From: Andrea Amorese Date: Wed, 6 Oct 2021 13:41:13 +0000 (+0200) Subject: Built motion from commit 51c26f9e.|2.5.36 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=2896a2728842c32753e380754e8d5af8a272371c;p=motion2.git Built motion from commit 51c26f9e.|2.5.36 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c22a90a..e3d4a53 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-06T13:09:28.781Z", + "time": "2021-10-06T13:27:58.293Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4b9c293..6e775ac 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-06T13:09:28.781Z", + "time": "2021-10-06T13:27:58.293Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index d68b756..d03a511 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 _0xa9dd=['motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x4a6a4c,_0x5149d1){var _0xdb0e5b=function(_0x319640){while(--_0x319640){_0x4a6a4c['push'](_0x4a6a4c['shift']());}};_0xdb0e5b(++_0x5149d1);}(_0xa9dd,0x1c2));var _0xda9d=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xa9dd[_0x564821];return _0x2b604d;};'use strict';var Sequelize=require('sequelize');module[_0xda9d('0x0')]={'name':{'type':Sequelize[_0xda9d('0x1')],'get':function(_0x4e6c23){return this[_0xda9d('0x2')](_0xda9d('0x3'));}},'action':{'type':Sequelize[_0xda9d('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xda9d('0x5'),'integration',_0xda9d('0x6'),_0xda9d('0x7'),'urlForward',_0xda9d('0x8'),_0xda9d('0x9'),_0xda9d('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xda9d('0xb')},'data1':{'type':Sequelize[_0xda9d('0x4')](0x1000),'comment':_0xda9d('0xc')},'data2':{'type':Sequelize[_0xda9d('0x4')](0x1000),'comment':_0xda9d('0xd')},'data3':{'type':Sequelize[_0xda9d('0x4')](0x1000),'comment':_0xda9d('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xda9d('0x4')](0x1000),'comments':_0xda9d('0xf')},'data6':{'type':Sequelize[_0xda9d('0x4')],'comments':_0xda9d('0x10')},'data7':{'type':Sequelize[_0xda9d('0x11')],'comments':_0xda9d('0x12')}}; \ No newline at end of file +var _0x8420=['jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar'];(function(_0x23c164,_0xe4d8f8){var _0xc2666c=function(_0x7cecf2){while(--_0x7cecf2){_0x23c164['push'](_0x23c164['shift']());}};_0xc2666c(++_0xe4d8f8);}(_0x8420,0xbe));var _0x0842=function(_0x27f3a4,_0x246b29){_0x27f3a4=_0x27f3a4-0x0;var _0x462541=_0x8420[_0x27f3a4];return _0x462541;};'use strict';var Sequelize=require(_0x0842('0x0'));module[_0x0842('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x515af2){return this[_0x0842('0x2')](_0x0842('0x3'));}},'action':{'type':Sequelize[_0x0842('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0842('0x5'),_0x0842('0x6'),_0x0842('0x7'),_0x0842('0x8'),_0x0842('0x9'),_0x0842('0xa'),_0x0842('0xb'),_0x0842('0xc')]],'msg':_0x0842('0xd')}},'comment':_0x0842('0xd')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x0842('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x0842('0xf')},'data3':{'type':Sequelize[_0x0842('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x0842('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x0842('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x0842('0x10')},'data7':{'type':Sequelize[_0x0842('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6142390..7c61acb 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 _0xc6f2=['body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name'];(function(_0x55d697,_0x2d3b37){var _0x1fc3f9=function(_0x13e1e5){while(--_0x13e1e5){_0x55d697['push'](_0x55d697['shift']());}};_0x1fc3f9(++_0x2d3b37);}(_0xc6f2,0xfa));var _0x2c6f=function(_0x592820,_0x1df77a){_0x592820=_0x592820-0x0;var _0x43d13e=_0xc6f2[_0x592820];return _0x43d13e;};'use strict';var emlformat=require(_0x2c6f('0x0'));var rimraf=require(_0x2c6f('0x1'));var zipdir=require(_0x2c6f('0x2'));var jsonpatch=require(_0x2c6f('0x3'));var rp=require(_0x2c6f('0x4'));var moment=require(_0x2c6f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c6f('0x6'));var util=require('util');var path=require(_0x2c6f('0x7'));var sox=require(_0x2c6f('0x8'));var csv=require(_0x2c6f('0x9'));var ejs=require(_0x2c6f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c6f('0xb'));var squel=require(_0x2c6f('0xc'));var crypto=require(_0x2c6f('0xd'));var jsforce=require(_0x2c6f('0xe'));var deskjs=require(_0x2c6f('0xf'));var toCsv=require(_0x2c6f('0x9'));var querystring=require(_0x2c6f('0x10'));var Papa=require('papaparse');var Redis=require(_0x2c6f('0x11'));var authService=require(_0x2c6f('0x12'));var qs=require(_0x2c6f('0x13'));var as=require(_0x2c6f('0x14'));var hardwareService=require(_0x2c6f('0x15'));var logger=require(_0x2c6f('0x16'))(_0x2c6f('0x17'));var utils=require('../../config/utils');var config=require(_0x2c6f('0x18'));var licenseUtil=require(_0x2c6f('0x19'));var db=require(_0x2c6f('0x1a'))['db'];function respondWithStatusCode(_0x46677e,_0x49dc83){_0x49dc83=_0x49dc83||0xcc;return function(_0x304e61){if(_0x304e61){return _0x46677e['sendStatus'](_0x49dc83);}return _0x46677e[_0x2c6f('0x1b')](_0x49dc83)[_0x2c6f('0x1c')]();};}function respondWithResult(_0x2ef7a7,_0x2583ca){_0x2583ca=_0x2583ca||0xc8;return function(_0x47d7d6){if(_0x47d7d6){return _0x2ef7a7['status'](_0x2583ca)[_0x2c6f('0x1d')](_0x47d7d6);}};}function respondWithFilteredResult(_0xef996f,_0x581f6f){return function(_0x4adb2b){if(_0x4adb2b){var _0x5cec38=typeof _0x581f6f[_0x2c6f('0x1e')]===_0x2c6f('0x1f')&&typeof _0x581f6f[_0x2c6f('0x20')]===_0x2c6f('0x1f');var _0x4d9dc7=_0x4adb2b[_0x2c6f('0x21')];var _0x233710=_0x5cec38?0x0:_0x581f6f[_0x2c6f('0x1e')];var _0x114047=_0x5cec38?_0x4adb2b[_0x2c6f('0x21')]:_0x581f6f[_0x2c6f('0x1e')]+_0x581f6f[_0x2c6f('0x20')];var _0x79a69b;if(_0x114047>=_0x4d9dc7){_0x114047=_0x4d9dc7;_0x79a69b=0xc8;}else{_0x79a69b=0xce;}_0xef996f[_0x2c6f('0x1b')](_0x79a69b);return _0xef996f[_0x2c6f('0x22')](_0x2c6f('0x23'),_0x233710+'-'+_0x114047+'/'+_0x4d9dc7)[_0x2c6f('0x1d')](_0x4adb2b);}return null;};}function patchUpdates(_0x4a2b5b){return function(_0x390a45){try{jsonpatch[_0x2c6f('0x24')](_0x390a45,_0x4a2b5b,!![]);}catch(_0x5b5258){return BPromise['reject'](_0x5b5258);}return _0x390a45[_0x2c6f('0x25')]();};}function saveUpdates(_0xa49450,_0x4485c4){return function(_0x1a31ab){if(_0x1a31ab){return _0x1a31ab[_0x2c6f('0x26')](_0xa49450)[_0x2c6f('0x27')](function(_0x4f2fa9){return _0x4f2fa9;});}return null;};}function removeEntity(_0x2326dc,_0x36a940){return function(_0x12a79f){if(_0x12a79f){return _0x12a79f['destroy']()['then'](function(){_0x2326dc[_0x2c6f('0x1b')](0xcc)[_0x2c6f('0x1c')]();});}};}function handleEntityNotFound(_0x3b3032,_0x306c62){return function(_0x357834){if(!_0x357834){_0x3b3032[_0x2c6f('0x28')](0x194);}return _0x357834;};}function handleError(_0x5ab25a,_0x597581){_0x597581=_0x597581||0x1f4;return function(_0x2dd13c){logger[_0x2c6f('0x29')](_0x2dd13c[_0x2c6f('0x2a')]);if(_0x2dd13c['name']){delete _0x2dd13c[_0x2c6f('0x2b')];}_0x5ab25a[_0x2c6f('0x1b')](_0x597581)['send'](_0x2dd13c);};}exports['update']=function(_0x56c69c,_0x41a264){if(_0x56c69c[_0x2c6f('0x2c')]['id']){delete _0x56c69c['body']['id'];}return db[_0x2c6f('0x2d')][_0x2c6f('0x2e')]({'where':{'id':_0x56c69c[_0x2c6f('0x2f')]['id']}})[_0x2c6f('0x27')](handleEntityNotFound(_0x41a264,null))[_0x2c6f('0x27')](saveUpdates(_0x56c69c[_0x2c6f('0x2c')],null))[_0x2c6f('0x27')](respondWithResult(_0x41a264,null))[_0x2c6f('0x30')](handleError(_0x41a264,null));};exports['destroy']=function(_0x10518b,_0x3dcd28){return db[_0x2c6f('0x2d')][_0x2c6f('0x2e')]({'where':{'id':_0x10518b['params']['id']}})[_0x2c6f('0x27')](handleEntityNotFound(_0x3dcd28,null))['then'](removeEntity(_0x3dcd28,null))[_0x2c6f('0x30')](handleError(_0x3dcd28,null));}; \ No newline at end of file +var _0x5281=['offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','find','params','catch','eml-format','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','json'];(function(_0x91143b,_0x4eb071){var _0x283b44=function(_0x22d73a){while(--_0x22d73a){_0x91143b['push'](_0x91143b['shift']());}};_0x283b44(++_0x4eb071);}(_0x5281,0x1d6));var _0x1528=function(_0xca80bb,_0x5bdfb1){_0xca80bb=_0xca80bb-0x0;var _0x2cf377=_0x5281[_0xca80bb];return _0x2cf377;};'use strict';var emlformat=require(_0x1528('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1528('0x1'));var moment=require(_0x1528('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1528('0x3'));var util=require(_0x1528('0x4'));var path=require(_0x1528('0x5'));var sox=require(_0x1528('0x6'));var csv=require('to-csv');var ejs=require(_0x1528('0x7'));var fs=require('fs');var fs_extra=require(_0x1528('0x8'));var _=require(_0x1528('0x9'));var squel=require('squel');var crypto=require(_0x1528('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1528('0xb'));var querystring=require(_0x1528('0xc'));var Papa=require(_0x1528('0xd'));var Redis=require(_0x1528('0xe'));var authService=require(_0x1528('0xf'));var qs=require(_0x1528('0x10'));var as=require(_0x1528('0x11'));var hardwareService=require(_0x1528('0x12'));var logger=require(_0x1528('0x13'))('api');var utils=require(_0x1528('0x14'));var config=require(_0x1528('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c5c4b,_0x1c4f1e){_0x1c4f1e=_0x1c4f1e||0xcc;return function(_0x1e63b6){if(_0x1e63b6){return _0x2c5c4b[_0x1528('0x16')](_0x1c4f1e);}return _0x2c5c4b['status'](_0x1c4f1e)[_0x1528('0x17')]();};}function respondWithResult(_0x581308,_0xe7b708){_0xe7b708=_0xe7b708||0xc8;return function(_0x4876b2){if(_0x4876b2){return _0x581308['status'](_0xe7b708)[_0x1528('0x18')](_0x4876b2);}};}function respondWithFilteredResult(_0x1d3d42,_0x18134f){return function(_0x1a636d){if(_0x1a636d){var _0x1d7675=typeof _0x18134f[_0x1528('0x19')]===_0x1528('0x1a')&&typeof _0x18134f[_0x1528('0x1b')]===_0x1528('0x1a');var _0x5b8be5=_0x1a636d[_0x1528('0x1c')];var _0x3e65c4=_0x1d7675?0x0:_0x18134f[_0x1528('0x19')];var _0x2ecbdf=_0x1d7675?_0x1a636d['count']:_0x18134f[_0x1528('0x19')]+_0x18134f[_0x1528('0x1b')];var _0x23f47b;if(_0x2ecbdf>=_0x5b8be5){_0x2ecbdf=_0x5b8be5;_0x23f47b=0xc8;}else{_0x23f47b=0xce;}_0x1d3d42[_0x1528('0x1d')](_0x23f47b);return _0x1d3d42['set'](_0x1528('0x1e'),_0x3e65c4+'-'+_0x2ecbdf+'/'+_0x5b8be5)[_0x1528('0x18')](_0x1a636d);}return null;};}function patchUpdates(_0x405a8e){return function(_0x372b09){try{jsonpatch[_0x1528('0x1f')](_0x372b09,_0x405a8e,!![]);}catch(_0x545a02){return BPromise[_0x1528('0x20')](_0x545a02);}return _0x372b09[_0x1528('0x21')]();};}function saveUpdates(_0x52c7e7,_0x2867a0){return function(_0xa9fa4d){if(_0xa9fa4d){return _0xa9fa4d[_0x1528('0x22')](_0x52c7e7)[_0x1528('0x23')](function(_0x4b18c5){return _0x4b18c5;});}return null;};}function removeEntity(_0x42830e,_0x281adc){return function(_0x12746c){if(_0x12746c){return _0x12746c[_0x1528('0x24')]()['then'](function(){_0x42830e[_0x1528('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x167ba6,_0x1f33a0){return function(_0x17e24f){if(!_0x17e24f){_0x167ba6[_0x1528('0x16')](0x194);}return _0x17e24f;};}function handleError(_0x4537a5,_0x54e993){_0x54e993=_0x54e993||0x1f4;return function(_0x3e7868){logger[_0x1528('0x25')](_0x3e7868[_0x1528('0x26')]);if(_0x3e7868[_0x1528('0x27')]){delete _0x3e7868[_0x1528('0x27')];}_0x4537a5[_0x1528('0x1d')](_0x54e993)[_0x1528('0x28')](_0x3e7868);};}exports[_0x1528('0x22')]=function(_0x3a6766,_0x2ac4b3){if(_0x3a6766['body']['id']){delete _0x3a6766[_0x1528('0x29')]['id'];}return db['Action'][_0x1528('0x2a')]({'where':{'id':_0x3a6766[_0x1528('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2ac4b3,null))[_0x1528('0x23')](saveUpdates(_0x3a6766[_0x1528('0x29')],null))[_0x1528('0x23')](respondWithResult(_0x2ac4b3,null))[_0x1528('0x2c')](handleError(_0x2ac4b3,null));};exports[_0x1528('0x24')]=function(_0x5859ac,_0x2f3e7f){return db['Action'][_0x1528('0x2a')]({'where':{'id':_0x5859ac['params']['id']}})[_0x1528('0x23')](handleEntityNotFound(_0x2f3e7f,null))[_0x1528('0x23')](removeEntity(_0x2f3e7f,null))[_0x1528('0x2c')](handleError(_0x2f3e7f,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ed8fba7..2aeda96 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 _0x71d3=['lodash','util','../../config/logger','api','moment','bluebird','path','./action.attributes','exports','define','Action','tools_actions'];(function(_0x41e72c,_0x5d38dc){var _0x877b0=function(_0x3c6fb4){while(--_0x3c6fb4){_0x41e72c['push'](_0x41e72c['shift']());}};_0x877b0(++_0x5d38dc);}(_0x71d3,0xb4));var _0x371d=function(_0x2c356f,_0xfd05e2){_0x2c356f=_0x2c356f-0x0;var _0x4f1294=_0x71d3[_0x2c356f];return _0x4f1294;};'use strict';var _=require(_0x371d('0x0'));var util=require(_0x371d('0x1'));var logger=require(_0x371d('0x2'))(_0x371d('0x3'));var moment=require(_0x371d('0x4'));var BPromise=require(_0x371d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x371d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x371d('0x7'));module[_0x371d('0x8')]=function(_0x560370,_0x13be14){return _0x560370[_0x371d('0x9')](_0x371d('0xa'),attributes,{'tableName':_0x371d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x238e=['request-promise','rimraf','exports','define','Action','lodash','util','../../config/logger','moment','bluebird'];(function(_0x594983,_0x52e4ea){var _0x4e63d4=function(_0x2913d7){while(--_0x2913d7){_0x594983['push'](_0x594983['shift']());}};_0x4e63d4(++_0x52e4ea);}(_0x238e,0x69));var _0xe238=function(_0x44bac8,_0x4d3691){_0x44bac8=_0x44bac8-0x0;var _0x13f823=_0x238e[_0x44bac8];return _0x13f823;};'use strict';var _=require(_0xe238('0x0'));var util=require(_0xe238('0x1'));var logger=require(_0xe238('0x2'))('api');var moment=require(_0xe238('0x3'));var BPromise=require(_0xe238('0x4'));var rp=require(_0xe238('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe238('0x6'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xe238('0x7')]=function(_0x54d40c,_0x3de486){return _0x54d40c[_0xe238('0x8')](_0xe238('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 65d99c0..4e02c91 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26a515,_0x286339){var _0x314682=function(_0x501b51){while(--_0x501b51){_0x26a515['push'](_0x26a515['shift']());}};_0x314682(++_0x286339);}(_0x5fab,0x177));var _0xb5fa=function(_0x809314,_0xaf27c0){_0x809314=_0x809314-0x0;var _0x1a94b6=_0x5fab[_0x809314];return _0x1a94b6;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _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(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x7217,0x19e));var _0x7721=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7217[_0x484e36];return _0xafc85d;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index d9c44e1..ca80377 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 _0x3172=['delete','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x1b68ba,_0x23687a){var _0xf49b11=function(_0x5732c6){while(--_0x5732c6){_0x1b68ba['push'](_0x1b68ba['shift']());}};_0xf49b11(++_0x23687a);}(_0x3172,0x120));var _0x2317=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x3172[_0x7feb90];return _0x3c5b33;};'use strict';var multer=require(_0x2317('0x0'));var util=require('util');var path=require(_0x2317('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2317('0x2'));var auth=require(_0x2317('0x3'));var interaction=require(_0x2317('0x4'));var config=require(_0x2317('0x5'));var controller=require(_0x2317('0x6'));router[_0x2317('0x7')](_0x2317('0x8'),auth[_0x2317('0x9')](),controller[_0x2317('0xa')]);router[_0x2317('0xb')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2317('0xc')]=router; \ No newline at end of file +var _0x2900=['Router','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x332998,_0x2d99c7){var _0x460be7=function(_0x1a4d24){while(--_0x1a4d24){_0x332998['push'](_0x332998['shift']());}};_0x460be7(++_0x2d99c7);}(_0x2900,0x18c));var _0x0290=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x2900[_0x3e8cae];return _0x45c4d6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0290('0x0')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0290('0x1'));var config=require(_0x0290('0x2'));var controller=require('./action.controller');router[_0x0290('0x3')](_0x0290('0x4'),auth[_0x0290('0x5')](),controller['update']);router[_0x0290('0x6')](_0x0290('0x4'),auth[_0x0290('0x5')](),controller[_0x0290('0x7')]);module[_0x0290('0x8')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 8951ece..72eb8f7 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 _0x71ab=['TEXT','exports','STRING'];(function(_0x8d8786,_0x4eaced){var _0x548894=function(_0x7a8f9){while(--_0x7a8f9){_0x8d8786['push'](_0x8d8786['shift']());}};_0x548894(++_0x4eaced);}(_0x71ab,0x64));var _0xb71a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x71ab[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x46ed,0x168));var _0xd46e=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x46ed[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a5e79bf..9a2451b 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 _0x84dd=['apply','save','update','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','length','model','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','findAll','rows','catch','params','fields','includeAll','include','create','body','role','user','Reports','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','getFields','replace','output','web','%s-%s.%s','randomstring','generate','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','fork','../../components/export/','../../files/reports','COUNT(*)','run','runReport','DATE(%s)','Please\x20insert\x20at\x20least\x20one\x20field','from','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','crypto','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x141b71,_0x2990ea){var _0x2b5c3d=function(_0x346377){while(--_0x346377){_0x141b71['push'](_0x141b71['shift']());}};_0x2b5c3d(++_0x2990ea);}(_0x84dd,0x1bc));var _0xd84d=function(_0x2b30dd,_0x2fef30){_0x2b30dd=_0x2b30dd-0x0;var _0x55504e=_0x84dd[_0x2b30dd];return _0x55504e;};'use strict';var emlformat=require(_0xd84d('0x0'));var rimraf=require(_0xd84d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd84d('0x2'));var rp=require(_0xd84d('0x3'));var moment=require('moment');var BPromise=require(_0xd84d('0x4'));var Mustache=require('mustache');var util=require(_0xd84d('0x5'));var path=require(_0xd84d('0x6'));var sox=require(_0xd84d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd84d('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd84d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd84d('0xa'));var querystring=require(_0xd84d('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd84d('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd84d('0xd'))(_0xd84d('0xe'));var utils=require(_0xd84d('0xf'));var config=require(_0xd84d('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xd84d('0x11'))['dbH'];function respondWithStatusCode(_0x8b734f,_0x3287fd){_0x3287fd=_0x3287fd||0xcc;return function(_0x2e35ba){if(_0x2e35ba){return _0x8b734f[_0xd84d('0x12')](_0x3287fd);}return _0x8b734f[_0xd84d('0x13')](_0x3287fd)['end']();};}function respondWithResult(_0x7511ac,_0x4601d1){_0x4601d1=_0x4601d1||0xc8;return function(_0x43ff15){if(_0x43ff15){return _0x7511ac[_0xd84d('0x13')](_0x4601d1)['json'](_0x43ff15);}};}function respondWithFilteredResult(_0x555ff1,_0x521384){return function(_0x5dfcb5){if(_0x5dfcb5){var _0x4b1041=typeof _0x521384[_0xd84d('0x14')]===_0xd84d('0x15')&&typeof _0x521384[_0xd84d('0x16')]===_0xd84d('0x15');var _0x12bea7=_0x5dfcb5['count'];var _0x19c629=_0x4b1041?0x0:_0x521384[_0xd84d('0x14')];var _0x574139=_0x4b1041?_0x5dfcb5[_0xd84d('0x17')]:_0x521384[_0xd84d('0x14')]+_0x521384[_0xd84d('0x16')];var _0x5cba14;if(_0x574139>=_0x12bea7){_0x574139=_0x12bea7;_0x5cba14=0xc8;}else{_0x5cba14=0xce;}_0x555ff1[_0xd84d('0x13')](_0x5cba14);return _0x555ff1[_0xd84d('0x18')](_0xd84d('0x19'),_0x19c629+'-'+_0x574139+'/'+_0x12bea7)[_0xd84d('0x1a')](_0x5dfcb5);}return null;};}function patchUpdates(_0x1a3242){return function(_0x2fb987){try{jsonpatch[_0xd84d('0x1b')](_0x2fb987,_0x1a3242,!![]);}catch(_0x28a33d){return BPromise['reject'](_0x28a33d);}return _0x2fb987[_0xd84d('0x1c')]();};}function saveUpdates(_0x3a8113,_0x57f6f9){return function(_0x1ca5a4){if(_0x1ca5a4){return _0x1ca5a4[_0xd84d('0x1d')](_0x3a8113)[_0xd84d('0x1e')](function(_0x3cf73a){return _0x3cf73a;});}return null;};}function removeEntity(_0x43ffbc,_0x17252e){return function(_0x5d980e){if(_0x5d980e){return _0x5d980e[_0xd84d('0x1f')]()[_0xd84d('0x1e')](function(){var _0x4978e6=_0x5d980e[_0xd84d('0x20')]({'plain':!![]});var _0x190a08=_0xd84d('0x21');return db[_0xd84d('0x22')]['destroy']({'where':{'type':_0x190a08,'resourceId':_0x4978e6['id']}})['then'](function(){return _0x5d980e;});})[_0xd84d('0x1e')](function(){_0x43ffbc['status'](0xcc)[_0xd84d('0x23')]();});}};}function handleEntityNotFound(_0x594612,_0x5877cd){return function(_0x5e375a){if(!_0x5e375a){_0x594612[_0xd84d('0x12')](0x194);}return _0x5e375a;};}function handleError(_0x5811d4,_0x44487f){_0x44487f=_0x44487f||0x1f4;return function(_0x4361e8){logger['error'](_0x4361e8[_0xd84d('0x24')]);if(_0x4361e8[_0xd84d('0x25')]){delete _0x4361e8[_0xd84d('0x25')];}_0x5811d4['status'](_0x44487f)[_0xd84d('0x26')](_0x4361e8);};}exports['index']=function(_0x3e3328,_0x3079a3){var _0x2c1fea={},_0x364b7f={},_0x169a64={'count':0x0,'rows':[]};var _0x336f80=_[_0xd84d('0x27')](db[_0xd84d('0x28')][_0xd84d('0x29')],function(_0x74e2b8){return{'name':_0x74e2b8[_0xd84d('0x2a')],'type':_0x74e2b8[_0xd84d('0x2b')][_0xd84d('0x2c')]};});_0x364b7f['model']=_[_0xd84d('0x27')](_0x336f80,_0xd84d('0x25'));_0x364b7f[_0xd84d('0x2d')]=_[_0xd84d('0x2e')](_0x3e3328[_0xd84d('0x2d')]);_0x364b7f[_0xd84d('0x2f')]=_['intersection'](_0x364b7f['model'],_0x364b7f[_0xd84d('0x2d')]);_0x2c1fea[_0xd84d('0x30')]=_[_0xd84d('0x31')](_0x364b7f['model'],qs['fields'](_0x3e3328[_0xd84d('0x2d')]['fields']));_0x2c1fea[_0xd84d('0x30')]=_0x2c1fea[_0xd84d('0x30')][_0xd84d('0x32')]?_0x2c1fea[_0xd84d('0x30')]:_0x364b7f[_0xd84d('0x33')];if(!_0x3e3328[_0xd84d('0x2d')]['hasOwnProperty'](_0xd84d('0x34'))){_0x2c1fea['limit']=qs[_0xd84d('0x16')](_0x3e3328[_0xd84d('0x2d')][_0xd84d('0x16')]);_0x2c1fea[_0xd84d('0x14')]=qs[_0xd84d('0x14')](_0x3e3328[_0xd84d('0x2d')]['offset']);}_0x2c1fea[_0xd84d('0x35')]=qs[_0xd84d('0x36')](_0x3e3328[_0xd84d('0x2d')][_0xd84d('0x36')]);_0x2c1fea['where']=qs[_0xd84d('0x2f')](_[_0xd84d('0x37')](_0x3e3328[_0xd84d('0x2d')],_0x364b7f[_0xd84d('0x2f')]),_0x336f80);if(_0x3e3328[_0xd84d('0x2d')][_0xd84d('0x38')]){_0x2c1fea['where']=_['merge'](_0x2c1fea['where'],{'$or':_[_0xd84d('0x27')](_0x336f80,function(_0x1a661a){if(_0x1a661a[_0xd84d('0x2b')]!==_0xd84d('0x39')){var _0x55c717={};_0x55c717[_0x1a661a[_0xd84d('0x25')]]={'$like':'%'+_0x3e3328[_0xd84d('0x2d')][_0xd84d('0x38')]+'%'};return _0x55c717;}})});}_0x2c1fea=_[_0xd84d('0x3a')]({},_0x2c1fea,_0x3e3328[_0xd84d('0x3b')]);var _0x5e224b={'where':_0x2c1fea[_0xd84d('0x3c')]};return db[_0xd84d('0x28')][_0xd84d('0x17')](_0x5e224b)[_0xd84d('0x1e')](function(_0x1b2407){_0x169a64[_0xd84d('0x17')]=_0x1b2407;if(_0x3e3328[_0xd84d('0x2d')]['includeAll']){_0x2c1fea['include']=[{'all':!![]}];}return db[_0xd84d('0x28')][_0xd84d('0x3d')](_0x2c1fea);})['then'](function(_0x4e7b55){_0x169a64[_0xd84d('0x3e')]=_0x4e7b55;return _0x169a64;})[_0xd84d('0x1e')](respondWithFilteredResult(_0x3079a3,_0x2c1fea))[_0xd84d('0x3f')](handleError(_0x3079a3,null));};exports['show']=function(_0x23c911,_0x27bebd){var _0xf2735c={'raw':![],'where':{'id':_0x23c911[_0xd84d('0x40')]['id']}},_0x2d6ef3={};_0x2d6ef3['model']=_[_0xd84d('0x2e')](db[_0xd84d('0x28')]['rawAttributes']);_0x2d6ef3[_0xd84d('0x2d')]=_[_0xd84d('0x2e')](_0x23c911[_0xd84d('0x2d')]);_0x2d6ef3[_0xd84d('0x2f')]=_[_0xd84d('0x31')](_0x2d6ef3[_0xd84d('0x33')],_0x2d6ef3['query']);_0xf2735c[_0xd84d('0x30')]=_['intersection'](_0x2d6ef3[_0xd84d('0x33')],qs['fields'](_0x23c911['query'][_0xd84d('0x41')]));_0xf2735c[_0xd84d('0x30')]=_0xf2735c[_0xd84d('0x30')][_0xd84d('0x32')]?_0xf2735c[_0xd84d('0x30')]:_0x2d6ef3[_0xd84d('0x33')];if(_0x23c911[_0xd84d('0x2d')][_0xd84d('0x42')]){_0xf2735c[_0xd84d('0x43')]=[{'all':!![]}];}_0xf2735c=_['merge']({},_0xf2735c,_0x23c911[_0xd84d('0x3b')]);return db[_0xd84d('0x28')]['find'](_0xf2735c)[_0xd84d('0x1e')](handleEntityNotFound(_0x27bebd,null))[_0xd84d('0x1e')](respondWithResult(_0x27bebd,null))[_0xd84d('0x3f')](handleError(_0x27bebd,null));};exports['create']=function(_0x299a9e,_0x3a2e0d){return db[_0xd84d('0x28')][_0xd84d('0x44')](_0x299a9e[_0xd84d('0x45')],{})[_0xd84d('0x1e')](function(_0x10e904){var _0xd7cce8=_0x299a9e['user']['get']({'plain':!![]});if(!_0xd7cce8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd7cce8[_0xd84d('0x46')]===_0xd84d('0x47')){var _0x38b3c6=_0x10e904[_0xd84d('0x20')]({'plain':!![]});var _0x452285=_0xd84d('0x48');return db[_0xd84d('0x49')][_0xd84d('0x4a')]({'where':{'name':_0x452285,'userProfileId':_0xd7cce8['userProfileId']},'raw':!![]})[_0xd84d('0x1e')](function(_0x661420){if(_0x661420&&_0x661420[_0xd84d('0x4b')]===0x0){return db[_0xd84d('0x22')][_0xd84d('0x44')]({'name':_0x38b3c6['name'],'resourceId':_0x38b3c6['id'],'type':_0xd84d('0x21'),'sectionId':_0x661420['id']},{})[_0xd84d('0x1e')](function(){return _0x10e904;});}else{return _0x10e904;}})[_0xd84d('0x3f')](function(_0xb5f0a6){logger[_0xd84d('0x4c')](_0xd84d('0x4d'),_0xb5f0a6);throw _0xb5f0a6;});}return _0x10e904;})['then'](respondWithResult(_0x3a2e0d,0xc9))[_0xd84d('0x3f')](handleError(_0x3a2e0d,null));};exports[_0xd84d('0x1d')]=function(_0x22ec12,_0x3787d2){if(_0x22ec12[_0xd84d('0x45')]['id']){delete _0x22ec12[_0xd84d('0x45')]['id'];}return db['AnalyticCustomReport'][_0xd84d('0x4a')]({'where':{'id':_0x22ec12[_0xd84d('0x40')]['id']}})['then'](handleEntityNotFound(_0x3787d2,null))[_0xd84d('0x1e')](saveUpdates(_0x22ec12[_0xd84d('0x45')],null))[_0xd84d('0x1e')](respondWithResult(_0x3787d2,null))[_0xd84d('0x3f')](handleError(_0x3787d2,null));};exports[_0xd84d('0x1f')]=function(_0x5051f8,_0x21720d){return db[_0xd84d('0x28')][_0xd84d('0x4a')]({'where':{'id':_0x5051f8[_0xd84d('0x40')]['id']}})[_0xd84d('0x1e')](handleEntityNotFound(_0x21720d,null))[_0xd84d('0x1e')](removeEntity(_0x21720d,null))[_0xd84d('0x3f')](handleError(_0x21720d,null));};exports[_0xd84d('0x4e')]=function(_0xa53491,_0xbf9ae6){var _0x380e60=0xa;var _0x3616fa=['join',_0xd84d('0x4f'),_0xd84d('0x50'),_0xd84d('0x51')];var _0x2831f6={'SUM':_0xd84d('0x52'),'COUNT':_0xd84d('0x53'),'COUNT DISTINCT':_0xd84d('0x54'),'MAX':'MAX(%s)','MIN':_0xd84d('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd84d('0x56'),'GROUP_CONCAT ASC':_0xd84d('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2d7705={'SEC_TO_TIME':_0xd84d('0x58'),'DATE':'DATE(%s)','HOUR':_0xd84d('0x59'),'ROUND':_0xd84d('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x9038a3=function(_0x510f13){return!_['includes'](['IS\x20NULL',_0xd84d('0x5b'),_0xd84d('0x5c'),'IS\x20NOT\x20EMPTY'],_0x510f13);};var _0x4435d3=function(_0x294602){if(!_0x294602||!_0x294602[_0xd84d('0x5d')][_0xd84d('0x32')]){return'';}for(var _0x447f85='(',_0x3f0a5a=0x0;_0x3f0a5a<_0x294602['rules'][_0xd84d('0x32')];_0x3f0a5a+=0x1){_0x3f0a5a>0x0&&(_0x447f85+='\x20'+_0x294602[_0xd84d('0x5e')]+'\x20');_0x447f85+=_0x294602['rules'][_0x3f0a5a][_0xd84d('0x5f')]?_0x4435d3(_0x294602['rules'][_0x3f0a5a]['group']):_0x294602[_0xd84d('0x5d')][_0x3f0a5a][_0xd84d('0x60')]+'\x20'+_0x294602[_0xd84d('0x5d')][_0x3f0a5a][_0xd84d('0x61')]+(_0x9038a3(_0x294602['rules'][_0x3f0a5a][_0xd84d('0x61')])?'\x20'+_0x294602[_0xd84d('0x5d')][_0x3f0a5a][_0xd84d('0x62')]:'');}return _0x447f85+')';};var _0x38e9f6={'where':{'id':_0xa53491['params']['id']}},_0x4c0da6,_0x390046,_0x2762f2,_0x421df5,_0x2ed66f;_0x38e9f6=_['merge']({},_0x38e9f6,_0xa53491[_0xd84d('0x3b')]);return db[_0xd84d('0x28')][_0xd84d('0x4a')](_0x38e9f6)[_0xd84d('0x1e')](function(_0x371945){if(_0x371945){_0x4c0da6=_0x371945;return _0x371945['getFields']();}return null;})[_0xd84d('0x1e')](function(_0x31063b){if(_0x31063b){if(!_0x31063b[_0xd84d('0x32')]){throw new db[(_0xd84d('0x63'))][(_0xd84d('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x390046=_0x31063b;return db[_0xd84d('0x65')]['findAll']({'raw':!![]});}return null;})[_0xd84d('0x1e')](function(_0x44c171){if(_0x44c171){_0x2762f2=_[_0xd84d('0x66')](_0x44c171,'id');var _0x5f4004;var _0x23e589=squel[_0xd84d('0x67')]();_0x23e589['from'](_0x4c0da6[_0xd84d('0x68')]);for(var _0x241a03=0x0;_0x241a03<_0x390046[_0xd84d('0x32')];_0x241a03+=0x1){_0x5f4004=_0x390046[_0x241a03]['MetricId']?_0x2762f2[_0x390046[_0x241a03][_0xd84d('0x69')]][_0xd84d('0x6a')]:_0x390046[_0x241a03][_0xd84d('0x60')];_0x5f4004=_0x390046[_0x241a03]['function']?_['replace'](_0x2831f6[_0x390046[_0x241a03][_0xd84d('0x6b')]],'%s',_0x5f4004):_0x5f4004;_0x5f4004=_0x390046[_0x241a03][_0xd84d('0x6c')]?_['replace'](_0x2d7705[_0x390046[_0x241a03][_0xd84d('0x6c')]],'%s',_0x5f4004):_0x5f4004;if(_0x390046[_0x241a03][_0xd84d('0x6d')]){_0x23e589[_0xd84d('0x5f')](_0x5f4004);}_0x390046[_0x241a03][_0xd84d('0x6e')]&&_0x23e589[_0xd84d('0x35')](_0x5f4004,_0x390046[_0x241a03]['orderBy']===_0xd84d('0x6f')?![]:!![]);_0x23e589[_0xd84d('0x60')](_0x5f4004,_0x390046[_0x241a03][_0xd84d('0x70')]||_0x5f4004);}if(_0x4c0da6[_0xd84d('0x71')]){_0x4c0da6['joins']=JSON[_0xd84d('0x72')](_0x4c0da6['joins']);for(var _0x54bb54=0x0;_0x54bb54<_0x4c0da6[_0xd84d('0x71')][_0xd84d('0x32')];_0x54bb54+=0x1){if(_0x4c0da6[_0xd84d('0x71')][_0x54bb54][_0xd84d('0x2b')]&&_[_0xd84d('0x73')](_0x3616fa,_0x4c0da6[_0xd84d('0x71')][_0x54bb54]['type'])&&_0x4c0da6[_0xd84d('0x71')][_0x54bb54][_0xd84d('0x74')]&&_0x4c0da6[_0xd84d('0x71')][_0x54bb54][_0xd84d('0x75')]&&_0x4c0da6[_0xd84d('0x71')][_0x54bb54][_0xd84d('0x76')]){_0x23e589[_0x4c0da6['joins'][_0x54bb54][_0xd84d('0x2b')]](_0x4c0da6['joins'][_0x54bb54][_0xd84d('0x75')],null,util[_0xd84d('0x6c')](_0xd84d('0x77'),_0x4c0da6[_0xd84d('0x68')],_0x4c0da6[_0xd84d('0x71')][_0x54bb54][_0xd84d('0x74')],_0x4c0da6[_0xd84d('0x71')][_0x54bb54][_0xd84d('0x75')],_0x4c0da6[_0xd84d('0x71')][_0x54bb54]['foreignKey']));}}}if(_0x4c0da6[_0xd84d('0x78')]){_0x4c0da6[_0xd84d('0x78')]=JSON[_0xd84d('0x72')](_0x4c0da6['conditions']);_0x23e589[_0xd84d('0x3c')](_0x4435d3(_0x4c0da6[_0xd84d('0x78')][_0xd84d('0x5f')]));}_0x2ed66f=_0x23e589[_0xd84d('0x79')]();_0x23e589['limit'](_0x380e60);_0x23e589['offset'](0x0);logger[_0xd84d('0x7a')](_0xd84d('0x7b'),_0x23e589['toString']());return dbH[_0xd84d('0x7c')]['query'](_0x23e589[_0xd84d('0x7d')](),{'type':dbH[_0xd84d('0x7c')][_0xd84d('0x7e')][_0xd84d('0x7f')]});}})['then'](respondWithResult(_0xbf9ae6,null))[_0xd84d('0x3f')](handleError(_0xbf9ae6,null));};function runReport(_0x41fd5a,_0x46591d,_0x1e2cf8){var _0x1eebbe=_0x46591d[_0xd84d('0x25')];var _0x20d2aa=0xa;var _0x565ceb=[_0xd84d('0x80'),_0xd84d('0x4f'),_0xd84d('0x50'),_0xd84d('0x51')];var _0x2a9b80={'SUM':_0xd84d('0x52'),'COUNT':_0xd84d('0x53'),'COUNT DISTINCT':_0xd84d('0x54'),'MAX':_0xd84d('0x81'),'MIN':_0xd84d('0x55'),'AVG':_0xd84d('0x82'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd84d('0x57'),'GROUP_CONCAT DESC':_0xd84d('0x83')};var _0x124e1a={'SEC_TO_TIME':_0xd84d('0x58'),'DATE':'DATE(%s)','HOUR':_0xd84d('0x59'),'ROUND':_0xd84d('0x5a'),'UNIX_TIMESTAMP':_0xd84d('0x84')};var _0x182d3c=function(_0x544193){return!_[_0xd84d('0x73')]([_0xd84d('0x85'),_0xd84d('0x5b'),_0xd84d('0x5c'),_0xd84d('0x86')],_0x544193);};var _0x18fb8c=function(_0x2ba00d){if(!_0x2ba00d||!_0x2ba00d[_0xd84d('0x5d')]['length']){return'';}for(var _0x44ecd5='(',_0x299c3b=0x0;_0x299c3b<_0x2ba00d[_0xd84d('0x5d')][_0xd84d('0x32')];_0x299c3b+=0x1){_0x299c3b>0x0&&(_0x44ecd5+='\x20'+_0x2ba00d[_0xd84d('0x5e')]+'\x20');_0x44ecd5+=_0x2ba00d[_0xd84d('0x5d')][_0x299c3b]['group']?_0x18fb8c(_0x2ba00d[_0xd84d('0x5d')][_0x299c3b]['group']):_0x2ba00d['rules'][_0x299c3b][_0xd84d('0x60')]+'\x20'+_0x2ba00d[_0xd84d('0x5d')][_0x299c3b][_0xd84d('0x61')]+(_0x182d3c(_0x2ba00d['rules'][_0x299c3b][_0xd84d('0x61')])?'\x20'+_0x2ba00d['rules'][_0x299c3b][_0xd84d('0x62')]:'');}return _0x44ecd5+')';};var _0x260c47={'where':{'id':_0x41fd5a['id']}},_0x4cad81,_0xb9ec8,_0x264ee1,_0x188dd7,_0xc1601e;_0x260c47=_[_0xd84d('0x3a')]({},_0x260c47,_0x1e2cf8);return db[_0xd84d('0x28')][_0xd84d('0x4a')](_0x260c47)[_0xd84d('0x1e')](function(_0x355ef9){if(_0x355ef9){_0x4cad81=_0x355ef9;return _0x355ef9[_0xd84d('0x87')]();}return null;})[_0xd84d('0x1e')](function(_0x162f18){if(_0x162f18){if(!_0x162f18['length']){throw new db[(_0xd84d('0x63'))][(_0xd84d('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xb9ec8=_0x162f18;return db[_0xd84d('0x65')][_0xd84d('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x3da2e7){if(_0x3da2e7){_0x264ee1=_[_0xd84d('0x66')](_0x3da2e7,'id');var _0x304018;var _0x550890=squel[_0xd84d('0x67')]();_0x550890['from'](_0x4cad81[_0xd84d('0x68')]);for(var _0x255024=0x0;_0x255024<_0xb9ec8[_0xd84d('0x32')];_0x255024+=0x1){_0x304018=_0xb9ec8[_0x255024][_0xd84d('0x69')]?_0x264ee1[_0xb9ec8[_0x255024][_0xd84d('0x69')]][_0xd84d('0x6a')]:_0xb9ec8[_0x255024][_0xd84d('0x60')];_0x304018=_0xb9ec8[_0x255024]['function']?_[_0xd84d('0x88')](_0x2a9b80[_0xb9ec8[_0x255024]['function']],'%s',_0x304018):_0x304018;_0x304018=_0xb9ec8[_0x255024][_0xd84d('0x6c')]?_[_0xd84d('0x88')](_0x124e1a[_0xb9ec8[_0x255024][_0xd84d('0x6c')]],'%s',_0x304018):_0x304018;if(_0xb9ec8[_0x255024][_0xd84d('0x6d')]){_0x550890[_0xd84d('0x5f')](_0x304018);}_0xb9ec8[_0x255024][_0xd84d('0x6e')]&&_0x550890['order'](_0x304018,_0xb9ec8[_0x255024]['orderBy']==='DESC'?![]:!![]);_0x550890['field'](_0x304018,_0xb9ec8[_0x255024][_0xd84d('0x70')]||_0x304018);}if(_0x4cad81['joins']){_0x4cad81['joins']=JSON[_0xd84d('0x72')](_0x4cad81[_0xd84d('0x71')]);for(var _0x2eb732=0x0;_0x2eb732<_0x4cad81[_0xd84d('0x71')]['length'];_0x2eb732+=0x1){if(_0x4cad81[_0xd84d('0x71')][_0x2eb732][_0xd84d('0x2b')]&&_[_0xd84d('0x73')](_0x565ceb,_0x4cad81[_0xd84d('0x71')][_0x2eb732][_0xd84d('0x2b')])&&_0x4cad81[_0xd84d('0x71')][_0x2eb732][_0xd84d('0x74')]&&_0x4cad81[_0xd84d('0x71')][_0x2eb732][_0xd84d('0x75')]&&_0x4cad81[_0xd84d('0x71')][_0x2eb732][_0xd84d('0x76')]){_0x550890[_0x4cad81['joins'][_0x2eb732]['type']](_0x4cad81[_0xd84d('0x71')][_0x2eb732][_0xd84d('0x75')],null,util[_0xd84d('0x6c')](_0xd84d('0x77'),_0x4cad81[_0xd84d('0x68')],_0x4cad81[_0xd84d('0x71')][_0x2eb732]['parentKey'],_0x4cad81[_0xd84d('0x71')][_0x2eb732][_0xd84d('0x75')],_0x4cad81[_0xd84d('0x71')][_0x2eb732][_0xd84d('0x76')]));}}}if(_0x4cad81[_0xd84d('0x78')]){_0x4cad81[_0xd84d('0x78')]=JSON[_0xd84d('0x72')](_0x4cad81[_0xd84d('0x78')]);_0x550890[_0xd84d('0x3c')](_0x18fb8c(_0x4cad81[_0xd84d('0x78')][_0xd84d('0x5f')]));}_0xc1601e=_0x550890[_0xd84d('0x79')]();_0x550890[_0xd84d('0x16')](_0x20d2aa);_0x550890[_0xd84d('0x14')](0x0);return;}})[_0xd84d('0x1e')](function(){if(_0x46591d[_0xd84d('0x89')]===_0xd84d('0x8a')){return null;}var _0x14a876=_[_0xd84d('0x3a')](_0x46591d,{'name':_0x46591d['fullPath']||_0x46591d[_0xd84d('0x25')]||_0x4cad81[_0xd84d('0x25')],'basename':_0x1eebbe,'savename':util['format'](_0xd84d('0x8b'),_0x46591d[_0xd84d('0x25')]||_0x4cad81[_0xd84d('0x25')],require(_0xd84d('0x8c'))[_0xd84d('0x8d')](0x4),_0x46591d[_0xd84d('0x89')]||'csv'),'reportId':_0x4cad81['id'],'reportType':_0xd84d('0x8e')});return db['AnalyticExtractedReport']['create'](_0x14a876,{'raw':!![]});})[_0xd84d('0x1e')](function(_0x11443c){if(_0x4cad81[_0xd84d('0x68')]===_0xd84d('0x8f')){_0xc1601e['where'](_0x4cad81['table']+_0xd84d('0x90'),_0x46591d['startDate'],_0x46591d[_0xd84d('0x91')]);}else{_0xc1601e[_0xd84d('0x3c')](_0x4cad81[_0xd84d('0x68')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x46591d[_0xd84d('0x92')],_0x46591d[_0xd84d('0x91')]);}if(_0x11443c){logger[_0xd84d('0x93')]('Run\x20Query:',_0xc1601e['toString']());require('child_process')[_0xd84d('0x94')](path['join'](__dirname,_0xd84d('0x95'),_0x11443c[_0xd84d('0x89')]),[_0x11443c['id'],_0xc1601e[_0xd84d('0x7d')](),path['join'](__dirname,_0xd84d('0x96'),_0x11443c['savename']),_0x1eebbe]);return _0x11443c;}else{var _0x2fd58e=squel[_0xd84d('0x67')]();_0x2fd58e['from']('('+_0xc1601e[_0xd84d('0x7d')]()+')','countTable');_0x2fd58e[_0xd84d('0x60')](_0xd84d('0x97'),_0xd84d('0x17'));_0xc1601e[_0xd84d('0x16')](_0x46591d[_0xd84d('0x16')]||_0x20d2aa);_0xc1601e[_0xd84d('0x14')](_0x46591d[_0xd84d('0x14')]||0x0);return dbH['sequelize'][_0xd84d('0x2d')](_0x2fd58e[_0xd84d('0x7d')](),{'type':dbH['sequelize'][_0xd84d('0x7e')][_0xd84d('0x7f')]})[_0xd84d('0x1e')](function(_0x51c251){if(!_0x51c251[_0xd84d('0x32')]){_0x188dd7=0x0;}else{_0x188dd7=_0x51c251[0x0][_0xd84d('0x17')]||0x0;}return dbH['sequelize'][_0xd84d('0x2d')](_0xc1601e[_0xd84d('0x7d')](),{'type':dbH[_0xd84d('0x7c')]['QueryTypes']['SELECT']});})[_0xd84d('0x1e')](function(_0x3215b7){return{'rows':_0x3215b7||[],'count':_0x188dd7};});}});}exports[_0xd84d('0x98')]=function(_0x4ea645,_0x34ff78){return runReport(_0x4ea645['params'],_0x4ea645[_0xd84d('0x2d')],_0x4ea645['options'])[_0xd84d('0x1e')](respondWithResult(_0x34ff78,null))[_0xd84d('0x3f')](handleError(_0x34ff78,null));};exports[_0xd84d('0x99')]=runReport;exports[_0xd84d('0x2d')]=function(_0x43c480,_0x199315){var _0x3250fb=0xa;var _0xc95f9d=[_0xd84d('0x80'),_0xd84d('0x4f'),_0xd84d('0x50'),'cross_join'];var _0x5c9e4a={'SUM':'SUM(%s)','COUNT':_0xd84d('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd84d('0x81'),'MIN':_0xd84d('0x55'),'AVG':_0xd84d('0x82'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd84d('0x57'),'GROUP_CONCAT DESC':_0xd84d('0x83')};var _0x5a36ff={'SEC_TO_TIME':_0xd84d('0x58'),'DATE':_0xd84d('0x9a'),'HOUR':_0xd84d('0x59'),'ROUND':_0xd84d('0x5a'),'UNIX_TIMESTAMP':_0xd84d('0x84')};var _0x2977e9=function(_0x269227){return!_['includes']([_0xd84d('0x85'),_0xd84d('0x5b'),_0xd84d('0x5c'),_0xd84d('0x86')],_0x269227);};var _0xeca768=function(_0x3d1bec){if(!_0x3d1bec||!_0x3d1bec[_0xd84d('0x5d')][_0xd84d('0x32')]){return'';}for(var _0x574ac9='(',_0x362b22=0x0;_0x362b22<_0x3d1bec[_0xd84d('0x5d')][_0xd84d('0x32')];_0x362b22+=0x1){_0x362b22>0x0&&(_0x574ac9+='\x20'+_0x3d1bec[_0xd84d('0x5e')]+'\x20');_0x574ac9+=_0x3d1bec[_0xd84d('0x5d')][_0x362b22]['group']?_0xeca768(_0x3d1bec[_0xd84d('0x5d')][_0x362b22][_0xd84d('0x5f')]):_0x3d1bec[_0xd84d('0x5d')][_0x362b22][_0xd84d('0x60')]+'\x20'+_0x3d1bec[_0xd84d('0x5d')][_0x362b22][_0xd84d('0x61')]+(_0x2977e9(_0x3d1bec['rules'][_0x362b22]['condition'])?'\x20'+_0x3d1bec['rules'][_0x362b22]['value']:'');}return _0x574ac9+')';};var _0x31957e={'where':{'id':_0x43c480[_0xd84d('0x40')]['id']}},_0x382a1a,_0x5a0ba6,_0x5d4c55,_0xbbd98f,_0x191823;_0x31957e=_['merge']({},_0x31957e,_0x43c480[_0xd84d('0x3b')]);return db[_0xd84d('0x28')]['find'](_0x31957e)[_0xd84d('0x1e')](function(_0x46f225){if(_0x46f225){_0x382a1a=_0x46f225;return _0x46f225['getFields']();}return null;})[_0xd84d('0x1e')](function(_0x44c61b){if(_0x44c61b){if(!_0x44c61b[_0xd84d('0x32')]){throw new db['Sequelize'][(_0xd84d('0x64'))](_0xd84d('0x9b'),0x193);}_0x5a0ba6=_0x44c61b;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x1fc2c4){if(_0x1fc2c4){_0x5d4c55=_[_0xd84d('0x66')](_0x1fc2c4,'id');var _0x17847d;var _0x227a3a=squel[_0xd84d('0x67')]();_0x227a3a[_0xd84d('0x9c')](_0x382a1a[_0xd84d('0x68')]);for(var _0x56b315=0x0;_0x56b315<_0x5a0ba6[_0xd84d('0x32')];_0x56b315+=0x1){_0x17847d=_0x5a0ba6[_0x56b315][_0xd84d('0x69')]?_0x5d4c55[_0x5a0ba6[_0x56b315]['MetricId']][_0xd84d('0x6a')]:_0x5a0ba6[_0x56b315][_0xd84d('0x60')];_0x17847d=_0x5a0ba6[_0x56b315][_0xd84d('0x6b')]?_[_0xd84d('0x88')](_0x5c9e4a[_0x5a0ba6[_0x56b315][_0xd84d('0x6b')]],'%s',_0x17847d):_0x17847d;_0x17847d=_0x5a0ba6[_0x56b315][_0xd84d('0x6c')]?_[_0xd84d('0x88')](_0x5a36ff[_0x5a0ba6[_0x56b315][_0xd84d('0x6c')]],'%s',_0x17847d):_0x17847d;if(_0x5a0ba6[_0x56b315][_0xd84d('0x6d')]){_0x227a3a[_0xd84d('0x5f')](_0x17847d);}_0x5a0ba6[_0x56b315][_0xd84d('0x6e')]&&_0x227a3a[_0xd84d('0x35')](_0x17847d,_0x5a0ba6[_0x56b315][_0xd84d('0x6e')]===_0xd84d('0x6f')?![]:!![]);_0x227a3a[_0xd84d('0x60')](_0x17847d,_0x5a0ba6[_0x56b315][_0xd84d('0x70')]||_0x17847d);}if(_0x382a1a[_0xd84d('0x71')]){_0x382a1a[_0xd84d('0x71')]=JSON[_0xd84d('0x72')](_0x382a1a[_0xd84d('0x71')]);for(var _0x6626=0x0;_0x6626<_0x382a1a[_0xd84d('0x71')][_0xd84d('0x32')];_0x6626+=0x1){if(_0x382a1a['joins'][_0x6626][_0xd84d('0x2b')]&&_[_0xd84d('0x73')](_0xc95f9d,_0x382a1a[_0xd84d('0x71')][_0x6626][_0xd84d('0x2b')])&&_0x382a1a['joins'][_0x6626][_0xd84d('0x74')]&&_0x382a1a['joins'][_0x6626]['foreignTable']&&_0x382a1a[_0xd84d('0x71')][_0x6626][_0xd84d('0x76')]){_0x227a3a[_0x382a1a[_0xd84d('0x71')][_0x6626][_0xd84d('0x2b')]](_0x382a1a[_0xd84d('0x71')][_0x6626][_0xd84d('0x75')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x382a1a['table'],_0x382a1a[_0xd84d('0x71')][_0x6626][_0xd84d('0x74')],_0x382a1a[_0xd84d('0x71')][_0x6626][_0xd84d('0x75')],_0x382a1a[_0xd84d('0x71')][_0x6626][_0xd84d('0x76')]));}}}if(_0x382a1a[_0xd84d('0x78')]){_0x382a1a[_0xd84d('0x78')]=JSON[_0xd84d('0x72')](_0x382a1a[_0xd84d('0x78')]);_0x227a3a['where'](_0xeca768(_0x382a1a[_0xd84d('0x78')][_0xd84d('0x5f')]));}_0x191823=_0x227a3a[_0xd84d('0x79')]();_0x227a3a[_0xd84d('0x16')](_0x3250fb);_0x227a3a[_0xd84d('0x14')](0x0);logger[_0xd84d('0x7a')](_0xd84d('0x7b'),_0x227a3a['toString']());return dbH[_0xd84d('0x7c')][_0xd84d('0x2d')](_0x227a3a['toString'](),{'type':dbH[_0xd84d('0x7c')][_0xd84d('0x7e')][_0xd84d('0x7f')]});}})['then'](function(){return{'sql':_0x191823[_0xd84d('0x7d')]()};})[_0xd84d('0x1e')](respondWithResult(_0x199315,null))[_0xd84d('0x3f')](handleError(_0x199315,null));}; \ No newline at end of file +var _0xf777=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','then','destroy','get','CustomReports','error','stack','name','index','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','filter','options','AnalyticCustomReport','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','includes','foreignTable','foreignKey','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','left_join','SUM(%s)','GROUP_CONCAT(%s)','IS\x20NOT\x20NULL','operator','findAll','metric','%s.%s\x20=\x20%s.%s','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','output','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7f77('0x0'));var rimraf=require(_0x7f77('0x1'));var zipdir=require(_0x7f77('0x2'));var jsonpatch=require(_0x7f77('0x3'));var rp=require(_0x7f77('0x4'));var moment=require(_0x7f77('0x5'));var BPromise=require(_0x7f77('0x6'));var Mustache=require(_0x7f77('0x7'));var util=require(_0x7f77('0x8'));var path=require('path');var sox=require(_0x7f77('0x9'));var csv=require(_0x7f77('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f77('0xb'));var _=require('lodash');var squel=require(_0x7f77('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f77('0xd'));var deskjs=require(_0x7f77('0xe'));var toCsv=require(_0x7f77('0xa'));var querystring=require(_0x7f77('0xf'));var Papa=require(_0x7f77('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f77('0x11'));var as=require(_0x7f77('0x12'));var hardwareService=require(_0x7f77('0x13'));var logger=require(_0x7f77('0x14'))(_0x7f77('0x15'));var utils=require('../../config/utils');var config=require(_0x7f77('0x16'));var licenseUtil=require(_0x7f77('0x17'));var db=require(_0x7f77('0x18'))['db'];var dbH=require(_0x7f77('0x18'))[_0x7f77('0x19')];function respondWithStatusCode(_0x484018,_0x505975){_0x505975=_0x505975||0xcc;return function(_0x1c275e){if(_0x1c275e){return _0x484018[_0x7f77('0x1a')](_0x505975);}return _0x484018[_0x7f77('0x1b')](_0x505975)[_0x7f77('0x1c')]();};}function respondWithResult(_0xe15bf7,_0x194b15){_0x194b15=_0x194b15||0xc8;return function(_0x1f0729){if(_0x1f0729){return _0xe15bf7[_0x7f77('0x1b')](_0x194b15)[_0x7f77('0x1d')](_0x1f0729);}};}function respondWithFilteredResult(_0x3d8a45,_0x2c104a){return function(_0x29d2cb){if(_0x29d2cb){var _0x186f7a=typeof _0x2c104a[_0x7f77('0x1e')]===_0x7f77('0x1f')&&typeof _0x2c104a[_0x7f77('0x20')]==='undefined';var _0x5b2c85=_0x29d2cb[_0x7f77('0x21')];var _0x53ec10=_0x186f7a?0x0:_0x2c104a[_0x7f77('0x1e')];var _0x50eb96=_0x186f7a?_0x29d2cb[_0x7f77('0x21')]:_0x2c104a[_0x7f77('0x1e')]+_0x2c104a[_0x7f77('0x20')];var _0x5306ae;if(_0x50eb96>=_0x5b2c85){_0x50eb96=_0x5b2c85;_0x5306ae=0xc8;}else{_0x5306ae=0xce;}_0x3d8a45[_0x7f77('0x1b')](_0x5306ae);return _0x3d8a45[_0x7f77('0x22')]('Content-Range',_0x53ec10+'-'+_0x50eb96+'/'+_0x5b2c85)[_0x7f77('0x1d')](_0x29d2cb);}return null;};}function patchUpdates(_0x58df31){return function(_0x2d7654){try{jsonpatch['apply'](_0x2d7654,_0x58df31,!![]);}catch(_0x24fac0){return BPromise['reject'](_0x24fac0);}return _0x2d7654['save']();};}function saveUpdates(_0xcb6a79,_0x30c54c){return function(_0x583faf){if(_0x583faf){return _0x583faf['update'](_0xcb6a79)[_0x7f77('0x23')](function(_0x87e6b6){return _0x87e6b6;});}return null;};}function removeEntity(_0x1d8fe3,_0x596139){return function(_0x5e03a3){if(_0x5e03a3){return _0x5e03a3[_0x7f77('0x24')]()[_0x7f77('0x23')](function(){var _0x303043=_0x5e03a3[_0x7f77('0x25')]({'plain':!![]});var _0xd78c83=_0x7f77('0x26');return db['UserProfileResource'][_0x7f77('0x24')]({'where':{'type':_0xd78c83,'resourceId':_0x303043['id']}})['then'](function(){return _0x5e03a3;});})[_0x7f77('0x23')](function(){_0x1d8fe3[_0x7f77('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd7e0,_0x386842){return function(_0x51437e){if(!_0x51437e){_0x2bd7e0[_0x7f77('0x1a')](0x194);}return _0x51437e;};}function handleError(_0x53ac60,_0x341b5a){_0x341b5a=_0x341b5a||0x1f4;return function(_0x25fcae){logger[_0x7f77('0x27')](_0x25fcae[_0x7f77('0x28')]);if(_0x25fcae[_0x7f77('0x29')]){delete _0x25fcae[_0x7f77('0x29')];}_0x53ac60[_0x7f77('0x1b')](_0x341b5a)['send'](_0x25fcae);};}exports[_0x7f77('0x2a')]=function(_0x26c84c,_0x19d93f){var _0x41be46={},_0x473c5f={},_0x429729={'count':0x0,'rows':[]};var _0x2c64db=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x11723e){return{'name':_0x11723e[_0x7f77('0x2b')],'type':_0x11723e[_0x7f77('0x2c')][_0x7f77('0x2d')]};});_0x473c5f[_0x7f77('0x2e')]=_[_0x7f77('0x2f')](_0x2c64db,_0x7f77('0x29'));_0x473c5f[_0x7f77('0x30')]=_[_0x7f77('0x31')](_0x26c84c[_0x7f77('0x30')]);_0x473c5f[_0x7f77('0x32')]=_['intersection'](_0x473c5f[_0x7f77('0x2e')],_0x473c5f[_0x7f77('0x30')]);_0x41be46[_0x7f77('0x33')]=_[_0x7f77('0x34')](_0x473c5f[_0x7f77('0x2e')],qs[_0x7f77('0x35')](_0x26c84c[_0x7f77('0x30')][_0x7f77('0x35')]));_0x41be46[_0x7f77('0x33')]=_0x41be46[_0x7f77('0x33')]['length']?_0x41be46[_0x7f77('0x33')]:_0x473c5f['model'];if(!_0x26c84c[_0x7f77('0x30')][_0x7f77('0x36')]('nolimit')){_0x41be46['limit']=qs[_0x7f77('0x20')](_0x26c84c[_0x7f77('0x30')]['limit']);_0x41be46[_0x7f77('0x1e')]=qs['offset'](_0x26c84c[_0x7f77('0x30')][_0x7f77('0x1e')]);}_0x41be46['order']=qs[_0x7f77('0x37')](_0x26c84c[_0x7f77('0x30')][_0x7f77('0x37')]);_0x41be46[_0x7f77('0x38')]=qs[_0x7f77('0x32')](_[_0x7f77('0x39')](_0x26c84c[_0x7f77('0x30')],_0x473c5f[_0x7f77('0x32')]),_0x2c64db);if(_0x26c84c[_0x7f77('0x30')]['filter']){_0x41be46[_0x7f77('0x38')]=_[_0x7f77('0x3a')](_0x41be46[_0x7f77('0x38')],{'$or':_[_0x7f77('0x2f')](_0x2c64db,function(_0x42c189){if(_0x42c189[_0x7f77('0x2c')]!=='VIRTUAL'){var _0x41614b={};_0x41614b[_0x42c189['name']]={'$like':'%'+_0x26c84c[_0x7f77('0x30')][_0x7f77('0x3b')]+'%'};return _0x41614b;}})});}_0x41be46=_['merge']({},_0x41be46,_0x26c84c[_0x7f77('0x3c')]);var _0x59aaf9={'where':_0x41be46[_0x7f77('0x38')]};return db[_0x7f77('0x3d')][_0x7f77('0x21')](_0x59aaf9)[_0x7f77('0x23')](function(_0x2540e0){_0x429729['count']=_0x2540e0;if(_0x26c84c[_0x7f77('0x30')][_0x7f77('0x3e')]){_0x41be46[_0x7f77('0x3f')]=[{'all':!![]}];}return db[_0x7f77('0x3d')]['findAll'](_0x41be46);})[_0x7f77('0x23')](function(_0x212707){_0x429729[_0x7f77('0x40')]=_0x212707;return _0x429729;})['then'](respondWithFilteredResult(_0x19d93f,_0x41be46))[_0x7f77('0x41')](handleError(_0x19d93f,null));};exports[_0x7f77('0x42')]=function(_0x4b90e1,_0x2c1516){var _0x53c93d={'raw':![],'where':{'id':_0x4b90e1[_0x7f77('0x43')]['id']}},_0x56948d={};_0x56948d[_0x7f77('0x2e')]=_['keys'](db[_0x7f77('0x3d')][_0x7f77('0x44')]);_0x56948d[_0x7f77('0x30')]=_[_0x7f77('0x31')](_0x4b90e1['query']);_0x56948d[_0x7f77('0x32')]=_[_0x7f77('0x34')](_0x56948d[_0x7f77('0x2e')],_0x56948d[_0x7f77('0x30')]);_0x53c93d['attributes']=_[_0x7f77('0x34')](_0x56948d[_0x7f77('0x2e')],qs[_0x7f77('0x35')](_0x4b90e1['query'][_0x7f77('0x35')]));_0x53c93d['attributes']=_0x53c93d[_0x7f77('0x33')][_0x7f77('0x45')]?_0x53c93d[_0x7f77('0x33')]:_0x56948d['model'];if(_0x4b90e1['query'][_0x7f77('0x3e')]){_0x53c93d[_0x7f77('0x3f')]=[{'all':!![]}];}_0x53c93d=_[_0x7f77('0x3a')]({},_0x53c93d,_0x4b90e1[_0x7f77('0x3c')]);return db[_0x7f77('0x3d')][_0x7f77('0x46')](_0x53c93d)[_0x7f77('0x23')](handleEntityNotFound(_0x2c1516,null))[_0x7f77('0x23')](respondWithResult(_0x2c1516,null))[_0x7f77('0x41')](handleError(_0x2c1516,null));};exports[_0x7f77('0x47')]=function(_0x34a835,_0x1ef96c){return db['AnalyticCustomReport'][_0x7f77('0x47')](_0x34a835[_0x7f77('0x48')],{})[_0x7f77('0x23')](function(_0x1edb18){var _0x2a27f0=_0x34a835[_0x7f77('0x49')][_0x7f77('0x25')]({'plain':!![]});if(!_0x2a27f0)throw new Error(_0x7f77('0x4a'));if(_0x2a27f0[_0x7f77('0x4b')]===_0x7f77('0x49')){var _0x1ba85b=_0x1edb18['get']({'plain':!![]});var _0x4cd8ee=_0x7f77('0x4c');return db[_0x7f77('0x4d')][_0x7f77('0x46')]({'where':{'name':_0x4cd8ee,'userProfileId':_0x2a27f0[_0x7f77('0x4e')]},'raw':!![]})['then'](function(_0x186c1b){if(_0x186c1b&&_0x186c1b['autoAssociation']===0x0){return db[_0x7f77('0x4f')][_0x7f77('0x47')]({'name':_0x1ba85b[_0x7f77('0x29')],'resourceId':_0x1ba85b['id'],'type':_0x7f77('0x26'),'sectionId':_0x186c1b['id']},{})[_0x7f77('0x23')](function(){return _0x1edb18;});}else{return _0x1edb18;}})['catch'](function(_0x11b484){logger['error'](_0x7f77('0x50'),_0x11b484);throw _0x11b484;});}return _0x1edb18;})['then'](respondWithResult(_0x1ef96c,0xc9))[_0x7f77('0x41')](handleError(_0x1ef96c,null));};exports[_0x7f77('0x51')]=function(_0xa31ce6,_0x230fd0){if(_0xa31ce6[_0x7f77('0x48')]['id']){delete _0xa31ce6['body']['id'];}return db['AnalyticCustomReport'][_0x7f77('0x46')]({'where':{'id':_0xa31ce6[_0x7f77('0x43')]['id']}})['then'](handleEntityNotFound(_0x230fd0,null))[_0x7f77('0x23')](saveUpdates(_0xa31ce6[_0x7f77('0x48')],null))['then'](respondWithResult(_0x230fd0,null))[_0x7f77('0x41')](handleError(_0x230fd0,null));};exports[_0x7f77('0x24')]=function(_0x30d2c9,_0xa4d4d8){return db[_0x7f77('0x3d')][_0x7f77('0x46')]({'where':{'id':_0x30d2c9[_0x7f77('0x43')]['id']}})['then'](handleEntityNotFound(_0xa4d4d8,null))[_0x7f77('0x23')](removeEntity(_0xa4d4d8,null))[_0x7f77('0x41')](handleError(_0xa4d4d8,null));};exports[_0x7f77('0x52')]=function(_0x5462ca,_0x2d49a7){var _0x2ad58b=0xa;var _0x3e4a5e=[_0x7f77('0x53'),'left_join',_0x7f77('0x54'),_0x7f77('0x55')];var _0x1dcaf7={'SUM':'SUM(%s)','COUNT':_0x7f77('0x56'),'COUNT DISTINCT':_0x7f77('0x57'),'MAX':_0x7f77('0x58'),'MIN':_0x7f77('0x59'),'AVG':_0x7f77('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7f77('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x49499c={'SEC_TO_TIME':_0x7f77('0x5c'),'DATE':_0x7f77('0x5d'),'HOUR':_0x7f77('0x5e'),'ROUND':_0x7f77('0x5f'),'UNIX_TIMESTAMP':_0x7f77('0x60')};var _0x35eaed=function(_0x5c79cd){return!_['includes']([_0x7f77('0x61'),'IS\x20NOT\x20NULL',_0x7f77('0x62'),_0x7f77('0x63')],_0x5c79cd);};var _0xfc37e8=function(_0x1a234a){if(!_0x1a234a||!_0x1a234a[_0x7f77('0x64')][_0x7f77('0x45')]){return'';}for(var _0x281e5f='(',_0x16a777=0x0;_0x16a777<_0x1a234a[_0x7f77('0x64')][_0x7f77('0x45')];_0x16a777+=0x1){_0x16a777>0x0&&(_0x281e5f+='\x20'+_0x1a234a['operator']+'\x20');_0x281e5f+=_0x1a234a[_0x7f77('0x64')][_0x16a777][_0x7f77('0x65')]?_0xfc37e8(_0x1a234a[_0x7f77('0x64')][_0x16a777][_0x7f77('0x65')]):_0x1a234a[_0x7f77('0x64')][_0x16a777][_0x7f77('0x66')]+'\x20'+_0x1a234a['rules'][_0x16a777][_0x7f77('0x67')]+(_0x35eaed(_0x1a234a[_0x7f77('0x64')][_0x16a777][_0x7f77('0x67')])?'\x20'+_0x1a234a[_0x7f77('0x64')][_0x16a777][_0x7f77('0x68')]:'');}return _0x281e5f+')';};var _0x458905={'where':{'id':_0x5462ca[_0x7f77('0x43')]['id']}},_0x511b5c,_0x420b01,_0x2c3894,_0x43d724,_0x4fc2f2;_0x458905=_[_0x7f77('0x3a')]({},_0x458905,_0x5462ca[_0x7f77('0x3c')]);return db[_0x7f77('0x3d')][_0x7f77('0x46')](_0x458905)[_0x7f77('0x23')](function(_0x19e222){if(_0x19e222){_0x511b5c=_0x19e222;return _0x19e222[_0x7f77('0x69')]();}return null;})[_0x7f77('0x23')](function(_0x2f9e64){if(_0x2f9e64){if(!_0x2f9e64[_0x7f77('0x45')]){throw new db[(_0x7f77('0x6a'))][(_0x7f77('0x6b'))](_0x7f77('0x6c'),0x193);}_0x420b01=_0x2f9e64;return db[_0x7f77('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d327b){if(_0x1d327b){_0x2c3894=_[_0x7f77('0x6e')](_0x1d327b,'id');var _0xd25feb;var _0x553964=squel[_0x7f77('0x6f')]();_0x553964[_0x7f77('0x70')](_0x511b5c[_0x7f77('0x71')]);for(var _0x55f4d3=0x0;_0x55f4d3<_0x420b01[_0x7f77('0x45')];_0x55f4d3+=0x1){_0xd25feb=_0x420b01[_0x55f4d3][_0x7f77('0x72')]?_0x2c3894[_0x420b01[_0x55f4d3][_0x7f77('0x72')]]['metric']:_0x420b01[_0x55f4d3][_0x7f77('0x66')];_0xd25feb=_0x420b01[_0x55f4d3][_0x7f77('0x73')]?_[_0x7f77('0x74')](_0x1dcaf7[_0x420b01[_0x55f4d3][_0x7f77('0x73')]],'%s',_0xd25feb):_0xd25feb;_0xd25feb=_0x420b01[_0x55f4d3][_0x7f77('0x75')]?_[_0x7f77('0x74')](_0x49499c[_0x420b01[_0x55f4d3][_0x7f77('0x75')]],'%s',_0xd25feb):_0xd25feb;if(_0x420b01[_0x55f4d3][_0x7f77('0x76')]){_0x553964[_0x7f77('0x65')](_0xd25feb);}_0x420b01[_0x55f4d3][_0x7f77('0x77')]&&_0x553964[_0x7f77('0x78')](_0xd25feb,_0x420b01[_0x55f4d3]['orderBy']===_0x7f77('0x79')?![]:!![]);_0x553964[_0x7f77('0x66')](_0xd25feb,_0x420b01[_0x55f4d3][_0x7f77('0x7a')]||_0xd25feb);}if(_0x511b5c[_0x7f77('0x7b')]){_0x511b5c[_0x7f77('0x7b')]=JSON[_0x7f77('0x7c')](_0x511b5c[_0x7f77('0x7b')]);for(var _0x537eff=0x0;_0x537eff<_0x511b5c['joins'][_0x7f77('0x45')];_0x537eff+=0x1){if(_0x511b5c[_0x7f77('0x7b')][_0x537eff]['type']&&_[_0x7f77('0x7d')](_0x3e4a5e,_0x511b5c[_0x7f77('0x7b')][_0x537eff][_0x7f77('0x2c')])&&_0x511b5c['joins'][_0x537eff]['parentKey']&&_0x511b5c[_0x7f77('0x7b')][_0x537eff][_0x7f77('0x7e')]&&_0x511b5c[_0x7f77('0x7b')][_0x537eff][_0x7f77('0x7f')]){_0x553964[_0x511b5c[_0x7f77('0x7b')][_0x537eff][_0x7f77('0x2c')]](_0x511b5c['joins'][_0x537eff][_0x7f77('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x511b5c[_0x7f77('0x71')],_0x511b5c[_0x7f77('0x7b')][_0x537eff][_0x7f77('0x80')],_0x511b5c[_0x7f77('0x7b')][_0x537eff]['foreignTable'],_0x511b5c[_0x7f77('0x7b')][_0x537eff][_0x7f77('0x7f')]));}}}if(_0x511b5c[_0x7f77('0x81')]){_0x511b5c[_0x7f77('0x81')]=JSON[_0x7f77('0x7c')](_0x511b5c[_0x7f77('0x81')]);_0x553964[_0x7f77('0x38')](_0xfc37e8(_0x511b5c[_0x7f77('0x81')][_0x7f77('0x65')]));}_0x4fc2f2=_0x553964[_0x7f77('0x82')]();_0x553964[_0x7f77('0x20')](_0x2ad58b);_0x553964[_0x7f77('0x1e')](0x0);logger[_0x7f77('0x83')](_0x7f77('0x84'),_0x553964[_0x7f77('0x85')]());return dbH['sequelize'][_0x7f77('0x30')](_0x553964[_0x7f77('0x85')](),{'type':dbH[_0x7f77('0x86')]['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x2d49a7,null))[_0x7f77('0x41')](handleError(_0x2d49a7,null));};function runReport(_0x29c8ee,_0x4fd9c1,_0xed5c26){var _0x2dbcbc=_0x4fd9c1['name'];var _0x518488=0xa;var _0x5e8a01=[_0x7f77('0x53'),_0x7f77('0x87'),_0x7f77('0x54'),_0x7f77('0x55')];var _0x27aea6={'SUM':_0x7f77('0x88'),'COUNT':_0x7f77('0x56'),'COUNT DISTINCT':_0x7f77('0x57'),'MAX':_0x7f77('0x58'),'MIN':_0x7f77('0x59'),'AVG':_0x7f77('0x5a'),'GROUP_CONCAT':_0x7f77('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2bfd98={'SEC_TO_TIME':_0x7f77('0x5c'),'DATE':_0x7f77('0x5d'),'HOUR':_0x7f77('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7f77('0x60')};var _0x42ccb0=function(_0x30f988){return!_[_0x7f77('0x7d')]([_0x7f77('0x61'),_0x7f77('0x8a'),_0x7f77('0x62'),_0x7f77('0x63')],_0x30f988);};var _0x179607=function(_0x20c952){if(!_0x20c952||!_0x20c952[_0x7f77('0x64')][_0x7f77('0x45')]){return'';}for(var _0x29e63a='(',_0x38535d=0x0;_0x38535d<_0x20c952[_0x7f77('0x64')][_0x7f77('0x45')];_0x38535d+=0x1){_0x38535d>0x0&&(_0x29e63a+='\x20'+_0x20c952[_0x7f77('0x8b')]+'\x20');_0x29e63a+=_0x20c952[_0x7f77('0x64')][_0x38535d][_0x7f77('0x65')]?_0x179607(_0x20c952[_0x7f77('0x64')][_0x38535d][_0x7f77('0x65')]):_0x20c952[_0x7f77('0x64')][_0x38535d][_0x7f77('0x66')]+'\x20'+_0x20c952[_0x7f77('0x64')][_0x38535d][_0x7f77('0x67')]+(_0x42ccb0(_0x20c952[_0x7f77('0x64')][_0x38535d][_0x7f77('0x67')])?'\x20'+_0x20c952['rules'][_0x38535d][_0x7f77('0x68')]:'');}return _0x29e63a+')';};var _0x320d4b={'where':{'id':_0x29c8ee['id']}},_0x1c9d92,_0x28fa4c,_0x20b49e,_0x20847d,_0x362d16;_0x320d4b=_[_0x7f77('0x3a')]({},_0x320d4b,_0xed5c26);return db[_0x7f77('0x3d')][_0x7f77('0x46')](_0x320d4b)[_0x7f77('0x23')](function(_0x3640d0){if(_0x3640d0){_0x1c9d92=_0x3640d0;return _0x3640d0[_0x7f77('0x69')]();}return null;})['then'](function(_0x4411fe){if(_0x4411fe){if(!_0x4411fe[_0x7f77('0x45')]){throw new db[(_0x7f77('0x6a'))][(_0x7f77('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x28fa4c=_0x4411fe;return db[_0x7f77('0x6d')][_0x7f77('0x8c')]({'raw':!![]});}return null;})[_0x7f77('0x23')](function(_0x530316){if(_0x530316){_0x20b49e=_[_0x7f77('0x6e')](_0x530316,'id');var _0x5773c5;var _0x5c58cb=squel[_0x7f77('0x6f')]();_0x5c58cb[_0x7f77('0x70')](_0x1c9d92[_0x7f77('0x71')]);for(var _0x41c78c=0x0;_0x41c78c<_0x28fa4c['length'];_0x41c78c+=0x1){_0x5773c5=_0x28fa4c[_0x41c78c][_0x7f77('0x72')]?_0x20b49e[_0x28fa4c[_0x41c78c]['MetricId']][_0x7f77('0x8d')]:_0x28fa4c[_0x41c78c]['field'];_0x5773c5=_0x28fa4c[_0x41c78c][_0x7f77('0x73')]?_[_0x7f77('0x74')](_0x27aea6[_0x28fa4c[_0x41c78c]['function']],'%s',_0x5773c5):_0x5773c5;_0x5773c5=_0x28fa4c[_0x41c78c][_0x7f77('0x75')]?_[_0x7f77('0x74')](_0x2bfd98[_0x28fa4c[_0x41c78c][_0x7f77('0x75')]],'%s',_0x5773c5):_0x5773c5;if(_0x28fa4c[_0x41c78c]['groupBy']){_0x5c58cb[_0x7f77('0x65')](_0x5773c5);}_0x28fa4c[_0x41c78c]['orderBy']&&_0x5c58cb['order'](_0x5773c5,_0x28fa4c[_0x41c78c][_0x7f77('0x77')]==='DESC'?![]:!![]);_0x5c58cb[_0x7f77('0x66')](_0x5773c5,_0x28fa4c[_0x41c78c][_0x7f77('0x7a')]||_0x5773c5);}if(_0x1c9d92[_0x7f77('0x7b')]){_0x1c9d92['joins']=JSON['parse'](_0x1c9d92[_0x7f77('0x7b')]);for(var _0x527cea=0x0;_0x527cea<_0x1c9d92[_0x7f77('0x7b')][_0x7f77('0x45')];_0x527cea+=0x1){if(_0x1c9d92['joins'][_0x527cea][_0x7f77('0x2c')]&&_[_0x7f77('0x7d')](_0x5e8a01,_0x1c9d92[_0x7f77('0x7b')][_0x527cea][_0x7f77('0x2c')])&&_0x1c9d92[_0x7f77('0x7b')][_0x527cea][_0x7f77('0x80')]&&_0x1c9d92[_0x7f77('0x7b')][_0x527cea][_0x7f77('0x7e')]&&_0x1c9d92['joins'][_0x527cea][_0x7f77('0x7f')]){_0x5c58cb[_0x1c9d92[_0x7f77('0x7b')][_0x527cea]['type']](_0x1c9d92[_0x7f77('0x7b')][_0x527cea]['foreignTable'],null,util[_0x7f77('0x75')](_0x7f77('0x8e'),_0x1c9d92[_0x7f77('0x71')],_0x1c9d92[_0x7f77('0x7b')][_0x527cea]['parentKey'],_0x1c9d92['joins'][_0x527cea][_0x7f77('0x7e')],_0x1c9d92[_0x7f77('0x7b')][_0x527cea][_0x7f77('0x7f')]));}}}if(_0x1c9d92[_0x7f77('0x81')]){_0x1c9d92[_0x7f77('0x81')]=JSON[_0x7f77('0x7c')](_0x1c9d92[_0x7f77('0x81')]);_0x5c58cb['where'](_0x179607(_0x1c9d92[_0x7f77('0x81')][_0x7f77('0x65')]));}_0x362d16=_0x5c58cb['clone']();_0x5c58cb['limit'](_0x518488);_0x5c58cb[_0x7f77('0x1e')](0x0);return;}})['then'](function(){if(_0x4fd9c1['output']===_0x7f77('0x8f')){return null;}var _0x2ea72b=_[_0x7f77('0x3a')](_0x4fd9c1,{'name':_0x4fd9c1[_0x7f77('0x90')]||_0x4fd9c1[_0x7f77('0x29')]||_0x1c9d92['name'],'basename':_0x2dbcbc,'savename':util[_0x7f77('0x75')](_0x7f77('0x91'),_0x4fd9c1[_0x7f77('0x29')]||_0x1c9d92[_0x7f77('0x29')],require(_0x7f77('0x92'))[_0x7f77('0x93')](0x4),_0x4fd9c1['output']||_0x7f77('0x94')),'reportId':_0x1c9d92['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x7f77('0x47')](_0x2ea72b,{'raw':!![]});})[_0x7f77('0x23')](function(_0x233794){if(_0x1c9d92[_0x7f77('0x71')]===_0x7f77('0x95')){_0x362d16['where'](_0x1c9d92['table']+_0x7f77('0x96'),_0x4fd9c1['startDate'],_0x4fd9c1['endDate']);}else{_0x362d16[_0x7f77('0x38')](_0x1c9d92[_0x7f77('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4fd9c1[_0x7f77('0x97')],_0x4fd9c1[_0x7f77('0x98')]);}if(_0x233794){logger[_0x7f77('0x99')](_0x7f77('0x9a'),_0x362d16[_0x7f77('0x85')]());require(_0x7f77('0x9b'))[_0x7f77('0x9c')](path[_0x7f77('0x53')](__dirname,_0x7f77('0x9d'),_0x233794[_0x7f77('0x9e')]),[_0x233794['id'],_0x362d16[_0x7f77('0x85')](),path[_0x7f77('0x53')](__dirname,_0x7f77('0x9f'),_0x233794[_0x7f77('0xa0')]),_0x2dbcbc]);return _0x233794;}else{var _0xe8a5bb=squel[_0x7f77('0x6f')]();_0xe8a5bb['from']('('+_0x362d16[_0x7f77('0x85')]()+')',_0x7f77('0xa1'));_0xe8a5bb['field'](_0x7f77('0xa2'),_0x7f77('0x21'));_0x362d16[_0x7f77('0x20')](_0x4fd9c1[_0x7f77('0x20')]||_0x518488);_0x362d16[_0x7f77('0x1e')](_0x4fd9c1[_0x7f77('0x1e')]||0x0);return dbH['sequelize']['query'](_0xe8a5bb[_0x7f77('0x85')](),{'type':dbH[_0x7f77('0x86')][_0x7f77('0xa3')][_0x7f77('0xa4')]})[_0x7f77('0x23')](function(_0x549d2f){if(!_0x549d2f[_0x7f77('0x45')]){_0x20847d=0x0;}else{_0x20847d=_0x549d2f[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x362d16[_0x7f77('0x85')](),{'type':dbH[_0x7f77('0x86')][_0x7f77('0xa3')][_0x7f77('0xa4')]});})[_0x7f77('0x23')](function(_0x2102c8){return{'rows':_0x2102c8||[],'count':_0x20847d};});}});}exports[_0x7f77('0xa5')]=function(_0x3d121a,_0x9c4f60){return runReport(_0x3d121a['params'],_0x3d121a[_0x7f77('0x30')],_0x3d121a[_0x7f77('0x3c')])['then'](respondWithResult(_0x9c4f60,null))[_0x7f77('0x41')](handleError(_0x9c4f60,null));};exports[_0x7f77('0xa6')]=runReport;exports['query']=function(_0x250182,_0x44a44a){var _0x19d184=0xa;var _0x4ab224=['join','left_join','right_join',_0x7f77('0x55')];var _0x55a505={'SUM':'SUM(%s)','COUNT':_0x7f77('0x56'),'COUNT DISTINCT':_0x7f77('0x57'),'MAX':'MAX(%s)','MIN':_0x7f77('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7f77('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7f77('0xa7')};var _0x2e8b9e={'SEC_TO_TIME':_0x7f77('0x5c'),'DATE':_0x7f77('0x5d'),'HOUR':_0x7f77('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x133d1b=function(_0x2138a8){return!_[_0x7f77('0x7d')]([_0x7f77('0x61'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x7f77('0x63')],_0x2138a8);};var _0x4cf8a4=function(_0x6d25b7){if(!_0x6d25b7||!_0x6d25b7[_0x7f77('0x64')]['length']){return'';}for(var _0x9ed789='(',_0x2b3669=0x0;_0x2b3669<_0x6d25b7[_0x7f77('0x64')][_0x7f77('0x45')];_0x2b3669+=0x1){_0x2b3669>0x0&&(_0x9ed789+='\x20'+_0x6d25b7[_0x7f77('0x8b')]+'\x20');_0x9ed789+=_0x6d25b7[_0x7f77('0x64')][_0x2b3669][_0x7f77('0x65')]?_0x4cf8a4(_0x6d25b7[_0x7f77('0x64')][_0x2b3669]['group']):_0x6d25b7[_0x7f77('0x64')][_0x2b3669][_0x7f77('0x66')]+'\x20'+_0x6d25b7[_0x7f77('0x64')][_0x2b3669]['condition']+(_0x133d1b(_0x6d25b7[_0x7f77('0x64')][_0x2b3669][_0x7f77('0x67')])?'\x20'+_0x6d25b7[_0x7f77('0x64')][_0x2b3669][_0x7f77('0x68')]:'');}return _0x9ed789+')';};var _0x27882b={'where':{'id':_0x250182[_0x7f77('0x43')]['id']}},_0x506b2b,_0x4b0293,_0x57f54a,_0x361c14,_0x1d2bc7;_0x27882b=_[_0x7f77('0x3a')]({},_0x27882b,_0x250182['options']);return db['AnalyticCustomReport'][_0x7f77('0x46')](_0x27882b)['then'](function(_0x57ed43){if(_0x57ed43){_0x506b2b=_0x57ed43;return _0x57ed43[_0x7f77('0x69')]();}return null;})[_0x7f77('0x23')](function(_0xa3f91e){if(_0xa3f91e){if(!_0xa3f91e['length']){throw new db['Sequelize'][(_0x7f77('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4b0293=_0xa3f91e;return db[_0x7f77('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x4f3faa){if(_0x4f3faa){_0x57f54a=_[_0x7f77('0x6e')](_0x4f3faa,'id');var _0x30b47c;var _0x5b5437=squel['select']();_0x5b5437[_0x7f77('0x70')](_0x506b2b[_0x7f77('0x71')]);for(var _0x3f238d=0x0;_0x3f238d<_0x4b0293['length'];_0x3f238d+=0x1){_0x30b47c=_0x4b0293[_0x3f238d][_0x7f77('0x72')]?_0x57f54a[_0x4b0293[_0x3f238d]['MetricId']][_0x7f77('0x8d')]:_0x4b0293[_0x3f238d]['field'];_0x30b47c=_0x4b0293[_0x3f238d][_0x7f77('0x73')]?_[_0x7f77('0x74')](_0x55a505[_0x4b0293[_0x3f238d][_0x7f77('0x73')]],'%s',_0x30b47c):_0x30b47c;_0x30b47c=_0x4b0293[_0x3f238d][_0x7f77('0x75')]?_[_0x7f77('0x74')](_0x2e8b9e[_0x4b0293[_0x3f238d][_0x7f77('0x75')]],'%s',_0x30b47c):_0x30b47c;if(_0x4b0293[_0x3f238d][_0x7f77('0x76')]){_0x5b5437['group'](_0x30b47c);}_0x4b0293[_0x3f238d][_0x7f77('0x77')]&&_0x5b5437[_0x7f77('0x78')](_0x30b47c,_0x4b0293[_0x3f238d]['orderBy']===_0x7f77('0x79')?![]:!![]);_0x5b5437[_0x7f77('0x66')](_0x30b47c,_0x4b0293[_0x3f238d][_0x7f77('0x7a')]||_0x30b47c);}if(_0x506b2b[_0x7f77('0x7b')]){_0x506b2b[_0x7f77('0x7b')]=JSON['parse'](_0x506b2b[_0x7f77('0x7b')]);for(var _0x308a17=0x0;_0x308a17<_0x506b2b[_0x7f77('0x7b')]['length'];_0x308a17+=0x1){if(_0x506b2b[_0x7f77('0x7b')][_0x308a17][_0x7f77('0x2c')]&&_[_0x7f77('0x7d')](_0x4ab224,_0x506b2b[_0x7f77('0x7b')][_0x308a17][_0x7f77('0x2c')])&&_0x506b2b[_0x7f77('0x7b')][_0x308a17]['parentKey']&&_0x506b2b[_0x7f77('0x7b')][_0x308a17][_0x7f77('0x7e')]&&_0x506b2b[_0x7f77('0x7b')][_0x308a17][_0x7f77('0x7f')]){_0x5b5437[_0x506b2b[_0x7f77('0x7b')][_0x308a17][_0x7f77('0x2c')]](_0x506b2b[_0x7f77('0x7b')][_0x308a17][_0x7f77('0x7e')],null,util['format'](_0x7f77('0x8e'),_0x506b2b[_0x7f77('0x71')],_0x506b2b[_0x7f77('0x7b')][_0x308a17]['parentKey'],_0x506b2b[_0x7f77('0x7b')][_0x308a17][_0x7f77('0x7e')],_0x506b2b['joins'][_0x308a17][_0x7f77('0x7f')]));}}}if(_0x506b2b[_0x7f77('0x81')]){_0x506b2b[_0x7f77('0x81')]=JSON[_0x7f77('0x7c')](_0x506b2b[_0x7f77('0x81')]);_0x5b5437[_0x7f77('0x38')](_0x4cf8a4(_0x506b2b[_0x7f77('0x81')][_0x7f77('0x65')]));}_0x1d2bc7=_0x5b5437[_0x7f77('0x82')]();_0x5b5437[_0x7f77('0x20')](_0x19d184);_0x5b5437[_0x7f77('0x1e')](0x0);logger[_0x7f77('0x83')]('Limited\x20Query:',_0x5b5437[_0x7f77('0x85')]());return dbH[_0x7f77('0x86')]['query'](_0x5b5437[_0x7f77('0x85')](),{'type':dbH[_0x7f77('0x86')][_0x7f77('0xa3')][_0x7f77('0xa4')]});}})[_0x7f77('0x23')](function(){return{'sql':_0x1d2bc7['toString']()};})[_0x7f77('0x23')](respondWithResult(_0x44a44a,null))[_0x7f77('0x41')](handleError(_0x44a44a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d423563..5cb65ae 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 _0x64e4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64e4,0x135));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x464e('0x0'));var util=require(_0x464e('0x1'));var logger=require(_0x464e('0x2'))(_0x464e('0x3'));var moment=require(_0x464e('0x4'));var BPromise=require(_0x464e('0x5'));var rp=require(_0x464e('0x6'));var fs=require('fs');var path=require(_0x464e('0x7'));var rimraf=require(_0x464e('0x8'));var config=require(_0x464e('0x9'));var attributes=require('./analyticCustomReport.attributes');module[_0x464e('0xa')]=function(_0x5a869d,_0x5e9483){return _0x5a869d[_0x464e('0xb')]('AnalyticCustomReport',attributes,{'tableName':_0x464e('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8873=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2c913a,_0x10aad3){var _0x33c2f8=function(_0x48929c){while(--_0x48929c){_0x2c913a['push'](_0x2c913a['shift']());}};_0x33c2f8(++_0x10aad3);}(_0x8873,0x9f));var _0x3887=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x8873[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x3887('0x0'));var util=require(_0x3887('0x1'));var logger=require(_0x3887('0x2'))(_0x3887('0x3'));var moment=require(_0x3887('0x4'));var BPromise=require(_0x3887('0x5'));var rp=require(_0x3887('0x6'));var fs=require('fs');var path=require(_0x3887('0x7'));var rimraf=require('rimraf');var config=require(_0x3887('0x8'));var attributes=require(_0x3887('0x9'));module[_0x3887('0xa')]=function(_0x46ff7f,_0x4087e8){return _0x46ff7f[_0x3887('0xb')](_0x3887('0xc'),attributes,{'tableName':_0x3887('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 633e281..8fb0fcf 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 _0x4277=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4e66eb,_0x1a5ae0){var _0x2ae430=function(_0x85f960){while(--_0x85f960){_0x4e66eb['push'](_0x4e66eb['shift']());}};_0x2ae430(++_0x1a5ae0);}(_0x4277,0x107));var _0x7427=function(_0x532f33,_0x33ca4a){_0x532f33=_0x532f33-0x0;var _0x4eafe8=_0x4277[_0x532f33];return _0x4eafe8;};'use strict';var _=require(_0x7427('0x0'));var util=require(_0x7427('0x1'));var moment=require(_0x7427('0x2'));var BPromise=require(_0x7427('0x3'));var rs=require(_0x7427('0x4'));var fs=require('fs');var Redis=require(_0x7427('0x5'));var db=require(_0x7427('0x6'))['db'];var utils=require(_0x7427('0x7'));var logger=require(_0x7427('0x8'))(_0x7427('0x9'));var config=require(_0x7427('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7427('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353770,_0x1511dc,_0x8a0da){return new BPromise(function(_0x39bc80,_0x2e7718){return client[_0x7427('0xc')](_0x353770,_0x8a0da)['then'](function(_0x55e7cb){logger[_0x7427('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1511dc,_0x7427('0xe'));logger['debug'](_0x7427('0xf'),_0x1511dc,'request\x20sent',JSON[_0x7427('0x10')](_0x55e7cb));if(_0x55e7cb[_0x7427('0x11')]){if(_0x55e7cb[_0x7427('0x11')]['code']===0x1f4){logger['error'](_0x7427('0x12'),_0x1511dc,_0x55e7cb[_0x7427('0x11')][_0x7427('0x13')]);return _0x2e7718(_0x55e7cb[_0x7427('0x11')][_0x7427('0x13')]);}logger[_0x7427('0x11')](_0x7427('0x12'),_0x1511dc,_0x55e7cb[_0x7427('0x11')][_0x7427('0x13')]);return _0x39bc80(_0x55e7cb[_0x7427('0x11')][_0x7427('0x13')]);}else{logger['info'](_0x7427('0x12'),_0x1511dc,'request\x20sent');_0x39bc80(_0x55e7cb[_0x7427('0x14')][_0x7427('0x13')]);}})[_0x7427('0x15')](function(_0x18c8ee){logger['error'](_0x7427('0x12'),_0x1511dc,_0x18c8ee);_0x2e7718(_0x18c8ee);});});} \ No newline at end of file +var _0xe135=['rpc','client','http','request','then','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x345bd5,_0x2c7ae2){var _0x4c32a1=function(_0x7de583){while(--_0x7de583){_0x345bd5['push'](_0x345bd5['shift']());}};_0x4c32a1(++_0x2c7ae2);}(_0xe135,0x10a));var _0x5e13=function(_0x35af53,_0x5966b1){_0x35af53=_0x35af53-0x0;var _0x6bbbce=_0xe135[_0x35af53];return _0x6bbbce;};'use strict';var _=require(_0x5e13('0x0'));var util=require('util');var moment=require(_0x5e13('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e13('0x2'));var fs=require('fs');var Redis=require(_0x5e13('0x3'));var db=require(_0x5e13('0x4'))['db'];var utils=require(_0x5e13('0x5'));var logger=require('../../config/logger')(_0x5e13('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e13('0x7')][_0x5e13('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ba531,_0x59bdbf,_0x196d22){return new BPromise(function(_0x5506c2,_0x28168f){return client[_0x5e13('0x9')](_0x4ba531,_0x196d22)[_0x5e13('0xa')](function(_0x4bc2be){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x59bdbf,_0x5e13('0xb'));logger['debug'](_0x5e13('0xc'),_0x59bdbf,'request\x20sent',JSON['stringify'](_0x4bc2be));if(_0x4bc2be[_0x5e13('0xd')]){if(_0x4bc2be[_0x5e13('0xd')][_0x5e13('0xe')]===0x1f4){logger[_0x5e13('0xd')](_0x5e13('0xf'),_0x59bdbf,_0x4bc2be[_0x5e13('0xd')][_0x5e13('0x10')]);return _0x28168f(_0x4bc2be[_0x5e13('0xd')][_0x5e13('0x10')]);}logger[_0x5e13('0xd')](_0x5e13('0xf'),_0x59bdbf,_0x4bc2be[_0x5e13('0xd')]['message']);return _0x5506c2(_0x4bc2be['error']['message']);}else{logger['info'](_0x5e13('0xf'),_0x59bdbf,_0x5e13('0xb'));_0x5506c2(_0x4bc2be['result'][_0x5e13('0x10')]);}})['catch'](function(_0x2318ce){logger[_0x5e13('0xd')](_0x5e13('0xf'),_0x59bdbf,_0x2318ce);_0x28168f(_0x2318ce);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 4e6a112..17bae6e 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 _0xd078=['isAuthenticated','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0x29eef2,_0x428d6e){var _0x1322e0=function(_0x1a17cc){while(--_0x1a17cc){_0x29eef2['push'](_0x29eef2['shift']());}};_0x1322e0(++_0x428d6e);}(_0xd078,0x9e));var _0x8d07=function(_0x4b3fa1,_0x497557){_0x4b3fa1=_0x4b3fa1-0x0;var _0x3a9c0a=_0xd078[_0x4b3fa1];return _0x3a9c0a;};'use strict';var multer=require('multer');var util=require(_0x8d07('0x0'));var path=require(_0x8d07('0x1'));var timeout=require(_0x8d07('0x2'));var express=require(_0x8d07('0x3'));var router=express[_0x8d07('0x4')]();var fs_extra=require(_0x8d07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8d07('0x6'));var config=require(_0x8d07('0x7'));var controller=require(_0x8d07('0x8'));router[_0x8d07('0x9')]('/',auth[_0x8d07('0xa')](),controller['index']);router[_0x8d07('0x9')](_0x8d07('0xb'),auth[_0x8d07('0xa')](),controller[_0x8d07('0xc')]);router[_0x8d07('0x9')](_0x8d07('0xd'),auth['isAuthenticated'](),controller['preview']);router[_0x8d07('0x9')](_0x8d07('0xe'),auth[_0x8d07('0xa')](),controller[_0x8d07('0xf')]);router[_0x8d07('0x9')](_0x8d07('0x10'),auth['isAuthenticated'](),controller[_0x8d07('0x11')]);router[_0x8d07('0x12')]('/',auth['isAuthenticated'](),controller[_0x8d07('0x13')]);router[_0x8d07('0x14')](_0x8d07('0xb'),auth['isAuthenticated'](),controller[_0x8d07('0x15')]);router[_0x8d07('0x16')](_0x8d07('0xb'),auth['isAuthenticated'](),controller[_0x8d07('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6fb6=['/:id/query','query','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run'];(function(_0x5b1b10,_0x508e2f){var _0x46eaa0=function(_0x50d837){while(--_0x50d837){_0x5b1b10['push'](_0x5b1b10['shift']());}};_0x46eaa0(++_0x508e2f);}(_0x6fb6,0x1d0));var _0x66fb=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x6fb6[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x66fb('0x0'));var util=require('util');var path=require(_0x66fb('0x1'));var timeout=require(_0x66fb('0x2'));var express=require(_0x66fb('0x3'));var router=express[_0x66fb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x66fb('0x5'));var interaction=require(_0x66fb('0x6'));var config=require(_0x66fb('0x7'));var controller=require(_0x66fb('0x8'));router[_0x66fb('0x9')]('/',auth[_0x66fb('0xa')](),controller[_0x66fb('0xb')]);router[_0x66fb('0x9')](_0x66fb('0xc'),auth[_0x66fb('0xa')](),controller['show']);router[_0x66fb('0x9')](_0x66fb('0xd'),auth[_0x66fb('0xa')](),controller[_0x66fb('0xe')]);router[_0x66fb('0x9')](_0x66fb('0xf'),auth['isAuthenticated'](),controller['run']);router[_0x66fb('0x9')](_0x66fb('0x10'),auth[_0x66fb('0xa')](),controller[_0x66fb('0x11')]);router[_0x66fb('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x66fb('0x13')]('/:id',auth[_0x66fb('0xa')](),controller[_0x66fb('0x14')]);router[_0x66fb('0x15')](_0x66fb('0xc'),auth[_0x66fb('0xa')](),controller[_0x66fb('0x16')]);module[_0x66fb('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index edd5fc3..776642b 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 _0x7fbe=['STRING','TEXT'];(function(_0xf74ddb,_0x8383bd){var _0x44e4cd=function(_0x20be15){while(--_0x20be15){_0xf74ddb['push'](_0xf74ddb['shift']());}};_0x44e4cd(++_0x8383bd);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2587ca,_0x231303){_0x2587ca=_0x2587ca-0x0;var _0x5aada1=_0x7fbe[_0x2587ca];return _0x5aada1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +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(_0x1e597a,_0x4834d6){_0x1e597a=_0x1e597a-0x0;var _0x5979c6=_0x1cb9[_0x1e597a];return _0x5979c6;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9964034..e4ab294 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','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','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x4dad7b,_0x4a17b0){var _0xc04d92=function(_0x5cad94){while(--_0x5cad94){_0x4dad7b['push'](_0x4dad7b['shift']());}};_0xc04d92(++_0x4a17b0);}(_0x53ec,0x192));var _0xc53e=function(_0x501932,_0x432837){_0x501932=_0x501932-0x0;var _0x1fe5eb=_0x53ec[_0x501932];return _0x1fe5eb;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x5fc3=['QueryTypes','right_join','HOUR(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0x40bc53,_0x23d242){var _0x287a92=function(_0x1784a1){while(--_0x1784a1){_0x40bc53['push'](_0x40bc53['shift']());}};_0x287a92(++_0x23d242);}(_0x5fc3,0xa8));var _0x35fc=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0x5fc3[_0x22868f];return _0x97bc75;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 571fc77..6d80280 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 _0x8da5=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x238480,_0x57fb07){var _0x1f7717=function(_0x134d23){while(--_0x134d23){_0x238480['push'](_0x238480['shift']());}};_0x1f7717(++_0x57fb07);}(_0x8da5,0x180));var _0x58da=function(_0x1ba208,_0x1cf9d0){_0x1ba208=_0x1ba208-0x0;var _0x33cbce=_0x8da5[_0x1ba208];return _0x33cbce;};'use strict';var _=require(_0x58da('0x0'));var util=require(_0x58da('0x1'));var logger=require(_0x58da('0x2'))(_0x58da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58da('0x5'));var config=require(_0x58da('0x6'));var attributes=require(_0x58da('0x7'));module[_0x58da('0x8')]=function(_0x5a5122,_0x363f61){return _0x5a5122[_0x58da('0x9')](_0x58da('0xa'),attributes,{'tableName':_0x58da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11bc=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util'];(function(_0x182e98,_0x4f29b2){var _0x5e9d50=function(_0x4971a7){while(--_0x4971a7){_0x182e98['push'](_0x182e98['shift']());}};_0x5e9d50(++_0x4f29b2);}(_0x11bc,0x191));var _0xc11b=function(_0x50fe49,_0x550ebe){_0x50fe49=_0x50fe49-0x0;var _0x416d2f=_0x11bc[_0x50fe49];return _0x416d2f;};'use strict';var _=require(_0xc11b('0x0'));var util=require(_0xc11b('0x1'));var logger=require(_0xc11b('0x2'))('api');var moment=require(_0xc11b('0x3'));var BPromise=require(_0xc11b('0x4'));var rp=require(_0xc11b('0x5'));var fs=require('fs');var path=require(_0xc11b('0x6'));var rimraf=require(_0xc11b('0x7'));var config=require(_0xc11b('0x8'));var attributes=require(_0xc11b('0x9'));module[_0xc11b('0xa')]=function(_0x438a95,_0x5650ba){return _0x438a95[_0xc11b('0xb')](_0xc11b('0xc'),attributes,{'tableName':'analytics_default_reports','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 aa85240..0e0406c 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 _0x8e71=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x52efef,_0x572e27){var _0x5dd0d6=function(_0xae91fb){while(--_0xae91fb){_0x52efef['push'](_0x52efef['shift']());}};_0x5dd0d6(++_0x572e27);}(_0x8e71,0x92));var _0x18e7=function(_0x12f59c,_0x13d956){_0x12f59c=_0x12f59c-0x0;var _0x2db43e=_0x8e71[_0x12f59c];return _0x2db43e;};'use strict';var _=require(_0x18e7('0x0'));var util=require(_0x18e7('0x1'));var moment=require(_0x18e7('0x2'));var BPromise=require(_0x18e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18e7('0x4'))['db'];var utils=require(_0x18e7('0x5'));var logger=require(_0x18e7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x18e7('0x7'));var client=jayson[_0x18e7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3038b8,_0x7d666e,_0x1a6771){return new BPromise(function(_0x3f15bf,_0x18fb6b){return client[_0x18e7('0x9')](_0x3038b8,_0x1a6771)[_0x18e7('0xa')](function(_0x1fe707){logger[_0x18e7('0xb')](_0x18e7('0xc'),_0x7d666e,_0x18e7('0xd'));logger[_0x18e7('0xe')](_0x18e7('0xf'),_0x7d666e,_0x18e7('0xd'),JSON[_0x18e7('0x10')](_0x1fe707));if(_0x1fe707[_0x18e7('0x11')]){if(_0x1fe707[_0x18e7('0x11')][_0x18e7('0x12')]===0x1f4){logger[_0x18e7('0x11')](_0x18e7('0xc'),_0x7d666e,_0x1fe707['error']['message']);return _0x18fb6b(_0x1fe707['error'][_0x18e7('0x13')]);}logger[_0x18e7('0x11')](_0x18e7('0xc'),_0x7d666e,_0x1fe707[_0x18e7('0x11')]['message']);return _0x3f15bf(_0x1fe707[_0x18e7('0x11')]['message']);}else{logger['info'](_0x18e7('0xc'),_0x7d666e,_0x18e7('0xd'));_0x3f15bf(_0x1fe707[_0x18e7('0x14')][_0x18e7('0x13')]);}})['catch'](function(_0xbee483){logger[_0x18e7('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x7d666e,_0xbee483);_0x18fb6b(_0xbee483);});});} \ No newline at end of file +var _0xf364=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xf364,0x1df));var _0x4f36=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xf364[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x4f36('0x0'));var util=require('util');var moment=require(_0x4f36('0x1'));var BPromise=require(_0x4f36('0x2'));var rs=require(_0x4f36('0x3'));var fs=require('fs');var Redis=require(_0x4f36('0x4'));var db=require(_0x4f36('0x5'))['db'];var utils=require(_0x4f36('0x6'));var logger=require('../../config/logger')(_0x4f36('0x7'));var config=require(_0x4f36('0x8'));var jayson=require(_0x4f36('0x9'));var client=jayson[_0x4f36('0xa')][_0x4f36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x884e31,_0x19addd,_0x5980e7){return new BPromise(function(_0x4350cb,_0x22bcdb){return client[_0x4f36('0xc')](_0x884e31,_0x5980e7)[_0x4f36('0xd')](function(_0x28aced){logger[_0x4f36('0xe')](_0x4f36('0xf'),_0x19addd,_0x4f36('0x10'));logger[_0x4f36('0x11')](_0x4f36('0x12'),_0x19addd,_0x4f36('0x10'),JSON[_0x4f36('0x13')](_0x28aced));if(_0x28aced[_0x4f36('0x14')]){if(_0x28aced[_0x4f36('0x14')][_0x4f36('0x15')]===0x1f4){logger[_0x4f36('0x14')](_0x4f36('0xf'),_0x19addd,_0x28aced[_0x4f36('0x14')][_0x4f36('0x16')]);return _0x22bcdb(_0x28aced[_0x4f36('0x14')][_0x4f36('0x16')]);}logger[_0x4f36('0x14')](_0x4f36('0xf'),_0x19addd,_0x28aced[_0x4f36('0x14')][_0x4f36('0x16')]);return _0x4350cb(_0x28aced[_0x4f36('0x14')][_0x4f36('0x16')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x19addd,_0x4f36('0x10'));_0x4350cb(_0x28aced[_0x4f36('0x17')]['message']);}})[_0x4f36('0x18')](function(_0x55448c){logger[_0x4f36('0x14')](_0x4f36('0xf'),_0x19addd,_0x55448c);_0x22bcdb(_0x55448c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 28b2f88..748da30 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 _0x164d=['/:id/query','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','/:id/run','run'];(function(_0x240786,_0x2bd6e1){var _0xd3a543=function(_0xc091e3){while(--_0xc091e3){_0x240786['push'](_0x240786['shift']());}};_0xd3a543(++_0x2bd6e1);}(_0x164d,0x82));var _0xd164=function(_0x1cfacc,_0x167cca){_0x1cfacc=_0x1cfacc-0x0;var _0x5e8766=_0x164d[_0x1cfacc];return _0x5e8766;};'use strict';var multer=require(_0xd164('0x0'));var util=require('util');var path=require(_0xd164('0x1'));var timeout=require(_0xd164('0x2'));var express=require(_0xd164('0x3'));var router=express[_0xd164('0x4')]();var fs_extra=require(_0xd164('0x5'));var auth=require(_0xd164('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd164('0x7'));var controller=require(_0xd164('0x8'));router['get']('/',auth[_0xd164('0x9')](),controller['index']);router[_0xd164('0xa')](_0xd164('0xb'),auth[_0xd164('0x9')](),controller[_0xd164('0xc')]);router[_0xd164('0xa')](_0xd164('0xd'),auth[_0xd164('0x9')](),controller[_0xd164('0xe')]);router[_0xd164('0xa')](_0xd164('0xf'),auth[_0xd164('0x9')](),controller[_0xd164('0x10')]);router[_0xd164('0xa')](_0xd164('0x11'),auth[_0xd164('0x9')](),controller['query']);router['post']('/',auth[_0xd164('0x9')](),controller['create']);router[_0xd164('0x12')](_0xd164('0xb'),auth[_0xd164('0x9')](),controller[_0xd164('0x13')]);router[_0xd164('0x14')]('/:id',auth[_0xd164('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcf3e=['post','create','update','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller','isAuthenticated','get','show','/:id/preview','/:id/run','run','/:id/query','query'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xcf3e,0x1b9));var _0xecf3=function(_0x37f649,_0xb0c292){_0x37f649=_0x37f649-0x0;var _0x1c29d8=_0xcf3e[_0x37f649];return _0x1c29d8;};'use strict';var multer=require(_0xecf3('0x0'));var util=require(_0xecf3('0x1'));var path=require(_0xecf3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xecf3('0x3')]();var fs_extra=require(_0xecf3('0x4'));var auth=require(_0xecf3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xecf3('0x6'));router['get']('/',auth[_0xecf3('0x7')](),controller['index']);router[_0xecf3('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xecf3('0x9')]);router[_0xecf3('0x8')](_0xecf3('0xa'),auth[_0xecf3('0x7')](),controller['preview']);router[_0xecf3('0x8')](_0xecf3('0xb'),auth[_0xecf3('0x7')](),controller[_0xecf3('0xc')]);router[_0xecf3('0x8')](_0xecf3('0xd'),auth[_0xecf3('0x7')](),controller[_0xecf3('0xe')]);router[_0xecf3('0xf')]('/',auth[_0xecf3('0x7')](),controller[_0xecf3('0x10')]);router['put']('/:id',auth[_0xecf3('0x7')](),controller[_0xecf3('0x11')]);router['delete']('/:id',auth[_0xecf3('0x7')](),controller[_0xecf3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index bf0da97..80561b0 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 _0x64d3=['pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv'];(function(_0x17c441,_0x2cd80b){var _0x44d307=function(_0x3279ea){while(--_0x3279ea){_0x17c441['push'](_0x17c441['shift']());}};_0x44d307(++_0x2cd80b);}(_0x64d3,0x1e7));var _0x364d=function(_0x1a7a39,_0x47b900){_0x1a7a39=_0x1a7a39-0x0;var _0x24af5b=_0x64d3[_0x1a7a39];return _0x24af5b;};'use strict';var Sequelize=require(_0x364d('0x0'));var moment=require(_0x364d('0x1'));module['exports']={'name':{'type':Sequelize[_0x364d('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x364d('0x3')](_0x364d('0x4'),_0x364d('0x5'),_0x364d('0x6')),'allowNull':![],'defaultValue':_0x364d('0x4')},'savename':{'type':Sequelize[_0x364d('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x364d('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x364d('0x8')},'type':{'type':Sequelize[_0x364d('0x3')](_0x364d('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x364d('0x9')},'reportId':{'type':Sequelize[_0x364d('0xa')](0xb)[_0x364d('0xb')]},'reportType':{'type':Sequelize[_0x364d('0x2')]}}; \ No newline at end of file +var _0xf30a=['pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','STRING','ENUM','csv'];(function(_0x454f50,_0x620d0e){var _0x3cdeb1=function(_0x28cc3e){while(--_0x28cc3e){_0x454f50['push'](_0x454f50['shift']());}};_0x3cdeb1(++_0x620d0e);}(_0xf30a,0x80));var _0xaf30=function(_0x8f3973,_0x236bfc){_0x8f3973=_0x8f3973-0x0;var _0x1b3c76=_0xf30a[_0x8f3973];return _0x1b3c76;};'use strict';var Sequelize=require(_0xaf30('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0xaf30('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xaf30('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xaf30('0x2')](_0xaf30('0x3'),_0xaf30('0x4'),_0xaf30('0x5')),'allowNull':![],'defaultValue':_0xaf30('0x3')},'savename':{'type':Sequelize[_0xaf30('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xaf30('0x6')]},'endDate':{'type':Sequelize[_0xaf30('0x6')]},'status':{'type':Sequelize[_0xaf30('0x1')],'defaultValue':_0xaf30('0x7')},'type':{'type':Sequelize['ENUM'](_0xaf30('0x8'),_0xaf30('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xaf30('0xa')](0xb)[_0xaf30('0xb')]},'reportType':{'type':Sequelize[_0xaf30('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 92131fa..d89dce8 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 _0xf115=['where','merge','VIRTUAL','options','AnalyticExtractedReport','findAll','rows','catch','show','params','keys','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','output','existsSync','join','server/files/reports','savename','Sequelize','ValidationError','exists','root','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter'];(function(_0x50e351,_0x35608c){var _0x418d06=function(_0x26145a){while(--_0x26145a){_0x50e351['push'](_0x50e351['shift']());}};_0x418d06(++_0x35608c);}(_0xf115,0x88));var _0x5f11=function(_0x42ed8f,_0x115d81){_0x42ed8f=_0x42ed8f-0x0;var _0x1aa640=_0xf115[_0x42ed8f];return _0x1aa640;};'use strict';var emlformat=require(_0x5f11('0x0'));var rimraf=require(_0x5f11('0x1'));var zipdir=require(_0x5f11('0x2'));var jsonpatch=require(_0x5f11('0x3'));var rp=require(_0x5f11('0x4'));var moment=require('moment');var BPromise=require(_0x5f11('0x5'));var Mustache=require('mustache');var util=require(_0x5f11('0x6'));var path=require('path');var sox=require(_0x5f11('0x7'));var csv=require('to-csv');var ejs=require(_0x5f11('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f11('0x9'));var squel=require(_0x5f11('0xa'));var crypto=require(_0x5f11('0xb'));var jsforce=require(_0x5f11('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5f11('0xd'));var querystring=require(_0x5f11('0xe'));var Papa=require(_0x5f11('0xf'));var Redis=require(_0x5f11('0x10'));var authService=require(_0x5f11('0x11'));var qs=require(_0x5f11('0x12'));var as=require(_0x5f11('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f11('0x14'))('api');var utils=require(_0x5f11('0x15'));var config=require(_0x5f11('0x16'));var licenseUtil=require(_0x5f11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dc905,_0x3c0ea7){_0x3c0ea7=_0x3c0ea7||0xcc;return function(_0x9a9d20){if(_0x9a9d20){return _0x5dc905[_0x5f11('0x18')](_0x3c0ea7);}return _0x5dc905[_0x5f11('0x19')](_0x3c0ea7)[_0x5f11('0x1a')]();};}function respondWithResult(_0x26dfca,_0x507386){_0x507386=_0x507386||0xc8;return function(_0x3dba84){if(_0x3dba84){return _0x26dfca[_0x5f11('0x19')](_0x507386)[_0x5f11('0x1b')](_0x3dba84);}};}function respondWithFilteredResult(_0x513463,_0x2e2083){return function(_0x399cad){if(_0x399cad){var _0x17483a=typeof _0x2e2083[_0x5f11('0x1c')]===_0x5f11('0x1d')&&typeof _0x2e2083[_0x5f11('0x1e')]===_0x5f11('0x1d');var _0x17243f=_0x399cad[_0x5f11('0x1f')];var _0x3b883d=_0x17483a?0x0:_0x2e2083['offset'];var _0x560f50=_0x17483a?_0x399cad[_0x5f11('0x1f')]:_0x2e2083[_0x5f11('0x1c')]+_0x2e2083[_0x5f11('0x1e')];var _0x2bab43;if(_0x560f50>=_0x17243f){_0x560f50=_0x17243f;_0x2bab43=0xc8;}else{_0x2bab43=0xce;}_0x513463[_0x5f11('0x19')](_0x2bab43);return _0x513463[_0x5f11('0x20')](_0x5f11('0x21'),_0x3b883d+'-'+_0x560f50+'/'+_0x17243f)[_0x5f11('0x1b')](_0x399cad);}return null;};}function patchUpdates(_0x57c8f5){return function(_0x523038){try{jsonpatch['apply'](_0x523038,_0x57c8f5,!![]);}catch(_0x21b964){return BPromise[_0x5f11('0x22')](_0x21b964);}return _0x523038[_0x5f11('0x23')]();};}function saveUpdates(_0x4153b0,_0x5d23a1){return function(_0x55b3c3){if(_0x55b3c3){return _0x55b3c3['update'](_0x4153b0)[_0x5f11('0x24')](function(_0x1c9628){return _0x1c9628;});}return null;};}function removeEntity(_0x59ec7d,_0x287b04){return function(_0x2a028f){if(_0x2a028f){return _0x2a028f[_0x5f11('0x25')]()['then'](function(){var _0x5bc717=_0x2a028f[_0x5f11('0x26')]({'plain':!![]});var _0x451beb=_0x5f11('0x27');return db[_0x5f11('0x28')][_0x5f11('0x25')]({'where':{'type':_0x451beb,'resourceId':_0x5bc717['id']}})[_0x5f11('0x24')](function(){return _0x2a028f;});})[_0x5f11('0x24')](function(){_0x59ec7d[_0x5f11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4166ac,_0x628e03){return function(_0x2be442){if(!_0x2be442){_0x4166ac[_0x5f11('0x18')](0x194);}return _0x2be442;};}function handleError(_0x284e41,_0x48c052){_0x48c052=_0x48c052||0x1f4;return function(_0x37dc8d){logger['error'](_0x37dc8d[_0x5f11('0x29')]);if(_0x37dc8d['name']){delete _0x37dc8d[_0x5f11('0x2a')];}_0x284e41[_0x5f11('0x19')](_0x48c052)['send'](_0x37dc8d);};}exports[_0x5f11('0x2b')]=function(_0x2fc04d,_0x3b5301){var _0x269347={},_0x77e94f={},_0x50418b={'count':0x0,'rows':[]};var _0x5e0ad4=_['map'](db['AnalyticExtractedReport'][_0x5f11('0x2c')],function(_0x434f8c){return{'name':_0x434f8c[_0x5f11('0x2d')],'type':_0x434f8c[_0x5f11('0x2e')][_0x5f11('0x2f')]};});_0x77e94f[_0x5f11('0x30')]=_[_0x5f11('0x31')](_0x5e0ad4,'name');_0x77e94f[_0x5f11('0x32')]=_['keys'](_0x2fc04d[_0x5f11('0x32')]);_0x77e94f[_0x5f11('0x33')]=_['intersection'](_0x77e94f[_0x5f11('0x30')],_0x77e94f[_0x5f11('0x32')]);_0x269347[_0x5f11('0x34')]=_[_0x5f11('0x35')](_0x77e94f[_0x5f11('0x30')],qs[_0x5f11('0x36')](_0x2fc04d[_0x5f11('0x32')][_0x5f11('0x36')]));_0x269347[_0x5f11('0x34')]=_0x269347[_0x5f11('0x34')][_0x5f11('0x37')]?_0x269347[_0x5f11('0x34')]:_0x77e94f[_0x5f11('0x30')];if(!_0x2fc04d[_0x5f11('0x32')]['hasOwnProperty'](_0x5f11('0x38'))){_0x269347[_0x5f11('0x1e')]=qs[_0x5f11('0x1e')](_0x2fc04d[_0x5f11('0x32')][_0x5f11('0x1e')]);_0x269347[_0x5f11('0x1c')]=qs[_0x5f11('0x1c')](_0x2fc04d['query']['offset']);}_0x269347['order']=qs[_0x5f11('0x39')](_0x2fc04d['query'][_0x5f11('0x39')]);_0x269347['where']=qs[_0x5f11('0x33')](_[_0x5f11('0x3a')](_0x2fc04d['query'],_0x77e94f[_0x5f11('0x33')]),_0x5e0ad4);if(_0x2fc04d[_0x5f11('0x32')][_0x5f11('0x3b')]){_0x269347[_0x5f11('0x3c')]=_[_0x5f11('0x3d')](_0x269347[_0x5f11('0x3c')],{'$or':_[_0x5f11('0x31')](_0x5e0ad4,function(_0x1cda37){if(_0x1cda37[_0x5f11('0x2e')]!==_0x5f11('0x3e')){var _0x4dce13={};_0x4dce13[_0x1cda37[_0x5f11('0x2a')]]={'$like':'%'+_0x2fc04d[_0x5f11('0x32')][_0x5f11('0x3b')]+'%'};return _0x4dce13;}})});}_0x269347=_[_0x5f11('0x3d')]({},_0x269347,_0x2fc04d[_0x5f11('0x3f')]);var _0x243844={'where':_0x269347[_0x5f11('0x3c')]};return db[_0x5f11('0x40')][_0x5f11('0x1f')](_0x243844)['then'](function(_0x116aa9){_0x50418b['count']=_0x116aa9;if(_0x2fc04d[_0x5f11('0x32')]['includeAll']){_0x269347['include']=[{'all':!![]}];}return db[_0x5f11('0x40')][_0x5f11('0x41')](_0x269347);})[_0x5f11('0x24')](function(_0x3bb22d){_0x50418b[_0x5f11('0x42')]=_0x3bb22d;return _0x50418b;})[_0x5f11('0x24')](respondWithFilteredResult(_0x3b5301,_0x269347))[_0x5f11('0x43')](handleError(_0x3b5301,null));};exports[_0x5f11('0x44')]=function(_0x3ee7d9,_0xa73f2f){var _0x4314ae={'raw':!![],'where':{'id':_0x3ee7d9[_0x5f11('0x45')]['id']}},_0x4a1f8d={};_0x4a1f8d[_0x5f11('0x30')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x4a1f8d[_0x5f11('0x32')]=_[_0x5f11('0x46')](_0x3ee7d9[_0x5f11('0x32')]);_0x4a1f8d[_0x5f11('0x33')]=_[_0x5f11('0x35')](_0x4a1f8d[_0x5f11('0x30')],_0x4a1f8d[_0x5f11('0x32')]);_0x4314ae['attributes']=_['intersection'](_0x4a1f8d[_0x5f11('0x30')],qs['fields'](_0x3ee7d9[_0x5f11('0x32')][_0x5f11('0x36')]));_0x4314ae[_0x5f11('0x34')]=_0x4314ae['attributes'][_0x5f11('0x37')]?_0x4314ae[_0x5f11('0x34')]:_0x4a1f8d[_0x5f11('0x30')];if(_0x3ee7d9[_0x5f11('0x32')][_0x5f11('0x47')]){_0x4314ae[_0x5f11('0x48')]=[{'all':!![]}];}_0x4314ae=_['merge']({},_0x4314ae,_0x3ee7d9[_0x5f11('0x3f')]);return db[_0x5f11('0x40')]['find'](_0x4314ae)[_0x5f11('0x24')](handleEntityNotFound(_0xa73f2f,null))[_0x5f11('0x24')](respondWithResult(_0xa73f2f,null))[_0x5f11('0x43')](handleError(_0xa73f2f,null));};exports['create']=function(_0x1e1be0,_0x352d5a){return db[_0x5f11('0x40')][_0x5f11('0x49')](_0x1e1be0[_0x5f11('0x4a')],{})[_0x5f11('0x24')](function(_0xc893ca){var _0x1c739a=_0x1e1be0[_0x5f11('0x4b')][_0x5f11('0x26')]({'plain':!![]});if(!_0x1c739a)throw new Error(_0x5f11('0x4c'));if(_0x1c739a[_0x5f11('0x4d')]===_0x5f11('0x4b')){var _0x2e867a=_0xc893ca[_0x5f11('0x26')]({'plain':!![]});var _0x4fb1d4='ExtractedReports';return db['UserProfileSection'][_0x5f11('0x4e')]({'where':{'name':_0x4fb1d4,'userProfileId':_0x1c739a[_0x5f11('0x4f')]},'raw':!![]})[_0x5f11('0x24')](function(_0x33f0e1){if(_0x33f0e1&&_0x33f0e1[_0x5f11('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2e867a['name'],'resourceId':_0x2e867a['id'],'type':_0x33f0e1[_0x5f11('0x2a')],'sectionId':_0x33f0e1['id']},{})[_0x5f11('0x24')](function(){return _0xc893ca;});}else{return _0xc893ca;}})[_0x5f11('0x43')](function(_0x5bf90e){logger[_0x5f11('0x51')](_0x5f11('0x52'),_0x5bf90e);throw _0x5bf90e;});}return _0xc893ca;})[_0x5f11('0x24')](respondWithResult(_0x352d5a,0xc9))[_0x5f11('0x43')](handleError(_0x352d5a,null));};exports[_0x5f11('0x53')]=function(_0x175077,_0x3dc810){if(_0x175077[_0x5f11('0x4a')]['id']){delete _0x175077[_0x5f11('0x4a')]['id'];}return db[_0x5f11('0x40')][_0x5f11('0x4e')]({'where':{'id':_0x175077[_0x5f11('0x45')]['id']}})[_0x5f11('0x24')](handleEntityNotFound(_0x3dc810,null))['then'](saveUpdates(_0x175077[_0x5f11('0x4a')],null))[_0x5f11('0x24')](respondWithResult(_0x3dc810,null))[_0x5f11('0x43')](handleError(_0x3dc810,null));};exports[_0x5f11('0x25')]=function(_0xcc6db8,_0x239168){return db[_0x5f11('0x40')][_0x5f11('0x4e')]({'where':{'id':_0xcc6db8[_0x5f11('0x45')]['id']}})['then'](handleEntityNotFound(_0x239168,null))['then'](removeEntity(_0x239168,null))[_0x5f11('0x43')](handleError(_0x239168,null));};exports[_0x5f11('0x54')]=function(_0x29a913,_0x851af8,_0x1c7f49){return db[_0x5f11('0x40')][_0x5f11('0x4e')]({'where':{'id':_0x29a913['params']['id']},'attributes':['name',_0x5f11('0x55'),'savename',_0x5f11('0x56')],'raw':!![]})[_0x5f11('0x24')](handleEntityNotFound(_0x851af8,null))[_0x5f11('0x24')](function(_0x5357ec){if(_0x5357ec){if(!fs[_0x5f11('0x57')](path[_0x5f11('0x58')](config['root'],_0x5f11('0x59'),_0x5357ec[_0x5f11('0x5a')]))){throw new db[(_0x5f11('0x5b'))][(_0x5f11('0x5c'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x29a913['query'][_0x5f11('0x5d')]){return _0x851af8[_0x5f11('0x18')](0xc8);}return _0x851af8[_0x5f11('0x54')](path['join'](config[_0x5f11('0x5e')],_0x5f11('0x59'),_0x5357ec[_0x5f11('0x5a')]),util[_0x5f11('0x5f')](_0x5f11('0x60'),_0x5357ec[_0x5f11('0x55')]||_0x5357ec[_0x5f11('0x2a')],_0x5357ec[_0x5f11('0x56')][_0x5f11('0x61')]()));}})[_0x5f11('0x43')](handleError(_0x851af8,null));}; \ No newline at end of file +var _0x74d4=['ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','update','destroy','then','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','index','AnalyticExtractedReport','type','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','existsSync','join','root','savename','Sequelize'];(function(_0x2b46a9,_0x56f304){var _0x4e03cd=function(_0x88e7dd){while(--_0x88e7dd){_0x2b46a9['push'](_0x2b46a9['shift']());}};_0x4e03cd(++_0x56f304);}(_0x74d4,0x1d8));var _0x474d=function(_0x4fa1c5,_0x186201){_0x4fa1c5=_0x4fa1c5-0x0;var _0x1dd3d0=_0x74d4[_0x4fa1c5];return _0x1dd3d0;};'use strict';var emlformat=require(_0x474d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x474d('0x1'));var jsonpatch=require(_0x474d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x474d('0x3'));var Mustache=require(_0x474d('0x4'));var util=require(_0x474d('0x5'));var path=require('path');var sox=require(_0x474d('0x6'));var csv=require('to-csv');var ejs=require(_0x474d('0x7'));var fs=require('fs');var fs_extra=require(_0x474d('0x8'));var _=require(_0x474d('0x9'));var squel=require(_0x474d('0xa'));var crypto=require('crypto');var jsforce=require(_0x474d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x474d('0xc'));var querystring=require(_0x474d('0xd'));var Papa=require(_0x474d('0xe'));var Redis=require(_0x474d('0xf'));var authService=require(_0x474d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x474d('0x11'));var hardwareService=require(_0x474d('0x12'));var logger=require(_0x474d('0x13'))(_0x474d('0x14'));var utils=require('../../config/utils');var config=require(_0x474d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x474d('0x16'))['db'];function respondWithStatusCode(_0x5b6740,_0xdf8369){_0xdf8369=_0xdf8369||0xcc;return function(_0x3692f4){if(_0x3692f4){return _0x5b6740['sendStatus'](_0xdf8369);}return _0x5b6740[_0x474d('0x17')](_0xdf8369)[_0x474d('0x18')]();};}function respondWithResult(_0x437da6,_0x55b1e4){_0x55b1e4=_0x55b1e4||0xc8;return function(_0x2e732d){if(_0x2e732d){return _0x437da6[_0x474d('0x17')](_0x55b1e4)[_0x474d('0x19')](_0x2e732d);}};}function respondWithFilteredResult(_0x1cb71a,_0x53b2fe){return function(_0x49c7ae){if(_0x49c7ae){var _0x16bdb5=typeof _0x53b2fe['offset']===_0x474d('0x1a')&&typeof _0x53b2fe[_0x474d('0x1b')]==='undefined';var _0x98bede=_0x49c7ae[_0x474d('0x1c')];var _0x36f78e=_0x16bdb5?0x0:_0x53b2fe[_0x474d('0x1d')];var _0x197591=_0x16bdb5?_0x49c7ae[_0x474d('0x1c')]:_0x53b2fe['offset']+_0x53b2fe['limit'];var _0x29de1f;if(_0x197591>=_0x98bede){_0x197591=_0x98bede;_0x29de1f=0xc8;}else{_0x29de1f=0xce;}_0x1cb71a['status'](_0x29de1f);return _0x1cb71a[_0x474d('0x1e')]('Content-Range',_0x36f78e+'-'+_0x197591+'/'+_0x98bede)[_0x474d('0x19')](_0x49c7ae);}return null;};}function patchUpdates(_0x4a18ec){return function(_0x4ae36d){try{jsonpatch[_0x474d('0x1f')](_0x4ae36d,_0x4a18ec,!![]);}catch(_0x1db236){return BPromise['reject'](_0x1db236);}return _0x4ae36d['save']();};}function saveUpdates(_0x4c5523,_0x4d4237){return function(_0x540ee8){if(_0x540ee8){return _0x540ee8[_0x474d('0x20')](_0x4c5523)['then'](function(_0x17fb91){return _0x17fb91;});}return null;};}function removeEntity(_0x4bcb51,_0x34be47){return function(_0x144ef2){if(_0x144ef2){return _0x144ef2[_0x474d('0x21')]()[_0x474d('0x22')](function(){var _0x915bcc=_0x144ef2[_0x474d('0x23')]({'plain':!![]});var _0x17feb8=_0x474d('0x24');return db[_0x474d('0x25')]['destroy']({'where':{'type':_0x17feb8,'resourceId':_0x915bcc['id']}})['then'](function(){return _0x144ef2;});})[_0x474d('0x22')](function(){_0x4bcb51[_0x474d('0x17')](0xcc)[_0x474d('0x18')]();});}};}function handleEntityNotFound(_0x323a61,_0x10b01a){return function(_0x58da09){if(!_0x58da09){_0x323a61[_0x474d('0x26')](0x194);}return _0x58da09;};}function handleError(_0x44a628,_0x454d96){_0x454d96=_0x454d96||0x1f4;return function(_0x210560){logger[_0x474d('0x27')](_0x210560[_0x474d('0x28')]);if(_0x210560['name']){delete _0x210560[_0x474d('0x29')];}_0x44a628[_0x474d('0x17')](_0x454d96)['send'](_0x210560);};}exports[_0x474d('0x2a')]=function(_0x4931d0,_0x3cc38b){var _0x5a59cf={},_0x4fc87d={},_0x34c15e={'count':0x0,'rows':[]};var _0x4b38bf=_['map'](db[_0x474d('0x2b')]['rawAttributes'],function(_0x1c8f4a){return{'name':_0x1c8f4a['fieldName'],'type':_0x1c8f4a[_0x474d('0x2c')]['key']};});_0x4fc87d[_0x474d('0x2d')]=_[_0x474d('0x2e')](_0x4b38bf,'name');_0x4fc87d['query']=_[_0x474d('0x2f')](_0x4931d0[_0x474d('0x30')]);_0x4fc87d[_0x474d('0x31')]=_[_0x474d('0x32')](_0x4fc87d['model'],_0x4fc87d[_0x474d('0x30')]);_0x5a59cf['attributes']=_['intersection'](_0x4fc87d[_0x474d('0x2d')],qs['fields'](_0x4931d0[_0x474d('0x30')][_0x474d('0x33')]));_0x5a59cf[_0x474d('0x34')]=_0x5a59cf[_0x474d('0x34')][_0x474d('0x35')]?_0x5a59cf['attributes']:_0x4fc87d['model'];if(!_0x4931d0[_0x474d('0x30')]['hasOwnProperty'](_0x474d('0x36'))){_0x5a59cf['limit']=qs[_0x474d('0x1b')](_0x4931d0[_0x474d('0x30')][_0x474d('0x1b')]);_0x5a59cf['offset']=qs[_0x474d('0x1d')](_0x4931d0[_0x474d('0x30')]['offset']);}_0x5a59cf[_0x474d('0x37')]=qs[_0x474d('0x38')](_0x4931d0[_0x474d('0x30')][_0x474d('0x38')]);_0x5a59cf[_0x474d('0x39')]=qs[_0x474d('0x31')](_[_0x474d('0x3a')](_0x4931d0[_0x474d('0x30')],_0x4fc87d[_0x474d('0x31')]),_0x4b38bf);if(_0x4931d0[_0x474d('0x30')][_0x474d('0x3b')]){_0x5a59cf[_0x474d('0x39')]=_[_0x474d('0x3c')](_0x5a59cf[_0x474d('0x39')],{'$or':_['map'](_0x4b38bf,function(_0x167e81){if(_0x167e81[_0x474d('0x2c')]!==_0x474d('0x3d')){var _0x12224e={};_0x12224e[_0x167e81[_0x474d('0x29')]]={'$like':'%'+_0x4931d0['query'][_0x474d('0x3b')]+'%'};return _0x12224e;}})});}_0x5a59cf=_[_0x474d('0x3c')]({},_0x5a59cf,_0x4931d0[_0x474d('0x3e')]);var _0x2e0286={'where':_0x5a59cf[_0x474d('0x39')]};return db[_0x474d('0x2b')][_0x474d('0x1c')](_0x2e0286)[_0x474d('0x22')](function(_0xfc9ab9){_0x34c15e[_0x474d('0x1c')]=_0xfc9ab9;if(_0x4931d0[_0x474d('0x30')][_0x474d('0x3f')]){_0x5a59cf[_0x474d('0x40')]=[{'all':!![]}];}return db[_0x474d('0x2b')]['findAll'](_0x5a59cf);})['then'](function(_0x24f867){_0x34c15e[_0x474d('0x41')]=_0x24f867;return _0x34c15e;})[_0x474d('0x22')](respondWithFilteredResult(_0x3cc38b,_0x5a59cf))[_0x474d('0x42')](handleError(_0x3cc38b,null));};exports['show']=function(_0x49e5db,_0x5e61bb){var _0x3540da={'raw':!![],'where':{'id':_0x49e5db[_0x474d('0x43')]['id']}},_0x3c3a80={};_0x3c3a80[_0x474d('0x2d')]=_[_0x474d('0x2f')](db[_0x474d('0x2b')][_0x474d('0x44')]);_0x3c3a80[_0x474d('0x30')]=_[_0x474d('0x2f')](_0x49e5db[_0x474d('0x30')]);_0x3c3a80['filters']=_[_0x474d('0x32')](_0x3c3a80['model'],_0x3c3a80[_0x474d('0x30')]);_0x3540da[_0x474d('0x34')]=_['intersection'](_0x3c3a80[_0x474d('0x2d')],qs[_0x474d('0x33')](_0x49e5db[_0x474d('0x30')][_0x474d('0x33')]));_0x3540da[_0x474d('0x34')]=_0x3540da[_0x474d('0x34')][_0x474d('0x35')]?_0x3540da[_0x474d('0x34')]:_0x3c3a80[_0x474d('0x2d')];if(_0x49e5db[_0x474d('0x30')]['includeAll']){_0x3540da[_0x474d('0x40')]=[{'all':!![]}];}_0x3540da=_[_0x474d('0x3c')]({},_0x3540da,_0x49e5db[_0x474d('0x3e')]);return db[_0x474d('0x2b')]['find'](_0x3540da)[_0x474d('0x22')](handleEntityNotFound(_0x5e61bb,null))[_0x474d('0x22')](respondWithResult(_0x5e61bb,null))[_0x474d('0x42')](handleError(_0x5e61bb,null));};exports[_0x474d('0x45')]=function(_0x34d98f,_0x16770e){return db[_0x474d('0x2b')][_0x474d('0x45')](_0x34d98f[_0x474d('0x46')],{})['then'](function(_0x4d81f7){var _0x3a35c9=_0x34d98f['user'][_0x474d('0x23')]({'plain':!![]});if(!_0x3a35c9)throw new Error(_0x474d('0x47'));if(_0x3a35c9[_0x474d('0x48')]===_0x474d('0x49')){var _0xf5d7ca=_0x4d81f7[_0x474d('0x23')]({'plain':!![]});var _0x4c61fc=_0x474d('0x24');return db[_0x474d('0x4a')][_0x474d('0x4b')]({'where':{'name':_0x4c61fc,'userProfileId':_0x3a35c9[_0x474d('0x4c')]},'raw':!![]})[_0x474d('0x22')](function(_0x3cea10){if(_0x3cea10&&_0x3cea10[_0x474d('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0xf5d7ca[_0x474d('0x29')],'resourceId':_0xf5d7ca['id'],'type':_0x3cea10[_0x474d('0x29')],'sectionId':_0x3cea10['id']},{})[_0x474d('0x22')](function(){return _0x4d81f7;});}else{return _0x4d81f7;}})[_0x474d('0x42')](function(_0x1766b4){logger[_0x474d('0x27')](_0x474d('0x4e'),_0x1766b4);throw _0x1766b4;});}return _0x4d81f7;})[_0x474d('0x22')](respondWithResult(_0x16770e,0xc9))[_0x474d('0x42')](handleError(_0x16770e,null));};exports[_0x474d('0x20')]=function(_0x43f70a,_0x30eebb){if(_0x43f70a['body']['id']){delete _0x43f70a[_0x474d('0x46')]['id'];}return db[_0x474d('0x2b')][_0x474d('0x4b')]({'where':{'id':_0x43f70a[_0x474d('0x43')]['id']}})[_0x474d('0x22')](handleEntityNotFound(_0x30eebb,null))[_0x474d('0x22')](saveUpdates(_0x43f70a[_0x474d('0x46')],null))[_0x474d('0x22')](respondWithResult(_0x30eebb,null))[_0x474d('0x42')](handleError(_0x30eebb,null));};exports[_0x474d('0x21')]=function(_0x109be1,_0x547718){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x109be1[_0x474d('0x43')]['id']}})['then'](handleEntityNotFound(_0x547718,null))['then'](removeEntity(_0x547718,null))[_0x474d('0x42')](handleError(_0x547718,null));};exports['download']=function(_0x4845e6,_0x500e5d,_0x29b9ff){return db[_0x474d('0x2b')][_0x474d('0x4b')]({'where':{'id':_0x4845e6['params']['id']},'attributes':[_0x474d('0x29'),_0x474d('0x4f'),'savename',_0x474d('0x50')],'raw':!![]})[_0x474d('0x22')](handleEntityNotFound(_0x500e5d,null))['then'](function(_0x40526d){if(_0x40526d){if(!fs[_0x474d('0x51')](path[_0x474d('0x52')](config[_0x474d('0x53')],'server/files/reports',_0x40526d[_0x474d('0x54')]))){throw new db[(_0x474d('0x55'))][(_0x474d('0x56'))](_0x474d('0x57'));}if(_0x4845e6[_0x474d('0x30')][_0x474d('0x58')]){return _0x500e5d['sendStatus'](0xc8);}return _0x500e5d[_0x474d('0x59')](path[_0x474d('0x52')](config[_0x474d('0x53')],'server/files/reports',_0x40526d[_0x474d('0x54')]),util[_0x474d('0x5a')](_0x474d('0x5b'),_0x40526d[_0x474d('0x4f')]||_0x40526d['name'],_0x40526d[_0x474d('0x50')][_0x474d('0x5c')]()));}})[_0x474d('0x42')](handleError(_0x500e5d,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1abeb1c..f524988 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 _0xb31a=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x16dbec,_0x133595){var _0x6785b4=function(_0x50a214){while(--_0x50a214){_0x16dbec['push'](_0x16dbec['shift']());}};_0x6785b4(++_0x133595);}(_0xb31a,0x7c));var _0xab31=function(_0x4ece6b,_0x20e7f5){_0x4ece6b=_0x4ece6b-0x0;var _0x1dae24=_0xb31a[_0x4ece6b];return _0x1dae24;};'use strict';var _=require(_0xab31('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xab31('0x1'));var BPromise=require(_0xab31('0x2'));var rp=require(_0xab31('0x3'));var fs=require('fs');var path=require(_0xab31('0x4'));var rimraf=require('rimraf');var config=require(_0xab31('0x5'));var attributes=require(_0xab31('0x6'));module[_0xab31('0x7')]=function(_0x3d93f5,_0x2a3629){return _0x3d93f5[_0xab31('0x8')](_0xab31('0x9'),attributes,{'tableName':_0xab31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dad=['./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f39cf,_0x3c59ec){var _0xd0ece8=function(_0x4ffc0f){while(--_0x4ffc0f){_0x2f39cf['push'](_0x2f39cf['shift']());}};_0xd0ece8(++_0x3c59ec);}(_0x5dad,0xb8));var _0xd5da=function(_0x94f458,_0x16606d){_0x94f458=_0x94f458-0x0;var _0x1ddcda=_0x5dad[_0x94f458];return _0x1ddcda;};'use strict';var _=require('lodash');var util=require(_0xd5da('0x0'));var logger=require(_0xd5da('0x1'))(_0xd5da('0x2'));var moment=require('moment');var BPromise=require(_0xd5da('0x3'));var rp=require(_0xd5da('0x4'));var fs=require('fs');var path=require(_0xd5da('0x5'));var rimraf=require(_0xd5da('0x6'));var config=require(_0xd5da('0x7'));var attributes=require(_0xd5da('0x8'));module['exports']=function(_0x2cd169,_0x1af437){return _0x2cd169[_0xd5da('0x9')](_0xd5da('0xa'),attributes,{'tableName':_0xd5da('0xb'),'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 4d91348..88f3bf9 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 _0x1869=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x199b4c,_0x3c0920){var _0x36c372=function(_0x52f27c){while(--_0x52f27c){_0x199b4c['push'](_0x199b4c['shift']());}};_0x36c372(++_0x3c0920);}(_0x1869,0x1c3));var _0x9186=function(_0x7af2bd,_0x23021a){_0x7af2bd=_0x7af2bd-0x0;var _0x458a6f=_0x1869[_0x7af2bd];return _0x458a6f;};'use strict';var _=require(_0x9186('0x0'));var util=require(_0x9186('0x1'));var moment=require(_0x9186('0x2'));var BPromise=require(_0x9186('0x3'));var rs=require(_0x9186('0x4'));var fs=require('fs');var Redis=require(_0x9186('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9186('0x6'));var logger=require(_0x9186('0x7'))(_0x9186('0x8'));var config=require(_0x9186('0x9'));var jayson=require(_0x9186('0xa'));var client=jayson[_0x9186('0xb')][_0x9186('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15949d,_0x1a39af,_0x2b881){return new BPromise(function(_0xacb782,_0x3762ec){return client[_0x9186('0xd')](_0x15949d,_0x2b881)[_0x9186('0xe')](function(_0x2e05da){logger[_0x9186('0xf')](_0x9186('0x10'),_0x1a39af,_0x9186('0x11'));logger['debug'](_0x9186('0x12'),_0x1a39af,'request\x20sent',JSON[_0x9186('0x13')](_0x2e05da));if(_0x2e05da[_0x9186('0x14')]){if(_0x2e05da['error'][_0x9186('0x15')]===0x1f4){logger[_0x9186('0x14')](_0x9186('0x10'),_0x1a39af,_0x2e05da[_0x9186('0x14')]['message']);return _0x3762ec(_0x2e05da[_0x9186('0x14')][_0x9186('0x16')]);}logger[_0x9186('0x14')](_0x9186('0x10'),_0x1a39af,_0x2e05da[_0x9186('0x14')][_0x9186('0x16')]);return _0xacb782(_0x2e05da['error'][_0x9186('0x16')]);}else{logger[_0x9186('0xf')](_0x9186('0x10'),_0x1a39af,_0x9186('0x11'));_0xacb782(_0x2e05da[_0x9186('0x17')][_0x9186('0x16')]);}})['catch'](function(_0x18739a){logger[_0x9186('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1a39af,_0x18739a);_0x3762ec(_0x18739a);});});} \ No newline at end of file +var _0x7ce8=['error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x6cdf4f,_0x28aa59){var _0x284852=function(_0x4d0c08){while(--_0x4d0c08){_0x6cdf4f['push'](_0x6cdf4f['shift']());}};_0x284852(++_0x28aa59);}(_0x7ce8,0x165));var _0x87ce=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7ce8[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x87ce('0x0'));var util=require(_0x87ce('0x1'));var moment=require(_0x87ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87ce('0x3'));var db=require(_0x87ce('0x4'))['db'];var utils=require(_0x87ce('0x5'));var logger=require(_0x87ce('0x6'))(_0x87ce('0x7'));var config=require(_0x87ce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x87ce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2903b5,_0x54dbdb,_0x53fa9e){return new BPromise(function(_0x3a9598,_0x43f500){return client[_0x87ce('0xa')](_0x2903b5,_0x53fa9e)[_0x87ce('0xb')](function(_0x36b92a){logger['info'](_0x87ce('0xc'),_0x54dbdb,'request\x20sent');logger[_0x87ce('0xd')](_0x87ce('0xe'),_0x54dbdb,_0x87ce('0xf'),JSON[_0x87ce('0x10')](_0x36b92a));if(_0x36b92a[_0x87ce('0x11')]){if(_0x36b92a[_0x87ce('0x11')]['code']===0x1f4){logger['error'](_0x87ce('0xc'),_0x54dbdb,_0x36b92a[_0x87ce('0x11')][_0x87ce('0x12')]);return _0x43f500(_0x36b92a['error'][_0x87ce('0x12')]);}logger['error'](_0x87ce('0xc'),_0x54dbdb,_0x36b92a[_0x87ce('0x11')][_0x87ce('0x12')]);return _0x3a9598(_0x36b92a[_0x87ce('0x11')][_0x87ce('0x12')]);}else{logger[_0x87ce('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x54dbdb,_0x87ce('0xf'));_0x3a9598(_0x36b92a[_0x87ce('0x14')][_0x87ce('0x12')]);}})[_0x87ce('0x15')](function(_0x4cf8b6){logger[_0x87ce('0x11')](_0x87ce('0xc'),_0x54dbdb,_0x4cf8b6);_0x43f500(_0x4cf8b6);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 68c600c..76eca91 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 _0x12fa=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1807b4,_0x1a2315){var _0x380523=function(_0x3af905){while(--_0x3af905){_0x1807b4['push'](_0x1807b4['shift']());}};_0x380523(++_0x1a2315);}(_0x12fa,0xfd));var _0xa12f=function(_0x1d721e,_0x329bfe){_0x1d721e=_0x1d721e-0x0;var _0x458fa9=_0x12fa[_0x1d721e];return _0x458fa9;};'use strict';var multer=require('multer');var util=require(_0xa12f('0x0'));var path=require(_0xa12f('0x1'));var timeout=require(_0xa12f('0x2'));var express=require(_0xa12f('0x3'));var router=express[_0xa12f('0x4')]();var fs_extra=require(_0xa12f('0x5'));var auth=require(_0xa12f('0x6'));var interaction=require(_0xa12f('0x7'));var config=require(_0xa12f('0x8'));var controller=require(_0xa12f('0x9'));router[_0xa12f('0xa')]('/',auth[_0xa12f('0xb')](),controller[_0xa12f('0xc')]);router[_0xa12f('0xa')]('/:id',auth[_0xa12f('0xb')](),controller[_0xa12f('0xd')]);router[_0xa12f('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xa12f('0xe')]('/',auth[_0xa12f('0xb')](),controller[_0xa12f('0xf')]);router[_0xa12f('0x10')]('/:id',auth[_0xa12f('0xb')](),controller[_0xa12f('0x11')]);router['delete'](_0xa12f('0x12'),auth[_0xa12f('0xb')](),controller['destroy']);module[_0xa12f('0x13')]=router; \ No newline at end of file +var _0xe5db=['update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id/download','download','/:id'];(function(_0x4bb675,_0x569a01){var _0x4064c5=function(_0x4a409e){while(--_0x4a409e){_0x4bb675['push'](_0x4bb675['shift']());}};_0x4064c5(++_0x569a01);}(_0xe5db,0xf1));var _0xbe5d=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0xe5db[_0x1f16de];return _0x36cd80;};'use strict';var multer=require(_0xbe5d('0x0'));var util=require('util');var path=require(_0xbe5d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe5d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbe5d('0x3'));var interaction=require(_0xbe5d('0x4'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xbe5d('0x5')]('/',auth['isAuthenticated'](),controller[_0xbe5d('0x6')]);router[_0xbe5d('0x5')]('/:id',auth[_0xbe5d('0x7')](),controller['show']);router[_0xbe5d('0x5')](_0xbe5d('0x8'),auth[_0xbe5d('0x7')](),controller[_0xbe5d('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbe5d('0xa'),auth[_0xbe5d('0x7')](),controller[_0xbe5d('0xb')]);router[_0xbe5d('0xc')](_0xbe5d('0xa'),auth['isAuthenticated'](),controller[_0xbe5d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 69a313d..b1d1e90 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 _0xcda0=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x442b6e,_0x27c6b1){var _0x349e9c=function(_0x370f05){while(--_0x370f05){_0x442b6e['push'](_0x442b6e['shift']());}};_0x349e9c(++_0x27c6b1);}(_0xcda0,0x19d));var _0x0cda=function(_0x39a873,_0x449c58){_0x39a873=_0x39a873-0x0;var _0x3a2c5f=_0xcda0[_0x39a873];return _0x3a2c5f;};'use strict';var Sequelize=require(_0x0cda('0x0'));module[_0x0cda('0x1')]={'field':{'type':Sequelize[_0x0cda('0x2')]},'alias':{'type':Sequelize[_0x0cda('0x3')]},'function':{'type':Sequelize[_0x0cda('0x3')]},'format':{'type':Sequelize[_0x0cda('0x3')]},'groupBy':{'type':Sequelize[_0x0cda('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0cda('0x3')]},'custom':{'type':Sequelize[_0x0cda('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x78d8=['STRING','BOOLEAN','exports','TEXT'];(function(_0x99ab5a,_0x12f418){var _0x12cba8=function(_0x3096ec){while(--_0x3096ec){_0x99ab5a['push'](_0x99ab5a['shift']());}};_0x12cba8(++_0x12f418);}(_0x78d8,0x112));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x878d('0x0')]={'field':{'type':Sequelize[_0x878d('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x878d('0x2')]},'format':{'type':Sequelize[_0x878d('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x878d('0x2')]},'custom':{'type':Sequelize[_0x878d('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index be5af56..4a0e665 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 _0xe756=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','update','destroy','end','error','name','index','map','AnalyticFieldReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','bulkCreate','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x116ea2,_0x581107){var _0x3448e9=function(_0x5ebc9a){while(--_0x5ebc9a){_0x116ea2['push'](_0x116ea2['shift']());}};_0x3448e9(++_0x581107);}(_0xe756,0x8d));var _0x6e75=function(_0x395f0f,_0x398025){_0x395f0f=_0x395f0f-0x0;var _0x3eada0=_0xe756[_0x395f0f];return _0x3eada0;};'use strict';var emlformat=require(_0x6e75('0x0'));var rimraf=require(_0x6e75('0x1'));var zipdir=require(_0x6e75('0x2'));var jsonpatch=require(_0x6e75('0x3'));var rp=require(_0x6e75('0x4'));var moment=require('moment');var BPromise=require(_0x6e75('0x5'));var Mustache=require(_0x6e75('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6e75('0x7'));var csv=require(_0x6e75('0x8'));var ejs=require(_0x6e75('0x9'));var fs=require('fs');var fs_extra=require(_0x6e75('0xa'));var _=require(_0x6e75('0xb'));var squel=require(_0x6e75('0xc'));var crypto=require('crypto');var jsforce=require(_0x6e75('0xd'));var deskjs=require(_0x6e75('0xe'));var toCsv=require(_0x6e75('0x8'));var querystring=require('querystring');var Papa=require(_0x6e75('0xf'));var Redis=require(_0x6e75('0x10'));var authService=require(_0x6e75('0x11'));var qs=require(_0x6e75('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e75('0x13'));var logger=require('../../config/logger')(_0x6e75('0x14'));var utils=require(_0x6e75('0x15'));var config=require(_0x6e75('0x16'));var licenseUtil=require(_0x6e75('0x17'));var db=require(_0x6e75('0x18'))['db'];function respondWithStatusCode(_0x5d8b1e,_0x3de5f5){_0x3de5f5=_0x3de5f5||0xcc;return function(_0x27a407){if(_0x27a407){return _0x5d8b1e[_0x6e75('0x19')](_0x3de5f5);}return _0x5d8b1e['status'](_0x3de5f5)['end']();};}function respondWithResult(_0x3f29c1,_0x15c2dc){_0x15c2dc=_0x15c2dc||0xc8;return function(_0x5da9a5){if(_0x5da9a5){return _0x3f29c1['status'](_0x15c2dc)[_0x6e75('0x1a')](_0x5da9a5);}};}function respondWithFilteredResult(_0x38a2b8,_0x42a732){return function(_0x49d28b){if(_0x49d28b){var _0x1b2506=typeof _0x42a732[_0x6e75('0x1b')]===_0x6e75('0x1c')&&typeof _0x42a732[_0x6e75('0x1d')]===_0x6e75('0x1c');var _0x1770ac=_0x49d28b['count'];var _0x286d49=_0x1b2506?0x0:_0x42a732['offset'];var _0x233b77=_0x1b2506?_0x49d28b[_0x6e75('0x1e')]:_0x42a732['offset']+_0x42a732[_0x6e75('0x1d')];var _0x3d6749;if(_0x233b77>=_0x1770ac){_0x233b77=_0x1770ac;_0x3d6749=0xc8;}else{_0x3d6749=0xce;}_0x38a2b8[_0x6e75('0x1f')](_0x3d6749);return _0x38a2b8[_0x6e75('0x20')]('Content-Range',_0x286d49+'-'+_0x233b77+'/'+_0x1770ac)['json'](_0x49d28b);}return null;};}function patchUpdates(_0x249859){return function(_0x549138){try{jsonpatch[_0x6e75('0x21')](_0x549138,_0x249859,!![]);}catch(_0x55a0eb){return BPromise[_0x6e75('0x22')](_0x55a0eb);}return _0x549138['save']();};}function saveUpdates(_0x2bc685,_0x5be674){return function(_0x5b617a){if(_0x5b617a){return _0x5b617a[_0x6e75('0x23')](_0x2bc685)['then'](function(_0xee6788){return _0xee6788;});}return null;};}function removeEntity(_0x53a9ea,_0x2f049b){return function(_0x1a5323){if(_0x1a5323){return _0x1a5323[_0x6e75('0x24')]()['then'](function(){_0x53a9ea[_0x6e75('0x1f')](0xcc)[_0x6e75('0x25')]();});}};}function handleEntityNotFound(_0x3fbdde,_0x421a7b){return function(_0x5ed37d){if(!_0x5ed37d){_0x3fbdde[_0x6e75('0x19')](0x194);}return _0x5ed37d;};}function handleError(_0x7bb451,_0x8d2908){_0x8d2908=_0x8d2908||0x1f4;return function(_0x3b93ff){logger[_0x6e75('0x26')](_0x3b93ff['stack']);if(_0x3b93ff['name']){delete _0x3b93ff[_0x6e75('0x27')];}_0x7bb451[_0x6e75('0x1f')](_0x8d2908)['send'](_0x3b93ff);};}exports[_0x6e75('0x28')]=function(_0x1c0a6b,_0x138696){var _0x158dda={},_0x352d0b={},_0x137b26={'count':0x0,'rows':[]};var _0x455c3f=_[_0x6e75('0x29')](db[_0x6e75('0x2a')][_0x6e75('0x2b')],function(_0x56690d){return{'name':_0x56690d['fieldName'],'type':_0x56690d[_0x6e75('0x2c')]['key']};});_0x352d0b[_0x6e75('0x2d')]=_[_0x6e75('0x29')](_0x455c3f,_0x6e75('0x27'));_0x352d0b[_0x6e75('0x2e')]=_[_0x6e75('0x2f')](_0x1c0a6b[_0x6e75('0x2e')]);_0x352d0b[_0x6e75('0x30')]=_[_0x6e75('0x31')](_0x352d0b[_0x6e75('0x2d')],_0x352d0b[_0x6e75('0x2e')]);_0x158dda['attributes']=_[_0x6e75('0x31')](_0x352d0b[_0x6e75('0x2d')],qs[_0x6e75('0x32')](_0x1c0a6b[_0x6e75('0x2e')]['fields']));_0x158dda[_0x6e75('0x33')]=_0x158dda[_0x6e75('0x33')]['length']?_0x158dda[_0x6e75('0x33')]:_0x352d0b[_0x6e75('0x2d')];if(!_0x1c0a6b['query'][_0x6e75('0x34')]('nolimit')){_0x158dda[_0x6e75('0x1d')]=qs[_0x6e75('0x1d')](_0x1c0a6b['query'][_0x6e75('0x1d')]);_0x158dda['offset']=qs[_0x6e75('0x1b')](_0x1c0a6b[_0x6e75('0x2e')]['offset']);}_0x158dda[_0x6e75('0x35')]=qs['sort'](_0x1c0a6b[_0x6e75('0x2e')][_0x6e75('0x36')]);_0x158dda[_0x6e75('0x37')]=qs[_0x6e75('0x30')](_[_0x6e75('0x38')](_0x1c0a6b[_0x6e75('0x2e')],_0x352d0b[_0x6e75('0x30')]),_0x455c3f);if(_0x1c0a6b[_0x6e75('0x2e')]['filter']){_0x158dda[_0x6e75('0x37')]=_['merge'](_0x158dda[_0x6e75('0x37')],{'$or':_[_0x6e75('0x29')](_0x455c3f,function(_0x16de38){if(_0x16de38[_0x6e75('0x2c')]!==_0x6e75('0x39')){var _0x12affd={};_0x12affd[_0x16de38['name']]={'$like':'%'+_0x1c0a6b['query'][_0x6e75('0x3a')]+'%'};return _0x12affd;}})});}_0x158dda=_[_0x6e75('0x3b')]({},_0x158dda,_0x1c0a6b[_0x6e75('0x3c')]);var _0x1c4bce={'where':_0x158dda[_0x6e75('0x37')]};return db[_0x6e75('0x2a')][_0x6e75('0x1e')](_0x1c4bce)[_0x6e75('0x3d')](function(_0x350dd8){_0x137b26[_0x6e75('0x1e')]=_0x350dd8;if(_0x1c0a6b['query'][_0x6e75('0x3e')]){_0x158dda[_0x6e75('0x3f')]=[{'all':!![]}];}return db[_0x6e75('0x2a')][_0x6e75('0x40')](_0x158dda);})[_0x6e75('0x3d')](function(_0x34ec5a){_0x137b26[_0x6e75('0x41')]=_0x34ec5a;return _0x137b26;})[_0x6e75('0x3d')](respondWithFilteredResult(_0x138696,_0x158dda))[_0x6e75('0x42')](handleError(_0x138696,null));};exports[_0x6e75('0x43')]=function(_0x28ca6f,_0x48bdb){var _0x22d34f={'raw':![],'where':{'id':_0x28ca6f[_0x6e75('0x44')]['id']}},_0x21acd6={};_0x21acd6[_0x6e75('0x2d')]=_[_0x6e75('0x2f')](db['AnalyticFieldReport'][_0x6e75('0x2b')]);_0x21acd6[_0x6e75('0x2e')]=_[_0x6e75('0x2f')](_0x28ca6f[_0x6e75('0x2e')]);_0x21acd6[_0x6e75('0x30')]=_[_0x6e75('0x31')](_0x21acd6[_0x6e75('0x2d')],_0x21acd6['query']);_0x22d34f['attributes']=_[_0x6e75('0x31')](_0x21acd6[_0x6e75('0x2d')],qs[_0x6e75('0x32')](_0x28ca6f[_0x6e75('0x2e')][_0x6e75('0x32')]));_0x22d34f[_0x6e75('0x33')]=_0x22d34f[_0x6e75('0x33')][_0x6e75('0x45')]?_0x22d34f['attributes']:_0x21acd6['model'];if(_0x28ca6f[_0x6e75('0x2e')][_0x6e75('0x3e')]){_0x22d34f[_0x6e75('0x3f')]=[{'all':!![]}];}_0x22d34f=_['merge']({},_0x22d34f,_0x28ca6f[_0x6e75('0x3c')]);return db['AnalyticFieldReport'][_0x6e75('0x46')](_0x22d34f)[_0x6e75('0x3d')](handleEntityNotFound(_0x48bdb,null))[_0x6e75('0x3d')](respondWithResult(_0x48bdb,null))[_0x6e75('0x42')](handleError(_0x48bdb,null));};exports[_0x6e75('0x47')]=function(_0x4d2e93,_0x1eb5dd){return db['AnalyticFieldReport'][_0x6e75('0x47')](_0x4d2e93[_0x6e75('0x48')],{})[_0x6e75('0x3d')](respondWithResult(_0x1eb5dd,0xc9))[_0x6e75('0x42')](handleError(_0x1eb5dd,null));};exports[_0x6e75('0x49')]=function(_0x2eb8c7,_0x446c31){return db[_0x6e75('0x2a')][_0x6e75('0x49')](_0x2eb8c7[_0x6e75('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x446c31,0xc9))[_0x6e75('0x42')](handleError(_0x446c31,null));};exports[_0x6e75('0x23')]=function(_0x8f81d0,_0x4a68b1){if(_0x8f81d0[_0x6e75('0x48')]['id']){delete _0x8f81d0['body']['id'];}return db[_0x6e75('0x2a')][_0x6e75('0x46')]({'where':{'id':_0x8f81d0[_0x6e75('0x44')]['id']}})[_0x6e75('0x3d')](handleEntityNotFound(_0x4a68b1,null))[_0x6e75('0x3d')](saveUpdates(_0x8f81d0[_0x6e75('0x48')],null))['then'](respondWithResult(_0x4a68b1,null))[_0x6e75('0x42')](handleError(_0x4a68b1,null));};exports[_0x6e75('0x24')]=function(_0x11023f,_0x2086be){return db[_0x6e75('0x2a')][_0x6e75('0x46')]({'where':{'id':_0x11023f['params']['id']}})[_0x6e75('0x3d')](handleEntityNotFound(_0x2086be,null))[_0x6e75('0x3d')](removeEntity(_0x2086be,null))[_0x6e75('0x42')](handleError(_0x2086be,null));};exports[_0x6e75('0x4a')]=function(_0x268d03,_0x46019b){return db[_0x6e75('0x2a')]['destroy']({'where':{'id':_0x268d03[_0x6e75('0x2e')][_0x6e75('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x6e75('0x3d')](respondWithResult(_0x46019b,0xcc))['catch'](handleError(_0x46019b,null));};exports[_0x6e75('0x4c')]=function(_0x1275f8,_0x55533e,_0x40bcee){return db['AnalyticCustomReport'][_0x6e75('0x4d')]({'where':{'id':_0x1275f8[_0x6e75('0x44')]['id']}})[_0x6e75('0x3d')](handleEntityNotFound(_0x55533e,null))['then'](function(_0x592e1c){if(_0x592e1c){return db[_0x6e75('0x4e')][_0x6e75('0x4f')](function(_0xc0b796){return db['AnalyticFieldReport'][_0x6e75('0x24')]({'where':{'CustomReportId':_0x1275f8[_0x6e75('0x44')]['id']},'transaction':_0xc0b796})[_0x6e75('0x3d')](function(_0x339f54){var _0x53ea80=_[_0x6e75('0x29')](_0x1275f8['body'],function(_0x2e1582){delete _0x2e1582['id'];_0x2e1582[_0x6e75('0x50')]=_0x1275f8['params']['id'];return _0x2e1582;});return db[_0x6e75('0x2a')][_0x6e75('0x49')](_0x53ea80,{'transaction':_0xc0b796});});})['then'](function(){return db[_0x6e75('0x2a')][_0x6e75('0x40')]({'where':{'CustomReportId':_0x1275f8[_0x6e75('0x44')]['id']}});});}})['then'](respondWithResult(_0x55533e,null))[_0x6e75('0x42')](handleError(_0x55533e,null));}; \ No newline at end of file +var _0x06e0=['error','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','bulkCreate','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','zip-dir','request-promise','moment','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus'];(function(_0x30c48d,_0x25e828){var _0x2c64aa=function(_0x244ae6){while(--_0x244ae6){_0x30c48d['push'](_0x30c48d['shift']());}};_0x2c64aa(++_0x25e828);}(_0x06e0,0x10f));var _0x006e=function(_0x4b70a2,_0x5d0fbd){_0x4b70a2=_0x4b70a2-0x0;var _0x2170fa=_0x06e0[_0x4b70a2];return _0x2170fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x006e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x006e('0x1'));var moment=require(_0x006e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x006e('0x3'));var ejs=require(_0x006e('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x006e('0x5'));var jsforce=require(_0x006e('0x6'));var deskjs=require('desk.js');var toCsv=require(_0x006e('0x3'));var querystring=require(_0x006e('0x7'));var Papa=require(_0x006e('0x8'));var Redis=require('ioredis');var authService=require(_0x006e('0x9'));var qs=require(_0x006e('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x006e('0xb'));var logger=require(_0x006e('0xc'))('api');var utils=require(_0x006e('0xd'));var config=require('../../config/environment');var licenseUtil=require(_0x006e('0xe'));var db=require(_0x006e('0xf'))['db'];function respondWithStatusCode(_0x4b3c29,_0x53c690){_0x53c690=_0x53c690||0xcc;return function(_0x2680e6){if(_0x2680e6){return _0x4b3c29['sendStatus'](_0x53c690);}return _0x4b3c29[_0x006e('0x10')](_0x53c690)[_0x006e('0x11')]();};}function respondWithResult(_0x264594,_0xed37ea){_0xed37ea=_0xed37ea||0xc8;return function(_0x5b5060){if(_0x5b5060){return _0x264594[_0x006e('0x10')](_0xed37ea)[_0x006e('0x12')](_0x5b5060);}};}function respondWithFilteredResult(_0x5c8074,_0x3af4fc){return function(_0x5eb4c9){if(_0x5eb4c9){var _0x1b2778=typeof _0x3af4fc[_0x006e('0x13')]===_0x006e('0x14')&&typeof _0x3af4fc[_0x006e('0x15')]===_0x006e('0x14');var _0x595fa0=_0x5eb4c9[_0x006e('0x16')];var _0x2a6c30=_0x1b2778?0x0:_0x3af4fc[_0x006e('0x13')];var _0x25824f=_0x1b2778?_0x5eb4c9[_0x006e('0x16')]:_0x3af4fc[_0x006e('0x13')]+_0x3af4fc[_0x006e('0x15')];var _0x6295cb;if(_0x25824f>=_0x595fa0){_0x25824f=_0x595fa0;_0x6295cb=0xc8;}else{_0x6295cb=0xce;}_0x5c8074[_0x006e('0x10')](_0x6295cb);return _0x5c8074[_0x006e('0x17')](_0x006e('0x18'),_0x2a6c30+'-'+_0x25824f+'/'+_0x595fa0)['json'](_0x5eb4c9);}return null;};}function patchUpdates(_0x27bfe9){return function(_0x5c8930){try{jsonpatch['apply'](_0x5c8930,_0x27bfe9,!![]);}catch(_0x4894c8){return BPromise[_0x006e('0x19')](_0x4894c8);}return _0x5c8930['save']();};}function saveUpdates(_0x5bbf51,_0x42bf94){return function(_0x3e0119){if(_0x3e0119){return _0x3e0119[_0x006e('0x1a')](_0x5bbf51)['then'](function(_0x59006f){return _0x59006f;});}return null;};}function removeEntity(_0x2935cd,_0xe212d3){return function(_0x7fd0a6){if(_0x7fd0a6){return _0x7fd0a6['destroy']()[_0x006e('0x1b')](function(){_0x2935cd['status'](0xcc)[_0x006e('0x11')]();});}};}function handleEntityNotFound(_0x5c874e,_0x4d50b0){return function(_0x6320d1){if(!_0x6320d1){_0x5c874e[_0x006e('0x1c')](0x194);}return _0x6320d1;};}function handleError(_0x354e63,_0x17e665){_0x17e665=_0x17e665||0x1f4;return function(_0x13e213){logger[_0x006e('0x1d')](_0x13e213['stack']);if(_0x13e213[_0x006e('0x1e')]){delete _0x13e213[_0x006e('0x1e')];}_0x354e63[_0x006e('0x10')](_0x17e665)[_0x006e('0x1f')](_0x13e213);};}exports[_0x006e('0x20')]=function(_0x1f32b3,_0x35298f){var _0xb1b8a8={},_0x15a081={},_0x1d9234={'count':0x0,'rows':[]};var _0x246a3f=_['map'](db[_0x006e('0x21')][_0x006e('0x22')],function(_0x29aa3e){return{'name':_0x29aa3e[_0x006e('0x23')],'type':_0x29aa3e[_0x006e('0x24')]['key']};});_0x15a081[_0x006e('0x25')]=_[_0x006e('0x26')](_0x246a3f,_0x006e('0x1e'));_0x15a081[_0x006e('0x27')]=_['keys'](_0x1f32b3[_0x006e('0x27')]);_0x15a081['filters']=_[_0x006e('0x28')](_0x15a081[_0x006e('0x25')],_0x15a081[_0x006e('0x27')]);_0xb1b8a8['attributes']=_['intersection'](_0x15a081[_0x006e('0x25')],qs[_0x006e('0x29')](_0x1f32b3[_0x006e('0x27')][_0x006e('0x29')]));_0xb1b8a8[_0x006e('0x2a')]=_0xb1b8a8[_0x006e('0x2a')]['length']?_0xb1b8a8['attributes']:_0x15a081['model'];if(!_0x1f32b3[_0x006e('0x27')][_0x006e('0x2b')](_0x006e('0x2c'))){_0xb1b8a8['limit']=qs['limit'](_0x1f32b3[_0x006e('0x27')]['limit']);_0xb1b8a8[_0x006e('0x13')]=qs[_0x006e('0x13')](_0x1f32b3[_0x006e('0x27')]['offset']);}_0xb1b8a8[_0x006e('0x2d')]=qs[_0x006e('0x2e')](_0x1f32b3[_0x006e('0x27')][_0x006e('0x2e')]);_0xb1b8a8['where']=qs[_0x006e('0x2f')](_[_0x006e('0x30')](_0x1f32b3[_0x006e('0x27')],_0x15a081[_0x006e('0x2f')]),_0x246a3f);if(_0x1f32b3[_0x006e('0x27')]['filter']){_0xb1b8a8[_0x006e('0x31')]=_[_0x006e('0x32')](_0xb1b8a8[_0x006e('0x31')],{'$or':_[_0x006e('0x26')](_0x246a3f,function(_0x29ccb8){if(_0x29ccb8['type']!==_0x006e('0x33')){var _0x33979c={};_0x33979c[_0x29ccb8[_0x006e('0x1e')]]={'$like':'%'+_0x1f32b3[_0x006e('0x27')][_0x006e('0x34')]+'%'};return _0x33979c;}})});}_0xb1b8a8=_['merge']({},_0xb1b8a8,_0x1f32b3[_0x006e('0x35')]);var _0x49f716={'where':_0xb1b8a8['where']};return db[_0x006e('0x21')][_0x006e('0x16')](_0x49f716)['then'](function(_0x123df7){_0x1d9234[_0x006e('0x16')]=_0x123df7;if(_0x1f32b3[_0x006e('0x27')][_0x006e('0x36')]){_0xb1b8a8[_0x006e('0x37')]=[{'all':!![]}];}return db[_0x006e('0x21')][_0x006e('0x38')](_0xb1b8a8);})[_0x006e('0x1b')](function(_0x5b5f0a){_0x1d9234[_0x006e('0x39')]=_0x5b5f0a;return _0x1d9234;})['then'](respondWithFilteredResult(_0x35298f,_0xb1b8a8))[_0x006e('0x3a')](handleError(_0x35298f,null));};exports[_0x006e('0x3b')]=function(_0x26fdaa,_0x53e377){var _0x51d1c2={'raw':![],'where':{'id':_0x26fdaa[_0x006e('0x3c')]['id']}},_0x907f6a={};_0x907f6a[_0x006e('0x25')]=_['keys'](db[_0x006e('0x21')]['rawAttributes']);_0x907f6a['query']=_[_0x006e('0x3d')](_0x26fdaa[_0x006e('0x27')]);_0x907f6a[_0x006e('0x2f')]=_[_0x006e('0x28')](_0x907f6a[_0x006e('0x25')],_0x907f6a[_0x006e('0x27')]);_0x51d1c2['attributes']=_[_0x006e('0x28')](_0x907f6a[_0x006e('0x25')],qs['fields'](_0x26fdaa['query']['fields']));_0x51d1c2[_0x006e('0x2a')]=_0x51d1c2[_0x006e('0x2a')][_0x006e('0x3e')]?_0x51d1c2['attributes']:_0x907f6a[_0x006e('0x25')];if(_0x26fdaa['query']['includeAll']){_0x51d1c2[_0x006e('0x37')]=[{'all':!![]}];}_0x51d1c2=_[_0x006e('0x32')]({},_0x51d1c2,_0x26fdaa['options']);return db[_0x006e('0x21')][_0x006e('0x3f')](_0x51d1c2)[_0x006e('0x1b')](handleEntityNotFound(_0x53e377,null))['then'](respondWithResult(_0x53e377,null))[_0x006e('0x3a')](handleError(_0x53e377,null));};exports['create']=function(_0x42519e,_0x427d42){return db[_0x006e('0x21')][_0x006e('0x40')](_0x42519e[_0x006e('0x41')],{})[_0x006e('0x1b')](respondWithResult(_0x427d42,0xc9))['catch'](handleError(_0x427d42,null));};exports[_0x006e('0x42')]=function(_0x5cc51a,_0x1bf323){return db[_0x006e('0x21')][_0x006e('0x42')](_0x5cc51a[_0x006e('0x41')],{'raw':![],'individualHooks':!![]})[_0x006e('0x1b')](respondWithResult(_0x1bf323,0xc9))[_0x006e('0x3a')](handleError(_0x1bf323,null));};exports[_0x006e('0x1a')]=function(_0xeb1c70,_0xb06d56){if(_0xeb1c70[_0x006e('0x41')]['id']){delete _0xeb1c70[_0x006e('0x41')]['id'];}return db[_0x006e('0x21')][_0x006e('0x3f')]({'where':{'id':_0xeb1c70[_0x006e('0x3c')]['id']}})[_0x006e('0x1b')](handleEntityNotFound(_0xb06d56,null))['then'](saveUpdates(_0xeb1c70[_0x006e('0x41')],null))[_0x006e('0x1b')](respondWithResult(_0xb06d56,null))[_0x006e('0x3a')](handleError(_0xb06d56,null));};exports['destroy']=function(_0x160c29,_0x400471){return db['AnalyticFieldReport'][_0x006e('0x3f')]({'where':{'id':_0x160c29[_0x006e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x400471,null))[_0x006e('0x1b')](removeEntity(_0x400471,null))['catch'](handleError(_0x400471,null));};exports[_0x006e('0x43')]=function(_0xb0f8de,_0x56e658){return db[_0x006e('0x21')][_0x006e('0x44')]({'where':{'id':_0xb0f8de[_0x006e('0x27')][_0x006e('0x45')]||[]},'raw':![],'individualHooks':!![]})[_0x006e('0x1b')](respondWithResult(_0x56e658,0xcc))[_0x006e('0x3a')](handleError(_0x56e658,null));};exports[_0x006e('0x46')]=function(_0x511167,_0x32ec07,_0x4555ef){return db[_0x006e('0x47')][_0x006e('0x48')]({'where':{'id':_0x511167[_0x006e('0x3c')]['id']}})[_0x006e('0x1b')](handleEntityNotFound(_0x32ec07,null))['then'](function(_0x29cc33){if(_0x29cc33){return db[_0x006e('0x49')]['transaction'](function(_0x4edf0e){return db[_0x006e('0x21')]['destroy']({'where':{'CustomReportId':_0x511167['params']['id']},'transaction':_0x4edf0e})[_0x006e('0x1b')](function(_0x3eaa67){var _0x5761b8=_[_0x006e('0x26')](_0x511167['body'],function(_0x317c0d){delete _0x317c0d['id'];_0x317c0d[_0x006e('0x4a')]=_0x511167[_0x006e('0x3c')]['id'];return _0x317c0d;});return db['AnalyticFieldReport']['bulkCreate'](_0x5761b8,{'transaction':_0x4edf0e});});})[_0x006e('0x1b')](function(){return db[_0x006e('0x21')][_0x006e('0x38')]({'where':{'CustomReportId':_0x511167[_0x006e('0x3c')]['id']}});});}})[_0x006e('0x1b')](respondWithResult(_0x32ec07,null))[_0x006e('0x3a')](handleError(_0x32ec07,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9a70115..3786651 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 _0x2c60=['exports','util','../../config/logger','api','bluebird','path','../../config/environment','./analyticFieldReport.attributes'];(function(_0x3764dc,_0x49f7d1){var _0x3a909b=function(_0x21fbde){while(--_0x21fbde){_0x3764dc['push'](_0x3764dc['shift']());}};_0x3a909b(++_0x49f7d1);}(_0x2c60,0xa9));var _0x02c6=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x2c60[_0x53cf8e];return _0x459197;};'use strict';var _=require('lodash');var util=require(_0x02c6('0x0'));var logger=require(_0x02c6('0x1'))(_0x02c6('0x2'));var moment=require('moment');var BPromise=require(_0x02c6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02c6('0x4'));var rimraf=require('rimraf');var config=require(_0x02c6('0x5'));var attributes=require(_0x02c6('0x6'));module[_0x02c6('0x7')]=function(_0x420a1e,_0x203dcb){return _0x420a1e['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c60=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash'];(function(_0x5d972b,_0x5c5530){var _0x2b449d=function(_0x174422){while(--_0x174422){_0x5d972b['push'](_0x5d972b['shift']());}};_0x2b449d(++_0x5c5530);}(_0x9c60,0xfb));var _0x09c6=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x9c60[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x09c6('0x0'));var util=require(_0x09c6('0x1'));var logger=require(_0x09c6('0x2'))(_0x09c6('0x3'));var moment=require('moment');var BPromise=require(_0x09c6('0x4'));var rp=require(_0x09c6('0x5'));var fs=require('fs');var path=require(_0x09c6('0x6'));var rimraf=require('rimraf');var config=require(_0x09c6('0x7'));var attributes=require(_0x09c6('0x8'));module[_0x09c6('0x9')]=function(_0x276e81,_0x3fb145){return _0x276e81[_0x09c6('0xa')](_0x09c6('0xb'),attributes,{'tableName':'analytics_report_fields','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 98b1a52..dbd6175 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 _0x849e=['jayson/promise','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xbd4ecd,_0x2f83ee){var _0x2571b4=function(_0x31c936){while(--_0x31c936){_0xbd4ecd['push'](_0xbd4ecd['shift']());}};_0x2571b4(++_0x2f83ee);}(_0x849e,0x80));var _0xe849=function(_0x20dd9b,_0x3c0fb8){_0x20dd9b=_0x20dd9b-0x0;var _0x2de3b0=_0x849e[_0x20dd9b];return _0x2de3b0;};'use strict';var _=require(_0xe849('0x0'));var util=require(_0xe849('0x1'));var moment=require('moment');var BPromise=require(_0xe849('0x2'));var rs=require(_0xe849('0x3'));var fs=require('fs');var Redis=require(_0xe849('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe849('0x5'))(_0xe849('0x6'));var config=require(_0xe849('0x7'));var jayson=require(_0xe849('0x8'));var client=jayson['client'][_0xe849('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x993f74,_0x59ed85,_0x4f78fb){return new BPromise(function(_0x451b39,_0x3e1753){return client[_0xe849('0xa')](_0x993f74,_0x4f78fb)['then'](function(_0x4bdc74){logger['info'](_0xe849('0xb'),_0x59ed85,_0xe849('0xc'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x59ed85,_0xe849('0xc'),JSON[_0xe849('0xd')](_0x4bdc74));if(_0x4bdc74[_0xe849('0xe')]){if(_0x4bdc74[_0xe849('0xe')]['code']===0x1f4){logger['error'](_0xe849('0xb'),_0x59ed85,_0x4bdc74[_0xe849('0xe')][_0xe849('0xf')]);return _0x3e1753(_0x4bdc74[_0xe849('0xe')][_0xe849('0xf')]);}logger[_0xe849('0xe')](_0xe849('0xb'),_0x59ed85,_0x4bdc74['error'][_0xe849('0xf')]);return _0x451b39(_0x4bdc74[_0xe849('0xe')][_0xe849('0xf')]);}else{logger['info'](_0xe849('0xb'),_0x59ed85,'request\x20sent');_0x451b39(_0x4bdc74[_0xe849('0x10')][_0xe849('0xf')]);}})['catch'](function(_0x39e8d3){logger[_0xe849('0xe')](_0xe849('0xb'),_0x59ed85,_0x39e8d3);_0x3e1753(_0x39e8d3);});});} \ No newline at end of file +var _0x30a5=['util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x30a5,0xa8));var _0x530a=function(_0x190148,_0xda6bdd){_0x190148=_0x190148-0x0;var _0x5009de=_0x30a5[_0x190148];return _0x5009de;};'use strict';var _=require('lodash');var util=require(_0x530a('0x0'));var moment=require(_0x530a('0x1'));var BPromise=require(_0x530a('0x2'));var rs=require(_0x530a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x530a('0x4'))(_0x530a('0x5'));var config=require(_0x530a('0x6'));var jayson=require(_0x530a('0x7'));var client=jayson[_0x530a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x547a48,_0x34c50d,_0x26b19f){return new BPromise(function(_0x3387d8,_0x1f5445){return client[_0x530a('0x9')](_0x547a48,_0x26b19f)[_0x530a('0xa')](function(_0x5bdf6f){logger[_0x530a('0xb')](_0x530a('0xc'),_0x34c50d,_0x530a('0xd'));logger[_0x530a('0xe')](_0x530a('0xf'),_0x34c50d,_0x530a('0xd'),JSON[_0x530a('0x10')](_0x5bdf6f));if(_0x5bdf6f[_0x530a('0x11')]){if(_0x5bdf6f['error']['code']===0x1f4){logger[_0x530a('0x11')](_0x530a('0xc'),_0x34c50d,_0x5bdf6f[_0x530a('0x11')]['message']);return _0x1f5445(_0x5bdf6f[_0x530a('0x11')][_0x530a('0x12')]);}logger[_0x530a('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x34c50d,_0x5bdf6f[_0x530a('0x11')][_0x530a('0x12')]);return _0x3387d8(_0x5bdf6f[_0x530a('0x11')][_0x530a('0x12')]);}else{logger[_0x530a('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x34c50d,'request\x20sent');_0x3387d8(_0x5bdf6f[_0x530a('0x13')][_0x530a('0x12')]);}})[_0x530a('0x14')](function(_0x33e888){logger['error'](_0x530a('0xc'),_0x34c50d,_0x33e888);_0x1f5445(_0x33e888);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ad75134..6c4f9bf 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(_0x129f47,_0x2d4e0c){var _0xcaf42a=function(_0x46a26d){while(--_0x46a26d){_0x129f47['push'](_0x129f47['shift']());}};_0xcaf42a(++_0x2d4e0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x22add5,_0x346816){var _0x39c293=function(_0x496ebf){while(--_0x496ebf){_0x22add5['push'](_0x22add5['shift']());}};_0x39c293(++_0x346816);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 370b560..8c03142 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 _0x90db=['name','exports','STRING'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x90db,0x1c0));var _0xb90d=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x90db[_0x521929];return _0x632436;};'use strict';var Sequelize=require('sequelize');module[_0xb90d('0x0')]={'name':{'type':Sequelize[_0xb90d('0x1')],'allowNull':![],'unique':_0xb90d('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x544a=['sequelize','exports','STRING','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x544a,0x118));var _0xa544=function(_0x44a4a9,_0x40ff99){_0x44a4a9=_0x44a4a9-0x0;var _0x5c4547=_0x544a[_0x44a4a9];return _0x5c4547;};'use strict';var Sequelize=require(_0xa544('0x0'));module[_0xa544('0x1')]={'name':{'type':Sequelize[_0xa544('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xa544('0x3')]},'description':{'type':Sequelize[_0xa544('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3ac24bb..cc2d0ba 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','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','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0xff1914,_0x15fd31){var _0x1e4fb5=function(_0x341cd3){while(--_0x341cd3){_0xff1914['push'](_0xff1914['shift']());}};_0x1e4fb5(++_0x15fd31);}(_0x9a19,0x114));var _0x99a1=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0x9a19[_0x503564];return _0x4be9fd;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x5d8b28,_0x93ca8e){var _0x460737=function(_0x55303b){while(--_0x55303b){_0x5d8b28['push'](_0x5d8b28['shift']());}};_0x460737(++_0x93ca8e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x591a97,_0x3f0693){_0x591a97=_0x591a97-0x0;var _0x36e8ed=_0xe5b3[_0x591a97];return _0x36e8ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f5c65ca..ff36530 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 _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger'];(function(_0x2fa536,_0x776a1c){var _0x316ea0=function(_0x285fac){while(--_0x285fac){_0x2fa536['push'](_0x2fa536['shift']());}};_0x316ea0(++_0x776a1c);}(_0x4745,0x1e7));var _0x5474=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x4745[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('AnalyticMetric',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb242=['./analyticMetric.attributes','exports','define','AnalyticMetric','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x25be49,_0x543a40){var _0xdb79d8=function(_0x26b724){while(--_0x26b724){_0x25be49['push'](_0x25be49['shift']());}};_0xdb79d8(++_0x543a40);}(_0xb242,0x1f3));var _0x2b24=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0xb242[_0x3b3210];return _0x5b5484;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var logger=require(_0x2b24('0x1'))(_0x2b24('0x2'));var moment=require(_0x2b24('0x3'));var BPromise=require(_0x2b24('0x4'));var rp=require(_0x2b24('0x5'));var fs=require('fs');var path=require(_0x2b24('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b24('0x7'));module[_0x2b24('0x8')]=function(_0x5c1f57,_0x341c66){return _0x5c1f57[_0x2b24('0x9')](_0x2b24('0xa'),attributes,{'tableName':'analytics_metrics','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 595787e..c846738 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 _0x06c9=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14e8d3,_0x67e3a){var _0x1f565b=function(_0x2be885){while(--_0x2be885){_0x14e8d3['push'](_0x14e8d3['shift']());}};_0x1f565b(++_0x67e3a);}(_0x06c9,0x8a));var _0x906c=function(_0x8a5a7b,_0xc5e515){_0x8a5a7b=_0x8a5a7b-0x0;var _0x54c476=_0x06c9[_0x8a5a7b];return _0x54c476;};'use strict';var _=require(_0x906c('0x0'));var util=require(_0x906c('0x1'));var moment=require(_0x906c('0x2'));var BPromise=require(_0x906c('0x3'));var rs=require(_0x906c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x906c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x906c('0x6'))(_0x906c('0x7'));var config=require('../../config/environment');var jayson=require(_0x906c('0x8'));var client=jayson['client'][_0x906c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178bc9,_0x5f28af,_0x47b0d1){return new BPromise(function(_0x48c655,_0x2647eb){return client['request'](_0x178bc9,_0x47b0d1)['then'](function(_0x4dfbba){logger[_0x906c('0xa')](_0x906c('0xb'),_0x5f28af,_0x906c('0xc'));logger[_0x906c('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5f28af,_0x906c('0xc'),JSON[_0x906c('0xe')](_0x4dfbba));if(_0x4dfbba[_0x906c('0xf')]){if(_0x4dfbba[_0x906c('0xf')][_0x906c('0x10')]===0x1f4){logger[_0x906c('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x5f28af,_0x4dfbba['error'][_0x906c('0x11')]);return _0x2647eb(_0x4dfbba[_0x906c('0xf')][_0x906c('0x11')]);}logger['error'](_0x906c('0xb'),_0x5f28af,_0x4dfbba[_0x906c('0xf')]['message']);return _0x48c655(_0x4dfbba[_0x906c('0xf')]['message']);}else{logger[_0x906c('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x5f28af,_0x906c('0xc'));_0x48c655(_0x4dfbba[_0x906c('0x12')][_0x906c('0x11')]);}})['catch'](function(_0x1681c8){logger[_0x906c('0xf')](_0x906c('0xb'),_0x5f28af,_0x1681c8);_0x2647eb(_0x1681c8);});});} \ No newline at end of file +var _0xa401=['jayson/promise','client','then','info','debug','error','code','AnalyticMetric,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x5251db,_0x4090f6){var _0x5671e5=function(_0x2b8b4f){while(--_0x2b8b4f){_0x5251db['push'](_0x5251db['shift']());}};_0x5671e5(++_0x4090f6);}(_0xa401,0x1ec));var _0x1a40=function(_0x31beb3,_0x34e44f){_0x31beb3=_0x31beb3-0x0;var _0x5457a8=_0xa401[_0x31beb3];return _0x5457a8;};'use strict';var _=require(_0x1a40('0x0'));var util=require(_0x1a40('0x1'));var moment=require(_0x1a40('0x2'));var BPromise=require(_0x1a40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a40('0x4'));var db=require(_0x1a40('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a40('0x6'))(_0x1a40('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a40('0x8'));var client=jayson[_0x1a40('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a57f,_0x584be8,_0x289ca9){return new BPromise(function(_0x9ba190,_0x536dae){return client['request'](_0x31a57f,_0x289ca9)[_0x1a40('0xa')](function(_0x4c2c62){logger[_0x1a40('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x584be8,'request\x20sent');logger[_0x1a40('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x584be8,'request\x20sent',JSON['stringify'](_0x4c2c62));if(_0x4c2c62[_0x1a40('0xd')]){if(_0x4c2c62[_0x1a40('0xd')][_0x1a40('0xe')]===0x1f4){logger[_0x1a40('0xd')](_0x1a40('0xf'),_0x584be8,_0x4c2c62[_0x1a40('0xd')][_0x1a40('0x10')]);return _0x536dae(_0x4c2c62[_0x1a40('0xd')]['message']);}logger[_0x1a40('0xd')](_0x1a40('0xf'),_0x584be8,_0x4c2c62[_0x1a40('0xd')][_0x1a40('0x10')]);return _0x9ba190(_0x4c2c62[_0x1a40('0xd')]['message']);}else{logger[_0x1a40('0xb')](_0x1a40('0xf'),_0x584be8,_0x1a40('0x11'));_0x9ba190(_0x4c2c62[_0x1a40('0x12')][_0x1a40('0x10')]);}})[_0x1a40('0x13')](function(_0x5ca131){logger[_0x1a40('0xd')](_0x1a40('0xf'),_0x584be8,_0x5ca131);_0x536dae(_0x5ca131);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3438566..a471147 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 _0xc949=['create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4cc78f,_0x549c18){var _0x35f93c=function(_0x5820f5){while(--_0x5820f5){_0x4cc78f['push'](_0x4cc78f['shift']());}};_0x35f93c(++_0x549c18);}(_0xc949,0x181));var _0x9c94=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xc949[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require(_0x9c94('0x0'));var util=require('util');var path=require(_0x9c94('0x1'));var timeout=require(_0x9c94('0x2'));var express=require(_0x9c94('0x3'));var router=express[_0x9c94('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c94('0x5'));var interaction=require(_0x9c94('0x6'));var config=require('../../config/environment');var controller=require(_0x9c94('0x7'));router[_0x9c94('0x8')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xa')]);router['get'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xc')]);router[_0x9c94('0xd')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xe')]);router[_0x9c94('0xf')](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x10')]);router['delete'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x11')]);module[_0x9c94('0x12')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x2eae1f,_0x4884bc){var _0x1110dc=function(_0x338ded){while(--_0x338ded){_0x2eae1f['push'](_0x2eae1f['shift']());}};_0x1110dc(++_0x4884bc);}(_0x814b,0x1a2));var _0xb814=function(_0xb096ef,_0x20ebdf){_0xb096ef=_0xb096ef-0x0;var _0x5ac5b=_0x814b[_0xb096ef];return _0x5ac5b;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xe')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['destroy']);module[_0xb814('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cb320e0..16ff3d1 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 _0x724d=['TEXT','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x724d,0x129));var _0xd724=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x724d[_0x5b64a1];return _0x4b6f55;};'use strict';var Sequelize=require(_0xd724('0x0'));module['exports']={'tree':{'type':Sequelize[_0xd724('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4992=['TEXT'];(function(_0x3c6cf7,_0x3bd3e2){var _0x22c6ac=function(_0x57beb0){while(--_0x57beb0){_0x3c6cf7['push'](_0x3c6cf7['shift']());}};_0x22c6ac(++_0x3bd3e2);}(_0x4992,0xf1));var _0x2499=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4992[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x2499('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index f78d735..242138f 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 _0xcfb9=['model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','findAll','catch','show','options','find','create','body','params','rimraf','zip-dir','request-promise','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type'];(function(_0x4ca7c7,_0x5d16ee){var _0x456a87=function(_0x11c8fc){while(--_0x11c8fc){_0x4ca7c7['push'](_0x4ca7c7['shift']());}};_0x456a87(++_0x5d16ee);}(_0xcfb9,0x1c3));var _0x9cfb=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xcfb9[_0x5c9307];return _0x373e29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9cfb('0x0'));var zipdir=require(_0x9cfb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cfb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9cfb('0x3'));var sox=require(_0x9cfb('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cfb('0x5'));var _=require(_0x9cfb('0x6'));var squel=require(_0x9cfb('0x7'));var crypto=require(_0x9cfb('0x8'));var jsforce=require(_0x9cfb('0x9'));var deskjs=require(_0x9cfb('0xa'));var toCsv=require(_0x9cfb('0xb'));var querystring=require(_0x9cfb('0xc'));var Papa=require('papaparse');var Redis=require(_0x9cfb('0xd'));var authService=require(_0x9cfb('0xe'));var qs=require(_0x9cfb('0xf'));var as=require(_0x9cfb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cfb('0x11'))(_0x9cfb('0x12'));var utils=require(_0x9cfb('0x13'));var config=require(_0x9cfb('0x14'));var licenseUtil=require(_0x9cfb('0x15'));var db=require(_0x9cfb('0x16'))['db'];function respondWithStatusCode(_0x5d6e0d,_0x27760a){_0x27760a=_0x27760a||0xcc;return function(_0x443d90){if(_0x443d90){return _0x5d6e0d[_0x9cfb('0x17')](_0x27760a);}return _0x5d6e0d[_0x9cfb('0x18')](_0x27760a)[_0x9cfb('0x19')]();};}function respondWithResult(_0x249d86,_0xb3c395){_0xb3c395=_0xb3c395||0xc8;return function(_0x4a8136){if(_0x4a8136){return _0x249d86['status'](_0xb3c395)[_0x9cfb('0x1a')](_0x4a8136);}};}function respondWithFilteredResult(_0x59ed81,_0x33230e){return function(_0x41d582){if(_0x41d582){var _0x3d0692=typeof _0x33230e[_0x9cfb('0x1b')]===_0x9cfb('0x1c')&&typeof _0x33230e[_0x9cfb('0x1d')]===_0x9cfb('0x1c');var _0x2411e1=_0x41d582['count'];var _0x42eae4=_0x3d0692?0x0:_0x33230e[_0x9cfb('0x1b')];var _0x17e707=_0x3d0692?_0x41d582['count']:_0x33230e['offset']+_0x33230e[_0x9cfb('0x1d')];var _0x5c7fb0;if(_0x17e707>=_0x2411e1){_0x17e707=_0x2411e1;_0x5c7fb0=0xc8;}else{_0x5c7fb0=0xce;}_0x59ed81['status'](_0x5c7fb0);return _0x59ed81['set']('Content-Range',_0x42eae4+'-'+_0x17e707+'/'+_0x2411e1)[_0x9cfb('0x1a')](_0x41d582);}return null;};}function patchUpdates(_0x16c72c){return function(_0x435ee3){try{jsonpatch[_0x9cfb('0x1e')](_0x435ee3,_0x16c72c,!![]);}catch(_0x15892e){return BPromise[_0x9cfb('0x1f')](_0x15892e);}return _0x435ee3[_0x9cfb('0x20')]();};}function saveUpdates(_0xe42f4e,_0x18d257){return function(_0x386c86){if(_0x386c86){return _0x386c86[_0x9cfb('0x21')](_0xe42f4e)[_0x9cfb('0x22')](function(_0x53586b){return _0x53586b;});}return null;};}function removeEntity(_0x44c579,_0x46cb9e){return function(_0x25fe95){if(_0x25fe95){return _0x25fe95[_0x9cfb('0x23')]()['then'](function(){_0x44c579['status'](0xcc)[_0x9cfb('0x19')]();});}};}function handleEntityNotFound(_0x55fe00,_0x20c391){return function(_0x53ad27){if(!_0x53ad27){_0x55fe00[_0x9cfb('0x17')](0x194);}return _0x53ad27;};}function handleError(_0xf42e19,_0x52b1b6){_0x52b1b6=_0x52b1b6||0x1f4;return function(_0x5d26cc){logger[_0x9cfb('0x24')](_0x5d26cc[_0x9cfb('0x25')]);if(_0x5d26cc['name']){delete _0x5d26cc[_0x9cfb('0x26')];}_0xf42e19['status'](_0x52b1b6)[_0x9cfb('0x27')](_0x5d26cc);};}exports[_0x9cfb('0x28')]=function(_0x5c8e0,_0x1d008c){var _0x1bc6f1={},_0x286dbb={},_0x402e75={'count':0x0,'rows':[]};var _0x7462af=_[_0x9cfb('0x29')](db[_0x9cfb('0x2a')][_0x9cfb('0x2b')],function(_0x132164){return{'name':_0x132164[_0x9cfb('0x2c')],'type':_0x132164[_0x9cfb('0x2d')]['key']};});_0x286dbb[_0x9cfb('0x2e')]=_[_0x9cfb('0x29')](_0x7462af,_0x9cfb('0x26'));_0x286dbb[_0x9cfb('0x2f')]=_[_0x9cfb('0x30')](_0x5c8e0[_0x9cfb('0x2f')]);_0x286dbb['filters']=_[_0x9cfb('0x31')](_0x286dbb[_0x9cfb('0x2e')],_0x286dbb['query']);_0x1bc6f1[_0x9cfb('0x32')]=_[_0x9cfb('0x31')](_0x286dbb[_0x9cfb('0x2e')],qs[_0x9cfb('0x33')](_0x5c8e0[_0x9cfb('0x2f')][_0x9cfb('0x33')]));_0x1bc6f1['attributes']=_0x1bc6f1[_0x9cfb('0x32')][_0x9cfb('0x34')]?_0x1bc6f1[_0x9cfb('0x32')]:_0x286dbb['model'];if(!_0x5c8e0[_0x9cfb('0x2f')]['hasOwnProperty'](_0x9cfb('0x35'))){_0x1bc6f1[_0x9cfb('0x1d')]=qs[_0x9cfb('0x1d')](_0x5c8e0[_0x9cfb('0x2f')][_0x9cfb('0x1d')]);_0x1bc6f1[_0x9cfb('0x1b')]=qs[_0x9cfb('0x1b')](_0x5c8e0[_0x9cfb('0x2f')][_0x9cfb('0x1b')]);}_0x1bc6f1[_0x9cfb('0x36')]=qs[_0x9cfb('0x37')](_0x5c8e0['query'][_0x9cfb('0x37')]);_0x1bc6f1[_0x9cfb('0x38')]=qs[_0x9cfb('0x39')](_[_0x9cfb('0x3a')](_0x5c8e0[_0x9cfb('0x2f')],_0x286dbb[_0x9cfb('0x39')]),_0x7462af);if(_0x5c8e0[_0x9cfb('0x2f')][_0x9cfb('0x3b')]){_0x1bc6f1['where']=_[_0x9cfb('0x3c')](_0x1bc6f1['where'],{'$or':_[_0x9cfb('0x29')](_0x7462af,function(_0x331d0a){if(_0x331d0a[_0x9cfb('0x2d')]!==_0x9cfb('0x3d')){var _0x1be561={};_0x1be561[_0x331d0a[_0x9cfb('0x26')]]={'$like':'%'+_0x5c8e0['query'][_0x9cfb('0x3b')]+'%'};return _0x1be561;}})});}_0x1bc6f1=_[_0x9cfb('0x3c')]({},_0x1bc6f1,_0x5c8e0['options']);var _0x6c5bcb={'where':_0x1bc6f1['where']};return db['AnalyticTreeReport'][_0x9cfb('0x3e')](_0x6c5bcb)[_0x9cfb('0x22')](function(_0x448dce){_0x402e75[_0x9cfb('0x3e')]=_0x448dce;if(_0x5c8e0[_0x9cfb('0x2f')]['includeAll']){_0x1bc6f1['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x9cfb('0x3f')](_0x1bc6f1);})[_0x9cfb('0x22')](function(_0x195197){_0x402e75['rows']=_0x195197;return _0x402e75;})[_0x9cfb('0x22')](respondWithFilteredResult(_0x1d008c,_0x1bc6f1))[_0x9cfb('0x40')](handleError(_0x1d008c,null));};exports[_0x9cfb('0x41')]=function(_0x74de41,_0x593ea7){var _0x424e20={'raw':!![],'where':{'id':_0x74de41['params']['id']}},_0x116d72={};_0x116d72[_0x9cfb('0x2e')]=_[_0x9cfb('0x30')](db[_0x9cfb('0x2a')][_0x9cfb('0x2b')]);_0x116d72[_0x9cfb('0x2f')]=_[_0x9cfb('0x30')](_0x74de41['query']);_0x116d72[_0x9cfb('0x39')]=_[_0x9cfb('0x31')](_0x116d72[_0x9cfb('0x2e')],_0x116d72[_0x9cfb('0x2f')]);_0x424e20[_0x9cfb('0x32')]=_[_0x9cfb('0x31')](_0x116d72[_0x9cfb('0x2e')],qs[_0x9cfb('0x33')](_0x74de41[_0x9cfb('0x2f')][_0x9cfb('0x33')]));_0x424e20[_0x9cfb('0x32')]=_0x424e20['attributes']['length']?_0x424e20['attributes']:_0x116d72[_0x9cfb('0x2e')];if(_0x74de41['query']['includeAll']){_0x424e20['include']=[{'all':!![]}];}_0x424e20=_[_0x9cfb('0x3c')]({},_0x424e20,_0x74de41[_0x9cfb('0x42')]);return db['AnalyticTreeReport'][_0x9cfb('0x43')](_0x424e20)['then'](handleEntityNotFound(_0x593ea7,null))[_0x9cfb('0x22')](respondWithResult(_0x593ea7,null))[_0x9cfb('0x40')](handleError(_0x593ea7,null));};exports[_0x9cfb('0x44')]=function(_0x4a039a,_0x5291a6){return db[_0x9cfb('0x2a')]['create'](_0x4a039a[_0x9cfb('0x45')],{})[_0x9cfb('0x22')](respondWithResult(_0x5291a6,0xc9))[_0x9cfb('0x40')](handleError(_0x5291a6,null));};exports[_0x9cfb('0x21')]=function(_0x3c58bc,_0x5f0e43){if(_0x3c58bc['body']['id']){delete _0x3c58bc[_0x9cfb('0x45')]['id'];}return db['AnalyticTreeReport'][_0x9cfb('0x43')]({'where':{'id':_0x3c58bc[_0x9cfb('0x46')]['id']}})[_0x9cfb('0x22')](handleEntityNotFound(_0x5f0e43,null))[_0x9cfb('0x22')](saveUpdates(_0x3c58bc['body'],null))[_0x9cfb('0x22')](respondWithResult(_0x5f0e43,null))['catch'](handleError(_0x5f0e43,null));};exports[_0x9cfb('0x23')]=function(_0x3367ce,_0x4fbd67){return db[_0x9cfb('0x2a')][_0x9cfb('0x43')]({'where':{'id':_0x3367ce[_0x9cfb('0x46')]['id']}})[_0x9cfb('0x22')](handleEntityNotFound(_0x4fbd67,null))[_0x9cfb('0x22')](removeEntity(_0x4fbd67,null))[_0x9cfb('0x40')](handleError(_0x4fbd67,null));}; \ No newline at end of file +var _0xd888=['where','options','include','rows','show','params','includeAll','create','body','find','catch','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge'];(function(_0x4052f5,_0x3c3b52){var _0x13451e=function(_0x581b91){while(--_0x581b91){_0x4052f5['push'](_0x4052f5['shift']());}};_0x13451e(++_0x3c3b52);}(_0xd888,0x1cd));var _0x8d88=function(_0x16995f,_0x326c0f){_0x16995f=_0x16995f-0x0;var _0x37931a=_0xd888[_0x16995f];return _0x37931a;};'use strict';var emlformat=require(_0x8d88('0x0'));var rimraf=require(_0x8d88('0x1'));var zipdir=require(_0x8d88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d88('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8d88('0x4'));var util=require(_0x8d88('0x5'));var path=require(_0x8d88('0x6'));var sox=require(_0x8d88('0x7'));var csv=require(_0x8d88('0x8'));var ejs=require(_0x8d88('0x9'));var fs=require('fs');var fs_extra=require(_0x8d88('0xa'));var _=require(_0x8d88('0xb'));var squel=require(_0x8d88('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8d88('0xd'));var toCsv=require(_0x8d88('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8d88('0xe'));var authService=require(_0x8d88('0xf'));var qs=require(_0x8d88('0x10'));var as=require(_0x8d88('0x11'));var hardwareService=require(_0x8d88('0x12'));var logger=require(_0x8d88('0x13'))(_0x8d88('0x14'));var utils=require('../../config/utils');var config=require(_0x8d88('0x15'));var licenseUtil=require(_0x8d88('0x16'));var db=require(_0x8d88('0x17'))['db'];function respondWithStatusCode(_0x5a5b1f,_0x534e9c){_0x534e9c=_0x534e9c||0xcc;return function(_0x19f06){if(_0x19f06){return _0x5a5b1f[_0x8d88('0x18')](_0x534e9c);}return _0x5a5b1f[_0x8d88('0x19')](_0x534e9c)[_0x8d88('0x1a')]();};}function respondWithResult(_0x525145,_0x2877d6){_0x2877d6=_0x2877d6||0xc8;return function(_0x3566cc){if(_0x3566cc){return _0x525145['status'](_0x2877d6)[_0x8d88('0x1b')](_0x3566cc);}};}function respondWithFilteredResult(_0x301b02,_0x4b6c9c){return function(_0x24a57a){if(_0x24a57a){var _0x173f56=typeof _0x4b6c9c[_0x8d88('0x1c')]===_0x8d88('0x1d')&&typeof _0x4b6c9c[_0x8d88('0x1e')]===_0x8d88('0x1d');var _0x52b903=_0x24a57a[_0x8d88('0x1f')];var _0x4e7d64=_0x173f56?0x0:_0x4b6c9c[_0x8d88('0x1c')];var _0x55a51a=_0x173f56?_0x24a57a[_0x8d88('0x1f')]:_0x4b6c9c[_0x8d88('0x1c')]+_0x4b6c9c['limit'];var _0x241b3c;if(_0x55a51a>=_0x52b903){_0x55a51a=_0x52b903;_0x241b3c=0xc8;}else{_0x241b3c=0xce;}_0x301b02[_0x8d88('0x19')](_0x241b3c);return _0x301b02[_0x8d88('0x20')](_0x8d88('0x21'),_0x4e7d64+'-'+_0x55a51a+'/'+_0x52b903)['json'](_0x24a57a);}return null;};}function patchUpdates(_0x3be7cf){return function(_0x5d049a){try{jsonpatch[_0x8d88('0x22')](_0x5d049a,_0x3be7cf,!![]);}catch(_0xa8169d){return BPromise[_0x8d88('0x23')](_0xa8169d);}return _0x5d049a[_0x8d88('0x24')]();};}function saveUpdates(_0x57857c,_0x21d763){return function(_0x2f7c56){if(_0x2f7c56){return _0x2f7c56[_0x8d88('0x25')](_0x57857c)[_0x8d88('0x26')](function(_0x3e33ee){return _0x3e33ee;});}return null;};}function removeEntity(_0x45a50a,_0x20101b){return function(_0x4c9367){if(_0x4c9367){return _0x4c9367[_0x8d88('0x27')]()['then'](function(){_0x45a50a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42309b,_0x447283){return function(_0x4f4a3d){if(!_0x4f4a3d){_0x42309b[_0x8d88('0x18')](0x194);}return _0x4f4a3d;};}function handleError(_0x2e5f76,_0x2efe68){_0x2efe68=_0x2efe68||0x1f4;return function(_0x28acfb){logger['error'](_0x28acfb[_0x8d88('0x28')]);if(_0x28acfb[_0x8d88('0x29')]){delete _0x28acfb[_0x8d88('0x29')];}_0x2e5f76[_0x8d88('0x19')](_0x2efe68)[_0x8d88('0x2a')](_0x28acfb);};}exports[_0x8d88('0x2b')]=function(_0x2cc2ae,_0x281aee){var _0x4d4e48={},_0x34c4c2={},_0x4a65a9={'count':0x0,'rows':[]};var _0x4d8d8b=_[_0x8d88('0x2c')](db[_0x8d88('0x2d')][_0x8d88('0x2e')],function(_0x3fd583){return{'name':_0x3fd583[_0x8d88('0x2f')],'type':_0x3fd583[_0x8d88('0x30')][_0x8d88('0x31')]};});_0x34c4c2[_0x8d88('0x32')]=_[_0x8d88('0x2c')](_0x4d8d8b,_0x8d88('0x29'));_0x34c4c2[_0x8d88('0x33')]=_[_0x8d88('0x34')](_0x2cc2ae[_0x8d88('0x33')]);_0x34c4c2[_0x8d88('0x35')]=_[_0x8d88('0x36')](_0x34c4c2[_0x8d88('0x32')],_0x34c4c2[_0x8d88('0x33')]);_0x4d4e48['attributes']=_[_0x8d88('0x36')](_0x34c4c2[_0x8d88('0x32')],qs[_0x8d88('0x37')](_0x2cc2ae[_0x8d88('0x33')][_0x8d88('0x37')]));_0x4d4e48['attributes']=_0x4d4e48[_0x8d88('0x38')][_0x8d88('0x39')]?_0x4d4e48[_0x8d88('0x38')]:_0x34c4c2[_0x8d88('0x32')];if(!_0x2cc2ae[_0x8d88('0x33')][_0x8d88('0x3a')](_0x8d88('0x3b'))){_0x4d4e48[_0x8d88('0x1e')]=qs[_0x8d88('0x1e')](_0x2cc2ae[_0x8d88('0x33')][_0x8d88('0x1e')]);_0x4d4e48[_0x8d88('0x1c')]=qs[_0x8d88('0x1c')](_0x2cc2ae[_0x8d88('0x33')][_0x8d88('0x1c')]);}_0x4d4e48[_0x8d88('0x3c')]=qs[_0x8d88('0x3d')](_0x2cc2ae[_0x8d88('0x33')][_0x8d88('0x3d')]);_0x4d4e48['where']=qs[_0x8d88('0x35')](_['pick'](_0x2cc2ae[_0x8d88('0x33')],_0x34c4c2[_0x8d88('0x35')]),_0x4d8d8b);if(_0x2cc2ae[_0x8d88('0x33')][_0x8d88('0x3e')]){_0x4d4e48['where']=_[_0x8d88('0x3f')](_0x4d4e48[_0x8d88('0x40')],{'$or':_['map'](_0x4d8d8b,function(_0x3a300c){if(_0x3a300c['type']!=='VIRTUAL'){var _0x9720b4={};_0x9720b4[_0x3a300c['name']]={'$like':'%'+_0x2cc2ae[_0x8d88('0x33')][_0x8d88('0x3e')]+'%'};return _0x9720b4;}})});}_0x4d4e48=_[_0x8d88('0x3f')]({},_0x4d4e48,_0x2cc2ae[_0x8d88('0x41')]);var _0x3b2e64={'where':_0x4d4e48[_0x8d88('0x40')]};return db[_0x8d88('0x2d')]['count'](_0x3b2e64)[_0x8d88('0x26')](function(_0x1486e3){_0x4a65a9[_0x8d88('0x1f')]=_0x1486e3;if(_0x2cc2ae[_0x8d88('0x33')]['includeAll']){_0x4d4e48[_0x8d88('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x4d4e48);})[_0x8d88('0x26')](function(_0x130674){_0x4a65a9[_0x8d88('0x43')]=_0x130674;return _0x4a65a9;})[_0x8d88('0x26')](respondWithFilteredResult(_0x281aee,_0x4d4e48))['catch'](handleError(_0x281aee,null));};exports[_0x8d88('0x44')]=function(_0x492715,_0x299575){var _0x3031fb={'raw':!![],'where':{'id':_0x492715[_0x8d88('0x45')]['id']}},_0x2461f3={};_0x2461f3[_0x8d88('0x32')]=_['keys'](db[_0x8d88('0x2d')][_0x8d88('0x2e')]);_0x2461f3['query']=_[_0x8d88('0x34')](_0x492715[_0x8d88('0x33')]);_0x2461f3[_0x8d88('0x35')]=_[_0x8d88('0x36')](_0x2461f3[_0x8d88('0x32')],_0x2461f3[_0x8d88('0x33')]);_0x3031fb[_0x8d88('0x38')]=_[_0x8d88('0x36')](_0x2461f3[_0x8d88('0x32')],qs['fields'](_0x492715[_0x8d88('0x33')][_0x8d88('0x37')]));_0x3031fb[_0x8d88('0x38')]=_0x3031fb[_0x8d88('0x38')][_0x8d88('0x39')]?_0x3031fb[_0x8d88('0x38')]:_0x2461f3[_0x8d88('0x32')];if(_0x492715[_0x8d88('0x33')][_0x8d88('0x46')]){_0x3031fb[_0x8d88('0x42')]=[{'all':!![]}];}_0x3031fb=_['merge']({},_0x3031fb,_0x492715[_0x8d88('0x41')]);return db[_0x8d88('0x2d')]['find'](_0x3031fb)[_0x8d88('0x26')](handleEntityNotFound(_0x299575,null))['then'](respondWithResult(_0x299575,null))['catch'](handleError(_0x299575,null));};exports[_0x8d88('0x47')]=function(_0xd080ed,_0x285c45){return db[_0x8d88('0x2d')][_0x8d88('0x47')](_0xd080ed['body'],{})[_0x8d88('0x26')](respondWithResult(_0x285c45,0xc9))['catch'](handleError(_0x285c45,null));};exports[_0x8d88('0x25')]=function(_0x4c6a50,_0x378cc3){if(_0x4c6a50[_0x8d88('0x48')]['id']){delete _0x4c6a50[_0x8d88('0x48')]['id'];}return db['AnalyticTreeReport'][_0x8d88('0x49')]({'where':{'id':_0x4c6a50[_0x8d88('0x45')]['id']}})[_0x8d88('0x26')](handleEntityNotFound(_0x378cc3,null))[_0x8d88('0x26')](saveUpdates(_0x4c6a50[_0x8d88('0x48')],null))[_0x8d88('0x26')](respondWithResult(_0x378cc3,null))[_0x8d88('0x4a')](handleError(_0x378cc3,null));};exports[_0x8d88('0x27')]=function(_0x51170e,_0x1117fc){return db[_0x8d88('0x2d')][_0x8d88('0x49')]({'where':{'id':_0x51170e[_0x8d88('0x45')]['id']}})[_0x8d88('0x26')](handleEntityNotFound(_0x1117fc,null))[_0x8d88('0x26')](removeEntity(_0x1117fc,null))[_0x8d88('0x4a')](handleError(_0x1117fc,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e7a99f4..988196a 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 _0x77fb=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x42a178,_0x402f42){var _0x1ad3b8=function(_0x26eae2){while(--_0x26eae2){_0x42a178['push'](_0x42a178['shift']());}};_0x1ad3b8(++_0x402f42);}(_0x77fb,0x197));var _0xb77f=function(_0x1a9c9c,_0x35af92){_0x1a9c9c=_0x1a9c9c-0x0;var _0x3fee2e=_0x77fb[_0x1a9c9c];return _0x3fee2e;};'use strict';var _=require(_0xb77f('0x0'));var util=require(_0xb77f('0x1'));var logger=require(_0xb77f('0x2'))(_0xb77f('0x3'));var moment=require(_0xb77f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb77f('0x5'));var config=require(_0xb77f('0x6'));var attributes=require(_0xb77f('0x7'));module['exports']=function(_0x494111,_0x10534d){return _0x494111[_0xb77f('0x8')](_0xb77f('0x9'),attributes,{'tableName':_0xb77f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d85=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util'];(function(_0x5ee7b4,_0x7eb24f){var _0x5bbf00=function(_0x2a6957){while(--_0x2a6957){_0x5ee7b4['push'](_0x5ee7b4['shift']());}};_0x5bbf00(++_0x7eb24f);}(_0x4d85,0x1c6));var _0x54d8=function(_0x143698,_0x3b736f){_0x143698=_0x143698-0x0;var _0x319aa6=_0x4d85[_0x143698];return _0x319aa6;};'use strict';var _=require('lodash');var util=require(_0x54d8('0x0'));var logger=require(_0x54d8('0x1'))(_0x54d8('0x2'));var moment=require(_0x54d8('0x3'));var BPromise=require(_0x54d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54d8('0x5'));var rimraf=require(_0x54d8('0x6'));var config=require(_0x54d8('0x7'));var attributes=require(_0x54d8('0x8'));module[_0x54d8('0x9')]=function(_0x8f5843,_0x3e1698){return _0x8f5843[_0x54d8('0xa')](_0x54d8('0xb'),attributes,{'tableName':_0x54d8('0xc'),'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 1a5d866..5843d1b 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x449ca9,_0x6fe125){var _0x3f755d=function(_0x4e0c71){while(--_0x4e0c71){_0x449ca9['push'](_0x449ca9['shift']());}};_0x3f755d(++_0x6fe125);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x3530e1,_0x1c9d26){var _0x94c8=function(_0x53534b){while(--_0x53534b){_0x3530e1['push'](_0x3530e1['shift']());}};_0x94c8(++_0x1c9d26);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c397662..6cebfe9 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 _0x78bb=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','post','create','update'];(function(_0x7a2273,_0x2cd10c){var _0x320b19=function(_0x433656){while(--_0x433656){_0x7a2273['push'](_0x7a2273['shift']());}};_0x320b19(++_0x2cd10c);}(_0x78bb,0xab));var _0xb78b=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x78bb[_0x673722];return _0x21249c;};'use strict';var multer=require(_0xb78b('0x0'));var util=require(_0xb78b('0x1'));var path=require(_0xb78b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb78b('0x3'));var router=express[_0xb78b('0x4')]();var fs_extra=require(_0xb78b('0x5'));var auth=require(_0xb78b('0x6'));var interaction=require(_0xb78b('0x7'));var config=require(_0xb78b('0x8'));var controller=require(_0xb78b('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb78b('0xa')](_0xb78b('0xb'),auth[_0xb78b('0xc')](),controller['show']);router[_0xb78b('0xd')]('/',auth['isAuthenticated'](),controller[_0xb78b('0xe')]);router['put'](_0xb78b('0xb'),auth[_0xb78b('0xc')](),controller[_0xb78b('0xf')]);router['delete'](_0xb78b('0xb'),auth[_0xb78b('0xc')](),controller[_0xb78b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x731c=['/:id','show','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get'];(function(_0x2709fa,_0x372a67){var _0x112e87=function(_0x44799f){while(--_0x44799f){_0x2709fa['push'](_0x2709fa['shift']());}};_0x112e87(++_0x372a67);}(_0x731c,0x138));var _0xc731=function(_0x60ee66,_0x3ff0a6){_0x60ee66=_0x60ee66-0x0;var _0x369e2f=_0x731c[_0x60ee66];return _0x369e2f;};'use strict';var multer=require('multer');var util=require(_0xc731('0x0'));var path=require(_0xc731('0x1'));var timeout=require(_0xc731('0x2'));var express=require('express');var router=express[_0xc731('0x3')]();var fs_extra=require(_0xc731('0x4'));var auth=require(_0xc731('0x5'));var interaction=require(_0xc731('0x6'));var config=require(_0xc731('0x7'));var controller=require(_0xc731('0x8'));router['get']('/',auth[_0xc731('0x9')](),controller[_0xc731('0xa')]);router[_0xc731('0xb')](_0xc731('0xc'),auth[_0xc731('0x9')](),controller[_0xc731('0xd')]);router['post']('/',auth[_0xc731('0x9')](),controller['create']);router[_0xc731('0xe')](_0xc731('0xc'),auth[_0xc731('0x9')](),controller[_0xc731('0xf')]);router['delete'](_0xc731('0xc'),auth[_0xc731('0x9')](),controller[_0xc731('0x10')]);module[_0xc731('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e02a477..aff8b56 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 _0x6ae0=['sequelize','exports','STRING'];(function(_0x4af4c0,_0x21377b){var _0x123554=function(_0x6d3d75){while(--_0x6d3d75){_0x4af4c0['push'](_0x4af4c0['shift']());}};_0x123554(++_0x21377b);}(_0x6ae0,0x192));var _0x06ae=function(_0x1731fe,_0x3b733e){_0x1731fe=_0x1731fe-0x0;var _0x2cb785=_0x6ae0[_0x1731fe];return _0x2cb785;};'use strict';var Sequelize=require(_0x06ae('0x0'));module[_0x06ae('0x1')]={'name':{'type':Sequelize[_0x06ae('0x2')]},'basename':{'type':Sequelize[_0x06ae('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc678=['STRING'];(function(_0xc3d6fc,_0x32ca0b){var _0x4d2acc=function(_0xda09){while(--_0xda09){_0xc3d6fc['push'](_0xc3d6fc['shift']());}};_0x4d2acc(++_0x32ca0b);}(_0xc678,0x1b4));var _0x8c67=function(_0x4346bf,_0x4ddc61){_0x4346bf=_0x4346bf-0x0;var _0x3541f9=_0xc678[_0x4346bf];return _0x3541f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8c67('0x0')]},'basename':{'type':Sequelize[_0x8c67('0x0')]},'type':{'type':Sequelize[_0x8c67('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 23d1598..b1800b5 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 _0xd09e=['rawAttributes','fields','includeAll','find','clone','params','get','createdAt','updatedAt','body','create','destroy','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','root','join','basename','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Attachment','key','model','query','keys','attributes','intersection','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','catch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd09e,0x1d8));var _0xed09=function(_0x4a6873,_0x5570e1){_0x4a6873=_0x4a6873-0x0;var _0x35074c=_0xd09e[_0x4a6873];return _0x35074c;};'use strict';var emlformat=require(_0xed09('0x0'));var rimraf=require(_0xed09('0x1'));var zipdir=require(_0xed09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed09('0x3'));var moment=require(_0xed09('0x4'));var BPromise=require(_0xed09('0x5'));var Mustache=require(_0xed09('0x6'));var util=require('util');var path=require(_0xed09('0x7'));var sox=require(_0xed09('0x8'));var csv=require(_0xed09('0x9'));var ejs=require(_0xed09('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed09('0xb'));var squel=require('squel');var crypto=require(_0xed09('0xc'));var jsforce=require(_0xed09('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed09('0xe'));var Papa=require(_0xed09('0xf'));var Redis=require(_0xed09('0x10'));var authService=require(_0xed09('0x11'));var qs=require(_0xed09('0x12'));var as=require(_0xed09('0x13'));var hardwareService=require(_0xed09('0x14'));var logger=require(_0xed09('0x15'))(_0xed09('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xed09('0x17'));var db=require(_0xed09('0x18'))['db'];function respondWithStatusCode(_0x13bd71,_0x43c867){_0x43c867=_0x43c867||0xcc;return function(_0x2e06b4){if(_0x2e06b4){return _0x13bd71[_0xed09('0x19')](_0x43c867);}return _0x13bd71[_0xed09('0x1a')](_0x43c867)[_0xed09('0x1b')]();};}function respondWithResult(_0x4c6e57,_0x463cac){_0x463cac=_0x463cac||0xc8;return function(_0x17be5){if(_0x17be5){return _0x4c6e57[_0xed09('0x1a')](_0x463cac)[_0xed09('0x1c')](_0x17be5);}};}function respondWithFilteredResult(_0x3515d0,_0x27b4da){return function(_0x6c20d7){if(_0x6c20d7){var _0x4a7767=typeof _0x27b4da['offset']===_0xed09('0x1d')&&typeof _0x27b4da[_0xed09('0x1e')]===_0xed09('0x1d');var _0x15145c=_0x6c20d7['count'];var _0x592805=_0x4a7767?0x0:_0x27b4da[_0xed09('0x1f')];var _0x188448=_0x4a7767?_0x6c20d7[_0xed09('0x20')]:_0x27b4da[_0xed09('0x1f')]+_0x27b4da[_0xed09('0x1e')];var _0x4df891;if(_0x188448>=_0x15145c){_0x188448=_0x15145c;_0x4df891=0xc8;}else{_0x4df891=0xce;}_0x3515d0['status'](_0x4df891);return _0x3515d0[_0xed09('0x21')](_0xed09('0x22'),_0x592805+'-'+_0x188448+'/'+_0x15145c)[_0xed09('0x1c')](_0x6c20d7);}return null;};}function patchUpdates(_0x4b5640){return function(_0x37cb91){try{jsonpatch[_0xed09('0x23')](_0x37cb91,_0x4b5640,!![]);}catch(_0x4a5cbc){return BPromise[_0xed09('0x24')](_0x4a5cbc);}return _0x37cb91[_0xed09('0x25')]();};}function saveUpdates(_0x5aad24,_0x537553){return function(_0x588d3e){if(_0x588d3e){return _0x588d3e[_0xed09('0x26')](_0x5aad24)[_0xed09('0x27')](function(_0x420773){return _0x420773;});}return null;};}function removeEntity(_0x37e80f,_0x14fdae){return function(_0x146d2c){if(_0x146d2c){return _0x146d2c['destroy']()[_0xed09('0x27')](function(){_0x37e80f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17fb5d,_0x428996){return function(_0x32f090){if(!_0x32f090){_0x17fb5d[_0xed09('0x19')](0x194);}return _0x32f090;};}function handleError(_0x47b0c6,_0x31302d){_0x31302d=_0x31302d||0x1f4;return function(_0x1fe6d1){logger[_0xed09('0x28')](_0x1fe6d1[_0xed09('0x29')]);if(_0x1fe6d1[_0xed09('0x2a')]){delete _0x1fe6d1[_0xed09('0x2a')];}_0x47b0c6[_0xed09('0x1a')](_0x31302d)[_0xed09('0x2b')](_0x1fe6d1);};}exports[_0xed09('0x2c')]=function(_0x515517,_0x2338f2){var _0x13b198={},_0x423b58={},_0x439404={'count':0x0,'rows':[]};var _0x43107a=_[_0xed09('0x2d')](db[_0xed09('0x2e')]['rawAttributes'],function(_0x1e41a1){return{'name':_0x1e41a1['fieldName'],'type':_0x1e41a1['type'][_0xed09('0x2f')]};});_0x423b58[_0xed09('0x30')]=_[_0xed09('0x2d')](_0x43107a,_0xed09('0x2a'));_0x423b58[_0xed09('0x31')]=_[_0xed09('0x32')](_0x515517[_0xed09('0x31')]);_0x423b58['filters']=_['intersection'](_0x423b58[_0xed09('0x30')],_0x423b58[_0xed09('0x31')]);_0x13b198[_0xed09('0x33')]=_[_0xed09('0x34')](_0x423b58['model'],qs['fields'](_0x515517[_0xed09('0x31')]['fields']));_0x13b198[_0xed09('0x33')]=_0x13b198[_0xed09('0x33')][_0xed09('0x35')]?_0x13b198[_0xed09('0x33')]:_0x423b58[_0xed09('0x30')];if(!_0x515517[_0xed09('0x31')]['hasOwnProperty'](_0xed09('0x36'))){_0x13b198[_0xed09('0x1e')]=qs[_0xed09('0x1e')](_0x515517['query'][_0xed09('0x1e')]);_0x13b198[_0xed09('0x1f')]=qs[_0xed09('0x1f')](_0x515517[_0xed09('0x31')]['offset']);}_0x13b198[_0xed09('0x37')]=qs[_0xed09('0x38')](_0x515517[_0xed09('0x31')]['sort']);_0x13b198['where']=qs[_0xed09('0x39')](_[_0xed09('0x3a')](_0x515517[_0xed09('0x31')],_0x423b58[_0xed09('0x39')]),_0x43107a);if(_0x515517[_0xed09('0x31')][_0xed09('0x3b')]){_0x13b198[_0xed09('0x3c')]=_[_0xed09('0x3d')](_0x13b198[_0xed09('0x3c')],{'$or':_[_0xed09('0x2d')](_0x43107a,function(_0x2cf3b3){if(_0x2cf3b3[_0xed09('0x3e')]!==_0xed09('0x3f')){var _0x69e47={};_0x69e47[_0x2cf3b3[_0xed09('0x2a')]]={'$like':'%'+_0x515517['query'][_0xed09('0x3b')]+'%'};return _0x69e47;}})});}_0x13b198=_['merge']({},_0x13b198,_0x515517[_0xed09('0x40')]);var _0x2b9a72={'where':_0x13b198[_0xed09('0x3c')]};return db['Attachment'][_0xed09('0x20')](_0x2b9a72)[_0xed09('0x27')](function(_0xbe9f8c){_0x439404[_0xed09('0x20')]=_0xbe9f8c;if(_0x515517['query']['includeAll']){_0x13b198[_0xed09('0x41')]=[{'all':!![]}];}return db['Attachment'][_0xed09('0x42')](_0x13b198);})[_0xed09('0x27')](function(_0x3d1efd){_0x439404['rows']=_0x3d1efd;return _0x439404;})[_0xed09('0x27')](respondWithFilteredResult(_0x2338f2,_0x13b198))[_0xed09('0x43')](handleError(_0x2338f2,null));};exports['show']=function(_0x5471dd,_0x38735b){var _0x1a2ae6={'raw':!![],'where':{'id':_0x5471dd['params']['id']}},_0xf5ffb8={};_0xf5ffb8['model']=_['keys'](db[_0xed09('0x2e')][_0xed09('0x44')]);_0xf5ffb8[_0xed09('0x31')]=_['keys'](_0x5471dd['query']);_0xf5ffb8[_0xed09('0x39')]=_[_0xed09('0x34')](_0xf5ffb8[_0xed09('0x30')],_0xf5ffb8[_0xed09('0x31')]);_0x1a2ae6[_0xed09('0x33')]=_[_0xed09('0x34')](_0xf5ffb8[_0xed09('0x30')],qs[_0xed09('0x45')](_0x5471dd[_0xed09('0x31')]['fields']));_0x1a2ae6['attributes']=_0x1a2ae6['attributes'][_0xed09('0x35')]?_0x1a2ae6[_0xed09('0x33')]:_0xf5ffb8[_0xed09('0x30')];if(_0x5471dd[_0xed09('0x31')][_0xed09('0x46')]){_0x1a2ae6['include']=[{'all':!![]}];}_0x1a2ae6=_[_0xed09('0x3d')]({},_0x1a2ae6,_0x5471dd['options']);return db[_0xed09('0x2e')][_0xed09('0x47')](_0x1a2ae6)[_0xed09('0x27')](handleEntityNotFound(_0x38735b,null))[_0xed09('0x27')](respondWithResult(_0x38735b,null))[_0xed09('0x43')](handleError(_0x38735b,null));};exports[_0xed09('0x48')]=function(_0x4eb316,_0x5145a0){var _0x5a2a69={'where':{'id':_0x4eb316[_0xed09('0x49')]['id']}},_0x50f9e0={};_0x50f9e0[_0xed09('0x30')]=_[_0xed09('0x32')](db[_0xed09('0x2e')]['rawAttributes']);_0x5a2a69[_0xed09('0x33')]=_[_0xed09('0x34')](_0x50f9e0[_0xed09('0x30')],qs[_0xed09('0x45')](_0x4eb316[_0xed09('0x31')][_0xed09('0x45')]));_0x5a2a69[_0xed09('0x33')]=_0x5a2a69[_0xed09('0x33')][_0xed09('0x35')]?_0x5a2a69[_0xed09('0x33')]:_0x50f9e0[_0xed09('0x30')];if(_0x4eb316['query']['includeAll']){_0x5a2a69[_0xed09('0x41')]=[{'all':!![]}];}_0x5a2a69=_[_0xed09('0x3d')]({},_0x5a2a69,_0x4eb316[_0xed09('0x40')]);return db['Attachment'][_0xed09('0x47')](_0x5a2a69)[_0xed09('0x27')](handleEntityNotFound(_0x5145a0,null))[_0xed09('0x27')](function(_0x50d786){if(_0x50d786){var _0x1678ec=_0x50d786[_0xed09('0x4a')]({'plain':!![]});_0x1678ec=qs['omit'](_0x1678ec,['id',_0xed09('0x4b'),_0xed09('0x4c')]);_0x4eb316[_0xed09('0x4d')]=_['omit'](_0x4eb316['body'],['id',_0xed09('0x4b'),_0xed09('0x4c')]);return db['Attachment'][_0xed09('0x4e')](_[_0xed09('0x3d')](_0x1678ec,_0x4eb316['body']),{'include':_0x4eb316[_0xed09('0x31')][_0xed09('0x46')]?[{'all':!![]}]:undefined});}})[_0xed09('0x27')](respondWithResult(_0x5145a0,0xc9))[_0xed09('0x43')](handleError(_0x5145a0,null));};exports['update']=function(_0x1999d5,_0x315886){if(_0x1999d5['body']['id']){delete _0x1999d5['body']['id'];}return db['Attachment'][_0xed09('0x47')]({'where':{'id':_0x1999d5[_0xed09('0x49')]['id']}})[_0xed09('0x27')](handleEntityNotFound(_0x315886,null))[_0xed09('0x27')](saveUpdates(_0x1999d5[_0xed09('0x4d')],null))[_0xed09('0x27')](respondWithResult(_0x315886,null))['catch'](handleError(_0x315886,null));};exports[_0xed09('0x4f')]=function(_0x28e9a0,_0x1d862c){return db['Attachment']['find']({'where':{'id':_0x28e9a0[_0xed09('0x49')]['id']}})[_0xed09('0x27')](handleEntityNotFound(_0x1d862c,null))['then'](removeEntity(_0x1d862c,null))[_0xed09('0x43')](handleError(_0x1d862c,null));};exports['create']=function(_0x2c0982,_0x16858d,_0x4520ad){_0x2c0982[_0xed09('0x4d')][_0xed09('0x2a')]=_0x2c0982[_0xed09('0x50')][_0xed09('0x51')];_0x2c0982[_0xed09('0x4d')]['basename']=_0x2c0982[_0xed09('0x50')][_0xed09('0x52')];_0x2c0982[_0xed09('0x4d')][_0xed09('0x3e')]=_0x2c0982[_0xed09('0x50')][_0xed09('0x53')];return db[_0xed09('0x2e')][_0xed09('0x4e')](_0x2c0982['body'])[_0xed09('0x27')](respondWithResult(_0x16858d,0xc9))[_0xed09('0x43')](handleError(_0x16858d,null));};exports[_0xed09('0x54')]=function(_0x252c92,_0x1638a1,_0x40863d){return db[_0xed09('0x2e')][_0xed09('0x55')]({'where':{'id':_0x252c92[_0xed09('0x49')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1638a1,null))[_0xed09('0x27')](function(_0x295980){if(_0x295980){var _0x5b81f9=_0x295980[_0xed09('0x56')]!==null;var _0x3fbbe0=path['join'](config[_0xed09('0x57')],'server/files/attachments/');if(_0x5b81f9){_0x3fbbe0=path[_0xed09('0x58')](_0x3fbbe0,'offline-chat/');}var _0x1a8dc5=path[_0xed09('0x58')](_0x3fbbe0,_0x295980[_0xed09('0x59')]);return _0x1638a1[_0xed09('0x54')](_0x1a8dc5);}})[_0xed09('0x43')](handleError(_0x1638a1,null));}; \ No newline at end of file +var _0x56e7=['VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','get','omit','createdAt','updatedAt','body','params','create','file','originalname','basename','filename','mimetype','download','findOne','root','server/files/attachments/','join','offline-chat/','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x45f6a3,_0x5667f5){var _0x379fd2=function(_0x17d8ef){while(--_0x17d8ef){_0x45f6a3['push'](_0x45f6a3['shift']());}};_0x379fd2(++_0x5667f5);}(_0x56e7,0xcd));var _0x756e=function(_0x28f105,_0x1c5ba0){_0x28f105=_0x28f105-0x0;var _0x33aa8a=_0x56e7[_0x28f105];return _0x33aa8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x756e('0x0'));var zipdir=require(_0x756e('0x1'));var jsonpatch=require(_0x756e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x756e('0x3'));var path=require(_0x756e('0x4'));var sox=require(_0x756e('0x5'));var csv=require(_0x756e('0x6'));var ejs=require(_0x756e('0x7'));var fs=require('fs');var fs_extra=require(_0x756e('0x8'));var _=require('lodash');var squel=require(_0x756e('0x9'));var crypto=require(_0x756e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x756e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x756e('0xc'));var Papa=require(_0x756e('0xd'));var Redis=require(_0x756e('0xe'));var authService=require(_0x756e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x756e('0x10'));var hardwareService=require(_0x756e('0x11'));var logger=require(_0x756e('0x12'))('api');var utils=require(_0x756e('0x13'));var config=require(_0x756e('0x14'));var licenseUtil=require(_0x756e('0x15'));var db=require(_0x756e('0x16'))['db'];function respondWithStatusCode(_0x5a204f,_0x59dc58){_0x59dc58=_0x59dc58||0xcc;return function(_0x1c669e){if(_0x1c669e){return _0x5a204f[_0x756e('0x17')](_0x59dc58);}return _0x5a204f[_0x756e('0x18')](_0x59dc58)[_0x756e('0x19')]();};}function respondWithResult(_0x5b7762,_0xe80944){_0xe80944=_0xe80944||0xc8;return function(_0x6ac509){if(_0x6ac509){return _0x5b7762[_0x756e('0x18')](_0xe80944)['json'](_0x6ac509);}};}function respondWithFilteredResult(_0xfeb1c6,_0x1f3906){return function(_0x2269d6){if(_0x2269d6){var _0x14c251=typeof _0x1f3906[_0x756e('0x1a')]===_0x756e('0x1b')&&typeof _0x1f3906[_0x756e('0x1c')]===_0x756e('0x1b');var _0x10752e=_0x2269d6[_0x756e('0x1d')];var _0x35e89a=_0x14c251?0x0:_0x1f3906[_0x756e('0x1a')];var _0xf7368a=_0x14c251?_0x2269d6[_0x756e('0x1d')]:_0x1f3906[_0x756e('0x1a')]+_0x1f3906[_0x756e('0x1c')];var _0x581c48;if(_0xf7368a>=_0x10752e){_0xf7368a=_0x10752e;_0x581c48=0xc8;}else{_0x581c48=0xce;}_0xfeb1c6[_0x756e('0x18')](_0x581c48);return _0xfeb1c6[_0x756e('0x1e')](_0x756e('0x1f'),_0x35e89a+'-'+_0xf7368a+'/'+_0x10752e)[_0x756e('0x20')](_0x2269d6);}return null;};}function patchUpdates(_0x3faf33){return function(_0xeb09b1){try{jsonpatch['apply'](_0xeb09b1,_0x3faf33,!![]);}catch(_0x40e1f0){return BPromise[_0x756e('0x21')](_0x40e1f0);}return _0xeb09b1[_0x756e('0x22')]();};}function saveUpdates(_0x3668a4,_0x3c10bb){return function(_0x102c85){if(_0x102c85){return _0x102c85[_0x756e('0x23')](_0x3668a4)[_0x756e('0x24')](function(_0x49ae1c){return _0x49ae1c;});}return null;};}function removeEntity(_0x5f461a,_0x56c7e4){return function(_0x4c7282){if(_0x4c7282){return _0x4c7282[_0x756e('0x25')]()[_0x756e('0x24')](function(){_0x5f461a[_0x756e('0x18')](0xcc)[_0x756e('0x19')]();});}};}function handleEntityNotFound(_0x829905,_0xd94eba){return function(_0x4b952a){if(!_0x4b952a){_0x829905[_0x756e('0x17')](0x194);}return _0x4b952a;};}function handleError(_0x172b6b,_0x46a86b){_0x46a86b=_0x46a86b||0x1f4;return function(_0x3c3129){logger[_0x756e('0x26')](_0x3c3129[_0x756e('0x27')]);if(_0x3c3129['name']){delete _0x3c3129[_0x756e('0x28')];}_0x172b6b[_0x756e('0x18')](_0x46a86b)['send'](_0x3c3129);};}exports[_0x756e('0x29')]=function(_0x511796,_0x4bd1f9){var _0x19a140={},_0x5c670a={},_0x264a76={'count':0x0,'rows':[]};var _0x3178fb=_[_0x756e('0x2a')](db[_0x756e('0x2b')][_0x756e('0x2c')],function(_0x11fc02){return{'name':_0x11fc02[_0x756e('0x2d')],'type':_0x11fc02[_0x756e('0x2e')]['key']};});_0x5c670a[_0x756e('0x2f')]=_[_0x756e('0x2a')](_0x3178fb,'name');_0x5c670a[_0x756e('0x30')]=_['keys'](_0x511796['query']);_0x5c670a[_0x756e('0x31')]=_[_0x756e('0x32')](_0x5c670a[_0x756e('0x2f')],_0x5c670a[_0x756e('0x30')]);_0x19a140[_0x756e('0x33')]=_['intersection'](_0x5c670a[_0x756e('0x2f')],qs[_0x756e('0x34')](_0x511796['query'][_0x756e('0x34')]));_0x19a140[_0x756e('0x33')]=_0x19a140[_0x756e('0x33')][_0x756e('0x35')]?_0x19a140[_0x756e('0x33')]:_0x5c670a[_0x756e('0x2f')];if(!_0x511796['query'][_0x756e('0x36')]('nolimit')){_0x19a140[_0x756e('0x1c')]=qs[_0x756e('0x1c')](_0x511796['query'][_0x756e('0x1c')]);_0x19a140[_0x756e('0x1a')]=qs[_0x756e('0x1a')](_0x511796[_0x756e('0x30')][_0x756e('0x1a')]);}_0x19a140['order']=qs[_0x756e('0x37')](_0x511796['query'][_0x756e('0x37')]);_0x19a140[_0x756e('0x38')]=qs[_0x756e('0x31')](_[_0x756e('0x39')](_0x511796[_0x756e('0x30')],_0x5c670a[_0x756e('0x31')]),_0x3178fb);if(_0x511796[_0x756e('0x30')][_0x756e('0x3a')]){_0x19a140[_0x756e('0x38')]=_['merge'](_0x19a140[_0x756e('0x38')],{'$or':_[_0x756e('0x2a')](_0x3178fb,function(_0x39d45a){if(_0x39d45a[_0x756e('0x2e')]!==_0x756e('0x3b')){var _0x15acc0={};_0x15acc0[_0x39d45a['name']]={'$like':'%'+_0x511796['query'][_0x756e('0x3a')]+'%'};return _0x15acc0;}})});}_0x19a140=_[_0x756e('0x3c')]({},_0x19a140,_0x511796['options']);var _0x4c7482={'where':_0x19a140['where']};return db[_0x756e('0x2b')][_0x756e('0x1d')](_0x4c7482)[_0x756e('0x24')](function(_0x4b48f2){_0x264a76[_0x756e('0x1d')]=_0x4b48f2;if(_0x511796[_0x756e('0x30')][_0x756e('0x3d')]){_0x19a140[_0x756e('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0x756e('0x3f')](_0x19a140);})['then'](function(_0x43e8f7){_0x264a76[_0x756e('0x40')]=_0x43e8f7;return _0x264a76;})['then'](respondWithFilteredResult(_0x4bd1f9,_0x19a140))[_0x756e('0x41')](handleError(_0x4bd1f9,null));};exports[_0x756e('0x42')]=function(_0x51aa09,_0x4de975){var _0x22c7dd={'raw':!![],'where':{'id':_0x51aa09['params']['id']}},_0x3fa8e1={};_0x3fa8e1[_0x756e('0x2f')]=_['keys'](db[_0x756e('0x2b')][_0x756e('0x2c')]);_0x3fa8e1['query']=_[_0x756e('0x43')](_0x51aa09[_0x756e('0x30')]);_0x3fa8e1[_0x756e('0x31')]=_['intersection'](_0x3fa8e1['model'],_0x3fa8e1[_0x756e('0x30')]);_0x22c7dd[_0x756e('0x33')]=_['intersection'](_0x3fa8e1['model'],qs[_0x756e('0x34')](_0x51aa09[_0x756e('0x30')][_0x756e('0x34')]));_0x22c7dd[_0x756e('0x33')]=_0x22c7dd['attributes'][_0x756e('0x35')]?_0x22c7dd[_0x756e('0x33')]:_0x3fa8e1['model'];if(_0x51aa09['query'][_0x756e('0x3d')]){_0x22c7dd[_0x756e('0x3e')]=[{'all':!![]}];}_0x22c7dd=_[_0x756e('0x3c')]({},_0x22c7dd,_0x51aa09[_0x756e('0x44')]);return db['Attachment']['find'](_0x22c7dd)[_0x756e('0x24')](handleEntityNotFound(_0x4de975,null))[_0x756e('0x24')](respondWithResult(_0x4de975,null))[_0x756e('0x41')](handleError(_0x4de975,null));};exports['clone']=function(_0x42d452,_0x37a917){var _0x4a8f17={'where':{'id':_0x42d452['params']['id']}},_0x22017f={};_0x22017f[_0x756e('0x2f')]=_['keys'](db[_0x756e('0x2b')][_0x756e('0x2c')]);_0x4a8f17['attributes']=_[_0x756e('0x32')](_0x22017f[_0x756e('0x2f')],qs[_0x756e('0x34')](_0x42d452['query'][_0x756e('0x34')]));_0x4a8f17[_0x756e('0x33')]=_0x4a8f17['attributes'][_0x756e('0x35')]?_0x4a8f17[_0x756e('0x33')]:_0x22017f[_0x756e('0x2f')];if(_0x42d452['query']['includeAll']){_0x4a8f17['include']=[{'all':!![]}];}_0x4a8f17=_['merge']({},_0x4a8f17,_0x42d452[_0x756e('0x44')]);return db[_0x756e('0x2b')][_0x756e('0x45')](_0x4a8f17)['then'](handleEntityNotFound(_0x37a917,null))[_0x756e('0x24')](function(_0x13efd3){if(_0x13efd3){var _0x4dce5a=_0x13efd3[_0x756e('0x46')]({'plain':!![]});_0x4dce5a=qs[_0x756e('0x47')](_0x4dce5a,['id',_0x756e('0x48'),_0x756e('0x49')]);_0x42d452[_0x756e('0x4a')]=_['omit'](_0x42d452[_0x756e('0x4a')],['id',_0x756e('0x48'),_0x756e('0x49')]);return db[_0x756e('0x2b')]['create'](_[_0x756e('0x3c')](_0x4dce5a,_0x42d452[_0x756e('0x4a')]),{'include':_0x42d452[_0x756e('0x30')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x756e('0x24')](respondWithResult(_0x37a917,0xc9))[_0x756e('0x41')](handleError(_0x37a917,null));};exports[_0x756e('0x23')]=function(_0x21b17f,_0x2d3f53){if(_0x21b17f[_0x756e('0x4a')]['id']){delete _0x21b17f[_0x756e('0x4a')]['id'];}return db[_0x756e('0x2b')][_0x756e('0x45')]({'where':{'id':_0x21b17f[_0x756e('0x4b')]['id']}})[_0x756e('0x24')](handleEntityNotFound(_0x2d3f53,null))[_0x756e('0x24')](saveUpdates(_0x21b17f['body'],null))[_0x756e('0x24')](respondWithResult(_0x2d3f53,null))[_0x756e('0x41')](handleError(_0x2d3f53,null));};exports[_0x756e('0x25')]=function(_0x10c6aa,_0x58d5d7){return db[_0x756e('0x2b')]['find']({'where':{'id':_0x10c6aa[_0x756e('0x4b')]['id']}})[_0x756e('0x24')](handleEntityNotFound(_0x58d5d7,null))[_0x756e('0x24')](removeEntity(_0x58d5d7,null))[_0x756e('0x41')](handleError(_0x58d5d7,null));};exports[_0x756e('0x4c')]=function(_0x2f7a17,_0x55c6ac,_0xa3714d){_0x2f7a17[_0x756e('0x4a')]['name']=_0x2f7a17[_0x756e('0x4d')][_0x756e('0x4e')];_0x2f7a17[_0x756e('0x4a')][_0x756e('0x4f')]=_0x2f7a17[_0x756e('0x4d')][_0x756e('0x50')];_0x2f7a17[_0x756e('0x4a')][_0x756e('0x2e')]=_0x2f7a17[_0x756e('0x4d')][_0x756e('0x51')];return db[_0x756e('0x2b')][_0x756e('0x4c')](_0x2f7a17['body'])[_0x756e('0x24')](respondWithResult(_0x55c6ac,0xc9))[_0x756e('0x41')](handleError(_0x55c6ac,null));};exports[_0x756e('0x52')]=function(_0x5928cc,_0x4bb954,_0xa1d230){return db[_0x756e('0x2b')][_0x756e('0x53')]({'where':{'id':_0x5928cc[_0x756e('0x4b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4bb954,null))[_0x756e('0x24')](function(_0x30929c){if(_0x30929c){var _0x455d69=_0x30929c['ChatOfflineMessageId']!==null;var _0x3cf51c=path['join'](config[_0x756e('0x54')],_0x756e('0x55'));if(_0x455d69){_0x3cf51c=path[_0x756e('0x56')](_0x3cf51c,_0x756e('0x57'));}var _0x1dac29=path[_0x756e('0x56')](_0x3cf51c,_0x30929c[_0x756e('0x4f')]);return _0x4bb954[_0x756e('0x52')](_0x1dac29);}})[_0x756e('0x41')](handleError(_0x4bb954,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 842c182..3fa21d4 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 _0x8f0c=['rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17a516,_0x132246){var _0x55bd58=function(_0x2ed196){while(--_0x2ed196){_0x17a516['push'](_0x17a516['shift']());}};_0x55bd58(++_0x132246);}(_0x8f0c,0x1b3));var _0xc8f0=function(_0x251fa4,_0x3d5860){_0x251fa4=_0x251fa4-0x0;var _0x453047=_0x8f0c[_0x251fa4];return _0x453047;};'use strict';var _=require(_0xc8f0('0x0'));var util=require('util');var logger=require(_0xc8f0('0x1'))(_0xc8f0('0x2'));var moment=require(_0xc8f0('0x3'));var BPromise=require(_0xc8f0('0x4'));var rp=require(_0xc8f0('0x5'));var fs=require('fs');var path=require(_0xc8f0('0x6'));var rimraf=require(_0xc8f0('0x7'));var config=require(_0xc8f0('0x8'));var attributes=require(_0xc8f0('0x9'));module[_0xc8f0('0xa')]=function(_0xdee4b9,_0x50ce0e){return _0xdee4b9[_0xc8f0('0xb')]('Attachment',attributes,{'tableName':_0xc8f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7726=['request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','bluebird'];(function(_0x39f6a8,_0x47a635){var _0x26ed2c=function(_0x5dedbf){while(--_0x5dedbf){_0x39f6a8['push'](_0x39f6a8['shift']());}};_0x26ed2c(++_0x47a635);}(_0x7726,0xff));var _0x6772=function(_0x3585e9,_0x54b683){_0x3585e9=_0x3585e9-0x0;var _0x2d88dd=_0x7726[_0x3585e9];return _0x2d88dd;};'use strict';var _=require(_0x6772('0x0'));var util=require(_0x6772('0x1'));var logger=require(_0x6772('0x2'))(_0x6772('0x3'));var moment=require('moment');var BPromise=require(_0x6772('0x4'));var rp=require(_0x6772('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6772('0x6'));var config=require(_0x6772('0x7'));var attributes=require(_0x6772('0x8'));module[_0x6772('0x9')]=function(_0x533638,_0x50410d){return _0x533638[_0x6772('0xa')](_0x6772('0xb'),attributes,{'tableName':_0x6772('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index aa2e942..836fd20 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 _0x0f69=['../../config/logger','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','moment','randomstring','ioredis','../../config/utils'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0x0f69,0x173));var _0x90f6=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x0f69[_0x20a558];return _0x53d3f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x90f6('0x1'));var fs=require('fs');var Redis=require(_0x90f6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90f6('0x3'));var logger=require(_0x90f6('0x4'))('rpc');var config=require(_0x90f6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90f6('0x6')][_0x90f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45657d,_0x3b35a0,_0x3bc2eb){return new BPromise(function(_0x42044f,_0x488b53){return client[_0x90f6('0x8')](_0x45657d,_0x3bc2eb)[_0x90f6('0x9')](function(_0x3c8148){logger[_0x90f6('0xa')](_0x90f6('0xb'),_0x3b35a0,_0x90f6('0xc'));logger['debug'](_0x90f6('0xd'),_0x3b35a0,_0x90f6('0xc'),JSON['stringify'](_0x3c8148));if(_0x3c8148[_0x90f6('0xe')]){if(_0x3c8148['error'][_0x90f6('0xf')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x3b35a0,_0x3c8148[_0x90f6('0xe')]['message']);return _0x488b53(_0x3c8148[_0x90f6('0xe')][_0x90f6('0x10')]);}logger[_0x90f6('0xe')](_0x90f6('0xb'),_0x3b35a0,_0x3c8148['error'][_0x90f6('0x10')]);return _0x42044f(_0x3c8148['error']['message']);}else{logger[_0x90f6('0xa')]('Attachment,\x20%s,\x20%s',_0x3b35a0,_0x90f6('0xc'));_0x42044f(_0x3c8148[_0x90f6('0x11')][_0x90f6('0x10')]);}})[_0x90f6('0x12')](function(_0x3b4d5d){logger[_0x90f6('0xe')](_0x90f6('0xb'),_0x3b35a0,_0x3b4d5d);_0x488b53(_0x3b4d5d);});});}exports['CreateAttachment']=function(_0x36682a){var _0x2898a8=this;return new Promise(function(_0x5ac9be,_0x4209b8){return db[_0x90f6('0x13')][_0x90f6('0x14')](_0x36682a[_0x90f6('0x15')],{'raw':_0x36682a[_0x90f6('0x16')]?_0x36682a[_0x90f6('0x16')][_0x90f6('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1beb61){logger[_0x90f6('0xa')]('CreateAttachment',_0x36682a);logger['debug'](_0x90f6('0x18'),_0x36682a,JSON['stringify'](_0x1beb61));_0x5ac9be(_0x1beb61);})['catch'](function(_0x763a9b){logger['error'](_0x90f6('0x18'),_0x763a9b[_0x90f6('0x10')],_0x36682a);_0x4209b8(_0x2898a8[_0x90f6('0xe')](0x1f4,_0x763a9b[_0x90f6('0x10')]));});});}; \ No newline at end of file +var _0x8868=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Attachment,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8868,0x1ca));var _0x8886=function(_0x26c119,_0x2fbdb8){_0x26c119=_0x26c119-0x0;var _0x316deb=_0x8868[_0x26c119];return _0x316deb;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var moment=require(_0x8886('0x2'));var BPromise=require(_0x8886('0x3'));var rs=require(_0x8886('0x4'));var fs=require('fs');var Redis=require(_0x8886('0x5'));var db=require(_0x8886('0x6'))['db'];var utils=require(_0x8886('0x7'));var logger=require(_0x8886('0x8'))(_0x8886('0x9'));var config=require(_0x8886('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b94d,_0x5e2a73,_0x1a85e1){return new BPromise(function(_0x56b9fa,_0x147fc9){return client[_0x8886('0xc')](_0x26b94d,_0x1a85e1)[_0x8886('0xd')](function(_0x39036d){logger[_0x8886('0xe')](_0x8886('0xf'),_0x5e2a73,'request\x20sent');logger[_0x8886('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5e2a73,'request\x20sent',JSON[_0x8886('0x11')](_0x39036d));if(_0x39036d['error']){if(_0x39036d[_0x8886('0x12')][_0x8886('0x13')]===0x1f4){logger[_0x8886('0x12')](_0x8886('0xf'),_0x5e2a73,_0x39036d['error'][_0x8886('0x14')]);return _0x147fc9(_0x39036d[_0x8886('0x12')]['message']);}logger[_0x8886('0x12')]('Attachment,\x20%s,\x20%s',_0x5e2a73,_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);return _0x56b9fa(_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x5e2a73,_0x8886('0x15'));_0x56b9fa(_0x39036d[_0x8886('0x16')]['message']);}})['catch'](function(_0x563a82){logger['error'](_0x8886('0xf'),_0x5e2a73,_0x563a82);_0x147fc9(_0x563a82);});});}exports[_0x8886('0x17')]=function(_0x1d47a6){var _0x5504ab=this;return new Promise(function(_0xb13c62,_0x20072e){return db[_0x8886('0x18')][_0x8886('0x19')](_0x1d47a6[_0x8886('0x1a')],{'raw':_0x1d47a6[_0x8886('0x1b')]?_0x1d47a6[_0x8886('0x1b')][_0x8886('0x1c')]===undefined?!![]:![]:!![]})[_0x8886('0xd')](function(_0x19f0ef){logger['info'](_0x8886('0x17'),_0x1d47a6);logger['debug'](_0x8886('0x17'),_0x1d47a6,JSON[_0x8886('0x11')](_0x19f0ef));_0xb13c62(_0x19f0ef);})['catch'](function(_0x3894a0){logger[_0x8886('0x12')](_0x8886('0x17'),_0x3894a0[_0x8886('0x14')],_0x1d47a6);_0x20072e(_0x5504ab[_0x8886('0x12')](0x1f4,_0x3894a0[_0x8886('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ec3a74a..84b44d3 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x12d8dc,_0x4ea5f3){var _0x1bf639=function(_0x30c282){while(--_0x30c282){_0x12d8dc['push'](_0x12d8dc['shift']());}};_0x1bf639(++_0x4ea5f3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a731a,_0x200bce){_0x4a731a=_0x4a731a-0x0;var _0x6d27fa=_0x5f2f[_0x4a731a];return _0x6d27fa;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a7cad6c..bb37a39 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 _0xeb16=['getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','clientID','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','User','map','value','user','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','minutes','clearBlockUser'];(function(_0x261655,_0x5c949f){var _0x25b37e=function(_0x5dede1){while(--_0x5dede1){_0x261655['push'](_0x261655['shift']());}};_0x25b37e(++_0x5c949f);}(_0xeb16,0x102));var _0x6eb1=function(_0x1342a1,_0x365a1b){_0x1342a1=_0x1342a1-0x0;var _0x3722c0=_0xeb16[_0x1342a1];return _0x3722c0;};'use strict';var _=require('lodash');var passport=require(_0x6eb1('0x0'));var GoogleStrategy=require(_0x6eb1('0x1'))[_0x6eb1('0x2')];var moment=require(_0x6eb1('0x3'));var db=require(_0x6eb1('0x4'))['db'];var config=require(_0x6eb1('0x5'));var signToken=require(_0x6eb1('0x6'))[_0x6eb1('0x7')];var utils=require(_0x6eb1('0x8'));exports[_0x6eb1('0x9')]=passport[_0x6eb1('0xa')](_0x6eb1('0xb'),{'failureRedirect':_0x6eb1('0xc'),'scope':['profile',_0x6eb1('0xd')],'session':![]});exports['callback']=passport[_0x6eb1('0xa')](_0x6eb1('0xb'),{'failureRedirect':_0x6eb1('0xc'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x6eb1('0xb')]?config[_0x6eb1('0xb')][_0x6eb1('0xe')]:'id','clientSecret':config[_0x6eb1('0xb')]?config['google'][_0x6eb1('0xf')]:_0x6eb1('0x10'),'callbackURL':config['google']?config['google']['callbackURL']:''},function(_0x1f3da3,_0x17c4e8,_0xcea09,_0x925f1a){var _0x240300,_0x505a66;return db[_0x6eb1('0x11')][_0x6eb1('0x12')]({'where':{'id':0x1},'attributes':[_0x6eb1('0x13'),_0x6eb1('0x14')],'raw':!![]})['then'](function(_0x41e973){_0x240300=_0x41e973;return db[_0x6eb1('0x15')]['find']({'where':{'email':_[_0x6eb1('0x16')](_0xcea09['emails'],_0x6eb1('0x17')),'role':{'$or':['admin',_0x6eb1('0x18'),'agent']}}});})[_0x6eb1('0x19')](function(_0x486336){_0x505a66=_0x486336;if(_0x505a66){if(_0x505a66['disabled']){return _0x925f1a(_0x6eb1('0x1a'));}else if(_0x240300['blockDuration']>0x0){if(_0x505a66['blocked']){if(moment(_0x505a66[_0x6eb1('0x1b')])['add'](_0x240300[_0x6eb1('0x14')],_0x6eb1('0x1c'))>moment()){return _0x925f1a(_0x6eb1('0x1a'));}else{return utils[_0x6eb1('0x1d')](_0x505a66,0x0,![],null)[_0x6eb1('0x19')](function(){return utils[_0x6eb1('0x1e')](_0x505a66);})[_0x6eb1('0x19')](function(){return _0x925f1a(null,_0x505a66);});}}else{return utils[_0x6eb1('0x1e')](_0x505a66)[_0x6eb1('0x19')](function(){return _0x925f1a(null,_0x505a66);});}}else{return utils[_0x6eb1('0x1e')](_0x505a66)['then'](function(){return _0x925f1a(null,_0x505a66);});}}return _0x925f1a(_0x6eb1('0x1a'));})[_0x6eb1('0x1f')](function(_0x64f829){_0x925f1a(_0x64f829);});})); \ No newline at end of file +var _0x74bd=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','google','/login','authenticate','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','find','map','emails','value','admin','user','agent','disabled'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x74bd,0x97));var _0xd74b=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x74bd[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0xd74b('0x0'));var passport=require(_0xd74b('0x1'));var GoogleStrategy=require(_0xd74b('0x2'))[_0xd74b('0x3')];var moment=require('moment');var db=require(_0xd74b('0x4'))['db'];var config=require(_0xd74b('0x5'));var signToken=require(_0xd74b('0x6'))['signToken'];var utils=require(_0xd74b('0x7'));exports[_0xd74b('0x8')]=passport['authenticate'](_0xd74b('0x9'),{'failureRedirect':_0xd74b('0xa'),'scope':['profile','email'],'session':![]});exports['callback']=passport[_0xd74b('0xb')](_0xd74b('0x9'),{'failureRedirect':_0xd74b('0xa'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0xd74b('0x9')]?config[_0xd74b('0x9')][_0xd74b('0xc')]:'id','clientSecret':config[_0xd74b('0x9')]?config['google'][_0xd74b('0xd')]:_0xd74b('0xe'),'callbackURL':config['google']?config[_0xd74b('0x9')][_0xd74b('0xf')]:''},function(_0x1abce6,_0x49802c,_0x47dc90,_0x4e4d12){var _0x9530a4,_0x51a2f8;return db[_0xd74b('0x10')][_0xd74b('0x11')]({'where':{'id':0x1},'attributes':[_0xd74b('0x12'),_0xd74b('0x13')],'raw':!![]})[_0xd74b('0x14')](function(_0x52d066){_0x9530a4=_0x52d066;return db['User'][_0xd74b('0x15')]({'where':{'email':_[_0xd74b('0x16')](_0x47dc90[_0xd74b('0x17')],_0xd74b('0x18')),'role':{'$or':[_0xd74b('0x19'),_0xd74b('0x1a'),_0xd74b('0x1b')]}}});})['then'](function(_0x23e3c3){_0x51a2f8=_0x23e3c3;if(_0x51a2f8){if(_0x51a2f8[_0xd74b('0x1c')]){return _0x4e4d12(_0xd74b('0x1d'));}else if(_0x9530a4['blockDuration']>0x0){if(_0x51a2f8[_0xd74b('0x1e')]){if(moment(_0x51a2f8[_0xd74b('0x1f')])[_0xd74b('0x20')](_0x9530a4['blockDuration'],_0xd74b('0x21'))>moment()){return _0x4e4d12(_0xd74b('0x1d'));}else{return utils['clearBlockUser'](_0x51a2f8,0x0,![],null)[_0xd74b('0x14')](function(){return utils[_0xd74b('0x22')](_0x51a2f8);})[_0xd74b('0x14')](function(){return _0x4e4d12(null,_0x51a2f8);});}}else{return utils[_0xd74b('0x22')](_0x51a2f8)[_0xd74b('0x14')](function(){return _0x4e4d12(null,_0x51a2f8);});}}else{return utils[_0xd74b('0x22')](_0x51a2f8)['then'](function(){return _0x4e4d12(null,_0x51a2f8);});}}return _0x4e4d12('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xd74b('0x23')](function(_0x6e280c){_0x4e4d12(_0x6e280c);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 69552f6..3d49cbf 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 _0x6f1a=['isMiddleware','login','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x13f9a9,_0x549e20){var _0x5753f5=function(_0xa71e52){while(--_0xa71e52){_0x13f9a9['push'](_0x13f9a9['shift']());}};_0x5753f5(++_0x549e20);}(_0x6f1a,0x14d));var _0xa6f1=function(_0x536c94,_0xd6aa36){_0x536c94=_0x536c94-0x0;var _0x5b1549=_0x6f1a[_0x536c94];return _0x5b1549;};'use strict';var express=require(_0xa6f1('0x0'));var passport=require(_0xa6f1('0x1'));var router=express[_0xa6f1('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xa6f1('0x3'));var authService=require(_0xa6f1('0x4'));router[_0xa6f1('0x5')]('/',controller['login']);router[_0xa6f1('0x5')](_0xa6f1('0x6'),controller['callback'],authService[_0xa6f1('0x7')],userController[_0xa6f1('0x8')],authService['setTokenCookie']);module[_0xa6f1('0x9')]=router; \ No newline at end of file +var _0xd24f=['Router','login','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x7b357d,_0x4837fc){var _0x5beed9=function(_0x1ac193){while(--_0x1ac193){_0x7b357d['push'](_0x7b357d['shift']());}};_0x5beed9(++_0x4837fc);}(_0xd24f,0x16e));var _0xfd24=function(_0x12c3d1,_0x3c6ae7){_0x12c3d1=_0x12c3d1-0x0;var _0x282840=_0xd24f[_0x12c3d1];return _0x282840;};'use strict';var express=require(_0xfd24('0x0'));var passport=require(_0xfd24('0x1'));var router=express[_0xfd24('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0xfd24('0x3')]);router['get']('/callback',controller[_0xfd24('0x4')],authService[_0xfd24('0x5')],userController[_0xfd24('0x3')],authService[_0xfd24('0x6')]);module[_0xfd24('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 57ad0a5..5e6bc4a 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 _0x67f8=['util','passport','passport-local','Strategy','lodash','randomstring','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockDuration','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','request','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','resetPasswordExpires','save','Password\x20reset!','use'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x67f8,0x105));var _0x867f=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x67f8[_0x68ee8b];return _0x5148f7;};'use strict';var util=require(_0x867f('0x0'));var passport=require(_0x867f('0x1'));var LocalStrategy=require(_0x867f('0x2'))[_0x867f('0x3')];var jayson=require('jayson/promise');var _=require(_0x867f('0x4'));var rs=require(_0x867f('0x5'));var moment=require('moment');var db=require(_0x867f('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x867f('0x7'));var client=jayson[_0x867f('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x547c7d,_0x19f2d9,_0x22c1d6,_0x2542d1){var _0x22d8a4,_0x200f44;return db[_0x867f('0x9')][_0x867f('0xa')]({'where':{'id':0x1},'attributes':[_0x867f('0xb'),'blockDuration'],'raw':!![]})[_0x867f('0xc')](function(_0x2e0c89){_0x22d8a4=_0x2e0c89;return _0x547c7d[_0x867f('0xa')]({'attributes':['id',_0x867f('0xd'),_0x867f('0xe'),'salt',_0x867f('0xf'),_0x867f('0x10'),_0x867f('0x11'),_0x867f('0x12'),'loginAttempts'],'where':{'name':_0x19f2d9,'role':{'$or':[_0x867f('0x13'),_0x867f('0x14'),_0x867f('0x15')]}}});})[_0x867f('0xc')](function(_0x4bb40d){if(!_0x4bb40d||_0x4bb40d&&_0x4bb40d[_0x867f('0xd')]!==_0x19f2d9){throw new Error(_0x867f('0x16'));}else{_0x200f44=_0x4bb40d;return _0x200f44;}})['then'](function(){_0x200f44[_0x867f('0x17')](_0x22c1d6,function(_0x9b9224,_0x3bc9c3){var _0x242b03=_0x200f44[_0x867f('0x18')]+0x1;if(_0x9b9224){return _0x2542d1(_0x9b9224);}else if(!_0x3bc9c3){if(_0x200f44[_0x867f('0x10')]){return _0x2542d1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x22d8a4[_0x867f('0xb')]>0x0){if(_0x200f44[_0x867f('0x11')]){if(_0x22d8a4[_0x867f('0x19')]>0x0){if(moment(_0x200f44[_0x867f('0x12')])['add'](_0x22d8a4[_0x867f('0x19')],_0x867f('0x1a'))>moment()){return _0x2542d1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x867f('0x1b')](_0x200f44,_0x242b03,![],null)[_0x867f('0xc')](function(){return _0x2542d1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2542d1(null,![],{'message':_0x867f('0x16')});}}else{if(_0x242b03>=_0x22d8a4[_0x867f('0xb')]){return utils[_0x867f('0x1b')](_0x200f44,0x0,!![],moment())[_0x867f('0xc')](function(){return _0x2542d1(null,![],{'message':_0x867f('0x16')});});}else{return utils[_0x867f('0x1b')](_0x200f44,_0x242b03,![],null)[_0x867f('0xc')](function(){return _0x2542d1(null,![],{'message':_0x867f('0x16')});});}}}else{return _0x2542d1(null,![],{'message':_0x867f('0x16')});}}else{if(_0x200f44[_0x867f('0x10')]){return _0x2542d1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x22d8a4[_0x867f('0xb')]>0x0){if(_0x200f44['blocked']){if(_0x22d8a4[_0x867f('0x19')]>0x0){if(moment(_0x200f44[_0x867f('0x12')])['add'](_0x22d8a4[_0x867f('0x19')],_0x867f('0x1a'))>moment()){return _0x2542d1(null,![],{'message':_0x867f('0x16')});}else{return utils[_0x867f('0x1b')](_0x200f44,0x0,![],null)[_0x867f('0xc')](function(){return utils[_0x867f('0x1c')](_0x200f44);})[_0x867f('0xc')](function(){return _0x2542d1(null,_0x200f44);});}}else{return _0x2542d1(null,![],{'message':_0x867f('0x16')});}}else{return utils['clearBlockUser'](_0x200f44,0x0,![],null)[_0x867f('0xc')](function(){return utils[_0x867f('0x1c')](_0x200f44);})[_0x867f('0xc')](function(){return _0x2542d1(null,_0x200f44);})[_0x867f('0x1d')](function(_0x3fd9d4){return _0x2542d1(null,![],_0x3fd9d4);});}}else{if(_0x200f44[_0x867f('0x11')]){return _0x2542d1(null,![],{'message':_0x867f('0x16')});}else{return utils[_0x867f('0x1c')](_0x200f44)[_0x867f('0xc')](function(){return _0x2542d1(null,_0x200f44);});}}}});})['catch'](function(_0x12b6ae){return _0x2542d1(null,![],_0x12b6ae);});}function sendServiceMail(_0x3ade44){return db[_0x867f('0x1e')][_0x867f('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x867f('0x20')],'include':[{'model':db[_0x867f('0x21')],'as':_0x867f('0x22')}]})[_0x867f('0xc')](function(_0x206ba8){if(!_0x206ba8){throw new Error(_0x867f('0x23'));}var _0x5927ea={'tls':{'rejectUnauthorized':![]}};if(_0x206ba8[_0x867f('0x22')][_0x867f('0x24')]){_0x5927ea[_0x867f('0x24')]=_0x206ba8['Smtp'][_0x867f('0x24')];}else{_0x5927ea[_0x867f('0x25')]=_0x206ba8[_0x867f('0x22')]['host'];_0x5927ea['port']=_0x206ba8['Smtp'][_0x867f('0x26')];_0x5927ea[_0x867f('0x27')]=_0x206ba8[_0x867f('0x22')][_0x867f('0x27')];}if(_0x206ba8[_0x867f('0x22')][_0x867f('0x28')]){_0x5927ea[_0x867f('0x29')]={'user':_0x206ba8[_0x867f('0x22')]['user'],'pass':_0x206ba8[_0x867f('0x22')]['pass']};}var _0x562fa8={'account':_0x5927ea,'message':_['merge']({'from':util[_0x867f('0x2a')](_0x867f('0x2b'),_0x206ba8[_0x867f('0xd')],_0x206ba8[_0x867f('0x20')]||_0x206ba8['Smtp'][_0x867f('0x14')])},_0x3ade44)};return client[_0x867f('0x2c')]('SendMail',_0x562fa8);})[_0x867f('0xc')](function(_0x4e115d){if(_0x4e115d['error']){throw new Error(util[_0x867f('0x2a')](_0x867f('0x2d'),_0x4e115d[_0x867f('0x2e')]['message']||JSON[_0x867f('0x2f')](_0x4e115d[_0x867f('0x2e')])));}return!![];});}function handleError(_0x3ab87b,_0x2a66a3,_0x5c1d68){return _0x3ab87b[_0x867f('0x30')](_0x2a66a3||0x1f4)[_0x867f('0x31')]({'message':_0x5c1d68?_0x5c1d68['message']||_0x5c1d68:''});}exports['login']=function(_0x5d287a,_0x4510d1,_0x4d7a5e){passport[_0x867f('0x17')](_0x867f('0x32'),function(_0x1f5f4d,_0x4ecc6b,_0x36cd63){var _0x534070=_0x1f5f4d||_0x36cd63;if(_0x534070){return handleError(_0x4510d1,0x191,_0x534070);}if(!_0x4ecc6b){return handleError(_0x4510d1,0x194,{'message':_0x867f('0x33')});}else{var _0x1efdb4={'payload':{'id':_0x4ecc6b['id'],'role':_0x4ecc6b['role']},'options':{'expiresIn':0x15180}};return authService[_0x867f('0x34')](_0x1efdb4)[_0x867f('0xc')](function(_0x8e4fef){_0x4510d1[_0x867f('0x35')]({'id':_0x4ecc6b['id'],'token':_0x8e4fef,'statusCall':'','isAlreadyLogged':_0x4ecc6b[_0x867f('0x36')]});});}})(_0x5d287a,_0x4510d1,_0x4d7a5e);};exports[_0x867f('0x37')]=function(_0x11ae4d,_0x560a8d,_0x11a586){if(!_0x11ae4d[_0x867f('0x38')]['email']){return handleError(_0x560a8d,0x1f4,{'message':_0x867f('0x39')});}var _0x33aa6e=rs[_0x867f('0x3a')]();_0x11ae4d[_0x867f('0x38')]['email']=_0x11ae4d[_0x867f('0x38')][_0x867f('0x20')][_0x867f('0x3b')]()['toLowerCase']();var _0x446cb9;return db[_0x867f('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x867f('0xb'),_0x867f('0x19')],'raw':!![]})['then'](function(_0x18c507){_0x446cb9=_0x18c507;return db[_0x867f('0x3c')]['find']({'where':{'email':_0x11ae4d[_0x867f('0x38')][_0x867f('0x20')]}});})[_0x867f('0xc')](function(_0x3bae44){if(!_0x3bae44){throw new Error(_0x867f('0x3d'));}if(_0x3bae44[_0x867f('0x10')]){throw new Error(_0x867f('0x3e'));}if(_0x3bae44[_0x867f('0x11')]){if(moment(_0x3bae44[_0x867f('0x12')])[_0x867f('0x3f')](_0x446cb9[_0x867f('0x19')],_0x867f('0x1a'))>moment()){throw new Error(_0x867f('0x40'));}else{_0x3bae44[_0x867f('0x11')]=![];_0x3bae44[_0x867f('0x12')]=null;}}_0x3bae44[_0x867f('0x41')]=_0x33aa6e;_0x3bae44['resetPasswordExpires']=Date[_0x867f('0x42')]()+0x36ee80;return _0x3bae44['save']();})[_0x867f('0xc')](function(){return sendServiceMail({'to':_0x11ae4d[_0x867f('0x38')][_0x867f('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x867f('0x43')+_0x867f('0x44')+_0x867f('0x45')+_0x11ae4d[_0x867f('0x46')]['host']+_0x867f('0x47')+_0x33aa6e+'\x0a\x0a'+_0x867f('0x48')});})[_0x867f('0xc')](function(){_0x560a8d[_0x867f('0x30')](0xc8)[_0x867f('0x31')]({'message':_0x867f('0x49')});})[_0x867f('0x1d')](function(_0x2717c9){return handleError(_0x560a8d,0x1f4,_0x2717c9);});};exports[_0x867f('0x4a')]=function(_0x63f330,_0x4bc288,_0x396d6a){return db[_0x867f('0x3c')][_0x867f('0x1f')]({'where':{'resetPasswordToken':_0x63f330['params'][_0x867f('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x867f('0x42')]()}}})[_0x867f('0xc')](function(_0x2f58f4){if(!_0x2f58f4){throw new Error(_0x867f('0x4c'));}return db[_0x867f('0x9')][_0x867f('0xa')]({'attributes':['id',_0x867f('0x4d'),'enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x21b466){if(_0x21b466[_0x867f('0x4d')])authService[_0x867f('0x4e')](_0x63f330['body'][_0x867f('0xe')]);if(!_0x21b466[_0x867f('0x4f')]||!_0x2f58f4['previousPasswords'])return _0x2f58f4;authService[_0x867f('0x50')](_0x63f330[_0x867f('0x38')][_0x867f('0xe')],_0x2f58f4[_0x867f('0x51')],_0x21b466[_0x867f('0x52')]);return _0x2f58f4;})[_0x867f('0xc')](function(){_0x2f58f4['password']=_0x63f330[_0x867f('0x38')][_0x867f('0xe')];_0x2f58f4[_0x867f('0x41')]=null;_0x2f58f4[_0x867f('0x53')]=null;return _0x2f58f4[_0x867f('0x54')]();});})[_0x867f('0xc')](function(){_0x4bc288['status'](0xc8)['send']({'message':_0x867f('0x55')});})[_0x867f('0x1d')](function(_0xdb3c93){return handleError(_0x4bc288,0x1f4,_0xdb3c93);});};passport[_0x867f('0x56')](new LocalStrategy({'usernameField':_0x867f('0xd'),'passwordField':_0x867f('0xe')},function(_0x4f7baf,_0x4d4345,_0x1854bd){return localAuthenticate(db[_0x867f('0x3c')],_0x4f7baf,_0x4d4345,_0x1854bd);})); \ No newline at end of file +var _0x04a8=['client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','format','email','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04a8,0x153));var _0x804a=function(_0x3e375c,_0x166f56){_0x3e375c=_0x3e375c-0x0;var _0xce96e3=_0x04a8[_0x3e375c];return _0xce96e3;};'use strict';var util=require(_0x804a('0x0'));var passport=require('passport');var LocalStrategy=require(_0x804a('0x1'))[_0x804a('0x2')];var jayson=require(_0x804a('0x3'));var _=require(_0x804a('0x4'));var rs=require('randomstring');var moment=require(_0x804a('0x5'));var db=require(_0x804a('0x6'))['db'];var authService=require(_0x804a('0x7'));var utils=require(_0x804a('0x8'));var client=jayson[_0x804a('0x9')][_0x804a('0xa')]({'port':0x232b});function localAuthenticate(_0x34189b,_0x5c35b6,_0x2f02c3,_0x5a12c1){var _0x3f470f,_0x1bd66a;return db[_0x804a('0xb')][_0x804a('0xc')]({'where':{'id':0x1},'attributes':[_0x804a('0xd'),_0x804a('0xe')],'raw':!![]})[_0x804a('0xf')](function(_0xd069f7){_0x3f470f=_0xd069f7;return _0x34189b[_0x804a('0xc')]({'attributes':['id',_0x804a('0x10'),_0x804a('0x11'),_0x804a('0x12'),'role',_0x804a('0x13'),_0x804a('0x14'),_0x804a('0x15'),_0x804a('0x16')],'where':{'name':_0x5c35b6,'role':{'$or':[_0x804a('0x17'),_0x804a('0x18'),_0x804a('0x19')]}}});})['then'](function(_0x2f2e37){if(!_0x2f2e37||_0x2f2e37&&_0x2f2e37[_0x804a('0x10')]!==_0x5c35b6){throw new Error(_0x804a('0x1a'));}else{_0x1bd66a=_0x2f2e37;return _0x1bd66a;}})[_0x804a('0xf')](function(){_0x1bd66a['authenticate'](_0x2f02c3,function(_0x42a555,_0x5170c2){var _0x5e8f6b=_0x1bd66a['loginAttempts']+0x1;if(_0x42a555){return _0x5a12c1(_0x42a555);}else if(!_0x5170c2){if(_0x1bd66a[_0x804a('0x13')]){return _0x5a12c1(null,![],{'message':_0x804a('0x1a')});}else if(_0x3f470f[_0x804a('0xd')]>0x0){if(_0x1bd66a['blocked']){if(_0x3f470f[_0x804a('0xe')]>0x0){if(moment(_0x1bd66a['blockedAt'])[_0x804a('0x1b')](_0x3f470f[_0x804a('0xe')],_0x804a('0x1c'))>moment()){return _0x5a12c1(null,![],{'message':_0x804a('0x1a')});}else{return utils[_0x804a('0x1d')](_0x1bd66a,_0x5e8f6b,![],null)[_0x804a('0xf')](function(){return _0x5a12c1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5a12c1(null,![],{'message':_0x804a('0x1a')});}}else{if(_0x5e8f6b>=_0x3f470f[_0x804a('0xd')]){return utils[_0x804a('0x1d')](_0x1bd66a,0x0,!![],moment())[_0x804a('0xf')](function(){return _0x5a12c1(null,![],{'message':_0x804a('0x1a')});});}else{return utils[_0x804a('0x1d')](_0x1bd66a,_0x5e8f6b,![],null)[_0x804a('0xf')](function(){return _0x5a12c1(null,![],{'message':_0x804a('0x1a')});});}}}else{return _0x5a12c1(null,![],{'message':_0x804a('0x1a')});}}else{if(_0x1bd66a[_0x804a('0x13')]){return _0x5a12c1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3f470f[_0x804a('0xd')]>0x0){if(_0x1bd66a[_0x804a('0x14')]){if(_0x3f470f['blockDuration']>0x0){if(moment(_0x1bd66a[_0x804a('0x15')])[_0x804a('0x1b')](_0x3f470f['blockDuration'],_0x804a('0x1c'))>moment()){return _0x5a12c1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x1bd66a,0x0,![],null)[_0x804a('0xf')](function(){return utils[_0x804a('0x1e')](_0x1bd66a);})[_0x804a('0xf')](function(){return _0x5a12c1(null,_0x1bd66a);});}}else{return _0x5a12c1(null,![],{'message':_0x804a('0x1a')});}}else{return utils['clearBlockUser'](_0x1bd66a,0x0,![],null)[_0x804a('0xf')](function(){return utils['getLicense'](_0x1bd66a);})[_0x804a('0xf')](function(){return _0x5a12c1(null,_0x1bd66a);})['catch'](function(_0x2862d5){return _0x5a12c1(null,![],_0x2862d5);});}}else{if(_0x1bd66a[_0x804a('0x14')]){return _0x5a12c1(null,![],{'message':_0x804a('0x1a')});}else{return utils[_0x804a('0x1e')](_0x1bd66a)[_0x804a('0xf')](function(){return _0x5a12c1(null,_0x1bd66a);});}}}});})[_0x804a('0x1f')](function(_0x291eb2){return _0x5a12c1(null,![],_0x291eb2);});}function sendServiceMail(_0xf823ec){return db[_0x804a('0x20')][_0x804a('0x21')]({'where':{'service':!![]},'attributes':['id',_0x804a('0x10'),'email'],'include':[{'model':db[_0x804a('0x22')],'as':'Smtp'}]})[_0x804a('0xf')](function(_0x1a02b9){if(!_0x1a02b9){throw new Error(_0x804a('0x23'));}var _0x4cc615={'tls':{'rejectUnauthorized':![]}};if(_0x1a02b9[_0x804a('0x24')]['service']){_0x4cc615[_0x804a('0x25')]=_0x1a02b9[_0x804a('0x24')]['service'];}else{_0x4cc615['host']=_0x1a02b9[_0x804a('0x24')][_0x804a('0x26')];_0x4cc615[_0x804a('0x27')]=_0x1a02b9[_0x804a('0x24')]['port'];_0x4cc615[_0x804a('0x28')]=_0x1a02b9['Smtp'][_0x804a('0x28')];}if(_0x1a02b9[_0x804a('0x24')][_0x804a('0x29')]){_0x4cc615[_0x804a('0x2a')]={'user':_0x1a02b9['Smtp']['user'],'pass':_0x1a02b9['Smtp'][_0x804a('0x2b')]};}var _0x3c942c={'account':_0x4cc615,'message':_['merge']({'from':util[_0x804a('0x2c')]('\x22%s\x22\x20<%s>',_0x1a02b9['name'],_0x1a02b9[_0x804a('0x2d')]||_0x1a02b9[_0x804a('0x24')][_0x804a('0x18')])},_0xf823ec)};return client['request'](_0x804a('0x2e'),_0x3c942c);})[_0x804a('0xf')](function(_0x1dcea8){if(_0x1dcea8[_0x804a('0x2f')]){throw new Error(util[_0x804a('0x2c')](_0x804a('0x30'),_0x1dcea8[_0x804a('0x2f')][_0x804a('0x31')]||JSON[_0x804a('0x32')](_0x1dcea8['error'])));}return!![];});}function handleError(_0x3ea1bc,_0x25995b,_0x58e94b){return _0x3ea1bc[_0x804a('0x33')](_0x25995b||0x1f4)[_0x804a('0x34')]({'message':_0x58e94b?_0x58e94b[_0x804a('0x31')]||_0x58e94b:''});}exports['login']=function(_0x6a123e,_0x528165,_0xab488f){passport[_0x804a('0x35')]('local',function(_0x33d2df,_0x314b88,_0x397721){var _0x599a1f=_0x33d2df||_0x397721;if(_0x599a1f){return handleError(_0x528165,0x191,_0x599a1f);}if(!_0x314b88){return handleError(_0x528165,0x194,{'message':_0x804a('0x36')});}else{var _0x210817={'payload':{'id':_0x314b88['id'],'role':_0x314b88[_0x804a('0x37')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x210817)[_0x804a('0xf')](function(_0xb6bc9e){_0x528165['json']({'id':_0x314b88['id'],'token':_0xb6bc9e,'statusCall':'','isAlreadyLogged':_0x314b88[_0x804a('0x38')]});});}})(_0x6a123e,_0x528165,_0xab488f);};exports[_0x804a('0x39')]=function(_0x2fec14,_0x420b41,_0xdccd79){if(!_0x2fec14['body'][_0x804a('0x2d')]){return handleError(_0x420b41,0x1f4,{'message':_0x804a('0x3a')});}var _0xd75d82=rs[_0x804a('0x3b')]();_0x2fec14['body']['email']=_0x2fec14[_0x804a('0x3c')]['email'][_0x804a('0x3d')]()[_0x804a('0x3e')]();var _0x1846f7;return db[_0x804a('0xb')][_0x804a('0xc')]({'where':{'id':0x1},'attributes':[_0x804a('0xd'),'blockDuration'],'raw':!![]})[_0x804a('0xf')](function(_0x5e3807){_0x1846f7=_0x5e3807;return db[_0x804a('0x3f')][_0x804a('0x21')]({'where':{'email':_0x2fec14['body']['email']}});})[_0x804a('0xf')](function(_0x24a921){if(!_0x24a921){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x24a921[_0x804a('0x13')]){throw new Error(_0x804a('0x40'));}if(_0x24a921['blocked']){if(moment(_0x24a921[_0x804a('0x15')])[_0x804a('0x1b')](_0x1846f7[_0x804a('0xe')],_0x804a('0x1c'))>moment()){throw new Error(_0x804a('0x41'));}else{_0x24a921[_0x804a('0x14')]=![];_0x24a921[_0x804a('0x15')]=null;}}_0x24a921[_0x804a('0x42')]=_0xd75d82;_0x24a921[_0x804a('0x43')]=Date[_0x804a('0x44')]()+0x36ee80;return _0x24a921[_0x804a('0x45')]();})[_0x804a('0xf')](function(){return sendServiceMail({'to':_0x2fec14[_0x804a('0x3c')]['email'],'subject':_0x804a('0x46'),'text':_0x804a('0x47')+_0x804a('0x48')+'https://'+_0x2fec14[_0x804a('0x49')]['host']+_0x804a('0x4a')+_0xd75d82+'\x0a\x0a'+_0x804a('0x4b')});})[_0x804a('0xf')](function(){_0x420b41[_0x804a('0x33')](0xc8)[_0x804a('0x34')]({'message':'Reset\x20Email\x20sent!'});})[_0x804a('0x1f')](function(_0x29cd81){return handleError(_0x420b41,0x1f4,_0x29cd81);});};exports[_0x804a('0x4c')]=function(_0x1a78f4,_0x26d709,_0x3b74d7){return db[_0x804a('0x3f')]['find']({'where':{'resetPasswordToken':_0x1a78f4[_0x804a('0x4d')][_0x804a('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x804a('0x44')]()}}})[_0x804a('0xf')](function(_0x28d135){if(!_0x28d135){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x804a('0xb')][_0x804a('0xc')]({'attributes':['id',_0x804a('0x4f'),_0x804a('0x50'),_0x804a('0x51')]})['then'](function(_0xc2ea4b){if(_0xc2ea4b['securePassword'])authService[_0x804a('0x52')](_0x1a78f4[_0x804a('0x3c')][_0x804a('0x11')]);if(!_0xc2ea4b[_0x804a('0x50')]||!_0x28d135[_0x804a('0x53')])return _0x28d135;authService[_0x804a('0x54')](_0x1a78f4['body'][_0x804a('0x11')],_0x28d135[_0x804a('0x53')],_0xc2ea4b[_0x804a('0x51')]);return _0x28d135;})['then'](function(){_0x28d135['password']=_0x1a78f4[_0x804a('0x3c')][_0x804a('0x11')];_0x28d135[_0x804a('0x42')]=null;_0x28d135[_0x804a('0x43')]=null;return _0x28d135[_0x804a('0x45')]();});})['then'](function(){_0x26d709['status'](0xc8)['send']({'message':_0x804a('0x55')});})[_0x804a('0x1f')](function(_0x42b7b9){return handleError(_0x26d709,0x1f4,_0x42b7b9);});};passport[_0x804a('0x56')](new LocalStrategy({'usernameField':_0x804a('0x10'),'passwordField':_0x804a('0x11')},function(_0x542d8c,_0x34db15,_0x52196c){return localAuthenticate(db['User'],_0x542d8c,_0x34db15,_0x52196c);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5aceda9..9f42679 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 _0xe2a0=['Router','./authLocal.controller','post','/forgot','forgot','/reset/:token','exports'];(function(_0x446a2a,_0x21892a){var _0x4e246d=function(_0x55d58b){while(--_0x55d58b){_0x446a2a['push'](_0x446a2a['shift']());}};_0x4e246d(++_0x21892a);}(_0xe2a0,0x13b));var _0x0e2a=function(_0x39d0dc,_0x542c56){_0x39d0dc=_0x39d0dc-0x0;var _0x3ce462=_0xe2a0[_0x39d0dc];return _0x3ce462;};'use strict';var express=require('express');var router=express[_0x0e2a('0x0')]();var controller=require(_0x0e2a('0x1'));router['post']('/',controller['login']);router[_0x0e2a('0x2')](_0x0e2a('0x3'),controller[_0x0e2a('0x4')]);router['post'](_0x0e2a('0x5'),controller['reset']);module[_0x0e2a('0x6')]=router; \ No newline at end of file +var _0xa132=['/forgot','forgot','/reset/:token','express','Router','./authLocal.controller','post','login'];(function(_0x28019c,_0x67743){var _0x48ca39=function(_0x4c161e){while(--_0x4c161e){_0x28019c['push'](_0x28019c['shift']());}};_0x48ca39(++_0x67743);}(_0xa132,0xeb));var _0x2a13=function(_0x3facf4,_0xa30b2e){_0x3facf4=_0x3facf4-0x0;var _0x2f4515=_0xa132[_0x3facf4];return _0x2f4515;};'use strict';var express=require(_0x2a13('0x0'));var router=express[_0x2a13('0x1')]();var controller=require(_0x2a13('0x2'));router[_0x2a13('0x3')]('/',controller[_0x2a13('0x4')]);router[_0x2a13('0x3')](_0x2a13('0x5'),controller[_0x2a13('0x6')]);router[_0x2a13('0x3')](_0x2a13('0x7'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 27346fa..a43a350 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 _0x8cef=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x5b97c8,_0x5952f2){var _0x52b034=function(_0x37e5d0){while(--_0x37e5d0){_0x5b97c8['push'](_0x5b97c8['shift']());}};_0x52b034(++_0x5952f2);}(_0x8cef,0x83));var _0xf8ce=function(_0x18e947,_0x4bf371){_0x18e947=_0x18e947-0x0;var _0x5bc507=_0x8cef[_0x18e947];return _0x5bc507;};'use strict';var Sequelize=require(_0xf8ce('0x0'));module[_0xf8ce('0x1')]={'name':{'type':Sequelize[_0xf8ce('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xf8ce('0x2')]},'description':{'type':Sequelize[_0xf8ce('0x2')]},'status':{'type':Sequelize[_0xf8ce('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf8ce('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xdce6=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xdce6,0xad));var _0x6dce=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdce6[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x6dce('0x0'));module[_0x6dce('0x1')]={'name':{'type':Sequelize[_0x6dce('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6dce('0x2')]},'status':{'type':Sequelize[_0x6dce('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6dce('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 060384c..d460ed4 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 _0xe80f=['fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Automation','includeAll','include','rows','catch','show','params','keys','length','create','update','body','find','addConditions','Condition','ids','omit','findOne','getConditions','addActions','Action','getActions','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xe80f,0x77));var _0xfe80=function(_0x1e6b00,_0xe959e8){_0x1e6b00=_0x1e6b00-0x0;var _0x2422fb=_0xe80f[_0x1e6b00];return _0x2422fb;};'use strict';var emlformat=require(_0xfe80('0x0'));var rimraf=require(_0xfe80('0x1'));var zipdir=require(_0xfe80('0x2'));var jsonpatch=require(_0xfe80('0x3'));var rp=require(_0xfe80('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe80('0x5'));var util=require(_0xfe80('0x6'));var path=require(_0xfe80('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfe80('0x8'));var fs=require('fs');var fs_extra=require(_0xfe80('0x9'));var _=require(_0xfe80('0xa'));var squel=require(_0xfe80('0xb'));var crypto=require(_0xfe80('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe80('0xd'));var querystring=require(_0xfe80('0xe'));var Papa=require('papaparse');var Redis=require(_0xfe80('0xf'));var authService=require(_0xfe80('0x10'));var qs=require(_0xfe80('0x11'));var as=require(_0xfe80('0x12'));var hardwareService=require(_0xfe80('0x13'));var logger=require(_0xfe80('0x14'))(_0xfe80('0x15'));var utils=require(_0xfe80('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfe80('0x17'));var db=require(_0xfe80('0x18'))['db'];function respondWithStatusCode(_0x5ad938,_0x39f36e){_0x39f36e=_0x39f36e||0xcc;return function(_0x3f0ac2){if(_0x3f0ac2){return _0x5ad938[_0xfe80('0x19')](_0x39f36e);}return _0x5ad938[_0xfe80('0x1a')](_0x39f36e)[_0xfe80('0x1b')]();};}function respondWithResult(_0x4b516b,_0x326632){_0x326632=_0x326632||0xc8;return function(_0xdd8bdb){if(_0xdd8bdb){return _0x4b516b['status'](_0x326632)[_0xfe80('0x1c')](_0xdd8bdb);}};}function respondWithFilteredResult(_0x2038ea,_0x350dfb){return function(_0x1e516c){if(_0x1e516c){var _0x59d7b0=typeof _0x350dfb['offset']==='undefined'&&typeof _0x350dfb[_0xfe80('0x1d')]===_0xfe80('0x1e');var _0x4abfd9=_0x1e516c[_0xfe80('0x1f')];var _0x56c139=_0x59d7b0?0x0:_0x350dfb[_0xfe80('0x20')];var _0x504ec7=_0x59d7b0?_0x1e516c[_0xfe80('0x1f')]:_0x350dfb[_0xfe80('0x20')]+_0x350dfb['limit'];var _0x197bbb;if(_0x504ec7>=_0x4abfd9){_0x504ec7=_0x4abfd9;_0x197bbb=0xc8;}else{_0x197bbb=0xce;}_0x2038ea[_0xfe80('0x1a')](_0x197bbb);return _0x2038ea[_0xfe80('0x21')](_0xfe80('0x22'),_0x56c139+'-'+_0x504ec7+'/'+_0x4abfd9)[_0xfe80('0x1c')](_0x1e516c);}return null;};}function patchUpdates(_0x208e69){return function(_0x4f71d4){try{jsonpatch[_0xfe80('0x23')](_0x4f71d4,_0x208e69,!![]);}catch(_0x534cff){return BPromise['reject'](_0x534cff);}return _0x4f71d4[_0xfe80('0x24')]();};}function saveUpdates(_0xb7a44f,_0x433ff1){return function(_0x30ae71){if(_0x30ae71){return _0x30ae71['update'](_0xb7a44f)[_0xfe80('0x25')](function(_0x21109a){return _0x21109a;});}return null;};}function removeEntity(_0x44529b,_0x43ef84){return function(_0x3f84b1){if(_0x3f84b1){return _0x3f84b1[_0xfe80('0x26')]()[_0xfe80('0x25')](function(){_0x44529b['status'](0xcc)[_0xfe80('0x1b')]();});}};}function handleEntityNotFound(_0xc9d666,_0x503d0c){return function(_0x9deb96){if(!_0x9deb96){_0xc9d666[_0xfe80('0x19')](0x194);}return _0x9deb96;};}function handleError(_0xf51789,_0x369f6d){_0x369f6d=_0x369f6d||0x1f4;return function(_0x1702b5){logger[_0xfe80('0x27')](_0x1702b5[_0xfe80('0x28')]);if(_0x1702b5[_0xfe80('0x29')]){delete _0x1702b5[_0xfe80('0x29')];}_0xf51789[_0xfe80('0x1a')](_0x369f6d)[_0xfe80('0x2a')](_0x1702b5);};}exports[_0xfe80('0x2b')]=function(_0x1b4d60,_0x59fbcd){var _0x15fd6d={},_0x521693={},_0x52718b={'count':0x0,'rows':[]};var _0x4b7ea6=_[_0xfe80('0x2c')](db['Automation'][_0xfe80('0x2d')],function(_0x132960){return{'name':_0x132960[_0xfe80('0x2e')],'type':_0x132960[_0xfe80('0x2f')]['key']};});_0x521693[_0xfe80('0x30')]=_['map'](_0x4b7ea6,'name');_0x521693[_0xfe80('0x31')]=_['keys'](_0x1b4d60[_0xfe80('0x31')]);_0x521693[_0xfe80('0x32')]=_[_0xfe80('0x33')](_0x521693[_0xfe80('0x30')],_0x521693[_0xfe80('0x31')]);_0x15fd6d[_0xfe80('0x34')]=_[_0xfe80('0x33')](_0x521693[_0xfe80('0x30')],qs[_0xfe80('0x35')](_0x1b4d60[_0xfe80('0x31')][_0xfe80('0x35')]));_0x15fd6d[_0xfe80('0x34')]=_0x15fd6d['attributes']['length']?_0x15fd6d[_0xfe80('0x34')]:_0x521693[_0xfe80('0x30')];if(!_0x1b4d60[_0xfe80('0x31')][_0xfe80('0x36')](_0xfe80('0x37'))){_0x15fd6d[_0xfe80('0x1d')]=qs[_0xfe80('0x1d')](_0x1b4d60[_0xfe80('0x31')][_0xfe80('0x1d')]);_0x15fd6d[_0xfe80('0x20')]=qs[_0xfe80('0x20')](_0x1b4d60[_0xfe80('0x31')]['offset']);}_0x15fd6d[_0xfe80('0x38')]=qs[_0xfe80('0x39')](_0x1b4d60[_0xfe80('0x31')]['sort']);_0x15fd6d[_0xfe80('0x3a')]=qs[_0xfe80('0x32')](_['pick'](_0x1b4d60[_0xfe80('0x31')],_0x521693['filters']),_0x4b7ea6);if(_0x1b4d60['query']['filter']){_0x15fd6d[_0xfe80('0x3a')]=_[_0xfe80('0x3b')](_0x15fd6d[_0xfe80('0x3a')],{'$or':_['map'](_0x4b7ea6,function(_0x557544){if(_0x557544[_0xfe80('0x2f')]!==_0xfe80('0x3c')){var _0x1cf6eb={};_0x1cf6eb[_0x557544[_0xfe80('0x29')]]={'$like':'%'+_0x1b4d60['query'][_0xfe80('0x3d')]+'%'};return _0x1cf6eb;}})});}_0x15fd6d=_[_0xfe80('0x3b')]({},_0x15fd6d,_0x1b4d60[_0xfe80('0x3e')]);var _0x415b30={'where':_0x15fd6d[_0xfe80('0x3a')]};return db[_0xfe80('0x3f')][_0xfe80('0x1f')](_0x415b30)[_0xfe80('0x25')](function(_0x2ad277){_0x52718b[_0xfe80('0x1f')]=_0x2ad277;if(_0x1b4d60[_0xfe80('0x31')][_0xfe80('0x40')]){_0x15fd6d[_0xfe80('0x41')]=[{'all':!![]}];}return db[_0xfe80('0x3f')]['findAll'](_0x15fd6d);})[_0xfe80('0x25')](function(_0x190822){_0x52718b[_0xfe80('0x42')]=_0x190822;return _0x52718b;})[_0xfe80('0x25')](respondWithFilteredResult(_0x59fbcd,_0x15fd6d))[_0xfe80('0x43')](handleError(_0x59fbcd,null));};exports[_0xfe80('0x44')]=function(_0x5ef026,_0x2fe6ff){var _0x296e95={'raw':![],'where':{'id':_0x5ef026[_0xfe80('0x45')]['id']}},_0x3c1801={};_0x3c1801[_0xfe80('0x30')]=_[_0xfe80('0x46')](db['Automation'][_0xfe80('0x2d')]);_0x3c1801[_0xfe80('0x31')]=_[_0xfe80('0x46')](_0x5ef026[_0xfe80('0x31')]);_0x3c1801[_0xfe80('0x32')]=_[_0xfe80('0x33')](_0x3c1801[_0xfe80('0x30')],_0x3c1801[_0xfe80('0x31')]);_0x296e95['attributes']=_['intersection'](_0x3c1801[_0xfe80('0x30')],qs[_0xfe80('0x35')](_0x5ef026['query']['fields']));_0x296e95['attributes']=_0x296e95['attributes'][_0xfe80('0x47')]?_0x296e95[_0xfe80('0x34')]:_0x3c1801[_0xfe80('0x30')];if(_0x5ef026[_0xfe80('0x31')][_0xfe80('0x40')]){_0x296e95['include']=[{'all':!![]}];}_0x296e95=_[_0xfe80('0x3b')]({},_0x296e95,_0x5ef026[_0xfe80('0x3e')]);return db['Automation']['find'](_0x296e95)['then'](handleEntityNotFound(_0x2fe6ff,null))['then'](respondWithResult(_0x2fe6ff,null))[_0xfe80('0x43')](handleError(_0x2fe6ff,null));};exports[_0xfe80('0x48')]=function(_0x507f2a,_0x446d6b){return db[_0xfe80('0x3f')]['create'](_0x507f2a['body'],{})[_0xfe80('0x25')](respondWithResult(_0x446d6b,0xc9))[_0xfe80('0x43')](handleError(_0x446d6b,null));};exports[_0xfe80('0x49')]=function(_0x10c7fb,_0x3195cb){if(_0x10c7fb[_0xfe80('0x4a')]['id']){delete _0x10c7fb[_0xfe80('0x4a')]['id'];}return db[_0xfe80('0x3f')][_0xfe80('0x4b')]({'where':{'id':_0x10c7fb[_0xfe80('0x45')]['id']}})[_0xfe80('0x25')](handleEntityNotFound(_0x3195cb,null))[_0xfe80('0x25')](saveUpdates(_0x10c7fb[_0xfe80('0x4a')],null))[_0xfe80('0x25')](respondWithResult(_0x3195cb,null))[_0xfe80('0x43')](handleError(_0x3195cb,null));};exports[_0xfe80('0x26')]=function(_0x239ad7,_0x5d90fa){return db['Automation'][_0xfe80('0x4b')]({'where':{'id':_0x239ad7[_0xfe80('0x45')]['id']}})[_0xfe80('0x25')](handleEntityNotFound(_0x5d90fa,null))['then'](removeEntity(_0x5d90fa,null))[_0xfe80('0x43')](handleError(_0x5d90fa,null));};exports[_0xfe80('0x4c')]=function(_0x653c7a,_0x32f050,_0x1dd0b0){return db[_0xfe80('0x4d')][_0xfe80('0x4b')]({'where':{'id':_0x653c7a[_0xfe80('0x45')]['id']}})[_0xfe80('0x25')](handleEntityNotFound(_0x32f050,null))[_0xfe80('0x25')](function(_0x336eac){if(_0x336eac){return _0x336eac[_0xfe80('0x4c')](_0x653c7a['body'][_0xfe80('0x4e')],_[_0xfe80('0x4f')](_0x653c7a[_0xfe80('0x4a')],[_0xfe80('0x4e'),'id'])||{});}})[_0xfe80('0x25')](respondWithResult(_0x32f050,null))['catch'](handleError(_0x32f050,null));};exports['getConditions']=function(_0xec3ef0,_0x391034,_0x4879ca){var _0x5926d3={};var _0x33e00c={};var _0x38757c;var _0x32eb71;return db[_0xfe80('0x3f')][_0xfe80('0x50')]({'where':{'id':_0xec3ef0['params']['id']}})[_0xfe80('0x25')](handleEntityNotFound(_0x391034,null))[_0xfe80('0x25')](function(_0x12f855){if(_0x12f855){_0x38757c=_0x12f855;_0x33e00c[_0xfe80('0x30')]=_[_0xfe80('0x46')](db[_0xfe80('0x4d')][_0xfe80('0x2d')]);_0x33e00c['query']=_[_0xfe80('0x46')](_0xec3ef0[_0xfe80('0x31')]);_0x33e00c['filters']=_[_0xfe80('0x33')](_0x33e00c[_0xfe80('0x30')],_0x33e00c[_0xfe80('0x31')]);_0x5926d3[_0xfe80('0x34')]=_[_0xfe80('0x33')](_0x33e00c['model'],qs[_0xfe80('0x35')](_0xec3ef0[_0xfe80('0x31')][_0xfe80('0x35')]));_0x5926d3[_0xfe80('0x34')]=_0x5926d3[_0xfe80('0x34')][_0xfe80('0x47')]?_0x5926d3[_0xfe80('0x34')]:_0x33e00c['model'];_0x5926d3[_0xfe80('0x38')]=qs[_0xfe80('0x39')](_0xec3ef0['query'][_0xfe80('0x39')]);_0x5926d3[_0xfe80('0x3a')]=qs[_0xfe80('0x32')](_['pick'](_0xec3ef0[_0xfe80('0x31')],_0x33e00c['filters']));if(_0xec3ef0[_0xfe80('0x31')]['filter']){_0x5926d3[_0xfe80('0x3a')]=_[_0xfe80('0x3b')](_0x5926d3[_0xfe80('0x3a')],{'$or':_[_0xfe80('0x2c')](_0x5926d3[_0xfe80('0x34')],function(_0x2c7e92){var _0x1c2152={};_0x1c2152[_0x2c7e92]={'$like':'%'+_0xec3ef0[_0xfe80('0x31')][_0xfe80('0x3d')]+'%'};return _0x1c2152;})});}_0x5926d3=_[_0xfe80('0x3b')]({},_0x5926d3,_0xec3ef0[_0xfe80('0x3e')]);return _0x38757c['getConditions'](_0x5926d3);}})['then'](function(_0x1f83a3){if(_0x1f83a3){_0x32eb71=_0x1f83a3['length'];if(!_0xec3ef0[_0xfe80('0x31')][_0xfe80('0x36')](_0xfe80('0x37'))){_0x5926d3[_0xfe80('0x1d')]=qs[_0xfe80('0x1d')](_0xec3ef0['query']['limit']);_0x5926d3['offset']=qs[_0xfe80('0x20')](_0xec3ef0[_0xfe80('0x31')][_0xfe80('0x20')]);}return _0x38757c[_0xfe80('0x51')](_0x5926d3);}})['then'](function(_0xb5e0c7){if(_0xb5e0c7){return _0xb5e0c7?{'count':_0x32eb71,'rows':_0xb5e0c7}:null;}})[_0xfe80('0x25')](respondWithResult(_0x391034,null))[_0xfe80('0x43')](handleError(_0x391034,null));};exports[_0xfe80('0x52')]=function(_0x37c3dd,_0x5deee1,_0xaed81){return db[_0xfe80('0x53')][_0xfe80('0x4b')]({'where':{'id':_0x37c3dd[_0xfe80('0x45')]['id']}})[_0xfe80('0x25')](handleEntityNotFound(_0x5deee1,null))[_0xfe80('0x25')](function(_0x28786c){if(_0x28786c){return _0x28786c[_0xfe80('0x52')](_0x37c3dd[_0xfe80('0x4a')][_0xfe80('0x4e')],_[_0xfe80('0x4f')](_0x37c3dd[_0xfe80('0x4a')],['ids','id'])||{});}})[_0xfe80('0x25')](respondWithResult(_0x5deee1,null))[_0xfe80('0x43')](handleError(_0x5deee1,null));};exports[_0xfe80('0x54')]=function(_0x32270d,_0x286a06,_0x2dbb70){var _0x526b96={};var _0x1558a7={};var _0x652d29;var _0x3e6f4c;return db[_0xfe80('0x3f')][_0xfe80('0x50')]({'where':{'id':_0x32270d[_0xfe80('0x45')]['id']}})[_0xfe80('0x25')](handleEntityNotFound(_0x286a06,null))['then'](function(_0x5c709a){if(_0x5c709a){_0x652d29=_0x5c709a;_0x1558a7[_0xfe80('0x30')]=_['keys'](db['Action'][_0xfe80('0x2d')]);_0x1558a7[_0xfe80('0x31')]=_[_0xfe80('0x46')](_0x32270d[_0xfe80('0x31')]);_0x1558a7['filters']=_[_0xfe80('0x33')](_0x1558a7[_0xfe80('0x30')],_0x1558a7[_0xfe80('0x31')]);_0x526b96[_0xfe80('0x34')]=_[_0xfe80('0x33')](_0x1558a7[_0xfe80('0x30')],qs['fields'](_0x32270d[_0xfe80('0x31')][_0xfe80('0x35')]));_0x526b96[_0xfe80('0x34')]=_0x526b96[_0xfe80('0x34')][_0xfe80('0x47')]?_0x526b96['attributes']:_0x1558a7['model'];_0x526b96[_0xfe80('0x38')]=qs[_0xfe80('0x39')](_0x32270d[_0xfe80('0x31')][_0xfe80('0x39')]);_0x526b96[_0xfe80('0x3a')]=qs[_0xfe80('0x32')](_[_0xfe80('0x55')](_0x32270d[_0xfe80('0x31')],_0x1558a7['filters']));if(_0x32270d[_0xfe80('0x31')][_0xfe80('0x3d')]){_0x526b96[_0xfe80('0x3a')]=_[_0xfe80('0x3b')](_0x526b96[_0xfe80('0x3a')],{'$or':_[_0xfe80('0x2c')](_0x526b96[_0xfe80('0x34')],function(_0x312bb1){var _0x180e00={};_0x180e00[_0x312bb1]={'$like':'%'+_0x32270d['query'][_0xfe80('0x3d')]+'%'};return _0x180e00;})});}_0x526b96=_[_0xfe80('0x3b')]({},_0x526b96,_0x32270d[_0xfe80('0x3e')]);return _0x652d29[_0xfe80('0x54')](_0x526b96);}})[_0xfe80('0x25')](function(_0x5f41a3){if(_0x5f41a3){_0x3e6f4c=_0x5f41a3[_0xfe80('0x47')];if(!_0x32270d[_0xfe80('0x31')][_0xfe80('0x36')](_0xfe80('0x37'))){_0x526b96[_0xfe80('0x1d')]=qs[_0xfe80('0x1d')](_0x32270d[_0xfe80('0x31')][_0xfe80('0x1d')]);_0x526b96[_0xfe80('0x20')]=qs[_0xfe80('0x20')](_0x32270d[_0xfe80('0x31')][_0xfe80('0x20')]);}return _0x652d29[_0xfe80('0x54')](_0x526b96);}})[_0xfe80('0x25')](function(_0x39573f){if(_0x39573f){return _0x39573f?{'count':_0x3e6f4c,'rows':_0x39573f}:null;}})[_0xfe80('0x25')](respondWithResult(_0x286a06,null))['catch'](handleError(_0x286a06,null));}; \ No newline at end of file +var _0xb34b=['catch','show','keys','includeAll','options','create','update','body','find','params','Condition','ids','omit','findOne','order','getConditions','addActions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','name','send','index','map','Automation','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb34b,0x162));var _0xbb34=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb34b[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xbb34('0x0'));var rimraf=require(_0xbb34('0x1'));var zipdir=require(_0xbb34('0x2'));var jsonpatch=require(_0xbb34('0x3'));var rp=require(_0xbb34('0x4'));var moment=require(_0xbb34('0x5'));var BPromise=require(_0xbb34('0x6'));var Mustache=require(_0xbb34('0x7'));var util=require('util');var path=require(_0xbb34('0x8'));var sox=require(_0xbb34('0x9'));var csv=require(_0xbb34('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb34('0xb'));var squel=require(_0xbb34('0xc'));var crypto=require(_0xbb34('0xd'));var jsforce=require(_0xbb34('0xe'));var deskjs=require(_0xbb34('0xf'));var toCsv=require(_0xbb34('0xa'));var querystring=require(_0xbb34('0x10'));var Papa=require(_0xbb34('0x11'));var Redis=require(_0xbb34('0x12'));var authService=require(_0xbb34('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbb34('0x14'));var hardwareService=require(_0xbb34('0x15'));var logger=require('../../config/logger')(_0xbb34('0x16'));var utils=require(_0xbb34('0x17'));var config=require(_0xbb34('0x18'));var licenseUtil=require(_0xbb34('0x19'));var db=require(_0xbb34('0x1a'))['db'];function respondWithStatusCode(_0xa12904,_0x23ef75){_0x23ef75=_0x23ef75||0xcc;return function(_0xb88717){if(_0xb88717){return _0xa12904[_0xbb34('0x1b')](_0x23ef75);}return _0xa12904[_0xbb34('0x1c')](_0x23ef75)[_0xbb34('0x1d')]();};}function respondWithResult(_0x49fe8c,_0x491e2b){_0x491e2b=_0x491e2b||0xc8;return function(_0x3c15fc){if(_0x3c15fc){return _0x49fe8c[_0xbb34('0x1c')](_0x491e2b)[_0xbb34('0x1e')](_0x3c15fc);}};}function respondWithFilteredResult(_0x108af5,_0xa3c4a3){return function(_0x5c2111){if(_0x5c2111){var _0x536671=typeof _0xa3c4a3['offset']===_0xbb34('0x1f')&&typeof _0xa3c4a3[_0xbb34('0x20')]===_0xbb34('0x1f');var _0x181ce=_0x5c2111[_0xbb34('0x21')];var _0x902cbd=_0x536671?0x0:_0xa3c4a3[_0xbb34('0x22')];var _0x3c8b6f=_0x536671?_0x5c2111['count']:_0xa3c4a3[_0xbb34('0x22')]+_0xa3c4a3['limit'];var _0x53ec99;if(_0x3c8b6f>=_0x181ce){_0x3c8b6f=_0x181ce;_0x53ec99=0xc8;}else{_0x53ec99=0xce;}_0x108af5[_0xbb34('0x1c')](_0x53ec99);return _0x108af5[_0xbb34('0x23')](_0xbb34('0x24'),_0x902cbd+'-'+_0x3c8b6f+'/'+_0x181ce)[_0xbb34('0x1e')](_0x5c2111);}return null;};}function patchUpdates(_0x39731d){return function(_0x4ac2e9){try{jsonpatch[_0xbb34('0x25')](_0x4ac2e9,_0x39731d,!![]);}catch(_0x44ba39){return BPromise[_0xbb34('0x26')](_0x44ba39);}return _0x4ac2e9['save']();};}function saveUpdates(_0x4fcea2,_0x2d67b6){return function(_0x2ab214){if(_0x2ab214){return _0x2ab214['update'](_0x4fcea2)[_0xbb34('0x27')](function(_0x3c337b){return _0x3c337b;});}return null;};}function removeEntity(_0x43bcb3,_0x39be0c){return function(_0x63330f){if(_0x63330f){return _0x63330f[_0xbb34('0x28')]()[_0xbb34('0x27')](function(){_0x43bcb3['status'](0xcc)[_0xbb34('0x1d')]();});}};}function handleEntityNotFound(_0x365711,_0x2a5124){return function(_0x1c74dc){if(!_0x1c74dc){_0x365711[_0xbb34('0x1b')](0x194);}return _0x1c74dc;};}function handleError(_0x59d49b,_0x49a9cb){_0x49a9cb=_0x49a9cb||0x1f4;return function(_0x168cff){logger['error'](_0x168cff['stack']);if(_0x168cff[_0xbb34('0x29')]){delete _0x168cff['name'];}_0x59d49b[_0xbb34('0x1c')](_0x49a9cb)[_0xbb34('0x2a')](_0x168cff);};}exports[_0xbb34('0x2b')]=function(_0x3b4e9b,_0x439995){var _0x57d074={},_0x1d7830={},_0x28898c={'count':0x0,'rows':[]};var _0x2eeea5=_[_0xbb34('0x2c')](db[_0xbb34('0x2d')][_0xbb34('0x2e')],function(_0x3ee455){return{'name':_0x3ee455['fieldName'],'type':_0x3ee455[_0xbb34('0x2f')][_0xbb34('0x30')]};});_0x1d7830['model']=_[_0xbb34('0x2c')](_0x2eeea5,_0xbb34('0x29'));_0x1d7830[_0xbb34('0x31')]=_['keys'](_0x3b4e9b[_0xbb34('0x31')]);_0x1d7830[_0xbb34('0x32')]=_[_0xbb34('0x33')](_0x1d7830[_0xbb34('0x34')],_0x1d7830[_0xbb34('0x31')]);_0x57d074[_0xbb34('0x35')]=_['intersection'](_0x1d7830['model'],qs[_0xbb34('0x36')](_0x3b4e9b['query']['fields']));_0x57d074['attributes']=_0x57d074[_0xbb34('0x35')][_0xbb34('0x37')]?_0x57d074[_0xbb34('0x35')]:_0x1d7830['model'];if(!_0x3b4e9b[_0xbb34('0x31')][_0xbb34('0x38')](_0xbb34('0x39'))){_0x57d074[_0xbb34('0x20')]=qs[_0xbb34('0x20')](_0x3b4e9b[_0xbb34('0x31')][_0xbb34('0x20')]);_0x57d074[_0xbb34('0x22')]=qs['offset'](_0x3b4e9b[_0xbb34('0x31')][_0xbb34('0x22')]);}_0x57d074['order']=qs['sort'](_0x3b4e9b['query'][_0xbb34('0x3a')]);_0x57d074[_0xbb34('0x3b')]=qs[_0xbb34('0x32')](_[_0xbb34('0x3c')](_0x3b4e9b['query'],_0x1d7830[_0xbb34('0x32')]),_0x2eeea5);if(_0x3b4e9b[_0xbb34('0x31')][_0xbb34('0x3d')]){_0x57d074['where']=_['merge'](_0x57d074[_0xbb34('0x3b')],{'$or':_[_0xbb34('0x2c')](_0x2eeea5,function(_0x4976a2){if(_0x4976a2[_0xbb34('0x2f')]!==_0xbb34('0x3e')){var _0x294525={};_0x294525[_0x4976a2[_0xbb34('0x29')]]={'$like':'%'+_0x3b4e9b[_0xbb34('0x31')]['filter']+'%'};return _0x294525;}})});}_0x57d074=_[_0xbb34('0x3f')]({},_0x57d074,_0x3b4e9b['options']);var _0x104310={'where':_0x57d074[_0xbb34('0x3b')]};return db[_0xbb34('0x2d')]['count'](_0x104310)[_0xbb34('0x27')](function(_0x219bb2){_0x28898c['count']=_0x219bb2;if(_0x3b4e9b[_0xbb34('0x31')]['includeAll']){_0x57d074[_0xbb34('0x40')]=[{'all':!![]}];}return db[_0xbb34('0x2d')][_0xbb34('0x41')](_0x57d074);})[_0xbb34('0x27')](function(_0x445bdf){_0x28898c['rows']=_0x445bdf;return _0x28898c;})['then'](respondWithFilteredResult(_0x439995,_0x57d074))[_0xbb34('0x42')](handleError(_0x439995,null));};exports[_0xbb34('0x43')]=function(_0x95ff58,_0x5ddbda){var _0x8e5575={'raw':![],'where':{'id':_0x95ff58['params']['id']}},_0x3a8646={};_0x3a8646[_0xbb34('0x34')]=_[_0xbb34('0x44')](db['Automation'][_0xbb34('0x2e')]);_0x3a8646[_0xbb34('0x31')]=_[_0xbb34('0x44')](_0x95ff58['query']);_0x3a8646[_0xbb34('0x32')]=_[_0xbb34('0x33')](_0x3a8646['model'],_0x3a8646[_0xbb34('0x31')]);_0x8e5575[_0xbb34('0x35')]=_['intersection'](_0x3a8646[_0xbb34('0x34')],qs[_0xbb34('0x36')](_0x95ff58[_0xbb34('0x31')][_0xbb34('0x36')]));_0x8e5575[_0xbb34('0x35')]=_0x8e5575['attributes'][_0xbb34('0x37')]?_0x8e5575[_0xbb34('0x35')]:_0x3a8646[_0xbb34('0x34')];if(_0x95ff58['query'][_0xbb34('0x45')]){_0x8e5575[_0xbb34('0x40')]=[{'all':!![]}];}_0x8e5575=_['merge']({},_0x8e5575,_0x95ff58[_0xbb34('0x46')]);return db[_0xbb34('0x2d')]['find'](_0x8e5575)[_0xbb34('0x27')](handleEntityNotFound(_0x5ddbda,null))[_0xbb34('0x27')](respondWithResult(_0x5ddbda,null))[_0xbb34('0x42')](handleError(_0x5ddbda,null));};exports['create']=function(_0x363639,_0x5b374c){return db[_0xbb34('0x2d')][_0xbb34('0x47')](_0x363639['body'],{})[_0xbb34('0x27')](respondWithResult(_0x5b374c,0xc9))[_0xbb34('0x42')](handleError(_0x5b374c,null));};exports[_0xbb34('0x48')]=function(_0x226fb1,_0x23d4ad){if(_0x226fb1[_0xbb34('0x49')]['id']){delete _0x226fb1[_0xbb34('0x49')]['id'];}return db[_0xbb34('0x2d')][_0xbb34('0x4a')]({'where':{'id':_0x226fb1[_0xbb34('0x4b')]['id']}})[_0xbb34('0x27')](handleEntityNotFound(_0x23d4ad,null))[_0xbb34('0x27')](saveUpdates(_0x226fb1[_0xbb34('0x49')],null))['then'](respondWithResult(_0x23d4ad,null))['catch'](handleError(_0x23d4ad,null));};exports[_0xbb34('0x28')]=function(_0x4319ef,_0x42fbba){return db[_0xbb34('0x2d')][_0xbb34('0x4a')]({'where':{'id':_0x4319ef[_0xbb34('0x4b')]['id']}})[_0xbb34('0x27')](handleEntityNotFound(_0x42fbba,null))[_0xbb34('0x27')](removeEntity(_0x42fbba,null))[_0xbb34('0x42')](handleError(_0x42fbba,null));};exports['addConditions']=function(_0x7976a6,_0x2fc396,_0x16023e){return db[_0xbb34('0x4c')][_0xbb34('0x4a')]({'where':{'id':_0x7976a6[_0xbb34('0x4b')]['id']}})[_0xbb34('0x27')](handleEntityNotFound(_0x2fc396,null))[_0xbb34('0x27')](function(_0x3a8c2d){if(_0x3a8c2d){return _0x3a8c2d['addConditions'](_0x7976a6[_0xbb34('0x49')][_0xbb34('0x4d')],_[_0xbb34('0x4e')](_0x7976a6[_0xbb34('0x49')],[_0xbb34('0x4d'),'id'])||{});}})[_0xbb34('0x27')](respondWithResult(_0x2fc396,null))['catch'](handleError(_0x2fc396,null));};exports['getConditions']=function(_0x590c82,_0x49e1cc,_0x430f4a){var _0x2241e9={};var _0x3891cf={};var _0x3ed8ea;var _0x5979c5;return db[_0xbb34('0x2d')][_0xbb34('0x4f')]({'where':{'id':_0x590c82[_0xbb34('0x4b')]['id']}})[_0xbb34('0x27')](handleEntityNotFound(_0x49e1cc,null))[_0xbb34('0x27')](function(_0x213c71){if(_0x213c71){_0x3ed8ea=_0x213c71;_0x3891cf[_0xbb34('0x34')]=_[_0xbb34('0x44')](db[_0xbb34('0x4c')][_0xbb34('0x2e')]);_0x3891cf[_0xbb34('0x31')]=_[_0xbb34('0x44')](_0x590c82[_0xbb34('0x31')]);_0x3891cf['filters']=_[_0xbb34('0x33')](_0x3891cf[_0xbb34('0x34')],_0x3891cf[_0xbb34('0x31')]);_0x2241e9[_0xbb34('0x35')]=_[_0xbb34('0x33')](_0x3891cf[_0xbb34('0x34')],qs[_0xbb34('0x36')](_0x590c82[_0xbb34('0x31')][_0xbb34('0x36')]));_0x2241e9[_0xbb34('0x35')]=_0x2241e9['attributes'][_0xbb34('0x37')]?_0x2241e9[_0xbb34('0x35')]:_0x3891cf[_0xbb34('0x34')];_0x2241e9[_0xbb34('0x50')]=qs['sort'](_0x590c82[_0xbb34('0x31')]['sort']);_0x2241e9[_0xbb34('0x3b')]=qs[_0xbb34('0x32')](_[_0xbb34('0x3c')](_0x590c82[_0xbb34('0x31')],_0x3891cf['filters']));if(_0x590c82['query'][_0xbb34('0x3d')]){_0x2241e9[_0xbb34('0x3b')]=_[_0xbb34('0x3f')](_0x2241e9[_0xbb34('0x3b')],{'$or':_[_0xbb34('0x2c')](_0x2241e9['attributes'],function(_0x496d5e){var _0x589523={};_0x589523[_0x496d5e]={'$like':'%'+_0x590c82[_0xbb34('0x31')][_0xbb34('0x3d')]+'%'};return _0x589523;})});}_0x2241e9=_[_0xbb34('0x3f')]({},_0x2241e9,_0x590c82[_0xbb34('0x46')]);return _0x3ed8ea[_0xbb34('0x51')](_0x2241e9);}})[_0xbb34('0x27')](function(_0x1fe6b2){if(_0x1fe6b2){_0x5979c5=_0x1fe6b2[_0xbb34('0x37')];if(!_0x590c82[_0xbb34('0x31')][_0xbb34('0x38')](_0xbb34('0x39'))){_0x2241e9['limit']=qs[_0xbb34('0x20')](_0x590c82[_0xbb34('0x31')][_0xbb34('0x20')]);_0x2241e9[_0xbb34('0x22')]=qs[_0xbb34('0x22')](_0x590c82[_0xbb34('0x31')][_0xbb34('0x22')]);}return _0x3ed8ea[_0xbb34('0x51')](_0x2241e9);}})[_0xbb34('0x27')](function(_0x59a575){if(_0x59a575){return _0x59a575?{'count':_0x5979c5,'rows':_0x59a575}:null;}})[_0xbb34('0x27')](respondWithResult(_0x49e1cc,null))[_0xbb34('0x42')](handleError(_0x49e1cc,null));};exports[_0xbb34('0x52')]=function(_0xdd1a2f,_0x70f2c7,_0x2e4bae){return db['Action'][_0xbb34('0x4a')]({'where':{'id':_0xdd1a2f[_0xbb34('0x4b')]['id']}})[_0xbb34('0x27')](handleEntityNotFound(_0x70f2c7,null))[_0xbb34('0x27')](function(_0x58cfd8){if(_0x58cfd8){return _0x58cfd8[_0xbb34('0x52')](_0xdd1a2f[_0xbb34('0x49')][_0xbb34('0x4d')],_[_0xbb34('0x4e')](_0xdd1a2f['body'],[_0xbb34('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x70f2c7,null))[_0xbb34('0x42')](handleError(_0x70f2c7,null));};exports[_0xbb34('0x53')]=function(_0x1e0269,_0x409cdb,_0x1bee10){var _0x5e1ebd={};var _0x17964c={};var _0x3a3bd0;var _0x5284c2;return db[_0xbb34('0x2d')]['findOne']({'where':{'id':_0x1e0269[_0xbb34('0x4b')]['id']}})[_0xbb34('0x27')](handleEntityNotFound(_0x409cdb,null))[_0xbb34('0x27')](function(_0x345969){if(_0x345969){_0x3a3bd0=_0x345969;_0x17964c[_0xbb34('0x34')]=_[_0xbb34('0x44')](db['Action'][_0xbb34('0x2e')]);_0x17964c[_0xbb34('0x31')]=_[_0xbb34('0x44')](_0x1e0269[_0xbb34('0x31')]);_0x17964c[_0xbb34('0x32')]=_[_0xbb34('0x33')](_0x17964c['model'],_0x17964c[_0xbb34('0x31')]);_0x5e1ebd[_0xbb34('0x35')]=_[_0xbb34('0x33')](_0x17964c[_0xbb34('0x34')],qs[_0xbb34('0x36')](_0x1e0269['query']['fields']));_0x5e1ebd[_0xbb34('0x35')]=_0x5e1ebd[_0xbb34('0x35')][_0xbb34('0x37')]?_0x5e1ebd[_0xbb34('0x35')]:_0x17964c['model'];_0x5e1ebd['order']=qs[_0xbb34('0x3a')](_0x1e0269['query'][_0xbb34('0x3a')]);_0x5e1ebd[_0xbb34('0x3b')]=qs[_0xbb34('0x32')](_[_0xbb34('0x3c')](_0x1e0269['query'],_0x17964c[_0xbb34('0x32')]));if(_0x1e0269['query']['filter']){_0x5e1ebd[_0xbb34('0x3b')]=_[_0xbb34('0x3f')](_0x5e1ebd['where'],{'$or':_[_0xbb34('0x2c')](_0x5e1ebd[_0xbb34('0x35')],function(_0x1822ed){var _0x449925={};_0x449925[_0x1822ed]={'$like':'%'+_0x1e0269[_0xbb34('0x31')]['filter']+'%'};return _0x449925;})});}_0x5e1ebd=_[_0xbb34('0x3f')]({},_0x5e1ebd,_0x1e0269['options']);return _0x3a3bd0[_0xbb34('0x53')](_0x5e1ebd);}})['then'](function(_0x110562){if(_0x110562){_0x5284c2=_0x110562[_0xbb34('0x37')];if(!_0x1e0269[_0xbb34('0x31')][_0xbb34('0x38')](_0xbb34('0x39'))){_0x5e1ebd[_0xbb34('0x20')]=qs[_0xbb34('0x20')](_0x1e0269[_0xbb34('0x31')]['limit']);_0x5e1ebd[_0xbb34('0x22')]=qs[_0xbb34('0x22')](_0x1e0269[_0xbb34('0x31')][_0xbb34('0x22')]);}return _0x3a3bd0[_0xbb34('0x53')](_0x5e1ebd);}})[_0xbb34('0x27')](function(_0x56ef4e){if(_0x56ef4e){return _0x56ef4e?{'count':_0x5284c2,'rows':_0x56ef4e}:null;}})[_0xbb34('0x27')](respondWithResult(_0x409cdb,null))[_0xbb34('0x42')](handleError(_0x409cdb,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f844cfc..d9ee22c 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 _0x2717=['define','Automation','tools_automations','lodash','util','api','bluebird','path','exports'];(function(_0x20d829,_0x1e45f0){var _0x241675=function(_0xacf1b1){while(--_0xacf1b1){_0x20d829['push'](_0x20d829['shift']());}};_0x241675(++_0x1e45f0);}(_0x2717,0xf6));var _0x7271=function(_0x3c8a4c,_0x3653c){_0x3c8a4c=_0x3c8a4c-0x0;var _0x2a4c1f=_0x2717[_0x3c8a4c];return _0x2a4c1f;};'use strict';var _=require(_0x7271('0x0'));var util=require(_0x7271('0x1'));var logger=require('../../config/logger')(_0x7271('0x2'));var moment=require('moment');var BPromise=require(_0x7271('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7271('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x7271('0x5')]=function(_0xe3e6a2,_0x1ad8ef){return _0xe3e6a2[_0x7271('0x6')](_0x7271('0x7'),attributes,{'tableName':_0x7271('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1edf=['./automation.attributes','exports','Automation','tools_automations','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1edf,0x117));var _0xf1ed=function(_0x1f4ea4,_0x4613a5){_0x1f4ea4=_0x1f4ea4-0x0;var _0x132975=_0x1edf[_0x1f4ea4];return _0x132975;};'use strict';var _=require(_0xf1ed('0x0'));var util=require(_0xf1ed('0x1'));var logger=require('../../config/logger')(_0xf1ed('0x2'));var moment=require(_0xf1ed('0x3'));var BPromise=require('bluebird');var rp=require(_0xf1ed('0x4'));var fs=require('fs');var path=require(_0xf1ed('0x5'));var rimraf=require(_0xf1ed('0x6'));var config=require('../../config/environment');var attributes=require(_0xf1ed('0x7'));module[_0xf1ed('0x8')]=function(_0x21173e,_0xc7f2a6){return _0x21173e['define'](_0xf1ed('0x9'),attributes,{'tableName':_0xf1ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 6e5572f..cd4695f 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 _0x72fa=['rpc','../../config/environment','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x72fa,0x78));var _0xa72f=function(_0x38dbb5,_0x427be1){_0x38dbb5=_0x38dbb5-0x0;var _0x34bd46=_0x72fa[_0x38dbb5];return _0x34bd46;};'use strict';var _=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var moment=require('moment');var BPromise=require(_0xa72f('0x2'));var rs=require(_0xa72f('0x3'));var fs=require('fs');var Redis=require(_0xa72f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa72f('0x5'))(_0xa72f('0x6'));var config=require(_0xa72f('0x7'));var jayson=require(_0xa72f('0x8'));var client=jayson[_0xa72f('0x9')][_0xa72f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cd1a3,_0xe8aa31,_0x1e1b85){return new BPromise(function(_0x33eae5,_0x57d4fa){return client[_0xa72f('0xb')](_0x2cd1a3,_0x1e1b85)[_0xa72f('0xc')](function(_0x423bc7){logger['info'](_0xa72f('0xd'),_0xe8aa31,_0xa72f('0xe'));logger['debug'](_0xa72f('0xf'),_0xe8aa31,_0xa72f('0xe'),JSON[_0xa72f('0x10')](_0x423bc7));if(_0x423bc7[_0xa72f('0x11')]){if(_0x423bc7[_0xa72f('0x11')][_0xa72f('0x12')]===0x1f4){logger[_0xa72f('0x11')](_0xa72f('0xd'),_0xe8aa31,_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);return _0x57d4fa(_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);}logger['error'](_0xa72f('0xd'),_0xe8aa31,_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);return _0x33eae5(_0x423bc7['error'][_0xa72f('0x13')]);}else{logger['info'](_0xa72f('0xd'),_0xe8aa31,_0xa72f('0xe'));_0x33eae5(_0x423bc7['result'][_0xa72f('0x13')]);}})[_0xa72f('0x14')](function(_0x461119){logger[_0xa72f('0x11')]('Automation,\x20%s,\x20%s',_0xe8aa31,_0x461119);_0x57d4fa(_0x461119);});});} \ No newline at end of file +var _0xa988=['../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x401554,_0x34b410){var _0x5b70e9=function(_0x4240c1){while(--_0x4240c1){_0x401554['push'](_0x401554['shift']());}};_0x5b70e9(++_0x34b410);}(_0xa988,0x1a7));var _0x8a98=function(_0x5a0945,_0x17a689){_0x5a0945=_0x5a0945-0x0;var _0x28fd9a=_0xa988[_0x5a0945];return _0x28fd9a;};'use strict';var _=require(_0x8a98('0x0'));var util=require(_0x8a98('0x1'));var moment=require(_0x8a98('0x2'));var BPromise=require(_0x8a98('0x3'));var rs=require(_0x8a98('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a98('0x5'))['db'];var utils=require(_0x8a98('0x6'));var logger=require(_0x8a98('0x7'))(_0x8a98('0x8'));var config=require(_0x8a98('0x9'));var jayson=require(_0x8a98('0xa'));var client=jayson[_0x8a98('0xb')][_0x8a98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ef481,_0x27db7a,_0x336f5f){return new BPromise(function(_0x5f3abf,_0xfa3168){return client[_0x8a98('0xd')](_0x4ef481,_0x336f5f)['then'](function(_0x5552b2){logger[_0x8a98('0xe')](_0x8a98('0xf'),_0x27db7a,'request\x20sent');logger[_0x8a98('0x10')](_0x8a98('0x11'),_0x27db7a,_0x8a98('0x12'),JSON['stringify'](_0x5552b2));if(_0x5552b2[_0x8a98('0x13')]){if(_0x5552b2[_0x8a98('0x13')][_0x8a98('0x14')]===0x1f4){logger['error'](_0x8a98('0xf'),_0x27db7a,_0x5552b2['error']['message']);return _0xfa3168(_0x5552b2['error'][_0x8a98('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x27db7a,_0x5552b2['error'][_0x8a98('0x15')]);return _0x5f3abf(_0x5552b2['error'][_0x8a98('0x15')]);}else{logger[_0x8a98('0xe')](_0x8a98('0xf'),_0x27db7a,_0x8a98('0x12'));_0x5f3abf(_0x5552b2[_0x8a98('0x16')][_0x8a98('0x15')]);}})[_0x8a98('0x17')](function(_0x92a1e8){logger['error']('Automation,\x20%s,\x20%s',_0x27db7a,_0x92a1e8);_0xfa3168(_0x92a1e8);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3c59e0f..a9e6e6a 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 _0xadae=['put','update','multer','util','path','../../config/environment','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xadae,0x134));var _0xeada=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xadae[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0xeada('0x0'));var util=require(_0xeada('0x1'));var path=require(_0xeada('0x2'));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('../../components/interaction/service');var config=require(_0xeada('0x3'));var controller=require('./automation.controller');router[_0xeada('0x4')]('/',auth[_0xeada('0x5')](),controller['index']);router['get'](_0xeada('0x6'),auth[_0xeada('0x5')](),controller[_0xeada('0x7')]);router[_0xeada('0x4')](_0xeada('0x8'),auth[_0xeada('0x5')](),controller[_0xeada('0x9')]);router[_0xeada('0x4')](_0xeada('0xa'),auth[_0xeada('0x5')](),controller[_0xeada('0xb')]);router[_0xeada('0xc')]('/',auth[_0xeada('0x5')](),controller['create']);router['post'](_0xeada('0x8'),auth[_0xeada('0x5')](),controller[_0xeada('0xd')]);router[_0xeada('0xc')](_0xeada('0xa'),auth['isAuthenticated'](),controller[_0xeada('0xe')]);router[_0xeada('0xf')](_0xeada('0x6'),auth[_0xeada('0x5')](),controller[_0xeada('0x10')]);router['delete'](_0xeada('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x95f7=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','delete','destroy','exports'];(function(_0x5bdeb2,_0x381819){var _0xbc81e=function(_0x2ede43){while(--_0x2ede43){_0x5bdeb2['push'](_0x5bdeb2['shift']());}};_0xbc81e(++_0x381819);}(_0x95f7,0x68));var _0x795f=function(_0x3a00af,_0x507f1){_0x3a00af=_0x3a00af-0x0;var _0x27ffe4=_0x95f7[_0x3a00af];return _0x27ffe4;};'use strict';var multer=require(_0x795f('0x0'));var util=require(_0x795f('0x1'));var path=require(_0x795f('0x2'));var timeout=require(_0x795f('0x3'));var express=require(_0x795f('0x4'));var router=express[_0x795f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x795f('0x6'));var interaction=require(_0x795f('0x7'));var config=require(_0x795f('0x8'));var controller=require(_0x795f('0x9'));router[_0x795f('0xa')]('/',auth[_0x795f('0xb')](),controller[_0x795f('0xc')]);router[_0x795f('0xa')](_0x795f('0xd'),auth[_0x795f('0xb')](),controller['show']);router[_0x795f('0xa')](_0x795f('0xe'),auth[_0x795f('0xb')](),controller[_0x795f('0xf')]);router[_0x795f('0xa')](_0x795f('0x10'),auth[_0x795f('0xb')](),controller[_0x795f('0x11')]);router[_0x795f('0x12')]('/',auth[_0x795f('0xb')](),controller[_0x795f('0x13')]);router[_0x795f('0x12')]('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router['post'](_0x795f('0x10'),auth['isAuthenticated'](),controller[_0x795f('0x14')]);router[_0x795f('0x15')](_0x795f('0xd'),auth[_0x795f('0xb')](),controller[_0x795f('0x16')]);router[_0x795f('0x17')](_0x795f('0xd'),auth[_0x795f('0xb')](),controller[_0x795f('0x18')]);module[_0x795f('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 75e6da2..59cb9eb 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 _0xe0b3=['onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xe0b3,0x1e6));var _0x3e0b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0b3[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3e0b('0x0'));module[_0x3e0b('0x1')]={'name':{'type':Sequelize[_0x3e0b('0x2')],'unique':_0x3e0b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3e0b('0x4')](_0x3e0b('0x5')),'allowNull':![],'defaultValue':_0x3e0b('0x5')},'description':{'type':Sequelize[_0x3e0b('0x2')]},'active':{'type':Sequelize[_0x3e0b('0x6')],'defaultValue':0x0,'comment':_0x3e0b('0x7')},'limitCalls':{'type':Sequelize[_0x3e0b('0x8')](0x4)[_0x3e0b('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x3e0b('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3e0b('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x3e0b('0x8')](0x3)[_0x3e0b('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e0b('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3e0b('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3e0b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e0b('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3e0b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e0b('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3e0b('0x8')](0x3)[_0x3e0b('0x9')],'defaultValue':0x3,'comment':_0x3e0b('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3e0b('0x8')](0x5)[_0x3e0b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e0b('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3e0b('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x3e0b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3e0b('0x2')],'defaultValue':_0x3e0b('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x3e0b('0x4')](_0x3e0b('0x10'),_0x3e0b('0x11'),_0x3e0b('0x12')),'defaultValue':_0x3e0b('0x10')},'dialAMDActive':{'type':Sequelize[_0x3e0b('0x6')],'defaultValue':0x0,'comment':_0x3e0b('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x3e0b('0x8')](0x9)[_0x3e0b('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3e0b('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x3e0b('0x8')](0x9)[_0x3e0b('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3e0b('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3e0b('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3e0b('0x8')](0x9)[_0x3e0b('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3e0b('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3e0b('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3e0b('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3e0b('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3e0b('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x3e0b('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3e0b('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3e0b('0x8')](0x5)[_0x3e0b('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3e0b('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3e0b('0x8')](0x9)[_0x3e0b('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3e0b('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3e0b('0x4')](_0x3e0b('0x1c'),'ASC'),'defaultValue':_0x3e0b('0x1c')},'dialPrefix':{'type':Sequelize[_0x3e0b('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3e0b('0x8')](0x3)[_0x3e0b('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x3e0b('0x8')](0x3)[_0x3e0b('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3e0b('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3e0b('0x8')](0x3)[_0x3e0b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e0b('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3e0b('0x8')](0x5)[_0x3e0b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e0b('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x3e0b('0x8')](0x3)[_0x3e0b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e0b('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x3e0b('0x8')](0x5)[_0x3e0b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e0b('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3e0b('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3e0b('0x8')](0x5)[_0x3e0b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x3e0b('0x8')](0x3)[_0x3e0b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e0b('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3e0b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3e0b('0x8')](0x3)[_0x3e0b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e0b('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3e0b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x01cc=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x2d69e1,_0x1843a3){var _0x3016b7=function(_0x2675a8){while(--_0x2675a8){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x3016b7(++_0x1843a3);}(_0x01cc,0x109));var _0xc01c=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x01cc[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0xc01c('0x0'));module[_0xc01c('0x1')]={'name':{'type':Sequelize[_0xc01c('0x2')],'unique':_0xc01c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc01c('0x4')](_0xc01c('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xc01c('0x2')]},'active':{'type':Sequelize[_0xc01c('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xc01c('0x7')](0x4)[_0xc01c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc01c('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc01c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xc01c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xc01c('0x7')](0x3)[_0xc01c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc01c('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc01c('0x7')](0x5)[_0xc01c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc01c('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xc01c('0x7')](0x3)[_0xc01c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc01c('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc01c('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc01c('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc01c('0x7')](0x5)[_0xc01c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc01c('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc01c('0x7')](0x3)[_0xc01c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc01c('0xf')},'dialTimezone':{'type':Sequelize[_0xc01c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc01c('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xc01c('0x4')](_0xc01c('0x10'),_0xc01c('0x11'),_0xc01c('0x12')),'defaultValue':_0xc01c('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc01c('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xc01c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc01c('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xc01c('0x7')](0x9)[_0xc01c('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc01c('0x7')](0x9)[_0xc01c('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc01c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc01c('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xc01c('0x7')](0x9)[_0xc01c('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc01c('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc01c('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc01c('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc01c('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc01c('0x7')](0x5)[_0xc01c('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc01c('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc01c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc01c('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc01c('0x4')](_0xc01c('0x1a'),_0xc01c('0x1b')),'defaultValue':_0xc01c('0x1a')},'dialPrefix':{'type':Sequelize[_0xc01c('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc01c('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc01c('0x1c')},'dialCutDigit':{'type':Sequelize[_0xc01c('0x7')](0x3)[_0xc01c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc01c('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc01c('0x7')](0x5)[_0xc01c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc01c('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xc01c('0x7')](0x3)[_0xc01c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc01c('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xc01c('0x7')](0x5)[_0xc01c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc01c('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc01c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc01c('0x7')](0x5)[_0xc01c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc01c('0x7')](0x3)[_0xc01c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc01c('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc01c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc01c('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc01c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc01c('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc01c('0x7')](0x5)[_0xc01c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc01c('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 212a9db..31e4018 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 _0x54af=['CampaignId\x20=\x20?','fromQuery','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','Campaign','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','IvrCampaigns','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x54af,0x90));var _0xf54a=function(_0x5e2c68,_0x1ef9db){_0x5e2c68=_0x5e2c68-0x0;var _0x375826=_0x54af[_0x5e2c68];return _0x375826;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf54a('0x0'));var zipdir=require(_0xf54a('0x1'));var jsonpatch=require(_0xf54a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf54a('0x3'));var Mustache=require(_0xf54a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf54a('0x5'));var csv=require('to-csv');var ejs=require(_0xf54a('0x6'));var fs=require('fs');var fs_extra=require(_0xf54a('0x7'));var _=require('lodash');var squel=require(_0xf54a('0x8'));var crypto=require(_0xf54a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf54a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf54a('0xb'));var Papa=require('papaparse');var Redis=require(_0xf54a('0xc'));var authService=require(_0xf54a('0xd'));var qs=require(_0xf54a('0xe'));var as=require(_0xf54a('0xf'));var hardwareService=require(_0xf54a('0x10'));var logger=require('../../config/logger')(_0xf54a('0x11'));var utils=require(_0xf54a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf54a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x353b8f,_0xd42c9f){_0xd42c9f=_0xd42c9f||0xcc;return function(_0x3b877c){if(_0x3b877c){return _0x353b8f[_0xf54a('0x14')](_0xd42c9f);}return _0x353b8f['status'](_0xd42c9f)[_0xf54a('0x15')]();};}function respondWithResult(_0x2e87c1,_0x456f55){_0x456f55=_0x456f55||0xc8;return function(_0x3e0eee){if(_0x3e0eee){return _0x2e87c1[_0xf54a('0x16')](_0x456f55)[_0xf54a('0x17')](_0x3e0eee);}};}function respondWithFilteredResult(_0x5a30c1,_0x165b79){return function(_0x941d34){if(_0x941d34){var _0x3a669f=typeof _0x165b79[_0xf54a('0x18')]===_0xf54a('0x19')&&typeof _0x165b79[_0xf54a('0x1a')]===_0xf54a('0x19');var _0x1aff3d=_0x941d34[_0xf54a('0x1b')];var _0x54083e=_0x3a669f?0x0:_0x165b79[_0xf54a('0x18')];var _0x3e3168=_0x3a669f?_0x941d34[_0xf54a('0x1b')]:_0x165b79[_0xf54a('0x18')]+_0x165b79['limit'];var _0x1b9cb6;if(_0x3e3168>=_0x1aff3d){_0x3e3168=_0x1aff3d;_0x1b9cb6=0xc8;}else{_0x1b9cb6=0xce;}_0x5a30c1[_0xf54a('0x16')](_0x1b9cb6);return _0x5a30c1[_0xf54a('0x1c')](_0xf54a('0x1d'),_0x54083e+'-'+_0x3e3168+'/'+_0x1aff3d)['json'](_0x941d34);}return null;};}function patchUpdates(_0x2e76e9){return function(_0x4984f2){try{jsonpatch[_0xf54a('0x1e')](_0x4984f2,_0x2e76e9,!![]);}catch(_0x285488){return BPromise[_0xf54a('0x1f')](_0x285488);}return _0x4984f2[_0xf54a('0x20')]();};}function saveUpdates(_0x47cf1f,_0xf023f3){return function(_0x571729){if(_0x571729){return _0x571729['update'](_0x47cf1f)[_0xf54a('0x21')](function(_0x1df943){return _0x1df943;});}return null;};}function removeEntity(_0x54a476,_0x287ed4){return function(_0x4a2818){if(_0x4a2818){return _0x4a2818[_0xf54a('0x22')]()[_0xf54a('0x21')](function(){var _0x26fc23=_0x4a2818[_0xf54a('0x23')]({'plain':!![]});var _0x23b097='IvrCampaigns';return db[_0xf54a('0x24')][_0xf54a('0x22')]({'where':{'type':_0x23b097,'resourceId':_0x26fc23['id']}})[_0xf54a('0x21')](function(){return _0x4a2818;});})['then'](function(){_0x54a476[_0xf54a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x551122,_0x4822ea){return function(_0x3341f6){if(!_0x3341f6){_0x551122[_0xf54a('0x14')](0x194);}return _0x3341f6;};}function handleError(_0x299416,_0x15ed12){_0x15ed12=_0x15ed12||0x1f4;return function(_0x55061e){logger[_0xf54a('0x25')](_0x55061e[_0xf54a('0x26')]);if(_0x55061e['name']){delete _0x55061e[_0xf54a('0x27')];}_0x299416[_0xf54a('0x16')](_0x15ed12)[_0xf54a('0x28')](_0x55061e);};}exports[_0xf54a('0x29')]=function(_0x36a198,_0x17122a){var _0x599c52={},_0x4de741={},_0x1d346a={'count':0x0,'rows':[]};var _0x36a894=_['map'](db[_0xf54a('0x2a')][_0xf54a('0x2b')],function(_0x2278ff){return{'name':_0x2278ff['fieldName'],'type':_0x2278ff[_0xf54a('0x2c')][_0xf54a('0x2d')]};});_0x4de741['model']=_[_0xf54a('0x2e')](_0x36a894,'name');_0x4de741[_0xf54a('0x2f')]=_[_0xf54a('0x30')](_0x36a198['query']);_0x4de741[_0xf54a('0x31')]=_[_0xf54a('0x32')](_0x4de741[_0xf54a('0x33')],_0x4de741['query']);_0x599c52[_0xf54a('0x34')]=_[_0xf54a('0x32')](_0x4de741[_0xf54a('0x33')],qs[_0xf54a('0x35')](_0x36a198[_0xf54a('0x2f')][_0xf54a('0x35')]));_0x599c52[_0xf54a('0x34')]=_0x599c52[_0xf54a('0x34')][_0xf54a('0x36')]?_0x599c52[_0xf54a('0x34')]:_0x4de741['model'];if(!_0x36a198[_0xf54a('0x2f')][_0xf54a('0x37')](_0xf54a('0x38'))){_0x599c52[_0xf54a('0x1a')]=qs['limit'](_0x36a198[_0xf54a('0x2f')]['limit']);_0x599c52[_0xf54a('0x18')]=qs[_0xf54a('0x18')](_0x36a198[_0xf54a('0x2f')]['offset']);}_0x599c52[_0xf54a('0x39')]=qs[_0xf54a('0x3a')](_0x36a198[_0xf54a('0x2f')][_0xf54a('0x3a')]);_0x599c52['where']=qs[_0xf54a('0x31')](_[_0xf54a('0x3b')](_0x36a198[_0xf54a('0x2f')],_0x4de741[_0xf54a('0x31')]),_0x36a894);if(_0x36a198[_0xf54a('0x2f')][_0xf54a('0x3c')]){_0x599c52[_0xf54a('0x3d')]=_[_0xf54a('0x3e')](_0x599c52[_0xf54a('0x3d')],{'$or':_[_0xf54a('0x2e')](_0x36a894,function(_0x2de3a5){if(_0x2de3a5[_0xf54a('0x2c')]!==_0xf54a('0x3f')){var _0x2a2daa={};_0x2a2daa[_0x2de3a5[_0xf54a('0x27')]]={'$like':'%'+_0x36a198[_0xf54a('0x2f')][_0xf54a('0x3c')]+'%'};return _0x2a2daa;}})});}_0x599c52=_[_0xf54a('0x3e')]({},_0x599c52,_0x36a198[_0xf54a('0x40')]);var _0x1916f8={'where':_0x599c52[_0xf54a('0x3d')]};return db[_0xf54a('0x2a')][_0xf54a('0x1b')](_0x1916f8)[_0xf54a('0x21')](function(_0x2d0e82){_0x1d346a[_0xf54a('0x1b')]=_0x2d0e82;if(_0x36a198[_0xf54a('0x2f')][_0xf54a('0x41')]){_0x599c52[_0xf54a('0x42')]=[{'all':!![]}];}return db[_0xf54a('0x2a')][_0xf54a('0x43')](_0x599c52);})[_0xf54a('0x21')](function(_0x246559){_0x1d346a[_0xf54a('0x44')]=_0x246559;return _0x1d346a;})['then'](respondWithFilteredResult(_0x17122a,_0x599c52))[_0xf54a('0x45')](handleError(_0x17122a,null));};exports[_0xf54a('0x46')]=function(_0x40ffdf,_0x52aa17){var _0x5e36c2={'raw':![],'where':{'id':_0x40ffdf[_0xf54a('0x47')]['id']}},_0x281697={};_0x281697[_0xf54a('0x33')]=_[_0xf54a('0x30')](db[_0xf54a('0x2a')][_0xf54a('0x2b')]);_0x281697[_0xf54a('0x2f')]=_[_0xf54a('0x30')](_0x40ffdf[_0xf54a('0x2f')]);_0x281697[_0xf54a('0x31')]=_[_0xf54a('0x32')](_0x281697['model'],_0x281697['query']);_0x5e36c2['attributes']=_[_0xf54a('0x32')](_0x281697[_0xf54a('0x33')],qs[_0xf54a('0x35')](_0x40ffdf[_0xf54a('0x2f')][_0xf54a('0x35')]));_0x5e36c2['attributes']=_0x5e36c2['attributes'][_0xf54a('0x36')]?_0x5e36c2[_0xf54a('0x34')]:_0x281697[_0xf54a('0x33')];if(_0x40ffdf['query']['includeAll']){_0x5e36c2[_0xf54a('0x42')]=[{'all':!![]}];}_0x5e36c2=_[_0xf54a('0x3e')]({},_0x5e36c2,_0x40ffdf[_0xf54a('0x40')]);return db[_0xf54a('0x2a')]['find'](_0x5e36c2)['then'](handleEntityNotFound(_0x52aa17,null))[_0xf54a('0x21')](respondWithResult(_0x52aa17,null))['catch'](handleError(_0x52aa17,null));};exports[_0xf54a('0x48')]=function(_0x16432e,_0x2caabe){return db[_0xf54a('0x2a')]['create'](_0x16432e[_0xf54a('0x49')],{})[_0xf54a('0x21')](function(_0x262f8f){var _0x5d9b7a=_0x16432e[_0xf54a('0x4a')][_0xf54a('0x23')]({'plain':!![]});if(!_0x5d9b7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d9b7a[_0xf54a('0x4b')]===_0xf54a('0x4a')){var _0x5c16cc=_0x262f8f[_0xf54a('0x23')]({'plain':!![]});var _0x7902e=_0xf54a('0x4c');return db['UserProfileSection'][_0xf54a('0x4d')]({'where':{'name':_0x7902e,'userProfileId':_0x5d9b7a[_0xf54a('0x4e')]},'raw':!![]})[_0xf54a('0x21')](function(_0x514bbd){if(_0x514bbd&&_0x514bbd[_0xf54a('0x4f')]===0x0){return db[_0xf54a('0x24')]['create']({'name':_0x5c16cc[_0xf54a('0x27')],'resourceId':_0x5c16cc['id'],'type':_0x514bbd[_0xf54a('0x27')],'sectionId':_0x514bbd['id']},{})[_0xf54a('0x21')](function(){return _0x262f8f;});}else{return _0x262f8f;}})['catch'](function(_0x43315d){logger[_0xf54a('0x25')](_0xf54a('0x50'),_0x43315d);throw _0x43315d;});}return _0x262f8f;})[_0xf54a('0x21')](respondWithResult(_0x2caabe,0xc9))[_0xf54a('0x45')](handleError(_0x2caabe,null));};exports[_0xf54a('0x51')]=function(_0x1fcdf1,_0x6bc269){var _0x92016={'where':{'id':_0x1fcdf1['params']['id']}},_0x6bd696={};_0x6bd696['model']=_['keys'](db[_0xf54a('0x2a')]['rawAttributes']);_0x92016['attributes']=_['intersection'](_0x6bd696[_0xf54a('0x33')],qs['fields'](_0x1fcdf1['query'][_0xf54a('0x35')]));_0x92016[_0xf54a('0x34')]=_0x92016[_0xf54a('0x34')][_0xf54a('0x36')]?_0x92016[_0xf54a('0x34')]:_0x6bd696[_0xf54a('0x33')];if(_0x1fcdf1[_0xf54a('0x2f')][_0xf54a('0x41')]){_0x92016[_0xf54a('0x42')]=[{'all':!![]}];}_0x92016=_['merge']({},_0x92016,_0x1fcdf1[_0xf54a('0x40')]);return db[_0xf54a('0x2a')]['find'](_0x92016)[_0xf54a('0x21')](handleEntityNotFound(_0x6bc269,null))[_0xf54a('0x21')](function(_0x3e60c0){if(_0x3e60c0){var _0x113ba9=_0x3e60c0[_0xf54a('0x23')]({'plain':!![]});_0x113ba9=qs[_0xf54a('0x52')](_0x113ba9,['id',_0xf54a('0x53'),_0xf54a('0x54')]);_0x1fcdf1[_0xf54a('0x49')]=_[_0xf54a('0x52')](_0x1fcdf1[_0xf54a('0x49')],['id','createdAt',_0xf54a('0x54')]);return db[_0xf54a('0x2a')]['create'](_['merge'](_0x113ba9,_0x1fcdf1['body']),{'include':_0x1fcdf1[_0xf54a('0x2f')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xb164e2){var _0x3539c9=_0x1fcdf1[_0xf54a('0x4a')]['get']({'plain':!![]});if(!_0x3539c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3539c9[_0xf54a('0x4b')]==='user'){var _0x24877f=_0xb164e2[_0xf54a('0x23')]({'plain':!![]});var _0x1dc864='IvrCampaigns';return db[_0xf54a('0x55')][_0xf54a('0x4d')]({'where':{'name':_0x1dc864,'userProfileId':_0x3539c9['userProfileId']},'raw':!![]})[_0xf54a('0x21')](function(_0x27aa77){if(_0x27aa77&&_0x27aa77['autoAssociation']===0x0){return db[_0xf54a('0x24')]['create']({'name':_0x24877f[_0xf54a('0x27')],'resourceId':_0x24877f['id'],'type':_0x27aa77[_0xf54a('0x27')],'sectionId':_0x27aa77['id']},{})[_0xf54a('0x21')](function(){return _0xb164e2;});}else{return _0xb164e2;}})[_0xf54a('0x45')](function(_0x1c4f6c){logger[_0xf54a('0x25')](_0xf54a('0x50'),_0x1c4f6c);throw _0x1c4f6c;});}return _0xb164e2;});}})['then'](respondWithResult(_0x6bc269,0xc9))[_0xf54a('0x45')](handleError(_0x6bc269,null));};exports[_0xf54a('0x56')]=function(_0x3f5c05,_0x45be17){if(_0x3f5c05['body']['id']){delete _0x3f5c05[_0xf54a('0x49')]['id'];}return db['Campaign'][_0xf54a('0x4d')]({'where':{'id':_0x3f5c05['params']['id']}})[_0xf54a('0x21')](handleEntityNotFound(_0x45be17,null))[_0xf54a('0x21')](saveUpdates(_0x3f5c05[_0xf54a('0x49')],null))[_0xf54a('0x21')](respondWithResult(_0x45be17,null))[_0xf54a('0x45')](handleError(_0x45be17,null));};exports[_0xf54a('0x22')]=function(_0x5ee983,_0x7b5ac0){return db[_0xf54a('0x2a')]['find']({'where':{'id':_0x5ee983['params']['id']}})['then'](handleEntityNotFound(_0x7b5ac0,null))[_0xf54a('0x21')](removeEntity(_0x7b5ac0,null))[_0xf54a('0x45')](handleError(_0x7b5ac0,null));};exports[_0xf54a('0x57')]=function(_0x413843,_0x25ea19,_0x44400e){var _0x2dcb54={'raw':!![],'where':{}};var _0x1027b6={};var _0x498455={'count':0x0,'rows':[]};return db[_0xf54a('0x2a')][_0xf54a('0x58')]({'where':{'id':_0x413843[_0xf54a('0x47')]['id']}})[_0xf54a('0x21')](handleEntityNotFound(_0x25ea19,null))['then'](function(_0xc0f412){if(_0xc0f412){_0x1027b6['model']=_[_0xf54a('0x30')](db['CmHopper']['rawAttributes']);_0x1027b6[_0xf54a('0x2f')]=_[_0xf54a('0x30')](_0x413843[_0xf54a('0x2f')]);_0x1027b6[_0xf54a('0x31')]=_['intersection'](_0x1027b6[_0xf54a('0x33')],_0x1027b6[_0xf54a('0x2f')]);_0x2dcb54[_0xf54a('0x34')]=_[_0xf54a('0x32')](_0x1027b6['model'],qs['fields'](_0x413843['query']['fields']));_0x2dcb54[_0xf54a('0x34')]=_0x2dcb54[_0xf54a('0x34')][_0xf54a('0x36')]?_0x2dcb54['attributes']:_0x1027b6[_0xf54a('0x33')];if(!_0x413843[_0xf54a('0x2f')][_0xf54a('0x37')](_0xf54a('0x38'))){_0x2dcb54[_0xf54a('0x1a')]=qs['limit'](_0x413843[_0xf54a('0x2f')][_0xf54a('0x1a')]);_0x2dcb54[_0xf54a('0x18')]=qs[_0xf54a('0x18')](_0x413843[_0xf54a('0x2f')][_0xf54a('0x18')]);}_0x2dcb54[_0xf54a('0x39')]=qs[_0xf54a('0x3a')](_0x413843[_0xf54a('0x2f')][_0xf54a('0x3a')]);_0x2dcb54['where']=qs[_0xf54a('0x31')](_[_0xf54a('0x3b')](_0x413843['query'],_0x1027b6[_0xf54a('0x31')]));_0x2dcb54[_0xf54a('0x3d')][_0xf54a('0x59')]=_0xc0f412['id'];if(_0x413843[_0xf54a('0x2f')][_0xf54a('0x3c')]){_0x2dcb54['where']=_[_0xf54a('0x3e')](_0x2dcb54[_0xf54a('0x3d')],{'$or':_['map'](_0x2dcb54[_0xf54a('0x34')],function(_0x20eb98){var _0x167357={};_0x167357[_0x20eb98]={'$like':'%'+_0x413843[_0xf54a('0x2f')][_0xf54a('0x3c')]+'%'};return _0x167357;})});}_0x2dcb54=_[_0xf54a('0x3e')]({},_0x2dcb54,_0x413843[_0xf54a('0x40')]);return db[_0xf54a('0x5a')][_0xf54a('0x1b')]({'where':_0x2dcb54['where']})[_0xf54a('0x21')](function(_0x2875a1){_0x498455[_0xf54a('0x1b')]=_0x2875a1;if(_0x413843[_0xf54a('0x2f')]['includeAll']){_0x2dcb54[_0xf54a('0x42')]=[{'all':!![]}];}return db[_0xf54a('0x5a')][_0xf54a('0x43')](_0x2dcb54);})[_0xf54a('0x21')](function(_0x558c11){_0x498455[_0xf54a('0x44')]=_0x558c11;return _0x498455;});}})[_0xf54a('0x21')](respondWithFilteredResult(_0x25ea19,_0x2dcb54))['catch'](handleError(_0x25ea19,null));};exports[_0xf54a('0x5b')]=function(_0x34a143,_0x3717f4,_0x4c8f83){var _0x33bdf6={'raw':!![],'where':{}};var _0x13a7fe={};var _0x20f583={'count':0x0,'rows':[]};return db[_0xf54a('0x2a')][_0xf54a('0x58')]({'where':{'id':_0x34a143[_0xf54a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3717f4,null))[_0xf54a('0x21')](function(_0x29b2d2){if(_0x29b2d2){_0x13a7fe[_0xf54a('0x33')]=_['keys'](db[_0xf54a('0x5c')][_0xf54a('0x2b')]);_0x13a7fe[_0xf54a('0x2f')]=_[_0xf54a('0x30')](_0x34a143['query']);_0x13a7fe[_0xf54a('0x31')]=_['intersection'](_0x13a7fe[_0xf54a('0x33')],_0x13a7fe[_0xf54a('0x2f')]);_0x33bdf6[_0xf54a('0x34')]=_[_0xf54a('0x32')](_0x13a7fe['model'],qs['fields'](_0x34a143['query'][_0xf54a('0x35')]));_0x33bdf6['attributes']=_0x33bdf6['attributes'][_0xf54a('0x36')]?_0x33bdf6[_0xf54a('0x34')]:_0x13a7fe['model'];if(!_0x34a143['query'][_0xf54a('0x37')](_0xf54a('0x38'))){_0x33bdf6[_0xf54a('0x1a')]=qs[_0xf54a('0x1a')](_0x34a143[_0xf54a('0x2f')]['limit']);_0x33bdf6[_0xf54a('0x18')]=qs[_0xf54a('0x18')](_0x34a143[_0xf54a('0x2f')][_0xf54a('0x18')]);}_0x33bdf6[_0xf54a('0x39')]=qs[_0xf54a('0x3a')](_0x34a143[_0xf54a('0x2f')][_0xf54a('0x3a')]);_0x33bdf6[_0xf54a('0x3d')]=qs[_0xf54a('0x31')](_['pick'](_0x34a143['query'],_0x13a7fe[_0xf54a('0x31')]));_0x33bdf6[_0xf54a('0x3d')]['CampaignId']=_0x29b2d2['id'];if(_0x34a143[_0xf54a('0x2f')][_0xf54a('0x3c')]){_0x33bdf6[_0xf54a('0x3d')]=_[_0xf54a('0x3e')](_0x33bdf6[_0xf54a('0x3d')],{'$or':_[_0xf54a('0x2e')](_0x33bdf6['attributes'],function(_0x48df8d){var _0x1badf8={};_0x1badf8[_0x48df8d]={'$like':'%'+_0x34a143[_0xf54a('0x2f')][_0xf54a('0x3c')]+'%'};return _0x1badf8;})});}_0x33bdf6=_['merge']({},_0x33bdf6,_0x34a143[_0xf54a('0x40')]);return db[_0xf54a('0x5c')]['count']({'where':_0x33bdf6['where']})[_0xf54a('0x21')](function(_0x5d3bc5){_0x20f583[_0xf54a('0x1b')]=_0x5d3bc5;if(_0x34a143[_0xf54a('0x2f')]['includeAll']){_0x33bdf6[_0xf54a('0x42')]=[{'all':!![]}];}return db[_0xf54a('0x5c')][_0xf54a('0x43')](_0x33bdf6);})[_0xf54a('0x21')](function(_0x4f1c4c){_0x20f583[_0xf54a('0x44')]=_0x4f1c4c;return _0x20f583;});}})['then'](respondWithFilteredResult(_0x3717f4,_0x33bdf6))[_0xf54a('0x45')](handleError(_0x3717f4,null));};exports['getHopperFinals']=function(_0x59c8a9,_0x5e8220,_0x1e53d4){var _0x1cddb5={'raw':!![],'where':{}};var _0x1f4b50={};var _0x13b6d1={'count':0x0,'rows':[]};return db[_0xf54a('0x2a')][_0xf54a('0x58')]({'where':{'id':_0x59c8a9[_0xf54a('0x47')]['id']}})[_0xf54a('0x21')](handleEntityNotFound(_0x5e8220,null))[_0xf54a('0x21')](function(_0x595ccb){if(_0x595ccb){_0x1f4b50[_0xf54a('0x33')]=_[_0xf54a('0x30')](db[_0xf54a('0x5d')][_0xf54a('0x2b')]);_0x1f4b50[_0xf54a('0x2f')]=_[_0xf54a('0x30')](_0x59c8a9[_0xf54a('0x2f')]);_0x1f4b50[_0xf54a('0x31')]=_['intersection'](_0x1f4b50[_0xf54a('0x33')],_0x1f4b50[_0xf54a('0x2f')]);_0x1cddb5[_0xf54a('0x34')]=_['intersection'](_0x1f4b50[_0xf54a('0x33')],qs[_0xf54a('0x35')](_0x59c8a9[_0xf54a('0x2f')][_0xf54a('0x35')]));_0x1cddb5[_0xf54a('0x34')]=_0x1cddb5[_0xf54a('0x34')]['length']?_0x1cddb5[_0xf54a('0x34')]:_0x1f4b50['model'];if(!_0x59c8a9['query'][_0xf54a('0x37')](_0xf54a('0x38'))){_0x1cddb5[_0xf54a('0x1a')]=qs['limit'](_0x59c8a9[_0xf54a('0x2f')][_0xf54a('0x1a')]);_0x1cddb5[_0xf54a('0x18')]=qs['offset'](_0x59c8a9[_0xf54a('0x2f')][_0xf54a('0x18')]);}_0x1cddb5[_0xf54a('0x39')]=qs[_0xf54a('0x3a')](_0x59c8a9[_0xf54a('0x2f')][_0xf54a('0x3a')]);_0x1cddb5[_0xf54a('0x3d')]=qs[_0xf54a('0x31')](_[_0xf54a('0x3b')](_0x59c8a9[_0xf54a('0x2f')],_0x1f4b50[_0xf54a('0x31')]));_0x1cddb5[_0xf54a('0x3d')][_0xf54a('0x59')]=_0x595ccb['id'];if(_0x59c8a9[_0xf54a('0x2f')][_0xf54a('0x3c')]){_0x1cddb5[_0xf54a('0x3d')]=_[_0xf54a('0x3e')](_0x1cddb5[_0xf54a('0x3d')],{'$or':_[_0xf54a('0x2e')](_0x1cddb5[_0xf54a('0x34')],function(_0x3f4c1c){var _0xe048c1={};_0xe048c1[_0x3f4c1c]={'$like':'%'+_0x59c8a9[_0xf54a('0x2f')]['filter']+'%'};return _0xe048c1;})});}_0x1cddb5=_[_0xf54a('0x3e')]({},_0x1cddb5,_0x59c8a9[_0xf54a('0x40')]);return db[_0xf54a('0x5d')][_0xf54a('0x1b')]({'where':_0x1cddb5[_0xf54a('0x3d')]})['then'](function(_0x2c2df1){_0x13b6d1[_0xf54a('0x1b')]=_0x2c2df1;if(_0x59c8a9[_0xf54a('0x2f')]['includeAll']){_0x1cddb5[_0xf54a('0x42')]=[{'all':!![]}];}return db[_0xf54a('0x5d')][_0xf54a('0x43')](_0x1cddb5);})['then'](function(_0x31a248){_0x13b6d1[_0xf54a('0x44')]=_0x31a248;return _0x13b6d1;});}})[_0xf54a('0x21')](respondWithFilteredResult(_0x5e8220,_0x1cddb5))[_0xf54a('0x45')](handleError(_0x5e8220,null));};exports['getHopperBlacks']=function(_0x572d68,_0x535e53,_0x3e1bdf){var _0x267d04={'raw':!![],'where':{}};var _0x271215={};var _0x122a9b={'count':0x0,'rows':[]};return db[_0xf54a('0x2a')]['findOne']({'where':{'id':_0x572d68['params']['id']}})['then'](handleEntityNotFound(_0x535e53,null))[_0xf54a('0x21')](function(_0x251cde){if(_0x251cde){_0x271215[_0xf54a('0x33')]=_[_0xf54a('0x30')](db[_0xf54a('0x5e')][_0xf54a('0x2b')]);_0x271215[_0xf54a('0x2f')]=_[_0xf54a('0x30')](_0x572d68['query']);_0x271215[_0xf54a('0x31')]=_[_0xf54a('0x32')](_0x271215[_0xf54a('0x33')],_0x271215[_0xf54a('0x2f')]);_0x267d04[_0xf54a('0x34')]=_[_0xf54a('0x32')](_0x271215[_0xf54a('0x33')],qs[_0xf54a('0x35')](_0x572d68['query'][_0xf54a('0x35')]));_0x267d04[_0xf54a('0x34')]=_0x267d04[_0xf54a('0x34')][_0xf54a('0x36')]?_0x267d04[_0xf54a('0x34')]:_0x271215['model'];if(!_0x572d68[_0xf54a('0x2f')][_0xf54a('0x37')](_0xf54a('0x38'))){_0x267d04[_0xf54a('0x1a')]=qs[_0xf54a('0x1a')](_0x572d68[_0xf54a('0x2f')][_0xf54a('0x1a')]);_0x267d04[_0xf54a('0x18')]=qs['offset'](_0x572d68[_0xf54a('0x2f')][_0xf54a('0x18')]);}_0x267d04['order']=qs[_0xf54a('0x3a')](_0x572d68['query'][_0xf54a('0x3a')]);_0x267d04[_0xf54a('0x3d')]=qs['filters'](_[_0xf54a('0x3b')](_0x572d68[_0xf54a('0x2f')],_0x271215[_0xf54a('0x31')]));_0x267d04[_0xf54a('0x3d')][_0xf54a('0x59')]=_0x251cde['id'];if(_0x572d68['query'][_0xf54a('0x3c')]){_0x267d04['where']=_[_0xf54a('0x3e')](_0x267d04[_0xf54a('0x3d')],{'$or':_[_0xf54a('0x2e')](_0x267d04[_0xf54a('0x34')],function(_0x5deb5c){var _0x1b64a1={};_0x1b64a1[_0x5deb5c]={'$like':'%'+_0x572d68[_0xf54a('0x2f')]['filter']+'%'};return _0x1b64a1;})});}_0x267d04=_[_0xf54a('0x3e')]({},_0x267d04,_0x572d68[_0xf54a('0x40')]);return db[_0xf54a('0x5e')][_0xf54a('0x1b')]({'where':_0x267d04[_0xf54a('0x3d')]})[_0xf54a('0x21')](function(_0x5181e1){_0x122a9b[_0xf54a('0x1b')]=_0x5181e1;if(_0x572d68['query'][_0xf54a('0x41')]){_0x267d04[_0xf54a('0x42')]=[{'all':!![]}];}return db[_0xf54a('0x5e')][_0xf54a('0x43')](_0x267d04);})[_0xf54a('0x21')](function(_0x13df16){_0x122a9b[_0xf54a('0x44')]=_0x13df16;return _0x122a9b;});}})[_0xf54a('0x21')](respondWithFilteredResult(_0x535e53,_0x267d04))['catch'](handleError(_0x535e53,null));};exports[_0xf54a('0x5f')]=function(_0x2a3e82,_0x4e9ddc,_0x3915f0){var _0x8a5887={};var _0x3f2559={};var _0x42c8bf;var _0xd5c4d6;return db['Campaign'][_0xf54a('0x58')]({'where':{'id':_0x2a3e82[_0xf54a('0x47')]['id']}})[_0xf54a('0x21')](handleEntityNotFound(_0x4e9ddc,null))['then'](function(_0x16db86){if(_0x16db86){_0x42c8bf=_0x16db86;_0x3f2559['model']=_[_0xf54a('0x30')](db[_0xf54a('0x60')][_0xf54a('0x2b')]);_0x3f2559[_0xf54a('0x2f')]=_[_0xf54a('0x30')](_0x2a3e82[_0xf54a('0x2f')]);_0x3f2559[_0xf54a('0x31')]=_[_0xf54a('0x32')](_0x3f2559[_0xf54a('0x33')],_0x3f2559[_0xf54a('0x2f')]);_0x8a5887[_0xf54a('0x34')]=_[_0xf54a('0x32')](_0x3f2559[_0xf54a('0x33')],qs[_0xf54a('0x35')](_0x2a3e82['query'][_0xf54a('0x35')]));_0x8a5887[_0xf54a('0x34')]=_0x8a5887['attributes']['length']?_0x8a5887['attributes']:_0x3f2559['model'];_0x8a5887[_0xf54a('0x39')]=qs[_0xf54a('0x3a')](_0x2a3e82[_0xf54a('0x2f')]['sort']);_0x8a5887[_0xf54a('0x3d')]=qs['filters'](_[_0xf54a('0x3b')](_0x2a3e82[_0xf54a('0x2f')],_0x3f2559[_0xf54a('0x31')]));if(_0x2a3e82[_0xf54a('0x2f')]['filter']){_0x8a5887['where']=_['merge'](_0x8a5887[_0xf54a('0x3d')],{'$or':_[_0xf54a('0x2e')](_0x8a5887[_0xf54a('0x34')],function(_0x3d76c9){var _0x3fb893={};_0x3fb893[_0x3d76c9]={'$like':'%'+_0x2a3e82[_0xf54a('0x2f')][_0xf54a('0x3c')]+'%'};return _0x3fb893;})});}_0x8a5887=_['merge']({},_0x8a5887,_0x2a3e82[_0xf54a('0x40')]);return _0x42c8bf['getLists'](_0x8a5887);}})['then'](function(_0x26920f){if(_0x26920f){_0xd5c4d6=_0x26920f[_0xf54a('0x36')];if(!_0x2a3e82[_0xf54a('0x2f')][_0xf54a('0x37')](_0xf54a('0x38'))){_0x8a5887['limit']=qs[_0xf54a('0x1a')](_0x2a3e82[_0xf54a('0x2f')][_0xf54a('0x1a')]);_0x8a5887[_0xf54a('0x18')]=qs[_0xf54a('0x18')](_0x2a3e82[_0xf54a('0x2f')][_0xf54a('0x18')]);}return _0x42c8bf[_0xf54a('0x5f')](_0x8a5887);}})[_0xf54a('0x21')](function(_0x154d70){if(_0x154d70){return _0x154d70?{'count':_0xd5c4d6,'rows':_0x154d70}:null;}})['then'](respondWithResult(_0x4e9ddc,null))[_0xf54a('0x45')](handleError(_0x4e9ddc,null));};exports[_0xf54a('0x61')]=function(_0x59f41f,_0x2541fa,_0x2eb563){var _0x59308f,_0x1ece2e;return db[_0xf54a('0x2a')][_0xf54a('0x4d')]({'where':{'id':_0x59f41f[_0xf54a('0x47')]['id']}})[_0xf54a('0x21')](handleEntityNotFound(_0x2541fa,null))[_0xf54a('0x21')](function(_0x4b50ae){if(_0x4b50ae){_0x1ece2e=_0x4b50ae;return _0x4b50ae[_0xf54a('0x61')](_0x59f41f[_0xf54a('0x49')][_0xf54a('0x62')],_['omit'](_0x59f41f['body'],[_0xf54a('0x62'),'id'])||{});}return null;})[_0xf54a('0x63')](function(_0x70f15a){var _0xe39e94;_0x59308f=_0x70f15a||[];var _0x1433c4=[];if(_0x70f15a){for(var _0x37a5da=0x0;_0x37a5da<_0x70f15a[_0xf54a('0x36')];_0x37a5da+=0x1){var _0x221347=_0x70f15a[_0x37a5da][_0xf54a('0x23')]({'plain':!![]});_0x1ece2e[_0xf54a('0x64')]=_0x59f41f[_0xf54a('0x49')][_0xf54a('0x64')]?_0x59f41f[_0xf54a('0x49')]['dialCheckDuplicateType']:_0x1ece2e['dialCheckDuplicateType'];switch(_0x1ece2e[_0xf54a('0x64')]){case _0xf54a('0x65'):_0xe39e94=squel[_0xf54a('0x66')]()[_0xf54a('0x67')]('cm_hopper')['fromQuery']([_0xf54a('0x68'),_0xf54a('0x69'),_0xf54a('0x6a'),_0xf54a('0x6b'),_0xf54a('0x59'),_0xf54a('0x53'),'updatedAt'],squel[_0xf54a('0x6c')]()[_0xf54a('0x6d')](_0xf54a('0x68'),_0xf54a('0x68'))[_0xf54a('0x6d')]('NOW()',_0xf54a('0x69'))[_0xf54a('0x6d')]('id',_0xf54a('0x6a'))[_0xf54a('0x6d')](_0x221347[_0xf54a('0x6e')]['toString'](),_0xf54a('0x6b'))['field'](_0x59f41f[_0xf54a('0x47')]['id'][_0xf54a('0x6f')](),'CampaignId')['field'](_0xf54a('0x70'),_0xf54a('0x53'))['field'](_0xf54a('0x70'),_0xf54a('0x54'))[_0xf54a('0x71')](_0xf54a('0x72'))[_0xf54a('0x3d')](_0xf54a('0x73'))[_0xf54a('0x3d')]('ListId\x20=\x20?',_0x221347[_0xf54a('0x6e')][_0xf54a('0x6f')]())[_0xf54a('0x3d')](_0xf54a('0x74'))['where'](_0xf54a('0x75'),squel[_0xf54a('0x6c')]()[_0xf54a('0x6d')](_0xf54a('0x76'))['from'](_0xf54a('0x77'))['where']('CampaignId\x20=\x20?',_0x59f41f[_0xf54a('0x47')]['id']['toString']()))[_0xf54a('0x3d')](_0xf54a('0x75'),squel[_0xf54a('0x6c')]()[_0xf54a('0x6d')](_0xf54a('0x78'))[_0xf54a('0x71')](_0xf54a('0x79'))[_0xf54a('0x3d')](_0xf54a('0x7a'),_0x59f41f[_0xf54a('0x47')]['id']['toString']())))['toString']();break;case'onlyIfOpen':_0xe39e94=squel[_0xf54a('0x66')]()['into']('cm_hopper')[_0xf54a('0x7b')](['phone',_0xf54a('0x69'),'ContactId',_0xf54a('0x6b'),_0xf54a('0x59'),_0xf54a('0x53'),'updatedAt'],squel['select']()['field']('phone',_0xf54a('0x68'))[_0xf54a('0x6d')](_0xf54a('0x70'),_0xf54a('0x69'))['field']('id',_0xf54a('0x6a'))[_0xf54a('0x6d')](_0x221347[_0xf54a('0x6e')][_0xf54a('0x6f')](),_0xf54a('0x6b'))[_0xf54a('0x6d')](_0x59f41f[_0xf54a('0x47')]['id'][_0xf54a('0x6f')](),_0xf54a('0x59'))[_0xf54a('0x6d')](_0xf54a('0x70'),_0xf54a('0x53'))[_0xf54a('0x6d')](_0xf54a('0x70'),'updatedAt')[_0xf54a('0x71')](_0xf54a('0x72'))[_0xf54a('0x3d')](_0xf54a('0x73'))[_0xf54a('0x3d')](_0xf54a('0x7c'),_0x221347[_0xf54a('0x6e')][_0xf54a('0x6f')]())[_0xf54a('0x3d')](_0xf54a('0x74'))[_0xf54a('0x3d')](_0xf54a('0x75'),squel['select']()['field'](_0xf54a('0x78'))['from']('cm_hopper')[_0xf54a('0x3d')](_0xf54a('0x7a'),_0x59f41f[_0xf54a('0x47')]['id'][_0xf54a('0x6f')]())))['toString']();break;default:_0xe39e94=squel[_0xf54a('0x66')]()[_0xf54a('0x67')]('cm_hopper')['fromQuery']([_0xf54a('0x68'),'scheduledAt',_0xf54a('0x6a'),'ListId',_0xf54a('0x59'),_0xf54a('0x53'),_0xf54a('0x54')],squel[_0xf54a('0x6c')]()[_0xf54a('0x6d')]('phone',_0xf54a('0x68'))['field'](_0xf54a('0x70'),_0xf54a('0x69'))[_0xf54a('0x6d')]('id',_0xf54a('0x6a'))[_0xf54a('0x6d')](_0x221347[_0xf54a('0x6e')][_0xf54a('0x6f')](),_0xf54a('0x6b'))[_0xf54a('0x6d')](_0x59f41f['params']['id']['toString'](),'CampaignId')[_0xf54a('0x6d')](_0xf54a('0x70'),_0xf54a('0x53'))[_0xf54a('0x6d')](_0xf54a('0x70'),'updatedAt')['from'](_0xf54a('0x72'))[_0xf54a('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x221347[_0xf54a('0x6e')][_0xf54a('0x6f')]())[_0xf54a('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x1433c4[_0xf54a('0x7d')](db[_0xf54a('0x7e')][_0xf54a('0x2f')](_0xe39e94));}return BPromise[_0xf54a('0x7f')](_0x1433c4);}})['then'](function(){return _0x59308f;})[_0xf54a('0x21')](respondWithResult(_0x2541fa,null))['catch'](handleError(_0x2541fa,null));};exports[_0xf54a('0x80')]=function(_0xfcff58,_0xcf3af4,_0x35f3a1){return db[_0xf54a('0x2a')][_0xf54a('0x4d')]({'where':{'id':_0xfcff58[_0xf54a('0x47')]['id']}})[_0xf54a('0x21')](handleEntityNotFound(_0xcf3af4,null))['then'](function(_0x3099bb){if(_0x3099bb){return _0x3099bb['removeLists'](_0xfcff58[_0xf54a('0x2f')][_0xf54a('0x62')]);}})['then'](function(_0x53f479){if(_0x53f479){return db[_0xf54a('0x5a')][_0xf54a('0x22')]({'where':{'ListId':_0xfcff58[_0xf54a('0x2f')][_0xf54a('0x62')],'CampaignId':_0xfcff58[_0xf54a('0x47')]['id']}})[_0xf54a('0x21')](function(){return _0x53f479;});}})['then'](respondWithStatusCode(_0xcf3af4,null))[_0xf54a('0x45')](handleError(_0xcf3af4,null));};exports[_0xf54a('0x81')]=function(_0x599f59,_0x580c69,_0x3e8f06){var _0x1157ea={};var _0x17c520={};var _0x89ff65;var _0x857bdc;return db[_0xf54a('0x2a')]['findOne']({'where':{'id':_0x599f59['params']['id']}})['then'](handleEntityNotFound(_0x580c69,null))[_0xf54a('0x21')](function(_0x3d237c){if(_0x3d237c){_0x89ff65=_0x3d237c;_0x17c520[_0xf54a('0x33')]=_[_0xf54a('0x30')](db['CmList'][_0xf54a('0x2b')]);_0x17c520['query']=_['keys'](_0x599f59[_0xf54a('0x2f')]);_0x17c520[_0xf54a('0x31')]=_[_0xf54a('0x32')](_0x17c520[_0xf54a('0x33')],_0x17c520['query']);_0x1157ea[_0xf54a('0x34')]=_[_0xf54a('0x32')](_0x17c520[_0xf54a('0x33')],qs[_0xf54a('0x35')](_0x599f59['query'][_0xf54a('0x35')]));_0x1157ea[_0xf54a('0x34')]=_0x1157ea['attributes'][_0xf54a('0x36')]?_0x1157ea[_0xf54a('0x34')]:_0x17c520['model'];_0x1157ea[_0xf54a('0x39')]=qs[_0xf54a('0x3a')](_0x599f59[_0xf54a('0x2f')][_0xf54a('0x3a')]);_0x1157ea['where']=qs[_0xf54a('0x31')](_[_0xf54a('0x3b')](_0x599f59[_0xf54a('0x2f')],_0x17c520[_0xf54a('0x31')]));if(_0x599f59[_0xf54a('0x2f')][_0xf54a('0x3c')]){_0x1157ea[_0xf54a('0x3d')]=_[_0xf54a('0x3e')](_0x1157ea[_0xf54a('0x3d')],{'$or':_['map'](_0x1157ea['attributes'],function(_0x13d023){var _0x42c5fa={};_0x42c5fa[_0x13d023]={'$like':'%'+_0x599f59[_0xf54a('0x2f')][_0xf54a('0x3c')]+'%'};return _0x42c5fa;})});}_0x1157ea=_[_0xf54a('0x3e')]({},_0x1157ea,_0x599f59[_0xf54a('0x40')]);return _0x89ff65['getBlackLists'](_0x1157ea);}})[_0xf54a('0x21')](function(_0x5992ea){if(_0x5992ea){_0x857bdc=_0x5992ea[_0xf54a('0x36')];if(!_0x599f59['query'][_0xf54a('0x37')]('nolimit')){_0x1157ea[_0xf54a('0x1a')]=qs[_0xf54a('0x1a')](_0x599f59[_0xf54a('0x2f')][_0xf54a('0x1a')]);_0x1157ea['offset']=qs[_0xf54a('0x18')](_0x599f59['query'][_0xf54a('0x18')]);}return _0x89ff65[_0xf54a('0x81')](_0x1157ea);}})[_0xf54a('0x21')](function(_0x72b2d3){if(_0x72b2d3){return _0x72b2d3?{'count':_0x857bdc,'rows':_0x72b2d3}:null;}})[_0xf54a('0x21')](respondWithResult(_0x580c69,null))[_0xf54a('0x45')](handleError(_0x580c69,null));};exports[_0xf54a('0x82')]=function(_0x13c205,_0x4fdfb5,_0x32715f){var _0x9bb1e8,_0x18bb4d;return db[_0xf54a('0x2a')]['find']({'where':{'id':_0x13c205[_0xf54a('0x47')]['id']}})[_0xf54a('0x21')](handleEntityNotFound(_0x4fdfb5,null))['then'](function(_0x25057e){if(_0x25057e){_0x18bb4d=_0x25057e;return _0x25057e[_0xf54a('0x82')](_0x13c205[_0xf54a('0x49')][_0xf54a('0x62')],_[_0xf54a('0x52')](_0x13c205[_0xf54a('0x49')],[_0xf54a('0x62'),'id'])||{});}return null;})['spread'](function(_0x503122){var _0x338295;_0x9bb1e8=_0x503122||[];var _0x480983=[];if(_0x503122){for(var _0x845359=0x0;_0x845359<_0x503122['length'];_0x845359+=0x1){var _0x552b40=_0x503122[_0x845359]['get']({'plain':!![]});_0x338295=squel[_0xf54a('0x66')]()['into'](_0xf54a('0x83'))[_0xf54a('0x7b')]([_0xf54a('0x68'),_0xf54a('0x6a'),'ListId',_0xf54a('0x59'),'createdAt','updatedAt'],squel['select']()['field'](_0xf54a('0x68'),_0xf54a('0x68'))[_0xf54a('0x6d')]('id',_0xf54a('0x6a'))[_0xf54a('0x6d')](_0x552b40[_0xf54a('0x6e')][_0xf54a('0x6f')](),_0xf54a('0x6b'))['field'](_0x13c205[_0xf54a('0x47')]['id'][_0xf54a('0x6f')](),_0xf54a('0x59'))[_0xf54a('0x6d')]('NOW()',_0xf54a('0x53'))[_0xf54a('0x6d')]('NOW()','updatedAt')[_0xf54a('0x71')](_0xf54a('0x72'))['where'](_0xf54a('0x73'))[_0xf54a('0x3d')](_0xf54a('0x7c'),_0x552b40['CmListId'][_0xf54a('0x6f')]())[_0xf54a('0x3d')](_0xf54a('0x74')))[_0xf54a('0x6f')]();_0x480983[_0xf54a('0x7d')](db[_0xf54a('0x7e')][_0xf54a('0x2f')](_0x338295));}return BPromise[_0xf54a('0x7f')](_0x480983);}})[_0xf54a('0x21')](function(){return _0x9bb1e8;})[_0xf54a('0x21')](respondWithResult(_0x4fdfb5,null))[_0xf54a('0x45')](handleError(_0x4fdfb5,null));};exports['removeBlackLists']=function(_0x59185d,_0x324086,_0x2f5706){return db[_0xf54a('0x2a')][_0xf54a('0x4d')]({'where':{'id':_0x59185d[_0xf54a('0x47')]['id']}})[_0xf54a('0x21')](handleEntityNotFound(_0x324086,null))[_0xf54a('0x21')](function(_0x26fc75){if(_0x26fc75){return _0x26fc75[_0xf54a('0x84')](_0x59185d['query'][_0xf54a('0x62')]);}})[_0xf54a('0x21')](function(_0x5adc8c){if(_0x5adc8c){return db[_0xf54a('0x5e')][_0xf54a('0x22')]({'where':{'ListId':_0x59185d[_0xf54a('0x2f')][_0xf54a('0x62')],'CampaignId':_0x59185d[_0xf54a('0x47')]['id']}})['then'](function(){return _0x5adc8c;});}})[_0xf54a('0x21')](respondWithStatusCode(_0x324086,null))['catch'](handleError(_0x324086,null));}; \ No newline at end of file +var _0x1271=['to-csv','fs-extra','crypto','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','params','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','phone','scheduledAt','select','field','NOW()','ContactId','CmListId','toString','ListId','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','fromQuery','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x52ecd0,_0x4bea49){var _0x588d37=function(_0xf78a8d){while(--_0xf78a8d){_0x52ecd0['push'](_0x52ecd0['shift']());}};_0x588d37(++_0x4bea49);}(_0x1271,0x18b));var _0x1127=function(_0x5c633,_0x22508b){_0x5c633=_0x5c633-0x0;var _0x3ae88b=_0x1271[_0x5c633];return _0x3ae88b;};'use strict';var emlformat=require(_0x1127('0x0'));var rimraf=require(_0x1127('0x1'));var zipdir=require(_0x1127('0x2'));var jsonpatch=require(_0x1127('0x3'));var rp=require(_0x1127('0x4'));var moment=require(_0x1127('0x5'));var BPromise=require(_0x1127('0x6'));var Mustache=require('mustache');var util=require(_0x1127('0x7'));var path=require(_0x1127('0x8'));var sox=require(_0x1127('0x9'));var csv=require(_0x1127('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1127('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1127('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1127('0xd'));var toCsv=require(_0x1127('0xa'));var querystring=require('querystring');var Papa=require(_0x1127('0xe'));var Redis=require('ioredis');var authService=require(_0x1127('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1127('0x10'))(_0x1127('0x11'));var utils=require(_0x1127('0x12'));var config=require(_0x1127('0x13'));var licenseUtil=require(_0x1127('0x14'));var db=require(_0x1127('0x15'))['db'];function respondWithStatusCode(_0x37429d,_0x26f7f8){_0x26f7f8=_0x26f7f8||0xcc;return function(_0x4d70e5){if(_0x4d70e5){return _0x37429d[_0x1127('0x16')](_0x26f7f8);}return _0x37429d[_0x1127('0x17')](_0x26f7f8)['end']();};}function respondWithResult(_0xbc867e,_0xde0522){_0xde0522=_0xde0522||0xc8;return function(_0x55c651){if(_0x55c651){return _0xbc867e[_0x1127('0x17')](_0xde0522)[_0x1127('0x18')](_0x55c651);}};}function respondWithFilteredResult(_0x3ecd75,_0x238c89){return function(_0x40fc32){if(_0x40fc32){var _0x50581e=typeof _0x238c89[_0x1127('0x19')]===_0x1127('0x1a')&&typeof _0x238c89[_0x1127('0x1b')]===_0x1127('0x1a');var _0x3100a2=_0x40fc32['count'];var _0x37a0c9=_0x50581e?0x0:_0x238c89[_0x1127('0x19')];var _0x8c0bf2=_0x50581e?_0x40fc32[_0x1127('0x1c')]:_0x238c89[_0x1127('0x19')]+_0x238c89[_0x1127('0x1b')];var _0x5424e6;if(_0x8c0bf2>=_0x3100a2){_0x8c0bf2=_0x3100a2;_0x5424e6=0xc8;}else{_0x5424e6=0xce;}_0x3ecd75[_0x1127('0x17')](_0x5424e6);return _0x3ecd75[_0x1127('0x1d')](_0x1127('0x1e'),_0x37a0c9+'-'+_0x8c0bf2+'/'+_0x3100a2)[_0x1127('0x18')](_0x40fc32);}return null;};}function patchUpdates(_0x481108){return function(_0x3862d0){try{jsonpatch[_0x1127('0x1f')](_0x3862d0,_0x481108,!![]);}catch(_0x372a5e){return BPromise['reject'](_0x372a5e);}return _0x3862d0[_0x1127('0x20')]();};}function saveUpdates(_0x1d2f82,_0xb2a103){return function(_0x86314c){if(_0x86314c){return _0x86314c[_0x1127('0x21')](_0x1d2f82)[_0x1127('0x22')](function(_0x37f884){return _0x37f884;});}return null;};}function removeEntity(_0xc09086,_0x5ea41f){return function(_0x2d0d7a){if(_0x2d0d7a){return _0x2d0d7a['destroy']()['then'](function(){var _0x2a24b9=_0x2d0d7a['get']({'plain':!![]});var _0x3fc7e0=_0x1127('0x23');return db[_0x1127('0x24')][_0x1127('0x25')]({'where':{'type':_0x3fc7e0,'resourceId':_0x2a24b9['id']}})['then'](function(){return _0x2d0d7a;});})[_0x1127('0x22')](function(){_0xc09086['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59d0de,_0x2607eb){return function(_0x4a6928){if(!_0x4a6928){_0x59d0de[_0x1127('0x16')](0x194);}return _0x4a6928;};}function handleError(_0x728cc1,_0x44c99e){_0x44c99e=_0x44c99e||0x1f4;return function(_0x1443f7){logger[_0x1127('0x26')](_0x1443f7[_0x1127('0x27')]);if(_0x1443f7[_0x1127('0x28')]){delete _0x1443f7[_0x1127('0x28')];}_0x728cc1[_0x1127('0x17')](_0x44c99e)[_0x1127('0x29')](_0x1443f7);};}exports[_0x1127('0x2a')]=function(_0x3f14aa,_0x31af48){var _0xf6685b={},_0x4f0838={},_0x1ac8c8={'count':0x0,'rows':[]};var _0x38bc8a=_[_0x1127('0x2b')](db[_0x1127('0x2c')][_0x1127('0x2d')],function(_0x4d62cc){return{'name':_0x4d62cc[_0x1127('0x2e')],'type':_0x4d62cc[_0x1127('0x2f')][_0x1127('0x30')]};});_0x4f0838[_0x1127('0x31')]=_[_0x1127('0x2b')](_0x38bc8a,_0x1127('0x28'));_0x4f0838[_0x1127('0x32')]=_['keys'](_0x3f14aa[_0x1127('0x32')]);_0x4f0838[_0x1127('0x33')]=_[_0x1127('0x34')](_0x4f0838['model'],_0x4f0838[_0x1127('0x32')]);_0xf6685b[_0x1127('0x35')]=_[_0x1127('0x34')](_0x4f0838['model'],qs[_0x1127('0x36')](_0x3f14aa[_0x1127('0x32')]['fields']));_0xf6685b[_0x1127('0x35')]=_0xf6685b['attributes'][_0x1127('0x37')]?_0xf6685b[_0x1127('0x35')]:_0x4f0838['model'];if(!_0x3f14aa[_0x1127('0x32')][_0x1127('0x38')](_0x1127('0x39'))){_0xf6685b[_0x1127('0x1b')]=qs[_0x1127('0x1b')](_0x3f14aa[_0x1127('0x32')][_0x1127('0x1b')]);_0xf6685b[_0x1127('0x19')]=qs[_0x1127('0x19')](_0x3f14aa[_0x1127('0x32')][_0x1127('0x19')]);}_0xf6685b[_0x1127('0x3a')]=qs[_0x1127('0x3b')](_0x3f14aa[_0x1127('0x32')][_0x1127('0x3b')]);_0xf6685b[_0x1127('0x3c')]=qs[_0x1127('0x33')](_[_0x1127('0x3d')](_0x3f14aa[_0x1127('0x32')],_0x4f0838[_0x1127('0x33')]),_0x38bc8a);if(_0x3f14aa[_0x1127('0x32')][_0x1127('0x3e')]){_0xf6685b[_0x1127('0x3c')]=_[_0x1127('0x3f')](_0xf6685b[_0x1127('0x3c')],{'$or':_['map'](_0x38bc8a,function(_0x7308b7){if(_0x7308b7[_0x1127('0x2f')]!=='VIRTUAL'){var _0x1d6026={};_0x1d6026[_0x7308b7[_0x1127('0x28')]]={'$like':'%'+_0x3f14aa['query']['filter']+'%'};return _0x1d6026;}})});}_0xf6685b=_[_0x1127('0x3f')]({},_0xf6685b,_0x3f14aa[_0x1127('0x40')]);var _0xf7ecd2={'where':_0xf6685b[_0x1127('0x3c')]};return db[_0x1127('0x2c')]['count'](_0xf7ecd2)['then'](function(_0x3b5676){_0x1ac8c8[_0x1127('0x1c')]=_0x3b5676;if(_0x3f14aa[_0x1127('0x32')]['includeAll']){_0xf6685b[_0x1127('0x41')]=[{'all':!![]}];}return db[_0x1127('0x2c')][_0x1127('0x42')](_0xf6685b);})[_0x1127('0x22')](function(_0x36e70e){_0x1ac8c8[_0x1127('0x43')]=_0x36e70e;return _0x1ac8c8;})[_0x1127('0x22')](respondWithFilteredResult(_0x31af48,_0xf6685b))['catch'](handleError(_0x31af48,null));};exports['show']=function(_0x56bd8c,_0x3056eb){var _0x31943e={'raw':![],'where':{'id':_0x56bd8c['params']['id']}},_0x2dc6c2={};_0x2dc6c2['model']=_['keys'](db[_0x1127('0x2c')][_0x1127('0x2d')]);_0x2dc6c2[_0x1127('0x32')]=_[_0x1127('0x44')](_0x56bd8c[_0x1127('0x32')]);_0x2dc6c2['filters']=_['intersection'](_0x2dc6c2[_0x1127('0x31')],_0x2dc6c2[_0x1127('0x32')]);_0x31943e[_0x1127('0x35')]=_[_0x1127('0x34')](_0x2dc6c2[_0x1127('0x31')],qs[_0x1127('0x36')](_0x56bd8c[_0x1127('0x32')][_0x1127('0x36')]));_0x31943e[_0x1127('0x35')]=_0x31943e[_0x1127('0x35')][_0x1127('0x37')]?_0x31943e[_0x1127('0x35')]:_0x2dc6c2[_0x1127('0x31')];if(_0x56bd8c[_0x1127('0x32')][_0x1127('0x45')]){_0x31943e['include']=[{'all':!![]}];}_0x31943e=_[_0x1127('0x3f')]({},_0x31943e,_0x56bd8c['options']);return db[_0x1127('0x2c')][_0x1127('0x46')](_0x31943e)[_0x1127('0x22')](handleEntityNotFound(_0x3056eb,null))[_0x1127('0x22')](respondWithResult(_0x3056eb,null))['catch'](handleError(_0x3056eb,null));};exports[_0x1127('0x47')]=function(_0x330e59,_0x25099d){return db[_0x1127('0x2c')][_0x1127('0x47')](_0x330e59[_0x1127('0x48')],{})[_0x1127('0x22')](function(_0x3df9de){var _0x58ff0d=_0x330e59[_0x1127('0x49')]['get']({'plain':!![]});if(!_0x58ff0d)throw new Error(_0x1127('0x4a'));if(_0x58ff0d[_0x1127('0x4b')]==='user'){var _0x11437e=_0x3df9de[_0x1127('0x4c')]({'plain':!![]});var _0x5e4e58=_0x1127('0x23');return db[_0x1127('0x4d')]['find']({'where':{'name':_0x5e4e58,'userProfileId':_0x58ff0d[_0x1127('0x4e')]},'raw':!![]})['then'](function(_0x4c2bf3){if(_0x4c2bf3&&_0x4c2bf3[_0x1127('0x4f')]===0x0){return db['UserProfileResource'][_0x1127('0x47')]({'name':_0x11437e[_0x1127('0x28')],'resourceId':_0x11437e['id'],'type':_0x4c2bf3['name'],'sectionId':_0x4c2bf3['id']},{})[_0x1127('0x22')](function(){return _0x3df9de;});}else{return _0x3df9de;}})[_0x1127('0x50')](function(_0x43574e){logger['error'](_0x1127('0x51'),_0x43574e);throw _0x43574e;});}return _0x3df9de;})[_0x1127('0x22')](respondWithResult(_0x25099d,0xc9))[_0x1127('0x50')](handleError(_0x25099d,null));};exports[_0x1127('0x52')]=function(_0x236684,_0x2876e8){var _0x5368f1={'where':{'id':_0x236684['params']['id']}},_0x5dcd7f={};_0x5dcd7f[_0x1127('0x31')]=_[_0x1127('0x44')](db[_0x1127('0x2c')][_0x1127('0x2d')]);_0x5368f1['attributes']=_[_0x1127('0x34')](_0x5dcd7f[_0x1127('0x31')],qs[_0x1127('0x36')](_0x236684['query'][_0x1127('0x36')]));_0x5368f1[_0x1127('0x35')]=_0x5368f1['attributes'][_0x1127('0x37')]?_0x5368f1[_0x1127('0x35')]:_0x5dcd7f[_0x1127('0x31')];if(_0x236684[_0x1127('0x32')]['includeAll']){_0x5368f1[_0x1127('0x41')]=[{'all':!![]}];}_0x5368f1=_[_0x1127('0x3f')]({},_0x5368f1,_0x236684[_0x1127('0x40')]);return db[_0x1127('0x2c')][_0x1127('0x46')](_0x5368f1)[_0x1127('0x22')](handleEntityNotFound(_0x2876e8,null))[_0x1127('0x22')](function(_0x397ff4){if(_0x397ff4){var _0x2493d0=_0x397ff4[_0x1127('0x4c')]({'plain':!![]});_0x2493d0=qs[_0x1127('0x53')](_0x2493d0,['id',_0x1127('0x54'),'updatedAt']);_0x236684[_0x1127('0x48')]=_['omit'](_0x236684[_0x1127('0x48')],['id',_0x1127('0x54'),'updatedAt']);return db[_0x1127('0x2c')][_0x1127('0x47')](_[_0x1127('0x3f')](_0x2493d0,_0x236684[_0x1127('0x48')]),{'include':_0x236684[_0x1127('0x32')][_0x1127('0x45')]?[{'all':!![]}]:undefined})[_0x1127('0x22')](function(_0x504615){var _0x504f17=_0x236684[_0x1127('0x49')][_0x1127('0x4c')]({'plain':!![]});if(!_0x504f17)throw new Error(_0x1127('0x4a'));if(_0x504f17[_0x1127('0x4b')]===_0x1127('0x49')){var _0x30fdc4=_0x504615[_0x1127('0x4c')]({'plain':!![]});var _0x2c481a=_0x1127('0x23');return db[_0x1127('0x4d')][_0x1127('0x46')]({'where':{'name':_0x2c481a,'userProfileId':_0x504f17[_0x1127('0x4e')]},'raw':!![]})[_0x1127('0x22')](function(_0x5ce2dd){if(_0x5ce2dd&&_0x5ce2dd[_0x1127('0x4f')]===0x0){return db['UserProfileResource'][_0x1127('0x47')]({'name':_0x30fdc4['name'],'resourceId':_0x30fdc4['id'],'type':_0x5ce2dd[_0x1127('0x28')],'sectionId':_0x5ce2dd['id']},{})['then'](function(){return _0x504615;});}else{return _0x504615;}})[_0x1127('0x50')](function(_0x2b78a0){logger[_0x1127('0x26')](_0x1127('0x51'),_0x2b78a0);throw _0x2b78a0;});}return _0x504615;});}})['then'](respondWithResult(_0x2876e8,0xc9))['catch'](handleError(_0x2876e8,null));};exports[_0x1127('0x21')]=function(_0x44dc3e,_0x421d58){if(_0x44dc3e['body']['id']){delete _0x44dc3e[_0x1127('0x48')]['id'];}return db[_0x1127('0x2c')]['find']({'where':{'id':_0x44dc3e[_0x1127('0x55')]['id']}})[_0x1127('0x22')](handleEntityNotFound(_0x421d58,null))[_0x1127('0x22')](saveUpdates(_0x44dc3e['body'],null))['then'](respondWithResult(_0x421d58,null))[_0x1127('0x50')](handleError(_0x421d58,null));};exports[_0x1127('0x25')]=function(_0x2b9fbc,_0x28601b){return db[_0x1127('0x2c')]['find']({'where':{'id':_0x2b9fbc[_0x1127('0x55')]['id']}})[_0x1127('0x22')](handleEntityNotFound(_0x28601b,null))[_0x1127('0x22')](removeEntity(_0x28601b,null))[_0x1127('0x50')](handleError(_0x28601b,null));};exports[_0x1127('0x56')]=function(_0x21580e,_0x56fc0b,_0x14e984){var _0x3c7c73={'raw':!![],'where':{}};var _0x3b629f={};var _0x4c4a23={'count':0x0,'rows':[]};return db[_0x1127('0x2c')][_0x1127('0x57')]({'where':{'id':_0x21580e[_0x1127('0x55')]['id']}})[_0x1127('0x22')](handleEntityNotFound(_0x56fc0b,null))[_0x1127('0x22')](function(_0x167b49){if(_0x167b49){_0x3b629f['model']=_[_0x1127('0x44')](db[_0x1127('0x58')]['rawAttributes']);_0x3b629f[_0x1127('0x32')]=_[_0x1127('0x44')](_0x21580e['query']);_0x3b629f[_0x1127('0x33')]=_[_0x1127('0x34')](_0x3b629f[_0x1127('0x31')],_0x3b629f[_0x1127('0x32')]);_0x3c7c73[_0x1127('0x35')]=_['intersection'](_0x3b629f['model'],qs[_0x1127('0x36')](_0x21580e[_0x1127('0x32')][_0x1127('0x36')]));_0x3c7c73[_0x1127('0x35')]=_0x3c7c73[_0x1127('0x35')]['length']?_0x3c7c73[_0x1127('0x35')]:_0x3b629f[_0x1127('0x31')];if(!_0x21580e[_0x1127('0x32')][_0x1127('0x38')](_0x1127('0x39'))){_0x3c7c73[_0x1127('0x1b')]=qs[_0x1127('0x1b')](_0x21580e[_0x1127('0x32')][_0x1127('0x1b')]);_0x3c7c73[_0x1127('0x19')]=qs[_0x1127('0x19')](_0x21580e[_0x1127('0x32')]['offset']);}_0x3c7c73[_0x1127('0x3a')]=qs[_0x1127('0x3b')](_0x21580e['query'][_0x1127('0x3b')]);_0x3c7c73['where']=qs['filters'](_[_0x1127('0x3d')](_0x21580e[_0x1127('0x32')],_0x3b629f['filters']));_0x3c7c73[_0x1127('0x3c')][_0x1127('0x59')]=_0x167b49['id'];if(_0x21580e[_0x1127('0x32')]['filter']){_0x3c7c73['where']=_[_0x1127('0x3f')](_0x3c7c73[_0x1127('0x3c')],{'$or':_[_0x1127('0x2b')](_0x3c7c73['attributes'],function(_0x5353e1){var _0x460788={};_0x460788[_0x5353e1]={'$like':'%'+_0x21580e[_0x1127('0x32')][_0x1127('0x3e')]+'%'};return _0x460788;})});}_0x3c7c73=_[_0x1127('0x3f')]({},_0x3c7c73,_0x21580e[_0x1127('0x40')]);return db[_0x1127('0x58')][_0x1127('0x1c')]({'where':_0x3c7c73[_0x1127('0x3c')]})[_0x1127('0x22')](function(_0x3fae61){_0x4c4a23['count']=_0x3fae61;if(_0x21580e[_0x1127('0x32')][_0x1127('0x45')]){_0x3c7c73['include']=[{'all':!![]}];}return db[_0x1127('0x58')][_0x1127('0x42')](_0x3c7c73);})['then'](function(_0x4c7cb6){_0x4c4a23[_0x1127('0x43')]=_0x4c7cb6;return _0x4c4a23;});}})[_0x1127('0x22')](respondWithFilteredResult(_0x56fc0b,_0x3c7c73))[_0x1127('0x50')](handleError(_0x56fc0b,null));};exports[_0x1127('0x5a')]=function(_0x306f71,_0x365e8e,_0x2adfef){var _0x43b809={'raw':!![],'where':{}};var _0x24c7e4={};var _0x2d1d1a={'count':0x0,'rows':[]};return db[_0x1127('0x2c')][_0x1127('0x57')]({'where':{'id':_0x306f71[_0x1127('0x55')]['id']}})['then'](handleEntityNotFound(_0x365e8e,null))['then'](function(_0x1cc9b5){if(_0x1cc9b5){_0x24c7e4[_0x1127('0x31')]=_['keys'](db[_0x1127('0x5b')][_0x1127('0x2d')]);_0x24c7e4[_0x1127('0x32')]=_[_0x1127('0x44')](_0x306f71[_0x1127('0x32')]);_0x24c7e4[_0x1127('0x33')]=_['intersection'](_0x24c7e4[_0x1127('0x31')],_0x24c7e4['query']);_0x43b809[_0x1127('0x35')]=_[_0x1127('0x34')](_0x24c7e4['model'],qs[_0x1127('0x36')](_0x306f71[_0x1127('0x32')][_0x1127('0x36')]));_0x43b809['attributes']=_0x43b809['attributes'][_0x1127('0x37')]?_0x43b809[_0x1127('0x35')]:_0x24c7e4['model'];if(!_0x306f71[_0x1127('0x32')][_0x1127('0x38')](_0x1127('0x39'))){_0x43b809[_0x1127('0x1b')]=qs[_0x1127('0x1b')](_0x306f71[_0x1127('0x32')][_0x1127('0x1b')]);_0x43b809['offset']=qs['offset'](_0x306f71[_0x1127('0x32')]['offset']);}_0x43b809[_0x1127('0x3a')]=qs[_0x1127('0x3b')](_0x306f71[_0x1127('0x32')][_0x1127('0x3b')]);_0x43b809[_0x1127('0x3c')]=qs[_0x1127('0x33')](_[_0x1127('0x3d')](_0x306f71[_0x1127('0x32')],_0x24c7e4[_0x1127('0x33')]));_0x43b809[_0x1127('0x3c')]['CampaignId']=_0x1cc9b5['id'];if(_0x306f71[_0x1127('0x32')][_0x1127('0x3e')]){_0x43b809[_0x1127('0x3c')]=_[_0x1127('0x3f')](_0x43b809[_0x1127('0x3c')],{'$or':_[_0x1127('0x2b')](_0x43b809[_0x1127('0x35')],function(_0x325f6b){var _0x1302dc={};_0x1302dc[_0x325f6b]={'$like':'%'+_0x306f71['query'][_0x1127('0x3e')]+'%'};return _0x1302dc;})});}_0x43b809=_[_0x1127('0x3f')]({},_0x43b809,_0x306f71[_0x1127('0x40')]);return db[_0x1127('0x5b')]['count']({'where':_0x43b809[_0x1127('0x3c')]})[_0x1127('0x22')](function(_0x44bd04){_0x2d1d1a[_0x1127('0x1c')]=_0x44bd04;if(_0x306f71['query'][_0x1127('0x45')]){_0x43b809[_0x1127('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1127('0x42')](_0x43b809);})[_0x1127('0x22')](function(_0x1b771b){_0x2d1d1a[_0x1127('0x43')]=_0x1b771b;return _0x2d1d1a;});}})['then'](respondWithFilteredResult(_0x365e8e,_0x43b809))[_0x1127('0x50')](handleError(_0x365e8e,null));};exports[_0x1127('0x5c')]=function(_0x589de9,_0x2eabd9,_0x1c818b){var _0x1b3fd3={'raw':!![],'where':{}};var _0x41469d={};var _0x4b7328={'count':0x0,'rows':[]};return db[_0x1127('0x2c')][_0x1127('0x57')]({'where':{'id':_0x589de9[_0x1127('0x55')]['id']}})['then'](handleEntityNotFound(_0x2eabd9,null))['then'](function(_0x1c88de){if(_0x1c88de){_0x41469d[_0x1127('0x31')]=_['keys'](db[_0x1127('0x5d')][_0x1127('0x2d')]);_0x41469d[_0x1127('0x32')]=_[_0x1127('0x44')](_0x589de9[_0x1127('0x32')]);_0x41469d['filters']=_[_0x1127('0x34')](_0x41469d[_0x1127('0x31')],_0x41469d[_0x1127('0x32')]);_0x1b3fd3['attributes']=_['intersection'](_0x41469d[_0x1127('0x31')],qs[_0x1127('0x36')](_0x589de9[_0x1127('0x32')][_0x1127('0x36')]));_0x1b3fd3[_0x1127('0x35')]=_0x1b3fd3[_0x1127('0x35')][_0x1127('0x37')]?_0x1b3fd3['attributes']:_0x41469d[_0x1127('0x31')];if(!_0x589de9['query'][_0x1127('0x38')]('nolimit')){_0x1b3fd3[_0x1127('0x1b')]=qs[_0x1127('0x1b')](_0x589de9[_0x1127('0x32')]['limit']);_0x1b3fd3['offset']=qs['offset'](_0x589de9[_0x1127('0x32')]['offset']);}_0x1b3fd3[_0x1127('0x3a')]=qs[_0x1127('0x3b')](_0x589de9[_0x1127('0x32')]['sort']);_0x1b3fd3[_0x1127('0x3c')]=qs[_0x1127('0x33')](_[_0x1127('0x3d')](_0x589de9[_0x1127('0x32')],_0x41469d['filters']));_0x1b3fd3[_0x1127('0x3c')][_0x1127('0x59')]=_0x1c88de['id'];if(_0x589de9[_0x1127('0x32')][_0x1127('0x3e')]){_0x1b3fd3[_0x1127('0x3c')]=_[_0x1127('0x3f')](_0x1b3fd3[_0x1127('0x3c')],{'$or':_[_0x1127('0x2b')](_0x1b3fd3[_0x1127('0x35')],function(_0x76af79){var _0x48fd82={};_0x48fd82[_0x76af79]={'$like':'%'+_0x589de9[_0x1127('0x32')][_0x1127('0x3e')]+'%'};return _0x48fd82;})});}_0x1b3fd3=_['merge']({},_0x1b3fd3,_0x589de9['options']);return db[_0x1127('0x5d')][_0x1127('0x1c')]({'where':_0x1b3fd3[_0x1127('0x3c')]})[_0x1127('0x22')](function(_0x95b80e){_0x4b7328['count']=_0x95b80e;if(_0x589de9[_0x1127('0x32')]['includeAll']){_0x1b3fd3[_0x1127('0x41')]=[{'all':!![]}];}return db[_0x1127('0x5d')]['findAll'](_0x1b3fd3);})[_0x1127('0x22')](function(_0x20f544){_0x4b7328[_0x1127('0x43')]=_0x20f544;return _0x4b7328;});}})[_0x1127('0x22')](respondWithFilteredResult(_0x2eabd9,_0x1b3fd3))['catch'](handleError(_0x2eabd9,null));};exports[_0x1127('0x5e')]=function(_0x11dfbd,_0x4b920c,_0x5396a2){var _0x337f7={'raw':!![],'where':{}};var _0x523cb6={};var _0xd14d86={'count':0x0,'rows':[]};return db[_0x1127('0x2c')][_0x1127('0x57')]({'where':{'id':_0x11dfbd[_0x1127('0x55')]['id']}})['then'](handleEntityNotFound(_0x4b920c,null))[_0x1127('0x22')](function(_0x9d4369){if(_0x9d4369){_0x523cb6[_0x1127('0x31')]=_[_0x1127('0x44')](db[_0x1127('0x5f')][_0x1127('0x2d')]);_0x523cb6[_0x1127('0x32')]=_[_0x1127('0x44')](_0x11dfbd[_0x1127('0x32')]);_0x523cb6[_0x1127('0x33')]=_[_0x1127('0x34')](_0x523cb6[_0x1127('0x31')],_0x523cb6[_0x1127('0x32')]);_0x337f7['attributes']=_[_0x1127('0x34')](_0x523cb6['model'],qs[_0x1127('0x36')](_0x11dfbd[_0x1127('0x32')][_0x1127('0x36')]));_0x337f7[_0x1127('0x35')]=_0x337f7[_0x1127('0x35')][_0x1127('0x37')]?_0x337f7['attributes']:_0x523cb6[_0x1127('0x31')];if(!_0x11dfbd[_0x1127('0x32')][_0x1127('0x38')](_0x1127('0x39'))){_0x337f7[_0x1127('0x1b')]=qs[_0x1127('0x1b')](_0x11dfbd[_0x1127('0x32')]['limit']);_0x337f7[_0x1127('0x19')]=qs[_0x1127('0x19')](_0x11dfbd[_0x1127('0x32')][_0x1127('0x19')]);}_0x337f7[_0x1127('0x3a')]=qs[_0x1127('0x3b')](_0x11dfbd['query'][_0x1127('0x3b')]);_0x337f7[_0x1127('0x3c')]=qs[_0x1127('0x33')](_['pick'](_0x11dfbd[_0x1127('0x32')],_0x523cb6[_0x1127('0x33')]));_0x337f7[_0x1127('0x3c')][_0x1127('0x59')]=_0x9d4369['id'];if(_0x11dfbd[_0x1127('0x32')]['filter']){_0x337f7[_0x1127('0x3c')]=_[_0x1127('0x3f')](_0x337f7[_0x1127('0x3c')],{'$or':_[_0x1127('0x2b')](_0x337f7['attributes'],function(_0x1197cd){var _0x47ce0e={};_0x47ce0e[_0x1197cd]={'$like':'%'+_0x11dfbd[_0x1127('0x32')][_0x1127('0x3e')]+'%'};return _0x47ce0e;})});}_0x337f7=_[_0x1127('0x3f')]({},_0x337f7,_0x11dfbd[_0x1127('0x40')]);return db[_0x1127('0x5f')][_0x1127('0x1c')]({'where':_0x337f7[_0x1127('0x3c')]})[_0x1127('0x22')](function(_0x64d296){_0xd14d86['count']=_0x64d296;if(_0x11dfbd[_0x1127('0x32')]['includeAll']){_0x337f7['include']=[{'all':!![]}];}return db[_0x1127('0x5f')]['findAll'](_0x337f7);})[_0x1127('0x22')](function(_0x4357ec){_0xd14d86['rows']=_0x4357ec;return _0xd14d86;});}})['then'](respondWithFilteredResult(_0x4b920c,_0x337f7))[_0x1127('0x50')](handleError(_0x4b920c,null));};exports['getLists']=function(_0x1d638e,_0x3f7b4d,_0x4a1889){var _0x3175d8={};var _0x3fd841={};var _0x4deabd;var _0x59a4bd;return db[_0x1127('0x2c')][_0x1127('0x57')]({'where':{'id':_0x1d638e[_0x1127('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f7b4d,null))[_0x1127('0x22')](function(_0x45ceb9){if(_0x45ceb9){_0x4deabd=_0x45ceb9;_0x3fd841[_0x1127('0x31')]=_[_0x1127('0x44')](db[_0x1127('0x60')][_0x1127('0x2d')]);_0x3fd841[_0x1127('0x32')]=_[_0x1127('0x44')](_0x1d638e[_0x1127('0x32')]);_0x3fd841[_0x1127('0x33')]=_[_0x1127('0x34')](_0x3fd841['model'],_0x3fd841['query']);_0x3175d8['attributes']=_['intersection'](_0x3fd841[_0x1127('0x31')],qs['fields'](_0x1d638e['query']['fields']));_0x3175d8['attributes']=_0x3175d8[_0x1127('0x35')]['length']?_0x3175d8[_0x1127('0x35')]:_0x3fd841['model'];_0x3175d8['order']=qs[_0x1127('0x3b')](_0x1d638e[_0x1127('0x32')][_0x1127('0x3b')]);_0x3175d8['where']=qs[_0x1127('0x33')](_[_0x1127('0x3d')](_0x1d638e['query'],_0x3fd841['filters']));if(_0x1d638e['query'][_0x1127('0x3e')]){_0x3175d8[_0x1127('0x3c')]=_[_0x1127('0x3f')](_0x3175d8[_0x1127('0x3c')],{'$or':_['map'](_0x3175d8[_0x1127('0x35')],function(_0x289543){var _0x229f5c={};_0x229f5c[_0x289543]={'$like':'%'+_0x1d638e['query']['filter']+'%'};return _0x229f5c;})});}_0x3175d8=_[_0x1127('0x3f')]({},_0x3175d8,_0x1d638e[_0x1127('0x40')]);return _0x4deabd[_0x1127('0x61')](_0x3175d8);}})['then'](function(_0x1a9897){if(_0x1a9897){_0x59a4bd=_0x1a9897[_0x1127('0x37')];if(!_0x1d638e[_0x1127('0x32')]['hasOwnProperty'](_0x1127('0x39'))){_0x3175d8['limit']=qs['limit'](_0x1d638e[_0x1127('0x32')][_0x1127('0x1b')]);_0x3175d8['offset']=qs[_0x1127('0x19')](_0x1d638e[_0x1127('0x32')][_0x1127('0x19')]);}return _0x4deabd[_0x1127('0x61')](_0x3175d8);}})['then'](function(_0x7c9592){if(_0x7c9592){return _0x7c9592?{'count':_0x59a4bd,'rows':_0x7c9592}:null;}})['then'](respondWithResult(_0x3f7b4d,null))[_0x1127('0x50')](handleError(_0x3f7b4d,null));};exports[_0x1127('0x62')]=function(_0x3d8bc9,_0x2fbab4,_0xfa3419){var _0x57654d,_0x683555;return db['Campaign'][_0x1127('0x46')]({'where':{'id':_0x3d8bc9['params']['id']}})[_0x1127('0x22')](handleEntityNotFound(_0x2fbab4,null))['then'](function(_0x4ba4f7){if(_0x4ba4f7){_0x683555=_0x4ba4f7;return _0x4ba4f7[_0x1127('0x62')](_0x3d8bc9[_0x1127('0x48')][_0x1127('0x63')],_[_0x1127('0x53')](_0x3d8bc9['body'],['ids','id'])||{});}return null;})[_0x1127('0x64')](function(_0x5c82bb){var _0x49a1b8;_0x57654d=_0x5c82bb||[];var _0x5c0710=[];if(_0x5c82bb){for(var _0x3bece3=0x0;_0x3bece3<_0x5c82bb['length'];_0x3bece3+=0x1){var _0x408116=_0x5c82bb[_0x3bece3][_0x1127('0x4c')]({'plain':!![]});_0x683555['dialCheckDuplicateType']=_0x3d8bc9['body'][_0x1127('0x65')]?_0x3d8bc9['body']['dialCheckDuplicateType']:_0x683555[_0x1127('0x65')];switch(_0x683555[_0x1127('0x65')]){case _0x1127('0x66'):_0x49a1b8=squel['insert']()['into'](_0x1127('0x67'))['fromQuery']([_0x1127('0x68'),_0x1127('0x69'),'ContactId','ListId',_0x1127('0x59'),'createdAt','updatedAt'],squel[_0x1127('0x6a')]()['field'](_0x1127('0x68'),_0x1127('0x68'))[_0x1127('0x6b')](_0x1127('0x6c'),_0x1127('0x69'))[_0x1127('0x6b')]('id',_0x1127('0x6d'))['field'](_0x408116[_0x1127('0x6e')][_0x1127('0x6f')](),_0x1127('0x70'))[_0x1127('0x6b')](_0x3d8bc9['params']['id'][_0x1127('0x6f')](),_0x1127('0x59'))[_0x1127('0x6b')]('NOW()','createdAt')[_0x1127('0x6b')]('NOW()',_0x1127('0x71'))[_0x1127('0x72')](_0x1127('0x73'))[_0x1127('0x3c')](_0x1127('0x74'))[_0x1127('0x3c')]('ListId\x20=\x20?',_0x408116[_0x1127('0x6e')][_0x1127('0x6f')]())[_0x1127('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x1127('0x3c')](_0x1127('0x75'),squel[_0x1127('0x6a')]()[_0x1127('0x6b')](_0x1127('0x76'))[_0x1127('0x72')]('cm_hopper_final')[_0x1127('0x3c')](_0x1127('0x77'),_0x3d8bc9[_0x1127('0x55')]['id'][_0x1127('0x6f')]()))[_0x1127('0x3c')](_0x1127('0x75'),squel['select']()[_0x1127('0x6b')](_0x1127('0x78'))[_0x1127('0x72')]('cm_hopper')[_0x1127('0x3c')](_0x1127('0x77'),_0x3d8bc9['params']['id'][_0x1127('0x6f')]())))['toString']();break;case _0x1127('0x79'):_0x49a1b8=squel[_0x1127('0x7a')]()[_0x1127('0x7b')](_0x1127('0x67'))[_0x1127('0x7c')]([_0x1127('0x68'),_0x1127('0x69'),'ContactId','ListId',_0x1127('0x59'),_0x1127('0x54'),'updatedAt'],squel[_0x1127('0x6a')]()[_0x1127('0x6b')](_0x1127('0x68'),_0x1127('0x68'))[_0x1127('0x6b')](_0x1127('0x6c'),_0x1127('0x69'))['field']('id',_0x1127('0x6d'))[_0x1127('0x6b')](_0x408116[_0x1127('0x6e')]['toString'](),_0x1127('0x70'))[_0x1127('0x6b')](_0x3d8bc9['params']['id'][_0x1127('0x6f')](),_0x1127('0x59'))[_0x1127('0x6b')](_0x1127('0x6c'),'createdAt')[_0x1127('0x6b')]('NOW()',_0x1127('0x71'))['from'](_0x1127('0x73'))[_0x1127('0x3c')]('deletedAt\x20IS\x20NULL')[_0x1127('0x3c')]('ListId\x20=\x20?',_0x408116[_0x1127('0x6e')][_0x1127('0x6f')]())[_0x1127('0x3c')](_0x1127('0x7d'))['where'](_0x1127('0x75'),squel[_0x1127('0x6a')]()[_0x1127('0x6b')](_0x1127('0x78'))[_0x1127('0x72')](_0x1127('0x67'))[_0x1127('0x3c')](_0x1127('0x77'),_0x3d8bc9[_0x1127('0x55')]['id'][_0x1127('0x6f')]())))[_0x1127('0x6f')]();break;default:_0x49a1b8=squel[_0x1127('0x7a')]()[_0x1127('0x7b')](_0x1127('0x67'))[_0x1127('0x7c')]([_0x1127('0x68'),_0x1127('0x69'),_0x1127('0x6d'),_0x1127('0x70'),_0x1127('0x59'),_0x1127('0x54'),_0x1127('0x71')],squel[_0x1127('0x6a')]()[_0x1127('0x6b')](_0x1127('0x68'),_0x1127('0x68'))['field'](_0x1127('0x6c'),_0x1127('0x69'))[_0x1127('0x6b')]('id',_0x1127('0x6d'))['field'](_0x408116[_0x1127('0x6e')][_0x1127('0x6f')](),_0x1127('0x70'))[_0x1127('0x6b')](_0x3d8bc9[_0x1127('0x55')]['id'][_0x1127('0x6f')](),_0x1127('0x59'))[_0x1127('0x6b')](_0x1127('0x6c'),_0x1127('0x54'))[_0x1127('0x6b')](_0x1127('0x6c'),_0x1127('0x71'))[_0x1127('0x72')](_0x1127('0x73'))['where'](_0x1127('0x74'))[_0x1127('0x3c')]('ListId\x20=\x20?',_0x408116[_0x1127('0x6e')][_0x1127('0x6f')]())[_0x1127('0x3c')](_0x1127('0x7d')))[_0x1127('0x6f')]();}_0x5c0710[_0x1127('0x7e')](db[_0x1127('0x7f')][_0x1127('0x32')](_0x49a1b8));}return BPromise[_0x1127('0x80')](_0x5c0710);}})[_0x1127('0x22')](function(){return _0x57654d;})[_0x1127('0x22')](respondWithResult(_0x2fbab4,null))[_0x1127('0x50')](handleError(_0x2fbab4,null));};exports[_0x1127('0x81')]=function(_0x5a314b,_0xaa55b0,_0x1b8107){return db['Campaign'][_0x1127('0x46')]({'where':{'id':_0x5a314b[_0x1127('0x55')]['id']}})[_0x1127('0x22')](handleEntityNotFound(_0xaa55b0,null))[_0x1127('0x22')](function(_0x30b74e){if(_0x30b74e){return _0x30b74e[_0x1127('0x81')](_0x5a314b[_0x1127('0x32')][_0x1127('0x63')]);}})[_0x1127('0x22')](function(_0x11d23b){if(_0x11d23b){return db[_0x1127('0x58')][_0x1127('0x25')]({'where':{'ListId':_0x5a314b['query'][_0x1127('0x63')],'CampaignId':_0x5a314b['params']['id']}})[_0x1127('0x22')](function(){return _0x11d23b;});}})[_0x1127('0x22')](respondWithStatusCode(_0xaa55b0,null))['catch'](handleError(_0xaa55b0,null));};exports['getBlackLists']=function(_0x5df206,_0x369f7a,_0x51aa8d){var _0x2b47be={};var _0x3be162={};var _0x5d4560;var _0x5259e2;return db[_0x1127('0x2c')][_0x1127('0x57')]({'where':{'id':_0x5df206[_0x1127('0x55')]['id']}})[_0x1127('0x22')](handleEntityNotFound(_0x369f7a,null))[_0x1127('0x22')](function(_0x1aa4ac){if(_0x1aa4ac){_0x5d4560=_0x1aa4ac;_0x3be162['model']=_[_0x1127('0x44')](db[_0x1127('0x60')][_0x1127('0x2d')]);_0x3be162[_0x1127('0x32')]=_[_0x1127('0x44')](_0x5df206['query']);_0x3be162[_0x1127('0x33')]=_[_0x1127('0x34')](_0x3be162[_0x1127('0x31')],_0x3be162[_0x1127('0x32')]);_0x2b47be[_0x1127('0x35')]=_[_0x1127('0x34')](_0x3be162[_0x1127('0x31')],qs['fields'](_0x5df206[_0x1127('0x32')][_0x1127('0x36')]));_0x2b47be[_0x1127('0x35')]=_0x2b47be['attributes']['length']?_0x2b47be[_0x1127('0x35')]:_0x3be162[_0x1127('0x31')];_0x2b47be[_0x1127('0x3a')]=qs[_0x1127('0x3b')](_0x5df206[_0x1127('0x32')]['sort']);_0x2b47be['where']=qs['filters'](_['pick'](_0x5df206[_0x1127('0x32')],_0x3be162[_0x1127('0x33')]));if(_0x5df206[_0x1127('0x32')][_0x1127('0x3e')]){_0x2b47be[_0x1127('0x3c')]=_[_0x1127('0x3f')](_0x2b47be[_0x1127('0x3c')],{'$or':_['map'](_0x2b47be[_0x1127('0x35')],function(_0x37194c){var _0x27714f={};_0x27714f[_0x37194c]={'$like':'%'+_0x5df206[_0x1127('0x32')][_0x1127('0x3e')]+'%'};return _0x27714f;})});}_0x2b47be=_[_0x1127('0x3f')]({},_0x2b47be,_0x5df206[_0x1127('0x40')]);return _0x5d4560['getBlackLists'](_0x2b47be);}})[_0x1127('0x22')](function(_0x46660c){if(_0x46660c){_0x5259e2=_0x46660c['length'];if(!_0x5df206[_0x1127('0x32')][_0x1127('0x38')](_0x1127('0x39'))){_0x2b47be[_0x1127('0x1b')]=qs[_0x1127('0x1b')](_0x5df206[_0x1127('0x32')][_0x1127('0x1b')]);_0x2b47be[_0x1127('0x19')]=qs[_0x1127('0x19')](_0x5df206[_0x1127('0x32')][_0x1127('0x19')]);}return _0x5d4560[_0x1127('0x82')](_0x2b47be);}})[_0x1127('0x22')](function(_0xa71f0b){if(_0xa71f0b){return _0xa71f0b?{'count':_0x5259e2,'rows':_0xa71f0b}:null;}})[_0x1127('0x22')](respondWithResult(_0x369f7a,null))[_0x1127('0x50')](handleError(_0x369f7a,null));};exports[_0x1127('0x83')]=function(_0x28224e,_0x3fc6ea,_0x3e0bf9){var _0x5b2c99,_0x44514b;return db[_0x1127('0x2c')][_0x1127('0x46')]({'where':{'id':_0x28224e[_0x1127('0x55')]['id']}})['then'](handleEntityNotFound(_0x3fc6ea,null))[_0x1127('0x22')](function(_0x2e618d){if(_0x2e618d){_0x44514b=_0x2e618d;return _0x2e618d[_0x1127('0x83')](_0x28224e[_0x1127('0x48')]['ids'],_[_0x1127('0x53')](_0x28224e[_0x1127('0x48')],[_0x1127('0x63'),'id'])||{});}return null;})[_0x1127('0x64')](function(_0x21ada7){var _0x3c8fdc;_0x5b2c99=_0x21ada7||[];var _0x5a469f=[];if(_0x21ada7){for(var _0x3ad1b5=0x0;_0x3ad1b5<_0x21ada7[_0x1127('0x37')];_0x3ad1b5+=0x1){var _0x5f4721=_0x21ada7[_0x3ad1b5][_0x1127('0x4c')]({'plain':!![]});_0x3c8fdc=squel['insert']()['into'](_0x1127('0x84'))[_0x1127('0x7c')](['phone',_0x1127('0x6d'),'ListId',_0x1127('0x59'),_0x1127('0x54'),_0x1127('0x71')],squel[_0x1127('0x6a')]()[_0x1127('0x6b')](_0x1127('0x68'),_0x1127('0x68'))[_0x1127('0x6b')]('id',_0x1127('0x6d'))[_0x1127('0x6b')](_0x5f4721[_0x1127('0x6e')]['toString'](),_0x1127('0x70'))[_0x1127('0x6b')](_0x28224e[_0x1127('0x55')]['id'][_0x1127('0x6f')](),_0x1127('0x59'))['field'](_0x1127('0x6c'),_0x1127('0x54'))[_0x1127('0x6b')](_0x1127('0x6c'),_0x1127('0x71'))[_0x1127('0x72')]('cm_contacts')[_0x1127('0x3c')]('deletedAt\x20IS\x20NULL')[_0x1127('0x3c')](_0x1127('0x85'),_0x5f4721['CmListId'][_0x1127('0x6f')]())['where'](_0x1127('0x7d')))[_0x1127('0x6f')]();_0x5a469f[_0x1127('0x7e')](db[_0x1127('0x7f')][_0x1127('0x32')](_0x3c8fdc));}return BPromise[_0x1127('0x80')](_0x5a469f);}})[_0x1127('0x22')](function(){return _0x5b2c99;})[_0x1127('0x22')](respondWithResult(_0x3fc6ea,null))[_0x1127('0x50')](handleError(_0x3fc6ea,null));};exports[_0x1127('0x86')]=function(_0x20e41a,_0x50db3e,_0x3d99cd){return db['Campaign'][_0x1127('0x46')]({'where':{'id':_0x20e41a['params']['id']}})[_0x1127('0x22')](handleEntityNotFound(_0x50db3e,null))['then'](function(_0x392458){if(_0x392458){return _0x392458[_0x1127('0x86')](_0x20e41a['query'][_0x1127('0x63')]);}})[_0x1127('0x22')](function(_0xef4dc9){if(_0xef4dc9){return db[_0x1127('0x5f')][_0x1127('0x25')]({'where':{'ListId':_0x20e41a['query']['ids'],'CampaignId':_0x20e41a[_0x1127('0x55')]['id']}})[_0x1127('0x22')](function(){return _0xef4dc9;});}})[_0x1127('0x22')](respondWithStatusCode(_0x50db3e,null))[_0x1127('0x50')](handleError(_0x50db3e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e75ef24..bfb2ca3 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(_0x101951,_0x42317d){var _0x114fd2=function(_0x526e20){while(--_0x526e20){_0x101951['push'](_0x101951['shift']());}};_0x114fd2(++_0x42317d);}(_0x7a54,0x106));var _0x47a5=function(_0x1196ec,_0x227fe7){_0x1196ec=_0x1196ec-0x0;var _0x150990=_0x7a54[_0x1196ec];return _0x150990;};'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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 5e808e2..e5bf22b 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 _0xb49a=['code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','options','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xb49a,0xfb));var _0xab49=function(_0x1bee7a,_0xacfa2a){_0x1bee7a=_0x1bee7a-0x0;var _0x5d69d7=_0xb49a[_0x1bee7a];return _0x5d69d7;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require(_0xab49('0x3'));var rs=require(_0xab49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x5'))['db'];var utils=require(_0xab49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xab49('0x7'));var jayson=require(_0xab49('0x8'));var client=jayson[_0xab49('0x9')][_0xab49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea72,_0x26a98a,_0xd86a5){return new BPromise(function(_0x4d4d00,_0x15f259){return client[_0xab49('0xb')](_0x57ea72,_0xd86a5)[_0xab49('0xc')](function(_0x79f764){logger[_0xab49('0xd')]('Campaign,\x20%s,\x20%s',_0x26a98a,'request\x20sent');logger[_0xab49('0xe')](_0xab49('0xf'),_0x26a98a,_0xab49('0x10'),JSON[_0xab49('0x11')](_0x79f764));if(_0x79f764[_0xab49('0x12')]){if(_0x79f764['error'][_0xab49('0x13')]===0x1f4){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x15f259(_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);}logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x4d4d00(_0x79f764['error'][_0xab49('0x15')]);}else{logger[_0xab49('0xd')](_0xab49('0x14'),_0x26a98a,_0xab49('0x10'));_0x4d4d00(_0x79f764[_0xab49('0x16')]['message']);}})[_0xab49('0x17')](function(_0x2cbcff){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x2cbcff);_0x15f259(_0x2cbcff);});});}exports[_0xab49('0x18')]=function(_0x47f977){var _0x167a2a=this;return new Promise(function(_0x24cb8f,_0x28449b){return db['Campaign']['findAll']({'raw':_0x47f977[_0xab49('0x19')]?_0x47f977[_0xab49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x47f977[_0xab49('0x19')]?_0x47f977[_0xab49('0x19')]['where']||null:null,'attributes':_0x47f977[_0xab49('0x19')]?_0x47f977['options'][_0xab49('0x1a')]||null:null,'limit':_0x47f977[_0xab49('0x19')]?_0x47f977['options']['limit']||null:null,'include':_0x47f977[_0xab49('0x19')]?_0x47f977['options'][_0xab49('0x1b')]?_['map'](_0x47f977[_0xab49('0x19')][_0xab49('0x1b')],function(_0x2ba18a){return{'model':db[_0x2ba18a['model']],'as':_0x2ba18a['as'],'attributes':_0x2ba18a[_0xab49('0x1a')],'include':_0x2ba18a['include']?_[_0xab49('0x1c')](_0x2ba18a[_0xab49('0x1b')],function(_0x5c3d71){return{'model':db[_0x5c3d71[_0xab49('0x1d')]],'as':_0x5c3d71['as'],'attributes':_0x5c3d71[_0xab49('0x1a')],'include':_0x5c3d71['include']?_['map'](_0x5c3d71[_0xab49('0x1b')],function(_0x2e0e37){return{'model':db[_0x2e0e37[_0xab49('0x1d')]],'as':_0x2e0e37['as'],'attributes':_0x2e0e37['attributes']};}):[]};}):[]};}):[]:[]})[_0xab49('0xc')](function(_0x237273){logger['info'](_0xab49('0x18'),_0x47f977);logger[_0xab49('0xe')](_0xab49('0x18'),_0x47f977,JSON['stringify'](_0x237273));_0x24cb8f(_0x237273);})[_0xab49('0x17')](function(_0x550f06){logger[_0xab49('0x12')]('GetCampaign',_0x550f06[_0xab49('0x15')],_0x47f977);_0x28449b(_0x167a2a['error'](0x1f4,_0x550f06[_0xab49('0x15')]));});});}; \ No newline at end of file +var _0x4d9e=['where','attributes','limit','include','model','map','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','Campaign','findAll','options'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x56f8f1,_0x1a97ec){_0x56f8f1=_0x56f8f1-0x0;var _0x344052=_0x4d9e[_0x56f8f1];return _0x344052;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe4d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('rpc');var config=require(_0xe4d9('0x5'));var jayson=require(_0xe4d9('0x6'));var client=jayson[_0xe4d9('0x7')][_0xe4d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125dbc,_0x32222c,_0x54a63a){return new BPromise(function(_0x36316f,_0x1d3810){return client[_0xe4d9('0x9')](_0x125dbc,_0x54a63a)[_0xe4d9('0xa')](function(_0x3f8937){logger[_0xe4d9('0xb')]('Campaign,\x20%s,\x20%s',_0x32222c,_0xe4d9('0xc'));logger[_0xe4d9('0xd')](_0xe4d9('0xe'),_0x32222c,_0xe4d9('0xc'),JSON[_0xe4d9('0xf')](_0x3f8937));if(_0x3f8937[_0xe4d9('0x10')]){if(_0x3f8937[_0xe4d9('0x10')]['code']===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x32222c,_0x3f8937['error']['message']);return _0x1d3810(_0x3f8937['error']['message']);}logger['error'](_0xe4d9('0x11'),_0x32222c,_0x3f8937[_0xe4d9('0x10')][_0xe4d9('0x12')]);return _0x36316f(_0x3f8937['error'][_0xe4d9('0x12')]);}else{logger[_0xe4d9('0xb')](_0xe4d9('0x11'),_0x32222c,_0xe4d9('0xc'));_0x36316f(_0x3f8937['result'][_0xe4d9('0x12')]);}})[_0xe4d9('0x13')](function(_0x4687f8){logger['error']('Campaign,\x20%s,\x20%s',_0x32222c,_0x4687f8);_0x1d3810(_0x4687f8);});});}exports[_0xe4d9('0x14')]=function(_0x112315){var _0x5ab3d1=this;return new Promise(function(_0x2e1490,_0x4f8dba){return db[_0xe4d9('0x15')][_0xe4d9('0x16')]({'raw':_0x112315[_0xe4d9('0x17')]?_0x112315[_0xe4d9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x112315[_0xe4d9('0x17')]?_0x112315[_0xe4d9('0x17')][_0xe4d9('0x18')]||null:null,'attributes':_0x112315[_0xe4d9('0x17')]?_0x112315[_0xe4d9('0x17')][_0xe4d9('0x19')]||null:null,'limit':_0x112315[_0xe4d9('0x17')]?_0x112315[_0xe4d9('0x17')][_0xe4d9('0x1a')]||null:null,'include':_0x112315['options']?_0x112315[_0xe4d9('0x17')][_0xe4d9('0x1b')]?_['map'](_0x112315[_0xe4d9('0x17')]['include'],function(_0x14f3d7){return{'model':db[_0x14f3d7[_0xe4d9('0x1c')]],'as':_0x14f3d7['as'],'attributes':_0x14f3d7['attributes'],'include':_0x14f3d7[_0xe4d9('0x1b')]?_[_0xe4d9('0x1d')](_0x14f3d7['include'],function(_0xc5be1b){return{'model':db[_0xc5be1b[_0xe4d9('0x1c')]],'as':_0xc5be1b['as'],'attributes':_0xc5be1b[_0xe4d9('0x19')],'include':_0xc5be1b['include']?_['map'](_0xc5be1b[_0xe4d9('0x1b')],function(_0x2846e2){return{'model':db[_0x2846e2['model']],'as':_0x2846e2['as'],'attributes':_0x2846e2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x529e2b){logger[_0xe4d9('0xb')]('GetCampaign',_0x112315);logger[_0xe4d9('0xd')](_0xe4d9('0x14'),_0x112315,JSON[_0xe4d9('0xf')](_0x529e2b));_0x2e1490(_0x529e2b);})['catch'](function(_0xec8d64){logger[_0xe4d9('0x10')](_0xe4d9('0x14'),_0xec8d64[_0xe4d9('0x12')],_0x112315);_0x4f8dba(_0x5ab3d1[_0xe4d9('0x10')](0x1f4,_0xec8d64[_0xe4d9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 225d3df..68065eb 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 _0x60a1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','show','getHoppers','/:id/hopper_histories','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','/:id/lists','addBlackLists','put','delete','/:id','destroy','removeBlackLists','exports','multer'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x60a1,0x9f));var _0x160a=function(_0x12acbc,_0x2ce996){_0x12acbc=_0x12acbc-0x0;var _0x406495=_0x60a1[_0x12acbc];return _0x406495;};'use strict';var multer=require(_0x160a('0x0'));var util=require(_0x160a('0x1'));var path=require(_0x160a('0x2'));var timeout=require(_0x160a('0x3'));var express=require(_0x160a('0x4'));var router=express[_0x160a('0x5')]();var fs_extra=require(_0x160a('0x6'));var auth=require(_0x160a('0x7'));var interaction=require(_0x160a('0x8'));var config=require('../../config/environment');var controller=require(_0x160a('0x9'));router[_0x160a('0xa')]('/',auth[_0x160a('0xb')](),controller[_0x160a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x160a('0xd')]);router[_0x160a('0xa')]('/:id/hoppers',auth[_0x160a('0xb')](),controller[_0x160a('0xe')]);router[_0x160a('0xa')](_0x160a('0xf'),auth[_0x160a('0xb')](),controller['getHopperHistories']);router[_0x160a('0xa')]('/:id/hopper_finals',auth[_0x160a('0xb')](),controller['getHopperFinals']);router[_0x160a('0xa')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x160a('0x10')]);router[_0x160a('0xa')]('/:id/lists',auth[_0x160a('0xb')](),controller[_0x160a('0x11')]);router['get'](_0x160a('0x12'),auth[_0x160a('0xb')](),controller[_0x160a('0x13')]);router['post']('/',auth[_0x160a('0xb')](),controller[_0x160a('0x14')]);router[_0x160a('0x15')](_0x160a('0x16'),auth[_0x160a('0xb')](),controller[_0x160a('0x17')]);router[_0x160a('0x15')](_0x160a('0x18'),auth[_0x160a('0xb')](),controller['addLists']);router[_0x160a('0x15')](_0x160a('0x12'),auth[_0x160a('0xb')](),controller[_0x160a('0x19')]);router[_0x160a('0x1a')]('/:id',auth[_0x160a('0xb')](),controller['update']);router[_0x160a('0x1b')](_0x160a('0x1c'),auth[_0x160a('0xb')](),controller[_0x160a('0x1d')]);router[_0x160a('0x1b')]('/:id/lists',auth[_0x160a('0xb')](),controller['removeLists']);router[_0x160a('0x1b')](_0x160a('0x12'),auth[_0x160a('0xb')](),controller[_0x160a('0x1e')]);module[_0x160a('0x1f')]=router; \ No newline at end of file +var _0x18c9=['put','update','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','index','get','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x18c9,0x1bf));var _0x918c=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x18c9[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var path=require(_0x918c('0x2'));var timeout=require(_0x918c('0x3'));var express=require(_0x918c('0x4'));var router=express[_0x918c('0x5')]();var fs_extra=require(_0x918c('0x6'));var auth=require(_0x918c('0x7'));var interaction=require(_0x918c('0x8'));var config=require(_0x918c('0x9'));var controller=require(_0x918c('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x918c('0xb')]);router[_0x918c('0xc')](_0x918c('0xd'),auth[_0x918c('0xe')](),controller['show']);router['get'](_0x918c('0xf'),auth[_0x918c('0xe')](),controller[_0x918c('0x10')]);router[_0x918c('0xc')](_0x918c('0x11'),auth[_0x918c('0xe')](),controller[_0x918c('0x12')]);router['get'](_0x918c('0x13'),auth[_0x918c('0xe')](),controller['getHopperFinals']);router[_0x918c('0xc')](_0x918c('0x14'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x918c('0xc')](_0x918c('0x15'),auth['isAuthenticated'](),controller['getLists']);router[_0x918c('0xc')](_0x918c('0x16'),auth[_0x918c('0xe')](),controller[_0x918c('0x17')]);router[_0x918c('0x18')]('/',auth[_0x918c('0xe')](),controller[_0x918c('0x19')]);router[_0x918c('0x18')](_0x918c('0x1a'),auth['isAuthenticated'](),controller[_0x918c('0x1b')]);router[_0x918c('0x18')]('/:id/lists',auth[_0x918c('0xe')](),controller['addLists']);router[_0x918c('0x18')]('/:id/blacklists',auth[_0x918c('0xe')](),controller[_0x918c('0x1c')]);router[_0x918c('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x918c('0x1e')]);router[_0x918c('0x1f')](_0x918c('0xd'),auth[_0x918c('0xe')](),controller['destroy']);router[_0x918c('0x1f')]('/:id/lists',auth['isAuthenticated'](),controller['removeLists']);router[_0x918c('0x1f')](_0x918c('0x16'),auth[_0x918c('0xe')](),controller[_0x918c('0x20')]);module[_0x918c('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 5c313f0..d8da6cd 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 _0xfacd=['VIRTUAL','getDataValue','key','sequelize','STRING'];(function(_0xc985a6,_0x697817){var _0x3e0c34=function(_0x42b0b6){while(--_0x42b0b6){_0xc985a6['push'](_0xc985a6['shift']());}};_0x3e0c34(++_0x697817);}(_0xfacd,0x157));var _0xdfac=function(_0x2b53f9,_0x4c78be){_0x2b53f9=_0x2b53f9-0x0;var _0x8deeb9=_0xfacd[_0x2b53f9];return _0x8deeb9;};'use strict';var Sequelize=require(_0xdfac('0x0'));module['exports']={'key':{'type':Sequelize[_0xdfac('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xdfac('0x1')]},'name':{'type':Sequelize[_0xdfac('0x2')],'get':function(){return this[_0xdfac('0x3')](_0xdfac('0x4'));}}}; \ No newline at end of file +var _0x9207=['key','exports','STRING','getDataValue'];(function(_0x5e2283,_0x1ed2f8){var _0x14bdce=function(_0x20c9c5){while(--_0x20c9c5){_0x5e2283['push'](_0x5e2283['shift']());}};_0x14bdce(++_0x1ed2f8);}(_0x9207,0x11d));var _0x7920=function(_0x204047,_0x2df7af){_0x204047=_0x204047-0x0;var _0x5956d2=_0x9207[_0x204047];return _0x5956d2;};'use strict';var Sequelize=require('sequelize');module[_0x7920('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x7920('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7920('0x2')](_0x7920('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a189bfd..f125586 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 _0xdfd3=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','CannedAnswer','includeAll','include','catch','show','params','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x524319,_0x14ee21){var _0xa144d=function(_0x3871d6){while(--_0x3871d6){_0x524319['push'](_0x524319['shift']());}};_0xa144d(++_0x14ee21);}(_0xdfd3,0x148));var _0x3dfd=function(_0x2be1ab,_0x2fe1fc){_0x2be1ab=_0x2be1ab-0x0;var _0x4c616d=_0xdfd3[_0x2be1ab];return _0x4c616d;};'use strict';var emlformat=require(_0x3dfd('0x0'));var rimraf=require(_0x3dfd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3dfd('0x2'));var rp=require(_0x3dfd('0x3'));var moment=require('moment');var BPromise=require(_0x3dfd('0x4'));var Mustache=require(_0x3dfd('0x5'));var util=require(_0x3dfd('0x6'));var path=require('path');var sox=require(_0x3dfd('0x7'));var csv=require(_0x3dfd('0x8'));var ejs=require(_0x3dfd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3dfd('0xa'));var crypto=require(_0x3dfd('0xb'));var jsforce=require(_0x3dfd('0xc'));var deskjs=require(_0x3dfd('0xd'));var toCsv=require(_0x3dfd('0x8'));var querystring=require(_0x3dfd('0xe'));var Papa=require(_0x3dfd('0xf'));var Redis=require(_0x3dfd('0x10'));var authService=require(_0x3dfd('0x11'));var qs=require(_0x3dfd('0x12'));var as=require(_0x3dfd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dfd('0x14'))(_0x3dfd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3dfd('0x16'));var db=require(_0x3dfd('0x17'))['db'];function respondWithStatusCode(_0x51434f,_0x53b85b){_0x53b85b=_0x53b85b||0xcc;return function(_0x4905b5){if(_0x4905b5){return _0x51434f[_0x3dfd('0x18')](_0x53b85b);}return _0x51434f[_0x3dfd('0x19')](_0x53b85b)[_0x3dfd('0x1a')]();};}function respondWithResult(_0x626646,_0x52517e){_0x52517e=_0x52517e||0xc8;return function(_0x37c94e){if(_0x37c94e){return _0x626646[_0x3dfd('0x19')](_0x52517e)[_0x3dfd('0x1b')](_0x37c94e);}};}function respondWithFilteredResult(_0x17f20f,_0x31b413){return function(_0x5298b4){if(_0x5298b4){var _0x254c31=typeof _0x31b413[_0x3dfd('0x1c')]===_0x3dfd('0x1d')&&typeof _0x31b413[_0x3dfd('0x1e')]===_0x3dfd('0x1d');var _0x172337=_0x5298b4[_0x3dfd('0x1f')];var _0x2973bf=_0x254c31?0x0:_0x31b413['offset'];var _0x515b21=_0x254c31?_0x5298b4[_0x3dfd('0x1f')]:_0x31b413['offset']+_0x31b413[_0x3dfd('0x1e')];var _0x4ee14b;if(_0x515b21>=_0x172337){_0x515b21=_0x172337;_0x4ee14b=0xc8;}else{_0x4ee14b=0xce;}_0x17f20f['status'](_0x4ee14b);return _0x17f20f[_0x3dfd('0x20')](_0x3dfd('0x21'),_0x2973bf+'-'+_0x515b21+'/'+_0x172337)['json'](_0x5298b4);}return null;};}function patchUpdates(_0x5ab314){return function(_0x3d58fe){try{jsonpatch['apply'](_0x3d58fe,_0x5ab314,!![]);}catch(_0x2e25b0){return BPromise[_0x3dfd('0x22')](_0x2e25b0);}return _0x3d58fe[_0x3dfd('0x23')]();};}function saveUpdates(_0x3cc3f6,_0x46670a){return function(_0x50c0f5){if(_0x50c0f5){return _0x50c0f5[_0x3dfd('0x24')](_0x3cc3f6)[_0x3dfd('0x25')](function(_0x4f1861){return _0x4f1861;});}return null;};}function removeEntity(_0x587f44,_0x438eb5){return function(_0xc5bbde){if(_0xc5bbde){return _0xc5bbde[_0x3dfd('0x26')]()['then'](function(){var _0x57467a=_0xc5bbde[_0x3dfd('0x27')]({'plain':!![]});var _0x1f0829='CannedAnswers';return db[_0x3dfd('0x28')][_0x3dfd('0x26')]({'where':{'type':_0x1f0829,'resourceId':_0x57467a['id']}})[_0x3dfd('0x25')](function(){return _0xc5bbde;});})['then'](function(){_0x587f44[_0x3dfd('0x19')](0xcc)[_0x3dfd('0x1a')]();});}};}function handleEntityNotFound(_0x2387c4,_0x3ec76c){return function(_0x49ce90){if(!_0x49ce90){_0x2387c4[_0x3dfd('0x18')](0x194);}return _0x49ce90;};}function handleError(_0x2b36a7,_0x528c60){_0x528c60=_0x528c60||0x1f4;return function(_0x428a9a){logger[_0x3dfd('0x29')](_0x428a9a[_0x3dfd('0x2a')]);if(_0x428a9a['name']){delete _0x428a9a[_0x3dfd('0x2b')];}_0x2b36a7[_0x3dfd('0x19')](_0x528c60)['send'](_0x428a9a);};}exports[_0x3dfd('0x2c')]=function(_0x1ae922,_0x4f7d86){var _0x21688f={},_0x54669b={},_0xc5d14c={'count':0x0,'rows':[]};var _0x21937e=_['map'](db['CannedAnswer'][_0x3dfd('0x2d')],function(_0x9bd706){return{'name':_0x9bd706['fieldName'],'type':_0x9bd706[_0x3dfd('0x2e')][_0x3dfd('0x2f')]};});_0x54669b[_0x3dfd('0x30')]=_['map'](_0x21937e,_0x3dfd('0x2b'));_0x54669b[_0x3dfd('0x31')]=_[_0x3dfd('0x32')](_0x1ae922[_0x3dfd('0x31')]);_0x54669b[_0x3dfd('0x33')]=_[_0x3dfd('0x34')](_0x54669b[_0x3dfd('0x30')],_0x54669b[_0x3dfd('0x31')]);_0x21688f[_0x3dfd('0x35')]=_[_0x3dfd('0x34')](_0x54669b[_0x3dfd('0x30')],qs[_0x3dfd('0x36')](_0x1ae922[_0x3dfd('0x31')]['fields']));_0x21688f[_0x3dfd('0x35')]=_0x21688f[_0x3dfd('0x35')][_0x3dfd('0x37')]?_0x21688f['attributes']:_0x54669b[_0x3dfd('0x30')];if(!_0x1ae922[_0x3dfd('0x31')][_0x3dfd('0x38')](_0x3dfd('0x39'))){_0x21688f[_0x3dfd('0x1e')]=qs['limit'](_0x1ae922[_0x3dfd('0x31')]['limit']);_0x21688f[_0x3dfd('0x1c')]=qs[_0x3dfd('0x1c')](_0x1ae922[_0x3dfd('0x31')][_0x3dfd('0x1c')]);}_0x21688f[_0x3dfd('0x3a')]=qs['sort'](_0x1ae922[_0x3dfd('0x31')][_0x3dfd('0x3b')]);_0x21688f['where']=qs[_0x3dfd('0x33')](_['pick'](_0x1ae922[_0x3dfd('0x31')],_0x54669b[_0x3dfd('0x33')]),_0x21937e);if(_0x1ae922[_0x3dfd('0x31')][_0x3dfd('0x3c')]){_0x21688f[_0x3dfd('0x3d')]=_[_0x3dfd('0x3e')](_0x21688f[_0x3dfd('0x3d')],{'$or':[{'key':{'$like':'%'+_0x1ae922[_0x3dfd('0x31')][_0x3dfd('0x3c')]+'%'}},{'value':{'$like':'%'+_0x1ae922[_0x3dfd('0x31')][_0x3dfd('0x3c')]+'%'}}]});}_0x21688f=_['merge']({},_0x21688f,_0x1ae922[_0x3dfd('0x3f')]);var _0x702ffb={'where':_0x21688f[_0x3dfd('0x3d')]};return db[_0x3dfd('0x40')]['count'](_0x702ffb)[_0x3dfd('0x25')](function(_0x3d8217){_0xc5d14c['count']=_0x3d8217;if(_0x1ae922['query'][_0x3dfd('0x41')]){_0x21688f[_0x3dfd('0x42')]=[{'all':!![]}];}return db[_0x3dfd('0x40')]['findAll'](_0x21688f);})[_0x3dfd('0x25')](function(_0x2ffc18){_0xc5d14c['rows']=_0x2ffc18;return _0xc5d14c;})[_0x3dfd('0x25')](respondWithFilteredResult(_0x4f7d86,_0x21688f))[_0x3dfd('0x43')](handleError(_0x4f7d86,null));};exports[_0x3dfd('0x44')]=function(_0x58eb2f,_0x498ed7){var _0x399a11={'raw':!![],'where':{'id':_0x58eb2f[_0x3dfd('0x45')]['id']}},_0x147b1d={};_0x147b1d['model']=_[_0x3dfd('0x32')](db['CannedAnswer'][_0x3dfd('0x2d')]);_0x147b1d[_0x3dfd('0x31')]=_['keys'](_0x58eb2f[_0x3dfd('0x31')]);_0x147b1d[_0x3dfd('0x33')]=_[_0x3dfd('0x34')](_0x147b1d[_0x3dfd('0x30')],_0x147b1d[_0x3dfd('0x31')]);_0x399a11['attributes']=_[_0x3dfd('0x34')](_0x147b1d[_0x3dfd('0x30')],qs[_0x3dfd('0x36')](_0x58eb2f[_0x3dfd('0x31')][_0x3dfd('0x36')]));_0x399a11[_0x3dfd('0x35')]=_0x399a11[_0x3dfd('0x35')][_0x3dfd('0x37')]?_0x399a11[_0x3dfd('0x35')]:_0x147b1d[_0x3dfd('0x30')];if(_0x58eb2f['query']['includeAll']){_0x399a11[_0x3dfd('0x42')]=[{'all':!![]}];}_0x399a11=_[_0x3dfd('0x3e')]({},_0x399a11,_0x58eb2f[_0x3dfd('0x3f')]);return db[_0x3dfd('0x40')]['find'](_0x399a11)[_0x3dfd('0x25')](handleEntityNotFound(_0x498ed7,null))[_0x3dfd('0x25')](respondWithResult(_0x498ed7,null))[_0x3dfd('0x43')](handleError(_0x498ed7,null));};exports['update']=function(_0x489414,_0x47bae9){if(_0x489414['body']['id']){delete _0x489414[_0x3dfd('0x46')]['id'];}return db[_0x3dfd('0x40')]['find']({'where':{'id':_0x489414[_0x3dfd('0x45')]['id']}})[_0x3dfd('0x25')](handleEntityNotFound(_0x47bae9,null))[_0x3dfd('0x25')](saveUpdates(_0x489414[_0x3dfd('0x46')],null))[_0x3dfd('0x25')](respondWithResult(_0x47bae9,null))[_0x3dfd('0x43')](handleError(_0x47bae9,null));};exports[_0x3dfd('0x26')]=function(_0x59ae9b,_0x4b9383){return db['CannedAnswer'][_0x3dfd('0x47')]({'where':{'id':_0x59ae9b['params']['id']}})['then'](handleEntityNotFound(_0x4b9383,null))['then'](removeEntity(_0x4b9383,null))[_0x3dfd('0x43')](handleError(_0x4b9383,null));};exports[_0x3dfd('0x48')]=function(_0x457be8,_0xc0b897){var _0x4240c2={'key':_0x457be8[_0x3dfd('0x46')][_0x3dfd('0x2f')]};if(_0x457be8[_0x3dfd('0x46')][_0x3dfd('0x49')]){_0x4240c2['MailAccountId']=_0x457be8['body'][_0x3dfd('0x49')];}else if(_0x457be8['body'][_0x3dfd('0x4a')]){_0x4240c2['SmsAccountId']=_0x457be8[_0x3dfd('0x46')][_0x3dfd('0x4a')];}else if(_0x457be8[_0x3dfd('0x46')][_0x3dfd('0x4b')]){_0x4240c2[_0x3dfd('0x4b')]=_0x457be8['body']['OpenchannelAccountId'];}else if(_0x457be8[_0x3dfd('0x46')][_0x3dfd('0x4c')]){_0x4240c2[_0x3dfd('0x4c')]=_0x457be8[_0x3dfd('0x46')][_0x3dfd('0x4c')];}return db[_0x3dfd('0x40')]['find']({'where':_0x4240c2})[_0x3dfd('0x25')](function(_0x535f0e){if(_0x535f0e){throw new db[(_0x3dfd('0x4d'))]['ValidationError'](_0x3dfd('0x4e'));}return db[_0x3dfd('0x40')][_0x3dfd('0x48')](_0x457be8['body']);})[_0x3dfd('0x25')](function(_0x84e6ff){var _0x2c2bbe=_0x457be8['user']['get']({'plain':!![]});if(!_0x2c2bbe)throw new Error(_0x3dfd('0x4f'));if(_0x2c2bbe['role']===_0x3dfd('0x50')){var _0x2aeb2a=_0x84e6ff['get']({'plain':!![]});return db[_0x3dfd('0x51')][_0x3dfd('0x47')]({'where':{'name':_0x3dfd('0x52'),'userProfileId':_0x2c2bbe[_0x3dfd('0x53')]},'raw':!![]})[_0x3dfd('0x25')](function(_0x4b9791){if(_0x4b9791&&_0x4b9791[_0x3dfd('0x54')]===0x0){return db[_0x3dfd('0x28')][_0x3dfd('0x48')]({'name':_0x2aeb2a['name'],'resourceId':_0x2aeb2a['id'],'type':_0x4b9791[_0x3dfd('0x2b')],'sectionId':_0x4b9791['id']},{})['then'](function(){return _0x84e6ff;});}else{return _0x84e6ff;}})['catch'](function(_0x709a31){logger[_0x3dfd('0x29')](_0x3dfd('0x55'),_0x709a31);throw _0x709a31;});}return _0x84e6ff;})[_0x3dfd('0x25')](respondWithResult(_0xc0b897,0xc9))['catch'](handleError(_0xc0b897,null));}; \ No newline at end of file +var _0x7712=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','CannedAnswers','end','error','stack','send','index','rawAttributes','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','CannedAnswer','include','findAll','rows','params','includeAll','catch','body','find','destroy','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4bf5aa,_0x350306){var _0x2e3073=function(_0x3d1b21){while(--_0x3d1b21){_0x4bf5aa['push'](_0x4bf5aa['shift']());}};_0x2e3073(++_0x350306);}(_0x7712,0x1d0));var _0x2771=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7712[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x2771('0x0'));var rimraf=require(_0x2771('0x1'));var zipdir=require(_0x2771('0x2'));var jsonpatch=require(_0x2771('0x3'));var rp=require(_0x2771('0x4'));var moment=require(_0x2771('0x5'));var BPromise=require(_0x2771('0x6'));var Mustache=require(_0x2771('0x7'));var util=require(_0x2771('0x8'));var path=require(_0x2771('0x9'));var sox=require(_0x2771('0xa'));var csv=require(_0x2771('0xb'));var ejs=require(_0x2771('0xc'));var fs=require('fs');var fs_extra=require(_0x2771('0xd'));var _=require(_0x2771('0xe'));var squel=require(_0x2771('0xf'));var crypto=require(_0x2771('0x10'));var jsforce=require(_0x2771('0x11'));var deskjs=require(_0x2771('0x12'));var toCsv=require(_0x2771('0xb'));var querystring=require(_0x2771('0x13'));var Papa=require('papaparse');var Redis=require(_0x2771('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2771('0x15'));var as=require(_0x2771('0x16'));var hardwareService=require(_0x2771('0x17'));var logger=require(_0x2771('0x18'))('api');var utils=require(_0x2771('0x19'));var config=require(_0x2771('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff9c8,_0x2a6a35){_0x2a6a35=_0x2a6a35||0xcc;return function(_0x460bf9){if(_0x460bf9){return _0x4ff9c8[_0x2771('0x1b')](_0x2a6a35);}return _0x4ff9c8[_0x2771('0x1c')](_0x2a6a35)['end']();};}function respondWithResult(_0x38a9e7,_0x321c8b){_0x321c8b=_0x321c8b||0xc8;return function(_0x5cd167){if(_0x5cd167){return _0x38a9e7[_0x2771('0x1c')](_0x321c8b)['json'](_0x5cd167);}};}function respondWithFilteredResult(_0x283544,_0x3ac7d0){return function(_0x1a9e48){if(_0x1a9e48){var _0x4f7c5b=typeof _0x3ac7d0[_0x2771('0x1d')]===_0x2771('0x1e')&&typeof _0x3ac7d0['limit']===_0x2771('0x1e');var _0x53b54b=_0x1a9e48[_0x2771('0x1f')];var _0x311920=_0x4f7c5b?0x0:_0x3ac7d0['offset'];var _0x3850d3=_0x4f7c5b?_0x1a9e48['count']:_0x3ac7d0['offset']+_0x3ac7d0['limit'];var _0x40cc4e;if(_0x3850d3>=_0x53b54b){_0x3850d3=_0x53b54b;_0x40cc4e=0xc8;}else{_0x40cc4e=0xce;}_0x283544[_0x2771('0x1c')](_0x40cc4e);return _0x283544[_0x2771('0x20')](_0x2771('0x21'),_0x311920+'-'+_0x3850d3+'/'+_0x53b54b)[_0x2771('0x22')](_0x1a9e48);}return null;};}function patchUpdates(_0x4f0504){return function(_0x1dceeb){try{jsonpatch[_0x2771('0x23')](_0x1dceeb,_0x4f0504,!![]);}catch(_0x4ee310){return BPromise[_0x2771('0x24')](_0x4ee310);}return _0x1dceeb[_0x2771('0x25')]();};}function saveUpdates(_0x52e0a7,_0x52f209){return function(_0x542816){if(_0x542816){return _0x542816[_0x2771('0x26')](_0x52e0a7)[_0x2771('0x27')](function(_0x364a27){return _0x364a27;});}return null;};}function removeEntity(_0x204864,_0x44bee7){return function(_0x23f57f){if(_0x23f57f){return _0x23f57f['destroy']()[_0x2771('0x27')](function(){var _0x4f96d4=_0x23f57f['get']({'plain':!![]});var _0x541103=_0x2771('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x541103,'resourceId':_0x4f96d4['id']}})[_0x2771('0x27')](function(){return _0x23f57f;});})[_0x2771('0x27')](function(){_0x204864[_0x2771('0x1c')](0xcc)[_0x2771('0x29')]();});}};}function handleEntityNotFound(_0x88bc5e,_0xa7a06){return function(_0x103697){if(!_0x103697){_0x88bc5e['sendStatus'](0x194);}return _0x103697;};}function handleError(_0xd9938a,_0x5d51e1){_0x5d51e1=_0x5d51e1||0x1f4;return function(_0x55c81a){logger[_0x2771('0x2a')](_0x55c81a[_0x2771('0x2b')]);if(_0x55c81a['name']){delete _0x55c81a['name'];}_0xd9938a[_0x2771('0x1c')](_0x5d51e1)[_0x2771('0x2c')](_0x55c81a);};}exports[_0x2771('0x2d')]=function(_0x10294f,_0x3a18be){var _0x16d962={},_0xa1b5b6={},_0x3238cc={'count':0x0,'rows':[]};var _0x633c36=_['map'](db['CannedAnswer'][_0x2771('0x2e')],function(_0x272179){return{'name':_0x272179['fieldName'],'type':_0x272179[_0x2771('0x2f')][_0x2771('0x30')]};});_0xa1b5b6[_0x2771('0x31')]=_[_0x2771('0x32')](_0x633c36,_0x2771('0x33'));_0xa1b5b6[_0x2771('0x34')]=_['keys'](_0x10294f['query']);_0xa1b5b6[_0x2771('0x35')]=_['intersection'](_0xa1b5b6[_0x2771('0x31')],_0xa1b5b6[_0x2771('0x34')]);_0x16d962[_0x2771('0x36')]=_[_0x2771('0x37')](_0xa1b5b6[_0x2771('0x31')],qs[_0x2771('0x38')](_0x10294f['query'][_0x2771('0x38')]));_0x16d962[_0x2771('0x36')]=_0x16d962['attributes'][_0x2771('0x39')]?_0x16d962[_0x2771('0x36')]:_0xa1b5b6[_0x2771('0x31')];if(!_0x10294f[_0x2771('0x34')][_0x2771('0x3a')](_0x2771('0x3b'))){_0x16d962[_0x2771('0x3c')]=qs[_0x2771('0x3c')](_0x10294f[_0x2771('0x34')]['limit']);_0x16d962[_0x2771('0x1d')]=qs[_0x2771('0x1d')](_0x10294f[_0x2771('0x34')][_0x2771('0x1d')]);}_0x16d962[_0x2771('0x3d')]=qs[_0x2771('0x3e')](_0x10294f[_0x2771('0x34')][_0x2771('0x3e')]);_0x16d962[_0x2771('0x3f')]=qs[_0x2771('0x35')](_[_0x2771('0x40')](_0x10294f['query'],_0xa1b5b6[_0x2771('0x35')]),_0x633c36);if(_0x10294f[_0x2771('0x34')][_0x2771('0x41')]){_0x16d962[_0x2771('0x3f')]=_[_0x2771('0x42')](_0x16d962[_0x2771('0x3f')],{'$or':[{'key':{'$like':'%'+_0x10294f[_0x2771('0x34')][_0x2771('0x41')]+'%'}},{'value':{'$like':'%'+_0x10294f[_0x2771('0x34')][_0x2771('0x41')]+'%'}}]});}_0x16d962=_[_0x2771('0x42')]({},_0x16d962,_0x10294f[_0x2771('0x43')]);var _0x3bc394={'where':_0x16d962[_0x2771('0x3f')]};return db[_0x2771('0x44')]['count'](_0x3bc394)[_0x2771('0x27')](function(_0x12b8ab){_0x3238cc[_0x2771('0x1f')]=_0x12b8ab;if(_0x10294f[_0x2771('0x34')]['includeAll']){_0x16d962[_0x2771('0x45')]=[{'all':!![]}];}return db[_0x2771('0x44')][_0x2771('0x46')](_0x16d962);})['then'](function(_0x5c8cbc){_0x3238cc[_0x2771('0x47')]=_0x5c8cbc;return _0x3238cc;})['then'](respondWithFilteredResult(_0x3a18be,_0x16d962))['catch'](handleError(_0x3a18be,null));};exports['show']=function(_0x49cf89,_0x4ca57a){var _0x379f72={'raw':!![],'where':{'id':_0x49cf89[_0x2771('0x48')]['id']}},_0x2b0466={};_0x2b0466[_0x2771('0x31')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x2b0466[_0x2771('0x34')]=_['keys'](_0x49cf89[_0x2771('0x34')]);_0x2b0466[_0x2771('0x35')]=_[_0x2771('0x37')](_0x2b0466[_0x2771('0x31')],_0x2b0466[_0x2771('0x34')]);_0x379f72[_0x2771('0x36')]=_['intersection'](_0x2b0466[_0x2771('0x31')],qs[_0x2771('0x38')](_0x49cf89[_0x2771('0x34')][_0x2771('0x38')]));_0x379f72['attributes']=_0x379f72[_0x2771('0x36')][_0x2771('0x39')]?_0x379f72[_0x2771('0x36')]:_0x2b0466['model'];if(_0x49cf89[_0x2771('0x34')][_0x2771('0x49')]){_0x379f72['include']=[{'all':!![]}];}_0x379f72=_[_0x2771('0x42')]({},_0x379f72,_0x49cf89[_0x2771('0x43')]);return db[_0x2771('0x44')]['find'](_0x379f72)[_0x2771('0x27')](handleEntityNotFound(_0x4ca57a,null))['then'](respondWithResult(_0x4ca57a,null))[_0x2771('0x4a')](handleError(_0x4ca57a,null));};exports[_0x2771('0x26')]=function(_0x4cb3b4,_0x33aded){if(_0x4cb3b4['body']['id']){delete _0x4cb3b4[_0x2771('0x4b')]['id'];}return db[_0x2771('0x44')][_0x2771('0x4c')]({'where':{'id':_0x4cb3b4[_0x2771('0x48')]['id']}})[_0x2771('0x27')](handleEntityNotFound(_0x33aded,null))[_0x2771('0x27')](saveUpdates(_0x4cb3b4[_0x2771('0x4b')],null))[_0x2771('0x27')](respondWithResult(_0x33aded,null))[_0x2771('0x4a')](handleError(_0x33aded,null));};exports[_0x2771('0x4d')]=function(_0x297fc3,_0x259dda){return db['CannedAnswer']['find']({'where':{'id':_0x297fc3[_0x2771('0x48')]['id']}})[_0x2771('0x27')](handleEntityNotFound(_0x259dda,null))['then'](removeEntity(_0x259dda,null))[_0x2771('0x4a')](handleError(_0x259dda,null));};exports['create']=function(_0x2074ad,_0x355ba6){var _0x354317={'key':_0x2074ad[_0x2771('0x4b')][_0x2771('0x30')]};if(_0x2074ad['body']['MailAccountId']){_0x354317[_0x2771('0x4e')]=_0x2074ad[_0x2771('0x4b')][_0x2771('0x4e')];}else if(_0x2074ad[_0x2771('0x4b')][_0x2771('0x4f')]){_0x354317[_0x2771('0x4f')]=_0x2074ad[_0x2771('0x4b')]['SmsAccountId'];}else if(_0x2074ad[_0x2771('0x4b')][_0x2771('0x50')]){_0x354317['OpenchannelAccountId']=_0x2074ad[_0x2771('0x4b')]['OpenchannelAccountId'];}else if(_0x2074ad['body']['ChatWebsiteId']){_0x354317['ChatWebsiteId']=_0x2074ad[_0x2771('0x4b')][_0x2771('0x51')];}return db[_0x2771('0x44')][_0x2771('0x4c')]({'where':_0x354317})[_0x2771('0x27')](function(_0x343b18){if(_0x343b18){throw new db[(_0x2771('0x52'))][(_0x2771('0x53'))](_0x2771('0x54'));}return db[_0x2771('0x44')]['create'](_0x2074ad[_0x2771('0x4b')]);})['then'](function(_0x2c927d){var _0x1efe2d=_0x2074ad[_0x2771('0x55')][_0x2771('0x56')]({'plain':!![]});if(!_0x1efe2d)throw new Error(_0x2771('0x57'));if(_0x1efe2d[_0x2771('0x58')]===_0x2771('0x55')){var _0x12800b=_0x2c927d['get']({'plain':!![]});return db[_0x2771('0x59')]['find']({'where':{'name':_0x2771('0x28'),'userProfileId':_0x1efe2d[_0x2771('0x5a')]},'raw':!![]})[_0x2771('0x27')](function(_0x41fb45){if(_0x41fb45&&_0x41fb45[_0x2771('0x5b')]===0x0){return db[_0x2771('0x5c')][_0x2771('0x5d')]({'name':_0x12800b['name'],'resourceId':_0x12800b['id'],'type':_0x41fb45[_0x2771('0x33')],'sectionId':_0x41fb45['id']},{})[_0x2771('0x27')](function(){return _0x2c927d;});}else{return _0x2c927d;}})[_0x2771('0x4a')](function(_0x5bc319){logger['error'](_0x2771('0x5e'),_0x5bc319);throw _0x5bc319;});}return _0x2c927d;})[_0x2771('0x27')](respondWithResult(_0x355ba6,0xc9))['catch'](handleError(_0x355ba6,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 70e51bc..ab8535b 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 _0x76fe=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','./cannedAnswer.attributes','define','CannedAnswer'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x76fe,0x179));var _0xe76f=function(_0x2c4cee,_0xed54d6){_0x2c4cee=_0x2c4cee-0x0;var _0x4cad54=_0x76fe[_0x2c4cee];return _0x4cad54;};'use strict';var _=require(_0xe76f('0x0'));var util=require('util');var logger=require(_0xe76f('0x1'))(_0xe76f('0x2'));var moment=require(_0xe76f('0x3'));var BPromise=require(_0xe76f('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(_0xe76f('0x5'));module['exports']=function(_0x45948a,_0x2a56d2){return _0x45948a[_0xe76f('0x6')](_0xe76f('0x7'),attributes,{'tableName':_0xe76f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe76f('0x9'),'collate':_0xe76f('0xa')});}; \ No newline at end of file +var _0x7566=['../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x7566,0x164));var _0x6756=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x7566[_0x525b28];return _0x180178;};'use strict';var _=require(_0x6756('0x0'));var util=require(_0x6756('0x1'));var logger=require(_0x6756('0x2'))(_0x6756('0x3'));var moment=require(_0x6756('0x4'));var BPromise=require('bluebird');var rp=require(_0x6756('0x5'));var fs=require('fs');var path=require(_0x6756('0x6'));var rimraf=require(_0x6756('0x7'));var config=require(_0x6756('0x8'));var attributes=require(_0x6756('0x9'));module[_0x6756('0xa')]=function(_0x5dda34,_0x493cbb){return _0x5dda34[_0x6756('0xb')]('CannedAnswer',attributes,{'tableName':_0x6756('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6756('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 196a07a..93a617c 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(_0x6ce588,_0x1d5f1b){var _0x59ea7c=function(_0x37cdf0){while(--_0x37cdf0){_0x6ce588['push'](_0x6ce588['shift']());}};_0x59ea7c(++_0x1d5f1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x17272f,_0x1d774b){var _0x188642=function(_0x2e49bb){while(--_0x2e49bb){_0x17272f['push'](_0x17272f['shift']());}};_0x188642(++_0x1d774b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 d1bc9c3..957c3ab 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 _0x7a37=['./cannedAnswer.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21e79a,_0x5a7990){var _0x506c02=function(_0x566c95){while(--_0x566c95){_0x21e79a['push'](_0x21e79a['shift']());}};_0x506c02(++_0x5a7990);}(_0x7a37,0x198));var _0x77a3=function(_0x356d14,_0x335981){_0x356d14=_0x356d14-0x0;var _0x454990=_0x7a37[_0x356d14];return _0x454990;};'use strict';var multer=require(_0x77a3('0x0'));var util=require(_0x77a3('0x1'));var path=require(_0x77a3('0x2'));var timeout=require(_0x77a3('0x3'));var express=require(_0x77a3('0x4'));var router=express[_0x77a3('0x5')]();var fs_extra=require(_0x77a3('0x6'));var auth=require(_0x77a3('0x7'));var interaction=require(_0x77a3('0x8'));var config=require(_0x77a3('0x9'));var controller=require(_0x77a3('0xa'));router['get']('/',auth[_0x77a3('0xb')](),controller[_0x77a3('0xc')]);router[_0x77a3('0xd')](_0x77a3('0xe'),auth['isAuthenticated'](),controller[_0x77a3('0xf')]);router[_0x77a3('0x10')]('/',auth[_0x77a3('0xb')](),controller[_0x77a3('0x11')]);router[_0x77a3('0x12')](_0x77a3('0xe'),auth[_0x77a3('0xb')](),controller[_0x77a3('0x13')]);router[_0x77a3('0x14')](_0x77a3('0xe'),auth[_0x77a3('0xb')](),controller['destroy']);module[_0x77a3('0x15')]=router; \ No newline at end of file +var _0x9651=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','create','/:id','update','delete','exports','multer'];(function(_0x3d79fc,_0x28b55a){var _0x554ea3=function(_0x18c2ac){while(--_0x18c2ac){_0x3d79fc['push'](_0x3d79fc['shift']());}};_0x554ea3(++_0x28b55a);}(_0x9651,0xa9));var _0x1965=function(_0x1b8745,_0x4deb89){_0x1b8745=_0x1b8745-0x0;var _0x1111a2=_0x9651[_0x1b8745];return _0x1111a2;};'use strict';var multer=require(_0x1965('0x0'));var util=require(_0x1965('0x1'));var path=require(_0x1965('0x2'));var timeout=require(_0x1965('0x3'));var express=require(_0x1965('0x4'));var router=express[_0x1965('0x5')]();var fs_extra=require(_0x1965('0x6'));var auth=require(_0x1965('0x7'));var interaction=require(_0x1965('0x8'));var config=require(_0x1965('0x9'));var controller=require(_0x1965('0xa'));router['get']('/',auth[_0x1965('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1965('0xb')](),controller[_0x1965('0xc')]);router['put'](_0x1965('0xd'),auth['isAuthenticated'](),controller[_0x1965('0xe')]);router[_0x1965('0xf')]('/:id',auth[_0x1965('0xb')](),controller['destroy']);module[_0x1965('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7bac6d9..27a656e 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 _0x6dd6=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x35b79f,_0x2d47db){var _0x1f7357=function(_0x3cb18a){while(--_0x3cb18a){_0x35b79f['push'](_0x35b79f['shift']());}};_0x1f7357(++_0x2d47db);}(_0x6dd6,0xcc));var _0x66dd=function(_0x123ff8,_0x2b9a42){_0x123ff8=_0x123ff8-0x0;var _0x2d8b5e=_0x6dd6[_0x123ff8];return _0x2d8b5e;};'use strict';var Sequelize=require('sequelize');module[_0x66dd('0x0')]={'calldate':{'type':Sequelize[_0x66dd('0x1')],'allowNull':![],'defaultValue':_0x66dd('0x2')},'clid':{'type':Sequelize[_0x66dd('0x3')]},'src':{'type':Sequelize[_0x66dd('0x3')]},'dst':{'type':Sequelize[_0x66dd('0x3')]},'dcontext':{'type':Sequelize[_0x66dd('0x3')]},'channel':{'type':Sequelize[_0x66dd('0x3')]},'dstchannel':{'type':Sequelize[_0x66dd('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x66dd('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x66dd('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x66dd('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x66dd('0x3')]},'userfield':{'type':Sequelize[_0x66dd('0x3')]},'uniqueid':{'type':Sequelize[_0x66dd('0x3')]},'linkedid':{'type':Sequelize[_0x66dd('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x66dd('0x3')]},'tag':{'type':Sequelize[_0x66dd('0x3')]}}; \ No newline at end of file +var _0x12c9=['DATE','STRING','INTEGER','sequelize'];(function(_0x5771c0,_0x129ef8){var _0x25b40b=function(_0x2d3671){while(--_0x2d3671){_0x5771c0['push'](_0x5771c0['shift']());}};_0x25b40b(++_0x129ef8);}(_0x12c9,0x9f));var _0x912c=function(_0x439fdf,_0x25d7d9){_0x439fdf=_0x439fdf-0x0;var _0x32c992=_0x12c9[_0x439fdf];return _0x32c992;};'use strict';var Sequelize=require(_0x912c('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x912c('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x912c('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x912c('0x2')]},'dcontext':{'type':Sequelize[_0x912c('0x2')]},'channel':{'type':Sequelize[_0x912c('0x2')]},'dstchannel':{'type':Sequelize[_0x912c('0x2')]},'lastapp':{'type':Sequelize[_0x912c('0x2')]},'lastdata':{'type':Sequelize[_0x912c('0x2')]},'duration':{'type':Sequelize[_0x912c('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x912c('0x2')]},'amaflags':{'type':Sequelize[_0x912c('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x912c('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x912c('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x912c('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 12d3622..94be441 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 _0xd6d2=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','Cdr','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x65281d,_0x201f0c){var _0x5c1bdd=function(_0x108567){while(--_0x108567){_0x65281d['push'](_0x65281d['shift']());}};_0x5c1bdd(++_0x201f0c);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x33229f,_0x53877b){_0x33229f=_0x33229f-0x0;var _0x18bb64=_0xd6d2[_0x33229f];return _0x18bb64;};'use strict';var emlformat=require(_0x2d6d('0x0'));var rimraf=require(_0x2d6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6d('0x2'));var rp=require(_0x2d6d('0x3'));var moment=require('moment');var BPromise=require(_0x2d6d('0x4'));var Mustache=require('mustache');var util=require(_0x2d6d('0x5'));var path=require(_0x2d6d('0x6'));var sox=require(_0x2d6d('0x7'));var csv=require('to-csv');var ejs=require(_0x2d6d('0x8'));var fs=require('fs');var fs_extra=require(_0x2d6d('0x9'));var _=require(_0x2d6d('0xa'));var squel=require(_0x2d6d('0xb'));var crypto=require(_0x2d6d('0xc'));var jsforce=require(_0x2d6d('0xd'));var deskjs=require(_0x2d6d('0xe'));var toCsv=require(_0x2d6d('0xf'));var querystring=require(_0x2d6d('0x10'));var Papa=require(_0x2d6d('0x11'));var Redis=require(_0x2d6d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2d6d('0x13'));var as=require(_0x2d6d('0x14'));var hardwareService=require(_0x2d6d('0x15'));var logger=require(_0x2d6d('0x16'))(_0x2d6d('0x17'));var utils=require('../../config/utils');var config=require(_0x2d6d('0x18'));var licenseUtil=require(_0x2d6d('0x19'));var db=require(_0x2d6d('0x1a'))['db'];function respondWithStatusCode(_0x2ad9fc,_0x5c4bf6){_0x5c4bf6=_0x5c4bf6||0xcc;return function(_0x5ef174){if(_0x5ef174){return _0x2ad9fc[_0x2d6d('0x1b')](_0x5c4bf6);}return _0x2ad9fc[_0x2d6d('0x1c')](_0x5c4bf6)[_0x2d6d('0x1d')]();};}function respondWithResult(_0x3528de,_0x58bd29){_0x58bd29=_0x58bd29||0xc8;return function(_0x1ec6aa){if(_0x1ec6aa){return _0x3528de[_0x2d6d('0x1c')](_0x58bd29)['json'](_0x1ec6aa);}};}function respondWithFilteredResult(_0x586085,_0x370096){return function(_0x17340f){if(_0x17340f){var _0x109b49=typeof _0x370096['offset']===_0x2d6d('0x1e')&&typeof _0x370096['limit']==='undefined';var _0x4c3092=_0x17340f[_0x2d6d('0x1f')];var _0x4179f2=_0x109b49?0x0:_0x370096[_0x2d6d('0x20')];var _0x3c527e=_0x109b49?_0x17340f[_0x2d6d('0x1f')]:_0x370096[_0x2d6d('0x20')]+_0x370096[_0x2d6d('0x21')];var _0xa2c4a7;if(_0x3c527e>=_0x4c3092){_0x3c527e=_0x4c3092;_0xa2c4a7=0xc8;}else{_0xa2c4a7=0xce;}_0x586085[_0x2d6d('0x1c')](_0xa2c4a7);return _0x586085['set'](_0x2d6d('0x22'),_0x4179f2+'-'+_0x3c527e+'/'+_0x4c3092)[_0x2d6d('0x23')](_0x17340f);}return null;};}function patchUpdates(_0x5b0c61){return function(_0x227e44){try{jsonpatch[_0x2d6d('0x24')](_0x227e44,_0x5b0c61,!![]);}catch(_0x15cb80){return BPromise[_0x2d6d('0x25')](_0x15cb80);}return _0x227e44[_0x2d6d('0x26')]();};}function saveUpdates(_0x59234a,_0x4aaa62){return function(_0x42c2f2){if(_0x42c2f2){return _0x42c2f2[_0x2d6d('0x27')](_0x59234a)[_0x2d6d('0x28')](function(_0x585b54){return _0x585b54;});}return null;};}function removeEntity(_0x47eb0e,_0x3ae8ad){return function(_0x4e7ec8){if(_0x4e7ec8){return _0x4e7ec8['destroy']()['then'](function(){_0x47eb0e[_0x2d6d('0x1c')](0xcc)[_0x2d6d('0x1d')]();});}};}function handleEntityNotFound(_0x3da83d,_0x3f89dd){return function(_0x3e5a92){if(!_0x3e5a92){_0x3da83d['sendStatus'](0x194);}return _0x3e5a92;};}function handleError(_0x16634d,_0x1b4964){_0x1b4964=_0x1b4964||0x1f4;return function(_0x455e71){logger[_0x2d6d('0x29')](_0x455e71[_0x2d6d('0x2a')]);if(_0x455e71[_0x2d6d('0x2b')]){delete _0x455e71[_0x2d6d('0x2b')];}_0x16634d[_0x2d6d('0x1c')](_0x1b4964)[_0x2d6d('0x2c')](_0x455e71);};}exports['index']=function(_0x1016e1,_0x26d299){var _0x2e7b32={},_0x34d485={},_0x486963={'count':0x0,'rows':[]};var _0x317bde=_['map'](db[_0x2d6d('0x2d')]['rawAttributes'],function(_0x58bfc7){return{'name':_0x58bfc7[_0x2d6d('0x2e')],'type':_0x58bfc7['type'][_0x2d6d('0x2f')]};});_0x34d485[_0x2d6d('0x30')]=_['map'](_0x317bde,_0x2d6d('0x2b'));_0x34d485['query']=_[_0x2d6d('0x31')](_0x1016e1[_0x2d6d('0x32')]);_0x34d485[_0x2d6d('0x33')]=_[_0x2d6d('0x34')](_0x34d485[_0x2d6d('0x30')],_0x34d485[_0x2d6d('0x32')]);_0x2e7b32[_0x2d6d('0x35')]=_[_0x2d6d('0x34')](_0x34d485['model'],qs[_0x2d6d('0x36')](_0x1016e1[_0x2d6d('0x32')]['fields']));_0x2e7b32[_0x2d6d('0x35')]=_0x2e7b32[_0x2d6d('0x35')][_0x2d6d('0x37')]?_0x2e7b32[_0x2d6d('0x35')]:_0x34d485[_0x2d6d('0x30')];if(!_0x1016e1['query']['hasOwnProperty']('nolimit')){_0x2e7b32[_0x2d6d('0x21')]=qs[_0x2d6d('0x21')](_0x1016e1[_0x2d6d('0x32')]['limit']);_0x2e7b32[_0x2d6d('0x20')]=qs[_0x2d6d('0x20')](_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x20')]);}_0x2e7b32['order']=qs[_0x2d6d('0x38')](_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x38')]);_0x2e7b32[_0x2d6d('0x39')]=qs[_0x2d6d('0x33')](_[_0x2d6d('0x3a')](_0x1016e1[_0x2d6d('0x32')],_0x34d485['filters']),_0x317bde);if(_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x3b')]){_0x2e7b32[_0x2d6d('0x39')]=_[_0x2d6d('0x3c')](_0x2e7b32[_0x2d6d('0x39')],{'$or':_['map'](_0x317bde,function(_0x1cad57){if(_0x1cad57[_0x2d6d('0x3d')]!==_0x2d6d('0x3e')){var _0x4616df={};_0x4616df[_0x1cad57[_0x2d6d('0x2b')]]={'$like':'%'+_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x3b')]+'%'};return _0x4616df;}})});}_0x2e7b32=_[_0x2d6d('0x3c')]({},_0x2e7b32,_0x1016e1[_0x2d6d('0x3f')]);var _0x38cce8={'where':_0x2e7b32[_0x2d6d('0x39')]};return db[_0x2d6d('0x2d')][_0x2d6d('0x1f')](_0x38cce8)[_0x2d6d('0x28')](function(_0x34fc23){_0x486963[_0x2d6d('0x1f')]=_0x34fc23;if(_0x1016e1[_0x2d6d('0x32')]['includeAll']){_0x2e7b32[_0x2d6d('0x40')]=[{'all':!![]}];}return db[_0x2d6d('0x2d')][_0x2d6d('0x41')](_0x2e7b32);})[_0x2d6d('0x28')](function(_0x246d6e){_0x486963['rows']=_0x246d6e;return _0x486963;})[_0x2d6d('0x28')](respondWithFilteredResult(_0x26d299,_0x2e7b32))[_0x2d6d('0x42')](handleError(_0x26d299,null));};exports[_0x2d6d('0x43')]=function(_0x41ab2e,_0x543b4b){var _0x3b62b1={'raw':!![],'where':{'id':_0x41ab2e[_0x2d6d('0x44')]['id']}},_0x7f76ad={};_0x7f76ad[_0x2d6d('0x30')]=_[_0x2d6d('0x31')](db['Cdr'][_0x2d6d('0x45')]);_0x7f76ad[_0x2d6d('0x32')]=_['keys'](_0x41ab2e[_0x2d6d('0x32')]);_0x7f76ad[_0x2d6d('0x33')]=_[_0x2d6d('0x34')](_0x7f76ad['model'],_0x7f76ad[_0x2d6d('0x32')]);_0x3b62b1[_0x2d6d('0x35')]=_['intersection'](_0x7f76ad['model'],qs['fields'](_0x41ab2e[_0x2d6d('0x32')][_0x2d6d('0x36')]));_0x3b62b1['attributes']=_0x3b62b1[_0x2d6d('0x35')][_0x2d6d('0x37')]?_0x3b62b1[_0x2d6d('0x35')]:_0x7f76ad[_0x2d6d('0x30')];if(_0x41ab2e['query'][_0x2d6d('0x46')]){_0x3b62b1[_0x2d6d('0x40')]=[{'all':!![]}];}_0x3b62b1=_['merge']({},_0x3b62b1,_0x41ab2e[_0x2d6d('0x3f')]);return db[_0x2d6d('0x2d')][_0x2d6d('0x47')](_0x3b62b1)[_0x2d6d('0x28')](handleEntityNotFound(_0x543b4b,null))[_0x2d6d('0x28')](respondWithResult(_0x543b4b,null))[_0x2d6d('0x42')](handleError(_0x543b4b,null));};exports[_0x2d6d('0x48')]=function(_0x5ac5e9,_0xe6b038){return db[_0x2d6d('0x2d')][_0x2d6d('0x48')](_0x5ac5e9['body'],{})['then'](respondWithResult(_0xe6b038,0xc9))[_0x2d6d('0x42')](handleError(_0xe6b038,null));};exports[_0x2d6d('0x27')]=function(_0x422198,_0x4e5203){if(_0x422198[_0x2d6d('0x49')]['id']){delete _0x422198[_0x2d6d('0x49')]['id'];}return db['Cdr'][_0x2d6d('0x47')]({'where':{'id':_0x422198[_0x2d6d('0x44')]['id']}})[_0x2d6d('0x28')](handleEntityNotFound(_0x4e5203,null))[_0x2d6d('0x28')](saveUpdates(_0x422198[_0x2d6d('0x49')],null))[_0x2d6d('0x28')](respondWithResult(_0x4e5203,null))[_0x2d6d('0x42')](handleError(_0x4e5203,null));};exports[_0x2d6d('0x4a')]=function(_0x42c125,_0x1ca9a2){return db['Cdr'][_0x2d6d('0x47')]({'where':{'id':_0x42c125[_0x2d6d('0x44')]['id']}})[_0x2d6d('0x28')](handleEntityNotFound(_0x1ca9a2,null))['then'](removeEntity(_0x1ca9a2,null))[_0x2d6d('0x42')](handleError(_0x1ca9a2,null));};exports[_0x2d6d('0x4b')]=function(_0x3738b3,_0x2dbcdc){return db[_0x2d6d('0x2d')][_0x2d6d('0x4b')]()[_0x2d6d('0x28')](respondWithResult(_0x2dbcdc,null))['catch'](handleError(_0x2dbcdc,null));}; \ No newline at end of file +var _0x9009=['stack','name','index','Cdr','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','map','VIRTUAL','catch','show','params','includeAll','include','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x9009,0x1d4));var _0x9900=function(_0x2bf3ac,_0x212f21){_0x2bf3ac=_0x2bf3ac-0x0;var _0x40ada=_0x9009[_0x2bf3ac];return _0x40ada;};'use strict';var emlformat=require(_0x9900('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9900('0x1'));var jsonpatch=require(_0x9900('0x2'));var rp=require('request-promise');var moment=require(_0x9900('0x3'));var BPromise=require(_0x9900('0x4'));var Mustache=require(_0x9900('0x5'));var util=require(_0x9900('0x6'));var path=require('path');var sox=require(_0x9900('0x7'));var csv=require(_0x9900('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9900('0x9'));var squel=require(_0x9900('0xa'));var crypto=require('crypto');var jsforce=require(_0x9900('0xb'));var deskjs=require(_0x9900('0xc'));var toCsv=require(_0x9900('0x8'));var querystring=require(_0x9900('0xd'));var Papa=require('papaparse');var Redis=require(_0x9900('0xe'));var authService=require(_0x9900('0xf'));var qs=require(_0x9900('0x10'));var as=require(_0x9900('0x11'));var hardwareService=require(_0x9900('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9900('0x13'));var config=require(_0x9900('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17070a,_0x4e8312){_0x4e8312=_0x4e8312||0xcc;return function(_0x6bd4da){if(_0x6bd4da){return _0x17070a[_0x9900('0x15')](_0x4e8312);}return _0x17070a[_0x9900('0x16')](_0x4e8312)[_0x9900('0x17')]();};}function respondWithResult(_0x318fa5,_0x1014e8){_0x1014e8=_0x1014e8||0xc8;return function(_0x2eaf32){if(_0x2eaf32){return _0x318fa5[_0x9900('0x16')](_0x1014e8)[_0x9900('0x18')](_0x2eaf32);}};}function respondWithFilteredResult(_0x209b4d,_0x375ee0){return function(_0xce2dd6){if(_0xce2dd6){var _0x154e22=typeof _0x375ee0[_0x9900('0x19')]===_0x9900('0x1a')&&typeof _0x375ee0[_0x9900('0x1b')]===_0x9900('0x1a');var _0x5d9ec9=_0xce2dd6['count'];var _0x1017a5=_0x154e22?0x0:_0x375ee0[_0x9900('0x19')];var _0x1bd7a3=_0x154e22?_0xce2dd6[_0x9900('0x1c')]:_0x375ee0['offset']+_0x375ee0[_0x9900('0x1b')];var _0x57ae85;if(_0x1bd7a3>=_0x5d9ec9){_0x1bd7a3=_0x5d9ec9;_0x57ae85=0xc8;}else{_0x57ae85=0xce;}_0x209b4d['status'](_0x57ae85);return _0x209b4d[_0x9900('0x1d')]('Content-Range',_0x1017a5+'-'+_0x1bd7a3+'/'+_0x5d9ec9)[_0x9900('0x18')](_0xce2dd6);}return null;};}function patchUpdates(_0x596eff){return function(_0x48d6df){try{jsonpatch[_0x9900('0x1e')](_0x48d6df,_0x596eff,!![]);}catch(_0x2892ce){return BPromise[_0x9900('0x1f')](_0x2892ce);}return _0x48d6df[_0x9900('0x20')]();};}function saveUpdates(_0x5ee4ad,_0x215bd4){return function(_0x3e4cee){if(_0x3e4cee){return _0x3e4cee[_0x9900('0x21')](_0x5ee4ad)[_0x9900('0x22')](function(_0x45c0d0){return _0x45c0d0;});}return null;};}function removeEntity(_0x5368bf,_0x37842b){return function(_0x218d7e){if(_0x218d7e){return _0x218d7e['destroy']()[_0x9900('0x22')](function(){_0x5368bf[_0x9900('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a015,_0x43ed24){return function(_0x2ac147){if(!_0x2ac147){_0x54a015['sendStatus'](0x194);}return _0x2ac147;};}function handleError(_0x285d51,_0x4507a9){_0x4507a9=_0x4507a9||0x1f4;return function(_0x5e3e21){logger[_0x9900('0x23')](_0x5e3e21[_0x9900('0x24')]);if(_0x5e3e21[_0x9900('0x25')]){delete _0x5e3e21[_0x9900('0x25')];}_0x285d51[_0x9900('0x16')](_0x4507a9)['send'](_0x5e3e21);};}exports[_0x9900('0x26')]=function(_0x44d775,_0x10fbae){var _0x32e343={},_0x3b1b94={},_0x50f16a={'count':0x0,'rows':[]};var _0x4cef1f=_['map'](db[_0x9900('0x27')][_0x9900('0x28')],function(_0x4ef405){return{'name':_0x4ef405[_0x9900('0x29')],'type':_0x4ef405[_0x9900('0x2a')][_0x9900('0x2b')]};});_0x3b1b94['model']=_['map'](_0x4cef1f,_0x9900('0x25'));_0x3b1b94[_0x9900('0x2c')]=_[_0x9900('0x2d')](_0x44d775[_0x9900('0x2c')]);_0x3b1b94['filters']=_['intersection'](_0x3b1b94[_0x9900('0x2e')],_0x3b1b94[_0x9900('0x2c')]);_0x32e343[_0x9900('0x2f')]=_[_0x9900('0x30')](_0x3b1b94[_0x9900('0x2e')],qs[_0x9900('0x31')](_0x44d775[_0x9900('0x2c')][_0x9900('0x31')]));_0x32e343[_0x9900('0x2f')]=_0x32e343[_0x9900('0x2f')][_0x9900('0x32')]?_0x32e343[_0x9900('0x2f')]:_0x3b1b94[_0x9900('0x2e')];if(!_0x44d775['query']['hasOwnProperty'](_0x9900('0x33'))){_0x32e343['limit']=qs[_0x9900('0x1b')](_0x44d775[_0x9900('0x2c')][_0x9900('0x1b')]);_0x32e343[_0x9900('0x19')]=qs[_0x9900('0x19')](_0x44d775[_0x9900('0x2c')][_0x9900('0x19')]);}_0x32e343[_0x9900('0x34')]=qs[_0x9900('0x35')](_0x44d775['query']['sort']);_0x32e343['where']=qs[_0x9900('0x36')](_[_0x9900('0x37')](_0x44d775['query'],_0x3b1b94[_0x9900('0x36')]),_0x4cef1f);if(_0x44d775[_0x9900('0x2c')][_0x9900('0x38')]){_0x32e343['where']=_[_0x9900('0x39')](_0x32e343[_0x9900('0x3a')],{'$or':_[_0x9900('0x3b')](_0x4cef1f,function(_0x141131){if(_0x141131[_0x9900('0x2a')]!==_0x9900('0x3c')){var _0x510d6a={};_0x510d6a[_0x141131[_0x9900('0x25')]]={'$like':'%'+_0x44d775[_0x9900('0x2c')]['filter']+'%'};return _0x510d6a;}})});}_0x32e343=_[_0x9900('0x39')]({},_0x32e343,_0x44d775['options']);var _0x2cee90={'where':_0x32e343[_0x9900('0x3a')]};return db['Cdr'][_0x9900('0x1c')](_0x2cee90)[_0x9900('0x22')](function(_0x2595cc){_0x50f16a[_0x9900('0x1c')]=_0x2595cc;if(_0x44d775[_0x9900('0x2c')]['includeAll']){_0x32e343['include']=[{'all':!![]}];}return db[_0x9900('0x27')]['findAll'](_0x32e343);})['then'](function(_0x5e2765){_0x50f16a['rows']=_0x5e2765;return _0x50f16a;})['then'](respondWithFilteredResult(_0x10fbae,_0x32e343))[_0x9900('0x3d')](handleError(_0x10fbae,null));};exports[_0x9900('0x3e')]=function(_0x3c8f30,_0x42849a){var _0x31c003={'raw':!![],'where':{'id':_0x3c8f30[_0x9900('0x3f')]['id']}},_0xb94a40={};_0xb94a40[_0x9900('0x2e')]=_['keys'](db[_0x9900('0x27')][_0x9900('0x28')]);_0xb94a40['query']=_['keys'](_0x3c8f30[_0x9900('0x2c')]);_0xb94a40[_0x9900('0x36')]=_[_0x9900('0x30')](_0xb94a40[_0x9900('0x2e')],_0xb94a40[_0x9900('0x2c')]);_0x31c003[_0x9900('0x2f')]=_[_0x9900('0x30')](_0xb94a40[_0x9900('0x2e')],qs['fields'](_0x3c8f30[_0x9900('0x2c')][_0x9900('0x31')]));_0x31c003['attributes']=_0x31c003[_0x9900('0x2f')][_0x9900('0x32')]?_0x31c003[_0x9900('0x2f')]:_0xb94a40[_0x9900('0x2e')];if(_0x3c8f30['query'][_0x9900('0x40')]){_0x31c003[_0x9900('0x41')]=[{'all':!![]}];}_0x31c003=_['merge']({},_0x31c003,_0x3c8f30[_0x9900('0x42')]);return db[_0x9900('0x27')][_0x9900('0x43')](_0x31c003)['then'](handleEntityNotFound(_0x42849a,null))[_0x9900('0x22')](respondWithResult(_0x42849a,null))['catch'](handleError(_0x42849a,null));};exports[_0x9900('0x44')]=function(_0x5ea06a,_0x1409a0){return db[_0x9900('0x27')][_0x9900('0x44')](_0x5ea06a['body'],{})[_0x9900('0x22')](respondWithResult(_0x1409a0,0xc9))['catch'](handleError(_0x1409a0,null));};exports[_0x9900('0x21')]=function(_0x11be07,_0x5ac239){if(_0x11be07[_0x9900('0x45')]['id']){delete _0x11be07[_0x9900('0x45')]['id'];}return db['Cdr'][_0x9900('0x43')]({'where':{'id':_0x11be07[_0x9900('0x3f')]['id']}})[_0x9900('0x22')](handleEntityNotFound(_0x5ac239,null))[_0x9900('0x22')](saveUpdates(_0x11be07[_0x9900('0x45')],null))['then'](respondWithResult(_0x5ac239,null))['catch'](handleError(_0x5ac239,null));};exports[_0x9900('0x46')]=function(_0x43cf2c,_0x2aa081){return db[_0x9900('0x27')][_0x9900('0x43')]({'where':{'id':_0x43cf2c['params']['id']}})[_0x9900('0x22')](handleEntityNotFound(_0x2aa081,null))[_0x9900('0x22')](removeEntity(_0x2aa081,null))[_0x9900('0x3d')](handleError(_0x2aa081,null));};exports[_0x9900('0x47')]=function(_0x2f7f74,_0xb5512f){return db[_0x9900('0x27')]['describe']()[_0x9900('0x22')](respondWithResult(_0xb5512f,null))['catch'](handleError(_0xb5512f,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e66f512..0469071 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(_0xea2a48,_0x24e9b1){var _0x247239=function(_0x295966){while(--_0x295966){_0xea2a48['push'](_0xea2a48['shift']());}};_0x247239(++_0x24e9b1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x143d46,_0x35d5b8){var _0x3f8c5c=function(_0x28feec){while(--_0x28feec){_0x143d46['push'](_0x143d46['shift']());}};_0x3f8c5c(++_0x35d5b8);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 caad92f..b34fcf7 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 _0xd0f2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment'];(function(_0x2b7ffe,_0x3129be){var _0x1a009a=function(_0x1c0a18){while(--_0x1c0a18){_0x2b7ffe['push'](_0x2b7ffe['shift']());}};_0x1a009a(++_0x3129be);}(_0xd0f2,0x13e));var _0x2d0f=function(_0x1f9e85,_0x1d8277){_0x1f9e85=_0x1f9e85-0x0;var _0x67fee9=_0xd0f2[_0x1f9e85];return _0x67fee9;};'use strict';var _=require(_0x2d0f('0x0'));var util=require('util');var moment=require(_0x2d0f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d0f('0x2'));var db=require(_0x2d0f('0x3'))['db'];var utils=require(_0x2d0f('0x4'));var logger=require(_0x2d0f('0x5'))(_0x2d0f('0x6'));var config=require(_0x2d0f('0x7'));var jayson=require(_0x2d0f('0x8'));var client=jayson['client'][_0x2d0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c2918,_0x2a1485,_0xfa6582){return new BPromise(function(_0x50deb2,_0x196a2f){return client[_0x2d0f('0xa')](_0x4c2918,_0xfa6582)[_0x2d0f('0xb')](function(_0x7b4e9b){logger['info'](_0x2d0f('0xc'),_0x2a1485,'request\x20sent');logger[_0x2d0f('0xd')](_0x2d0f('0xe'),_0x2a1485,_0x2d0f('0xf'),JSON['stringify'](_0x7b4e9b));if(_0x7b4e9b[_0x2d0f('0x10')]){if(_0x7b4e9b[_0x2d0f('0x10')][_0x2d0f('0x11')]===0x1f4){logger[_0x2d0f('0x10')](_0x2d0f('0xc'),_0x2a1485,_0x7b4e9b[_0x2d0f('0x10')]['message']);return _0x196a2f(_0x7b4e9b[_0x2d0f('0x10')][_0x2d0f('0x12')]);}logger[_0x2d0f('0x10')]('Cdr,\x20%s,\x20%s',_0x2a1485,_0x7b4e9b['error']['message']);return _0x50deb2(_0x7b4e9b['error'][_0x2d0f('0x12')]);}else{logger['info'](_0x2d0f('0xc'),_0x2a1485,'request\x20sent');_0x50deb2(_0x7b4e9b[_0x2d0f('0x13')][_0x2d0f('0x12')]);}})['catch'](function(_0x2f4b73){logger['error'](_0x2d0f('0xc'),_0x2a1485,_0x2f4b73);_0x196a2f(_0x2f4b73);});});} \ No newline at end of file +var _0x2bf0=['client','then','info','Cdr,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x11c609,_0x4873c9){var _0xb3b638=function(_0x458eca){while(--_0x458eca){_0x11c609['push'](_0x11c609['shift']());}};_0xb3b638(++_0x4873c9);}(_0x2bf0,0xee));var _0x02bf=function(_0x342625,_0x4895ad){_0x342625=_0x342625-0x0;var _0x1d1900=_0x2bf0[_0x342625];return _0x1d1900;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x02bf('0x0'));var BPromise=require(_0x02bf('0x1'));var rs=require(_0x02bf('0x2'));var fs=require('fs');var Redis=require(_0x02bf('0x3'));var db=require(_0x02bf('0x4'))['db'];var utils=require(_0x02bf('0x5'));var logger=require(_0x02bf('0x6'))(_0x02bf('0x7'));var config=require('../../config/environment');var jayson=require(_0x02bf('0x8'));var client=jayson[_0x02bf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f2b8e,_0x4183ed,_0x3d5bea){return new BPromise(function(_0x2cc437,_0x44b208){return client['request'](_0x3f2b8e,_0x3d5bea)[_0x02bf('0xa')](function(_0x228bed){logger[_0x02bf('0xb')](_0x02bf('0xc'),_0x4183ed,_0x02bf('0xd'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x4183ed,'request\x20sent',JSON['stringify'](_0x228bed));if(_0x228bed[_0x02bf('0xe')]){if(_0x228bed['error'][_0x02bf('0xf')]===0x1f4){logger[_0x02bf('0xe')](_0x02bf('0xc'),_0x4183ed,_0x228bed[_0x02bf('0xe')][_0x02bf('0x10')]);return _0x44b208(_0x228bed['error'][_0x02bf('0x10')]);}logger[_0x02bf('0xe')](_0x02bf('0xc'),_0x4183ed,_0x228bed[_0x02bf('0xe')][_0x02bf('0x10')]);return _0x2cc437(_0x228bed['error'][_0x02bf('0x10')]);}else{logger['info'](_0x02bf('0xc'),_0x4183ed,'request\x20sent');_0x2cc437(_0x228bed[_0x02bf('0x11')][_0x02bf('0x10')]);}})[_0x02bf('0x12')](function(_0x50c457){logger[_0x02bf('0xe')](_0x02bf('0xc'),_0x4183ed,_0x50c457);_0x44b208(_0x50c457);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b5ef573..f611012 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_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'));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 _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(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index eada99e..46e4465 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 _0x54bd=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x29fad0,_0x192ddf){var _0x1d2dda=function(_0x5ba4ae){while(--_0x5ba4ae){_0x29fad0['push'](_0x29fad0['shift']());}};_0x1d2dda(++_0x192ddf);}(_0x54bd,0x1ab));var _0xd54b=function(_0x32220a,_0x283cf6){_0x32220a=_0x32220a-0x0;var _0x32d8e6=_0x54bd[_0x32220a];return _0x32d8e6;};'use strict';var Sequelize=require(_0xd54b('0x0'));module[_0xd54b('0x1')]={'priority':{'type':Sequelize[_0xd54b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd54b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd54b('0x3')],'defaultValue':_0xd54b('0x4')}}; \ No newline at end of file +var _0xc801=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x29f476,_0x2db883){var _0x18ded1=function(_0x221cc6){while(--_0x221cc6){_0x29f476['push'](_0x29f476['shift']());}};_0x18ded1(++_0x2db883);}(_0xc801,0x9d));var _0x1c80=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xc801[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x1c80('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1c80('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1c80('0x2')],'allowNull':![],'defaultValue':_0x1c80('0x3')},'appdata':{'type':Sequelize[_0x1c80('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1c80('0x2')],'defaultValue':_0x1c80('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 669bfd6..d36eb08 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 _0xeb74=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4c0379,_0x265e7b){var _0x2e58db=function(_0xfdc7dc){while(--_0xfdc7dc){_0x4c0379['push'](_0x4c0379['shift']());}};_0x2e58db(++_0x265e7b);}(_0xeb74,0xe3));var _0x4eb7=function(_0x59ebe1,_0x94a70a){_0x59ebe1=_0x59ebe1-0x0;var _0x1b8872=_0xeb74[_0x59ebe1];return _0x1b8872;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x27')]();});}};}function handleEntityNotFound(_0x3e0da2,_0x25eb74){return function(_0x365060){if(!_0x365060){_0x3e0da2[_0x4eb7('0x28')](0x194);}return _0x365060;};}function handleError(_0x80b804,_0x248759){_0x248759=_0x248759||0x1f4;return function(_0xf83c11){logger[_0x4eb7('0x29')](_0xf83c11[_0x4eb7('0x2a')]);if(_0xf83c11[_0x4eb7('0x2b')]){delete _0xf83c11[_0x4eb7('0x2b')];}_0x80b804[_0x4eb7('0x19')](_0x248759)[_0x4eb7('0x2c')](_0xf83c11);};}exports[_0x4eb7('0x2d')]=function(_0x33a2c1,_0x28fda8){var _0x114c68={'raw':!![],'where':{'id':_0x33a2c1[_0x4eb7('0x2e')]['id']}},_0x17030a={};_0x17030a['model']=_[_0x4eb7('0x2f')](db['ChatApplication'][_0x4eb7('0x30')]);_0x17030a[_0x4eb7('0x31')]=_[_0x4eb7('0x2f')](_0x33a2c1[_0x4eb7('0x31')]);_0x17030a[_0x4eb7('0x32')]=_[_0x4eb7('0x33')](_0x17030a[_0x4eb7('0x34')],_0x17030a[_0x4eb7('0x31')]);_0x114c68[_0x4eb7('0x35')]=_['intersection'](_0x17030a[_0x4eb7('0x34')],qs['fields'](_0x33a2c1[_0x4eb7('0x31')][_0x4eb7('0x36')]));_0x114c68['attributes']=_0x114c68['attributes'][_0x4eb7('0x37')]?_0x114c68[_0x4eb7('0x35')]:_0x17030a[_0x4eb7('0x34')];if(_0x33a2c1[_0x4eb7('0x31')]['includeAll']){_0x114c68[_0x4eb7('0x38')]=[{'all':!![]}];}_0x114c68=_[_0x4eb7('0x39')]({},_0x114c68,_0x33a2c1[_0x4eb7('0x3a')]);return db[_0x4eb7('0x3b')][_0x4eb7('0x3c')](_0x114c68)['then'](handleEntityNotFound(_0x28fda8,null))[_0x4eb7('0x25')](respondWithResult(_0x28fda8,null))[_0x4eb7('0x3d')](handleError(_0x28fda8,null));};exports[_0x4eb7('0x24')]=function(_0x59d70a,_0x115642){if(_0x59d70a[_0x4eb7('0x3e')]['id']){delete _0x59d70a[_0x4eb7('0x3e')]['id'];}return db['ChatApplication'][_0x4eb7('0x3c')]({'where':{'id':_0x59d70a['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x115642,null))[_0x4eb7('0x25')](saveUpdates(_0x59d70a[_0x4eb7('0x3e')],null))[_0x4eb7('0x25')](respondWithResult(_0x115642,null))['catch'](handleError(_0x115642,null));};exports[_0x4eb7('0x26')]=function(_0xfd2721,_0x9c44e9){return db[_0x4eb7('0x3b')]['find']({'where':{'id':_0xfd2721['params']['id']}})['then'](handleEntityNotFound(_0x9c44e9,null))[_0x4eb7('0x25')](removeEntity(_0x9c44e9,null))[_0x4eb7('0x3d')](handleError(_0x9c44e9,null));}; \ No newline at end of file +var _0x43fd=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','reject','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4cdd51,_0x57f86e){var _0x5c9687=function(_0x32fd20){while(--_0x32fd20){_0x4cdd51['push'](_0x4cdd51['shift']());}};_0x5c9687(++_0x57f86e);}(_0x43fd,0x150));var _0xd43f=function(_0x26287d,_0x328a9f){_0x26287d=_0x26287d-0x0;var _0x4f053f=_0x43fd[_0x26287d];return _0x4f053f;};'use strict';var emlformat=require(_0xd43f('0x0'));var rimraf=require(_0xd43f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd43f('0x2'));var rp=require('request-promise');var moment=require(_0xd43f('0x3'));var BPromise=require(_0xd43f('0x4'));var Mustache=require(_0xd43f('0x5'));var util=require(_0xd43f('0x6'));var path=require(_0xd43f('0x7'));var sox=require(_0xd43f('0x8'));var csv=require(_0xd43f('0x9'));var ejs=require(_0xd43f('0xa'));var fs=require('fs');var fs_extra=require(_0xd43f('0xb'));var _=require(_0xd43f('0xc'));var squel=require(_0xd43f('0xd'));var crypto=require(_0xd43f('0xe'));var jsforce=require(_0xd43f('0xf'));var deskjs=require(_0xd43f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd43f('0x11'));var Papa=require(_0xd43f('0x12'));var Redis=require(_0xd43f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd43f('0x14'));var as=require(_0xd43f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd43f('0x16'))(_0xd43f('0x17'));var utils=require(_0xd43f('0x18'));var config=require(_0xd43f('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3be74e,_0xed42ff){_0xed42ff=_0xed42ff||0xcc;return function(_0x5b90a7){if(_0x5b90a7){return _0x3be74e[_0xd43f('0x1a')](_0xed42ff);}return _0x3be74e['status'](_0xed42ff)['end']();};}function respondWithResult(_0x28fe2d,_0x12bd82){_0x12bd82=_0x12bd82||0xc8;return function(_0x568087){if(_0x568087){return _0x28fe2d[_0xd43f('0x1b')](_0x12bd82)[_0xd43f('0x1c')](_0x568087);}};}function respondWithFilteredResult(_0x54f136,_0x229f81){return function(_0x351c9c){if(_0x351c9c){var _0x10f584=typeof _0x229f81[_0xd43f('0x1d')]===_0xd43f('0x1e')&&typeof _0x229f81['limit']==='undefined';var _0x5c03a6=_0x351c9c[_0xd43f('0x1f')];var _0x22d86f=_0x10f584?0x0:_0x229f81[_0xd43f('0x1d')];var _0x2e2396=_0x10f584?_0x351c9c['count']:_0x229f81[_0xd43f('0x1d')]+_0x229f81[_0xd43f('0x20')];var _0x263e9a;if(_0x2e2396>=_0x5c03a6){_0x2e2396=_0x5c03a6;_0x263e9a=0xc8;}else{_0x263e9a=0xce;}_0x54f136[_0xd43f('0x1b')](_0x263e9a);return _0x54f136[_0xd43f('0x21')]('Content-Range',_0x22d86f+'-'+_0x2e2396+'/'+_0x5c03a6)[_0xd43f('0x1c')](_0x351c9c);}return null;};}function patchUpdates(_0x5bae9e){return function(_0x1ad9d3){try{jsonpatch['apply'](_0x1ad9d3,_0x5bae9e,!![]);}catch(_0x1ce702){return BPromise[_0xd43f('0x22')](_0x1ce702);}return _0x1ad9d3['save']();};}function saveUpdates(_0x37da4a,_0x1c79b8){return function(_0x15a7d9){if(_0x15a7d9){return _0x15a7d9['update'](_0x37da4a)[_0xd43f('0x23')](function(_0x51c68c){return _0x51c68c;});}return null;};}function removeEntity(_0x3ff3dc,_0x4646c2){return function(_0x1bf18d){if(_0x1bf18d){return _0x1bf18d[_0xd43f('0x24')]()[_0xd43f('0x23')](function(){_0x3ff3dc[_0xd43f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cf19f,_0x4750c3){return function(_0x30d7a3){if(!_0x30d7a3){_0x3cf19f[_0xd43f('0x1a')](0x194);}return _0x30d7a3;};}function handleError(_0x3381b6,_0x2f7769){_0x2f7769=_0x2f7769||0x1f4;return function(_0x2df5b4){logger[_0xd43f('0x25')](_0x2df5b4[_0xd43f('0x26')]);if(_0x2df5b4[_0xd43f('0x27')]){delete _0x2df5b4['name'];}_0x3381b6[_0xd43f('0x1b')](_0x2f7769)[_0xd43f('0x28')](_0x2df5b4);};}exports[_0xd43f('0x29')]=function(_0x1215cf,_0x82103b){var _0x30d1dc={'raw':!![],'where':{'id':_0x1215cf[_0xd43f('0x2a')]['id']}},_0x4efdb5={};_0x4efdb5[_0xd43f('0x2b')]=_[_0xd43f('0x2c')](db[_0xd43f('0x2d')][_0xd43f('0x2e')]);_0x4efdb5[_0xd43f('0x2f')]=_[_0xd43f('0x2c')](_0x1215cf[_0xd43f('0x2f')]);_0x4efdb5[_0xd43f('0x30')]=_['intersection'](_0x4efdb5[_0xd43f('0x2b')],_0x4efdb5[_0xd43f('0x2f')]);_0x30d1dc['attributes']=_[_0xd43f('0x31')](_0x4efdb5['model'],qs[_0xd43f('0x32')](_0x1215cf['query'][_0xd43f('0x32')]));_0x30d1dc['attributes']=_0x30d1dc[_0xd43f('0x33')]['length']?_0x30d1dc[_0xd43f('0x33')]:_0x4efdb5[_0xd43f('0x2b')];if(_0x1215cf['query'][_0xd43f('0x34')]){_0x30d1dc[_0xd43f('0x35')]=[{'all':!![]}];}_0x30d1dc=_[_0xd43f('0x36')]({},_0x30d1dc,_0x1215cf[_0xd43f('0x37')]);return db[_0xd43f('0x2d')][_0xd43f('0x38')](_0x30d1dc)['then'](handleEntityNotFound(_0x82103b,null))[_0xd43f('0x23')](respondWithResult(_0x82103b,null))[_0xd43f('0x39')](handleError(_0x82103b,null));};exports['update']=function(_0x12f22f,_0x15759d){if(_0x12f22f[_0xd43f('0x3a')]['id']){delete _0x12f22f[_0xd43f('0x3a')]['id'];}return db[_0xd43f('0x2d')]['find']({'where':{'id':_0x12f22f[_0xd43f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x15759d,null))[_0xd43f('0x23')](saveUpdates(_0x12f22f[_0xd43f('0x3a')],null))[_0xd43f('0x23')](respondWithResult(_0x15759d,null))[_0xd43f('0x39')](handleError(_0x15759d,null));};exports[_0xd43f('0x24')]=function(_0x400fa5,_0x4b6608){return db[_0xd43f('0x2d')][_0xd43f('0x38')]({'where':{'id':_0x400fa5['params']['id']}})[_0xd43f('0x23')](handleEntityNotFound(_0x4b6608,null))[_0xd43f('0x23')](removeEntity(_0x4b6608,null))[_0xd43f('0x39')](handleError(_0x4b6608,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d7ec747..ed78dea 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 _0x831e=['rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0x831e,0xb0));var _0xe831=function(_0x2b2074,_0x1525fb){_0x2b2074=_0x2b2074-0x0;var _0x51ce87=_0x831e[_0x2b2074];return _0x51ce87;};'use strict';var _=require(_0xe831('0x0'));var util=require('util');var logger=require(_0xe831('0x1'))(_0xe831('0x2'));var moment=require('moment');var BPromise=require(_0xe831('0x3'));var rp=require(_0xe831('0x4'));var fs=require('fs');var path=require(_0xe831('0x5'));var rimraf=require(_0xe831('0x6'));var config=require(_0xe831('0x7'));var attributes=require(_0xe831('0x8'));module[_0xe831('0x9')]=function(_0x4430be,_0x5639d0){return _0x4430be['define'](_0xe831('0xa'),attributes,{'tableName':_0xe831('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe831('0xc'),'collate':_0xe831('0xd')});}; \ No newline at end of file +var _0x0590=['define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','./chatApplication.attributes','exports'];(function(_0x239cee,_0xf786c8){var _0x4fe6b6=function(_0x2d6a20){while(--_0x2d6a20){_0x239cee['push'](_0x239cee['shift']());}};_0x4fe6b6(++_0xf786c8);}(_0x0590,0x1d3));var _0x0059=function(_0x5fe8c3,_0x112516){_0x5fe8c3=_0x5fe8c3-0x0;var _0x3c7559=_0x0590[_0x5fe8c3];return _0x3c7559;};'use strict';var _=require(_0x0059('0x0'));var util=require(_0x0059('0x1'));var logger=require('../../config/logger')(_0x0059('0x2'));var moment=require(_0x0059('0x3'));var BPromise=require(_0x0059('0x4'));var rp=require(_0x0059('0x5'));var fs=require('fs');var path=require(_0x0059('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0059('0x7'));module[_0x0059('0x8')]=function(_0x2df387,_0x4e0aa3){return _0x2df387[_0x0059('0x9')](_0x0059('0xa'),attributes,{'tableName':_0x0059('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0059('0xc'),'collate':_0x0059('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 6a7904a..0348b8d 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 _0xcb80=['stringify','error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x5b3ccf,_0x540e79){var _0x143c48=function(_0x4c029b){while(--_0x4c029b){_0x5b3ccf['push'](_0x5b3ccf['shift']());}};_0x143c48(++_0x540e79);}(_0xcb80,0x1a9));var _0x0cb8=function(_0x4dd026,_0x2067c8){_0x4dd026=_0x4dd026-0x0;var _0x47d468=_0xcb80[_0x4dd026];return _0x47d468;};'use strict';var _=require(_0x0cb8('0x0'));var util=require(_0x0cb8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cb8('0x2'));var db=require(_0x0cb8('0x3'))['db'];var utils=require(_0x0cb8('0x4'));var logger=require(_0x0cb8('0x5'))(_0x0cb8('0x6'));var config=require(_0x0cb8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0cb8('0x8')][_0x0cb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ee2c9,_0x5b7333,_0x9f31cc){return new BPromise(function(_0x39c760,_0x31572f){return client[_0x0cb8('0xa')](_0x3ee2c9,_0x9f31cc)[_0x0cb8('0xb')](function(_0x5e4e34){logger[_0x0cb8('0xc')](_0x0cb8('0xd'),_0x5b7333,'request\x20sent');logger[_0x0cb8('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x5b7333,_0x0cb8('0xf'),JSON[_0x0cb8('0x10')](_0x5e4e34));if(_0x5e4e34[_0x0cb8('0x11')]){if(_0x5e4e34[_0x0cb8('0x11')]['code']===0x1f4){logger[_0x0cb8('0x11')](_0x0cb8('0xd'),_0x5b7333,_0x5e4e34[_0x0cb8('0x11')][_0x0cb8('0x12')]);return _0x31572f(_0x5e4e34[_0x0cb8('0x11')][_0x0cb8('0x12')]);}logger[_0x0cb8('0x11')](_0x0cb8('0xd'),_0x5b7333,_0x5e4e34[_0x0cb8('0x11')][_0x0cb8('0x12')]);return _0x39c760(_0x5e4e34[_0x0cb8('0x11')]['message']);}else{logger[_0x0cb8('0xc')]('ChatApplication,\x20%s,\x20%s',_0x5b7333,_0x0cb8('0xf'));_0x39c760(_0x5e4e34[_0x0cb8('0x13')][_0x0cb8('0x12')]);}})[_0x0cb8('0x14')](function(_0x1a4c24){logger[_0x0cb8('0x11')](_0x0cb8('0xd'),_0x5b7333,_0x1a4c24);_0x31572f(_0x1a4c24);});});} \ No newline at end of file +var _0x414b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1c3430,_0x5cf19f){var _0x255c4b=function(_0x402307){while(--_0x402307){_0x1c3430['push'](_0x1c3430['shift']());}};_0x255c4b(++_0x5cf19f);}(_0x414b,0x14b));var _0xb414=function(_0x2e1f9e,_0x2e5322){_0x2e1f9e=_0x2e1f9e-0x0;var _0x40d80a=_0x414b[_0x2e1f9e];return _0x40d80a;};'use strict';var _=require(_0xb414('0x0'));var util=require('util');var moment=require(_0xb414('0x1'));var BPromise=require(_0xb414('0x2'));var rs=require(_0xb414('0x3'));var fs=require('fs');var Redis=require(_0xb414('0x4'));var db=require(_0xb414('0x5'))['db'];var utils=require(_0xb414('0x6'));var logger=require(_0xb414('0x7'))(_0xb414('0x8'));var config=require(_0xb414('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf5656d,_0x232039,_0x2c29e9){return new BPromise(function(_0x594cf5,_0x1a94d5){return client[_0xb414('0xb')](_0xf5656d,_0x2c29e9)[_0xb414('0xc')](function(_0x19a902){logger[_0xb414('0xd')]('ChatApplication,\x20%s,\x20%s',_0x232039,_0xb414('0xe'));logger[_0xb414('0xf')](_0xb414('0x10'),_0x232039,_0xb414('0xe'),JSON[_0xb414('0x11')](_0x19a902));if(_0x19a902[_0xb414('0x12')]){if(_0x19a902[_0xb414('0x12')][_0xb414('0x13')]===0x1f4){logger[_0xb414('0x12')](_0xb414('0x14'),_0x232039,_0x19a902[_0xb414('0x12')]['message']);return _0x1a94d5(_0x19a902[_0xb414('0x12')]['message']);}logger[_0xb414('0x12')]('ChatApplication,\x20%s,\x20%s',_0x232039,_0x19a902[_0xb414('0x12')][_0xb414('0x15')]);return _0x594cf5(_0x19a902['error'][_0xb414('0x15')]);}else{logger[_0xb414('0xd')](_0xb414('0x14'),_0x232039,'request\x20sent');_0x594cf5(_0x19a902[_0xb414('0x16')][_0xb414('0x15')]);}})[_0xb414('0x17')](function(_0x5ee7d8){logger[_0xb414('0x12')]('ChatApplication,\x20%s,\x20%s',_0x232039,_0x5ee7d8);_0x1a94d5(_0x5ee7d8);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8e0192d..1c31e1c 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 _0x037e=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','show','put','/:id','update','delete','isAuthenticated','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x037e,0x1dd));var _0xe037=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x037e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe037('0x0'));var util=require(_0xe037('0x1'));var path=require(_0xe037('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe037('0x3')]();var fs_extra=require(_0xe037('0x4'));var auth=require(_0xe037('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe037('0x6'));var controller=require(_0xe037('0x7'));router[_0xe037('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe037('0x9')]);router[_0xe037('0xa')](_0xe037('0xb'),auth['isAuthenticated'](),controller[_0xe037('0xc')]);router[_0xe037('0xd')](_0xe037('0xb'),auth[_0xe037('0xe')](),controller[_0xe037('0xf')]);module[_0xe037('0x10')]=router; \ No newline at end of file +var _0x239c=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x4af856,_0x3990fd){var _0xdb6d15=function(_0x45af83){while(--_0x45af83){_0x4af856['push'](_0x4af856['shift']());}};_0xdb6d15(++_0x3990fd);}(_0x239c,0x146));var _0xc239=function(_0x1e526c,_0x43a2ad){_0x1e526c=_0x1e526c-0x0;var _0x210c5a=_0x239c[_0x1e526c];return _0x210c5a;};'use strict';var multer=require(_0xc239('0x0'));var util=require('util');var path=require(_0xc239('0x1'));var timeout=require(_0xc239('0x2'));var express=require(_0xc239('0x3'));var router=express[_0xc239('0x4')]();var fs_extra=require(_0xc239('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc239('0x6'));var config=require(_0xc239('0x7'));var controller=require(_0xc239('0x8'));router[_0xc239('0x9')](_0xc239('0xa'),auth[_0xc239('0xb')](),controller[_0xc239('0xc')]);router[_0xc239('0xd')]('/:id',auth[_0xc239('0xb')](),controller[_0xc239('0xe')]);router[_0xc239('0xf')](_0xc239('0xa'),auth[_0xc239('0xb')](),controller[_0xc239('0x10')]);module[_0xc239('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 034a902..1cac8a3 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 _0x458a=['exports','STRING','BOOLEAN','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x458a,0xc7));var _0xa458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x458a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa458('0x0'));module[_0xa458('0x1')]={'name':{'type':Sequelize[_0xa458('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xa458('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf17a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xf17a,0x136));var _0xaf17=function(_0x486be6,_0x9e907b){_0x486be6=_0x486be6-0x0;var _0x1181e4=_0xf17a[_0x486be6];return _0x1181e4;};'use strict';var Sequelize=require(_0xaf17('0x0'));module[_0xaf17('0x1')]={'name':{'type':Sequelize[_0xaf17('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xaf17('0x2')]},'write':{'type':Sequelize[_0xaf17('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 9d9513d..f1b4471 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 _0xa216=['omit','getMembers','User','removeMembers','findOne','$gte','format','getMessages','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','options','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids'];(function(_0x40e06e,_0x330b9a){var _0x382c2b=function(_0x41132c){while(--_0x41132c){_0x40e06e['push'](_0x40e06e['shift']());}};_0x382c2b(++_0x330b9a);}(_0xa216,0x69));var _0x6a21=function(_0x281aa2,_0x55282c){_0x281aa2=_0x281aa2-0x0;var _0x5475d2=_0xa216[_0x281aa2];return _0x5475d2;};'use strict';var emlformat=require(_0x6a21('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6a21('0x1'));var rp=require(_0x6a21('0x2'));var moment=require(_0x6a21('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6a21('0x4'));var util=require(_0x6a21('0x5'));var path=require('path');var sox=require(_0x6a21('0x6'));var csv=require(_0x6a21('0x7'));var ejs=require(_0x6a21('0x8'));var fs=require('fs');var fs_extra=require(_0x6a21('0x9'));var _=require(_0x6a21('0xa'));var squel=require(_0x6a21('0xb'));var crypto=require(_0x6a21('0xc'));var jsforce=require(_0x6a21('0xd'));var deskjs=require(_0x6a21('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6a21('0xf'));var Redis=require(_0x6a21('0x10'));var authService=require(_0x6a21('0x11'));var qs=require(_0x6a21('0x12'));var as=require(_0x6a21('0x13'));var hardwareService=require(_0x6a21('0x14'));var logger=require(_0x6a21('0x15'))(_0x6a21('0x16'));var utils=require(_0x6a21('0x17'));var config=require(_0x6a21('0x18'));var licenseUtil=require(_0x6a21('0x19'));var db=require('../../mysqldb')['db'];config[_0x6a21('0x1a')]=_['defaults'](config['redis'],{'host':_0x6a21('0x1b'),'port':0x18eb});var socket=require(_0x6a21('0x1c'))(new Redis(config[_0x6a21('0x1a')]));require('./chatGroup.socket')[_0x6a21('0x1d')](socket);function respondWithStatusCode(_0x2dd42f,_0x1c3ba3){_0x1c3ba3=_0x1c3ba3||0xcc;return function(_0x35a9cd){if(_0x35a9cd){return _0x2dd42f[_0x6a21('0x1e')](_0x1c3ba3);}return _0x2dd42f[_0x6a21('0x1f')](_0x1c3ba3)[_0x6a21('0x20')]();};}function respondWithResult(_0x1e8402,_0x34e398){_0x34e398=_0x34e398||0xc8;return function(_0x2940dc){if(_0x2940dc){return _0x1e8402[_0x6a21('0x1f')](_0x34e398)[_0x6a21('0x21')](_0x2940dc);}};}function respondWithFilteredResult(_0x5704e1,_0xd56564){return function(_0x6b66ad){if(_0x6b66ad){var _0x43fdbb=typeof _0xd56564[_0x6a21('0x22')]===_0x6a21('0x23')&&typeof _0xd56564[_0x6a21('0x24')]===_0x6a21('0x23');var _0x48284b=_0x6b66ad['count'];var _0x41764d=_0x43fdbb?0x0:_0xd56564[_0x6a21('0x22')];var _0x297138=_0x43fdbb?_0x6b66ad['count']:_0xd56564[_0x6a21('0x22')]+_0xd56564['limit'];var _0x5e916f;if(_0x297138>=_0x48284b){_0x297138=_0x48284b;_0x5e916f=0xc8;}else{_0x5e916f=0xce;}_0x5704e1[_0x6a21('0x1f')](_0x5e916f);return _0x5704e1[_0x6a21('0x25')](_0x6a21('0x26'),_0x41764d+'-'+_0x297138+'/'+_0x48284b)[_0x6a21('0x21')](_0x6b66ad);}return null;};}function patchUpdates(_0x56cf14){return function(_0x3c660d){try{jsonpatch[_0x6a21('0x27')](_0x3c660d,_0x56cf14,!![]);}catch(_0x1c3f98){return BPromise[_0x6a21('0x28')](_0x1c3f98);}return _0x3c660d[_0x6a21('0x29')]();};}function saveUpdates(_0x18780f,_0x5ca933){return function(_0x43faee){if(_0x43faee){return _0x43faee[_0x6a21('0x2a')](_0x18780f)[_0x6a21('0x2b')](function(_0x404330){return _0x404330;});}return null;};}function removeEntity(_0x18ac7e,_0x576a0a){return function(_0x5df219){if(_0x5df219){return _0x5df219[_0x6a21('0x2c')]()[_0x6a21('0x2b')](function(){_0x18ac7e[_0x6a21('0x1f')](0xcc)[_0x6a21('0x20')]();});}};}function handleEntityNotFound(_0x478509,_0x300a43){return function(_0x349c02){if(!_0x349c02){_0x478509[_0x6a21('0x1e')](0x194);}return _0x349c02;};}function handleError(_0x4a930d,_0xc84360){_0xc84360=_0xc84360||0x1f4;return function(_0x318869){logger[_0x6a21('0x2d')](_0x318869[_0x6a21('0x2e')]);if(_0x318869[_0x6a21('0x2f')]){delete _0x318869[_0x6a21('0x2f')];}_0x4a930d[_0x6a21('0x1f')](_0xc84360)['send'](_0x318869);};}exports[_0x6a21('0x30')]=function(_0x4f18f9,_0x9ccebb){var _0xde479d={},_0x48def0={},_0xf57255={'count':0x0,'rows':[]};var _0xc941ba=_[_0x6a21('0x31')](db[_0x6a21('0x32')][_0x6a21('0x33')],function(_0x27f3fc){return{'name':_0x27f3fc[_0x6a21('0x34')],'type':_0x27f3fc[_0x6a21('0x35')][_0x6a21('0x36')]};});_0x48def0[_0x6a21('0x37')]=_[_0x6a21('0x31')](_0xc941ba,_0x6a21('0x2f'));_0x48def0[_0x6a21('0x38')]=_[_0x6a21('0x39')](_0x4f18f9['query']);_0x48def0['filters']=_[_0x6a21('0x3a')](_0x48def0[_0x6a21('0x37')],_0x48def0[_0x6a21('0x38')]);_0xde479d[_0x6a21('0x3b')]=_[_0x6a21('0x3a')](_0x48def0['model'],qs[_0x6a21('0x3c')](_0x4f18f9[_0x6a21('0x38')][_0x6a21('0x3c')]));_0xde479d[_0x6a21('0x3b')]=_0xde479d['attributes'][_0x6a21('0x3d')]?_0xde479d[_0x6a21('0x3b')]:_0x48def0[_0x6a21('0x37')];if(!_0x4f18f9[_0x6a21('0x38')][_0x6a21('0x3e')](_0x6a21('0x3f'))){_0xde479d[_0x6a21('0x24')]=qs[_0x6a21('0x24')](_0x4f18f9['query'][_0x6a21('0x24')]);_0xde479d[_0x6a21('0x22')]=qs['offset'](_0x4f18f9[_0x6a21('0x38')][_0x6a21('0x22')]);}_0xde479d[_0x6a21('0x40')]=qs['sort'](_0x4f18f9[_0x6a21('0x38')][_0x6a21('0x41')]);_0xde479d[_0x6a21('0x42')]=qs[_0x6a21('0x43')](_[_0x6a21('0x44')](_0x4f18f9['query'],_0x48def0['filters']),_0xc941ba);if(_0x4f18f9[_0x6a21('0x38')][_0x6a21('0x45')]){_0xde479d[_0x6a21('0x42')]=_[_0x6a21('0x46')](_0xde479d[_0x6a21('0x42')],{'$or':_[_0x6a21('0x31')](_0xc941ba,function(_0x341d70){if(_0x341d70[_0x6a21('0x35')]!==_0x6a21('0x47')){var _0x2f5d24={};_0x2f5d24[_0x341d70['name']]={'$like':'%'+_0x4f18f9[_0x6a21('0x38')][_0x6a21('0x45')]+'%'};return _0x2f5d24;}})});}_0xde479d=_[_0x6a21('0x46')]({},_0xde479d,_0x4f18f9['options']);var _0x2708e9={'where':_0xde479d[_0x6a21('0x42')]};return db[_0x6a21('0x32')][_0x6a21('0x48')](_0x2708e9)['then'](function(_0x579595){_0xf57255[_0x6a21('0x48')]=_0x579595;if(_0x4f18f9[_0x6a21('0x38')][_0x6a21('0x49')]){_0xde479d[_0x6a21('0x4a')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0xde479d);})['then'](function(_0x20edcb){_0xf57255[_0x6a21('0x4b')]=_0x20edcb;return _0xf57255;})[_0x6a21('0x2b')](respondWithFilteredResult(_0x9ccebb,_0xde479d))[_0x6a21('0x4c')](handleError(_0x9ccebb,null));};exports[_0x6a21('0x4d')]=function(_0x467d3d,_0x568664){var _0x4f91c0={'raw':!![],'where':{'id':_0x467d3d[_0x6a21('0x4e')]['id']}},_0x94ede8={};_0x94ede8[_0x6a21('0x37')]=_['keys'](db[_0x6a21('0x32')][_0x6a21('0x33')]);_0x94ede8['query']=_['keys'](_0x467d3d[_0x6a21('0x38')]);_0x94ede8[_0x6a21('0x43')]=_['intersection'](_0x94ede8['model'],_0x94ede8[_0x6a21('0x38')]);_0x4f91c0[_0x6a21('0x3b')]=_[_0x6a21('0x3a')](_0x94ede8[_0x6a21('0x37')],qs[_0x6a21('0x3c')](_0x467d3d['query'][_0x6a21('0x3c')]));_0x4f91c0[_0x6a21('0x3b')]=_0x4f91c0[_0x6a21('0x3b')][_0x6a21('0x3d')]?_0x4f91c0[_0x6a21('0x3b')]:_0x94ede8[_0x6a21('0x37')];if(_0x467d3d['query']['includeAll']){_0x4f91c0[_0x6a21('0x4a')]=[{'all':!![]}];}_0x4f91c0=_[_0x6a21('0x46')]({},_0x4f91c0,_0x467d3d[_0x6a21('0x4f')]);return db[_0x6a21('0x32')][_0x6a21('0x50')](_0x4f91c0)[_0x6a21('0x2b')](handleEntityNotFound(_0x568664,null))['then'](respondWithResult(_0x568664,null))['catch'](handleError(_0x568664,null));};exports[_0x6a21('0x51')]=function(_0x2336eb,_0x1b347f){return db[_0x6a21('0x32')][_0x6a21('0x51')](_0x2336eb[_0x6a21('0x52')],{})[_0x6a21('0x2b')](respondWithResult(_0x1b347f,0xc9))[_0x6a21('0x4c')](handleError(_0x1b347f,null));};exports[_0x6a21('0x2a')]=function(_0xa3a783,_0x2af0d9){if(_0xa3a783[_0x6a21('0x52')]['id']){delete _0xa3a783[_0x6a21('0x52')]['id'];}return db[_0x6a21('0x32')][_0x6a21('0x50')]({'where':{'id':_0xa3a783['params']['id']}})[_0x6a21('0x2b')](handleEntityNotFound(_0x2af0d9,null))[_0x6a21('0x2b')](saveUpdates(_0xa3a783[_0x6a21('0x52')],null))[_0x6a21('0x2b')](respondWithResult(_0x2af0d9,null))[_0x6a21('0x4c')](handleError(_0x2af0d9,null));};exports[_0x6a21('0x2c')]=function(_0x196efd,_0x4ebf7f){return db[_0x6a21('0x32')][_0x6a21('0x50')]({'where':{'id':_0x196efd['params']['id']}})[_0x6a21('0x2b')](handleEntityNotFound(_0x4ebf7f,null))[_0x6a21('0x2b')](removeEntity(_0x4ebf7f,null))[_0x6a21('0x4c')](handleError(_0x4ebf7f,null));};exports[_0x6a21('0x53')]=function(_0x37bcb6,_0x389d95){return db[_0x6a21('0x32')][_0x6a21('0x53')]()['then'](respondWithResult(_0x389d95,null))[_0x6a21('0x4c')](handleError(_0x389d95,null));};exports[_0x6a21('0x54')]=function(_0x450806,_0x46e89a,_0x49a9fe){return db[_0x6a21('0x55')]['count']({'where':{'ChatGroupId':_0x450806[_0x6a21('0x4e')]['id'],'ToId':_0x450806[_0x6a21('0x56')]['id'],'read':![]}})[_0x6a21('0x2b')](function(_0x2ca4c8){return{'id':_['toInteger'](_0x450806[_0x6a21('0x4e')]['id']),'count':_0x2ca4c8};})[_0x6a21('0x2b')](respondWithResult(_0x46e89a,null))['catch'](handleError(_0x46e89a,null));};exports['addMembers']=function(_0xf0efe9,_0x47ef49,_0x43560a){return db[_0x6a21('0x32')][_0x6a21('0x50')]({'where':{'id':_0xf0efe9[_0x6a21('0x4e')]['id']}})[_0x6a21('0x2b')](handleEntityNotFound(_0x47ef49,null))['then'](function(_0x37b34a){if(_0x37b34a){return _0x37b34a[_0x6a21('0x57')](_0xf0efe9['body'][_0x6a21('0x58')],_[_0x6a21('0x59')](_0xf0efe9['body'],[_0x6a21('0x58'),'id'])||{});}})[_0x6a21('0x2b')](respondWithResult(_0x47ef49,null))[_0x6a21('0x4c')](handleError(_0x47ef49,null));};exports[_0x6a21('0x5a')]=function(_0x30be55,_0x57c6fe,_0x4bf843){var _0x5812f0={};var _0x58282c={};var _0x14562b;var _0x263688;return db[_0x6a21('0x32')]['findOne']({'where':{'id':_0x30be55[_0x6a21('0x4e')]['id']}})[_0x6a21('0x2b')](handleEntityNotFound(_0x57c6fe,null))[_0x6a21('0x2b')](function(_0x2acd6b){if(_0x2acd6b){_0x14562b=_0x2acd6b;_0x58282c[_0x6a21('0x37')]=_[_0x6a21('0x39')](db[_0x6a21('0x5b')][_0x6a21('0x33')]);_0x58282c[_0x6a21('0x38')]=_['keys'](_0x30be55['query']);_0x58282c['filters']=_['intersection'](_0x58282c['model'],_0x58282c[_0x6a21('0x38')]);_0x5812f0[_0x6a21('0x3b')]=_[_0x6a21('0x3a')](_0x58282c['model'],qs[_0x6a21('0x3c')](_0x30be55['query'][_0x6a21('0x3c')]));_0x5812f0[_0x6a21('0x3b')]=_0x5812f0[_0x6a21('0x3b')]['length']?_0x5812f0['attributes']:_0x58282c[_0x6a21('0x37')];_0x5812f0[_0x6a21('0x40')]=qs[_0x6a21('0x41')](_0x30be55[_0x6a21('0x38')]['sort']);_0x5812f0[_0x6a21('0x42')]=qs['filters'](_[_0x6a21('0x44')](_0x30be55[_0x6a21('0x38')],_0x58282c[_0x6a21('0x43')]));if(_0x30be55[_0x6a21('0x38')][_0x6a21('0x45')]){_0x5812f0['where']=_[_0x6a21('0x46')](_0x5812f0['where'],{'$or':_[_0x6a21('0x31')](_0x5812f0['attributes'],function(_0x2a9e02){var _0x574394={};_0x574394[_0x2a9e02]={'$like':'%'+_0x30be55[_0x6a21('0x38')][_0x6a21('0x45')]+'%'};return _0x574394;})});}_0x5812f0=_['merge']({},_0x5812f0,_0x30be55[_0x6a21('0x4f')]);return _0x14562b[_0x6a21('0x5a')](_0x5812f0);}})[_0x6a21('0x2b')](function(_0x40410b){if(_0x40410b){_0x263688=_0x40410b[_0x6a21('0x3d')];if(!_0x30be55[_0x6a21('0x38')][_0x6a21('0x3e')]('nolimit')){_0x5812f0['limit']=qs[_0x6a21('0x24')](_0x30be55[_0x6a21('0x38')][_0x6a21('0x24')]);_0x5812f0[_0x6a21('0x22')]=qs[_0x6a21('0x22')](_0x30be55[_0x6a21('0x38')][_0x6a21('0x22')]);}return _0x14562b[_0x6a21('0x5a')](_0x5812f0);}})[_0x6a21('0x2b')](function(_0x309119){if(_0x309119){return _0x309119?{'count':_0x263688,'rows':_0x309119}:null;}})[_0x6a21('0x2b')](respondWithResult(_0x57c6fe,null))['catch'](handleError(_0x57c6fe,null));};exports[_0x6a21('0x5c')]=function(_0x185551,_0x1cdbd4,_0x42b3de){return db[_0x6a21('0x32')][_0x6a21('0x50')]({'where':{'id':_0x185551[_0x6a21('0x4e')]['id']}})[_0x6a21('0x2b')](handleEntityNotFound(_0x1cdbd4,null))[_0x6a21('0x2b')](function(_0x44428b){if(_0x44428b){return _0x44428b[_0x6a21('0x5c')](_0x185551[_0x6a21('0x38')][_0x6a21('0x58')]);}})[_0x6a21('0x2b')](respondWithStatusCode(_0x1cdbd4,null))[_0x6a21('0x4c')](handleError(_0x1cdbd4,null));};exports['addMessage']=function(_0x19ef3e,_0x34bc8a,_0x3337e1){if(_0x19ef3e[_0x6a21('0x52')]['id']){delete _0x19ef3e[_0x6a21('0x52')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x19ef3e[_0x6a21('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34bc8a,null))[_0x6a21('0x2b')](function(_0x42b12d){if(_0x42b12d){_0x19ef3e[_0x6a21('0x52')]['ChatGroupId']=_0x42b12d['id'];return db[_0x6a21('0x55')]['create'](_0x19ef3e[_0x6a21('0x52')]);}})[_0x6a21('0x2b')](respondWithResult(_0x34bc8a,null))[_0x6a21('0x4c')](handleError(_0x34bc8a,null));};exports['getMessages']=function(_0x54a256,_0x57ea57,_0x368d96){var _0x4e5941={};var _0x4ea3bf={};var _0x572c07;var _0x4defcc;return db[_0x6a21('0x32')][_0x6a21('0x5d')]({'where':{'id':_0x54a256[_0x6a21('0x4e')]['id']}})[_0x6a21('0x2b')](handleEntityNotFound(_0x57ea57,null))[_0x6a21('0x2b')](function(_0x272642){if(_0x272642){_0x572c07=_0x272642;_0x4ea3bf['model']=_[_0x6a21('0x39')](db[_0x6a21('0x55')][_0x6a21('0x33')]);_0x4ea3bf[_0x6a21('0x38')]=_[_0x6a21('0x39')](_0x54a256[_0x6a21('0x38')]);_0x4ea3bf[_0x6a21('0x43')]=_['intersection'](_0x4ea3bf[_0x6a21('0x37')],_0x4ea3bf[_0x6a21('0x38')]);_0x4e5941[_0x6a21('0x3b')]=_['intersection'](_0x4ea3bf[_0x6a21('0x37')],qs[_0x6a21('0x3c')](_0x54a256[_0x6a21('0x38')][_0x6a21('0x3c')]));_0x4e5941[_0x6a21('0x3b')]=_0x4e5941[_0x6a21('0x3b')][_0x6a21('0x3d')]?_0x4e5941[_0x6a21('0x3b')]:_0x4ea3bf[_0x6a21('0x37')];_0x4e5941[_0x6a21('0x40')]=qs[_0x6a21('0x41')](_0x54a256[_0x6a21('0x38')][_0x6a21('0x41')]);_0x4e5941['where']=qs[_0x6a21('0x43')](_[_0x6a21('0x44')](_0x54a256[_0x6a21('0x38')],_0x4ea3bf[_0x6a21('0x43')]));if(_0x54a256['query'][_0x6a21('0x45')]){_0x4e5941[_0x6a21('0x42')]=_[_0x6a21('0x46')](_0x4e5941[_0x6a21('0x42')],{'$or':_[_0x6a21('0x31')](_0x4e5941[_0x6a21('0x3b')],function(_0x35c4b8){var _0x262b9={};_0x262b9[_0x35c4b8]={'$like':'%'+_0x54a256[_0x6a21('0x38')]['filter']+'%'};return _0x262b9;})});}if(_0x54a256[_0x6a21('0x38')][_0x6a21('0x5e')]){var _0x841bc0=_0x54a256[_0x6a21('0x38')][_0x6a21('0x5e')]['split'](',');var _0x32d96b={};_0x32d96b[_0x841bc0[0x0]]={'$gte':moment(_0x841bc0[0x1])[_0x6a21('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4e5941[_0x6a21('0x42')]=_[_0x6a21('0x46')](_0x4e5941[_0x6a21('0x42')],_0x32d96b);}_0x4e5941=_[_0x6a21('0x46')]({},_0x4e5941,_0x54a256['options']);return _0x572c07[_0x6a21('0x60')](_0x4e5941);}})['then'](function(_0x5794cc){if(_0x5794cc){_0x4defcc=_0x5794cc[_0x6a21('0x3d')];if(!_0x54a256[_0x6a21('0x38')][_0x6a21('0x3e')](_0x6a21('0x3f'))){_0x4e5941[_0x6a21('0x24')]=qs[_0x6a21('0x24')](_0x54a256['query'][_0x6a21('0x24')]);_0x4e5941[_0x6a21('0x22')]=qs[_0x6a21('0x22')](_0x54a256[_0x6a21('0x38')][_0x6a21('0x22')]);}return _0x572c07['getMessages'](_0x4e5941);}})[_0x6a21('0x2b')](function(_0x3c8934){if(_0x3c8934){return _0x3c8934?{'count':_0x4defcc,'rows':_0x3c8934}:null;}})[_0x6a21('0x2b')](respondWithResult(_0x57ea57,null))['catch'](handleError(_0x57ea57,null));}; \ No newline at end of file +var _0x31df=['getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','pick','removeMembers','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','ChatGroup','findAll','rows','catch','rawAttributes','create','body','find','params','describe'];(function(_0x25efa6,_0x387223){var _0x384a62=function(_0x568790){while(--_0x568790){_0x25efa6['push'](_0x25efa6['shift']());}};_0x384a62(++_0x387223);}(_0x31df,0x1f1));var _0xf31d=function(_0x59b380,_0x4e3151){_0x59b380=_0x59b380-0x0;var _0x1b8bcc=_0x31df[_0x59b380];return _0x1b8bcc;};'use strict';var emlformat=require(_0xf31d('0x0'));var rimraf=require(_0xf31d('0x1'));var zipdir=require(_0xf31d('0x2'));var jsonpatch=require(_0xf31d('0x3'));var rp=require(_0xf31d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf31d('0x5'));var util=require(_0xf31d('0x6'));var path=require(_0xf31d('0x7'));var sox=require(_0xf31d('0x8'));var csv=require(_0xf31d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf31d('0xa'));var _=require('lodash');var squel=require(_0xf31d('0xb'));var crypto=require(_0xf31d('0xc'));var jsforce=require(_0xf31d('0xd'));var deskjs=require(_0xf31d('0xe'));var toCsv=require(_0xf31d('0x9'));var querystring=require(_0xf31d('0xf'));var Papa=require('papaparse');var Redis=require(_0xf31d('0x10'));var authService=require(_0xf31d('0x11'));var qs=require(_0xf31d('0x12'));var as=require(_0xf31d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf31d('0x14'))('api');var utils=require(_0xf31d('0x15'));var config=require(_0xf31d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf31d('0x17'))['db'];config['redis']=_['defaults'](config[_0xf31d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xf31d('0x19'))(new Redis(config[_0xf31d('0x18')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x2736bb,_0x389adc){_0x389adc=_0x389adc||0xcc;return function(_0x41c057){if(_0x41c057){return _0x2736bb[_0xf31d('0x1a')](_0x389adc);}return _0x2736bb[_0xf31d('0x1b')](_0x389adc)[_0xf31d('0x1c')]();};}function respondWithResult(_0x274f9d,_0x491dbb){_0x491dbb=_0x491dbb||0xc8;return function(_0x4cd1c2){if(_0x4cd1c2){return _0x274f9d[_0xf31d('0x1b')](_0x491dbb)[_0xf31d('0x1d')](_0x4cd1c2);}};}function respondWithFilteredResult(_0x437d4b,_0x45ccbd){return function(_0x4beada){if(_0x4beada){var _0xc24f72=typeof _0x45ccbd[_0xf31d('0x1e')]===_0xf31d('0x1f')&&typeof _0x45ccbd['limit']===_0xf31d('0x1f');var _0x220936=_0x4beada[_0xf31d('0x20')];var _0x4441e4=_0xc24f72?0x0:_0x45ccbd[_0xf31d('0x1e')];var _0x4309ef=_0xc24f72?_0x4beada[_0xf31d('0x20')]:_0x45ccbd[_0xf31d('0x1e')]+_0x45ccbd[_0xf31d('0x21')];var _0x1f9a74;if(_0x4309ef>=_0x220936){_0x4309ef=_0x220936;_0x1f9a74=0xc8;}else{_0x1f9a74=0xce;}_0x437d4b[_0xf31d('0x1b')](_0x1f9a74);return _0x437d4b[_0xf31d('0x22')](_0xf31d('0x23'),_0x4441e4+'-'+_0x4309ef+'/'+_0x220936)['json'](_0x4beada);}return null;};}function patchUpdates(_0x412709){return function(_0x5436f4){try{jsonpatch[_0xf31d('0x24')](_0x5436f4,_0x412709,!![]);}catch(_0x13cc74){return BPromise[_0xf31d('0x25')](_0x13cc74);}return _0x5436f4[_0xf31d('0x26')]();};}function saveUpdates(_0x4538f2,_0x405bb3){return function(_0x1227a9){if(_0x1227a9){return _0x1227a9[_0xf31d('0x27')](_0x4538f2)[_0xf31d('0x28')](function(_0x3ee078){return _0x3ee078;});}return null;};}function removeEntity(_0xb2f787,_0xc8fc13){return function(_0x3438e9){if(_0x3438e9){return _0x3438e9[_0xf31d('0x29')]()[_0xf31d('0x28')](function(){_0xb2f787['status'](0xcc)[_0xf31d('0x1c')]();});}};}function handleEntityNotFound(_0x108051,_0x4a9d43){return function(_0x4a8ec9){if(!_0x4a8ec9){_0x108051[_0xf31d('0x1a')](0x194);}return _0x4a8ec9;};}function handleError(_0x57e4ae,_0x17fbcd){_0x17fbcd=_0x17fbcd||0x1f4;return function(_0x5e0f8a){logger['error'](_0x5e0f8a[_0xf31d('0x2a')]);if(_0x5e0f8a[_0xf31d('0x2b')]){delete _0x5e0f8a['name'];}_0x57e4ae[_0xf31d('0x1b')](_0x17fbcd)[_0xf31d('0x2c')](_0x5e0f8a);};}exports[_0xf31d('0x2d')]=function(_0x1a3a0f,_0x2a59aa){var _0x4de393={},_0x130998={},_0x4dfe55={'count':0x0,'rows':[]};var _0xe82888=_[_0xf31d('0x2e')](db['ChatGroup']['rawAttributes'],function(_0x17a9b8){return{'name':_0x17a9b8[_0xf31d('0x2f')],'type':_0x17a9b8[_0xf31d('0x30')][_0xf31d('0x31')]};});_0x130998[_0xf31d('0x32')]=_[_0xf31d('0x2e')](_0xe82888,_0xf31d('0x2b'));_0x130998[_0xf31d('0x33')]=_[_0xf31d('0x34')](_0x1a3a0f[_0xf31d('0x33')]);_0x130998['filters']=_[_0xf31d('0x35')](_0x130998[_0xf31d('0x32')],_0x130998[_0xf31d('0x33')]);_0x4de393[_0xf31d('0x36')]=_[_0xf31d('0x35')](_0x130998[_0xf31d('0x32')],qs[_0xf31d('0x37')](_0x1a3a0f[_0xf31d('0x33')][_0xf31d('0x37')]));_0x4de393[_0xf31d('0x36')]=_0x4de393['attributes'][_0xf31d('0x38')]?_0x4de393[_0xf31d('0x36')]:_0x130998[_0xf31d('0x32')];if(!_0x1a3a0f[_0xf31d('0x33')][_0xf31d('0x39')](_0xf31d('0x3a'))){_0x4de393[_0xf31d('0x21')]=qs[_0xf31d('0x21')](_0x1a3a0f[_0xf31d('0x33')][_0xf31d('0x21')]);_0x4de393['offset']=qs[_0xf31d('0x1e')](_0x1a3a0f[_0xf31d('0x33')]['offset']);}_0x4de393[_0xf31d('0x3b')]=qs[_0xf31d('0x3c')](_0x1a3a0f[_0xf31d('0x33')][_0xf31d('0x3c')]);_0x4de393[_0xf31d('0x3d')]=qs[_0xf31d('0x3e')](_['pick'](_0x1a3a0f['query'],_0x130998['filters']),_0xe82888);if(_0x1a3a0f[_0xf31d('0x33')][_0xf31d('0x3f')]){_0x4de393[_0xf31d('0x3d')]=_['merge'](_0x4de393[_0xf31d('0x3d')],{'$or':_['map'](_0xe82888,function(_0x29fad6){if(_0x29fad6[_0xf31d('0x30')]!==_0xf31d('0x40')){var _0x100c70={};_0x100c70[_0x29fad6['name']]={'$like':'%'+_0x1a3a0f[_0xf31d('0x33')][_0xf31d('0x3f')]+'%'};return _0x100c70;}})});}_0x4de393=_[_0xf31d('0x41')]({},_0x4de393,_0x1a3a0f[_0xf31d('0x42')]);var _0x5203ce={'where':_0x4de393[_0xf31d('0x3d')]};return db['ChatGroup'][_0xf31d('0x20')](_0x5203ce)[_0xf31d('0x28')](function(_0x1be19e){_0x4dfe55[_0xf31d('0x20')]=_0x1be19e;if(_0x1a3a0f[_0xf31d('0x33')][_0xf31d('0x43')]){_0x4de393[_0xf31d('0x44')]=[{'all':!![]}];}return db[_0xf31d('0x45')][_0xf31d('0x46')](_0x4de393);})[_0xf31d('0x28')](function(_0xf95305){_0x4dfe55[_0xf31d('0x47')]=_0xf95305;return _0x4dfe55;})[_0xf31d('0x28')](respondWithFilteredResult(_0x2a59aa,_0x4de393))[_0xf31d('0x48')](handleError(_0x2a59aa,null));};exports['show']=function(_0x3bc22d,_0x285917){var _0xbb92ad={'raw':!![],'where':{'id':_0x3bc22d['params']['id']}},_0x266459={};_0x266459['model']=_['keys'](db['ChatGroup'][_0xf31d('0x49')]);_0x266459[_0xf31d('0x33')]=_['keys'](_0x3bc22d['query']);_0x266459[_0xf31d('0x3e')]=_[_0xf31d('0x35')](_0x266459[_0xf31d('0x32')],_0x266459[_0xf31d('0x33')]);_0xbb92ad[_0xf31d('0x36')]=_[_0xf31d('0x35')](_0x266459[_0xf31d('0x32')],qs['fields'](_0x3bc22d[_0xf31d('0x33')][_0xf31d('0x37')]));_0xbb92ad[_0xf31d('0x36')]=_0xbb92ad[_0xf31d('0x36')]['length']?_0xbb92ad[_0xf31d('0x36')]:_0x266459['model'];if(_0x3bc22d[_0xf31d('0x33')]['includeAll']){_0xbb92ad[_0xf31d('0x44')]=[{'all':!![]}];}_0xbb92ad=_[_0xf31d('0x41')]({},_0xbb92ad,_0x3bc22d[_0xf31d('0x42')]);return db[_0xf31d('0x45')]['find'](_0xbb92ad)['then'](handleEntityNotFound(_0x285917,null))[_0xf31d('0x28')](respondWithResult(_0x285917,null))[_0xf31d('0x48')](handleError(_0x285917,null));};exports['create']=function(_0x18c737,_0x1e0779){return db[_0xf31d('0x45')][_0xf31d('0x4a')](_0x18c737[_0xf31d('0x4b')],{})[_0xf31d('0x28')](respondWithResult(_0x1e0779,0xc9))[_0xf31d('0x48')](handleError(_0x1e0779,null));};exports[_0xf31d('0x27')]=function(_0x38f198,_0x2b10ea){if(_0x38f198[_0xf31d('0x4b')]['id']){delete _0x38f198['body']['id'];}return db['ChatGroup'][_0xf31d('0x4c')]({'where':{'id':_0x38f198[_0xf31d('0x4d')]['id']}})[_0xf31d('0x28')](handleEntityNotFound(_0x2b10ea,null))[_0xf31d('0x28')](saveUpdates(_0x38f198[_0xf31d('0x4b')],null))[_0xf31d('0x28')](respondWithResult(_0x2b10ea,null))['catch'](handleError(_0x2b10ea,null));};exports[_0xf31d('0x29')]=function(_0x3f5acb,_0x5f3e2b){return db[_0xf31d('0x45')]['find']({'where':{'id':_0x3f5acb[_0xf31d('0x4d')]['id']}})[_0xf31d('0x28')](handleEntityNotFound(_0x5f3e2b,null))[_0xf31d('0x28')](removeEntity(_0x5f3e2b,null))[_0xf31d('0x48')](handleError(_0x5f3e2b,null));};exports['describe']=function(_0x2cb7dd,_0x42ee7c){return db['ChatGroup'][_0xf31d('0x4e')]()['then'](respondWithResult(_0x42ee7c,null))[_0xf31d('0x48')](handleError(_0x42ee7c,null));};exports[_0xf31d('0x4f')]=function(_0x502bbd,_0x31fe38,_0xbe9ce3){return db[_0xf31d('0x50')][_0xf31d('0x20')]({'where':{'ChatGroupId':_0x502bbd[_0xf31d('0x4d')]['id'],'ToId':_0x502bbd[_0xf31d('0x51')]['id'],'read':![]}})['then'](function(_0x4020f3){return{'id':_['toInteger'](_0x502bbd[_0xf31d('0x4d')]['id']),'count':_0x4020f3};})[_0xf31d('0x28')](respondWithResult(_0x31fe38,null))[_0xf31d('0x48')](handleError(_0x31fe38,null));};exports[_0xf31d('0x52')]=function(_0x928420,_0x5129ac,_0xbea01e){return db[_0xf31d('0x45')][_0xf31d('0x4c')]({'where':{'id':_0x928420[_0xf31d('0x4d')]['id']}})[_0xf31d('0x28')](handleEntityNotFound(_0x5129ac,null))[_0xf31d('0x28')](function(_0x4b6199){if(_0x4b6199){return _0x4b6199[_0xf31d('0x52')](_0x928420[_0xf31d('0x4b')][_0xf31d('0x53')],_[_0xf31d('0x54')](_0x928420[_0xf31d('0x4b')],[_0xf31d('0x53'),'id'])||{});}})[_0xf31d('0x28')](respondWithResult(_0x5129ac,null))[_0xf31d('0x48')](handleError(_0x5129ac,null));};exports[_0xf31d('0x55')]=function(_0x3bb815,_0x3a9906,_0x9a94d8){var _0x54bd38={};var _0x151610={};var _0x177eb5;var _0x8c98be;return db[_0xf31d('0x45')]['findOne']({'where':{'id':_0x3bb815[_0xf31d('0x4d')]['id']}})[_0xf31d('0x28')](handleEntityNotFound(_0x3a9906,null))['then'](function(_0x237e54){if(_0x237e54){_0x177eb5=_0x237e54;_0x151610[_0xf31d('0x32')]=_[_0xf31d('0x34')](db[_0xf31d('0x56')]['rawAttributes']);_0x151610['query']=_['keys'](_0x3bb815[_0xf31d('0x33')]);_0x151610[_0xf31d('0x3e')]=_[_0xf31d('0x35')](_0x151610[_0xf31d('0x32')],_0x151610['query']);_0x54bd38[_0xf31d('0x36')]=_[_0xf31d('0x35')](_0x151610[_0xf31d('0x32')],qs[_0xf31d('0x37')](_0x3bb815[_0xf31d('0x33')][_0xf31d('0x37')]));_0x54bd38[_0xf31d('0x36')]=_0x54bd38[_0xf31d('0x36')][_0xf31d('0x38')]?_0x54bd38[_0xf31d('0x36')]:_0x151610['model'];_0x54bd38[_0xf31d('0x3b')]=qs['sort'](_0x3bb815[_0xf31d('0x33')][_0xf31d('0x3c')]);_0x54bd38[_0xf31d('0x3d')]=qs[_0xf31d('0x3e')](_[_0xf31d('0x57')](_0x3bb815[_0xf31d('0x33')],_0x151610['filters']));if(_0x3bb815[_0xf31d('0x33')][_0xf31d('0x3f')]){_0x54bd38[_0xf31d('0x3d')]=_[_0xf31d('0x41')](_0x54bd38[_0xf31d('0x3d')],{'$or':_[_0xf31d('0x2e')](_0x54bd38[_0xf31d('0x36')],function(_0x3549b9){var _0x374a7e={};_0x374a7e[_0x3549b9]={'$like':'%'+_0x3bb815[_0xf31d('0x33')][_0xf31d('0x3f')]+'%'};return _0x374a7e;})});}_0x54bd38=_[_0xf31d('0x41')]({},_0x54bd38,_0x3bb815[_0xf31d('0x42')]);return _0x177eb5[_0xf31d('0x55')](_0x54bd38);}})[_0xf31d('0x28')](function(_0x476b9b){if(_0x476b9b){_0x8c98be=_0x476b9b['length'];if(!_0x3bb815[_0xf31d('0x33')][_0xf31d('0x39')](_0xf31d('0x3a'))){_0x54bd38[_0xf31d('0x21')]=qs[_0xf31d('0x21')](_0x3bb815[_0xf31d('0x33')][_0xf31d('0x21')]);_0x54bd38['offset']=qs[_0xf31d('0x1e')](_0x3bb815[_0xf31d('0x33')][_0xf31d('0x1e')]);}return _0x177eb5[_0xf31d('0x55')](_0x54bd38);}})[_0xf31d('0x28')](function(_0x378b34){if(_0x378b34){return _0x378b34?{'count':_0x8c98be,'rows':_0x378b34}:null;}})['then'](respondWithResult(_0x3a9906,null))[_0xf31d('0x48')](handleError(_0x3a9906,null));};exports[_0xf31d('0x58')]=function(_0x12ec61,_0x1bd22c,_0xb62efd){return db[_0xf31d('0x45')][_0xf31d('0x4c')]({'where':{'id':_0x12ec61[_0xf31d('0x4d')]['id']}})[_0xf31d('0x28')](handleEntityNotFound(_0x1bd22c,null))[_0xf31d('0x28')](function(_0x26d86e){if(_0x26d86e){return _0x26d86e[_0xf31d('0x58')](_0x12ec61[_0xf31d('0x33')]['ids']);}})[_0xf31d('0x28')](respondWithStatusCode(_0x1bd22c,null))[_0xf31d('0x48')](handleError(_0x1bd22c,null));};exports['addMessage']=function(_0x202701,_0x3d8546,_0x282106){if(_0x202701[_0xf31d('0x4b')]['id']){delete _0x202701['body']['id'];}return db[_0xf31d('0x45')][_0xf31d('0x4c')]({'where':{'id':_0x202701[_0xf31d('0x4d')]['id']}})[_0xf31d('0x28')](handleEntityNotFound(_0x3d8546,null))['then'](function(_0x20dbca){if(_0x20dbca){_0x202701[_0xf31d('0x4b')][_0xf31d('0x59')]=_0x20dbca['id'];return db[_0xf31d('0x50')][_0xf31d('0x4a')](_0x202701['body']);}})[_0xf31d('0x28')](respondWithResult(_0x3d8546,null))[_0xf31d('0x48')](handleError(_0x3d8546,null));};exports[_0xf31d('0x5a')]=function(_0xd8dc8c,_0x4c2524,_0x12554d){var _0x5007b7={};var _0x328873={};var _0xd01c5a;var _0x33cb5a;return db[_0xf31d('0x45')][_0xf31d('0x5b')]({'where':{'id':_0xd8dc8c[_0xf31d('0x4d')]['id']}})[_0xf31d('0x28')](handleEntityNotFound(_0x4c2524,null))[_0xf31d('0x28')](function(_0x27d53b){if(_0x27d53b){_0xd01c5a=_0x27d53b;_0x328873[_0xf31d('0x32')]=_[_0xf31d('0x34')](db[_0xf31d('0x50')][_0xf31d('0x49')]);_0x328873[_0xf31d('0x33')]=_[_0xf31d('0x34')](_0xd8dc8c[_0xf31d('0x33')]);_0x328873[_0xf31d('0x3e')]=_[_0xf31d('0x35')](_0x328873[_0xf31d('0x32')],_0x328873[_0xf31d('0x33')]);_0x5007b7[_0xf31d('0x36')]=_[_0xf31d('0x35')](_0x328873['model'],qs['fields'](_0xd8dc8c[_0xf31d('0x33')]['fields']));_0x5007b7[_0xf31d('0x36')]=_0x5007b7[_0xf31d('0x36')][_0xf31d('0x38')]?_0x5007b7[_0xf31d('0x36')]:_0x328873[_0xf31d('0x32')];_0x5007b7[_0xf31d('0x3b')]=qs['sort'](_0xd8dc8c[_0xf31d('0x33')]['sort']);_0x5007b7['where']=qs[_0xf31d('0x3e')](_[_0xf31d('0x57')](_0xd8dc8c[_0xf31d('0x33')],_0x328873[_0xf31d('0x3e')]));if(_0xd8dc8c[_0xf31d('0x33')][_0xf31d('0x3f')]){_0x5007b7['where']=_['merge'](_0x5007b7[_0xf31d('0x3d')],{'$or':_['map'](_0x5007b7[_0xf31d('0x36')],function(_0x1bd6da){var _0x1dae62={};_0x1dae62[_0x1bd6da]={'$like':'%'+_0xd8dc8c[_0xf31d('0x33')]['filter']+'%'};return _0x1dae62;})});}if(_0xd8dc8c[_0xf31d('0x33')]['$gte']){var _0x4a1f55=_0xd8dc8c['query'][_0xf31d('0x5c')][_0xf31d('0x5d')](',');var _0x24e615={};_0x24e615[_0x4a1f55[0x0]]={'$gte':moment(_0x4a1f55[0x1])[_0xf31d('0x5e')](_0xf31d('0x5f'))};_0x5007b7[_0xf31d('0x3d')]=_[_0xf31d('0x41')](_0x5007b7[_0xf31d('0x3d')],_0x24e615);}_0x5007b7=_['merge']({},_0x5007b7,_0xd8dc8c[_0xf31d('0x42')]);return _0xd01c5a['getMessages'](_0x5007b7);}})[_0xf31d('0x28')](function(_0x10e752){if(_0x10e752){_0x33cb5a=_0x10e752[_0xf31d('0x38')];if(!_0xd8dc8c[_0xf31d('0x33')]['hasOwnProperty'](_0xf31d('0x3a'))){_0x5007b7['limit']=qs[_0xf31d('0x21')](_0xd8dc8c[_0xf31d('0x33')][_0xf31d('0x21')]);_0x5007b7[_0xf31d('0x1e')]=qs[_0xf31d('0x1e')](_0xd8dc8c[_0xf31d('0x33')][_0xf31d('0x1e')]);}return _0xd01c5a[_0xf31d('0x5a')](_0x5007b7);}})['then'](function(_0x4994e3){if(_0x4994e3){return _0x4994e3?{'count':_0x33cb5a,'rows':_0x4994e3}:null;}})[_0xf31d('0x28')](respondWithResult(_0x4c2524,null))[_0xf31d('0x48')](handleError(_0x4c2524,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e1d8e8a..8bd751d 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 _0x52ad=['emit','hasOwnProperty','hook','exports','ChatGroup','save','update','remove'];(function(_0x58d90a,_0x1a2ea6){var _0x3938a9=function(_0x4f324c){while(--_0x4f324c){_0x58d90a['push'](_0x58d90a['shift']());}};_0x3938a9(++_0x1a2ea6);}(_0x52ad,0xd4));var _0xd52a=function(_0x1c1655,_0x46c212){_0x1c1655=_0x1c1655-0x0;var _0x159ee2=_0x52ad[_0x1c1655];return _0x159ee2;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xd52a('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd52a('0x1'),'afterUpdate':_0xd52a('0x2'),'afterDestroy':_0xd52a('0x3')};function emitEvent(_0x4c26b7){return function(_0x34e3af,_0x503160,_0x25cb54){ChatGroupEvents[_0xd52a('0x4')](_0x4c26b7+':'+_0x34e3af['id'],_0x34e3af);ChatGroupEvents['emit'](_0x4c26b7,_0x34e3af);_0x25cb54(null);};}for(var e in events){if(events[_0xd52a('0x5')](e)){var event=events[e];ChatGroup[_0xd52a('0x6')](e,emitEvent(event));}}module[_0xd52a('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xf8fb=['hook','events','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xf8fb,0x184));var _0xbf8f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf8fb[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require(_0xbf8f('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbf8f('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbf8f('0x2')](0x0);var events={'afterCreate':_0xbf8f('0x3'),'afterUpdate':_0xbf8f('0x4'),'afterDestroy':_0xbf8f('0x5')};function emitEvent(_0x54cde4){return function(_0xf0aaeb,_0x41d662,_0x1e073a){ChatGroupEvents[_0xbf8f('0x6')](_0x54cde4+':'+_0xf0aaeb['id'],_0xf0aaeb);ChatGroupEvents[_0xbf8f('0x6')](_0x54cde4,_0xf0aaeb);_0x1e073a(null);};}for(var e in events){if(events[_0xbf8f('0x7')](e)){var event=events[e];ChatGroup[_0xbf8f('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 8fa328d..2fc775d 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 _0x7355=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x7355,0x17e));var _0x5735=function(_0x29fae1,_0xad0704){_0x29fae1=_0x29fae1-0x0;var _0x3986d6=_0x7355[_0x29fae1];return _0x3986d6;};'use strict';var _=require('lodash');var util=require(_0x5735('0x0'));var logger=require(_0x5735('0x1'))(_0x5735('0x2'));var moment=require(_0x5735('0x3'));var BPromise=require(_0x5735('0x4'));var rp=require(_0x5735('0x5'));var fs=require('fs');var path=require(_0x5735('0x6'));var rimraf=require(_0x5735('0x7'));var config=require('../../config/environment');var attributes=require(_0x5735('0x8'));module[_0x5735('0x9')]=function(_0x6ee1c0,_0x309394){return _0x6ee1c0[_0x5735('0xa')](_0x5735('0xb'),attributes,{'tableName':_0x5735('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa3=['../../config/environment','define','ChatGroup','chat_groups','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x277e95,_0x21e0d8){var _0x5634dc=function(_0x136578){while(--_0x136578){_0x277e95['push'](_0x277e95['shift']());}};_0x5634dc(++_0x21e0d8);}(_0x6aa3,0xae));var _0x36aa=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0x6aa3[_0x33c603];return _0xae96f4;};'use strict';var _=require(_0x36aa('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x36aa('0x1'));var BPromise=require(_0x36aa('0x2'));var rp=require(_0x36aa('0x3'));var fs=require('fs');var path=require(_0x36aa('0x4'));var rimraf=require(_0x36aa('0x5'));var config=require(_0x36aa('0x6'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x908b65,_0x34d93e){return _0x908b65[_0x36aa('0x7')](_0x36aa('0x8'),attributes,{'tableName':_0x36aa('0x9'),'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 ed6bd56..4986f43 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 _0xd347=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x498e78,_0x1d6412){var _0x476268=function(_0x325434){while(--_0x325434){_0x498e78['push'](_0x498e78['shift']());}};_0x476268(++_0x1d6412);}(_0xd347,0x182));var _0x7d34=function(_0x3fec86,_0x41c942){_0x3fec86=_0x3fec86-0x0;var _0x1b4499=_0xd347[_0x3fec86];return _0x1b4499;};'use strict';var _=require(_0x7d34('0x0'));var util=require(_0x7d34('0x1'));var moment=require(_0x7d34('0x2'));var BPromise=require('bluebird');var rs=require(_0x7d34('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d34('0x4'));var logger=require(_0x7d34('0x5'))(_0x7d34('0x6'));var config=require(_0x7d34('0x7'));var jayson=require(_0x7d34('0x8'));var client=jayson[_0x7d34('0x9')][_0x7d34('0xa')]({'port':0x232a});config[_0x7d34('0xb')]=_[_0x7d34('0xc')](config[_0x7d34('0xb')],{'host':_0x7d34('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d34('0xb')]));require(_0x7d34('0xe'))[_0x7d34('0xf')](socket);function respondWithRpcPromise(_0x4deb0d,_0x266182,_0x117987){return new BPromise(function(_0x2f9374,_0x34b3ce){return client[_0x7d34('0x10')](_0x4deb0d,_0x117987)[_0x7d34('0x11')](function(_0x5e2f23){logger['info'](_0x7d34('0x12'),_0x266182,'request\x20sent');logger[_0x7d34('0x13')](_0x7d34('0x14'),_0x266182,_0x7d34('0x15'),JSON[_0x7d34('0x16')](_0x5e2f23));if(_0x5e2f23[_0x7d34('0x17')]){if(_0x5e2f23[_0x7d34('0x17')]['code']===0x1f4){logger[_0x7d34('0x17')]('ChatGroup,\x20%s,\x20%s',_0x266182,_0x5e2f23[_0x7d34('0x17')][_0x7d34('0x18')]);return _0x34b3ce(_0x5e2f23['error'][_0x7d34('0x18')]);}logger[_0x7d34('0x17')]('ChatGroup,\x20%s,\x20%s',_0x266182,_0x5e2f23[_0x7d34('0x17')]['message']);return _0x2f9374(_0x5e2f23[_0x7d34('0x17')][_0x7d34('0x18')]);}else{logger[_0x7d34('0x19')]('ChatGroup,\x20%s,\x20%s',_0x266182,_0x7d34('0x15'));_0x2f9374(_0x5e2f23[_0x7d34('0x1a')][_0x7d34('0x18')]);}})[_0x7d34('0x1b')](function(_0x43b30b){logger[_0x7d34('0x17')]('ChatGroup,\x20%s,\x20%s',_0x266182,_0x43b30b);_0x34b3ce(_0x43b30b);});});} \ No newline at end of file +var _0xc300=['error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatGroup.socket','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3e9edb,_0x464c8f){var _0x2a1e74=function(_0x104505){while(--_0x104505){_0x3e9edb['push'](_0x3e9edb['shift']());}};_0x2a1e74(++_0x464c8f);}(_0xc300,0x132));var _0x0c30=function(_0x91bf20,_0x37ee1c){_0x91bf20=_0x91bf20-0x0;var _0x13de6c=_0xc300[_0x91bf20];return _0x13de6c;};'use strict';var _=require(_0x0c30('0x0'));var util=require(_0x0c30('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c30('0x2'));var fs=require('fs');var Redis=require(_0x0c30('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c30('0x4'));var logger=require(_0x0c30('0x5'))(_0x0c30('0x6'));var config=require(_0x0c30('0x7'));var jayson=require(_0x0c30('0x8'));var client=jayson[_0x0c30('0x9')][_0x0c30('0xa')]({'port':0x232a});config[_0x0c30('0xb')]=_['defaults'](config[_0x0c30('0xb')],{'host':_0x0c30('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c30('0xb')]));require(_0x0c30('0xd'))['register'](socket);function respondWithRpcPromise(_0x351cca,_0x2d077e,_0x1c8c00){return new BPromise(function(_0x104032,_0x1421b8){return client['request'](_0x351cca,_0x1c8c00)['then'](function(_0x1481d9){logger[_0x0c30('0xe')]('ChatGroup,\x20%s,\x20%s',_0x2d077e,'request\x20sent');logger[_0x0c30('0xf')](_0x0c30('0x10'),_0x2d077e,_0x0c30('0x11'),JSON[_0x0c30('0x12')](_0x1481d9));if(_0x1481d9[_0x0c30('0x13')]){if(_0x1481d9['error'][_0x0c30('0x14')]===0x1f4){logger['error'](_0x0c30('0x15'),_0x2d077e,_0x1481d9[_0x0c30('0x13')][_0x0c30('0x16')]);return _0x1421b8(_0x1481d9[_0x0c30('0x13')][_0x0c30('0x16')]);}logger[_0x0c30('0x13')]('ChatGroup,\x20%s,\x20%s',_0x2d077e,_0x1481d9[_0x0c30('0x13')]['message']);return _0x104032(_0x1481d9[_0x0c30('0x13')][_0x0c30('0x16')]);}else{logger[_0x0c30('0xe')]('ChatGroup,\x20%s,\x20%s',_0x2d077e,_0x0c30('0x11'));_0x104032(_0x1481d9[_0x0c30('0x17')][_0x0c30('0x16')]);}})[_0x0c30('0x18')](function(_0x5c04d9){logger[_0x0c30('0x13')](_0x0c30('0x15'),_0x2d077e,_0x5c04d9);_0x1421b8(_0x5c04d9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a42af50..72d4667 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 _0xeadb=['remove','update','removeListener','register','./chatGroup.events'];(function(_0x5204bc,_0x16596d){var _0x3188d8=function(_0x194ea8){while(--_0x194ea8){_0x5204bc['push'](_0x5204bc['shift']());}};_0x3188d8(++_0x16596d);}(_0xeadb,0xbd));var _0xbead=function(_0x5abb66,_0x890ddd){_0x5abb66=_0x5abb66-0x0;var _0x42f50e=_0xeadb[_0x5abb66];return _0x42f50e;};'use strict';var ChatGroupEvents=require(_0xbead('0x0'));var events=['save',_0xbead('0x1'),_0xbead('0x2')];function createListener(_0x41815a,_0xe1559d){return function(_0x419d80){_0xe1559d['emit'](_0x41815a,_0x419d80);};}function removeListener(_0x14a322,_0x50c2e4){return function(){ChatGroupEvents[_0xbead('0x3')](_0x14a322,_0x50c2e4);};}exports[_0xbead('0x4')]=function(_0x3854d3){for(var _0x232b4f=0x0,_0x16e4cc=events['length'];_0x232b4f<_0x16e4cc;_0x232b4f++){var _0x5c3148=events[_0x232b4f];var _0x41f91b=createListener('chatGroup:'+_0x5c3148,_0x3854d3);ChatGroupEvents['on'](_0x5c3148,_0x41f91b);}}; \ No newline at end of file +var _0xb846=['emit','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x3c1113,_0xdc9aa7){var _0x18a2a6=function(_0x958423){while(--_0x958423){_0x3c1113['push'](_0x3c1113['shift']());}};_0x18a2a6(++_0xdc9aa7);}(_0xb846,0x162));var _0x6b84=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb846[_0x465028];return _0xb783d4;};'use strict';var ChatGroupEvents=require(_0x6b84('0x0'));var events=[_0x6b84('0x1'),'remove',_0x6b84('0x2')];function createListener(_0x1a886e,_0x3eaa40){return function(_0x1f8c79){_0x3eaa40[_0x6b84('0x3')](_0x1a886e,_0x1f8c79);};}function removeListener(_0x32eac3,_0x3797a3){return function(){ChatGroupEvents['removeListener'](_0x32eac3,_0x3797a3);};}exports[_0x6b84('0x4')]=function(_0x780d90){for(var _0x38a87f=0x0,_0x3b3a9e=events[_0x6b84('0x5')];_0x38a87f<_0x3b3a9e;_0x38a87f++){var _0x4f2913=events[_0x38a87f];var _0x3ffdb9=createListener(_0x6b84('0x6')+_0x4f2913,_0x780d90);ChatGroupEvents['on'](_0x4f2913,_0x3ffdb9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 7865ae5..38ef468 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 _0x3fdf=['/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe','/:id','show','/:id/unread'];(function(_0x5280c2,_0x238faf){var _0x283bf6=function(_0x150603){while(--_0x150603){_0x5280c2['push'](_0x5280c2['shift']());}};_0x283bf6(++_0x238faf);}(_0x3fdf,0xfb));var _0xf3fd=function(_0x305cd9,_0x58f45c){_0x305cd9=_0x305cd9-0x0;var _0x23a541=_0x3fdf[_0x305cd9];return _0x23a541;};'use strict';var multer=require('multer');var util=require(_0xf3fd('0x0'));var path=require(_0xf3fd('0x1'));var timeout=require(_0xf3fd('0x2'));var express=require('express');var router=express[_0xf3fd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf3fd('0x4'));var config=require(_0xf3fd('0x5'));var controller=require(_0xf3fd('0x6'));router[_0xf3fd('0x7')]('/',auth[_0xf3fd('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf3fd('0x9')]);router[_0xf3fd('0x7')](_0xf3fd('0xa'),auth[_0xf3fd('0x8')](),controller[_0xf3fd('0xb')]);router[_0xf3fd('0x7')](_0xf3fd('0xc'),auth[_0xf3fd('0x8')](),controller['getUnread']);router[_0xf3fd('0x7')](_0xf3fd('0xd'),auth[_0xf3fd('0x8')](),controller[_0xf3fd('0xe')]);router[_0xf3fd('0x7')](_0xf3fd('0xf'),auth[_0xf3fd('0x8')](),controller[_0xf3fd('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf3fd('0x11')](_0xf3fd('0xd'),auth['isAuthenticated'](),controller[_0xf3fd('0x12')]);router[_0xf3fd('0x11')]('/:id/messages',auth[_0xf3fd('0x8')](),controller[_0xf3fd('0x13')]);router['put'](_0xf3fd('0xa'),auth[_0xf3fd('0x8')](),controller[_0xf3fd('0x14')]);router[_0xf3fd('0x15')](_0xf3fd('0xa'),auth['isAuthenticated'](),controller[_0xf3fd('0x16')]);router[_0xf3fd('0x15')](_0xf3fd('0xd'),auth[_0xf3fd('0x8')](),controller['removeMembers']);module[_0xf3fd('0x17')]=router; \ No newline at end of file +var _0x32d5=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','addMembers','addMessage','put','/:id','update','delete','removeMembers','exports'];(function(_0x2bf460,_0x12ca5d){var _0x559af3=function(_0x4fa7ac){while(--_0x4fa7ac){_0x2bf460['push'](_0x2bf460['shift']());}};_0x559af3(++_0x12ca5d);}(_0x32d5,0x16c));var _0x532d=function(_0x550e6f,_0x3e639b){_0x550e6f=_0x550e6f-0x0;var _0x1ec4b3=_0x32d5[_0x550e6f];return _0x1ec4b3;};'use strict';var multer=require(_0x532d('0x0'));var util=require('util');var path=require(_0x532d('0x1'));var timeout=require(_0x532d('0x2'));var express=require(_0x532d('0x3'));var router=express[_0x532d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x532d('0x5'));var config=require(_0x532d('0x6'));var controller=require(_0x532d('0x7'));router[_0x532d('0x8')]('/',auth[_0x532d('0x9')](),controller[_0x532d('0xa')]);router[_0x532d('0x8')](_0x532d('0xb'),auth[_0x532d('0x9')](),controller[_0x532d('0xc')]);router[_0x532d('0x8')]('/:id',auth[_0x532d('0x9')](),controller[_0x532d('0xd')]);router[_0x532d('0x8')](_0x532d('0xe'),auth[_0x532d('0x9')](),controller[_0x532d('0xf')]);router[_0x532d('0x8')](_0x532d('0x10'),auth[_0x532d('0x9')](),controller[_0x532d('0x11')]);router['get'](_0x532d('0x12'),auth[_0x532d('0x9')](),controller['getMessages']);router[_0x532d('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x532d('0x13')]('/:id/members',auth[_0x532d('0x9')](),controller[_0x532d('0x14')]);router[_0x532d('0x13')](_0x532d('0x12'),auth['isAuthenticated'](),controller[_0x532d('0x15')]);router[_0x532d('0x16')](_0x532d('0x17'),auth[_0x532d('0x9')](),controller[_0x532d('0x18')]);router['delete'](_0x532d('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0x532d('0x19')](_0x532d('0x10'),auth[_0x532d('0x9')](),controller[_0x532d('0x1a')]);module[_0x532d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f17a333..dea2fe8 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 _0x0427=['INTEGER','star','thumb','TEXT','STRING','DATE','out','BOOLEAN'];(function(_0x46684e,_0x55dac7){var _0x15cdc1=function(_0x4f2083){while(--_0x4f2083){_0x46684e['push'](_0x46684e['shift']());}};_0x15cdc1(++_0x55dac7);}(_0x0427,0x137));var _0x7042=function(_0x5a6ccc,_0x52259c){_0x5a6ccc=_0x5a6ccc-0x0;var _0x46ae25=_0x0427[_0x5a6ccc];return _0x46ae25;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x7042('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7042('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0x7042('0x2'),_0x7042('0x3')),'defaultValue':_0x7042('0x2')},'ratingMessage':{'type':Sequelize[_0x7042('0x4')]},'pathTranscript':{'type':Sequelize[_0x7042('0x4')]},'mailTranscript':{'type':Sequelize[_0x7042('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7042('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7042('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7042('0x5')]},'note':{'type':Sequelize[_0x7042('0x5')]},'browserName':{'type':Sequelize[_0x7042('0x5')]},'browserVersion':{'type':Sequelize[_0x7042('0x5')]},'osName':{'type':Sequelize[_0x7042('0x5')]},'osVersion':{'type':Sequelize[_0x7042('0x5')]},'deviceModel':{'type':Sequelize[_0x7042('0x5')]},'deviceVendor':{'type':Sequelize[_0x7042('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x7042('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x7042('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7042('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7042('0x5')]},'customerPort':{'type':Sequelize[_0x7042('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0db9=['long','DATE','BOOLEAN','sequelize','ENUM','star','TEXT','STRING'];(function(_0x1d7c54,_0x1ac0f7){var _0xdd6e7a=function(_0x4890fd){while(--_0x4890fd){_0x1d7c54['push'](_0x1d7c54['shift']());}};_0xdd6e7a(++_0x1ac0f7);}(_0x0db9,0xa3));var _0x90db=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x0db9[_0x164af1];return _0x5d81a2;};'use strict';var Sequelize=require(_0x90db('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x90db('0x1')](_0x90db('0x2'),'thumb'),'defaultValue':_0x90db('0x2')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x90db('0x3')]},'mailTranscript':{'type':Sequelize[_0x90db('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x90db('0x4')]},'secondDisposition':{'type':Sequelize[_0x90db('0x4')]},'thirdDisposition':{'type':Sequelize[_0x90db('0x4')]},'note':{'type':Sequelize[_0x90db('0x4')]},'browserName':{'type':Sequelize[_0x90db('0x4')]},'browserVersion':{'type':Sequelize[_0x90db('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x90db('0x4')]},'deviceModel':{'type':Sequelize[_0x90db('0x4')]},'deviceVendor':{'type':Sequelize[_0x90db('0x4')]},'deviceType':{'type':Sequelize[_0x90db('0x4')]},'referer':{'type':Sequelize[_0x90db('0x3')]},'customerIp':{'type':Sequelize[_0x90db('0x4')]},'formData':{'type':Sequelize[_0x90db('0x3')](_0x90db('0x5'))},'read1stAt':{'type':Sequelize[_0x90db('0x6')]},'lastMsgAt':{'type':Sequelize[_0x90db('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x90db('0x1')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x90db('0x4')]},'customerPort':{'type':Sequelize[_0x90db('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x90db('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x90db('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 97064f5..573e000 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 _0x8603=['Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','omit','getMessages','nolimit','pick','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','getMyMessages','hasOwnProperty','includeAgent','addTags','setTags','spread','chatInteractionTags:save','removeTags','download','unix','server','files','attachments','Attachment','Account','Owner','mkdirSync','Chat','N.A.','closedAt','disposition','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','update','then','stack','name','send','render','contact','agent','interaction','account','Users','fullname','Tags','TagIds','split','push','catch','index','map','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','Tag','forEach','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','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','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooMetadata','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooNote','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','customUpdate','abandon','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','basename','mimetype','attachmentDownload'];(function(_0x420166,_0x4767a3){var _0x56a849=function(_0x2f449c){while(--_0x2f449c){_0x420166['push'](_0x420166['shift']());}};_0x56a849(++_0x4767a3);}(_0x8603,0x190));var _0x3860=function(_0x29438f,_0x34671f){_0x29438f=_0x29438f-0x0;var _0x22d852=_0x8603[_0x29438f];return _0x22d852;};'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 pdf=require(_0x3860('0x10'));var hardwareService=require(_0x3860('0x11'));var logger=require('../../config/logger')(_0x3860('0x12'));var utils=require(_0x3860('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3860('0x14'));var db=require(_0x3860('0x15'))['db'];config[_0x3860('0x16')]=_[_0x3860('0x17')](config[_0x3860('0x16')],{'host':_0x3860('0x18'),'port':0x18eb});var socket=require(_0x3860('0x19'))(new Redis(config[_0x3860('0x16')]));require(_0x3860('0x1a'))[_0x3860('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3860('0x1c')][_0x3860('0x1d')]({'port':0x232b});var client9004=jayson[_0x3860('0x1c')][_0x3860('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1055b3,_0xfa0c9a,_0x2d8a3a,_0x378305){return new BPromise(function(_0x311fdb,_0x3c0d91){var _0x3e51b4=_0x378305||client;return _0x3e51b4[_0x3860('0x1e')](_0x1055b3,_0x2d8a3a)['then'](function(_0x4863bd){logger[_0x3860('0x1f')](_0x3860('0x20'),_0xfa0c9a,_0x3860('0x21'));logger['debug'](_0x3860('0x22'),_0xfa0c9a,_0x3860('0x21'),JSON[_0x3860('0x23')](_0x4863bd));if(_0x4863bd[_0x3860('0x24')]){if(_0x4863bd[_0x3860('0x24')][_0x3860('0x25')]===0x1f4){logger[_0x3860('0x24')](_0x3860('0x20'),_0xfa0c9a,_0x4863bd[_0x3860('0x24')][_0x3860('0x26')]);return _0x3c0d91(_0x4863bd[_0x3860('0x24')][_0x3860('0x26')]);}logger[_0x3860('0x24')](_0x3860('0x20'),_0xfa0c9a,_0x4863bd[_0x3860('0x24')]['message']);return _0x311fdb(_0x4863bd[_0x3860('0x24')][_0x3860('0x26')]);}else{logger[_0x3860('0x1f')](_0x3860('0x20'),_0xfa0c9a,_0x3860('0x21'));_0x311fdb(_0x4863bd['result'][_0x3860('0x26')]);}})['catch'](function(_0x577750){logger[_0x3860('0x24')](_0x3860('0x20'),_0xfa0c9a,_0x577750);_0x3c0d91(_0x577750);});});}function respondWithStatusCode(_0x54b5ec,_0x4d9a90){_0x4d9a90=_0x4d9a90||0xcc;return function(_0x5f42d5){if(_0x5f42d5){return _0x54b5ec[_0x3860('0x27')](_0x4d9a90);}return _0x54b5ec[_0x3860('0x28')](_0x4d9a90)[_0x3860('0x29')]();};}function respondWithResult(_0x371f3a,_0x9332a5){_0x9332a5=_0x9332a5||0xc8;return function(_0x228d34){if(_0x228d34){return _0x371f3a['status'](_0x9332a5)['json'](_0x228d34);}};}function respondWithFilteredResult(_0x389bd0,_0x1f1809){return function(_0x5a9af2){if(_0x5a9af2){var _0x2551f4=typeof _0x1f1809[_0x3860('0x2a')]===_0x3860('0x2b')&&typeof _0x1f1809[_0x3860('0x2c')]===_0x3860('0x2b');var _0x4bbae9=_0x5a9af2[_0x3860('0x2d')];var _0xf624ba=_0x2551f4?0x0:_0x1f1809[_0x3860('0x2a')];var _0x4bd90c=_0x2551f4?_0x5a9af2[_0x3860('0x2d')]:_0x1f1809['offset']+_0x1f1809[_0x3860('0x2c')];var _0x4825f0;if(_0x4bd90c>=_0x4bbae9){_0x4bd90c=_0x4bbae9;_0x4825f0=0xc8;}else{_0x4825f0=0xce;}_0x389bd0[_0x3860('0x28')](_0x4825f0);return _0x389bd0[_0x3860('0x2e')](_0x3860('0x2f'),_0xf624ba+'-'+_0x4bd90c+'/'+_0x4bbae9)['json'](_0x5a9af2);}return null;};}function patchUpdates(_0x39c751){return function(_0x451b0c){try{jsonpatch['apply'](_0x451b0c,_0x39c751,!![]);}catch(_0x1c94cc){return BPromise['reject'](_0x1c94cc);}return _0x451b0c[_0x3860('0x30')]();};}function saveUpdates(_0x3a577a,_0x35185c){return function(_0x2fc231){if(_0x2fc231){return _0x2fc231[_0x3860('0x31')](_0x3a577a)[_0x3860('0x32')](function(_0x1d3fd0){return _0x1d3fd0;});}return null;};}function removeEntity(_0x4d30bc,_0x1a48b6){return function(_0x396ccf){if(_0x396ccf){return _0x396ccf['destroy']()[_0x3860('0x32')](function(){_0x4d30bc[_0x3860('0x28')](0xcc)[_0x3860('0x29')]();});}};}function handleEntityNotFound(_0x5af661,_0x523cc1){return function(_0x285b1b){if(!_0x285b1b){_0x5af661[_0x3860('0x27')](0x194);}return _0x285b1b;};}function handleError(_0x3abf18,_0xa921ed){_0xa921ed=_0xa921ed||0x1f4;return function(_0x59271f){logger['error'](_0x59271f[_0x3860('0x33')]);if(_0x59271f[_0x3860('0x34')]){delete _0x59271f[_0x3860('0x34')];}_0x3abf18[_0x3860('0x28')](_0xa921ed)[_0x3860('0x35')](_0x59271f);};}function getMustacheRender(_0x4df2a9,_0x424424){return Mustache[_0x3860('0x36')](_0x4df2a9,_['merge'](_0x424424['body'],{'contact':_0x424424[_0x3860('0x37')],'message':_0x424424[_0x3860('0x26')],'agent':_0x424424[_0x3860('0x38')],'interaction':_0x424424[_0x3860('0x39')],'account':_0x424424[_0x3860('0x3a')]}))||'';}function getInteractionUsers(_0x592311,_0x28f04d){return new BPromise(function(_0x510aef,_0x112600){try{if(_0x28f04d[_0x592311['id']]){_0x592311[_0x3860('0x3b')]=_['map'](_0x28f04d[_0x592311['id']],function(_0x36d9bd){return{'id':_0x36d9bd['id'],'fullname':_0x36d9bd[_0x3860('0x3c')]};});}}catch(_0x4f3303){_0x112600(_0x4f3303);}_0x510aef(_0x592311);});}function getInteractionTags(_0x1ef9aa,_0xc7d34d){return new BPromise(function(_0x15bd2c,_0xf346e){try{if(_0x1ef9aa['TagIds']){_0x1ef9aa[_0x3860('0x3d')]=[];_0x1ef9aa[_0x3860('0x3e')][_0x3860('0x3f')](',')['forEach'](function(_0x3a87e5){_0x1ef9aa['Tags'][_0x3860('0x40')](_0xc7d34d[_0x3a87e5]);});}delete _0x1ef9aa[_0x3860('0x3e')];}catch(_0x405bfc){_0xf346e(_0x405bfc);}_0x15bd2c(_0x1ef9aa);});}function updateChatInteraction(_0x3f613f,_0x2220c8,_0x3f4216){return new BPromise(function(_0x4e0a44,_0xbbbf01){return getInteractionUsers(_0x3f613f,_0x3f4216)[_0x3860('0x32')](function(_0x5dc78f){return getInteractionTags(_0x5dc78f,_0x2220c8);})['then'](function(_0x2938d4){_0x4e0a44(_0x2938d4);})[_0x3860('0x41')](function(_0x4f2f53){_0xbbbf01(_0x4f2f53);});});}exports[_0x3860('0x42')]=function(_0x30d8eb,_0x4c6c23){var _0xa6791a={},_0x56a650={},_0x392dc3={'count':0x0,'rows':[]};var _0x37e5c3=_[_0x3860('0x43')](db[_0x3860('0x44')][_0x3860('0x45')],function(_0x15ebbd){return{'name':_0x15ebbd[_0x3860('0x46')],'type':_0x15ebbd[_0x3860('0x47')][_0x3860('0x48')]};});_0x56a650[_0x3860('0x49')]=_[_0x3860('0x43')](_0x37e5c3,'name');_0x56a650[_0x3860('0x4a')]=_['keys'](_0x30d8eb[_0x3860('0x4a')]);_0x56a650[_0x3860('0x4b')]=_[_0x3860('0x4c')](_0x56a650[_0x3860('0x49')],_0x56a650[_0x3860('0x4a')]);_0xa6791a[_0x3860('0x4d')]=_[_0x3860('0x4c')](_0x56a650[_0x3860('0x49')],qs['fields'](_0x30d8eb[_0x3860('0x4a')][_0x3860('0x4e')]));_0xa6791a[_0x3860('0x4d')]=_0xa6791a['attributes'][_0x3860('0x4f')]?_0xa6791a[_0x3860('0x4d')]:_0x56a650[_0x3860('0x49')];if(!_0x30d8eb[_0x3860('0x4a')]['hasOwnProperty']('nolimit')){_0xa6791a[_0x3860('0x2c')]=qs['limit'](_0x30d8eb[_0x3860('0x4a')][_0x3860('0x2c')]);_0xa6791a[_0x3860('0x2a')]=qs['offset'](_0x30d8eb[_0x3860('0x4a')]['offset']);}_0xa6791a[_0x3860('0x50')]=qs['sort'](_0x30d8eb[_0x3860('0x4a')][_0x3860('0x51')]);_0xa6791a[_0x3860('0x52')]=qs['filters'](_['pick'](_0x30d8eb[_0x3860('0x4a')],_0x56a650[_0x3860('0x4b')]),_0x37e5c3);var _0x478dd9=[];var _0x3910f5=squel['select']()[_0x3860('0x53')]('id')[_0x3860('0x53')](_0x3860('0x34'))[_0x3860('0x53')](_0x3860('0x54'))[_0x3860('0x55')](_0x3860('0x56'));var _0x5a9987=squel[_0x3860('0x57')]()[_0x3860('0x53')](_0x3860('0x58'))[_0x3860('0x53')](_0x3860('0x59'))[_0x3860('0x53')]('ui.ChatInteractionId')[_0x3860('0x55')](_0x3860('0x5a'),'ui')[_0x3860('0x5b')](_0x3860('0x5c'),'u',_0x3860('0x5d'));var _0x1e2b5d=squel[_0x3860('0x57')]()[_0x3860('0x55')]('chat_interactions','i')[_0x3860('0x5b')](_0x3860('0x5e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3860('0x5b')](_0x3860('0x5c'),'o',_0x3860('0x5f'))['left_join'](_0x3860('0x60'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x3860('0x5b')](_0x3860('0x61'),'me',_0x3860('0x62'))[_0x3860('0x5b')](_0x3860('0x63'),'it',_0x3860('0x64'))[_0x3860('0x5b')](_0x3860('0x56'),'t',_0x3860('0x65'));var _0x151492=squel[_0x3860('0x66')]();var _0x2bac24=[];var _0x58147d=squel['expr']();var _0x5111e0;if(_0x30d8eb[_0x3860('0x4a')]['search']){_0x5111e0=as['parseSearch'](_0x30d8eb[_0x3860('0x4a')][_0x3860('0x67')]);var _0x2ff440=_0x5111e0[_0x3860('0x68')];for(var _0x3d6c17=0x0;_0x3d6c17<_0x5111e0[_0x3860('0x69')]['length'];_0x3d6c17++){var _0x49ec68=_0x5111e0['conditions'][_0x3d6c17];var _0x1d6c70='i';var _0x1c1da4=_[_0x3860('0x6a')](_0x37e5c3,['name',_0x49ec68[_0x3860('0x53')]]);if(!_0x1c1da4){switch(_0x49ec68['field']){case _0x3860('0x6b'):if(_0x49ec68[_0x3860('0x6c')]==0x1){_0x1e2b5d['having']('`'+_0x49ec68[_0x3860('0x53')]+_0x3860('0x6d'));}else{_0x1e2b5d[_0x3860('0x6e')]('`'+_0x49ec68[_0x3860('0x53')]+'`\x20>\x200');}break;case _0x3860('0x6f'):if(_0x49ec68[_0x3860('0x70')]===_0x3860('0x71')){if(_0x49ec68['value']['split']('\x20')[_0x3860('0x4f')]>0x1){_0x151492[_0x2ff440](_0x3860('0x72'),qs[_0x3860('0x73')](_0x49ec68[_0x3860('0x6c')]),null);}else{var _0x28a8b4='%'+_0x49ec68[_0x3860('0x6c')]+'%';_0x151492[_0x2ff440]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x28a8b4,_0x28a8b4,_0x28a8b4);}}else{_0x1c1da4=_[_0x3860('0x6a')](_0x37e5c3,[_0x3860('0x34'),'ContactId']);_0x49ec68[_0x3860('0x53')]=_0x3860('0x74');_0x3427a5=as[_0x3860('0x75')](_0x1d6c70,_0x1c1da4[_0x3860('0x47')],_0x49ec68);_0x151492[_0x2ff440](_0x3427a5[_0x3860('0x76')],_0x3427a5[_0x3860('0x6c')]['start'],_0x3427a5[_0x3860('0x6c')][_0x3860('0x29')]);}break;case _0x3860('0x77'):var _0x27e5ab=_0x49ec68[_0x3860('0x6c')][_0x3860('0x3f')](',')['map'](function(_0x1ae31b){return Number(_0x1ae31b);});_0x27e5ab[_0x3860('0x78')](function(_0x1c33dc){_0x58147d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1c33dc+',%');});_0x2bac24=_['union'](_0x2bac24,_0x27e5ab);break;case _0x3860('0x79'):if(_0x49ec68[_0x3860('0x70')]===_0x3860('0x71')){_0x151492[_0x2ff440](_0x3860('0x7a'),'%'+_0x49ec68[_0x3860('0x6c')]+'%',null);}else{_0x1c1da4=_['find'](_0x37e5c3,['name',_0x3860('0x7b')]);_0x49ec68[_0x3860('0x53')]='UserId';_0x3427a5=as['buildExpression'](_0x1d6c70,_0x1c1da4[_0x3860('0x47')],_0x49ec68);_0x151492[_0x2ff440](_0x3427a5[_0x3860('0x76')],_0x3427a5['value'][_0x3860('0x7c')],_0x3427a5[_0x3860('0x6c')][_0x3860('0x29')]);}break;case _0x3860('0x7d'):_0x3427a5=as['buildExpression']('me',null,_0x49ec68);_0x151492[_0x2ff440](_0x3427a5[_0x3860('0x76')],_0x3427a5[_0x3860('0x6c')]['start'],_0x3427a5['value'][_0x3860('0x29')]);break;}}else{var _0x3427a5=as['buildExpression'](_0x1d6c70,_0x1c1da4[_0x3860('0x47')],_0x49ec68);_0x151492[_0x2ff440](_0x3427a5['text'],_0x3427a5[_0x3860('0x6c')]['start'],_0x3427a5['value'][_0x3860('0x29')]);}}}else{var _0x49c356=_(_0x30d8eb[_0x3860('0x4a')])[_0x3860('0x7e')]()[_0x3860('0x43')](function(_0x2fd2f4){return _[_0x3860('0x7f')](_0x37e5c3,[_0x3860('0x34'),_0x2fd2f4])?_0x2fd2f4:undefined;})['compact']()[_0x3860('0x6c')]();if(!_[_0x3860('0x80')](_0x49c356)){_0x49c356[_0x3860('0x78')](function(_0x5d7cc4){if(_0x5d7cc4===_0x3860('0x81')){_0x1e2b5d['where'](_0x3860('0x82'),[][_0x3860('0x83')](_0x30d8eb['query'][_0x5d7cc4]));}else if(_0x5d7cc4===_0x3860('0x84')){var _0x2cd731=JSON[_0x3860('0x85')](_0x30d8eb['query'][_0x5d7cc4])['$gte'];var _0x5a282a=JSON['parse'](_0x30d8eb[_0x3860('0x4a')][_0x5d7cc4])[_0x3860('0x86')];_0x1e2b5d[_0x3860('0x52')](_0x3860('0x87'),_0x2cd731,_0x5a282a);}else{if(_0x30d8eb['query'][_0x5d7cc4]==='null'){_0x1e2b5d[_0x3860('0x52')]('i.'+_0x5d7cc4+_0x3860('0x88'));}else{_0x1e2b5d[_0x3860('0x52')]('i.'+_0x5d7cc4+_0x3860('0x89'),_0x30d8eb['query'][_0x5d7cc4]);}}});}if(_0x30d8eb[_0x3860('0x4a')][_0x3860('0x8a')]){if(_0x30d8eb['query']['read']==0x1){_0x1e2b5d[_0x3860('0x6e')](_0x3860('0x8b'));}else{_0x1e2b5d[_0x3860('0x6e')](_0x3860('0x8c'));}}if(_0x30d8eb['query']['tag']){_0x2bac24=_[_0x3860('0x8d')](_0x30d8eb['query'][_0x3860('0x8e')])?_0x30d8eb[_0x3860('0x4a')]['tag']:new Array(_0x30d8eb['query']['tag']);_0x2bac24[_0x3860('0x78')](function(_0x36116e){_0x58147d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x36116e+',%');});}if(_0x30d8eb[_0x3860('0x4a')][_0x3860('0x8f')]){var _0x2351fe=_0x30d8eb[_0x3860('0x4a')][_0x3860('0x8f')]['replace']('\x5c','\x5c\x5c')[_0x3860('0x90')](/'/g,'\x27\x27');if(qs[_0x3860('0x91')](_0x2351fe)){_0x151492['or'](_0x3860('0x92'),_0x2351fe+'%');}else{_0x151492['or'](_0x3860('0x93'),qs[_0x3860('0x73')](_0x2351fe))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2351fe+'%');}}}_0x1e2b5d[_0x3860('0x52')](_0x151492);_0x1e2b5d[_0x3860('0x94')](_0x3860('0x95'));var _0x41ee6f={'type':db[_0x3860('0x96')]['QueryTypes']['SELECT'],'raw':!![]};var _0x196c50=_0x1e2b5d[_0x3860('0x97')]();_0x196c50[_0x3860('0x53')](_0x3860('0x95'));_0x196c50[_0x3860('0x53')](_0x3860('0x98'),_0x3860('0x6b'));if(_0xa6791a['order']){_0xa6791a[_0x3860('0x50')][_0x3860('0x78')](function(_0x58eddd){var _0x1ff95b=_0x58eddd[0x0]===_0x3860('0x99')?_0x58eddd[0x0]:'i.'+_0x58eddd[0x0];_0x1e2b5d[_0x3860('0x50')](_0x1ff95b,_0x58eddd[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3860('0x80')](_0x2bac24)){_0x1e2b5d[_0x3860('0x6e')](_0x58147d);_0x196c50['where'](_0x3860('0x9a'),_0x2bac24);}BPromise['resolve']()[_0x3860('0x32')](function(){if(!_0x5111e0){if(_0x30d8eb[_0x3860('0x4a')]['ChatWebsiteId'])return;_0x196c50[_0x3860('0x52')](_0x3860('0x9b'));_0x1e2b5d[_0x3860('0x52')](_0x3860('0x9b'));return;}if(_0x30d8eb[_0x3860('0x9c')]['role']!==_0x3860('0x38'))return;return _0x30d8eb[_0x3860('0x9c')][_0x3860('0x9d')]({'attributes':['id'],'raw':!![]})[_0x3860('0x32')](function(_0x3c9837){if(_['isEmpty'](_0x3c9837)){_0x196c50['where'](_0x3860('0x9e'));_0x1e2b5d[_0x3860('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x196c50[_0x3860('0x52')](_0x3860('0x82'),_[_0x3860('0x43')](_0x3c9837,'id'));_0x1e2b5d[_0x3860('0x52')]('i.ChatWebsiteId\x20IN\x20?',_[_0x3860('0x43')](_0x3c9837,'id'));}});})['then'](function(){if(_0x30d8eb[_0x3860('0x9c')][_0x3860('0x9f')]===_0x3860('0x38')&&!_0x5111e0&&!_0x30d8eb[_0x3860('0x4a')][_0x3860('0x81')])return[];return db[_0x3860('0xa0')][_0x3860('0x4a')](_0x196c50['toString'](),_0x41ee6f);})[_0x3860('0x32')](function(_0x47396d){_0x392dc3['count']=_0x47396d['length'];if(_0x392dc3['count']===0x0)return[];return db['sequelize'][_0x3860('0x4a')](_0x3910f5[_0x3860('0xa1')](),_0x41ee6f)[_0x3860('0x32')](function(_0x1482cd){_0x478dd9=_[_0x3860('0xa2')](_0x1482cd,'id');_0x41ee6f=_[_0x3860('0xa3')](_0x41ee6f,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30d8eb[_0x3860('0x4a')]['fields']){_0xa6791a[_0x3860('0x4d')][_0x3860('0x78')](function(_0x897ea0){_0x1e2b5d[_0x3860('0x53')]('i.'+_0x897ea0);});}else{_0x1e2b5d[_0x3860('0x53')](_0x3860('0x98'),_0x3860('0x6b'));_0x1e2b5d[_0x3860('0x53')](_0x3860('0xa4'),_0x3860('0xa5'));_0x1e2b5d[_0x3860('0x53')]('a.mandatoryDisposition',_0x3860('0xa6'));_0x1e2b5d[_0x3860('0x53')](_0x3860('0xa7'),'contactName');_0x1e2b5d[_0x3860('0x53')](_0x3860('0xa8'));_0x1e2b5d[_0x3860('0x53')](_0x3860('0xa9'),'Contact.firstName');_0x1e2b5d[_0x3860('0x53')](_0x3860('0xaa'),_0x3860('0xab'));_0x1e2b5d['field'](_0x3860('0xac'),_0x3860('0xad'));_0x1e2b5d[_0x3860('0x53')]('c.phone',_0x3860('0xae'));_0x1e2b5d[_0x3860('0x53')](_0x3860('0xaf'),'Contact.mobile');_0x1e2b5d[_0x3860('0x53')](_0x3860('0xb0'),_0x3860('0xb1'));_0x1e2b5d['field'](_0x3860('0xb2'),_0x3860('0xb3'));_0x1e2b5d[_0x3860('0x53')]('o.internal',_0x3860('0xb4'));_0x1e2b5d['field'](_0x3860('0xb5'),'TagIds');}if(_0xa6791a[_0x3860('0x2c')])_0x1e2b5d[_0x3860('0x2c')](_0xa6791a[_0x3860('0x2c')]);if(_0xa6791a[_0x3860('0x2a')])_0x1e2b5d[_0x3860('0x2a')](_0xa6791a[_0x3860('0x2a')]);return db[_0x3860('0xa0')][_0x3860('0x4a')](_0x1e2b5d[_0x3860('0xa1')](),_0x41ee6f);})[_0x3860('0x32')](function(_0x10b4e8){if(_0x10b4e8[_0x3860('0x4f')]>0x0)_0x5a9987[_0x3860('0x52')](_0x3860('0xb6'),_[_0x3860('0x43')](_0x10b4e8,'id'));return db[_0x3860('0xa0')][_0x3860('0x4a')](_0x5a9987[_0x3860('0xa1')](),_0x41ee6f)['then'](function(_0x37575b){var _0x1d6d2b=_[_0x3860('0xb7')](_0x37575b,_0x3860('0xb8'));var _0x3e6bf8=[];_0x10b4e8[_0x3860('0x78')](function(_0xffe2a1){_0x3e6bf8[_0x3860('0x40')](updateChatInteraction(_0xffe2a1,_0x478dd9,_0x1d6d2b));});return BPromise[_0x3860('0xb9')](_0x3e6bf8);});});})[_0x3860('0x32')](function(_0x3b932d){_0x392dc3['rows']=_0x3b932d;return _0x392dc3;})[_0x3860('0x32')](respondWithFilteredResult(_0x4c6c23,_0xa6791a))[_0x3860('0x41')](handleError(_0x4c6c23,null));};exports[_0x3860('0xba')]=function(_0x6334ca,_0x4a929e){var _0x1a1994={'raw':![],'where':{'id':_0x6334ca[_0x3860('0xbb')]['id']}},_0x2ece36={};_0x2ece36[_0x3860('0x49')]=_['keys'](db[_0x3860('0x44')]['rawAttributes']);_0x2ece36['query']=_[_0x3860('0x7e')](_0x6334ca[_0x3860('0x4a')]);_0x2ece36[_0x3860('0x4b')]=_[_0x3860('0x4c')](_0x2ece36[_0x3860('0x49')],_0x2ece36[_0x3860('0x4a')]);_0x1a1994[_0x3860('0x4d')]=_[_0x3860('0x4c')](_0x2ece36[_0x3860('0x49')],qs[_0x3860('0x4e')](_0x6334ca[_0x3860('0x4a')][_0x3860('0x4e')]));_0x1a1994[_0x3860('0x4d')]=_0x1a1994['attributes'][_0x3860('0x4f')]?_0x1a1994['attributes']:_0x2ece36[_0x3860('0x49')];if(_0x6334ca[_0x3860('0x4a')]['includeAll']){_0x1a1994[_0x3860('0xbc')]=[{'all':!![]}];}_0x1a1994=_[_0x3860('0xa3')]({},_0x1a1994,_0x6334ca[_0x3860('0xbd')]);return db[_0x3860('0x44')][_0x3860('0x6a')](_0x1a1994)[_0x3860('0x32')](handleEntityNotFound(_0x4a929e,null))[_0x3860('0x32')](respondWithResult(_0x4a929e,null))['catch'](handleError(_0x4a929e,null));};exports[_0x3860('0xbe')]=function(_0x6d1819,_0x9e1682){return db[_0x3860('0x44')][_0x3860('0xbe')](_0x6d1819['body'],{})[_0x3860('0x32')](respondWithResult(_0x9e1682,0xc9))['catch'](handleError(_0x9e1682,null));};exports['update']=function(_0x56af8c,_0x1059a4){if(_0x56af8c[_0x3860('0x7d')]['id']){delete _0x56af8c[_0x3860('0x7d')]['id'];}return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x56af8c[_0x3860('0xbb')]['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x1059a4,null))[_0x3860('0x32')](saveUpdates(_0x56af8c['body'],null))[_0x3860('0x32')](respondWithResult(_0x1059a4,null))[_0x3860('0x41')](handleError(_0x1059a4,null));};exports['destroy']=function(_0x490884,_0x4428eb){return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x490884['params']['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x4428eb,null))['then'](removeEntity(_0x4428eb,null))[_0x3860('0x41')](handleError(_0x4428eb,null));};exports['describe']=function(_0x41fd53,_0xf91fc2){return db['ChatInteraction'][_0x3860('0xbf')]()[_0x3860('0x32')](respondWithResult(_0xf91fc2,null))['catch'](handleError(_0xf91fc2,null));};exports[_0x3860('0xc0')]=function(_0x398bc1,_0x3312c4){var _0x501519=_0x398bc1[_0x3860('0xbb')]['id'];var _0x47fba5;var _0x3e3dac;var _0x18b845;return db['ChatInteraction'][_0x3860('0xc1')]({'where':{'id':_0x501519}})[_0x3860('0x32')](function(_0x2b1dc1){_0x47fba5=_0x2b1dc1;return db[_0x3860('0xc2')][_0x3860('0xc1')]({'where':{'id':_0x2b1dc1['ChatWebsiteId']},'attributes':['id',_0x3860('0xc3'),_0x3860('0xc4'),'vidaooTopic','vidaooNote',_0x3860('0xc5')],'raw':!![]});})['then'](function(_0xe27f6b){if(_0xe27f6b&&_0xe27f6b[_0x3860('0xc3')]&&_0xe27f6b['vidaooEscalation']){_0x3e3dac=_0xe27f6b;var _0x1041bf={'interaction':{'id':_0x501519},'agent':{'id':_0x398bc1['user']['id'],'name':_0x398bc1[_0x3860('0x9c')]['name'],'fullname':_0x398bc1[_0x3860('0x9c')][_0x3860('0x3c')],'email':_0x398bc1[_0x3860('0x9c')][_0x3860('0xc6')]},'contact':_0x398bc1['body'][_0x3860('0x37')],'account':_0x398bc1[_0x3860('0x7d')][_0x3860('0x3a')]};var _0x1e1baf={'rejectUnauthorized':![],'method':'POST','url':_0x3860('0xc7'),'headers':{'X-APIKEY':_0xe27f6b[_0x3860('0xc3')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x398bc1['user'][_0x3860('0xc6')]],'buttons':null,'topic':_0x3e3dac[_0x3860('0xc8')],'note':_[_0x3860('0xc9')](_0x3e3dac[_0x3860('0xca')])?null:getMustacheRender(_0x3e3dac['vidaooNote'],_0x1041bf),'metadata':null},'redirect':_0x3860('0xcb'),'json':!![]};try{if(!_[_0x3860('0xc9')](_0x3e3dac[_0x3860('0xc5')])){var _0x1ce6e6=getMustacheRender(_0x3e3dac['vidaooMetadata'],_0x1041bf);var _0x1df44=JSON['parse'](_0x1ce6e6);_0x1e1baf['body']['metadata']=_0x1df44;}}catch(_0x15b53f){throw new db[(_0x3860('0x96'))][(_0x3860('0xcc'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x1e1baf);}else{throw new db[(_0x3860('0x96'))]['ValidationError'](_0x3860('0xcd'));}})[_0x3860('0x32')](function(_0x21c052){_0x18b845=_0x21c052;if(_0x18b845['id']){var _0x3a920b={'body':_0x18b845['join_url'],'ChatWebsiteId':_0x3e3dac['id'],'ChatInteractionId':_0x47fba5['id'],'direction':_0x3860('0xce'),'UserId':_0x398bc1[_0x3860('0x9c')]['id']};return db[_0x3860('0xcf')]['create'](_0x3a920b,{});}else{throw new db[(_0x3860('0x96'))][(_0x3860('0xcc'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x47fba5['updateAttributes']({'vidaooSessionId':_0x18b845['id']});})['then'](respondWithResult(_0x3312c4,null))[_0x3860('0x41')](handleError(_0x3312c4,null));};exports[_0x3860('0xd0')]=function(_0x2a09a2,_0x266347){if(_0x2a09a2[_0x3860('0x7d')]['id']){delete _0x2a09a2[_0x3860('0x7d')]['id'];}return db[_0x3860('0x44')]['find']({'where':{'id':_0x2a09a2['params']['id']},'include':[{'model':db['CmContact'],'as':_0x3860('0x6f')}]})[_0x3860('0x32')](handleEntityNotFound(_0x266347,null))[_0x3860('0x32')](saveUpdates(_0x2a09a2['body'],null))[_0x3860('0x32')](respondWithResult(_0x266347,null))['catch'](handleError(_0x266347,null));};exports['abandon']=function(_0x5f0700,_0x46f630,_0x505ba2){if(_0x5f0700['body']['id']){delete _0x5f0700[_0x3860('0x7d')]['id'];}return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x5f0700[_0x3860('0xbb')]['id']}})['then'](function(_0x53392b){if(!_0x53392b){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x3860('0xd1'),0x194,'entity\x20not\x20found');_0x46f630['sendStatus'](0x194);}else{if(_0x53392b[_0x3860('0x7b')]){throw new db[(_0x3860('0x96'))][(_0x3860('0xcc'))](_0x3860('0xd2'));}}return _0x53392b;})['then'](function(_0x6e541d){if(_0x6e541d){return _0x6e541d[_0x3860('0x31')]({'closed':_0x5f0700[_0x3860('0x7d')][_0x3860('0xd3')],'disposition':_0x5f0700['body']['disposition']})[_0x3860('0x32')](function(_0x55c19c){return _0x55c19c;});}})[_0x3860('0x32')](function(_0x4ab85d){return respondWithRpcPromise(_0x3860('0xd4'),_0x3860('0xd1'),_0x5f0700[_0x3860('0x7d')],client9004);})[_0x3860('0x32')](respondWithResult(_0x46f630,null))[_0x3860('0x41')](handleError(_0x46f630,null));};exports['attachmentUpload']=function(_0x5d3c4d,_0x5e3c54,_0x39e855){_0x5d3c4d[_0x3860('0x7d')][_0x3860('0x34')]=_0x5d3c4d[_0x3860('0xd5')][_0x3860('0xd6')];_0x5d3c4d['body'][_0x3860('0xd7')]=_0x5d3c4d[_0x3860('0xd5')]['filename'];_0x5d3c4d[_0x3860('0x7d')]['type']=_0x5d3c4d[_0x3860('0xd5')][_0x3860('0xd8')];return db['Attachment'][_0x3860('0xbe')](_0x5d3c4d[_0x3860('0x7d')])[_0x3860('0x32')](respondWithResult(_0x5e3c54,0xc9))[_0x3860('0x41')](handleError(_0x5e3c54,null));};exports[_0x3860('0xd9')]=function(_0x3e2dfc,_0x135e84,_0x199bbc){return db[_0x3860('0x44')][_0x3860('0xc1')]({'where':{'id':_0x3e2dfc[_0x3860('0xbb')]['id']},'raw':!![]})[_0x3860('0x32')](handleEntityNotFound(_0x135e84,null))['then'](function(_0x369a4b){if(_0x369a4b){if(_0x369a4b['closed']){return _0x135e84[_0x3860('0x28')](0x193)['json']({'status':0x193,'message':_0x3860('0xda')});}return db['Attachment'][_0x3860('0xc1')]({'where':{'id':_0x3e2dfc['query']['attachId']},'raw':!![]})[_0x3860('0x32')](handleEntityNotFound(_0x135e84,null));}})[_0x3860('0x32')](function(_0xa152b4){if(_0xa152b4){var _0x28931d=_0xa152b4[_0x3860('0xdb')]!==null;var _0x5e65a2=path[_0x3860('0xdc')](config[_0x3860('0xdd')],_0x3860('0xde'));if(_0x28931d){_0x5e65a2=path[_0x3860('0xdc')](_0x5e65a2,_0x3860('0xdf'));}var _0x268658=path['join'](_0x5e65a2,_0xa152b4[_0x3860('0xd7')]);return _0x135e84['download'](_0x268658);}})[_0x3860('0x41')](handleError(_0x135e84,null));};exports[_0x3860('0xe0')]=function(_0x118c4e,_0x471da9){var _0x244ceb=null;var _0x24f8a6=null;var _0x532349=null;var _0x17fa12=null;if(_0x118c4e[_0x3860('0x7d')]['id']){delete _0x118c4e[_0x3860('0x7d')]['id'];}if(_0x118c4e[_0x3860('0x7d')]['mailTranscript']){_0x17fa12=path[_0x3860('0xdc')](config[_0x3860('0xdd')],_0x3860('0xe1'),util[_0x3860('0xe2')](_0x3860('0xe3'),Date[_0x3860('0xe4')]()));_0x118c4e['body'][_0x3860('0xe5')]=_0x17fa12;}return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x118c4e[_0x3860('0xbb')]['id']},'include':[{'model':db[_0x3860('0xcf')],'as':_0x3860('0xe6'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x471da9,null))[_0x3860('0x32')](saveUpdates(_0x118c4e[_0x3860('0x7d')],null))['then'](function(_0x276828){if(_0x276828){_0x244ceb=_0x276828;return db[_0x3860('0xc2')][_0x3860('0x6a')]({'where':{'id':_0x244ceb[_0x3860('0x81')]}});}})[_0x3860('0x32')](function(_0x1740d0){if(_0x1740d0){_0x532349=_0x1740d0;return db[_0x3860('0xe7')][_0x3860('0x6a')]({'where':{'id':_0x244ceb[_0x3860('0x74')]}});}})[_0x3860('0x32')](function(_0x975c7f){if(_0x975c7f){_0x24f8a6=_0x975c7f;if(_0x17fa12){var _0x23207b=null;for(var _0x1a1366=0x1;_0x1a1366<_0x244ceb[_0x3860('0xe6')][_0x3860('0x4f')];++_0x1a1366){_0x23207b=_0x244ceb['Messages'][_0x1a1366];var _0x56566c=_0x23207b[_0x3860('0x7b')]?util[_0x3860('0xe2')](_0x3860('0xe8'),_0x532349[_0x3860('0xe9')],_0x23207b[_0x3860('0x7b')]):_0x3860('0xea');var _0x1290e7=_0x118c4e[_0x3860('0x7d')]['customer']||util[_0x3860('0xe2')](_0x3860('0xe8'),_0x3860('0xeb'),_0x23207b['ContactId']);switch(_0x532349[_0x3860('0xec')]){case _0x3860('0xed'):_0x56566c=_0x23207b[_0x3860('0x7b')]?util[_0x3860('0xe2')](_0x3860('0xe8'),_0x532349[_0x3860('0xe9')],_0x23207b[_0x3860('0x7b')]):_0x3860('0xea');break;case _0x3860('0xee'):_0x56566c=_0x23207b['UserId']?_0x23207b[_0x3860('0x79')][_0x3860('0xef')]||_0x23207b['User'][_0x3860('0x3c')]:_0x3860('0xea');break;case _0x3860('0xf0'):_0x56566c=_0x23207b['UserId']?_0x23207b[_0x3860('0x79')][_0x3860('0x3c')]:_0x3860('0xea');break;default:_0x56566c=_0x23207b[_0x3860('0x7b')]?util['format']('%s%d',_0x532349[_0x3860('0xe9')],_0x23207b['UserId']):_0x3860('0xea');}var _0x15314d=util[_0x3860('0xe2')](_0x3860('0xf1'),moment(_0x23207b[_0x3860('0x84')])[_0x3860('0xe2')](_0x3860('0xf2')),_0x23207b[_0x3860('0xf3')]==='in'?_0x1290e7:_0x56566c,_0x23207b['body']);if(!_0x23207b[_0x3860('0xf4')]){fs[_0x3860('0xf5')](_0x17fa12,_0x15314d);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x3860('0xf6')],'as':'Smtp','raw':!![]}]});}}})[_0x3860('0x32')](function(_0x2bf644){if(_0x2bf644&&_0x2bf644[_0x3860('0xf7')]&&_0x118c4e[_0x3860('0x7d')]){var _0xd95981={'tls':{'rejectUnauthorized':![]}};if(_0x2bf644[_0x3860('0xf7')][_0x3860('0xf8')]){_0xd95981[_0x3860('0xf8')]=_0x2bf644['Smtp']['service'];}else{_0xd95981[_0x3860('0xf9')]=_0x2bf644['Smtp'][_0x3860('0xf9')];_0xd95981[_0x3860('0xfa')]=_0x2bf644[_0x3860('0xf7')][_0x3860('0xfa')];_0xd95981[_0x3860('0xfb')]=_0x2bf644[_0x3860('0xf7')][_0x3860('0xfb')];}if(_0x2bf644['Smtp']['authentication']){_0xd95981[_0x3860('0xfc')]={'user':_0x2bf644[_0x3860('0xf7')][_0x3860('0x9c')],'pass':_0x2bf644['Smtp'][_0x3860('0xfd')]};}return respondWithRpcPromise(_0x3860('0xfe'),_0x3860('0xff'),{'account':_0xd95981,'message':{'from':util['format'](_0x3860('0x100'),_0x2bf644[_0x3860('0x34')],_0x2bf644['email']||_0x2bf644['Smtp']['user']),'to':_0x118c4e['body']['mailTranscript'],'subject':_0x3860('0x101'),'text':util[_0x3860('0xe2')](_0x3860('0x102'),_0x118c4e[_0x3860('0x7d')][_0x3860('0x103')]),'attachments':[{'path':_0x17fa12}]}})['then'](function(){return _0x244ceb;})[_0x3860('0x41')](function(_0x5235e){console['error'](_0x5235e);});}else{return _0x244ceb;}})[_0x3860('0x32')](respondWithStatusCode(_0x471da9,0xc8))[_0x3860('0x41')](handleError(_0x471da9,null));};exports[_0x3860('0x104')]=function(_0x38cdf1,_0x4ab7b2,_0x4c8a10){return db['ChatMessage'][_0x3860('0x6a')]({'where':{'id':_0x38cdf1['params']['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x4ab7b2,null))[_0x3860('0x32')](function(_0x2adf67){if(_0x2adf67){return _0x2adf67[_0x3860('0x104')](_0x38cdf1[_0x3860('0x7d')][_0x3860('0x105')],_[_0x3860('0x106')](_0x38cdf1[_0x3860('0x7d')],[_0x3860('0x105'),'id'])||{});}})[_0x3860('0x32')](respondWithResult(_0x4ab7b2,null))[_0x3860('0x41')](handleError(_0x4ab7b2,null));};exports[_0x3860('0x107')]=function(_0x173790,_0x20d0d2,_0x8d3ad7){var _0xf1e9ab={'raw':![],'where':{}};var _0xcf350b={};var _0x1348e0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3860('0xc1')]({'where':{'id':_0x173790['params']['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x20d0d2,null))[_0x3860('0x32')](function(_0x11d0ab){if(_0x11d0ab){_0xcf350b[_0x3860('0x49')]=_[_0x3860('0x7e')](db[_0x3860('0xcf')][_0x3860('0x45')]);_0xcf350b[_0x3860('0x4a')]=_[_0x3860('0x7e')](_0x173790['query']);_0xcf350b[_0x3860('0x4b')]=_[_0x3860('0x4c')](_0xcf350b[_0x3860('0x49')],_0xcf350b[_0x3860('0x4a')]);_0xf1e9ab[_0x3860('0x4d')]=_[_0x3860('0x4c')](_0xcf350b[_0x3860('0x49')],qs['fields'](_0x173790[_0x3860('0x4a')][_0x3860('0x4e')]));_0xf1e9ab[_0x3860('0x4d')]=_0xf1e9ab['attributes'][_0x3860('0x4f')]?_0xf1e9ab[_0x3860('0x4d')]:_0xcf350b[_0x3860('0x49')];if(!_0x173790['query']['hasOwnProperty'](_0x3860('0x108'))){_0xf1e9ab[_0x3860('0x2c')]=qs['limit'](_0x173790[_0x3860('0x4a')]['limit']);_0xf1e9ab[_0x3860('0x2a')]=qs[_0x3860('0x2a')](_0x173790['query'][_0x3860('0x2a')]);}_0xf1e9ab['order']=qs[_0x3860('0x51')](_0x173790[_0x3860('0x4a')][_0x3860('0x51')]);_0xf1e9ab[_0x3860('0x52')]=qs[_0x3860('0x4b')](_[_0x3860('0x109')](_0x173790[_0x3860('0x4a')],_0xcf350b['filters']));_0xf1e9ab[_0x3860('0x52')]['ChatInteractionId']=_0x11d0ab['id'];if(_0x173790[_0x3860('0x4a')][_0x3860('0x8f')]){_0xf1e9ab['where']=_['merge'](_0xf1e9ab[_0x3860('0x52')],{'$or':_[_0x3860('0x43')](_0xf1e9ab[_0x3860('0x4d')],function(_0x234f93){var _0x5ed001={};_0x5ed001[_0x234f93]={'$like':'%'+_0x173790[_0x3860('0x4a')][_0x3860('0x8f')]+'%'};return _0x5ed001;})});}if(_0x173790[_0x3860('0x4a')]['$gte']){var _0x1ac962=_0x173790[_0x3860('0x4a')]['$gte'][_0x3860('0x3f')](',');var _0x35dbfe={};_0x35dbfe[_0x1ac962[0x0]]={'$gte':moment(_0x1ac962[0x1])[_0x3860('0xe2')](_0x3860('0x10a'))};_0xf1e9ab[_0x3860('0x52')]=_[_0x3860('0xa3')](_0xf1e9ab[_0x3860('0x52')],_0x35dbfe);}_0xf1e9ab=_['merge']({},_0xf1e9ab,_0x173790[_0x3860('0xbd')]);return db[_0x3860('0xcf')][_0x3860('0x2d')]({'where':_0xf1e9ab[_0x3860('0x52')]})[_0x3860('0x32')](function(_0x54ebd7){_0x1348e0[_0x3860('0x2d')]=_0x54ebd7;if(_0x173790[_0x3860('0x4a')][_0x3860('0x10b')]){_0xf1e9ab[_0x3860('0xbc')]=[{'all':!![]}];}return db[_0x3860('0xcf')][_0x3860('0x10c')](_0xf1e9ab);})['then'](function(_0x16457e){_0x1348e0[_0x3860('0x10d')]=_0x16457e;return _0x1348e0;});}})[_0x3860('0x32')](respondWithFilteredResult(_0x20d0d2,_0xf1e9ab))[_0x3860('0x41')](handleError(_0x20d0d2,null));};exports[_0x3860('0x10e')]=function(_0x2b6605,_0x11409b,_0x187e3b){var _0x4fb4f3={'where':{}},_0x21b179={},_0x28b7a2={'count':0x0,'rows':[]};return db[_0x3860('0x44')][_0x3860('0xc1')]({'where':{'id':_0x2b6605[_0x3860('0xbb')]['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x11409b,null))[_0x3860('0x32')](function(_0x2ca2e7){if(_0x2ca2e7){_0x21b179[_0x3860('0x49')]=_['keys'](db[_0x3860('0xcf')][_0x3860('0x45')]);_0x21b179[_0x3860('0x4a')]=_[_0x3860('0x7e')](_0x2b6605[_0x3860('0x4a')]);_0x21b179[_0x3860('0x4b')]=_[_0x3860('0x4c')](_0x21b179[_0x3860('0x49')],_0x21b179[_0x3860('0x4a')]);_0x4fb4f3[_0x3860('0x4d')]=_[_0x3860('0x4c')](_0x21b179[_0x3860('0x49')],qs[_0x3860('0x4e')](_0x2b6605[_0x3860('0x4a')][_0x3860('0x4e')]));_0x4fb4f3['attributes']=_0x4fb4f3[_0x3860('0x4d')][_0x3860('0x4f')]?_0x4fb4f3[_0x3860('0x4d')]:_0x21b179[_0x3860('0x49')];if(!_0x2b6605[_0x3860('0x4a')][_0x3860('0x10f')](_0x3860('0x108'))){_0x4fb4f3[_0x3860('0x2c')]=qs[_0x3860('0x2c')](_0x2b6605[_0x3860('0x4a')][_0x3860('0x2c')]);_0x4fb4f3[_0x3860('0x2a')]=qs['offset'](_0x2b6605[_0x3860('0x4a')]['offset']);}_0x4fb4f3[_0x3860('0x50')]=qs['sort'](_0x2b6605[_0x3860('0x4a')]['sort']);_0x4fb4f3[_0x3860('0x52')]=qs[_0x3860('0x4b')](_['pick'](_0x2b6605[_0x3860('0x4a')],_0x21b179[_0x3860('0x4b')]));_0x4fb4f3[_0x3860('0x52')][_0x3860('0xb8')]=_0x2ca2e7['id'];if(_0x2b6605[_0x3860('0x4a')]['filter']){_0x4fb4f3['where']=_[_0x3860('0xa3')](_0x4fb4f3[_0x3860('0x52')],{'$or':_[_0x3860('0x43')](_0x4fb4f3[_0x3860('0x4d')],function(_0x31a537){var _0x438121={};_0x438121[_0x31a537]={'$like':'%'+_0x2b6605[_0x3860('0x4a')]['filter']+'%'};return _0x438121;})});}_0x4fb4f3[_0x3860('0x52')]['secret']=![];if(_0x2b6605[_0x3860('0x4a')]['id']){_0x4fb4f3[_0x3860('0x52')]['id']={'$gt':_0x2b6605[_0x3860('0x4a')]['id']};}_0x4fb4f3=_[_0x3860('0xa3')]({},_0x4fb4f3,_0x2b6605['options']);return db[_0x3860('0xcf')][_0x3860('0x2d')]({'where':_0x4fb4f3['where']})[_0x3860('0x32')](function(_0x4d4366){_0x28b7a2[_0x3860('0x2d')]=_0x4d4366;_0x4fb4f3[_0x3860('0xbc')]=[];if(_0x2b6605[_0x3860('0x4a')][_0x3860('0x110')]){_0x4fb4f3[_0x3860('0xbc')][_0x3860('0x40')]({'model':db[_0x3860('0x79')],'as':_0x3860('0x79'),'attributes':['id',_0x3860('0x3c'),'alias']});}if(_0x2b6605[_0x3860('0x4a')][_0x3860('0x10b')]){_0x4fb4f3[_0x3860('0xbc')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4fb4f3);})['then'](function(_0x39c52e){_0x28b7a2[_0x3860('0x10d')]=_0x39c52e;return _0x28b7a2;});}})[_0x3860('0x32')](respondWithFilteredResult(_0x11409b,_0x4fb4f3))[_0x3860('0x41')](handleError(_0x11409b,null));};exports[_0x3860('0x111')]=function(_0x185040,_0x14cef9,_0x5e1ed4){return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x185040[_0x3860('0xbb')]['id']}})[_0x3860('0x32')](handleEntityNotFound(_0x14cef9,null))['then'](function(_0xbc013a){if(_0xbc013a){return _0xbc013a[_0x3860('0x112')](_0x185040['body'][_0x3860('0x105')],_[_0x3860('0x106')](_0x185040[_0x3860('0x7d')],[_0x3860('0x105'),'id'])||{})[_0x3860('0x113')](function(){return db[_0x3860('0x77')][_0x3860('0x10c')]({'attributes':['id',_0x3860('0x34'),_0x3860('0x54')],'where':{'id':_0x185040[_0x3860('0x7d')][_0x3860('0x105')]}});})[_0x3860('0x32')](function(_0x57f603){socket['emit'](_0x3860('0x114'),{'id':Number(_0x185040['params']['id']),'tags':_0x57f603||[]});return{'id':Number(_0x185040['params']['id']),'tags':_0x57f603||[]};});}})[_0x3860('0x32')](respondWithResult(_0x14cef9,null))[_0x3860('0x41')](handleError(_0x14cef9,null));};exports[_0x3860('0x115')]=function(_0x2e2ff3,_0x27c591,_0x8b9a7a){return db['ChatInteraction'][_0x3860('0x6a')]({'where':{'id':_0x2e2ff3[_0x3860('0xbb')]['id']}})['then'](handleEntityNotFound(_0x27c591,null))[_0x3860('0x32')](function(_0x5ecd57){if(_0x5ecd57){return _0x5ecd57['removeTags'](_0x2e2ff3['query'][_0x3860('0x105')]);}})[_0x3860('0x32')](respondWithStatusCode(_0x27c591,null))[_0x3860('0x41')](handleError(_0x27c591,null));};exports[_0x3860('0x116')]=function(_0x39524a,_0xa0492b){var _0x4d44de=moment()[_0x3860('0x117')]()[_0x3860('0xa1')]();var _0x1dcd01=path['join'](config[_0x3860('0xdd')],_0x3860('0x118'),_0x3860('0x119'),'tmp');var _0x198422=path['join'](config[_0x3860('0xdd')],'server',_0x3860('0x119'),_0x3860('0x11a'));var _0x1a97c1=path[_0x3860('0xdc')](_0x1dcd01,_0x4d44de);var _0x4cc748=util[_0x3860('0xe2')]('transcript-%d-%s.zip',_0x39524a[_0x3860('0xbb')]['id'],_0x4d44de);var _0x18fd61=path['join'](_0x1dcd01,_0x4cc748);var _0x39eb63=[];_0x39eb63[_0x3860('0x40')]({'model':db['User'],'as':_0x3860('0x79'),'attributes':['id',_0x3860('0x3c')],'raw':!![]});_0x39eb63[_0x3860('0x40')]({'model':db[_0x3860('0xe7')],'as':_0x3860('0x6f'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x39524a[_0x3860('0x4a')]['attachments']){_0x39eb63[_0x3860('0x40')]({'model':db[_0x3860('0x11b')],'as':'Attachment','raw':!![]});}var _0x134dfd=[{'model':db[_0x3860('0xcf')],'as':_0x3860('0xe6'),'attributes':['id','body',_0x3860('0x84'),'direction','secret','read'],'include':_0x39eb63}];_0x134dfd['push']({'model':db['ChatWebsite'],'as':_0x3860('0x11c'),'attributes':['id',_0x3860('0x34')]});_0x134dfd['push']({'model':db[_0x3860('0x79')],'as':_0x3860('0x11d'),'attributes':['id',_0x3860('0x3c')]});return db[_0x3860('0x44')][_0x3860('0x6a')]({'where':{'id':_0x39524a[_0x3860('0xbb')]['id']},'include':_0x134dfd})[_0x3860('0x32')](handleEntityNotFound(_0xa0492b,null))['then'](function(_0x2fe51b){if(_0x2fe51b){var _0x51bf5a=_0x2fe51b['get']({'plain':!![]});fs[_0x3860('0x11e')](_0x1a97c1);var _0x33abf1={'channel':_0x3860('0x11f'),'account':_0x51bf5a[_0x3860('0x11c')][_0x3860('0x34')],'agent':_0x51bf5a['Owner']?_0x51bf5a[_0x3860('0x11d')]['fullname']:_0x3860('0x120'),'createdAt':moment(_0x51bf5a['createdAt'])[_0x3860('0xe2')](_0x3860('0x10a'))[_0x3860('0xa1')](),'closedAt':_0x51bf5a[_0x3860('0xd3')]?moment(_0x51bf5a[_0x3860('0x121')])[_0x3860('0xe2')](_0x3860('0x10a'))[_0x3860('0xa1')]():'','disposition':_0x51bf5a[_0x3860('0x122')],'chatInfo':{'browser':_0x51bf5a['browserName'],'os':_0x51bf5a[_0x3860('0x123')],'referer':_0x51bf5a[_0x3860('0x124')],'customerIp':_0x51bf5a[_0x3860('0x125')],'customerPort':_0x51bf5a[_0x3860('0x126')]?_0x51bf5a[_0x3860('0x126')]:'N.A.'},'messages':_(_0x51bf5a[_0x3860('0xe6')])[_0x3860('0x127')]()['filter']({'secret':![]})['map'](function(_0x5b23d2){if(_0x5b23d2[_0x3860('0x11b')]){var _0x409781=path[_0x3860('0xdc')](_0x198422,_0x5b23d2[_0x3860('0x11b')][_0x3860('0xd7')]);if(fs[_0x3860('0x128')](_0x409781)){fs[_0x3860('0x129')](_0x409781)[_0x3860('0x12a')](fs[_0x3860('0x12b')](path[_0x3860('0xdc')](_0x1a97c1,_0x5b23d2[_0x3860('0x11b')][_0x3860('0xd7')])));}}return{'date':moment(_0x5b23d2[_0x3860('0x84')])[_0x3860('0xe2')](_0x3860('0x10a'))[_0x3860('0xa1')](),'sender':_0x5b23d2[_0x3860('0xf3')]===_0x3860('0xce')?_0x5b23d2[_0x3860('0x79')]?_0x5b23d2['User'][_0x3860('0x3c')]:_0x3860('0xea'):_0x5b23d2[_0x3860('0x6f')]['firstName']+(_0x5b23d2[_0x3860('0x6f')][_0x3860('0x12c')]?'\x20'+_0x5b23d2['Contact'][_0x3860('0x12c')]:''),'body':_0x5b23d2['Attachment']?_0x5b23d2['Attachment'][_0x3860('0xd7')]:_0x5b23d2[_0x3860('0x7d')],'direction':_0x5b23d2[_0x3860('0xf3')]===_0x3860('0xce')?'A':'C','secret':_0x5b23d2[_0x3860('0xf4')],'read':_0x5b23d2[_0x3860('0x8a')],'attachment':_0x5b23d2['Attachment']};})[_0x3860('0x6c')]()};return ejs[_0x3860('0x12d')](path[_0x3860('0xdc')](config['root'],_0x3860('0x118'),_0x3860('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x33abf1})[_0x3860('0x32')](function(_0x5c5755){var _0x5dfb3b=path[_0x3860('0xdc')](_0x1a97c1,_0x3860('0x12f')+_0x51bf5a['id']+'-'+_0x4d44de+_0x3860('0x130'));var _0x1eba76={'path':_0x5dfb3b,'channel':'Chat','interactionId':_0x51bf5a['id']};return pdf[_0x3860('0x131')](_0x5c5755,_0x1eba76);})['then'](function(){return new BPromise(function(_0x34ad82,_0x44ac65){zipdir(_0x1a97c1,{'saveTo':_0x18fd61},function(_0x43cc98,_0xd9ff70){if(_0x43cc98)return _0x44ac65(_0x43cc98);return _0x34ad82(_0xd9ff70);});})['then'](function(){return new BPromise(function(_0x52e611,_0x4ccefa){rimraf(_0x1a97c1,function(_0x2c90b){if(_0x2c90b)_0x4ccefa(_0x2c90b);return _0x52e611();});});})[_0x3860('0x32')](function(){return _0xa0492b[_0x3860('0x116')](_0x18fd61,_0x4cc748,function(_0x3046f4){if(_0x3046f4){console[_0x3860('0x132')](_0x3860('0x133'),_0x3046f4);}else{fs[_0x3860('0x134')](_0x18fd61);}});});});}else{return _0xa0492b['sendStatus'](0xc8);}})[_0x3860('0x41')](handleError(_0xa0492b,null));}; \ No newline at end of file +var _0x7916=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','http','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','end','name','render','merge','body','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','union','User','operator','UserId','some','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','length','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','catch','show','params','includeAll','include','options','create','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','join','offline-chat/','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','Messages','ChatWebsite','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','addTags','spread','Tag','emit','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','out','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','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/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4665b8,_0x234a28){var _0x54ba4c=function(_0x38064a){while(--_0x38064a){_0x4665b8['push'](_0x4665b8['shift']());}};_0x54ba4c(++_0x234a28);}(_0x7916,0x128));var _0x6791=function(_0x189989,_0x392303){_0x189989=_0x189989-0x0;var _0x289565=_0x7916[_0x189989];return _0x289565;};'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 pdf=require('../../components/export/pdf');var hardwareService=require(_0x6791('0x11'));var logger=require(_0x6791('0x12'))(_0x6791('0x13'));var utils=require(_0x6791('0x14'));var config=require(_0x6791('0x15'));var licenseUtil=require(_0x6791('0x16'));var db=require(_0x6791('0x17'))['db'];config[_0x6791('0x18')]=_[_0x6791('0x19')](config[_0x6791('0x18')],{'host':_0x6791('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6791('0x1b'))['register'](socket);var jayson=require(_0x6791('0x1c'));var client=jayson['client'][_0x6791('0x1d')]({'port':0x232b});var client9004=jayson[_0x6791('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3e4792,_0x4b80ed,_0x3856ac,_0x150d1f){return new BPromise(function(_0x596a06,_0xbc35d){var _0x36d7a1=_0x150d1f||client;return _0x36d7a1['request'](_0x3e4792,_0x3856ac)[_0x6791('0x1f')](function(_0x4d8a79){logger[_0x6791('0x20')](_0x6791('0x21'),_0x4b80ed,_0x6791('0x22'));logger[_0x6791('0x23')](_0x6791('0x24'),_0x4b80ed,_0x6791('0x22'),JSON[_0x6791('0x25')](_0x4d8a79));if(_0x4d8a79['error']){if(_0x4d8a79[_0x6791('0x26')][_0x6791('0x27')]===0x1f4){logger['error'](_0x6791('0x21'),_0x4b80ed,_0x4d8a79[_0x6791('0x26')]['message']);return _0xbc35d(_0x4d8a79[_0x6791('0x26')][_0x6791('0x28')]);}logger[_0x6791('0x26')](_0x6791('0x21'),_0x4b80ed,_0x4d8a79['error'][_0x6791('0x28')]);return _0x596a06(_0x4d8a79[_0x6791('0x26')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4b80ed,_0x6791('0x22'));_0x596a06(_0x4d8a79['result'][_0x6791('0x28')]);}})['catch'](function(_0x54a092){logger['error'](_0x6791('0x21'),_0x4b80ed,_0x54a092);_0xbc35d(_0x54a092);});});}function respondWithStatusCode(_0x23442e,_0xd49b84){_0xd49b84=_0xd49b84||0xcc;return function(_0x56a74e){if(_0x56a74e){return _0x23442e[_0x6791('0x29')](_0xd49b84);}return _0x23442e[_0x6791('0x2a')](_0xd49b84)['end']();};}function respondWithResult(_0x342107,_0x5cbb79){_0x5cbb79=_0x5cbb79||0xc8;return function(_0x424b0e){if(_0x424b0e){return _0x342107['status'](_0x5cbb79)['json'](_0x424b0e);}};}function respondWithFilteredResult(_0x270a1d,_0x551718){return function(_0x2f56a2){if(_0x2f56a2){var _0x34b006=typeof _0x551718['offset']===_0x6791('0x2b')&&typeof _0x551718[_0x6791('0x2c')]===_0x6791('0x2b');var _0xd36448=_0x2f56a2['count'];var _0x4f91d6=_0x34b006?0x0:_0x551718[_0x6791('0x2d')];var _0x5e5ac3=_0x34b006?_0x2f56a2[_0x6791('0x2e')]:_0x551718[_0x6791('0x2d')]+_0x551718[_0x6791('0x2c')];var _0x2b98b8;if(_0x5e5ac3>=_0xd36448){_0x5e5ac3=_0xd36448;_0x2b98b8=0xc8;}else{_0x2b98b8=0xce;}_0x270a1d[_0x6791('0x2a')](_0x2b98b8);return _0x270a1d[_0x6791('0x2f')](_0x6791('0x30'),_0x4f91d6+'-'+_0x5e5ac3+'/'+_0xd36448)[_0x6791('0x31')](_0x2f56a2);}return null;};}function patchUpdates(_0x152751){return function(_0x100210){try{jsonpatch['apply'](_0x100210,_0x152751,!![]);}catch(_0x28b3d4){return BPromise[_0x6791('0x32')](_0x28b3d4);}return _0x100210[_0x6791('0x33')]();};}function saveUpdates(_0xa1ed41,_0x19cd22){return function(_0x36f673){if(_0x36f673){return _0x36f673['update'](_0xa1ed41)['then'](function(_0x551357){return _0x551357;});}return null;};}function removeEntity(_0x1de770,_0x21a9cf){return function(_0x252916){if(_0x252916){return _0x252916['destroy']()['then'](function(){_0x1de770[_0x6791('0x2a')](0xcc)[_0x6791('0x34')]();});}};}function handleEntityNotFound(_0x31a525,_0x42deeb){return function(_0x50db2b){if(!_0x50db2b){_0x31a525[_0x6791('0x29')](0x194);}return _0x50db2b;};}function handleError(_0xee6b68,_0x2068a5){_0x2068a5=_0x2068a5||0x1f4;return function(_0x56d8c8){logger[_0x6791('0x26')](_0x56d8c8['stack']);if(_0x56d8c8['name']){delete _0x56d8c8[_0x6791('0x35')];}_0xee6b68[_0x6791('0x2a')](_0x2068a5)['send'](_0x56d8c8);};}function getMustacheRender(_0x764f15,_0x70b2b7){return Mustache[_0x6791('0x36')](_0x764f15,_[_0x6791('0x37')](_0x70b2b7[_0x6791('0x38')],{'contact':_0x70b2b7['contact'],'message':_0x70b2b7[_0x6791('0x28')],'agent':_0x70b2b7[_0x6791('0x39')],'interaction':_0x70b2b7[_0x6791('0x3a')],'account':_0x70b2b7['account']}))||'';}function getInteractionUsers(_0x3a6062,_0x24955c){return new BPromise(function(_0x2349b0,_0x577006){try{if(_0x24955c[_0x3a6062['id']]){_0x3a6062[_0x6791('0x3b')]=_[_0x6791('0x3c')](_0x24955c[_0x3a6062['id']],function(_0x13be81){return{'id':_0x13be81['id'],'fullname':_0x13be81[_0x6791('0x3d')]};});}}catch(_0x593fda){_0x577006(_0x593fda);}_0x2349b0(_0x3a6062);});}function getInteractionTags(_0x18c478,_0x1a4b64){return new BPromise(function(_0x3e95b6,_0xd0f1c){try{if(_0x18c478[_0x6791('0x3e')]){_0x18c478[_0x6791('0x3f')]=[];_0x18c478[_0x6791('0x3e')][_0x6791('0x40')](',')[_0x6791('0x41')](function(_0x4e4004){_0x18c478['Tags'][_0x6791('0x42')](_0x1a4b64[_0x4e4004]);});}delete _0x18c478[_0x6791('0x3e')];}catch(_0x5900b6){_0xd0f1c(_0x5900b6);}_0x3e95b6(_0x18c478);});}function updateChatInteraction(_0x39dcb7,_0x1c9913,_0x1c6803){return new BPromise(function(_0x3edb86,_0x1a922e){return getInteractionUsers(_0x39dcb7,_0x1c6803)[_0x6791('0x1f')](function(_0x44e0ba){return getInteractionTags(_0x44e0ba,_0x1c9913);})['then'](function(_0xb3bea8){_0x3edb86(_0xb3bea8);})['catch'](function(_0x17ecf0){_0x1a922e(_0x17ecf0);});});}exports[_0x6791('0x43')]=function(_0x16f26c,_0xbd6326){var _0x573e38={},_0xe55ee={},_0x4f0e2d={'count':0x0,'rows':[]};var _0xeb9d45=_[_0x6791('0x3c')](db[_0x6791('0x44')][_0x6791('0x45')],function(_0x91a161){return{'name':_0x91a161[_0x6791('0x46')],'type':_0x91a161['type'][_0x6791('0x47')]};});_0xe55ee[_0x6791('0x48')]=_[_0x6791('0x3c')](_0xeb9d45,_0x6791('0x35'));_0xe55ee['query']=_[_0x6791('0x49')](_0x16f26c[_0x6791('0x4a')]);_0xe55ee['filters']=_[_0x6791('0x4b')](_0xe55ee['model'],_0xe55ee[_0x6791('0x4a')]);_0x573e38[_0x6791('0x4c')]=_[_0x6791('0x4b')](_0xe55ee[_0x6791('0x48')],qs[_0x6791('0x4d')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x4d')]));_0x573e38[_0x6791('0x4c')]=_0x573e38[_0x6791('0x4c')]['length']?_0x573e38[_0x6791('0x4c')]:_0xe55ee['model'];if(!_0x16f26c[_0x6791('0x4a')][_0x6791('0x4e')](_0x6791('0x4f'))){_0x573e38[_0x6791('0x2c')]=qs[_0x6791('0x2c')](_0x16f26c['query'][_0x6791('0x2c')]);_0x573e38[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x2d')]);}_0x573e38['order']=qs[_0x6791('0x50')](_0x16f26c[_0x6791('0x4a')]['sort']);_0x573e38[_0x6791('0x51')]=qs['filters'](_[_0x6791('0x52')](_0x16f26c[_0x6791('0x4a')],_0xe55ee[_0x6791('0x53')]),_0xeb9d45);var _0x37e360=[];var _0x558069=squel[_0x6791('0x54')]()[_0x6791('0x55')]('id')['field'](_0x6791('0x35'))[_0x6791('0x55')](_0x6791('0x56'))['from'](_0x6791('0x57'));var _0x166b9a=squel['select']()[_0x6791('0x55')](_0x6791('0x58'))['field'](_0x6791('0x59'))[_0x6791('0x55')](_0x6791('0x5a'))[_0x6791('0x5b')]('user_has_chat_interactions','ui')[_0x6791('0x5c')](_0x6791('0x5d'),'u',_0x6791('0x5e'));var _0x5b534b=squel['select']()[_0x6791('0x5b')](_0x6791('0x5f'),'i')[_0x6791('0x5c')](_0x6791('0x60'),'c',_0x6791('0x61'))['left_join']('users','o',_0x6791('0x62'))['left_join']('chat_websites','a',_0x6791('0x63'))[_0x6791('0x5c')](_0x6791('0x64'),'me',_0x6791('0x65'))[_0x6791('0x5c')](_0x6791('0x66'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x6791('0x57'),'t',_0x6791('0x67'));var _0x56e424=squel[_0x6791('0x68')]();var _0x535ecf=[];var _0x473443=squel[_0x6791('0x68')]();var _0x50cf85;if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x69')]){_0x50cf85=as[_0x6791('0x6a')](_0x16f26c['query'][_0x6791('0x69')]);var _0x2c6316=_0x50cf85[_0x6791('0x6b')];for(var _0x383853=0x0;_0x383853<_0x50cf85[_0x6791('0x6c')]['length'];_0x383853++){var _0x54d0ba=_0x50cf85[_0x6791('0x6c')][_0x383853];var _0x13430e='i';var _0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,[_0x6791('0x35'),_0x54d0ba[_0x6791('0x55')]]);if(!_0x5d2668){switch(_0x54d0ba[_0x6791('0x55')]){case _0x6791('0x6e'):if(_0x54d0ba[_0x6791('0x6f')]==0x1){_0x5b534b[_0x6791('0x70')]('`'+_0x54d0ba[_0x6791('0x55')]+'`\x20=\x200');}else{_0x5b534b[_0x6791('0x70')]('`'+_0x54d0ba[_0x6791('0x55')]+_0x6791('0x71'));}break;case _0x6791('0x72'):if(_0x54d0ba['operator']===_0x6791('0x73')){if(_0x54d0ba[_0x6791('0x6f')][_0x6791('0x40')]('\x20')['length']>0x1){_0x56e424[_0x2c6316](_0x6791('0x74'),qs[_0x6791('0x75')](_0x54d0ba[_0x6791('0x6f')]),null);}else{var _0x11df6b='%'+_0x54d0ba['value']+'%';_0x56e424[_0x2c6316](_0x6791('0x76'),_0x11df6b,_0x11df6b,_0x11df6b);}}else{_0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,['name',_0x6791('0x77')]);_0x54d0ba[_0x6791('0x55')]=_0x6791('0x77');_0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668[_0x6791('0x79')],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7['value'][_0x6791('0x7b')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x34')]);}break;case'Tag':var _0x2d487e=_0x54d0ba['value'][_0x6791('0x40')](',')[_0x6791('0x3c')](function(_0xf0941a){return Number(_0xf0941a);});_0x2d487e[_0x6791('0x41')](function(_0x28d86b){_0x473443['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28d86b+',%');});_0x535ecf=_[_0x6791('0x7c')](_0x535ecf,_0x2d487e);break;case _0x6791('0x7d'):if(_0x54d0ba[_0x6791('0x7e')]===_0x6791('0x73')){_0x56e424[_0x2c6316]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x54d0ba[_0x6791('0x6f')]+'%',null);}else{_0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,['name',_0x6791('0x7f')]);_0x54d0ba[_0x6791('0x55')]='UserId';_0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668[_0x6791('0x79')],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')]['start'],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x34')]);}break;case'body':_0xbd55d7=as[_0x6791('0x78')]('me',null,_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x7b')],_0xbd55d7[_0x6791('0x6f')]['end']);break;}}else{var _0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668['type'],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x7b')],_0xbd55d7['value'][_0x6791('0x34')]);}}}else{var _0x165899=_(_0x16f26c[_0x6791('0x4a')])[_0x6791('0x49')]()[_0x6791('0x3c')](function(_0x1a1c3b){return _[_0x6791('0x80')](_0xeb9d45,[_0x6791('0x35'),_0x1a1c3b])?_0x1a1c3b:undefined;})['compact']()[_0x6791('0x6f')]();if(!_[_0x6791('0x81')](_0x165899)){_0x165899['forEach'](function(_0x48909c){if(_0x48909c===_0x6791('0x82')){_0x5b534b[_0x6791('0x51')]('i.ChatWebsiteId\x20IN\x20?',[][_0x6791('0x83')](_0x16f26c['query'][_0x48909c]));}else if(_0x48909c===_0x6791('0x84')){var _0x304e2a=JSON[_0x6791('0x85')](_0x16f26c[_0x6791('0x4a')][_0x48909c])[_0x6791('0x86')];var _0x2d15b5=JSON[_0x6791('0x85')](_0x16f26c[_0x6791('0x4a')][_0x48909c])[_0x6791('0x87')];_0x5b534b[_0x6791('0x51')](_0x6791('0x88'),_0x304e2a,_0x2d15b5);}else{if(_0x16f26c[_0x6791('0x4a')][_0x48909c]===_0x6791('0x89')){_0x5b534b[_0x6791('0x51')]('i.'+_0x48909c+_0x6791('0x8a'));}else{_0x5b534b[_0x6791('0x51')]('i.'+_0x48909c+_0x6791('0x8b'),_0x16f26c[_0x6791('0x4a')][_0x48909c]);}}});}if(_0x16f26c[_0x6791('0x4a')]['read']){if(_0x16f26c['query']['read']==0x1){_0x5b534b[_0x6791('0x70')](_0x6791('0x8c'));}else{_0x5b534b[_0x6791('0x70')](_0x6791('0x8d'));}}if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]){_0x535ecf=_[_0x6791('0x8f')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')])?_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]:new Array(_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]);_0x535ecf[_0x6791('0x41')](function(_0x2dafe6){_0x473443['or'](_0x6791('0x90'),'%,'+_0x2dafe6+',%');});}if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x91')]){var _0x159544=_0x16f26c[_0x6791('0x4a')][_0x6791('0x91')][_0x6791('0x92')]('\x5c','\x5c\x5c')[_0x6791('0x92')](/'/g,'\x27\x27');if(qs[_0x6791('0x93')](_0x159544)){_0x56e424['or'](_0x6791('0x94'),_0x159544+'%');}else{_0x56e424['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6791('0x75')](_0x159544))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x159544+'%');}}}_0x5b534b[_0x6791('0x51')](_0x56e424);_0x5b534b[_0x6791('0x95')]('i.id');var _0x1c2864={'type':db['Sequelize'][_0x6791('0x96')][_0x6791('0x97')],'raw':!![]};var _0x5945cb=_0x5b534b[_0x6791('0x98')]();_0x5945cb[_0x6791('0x55')](_0x6791('0x99'));_0x5945cb['field'](_0x6791('0x9a'),_0x6791('0x6e'));if(_0x573e38[_0x6791('0x9b')]){_0x573e38[_0x6791('0x9b')][_0x6791('0x41')](function(_0x35cd1b){var _0x52ab63=_0x35cd1b[0x0]===_0x6791('0x9c')?_0x35cd1b[0x0]:'i.'+_0x35cd1b[0x0];_0x5b534b[_0x6791('0x9b')](_0x52ab63,_0x35cd1b[0x1]===_0x6791('0x9d')?![]:!![]);});}if(!_[_0x6791('0x81')](_0x535ecf)){_0x5b534b[_0x6791('0x70')](_0x473443);_0x5945cb[_0x6791('0x51')](_0x6791('0x9e'),_0x535ecf);}BPromise['resolve']()[_0x6791('0x1f')](function(){if(!_0x50cf85){if(_0x16f26c['query'][_0x6791('0x82')])return;_0x5945cb['where'](_0x6791('0x9f'));_0x5b534b[_0x6791('0x51')](_0x6791('0x9f'));return;}if(_0x16f26c[_0x6791('0xa0')][_0x6791('0xa1')]!==_0x6791('0x39'))return;return _0x16f26c['user'][_0x6791('0xa2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f2f6d){if(_['isEmpty'](_0x2f2f6d)){_0x5945cb['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x5b534b[_0x6791('0x51')](_0x6791('0xa3'));}else{_0x5945cb['where'](_0x6791('0xa4'),_['map'](_0x2f2f6d,'id'));_0x5b534b[_0x6791('0x51')](_0x6791('0xa4'),_['map'](_0x2f2f6d,'id'));}});})['then'](function(){if(_0x16f26c['user'][_0x6791('0xa1')]===_0x6791('0x39')&&!_0x50cf85&&!_0x16f26c[_0x6791('0x4a')]['ChatWebsiteId'])return[];return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x5945cb[_0x6791('0xa6')](),_0x1c2864);})[_0x6791('0x1f')](function(_0xaf50fd){_0x4f0e2d['count']=_0xaf50fd[_0x6791('0xa7')];if(_0x4f0e2d[_0x6791('0x2e')]===0x0)return[];return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x558069[_0x6791('0xa6')](),_0x1c2864)['then'](function(_0x6ef225){_0x37e360=_[_0x6791('0xa8')](_0x6ef225,'id');_0x1c2864=_['merge'](_0x1c2864,{'model':db[_0x6791('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x4d')]){_0x573e38[_0x6791('0x4c')]['forEach'](function(_0x29e2a0){_0x5b534b[_0x6791('0x55')]('i.'+_0x29e2a0);});}else{_0x5b534b[_0x6791('0x55')](_0x6791('0x9a'),_0x6791('0x6e'));_0x5b534b[_0x6791('0x55')](_0x6791('0xa9'),_0x6791('0xaa'));_0x5b534b['field']('a.mandatoryDisposition',_0x6791('0xab'));_0x5b534b[_0x6791('0x55')](_0x6791('0xac'),'contactName');_0x5b534b[_0x6791('0x55')]('i.*');_0x5b534b[_0x6791('0x55')](_0x6791('0xad'),'Contact.firstName');_0x5b534b[_0x6791('0x55')](_0x6791('0xae'),_0x6791('0xaf'));_0x5b534b[_0x6791('0x55')](_0x6791('0xb0'),'Contact.email');_0x5b534b[_0x6791('0x55')](_0x6791('0xb1'),_0x6791('0xb2'));_0x5b534b['field']('c.mobile',_0x6791('0xb3'));_0x5b534b[_0x6791('0x55')]('c.fax',_0x6791('0xb4'));_0x5b534b[_0x6791('0x55')](_0x6791('0xb5'),'Owner.fullname');_0x5b534b[_0x6791('0x55')]('o.internal','Owner.internal');_0x5b534b[_0x6791('0x55')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6791('0x3e'));}if(_0x573e38[_0x6791('0x2c')])_0x5b534b[_0x6791('0x2c')](_0x573e38[_0x6791('0x2c')]);if(_0x573e38[_0x6791('0x2d')])_0x5b534b[_0x6791('0x2d')](_0x573e38['offset']);return db[_0x6791('0xa5')]['query'](_0x5b534b[_0x6791('0xa6')](),_0x1c2864);})['then'](function(_0x599f9f){if(_0x599f9f[_0x6791('0xa7')]>0x0)_0x166b9a[_0x6791('0x51')](_0x6791('0xb6'),_[_0x6791('0x3c')](_0x599f9f,'id'));return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x166b9a[_0x6791('0xa6')](),_0x1c2864)[_0x6791('0x1f')](function(_0x1bdeab){var _0x1d7926=_[_0x6791('0xb7')](_0x1bdeab,_0x6791('0xb8'));var _0x2bb01f=[];_0x599f9f[_0x6791('0x41')](function(_0x386f26){_0x2bb01f[_0x6791('0x42')](updateChatInteraction(_0x386f26,_0x37e360,_0x1d7926));});return BPromise[_0x6791('0xb9')](_0x2bb01f);});});})[_0x6791('0x1f')](function(_0x153fd1){_0x4f0e2d['rows']=_0x153fd1;return _0x4f0e2d;})[_0x6791('0x1f')](respondWithFilteredResult(_0xbd6326,_0x573e38))[_0x6791('0xba')](handleError(_0xbd6326,null));};exports[_0x6791('0xbb')]=function(_0x4dc5e1,_0x4c6eb1){var _0x4bce1d={'raw':![],'where':{'id':_0x4dc5e1[_0x6791('0xbc')]['id']}},_0x42d7fb={};_0x42d7fb['model']=_[_0x6791('0x49')](db[_0x6791('0x44')][_0x6791('0x45')]);_0x42d7fb[_0x6791('0x4a')]=_[_0x6791('0x49')](_0x4dc5e1[_0x6791('0x4a')]);_0x42d7fb[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x42d7fb['model'],_0x42d7fb[_0x6791('0x4a')]);_0x4bce1d['attributes']=_[_0x6791('0x4b')](_0x42d7fb[_0x6791('0x48')],qs[_0x6791('0x4d')](_0x4dc5e1['query']['fields']));_0x4bce1d['attributes']=_0x4bce1d[_0x6791('0x4c')][_0x6791('0xa7')]?_0x4bce1d[_0x6791('0x4c')]:_0x42d7fb[_0x6791('0x48')];if(_0x4dc5e1['query'][_0x6791('0xbd')]){_0x4bce1d[_0x6791('0xbe')]=[{'all':!![]}];}_0x4bce1d=_[_0x6791('0x37')]({},_0x4bce1d,_0x4dc5e1[_0x6791('0xbf')]);return db['ChatInteraction']['find'](_0x4bce1d)['then'](handleEntityNotFound(_0x4c6eb1,null))[_0x6791('0x1f')](respondWithResult(_0x4c6eb1,null))['catch'](handleError(_0x4c6eb1,null));};exports[_0x6791('0xc0')]=function(_0x416812,_0xfb6287){return db[_0x6791('0x44')][_0x6791('0xc0')](_0x416812[_0x6791('0x38')],{})[_0x6791('0x1f')](respondWithResult(_0xfb6287,0xc9))[_0x6791('0xba')](handleError(_0xfb6287,null));};exports['update']=function(_0x38fa5c,_0x300c8b){if(_0x38fa5c['body']['id']){delete _0x38fa5c[_0x6791('0x38')]['id'];}return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x38fa5c[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x300c8b,null))[_0x6791('0x1f')](saveUpdates(_0x38fa5c[_0x6791('0x38')],null))[_0x6791('0x1f')](respondWithResult(_0x300c8b,null))[_0x6791('0xba')](handleError(_0x300c8b,null));};exports[_0x6791('0xc1')]=function(_0x201cfc,_0x456077){return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x201cfc['params']['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x456077,null))[_0x6791('0x1f')](removeEntity(_0x456077,null))[_0x6791('0xba')](handleError(_0x456077,null));};exports[_0x6791('0xc2')]=function(_0x19cb72,_0x5aad37){return db['ChatInteraction'][_0x6791('0xc2')]()[_0x6791('0x1f')](respondWithResult(_0x5aad37,null))['catch'](handleError(_0x5aad37,null));};exports[_0x6791('0xc3')]=function(_0x355c3a,_0x409f15){var _0x3fffd9=_0x355c3a[_0x6791('0xbc')]['id'];var _0xccd935;var _0x16b1d2;var _0x21a12c;return db[_0x6791('0x44')]['findOne']({'where':{'id':_0x3fffd9}})[_0x6791('0x1f')](function(_0x323f3c){_0xccd935=_0x323f3c;return db['ChatWebsite'][_0x6791('0xc4')]({'where':{'id':_0x323f3c['ChatWebsiteId']},'attributes':['id',_0x6791('0xc5'),_0x6791('0xc6'),_0x6791('0xc7'),_0x6791('0xc8'),_0x6791('0xc9')],'raw':!![]});})[_0x6791('0x1f')](function(_0x3a6ce4){if(_0x3a6ce4&&_0x3a6ce4[_0x6791('0xc5')]&&_0x3a6ce4[_0x6791('0xc6')]){_0x16b1d2=_0x3a6ce4;var _0x1ee4d7={'interaction':{'id':_0x3fffd9},'agent':{'id':_0x355c3a[_0x6791('0xa0')]['id'],'name':_0x355c3a[_0x6791('0xa0')][_0x6791('0x35')],'fullname':_0x355c3a[_0x6791('0xa0')][_0x6791('0x3d')],'email':_0x355c3a[_0x6791('0xa0')][_0x6791('0xca')]},'contact':_0x355c3a[_0x6791('0x38')][_0x6791('0xcb')],'account':_0x355c3a['body'][_0x6791('0xcc')]};var _0x5f52f8={'rejectUnauthorized':![],'method':_0x6791('0xcd'),'url':_0x6791('0xce'),'headers':{'X-APIKEY':_0x3a6ce4[_0x6791('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x355c3a[_0x6791('0xa0')][_0x6791('0xca')]],'buttons':null,'topic':_0x16b1d2[_0x6791('0xc7')],'note':_[_0x6791('0xcf')](_0x16b1d2[_0x6791('0xc8')])?null:getMustacheRender(_0x16b1d2['vidaooNote'],_0x1ee4d7),'metadata':null},'redirect':_0x6791('0xd0'),'json':!![]};try{if(!_['isNull'](_0x16b1d2['vidaooMetadata'])){var _0x37bb87=getMustacheRender(_0x16b1d2[_0x6791('0xc9')],_0x1ee4d7);var _0x371229=JSON[_0x6791('0x85')](_0x37bb87);_0x5f52f8[_0x6791('0x38')][_0x6791('0xd1')]=_0x371229;}}catch(_0x2e8d88){throw new db['Sequelize'][(_0x6791('0xd2'))](_0x6791('0xd3'));}return rp(_0x5f52f8);}else{throw new db[(_0x6791('0xd4'))][(_0x6791('0xd2'))](_0x6791('0xd5'));}})[_0x6791('0x1f')](function(_0x550c19){_0x21a12c=_0x550c19;if(_0x21a12c['id']){var _0x3a6909={'body':_0x21a12c[_0x6791('0xd6')],'ChatWebsiteId':_0x16b1d2['id'],'ChatInteractionId':_0xccd935['id'],'direction':'out','UserId':_0x355c3a[_0x6791('0xa0')]['id']};return db[_0x6791('0xd7')][_0x6791('0xc0')](_0x3a6909,{});}else{throw new db[(_0x6791('0xd4'))]['ValidationError'](_0x6791('0xd8'));}})[_0x6791('0x1f')](function(){return _0xccd935[_0x6791('0xd9')]({'vidaooSessionId':_0x21a12c['id']});})[_0x6791('0x1f')](respondWithResult(_0x409f15,null))['catch'](handleError(_0x409f15,null));};exports['customUpdate']=function(_0x46b51c,_0x3b618b){if(_0x46b51c[_0x6791('0x38')]['id']){delete _0x46b51c['body']['id'];}return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x46b51c[_0x6791('0xbc')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3b618b,null))[_0x6791('0x1f')](saveUpdates(_0x46b51c['body'],null))[_0x6791('0x1f')](respondWithResult(_0x3b618b,null))[_0x6791('0xba')](handleError(_0x3b618b,null));};exports[_0x6791('0xda')]=function(_0x576b1c,_0x348f18,_0x51538c){if(_0x576b1c[_0x6791('0x38')]['id']){delete _0x576b1c['body']['id'];}return db[_0x6791('0x44')]['find']({'where':{'id':_0x576b1c[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](function(_0x181b92){if(!_0x181b92){logger[_0x6791('0x26')](_0x6791('0xdb'),'abandon',0x194,_0x6791('0xdc'));_0x348f18['sendStatus'](0x194);}else{if(_0x181b92[_0x6791('0x7f')]){throw new db['Sequelize'][(_0x6791('0xd2'))](_0x6791('0xdd'));}}return _0x181b92;})[_0x6791('0x1f')](function(_0x105823){if(_0x105823){return _0x105823['update']({'closed':_0x576b1c['body'][_0x6791('0xde')],'disposition':_0x576b1c[_0x6791('0x38')][_0x6791('0xdf')]})[_0x6791('0x1f')](function(_0x5932ab){return _0x5932ab;});}})[_0x6791('0x1f')](function(_0x56389f){return respondWithRpcPromise(_0x6791('0xe0'),_0x6791('0xda'),_0x576b1c[_0x6791('0x38')],client9004);})[_0x6791('0x1f')](respondWithResult(_0x348f18,null))[_0x6791('0xba')](handleError(_0x348f18,null));};exports[_0x6791('0xe1')]=function(_0x3312c4,_0x5cd7c8,_0x3213a4){_0x3312c4[_0x6791('0x38')][_0x6791('0x35')]=_0x3312c4[_0x6791('0xe2')][_0x6791('0xe3')];_0x3312c4[_0x6791('0x38')][_0x6791('0xe4')]=_0x3312c4[_0x6791('0xe2')][_0x6791('0xe5')];_0x3312c4[_0x6791('0x38')][_0x6791('0x79')]=_0x3312c4[_0x6791('0xe2')]['mimetype'];return db[_0x6791('0xe6')][_0x6791('0xc0')](_0x3312c4['body'])[_0x6791('0x1f')](respondWithResult(_0x5cd7c8,0xc9))[_0x6791('0xba')](handleError(_0x5cd7c8,null));};exports[_0x6791('0xe7')]=function(_0x4e7de0,_0x5ad60f,_0x405363){return db[_0x6791('0x44')][_0x6791('0xc4')]({'where':{'id':_0x4e7de0[_0x6791('0xbc')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5ad60f,null))['then'](function(_0x1ea78e){if(_0x1ea78e){if(_0x1ea78e[_0x6791('0xde')]){return _0x5ad60f[_0x6791('0x2a')](0x193)[_0x6791('0x31')]({'status':0x193,'message':_0x6791('0xe8')});}return db[_0x6791('0xe6')][_0x6791('0xc4')]({'where':{'id':_0x4e7de0[_0x6791('0x4a')][_0x6791('0xe9')]},'raw':!![]})[_0x6791('0x1f')](handleEntityNotFound(_0x5ad60f,null));}})[_0x6791('0x1f')](function(_0x51e0ff){if(_0x51e0ff){var _0x40ced1=_0x51e0ff['ChatOfflineMessageId']!==null;var _0x2bbbf6=path[_0x6791('0xea')](config['root'],'server/files/attachments/');if(_0x40ced1){_0x2bbbf6=path[_0x6791('0xea')](_0x2bbbf6,_0x6791('0xeb'));}var _0x50b575=path[_0x6791('0xea')](_0x2bbbf6,_0x51e0ff[_0x6791('0xe4')]);return _0x5ad60f['download'](_0x50b575);}})[_0x6791('0xba')](handleError(_0x5ad60f,null));};exports[_0x6791('0xec')]=function(_0x217690,_0x3f8140){var _0x216b49=null;var _0x104b7d=null;var _0x1d1840=null;var _0xeeee25=null;if(_0x217690[_0x6791('0x38')]['id']){delete _0x217690['body']['id'];}if(_0x217690[_0x6791('0x38')][_0x6791('0xed')]){_0xeeee25=path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0xef'),util[_0x6791('0xf0')](_0x6791('0xf1'),Date['now']()));_0x217690[_0x6791('0x38')]['pathTranscript']=_0xeeee25;}return db[_0x6791('0x44')]['find']({'where':{'id':_0x217690[_0x6791('0xbc')]['id']},'include':[{'model':db[_0x6791('0xd7')],'as':_0x6791('0xf2'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x6791('0x1f')](handleEntityNotFound(_0x3f8140,null))[_0x6791('0x1f')](saveUpdates(_0x217690[_0x6791('0x38')],null))[_0x6791('0x1f')](function(_0x749c0b){if(_0x749c0b){_0x216b49=_0x749c0b;return db[_0x6791('0xf3')][_0x6791('0x6d')]({'where':{'id':_0x216b49[_0x6791('0x82')]}});}})['then'](function(_0x2df0f3){if(_0x2df0f3){_0x1d1840=_0x2df0f3;return db[_0x6791('0xf4')][_0x6791('0x6d')]({'where':{'id':_0x216b49[_0x6791('0x77')]}});}})[_0x6791('0x1f')](function(_0x206dda){if(_0x206dda){_0x104b7d=_0x206dda;if(_0xeeee25){var _0x13ab4d=null;for(var _0x4685f1=0x1;_0x4685f1<_0x216b49['Messages'][_0x6791('0xa7')];++_0x4685f1){_0x13ab4d=_0x216b49[_0x6791('0xf2')][_0x4685f1];var _0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util[_0x6791('0xf0')](_0x6791('0xf5'),_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');var _0x54f969=_0x217690['body']['customer']||util[_0x6791('0xf0')]('%s%d',_0x6791('0xf8'),_0x13ab4d[_0x6791('0x77')]);switch(_0x1d1840[_0x6791('0xf9')]){case'website_alias':_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util['format']('%s%d',_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');break;case _0x6791('0xfa'):_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?_0x13ab4d[_0x6791('0x7d')][_0x6791('0xfb')]||_0x13ab4d[_0x6791('0x7d')][_0x6791('0x3d')]:_0x6791('0xf7');break;case _0x6791('0xfc'):_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?_0x13ab4d[_0x6791('0x7d')]['fullname']:_0x6791('0xf7');break;default:_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util[_0x6791('0xf0')](_0x6791('0xf5'),_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');}var _0xd5e51f=util[_0x6791('0xf0')](_0x6791('0xfd'),moment(_0x13ab4d[_0x6791('0x84')])['format'](_0x6791('0xfe')),_0x13ab4d[_0x6791('0xff')]==='in'?_0x54f969:_0x7f7b0d,_0x13ab4d[_0x6791('0x38')]);if(!_0x13ab4d[_0x6791('0x100')]){fs[_0x6791('0x101')](_0xeeee25,_0xd5e51f);}}return db['MailAccount'][_0x6791('0xc4')]({'where':{'service':!![]},'include':[{'model':db[_0x6791('0x102')],'as':_0x6791('0x103'),'raw':!![]}]});}}})['then'](function(_0x287f0){if(_0x287f0&&_0x287f0[_0x6791('0x103')]&&_0x217690['body']){var _0x505914={'tls':{'rejectUnauthorized':![]}};if(_0x287f0[_0x6791('0x103')][_0x6791('0x104')]){_0x505914[_0x6791('0x104')]=_0x287f0['Smtp'][_0x6791('0x104')];}else{_0x505914['host']=_0x287f0[_0x6791('0x103')][_0x6791('0x105')];_0x505914[_0x6791('0x106')]=_0x287f0[_0x6791('0x103')][_0x6791('0x106')];_0x505914[_0x6791('0x107')]=_0x287f0[_0x6791('0x103')][_0x6791('0x107')];}if(_0x287f0['Smtp'][_0x6791('0x108')]){_0x505914['auth']={'user':_0x287f0[_0x6791('0x103')][_0x6791('0xa0')],'pass':_0x287f0[_0x6791('0x103')][_0x6791('0x109')]};}return respondWithRpcPromise(_0x6791('0x10a'),_0x6791('0x10b'),{'account':_0x505914,'message':{'from':util[_0x6791('0xf0')]('\x22%s\x22\x20<%s>',_0x287f0[_0x6791('0x35')],_0x287f0['email']||_0x287f0['Smtp'][_0x6791('0xa0')]),'to':_0x217690[_0x6791('0x38')][_0x6791('0xed')],'subject':_0x6791('0x10c'),'text':util[_0x6791('0xf0')](_0x6791('0x10d'),_0x217690['body'][_0x6791('0xed')]),'attachments':[{'path':_0xeeee25}]}})[_0x6791('0x1f')](function(){return _0x216b49;})[_0x6791('0xba')](function(_0x598e2a){console[_0x6791('0x26')](_0x598e2a);});}else{return _0x216b49;}})[_0x6791('0x1f')](respondWithStatusCode(_0x3f8140,0xc8))[_0x6791('0xba')](handleError(_0x3f8140,null));};exports[_0x6791('0x10e')]=function(_0x1c5b2e,_0x2d5291,_0x881fc6){return db[_0x6791('0xd7')][_0x6791('0x6d')]({'where':{'id':_0x1c5b2e['params']['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x2d5291,null))[_0x6791('0x1f')](function(_0x5096ae){if(_0x5096ae){return _0x5096ae['addMessage'](_0x1c5b2e['body'][_0x6791('0x10f')],_[_0x6791('0x110')](_0x1c5b2e[_0x6791('0x38')],[_0x6791('0x10f'),'id'])||{});}})[_0x6791('0x1f')](respondWithResult(_0x2d5291,null))[_0x6791('0xba')](handleError(_0x2d5291,null));};exports['getMessages']=function(_0x541ee8,_0x4876ef,_0x48d62f){var _0x2e5b68={'raw':![],'where':{}};var _0x56fadd={};var _0x5ad2f9={'count':0x0,'rows':[]};return db[_0x6791('0x44')][_0x6791('0xc4')]({'where':{'id':_0x541ee8[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x4876ef,null))[_0x6791('0x1f')](function(_0x117382){if(_0x117382){_0x56fadd['model']=_[_0x6791('0x49')](db[_0x6791('0xd7')][_0x6791('0x45')]);_0x56fadd['query']=_[_0x6791('0x49')](_0x541ee8[_0x6791('0x4a')]);_0x56fadd[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x56fadd[_0x6791('0x48')],_0x56fadd[_0x6791('0x4a')]);_0x2e5b68[_0x6791('0x4c')]=_['intersection'](_0x56fadd['model'],qs[_0x6791('0x4d')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x4d')]));_0x2e5b68[_0x6791('0x4c')]=_0x2e5b68[_0x6791('0x4c')]['length']?_0x2e5b68[_0x6791('0x4c')]:_0x56fadd[_0x6791('0x48')];if(!_0x541ee8[_0x6791('0x4a')][_0x6791('0x4e')]('nolimit')){_0x2e5b68['limit']=qs[_0x6791('0x2c')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x2c')]);_0x2e5b68[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x2d')]);}_0x2e5b68['order']=qs[_0x6791('0x50')](_0x541ee8[_0x6791('0x4a')]['sort']);_0x2e5b68[_0x6791('0x51')]=qs[_0x6791('0x53')](_[_0x6791('0x52')](_0x541ee8['query'],_0x56fadd[_0x6791('0x53')]));_0x2e5b68[_0x6791('0x51')][_0x6791('0xb8')]=_0x117382['id'];if(_0x541ee8[_0x6791('0x4a')]['filter']){_0x2e5b68[_0x6791('0x51')]=_[_0x6791('0x37')](_0x2e5b68[_0x6791('0x51')],{'$or':_[_0x6791('0x3c')](_0x2e5b68['attributes'],function(_0x1b96a8){var _0x4f2e87={};_0x4f2e87[_0x1b96a8]={'$like':'%'+_0x541ee8[_0x6791('0x4a')][_0x6791('0x91')]+'%'};return _0x4f2e87;})});}if(_0x541ee8[_0x6791('0x4a')][_0x6791('0x86')]){var _0x267d3f=_0x541ee8[_0x6791('0x4a')]['$gte'][_0x6791('0x40')](',');var _0x1fe4f3={};_0x1fe4f3[_0x267d3f[0x0]]={'$gte':moment(_0x267d3f[0x1])[_0x6791('0xf0')](_0x6791('0x111'))};_0x2e5b68['where']=_['merge'](_0x2e5b68['where'],_0x1fe4f3);}_0x2e5b68=_['merge']({},_0x2e5b68,_0x541ee8[_0x6791('0xbf')]);return db[_0x6791('0xd7')][_0x6791('0x2e')]({'where':_0x2e5b68[_0x6791('0x51')]})[_0x6791('0x1f')](function(_0x28265e){_0x5ad2f9[_0x6791('0x2e')]=_0x28265e;if(_0x541ee8['query'][_0x6791('0xbd')]){_0x2e5b68['include']=[{'all':!![]}];}return db[_0x6791('0xd7')][_0x6791('0x112')](_0x2e5b68);})[_0x6791('0x1f')](function(_0x5a1d1d){_0x5ad2f9[_0x6791('0x113')]=_0x5a1d1d;return _0x5ad2f9;});}})[_0x6791('0x1f')](respondWithFilteredResult(_0x4876ef,_0x2e5b68))[_0x6791('0xba')](handleError(_0x4876ef,null));};exports[_0x6791('0x114')]=function(_0x202f0a,_0x2f4e6f,_0x4dd36a){var _0x42370c={'where':{}},_0x5a23ba={},_0x5088cd={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x6791('0xc4')]({'where':{'id':_0x202f0a[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x2f4e6f,null))[_0x6791('0x1f')](function(_0xe4951){if(_0xe4951){_0x5a23ba[_0x6791('0x48')]=_[_0x6791('0x49')](db[_0x6791('0xd7')][_0x6791('0x45')]);_0x5a23ba['query']=_[_0x6791('0x49')](_0x202f0a['query']);_0x5a23ba[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x5a23ba[_0x6791('0x48')],_0x5a23ba[_0x6791('0x4a')]);_0x42370c[_0x6791('0x4c')]=_[_0x6791('0x4b')](_0x5a23ba[_0x6791('0x48')],qs['fields'](_0x202f0a[_0x6791('0x4a')]['fields']));_0x42370c['attributes']=_0x42370c[_0x6791('0x4c')][_0x6791('0xa7')]?_0x42370c['attributes']:_0x5a23ba[_0x6791('0x48')];if(!_0x202f0a[_0x6791('0x4a')][_0x6791('0x4e')](_0x6791('0x4f'))){_0x42370c[_0x6791('0x2c')]=qs['limit'](_0x202f0a[_0x6791('0x4a')][_0x6791('0x2c')]);_0x42370c[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x202f0a[_0x6791('0x4a')]['offset']);}_0x42370c[_0x6791('0x9b')]=qs['sort'](_0x202f0a['query'][_0x6791('0x50')]);_0x42370c['where']=qs[_0x6791('0x53')](_['pick'](_0x202f0a[_0x6791('0x4a')],_0x5a23ba[_0x6791('0x53')]));_0x42370c[_0x6791('0x51')][_0x6791('0xb8')]=_0xe4951['id'];if(_0x202f0a[_0x6791('0x4a')][_0x6791('0x91')]){_0x42370c[_0x6791('0x51')]=_[_0x6791('0x37')](_0x42370c[_0x6791('0x51')],{'$or':_['map'](_0x42370c['attributes'],function(_0x50e02c){var _0x2d7581={};_0x2d7581[_0x50e02c]={'$like':'%'+_0x202f0a[_0x6791('0x4a')][_0x6791('0x91')]+'%'};return _0x2d7581;})});}_0x42370c[_0x6791('0x51')][_0x6791('0x100')]=![];if(_0x202f0a[_0x6791('0x4a')]['id']){_0x42370c['where']['id']={'$gt':_0x202f0a['query']['id']};}_0x42370c=_[_0x6791('0x37')]({},_0x42370c,_0x202f0a[_0x6791('0xbf')]);return db[_0x6791('0xd7')]['count']({'where':_0x42370c[_0x6791('0x51')]})[_0x6791('0x1f')](function(_0x4a143f){_0x5088cd['count']=_0x4a143f;_0x42370c[_0x6791('0xbe')]=[];if(_0x202f0a[_0x6791('0x4a')][_0x6791('0x115')]){_0x42370c[_0x6791('0xbe')][_0x6791('0x42')]({'model':db[_0x6791('0x7d')],'as':_0x6791('0x7d'),'attributes':['id',_0x6791('0x3d'),_0x6791('0xfb')]});}if(_0x202f0a[_0x6791('0x4a')][_0x6791('0xbd')]){_0x42370c[_0x6791('0xbe')]=[{'all':!![]}];}return db[_0x6791('0xd7')][_0x6791('0x112')](_0x42370c);})[_0x6791('0x1f')](function(_0x44dc2a){_0x5088cd['rows']=_0x44dc2a;return _0x5088cd;});}})[_0x6791('0x1f')](respondWithFilteredResult(_0x2f4e6f,_0x42370c))['catch'](handleError(_0x2f4e6f,null));};exports[_0x6791('0x116')]=function(_0x9c2cb,_0x5038f2,_0x7e30d9){return db[_0x6791('0x44')]['find']({'where':{'id':_0x9c2cb[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x5038f2,null))[_0x6791('0x1f')](function(_0xd53708){if(_0xd53708){return _0xd53708['setTags'](_0x9c2cb['body']['ids'],_[_0x6791('0x110')](_0x9c2cb[_0x6791('0x38')],['ids','id'])||{})[_0x6791('0x117')](function(){return db[_0x6791('0x118')][_0x6791('0x112')]({'attributes':['id','name',_0x6791('0x56')],'where':{'id':_0x9c2cb[_0x6791('0x38')][_0x6791('0x10f')]}});})[_0x6791('0x1f')](function(_0x5e3c66){socket[_0x6791('0x119')]('chatInteractionTags:save',{'id':Number(_0x9c2cb[_0x6791('0xbc')]['id']),'tags':_0x5e3c66||[]});return{'id':Number(_0x9c2cb[_0x6791('0xbc')]['id']),'tags':_0x5e3c66||[]};});}})[_0x6791('0x1f')](respondWithResult(_0x5038f2,null))['catch'](handleError(_0x5038f2,null));};exports[_0x6791('0x11a')]=function(_0x10530c,_0x521cae,_0x3f4172){return db[_0x6791('0x44')]['find']({'where':{'id':_0x10530c[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x521cae,null))[_0x6791('0x1f')](function(_0x926ee4){if(_0x926ee4){return _0x926ee4[_0x6791('0x11a')](_0x10530c[_0x6791('0x4a')][_0x6791('0x10f')]);}})['then'](respondWithStatusCode(_0x521cae,null))[_0x6791('0xba')](handleError(_0x521cae,null));};exports[_0x6791('0x11b')]=function(_0x22dbd0,_0x1cc5c3){var _0x1d2613=moment()[_0x6791('0x11c')]()[_0x6791('0xa6')]();var _0x1d3607=path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0x11d'),_0x6791('0x11e'),_0x6791('0x11f'));var _0x3b3363=path[_0x6791('0xea')](config['root'],'server',_0x6791('0x11e'),_0x6791('0x120'));var _0x56d353=path[_0x6791('0xea')](_0x1d3607,_0x1d2613);var _0x481b70=util[_0x6791('0xf0')](_0x6791('0x121'),_0x22dbd0[_0x6791('0xbc')]['id'],_0x1d2613);var _0x1caa00=path[_0x6791('0xea')](_0x1d3607,_0x481b70);var _0x14d7e3=[];_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0x7d')],'as':_0x6791('0x7d'),'attributes':['id',_0x6791('0x3d')],'raw':!![]});_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0xf4')],'as':'Contact','attributes':['id',_0x6791('0x122'),_0x6791('0x123')],'raw':!![]});if(_0x22dbd0[_0x6791('0x4a')][_0x6791('0x120')]){_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0xe6')],'as':_0x6791('0xe6'),'raw':!![]});}var _0xb8d13a=[{'model':db[_0x6791('0xd7')],'as':_0x6791('0xf2'),'attributes':['id',_0x6791('0x38'),_0x6791('0x84'),_0x6791('0xff'),_0x6791('0x100'),_0x6791('0x124')],'include':_0x14d7e3}];_0xb8d13a[_0x6791('0x42')]({'model':db[_0x6791('0xf3')],'as':_0x6791('0x125'),'attributes':['id','name']});_0xb8d13a[_0x6791('0x42')]({'model':db['User'],'as':_0x6791('0x126'),'attributes':['id','fullname']});return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x22dbd0['params']['id']},'include':_0xb8d13a})[_0x6791('0x1f')](handleEntityNotFound(_0x1cc5c3,null))[_0x6791('0x1f')](function(_0x3c7b66){if(_0x3c7b66){var _0x3d7e1f=_0x3c7b66[_0x6791('0x127')]({'plain':!![]});fs[_0x6791('0x128')](_0x56d353);var _0x2e6bc5={'channel':_0x6791('0x129'),'account':_0x3d7e1f[_0x6791('0x125')][_0x6791('0x35')],'agent':_0x3d7e1f[_0x6791('0x126')]?_0x3d7e1f[_0x6791('0x126')][_0x6791('0x3d')]:_0x6791('0x12a'),'createdAt':moment(_0x3d7e1f[_0x6791('0x84')])[_0x6791('0xf0')](_0x6791('0x111'))[_0x6791('0xa6')](),'closedAt':_0x3d7e1f[_0x6791('0xde')]?moment(_0x3d7e1f[_0x6791('0x12b')])[_0x6791('0xf0')](_0x6791('0x111'))['toString']():'','disposition':_0x3d7e1f[_0x6791('0xdf')],'chatInfo':{'browser':_0x3d7e1f[_0x6791('0x12c')],'os':_0x3d7e1f[_0x6791('0x12d')],'referer':_0x3d7e1f[_0x6791('0x12e')],'customerIp':_0x3d7e1f[_0x6791('0x12f')],'customerPort':_0x3d7e1f[_0x6791('0x130')]?_0x3d7e1f[_0x6791('0x130')]:_0x6791('0x12a')},'messages':_(_0x3d7e1f[_0x6791('0xf2')])[_0x6791('0x131')]()[_0x6791('0x91')]({'secret':![]})[_0x6791('0x3c')](function(_0x449a9f){if(_0x449a9f[_0x6791('0xe6')]){var _0xc6d9ba=path[_0x6791('0xea')](_0x3b3363,_0x449a9f[_0x6791('0xe6')][_0x6791('0xe4')]);if(fs['existsSync'](_0xc6d9ba)){fs[_0x6791('0x132')](_0xc6d9ba)['pipe'](fs[_0x6791('0x133')](path['join'](_0x56d353,_0x449a9f[_0x6791('0xe6')][_0x6791('0xe4')])));}}return{'date':moment(_0x449a9f[_0x6791('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6791('0xa6')](),'sender':_0x449a9f[_0x6791('0xff')]===_0x6791('0x134')?_0x449a9f[_0x6791('0x7d')]?_0x449a9f['User'][_0x6791('0x3d')]:'System':_0x449a9f['Contact'][_0x6791('0x122')]+(_0x449a9f[_0x6791('0x72')][_0x6791('0x123')]?'\x20'+_0x449a9f[_0x6791('0x72')][_0x6791('0x123')]:''),'body':_0x449a9f[_0x6791('0xe6')]?_0x449a9f[_0x6791('0xe6')]['basename']:_0x449a9f[_0x6791('0x38')],'direction':_0x449a9f['direction']===_0x6791('0x134')?'A':'C','secret':_0x449a9f['secret'],'read':_0x449a9f[_0x6791('0x124')],'attachment':_0x449a9f[_0x6791('0xe6')]};})[_0x6791('0x6f')]()};return ejs['renderFile'](path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0x11d'),_0x6791('0x135'),_0x6791('0x136')),{'interaction':_0x2e6bc5})[_0x6791('0x1f')](function(_0x2946bd){var _0x4ede2f=path[_0x6791('0xea')](_0x56d353,_0x6791('0x137')+_0x3d7e1f['id']+'-'+_0x1d2613+_0x6791('0x138'));var _0x2a8d18={'path':_0x4ede2f,'channel':_0x6791('0x129'),'interactionId':_0x3d7e1f['id']};return pdf[_0x6791('0x139')](_0x2946bd,_0x2a8d18);})[_0x6791('0x1f')](function(){return new BPromise(function(_0x192f05,_0x1e661a){zipdir(_0x56d353,{'saveTo':_0x1caa00},function(_0x102182,_0x2f15a2){if(_0x102182)return _0x1e661a(_0x102182);return _0x192f05(_0x2f15a2);});})[_0x6791('0x1f')](function(){return new BPromise(function(_0x2aa871,_0x59376b){rimraf(_0x56d353,function(_0xefb45b){if(_0xefb45b)_0x59376b(_0xefb45b);return _0x2aa871();});});})[_0x6791('0x1f')](function(){return _0x1cc5c3['download'](_0x1caa00,_0x481b70,function(_0x4c3ef2){if(_0x4c3ef2){console[_0x6791('0x13a')](_0x6791('0x13b'),_0x4c3ef2);}else{fs[_0x6791('0x13c')](_0x1caa00);}});});});}else{return _0x1cc5c3[_0x6791('0x29')](0xc8);}})['catch'](handleError(_0x1cc5c3,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0c3f638..3e2c479 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 _0xacb2=['ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','then','map','findAll','setDataValue','length','emit','hasOwnProperty','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacb2,0x117));var _0x2acb=function(_0x57dbd0,_0x8410cf){_0x57dbd0=_0x57dbd0-0x0;var _0x54894d=_0xacb2[_0x57dbd0];return _0x54894d;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x2acb('0x0'))['db'][_0x2acb('0x1')];var ChatMessage=require(_0x2acb('0x0'))['db'][_0x2acb('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2acb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2acb('0x4'),'afterDestroy':_0x2acb('0x5')};function emitEvent(_0x589ef1){return function(_0x4c8db2,_0x31d543,_0x27cdfb){_0x4c8db2[_0x2acb('0x6')]({'attributes':['id'],'raw':!![]})[_0x2acb('0x7')](function(_0x115b8c){_0x4c8db2['setDataValue']('Users',_0x115b8c[_0x2acb('0x8')](function(_0x1755c8){return{'id':_0x1755c8['id']};}));return ChatMessage[_0x2acb('0x9')]({'where':{'ChatInteractionId':_0x4c8db2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2acb('0x7')](function(_0x7016a6){_0x4c8db2[_0x2acb('0xa')]('unreadMessages',_0x7016a6[_0x2acb('0xb')]);ChatInteractionEvents[_0x2acb('0xc')](_0x589ef1+':'+_0x4c8db2['id'],_0x4c8db2);ChatInteractionEvents[_0x2acb('0xc')](_0x589ef1,_0x4c8db2);_0x27cdfb(null);})['catch'](_0x27cdfb(null));};}for(var e in events){if(events[_0x2acb('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xe446=['Users','map','findAll','unreadMessages','length','emit','exports','../../mysqldb','ChatInteraction','save','update','remove','getUsers','then','setDataValue'];(function(_0x26bd9d,_0xa80cf7){var _0x3192d8=function(_0xcee2be){while(--_0xcee2be){_0x26bd9d['push'](_0x26bd9d['shift']());}};_0x3192d8(++_0xa80cf7);}(_0xe446,0x16f));var _0x6e44=function(_0x190abb,_0x5c356d){_0x190abb=_0x190abb-0x0;var _0x31fe0f=_0xe446[_0x190abb];return _0x31fe0f;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x6e44('0x0'))['db'][_0x6e44('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e44('0x2'),'afterUpdate':_0x6e44('0x3'),'afterDestroy':_0x6e44('0x4')};function emitEvent(_0x4813c6){return function(_0x59c436,_0x33835c,_0x364793){_0x59c436[_0x6e44('0x5')]({'attributes':['id'],'raw':!![]})[_0x6e44('0x6')](function(_0xd82de4){_0x59c436[_0x6e44('0x7')](_0x6e44('0x8'),_0xd82de4[_0x6e44('0x9')](function(_0x27f75c){return{'id':_0x27f75c['id']};}));return ChatMessage[_0x6e44('0xa')]({'where':{'ChatInteractionId':_0x59c436['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3d61dc){_0x59c436[_0x6e44('0x7')](_0x6e44('0xb'),_0x3d61dc[_0x6e44('0xc')]);ChatInteractionEvents[_0x6e44('0xd')](_0x4813c6+':'+_0x59c436['id'],_0x59c436);ChatInteractionEvents[_0x6e44('0xd')](_0x4813c6,_0x59c436);_0x364793(null);})['catch'](_0x364793(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x6e44('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9d776a1..768ec6d 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 _0x4c73=['closedAt','format','utf8mb4','lodash','api','moment','bluebird','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed'];(function(_0x33399b,_0x1cd1cc){var _0x49acc9=function(_0x16ef40){while(--_0x16ef40){_0x33399b['push'](_0x33399b['shift']());}};_0x49acc9(++_0x1cd1cc);}(_0x4c73,0xa8));var _0x34c7=function(_0xf93db,_0x5b18ad){_0xf93db=_0xf93db-0x0;var _0x2d9680=_0x4c73[_0xf93db];return _0x2d9680;};'use strict';var _=require(_0x34c7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x34c7('0x1'));var moment=require(_0x34c7('0x2'));var BPromise=require(_0x34c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34c7('0x4'));var rimraf=require('rimraf');var config=require(_0x34c7('0x5'));var attributes=require(_0x34c7('0x6'));module[_0x34c7('0x7')]=function(_0x1df8fb,_0x479173){return _0x1df8fb[_0x34c7('0x8')](_0x34c7('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30d7f8,_0x542eb9,_0x52b36b){if(_0x30d7f8[_0x34c7('0xa')](_0x34c7('0xb'))){_0x30d7f8[_0x34c7('0xc')]=moment()[_0x34c7('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x52b36b(null,_0x30d7f8);}},'charset':_0x34c7('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x640d=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed'];(function(_0x516f6b,_0x48ba9e){var _0xb4607=function(_0x175e74){while(--_0x175e74){_0x516f6b['push'](_0x516f6b['shift']());}};_0xb4607(++_0x48ba9e);}(_0x640d,0xdd));var _0xd640=function(_0x8359e,_0x43c33f){_0x8359e=_0x8359e-0x0;var _0x4ee946=_0x640d[_0x8359e];return _0x4ee946;};'use strict';var _=require(_0xd640('0x0'));var util=require(_0xd640('0x1'));var logger=require(_0xd640('0x2'))(_0xd640('0x3'));var moment=require(_0xd640('0x4'));var BPromise=require(_0xd640('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd640('0x6'));var rimraf=require(_0xd640('0x7'));var config=require(_0xd640('0x8'));var attributes=require(_0xd640('0x9'));module['exports']=function(_0x2793e5,_0x2957dd){return _0x2793e5['define'](_0xd640('0xa'),attributes,{'tableName':_0xd640('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x66ca95,_0xeb071e,_0x7db407){if(_0x66ca95[_0xd640('0xc')](_0xd640('0xd'))){_0x66ca95[_0xd640('0xe')]=moment()[_0xd640('0xf')](_0xd640('0x10'));}_0x7db407(null,_0x66ca95);}},'charset':'utf8mb4','collate':_0xd640('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 19bfabf..82cef93 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 _0x5454=['jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UpdateChatInteraction','update','body','options','raw','where','attributes','catch','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x15d23a,_0x490567){var _0x2dedc9=function(_0x443ad5){while(--_0x443ad5){_0x15d23a['push'](_0x15d23a['shift']());}};_0x2dedc9(++_0x490567);}(_0x5454,0x160));var _0x4545=function(_0x24afda,_0x210b83){_0x24afda=_0x24afda-0x0;var _0x1d6256=_0x5454[_0x24afda];return _0x1d6256;};'use strict';var _=require(_0x4545('0x0'));var util=require(_0x4545('0x1'));var moment=require('moment');var BPromise=require(_0x4545('0x2'));var rs=require(_0x4545('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4545('0x4'))['db'];var utils=require(_0x4545('0x5'));var logger=require(_0x4545('0x6'))(_0x4545('0x7'));var config=require('../../config/environment');var jayson=require(_0x4545('0x8'));var client=jayson[_0x4545('0x9')]['http']({'port':0x232a});config[_0x4545('0xa')]=_['defaults'](config['redis'],{'host':_0x4545('0xb'),'port':0x18eb});var socket=require(_0x4545('0xc'))(new Redis(config[_0x4545('0xa')]));require('./chatInteraction.socket')[_0x4545('0xd')](socket);function respondWithRpcPromise(_0x2ffdf9,_0xaacc9e,_0x2e971e){return new BPromise(function(_0x32b7e4,_0xfb9f9a){return client[_0x4545('0xe')](_0x2ffdf9,_0x2e971e)[_0x4545('0xf')](function(_0x2d6f04){logger[_0x4545('0x10')](_0x4545('0x11'),_0xaacc9e,'request\x20sent');logger[_0x4545('0x12')](_0x4545('0x13'),_0xaacc9e,_0x4545('0x14'),JSON[_0x4545('0x15')](_0x2d6f04));if(_0x2d6f04['error']){if(_0x2d6f04[_0x4545('0x16')]['code']===0x1f4){logger['error'](_0x4545('0x11'),_0xaacc9e,_0x2d6f04[_0x4545('0x16')][_0x4545('0x17')]);return _0xfb9f9a(_0x2d6f04[_0x4545('0x16')]['message']);}logger[_0x4545('0x16')]('ChatInteraction,\x20%s,\x20%s',_0xaacc9e,_0x2d6f04[_0x4545('0x16')][_0x4545('0x17')]);return _0x32b7e4(_0x2d6f04['error'][_0x4545('0x17')]);}else{logger[_0x4545('0x10')](_0x4545('0x11'),_0xaacc9e,_0x4545('0x14'));_0x32b7e4(_0x2d6f04['result'][_0x4545('0x17')]);}})['catch'](function(_0x3f254e){logger[_0x4545('0x16')]('ChatInteraction,\x20%s,\x20%s',_0xaacc9e,_0x3f254e);_0xfb9f9a(_0x3f254e);});});}exports[_0x4545('0x18')]=function(_0x445ae5){var _0x5d9e65=this;return new Promise(function(_0x26b1f2,_0x4e1c33){return db['ChatInteraction'][_0x4545('0x19')](_0x445ae5[_0x4545('0x1a')],{'raw':_0x445ae5[_0x4545('0x1b')]?_0x445ae5[_0x4545('0x1b')][_0x4545('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445ae5[_0x4545('0x1b')]?_0x445ae5['options'][_0x4545('0x1d')]||null:null,'attributes':_0x445ae5[_0x4545('0x1b')]?_0x445ae5[_0x4545('0x1b')][_0x4545('0x1e')]||null:null,'limit':_0x445ae5[_0x4545('0x1b')]?_0x445ae5[_0x4545('0x1b')]['limit']||null:null})[_0x4545('0xf')](function(_0x2c8eac){logger[_0x4545('0x10')](_0x4545('0x18'),_0x445ae5);logger[_0x4545('0x12')](_0x4545('0x18'),_0x445ae5,JSON[_0x4545('0x15')](_0x2c8eac));_0x26b1f2(_0x2c8eac);})[_0x4545('0x1f')](function(_0x58e2ab){logger[_0x4545('0x16')](_0x4545('0x18'),_0x58e2ab[_0x4545('0x17')],_0x445ae5);_0x4e1c33(_0x5d9e65[_0x4545('0x16')](0x1f4,_0x58e2ab[_0x4545('0x17')]));});});};exports[_0x4545('0x20')]=function(_0x690a84){return new Promise(function(_0x40e491,_0x3c17b3){return db[_0x4545('0x21')][_0x4545('0x22')]({'where':_0x690a84['options']?_0x690a84[_0x4545('0x1b')][_0x4545('0x1d')]||null:null})['then'](function(_0x2db4b9){if(_0x2db4b9){return _0x2db4b9[_0x4545('0x23')](_0x690a84[_0x4545('0x1a')][_0x4545('0x24')],_[_0x4545('0x25')](_0x690a84[_0x4545('0x1a')],[_0x4545('0x24'),'id'])||{});}})[_0x4545('0x26')](function(_0x3c317a){logger[_0x4545('0x10')]('AddTags',_0x690a84);logger[_0x4545('0x12')](_0x4545('0x27'),_0x690a84,JSON['stringify'](_0x3c317a));_0x40e491(_0x3c317a);})[_0x4545('0x1f')](function(_0x31b7ab){logger['error'](_0x4545('0x27'),_0x31b7ab[_0x4545('0x17')],_0x690a84);_0x3c17b3(_this[_0x4545('0x16')](0x1f4,_0x31b7ab[_0x4545('0x17')]));});});}; \ No newline at end of file +var _0xd1cf=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','then','debug','AddTagsToChatInteraction','addTags','omit','ids','AddTags'];(function(_0x2b51dc,_0x3b6e45){var _0x4bda0e=function(_0x5e9a16){while(--_0x5e9a16){_0x2b51dc['push'](_0x2b51dc['shift']());}};_0x4bda0e(++_0x3b6e45);}(_0xd1cf,0x126));var _0xfd1c=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xd1cf[_0x42020e];return _0x561551;};'use strict';var _=require(_0xfd1c('0x0'));var util=require('util');var moment=require(_0xfd1c('0x1'));var BPromise=require(_0xfd1c('0x2'));var rs=require(_0xfd1c('0x3'));var fs=require('fs');var Redis=require(_0xfd1c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd1c('0x5'));var logger=require(_0xfd1c('0x6'))('rpc');var config=require(_0xfd1c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd1c('0x8')][_0xfd1c('0x9')]({'port':0x232a});config[_0xfd1c('0xa')]=_['defaults'](config[_0xfd1c('0xa')],{'host':_0xfd1c('0xb'),'port':0x18eb});var socket=require(_0xfd1c('0xc'))(new Redis(config[_0xfd1c('0xa')]));require(_0xfd1c('0xd'))[_0xfd1c('0xe')](socket);function respondWithRpcPromise(_0x45e01d,_0x37cf00,_0x3a3b18){return new BPromise(function(_0x29b001,_0x1bf524){return client[_0xfd1c('0xf')](_0x45e01d,_0x3a3b18)['then'](function(_0x36e500){logger[_0xfd1c('0x10')](_0xfd1c('0x11'),_0x37cf00,_0xfd1c('0x12'));logger['debug'](_0xfd1c('0x13'),_0x37cf00,'request\x20sent',JSON[_0xfd1c('0x14')](_0x36e500));if(_0x36e500[_0xfd1c('0x15')]){if(_0x36e500[_0xfd1c('0x15')][_0xfd1c('0x16')]===0x1f4){logger[_0xfd1c('0x15')](_0xfd1c('0x11'),_0x37cf00,_0x36e500['error'][_0xfd1c('0x17')]);return _0x1bf524(_0x36e500[_0xfd1c('0x15')][_0xfd1c('0x17')]);}logger[_0xfd1c('0x15')](_0xfd1c('0x11'),_0x37cf00,_0x36e500[_0xfd1c('0x15')]['message']);return _0x29b001(_0x36e500[_0xfd1c('0x15')][_0xfd1c('0x17')]);}else{logger[_0xfd1c('0x10')](_0xfd1c('0x11'),_0x37cf00,_0xfd1c('0x12'));_0x29b001(_0x36e500[_0xfd1c('0x18')][_0xfd1c('0x17')]);}})[_0xfd1c('0x19')](function(_0x3f2ca8){logger[_0xfd1c('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x37cf00,_0x3f2ca8);_0x1bf524(_0x3f2ca8);});});}exports[_0xfd1c('0x1a')]=function(_0x11719f){var _0x559a2c=this;return new Promise(function(_0x297f79,_0x51a8da){return db[_0xfd1c('0x1b')][_0xfd1c('0x1c')](_0x11719f[_0xfd1c('0x1d')],{'raw':_0x11719f[_0xfd1c('0x1e')]?_0x11719f[_0xfd1c('0x1e')][_0xfd1c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11719f[_0xfd1c('0x1e')]?_0x11719f[_0xfd1c('0x1e')][_0xfd1c('0x20')]||null:null,'attributes':_0x11719f['options']?_0x11719f[_0xfd1c('0x1e')][_0xfd1c('0x21')]||null:null,'limit':_0x11719f[_0xfd1c('0x1e')]?_0x11719f[_0xfd1c('0x1e')][_0xfd1c('0x22')]||null:null})[_0xfd1c('0x23')](function(_0x510668){logger[_0xfd1c('0x10')](_0xfd1c('0x1a'),_0x11719f);logger[_0xfd1c('0x24')](_0xfd1c('0x1a'),_0x11719f,JSON[_0xfd1c('0x14')](_0x510668));_0x297f79(_0x510668);})[_0xfd1c('0x19')](function(_0x2e116f){logger[_0xfd1c('0x15')](_0xfd1c('0x1a'),_0x2e116f[_0xfd1c('0x17')],_0x11719f);_0x51a8da(_0x559a2c['error'](0x1f4,_0x2e116f[_0xfd1c('0x17')]));});});};exports[_0xfd1c('0x25')]=function(_0x886368){return new Promise(function(_0x35e58a,_0x2bf9a9){return db[_0xfd1c('0x1b')]['find']({'where':_0x886368[_0xfd1c('0x1e')]?_0x886368[_0xfd1c('0x1e')][_0xfd1c('0x20')]||null:null})[_0xfd1c('0x23')](function(_0x4dc86d){if(_0x4dc86d){return _0x4dc86d[_0xfd1c('0x26')](_0x886368[_0xfd1c('0x1d')]['ids'],_[_0xfd1c('0x27')](_0x886368[_0xfd1c('0x1d')],[_0xfd1c('0x28'),'id'])||{});}})['spread'](function(_0x3e74cb){logger[_0xfd1c('0x10')]('AddTags',_0x886368);logger[_0xfd1c('0x24')]('AddTags',_0x886368,JSON[_0xfd1c('0x14')](_0x3e74cb));_0x35e58a(_0x3e74cb);})[_0xfd1c('0x19')](function(_0x4df8d4){logger['error'](_0xfd1c('0x29'),_0x4df8d4[_0xfd1c('0x17')],_0x886368);_0x2bf9a9(_this[_0xfd1c('0x15')](0x1f4,_0x4df8d4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a7f3bf9..c4d2e7a 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 _0x1268=['length','chatInteraction:','./chatInteraction.events','remove'];(function(_0x3ae8f4,_0x5d1025){var _0x207506=function(_0x5efbc5){while(--_0x5efbc5){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x207506(++_0x5d1025);}(_0x1268,0x1b6));var _0x8126=function(_0xe37b3f,_0xee7d81){_0xe37b3f=_0xe37b3f-0x0;var _0x5efbfd=_0x1268[_0xe37b3f];return _0x5efbfd;};'use strict';var ChatInteractionEvents=require(_0x8126('0x0'));var events=['save',_0x8126('0x1'),'update'];function createListener(_0x43b7a3,_0x251e59){return function(_0x118791){_0x251e59['emit'](_0x43b7a3,_0x118791);};}function removeListener(_0x265f15,_0x41b460){return function(){ChatInteractionEvents['removeListener'](_0x265f15,_0x41b460);};}exports['register']=function(_0x3277bf){for(var _0x13024f=0x0,_0x5c7dcc=events[_0x8126('0x2')];_0x13024f<_0x5c7dcc;_0x13024f++){var _0x4c9875=events[_0x13024f];var _0x3233ec=createListener(_0x8126('0x3')+_0x4c9875,_0x3277bf);ChatInteractionEvents['on'](_0x4c9875,_0x3233ec);}}; \ No newline at end of file +var _0x5d95=['register','length','chatInteraction:','./chatInteraction.events','save','update','emit'];(function(_0x33c974,_0x3ce56d){var _0x12778b=function(_0x35ebc6){while(--_0x35ebc6){_0x33c974['push'](_0x33c974['shift']());}};_0x12778b(++_0x3ce56d);}(_0x5d95,0x161));var _0x55d9=function(_0x56702d,_0x14b2e9){_0x56702d=_0x56702d-0x0;var _0x107a02=_0x5d95[_0x56702d];return _0x107a02;};'use strict';var ChatInteractionEvents=require(_0x55d9('0x0'));var events=[_0x55d9('0x1'),'remove',_0x55d9('0x2')];function createListener(_0x2135ff,_0x29e725){return function(_0x266634){_0x29e725[_0x55d9('0x3')](_0x2135ff,_0x266634);};}function removeListener(_0x5b0d8b,_0x4e5305){return function(){ChatInteractionEvents['removeListener'](_0x5b0d8b,_0x4e5305);};}exports[_0x55d9('0x4')]=function(_0x3f057d){for(var _0x4c1b2f=0x0,_0x50d0db=events[_0x55d9('0x5')];_0x4c1b2f<_0x50d0db;_0x4c1b2f++){var _0x22af9a=events[_0x4c1b2f];var _0x5cd22d=createListener(_0x55d9('0x6')+_0x22af9a,_0x3f057d);ChatInteractionEvents['on'](_0x22af9a,_0x5cd22d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index bc99341..f3edae7 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 _0x9a02=['attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','chat','chatinteraction:addtags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download'];(function(_0x1bb317,_0x33833e){var _0x1d9fb3=function(_0x2e9d25){while(--_0x2e9d25){_0x1bb317['push'](_0x1bb317['shift']());}};_0x1d9fb3(++_0x33833e);}(_0x9a02,0xdc));var _0x29a0=function(_0x15f11e,_0x35caa3){_0x15f11e=_0x15f11e-0x0;var _0x5eb0e6=_0x9a02[_0x15f11e];return _0x5eb0e6;};'use strict';var multer=require(_0x29a0('0x0'));var util=require(_0x29a0('0x1'));var path=require(_0x29a0('0x2'));var timeout=require(_0x29a0('0x3'));var express=require(_0x29a0('0x4'));var router=express[_0x29a0('0x5')]();var fs_extra=require(_0x29a0('0x6'));var auth=require(_0x29a0('0x7'));var interaction=require(_0x29a0('0x8'));var config=require(_0x29a0('0x9'));var controller=require(_0x29a0('0xa'));router[_0x29a0('0xb')]('/',auth[_0x29a0('0xc')](),controller[_0x29a0('0xd')]);router[_0x29a0('0xb')](_0x29a0('0xe'),auth['isAuthenticated'](),controller[_0x29a0('0xf')]);router[_0x29a0('0xb')](_0x29a0('0x10'),auth[_0x29a0('0x11')](),controller[_0x29a0('0x12')]);router[_0x29a0('0xb')](_0x29a0('0x13'),auth[_0x29a0('0x11')](),controller[_0x29a0('0x14')]);router[_0x29a0('0xb')](_0x29a0('0x15'),auth['isAuthenticated'](),controller[_0x29a0('0x16')]);router[_0x29a0('0xb')](_0x29a0('0x17'),auth[_0x29a0('0x11')](),controller[_0x29a0('0x18')]);router['get'](_0x29a0('0x19'),auth[_0x29a0('0xc')](),controller[_0x29a0('0x1a')]);router[_0x29a0('0x1b')]('/',auth[_0x29a0('0xc')](),controller['create']);router[_0x29a0('0x1b')](_0x29a0('0x1c'),auth[_0x29a0('0xc')](),controller[_0x29a0('0x1d')]);var upload=multer({'storage':multer[_0x29a0('0x1e')]({'destination':function(_0x4b51ee,_0x427e20,_0x3b6d23){_0x3b6d23(null,path[_0x29a0('0x1f')](config[_0x29a0('0x20')],'server/files/attachments/'));},'filename':function(_0x449ade,_0x2ccd93,_0x4d58d6){_0x4d58d6(null,util[_0x29a0('0x21')](_0x29a0('0x22'),Date[_0x29a0('0x23')](),_0x2ccd93[_0x29a0('0x24')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x29a0('0x1b')](_0x29a0('0x25'),upload[_0x29a0('0x26')](_0x29a0('0x27')),controller[_0x29a0('0x28')]);router[_0x29a0('0x1b')](_0x29a0('0x15'),auth['isChatInteractionAuthorized'](),controller[_0x29a0('0x29')]);router[_0x29a0('0x1b')]('/:id/tags',auth[_0x29a0('0xc')](),interaction['tracked'](_0x29a0('0x2a'),_0x29a0('0x2b')),controller['addTags']);router[_0x29a0('0x2c')](_0x29a0('0x10'),auth['isAuthenticated'](),interaction[_0x29a0('0x2d')](_0x29a0('0x2a'),_0x29a0('0x2e')),controller[_0x29a0('0x2f')]);router[_0x29a0('0x2c')](_0x29a0('0x30'),controller[_0x29a0('0x31')]);router['put'](_0x29a0('0x32'),auth[_0x29a0('0x11')](),controller[_0x29a0('0x33')]);router[_0x29a0('0x2c')](_0x29a0('0x34'),controller[_0x29a0('0x35')]);router[_0x29a0('0x36')](_0x29a0('0x10'),auth[_0x29a0('0xc')](),interaction['tracked']('chat',_0x29a0('0x37')),controller[_0x29a0('0x38')]);router[_0x29a0('0x36')](_0x29a0('0x39'),auth[_0x29a0('0xc')](),controller[_0x29a0('0x3a')]);module[_0x29a0('0x3b')]=router; \ No newline at end of file +var _0xd0a2=['chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','chatinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','format','originalname','single','file','attachmentUpload','addMessage','/:id/tags','chat'];(function(_0x1e6035,_0x5496f9){var _0x30cb59=function(_0x28a86d){while(--_0x28a86d){_0x1e6035['push'](_0x1e6035['shift']());}};_0x30cb59(++_0x5496f9);}(_0xd0a2,0x71));var _0x2d0a=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0xd0a2[_0x888385];return _0x22d5c2;};'use strict';var multer=require(_0x2d0a('0x0'));var util=require(_0x2d0a('0x1'));var path=require(_0x2d0a('0x2'));var timeout=require(_0x2d0a('0x3'));var express=require(_0x2d0a('0x4'));var router=express[_0x2d0a('0x5')]();var fs_extra=require(_0x2d0a('0x6'));var auth=require(_0x2d0a('0x7'));var interaction=require(_0x2d0a('0x8'));var config=require(_0x2d0a('0x9'));var controller=require(_0x2d0a('0xa'));router['get']('/',auth[_0x2d0a('0xb')](),controller['index']);router[_0x2d0a('0xc')](_0x2d0a('0xd'),auth['isAuthenticated'](),controller[_0x2d0a('0xe')]);router['get'](_0x2d0a('0xf'),auth[_0x2d0a('0x10')](),controller[_0x2d0a('0x11')]);router[_0x2d0a('0xc')]('/:id/attachment_download',auth[_0x2d0a('0x10')](),controller['attachmentDownload']);router[_0x2d0a('0xc')](_0x2d0a('0x12'),auth[_0x2d0a('0xb')](),controller['getMessages']);router[_0x2d0a('0xc')](_0x2d0a('0x13'),auth[_0x2d0a('0x10')](),controller[_0x2d0a('0x14')]);router['get'](_0x2d0a('0x15'),auth[_0x2d0a('0xb')](),controller[_0x2d0a('0x16')]);router[_0x2d0a('0x17')]('/',auth['isAuthenticated'](),controller[_0x2d0a('0x18')]);router[_0x2d0a('0x17')](_0x2d0a('0x19'),auth[_0x2d0a('0xb')](),controller[_0x2d0a('0x1a')]);var upload=multer({'storage':multer[_0x2d0a('0x1b')]({'destination':function(_0x52b8fb,_0x5de826,_0x44087a){_0x44087a(null,path[_0x2d0a('0x1c')](config['root'],'server/files/attachments/'));},'filename':function(_0x602f15,_0x26e923,_0x3a476a){_0x3a476a(null,util[_0x2d0a('0x1d')]('%s-%s',Date['now'](),_0x26e923[_0x2d0a('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2d0a('0x17')]('/:id/attachment_upload',upload[_0x2d0a('0x1f')](_0x2d0a('0x20')),controller[_0x2d0a('0x21')]);router[_0x2d0a('0x17')]('/:id/messages',auth[_0x2d0a('0x10')](),controller[_0x2d0a('0x22')]);router[_0x2d0a('0x17')](_0x2d0a('0x23'),auth[_0x2d0a('0xb')](),interaction['tracked'](_0x2d0a('0x24'),_0x2d0a('0x25')),controller[_0x2d0a('0x26')]);router[_0x2d0a('0x27')](_0x2d0a('0xf'),auth['isAuthenticated'](),interaction[_0x2d0a('0x28')](_0x2d0a('0x24'),_0x2d0a('0x29')),controller['update']);router[_0x2d0a('0x27')](_0x2d0a('0x2a'),controller[_0x2d0a('0x2b')]);router[_0x2d0a('0x27')](_0x2d0a('0x2c'),auth[_0x2d0a('0x10')](),controller['abandon']);router['put'](_0x2d0a('0x2d'),controller['close']);router['delete'](_0x2d0a('0xf'),auth[_0x2d0a('0xb')](),interaction[_0x2d0a('0x28')](_0x2d0a('0x24'),_0x2d0a('0x2e')),controller['destroy']);router[_0x2d0a('0x2f')](_0x2d0a('0x23'),auth[_0x2d0a('0xb')](),controller[_0x2d0a('0x30')]);module[_0x2d0a('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 88f7cf1..7345cf1 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 _0x50a3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x50a3,0x186));var _0x350a=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x50a3[_0x4017b0];return _0x5ed4f7;};'use strict';var Sequelize=require(_0x350a('0x0'));module[_0x350a('0x1')]={'body':{'type':Sequelize[_0x350a('0x2')](_0x350a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x350a('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x350a('0x5')]}}; \ No newline at end of file +var _0x8dbe=['medium','sequelize','exports','TEXT'];(function(_0x311df2,_0x5b6291){var _0x2d70d7=function(_0x11d81b){while(--_0x11d81b){_0x311df2['push'](_0x311df2['shift']());}};_0x2d70d7(++_0x5b6291);}(_0x8dbe,0xb1));var _0xe8db=function(_0x58c8b6,_0x547708){_0x58c8b6=_0x58c8b6-0x0;var _0x2b05cf=_0x8dbe[_0x58c8b6];return _0x2b05cf;};'use strict';var Sequelize=require(_0xe8db('0x0'));module[_0xe8db('0x1')]={'body':{'type':Sequelize[_0xe8db('0x2')](_0xe8db('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 10164d2..3b99ab1 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 _0x7e6f=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','type','filter','merge','includeAll','findAll','catch','show','params','include','options','find','create','update','body','get','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x17a3ad,_0x451db7){var _0x530be1=function(_0x687c48){while(--_0x687c48){_0x17a3ad['push'](_0x17a3ad['shift']());}};_0x530be1(++_0x451db7);}(_0x7e6f,0x6c));var _0xf7e6=function(_0x26082d,_0x2a3c96){_0x26082d=_0x26082d-0x0;var _0x8de8e2=_0x7e6f[_0x26082d];return _0x8de8e2;};'use strict';var emlformat=require(_0xf7e6('0x0'));var rimraf=require(_0xf7e6('0x1'));var zipdir=require(_0xf7e6('0x2'));var jsonpatch=require(_0xf7e6('0x3'));var rp=require(_0xf7e6('0x4'));var moment=require(_0xf7e6('0x5'));var BPromise=require(_0xf7e6('0x6'));var Mustache=require(_0xf7e6('0x7'));var util=require(_0xf7e6('0x8'));var path=require(_0xf7e6('0x9'));var sox=require(_0xf7e6('0xa'));var csv=require(_0xf7e6('0xb'));var ejs=require(_0xf7e6('0xc'));var fs=require('fs');var fs_extra=require(_0xf7e6('0xd'));var _=require(_0xf7e6('0xe'));var squel=require(_0xf7e6('0xf'));var crypto=require(_0xf7e6('0x10'));var jsforce=require(_0xf7e6('0x11'));var deskjs=require(_0xf7e6('0x12'));var toCsv=require('to-csv');var querystring=require(_0xf7e6('0x13'));var Papa=require('papaparse');var Redis=require(_0xf7e6('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf7e6('0x15'));var as=require(_0xf7e6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7e6('0x17'))('api');var utils=require(_0xf7e6('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf7e6('0x19'))['db'];config['redis']=_['defaults'](config[_0xf7e6('0x1a')],{'host':_0xf7e6('0x1b'),'port':0x18eb});var socket=require(_0xf7e6('0x1c'))(new Redis(config['redis']));require(_0xf7e6('0x1d'))['register'](socket);function respondWithStatusCode(_0x544792,_0x3f17aa){_0x3f17aa=_0x3f17aa||0xcc;return function(_0x36978f){if(_0x36978f){return _0x544792[_0xf7e6('0x1e')](_0x3f17aa);}return _0x544792[_0xf7e6('0x1f')](_0x3f17aa)[_0xf7e6('0x20')]();};}function respondWithResult(_0x3acf3a,_0x36cf88){_0x36cf88=_0x36cf88||0xc8;return function(_0x3d97db){if(_0x3d97db){return _0x3acf3a[_0xf7e6('0x1f')](_0x36cf88)[_0xf7e6('0x21')](_0x3d97db);}};}function respondWithFilteredResult(_0x17ac98,_0x56950f){return function(_0x28beed){if(_0x28beed){var _0x1ba2ae=typeof _0x56950f['offset']==='undefined'&&typeof _0x56950f['limit']===_0xf7e6('0x22');var _0x5a4e4c=_0x28beed['count'];var _0x28f0f0=_0x1ba2ae?0x0:_0x56950f[_0xf7e6('0x23')];var _0x10f809=_0x1ba2ae?_0x28beed[_0xf7e6('0x24')]:_0x56950f[_0xf7e6('0x23')]+_0x56950f[_0xf7e6('0x25')];var _0x27870b;if(_0x10f809>=_0x5a4e4c){_0x10f809=_0x5a4e4c;_0x27870b=0xc8;}else{_0x27870b=0xce;}_0x17ac98[_0xf7e6('0x1f')](_0x27870b);return _0x17ac98[_0xf7e6('0x26')](_0xf7e6('0x27'),_0x28f0f0+'-'+_0x10f809+'/'+_0x5a4e4c)[_0xf7e6('0x21')](_0x28beed);}return null;};}function patchUpdates(_0x544d0d){return function(_0x588c29){try{jsonpatch['apply'](_0x588c29,_0x544d0d,!![]);}catch(_0x4700be){return BPromise[_0xf7e6('0x28')](_0x4700be);}return _0x588c29[_0xf7e6('0x29')]();};}function saveUpdates(_0x460180,_0x5a450e){return function(_0x219b32){if(_0x219b32){return _0x219b32['update'](_0x460180)['then'](function(_0x2a21d1){return _0x2a21d1;});}return null;};}function removeEntity(_0x4cd11f,_0x494797){return function(_0x24436b){if(_0x24436b){return _0x24436b[_0xf7e6('0x2a')]()[_0xf7e6('0x2b')](function(){_0x4cd11f[_0xf7e6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461cdc,_0x1a2be0){return function(_0x64973c){if(!_0x64973c){_0x461cdc[_0xf7e6('0x1e')](0x194);}return _0x64973c;};}function handleError(_0x46218a,_0xf3afaa){_0xf3afaa=_0xf3afaa||0x1f4;return function(_0x160407){logger[_0xf7e6('0x2c')](_0x160407[_0xf7e6('0x2d')]);if(_0x160407[_0xf7e6('0x2e')]){delete _0x160407[_0xf7e6('0x2e')];}_0x46218a['status'](_0xf3afaa)[_0xf7e6('0x2f')](_0x160407);};}exports[_0xf7e6('0x30')]=function(_0x39c9a2,_0x59a268){var _0x2d3227={},_0x42baa6={},_0x3a5436={'count':0x0,'rows':[]};var _0x214600=_[_0xf7e6('0x31')](db[_0xf7e6('0x32')][_0xf7e6('0x33')],function(_0x57e073){return{'name':_0x57e073[_0xf7e6('0x34')],'type':_0x57e073['type'][_0xf7e6('0x35')]};});_0x42baa6[_0xf7e6('0x36')]=_[_0xf7e6('0x31')](_0x214600,_0xf7e6('0x2e'));_0x42baa6[_0xf7e6('0x37')]=_['keys'](_0x39c9a2['query']);_0x42baa6['filters']=_['intersection'](_0x42baa6[_0xf7e6('0x36')],_0x42baa6[_0xf7e6('0x37')]);_0x2d3227['attributes']=_[_0xf7e6('0x38')](_0x42baa6[_0xf7e6('0x36')],qs[_0xf7e6('0x39')](_0x39c9a2[_0xf7e6('0x37')]['fields']));_0x2d3227[_0xf7e6('0x3a')]=_0x2d3227[_0xf7e6('0x3a')][_0xf7e6('0x3b')]?_0x2d3227[_0xf7e6('0x3a')]:_0x42baa6[_0xf7e6('0x36')];if(!_0x39c9a2['query'][_0xf7e6('0x3c')]('nolimit')){_0x2d3227['limit']=qs[_0xf7e6('0x25')](_0x39c9a2[_0xf7e6('0x37')][_0xf7e6('0x25')]);_0x2d3227[_0xf7e6('0x23')]=qs[_0xf7e6('0x23')](_0x39c9a2['query'][_0xf7e6('0x23')]);}_0x2d3227['order']=qs[_0xf7e6('0x3d')](_0x39c9a2[_0xf7e6('0x37')]['sort']);_0x2d3227[_0xf7e6('0x3e')]=qs[_0xf7e6('0x3f')](_[_0xf7e6('0x40')](_0x39c9a2[_0xf7e6('0x37')],_0x42baa6['filters']),_0x214600);if(_0x39c9a2[_0xf7e6('0x37')]['filter']){_0x2d3227['where']=_['merge'](_0x2d3227[_0xf7e6('0x3e')],{'$or':_[_0xf7e6('0x31')](_0x214600,function(_0x18fea9){if(_0x18fea9[_0xf7e6('0x41')]!=='VIRTUAL'){var _0x5b42e6={};_0x5b42e6[_0x18fea9[_0xf7e6('0x2e')]]={'$like':'%'+_0x39c9a2[_0xf7e6('0x37')][_0xf7e6('0x42')]+'%'};return _0x5b42e6;}})});}_0x2d3227=_[_0xf7e6('0x43')]({},_0x2d3227,_0x39c9a2['options']);var _0x3a858a={'where':_0x2d3227[_0xf7e6('0x3e')]};return db[_0xf7e6('0x32')][_0xf7e6('0x24')](_0x3a858a)[_0xf7e6('0x2b')](function(_0x1e7a66){_0x3a5436[_0xf7e6('0x24')]=_0x1e7a66;if(_0x39c9a2[_0xf7e6('0x37')][_0xf7e6('0x44')]){_0x2d3227['include']=[{'all':!![]}];}return db[_0xf7e6('0x32')][_0xf7e6('0x45')](_0x2d3227);})['then'](function(_0x4fa862){_0x3a5436['rows']=_0x4fa862;return _0x3a5436;})[_0xf7e6('0x2b')](respondWithFilteredResult(_0x59a268,_0x2d3227))[_0xf7e6('0x46')](handleError(_0x59a268,null));};exports[_0xf7e6('0x47')]=function(_0x2527e6,_0x161b46){var _0x1f4a4d={'raw':!![],'where':{'id':_0x2527e6[_0xf7e6('0x48')]['id']}},_0x47da12={};_0x47da12[_0xf7e6('0x36')]=_['keys'](db[_0xf7e6('0x32')][_0xf7e6('0x33')]);_0x47da12[_0xf7e6('0x37')]=_['keys'](_0x2527e6['query']);_0x47da12[_0xf7e6('0x3f')]=_[_0xf7e6('0x38')](_0x47da12['model'],_0x47da12['query']);_0x1f4a4d[_0xf7e6('0x3a')]=_['intersection'](_0x47da12[_0xf7e6('0x36')],qs[_0xf7e6('0x39')](_0x2527e6[_0xf7e6('0x37')][_0xf7e6('0x39')]));_0x1f4a4d[_0xf7e6('0x3a')]=_0x1f4a4d[_0xf7e6('0x3a')][_0xf7e6('0x3b')]?_0x1f4a4d[_0xf7e6('0x3a')]:_0x47da12[_0xf7e6('0x36')];if(_0x2527e6[_0xf7e6('0x37')][_0xf7e6('0x44')]){_0x1f4a4d[_0xf7e6('0x49')]=[{'all':!![]}];}_0x1f4a4d=_[_0xf7e6('0x43')]({},_0x1f4a4d,_0x2527e6[_0xf7e6('0x4a')]);return db[_0xf7e6('0x32')][_0xf7e6('0x4b')](_0x1f4a4d)[_0xf7e6('0x2b')](handleEntityNotFound(_0x161b46,null))[_0xf7e6('0x2b')](respondWithResult(_0x161b46,null))['catch'](handleError(_0x161b46,null));};exports[_0xf7e6('0x4c')]=function(_0x37bcb5,_0xa650a6){return db['ChatInternalMessage']['create'](_0x37bcb5['body'],{})[_0xf7e6('0x2b')](respondWithResult(_0xa650a6,0xc9))[_0xf7e6('0x46')](handleError(_0xa650a6,null));};exports[_0xf7e6('0x4d')]=function(_0x48b08e,_0x1dde50){if(_0x48b08e[_0xf7e6('0x4e')]['id']){delete _0x48b08e[_0xf7e6('0x4e')]['id'];}return db[_0xf7e6('0x32')][_0xf7e6('0x4b')]({'where':{'id':_0x48b08e[_0xf7e6('0x48')]['id']}})[_0xf7e6('0x2b')](handleEntityNotFound(_0x1dde50,null))[_0xf7e6('0x2b')](saveUpdates(_0x48b08e['body'],null))['then'](respondWithResult(_0x1dde50,null))['catch'](handleError(_0x1dde50,null));};exports[_0xf7e6('0x2a')]=function(_0x2a0cdf,_0x596dfd){return db[_0xf7e6('0x32')][_0xf7e6('0x4b')]({'where':{'id':_0x2a0cdf['params']['id']}})['then'](handleEntityNotFound(_0x596dfd,null))['then'](removeEntity(_0x596dfd,null))[_0xf7e6('0x46')](handleError(_0x596dfd,null));};exports['describe']=function(_0x550054,_0x5143ca){return db[_0xf7e6('0x32')]['describe']()[_0xf7e6('0x2b')](respondWithResult(_0x5143ca,null))[_0xf7e6('0x46')](handleError(_0x5143ca,null));};function wrapUser(_0x43c5e3){return function(_0x27ffd4){var _0x14e5d8=_0x43c5e3[_0xf7e6('0x4f')]({'plain':!![]});_0x14e5d8['messages']=[];if(_0x27ffd4){_0x14e5d8['lastMessageAt']=_0x27ffd4[_0xf7e6('0x50')];_0x14e5d8['lastMessage']=_0x27ffd4;}else{_0x14e5d8[_0xf7e6('0x51')]=moment(0x0)[_0xf7e6('0x52')](_0xf7e6('0x53'));_0x14e5d8[_0xf7e6('0x54')]={};}return _0x14e5d8;};}exports[_0xf7e6('0x55')]=function(_0x9b9fa5,_0x3500ed,_0x2e6692){var _0x142fee=[];return db[_0xf7e6('0x56')][_0xf7e6('0x45')]({'where':{'role':[_0xf7e6('0x57'),_0xf7e6('0x58'),_0xf7e6('0x59')]},'attributes':['id',_0xf7e6('0x5a'),_0xf7e6('0x2e'),_0xf7e6('0x5b'),_0xf7e6('0x5c'),'internal',_0xf7e6('0x5d'),_0xf7e6('0x5e'),'allowmessenger',_0xf7e6('0x5f')],'order':qs[_0xf7e6('0x3d')]('-online'),'include':[{'model':db[_0xf7e6('0x60')],'as':_0xf7e6('0x61'),'attributes':['id',_0xf7e6('0x2e'),_0xf7e6('0x41')],'through':{'attributes':[]}}]})[_0xf7e6('0x2b')](function(_0x4c3f50){if(_0x4c3f50){var _0x393885=_0x9b9fa5['user'][_0xf7e6('0x4f')]({'plain':!![]});if(!_0x393885)throw new Error(_0xf7e6('0x62'));if(_0x393885['role']===_0xf7e6('0x59')){return db['UserProfileSection'][_0xf7e6('0x4b')]({'where':{'name':_0xf7e6('0x63'),'userProfileId':_0x393885[_0xf7e6('0x64')]},'raw':!![]})[_0xf7e6('0x2b')](function(_0x43f324){if(_0x43f324){if(_0x43f324[_0xf7e6('0x65')]===0x0){return db[_0xf7e6('0x66')][_0xf7e6('0x45')]({'where':{'sectionId':_0x43f324['id']},'raw':!![]})[_0xf7e6('0x2b')](function(_0x13e95f){var _0x2adef4=[];if(_[_0xf7e6('0x67')](_0x13e95f)){_0x2adef4=_['filter'](_0x4c3f50,function(_0x1b0a22){if(_0x1b0a22[_0xf7e6('0x5b')]!==_0xf7e6('0x57')){return _0x1b0a22;}});return _0x2adef4;}else{for(var _0x47132c=0x0;_0x47132c<_0x4c3f50[_0xf7e6('0x3b')];_0x47132c++){var _0x55346a=_0x4c3f50[_0x47132c];if(_0x55346a['role']===_0xf7e6('0x57')){var _0x573658=_[_0xf7e6('0x4b')](_0x13e95f,function(_0x39f5a8){return _0x39f5a8[_0xf7e6('0x68')]===_0x55346a['id'];});if(_0x573658)_0x2adef4[_0xf7e6('0x69')](_0x55346a);}else{_0x2adef4['push'](_0x55346a);}}return _0x2adef4;}});}else{return _0x4c3f50;}}else{var _0x7b8e4a=_[_0xf7e6('0x42')](_0x4c3f50,function(_0x218bc2){if(_0x218bc2[_0xf7e6('0x5b')]!==_0xf7e6('0x57')){return _0x218bc2;}});return _0x7b8e4a;}});}else{return _0x4c3f50;}}})['then'](function(_0xe3bb45){var _0x45cc54=[];if(_0xe3bb45){_0x142fee=_0xe3bb45;for(var _0x4abc46=0x0;_0x4abc46<_0xe3bb45['length'];_0x4abc46+=0x1){_0x142fee[_0x4abc46][_0xf7e6('0x6a')]=[];_0x45cc54[_0xf7e6('0x69')](db[_0xf7e6('0x32')]['find']({'where':{'FromId':[_0x9b9fa5[_0xf7e6('0x59')]['id'],_0xe3bb45[_0x4abc46]['id']],'ToId':[_0x9b9fa5[_0xf7e6('0x59')]['id'],_0xe3bb45[_0x4abc46]['id']],'ChatGroupId':null},'attributes':['id',_0xf7e6('0x50'),_0xf7e6('0x6b'),_0xf7e6('0x6c'),_0xf7e6('0x6d'),_0xf7e6('0x4e')],'order':qs[_0xf7e6('0x3d')](_0xf7e6('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xe3bb45[_0x4abc46])));}return BPromise[_0xf7e6('0x6f')](_0x45cc54);}return[];})['then'](function(_0x4be536){return{'rows':_0x4be536,'count':_0x4be536[_0xf7e6('0x3b')]};})[_0xf7e6('0x2b')](respondWithResult(_0x3500ed,null))['catch'](handleError(_0x3500ed,null));}; \ No newline at end of file +var _0x82a7=['undefined','count','set','Content-Range','apply','reject','then','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatInternalMessage','includeAll','findAll','rows','catch','show','params','include','find','create','update','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','read','all','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','limit'];(function(_0x369faa,_0x1d9fae){var _0x2f4a5e=function(_0x33efbb){while(--_0x33efbb){_0x369faa['push'](_0x369faa['shift']());}};_0x2f4a5e(++_0x1d9fae);}(_0x82a7,0x131));var _0x782a=function(_0x172457,_0x4c489a){_0x172457=_0x172457-0x0;var _0x381e24=_0x82a7[_0x172457];return _0x381e24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x782a('0x0'));var zipdir=require(_0x782a('0x1'));var jsonpatch=require(_0x782a('0x2'));var rp=require('request-promise');var moment=require(_0x782a('0x3'));var BPromise=require(_0x782a('0x4'));var Mustache=require(_0x782a('0x5'));var util=require(_0x782a('0x6'));var path=require(_0x782a('0x7'));var sox=require('sox');var csv=require(_0x782a('0x8'));var ejs=require(_0x782a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x782a('0xa'));var squel=require(_0x782a('0xb'));var crypto=require(_0x782a('0xc'));var jsforce=require(_0x782a('0xd'));var deskjs=require(_0x782a('0xe'));var toCsv=require(_0x782a('0x8'));var querystring=require(_0x782a('0xf'));var Papa=require(_0x782a('0x10'));var Redis=require(_0x782a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x782a('0x12'));var as=require(_0x782a('0x13'));var hardwareService=require(_0x782a('0x14'));var logger=require(_0x782a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x782a('0x16'));var licenseUtil=require(_0x782a('0x17'));var db=require(_0x782a('0x18'))['db'];config[_0x782a('0x19')]=_['defaults'](config[_0x782a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x782a('0x1a'))(new Redis(config[_0x782a('0x19')]));require('./chatInternalMessage.socket')[_0x782a('0x1b')](socket);function respondWithStatusCode(_0x3f8ff5,_0x4ff3a4){_0x4ff3a4=_0x4ff3a4||0xcc;return function(_0x3a125e){if(_0x3a125e){return _0x3f8ff5[_0x782a('0x1c')](_0x4ff3a4);}return _0x3f8ff5[_0x782a('0x1d')](_0x4ff3a4)[_0x782a('0x1e')]();};}function respondWithResult(_0x5ab537,_0x1254b6){_0x1254b6=_0x1254b6||0xc8;return function(_0x250c8f){if(_0x250c8f){return _0x5ab537[_0x782a('0x1d')](_0x1254b6)[_0x782a('0x1f')](_0x250c8f);}};}function respondWithFilteredResult(_0x2289f8,_0x143a66){return function(_0x1b8ca8){if(_0x1b8ca8){var _0x22e2ad=typeof _0x143a66[_0x782a('0x20')]==='undefined'&&typeof _0x143a66[_0x782a('0x21')]===_0x782a('0x22');var _0x2f0232=_0x1b8ca8['count'];var _0x18b4e1=_0x22e2ad?0x0:_0x143a66[_0x782a('0x20')];var _0x4ded3e=_0x22e2ad?_0x1b8ca8[_0x782a('0x23')]:_0x143a66[_0x782a('0x20')]+_0x143a66[_0x782a('0x21')];var _0x4d3739;if(_0x4ded3e>=_0x2f0232){_0x4ded3e=_0x2f0232;_0x4d3739=0xc8;}else{_0x4d3739=0xce;}_0x2289f8[_0x782a('0x1d')](_0x4d3739);return _0x2289f8[_0x782a('0x24')](_0x782a('0x25'),_0x18b4e1+'-'+_0x4ded3e+'/'+_0x2f0232)['json'](_0x1b8ca8);}return null;};}function patchUpdates(_0x5c18f9){return function(_0x4ff6e6){try{jsonpatch[_0x782a('0x26')](_0x4ff6e6,_0x5c18f9,!![]);}catch(_0x50e108){return BPromise[_0x782a('0x27')](_0x50e108);}return _0x4ff6e6['save']();};}function saveUpdates(_0x226259,_0x55eed9){return function(_0x36b362){if(_0x36b362){return _0x36b362['update'](_0x226259)[_0x782a('0x28')](function(_0xd1ef28){return _0xd1ef28;});}return null;};}function removeEntity(_0x2722f2,_0x41b067){return function(_0x3fd78d){if(_0x3fd78d){return _0x3fd78d[_0x782a('0x29')]()[_0x782a('0x28')](function(){_0x2722f2['status'](0xcc)[_0x782a('0x1e')]();});}};}function handleEntityNotFound(_0x256f43,_0x43fc36){return function(_0x579cf0){if(!_0x579cf0){_0x256f43[_0x782a('0x1c')](0x194);}return _0x579cf0;};}function handleError(_0x1e68a0,_0x106929){_0x106929=_0x106929||0x1f4;return function(_0x277f41){logger['error'](_0x277f41[_0x782a('0x2a')]);if(_0x277f41['name']){delete _0x277f41['name'];}_0x1e68a0['status'](_0x106929)[_0x782a('0x2b')](_0x277f41);};}exports[_0x782a('0x2c')]=function(_0x31ea72,_0x2f8a01){var _0x314263={},_0x37bfe2={},_0x3844c4={'count':0x0,'rows':[]};var _0x151006=_[_0x782a('0x2d')](db['ChatInternalMessage'][_0x782a('0x2e')],function(_0x191c7f){return{'name':_0x191c7f[_0x782a('0x2f')],'type':_0x191c7f[_0x782a('0x30')][_0x782a('0x31')]};});_0x37bfe2[_0x782a('0x32')]=_[_0x782a('0x2d')](_0x151006,_0x782a('0x33'));_0x37bfe2[_0x782a('0x34')]=_[_0x782a('0x35')](_0x31ea72[_0x782a('0x34')]);_0x37bfe2[_0x782a('0x36')]=_[_0x782a('0x37')](_0x37bfe2[_0x782a('0x32')],_0x37bfe2[_0x782a('0x34')]);_0x314263[_0x782a('0x38')]=_[_0x782a('0x37')](_0x37bfe2['model'],qs['fields'](_0x31ea72['query'][_0x782a('0x39')]));_0x314263['attributes']=_0x314263[_0x782a('0x38')][_0x782a('0x3a')]?_0x314263[_0x782a('0x38')]:_0x37bfe2['model'];if(!_0x31ea72[_0x782a('0x34')][_0x782a('0x3b')](_0x782a('0x3c'))){_0x314263[_0x782a('0x21')]=qs[_0x782a('0x21')](_0x31ea72[_0x782a('0x34')][_0x782a('0x21')]);_0x314263[_0x782a('0x20')]=qs[_0x782a('0x20')](_0x31ea72['query'][_0x782a('0x20')]);}_0x314263[_0x782a('0x3d')]=qs[_0x782a('0x3e')](_0x31ea72[_0x782a('0x34')][_0x782a('0x3e')]);_0x314263[_0x782a('0x3f')]=qs['filters'](_[_0x782a('0x40')](_0x31ea72[_0x782a('0x34')],_0x37bfe2[_0x782a('0x36')]),_0x151006);if(_0x31ea72[_0x782a('0x34')][_0x782a('0x41')]){_0x314263[_0x782a('0x3f')]=_[_0x782a('0x42')](_0x314263[_0x782a('0x3f')],{'$or':_['map'](_0x151006,function(_0x3ac4b1){if(_0x3ac4b1[_0x782a('0x30')]!=='VIRTUAL'){var _0x28b98c={};_0x28b98c[_0x3ac4b1[_0x782a('0x33')]]={'$like':'%'+_0x31ea72[_0x782a('0x34')][_0x782a('0x41')]+'%'};return _0x28b98c;}})});}_0x314263=_[_0x782a('0x42')]({},_0x314263,_0x31ea72[_0x782a('0x43')]);var _0x5245dd={'where':_0x314263[_0x782a('0x3f')]};return db[_0x782a('0x44')][_0x782a('0x23')](_0x5245dd)[_0x782a('0x28')](function(_0x35cde5){_0x3844c4[_0x782a('0x23')]=_0x35cde5;if(_0x31ea72[_0x782a('0x34')][_0x782a('0x45')]){_0x314263['include']=[{'all':!![]}];}return db[_0x782a('0x44')][_0x782a('0x46')](_0x314263);})[_0x782a('0x28')](function(_0x25e359){_0x3844c4[_0x782a('0x47')]=_0x25e359;return _0x3844c4;})['then'](respondWithFilteredResult(_0x2f8a01,_0x314263))[_0x782a('0x48')](handleError(_0x2f8a01,null));};exports[_0x782a('0x49')]=function(_0x11ce6a,_0x3133bc){var _0x3b4a85={'raw':!![],'where':{'id':_0x11ce6a[_0x782a('0x4a')]['id']}},_0x279303={};_0x279303[_0x782a('0x32')]=_[_0x782a('0x35')](db['ChatInternalMessage'][_0x782a('0x2e')]);_0x279303[_0x782a('0x34')]=_[_0x782a('0x35')](_0x11ce6a[_0x782a('0x34')]);_0x279303[_0x782a('0x36')]=_['intersection'](_0x279303['model'],_0x279303['query']);_0x3b4a85[_0x782a('0x38')]=_[_0x782a('0x37')](_0x279303[_0x782a('0x32')],qs['fields'](_0x11ce6a['query'][_0x782a('0x39')]));_0x3b4a85[_0x782a('0x38')]=_0x3b4a85[_0x782a('0x38')][_0x782a('0x3a')]?_0x3b4a85['attributes']:_0x279303[_0x782a('0x32')];if(_0x11ce6a[_0x782a('0x34')][_0x782a('0x45')]){_0x3b4a85[_0x782a('0x4b')]=[{'all':!![]}];}_0x3b4a85=_[_0x782a('0x42')]({},_0x3b4a85,_0x11ce6a['options']);return db['ChatInternalMessage'][_0x782a('0x4c')](_0x3b4a85)[_0x782a('0x28')](handleEntityNotFound(_0x3133bc,null))[_0x782a('0x28')](respondWithResult(_0x3133bc,null))['catch'](handleError(_0x3133bc,null));};exports['create']=function(_0x52c6b6,_0x47221f){return db['ChatInternalMessage'][_0x782a('0x4d')](_0x52c6b6['body'],{})[_0x782a('0x28')](respondWithResult(_0x47221f,0xc9))[_0x782a('0x48')](handleError(_0x47221f,null));};exports[_0x782a('0x4e')]=function(_0x3134b9,_0x470cff){if(_0x3134b9['body']['id']){delete _0x3134b9[_0x782a('0x4f')]['id'];}return db[_0x782a('0x44')][_0x782a('0x4c')]({'where':{'id':_0x3134b9[_0x782a('0x4a')]['id']}})[_0x782a('0x28')](handleEntityNotFound(_0x470cff,null))['then'](saveUpdates(_0x3134b9[_0x782a('0x4f')],null))[_0x782a('0x28')](respondWithResult(_0x470cff,null))['catch'](handleError(_0x470cff,null));};exports[_0x782a('0x29')]=function(_0x1c534d,_0x4b1334){return db[_0x782a('0x44')][_0x782a('0x4c')]({'where':{'id':_0x1c534d['params']['id']}})[_0x782a('0x28')](handleEntityNotFound(_0x4b1334,null))[_0x782a('0x28')](removeEntity(_0x4b1334,null))[_0x782a('0x48')](handleError(_0x4b1334,null));};exports['describe']=function(_0x328321,_0x1463ad){return db[_0x782a('0x44')][_0x782a('0x50')]()['then'](respondWithResult(_0x1463ad,null))[_0x782a('0x48')](handleError(_0x1463ad,null));};function wrapUser(_0x1f4a13){return function(_0x17c12){var _0x384ea5=_0x1f4a13[_0x782a('0x51')]({'plain':!![]});_0x384ea5[_0x782a('0x52')]=[];if(_0x17c12){_0x384ea5[_0x782a('0x53')]=_0x17c12[_0x782a('0x54')];_0x384ea5[_0x782a('0x55')]=_0x17c12;}else{_0x384ea5[_0x782a('0x53')]=moment(0x0)[_0x782a('0x56')](_0x782a('0x57'));_0x384ea5[_0x782a('0x55')]={};}return _0x384ea5;};}exports['getUsers']=function(_0x19b061,_0x1254bb,_0x607cb7){var _0x3f4cb9=[];return db[_0x782a('0x58')]['findAll']({'where':{'role':[_0x782a('0x59'),'admin','user']},'attributes':['id',_0x782a('0x5a'),'name',_0x782a('0x5b'),_0x782a('0x5c'),_0x782a('0x5d'),_0x782a('0x5e'),_0x782a('0x5f'),_0x782a('0x60'),_0x782a('0x61')],'order':qs['sort'](_0x782a('0x62')),'include':[{'model':db[_0x782a('0x63')],'as':_0x782a('0x64'),'attributes':['id',_0x782a('0x33'),'type'],'through':{'attributes':[]}}]})[_0x782a('0x28')](function(_0x52c672){if(_0x52c672){var _0x498514=_0x19b061[_0x782a('0x65')][_0x782a('0x51')]({'plain':!![]});if(!_0x498514)throw new Error(_0x782a('0x66'));if(_0x498514[_0x782a('0x5b')]==='user'){return db[_0x782a('0x67')][_0x782a('0x4c')]({'where':{'name':'Agents','userProfileId':_0x498514[_0x782a('0x68')]},'raw':!![]})[_0x782a('0x28')](function(_0x4f52e4){if(_0x4f52e4){if(_0x4f52e4[_0x782a('0x69')]===0x0){return db[_0x782a('0x6a')][_0x782a('0x46')]({'where':{'sectionId':_0x4f52e4['id']},'raw':!![]})[_0x782a('0x28')](function(_0x1e7baf){var _0x559635=[];if(_[_0x782a('0x6b')](_0x1e7baf)){_0x559635=_[_0x782a('0x41')](_0x52c672,function(_0x5d33fb){if(_0x5d33fb[_0x782a('0x5b')]!==_0x782a('0x59')){return _0x5d33fb;}});return _0x559635;}else{for(var _0x20e4bd=0x0;_0x20e4bd<_0x52c672[_0x782a('0x3a')];_0x20e4bd++){var _0x134d8d=_0x52c672[_0x20e4bd];if(_0x134d8d[_0x782a('0x5b')]==='agent'){var _0x2e8039=_[_0x782a('0x4c')](_0x1e7baf,function(_0x413fe1){return _0x413fe1['resourceId']===_0x134d8d['id'];});if(_0x2e8039)_0x559635[_0x782a('0x6c')](_0x134d8d);}else{_0x559635['push'](_0x134d8d);}}return _0x559635;}});}else{return _0x52c672;}}else{var _0x1c80d2=_[_0x782a('0x41')](_0x52c672,function(_0x2be889){if(_0x2be889[_0x782a('0x5b')]!==_0x782a('0x59')){return _0x2be889;}});return _0x1c80d2;}});}else{return _0x52c672;}}})[_0x782a('0x28')](function(_0x5496c4){var _0x5edad3=[];if(_0x5496c4){_0x3f4cb9=_0x5496c4;for(var _0x14ef71=0x0;_0x14ef71<_0x5496c4[_0x782a('0x3a')];_0x14ef71+=0x1){_0x3f4cb9[_0x14ef71][_0x782a('0x52')]=[];_0x5edad3[_0x782a('0x6c')](db[_0x782a('0x44')][_0x782a('0x4c')]({'where':{'FromId':[_0x19b061[_0x782a('0x65')]['id'],_0x5496c4[_0x14ef71]['id']],'ToId':[_0x19b061[_0x782a('0x65')]['id'],_0x5496c4[_0x14ef71]['id']],'ChatGroupId':null},'attributes':['id',_0x782a('0x54'),_0x782a('0x6d'),_0x782a('0x6e'),_0x782a('0x6f'),_0x782a('0x4f')],'order':qs[_0x782a('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x782a('0x28')](wrapUser(_0x5496c4[_0x14ef71])));}return BPromise[_0x782a('0x70')](_0x5edad3);}return[];})[_0x782a('0x28')](function(_0x528ee8){return{'rows':_0x528ee8,'count':_0x528ee8[_0x782a('0x3a')]};})[_0x782a('0x28')](respondWithResult(_0x1254bb,null))[_0x782a('0x48')](handleError(_0x1254bb,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a3f5fb8..63946de 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 _0x24e4=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x5c6f37,_0x5251e2){var _0x489ad2=function(_0x3b2642){while(--_0x3b2642){_0x5c6f37['push'](_0x5c6f37['shift']());}};_0x489ad2(++_0x5251e2);}(_0x24e4,0x10e));var _0x424e=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x24e4[_0x9307ea];return _0x295554;};'use strict';var EventEmitter=require(_0x424e('0x0'));var ChatInternalMessage=require(_0x424e('0x1'))['db'][_0x424e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x424e('0x3')](0x0);var events={'afterCreate':_0x424e('0x4'),'afterUpdate':_0x424e('0x5'),'afterDestroy':_0x424e('0x6')};function emitEvent(_0x57592d){return function(_0x3e2598,_0x26a982,_0x27f284){ChatInternalMessageEvents[_0x424e('0x7')](_0x57592d+':'+_0x3e2598['id'],_0x3e2598);ChatInternalMessageEvents[_0x424e('0x7')](_0x57592d,_0x3e2598);_0x27f284(null);};}for(var e in events){if(events[_0x424e('0x8')](e)){var event=events[e];ChatInternalMessage[_0x424e('0x9')](e,emitEvent(event));}}module[_0x424e('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xc584=['ChatInternalMessage','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xb691c,_0x39ab28){var _0x134e84=function(_0x21d419){while(--_0x21d419){_0xb691c['push'](_0xb691c['shift']());}};_0x134e84(++_0x39ab28);}(_0xc584,0x1e7));var _0x4c58=function(_0x469ae2,_0x24cd30){_0x469ae2=_0x469ae2-0x0;var _0x5e33e4=_0xc584[_0x469ae2];return _0x5e33e4;};'use strict';var EventEmitter=require(_0x4c58('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x4c58('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4c58('0x2'),'afterUpdate':'update','afterDestroy':_0x4c58('0x3')};function emitEvent(_0x68c037){return function(_0x547ada,_0x2ec00a,_0x2ec4af){ChatInternalMessageEvents[_0x4c58('0x4')](_0x68c037+':'+_0x547ada['id'],_0x547ada);ChatInternalMessageEvents[_0x4c58('0x4')](_0x68c037,_0x547ada);_0x2ec4af(null);};}for(var e in events){if(events[_0x4c58('0x5')](e)){var event=events[e];ChatInternalMessage[_0x4c58('0x6')](e,emitEvent(event));}}module[_0x4c58('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 a6be00b..f1ea563 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 _0x6c89=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x6c89,0x180));var _0x96c8=function(_0x2df62a,_0x19b422){_0x2df62a=_0x2df62a-0x0;var _0x2f49c6=_0x6c89[_0x2df62a];return _0x2f49c6;};'use strict';var _=require(_0x96c8('0x0'));var util=require(_0x96c8('0x1'));var logger=require(_0x96c8('0x2'))(_0x96c8('0x3'));var moment=require(_0x96c8('0x4'));var BPromise=require(_0x96c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96c8('0x6'));var rimraf=require('rimraf');var config=require(_0x96c8('0x7'));var attributes=require(_0x96c8('0x8'));module[_0x96c8('0x9')]=function(_0x88b786,_0x12b24a){return _0x88b786[_0x96c8('0xa')](_0x96c8('0xb'),attributes,{'tableName':_0x96c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96c8('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5773=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','define','chat_internal_messages','utf8mb4'];(function(_0x4d995b,_0x3ab30c){var _0x2e7a07=function(_0x33fc28){while(--_0x33fc28){_0x4d995b['push'](_0x4d995b['shift']());}};_0x2e7a07(++_0x3ab30c);}(_0x5773,0x168));var _0x3577=function(_0x1787a5,_0x8b3d8f){_0x1787a5=_0x1787a5-0x0;var _0xfe1519=_0x5773[_0x1787a5];return _0xfe1519;};'use strict';var _=require(_0x3577('0x0'));var util=require(_0x3577('0x1'));var logger=require(_0x3577('0x2'))('api');var moment=require(_0x3577('0x3'));var BPromise=require('bluebird');var rp=require(_0x3577('0x4'));var fs=require('fs');var path=require(_0x3577('0x5'));var rimraf=require('rimraf');var config=require(_0x3577('0x6'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x46c495,_0x2d6fae){return _0x46c495[_0x3577('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x3577('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3577('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 7fd1b51..78c6b36 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 _0xb9e1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x5ec548,_0xf21387){var _0x4093fb=function(_0xa22522){while(--_0xa22522){_0x5ec548['push'](_0x5ec548['shift']());}};_0x4093fb(++_0xf21387);}(_0xb9e1,0xad));var _0x1b9e=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0xb9e1[_0x32c012];return _0x48562e;};'use strict';var _=require(_0x1b9e('0x0'));var util=require(_0x1b9e('0x1'));var moment=require(_0x1b9e('0x2'));var BPromise=require(_0x1b9e('0x3'));var rs=require(_0x1b9e('0x4'));var fs=require('fs');var Redis=require(_0x1b9e('0x5'));var db=require(_0x1b9e('0x6'))['db'];var utils=require(_0x1b9e('0x7'));var logger=require('../../config/logger')(_0x1b9e('0x8'));var config=require(_0x1b9e('0x9'));var jayson=require(_0x1b9e('0xa'));var client=jayson[_0x1b9e('0xb')][_0x1b9e('0xc')]({'port':0x232a});config[_0x1b9e('0xd')]=_[_0x1b9e('0xe')](config[_0x1b9e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b9e('0xf'))(new Redis(config[_0x1b9e('0xd')]));require('./chatInternalMessage.socket')[_0x1b9e('0x10')](socket);function respondWithRpcPromise(_0x147f01,_0x4239a1,_0x109837){return new BPromise(function(_0x58b3aa,_0x443ec1){return client[_0x1b9e('0x11')](_0x147f01,_0x109837)[_0x1b9e('0x12')](function(_0x33f7e0){logger[_0x1b9e('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x4239a1,_0x1b9e('0x14'));logger[_0x1b9e('0x15')](_0x1b9e('0x16'),_0x4239a1,_0x1b9e('0x14'),JSON[_0x1b9e('0x17')](_0x33f7e0));if(_0x33f7e0[_0x1b9e('0x18')]){if(_0x33f7e0[_0x1b9e('0x18')][_0x1b9e('0x19')]===0x1f4){logger['error'](_0x1b9e('0x1a'),_0x4239a1,_0x33f7e0[_0x1b9e('0x18')][_0x1b9e('0x1b')]);return _0x443ec1(_0x33f7e0[_0x1b9e('0x18')][_0x1b9e('0x1b')]);}logger[_0x1b9e('0x18')](_0x1b9e('0x1a'),_0x4239a1,_0x33f7e0[_0x1b9e('0x18')][_0x1b9e('0x1b')]);return _0x58b3aa(_0x33f7e0[_0x1b9e('0x18')][_0x1b9e('0x1b')]);}else{logger[_0x1b9e('0x13')](_0x1b9e('0x1a'),_0x4239a1,_0x1b9e('0x14'));_0x58b3aa(_0x33f7e0['result'][_0x1b9e('0x1b')]);}})[_0x1b9e('0x1c')](function(_0x508435){logger[_0x1b9e('0x18')](_0x1b9e('0x1a'),_0x4239a1,_0x508435);_0x443ec1(_0x508435);});});} \ No newline at end of file +var _0x8bf5=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x55ced2,_0x352f9c){var _0x2c2788=function(_0x4c38d8){while(--_0x4c38d8){_0x55ced2['push'](_0x55ced2['shift']());}};_0x2c2788(++_0x352f9c);}(_0x8bf5,0x172));var _0x58bf=function(_0x20008a,_0x362490){_0x20008a=_0x20008a-0x0;var _0x5d0f1c=_0x8bf5[_0x20008a];return _0x5d0f1c;};'use strict';var _=require('lodash');var util=require(_0x58bf('0x0'));var moment=require(_0x58bf('0x1'));var BPromise=require(_0x58bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58bf('0x3'));var db=require(_0x58bf('0x4'))['db'];var utils=require(_0x58bf('0x5'));var logger=require(_0x58bf('0x6'))(_0x58bf('0x7'));var config=require(_0x58bf('0x8'));var jayson=require(_0x58bf('0x9'));var client=jayson[_0x58bf('0xa')]['http']({'port':0x232a});config[_0x58bf('0xb')]=_[_0x58bf('0xc')](config['redis'],{'host':_0x58bf('0xd'),'port':0x18eb});var socket=require(_0x58bf('0xe'))(new Redis(config[_0x58bf('0xb')]));require(_0x58bf('0xf'))['register'](socket);function respondWithRpcPromise(_0x201528,_0xd67bbd,_0x5aba24){return new BPromise(function(_0x5d453e,_0x1cca09){return client[_0x58bf('0x10')](_0x201528,_0x5aba24)[_0x58bf('0x11')](function(_0x5303e9){logger[_0x58bf('0x12')](_0x58bf('0x13'),_0xd67bbd,_0x58bf('0x14'));logger[_0x58bf('0x15')](_0x58bf('0x16'),_0xd67bbd,'request\x20sent',JSON[_0x58bf('0x17')](_0x5303e9));if(_0x5303e9[_0x58bf('0x18')]){if(_0x5303e9['error']['code']===0x1f4){logger['error'](_0x58bf('0x13'),_0xd67bbd,_0x5303e9[_0x58bf('0x18')]['message']);return _0x1cca09(_0x5303e9[_0x58bf('0x18')][_0x58bf('0x19')]);}logger[_0x58bf('0x18')](_0x58bf('0x13'),_0xd67bbd,_0x5303e9[_0x58bf('0x18')][_0x58bf('0x19')]);return _0x5d453e(_0x5303e9[_0x58bf('0x18')][_0x58bf('0x19')]);}else{logger[_0x58bf('0x12')](_0x58bf('0x13'),_0xd67bbd,_0x58bf('0x14'));_0x5d453e(_0x5303e9[_0x58bf('0x1a')]['message']);}})['catch'](function(_0x233e49){logger['error'](_0x58bf('0x13'),_0xd67bbd,_0x233e49);_0x1cca09(_0x233e49);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 12f333d..1c87e59 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 _0x0f50=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x225e61,_0xb3c102){var _0x41bdad=function(_0x318eac){while(--_0x318eac){_0x225e61['push'](_0x225e61['shift']());}};_0x41bdad(++_0xb3c102);}(_0x0f50,0x130));var _0x00f5=function(_0x3a6b8b,_0x40a1fc){_0x3a6b8b=_0x3a6b8b-0x0;var _0x32869e=_0x0f50[_0x3a6b8b];return _0x32869e;};'use strict';var ChatInternalMessageEvents=require(_0x00f5('0x0'));var events=[_0x00f5('0x1'),_0x00f5('0x2'),_0x00f5('0x3')];function createListener(_0x12b049,_0x1b2830){return function(_0x2aeea5){_0x1b2830[_0x00f5('0x4')](_0x12b049,_0x2aeea5);};}function removeListener(_0x51e050,_0x4a3b91){return function(){ChatInternalMessageEvents[_0x00f5('0x5')](_0x51e050,_0x4a3b91);};}exports[_0x00f5('0x6')]=function(_0x28bf80){for(var _0x280b85=0x0,_0x4a3233=events[_0x00f5('0x7')];_0x280b85<_0x4a3233;_0x280b85++){var _0xd3803=events[_0x280b85];var _0x1e07c4=createListener(_0x00f5('0x8')+_0xd3803,_0x28bf80);ChatInternalMessageEvents['on'](_0xd3803,_0x1e07c4);}}; \ No newline at end of file +var _0xf4d3=['update','removeListener','register','./chatInternalMessage.events','save','remove'];(function(_0x3bbcb9,_0x2836c3){var _0x4860ff=function(_0x227e5f){while(--_0x227e5f){_0x3bbcb9['push'](_0x3bbcb9['shift']());}};_0x4860ff(++_0x2836c3);}(_0xf4d3,0x1b9));var _0x3f4d=function(_0x45f637,_0x2eee9b){_0x45f637=_0x45f637-0x0;var _0x26f64e=_0xf4d3[_0x45f637];return _0x26f64e;};'use strict';var ChatInternalMessageEvents=require(_0x3f4d('0x0'));var events=[_0x3f4d('0x1'),_0x3f4d('0x2'),_0x3f4d('0x3')];function createListener(_0x3fe48a,_0x53ebd6){return function(_0x34d965){_0x53ebd6['emit'](_0x3fe48a,_0x34d965);};}function removeListener(_0x35e7e1,_0x57f2a1){return function(){ChatInternalMessageEvents[_0x3f4d('0x4')](_0x35e7e1,_0x57f2a1);};}exports[_0x3f4d('0x5')]=function(_0x22fa66){for(var _0x3a983d=0x0,_0x55c134=events['length'];_0x3a983d<_0x55c134;_0x3a983d++){var _0x3a953d=events[_0x3a983d];var _0x5c0052=createListener('chatInternalMessage:'+_0x3a953d,_0x22fa66);ChatInternalMessageEvents['on'](_0x3a953d,_0x5c0052);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index dd38fe5..b6efd36 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 _0x7278=['express','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id','show','create','update','delete','destroy','exports','util','connect-timeout'];(function(_0x1fa746,_0x2b9b2f){var _0x51b214=function(_0x5c7df2){while(--_0x5c7df2){_0x1fa746['push'](_0x1fa746['shift']());}};_0x51b214(++_0x2b9b2f);}(_0x7278,0x1da));var _0x8727=function(_0x2f1dad,_0x1dfee5){_0x2f1dad=_0x2f1dad-0x0;var _0x64e3d6=_0x7278[_0x2f1dad];return _0x64e3d6;};'use strict';var multer=require('multer');var util=require(_0x8727('0x0'));var path=require('path');var timeout=require(_0x8727('0x1'));var express=require(_0x8727('0x2'));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(_0x8727('0x3'));var controller=require(_0x8727('0x4'));router[_0x8727('0x5')]('/',auth[_0x8727('0x6')](),controller['index']);router[_0x8727('0x5')](_0x8727('0x7'),auth[_0x8727('0x6')](),controller[_0x8727('0x8')]);router[_0x8727('0x5')]('/users',auth[_0x8727('0x6')](),controller[_0x8727('0x9')]);router['get'](_0x8727('0xa'),auth['isAuthenticated'](),controller[_0x8727('0xb')]);router['post']('/',auth[_0x8727('0x6')](),controller[_0x8727('0xc')]);router['put']('/:id',controller[_0x8727('0xd')]);router[_0x8727('0xe')](_0x8727('0xa'),auth[_0x8727('0x6')](),controller[_0x8727('0xf')]);module[_0x8727('0x10')]=router; \ No newline at end of file +var _0xfb49=['post','create','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','getUsers','/:id','show'];(function(_0x58a76c,_0x45461a){var _0x10dcf3=function(_0x263fbc){while(--_0x263fbc){_0x58a76c['push'](_0x58a76c['shift']());}};_0x10dcf3(++_0x45461a);}(_0xfb49,0x13a));var _0x9fb4=function(_0x4ae58a,_0x72bd08){_0x4ae58a=_0x4ae58a-0x0;var _0x3c0445=_0xfb49[_0x4ae58a];return _0x3c0445;};'use strict';var multer=require(_0x9fb4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9fb4('0x1'));var express=require(_0x9fb4('0x2'));var router=express[_0x9fb4('0x3')]();var fs_extra=require(_0x9fb4('0x4'));var auth=require(_0x9fb4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9fb4('0x6'));var controller=require(_0x9fb4('0x7'));router[_0x9fb4('0x8')]('/',auth['isAuthenticated'](),controller[_0x9fb4('0x9')]);router[_0x9fb4('0x8')](_0x9fb4('0xa'),auth[_0x9fb4('0xb')](),controller[_0x9fb4('0xc')]);router[_0x9fb4('0x8')]('/users',auth[_0x9fb4('0xb')](),controller[_0x9fb4('0xd')]);router[_0x9fb4('0x8')](_0x9fb4('0xe'),auth['isAuthenticated'](),controller[_0x9fb4('0xf')]);router[_0x9fb4('0x10')]('/',auth[_0x9fb4('0xb')](),controller[_0x9fb4('0x11')]);router[_0x9fb4('0x12')]('/:id',controller[_0x9fb4('0x13')]);router[_0x9fb4('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9fb4('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1ba0943..a270ee6 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 _0xdd6e=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xdd6e,0xa5));var _0xedd6=function(_0x211782,_0x48fda7){_0x211782=_0x211782-0x0;var _0x2811ed=_0xdd6e[_0x211782];return _0x2811ed;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'body':{'type':Sequelize[_0xedd6('0x2')](_0xedd6('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xedd6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xedd6('0x5')]('in',_0xedd6('0x6')),'defaultValue':_0xedd6('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3264=['STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3264,0x7f));var _0x4326=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3264[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'body':{'type':Sequelize[_0x4326('0x1')](_0x4326('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4326('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4326('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4326('0x5')]},'providerResponse':{'type':Sequelize[_0x4326('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 381db7f..6c6e489 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 _0x3fc9=['ChatInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','sequelize','Sequelize','SELECT','agent','email','internal','manual','interface','channel','EventManager','acceptmessage','parse','formData','role','RejectMessage','rejectMessage','ContactId','contact','User','fullname','event','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','length','options','create','body','describe','chat-interactions','accept','chat','read','readAt','UserId','user','find','get','ChatInteraction'];(function(_0x338f2a,_0x2cec43){var _0x427bae=function(_0x2fc62e){while(--_0x2fc62e){_0x338f2a['push'](_0x338f2a['shift']());}};_0x427bae(++_0x2cec43);}(_0x3fc9,0x1b0));var _0x93fc=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x3fc9[_0xd816e2];return _0x1f5924;};'use strict';var emlformat=require(_0x93fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x93fc('0x1'));var jsonpatch=require(_0x93fc('0x2'));var rp=require(_0x93fc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x93fc('0x4'));var path=require(_0x93fc('0x5'));var sox=require(_0x93fc('0x6'));var csv=require(_0x93fc('0x7'));var ejs=require(_0x93fc('0x8'));var fs=require('fs');var fs_extra=require(_0x93fc('0x9'));var _=require(_0x93fc('0xa'));var squel=require(_0x93fc('0xb'));var crypto=require(_0x93fc('0xc'));var jsforce=require(_0x93fc('0xd'));var deskjs=require(_0x93fc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x93fc('0xf'));var Papa=require(_0x93fc('0x10'));var Redis=require(_0x93fc('0x11'));var authService=require(_0x93fc('0x12'));var qs=require(_0x93fc('0x13'));var as=require(_0x93fc('0x14'));var hardwareService=require(_0x93fc('0x15'));var logger=require(_0x93fc('0x16'))(_0x93fc('0x17'));var utils=require(_0x93fc('0x18'));var config=require(_0x93fc('0x19'));var licenseUtil=require(_0x93fc('0x1a'));var db=require('../../mysqldb')['db'];config[_0x93fc('0x1b')]=_[_0x93fc('0x1c')](config['redis'],{'host':_0x93fc('0x1d'),'port':0x18eb});var socket=require(_0x93fc('0x1e'))(new Redis(config[_0x93fc('0x1b')]));require('./chatMessage.socket')[_0x93fc('0x1f')](socket);var jayson=require(_0x93fc('0x20'));var client=jayson['client'][_0x93fc('0x21')]({'port':0x232c});var client9002=jayson[_0x93fc('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14aea2,_0xc5a3a3,_0x5b218d,_0x3a8c87){return new BPromise(function(_0x2b7b40,_0x44864d){var _0x1d8240=_0x3a8c87||client;return _0x1d8240[_0x93fc('0x23')](_0x14aea2,_0x5b218d)[_0x93fc('0x24')](function(_0x20fbc1){logger[_0x93fc('0x25')](_0x93fc('0x26'),_0xc5a3a3,'request\x20sent');logger[_0x93fc('0x27')](_0x93fc('0x28'),_0xc5a3a3,_0x93fc('0x29'),JSON[_0x93fc('0x2a')](_0x20fbc1));if(_0x20fbc1[_0x93fc('0x2b')]){if(_0x20fbc1[_0x93fc('0x2b')]['code']===0x1f4){logger['error'](_0x93fc('0x26'),_0xc5a3a3,_0x20fbc1[_0x93fc('0x2b')][_0x93fc('0x2c')]);return _0x44864d(_0x20fbc1[_0x93fc('0x2b')]['message']);}logger[_0x93fc('0x2b')]('ChatMessage,\x20%s,\x20%s',_0xc5a3a3,_0x20fbc1[_0x93fc('0x2b')]['message']);return _0x2b7b40(_0x20fbc1['error'][_0x93fc('0x2c')]);}else{logger[_0x93fc('0x25')](_0x93fc('0x26'),_0xc5a3a3,_0x93fc('0x29'));_0x2b7b40(_0x20fbc1[_0x93fc('0x2d')][_0x93fc('0x2c')]);}})[_0x93fc('0x2e')](function(_0x471c69){logger[_0x93fc('0x2b')](_0x93fc('0x26'),_0xc5a3a3,_0x471c69);_0x44864d(_0x471c69);});});}function respondWithStatusCode(_0xf995a2,_0x963869){_0x963869=_0x963869||0xcc;return function(_0x2edb77){if(_0x2edb77){return _0xf995a2['sendStatus'](_0x963869);}return _0xf995a2[_0x93fc('0x2f')](_0x963869)[_0x93fc('0x30')]();};}function respondWithResult(_0x40b982,_0x3bf64f){_0x3bf64f=_0x3bf64f||0xc8;return function(_0x4f1735){if(_0x4f1735){return _0x40b982['status'](_0x3bf64f)[_0x93fc('0x31')](_0x4f1735);}};}function respondWithFilteredResult(_0x2f7c94,_0x363b17){return function(_0x272595){if(_0x272595){var _0x479ff8=typeof _0x363b17[_0x93fc('0x32')]==='undefined'&&typeof _0x363b17[_0x93fc('0x33')]===_0x93fc('0x34');var _0x1d39b8=_0x272595[_0x93fc('0x35')];var _0x449b1b=_0x479ff8?0x0:_0x363b17[_0x93fc('0x32')];var _0x4cd0b0=_0x479ff8?_0x272595[_0x93fc('0x35')]:_0x363b17[_0x93fc('0x32')]+_0x363b17[_0x93fc('0x33')];var _0x2722bb;if(_0x4cd0b0>=_0x1d39b8){_0x4cd0b0=_0x1d39b8;_0x2722bb=0xc8;}else{_0x2722bb=0xce;}_0x2f7c94['status'](_0x2722bb);return _0x2f7c94[_0x93fc('0x36')]('Content-Range',_0x449b1b+'-'+_0x4cd0b0+'/'+_0x1d39b8)[_0x93fc('0x31')](_0x272595);}return null;};}function patchUpdates(_0x50d7a4){return function(_0x51f86f){try{jsonpatch['apply'](_0x51f86f,_0x50d7a4,!![]);}catch(_0x590e69){return BPromise[_0x93fc('0x37')](_0x590e69);}return _0x51f86f[_0x93fc('0x38')]();};}function saveUpdates(_0x33830c,_0x2e8f61){return function(_0x501d20){if(_0x501d20){return _0x501d20[_0x93fc('0x39')](_0x33830c)['then'](function(_0x2b7aef){return _0x2b7aef;});}return null;};}function removeEntity(_0x1571f3,_0xe96526){return function(_0x1e6315){if(_0x1e6315){return _0x1e6315[_0x93fc('0x3a')]()[_0x93fc('0x24')](function(){_0x1571f3[_0x93fc('0x2f')](0xcc)[_0x93fc('0x30')]();});}};}function handleEntityNotFound(_0x2ab340,_0xffd3b8){return function(_0x44d519){if(!_0x44d519){_0x2ab340['sendStatus'](0x194);}return _0x44d519;};}function handleError(_0x592711,_0x561ae4){_0x561ae4=_0x561ae4||0x1f4;return function(_0x218230){logger[_0x93fc('0x2b')](_0x218230[_0x93fc('0x3b')]);if(_0x218230[_0x93fc('0x3c')]){delete _0x218230[_0x93fc('0x3c')];}_0x592711[_0x93fc('0x2f')](_0x561ae4)['send'](_0x218230);};}exports[_0x93fc('0x3d')]=function(_0x30dde6,_0x1c2021){var _0x311f1f={},_0x129859={},_0x532ccb={'count':0x0,'rows':[]};var _0x3e1ac6=_[_0x93fc('0x3e')](db[_0x93fc('0x3f')][_0x93fc('0x40')],function(_0x2d23a2){return{'name':_0x2d23a2[_0x93fc('0x41')],'type':_0x2d23a2[_0x93fc('0x42')][_0x93fc('0x43')]};});_0x129859[_0x93fc('0x44')]=_[_0x93fc('0x3e')](_0x3e1ac6,_0x93fc('0x3c'));_0x129859['query']=_[_0x93fc('0x45')](_0x30dde6[_0x93fc('0x46')]);_0x129859['filters']=_[_0x93fc('0x47')](_0x129859['model'],_0x129859[_0x93fc('0x46')]);_0x311f1f[_0x93fc('0x48')]=_[_0x93fc('0x47')](_0x129859['model'],qs['fields'](_0x30dde6[_0x93fc('0x46')][_0x93fc('0x49')]));_0x311f1f[_0x93fc('0x48')]=_0x311f1f[_0x93fc('0x48')]['length']?_0x311f1f[_0x93fc('0x48')]:_0x129859[_0x93fc('0x44')];if(!_0x30dde6['query'][_0x93fc('0x4a')](_0x93fc('0x4b'))){_0x311f1f[_0x93fc('0x33')]=qs[_0x93fc('0x33')](_0x30dde6[_0x93fc('0x46')][_0x93fc('0x33')]);_0x311f1f[_0x93fc('0x32')]=qs[_0x93fc('0x32')](_0x30dde6[_0x93fc('0x46')]['offset']);}_0x311f1f[_0x93fc('0x4c')]=qs[_0x93fc('0x4d')](_0x30dde6[_0x93fc('0x46')][_0x93fc('0x4d')]);_0x311f1f['where']=qs[_0x93fc('0x4e')](_[_0x93fc('0x4f')](_0x30dde6['query'],_0x129859[_0x93fc('0x4e')]),_0x3e1ac6);if(_0x30dde6[_0x93fc('0x46')]['filter']){_0x311f1f[_0x93fc('0x50')]=_[_0x93fc('0x51')](_0x311f1f['where'],{'$or':_[_0x93fc('0x3e')](_0x3e1ac6,function(_0x5cc4fc){if(_0x5cc4fc[_0x93fc('0x42')]!==_0x93fc('0x52')){var _0x3387a5={};_0x3387a5[_0x5cc4fc[_0x93fc('0x3c')]]={'$like':'%'+_0x30dde6[_0x93fc('0x46')][_0x93fc('0x53')]+'%'};return _0x3387a5;}})});}_0x311f1f=_['merge']({},_0x311f1f,_0x30dde6['options']);var _0x3c5413={'where':_0x311f1f[_0x93fc('0x50')]};return db[_0x93fc('0x3f')][_0x93fc('0x35')](_0x3c5413)[_0x93fc('0x24')](function(_0x393781){_0x532ccb[_0x93fc('0x35')]=_0x393781;if(_0x30dde6[_0x93fc('0x46')][_0x93fc('0x54')]){_0x311f1f[_0x93fc('0x55')]=[{'all':!![]}];}return db[_0x93fc('0x3f')][_0x93fc('0x56')](_0x311f1f);})[_0x93fc('0x24')](function(_0x3a8c1d){_0x532ccb['rows']=_0x3a8c1d;return _0x532ccb;})[_0x93fc('0x24')](respondWithFilteredResult(_0x1c2021,_0x311f1f))[_0x93fc('0x2e')](handleError(_0x1c2021,null));};exports[_0x93fc('0x57')]=function(_0x15ccdc,_0x13f370){var _0x24bc2f={'raw':!![],'where':{'id':_0x15ccdc[_0x93fc('0x58')]['id']}},_0x20673c={};_0x20673c[_0x93fc('0x44')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x20673c[_0x93fc('0x46')]=_[_0x93fc('0x45')](_0x15ccdc[_0x93fc('0x46')]);_0x20673c[_0x93fc('0x4e')]=_['intersection'](_0x20673c[_0x93fc('0x44')],_0x20673c[_0x93fc('0x46')]);_0x24bc2f['attributes']=_[_0x93fc('0x47')](_0x20673c[_0x93fc('0x44')],qs[_0x93fc('0x49')](_0x15ccdc[_0x93fc('0x46')][_0x93fc('0x49')]));_0x24bc2f[_0x93fc('0x48')]=_0x24bc2f[_0x93fc('0x48')][_0x93fc('0x59')]?_0x24bc2f['attributes']:_0x20673c[_0x93fc('0x44')];if(_0x15ccdc['query'][_0x93fc('0x54')]){_0x24bc2f[_0x93fc('0x55')]=[{'all':!![]}];}_0x24bc2f=_['merge']({},_0x24bc2f,_0x15ccdc[_0x93fc('0x5a')]);return db[_0x93fc('0x3f')]['find'](_0x24bc2f)[_0x93fc('0x24')](handleEntityNotFound(_0x13f370,null))[_0x93fc('0x24')](respondWithResult(_0x13f370,null))['catch'](handleError(_0x13f370,null));};exports[_0x93fc('0x5b')]=function(_0x38a475,_0x484558){return db['ChatMessage'][_0x93fc('0x5b')](_0x38a475[_0x93fc('0x5c')],{})[_0x93fc('0x24')](respondWithResult(_0x484558,0xc9))[_0x93fc('0x2e')](handleError(_0x484558,null));};exports['update']=function(_0x64cc8a,_0x5d5ef7){if(_0x64cc8a[_0x93fc('0x5c')]['id']){delete _0x64cc8a[_0x93fc('0x5c')]['id'];}return db[_0x93fc('0x3f')]['find']({'where':{'id':_0x64cc8a[_0x93fc('0x58')]['id']}})[_0x93fc('0x24')](handleEntityNotFound(_0x5d5ef7,null))[_0x93fc('0x24')](saveUpdates(_0x64cc8a[_0x93fc('0x5c')],null))[_0x93fc('0x24')](respondWithResult(_0x5d5ef7,null))[_0x93fc('0x2e')](handleError(_0x5d5ef7,null));};exports[_0x93fc('0x3a')]=function(_0xd53620,_0x5296c3){return db[_0x93fc('0x3f')]['find']({'where':{'id':_0xd53620['params']['id']}})['then'](handleEntityNotFound(_0x5296c3,null))[_0x93fc('0x24')](removeEntity(_0x5296c3,null))[_0x93fc('0x2e')](handleError(_0x5296c3,null));};exports[_0x93fc('0x5d')]=function(_0x14a6fe,_0x3ecf04){return db[_0x93fc('0x3f')]['describe']()[_0x93fc('0x24')](respondWithResult(_0x3ecf04,null))['catch'](handleError(_0x3ecf04,null));};var interaction_log=require('../../config/logger')(_0x93fc('0x5e'));exports[_0x93fc('0x5f')]=function(_0x2cd011,_0x410b9f,_0x4c3acc){var _0x1e99e6={'agent':{},'channel':_0x93fc('0x60')};if(_0x2cd011[_0x93fc('0x5c')]['id']){delete _0x2cd011['body']['id'];}_0x2cd011[_0x93fc('0x5c')][_0x93fc('0x61')]=!![];_0x2cd011[_0x93fc('0x5c')][_0x93fc('0x62')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2cd011[_0x93fc('0x5c')][_0x93fc('0x63')]=_0x2cd011['body']['UserId']||_0x2cd011[_0x93fc('0x64')]['id'];_0x1e99e6['agent']['id']=_0x2cd011[_0x93fc('0x5c')][_0x93fc('0x63')];return db['ChatMessage'][_0x93fc('0x65')]({'where':{'id':_0x2cd011[_0x93fc('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x410b9f,null))[_0x93fc('0x24')](saveUpdates(_0x2cd011[_0x93fc('0x5c')],null))['then'](function(_0x1e1713){if(_0x1e1713){_0x1e99e6[_0x93fc('0x2c')]=_0x1e1713[_0x93fc('0x66')]({'plain':!![]});return db[_0x93fc('0x67')]['find']({'where':{'id':_0x1e1713[_0x93fc('0x68')]}});}return null;})[_0x93fc('0x24')](handleEntityNotFound(_0x410b9f,null))[_0x93fc('0x24')](function(_0x5c1dac){if(_0x5c1dac){return _0x5c1dac[_0x93fc('0x39')]({'UserId':_0x2cd011[_0x93fc('0x5c')][_0x93fc('0x63')],'read1stAt':_[_0x93fc('0x69')](_0x5c1dac['read1stAt'])?moment()[_0x93fc('0x6a')](_0x93fc('0x6b')):undefined});}return null;})['then'](function(_0x1a28c3){if(_0x1a28c3){_0x1e99e6[_0x93fc('0x6c')]=_0x1a28c3[_0x93fc('0x66')]({'plain':!![]});interaction_log['info'](_0x93fc('0x6d'),_0x2cd011[_0x93fc('0x64')]['id'],_0x2cd011[_0x93fc('0x64')][_0x93fc('0x3c')],_0x2cd011[_0x93fc('0x64')]['role'],_0x1e99e6[_0x93fc('0x6c')]['id'],_0x2cd011['body']?JSON[_0x93fc('0x2a')](_0x2cd011[_0x93fc('0x5c')]):_0x93fc('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x93fc('0x6f'),_0x1e99e6);}return null;})[_0x93fc('0x24')](function(_0xc11933){var _0x4d10bc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xc11933[_0x93fc('0x2c')]['ContactId'];return db[_0x93fc('0x70')]['query'](_0x4d10bc,{'type':db[_0x93fc('0x71')]['QueryTypes'][_0x93fc('0x72')],'raw':!![]})[_0x93fc('0x24')](function(_0x42f8ce){return _0x42f8ce;});})['then'](function(_0x11b101){if(_0x11b101){_0x1e99e6[_0x93fc('0x2c')]['contact']=_0x11b101[0x0];if(!_0x2cd011[_0x93fc('0x5c')][_0x93fc('0x63')])return;return db['User']['find']({'where':{'id':_0x2cd011['body'][_0x93fc('0x63')],'role':_0x93fc('0x73')},'attributes':['id',_0x93fc('0x3c'),'fullname',_0x93fc('0x74'),_0x93fc('0x75')],'raw':!![]});}return null;})[_0x93fc('0x24')](function(_0x5abf06){if(!_0x5abf06)return null;_0x1e99e6[_0x93fc('0x2c')]['agent']=_0x5abf06;return _0x1e99e6;})[_0x93fc('0x24')](function(_0x1d7a69){if(_0x1d7a69){if(_0x2cd011[_0x93fc('0x5c')][_0x93fc('0x76')]){_0x1e99e6['message'][_0x93fc('0x77')]=util[_0x93fc('0x6a')]('SIP/%s',_0x2cd011['user'][_0x93fc('0x3c')]);_0x1e99e6[_0x93fc('0x2c')][_0x93fc('0x78')]=_0x1e99e6[_0x93fc('0x78')];_0x1e99e6[_0x93fc('0x2c')]['motionChannel']=_0x1e99e6['channel'];_0x1e99e6['message']['event']=_0x93fc('0x5f');return respondWithRpcPromise(_0x93fc('0x79'),_0x93fc('0x79'),{'event':_0x93fc('0x7a'),'message':_[_0x93fc('0x51')](_0x1e99e6[_0x93fc('0x2c')],JSON[_0x93fc('0x7b')](_0x1e99e6[_0x93fc('0x6c')][_0x93fc('0x7c')]))},client9002)[_0x93fc('0x24')](function(){return _0x1e99e6;});}return _0x1e99e6;}return null;})['then'](respondWithResult(_0x410b9f,null))[_0x93fc('0x2e')](handleError(_0x410b9f,null));};var interaction_log=require(_0x93fc('0x16'))(_0x93fc('0x5e'));exports[_0x93fc('0x37')]=function(_0x16e616,_0x30942f,_0x106cb2){var _0x43149d={'agent':{},'channel':_0x93fc('0x60')};if(_0x16e616[_0x93fc('0x5c')]['id']){delete _0x16e616[_0x93fc('0x5c')]['id'];}_0x16e616[_0x93fc('0x5c')][_0x93fc('0x63')]=_0x16e616[_0x93fc('0x5c')][_0x93fc('0x63')]||_0x16e616[_0x93fc('0x64')]['id'];_0x43149d[_0x93fc('0x73')]['id']=_0x16e616[_0x93fc('0x5c')]['UserId'];return db['ChatMessage'][_0x93fc('0x65')]({'where':{'id':_0x16e616[_0x93fc('0x58')]['id'],'UserId':null}})[_0x93fc('0x24')](handleEntityNotFound(_0x30942f,null))['then'](function(_0xe40b38){if(_0xe40b38){_0x43149d[_0x93fc('0x2c')]=_0xe40b38[_0x93fc('0x66')]({'plain':!![]});return db[_0x93fc('0x67')][_0x93fc('0x65')]({'where':{'id':_0xe40b38[_0x93fc('0x68')]}});}return null;})[_0x93fc('0x24')](handleEntityNotFound(_0x30942f,null))[_0x93fc('0x24')](function(_0x80cbdf){if(_0x80cbdf){_0x43149d['interaction']=_0x80cbdf[_0x93fc('0x66')]({'plain':!![]});interaction_log[_0x93fc('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x16e616[_0x93fc('0x64')]['id'],_0x16e616[_0x93fc('0x64')][_0x93fc('0x3c')],_0x16e616[_0x93fc('0x64')][_0x93fc('0x7d')],_0x43149d['interaction']['id'],_0x16e616[_0x93fc('0x5c')]?JSON['stringify'](_0x16e616[_0x93fc('0x5c')]):_0x93fc('0x6e'));return respondWithRpcPromise(_0x93fc('0x7e'),_0x93fc('0x7f'),_0x43149d);}return null;})['then'](function(_0x4b3a38){var _0x4143b6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4b3a38[_0x93fc('0x2c')][_0x93fc('0x80')];return db[_0x93fc('0x70')]['query'](_0x4143b6,{'type':db[_0x93fc('0x71')]['QueryTypes'][_0x93fc('0x72')],'raw':!![]})['then'](function(_0x5cbce5){return _0x5cbce5;});})['then'](function(_0x4219b9){if(_0x4219b9){_0x43149d[_0x93fc('0x2c')][_0x93fc('0x81')]=_0x4219b9[0x0];if(!_0x16e616[_0x93fc('0x5c')][_0x93fc('0x63')])return;return db[_0x93fc('0x82')][_0x93fc('0x65')]({'where':{'id':_0x16e616[_0x93fc('0x5c')][_0x93fc('0x63')],'role':_0x93fc('0x73')},'attributes':['id',_0x93fc('0x3c'),_0x93fc('0x83'),_0x93fc('0x74'),_0x93fc('0x75')],'raw':!![]});}return null;})['then'](function(_0x4cb7a6){if(!_0x4cb7a6)return null;_0x43149d[_0x93fc('0x2c')]['agent']=_0x4cb7a6;return _0x43149d;})[_0x93fc('0x24')](function(_0x34980a){if(_0x34980a){_0x34980a[_0x93fc('0x2c')]['interface']=util[_0x93fc('0x6a')]('SIP/%s',_0x16e616[_0x93fc('0x64')][_0x93fc('0x3c')]);_0x34980a[_0x93fc('0x2c')]['channel']=_0x43149d[_0x93fc('0x78')];_0x34980a[_0x93fc('0x2c')]['motionChannel']=_0x43149d[_0x93fc('0x78')];_0x34980a[_0x93fc('0x2c')][_0x93fc('0x84')]=_0x93fc('0x37');respondWithRpcPromise('EventManager',_0x93fc('0x79'),{'event':_0x93fc('0x85'),'message':_[_0x93fc('0x51')](_0x43149d['message'],JSON[_0x93fc('0x7b')](_0x43149d[_0x93fc('0x6c')][_0x93fc('0x7c')]))},client9002);return _0x43149d;}return null;})[_0x93fc('0x24')](respondWithResult(_0x30942f,null))['catch'](handleError(_0x30942f,null));}; \ No newline at end of file +var _0xe391=['type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT','User','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','ChatMessage','rawAttributes','fieldName'];(function(_0x2813ef,_0x16b003){var _0x579162=function(_0x55bc04){while(--_0x55bc04){_0x2813ef['push'](_0x2813ef['shift']());}};_0x579162(++_0x16b003);}(_0xe391,0x156));var _0x1e39=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0xe391[_0x220afa];return _0x1b79d1;};'use strict';var emlformat=require(_0x1e39('0x0'));var rimraf=require(_0x1e39('0x1'));var zipdir=require(_0x1e39('0x2'));var jsonpatch=require(_0x1e39('0x3'));var rp=require(_0x1e39('0x4'));var moment=require('moment');var BPromise=require(_0x1e39('0x5'));var Mustache=require(_0x1e39('0x6'));var util=require('util');var path=require(_0x1e39('0x7'));var sox=require(_0x1e39('0x8'));var csv=require(_0x1e39('0x9'));var ejs=require(_0x1e39('0xa'));var fs=require('fs');var fs_extra=require(_0x1e39('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e39('0xc'));var jsforce=require(_0x1e39('0xd'));var deskjs=require(_0x1e39('0xe'));var toCsv=require(_0x1e39('0x9'));var querystring=require(_0x1e39('0xf'));var Papa=require(_0x1e39('0x10'));var Redis=require(_0x1e39('0x11'));var authService=require(_0x1e39('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1e39('0x13'));var hardwareService=require(_0x1e39('0x14'));var logger=require(_0x1e39('0x15'))(_0x1e39('0x16'));var utils=require(_0x1e39('0x17'));var config=require(_0x1e39('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e39('0x19'))['db'];config[_0x1e39('0x1a')]=_[_0x1e39('0x1b')](config[_0x1e39('0x1a')],{'host':_0x1e39('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e39('0x1a')]));require(_0x1e39('0x1d'))[_0x1e39('0x1e')](socket);var jayson=require(_0x1e39('0x1f'));var client=jayson[_0x1e39('0x20')][_0x1e39('0x21')]({'port':0x232c});var client9002=jayson[_0x1e39('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x367f89,_0x6f0670,_0x2791bb,_0xed29f7){return new BPromise(function(_0x3ae14d,_0x52e270){var _0x133f46=_0xed29f7||client;return _0x133f46[_0x1e39('0x22')](_0x367f89,_0x2791bb)[_0x1e39('0x23')](function(_0x113467){logger[_0x1e39('0x24')](_0x1e39('0x25'),_0x6f0670,_0x1e39('0x26'));logger[_0x1e39('0x27')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x6f0670,'request\x20sent',JSON[_0x1e39('0x28')](_0x113467));if(_0x113467[_0x1e39('0x29')]){if(_0x113467[_0x1e39('0x29')][_0x1e39('0x2a')]===0x1f4){logger[_0x1e39('0x29')]('ChatMessage,\x20%s,\x20%s',_0x6f0670,_0x113467[_0x1e39('0x29')][_0x1e39('0x2b')]);return _0x52e270(_0x113467[_0x1e39('0x29')][_0x1e39('0x2b')]);}logger[_0x1e39('0x29')]('ChatMessage,\x20%s,\x20%s',_0x6f0670,_0x113467[_0x1e39('0x29')]['message']);return _0x3ae14d(_0x113467[_0x1e39('0x29')][_0x1e39('0x2b')]);}else{logger[_0x1e39('0x24')](_0x1e39('0x25'),_0x6f0670,'request\x20sent');_0x3ae14d(_0x113467[_0x1e39('0x2c')]['message']);}})[_0x1e39('0x2d')](function(_0x1d5e99){logger[_0x1e39('0x29')]('ChatMessage,\x20%s,\x20%s',_0x6f0670,_0x1d5e99);_0x52e270(_0x1d5e99);});});}function respondWithStatusCode(_0x3f3c2e,_0x426d84){_0x426d84=_0x426d84||0xcc;return function(_0x5fc46){if(_0x5fc46){return _0x3f3c2e['sendStatus'](_0x426d84);}return _0x3f3c2e[_0x1e39('0x2e')](_0x426d84)['end']();};}function respondWithResult(_0x203ae4,_0xd7b600){_0xd7b600=_0xd7b600||0xc8;return function(_0x303964){if(_0x303964){return _0x203ae4[_0x1e39('0x2e')](_0xd7b600)['json'](_0x303964);}};}function respondWithFilteredResult(_0x364ae1,_0x5e5d7b){return function(_0x1a991d){if(_0x1a991d){var _0x3d5126=typeof _0x5e5d7b['offset']===_0x1e39('0x2f')&&typeof _0x5e5d7b[_0x1e39('0x30')]==='undefined';var _0x4d7a71=_0x1a991d[_0x1e39('0x31')];var _0x420ce4=_0x3d5126?0x0:_0x5e5d7b['offset'];var _0x480a0c=_0x3d5126?_0x1a991d[_0x1e39('0x31')]:_0x5e5d7b['offset']+_0x5e5d7b['limit'];var _0x3ae223;if(_0x480a0c>=_0x4d7a71){_0x480a0c=_0x4d7a71;_0x3ae223=0xc8;}else{_0x3ae223=0xce;}_0x364ae1[_0x1e39('0x2e')](_0x3ae223);return _0x364ae1['set'](_0x1e39('0x32'),_0x420ce4+'-'+_0x480a0c+'/'+_0x4d7a71)[_0x1e39('0x33')](_0x1a991d);}return null;};}function patchUpdates(_0x57743c){return function(_0x25db95){try{jsonpatch[_0x1e39('0x34')](_0x25db95,_0x57743c,!![]);}catch(_0x1355a4){return BPromise[_0x1e39('0x35')](_0x1355a4);}return _0x25db95[_0x1e39('0x36')]();};}function saveUpdates(_0x251820,_0x141dd0){return function(_0x384d26){if(_0x384d26){return _0x384d26[_0x1e39('0x37')](_0x251820)['then'](function(_0xddfd5a){return _0xddfd5a;});}return null;};}function removeEntity(_0x26c9ce,_0x13001d){return function(_0x25fdd7){if(_0x25fdd7){return _0x25fdd7[_0x1e39('0x38')]()[_0x1e39('0x23')](function(){_0x26c9ce[_0x1e39('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfca777,_0x316ce4){return function(_0xb4cbbb){if(!_0xb4cbbb){_0xfca777[_0x1e39('0x39')](0x194);}return _0xb4cbbb;};}function handleError(_0x4be5fa,_0x1b4054){_0x1b4054=_0x1b4054||0x1f4;return function(_0x317e48){logger[_0x1e39('0x29')](_0x317e48[_0x1e39('0x3a')]);if(_0x317e48[_0x1e39('0x3b')]){delete _0x317e48[_0x1e39('0x3b')];}_0x4be5fa[_0x1e39('0x2e')](_0x1b4054)['send'](_0x317e48);};}exports['index']=function(_0x18cadb,_0x3c2262){var _0x4e9727={},_0x190016={},_0x45a676={'count':0x0,'rows':[]};var _0x4ef7e7=_['map'](db[_0x1e39('0x3c')][_0x1e39('0x3d')],function(_0x5b0fc7){return{'name':_0x5b0fc7[_0x1e39('0x3e')],'type':_0x5b0fc7[_0x1e39('0x3f')][_0x1e39('0x40')]};});_0x190016[_0x1e39('0x41')]=_[_0x1e39('0x42')](_0x4ef7e7,_0x1e39('0x3b'));_0x190016['query']=_[_0x1e39('0x43')](_0x18cadb[_0x1e39('0x44')]);_0x190016[_0x1e39('0x45')]=_[_0x1e39('0x46')](_0x190016[_0x1e39('0x41')],_0x190016[_0x1e39('0x44')]);_0x4e9727[_0x1e39('0x47')]=_[_0x1e39('0x46')](_0x190016[_0x1e39('0x41')],qs[_0x1e39('0x48')](_0x18cadb['query'][_0x1e39('0x48')]));_0x4e9727[_0x1e39('0x47')]=_0x4e9727[_0x1e39('0x47')]['length']?_0x4e9727[_0x1e39('0x47')]:_0x190016[_0x1e39('0x41')];if(!_0x18cadb[_0x1e39('0x44')][_0x1e39('0x49')](_0x1e39('0x4a'))){_0x4e9727[_0x1e39('0x30')]=qs['limit'](_0x18cadb[_0x1e39('0x44')][_0x1e39('0x30')]);_0x4e9727['offset']=qs[_0x1e39('0x4b')](_0x18cadb[_0x1e39('0x44')][_0x1e39('0x4b')]);}_0x4e9727['order']=qs['sort'](_0x18cadb[_0x1e39('0x44')][_0x1e39('0x4c')]);_0x4e9727[_0x1e39('0x4d')]=qs[_0x1e39('0x45')](_[_0x1e39('0x4e')](_0x18cadb[_0x1e39('0x44')],_0x190016[_0x1e39('0x45')]),_0x4ef7e7);if(_0x18cadb[_0x1e39('0x44')][_0x1e39('0x4f')]){_0x4e9727['where']=_[_0x1e39('0x50')](_0x4e9727[_0x1e39('0x4d')],{'$or':_[_0x1e39('0x42')](_0x4ef7e7,function(_0x59a475){if(_0x59a475[_0x1e39('0x3f')]!==_0x1e39('0x51')){var _0x3ea547={};_0x3ea547[_0x59a475[_0x1e39('0x3b')]]={'$like':'%'+_0x18cadb[_0x1e39('0x44')][_0x1e39('0x4f')]+'%'};return _0x3ea547;}})});}_0x4e9727=_[_0x1e39('0x50')]({},_0x4e9727,_0x18cadb['options']);var _0x2c3f8c={'where':_0x4e9727[_0x1e39('0x4d')]};return db['ChatMessage']['count'](_0x2c3f8c)[_0x1e39('0x23')](function(_0x2248da){_0x45a676[_0x1e39('0x31')]=_0x2248da;if(_0x18cadb[_0x1e39('0x44')][_0x1e39('0x52')]){_0x4e9727[_0x1e39('0x53')]=[{'all':!![]}];}return db[_0x1e39('0x3c')][_0x1e39('0x54')](_0x4e9727);})['then'](function(_0x3debc5){_0x45a676[_0x1e39('0x55')]=_0x3debc5;return _0x45a676;})[_0x1e39('0x23')](respondWithFilteredResult(_0x3c2262,_0x4e9727))['catch'](handleError(_0x3c2262,null));};exports[_0x1e39('0x56')]=function(_0x4a3c44,_0x42a27a){var _0x1625d5={'raw':!![],'where':{'id':_0x4a3c44[_0x1e39('0x57')]['id']}},_0x1c8f3a={};_0x1c8f3a['model']=_[_0x1e39('0x43')](db[_0x1e39('0x3c')][_0x1e39('0x3d')]);_0x1c8f3a['query']=_[_0x1e39('0x43')](_0x4a3c44[_0x1e39('0x44')]);_0x1c8f3a[_0x1e39('0x45')]=_[_0x1e39('0x46')](_0x1c8f3a[_0x1e39('0x41')],_0x1c8f3a[_0x1e39('0x44')]);_0x1625d5[_0x1e39('0x47')]=_['intersection'](_0x1c8f3a[_0x1e39('0x41')],qs[_0x1e39('0x48')](_0x4a3c44['query']['fields']));_0x1625d5['attributes']=_0x1625d5['attributes'][_0x1e39('0x58')]?_0x1625d5[_0x1e39('0x47')]:_0x1c8f3a[_0x1e39('0x41')];if(_0x4a3c44[_0x1e39('0x44')]['includeAll']){_0x1625d5[_0x1e39('0x53')]=[{'all':!![]}];}_0x1625d5=_['merge']({},_0x1625d5,_0x4a3c44[_0x1e39('0x59')]);return db[_0x1e39('0x3c')][_0x1e39('0x5a')](_0x1625d5)[_0x1e39('0x23')](handleEntityNotFound(_0x42a27a,null))[_0x1e39('0x23')](respondWithResult(_0x42a27a,null))[_0x1e39('0x2d')](handleError(_0x42a27a,null));};exports[_0x1e39('0x5b')]=function(_0x1b5d65,_0x157441){return db['ChatMessage'][_0x1e39('0x5b')](_0x1b5d65[_0x1e39('0x5c')],{})[_0x1e39('0x23')](respondWithResult(_0x157441,0xc9))[_0x1e39('0x2d')](handleError(_0x157441,null));};exports[_0x1e39('0x37')]=function(_0x578e36,_0x12edbb){if(_0x578e36[_0x1e39('0x5c')]['id']){delete _0x578e36[_0x1e39('0x5c')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x578e36[_0x1e39('0x57')]['id']}})[_0x1e39('0x23')](handleEntityNotFound(_0x12edbb,null))[_0x1e39('0x23')](saveUpdates(_0x578e36[_0x1e39('0x5c')],null))[_0x1e39('0x23')](respondWithResult(_0x12edbb,null))[_0x1e39('0x2d')](handleError(_0x12edbb,null));};exports[_0x1e39('0x38')]=function(_0x4ddfa3,_0xa32eb4){return db['ChatMessage'][_0x1e39('0x5a')]({'where':{'id':_0x4ddfa3[_0x1e39('0x57')]['id']}})['then'](handleEntityNotFound(_0xa32eb4,null))[_0x1e39('0x23')](removeEntity(_0xa32eb4,null))['catch'](handleError(_0xa32eb4,null));};exports[_0x1e39('0x5d')]=function(_0xf1120a,_0xc3a6b9){return db['ChatMessage']['describe']()[_0x1e39('0x23')](respondWithResult(_0xc3a6b9,null))['catch'](handleError(_0xc3a6b9,null));};var interaction_log=require(_0x1e39('0x15'))(_0x1e39('0x5e'));exports[_0x1e39('0x5f')]=function(_0x399c40,_0x2df461,_0x55724c){var _0xe90245={'agent':{},'channel':_0x1e39('0x60')};if(_0x399c40[_0x1e39('0x5c')]['id']){delete _0x399c40[_0x1e39('0x5c')]['id'];}_0x399c40[_0x1e39('0x5c')][_0x1e39('0x61')]=!![];_0x399c40['body']['readAt']=moment()[_0x1e39('0x62')](_0x1e39('0x63'));_0x399c40[_0x1e39('0x5c')]['UserId']=_0x399c40[_0x1e39('0x5c')]['UserId']||_0x399c40[_0x1e39('0x64')]['id'];_0xe90245[_0x1e39('0x65')]['id']=_0x399c40['body'][_0x1e39('0x66')];return db[_0x1e39('0x3c')]['find']({'where':{'id':_0x399c40[_0x1e39('0x57')]['id'],'UserId':null}})[_0x1e39('0x23')](handleEntityNotFound(_0x2df461,null))[_0x1e39('0x23')](saveUpdates(_0x399c40[_0x1e39('0x5c')],null))['then'](function(_0x3d258c){if(_0x3d258c){_0xe90245['message']=_0x3d258c[_0x1e39('0x67')]({'plain':!![]});return db[_0x1e39('0x68')][_0x1e39('0x5a')]({'where':{'id':_0x3d258c[_0x1e39('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x2df461,null))[_0x1e39('0x23')](function(_0x4d56b2){if(_0x4d56b2){return _0x4d56b2['update']({'UserId':_0x399c40['body'][_0x1e39('0x66')],'read1stAt':_[_0x1e39('0x6a')](_0x4d56b2['read1stAt'])?moment()[_0x1e39('0x62')](_0x1e39('0x63')):undefined});}return null;})[_0x1e39('0x23')](function(_0x49a2a9){if(_0x49a2a9){_0xe90245[_0x1e39('0x6b')]=_0x49a2a9['get']({'plain':!![]});interaction_log[_0x1e39('0x24')](_0x1e39('0x6c'),_0x399c40[_0x1e39('0x64')]['id'],_0x399c40['user']['name'],_0x399c40[_0x1e39('0x64')]['role'],_0xe90245[_0x1e39('0x6b')]['id'],_0x399c40[_0x1e39('0x5c')]?JSON[_0x1e39('0x28')](_0x399c40[_0x1e39('0x5c')]):_0x1e39('0x6d'));return respondWithRpcPromise(_0x1e39('0x6e'),'acceptMessage',_0xe90245);}return null;})[_0x1e39('0x23')](function(_0x9f9503){var _0x149327=_0x1e39('0x6f')+_0x9f9503[_0x1e39('0x2b')][_0x1e39('0x70')];return db[_0x1e39('0x71')][_0x1e39('0x44')](_0x149327,{'type':db[_0x1e39('0x72')][_0x1e39('0x73')]['SELECT'],'raw':!![]})[_0x1e39('0x23')](function(_0x311c10){return _0x311c10;});})[_0x1e39('0x23')](function(_0x25708f){if(_0x25708f){_0xe90245[_0x1e39('0x2b')][_0x1e39('0x74')]=_0x25708f[0x0];if(!_0x399c40[_0x1e39('0x5c')][_0x1e39('0x66')])return;return db['User'][_0x1e39('0x5a')]({'where':{'id':_0x399c40[_0x1e39('0x5c')][_0x1e39('0x66')],'role':'agent'},'attributes':['id','name',_0x1e39('0x75'),'email',_0x1e39('0x76')],'raw':!![]});}return null;})[_0x1e39('0x23')](function(_0x2ef86b){if(!_0x2ef86b)return null;_0xe90245[_0x1e39('0x2b')][_0x1e39('0x65')]=_0x2ef86b;return _0xe90245;})[_0x1e39('0x23')](function(_0x35d6d9){if(_0x35d6d9){if(_0x399c40[_0x1e39('0x5c')][_0x1e39('0x77')]){_0xe90245[_0x1e39('0x2b')][_0x1e39('0x78')]=util[_0x1e39('0x62')](_0x1e39('0x79'),_0x399c40['user']['name']);_0xe90245[_0x1e39('0x2b')][_0x1e39('0x7a')]=_0xe90245[_0x1e39('0x7a')];_0xe90245['message'][_0x1e39('0x7b')]=_0xe90245[_0x1e39('0x7a')];_0xe90245['message'][_0x1e39('0x7c')]=_0x1e39('0x5f');return respondWithRpcPromise('EventManager',_0x1e39('0x7d'),{'event':'acceptmessage','message':_['merge'](_0xe90245['message'],JSON[_0x1e39('0x7e')](_0xe90245[_0x1e39('0x6b')][_0x1e39('0x7f')]))},client9002)[_0x1e39('0x23')](function(){return _0xe90245;});}return _0xe90245;}return null;})[_0x1e39('0x23')](respondWithResult(_0x2df461,null))[_0x1e39('0x2d')](handleError(_0x2df461,null));};var interaction_log=require('../../config/logger')(_0x1e39('0x5e'));exports[_0x1e39('0x35')]=function(_0x1bf11c,_0xe94775,_0x358571){var _0x4c4fe8={'agent':{},'channel':_0x1e39('0x60')};if(_0x1bf11c[_0x1e39('0x5c')]['id']){delete _0x1bf11c[_0x1e39('0x5c')]['id'];}_0x1bf11c[_0x1e39('0x5c')][_0x1e39('0x66')]=_0x1bf11c[_0x1e39('0x5c')][_0x1e39('0x66')]||_0x1bf11c['user']['id'];_0x4c4fe8[_0x1e39('0x65')]['id']=_0x1bf11c[_0x1e39('0x5c')][_0x1e39('0x66')];return db[_0x1e39('0x3c')]['find']({'where':{'id':_0x1bf11c[_0x1e39('0x57')]['id'],'UserId':null}})[_0x1e39('0x23')](handleEntityNotFound(_0xe94775,null))[_0x1e39('0x23')](function(_0x52c6bd){if(_0x52c6bd){_0x4c4fe8['message']=_0x52c6bd['get']({'plain':!![]});return db[_0x1e39('0x68')]['find']({'where':{'id':_0x52c6bd[_0x1e39('0x69')]}});}return null;})[_0x1e39('0x23')](handleEntityNotFound(_0xe94775,null))['then'](function(_0xae8212){if(_0xae8212){_0x4c4fe8['interaction']=_0xae8212[_0x1e39('0x67')]({'plain':!![]});interaction_log[_0x1e39('0x24')](_0x1e39('0x80'),_0x1bf11c['user']['id'],_0x1bf11c[_0x1e39('0x64')]['name'],_0x1bf11c[_0x1e39('0x64')][_0x1e39('0x81')],_0x4c4fe8[_0x1e39('0x6b')]['id'],_0x1bf11c['body']?JSON[_0x1e39('0x28')](_0x1bf11c[_0x1e39('0x5c')]):_0x1e39('0x6d'));return respondWithRpcPromise('RejectMessage',_0x1e39('0x82'),_0x4c4fe8);}return null;})[_0x1e39('0x23')](function(_0x2e993f){var _0x3209b0=_0x1e39('0x6f')+_0x2e993f[_0x1e39('0x2b')][_0x1e39('0x70')];return db[_0x1e39('0x71')][_0x1e39('0x44')](_0x3209b0,{'type':db[_0x1e39('0x72')][_0x1e39('0x73')][_0x1e39('0x83')],'raw':!![]})[_0x1e39('0x23')](function(_0xc28706){return _0xc28706;});})['then'](function(_0x1c63eb){if(_0x1c63eb){_0x4c4fe8['message']['contact']=_0x1c63eb[0x0];if(!_0x1bf11c[_0x1e39('0x5c')][_0x1e39('0x66')])return;return db[_0x1e39('0x84')][_0x1e39('0x5a')]({'where':{'id':_0x1bf11c[_0x1e39('0x5c')][_0x1e39('0x66')],'role':_0x1e39('0x65')},'attributes':['id',_0x1e39('0x3b'),_0x1e39('0x75'),_0x1e39('0x85'),'internal'],'raw':!![]});}return null;})[_0x1e39('0x23')](function(_0x15db87){if(!_0x15db87)return null;_0x4c4fe8[_0x1e39('0x2b')][_0x1e39('0x65')]=_0x15db87;return _0x4c4fe8;})['then'](function(_0x2109f8){if(_0x2109f8){_0x2109f8[_0x1e39('0x2b')][_0x1e39('0x78')]=util[_0x1e39('0x62')]('SIP/%s',_0x1bf11c[_0x1e39('0x64')][_0x1e39('0x3b')]);_0x2109f8['message'][_0x1e39('0x7a')]=_0x4c4fe8[_0x1e39('0x7a')];_0x2109f8[_0x1e39('0x2b')][_0x1e39('0x7b')]=_0x4c4fe8['channel'];_0x2109f8['message'][_0x1e39('0x7c')]=_0x1e39('0x35');respondWithRpcPromise('EventManager',_0x1e39('0x7d'),{'event':_0x1e39('0x86'),'message':_[_0x1e39('0x50')](_0x4c4fe8[_0x1e39('0x2b')],JSON[_0x1e39('0x7e')](_0x4c4fe8[_0x1e39('0x6b')]['formData']))},client9002);return _0x4c4fe8;}return null;})[_0x1e39('0x23')](respondWithResult(_0xe94775,null))[_0x1e39('0x2d')](handleError(_0xe94775,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8139637..7bc2e2b 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 _0xd5b9=['ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x377237,_0xb737bc){var _0x4eff1c=function(_0x1c022f){while(--_0x1c022f){_0x377237['push'](_0x377237['shift']());}};_0x4eff1c(++_0xb737bc);}(_0xd5b9,0xda));var _0x9d5b=function(_0x41cd0c,_0x59a279){_0x41cd0c=_0x41cd0c-0x0;var _0x598a9c=_0xd5b9[_0x41cd0c];return _0x598a9c;};'use strict';var EventEmitter=require(_0x9d5b('0x0'));var ChatMessage=require(_0x9d5b('0x1'))['db'][_0x9d5b('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9d5b('0x3')](0x0);var events={'afterCreate':_0x9d5b('0x4'),'afterUpdate':_0x9d5b('0x5'),'afterDestroy':_0x9d5b('0x6')};function emitEvent(_0x42959e){return function(_0x2069d0,_0x496c27,_0x1e5b58){ChatMessageEvents[_0x9d5b('0x7')](_0x42959e+':'+_0x2069d0['id'],_0x2069d0);ChatMessageEvents[_0x9d5b('0x7')](_0x42959e,_0x2069d0);_0x1e5b58(null);};}for(var e in events){if(events[_0x9d5b('0x8')](e)){var event=events[e];ChatMessage[_0x9d5b('0x9')](e,emitEvent(event));}}module[_0x9d5b('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0x9b2a=['exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0x9b2a,0x1e7));var _0xa9b2=function(_0x2e2e17,_0x1366f6){_0x2e2e17=_0x2e2e17-0x0;var _0x2dff2f=_0x9b2a[_0x2e2e17];return _0x2dff2f;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xa9b2('0x0'))['db'][_0xa9b2('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa9b2('0x2')](0x0);var events={'afterCreate':_0xa9b2('0x3'),'afterUpdate':_0xa9b2('0x4'),'afterDestroy':_0xa9b2('0x5')};function emitEvent(_0x5aa243){return function(_0x7cd48e,_0x299308,_0x2e6593){ChatMessageEvents['emit'](_0x5aa243+':'+_0x7cd48e['id'],_0x7cd48e);ChatMessageEvents['emit'](_0x5aa243,_0x7cd48e);_0x2e6593(null);};}for(var e in events){if(events[_0xa9b2('0x6')](e)){var event=events[e];ChatMessage[_0xa9b2('0x7')](e,emitEvent(event));}}module[_0xa9b2('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 adea838..8f38df0 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 _0x832e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5add09,_0x189557){var _0x509669=function(_0x414fb2){while(--_0x414fb2){_0x5add09['push'](_0x5add09['shift']());}};_0x509669(++_0x189557);}(_0x832e,0x13c));var _0xe832=function(_0x2c39d5,_0x1392a4){_0x2c39d5=_0x2c39d5-0x0;var _0x565490=_0x832e[_0x2c39d5];return _0x565490;};'use strict';var _=require(_0xe832('0x0'));var util=require(_0xe832('0x1'));var logger=require(_0xe832('0x2'))(_0xe832('0x3'));var moment=require(_0xe832('0x4'));var BPromise=require(_0xe832('0x5'));var rp=require(_0xe832('0x6'));var fs=require('fs');var path=require(_0xe832('0x7'));var rimraf=require(_0xe832('0x8'));var config=require(_0xe832('0x9'));var attributes=require('./chatMessage.attributes');module[_0xe832('0xa')]=function(_0x3587e9,_0x5d2b24){return _0x3587e9[_0xe832('0xb')](_0xe832('0xc'),attributes,{'tableName':_0xe832('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xe832('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18f9e8,_0x41f08d,_0x48007e){var _0x249205=_0x3587e9[_0xe832('0xf')];var _0x48b778=_0x18f9e8[_0xe832('0x10')]({'plain':!![]});if(_0x48b778[_0xe832('0x11')][_0xe832('0x12')]()==='in'||_0x48b778[_0xe832('0x11')][_0xe832('0x12')]()===_0xe832('0x13')&&!_0x48b778['secret']&&!_[_0xe832('0x14')](_0x48b778[_0xe832('0x15')])){_0x249205[_0xe832('0x16')]['findOne']({'where':{'id':_0x48b778['ChatInteractionId']}})[_0xe832('0x17')](function(_0x104bfa){if(_0x104bfa){_0x104bfa['update']({'lastMsgAt':_0x48b778[_0xe832('0x18')],'lastMsgDirection':_0x48b778[_0xe832('0x11')][_0xe832('0x12')]()});}})[_0xe832('0x19')](function(_0x26147a){console[_0xe832('0x1a')](_0x26147a);});}_0x48007e();}},'charset':_0xe832('0x1b'),'collate':_0xe832('0x1c')});}; \ No newline at end of file +var _0x96a5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','error','utf8mb4','lodash'];(function(_0x24afae,_0xc1e4eb){var _0x5713b5=function(_0x2a29dd){while(--_0x2a29dd){_0x24afae['push'](_0x24afae['shift']());}};_0x5713b5(++_0xc1e4eb);}(_0x96a5,0x17f));var _0x596a=function(_0xbee9b3,_0x344eab){_0xbee9b3=_0xbee9b3-0x0;var _0x26960e=_0x96a5[_0xbee9b3];return _0x26960e;};'use strict';var _=require(_0x596a('0x0'));var util=require(_0x596a('0x1'));var logger=require(_0x596a('0x2'))(_0x596a('0x3'));var moment=require(_0x596a('0x4'));var BPromise=require(_0x596a('0x5'));var rp=require(_0x596a('0x6'));var fs=require('fs');var path=require(_0x596a('0x7'));var rimraf=require(_0x596a('0x8'));var config=require(_0x596a('0x9'));var attributes=require(_0x596a('0xa'));module[_0x596a('0xb')]=function(_0x3d7f33,_0x276f2d){return _0x3d7f33[_0x596a('0xc')](_0x596a('0xd'),attributes,{'tableName':_0x596a('0xe'),'paranoid':![],'indexes':[{'name':_0x596a('0xf'),'fields':[_0x596a('0x10')],'type':_0x596a('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe56c80,_0x9e477,_0x160b97){var _0x3f7fb1=_0x3d7f33[_0x596a('0x12')];var _0x12e2b0=_0xe56c80[_0x596a('0x13')]({'plain':!![]});if(_0x12e2b0[_0x596a('0x14')][_0x596a('0x15')]()==='in'||_0x12e2b0['direction']['toLowerCase']()===_0x596a('0x16')&&!_0x12e2b0[_0x596a('0x17')]&&!_[_0x596a('0x18')](_0x12e2b0[_0x596a('0x19')])){_0x3f7fb1[_0x596a('0x1a')][_0x596a('0x1b')]({'where':{'id':_0x12e2b0[_0x596a('0x1c')]}})['then'](function(_0x52801c){if(_0x52801c){_0x52801c[_0x596a('0x1d')]({'lastMsgAt':_0x12e2b0['createdAt'],'lastMsgDirection':_0x12e2b0[_0x596a('0x14')][_0x596a('0x15')]()});}})['catch'](function(_0x27f885){console[_0x596a('0x1e')](_0x27f885);});}_0x160b97();}},'charset':_0x596a('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 71b1cc5..93ed2eb 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 _0x0ab2=['error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x56117b,_0x22c9a9){var _0x4f1cee=function(_0x568cb8){while(--_0x568cb8){_0x56117b['push'](_0x56117b['shift']());}};_0x4f1cee(++_0x22c9a9);}(_0x0ab2,0xfa));var _0x20ab=function(_0x181b84,_0x42f8f1){_0x181b84=_0x181b84-0x0;var _0x3f773d=_0x0ab2[_0x181b84];return _0x3f773d;};'use strict';var _=require('lodash');var util=require(_0x20ab('0x0'));var moment=require(_0x20ab('0x1'));var BPromise=require(_0x20ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20ab('0x3'));var db=require(_0x20ab('0x4'))['db'];var utils=require(_0x20ab('0x5'));var logger=require('../../config/logger')(_0x20ab('0x6'));var config=require('../../config/environment');var jayson=require(_0x20ab('0x7'));var client=jayson[_0x20ab('0x8')][_0x20ab('0x9')]({'port':0x232a});config[_0x20ab('0xa')]=_[_0x20ab('0xb')](config[_0x20ab('0xa')],{'host':_0x20ab('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20ab('0xa')]));require(_0x20ab('0xd'))[_0x20ab('0xe')](socket);function respondWithRpcPromise(_0x9dcf25,_0x2585bf,_0x2442ca){return new BPromise(function(_0x4012d4,_0x32418b){return client[_0x20ab('0xf')](_0x9dcf25,_0x2442ca)[_0x20ab('0x10')](function(_0x2096ad){logger[_0x20ab('0x11')](_0x20ab('0x12'),_0x2585bf,_0x20ab('0x13'));logger[_0x20ab('0x14')](_0x20ab('0x15'),_0x2585bf,_0x20ab('0x13'),JSON['stringify'](_0x2096ad));if(_0x2096ad['error']){if(_0x2096ad[_0x20ab('0x16')][_0x20ab('0x17')]===0x1f4){logger[_0x20ab('0x16')](_0x20ab('0x12'),_0x2585bf,_0x2096ad[_0x20ab('0x16')][_0x20ab('0x18')]);return _0x32418b(_0x2096ad[_0x20ab('0x16')]['message']);}logger[_0x20ab('0x16')](_0x20ab('0x12'),_0x2585bf,_0x2096ad[_0x20ab('0x16')]['message']);return _0x4012d4(_0x2096ad['error']['message']);}else{logger[_0x20ab('0x11')](_0x20ab('0x12'),_0x2585bf,_0x20ab('0x13'));_0x4012d4(_0x2096ad[_0x20ab('0x19')][_0x20ab('0x18')]);}})[_0x20ab('0x1a')](function(_0x23e76a){logger['error'](_0x20ab('0x12'),_0x2585bf,_0x23e76a);_0x32418b(_0x23e76a);});});}exports[_0x20ab('0x1b')]=function(_0x3c7b9b){var _0x1fe175=this;return new Promise(function(_0x3930ec,_0x46b86e){return db[_0x20ab('0x1c')][_0x20ab('0x1d')](_0x3c7b9b[_0x20ab('0x1e')],{'raw':_0x3c7b9b['options']?_0x3c7b9b[_0x20ab('0x1f')][_0x20ab('0x20')]===undefined?!![]:![]:!![]})[_0x20ab('0x10')](function(_0x5883b3){logger[_0x20ab('0x11')](_0x20ab('0x1b'),_0x3c7b9b);logger['debug'](_0x20ab('0x1b'),_0x3c7b9b,JSON[_0x20ab('0x21')](_0x5883b3));_0x3930ec(_0x5883b3);})[_0x20ab('0x1a')](function(_0x18063b){logger[_0x20ab('0x16')]('CreateChatMessage',_0x18063b[_0x20ab('0x18')],_0x3c7b9b);_0x46b86e(_0x1fe175['error'](0x1f4,_0x18063b[_0x20ab('0x18')]));});});}; \ No newline at end of file +var _0x5e6f=['socket.io-emitter','./chatMessage.socket','register','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','ChatMessage,\x20%s,\x20%s','error','message','catch','CreateChatMessage','create','body','options','raw','then','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x95916a,_0x3707d7){var _0x2a0ac4=function(_0x4754c4){while(--_0x4754c4){_0x95916a['push'](_0x95916a['shift']());}};_0x2a0ac4(++_0x3707d7);}(_0x5e6f,0x1c5));var _0xf5e6=function(_0x5deb0a,_0xc192bb){_0x5deb0a=_0x5deb0a-0x0;var _0x33d0ce=_0x5e6f[_0x5deb0a];return _0x33d0ce;};'use strict';var _=require(_0xf5e6('0x0'));var util=require(_0xf5e6('0x1'));var moment=require(_0xf5e6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf5e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf5e6('0x4'))(_0xf5e6('0x5'));var config=require(_0xf5e6('0x6'));var jayson=require(_0xf5e6('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf5e6('0x8')]=_[_0xf5e6('0x9')](config[_0xf5e6('0x8')],{'host':_0xf5e6('0xa'),'port':0x18eb});var socket=require(_0xf5e6('0xb'))(new Redis(config[_0xf5e6('0x8')]));require(_0xf5e6('0xc'))[_0xf5e6('0xd')](socket);function respondWithRpcPromise(_0x303a4f,_0x2c4443,_0x3f038f){return new BPromise(function(_0x38d06c,_0x59929f){return client['request'](_0x303a4f,_0x3f038f)['then'](function(_0x25c256){logger[_0xf5e6('0xe')]('ChatMessage,\x20%s,\x20%s',_0x2c4443,'request\x20sent');logger[_0xf5e6('0xf')](_0xf5e6('0x10'),_0x2c4443,_0xf5e6('0x11'),JSON[_0xf5e6('0x12')](_0x25c256));if(_0x25c256['error']){if(_0x25c256['error']['code']===0x1f4){logger['error'](_0xf5e6('0x13'),_0x2c4443,_0x25c256[_0xf5e6('0x14')][_0xf5e6('0x15')]);return _0x59929f(_0x25c256[_0xf5e6('0x14')][_0xf5e6('0x15')]);}logger[_0xf5e6('0x14')]('ChatMessage,\x20%s,\x20%s',_0x2c4443,_0x25c256[_0xf5e6('0x14')][_0xf5e6('0x15')]);return _0x38d06c(_0x25c256[_0xf5e6('0x14')][_0xf5e6('0x15')]);}else{logger['info'](_0xf5e6('0x13'),_0x2c4443,_0xf5e6('0x11'));_0x38d06c(_0x25c256['result']['message']);}})[_0xf5e6('0x16')](function(_0x5cfbe0){logger[_0xf5e6('0x14')]('ChatMessage,\x20%s,\x20%s',_0x2c4443,_0x5cfbe0);_0x59929f(_0x5cfbe0);});});}exports[_0xf5e6('0x17')]=function(_0x590e59){var _0x6070a4=this;return new Promise(function(_0x3d53d1,_0x235d89){return db['ChatMessage'][_0xf5e6('0x18')](_0x590e59[_0xf5e6('0x19')],{'raw':_0x590e59[_0xf5e6('0x1a')]?_0x590e59[_0xf5e6('0x1a')][_0xf5e6('0x1b')]===undefined?!![]:![]:!![]})[_0xf5e6('0x1c')](function(_0x4859f4){logger[_0xf5e6('0xe')](_0xf5e6('0x17'),_0x590e59);logger[_0xf5e6('0xf')](_0xf5e6('0x17'),_0x590e59,JSON[_0xf5e6('0x12')](_0x4859f4));_0x3d53d1(_0x4859f4);})[_0xf5e6('0x16')](function(_0x3ce649){logger[_0xf5e6('0x14')]('CreateChatMessage',_0x3ce649[_0xf5e6('0x15')],_0x590e59);_0x235d89(_0x6070a4[_0xf5e6('0x14')](0x1f4,_0x3ce649['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ed18966..fd839c7 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 _0x37a7=['chatMessage:','./chatMessage.events','save','removeListener','register'];(function(_0x4c912e,_0x27299d){var _0x2fa424=function(_0x4b0cfb){while(--_0x4b0cfb){_0x4c912e['push'](_0x4c912e['shift']());}};_0x2fa424(++_0x27299d);}(_0x37a7,0x6f));var _0x737a=function(_0x20993e,_0x110617){_0x20993e=_0x20993e-0x0;var _0x3f5292=_0x37a7[_0x20993e];return _0x3f5292;};'use strict';var ChatMessageEvents=require(_0x737a('0x0'));var events=[_0x737a('0x1'),'remove','update'];function createListener(_0x5a259b,_0x2d4b54){return function(_0xc5eaef){_0x2d4b54['emit'](_0x5a259b,_0xc5eaef);};}function removeListener(_0x524516,_0x4af128){return function(){ChatMessageEvents[_0x737a('0x2')](_0x524516,_0x4af128);};}exports[_0x737a('0x3')]=function(_0x7f4eed){for(var _0x11109c=0x0,_0x2f6800=events['length'];_0x11109c<_0x2f6800;_0x11109c++){var _0x244850=events[_0x11109c];var _0x249898=createListener(_0x737a('0x4')+_0x244850,_0x7f4eed);ChatMessageEvents['on'](_0x244850,_0x249898);}}; \ No newline at end of file +var _0xea31=['register','chatMessage:','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0xea31,0x6b));var _0x1ea3=function(_0x38b0d8,_0x17c058){_0x38b0d8=_0x38b0d8-0x0;var _0x427965=_0xea31[_0x38b0d8];return _0x427965;};'use strict';var ChatMessageEvents=require(_0x1ea3('0x0'));var events=['save',_0x1ea3('0x1'),_0x1ea3('0x2')];function createListener(_0x3b1d99,_0x153625){return function(_0x2dc24e){_0x153625[_0x1ea3('0x3')](_0x3b1d99,_0x2dc24e);};}function removeListener(_0x1142f1,_0x555620){return function(){ChatMessageEvents[_0x1ea3('0x4')](_0x1142f1,_0x555620);};}exports[_0x1ea3('0x5')]=function(_0x6810da){for(var _0x27c695=0x0,_0x13e6fb=events['length'];_0x27c695<_0x13e6fb;_0x27c695++){var _0x1fa3a8=events[_0x27c695];var _0x1b578e=createListener(_0x1ea3('0x6')+_0x1fa3a8,_0x6810da);ChatMessageEvents['on'](_0x1fa3a8,_0x1b578e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1d30866..fd227cc 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 _0x4fa8=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','describe','/:id','isAuthenticated','show','tracked','chat','create','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x4fa8,0xa3));var _0x84fa=function(_0x5d3882,_0x528ff0){_0x5d3882=_0x5d3882-0x0;var _0x20b576=_0x4fa8[_0x5d3882];return _0x20b576;};'use strict';var multer=require(_0x84fa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x84fa('0x1'));var express=require(_0x84fa('0x2'));var router=express['Router']();var fs_extra=require(_0x84fa('0x3'));var auth=require(_0x84fa('0x4'));var interaction=require(_0x84fa('0x5'));var config=require(_0x84fa('0x6'));var controller=require(_0x84fa('0x7'));router[_0x84fa('0x8')]('/',auth['isAuthenticated'](),controller[_0x84fa('0x9')]);router[_0x84fa('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x84fa('0xa')]);router['get'](_0x84fa('0xb'),auth[_0x84fa('0xc')](),controller[_0x84fa('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x84fa('0xe')](_0x84fa('0xf'),'chatmessage:create'),controller[_0x84fa('0x10')]);router[_0x84fa('0x11')](_0x84fa('0xb'),controller['update']);router[_0x84fa('0x11')](_0x84fa('0x12'),auth[_0x84fa('0xc')](),controller[_0x84fa('0x13')]);router[_0x84fa('0x11')](_0x84fa('0x14'),auth[_0x84fa('0xc')](),controller[_0x84fa('0x15')]);router[_0x84fa('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x84fa('0x17')]=router; \ No newline at end of file +var _0x5a95=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','chat','chatmessage:create','put','/:id/accept','accept','reject','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x1a20be,_0x2c18b8){var _0x147494=function(_0xe4fe4f){while(--_0xe4fe4f){_0x1a20be['push'](_0x1a20be['shift']());}};_0x147494(++_0x2c18b8);}(_0x5a95,0xd3));var _0x55a9=function(_0x370242,_0x17144a){_0x370242=_0x370242-0x0;var _0x2ccd21=_0x5a95[_0x370242];return _0x2ccd21;};'use strict';var multer=require(_0x55a9('0x0'));var util=require('util');var path=require(_0x55a9('0x1'));var timeout=require(_0x55a9('0x2'));var express=require(_0x55a9('0x3'));var router=express['Router']();var fs_extra=require(_0x55a9('0x4'));var auth=require(_0x55a9('0x5'));var interaction=require(_0x55a9('0x6'));var config=require(_0x55a9('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x55a9('0x8')](),controller[_0x55a9('0x9')]);router[_0x55a9('0xa')](_0x55a9('0xb'),auth[_0x55a9('0x8')](),controller[_0x55a9('0xc')]);router['get'](_0x55a9('0xd'),auth[_0x55a9('0x8')](),controller['show']);router[_0x55a9('0xe')]('/',auth[_0x55a9('0x8')](),interaction['tracked'](_0x55a9('0xf'),_0x55a9('0x10')),controller['create']);router['put'](_0x55a9('0xd'),controller['update']);router[_0x55a9('0x11')](_0x55a9('0x12'),auth[_0x55a9('0x8')](),controller[_0x55a9('0x13')]);router[_0x55a9('0x11')]('/:id/reject',auth[_0x55a9('0x8')](),controller[_0x55a9('0x14')]);router[_0x55a9('0x15')](_0x55a9('0xd'),auth[_0x55a9('0x8')](),controller[_0x55a9('0x16')]);module[_0x55a9('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 3faf47c..e85ec63 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 _0x4f4e=['sequelize','TEXT'];(function(_0x5ce487,_0x555c4f){var _0x5e289b=function(_0x15ff89){while(--_0x15ff89){_0x5ce487['push'](_0x5ce487['shift']());}};_0x5e289b(++_0x555c4f);}(_0x4f4e,0x142));var _0xe4f4=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x4f4e[_0x16938f];return _0x5c66e9;};'use strict';var Sequelize=require(_0xe4f4('0x0'));module['exports']={'body':{'type':Sequelize[_0xe4f4('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x7f92=['sequelize','exports','TEXT','medium'];(function(_0x2fcda1,_0x3f6814){var _0x243a92=function(_0x2d7043){while(--_0x2d7043){_0x2fcda1['push'](_0x2fcda1['shift']());}};_0x243a92(++_0x3f6814);}(_0x7f92,0x64));var _0x27f9=function(_0xe2d608,_0x31508c){_0xe2d608=_0xe2d608-0x0;var _0x27ca38=_0x7f92[_0xe2d608];return _0x27ca38;};'use strict';var Sequelize=require(_0x27f9('0x0'));module[_0x27f9('0x1')]={'body':{'type':Sequelize[_0x27f9('0x2')](_0x27f9('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 5388bb5..9c67fe8 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(_0x56cdd4,_0x4b1455){var _0x110634=function(_0x40c0de){while(--_0x40c0de){_0x56cdd4['push'](_0x56cdd4['shift']());}};_0x110634(++_0x4b1455);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 _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(_0x23b129,_0x12030c){var _0x1a4c39=function(_0x540d2a){while(--_0x540d2a){_0x23b129['push'](_0x23b129['shift']());}};_0x1a4c39(++_0x12030c);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index ccdde89..825c1d5 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 _0x870d=['exports','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x870d,0x187));var _0xd870=function(_0x9c8969,_0x46765a){_0x9c8969=_0x9c8969-0x0;var _0xb29dbd=_0x870d[_0x9c8969];return _0xb29dbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd870('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd870('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd870('0x2'));var rimraf=require(_0xd870('0x3'));var config=require(_0xd870('0x4'));var attributes=require('./chatOfflineMessage.attributes');module[_0xd870('0x5')]=function(_0x1609d4,_0x17cafb){return _0x1609d4['define'](_0xd870('0x6'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd870('0x7'),'collate':_0xd870('0x8')});}; \ No newline at end of file +var _0x112c=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0x112c,0xef));var _0xc112=function(_0x1a5db7,_0x35760a){_0x1a5db7=_0x1a5db7-0x0;var _0x624a34=_0x112c[_0x1a5db7];return _0x624a34;};'use strict';var _=require(_0xc112('0x0'));var util=require('util');var logger=require(_0xc112('0x1'))(_0xc112('0x2'));var moment=require(_0xc112('0x3'));var BPromise=require(_0xc112('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc112('0x5'));var rimraf=require(_0xc112('0x6'));var config=require(_0xc112('0x7'));var attributes=require(_0xc112('0x8'));module[_0xc112('0x9')]=function(_0x1da3b8,_0x5decc4){return _0x1da3b8[_0xc112('0xa')]('ChatOfflineMessage',attributes,{'tableName':_0xc112('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc112('0xc'),'collate':_0xc112('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ba90d56..edfd0de 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 _0x4fde=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x103989,_0x594901){var _0x2b1383=function(_0x26033f){while(--_0x26033f){_0x103989['push'](_0x103989['shift']());}};_0x2b1383(++_0x594901);}(_0x4fde,0x19f));var _0xe4fd=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x4fde[_0x3861f7];return _0x50879f;};'use strict';var _=require(_0xe4fd('0x0'));var util=require(_0xe4fd('0x1'));var moment=require(_0xe4fd('0x2'));var BPromise=require(_0xe4fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4fd('0x4'));var db=require(_0xe4fd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4fd('0x6'))(_0xe4fd('0x7'));var config=require(_0xe4fd('0x8'));var jayson=require(_0xe4fd('0x9'));var client=jayson[_0xe4fd('0xa')][_0xe4fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x439c7e,_0x26d781,_0x293acf){return new BPromise(function(_0x595e56,_0x32c847){return client['request'](_0x439c7e,_0x293acf)[_0xe4fd('0xc')](function(_0x49afd3){logger['info'](_0xe4fd('0xd'),_0x26d781,_0xe4fd('0xe'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x26d781,_0xe4fd('0xe'),JSON[_0xe4fd('0xf')](_0x49afd3));if(_0x49afd3[_0xe4fd('0x10')]){if(_0x49afd3['error'][_0xe4fd('0x11')]===0x1f4){logger[_0xe4fd('0x10')](_0xe4fd('0xd'),_0x26d781,_0x49afd3[_0xe4fd('0x10')][_0xe4fd('0x12')]);return _0x32c847(_0x49afd3[_0xe4fd('0x10')]['message']);}logger[_0xe4fd('0x10')](_0xe4fd('0xd'),_0x26d781,_0x49afd3[_0xe4fd('0x10')]['message']);return _0x595e56(_0x49afd3[_0xe4fd('0x10')][_0xe4fd('0x12')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x26d781,_0xe4fd('0xe'));_0x595e56(_0x49afd3[_0xe4fd('0x13')][_0xe4fd('0x12')]);}})['catch'](function(_0x2c2adf){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x26d781,_0x2c2adf);_0x32c847(_0x2c2adf);});});} \ No newline at end of file +var _0x3826=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x44607e,_0x117dcc){var _0x45db3e=function(_0x2d8eeb){while(--_0x2d8eeb){_0x44607e['push'](_0x44607e['shift']());}};_0x45db3e(++_0x117dcc);}(_0x3826,0x190));var _0x6382=function(_0x2df7c7,_0x5ec3eb){_0x2df7c7=_0x2df7c7-0x0;var _0x42995b=_0x3826[_0x2df7c7];return _0x42995b;};'use strict';var _=require(_0x6382('0x0'));var util=require(_0x6382('0x1'));var moment=require('moment');var BPromise=require(_0x6382('0x2'));var rs=require(_0x6382('0x3'));var fs=require('fs');var Redis=require(_0x6382('0x4'));var db=require(_0x6382('0x5'))['db'];var utils=require(_0x6382('0x6'));var logger=require(_0x6382('0x7'))('rpc');var config=require(_0x6382('0x8'));var jayson=require(_0x6382('0x9'));var client=jayson[_0x6382('0xa')][_0x6382('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x357b87,_0x8c9f1a,_0x3be9b9){return new BPromise(function(_0x4f5e31,_0xca0750){return client['request'](_0x357b87,_0x3be9b9)['then'](function(_0x37f373){logger[_0x6382('0xc')](_0x6382('0xd'),_0x8c9f1a,_0x6382('0xe'));logger[_0x6382('0xf')](_0x6382('0x10'),_0x8c9f1a,_0x6382('0xe'),JSON[_0x6382('0x11')](_0x37f373));if(_0x37f373['error']){if(_0x37f373[_0x6382('0x12')][_0x6382('0x13')]===0x1f4){logger[_0x6382('0x12')](_0x6382('0xd'),_0x8c9f1a,_0x37f373[_0x6382('0x12')][_0x6382('0x14')]);return _0xca0750(_0x37f373[_0x6382('0x12')][_0x6382('0x14')]);}logger[_0x6382('0x12')](_0x6382('0xd'),_0x8c9f1a,_0x37f373[_0x6382('0x12')][_0x6382('0x14')]);return _0x4f5e31(_0x37f373[_0x6382('0x12')]['message']);}else{logger[_0x6382('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x8c9f1a,_0x6382('0xe'));_0x4f5e31(_0x37f373[_0x6382('0x15')]['message']);}})[_0x6382('0x16')](function(_0x22b9b4){logger[_0x6382('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x8c9f1a,_0x22b9b4);_0xca0750(_0x22b9b4);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bf34130..afea147 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 _0xcc32=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x4eb517,_0x385479){var _0x30e9ed=function(_0x1825ef){while(--_0x1825ef){_0x4eb517['push'](_0x4eb517['shift']());}};_0x30e9ed(++_0x385479);}(_0xcc32,0x1a4));var _0x2cc3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcc32[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x2cc3('0x0'));var util=require('util');var path=require(_0x2cc3('0x1'));var timeout=require(_0x2cc3('0x2'));var express=require(_0x2cc3('0x3'));var router=express[_0x2cc3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2cc3('0x5'));var interaction=require(_0x2cc3('0x6'));var config=require(_0x2cc3('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x2cc3('0x8')]('/',auth[_0x2cc3('0x9')](),controller[_0x2cc3('0xa')]);router[_0x2cc3('0x8')](_0x2cc3('0xb'),auth[_0x2cc3('0x9')](),controller[_0x2cc3('0xc')]);router['get'](_0x2cc3('0xd'),auth[_0x2cc3('0x9')](),controller[_0x2cc3('0xe')]);router[_0x2cc3('0xf')]('/',auth[_0x2cc3('0x9')](),controller[_0x2cc3('0x10')]);router[_0x2cc3('0x11')](_0x2cc3('0xd'),auth[_0x2cc3('0x9')](),controller[_0x2cc3('0x12')]);router['delete'](_0x2cc3('0xd'),auth[_0x2cc3('0x9')](),controller[_0x2cc3('0x13')]);module[_0x2cc3('0x14')]=router; \ No newline at end of file +var _0x4593=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','path'];(function(_0x83b169,_0x392d60){var _0x8f726c=function(_0xe18fe5){while(--_0xe18fe5){_0x83b169['push'](_0x83b169['shift']());}};_0x8f726c(++_0x392d60);}(_0x4593,0x12f));var _0x3459=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x4593[_0x468b0f];return _0x3e74d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3459('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3459('0x1')]();var fs_extra=require(_0x3459('0x2'));var auth=require(_0x3459('0x3'));var interaction=require(_0x3459('0x4'));var config=require(_0x3459('0x5'));var controller=require(_0x3459('0x6'));router['get']('/',auth[_0x3459('0x7')](),controller['index']);router[_0x3459('0x8')](_0x3459('0x9'),auth['isAuthenticated'](),controller[_0x3459('0xa')]);router['get'](_0x3459('0xb'),auth['isAuthenticated'](),controller[_0x3459('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3459('0xd')]);router[_0x3459('0xe')]('/:id',auth[_0x3459('0x7')](),controller[_0x3459('0xf')]);router[_0x3459('0x10')](_0x3459('0xb'),auth[_0x3459('0x7')](),controller[_0x3459('0x11')]);module[_0x3459('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a926604..7291dbf 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 _0xfd2d=['INTEGER','STRING','mouseOver','timeout'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xfd2d,0x1bd));var _0xdfd2=function(_0x6935da,_0x3f8c67){_0x6935da=_0x6935da-0x0;var _0x51e54f=_0xfd2d[_0x6935da];return _0x51e54f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdfd2('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdfd2('0x1'),_0xdfd2('0x2')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xdfd2('0x0')]},'timeout':{'type':Sequelize[_0xdfd2('0x3')]}}; \ No newline at end of file +var _0x05ca=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0x4db3ac,_0x2aebb8){var _0x59a635=function(_0x2d888a){while(--_0x2d888a){_0x4db3ac['push'](_0x4db3ac['shift']());}};_0x59a635(++_0x2aebb8);}(_0x05ca,0x9e));var _0xa05c=function(_0x825d94,_0x2e8884){_0x825d94=_0x825d94-0x0;var _0x2cdd0d=_0x05ca[_0x825d94];return _0x2cdd0d;};'use strict';var Sequelize=require(_0xa05c('0x0'));module[_0xa05c('0x1')]={'name':{'type':Sequelize[_0xa05c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa05c('0x3'),_0xa05c('0x4')),'defaultValue':_0xa05c('0x3')},'selector':{'type':Sequelize[_0xa05c('0x2')]},'timeout':{'type':Sequelize[_0xa05c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b040c21..aef7148 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 _0xf041=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','filters','intersection','query','fields','attributes','includeAll','include','merge','find','catch','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x21705d,_0x52a5bd){var _0xaa4309=function(_0x441e16){while(--_0x441e16){_0x21705d['push'](_0x21705d['shift']());}};_0xaa4309(++_0x52a5bd);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f04('0x0'));var jsonpatch=require(_0x1f04('0x1'));var rp=require(_0x1f04('0x2'));var moment=require(_0x1f04('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f04('0x4'));var util=require('util');var path=require(_0x1f04('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f04('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f04('0x7'));var squel=require(_0x1f04('0x8'));var crypto=require(_0x1f04('0x9'));var jsforce=require(_0x1f04('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1f04('0xb'));var querystring=require(_0x1f04('0xc'));var Papa=require(_0x1f04('0xd'));var Redis=require(_0x1f04('0xe'));var authService=require(_0x1f04('0xf'));var qs=require(_0x1f04('0x10'));var as=require(_0x1f04('0x11'));var hardwareService=require(_0x1f04('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1f04('0x13'));var config=require(_0x1f04('0x14'));var licenseUtil=require(_0x1f04('0x15'));var db=require(_0x1f04('0x16'))['db'];function respondWithStatusCode(_0x10e1da,_0x28edce){_0x28edce=_0x28edce||0xcc;return function(_0x1a9b46){if(_0x1a9b46){return _0x10e1da[_0x1f04('0x17')](_0x28edce);}return _0x10e1da[_0x1f04('0x18')](_0x28edce)[_0x1f04('0x19')]();};}function respondWithResult(_0x306c30,_0x4ebd86){_0x4ebd86=_0x4ebd86||0xc8;return function(_0x5bd64c){if(_0x5bd64c){return _0x306c30[_0x1f04('0x18')](_0x4ebd86)[_0x1f04('0x1a')](_0x5bd64c);}};}function respondWithFilteredResult(_0x24d37c,_0x57de82){return function(_0x255fc8){if(_0x255fc8){var _0x57b4e5=typeof _0x57de82[_0x1f04('0x1b')]===_0x1f04('0x1c')&&typeof _0x57de82[_0x1f04('0x1d')]===_0x1f04('0x1c');var _0x1b2be5=_0x255fc8[_0x1f04('0x1e')];var _0x573dd6=_0x57b4e5?0x0:_0x57de82['offset'];var _0x148d2a=_0x57b4e5?_0x255fc8[_0x1f04('0x1e')]:_0x57de82[_0x1f04('0x1b')]+_0x57de82[_0x1f04('0x1d')];var _0x246d2a;if(_0x148d2a>=_0x1b2be5){_0x148d2a=_0x1b2be5;_0x246d2a=0xc8;}else{_0x246d2a=0xce;}_0x24d37c[_0x1f04('0x18')](_0x246d2a);return _0x24d37c[_0x1f04('0x1f')](_0x1f04('0x20'),_0x573dd6+'-'+_0x148d2a+'/'+_0x1b2be5)['json'](_0x255fc8);}return null;};}function patchUpdates(_0x2d325e){return function(_0x3de665){try{jsonpatch[_0x1f04('0x21')](_0x3de665,_0x2d325e,!![]);}catch(_0x57e85d){return BPromise[_0x1f04('0x22')](_0x57e85d);}return _0x3de665[_0x1f04('0x23')]();};}function saveUpdates(_0x570578,_0xae5976){return function(_0x272707){if(_0x272707){return _0x272707[_0x1f04('0x24')](_0x570578)[_0x1f04('0x25')](function(_0x3f3c1c){return _0x3f3c1c;});}return null;};}function removeEntity(_0x162d4f,_0x33ada4){return function(_0x4735a2){if(_0x4735a2){return _0x4735a2['destroy']()['then'](function(){_0x162d4f[_0x1f04('0x18')](0xcc)[_0x1f04('0x19')]();});}};}function handleEntityNotFound(_0x151437,_0x34bfcb){return function(_0x35ae83){if(!_0x35ae83){_0x151437[_0x1f04('0x17')](0x194);}return _0x35ae83;};}function handleError(_0x1932cc,_0x410eb4){_0x410eb4=_0x410eb4||0x1f4;return function(_0xfb5efa){logger[_0x1f04('0x26')](_0xfb5efa[_0x1f04('0x27')]);if(_0xfb5efa[_0x1f04('0x28')]){delete _0xfb5efa[_0x1f04('0x28')];}_0x1932cc['status'](_0x410eb4)[_0x1f04('0x29')](_0xfb5efa);};}exports[_0x1f04('0x2a')]=function(_0x1d748c,_0x3121f9){var _0x22848d={'raw':!![],'where':{'id':_0x1d748c[_0x1f04('0x2b')]['id']}},_0x163adf={};_0x163adf[_0x1f04('0x2c')]=_[_0x1f04('0x2d')](db[_0x1f04('0x2e')][_0x1f04('0x2f')]);_0x163adf['query']=_[_0x1f04('0x2d')](_0x1d748c['query']);_0x163adf[_0x1f04('0x30')]=_[_0x1f04('0x31')](_0x163adf[_0x1f04('0x2c')],_0x163adf[_0x1f04('0x32')]);_0x22848d['attributes']=_[_0x1f04('0x31')](_0x163adf[_0x1f04('0x2c')],qs[_0x1f04('0x33')](_0x1d748c[_0x1f04('0x32')][_0x1f04('0x33')]));_0x22848d[_0x1f04('0x34')]=_0x22848d[_0x1f04('0x34')]['length']?_0x22848d[_0x1f04('0x34')]:_0x163adf['model'];if(_0x1d748c['query'][_0x1f04('0x35')]){_0x22848d[_0x1f04('0x36')]=[{'all':!![]}];}_0x22848d=_[_0x1f04('0x37')]({},_0x22848d,_0x1d748c['options']);return db[_0x1f04('0x2e')][_0x1f04('0x38')](_0x22848d)[_0x1f04('0x25')](handleEntityNotFound(_0x3121f9,null))['then'](respondWithResult(_0x3121f9,null))[_0x1f04('0x39')](handleError(_0x3121f9,null));};exports['create']=function(_0x2dfccd,_0x3a148d){return db[_0x1f04('0x2e')][_0x1f04('0x3a')](_0x2dfccd[_0x1f04('0x3b')],{})[_0x1f04('0x25')](respondWithResult(_0x3a148d,0xc9))[_0x1f04('0x39')](handleError(_0x3a148d,null));};exports[_0x1f04('0x24')]=function(_0x42415e,_0xbae334){if(_0x42415e[_0x1f04('0x3b')]['id']){delete _0x42415e[_0x1f04('0x3b')]['id'];}return db['ChatProactiveAction'][_0x1f04('0x38')]({'where':{'id':_0x42415e['params']['id']}})[_0x1f04('0x25')](handleEntityNotFound(_0xbae334,null))[_0x1f04('0x25')](saveUpdates(_0x42415e[_0x1f04('0x3b')],null))[_0x1f04('0x25')](respondWithResult(_0xbae334,null))[_0x1f04('0x39')](handleError(_0xbae334,null));};exports[_0x1f04('0x3c')]=function(_0x316f58,_0x2b550b){return db[_0x1f04('0x2e')][_0x1f04('0x38')]({'where':{'id':_0x316f58[_0x1f04('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2b550b,null))[_0x1f04('0x25')](removeEntity(_0x2b550b,null))[_0x1f04('0x39')](handleError(_0x2b550b,null));}; \ No newline at end of file +var _0x95d9=['update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x2bc836,_0x5c1a7f){var _0x382fbd=function(_0x280b1d){while(--_0x280b1d){_0x2bc836['push'](_0x2bc836['shift']());}};_0x382fbd(++_0x5c1a7f);}(_0x95d9,0x97));var _0x995d=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x95d9[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require(_0x995d('0x0'));var rimraf=require(_0x995d('0x1'));var zipdir=require(_0x995d('0x2'));var jsonpatch=require(_0x995d('0x3'));var rp=require('request-promise');var moment=require(_0x995d('0x4'));var BPromise=require(_0x995d('0x5'));var Mustache=require(_0x995d('0x6'));var util=require('util');var path=require(_0x995d('0x7'));var sox=require(_0x995d('0x8'));var csv=require(_0x995d('0x9'));var ejs=require(_0x995d('0xa'));var fs=require('fs');var fs_extra=require(_0x995d('0xb'));var _=require('lodash');var squel=require(_0x995d('0xc'));var crypto=require(_0x995d('0xd'));var jsforce=require(_0x995d('0xe'));var deskjs=require(_0x995d('0xf'));var toCsv=require(_0x995d('0x9'));var querystring=require(_0x995d('0x10'));var Papa=require('papaparse');var Redis=require(_0x995d('0x11'));var authService=require(_0x995d('0x12'));var qs=require(_0x995d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x995d('0x14'));var config=require(_0x995d('0x15'));var licenseUtil=require(_0x995d('0x16'));var db=require(_0x995d('0x17'))['db'];function respondWithStatusCode(_0x2dc477,_0x5134f6){_0x5134f6=_0x5134f6||0xcc;return function(_0x2f9e79){if(_0x2f9e79){return _0x2dc477[_0x995d('0x18')](_0x5134f6);}return _0x2dc477[_0x995d('0x19')](_0x5134f6)[_0x995d('0x1a')]();};}function respondWithResult(_0x543a98,_0x38b03c){_0x38b03c=_0x38b03c||0xc8;return function(_0x4f12ba){if(_0x4f12ba){return _0x543a98[_0x995d('0x19')](_0x38b03c)['json'](_0x4f12ba);}};}function respondWithFilteredResult(_0x54f1d8,_0x7f4e07){return function(_0x53d041){if(_0x53d041){var _0x44230d=typeof _0x7f4e07[_0x995d('0x1b')]===_0x995d('0x1c')&&typeof _0x7f4e07[_0x995d('0x1d')]===_0x995d('0x1c');var _0x294efb=_0x53d041[_0x995d('0x1e')];var _0xa3ca7a=_0x44230d?0x0:_0x7f4e07[_0x995d('0x1b')];var _0x2c3ed4=_0x44230d?_0x53d041[_0x995d('0x1e')]:_0x7f4e07[_0x995d('0x1b')]+_0x7f4e07[_0x995d('0x1d')];var _0x2705cf;if(_0x2c3ed4>=_0x294efb){_0x2c3ed4=_0x294efb;_0x2705cf=0xc8;}else{_0x2705cf=0xce;}_0x54f1d8[_0x995d('0x19')](_0x2705cf);return _0x54f1d8[_0x995d('0x1f')](_0x995d('0x20'),_0xa3ca7a+'-'+_0x2c3ed4+'/'+_0x294efb)['json'](_0x53d041);}return null;};}function patchUpdates(_0x2ec018){return function(_0x14c706){try{jsonpatch['apply'](_0x14c706,_0x2ec018,!![]);}catch(_0x317d76){return BPromise[_0x995d('0x21')](_0x317d76);}return _0x14c706[_0x995d('0x22')]();};}function saveUpdates(_0x542aae,_0x30a59c){return function(_0x511cb3){if(_0x511cb3){return _0x511cb3[_0x995d('0x23')](_0x542aae)[_0x995d('0x24')](function(_0x11f1e3){return _0x11f1e3;});}return null;};}function removeEntity(_0x3754a2,_0x380359){return function(_0x539208){if(_0x539208){return _0x539208[_0x995d('0x25')]()[_0x995d('0x24')](function(){_0x3754a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18f4bb,_0x488503){return function(_0x5aa2ba){if(!_0x5aa2ba){_0x18f4bb['sendStatus'](0x194);}return _0x5aa2ba;};}function handleError(_0x19e68d,_0x260ffa){_0x260ffa=_0x260ffa||0x1f4;return function(_0x27e402){logger[_0x995d('0x26')](_0x27e402[_0x995d('0x27')]);if(_0x27e402['name']){delete _0x27e402[_0x995d('0x28')];}_0x19e68d[_0x995d('0x19')](_0x260ffa)[_0x995d('0x29')](_0x27e402);};}exports[_0x995d('0x2a')]=function(_0x534f01,_0x28be92){var _0x373e79={'raw':!![],'where':{'id':_0x534f01[_0x995d('0x2b')]['id']}},_0x5c2e1c={};_0x5c2e1c[_0x995d('0x2c')]=_[_0x995d('0x2d')](db[_0x995d('0x2e')][_0x995d('0x2f')]);_0x5c2e1c[_0x995d('0x30')]=_['keys'](_0x534f01['query']);_0x5c2e1c[_0x995d('0x31')]=_['intersection'](_0x5c2e1c[_0x995d('0x2c')],_0x5c2e1c[_0x995d('0x30')]);_0x373e79[_0x995d('0x32')]=_[_0x995d('0x33')](_0x5c2e1c[_0x995d('0x2c')],qs['fields'](_0x534f01[_0x995d('0x30')][_0x995d('0x34')]));_0x373e79[_0x995d('0x32')]=_0x373e79['attributes'][_0x995d('0x35')]?_0x373e79['attributes']:_0x5c2e1c[_0x995d('0x2c')];if(_0x534f01[_0x995d('0x30')][_0x995d('0x36')]){_0x373e79[_0x995d('0x37')]=[{'all':!![]}];}_0x373e79=_[_0x995d('0x38')]({},_0x373e79,_0x534f01[_0x995d('0x39')]);return db[_0x995d('0x2e')][_0x995d('0x3a')](_0x373e79)[_0x995d('0x24')](handleEntityNotFound(_0x28be92,null))[_0x995d('0x24')](respondWithResult(_0x28be92,null))[_0x995d('0x3b')](handleError(_0x28be92,null));};exports[_0x995d('0x3c')]=function(_0x383ea4,_0x27e238){return db[_0x995d('0x2e')][_0x995d('0x3c')](_0x383ea4[_0x995d('0x3d')],{})[_0x995d('0x24')](respondWithResult(_0x27e238,0xc9))['catch'](handleError(_0x27e238,null));};exports[_0x995d('0x23')]=function(_0x1a5386,_0x2dcd8a){if(_0x1a5386['body']['id']){delete _0x1a5386['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x1a5386[_0x995d('0x2b')]['id']}})[_0x995d('0x24')](handleEntityNotFound(_0x2dcd8a,null))[_0x995d('0x24')](saveUpdates(_0x1a5386[_0x995d('0x3d')],null))['then'](respondWithResult(_0x2dcd8a,null))[_0x995d('0x3b')](handleError(_0x2dcd8a,null));};exports[_0x995d('0x25')]=function(_0x5dfb1f,_0x43a34b){return db[_0x995d('0x2e')][_0x995d('0x3a')]({'where':{'id':_0x5dfb1f[_0x995d('0x2b')]['id']}})[_0x995d('0x24')](handleEntityNotFound(_0x43a34b,null))['then'](removeEntity(_0x43a34b,null))[_0x995d('0x3b')](handleError(_0x43a34b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6a176b2..17c63a5 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 _0xea5d=['../../config/logger','moment','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util'];(function(_0x141bd4,_0x3259f7){var _0x332e6d=function(_0x395208){while(--_0x395208){_0x141bd4['push'](_0x141bd4['shift']());}};_0x332e6d(++_0x3259f7);}(_0xea5d,0x154));var _0xdea5=function(_0x31a2cf,_0x36c3b1){_0x31a2cf=_0x31a2cf-0x0;var _0x533d29=_0xea5d[_0x31a2cf];return _0x533d29;};'use strict';var _=require(_0xdea5('0x0'));var util=require(_0xdea5('0x1'));var logger=require(_0xdea5('0x2'))('api');var moment=require(_0xdea5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdea5('0x4'));var attributes=require(_0xdea5('0x5'));module[_0xdea5('0x6')]=function(_0x55a870,_0x41a506){return _0x55a870['define'](_0xdea5('0x7'),attributes,{'tableName':_0xdea5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dbd=['request-promise','rimraf','./chatProactiveAction.attributes','exports','lodash','util','../../config/logger','api','moment'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x5dbd,0x109));var _0xd5db=function(_0x315cda,_0x464236){_0x315cda=_0x315cda-0x0;var _0x41560c=_0x5dbd[_0x315cda];return _0x41560c;};'use strict';var _=require(_0xd5db('0x0'));var util=require(_0xd5db('0x1'));var logger=require(_0xd5db('0x2'))(_0xd5db('0x3'));var moment=require(_0xd5db('0x4'));var BPromise=require('bluebird');var rp=require(_0xd5db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5db('0x6'));var config=require('../../config/environment');var attributes=require(_0xd5db('0x7'));module[_0xd5db('0x8')]=function(_0x3a90e5,_0x3c7d3a){return _0x3a90e5['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 77104a8..dd42e94 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 _0xed17=['http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xed17,0x9e));var _0x7ed1=function(_0x454bd3,_0x3e4d94){_0x454bd3=_0x454bd3-0x0;var _0x4eb066=_0xed17[_0x454bd3];return _0x4eb066;};'use strict';var _=require(_0x7ed1('0x0'));var util=require('util');var moment=require(_0x7ed1('0x1'));var BPromise=require(_0x7ed1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ed1('0x3'));var db=require(_0x7ed1('0x4'))['db'];var utils=require(_0x7ed1('0x5'));var logger=require('../../config/logger')(_0x7ed1('0x6'));var config=require(_0x7ed1('0x7'));var jayson=require(_0x7ed1('0x8'));var client=jayson[_0x7ed1('0x9')][_0x7ed1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aeb87,_0x213968,_0x4e630d){return new BPromise(function(_0x31ee46,_0x54d8a6){return client[_0x7ed1('0xb')](_0x1aeb87,_0x4e630d)[_0x7ed1('0xc')](function(_0x477404){logger['info'](_0x7ed1('0xd'),_0x213968,_0x7ed1('0xe'));logger['debug'](_0x7ed1('0xf'),_0x213968,'request\x20sent',JSON[_0x7ed1('0x10')](_0x477404));if(_0x477404[_0x7ed1('0x11')]){if(_0x477404[_0x7ed1('0x11')][_0x7ed1('0x12')]===0x1f4){logger['error'](_0x7ed1('0xd'),_0x213968,_0x477404[_0x7ed1('0x11')][_0x7ed1('0x13')]);return _0x54d8a6(_0x477404[_0x7ed1('0x11')]['message']);}logger[_0x7ed1('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x213968,_0x477404[_0x7ed1('0x11')][_0x7ed1('0x13')]);return _0x31ee46(_0x477404[_0x7ed1('0x11')][_0x7ed1('0x13')]);}else{logger[_0x7ed1('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x213968,_0x7ed1('0xe'));_0x31ee46(_0x477404['result'][_0x7ed1('0x13')]);}})['catch'](function(_0x2f8577){logger[_0x7ed1('0x11')](_0x7ed1('0xd'),_0x213968,_0x2f8577);_0x54d8a6(_0x2f8577);});});} \ No newline at end of file +var _0xc026=['debug','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x31abd7,_0x4cd79d){var _0x58c8ae=function(_0x48ceb5){while(--_0x48ceb5){_0x31abd7['push'](_0x31abd7['shift']());}};_0x58c8ae(++_0x4cd79d);}(_0xc026,0x111));var _0x6c02=function(_0x20a330,_0x4b6f2b){_0x20a330=_0x20a330-0x0;var _0xf218e1=_0xc026[_0x20a330];return _0xf218e1;};'use strict';var _=require('lodash');var util=require(_0x6c02('0x0'));var moment=require(_0x6c02('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c02('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c02('0x3'))['db'];var utils=require(_0x6c02('0x4'));var logger=require(_0x6c02('0x5'))(_0x6c02('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6c02('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc39db0,_0x42976c,_0x10c8de){return new BPromise(function(_0x28ab72,_0x1458c3){return client[_0x6c02('0x8')](_0xc39db0,_0x10c8de)['then'](function(_0x4198f3){logger[_0x6c02('0x9')](_0x6c02('0xa'),_0x42976c,_0x6c02('0xb'));logger[_0x6c02('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x42976c,_0x6c02('0xb'),JSON[_0x6c02('0xd')](_0x4198f3));if(_0x4198f3['error']){if(_0x4198f3[_0x6c02('0xe')][_0x6c02('0xf')]===0x1f4){logger[_0x6c02('0xe')](_0x6c02('0xa'),_0x42976c,_0x4198f3[_0x6c02('0xe')]['message']);return _0x1458c3(_0x4198f3['error']['message']);}logger[_0x6c02('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x42976c,_0x4198f3[_0x6c02('0xe')][_0x6c02('0x10')]);return _0x28ab72(_0x4198f3[_0x6c02('0xe')][_0x6c02('0x10')]);}else{logger[_0x6c02('0x9')]('ChatProactiveAction,\x20%s,\x20%s',_0x42976c,_0x6c02('0xb'));_0x28ab72(_0x4198f3[_0x6c02('0x11')][_0x6c02('0x10')]);}})[_0x6c02('0x12')](function(_0x443192){logger[_0x6c02('0xe')](_0x6c02('0xa'),_0x42976c,_0x443192);_0x1458c3(_0x443192);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ca6a290..3a2d34b 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 _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x5e8965,_0x744744){var _0x5efd03=function(_0xc82aa1){while(--_0xc82aa1){_0x5e8965['push'](_0x5e8965['shift']());}};_0x5efd03(++_0x744744);}(_0x814b,0x1a2));var _0xb814=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x814b[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')](_0xb814('0xb'),auth['isAuthenticated'](),controller[_0xb814('0xc')]);router[_0xb814('0xd')]('/',auth['isAuthenticated'](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xb'),auth[_0xb814('0x10')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xb'),auth[_0xb814('0x10')](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0x7c09=['delete','/:id','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','show','post','isAuthenticated','create','put'];(function(_0x3f787e,_0x951303){var _0x26242d=function(_0x58622a){while(--_0x58622a){_0x3f787e['push'](_0x3f787e['shift']());}};_0x26242d(++_0x951303);}(_0x7c09,0x102));var _0x97c0=function(_0x50280c,_0x34e3ea){_0x50280c=_0x50280c-0x0;var _0x45dff7=_0x7c09[_0x50280c];return _0x45dff7;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var fs_extra=require(_0x97c0('0x4'));var auth=require(_0x97c0('0x5'));var interaction=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var controller=require(_0x97c0('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x97c0('0x9')]);router[_0x97c0('0xa')]('/',auth[_0x97c0('0xb')](),controller[_0x97c0('0xc')]);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xb')](),controller['update']);router[_0x97c0('0xe')](_0x97c0('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x97c0('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 7b0c560..b29fccb 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 _0x8ee7=['INTEGER','rrmemory','sequelize','exports','STRING','name'];(function(_0x1c11cb,_0x5c6184){var _0x377395=function(_0x2174b1){while(--_0x2174b1){_0x1c11cb['push'](_0x1c11cb['shift']());}};_0x377395(++_0x5c6184);}(_0x8ee7,0x1b2));var _0x78ee=function(_0x54ac71,_0x1043f6){_0x54ac71=_0x54ac71-0x0;var _0xc11d8d=_0x8ee7[_0x54ac71];return _0xc11d8d;};'use strict';var Sequelize=require(_0x78ee('0x0'));module[_0x78ee('0x1')]={'name':{'type':Sequelize[_0x78ee('0x2')],'unique':_0x78ee('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x78ee('0x2')]},'timeout':{'type':Sequelize[_0x78ee('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x78ee('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xda7e=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x2318b4,_0xa63f2a){var _0x1aeee6=function(_0x4a0284){while(--_0x4a0284){_0x2318b4['push'](_0x2318b4['shift']());}};_0x1aeee6(++_0xa63f2a);}(_0xda7e,0x7d));var _0xeda7=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0xda7e[_0x146a85];return _0x1b59bf;};'use strict';var Sequelize=require(_0xeda7('0x0'));module[_0xeda7('0x1')]={'name':{'type':Sequelize[_0xeda7('0x2')],'unique':_0xeda7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeda7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeda7('0x4')](_0xeda7('0x5'),_0xeda7('0x6'),_0xeda7('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 70dee8e..4870e5b 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 _0x76d3=['ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','ChatQueues','UserProfileResource','stack','name','send','index','rawAttributes','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','ChatQueue','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction','userChatQueue:remove','addAgents','omit','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x556d7a,_0x2cfa75){var _0x15968a=function(_0x2aa01a){while(--_0x2aa01a){_0x556d7a['push'](_0x556d7a['shift']());}};_0x15968a(++_0x2cfa75);}(_0x76d3,0x1a0));var _0x376d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x76d3[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x376d('0x0'));var rimraf=require(_0x376d('0x1'));var zipdir=require(_0x376d('0x2'));var jsonpatch=require(_0x376d('0x3'));var rp=require(_0x376d('0x4'));var moment=require(_0x376d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x376d('0x6'));var util=require('util');var path=require(_0x376d('0x7'));var sox=require(_0x376d('0x8'));var csv=require(_0x376d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x376d('0xa'));var _=require(_0x376d('0xb'));var squel=require(_0x376d('0xc'));var crypto=require(_0x376d('0xd'));var jsforce=require(_0x376d('0xe'));var deskjs=require(_0x376d('0xf'));var toCsv=require(_0x376d('0x9'));var querystring=require(_0x376d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x376d('0x11'));var qs=require(_0x376d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x376d('0x13'));var utils=require(_0x376d('0x14'));var config=require(_0x376d('0x15'));var licenseUtil=require(_0x376d('0x16'));var db=require('../../mysqldb')['db'];config[_0x376d('0x17')]=_[_0x376d('0x18')](config['redis'],{'host':_0x376d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x376d('0x17')]));require(_0x376d('0x1a'))[_0x376d('0x1b')](socket);var jayson=require(_0x376d('0x1c'));var client=jayson[_0x376d('0x1d')][_0x376d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x7197d2,_0x38070a,_0x5b61e5,_0x263b69){return new BPromise(function(_0x284349,_0x1a2ff9){var _0x270a74=_0x263b69||client;return _0x270a74[_0x376d('0x1f')](_0x7197d2,_0x5b61e5)[_0x376d('0x20')](function(_0x17c3e8){logger[_0x376d('0x21')](_0x376d('0x22'),_0x38070a,_0x376d('0x23'));logger[_0x376d('0x24')](_0x376d('0x25'),_0x38070a,_0x376d('0x23'),JSON['stringify'](_0x17c3e8));if(_0x17c3e8['error']){if(_0x17c3e8[_0x376d('0x26')]['code']===0x1f4){logger[_0x376d('0x26')](_0x376d('0x22'),_0x38070a,_0x17c3e8[_0x376d('0x26')][_0x376d('0x27')]);return _0x1a2ff9(_0x17c3e8[_0x376d('0x26')]['message']);}logger[_0x376d('0x26')](_0x376d('0x22'),_0x38070a,_0x17c3e8[_0x376d('0x26')][_0x376d('0x27')]);return _0x284349(_0x17c3e8[_0x376d('0x26')]['message']);}else{logger['info'](_0x376d('0x22'),_0x38070a,_0x376d('0x23'));_0x284349(_0x17c3e8[_0x376d('0x28')]['message']);}})[_0x376d('0x29')](function(_0x1d0cae){logger['error']('ChatQueue,\x20%s,\x20%s',_0x38070a,_0x1d0cae);_0x1a2ff9(_0x1d0cae);});});}function respondWithStatusCode(_0x1b0e1f,_0x586159){_0x586159=_0x586159||0xcc;return function(_0x141086){if(_0x141086){return _0x1b0e1f[_0x376d('0x2a')](_0x586159);}return _0x1b0e1f[_0x376d('0x2b')](_0x586159)[_0x376d('0x2c')]();};}function respondWithResult(_0x56e493,_0x4ad084){_0x4ad084=_0x4ad084||0xc8;return function(_0x5eeb18){if(_0x5eeb18){return _0x56e493[_0x376d('0x2b')](_0x4ad084)[_0x376d('0x2d')](_0x5eeb18);}};}function respondWithFilteredResult(_0x21d9c5,_0x1a7ae4){return function(_0x9ef77b){if(_0x9ef77b){var _0x2f8dd1=typeof _0x1a7ae4[_0x376d('0x2e')]===_0x376d('0x2f')&&typeof _0x1a7ae4[_0x376d('0x30')]===_0x376d('0x2f');var _0x109e2e=_0x9ef77b['count'];var _0x33c5c4=_0x2f8dd1?0x0:_0x1a7ae4[_0x376d('0x2e')];var _0x38a62d=_0x2f8dd1?_0x9ef77b[_0x376d('0x31')]:_0x1a7ae4[_0x376d('0x2e')]+_0x1a7ae4[_0x376d('0x30')];var _0x1eb09d;if(_0x38a62d>=_0x109e2e){_0x38a62d=_0x109e2e;_0x1eb09d=0xc8;}else{_0x1eb09d=0xce;}_0x21d9c5[_0x376d('0x2b')](_0x1eb09d);return _0x21d9c5[_0x376d('0x32')](_0x376d('0x33'),_0x33c5c4+'-'+_0x38a62d+'/'+_0x109e2e)[_0x376d('0x2d')](_0x9ef77b);}return null;};}function patchUpdates(_0x51ea6f){return function(_0x136ca8){try{jsonpatch['apply'](_0x136ca8,_0x51ea6f,!![]);}catch(_0x2c6500){return BPromise[_0x376d('0x34')](_0x2c6500);}return _0x136ca8[_0x376d('0x35')]();};}function saveUpdates(_0x57898e,_0x48f919){return function(_0x5b0fca){if(_0x5b0fca){return _0x5b0fca['update'](_0x57898e)[_0x376d('0x20')](function(_0x5667fb){return _0x5667fb;});}return null;};}function removeEntity(_0xae9530,_0x4f4a37){return function(_0x583022){if(_0x583022){return _0x583022[_0x376d('0x36')]()[_0x376d('0x20')](function(){var _0x5b0280=_0x583022['get']({'plain':!![]});var _0x4a3479=_0x376d('0x37');return db[_0x376d('0x38')][_0x376d('0x36')]({'where':{'type':_0x4a3479,'resourceId':_0x5b0280['id']}})[_0x376d('0x20')](function(){return _0x583022;});})['then'](function(){_0xae9530['status'](0xcc)[_0x376d('0x2c')]();});}};}function handleEntityNotFound(_0x107866,_0x21a0d0){return function(_0x3ec4bf){if(!_0x3ec4bf){_0x107866['sendStatus'](0x194);}return _0x3ec4bf;};}function handleError(_0x29b2a8,_0x36f29b){_0x36f29b=_0x36f29b||0x1f4;return function(_0x38988d){logger[_0x376d('0x26')](_0x38988d[_0x376d('0x39')]);if(_0x38988d['name']){delete _0x38988d[_0x376d('0x3a')];}_0x29b2a8['status'](_0x36f29b)[_0x376d('0x3b')](_0x38988d);};}exports[_0x376d('0x3c')]=function(_0x796d1,_0x3447b7){var _0x4761a4={},_0x1a5c48={},_0x5b5e66={'count':0x0,'rows':[]};var _0x2a9365=_['map'](db['ChatQueue'][_0x376d('0x3d')],function(_0x4ab90f){return{'name':_0x4ab90f['fieldName'],'type':_0x4ab90f['type']['key']};});_0x1a5c48[_0x376d('0x3e')]=_[_0x376d('0x3f')](_0x2a9365,_0x376d('0x3a'));_0x1a5c48[_0x376d('0x40')]=_['keys'](_0x796d1['query']);_0x1a5c48[_0x376d('0x41')]=_['intersection'](_0x1a5c48[_0x376d('0x3e')],_0x1a5c48['query']);_0x4761a4[_0x376d('0x42')]=_[_0x376d('0x43')](_0x1a5c48['model'],qs['fields'](_0x796d1['query'][_0x376d('0x44')]));_0x4761a4[_0x376d('0x42')]=_0x4761a4[_0x376d('0x42')][_0x376d('0x45')]?_0x4761a4[_0x376d('0x42')]:_0x1a5c48[_0x376d('0x3e')];if(!_0x796d1[_0x376d('0x40')][_0x376d('0x46')](_0x376d('0x47'))){_0x4761a4['limit']=qs[_0x376d('0x30')](_0x796d1[_0x376d('0x40')][_0x376d('0x30')]);_0x4761a4['offset']=qs[_0x376d('0x2e')](_0x796d1[_0x376d('0x40')]['offset']);}_0x4761a4[_0x376d('0x48')]=qs[_0x376d('0x49')](_0x796d1['query'][_0x376d('0x49')]);_0x4761a4[_0x376d('0x4a')]=qs[_0x376d('0x41')](_[_0x376d('0x4b')](_0x796d1[_0x376d('0x40')],_0x1a5c48[_0x376d('0x41')]),_0x2a9365);if(_0x796d1[_0x376d('0x40')]['filter']){_0x4761a4[_0x376d('0x4a')]=_[_0x376d('0x4c')](_0x4761a4[_0x376d('0x4a')],{'$or':_[_0x376d('0x3f')](_0x2a9365,function(_0x1c5b06){if(_0x1c5b06['type']!=='VIRTUAL'){var _0x584ce9={};_0x584ce9[_0x1c5b06[_0x376d('0x3a')]]={'$like':'%'+_0x796d1[_0x376d('0x40')][_0x376d('0x4d')]+'%'};return _0x584ce9;}})});}_0x4761a4=_[_0x376d('0x4c')]({},_0x4761a4,_0x796d1[_0x376d('0x4e')]);var _0x34dea8={'where':_0x4761a4[_0x376d('0x4a')]};return db[_0x376d('0x4f')][_0x376d('0x31')](_0x34dea8)['then'](function(_0x10fc96){_0x5b5e66[_0x376d('0x31')]=_0x10fc96;if(_0x796d1['query'][_0x376d('0x50')]){_0x4761a4[_0x376d('0x51')]=[{'all':!![]}];}return db[_0x376d('0x4f')][_0x376d('0x52')](_0x4761a4);})[_0x376d('0x20')](function(_0x133cb4){_0x5b5e66[_0x376d('0x53')]=_0x133cb4;return _0x5b5e66;})[_0x376d('0x20')](respondWithFilteredResult(_0x3447b7,_0x4761a4))[_0x376d('0x29')](handleError(_0x3447b7,null));};exports[_0x376d('0x54')]=function(_0x278392,_0x1c1c88){var _0x3e090c={'raw':!![],'where':{'id':_0x278392[_0x376d('0x55')]['id']}},_0x2e46f6={};_0x2e46f6[_0x376d('0x3e')]=_[_0x376d('0x56')](db[_0x376d('0x4f')][_0x376d('0x3d')]);_0x2e46f6[_0x376d('0x40')]=_[_0x376d('0x56')](_0x278392[_0x376d('0x40')]);_0x2e46f6['filters']=_[_0x376d('0x43')](_0x2e46f6[_0x376d('0x3e')],_0x2e46f6[_0x376d('0x40')]);_0x3e090c[_0x376d('0x42')]=_[_0x376d('0x43')](_0x2e46f6[_0x376d('0x3e')],qs[_0x376d('0x44')](_0x278392[_0x376d('0x40')][_0x376d('0x44')]));_0x3e090c[_0x376d('0x42')]=_0x3e090c['attributes'][_0x376d('0x45')]?_0x3e090c[_0x376d('0x42')]:_0x2e46f6[_0x376d('0x3e')];if(_0x278392['query']['includeAll']){_0x3e090c[_0x376d('0x51')]=[{'all':!![]}];}_0x3e090c=_['merge']({},_0x3e090c,_0x278392['options']);return db['ChatQueue'][_0x376d('0x57')](_0x3e090c)['then'](handleEntityNotFound(_0x1c1c88,null))['then'](respondWithResult(_0x1c1c88,null))['catch'](handleError(_0x1c1c88,null));};exports[_0x376d('0x58')]=function(_0x4538bb,_0xd41e93){return db[_0x376d('0x4f')]['create'](_0x4538bb[_0x376d('0x59')],{})[_0x376d('0x20')](function(_0x31c774){var _0x199ca6=_0x4538bb[_0x376d('0x5a')]['get']({'plain':!![]});if(!_0x199ca6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x199ca6['role']===_0x376d('0x5a')){var _0x2f6886=_0x31c774[_0x376d('0x5b')]({'plain':!![]});var _0x14220c=_0x376d('0x37');return db['UserProfileSection'][_0x376d('0x57')]({'where':{'name':_0x14220c,'userProfileId':_0x199ca6[_0x376d('0x5c')]},'raw':!![]})[_0x376d('0x20')](function(_0x2df3b5){if(_0x2df3b5&&_0x2df3b5[_0x376d('0x5d')]===0x0){return db[_0x376d('0x38')]['create']({'name':_0x2f6886[_0x376d('0x3a')],'resourceId':_0x2f6886['id'],'type':_0x2df3b5[_0x376d('0x3a')],'sectionId':_0x2df3b5['id']},{})['then'](function(){return _0x31c774;});}else{return _0x31c774;}})['catch'](function(_0x663fee){logger['error'](_0x376d('0x5e'),_0x663fee);throw _0x663fee;});}return _0x31c774;})[_0x376d('0x20')](respondWithResult(_0xd41e93,0xc9))[_0x376d('0x29')](handleError(_0xd41e93,null));};exports[_0x376d('0x5f')]=function(_0x18df1b,_0x1999bd){if(_0x18df1b['body']['id']){delete _0x18df1b[_0x376d('0x59')]['id'];}return db[_0x376d('0x4f')][_0x376d('0x57')]({'where':{'id':_0x18df1b[_0x376d('0x55')]['id']}})[_0x376d('0x20')](handleEntityNotFound(_0x1999bd,null))[_0x376d('0x20')](saveUpdates(_0x18df1b[_0x376d('0x59')],null))[_0x376d('0x20')](respondWithResult(_0x1999bd,null))[_0x376d('0x29')](handleError(_0x1999bd,null));};exports[_0x376d('0x36')]=function(_0x50f73c,_0x417b2e){return db[_0x376d('0x4f')][_0x376d('0x57')]({'where':{'id':_0x50f73c['params']['id']}})[_0x376d('0x20')](handleEntityNotFound(_0x417b2e,null))['then'](removeEntity(_0x417b2e,null))['catch'](handleError(_0x417b2e,null));};exports[_0x376d('0x60')]=function(_0x4ffd52,_0x293add){return db['ChatQueue'][_0x376d('0x60')]()[_0x376d('0x20')](respondWithResult(_0x293add,null))[_0x376d('0x29')](handleError(_0x293add,null));};exports[_0x376d('0x61')]=function(_0x3c5e7b,_0x4bae7b,_0xea0a0a){var _0x168991={'raw':!![],'where':{}},_0xf9182c={},_0x33dbf6;return db[_0x376d('0x4f')][_0x376d('0x62')]({'where':{'id':_0x3c5e7b['params']['id']}})[_0x376d('0x20')](handleEntityNotFound(_0x4bae7b,null))['then'](function(_0xba7e77){if(_0xba7e77){_0x33dbf6=_0xba7e77[_0x376d('0x5b')]({'plain':!![]});_0xf9182c[_0x376d('0x3e')]=_['keys'](db[_0x376d('0x63')][_0x376d('0x3d')]);_0xf9182c[_0x376d('0x40')]=_['keys'](_0x3c5e7b[_0x376d('0x40')]);_0xf9182c[_0x376d('0x41')]=_['intersection'](_0xf9182c[_0x376d('0x3e')],_0xf9182c[_0x376d('0x40')]);_0x168991[_0x376d('0x42')]=_['intersection'](_0xf9182c[_0x376d('0x3e')],qs[_0x376d('0x44')](_0x3c5e7b[_0x376d('0x40')][_0x376d('0x44')]));_0x168991[_0x376d('0x42')]=_0x168991['attributes'][_0x376d('0x45')]?_0x168991[_0x376d('0x42')]:_0xf9182c[_0x376d('0x3e')];if(!_0x3c5e7b[_0x376d('0x40')][_0x376d('0x46')](_0x376d('0x47'))){_0x168991[_0x376d('0x30')]=qs['limit'](_0x3c5e7b[_0x376d('0x40')]['limit']);_0x168991[_0x376d('0x2e')]=qs[_0x376d('0x2e')](_0x3c5e7b['query'][_0x376d('0x2e')]);}_0x168991['order']=qs[_0x376d('0x49')](_0x3c5e7b[_0x376d('0x40')]['sort']);_0x168991[_0x376d('0x4a')]=qs[_0x376d('0x41')](_[_0x376d('0x4b')](_0x3c5e7b['query'],_0xf9182c[_0x376d('0x41')]));_0x168991[_0x376d('0x4a')][_0x376d('0x64')]=_0xba7e77['id'];if(_0x3c5e7b[_0x376d('0x40')][_0x376d('0x4d')]){_0x168991[_0x376d('0x4a')]=_['merge'](_0x168991[_0x376d('0x4a')],{'$or':_[_0x376d('0x3f')](_0x168991['attributes'],function(_0x1075a0){var _0x4b51fe={};_0x4b51fe[_0x1075a0]={'$like':'%'+_0x3c5e7b[_0x376d('0x40')][_0x376d('0x4d')]+'%'};return _0x4b51fe;})});}_0x168991=_[_0x376d('0x4c')]({},_0x168991,_0x3c5e7b[_0x376d('0x4e')]);return db[_0x376d('0x63')][_0x376d('0x52')](_0x168991);}})[_0x376d('0x20')](function(_0x5376bd){if(_0x5376bd){return db['User'][_0x376d('0x65')]({'where':{'id':_[_0x376d('0x3f')](_0x5376bd,_0x376d('0x66')),'role':_0x376d('0x67')},'attributes':['id',_0x376d('0x3a'),'chatPause',_0x376d('0x68'),_0x376d('0x69')]});}})[_0x376d('0x20')](function(_0x4bd285){if(_0x4bd285){return{'count':_0x4bd285[_0x376d('0x31')],'rows':_[_0x376d('0x3f')](_0x4bd285['rows'],function(_0x170145){return{'membername':_0x170145[_0x376d('0x3a')],'UserId':_0x170145['id'],'queue_name':_0x33dbf6['name'],'ChatQueueId':_0x33dbf6['id'],'interface':util[_0x376d('0x6a')](_0x376d('0x6b'),_0x376d('0x6c'),_0x170145['name']),'penalty':0x0,'paused':_0x170145[_0x376d('0x6d')],'createdAt':_0x170145[_0x376d('0x69')],'updatedAt':_0x170145[_0x376d('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4bae7b,_0x168991))[_0x376d('0x29')](handleError(_0x4bae7b,null));};exports[_0x376d('0x6e')]=function(_0x2fba07,_0x49faf5,_0x5a4c2e){var _0xfbce6d={};var _0x40bc30={};var _0x2dbef0;var _0x688c0f;return db[_0x376d('0x4f')][_0x376d('0x62')]({'where':{'id':_0x2fba07[_0x376d('0x55')]['id']}})[_0x376d('0x20')](handleEntityNotFound(_0x49faf5,null))['then'](function(_0x57a105){if(_0x57a105){_0x2dbef0=_0x57a105;_0x40bc30[_0x376d('0x3e')]=_[_0x376d('0x56')](db[_0x376d('0x6f')]['rawAttributes']);_0x40bc30['query']=_[_0x376d('0x56')](_0x2fba07['query']);_0x40bc30[_0x376d('0x41')]=_['intersection'](_0x40bc30[_0x376d('0x3e')],_0x40bc30[_0x376d('0x40')]);_0xfbce6d[_0x376d('0x42')]=_[_0x376d('0x43')](_0x40bc30[_0x376d('0x3e')],qs['fields'](_0x2fba07[_0x376d('0x40')][_0x376d('0x44')]));_0xfbce6d[_0x376d('0x42')]=_0xfbce6d[_0x376d('0x42')][_0x376d('0x45')]?_0xfbce6d[_0x376d('0x42')]:_0x40bc30[_0x376d('0x3e')];_0xfbce6d['order']=qs['sort'](_0x2fba07[_0x376d('0x40')][_0x376d('0x49')]);_0xfbce6d[_0x376d('0x4a')]=qs[_0x376d('0x41')](_['pick'](_0x2fba07[_0x376d('0x40')],_0x40bc30[_0x376d('0x41')]));if(_0x2fba07['query'][_0x376d('0x4d')]){_0xfbce6d['where']=_[_0x376d('0x4c')](_0xfbce6d[_0x376d('0x4a')],{'$or':_[_0x376d('0x3f')](_0xfbce6d['attributes'],function(_0x1cc204){var _0x4b2ae1={};_0x4b2ae1[_0x1cc204]={'$like':'%'+_0x2fba07[_0x376d('0x40')]['filter']+'%'};return _0x4b2ae1;})});}_0xfbce6d=_[_0x376d('0x4c')]({},_0xfbce6d,_0x2fba07[_0x376d('0x4e')]);return _0x2dbef0[_0x376d('0x6e')](_0xfbce6d);}})[_0x376d('0x20')](function(_0x35feed){if(_0x35feed){_0x688c0f=_0x35feed[_0x376d('0x45')];if(!_0x2fba07[_0x376d('0x40')][_0x376d('0x46')]('nolimit')){_0xfbce6d[_0x376d('0x30')]=qs['limit'](_0x2fba07['query'][_0x376d('0x30')]);_0xfbce6d['offset']=qs['offset'](_0x2fba07[_0x376d('0x40')][_0x376d('0x2e')]);}return _0x2dbef0[_0x376d('0x6e')](_0xfbce6d);}})['then'](function(_0x5b621e){if(_0x5b621e){return _0x5b621e?{'count':_0x688c0f,'rows':_0x5b621e}:null;}})[_0x376d('0x20')](respondWithResult(_0x49faf5,null))[_0x376d('0x29')](handleError(_0x49faf5,null));};exports[_0x376d('0x70')]=function(_0x54f601,_0x582de3,_0x22e9aa){var _0x58d844=_0x54f601[_0x376d('0x59')][_0x376d('0x71')];return db['Team'][_0x376d('0x52')]({'where':{'id':_0x58d844},'attributes':['id'],'include':[{'model':db[_0x376d('0x72')],'as':_0x376d('0x73'),'attributes':['id',_0x376d('0x3a'),_0x376d('0x74'),_0x376d('0x75'),_0x376d('0x76')],'raw':!![]}]})['then'](function(_0x291730){if(_0x291730){var _0xbe9b92=_[_0x376d('0x77')](_0x291730,function(_0x32df3e){var _0x119379=_0x32df3e[_0x376d('0x5b')]({'plain':!![]});return _0x119379[_0x376d('0x73')];});return db['ChatQueue']['find']({'where':{'id':_0x54f601[_0x376d('0x55')]['id']}})[_0x376d('0x20')](function(_0x31ee63){return db[_0x376d('0x78')]['transaction'](function(_0x17cb36){return _0x31ee63[_0x376d('0x70')](_0x58d844,{'transaction':_0x17cb36})['then'](function(){return BPromise['each'](_0xbe9b92,function(_0x2b92d5){return db['UserChatQueue'][_0x376d('0x79')]({'where':{'UserId':_0x2b92d5['id'],'ChatQueueId':_0x54f601[_0x376d('0x55')]['id']},'transaction':_0x17cb36});});})[_0x376d('0x20')](function(){_0xbe9b92[_0x376d('0x7a')](function(_0x53b63a){socket[_0x376d('0x7b')](_0x376d('0x7c'),{'UserId':_0x53b63a['id'],'ChatQueueId':_0x31ee63['id']});});});});});}})[_0x376d('0x20')](respondWithStatusCode(_0x582de3,null))[_0x376d('0x29')](handleError(_0x582de3,null));};exports[_0x376d('0x7d')]=function(_0x1d4148,_0xbca9b4,_0x39568c){return db[_0x376d('0x6f')]['findAll']({'where':{'id':_0x1d4148[_0x376d('0x40')][_0x376d('0x71')]},'attributes':['id'],'include':[{'model':db[_0x376d('0x72')],'as':_0x376d('0x73'),'attributes':['id'],'raw':!![]}]})[_0x376d('0x20')](handleEntityNotFound(_0xbca9b4,null))[_0x376d('0x20')](function(_0x4506dd){var _0x35bfc2=_[_0x376d('0x3f')](_0x4506dd,'id');var _0x4b292b=[];var _0x446cfd=[];var _0x9612c2=squel[_0x376d('0x7e')]();_0x9612c2[_0x376d('0x7f')](_0x376d('0x80'))[_0x376d('0x81')](_0x376d('0x82'),'tq')[_0x376d('0x83')](_0x376d('0x84'),'ut',_0x376d('0x85'))[_0x376d('0x4a')]('ChatQueueId\x20=\x20?',_0x1d4148[_0x376d('0x55')]['id']);for(var _0x470cce=0x0;_0x470cce<_0x4506dd[_0x376d('0x45')];_0x470cce+=0x1){let _0x26f696=_0x4506dd[_0x470cce];for(var _0x398eef=0x0;_0x398eef<_0x26f696[_0x376d('0x73')]['length'];_0x398eef+=0x1){let _0x15ca60=_0x26f696[_0x376d('0x73')][_0x398eef];var _0x5e4c77=_0x9612c2[_0x376d('0x86')]();_0x5e4c77[_0x376d('0x4a')](_0x376d('0x87'),_0x15ca60['id']);_0x446cfd[_0x376d('0x88')](db[_0x376d('0x78')]['query'](_0x5e4c77[_0x376d('0x89')](),{'type':db[_0x376d('0x78')][_0x376d('0x8a')][_0x376d('0x8b')]})[_0x376d('0x20')](function(_0x1d583c){if(_0x1d583c['length']===0x1){return _0x15ca60['id'];}else{var _0x51c37c=_[_0x376d('0x8c')](_[_0x376d('0x3f')](_0x1d583c,_0x376d('0x8d')),function(_0x24a695){return _[_0x376d('0x8e')](_0x35bfc2,_0x24a695);});if(_0x51c37c){return _0x15ca60['id'];}}}));}}return BPromise['all'](_0x446cfd)['then'](function(_0x2bd45a){_0x4b292b=_(_0x4b292b)[_0x376d('0x8f')](_0x2bd45a)[_0x376d('0x90')]()['value']();return db[_0x376d('0x4f')][_0x376d('0x57')]({'where':{'id':_0x1d4148[_0x376d('0x55')]['id']}})[_0x376d('0x20')](function(_0x192609){return db[_0x376d('0x78')][_0x376d('0x91')](function(_0x3c2652){return _0x192609['removeTeams'](_0x1d4148[_0x376d('0x40')][_0x376d('0x71')],{'transaction':_0x3c2652})[_0x376d('0x20')](function(){if(!_['isEmpty'](_0x4b292b)){return _0x192609['removeAgents'](_0x4b292b,{'transaction':_0x3c2652});}})[_0x376d('0x20')](function(){_0x4b292b[_0x376d('0x7a')](function(_0x269074){socket['emit'](_0x376d('0x92'),{'UserId':_0x269074,'ChatQueueId':_0x192609['id']});});});});});});})[_0x376d('0x20')](respondWithStatusCode(_0xbca9b4,null))[_0x376d('0x29')](handleError(_0xbca9b4,null));};exports[_0x376d('0x93')]=function(_0x443ba4,_0x119079,_0x1ed46d){return db['ChatQueue']['find']({'where':{'id':_0x443ba4[_0x376d('0x55')]['id']}})[_0x376d('0x20')](handleEntityNotFound(_0x119079,null))['then'](function(_0x6b6066){if(_0x6b6066){return _0x6b6066['addAgents'](_0x443ba4[_0x376d('0x59')][_0x376d('0x71')],_[_0x376d('0x94')](_0x443ba4[_0x376d('0x59')],[_0x376d('0x71'),'id'])||{})['spread'](function(_0x3c7e1f){for(var _0x1cc11b=0x0;_0x1cc11b<_0x443ba4[_0x376d('0x59')][_0x376d('0x71')][_0x376d('0x45')];_0x1cc11b+=0x1){socket[_0x376d('0x7b')](_0x376d('0x7c'),{'UserId':Number(_0x443ba4[_0x376d('0x59')][_0x376d('0x71')][_0x1cc11b]),'ChatQueueId':Number(_0x443ba4[_0x376d('0x55')]['id'])});}return _0x3c7e1f;});}})[_0x376d('0x20')](respondWithResult(_0x119079,null))['catch'](handleError(_0x119079,null));};exports[_0x376d('0x95')]=function(_0x2dfdb7,_0x1d6049,_0x370b1b){return db['ChatQueue'][_0x376d('0x57')]({'where':{'id':_0x2dfdb7[_0x376d('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d6049,null))['then'](function(_0x109a60){if(_0x109a60){return _0x109a60[_0x376d('0x95')](_0x2dfdb7[_0x376d('0x40')][_0x376d('0x71')])[_0x376d('0x20')](function(){if(_['isArray'](_0x2dfdb7[_0x376d('0x40')][_0x376d('0x71')])){for(var _0x202786=0x0;_0x202786<_0x2dfdb7[_0x376d('0x40')][_0x376d('0x71')][_0x376d('0x45')];_0x202786+=0x1){socket['emit'](_0x376d('0x92'),{'UserId':Number(_0x2dfdb7['query']['ids'][_0x202786]),'ChatQueueId':Number(_0x2dfdb7['params']['id'])});}}else{socket[_0x376d('0x7b')](_0x376d('0x92'),{'UserId':Number(_0x2dfdb7[_0x376d('0x40')]['ids']),'ChatQueueId':Number(_0x2dfdb7['params']['id'])});}});}})[_0x376d('0x20')](respondWithStatusCode(_0x1d6049,null))['catch'](handleError(_0x1d6049,null));};exports[_0x376d('0x96')]=function(_0x18146b,_0x53886a,_0x4c0782){var _0x167b8a={};var _0x85916b={};var _0x3a30d2;var _0x1fbe32;return db[_0x376d('0x4f')][_0x376d('0x62')]({'where':{'id':_0x18146b[_0x376d('0x55')]['id']}})['then'](handleEntityNotFound(_0x53886a,null))['then'](function(_0x1b97cb){if(_0x1b97cb){_0x3a30d2=_0x1b97cb;_0x85916b[_0x376d('0x3e')]=_[_0x376d('0x56')](db[_0x376d('0x72')][_0x376d('0x3d')]);_0x85916b[_0x376d('0x40')]=_[_0x376d('0x56')](_0x18146b[_0x376d('0x40')]);_0x85916b[_0x376d('0x41')]=_[_0x376d('0x43')](_0x85916b[_0x376d('0x3e')],_0x85916b[_0x376d('0x40')]);_0x167b8a[_0x376d('0x42')]=_[_0x376d('0x43')](_0x85916b['model'],qs[_0x376d('0x44')](_0x18146b[_0x376d('0x40')][_0x376d('0x44')]));_0x167b8a['attributes']=_0x167b8a[_0x376d('0x42')][_0x376d('0x45')]?_0x167b8a[_0x376d('0x42')]:_0x85916b['model'];_0x167b8a[_0x376d('0x48')]=qs[_0x376d('0x49')](_0x18146b['query']['sort']);_0x167b8a[_0x376d('0x4a')]=qs['filters'](_['pick'](_0x18146b[_0x376d('0x40')],_0x85916b[_0x376d('0x41')]));if(_0x18146b[_0x376d('0x40')][_0x376d('0x4d')]){_0x167b8a[_0x376d('0x4a')]=_[_0x376d('0x4c')](_0x167b8a[_0x376d('0x4a')],{'$or':_[_0x376d('0x3f')](_0x167b8a[_0x376d('0x42')],function(_0x11814a){var _0x1770a1={};_0x1770a1[_0x11814a]={'$like':'%'+_0x18146b['query'][_0x376d('0x4d')]+'%'};return _0x1770a1;})});}_0x167b8a=_['merge']({},_0x167b8a,_0x18146b['options']);return _0x3a30d2[_0x376d('0x96')](_0x167b8a);}})[_0x376d('0x20')](function(_0x3aa2f4){if(_0x3aa2f4){_0x1fbe32=_0x3aa2f4['length'];if(!_0x18146b[_0x376d('0x40')][_0x376d('0x46')](_0x376d('0x47'))){_0x167b8a[_0x376d('0x30')]=qs[_0x376d('0x30')](_0x18146b['query'][_0x376d('0x30')]);_0x167b8a[_0x376d('0x2e')]=qs[_0x376d('0x2e')](_0x18146b[_0x376d('0x40')]['offset']);}return _0x3a30d2[_0x376d('0x96')](_0x167b8a);}})[_0x376d('0x20')](function(_0x575a78){if(_0x575a78){return _0x575a78?{'count':_0x1fbe32,'rows':_0x575a78}:null;}})[_0x376d('0x20')](respondWithResult(_0x53886a,null))['catch'](handleError(_0x53886a,null));}; \ No newline at end of file +var _0x03aa=['sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','update','destroy','get','UserProfileResource','name','index','map','ChatQueue','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserChatQueue','rawAttributes','keys','ChatQueueId','User','findAndCountAll','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','filter','addTeams','ids','Agents','online','interface','flatMap','transaction','each','forEach','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString'];(function(_0x41815e,_0x2b538d){var _0x2de5d0=function(_0x36175f){while(--_0x36175f){_0x41815e['push'](_0x41815e['shift']());}};_0x2de5d0(++_0x2b538d);}(_0x03aa,0xab));var _0xa03a=function(_0x3d2fc9,_0x5ed7ed){_0x3d2fc9=_0x3d2fc9-0x0;var _0x10016f=_0x03aa[_0x3d2fc9];return _0x10016f;};'use strict';var emlformat=require(_0xa03a('0x0'));var rimraf=require(_0xa03a('0x1'));var zipdir=require(_0xa03a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa03a('0x3'));var BPromise=require(_0xa03a('0x4'));var Mustache=require(_0xa03a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa03a('0x6'));var fs=require('fs');var fs_extra=require(_0xa03a('0x7'));var _=require(_0xa03a('0x8'));var squel=require('squel');var crypto=require(_0xa03a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa03a('0xa'));var toCsv=require(_0xa03a('0xb'));var querystring=require(_0xa03a('0xc'));var Papa=require(_0xa03a('0xd'));var Redis=require(_0xa03a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa03a('0xf'));var as=require(_0xa03a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa03a('0x11'))('api');var utils=require(_0xa03a('0x12'));var config=require(_0xa03a('0x13'));var licenseUtil=require(_0xa03a('0x14'));var db=require(_0xa03a('0x15'))['db'];config[_0xa03a('0x16')]=_[_0xa03a('0x17')](config['redis'],{'host':_0xa03a('0x18'),'port':0x18eb});var socket=require(_0xa03a('0x19'))(new Redis(config[_0xa03a('0x16')]));require(_0xa03a('0x1a'))[_0xa03a('0x1b')](socket);var jayson=require(_0xa03a('0x1c'));var client=jayson[_0xa03a('0x1d')][_0xa03a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x21505c,_0x3cbe85,_0x1e6b84,_0x3d5990){return new BPromise(function(_0x31357c,_0x21dfff){var _0x5b7e54=_0x3d5990||client;return _0x5b7e54[_0xa03a('0x1f')](_0x21505c,_0x1e6b84)[_0xa03a('0x20')](function(_0x1be9d0){logger['info'](_0xa03a('0x21'),_0x3cbe85,_0xa03a('0x22'));logger[_0xa03a('0x23')](_0xa03a('0x24'),_0x3cbe85,'request\x20sent',JSON[_0xa03a('0x25')](_0x1be9d0));if(_0x1be9d0['error']){if(_0x1be9d0[_0xa03a('0x26')][_0xa03a('0x27')]===0x1f4){logger['error'](_0xa03a('0x21'),_0x3cbe85,_0x1be9d0[_0xa03a('0x26')][_0xa03a('0x28')]);return _0x21dfff(_0x1be9d0[_0xa03a('0x26')][_0xa03a('0x28')]);}logger['error'](_0xa03a('0x21'),_0x3cbe85,_0x1be9d0[_0xa03a('0x26')][_0xa03a('0x28')]);return _0x31357c(_0x1be9d0[_0xa03a('0x26')][_0xa03a('0x28')]);}else{logger[_0xa03a('0x29')](_0xa03a('0x21'),_0x3cbe85,'request\x20sent');_0x31357c(_0x1be9d0[_0xa03a('0x2a')][_0xa03a('0x28')]);}})[_0xa03a('0x2b')](function(_0x50eff9){logger[_0xa03a('0x26')](_0xa03a('0x21'),_0x3cbe85,_0x50eff9);_0x21dfff(_0x50eff9);});});}function respondWithStatusCode(_0x57b4a7,_0x130031){_0x130031=_0x130031||0xcc;return function(_0xb6dfd5){if(_0xb6dfd5){return _0x57b4a7[_0xa03a('0x2c')](_0x130031);}return _0x57b4a7['status'](_0x130031)[_0xa03a('0x2d')]();};}function respondWithResult(_0x325003,_0x1c8b65){_0x1c8b65=_0x1c8b65||0xc8;return function(_0x3765a9){if(_0x3765a9){return _0x325003[_0xa03a('0x2e')](_0x1c8b65)[_0xa03a('0x2f')](_0x3765a9);}};}function respondWithFilteredResult(_0x451d06,_0x4ee8a8){return function(_0x27c410){if(_0x27c410){var _0x22e297=typeof _0x4ee8a8['offset']===_0xa03a('0x30')&&typeof _0x4ee8a8[_0xa03a('0x31')]===_0xa03a('0x30');var _0x47ab70=_0x27c410[_0xa03a('0x32')];var _0x392e03=_0x22e297?0x0:_0x4ee8a8['offset'];var _0x1305d5=_0x22e297?_0x27c410[_0xa03a('0x32')]:_0x4ee8a8[_0xa03a('0x33')]+_0x4ee8a8[_0xa03a('0x31')];var _0x5b8667;if(_0x1305d5>=_0x47ab70){_0x1305d5=_0x47ab70;_0x5b8667=0xc8;}else{_0x5b8667=0xce;}_0x451d06['status'](_0x5b8667);return _0x451d06[_0xa03a('0x34')]('Content-Range',_0x392e03+'-'+_0x1305d5+'/'+_0x47ab70)[_0xa03a('0x2f')](_0x27c410);}return null;};}function patchUpdates(_0xe0a252){return function(_0x3fdbd3){try{jsonpatch[_0xa03a('0x35')](_0x3fdbd3,_0xe0a252,!![]);}catch(_0x1fa526){return BPromise['reject'](_0x1fa526);}return _0x3fdbd3['save']();};}function saveUpdates(_0x16f9f6,_0x382e1){return function(_0x1a5622){if(_0x1a5622){return _0x1a5622[_0xa03a('0x36')](_0x16f9f6)[_0xa03a('0x20')](function(_0x48ee3b){return _0x48ee3b;});}return null;};}function removeEntity(_0x49e9ba,_0x332579){return function(_0x26fc1e){if(_0x26fc1e){return _0x26fc1e[_0xa03a('0x37')]()[_0xa03a('0x20')](function(){var _0x109d1b=_0x26fc1e[_0xa03a('0x38')]({'plain':!![]});var _0xf5de64='ChatQueues';return db[_0xa03a('0x39')]['destroy']({'where':{'type':_0xf5de64,'resourceId':_0x109d1b['id']}})[_0xa03a('0x20')](function(){return _0x26fc1e;});})['then'](function(){_0x49e9ba[_0xa03a('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7c99,_0x5b046d){return function(_0x408d74){if(!_0x408d74){_0x5e7c99['sendStatus'](0x194);}return _0x408d74;};}function handleError(_0x11883c,_0x2f2450){_0x2f2450=_0x2f2450||0x1f4;return function(_0x3f36cd){logger[_0xa03a('0x26')](_0x3f36cd['stack']);if(_0x3f36cd['name']){delete _0x3f36cd[_0xa03a('0x3a')];}_0x11883c[_0xa03a('0x2e')](_0x2f2450)['send'](_0x3f36cd);};}exports[_0xa03a('0x3b')]=function(_0x4dfd4b,_0x1236b0){var _0x576870={},_0xe9cb2f={},_0x2d15cb={'count':0x0,'rows':[]};var _0x310fb4=_[_0xa03a('0x3c')](db[_0xa03a('0x3d')]['rawAttributes'],function(_0x5a0bda){return{'name':_0x5a0bda[_0xa03a('0x3e')],'type':_0x5a0bda[_0xa03a('0x3f')][_0xa03a('0x40')]};});_0xe9cb2f[_0xa03a('0x41')]=_[_0xa03a('0x3c')](_0x310fb4,_0xa03a('0x3a'));_0xe9cb2f[_0xa03a('0x42')]=_['keys'](_0x4dfd4b[_0xa03a('0x42')]);_0xe9cb2f[_0xa03a('0x43')]=_[_0xa03a('0x44')](_0xe9cb2f[_0xa03a('0x41')],_0xe9cb2f[_0xa03a('0x42')]);_0x576870[_0xa03a('0x45')]=_[_0xa03a('0x44')](_0xe9cb2f[_0xa03a('0x41')],qs[_0xa03a('0x46')](_0x4dfd4b[_0xa03a('0x42')][_0xa03a('0x46')]));_0x576870[_0xa03a('0x45')]=_0x576870[_0xa03a('0x45')]['length']?_0x576870[_0xa03a('0x45')]:_0xe9cb2f[_0xa03a('0x41')];if(!_0x4dfd4b[_0xa03a('0x42')][_0xa03a('0x47')](_0xa03a('0x48'))){_0x576870[_0xa03a('0x31')]=qs['limit'](_0x4dfd4b['query'][_0xa03a('0x31')]);_0x576870[_0xa03a('0x33')]=qs['offset'](_0x4dfd4b[_0xa03a('0x42')]['offset']);}_0x576870[_0xa03a('0x49')]=qs[_0xa03a('0x4a')](_0x4dfd4b[_0xa03a('0x42')][_0xa03a('0x4a')]);_0x576870[_0xa03a('0x4b')]=qs[_0xa03a('0x43')](_[_0xa03a('0x4c')](_0x4dfd4b[_0xa03a('0x42')],_0xe9cb2f[_0xa03a('0x43')]),_0x310fb4);if(_0x4dfd4b[_0xa03a('0x42')]['filter']){_0x576870['where']=_['merge'](_0x576870[_0xa03a('0x4b')],{'$or':_['map'](_0x310fb4,function(_0x3cfb7c){if(_0x3cfb7c['type']!==_0xa03a('0x4d')){var _0x50ac1e={};_0x50ac1e[_0x3cfb7c[_0xa03a('0x3a')]]={'$like':'%'+_0x4dfd4b[_0xa03a('0x42')]['filter']+'%'};return _0x50ac1e;}})});}_0x576870=_[_0xa03a('0x4e')]({},_0x576870,_0x4dfd4b[_0xa03a('0x4f')]);var _0x21695b={'where':_0x576870[_0xa03a('0x4b')]};return db[_0xa03a('0x3d')][_0xa03a('0x32')](_0x21695b)['then'](function(_0x9edda){_0x2d15cb[_0xa03a('0x32')]=_0x9edda;if(_0x4dfd4b['query'][_0xa03a('0x50')]){_0x576870[_0xa03a('0x51')]=[{'all':!![]}];}return db['ChatQueue'][_0xa03a('0x52')](_0x576870);})[_0xa03a('0x20')](function(_0x33b1fb){_0x2d15cb[_0xa03a('0x53')]=_0x33b1fb;return _0x2d15cb;})[_0xa03a('0x20')](respondWithFilteredResult(_0x1236b0,_0x576870))[_0xa03a('0x2b')](handleError(_0x1236b0,null));};exports[_0xa03a('0x54')]=function(_0x5c08da,_0x1fda4e){var _0x41f86a={'raw':!![],'where':{'id':_0x5c08da['params']['id']}},_0x2b352f={};_0x2b352f['model']=_['keys'](db[_0xa03a('0x3d')]['rawAttributes']);_0x2b352f[_0xa03a('0x42')]=_['keys'](_0x5c08da[_0xa03a('0x42')]);_0x2b352f[_0xa03a('0x43')]=_[_0xa03a('0x44')](_0x2b352f[_0xa03a('0x41')],_0x2b352f[_0xa03a('0x42')]);_0x41f86a[_0xa03a('0x45')]=_[_0xa03a('0x44')](_0x2b352f[_0xa03a('0x41')],qs[_0xa03a('0x46')](_0x5c08da[_0xa03a('0x42')][_0xa03a('0x46')]));_0x41f86a[_0xa03a('0x45')]=_0x41f86a['attributes'][_0xa03a('0x55')]?_0x41f86a[_0xa03a('0x45')]:_0x2b352f['model'];if(_0x5c08da[_0xa03a('0x42')][_0xa03a('0x50')]){_0x41f86a[_0xa03a('0x51')]=[{'all':!![]}];}_0x41f86a=_[_0xa03a('0x4e')]({},_0x41f86a,_0x5c08da[_0xa03a('0x4f')]);return db[_0xa03a('0x3d')]['find'](_0x41f86a)[_0xa03a('0x20')](handleEntityNotFound(_0x1fda4e,null))[_0xa03a('0x20')](respondWithResult(_0x1fda4e,null))[_0xa03a('0x2b')](handleError(_0x1fda4e,null));};exports['create']=function(_0x383bcc,_0x19a091){return db[_0xa03a('0x3d')][_0xa03a('0x56')](_0x383bcc[_0xa03a('0x57')],{})['then'](function(_0x2cf7cf){var _0x444b6c=_0x383bcc['user']['get']({'plain':!![]});if(!_0x444b6c)throw new Error(_0xa03a('0x58'));if(_0x444b6c[_0xa03a('0x59')]===_0xa03a('0x5a')){var _0x5b13ee=_0x2cf7cf[_0xa03a('0x38')]({'plain':!![]});var _0x5af5f8='ChatQueues';return db[_0xa03a('0x5b')][_0xa03a('0x5c')]({'where':{'name':_0x5af5f8,'userProfileId':_0x444b6c['userProfileId']},'raw':!![]})[_0xa03a('0x20')](function(_0x7b1360){if(_0x7b1360&&_0x7b1360['autoAssociation']===0x0){return db[_0xa03a('0x39')][_0xa03a('0x56')]({'name':_0x5b13ee[_0xa03a('0x3a')],'resourceId':_0x5b13ee['id'],'type':_0x7b1360[_0xa03a('0x3a')],'sectionId':_0x7b1360['id']},{})[_0xa03a('0x20')](function(){return _0x2cf7cf;});}else{return _0x2cf7cf;}})['catch'](function(_0x4cbfbb){logger['error'](_0xa03a('0x5d'),_0x4cbfbb);throw _0x4cbfbb;});}return _0x2cf7cf;})['then'](respondWithResult(_0x19a091,0xc9))[_0xa03a('0x2b')](handleError(_0x19a091,null));};exports[_0xa03a('0x36')]=function(_0x26e9cf,_0x5251e0){if(_0x26e9cf[_0xa03a('0x57')]['id']){delete _0x26e9cf[_0xa03a('0x57')]['id'];}return db['ChatQueue'][_0xa03a('0x5c')]({'where':{'id':_0x26e9cf[_0xa03a('0x5e')]['id']}})[_0xa03a('0x20')](handleEntityNotFound(_0x5251e0,null))[_0xa03a('0x20')](saveUpdates(_0x26e9cf[_0xa03a('0x57')],null))['then'](respondWithResult(_0x5251e0,null))['catch'](handleError(_0x5251e0,null));};exports[_0xa03a('0x37')]=function(_0x569d70,_0x34a56b){return db[_0xa03a('0x3d')]['find']({'where':{'id':_0x569d70[_0xa03a('0x5e')]['id']}})[_0xa03a('0x20')](handleEntityNotFound(_0x34a56b,null))[_0xa03a('0x20')](removeEntity(_0x34a56b,null))[_0xa03a('0x2b')](handleError(_0x34a56b,null));};exports[_0xa03a('0x5f')]=function(_0xc1d0c3,_0x247458){return db[_0xa03a('0x3d')][_0xa03a('0x5f')]()['then'](respondWithResult(_0x247458,null))['catch'](handleError(_0x247458,null));};exports[_0xa03a('0x60')]=function(_0x30e227,_0x2fdf0b,_0x92d04e){var _0x5a4480={'raw':!![],'where':{}},_0x4532e0={},_0x57f3b0;return db[_0xa03a('0x3d')]['findOne']({'where':{'id':_0x30e227[_0xa03a('0x5e')]['id']}})[_0xa03a('0x20')](handleEntityNotFound(_0x2fdf0b,null))[_0xa03a('0x20')](function(_0x828977){if(_0x828977){_0x57f3b0=_0x828977['get']({'plain':!![]});_0x4532e0[_0xa03a('0x41')]=_['keys'](db[_0xa03a('0x61')][_0xa03a('0x62')]);_0x4532e0[_0xa03a('0x42')]=_[_0xa03a('0x63')](_0x30e227[_0xa03a('0x42')]);_0x4532e0[_0xa03a('0x43')]=_[_0xa03a('0x44')](_0x4532e0[_0xa03a('0x41')],_0x4532e0[_0xa03a('0x42')]);_0x5a4480[_0xa03a('0x45')]=_['intersection'](_0x4532e0['model'],qs[_0xa03a('0x46')](_0x30e227[_0xa03a('0x42')][_0xa03a('0x46')]));_0x5a4480[_0xa03a('0x45')]=_0x5a4480[_0xa03a('0x45')][_0xa03a('0x55')]?_0x5a4480['attributes']:_0x4532e0[_0xa03a('0x41')];if(!_0x30e227[_0xa03a('0x42')][_0xa03a('0x47')](_0xa03a('0x48'))){_0x5a4480[_0xa03a('0x31')]=qs[_0xa03a('0x31')](_0x30e227[_0xa03a('0x42')]['limit']);_0x5a4480['offset']=qs[_0xa03a('0x33')](_0x30e227['query']['offset']);}_0x5a4480[_0xa03a('0x49')]=qs[_0xa03a('0x4a')](_0x30e227[_0xa03a('0x42')][_0xa03a('0x4a')]);_0x5a4480[_0xa03a('0x4b')]=qs['filters'](_[_0xa03a('0x4c')](_0x30e227['query'],_0x4532e0[_0xa03a('0x43')]));_0x5a4480[_0xa03a('0x4b')][_0xa03a('0x64')]=_0x828977['id'];if(_0x30e227[_0xa03a('0x42')]['filter']){_0x5a4480['where']=_[_0xa03a('0x4e')](_0x5a4480[_0xa03a('0x4b')],{'$or':_[_0xa03a('0x3c')](_0x5a4480['attributes'],function(_0x5678c3){var _0x2c4ce2={};_0x2c4ce2[_0x5678c3]={'$like':'%'+_0x30e227[_0xa03a('0x42')]['filter']+'%'};return _0x2c4ce2;})});}_0x5a4480=_[_0xa03a('0x4e')]({},_0x5a4480,_0x30e227[_0xa03a('0x4f')]);return db[_0xa03a('0x61')][_0xa03a('0x52')](_0x5a4480);}})[_0xa03a('0x20')](function(_0x36c860){if(_0x36c860){return db[_0xa03a('0x65')][_0xa03a('0x66')]({'where':{'id':_[_0xa03a('0x3c')](_0x36c860,'UserId'),'role':_0xa03a('0x67')},'attributes':['id',_0xa03a('0x3a'),_0xa03a('0x68'),'updatedAt',_0xa03a('0x69')]});}})[_0xa03a('0x20')](function(_0x3d6a7a){if(_0x3d6a7a){return{'count':_0x3d6a7a[_0xa03a('0x32')],'rows':_['map'](_0x3d6a7a[_0xa03a('0x53')],function(_0x494e4d){return{'membername':_0x494e4d['name'],'UserId':_0x494e4d['id'],'queue_name':_0x57f3b0[_0xa03a('0x3a')],'ChatQueueId':_0x57f3b0['id'],'interface':util[_0xa03a('0x6a')](_0xa03a('0x6b'),_0xa03a('0x6c'),_0x494e4d[_0xa03a('0x3a')]),'penalty':0x0,'paused':_0x494e4d[_0xa03a('0x68')],'createdAt':_0x494e4d[_0xa03a('0x69')],'updatedAt':_0x494e4d[_0xa03a('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa03a('0x20')](respondWithFilteredResult(_0x2fdf0b,_0x5a4480))[_0xa03a('0x2b')](handleError(_0x2fdf0b,null));};exports[_0xa03a('0x6e')]=function(_0x662751,_0x50f8cd,_0x1bc801){var _0x400ce5={};var _0x1fbca7={};var _0x400e39;var _0x4ad4fd;return db['ChatQueue'][_0xa03a('0x6f')]({'where':{'id':_0x662751[_0xa03a('0x5e')]['id']}})[_0xa03a('0x20')](handleEntityNotFound(_0x50f8cd,null))[_0xa03a('0x20')](function(_0x33aa18){if(_0x33aa18){_0x400e39=_0x33aa18;_0x1fbca7[_0xa03a('0x41')]=_[_0xa03a('0x63')](db[_0xa03a('0x70')][_0xa03a('0x62')]);_0x1fbca7[_0xa03a('0x42')]=_[_0xa03a('0x63')](_0x662751[_0xa03a('0x42')]);_0x1fbca7['filters']=_['intersection'](_0x1fbca7[_0xa03a('0x41')],_0x1fbca7[_0xa03a('0x42')]);_0x400ce5['attributes']=_[_0xa03a('0x44')](_0x1fbca7['model'],qs[_0xa03a('0x46')](_0x662751[_0xa03a('0x42')][_0xa03a('0x46')]));_0x400ce5[_0xa03a('0x45')]=_0x400ce5['attributes'][_0xa03a('0x55')]?_0x400ce5[_0xa03a('0x45')]:_0x1fbca7[_0xa03a('0x41')];_0x400ce5[_0xa03a('0x49')]=qs[_0xa03a('0x4a')](_0x662751[_0xa03a('0x42')][_0xa03a('0x4a')]);_0x400ce5[_0xa03a('0x4b')]=qs[_0xa03a('0x43')](_[_0xa03a('0x4c')](_0x662751['query'],_0x1fbca7[_0xa03a('0x43')]));if(_0x662751[_0xa03a('0x42')][_0xa03a('0x71')]){_0x400ce5[_0xa03a('0x4b')]=_[_0xa03a('0x4e')](_0x400ce5[_0xa03a('0x4b')],{'$or':_['map'](_0x400ce5[_0xa03a('0x45')],function(_0x412608){var _0x10f7ea={};_0x10f7ea[_0x412608]={'$like':'%'+_0x662751[_0xa03a('0x42')][_0xa03a('0x71')]+'%'};return _0x10f7ea;})});}_0x400ce5=_[_0xa03a('0x4e')]({},_0x400ce5,_0x662751['options']);return _0x400e39[_0xa03a('0x6e')](_0x400ce5);}})['then'](function(_0x8a0281){if(_0x8a0281){_0x4ad4fd=_0x8a0281[_0xa03a('0x55')];if(!_0x662751[_0xa03a('0x42')][_0xa03a('0x47')](_0xa03a('0x48'))){_0x400ce5[_0xa03a('0x31')]=qs[_0xa03a('0x31')](_0x662751[_0xa03a('0x42')][_0xa03a('0x31')]);_0x400ce5[_0xa03a('0x33')]=qs[_0xa03a('0x33')](_0x662751['query'][_0xa03a('0x33')]);}return _0x400e39[_0xa03a('0x6e')](_0x400ce5);}})[_0xa03a('0x20')](function(_0x32fe35){if(_0x32fe35){return _0x32fe35?{'count':_0x4ad4fd,'rows':_0x32fe35}:null;}})[_0xa03a('0x20')](respondWithResult(_0x50f8cd,null))[_0xa03a('0x2b')](handleError(_0x50f8cd,null));};exports[_0xa03a('0x72')]=function(_0x44cc97,_0x3dcce1,_0x47486f){var _0xb516d7=_0x44cc97[_0xa03a('0x57')][_0xa03a('0x73')];return db[_0xa03a('0x70')][_0xa03a('0x52')]({'where':{'id':_0xb516d7},'attributes':['id'],'include':[{'model':db[_0xa03a('0x65')],'as':_0xa03a('0x74'),'attributes':['id',_0xa03a('0x3a'),_0xa03a('0x75'),'voicePause',_0xa03a('0x76')],'raw':!![]}]})[_0xa03a('0x20')](function(_0x2cad90){if(_0x2cad90){var _0x1bb398=_[_0xa03a('0x77')](_0x2cad90,function(_0x41eb0f){var _0x4be040=_0x41eb0f['get']({'plain':!![]});return _0x4be040[_0xa03a('0x74')];});return db['ChatQueue']['find']({'where':{'id':_0x44cc97[_0xa03a('0x5e')]['id']}})[_0xa03a('0x20')](function(_0x316a81){return db['sequelize'][_0xa03a('0x78')](function(_0x479236){return _0x316a81[_0xa03a('0x72')](_0xb516d7,{'transaction':_0x479236})['then'](function(){return BPromise[_0xa03a('0x79')](_0x1bb398,function(_0x38d981){return db[_0xa03a('0x61')]['findOrCreate']({'where':{'UserId':_0x38d981['id'],'ChatQueueId':_0x44cc97[_0xa03a('0x5e')]['id']},'transaction':_0x479236});});})[_0xa03a('0x20')](function(){_0x1bb398[_0xa03a('0x7a')](function(_0x58b45e){socket['emit'](_0xa03a('0x7b'),{'UserId':_0x58b45e['id'],'ChatQueueId':_0x316a81['id']});});});});});}})['then'](respondWithStatusCode(_0x3dcce1,null))['catch'](handleError(_0x3dcce1,null));};exports['removeTeams']=function(_0xf1840a,_0x3a077d,_0x3a139b){return db[_0xa03a('0x70')][_0xa03a('0x52')]({'where':{'id':_0xf1840a[_0xa03a('0x42')][_0xa03a('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa03a('0x65')],'as':_0xa03a('0x74'),'attributes':['id'],'raw':!![]}]})[_0xa03a('0x20')](handleEntityNotFound(_0x3a077d,null))[_0xa03a('0x20')](function(_0x3a900b){var _0x3ff615=_[_0xa03a('0x3c')](_0x3a900b,'id');var _0x2755de=[];var _0x5ef17f=[];var _0x57b478=squel[_0xa03a('0x7c')]();_0x57b478[_0xa03a('0x7d')](_0xa03a('0x7e'))[_0xa03a('0x7f')](_0xa03a('0x80'),'tq')[_0xa03a('0x81')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa03a('0x4b')](_0xa03a('0x82'),_0xf1840a[_0xa03a('0x5e')]['id']);for(var _0x49e4f5=0x0;_0x49e4f5<_0x3a900b['length'];_0x49e4f5+=0x1){let _0xe64d15=_0x3a900b[_0x49e4f5];for(var _0x4608fe=0x0;_0x4608fe<_0xe64d15[_0xa03a('0x74')][_0xa03a('0x55')];_0x4608fe+=0x1){let _0x3b97d2=_0xe64d15[_0xa03a('0x74')][_0x4608fe];var _0x1ec386=_0x57b478[_0xa03a('0x83')]();_0x1ec386[_0xa03a('0x4b')](_0xa03a('0x84'),_0x3b97d2['id']);_0x5ef17f[_0xa03a('0x85')](db['sequelize'][_0xa03a('0x42')](_0x1ec386[_0xa03a('0x86')](),{'type':db[_0xa03a('0x87')][_0xa03a('0x88')][_0xa03a('0x89')]})[_0xa03a('0x20')](function(_0x5d018a){if(_0x5d018a[_0xa03a('0x55')]===0x1){return _0x3b97d2['id'];}else{var _0x51723e=_[_0xa03a('0x8a')](_[_0xa03a('0x3c')](_0x5d018a,_0xa03a('0x8b')),function(_0x3d12ad){return _[_0xa03a('0x8c')](_0x3ff615,_0x3d12ad);});if(_0x51723e){return _0x3b97d2['id'];}}}));}}return BPromise[_0xa03a('0x8d')](_0x5ef17f)['then'](function(_0x2a63a3){_0x2755de=_(_0x2755de)[_0xa03a('0x8e')](_0x2a63a3)['compact']()[_0xa03a('0x8f')]();return db[_0xa03a('0x3d')][_0xa03a('0x5c')]({'where':{'id':_0xf1840a['params']['id']}})[_0xa03a('0x20')](function(_0xd45054){return db['sequelize'][_0xa03a('0x78')](function(_0x594ca7){return _0xd45054[_0xa03a('0x90')](_0xf1840a['query'][_0xa03a('0x73')],{'transaction':_0x594ca7})['then'](function(){if(!_[_0xa03a('0x91')](_0x2755de)){return _0xd45054[_0xa03a('0x92')](_0x2755de,{'transaction':_0x594ca7});}})[_0xa03a('0x20')](function(){_0x2755de[_0xa03a('0x7a')](function(_0x10df18){socket[_0xa03a('0x93')](_0xa03a('0x94'),{'UserId':_0x10df18,'ChatQueueId':_0xd45054['id']});});});});});});})[_0xa03a('0x20')](respondWithStatusCode(_0x3a077d,null))['catch'](handleError(_0x3a077d,null));};exports['addAgents']=function(_0x43b0c7,_0xb5540f,_0x44ab49){return db[_0xa03a('0x3d')]['find']({'where':{'id':_0x43b0c7[_0xa03a('0x5e')]['id']}})[_0xa03a('0x20')](handleEntityNotFound(_0xb5540f,null))[_0xa03a('0x20')](function(_0x3988bc){if(_0x3988bc){return _0x3988bc[_0xa03a('0x95')](_0x43b0c7[_0xa03a('0x57')][_0xa03a('0x73')],_[_0xa03a('0x96')](_0x43b0c7[_0xa03a('0x57')],[_0xa03a('0x73'),'id'])||{})[_0xa03a('0x97')](function(_0x247d8e){for(var _0x521676=0x0;_0x521676<_0x43b0c7[_0xa03a('0x57')]['ids'][_0xa03a('0x55')];_0x521676+=0x1){socket[_0xa03a('0x93')](_0xa03a('0x7b'),{'UserId':Number(_0x43b0c7[_0xa03a('0x57')][_0xa03a('0x73')][_0x521676]),'ChatQueueId':Number(_0x43b0c7[_0xa03a('0x5e')]['id'])});}return _0x247d8e;});}})[_0xa03a('0x20')](respondWithResult(_0xb5540f,null))[_0xa03a('0x2b')](handleError(_0xb5540f,null));};exports[_0xa03a('0x92')]=function(_0x2077d8,_0x74e912,_0x562880){return db['ChatQueue'][_0xa03a('0x5c')]({'where':{'id':_0x2077d8[_0xa03a('0x5e')]['id']}})[_0xa03a('0x20')](handleEntityNotFound(_0x74e912,null))['then'](function(_0x26eee1){if(_0x26eee1){return _0x26eee1['removeAgents'](_0x2077d8[_0xa03a('0x42')][_0xa03a('0x73')])[_0xa03a('0x20')](function(){if(_['isArray'](_0x2077d8['query'][_0xa03a('0x73')])){for(var _0x2781fb=0x0;_0x2781fb<_0x2077d8[_0xa03a('0x42')][_0xa03a('0x73')][_0xa03a('0x55')];_0x2781fb+=0x1){socket[_0xa03a('0x93')]('userChatQueue:remove',{'UserId':Number(_0x2077d8['query']['ids'][_0x2781fb]),'ChatQueueId':Number(_0x2077d8[_0xa03a('0x5e')]['id'])});}}else{socket[_0xa03a('0x93')](_0xa03a('0x94'),{'UserId':Number(_0x2077d8[_0xa03a('0x42')]['ids']),'ChatQueueId':Number(_0x2077d8[_0xa03a('0x5e')]['id'])});}});}})[_0xa03a('0x20')](respondWithStatusCode(_0x74e912,null))['catch'](handleError(_0x74e912,null));};exports[_0xa03a('0x98')]=function(_0x8ff75b,_0x5bd307,_0x37c6ea){var _0xf4368e={};var _0x39c2a8={};var _0x42bb79;var _0x3dfd14;return db[_0xa03a('0x3d')][_0xa03a('0x6f')]({'where':{'id':_0x8ff75b[_0xa03a('0x5e')]['id']}})[_0xa03a('0x20')](handleEntityNotFound(_0x5bd307,null))[_0xa03a('0x20')](function(_0xc78f57){if(_0xc78f57){_0x42bb79=_0xc78f57;_0x39c2a8[_0xa03a('0x41')]=_[_0xa03a('0x63')](db[_0xa03a('0x65')]['rawAttributes']);_0x39c2a8[_0xa03a('0x42')]=_[_0xa03a('0x63')](_0x8ff75b[_0xa03a('0x42')]);_0x39c2a8[_0xa03a('0x43')]=_[_0xa03a('0x44')](_0x39c2a8[_0xa03a('0x41')],_0x39c2a8[_0xa03a('0x42')]);_0xf4368e[_0xa03a('0x45')]=_['intersection'](_0x39c2a8[_0xa03a('0x41')],qs[_0xa03a('0x46')](_0x8ff75b[_0xa03a('0x42')][_0xa03a('0x46')]));_0xf4368e[_0xa03a('0x45')]=_0xf4368e[_0xa03a('0x45')]['length']?_0xf4368e['attributes']:_0x39c2a8['model'];_0xf4368e['order']=qs[_0xa03a('0x4a')](_0x8ff75b[_0xa03a('0x42')]['sort']);_0xf4368e[_0xa03a('0x4b')]=qs[_0xa03a('0x43')](_['pick'](_0x8ff75b[_0xa03a('0x42')],_0x39c2a8[_0xa03a('0x43')]));if(_0x8ff75b[_0xa03a('0x42')][_0xa03a('0x71')]){_0xf4368e[_0xa03a('0x4b')]=_['merge'](_0xf4368e[_0xa03a('0x4b')],{'$or':_[_0xa03a('0x3c')](_0xf4368e[_0xa03a('0x45')],function(_0x7829f7){var _0x5e3fec={};_0x5e3fec[_0x7829f7]={'$like':'%'+_0x8ff75b[_0xa03a('0x42')][_0xa03a('0x71')]+'%'};return _0x5e3fec;})});}_0xf4368e=_[_0xa03a('0x4e')]({},_0xf4368e,_0x8ff75b[_0xa03a('0x4f')]);return _0x42bb79[_0xa03a('0x98')](_0xf4368e);}})[_0xa03a('0x20')](function(_0x43c54f){if(_0x43c54f){_0x3dfd14=_0x43c54f['length'];if(!_0x8ff75b['query'][_0xa03a('0x47')]('nolimit')){_0xf4368e[_0xa03a('0x31')]=qs[_0xa03a('0x31')](_0x8ff75b[_0xa03a('0x42')]['limit']);_0xf4368e[_0xa03a('0x33')]=qs['offset'](_0x8ff75b['query'][_0xa03a('0x33')]);}return _0x42bb79[_0xa03a('0x98')](_0xf4368e);}})['then'](function(_0x4cbc33){if(_0x4cbc33){return _0x4cbc33?{'count':_0x3dfd14,'rows':_0x4cbc33}:null;}})[_0xa03a('0x20')](respondWithResult(_0x5bd307,null))['catch'](handleError(_0x5bd307,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 0bc78a9..60aee43 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 _0x3597=['hook','events','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x5326f3,_0xade490){var _0x394455=function(_0x52534c){while(--_0x52534c){_0x5326f3['push'](_0x5326f3['shift']());}};_0x394455(++_0xade490);}(_0x3597,0x91));var _0x7359=function(_0x347618,_0x58effb){_0x347618=_0x347618-0x0;var _0xa1223e=_0x3597[_0x347618];return _0xa1223e;};'use strict';var EventEmitter=require(_0x7359('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x7359('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7359('0x2')](0x0);var events={'afterCreate':_0x7359('0x3'),'afterUpdate':_0x7359('0x4'),'afterDestroy':_0x7359('0x5')};function emitEvent(_0x29cfd2){return function(_0x3ae497,_0x5e7e88,_0x2244cd){ChatQueueEvents[_0x7359('0x6')](_0x29cfd2+':'+_0x3ae497['id'],_0x3ae497);ChatQueueEvents[_0x7359('0x6')](_0x29cfd2,_0x3ae497);_0x2244cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x7359('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xa0e7=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x4e6d53,_0x5a3c61){var _0x2f3c03=function(_0x1395c3){while(--_0x1395c3){_0x4e6d53['push'](_0x4e6d53['shift']());}};_0x2f3c03(++_0x5a3c61);}(_0xa0e7,0x141));var _0x7a0e=function(_0x59327f,_0xd14aac){_0x59327f=_0x59327f-0x0;var _0x5b7632=_0xa0e7[_0x59327f];return _0x5b7632;};'use strict';var EventEmitter=require(_0x7a0e('0x0'));var ChatQueue=require(_0x7a0e('0x1'))['db'][_0x7a0e('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7a0e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a0e('0x4'),'afterDestroy':_0x7a0e('0x5')};function emitEvent(_0x278fab){return function(_0x1d29c7,_0x2e5ec0,_0x3718e3){ChatQueueEvents[_0x7a0e('0x6')](_0x278fab+':'+_0x1d29c7['id'],_0x1d29c7);ChatQueueEvents[_0x7a0e('0x6')](_0x278fab,_0x1d29c7);_0x3718e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x7a0e('0x7')](e,emitEvent(event));}}module[_0x7a0e('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 74f31c3..adbd633 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 _0xb463=['rimraf','define','chat_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3cc28d,_0x586ed0){var _0x314327=function(_0x52f98d){while(--_0x52f98d){_0x3cc28d['push'](_0x3cc28d['shift']());}};_0x314327(++_0x586ed0);}(_0xb463,0x107));var _0x3b46=function(_0xdc6b85,_0x45fcf5){_0xdc6b85=_0xdc6b85-0x0;var _0x3839a0=_0xb463[_0xdc6b85];return _0x3839a0;};'use strict';var _=require(_0x3b46('0x0'));var util=require(_0x3b46('0x1'));var logger=require('../../config/logger')(_0x3b46('0x2'));var moment=require(_0x3b46('0x3'));var BPromise=require(_0x3b46('0x4'));var rp=require(_0x3b46('0x5'));var fs=require('fs');var path=require(_0x3b46('0x6'));var rimraf=require(_0x3b46('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module['exports']=function(_0x4cef72,_0x45c61b){return _0x4cef72[_0x3b46('0x8')]('ChatQueue',attributes,{'tableName':_0x3b46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8014=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x310481,_0x5eeee3){var _0x3c9d8f=function(_0x1bfe3f){while(--_0x1bfe3f){_0x310481['push'](_0x310481['shift']());}};_0x3c9d8f(++_0x5eeee3);}(_0x8014,0x96));var _0x4801=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x8014[_0x502953];return _0x2fa32d;};'use strict';var _=require(_0x4801('0x0'));var util=require('util');var logger=require(_0x4801('0x1'))(_0x4801('0x2'));var moment=require(_0x4801('0x3'));var BPromise=require(_0x4801('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4801('0x5'));var config=require(_0x4801('0x6'));var attributes=require(_0x4801('0x7'));module[_0x4801('0x8')]=function(_0x126e8e,_0x3fffe3){return _0x126e8e[_0x4801('0x9')](_0x4801('0xa'),attributes,{'tableName':_0x4801('0xb'),'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 33c764f..e81ae56 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 _0x83cd=['where','attributes','limit','include','map','model','info','ShowChatQueue','find','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','redis','register','request','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','raw'];(function(_0x18b8c8,_0x35ba24){var _0x1af76a=function(_0x48de23){while(--_0x48de23){_0x18b8c8['push'](_0x18b8c8['shift']());}};_0x1af76a(++_0x35ba24);}(_0x83cd,0x17b));var _0xd83c=function(_0x35cac3,_0xd80316){_0x35cac3=_0x35cac3-0x0;var _0x189ca4=_0x83cd[_0x35cac3];return _0x189ca4;};'use strict';var _=require(_0xd83c('0x0'));var util=require(_0xd83c('0x1'));var moment=require(_0xd83c('0x2'));var BPromise=require(_0xd83c('0x3'));var rs=require(_0xd83c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd83c('0x5'))['db'];var utils=require(_0xd83c('0x6'));var logger=require(_0xd83c('0x7'))(_0xd83c('0x8'));var config=require('../../config/environment');var jayson=require(_0xd83c('0x9'));var client=jayson[_0xd83c('0xa')][_0xd83c('0xb')]({'port':0x232a});config['redis']=_[_0xd83c('0xc')](config['redis'],{'host':_0xd83c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd83c('0xe')]));require('./chatQueue.socket')[_0xd83c('0xf')](socket);function respondWithRpcPromise(_0x34ec60,_0x1dfb1d,_0x1b717b){return new BPromise(function(_0x226c96,_0x415853){return client[_0xd83c('0x10')](_0x34ec60,_0x1b717b)['then'](function(_0x3f6e36){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1dfb1d,_0xd83c('0x11'));logger[_0xd83c('0x12')](_0xd83c('0x13'),_0x1dfb1d,'request\x20sent',JSON[_0xd83c('0x14')](_0x3f6e36));if(_0x3f6e36[_0xd83c('0x15')]){if(_0x3f6e36[_0xd83c('0x15')][_0xd83c('0x16')]===0x1f4){logger[_0xd83c('0x15')](_0xd83c('0x17'),_0x1dfb1d,_0x3f6e36[_0xd83c('0x15')]['message']);return _0x415853(_0x3f6e36[_0xd83c('0x15')]['message']);}logger[_0xd83c('0x15')](_0xd83c('0x17'),_0x1dfb1d,_0x3f6e36[_0xd83c('0x15')][_0xd83c('0x18')]);return _0x226c96(_0x3f6e36['error'][_0xd83c('0x18')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x1dfb1d,_0xd83c('0x11'));_0x226c96(_0x3f6e36[_0xd83c('0x19')][_0xd83c('0x18')]);}})[_0xd83c('0x1a')](function(_0x2dbc60){logger[_0xd83c('0x15')](_0xd83c('0x17'),_0x1dfb1d,_0x2dbc60);_0x415853(_0x2dbc60);});});}exports[_0xd83c('0x1b')]=function(_0x1f95b8){var _0x24fa52=this;return new Promise(function(_0x45908d,_0x30d96c){return db[_0xd83c('0x1c')]['findAll']({'raw':_0x1f95b8[_0xd83c('0x1d')]?_0x1f95b8[_0xd83c('0x1d')][_0xd83c('0x1e')]===undefined?!![]:![]:!![],'where':_0x1f95b8[_0xd83c('0x1d')]?_0x1f95b8[_0xd83c('0x1d')][_0xd83c('0x1f')]||null:null,'attributes':_0x1f95b8[_0xd83c('0x1d')]?_0x1f95b8[_0xd83c('0x1d')][_0xd83c('0x20')]||null:null,'limit':_0x1f95b8[_0xd83c('0x1d')]?_0x1f95b8[_0xd83c('0x1d')][_0xd83c('0x21')]||null:null,'include':_0x1f95b8[_0xd83c('0x1d')]?_0x1f95b8[_0xd83c('0x1d')][_0xd83c('0x22')]?_[_0xd83c('0x23')](_0x1f95b8['options'][_0xd83c('0x22')],function(_0x5c9dc0){return{'model':db[_0x5c9dc0['model']],'as':_0x5c9dc0['as'],'attributes':_0x5c9dc0['attributes'],'include':_0x5c9dc0[_0xd83c('0x22')]?_['map'](_0x5c9dc0[_0xd83c('0x22')],function(_0x339ff9){return{'model':db[_0x339ff9['model']],'as':_0x339ff9['as'],'attributes':_0x339ff9[_0xd83c('0x20')],'include':_0x339ff9[_0xd83c('0x22')]?_[_0xd83c('0x23')](_0x339ff9['include'],function(_0x1e3f30){return{'model':db[_0x1e3f30[_0xd83c('0x24')]],'as':_0x1e3f30['as'],'attributes':_0x1e3f30[_0xd83c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34731d){logger[_0xd83c('0x25')](_0xd83c('0x1b'),_0x1f95b8);logger['debug'](_0xd83c('0x1b'),_0x1f95b8,JSON[_0xd83c('0x14')](_0x34731d));_0x45908d(_0x34731d);})[_0xd83c('0x1a')](function(_0xe04b9a){logger[_0xd83c('0x15')](_0xd83c('0x1b'),_0xe04b9a[_0xd83c('0x18')],_0x1f95b8);_0x30d96c(_0x24fa52['error'](0x1f4,_0xe04b9a[_0xd83c('0x18')]));});});};exports[_0xd83c('0x26')]=function(_0x173201){var _0x4e8e2a=this;return new Promise(function(_0x3467e5,_0x4f0da6){return db['ChatQueue'][_0xd83c('0x27')]({'raw':_0x173201[_0xd83c('0x1d')]?_0x173201[_0xd83c('0x1d')][_0xd83c('0x1e')]===undefined?!![]:![]:!![],'where':_0x173201[_0xd83c('0x1d')]?_0x173201[_0xd83c('0x1d')][_0xd83c('0x1f')]||null:null,'attributes':_0x173201[_0xd83c('0x1d')]?_0x173201[_0xd83c('0x1d')][_0xd83c('0x20')]||null:null,'include':_0x173201[_0xd83c('0x1d')]?_0x173201['options']['include']?_['map'](_0x173201[_0xd83c('0x1d')]['include'],function(_0x1a0cc0){return{'model':db[_0x1a0cc0[_0xd83c('0x24')]],'as':_0x1a0cc0['as'],'attributes':_0x1a0cc0['attributes'],'include':_0x1a0cc0[_0xd83c('0x22')]?_[_0xd83c('0x23')](_0x1a0cc0['include'],function(_0x4b7fe4){return{'model':db[_0x4b7fe4[_0xd83c('0x24')]],'as':_0x4b7fe4['as'],'attributes':_0x4b7fe4[_0xd83c('0x20')],'include':_0x4b7fe4['include']?_['map'](_0x4b7fe4['include'],function(_0x313094){return{'model':db[_0x313094[_0xd83c('0x24')]],'as':_0x313094['as'],'attributes':_0x313094[_0xd83c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd83c('0x28')](function(_0x329a02){logger[_0xd83c('0x25')](_0xd83c('0x26'),_0x173201);logger['debug']('ShowChatQueue',_0x173201,JSON[_0xd83c('0x14')](_0x329a02));_0x3467e5(_0x329a02);})[_0xd83c('0x1a')](function(_0x4814b9){logger['error'](_0xd83c('0x26'),_0x4814b9[_0xd83c('0x18')],_0x173201);_0x4f0da6(_0x4e8e2a[_0xd83c('0x15')](0x1f4,_0x4814b9[_0xd83c('0x18')]));});});}; \ No newline at end of file +var _0x9a4d=['error','code','message','info','result','GetChatQueue','ChatQueue','findAll','options','attributes','include','map','model','ShowChatQueue','find','where','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x27fbfc,_0x4ec14f){var _0x27fb46=function(_0x5de8cd){while(--_0x5de8cd){_0x27fbfc['push'](_0x27fbfc['shift']());}};_0x27fb46(++_0x4ec14f);}(_0x9a4d,0xa8));var _0xd9a4=function(_0x18cf9a,_0xb19502){_0x18cf9a=_0x18cf9a-0x0;var _0x1203f7=_0x9a4d[_0x18cf9a];return _0x1203f7;};'use strict';var _=require(_0xd9a4('0x0'));var util=require(_0xd9a4('0x1'));var moment=require(_0xd9a4('0x2'));var BPromise=require(_0xd9a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd9a4('0x4'));var logger=require(_0xd9a4('0x5'))(_0xd9a4('0x6'));var config=require(_0xd9a4('0x7'));var jayson=require(_0xd9a4('0x8'));var client=jayson['client'][_0xd9a4('0x9')]({'port':0x232a});config[_0xd9a4('0xa')]=_[_0xd9a4('0xb')](config[_0xd9a4('0xa')],{'host':_0xd9a4('0xc'),'port':0x18eb});var socket=require(_0xd9a4('0xd'))(new Redis(config['redis']));require(_0xd9a4('0xe'))[_0xd9a4('0xf')](socket);function respondWithRpcPromise(_0x45d15b,_0x30e4a,_0x50e04e){return new BPromise(function(_0x432050,_0x3c0e79){return client[_0xd9a4('0x10')](_0x45d15b,_0x50e04e)[_0xd9a4('0x11')](function(_0x303a2b){logger['info'](_0xd9a4('0x12'),_0x30e4a,_0xd9a4('0x13'));logger[_0xd9a4('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x30e4a,_0xd9a4('0x13'),JSON[_0xd9a4('0x15')](_0x303a2b));if(_0x303a2b[_0xd9a4('0x16')]){if(_0x303a2b[_0xd9a4('0x16')][_0xd9a4('0x17')]===0x1f4){logger[_0xd9a4('0x16')](_0xd9a4('0x12'),_0x30e4a,_0x303a2b[_0xd9a4('0x16')][_0xd9a4('0x18')]);return _0x3c0e79(_0x303a2b['error'][_0xd9a4('0x18')]);}logger[_0xd9a4('0x16')]('ChatQueue,\x20%s,\x20%s',_0x30e4a,_0x303a2b[_0xd9a4('0x16')][_0xd9a4('0x18')]);return _0x432050(_0x303a2b[_0xd9a4('0x16')][_0xd9a4('0x18')]);}else{logger[_0xd9a4('0x19')]('ChatQueue,\x20%s,\x20%s',_0x30e4a,_0xd9a4('0x13'));_0x432050(_0x303a2b[_0xd9a4('0x1a')][_0xd9a4('0x18')]);}})['catch'](function(_0x59e9d7){logger['error'](_0xd9a4('0x12'),_0x30e4a,_0x59e9d7);_0x3c0e79(_0x59e9d7);});});}exports[_0xd9a4('0x1b')]=function(_0x2103d9){var _0x459fe3=this;return new Promise(function(_0x1b28d4,_0x25ef52){return db[_0xd9a4('0x1c')][_0xd9a4('0x1d')]({'raw':_0x2103d9['options']?_0x2103d9['options']['raw']===undefined?!![]:![]:!![],'where':_0x2103d9[_0xd9a4('0x1e')]?_0x2103d9[_0xd9a4('0x1e')]['where']||null:null,'attributes':_0x2103d9[_0xd9a4('0x1e')]?_0x2103d9[_0xd9a4('0x1e')][_0xd9a4('0x1f')]||null:null,'limit':_0x2103d9[_0xd9a4('0x1e')]?_0x2103d9[_0xd9a4('0x1e')]['limit']||null:null,'include':_0x2103d9[_0xd9a4('0x1e')]?_0x2103d9['options'][_0xd9a4('0x20')]?_[_0xd9a4('0x21')](_0x2103d9[_0xd9a4('0x1e')][_0xd9a4('0x20')],function(_0x191b85){return{'model':db[_0x191b85[_0xd9a4('0x22')]],'as':_0x191b85['as'],'attributes':_0x191b85['attributes'],'include':_0x191b85[_0xd9a4('0x20')]?_[_0xd9a4('0x21')](_0x191b85[_0xd9a4('0x20')],function(_0x3dcc4d){return{'model':db[_0x3dcc4d[_0xd9a4('0x22')]],'as':_0x3dcc4d['as'],'attributes':_0x3dcc4d[_0xd9a4('0x1f')],'include':_0x3dcc4d[_0xd9a4('0x20')]?_[_0xd9a4('0x21')](_0x3dcc4d[_0xd9a4('0x20')],function(_0x48bc1a){return{'model':db[_0x48bc1a['model']],'as':_0x48bc1a['as'],'attributes':_0x48bc1a[_0xd9a4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd9a4('0x11')](function(_0x3d5bd1){logger['info'](_0xd9a4('0x1b'),_0x2103d9);logger['debug'](_0xd9a4('0x1b'),_0x2103d9,JSON[_0xd9a4('0x15')](_0x3d5bd1));_0x1b28d4(_0x3d5bd1);})['catch'](function(_0x2e5bd9){logger['error'](_0xd9a4('0x1b'),_0x2e5bd9[_0xd9a4('0x18')],_0x2103d9);_0x25ef52(_0x459fe3[_0xd9a4('0x16')](0x1f4,_0x2e5bd9[_0xd9a4('0x18')]));});});};exports[_0xd9a4('0x23')]=function(_0x4cc9ba){var _0x576427=this;return new Promise(function(_0xd8b3cc,_0x5ba340){return db[_0xd9a4('0x1c')][_0xd9a4('0x24')]({'raw':_0x4cc9ba[_0xd9a4('0x1e')]?_0x4cc9ba['options']['raw']===undefined?!![]:![]:!![],'where':_0x4cc9ba[_0xd9a4('0x1e')]?_0x4cc9ba[_0xd9a4('0x1e')][_0xd9a4('0x25')]||null:null,'attributes':_0x4cc9ba[_0xd9a4('0x1e')]?_0x4cc9ba[_0xd9a4('0x1e')][_0xd9a4('0x1f')]||null:null,'include':_0x4cc9ba[_0xd9a4('0x1e')]?_0x4cc9ba['options'][_0xd9a4('0x20')]?_[_0xd9a4('0x21')](_0x4cc9ba[_0xd9a4('0x1e')][_0xd9a4('0x20')],function(_0x223cb3){return{'model':db[_0x223cb3[_0xd9a4('0x22')]],'as':_0x223cb3['as'],'attributes':_0x223cb3[_0xd9a4('0x1f')],'include':_0x223cb3['include']?_[_0xd9a4('0x21')](_0x223cb3[_0xd9a4('0x20')],function(_0xaca7c0){return{'model':db[_0xaca7c0['model']],'as':_0xaca7c0['as'],'attributes':_0xaca7c0['attributes'],'include':_0xaca7c0[_0xd9a4('0x20')]?_[_0xd9a4('0x21')](_0xaca7c0['include'],function(_0x9dcdfe){return{'model':db[_0x9dcdfe[_0xd9a4('0x22')]],'as':_0x9dcdfe['as'],'attributes':_0x9dcdfe[_0xd9a4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd9a4('0x11')](function(_0x561c02){logger[_0xd9a4('0x19')](_0xd9a4('0x23'),_0x4cc9ba);logger['debug'](_0xd9a4('0x23'),_0x4cc9ba,JSON['stringify'](_0x561c02));_0xd8b3cc(_0x561c02);})['catch'](function(_0x2b8409){logger[_0xd9a4('0x16')](_0xd9a4('0x23'),_0x2b8409['message'],_0x4cc9ba);_0x5ba340(_0x576427['error'](0x1f4,_0x2b8409[_0xd9a4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 35767c1..fb2abf8 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x1303b5,_0x5ce3f6){var _0x7cfdc3=function(_0x37b5a3){while(--_0x37b5a3){_0x1303b5['push'](_0x1303b5['shift']());}};_0x7cfdc3(++_0x5ce3f6);}(_0x70e0,0x17b));var _0x070e=function(_0x4d09d5,_0x4452b0){_0x4d09d5=_0x4d09d5-0x0;var _0xa2de33=_0x70e0[_0x4d09d5];return _0xa2de33;};'use strict';var ChatQueueEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){ChatQueueEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);ChatQueueEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file +var _0x6334=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x182e85,_0x3c4f39){var _0x3196f5=function(_0x57ca9b){while(--_0x57ca9b){_0x182e85['push'](_0x182e85['shift']());}};_0x3196f5(++_0x3c4f39);}(_0x6334,0x119));var _0x4633=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x6334[_0x2c3255];return _0x282aba;};'use strict';var ChatQueueEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){ChatQueueEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);ChatQueueEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f751e7c..404a976 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x3c59c8,_0x14c5e8){_0x3c59c8=_0x3c59c8-0x0;var _0x21f19f=_0x3e74[_0x3c59c8];return _0x21f19f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e74,0x175));var _0x43e7=function(_0xa66c6,_0x13e61e){_0xa66c6=_0xa66c6-0x0;var _0x337852=_0x3e74[_0xa66c6];return _0x337852;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 01c6897..5482d91 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 _0xe68b=['sequelize','exports','STRING','DATE','moment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xe68b,0x6d));var _0xbe68=function(_0x7a81f7,_0x53385e){_0x7a81f7=_0x7a81f7-0x0;var _0x1b0169=_0xe68b[_0x7a81f7];return _0x1b0169;};'use strict';var moment=require(_0xbe68('0x0'));var Sequelize=require(_0xbe68('0x1'));module[_0xbe68('0x2')]={'uniqueid':{'type':Sequelize[_0xbe68('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbe68('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbe68('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbe68('0x4')]},'reason':{'type':Sequelize[_0xbe68('0x3')]}}; \ No newline at end of file +var _0x7eea=['DATE','moment','sequelize','exports','STRING'];(function(_0x3a5ad3,_0x3187fc){var _0x5292fc=function(_0x256879){while(--_0x256879){_0x3a5ad3['push'](_0x3a5ad3['shift']());}};_0x5292fc(++_0x3187fc);}(_0x7eea,0x7e));var _0xa7ee=function(_0x1c420a,_0x4e8f10){_0x1c420a=_0x1c420a-0x0;var _0x1f531d=_0x7eea[_0x1c420a];return _0x1f531d;};'use strict';var moment=require(_0xa7ee('0x0'));var Sequelize=require(_0xa7ee('0x1'));module[_0xa7ee('0x2')]={'uniqueid':{'type':Sequelize[_0xa7ee('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa7ee('0x3')]},'joinAt':{'type':Sequelize[_0xa7ee('0x4')]},'leaveAt':{'type':Sequelize[_0xa7ee('0x4')]},'acceptAt':{'type':Sequelize[_0xa7ee('0x4')]},'exitAt':{'type':Sequelize[_0xa7ee('0x4')]},'reason':{'type':Sequelize[_0xa7ee('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 810aa77..7d05c9e 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 _0x5078=['sort','where','filters','merge','filter','includeAll','include','findAll','rows','catch','show','params','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5ef0fe,_0xb5967a){var _0x3a18bb=function(_0x3b633e){while(--_0x3b633e){_0x5ef0fe['push'](_0x5ef0fe['shift']());}};_0x3a18bb(++_0xb5967a);}(_0x5078,0x148));var _0x8507=function(_0x2def85,_0x39b650){_0x2def85=_0x2def85-0x0;var _0x12ce04=_0x5078[_0x2def85];return _0x12ce04;};'use strict';var emlformat=require(_0x8507('0x0'));var rimraf=require(_0x8507('0x1'));var zipdir=require(_0x8507('0x2'));var jsonpatch=require(_0x8507('0x3'));var rp=require(_0x8507('0x4'));var moment=require(_0x8507('0x5'));var BPromise=require(_0x8507('0x6'));var Mustache=require(_0x8507('0x7'));var util=require(_0x8507('0x8'));var path=require(_0x8507('0x9'));var sox=require(_0x8507('0xa'));var csv=require(_0x8507('0xb'));var ejs=require(_0x8507('0xc'));var fs=require('fs');var fs_extra=require(_0x8507('0xd'));var _=require(_0x8507('0xe'));var squel=require(_0x8507('0xf'));var crypto=require('crypto');var jsforce=require(_0x8507('0x10'));var deskjs=require(_0x8507('0x11'));var toCsv=require(_0x8507('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8507('0x12'));var authService=require(_0x8507('0x13'));var qs=require(_0x8507('0x14'));var as=require(_0x8507('0x15'));var hardwareService=require(_0x8507('0x16'));var logger=require(_0x8507('0x17'))(_0x8507('0x18'));var utils=require('../../config/utils');var config=require(_0x8507('0x19'));var licenseUtil=require(_0x8507('0x1a'));var db=require(_0x8507('0x1b'))['db'];function respondWithStatusCode(_0x31109f,_0x21a236){_0x21a236=_0x21a236||0xcc;return function(_0x5c41e2){if(_0x5c41e2){return _0x31109f['sendStatus'](_0x21a236);}return _0x31109f[_0x8507('0x1c')](_0x21a236)[_0x8507('0x1d')]();};}function respondWithResult(_0x1f5550,_0x3bafeb){_0x3bafeb=_0x3bafeb||0xc8;return function(_0x2ea0e1){if(_0x2ea0e1){return _0x1f5550[_0x8507('0x1c')](_0x3bafeb)['json'](_0x2ea0e1);}};}function respondWithFilteredResult(_0x4f5aa0,_0x58ff83){return function(_0x1ec9b8){if(_0x1ec9b8){var _0x3f1ed1=typeof _0x58ff83['offset']===_0x8507('0x1e')&&typeof _0x58ff83[_0x8507('0x1f')]===_0x8507('0x1e');var _0x412aee=_0x1ec9b8[_0x8507('0x20')];var _0x13b285=_0x3f1ed1?0x0:_0x58ff83[_0x8507('0x21')];var _0x36e387=_0x3f1ed1?_0x1ec9b8['count']:_0x58ff83['offset']+_0x58ff83[_0x8507('0x1f')];var _0xc556a4;if(_0x36e387>=_0x412aee){_0x36e387=_0x412aee;_0xc556a4=0xc8;}else{_0xc556a4=0xce;}_0x4f5aa0[_0x8507('0x1c')](_0xc556a4);return _0x4f5aa0[_0x8507('0x22')](_0x8507('0x23'),_0x13b285+'-'+_0x36e387+'/'+_0x412aee)['json'](_0x1ec9b8);}return null;};}function patchUpdates(_0x1b8dbf){return function(_0x16501a){try{jsonpatch[_0x8507('0x24')](_0x16501a,_0x1b8dbf,!![]);}catch(_0x192f1c){return BPromise[_0x8507('0x25')](_0x192f1c);}return _0x16501a[_0x8507('0x26')]();};}function saveUpdates(_0x42e5ff,_0x2dc900){return function(_0x539cf9){if(_0x539cf9){return _0x539cf9[_0x8507('0x27')](_0x42e5ff)[_0x8507('0x28')](function(_0x37fd9c){return _0x37fd9c;});}return null;};}function removeEntity(_0x40ad72,_0x873ec4){return function(_0x438001){if(_0x438001){return _0x438001[_0x8507('0x29')]()[_0x8507('0x28')](function(){_0x40ad72['status'](0xcc)[_0x8507('0x1d')]();});}};}function handleEntityNotFound(_0x24fc61,_0x188ae0){return function(_0x5a559e){if(!_0x5a559e){_0x24fc61[_0x8507('0x2a')](0x194);}return _0x5a559e;};}function handleError(_0x15c710,_0x404d73){_0x404d73=_0x404d73||0x1f4;return function(_0x160402){logger['error'](_0x160402[_0x8507('0x2b')]);if(_0x160402[_0x8507('0x2c')]){delete _0x160402[_0x8507('0x2c')];}_0x15c710[_0x8507('0x1c')](_0x404d73)[_0x8507('0x2d')](_0x160402);};}exports['index']=function(_0x23c6e1,_0xb01c06){var _0x232182={},_0x2ca452={},_0x25fe12={'count':0x0,'rows':[]};var _0x8b5a47=_[_0x8507('0x2e')](db[_0x8507('0x2f')][_0x8507('0x30')],function(_0x6e9a38){return{'name':_0x6e9a38[_0x8507('0x31')],'type':_0x6e9a38[_0x8507('0x32')][_0x8507('0x33')]};});_0x2ca452['model']=_['map'](_0x8b5a47,_0x8507('0x2c'));_0x2ca452['query']=_[_0x8507('0x34')](_0x23c6e1[_0x8507('0x35')]);_0x2ca452['filters']=_['intersection'](_0x2ca452['model'],_0x2ca452[_0x8507('0x35')]);_0x232182[_0x8507('0x36')]=_[_0x8507('0x37')](_0x2ca452[_0x8507('0x38')],qs[_0x8507('0x39')](_0x23c6e1[_0x8507('0x35')]['fields']));_0x232182['attributes']=_0x232182[_0x8507('0x36')][_0x8507('0x3a')]?_0x232182[_0x8507('0x36')]:_0x2ca452['model'];if(!_0x23c6e1['query'][_0x8507('0x3b')](_0x8507('0x3c'))){_0x232182['limit']=qs[_0x8507('0x1f')](_0x23c6e1[_0x8507('0x35')]['limit']);_0x232182['offset']=qs['offset'](_0x23c6e1[_0x8507('0x35')][_0x8507('0x21')]);}_0x232182[_0x8507('0x3d')]=qs[_0x8507('0x3e')](_0x23c6e1['query']['sort']);_0x232182[_0x8507('0x3f')]=qs[_0x8507('0x40')](_['pick'](_0x23c6e1[_0x8507('0x35')],_0x2ca452[_0x8507('0x40')]),_0x8b5a47);if(_0x23c6e1[_0x8507('0x35')]['filter']){_0x232182[_0x8507('0x3f')]=_[_0x8507('0x41')](_0x232182[_0x8507('0x3f')],{'$or':_[_0x8507('0x2e')](_0x8b5a47,function(_0x46e6dd){if(_0x46e6dd[_0x8507('0x32')]!=='VIRTUAL'){var _0x42e640={};_0x42e640[_0x46e6dd[_0x8507('0x2c')]]={'$like':'%'+_0x23c6e1['query'][_0x8507('0x42')]+'%'};return _0x42e640;}})});}_0x232182=_[_0x8507('0x41')]({},_0x232182,_0x23c6e1['options']);var _0x2297a8={'where':_0x232182['where']};return db[_0x8507('0x2f')][_0x8507('0x20')](_0x2297a8)['then'](function(_0x2d344e){_0x25fe12['count']=_0x2d344e;if(_0x23c6e1[_0x8507('0x35')][_0x8507('0x43')]){_0x232182[_0x8507('0x44')]=[{'all':!![]}];}return db[_0x8507('0x2f')][_0x8507('0x45')](_0x232182);})[_0x8507('0x28')](function(_0x54d8d3){_0x25fe12[_0x8507('0x46')]=_0x54d8d3;return _0x25fe12;})[_0x8507('0x28')](respondWithFilteredResult(_0xb01c06,_0x232182))[_0x8507('0x47')](handleError(_0xb01c06,null));};exports[_0x8507('0x48')]=function(_0x57083e,_0x260a98){var _0x2e49d0={'raw':!![],'where':{'id':_0x57083e[_0x8507('0x49')]['id']}},_0x55b156={};_0x55b156[_0x8507('0x38')]=_[_0x8507('0x34')](db['ChatQueueReport'][_0x8507('0x30')]);_0x55b156['query']=_[_0x8507('0x34')](_0x57083e[_0x8507('0x35')]);_0x55b156[_0x8507('0x40')]=_[_0x8507('0x37')](_0x55b156['model'],_0x55b156[_0x8507('0x35')]);_0x2e49d0[_0x8507('0x36')]=_[_0x8507('0x37')](_0x55b156[_0x8507('0x38')],qs['fields'](_0x57083e['query']['fields']));_0x2e49d0[_0x8507('0x36')]=_0x2e49d0[_0x8507('0x36')][_0x8507('0x3a')]?_0x2e49d0[_0x8507('0x36')]:_0x55b156[_0x8507('0x38')];if(_0x57083e[_0x8507('0x35')]['includeAll']){_0x2e49d0[_0x8507('0x44')]=[{'all':!![]}];}_0x2e49d0=_[_0x8507('0x41')]({},_0x2e49d0,_0x57083e['options']);return db[_0x8507('0x2f')][_0x8507('0x4a')](_0x2e49d0)[_0x8507('0x28')](handleEntityNotFound(_0x260a98,null))[_0x8507('0x28')](respondWithResult(_0x260a98,null))[_0x8507('0x47')](handleError(_0x260a98,null));};exports[_0x8507('0x4b')]=function(_0x4858b6,_0x5e119e){return db['ChatQueueReport'][_0x8507('0x4b')](_0x4858b6[_0x8507('0x4c')],{})[_0x8507('0x28')](respondWithResult(_0x5e119e,0xc9))[_0x8507('0x47')](handleError(_0x5e119e,null));};exports[_0x8507('0x27')]=function(_0x2c3a5d,_0x5bb3c4){if(_0x2c3a5d[_0x8507('0x4c')]['id']){delete _0x2c3a5d[_0x8507('0x4c')]['id'];}return db[_0x8507('0x2f')][_0x8507('0x4a')]({'where':{'id':_0x2c3a5d[_0x8507('0x49')]['id']}})[_0x8507('0x28')](handleEntityNotFound(_0x5bb3c4,null))['then'](saveUpdates(_0x2c3a5d['body'],null))[_0x8507('0x28')](respondWithResult(_0x5bb3c4,null))[_0x8507('0x47')](handleError(_0x5bb3c4,null));};exports[_0x8507('0x29')]=function(_0x75b763,_0x50465d){return db[_0x8507('0x2f')][_0x8507('0x4a')]({'where':{'id':_0x75b763['params']['id']}})[_0x8507('0x28')](handleEntityNotFound(_0x50465d,null))[_0x8507('0x28')](removeEntity(_0x50465d,null))['catch'](handleError(_0x50465d,null));};exports[_0x8507('0x4d')]=function(_0x109b91,_0x447978){return db[_0x8507('0x2f')][_0x8507('0x4d')]()[_0x8507('0x28')](respondWithResult(_0x447978,null))[_0x8507('0x47')](handleError(_0x447978,null));}; \ No newline at end of file +var _0xaf0d=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','name','send','map','ChatQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','include','show','length','catch','create','body','find','params','describe','rimraf','zip-dir','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x323464,_0x22141b){_0x323464=_0x323464-0x0;var _0x1a8699=_0xaf0d[_0x323464];return _0x1a8699;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdaf0('0x0'));var zipdir=require(_0xdaf0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdaf0('0x2'));var path=require(_0xdaf0('0x3'));var sox=require(_0xdaf0('0x4'));var csv=require('to-csv');var ejs=require(_0xdaf0('0x5'));var fs=require('fs');var fs_extra=require(_0xdaf0('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdaf0('0x7'));var jsforce=require(_0xdaf0('0x8'));var deskjs=require(_0xdaf0('0x9'));var toCsv=require(_0xdaf0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdaf0('0xb'));var as=require(_0xdaf0('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaf0('0xd'))(_0xdaf0('0xe'));var utils=require(_0xdaf0('0xf'));var config=require(_0xdaf0('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaf0('0x11'))['db'];function respondWithStatusCode(_0x149261,_0x1e7a70){_0x1e7a70=_0x1e7a70||0xcc;return function(_0x4fbd9c){if(_0x4fbd9c){return _0x149261[_0xdaf0('0x12')](_0x1e7a70);}return _0x149261[_0xdaf0('0x13')](_0x1e7a70)['end']();};}function respondWithResult(_0x557f8b,_0x48ea31){_0x48ea31=_0x48ea31||0xc8;return function(_0x4f0b4a){if(_0x4f0b4a){return _0x557f8b['status'](_0x48ea31)[_0xdaf0('0x14')](_0x4f0b4a);}};}function respondWithFilteredResult(_0x4ab77b,_0x4296fc){return function(_0x56bc8e){if(_0x56bc8e){var _0x499482=typeof _0x4296fc[_0xdaf0('0x15')]===_0xdaf0('0x16')&&typeof _0x4296fc[_0xdaf0('0x17')]==='undefined';var _0x806153=_0x56bc8e[_0xdaf0('0x18')];var _0x21db47=_0x499482?0x0:_0x4296fc['offset'];var _0x5a2180=_0x499482?_0x56bc8e[_0xdaf0('0x18')]:_0x4296fc[_0xdaf0('0x15')]+_0x4296fc[_0xdaf0('0x17')];var _0x15d2a9;if(_0x5a2180>=_0x806153){_0x5a2180=_0x806153;_0x15d2a9=0xc8;}else{_0x15d2a9=0xce;}_0x4ab77b[_0xdaf0('0x13')](_0x15d2a9);return _0x4ab77b[_0xdaf0('0x19')](_0xdaf0('0x1a'),_0x21db47+'-'+_0x5a2180+'/'+_0x806153)['json'](_0x56bc8e);}return null;};}function patchUpdates(_0x353229){return function(_0x350f65){try{jsonpatch[_0xdaf0('0x1b')](_0x350f65,_0x353229,!![]);}catch(_0x452bb6){return BPromise['reject'](_0x452bb6);}return _0x350f65[_0xdaf0('0x1c')]();};}function saveUpdates(_0x320d6e,_0x100817){return function(_0xdc104f){if(_0xdc104f){return _0xdc104f['update'](_0x320d6e)[_0xdaf0('0x1d')](function(_0x3f886f){return _0x3f886f;});}return null;};}function removeEntity(_0xd94acb,_0x13abfc){return function(_0xb921d5){if(_0xb921d5){return _0xb921d5[_0xdaf0('0x1e')]()[_0xdaf0('0x1d')](function(){_0xd94acb['status'](0xcc)[_0xdaf0('0x1f')]();});}};}function handleEntityNotFound(_0x33e5c2,_0xe41671){return function(_0x401a58){if(!_0x401a58){_0x33e5c2[_0xdaf0('0x12')](0x194);}return _0x401a58;};}function handleError(_0x688451,_0x2efd93){_0x2efd93=_0x2efd93||0x1f4;return function(_0x4d3347){logger[_0xdaf0('0x20')](_0x4d3347['stack']);if(_0x4d3347[_0xdaf0('0x21')]){delete _0x4d3347[_0xdaf0('0x21')];}_0x688451['status'](_0x2efd93)[_0xdaf0('0x22')](_0x4d3347);};}exports['index']=function(_0x28e230,_0xd78a51){var _0x5dbb6d={},_0xaf86cb={},_0x2378ae={'count':0x0,'rows':[]};var _0x2fb05b=_[_0xdaf0('0x23')](db[_0xdaf0('0x24')]['rawAttributes'],function(_0xb1a379){return{'name':_0xb1a379[_0xdaf0('0x25')],'type':_0xb1a379[_0xdaf0('0x26')]['key']};});_0xaf86cb[_0xdaf0('0x27')]=_[_0xdaf0('0x23')](_0x2fb05b,'name');_0xaf86cb[_0xdaf0('0x28')]=_[_0xdaf0('0x29')](_0x28e230['query']);_0xaf86cb[_0xdaf0('0x2a')]=_[_0xdaf0('0x2b')](_0xaf86cb[_0xdaf0('0x27')],_0xaf86cb[_0xdaf0('0x28')]);_0x5dbb6d[_0xdaf0('0x2c')]=_[_0xdaf0('0x2b')](_0xaf86cb[_0xdaf0('0x27')],qs[_0xdaf0('0x2d')](_0x28e230[_0xdaf0('0x28')][_0xdaf0('0x2d')]));_0x5dbb6d[_0xdaf0('0x2c')]=_0x5dbb6d['attributes']['length']?_0x5dbb6d['attributes']:_0xaf86cb[_0xdaf0('0x27')];if(!_0x28e230[_0xdaf0('0x28')]['hasOwnProperty'](_0xdaf0('0x2e'))){_0x5dbb6d[_0xdaf0('0x17')]=qs[_0xdaf0('0x17')](_0x28e230[_0xdaf0('0x28')][_0xdaf0('0x17')]);_0x5dbb6d[_0xdaf0('0x15')]=qs[_0xdaf0('0x15')](_0x28e230[_0xdaf0('0x28')][_0xdaf0('0x15')]);}_0x5dbb6d[_0xdaf0('0x2f')]=qs[_0xdaf0('0x30')](_0x28e230[_0xdaf0('0x28')][_0xdaf0('0x30')]);_0x5dbb6d[_0xdaf0('0x31')]=qs[_0xdaf0('0x2a')](_[_0xdaf0('0x32')](_0x28e230[_0xdaf0('0x28')],_0xaf86cb['filters']),_0x2fb05b);if(_0x28e230[_0xdaf0('0x28')][_0xdaf0('0x33')]){_0x5dbb6d[_0xdaf0('0x31')]=_[_0xdaf0('0x34')](_0x5dbb6d[_0xdaf0('0x31')],{'$or':_[_0xdaf0('0x23')](_0x2fb05b,function(_0x380912){if(_0x380912[_0xdaf0('0x26')]!=='VIRTUAL'){var _0x514d1c={};_0x514d1c[_0x380912[_0xdaf0('0x21')]]={'$like':'%'+_0x28e230[_0xdaf0('0x28')][_0xdaf0('0x33')]+'%'};return _0x514d1c;}})});}_0x5dbb6d=_['merge']({},_0x5dbb6d,_0x28e230[_0xdaf0('0x35')]);var _0x4c4d39={'where':_0x5dbb6d[_0xdaf0('0x31')]};return db[_0xdaf0('0x24')][_0xdaf0('0x18')](_0x4c4d39)[_0xdaf0('0x1d')](function(_0x161913){_0x2378ae[_0xdaf0('0x18')]=_0x161913;if(_0x28e230[_0xdaf0('0x28')]['includeAll']){_0x5dbb6d[_0xdaf0('0x36')]=[{'all':!![]}];}return db[_0xdaf0('0x24')]['findAll'](_0x5dbb6d);})[_0xdaf0('0x1d')](function(_0x5b5f3b){_0x2378ae['rows']=_0x5b5f3b;return _0x2378ae;})[_0xdaf0('0x1d')](respondWithFilteredResult(_0xd78a51,_0x5dbb6d))['catch'](handleError(_0xd78a51,null));};exports[_0xdaf0('0x37')]=function(_0x50f02e,_0x1fe74f){var _0x51cf56={'raw':!![],'where':{'id':_0x50f02e['params']['id']}},_0x23dfc1={};_0x23dfc1[_0xdaf0('0x27')]=_[_0xdaf0('0x29')](db[_0xdaf0('0x24')]['rawAttributes']);_0x23dfc1[_0xdaf0('0x28')]=_[_0xdaf0('0x29')](_0x50f02e[_0xdaf0('0x28')]);_0x23dfc1[_0xdaf0('0x2a')]=_[_0xdaf0('0x2b')](_0x23dfc1[_0xdaf0('0x27')],_0x23dfc1[_0xdaf0('0x28')]);_0x51cf56[_0xdaf0('0x2c')]=_['intersection'](_0x23dfc1[_0xdaf0('0x27')],qs[_0xdaf0('0x2d')](_0x50f02e['query'][_0xdaf0('0x2d')]));_0x51cf56[_0xdaf0('0x2c')]=_0x51cf56[_0xdaf0('0x2c')][_0xdaf0('0x38')]?_0x51cf56[_0xdaf0('0x2c')]:_0x23dfc1[_0xdaf0('0x27')];if(_0x50f02e[_0xdaf0('0x28')]['includeAll']){_0x51cf56[_0xdaf0('0x36')]=[{'all':!![]}];}_0x51cf56=_[_0xdaf0('0x34')]({},_0x51cf56,_0x50f02e['options']);return db['ChatQueueReport']['find'](_0x51cf56)[_0xdaf0('0x1d')](handleEntityNotFound(_0x1fe74f,null))[_0xdaf0('0x1d')](respondWithResult(_0x1fe74f,null))[_0xdaf0('0x39')](handleError(_0x1fe74f,null));};exports[_0xdaf0('0x3a')]=function(_0x1ea13a,_0x2e8736){return db[_0xdaf0('0x24')][_0xdaf0('0x3a')](_0x1ea13a[_0xdaf0('0x3b')],{})[_0xdaf0('0x1d')](respondWithResult(_0x2e8736,0xc9))[_0xdaf0('0x39')](handleError(_0x2e8736,null));};exports['update']=function(_0xb112b4,_0x44fd2a){if(_0xb112b4[_0xdaf0('0x3b')]['id']){delete _0xb112b4['body']['id'];}return db[_0xdaf0('0x24')][_0xdaf0('0x3c')]({'where':{'id':_0xb112b4['params']['id']}})[_0xdaf0('0x1d')](handleEntityNotFound(_0x44fd2a,null))[_0xdaf0('0x1d')](saveUpdates(_0xb112b4['body'],null))[_0xdaf0('0x1d')](respondWithResult(_0x44fd2a,null))[_0xdaf0('0x39')](handleError(_0x44fd2a,null));};exports[_0xdaf0('0x1e')]=function(_0x2438e0,_0x2e2696){return db['ChatQueueReport'][_0xdaf0('0x3c')]({'where':{'id':_0x2438e0[_0xdaf0('0x3d')]['id']}})[_0xdaf0('0x1d')](handleEntityNotFound(_0x2e2696,null))[_0xdaf0('0x1d')](removeEntity(_0x2e2696,null))[_0xdaf0('0x39')](handleError(_0x2e2696,null));};exports[_0xdaf0('0x3e')]=function(_0x50f2b6,_0x8dac49){return db[_0xdaf0('0x24')][_0xdaf0('0x3e')]()[_0xdaf0('0x1d')](respondWithResult(_0x8dac49,null))[_0xdaf0('0x39')](handleError(_0x8dac49,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 830d6fe..e095fa0 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x565feb,_0x43a6f0){var _0x1f6808=function(_0x1e4aff){while(--_0x1e4aff){_0x565feb['push'](_0x565feb['shift']());}};_0x1f6808(++_0x43a6f0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x374f88,_0x1c20e8){var _0x569b79=function(_0x29fc96){while(--_0x29fc96){_0x374f88['push'](_0x374f88['shift']());}};_0x569b79(++_0x1c20e8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index e99a14a..934dfea 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 _0x1cfb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','update','raw','where','attributes','limit','UpdateChatQueueReport','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cfb,0x7a));var _0xb1cf=function(_0x3b2a34,_0x55027c){_0x3b2a34=_0x3b2a34-0x0;var _0x3304cd=_0x1cfb[_0x3b2a34];return _0x3304cd;};'use strict';var _=require(_0xb1cf('0x0'));var util=require('util');var moment=require(_0xb1cf('0x1'));var BPromise=require(_0xb1cf('0x2'));var rs=require(_0xb1cf('0x3'));var fs=require('fs');var Redis=require(_0xb1cf('0x4'));var db=require(_0xb1cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1cf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb1cf('0x7'));var client=jayson[_0xb1cf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3995e9,_0x1596ec,_0x229f6d){return new BPromise(function(_0x348741,_0xa8e6ef){return client['request'](_0x3995e9,_0x229f6d)[_0xb1cf('0x9')](function(_0x282d63){logger[_0xb1cf('0xa')](_0xb1cf('0xb'),_0x1596ec,_0xb1cf('0xc'));logger[_0xb1cf('0xd')](_0xb1cf('0xe'),_0x1596ec,'request\x20sent',JSON[_0xb1cf('0xf')](_0x282d63));if(_0x282d63[_0xb1cf('0x10')]){if(_0x282d63[_0xb1cf('0x10')]['code']===0x1f4){logger['error'](_0xb1cf('0xb'),_0x1596ec,_0x282d63['error'][_0xb1cf('0x11')]);return _0xa8e6ef(_0x282d63[_0xb1cf('0x10')][_0xb1cf('0x11')]);}logger[_0xb1cf('0x10')](_0xb1cf('0xb'),_0x1596ec,_0x282d63[_0xb1cf('0x10')]['message']);return _0x348741(_0x282d63[_0xb1cf('0x10')][_0xb1cf('0x11')]);}else{logger[_0xb1cf('0xa')](_0xb1cf('0xb'),_0x1596ec,'request\x20sent');_0x348741(_0x282d63[_0xb1cf('0x12')]['message']);}})[_0xb1cf('0x13')](function(_0x134adf){logger[_0xb1cf('0x10')](_0xb1cf('0xb'),_0x1596ec,_0x134adf);_0xa8e6ef(_0x134adf);});});}exports[_0xb1cf('0x14')]=function(_0x1d70e4){var _0x5c515c=this;return new Promise(function(_0x30b7e8,_0xbdc4d3){return db[_0xb1cf('0x15')][_0xb1cf('0x16')](_0x1d70e4[_0xb1cf('0x17')],{'raw':_0x1d70e4['options']?_0x1d70e4[_0xb1cf('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xb1cf('0x9')](function(_0x2e6920){logger[_0xb1cf('0xa')](_0xb1cf('0x14'),_0x1d70e4);logger[_0xb1cf('0xd')](_0xb1cf('0x14'),_0x1d70e4,JSON[_0xb1cf('0xf')](_0x2e6920));_0x30b7e8(_0x2e6920);})['catch'](function(_0x4444f4){logger['error'](_0xb1cf('0x14'),_0x4444f4[_0xb1cf('0x11')],_0x1d70e4);_0xbdc4d3(_0x5c515c[_0xb1cf('0x10')](0x1f4,_0x4444f4[_0xb1cf('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x4fc1ec){var _0x1d48c4=this;return new Promise(function(_0xd755b,_0x380776){return db[_0xb1cf('0x15')][_0xb1cf('0x19')](_0x4fc1ec[_0xb1cf('0x17')],{'raw':_0x4fc1ec[_0xb1cf('0x18')]?_0x4fc1ec[_0xb1cf('0x18')][_0xb1cf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc1ec[_0xb1cf('0x18')]?_0x4fc1ec[_0xb1cf('0x18')][_0xb1cf('0x1b')]||null:null,'attributes':_0x4fc1ec['options']?_0x4fc1ec[_0xb1cf('0x18')][_0xb1cf('0x1c')]||null:null,'limit':_0x4fc1ec['options']?_0x4fc1ec[_0xb1cf('0x18')][_0xb1cf('0x1d')]||null:null})[_0xb1cf('0x9')](function(_0x1409a9){logger[_0xb1cf('0xa')](_0xb1cf('0x1e'),_0x4fc1ec);logger['debug']('UpdateChatQueueReport',_0x4fc1ec,JSON['stringify'](_0x1409a9));_0xd755b(_0x1409a9);})[_0xb1cf('0x13')](function(_0x1cfd90){logger[_0xb1cf('0x10')](_0xb1cf('0x1e'),_0x1cfd90[_0xb1cf('0x11')],_0x4fc1ec);_0x380776(_0x1d48c4[_0xb1cf('0x10')](0x1f4,_0x1cfd90[_0xb1cf('0x11')]));});});}; \ No newline at end of file +var _0x6ec8=['UpdateChatQueueReport','update','body','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','options','raw'];(function(_0x34217f,_0x4954d9){var _0x533721=function(_0x5ea689){while(--_0x5ea689){_0x34217f['push'](_0x34217f['shift']());}};_0x533721(++_0x4954d9);}(_0x6ec8,0x18a));var _0x86ec=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x6ec8[_0x3725ee];return _0x399c71;};'use strict';var _=require('lodash');var util=require(_0x86ec('0x0'));var moment=require('moment');var BPromise=require(_0x86ec('0x1'));var rs=require(_0x86ec('0x2'));var fs=require('fs');var Redis=require(_0x86ec('0x3'));var db=require(_0x86ec('0x4'))['db'];var utils=require(_0x86ec('0x5'));var logger=require(_0x86ec('0x6'))('rpc');var config=require(_0x86ec('0x7'));var jayson=require(_0x86ec('0x8'));var client=jayson[_0x86ec('0x9')][_0x86ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ad761,_0x5ee31f,_0x5adef5){return new BPromise(function(_0x447f94,_0x48c542){return client['request'](_0x4ad761,_0x5adef5)[_0x86ec('0xb')](function(_0x37ba88){logger[_0x86ec('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x5ee31f,_0x86ec('0xd'));logger[_0x86ec('0xe')](_0x86ec('0xf'),_0x5ee31f,_0x86ec('0xd'),JSON[_0x86ec('0x10')](_0x37ba88));if(_0x37ba88[_0x86ec('0x11')]){if(_0x37ba88[_0x86ec('0x11')]['code']===0x1f4){logger[_0x86ec('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x5ee31f,_0x37ba88[_0x86ec('0x11')][_0x86ec('0x12')]);return _0x48c542(_0x37ba88[_0x86ec('0x11')][_0x86ec('0x12')]);}logger[_0x86ec('0x11')](_0x86ec('0x13'),_0x5ee31f,_0x37ba88[_0x86ec('0x11')][_0x86ec('0x12')]);return _0x447f94(_0x37ba88[_0x86ec('0x11')][_0x86ec('0x12')]);}else{logger[_0x86ec('0xc')](_0x86ec('0x13'),_0x5ee31f,_0x86ec('0xd'));_0x447f94(_0x37ba88[_0x86ec('0x14')][_0x86ec('0x12')]);}})[_0x86ec('0x15')](function(_0x21855d){logger[_0x86ec('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x5ee31f,_0x21855d);_0x48c542(_0x21855d);});});}exports[_0x86ec('0x16')]=function(_0x3563a5){var _0x436289=this;return new Promise(function(_0x3b44b9,_0x234d76){return db[_0x86ec('0x17')]['create'](_0x3563a5['body'],{'raw':_0x3563a5['options']?_0x3563a5[_0x86ec('0x18')][_0x86ec('0x19')]===undefined?!![]:![]:!![]})[_0x86ec('0xb')](function(_0x16a6f7){logger[_0x86ec('0xc')]('CreateChatQueueReport',_0x3563a5);logger['debug']('CreateChatQueueReport',_0x3563a5,JSON['stringify'](_0x16a6f7));_0x3b44b9(_0x16a6f7);})[_0x86ec('0x15')](function(_0x15674c){logger[_0x86ec('0x11')](_0x86ec('0x16'),_0x15674c[_0x86ec('0x12')],_0x3563a5);_0x234d76(_0x436289[_0x86ec('0x11')](0x1f4,_0x15674c['message']));});});};exports[_0x86ec('0x1a')]=function(_0x1ac510){var _0x2d56f1=this;return new Promise(function(_0x48380e,_0x33d99b){return db[_0x86ec('0x17')][_0x86ec('0x1b')](_0x1ac510[_0x86ec('0x1c')],{'raw':_0x1ac510[_0x86ec('0x18')]?_0x1ac510[_0x86ec('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac510[_0x86ec('0x18')]?_0x1ac510[_0x86ec('0x18')]['where']||null:null,'attributes':_0x1ac510[_0x86ec('0x18')]?_0x1ac510[_0x86ec('0x18')]['attributes']||null:null,'limit':_0x1ac510[_0x86ec('0x18')]?_0x1ac510[_0x86ec('0x18')][_0x86ec('0x1d')]||null:null})[_0x86ec('0xb')](function(_0x836c80){logger[_0x86ec('0xc')](_0x86ec('0x1a'),_0x1ac510);logger[_0x86ec('0xe')](_0x86ec('0x1a'),_0x1ac510,JSON[_0x86ec('0x10')](_0x836c80));_0x48380e(_0x836c80);})[_0x86ec('0x15')](function(_0x435849){logger[_0x86ec('0x11')](_0x86ec('0x1a'),_0x435849['message'],_0x1ac510);_0x33d99b(_0x2d56f1[_0x86ec('0x11')](0x1f4,_0x435849['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d43bee6..a58d3d1 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 _0x9d79=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x353e0b,_0x4eb9b9){var _0x5b6b4d=function(_0x4a3f41){while(--_0x4a3f41){_0x353e0b['push'](_0x353e0b['shift']());}};_0x5b6b4d(++_0x4eb9b9);}(_0x9d79,0x1dc));var _0x99d7=function(_0x4d4334,_0x5d89cf){_0x4d4334=_0x4d4334-0x0;var _0x276ef6=_0x9d79[_0x4d4334];return _0x276ef6;};'use strict';var multer=require(_0x99d7('0x0'));var util=require(_0x99d7('0x1'));var path=require(_0x99d7('0x2'));var timeout=require(_0x99d7('0x3'));var express=require('express');var router=express[_0x99d7('0x4')]();var fs_extra=require(_0x99d7('0x5'));var auth=require(_0x99d7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x99d7('0x7'));router[_0x99d7('0x8')]('/',auth[_0x99d7('0x9')](),controller[_0x99d7('0xa')]);router['get'](_0x99d7('0xb'),auth[_0x99d7('0x9')](),controller[_0x99d7('0xc')]);router['get'](_0x99d7('0xd'),auth['isAuthenticated'](),controller[_0x99d7('0xe')]);router[_0x99d7('0xf')]('/',auth[_0x99d7('0x9')](),controller[_0x99d7('0x10')]);router[_0x99d7('0x11')](_0x99d7('0xd'),auth['isAuthenticated'](),controller[_0x99d7('0x12')]);router[_0x99d7('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x99d7('0x14')]=router; \ No newline at end of file +var _0x78af=['get','index','isAuthenticated','describe','/:id','show','post','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x78af,0x190));var _0xf78a=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x78af[_0x41c381];return _0x427981;};'use strict';var multer=require(_0xf78a('0x0'));var util=require('util');var path=require(_0xf78a('0x1'));var timeout=require(_0xf78a('0x2'));var express=require(_0xf78a('0x3'));var router=express['Router']();var fs_extra=require(_0xf78a('0x4'));var auth=require(_0xf78a('0x5'));var interaction=require(_0xf78a('0x6'));var config=require(_0xf78a('0x7'));var controller=require('./chatQueueReport.controller');router[_0xf78a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf78a('0x9')]);router[_0xf78a('0x8')]('/describe',auth[_0xf78a('0xa')](),controller[_0xf78a('0xb')]);router[_0xf78a('0x8')](_0xf78a('0xc'),auth[_0xf78a('0xa')](),controller[_0xf78a('0xd')]);router[_0xf78a('0xe')]('/',auth[_0xf78a('0xa')](),controller['create']);router['put'](_0xf78a('0xc'),auth[_0xf78a('0xa')](),controller[_0xf78a('0xf')]);router['delete'](_0xf78a('0xc'),auth[_0xf78a('0xa')](),controller['destroy']);module[_0xf78a('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4ea47ab..2cc3871 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0xb43b,0x1b2));var _0xbb43=function(_0x56c17b,_0x300f31){_0x56c17b=_0x56c17b-0x0;var _0x2226ed=_0xb43b[_0x56c17b];return _0x2226ed;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x279b1a,_0x2bb6df){var _0x316364=function(_0x67247f){while(--_0x67247f){_0x279b1a['push'](_0x279b1a['shift']());}};_0x316364(++_0x2bb6df);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index e660c2b..1680675 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 _0x84d1=['zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','create','body','update','find','describe','eml-format','rimraf'];(function(_0x18f80d,_0x2d1b35){var _0x50bf4f=function(_0x5d6e34){while(--_0x5d6e34){_0x18f80d['push'](_0x18f80d['shift']());}};_0x50bf4f(++_0x2d1b35);}(_0x84d1,0xdc));var _0x184d=function(_0xf858e,_0x51b0f1){_0xf858e=_0xf858e-0x0;var _0x5344d8=_0x84d1[_0xf858e];return _0x5344d8;};'use strict';var emlformat=require(_0x184d('0x0'));var rimraf=require(_0x184d('0x1'));var zipdir=require(_0x184d('0x2'));var jsonpatch=require(_0x184d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x184d('0x4'));var util=require(_0x184d('0x5'));var path=require(_0x184d('0x6'));var sox=require(_0x184d('0x7'));var csv=require('to-csv');var ejs=require(_0x184d('0x8'));var fs=require('fs');var fs_extra=require(_0x184d('0x9'));var _=require(_0x184d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x184d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x184d('0xc'));var Papa=require(_0x184d('0xd'));var Redis=require(_0x184d('0xe'));var authService=require(_0x184d('0xf'));var qs=require(_0x184d('0x10'));var as=require(_0x184d('0x11'));var hardwareService=require(_0x184d('0x12'));var logger=require(_0x184d('0x13'))(_0x184d('0x14'));var utils=require('../../config/utils');var config=require(_0x184d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x184d('0x16'))['db'];function respondWithStatusCode(_0xe230c8,_0x100a03){_0x100a03=_0x100a03||0xcc;return function(_0x57d7ed){if(_0x57d7ed){return _0xe230c8[_0x184d('0x17')](_0x100a03);}return _0xe230c8[_0x184d('0x18')](_0x100a03)[_0x184d('0x19')]();};}function respondWithResult(_0x412303,_0x21d36f){_0x21d36f=_0x21d36f||0xc8;return function(_0x44e91f){if(_0x44e91f){return _0x412303[_0x184d('0x18')](_0x21d36f)[_0x184d('0x1a')](_0x44e91f);}};}function respondWithFilteredResult(_0x31237b,_0x2cc06d){return function(_0x134627){if(_0x134627){var _0x42d580=typeof _0x2cc06d[_0x184d('0x1b')]===_0x184d('0x1c')&&typeof _0x2cc06d[_0x184d('0x1d')]===_0x184d('0x1c');var _0x3039d2=_0x134627[_0x184d('0x1e')];var _0x5f3c68=_0x42d580?0x0:_0x2cc06d[_0x184d('0x1b')];var _0x5cc255=_0x42d580?_0x134627[_0x184d('0x1e')]:_0x2cc06d[_0x184d('0x1b')]+_0x2cc06d[_0x184d('0x1d')];var _0x154507;if(_0x5cc255>=_0x3039d2){_0x5cc255=_0x3039d2;_0x154507=0xc8;}else{_0x154507=0xce;}_0x31237b[_0x184d('0x18')](_0x154507);return _0x31237b[_0x184d('0x1f')](_0x184d('0x20'),_0x5f3c68+'-'+_0x5cc255+'/'+_0x3039d2)['json'](_0x134627);}return null;};}function patchUpdates(_0x431e65){return function(_0x1876af){try{jsonpatch[_0x184d('0x21')](_0x1876af,_0x431e65,!![]);}catch(_0x224767){return BPromise[_0x184d('0x22')](_0x224767);}return _0x1876af['save']();};}function saveUpdates(_0x51986e,_0x432163){return function(_0x4d436d){if(_0x4d436d){return _0x4d436d['update'](_0x51986e)[_0x184d('0x23')](function(_0x188b2d){return _0x188b2d;});}return null;};}function removeEntity(_0x1f223c,_0x1a3e43){return function(_0x44ec2e){if(_0x44ec2e){return _0x44ec2e[_0x184d('0x24')]()[_0x184d('0x23')](function(){_0x1f223c[_0x184d('0x18')](0xcc)[_0x184d('0x19')]();});}};}function handleEntityNotFound(_0x237ced,_0x29d3e0){return function(_0x272c3b){if(!_0x272c3b){_0x237ced[_0x184d('0x17')](0x194);}return _0x272c3b;};}function handleError(_0x417bb1,_0x52502b){_0x52502b=_0x52502b||0x1f4;return function(_0x24a665){logger[_0x184d('0x25')](_0x24a665['stack']);if(_0x24a665[_0x184d('0x26')]){delete _0x24a665['name'];}_0x417bb1['status'](_0x52502b)[_0x184d('0x27')](_0x24a665);};}exports[_0x184d('0x28')]=function(_0x82f248,_0x547fe4){var _0x2eb025={},_0xe7fa7e={},_0x330f23={'count':0x0,'rows':[]};var _0x39f611=_[_0x184d('0x29')](db[_0x184d('0x2a')][_0x184d('0x2b')],function(_0x20a48b){return{'name':_0x20a48b[_0x184d('0x2c')],'type':_0x20a48b[_0x184d('0x2d')]['key']};});_0xe7fa7e[_0x184d('0x2e')]=_[_0x184d('0x29')](_0x39f611,_0x184d('0x26'));_0xe7fa7e[_0x184d('0x2f')]=_[_0x184d('0x30')](_0x82f248[_0x184d('0x2f')]);_0xe7fa7e[_0x184d('0x31')]=_[_0x184d('0x32')](_0xe7fa7e[_0x184d('0x2e')],_0xe7fa7e[_0x184d('0x2f')]);_0x2eb025[_0x184d('0x33')]=_[_0x184d('0x32')](_0xe7fa7e[_0x184d('0x2e')],qs[_0x184d('0x34')](_0x82f248[_0x184d('0x2f')][_0x184d('0x34')]));_0x2eb025[_0x184d('0x33')]=_0x2eb025[_0x184d('0x33')][_0x184d('0x35')]?_0x2eb025[_0x184d('0x33')]:_0xe7fa7e['model'];if(!_0x82f248[_0x184d('0x2f')][_0x184d('0x36')](_0x184d('0x37'))){_0x2eb025[_0x184d('0x1d')]=qs[_0x184d('0x1d')](_0x82f248['query']['limit']);_0x2eb025[_0x184d('0x1b')]=qs[_0x184d('0x1b')](_0x82f248['query'][_0x184d('0x1b')]);}_0x2eb025[_0x184d('0x38')]=qs[_0x184d('0x39')](_0x82f248['query']['sort']);_0x2eb025[_0x184d('0x3a')]=qs[_0x184d('0x31')](_[_0x184d('0x3b')](_0x82f248[_0x184d('0x2f')],_0xe7fa7e[_0x184d('0x31')]),_0x39f611);if(_0x82f248[_0x184d('0x2f')][_0x184d('0x3c')]){_0x2eb025[_0x184d('0x3a')]=_[_0x184d('0x3d')](_0x2eb025[_0x184d('0x3a')],{'$or':_[_0x184d('0x29')](_0x39f611,function(_0x116ab7){if(_0x116ab7[_0x184d('0x2d')]!=='VIRTUAL'){var _0x2f9a99={};_0x2f9a99[_0x116ab7[_0x184d('0x26')]]={'$like':'%'+_0x82f248['query']['filter']+'%'};return _0x2f9a99;}})});}_0x2eb025=_[_0x184d('0x3d')]({},_0x2eb025,_0x82f248['options']);var _0xddf2ca={'where':_0x2eb025[_0x184d('0x3a')]};return db[_0x184d('0x2a')][_0x184d('0x1e')](_0xddf2ca)['then'](function(_0x222214){_0x330f23[_0x184d('0x1e')]=_0x222214;if(_0x82f248[_0x184d('0x2f')]['includeAll']){_0x2eb025[_0x184d('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x184d('0x3f')](_0x2eb025);})[_0x184d('0x23')](function(_0x1c4eef){_0x330f23[_0x184d('0x40')]=_0x1c4eef;return _0x330f23;})[_0x184d('0x23')](respondWithFilteredResult(_0x547fe4,_0x2eb025))[_0x184d('0x41')](handleError(_0x547fe4,null));};exports[_0x184d('0x42')]=function(_0x541214,_0x5422a3){var _0x35c523={'raw':!![],'where':{'id':_0x541214[_0x184d('0x43')]['id']}},_0x41f369={};_0x41f369[_0x184d('0x2e')]=_[_0x184d('0x30')](db['ChatTransferReport']['rawAttributes']);_0x41f369[_0x184d('0x2f')]=_[_0x184d('0x30')](_0x541214[_0x184d('0x2f')]);_0x41f369[_0x184d('0x31')]=_[_0x184d('0x32')](_0x41f369[_0x184d('0x2e')],_0x41f369[_0x184d('0x2f')]);_0x35c523[_0x184d('0x33')]=_[_0x184d('0x32')](_0x41f369[_0x184d('0x2e')],qs[_0x184d('0x34')](_0x541214['query'][_0x184d('0x34')]));_0x35c523['attributes']=_0x35c523[_0x184d('0x33')]['length']?_0x35c523[_0x184d('0x33')]:_0x41f369[_0x184d('0x2e')];if(_0x541214[_0x184d('0x2f')][_0x184d('0x44')]){_0x35c523[_0x184d('0x3e')]=[{'all':!![]}];}_0x35c523=_[_0x184d('0x3d')]({},_0x35c523,_0x541214['options']);return db['ChatTransferReport']['find'](_0x35c523)['then'](handleEntityNotFound(_0x5422a3,null))[_0x184d('0x23')](respondWithResult(_0x5422a3,null))[_0x184d('0x41')](handleError(_0x5422a3,null));};exports[_0x184d('0x45')]=function(_0x3787fd,_0x2c4132){return db[_0x184d('0x2a')][_0x184d('0x45')](_0x3787fd[_0x184d('0x46')],{})[_0x184d('0x23')](respondWithResult(_0x2c4132,0xc9))[_0x184d('0x41')](handleError(_0x2c4132,null));};exports[_0x184d('0x47')]=function(_0x4ac503,_0x19a3af){if(_0x4ac503[_0x184d('0x46')]['id']){delete _0x4ac503[_0x184d('0x46')]['id'];}return db[_0x184d('0x2a')][_0x184d('0x48')]({'where':{'id':_0x4ac503['params']['id']}})[_0x184d('0x23')](handleEntityNotFound(_0x19a3af,null))[_0x184d('0x23')](saveUpdates(_0x4ac503[_0x184d('0x46')],null))[_0x184d('0x23')](respondWithResult(_0x19a3af,null))[_0x184d('0x41')](handleError(_0x19a3af,null));};exports[_0x184d('0x24')]=function(_0x5ba753,_0x5ca14b){return db['ChatTransferReport'][_0x184d('0x48')]({'where':{'id':_0x5ba753[_0x184d('0x43')]['id']}})[_0x184d('0x23')](handleEntityNotFound(_0x5ca14b,null))[_0x184d('0x23')](removeEntity(_0x5ca14b,null))[_0x184d('0x41')](handleError(_0x5ca14b,null));};exports[_0x184d('0x49')]=function(_0x368ec5,_0x535748){return db['ChatTransferReport']['describe']()[_0x184d('0x23')](respondWithResult(_0x535748,null))['catch'](handleError(_0x535748,null));}; \ No newline at end of file +var _0xcd69=['reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x4a8da6,_0x34605f){var _0x9b346b=function(_0x46d8a8){while(--_0x46d8a8){_0x4a8da6['push'](_0x4a8da6['shift']());}};_0x9b346b(++_0x34605f);}(_0xcd69,0x1a7));var _0x9cd6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xcd69[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x9cd6('0x0'));var rimraf=require(_0x9cd6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cd6('0x2'));var rp=require(_0x9cd6('0x3'));var moment=require(_0x9cd6('0x4'));var BPromise=require(_0x9cd6('0x5'));var Mustache=require(_0x9cd6('0x6'));var util=require(_0x9cd6('0x7'));var path=require(_0x9cd6('0x8'));var sox=require(_0x9cd6('0x9'));var csv=require(_0x9cd6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cd6('0xb'));var _=require(_0x9cd6('0xc'));var squel=require(_0x9cd6('0xd'));var crypto=require('crypto');var jsforce=require(_0x9cd6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9cd6('0xa'));var querystring=require(_0x9cd6('0xf'));var Papa=require(_0x9cd6('0x10'));var Redis=require(_0x9cd6('0x11'));var authService=require(_0x9cd6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cd6('0x13'));var logger=require(_0x9cd6('0x14'))(_0x9cd6('0x15'));var utils=require('../../config/utils');var config=require(_0x9cd6('0x16'));var licenseUtil=require(_0x9cd6('0x17'));var db=require(_0x9cd6('0x18'))['db'];function respondWithStatusCode(_0x4890b3,_0x5bed42){_0x5bed42=_0x5bed42||0xcc;return function(_0x2ce95a){if(_0x2ce95a){return _0x4890b3['sendStatus'](_0x5bed42);}return _0x4890b3[_0x9cd6('0x19')](_0x5bed42)[_0x9cd6('0x1a')]();};}function respondWithResult(_0x3e0ac9,_0xfae2fd){_0xfae2fd=_0xfae2fd||0xc8;return function(_0x4a35ef){if(_0x4a35ef){return _0x3e0ac9['status'](_0xfae2fd)[_0x9cd6('0x1b')](_0x4a35ef);}};}function respondWithFilteredResult(_0x4d1bb1,_0x3029d5){return function(_0x204c7b){if(_0x204c7b){var _0x305b2c=typeof _0x3029d5[_0x9cd6('0x1c')]===_0x9cd6('0x1d')&&typeof _0x3029d5[_0x9cd6('0x1e')]===_0x9cd6('0x1d');var _0x5a1b04=_0x204c7b[_0x9cd6('0x1f')];var _0x5729cf=_0x305b2c?0x0:_0x3029d5['offset'];var _0x42e007=_0x305b2c?_0x204c7b[_0x9cd6('0x1f')]:_0x3029d5[_0x9cd6('0x1c')]+_0x3029d5[_0x9cd6('0x1e')];var _0x1b861d;if(_0x42e007>=_0x5a1b04){_0x42e007=_0x5a1b04;_0x1b861d=0xc8;}else{_0x1b861d=0xce;}_0x4d1bb1[_0x9cd6('0x19')](_0x1b861d);return _0x4d1bb1['set'](_0x9cd6('0x20'),_0x5729cf+'-'+_0x42e007+'/'+_0x5a1b04)[_0x9cd6('0x1b')](_0x204c7b);}return null;};}function patchUpdates(_0x57fb4d){return function(_0x21b4dc){try{jsonpatch['apply'](_0x21b4dc,_0x57fb4d,!![]);}catch(_0x25639b){return BPromise[_0x9cd6('0x21')](_0x25639b);}return _0x21b4dc[_0x9cd6('0x22')]();};}function saveUpdates(_0x2d89ae,_0x50bc6b){return function(_0x496dbd){if(_0x496dbd){return _0x496dbd[_0x9cd6('0x23')](_0x2d89ae)[_0x9cd6('0x24')](function(_0x48f344){return _0x48f344;});}return null;};}function removeEntity(_0x320192,_0x4c1b00){return function(_0x178989){if(_0x178989){return _0x178989[_0x9cd6('0x25')]()[_0x9cd6('0x24')](function(){_0x320192[_0x9cd6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x193c59,_0x158bb6){return function(_0x1553df){if(!_0x1553df){_0x193c59[_0x9cd6('0x26')](0x194);}return _0x1553df;};}function handleError(_0x16beee,_0x55a7b2){_0x55a7b2=_0x55a7b2||0x1f4;return function(_0x2c4dd4){logger['error'](_0x2c4dd4[_0x9cd6('0x27')]);if(_0x2c4dd4[_0x9cd6('0x28')]){delete _0x2c4dd4[_0x9cd6('0x28')];}_0x16beee[_0x9cd6('0x19')](_0x55a7b2)[_0x9cd6('0x29')](_0x2c4dd4);};}exports[_0x9cd6('0x2a')]=function(_0x194fc3,_0x43648c){var _0x180838={},_0x1900df={},_0x49da5b={'count':0x0,'rows':[]};var _0x346d68=_[_0x9cd6('0x2b')](db[_0x9cd6('0x2c')][_0x9cd6('0x2d')],function(_0x5ce16d){return{'name':_0x5ce16d['fieldName'],'type':_0x5ce16d[_0x9cd6('0x2e')][_0x9cd6('0x2f')]};});_0x1900df[_0x9cd6('0x30')]=_[_0x9cd6('0x2b')](_0x346d68,_0x9cd6('0x28'));_0x1900df[_0x9cd6('0x31')]=_[_0x9cd6('0x32')](_0x194fc3[_0x9cd6('0x31')]);_0x1900df[_0x9cd6('0x33')]=_[_0x9cd6('0x34')](_0x1900df['model'],_0x1900df[_0x9cd6('0x31')]);_0x180838['attributes']=_['intersection'](_0x1900df[_0x9cd6('0x30')],qs[_0x9cd6('0x35')](_0x194fc3[_0x9cd6('0x31')][_0x9cd6('0x35')]));_0x180838['attributes']=_0x180838['attributes']['length']?_0x180838[_0x9cd6('0x36')]:_0x1900df[_0x9cd6('0x30')];if(!_0x194fc3[_0x9cd6('0x31')][_0x9cd6('0x37')](_0x9cd6('0x38'))){_0x180838[_0x9cd6('0x1e')]=qs['limit'](_0x194fc3[_0x9cd6('0x31')][_0x9cd6('0x1e')]);_0x180838[_0x9cd6('0x1c')]=qs[_0x9cd6('0x1c')](_0x194fc3[_0x9cd6('0x31')]['offset']);}_0x180838[_0x9cd6('0x39')]=qs[_0x9cd6('0x3a')](_0x194fc3[_0x9cd6('0x31')][_0x9cd6('0x3a')]);_0x180838[_0x9cd6('0x3b')]=qs[_0x9cd6('0x33')](_[_0x9cd6('0x3c')](_0x194fc3['query'],_0x1900df[_0x9cd6('0x33')]),_0x346d68);if(_0x194fc3[_0x9cd6('0x31')][_0x9cd6('0x3d')]){_0x180838['where']=_['merge'](_0x180838[_0x9cd6('0x3b')],{'$or':_['map'](_0x346d68,function(_0x26a07d){if(_0x26a07d[_0x9cd6('0x2e')]!==_0x9cd6('0x3e')){var _0x2fbab2={};_0x2fbab2[_0x26a07d[_0x9cd6('0x28')]]={'$like':'%'+_0x194fc3[_0x9cd6('0x31')]['filter']+'%'};return _0x2fbab2;}})});}_0x180838=_[_0x9cd6('0x3f')]({},_0x180838,_0x194fc3[_0x9cd6('0x40')]);var _0x4658cb={'where':_0x180838[_0x9cd6('0x3b')]};return db[_0x9cd6('0x2c')][_0x9cd6('0x1f')](_0x4658cb)[_0x9cd6('0x24')](function(_0x1c6976){_0x49da5b[_0x9cd6('0x1f')]=_0x1c6976;if(_0x194fc3[_0x9cd6('0x31')]['includeAll']){_0x180838[_0x9cd6('0x41')]=[{'all':!![]}];}return db[_0x9cd6('0x2c')]['findAll'](_0x180838);})['then'](function(_0x8ee273){_0x49da5b[_0x9cd6('0x42')]=_0x8ee273;return _0x49da5b;})[_0x9cd6('0x24')](respondWithFilteredResult(_0x43648c,_0x180838))[_0x9cd6('0x43')](handleError(_0x43648c,null));};exports[_0x9cd6('0x44')]=function(_0x396889,_0x28dfe4){var _0x1bece4={'raw':!![],'where':{'id':_0x396889[_0x9cd6('0x45')]['id']}},_0x1e22ce={};_0x1e22ce['model']=_[_0x9cd6('0x32')](db[_0x9cd6('0x2c')][_0x9cd6('0x2d')]);_0x1e22ce[_0x9cd6('0x31')]=_['keys'](_0x396889[_0x9cd6('0x31')]);_0x1e22ce[_0x9cd6('0x33')]=_[_0x9cd6('0x34')](_0x1e22ce[_0x9cd6('0x30')],_0x1e22ce[_0x9cd6('0x31')]);_0x1bece4['attributes']=_[_0x9cd6('0x34')](_0x1e22ce[_0x9cd6('0x30')],qs[_0x9cd6('0x35')](_0x396889[_0x9cd6('0x31')][_0x9cd6('0x35')]));_0x1bece4[_0x9cd6('0x36')]=_0x1bece4[_0x9cd6('0x36')][_0x9cd6('0x46')]?_0x1bece4[_0x9cd6('0x36')]:_0x1e22ce[_0x9cd6('0x30')];if(_0x396889[_0x9cd6('0x31')][_0x9cd6('0x47')]){_0x1bece4['include']=[{'all':!![]}];}_0x1bece4=_[_0x9cd6('0x3f')]({},_0x1bece4,_0x396889[_0x9cd6('0x40')]);return db[_0x9cd6('0x2c')][_0x9cd6('0x48')](_0x1bece4)[_0x9cd6('0x24')](handleEntityNotFound(_0x28dfe4,null))[_0x9cd6('0x24')](respondWithResult(_0x28dfe4,null))[_0x9cd6('0x43')](handleError(_0x28dfe4,null));};exports['create']=function(_0x2a883f,_0x45de50){return db[_0x9cd6('0x2c')][_0x9cd6('0x49')](_0x2a883f[_0x9cd6('0x4a')],{})['then'](respondWithResult(_0x45de50,0xc9))[_0x9cd6('0x43')](handleError(_0x45de50,null));};exports[_0x9cd6('0x23')]=function(_0x38b68c,_0x3e5777){if(_0x38b68c[_0x9cd6('0x4a')]['id']){delete _0x38b68c[_0x9cd6('0x4a')]['id'];}return db[_0x9cd6('0x2c')][_0x9cd6('0x48')]({'where':{'id':_0x38b68c[_0x9cd6('0x45')]['id']}})[_0x9cd6('0x24')](handleEntityNotFound(_0x3e5777,null))[_0x9cd6('0x24')](saveUpdates(_0x38b68c[_0x9cd6('0x4a')],null))[_0x9cd6('0x24')](respondWithResult(_0x3e5777,null))[_0x9cd6('0x43')](handleError(_0x3e5777,null));};exports[_0x9cd6('0x25')]=function(_0x2727d9,_0x3f4b8c){return db['ChatTransferReport']['find']({'where':{'id':_0x2727d9[_0x9cd6('0x45')]['id']}})[_0x9cd6('0x24')](handleEntityNotFound(_0x3f4b8c,null))[_0x9cd6('0x24')](removeEntity(_0x3f4b8c,null))[_0x9cd6('0x43')](handleError(_0x3f4b8c,null));};exports['describe']=function(_0x212dfe,_0x4e43ed){return db[_0x9cd6('0x2c')][_0x9cd6('0x4b')]()['then'](respondWithResult(_0x4e43ed,null))[_0x9cd6('0x43')](handleError(_0x4e43ed,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 491664c..8c4273b 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 _0xa938=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x2b4ff7,_0x14ced6){var _0x1c865a=function(_0x35ed5){while(--_0x35ed5){_0x2b4ff7['push'](_0x2b4ff7['shift']());}};_0x1c865a(++_0x14ced6);}(_0xa938,0x1a5));var _0x8a93=function(_0x1ce792,_0x342e8c){_0x1ce792=_0x1ce792-0x0;var _0x330705=_0xa938[_0x1ce792];return _0x330705;};'use strict';var _=require(_0x8a93('0x0'));var util=require(_0x8a93('0x1'));var logger=require(_0x8a93('0x2'))(_0x8a93('0x3'));var moment=require(_0x8a93('0x4'));var BPromise=require(_0x8a93('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a93('0x6'));var rimraf=require(_0x8a93('0x7'));var config=require(_0x8a93('0x8'));var attributes=require(_0x8a93('0x9'));module[_0x8a93('0xa')]=function(_0xa36308,_0x4b5dfa){return _0xa36308[_0x8a93('0xb')](_0x8a93('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8a93('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e12=['moment','bluebird','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','api'];(function(_0x222cb5,_0x936e92){var _0x3fedf2=function(_0xe7433a){while(--_0xe7433a){_0x222cb5['push'](_0x222cb5['shift']());}};_0x3fedf2(++_0x936e92);}(_0x0e12,0x1ae));var _0x20e1=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x0e12[_0x352d28];return _0x387d7e;};'use strict';var _=require(_0x20e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x20e1('0x1'));var moment=require(_0x20e1('0x2'));var BPromise=require(_0x20e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x20e1('0x4'));var config=require(_0x20e1('0x5'));var attributes=require(_0x20e1('0x6'));module[_0x20e1('0x7')]=function(_0x45a0e8,_0x403c63){return _0x45a0e8[_0x20e1('0x8')](_0x20e1('0x9'),attributes,{'tableName':_0x20e1('0xa'),'paranoid':![],'indexes':[{'name':_0x20e1('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d9d4841..a54627b 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 _0x488f=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3ce856,_0x124bf3){var _0xb8c6e1=function(_0x287c07){while(--_0x287c07){_0x3ce856['push'](_0x3ce856['shift']());}};_0xb8c6e1(++_0x124bf3);}(_0x488f,0xb1));var _0xf488=function(_0x2bde3b,_0x400ce6){_0x2bde3b=_0x2bde3b-0x0;var _0x497aa8=_0x488f[_0x2bde3b];return _0x497aa8;};'use strict';var _=require(_0xf488('0x0'));var util=require(_0xf488('0x1'));var moment=require(_0xf488('0x2'));var BPromise=require(_0xf488('0x3'));var rs=require(_0xf488('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf488('0x5'))['db'];var utils=require(_0xf488('0x6'));var logger=require(_0xf488('0x7'))(_0xf488('0x8'));var config=require(_0xf488('0x9'));var jayson=require(_0xf488('0xa'));var client=jayson[_0xf488('0xb')][_0xf488('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x564870,_0x3594d0,_0x1eef39){return new BPromise(function(_0x46301f,_0x5830ca){return client[_0xf488('0xd')](_0x564870,_0x1eef39)[_0xf488('0xe')](function(_0x395014){logger[_0xf488('0xf')](_0xf488('0x10'),_0x3594d0,_0xf488('0x11'));logger[_0xf488('0x12')](_0xf488('0x13'),_0x3594d0,_0xf488('0x11'),JSON['stringify'](_0x395014));if(_0x395014[_0xf488('0x14')]){if(_0x395014[_0xf488('0x14')][_0xf488('0x15')]===0x1f4){logger[_0xf488('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x3594d0,_0x395014[_0xf488('0x14')][_0xf488('0x16')]);return _0x5830ca(_0x395014['error'][_0xf488('0x16')]);}logger[_0xf488('0x14')](_0xf488('0x10'),_0x3594d0,_0x395014[_0xf488('0x14')]['message']);return _0x46301f(_0x395014[_0xf488('0x14')][_0xf488('0x16')]);}else{logger[_0xf488('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x3594d0,_0xf488('0x11'));_0x46301f(_0x395014[_0xf488('0x17')][_0xf488('0x16')]);}})[_0xf488('0x18')](function(_0x4d3a4b){logger['error'](_0xf488('0x10'),_0x3594d0,_0x4d3a4b);_0x5830ca(_0x4d3a4b);});});} \ No newline at end of file +var _0xc0d2=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xc0d2,0x1b5));var _0x2c0d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc0d2[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2c0d('0x0'));var util=require(_0x2c0d('0x1'));var moment=require(_0x2c0d('0x2'));var BPromise=require(_0x2c0d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c0d('0x4'));var db=require(_0x2c0d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c0d('0x6'))(_0x2c0d('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c0d('0x8'));var client=jayson['client'][_0x2c0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ed708,_0x4a9ccc,_0x5b25aa){return new BPromise(function(_0x3467e3,_0x200fa3){return client['request'](_0x1ed708,_0x5b25aa)[_0x2c0d('0xa')](function(_0x589715){logger[_0x2c0d('0xb')](_0x2c0d('0xc'),_0x4a9ccc,_0x2c0d('0xd'));logger[_0x2c0d('0xe')](_0x2c0d('0xf'),_0x4a9ccc,_0x2c0d('0xd'),JSON['stringify'](_0x589715));if(_0x589715[_0x2c0d('0x10')]){if(_0x589715[_0x2c0d('0x10')][_0x2c0d('0x11')]===0x1f4){logger[_0x2c0d('0x10')](_0x2c0d('0xc'),_0x4a9ccc,_0x589715['error'][_0x2c0d('0x12')]);return _0x200fa3(_0x589715[_0x2c0d('0x10')][_0x2c0d('0x12')]);}logger[_0x2c0d('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x4a9ccc,_0x589715[_0x2c0d('0x10')][_0x2c0d('0x12')]);return _0x3467e3(_0x589715[_0x2c0d('0x10')][_0x2c0d('0x12')]);}else{logger['info'](_0x2c0d('0xc'),_0x4a9ccc,_0x2c0d('0xd'));_0x3467e3(_0x589715[_0x2c0d('0x13')]['message']);}})[_0x2c0d('0x14')](function(_0x124329){logger[_0x2c0d('0x10')](_0x2c0d('0xc'),_0x4a9ccc,_0x124329);_0x200fa3(_0x124329);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1884000..952c392 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 _0x78f8=['./chatTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x50132a,_0x373543){var _0x241c77=function(_0x5c39a4){while(--_0x5c39a4){_0x50132a['push'](_0x50132a['shift']());}};_0x241c77(++_0x373543);}(_0x78f8,0x1c5));var _0x878f=function(_0x4d0f23,_0x1806a9){_0x4d0f23=_0x4d0f23-0x0;var _0x53337f=_0x78f8[_0x4d0f23];return _0x53337f;};'use strict';var multer=require(_0x878f('0x0'));var util=require(_0x878f('0x1'));var path=require('path');var timeout=require(_0x878f('0x2'));var express=require(_0x878f('0x3'));var router=express['Router']();var fs_extra=require(_0x878f('0x4'));var auth=require(_0x878f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x878f('0x6'));var controller=require(_0x878f('0x7'));router[_0x878f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x878f('0x9'),auth[_0x878f('0xa')](),controller[_0x878f('0xb')]);router[_0x878f('0x8')](_0x878f('0xc'),auth['isAuthenticated'](),controller[_0x878f('0xd')]);router['post']('/',auth[_0x878f('0xa')](),controller[_0x878f('0xe')]);router[_0x878f('0xf')]('/:id',auth[_0x878f('0xa')](),controller[_0x878f('0x10')]);router[_0x878f('0x11')](_0x878f('0xc'),auth['isAuthenticated'](),controller[_0x878f('0x12')]);module[_0x878f('0x13')]=router; \ No newline at end of file +var _0xf645=['index','/describe','get','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0xf645,0x14c));var _0x5f64=function(_0x18de6c,_0x4cb805){_0x18de6c=_0x18de6c-0x0;var _0x54b14d=_0xf645[_0x18de6c];return _0x54b14d;};'use strict';var multer=require('multer');var util=require(_0x5f64('0x0'));var path=require(_0x5f64('0x1'));var timeout=require(_0x5f64('0x2'));var express=require(_0x5f64('0x3'));var router=express['Router']();var fs_extra=require(_0x5f64('0x4'));var auth=require(_0x5f64('0x5'));var interaction=require(_0x5f64('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x5f64('0x7')](),controller[_0x5f64('0x8')]);router['get'](_0x5f64('0x9'),auth[_0x5f64('0x7')](),controller['describe']);router[_0x5f64('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5f64('0xb')]);router[_0x5f64('0xc')]('/',auth[_0x5f64('0x7')](),controller[_0x5f64('0xd')]);router[_0x5f64('0xe')](_0x5f64('0xf'),auth[_0x5f64('0x7')](),controller[_0x5f64('0x10')]);router[_0x5f64('0x11')](_0x5f64('0xf'),auth[_0x5f64('0x7')](),controller[_0x5f64('0x12')]);module[_0x5f64('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 b7aad3a..582b636 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 _0x0581=['Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','BOOLEAN','star','thumb','name','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','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.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','TEXT'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x0581,0x18e));var _0x1058=function(_0x5db59c,_0x11cc79){_0x5db59c=_0x5db59c-0x0;var _0x2a1f41=_0x0581[_0x5db59c];return _0x2a1f41;};'use strict';var Sequelize=require(_0x1058('0x0'));var rs=require(_0x1058('0x1'));module['exports']={'name':{'type':Sequelize[_0x1058('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x1058('0x2')],'allowNull':![],'unique':_0x1058('0x3')},'description':{'type':Sequelize[_0x1058('0x2')]},'mapKey':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x4')},'mapKeyOffline':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x4')},'key':{'type':Sequelize[_0x1058('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x1058('0x2')],'allowNull':![],'defaultValue':_0x1058('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1058('0x2')],'allowNull':![],'defaultValue':_0x1058('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1058('0x2')],'allowNull':![],'defaultValue':_0x1058('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1058('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1058('0x9')](_0x1058('0xa'),_0x1058('0xb')),'defaultValue':_0x1058('0xa')},'header_online':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0xc')},'start_chat_button':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0xd')},'offline_chat_button':{'type':Sequelize[_0x1058('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1058('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1058('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1058('0xf')]},'closingQuestion':{'type':Sequelize[_0x1058('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x11')},'noteTitle':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x12')},'placeholderMessage':{'type':Sequelize[_0x1058('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x13')},'closingMessageButton':{'type':Sequelize[_0x1058('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x1058('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1058('0x9')](_0x1058('0x16'),_0x1058('0x17')),'defaultValue':_0x1058('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x1058('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x1058('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x1058('0x18'),'type':'text','required':!![]},'props':{'title':_0x1058('0x18'),'helpText':''}},{'type':'input','props':{'title':_0x1058('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x1058('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1058('0x19')](_0x1058('0x1a'))?JSON[_0x1058('0x1b')](this[_0x1058('0x19')](_0x1058('0x1a'))):{};},'set':function(_0x485bb6){return this[_0x1058('0x1c')]('onlineForm',JSON['stringify'](_0x485bb6));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1058('0x1d')]({'items':[{'type':'input','props':{'title':_0x1058('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x1058('0x4'),'type':_0x1058('0x4')},'variable':null},{'type':_0x1058('0x1e'),'config':{'placeholder':_0x1058('0x1f')},'props':{'title':_0x1058('0x1f'),'helpText':_0x1058('0x20')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x1058('0x21'))?JSON[_0x1058('0x1b')](this[_0x1058('0x19')](_0x1058('0x21'))):{};},'set':function(_0x15e84b){return this[_0x1058('0x1c')](_0x1058('0x21'),JSON[_0x1058('0x1d')](_0x15e84b));}},'token':{'type':Sequelize[_0x1058('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1058('0x2')]},'waitingTitle':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1058('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x1058('0x15')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x24')},'skipUnmanaged':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x14')},'sendUnmanaged':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x25')},'enableCustomerAttachment':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1058('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1058('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1058('0xf')],'defaultValue':function(){return _0x1058('0x26');}},'notificationSound':{'type':Sequelize[_0x1058('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x1058('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1058('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x27')},'defaultTitle':{'type':Sequelize[_0x1058('0x2')]},'customerAvatar':{'type':Sequelize[_0x1058('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x1058('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1058('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1058('0x2')],'defaultValue':_0x1058('0x28')},'systemAvatar':{'type':Sequelize[_0x1058('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1058('0x8')],'comment':_0x1058('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![],'comment':_0x1058('0x2a'),'set':function(_0x4d2806){if(!_0x4d2806)this[_0x1058('0x1c')](_0x1058('0x2b'),null);this[_0x1058('0x1c')](_0x1058('0x2c'),_0x4d2806);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x1058('0x2')],'allowNull':![],'defaultValue':_0x1058('0x2d')},'vidaooNote':{'type':Sequelize[_0x1058('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x1058('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1058('0x15')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1058('0xf')]}}; \ No newline at end of file +var _0x5c38=['Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','BOOLEAN','thumb','star','stringify','text','name','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#ffffff','INTEGER','ENUM','rounded','squared','Chat'];(function(_0xa3c315,_0x721d2a){var _0x4ab5fc=function(_0x5cf36e){while(--_0x5cf36e){_0xa3c315['push'](_0xa3c315['shift']());}};_0x4ab5fc(++_0x721d2a);}(_0x5c38,0x145));var _0x85c3=function(_0x3e1f1b,_0x1edf50){_0x3e1f1b=_0x3e1f1b-0x0;var _0x45962f=_0x5c38[_0x3e1f1b];return _0x45962f;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x85c3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x85c3('0x1')],'allowNull':![],'unique':_0x85c3('0x2')},'description':{'type':Sequelize[_0x85c3('0x1')]},'mapKey':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x3')},'mapKeyOffline':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x4')},'customerAlias':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x85c3('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x85c3('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x85c3('0x1')],'allowNull':![],'defaultValue':_0x85c3('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x85c3('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x85c3('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x85c3('0x7')](_0x85c3('0x8'),_0x85c3('0x9')),'defaultValue':_0x85c3('0x8')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0xa')},'offline_chat_button':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x85c3('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x85c3('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x85c3('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x85c3('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0xf')},'noteTitle':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x10')},'placeholderMessage':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x11')},'closingMessage':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x85c3('0x12')},'conditionAgreement':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM']('star',_0x85c3('0x14')),'defaultValue':_0x85c3('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x85c3('0xd')],'defaultValue':function(){return JSON[_0x85c3('0x16')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':_0x85c3('0x17'),'required':!![]},'props':{'title':_0x85c3('0x18'),'helpText':''}},{'type':_0x85c3('0x19'),'props':{'title':_0x85c3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x85c3('0x3'),'type':_0x85c3('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x85c3('0x1a')](_0x85c3('0x1b'))?JSON[_0x85c3('0x1c')](this[_0x85c3('0x1a')](_0x85c3('0x1b'))):{};},'set':function(_0x58e902){return this[_0x85c3('0x1d')]('onlineForm',JSON[_0x85c3('0x16')](_0x58e902));}},'offlineForm':{'type':Sequelize[_0x85c3('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x85c3('0x19'),'props':{'title':_0x85c3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x85c3('0x1e'),'config':{'placeholder':_0x85c3('0x1f')},'props':{'title':'Comments','helpText':_0x85c3('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x85c3('0x1a')](_0x85c3('0x21'))?JSON[_0x85c3('0x1c')](this[_0x85c3('0x1a')](_0x85c3('0x21'))):{};},'set':function(_0x2f03d5){return this[_0x85c3('0x1d')](_0x85c3('0x21'),JSON[_0x85c3('0x16')](_0x2f03d5));}},'token':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':function(){return rs[_0x85c3('0x22')]();}},'autoclose':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x85c3('0x1')]},'forwardOffline':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x85c3('0x1')]},'waitingTitle':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x23')},'waitingMessage':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x25')},'offlineMessageBody':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x12')},'sendUnmanaged':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0xb')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x85c3('0x1')]},'notificationTemplate':{'type':Sequelize[_0x85c3('0xd')],'defaultValue':function(){return _0x85c3('0x27');}},'notificationSound':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x85c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x29')},'verticalAlignment':{'type':Sequelize[_0x85c3('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x85c3('0x1')]},'customerAvatar':{'type':Sequelize[_0x85c3('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x85c3('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x85c3('0x1')],'allowNull':![],'defaultValue':_0x85c3('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x85c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x85c3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x85c3('0x1')],'defaultValue':_0x85c3('0x2b')},'systemAvatar':{'type':Sequelize[_0x85c3('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x85c3('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x48fe35){if(!_0x48fe35)this[_0x85c3('0x1d')](_0x85c3('0x2c'),null);this['setDataValue'](_0x85c3('0x2d'),_0x48fe35);}},'vidaooEscalation':{'type':Sequelize[_0x85c3('0x13')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x85c3('0x1')]},'vidaooTopic':{'type':Sequelize[_0x85c3('0x1')],'allowNull':![],'defaultValue':_0x85c3('0x2e')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x85c3('0x2f');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index dab678f..174d6ff 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 _0x8e08=['VIRTUAL','include','findAll','rows','params','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','sitepic','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','ChatApplication','account','applications','list','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','device','vendor','format','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','update','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','server','offline-chat','basename','sequelize','transaction','Attachment','MailServerOut','Smtp','forwardOfflineAddress','service','host','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','virtual','License','increment','all','server/files/chat/iframe.ejs','remote','replace','alignment','verticalAlignment','color','color_button','addApplications','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachments','emit','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','save','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0xeefb2a,_0x516fb0){var _0x216b71=function(_0x2e5e0d){while(--_0x2e5e0d){_0xeefb2a['push'](_0xeefb2a['shift']());}};_0x216b71(++_0x516fb0);}(_0x8e08,0xda));var _0x88e0=function(_0x2f7ae2,_0x1bfe9c){_0x2f7ae2=_0x2f7ae2-0x0;var _0x5ea176=_0x8e08[_0x2f7ae2];return _0x5ea176;};'use strict';var emlformat=require(_0x88e0('0x0'));var rimraf=require(_0x88e0('0x1'));var zipdir=require(_0x88e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x88e0('0x3'));var BPromise=require(_0x88e0('0x4'));var Mustache=require(_0x88e0('0x5'));var util=require('util');var path=require(_0x88e0('0x6'));var sox=require(_0x88e0('0x7'));var csv=require(_0x88e0('0x8'));var ejs=require(_0x88e0('0x9'));var fs=require('fs');var fs_extra=require(_0x88e0('0xa'));var _=require(_0x88e0('0xb'));var squel=require(_0x88e0('0xc'));var crypto=require(_0x88e0('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x88e0('0x8'));var querystring=require('querystring');var Papa=require(_0x88e0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x88e0('0xf'));var as=require(_0x88e0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88e0('0x11'))(_0x88e0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x88e0('0x13'));var db=require(_0x88e0('0x14'))['db'];config['redis']=_[_0x88e0('0x15')](config[_0x88e0('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88e0('0x16')]));require(_0x88e0('0x17'))[_0x88e0('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x88e0('0x19')][_0x88e0('0x1a')]({'port':0x232c});var client9002=jayson[_0x88e0('0x19')][_0x88e0('0x1a')]({'port':0x232a});var client9003=jayson[_0x88e0('0x19')][_0x88e0('0x1a')]({'port':0x232b});var client9001=jayson[_0x88e0('0x19')]['http']({'port':0x2329});function respondWithRpcPromise(_0x28d7fe,_0x2a7926,_0x361199,_0x37e1af){return new BPromise(function(_0x240e25,_0x5ce781){var _0x357204=_0x37e1af||client;return _0x357204[_0x88e0('0x1b')](_0x28d7fe,_0x361199)[_0x88e0('0x1c')](function(_0x425428){logger[_0x88e0('0x1d')](_0x88e0('0x1e'),_0x2a7926,'request\x20sent');logger[_0x88e0('0x1f')](_0x88e0('0x20'),_0x2a7926,_0x88e0('0x21'),JSON[_0x88e0('0x22')](_0x425428));if(_0x425428[_0x88e0('0x23')]){if(_0x425428[_0x88e0('0x23')][_0x88e0('0x24')]===0x1f4){logger[_0x88e0('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x2a7926,_0x425428[_0x88e0('0x23')][_0x88e0('0x25')]);return _0x5ce781(_0x425428[_0x88e0('0x23')][_0x88e0('0x25')]);}logger[_0x88e0('0x23')](_0x88e0('0x1e'),_0x2a7926,_0x425428['error'][_0x88e0('0x25')]);return _0x240e25(_0x425428[_0x88e0('0x23')][_0x88e0('0x25')]);}else{logger[_0x88e0('0x1d')](_0x88e0('0x1e'),_0x2a7926,_0x88e0('0x21'));_0x240e25(_0x425428['result'][_0x88e0('0x25')]);}})[_0x88e0('0x26')](function(_0x5e90ae){logger[_0x88e0('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x2a7926,_0x5e90ae);_0x5ce781(_0x5e90ae);});});}function respondWithStatusCode(_0x4033c2,_0x5bc864){_0x5bc864=_0x5bc864||0xcc;return function(_0x5bd43f){if(_0x5bd43f){return _0x4033c2[_0x88e0('0x27')](_0x5bc864);}return _0x4033c2[_0x88e0('0x28')](_0x5bc864)[_0x88e0('0x29')]();};}function respondWithResult(_0x47a0d,_0x52231f){_0x52231f=_0x52231f||0xc8;return function(_0xd47cbb){if(_0xd47cbb){return _0x47a0d[_0x88e0('0x28')](_0x52231f)[_0x88e0('0x2a')](_0xd47cbb);}};}function respondWithFilteredResult(_0x3594be,_0x5e1896){return function(_0x69e38d){if(_0x69e38d){var _0x3dd6eb=typeof _0x5e1896[_0x88e0('0x2b')]==='undefined'&&typeof _0x5e1896[_0x88e0('0x2c')]===_0x88e0('0x2d');var _0x52dbef=_0x69e38d[_0x88e0('0x2e')];var _0x27d6c9=_0x3dd6eb?0x0:_0x5e1896[_0x88e0('0x2b')];var _0x6d68c1=_0x3dd6eb?_0x69e38d['count']:_0x5e1896[_0x88e0('0x2b')]+_0x5e1896[_0x88e0('0x2c')];var _0x36903c;if(_0x6d68c1>=_0x52dbef){_0x6d68c1=_0x52dbef;_0x36903c=0xc8;}else{_0x36903c=0xce;}_0x3594be[_0x88e0('0x28')](_0x36903c);return _0x3594be[_0x88e0('0x2f')]('Content-Range',_0x27d6c9+'-'+_0x6d68c1+'/'+_0x52dbef)['json'](_0x69e38d);}return null;};}function patchUpdates(_0x25324d){return function(_0x239ecc){try{jsonpatch['apply'](_0x239ecc,_0x25324d,!![]);}catch(_0x54fea4){return BPromise['reject'](_0x54fea4);}return _0x239ecc[_0x88e0('0x30')]();};}function saveUpdates(_0x56284a,_0x9fcfb7){return function(_0x2df9fa){if(_0x2df9fa){return _0x2df9fa['update'](_0x56284a)[_0x88e0('0x1c')](function(_0x297a83){return _0x297a83;});}return null;};}function removeEntity(_0x322103,_0x11c2e6){return function(_0x410906){if(_0x410906){return _0x410906['destroy']()['then'](function(){var _0x1ef552=_0x410906[_0x88e0('0x31')]({'plain':!![]});var _0x4dfffa=_0x88e0('0x32');return db[_0x88e0('0x33')][_0x88e0('0x34')]({'where':{'type':_0x4dfffa,'resourceId':_0x1ef552['id']}})[_0x88e0('0x1c')](function(){return _0x410906;});})['then'](function(){_0x322103[_0x88e0('0x28')](0xcc)[_0x88e0('0x29')]();});}};}function handleEntityNotFound(_0x3e4481,_0x4e3746){return function(_0x1a0c75){if(!_0x1a0c75){_0x3e4481[_0x88e0('0x27')](0x194);}return _0x1a0c75;};}function handleError(_0x515df3,_0x1fa2fd){_0x1fa2fd=_0x1fa2fd||0x1f4;return function(_0x4b2f2a){logger[_0x88e0('0x23')](_0x4b2f2a[_0x88e0('0x35')]);if(_0x4b2f2a[_0x88e0('0x36')]){delete _0x4b2f2a[_0x88e0('0x36')];}_0x515df3[_0x88e0('0x28')](_0x1fa2fd)[_0x88e0('0x37')](_0x4b2f2a);};}exports[_0x88e0('0x38')]=function(_0x29c36c,_0xfd7820){var _0x59e095={'include':[{'model':db[_0x88e0('0x39')],'as':_0x88e0('0x3a')}]},_0x54c67e={},_0xa6c8cf={'count':0x0,'rows':[]};var _0x468f43=_[_0x88e0('0x3b')](db[_0x88e0('0x3c')][_0x88e0('0x3d')],function(_0x546c30){return{'name':_0x546c30[_0x88e0('0x3e')],'type':_0x546c30[_0x88e0('0x3f')][_0x88e0('0x40')]};});_0x54c67e[_0x88e0('0x41')]=_[_0x88e0('0x3b')](_0x468f43,'name');_0x54c67e['query']=_[_0x88e0('0x42')](_0x29c36c[_0x88e0('0x43')]);_0x54c67e[_0x88e0('0x44')]=_[_0x88e0('0x45')](_0x54c67e['model'],_0x54c67e[_0x88e0('0x43')]);_0x59e095[_0x88e0('0x46')]=_[_0x88e0('0x45')](_0x54c67e[_0x88e0('0x41')],qs[_0x88e0('0x47')](_0x29c36c[_0x88e0('0x43')][_0x88e0('0x47')]));_0x59e095['attributes']=_0x59e095['attributes'][_0x88e0('0x48')]?_0x59e095[_0x88e0('0x46')]:_0x54c67e[_0x88e0('0x41')];if(!_0x29c36c[_0x88e0('0x43')][_0x88e0('0x49')](_0x88e0('0x4a'))){_0x59e095[_0x88e0('0x2c')]=qs[_0x88e0('0x2c')](_0x29c36c[_0x88e0('0x43')][_0x88e0('0x2c')]);_0x59e095[_0x88e0('0x2b')]=qs[_0x88e0('0x2b')](_0x29c36c[_0x88e0('0x43')][_0x88e0('0x2b')]);}_0x59e095[_0x88e0('0x4b')]=qs[_0x88e0('0x4c')](_0x29c36c[_0x88e0('0x43')]['sort']);_0x59e095['where']=qs[_0x88e0('0x44')](_[_0x88e0('0x4d')](_0x29c36c[_0x88e0('0x43')],_0x54c67e[_0x88e0('0x44')]),_0x468f43);if(_0x29c36c[_0x88e0('0x43')][_0x88e0('0x4e')]){_0x59e095[_0x88e0('0x4f')]=_[_0x88e0('0x50')](_0x59e095[_0x88e0('0x4f')],{'$or':_[_0x88e0('0x3b')](_0x468f43,function(_0x3a30b3){if(_0x3a30b3[_0x88e0('0x3f')]!==_0x88e0('0x51')){var _0x503e6c={};_0x503e6c[_0x3a30b3[_0x88e0('0x36')]]={'$like':'%'+_0x29c36c[_0x88e0('0x43')][_0x88e0('0x4e')]+'%'};return _0x503e6c;}})});}_0x59e095=_[_0x88e0('0x50')]({},_0x59e095,_0x29c36c['options']);var _0x1f11df={'where':_0x59e095[_0x88e0('0x4f')]};return db[_0x88e0('0x3c')][_0x88e0('0x2e')](_0x1f11df)[_0x88e0('0x1c')](function(_0x28d455){_0xa6c8cf[_0x88e0('0x2e')]=_0x28d455;if(_0x29c36c['query']['includeAll']){_0x59e095[_0x88e0('0x52')]=[{'all':!![]}];}return db[_0x88e0('0x3c')][_0x88e0('0x53')](_0x59e095);})[_0x88e0('0x1c')](function(_0x2095ce){_0xa6c8cf[_0x88e0('0x54')]=_0x2095ce;return _0xa6c8cf;})[_0x88e0('0x1c')](respondWithFilteredResult(_0xfd7820,_0x59e095))[_0x88e0('0x26')](handleError(_0xfd7820,null));};exports['show']=function(_0x391294,_0x406629){var _0x2f8028={'raw':![],'where':{'id':_0x391294[_0x88e0('0x55')]['id']},'include':[{'model':db[_0x88e0('0x39')],'as':'mandatoryDispositionPause'}]},_0x1caf35={};_0x1caf35['model']=_['keys'](db[_0x88e0('0x3c')][_0x88e0('0x3d')]);_0x1caf35['query']=_[_0x88e0('0x42')](_0x391294['query']);_0x1caf35[_0x88e0('0x44')]=_['intersection'](_0x1caf35[_0x88e0('0x41')],_0x1caf35['query']);_0x2f8028[_0x88e0('0x46')]=_[_0x88e0('0x45')](_0x1caf35['model'],qs[_0x88e0('0x47')](_0x391294[_0x88e0('0x43')][_0x88e0('0x47')]));_0x2f8028[_0x88e0('0x46')]=_0x2f8028[_0x88e0('0x46')][_0x88e0('0x48')]?_0x2f8028[_0x88e0('0x46')]:_0x1caf35[_0x88e0('0x41')];if(_0x391294[_0x88e0('0x43')][_0x88e0('0x56')]){_0x2f8028[_0x88e0('0x52')]=[{'all':!![]}];}_0x2f8028=_[_0x88e0('0x50')]({},_0x2f8028,_0x391294[_0x88e0('0x57')]);return db['ChatWebsite'][_0x88e0('0x58')](_0x2f8028)['then'](handleEntityNotFound(_0x406629,null))['then'](respondWithResult(_0x406629,null))['catch'](handleError(_0x406629,null));};exports[_0x88e0('0x59')]=function(_0x4a3c07,_0x34743b){return db[_0x88e0('0x3c')][_0x88e0('0x59')](_0x4a3c07['body'],{})[_0x88e0('0x1c')](function(_0xd7a545){var _0xa45959=_0x4a3c07[_0x88e0('0x5a')][_0x88e0('0x31')]({'plain':!![]});if(!_0xa45959)throw new Error(_0x88e0('0x5b'));if(_0xa45959[_0x88e0('0x5c')]==='user'){var _0x36432a=_0xd7a545[_0x88e0('0x31')]({'plain':!![]});var _0x54d4d9='ChatWebsites';return db[_0x88e0('0x5d')][_0x88e0('0x58')]({'where':{'name':_0x54d4d9,'userProfileId':_0xa45959[_0x88e0('0x5e')]},'raw':!![]})[_0x88e0('0x1c')](function(_0x2421f8){if(_0x2421f8&&_0x2421f8['autoAssociation']===0x0){return db[_0x88e0('0x33')][_0x88e0('0x59')]({'name':_0x36432a[_0x88e0('0x36')],'resourceId':_0x36432a['id'],'type':_0x2421f8[_0x88e0('0x36')],'sectionId':_0x2421f8['id']},{})[_0x88e0('0x1c')](function(){return _0xd7a545;});}else{return _0xd7a545;}})[_0x88e0('0x26')](function(_0x56971d){logger[_0x88e0('0x23')](_0x88e0('0x5f'),_0x56971d);throw _0x56971d;});}return _0xd7a545;})[_0x88e0('0x1c')](respondWithResult(_0x34743b,0xc9))[_0x88e0('0x26')](handleError(_0x34743b,null));};exports['update']=function(_0x32cd04,_0x18aeef){if(_0x32cd04['body']['id']){delete _0x32cd04['body']['id'];}return db[_0x88e0('0x3c')]['find']({'where':{'id':_0x32cd04[_0x88e0('0x55')]['id']},'include':[{'model':db[_0x88e0('0x39')],'as':_0x88e0('0x3a')}]})[_0x88e0('0x1c')](handleEntityNotFound(_0x18aeef,null))[_0x88e0('0x1c')](saveUpdates(_0x32cd04[_0x88e0('0x60')],null))['then'](respondWithResult(_0x18aeef,null))[_0x88e0('0x26')](handleError(_0x18aeef,null));};exports[_0x88e0('0x34')]=function(_0x5e8cd7,_0x4f290c){return db[_0x88e0('0x3c')][_0x88e0('0x58')]({'where':{'id':_0x5e8cd7[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x4f290c,null))[_0x88e0('0x1c')](removeEntity(_0x4f290c,null))[_0x88e0('0x26')](handleError(_0x4f290c,null));};exports[_0x88e0('0x61')]=function(_0xfa0273,_0x14cac8){return db[_0x88e0('0x3c')]['describe']()[_0x88e0('0x1c')](respondWithResult(_0x14cac8,null))[_0x88e0('0x26')](handleError(_0x14cac8,null));};exports[_0x88e0('0x62')]=function(_0x194216,_0x2c1bea,_0x5e63e2){if(_0x194216[_0x88e0('0x60')]['id']){delete _0x194216[_0x88e0('0x60')]['id'];}return db[_0x88e0('0x3c')][_0x88e0('0x58')]({'where':{'id':_0x194216[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x2c1bea,null))[_0x88e0('0x1c')](function(_0x2521af){if(_0x2521af){_0x194216[_0x88e0('0x60')][_0x88e0('0x63')]=_0x2521af['id'];return db['Disposition'][_0x88e0('0x59')](_0x194216['body']);}})[_0x88e0('0x1c')](respondWithResult(_0x2c1bea,null))['catch'](handleError(_0x2c1bea,null));};exports[_0x88e0('0x64')]=function(_0x12fdb7,_0x2a7b4f,_0x10b240){var _0x9f47b7={'raw':![],'where':{}};var _0x473e95={};var _0x554608={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x88e0('0x65')]({'where':{'id':_0x12fdb7[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x2a7b4f,null))[_0x88e0('0x1c')](function(_0x2e68aa){if(_0x2e68aa){_0x473e95[_0x88e0('0x41')]=_[_0x88e0('0x42')](db[_0x88e0('0x66')][_0x88e0('0x3d')]);_0x473e95[_0x88e0('0x43')]=_[_0x88e0('0x42')](_0x12fdb7[_0x88e0('0x43')]);_0x473e95[_0x88e0('0x44')]=_[_0x88e0('0x45')](_0x473e95[_0x88e0('0x41')],_0x473e95['query']);_0x9f47b7[_0x88e0('0x46')]=_['intersection'](_0x473e95[_0x88e0('0x41')],qs[_0x88e0('0x47')](_0x12fdb7[_0x88e0('0x43')][_0x88e0('0x47')]));_0x9f47b7['attributes']=_0x9f47b7[_0x88e0('0x46')][_0x88e0('0x48')]?_0x9f47b7[_0x88e0('0x46')]:_0x473e95['model'];if(!_0x12fdb7[_0x88e0('0x43')][_0x88e0('0x49')](_0x88e0('0x4a'))){_0x9f47b7['limit']=qs[_0x88e0('0x2c')](_0x12fdb7[_0x88e0('0x43')][_0x88e0('0x2c')]);_0x9f47b7['offset']=qs[_0x88e0('0x2b')](_0x12fdb7[_0x88e0('0x43')][_0x88e0('0x2b')]);}_0x9f47b7[_0x88e0('0x4b')]=qs[_0x88e0('0x4c')](_0x12fdb7['query'][_0x88e0('0x4c')]);_0x9f47b7[_0x88e0('0x4f')]=qs[_0x88e0('0x44')](_[_0x88e0('0x4d')](_0x12fdb7[_0x88e0('0x43')],_0x473e95[_0x88e0('0x44')]));_0x9f47b7['where'][_0x88e0('0x63')]=_0x2e68aa['id'];if(_0x12fdb7[_0x88e0('0x43')][_0x88e0('0x4e')]){_0x9f47b7['where']=_[_0x88e0('0x50')](_0x9f47b7[_0x88e0('0x4f')],{'$or':_[_0x88e0('0x3b')](_0x9f47b7[_0x88e0('0x46')],function(_0x2724ff){var _0x33514b={};_0x33514b[_0x2724ff]={'$like':'%'+_0x12fdb7[_0x88e0('0x43')][_0x88e0('0x4e')]+'%'};return _0x33514b;})});}_0x9f47b7=_[_0x88e0('0x50')]({},_0x9f47b7,_0x12fdb7['options']);return db[_0x88e0('0x66')][_0x88e0('0x2e')]({'where':_0x9f47b7[_0x88e0('0x4f')]})[_0x88e0('0x1c')](function(_0x468806){_0x554608[_0x88e0('0x2e')]=_0x468806;if(_0x12fdb7[_0x88e0('0x43')][_0x88e0('0x56')]){_0x9f47b7[_0x88e0('0x52')]=[{'all':!![]}];}return db[_0x88e0('0x66')][_0x88e0('0x53')](_0x9f47b7);})[_0x88e0('0x1c')](function(_0x24b56d){_0x554608[_0x88e0('0x54')]=_0x24b56d;return _0x554608;});}})[_0x88e0('0x1c')](respondWithFilteredResult(_0x2a7b4f,_0x9f47b7))[_0x88e0('0x26')](handleError(_0x2a7b4f,null));};exports[_0x88e0('0x67')]=function(_0xc1ae6a,_0x5ad482,_0x2dea60){return db[_0x88e0('0x3c')][_0x88e0('0x58')]({'where':{'id':_0xc1ae6a[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ad482,null))[_0x88e0('0x1c')](function(_0x57d2c9){if(_0x57d2c9){return _0x57d2c9[_0x88e0('0x67')](_0xc1ae6a['query'][_0x88e0('0x68')]);}})['then'](respondWithStatusCode(_0x5ad482,null))[_0x88e0('0x26')](handleError(_0x5ad482,null));};exports[_0x88e0('0x69')]=function(_0x1b4a97,_0x35cf17,_0x16269c){if(_0x1b4a97[_0x88e0('0x60')]['id']){delete _0x1b4a97['body']['id'];}return db[_0x88e0('0x3c')][_0x88e0('0x58')]({'where':{'id':_0x1b4a97[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x35cf17,null))['then'](function(_0x5e243f){if(_0x5e243f){_0x1b4a97[_0x88e0('0x60')][_0x88e0('0x63')]=_0x5e243f['id'];return db['CannedAnswer']['create'](_0x1b4a97[_0x88e0('0x60')]);}})[_0x88e0('0x1c')](respondWithResult(_0x35cf17,null))['catch'](handleError(_0x35cf17,null));};exports['getAnswers']=function(_0x6e2423,_0x13c655,_0x2e792f){var _0x4a38d3={'raw':![],'where':{}};var _0x1f6c5e={};var _0x1dabb1={'count':0x0,'rows':[]};return db[_0x88e0('0x3c')][_0x88e0('0x65')]({'where':{'id':_0x6e2423[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x13c655,null))[_0x88e0('0x1c')](function(_0x35c729){if(_0x35c729){_0x1f6c5e[_0x88e0('0x41')]=_[_0x88e0('0x42')](db[_0x88e0('0x6a')][_0x88e0('0x3d')]);_0x1f6c5e[_0x88e0('0x43')]=_[_0x88e0('0x42')](_0x6e2423[_0x88e0('0x43')]);_0x1f6c5e[_0x88e0('0x44')]=_[_0x88e0('0x45')](_0x1f6c5e[_0x88e0('0x41')],_0x1f6c5e[_0x88e0('0x43')]);_0x4a38d3[_0x88e0('0x46')]=_[_0x88e0('0x45')](_0x1f6c5e['model'],qs['fields'](_0x6e2423['query'][_0x88e0('0x47')]));_0x4a38d3[_0x88e0('0x46')]=_0x4a38d3['attributes'][_0x88e0('0x48')]?_0x4a38d3['attributes']:_0x1f6c5e[_0x88e0('0x41')];if(!_0x6e2423['query'][_0x88e0('0x49')](_0x88e0('0x4a'))){_0x4a38d3[_0x88e0('0x2c')]=qs['limit'](_0x6e2423[_0x88e0('0x43')][_0x88e0('0x2c')]);_0x4a38d3[_0x88e0('0x2b')]=qs['offset'](_0x6e2423['query'][_0x88e0('0x2b')]);}_0x4a38d3['order']=qs['sort'](_0x6e2423[_0x88e0('0x43')][_0x88e0('0x4c')]);_0x4a38d3[_0x88e0('0x4f')]=qs['filters'](_[_0x88e0('0x4d')](_0x6e2423['query'],_0x1f6c5e[_0x88e0('0x44')]));_0x4a38d3[_0x88e0('0x4f')][_0x88e0('0x63')]=_0x35c729['id'];if(_0x6e2423[_0x88e0('0x43')][_0x88e0('0x4e')]){_0x4a38d3[_0x88e0('0x4f')]=_[_0x88e0('0x50')](_0x4a38d3['where'],{'$or':_[_0x88e0('0x3b')](_0x4a38d3[_0x88e0('0x46')],function(_0x5be673){var _0x12643b={};_0x12643b[_0x5be673]={'$like':'%'+_0x6e2423[_0x88e0('0x43')][_0x88e0('0x4e')]+'%'};return _0x12643b;})});}_0x4a38d3=_[_0x88e0('0x50')]({},_0x4a38d3,_0x6e2423['options']);return db[_0x88e0('0x6a')][_0x88e0('0x2e')]({'where':_0x4a38d3[_0x88e0('0x4f')]})['then'](function(_0x762173){_0x1dabb1[_0x88e0('0x2e')]=_0x762173;if(_0x6e2423[_0x88e0('0x43')]['includeAll']){_0x4a38d3[_0x88e0('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4a38d3);})[_0x88e0('0x1c')](function(_0x1bd821){_0x1dabb1[_0x88e0('0x54')]=_0x1bd821;return _0x1dabb1;});}})[_0x88e0('0x1c')](respondWithFilteredResult(_0x13c655,_0x4a38d3))[_0x88e0('0x26')](handleError(_0x13c655,null));};exports[_0x88e0('0x6b')]=function(_0x3f0f74,_0x12fced,_0x399b61){return db[_0x88e0('0x3c')]['find']({'where':{'id':_0x3f0f74[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x12fced,null))[_0x88e0('0x1c')](function(_0x4bc14c){if(_0x4bc14c){return _0x4bc14c[_0x88e0('0x6b')](_0x3f0f74[_0x88e0('0x43')][_0x88e0('0x68')]);}})[_0x88e0('0x1c')](respondWithStatusCode(_0x12fced,null))[_0x88e0('0x26')](handleError(_0x12fced,null));};exports['addLogo']=function(_0x4cc0f5,_0xf1f127,_0x5e6e21){_0x4cc0f5['body']['sitepic']=_0x4cc0f5['file'][_0x88e0('0x6c')];return db['ChatWebsite'][_0x88e0('0x58')]({'where':{'id':_0x4cc0f5[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0xf1f127,null))[_0x88e0('0x1c')](saveUpdates(_0x4cc0f5[_0x88e0('0x60')],null))[_0x88e0('0x1c')](respondWithResult(_0xf1f127,null))[_0x88e0('0x26')](handleError(_0xf1f127,null));};exports[_0x88e0('0x6d')]=function(_0x273f28,_0x3b9949,_0x40b3b5){_0x273f28['body'][_0x88e0('0x6e')]=_0x273f28[_0x88e0('0x6f')][_0x88e0('0x6c')];return db[_0x88e0('0x3c')][_0x88e0('0x58')]({'where':{'id':_0x273f28[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b9949,null))[_0x88e0('0x1c')](saveUpdates(_0x273f28[_0x88e0('0x60')],null))['then'](respondWithResult(_0x3b9949,null))[_0x88e0('0x26')](handleError(_0x3b9949,null));};exports[_0x88e0('0x70')]=function(_0x8005d9,_0x4a846d,_0x357c77){_0x8005d9[_0x88e0('0x60')][_0x88e0('0x71')]=_0x8005d9[_0x88e0('0x6f')][_0x88e0('0x6c')];return db['ChatWebsite'][_0x88e0('0x58')]({'where':{'id':_0x8005d9[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x4a846d,null))[_0x88e0('0x1c')](saveUpdates(_0x8005d9[_0x88e0('0x60')],null))[_0x88e0('0x1c')](respondWithResult(_0x4a846d,null))[_0x88e0('0x26')](handleError(_0x4a846d,null));};exports[_0x88e0('0x72')]=function(_0x2860f9,_0x24b03c,_0x503444){_0x2860f9[_0x88e0('0x60')][_0x88e0('0x73')]=_0x2860f9[_0x88e0('0x6f')][_0x88e0('0x6c')];return db[_0x88e0('0x3c')][_0x88e0('0x58')]({'where':{'id':_0x2860f9[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x24b03c,null))['then'](saveUpdates(_0x2860f9['body'],null))[_0x88e0('0x1c')](respondWithResult(_0x24b03c,null))['catch'](handleError(_0x24b03c,null));};exports[_0x88e0('0x74')]=function(_0x2f7b69,_0x3feeab,_0x1543df){var _0x521905=path[_0x88e0('0x75')](config[_0x88e0('0x76')],_0x88e0('0x77'));var _0xb69720={'where':{'id':_0x2f7b69[_0x88e0('0x55')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x27e9b4=![];return require(_0x88e0('0x13'))[_0x88e0('0x78')]()[_0x88e0('0x1c')](function(_0x225b48){if(_0x225b48){_0x27e9b4=_0x225b48[_0x88e0('0x79')];}})[_0x88e0('0x1c')](function(){return db[_0x88e0('0x3c')][_0x88e0('0x58')](_0xb69720);})['then'](handleEntityNotFound(_0x3feeab,null))['then'](function(_0x1c3f74){if(_0x1c3f74){if(!_['isNil'](_0x1c3f74[_0x88e0('0x7a')])){if(fs[_0x88e0('0x7b')](path[_0x88e0('0x75')](config[_0x88e0('0x76')],'server/files/images/logos/',_0x1c3f74[_0x88e0('0x7a')]))&&_0x27e9b4){_0x521905=path[_0x88e0('0x75')](config['root'],_0x88e0('0x7c'),_0x1c3f74[_0x88e0('0x7a')]);}}return _0x3feeab['download'](_0x521905);}})[_0x88e0('0x26')](handleError(_0x3feeab,null));};exports[_0x88e0('0x7d')]=function(_0x104b14,_0x44921d,_0x503be5){var _0x150d5e=path[_0x88e0('0x75')](config[_0x88e0('0x76')],_0x88e0('0x7e'));var _0x314580={'where':{'id':_0x104b14['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x88e0('0x3c')]['find'](_0x314580)['then'](handleEntityNotFound(_0x44921d,null))[_0x88e0('0x1c')](function(_0x197894){if(_0x197894){if(!_[_0x88e0('0x7f')](_0x197894[_0x88e0('0x6e')])){if(fs[_0x88e0('0x7b')](path[_0x88e0('0x75')](config['root'],'server/files/images/avatars/',_0x197894[_0x88e0('0x6e')]))){_0x150d5e=path[_0x88e0('0x75')](config[_0x88e0('0x76')],_0x88e0('0x80'),_0x197894[_0x88e0('0x6e')]);}}return _0x44921d[_0x88e0('0x81')](_0x150d5e);}})[_0x88e0('0x26')](handleError(_0x44921d,null));};exports[_0x88e0('0x82')]=function(_0x43a087,_0x2dcbad,_0x43af63){var _0x3b0832=path[_0x88e0('0x75')](config[_0x88e0('0x76')],'server/files/images/avatars/customer_avatar.png');var _0x28ba95={'where':{'id':_0x43a087[_0x88e0('0x55')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x88e0('0x58')](_0x28ba95)['then'](handleEntityNotFound(_0x2dcbad,null))[_0x88e0('0x1c')](function(_0x380a8a){if(_0x380a8a){if(!_['isNil'](_0x380a8a[_0x88e0('0x71')])){if(fs[_0x88e0('0x7b')](path[_0x88e0('0x75')](config[_0x88e0('0x76')],_0x88e0('0x80'),_0x380a8a[_0x88e0('0x71')]))&&_0x380a8a[_0x88e0('0x83')]){_0x3b0832=path['join'](config['root'],_0x88e0('0x80'),_0x380a8a[_0x88e0('0x71')]);}}return _0x2dcbad[_0x88e0('0x81')](_0x3b0832);}})[_0x88e0('0x26')](handleError(_0x2dcbad,null));};exports['getSystemAvatar']=function(_0x2f4ff8,_0x100472,_0x1a013e){var _0x3c8fe9=path[_0x88e0('0x75')](config[_0x88e0('0x76')],_0x88e0('0x84'));var _0x364c6c={'where':{'id':_0x2f4ff8[_0x88e0('0x55')]['id']},'attributes':['id',_0x88e0('0x73')],'raw':!![]};return db[_0x88e0('0x3c')][_0x88e0('0x58')](_0x364c6c)[_0x88e0('0x1c')](handleEntityNotFound(_0x100472,null))['then'](function(_0x5f1caa){if(_0x5f1caa){if(!_[_0x88e0('0x7f')](_0x5f1caa['systemAvatar'])){if(fs['existsSync'](path['join'](config[_0x88e0('0x76')],_0x88e0('0x80'),_0x5f1caa['systemAvatar']))){_0x3c8fe9=path[_0x88e0('0x75')](config['root'],_0x88e0('0x80'),_0x5f1caa[_0x88e0('0x73')]);}}return _0x100472[_0x88e0('0x81')](_0x3c8fe9);}})[_0x88e0('0x26')](handleError(_0x100472,null));};exports[_0x88e0('0x85')]=function(_0x1709aa,_0x3aa580,_0x5a041b){var _0x54fae4=require(_0x88e0('0x86'));var _0x297672=new _0x54fae4();var _0x360c83=_0x297672[_0x88e0('0x87')](_0x1709aa[_0x88e0('0x88')][_0x88e0('0x89')])[_0x88e0('0x8a')]();var _0x1138fe={'body':_0x1709aa[_0x88e0('0x60')],'channel':_0x88e0('0x8b')};var _0x23dd20=[];var _0x4b958d=[];var _0x4dbe36={};var _0x1b63dd=![];return db['CmContact'][_0x88e0('0x61')]()[_0x88e0('0x1c')](function(_0x39da42){if(!_0x39da42){throw new db[(_0x88e0('0x8c'))]['ValidationError']('no\x20available\x20attributes');}_0x23dd20=_[_0x88e0('0x8d')](_[_0x88e0('0x42')](_0x39da42),[_0x88e0('0x8e'),'updatedAt']);_0x4b958d=_['difference'](_[_0x88e0('0x42')](_0x39da42),[_0x88e0('0x8e'),_0x88e0('0x8f'),'CompanyId','ListId']);if(_0x1709aa[_0x88e0('0x60')]['id']){delete _0x1709aa[_0x88e0('0x60')]['id'];}if(_['isNil'](_0x1709aa['body'][_0x88e0('0x90')])){throw new db['Sequelize']['ValidationError'](_0x88e0('0x91'));}if(_[_0x88e0('0x7f')](_0x1709aa[_0x88e0('0x60')]['body'])||_0x1709aa[_0x88e0('0x60')][_0x88e0('0x60')]===''){throw new db[(_0x88e0('0x8c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x88e0('0x7f')](_0x1709aa[_0x88e0('0x60')][_0x88e0('0x92')])){throw new db[(_0x88e0('0x8c'))][(_0x88e0('0x93'))](_0x88e0('0x94')+_0x4b958d);}if(!_['includes'](_0x4b958d,_0x1709aa[_0x88e0('0x60')][_0x88e0('0x92')])){throw new db[(_0x88e0('0x8c'))]['ValidationError'](_0x88e0('0x95')+_0x4b958d);}_0x4dbe36[_0x1709aa[_0x88e0('0x60')][_0x88e0('0x92')]]=_0x1709aa['body']['from'];})[_0x88e0('0x1c')](function(){return db[_0x88e0('0x3c')][_0x88e0('0x58')]({'where':{'id':_0x1709aa[_0x88e0('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x88e0('0x96'),'include':[{'model':db[_0x88e0('0x97')],'as':_0x88e0('0x98'),'where':_0x4dbe36,'limit':0x1,'order':[['updatedAt',_0x88e0('0x99')]]}]},{'model':db[_0x88e0('0x9a')],'as':'Applications'}]});})[_0x88e0('0x1c')](handleEntityNotFound(_0x3aa580,null))[_0x88e0('0x1c')](function(_0x1c2a1c){if(_0x1c2a1c&&_0x1c2a1c[_0x88e0('0x96')]){_0x1138fe[_0x88e0('0x9b')]=_0x1c2a1c;_0x1138fe[_0x88e0('0x9c')]=_0x1c2a1c['Applications'];_0x1138fe[_0x88e0('0x9d')]=_0x1c2a1c[_0x88e0('0x96')];_0x1138fe[_0x88e0('0x9c')]=_['orderBy'](_0x1138fe[_0x88e0('0x9c')],[_0x88e0('0x9e')],[_0x88e0('0x9f')]);if(_0x1138fe[_0x88e0('0x9b')]['Applications']){delete _0x1138fe[_0x88e0('0x9b')]['Applications'];}if(_0x1138fe[_0x88e0('0x9b')][_0x88e0('0x96')]&&_0x1138fe['account'][_0x88e0('0x96')][_0x88e0('0x98')][_0x88e0('0x48')]){return _0x1138fe[_0x88e0('0x9b')][_0x88e0('0x96')][_0x88e0('0x98')][0x0];}var _0x43fb6f=_[_0x88e0('0x15')](_0x1709aa[_0x88e0('0x60')],{'firstName':_0x1709aa[_0x88e0('0x60')][_0x88e0('0x90')],'ListId':_0x1c2a1c['ListId']});_0x43fb6f[_0x1709aa[_0x88e0('0x60')][_0x88e0('0x92')]]=_0x1709aa['body']['from'];return db[_0x88e0('0x97')]['create'](_0x43fb6f,{'fields':_0x23dd20,'raw':!![]});}})[_0x88e0('0x1c')](handleEntityNotFound(_0x3aa580,null))[_0x88e0('0x1c')](function(_0x3db7c7){_0x1138fe[_0x88e0('0xa0')]=_0x3db7c7;var _0x3661cf=_0x1709aa[_0x88e0('0x60')]['customerIp'];if(_0x1709aa[_0x88e0('0x88')][_0x88e0('0xa1')]){_0x3661cf=_0x1709aa[_0x88e0('0x88')][_0x88e0('0xa1')];}else if(_0x1709aa[_0x88e0('0x88')][_0x88e0('0xa2')]){_0x3661cf=_[_0x88e0('0xa3')](_0x1709aa[_0x88e0('0x88')][_0x88e0('0xa2')]['split'](','));}if(_0x3db7c7){var _0x5a85fd={'ContactId':_0x3db7c7['id'],'ChatWebsiteId':_0x1709aa['params']['id'],'from':(_0x3db7c7[_0x88e0('0xa4')]||'')+'\x20'+(_0x3db7c7[_0x88e0('0xa5')]||''),'customerIp':_0x3661cf,'customerPort':_0x1709aa['headers'][_0x88e0('0xa6')]?_0x1709aa['headers']['x-real-port']:null,'referer':_0x1709aa[_0x88e0('0x60')][_0x88e0('0xa7')],'browserName':_0x360c83[_0x88e0('0xa8')][_0x88e0('0x36')]&&_0x360c83[_0x88e0('0xa8')]['version']?util['format'](_0x88e0('0xa9'),_0x360c83[_0x88e0('0xa8')]['name'],_0x360c83['browser'][_0x88e0('0xaa')]):_0x88e0('0xab'),'browserVersion':_0x360c83['browser']['version']||_0x88e0('0xab'),'osName':util['format'](_0x88e0('0xa9'),_0x360c83['os'][_0x88e0('0x36')],_0x360c83['os'][_0x88e0('0xaa')]),'osVersion':_0x360c83['os']['version'],'deviceModel':_0x360c83[_0x88e0('0xac')]['model']&&_0x360c83['device'][_0x88e0('0xad')]?util[_0x88e0('0xae')]('%s\x20%s\x20%s',_0x360c83[_0x88e0('0xac')][_0x88e0('0x41')],_0x360c83[_0x88e0('0xac')][_0x88e0('0xad')],_0x360c83[_0x88e0('0xac')][_0x88e0('0x3f')]):null,'deviceVendor':_0x360c83[_0x88e0('0xac')][_0x88e0('0xad')],'deviceType':_0x360c83[_0x88e0('0xac')][_0x88e0('0x3f')],'formData':JSON[_0x88e0('0x22')](_0x1709aa[_0x88e0('0x60')])};var _0x481ca9={'ChatWebsiteId':_0x1709aa[_0x88e0('0x55')]['id'],'closed':![]};if(_0x1709aa['body']['threadId']){_0x481ca9[_0x88e0('0xaf')]=_0x1709aa[_0x88e0('0x60')][_0x88e0('0xaf')];return db[_0x88e0('0xb0')][_0x88e0('0x58')]({'where':_0x481ca9})['then'](function(_0x1e3562){if(_0x1e3562){return[_0x1e3562,![]];}_0x5a85fd[_0x88e0('0xaf')]=_0x1709aa[_0x88e0('0x60')][_0x88e0('0xaf')];_0x5a85fd[_0x88e0('0xb1')]=_0x1709aa[_0x88e0('0x60')][_0x88e0('0xb1')];return db[_0x88e0('0xb0')][_0x88e0('0x59')](_0x5a85fd)['then'](function(_0x2c7b85){return[_0x2c7b85,!![]];});});}_0x481ca9['ContactId']=_0x3db7c7['id'];if(_0x1709aa[_0x88e0('0x60')][_0x88e0('0xb2')]&&_0x1709aa['body'][_0x88e0('0xb2')]['id']){_0x481ca9['id']=_0x1709aa[_0x88e0('0x60')]['interaction']['id'];return db[_0x88e0('0xb0')][_0x88e0('0x58')]({'where':_0x481ca9})[_0x88e0('0x1c')](function(_0x18d8f3){if(_0x18d8f3){return[_0x18d8f3,![]];}return db['ChatInteraction'][_0x88e0('0x59')](_0x5a85fd)['then'](function(_0x1db363){return[_0x1db363,!![]];});});}return db[_0x88e0('0xb0')]['create'](_0x5a85fd)[_0x88e0('0x1c')](function(_0x3e1ffa){return[_0x3e1ffa,!![]];});}})[_0x88e0('0xb3')](function(_0x5b18ba,_0x227ac1){if(_0x5b18ba){_0x1b63dd=_0x227ac1;if(!_0x227ac1){var _0x50485f={'from':(_0x1138fe[_0x88e0('0xa0')][_0x88e0('0xa4')]||'')+'\x20'+(_0x1138fe[_0x88e0('0xa0')]['lastName']||'')};if(_0x1709aa['body']['threadId']&&_0x1709aa[_0x88e0('0x60')]['messageId']&&_0x1709aa[_0x88e0('0x60')][_0x88e0('0xaf')]!=_0x1709aa[_0x88e0('0x60')][_0x88e0('0xb4')]){_0x50485f[_0x88e0('0xaf')]=_0x1709aa[_0x88e0('0x60')][_0x88e0('0xb4')];}return _0x5b18ba[_0x88e0('0xb5')](_0x50485f);}else{return _0x5b18ba;}}})['then'](function(_0xe073e2){_0x1138fe[_0x88e0('0xb2')]=_0xe073e2[_0x88e0('0x31')]({'plain':!![]});_0x1138fe[_0x88e0('0xb2')]['created']=_0x1b63dd;if(_0x1138fe['interaction'][_0x88e0('0xb6')]){if(_0x1138fe[_0x88e0('0x9b')][_0x88e0('0xb7')]){_0x1138fe[_0x88e0('0x9c')][_0x88e0('0xb8')]({'id':0x0,'priority':_0x1138fe[_0x88e0('0x9c')]['length']+0x1,'app':'close','appdata':_0x88e0('0xb9'),'interval':_0x88e0('0xba')});}}return db['ChatMessage']['create']({'body':_0x1709aa[_0x88e0('0x60')][_0x88e0('0x60')],'ChatWebsiteId':_0x1709aa[_0x88e0('0x55')]['id'],'ChatInteractionId':_0xe073e2['id'],'direction':'in','ContactId':_0x1138fe[_0x88e0('0xa0')]['id'],'AttachmentId':_0x1709aa['body'][_0x88e0('0xbb')]});})['then'](function(_0x154a0b){_0x1138fe['message']=_0x154a0b;if(_0x1138fe['interaction'][_0x88e0('0xbc')]){return db[_0x88e0('0xbd')]['find']({'attributes':['id',_0x88e0('0x36')],'where':{'id':_0x1138fe[_0x88e0('0xb2')][_0x88e0('0xbc')]}})[_0x88e0('0x1c')](function(_0x4ace30){if(_0x4ace30){_0x1138fe['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x88e0('0xbe'),'appdata':_0x4ace30['name']+','+(_0x1138fe[_0x88e0('0x9b')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x1138fe[_0x88e0('0xbf')]=!![];}return respondWithRpcPromise(_0x88e0('0xc0'),_0x88e0('0xc1'),_0x1138fe);});}return respondWithRpcPromise(_0x88e0('0xc0'),_0x88e0('0xc1'),_0x1138fe);})[_0x88e0('0x1c')](function(_0xbc36e4){respondWithRpcPromise(_0x88e0('0xc2'),_0x88e0('0xc2'),{'event':'notify','message':_0xbc36e4},client9002);return _0xbc36e4;})['then'](respondWithResult(_0x3aa580,null))[_0x88e0('0x26')](handleError(_0x3aa580,null));};exports[_0x88e0('0xc3')]=function(_0x2e4829,_0x417ca3,_0xa83dd7){var _0x21159c,_0xb84371,_0x3e903f;var _0x133c45=[];var _0x37c834=[];var _0x482379={};var _0x55c0ed=_0x2e4829[_0x88e0('0xc4')]||[];var _0x1dc7e0=[];var _0x26e71b;return db[_0x88e0('0x97')][_0x88e0('0x61')]()['then'](function(_0x284a33){if(!_0x284a33){throw new db[(_0x88e0('0x8c'))][(_0x88e0('0x93'))](_0x88e0('0xc5'));}_0x37c834=_[_0x88e0('0x8d')](_[_0x88e0('0x42')](_0x284a33),[_0x88e0('0x8e'),'updatedAt']);_0x133c45=_['difference'](_[_0x88e0('0x42')](_0x284a33),[_0x88e0('0x8e'),'updatedAt',_0x88e0('0xc6'),'ListId']);if(_0x2e4829[_0x88e0('0x60')]['id']){delete _0x2e4829[_0x88e0('0x60')]['id'];}if(_[_0x88e0('0x7f')](_0x2e4829[_0x88e0('0x60')]['from'])){throw _0x417ca3[_0x88e0('0x28')](0x1f4)[_0x88e0('0x37')](new db[(_0x88e0('0x8c'))][(_0x88e0('0x93'))](_0x88e0('0x91')));}if(_[_0x88e0('0x7f')](_0x2e4829[_0x88e0('0x60')]['body'])||_0x2e4829[_0x88e0('0x60')][_0x88e0('0x60')]===''){throw _0x417ca3[_0x88e0('0x28')](0x1f4)[_0x88e0('0x37')](new db['Sequelize'][(_0x88e0('0x93'))](_0x88e0('0xc7')));}if(_[_0x88e0('0x7f')](_0x2e4829[_0x88e0('0x60')][_0x88e0('0xc8')])){throw _0x417ca3['status'](0x1f4)[_0x88e0('0x37')](new db[(_0x88e0('0x8c'))][(_0x88e0('0x93'))](_0x88e0('0xc9')+_0x133c45));}if(!_[_0x88e0('0xca')](_0x133c45,_0x2e4829[_0x88e0('0x60')]['mapKeyOffline'])){throw _0x417ca3['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x88e0('0xcb')+_0x133c45));}_0x482379[_0x2e4829[_0x88e0('0x60')][_0x88e0('0xc8')]]=_0x2e4829[_0x88e0('0x60')][_0x88e0('0x90')];})[_0x88e0('0x1c')](function(){return db[_0x88e0('0x3c')]['find']({'where':{'id':_0x2e4829[_0x88e0('0x55')]['id']},'include':[{'model':db[_0x88e0('0xcc')],'as':'List'},{'model':db[_0x88e0('0xcd')],'as':_0x88e0('0xcd')}]});})[_0x88e0('0x1c')](handleEntityNotFound(_0x417ca3,null))[_0x88e0('0x1c')](function(_0x3409b0){if(_0x3409b0&&_0x3409b0['List']){_0xb84371=_0x3409b0;var _0x3937b5=_[_0x88e0('0x15')](_0x2e4829[_0x88e0('0x60')],{'firstName':_0x2e4829[_0x88e0('0x60')][_0x88e0('0x90')],'phone':_0x2e4829[_0x88e0('0x60')][_0x88e0('0x90')],'ListId':_0x3409b0['ListId']});_0x3937b5[_0x2e4829[_0x88e0('0x60')]['mapKeyOffline']]=_0x2e4829[_0x88e0('0x60')][_0x88e0('0x90')];return db[_0x88e0('0x97')][_0x88e0('0xce')]({'where':_0x482379,'defaults':_0x3937b5});}})['spread'](function(_0x3a9ddd){if(_0x3a9ddd){_0x3e903f=_0x3a9ddd;var _0x5ac2b3=fs[_0x88e0('0xcf')](path[_0x88e0('0x75')](config['root'],_0x88e0('0xd0')),_0x88e0('0xd1'));var _0x23de13=ejs[_0x88e0('0xd2')](_0x5ac2b3,{'body':_[_0x88e0('0xd3')](_0x2e4829[_0x88e0('0x60')][_0x88e0('0x60')]),'bodyTitle':_0xb84371[_0x88e0('0xd4')]});return db['ChatOfflineMessage'][_0x88e0('0x59')]({'body':_0x23de13,'ContactId':_0x3a9ddd['id'],'ChatWebsiteId':_0xb84371['id']});}})[_0x88e0('0x1c')](function(_0x31f83d){_0x26e71b=_0x31f83d;if(_0x55c0ed['length']){var _0x2e97b0=_0x55c0ed['map'](function(_0x2726ba){return{'name':_0x2726ba[_0x88e0('0xd5')],'basename':_0x2726ba[_0x88e0('0x6c')],'type':_0x2726ba[_0x88e0('0xd6')],'ChatOfflineMessageId':_0x31f83d['id']};});_0x1dc7e0=_0x2e97b0[_0x88e0('0x3b')](_0x4e97d6=>{var _0x229738={'filename':_0x4e97d6[_0x88e0('0x36')],'path':path['join'](config[_0x88e0('0x76')],_0x88e0('0xd7'),_0x88e0('0xc4'),'attachments',_0x88e0('0xd8'),_0x4e97d6[_0x88e0('0xd9')])};return _0x229738;});if(!_0xb84371['openNewInteraction']){return db[_0x88e0('0xda')][_0x88e0('0xdb')](function(_0x8229fb){return db[_0x88e0('0xdc')]['bulkCreate'](_0x2e97b0,{'transaction':_0x8229fb});});}}})['then'](function(){if(_0x26e71b){_0x21159c=_0x26e71b;return db[_0x88e0('0xcd')][_0x88e0('0x65')]({'where':{'active':!![]},'include':[{'model':db[_0x88e0('0xdd')],'as':_0x88e0('0xde'),'raw':!![]}]});}})[_0x88e0('0x1c')](function(_0x19c01d){if(_0x19c01d&&_0x19c01d[_0x88e0('0xde')]&&_0xb84371['forwardOffline']&&_0xb84371[_0x88e0('0xdf')]){var _0x523b50={'tls':{'rejectUnauthorized':![]}};if(_0x19c01d[_0x88e0('0xde')][_0x88e0('0xe0')]){_0x523b50[_0x88e0('0xe0')]=_0x19c01d[_0x88e0('0xde')][_0x88e0('0xe0')];}else{_0x523b50[_0x88e0('0xe1')]=_0x19c01d[_0x88e0('0xde')][_0x88e0('0xe1')];_0x523b50['port']=_0x19c01d[_0x88e0('0xde')]['port'];_0x523b50['secure']=_0x19c01d[_0x88e0('0xde')]['secure'];}if(_0x19c01d[_0x88e0('0xde')]['authentication']){_0x523b50[_0x88e0('0xe2')]={'user':_0x19c01d[_0x88e0('0xde')][_0x88e0('0x5a')],'pass':_0x19c01d[_0x88e0('0xde')][_0x88e0('0xe3')]};}return respondWithRpcPromise(_0x88e0('0xe4'),_0x88e0('0xe5'),{'account':_0x523b50,'message':{'from':util[_0x88e0('0xae')](_0x88e0('0xe6'),_0x19c01d[_0x88e0('0x36')],_0x19c01d[_0x88e0('0xe7')]||_0x19c01d[_0x88e0('0xde')][_0x88e0('0x5a')]),'to':_0xb84371[_0x88e0('0xdf')],'subject':_0xb84371[_0x88e0('0xe8')],'html':_0x21159c[_0x88e0('0x60')],'attachments':_0x1dc7e0}},client9003)[_0x88e0('0x1c')](function(){return _0x21159c;})[_0x88e0('0x26')](function(_0x4fa931){console['error'](_0x4fa931);});}})[_0x88e0('0x1c')](function(){if(_0xb84371&&_0xb84371[_0x88e0('0xe9')]&&_0xb84371[_0x88e0('0xea')]){var _0x546350=[];if(_0x55c0ed[_0x88e0('0x48')]){_0x546350=_0x55c0ed[_0x88e0('0x3b')](function(_0x5c5e36){return{'name':_0x5c5e36['originalname'],'basename':_0x5c5e36[_0x88e0('0x6c')],'type':_0x5c5e36[_0x88e0('0xd6')],'ChatOfflineMessageId':_0x26e71b['id']};});}var _0x5ab942;if(!_[_0x88e0('0x7f')](_0xb84371[_0x88e0('0xeb')])){var _0x5bd18a=_['map'](_0x2e4829['body'],function(_0x531f97){return _0x531f97;});var _0x4ebf39=_[_0x88e0('0xec')](_0x5bd18a)[0x0];var _0x3f6f38=_[_0x88e0('0xed')](_0x4ebf39,function(_0x34a12d){return _0x34a12d;});_0x5ab942=_0x3f6f38[0x1][_0xb84371[_0x88e0('0xeb')]];}var _0x48a952={'from':_0x3e903f[_0x88e0('0xe7')],'firstName':_0x3e903f[_0x88e0('0xa4')],'lastName':_0x3e903f['lastName'],'mapKey':_0x88e0('0xe7'),'message':{'from':_0x3e903f['email'],'to':_0xb84371[_0x88e0('0xcd')][_0x88e0('0xe7')],'cc':'','subject':_[_0x88e0('0x7f')](_0x5ab942)?_0xb84371[_0x88e0('0xe8')]:_0x5ab942,'messageId':'','sentAt':new Date(),'attach':_0x546350[_0x88e0('0x48')],'attachments':_0x546350,'originChannel':_0x88e0('0xee'),'ChatWebsiteId':_0xb84371['id'],'ChatOfflineMessageId':_0x21159c['id'],'originTo':_0xb84371[_0x88e0('0xcd')]['email']},'body':_0x21159c[_0x88e0('0x60')]};var _0x1e9a59={'account':{'id':_0xb84371['MailAccountId']},'body':_0x48a952,'log':_0x88e0('0xef')};return respondWithRpcPromise(_0x88e0('0xef'),_0x88e0('0xf0'),_0x1e9a59,client9001)['then'](function(){return _0x21159c;})[_0x88e0('0x26')](function(_0x141234){console[_0x88e0('0x23')](_0x141234);});}return;})['then'](function(){if(_0x21159c){return _0x21159c;}})[_0x88e0('0x1c')](respondWithResult(_0x417ca3,null))[_0x88e0('0x26')](function(_0x3344a4){console[_0x88e0('0x23')]('catch',_0x3344a4);for(var _0x395c4e of _0x55c0ed){var _0xa2fbda=path[_0x88e0('0x75')](config[_0x88e0('0x76')],_0x88e0('0xd7'),'files',_0x88e0('0xf1'),_0x88e0('0xd8'),_0x395c4e['filename']);fs_extra[_0x88e0('0xf2')](_0xa2fbda)[_0x88e0('0x26')](function(_0x1bae68){console[_0x88e0('0x23')](_0x88e0('0xf3'),_0xa2fbda,_0x1bae68);});}});};exports[_0x88e0('0xf4')]=function(_0x39392f,_0x2d13d4,_0x45b899){return db[_0x88e0('0xb0')][_0x88e0('0x58')]({'where':{'id':_0x39392f[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x2d13d4,null))[_0x88e0('0x1c')](function(_0x441486){if(_0x441486){return _0x441486[_0x88e0('0xf4')](_0x39392f['body'][_0x88e0('0x68')],_[_0x88e0('0xf5')](_0x39392f[_0x88e0('0x60')],['ids','id'])||{});}})['then'](respondWithResult(_0x2d13d4,null))[_0x88e0('0x26')](handleError(_0x2d13d4,null));};exports[_0x88e0('0xf6')]=function(_0x5e1c55,_0x29b346,_0x538585){var _0x51cc8c={'raw':![],'where':{}};var _0x16d127={};var _0x222a74={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x88e0('0x65')]({'where':{'id':_0x5e1c55[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x29b346,null))[_0x88e0('0x1c')](function(_0xed1fe3){if(_0xed1fe3){_0x16d127[_0x88e0('0x41')]=_[_0x88e0('0x42')](db[_0x88e0('0xb0')]['rawAttributes']);_0x16d127[_0x88e0('0x43')]=_[_0x88e0('0x42')](_0x5e1c55['query']);_0x16d127[_0x88e0('0x44')]=_[_0x88e0('0x45')](_0x16d127['model'],_0x16d127['query']);_0x51cc8c[_0x88e0('0x46')]=_[_0x88e0('0x45')](_0x16d127[_0x88e0('0x41')],qs[_0x88e0('0x47')](_0x5e1c55[_0x88e0('0x43')][_0x88e0('0x47')]));_0x51cc8c['attributes']=_0x51cc8c['attributes'][_0x88e0('0x48')]?_0x51cc8c[_0x88e0('0x46')]:_0x16d127[_0x88e0('0x41')];if(!_0x5e1c55[_0x88e0('0x43')][_0x88e0('0x49')](_0x88e0('0x4a'))){_0x51cc8c[_0x88e0('0x2c')]=qs['limit'](_0x5e1c55['query'][_0x88e0('0x2c')]);_0x51cc8c[_0x88e0('0x2b')]=qs[_0x88e0('0x2b')](_0x5e1c55[_0x88e0('0x43')][_0x88e0('0x2b')]);}_0x51cc8c[_0x88e0('0x4b')]=qs['sort'](_0x5e1c55['query'][_0x88e0('0x4c')]);_0x51cc8c[_0x88e0('0x4f')]=qs[_0x88e0('0x44')](_[_0x88e0('0x4d')](_0x5e1c55[_0x88e0('0x43')],_0x16d127[_0x88e0('0x44')]));_0x51cc8c['where']['ChatWebsiteId']=_0xed1fe3['id'];if(_0x5e1c55[_0x88e0('0x43')][_0x88e0('0x4e')]){_0x51cc8c[_0x88e0('0x4f')]=_[_0x88e0('0x50')](_0x51cc8c[_0x88e0('0x4f')],{'$or':_[_0x88e0('0x3b')](_0x51cc8c[_0x88e0('0x46')],function(_0x4121c2){var _0x26fd27={};_0x26fd27[_0x4121c2]={'$like':'%'+_0x5e1c55[_0x88e0('0x43')]['filter']+'%'};return _0x26fd27;})});}_0x51cc8c=_[_0x88e0('0x50')]({},_0x51cc8c,_0x5e1c55[_0x88e0('0x57')]);return db['ChatInteraction'][_0x88e0('0x2e')]({'where':_0x51cc8c[_0x88e0('0x4f')]})[_0x88e0('0x1c')](function(_0x3dd9ff){_0x222a74[_0x88e0('0x2e')]=_0x3dd9ff;if(_0x5e1c55[_0x88e0('0x43')][_0x88e0('0x56')]){_0x51cc8c[_0x88e0('0x52')]=[{'model':db[_0x88e0('0x97')],'as':'Contact','required':![]},{'model':db[_0x88e0('0xbd')],'as':_0x88e0('0xf7'),'attributes':[_0x88e0('0x36'),'fullname',_0x88e0('0xf8')],'required':![]},{'model':db[_0x88e0('0xf9')],'as':_0x88e0('0xfa'),'attributes':['id',_0x88e0('0x36'),'color'],'where':_0x5e1c55[_0x88e0('0x43')][_0x88e0('0xfb')]?{'id':_0x5e1c55[_0x88e0('0x43')][_0x88e0('0xfb')]}:undefined,'required':_0x5e1c55[_0x88e0('0x43')][_0x88e0('0xfb')]?!![]:![]}];}return db['ChatInteraction'][_0x88e0('0x53')](_0x51cc8c);})[_0x88e0('0x1c')](function(_0x289b40){_0x222a74[_0x88e0('0x54')]=_0x289b40;return _0x222a74;});}})[_0x88e0('0x1c')](respondWithFilteredResult(_0x29b346,_0x51cc8c))['catch'](handleError(_0x29b346,null));};function iftimePromise(_0x17cdf4,_0x94f46){return respondWithRpcPromise(_0x88e0('0xfc'),_0x88e0('0xfd'),{'command':_0x94f46[_0x88e0('0xfe')]?util[_0x88e0('0xae')](_0x88e0('0xff'),_0x17cdf4['interval'],_0x94f46[_0x88e0('0xfe')]):util['format'](_0x88e0('0x100'),_0x17cdf4[_0x88e0('0x101')])},client9002)[_0x88e0('0x1c')](function(_0x10ab86){var _0x1cef6a=_0x10ab86&&_0x10ab86[_0x88e0('0x102')](_0x88e0('0x103'))>=0x0?!![]:![];logger[_0x88e0('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x94f46['id'],_0x17cdf4['id'],_0x17cdf4['interval'],_0x1cef6a?_0x88e0('0x104'):_0x88e0('0x105'),_0x94f46[_0x88e0('0xfe')]?_0x94f46[_0x88e0('0xfe')]:_0x88e0('0x106'));return _0x1cef6a;})['catch'](function(_0x591e75){logger[_0x88e0('0x23')](_0x88e0('0x107'),_0x94f46['id'],_0x17cdf4['id'],_0x17cdf4[_0x88e0('0x101')],util[_0x88e0('0x108')](_0x591e75,{'showHidden':![],'depth':null}),_0x94f46[_0x88e0('0xfe')]?_0x94f46[_0x88e0('0xfe')]:'No\x20timezone');return![];});}exports[_0x88e0('0xfd')]=function(_0x22f63d,_0x138d81,_0x484c2d){var _0x3ae08e=0x0;var _0x276d90=0x0;var _0x5890f3=![];var _0x22fc2c;var _0x3e4c86;return db[_0x88e0('0x3c')]['find']({'where':{'id':_0x22f63d[_0x88e0('0x55')]['id']},'include':[{'model':db[_0x88e0('0x109')],'as':_0x88e0('0x109'),'include':[{'model':db['Interval'],'as':_0x88e0('0x10a'),'attributes':['id',_0x88e0('0x101')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x138d81,null))[_0x88e0('0x1c')](function(_0x5db528){if(_0x5db528){_0x22fc2c=_0x5db528;return _0x5db528['getProactiveActions']({'raw':!![]});}})[_0x88e0('0x1c')](function(_0x14a554){if(_0x22fc2c){if(_0x14a554){_0x3e4c86=_0x14a554;}}return require(_0x88e0('0x13'))[_0x88e0('0x78')]();})[_0x88e0('0x1c')](function(_0x5cd387){if(_0x5cd387){_0x276d90=_0x5cd387[_0x88e0('0x10b')];_0x5890f3=_0x5cd387['custom'];}})['then'](function(){return db[_0x88e0('0xb0')][_0x88e0('0x2e')]({'where':{'closed':![]}});})[_0x88e0('0x1c')](function(_0x5038dc){_0x3ae08e=_0x5038dc;if(_0x276d90&&_0x5038dc>_0x276d90){return db[_0x88e0('0x10c')]['findOne']({'where':{'id':0x1}})['then'](function(_0x9e9f8f){if(_0x9e9f8f){_0x9e9f8f[_0x88e0('0x10d')]('chatLicenseExceeded');}});}})[_0x88e0('0x1c')](function(){if(_0x22fc2c[_0x88e0('0x109')]&&_0x22fc2c[_0x88e0('0x109')][_0x88e0('0x10a')]){var _0x3a6419=[];for(var _0x4c22eb=0x0;_0x4c22eb<_0x22fc2c[_0x88e0('0x109')][_0x88e0('0x10a')][_0x88e0('0x48')];_0x4c22eb++){var _0x3596dd=_0x22fc2c[_0x88e0('0x109')][_0x88e0('0x10a')][_0x4c22eb][_0x88e0('0x31')]({'plain':!![]});_0x3a6419[_0x88e0('0xb8')](iftimePromise(_0x3596dd,_0x22fc2c));}return BPromise[_0x88e0('0x10e')](_0x3a6419)[_0x88e0('0x1c')](function(_0x2eb7e4){return _['some'](_0x2eb7e4);});}else{return!![];}})[_0x88e0('0x1c')](function(_0x428581){var _0x3748df=fs[_0x88e0('0xcf')](path[_0x88e0('0x75')](config['root'],_0x88e0('0x10f')),'utf8');var _0x58b8e0={'remote':_0x22fc2c[_0x88e0('0x110')],'query':querystring[_0x88e0('0x22')](_[_0x88e0('0x50')](_0x22fc2c[_0x88e0('0x31')]({'plain':!![]}),{'customerIp':_0x22f63d['headers'][_0x88e0('0xa2')]||_0x22f63d[_0x88e0('0x88')]['x-real-ip']||_0x22f63d['connection']['remoteAddress']||_0x22f63d['ip'],'referer':_0x22f63d[_0x88e0('0x88')]['referer'],'openedInteractions':_0x3ae08e,'maxInteractions':_0x276d90,'virtual':_0x5890f3['virtual'],'online':_0x428581,'custom':_0x5890f3}))[_0x88e0('0x111')](/'/g,'\x5c\x27')};_0x138d81[_0x88e0('0x37')](ejs[_0x88e0('0xd2')](Mustache[_0x88e0('0xd2')](_0x3748df,_0x58b8e0),{'proactiveActions':_0x3e4c86,'alignment':_0x22fc2c[_0x88e0('0x112')],'verticalAlignment':_0x22fc2c[_0x88e0('0x113')],'div_color':_0x22fc2c[_0x88e0('0x114')],'text_color':_0x22fc2c['textColor'],'button_color':_0x22fc2c[_0x88e0('0x115')],'background_color':_0x22fc2c['backgroundColor']}));})[_0x88e0('0x26')](handleError(_0x138d81,null));};exports[_0x88e0('0x116')]=function(_0x5d3cf6,_0x42c97d,_0x5c4216){return db['ChatWebsite'][_0x88e0('0x65')]({'where':{'id':_0x5d3cf6['params']['id']}})['then'](handleEntityNotFound(_0x42c97d,null))[_0x88e0('0x1c')](function(_0x579137){if(_0x579137){return db[_0x88e0('0xda')]['transaction'](function(_0x3f6f13){return db['ChatApplication'][_0x88e0('0x34')]({'where':{'ChatWebsiteId':_0x5d3cf6['params']['id']},'transaction':_0x3f6f13})[_0x88e0('0x1c')](function(_0x2fcb14){var _0x303b15=_[_0x88e0('0x3b')](_0x5d3cf6[_0x88e0('0x60')],function(_0x3e5354){_0x3e5354[_0x88e0('0x63')]=_0x5d3cf6[_0x88e0('0x55')]['id'];return _0x3e5354;});return db[_0x88e0('0x9a')][_0x88e0('0x117')](_0x303b15,{'transaction':_0x3f6f13});});})['then'](function(){return db[_0x88e0('0x9a')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x5d3cf6[_0x88e0('0x55')]['id']},'order':'priority'});});}})[_0x88e0('0x1c')](respondWithResult(_0x42c97d,null))[_0x88e0('0x26')](handleError(_0x42c97d,null));};exports[_0x88e0('0x118')]=function(_0x4c104a,_0x1c02c7,_0x39bad4){var _0x213434={};var _0x56dd08={};var _0x948869;var _0x25105f;return db[_0x88e0('0x3c')]['findOne']({'where':{'id':_0x4c104a[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x1c02c7,null))[_0x88e0('0x1c')](function(_0x2a65bd){if(_0x2a65bd){_0x948869=_0x2a65bd;_0x56dd08['model']=_['keys'](db[_0x88e0('0x9a')][_0x88e0('0x3d')]);_0x56dd08[_0x88e0('0x43')]=_[_0x88e0('0x42')](_0x4c104a[_0x88e0('0x43')]);_0x56dd08[_0x88e0('0x44')]=_[_0x88e0('0x45')](_0x56dd08['model'],_0x56dd08[_0x88e0('0x43')]);_0x213434[_0x88e0('0x46')]=_['intersection'](_0x56dd08[_0x88e0('0x41')],qs[_0x88e0('0x47')](_0x4c104a[_0x88e0('0x43')]['fields']));_0x213434[_0x88e0('0x46')]=_0x213434[_0x88e0('0x46')][_0x88e0('0x48')]?_0x213434['attributes']:_0x56dd08[_0x88e0('0x41')];_0x213434[_0x88e0('0x4b')]=qs[_0x88e0('0x4c')](_0x4c104a[_0x88e0('0x43')][_0x88e0('0x4c')]);_0x213434[_0x88e0('0x4f')]=qs[_0x88e0('0x44')](_[_0x88e0('0x4d')](_0x4c104a[_0x88e0('0x43')],_0x56dd08[_0x88e0('0x44')]));if(_0x4c104a[_0x88e0('0x43')][_0x88e0('0x4e')]){_0x213434[_0x88e0('0x4f')]=_[_0x88e0('0x50')](_0x213434['where'],{'$or':_[_0x88e0('0x3b')](_0x213434[_0x88e0('0x46')],function(_0x568911){var _0x2e85ab={};_0x2e85ab[_0x568911]={'$like':'%'+_0x4c104a[_0x88e0('0x43')][_0x88e0('0x4e')]+'%'};return _0x2e85ab;})});}_0x213434=_[_0x88e0('0x50')]({},_0x213434,_0x4c104a[_0x88e0('0x57')]);return _0x948869['getApplications'](_0x213434);}})[_0x88e0('0x1c')](function(_0xfe5a2){if(_0xfe5a2){_0x25105f=_0xfe5a2['length'];if(!_0x4c104a['query'][_0x88e0('0x49')](_0x88e0('0x4a'))){_0x213434[_0x88e0('0x2c')]=qs[_0x88e0('0x2c')](_0x4c104a[_0x88e0('0x43')][_0x88e0('0x2c')]);_0x213434['offset']=qs['offset'](_0x4c104a['query'][_0x88e0('0x2b')]);}return _0x948869[_0x88e0('0x118')](_0x213434);}})['then'](function(_0x13de75){if(_0x13de75){return _0x13de75?{'count':_0x25105f,'rows':_0x13de75}:null;}})[_0x88e0('0x1c')](respondWithResult(_0x1c02c7,null))[_0x88e0('0x26')](handleError(_0x1c02c7,null));};exports[_0x88e0('0x119')]=function(_0x46746d,_0x15f42d,_0x2624e3){return db[_0x88e0('0x11a')]['find']({'where':{'id':_0x46746d[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x15f42d,null))[_0x88e0('0x1c')](function(_0x5df828){if(_0x5df828){return _0x5df828['addProactiveActions'](_0x46746d['body']['ids'],_[_0x88e0('0xf5')](_0x46746d[_0x88e0('0x60')],['ids','id'])||{});}})[_0x88e0('0x1c')](respondWithResult(_0x15f42d,null))[_0x88e0('0x26')](handleError(_0x15f42d,null));};exports[_0x88e0('0x11b')]=function(_0x244c57,_0x2020d4,_0x524b9b){var _0x3e5e3e={};var _0x4789f6={};var _0x1dbb44;var _0x1788c4;return db[_0x88e0('0x3c')][_0x88e0('0x65')]({'where':{'id':_0x244c57[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x2020d4,null))['then'](function(_0x4dc789){if(_0x4dc789){_0x1dbb44=_0x4dc789;_0x4789f6[_0x88e0('0x41')]=_[_0x88e0('0x42')](db[_0x88e0('0x11c')][_0x88e0('0x3d')]);_0x4789f6['query']=_[_0x88e0('0x42')](_0x244c57[_0x88e0('0x43')]);_0x4789f6[_0x88e0('0x44')]=_[_0x88e0('0x45')](_0x4789f6['model'],_0x4789f6[_0x88e0('0x43')]);_0x3e5e3e[_0x88e0('0x46')]=_[_0x88e0('0x45')](_0x4789f6[_0x88e0('0x41')],qs[_0x88e0('0x47')](_0x244c57[_0x88e0('0x43')][_0x88e0('0x47')]));_0x3e5e3e['attributes']=_0x3e5e3e[_0x88e0('0x46')][_0x88e0('0x48')]?_0x3e5e3e['attributes']:_0x4789f6['model'];_0x3e5e3e['order']=qs[_0x88e0('0x4c')](_0x244c57['query'][_0x88e0('0x4c')]);_0x3e5e3e[_0x88e0('0x4f')]=qs[_0x88e0('0x44')](_[_0x88e0('0x4d')](_0x244c57['query'],_0x4789f6[_0x88e0('0x44')]));if(_0x244c57['query']['filter']){_0x3e5e3e['where']=_['merge'](_0x3e5e3e['where'],{'$or':_[_0x88e0('0x3b')](_0x3e5e3e[_0x88e0('0x46')],function(_0x56d9e3){var _0xb7a26a={};_0xb7a26a[_0x56d9e3]={'$like':'%'+_0x244c57[_0x88e0('0x43')]['filter']+'%'};return _0xb7a26a;})});}_0x3e5e3e=_[_0x88e0('0x50')]({},_0x3e5e3e,_0x244c57[_0x88e0('0x57')]);return _0x1dbb44[_0x88e0('0x11b')](_0x3e5e3e);}})[_0x88e0('0x1c')](function(_0x30d22d){if(_0x30d22d){_0x1788c4=_0x30d22d[_0x88e0('0x48')];if(!_0x244c57[_0x88e0('0x43')][_0x88e0('0x49')](_0x88e0('0x4a'))){_0x3e5e3e[_0x88e0('0x2c')]=qs[_0x88e0('0x2c')](_0x244c57[_0x88e0('0x43')][_0x88e0('0x2c')]);_0x3e5e3e[_0x88e0('0x2b')]=qs[_0x88e0('0x2b')](_0x244c57['query']['offset']);}return _0x1dbb44[_0x88e0('0x11b')](_0x3e5e3e);}})[_0x88e0('0x1c')](function(_0x29bbb3){if(_0x29bbb3){return _0x29bbb3?{'count':_0x1788c4,'rows':_0x29bbb3}:null;}})['then'](respondWithResult(_0x2020d4,null))[_0x88e0('0x26')](handleError(_0x2020d4,null));};exports[_0x88e0('0x11d')]=function(_0x18bc80,_0x11a602,_0x32f70f){var _0x28fa67=_0x18bc80['query'][_0x88e0('0x11e')]==='false'?_0x88e0('0x11f'):_0x88e0('0x120');return db['ChatWebsite'][_0x88e0('0x58')]({'attributes':['id',_0x28fa67],'where':{'id':_0x18bc80['params']['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x11a602,null))[_0x88e0('0x1c')](function(_0x49f26b){if(_0x49f26b){var _0x5b745f=_0x49f26b[_0x28fa67];var _0x46ef73=_0x5b745f&&_0x5b745f[_0x88e0('0x121')]?_0x5b745f[_0x88e0('0x121')]:[];_0x11a602[_0x88e0('0x37')]({'fromKey':_['isNil'](_0x5b745f[_0x88e0('0x122')])?undefined:_0x5b745f[_0x88e0('0x122')],'count':_0x46ef73['length'],'rows':_0x46ef73});}})[_0x88e0('0x26')](handleError(_0x11a602,null));};exports[_0x88e0('0x123')]=function(_0x434ced,_0x367fb0,_0x31c6a6){var _0x1de694={'raw':![],'where':{}};var _0x4f3afa={};var _0x33540c={'count':0x0,'rows':[]};return db[_0x88e0('0x3c')][_0x88e0('0x65')]({'where':{'id':_0x434ced[_0x88e0('0x55')]['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x367fb0,null))[_0x88e0('0x1c')](function(_0x5dd555){if(_0x5dd555){_0x4f3afa['model']=_[_0x88e0('0x42')](db[_0x88e0('0x124')][_0x88e0('0x3d')]);_0x4f3afa[_0x88e0('0x43')]=_[_0x88e0('0x42')](_0x434ced[_0x88e0('0x43')]);_0x4f3afa['filters']=_[_0x88e0('0x45')](_0x4f3afa[_0x88e0('0x41')],_0x4f3afa[_0x88e0('0x43')]);_0x1de694[_0x88e0('0x46')]=_[_0x88e0('0x45')](_0x4f3afa[_0x88e0('0x41')],qs['fields'](_0x434ced['query'][_0x88e0('0x47')]));_0x1de694[_0x88e0('0x46')]=_0x1de694['attributes'][_0x88e0('0x48')]?_0x1de694[_0x88e0('0x46')]:_0x4f3afa[_0x88e0('0x41')];if(!_0x434ced['query']['hasOwnProperty'](_0x88e0('0x4a'))){_0x1de694[_0x88e0('0x2c')]=qs[_0x88e0('0x2c')](_0x434ced['query'][_0x88e0('0x2c')]);_0x1de694['offset']=qs['offset'](_0x434ced[_0x88e0('0x43')][_0x88e0('0x2b')]);}_0x1de694[_0x88e0('0x4b')]=qs[_0x88e0('0x4c')](_0x434ced[_0x88e0('0x43')][_0x88e0('0x4c')]);_0x1de694[_0x88e0('0x4f')]=qs['filters'](_[_0x88e0('0x4d')](_0x434ced['query'],_0x4f3afa[_0x88e0('0x44')]));_0x1de694[_0x88e0('0x4f')][_0x88e0('0x63')]=_0x5dd555['id'];if(_0x434ced[_0x88e0('0x43')][_0x88e0('0x4e')]){_0x1de694[_0x88e0('0x4f')]=_[_0x88e0('0x50')](_0x1de694[_0x88e0('0x4f')],{'$or':_[_0x88e0('0x3b')](_0x1de694[_0x88e0('0x46')],function(_0x583ab4){var _0x4f4802={};_0x4f4802[_0x583ab4]={'$like':'%'+_0x434ced[_0x88e0('0x43')][_0x88e0('0x4e')]+'%'};return _0x4f4802;})});}_0x1de694=_[_0x88e0('0x50')]({},_0x1de694,_0x434ced['options']);return db[_0x88e0('0x124')][_0x88e0('0x2e')]({'where':_0x1de694['where']})['then'](function(_0x510982){_0x33540c[_0x88e0('0x2e')]=_0x510982;if(_0x434ced[_0x88e0('0x43')][_0x88e0('0x56')]){_0x1de694[_0x88e0('0x52')]=[{'all':!![]}];}else{_0x1de694[_0x88e0('0x52')]=[{'model':db['CmContact'],'as':_0x88e0('0x125'),'required':![]},{'model':db[_0x88e0('0xdc')],'as':_0x88e0('0x126'),'required':![]}];}return db[_0x88e0('0x124')]['findAll'](_0x1de694);})['then'](function(_0x1f9331){_0x33540c[_0x88e0('0x54')]=_0x1f9331;return _0x33540c;});}})[_0x88e0('0x1c')](respondWithFilteredResult(_0x367fb0,_0x1de694))['catch'](handleError(_0x367fb0,null));};exports['addAgents']=function(_0x5bf7c6,_0x2e6415,_0x547465){return db['ChatWebsite'][_0x88e0('0x58')]({'where':{'id':_0x5bf7c6[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e6415,null))[_0x88e0('0x1c')](function(_0xed6927){if(_0xed6927){return _0xed6927['addAgents'](_0x5bf7c6['body'][_0x88e0('0x68')],_[_0x88e0('0xf5')](_0x5bf7c6[_0x88e0('0x60')],['ids','id'])||{})[_0x88e0('0xb3')](function(_0xf44331){for(var _0x55266c=0x0;_0x55266c<_0x5bf7c6[_0x88e0('0x60')][_0x88e0('0x68')][_0x88e0('0x48')];_0x55266c+=0x1){socket[_0x88e0('0x127')]('userChatWebsite:save',{'UserId':Number(_0x5bf7c6[_0x88e0('0x60')][_0x88e0('0x68')][_0x55266c]),'ChatWebsiteId':Number(_0x5bf7c6[_0x88e0('0x55')]['id'])});}return _0xf44331;});}})[_0x88e0('0x1c')](respondWithResult(_0x2e6415,null))[_0x88e0('0x26')](handleError(_0x2e6415,null));};exports[_0x88e0('0x128')]=function(_0x8db96f,_0x12665f,_0x48aa32){return db[_0x88e0('0x3c')][_0x88e0('0x58')]({'where':{'id':_0x8db96f['params']['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x12665f,null))['then'](function(_0x44cf85){if(_0x44cf85){return _0x44cf85[_0x88e0('0x128')](_0x8db96f['query'][_0x88e0('0x68')])['then'](function(){if(_['isArray'](_0x8db96f[_0x88e0('0x43')][_0x88e0('0x68')])){for(var _0x20cf29=0x0;_0x20cf29<_0x8db96f[_0x88e0('0x43')]['ids'][_0x88e0('0x48')];_0x20cf29+=0x1){socket[_0x88e0('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x8db96f['query'][_0x88e0('0x68')][_0x20cf29]),'ChatWebsiteId':Number(_0x8db96f[_0x88e0('0x55')]['id'])});}}else{socket['emit'](_0x88e0('0x129'),{'UserId':Number(_0x8db96f[_0x88e0('0x43')][_0x88e0('0x68')]),'ChatWebsiteId':Number(_0x8db96f[_0x88e0('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x12665f,null))[_0x88e0('0x26')](handleError(_0x12665f,null));};exports[_0x88e0('0x12a')]=function(_0x23a431,_0x375f23,_0x340bca){var _0x2040f2={};var _0xa158fc={};var _0x12f04a;var _0x25502c;return db['ChatWebsite']['findOne']({'where':{'id':_0x23a431['params']['id']}})[_0x88e0('0x1c')](handleEntityNotFound(_0x375f23,null))[_0x88e0('0x1c')](function(_0xc4b6f8){if(_0xc4b6f8){_0x12f04a=_0xc4b6f8;_0xa158fc[_0x88e0('0x41')]=_[_0x88e0('0x42')](db[_0x88e0('0xbd')]['rawAttributes']);_0xa158fc[_0x88e0('0x43')]=_['keys'](_0x23a431[_0x88e0('0x43')]);_0xa158fc[_0x88e0('0x44')]=_[_0x88e0('0x45')](_0xa158fc[_0x88e0('0x41')],_0xa158fc[_0x88e0('0x43')]);_0x2040f2[_0x88e0('0x46')]=_['intersection'](_0xa158fc[_0x88e0('0x41')],qs[_0x88e0('0x47')](_0x23a431[_0x88e0('0x43')][_0x88e0('0x47')]));_0x2040f2['attributes']=_0x2040f2['attributes']['length']?_0x2040f2['attributes']:_0xa158fc[_0x88e0('0x41')];_0x2040f2['order']=qs[_0x88e0('0x4c')](_0x23a431[_0x88e0('0x43')][_0x88e0('0x4c')]);_0x2040f2[_0x88e0('0x4f')]=qs['filters'](_[_0x88e0('0x4d')](_0x23a431[_0x88e0('0x43')],_0xa158fc[_0x88e0('0x44')]));if(_0x23a431[_0x88e0('0x43')][_0x88e0('0x4e')]){_0x2040f2['where']=_['merge'](_0x2040f2['where'],{'$or':_[_0x88e0('0x3b')](_0x2040f2[_0x88e0('0x46')],function(_0x15cc8f){var _0x5997be={};_0x5997be[_0x15cc8f]={'$like':'%'+_0x23a431[_0x88e0('0x43')][_0x88e0('0x4e')]+'%'};return _0x5997be;})});}_0x2040f2=_[_0x88e0('0x50')]({},_0x2040f2,_0x23a431[_0x88e0('0x57')]);return _0x12f04a['getAgents'](_0x2040f2);}})[_0x88e0('0x1c')](function(_0x5a5a8d){if(_0x5a5a8d){_0x25502c=_0x5a5a8d[_0x88e0('0x48')];if(!_0x23a431[_0x88e0('0x43')]['hasOwnProperty']('nolimit')){_0x2040f2[_0x88e0('0x2c')]=qs['limit'](_0x23a431[_0x88e0('0x43')][_0x88e0('0x2c')]);_0x2040f2[_0x88e0('0x2b')]=qs[_0x88e0('0x2b')](_0x23a431[_0x88e0('0x43')][_0x88e0('0x2b')]);}return _0x12f04a[_0x88e0('0x12a')](_0x2040f2);}})[_0x88e0('0x1c')](function(_0x5782af){if(_0x5782af){return _0x5782af?{'count':_0x25502c,'rows':_0x5782af}:null;}})[_0x88e0('0x1c')](respondWithResult(_0x375f23,null))[_0x88e0('0x26')](handleError(_0x375f23,null));}; \ No newline at end of file +var _0x93c4=['browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','basename','sequelize','transaction','Attachment','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','all','some','readFileSync','remote','stringify','x-real-ip','referer','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','bulkCreate','ChatApplication','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','isArray','userChatWebsite:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','code','error','message','ChatWebsite,\x20%s,\x20%s','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','save','get','ChatWebsites','UserProfileResource','end','stack','name','send','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','Pause','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','ChatWebsiteId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','file','filename','addAvatar','addCustomerAvatar','addSystemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','isNil','root','server/files/images/logos/','download','getAvatar','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','CmContact','no\x20available\x20attributes','updatedAt','difference','createdAt','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','applications','orderBy','priority','asc','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port'];(function(_0x4e33e5,_0x5aacc1){var _0x2de058=function(_0x2eea19){while(--_0x2eea19){_0x4e33e5['push'](_0x4e33e5['shift']());}};_0x2de058(++_0x5aacc1);}(_0x93c4,0x1b3));var _0x493c=function(_0x5997ee,_0x2870ed){_0x5997ee=_0x5997ee-0x0;var _0x2d7b69=_0x93c4[_0x5997ee];return _0x2d7b69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x493c('0x0'));var zipdir=require(_0x493c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x493c('0x2'));var moment=require('moment');var BPromise=require(_0x493c('0x3'));var Mustache=require(_0x493c('0x4'));var util=require(_0x493c('0x5'));var path=require(_0x493c('0x6'));var sox=require(_0x493c('0x7'));var csv=require('to-csv');var ejs=require(_0x493c('0x8'));var fs=require('fs');var fs_extra=require(_0x493c('0x9'));var _=require(_0x493c('0xa'));var squel=require('squel');var crypto=require(_0x493c('0xb'));var jsforce=require(_0x493c('0xc'));var deskjs=require(_0x493c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x493c('0xe'));var authService=require(_0x493c('0xf'));var qs=require(_0x493c('0x10'));var as=require(_0x493c('0x11'));var hardwareService=require(_0x493c('0x12'));var logger=require(_0x493c('0x13'))(_0x493c('0x14'));var utils=require(_0x493c('0x15'));var config=require(_0x493c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x493c('0x17')]=_[_0x493c('0x18')](config[_0x493c('0x17')],{'host':_0x493c('0x19'),'port':0x18eb});var socket=require(_0x493c('0x1a'))(new Redis(config['redis']));require(_0x493c('0x1b'))[_0x493c('0x1c')](socket);var jayson=require(_0x493c('0x1d'));var client=jayson[_0x493c('0x1e')][_0x493c('0x1f')]({'port':0x232c});var client9002=jayson[_0x493c('0x1e')][_0x493c('0x1f')]({'port':0x232a});var client9003=jayson['client'][_0x493c('0x1f')]({'port':0x232b});var client9001=jayson[_0x493c('0x1e')][_0x493c('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x161329,_0x327123,_0x119f6f,_0x4837ba){return new BPromise(function(_0xac39b0,_0x7e7a5){var _0x55b6bb=_0x4837ba||client;return _0x55b6bb[_0x493c('0x20')](_0x161329,_0x119f6f)[_0x493c('0x21')](function(_0x310688){logger[_0x493c('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x327123,_0x493c('0x23'));logger[_0x493c('0x24')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x327123,_0x493c('0x23'),JSON['stringify'](_0x310688));if(_0x310688['error']){if(_0x310688['error'][_0x493c('0x25')]===0x1f4){logger[_0x493c('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x327123,_0x310688['error'][_0x493c('0x27')]);return _0x7e7a5(_0x310688[_0x493c('0x26')][_0x493c('0x27')]);}logger[_0x493c('0x26')](_0x493c('0x28'),_0x327123,_0x310688[_0x493c('0x26')][_0x493c('0x27')]);return _0xac39b0(_0x310688[_0x493c('0x26')][_0x493c('0x27')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x327123,_0x493c('0x23'));_0xac39b0(_0x310688['result'][_0x493c('0x27')]);}})[_0x493c('0x29')](function(_0x5141c0){logger[_0x493c('0x26')](_0x493c('0x28'),_0x327123,_0x5141c0);_0x7e7a5(_0x5141c0);});});}function respondWithStatusCode(_0x222f29,_0x26f2ab){_0x26f2ab=_0x26f2ab||0xcc;return function(_0x2739b3){if(_0x2739b3){return _0x222f29[_0x493c('0x2a')](_0x26f2ab);}return _0x222f29[_0x493c('0x2b')](_0x26f2ab)['end']();};}function respondWithResult(_0x1dd287,_0x419795){_0x419795=_0x419795||0xc8;return function(_0x54b8d8){if(_0x54b8d8){return _0x1dd287[_0x493c('0x2b')](_0x419795)[_0x493c('0x2c')](_0x54b8d8);}};}function respondWithFilteredResult(_0x37910a,_0x1b403d){return function(_0x2a2a4c){if(_0x2a2a4c){var _0x3d30f0=typeof _0x1b403d['offset']===_0x493c('0x2d')&&typeof _0x1b403d[_0x493c('0x2e')]==='undefined';var _0x1d4825=_0x2a2a4c[_0x493c('0x2f')];var _0x23067a=_0x3d30f0?0x0:_0x1b403d[_0x493c('0x30')];var _0x418b24=_0x3d30f0?_0x2a2a4c['count']:_0x1b403d[_0x493c('0x30')]+_0x1b403d[_0x493c('0x2e')];var _0x2d9b27;if(_0x418b24>=_0x1d4825){_0x418b24=_0x1d4825;_0x2d9b27=0xc8;}else{_0x2d9b27=0xce;}_0x37910a[_0x493c('0x2b')](_0x2d9b27);return _0x37910a['set'](_0x493c('0x31'),_0x23067a+'-'+_0x418b24+'/'+_0x1d4825)['json'](_0x2a2a4c);}return null;};}function patchUpdates(_0x191c80){return function(_0xada99e){try{jsonpatch['apply'](_0xada99e,_0x191c80,!![]);}catch(_0x417de8){return BPromise['reject'](_0x417de8);}return _0xada99e[_0x493c('0x32')]();};}function saveUpdates(_0x481345,_0x2f0d50){return function(_0x1aaaf1){if(_0x1aaaf1){return _0x1aaaf1['update'](_0x481345)[_0x493c('0x21')](function(_0x1e61c2){return _0x1e61c2;});}return null;};}function removeEntity(_0x4176de,_0x3e7c5d){return function(_0x3ead82){if(_0x3ead82){return _0x3ead82['destroy']()[_0x493c('0x21')](function(){var _0x36b1ff=_0x3ead82[_0x493c('0x33')]({'plain':!![]});var _0xce6562=_0x493c('0x34');return db[_0x493c('0x35')]['destroy']({'where':{'type':_0xce6562,'resourceId':_0x36b1ff['id']}})[_0x493c('0x21')](function(){return _0x3ead82;});})[_0x493c('0x21')](function(){_0x4176de[_0x493c('0x2b')](0xcc)[_0x493c('0x36')]();});}};}function handleEntityNotFound(_0x5f2b92,_0x4a704b){return function(_0x41fe59){if(!_0x41fe59){_0x5f2b92[_0x493c('0x2a')](0x194);}return _0x41fe59;};}function handleError(_0x3cfcfc,_0x42c715){_0x42c715=_0x42c715||0x1f4;return function(_0x23bf2e){logger[_0x493c('0x26')](_0x23bf2e[_0x493c('0x37')]);if(_0x23bf2e[_0x493c('0x38')]){delete _0x23bf2e[_0x493c('0x38')];}_0x3cfcfc['status'](_0x42c715)[_0x493c('0x39')](_0x23bf2e);};}exports['index']=function(_0xe4ce0a,_0x10c5a2){var _0xfc53d6={'include':[{'model':db['Pause'],'as':_0x493c('0x3a')}]},_0x140fad={},_0x1293a2={'count':0x0,'rows':[]};var _0x407b12=_[_0x493c('0x3b')](db['ChatWebsite'][_0x493c('0x3c')],function(_0x11df0e){return{'name':_0x11df0e['fieldName'],'type':_0x11df0e[_0x493c('0x3d')][_0x493c('0x3e')]};});_0x140fad[_0x493c('0x3f')]=_[_0x493c('0x3b')](_0x407b12,_0x493c('0x38'));_0x140fad[_0x493c('0x40')]=_['keys'](_0xe4ce0a['query']);_0x140fad[_0x493c('0x41')]=_[_0x493c('0x42')](_0x140fad[_0x493c('0x3f')],_0x140fad[_0x493c('0x40')]);_0xfc53d6[_0x493c('0x43')]=_[_0x493c('0x42')](_0x140fad[_0x493c('0x3f')],qs[_0x493c('0x44')](_0xe4ce0a['query'][_0x493c('0x44')]));_0xfc53d6[_0x493c('0x43')]=_0xfc53d6[_0x493c('0x43')]['length']?_0xfc53d6['attributes']:_0x140fad[_0x493c('0x3f')];if(!_0xe4ce0a[_0x493c('0x40')][_0x493c('0x45')]('nolimit')){_0xfc53d6['limit']=qs['limit'](_0xe4ce0a['query'][_0x493c('0x2e')]);_0xfc53d6[_0x493c('0x30')]=qs[_0x493c('0x30')](_0xe4ce0a[_0x493c('0x40')][_0x493c('0x30')]);}_0xfc53d6[_0x493c('0x46')]=qs[_0x493c('0x47')](_0xe4ce0a[_0x493c('0x40')][_0x493c('0x47')]);_0xfc53d6[_0x493c('0x48')]=qs['filters'](_[_0x493c('0x49')](_0xe4ce0a[_0x493c('0x40')],_0x140fad[_0x493c('0x41')]),_0x407b12);if(_0xe4ce0a[_0x493c('0x40')][_0x493c('0x4a')]){_0xfc53d6[_0x493c('0x48')]=_[_0x493c('0x4b')](_0xfc53d6[_0x493c('0x48')],{'$or':_[_0x493c('0x3b')](_0x407b12,function(_0x74d470){if(_0x74d470['type']!==_0x493c('0x4c')){var _0x65aa2b={};_0x65aa2b[_0x74d470['name']]={'$like':'%'+_0xe4ce0a[_0x493c('0x40')][_0x493c('0x4a')]+'%'};return _0x65aa2b;}})});}_0xfc53d6=_[_0x493c('0x4b')]({},_0xfc53d6,_0xe4ce0a[_0x493c('0x4d')]);var _0x3c9661={'where':_0xfc53d6[_0x493c('0x48')]};return db[_0x493c('0x4e')][_0x493c('0x2f')](_0x3c9661)['then'](function(_0x50275c){_0x1293a2[_0x493c('0x2f')]=_0x50275c;if(_0xe4ce0a[_0x493c('0x40')][_0x493c('0x4f')]){_0xfc53d6[_0x493c('0x50')]=[{'all':!![]}];}return db[_0x493c('0x4e')][_0x493c('0x51')](_0xfc53d6);})[_0x493c('0x21')](function(_0x51fc6c){_0x1293a2[_0x493c('0x52')]=_0x51fc6c;return _0x1293a2;})[_0x493c('0x21')](respondWithFilteredResult(_0x10c5a2,_0xfc53d6))[_0x493c('0x29')](handleError(_0x10c5a2,null));};exports['show']=function(_0x3cf487,_0x4f626d){var _0x2ab8f7={'raw':![],'where':{'id':_0x3cf487['params']['id']},'include':[{'model':db[_0x493c('0x53')],'as':_0x493c('0x3a')}]},_0x5b8cce={};_0x5b8cce[_0x493c('0x3f')]=_[_0x493c('0x54')](db[_0x493c('0x4e')][_0x493c('0x3c')]);_0x5b8cce[_0x493c('0x40')]=_[_0x493c('0x54')](_0x3cf487[_0x493c('0x40')]);_0x5b8cce[_0x493c('0x41')]=_[_0x493c('0x42')](_0x5b8cce['model'],_0x5b8cce['query']);_0x2ab8f7[_0x493c('0x43')]=_[_0x493c('0x42')](_0x5b8cce[_0x493c('0x3f')],qs[_0x493c('0x44')](_0x3cf487[_0x493c('0x40')]['fields']));_0x2ab8f7[_0x493c('0x43')]=_0x2ab8f7[_0x493c('0x43')][_0x493c('0x55')]?_0x2ab8f7[_0x493c('0x43')]:_0x5b8cce[_0x493c('0x3f')];if(_0x3cf487[_0x493c('0x40')][_0x493c('0x4f')]){_0x2ab8f7[_0x493c('0x50')]=[{'all':!![]}];}_0x2ab8f7=_['merge']({},_0x2ab8f7,_0x3cf487['options']);return db[_0x493c('0x4e')][_0x493c('0x56')](_0x2ab8f7)['then'](handleEntityNotFound(_0x4f626d,null))['then'](respondWithResult(_0x4f626d,null))[_0x493c('0x29')](handleError(_0x4f626d,null));};exports[_0x493c('0x57')]=function(_0x92021a,_0x18fa80){return db[_0x493c('0x4e')]['create'](_0x92021a[_0x493c('0x58')],{})['then'](function(_0x29d2a6){var _0x50da10=_0x92021a[_0x493c('0x59')][_0x493c('0x33')]({'plain':!![]});if(!_0x50da10)throw new Error(_0x493c('0x5a'));if(_0x50da10[_0x493c('0x5b')]===_0x493c('0x59')){var _0x2f9537=_0x29d2a6['get']({'plain':!![]});var _0x106e37='ChatWebsites';return db[_0x493c('0x5c')][_0x493c('0x56')]({'where':{'name':_0x106e37,'userProfileId':_0x50da10['userProfileId']},'raw':!![]})[_0x493c('0x21')](function(_0x2b6fc3){if(_0x2b6fc3&&_0x2b6fc3[_0x493c('0x5d')]===0x0){return db['UserProfileResource'][_0x493c('0x57')]({'name':_0x2f9537[_0x493c('0x38')],'resourceId':_0x2f9537['id'],'type':_0x2b6fc3[_0x493c('0x38')],'sectionId':_0x2b6fc3['id']},{})[_0x493c('0x21')](function(){return _0x29d2a6;});}else{return _0x29d2a6;}})[_0x493c('0x29')](function(_0x3ac7dc){logger[_0x493c('0x26')](_0x493c('0x5e'),_0x3ac7dc);throw _0x3ac7dc;});}return _0x29d2a6;})[_0x493c('0x21')](respondWithResult(_0x18fa80,0xc9))[_0x493c('0x29')](handleError(_0x18fa80,null));};exports[_0x493c('0x5f')]=function(_0x1cbf23,_0x1dc565){if(_0x1cbf23[_0x493c('0x58')]['id']){delete _0x1cbf23[_0x493c('0x58')]['id'];}return db[_0x493c('0x4e')][_0x493c('0x56')]({'where':{'id':_0x1cbf23[_0x493c('0x60')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x493c('0x21')](handleEntityNotFound(_0x1dc565,null))['then'](saveUpdates(_0x1cbf23[_0x493c('0x58')],null))['then'](respondWithResult(_0x1dc565,null))[_0x493c('0x29')](handleError(_0x1dc565,null));};exports[_0x493c('0x61')]=function(_0x1cff76,_0x47d8d0){return db['ChatWebsite'][_0x493c('0x56')]({'where':{'id':_0x1cff76[_0x493c('0x60')]['id']}})['then'](handleEntityNotFound(_0x47d8d0,null))['then'](removeEntity(_0x47d8d0,null))[_0x493c('0x29')](handleError(_0x47d8d0,null));};exports[_0x493c('0x62')]=function(_0x59a25f,_0x1a8efc){return db['ChatWebsite'][_0x493c('0x62')]()['then'](respondWithResult(_0x1a8efc,null))[_0x493c('0x29')](handleError(_0x1a8efc,null));};exports[_0x493c('0x63')]=function(_0x10cf50,_0x306592,_0x12272a){if(_0x10cf50['body']['id']){delete _0x10cf50[_0x493c('0x58')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x10cf50[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x306592,null))[_0x493c('0x21')](function(_0x17d555){if(_0x17d555){_0x10cf50[_0x493c('0x58')]['ChatWebsiteId']=_0x17d555['id'];return db[_0x493c('0x64')][_0x493c('0x57')](_0x10cf50['body']);}})[_0x493c('0x21')](respondWithResult(_0x306592,null))[_0x493c('0x29')](handleError(_0x306592,null));};exports[_0x493c('0x65')]=function(_0x3c7c55,_0x113475,_0x246a18){var _0xe01c37={'raw':![],'where':{}};var _0x120ab0={};var _0x109097={'count':0x0,'rows':[]};return db[_0x493c('0x4e')][_0x493c('0x66')]({'where':{'id':_0x3c7c55[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x113475,null))[_0x493c('0x21')](function(_0x2cf702){if(_0x2cf702){_0x120ab0[_0x493c('0x3f')]=_[_0x493c('0x54')](db['Disposition'][_0x493c('0x3c')]);_0x120ab0[_0x493c('0x40')]=_[_0x493c('0x54')](_0x3c7c55[_0x493c('0x40')]);_0x120ab0[_0x493c('0x41')]=_['intersection'](_0x120ab0[_0x493c('0x3f')],_0x120ab0['query']);_0xe01c37[_0x493c('0x43')]=_[_0x493c('0x42')](_0x120ab0[_0x493c('0x3f')],qs[_0x493c('0x44')](_0x3c7c55['query']['fields']));_0xe01c37['attributes']=_0xe01c37['attributes']['length']?_0xe01c37[_0x493c('0x43')]:_0x120ab0['model'];if(!_0x3c7c55[_0x493c('0x40')][_0x493c('0x45')](_0x493c('0x67'))){_0xe01c37[_0x493c('0x2e')]=qs[_0x493c('0x2e')](_0x3c7c55[_0x493c('0x40')]['limit']);_0xe01c37[_0x493c('0x30')]=qs['offset'](_0x3c7c55[_0x493c('0x40')][_0x493c('0x30')]);}_0xe01c37[_0x493c('0x46')]=qs['sort'](_0x3c7c55[_0x493c('0x40')][_0x493c('0x47')]);_0xe01c37[_0x493c('0x48')]=qs['filters'](_['pick'](_0x3c7c55[_0x493c('0x40')],_0x120ab0[_0x493c('0x41')]));_0xe01c37[_0x493c('0x48')][_0x493c('0x68')]=_0x2cf702['id'];if(_0x3c7c55['query']['filter']){_0xe01c37[_0x493c('0x48')]=_[_0x493c('0x4b')](_0xe01c37[_0x493c('0x48')],{'$or':_[_0x493c('0x3b')](_0xe01c37[_0x493c('0x43')],function(_0x44a57b){var _0x349cc3={};_0x349cc3[_0x44a57b]={'$like':'%'+_0x3c7c55[_0x493c('0x40')][_0x493c('0x4a')]+'%'};return _0x349cc3;})});}_0xe01c37=_['merge']({},_0xe01c37,_0x3c7c55['options']);return db[_0x493c('0x64')][_0x493c('0x2f')]({'where':_0xe01c37['where']})[_0x493c('0x21')](function(_0x500763){_0x109097['count']=_0x500763;if(_0x3c7c55[_0x493c('0x40')][_0x493c('0x4f')]){_0xe01c37[_0x493c('0x50')]=[{'all':!![]}];}return db[_0x493c('0x64')][_0x493c('0x51')](_0xe01c37);})['then'](function(_0x4fb277){_0x109097[_0x493c('0x52')]=_0x4fb277;return _0x109097;});}})[_0x493c('0x21')](respondWithFilteredResult(_0x113475,_0xe01c37))['catch'](handleError(_0x113475,null));};exports[_0x493c('0x69')]=function(_0x28d14f,_0x4aee79,_0x11bea6){return db[_0x493c('0x4e')][_0x493c('0x56')]({'where':{'id':_0x28d14f['params']['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x4aee79,null))['then'](function(_0x594565){if(_0x594565){return _0x594565[_0x493c('0x69')](_0x28d14f['query']['ids']);}})[_0x493c('0x21')](respondWithStatusCode(_0x4aee79,null))[_0x493c('0x29')](handleError(_0x4aee79,null));};exports[_0x493c('0x6a')]=function(_0x24fefb,_0x5973c2,_0x40e550){if(_0x24fefb[_0x493c('0x58')]['id']){delete _0x24fefb['body']['id'];}return db[_0x493c('0x4e')][_0x493c('0x56')]({'where':{'id':_0x24fefb[_0x493c('0x60')]['id']}})['then'](handleEntityNotFound(_0x5973c2,null))['then'](function(_0x31f1d2){if(_0x31f1d2){_0x24fefb[_0x493c('0x58')][_0x493c('0x68')]=_0x31f1d2['id'];return db[_0x493c('0x6b')][_0x493c('0x57')](_0x24fefb[_0x493c('0x58')]);}})[_0x493c('0x21')](respondWithResult(_0x5973c2,null))[_0x493c('0x29')](handleError(_0x5973c2,null));};exports[_0x493c('0x6c')]=function(_0x4082a4,_0x3ae094,_0x54fb8a){var _0x3ea62f={'raw':![],'where':{}};var _0x589590={};var _0x5077e2={'count':0x0,'rows':[]};return db[_0x493c('0x4e')][_0x493c('0x66')]({'where':{'id':_0x4082a4[_0x493c('0x60')]['id']}})['then'](handleEntityNotFound(_0x3ae094,null))[_0x493c('0x21')](function(_0x1282b3){if(_0x1282b3){_0x589590[_0x493c('0x3f')]=_['keys'](db[_0x493c('0x6b')]['rawAttributes']);_0x589590[_0x493c('0x40')]=_[_0x493c('0x54')](_0x4082a4[_0x493c('0x40')]);_0x589590[_0x493c('0x41')]=_[_0x493c('0x42')](_0x589590[_0x493c('0x3f')],_0x589590[_0x493c('0x40')]);_0x3ea62f[_0x493c('0x43')]=_['intersection'](_0x589590['model'],qs[_0x493c('0x44')](_0x4082a4['query'][_0x493c('0x44')]));_0x3ea62f['attributes']=_0x3ea62f['attributes'][_0x493c('0x55')]?_0x3ea62f[_0x493c('0x43')]:_0x589590[_0x493c('0x3f')];if(!_0x4082a4[_0x493c('0x40')][_0x493c('0x45')](_0x493c('0x67'))){_0x3ea62f[_0x493c('0x2e')]=qs[_0x493c('0x2e')](_0x4082a4['query'][_0x493c('0x2e')]);_0x3ea62f[_0x493c('0x30')]=qs[_0x493c('0x30')](_0x4082a4[_0x493c('0x40')]['offset']);}_0x3ea62f[_0x493c('0x46')]=qs['sort'](_0x4082a4[_0x493c('0x40')]['sort']);_0x3ea62f['where']=qs[_0x493c('0x41')](_[_0x493c('0x49')](_0x4082a4[_0x493c('0x40')],_0x589590[_0x493c('0x41')]));_0x3ea62f['where'][_0x493c('0x68')]=_0x1282b3['id'];if(_0x4082a4[_0x493c('0x40')][_0x493c('0x4a')]){_0x3ea62f[_0x493c('0x48')]=_[_0x493c('0x4b')](_0x3ea62f[_0x493c('0x48')],{'$or':_[_0x493c('0x3b')](_0x3ea62f[_0x493c('0x43')],function(_0x4d9bb4){var _0x3a3e3d={};_0x3a3e3d[_0x4d9bb4]={'$like':'%'+_0x4082a4[_0x493c('0x40')][_0x493c('0x4a')]+'%'};return _0x3a3e3d;})});}_0x3ea62f=_[_0x493c('0x4b')]({},_0x3ea62f,_0x4082a4[_0x493c('0x4d')]);return db[_0x493c('0x6b')][_0x493c('0x2f')]({'where':_0x3ea62f[_0x493c('0x48')]})[_0x493c('0x21')](function(_0x4dd0c5){_0x5077e2[_0x493c('0x2f')]=_0x4dd0c5;if(_0x4082a4[_0x493c('0x40')][_0x493c('0x4f')]){_0x3ea62f[_0x493c('0x50')]=[{'all':!![]}];}return db[_0x493c('0x6b')][_0x493c('0x51')](_0x3ea62f);})[_0x493c('0x21')](function(_0x9afb59){_0x5077e2[_0x493c('0x52')]=_0x9afb59;return _0x5077e2;});}})[_0x493c('0x21')](respondWithFilteredResult(_0x3ae094,_0x3ea62f))[_0x493c('0x29')](handleError(_0x3ae094,null));};exports[_0x493c('0x6d')]=function(_0xa9df3e,_0x3de19f,_0xc27e65){return db[_0x493c('0x4e')][_0x493c('0x56')]({'where':{'id':_0xa9df3e['params']['id']}})['then'](handleEntityNotFound(_0x3de19f,null))['then'](function(_0x1d4a06){if(_0x1d4a06){return _0x1d4a06[_0x493c('0x6d')](_0xa9df3e['query'][_0x493c('0x6e')]);}})['then'](respondWithStatusCode(_0x3de19f,null))[_0x493c('0x29')](handleError(_0x3de19f,null));};exports[_0x493c('0x6f')]=function(_0x5c72e6,_0x4de7b0,_0x3bee36){_0x5c72e6['body']['sitepic']=_0x5c72e6[_0x493c('0x70')][_0x493c('0x71')];return db[_0x493c('0x4e')][_0x493c('0x56')]({'where':{'id':_0x5c72e6[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x4de7b0,null))[_0x493c('0x21')](saveUpdates(_0x5c72e6[_0x493c('0x58')],null))[_0x493c('0x21')](respondWithResult(_0x4de7b0,null))[_0x493c('0x29')](handleError(_0x4de7b0,null));};exports[_0x493c('0x72')]=function(_0x2260e0,_0x59664e,_0xb6cd0f){_0x2260e0['body']['agentAvatar']=_0x2260e0[_0x493c('0x70')]['filename'];return db['ChatWebsite'][_0x493c('0x56')]({'where':{'id':_0x2260e0[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x59664e,null))[_0x493c('0x21')](saveUpdates(_0x2260e0[_0x493c('0x58')],null))[_0x493c('0x21')](respondWithResult(_0x59664e,null))[_0x493c('0x29')](handleError(_0x59664e,null));};exports[_0x493c('0x73')]=function(_0x566beb,_0x39f6f0,_0x11aef2){_0x566beb[_0x493c('0x58')]['customerAvatar']=_0x566beb[_0x493c('0x70')][_0x493c('0x71')];return db[_0x493c('0x4e')][_0x493c('0x56')]({'where':{'id':_0x566beb[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x39f6f0,null))['then'](saveUpdates(_0x566beb[_0x493c('0x58')],null))[_0x493c('0x21')](respondWithResult(_0x39f6f0,null))[_0x493c('0x29')](handleError(_0x39f6f0,null));};exports[_0x493c('0x74')]=function(_0x4ee109,_0x287f3c,_0x85c8f){_0x4ee109[_0x493c('0x58')]['systemAvatar']=_0x4ee109['file']['filename'];return db[_0x493c('0x4e')][_0x493c('0x56')]({'where':{'id':_0x4ee109[_0x493c('0x60')]['id']}})['then'](handleEntityNotFound(_0x287f3c,null))[_0x493c('0x21')](saveUpdates(_0x4ee109[_0x493c('0x58')],null))[_0x493c('0x21')](respondWithResult(_0x287f3c,null))[_0x493c('0x29')](handleError(_0x287f3c,null));};exports[_0x493c('0x75')]=function(_0x3cd826,_0x2c0654,_0xac2cb9){var _0x596a02=path[_0x493c('0x76')](config['root'],_0x493c('0x77'));var _0x10f4fd={'where':{'id':_0x3cd826[_0x493c('0x60')]['id']},'attributes':['id',_0x493c('0x78')],'raw':!![]};var _0x2c6f74=![];return require(_0x493c('0x79'))['getLicense']()[_0x493c('0x21')](function(_0x399668){if(_0x399668){_0x2c6f74=_0x399668['custom'];}})[_0x493c('0x21')](function(){return db['ChatWebsite'][_0x493c('0x56')](_0x10f4fd);})['then'](handleEntityNotFound(_0x2c0654,null))['then'](function(_0x13cdf6){if(_0x13cdf6){if(!_[_0x493c('0x7a')](_0x13cdf6[_0x493c('0x78')])){if(fs['existsSync'](path[_0x493c('0x76')](config[_0x493c('0x7b')],_0x493c('0x7c'),_0x13cdf6[_0x493c('0x78')]))&&_0x2c6f74){_0x596a02=path['join'](config[_0x493c('0x7b')],_0x493c('0x7c'),_0x13cdf6[_0x493c('0x78')]);}}return _0x2c0654[_0x493c('0x7d')](_0x596a02);}})[_0x493c('0x29')](handleError(_0x2c0654,null));};exports[_0x493c('0x7e')]=function(_0x5ad92b,_0x2a09d5,_0x5608eb){var _0x1da6f6=path[_0x493c('0x76')](config[_0x493c('0x7b')],'server/files/images/avatars/default_avatar.png');var _0x852d0f={'where':{'id':_0x5ad92b[_0x493c('0x60')]['id']},'attributes':['id',_0x493c('0x7f')],'raw':!![]};return db[_0x493c('0x4e')][_0x493c('0x56')](_0x852d0f)[_0x493c('0x21')](handleEntityNotFound(_0x2a09d5,null))['then'](function(_0x1cda2d){if(_0x1cda2d){if(!_[_0x493c('0x7a')](_0x1cda2d[_0x493c('0x7f')])){if(fs[_0x493c('0x80')](path[_0x493c('0x76')](config['root'],_0x493c('0x81'),_0x1cda2d[_0x493c('0x7f')]))){_0x1da6f6=path['join'](config['root'],_0x493c('0x81'),_0x1cda2d[_0x493c('0x7f')]);}}return _0x2a09d5['download'](_0x1da6f6);}})['catch'](handleError(_0x2a09d5,null));};exports[_0x493c('0x82')]=function(_0x200a33,_0x41388b,_0x38e971){var _0x2954f0=path[_0x493c('0x76')](config[_0x493c('0x7b')],_0x493c('0x83'));var _0x16d44c={'where':{'id':_0x200a33['params']['id']},'attributes':['id',_0x493c('0x84'),_0x493c('0x85')],'raw':!![]};return db[_0x493c('0x4e')][_0x493c('0x56')](_0x16d44c)[_0x493c('0x21')](handleEntityNotFound(_0x41388b,null))['then'](function(_0x3b3d07){if(_0x3b3d07){if(!_[_0x493c('0x7a')](_0x3b3d07['customerAvatar'])){if(fs[_0x493c('0x80')](path[_0x493c('0x76')](config['root'],_0x493c('0x81'),_0x3b3d07[_0x493c('0x84')]))&&_0x3b3d07[_0x493c('0x85')]){_0x2954f0=path[_0x493c('0x76')](config[_0x493c('0x7b')],_0x493c('0x81'),_0x3b3d07['customerAvatar']);}}return _0x41388b['download'](_0x2954f0);}})[_0x493c('0x29')](handleError(_0x41388b,null));};exports[_0x493c('0x86')]=function(_0x34d88c,_0x5ba2b5,_0x155026){var _0x5b5a1e=path[_0x493c('0x76')](config['root'],_0x493c('0x87'));var _0x7188c0={'where':{'id':_0x34d88c[_0x493c('0x60')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x493c('0x4e')][_0x493c('0x56')](_0x7188c0)[_0x493c('0x21')](handleEntityNotFound(_0x5ba2b5,null))[_0x493c('0x21')](function(_0x164cc9){if(_0x164cc9){if(!_[_0x493c('0x7a')](_0x164cc9[_0x493c('0x88')])){if(fs[_0x493c('0x80')](path['join'](config[_0x493c('0x7b')],_0x493c('0x81'),_0x164cc9[_0x493c('0x88')]))){_0x5b5a1e=path[_0x493c('0x76')](config['root'],_0x493c('0x81'),_0x164cc9['systemAvatar']);}}return _0x5ba2b5[_0x493c('0x7d')](_0x5b5a1e);}})[_0x493c('0x29')](handleError(_0x5ba2b5,null));};exports['notify']=function(_0x5700f1,_0x39821a,_0x440fed){var _0x1e7818=require(_0x493c('0x89'));var _0x27c837=new _0x1e7818();var _0x1028c1=_0x27c837[_0x493c('0x8a')](_0x5700f1[_0x493c('0x8b')]['user-agent'])['getResult']();var _0x1ff9fb={'body':_0x5700f1[_0x493c('0x58')],'channel':'chat'};var _0x4363c1=[];var _0x2e1f4d=[];var _0x169e17={};var _0x5994ae=![];return db[_0x493c('0x8c')][_0x493c('0x62')]()['then'](function(_0x534ea5){if(!_0x534ea5){throw new db['Sequelize']['ValidationError'](_0x493c('0x8d'));}_0x4363c1=_['difference'](_[_0x493c('0x54')](_0x534ea5),['createdAt',_0x493c('0x8e')]);_0x2e1f4d=_[_0x493c('0x8f')](_[_0x493c('0x54')](_0x534ea5),[_0x493c('0x90'),_0x493c('0x8e'),'CompanyId','ListId']);if(_0x5700f1[_0x493c('0x58')]['id']){delete _0x5700f1[_0x493c('0x58')]['id'];}if(_[_0x493c('0x7a')](_0x5700f1[_0x493c('0x58')][_0x493c('0x91')])){throw new db[(_0x493c('0x92'))][(_0x493c('0x93'))](_0x493c('0x94'));}if(_['isNil'](_0x5700f1[_0x493c('0x58')]['body'])||_0x5700f1[_0x493c('0x58')]['body']===''){throw new db[(_0x493c('0x92'))]['ValidationError'](_0x493c('0x95'));}if(_[_0x493c('0x7a')](_0x5700f1[_0x493c('0x58')][_0x493c('0x96')])){throw new db[(_0x493c('0x92'))][(_0x493c('0x93'))](_0x493c('0x97')+_0x2e1f4d);}if(!_[_0x493c('0x98')](_0x2e1f4d,_0x5700f1[_0x493c('0x58')][_0x493c('0x96')])){throw new db[(_0x493c('0x92'))][(_0x493c('0x93'))](_0x493c('0x99')+_0x2e1f4d);}_0x169e17[_0x5700f1[_0x493c('0x58')]['mapKey']]=_0x5700f1['body'][_0x493c('0x91')];})[_0x493c('0x21')](function(){return db[_0x493c('0x4e')]['find']({'where':{'id':_0x5700f1['params']['id']},'include':[{'model':db[_0x493c('0x9a')],'as':_0x493c('0x9b'),'include':[{'model':db[_0x493c('0x8c')],'as':_0x493c('0x9c'),'where':_0x169e17,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['ChatApplication'],'as':_0x493c('0x9d')}]});})[_0x493c('0x21')](handleEntityNotFound(_0x39821a,null))[_0x493c('0x21')](function(_0x21afed){if(_0x21afed&&_0x21afed[_0x493c('0x9b')]){_0x1ff9fb[_0x493c('0x9e')]=_0x21afed;_0x1ff9fb[_0x493c('0x9f')]=_0x21afed['Applications'];_0x1ff9fb['list']=_0x21afed[_0x493c('0x9b')];_0x1ff9fb[_0x493c('0x9f')]=_[_0x493c('0xa0')](_0x1ff9fb[_0x493c('0x9f')],[_0x493c('0xa1')],[_0x493c('0xa2')]);if(_0x1ff9fb[_0x493c('0x9e')][_0x493c('0x9d')]){delete _0x1ff9fb[_0x493c('0x9e')][_0x493c('0x9d')];}if(_0x1ff9fb['account'][_0x493c('0x9b')]&&_0x1ff9fb[_0x493c('0x9e')][_0x493c('0x9b')][_0x493c('0x9c')][_0x493c('0x55')]){return _0x1ff9fb[_0x493c('0x9e')][_0x493c('0x9b')][_0x493c('0x9c')][0x0];}var _0x4dfb7e=_[_0x493c('0x18')](_0x5700f1[_0x493c('0x58')],{'firstName':_0x5700f1[_0x493c('0x58')][_0x493c('0x91')],'ListId':_0x21afed[_0x493c('0xa3')]});_0x4dfb7e[_0x5700f1['body'][_0x493c('0x96')]]=_0x5700f1['body']['from'];return db['CmContact'][_0x493c('0x57')](_0x4dfb7e,{'fields':_0x4363c1,'raw':!![]});}})['then'](handleEntityNotFound(_0x39821a,null))[_0x493c('0x21')](function(_0x13df01){_0x1ff9fb[_0x493c('0xa4')]=_0x13df01;var _0x7f0cfa=_0x5700f1['body'][_0x493c('0xa5')];if(_0x5700f1[_0x493c('0x8b')][_0x493c('0xa6')]){_0x7f0cfa=_0x5700f1[_0x493c('0x8b')][_0x493c('0xa6')];}else if(_0x5700f1[_0x493c('0x8b')][_0x493c('0xa7')]){_0x7f0cfa=_[_0x493c('0xa8')](_0x5700f1[_0x493c('0x8b')][_0x493c('0xa7')][_0x493c('0xa9')](','));}if(_0x13df01){var _0x49a97e={'ContactId':_0x13df01['id'],'ChatWebsiteId':_0x5700f1[_0x493c('0x60')]['id'],'from':(_0x13df01[_0x493c('0xaa')]||'')+'\x20'+(_0x13df01[_0x493c('0xab')]||''),'customerIp':_0x7f0cfa,'customerPort':_0x5700f1[_0x493c('0x8b')][_0x493c('0xac')]?_0x5700f1['headers'][_0x493c('0xac')]:null,'referer':_0x5700f1[_0x493c('0x58')]['referer'],'browserName':_0x1028c1[_0x493c('0xad')][_0x493c('0x38')]&&_0x1028c1[_0x493c('0xad')][_0x493c('0xae')]?util[_0x493c('0xaf')](_0x493c('0xb0'),_0x1028c1[_0x493c('0xad')]['name'],_0x1028c1['browser'][_0x493c('0xae')]):_0x493c('0xb1'),'browserVersion':_0x1028c1[_0x493c('0xad')][_0x493c('0xae')]||_0x493c('0xb1'),'osName':util[_0x493c('0xaf')](_0x493c('0xb0'),_0x1028c1['os'][_0x493c('0x38')],_0x1028c1['os']['version']),'osVersion':_0x1028c1['os']['version'],'deviceModel':_0x1028c1[_0x493c('0xb2')]['model']&&_0x1028c1[_0x493c('0xb2')][_0x493c('0xb3')]?util[_0x493c('0xaf')](_0x493c('0xb4'),_0x1028c1[_0x493c('0xb2')][_0x493c('0x3f')],_0x1028c1['device'][_0x493c('0xb3')],_0x1028c1['device']['type']):null,'deviceVendor':_0x1028c1[_0x493c('0xb2')][_0x493c('0xb3')],'deviceType':_0x1028c1['device']['type'],'formData':JSON['stringify'](_0x5700f1[_0x493c('0x58')])};var _0x824453={'ChatWebsiteId':_0x5700f1[_0x493c('0x60')]['id'],'closed':![]};if(_0x5700f1[_0x493c('0x58')][_0x493c('0xb5')]){_0x824453[_0x493c('0xb5')]=_0x5700f1[_0x493c('0x58')]['threadId'];return db[_0x493c('0xb6')][_0x493c('0x56')]({'where':_0x824453})[_0x493c('0x21')](function(_0x1d1e36){if(_0x1d1e36){return[_0x1d1e36,![]];}_0x49a97e[_0x493c('0xb5')]=_0x5700f1[_0x493c('0x58')][_0x493c('0xb5')];_0x49a97e['externalUrl']=_0x5700f1['body'][_0x493c('0xb7')];return db['ChatInteraction'][_0x493c('0x57')](_0x49a97e)['then'](function(_0x86eb56){return[_0x86eb56,!![]];});});}_0x824453[_0x493c('0xb8')]=_0x13df01['id'];if(_0x5700f1[_0x493c('0x58')][_0x493c('0xb9')]&&_0x5700f1[_0x493c('0x58')][_0x493c('0xb9')]['id']){_0x824453['id']=_0x5700f1['body']['interaction']['id'];return db['ChatInteraction'][_0x493c('0x56')]({'where':_0x824453})[_0x493c('0x21')](function(_0x4531b5){if(_0x4531b5){return[_0x4531b5,![]];}return db['ChatInteraction']['create'](_0x49a97e)[_0x493c('0x21')](function(_0x3f49e1){return[_0x3f49e1,!![]];});});}return db[_0x493c('0xb6')][_0x493c('0x57')](_0x49a97e)['then'](function(_0x4930b0){return[_0x4930b0,!![]];});}})[_0x493c('0xba')](function(_0x45ebcf,_0x593866){if(_0x45ebcf){_0x5994ae=_0x593866;if(!_0x593866){var _0x12f152={'from':(_0x1ff9fb[_0x493c('0xa4')][_0x493c('0xaa')]||'')+'\x20'+(_0x1ff9fb[_0x493c('0xa4')][_0x493c('0xab')]||'')};if(_0x5700f1['body'][_0x493c('0xb5')]&&_0x5700f1['body'][_0x493c('0xbb')]&&_0x5700f1[_0x493c('0x58')][_0x493c('0xb5')]!=_0x5700f1[_0x493c('0x58')][_0x493c('0xbb')]){_0x12f152[_0x493c('0xb5')]=_0x5700f1[_0x493c('0x58')][_0x493c('0xbb')];}return _0x45ebcf[_0x493c('0x5f')](_0x12f152);}else{return _0x45ebcf;}}})[_0x493c('0x21')](function(_0x2daa2b){_0x1ff9fb[_0x493c('0xb9')]=_0x2daa2b[_0x493c('0x33')]({'plain':!![]});_0x1ff9fb['interaction'][_0x493c('0xbc')]=_0x5994ae;if(_0x1ff9fb[_0x493c('0xb9')][_0x493c('0xbc')]){if(_0x1ff9fb[_0x493c('0x9e')][_0x493c('0xbd')]){_0x1ff9fb[_0x493c('0x9f')][_0x493c('0xbe')]({'id':0x0,'priority':_0x1ff9fb[_0x493c('0x9f')][_0x493c('0x55')]+0x1,'app':_0x493c('0xbf'),'appdata':_0x493c('0xc0'),'interval':_0x493c('0xc1')});}}return db['ChatMessage']['create']({'body':_0x5700f1[_0x493c('0x58')][_0x493c('0x58')],'ChatWebsiteId':_0x5700f1[_0x493c('0x60')]['id'],'ChatInteractionId':_0x2daa2b['id'],'direction':'in','ContactId':_0x1ff9fb['contact']['id'],'AttachmentId':_0x5700f1['body'][_0x493c('0xc2')]});})['then'](function(_0x473b89){_0x1ff9fb[_0x493c('0x27')]=_0x473b89;if(_0x1ff9fb['interaction'][_0x493c('0xc3')]){return db[_0x493c('0xc4')]['find']({'attributes':['id','name'],'where':{'id':_0x1ff9fb[_0x493c('0xb9')][_0x493c('0xc3')]}})[_0x493c('0x21')](function(_0x38753c){if(_0x38753c){_0x1ff9fb['applications'][_0x493c('0xc5')]({'id':0x0,'priority':0x0,'app':_0x493c('0xc6'),'appdata':_0x38753c[_0x493c('0x38')]+','+(_0x1ff9fb[_0x493c('0x9e')][_0x493c('0xc7')]||0xa),'interval':_0x493c('0xc1')});_0x1ff9fb[_0x493c('0xc8')]=!![];}return respondWithRpcPromise(_0x493c('0xc9'),'startRouting',_0x1ff9fb);});}return respondWithRpcPromise(_0x493c('0xc9'),_0x493c('0xca'),_0x1ff9fb);})['then'](function(_0x32a95c){respondWithRpcPromise(_0x493c('0xcb'),_0x493c('0xcb'),{'event':'notify','message':_0x32a95c},client9002);return _0x32a95c;})[_0x493c('0x21')](respondWithResult(_0x39821a,null))['catch'](handleError(_0x39821a,null));};exports[_0x493c('0xcc')]=function(_0x19bbb1,_0x78dbda,_0x1edd01){var _0x3e7c87,_0x59af64,_0x458657;var _0x438c2a=[];var _0x50a5c4=[];var _0x9d1d9e={};var _0x5f25f9=_0x19bbb1[_0x493c('0xcd')]||[];var _0x21b2e7=[];var _0x2b6e3e;return db[_0x493c('0x8c')][_0x493c('0x62')]()[_0x493c('0x21')](function(_0x2dee4e){if(!_0x2dee4e){throw new db[(_0x493c('0x92'))][(_0x493c('0x93'))]('no\x20available\x20attributes');}_0x50a5c4=_[_0x493c('0x8f')](_[_0x493c('0x54')](_0x2dee4e),[_0x493c('0x90'),_0x493c('0x8e')]);_0x438c2a=_['difference'](_[_0x493c('0x54')](_0x2dee4e),[_0x493c('0x90'),'updatedAt',_0x493c('0xce'),_0x493c('0xa3')]);if(_0x19bbb1[_0x493c('0x58')]['id']){delete _0x19bbb1[_0x493c('0x58')]['id'];}if(_['isNil'](_0x19bbb1[_0x493c('0x58')][_0x493c('0x91')])){throw _0x78dbda[_0x493c('0x2b')](0x1f4)[_0x493c('0x39')](new db[(_0x493c('0x92'))][(_0x493c('0x93'))](_0x493c('0x94')));}if(_['isNil'](_0x19bbb1['body']['body'])||_0x19bbb1[_0x493c('0x58')][_0x493c('0x58')]===''){throw _0x78dbda[_0x493c('0x2b')](0x1f4)[_0x493c('0x39')](new db['Sequelize'][(_0x493c('0x93'))](_0x493c('0x95')));}if(_['isNil'](_0x19bbb1[_0x493c('0x58')]['mapKeyOffline'])){throw _0x78dbda['status'](0x1f4)[_0x493c('0x39')](new db['Sequelize'][(_0x493c('0x93'))](_0x493c('0xcf')+_0x438c2a));}if(!_['includes'](_0x438c2a,_0x19bbb1['body'][_0x493c('0xd0')])){throw _0x78dbda[_0x493c('0x2b')](0x1f4)[_0x493c('0x39')](new db[(_0x493c('0x92'))][(_0x493c('0x93'))](_0x493c('0xd1')+_0x438c2a));}_0x9d1d9e[_0x19bbb1[_0x493c('0x58')][_0x493c('0xd0')]]=_0x19bbb1[_0x493c('0x58')][_0x493c('0x91')];})[_0x493c('0x21')](function(){return db[_0x493c('0x4e')]['find']({'where':{'id':_0x19bbb1['params']['id']},'include':[{'model':db[_0x493c('0x9a')],'as':_0x493c('0x9b')},{'model':db[_0x493c('0xd2')],'as':_0x493c('0xd2')}]});})[_0x493c('0x21')](handleEntityNotFound(_0x78dbda,null))[_0x493c('0x21')](function(_0x5a14d9){if(_0x5a14d9&&_0x5a14d9[_0x493c('0x9b')]){_0x59af64=_0x5a14d9;var _0x48fd9d=_[_0x493c('0x18')](_0x19bbb1['body'],{'firstName':_0x19bbb1[_0x493c('0x58')][_0x493c('0x91')],'phone':_0x19bbb1[_0x493c('0x58')]['from'],'ListId':_0x5a14d9[_0x493c('0xa3')]});_0x48fd9d[_0x19bbb1[_0x493c('0x58')][_0x493c('0xd0')]]=_0x19bbb1[_0x493c('0x58')][_0x493c('0x91')];return db[_0x493c('0x8c')][_0x493c('0xd3')]({'where':_0x9d1d9e,'defaults':_0x48fd9d});}})[_0x493c('0xba')](function(_0x889ffb){if(_0x889ffb){_0x458657=_0x889ffb;var _0xfe3a49=fs['readFileSync'](path[_0x493c('0x76')](config[_0x493c('0x7b')],_0x493c('0xd4')),_0x493c('0xd5'));var _0x50fbec=ejs[_0x493c('0xd6')](_0xfe3a49,{'body':_[_0x493c('0xd7')](_0x19bbb1[_0x493c('0x58')][_0x493c('0x58')]),'bodyTitle':_0x59af64[_0x493c('0xd8')]});return db[_0x493c('0xd9')][_0x493c('0x57')]({'body':_0x50fbec,'ContactId':_0x889ffb['id'],'ChatWebsiteId':_0x59af64['id']});}})[_0x493c('0x21')](function(_0x3fe5a4){_0x2b6e3e=_0x3fe5a4;if(_0x5f25f9['length']){var _0x5f2ccf=_0x5f25f9['map'](function(_0x59f60d){return{'name':_0x59f60d[_0x493c('0xda')],'basename':_0x59f60d[_0x493c('0x71')],'type':_0x59f60d['mimetype'],'ChatOfflineMessageId':_0x3fe5a4['id']};});_0x21b2e7=_0x5f2ccf[_0x493c('0x3b')](_0x25db40=>{var _0x4a14eb={'filename':_0x25db40['name'],'path':path[_0x493c('0x76')](config['root'],_0x493c('0xdb'),_0x493c('0xcd'),_0x493c('0xdc'),'offline-chat',_0x25db40[_0x493c('0xdd')])};return _0x4a14eb;});if(!_0x59af64['openNewInteraction']){return db[_0x493c('0xde')][_0x493c('0xdf')](function(_0x33bbe3){return db[_0x493c('0xe0')]['bulkCreate'](_0x5f2ccf,{'transaction':_0x33bbe3});});}}})[_0x493c('0x21')](function(){if(_0x2b6e3e){_0x3e7c87=_0x2b6e3e;return db[_0x493c('0xd2')][_0x493c('0x66')]({'where':{'active':!![]},'include':[{'model':db[_0x493c('0xe1')],'as':_0x493c('0xe2'),'raw':!![]}]});}})['then'](function(_0x3ed42e){if(_0x3ed42e&&_0x3ed42e[_0x493c('0xe2')]&&_0x59af64[_0x493c('0xe3')]&&_0x59af64[_0x493c('0xe4')]){var _0x112341={'tls':{'rejectUnauthorized':![]}};if(_0x3ed42e[_0x493c('0xe2')][_0x493c('0xe5')]){_0x112341[_0x493c('0xe5')]=_0x3ed42e[_0x493c('0xe2')]['service'];}else{_0x112341[_0x493c('0xe6')]=_0x3ed42e[_0x493c('0xe2')][_0x493c('0xe6')];_0x112341[_0x493c('0xe7')]=_0x3ed42e['Smtp']['port'];_0x112341['secure']=_0x3ed42e[_0x493c('0xe2')]['secure'];}if(_0x3ed42e[_0x493c('0xe2')][_0x493c('0xe8')]){_0x112341[_0x493c('0xe9')]={'user':_0x3ed42e[_0x493c('0xe2')][_0x493c('0x59')],'pass':_0x3ed42e[_0x493c('0xe2')][_0x493c('0xea')]};}return respondWithRpcPromise(_0x493c('0xeb'),_0x493c('0xec'),{'account':_0x112341,'message':{'from':util[_0x493c('0xaf')](_0x493c('0xed'),_0x3ed42e[_0x493c('0x38')],_0x3ed42e[_0x493c('0xee')]||_0x3ed42e[_0x493c('0xe2')][_0x493c('0x59')]),'to':_0x59af64[_0x493c('0xe4')],'subject':_0x59af64[_0x493c('0xef')],'html':_0x3e7c87[_0x493c('0x58')],'attachments':_0x21b2e7}},client9003)['then'](function(){return _0x3e7c87;})[_0x493c('0x29')](function(_0x446717){console[_0x493c('0x26')](_0x446717);});}})[_0x493c('0x21')](function(){if(_0x59af64&&_0x59af64[_0x493c('0xf0')]&&_0x59af64[_0x493c('0xf1')]){var _0x2a43cb=[];if(_0x5f25f9[_0x493c('0x55')]){_0x2a43cb=_0x5f25f9[_0x493c('0x3b')](function(_0x13eddd){return{'name':_0x13eddd[_0x493c('0xda')],'basename':_0x13eddd[_0x493c('0x71')],'type':_0x13eddd[_0x493c('0xf2')],'ChatOfflineMessageId':_0x2b6e3e['id']};});}var _0x38baf6;if(!_[_0x493c('0x7a')](_0x59af64[_0x493c('0xf3')])){var _0x2a92bc=_[_0x493c('0x3b')](_0x19bbb1[_0x493c('0x58')],function(_0x19d1db){return _0x19d1db;});var _0x4532b1=_[_0x493c('0xf4')](_0x2a92bc)[0x0];var _0x152d10=_['mapValues'](_0x4532b1,function(_0x2a4917){return _0x2a4917;});_0x38baf6=_0x152d10[0x1][_0x59af64[_0x493c('0xf3')]];}var _0x3d6d16={'from':_0x458657['email'],'firstName':_0x458657[_0x493c('0xaa')],'lastName':_0x458657[_0x493c('0xab')],'mapKey':_0x493c('0xee'),'message':{'from':_0x458657[_0x493c('0xee')],'to':_0x59af64[_0x493c('0xd2')][_0x493c('0xee')],'cc':'','subject':_[_0x493c('0x7a')](_0x38baf6)?_0x59af64[_0x493c('0xef')]:_0x38baf6,'messageId':'','sentAt':new Date(),'attach':_0x2a43cb['length'],'attachments':_0x2a43cb,'originChannel':_0x493c('0xf5'),'ChatWebsiteId':_0x59af64['id'],'ChatOfflineMessageId':_0x3e7c87['id'],'originTo':_0x59af64[_0x493c('0xd2')]['email']},'body':_0x3e7c87[_0x493c('0x58')]};var _0x158a31={'account':{'id':_0x59af64[_0x493c('0xf1')]},'body':_0x3d6d16,'log':_0x493c('0xf6')};return respondWithRpcPromise(_0x493c('0xf6'),_0x493c('0xf7'),_0x158a31,client9001)['then'](function(){return _0x3e7c87;})[_0x493c('0x29')](function(_0x27bd9a){console[_0x493c('0x26')](_0x27bd9a);});}return;})[_0x493c('0x21')](function(){if(_0x3e7c87){return _0x3e7c87;}})['then'](respondWithResult(_0x78dbda,null))[_0x493c('0x29')](function(_0x3cb34c){console[_0x493c('0x26')](_0x493c('0x29'),_0x3cb34c);for(var _0x17635b of _0x5f25f9){var _0x2cee33=path[_0x493c('0x76')](config[_0x493c('0x7b')],_0x493c('0xdb'),_0x493c('0xcd'),_0x493c('0xdc'),'offline-chat',_0x17635b[_0x493c('0x71')]);fs_extra[_0x493c('0xf8')](_0x2cee33)['catch'](function(_0x8ec41a){console['error'](_0x493c('0xf9'),_0x2cee33,_0x8ec41a);});}});};exports['addInteraction']=function(_0x50905c,_0x4960e4,_0x2adfb8){return db[_0x493c('0xb6')][_0x493c('0x56')]({'where':{'id':_0x50905c[_0x493c('0x60')]['id']}})['then'](handleEntityNotFound(_0x4960e4,null))[_0x493c('0x21')](function(_0x110b96){if(_0x110b96){return _0x110b96[_0x493c('0xfa')](_0x50905c[_0x493c('0x58')][_0x493c('0x6e')],_[_0x493c('0xfb')](_0x50905c[_0x493c('0x58')],['ids','id'])||{});}})[_0x493c('0x21')](respondWithResult(_0x4960e4,null))[_0x493c('0x29')](handleError(_0x4960e4,null));};exports['getInteractions']=function(_0x223d66,_0x45d9bc,_0x4191c9){var _0x77c2e8={'raw':![],'where':{}};var _0x2fbfca={};var _0x4b3436={'count':0x0,'rows':[]};return db[_0x493c('0x4e')][_0x493c('0x66')]({'where':{'id':_0x223d66[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x45d9bc,null))[_0x493c('0x21')](function(_0x5b04f4){if(_0x5b04f4){_0x2fbfca['model']=_[_0x493c('0x54')](db[_0x493c('0xb6')][_0x493c('0x3c')]);_0x2fbfca[_0x493c('0x40')]=_[_0x493c('0x54')](_0x223d66[_0x493c('0x40')]);_0x2fbfca['filters']=_[_0x493c('0x42')](_0x2fbfca[_0x493c('0x3f')],_0x2fbfca[_0x493c('0x40')]);_0x77c2e8[_0x493c('0x43')]=_['intersection'](_0x2fbfca[_0x493c('0x3f')],qs[_0x493c('0x44')](_0x223d66[_0x493c('0x40')][_0x493c('0x44')]));_0x77c2e8['attributes']=_0x77c2e8[_0x493c('0x43')][_0x493c('0x55')]?_0x77c2e8['attributes']:_0x2fbfca[_0x493c('0x3f')];if(!_0x223d66[_0x493c('0x40')][_0x493c('0x45')](_0x493c('0x67'))){_0x77c2e8[_0x493c('0x2e')]=qs['limit'](_0x223d66[_0x493c('0x40')][_0x493c('0x2e')]);_0x77c2e8[_0x493c('0x30')]=qs[_0x493c('0x30')](_0x223d66[_0x493c('0x40')][_0x493c('0x30')]);}_0x77c2e8[_0x493c('0x46')]=qs[_0x493c('0x47')](_0x223d66[_0x493c('0x40')]['sort']);_0x77c2e8['where']=qs['filters'](_[_0x493c('0x49')](_0x223d66[_0x493c('0x40')],_0x2fbfca[_0x493c('0x41')]));_0x77c2e8['where']['ChatWebsiteId']=_0x5b04f4['id'];if(_0x223d66[_0x493c('0x40')][_0x493c('0x4a')]){_0x77c2e8[_0x493c('0x48')]=_[_0x493c('0x4b')](_0x77c2e8[_0x493c('0x48')],{'$or':_['map'](_0x77c2e8[_0x493c('0x43')],function(_0x44a0b4){var _0x4d723f={};_0x4d723f[_0x44a0b4]={'$like':'%'+_0x223d66['query'][_0x493c('0x4a')]+'%'};return _0x4d723f;})});}_0x77c2e8=_[_0x493c('0x4b')]({},_0x77c2e8,_0x223d66[_0x493c('0x4d')]);return db[_0x493c('0xb6')][_0x493c('0x2f')]({'where':_0x77c2e8[_0x493c('0x48')]})[_0x493c('0x21')](function(_0x4a1c39){_0x4b3436['count']=_0x4a1c39;if(_0x223d66[_0x493c('0x40')]['includeAll']){_0x77c2e8['include']=[{'model':db[_0x493c('0x8c')],'as':_0x493c('0xfc'),'required':![]},{'model':db[_0x493c('0xc4')],'as':_0x493c('0xfd'),'attributes':[_0x493c('0x38'),_0x493c('0xfe'),'internal'],'required':![]},{'model':db[_0x493c('0xff')],'as':'Tags','attributes':['id',_0x493c('0x38'),_0x493c('0x100')],'where':_0x223d66['query']['tag']?{'id':_0x223d66[_0x493c('0x40')][_0x493c('0x101')]}:undefined,'required':_0x223d66['query'][_0x493c('0x101')]?!![]:![]}];}return db[_0x493c('0xb6')][_0x493c('0x51')](_0x77c2e8);})[_0x493c('0x21')](function(_0x1496f8){_0x4b3436[_0x493c('0x52')]=_0x1496f8;return _0x4b3436;});}})[_0x493c('0x21')](respondWithFilteredResult(_0x45d9bc,_0x77c2e8))[_0x493c('0x29')](handleError(_0x45d9bc,null));};function iftimePromise(_0x49ad3d,_0x313b3a){return respondWithRpcPromise('Command',_0x493c('0x102'),{'command':_0x313b3a[_0x493c('0x103')]?util['format'](_0x493c('0x104'),_0x49ad3d[_0x493c('0x105')],_0x313b3a[_0x493c('0x103')]):util[_0x493c('0xaf')](_0x493c('0x106'),_0x49ad3d[_0x493c('0x105')])},client9002)[_0x493c('0x21')](function(_0x200f3f){var _0xd9c246=_0x200f3f&&_0x200f3f[_0x493c('0x107')](_0x493c('0x108'))>=0x0?!![]:![];logger[_0x493c('0x22')](_0x493c('0x109'),_0x313b3a['id'],_0x49ad3d['id'],_0x49ad3d['interval'],_0xd9c246?'ONLINE':_0x493c('0x10a'),_0x313b3a[_0x493c('0x103')]?_0x313b3a[_0x493c('0x103')]:_0x493c('0x10b'));return _0xd9c246;})[_0x493c('0x29')](function(_0x4cd911){logger[_0x493c('0x26')](_0x493c('0x109'),_0x313b3a['id'],_0x49ad3d['id'],_0x49ad3d['interval'],util[_0x493c('0x10c')](_0x4cd911,{'showHidden':![],'depth':null}),_0x313b3a[_0x493c('0x103')]?_0x313b3a[_0x493c('0x103')]:_0x493c('0x10b'));return![];});}exports[_0x493c('0x102')]=function(_0x1cba4e,_0x3b8031,_0x30cbf3){var _0x280296=0x0;var _0x4e26f3=0x0;var _0x41a591=![];var _0x1655f4;var _0x159d3c;return db['ChatWebsite'][_0x493c('0x56')]({'where':{'id':_0x1cba4e[_0x493c('0x60')]['id']},'include':[{'model':db[_0x493c('0x10d')],'as':'Interval','include':[{'model':db[_0x493c('0x10d')],'as':_0x493c('0x10e'),'attributes':['id',_0x493c('0x105')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3b8031,null))[_0x493c('0x21')](function(_0x2c1854){if(_0x2c1854){_0x1655f4=_0x2c1854;return _0x2c1854[_0x493c('0x10f')]({'raw':!![]});}})[_0x493c('0x21')](function(_0x53d0c8){if(_0x1655f4){if(_0x53d0c8){_0x159d3c=_0x53d0c8;}}return require('../../config/license/util')['getLicense']();})[_0x493c('0x21')](function(_0x5a3fef){if(_0x5a3fef){_0x4e26f3=_0x5a3fef[_0x493c('0x110')];_0x41a591=_0x5a3fef['custom'];}})['then'](function(){return db['ChatInteraction'][_0x493c('0x2f')]({'where':{'closed':![]}});})[_0x493c('0x21')](function(_0x1aba3b){_0x280296=_0x1aba3b;if(_0x4e26f3&&_0x1aba3b>_0x4e26f3){return db[_0x493c('0x111')][_0x493c('0x66')]({'where':{'id':0x1}})[_0x493c('0x21')](function(_0x1823ba){if(_0x1823ba){_0x1823ba[_0x493c('0x112')]('chatLicenseExceeded');}});}})[_0x493c('0x21')](function(){if(_0x1655f4[_0x493c('0x10d')]&&_0x1655f4[_0x493c('0x10d')][_0x493c('0x10e')]){var _0x283012=[];for(var _0x55fc09=0x0;_0x55fc09<_0x1655f4[_0x493c('0x10d')][_0x493c('0x10e')][_0x493c('0x55')];_0x55fc09++){var _0x1a3a13=_0x1655f4['Interval'][_0x493c('0x10e')][_0x55fc09]['get']({'plain':!![]});_0x283012[_0x493c('0xbe')](iftimePromise(_0x1a3a13,_0x1655f4));}return BPromise[_0x493c('0x113')](_0x283012)['then'](function(_0x784146){return _[_0x493c('0x114')](_0x784146);});}else{return!![];}})['then'](function(_0x56235e){var _0x52d138=fs[_0x493c('0x115')](path[_0x493c('0x76')](config[_0x493c('0x7b')],'server/files/chat/iframe.ejs'),_0x493c('0xd5'));var _0x480f2e={'remote':_0x1655f4[_0x493c('0x116')],'query':querystring[_0x493c('0x117')](_['merge'](_0x1655f4[_0x493c('0x33')]({'plain':!![]}),{'customerIp':_0x1cba4e[_0x493c('0x8b')][_0x493c('0xa7')]||_0x1cba4e[_0x493c('0x8b')][_0x493c('0x118')]||_0x1cba4e['connection']['remoteAddress']||_0x1cba4e['ip'],'referer':_0x1cba4e['headers'][_0x493c('0x119')],'openedInteractions':_0x280296,'maxInteractions':_0x4e26f3,'virtual':_0x41a591[_0x493c('0x110')],'online':_0x56235e,'custom':_0x41a591}))['replace'](/'/g,'\x5c\x27')};_0x3b8031[_0x493c('0x39')](ejs['render'](Mustache['render'](_0x52d138,_0x480f2e),{'proactiveActions':_0x159d3c,'alignment':_0x1655f4[_0x493c('0x11a')],'verticalAlignment':_0x1655f4[_0x493c('0x11b')],'div_color':_0x1655f4[_0x493c('0x100')],'text_color':_0x1655f4[_0x493c('0x11c')],'button_color':_0x1655f4[_0x493c('0x11d')],'background_color':_0x1655f4[_0x493c('0x11e')]}));})[_0x493c('0x29')](handleError(_0x3b8031,null));};exports[_0x493c('0x11f')]=function(_0xa71670,_0x3c122d,_0xef9fc8){return db[_0x493c('0x4e')][_0x493c('0x66')]({'where':{'id':_0xa71670[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x3c122d,null))[_0x493c('0x21')](function(_0x3e1ab6){if(_0x3e1ab6){return db[_0x493c('0xde')][_0x493c('0xdf')](function(_0x47c78d){return db['ChatApplication'][_0x493c('0x61')]({'where':{'ChatWebsiteId':_0xa71670[_0x493c('0x60')]['id']},'transaction':_0x47c78d})[_0x493c('0x21')](function(_0x40b28d){var _0x209286=_['map'](_0xa71670[_0x493c('0x58')],function(_0x524d17){_0x524d17[_0x493c('0x68')]=_0xa71670[_0x493c('0x60')]['id'];return _0x524d17;});return db['ChatApplication'][_0x493c('0x120')](_0x209286,{'transaction':_0x47c78d});});})[_0x493c('0x21')](function(){return db[_0x493c('0x121')]['findAndCountAll']({'where':{'ChatWebsiteId':_0xa71670[_0x493c('0x60')]['id']},'order':_0x493c('0xa1')});});}})['then'](respondWithResult(_0x3c122d,null))[_0x493c('0x29')](handleError(_0x3c122d,null));};exports['getApplications']=function(_0x58f4c7,_0x29d84f,_0x477e2c){var _0x3661ca={};var _0x5d8a2b={};var _0x1986ca;var _0x59f188;return db[_0x493c('0x4e')][_0x493c('0x66')]({'where':{'id':_0x58f4c7[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x29d84f,null))['then'](function(_0x2d8a38){if(_0x2d8a38){_0x1986ca=_0x2d8a38;_0x5d8a2b[_0x493c('0x3f')]=_[_0x493c('0x54')](db[_0x493c('0x121')]['rawAttributes']);_0x5d8a2b[_0x493c('0x40')]=_[_0x493c('0x54')](_0x58f4c7['query']);_0x5d8a2b[_0x493c('0x41')]=_[_0x493c('0x42')](_0x5d8a2b[_0x493c('0x3f')],_0x5d8a2b[_0x493c('0x40')]);_0x3661ca[_0x493c('0x43')]=_[_0x493c('0x42')](_0x5d8a2b['model'],qs[_0x493c('0x44')](_0x58f4c7[_0x493c('0x40')]['fields']));_0x3661ca[_0x493c('0x43')]=_0x3661ca['attributes'][_0x493c('0x55')]?_0x3661ca[_0x493c('0x43')]:_0x5d8a2b[_0x493c('0x3f')];_0x3661ca['order']=qs[_0x493c('0x47')](_0x58f4c7['query'][_0x493c('0x47')]);_0x3661ca['where']=qs[_0x493c('0x41')](_[_0x493c('0x49')](_0x58f4c7[_0x493c('0x40')],_0x5d8a2b[_0x493c('0x41')]));if(_0x58f4c7[_0x493c('0x40')][_0x493c('0x4a')]){_0x3661ca[_0x493c('0x48')]=_['merge'](_0x3661ca[_0x493c('0x48')],{'$or':_['map'](_0x3661ca[_0x493c('0x43')],function(_0x37e297){var _0x2fdeac={};_0x2fdeac[_0x37e297]={'$like':'%'+_0x58f4c7[_0x493c('0x40')][_0x493c('0x4a')]+'%'};return _0x2fdeac;})});}_0x3661ca=_['merge']({},_0x3661ca,_0x58f4c7[_0x493c('0x4d')]);return _0x1986ca[_0x493c('0x122')](_0x3661ca);}})[_0x493c('0x21')](function(_0x18604d){if(_0x18604d){_0x59f188=_0x18604d['length'];if(!_0x58f4c7[_0x493c('0x40')][_0x493c('0x45')](_0x493c('0x67'))){_0x3661ca[_0x493c('0x2e')]=qs['limit'](_0x58f4c7[_0x493c('0x40')][_0x493c('0x2e')]);_0x3661ca[_0x493c('0x30')]=qs[_0x493c('0x30')](_0x58f4c7[_0x493c('0x40')][_0x493c('0x30')]);}return _0x1986ca['getApplications'](_0x3661ca);}})[_0x493c('0x21')](function(_0x37094c){if(_0x37094c){return _0x37094c?{'count':_0x59f188,'rows':_0x37094c}:null;}})[_0x493c('0x21')](respondWithResult(_0x29d84f,null))[_0x493c('0x29')](handleError(_0x29d84f,null));};exports[_0x493c('0x123')]=function(_0x5c62b1,_0x153860,_0x830eee){return db[_0x493c('0x124')]['find']({'where':{'id':_0x5c62b1[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x153860,null))[_0x493c('0x21')](function(_0x4d3ba9){if(_0x4d3ba9){return _0x4d3ba9[_0x493c('0x123')](_0x5c62b1[_0x493c('0x58')]['ids'],_[_0x493c('0xfb')](_0x5c62b1[_0x493c('0x58')],[_0x493c('0x6e'),'id'])||{});}})[_0x493c('0x21')](respondWithResult(_0x153860,null))[_0x493c('0x29')](handleError(_0x153860,null));};exports[_0x493c('0x10f')]=function(_0x158704,_0x4707e8,_0x627b7e){var _0x1ed736={};var _0x2fdc80={};var _0x29aafc;var _0x4a3d1c;return db[_0x493c('0x4e')][_0x493c('0x66')]({'where':{'id':_0x158704[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x4707e8,null))[_0x493c('0x21')](function(_0x8ed121){if(_0x8ed121){_0x29aafc=_0x8ed121;_0x2fdc80['model']=_[_0x493c('0x54')](db[_0x493c('0x125')][_0x493c('0x3c')]);_0x2fdc80['query']=_['keys'](_0x158704['query']);_0x2fdc80[_0x493c('0x41')]=_[_0x493c('0x42')](_0x2fdc80[_0x493c('0x3f')],_0x2fdc80[_0x493c('0x40')]);_0x1ed736[_0x493c('0x43')]=_[_0x493c('0x42')](_0x2fdc80[_0x493c('0x3f')],qs[_0x493c('0x44')](_0x158704[_0x493c('0x40')][_0x493c('0x44')]));_0x1ed736[_0x493c('0x43')]=_0x1ed736['attributes']['length']?_0x1ed736[_0x493c('0x43')]:_0x2fdc80[_0x493c('0x3f')];_0x1ed736[_0x493c('0x46')]=qs[_0x493c('0x47')](_0x158704['query'][_0x493c('0x47')]);_0x1ed736[_0x493c('0x48')]=qs['filters'](_[_0x493c('0x49')](_0x158704['query'],_0x2fdc80[_0x493c('0x41')]));if(_0x158704[_0x493c('0x40')]['filter']){_0x1ed736[_0x493c('0x48')]=_[_0x493c('0x4b')](_0x1ed736['where'],{'$or':_[_0x493c('0x3b')](_0x1ed736['attributes'],function(_0x5cc5d8){var _0x3dca59={};_0x3dca59[_0x5cc5d8]={'$like':'%'+_0x158704[_0x493c('0x40')]['filter']+'%'};return _0x3dca59;})});}_0x1ed736=_[_0x493c('0x4b')]({},_0x1ed736,_0x158704[_0x493c('0x4d')]);return _0x29aafc[_0x493c('0x10f')](_0x1ed736);}})[_0x493c('0x21')](function(_0x4a149d){if(_0x4a149d){_0x4a3d1c=_0x4a149d['length'];if(!_0x158704['query'][_0x493c('0x45')](_0x493c('0x67'))){_0x1ed736[_0x493c('0x2e')]=qs[_0x493c('0x2e')](_0x158704[_0x493c('0x40')][_0x493c('0x2e')]);_0x1ed736['offset']=qs[_0x493c('0x30')](_0x158704[_0x493c('0x40')][_0x493c('0x30')]);}return _0x29aafc[_0x493c('0x10f')](_0x1ed736);}})[_0x493c('0x21')](function(_0x1fd20a){if(_0x1fd20a){return _0x1fd20a?{'count':_0x4a3d1c,'rows':_0x1fd20a}:null;}})['then'](respondWithResult(_0x4707e8,null))['catch'](handleError(_0x4707e8,null));};exports['getFields']=function(_0x2ef228,_0x168a66,_0x5529f0){var _0x306c57=_0x2ef228[_0x493c('0x40')][_0x493c('0x126')]==='false'?_0x493c('0x127'):'onlineForm';return db[_0x493c('0x4e')][_0x493c('0x56')]({'attributes':['id',_0x306c57],'where':{'id':_0x2ef228[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x168a66,null))['then'](function(_0xc8bc18){if(_0xc8bc18){var _0x184996=_0xc8bc18[_0x306c57];var _0x46914d=_0x184996&&_0x184996['items']?_0x184996[_0x493c('0x128')]:[];_0x168a66[_0x493c('0x39')]({'fromKey':_['isNil'](_0x184996[_0x493c('0x129')])?undefined:_0x184996[_0x493c('0x129')],'count':_0x46914d[_0x493c('0x55')],'rows':_0x46914d});}})[_0x493c('0x29')](handleError(_0x168a66,null));};exports[_0x493c('0x12a')]=function(_0x1d49f6,_0x40e3ea,_0x2170fa){var _0x1e8a41={'raw':![],'where':{}};var _0x35d965={};var _0x58b79c={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1d49f6[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x40e3ea,null))[_0x493c('0x21')](function(_0xab97d0){if(_0xab97d0){_0x35d965[_0x493c('0x3f')]=_[_0x493c('0x54')](db[_0x493c('0xd9')]['rawAttributes']);_0x35d965[_0x493c('0x40')]=_[_0x493c('0x54')](_0x1d49f6['query']);_0x35d965[_0x493c('0x41')]=_[_0x493c('0x42')](_0x35d965[_0x493c('0x3f')],_0x35d965[_0x493c('0x40')]);_0x1e8a41['attributes']=_[_0x493c('0x42')](_0x35d965[_0x493c('0x3f')],qs[_0x493c('0x44')](_0x1d49f6[_0x493c('0x40')][_0x493c('0x44')]));_0x1e8a41[_0x493c('0x43')]=_0x1e8a41[_0x493c('0x43')]['length']?_0x1e8a41[_0x493c('0x43')]:_0x35d965[_0x493c('0x3f')];if(!_0x1d49f6[_0x493c('0x40')][_0x493c('0x45')]('nolimit')){_0x1e8a41[_0x493c('0x2e')]=qs[_0x493c('0x2e')](_0x1d49f6[_0x493c('0x40')][_0x493c('0x2e')]);_0x1e8a41[_0x493c('0x30')]=qs[_0x493c('0x30')](_0x1d49f6[_0x493c('0x40')][_0x493c('0x30')]);}_0x1e8a41[_0x493c('0x46')]=qs[_0x493c('0x47')](_0x1d49f6[_0x493c('0x40')][_0x493c('0x47')]);_0x1e8a41[_0x493c('0x48')]=qs[_0x493c('0x41')](_[_0x493c('0x49')](_0x1d49f6['query'],_0x35d965[_0x493c('0x41')]));_0x1e8a41['where'][_0x493c('0x68')]=_0xab97d0['id'];if(_0x1d49f6[_0x493c('0x40')][_0x493c('0x4a')]){_0x1e8a41[_0x493c('0x48')]=_[_0x493c('0x4b')](_0x1e8a41[_0x493c('0x48')],{'$or':_[_0x493c('0x3b')](_0x1e8a41[_0x493c('0x43')],function(_0x32fa0f){var _0xd649e9={};_0xd649e9[_0x32fa0f]={'$like':'%'+_0x1d49f6[_0x493c('0x40')]['filter']+'%'};return _0xd649e9;})});}_0x1e8a41=_[_0x493c('0x4b')]({},_0x1e8a41,_0x1d49f6[_0x493c('0x4d')]);return db[_0x493c('0xd9')][_0x493c('0x2f')]({'where':_0x1e8a41[_0x493c('0x48')]})[_0x493c('0x21')](function(_0x208bfa){_0x58b79c['count']=_0x208bfa;if(_0x1d49f6[_0x493c('0x40')][_0x493c('0x4f')]){_0x1e8a41[_0x493c('0x50')]=[{'all':!![]}];}else{_0x1e8a41['include']=[{'model':db['CmContact'],'as':_0x493c('0xfc'),'required':![]},{'model':db[_0x493c('0xe0')],'as':'Attachments','required':![]}];}return db[_0x493c('0xd9')][_0x493c('0x51')](_0x1e8a41);})[_0x493c('0x21')](function(_0x3d9747){_0x58b79c[_0x493c('0x52')]=_0x3d9747;return _0x58b79c;});}})[_0x493c('0x21')](respondWithFilteredResult(_0x40e3ea,_0x1e8a41))['catch'](handleError(_0x40e3ea,null));};exports[_0x493c('0x12b')]=function(_0x12103e,_0x41344b,_0x4dd6ff){return db[_0x493c('0x4e')]['find']({'where':{'id':_0x12103e['params']['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x41344b,null))[_0x493c('0x21')](function(_0x36a767){if(_0x36a767){return _0x36a767[_0x493c('0x12b')](_0x12103e['body'][_0x493c('0x6e')],_[_0x493c('0xfb')](_0x12103e[_0x493c('0x58')],[_0x493c('0x6e'),'id'])||{})[_0x493c('0xba')](function(_0x533e7e){for(var _0x127a64=0x0;_0x127a64<_0x12103e[_0x493c('0x58')][_0x493c('0x6e')][_0x493c('0x55')];_0x127a64+=0x1){socket[_0x493c('0x12c')]('userChatWebsite:save',{'UserId':Number(_0x12103e[_0x493c('0x58')][_0x493c('0x6e')][_0x127a64]),'ChatWebsiteId':Number(_0x12103e['params']['id'])});}return _0x533e7e;});}})[_0x493c('0x21')](respondWithResult(_0x41344b,null))['catch'](handleError(_0x41344b,null));};exports['removeAgents']=function(_0x438861,_0x1193d2,_0x258af2){return db[_0x493c('0x4e')][_0x493c('0x56')]({'where':{'id':_0x438861[_0x493c('0x60')]['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x1193d2,null))[_0x493c('0x21')](function(_0x3c992e){if(_0x3c992e){return _0x3c992e['removeAgents'](_0x438861[_0x493c('0x40')][_0x493c('0x6e')])[_0x493c('0x21')](function(){if(_[_0x493c('0x12d')](_0x438861[_0x493c('0x40')][_0x493c('0x6e')])){for(var _0x454d20=0x0;_0x454d20<_0x438861[_0x493c('0x40')][_0x493c('0x6e')][_0x493c('0x55')];_0x454d20+=0x1){socket[_0x493c('0x12c')](_0x493c('0x12e'),{'UserId':Number(_0x438861[_0x493c('0x40')][_0x493c('0x6e')][_0x454d20]),'ChatWebsiteId':Number(_0x438861[_0x493c('0x60')]['id'])});}}else{socket[_0x493c('0x12c')]('userChatWebsite:remove',{'UserId':Number(_0x438861[_0x493c('0x40')]['ids']),'ChatWebsiteId':Number(_0x438861[_0x493c('0x60')]['id'])});}});}})[_0x493c('0x21')](respondWithStatusCode(_0x1193d2,null))[_0x493c('0x29')](handleError(_0x1193d2,null));};exports['getAgents']=function(_0x379842,_0x1a7e52,_0x2c85c9){var _0x2b7c4e={};var _0x25c410={};var _0x228870;var _0x3e8e42;return db[_0x493c('0x4e')][_0x493c('0x66')]({'where':{'id':_0x379842['params']['id']}})[_0x493c('0x21')](handleEntityNotFound(_0x1a7e52,null))[_0x493c('0x21')](function(_0x532e21){if(_0x532e21){_0x228870=_0x532e21;_0x25c410[_0x493c('0x3f')]=_['keys'](db[_0x493c('0xc4')]['rawAttributes']);_0x25c410[_0x493c('0x40')]=_[_0x493c('0x54')](_0x379842[_0x493c('0x40')]);_0x25c410[_0x493c('0x41')]=_[_0x493c('0x42')](_0x25c410[_0x493c('0x3f')],_0x25c410[_0x493c('0x40')]);_0x2b7c4e[_0x493c('0x43')]=_[_0x493c('0x42')](_0x25c410['model'],qs['fields'](_0x379842[_0x493c('0x40')][_0x493c('0x44')]));_0x2b7c4e[_0x493c('0x43')]=_0x2b7c4e[_0x493c('0x43')]['length']?_0x2b7c4e[_0x493c('0x43')]:_0x25c410[_0x493c('0x3f')];_0x2b7c4e['order']=qs[_0x493c('0x47')](_0x379842['query'][_0x493c('0x47')]);_0x2b7c4e[_0x493c('0x48')]=qs[_0x493c('0x41')](_['pick'](_0x379842[_0x493c('0x40')],_0x25c410[_0x493c('0x41')]));if(_0x379842['query'][_0x493c('0x4a')]){_0x2b7c4e[_0x493c('0x48')]=_[_0x493c('0x4b')](_0x2b7c4e['where'],{'$or':_[_0x493c('0x3b')](_0x2b7c4e[_0x493c('0x43')],function(_0x2a295e){var _0x4ba149={};_0x4ba149[_0x2a295e]={'$like':'%'+_0x379842['query'][_0x493c('0x4a')]+'%'};return _0x4ba149;})});}_0x2b7c4e=_[_0x493c('0x4b')]({},_0x2b7c4e,_0x379842[_0x493c('0x4d')]);return _0x228870['getAgents'](_0x2b7c4e);}})[_0x493c('0x21')](function(_0x44abb6){if(_0x44abb6){_0x3e8e42=_0x44abb6[_0x493c('0x55')];if(!_0x379842[_0x493c('0x40')][_0x493c('0x45')](_0x493c('0x67'))){_0x2b7c4e[_0x493c('0x2e')]=qs['limit'](_0x379842[_0x493c('0x40')]['limit']);_0x2b7c4e[_0x493c('0x30')]=qs['offset'](_0x379842[_0x493c('0x40')]['offset']);}return _0x228870[_0x493c('0x12f')](_0x2b7c4e);}})[_0x493c('0x21')](function(_0x5dcb30){if(_0x5dcb30){return _0x5dcb30?{'count':_0x3e8e42,'rows':_0x5dcb30}:null;}})[_0x493c('0x21')](respondWithResult(_0x1a7e52,null))['catch'](handleError(_0x1a7e52,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 602f34d..9500c16 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 _0x3b75=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x3b75,0x144));var _0x53b7=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0x3b75[_0x4599b6];return _0x2e014c;};'use strict';var EventEmitter=require(_0x53b7('0x0'));var ChatWebsite=require(_0x53b7('0x1'))['db'][_0x53b7('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x53b7('0x3')](0x0);var events={'afterCreate':_0x53b7('0x4'),'afterUpdate':_0x53b7('0x5'),'afterDestroy':_0x53b7('0x6')};function emitEvent(_0x145e6c){return function(_0x5a0a4a,_0x5c678a,_0xe75348){ChatWebsiteEvents[_0x53b7('0x7')](_0x145e6c+':'+_0x5a0a4a['id'],_0x5a0a4a);ChatWebsiteEvents[_0x53b7('0x7')](_0x145e6c,_0x5a0a4a);_0xe75348(null);};}for(var e in events){if(events[_0x53b7('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x7f90=['save','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x7f90,0xf4));var _0x07f9=function(_0x2a27eb,_0x2451c8){_0x2a27eb=_0x2a27eb-0x0;var _0x3e8594=_0x7f90[_0x2a27eb];return _0x3e8594;};'use strict';var EventEmitter=require(_0x07f9('0x0'));var ChatWebsite=require(_0x07f9('0x1'))['db'][_0x07f9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x07f9('0x3')](0x0);var events={'afterCreate':_0x07f9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x15b548){return function(_0x132ae4,_0x574e7d,_0x36a0f1){ChatWebsiteEvents[_0x07f9('0x5')](_0x15b548+':'+_0x132ae4['id'],_0x132ae4);ChatWebsiteEvents[_0x07f9('0x5')](_0x15b548,_0x132ae4);_0x36a0f1(null);};}for(var e in events){if(events[_0x07f9('0x6')](e)){var event=events[e];ChatWebsite[_0x07f9('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 367c3f7..a20271b 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 _0x993f=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash'];(function(_0x28f172,_0xcaca0b){var _0x342ad6=function(_0x49ba72){while(--_0x49ba72){_0x28f172['push'](_0x28f172['shift']());}};_0x342ad6(++_0xcaca0b);}(_0x993f,0xb3));var _0xf993=function(_0x47027e,_0x2004b8){_0x47027e=_0x47027e-0x0;var _0x3ceead=_0x993f[_0x47027e];return _0x3ceead;};'use strict';var _=require(_0xf993('0x0'));var util=require('util');var logger=require(_0xf993('0x1'))(_0xf993('0x2'));var moment=require(_0xf993('0x3'));var BPromise=require(_0xf993('0x4'));var rp=require(_0xf993('0x5'));var fs=require('fs');var path=require(_0xf993('0x6'));var rimraf=require('rimraf');var config=require(_0xf993('0x7'));var attributes=require(_0xf993('0x8'));module[_0xf993('0x9')]=function(_0x1fe085,_0x45010e){return _0x1fe085[_0xf993('0xa')]('ChatWebsite',attributes,{'tableName':_0xf993('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbab8=['ChatWebsite','chat_websites','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0xbab8,0x9c));var _0x8bab=function(_0x2aea64,_0x32a66f){_0x2aea64=_0x2aea64-0x0;var _0x375247=_0xbab8[_0x2aea64];return _0x375247;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8bab('0x0'))(_0x8bab('0x1'));var moment=require(_0x8bab('0x2'));var BPromise=require(_0x8bab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8bab('0x4'));var config=require(_0x8bab('0x5'));var attributes=require(_0x8bab('0x6'));module[_0x8bab('0x7')]=function(_0x432135,_0xa24f97){return _0x432135[_0x8bab('0x8')](_0x8bab('0x9'),attributes,{'tableName':_0x8bab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 0a104ee..24e953f 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 _0xe924=['redis','defaults','socket.io-emitter','./chatWebsite.socket','register','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31d646,_0x1d7f6b){var _0x3d1d20=function(_0x5bb86f){while(--_0x5bb86f){_0x31d646['push'](_0x31d646['shift']());}};_0x3d1d20(++_0x1d7f6b);}(_0xe924,0xf0));var _0x4e92=function(_0x4fa717,_0x4dcc12){_0x4fa717=_0x4fa717-0x0;var _0x18adbd=_0xe924[_0x4fa717];return _0x18adbd;};'use strict';var _=require(_0x4e92('0x0'));var util=require('util');var moment=require(_0x4e92('0x1'));var BPromise=require(_0x4e92('0x2'));var rs=require(_0x4e92('0x3'));var fs=require('fs');var Redis=require(_0x4e92('0x4'));var db=require(_0x4e92('0x5'))['db'];var utils=require(_0x4e92('0x6'));var logger=require(_0x4e92('0x7'))(_0x4e92('0x8'));var config=require(_0x4e92('0x9'));var jayson=require(_0x4e92('0xa'));var client=jayson[_0x4e92('0xb')]['http']({'port':0x232a});config[_0x4e92('0xc')]=_[_0x4e92('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4e92('0xe'))(new Redis(config['redis']));require(_0x4e92('0xf'))[_0x4e92('0x10')](socket);function respondWithRpcPromise(_0x57b010,_0x24ad95,_0x12a2bc){return new BPromise(function(_0xe84d65,_0xe1e3b6){return client['request'](_0x57b010,_0x12a2bc)['then'](function(_0x570917){logger[_0x4e92('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x24ad95,_0x4e92('0x12'));logger[_0x4e92('0x13')](_0x4e92('0x14'),_0x24ad95,_0x4e92('0x12'),JSON[_0x4e92('0x15')](_0x570917));if(_0x570917[_0x4e92('0x16')]){if(_0x570917[_0x4e92('0x16')][_0x4e92('0x17')]===0x1f4){logger[_0x4e92('0x16')](_0x4e92('0x18'),_0x24ad95,_0x570917[_0x4e92('0x16')][_0x4e92('0x19')]);return _0xe1e3b6(_0x570917[_0x4e92('0x16')][_0x4e92('0x19')]);}logger[_0x4e92('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x24ad95,_0x570917['error']['message']);return _0xe84d65(_0x570917['error'][_0x4e92('0x19')]);}else{logger['info'](_0x4e92('0x18'),_0x24ad95,_0x4e92('0x12'));_0xe84d65(_0x570917[_0x4e92('0x1a')][_0x4e92('0x19')]);}})[_0x4e92('0x1b')](function(_0x3e9d77){logger['error'](_0x4e92('0x18'),_0x24ad95,_0x3e9d77);_0xe1e3b6(_0x3e9d77);});});} \ No newline at end of file +var _0x6880=['request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0xd2b574,_0x2b42ed){var _0x413ee1=function(_0x299ac8){while(--_0x299ac8){_0xd2b574['push'](_0xd2b574['shift']());}};_0x413ee1(++_0x2b42ed);}(_0x6880,0x17d));var _0x0688=function(_0x25e923,_0x2c15c7){_0x25e923=_0x25e923-0x0;var _0x34a4bc=_0x6880[_0x25e923];return _0x34a4bc;};'use strict';var _=require(_0x0688('0x0'));var util=require(_0x0688('0x1'));var moment=require(_0x0688('0x2'));var BPromise=require(_0x0688('0x3'));var rs=require(_0x0688('0x4'));var fs=require('fs');var Redis=require(_0x0688('0x5'));var db=require(_0x0688('0x6'))['db'];var utils=require(_0x0688('0x7'));var logger=require(_0x0688('0x8'))(_0x0688('0x9'));var config=require(_0x0688('0xa'));var jayson=require(_0x0688('0xb'));var client=jayson[_0x0688('0xc')]['http']({'port':0x232a});config['redis']=_[_0x0688('0xd')](config[_0x0688('0xe')],{'host':_0x0688('0xf'),'port':0x18eb});var socket=require(_0x0688('0x10'))(new Redis(config[_0x0688('0xe')]));require('./chatWebsite.socket')[_0x0688('0x11')](socket);function respondWithRpcPromise(_0xdfad1f,_0xc685ea,_0x2934b1){return new BPromise(function(_0x586f32,_0x55d69c){return client[_0x0688('0x12')](_0xdfad1f,_0x2934b1)[_0x0688('0x13')](function(_0x1b295b){logger[_0x0688('0x14')](_0x0688('0x15'),_0xc685ea,_0x0688('0x16'));logger[_0x0688('0x17')](_0x0688('0x18'),_0xc685ea,_0x0688('0x16'),JSON[_0x0688('0x19')](_0x1b295b));if(_0x1b295b[_0x0688('0x1a')]){if(_0x1b295b[_0x0688('0x1a')][_0x0688('0x1b')]===0x1f4){logger[_0x0688('0x1a')](_0x0688('0x15'),_0xc685ea,_0x1b295b[_0x0688('0x1a')][_0x0688('0x1c')]);return _0x55d69c(_0x1b295b['error'][_0x0688('0x1c')]);}logger[_0x0688('0x1a')](_0x0688('0x15'),_0xc685ea,_0x1b295b[_0x0688('0x1a')]['message']);return _0x586f32(_0x1b295b[_0x0688('0x1a')][_0x0688('0x1c')]);}else{logger[_0x0688('0x14')](_0x0688('0x15'),_0xc685ea,_0x0688('0x16'));_0x586f32(_0x1b295b[_0x0688('0x1d')][_0x0688('0x1c')]);}})[_0x0688('0x1e')](function(_0x2be4ca){logger['error'](_0x0688('0x15'),_0xc685ea,_0x2be4ca);_0x55d69c(_0x2be4ca);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a322657..604cdd6 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 _0xc139=['removeListener','register','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x32fdfc,_0x1c51a5){var _0x570fa2=function(_0x2de97c){while(--_0x2de97c){_0x32fdfc['push'](_0x32fdfc['shift']());}};_0x570fa2(++_0x1c51a5);}(_0xc139,0xcb));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var ChatWebsiteEvents=require(_0x9c13('0x0'));var events=[_0x9c13('0x1'),_0x9c13('0x2'),_0x9c13('0x3')];function createListener(_0x2e8b17,_0x69a13c){return function(_0x1d0579){_0x69a13c[_0x9c13('0x4')](_0x2e8b17,_0x1d0579);};}function removeListener(_0xc0d642,_0x161413){return function(){ChatWebsiteEvents[_0x9c13('0x5')](_0xc0d642,_0x161413);};}exports[_0x9c13('0x6')]=function(_0x43a365){for(var _0x43a99b=0x0,_0x2175bb=events['length'];_0x43a99b<_0x2175bb;_0x43a99b++){var _0x3385c6=events[_0x43a99b];var _0x19ca6f=createListener(_0x9c13('0x7')+_0x3385c6,_0x43a365);ChatWebsiteEvents['on'](_0x3385c6,_0x19ca6f);}}; \ No newline at end of file +var _0x9bfa=['update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x9bfa,0xf6));var _0xa9bf=function(_0x4628c6,_0x2e68e5){_0x4628c6=_0x4628c6-0x0;var _0x5b9a47=_0x9bfa[_0x4628c6];return _0x5b9a47;};'use strict';var ChatWebsiteEvents=require(_0xa9bf('0x0'));var events=[_0xa9bf('0x1'),'remove',_0xa9bf('0x2')];function createListener(_0x6da1a5,_0x24da9a){return function(_0x34ab1c){_0x24da9a[_0xa9bf('0x3')](_0x6da1a5,_0x34ab1c);};}function removeListener(_0x9ea807,_0x317cd2){return function(){ChatWebsiteEvents[_0xa9bf('0x4')](_0x9ea807,_0x317cd2);};}exports[_0xa9bf('0x5')]=function(_0x584573){for(var _0x3a0767=0x0,_0x43073d=events[_0xa9bf('0x6')];_0x3a0767<_0x43073d;_0x3a0767++){var _0x1007b4=events[_0x3a0767];var _0x732aae=createListener(_0xa9bf('0x7')+_0x1007b4,_0x584573);ChatWebsiteEvents['on'](_0x1007b4,_0x732aae);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 0375f42..3fa40b3 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 _0x8f0a=['%s-%s','/:id/notify','notify','offline-chat','extname','replace','/:id/offline','any','offline','addApplications','addProactiveActions','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatWebsite.controller','index','get','/describe','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','now','originalname','single','file','addLogo','join','server/files/images/avatars/','/:id/avatar','format'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x8f0a,0x120));var _0xa8f0=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x8f0a[_0x1064bc];return _0x5edc45;};'use strict';var multer=require('multer');var util=require(_0xa8f0('0x0'));var path=require(_0xa8f0('0x1'));var timeout=require(_0xa8f0('0x2'));var express=require(_0xa8f0('0x3'));var router=express[_0xa8f0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa8f0('0x5'));var config=require('../../config/environment');var controller=require(_0xa8f0('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa8f0('0x7')]);router[_0xa8f0('0x8')](_0xa8f0('0x9'),auth[_0xa8f0('0xa')](),controller['describe']);router[_0xa8f0('0x8')](_0xa8f0('0xb'),auth[_0xa8f0('0xa')](),controller['show']);router['get'](_0xa8f0('0xc'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0xd')]);router[_0xa8f0('0x8')](_0xa8f0('0xe'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0xf')]);router[_0xa8f0('0x8')](_0xa8f0('0x10'),controller[_0xa8f0('0x11')]);router[_0xa8f0('0x8')]('/:id/avatar',controller[_0xa8f0('0x12')]);router['get'](_0xa8f0('0x13'),controller[_0xa8f0('0x14')]);router[_0xa8f0('0x8')](_0xa8f0('0x15'),controller['getSystemAvatar']);router['get'](_0xa8f0('0x16'),auth[_0xa8f0('0xa')](),controller['getInteractions']);router['get'](_0xa8f0('0x17'),controller['getSnippet']);router[_0xa8f0('0x8')](_0xa8f0('0x18'),auth['isAuthenticated'](),controller[_0xa8f0('0x19')]);router[_0xa8f0('0x8')]('/:id/proactive_actions',auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x1a')]);router['get'](_0xa8f0('0x1b'),controller[_0xa8f0('0x1c')]);router[_0xa8f0('0x8')]('/:id/offline_messages',auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x1d')]);router[_0xa8f0('0x8')]('/:id/users',auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x1e')]);router[_0xa8f0('0x1f')]('/',auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x20')]);router['post'](_0xa8f0('0xc'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x21')]);router[_0xa8f0('0x1f')](_0xa8f0('0xe'),auth['isAuthenticated'](),controller[_0xa8f0('0x22')]);var upload=multer({'storage':multer[_0xa8f0('0x23')]({'destination':function(_0x52c23f,_0x576613,_0x45acc8){_0x45acc8(null,path['join'](config[_0xa8f0('0x24')],_0xa8f0('0x25')));},'filename':function(_0x24303f,_0x2ef08f,_0x574dae){_0x574dae(null,util['format']('%s-%s',Date[_0xa8f0('0x26')](),_0x2ef08f[_0xa8f0('0x27')]));}})});router['post'](_0xa8f0('0x10'),upload[_0xa8f0('0x28')](_0xa8f0('0x29')),controller[_0xa8f0('0x2a')]);var upload=multer({'storage':multer[_0xa8f0('0x23')]({'destination':function(_0x2be6ca,_0x52bb67,_0x4dea36){_0x4dea36(null,path[_0xa8f0('0x2b')](config[_0xa8f0('0x24')],_0xa8f0('0x2c')));},'filename':function(_0x43d740,_0x5c8d97,_0x5af185){_0x5af185(null,util['format']('%s-%s',Date[_0xa8f0('0x26')](),_0x5c8d97['originalname']));}})});router[_0xa8f0('0x1f')](_0xa8f0('0x2d'),upload['single'](_0xa8f0('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0xa8f0('0x23')]({'destination':function(_0xd8a69b,_0x4a8fc3,_0x4f4e2d){_0x4f4e2d(null,path[_0xa8f0('0x2b')](config[_0xa8f0('0x24')],_0xa8f0('0x2c')));},'filename':function(_0xee11f5,_0x30955a,_0x81486c){_0x81486c(null,util[_0xa8f0('0x2e')](_0xa8f0('0x2f'),Date[_0xa8f0('0x26')](),_0x30955a[_0xa8f0('0x27')]));}})});router[_0xa8f0('0x1f')](_0xa8f0('0x13'),upload[_0xa8f0('0x28')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xa8f0('0x23')]({'destination':function(_0x4b470f,_0x1a286a,_0x29694e){_0x29694e(null,path[_0xa8f0('0x2b')](config['root'],_0xa8f0('0x2c')));},'filename':function(_0x5d3eca,_0x1957e7,_0x25e723){_0x25e723(null,util[_0xa8f0('0x2e')]('%s-%s',Date[_0xa8f0('0x26')](),_0x1957e7['originalname']));}})});router[_0xa8f0('0x1f')](_0xa8f0('0x15'),upload[_0xa8f0('0x28')](_0xa8f0('0x29')),controller['addSystemAvatar']);router[_0xa8f0('0x1f')](_0xa8f0('0x30'),controller[_0xa8f0('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0xa8f0('0x23')]({'destination':function(_0x22e789,_0x3d0350,_0x8a4719){const _0x3c9bda=path['join'](config['root'],'server/files','attachments',_0xa8f0('0x32'));fs_extra['ensureDir'](_0x3c9bda,function(){_0x8a4719(null,_0x3c9bda);});},'filename':function(_0x3392e6,_0x6af2a4,_0x116c82){const _0x1cc6c8=_0x6af2a4['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x46dee6=path[_0xa8f0('0x33')](_0x1cc6c8);const _0x11bb7f=Date[_0xa8f0('0x26')]()+'-'+_0x1cc6c8[_0xa8f0('0x34')](_0x46dee6,'')+_0x46dee6;_0x116c82(null,_0x11bb7f);}})});router['post'](_0xa8f0('0x35'),offlineUploadMulter[_0xa8f0('0x36')](),controller[_0xa8f0('0x37')]);router['post'](_0xa8f0('0x16'),auth[_0xa8f0('0xa')](),controller['addInteraction']);router[_0xa8f0('0x1f')](_0xa8f0('0x18'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x38')]);router[_0xa8f0('0x1f')]('/:id/proactive_actions',auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x39')]);router[_0xa8f0('0x1f')](_0xa8f0('0x3a'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x3b')]);router[_0xa8f0('0x3c')](_0xa8f0('0xb'),auth[_0xa8f0('0xa')](),controller['update']);router['delete'](_0xa8f0('0xb'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x3d')]);router[_0xa8f0('0x3e')](_0xa8f0('0xc'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x3f')]);router[_0xa8f0('0x3e')]('/:id/canned_answers',auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x40')]);router[_0xa8f0('0x3e')](_0xa8f0('0x3a'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0x41')]);module[_0xa8f0('0x42')]=router; \ No newline at end of file +var _0x03fa=['getOfflineMessages','create','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','root','server/files/images/avatars/','format','addAvatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields'];(function(_0x2fb3db,_0x2960bf){var _0x5a358f=function(_0x573434){while(--_0x573434){_0x2fb3db['push'](_0x2fb3db['shift']());}};_0x5a358f(++_0x2960bf);}(_0x03fa,0xfe));var _0xa03f=function(_0x3fc1ed,_0x34a9b4){_0x3fc1ed=_0x3fc1ed-0x0;var _0xf93288=_0x03fa[_0x3fc1ed];return _0xf93288;};'use strict';var multer=require(_0xa03f('0x0'));var util=require('util');var path=require(_0xa03f('0x1'));var timeout=require(_0xa03f('0x2'));var express=require(_0xa03f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa03f('0x4'));var config=require(_0xa03f('0x5'));var controller=require('./chatWebsite.controller');router[_0xa03f('0x6')]('/',auth[_0xa03f('0x7')](),controller[_0xa03f('0x8')]);router['get'](_0xa03f('0x9'),auth[_0xa03f('0x7')](),controller['describe']);router[_0xa03f('0x6')](_0xa03f('0xa'),auth[_0xa03f('0x7')](),controller[_0xa03f('0xb')]);router[_0xa03f('0x6')](_0xa03f('0xc'),auth[_0xa03f('0x7')](),controller[_0xa03f('0xd')]);router[_0xa03f('0x6')](_0xa03f('0xe'),auth[_0xa03f('0x7')](),controller['getAnswers']);router['get'](_0xa03f('0xf'),controller[_0xa03f('0x10')]);router[_0xa03f('0x6')](_0xa03f('0x11'),controller[_0xa03f('0x12')]);router[_0xa03f('0x6')](_0xa03f('0x13'),controller[_0xa03f('0x14')]);router[_0xa03f('0x6')](_0xa03f('0x15'),controller['getSystemAvatar']);router[_0xa03f('0x6')]('/:id/interactions',auth[_0xa03f('0x7')](),controller[_0xa03f('0x16')]);router[_0xa03f('0x6')](_0xa03f('0x17'),controller[_0xa03f('0x18')]);router[_0xa03f('0x6')](_0xa03f('0x19'),auth['isAuthenticated'](),controller[_0xa03f('0x1a')]);router[_0xa03f('0x6')](_0xa03f('0x1b'),auth['isAuthenticated'](),controller[_0xa03f('0x1c')]);router['get']('/:id/fields',controller[_0xa03f('0x1d')]);router[_0xa03f('0x6')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xa03f('0x1e')]);router['get']('/:id/users',auth[_0xa03f('0x7')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xa03f('0x1f')]);router[_0xa03f('0x20')](_0xa03f('0xc'),auth['isAuthenticated'](),controller[_0xa03f('0x21')]);router[_0xa03f('0x20')](_0xa03f('0xe'),auth[_0xa03f('0x7')](),controller[_0xa03f('0x22')]);var upload=multer({'storage':multer[_0xa03f('0x23')]({'destination':function(_0x38d937,_0x423c08,_0xf0c362){_0xf0c362(null,path[_0xa03f('0x24')](config['root'],_0xa03f('0x25')));},'filename':function(_0xfeec58,_0x39018e,_0x46110e){_0x46110e(null,util['format'](_0xa03f('0x26'),Date[_0xa03f('0x27')](),_0x39018e[_0xa03f('0x28')]));}})});router[_0xa03f('0x20')](_0xa03f('0xf'),upload[_0xa03f('0x29')](_0xa03f('0x2a')),controller[_0xa03f('0x2b')]);var upload=multer({'storage':multer[_0xa03f('0x23')]({'destination':function(_0x1704ec,_0x3e0fe5,_0x4fc68b){_0x4fc68b(null,path[_0xa03f('0x24')](config[_0xa03f('0x2c')],_0xa03f('0x2d')));},'filename':function(_0x59d185,_0x26e0be,_0x46126e){_0x46126e(null,util[_0xa03f('0x2e')](_0xa03f('0x26'),Date[_0xa03f('0x27')](),_0x26e0be[_0xa03f('0x28')]));}})});router[_0xa03f('0x20')](_0xa03f('0x11'),upload[_0xa03f('0x29')]('file'),controller[_0xa03f('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x139f35,_0x138f7d,_0x5b19d4){_0x5b19d4(null,path[_0xa03f('0x24')](config[_0xa03f('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x1c803e,_0x15d083,_0x48bffb){_0x48bffb(null,util[_0xa03f('0x2e')]('%s-%s',Date[_0xa03f('0x27')](),_0x15d083[_0xa03f('0x28')]));}})});router['post'](_0xa03f('0x13'),upload[_0xa03f('0x29')](_0xa03f('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xa03f('0x23')]({'destination':function(_0x1f4543,_0xeabf3b,_0xad1d21){_0xad1d21(null,path[_0xa03f('0x24')](config[_0xa03f('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x4b639d,_0x2c9816,_0x145745){_0x145745(null,util['format'](_0xa03f('0x26'),Date[_0xa03f('0x27')](),_0x2c9816[_0xa03f('0x28')]));}})});router[_0xa03f('0x20')](_0xa03f('0x15'),upload[_0xa03f('0x29')](_0xa03f('0x2a')),controller[_0xa03f('0x30')]);router['post'](_0xa03f('0x31'),controller[_0xa03f('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xa03f('0x23')]({'destination':function(_0x174686,_0x23e6d5,_0x34e07b){const _0x10dc84=path['join'](config['root'],_0xa03f('0x33'),'attachments',_0xa03f('0x34'));fs_extra[_0xa03f('0x35')](_0x10dc84,function(){_0x34e07b(null,_0x10dc84);});},'filename':function(_0x2a76d5,_0x2043cb,_0x12041d){const _0x209320=_0x2043cb[_0xa03f('0x28')][_0xa03f('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x59e61e=path[_0xa03f('0x37')](_0x209320);const _0x13047d=Date[_0xa03f('0x27')]()+'-'+_0x209320[_0xa03f('0x36')](_0x59e61e,'')+_0x59e61e;_0x12041d(null,_0x13047d);}})});router['post'](_0xa03f('0x38'),offlineUploadMulter[_0xa03f('0x39')](),controller[_0xa03f('0x3a')]);router[_0xa03f('0x20')](_0xa03f('0x3b'),auth[_0xa03f('0x7')](),controller[_0xa03f('0x3c')]);router[_0xa03f('0x20')](_0xa03f('0x19'),auth[_0xa03f('0x7')](),controller[_0xa03f('0x3d')]);router[_0xa03f('0x20')](_0xa03f('0x1b'),auth[_0xa03f('0x7')](),controller[_0xa03f('0x3e')]);router[_0xa03f('0x20')]('/:id/users',auth[_0xa03f('0x7')](),controller[_0xa03f('0x3f')]);router['put'](_0xa03f('0xa'),auth[_0xa03f('0x7')](),controller[_0xa03f('0x40')]);router[_0xa03f('0x41')]('/:id',auth['isAuthenticated'](),controller[_0xa03f('0x42')]);router[_0xa03f('0x41')](_0xa03f('0xc'),auth[_0xa03f('0x7')](),controller[_0xa03f('0x43')]);router[_0xa03f('0x41')](_0xa03f('0xe'),auth[_0xa03f('0x7')](),controller[_0xa03f('0x44')]);router['delete'](_0xa03f('0x45'),auth[_0xa03f('0x7')](),controller['removeAgents']);module[_0xa03f('0x46')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5187a43..9a1db61 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 _0x870d=['AmazonAWS','Google','exports','STRING','ENUM'];(function(_0x419fe4,_0x58b271){var _0x22837c=function(_0x4fc713){while(--_0x4fc713){_0x419fe4['push'](_0x419fe4['shift']());}};_0x22837c(++_0x58b271);}(_0x870d,0xde));var _0xd870=function(_0x1ddf90,_0x599744){_0x1ddf90=_0x1ddf90-0x0;var _0x131161=_0x870d[_0x1ddf90];return _0x131161;};'use strict';var Sequelize=require('sequelize');module[_0xd870('0x0')]={'name':{'type':Sequelize[_0xd870('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd870('0x2')](_0xd870('0x3'),_0xd870('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xd870('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x972c=['ENUM','Google','STRING'];(function(_0x32b5ea,_0x53edec){var _0x4358ae=function(_0x4d303a){while(--_0x4d303a){_0x32b5ea['push'](_0x32b5ea['shift']());}};_0x4358ae(++_0x53edec);}(_0x972c,0xf2));var _0xc972=function(_0x2bcc2b,_0x2981f4){_0x2bcc2b=_0x2bcc2b-0x0;var _0x3f198e=_0x972c[_0x2bcc2b];return _0x3f198e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc972('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc972('0x1')]('AmazonAWS',_0xc972('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xc972('0x0')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b325af0..6bfdd78 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 _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x1a37df,_0x3ed536){var _0x5a7d5f=function(_0x4dd8a1){while(--_0x4dd8a1){_0x1a37df['push'](_0x1a37df['shift']());}};_0x5a7d5f(++_0x3ed536);}(_0x0b0e,0x187));var _0xe0b0=function(_0x131205,_0x57575c){_0x131205=_0x131205-0x0;var _0x305300=_0x0b0e[_0x131205];return _0x305300;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x27a911,_0x2a3255){var _0x110ef2=function(_0x5d37a6){while(--_0x5d37a6){_0x27a911['push'](_0x27a911['shift']());}};_0x110ef2(++_0x2a3255);}(_0x7a54,0x106));var _0x47a5=function(_0x13a07d,_0x3ab6c2){_0x13a07d=_0x13a07d-0x0;var _0x1589c4=_0x7a54[_0x13a07d];return _0x1589c4;};'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['CloudProvider'][_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['CloudProvider']['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['CloudProvider']['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('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a8f1f97..a8d8b4c 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 _0xe2b3=['api','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','lodash','util','../../config/logger'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xe2b3,0xcf));var _0x3e2b=function(_0x200b1e,_0x8eb183){_0x200b1e=_0x200b1e-0x0;var _0x30908a=_0xe2b3[_0x200b1e];return _0x30908a;};'use strict';var _=require(_0x3e2b('0x0'));var util=require(_0x3e2b('0x1'));var logger=require(_0x3e2b('0x2'))(_0x3e2b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e2b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e2b('0x5'));var config=require(_0x3e2b('0x6'));var attributes=require(_0x3e2b('0x7'));module['exports']=function(_0x1587c6,_0xff8275){return _0x1587c6[_0x3e2b('0x8')](_0x3e2b('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x935d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','cloud_providers'];(function(_0x343899,_0x128a38){var _0x8982ac=function(_0x548da5){while(--_0x548da5){_0x343899['push'](_0x343899['shift']());}};_0x8982ac(++_0x128a38);}(_0x935d,0xb4));var _0xd935=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x935d[_0x3fa296];return _0x10b19f;};'use strict';var _=require(_0xd935('0x0'));var util=require(_0xd935('0x1'));var logger=require(_0xd935('0x2'))(_0xd935('0x3'));var moment=require(_0xd935('0x4'));var BPromise=require(_0xd935('0x5'));var rp=require(_0xd935('0x6'));var fs=require('fs');var path=require(_0xd935('0x7'));var rimraf=require(_0xd935('0x8'));var config=require(_0xd935('0x9'));var attributes=require('./cloudProvider.attributes');module[_0xd935('0xa')]=function(_0x12f6b1,_0x4ca65f){return _0x12f6b1['define']('CloudProvider',attributes,{'tableName':_0xd935('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 70272ff..cd4cfd2 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 _0xa456=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error'];(function(_0x5bd4fc,_0x4fbd8c){var _0x14b56e=function(_0x361e5c){while(--_0x361e5c){_0x5bd4fc['push'](_0x5bd4fc['shift']());}};_0x14b56e(++_0x4fbd8c);}(_0xa456,0x142));var _0x6a45=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa456[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('CloudProvider,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});} \ No newline at end of file +var _0x13b6=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0x13b6,0x97));var _0x613b=function(_0xea6957,_0xf3bd27){_0xea6957=_0xea6957-0x0;var _0xbe6a78=_0x13b6[_0xea6957];return _0xbe6a78;};'use strict';var _=require(_0x613b('0x0'));var util=require('util');var moment=require(_0x613b('0x1'));var BPromise=require(_0x613b('0x2'));var rs=require(_0x613b('0x3'));var fs=require('fs');var Redis=require(_0x613b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x613b('0x5'));var logger=require(_0x613b('0x6'))(_0x613b('0x7'));var config=require('../../config/environment');var jayson=require(_0x613b('0x8'));var client=jayson[_0x613b('0x9')][_0x613b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x593a18,_0x31a96f,_0x4e576a){return new BPromise(function(_0xf83c34,_0x4abb96){return client['request'](_0x593a18,_0x4e576a)[_0x613b('0xb')](function(_0x37dbc7){logger[_0x613b('0xc')](_0x613b('0xd'),_0x31a96f,_0x613b('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x31a96f,_0x613b('0xe'),JSON['stringify'](_0x37dbc7));if(_0x37dbc7[_0x613b('0xf')]){if(_0x37dbc7['error']['code']===0x1f4){logger[_0x613b('0xf')](_0x613b('0xd'),_0x31a96f,_0x37dbc7[_0x613b('0xf')]['message']);return _0x4abb96(_0x37dbc7[_0x613b('0xf')][_0x613b('0x10')]);}logger[_0x613b('0xf')](_0x613b('0xd'),_0x31a96f,_0x37dbc7[_0x613b('0xf')][_0x613b('0x10')]);return _0xf83c34(_0x37dbc7[_0x613b('0xf')][_0x613b('0x10')]);}else{logger[_0x613b('0xc')](_0x613b('0xd'),_0x31a96f,'request\x20sent');_0xf83c34(_0x37dbc7[_0x613b('0x11')][_0x613b('0x10')]);}})[_0x613b('0x12')](function(_0x4cafe9){logger['error'](_0x613b('0xd'),_0x31a96f,_0x4cafe9);_0x4abb96(_0x4cafe9);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 7ed659e..8da691d 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 _0xf835=['/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xf835,0x183));var _0x5f83=function(_0x407b23,_0x28dc76){_0x407b23=_0x407b23-0x0;var _0x1742da=_0xf835[_0x407b23];return _0x1742da;};'use strict';var multer=require(_0x5f83('0x0'));var util=require(_0x5f83('0x1'));var path=require(_0x5f83('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f83('0x3'));var router=express[_0x5f83('0x4')]();var fs_extra=require(_0x5f83('0x5'));var auth=require(_0x5f83('0x6'));var interaction=require(_0x5f83('0x7'));var config=require(_0x5f83('0x8'));var controller=require(_0x5f83('0x9'));router[_0x5f83('0xa')]('/',auth['isAuthenticated'](),controller[_0x5f83('0xb')]);router['get'](_0x5f83('0xc'),auth[_0x5f83('0xd')](),controller['show']);router[_0x5f83('0xe')]('/',auth['isAuthenticated'](),controller[_0x5f83('0xf')]);router[_0x5f83('0x10')](_0x5f83('0xc'),auth['isAuthenticated'](),controller[_0x5f83('0x11')]);router[_0x5f83('0x12')](_0x5f83('0xc'),auth[_0x5f83('0xd')](),controller[_0x5f83('0x13')]);module[_0x5f83('0x14')]=router; \ No newline at end of file +var _0x9931=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy'];(function(_0x25592c,_0x14f27c){var _0x5ac6c4=function(_0x218ee1){while(--_0x218ee1){_0x25592c['push'](_0x25592c['shift']());}};_0x5ac6c4(++_0x14f27c);}(_0x9931,0x1b6));var _0x1993=function(_0x17bbc4,_0x198dd9){_0x17bbc4=_0x17bbc4-0x0;var _0x2b23f4=_0x9931[_0x17bbc4];return _0x2b23f4;};'use strict';var multer=require('multer');var util=require(_0x1993('0x0'));var path=require('path');var timeout=require(_0x1993('0x1'));var express=require(_0x1993('0x2'));var router=express[_0x1993('0x3')]();var fs_extra=require(_0x1993('0x4'));var auth=require(_0x1993('0x5'));var interaction=require(_0x1993('0x6'));var config=require(_0x1993('0x7'));var controller=require(_0x1993('0x8'));router[_0x1993('0x9')]('/',auth[_0x1993('0xa')](),controller[_0x1993('0xb')]);router[_0x1993('0x9')](_0x1993('0xc'),auth[_0x1993('0xa')](),controller[_0x1993('0xd')]);router[_0x1993('0xe')]('/',auth[_0x1993('0xa')](),controller['create']);router['put'](_0x1993('0xc'),auth[_0x1993('0xa')](),controller[_0x1993('0xf')]);router[_0x1993('0x10')](_0x1993('0xc'),auth[_0x1993('0xa')](),controller[_0x1993('0x11')]);module[_0x1993('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 1a30a11..178b057 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 _0x4f6e=['STRING','name','sequelize'];(function(_0x587afc,_0x5b3356){var _0x57705a=function(_0x3a0922){while(--_0x3a0922){_0x587afc['push'](_0x587afc['shift']());}};_0x57705a(++_0x5b3356);}(_0x4f6e,0x1e5));var _0xe4f6=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x4f6e[_0x42c6f1];return _0x3c7398;};'use strict';var Sequelize=require(_0xe4f6('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4f6('0x1')],'unique':_0xe4f6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe4f6('0x1')]},'fax':{'type':Sequelize[_0xe4f6('0x1')]},'type':{'type':Sequelize[_0xe4f6('0x1')]},'street':{'type':Sequelize[_0xe4f6('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe4f6('0x1')]},'country':{'type':Sequelize[_0xe4f6('0x1')]},'email':{'type':Sequelize[_0xe4f6('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe4f6('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xe4f6('0x1')]},'sCity':{'type':Sequelize[_0xe4f6('0x1')]},'sCountry':{'type':Sequelize[_0xe4f6('0x1')]},'description':{'type':Sequelize[_0xe4f6('0x1')]}}; \ No newline at end of file +var _0x9c07=['exports','STRING','name','sequelize'];(function(_0x55afc4,_0x26d115){var _0x217834=function(_0x2892c5){while(--_0x2892c5){_0x55afc4['push'](_0x55afc4['shift']());}};_0x217834(++_0x26d115);}(_0x9c07,0x163));var _0x79c0=function(_0x46b2b4,_0x285429){_0x46b2b4=_0x46b2b4-0x0;var _0x477b19=_0x9c07[_0x46b2b4];return _0x477b19;};'use strict';var Sequelize=require(_0x79c0('0x0'));module[_0x79c0('0x1')]={'name':{'type':Sequelize[_0x79c0('0x2')],'unique':_0x79c0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x79c0('0x2')]},'companyId':{'type':Sequelize[_0x79c0('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x79c0('0x2')]},'fax':{'type':Sequelize[_0x79c0('0x2')]},'type':{'type':Sequelize[_0x79c0('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x79c0('0x2')]},'city':{'type':Sequelize[_0x79c0('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x79c0('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x79c0('0x2')]},'sCity':{'type':Sequelize[_0x79c0('0x2')]},'sCountry':{'type':Sequelize[_0x79c0('0x2')]},'description':{'type':Sequelize[_0x79c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b6cfac7..d361a50 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 _0xbe80=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Companies','end','sendStatus','error','name','send','index','CmCompany','describe','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addContacts','CmContact','ids','getContacts','findOne','nolimit','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','lodash'];(function(_0x8bc7a5,_0x55b149){var _0x45a6b7=function(_0xa38d2c){while(--_0xa38d2c){_0x8bc7a5['push'](_0x8bc7a5['shift']());}};_0x45a6b7(++_0x55b149);}(_0xbe80,0xa3));var _0x0be8=function(_0x58ec8b,_0x37baa2){_0x58ec8b=_0x58ec8b-0x0;var _0x358864=_0xbe80[_0x58ec8b];return _0x358864;};'use strict';var emlformat=require(_0x0be8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0be8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0be8('0x2'));var moment=require(_0x0be8('0x3'));var BPromise=require(_0x0be8('0x4'));var Mustache=require('mustache');var util=require(_0x0be8('0x5'));var path=require(_0x0be8('0x6'));var sox=require('sox');var csv=require(_0x0be8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0be8('0x8'));var squel=require('squel');var crypto=require(_0x0be8('0x9'));var jsforce=require(_0x0be8('0xa'));var deskjs=require(_0x0be8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0be8('0xc'));var Redis=require(_0x0be8('0xd'));var authService=require(_0x0be8('0xe'));var qs=require(_0x0be8('0xf'));var as=require(_0x0be8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0be8('0x11'))(_0x0be8('0x12'));var utils=require(_0x0be8('0x13'));var config=require(_0x0be8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0be8('0x15'))['db'];function respondWithStatusCode(_0x5ec139,_0x5335c5){_0x5335c5=_0x5335c5||0xcc;return function(_0x64e8dc){if(_0x64e8dc){return _0x5ec139['sendStatus'](_0x5335c5);}return _0x5ec139[_0x0be8('0x16')](_0x5335c5)['end']();};}function respondWithResult(_0x2bfa0b,_0x46f825){_0x46f825=_0x46f825||0xc8;return function(_0x44ceea){if(_0x44ceea){return _0x2bfa0b[_0x0be8('0x16')](_0x46f825)['json'](_0x44ceea);}};}function respondWithFilteredResult(_0x4b27a7,_0x3ece09){return function(_0x1efbe1){if(_0x1efbe1){var _0x37b211=typeof _0x3ece09[_0x0be8('0x17')]==='undefined'&&typeof _0x3ece09['limit']===_0x0be8('0x18');var _0x50f00f=_0x1efbe1[_0x0be8('0x19')];var _0x22ff6b=_0x37b211?0x0:_0x3ece09[_0x0be8('0x17')];var _0x3e6c3c=_0x37b211?_0x1efbe1['count']:_0x3ece09['offset']+_0x3ece09[_0x0be8('0x1a')];var _0x3281f2;if(_0x3e6c3c>=_0x50f00f){_0x3e6c3c=_0x50f00f;_0x3281f2=0xc8;}else{_0x3281f2=0xce;}_0x4b27a7[_0x0be8('0x16')](_0x3281f2);return _0x4b27a7[_0x0be8('0x1b')](_0x0be8('0x1c'),_0x22ff6b+'-'+_0x3e6c3c+'/'+_0x50f00f)['json'](_0x1efbe1);}return null;};}function patchUpdates(_0x5b9667){return function(_0x26a45c){try{jsonpatch[_0x0be8('0x1d')](_0x26a45c,_0x5b9667,!![]);}catch(_0x545940){return BPromise[_0x0be8('0x1e')](_0x545940);}return _0x26a45c[_0x0be8('0x1f')]();};}function saveUpdates(_0x263082,_0x47e8e7){return function(_0x4ce073){if(_0x4ce073){return _0x4ce073['update'](_0x263082)[_0x0be8('0x20')](function(_0x5b20ad){return _0x5b20ad;});}return null;};}function removeEntity(_0x48fa59,_0x7d5b2f){return function(_0x44783b){if(_0x44783b){return _0x44783b[_0x0be8('0x21')]()['then'](function(){var _0x51b8f0=_0x44783b[_0x0be8('0x22')]({'plain':!![]});var _0x58ab7c=_0x0be8('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x58ab7c,'resourceId':_0x51b8f0['id']}})[_0x0be8('0x20')](function(){return _0x44783b;});})[_0x0be8('0x20')](function(){_0x48fa59[_0x0be8('0x16')](0xcc)[_0x0be8('0x24')]();});}};}function handleEntityNotFound(_0x33bee4,_0x27fc7d){return function(_0x4e8883){if(!_0x4e8883){_0x33bee4[_0x0be8('0x25')](0x194);}return _0x4e8883;};}function handleError(_0x5284bd,_0x5e4d77){_0x5e4d77=_0x5e4d77||0x1f4;return function(_0x381c96){logger[_0x0be8('0x26')](_0x381c96['stack']);if(_0x381c96[_0x0be8('0x27')]){delete _0x381c96[_0x0be8('0x27')];}_0x5284bd[_0x0be8('0x16')](_0x5e4d77)[_0x0be8('0x28')](_0x381c96);};}exports[_0x0be8('0x29')]=function(_0x19d827,_0x4925c2){var _0xb353fc={},_0x3494a6={},_0x42d1a2={'count':0x0,'rows':[]};return db[_0x0be8('0x2a')][_0x0be8('0x2b')]()[_0x0be8('0x20')](function(_0x11abde){_0x3494a6[_0x0be8('0x2c')]=_['keys'](_0x11abde);_0x3494a6[_0x0be8('0x2d')]=_[_0x0be8('0x2e')](_0x19d827[_0x0be8('0x2d')]);_0x3494a6['filters']=_[_0x0be8('0x2f')](_0x3494a6[_0x0be8('0x2c')],_0x3494a6[_0x0be8('0x2d')]);_0xb353fc['attributes']=_['intersection'](_0x3494a6[_0x0be8('0x2c')],qs[_0x0be8('0x30')](_0x19d827[_0x0be8('0x2d')][_0x0be8('0x30')]));_0xb353fc[_0x0be8('0x31')]=_0xb353fc[_0x0be8('0x31')]['length']?_0xb353fc['attributes']:_0x3494a6[_0x0be8('0x2c')];if(!_0x19d827[_0x0be8('0x2d')][_0x0be8('0x32')]('nolimit')){_0xb353fc['limit']=qs[_0x0be8('0x1a')](_0x19d827[_0x0be8('0x2d')][_0x0be8('0x1a')]);_0xb353fc[_0x0be8('0x17')]=qs[_0x0be8('0x17')](_0x19d827[_0x0be8('0x2d')][_0x0be8('0x17')]);}_0xb353fc[_0x0be8('0x33')]=qs[_0x0be8('0x34')](_0x19d827[_0x0be8('0x2d')][_0x0be8('0x34')]);_0xb353fc[_0x0be8('0x35')]=qs[_0x0be8('0x36')](_[_0x0be8('0x37')](_0x19d827[_0x0be8('0x2d')],_0x3494a6[_0x0be8('0x36')]),_0x11abde);if(_0x19d827[_0x0be8('0x2d')][_0x0be8('0x38')]){_0xb353fc[_0x0be8('0x35')]=_[_0x0be8('0x39')](_0xb353fc[_0x0be8('0x35')],{'$or':_[_0x0be8('0x3a')](_0xb353fc[_0x0be8('0x31')],function(_0x30284e){var _0x2724e7={};_0x2724e7[_0x30284e]={'$like':'%'+_0x19d827[_0x0be8('0x2d')][_0x0be8('0x38')]+'%'};return _0x2724e7;})});}_0xb353fc=_['merge']({},_0xb353fc,_0x19d827[_0x0be8('0x3b')]);var _0x5c1fff={'where':_0xb353fc[_0x0be8('0x35')]};return db['CmCompany']['count'](_0x5c1fff)[_0x0be8('0x20')](function(_0x95de65){_0x42d1a2['count']=_0x95de65;if(_0x19d827[_0x0be8('0x2d')][_0x0be8('0x3c')]){_0xb353fc[_0x0be8('0x3d')]=[{'all':!![]}];}return db[_0x0be8('0x2a')][_0x0be8('0x3e')](_0xb353fc);})['then'](function(_0x1139a1){_0x42d1a2[_0x0be8('0x3f')]=_0x1139a1;return _0x42d1a2;})[_0x0be8('0x20')](respondWithFilteredResult(_0x4925c2,_0xb353fc))['catch'](handleError(_0x4925c2,null));})['catch'](handleError(_0x4925c2,null));};exports[_0x0be8('0x40')]=function(_0x55861a,_0x434193){var _0x28498d={'raw':![],'where':{'id':_0x55861a[_0x0be8('0x41')]['id']}},_0x9eab86={};_0x9eab86[_0x0be8('0x2c')]=_[_0x0be8('0x2e')](db[_0x0be8('0x2a')][_0x0be8('0x42')]);_0x9eab86['query']=_[_0x0be8('0x2e')](_0x55861a[_0x0be8('0x2d')]);_0x9eab86[_0x0be8('0x36')]=_['intersection'](_0x9eab86['model'],_0x9eab86[_0x0be8('0x2d')]);_0x28498d[_0x0be8('0x31')]=_[_0x0be8('0x2f')](_0x9eab86[_0x0be8('0x2c')],qs[_0x0be8('0x30')](_0x55861a[_0x0be8('0x2d')][_0x0be8('0x30')]));_0x28498d[_0x0be8('0x31')]=_0x28498d['attributes']['length']?_0x28498d[_0x0be8('0x31')]:_0x9eab86['model'];if(_0x55861a[_0x0be8('0x2d')][_0x0be8('0x3c')]){_0x28498d[_0x0be8('0x3d')]=[{'all':!![]}];}_0x28498d=_['merge']({},_0x28498d,_0x55861a[_0x0be8('0x3b')]);return db[_0x0be8('0x2a')][_0x0be8('0x43')](_0x28498d)['then'](handleEntityNotFound(_0x434193,null))[_0x0be8('0x20')](respondWithResult(_0x434193,null))[_0x0be8('0x44')](handleError(_0x434193,null));};exports[_0x0be8('0x45')]=function(_0x51eae7,_0xdd6ead){return db[_0x0be8('0x2a')]['create'](_0x51eae7['body'],{})['then'](function(_0x410d92){var _0x14fd65=_0x51eae7[_0x0be8('0x46')][_0x0be8('0x22')]({'plain':!![]});if(!_0x14fd65)throw new Error(_0x0be8('0x47'));if(_0x14fd65[_0x0be8('0x48')]==='user'){var _0xcf131c=_0x410d92[_0x0be8('0x22')]({'plain':!![]});var _0x189d1f='Companies';return db[_0x0be8('0x49')][_0x0be8('0x43')]({'where':{'name':_0x189d1f,'userProfileId':_0x14fd65[_0x0be8('0x4a')]},'raw':!![]})['then'](function(_0x677716){if(_0x677716&&_0x677716[_0x0be8('0x4b')]===0x0){return db[_0x0be8('0x4c')][_0x0be8('0x45')]({'name':_0xcf131c[_0x0be8('0x27')],'resourceId':_0xcf131c['id'],'type':_0x677716['name'],'sectionId':_0x677716['id']},{})['then'](function(){return _0x410d92;});}else{return _0x410d92;}})['catch'](function(_0x299c37){logger[_0x0be8('0x26')](_0x0be8('0x4d'),_0x299c37);throw _0x299c37;});}return _0x410d92;})['then'](respondWithResult(_0xdd6ead,0xc9))[_0x0be8('0x44')](handleError(_0xdd6ead,null));};exports[_0x0be8('0x4e')]=function(_0xa8dc9c,_0x4979bf){if(_0xa8dc9c[_0x0be8('0x4f')]['id']){delete _0xa8dc9c[_0x0be8('0x4f')]['id'];}return db[_0x0be8('0x2a')]['find']({'where':{'id':_0xa8dc9c['params']['id']}})['then'](handleEntityNotFound(_0x4979bf,null))[_0x0be8('0x20')](saveUpdates(_0xa8dc9c['body'],null))[_0x0be8('0x20')](respondWithResult(_0x4979bf,null))[_0x0be8('0x44')](handleError(_0x4979bf,null));};exports['destroy']=function(_0x559c9a,_0x33b652){return db['CmCompany'][_0x0be8('0x43')]({'where':{'id':_0x559c9a[_0x0be8('0x41')]['id']}})['then'](handleEntityNotFound(_0x33b652,null))['then'](removeEntity(_0x33b652,null))[_0x0be8('0x44')](handleError(_0x33b652,null));};exports['describe']=function(_0x209467,_0x121365){return db['CmCompany'][_0x0be8('0x2b')]()[_0x0be8('0x20')](respondWithResult(_0x121365,null))[_0x0be8('0x44')](handleError(_0x121365,null));};exports[_0x0be8('0x50')]=function(_0x5eaa5b,_0x21bd78,_0x288da7){return db[_0x0be8('0x51')][_0x0be8('0x43')]({'where':{'id':_0x5eaa5b['params']['id']}})[_0x0be8('0x20')](handleEntityNotFound(_0x21bd78,null))[_0x0be8('0x20')](function(_0x1dfd10){if(_0x1dfd10){return _0x1dfd10[_0x0be8('0x50')](_0x5eaa5b[_0x0be8('0x4f')]['ids'],_['omit'](_0x5eaa5b['body'],[_0x0be8('0x52'),'id'])||{});}})[_0x0be8('0x20')](respondWithResult(_0x21bd78,null))[_0x0be8('0x44')](handleError(_0x21bd78,null));};exports[_0x0be8('0x53')]=function(_0x4cc89f,_0x105a2d,_0x34cf57){var _0x45992b={};var _0x529221={};var _0x151250;var _0x2c27ba;return db[_0x0be8('0x2a')][_0x0be8('0x54')]({'where':{'id':_0x4cc89f[_0x0be8('0x41')]['id']}})[_0x0be8('0x20')](handleEntityNotFound(_0x105a2d,null))[_0x0be8('0x20')](function(_0x2badd1){if(_0x2badd1){_0x151250=_0x2badd1;_0x529221[_0x0be8('0x2c')]=_['keys'](db[_0x0be8('0x51')][_0x0be8('0x42')]);_0x529221['query']=_[_0x0be8('0x2e')](_0x4cc89f[_0x0be8('0x2d')]);_0x529221[_0x0be8('0x36')]=_[_0x0be8('0x2f')](_0x529221[_0x0be8('0x2c')],_0x529221[_0x0be8('0x2d')]);_0x45992b['attributes']=_[_0x0be8('0x2f')](_0x529221[_0x0be8('0x2c')],qs[_0x0be8('0x30')](_0x4cc89f[_0x0be8('0x2d')][_0x0be8('0x30')]));_0x45992b[_0x0be8('0x31')]=_0x45992b[_0x0be8('0x31')]['length']?_0x45992b[_0x0be8('0x31')]:_0x529221[_0x0be8('0x2c')];_0x45992b[_0x0be8('0x33')]=qs[_0x0be8('0x34')](_0x4cc89f[_0x0be8('0x2d')][_0x0be8('0x34')]);_0x45992b['where']=qs[_0x0be8('0x36')](_['pick'](_0x4cc89f['query'],_0x529221['filters']));if(_0x4cc89f[_0x0be8('0x2d')]['filter']){_0x45992b[_0x0be8('0x35')]=_[_0x0be8('0x39')](_0x45992b[_0x0be8('0x35')],{'$or':_[_0x0be8('0x3a')](_0x45992b['attributes'],function(_0x2d1a93){var _0x279a20={};_0x279a20[_0x2d1a93]={'$like':'%'+_0x4cc89f[_0x0be8('0x2d')][_0x0be8('0x38')]+'%'};return _0x279a20;})});}_0x45992b=_[_0x0be8('0x39')]({},_0x45992b,_0x4cc89f[_0x0be8('0x3b')]);return _0x151250['getContacts'](_0x45992b);}})[_0x0be8('0x20')](function(_0x4bf49d){if(_0x4bf49d){_0x2c27ba=_0x4bf49d['length'];if(!_0x4cc89f[_0x0be8('0x2d')]['hasOwnProperty'](_0x0be8('0x55'))){_0x45992b[_0x0be8('0x1a')]=qs['limit'](_0x4cc89f[_0x0be8('0x2d')][_0x0be8('0x1a')]);_0x45992b['offset']=qs[_0x0be8('0x17')](_0x4cc89f[_0x0be8('0x2d')]['offset']);}return _0x151250[_0x0be8('0x53')](_0x45992b);}})[_0x0be8('0x20')](function(_0x4070aa){if(_0x4070aa){return _0x4070aa?{'count':_0x2c27ba,'rows':_0x4070aa}:null;}})[_0x0be8('0x20')](respondWithResult(_0x105a2d,null))[_0x0be8('0x44')](handleError(_0x105a2d,null));}; \ No newline at end of file +var _0xd988=['nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','CmCompany','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContact','addContacts','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','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','apply','save','update','then','destroy','get','Companies','end','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x19050b,_0x26d9f6){var _0x267f98=function(_0x566562){while(--_0x566562){_0x19050b['push'](_0x19050b['shift']());}};_0x267f98(++_0x26d9f6);}(_0xd988,0xd2));var _0x8d98=function(_0x50e383,_0xd95cd){_0x50e383=_0x50e383-0x0;var _0x523095=_0xd988[_0x50e383];return _0x523095;};'use strict';var emlformat=require(_0x8d98('0x0'));var rimraf=require(_0x8d98('0x1'));var zipdir=require(_0x8d98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d98('0x3'));var moment=require('moment');var BPromise=require(_0x8d98('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8d98('0x5'));var sox=require(_0x8d98('0x6'));var csv=require(_0x8d98('0x7'));var ejs=require(_0x8d98('0x8'));var fs=require('fs');var fs_extra=require(_0x8d98('0x9'));var _=require(_0x8d98('0xa'));var squel=require(_0x8d98('0xb'));var crypto=require('crypto');var jsforce=require(_0x8d98('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8d98('0xd'));var authService=require(_0x8d98('0xe'));var qs=require(_0x8d98('0xf'));var as=require(_0x8d98('0x10'));var hardwareService=require(_0x8d98('0x11'));var logger=require(_0x8d98('0x12'))(_0x8d98('0x13'));var utils=require(_0x8d98('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8d98('0x15'))['db'];function respondWithStatusCode(_0x5303e5,_0x12b2da){_0x12b2da=_0x12b2da||0xcc;return function(_0x110ecf){if(_0x110ecf){return _0x5303e5[_0x8d98('0x16')](_0x12b2da);}return _0x5303e5[_0x8d98('0x17')](_0x12b2da)['end']();};}function respondWithResult(_0x36d6c8,_0x44d666){_0x44d666=_0x44d666||0xc8;return function(_0x116f26){if(_0x116f26){return _0x36d6c8[_0x8d98('0x17')](_0x44d666)[_0x8d98('0x18')](_0x116f26);}};}function respondWithFilteredResult(_0x23732c,_0x207f10){return function(_0x48b558){if(_0x48b558){var _0xb08729=typeof _0x207f10[_0x8d98('0x19')]===_0x8d98('0x1a')&&typeof _0x207f10[_0x8d98('0x1b')]===_0x8d98('0x1a');var _0xd2e1d9=_0x48b558[_0x8d98('0x1c')];var _0x2ff64a=_0xb08729?0x0:_0x207f10[_0x8d98('0x19')];var _0x227d7b=_0xb08729?_0x48b558[_0x8d98('0x1c')]:_0x207f10['offset']+_0x207f10[_0x8d98('0x1b')];var _0x8d739c;if(_0x227d7b>=_0xd2e1d9){_0x227d7b=_0xd2e1d9;_0x8d739c=0xc8;}else{_0x8d739c=0xce;}_0x23732c[_0x8d98('0x17')](_0x8d739c);return _0x23732c[_0x8d98('0x1d')]('Content-Range',_0x2ff64a+'-'+_0x227d7b+'/'+_0xd2e1d9)[_0x8d98('0x18')](_0x48b558);}return null;};}function patchUpdates(_0x193a9f){return function(_0x266096){try{jsonpatch[_0x8d98('0x1e')](_0x266096,_0x193a9f,!![]);}catch(_0xaf83e0){return BPromise['reject'](_0xaf83e0);}return _0x266096[_0x8d98('0x1f')]();};}function saveUpdates(_0x4516c0,_0x213c84){return function(_0x1b75cc){if(_0x1b75cc){return _0x1b75cc[_0x8d98('0x20')](_0x4516c0)[_0x8d98('0x21')](function(_0x34dde8){return _0x34dde8;});}return null;};}function removeEntity(_0x50b4c6,_0x4b4386){return function(_0x47665f){if(_0x47665f){return _0x47665f[_0x8d98('0x22')]()['then'](function(){var _0x51233b=_0x47665f[_0x8d98('0x23')]({'plain':!![]});var _0x5264ee=_0x8d98('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5264ee,'resourceId':_0x51233b['id']}})[_0x8d98('0x21')](function(){return _0x47665f;});})[_0x8d98('0x21')](function(){_0x50b4c6[_0x8d98('0x17')](0xcc)[_0x8d98('0x25')]();});}};}function handleEntityNotFound(_0x128668,_0x6fa42b){return function(_0x3a8fd6){if(!_0x3a8fd6){_0x128668[_0x8d98('0x16')](0x194);}return _0x3a8fd6;};}function handleError(_0x2da954,_0x44428c){_0x44428c=_0x44428c||0x1f4;return function(_0x272f2c){logger['error'](_0x272f2c[_0x8d98('0x26')]);if(_0x272f2c['name']){delete _0x272f2c[_0x8d98('0x27')];}_0x2da954[_0x8d98('0x17')](_0x44428c)[_0x8d98('0x28')](_0x272f2c);};}exports[_0x8d98('0x29')]=function(_0xd8b8db,_0x43ac6f){var _0x2c0af7={},_0x2535b3={},_0x253275={'count':0x0,'rows':[]};return db['CmCompany'][_0x8d98('0x2a')]()[_0x8d98('0x21')](function(_0x5c5662){_0x2535b3[_0x8d98('0x2b')]=_[_0x8d98('0x2c')](_0x5c5662);_0x2535b3[_0x8d98('0x2d')]=_[_0x8d98('0x2c')](_0xd8b8db[_0x8d98('0x2d')]);_0x2535b3[_0x8d98('0x2e')]=_[_0x8d98('0x2f')](_0x2535b3[_0x8d98('0x2b')],_0x2535b3[_0x8d98('0x2d')]);_0x2c0af7[_0x8d98('0x30')]=_['intersection'](_0x2535b3[_0x8d98('0x2b')],qs[_0x8d98('0x31')](_0xd8b8db[_0x8d98('0x2d')][_0x8d98('0x31')]));_0x2c0af7[_0x8d98('0x30')]=_0x2c0af7['attributes'][_0x8d98('0x32')]?_0x2c0af7[_0x8d98('0x30')]:_0x2535b3[_0x8d98('0x2b')];if(!_0xd8b8db['query']['hasOwnProperty'](_0x8d98('0x33'))){_0x2c0af7['limit']=qs[_0x8d98('0x1b')](_0xd8b8db[_0x8d98('0x2d')][_0x8d98('0x1b')]);_0x2c0af7['offset']=qs[_0x8d98('0x19')](_0xd8b8db[_0x8d98('0x2d')][_0x8d98('0x19')]);}_0x2c0af7[_0x8d98('0x34')]=qs['sort'](_0xd8b8db[_0x8d98('0x2d')][_0x8d98('0x35')]);_0x2c0af7[_0x8d98('0x36')]=qs[_0x8d98('0x2e')](_[_0x8d98('0x37')](_0xd8b8db[_0x8d98('0x2d')],_0x2535b3[_0x8d98('0x2e')]),_0x5c5662);if(_0xd8b8db['query'][_0x8d98('0x38')]){_0x2c0af7[_0x8d98('0x36')]=_[_0x8d98('0x39')](_0x2c0af7[_0x8d98('0x36')],{'$or':_[_0x8d98('0x3a')](_0x2c0af7[_0x8d98('0x30')],function(_0x5b6604){var _0x57b6f7={};_0x57b6f7[_0x5b6604]={'$like':'%'+_0xd8b8db['query'][_0x8d98('0x38')]+'%'};return _0x57b6f7;})});}_0x2c0af7=_[_0x8d98('0x39')]({},_0x2c0af7,_0xd8b8db['options']);var _0x1577e5={'where':_0x2c0af7['where']};return db['CmCompany'][_0x8d98('0x1c')](_0x1577e5)['then'](function(_0x4be3a7){_0x253275[_0x8d98('0x1c')]=_0x4be3a7;if(_0xd8b8db[_0x8d98('0x2d')][_0x8d98('0x3b')]){_0x2c0af7[_0x8d98('0x3c')]=[{'all':!![]}];}return db[_0x8d98('0x3d')][_0x8d98('0x3e')](_0x2c0af7);})[_0x8d98('0x21')](function(_0xf12333){_0x253275[_0x8d98('0x3f')]=_0xf12333;return _0x253275;})[_0x8d98('0x21')](respondWithFilteredResult(_0x43ac6f,_0x2c0af7))[_0x8d98('0x40')](handleError(_0x43ac6f,null));})['catch'](handleError(_0x43ac6f,null));};exports[_0x8d98('0x41')]=function(_0x142271,_0x167a18){var _0x21246b={'raw':![],'where':{'id':_0x142271[_0x8d98('0x42')]['id']}},_0x174af8={};_0x174af8[_0x8d98('0x2b')]=_['keys'](db['CmCompany'][_0x8d98('0x43')]);_0x174af8[_0x8d98('0x2d')]=_[_0x8d98('0x2c')](_0x142271['query']);_0x174af8[_0x8d98('0x2e')]=_[_0x8d98('0x2f')](_0x174af8[_0x8d98('0x2b')],_0x174af8[_0x8d98('0x2d')]);_0x21246b[_0x8d98('0x30')]=_['intersection'](_0x174af8['model'],qs[_0x8d98('0x31')](_0x142271[_0x8d98('0x2d')][_0x8d98('0x31')]));_0x21246b[_0x8d98('0x30')]=_0x21246b[_0x8d98('0x30')][_0x8d98('0x32')]?_0x21246b['attributes']:_0x174af8[_0x8d98('0x2b')];if(_0x142271[_0x8d98('0x2d')][_0x8d98('0x3b')]){_0x21246b[_0x8d98('0x3c')]=[{'all':!![]}];}_0x21246b=_[_0x8d98('0x39')]({},_0x21246b,_0x142271[_0x8d98('0x44')]);return db[_0x8d98('0x3d')][_0x8d98('0x45')](_0x21246b)['then'](handleEntityNotFound(_0x167a18,null))[_0x8d98('0x21')](respondWithResult(_0x167a18,null))[_0x8d98('0x40')](handleError(_0x167a18,null));};exports[_0x8d98('0x46')]=function(_0x18bb9a,_0x262637){return db['CmCompany']['create'](_0x18bb9a['body'],{})['then'](function(_0x1a0cc0){var _0x2013e6=_0x18bb9a[_0x8d98('0x47')]['get']({'plain':!![]});if(!_0x2013e6)throw new Error(_0x8d98('0x48'));if(_0x2013e6[_0x8d98('0x49')]==='user'){var _0x5b5c05=_0x1a0cc0['get']({'plain':!![]});var _0x56b8b5='Companies';return db[_0x8d98('0x4a')][_0x8d98('0x45')]({'where':{'name':_0x56b8b5,'userProfileId':_0x2013e6[_0x8d98('0x4b')]},'raw':!![]})[_0x8d98('0x21')](function(_0x3e8cb0){if(_0x3e8cb0&&_0x3e8cb0[_0x8d98('0x4c')]===0x0){return db[_0x8d98('0x4d')][_0x8d98('0x46')]({'name':_0x5b5c05[_0x8d98('0x27')],'resourceId':_0x5b5c05['id'],'type':_0x3e8cb0['name'],'sectionId':_0x3e8cb0['id']},{})[_0x8d98('0x21')](function(){return _0x1a0cc0;});}else{return _0x1a0cc0;}})[_0x8d98('0x40')](function(_0x55d84f){logger[_0x8d98('0x4e')](_0x8d98('0x4f'),_0x55d84f);throw _0x55d84f;});}return _0x1a0cc0;})[_0x8d98('0x21')](respondWithResult(_0x262637,0xc9))[_0x8d98('0x40')](handleError(_0x262637,null));};exports[_0x8d98('0x20')]=function(_0x1da66a,_0x576067){if(_0x1da66a[_0x8d98('0x50')]['id']){delete _0x1da66a['body']['id'];}return db[_0x8d98('0x3d')]['find']({'where':{'id':_0x1da66a[_0x8d98('0x42')]['id']}})[_0x8d98('0x21')](handleEntityNotFound(_0x576067,null))[_0x8d98('0x21')](saveUpdates(_0x1da66a['body'],null))[_0x8d98('0x21')](respondWithResult(_0x576067,null))[_0x8d98('0x40')](handleError(_0x576067,null));};exports[_0x8d98('0x22')]=function(_0x1c278a,_0x396f80){return db['CmCompany'][_0x8d98('0x45')]({'where':{'id':_0x1c278a[_0x8d98('0x42')]['id']}})[_0x8d98('0x21')](handleEntityNotFound(_0x396f80,null))[_0x8d98('0x21')](removeEntity(_0x396f80,null))[_0x8d98('0x40')](handleError(_0x396f80,null));};exports['describe']=function(_0x5d9683,_0xab54f6){return db[_0x8d98('0x3d')][_0x8d98('0x2a')]()[_0x8d98('0x21')](respondWithResult(_0xab54f6,null))[_0x8d98('0x40')](handleError(_0xab54f6,null));};exports['addContacts']=function(_0x3e36fc,_0x5451b2,_0x522e95){return db[_0x8d98('0x51')][_0x8d98('0x45')]({'where':{'id':_0x3e36fc['params']['id']}})['then'](handleEntityNotFound(_0x5451b2,null))[_0x8d98('0x21')](function(_0x20a5b2){if(_0x20a5b2){return _0x20a5b2[_0x8d98('0x52')](_0x3e36fc['body'][_0x8d98('0x53')],_[_0x8d98('0x54')](_0x3e36fc[_0x8d98('0x50')],[_0x8d98('0x53'),'id'])||{});}})[_0x8d98('0x21')](respondWithResult(_0x5451b2,null))[_0x8d98('0x40')](handleError(_0x5451b2,null));};exports[_0x8d98('0x55')]=function(_0x5f19a8,_0x59320b,_0x36ada2){var _0x503bab={};var _0x14023e={};var _0x5a0b54;var _0x1b71fd;return db['CmCompany'][_0x8d98('0x56')]({'where':{'id':_0x5f19a8[_0x8d98('0x42')]['id']}})[_0x8d98('0x21')](handleEntityNotFound(_0x59320b,null))[_0x8d98('0x21')](function(_0x2a762e){if(_0x2a762e){_0x5a0b54=_0x2a762e;_0x14023e[_0x8d98('0x2b')]=_[_0x8d98('0x2c')](db['CmContact'][_0x8d98('0x43')]);_0x14023e[_0x8d98('0x2d')]=_[_0x8d98('0x2c')](_0x5f19a8[_0x8d98('0x2d')]);_0x14023e[_0x8d98('0x2e')]=_[_0x8d98('0x2f')](_0x14023e['model'],_0x14023e[_0x8d98('0x2d')]);_0x503bab['attributes']=_[_0x8d98('0x2f')](_0x14023e[_0x8d98('0x2b')],qs[_0x8d98('0x31')](_0x5f19a8['query'][_0x8d98('0x31')]));_0x503bab[_0x8d98('0x30')]=_0x503bab['attributes']['length']?_0x503bab[_0x8d98('0x30')]:_0x14023e[_0x8d98('0x2b')];_0x503bab['order']=qs[_0x8d98('0x35')](_0x5f19a8[_0x8d98('0x2d')][_0x8d98('0x35')]);_0x503bab[_0x8d98('0x36')]=qs[_0x8d98('0x2e')](_[_0x8d98('0x37')](_0x5f19a8[_0x8d98('0x2d')],_0x14023e[_0x8d98('0x2e')]));if(_0x5f19a8[_0x8d98('0x2d')][_0x8d98('0x38')]){_0x503bab[_0x8d98('0x36')]=_[_0x8d98('0x39')](_0x503bab[_0x8d98('0x36')],{'$or':_['map'](_0x503bab[_0x8d98('0x30')],function(_0x53e7cd){var _0x1a712a={};_0x1a712a[_0x53e7cd]={'$like':'%'+_0x5f19a8[_0x8d98('0x2d')]['filter']+'%'};return _0x1a712a;})});}_0x503bab=_['merge']({},_0x503bab,_0x5f19a8[_0x8d98('0x44')]);return _0x5a0b54[_0x8d98('0x55')](_0x503bab);}})[_0x8d98('0x21')](function(_0x106c12){if(_0x106c12){_0x1b71fd=_0x106c12[_0x8d98('0x32')];if(!_0x5f19a8['query']['hasOwnProperty'](_0x8d98('0x33'))){_0x503bab['limit']=qs['limit'](_0x5f19a8[_0x8d98('0x2d')][_0x8d98('0x1b')]);_0x503bab[_0x8d98('0x19')]=qs[_0x8d98('0x19')](_0x5f19a8[_0x8d98('0x2d')][_0x8d98('0x19')]);}return _0x5a0b54[_0x8d98('0x55')](_0x503bab);}})[_0x8d98('0x21')](function(_0x439a1c){if(_0x439a1c){return _0x439a1c?{'count':_0x1b71fd,'rows':_0x439a1c}:null;}})[_0x8d98('0x21')](respondWithResult(_0x59320b,null))[_0x8d98('0x40')](handleError(_0x59320b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 74c7274..72fad3b 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 _0xb44c=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0xb44c,0x6c));var _0xcb44=function(_0x1ae78f,_0x122ed2){_0x1ae78f=_0x1ae78f-0x0;var _0x5baf80=_0xb44c[_0x1ae78f];return _0x5baf80;};'use strict';var _=require(_0xcb44('0x0'));var util=require(_0xcb44('0x1'));var logger=require('../../config/logger')(_0xcb44('0x2'));var moment=require('moment');var BPromise=require(_0xcb44('0x3'));var rp=require(_0xcb44('0x4'));var fs=require('fs');var path=require(_0xcb44('0x5'));var rimraf=require(_0xcb44('0x6'));var config=require(_0xcb44('0x7'));var attributes=require(_0xcb44('0x8'));module['exports']=function(_0x40c1a8,_0x12fc2a){return _0x40c1a8[_0xcb44('0x9')](_0xcb44('0xa'),attributes,{'tableName':_0xcb44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x726f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies'];(function(_0x19e777,_0x1a59ec){var _0x2e91f1=function(_0x320dfb){while(--_0x320dfb){_0x19e777['push'](_0x19e777['shift']());}};_0x2e91f1(++_0x1a59ec);}(_0x726f,0xc3));var _0xf726=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x726f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var logger=require(_0xf726('0x2'))(_0xf726('0x3'));var moment=require('moment');var BPromise=require(_0xf726('0x4'));var rp=require(_0xf726('0x5'));var fs=require('fs');var path=require(_0xf726('0x6'));var rimraf=require(_0xf726('0x7'));var config=require(_0xf726('0x8'));var attributes=require(_0xf726('0x9'));module[_0xf726('0xa')]=function(_0x348b49,_0xd8a692){return _0x348b49[_0xf726('0xb')]('CmCompany',attributes,{'tableName':_0xf726('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index c5d27f7..f54aa03 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 _0xc3ec=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc3ec,0x13f));var _0xcc3e=function(_0x455616,_0x5c5d00){_0x455616=_0x455616-0x0;var _0x249090=_0xc3ec[_0x455616];return _0x249090;};'use strict';var _=require(_0xcc3e('0x0'));var util=require(_0xcc3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc3e('0x2'));var fs=require('fs');var Redis=require(_0xcc3e('0x3'));var db=require(_0xcc3e('0x4'))['db'];var utils=require(_0xcc3e('0x5'));var logger=require(_0xcc3e('0x6'))(_0xcc3e('0x7'));var config=require(_0xcc3e('0x8'));var jayson=require(_0xcc3e('0x9'));var client=jayson[_0xcc3e('0xa')][_0xcc3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cab51,_0x3987d4,_0x474cdf){return new BPromise(function(_0x153542,_0xb2445b){return client[_0xcc3e('0xc')](_0x3cab51,_0x474cdf)[_0xcc3e('0xd')](function(_0x388f8b){logger['info'](_0xcc3e('0xe'),_0x3987d4,_0xcc3e('0xf'));logger[_0xcc3e('0x10')](_0xcc3e('0x11'),_0x3987d4,'request\x20sent',JSON[_0xcc3e('0x12')](_0x388f8b));if(_0x388f8b['error']){if(_0x388f8b[_0xcc3e('0x13')][_0xcc3e('0x14')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x3987d4,_0x388f8b[_0xcc3e('0x13')][_0xcc3e('0x15')]);return _0xb2445b(_0x388f8b['error'][_0xcc3e('0x15')]);}logger[_0xcc3e('0x13')](_0xcc3e('0xe'),_0x3987d4,_0x388f8b[_0xcc3e('0x13')][_0xcc3e('0x15')]);return _0x153542(_0x388f8b[_0xcc3e('0x13')][_0xcc3e('0x15')]);}else{logger[_0xcc3e('0x16')](_0xcc3e('0xe'),_0x3987d4,_0xcc3e('0xf'));_0x153542(_0x388f8b[_0xcc3e('0x17')][_0xcc3e('0x15')]);}})['catch'](function(_0x5d83a4){logger['error'](_0xcc3e('0xe'),_0x3987d4,_0x5d83a4);_0xb2445b(_0x5d83a4);});});} \ No newline at end of file +var _0x35ea=['then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','CmCompany,\x20%s,\x20%s','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x59f860,_0x24716c){var _0x2d558a=function(_0x474b8a){while(--_0x474b8a){_0x59f860['push'](_0x59f860['shift']());}};_0x2d558a(++_0x24716c);}(_0x35ea,0x1d8));var _0xa35e=function(_0xa270f3,_0x293fd){_0xa270f3=_0xa270f3-0x0;var _0x48767f=_0x35ea[_0xa270f3];return _0x48767f;};'use strict';var _=require('lodash');var util=require(_0xa35e('0x0'));var moment=require(_0xa35e('0x1'));var BPromise=require(_0xa35e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa35e('0x3'));var db=require(_0xa35e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa35e('0x5'))(_0xa35e('0x6'));var config=require(_0xa35e('0x7'));var jayson=require(_0xa35e('0x8'));var client=jayson[_0xa35e('0x9')][_0xa35e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x337a92,_0x5827b8,_0x1df997){return new BPromise(function(_0x1a2986,_0x1b58c9){return client[_0xa35e('0xb')](_0x337a92,_0x1df997)[_0xa35e('0xc')](function(_0xb2dd18){logger['info']('CmCompany,\x20%s,\x20%s',_0x5827b8,_0xa35e('0xd'));logger[_0xa35e('0xe')](_0xa35e('0xf'),_0x5827b8,_0xa35e('0xd'),JSON[_0xa35e('0x10')](_0xb2dd18));if(_0xb2dd18['error']){if(_0xb2dd18['error'][_0xa35e('0x11')]===0x1f4){logger[_0xa35e('0x12')]('CmCompany,\x20%s,\x20%s',_0x5827b8,_0xb2dd18[_0xa35e('0x12')][_0xa35e('0x13')]);return _0x1b58c9(_0xb2dd18[_0xa35e('0x12')][_0xa35e('0x13')]);}logger[_0xa35e('0x12')]('CmCompany,\x20%s,\x20%s',_0x5827b8,_0xb2dd18[_0xa35e('0x12')]['message']);return _0x1a2986(_0xb2dd18[_0xa35e('0x12')][_0xa35e('0x13')]);}else{logger[_0xa35e('0x14')]('CmCompany,\x20%s,\x20%s',_0x5827b8,_0xa35e('0xd'));_0x1a2986(_0xb2dd18['result']['message']);}})['catch'](function(_0x1c1e53){logger[_0xa35e('0x12')](_0xa35e('0x15'),_0x5827b8,_0x1c1e53);_0x1b58c9(_0x1c1e53);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 035d9e0..545175d 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 _0x9c4a=['./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','post','create','addContacts','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x9c4a,0x1dd));var _0xa9c4=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x9c4a[_0x136619];return _0x38c4a5;};'use strict';var multer=require('multer');var util=require(_0xa9c4('0x0'));var path=require('path');var timeout=require(_0xa9c4('0x1'));var express=require(_0xa9c4('0x2'));var router=express['Router']();var fs_extra=require(_0xa9c4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c4('0x4'));var config=require(_0xa9c4('0x5'));var controller=require(_0xa9c4('0x6'));router[_0xa9c4('0x7')]('/',auth[_0xa9c4('0x8')](),controller[_0xa9c4('0x9')]);router[_0xa9c4('0x7')](_0xa9c4('0xa'),auth[_0xa9c4('0x8')](),controller[_0xa9c4('0xb')]);router[_0xa9c4('0x7')](_0xa9c4('0xc'),auth[_0xa9c4('0x8')](),controller[_0xa9c4('0xd')]);router[_0xa9c4('0x7')](_0xa9c4('0xe'),auth[_0xa9c4('0x8')](),controller['getContacts']);router[_0xa9c4('0xf')]('/',auth[_0xa9c4('0x8')](),controller[_0xa9c4('0x10')]);router[_0xa9c4('0xf')](_0xa9c4('0xe'),auth[_0xa9c4('0x8')](),controller[_0xa9c4('0x11')]);router['put'](_0xa9c4('0xc'),auth[_0xa9c4('0x8')](),controller[_0xa9c4('0x12')]);router[_0xa9c4('0x13')](_0xa9c4('0xc'),auth[_0xa9c4('0x8')](),controller['destroy']);module[_0xa9c4('0x14')]=router; \ No newline at end of file +var _0x61e0=['post','create','addContacts','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x61e0,0x187));var _0x061e=function(_0xa2374f,_0x392586){_0xa2374f=_0xa2374f-0x0;var _0x3751fb=_0x61e0[_0xa2374f];return _0x3751fb;};'use strict';var multer=require(_0x061e('0x0'));var util=require(_0x061e('0x1'));var path=require(_0x061e('0x2'));var timeout=require('connect-timeout');var express=require(_0x061e('0x3'));var router=express[_0x061e('0x4')]();var fs_extra=require(_0x061e('0x5'));var auth=require(_0x061e('0x6'));var interaction=require(_0x061e('0x7'));var config=require(_0x061e('0x8'));var controller=require('./cmCompany.controller');router[_0x061e('0x9')]('/',auth[_0x061e('0xa')](),controller[_0x061e('0xb')]);router[_0x061e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x061e('0xc')]);router[_0x061e('0x9')](_0x061e('0xd'),auth[_0x061e('0xa')](),controller[_0x061e('0xe')]);router[_0x061e('0x9')](_0x061e('0xf'),auth[_0x061e('0xa')](),controller[_0x061e('0x10')]);router[_0x061e('0x11')]('/',auth[_0x061e('0xa')](),controller[_0x061e('0x12')]);router['post'](_0x061e('0xf'),auth[_0x061e('0xa')](),controller[_0x061e('0x13')]);router[_0x061e('0x14')](_0x061e('0xd'),auth[_0x061e('0xa')](),controller[_0x061e('0x15')]);router[_0x061e('0x16')](_0x061e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x061e('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index b66cb98..82f48b3 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 _0x4e1e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x4e1e,0xfb));var _0xe4e1=function(_0x434804,_0x415f68){_0x434804=_0x434804-0x0;var _0x573fc8=_0x4e1e[_0x434804];return _0x573fc8;};'use strict';var _=require(_0xe4e1('0x0'));var Sequelize=require('sequelize');module[_0xe4e1('0x1')]={'firstName':{'type':Sequelize[_0xe4e1('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xe4e1('0x2')]},'postalCode':{'type':Sequelize[_0xe4e1('0x2')]},'city':{'type':Sequelize[_0xe4e1('0x2')]},'country':{'type':Sequelize[_0xe4e1('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe4e1('0x2')]},'description':{'type':Sequelize[_0xe4e1('0x3')]},'phone':{'type':Sequelize[_0xe4e1('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xe4e1('0x2')]},'email':{'type':Sequelize[_0xe4e1('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe4e1('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xe4e1('0x2')]},'viber':{'type':Sequelize[_0xe4e1('0x2')]},'line':{'type':Sequelize[_0xe4e1('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xe4e1('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xe4e1('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe4e1('0x5')],'defaultValue':Sequelize[_0xe4e1('0x6')]}}; \ No newline at end of file +var _0x8ffe=['NOW','lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x202570,_0x2d7b65){var _0x1a0277=function(_0x2f5f55){while(--_0x2f5f55){_0x202570['push'](_0x202570['shift']());}};_0x1a0277(++_0x2d7b65);}(_0x8ffe,0x1b9));var _0xe8ff=function(_0x482e66,_0x93401f){_0x482e66=_0x482e66-0x0;var _0x8905a3=_0x8ffe[_0x482e66];return _0x8905a3;};'use strict';var _=require(_0xe8ff('0x0'));var Sequelize=require(_0xe8ff('0x1'));module[_0xe8ff('0x2')]={'firstName':{'type':Sequelize[_0xe8ff('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe8ff('0x3')]},'street':{'type':Sequelize[_0xe8ff('0x3')]},'postalCode':{'type':Sequelize[_0xe8ff('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xe8ff('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xe8ff('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe8ff('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xe8ff('0x3')]},'fb_data':{'type':Sequelize[_0xe8ff('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xe8ff('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xe8ff('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe8ff('0x4')]},'priority':{'type':Sequelize[_0xe8ff('0x4')](0x2)[_0xe8ff('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe8ff('0x6')],'defaultValue':Sequelize[_0xe8ff('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 681de6c..c0319cf 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 _0x8efa=['color','format','cf_%d','$and','pickBy','cm_contacts','setFields','toParam','phone','getTags','findOne','rawAttributes','pick','options','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','parse','import','No\x20ListId\x20specified','fork','../../components/import/cm/csv2','stringify','pid','exit','error\x20child\x20process','mail','chat','sms','openchannel','fax','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','findAndCountAll','startCase','Website','closed','closedAt','secondDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','subject','substatus','externalUrl','threadId','Interaction','sortBy','slice','moment','path','lodash','squel','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','json','offset','undefined','count','limit','set','Content-Range','update','then','status','end','sendStatus','error','stack','name','send','index','CmContact','describe','length','keys','startsWith','CmCustomField','all','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','select','field','from','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','split','map','union','User','value','dateOfBirth','fieldType','castTo','DATE','buildExpression','type','start','filter','isNil','Contact','isEmpty','forEach','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','role','user','agent','sequelize','toString','keyBy','merge','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','push','rows','catch','destroy','params','tags','cf_','columnName','findAll','displayName','alias','custom','values','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','spread','show'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x8efa,0x67));var _0xa8ef=function(_0x552291,_0x37ae2f){_0x552291=_0x552291-0x0;var _0x4985c2=_0x8efa[_0x552291];return _0x4985c2;};'use strict';var moment=require(_0xa8ef('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xa8ef('0x1'));var fs=require('fs');var _=require(_0xa8ef('0x2'));var squel=require(_0xa8ef('0x3'));var Papa=require(_0xa8ef('0x4'));var Redis=require(_0xa8ef('0x5'));var qs=require('../../components/parsers/qs');var as=require(_0xa8ef('0x6'));var logger=require(_0xa8ef('0x7'))(_0xa8ef('0x8'));var config=require(_0xa8ef('0x9'));var db=require(_0xa8ef('0xa'))['db'];config[_0xa8ef('0xb')]=_['defaults'](config[_0xa8ef('0xb')],{'host':_0xa8ef('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8ef('0xb')]));require('./cmContact.socket')[_0xa8ef('0xd')](socket);function respondWithResult(_0x59d198,_0x520cc9){_0x520cc9=_0x520cc9||0xc8;return function(_0x42a377){if(_0x42a377){return _0x59d198['status'](_0x520cc9)[_0xa8ef('0xe')](_0x42a377);}};}function respondWithFilteredResult(_0x4565ed,_0x2ceaa6){return function(_0x1ccda2){if(_0x1ccda2){var _0x7c2f41=typeof _0x2ceaa6[_0xa8ef('0xf')]===_0xa8ef('0x10')&&typeof _0x2ceaa6['limit']===_0xa8ef('0x10');var _0x1c825e=_0x1ccda2[_0xa8ef('0x11')];var _0x4576c9=_0x7c2f41?0x0:_0x2ceaa6[_0xa8ef('0xf')];var _0x34e6ff=_0x7c2f41?_0x1ccda2[_0xa8ef('0x11')]:_0x2ceaa6[_0xa8ef('0xf')]+_0x2ceaa6[_0xa8ef('0x12')];var _0x535193;if(_0x34e6ff>=_0x1c825e){_0x34e6ff=_0x1c825e;_0x535193=0xc8;}else{_0x535193=0xce;}_0x4565ed['status'](_0x535193);return _0x4565ed[_0xa8ef('0x13')](_0xa8ef('0x14'),_0x4576c9+'-'+_0x34e6ff+'/'+_0x1c825e)[_0xa8ef('0xe')](_0x1ccda2);}return null;};}function saveUpdates(_0x191526){return function(_0x58d4eb){if(_0x58d4eb){return _0x58d4eb[_0xa8ef('0x15')](_0x191526)[_0xa8ef('0x16')](function(_0x4f74c4){return _0x4f74c4;});}return null;};}function removeEntity(_0x35729e){return function(_0x5562f6){if(_0x5562f6){return _0x5562f6['destroy']()['then'](function(){_0x35729e[_0xa8ef('0x17')](0xcc)[_0xa8ef('0x18')]();});}};}function handleEntityNotFound(_0x297711){return function(_0xdfe9a2){if(!_0xdfe9a2){_0x297711[_0xa8ef('0x19')](0x194);}return _0xdfe9a2;};}function handleError(_0x5de257,_0x225132){_0x225132=_0x225132||0x1f4;return function(_0x2f0dee){logger[_0xa8ef('0x1a')](_0x2f0dee[_0xa8ef('0x1b')]);if(_0x2f0dee[_0xa8ef('0x1c')]){delete _0x2f0dee[_0xa8ef('0x1c')];}_0x5de257[_0xa8ef('0x17')](_0x225132)[_0xa8ef('0x1d')](_0x2f0dee);};}exports[_0xa8ef('0x1e')]=function(_0x3345be,_0x370af0){var _0x2e483={},_0x43041c={},_0x258951={'count':0x0,'rows':[]};return db[_0xa8ef('0x1f')][_0xa8ef('0x20')]()[_0xa8ef('0x16')](function(_0x4b36e2){var _0xdbad8d=[];for(var _0x504b0e=0x0;_0x504b0e0x1){_0x65c7d0['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa8ef('0x59')](_0x559d8b),null);}else{if(qs[_0xa8ef('0x5a')](_0x559d8b)){_0x65c7d0['or'](_0xa8ef('0x5b'),_0x559d8b+'%');_0x65c7d0['or'](_0xa8ef('0x5c'),_0x559d8b+'%');_0x65c7d0['or'](_0xa8ef('0x5d'),_0x559d8b+'%');_0x65c7d0['or'](_0xa8ef('0x5e'),_0x559d8b+'%');}else if(qs['isEmail'](_0x559d8b)){_0x65c7d0['or'](_0xa8ef('0x5f'),_0x559d8b+'%');}else{_0x65c7d0['or'](_0xa8ef('0x60'),'%'+_0x559d8b+'%');_0x65c7d0['or']('c.lastName\x20LIKE\x20?','%'+_0x559d8b+'%');_0x65c7d0['or'](_0xa8ef('0x5f'),'%'+_0x559d8b+'%');}}}}_0x447ce3[_0xa8ef('0x38')](_0x65c7d0);_0x447ce3[_0xa8ef('0x61')](_0xa8ef('0x62'));var _0x16816e={'type':db[_0xa8ef('0x63')][_0xa8ef('0x64')]['SELECT'],'raw':!![]};var _0x170726=_0x447ce3[_0xa8ef('0x65')]()[_0xa8ef('0x31')](_0xa8ef('0x62'));if(_0x2e483[_0xa8ef('0x2e')]){_0x2e483[_0xa8ef('0x2e')]['forEach'](function(_0x388b48){_0x447ce3[_0xa8ef('0x2e')]('c.'+_0x388b48[0x0],_0x388b48[0x1]===_0xa8ef('0x66')?![]:!![]);});}if(!_[_0xa8ef('0x4f')](_0x1aeb9d)){_0x447ce3[_0xa8ef('0x67')](_0xbc5dec);_0x170726[_0xa8ef('0x38')](_0xa8ef('0x68'),_0x1aeb9d);}BPromise['resolve']()['then'](function(){if(!_0xde2778)return;if(_0x3345be['user'][_0xa8ef('0x69')]!=='agent')return;if(!_['some'](_0xde2778[_0xa8ef('0x3d')],[_0xa8ef('0x31'),_0xa8ef('0x43')])){return _0x3345be[_0xa8ef('0x6a')]['getLists']({'attributes':['id'],'raw':!![]})[_0xa8ef('0x16')](function(_0x4dd273){if(_[_0xa8ef('0x4f')](_0x4dd273)){_0x170726[_0xa8ef('0x38')]('c.ListId\x20IS\x20NULL');_0x447ce3[_0xa8ef('0x38')]('c.ListId\x20IS\x20NULL');}else{_0x170726[_0xa8ef('0x38')]('c.ListId\x20IN\x20?',_[_0xa8ef('0x41')](_0x4dd273,'id'));_0x447ce3[_0xa8ef('0x38')]('c.ListId\x20IN\x20?',_['map'](_0x4dd273,'id'));}});}})[_0xa8ef('0x16')](function(){if(_0x3345be[_0xa8ef('0x6a')][_0xa8ef('0x69')]===_0xa8ef('0x6b')&&!_0xde2778&&!_0x3345be[_0xa8ef('0x27')][_0xa8ef('0x51')])return[];return db[_0xa8ef('0x6c')][_0xa8ef('0x27')](_0x170726[_0xa8ef('0x6d')](),_0x16816e);})[_0xa8ef('0x16')](function(_0x906fad){_0x258951[_0xa8ef('0x11')]=_0x906fad[_0xa8ef('0x21')];if(_0x258951[_0xa8ef('0x11')]===0x0)return[];return db[_0xa8ef('0x6c')][_0xa8ef('0x27')](_0x1db17a['toString'](),_0x16816e)[_0xa8ef('0x16')](function(_0x313dd2){_0x414030=_[_0xa8ef('0x6e')](_0x313dd2,'id');_0x16816e=_[_0xa8ef('0x6f')](_0x16816e,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3345be[_0xa8ef('0x27')][_0xa8ef('0x2b')]){_0x2e483[_0xa8ef('0x29')][_0xa8ef('0x50')](function(_0x1f1645){_0x447ce3[_0xa8ef('0x31')]('c.'+_0x1f1645);});}else{_0x447ce3[_0xa8ef('0x31')](_0xa8ef('0x62'));_0x447ce3['field']('c.firstName');_0x447ce3[_0xa8ef('0x31')]('c.lastName');_0x447ce3['field']('c.phone');_0x447ce3[_0xa8ef('0x31')](_0xa8ef('0x70'));_0x447ce3[_0xa8ef('0x31')](_0xa8ef('0x71'));_0x447ce3['field'](_0xa8ef('0x72'));_0x447ce3[_0xa8ef('0x31')](_0xa8ef('0x73'));_0x447ce3[_0xa8ef('0x31')](_0xa8ef('0x74'));_0x447ce3[_0xa8ef('0x31')](_0xa8ef('0x75'));_0x447ce3[_0xa8ef('0x31')](_0xa8ef('0x76'));_0x447ce3['field'](_0xa8ef('0x77'),_0xa8ef('0x78'));}if(_0x2e483['limit'])_0x447ce3[_0xa8ef('0x12')](_0x2e483[_0xa8ef('0x12')]);if(_0x2e483['offset'])_0x447ce3[_0xa8ef('0xf')](_0x2e483[_0xa8ef('0xf')]);return db[_0xa8ef('0x6c')][_0xa8ef('0x27')](_0x447ce3[_0xa8ef('0x6d')](),_0x16816e);});})[_0xa8ef('0x16')](function(_0x27c454){_0x27c454[_0xa8ef('0x50')](function(_0x53a1fe){if(_0x53a1fe[_0xa8ef('0x78')]){_0x53a1fe['Tags']=[];_0x53a1fe['TagIds'][_0xa8ef('0x40')](',')['forEach'](function(_0xd23f1c){_0x53a1fe[_0xa8ef('0x79')][_0xa8ef('0x7a')](_0x414030[_0xd23f1c]);});}delete _0x53a1fe[_0xa8ef('0x78')];});_0x258951[_0xa8ef('0x7b')]=_0x27c454;return _0x258951;})[_0xa8ef('0x16')](respondWithFilteredResult(_0x370af0,_0x2e483));})[_0xa8ef('0x7c')](handleError(_0x370af0,null));};exports[_0xa8ef('0x7d')]=function(_0x586c29,_0x314700){return db['CmContact']['find']({'where':{'id':_0x586c29[_0xa8ef('0x7e')]['id']}})[_0xa8ef('0x16')](handleEntityNotFound(_0x314700,null))[_0xa8ef('0x16')](removeEntity(_0x314700,null))[_0xa8ef('0x7c')](handleError(_0x314700,null));};exports[_0xa8ef('0x20')]=function(_0x168346,_0x1dc205){return db[_0xa8ef('0x1f')][_0xa8ef('0x20')]()[_0xa8ef('0x16')](function(_0x5eb87d){delete _0x5eb87d[_0xa8ef('0x7f')];for(var _0x4f3fcb=0x0;_0x4f3fcb=_0x5d4149){_0x59f54c=_0x5d4149;_0x300074=0xc8;}else{_0x300074=0xce;}_0x12a375['status'](_0x300074);return _0x12a375['set'](_0xe037('0x16'),_0x225824+'-'+_0x59f54c+'/'+_0x5d4149)[_0xe037('0x11')](_0x4a95f7);}return null;};}function saveUpdates(_0xa4a401){return function(_0x255388){if(_0x255388){return _0x255388[_0xe037('0x17')](_0xa4a401)['then'](function(_0xa12858){return _0xa12858;});}return null;};}function removeEntity(_0x1dda2b){return function(_0x1034b6){if(_0x1034b6){return _0x1034b6['destroy']()['then'](function(){_0x1dda2b[_0xe037('0x10')](0xcc)[_0xe037('0x18')]();});}};}function handleEntityNotFound(_0x26fa05){return function(_0x81cae){if(!_0x81cae){_0x26fa05[_0xe037('0x19')](0x194);}return _0x81cae;};}function handleError(_0x4b54c6,_0x5d2677){_0x5d2677=_0x5d2677||0x1f4;return function(_0x1365f7){logger['error'](_0x1365f7[_0xe037('0x1a')]);if(_0x1365f7['name']){delete _0x1365f7[_0xe037('0x1b')];}_0x4b54c6[_0xe037('0x10')](_0x5d2677)[_0xe037('0x1c')](_0x1365f7);};}exports[_0xe037('0x1d')]=function(_0x571adf,_0x4b6fe0){var _0x204a03={},_0x188ee5={},_0x2637f6={'count':0x0,'rows':[]};return db[_0xe037('0x1e')][_0xe037('0x1f')]()['then'](function(_0x1286ba){var _0x13b840=[];for(var _0x117214=0x0;_0x1172140x1){_0x4c8b3a['or'](_0xe037('0x5a'),qs[_0xe037('0x5b')](_0x494eac),null);}else{if(qs[_0xe037('0x5c')](_0x494eac)){_0x4c8b3a['or'](_0xe037('0x5d'),_0x494eac+'%');_0x4c8b3a['or'](_0xe037('0x5e'),_0x494eac+'%');_0x4c8b3a['or']('c.mobile\x20LIKE\x20?',_0x494eac+'%');_0x4c8b3a['or'](_0xe037('0x5f'),_0x494eac+'%');}else if(qs['isEmail'](_0x494eac)){_0x4c8b3a['or'](_0xe037('0x60'),_0x494eac+'%');}else{_0x4c8b3a['or'](_0xe037('0x61'),'%'+_0x494eac+'%');_0x4c8b3a['or'](_0xe037('0x62'),'%'+_0x494eac+'%');_0x4c8b3a['or'](_0xe037('0x60'),'%'+_0x494eac+'%');}}}}_0x2c9291[_0xe037('0x32')](_0x4c8b3a);_0x2c9291[_0xe037('0x63')](_0xe037('0x64'));var _0x17a7de={'type':db['Sequelize'][_0xe037('0x65')]['SELECT'],'raw':!![]};var _0x3179bc=_0x2c9291['clone']()[_0xe037('0x34')](_0xe037('0x64'));if(_0x204a03[_0xe037('0x30')]){_0x204a03[_0xe037('0x30')][_0xe037('0x47')](function(_0x134551){_0x2c9291['order']('c.'+_0x134551[0x0],_0x134551[0x1]===_0xe037('0x66')?![]:!![]);});}if(!_[_0xe037('0x53')](_0x4848aa)){_0x2c9291[_0xe037('0x67')](_0x28d11f);_0x3179bc[_0xe037('0x32')](_0xe037('0x68'),_0x4848aa);}BPromise[_0xe037('0x69')]()[_0xe037('0x26')](function(){if(!_0x3b2527)return;if(_0x571adf[_0xe037('0x6a')][_0xe037('0x6b')]!==_0xe037('0x6c'))return;if(!_[_0xe037('0x6d')](_0x3b2527['conditions'],['field',_0xe037('0x49')])){return _0x571adf['user'][_0xe037('0x6e')]({'attributes':['id'],'raw':!![]})[_0xe037('0x26')](function(_0x2f2021){if(_[_0xe037('0x53')](_0x2f2021)){_0x3179bc[_0xe037('0x32')](_0xe037('0x6f'));_0x2c9291['where'](_0xe037('0x6f'));}else{_0x3179bc[_0xe037('0x32')]('c.ListId\x20IN\x20?',_['map'](_0x2f2021,'id'));_0x2c9291[_0xe037('0x32')](_0xe037('0x54'),_['map'](_0x2f2021,'id'));}});}})[_0xe037('0x26')](function(){if(_0x571adf[_0xe037('0x6a')][_0xe037('0x6b')]==='agent'&&!_0x3b2527&&!_0x571adf['query'][_0xe037('0x70')])return[];return db[_0xe037('0x71')][_0xe037('0x29')](_0x3179bc[_0xe037('0x72')](),_0x17a7de);})[_0xe037('0x26')](function(_0x38ea44){_0x2637f6[_0xe037('0x15')]=_0x38ea44[_0xe037('0x21')];if(_0x2637f6[_0xe037('0x15')]===0x0)return[];return db[_0xe037('0x71')][_0xe037('0x29')](_0x248b47[_0xe037('0x72')](),_0x17a7de)['then'](function(_0x543f51){_0x36ec77=_['keyBy'](_0x543f51,'id');_0x17a7de=_[_0xe037('0x73')](_0x17a7de,{'model':db[_0xe037('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x571adf[_0xe037('0x29')][_0xe037('0x2d')]){_0x204a03[_0xe037('0x2c')][_0xe037('0x47')](function(_0x4151f1){_0x2c9291[_0xe037('0x34')]('c.'+_0x4151f1);});}else{_0x2c9291[_0xe037('0x34')]('c.id');_0x2c9291[_0xe037('0x34')](_0xe037('0x74'));_0x2c9291[_0xe037('0x34')](_0xe037('0x75'));_0x2c9291['field'](_0xe037('0x76'));_0x2c9291[_0xe037('0x34')]('c.mobile');_0x2c9291['field']('c.fax');_0x2c9291[_0xe037('0x34')](_0xe037('0x77'));_0x2c9291['field']('c.ListId');_0x2c9291[_0xe037('0x34')](_0xe037('0x78'));_0x2c9291['field'](_0xe037('0x79'));_0x2c9291[_0xe037('0x34')](_0xe037('0x7a'));_0x2c9291[_0xe037('0x34')](_0xe037('0x7b'),'TagIds');}if(_0x204a03[_0xe037('0x14')])_0x2c9291[_0xe037('0x14')](_0x204a03[_0xe037('0x14')]);if(_0x204a03['offset'])_0x2c9291[_0xe037('0x12')](_0x204a03[_0xe037('0x12')]);return db['sequelize'][_0xe037('0x29')](_0x2c9291[_0xe037('0x72')](),_0x17a7de);});})[_0xe037('0x26')](function(_0x1c2c25){_0x1c2c25['forEach'](function(_0x39b6fd){if(_0x39b6fd[_0xe037('0x7c')]){_0x39b6fd[_0xe037('0x7d')]=[];_0x39b6fd['TagIds'][_0xe037('0x45')](',')[_0xe037('0x47')](function(_0x211201){_0x39b6fd['Tags'][_0xe037('0x7e')](_0x36ec77[_0x211201]);});}delete _0x39b6fd[_0xe037('0x7c')];});_0x2637f6[_0xe037('0x7f')]=_0x1c2c25;return _0x2637f6;})[_0xe037('0x26')](respondWithFilteredResult(_0x4b6fe0,_0x204a03));})[_0xe037('0x80')](handleError(_0x4b6fe0,null));};exports['destroy']=function(_0x3e7899,_0x2f644d){return db[_0xe037('0x1e')][_0xe037('0x81')]({'where':{'id':_0x3e7899[_0xe037('0x82')]['id']}})[_0xe037('0x26')](handleEntityNotFound(_0x2f644d,null))[_0xe037('0x26')](removeEntity(_0x2f644d,null))[_0xe037('0x80')](handleError(_0x2f644d,null));};exports[_0xe037('0x1f')]=function(_0x352808,_0x4a7d20){return db[_0xe037('0x1e')]['describe']()[_0xe037('0x26')](function(_0x3606fd){delete _0x3606fd[_0xe037('0x83')];for(var _0x1087e6=0x0;_0x1087e6{}\s\\|]/g,'-');_0x51c95d(null,util[_0x00ea('0x23')](_0x00ea('0x24'),path[_0x00ea('0x25')](_0x267a94['originalname'],path['extname'](_0x267a94[_0x00ea('0x21')])),Date['now'](),path[_0x00ea('0x26')](_0x267a94['originalname'])));}})});router[_0x00ea('0x19')](_0x00ea('0x27'),upload[_0x00ea('0x28')](_0x00ea('0x29')),controller[_0x00ea('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x37e773,_0x2ec248,_0x17be04){_0x17be04(null,path['join'](config[_0x00ea('0x1f')],'server/files/tmp'));},'filename':function(_0x21e449,_0x375668,_0x17c38f){_0x375668['originalname']=_0x375668[_0x00ea('0x21')][_0x00ea('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17c38f(null,util[_0x00ea('0x23')](_0x00ea('0x24'),path[_0x00ea('0x25')](_0x375668[_0x00ea('0x21')],path['extname'](_0x375668[_0x00ea('0x21')])),Date['now'](),path['extname'](_0x375668[_0x00ea('0x21')])));}})});router['post'](_0x00ea('0x2b'),upload['single'](_0x00ea('0x29')),controller['upload']);router[_0x00ea('0x19')]('/upload/:id',auth[_0x00ea('0x8')](),controller[_0x00ea('0x2c')]);router[_0x00ea('0x2d')]('/:id',auth[_0x00ea('0x8')](),controller['update']);router[_0x00ea('0x2e')](_0x00ea('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x00ea('0x2f')]=router; \ No newline at end of file +var _0x09e5=['single','file','server/files/tmp','/upload','import','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','setTags','join','root','originalname','replace','format','%s-%s%s','basename','now','extname','/csv'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x09e5,0x1a8));var _0x509e=function(_0x196c66,_0x64f618){_0x196c66=_0x196c66-0x0;var _0x27c9bf=_0x09e5[_0x196c66];return _0x27c9bf;};'use strict';var multer=require(_0x509e('0x0'));var util=require(_0x509e('0x1'));var path=require(_0x509e('0x2'));var timeout=require(_0x509e('0x3'));var express=require(_0x509e('0x4'));var router=express[_0x509e('0x5')]();var fs_extra=require(_0x509e('0x6'));var auth=require(_0x509e('0x7'));var interaction=require(_0x509e('0x8'));var config=require(_0x509e('0x9'));var controller=require('./cmContact.controller');router[_0x509e('0xa')]('/',auth[_0x509e('0xb')](),controller[_0x509e('0xc')]);router[_0x509e('0xa')]('/describe',auth[_0x509e('0xb')](),controller[_0x509e('0xd')]);router['get'](_0x509e('0xe'),auth[_0x509e('0xb')](),controller[_0x509e('0xf')]);router['get']('/:id/tags',auth[_0x509e('0xb')](),controller[_0x509e('0x10')]);router['get'](_0x509e('0x11'),auth[_0x509e('0xb')](),controller[_0x509e('0x12')]);router[_0x509e('0xa')]('/:id/hopper_histories',auth[_0x509e('0xb')](),controller[_0x509e('0x13')]);router[_0x509e('0xa')](_0x509e('0x14'),auth[_0x509e('0xb')](),controller[_0x509e('0x15')]);router[_0x509e('0xa')](_0x509e('0x16'),auth[_0x509e('0xb')](),controller[_0x509e('0x17')]);router[_0x509e('0xa')](_0x509e('0x18'),auth[_0x509e('0xb')](),controller[_0x509e('0x19')]);router[_0x509e('0x1a')](_0x509e('0x1b'),auth[_0x509e('0xb')](),controller[_0x509e('0x1c')]);router[_0x509e('0x1a')]('/',auth['isAuthenticated'](),controller[_0x509e('0x1d')]);router[_0x509e('0x1a')](_0x509e('0x1e'),auth[_0x509e('0xb')](),controller[_0x509e('0x1f')]);router[_0x509e('0x1a')](_0x509e('0x20'),auth[_0x509e('0xb')](),controller[_0x509e('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x54642e,_0x4e37bf,_0x231134){_0x231134(null,path[_0x509e('0x22')](config[_0x509e('0x23')],'server/files/tmp'));},'filename':function(_0x18b174,_0x5d51e4,_0x1eb133){_0x5d51e4['originalname']=_0x5d51e4[_0x509e('0x24')][_0x509e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1eb133(null,util[_0x509e('0x26')](_0x509e('0x27'),path[_0x509e('0x28')](_0x5d51e4[_0x509e('0x24')],path['extname'](_0x5d51e4['originalname'])),Date[_0x509e('0x29')](),path[_0x509e('0x2a')](_0x5d51e4[_0x509e('0x24')])));}})});router[_0x509e('0x1a')](_0x509e('0x2b'),upload[_0x509e('0x2c')](_0x509e('0x2d')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x302a31,_0x35a378,_0x36bc73){_0x36bc73(null,path['join'](config[_0x509e('0x23')],_0x509e('0x2e')));},'filename':function(_0x1c90c8,_0x19bf98,_0x3fd843){_0x19bf98[_0x509e('0x24')]=_0x19bf98[_0x509e('0x24')][_0x509e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3fd843(null,util[_0x509e('0x26')](_0x509e('0x27'),path[_0x509e('0x28')](_0x19bf98[_0x509e('0x24')],path['extname'](_0x19bf98[_0x509e('0x24')])),Date['now'](),path[_0x509e('0x2a')](_0x19bf98[_0x509e('0x24')])));}})});router[_0x509e('0x1a')](_0x509e('0x2f'),upload[_0x509e('0x2c')]('file'),controller['upload']);router[_0x509e('0x1a')]('/upload/:id',auth[_0x509e('0xb')](),controller[_0x509e('0x30')]);router[_0x509e('0x31')](_0x509e('0xe'),auth[_0x509e('0xb')](),controller[_0x509e('0x32')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x509e('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 890dcac..b16b1f2 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 _0xb36f=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','long','type','select','values','isArray','stringify'];(function(_0x26c2c0,_0xf435cd){var _0x599c35=function(_0x231d53){while(--_0x231d53){_0x26c2c0['push'](_0x26c2c0['shift']());}};_0x599c35(++_0xf435cd);}(_0xb36f,0xc9));var _0xfb36=function(_0x6c6997,_0x3b6dd5){_0x6c6997=_0x6c6997-0x0;var _0x1be516=_0xb36f[_0x6c6997];return _0x1be516;};'use strict';var Sequelize=require(_0xfb36('0x0'));var _=require(_0xfb36('0x1'));module[_0xfb36('0x2')]={'name':{'type':Sequelize[_0xfb36('0x3')],'get':function(_0x323dcd){return this[_0xfb36('0x4')](_0xfb36('0x5'));}},'alias':{'type':Sequelize[_0xfb36('0x6')],'allowNull':![],'set':function(_0x3328f1){this[_0xfb36('0x7')]('alias',_0x3328f1?_0x3328f1:this[_0xfb36('0x4')]('name'));}},'type':{'type':Sequelize[_0xfb36('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xfb36('0x8')](_0xfb36('0x9')),'get':function(){if(this[_0xfb36('0x4')](_0xfb36('0xa'))===_0xfb36('0xb')){return JSON['parse'](this['getDataValue'](_0xfb36('0xc')));}else{return this[_0xfb36('0x4')](_0xfb36('0xc'));}},'set':function(_0x43a36b){if(Array[_0xfb36('0xd')](_0x43a36b)){this[_0xfb36('0x7')](_0xfb36('0xc'),JSON[_0xfb36('0xe')](_0x43a36b));}else{this[_0xfb36('0x7')](_0xfb36('0xc'),_0x43a36b);}}},'required':{'type':Sequelize[_0xfb36('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xfb36('0x10')](_0xfb36('0x11'))}}; \ No newline at end of file +var _0x6521=['stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','type','select','parse','values','isArray','setDataValue'];(function(_0x45b232,_0x41e26a){var _0x4df393=function(_0x1e9f3e){while(--_0x1e9f3e){_0x45b232['push'](_0x45b232['shift']());}};_0x4df393(++_0x41e26a);}(_0x6521,0x100));var _0x1652=function(_0x3de8a2,_0x1c8615){_0x3de8a2=_0x3de8a2-0x0;var _0x267573=_0x6521[_0x3de8a2];return _0x267573;};'use strict';var Sequelize=require(_0x1652('0x0'));var _=require(_0x1652('0x1'));module[_0x1652('0x2')]={'name':{'type':Sequelize[_0x1652('0x3')],'get':function(_0x79ec70){return this[_0x1652('0x4')](_0x1652('0x5'));}},'alias':{'type':Sequelize[_0x1652('0x6')],'allowNull':![],'set':function(_0x3efabf){this['setDataValue'](_0x1652('0x5'),_0x3efabf?_0x3efabf:this[_0x1652('0x4')](_0x1652('0x7')));}},'type':{'type':Sequelize[_0x1652('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x1652('0x4')](_0x1652('0x8'))===_0x1652('0x9')){return JSON[_0x1652('0xa')](this['getDataValue'](_0x1652('0xb')));}else{return this['getDataValue'](_0x1652('0xb'));}},'set':function(_0x43270f){if(Array[_0x1652('0xc')](_0x43270f)){this[_0x1652('0xd')](_0x1652('0xb'),JSON[_0x1652('0xe')](_0x43270f));}else{this[_0x1652('0xd')]('values',_0x43270f);}}},'required':{'type':Sequelize[_0x1652('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1652('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1652('0x10')](_0x1652('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 740f16c..a4cd1c0 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 _0x948d=['create','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','includeAll','include','rows','catch','params','length','options','find','body'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x948d,0x15e));var _0xd948=function(_0x18c87b,_0x1ed7fb){_0x18c87b=_0x18c87b-0x0;var _0x1314a1=_0x948d[_0x18c87b];return _0x1314a1;};'use strict';var emlformat=require(_0xd948('0x0'));var rimraf=require(_0xd948('0x1'));var zipdir=require(_0xd948('0x2'));var jsonpatch=require(_0xd948('0x3'));var rp=require(_0xd948('0x4'));var moment=require('moment');var BPromise=require(_0xd948('0x5'));var Mustache=require('mustache');var util=require(_0xd948('0x6'));var path=require(_0xd948('0x7'));var sox=require(_0xd948('0x8'));var csv=require(_0xd948('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd948('0xa'));var _=require(_0xd948('0xb'));var squel=require('squel');var crypto=require(_0xd948('0xc'));var jsforce=require(_0xd948('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd948('0x9'));var querystring=require(_0xd948('0xe'));var Papa=require(_0xd948('0xf'));var Redis=require(_0xd948('0x10'));var authService=require(_0xd948('0x11'));var qs=require(_0xd948('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd948('0x13'));var utils=require(_0xd948('0x14'));var config=require(_0xd948('0x15'));var licenseUtil=require(_0xd948('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ca21c,_0x40991e){_0x40991e=_0x40991e||0xcc;return function(_0x5e0bc9){if(_0x5e0bc9){return _0x4ca21c[_0xd948('0x17')](_0x40991e);}return _0x4ca21c[_0xd948('0x18')](_0x40991e)['end']();};}function respondWithResult(_0x18b8a3,_0x5ae925){_0x5ae925=_0x5ae925||0xc8;return function(_0x1b0336){if(_0x1b0336){return _0x18b8a3[_0xd948('0x18')](_0x5ae925)[_0xd948('0x19')](_0x1b0336);}};}function respondWithFilteredResult(_0x3e7eb5,_0xaf1101){return function(_0x3470ae){if(_0x3470ae){var _0x3870fa=typeof _0xaf1101[_0xd948('0x1a')]===_0xd948('0x1b')&&typeof _0xaf1101[_0xd948('0x1c')]==='undefined';var _0x2c6091=_0x3470ae[_0xd948('0x1d')];var _0x524d00=_0x3870fa?0x0:_0xaf1101[_0xd948('0x1a')];var _0x4099e6=_0x3870fa?_0x3470ae['count']:_0xaf1101['offset']+_0xaf1101[_0xd948('0x1c')];var _0x444bab;if(_0x4099e6>=_0x2c6091){_0x4099e6=_0x2c6091;_0x444bab=0xc8;}else{_0x444bab=0xce;}_0x3e7eb5[_0xd948('0x18')](_0x444bab);return _0x3e7eb5['set'](_0xd948('0x1e'),_0x524d00+'-'+_0x4099e6+'/'+_0x2c6091)[_0xd948('0x19')](_0x3470ae);}return null;};}function patchUpdates(_0x2e72c3){return function(_0x11bbb8){try{jsonpatch[_0xd948('0x1f')](_0x11bbb8,_0x2e72c3,!![]);}catch(_0x34aa7d){return BPromise['reject'](_0x34aa7d);}return _0x11bbb8[_0xd948('0x20')]();};}function saveUpdates(_0x2d2f57,_0x4aabee){return function(_0x1be587){if(_0x1be587){return _0x1be587[_0xd948('0x21')](_0x2d2f57)[_0xd948('0x22')](function(_0x23eadb){return _0x23eadb;});}return null;};}function removeEntity(_0x4177db,_0x1bca39){return function(_0x5990c9){if(_0x5990c9){return _0x5990c9[_0xd948('0x23')]()[_0xd948('0x22')](function(){_0x4177db[_0xd948('0x18')](0xcc)[_0xd948('0x24')]();});}};}function handleEntityNotFound(_0xa41281,_0x5454a3){return function(_0x5716b0){if(!_0x5716b0){_0xa41281[_0xd948('0x17')](0x194);}return _0x5716b0;};}function handleError(_0x3cff7d,_0x150909){_0x150909=_0x150909||0x1f4;return function(_0x533665){logger[_0xd948('0x25')](_0x533665[_0xd948('0x26')]);if(_0x533665['name']){delete _0x533665[_0xd948('0x27')];}_0x3cff7d[_0xd948('0x18')](_0x150909)[_0xd948('0x28')](_0x533665);};}exports['index']=function(_0x1fbe1f,_0x87b82b){var _0x9f22fa={},_0x149f06={},_0x4f5913={'count':0x0,'rows':[]};var _0x392e6e=_['map'](db[_0xd948('0x29')][_0xd948('0x2a')],function(_0x1e778c){return{'name':_0x1e778c[_0xd948('0x2b')],'type':_0x1e778c[_0xd948('0x2c')][_0xd948('0x2d')]};});_0x149f06[_0xd948('0x2e')]=_[_0xd948('0x2f')](_['map'](_0x392e6e,_0xd948('0x27')),[_0xd948('0x27')]);_0x149f06[_0xd948('0x30')]=_[_0xd948('0x31')](_0x1fbe1f['query']);_0x149f06[_0xd948('0x32')]=_[_0xd948('0x33')](_0x149f06['model'],_0x149f06[_0xd948('0x30')]);_0x9f22fa[_0xd948('0x34')]=_[_0xd948('0x33')](_0x149f06['model'],qs[_0xd948('0x35')](_0x1fbe1f[_0xd948('0x30')][_0xd948('0x35')]));_0x9f22fa[_0xd948('0x34')]=_0x9f22fa['attributes']['length']?_0x9f22fa[_0xd948('0x34')]:_0x149f06[_0xd948('0x2e')];if(!_0x1fbe1f[_0xd948('0x30')]['hasOwnProperty'](_0xd948('0x36'))){_0x9f22fa[_0xd948('0x1c')]=qs[_0xd948('0x1c')](_0x1fbe1f[_0xd948('0x30')][_0xd948('0x1c')]);_0x9f22fa[_0xd948('0x1a')]=qs[_0xd948('0x1a')](_0x1fbe1f[_0xd948('0x30')][_0xd948('0x1a')]);}_0x9f22fa['order']=qs['sort'](_0x1fbe1f[_0xd948('0x30')][_0xd948('0x37')]);_0x9f22fa[_0xd948('0x38')]=qs[_0xd948('0x32')](_[_0xd948('0x39')](_0x1fbe1f[_0xd948('0x30')],_0x149f06[_0xd948('0x32')]),_0x392e6e);if(_0x1fbe1f[_0xd948('0x30')][_0xd948('0x3a')]){_0x9f22fa[_0xd948('0x38')]=_[_0xd948('0x3b')](_0x9f22fa[_0xd948('0x38')],{'$or':_[_0xd948('0x3c')](_0x392e6e,function(_0x329dc5){if(_0x329dc5[_0xd948('0x2c')]!=='VIRTUAL'){var _0x5698de={};_0x5698de[_0x329dc5[_0xd948('0x27')]]={'$like':'%'+_0x1fbe1f[_0xd948('0x30')]['filter']+'%'};return _0x5698de;}})});}_0x9f22fa=_['merge']({},_0x9f22fa,_0x1fbe1f['options']);var _0x593de2={'where':_0x9f22fa['where']};return db['CmCustomField'][_0xd948('0x1d')](_0x593de2)[_0xd948('0x22')](function(_0xf44a7a){_0x4f5913[_0xd948('0x1d')]=_0xf44a7a;if(_0x1fbe1f[_0xd948('0x30')][_0xd948('0x3d')]){_0x9f22fa[_0xd948('0x3e')]=[{'all':!![]}];}return db[_0xd948('0x29')]['findAll'](_0x9f22fa);})[_0xd948('0x22')](function(_0x360800){_0x4f5913[_0xd948('0x3f')]=_0x360800;return _0x4f5913;})[_0xd948('0x22')](respondWithFilteredResult(_0x87b82b,_0x9f22fa))[_0xd948('0x40')](handleError(_0x87b82b,null));};exports['show']=function(_0x4b27bb,_0x5763e1){var _0x337973={'raw':!![],'where':{'id':_0x4b27bb[_0xd948('0x41')]['id']}},_0x78ee51={};_0x78ee51[_0xd948('0x2e')]=_[_0xd948('0x31')](db[_0xd948('0x29')][_0xd948('0x2a')]);_0x78ee51['query']=_[_0xd948('0x31')](_0x4b27bb[_0xd948('0x30')]);_0x78ee51[_0xd948('0x32')]=_[_0xd948('0x33')](_0x78ee51[_0xd948('0x2e')],_0x78ee51['query']);_0x337973['attributes']=_[_0xd948('0x33')](_0x78ee51['model'],qs[_0xd948('0x35')](_0x4b27bb[_0xd948('0x30')][_0xd948('0x35')]));_0x337973['attributes']=_0x337973['attributes'][_0xd948('0x42')]?_0x337973[_0xd948('0x34')]:_0x78ee51[_0xd948('0x2e')];if(_0x4b27bb[_0xd948('0x30')][_0xd948('0x3d')]){_0x337973[_0xd948('0x3e')]=[{'all':!![]}];}_0x337973=_[_0xd948('0x3b')]({},_0x337973,_0x4b27bb[_0xd948('0x43')]);return db['CmCustomField'][_0xd948('0x44')](_0x337973)[_0xd948('0x22')](handleEntityNotFound(_0x5763e1,null))[_0xd948('0x22')](respondWithResult(_0x5763e1,null))[_0xd948('0x40')](handleError(_0x5763e1,null));};exports[_0xd948('0x21')]=function(_0x94767d,_0x5919f2){if(_0x94767d[_0xd948('0x45')]['id']){delete _0x94767d[_0xd948('0x45')]['id'];}return db['CmCustomField'][_0xd948('0x44')]({'where':{'id':_0x94767d[_0xd948('0x41')]['id']}})['then'](handleEntityNotFound(_0x5919f2,null))[_0xd948('0x22')](saveUpdates(_0x94767d['body'],null))['then'](respondWithResult(_0x5919f2,null))['catch'](handleError(_0x5919f2,null));};exports['destroy']=function(_0xbc1dba,_0x16c799){return db['CmCustomField'][_0xd948('0x44')]({'where':{'id':_0xbc1dba[_0xd948('0x41')]['id']}})[_0xd948('0x22')](handleEntityNotFound(_0x16c799,null))[_0xd948('0x22')](removeEntity(_0x16c799,null))[_0xd948('0x40')](handleError(_0x16c799,null));};exports[_0xd948('0x46')]=function(_0x4ddcc8,_0x4b26ac){var _0x4a9c0b;return db['sequelize'][_0xd948('0x47')](function(_0x51e5f0){return db['CmCustomField'][_0xd948('0x46')](_0x4ddcc8[_0xd948('0x45')],{'transaction':_0x51e5f0})[_0xd948('0x22')](function(_0x52ef71){_0x4a9c0b=_0x52ef71;var _0xea4554={'type':db[_0xd948('0x48')]['TEXT'],'transaction':_0x51e5f0};switch(_0x4ddcc8[_0xd948('0x45')][_0xd948('0x2c')]){case'text':_0xea4554[_0xd948('0x2c')]=db[_0xd948('0x48')][_0xd948('0x49')];break;case _0xd948('0x4a'):_0xea4554[_0xd948('0x2c')]=db[_0xd948('0x48')][_0xd948('0x4b')];break;case _0xd948('0x4c'):_0xea4554[_0xd948('0x2c')]=db[_0xd948('0x48')][_0xd948('0x4d')];_0xea4554[_0xd948('0x4e')]=![];break;default:}return db[_0xd948('0x4f')][_0xd948('0x50')][_0xd948('0x51')](_0xd948('0x52'),util['format'](_0xd948('0x53'),_0x4a9c0b['id']),_0xea4554);})[_0xd948('0x22')](function(){return _0x4a9c0b;});})['then'](respondWithResult(_0x4b26ac,0xc9))[_0xd948('0x40')](handleError(_0x4b26ac,null));}; \ No newline at end of file +var _0x5e7c=['limit','count','status','set','Content-Range','apply','save','update','then','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','show','params','length','include','find','catch','body','destroy','create','sequelize','transaction','TEXT','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e7c,0x91));var _0xc5e7=function(_0x5b4cc1,_0x20f414){_0x5b4cc1=_0x5b4cc1-0x0;var _0x4f012c=_0x5e7c[_0x5b4cc1];return _0x4f012c;};'use strict';var emlformat=require(_0xc5e7('0x0'));var rimraf=require(_0xc5e7('0x1'));var zipdir=require(_0xc5e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5e7('0x3'));var moment=require(_0xc5e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc5e7('0x5'));var util=require(_0xc5e7('0x6'));var path=require(_0xc5e7('0x7'));var sox=require(_0xc5e7('0x8'));var csv=require(_0xc5e7('0x9'));var ejs=require(_0xc5e7('0xa'));var fs=require('fs');var fs_extra=require(_0xc5e7('0xb'));var _=require(_0xc5e7('0xc'));var squel=require('squel');var crypto=require(_0xc5e7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc5e7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5e7('0xf'));var Papa=require(_0xc5e7('0x10'));var Redis=require(_0xc5e7('0x11'));var authService=require(_0xc5e7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc5e7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc5e7('0x14'));var utils=require(_0xc5e7('0x15'));var config=require(_0xc5e7('0x16'));var licenseUtil=require(_0xc5e7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x146089,_0x25422d){_0x25422d=_0x25422d||0xcc;return function(_0x3107a5){if(_0x3107a5){return _0x146089[_0xc5e7('0x18')](_0x25422d);}return _0x146089['status'](_0x25422d)[_0xc5e7('0x19')]();};}function respondWithResult(_0x41d0b7,_0x2b3844){_0x2b3844=_0x2b3844||0xc8;return function(_0x4ae392){if(_0x4ae392){return _0x41d0b7['status'](_0x2b3844)[_0xc5e7('0x1a')](_0x4ae392);}};}function respondWithFilteredResult(_0x5436d0,_0x36c097){return function(_0x35a410){if(_0x35a410){var _0x324388=typeof _0x36c097[_0xc5e7('0x1b')]===_0xc5e7('0x1c')&&typeof _0x36c097[_0xc5e7('0x1d')]===_0xc5e7('0x1c');var _0x380c99=_0x35a410[_0xc5e7('0x1e')];var _0x29c70d=_0x324388?0x0:_0x36c097[_0xc5e7('0x1b')];var _0x49115d=_0x324388?_0x35a410[_0xc5e7('0x1e')]:_0x36c097['offset']+_0x36c097['limit'];var _0x5d1b56;if(_0x49115d>=_0x380c99){_0x49115d=_0x380c99;_0x5d1b56=0xc8;}else{_0x5d1b56=0xce;}_0x5436d0[_0xc5e7('0x1f')](_0x5d1b56);return _0x5436d0[_0xc5e7('0x20')](_0xc5e7('0x21'),_0x29c70d+'-'+_0x49115d+'/'+_0x380c99)[_0xc5e7('0x1a')](_0x35a410);}return null;};}function patchUpdates(_0x824d2f){return function(_0x1a089f){try{jsonpatch[_0xc5e7('0x22')](_0x1a089f,_0x824d2f,!![]);}catch(_0x4bf462){return BPromise['reject'](_0x4bf462);}return _0x1a089f[_0xc5e7('0x23')]();};}function saveUpdates(_0x2e6e6d,_0xb25a51){return function(_0x2d9eeb){if(_0x2d9eeb){return _0x2d9eeb[_0xc5e7('0x24')](_0x2e6e6d)['then'](function(_0x29bbdf){return _0x29bbdf;});}return null;};}function removeEntity(_0x29b473,_0x35eeb8){return function(_0x30ad90){if(_0x30ad90){return _0x30ad90['destroy']()[_0xc5e7('0x25')](function(){_0x29b473[_0xc5e7('0x1f')](0xcc)[_0xc5e7('0x19')]();});}};}function handleEntityNotFound(_0x548ae3,_0x2d0439){return function(_0x3b6ec1){if(!_0x3b6ec1){_0x548ae3['sendStatus'](0x194);}return _0x3b6ec1;};}function handleError(_0x4aec38,_0x52f88d){_0x52f88d=_0x52f88d||0x1f4;return function(_0x1b109c){logger[_0xc5e7('0x26')](_0x1b109c[_0xc5e7('0x27')]);if(_0x1b109c[_0xc5e7('0x28')]){delete _0x1b109c[_0xc5e7('0x28')];}_0x4aec38['status'](_0x52f88d)['send'](_0x1b109c);};}exports[_0xc5e7('0x29')]=function(_0x10bb87,_0x45fb43){var _0x1d0622={},_0x5acb30={},_0x16fc38={'count':0x0,'rows':[]};var _0x5ab6e7=_[_0xc5e7('0x2a')](db[_0xc5e7('0x2b')][_0xc5e7('0x2c')],function(_0x5135f4){return{'name':_0x5135f4[_0xc5e7('0x2d')],'type':_0x5135f4[_0xc5e7('0x2e')][_0xc5e7('0x2f')]};});_0x5acb30[_0xc5e7('0x30')]=_[_0xc5e7('0x31')](_[_0xc5e7('0x2a')](_0x5ab6e7,_0xc5e7('0x28')),['name']);_0x5acb30[_0xc5e7('0x32')]=_[_0xc5e7('0x33')](_0x10bb87[_0xc5e7('0x32')]);_0x5acb30[_0xc5e7('0x34')]=_['intersection'](_0x5acb30[_0xc5e7('0x30')],_0x5acb30[_0xc5e7('0x32')]);_0x1d0622[_0xc5e7('0x35')]=_[_0xc5e7('0x36')](_0x5acb30['model'],qs[_0xc5e7('0x37')](_0x10bb87['query'][_0xc5e7('0x37')]));_0x1d0622[_0xc5e7('0x35')]=_0x1d0622[_0xc5e7('0x35')]['length']?_0x1d0622[_0xc5e7('0x35')]:_0x5acb30[_0xc5e7('0x30')];if(!_0x10bb87[_0xc5e7('0x32')][_0xc5e7('0x38')](_0xc5e7('0x39'))){_0x1d0622[_0xc5e7('0x1d')]=qs['limit'](_0x10bb87[_0xc5e7('0x32')][_0xc5e7('0x1d')]);_0x1d0622[_0xc5e7('0x1b')]=qs[_0xc5e7('0x1b')](_0x10bb87['query'][_0xc5e7('0x1b')]);}_0x1d0622['order']=qs[_0xc5e7('0x3a')](_0x10bb87['query'][_0xc5e7('0x3a')]);_0x1d0622['where']=qs['filters'](_['pick'](_0x10bb87[_0xc5e7('0x32')],_0x5acb30[_0xc5e7('0x34')]),_0x5ab6e7);if(_0x10bb87['query'][_0xc5e7('0x3b')]){_0x1d0622[_0xc5e7('0x3c')]=_[_0xc5e7('0x3d')](_0x1d0622['where'],{'$or':_[_0xc5e7('0x2a')](_0x5ab6e7,function(_0x4ffbe5){if(_0x4ffbe5[_0xc5e7('0x2e')]!==_0xc5e7('0x3e')){var _0x582247={};_0x582247[_0x4ffbe5[_0xc5e7('0x28')]]={'$like':'%'+_0x10bb87['query'][_0xc5e7('0x3b')]+'%'};return _0x582247;}})});}_0x1d0622=_[_0xc5e7('0x3d')]({},_0x1d0622,_0x10bb87[_0xc5e7('0x3f')]);var _0x240d56={'where':_0x1d0622[_0xc5e7('0x3c')]};return db['CmCustomField'][_0xc5e7('0x1e')](_0x240d56)[_0xc5e7('0x25')](function(_0x95835e){_0x16fc38[_0xc5e7('0x1e')]=_0x95835e;if(_0x10bb87['query'][_0xc5e7('0x40')]){_0x1d0622['include']=[{'all':!![]}];}return db[_0xc5e7('0x2b')]['findAll'](_0x1d0622);})[_0xc5e7('0x25')](function(_0x5796b8){_0x16fc38['rows']=_0x5796b8;return _0x16fc38;})[_0xc5e7('0x25')](respondWithFilteredResult(_0x45fb43,_0x1d0622))['catch'](handleError(_0x45fb43,null));};exports[_0xc5e7('0x41')]=function(_0x19b23c,_0x366159){var _0x393ace={'raw':!![],'where':{'id':_0x19b23c[_0xc5e7('0x42')]['id']}},_0x560866={};_0x560866[_0xc5e7('0x30')]=_[_0xc5e7('0x33')](db[_0xc5e7('0x2b')][_0xc5e7('0x2c')]);_0x560866['query']=_['keys'](_0x19b23c['query']);_0x560866[_0xc5e7('0x34')]=_['intersection'](_0x560866[_0xc5e7('0x30')],_0x560866[_0xc5e7('0x32')]);_0x393ace[_0xc5e7('0x35')]=_[_0xc5e7('0x36')](_0x560866[_0xc5e7('0x30')],qs[_0xc5e7('0x37')](_0x19b23c['query'][_0xc5e7('0x37')]));_0x393ace['attributes']=_0x393ace[_0xc5e7('0x35')][_0xc5e7('0x43')]?_0x393ace[_0xc5e7('0x35')]:_0x560866['model'];if(_0x19b23c[_0xc5e7('0x32')][_0xc5e7('0x40')]){_0x393ace[_0xc5e7('0x44')]=[{'all':!![]}];}_0x393ace=_[_0xc5e7('0x3d')]({},_0x393ace,_0x19b23c['options']);return db[_0xc5e7('0x2b')][_0xc5e7('0x45')](_0x393ace)[_0xc5e7('0x25')](handleEntityNotFound(_0x366159,null))[_0xc5e7('0x25')](respondWithResult(_0x366159,null))[_0xc5e7('0x46')](handleError(_0x366159,null));};exports[_0xc5e7('0x24')]=function(_0x2f34f7,_0x255d47){if(_0x2f34f7[_0xc5e7('0x47')]['id']){delete _0x2f34f7[_0xc5e7('0x47')]['id'];}return db['CmCustomField'][_0xc5e7('0x45')]({'where':{'id':_0x2f34f7[_0xc5e7('0x42')]['id']}})[_0xc5e7('0x25')](handleEntityNotFound(_0x255d47,null))[_0xc5e7('0x25')](saveUpdates(_0x2f34f7[_0xc5e7('0x47')],null))[_0xc5e7('0x25')](respondWithResult(_0x255d47,null))['catch'](handleError(_0x255d47,null));};exports[_0xc5e7('0x48')]=function(_0x54e21e,_0x477507){return db[_0xc5e7('0x2b')][_0xc5e7('0x45')]({'where':{'id':_0x54e21e[_0xc5e7('0x42')]['id']}})[_0xc5e7('0x25')](handleEntityNotFound(_0x477507,null))[_0xc5e7('0x25')](removeEntity(_0x477507,null))[_0xc5e7('0x46')](handleError(_0x477507,null));};exports[_0xc5e7('0x49')]=function(_0x8f2244,_0x57c16f){var _0x3867cc;return db[_0xc5e7('0x4a')][_0xc5e7('0x4b')](function(_0x34f0f7){return db[_0xc5e7('0x2b')][_0xc5e7('0x49')](_0x8f2244['body'],{'transaction':_0x34f0f7})[_0xc5e7('0x25')](function(_0x46141c){_0x3867cc=_0x46141c;var _0x5799f6={'type':db['Sequelize'][_0xc5e7('0x4c')],'transaction':_0x34f0f7};switch(_0x8f2244[_0xc5e7('0x47')]['type']){case'text':_0x5799f6[_0xc5e7('0x2e')]=db[_0xc5e7('0x4d')][_0xc5e7('0x4c')];break;case _0xc5e7('0x4e'):_0x5799f6[_0xc5e7('0x2e')]=db[_0xc5e7('0x4d')][_0xc5e7('0x4f')];break;case _0xc5e7('0x50'):_0x5799f6[_0xc5e7('0x2e')]=db[_0xc5e7('0x4d')]['BOOLEAN'];_0x5799f6[_0xc5e7('0x51')]=![];break;default:}return db[_0xc5e7('0x4a')][_0xc5e7('0x52')][_0xc5e7('0x53')](_0xc5e7('0x54'),util[_0xc5e7('0x55')](_0xc5e7('0x56'),_0x3867cc['id']),_0x5799f6);})[_0xc5e7('0x25')](function(){return _0x3867cc;});})['then'](respondWithResult(_0x57c16f,0xc9))[_0xc5e7('0x46')](handleError(_0x57c16f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fcfda46..6789236 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 _0x6569=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','request-promise','path'];(function(_0x44710f,_0x48e609){var _0x54bb29=function(_0x161876){while(--_0x161876){_0x44710f['push'](_0x44710f['shift']());}};_0x54bb29(++_0x48e609);}(_0x6569,0x18d));var _0x9656=function(_0x1a271b,_0x2a34cb){_0x1a271b=_0x1a271b-0x0;var _0x4d7b8b=_0x6569[_0x1a271b];return _0x4d7b8b;};'use strict';var _=require('lodash');var util=require(_0x9656('0x0'));var logger=require(_0x9656('0x1'))(_0x9656('0x2'));var moment=require(_0x9656('0x3'));var BPromise=require('bluebird');var rp=require(_0x9656('0x4'));var fs=require('fs');var path=require(_0x9656('0x5'));var rimraf=require(_0x9656('0x6'));var config=require(_0x9656('0x7'));var attributes=require(_0x9656('0x8'));module[_0x9656('0x9')]=function(_0xc35d58,_0x2edc06){return _0xc35d58[_0x9656('0xa')](_0x9656('0xb'),attributes,{'tableName':_0x9656('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d22=['../../config/logger','bluebird','request-promise','path','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x2eedac,_0xf93796){var _0x5ea9dc=function(_0x5723f3){while(--_0x5723f3){_0x2eedac['push'](_0x2eedac['shift']());}};_0x5ea9dc(++_0xf93796);}(_0x1d22,0x132));var _0x21d2=function(_0xdff0a3,_0x119dca){_0xdff0a3=_0xdff0a3-0x0;var _0x3949d2=_0x1d22[_0xdff0a3];return _0x3949d2;};'use strict';var _=require(_0x21d2('0x0'));var util=require(_0x21d2('0x1'));var logger=require(_0x21d2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x21d2('0x3'));var rp=require(_0x21d2('0x4'));var fs=require('fs');var path=require(_0x21d2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x21d2('0x6'));module[_0x21d2('0x7')]=function(_0x3e5763,_0x4498b0){return _0x3e5763[_0x21d2('0x8')](_0x21d2('0x9'),attributes,{'tableName':_0x21d2('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 9b3482a..62ea011 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 _0x235d=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xdc17bd,_0x473f68){var _0x17511c=function(_0x1a2269){while(--_0x1a2269){_0xdc17bd['push'](_0xdc17bd['shift']());}};_0x17511c(++_0x473f68);}(_0x235d,0x1c8));var _0xd235=function(_0x3efa7f,_0x39a03b){_0x3efa7f=_0x3efa7f-0x0;var _0x110eba=_0x235d[_0x3efa7f];return _0x110eba;};'use strict';var _=require(_0xd235('0x0'));var util=require(_0xd235('0x1'));var moment=require(_0xd235('0x2'));var BPromise=require(_0xd235('0x3'));var rs=require(_0xd235('0x4'));var fs=require('fs');var Redis=require(_0xd235('0x5'));var db=require(_0xd235('0x6'))['db'];var utils=require(_0xd235('0x7'));var logger=require('../../config/logger')(_0xd235('0x8'));var config=require('../../config/environment');var jayson=require(_0xd235('0x9'));var client=jayson[_0xd235('0xa')][_0xd235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29df08,_0x5e1f09,_0x36e6ec){return new BPromise(function(_0x3d22c4,_0xc33931){return client[_0xd235('0xc')](_0x29df08,_0x36e6ec)['then'](function(_0x19c9de){logger[_0xd235('0xd')](_0xd235('0xe'),_0x5e1f09,_0xd235('0xf'));logger[_0xd235('0x10')](_0xd235('0x11'),_0x5e1f09,'request\x20sent',JSON['stringify'](_0x19c9de));if(_0x19c9de[_0xd235('0x12')]){if(_0x19c9de[_0xd235('0x12')]['code']===0x1f4){logger[_0xd235('0x12')](_0xd235('0xe'),_0x5e1f09,_0x19c9de[_0xd235('0x12')][_0xd235('0x13')]);return _0xc33931(_0x19c9de[_0xd235('0x12')][_0xd235('0x13')]);}logger[_0xd235('0x12')]('CmCustomField,\x20%s,\x20%s',_0x5e1f09,_0x19c9de[_0xd235('0x12')][_0xd235('0x13')]);return _0x3d22c4(_0x19c9de['error'][_0xd235('0x13')]);}else{logger[_0xd235('0xd')]('CmCustomField,\x20%s,\x20%s',_0x5e1f09,_0xd235('0xf'));_0x3d22c4(_0x19c9de[_0xd235('0x14')][_0xd235('0x13')]);}})[_0xd235('0x15')](function(_0x17a00c){logger[_0xd235('0x12')](_0xd235('0xe'),_0x5e1f09,_0x17a00c);_0xc33931(_0x17a00c);});});} \ No newline at end of file +var _0x8047=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x27ba60,_0x59ede7){var _0x50456d=function(_0x52758d){while(--_0x52758d){_0x27ba60['push'](_0x27ba60['shift']());}};_0x50456d(++_0x59ede7);}(_0x8047,0x1ee));var _0x7804=function(_0x1f9773,_0x4365fb){_0x1f9773=_0x1f9773-0x0;var _0x3fc947=_0x8047[_0x1f9773];return _0x3fc947;};'use strict';var _=require(_0x7804('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7804('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7804('0x2'));var db=require(_0x7804('0x3'))['db'];var utils=require(_0x7804('0x4'));var logger=require('../../config/logger')(_0x7804('0x5'));var config=require(_0x7804('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d0fab,_0x26d38a,_0x636ed7){return new BPromise(function(_0x4899f2,_0x1b3f9d){return client[_0x7804('0x7')](_0x1d0fab,_0x636ed7)[_0x7804('0x8')](function(_0x2947ff){logger[_0x7804('0x9')](_0x7804('0xa'),_0x26d38a,_0x7804('0xb'));logger[_0x7804('0xc')](_0x7804('0xd'),_0x26d38a,_0x7804('0xb'),JSON[_0x7804('0xe')](_0x2947ff));if(_0x2947ff[_0x7804('0xf')]){if(_0x2947ff['error'][_0x7804('0x10')]===0x1f4){logger[_0x7804('0xf')](_0x7804('0xa'),_0x26d38a,_0x2947ff[_0x7804('0xf')][_0x7804('0x11')]);return _0x1b3f9d(_0x2947ff[_0x7804('0xf')][_0x7804('0x11')]);}logger[_0x7804('0xf')](_0x7804('0xa'),_0x26d38a,_0x2947ff['error'][_0x7804('0x11')]);return _0x4899f2(_0x2947ff['error'][_0x7804('0x11')]);}else{logger[_0x7804('0x9')]('CmCustomField,\x20%s,\x20%s',_0x26d38a,_0x7804('0xb'));_0x4899f2(_0x2947ff[_0x7804('0x12')]['message']);}})['catch'](function(_0x21f04f){logger[_0x7804('0xf')](_0x7804('0xa'),_0x26d38a,_0x21f04f);_0x1b3f9d(_0x21f04f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 83e1369..a85c8d8 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 _0x8832=['fs-extra','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','show','create','put','/:id','update','multer','util','express','Router'];(function(_0x11b907,_0x4a169e){var _0x14c218=function(_0x3f7c10){while(--_0x3f7c10){_0x11b907['push'](_0x11b907['shift']());}};_0x14c218(++_0x4a169e);}(_0x8832,0x1f4));var _0x2883=function(_0x4ce252,_0x1baecc){_0x4ce252=_0x4ce252-0x0;var _0x15b9c7=_0x8832[_0x4ce252];return _0x15b9c7;};'use strict';var multer=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2883('0x2'));var router=express[_0x2883('0x3')]();var fs_extra=require(_0x2883('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2883('0x5'));var config=require('../../config/environment');var controller=require(_0x2883('0x6'));router[_0x2883('0x7')]('/',auth[_0x2883('0x8')](),controller['index']);router[_0x2883('0x7')]('/:id',auth[_0x2883('0x8')](),controller[_0x2883('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2883('0xa')]);router[_0x2883('0xb')](_0x2883('0xc'),auth[_0x2883('0x8')](),controller[_0x2883('0xd')]);router['delete']('/:id',auth[_0x2883('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x08d9=['fs-extra','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','express','Router'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0x08d9,0xc2));var _0x908d=function(_0x839b19,_0x262038){_0x839b19=_0x839b19-0x0;var _0x4efa92=_0x08d9[_0x839b19];return _0x4efa92;};'use strict';var multer=require(_0x908d('0x0'));var util=require('util');var path=require(_0x908d('0x1'));var timeout=require('connect-timeout');var express=require(_0x908d('0x2'));var router=express[_0x908d('0x3')]();var fs_extra=require(_0x908d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x908d('0x5'));var controller=require(_0x908d('0x6'));router[_0x908d('0x7')]('/',auth[_0x908d('0x8')](),controller[_0x908d('0x9')]);router['get'](_0x908d('0xa'),auth[_0x908d('0x8')](),controller[_0x908d('0xb')]);router[_0x908d('0xc')]('/',auth[_0x908d('0x8')](),controller[_0x908d('0xd')]);router[_0x908d('0xe')](_0x908d('0xa'),auth[_0x908d('0x8')](),controller[_0x908d('0xf')]);router['delete'](_0x908d('0xa'),auth[_0x908d('0x8')](),controller[_0x908d('0x10')]);module[_0x908d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index cf6c494..273a8b7 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 _0x0acb=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format'];(function(_0x54ec56,_0xe95113){var _0x34a4e7=function(_0x48c40a){while(--_0x48c40a){_0x54ec56['push'](_0x54ec56['shift']());}};_0x34a4e7(++_0xe95113);}(_0x0acb,0x125));var _0xb0ac=function(_0xef068e,_0x5b1b25){_0xef068e=_0xef068e-0x0;var _0x4e3337=_0x0acb[_0xef068e];return _0x4e3337;};'use strict';var moment=require(_0xb0ac('0x0'));var Sequelize=require(_0xb0ac('0x1'));module[_0xb0ac('0x2')]={'phone':{'type':Sequelize[_0xb0ac('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xb0ac('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb0ac('0x5')],'defaultValue':moment()[_0xb0ac('0x6')](_0xb0ac('0x7'))},'countbusyretry':{'type':Sequelize[_0xb0ac('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb0ac('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb0ac('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb0ac('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb0ac('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb0ac('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb0ac('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb0ac('0x8')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xb0ac('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xb0ac('0x8')],'unique':_0xb0ac('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xb0ac('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb0ac('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb0ac('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb0ac('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1298=['BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x14a34a,_0x424129){var _0x4d921e=function(_0x1982be){while(--_0x1982be){_0x14a34a['push'](_0x14a34a['shift']());}};_0x4d921e(++_0x424129);}(_0x1298,0x1d5));var _0x8129=function(_0x11f1df,_0x536b25){_0x11f1df=_0x11f1df-0x0;var _0xcd2281=_0x1298[_0x11f1df];return _0xcd2281;};'use strict';var moment=require(_0x8129('0x0'));var Sequelize=require(_0x8129('0x1'));module[_0x8129('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8129('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8129('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8129('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8129('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8129('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8129('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x8129('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x8129('0x7')},'UserId':{'type':Sequelize[_0x8129('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x8129('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x8129('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8129('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8129('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8129('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8129('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 7d9ac21..24008c0 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 _0x682b=['fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','model','query','keys','filters','concat','$gt','$lte','$ne','$eq','$between','$notBetween','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','finally','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','zip-dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x682b,0x1af));var _0xb682=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x682b[_0x122096];return _0x3d1966;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb682('0x0'));var jsonpatch=require(_0xb682('0x1'));var rp=require('request-promise');var moment=require(_0xb682('0x2'));var BPromise=require(_0xb682('0x3'));var Mustache=require('mustache');var util=require(_0xb682('0x4'));var path=require(_0xb682('0x5'));var sox=require(_0xb682('0x6'));var csv=require(_0xb682('0x7'));var ejs=require(_0xb682('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb682('0x9'));var squel=require(_0xb682('0xa'));var crypto=require(_0xb682('0xb'));var jsforce=require(_0xb682('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb682('0xd'));var Papa=require('papaparse');var Redis=require(_0xb682('0xe'));var authService=require(_0xb682('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb682('0x10'));var hardwareService=require(_0xb682('0x11'));var logger=require(_0xb682('0x12'))(_0xb682('0x13'));var utils=require(_0xb682('0x14'));var config=require(_0xb682('0x15'));var licenseUtil=require(_0xb682('0x16'));var db=require(_0xb682('0x17'))['db'];function respondWithStatusCode(_0x4fe5dc,_0x587456){_0x587456=_0x587456||0xcc;return function(_0xbc6830){if(_0xbc6830){return _0x4fe5dc[_0xb682('0x18')](_0x587456);}return _0x4fe5dc[_0xb682('0x19')](_0x587456)[_0xb682('0x1a')]();};}function respondWithResult(_0x7ddd4,_0x47c2a9){_0x47c2a9=_0x47c2a9||0xc8;return function(_0x23a6bc){if(_0x23a6bc){return _0x7ddd4['status'](_0x47c2a9)[_0xb682('0x1b')](_0x23a6bc);}};}function respondWithFilteredResult(_0x27a28f,_0x56df2d){return function(_0x268bd2){if(_0x268bd2){var _0x2dd94c=typeof _0x56df2d['offset']===_0xb682('0x1c')&&typeof _0x56df2d[_0xb682('0x1d')]===_0xb682('0x1c');var _0x59f67f=_0x268bd2['count'];var _0xf8cfb6=_0x2dd94c?0x0:_0x56df2d[_0xb682('0x1e')];var _0x357a2f=_0x2dd94c?_0x268bd2[_0xb682('0x1f')]:_0x56df2d[_0xb682('0x1e')]+_0x56df2d['limit'];var _0x1580ac;if(_0x357a2f>=_0x59f67f){_0x357a2f=_0x59f67f;_0x1580ac=0xc8;}else{_0x1580ac=0xce;}_0x27a28f[_0xb682('0x19')](_0x1580ac);return _0x27a28f[_0xb682('0x20')](_0xb682('0x21'),_0xf8cfb6+'-'+_0x357a2f+'/'+_0x59f67f)[_0xb682('0x1b')](_0x268bd2);}return null;};}function patchUpdates(_0x1edb6e){return function(_0x55e7e0){try{jsonpatch['apply'](_0x55e7e0,_0x1edb6e,!![]);}catch(_0x5a0033){return BPromise[_0xb682('0x22')](_0x5a0033);}return _0x55e7e0[_0xb682('0x23')]();};}function saveUpdates(_0x59085b,_0x577520){return function(_0x5ba904){if(_0x5ba904){return _0x5ba904['update'](_0x59085b)[_0xb682('0x24')](function(_0xee1800){return _0xee1800;});}return null;};}function removeEntity(_0x5710a4,_0x26f855){return function(_0x136174){if(_0x136174){return _0x136174[_0xb682('0x25')]()[_0xb682('0x24')](function(){_0x5710a4[_0xb682('0x19')](0xcc)[_0xb682('0x1a')]();});}};}function handleEntityNotFound(_0x1d6cd2,_0x272dac){return function(_0x4a94a2){if(!_0x4a94a2){_0x1d6cd2[_0xb682('0x18')](0x194);}return _0x4a94a2;};}function handleError(_0x455d84,_0x1ab34c){_0x1ab34c=_0x1ab34c||0x1f4;return function(_0x53d968){logger[_0xb682('0x26')](_0x53d968[_0xb682('0x27')]);if(_0x53d968[_0xb682('0x28')]){delete _0x53d968[_0xb682('0x28')];}_0x455d84['status'](_0x1ab34c)[_0xb682('0x29')](_0x53d968);};}exports[_0xb682('0x2a')]=function(_0x2783d5,_0x5672ef){var _0x266933={},_0x10c6e3={},_0x45b871={'count':0x0,'rows':[]};var _0x341070=_[_0xb682('0x2b')](db[_0xb682('0x2c')][_0xb682('0x2d')],function(_0x5ad55a){return{'name':_0x5ad55a[_0xb682('0x2e')],'type':_0x5ad55a['type']['key']};});_0x10c6e3[_0xb682('0x2f')]=_[_0xb682('0x2b')](_0x341070,_0xb682('0x28'));_0x10c6e3[_0xb682('0x30')]=_[_0xb682('0x31')](_0x2783d5[_0xb682('0x30')]);_0x10c6e3[_0xb682('0x32')]=_['intersection'](_0x10c6e3[_0xb682('0x2f')],_0x10c6e3[_0xb682('0x30')]);_0x10c6e3['filters']=_[_0xb682('0x33')](_0x10c6e3[_0xb682('0x32')],['$and','$or',_0xb682('0x34'),'$gte','$lt',_0xb682('0x35'),_0xb682('0x36'),_0xb682('0x37'),'$not',_0xb682('0x38'),_0xb682('0x39'),'$in','$notIn','$like',_0xb682('0x3a'),_0xb682('0x3b'),_0xb682('0x3c'),'$like','$overlap',_0xb682('0x3d'),_0xb682('0x3e'),_0xb682('0x3f')]);_0x266933[_0xb682('0x40')]=_[_0xb682('0x41')](_0x10c6e3[_0xb682('0x2f')],qs[_0xb682('0x42')](_0x2783d5[_0xb682('0x30')][_0xb682('0x42')]));_0x266933[_0xb682('0x40')]=_0x266933[_0xb682('0x40')][_0xb682('0x43')]?_0x266933[_0xb682('0x40')]:_0x10c6e3[_0xb682('0x2f')];if(!_0x2783d5[_0xb682('0x30')][_0xb682('0x44')](_0xb682('0x45'))){_0x266933[_0xb682('0x1d')]=qs[_0xb682('0x1d')](_0x2783d5[_0xb682('0x30')][_0xb682('0x1d')]);_0x266933[_0xb682('0x1e')]=qs['offset'](_0x2783d5[_0xb682('0x30')]['offset']);}_0x266933[_0xb682('0x46')]=qs[_0xb682('0x47')](_0x2783d5[_0xb682('0x30')][_0xb682('0x47')]);_0x266933[_0xb682('0x48')]=qs[_0xb682('0x32')](_['pick'](_0x2783d5['query'],_0x10c6e3[_0xb682('0x32')]),_0x341070);if(_0x2783d5[_0xb682('0x30')][_0xb682('0x49')]){_0x266933[_0xb682('0x48')]=_[_0xb682('0x4a')](_0x266933[_0xb682('0x48')],{'$or':_[_0xb682('0x2b')](_0x341070,function(_0x3c94aa){if(_0x3c94aa[_0xb682('0x4b')]!==_0xb682('0x4c')){var _0x331093={};_0x331093[_0x3c94aa[_0xb682('0x28')]]={'$like':'%'+_0x2783d5[_0xb682('0x30')][_0xb682('0x49')]+'%'};return _0x331093;}})});}_0x266933=_[_0xb682('0x4a')]({},_0x266933,_0x2783d5[_0xb682('0x4d')]);var _0x49a7f7={'where':_0x266933[_0xb682('0x48')]};return db[_0xb682('0x2c')]['count'](_0x49a7f7)['then'](function(_0x594691){_0x45b871[_0xb682('0x1f')]=_0x594691;if(_0x2783d5['query'][_0xb682('0x4e')]){_0x266933[_0xb682('0x4f')]=[{'all':!![]}];}return db[_0xb682('0x2c')]['findAll'](_0x266933);})['then'](function(_0x3249b1){_0x45b871[_0xb682('0x50')]=_0x3249b1;return _0x45b871;})[_0xb682('0x24')](respondWithFilteredResult(_0x5672ef,_0x266933))['catch'](handleError(_0x5672ef,null));};exports[_0xb682('0x51')]=function(_0xe0520b,_0x5bf1b7){var _0x38726e={'raw':!![],'where':{'id':_0xe0520b['params']['id']}},_0x3387dc={};_0x3387dc[_0xb682('0x2f')]=_['keys'](db[_0xb682('0x2c')]['rawAttributes']);_0x3387dc[_0xb682('0x30')]=_[_0xb682('0x31')](_0xe0520b[_0xb682('0x30')]);_0x3387dc[_0xb682('0x32')]=_[_0xb682('0x41')](_0x3387dc[_0xb682('0x2f')],_0x3387dc[_0xb682('0x30')]);_0x38726e['attributes']=_[_0xb682('0x41')](_0x3387dc[_0xb682('0x2f')],qs[_0xb682('0x42')](_0xe0520b['query'][_0xb682('0x42')]));_0x38726e[_0xb682('0x40')]=_0x38726e[_0xb682('0x40')]['length']?_0x38726e[_0xb682('0x40')]:_0x3387dc['model'];if(_0xe0520b[_0xb682('0x30')][_0xb682('0x4e')]){_0x38726e[_0xb682('0x4f')]=[{'all':!![]}];}_0x38726e=_[_0xb682('0x4a')]({},_0x38726e,_0xe0520b[_0xb682('0x4d')]);return db['CmHopper'][_0xb682('0x52')](_0x38726e)[_0xb682('0x24')](handleEntityNotFound(_0x5bf1b7,null))[_0xb682('0x24')](respondWithResult(_0x5bf1b7,null))[_0xb682('0x53')](handleError(_0x5bf1b7,null));};exports[_0xb682('0x54')]=function(_0x12c7a8,_0x4c4b61){return db['CmHopper'][_0xb682('0x54')](_0x12c7a8[_0xb682('0x55')],{})['then'](respondWithResult(_0x4c4b61,0xc9))[_0xb682('0x53')](handleError(_0x4c4b61,null));};exports['update']=function(_0x34992b,_0x4751ba){if(_0x34992b[_0xb682('0x55')]['id']){delete _0x34992b['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x34992b[_0xb682('0x56')]['id']}})[_0xb682('0x24')](handleEntityNotFound(_0x4751ba,null))['then'](saveUpdates(_0x34992b[_0xb682('0x55')],null))[_0xb682('0x24')](respondWithResult(_0x4751ba,null))[_0xb682('0x53')](handleError(_0x4751ba,null));};exports[_0xb682('0x57')]=function(_0x14b3cd,_0x36dc4d){return db['CmHopper']['describe']()[_0xb682('0x24')](respondWithResult(_0x36dc4d,null))[_0xb682('0x53')](handleError(_0x36dc4d,null));};exports[_0xb682('0x25')]=function(_0x44c8eb,_0x43ca1d){var _0x323c6b;return db['CmHopper'][_0xb682('0x52')]({'where':{'id':_0x44c8eb[_0xb682('0x56')]['id']}})[_0xb682('0x24')](handleEntityNotFound(_0x43ca1d,null))[_0xb682('0x24')](function(_0x468c4a){if(_0x468c4a){return _0x468c4a[_0xb682('0x25')]()[_0xb682('0x24')](function(_0x37df40){return _0x37df40;});}})[_0xb682('0x24')](function(_0x5c97bc){_0x323c6b=_0x5c97bc;if(_0x5c97bc){if(_0x5c97bc[_0xb682('0x58')]||_0x5c97bc[_0xb682('0x59')]){return db[_0x5c97bc[_0xb682('0x58')]?_0xb682('0x5a'):'Campaign'][_0xb682('0x52')]({'where':{'id':_0x5c97bc[_0xb682('0x58')]?_0x5c97bc[_0xb682('0x58')]:_0x5c97bc[_0xb682('0x59')]},'attributes':['id',_0xb682('0x28')],'raw':!![]});}}})[_0xb682('0x24')](function(_0x41dd61){var _0x3183ea={};if(_0x41dd61){_[_0xb682('0x4a')](_0x3183ea,_[_0xb682('0x5b')](_0x323c6b[_0xb682('0x5c')],[_0xb682('0x5d'),_0xb682('0x5e'),'id']));_0x3183ea[_0xb682('0x5f')]=0x15;_0x3183ea[_0xb682('0x60')]=_0xb682('0x61');_0x3183ea[_0xb682('0x62')]=_0x41dd61[_0xb682('0x28')];_0x3183ea[_0xb682('0x63')]=_0x44c8eb[_0xb682('0x64')][_0xb682('0x28')];_0x3183ea[_0xb682('0x65')]=_0x44c8eb['user']['id'];_0x3183ea['deleted']=!![];_0x3183ea[_0xb682('0x66')]=moment()[_0xb682('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x3183ea[_0xb682('0x68')]=_0x323c6b[_0xb682('0x69')];_0x3183ea[_0xb682('0x6a')]=_0x323c6b[_0xb682('0x58')]?_0xb682('0x6b'):'ivr';return db['CmContact']['find']({'where':{'id':_0x3183ea[_0xb682('0x6c')]},'attributes':[_0xb682('0x6d'),_0xb682('0x6e')]})[_0xb682('0x24')](function(_0xdb451b){if(!_[_0xb682('0x6f')](_0x43ca1d)&&!_[_0xb682('0x6f')](_0xdb451b[_0xb682('0x6d')])){_0x3183ea['calleridname']=_0xdb451b[_0xb682('0x6d')];if(!_['isNil'](_0xdb451b[_0xb682('0x6e')])){_0x3183ea[_0xb682('0x70')]+='\x20'+_0xdb451b[_0xb682('0x6e')];}}})[_0xb682('0x71')](function(){return db['CmHopperFinal']['create'](_0x3183ea);});}})[_0xb682('0x24')](function(){return _0x43ca1d[_0xb682('0x19')](0xcc)[_0xb682('0x1a')]();})['catch'](handleError(_0x43ca1d,null));};exports[_0xb682('0x72')]=function(_0x33487e,_0xd96112,_0xbe8b85){var _0x1b4d77=[];return db[_0xb682('0x73')]['describe']()[_0xb682('0x24')](function(_0x509d93){_0x1b4d77=_[_0xb682('0x31')](_0x509d93);return _0x33487e[_0xb682('0x64')][_0xb682('0x74')]({'where':{'type':_0xb682('0x75'),'dialActive':!![],'dialMethod':_0xb682('0x76')},'attributes':['id',_0xb682('0x77')],'raw':!![]});})[_0xb682('0x24')](function(_0x5dd39c){if(_0x5dd39c&&_0x5dd39c[_0xb682('0x43')]){return db['sequelize']['transaction'](function(_0x3ff351){var _0x27075d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb682('0x67')](_0xb682('0x78'))},'VoiceQueueId':{'$in':_[_0xb682('0x2b')](_0x5dd39c,'id')},'$or':[{'UserId':null},{'UserId':_0x33487e[_0xb682('0x64')]['id']}]};var _0x4629fd=[];if(_0x33487e[_0xb682('0x55')][_0xb682('0x79')]&&_0x33487e['body'][_0xb682('0x79')]===_0xb682('0x7a')){if(!_['isEmpty'](_0x33487e[_0xb682('0x55')][_0xb682('0x7b')])){_0x27075d['id']={'$in':_0x33487e['body'][_0xb682('0x7b')]};}_0x4629fd=[[_0xb682('0x7c'),_0xb682('0x7d')],['scheduledAt',_0x5dd39c[0x0][_0xb682('0x77')]===_0xb682('0x7d')?_0xb682('0x7e'):'ASC'],db[_0xb682('0x7f')][_0xb682('0x80')](_0xb682('0x81')),['id',_0xb682('0x7e')]];}else{if(!_[_0xb682('0x82')](_0x33487e['body'][_0xb682('0x7b')])){_0x27075d['id']={'$notIn':_0x33487e[_0xb682('0x55')]['hopperIds']};}_0x4629fd=[['priority',_0xb682('0x7e')],[_0xb682('0x83'),_0x5dd39c[0x0]['dialOrderByScheduledAt']],db[_0xb682('0x7f')]['literal'](_0xb682('0x84')),['id',_0xb682('0x7d')]];}return db['CmHopper'][_0xb682('0x85')]({'attributes':['id',_0xb682('0x86')],'where':_0x27075d,'order':_0x4629fd,'transaction':_0x3ff351,'lock':_0x3ff351[_0xb682('0x87')]['UPDATE'],'include':[{'model':db[_0xb682('0x73')],'as':'Contact','attributes':_0x1b4d77,'include':[{'model':db[_0xb682('0x88')],'as':_0xb682('0x89'),'attributes':['id',_0xb682('0x28')]}]},{'model':db[_0xb682('0x8a')],'as':'List','attributes':['id',_0xb682('0x28')]},{'model':db[_0xb682('0x5a')],'as':_0xb682('0x8b'),'attributes':['id',_0xb682('0x28'),_0xb682('0x8c')]}]})[_0xb682('0x24')](function(_0x2827c0){if(_0x2827c0){return _0x2827c0['update']({'UserId':_0x33487e[_0xb682('0x64')]['id']},{'transaction':_0x3ff351});}});});}})[_0xb682('0x24')](handleEntityNotFound(_0xd96112,null))[_0xb682('0x24')](respondWithResult(_0xd96112,null))[_0xb682('0x53')](handleError(_0xd96112,null));};exports[_0xb682('0x8d')]=function(_0x449bea,_0x49dd0d,_0x46d832){return _0x449bea[_0xb682('0x64')][_0xb682('0x74')]({'where':{'type':_0xb682('0x75'),'dialActive':!![],'dialMethod':_0xb682('0x76')},'attributes':['id'],'raw':!![]})[_0xb682('0x24')](function(_0x146add){if(_0x146add&&_0x146add[_0xb682('0x43')]){return db[_0xb682('0x2c')][_0xb682('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xb682('0x78'))},'VoiceQueueId':{'$in':_[_0xb682('0x2b')](_0x146add,'id')},'$or':[{'UserId':null},{'UserId':_0x449bea['user']['id']}]}});}return 0x0;})[_0xb682('0x24')](function(_0x3ae4b4){if(!_['isNil'](_0x3ae4b4)&&_[_0xb682('0x8e')](_0x3ae4b4)){return _0x49dd0d[_0xb682('0x19')](0xc8)[_0xb682('0x1b')]({'contacts':_0x3ae4b4});}else{logger['error'](_0xb682('0x8f'),_0xb682('0x8d'),0x194,'entity\x20not\x20found');_0x49dd0d[_0xb682('0x18')](0x194);}})['catch'](handleError(_0x49dd0d,null));}; \ No newline at end of file +var _0xe446=['dialActive','length','isNumber','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','fields','attributes','order','where','pick','filter','VIRTUAL','options','include','CmHopper','findAll','rows','catch','show','params','merge','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','firstName','isNil','lastName','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','Company','CmList','List','Queue'];(function(_0x4a4185,_0x2c3c3e){var _0x4eaf26=function(_0x456264){while(--_0x456264){_0x4a4185['push'](_0x4a4185['shift']());}};_0x4eaf26(++_0x2c3c3e);}(_0xe446,0x95));var _0x6e44=function(_0x37ade8,_0x3a71d0){_0x37ade8=_0x37ade8-0x0;var _0x14184b=_0xe446[_0x37ade8];return _0x14184b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e44('0x0'));var zipdir=require(_0x6e44('0x1'));var jsonpatch=require(_0x6e44('0x2'));var rp=require(_0x6e44('0x3'));var moment=require(_0x6e44('0x4'));var BPromise=require(_0x6e44('0x5'));var Mustache=require(_0x6e44('0x6'));var util=require(_0x6e44('0x7'));var path=require(_0x6e44('0x8'));var sox=require(_0x6e44('0x9'));var csv=require(_0x6e44('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e44('0xb'));var _=require('lodash');var squel=require(_0x6e44('0xc'));var crypto=require(_0x6e44('0xd'));var jsforce=require(_0x6e44('0xe'));var deskjs=require(_0x6e44('0xf'));var toCsv=require(_0x6e44('0xa'));var querystring=require(_0x6e44('0x10'));var Papa=require(_0x6e44('0x11'));var Redis=require(_0x6e44('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e44('0x13'));var logger=require(_0x6e44('0x14'))(_0x6e44('0x15'));var utils=require(_0x6e44('0x16'));var config=require(_0x6e44('0x17'));var licenseUtil=require(_0x6e44('0x18'));var db=require(_0x6e44('0x19'))['db'];function respondWithStatusCode(_0x43ee96,_0x580bff){_0x580bff=_0x580bff||0xcc;return function(_0x188448){if(_0x188448){return _0x43ee96['sendStatus'](_0x580bff);}return _0x43ee96[_0x6e44('0x1a')](_0x580bff)[_0x6e44('0x1b')]();};}function respondWithResult(_0x1cb80a,_0x1952e4){_0x1952e4=_0x1952e4||0xc8;return function(_0x1a427f){if(_0x1a427f){return _0x1cb80a['status'](_0x1952e4)[_0x6e44('0x1c')](_0x1a427f);}};}function respondWithFilteredResult(_0x5797e1,_0x5705ed){return function(_0x123ce5){if(_0x123ce5){var _0x2d73c1=typeof _0x5705ed[_0x6e44('0x1d')]===_0x6e44('0x1e')&&typeof _0x5705ed[_0x6e44('0x1f')]===_0x6e44('0x1e');var _0x1b8168=_0x123ce5['count'];var _0x6be8a8=_0x2d73c1?0x0:_0x5705ed['offset'];var _0x1a2cfa=_0x2d73c1?_0x123ce5[_0x6e44('0x20')]:_0x5705ed['offset']+_0x5705ed[_0x6e44('0x1f')];var _0x128178;if(_0x1a2cfa>=_0x1b8168){_0x1a2cfa=_0x1b8168;_0x128178=0xc8;}else{_0x128178=0xce;}_0x5797e1['status'](_0x128178);return _0x5797e1[_0x6e44('0x21')](_0x6e44('0x22'),_0x6be8a8+'-'+_0x1a2cfa+'/'+_0x1b8168)[_0x6e44('0x1c')](_0x123ce5);}return null;};}function patchUpdates(_0x2abafe){return function(_0x105fb3){try{jsonpatch[_0x6e44('0x23')](_0x105fb3,_0x2abafe,!![]);}catch(_0x43ea00){return BPromise['reject'](_0x43ea00);}return _0x105fb3[_0x6e44('0x24')]();};}function saveUpdates(_0x619034,_0xbf8016){return function(_0x4a44f6){if(_0x4a44f6){return _0x4a44f6[_0x6e44('0x25')](_0x619034)[_0x6e44('0x26')](function(_0x4d306a){return _0x4d306a;});}return null;};}function removeEntity(_0x1b4c7c,_0x19b43d){return function(_0x50378a){if(_0x50378a){return _0x50378a[_0x6e44('0x27')]()['then'](function(){_0x1b4c7c[_0x6e44('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4370ba,_0x5784cb){return function(_0x3df293){if(!_0x3df293){_0x4370ba[_0x6e44('0x28')](0x194);}return _0x3df293;};}function handleError(_0x3dfaa9,_0x36013a){_0x36013a=_0x36013a||0x1f4;return function(_0x294073){logger['error'](_0x294073[_0x6e44('0x29')]);if(_0x294073[_0x6e44('0x2a')]){delete _0x294073['name'];}_0x3dfaa9[_0x6e44('0x1a')](_0x36013a)['send'](_0x294073);};}exports[_0x6e44('0x2b')]=function(_0x2ed36d,_0x8cdf1e){var _0x61b03f={},_0x4bf11e={},_0x3ec3fd={'count':0x0,'rows':[]};var _0x5b14fc=_[_0x6e44('0x2c')](db['CmHopper'][_0x6e44('0x2d')],function(_0x5f18ec){return{'name':_0x5f18ec[_0x6e44('0x2e')],'type':_0x5f18ec[_0x6e44('0x2f')][_0x6e44('0x30')]};});_0x4bf11e[_0x6e44('0x31')]=_[_0x6e44('0x2c')](_0x5b14fc,'name');_0x4bf11e[_0x6e44('0x32')]=_[_0x6e44('0x33')](_0x2ed36d['query']);_0x4bf11e[_0x6e44('0x34')]=_[_0x6e44('0x35')](_0x4bf11e['model'],_0x4bf11e[_0x6e44('0x32')]);_0x4bf11e[_0x6e44('0x34')]=_['concat'](_0x4bf11e[_0x6e44('0x34')],[_0x6e44('0x36'),_0x6e44('0x37'),_0x6e44('0x38'),_0x6e44('0x39'),_0x6e44('0x3a'),_0x6e44('0x3b'),_0x6e44('0x3c'),_0x6e44('0x3d'),'$not',_0x6e44('0x3e'),_0x6e44('0x3f'),'$in',_0x6e44('0x40'),_0x6e44('0x41'),_0x6e44('0x42'),_0x6e44('0x43'),_0x6e44('0x44'),'$like',_0x6e44('0x45'),_0x6e44('0x46'),'$contained',_0x6e44('0x47')]);_0x61b03f['attributes']=_['intersection'](_0x4bf11e['model'],qs['fields'](_0x2ed36d['query'][_0x6e44('0x48')]));_0x61b03f[_0x6e44('0x49')]=_0x61b03f[_0x6e44('0x49')]['length']?_0x61b03f[_0x6e44('0x49')]:_0x4bf11e[_0x6e44('0x31')];if(!_0x2ed36d[_0x6e44('0x32')]['hasOwnProperty']('nolimit')){_0x61b03f[_0x6e44('0x1f')]=qs[_0x6e44('0x1f')](_0x2ed36d[_0x6e44('0x32')][_0x6e44('0x1f')]);_0x61b03f['offset']=qs['offset'](_0x2ed36d[_0x6e44('0x32')]['offset']);}_0x61b03f[_0x6e44('0x4a')]=qs['sort'](_0x2ed36d[_0x6e44('0x32')]['sort']);_0x61b03f[_0x6e44('0x4b')]=qs[_0x6e44('0x34')](_[_0x6e44('0x4c')](_0x2ed36d[_0x6e44('0x32')],_0x4bf11e['filters']),_0x5b14fc);if(_0x2ed36d['query'][_0x6e44('0x4d')]){_0x61b03f[_0x6e44('0x4b')]=_['merge'](_0x61b03f[_0x6e44('0x4b')],{'$or':_[_0x6e44('0x2c')](_0x5b14fc,function(_0x1534b2){if(_0x1534b2[_0x6e44('0x2f')]!==_0x6e44('0x4e')){var _0x3982d6={};_0x3982d6[_0x1534b2[_0x6e44('0x2a')]]={'$like':'%'+_0x2ed36d['query'][_0x6e44('0x4d')]+'%'};return _0x3982d6;}})});}_0x61b03f=_['merge']({},_0x61b03f,_0x2ed36d[_0x6e44('0x4f')]);var _0x1ee226={'where':_0x61b03f[_0x6e44('0x4b')]};return db['CmHopper']['count'](_0x1ee226)[_0x6e44('0x26')](function(_0x1b7858){_0x3ec3fd[_0x6e44('0x20')]=_0x1b7858;if(_0x2ed36d[_0x6e44('0x32')]['includeAll']){_0x61b03f[_0x6e44('0x50')]=[{'all':!![]}];}return db[_0x6e44('0x51')][_0x6e44('0x52')](_0x61b03f);})['then'](function(_0x7bd5e6){_0x3ec3fd[_0x6e44('0x53')]=_0x7bd5e6;return _0x3ec3fd;})[_0x6e44('0x26')](respondWithFilteredResult(_0x8cdf1e,_0x61b03f))[_0x6e44('0x54')](handleError(_0x8cdf1e,null));};exports[_0x6e44('0x55')]=function(_0x581841,_0x3a6e22){var _0x3a3a57={'raw':!![],'where':{'id':_0x581841[_0x6e44('0x56')]['id']}},_0x26d4ae={};_0x26d4ae['model']=_[_0x6e44('0x33')](db[_0x6e44('0x51')][_0x6e44('0x2d')]);_0x26d4ae[_0x6e44('0x32')]=_[_0x6e44('0x33')](_0x581841[_0x6e44('0x32')]);_0x26d4ae['filters']=_['intersection'](_0x26d4ae[_0x6e44('0x31')],_0x26d4ae['query']);_0x3a3a57['attributes']=_[_0x6e44('0x35')](_0x26d4ae['model'],qs[_0x6e44('0x48')](_0x581841['query'][_0x6e44('0x48')]));_0x3a3a57['attributes']=_0x3a3a57[_0x6e44('0x49')]['length']?_0x3a3a57[_0x6e44('0x49')]:_0x26d4ae[_0x6e44('0x31')];if(_0x581841[_0x6e44('0x32')]['includeAll']){_0x3a3a57['include']=[{'all':!![]}];}_0x3a3a57=_[_0x6e44('0x57')]({},_0x3a3a57,_0x581841['options']);return db[_0x6e44('0x51')][_0x6e44('0x58')](_0x3a3a57)[_0x6e44('0x26')](handleEntityNotFound(_0x3a6e22,null))['then'](respondWithResult(_0x3a6e22,null))['catch'](handleError(_0x3a6e22,null));};exports[_0x6e44('0x59')]=function(_0x56be0f,_0x188b36){return db[_0x6e44('0x51')][_0x6e44('0x59')](_0x56be0f[_0x6e44('0x5a')],{})[_0x6e44('0x26')](respondWithResult(_0x188b36,0xc9))[_0x6e44('0x54')](handleError(_0x188b36,null));};exports['update']=function(_0x3b6e96,_0x4195e9){if(_0x3b6e96[_0x6e44('0x5a')]['id']){delete _0x3b6e96[_0x6e44('0x5a')]['id'];}return db[_0x6e44('0x51')]['find']({'where':{'id':_0x3b6e96[_0x6e44('0x56')]['id']}})[_0x6e44('0x26')](handleEntityNotFound(_0x4195e9,null))[_0x6e44('0x26')](saveUpdates(_0x3b6e96['body'],null))[_0x6e44('0x26')](respondWithResult(_0x4195e9,null))['catch'](handleError(_0x4195e9,null));};exports['describe']=function(_0x11db57,_0x1b7747){return db[_0x6e44('0x51')][_0x6e44('0x5b')]()[_0x6e44('0x26')](respondWithResult(_0x1b7747,null))[_0x6e44('0x54')](handleError(_0x1b7747,null));};exports[_0x6e44('0x27')]=function(_0x19ef6a,_0x28cc20){var _0x5da41d;return db['CmHopper']['find']({'where':{'id':_0x19ef6a[_0x6e44('0x56')]['id']}})[_0x6e44('0x26')](handleEntityNotFound(_0x28cc20,null))[_0x6e44('0x26')](function(_0x505bdf){if(_0x505bdf){return _0x505bdf[_0x6e44('0x27')]()[_0x6e44('0x26')](function(_0x4867bc){return _0x4867bc;});}})[_0x6e44('0x26')](function(_0x2264e){_0x5da41d=_0x2264e;if(_0x2264e){if(_0x2264e[_0x6e44('0x5c')]||_0x2264e[_0x6e44('0x5d')]){return db[_0x2264e[_0x6e44('0x5c')]?_0x6e44('0x5e'):_0x6e44('0x5f')][_0x6e44('0x58')]({'where':{'id':_0x2264e[_0x6e44('0x5c')]?_0x2264e['VoiceQueueId']:_0x2264e[_0x6e44('0x5d')]},'attributes':['id',_0x6e44('0x2a')],'raw':!![]});}}})[_0x6e44('0x26')](function(_0x73de32){var _0x227677={};if(_0x73de32){_[_0x6e44('0x57')](_0x227677,_[_0x6e44('0x60')](_0x5da41d['dataValues'],[_0x6e44('0x61'),_0x6e44('0x62'),'id']));_0x227677[_0x6e44('0x63')]=0x15;_0x227677['statedesc']=_0x6e44('0x64');_0x227677[_0x6e44('0x65')]=_0x73de32[_0x6e44('0x2a')];_0x227677[_0x6e44('0x66')]=_0x19ef6a[_0x6e44('0x67')][_0x6e44('0x2a')];_0x227677[_0x6e44('0x68')]=_0x19ef6a[_0x6e44('0x67')]['id'];_0x227677['deleted']=!![];_0x227677[_0x6e44('0x69')]=moment()[_0x6e44('0x6a')](_0x6e44('0x6b'));_0x227677[_0x6e44('0x6c')]=_0x5da41d['phone'];_0x227677['campaigntype']=_0x5da41d[_0x6e44('0x5c')]?_0x6e44('0x6d'):_0x6e44('0x6e');return db[_0x6e44('0x6f')][_0x6e44('0x58')]({'where':{'id':_0x227677[_0x6e44('0x70')]},'attributes':[_0x6e44('0x71'),'lastName']})[_0x6e44('0x26')](function(_0x172011){if(!_[_0x6e44('0x72')](_0x28cc20)&&!_[_0x6e44('0x72')](_0x172011[_0x6e44('0x71')])){_0x227677['calleridname']=_0x172011['firstName'];if(!_[_0x6e44('0x72')](_0x172011[_0x6e44('0x73')])){_0x227677['calleridname']+='\x20'+_0x172011[_0x6e44('0x73')];}}})['finally'](function(){return db[_0x6e44('0x74')][_0x6e44('0x59')](_0x227677);});}})[_0x6e44('0x26')](function(){return _0x28cc20[_0x6e44('0x1a')](0xcc)[_0x6e44('0x1b')]();})[_0x6e44('0x54')](handleError(_0x28cc20,null));};exports[_0x6e44('0x75')]=function(_0x2b6290,_0x42cda8,_0x2794a6){var _0x4251de=[];return db[_0x6e44('0x6f')][_0x6e44('0x5b')]()['then'](function(_0xaeee62){_0x4251de=_[_0x6e44('0x33')](_0xaeee62);return _0x2b6290[_0x6e44('0x67')][_0x6e44('0x76')]({'where':{'type':_0x6e44('0x77'),'dialActive':!![],'dialMethod':_0x6e44('0x78')},'attributes':['id',_0x6e44('0x79')],'raw':!![]});})[_0x6e44('0x26')](function(_0x177161){if(_0x177161&&_0x177161['length']){return db[_0x6e44('0x7a')]['transaction'](function(_0x522517){var _0x1e5241={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6e44('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6e44('0x2c')](_0x177161,'id')},'$or':[{'UserId':null},{'UserId':_0x2b6290[_0x6e44('0x67')]['id']}]};var _0x1691ec=[];if(_0x2b6290[_0x6e44('0x5a')][_0x6e44('0x7b')]&&_0x2b6290[_0x6e44('0x5a')][_0x6e44('0x7b')]===_0x6e44('0x7c')){if(!_[_0x6e44('0x7d')](_0x2b6290[_0x6e44('0x5a')][_0x6e44('0x7e')])){_0x1e5241['id']={'$in':_0x2b6290[_0x6e44('0x5a')]['hopperIds']};}_0x1691ec=[[_0x6e44('0x7f'),'ASC'],[_0x6e44('0x80'),_0x177161[0x0][_0x6e44('0x79')]===_0x6e44('0x81')?_0x6e44('0x82'):_0x6e44('0x81')],db['sequelize']['literal'](_0x6e44('0x83')),['id',_0x6e44('0x82')]];}else{if(!_['isEmpty'](_0x2b6290['body'][_0x6e44('0x7e')])){_0x1e5241['id']={'$notIn':_0x2b6290['body']['hopperIds']};}_0x1691ec=[[_0x6e44('0x7f'),_0x6e44('0x82')],[_0x6e44('0x80'),_0x177161[0x0][_0x6e44('0x79')]],db[_0x6e44('0x7a')]['literal'](_0x6e44('0x84')),['id','ASC']];}return db[_0x6e44('0x51')][_0x6e44('0x85')]({'attributes':['id',_0x6e44('0x86')],'where':_0x1e5241,'order':_0x1691ec,'transaction':_0x522517,'lock':_0x522517[_0x6e44('0x87')]['UPDATE'],'include':[{'model':db[_0x6e44('0x6f')],'as':_0x6e44('0x88'),'attributes':_0x4251de,'include':[{'model':db['CmCompany'],'as':_0x6e44('0x89'),'attributes':['id',_0x6e44('0x2a')]}]},{'model':db[_0x6e44('0x8a')],'as':_0x6e44('0x8b'),'attributes':['id',_0x6e44('0x2a')]},{'model':db[_0x6e44('0x5e')],'as':_0x6e44('0x8c'),'attributes':['id',_0x6e44('0x2a'),_0x6e44('0x8d')]}]})[_0x6e44('0x26')](function(_0x17450a){if(_0x17450a){return _0x17450a['update']({'UserId':_0x2b6290[_0x6e44('0x67')]['id']},{'transaction':_0x522517});}});});}})[_0x6e44('0x26')](handleEntityNotFound(_0x42cda8,null))['then'](respondWithResult(_0x42cda8,null))[_0x6e44('0x54')](handleError(_0x42cda8,null));};exports['getOpenContacts']=function(_0xe39cfd,_0x322c6e,_0x1871b3){return _0xe39cfd[_0x6e44('0x67')][_0x6e44('0x76')]({'where':{'type':_0x6e44('0x77'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x14df4c){if(_0x14df4c&&_0x14df4c[_0x6e44('0x8e')]){return db[_0x6e44('0x51')][_0x6e44('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6e44('0x6a')](_0x6e44('0x6b'))},'VoiceQueueId':{'$in':_[_0x6e44('0x2c')](_0x14df4c,'id')},'$or':[{'UserId':null},{'UserId':_0xe39cfd[_0x6e44('0x67')]['id']}]}});}return 0x0;})[_0x6e44('0x26')](function(_0x3255cf){if(!_[_0x6e44('0x72')](_0x3255cf)&&_[_0x6e44('0x8f')](_0x3255cf)){return _0x322c6e[_0x6e44('0x1a')](0xc8)[_0x6e44('0x1c')]({'contacts':_0x3255cf});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x6e44('0x90'));_0x322c6e[_0x6e44('0x28')](0x194);}})[_0x6e44('0x54')](handleError(_0x322c6e,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 6abdc67..05307a4 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 _0xafc4=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','exports','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x442f98,_0x31ec60){var _0x5e8c01=function(_0x3ca2a0){while(--_0x3ca2a0){_0x442f98['push'](_0x442f98['shift']());}};_0x5e8c01(++_0x31ec60);}(_0xafc4,0x69));var _0x4afc=function(_0x46cff9,_0x23d782){_0x46cff9=_0x46cff9-0x0;var _0x524120=_0xafc4[_0x46cff9];return _0x524120;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x4afc('0xa')]},{'name':_0x4afc('0xb'),'fields':[_0x4afc('0xb')]},{'name':_0x4afc('0xc'),'fields':[_0x4afc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x3197b2,_0x56dcba){var _0x8bfb0=function(_0x3cb529){while(--_0x3cb529){_0x3197b2['push'](_0x3197b2['shift']());}};_0x8bfb0(++_0x56dcba);}(_0x2bd8,0x130));var _0x82bd=function(_0x519c40,_0x499209){_0x519c40=_0x519c40-0x0;var _0x150fb3=_0x2bd8[_0x519c40];return _0x150fb3;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'name':_0x82bd('0xd'),'fields':['scheduledat']},{'name':_0x82bd('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index afd6761..280b555 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 _0xea17=['raw','where','limit','include','model','attributes','map','GetCmHopper','stringify','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','CmContact','transaction','findAll','order','Contact','User','Agent','name','voicePause','length','UserId','includes','all','sequelize','CmHopperFinal','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','describe','LOCK','push','GetCmHopperPreview','keys','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CmHopper','options'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0xea17,0x14f));var _0x7ea1=function(_0x26b668,_0x336f8d){_0x26b668=_0x26b668-0x0;var _0x473231=_0xea17[_0x26b668];return _0x473231;};'use strict';var _=require(_0x7ea1('0x0'));var util=require(_0x7ea1('0x1'));var moment=require(_0x7ea1('0x2'));var BPromise=require(_0x7ea1('0x3'));var rs=require(_0x7ea1('0x4'));var fs=require('fs');var Redis=require(_0x7ea1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ea1('0x6'));var logger=require(_0x7ea1('0x7'))(_0x7ea1('0x8'));var config=require(_0x7ea1('0x9'));var jayson=require(_0x7ea1('0xa'));var client=jayson[_0x7ea1('0xb')][_0x7ea1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x378727,_0xadda97,_0x191caa){return new BPromise(function(_0x2c7188,_0x1c8fa7){return client[_0x7ea1('0xd')](_0x378727,_0x191caa)[_0x7ea1('0xe')](function(_0xb663af){logger[_0x7ea1('0xf')](_0x7ea1('0x10'),_0xadda97,_0x7ea1('0x11'));logger[_0x7ea1('0x12')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xadda97,_0x7ea1('0x11'),JSON['stringify'](_0xb663af));if(_0xb663af['error']){if(_0xb663af[_0x7ea1('0x13')]['code']===0x1f4){logger[_0x7ea1('0x13')]('CmHopper,\x20%s,\x20%s',_0xadda97,_0xb663af[_0x7ea1('0x13')][_0x7ea1('0x14')]);return _0x1c8fa7(_0xb663af[_0x7ea1('0x13')]['message']);}logger['error'](_0x7ea1('0x10'),_0xadda97,_0xb663af[_0x7ea1('0x13')][_0x7ea1('0x14')]);return _0x2c7188(_0xb663af[_0x7ea1('0x13')][_0x7ea1('0x14')]);}else{logger['info'](_0x7ea1('0x10'),_0xadda97,_0x7ea1('0x11'));_0x2c7188(_0xb663af[_0x7ea1('0x15')][_0x7ea1('0x14')]);}})[_0x7ea1('0x16')](function(_0x1a5934){logger['error'](_0x7ea1('0x10'),_0xadda97,_0x1a5934);_0x1c8fa7(_0x1a5934);});});}exports['GetCmHopper']=function(_0x2807b5){var _0x26e446=this;return new Promise(function(_0x30df71,_0x2206e3){return db[_0x7ea1('0x17')]['findAll']({'raw':_0x2807b5[_0x7ea1('0x18')]?_0x2807b5[_0x7ea1('0x18')][_0x7ea1('0x19')]===undefined?!![]:![]:!![],'where':_0x2807b5[_0x7ea1('0x18')]?_0x2807b5['options'][_0x7ea1('0x1a')]||null:null,'attributes':_0x2807b5[_0x7ea1('0x18')]?_0x2807b5[_0x7ea1('0x18')]['attributes']||null:null,'limit':_0x2807b5[_0x7ea1('0x18')]?_0x2807b5[_0x7ea1('0x18')][_0x7ea1('0x1b')]||null:null,'include':_0x2807b5[_0x7ea1('0x18')]?_0x2807b5[_0x7ea1('0x18')][_0x7ea1('0x1c')]?_['map'](_0x2807b5[_0x7ea1('0x18')][_0x7ea1('0x1c')],function(_0x506bf2){return{'model':db[_0x506bf2[_0x7ea1('0x1d')]],'as':_0x506bf2['as'],'attributes':_0x506bf2[_0x7ea1('0x1e')],'include':_0x506bf2[_0x7ea1('0x1c')]?_['map'](_0x506bf2['include'],function(_0x363802){return{'model':db[_0x363802['model']],'as':_0x363802['as'],'attributes':_0x363802[_0x7ea1('0x1e')],'include':_0x363802[_0x7ea1('0x1c')]?_[_0x7ea1('0x1f')](_0x363802[_0x7ea1('0x1c')],function(_0x1ee0ae){return{'model':db[_0x1ee0ae['model']],'as':_0x1ee0ae['as'],'attributes':_0x1ee0ae['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ea1('0xe')](function(_0x38ca27){logger[_0x7ea1('0xf')](_0x7ea1('0x20'),_0x2807b5);logger['debug'](_0x7ea1('0x20'),_0x2807b5,JSON[_0x7ea1('0x21')](_0x38ca27));_0x30df71(_0x38ca27);})['catch'](function(_0x2e5df9){logger['error'](_0x7ea1('0x20'),_0x2e5df9[_0x7ea1('0x14')],_0x2807b5);_0x2206e3(_0x26e446[_0x7ea1('0x13')](0x1f4,_0x2e5df9[_0x7ea1('0x14')]));});});};exports['ShowCmHopper']=function(_0x10e2a7){var _0x89e6a1=this;return new Promise(function(_0x56e412,_0x471c9b){return db['CmHopper'][_0x7ea1('0x22')]({'raw':_0x10e2a7[_0x7ea1('0x18')]?_0x10e2a7['options']['raw']===undefined?!![]:![]:!![],'where':_0x10e2a7[_0x7ea1('0x18')]?_0x10e2a7[_0x7ea1('0x18')][_0x7ea1('0x1a')]||null:null,'attributes':_0x10e2a7['options']?_0x10e2a7[_0x7ea1('0x18')]['attributes']||null:null,'include':_0x10e2a7[_0x7ea1('0x18')]?_0x10e2a7[_0x7ea1('0x18')][_0x7ea1('0x1c')]?_[_0x7ea1('0x1f')](_0x10e2a7['options'][_0x7ea1('0x1c')],function(_0x580a64){return{'model':db[_0x580a64[_0x7ea1('0x1d')]],'as':_0x580a64['as'],'attributes':_0x580a64[_0x7ea1('0x1e')],'include':_0x580a64['include']?_[_0x7ea1('0x1f')](_0x580a64[_0x7ea1('0x1c')],function(_0x14e188){return{'model':db[_0x14e188[_0x7ea1('0x1d')]],'as':_0x14e188['as'],'attributes':_0x14e188[_0x7ea1('0x1e')],'include':_0x14e188['include']?_[_0x7ea1('0x1f')](_0x14e188[_0x7ea1('0x1c')],function(_0x961817){return{'model':db[_0x961817[_0x7ea1('0x1d')]],'as':_0x961817['as'],'attributes':_0x961817[_0x7ea1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7ea1('0xe')](function(_0x4f1d6f){logger['info']('ShowCmHopper',_0x10e2a7);logger[_0x7ea1('0x12')](_0x7ea1('0x23'),_0x10e2a7,JSON[_0x7ea1('0x21')](_0x4f1d6f));_0x56e412(_0x4f1d6f);})[_0x7ea1('0x16')](function(_0x1714bb){logger[_0x7ea1('0x13')]('ShowCmHopper',_0x1714bb[_0x7ea1('0x14')],_0x10e2a7);_0x471c9b(_0x89e6a1[_0x7ea1('0x13')](0x1f4,_0x1714bb[_0x7ea1('0x14')]));});});};exports['CreateCmHopper']=function(_0x51bf92){var _0x1eeec5=this;return new Promise(function(_0x4b2d4a,_0x40efb7){return db[_0x7ea1('0x17')][_0x7ea1('0x24')](_0x51bf92[_0x7ea1('0x25')],{'raw':_0x51bf92['options']?_0x51bf92[_0x7ea1('0x18')][_0x7ea1('0x19')]===undefined?!![]:![]:!![]})[_0x7ea1('0xe')](function(_0x19870e){logger['info'](_0x7ea1('0x26'),_0x51bf92);logger[_0x7ea1('0x12')](_0x7ea1('0x26'),_0x51bf92,JSON[_0x7ea1('0x21')](_0x19870e));_0x4b2d4a(_0x19870e);})[_0x7ea1('0x16')](function(_0x43ee5f){logger['error'](_0x7ea1('0x26'),_0x43ee5f[_0x7ea1('0x14')],_0x51bf92);_0x40efb7(_0x1eeec5[_0x7ea1('0x13')](0x1f4,_0x43ee5f['message']));});});};exports[_0x7ea1('0x27')]=function(_0x12f4c9){var _0x323c2f=this;return new Promise(function(_0x4c50d2,_0xcb5407){return db[_0x7ea1('0x17')][_0x7ea1('0x28')](_0x12f4c9[_0x7ea1('0x25')],{'raw':_0x12f4c9['options']?_0x12f4c9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12f4c9[_0x7ea1('0x18')]?_0x12f4c9[_0x7ea1('0x18')][_0x7ea1('0x1a')]||null:null,'attributes':_0x12f4c9[_0x7ea1('0x18')]?_0x12f4c9[_0x7ea1('0x18')][_0x7ea1('0x1e')]||null:null,'limit':_0x12f4c9[_0x7ea1('0x18')]?_0x12f4c9['options']['limit']||null:null})[_0x7ea1('0xe')](function(_0x10baf3){logger[_0x7ea1('0xf')](_0x7ea1('0x27'),_0x12f4c9);logger[_0x7ea1('0x12')](_0x7ea1('0x27'),_0x12f4c9,JSON[_0x7ea1('0x21')](_0x10baf3));_0x4c50d2(_0x10baf3);})['catch'](function(_0x20d447){logger[_0x7ea1('0x13')](_0x7ea1('0x27'),_0x20d447[_0x7ea1('0x14')],_0x12f4c9);_0xcb5407(_0x323c2f[_0x7ea1('0x13')](0x1f4,_0x20d447[_0x7ea1('0x14')]));});});};exports['DestroyCmHopper']=function(_0x4b34e5){var _0x62418f=this;return new Promise(function(_0x4b7f24,_0xe59219){return db[_0x7ea1('0x17')]['destroy']({'where':_0x4b34e5[_0x7ea1('0x18')]?_0x4b34e5[_0x7ea1('0x18')][_0x7ea1('0x1a')]||null:null})[_0x7ea1('0xe')](function(_0x4112b2){logger[_0x7ea1('0xf')]('DestroyCmHopper',_0x4b34e5);logger['debug'](_0x7ea1('0x29'),_0x4b34e5,JSON['stringify'](_0x4112b2));_0x4b7f24(_0x4112b2);})[_0x7ea1('0x16')](function(_0x384939){logger[_0x7ea1('0x13')]('DestroyCmHopper',_0x384939['message'],_0x4b34e5);_0xe59219(_0x62418f[_0x7ea1('0x13')](0x1f4,_0x384939[_0x7ea1('0x14')]));});});};exports[_0x7ea1('0x2a')]=function(_0x41969e){var _0x1de6e9=this;return new Promise(function(_0xd1289a,_0x53bed1){return db[_0x7ea1('0x2b')]['describe']()[_0x7ea1('0xe')](function(_0x4d97f8){return db['sequelize'][_0x7ea1('0x2c')](function(_0x17914e){return db['CmHopper'][_0x7ea1('0x2d')]({'where':_0x41969e[_0x7ea1('0x18')]?_0x41969e[_0x7ea1('0x18')][_0x7ea1('0x1a')]||null:null,'attributes':_0x41969e['options']?_0x41969e[_0x7ea1('0x18')][_0x7ea1('0x1e')]||null:null,'limit':_0x41969e['options']?_0x41969e[_0x7ea1('0x18')]['limit']||null:null,'order':_0x41969e[_0x7ea1('0x18')]?_0x41969e[_0x7ea1('0x18')][_0x7ea1('0x2e')]||null:null,'transaction':_0x17914e,'lock':_0x17914e['LOCK']['UPDATE'],'include':[{'model':db[_0x7ea1('0x2b')],'as':_0x7ea1('0x2f'),'attributes':_['keys'](_0x4d97f8)},{'model':db[_0x7ea1('0x30')],'as':_0x7ea1('0x31'),'attributes':['id',_0x7ea1('0x32'),_0x7ea1('0x33')]}]})['then'](function(_0x2b4258){var _0x2419fb=[];var _0x435dea=[];for(var _0x1f68e2=0x0;_0x1f68e2<_0x2b4258[_0x7ea1('0x34')];_0x1f68e2+=0x1){var _0x1401e1=_0x2b4258[_0x1f68e2][_0x7ea1('0x35')];if(_0x1401e1===null){_0x2419fb['push'](_0x2b4258[_0x1f68e2]['update'](_0x41969e[_0x7ea1('0x25')],{'transaction':_0x17914e}));}else if(!_0x435dea[_0x7ea1('0x36')](_0x1401e1)){_0x435dea['push'](_0x1401e1);_0x2419fb['push'](_0x2b4258[_0x1f68e2][_0x7ea1('0x28')](_0x41969e['body'],{'transaction':_0x17914e}));}}return BPromise[_0x7ea1('0x37')](_0x2419fb);});})[_0x7ea1('0xe')](function(_0x3d2572){logger[_0x7ea1('0xf')](_0x7ea1('0x2a'),_0x41969e);logger['debug']('GetContactDialer',_0x41969e,JSON[_0x7ea1('0x21')](_0x3d2572));_0xd1289a(_0x3d2572);})[_0x7ea1('0x16')](function(_0x2386fb){logger[_0x7ea1('0x13')](_0x7ea1('0x2a'),_0x2386fb[_0x7ea1('0x14')],_0x41969e);_0x53bed1(_0x1de6e9['error'](0x1f4,_0x2386fb[_0x7ea1('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x55f658){var _0x21fecf=this;return new Promise(function(_0x346099,_0x591721){return db[_0x7ea1('0x38')][_0x7ea1('0x2c')](function(_0x428c75){return db[_0x7ea1('0x39')][_0x7ea1('0x24')](_0x55f658['body'],{'raw':_0x55f658[_0x7ea1('0x18')]?_0x55f658['options'][_0x7ea1('0x19')]===undefined?!![]:![]:!![],'transaction':_0x428c75})[_0x7ea1('0xe')](function(){return db[_0x7ea1('0x17')]['destroy']({'where':_0x55f658[_0x7ea1('0x18')]?_0x55f658[_0x7ea1('0x18')][_0x7ea1('0x1a')]||null:null,'transaction':_0x428c75});});})[_0x7ea1('0xe')](function(_0x69f4dc){logger[_0x7ea1('0xf')](_0x7ea1('0x3a'),_0x55f658);logger['debug']('MoveContactManagedDialer',_0x55f658,JSON[_0x7ea1('0x21')](_0x69f4dc));_0x346099(_0x69f4dc);})[_0x7ea1('0x16')](function(_0x4d2614){logger[_0x7ea1('0x13')]('MoveContactManagedDialer',_0x4d2614['message'],_0x55f658);_0x591721(_0x21fecf[_0x7ea1('0x13')](0x1f4,_0x4d2614[_0x7ea1('0x14')]));});});};exports['CountReScheduled']=function(_0x1cc904){var _0x2073eb=this;return new Promise(function(_0x10fba1,_0x4b3bad){return db['CmHopper'][_0x7ea1('0x2d')]({'raw':_0x1cc904[_0x7ea1('0x18')]?_0x1cc904['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cc904[_0x7ea1('0x18')]?_0x1cc904[_0x7ea1('0x18')]['where']||null:null,'attributes':[[db[_0x7ea1('0x38')]['fn'](_0x7ea1('0x3b'),db['sequelize']['fn']('IF',db['sequelize'][_0x7ea1('0x3c')](_0x7ea1('0x3d')+util['format']('\x22%s\x22',moment()[_0x7ea1('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x7ea1('0x3f')))),_0x7ea1('0x40')]]})[_0x7ea1('0xe')](function(_0x3702f1){logger[_0x7ea1('0xf')](_0x7ea1('0x41'),_0x1cc904);logger[_0x7ea1('0x12')](_0x7ea1('0x41'),_0x1cc904,JSON[_0x7ea1('0x21')](_0x3702f1));_0x10fba1(_0x3702f1);})['catch'](function(_0x1480c2){logger['error']('CountReScheduled',_0x1480c2[_0x7ea1('0x14')],_0x1cc904);_0x4b3bad(_0x2073eb[_0x7ea1('0x13')](0x1f4,_0x1480c2[_0x7ea1('0x14')]));});});};exports[_0x7ea1('0x42')]=function(_0x2096d6){var _0x51c5ff=this;return new Promise(function(_0x2294b8,_0x2a66ce){return db[_0x7ea1('0x2b')][_0x7ea1('0x43')]()['then'](function(_0x1c619f){return db[_0x7ea1('0x38')]['transaction'](function(_0x3052a3){return db[_0x7ea1('0x17')][_0x7ea1('0x2d')]({'where':_0x2096d6['options']?_0x2096d6[_0x7ea1('0x18')][_0x7ea1('0x1a')]||null:null,'attributes':_0x2096d6[_0x7ea1('0x18')]?_0x2096d6[_0x7ea1('0x18')][_0x7ea1('0x1e')]||null:null,'limit':0x1,'order':_0x2096d6['options']?_0x2096d6[_0x7ea1('0x18')][_0x7ea1('0x2e')]||null:null,'group':db[_0x7ea1('0x17')]['UserId'],'transaction':_0x3052a3,'lock':_0x3052a3[_0x7ea1('0x44')]['UPDATE'],'include':_0x2096d6[_0x7ea1('0x18')]?_0x2096d6[_0x7ea1('0x18')]['include']?_[_0x7ea1('0x1f')](_0x2096d6[_0x7ea1('0x18')]['include'],function(_0xecdd3e){return{'model':db[_0xecdd3e[_0x7ea1('0x1d')]],'as':_0xecdd3e['as'],'attributes':_0xecdd3e[_0x7ea1('0x1e')],'include':_0xecdd3e[_0x7ea1('0x1c')]?_[_0x7ea1('0x1f')](_0xecdd3e[_0x7ea1('0x1c')],function(_0x105fc0){return{'model':db[_0x105fc0['model']],'as':_0x105fc0['as'],'attributes':_0x105fc0['attributes'],'include':_0x105fc0['include']?_['map'](_0x105fc0[_0x7ea1('0x1c')],function(_0x265bc9){return{'model':db[_0x265bc9[_0x7ea1('0x1d')]],'as':_0x265bc9['as'],'attributes':_0x265bc9[_0x7ea1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7ea1('0xe')](function(_0x386be4){var _0xbd2cf1=[];for(var _0x44f3a8=0x0;_0x44f3a8<_0x386be4['length'];_0x44f3a8+=0x1){_0xbd2cf1[_0x7ea1('0x45')](_0x386be4[_0x44f3a8][_0x7ea1('0x28')](_0x2096d6[_0x7ea1('0x25')],{'transaction':_0x3052a3}));}return BPromise[_0x7ea1('0x37')](_0xbd2cf1);});})[_0x7ea1('0xe')](function(_0x39b867){logger[_0x7ea1('0xf')](_0x7ea1('0x42'),_0x2096d6);logger[_0x7ea1('0x12')](_0x7ea1('0x42'),_0x2096d6,JSON[_0x7ea1('0x21')](_0x39b867));_0x2294b8(_0x39b867);})['catch'](function(_0xe64ea2){logger['error'](_0x7ea1('0x42'),_0xe64ea2[_0x7ea1('0x14')],_0x2096d6);_0x2a66ce(_0x51c5ff[_0x7ea1('0x13')](0x1f4,_0xe64ea2['message']));});});});};exports[_0x7ea1('0x46')]=function(_0x48fc55){var _0x121464=this;return new Promise(function(_0xf332d4,_0x3dd9a2){db['CmContact'][_0x7ea1('0x43')]()[_0x7ea1('0xe')](function(_0xaa75b5){return db[_0x7ea1('0x17')][_0x7ea1('0x2d')]({'raw':_0x48fc55['options']?_0x48fc55[_0x7ea1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x48fc55['options']?_0x48fc55[_0x7ea1('0x18')][_0x7ea1('0x1a')]||null:null,'attributes':_0x48fc55['options']?_0x48fc55[_0x7ea1('0x18')][_0x7ea1('0x1e')]||null:null,'limit':_0x48fc55['options']?_0x48fc55[_0x7ea1('0x18')][_0x7ea1('0x1b')]||null:null,'include':_0x48fc55['options']?_0x48fc55[_0x7ea1('0x18')][_0x7ea1('0x1c')]?_[_0x7ea1('0x1f')](_0x48fc55[_0x7ea1('0x18')][_0x7ea1('0x1c')],function(_0x2f307f){return{'model':db[_0x2f307f['model']],'as':_0x2f307f['as'],'attributes':_0x2f307f['as']===_0x7ea1('0x2f')?_[_0x7ea1('0x47')](_0xaa75b5):_0x2f307f[_0x7ea1('0x1e')],'include':_0x2f307f[_0x7ea1('0x1c')]?_[_0x7ea1('0x1f')](_0x2f307f[_0x7ea1('0x1c')],function(_0x348cef){return{'model':db[_0x348cef[_0x7ea1('0x1d')]],'as':_0x348cef['as'],'attributes':_0x348cef[_0x7ea1('0x1e')],'include':_0x348cef[_0x7ea1('0x1c')]?_[_0x7ea1('0x1f')](_0x348cef[_0x7ea1('0x1c')],function(_0x2bfd7c){return{'model':db[_0x2bfd7c[_0x7ea1('0x1d')]],'as':_0x2bfd7c['as'],'attributes':_0x2bfd7c[_0x7ea1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7ea1('0xe')](function(_0x199d93){logger[_0x7ea1('0xf')](_0x7ea1('0x20'),_0x48fc55);logger[_0x7ea1('0x12')](_0x7ea1('0x20'),_0x48fc55,JSON[_0x7ea1('0x21')](_0x199d93));_0xf332d4(_0x199d93);})[_0x7ea1('0x16')](function(_0x1fef53){logger[_0x7ea1('0x13')]('GetCmHopper',_0x1fef53[_0x7ea1('0x14')],_0x48fc55);_0x3dd9a2(_0x121464[_0x7ea1('0x13')](0x1f4,_0x1fef53['message']));});});});}; \ No newline at end of file +var _0x1ac8=['options','raw','where','attributes','map','model','include','stringify','ShowCmHopper','CmHopper','find','CreateCmHopper','create','update','limit','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','findAll','LOCK','UPDATE','CmContact','Contact','Agent','name','voicePause','length','UserId','push','body','includes','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','all','GetCmHopperPreview','keys','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','catch','GetCmHopper'];(function(_0x4f7481,_0x59b10c){var _0x4b2368=function(_0x4e10c0){while(--_0x4e10c0){_0x4f7481['push'](_0x4f7481['shift']());}};_0x4b2368(++_0x59b10c);}(_0x1ac8,0x199));var _0x81ac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1ac8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x81ac('0x0'));var util=require(_0x81ac('0x1'));var moment=require(_0x81ac('0x2'));var BPromise=require(_0x81ac('0x3'));var rs=require(_0x81ac('0x4'));var fs=require('fs');var Redis=require(_0x81ac('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x81ac('0x6'));var logger=require(_0x81ac('0x7'))(_0x81ac('0x8'));var config=require('../../config/environment');var jayson=require(_0x81ac('0x9'));var client=jayson[_0x81ac('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0091,_0x4ec900,_0x561866){return new BPromise(function(_0x14a8e2,_0x47a99c){return client[_0x81ac('0xb')](_0x2f0091,_0x561866)[_0x81ac('0xc')](function(_0x105204){logger[_0x81ac('0xd')]('CmHopper,\x20%s,\x20%s',_0x4ec900,_0x81ac('0xe'));logger[_0x81ac('0xf')](_0x81ac('0x10'),_0x4ec900,_0x81ac('0xe'),JSON['stringify'](_0x105204));if(_0x105204[_0x81ac('0x11')]){if(_0x105204['error'][_0x81ac('0x12')]===0x1f4){logger[_0x81ac('0x11')](_0x81ac('0x13'),_0x4ec900,_0x105204[_0x81ac('0x11')][_0x81ac('0x14')]);return _0x47a99c(_0x105204[_0x81ac('0x11')][_0x81ac('0x14')]);}logger[_0x81ac('0x11')](_0x81ac('0x13'),_0x4ec900,_0x105204[_0x81ac('0x11')]['message']);return _0x14a8e2(_0x105204[_0x81ac('0x11')][_0x81ac('0x14')]);}else{logger['info'](_0x81ac('0x13'),_0x4ec900,'request\x20sent');_0x14a8e2(_0x105204['result'][_0x81ac('0x14')]);}})[_0x81ac('0x15')](function(_0x2e4f76){logger[_0x81ac('0x11')](_0x81ac('0x13'),_0x4ec900,_0x2e4f76);_0x47a99c(_0x2e4f76);});});}exports[_0x81ac('0x16')]=function(_0x3da50d){var _0x3330d0=this;return new Promise(function(_0x5c7f5a,_0x30846d){return db['CmHopper']['findAll']({'raw':_0x3da50d[_0x81ac('0x17')]?_0x3da50d[_0x81ac('0x17')][_0x81ac('0x18')]===undefined?!![]:![]:!![],'where':_0x3da50d[_0x81ac('0x17')]?_0x3da50d[_0x81ac('0x17')][_0x81ac('0x19')]||null:null,'attributes':_0x3da50d[_0x81ac('0x17')]?_0x3da50d[_0x81ac('0x17')][_0x81ac('0x1a')]||null:null,'limit':_0x3da50d[_0x81ac('0x17')]?_0x3da50d[_0x81ac('0x17')]['limit']||null:null,'include':_0x3da50d[_0x81ac('0x17')]?_0x3da50d[_0x81ac('0x17')]['include']?_[_0x81ac('0x1b')](_0x3da50d[_0x81ac('0x17')]['include'],function(_0x445799){return{'model':db[_0x445799[_0x81ac('0x1c')]],'as':_0x445799['as'],'attributes':_0x445799[_0x81ac('0x1a')],'include':_0x445799[_0x81ac('0x1d')]?_[_0x81ac('0x1b')](_0x445799['include'],function(_0xb86508){return{'model':db[_0xb86508['model']],'as':_0xb86508['as'],'attributes':_0xb86508[_0x81ac('0x1a')],'include':_0xb86508[_0x81ac('0x1d')]?_[_0x81ac('0x1b')](_0xb86508[_0x81ac('0x1d')],function(_0x5c7d7f){return{'model':db[_0x5c7d7f[_0x81ac('0x1c')]],'as':_0x5c7d7f['as'],'attributes':_0x5c7d7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x81ac('0xc')](function(_0x5cfb85){logger[_0x81ac('0xd')](_0x81ac('0x16'),_0x3da50d);logger[_0x81ac('0xf')](_0x81ac('0x16'),_0x3da50d,JSON[_0x81ac('0x1e')](_0x5cfb85));_0x5c7f5a(_0x5cfb85);})['catch'](function(_0x29cf65){logger[_0x81ac('0x11')](_0x81ac('0x16'),_0x29cf65[_0x81ac('0x14')],_0x3da50d);_0x30846d(_0x3330d0[_0x81ac('0x11')](0x1f4,_0x29cf65['message']));});});};exports[_0x81ac('0x1f')]=function(_0x5e632b){var _0xd131bb=this;return new Promise(function(_0x48f63a,_0x26654d){return db[_0x81ac('0x20')][_0x81ac('0x21')]({'raw':_0x5e632b[_0x81ac('0x17')]?_0x5e632b[_0x81ac('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5e632b[_0x81ac('0x17')]?_0x5e632b[_0x81ac('0x17')][_0x81ac('0x19')]||null:null,'attributes':_0x5e632b[_0x81ac('0x17')]?_0x5e632b['options']['attributes']||null:null,'include':_0x5e632b[_0x81ac('0x17')]?_0x5e632b[_0x81ac('0x17')]['include']?_[_0x81ac('0x1b')](_0x5e632b[_0x81ac('0x17')][_0x81ac('0x1d')],function(_0x217852){return{'model':db[_0x217852[_0x81ac('0x1c')]],'as':_0x217852['as'],'attributes':_0x217852[_0x81ac('0x1a')],'include':_0x217852[_0x81ac('0x1d')]?_[_0x81ac('0x1b')](_0x217852[_0x81ac('0x1d')],function(_0x54275d){return{'model':db[_0x54275d['model']],'as':_0x54275d['as'],'attributes':_0x54275d[_0x81ac('0x1a')],'include':_0x54275d['include']?_[_0x81ac('0x1b')](_0x54275d[_0x81ac('0x1d')],function(_0x54c4f5){return{'model':db[_0x54c4f5['model']],'as':_0x54c4f5['as'],'attributes':_0x54c4f5[_0x81ac('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x81ac('0xc')](function(_0x4d5f43){logger['info'](_0x81ac('0x1f'),_0x5e632b);logger[_0x81ac('0xf')](_0x81ac('0x1f'),_0x5e632b,JSON['stringify'](_0x4d5f43));_0x48f63a(_0x4d5f43);})[_0x81ac('0x15')](function(_0x5799b3){logger[_0x81ac('0x11')](_0x81ac('0x1f'),_0x5799b3[_0x81ac('0x14')],_0x5e632b);_0x26654d(_0xd131bb[_0x81ac('0x11')](0x1f4,_0x5799b3['message']));});});};exports[_0x81ac('0x22')]=function(_0x32177c){var _0xe6a868=this;return new Promise(function(_0x39913a,_0x1b2efa){return db[_0x81ac('0x20')][_0x81ac('0x23')](_0x32177c['body'],{'raw':_0x32177c['options']?_0x32177c[_0x81ac('0x17')][_0x81ac('0x18')]===undefined?!![]:![]:!![]})[_0x81ac('0xc')](function(_0x32714d){logger[_0x81ac('0xd')]('CreateCmHopper',_0x32177c);logger[_0x81ac('0xf')](_0x81ac('0x22'),_0x32177c,JSON[_0x81ac('0x1e')](_0x32714d));_0x39913a(_0x32714d);})[_0x81ac('0x15')](function(_0x3c4cf1){logger['error'](_0x81ac('0x22'),_0x3c4cf1[_0x81ac('0x14')],_0x32177c);_0x1b2efa(_0xe6a868[_0x81ac('0x11')](0x1f4,_0x3c4cf1['message']));});});};exports['UpdateCmHopper']=function(_0x86f38){var _0x173f80=this;return new Promise(function(_0x3ea806,_0x4c5ad7){return db[_0x81ac('0x20')][_0x81ac('0x24')](_0x86f38['body'],{'raw':_0x86f38[_0x81ac('0x17')]?_0x86f38[_0x81ac('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x86f38['options']?_0x86f38[_0x81ac('0x17')][_0x81ac('0x19')]||null:null,'attributes':_0x86f38[_0x81ac('0x17')]?_0x86f38[_0x81ac('0x17')][_0x81ac('0x1a')]||null:null,'limit':_0x86f38[_0x81ac('0x17')]?_0x86f38[_0x81ac('0x17')][_0x81ac('0x25')]||null:null})[_0x81ac('0xc')](function(_0x223320){logger[_0x81ac('0xd')](_0x81ac('0x26'),_0x86f38);logger[_0x81ac('0xf')](_0x81ac('0x26'),_0x86f38,JSON[_0x81ac('0x1e')](_0x223320));_0x3ea806(_0x223320);})['catch'](function(_0x57c4f3){logger[_0x81ac('0x11')](_0x81ac('0x26'),_0x57c4f3['message'],_0x86f38);_0x4c5ad7(_0x173f80[_0x81ac('0x11')](0x1f4,_0x57c4f3[_0x81ac('0x14')]));});});};exports[_0x81ac('0x27')]=function(_0x331b32){var _0x1237ea=this;return new Promise(function(_0x2c30ed,_0x5edb1b){return db['CmHopper'][_0x81ac('0x28')]({'where':_0x331b32[_0x81ac('0x17')]?_0x331b32[_0x81ac('0x17')][_0x81ac('0x19')]||null:null})[_0x81ac('0xc')](function(_0x12394a){logger[_0x81ac('0xd')](_0x81ac('0x27'),_0x331b32);logger[_0x81ac('0xf')](_0x81ac('0x27'),_0x331b32,JSON[_0x81ac('0x1e')](_0x12394a));_0x2c30ed(_0x12394a);})[_0x81ac('0x15')](function(_0xa85394){logger[_0x81ac('0x11')](_0x81ac('0x27'),_0xa85394[_0x81ac('0x14')],_0x331b32);_0x5edb1b(_0x1237ea[_0x81ac('0x11')](0x1f4,_0xa85394[_0x81ac('0x14')]));});});};exports[_0x81ac('0x29')]=function(_0x53255a){var _0x5317b6=this;return new Promise(function(_0x2fbf57,_0x46d954){return db['CmContact'][_0x81ac('0x2a')]()[_0x81ac('0xc')](function(_0x1f4415){return db[_0x81ac('0x2b')][_0x81ac('0x2c')](function(_0x5e7700){return db[_0x81ac('0x20')][_0x81ac('0x2d')]({'where':_0x53255a['options']?_0x53255a[_0x81ac('0x17')][_0x81ac('0x19')]||null:null,'attributes':_0x53255a[_0x81ac('0x17')]?_0x53255a[_0x81ac('0x17')]['attributes']||null:null,'limit':_0x53255a[_0x81ac('0x17')]?_0x53255a['options'][_0x81ac('0x25')]||null:null,'order':_0x53255a[_0x81ac('0x17')]?_0x53255a['options']['order']||null:null,'transaction':_0x5e7700,'lock':_0x5e7700[_0x81ac('0x2e')][_0x81ac('0x2f')],'include':[{'model':db[_0x81ac('0x30')],'as':_0x81ac('0x31'),'attributes':_['keys'](_0x1f4415)},{'model':db['User'],'as':_0x81ac('0x32'),'attributes':['id',_0x81ac('0x33'),_0x81ac('0x34')]}]})['then'](function(_0x1cc5e6){var _0x19d583=[];var _0x1aee61=[];for(var _0x26498a=0x0;_0x26498a<_0x1cc5e6[_0x81ac('0x35')];_0x26498a+=0x1){var _0x1ef550=_0x1cc5e6[_0x26498a][_0x81ac('0x36')];if(_0x1ef550===null){_0x19d583[_0x81ac('0x37')](_0x1cc5e6[_0x26498a][_0x81ac('0x24')](_0x53255a[_0x81ac('0x38')],{'transaction':_0x5e7700}));}else if(!_0x1aee61[_0x81ac('0x39')](_0x1ef550)){_0x1aee61[_0x81ac('0x37')](_0x1ef550);_0x19d583['push'](_0x1cc5e6[_0x26498a][_0x81ac('0x24')](_0x53255a[_0x81ac('0x38')],{'transaction':_0x5e7700}));}}return BPromise['all'](_0x19d583);});})['then'](function(_0x2ce30c){logger[_0x81ac('0xd')](_0x81ac('0x29'),_0x53255a);logger[_0x81ac('0xf')](_0x81ac('0x29'),_0x53255a,JSON[_0x81ac('0x1e')](_0x2ce30c));_0x2fbf57(_0x2ce30c);})['catch'](function(_0x1e9401){logger[_0x81ac('0x11')](_0x81ac('0x29'),_0x1e9401[_0x81ac('0x14')],_0x53255a);_0x46d954(_0x5317b6[_0x81ac('0x11')](0x1f4,_0x1e9401[_0x81ac('0x14')]));});});});};exports[_0x81ac('0x3a')]=function(_0x3b7820){var _0x567f75=this;return new Promise(function(_0x421c1e,_0x324850){return db[_0x81ac('0x2b')]['transaction'](function(_0x5c619b){return db[_0x81ac('0x3b')]['create'](_0x3b7820[_0x81ac('0x38')],{'raw':_0x3b7820[_0x81ac('0x17')]?_0x3b7820[_0x81ac('0x17')][_0x81ac('0x18')]===undefined?!![]:![]:!![],'transaction':_0x5c619b})[_0x81ac('0xc')](function(){return db[_0x81ac('0x20')][_0x81ac('0x28')]({'where':_0x3b7820[_0x81ac('0x17')]?_0x3b7820[_0x81ac('0x17')][_0x81ac('0x19')]||null:null,'transaction':_0x5c619b});});})['then'](function(_0x155492){logger[_0x81ac('0xd')](_0x81ac('0x3a'),_0x3b7820);logger[_0x81ac('0xf')]('MoveContactManagedDialer',_0x3b7820,JSON[_0x81ac('0x1e')](_0x155492));_0x421c1e(_0x155492);})[_0x81ac('0x15')](function(_0x13e6b1){logger[_0x81ac('0x11')]('MoveContactManagedDialer',_0x13e6b1[_0x81ac('0x14')],_0x3b7820);_0x324850(_0x567f75[_0x81ac('0x11')](0x1f4,_0x13e6b1[_0x81ac('0x14')]));});});};exports[_0x81ac('0x3c')]=function(_0x58c5e7){var _0x38f191=this;return new Promise(function(_0x23cc44,_0x4c2fd2){return db[_0x81ac('0x20')][_0x81ac('0x2d')]({'raw':_0x58c5e7[_0x81ac('0x17')]?_0x58c5e7[_0x81ac('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58c5e7[_0x81ac('0x17')]?_0x58c5e7[_0x81ac('0x17')][_0x81ac('0x19')]||null:null,'attributes':[[db[_0x81ac('0x2b')]['fn'](_0x81ac('0x3d'),db[_0x81ac('0x2b')]['fn']('IF',db['sequelize'][_0x81ac('0x3e')](_0x81ac('0x3f')+util[_0x81ac('0x40')](_0x81ac('0x41'),moment()[_0x81ac('0x40')](_0x81ac('0x42')))+'\x20,\x201,\x20null'))),_0x81ac('0x43')]]})[_0x81ac('0xc')](function(_0x5bbcd7){logger[_0x81ac('0xd')](_0x81ac('0x3c'),_0x58c5e7);logger[_0x81ac('0xf')]('CountReScheduled',_0x58c5e7,JSON[_0x81ac('0x1e')](_0x5bbcd7));_0x23cc44(_0x5bbcd7);})[_0x81ac('0x15')](function(_0x30e869){logger[_0x81ac('0x11')]('CountReScheduled',_0x30e869[_0x81ac('0x14')],_0x58c5e7);_0x4c2fd2(_0x38f191[_0x81ac('0x11')](0x1f4,_0x30e869[_0x81ac('0x14')]));});});};exports[_0x81ac('0x44')]=function(_0x58ad14){var _0x1a9227=this;return new Promise(function(_0x2e1888,_0x10cf3f){return db[_0x81ac('0x30')][_0x81ac('0x2a')]()['then'](function(_0x10f62a){return db[_0x81ac('0x2b')]['transaction'](function(_0x45d6cc){return db[_0x81ac('0x20')][_0x81ac('0x2d')]({'where':_0x58ad14['options']?_0x58ad14[_0x81ac('0x17')]['where']||null:null,'attributes':_0x58ad14[_0x81ac('0x17')]?_0x58ad14[_0x81ac('0x17')][_0x81ac('0x1a')]||null:null,'limit':0x1,'order':_0x58ad14['options']?_0x58ad14[_0x81ac('0x17')]['order']||null:null,'group':db[_0x81ac('0x20')][_0x81ac('0x36')],'transaction':_0x45d6cc,'lock':_0x45d6cc['LOCK'][_0x81ac('0x2f')],'include':_0x58ad14[_0x81ac('0x17')]?_0x58ad14[_0x81ac('0x17')][_0x81ac('0x1d')]?_['map'](_0x58ad14[_0x81ac('0x17')][_0x81ac('0x1d')],function(_0x1aed0c){return{'model':db[_0x1aed0c['model']],'as':_0x1aed0c['as'],'attributes':_0x1aed0c[_0x81ac('0x1a')],'include':_0x1aed0c[_0x81ac('0x1d')]?_['map'](_0x1aed0c[_0x81ac('0x1d')],function(_0x2f4677){return{'model':db[_0x2f4677[_0x81ac('0x1c')]],'as':_0x2f4677['as'],'attributes':_0x2f4677[_0x81ac('0x1a')],'include':_0x2f4677[_0x81ac('0x1d')]?_['map'](_0x2f4677[_0x81ac('0x1d')],function(_0x124175){return{'model':db[_0x124175['model']],'as':_0x124175['as'],'attributes':_0x124175['attributes']};}):[]};}):[]};}):[]:[]})[_0x81ac('0xc')](function(_0x73247e){var _0x51a94d=[];for(var _0xa78219=0x0;_0xa78219<_0x73247e[_0x81ac('0x35')];_0xa78219+=0x1){_0x51a94d[_0x81ac('0x37')](_0x73247e[_0xa78219][_0x81ac('0x24')](_0x58ad14[_0x81ac('0x38')],{'transaction':_0x45d6cc}));}return BPromise[_0x81ac('0x45')](_0x51a94d);});})[_0x81ac('0xc')](function(_0x9ed439){logger[_0x81ac('0xd')]('GetContactRecallMe',_0x58ad14);logger['debug'](_0x81ac('0x44'),_0x58ad14,JSON[_0x81ac('0x1e')](_0x9ed439));_0x2e1888(_0x9ed439);})['catch'](function(_0xf764be){logger[_0x81ac('0x11')](_0x81ac('0x44'),_0xf764be['message'],_0x58ad14);_0x10cf3f(_0x1a9227[_0x81ac('0x11')](0x1f4,_0xf764be[_0x81ac('0x14')]));});});});};exports[_0x81ac('0x46')]=function(_0x4da4a2){var _0xe6cc62=this;return new Promise(function(_0x141fd6,_0x5b6ae2){db[_0x81ac('0x30')][_0x81ac('0x2a')]()[_0x81ac('0xc')](function(_0x1bf366){return db['CmHopper'][_0x81ac('0x2d')]({'raw':_0x4da4a2['options']?_0x4da4a2[_0x81ac('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4da4a2[_0x81ac('0x17')]?_0x4da4a2['options'][_0x81ac('0x19')]||null:null,'attributes':_0x4da4a2[_0x81ac('0x17')]?_0x4da4a2[_0x81ac('0x17')][_0x81ac('0x1a')]||null:null,'limit':_0x4da4a2[_0x81ac('0x17')]?_0x4da4a2[_0x81ac('0x17')][_0x81ac('0x25')]||null:null,'include':_0x4da4a2['options']?_0x4da4a2['options'][_0x81ac('0x1d')]?_['map'](_0x4da4a2['options'][_0x81ac('0x1d')],function(_0x42f76c){return{'model':db[_0x42f76c[_0x81ac('0x1c')]],'as':_0x42f76c['as'],'attributes':_0x42f76c['as']===_0x81ac('0x31')?_[_0x81ac('0x47')](_0x1bf366):_0x42f76c[_0x81ac('0x1a')],'include':_0x42f76c['include']?_[_0x81ac('0x1b')](_0x42f76c[_0x81ac('0x1d')],function(_0x3dba15){return{'model':db[_0x3dba15[_0x81ac('0x1c')]],'as':_0x3dba15['as'],'attributes':_0x3dba15[_0x81ac('0x1a')],'include':_0x3dba15['include']?_[_0x81ac('0x1b')](_0x3dba15['include'],function(_0x134951){return{'model':db[_0x134951[_0x81ac('0x1c')]],'as':_0x134951['as'],'attributes':_0x134951[_0x81ac('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x81ac('0xc')](function(_0x26bdb0){logger[_0x81ac('0xd')](_0x81ac('0x16'),_0x4da4a2);logger[_0x81ac('0xf')]('GetCmHopper',_0x4da4a2,JSON['stringify'](_0x26bdb0));_0x141fd6(_0x26bdb0);})['catch'](function(_0x56f115){logger[_0x81ac('0x11')](_0x81ac('0x16'),_0x56f115['message'],_0x4da4a2);_0x5b6ae2(_0xe6cc62[_0x81ac('0x11')](0x1f4,_0x56f115[_0x81ac('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9f52f90..7e7c43c 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 _0xc61f=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','index','/describe','describe','getOpenContacts','/:id','isAuthenticated','show','post','create','/preview','getPreview','put'];(function(_0x1320fd,_0x2d576c){var _0x581e22=function(_0x15199f){while(--_0x15199f){_0x1320fd['push'](_0x1320fd['shift']());}};_0x581e22(++_0x2d576c);}(_0xc61f,0xf7));var _0xfc61=function(_0x2f58c4,_0x329d7d){_0x2f58c4=_0x2f58c4-0x0;var _0x11dbca=_0xc61f[_0x2f58c4];return _0x11dbca;};'use strict';var multer=require(_0xfc61('0x0'));var util=require(_0xfc61('0x1'));var path=require(_0xfc61('0x2'));var timeout=require(_0xfc61('0x3'));var express=require(_0xfc61('0x4'));var router=express[_0xfc61('0x5')]();var fs_extra=require(_0xfc61('0x6'));var auth=require(_0xfc61('0x7'));var interaction=require(_0xfc61('0x8'));var config=require('../../config/environment');var controller=require(_0xfc61('0x9'));router[_0xfc61('0xa')]('/',auth['isAuthenticated'](),controller[_0xfc61('0xb')]);router[_0xfc61('0xa')](_0xfc61('0xc'),auth['isAuthenticated'](),controller[_0xfc61('0xd')]);router[_0xfc61('0xa')]('/opencontacts',auth['isAuthenticated'](),controller[_0xfc61('0xe')]);router['get'](_0xfc61('0xf'),auth[_0xfc61('0x10')](),controller[_0xfc61('0x11')]);router[_0xfc61('0x12')]('/',auth['isAuthenticated'](),controller[_0xfc61('0x13')]);router[_0xfc61('0x12')](_0xfc61('0x14'),auth[_0xfc61('0x10')](),controller[_0xfc61('0x15')]);router[_0xfc61('0x16')](_0xfc61('0xf'),auth[_0xfc61('0x10')](),controller[_0xfc61('0x17')]);router[_0xfc61('0x18')](_0xfc61('0xf'),auth[_0xfc61('0x10')](),controller[_0xfc61('0x19')]);module[_0xfc61('0x1a')]=router; \ No newline at end of file +var _0x8f70=['getPreview','put','destroy','multer','util','path','fs-extra','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/:id','show','post','create','/preview'];(function(_0x1da06b,_0x295519){var _0x541dfe=function(_0x161d70){while(--_0x161d70){_0x1da06b['push'](_0x1da06b['shift']());}};_0x541dfe(++_0x295519);}(_0x8f70,0xdf));var _0x08f7=function(_0x1ea71e,_0x5df6d0){_0x1ea71e=_0x1ea71e-0x0;var _0x3ac787=_0x8f70[_0x1ea71e];return _0x3ac787;};'use strict';var multer=require(_0x08f7('0x0'));var util=require(_0x08f7('0x1'));var path=require(_0x08f7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x08f7('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x08f7('0x4'));var controller=require(_0x08f7('0x5'));router[_0x08f7('0x6')]('/',auth[_0x08f7('0x7')](),controller[_0x08f7('0x8')]);router[_0x08f7('0x6')](_0x08f7('0x9'),auth[_0x08f7('0x7')](),controller[_0x08f7('0xa')]);router[_0x08f7('0x6')](_0x08f7('0xb'),auth[_0x08f7('0x7')](),controller['getOpenContacts']);router[_0x08f7('0x6')](_0x08f7('0xc'),auth[_0x08f7('0x7')](),controller[_0x08f7('0xd')]);router[_0x08f7('0xe')]('/',auth[_0x08f7('0x7')](),controller[_0x08f7('0xf')]);router[_0x08f7('0xe')](_0x08f7('0x10'),auth['isAuthenticated'](),controller[_0x08f7('0x11')]);router[_0x08f7('0x12')](_0x08f7('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x08f7('0xc'),auth[_0x08f7('0x7')](),controller[_0x08f7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 783732c..f05c416 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 _0x950a=['STRING','contactListQueue','INTEGER','moment','sequelize','exports'];(function(_0x292e9e,_0x3343c1){var _0x16412c=function(_0x429b0b){while(--_0x429b0b){_0x292e9e['push'](_0x292e9e['shift']());}};_0x16412c(++_0x3343c1);}(_0x950a,0x111));var _0xa950=function(_0x5b3996,_0x43bb21){_0x5b3996=_0x5b3996-0x0;var _0x46590c=_0x950a[_0x5b3996];return _0x46590c;};'use strict';var moment=require(_0xa950('0x0'));var Sequelize=require(_0xa950('0x1'));module[_0xa950('0x2')]={'phone':{'type':Sequelize[_0xa950('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xa950('0x4')},'ListId':{'type':Sequelize[_0xa950('0x5')],'unique':_0xa950('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa950('0x5')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x377e=['moment','INTEGER','contactListQueue'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x377e,0x1e9));var _0xe377=function(_0x165718,_0x49ae0b){_0x165718=_0x165718-0x0;var _0x2e57b2=_0x377e[_0x165718];return _0x2e57b2;};'use strict';var moment=require(_0xe377('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe377('0x1')],'unique':_0xe377('0x2')},'ListId':{'type':Sequelize[_0xe377('0x1')],'unique':_0xe377('0x2')},'VoiceQueueId':{'type':Sequelize[_0xe377('0x1')],'unique':_0xe377('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8f52ea1..f73a7f0 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 _0xc5e4=['zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','find','body','describe','rimraf'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0xc5e4,0x117));var _0x4c5e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc5e4[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c5e('0x0'));var zipdir=require(_0x4c5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c5e('0x2'));var moment=require(_0x4c5e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c5e('0x4'));var util=require(_0x4c5e('0x5'));var path=require(_0x4c5e('0x6'));var sox=require(_0x4c5e('0x7'));var csv=require(_0x4c5e('0x8'));var ejs=require(_0x4c5e('0x9'));var fs=require('fs');var fs_extra=require(_0x4c5e('0xa'));var _=require(_0x4c5e('0xb'));var squel=require('squel');var crypto=require(_0x4c5e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4c5e('0xd'));var toCsv=require(_0x4c5e('0x8'));var querystring=require(_0x4c5e('0xe'));var Papa=require(_0x4c5e('0xf'));var Redis=require(_0x4c5e('0x10'));var authService=require(_0x4c5e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4c5e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4c5e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4c5e('0x14'));var db=require(_0x4c5e('0x15'))['db'];function respondWithStatusCode(_0x3485f0,_0x47b4b6){_0x47b4b6=_0x47b4b6||0xcc;return function(_0x4e3a89){if(_0x4e3a89){return _0x3485f0[_0x4c5e('0x16')](_0x47b4b6);}return _0x3485f0[_0x4c5e('0x17')](_0x47b4b6)[_0x4c5e('0x18')]();};}function respondWithResult(_0x7cac0e,_0x145be5){_0x145be5=_0x145be5||0xc8;return function(_0x2c1504){if(_0x2c1504){return _0x7cac0e[_0x4c5e('0x17')](_0x145be5)['json'](_0x2c1504);}};}function respondWithFilteredResult(_0x52c3d4,_0x4283cc){return function(_0x3bf3ac){if(_0x3bf3ac){var _0x39f45e=typeof _0x4283cc[_0x4c5e('0x19')]===_0x4c5e('0x1a')&&typeof _0x4283cc[_0x4c5e('0x1b')]===_0x4c5e('0x1a');var _0x16343f=_0x3bf3ac[_0x4c5e('0x1c')];var _0x25c4d6=_0x39f45e?0x0:_0x4283cc['offset'];var _0x6eefe=_0x39f45e?_0x3bf3ac[_0x4c5e('0x1c')]:_0x4283cc['offset']+_0x4283cc['limit'];var _0x4a679d;if(_0x6eefe>=_0x16343f){_0x6eefe=_0x16343f;_0x4a679d=0xc8;}else{_0x4a679d=0xce;}_0x52c3d4[_0x4c5e('0x17')](_0x4a679d);return _0x52c3d4[_0x4c5e('0x1d')]('Content-Range',_0x25c4d6+'-'+_0x6eefe+'/'+_0x16343f)[_0x4c5e('0x1e')](_0x3bf3ac);}return null;};}function patchUpdates(_0x5d4824){return function(_0x82f918){try{jsonpatch[_0x4c5e('0x1f')](_0x82f918,_0x5d4824,!![]);}catch(_0x6bf00c){return BPromise[_0x4c5e('0x20')](_0x6bf00c);}return _0x82f918[_0x4c5e('0x21')]();};}function saveUpdates(_0x237cc7,_0x3561c7){return function(_0x4a0728){if(_0x4a0728){return _0x4a0728[_0x4c5e('0x22')](_0x237cc7)[_0x4c5e('0x23')](function(_0x2293bb){return _0x2293bb;});}return null;};}function removeEntity(_0x35b4ab,_0x54438f){return function(_0x5b3327){if(_0x5b3327){return _0x5b3327['destroy']()['then'](function(){_0x35b4ab['status'](0xcc)[_0x4c5e('0x18')]();});}};}function handleEntityNotFound(_0x2e9c75,_0x3712ca){return function(_0x4cf766){if(!_0x4cf766){_0x2e9c75[_0x4c5e('0x16')](0x194);}return _0x4cf766;};}function handleError(_0xea2d,_0x913095){_0x913095=_0x913095||0x1f4;return function(_0x172346){logger['error'](_0x172346[_0x4c5e('0x24')]);if(_0x172346[_0x4c5e('0x25')]){delete _0x172346[_0x4c5e('0x25')];}_0xea2d[_0x4c5e('0x17')](_0x913095)[_0x4c5e('0x26')](_0x172346);};}exports[_0x4c5e('0x27')]=function(_0x47582e,_0x3228cb){var _0x47a7ee={},_0x39aa40={},_0x4de60b={'count':0x0,'rows':[]};var _0x57bccb=_[_0x4c5e('0x28')](db[_0x4c5e('0x29')]['rawAttributes'],function(_0x3b2954){return{'name':_0x3b2954[_0x4c5e('0x2a')],'type':_0x3b2954[_0x4c5e('0x2b')][_0x4c5e('0x2c')]};});_0x39aa40[_0x4c5e('0x2d')]=_['map'](_0x57bccb,'name');_0x39aa40[_0x4c5e('0x2e')]=_[_0x4c5e('0x2f')](_0x47582e['query']);_0x39aa40[_0x4c5e('0x30')]=_[_0x4c5e('0x31')](_0x39aa40[_0x4c5e('0x2d')],_0x39aa40[_0x4c5e('0x2e')]);_0x47a7ee[_0x4c5e('0x32')]=_[_0x4c5e('0x31')](_0x39aa40['model'],qs[_0x4c5e('0x33')](_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x33')]));_0x47a7ee[_0x4c5e('0x32')]=_0x47a7ee[_0x4c5e('0x32')][_0x4c5e('0x34')]?_0x47a7ee[_0x4c5e('0x32')]:_0x39aa40['model'];if(!_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x35')](_0x4c5e('0x36'))){_0x47a7ee[_0x4c5e('0x1b')]=qs[_0x4c5e('0x1b')](_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x1b')]);_0x47a7ee['offset']=qs[_0x4c5e('0x19')](_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x19')]);}_0x47a7ee[_0x4c5e('0x37')]=qs[_0x4c5e('0x38')](_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x38')]);_0x47a7ee[_0x4c5e('0x39')]=qs['filters'](_[_0x4c5e('0x3a')](_0x47582e[_0x4c5e('0x2e')],_0x39aa40[_0x4c5e('0x30')]),_0x57bccb);if(_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x3b')]){_0x47a7ee[_0x4c5e('0x39')]=_['merge'](_0x47a7ee[_0x4c5e('0x39')],{'$or':_[_0x4c5e('0x28')](_0x57bccb,function(_0x1822e8){if(_0x1822e8[_0x4c5e('0x2b')]!==_0x4c5e('0x3c')){var _0x117d72={};_0x117d72[_0x1822e8[_0x4c5e('0x25')]]={'$like':'%'+_0x47582e['query']['filter']+'%'};return _0x117d72;}})});}_0x47a7ee=_[_0x4c5e('0x3d')]({},_0x47a7ee,_0x47582e['options']);var _0x5e5dd3={'where':_0x47a7ee[_0x4c5e('0x39')]};return db['CmHopperBlack'][_0x4c5e('0x1c')](_0x5e5dd3)['then'](function(_0x4521f6){_0x4de60b[_0x4c5e('0x1c')]=_0x4521f6;if(_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x3e')]){_0x47a7ee['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x47a7ee);})['then'](function(_0x15be39){_0x4de60b[_0x4c5e('0x3f')]=_0x15be39;return _0x4de60b;})[_0x4c5e('0x23')](respondWithFilteredResult(_0x3228cb,_0x47a7ee))[_0x4c5e('0x40')](handleError(_0x3228cb,null));};exports[_0x4c5e('0x41')]=function(_0x58a168,_0x537535){var _0xa75344={'raw':!![],'where':{'id':_0x58a168[_0x4c5e('0x42')]['id']}},_0x3a4723={};_0x3a4723['model']=_[_0x4c5e('0x2f')](db[_0x4c5e('0x29')]['rawAttributes']);_0x3a4723[_0x4c5e('0x2e')]=_['keys'](_0x58a168['query']);_0x3a4723[_0x4c5e('0x30')]=_[_0x4c5e('0x31')](_0x3a4723[_0x4c5e('0x2d')],_0x3a4723[_0x4c5e('0x2e')]);_0xa75344[_0x4c5e('0x32')]=_['intersection'](_0x3a4723[_0x4c5e('0x2d')],qs[_0x4c5e('0x33')](_0x58a168[_0x4c5e('0x2e')][_0x4c5e('0x33')]));_0xa75344[_0x4c5e('0x32')]=_0xa75344[_0x4c5e('0x32')][_0x4c5e('0x34')]?_0xa75344[_0x4c5e('0x32')]:_0x3a4723['model'];if(_0x58a168[_0x4c5e('0x2e')][_0x4c5e('0x3e')]){_0xa75344['include']=[{'all':!![]}];}_0xa75344=_['merge']({},_0xa75344,_0x58a168['options']);return db['CmHopperBlack'][_0x4c5e('0x43')](_0xa75344)[_0x4c5e('0x23')](handleEntityNotFound(_0x537535,null))[_0x4c5e('0x23')](respondWithResult(_0x537535,null))[_0x4c5e('0x40')](handleError(_0x537535,null));};exports['update']=function(_0x37d3bb,_0xf76d27){if(_0x37d3bb[_0x4c5e('0x44')]['id']){delete _0x37d3bb[_0x4c5e('0x44')]['id'];}return db['CmHopperBlack'][_0x4c5e('0x43')]({'where':{'id':_0x37d3bb[_0x4c5e('0x42')]['id']}})['then'](handleEntityNotFound(_0xf76d27,null))['then'](saveUpdates(_0x37d3bb[_0x4c5e('0x44')],null))[_0x4c5e('0x23')](respondWithResult(_0xf76d27,null))[_0x4c5e('0x40')](handleError(_0xf76d27,null));};exports['destroy']=function(_0x36bcc0,_0x346994){return db[_0x4c5e('0x29')][_0x4c5e('0x43')]({'where':{'id':_0x36bcc0['params']['id']}})['then'](handleEntityNotFound(_0x346994,null))[_0x4c5e('0x23')](removeEntity(_0x346994,null))[_0x4c5e('0x40')](handleError(_0x346994,null));};exports[_0x4c5e('0x45')]=function(_0xc0b36,_0x2df29c){return db['CmHopperBlack'][_0x4c5e('0x45')]()[_0x4c5e('0x23')](respondWithResult(_0x2df29c,null))[_0x4c5e('0x40')](handleError(_0x2df29c,null));}; \ No newline at end of file +var _0x7a44=['sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','findAll','then','rows','catch','show','params','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0x7a44,0x157));var _0x47a4=function(_0x27d9a2,_0x2fdec8){_0x27d9a2=_0x27d9a2-0x0;var _0x20e1fa=_0x7a44[_0x27d9a2];return _0x20e1fa;};'use strict';var emlformat=require(_0x47a4('0x0'));var rimraf=require(_0x47a4('0x1'));var zipdir=require(_0x47a4('0x2'));var jsonpatch=require(_0x47a4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x47a4('0x4'));var util=require(_0x47a4('0x5'));var path=require(_0x47a4('0x6'));var sox=require(_0x47a4('0x7'));var csv=require(_0x47a4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a4('0x9'));var _=require('lodash');var squel=require(_0x47a4('0xa'));var crypto=require('crypto');var jsforce=require(_0x47a4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x47a4('0xc'));var Papa=require(_0x47a4('0xd'));var Redis=require(_0x47a4('0xe'));var authService=require(_0x47a4('0xf'));var qs=require(_0x47a4('0x10'));var as=require(_0x47a4('0x11'));var hardwareService=require(_0x47a4('0x12'));var logger=require('../../config/logger')(_0x47a4('0x13'));var utils=require('../../config/utils');var config=require(_0x47a4('0x14'));var licenseUtil=require(_0x47a4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19d6f7,_0x2b4f7c){_0x2b4f7c=_0x2b4f7c||0xcc;return function(_0x470ac3){if(_0x470ac3){return _0x19d6f7[_0x47a4('0x16')](_0x2b4f7c);}return _0x19d6f7['status'](_0x2b4f7c)[_0x47a4('0x17')]();};}function respondWithResult(_0x4122e3,_0x3eda87){_0x3eda87=_0x3eda87||0xc8;return function(_0x5647d1){if(_0x5647d1){return _0x4122e3[_0x47a4('0x18')](_0x3eda87)[_0x47a4('0x19')](_0x5647d1);}};}function respondWithFilteredResult(_0x1eeb81,_0x419218){return function(_0x40af48){if(_0x40af48){var _0x2fdb17=typeof _0x419218['offset']==='undefined'&&typeof _0x419218['limit']===_0x47a4('0x1a');var _0x28f5e3=_0x40af48[_0x47a4('0x1b')];var _0x5c773c=_0x2fdb17?0x0:_0x419218[_0x47a4('0x1c')];var _0xdb9f5f=_0x2fdb17?_0x40af48['count']:_0x419218['offset']+_0x419218[_0x47a4('0x1d')];var _0x1bf995;if(_0xdb9f5f>=_0x28f5e3){_0xdb9f5f=_0x28f5e3;_0x1bf995=0xc8;}else{_0x1bf995=0xce;}_0x1eeb81[_0x47a4('0x18')](_0x1bf995);return _0x1eeb81[_0x47a4('0x1e')](_0x47a4('0x1f'),_0x5c773c+'-'+_0xdb9f5f+'/'+_0x28f5e3)[_0x47a4('0x19')](_0x40af48);}return null;};}function patchUpdates(_0x19ed34){return function(_0x27d2da){try{jsonpatch[_0x47a4('0x20')](_0x27d2da,_0x19ed34,!![]);}catch(_0x61134){return BPromise[_0x47a4('0x21')](_0x61134);}return _0x27d2da[_0x47a4('0x22')]();};}function saveUpdates(_0x582339,_0x187567){return function(_0x4a9d63){if(_0x4a9d63){return _0x4a9d63[_0x47a4('0x23')](_0x582339)['then'](function(_0x26c049){return _0x26c049;});}return null;};}function removeEntity(_0x55d34f,_0x5c3b57){return function(_0x2fa374){if(_0x2fa374){return _0x2fa374[_0x47a4('0x24')]()['then'](function(){_0x55d34f[_0x47a4('0x18')](0xcc)[_0x47a4('0x17')]();});}};}function handleEntityNotFound(_0x28157f,_0x409a9f){return function(_0xddac96){if(!_0xddac96){_0x28157f[_0x47a4('0x16')](0x194);}return _0xddac96;};}function handleError(_0x229bfe,_0x4b89ed){_0x4b89ed=_0x4b89ed||0x1f4;return function(_0x40bff0){logger['error'](_0x40bff0[_0x47a4('0x25')]);if(_0x40bff0['name']){delete _0x40bff0[_0x47a4('0x26')];}_0x229bfe[_0x47a4('0x18')](_0x4b89ed)['send'](_0x40bff0);};}exports['index']=function(_0x47fdaa,_0x227b42){var _0x362c99={},_0x286dde={},_0x22ec87={'count':0x0,'rows':[]};var _0x5cf00e=_['map'](db[_0x47a4('0x27')][_0x47a4('0x28')],function(_0x32fcd6){return{'name':_0x32fcd6[_0x47a4('0x29')],'type':_0x32fcd6[_0x47a4('0x2a')][_0x47a4('0x2b')]};});_0x286dde[_0x47a4('0x2c')]=_[_0x47a4('0x2d')](_0x5cf00e,_0x47a4('0x26'));_0x286dde[_0x47a4('0x2e')]=_[_0x47a4('0x2f')](_0x47fdaa[_0x47a4('0x2e')]);_0x286dde[_0x47a4('0x30')]=_[_0x47a4('0x31')](_0x286dde[_0x47a4('0x2c')],_0x286dde[_0x47a4('0x2e')]);_0x362c99[_0x47a4('0x32')]=_[_0x47a4('0x31')](_0x286dde[_0x47a4('0x2c')],qs[_0x47a4('0x33')](_0x47fdaa[_0x47a4('0x2e')]['fields']));_0x362c99[_0x47a4('0x32')]=_0x362c99['attributes'][_0x47a4('0x34')]?_0x362c99['attributes']:_0x286dde['model'];if(!_0x47fdaa[_0x47a4('0x2e')]['hasOwnProperty'](_0x47a4('0x35'))){_0x362c99[_0x47a4('0x1d')]=qs[_0x47a4('0x1d')](_0x47fdaa[_0x47a4('0x2e')][_0x47a4('0x1d')]);_0x362c99[_0x47a4('0x1c')]=qs['offset'](_0x47fdaa['query'][_0x47a4('0x1c')]);}_0x362c99['order']=qs[_0x47a4('0x36')](_0x47fdaa['query'][_0x47a4('0x36')]);_0x362c99[_0x47a4('0x37')]=qs['filters'](_[_0x47a4('0x38')](_0x47fdaa['query'],_0x286dde[_0x47a4('0x30')]),_0x5cf00e);if(_0x47fdaa['query']['filter']){_0x362c99[_0x47a4('0x37')]=_[_0x47a4('0x39')](_0x362c99[_0x47a4('0x37')],{'$or':_[_0x47a4('0x2d')](_0x5cf00e,function(_0x32155a){if(_0x32155a[_0x47a4('0x2a')]!==_0x47a4('0x3a')){var _0x47f6ef={};_0x47f6ef[_0x32155a[_0x47a4('0x26')]]={'$like':'%'+_0x47fdaa[_0x47a4('0x2e')][_0x47a4('0x3b')]+'%'};return _0x47f6ef;}})});}_0x362c99=_[_0x47a4('0x39')]({},_0x362c99,_0x47fdaa['options']);var _0x395d52={'where':_0x362c99[_0x47a4('0x37')]};return db['CmHopperBlack'][_0x47a4('0x1b')](_0x395d52)['then'](function(_0xf15944){_0x22ec87[_0x47a4('0x1b')]=_0xf15944;if(_0x47fdaa[_0x47a4('0x2e')]['includeAll']){_0x362c99['include']=[{'all':!![]}];}return db[_0x47a4('0x27')][_0x47a4('0x3c')](_0x362c99);})[_0x47a4('0x3d')](function(_0x1f1c28){_0x22ec87[_0x47a4('0x3e')]=_0x1f1c28;return _0x22ec87;})[_0x47a4('0x3d')](respondWithFilteredResult(_0x227b42,_0x362c99))[_0x47a4('0x3f')](handleError(_0x227b42,null));};exports[_0x47a4('0x40')]=function(_0x49c52f,_0x5ca45f){var _0x23056c={'raw':!![],'where':{'id':_0x49c52f[_0x47a4('0x41')]['id']}},_0x3ab545={};_0x3ab545[_0x47a4('0x2c')]=_['keys'](db['CmHopperBlack'][_0x47a4('0x28')]);_0x3ab545['query']=_[_0x47a4('0x2f')](_0x49c52f[_0x47a4('0x2e')]);_0x3ab545[_0x47a4('0x30')]=_[_0x47a4('0x31')](_0x3ab545[_0x47a4('0x2c')],_0x3ab545[_0x47a4('0x2e')]);_0x23056c[_0x47a4('0x32')]=_[_0x47a4('0x31')](_0x3ab545['model'],qs[_0x47a4('0x33')](_0x49c52f['query']['fields']));_0x23056c[_0x47a4('0x32')]=_0x23056c[_0x47a4('0x32')][_0x47a4('0x34')]?_0x23056c[_0x47a4('0x32')]:_0x3ab545[_0x47a4('0x2c')];if(_0x49c52f[_0x47a4('0x2e')]['includeAll']){_0x23056c['include']=[{'all':!![]}];}_0x23056c=_['merge']({},_0x23056c,_0x49c52f[_0x47a4('0x42')]);return db[_0x47a4('0x27')][_0x47a4('0x43')](_0x23056c)['then'](handleEntityNotFound(_0x5ca45f,null))[_0x47a4('0x3d')](respondWithResult(_0x5ca45f,null))['catch'](handleError(_0x5ca45f,null));};exports[_0x47a4('0x23')]=function(_0x190956,_0x31e0b2){if(_0x190956[_0x47a4('0x44')]['id']){delete _0x190956['body']['id'];}return db[_0x47a4('0x27')][_0x47a4('0x43')]({'where':{'id':_0x190956[_0x47a4('0x41')]['id']}})[_0x47a4('0x3d')](handleEntityNotFound(_0x31e0b2,null))[_0x47a4('0x3d')](saveUpdates(_0x190956[_0x47a4('0x44')],null))[_0x47a4('0x3d')](respondWithResult(_0x31e0b2,null))[_0x47a4('0x3f')](handleError(_0x31e0b2,null));};exports[_0x47a4('0x24')]=function(_0x36333b,_0x115d03){return db[_0x47a4('0x27')][_0x47a4('0x43')]({'where':{'id':_0x36333b['params']['id']}})[_0x47a4('0x3d')](handleEntityNotFound(_0x115d03,null))['then'](removeEntity(_0x115d03,null))['catch'](handleError(_0x115d03,null));};exports[_0x47a4('0x45')]=function(_0x3762f4,_0x3a4735){return db[_0x47a4('0x27')]['describe']()[_0x47a4('0x3d')](respondWithResult(_0x3a4735,null))['catch'](handleError(_0x3a4735,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 59931c2..1e3a784 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 _0x402c=['../../config/logger','api','request-promise','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util'];(function(_0xc2c0c9,_0x4a43d8){var _0x4ea574=function(_0xb3d281){while(--_0xb3d281){_0xc2c0c9['push'](_0xc2c0c9['shift']());}};_0x4ea574(++_0x4a43d8);}(_0x402c,0x132));var _0xc402=function(_0x174e6b,_0x124a26){_0x174e6b=_0x174e6b-0x0;var _0x10ab0e=_0x402c[_0x174e6b];return _0x10ab0e;};'use strict';var _=require(_0xc402('0x0'));var util=require(_0xc402('0x1'));var logger=require(_0xc402('0x2'))(_0xc402('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc402('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc402('0x5'));var config=require('../../config/environment');var attributes=require(_0xc402('0x6'));module[_0xc402('0x7')]=function(_0x20d2be,_0x4aff70){return _0x20d2be[_0xc402('0x8')](_0xc402('0x9'),attributes,{'tableName':_0xc402('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75f1=['lodash','util','api','bluebird','request-promise','exports','CmHopperBlack','cm_hopper_black'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0x75f1,0x158));var _0x175f=function(_0x47f719,_0x2e559d){_0x47f719=_0x47f719-0x0;var _0x407f4e=_0x75f1[_0x47f719];return _0x407f4e;};'use strict';var _=require(_0x175f('0x0'));var util=require(_0x175f('0x1'));var logger=require('../../config/logger')(_0x175f('0x2'));var moment=require('moment');var BPromise=require(_0x175f('0x3'));var rp=require(_0x175f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x175f('0x5')]=function(_0x57387d,_0x19baec){return _0x57387d['define'](_0x175f('0x6'),attributes,{'tableName':_0x175f('0x7'),'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 61c4387..c05210c 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 _0x0ce9=['catch','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','include','map','model','info','GetCmHopperBlack','CmHopperBlack','body','UpdateCmHopperBlack'];(function(_0x3c22f7,_0x1fb12a){var _0x537f59=function(_0x471688){while(--_0x471688){_0x3c22f7['push'](_0x3c22f7['shift']());}};_0x537f59(++_0x1fb12a);}(_0x0ce9,0xcb));var _0x90ce=function(_0x46d010,_0x5a3f0f){_0x46d010=_0x46d010-0x0;var _0x5bef57=_0x0ce9[_0x46d010];return _0x5bef57;};'use strict';var _=require(_0x90ce('0x0'));var util=require(_0x90ce('0x1'));var moment=require(_0x90ce('0x2'));var BPromise=require(_0x90ce('0x3'));var rs=require(_0x90ce('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90ce('0x5'))['db'];var utils=require(_0x90ce('0x6'));var logger=require(_0x90ce('0x7'))(_0x90ce('0x8'));var config=require('../../config/environment');var jayson=require(_0x90ce('0x9'));var client=jayson[_0x90ce('0xa')][_0x90ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f14b1,_0x58a15e,_0x44827a){return new BPromise(function(_0x310cac,_0x36cf7f){return client[_0x90ce('0xc')](_0x5f14b1,_0x44827a)[_0x90ce('0xd')](function(_0x35edcc){logger['info'](_0x90ce('0xe'),_0x58a15e,_0x90ce('0xf'));logger[_0x90ce('0x10')](_0x90ce('0x11'),_0x58a15e,_0x90ce('0xf'),JSON[_0x90ce('0x12')](_0x35edcc));if(_0x35edcc[_0x90ce('0x13')]){if(_0x35edcc['error'][_0x90ce('0x14')]===0x1f4){logger[_0x90ce('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x58a15e,_0x35edcc[_0x90ce('0x13')][_0x90ce('0x15')]);return _0x36cf7f(_0x35edcc[_0x90ce('0x13')][_0x90ce('0x15')]);}logger[_0x90ce('0x13')](_0x90ce('0xe'),_0x58a15e,_0x35edcc[_0x90ce('0x13')][_0x90ce('0x15')]);return _0x310cac(_0x35edcc[_0x90ce('0x13')][_0x90ce('0x15')]);}else{logger['info'](_0x90ce('0xe'),_0x58a15e,_0x90ce('0xf'));_0x310cac(_0x35edcc[_0x90ce('0x16')][_0x90ce('0x15')]);}})['catch'](function(_0x414794){logger['error'](_0x90ce('0xe'),_0x58a15e,_0x414794);_0x36cf7f(_0x414794);});});}exports['GetCmHopperBlack']=function(_0x577594){var _0x4da3cc=this;return new Promise(function(_0x2fb62e,_0x4120b7){return db['CmHopperBlack'][_0x90ce('0x17')]({'raw':_0x577594['options']?_0x577594[_0x90ce('0x18')][_0x90ce('0x19')]===undefined?!![]:![]:!![],'where':_0x577594[_0x90ce('0x18')]?_0x577594[_0x90ce('0x18')][_0x90ce('0x1a')]||null:null,'attributes':_0x577594[_0x90ce('0x18')]?_0x577594['options'][_0x90ce('0x1b')]||null:null,'limit':_0x577594['options']?_0x577594[_0x90ce('0x18')][_0x90ce('0x1c')]||null:null,'include':_0x577594[_0x90ce('0x18')]?_0x577594[_0x90ce('0x18')][_0x90ce('0x1d')]?_[_0x90ce('0x1e')](_0x577594[_0x90ce('0x18')][_0x90ce('0x1d')],function(_0xcc17d4){return{'model':db[_0xcc17d4['model']],'as':_0xcc17d4['as'],'attributes':_0xcc17d4['attributes'],'include':_0xcc17d4['include']?_[_0x90ce('0x1e')](_0xcc17d4[_0x90ce('0x1d')],function(_0x41799d){return{'model':db[_0x41799d['model']],'as':_0x41799d['as'],'attributes':_0x41799d[_0x90ce('0x1b')],'include':_0x41799d[_0x90ce('0x1d')]?_[_0x90ce('0x1e')](_0x41799d[_0x90ce('0x1d')],function(_0x12e3d1){return{'model':db[_0x12e3d1[_0x90ce('0x1f')]],'as':_0x12e3d1['as'],'attributes':_0x12e3d1['attributes']};}):[]};}):[]};}):[]:[]})[_0x90ce('0xd')](function(_0x3d0fa7){logger[_0x90ce('0x20')](_0x90ce('0x21'),_0x577594);logger[_0x90ce('0x10')](_0x90ce('0x21'),_0x577594,JSON[_0x90ce('0x12')](_0x3d0fa7));_0x2fb62e(_0x3d0fa7);})['catch'](function(_0x1ff966){logger[_0x90ce('0x13')](_0x90ce('0x21'),_0x1ff966['message'],_0x577594);_0x4120b7(_0x4da3cc[_0x90ce('0x13')](0x1f4,_0x1ff966[_0x90ce('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x284ce2){var _0x477bc3=this;return new Promise(function(_0x3478e3,_0x28bd7b){return db[_0x90ce('0x22')]['update'](_0x284ce2[_0x90ce('0x23')],{'raw':_0x284ce2[_0x90ce('0x18')]?_0x284ce2[_0x90ce('0x18')][_0x90ce('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x284ce2['options']?_0x284ce2['options'][_0x90ce('0x1a')]||null:null,'attributes':_0x284ce2[_0x90ce('0x18')]?_0x284ce2['options'][_0x90ce('0x1b')]||null:null,'limit':_0x284ce2[_0x90ce('0x18')]?_0x284ce2[_0x90ce('0x18')][_0x90ce('0x1c')]||null:null})['then'](function(_0x150824){logger[_0x90ce('0x20')](_0x90ce('0x24'),_0x284ce2);logger[_0x90ce('0x10')](_0x90ce('0x24'),_0x284ce2,JSON[_0x90ce('0x12')](_0x150824));_0x3478e3(_0x150824);})[_0x90ce('0x25')](function(_0xcda637){logger['error'](_0x90ce('0x24'),_0xcda637['message'],_0x284ce2);_0x28bd7b(_0x477bc3[_0x90ce('0x13')](0x1f4,_0xcda637[_0x90ce('0x15')]));});});};exports[_0x90ce('0x26')]=function(_0x1b3d95){var _0x58f44d=this;return new Promise(function(_0x1b4773,_0x387917){return db[_0x90ce('0x22')][_0x90ce('0x27')]({'where':_0x1b3d95[_0x90ce('0x18')]?_0x1b3d95[_0x90ce('0x18')][_0x90ce('0x1a')]||null:null})['then'](function(_0x59527c){logger[_0x90ce('0x20')](_0x90ce('0x26'),_0x1b3d95);logger[_0x90ce('0x10')](_0x90ce('0x26'),_0x1b3d95,JSON['stringify'](_0x59527c));_0x1b4773(_0x59527c);})[_0x90ce('0x25')](function(_0x46736b){logger[_0x90ce('0x13')](_0x90ce('0x26'),_0x46736b['message'],_0x1b3d95);_0x387917(_0x58f44d[_0x90ce('0x13')](0x1f4,_0x46736b[_0x90ce('0x15')]));});});}; \ No newline at end of file +var _0x2d23=['../../config/logger','rpc','../../config/environment','client','http','request','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','catch','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x2d23,0x189));var _0x32d2=function(_0x3fa2f5,_0x4a1608){_0x3fa2f5=_0x3fa2f5-0x0;var _0x44ab92=_0x2d23[_0x3fa2f5];return _0x44ab92;};'use strict';var _=require(_0x32d2('0x0'));var util=require('util');var moment=require(_0x32d2('0x1'));var BPromise=require(_0x32d2('0x2'));var rs=require(_0x32d2('0x3'));var fs=require('fs');var Redis=require(_0x32d2('0x4'));var db=require(_0x32d2('0x5'))['db'];var utils=require(_0x32d2('0x6'));var logger=require(_0x32d2('0x7'))(_0x32d2('0x8'));var config=require(_0x32d2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x32d2('0xa')][_0x32d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ed832,_0x388b64,_0xf15741){return new BPromise(function(_0x363ffb,_0x490c62){return client[_0x32d2('0xc')](_0x5ed832,_0xf15741)['then'](function(_0x15642a){logger['info'](_0x32d2('0xd'),_0x388b64,'request\x20sent');logger[_0x32d2('0xe')](_0x32d2('0xf'),_0x388b64,'request\x20sent',JSON['stringify'](_0x15642a));if(_0x15642a[_0x32d2('0x10')]){if(_0x15642a[_0x32d2('0x10')][_0x32d2('0x11')]===0x1f4){logger[_0x32d2('0x10')](_0x32d2('0xd'),_0x388b64,_0x15642a[_0x32d2('0x10')]['message']);return _0x490c62(_0x15642a['error'][_0x32d2('0x12')]);}logger[_0x32d2('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x388b64,_0x15642a['error'][_0x32d2('0x12')]);return _0x363ffb(_0x15642a[_0x32d2('0x10')][_0x32d2('0x12')]);}else{logger[_0x32d2('0x13')](_0x32d2('0xd'),_0x388b64,_0x32d2('0x14'));_0x363ffb(_0x15642a[_0x32d2('0x15')]['message']);}})['catch'](function(_0xb76e6d){logger[_0x32d2('0x10')](_0x32d2('0xd'),_0x388b64,_0xb76e6d);_0x490c62(_0xb76e6d);});});}exports[_0x32d2('0x16')]=function(_0x13a2d6){var _0x1697e7=this;return new Promise(function(_0x42d8d8,_0x498f67){return db[_0x32d2('0x17')][_0x32d2('0x18')]({'raw':_0x13a2d6[_0x32d2('0x19')]?_0x13a2d6['options'][_0x32d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x13a2d6[_0x32d2('0x19')]?_0x13a2d6[_0x32d2('0x19')][_0x32d2('0x1b')]||null:null,'attributes':_0x13a2d6[_0x32d2('0x19')]?_0x13a2d6['options'][_0x32d2('0x1c')]||null:null,'limit':_0x13a2d6['options']?_0x13a2d6[_0x32d2('0x19')][_0x32d2('0x1d')]||null:null,'include':_0x13a2d6[_0x32d2('0x19')]?_0x13a2d6['options'][_0x32d2('0x1e')]?_[_0x32d2('0x1f')](_0x13a2d6['options'][_0x32d2('0x1e')],function(_0x1130d1){return{'model':db[_0x1130d1['model']],'as':_0x1130d1['as'],'attributes':_0x1130d1[_0x32d2('0x1c')],'include':_0x1130d1['include']?_['map'](_0x1130d1[_0x32d2('0x1e')],function(_0x56a70b){return{'model':db[_0x56a70b[_0x32d2('0x20')]],'as':_0x56a70b['as'],'attributes':_0x56a70b[_0x32d2('0x1c')],'include':_0x56a70b[_0x32d2('0x1e')]?_[_0x32d2('0x1f')](_0x56a70b[_0x32d2('0x1e')],function(_0x2029e8){return{'model':db[_0x2029e8[_0x32d2('0x20')]],'as':_0x2029e8['as'],'attributes':_0x2029e8[_0x32d2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x32d2('0x21')](function(_0x20399f){logger[_0x32d2('0x13')](_0x32d2('0x16'),_0x13a2d6);logger[_0x32d2('0xe')](_0x32d2('0x16'),_0x13a2d6,JSON[_0x32d2('0x22')](_0x20399f));_0x42d8d8(_0x20399f);})[_0x32d2('0x23')](function(_0x1f0a06){logger[_0x32d2('0x10')]('GetCmHopperBlack',_0x1f0a06[_0x32d2('0x12')],_0x13a2d6);_0x498f67(_0x1697e7[_0x32d2('0x10')](0x1f4,_0x1f0a06[_0x32d2('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x1ce6b1){var _0x332331=this;return new Promise(function(_0x35a0d5,_0x13719c){return db[_0x32d2('0x17')][_0x32d2('0x24')](_0x1ce6b1[_0x32d2('0x25')],{'raw':_0x1ce6b1[_0x32d2('0x19')]?_0x1ce6b1[_0x32d2('0x19')][_0x32d2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce6b1[_0x32d2('0x19')]?_0x1ce6b1[_0x32d2('0x19')][_0x32d2('0x1b')]||null:null,'attributes':_0x1ce6b1[_0x32d2('0x19')]?_0x1ce6b1['options'][_0x32d2('0x1c')]||null:null,'limit':_0x1ce6b1[_0x32d2('0x19')]?_0x1ce6b1[_0x32d2('0x19')][_0x32d2('0x1d')]||null:null})[_0x32d2('0x21')](function(_0x1da91b){logger['info'](_0x32d2('0x26'),_0x1ce6b1);logger['debug'](_0x32d2('0x26'),_0x1ce6b1,JSON['stringify'](_0x1da91b));_0x35a0d5(_0x1da91b);})[_0x32d2('0x23')](function(_0x32fc75){logger[_0x32d2('0x10')](_0x32d2('0x26'),_0x32fc75[_0x32d2('0x12')],_0x1ce6b1);_0x13719c(_0x332331[_0x32d2('0x10')](0x1f4,_0x32fc75[_0x32d2('0x12')]));});});};exports[_0x32d2('0x27')]=function(_0x5f9f21){var _0x57e425=this;return new Promise(function(_0x3e5de5,_0x2e93a6){return db[_0x32d2('0x17')]['destroy']({'where':_0x5f9f21[_0x32d2('0x19')]?_0x5f9f21[_0x32d2('0x19')]['where']||null:null})[_0x32d2('0x21')](function(_0x22a746){logger[_0x32d2('0x13')](_0x32d2('0x27'),_0x5f9f21);logger[_0x32d2('0xe')](_0x32d2('0x27'),_0x5f9f21,JSON[_0x32d2('0x22')](_0x22a746));_0x3e5de5(_0x22a746);})[_0x32d2('0x23')](function(_0x29fc77){logger[_0x32d2('0x10')]('DestroyCmHopperBlack',_0x29fc77[_0x32d2('0x12')],_0x5f9f21);_0x2e93a6(_0x57e425[_0x32d2('0x10')](0x1f4,_0x29fc77[_0x32d2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index acbb2b9..23ee1ae 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 _0xc2c7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','update','delete'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xc2c7,0x134));var _0x7c2c=function(_0x24d8a5,_0x90a072){_0x24d8a5=_0x24d8a5-0x0;var _0x851486=_0xc2c7[_0x24d8a5];return _0x851486;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['put'](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);module[_0x7c2c('0x11')]=router; \ No newline at end of file +var _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','show','put','/:id','delete','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x32f4,0x154));var _0x432f=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x32f4[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['describe']);router[_0x432f('0x9')]('/:id',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')](_0x432f('0xe'),auth[_0x432f('0xa')](),controller['update']);router[_0x432f('0xf')]('/:id',auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f860bd0..13152fb 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 _0x0a85=['followuptime','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','getDataValue','setDataValue'];(function(_0x27843a,_0x485e6e){var _0x51198f=function(_0x2f56f5){while(--_0x2f56f5){_0x27843a['push'](_0x27843a['shift']());}};_0x51198f(++_0x485e6e);}(_0x0a85,0x1f2));var _0x50a8=function(_0x3ef8f0,_0x3153d2){_0x3ef8f0=_0x3ef8f0-0x0;var _0x5c541b=_0x0a85[_0x3ef8f0];return _0x5c541b;};'use strict';var Sequelize=require(_0x50a8('0x0'));var moment=require(_0x50a8('0x1'));module[_0x50a8('0x2')]={'state':{'type':Sequelize[_0x50a8('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x50a8('0x4')]},'countbusyretry':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x50a8('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x50a8('0x5')]},'originatecalleridname':{'type':Sequelize[_0x50a8('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x50a8('0x5')]},'starttime':{'type':Sequelize[_0x50a8('0x4')]},'responsetime':{'type':Sequelize[_0x50a8('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x50a8('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x50a8('0x5')]},'campaign':{'type':Sequelize[_0x50a8('0x5')]},'campaigntype':{'type':Sequelize[_0x50a8('0x5')]},'membername':{'type':Sequelize[_0x50a8('0x5')]},'reason':{'type':Sequelize[_0x50a8('0x5')]},'disposition':{'type':Sequelize[_0x50a8('0x5')]},'secondDisposition':{'type':Sequelize[_0x50a8('0x5')]},'thirdDisposition':{'type':Sequelize[_0x50a8('0x5')]},'dispositionat':{'type':Sequelize[_0x50a8('0x4')],'set':function(_0x24e7a1){var _0x1429e3=this[_0x50a8('0x6')]('endtime');if(_0x1429e3&&_0x24e7a1){this[_0x50a8('0x7')](_0x50a8('0x8'),moment(_0x24e7a1)['diff'](moment(_0x1429e3),'seconds'));}return this['setDataValue'](_0x50a8('0x9'),_0x24e7a1);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x50a8('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x50a8('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x50a8('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x50a8('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x50a8('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x50a8('0x4')]},'deleted':{'type':Sequelize[_0x50a8('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x50a8('0x4')]},'recallme':{'type':Sequelize[_0x50a8('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x50a8('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x50a8('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f37=['sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x453304,_0x1b41a2){var _0x159843=function(_0x153882){while(--_0x153882){_0x453304['push'](_0x453304['shift']());}};_0x159843(++_0x1b41a2);}(_0x0f37,0xdd));var _0x70f3=function(_0x5a9e32,_0x3197fd){_0x5a9e32=_0x5a9e32-0x0;var _0x521b3f=_0x0f37[_0x5a9e32];return _0x521b3f;};'use strict';var Sequelize=require(_0x70f3('0x0'));var moment=require('moment');module[_0x70f3('0x1')]={'state':{'type':Sequelize[_0x70f3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x70f3('0x3')]},'scheduledat':{'type':Sequelize[_0x70f3('0x4')]},'countbusyretry':{'type':Sequelize[_0x70f3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x70f3('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x70f3('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x70f3('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x70f3('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x70f3('0x3')]},'calleridname':{'type':Sequelize[_0x70f3('0x3')]},'starttime':{'type':Sequelize[_0x70f3('0x4')]},'responsetime':{'type':Sequelize[_0x70f3('0x4')]},'answertime':{'type':Sequelize[_0x70f3('0x4')]},'droptime':{'type':Sequelize[_0x70f3('0x4')]},'endtime':{'type':Sequelize[_0x70f3('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x70f3('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x70f3('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x70f3('0x3')]},'membername':{'type':Sequelize[_0x70f3('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x70f3('0x3')]},'secondDisposition':{'type':Sequelize[_0x70f3('0x3')]},'thirdDisposition':{'type':Sequelize[_0x70f3('0x3')]},'dispositionat':{'type':Sequelize[_0x70f3('0x4')],'set':function(_0x1e9efd){var _0x2805bf=this[_0x70f3('0x5')](_0x70f3('0x6'));if(_0x2805bf&&_0x1e9efd){this[_0x70f3('0x7')](_0x70f3('0x8'),moment(_0x1e9efd)[_0x70f3('0x9')](moment(_0x2805bf),_0x70f3('0xa')));}return this['setDataValue'](_0x70f3('0xb'),_0x1e9efd);}},'amd':{'type':Sequelize[_0x70f3('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x70f3('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x70f3('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x70f3('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x70f3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x70f3('0x4')]},'deleted':{'type':Sequelize[_0x70f3('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x70f3('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x70f3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x70f3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x70f3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x70f3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 6e3d707..d87e9e1 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 _0xfdbd=['status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','length','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','params','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','checkContactHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3bac3d,_0x338f17){var _0x90fbe9=function(_0x498e04){while(--_0x498e04){_0x3bac3d['push'](_0x3bac3d['shift']());}};_0x90fbe9(++_0x338f17);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xfdbd[_0x272638];return _0x19d027;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':!![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['CmHopperFinal']['describe']()[_0xdfdb('0x26')](respondWithResult(_0x273477,null))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports[_0xdfdb('0x24')]=function(_0x4bbb88,_0x36149e){if(_0x4bbb88[_0xdfdb('0x4b')][_0xdfdb('0x4c')]){delete _0x4bbb88[_0xdfdb('0x4b')]['uniqueid'];}return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'uniqueid':_0x4bbb88['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x36149e,null))[_0xdfdb('0x26')](saveUpdates(_0x4bbb88[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x36149e,null))[_0xdfdb('0x49')](handleError(_0x36149e,null));};exports[_0xdfdb('0x4d')]=function(_0x17dfdb,_0x1f5b88,_0x1da7af){return db['CmHopperFinal'][_0xdfdb('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x17dfdb['params']['id']},'attributes':[[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x53')))),'noAnswerContacts'],[db[_0xdfdb('0x4e')]['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x54')))),_0xdfdb('0x55')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x56')))),_0xdfdb('0x57')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x58')))),_0xdfdb('0x59')],[db['sequelize']['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5b')))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')]['literal'](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x1f5b88,null))['then'](respondWithResult(_0x1f5b88,null))[_0xdfdb('0x49')](handleError(_0x1f5b88,null));};exports[_0xdfdb('0x5f')]=function(_0x349cf7,_0x2f69a8,_0x424212){return db[_0xdfdb('0x2d')][_0xdfdb('0x44')]({'raw':![],'where':{'CampaignId':_0x349cf7[_0xdfdb('0x60')]['id']},'attributes':[[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xdfdb('0x61')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x54')))),'busyContacts'],[db['sequelize']['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xdfdb('0x57')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xdfdb('0x59')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x2f69a8,null))[_0xdfdb('0x26')](respondWithResult(_0x2f69a8,null))['catch'](handleError(_0x2f69a8,null));};exports[_0xdfdb('0x62')]=function(_0x198cfa,_0x2831d6,_0x45bfc0){return db[_0xdfdb('0x63')]['find']({'where':{'id':_0x198cfa[_0xdfdb('0x60')]['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x2831d6,null))[_0xdfdb('0x26')](function(_0x1a31b9){var _0x4999c4;if(_0x1a31b9){_0x4999c4=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')](_0xdfdb('0x66'))[_0xdfdb('0x67')]([_0xdfdb('0x68'),_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),_0xdfdb('0x6c'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel['select']()[_0xdfdb('0x6f')](_0xdfdb('0x70'),'phone')[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)','ContactId')[_0xdfdb('0x6f')](_0xdfdb('0x72'),_0xdfdb('0x6b'))[_0xdfdb('0x6f')](_0xdfdb('0x73'),_0xdfdb('0x6c'))[_0xdfdb('0x6f')]('NOW()',_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')]('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id'][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x77'),_0x198cfa[_0xdfdb('0x4b')]['state'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')]('phone')[_0xdfdb('0x74')](_0xdfdb('0x66'))['where']('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id']['toString']()))['where'](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x7c'),_0x198cfa['params']['id'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x7d')))[_0xdfdb('0x7e')](_0xdfdb('0x6a')))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x4999c4);}return[];})[_0xdfdb('0x26')](respondWithResult(_0x2831d6,null))[_0xdfdb('0x49')](handleError(_0x2831d6,null));};exports[_0xdfdb('0x7f')]=function(_0x1b6445,_0x36241c,_0x4c833f){return db['Campaign'][_0xdfdb('0x48')]({'where':{'id':_0x1b6445[_0xdfdb('0x60')]['id']}})['then'](handleEntityNotFound(_0x36241c,null))[_0xdfdb('0x26')](function(_0x50d5d4){var _0x158454;if(_0x50d5d4){_0x158454=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')]('cm_hopper')[_0xdfdb('0x67')](['phone','scheduledAt',_0xdfdb('0x6a'),'ListId',_0xdfdb('0x80'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x70'),_0xdfdb('0x68'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)',_0xdfdb('0x6a'))['field']('ANY_VALUE(ListId)','ListId')['field'](_0xdfdb('0x81'),_0xdfdb('0x80'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x77'),_0x1b6445[_0xdfdb('0x4b')][_0xdfdb('0x83')][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()['field'](_0xdfdb('0x68'))[_0xdfdb('0x74')](_0xdfdb('0x66'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']()))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')]('cm_hopper_final')[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x7d')))['group']('ContactId'))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x158454);}return[];})['then'](respondWithResult(_0x36241c,null))[_0xdfdb('0x49')](handleError(_0x36241c,null));};exports[_0xdfdb('0x84')]=function(_0x1f87d3,_0x1bc293,_0x36b01e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x1f87d3[_0xdfdb('0x4b')]['VoiceQueueId'],'CampaignId':_0x1f87d3[_0xdfdb('0x4b')][_0xdfdb('0x80')],'ContactId':_0x1f87d3[_0xdfdb('0x4b')]['ContactId']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x1bc293,null))[_0xdfdb('0x26')](function(_0x3e0208){if(_0x3e0208){return _0x3e0208;}return null;})[_0xdfdb('0x26')](respondWithResult(_0x1bc293,null))['catch'](handleError(_0x1bc293,null));}; \ No newline at end of file +var _0x1623=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','createdAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x3465b8,_0x224c67){var _0x2686ba=function(_0x793c39){while(--_0x793c39){_0x3465b8['push'](_0x3465b8['shift']());}};_0x2686ba(++_0x224c67);}(_0x1623,0xab));var _0x3162=function(_0x19bc3e,_0x2dfdc8){_0x19bc3e=_0x19bc3e-0x0;var _0x3ee1b1=_0x1623[_0x19bc3e];return _0x3ee1b1;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['CmHopperFinal'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')]()[_0x3162('0x24')](respondWithResult(_0x28865c,null))['catch'](handleError(_0x28865c,null));};exports[_0x3162('0x23')]=function(_0x48cb8f,_0x4f1dde){if(_0x48cb8f[_0x3162('0x48')][_0x3162('0x49')]){delete _0x48cb8f[_0x3162('0x48')][_0x3162('0x49')];}return db['CmHopperFinal'][_0x3162('0x46')]({'where':{'uniqueid':_0x48cb8f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x4f1dde,null))[_0x3162('0x24')](saveUpdates(_0x48cb8f['body'],null))[_0x3162('0x24')](respondWithResult(_0x4f1dde,null))['catch'](handleError(_0x4f1dde,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x13e7c4,_0x22c0a2,_0x160364){return db[_0x3162('0x3f')][_0x3162('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x13e7c4[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3162('0x4c')))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x50')))),_0x3162('0x51')],[db['sequelize']['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db['sequelize'][_0x3162('0x4e')](_0x3162('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),_0x3162('0x56')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3162('0x57')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x58')))),_0x3162('0x59')]]})[_0x3162('0x24')](handleEntityNotFound(_0x22c0a2,null))[_0x3162('0x24')](respondWithResult(_0x22c0a2,null))[_0x3162('0x42')](handleError(_0x22c0a2,null));};exports[_0x3162('0x5a')]=function(_0x4b5729,_0x4a42ea,_0x520b1a){return db[_0x3162('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5729[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5b')))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x50')))),'busyContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x54')))),_0x3162('0x5c')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),'abandonedContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5d')))),'reCallContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x58')))),'answeringMachine']]})[_0x3162('0x24')](handleEntityNotFound(_0x4a42ea,null))[_0x3162('0x24')](respondWithResult(_0x4a42ea,null))[_0x3162('0x42')](handleError(_0x4a42ea,null));};exports[_0x3162('0x5e')]=function(_0x8a75ca,_0x33c39d,_0xb3d824){return db['VoiceQueue']['find']({'where':{'id':_0x8a75ca['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x33c39d,null))[_0x3162('0x24')](function(_0x59b3f7){var _0x129005;if(_0x59b3f7){_0x129005=squel[_0x3162('0x5f')]()[_0x3162('0x60')](_0x3162('0x61'))['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'VoiceQueueId',_0x3162('0x65'),'updatedAt'],squel[_0x3162('0x66')]()['field'](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))[_0x3162('0x68')]('ANY_VALUE(ContactId)',_0x3162('0x6a'))[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x6c'),_0x3162('0x6d'))[_0x3162('0x68')](_0x3162('0x69'),'createdAt')[_0x3162('0x68')](_0x3162('0x69'),'updatedAt')['from'](_0x3162('0x6e'))[_0x3162('0x3c')]('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x8a75ca[_0x3162('0x48')][_0x3162('0x71')][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3162('0x66')]()[_0x3162('0x68')]('phone')[_0x3162('0x73')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id']['toString']()))[_0x3162('0x3c')](_0x3162('0x74'),squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x76'),_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where'](_0x3162('0x77')))[_0x3162('0x78')](_0x3162('0x6a')))[_0x3162('0x6f')]();return db[_0x3162('0x4a')][_0x3162('0x31')](_0x129005);}return[];})[_0x3162('0x24')](respondWithResult(_0x33c39d,null))[_0x3162('0x42')](handleError(_0x33c39d,null));};exports[_0x3162('0x79')]=function(_0x3f37fa,_0x1d242f,_0x190f91){return db['Campaign'][_0x3162('0x46')]({'where':{'id':_0x3f37fa[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x1d242f,null))['then'](function(_0x3d7bd1){var _0x5cdbb0;if(_0x3d7bd1){_0x5cdbb0=squel[_0x3162('0x5f')]()[_0x3162('0x60')]('cm_hopper')['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'CampaignId',_0x3162('0x65'),_0x3162('0x7a')],squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))['field'](_0x3162('0x7b'),'ContactId')[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x7c'),_0x3162('0x7d'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x65'))[_0x3162('0x68')]('NOW()',_0x3162('0x7a'))[_0x3162('0x73')](_0x3162('0x6e'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x3f37fa[_0x3162('0x48')]['state'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))[_0x3162('0x3c')](_0x3162('0x74'),squel['select']()[_0x3162('0x68')]('phone')[_0x3162('0x73')](_0x3162('0x61'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]()))['where'](_0x3162('0x74'),squel['select']()['field'](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where']('state\x20=\x204'))['group'](_0x3162('0x6a')))[_0x3162('0x6f')]();return db['sequelize']['query'](_0x5cdbb0);}return[];})[_0x3162('0x24')](respondWithResult(_0x1d242f,null))['catch'](handleError(_0x1d242f,null));};exports[_0x3162('0x7f')]=function(_0x35d9f0,_0x4408db,_0x377edb){return db['CmHopper'][_0x3162('0x80')]({'where':{'VoiceQueueId':_0x35d9f0[_0x3162('0x48')][_0x3162('0x6d')],'CampaignId':_0x35d9f0['body'][_0x3162('0x7d')],'ContactId':_0x35d9f0['body'][_0x3162('0x6a')]}})['then'](handleEntityNotFound(_0x4408db,null))[_0x3162('0x24')](function(_0x3d414f){if(_0x3d414f){return _0x3d414f;}return null;})[_0x3162('0x24')](respondWithResult(_0x4408db,null))['catch'](handleError(_0x4408db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index bee1761..46f340d 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 _0x6faf=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x4a9531,_0x31f133){var _0x2967f4=function(_0x43ac20){while(--_0x43ac20){_0x4a9531['push'](_0x4a9531['shift']());}};_0x2967f4(++_0x31f133);}(_0x6faf,0xa6));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf6fa('0x0'));var util=require(_0xf6fa('0x1'));var logger=require('../../config/logger')(_0xf6fa('0x2'));var moment=require(_0xf6fa('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6fa('0x4'));var fs=require('fs');var path=require(_0xf6fa('0x5'));var rimraf=require(_0xf6fa('0x6'));var config=require(_0xf6fa('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0xf6fa('0x8')]=function(_0x6ebf13,_0x51681e){return _0x6ebf13[_0xf6fa('0x9')](_0xf6fa('0xa'),attributes,{'tableName':_0xf6fa('0xb'),'paranoid':![],'indexes':[{'name':_0xf6fa('0xc'),'fields':[_0xf6fa('0xc')]},{'name':_0xf6fa('0xd'),'fields':[_0xf6fa('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x87b4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','util','api'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x87b4,0x107));var _0x487b=function(_0x35c179,_0x3516ee){_0x35c179=_0x35c179-0x0;var _0x5dbc37=_0x87b4[_0x35c179];return _0x5dbc37;};'use strict';var _=require(_0x487b('0x0'));var util=require(_0x487b('0x1'));var logger=require('../../config/logger')(_0x487b('0x2'));var moment=require(_0x487b('0x3'));var BPromise=require(_0x487b('0x4'));var rp=require(_0x487b('0x5'));var fs=require('fs');var path=require(_0x487b('0x6'));var rimraf=require(_0x487b('0x7'));var config=require(_0x487b('0x8'));var attributes=require(_0x487b('0x9'));module[_0x487b('0xa')]=function(_0xbf65b,_0x531f5b){return _0xbf65b[_0x487b('0xb')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x487b('0xc')]},{'name':_0x487b('0xd'),'fields':[_0x487b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d56c4fd..c29c8e2 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x574976,_0x4e190c){var _0x4daf51=function(_0x3fc3de){while(--_0x3fc3de){_0x574976['push'](_0x574976['shift']());}};_0x4daf51(++_0x4e190c);}(_0xb10b,0x12a));var _0xbb10=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0xb10b[_0x4efd3d];return _0x1293f2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3eec58,_0x146439){var _0x5ee827=function(_0x8709cc){while(--_0x8709cc){_0x3eec58['push'](_0x3eec58['shift']());}};_0x5ee827(++_0x146439);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0xb10b[_0x3c414c];return _0x4f3062;};'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 66765af..46dbe05 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 _0x2e98=['countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','get','/describe','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id'];(function(_0x43d5d5,_0x40fae7){var _0x42871f=function(_0x1fcbe1){while(--_0x1fcbe1){_0x43d5d5['push'](_0x43d5d5['shift']());}};_0x42871f(++_0x40fae7);}(_0x2e98,0x110));var _0x82e9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2e98[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x82e9('0x0'));var util=require(_0x82e9('0x1'));var path=require(_0x82e9('0x2'));var timeout=require(_0x82e9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x82e9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82e9('0x5'));var config=require(_0x82e9('0x6'));var controller=require(_0x82e9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x82e9('0x8')]);router[_0x82e9('0x9')](_0x82e9('0xa'),auth[_0x82e9('0xb')](),controller['describe']);router[_0x82e9('0x9')]('/:id',auth[_0x82e9('0xb')](),controller[_0x82e9('0xc')]);router[_0x82e9('0x9')](_0x82e9('0xd'),auth[_0x82e9('0xb')](),controller[_0x82e9('0xe')]);router[_0x82e9('0x9')](_0x82e9('0xf'),auth[_0x82e9('0xb')](),controller[_0x82e9('0x10')]);router[_0x82e9('0x11')]('/voice/queue/moveContacts/:id',auth[_0x82e9('0xb')](),controller[_0x82e9('0x12')]);router[_0x82e9('0x11')](_0x82e9('0x13'),auth[_0x82e9('0xb')](),controller[_0x82e9('0x14')]);router['post'](_0x82e9('0x15'),auth[_0x82e9('0xb')](),controller[_0x82e9('0x16')]);router['put']('/:id',auth[_0x82e9('0xb')](),controller['update']);module[_0x82e9('0x17')]=router; \ No newline at end of file +var _0xda16=['update','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','/:id'];(function(_0x38298e,_0x180183){var _0x1ba885=function(_0x159e48){while(--_0x159e48){_0x38298e['push'](_0x38298e['shift']());}};_0x1ba885(++_0x180183);}(_0xda16,0x1cf));var _0x6da1=function(_0x3fc1c1,_0x1f038d){_0x3fc1c1=_0x3fc1c1-0x0;var _0x1353db=_0xda16[_0x3fc1c1];return _0x1353db;};'use strict';var multer=require(_0x6da1('0x0'));var util=require(_0x6da1('0x1'));var path=require(_0x6da1('0x2'));var timeout=require(_0x6da1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6da1('0x4'));var interaction=require(_0x6da1('0x5'));var config=require(_0x6da1('0x6'));var controller=require('./cmHopperFinal.controller');router[_0x6da1('0x7')]('/',auth[_0x6da1('0x8')](),controller[_0x6da1('0x9')]);router[_0x6da1('0x7')]('/describe',auth[_0x6da1('0x8')](),controller['describe']);router[_0x6da1('0x7')]('/:id',auth[_0x6da1('0x8')](),controller[_0x6da1('0xa')]);router[_0x6da1('0x7')](_0x6da1('0xb'),auth[_0x6da1('0x8')](),controller[_0x6da1('0xc')]);router['get'](_0x6da1('0xd'),auth[_0x6da1('0x8')](),controller[_0x6da1('0xe')]);router[_0x6da1('0xf')](_0x6da1('0x10'),auth[_0x6da1('0x8')](),controller[_0x6da1('0x11')]);router[_0x6da1('0xf')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0x6da1('0x12')]);router[_0x6da1('0xf')]('/checkContactHopper',auth[_0x6da1('0x8')](),controller[_0x6da1('0x13')]);router['put'](_0x6da1('0x14'),auth[_0x6da1('0x8')](),controller[_0x6da1('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7aef9d8..1509430 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 _0xb0bd=['DATE','INTEGER','BOOLEAN','exports','STRING'];(function(_0x4cbb8e,_0x1047c8){var _0x17846f=function(_0x29e1e0){while(--_0x29e1e0){_0x4cbb8e['push'](_0x4cbb8e['shift']());}};_0x17846f(++_0x1047c8);}(_0xb0bd,0x12a));var _0xdb0b=function(_0x1dace9,_0x1566ac){_0x1dace9=_0x1dace9-0x0;var _0xf44d3d=_0xb0bd[_0x1dace9];return _0xf44d3d;};'use strict';var Sequelize=require('sequelize');module[_0xdb0b('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xdb0b('0x1')]},'scheduledat':{'type':Sequelize[_0xdb0b('0x2')]},'countbusyretry':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdb0b('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xdb0b('0x1')]},'originatecalleridname':{'type':Sequelize[_0xdb0b('0x1')]},'calleridnum':{'type':Sequelize[_0xdb0b('0x1')]},'calleridname':{'type':Sequelize[_0xdb0b('0x1')]},'starttime':{'type':Sequelize[_0xdb0b('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xdb0b('0x2')]},'droptime':{'type':Sequelize[_0xdb0b('0x2')]},'endtime':{'type':Sequelize[_0xdb0b('0x2')]},'ringtime':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdb0b('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xdb0b('0x1')]},'membername':{'type':Sequelize[_0xdb0b('0x1')]},'reason':{'type':Sequelize[_0xdb0b('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xdb0b('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xdb0b('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdb0b('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdb0b('0x2')]},'recallme':{'type':Sequelize[_0xdb0b('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xdb0b('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdb0b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc128=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x3f9f39,_0x39d8c2){var _0x3de0b8=function(_0x4e9efe){while(--_0x4e9efe){_0x3f9f39['push'](_0x3f9f39['shift']());}};_0x3de0b8(++_0x39d8c2);}(_0xc128,0x160));var _0x8c12=function(_0x4b70bc,_0x4568a3){_0x4b70bc=_0x4b70bc-0x0;var _0x59e4b5=_0xc128[_0x4b70bc];return _0x59e4b5;};'use strict';var Sequelize=require(_0x8c12('0x0'));module[_0x8c12('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8c12('0x2')]},'scheduledat':{'type':Sequelize[_0x8c12('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8c12('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8c12('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8c12('0x2')]},'calleridname':{'type':Sequelize[_0x8c12('0x2')]},'starttime':{'type':Sequelize[_0x8c12('0x3')]},'responsetime':{'type':Sequelize[_0x8c12('0x3')]},'answertime':{'type':Sequelize[_0x8c12('0x3')]},'droptime':{'type':Sequelize[_0x8c12('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8c12('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8c12('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8c12('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8c12('0x2')]},'campaign':{'type':Sequelize[_0x8c12('0x2')]},'campaigntype':{'type':Sequelize[_0x8c12('0x2')]},'membername':{'type':Sequelize[_0x8c12('0x2')]},'reason':{'type':Sequelize[_0x8c12('0x2')]},'amd':{'type':Sequelize[_0x8c12('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8c12('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8c12('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8c12('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8c12('0x3')]},'edited':{'type':Sequelize[_0x8c12('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8c12('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8c12('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index efb9e0d..cf53170 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 _0x9beb=['filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1082d0,_0x1df9f5){var _0x288451=function(_0x6c422f){while(--_0x6c422f){_0x1082d0['push'](_0x1082d0['shift']());}};_0x288451(++_0x1df9f5);}(_0x9beb,0x1df));var _0xb9be=function(_0x591d7c,_0x11a111){_0x591d7c=_0x591d7c-0x0;var _0x502b96=_0x9beb[_0x591d7c];return _0x502b96;};'use strict';var emlformat=require(_0xb9be('0x0'));var rimraf=require(_0xb9be('0x1'));var zipdir=require(_0xb9be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9be('0x3'));var moment=require(_0xb9be('0x4'));var BPromise=require(_0xb9be('0x5'));var Mustache=require(_0xb9be('0x6'));var util=require(_0xb9be('0x7'));var path=require(_0xb9be('0x8'));var sox=require(_0xb9be('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9be('0xa'));var _=require(_0xb9be('0xb'));var squel=require(_0xb9be('0xc'));var crypto=require(_0xb9be('0xd'));var jsforce=require(_0xb9be('0xe'));var deskjs=require(_0xb9be('0xf'));var toCsv=require(_0xb9be('0x10'));var querystring=require('querystring');var Papa=require(_0xb9be('0x11'));var Redis=require(_0xb9be('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb9be('0x13'));var as=require(_0xb9be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb9be('0x15'));var config=require(_0xb9be('0x16'));var licenseUtil=require(_0xb9be('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51cb23,_0x5b007d){_0x5b007d=_0x5b007d||0xcc;return function(_0x8d9215){if(_0x8d9215){return _0x51cb23[_0xb9be('0x18')](_0x5b007d);}return _0x51cb23[_0xb9be('0x19')](_0x5b007d)[_0xb9be('0x1a')]();};}function respondWithResult(_0x50f09c,_0x4e20a2){_0x4e20a2=_0x4e20a2||0xc8;return function(_0x2c105a){if(_0x2c105a){return _0x50f09c[_0xb9be('0x19')](_0x4e20a2)[_0xb9be('0x1b')](_0x2c105a);}};}function respondWithFilteredResult(_0x1ee5bd,_0x502a80){return function(_0x529c96){if(_0x529c96){var _0x391ba4=typeof _0x502a80['offset']==='undefined'&&typeof _0x502a80[_0xb9be('0x1c')]===_0xb9be('0x1d');var _0x288ce1=_0x529c96[_0xb9be('0x1e')];var _0x450356=_0x391ba4?0x0:_0x502a80[_0xb9be('0x1f')];var _0x215df3=_0x391ba4?_0x529c96[_0xb9be('0x1e')]:_0x502a80[_0xb9be('0x1f')]+_0x502a80[_0xb9be('0x1c')];var _0x4218c1;if(_0x215df3>=_0x288ce1){_0x215df3=_0x288ce1;_0x4218c1=0xc8;}else{_0x4218c1=0xce;}_0x1ee5bd['status'](_0x4218c1);return _0x1ee5bd[_0xb9be('0x20')](_0xb9be('0x21'),_0x450356+'-'+_0x215df3+'/'+_0x288ce1)[_0xb9be('0x1b')](_0x529c96);}return null;};}function patchUpdates(_0x6642df){return function(_0x1bdb57){try{jsonpatch[_0xb9be('0x22')](_0x1bdb57,_0x6642df,!![]);}catch(_0xce8ce2){return BPromise[_0xb9be('0x23')](_0xce8ce2);}return _0x1bdb57[_0xb9be('0x24')]();};}function saveUpdates(_0x296462,_0x10e733){return function(_0x1806fc){if(_0x1806fc){return _0x1806fc[_0xb9be('0x25')](_0x296462)['then'](function(_0x34613a){return _0x34613a;});}return null;};}function removeEntity(_0x376a64,_0xcf43a3){return function(_0x253638){if(_0x253638){return _0x253638[_0xb9be('0x26')]()[_0xb9be('0x27')](function(){_0x376a64[_0xb9be('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a3440,_0x30afe3){return function(_0x3bc945){if(!_0x3bc945){_0x1a3440['sendStatus'](0x194);}return _0x3bc945;};}function handleError(_0xe94b3,_0x553101){_0x553101=_0x553101||0x1f4;return function(_0x1c1821){logger['error'](_0x1c1821[_0xb9be('0x28')]);if(_0x1c1821[_0xb9be('0x29')]){delete _0x1c1821['name'];}_0xe94b3['status'](_0x553101)[_0xb9be('0x2a')](_0x1c1821);};}exports['index']=function(_0x19d594,_0x4c0e9c){var _0x1f0bd4={},_0x526995={},_0x3a42e6={'count':0x0,'rows':[]};var _0x276eeb=_[_0xb9be('0x2b')](db[_0xb9be('0x2c')][_0xb9be('0x2d')],function(_0x18a899){return{'name':_0x18a899['fieldName'],'type':_0x18a899[_0xb9be('0x2e')][_0xb9be('0x2f')]};});_0x526995[_0xb9be('0x30')]=_[_0xb9be('0x2b')](_0x276eeb,'name');_0x526995[_0xb9be('0x31')]=_[_0xb9be('0x32')](_0x19d594[_0xb9be('0x31')]);_0x526995['filters']=_['intersection'](_0x526995[_0xb9be('0x30')],_0x526995[_0xb9be('0x31')]);_0x1f0bd4['attributes']=_[_0xb9be('0x33')](_0x526995[_0xb9be('0x30')],qs['fields'](_0x19d594[_0xb9be('0x31')][_0xb9be('0x34')]));_0x1f0bd4[_0xb9be('0x35')]=_0x1f0bd4[_0xb9be('0x35')][_0xb9be('0x36')]?_0x1f0bd4[_0xb9be('0x35')]:_0x526995[_0xb9be('0x30')];if(!_0x19d594[_0xb9be('0x31')][_0xb9be('0x37')](_0xb9be('0x38'))){_0x1f0bd4['limit']=qs['limit'](_0x19d594[_0xb9be('0x31')][_0xb9be('0x1c')]);_0x1f0bd4[_0xb9be('0x1f')]=qs[_0xb9be('0x1f')](_0x19d594[_0xb9be('0x31')][_0xb9be('0x1f')]);}_0x1f0bd4[_0xb9be('0x39')]=qs[_0xb9be('0x3a')](_0x19d594['query']['sort']);_0x1f0bd4[_0xb9be('0x3b')]=qs[_0xb9be('0x3c')](_[_0xb9be('0x3d')](_0x19d594[_0xb9be('0x31')],_0x526995[_0xb9be('0x3c')]),_0x276eeb);if(_0x19d594[_0xb9be('0x31')]['filter']){_0x1f0bd4[_0xb9be('0x3b')]=_[_0xb9be('0x3e')](_0x1f0bd4[_0xb9be('0x3b')],{'$or':_[_0xb9be('0x2b')](_0x276eeb,function(_0x27e872){if(_0x27e872[_0xb9be('0x2e')]!==_0xb9be('0x3f')){var _0x284503={};_0x284503[_0x27e872[_0xb9be('0x29')]]={'$like':'%'+_0x19d594[_0xb9be('0x31')][_0xb9be('0x40')]+'%'};return _0x284503;}})});}_0x1f0bd4=_[_0xb9be('0x3e')]({},_0x1f0bd4,_0x19d594[_0xb9be('0x41')]);var _0x223cf1={'where':_0x1f0bd4[_0xb9be('0x3b')]};return db[_0xb9be('0x2c')][_0xb9be('0x1e')](_0x223cf1)[_0xb9be('0x27')](function(_0x2df755){_0x3a42e6['count']=_0x2df755;if(_0x19d594[_0xb9be('0x31')][_0xb9be('0x42')]){_0x1f0bd4[_0xb9be('0x43')]=[{'all':!![]}];}return db[_0xb9be('0x2c')][_0xb9be('0x44')](_0x1f0bd4);})[_0xb9be('0x27')](function(_0x3ce46a){_0x3a42e6[_0xb9be('0x45')]=_0x3ce46a;return _0x3a42e6;})['then'](respondWithFilteredResult(_0x4c0e9c,_0x1f0bd4))[_0xb9be('0x46')](handleError(_0x4c0e9c,null));};exports['show']=function(_0x366944,_0x35ec61){var _0x1f2c9f={'raw':!![],'where':{'id':_0x366944[_0xb9be('0x47')]['id']}},_0x298446={};_0x298446['model']=_['keys'](db[_0xb9be('0x2c')][_0xb9be('0x2d')]);_0x298446[_0xb9be('0x31')]=_[_0xb9be('0x32')](_0x366944[_0xb9be('0x31')]);_0x298446[_0xb9be('0x3c')]=_[_0xb9be('0x33')](_0x298446[_0xb9be('0x30')],_0x298446[_0xb9be('0x31')]);_0x1f2c9f[_0xb9be('0x35')]=_[_0xb9be('0x33')](_0x298446[_0xb9be('0x30')],qs[_0xb9be('0x34')](_0x366944[_0xb9be('0x31')][_0xb9be('0x34')]));_0x1f2c9f[_0xb9be('0x35')]=_0x1f2c9f[_0xb9be('0x35')][_0xb9be('0x36')]?_0x1f2c9f[_0xb9be('0x35')]:_0x298446[_0xb9be('0x30')];if(_0x366944[_0xb9be('0x31')][_0xb9be('0x42')]){_0x1f2c9f[_0xb9be('0x43')]=[{'all':!![]}];}_0x1f2c9f=_[_0xb9be('0x3e')]({},_0x1f2c9f,_0x366944[_0xb9be('0x41')]);return db[_0xb9be('0x2c')][_0xb9be('0x48')](_0x1f2c9f)['then'](handleEntityNotFound(_0x35ec61,null))[_0xb9be('0x27')](respondWithResult(_0x35ec61,null))[_0xb9be('0x46')](handleError(_0x35ec61,null));};exports[_0xb9be('0x49')]=function(_0x2cc9c0,_0x436176){return db[_0xb9be('0x2c')][_0xb9be('0x49')](_0x2cc9c0[_0xb9be('0x4a')],{})[_0xb9be('0x27')](respondWithResult(_0x436176,0xc9))[_0xb9be('0x46')](handleError(_0x436176,null));};exports[_0xb9be('0x4b')]=function(_0x3f3fc7,_0x295af0){return db[_0xb9be('0x2c')]['describe']()[_0xb9be('0x27')](respondWithResult(_0x295af0,null))[_0xb9be('0x46')](handleError(_0x295af0,null));};exports['update']=function(_0x234803,_0x711b26){if(_0x234803[_0xb9be('0x4a')][_0xb9be('0x4c')]){delete _0x234803[_0xb9be('0x4a')][_0xb9be('0x4c')];}return db['CmHopperHistory'][_0xb9be('0x48')]({'where':{'uniqueid':_0x234803[_0xb9be('0x47')]['id']}})[_0xb9be('0x27')](handleEntityNotFound(_0x711b26,null))[_0xb9be('0x27')](saveUpdates(_0x234803[_0xb9be('0x4a')],null))[_0xb9be('0x27')](respondWithResult(_0x711b26,null))[_0xb9be('0x46')](handleError(_0x711b26,null));}; \ No newline at end of file +var _0x46a1=['sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','index','CmHopperHistory','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','include','rows','catch','show','keys','includeAll','create','body','update','uniqueid','params','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x46a1,0x1e7));var _0x146a=function(_0x3d0e0c,_0x3c4f7b){_0x3d0e0c=_0x3d0e0c-0x0;var _0x2cad75=_0x46a1[_0x3d0e0c];return _0x2cad75;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x146a('0x0'));var jsonpatch=require(_0x146a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x146a('0x2'));var Mustache=require(_0x146a('0x3'));var util=require(_0x146a('0x4'));var path=require('path');var sox=require(_0x146a('0x5'));var csv=require(_0x146a('0x6'));var ejs=require(_0x146a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x146a('0x8'));var squel=require(_0x146a('0x9'));var crypto=require(_0x146a('0xa'));var jsforce=require(_0x146a('0xb'));var deskjs=require(_0x146a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x146a('0xd'));var Papa=require(_0x146a('0xe'));var Redis=require(_0x146a('0xf'));var authService=require(_0x146a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x146a('0x11'));var hardwareService=require(_0x146a('0x12'));var logger=require(_0x146a('0x13'))(_0x146a('0x14'));var utils=require('../../config/utils');var config=require(_0x146a('0x15'));var licenseUtil=require(_0x146a('0x16'));var db=require(_0x146a('0x17'))['db'];function respondWithStatusCode(_0x39498c,_0x5a0d42){_0x5a0d42=_0x5a0d42||0xcc;return function(_0x5574cc){if(_0x5574cc){return _0x39498c[_0x146a('0x18')](_0x5a0d42);}return _0x39498c[_0x146a('0x19')](_0x5a0d42)['end']();};}function respondWithResult(_0x4644f1,_0x2c5763){_0x2c5763=_0x2c5763||0xc8;return function(_0x34bdfb){if(_0x34bdfb){return _0x4644f1[_0x146a('0x19')](_0x2c5763)[_0x146a('0x1a')](_0x34bdfb);}};}function respondWithFilteredResult(_0x12ef31,_0x2c8c39){return function(_0x38c679){if(_0x38c679){var _0xf16372=typeof _0x2c8c39[_0x146a('0x1b')]==='undefined'&&typeof _0x2c8c39[_0x146a('0x1c')]===_0x146a('0x1d');var _0x51ea8a=_0x38c679['count'];var _0x1c28b8=_0xf16372?0x0:_0x2c8c39[_0x146a('0x1b')];var _0x11a1d7=_0xf16372?_0x38c679[_0x146a('0x1e')]:_0x2c8c39[_0x146a('0x1b')]+_0x2c8c39[_0x146a('0x1c')];var _0x499feb;if(_0x11a1d7>=_0x51ea8a){_0x11a1d7=_0x51ea8a;_0x499feb=0xc8;}else{_0x499feb=0xce;}_0x12ef31[_0x146a('0x19')](_0x499feb);return _0x12ef31[_0x146a('0x1f')](_0x146a('0x20'),_0x1c28b8+'-'+_0x11a1d7+'/'+_0x51ea8a)[_0x146a('0x1a')](_0x38c679);}return null;};}function patchUpdates(_0x580f3f){return function(_0x3eefef){try{jsonpatch[_0x146a('0x21')](_0x3eefef,_0x580f3f,!![]);}catch(_0xc0b8b5){return BPromise[_0x146a('0x22')](_0xc0b8b5);}return _0x3eefef[_0x146a('0x23')]();};}function saveUpdates(_0x33cee4,_0xeb3220){return function(_0x154871){if(_0x154871){return _0x154871['update'](_0x33cee4)[_0x146a('0x24')](function(_0x24ead6){return _0x24ead6;});}return null;};}function removeEntity(_0x938d29,_0x282a17){return function(_0x5775bf){if(_0x5775bf){return _0x5775bf['destroy']()[_0x146a('0x24')](function(){_0x938d29[_0x146a('0x19')](0xcc)[_0x146a('0x25')]();});}};}function handleEntityNotFound(_0x3a9ec1,_0x5ee2b8){return function(_0x3eae1d){if(!_0x3eae1d){_0x3a9ec1['sendStatus'](0x194);}return _0x3eae1d;};}function handleError(_0x28e25c,_0x148c2d){_0x148c2d=_0x148c2d||0x1f4;return function(_0x308dc5){logger[_0x146a('0x26')](_0x308dc5[_0x146a('0x27')]);if(_0x308dc5[_0x146a('0x28')]){delete _0x308dc5[_0x146a('0x28')];}_0x28e25c['status'](_0x148c2d)['send'](_0x308dc5);};}exports[_0x146a('0x29')]=function(_0x4f7383,_0x243730){var _0x1b79a9={},_0x3f4877={},_0x9679e9={'count':0x0,'rows':[]};var _0x55ba97=_['map'](db[_0x146a('0x2a')][_0x146a('0x2b')],function(_0x4de3ba){return{'name':_0x4de3ba[_0x146a('0x2c')],'type':_0x4de3ba['type'][_0x146a('0x2d')]};});_0x3f4877['model']=_['map'](_0x55ba97,_0x146a('0x28'));_0x3f4877[_0x146a('0x2e')]=_['keys'](_0x4f7383['query']);_0x3f4877[_0x146a('0x2f')]=_[_0x146a('0x30')](_0x3f4877[_0x146a('0x31')],_0x3f4877[_0x146a('0x2e')]);_0x1b79a9[_0x146a('0x32')]=_['intersection'](_0x3f4877[_0x146a('0x31')],qs[_0x146a('0x33')](_0x4f7383['query']['fields']));_0x1b79a9[_0x146a('0x32')]=_0x1b79a9[_0x146a('0x32')][_0x146a('0x34')]?_0x1b79a9[_0x146a('0x32')]:_0x3f4877[_0x146a('0x31')];if(!_0x4f7383['query'][_0x146a('0x35')](_0x146a('0x36'))){_0x1b79a9[_0x146a('0x1c')]=qs[_0x146a('0x1c')](_0x4f7383[_0x146a('0x2e')][_0x146a('0x1c')]);_0x1b79a9[_0x146a('0x1b')]=qs[_0x146a('0x1b')](_0x4f7383['query']['offset']);}_0x1b79a9[_0x146a('0x37')]=qs[_0x146a('0x38')](_0x4f7383['query'][_0x146a('0x38')]);_0x1b79a9[_0x146a('0x39')]=qs[_0x146a('0x2f')](_['pick'](_0x4f7383[_0x146a('0x2e')],_0x3f4877['filters']),_0x55ba97);if(_0x4f7383[_0x146a('0x2e')][_0x146a('0x3a')]){_0x1b79a9[_0x146a('0x39')]=_[_0x146a('0x3b')](_0x1b79a9['where'],{'$or':_[_0x146a('0x3c')](_0x55ba97,function(_0x2110e2){if(_0x2110e2[_0x146a('0x3d')]!=='VIRTUAL'){var _0x2eb555={};_0x2eb555[_0x2110e2[_0x146a('0x28')]]={'$like':'%'+_0x4f7383[_0x146a('0x2e')]['filter']+'%'};return _0x2eb555;}})});}_0x1b79a9=_[_0x146a('0x3b')]({},_0x1b79a9,_0x4f7383['options']);var _0x217a6d={'where':_0x1b79a9[_0x146a('0x39')]};return db[_0x146a('0x2a')][_0x146a('0x1e')](_0x217a6d)['then'](function(_0x2b124c){_0x9679e9[_0x146a('0x1e')]=_0x2b124c;if(_0x4f7383['query']['includeAll']){_0x1b79a9[_0x146a('0x3e')]=[{'all':!![]}];}return db[_0x146a('0x2a')]['findAll'](_0x1b79a9);})[_0x146a('0x24')](function(_0x1a9edc){_0x9679e9[_0x146a('0x3f')]=_0x1a9edc;return _0x9679e9;})[_0x146a('0x24')](respondWithFilteredResult(_0x243730,_0x1b79a9))[_0x146a('0x40')](handleError(_0x243730,null));};exports[_0x146a('0x41')]=function(_0x39648f,_0x3eb40c){var _0x910e5c={'raw':!![],'where':{'id':_0x39648f['params']['id']}},_0x446110={};_0x446110[_0x146a('0x31')]=_[_0x146a('0x42')](db['CmHopperHistory'][_0x146a('0x2b')]);_0x446110[_0x146a('0x2e')]=_[_0x146a('0x42')](_0x39648f[_0x146a('0x2e')]);_0x446110[_0x146a('0x2f')]=_['intersection'](_0x446110[_0x146a('0x31')],_0x446110['query']);_0x910e5c[_0x146a('0x32')]=_['intersection'](_0x446110[_0x146a('0x31')],qs[_0x146a('0x33')](_0x39648f['query'][_0x146a('0x33')]));_0x910e5c[_0x146a('0x32')]=_0x910e5c[_0x146a('0x32')][_0x146a('0x34')]?_0x910e5c[_0x146a('0x32')]:_0x446110[_0x146a('0x31')];if(_0x39648f[_0x146a('0x2e')][_0x146a('0x43')]){_0x910e5c[_0x146a('0x3e')]=[{'all':!![]}];}_0x910e5c=_[_0x146a('0x3b')]({},_0x910e5c,_0x39648f['options']);return db['CmHopperHistory']['find'](_0x910e5c)[_0x146a('0x24')](handleEntityNotFound(_0x3eb40c,null))[_0x146a('0x24')](respondWithResult(_0x3eb40c,null))['catch'](handleError(_0x3eb40c,null));};exports[_0x146a('0x44')]=function(_0x3be99c,_0x5af8f5){return db[_0x146a('0x2a')][_0x146a('0x44')](_0x3be99c[_0x146a('0x45')],{})[_0x146a('0x24')](respondWithResult(_0x5af8f5,0xc9))[_0x146a('0x40')](handleError(_0x5af8f5,null));};exports['describe']=function(_0xd275dc,_0x3205c2){return db['CmHopperHistory']['describe']()[_0x146a('0x24')](respondWithResult(_0x3205c2,null))[_0x146a('0x40')](handleError(_0x3205c2,null));};exports[_0x146a('0x46')]=function(_0x271edb,_0x578263){if(_0x271edb[_0x146a('0x45')]['uniqueid']){delete _0x271edb['body'][_0x146a('0x47')];}return db[_0x146a('0x2a')]['find']({'where':{'uniqueid':_0x271edb[_0x146a('0x48')]['id']}})[_0x146a('0x24')](handleEntityNotFound(_0x578263,null))['then'](saveUpdates(_0x271edb[_0x146a('0x45')],null))[_0x146a('0x24')](respondWithResult(_0x578263,null))[_0x146a('0x40')](handleError(_0x578263,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b06f807..45d409b 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 _0xb4d9=['bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb4d9,0xce));var _0x9b4d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xb4d9[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x9b4d('0x0'));var util=require(_0x9b4d('0x1'));var logger=require('../../config/logger')(_0x9b4d('0x2'));var moment=require(_0x9b4d('0x3'));var BPromise=require(_0x9b4d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b4d('0x5'));var rimraf=require(_0x9b4d('0x6'));var config=require(_0x9b4d('0x7'));var attributes=require(_0x9b4d('0x8'));module[_0x9b4d('0x9')]=function(_0x125f8e,_0x16c6dd){return _0x125f8e[_0x9b4d('0xa')](_0x9b4d('0xb'),attributes,{'tableName':_0x9b4d('0xc'),'paranoid':![],'indexes':[{'name':_0x9b4d('0xd'),'fields':['endtime']},{'name':_0x9b4d('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0598=['cm_hopper_history','endtime','lodash','util','api','request-promise','path','exports','CmHopperHistory'];(function(_0x442492,_0x5ed9e8){var _0x453345=function(_0x39d11c){while(--_0x39d11c){_0x442492['push'](_0x442492['shift']());}};_0x453345(++_0x5ed9e8);}(_0x0598,0x92));var _0x8059=function(_0x4e72ec,_0x495320){_0x4e72ec=_0x4e72ec-0x0;var _0x53fdd1=_0x0598[_0x4e72ec];return _0x53fdd1;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'paranoid':![],'indexes':[{'name':_0x8059('0x8'),'fields':[_0x8059('0x8')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 23305dd..593559f 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 _0xec81=['predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperHistory','create','body','options','raw','debug','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xec81,0x71));var _0x1ec8=function(_0x344294,_0x5bd8c5){_0x344294=_0x344294-0x0;var _0x14a5e4=_0xec81[_0x344294];return _0x14a5e4;};'use strict';var _=require('lodash');var util=require(_0x1ec8('0x0'));var moment=require('moment');var BPromise=require(_0x1ec8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ec8('0x2'));var db=require(_0x1ec8('0x3'))['db'];var utils=require(_0x1ec8('0x4'));var logger=require(_0x1ec8('0x5'))(_0x1ec8('0x6'));var config=require(_0x1ec8('0x7'));var jayson=require(_0x1ec8('0x8'));var client=jayson[_0x1ec8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x273c0a,_0x4091ba,_0x4cc35e){return new BPromise(function(_0x432173,_0x1ca077){return client['request'](_0x273c0a,_0x4cc35e)[_0x1ec8('0xa')](function(_0x2d9916){logger[_0x1ec8('0xb')](_0x1ec8('0xc'),_0x4091ba,_0x1ec8('0xd'));logger['debug'](_0x1ec8('0xe'),_0x4091ba,_0x1ec8('0xd'),JSON[_0x1ec8('0xf')](_0x2d9916));if(_0x2d9916[_0x1ec8('0x10')]){if(_0x2d9916[_0x1ec8('0x10')][_0x1ec8('0x11')]===0x1f4){logger[_0x1ec8('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4091ba,_0x2d9916[_0x1ec8('0x10')][_0x1ec8('0x12')]);return _0x1ca077(_0x2d9916[_0x1ec8('0x10')][_0x1ec8('0x12')]);}logger[_0x1ec8('0x10')](_0x1ec8('0xc'),_0x4091ba,_0x2d9916['error'][_0x1ec8('0x12')]);return _0x432173(_0x2d9916[_0x1ec8('0x10')][_0x1ec8('0x12')]);}else{logger['info'](_0x1ec8('0xc'),_0x4091ba,_0x1ec8('0xd'));_0x432173(_0x2d9916[_0x1ec8('0x13')][_0x1ec8('0x12')]);}})[_0x1ec8('0x14')](function(_0x312adc){logger[_0x1ec8('0x10')](_0x1ec8('0xc'),_0x4091ba,_0x312adc);_0x1ca077(_0x312adc);});});}exports['CreateCmHopperHistory']=function(_0x35ba20){var _0x46c2ac=this;return new Promise(function(_0x11dcab,_0x138730){return db[_0x1ec8('0x15')][_0x1ec8('0x16')](_0x35ba20[_0x1ec8('0x17')],{'raw':_0x35ba20[_0x1ec8('0x18')]?_0x35ba20[_0x1ec8('0x18')][_0x1ec8('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4e575d){logger[_0x1ec8('0xb')]('CreateCmHopperHistory',_0x35ba20);logger[_0x1ec8('0x1a')](_0x1ec8('0x1b'),_0x35ba20,JSON['stringify'](_0x4e575d));_0x11dcab(_0x4e575d);})[_0x1ec8('0x14')](function(_0x2d9621){logger[_0x1ec8('0x10')](_0x1ec8('0x1b'),_0x2d9621['message'],_0x35ba20);_0x138730(_0x46c2ac[_0x1ec8('0x10')](0x1f4,_0x2d9621[_0x1ec8('0x12')]));});});};exports[_0x1ec8('0x1c')]=function(_0x227d60){var _0x1880b9=this;return new Promise(function(_0x326b00,_0x18df32){return db[_0x1ec8('0x15')][_0x1ec8('0x1d')]({'raw':_0x227d60[_0x1ec8('0x18')]?_0x227d60[_0x1ec8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x227d60[_0x1ec8('0x18')]?_0x227d60[_0x1ec8('0x18')][_0x1ec8('0x1e')]||null:null,'attributes':[[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db['sequelize'][_0x1ec8('0x21')]('id')),_0x1ec8('0x22')],[db[_0x1ec8('0x1f')]['fn']('COUNT',db[_0x1ec8('0x1f')]['fn']('IF',db['sequelize'][_0x1ec8('0x23')](_0x1ec8('0x24')))),_0x1ec8('0x25')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')]['literal'](_0x1ec8('0x26')))),_0x1ec8('0x27')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')](_0x1ec8('0x28')))),_0x1ec8('0x29')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x2a'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')](_0x1ec8('0x2b')))),_0x1ec8('0x2c')],[db['sequelize']['fn'](_0x1ec8('0x2a'),db[_0x1ec8('0x1f')]['fn']('IF',db['sequelize'][_0x1ec8('0x23')](_0x1ec8('0x2d')))),_0x1ec8('0x2e')]]})[_0x1ec8('0xa')](function(_0x283baa){logger[_0x1ec8('0xb')](_0x1ec8('0x1c'),_0x227d60);logger['debug'](_0x1ec8('0x1c'),_0x227d60,JSON['stringify'](_0x283baa));_0x326b00(_0x283baa);})[_0x1ec8('0x14')](function(_0x5df6ef){logger[_0x1ec8('0x10')]('AvgHandleTime',_0x5df6ef[_0x1ec8('0x12')],_0x227d60);_0x18df32(_0x1880b9[_0x1ec8('0x10')](0x1f4,_0x5df6ef[_0x1ec8('0x12')]));});});};exports[_0x1ec8('0x2f')]=function(_0x2a1d35){var _0x1fdded=this;return new Promise(function(_0x2f12d7,_0x5216fc){return db[_0x1ec8('0x15')]['findAll']({'raw':_0x2a1d35['options']?_0x2a1d35[_0x1ec8('0x18')][_0x1ec8('0x19')]===undefined?!![]:![]:!![],'where':_0x2a1d35[_0x1ec8('0x18')]?_0x2a1d35[_0x1ec8('0x18')][_0x1ec8('0x1e')]||null:null,'attributes':[['campaign',_0x1ec8('0x30')],[db['sequelize']['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db['sequelize'][_0x1ec8('0x23')](_0x1ec8('0x31')))),_0x1ec8('0x32')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0x1ec8('0x33')],[db[_0x1ec8('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x1ec8('0x34')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db['sequelize'][_0x1ec8('0x23')](_0x1ec8('0x35')))),_0x1ec8('0x36')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')](_0x1ec8('0x37')))),'outboundCongestionCallsDay'],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db['sequelize']['fn']('IF',db[_0x1ec8('0x1f')]['literal'](_0x1ec8('0x38')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')](_0x1ec8('0x39')))),_0x1ec8('0x3a')],[db['sequelize']['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db['sequelize'][_0x1ec8('0x23')](_0x1ec8('0x3b')))),_0x1ec8('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')](_0x1ec8('0x3d')))),_0x1ec8('0x3e')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')](_0x1ec8('0x3f')))),_0x1ec8('0x40')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db['sequelize'][_0x1ec8('0x23')](_0x1ec8('0x41')))),_0x1ec8('0x42')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db['sequelize']['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')](_0x1ec8('0x43')))),_0x1ec8('0x44')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db['sequelize'][_0x1ec8('0x23')]('`state`\x20=\x2020,\x201,\x20null'))),_0x1ec8('0x42')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')]['literal'](_0x1ec8('0x45')))),_0x1ec8('0x46')]],'group':[_0x1ec8('0x47')]})[_0x1ec8('0xa')](function(_0xf26e56){logger[_0x1ec8('0xb')](_0x1ec8('0x2f'),_0x2a1d35);logger[_0x1ec8('0x1a')]('GetVoiceQueueHopperHistory',_0x2a1d35,JSON[_0x1ec8('0xf')](_0xf26e56));_0x2f12d7(_0xf26e56);})[_0x1ec8('0x14')](function(_0x35919b){logger[_0x1ec8('0x10')](_0x1ec8('0x2f'),_0x35919b[_0x1ec8('0x12')],_0x2a1d35);_0x5216fc(_0x1fdded[_0x1ec8('0x10')](0x1f4,_0x35919b[_0x1ec8('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0xe3d9a2){var _0x50b737=this;return new Promise(function(_0x362ce4,_0x96184b){return db['CmHopperHistory'][_0x1ec8('0x1d')]({'raw':_0xe3d9a2[_0x1ec8('0x18')]?_0xe3d9a2['options'][_0x1ec8('0x19')]===undefined?!![]:![]:!![],'where':_0xe3d9a2[_0x1ec8('0x18')]?_0xe3d9a2[_0x1ec8('0x18')][_0x1ec8('0x1e')]||null:null,'attributes':[[_0x1ec8('0x47'),_0x1ec8('0x30')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['col']('id')),_0x1ec8('0x48')],[db[_0x1ec8('0x1f')]['fn'](_0x1ec8('0x20'),db[_0x1ec8('0x1f')]['fn']('IF',db[_0x1ec8('0x1f')][_0x1ec8('0x23')](_0x1ec8('0x24')))),_0x1ec8('0x49')]],'group':[_0x1ec8('0x47')]})[_0x1ec8('0xa')](function(_0x47e6d9){logger['info'](_0x1ec8('0x4a'),_0xe3d9a2);logger[_0x1ec8('0x1a')]('GetCampaignHopperHistory',_0xe3d9a2,JSON[_0x1ec8('0xf')](_0x47e6d9));_0x362ce4(_0x47e6d9);})[_0x1ec8('0x14')](function(_0x242f1a){logger[_0x1ec8('0x10')](_0x1ec8('0x4a'),_0x242f1a[_0x1ec8('0x12')],_0xe3d9a2);_0x96184b(_0x50b737[_0x1ec8('0x10')](0x1f4,_0x242f1a[_0x1ec8('0x12')]));});});}; \ No newline at end of file +var _0x6be1=['`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','name','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','raw','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0x15930e,_0x33812b){var _0x36093a=function(_0x4729aa){while(--_0x4729aa){_0x15930e['push'](_0x15930e['shift']());}};_0x36093a(++_0x33812b);}(_0x6be1,0x12f));var _0x16be=function(_0xea76e7,_0x2444d1){_0xea76e7=_0xea76e7-0x0;var _0x8525f9=_0x6be1[_0xea76e7];return _0x8525f9;};'use strict';var _=require(_0x16be('0x0'));var util=require(_0x16be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16be('0x2'))['db'];var utils=require(_0x16be('0x3'));var logger=require(_0x16be('0x4'))(_0x16be('0x5'));var config=require(_0x16be('0x6'));var jayson=require(_0x16be('0x7'));var client=jayson[_0x16be('0x8')][_0x16be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f6c26,_0x1c5e94,_0x4eaedb){return new BPromise(function(_0x36438c,_0x32ff9a){return client[_0x16be('0xa')](_0x2f6c26,_0x4eaedb)[_0x16be('0xb')](function(_0x1a820e){logger[_0x16be('0xc')](_0x16be('0xd'),_0x1c5e94,_0x16be('0xe'));logger[_0x16be('0xf')](_0x16be('0x10'),_0x1c5e94,_0x16be('0xe'),JSON[_0x16be('0x11')](_0x1a820e));if(_0x1a820e[_0x16be('0x12')]){if(_0x1a820e[_0x16be('0x12')][_0x16be('0x13')]===0x1f4){logger[_0x16be('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x1c5e94,_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);return _0x32ff9a(_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);}logger[_0x16be('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x1c5e94,_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);return _0x36438c(_0x1a820e['error'][_0x16be('0x14')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x1c5e94,'request\x20sent');_0x36438c(_0x1a820e[_0x16be('0x15')][_0x16be('0x14')]);}})[_0x16be('0x16')](function(_0x5e8eeb){logger[_0x16be('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x1c5e94,_0x5e8eeb);_0x32ff9a(_0x5e8eeb);});});}exports[_0x16be('0x17')]=function(_0x173da3){var _0x10ee4e=this;return new Promise(function(_0x26d381,_0x47d49d){return db[_0x16be('0x18')][_0x16be('0x19')](_0x173da3['body'],{'raw':_0x173da3[_0x16be('0x1a')]?_0x173da3[_0x16be('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x16be('0xb')](function(_0xac15db){logger['info'](_0x16be('0x17'),_0x173da3);logger[_0x16be('0xf')]('CreateCmHopperHistory',_0x173da3,JSON['stringify'](_0xac15db));_0x26d381(_0xac15db);})[_0x16be('0x16')](function(_0xd99f60){logger['error'](_0x16be('0x17'),_0xd99f60[_0x16be('0x14')],_0x173da3);_0x47d49d(_0x10ee4e[_0x16be('0x12')](0x1f4,_0xd99f60[_0x16be('0x14')]));});});};exports['AvgHandleTime']=function(_0x71a798){var _0x4525a2=this;return new Promise(function(_0x4c6c3a,_0x14ba98){return db['CmHopperHistory']['findAll']({'raw':_0x71a798[_0x16be('0x1a')]?_0x71a798[_0x16be('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x71a798[_0x16be('0x1a')]?_0x71a798[_0x16be('0x1a')][_0x16be('0x1b')]||null:null,'attributes':[[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')][_0x16be('0x1e')]('id')),_0x16be('0x1f')],[db['sequelize']['fn'](_0x16be('0x1d'),db['sequelize']['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')](_0x16be('0x21')))),_0x16be('0x22')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x16be('0x20')](_0x16be('0x23')))),_0x16be('0x24')],[db[_0x16be('0x1c')]['fn']('COUNT',db[_0x16be('0x1c')]['fn']('IF',db['sequelize'][_0x16be('0x20')](_0x16be('0x25')))),_0x16be('0x26')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x27'),db[_0x16be('0x1c')]['fn']('IF',db['sequelize'][_0x16be('0x20')](_0x16be('0x28')))),_0x16be('0x29')],[db['sequelize']['fn']('AVG',db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')](_0x16be('0x2a')))),_0x16be('0x2b')]]})[_0x16be('0xb')](function(_0x24d842){logger['info']('AvgHandleTime',_0x71a798);logger[_0x16be('0xf')](_0x16be('0x2c'),_0x71a798,JSON[_0x16be('0x11')](_0x24d842));_0x4c6c3a(_0x24d842);})[_0x16be('0x16')](function(_0x49246b){logger[_0x16be('0x12')](_0x16be('0x2c'),_0x49246b[_0x16be('0x14')],_0x71a798);_0x14ba98(_0x4525a2[_0x16be('0x12')](0x1f4,_0x49246b['message']));});});};exports[_0x16be('0x2d')]=function(_0x4a11a2){var _0x56e0c7=this;return new Promise(function(_0x38f3d1,_0x1a215c){return db['CmHopperHistory'][_0x16be('0x2e')]({'raw':_0x4a11a2[_0x16be('0x1a')]?_0x4a11a2[_0x16be('0x1a')][_0x16be('0x2f')]===undefined?!![]:![]:!![],'where':_0x4a11a2[_0x16be('0x1a')]?_0x4a11a2['options'][_0x16be('0x1b')]||null:null,'attributes':[['campaign','name'],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db['sequelize'][_0x16be('0x20')](_0x16be('0x30')))),'outboundNoSuchCallsDay'],[db[_0x16be('0x1c')]['fn']('COUNT',db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')](_0x16be('0x31')))),_0x16be('0x32')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x16be('0x33')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db['sequelize']['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')](_0x16be('0x34')))),'outboundBusyCallsDay'],[db[_0x16be('0x1c')]['fn']('COUNT',db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')]['literal'](_0x16be('0x35')))),'outboundCongestionCallsDay'],[db[_0x16be('0x1c')]['fn']('COUNT',db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x16be('0x36')],[db['sequelize']['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db['sequelize'][_0x16be('0x20')](_0x16be('0x37')))),_0x16be('0x38')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')]['literal'](_0x16be('0x39')))),_0x16be('0x3a')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db['sequelize'][_0x16be('0x20')](_0x16be('0x3b')))),_0x16be('0x3c')],[db[_0x16be('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')](_0x16be('0x3d')))),_0x16be('0x3e')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')]['literal'](_0x16be('0x3f')))),_0x16be('0x40')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')](_0x16be('0x41')))),_0x16be('0x3e')],[db[_0x16be('0x1c')]['fn']('COUNT',db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')](_0x16be('0x42')))),'outboundReCallsDay']],'group':[_0x16be('0x43')]})[_0x16be('0xb')](function(_0x2897b1){logger[_0x16be('0xc')](_0x16be('0x2d'),_0x4a11a2);logger[_0x16be('0xf')]('GetVoiceQueueHopperHistory',_0x4a11a2,JSON[_0x16be('0x11')](_0x2897b1));_0x38f3d1(_0x2897b1);})['catch'](function(_0x189522){logger[_0x16be('0x12')]('GetVoiceQueueHopperHistory',_0x189522['message'],_0x4a11a2);_0x1a215c(_0x56e0c7['error'](0x1f4,_0x189522['message']));});});};exports['GetCampaignHopperHistory']=function(_0x5728ba){var _0x163913=this;return new Promise(function(_0x558b76,_0x1d6436){return db['CmHopperHistory'][_0x16be('0x2e')]({'raw':_0x5728ba['options']?_0x5728ba[_0x16be('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5728ba[_0x16be('0x1a')]?_0x5728ba[_0x16be('0x1a')][_0x16be('0x1b')]||null:null,'attributes':[[_0x16be('0x43'),_0x16be('0x44')],[db[_0x16be('0x1c')]['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')][_0x16be('0x1e')]('id')),_0x16be('0x45')],[db['sequelize']['fn'](_0x16be('0x1d'),db[_0x16be('0x1c')]['fn']('IF',db[_0x16be('0x1c')][_0x16be('0x20')](_0x16be('0x21')))),_0x16be('0x46')]],'group':[_0x16be('0x43')]})[_0x16be('0xb')](function(_0xe5c135){logger[_0x16be('0xc')](_0x16be('0x47'),_0x5728ba);logger[_0x16be('0xf')](_0x16be('0x47'),_0x5728ba,JSON[_0x16be('0x11')](_0xe5c135));_0x558b76(_0xe5c135);})[_0x16be('0x16')](function(_0x1f844d){logger[_0x16be('0x12')]('GetCampaignHopperHistory',_0x1f844d[_0x16be('0x14')],_0x5728ba);_0x1d6436(_0x163913[_0x16be('0x12')](0x1f4,_0x1f844d[_0x16be('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 684b0d7..0a4bb9f 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 _0x0dab=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','show','create','put','exports','multer','util','path','connect-timeout','Router'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x0dab,0xc7));var _0xb0da=function(_0x1d7c77,_0x42aa27){_0x1d7c77=_0x1d7c77-0x0;var _0x38263e=_0x0dab[_0x1d7c77];return _0x38263e;};'use strict';var multer=require(_0xb0da('0x0'));var util=require(_0xb0da('0x1'));var path=require(_0xb0da('0x2'));var timeout=require(_0xb0da('0x3'));var express=require('express');var router=express[_0xb0da('0x4')]();var fs_extra=require(_0xb0da('0x5'));var auth=require(_0xb0da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb0da('0x7'));var controller=require(_0xb0da('0x8'));router[_0xb0da('0x9')]('/',auth[_0xb0da('0xa')](),controller[_0xb0da('0xb')]);router[_0xb0da('0x9')]('/describe',auth[_0xb0da('0xa')](),controller[_0xb0da('0xc')]);router[_0xb0da('0x9')]('/:id',auth[_0xb0da('0xa')](),controller[_0xb0da('0xd')]);router['post']('/',auth[_0xb0da('0xa')](),controller[_0xb0da('0xe')]);router[_0xb0da('0xf')]('/:id',auth[_0xb0da('0xa')](),controller['update']);module[_0xb0da('0x10')]=router; \ No newline at end of file +var _0x9f1b=['../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3c391f,_0x2163ce){var _0x5c0b55=function(_0x72a8b8){while(--_0x72a8b8){_0x3c391f['push'](_0x3c391f['shift']());}};_0x5c0b55(++_0x2163ce);}(_0x9f1b,0x1bc));var _0xb9f1=function(_0x30458a,_0x545963){_0x30458a=_0x30458a-0x0;var _0x1bd192=_0x9f1b[_0x30458a];return _0x1bd192;};'use strict';var multer=require('multer');var util=require(_0xb9f1('0x0'));var path=require(_0xb9f1('0x1'));var timeout=require(_0xb9f1('0x2'));var express=require(_0xb9f1('0x3'));var router=express[_0xb9f1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb9f1('0x5'));var interaction=require(_0xb9f1('0x6'));var config=require(_0xb9f1('0x7'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb9f1('0x8')]);router['get'](_0xb9f1('0x9'),auth[_0xb9f1('0xa')](),controller[_0xb9f1('0xb')]);router['get'](_0xb9f1('0xc'),auth[_0xb9f1('0xa')](),controller[_0xb9f1('0xd')]);router[_0xb9f1('0xe')]('/',auth[_0xb9f1('0xa')](),controller['create']);router[_0xb9f1('0xf')](_0xb9f1('0xc'),auth['isAuthenticated'](),controller[_0xb9f1('0x10')]);module[_0xb9f1('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 e32c9b6..5b4ff38 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 _0xe599=['name','sequelize','exports','STRING'];(function(_0x20fbd5,_0x548e19){var _0x1bf745=function(_0x1ff7c3){while(--_0x1ff7c3){_0x20fbd5['push'](_0x20fbd5['shift']());}};_0x1bf745(++_0x548e19);}(_0xe599,0x1e5));var _0x9e59=function(_0x3b4678,_0xee215e){_0x3b4678=_0x3b4678-0x0;var _0x4f322b=_0xe599[_0x3b4678];return _0x4f322b;};'use strict';var Sequelize=require(_0x9e59('0x0'));module[_0x9e59('0x1')]={'name':{'type':Sequelize[_0x9e59('0x2')],'unique':_0x9e59('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9e59('0x2')]},'dialPrefix':{'type':Sequelize[_0x9e59('0x2')]}}; \ No newline at end of file +var _0xe799=['sequelize','STRING'];(function(_0x309f8d,_0x2b7314){var _0x19ccf7=function(_0x4c45bd){while(--_0x4c45bd){_0x309f8d['push'](_0x309f8d['shift']());}};_0x19ccf7(++_0x2b7314);}(_0xe799,0x170));var _0x9e79=function(_0x2a0aa9,_0x24f3d0){_0x2a0aa9=_0x2a0aa9-0x0;var _0x5163fc=_0xe799[_0x2a0aa9];return _0x5163fc;};'use strict';var Sequelize=require(_0x9e79('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e79('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9e79('0x1')]},'dialPrefix':{'type':Sequelize[_0x9e79('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 5b4e784..6c18998 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 _0x50ec=['includeAll','removeDispositions','ids','addContacts','tags','join','push','each','CmContact','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','sequelize','transaction','Sequelize','text','TEXT','number','switch','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','order','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','Lists','UserProfileResource','destroy','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','params','keys','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50ec,0xc9));var _0xc50e=function(_0x58f7ad,_0xc1732a){_0x58f7ad=_0x58f7ad-0x0;var _0x5c96bc=_0x50ec[_0x58f7ad];return _0x5c96bc;};'use strict';var emlformat=require(_0xc50e('0x0'));var rimraf=require(_0xc50e('0x1'));var zipdir=require(_0xc50e('0x2'));var jsonpatch=require(_0xc50e('0x3'));var rp=require(_0xc50e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc50e('0x5'));var util=require('util');var path=require(_0xc50e('0x6'));var sox=require(_0xc50e('0x7'));var csv=require(_0xc50e('0x8'));var ejs=require(_0xc50e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc50e('0xa'));var squel=require(_0xc50e('0xb'));var crypto=require(_0xc50e('0xc'));var jsforce=require(_0xc50e('0xd'));var deskjs=require(_0xc50e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc50e('0xf'));var Redis=require('ioredis');var authService=require(_0xc50e('0x10'));var qs=require(_0xc50e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc50e('0x12'));var logger=require(_0xc50e('0x13'))(_0xc50e('0x14'));var utils=require(_0xc50e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc50e('0x16'));var db=require(_0xc50e('0x17'))['db'];config['redis']=_[_0xc50e('0x18')](config[_0xc50e('0x19')],{'host':_0xc50e('0x1a'),'port':0x18eb});var socket=require(_0xc50e('0x1b'))(new Redis(config[_0xc50e('0x19')]));require('./cmList.socket')[_0xc50e('0x1c')](socket);function respondWithStatusCode(_0x220f32,_0xf17caa){_0xf17caa=_0xf17caa||0xcc;return function(_0x15812d){if(_0x15812d){return _0x220f32[_0xc50e('0x1d')](_0xf17caa);}return _0x220f32[_0xc50e('0x1e')](_0xf17caa)[_0xc50e('0x1f')]();};}function respondWithResult(_0x3e19d9,_0x20172c){_0x20172c=_0x20172c||0xc8;return function(_0x40e9e9){if(_0x40e9e9){return _0x3e19d9['status'](_0x20172c)[_0xc50e('0x20')](_0x40e9e9);}};}function respondWithFilteredResult(_0x58d3ba,_0x3097b2){return function(_0x19bc4c){if(_0x19bc4c){var _0x19b32f=typeof _0x3097b2[_0xc50e('0x21')]===_0xc50e('0x22')&&typeof _0x3097b2['limit']==='undefined';var _0x1f358f=_0x19bc4c[_0xc50e('0x23')];var _0xee4c8f=_0x19b32f?0x0:_0x3097b2[_0xc50e('0x21')];var _0x5c8bc8=_0x19b32f?_0x19bc4c[_0xc50e('0x23')]:_0x3097b2['offset']+_0x3097b2['limit'];var _0x510f92;if(_0x5c8bc8>=_0x1f358f){_0x5c8bc8=_0x1f358f;_0x510f92=0xc8;}else{_0x510f92=0xce;}_0x58d3ba[_0xc50e('0x1e')](_0x510f92);return _0x58d3ba[_0xc50e('0x24')](_0xc50e('0x25'),_0xee4c8f+'-'+_0x5c8bc8+'/'+_0x1f358f)[_0xc50e('0x20')](_0x19bc4c);}return null;};}function patchUpdates(_0x108178){return function(_0x3f01dc){try{jsonpatch[_0xc50e('0x26')](_0x3f01dc,_0x108178,!![]);}catch(_0x24c5ab){return BPromise[_0xc50e('0x27')](_0x24c5ab);}return _0x3f01dc[_0xc50e('0x28')]();};}function saveUpdates(_0x1ec0e7,_0x33f9a7){return function(_0x4ac95a){if(_0x4ac95a){return _0x4ac95a[_0xc50e('0x29')](_0x1ec0e7)[_0xc50e('0x2a')](function(_0x18e52d){return _0x18e52d;});}return null;};}function removeEntity(_0x1659ae,_0x26022a){return function(_0x227040){if(_0x227040){return _0x227040['destroy']()[_0xc50e('0x2a')](function(){var _0x4f7e04=_0x227040['get']({'plain':!![]});var _0xccfd10=_0xc50e('0x2b');return db[_0xc50e('0x2c')][_0xc50e('0x2d')]({'where':{'type':_0xccfd10,'resourceId':_0x4f7e04['id']}})[_0xc50e('0x2a')](function(){return _0x227040;});})['then'](function(){_0x1659ae[_0xc50e('0x1e')](0xcc)[_0xc50e('0x1f')]();});}};}function handleEntityNotFound(_0x2dc769,_0x530d81){return function(_0x15e167){if(!_0x15e167){_0x2dc769[_0xc50e('0x1d')](0x194);}return _0x15e167;};}function handleError(_0x5ec8ab,_0x38f1b4){_0x38f1b4=_0x38f1b4||0x1f4;return function(_0x236846){logger[_0xc50e('0x2e')](_0x236846[_0xc50e('0x2f')]);if(_0x236846['name']){delete _0x236846[_0xc50e('0x30')];}_0x5ec8ab[_0xc50e('0x1e')](_0x38f1b4)[_0xc50e('0x31')](_0x236846);};}exports[_0xc50e('0x32')]=function(_0x360103,_0x55f4bf){var _0x58067d={},_0x56621c={},_0x37e34d={'count':0x0,'rows':[]};var _0x2019d6=_['map'](db[_0xc50e('0x33')][_0xc50e('0x34')],function(_0x43b658){return{'name':_0x43b658[_0xc50e('0x35')],'type':_0x43b658[_0xc50e('0x36')][_0xc50e('0x37')]};});_0x56621c[_0xc50e('0x38')]=_[_0xc50e('0x39')](_0x2019d6,'name');_0x56621c[_0xc50e('0x3a')]=_['keys'](_0x360103[_0xc50e('0x3a')]);_0x56621c[_0xc50e('0x3b')]=_[_0xc50e('0x3c')](_0x56621c['model'],_0x56621c[_0xc50e('0x3a')]);_0x58067d[_0xc50e('0x3d')]=_[_0xc50e('0x3c')](_0x56621c[_0xc50e('0x38')],qs[_0xc50e('0x3e')](_0x360103[_0xc50e('0x3a')][_0xc50e('0x3e')]));_0x58067d[_0xc50e('0x3d')]=_0x58067d[_0xc50e('0x3d')][_0xc50e('0x3f')]?_0x58067d[_0xc50e('0x3d')]:_0x56621c[_0xc50e('0x38')];if(!_0x360103[_0xc50e('0x3a')][_0xc50e('0x40')](_0xc50e('0x41'))){_0x58067d['limit']=qs[_0xc50e('0x42')](_0x360103[_0xc50e('0x3a')][_0xc50e('0x42')]);_0x58067d['offset']=qs[_0xc50e('0x21')](_0x360103['query'][_0xc50e('0x21')]);}_0x58067d['order']=qs[_0xc50e('0x43')](_0x360103[_0xc50e('0x3a')][_0xc50e('0x43')]);_0x58067d['where']=qs[_0xc50e('0x3b')](_['pick'](_0x360103[_0xc50e('0x3a')],_0x56621c[_0xc50e('0x3b')]),_0x2019d6);if(_0x360103[_0xc50e('0x3a')][_0xc50e('0x44')]){_0x58067d[_0xc50e('0x45')]=_[_0xc50e('0x46')](_0x58067d[_0xc50e('0x45')],{'$or':_[_0xc50e('0x39')](_0x2019d6,function(_0xea42e4){if(_0xea42e4[_0xc50e('0x36')]!==_0xc50e('0x47')){var _0x1269d3={};_0x1269d3[_0xea42e4[_0xc50e('0x30')]]={'$like':'%'+_0x360103['query'][_0xc50e('0x44')]+'%'};return _0x1269d3;}})});}_0x58067d=_[_0xc50e('0x46')]({},_0x58067d,_0x360103[_0xc50e('0x48')]);var _0x369b81={'where':_0x58067d[_0xc50e('0x45')]};return db[_0xc50e('0x33')][_0xc50e('0x23')](_0x369b81)['then'](function(_0x121ad0){_0x37e34d[_0xc50e('0x23')]=_0x121ad0;if(_0x360103[_0xc50e('0x3a')]['includeAll']){_0x58067d[_0xc50e('0x49')]=[{'all':!![]}];}return db['CmList'][_0xc50e('0x4a')](_0x58067d);})[_0xc50e('0x2a')](function(_0xaea724){_0x37e34d['rows']=_0xaea724;return _0x37e34d;})[_0xc50e('0x2a')](respondWithFilteredResult(_0x55f4bf,_0x58067d))[_0xc50e('0x4b')](handleError(_0x55f4bf,null));};exports['show']=function(_0x595f59,_0x4ceda5){var _0x2b7015={'raw':![],'where':{'id':_0x595f59[_0xc50e('0x4c')]['id']}},_0x1426ab={};_0x1426ab['model']=_[_0xc50e('0x4d')](db[_0xc50e('0x33')][_0xc50e('0x34')]);_0x1426ab['query']=_[_0xc50e('0x4d')](_0x595f59['query']);_0x1426ab[_0xc50e('0x3b')]=_[_0xc50e('0x3c')](_0x1426ab[_0xc50e('0x38')],_0x1426ab['query']);_0x2b7015[_0xc50e('0x3d')]=_[_0xc50e('0x3c')](_0x1426ab['model'],qs[_0xc50e('0x3e')](_0x595f59[_0xc50e('0x3a')]['fields']));_0x2b7015['attributes']=_0x2b7015[_0xc50e('0x3d')][_0xc50e('0x3f')]?_0x2b7015[_0xc50e('0x3d')]:_0x1426ab['model'];if(_0x595f59[_0xc50e('0x3a')]['includeAll']){_0x2b7015[_0xc50e('0x49')]=[{'all':!![]}];}_0x2b7015=_[_0xc50e('0x46')]({},_0x2b7015,_0x595f59[_0xc50e('0x48')]);return db[_0xc50e('0x33')][_0xc50e('0x4e')](_0x2b7015)[_0xc50e('0x2a')](handleEntityNotFound(_0x4ceda5,null))[_0xc50e('0x2a')](respondWithResult(_0x4ceda5,null))[_0xc50e('0x4b')](handleError(_0x4ceda5,null));};exports['create']=function(_0x35c0ae,_0x3d898b){return db[_0xc50e('0x33')][_0xc50e('0x4f')](_0x35c0ae[_0xc50e('0x50')],{})['then'](function(_0xdb89e0){var _0x2b57b1=_0x35c0ae[_0xc50e('0x51')][_0xc50e('0x52')]({'plain':!![]});if(!_0x2b57b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b57b1[_0xc50e('0x53')]===_0xc50e('0x51')){var _0x23bcfb=_0xdb89e0[_0xc50e('0x52')]({'plain':!![]});var _0x24417=_0xc50e('0x2b');return db[_0xc50e('0x54')][_0xc50e('0x4e')]({'where':{'name':_0x24417,'userProfileId':_0x2b57b1[_0xc50e('0x55')]},'raw':!![]})[_0xc50e('0x2a')](function(_0x257274){if(_0x257274&&_0x257274[_0xc50e('0x56')]===0x0){return db[_0xc50e('0x2c')][_0xc50e('0x4f')]({'name':_0x23bcfb[_0xc50e('0x30')],'resourceId':_0x23bcfb['id'],'type':_0x257274[_0xc50e('0x30')],'sectionId':_0x257274['id']},{})[_0xc50e('0x2a')](function(){return _0xdb89e0;});}else{return _0xdb89e0;}})[_0xc50e('0x4b')](function(_0x2a88b7){logger[_0xc50e('0x2e')](_0xc50e('0x57'),_0x2a88b7);throw _0x2a88b7;});}return _0xdb89e0;})[_0xc50e('0x2a')](respondWithResult(_0x3d898b,0xc9))[_0xc50e('0x4b')](handleError(_0x3d898b,null));};exports['update']=function(_0x19ad74,_0x12c389){if(_0x19ad74['body']['id']){delete _0x19ad74['body']['id'];}return db[_0xc50e('0x33')]['find']({'where':{'id':_0x19ad74['params']['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x12c389,null))[_0xc50e('0x2a')](saveUpdates(_0x19ad74['body'],null))[_0xc50e('0x2a')](respondWithResult(_0x12c389,null))['catch'](handleError(_0x12c389,null));};exports['destroy']=function(_0x2d2165,_0x130ff2){return db[_0xc50e('0x33')]['find']({'where':{'id':_0x2d2165['params']['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x130ff2,null))[_0xc50e('0x2a')](removeEntity(_0x130ff2,null))[_0xc50e('0x4b')](handleError(_0x130ff2,null));};exports[_0xc50e('0x58')]=function(_0x1c3057,_0xddd0e0){return db['CmList'][_0xc50e('0x58')]()['then'](respondWithResult(_0xddd0e0,null))[_0xc50e('0x4b')](handleError(_0xddd0e0,null));};exports[_0xc50e('0x59')]=function(_0x570c5b,_0x372782,_0x502a08){if(_0x570c5b['body']['id']){delete _0x570c5b[_0xc50e('0x50')]['id'];}return db['CmList']['find']({'where':{'id':_0x570c5b[_0xc50e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x372782,null))[_0xc50e('0x2a')](function(_0x1bce5b){if(_0x1bce5b){_0x570c5b['body'][_0xc50e('0x5a')]=_0x1bce5b['id'];return db[_0xc50e('0x5b')][_0xc50e('0x4f')](_0x570c5b['body']);}})['then'](respondWithResult(_0x372782,null))[_0xc50e('0x4b')](handleError(_0x372782,null));};exports[_0xc50e('0x5c')]=function(_0x1897af,_0x3232d0,_0x4c737f){var _0x1fc1af={'raw':![],'where':{}};var _0x431ee1={};var _0x3b41b1={'count':0x0,'rows':[]};return db[_0xc50e('0x33')][_0xc50e('0x5d')]({'where':{'id':_0x1897af[_0xc50e('0x4c')]['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x3232d0,null))[_0xc50e('0x2a')](function(_0x2d65f1){if(_0x2d65f1){_0x431ee1[_0xc50e('0x38')]=_['keys'](db[_0xc50e('0x5b')]['rawAttributes']);_0x431ee1[_0xc50e('0x3a')]=_['keys'](_0x1897af[_0xc50e('0x3a')]);_0x431ee1[_0xc50e('0x3b')]=_[_0xc50e('0x3c')](_0x431ee1['model'],_0x431ee1['query']);_0x1fc1af['attributes']=_['intersection'](_0x431ee1[_0xc50e('0x38')],qs['fields'](_0x1897af[_0xc50e('0x3a')][_0xc50e('0x3e')]));_0x1fc1af[_0xc50e('0x3d')]=_0x1fc1af[_0xc50e('0x3d')][_0xc50e('0x3f')]?_0x1fc1af[_0xc50e('0x3d')]:_0x431ee1[_0xc50e('0x38')];if(!_0x1897af[_0xc50e('0x3a')][_0xc50e('0x40')]('nolimit')){_0x1fc1af[_0xc50e('0x42')]=qs[_0xc50e('0x42')](_0x1897af[_0xc50e('0x3a')][_0xc50e('0x42')]);_0x1fc1af['offset']=qs[_0xc50e('0x21')](_0x1897af[_0xc50e('0x3a')][_0xc50e('0x21')]);}_0x1fc1af['order']=qs[_0xc50e('0x43')](_0x1897af[_0xc50e('0x3a')][_0xc50e('0x43')]);_0x1fc1af['where']=qs[_0xc50e('0x3b')](_[_0xc50e('0x5e')](_0x1897af[_0xc50e('0x3a')],_0x431ee1[_0xc50e('0x3b')]));_0x1fc1af[_0xc50e('0x45')][_0xc50e('0x5a')]=_0x2d65f1['id'];if(_0x1897af['query'][_0xc50e('0x44')]){_0x1fc1af[_0xc50e('0x45')]=_[_0xc50e('0x46')](_0x1fc1af[_0xc50e('0x45')],{'$or':_[_0xc50e('0x39')](_0x1fc1af[_0xc50e('0x3d')],function(_0x423df3){var _0x5958eb={};_0x5958eb[_0x423df3]={'$like':'%'+_0x1897af[_0xc50e('0x3a')]['filter']+'%'};return _0x5958eb;})});}_0x1fc1af=_[_0xc50e('0x46')]({},_0x1fc1af,_0x1897af['options']);return db[_0xc50e('0x5b')][_0xc50e('0x23')]({'where':_0x1fc1af['where']})[_0xc50e('0x2a')](function(_0x32bc0c){_0x3b41b1['count']=_0x32bc0c;if(_0x1897af[_0xc50e('0x3a')][_0xc50e('0x5f')]){_0x1fc1af[_0xc50e('0x49')]=[{'all':!![]}];}return db[_0xc50e('0x5b')][_0xc50e('0x4a')](_0x1fc1af);})[_0xc50e('0x2a')](function(_0xb3129b){_0x3b41b1['rows']=_0xb3129b;return _0x3b41b1;});}})[_0xc50e('0x2a')](respondWithFilteredResult(_0x3232d0,_0x1fc1af))[_0xc50e('0x4b')](handleError(_0x3232d0,null));};exports[_0xc50e('0x60')]=function(_0x2db9a1,_0x546f82,_0x21c160){return db[_0xc50e('0x33')][_0xc50e('0x4e')]({'where':{'id':_0x2db9a1[_0xc50e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x546f82,null))['then'](function(_0x24b089){if(_0x24b089){return _0x24b089['removeDispositions'](_0x2db9a1[_0xc50e('0x3a')][_0xc50e('0x61')]);}})['then'](respondWithStatusCode(_0x546f82,null))['catch'](handleError(_0x546f82,null));};exports[_0xc50e('0x62')]=function(_0x5320b3,_0x21b513,_0x590bee){return db['CmList'][_0xc50e('0x4e')]({'where':{'id':_0x5320b3[_0xc50e('0x4c')]['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x21b513,null))[_0xc50e('0x2a')](function(_0x491211){if(_0x491211){var _0x17893d=[];var _0x5151e9={'success':[],'errors':[]};return db['CmContact'][_0xc50e('0x58')]()[_0xc50e('0x2a')](function(_0x61fe9e){if(_0x5320b3[_0xc50e('0x50')][_0xc50e('0x63')]&&_['isArray'](_0x5320b3[_0xc50e('0x50')][_0xc50e('0x63')])){if(_0x5320b3[_0xc50e('0x50')][_0xc50e('0x63')][_0xc50e('0x3f')]){_0x5320b3['body'][_0xc50e('0x63')]=_0x5320b3['body']['tags'][_0xc50e('0x64')](';')+';';}else{_0x5320b3['body'][_0xc50e('0x63')]=null;}}else{_0x5320b3[_0xc50e('0x50')][_0xc50e('0x63')]=null;}if(_0x5320b3['body']&&_['isArray'](_0x5320b3[_0xc50e('0x50')])){for(var _0x3274f5=0x0;_0x3274f5<_0x5320b3[_0xc50e('0x50')][_0xc50e('0x3f')];_0x3274f5+=0x1){_0x5320b3[_0xc50e('0x50')][_0x3274f5][_0xc50e('0x5a')]=_0x5320b3[_0xc50e('0x4c')]['id'];_0x17893d[_0xc50e('0x65')](_0x5320b3['body'][_0x3274f5]);}return BPromise[_0xc50e('0x66')](_0x17893d,function(_0x41d221){return db[_0xc50e('0x67')]['create'](_[_0xc50e('0x68')](_0x41d221,[_0xc50e('0x61'),'id'])||{},{'fields':_[_0xc50e('0x4d')](_0x61fe9e),'raw':!![]})['then'](function(_0xc7532d){_0x5151e9[_0xc50e('0x69')][_0xc50e('0x65')](_0xc7532d['dataValues']);})[_0xc50e('0x4b')](function(_0x27db99){_0x5151e9[_0xc50e('0x6a')][_0xc50e('0x65')]({'data':_0x41d221,'error':_0x27db99[_0xc50e('0x6b')]});});})[_0xc50e('0x2a')](function(_0x4f1b87){return _0x5151e9;})['catch'](function(_0x49ff15){return _0x49ff15;});}else{_0x21b513[_0xc50e('0x1e')](0x190)['json']({'message':_0xc50e('0x6c')});}});}})[_0xc50e('0x2a')](respondWithResult(_0x21b513,null))[_0xc50e('0x4b')](handleError(_0x21b513,null));};exports[_0xc50e('0x6d')]=function(_0x4c0693,_0x152412,_0xedfb0a){var _0x12bc67;return db['CmList'][_0xc50e('0x4e')]({'where':{'id':_0x4c0693[_0xc50e('0x4c')]['id']},'include':[{'model':db[_0xc50e('0x6e')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x152412,null))[_0xc50e('0x2a')](function(_0x4f6ad3){if(_0x4f6ad3){_0x12bc67=_0x4f6ad3;return db[_0xc50e('0x67')][_0xc50e('0x34')];}})[_0xc50e('0x2a')](function(_0x1692bb){if(_0x1692bb){var _0x2ed6cc={};var _0x4b2527={};_0x4b2527[_0xc50e('0x38')]=_[_0xc50e('0x6f')](_['keys'](_0x1692bb),_[_0xc50e('0x39')](_0x12bc67[_0xc50e('0x70')],function(_0x341e7e){return util[_0xc50e('0x71')](_0xc50e('0x72'),_0x341e7e['id']);}));_0x4b2527[_0xc50e('0x3a')]=_['keys'](_0x4c0693[_0xc50e('0x3a')]);_0x4b2527[_0xc50e('0x3b')]=_['intersection'](_0x4b2527[_0xc50e('0x38')],_0x4b2527[_0xc50e('0x3a')]);_0x2ed6cc[_0xc50e('0x3d')]=_[_0xc50e('0x3c')](_0x4b2527[_0xc50e('0x38')],qs['fields'](_0x4c0693[_0xc50e('0x3a')]['fields']));_0x2ed6cc[_0xc50e('0x3d')]=_0x2ed6cc['attributes'][_0xc50e('0x3f')]?_0x2ed6cc[_0xc50e('0x3d')]:_0x4b2527[_0xc50e('0x38')];if(!_0x4c0693[_0xc50e('0x3a')][_0xc50e('0x40')](_0xc50e('0x41'))){_0x2ed6cc[_0xc50e('0x42')]=qs[_0xc50e('0x42')](_0x4c0693['query'][_0xc50e('0x42')]);_0x2ed6cc[_0xc50e('0x21')]=qs[_0xc50e('0x21')](_0x4c0693[_0xc50e('0x3a')][_0xc50e('0x21')]);}_0x2ed6cc['order']=qs['sort'](_0x4c0693[_0xc50e('0x3a')][_0xc50e('0x43')]);_0x2ed6cc[_0xc50e('0x45')]=qs[_0xc50e('0x3b')](_['pick'](_0x4c0693[_0xc50e('0x3a')],_0x4b2527[_0xc50e('0x3b')]));_0x2ed6cc['raw']=!![];if(_0x4c0693[_0xc50e('0x3a')][_0xc50e('0x44')]){_0x2ed6cc[_0xc50e('0x45')]=_[_0xc50e('0x46')](_0x2ed6cc[_0xc50e('0x45')],{'$or':_[_0xc50e('0x39')](_0x2ed6cc[_0xc50e('0x3d')],function(_0x54de43){var _0x54d9cc={};_0x54d9cc[_0x54de43]={'$like':'%'+_0x4c0693[_0xc50e('0x3a')]['filter']+'%'};return _0x54d9cc;})});}_0x2ed6cc=_['merge']({},_0x2ed6cc,_0x4c0693[_0xc50e('0x48')]);return _0x12bc67[_0xc50e('0x6d')](_0x2ed6cc);}})[_0xc50e('0x2a')](respondWithResult(_0x152412,null))[_0xc50e('0x4b')](handleError(_0x152412,null));};exports[_0xc50e('0x73')]=function(_0x7605c7,_0x229cc1,_0x2b7433){var _0x20504f;return db[_0xc50e('0x33')][_0xc50e('0x4e')]({'where':{'id':_0x7605c7['params']['id']},'include':[{'model':db[_0xc50e('0x6e')],'as':_0xc50e('0x70')}]})[_0xc50e('0x2a')](handleEntityNotFound(_0x229cc1,null))[_0xc50e('0x2a')](function(_0x3bd2b5){if(_0x3bd2b5){_0x20504f=_0x3bd2b5;return db[_0xc50e('0x67')][_0xc50e('0x34')];}})[_0xc50e('0x2a')](function(_0x174ce8){if(_0x174ce8){var _0x1cc093={};var _0x3bbeb6={};_0x3bbeb6['model']=_[_0xc50e('0x6f')](_['keys'](_0x174ce8),_[_0xc50e('0x39')](_0x20504f[_0xc50e('0x70')],function(_0x24659b){return util[_0xc50e('0x71')](_0xc50e('0x72'),_0x24659b['id']);}));_0x3bbeb6[_0xc50e('0x3a')]=_[_0xc50e('0x4d')](_0x7605c7[_0xc50e('0x3a')]);_0x3bbeb6[_0xc50e('0x3b')]=_['intersection'](_0x3bbeb6[_0xc50e('0x38')],_0x3bbeb6[_0xc50e('0x3a')]);_0x1cc093[_0xc50e('0x3d')]=_[_0xc50e('0x3c')](_0x3bbeb6['model'],qs[_0xc50e('0x3e')](_0x7605c7['query'][_0xc50e('0x3e')]));_0x1cc093['attributes']=_0x1cc093[_0xc50e('0x3d')][_0xc50e('0x3f')]?_0x1cc093['attributes']:_0x3bbeb6[_0xc50e('0x38')];if(!_0x7605c7[_0xc50e('0x3a')]['hasOwnProperty'](_0xc50e('0x41'))){_0x1cc093[_0xc50e('0x42')]=qs[_0xc50e('0x42')](_0x7605c7[_0xc50e('0x3a')][_0xc50e('0x42')]);_0x1cc093[_0xc50e('0x21')]=qs[_0xc50e('0x21')](_0x7605c7[_0xc50e('0x3a')]['offset']);}_0x1cc093['order']=qs[_0xc50e('0x43')](_0x7605c7[_0xc50e('0x3a')][_0xc50e('0x43')]);_0x1cc093[_0xc50e('0x45')]=qs['filters'](_['pick'](_0x7605c7[_0xc50e('0x3a')],_0x3bbeb6['filters']));_0x1cc093['raw']=!![];if(_0x7605c7[_0xc50e('0x3a')][_0xc50e('0x44')]){_0x1cc093[_0xc50e('0x45')]=_[_0xc50e('0x46')](_0x1cc093[_0xc50e('0x45')],{'$or':_[_0xc50e('0x39')](_0x1cc093['attributes'],function(_0x3ac0b5){var _0x2b6d8a={};_0x2b6d8a[_0x3ac0b5]={'$like':'%'+_0x7605c7[_0xc50e('0x3a')][_0xc50e('0x44')]+'%'};return _0x2b6d8a;})});}_0x1cc093=_[_0xc50e('0x46')]({},_0x1cc093,_0x7605c7['options']);return _0x20504f[_0xc50e('0x6d')](_0x1cc093);}})[_0xc50e('0x2a')](function(_0x486811){if(!_[_0xc50e('0x74')](_0x486811)){var _0x2e87db=toCsv(_0x486811);var _0x1f104d=Date[_0xc50e('0x75')]();fs[_0xc50e('0x76')](util['format'](_0xc50e('0x77'),_0x20504f['id'],_0x1f104d),_0x2e87db);_0x229cc1[_0xc50e('0x78')](_0xc50e('0x79'),_0xc50e('0x7a')+util[_0xc50e('0x71')]('list_%d_%s.csv',_0x20504f['id'],_0x1f104d));_0x229cc1[_0xc50e('0x78')](_0xc50e('0x7b'),_0xc50e('0x7c'));return _0x229cc1[_0xc50e('0x7d')](util['format'](_0xc50e('0x77'),_0x20504f['id'],_0x1f104d));}else{return _0x229cc1[_0xc50e('0x1d')](0xcc);}})[_0xc50e('0x4b')](handleError(_0x229cc1,null));};exports['addCustomField']=function(_0x33a3eb,_0x46721f,_0x221b81){var _0x19c6b0;delete _0x33a3eb[_0xc50e('0x50')]['id'];return db[_0xc50e('0x33')][_0xc50e('0x5d')]({'where':{'id':_0x33a3eb[_0xc50e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46721f,null))[_0xc50e('0x2a')](function(_0x2da140){if(_0x2da140){return db[_0xc50e('0x7e')][_0xc50e('0x7f')](function(_0x58cc63){return db['CmCustomField'][_0xc50e('0x4f')](_0x33a3eb[_0xc50e('0x50')],{'transaction':_0x58cc63})[_0xc50e('0x2a')](function(_0x103071){_0x19c6b0=_0x103071;return _0x2da140['addCustomFields'](_0x103071,{'transaction':_0x58cc63});})['then'](function(){var _0x378fe3={'type':db[_0xc50e('0x80')]['TEXT'],'transaction':_0x58cc63};switch(_0x33a3eb[_0xc50e('0x50')][_0xc50e('0x36')]){case _0xc50e('0x81'):_0x378fe3[_0xc50e('0x36')]=db[_0xc50e('0x80')][_0xc50e('0x82')];break;case _0xc50e('0x83'):_0x378fe3[_0xc50e('0x36')]=db['Sequelize']['INTEGER'];break;case _0xc50e('0x84'):_0x378fe3[_0xc50e('0x36')]=db[_0xc50e('0x80')]['BOOLEAN'];_0x378fe3[_0xc50e('0x85')]=![];break;default:}return db['sequelize']['queryInterface'][_0xc50e('0x86')](_0xc50e('0x87'),util['format'](_0xc50e('0x88'),_0x19c6b0['id']),_0x378fe3);})[_0xc50e('0x2a')](function(){return _0x19c6b0;});});}})['then'](respondWithResult(_0x46721f,null))[_0xc50e('0x4b')](handleError(_0x46721f,null));};exports[_0xc50e('0x89')]=function(_0x25056c,_0xdc211e,_0x58682f){var _0x50d300={};var _0x32b716={};var _0x16afda;var _0xd7f665;return db[_0xc50e('0x33')][_0xc50e('0x5d')]({'where':{'id':_0x25056c[_0xc50e('0x4c')]['id']}})['then'](handleEntityNotFound(_0xdc211e,null))['then'](function(_0x4e3ca5){if(_0x4e3ca5){_0x16afda=_0x4e3ca5;_0x32b716['model']=_[_0xc50e('0x4d')](db[_0xc50e('0x6e')][_0xc50e('0x34')]);_0x32b716[_0xc50e('0x3a')]=_[_0xc50e('0x4d')](_0x25056c[_0xc50e('0x3a')]);_0x32b716[_0xc50e('0x3b')]=_[_0xc50e('0x3c')](_0x32b716['model'],_0x32b716[_0xc50e('0x3a')]);_0x50d300[_0xc50e('0x3d')]=_[_0xc50e('0x3c')](_0x32b716[_0xc50e('0x38')],qs[_0xc50e('0x3e')](_0x25056c['query'][_0xc50e('0x3e')]));_0x50d300[_0xc50e('0x3d')]=_0x50d300[_0xc50e('0x3d')][_0xc50e('0x3f')]?_0x50d300[_0xc50e('0x3d')]:_0x32b716[_0xc50e('0x38')];_0x50d300[_0xc50e('0x8a')]=qs[_0xc50e('0x43')](_0x25056c['query']['sort']);_0x50d300['where']=qs['filters'](_[_0xc50e('0x5e')](_0x25056c[_0xc50e('0x3a')],_0x32b716['filters']));_0x50d300[_0xc50e('0x45')]=_[_0xc50e('0x46')](_0x50d300[_0xc50e('0x45')],{'$or':[{'ListId':_0x4e3ca5['id']},{'ListId':null}]});if(_0x25056c[_0xc50e('0x3a')]['filter']){_0x50d300[_0xc50e('0x45')]=_[_0xc50e('0x46')](_0x50d300[_0xc50e('0x45')],{'$or':_[_0xc50e('0x39')](_0x50d300['attributes'],function(_0xcbbbdd){var _0x3fdc5c={};_0x3fdc5c[_0xcbbbdd]={'$like':'%'+_0x25056c[_0xc50e('0x3a')][_0xc50e('0x44')]+'%'};return _0x3fdc5c;})});}_0x50d300=_[_0xc50e('0x46')]({},_0x50d300,_0x25056c[_0xc50e('0x48')]);return db[_0xc50e('0x6e')][_0xc50e('0x8b')](_0x50d300);}})[_0xc50e('0x2a')](respondWithResult(_0xdc211e,null))[_0xc50e('0x4b')](handleError(_0xdc211e,null));};exports[_0xc50e('0x8c')]=function(_0x2f3454,_0x2d8bbc,_0x589f36){return db[_0xc50e('0x33')][_0xc50e('0x4e')]({'where':{'id':_0x2f3454[_0xc50e('0x4c')]['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x2d8bbc,null))[_0xc50e('0x2a')](function(_0x2b610e){if(_0x2b610e){return _0x2b610e[_0xc50e('0x8c')](_0x2f3454[_0xc50e('0x50')]['ids'],_[_0xc50e('0x68')](_0x2f3454[_0xc50e('0x50')],[_0xc50e('0x61'),'id'])||{})[_0xc50e('0x8d')](function(_0x290f95){for(var _0x35482a=0x0;_0x35482a<_0x2f3454[_0xc50e('0x50')]['ids'][_0xc50e('0x3f')];_0x35482a+=0x1){socket[_0xc50e('0x8e')](_0xc50e('0x8f'),{'UserId':Number(_0x2f3454[_0xc50e('0x50')][_0xc50e('0x61')][_0x35482a]),'CmListId':Number(_0x2f3454[_0xc50e('0x4c')]['id'])});}return _0x290f95;});}})[_0xc50e('0x2a')](respondWithResult(_0x2d8bbc,null))[_0xc50e('0x4b')](handleError(_0x2d8bbc,null));};exports['removeAgents']=function(_0x4e9818,_0x4e00b7,_0x4d43d4){return db['CmList']['find']({'where':{'id':_0x4e9818['params']['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x4e00b7,null))[_0xc50e('0x2a')](function(_0x1aea31){if(_0x1aea31){return _0x1aea31[_0xc50e('0x90')](_0x4e9818[_0xc50e('0x3a')][_0xc50e('0x61')])[_0xc50e('0x2a')](function(){if(_[_0xc50e('0x91')](_0x4e9818['query'][_0xc50e('0x61')])){for(var _0x17cd27=0x0;_0x17cd27<_0x4e9818['query'][_0xc50e('0x61')][_0xc50e('0x3f')];_0x17cd27+=0x1){socket[_0xc50e('0x8e')](_0xc50e('0x92'),{'UserId':Number(_0x4e9818[_0xc50e('0x3a')][_0xc50e('0x61')][_0x17cd27]),'CmListId':Number(_0x4e9818[_0xc50e('0x4c')]['id'])});}}else{socket['emit'](_0xc50e('0x92'),{'UserId':Number(_0x4e9818['query'][_0xc50e('0x61')]),'CmListId':Number(_0x4e9818[_0xc50e('0x4c')]['id'])});}});}})[_0xc50e('0x2a')](respondWithStatusCode(_0x4e00b7,null))[_0xc50e('0x4b')](handleError(_0x4e00b7,null));};exports[_0xc50e('0x93')]=function(_0x5d90b5,_0x2f2cec,_0x17d685){var _0x311b74={};var _0x2a14e6={};var _0x52ab31;var _0x357d93;return db[_0xc50e('0x33')][_0xc50e('0x5d')]({'where':{'id':_0x5d90b5[_0xc50e('0x4c')]['id']}})[_0xc50e('0x2a')](handleEntityNotFound(_0x2f2cec,null))['then'](function(_0x448f97){if(_0x448f97){_0x52ab31=_0x448f97;_0x2a14e6[_0xc50e('0x38')]=_[_0xc50e('0x4d')](db['User'][_0xc50e('0x34')]);_0x2a14e6[_0xc50e('0x3a')]=_[_0xc50e('0x4d')](_0x5d90b5[_0xc50e('0x3a')]);_0x2a14e6[_0xc50e('0x3b')]=_[_0xc50e('0x3c')](_0x2a14e6[_0xc50e('0x38')],_0x2a14e6[_0xc50e('0x3a')]);_0x311b74[_0xc50e('0x3d')]=_[_0xc50e('0x3c')](_0x2a14e6[_0xc50e('0x38')],qs['fields'](_0x5d90b5[_0xc50e('0x3a')][_0xc50e('0x3e')]));_0x311b74[_0xc50e('0x3d')]=_0x311b74[_0xc50e('0x3d')]['length']?_0x311b74[_0xc50e('0x3d')]:_0x2a14e6[_0xc50e('0x38')];_0x311b74[_0xc50e('0x8a')]=qs[_0xc50e('0x43')](_0x5d90b5[_0xc50e('0x3a')][_0xc50e('0x43')]);_0x311b74[_0xc50e('0x45')]=qs[_0xc50e('0x3b')](_['pick'](_0x5d90b5[_0xc50e('0x3a')],_0x2a14e6[_0xc50e('0x3b')]));if(_0x5d90b5[_0xc50e('0x3a')][_0xc50e('0x44')]){_0x311b74[_0xc50e('0x45')]=_['merge'](_0x311b74[_0xc50e('0x45')],{'$or':_['map'](_0x311b74[_0xc50e('0x3d')],function(_0x55585a){var _0x44d601={};_0x44d601[_0x55585a]={'$like':'%'+_0x5d90b5['query'][_0xc50e('0x44')]+'%'};return _0x44d601;})});}_0x311b74=_[_0xc50e('0x46')]({},_0x311b74,_0x5d90b5[_0xc50e('0x48')]);return _0x52ab31[_0xc50e('0x93')](_0x311b74);}})[_0xc50e('0x2a')](function(_0x5e571d){if(_0x5e571d){_0x357d93=_0x5e571d[_0xc50e('0x3f')];if(!_0x5d90b5[_0xc50e('0x3a')][_0xc50e('0x40')]('nolimit')){_0x311b74[_0xc50e('0x42')]=qs['limit'](_0x5d90b5[_0xc50e('0x3a')][_0xc50e('0x42')]);_0x311b74[_0xc50e('0x21')]=qs[_0xc50e('0x21')](_0x5d90b5['query'][_0xc50e('0x21')]);}return _0x52ab31['getAgents'](_0x311b74);}})[_0xc50e('0x2a')](function(_0x1e775c){if(_0x1e775c){return _0x1e775c?{'count':_0x357d93,'rows':_0x1e775c}:null;}})[_0xc50e('0x2a')](respondWithResult(_0x2f2cec,null))[_0xc50e('0x4b')](handleError(_0x2f2cec,null));}; \ No newline at end of file +var _0xeb0e=['model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','Disposition','findOne','keys','findAll','removeDispositions','addContacts','isArray','tags','push','each','CmContact','omit','ids','errors','message','CmCustomField','CustomFields','format','cf_%d','order','raw','getContactsCsv','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Lists','UserProfileResource','error','name','send','map','CmList','rawAttributes','fieldName','key','query','filters','intersection','attributes'];(function(_0x14fd54,_0x139fed){var _0x25eb06=function(_0x31e0a7){while(--_0x31e0a7){_0x14fd54['push'](_0x14fd54['shift']());}};_0x25eb06(++_0x139fed);}(_0xeb0e,0x1e5));var _0xeeb0=function(_0x120b75,_0x357dc9){_0x120b75=_0x120b75-0x0;var _0x4f9c47=_0xeb0e[_0x120b75];return _0x4f9c47;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeeb0('0x0'));var zipdir=require(_0xeeb0('0x1'));var jsonpatch=require(_0xeeb0('0x2'));var rp=require(_0xeeb0('0x3'));var moment=require('moment');var BPromise=require(_0xeeb0('0x4'));var Mustache=require(_0xeeb0('0x5'));var util=require(_0xeeb0('0x6'));var path=require(_0xeeb0('0x7'));var sox=require(_0xeeb0('0x8'));var csv=require('to-csv');var ejs=require(_0xeeb0('0x9'));var fs=require('fs');var fs_extra=require(_0xeeb0('0xa'));var _=require(_0xeeb0('0xb'));var squel=require('squel');var crypto=require(_0xeeb0('0xc'));var jsforce=require(_0xeeb0('0xd'));var deskjs=require(_0xeeb0('0xe'));var toCsv=require(_0xeeb0('0xf'));var querystring=require('querystring');var Papa=require(_0xeeb0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeeb0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xeeb0('0x12'));var config=require(_0xeeb0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xeeb0('0x14'))['db'];config[_0xeeb0('0x15')]=_[_0xeeb0('0x16')](config['redis'],{'host':_0xeeb0('0x17'),'port':0x18eb});var socket=require(_0xeeb0('0x18'))(new Redis(config[_0xeeb0('0x15')]));require(_0xeeb0('0x19'))[_0xeeb0('0x1a')](socket);function respondWithStatusCode(_0x489895,_0x1d542c){_0x1d542c=_0x1d542c||0xcc;return function(_0x600fb2){if(_0x600fb2){return _0x489895['sendStatus'](_0x1d542c);}return _0x489895[_0xeeb0('0x1b')](_0x1d542c)[_0xeeb0('0x1c')]();};}function respondWithResult(_0x2493ee,_0x21e085){_0x21e085=_0x21e085||0xc8;return function(_0x3d8ecd){if(_0x3d8ecd){return _0x2493ee[_0xeeb0('0x1b')](_0x21e085)[_0xeeb0('0x1d')](_0x3d8ecd);}};}function respondWithFilteredResult(_0x51053f,_0x53abea){return function(_0x29fd00){if(_0x29fd00){var _0x1e86c9=typeof _0x53abea[_0xeeb0('0x1e')]===_0xeeb0('0x1f')&&typeof _0x53abea[_0xeeb0('0x20')]===_0xeeb0('0x1f');var _0x135a68=_0x29fd00[_0xeeb0('0x21')];var _0x2a1d80=_0x1e86c9?0x0:_0x53abea[_0xeeb0('0x1e')];var _0x5e6a4f=_0x1e86c9?_0x29fd00['count']:_0x53abea[_0xeeb0('0x1e')]+_0x53abea['limit'];var _0xbb7d4d;if(_0x5e6a4f>=_0x135a68){_0x5e6a4f=_0x135a68;_0xbb7d4d=0xc8;}else{_0xbb7d4d=0xce;}_0x51053f[_0xeeb0('0x1b')](_0xbb7d4d);return _0x51053f[_0xeeb0('0x22')](_0xeeb0('0x23'),_0x2a1d80+'-'+_0x5e6a4f+'/'+_0x135a68)[_0xeeb0('0x1d')](_0x29fd00);}return null;};}function patchUpdates(_0x2b0766){return function(_0x4ace1d){try{jsonpatch[_0xeeb0('0x24')](_0x4ace1d,_0x2b0766,!![]);}catch(_0x29862b){return BPromise['reject'](_0x29862b);}return _0x4ace1d[_0xeeb0('0x25')]();};}function saveUpdates(_0x2fcf33,_0x33afb7){return function(_0x7019f4){if(_0x7019f4){return _0x7019f4['update'](_0x2fcf33)[_0xeeb0('0x26')](function(_0x38846e){return _0x38846e;});}return null;};}function removeEntity(_0x27efe8,_0x2d2ae5){return function(_0x25a6c0){if(_0x25a6c0){return _0x25a6c0[_0xeeb0('0x27')]()[_0xeeb0('0x26')](function(){var _0x24eb88=_0x25a6c0[_0xeeb0('0x28')]({'plain':!![]});var _0x16dc73=_0xeeb0('0x29');return db[_0xeeb0('0x2a')][_0xeeb0('0x27')]({'where':{'type':_0x16dc73,'resourceId':_0x24eb88['id']}})['then'](function(){return _0x25a6c0;});})[_0xeeb0('0x26')](function(){_0x27efe8[_0xeeb0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa13ca2,_0x2efd21){return function(_0x3147db){if(!_0x3147db){_0xa13ca2['sendStatus'](0x194);}return _0x3147db;};}function handleError(_0x20691d,_0xee144b){_0xee144b=_0xee144b||0x1f4;return function(_0x3de6fc){logger[_0xeeb0('0x2b')](_0x3de6fc['stack']);if(_0x3de6fc['name']){delete _0x3de6fc[_0xeeb0('0x2c')];}_0x20691d[_0xeeb0('0x1b')](_0xee144b)[_0xeeb0('0x2d')](_0x3de6fc);};}exports['index']=function(_0x168298,_0x55b880){var _0x185b5c={},_0x50e71a={},_0x133bdd={'count':0x0,'rows':[]};var _0xbba654=_[_0xeeb0('0x2e')](db[_0xeeb0('0x2f')][_0xeeb0('0x30')],function(_0x170cee){return{'name':_0x170cee[_0xeeb0('0x31')],'type':_0x170cee['type'][_0xeeb0('0x32')]};});_0x50e71a['model']=_['map'](_0xbba654,_0xeeb0('0x2c'));_0x50e71a[_0xeeb0('0x33')]=_['keys'](_0x168298[_0xeeb0('0x33')]);_0x50e71a[_0xeeb0('0x34')]=_[_0xeeb0('0x35')](_0x50e71a['model'],_0x50e71a[_0xeeb0('0x33')]);_0x185b5c[_0xeeb0('0x36')]=_[_0xeeb0('0x35')](_0x50e71a[_0xeeb0('0x37')],qs[_0xeeb0('0x38')](_0x168298[_0xeeb0('0x33')][_0xeeb0('0x38')]));_0x185b5c[_0xeeb0('0x36')]=_0x185b5c[_0xeeb0('0x36')][_0xeeb0('0x39')]?_0x185b5c[_0xeeb0('0x36')]:_0x50e71a[_0xeeb0('0x37')];if(!_0x168298[_0xeeb0('0x33')][_0xeeb0('0x3a')](_0xeeb0('0x3b'))){_0x185b5c[_0xeeb0('0x20')]=qs[_0xeeb0('0x20')](_0x168298[_0xeeb0('0x33')][_0xeeb0('0x20')]);_0x185b5c[_0xeeb0('0x1e')]=qs['offset'](_0x168298['query'][_0xeeb0('0x1e')]);}_0x185b5c['order']=qs['sort'](_0x168298[_0xeeb0('0x33')][_0xeeb0('0x3c')]);_0x185b5c[_0xeeb0('0x3d')]=qs[_0xeeb0('0x34')](_[_0xeeb0('0x3e')](_0x168298['query'],_0x50e71a[_0xeeb0('0x34')]),_0xbba654);if(_0x168298[_0xeeb0('0x33')][_0xeeb0('0x3f')]){_0x185b5c[_0xeeb0('0x3d')]=_[_0xeeb0('0x40')](_0x185b5c['where'],{'$or':_[_0xeeb0('0x2e')](_0xbba654,function(_0x8b4ae5){if(_0x8b4ae5['type']!==_0xeeb0('0x41')){var _0x49f497={};_0x49f497[_0x8b4ae5[_0xeeb0('0x2c')]]={'$like':'%'+_0x168298[_0xeeb0('0x33')][_0xeeb0('0x3f')]+'%'};return _0x49f497;}})});}_0x185b5c=_[_0xeeb0('0x40')]({},_0x185b5c,_0x168298[_0xeeb0('0x42')]);var _0x18b716={'where':_0x185b5c[_0xeeb0('0x3d')]};return db[_0xeeb0('0x2f')][_0xeeb0('0x21')](_0x18b716)['then'](function(_0x1f95ab){_0x133bdd['count']=_0x1f95ab;if(_0x168298[_0xeeb0('0x33')]['includeAll']){_0x185b5c[_0xeeb0('0x43')]=[{'all':!![]}];}return db[_0xeeb0('0x2f')]['findAll'](_0x185b5c);})['then'](function(_0x57a630){_0x133bdd[_0xeeb0('0x44')]=_0x57a630;return _0x133bdd;})[_0xeeb0('0x26')](respondWithFilteredResult(_0x55b880,_0x185b5c))[_0xeeb0('0x45')](handleError(_0x55b880,null));};exports['show']=function(_0x3665e0,_0x543786){var _0x4dbd92={'raw':![],'where':{'id':_0x3665e0[_0xeeb0('0x46')]['id']}},_0x495608={};_0x495608['model']=_['keys'](db['CmList'][_0xeeb0('0x30')]);_0x495608[_0xeeb0('0x33')]=_['keys'](_0x3665e0[_0xeeb0('0x33')]);_0x495608[_0xeeb0('0x34')]=_[_0xeeb0('0x35')](_0x495608[_0xeeb0('0x37')],_0x495608[_0xeeb0('0x33')]);_0x4dbd92['attributes']=_[_0xeeb0('0x35')](_0x495608['model'],qs[_0xeeb0('0x38')](_0x3665e0[_0xeeb0('0x33')][_0xeeb0('0x38')]));_0x4dbd92[_0xeeb0('0x36')]=_0x4dbd92['attributes'][_0xeeb0('0x39')]?_0x4dbd92['attributes']:_0x495608[_0xeeb0('0x37')];if(_0x3665e0['query'][_0xeeb0('0x47')]){_0x4dbd92[_0xeeb0('0x43')]=[{'all':!![]}];}_0x4dbd92=_[_0xeeb0('0x40')]({},_0x4dbd92,_0x3665e0[_0xeeb0('0x42')]);return db[_0xeeb0('0x2f')][_0xeeb0('0x48')](_0x4dbd92)['then'](handleEntityNotFound(_0x543786,null))[_0xeeb0('0x26')](respondWithResult(_0x543786,null))[_0xeeb0('0x45')](handleError(_0x543786,null));};exports[_0xeeb0('0x49')]=function(_0x27fcc4,_0x271d46){return db[_0xeeb0('0x2f')]['create'](_0x27fcc4['body'],{})[_0xeeb0('0x26')](function(_0x29e73a){var _0x5d8dab=_0x27fcc4[_0xeeb0('0x4a')]['get']({'plain':!![]});if(!_0x5d8dab)throw new Error(_0xeeb0('0x4b'));if(_0x5d8dab['role']===_0xeeb0('0x4a')){var _0x32c040=_0x29e73a[_0xeeb0('0x28')]({'plain':!![]});var _0x1e65fa=_0xeeb0('0x29');return db['UserProfileSection'][_0xeeb0('0x48')]({'where':{'name':_0x1e65fa,'userProfileId':_0x5d8dab['userProfileId']},'raw':!![]})[_0xeeb0('0x26')](function(_0x16c36c){if(_0x16c36c&&_0x16c36c[_0xeeb0('0x4c')]===0x0){return db[_0xeeb0('0x2a')][_0xeeb0('0x49')]({'name':_0x32c040['name'],'resourceId':_0x32c040['id'],'type':_0x16c36c[_0xeeb0('0x2c')],'sectionId':_0x16c36c['id']},{})[_0xeeb0('0x26')](function(){return _0x29e73a;});}else{return _0x29e73a;}})['catch'](function(_0x1bde6d){logger['error'](_0xeeb0('0x4d'),_0x1bde6d);throw _0x1bde6d;});}return _0x29e73a;})['then'](respondWithResult(_0x271d46,0xc9))[_0xeeb0('0x45')](handleError(_0x271d46,null));};exports['update']=function(_0x4e8a2c,_0x515225){if(_0x4e8a2c['body']['id']){delete _0x4e8a2c['body']['id'];}return db['CmList'][_0xeeb0('0x48')]({'where':{'id':_0x4e8a2c['params']['id']}})[_0xeeb0('0x26')](handleEntityNotFound(_0x515225,null))[_0xeeb0('0x26')](saveUpdates(_0x4e8a2c[_0xeeb0('0x4e')],null))[_0xeeb0('0x26')](respondWithResult(_0x515225,null))['catch'](handleError(_0x515225,null));};exports[_0xeeb0('0x27')]=function(_0x541a2c,_0x466864){return db['CmList'][_0xeeb0('0x48')]({'where':{'id':_0x541a2c[_0xeeb0('0x46')]['id']}})['then'](handleEntityNotFound(_0x466864,null))['then'](removeEntity(_0x466864,null))[_0xeeb0('0x45')](handleError(_0x466864,null));};exports[_0xeeb0('0x4f')]=function(_0x21ce51,_0x30183c){return db[_0xeeb0('0x2f')][_0xeeb0('0x4f')]()[_0xeeb0('0x26')](respondWithResult(_0x30183c,null))[_0xeeb0('0x45')](handleError(_0x30183c,null));};exports['addDisposition']=function(_0x5873cd,_0x416c13,_0x56866f){if(_0x5873cd[_0xeeb0('0x4e')]['id']){delete _0x5873cd[_0xeeb0('0x4e')]['id'];}return db[_0xeeb0('0x2f')]['find']({'where':{'id':_0x5873cd[_0xeeb0('0x46')]['id']}})[_0xeeb0('0x26')](handleEntityNotFound(_0x416c13,null))['then'](function(_0x54dfe7){if(_0x54dfe7){_0x5873cd[_0xeeb0('0x4e')][_0xeeb0('0x50')]=_0x54dfe7['id'];return db[_0xeeb0('0x51')][_0xeeb0('0x49')](_0x5873cd[_0xeeb0('0x4e')]);}})[_0xeeb0('0x26')](respondWithResult(_0x416c13,null))[_0xeeb0('0x45')](handleError(_0x416c13,null));};exports['getDispositions']=function(_0x1b483c,_0xd35c80,_0x3ebb5f){var _0x4ee6cb={'raw':![],'where':{}};var _0x21ac02={};var _0x432df2={'count':0x0,'rows':[]};return db['CmList'][_0xeeb0('0x52')]({'where':{'id':_0x1b483c[_0xeeb0('0x46')]['id']}})['then'](handleEntityNotFound(_0xd35c80,null))['then'](function(_0x106daf){if(_0x106daf){_0x21ac02[_0xeeb0('0x37')]=_[_0xeeb0('0x53')](db[_0xeeb0('0x51')][_0xeeb0('0x30')]);_0x21ac02[_0xeeb0('0x33')]=_['keys'](_0x1b483c['query']);_0x21ac02[_0xeeb0('0x34')]=_[_0xeeb0('0x35')](_0x21ac02[_0xeeb0('0x37')],_0x21ac02['query']);_0x4ee6cb['attributes']=_['intersection'](_0x21ac02[_0xeeb0('0x37')],qs['fields'](_0x1b483c['query'][_0xeeb0('0x38')]));_0x4ee6cb[_0xeeb0('0x36')]=_0x4ee6cb[_0xeeb0('0x36')]['length']?_0x4ee6cb[_0xeeb0('0x36')]:_0x21ac02[_0xeeb0('0x37')];if(!_0x1b483c[_0xeeb0('0x33')][_0xeeb0('0x3a')](_0xeeb0('0x3b'))){_0x4ee6cb['limit']=qs['limit'](_0x1b483c['query']['limit']);_0x4ee6cb[_0xeeb0('0x1e')]=qs[_0xeeb0('0x1e')](_0x1b483c[_0xeeb0('0x33')][_0xeeb0('0x1e')]);}_0x4ee6cb['order']=qs[_0xeeb0('0x3c')](_0x1b483c[_0xeeb0('0x33')][_0xeeb0('0x3c')]);_0x4ee6cb[_0xeeb0('0x3d')]=qs['filters'](_[_0xeeb0('0x3e')](_0x1b483c['query'],_0x21ac02[_0xeeb0('0x34')]));_0x4ee6cb[_0xeeb0('0x3d')][_0xeeb0('0x50')]=_0x106daf['id'];if(_0x1b483c[_0xeeb0('0x33')][_0xeeb0('0x3f')]){_0x4ee6cb[_0xeeb0('0x3d')]=_[_0xeeb0('0x40')](_0x4ee6cb[_0xeeb0('0x3d')],{'$or':_['map'](_0x4ee6cb[_0xeeb0('0x36')],function(_0x96a275){var _0x125c1e={};_0x125c1e[_0x96a275]={'$like':'%'+_0x1b483c['query'][_0xeeb0('0x3f')]+'%'};return _0x125c1e;})});}_0x4ee6cb=_[_0xeeb0('0x40')]({},_0x4ee6cb,_0x1b483c[_0xeeb0('0x42')]);return db[_0xeeb0('0x51')][_0xeeb0('0x21')]({'where':_0x4ee6cb[_0xeeb0('0x3d')]})['then'](function(_0x5cbfc6){_0x432df2['count']=_0x5cbfc6;if(_0x1b483c[_0xeeb0('0x33')][_0xeeb0('0x47')]){_0x4ee6cb[_0xeeb0('0x43')]=[{'all':!![]}];}return db[_0xeeb0('0x51')][_0xeeb0('0x54')](_0x4ee6cb);})['then'](function(_0x59732e){_0x432df2[_0xeeb0('0x44')]=_0x59732e;return _0x432df2;});}})[_0xeeb0('0x26')](respondWithFilteredResult(_0xd35c80,_0x4ee6cb))[_0xeeb0('0x45')](handleError(_0xd35c80,null));};exports[_0xeeb0('0x55')]=function(_0x595a65,_0x5289c5,_0x48168d){return db[_0xeeb0('0x2f')]['find']({'where':{'id':_0x595a65[_0xeeb0('0x46')]['id']}})[_0xeeb0('0x26')](handleEntityNotFound(_0x5289c5,null))['then'](function(_0x145ede){if(_0x145ede){return _0x145ede['removeDispositions'](_0x595a65[_0xeeb0('0x33')]['ids']);}})[_0xeeb0('0x26')](respondWithStatusCode(_0x5289c5,null))[_0xeeb0('0x45')](handleError(_0x5289c5,null));};exports[_0xeeb0('0x56')]=function(_0x1ce262,_0x25ec3b,_0x7af969){return db['CmList'][_0xeeb0('0x48')]({'where':{'id':_0x1ce262[_0xeeb0('0x46')]['id']}})['then'](handleEntityNotFound(_0x25ec3b,null))[_0xeeb0('0x26')](function(_0x3bf190){if(_0x3bf190){var _0x4515ca=[];var _0x356433={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xeeb0('0x26')](function(_0x449d6e){if(_0x1ce262[_0xeeb0('0x4e')]['tags']&&_[_0xeeb0('0x57')](_0x1ce262[_0xeeb0('0x4e')][_0xeeb0('0x58')])){if(_0x1ce262[_0xeeb0('0x4e')][_0xeeb0('0x58')]['length']){_0x1ce262[_0xeeb0('0x4e')][_0xeeb0('0x58')]=_0x1ce262[_0xeeb0('0x4e')]['tags']['join'](';')+';';}else{_0x1ce262[_0xeeb0('0x4e')]['tags']=null;}}else{_0x1ce262['body'][_0xeeb0('0x58')]=null;}if(_0x1ce262[_0xeeb0('0x4e')]&&_[_0xeeb0('0x57')](_0x1ce262[_0xeeb0('0x4e')])){for(var _0x5dd28c=0x0;_0x5dd28c<_0x1ce262[_0xeeb0('0x4e')]['length'];_0x5dd28c+=0x1){_0x1ce262['body'][_0x5dd28c][_0xeeb0('0x50')]=_0x1ce262[_0xeeb0('0x46')]['id'];_0x4515ca[_0xeeb0('0x59')](_0x1ce262[_0xeeb0('0x4e')][_0x5dd28c]);}return BPromise[_0xeeb0('0x5a')](_0x4515ca,function(_0x2fede7){return db[_0xeeb0('0x5b')]['create'](_[_0xeeb0('0x5c')](_0x2fede7,[_0xeeb0('0x5d'),'id'])||{},{'fields':_['keys'](_0x449d6e),'raw':!![]})[_0xeeb0('0x26')](function(_0x43b18e){_0x356433['success'][_0xeeb0('0x59')](_0x43b18e['dataValues']);})[_0xeeb0('0x45')](function(_0x55b8e0){_0x356433[_0xeeb0('0x5e')][_0xeeb0('0x59')]({'data':_0x2fede7,'error':_0x55b8e0[_0xeeb0('0x5f')]});});})[_0xeeb0('0x26')](function(_0x4a30bd){return _0x356433;})['catch'](function(_0x35b760){return _0x35b760;});}else{_0x25ec3b[_0xeeb0('0x1b')](0x190)[_0xeeb0('0x1d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xeeb0('0x26')](respondWithResult(_0x25ec3b,null))['catch'](handleError(_0x25ec3b,null));};exports['getContacts']=function(_0xf8f2e0,_0x2ee877,_0x3a3caf){var _0x29ff7d;return db['CmList']['find']({'where':{'id':_0xf8f2e0[_0xeeb0('0x46')]['id']},'include':[{'model':db[_0xeeb0('0x60')],'as':_0xeeb0('0x61')}]})['then'](handleEntityNotFound(_0x2ee877,null))[_0xeeb0('0x26')](function(_0x8a6517){if(_0x8a6517){_0x29ff7d=_0x8a6517;return db[_0xeeb0('0x5b')][_0xeeb0('0x30')];}})[_0xeeb0('0x26')](function(_0x1eeb7e){if(_0x1eeb7e){var _0x4739e0={};var _0x2bb416={};_0x2bb416[_0xeeb0('0x37')]=_['concat'](_[_0xeeb0('0x53')](_0x1eeb7e),_[_0xeeb0('0x2e')](_0x29ff7d['CustomFields'],function(_0xfeca08){return util[_0xeeb0('0x62')](_0xeeb0('0x63'),_0xfeca08['id']);}));_0x2bb416[_0xeeb0('0x33')]=_['keys'](_0xf8f2e0[_0xeeb0('0x33')]);_0x2bb416[_0xeeb0('0x34')]=_['intersection'](_0x2bb416[_0xeeb0('0x37')],_0x2bb416[_0xeeb0('0x33')]);_0x4739e0[_0xeeb0('0x36')]=_[_0xeeb0('0x35')](_0x2bb416[_0xeeb0('0x37')],qs[_0xeeb0('0x38')](_0xf8f2e0[_0xeeb0('0x33')][_0xeeb0('0x38')]));_0x4739e0[_0xeeb0('0x36')]=_0x4739e0[_0xeeb0('0x36')][_0xeeb0('0x39')]?_0x4739e0[_0xeeb0('0x36')]:_0x2bb416[_0xeeb0('0x37')];if(!_0xf8f2e0[_0xeeb0('0x33')]['hasOwnProperty']('nolimit')){_0x4739e0[_0xeeb0('0x20')]=qs['limit'](_0xf8f2e0[_0xeeb0('0x33')][_0xeeb0('0x20')]);_0x4739e0['offset']=qs[_0xeeb0('0x1e')](_0xf8f2e0[_0xeeb0('0x33')][_0xeeb0('0x1e')]);}_0x4739e0[_0xeeb0('0x64')]=qs[_0xeeb0('0x3c')](_0xf8f2e0['query']['sort']);_0x4739e0[_0xeeb0('0x3d')]=qs[_0xeeb0('0x34')](_[_0xeeb0('0x3e')](_0xf8f2e0[_0xeeb0('0x33')],_0x2bb416['filters']));_0x4739e0[_0xeeb0('0x65')]=!![];if(_0xf8f2e0[_0xeeb0('0x33')][_0xeeb0('0x3f')]){_0x4739e0[_0xeeb0('0x3d')]=_[_0xeeb0('0x40')](_0x4739e0[_0xeeb0('0x3d')],{'$or':_['map'](_0x4739e0[_0xeeb0('0x36')],function(_0x58720a){var _0x11bdab={};_0x11bdab[_0x58720a]={'$like':'%'+_0xf8f2e0[_0xeeb0('0x33')]['filter']+'%'};return _0x11bdab;})});}_0x4739e0=_['merge']({},_0x4739e0,_0xf8f2e0[_0xeeb0('0x42')]);return _0x29ff7d['getContacts'](_0x4739e0);}})[_0xeeb0('0x26')](respondWithResult(_0x2ee877,null))[_0xeeb0('0x45')](handleError(_0x2ee877,null));};exports[_0xeeb0('0x66')]=function(_0x2c522e,_0x5e4c7a,_0xef1c9){var _0x2f0a91;return db['CmList'][_0xeeb0('0x48')]({'where':{'id':_0x2c522e['params']['id']},'include':[{'model':db[_0xeeb0('0x60')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x5e4c7a,null))[_0xeeb0('0x26')](function(_0x154d57){if(_0x154d57){_0x2f0a91=_0x154d57;return db[_0xeeb0('0x5b')]['rawAttributes'];}})[_0xeeb0('0x26')](function(_0x37ca50){if(_0x37ca50){var _0x33470c={};var _0x143b0b={};_0x143b0b[_0xeeb0('0x37')]=_['concat'](_['keys'](_0x37ca50),_[_0xeeb0('0x2e')](_0x2f0a91[_0xeeb0('0x61')],function(_0x4a245d){return util[_0xeeb0('0x62')](_0xeeb0('0x63'),_0x4a245d['id']);}));_0x143b0b[_0xeeb0('0x33')]=_[_0xeeb0('0x53')](_0x2c522e[_0xeeb0('0x33')]);_0x143b0b[_0xeeb0('0x34')]=_[_0xeeb0('0x35')](_0x143b0b['model'],_0x143b0b[_0xeeb0('0x33')]);_0x33470c[_0xeeb0('0x36')]=_[_0xeeb0('0x35')](_0x143b0b[_0xeeb0('0x37')],qs[_0xeeb0('0x38')](_0x2c522e[_0xeeb0('0x33')]['fields']));_0x33470c[_0xeeb0('0x36')]=_0x33470c[_0xeeb0('0x36')]['length']?_0x33470c[_0xeeb0('0x36')]:_0x143b0b['model'];if(!_0x2c522e['query'][_0xeeb0('0x3a')]('nolimit')){_0x33470c[_0xeeb0('0x20')]=qs[_0xeeb0('0x20')](_0x2c522e[_0xeeb0('0x33')][_0xeeb0('0x20')]);_0x33470c[_0xeeb0('0x1e')]=qs[_0xeeb0('0x1e')](_0x2c522e[_0xeeb0('0x33')]['offset']);}_0x33470c[_0xeeb0('0x64')]=qs[_0xeeb0('0x3c')](_0x2c522e[_0xeeb0('0x33')]['sort']);_0x33470c[_0xeeb0('0x3d')]=qs[_0xeeb0('0x34')](_[_0xeeb0('0x3e')](_0x2c522e[_0xeeb0('0x33')],_0x143b0b[_0xeeb0('0x34')]));_0x33470c[_0xeeb0('0x65')]=!![];if(_0x2c522e[_0xeeb0('0x33')][_0xeeb0('0x3f')]){_0x33470c['where']=_['merge'](_0x33470c[_0xeeb0('0x3d')],{'$or':_[_0xeeb0('0x2e')](_0x33470c[_0xeeb0('0x36')],function(_0xb2daa2){var _0xf61fc={};_0xf61fc[_0xb2daa2]={'$like':'%'+_0x2c522e[_0xeeb0('0x33')]['filter']+'%'};return _0xf61fc;})});}_0x33470c=_[_0xeeb0('0x40')]({},_0x33470c,_0x2c522e[_0xeeb0('0x42')]);return _0x2f0a91['getContacts'](_0x33470c);}})['then'](function(_0xd69446){if(!_['isEmpty'](_0xd69446)){var _0x26255e=toCsv(_0xd69446);var _0x142fe7=Date['now']();fs[_0xeeb0('0x67')](util[_0xeeb0('0x62')](_0xeeb0('0x68'),_0x2f0a91['id'],_0x142fe7),_0x26255e);_0x5e4c7a[_0xeeb0('0x69')](_0xeeb0('0x6a'),_0xeeb0('0x6b')+util[_0xeeb0('0x62')](_0xeeb0('0x6c'),_0x2f0a91['id'],_0x142fe7));_0x5e4c7a['setHeader']('Content-type','text/csv');return _0x5e4c7a[_0xeeb0('0x6d')](util[_0xeeb0('0x62')]('/tmp/list_%d_%s.csv',_0x2f0a91['id'],_0x142fe7));}else{return _0x5e4c7a[_0xeeb0('0x6e')](0xcc);}})[_0xeeb0('0x45')](handleError(_0x5e4c7a,null));};exports[_0xeeb0('0x6f')]=function(_0x5533df,_0x36543f,_0x4c9f3b){var _0x645d5d;delete _0x5533df[_0xeeb0('0x4e')]['id'];return db[_0xeeb0('0x2f')][_0xeeb0('0x52')]({'where':{'id':_0x5533df[_0xeeb0('0x46')]['id']}})['then'](handleEntityNotFound(_0x36543f,null))['then'](function(_0x44be23){if(_0x44be23){return db[_0xeeb0('0x70')][_0xeeb0('0x71')](function(_0x2ab1b3){return db['CmCustomField']['create'](_0x5533df[_0xeeb0('0x4e')],{'transaction':_0x2ab1b3})[_0xeeb0('0x26')](function(_0xae5519){_0x645d5d=_0xae5519;return _0x44be23[_0xeeb0('0x72')](_0xae5519,{'transaction':_0x2ab1b3});})[_0xeeb0('0x26')](function(){var _0x106ee9={'type':db[_0xeeb0('0x73')][_0xeeb0('0x74')],'transaction':_0x2ab1b3};switch(_0x5533df[_0xeeb0('0x4e')][_0xeeb0('0x75')]){case _0xeeb0('0x76'):_0x106ee9[_0xeeb0('0x75')]=db[_0xeeb0('0x73')]['TEXT'];break;case _0xeeb0('0x77'):_0x106ee9[_0xeeb0('0x75')]=db[_0xeeb0('0x73')][_0xeeb0('0x78')];break;case _0xeeb0('0x79'):_0x106ee9[_0xeeb0('0x75')]=db[_0xeeb0('0x73')][_0xeeb0('0x7a')];_0x106ee9[_0xeeb0('0x7b')]=![];break;default:}return db[_0xeeb0('0x70')][_0xeeb0('0x7c')][_0xeeb0('0x7d')]('cm_contacts',util[_0xeeb0('0x62')](_0xeeb0('0x7e'),_0x645d5d['id']),_0x106ee9);})[_0xeeb0('0x26')](function(){return _0x645d5d;});});}})['then'](respondWithResult(_0x36543f,null))[_0xeeb0('0x45')](handleError(_0x36543f,null));};exports[_0xeeb0('0x7f')]=function(_0x487db6,_0x9eaae5,_0x30b50d){var _0x3dec24={};var _0x4964ae={};var _0x1be2dd;var _0x3ba9d8;return db[_0xeeb0('0x2f')][_0xeeb0('0x52')]({'where':{'id':_0x487db6['params']['id']}})[_0xeeb0('0x26')](handleEntityNotFound(_0x9eaae5,null))[_0xeeb0('0x26')](function(_0x423df2){if(_0x423df2){_0x1be2dd=_0x423df2;_0x4964ae[_0xeeb0('0x37')]=_[_0xeeb0('0x53')](db[_0xeeb0('0x60')][_0xeeb0('0x30')]);_0x4964ae['query']=_[_0xeeb0('0x53')](_0x487db6[_0xeeb0('0x33')]);_0x4964ae[_0xeeb0('0x34')]=_[_0xeeb0('0x35')](_0x4964ae[_0xeeb0('0x37')],_0x4964ae['query']);_0x3dec24[_0xeeb0('0x36')]=_[_0xeeb0('0x35')](_0x4964ae[_0xeeb0('0x37')],qs['fields'](_0x487db6[_0xeeb0('0x33')][_0xeeb0('0x38')]));_0x3dec24['attributes']=_0x3dec24[_0xeeb0('0x36')][_0xeeb0('0x39')]?_0x3dec24[_0xeeb0('0x36')]:_0x4964ae[_0xeeb0('0x37')];_0x3dec24['order']=qs[_0xeeb0('0x3c')](_0x487db6[_0xeeb0('0x33')][_0xeeb0('0x3c')]);_0x3dec24['where']=qs[_0xeeb0('0x34')](_[_0xeeb0('0x3e')](_0x487db6[_0xeeb0('0x33')],_0x4964ae[_0xeeb0('0x34')]));_0x3dec24[_0xeeb0('0x3d')]=_[_0xeeb0('0x40')](_0x3dec24[_0xeeb0('0x3d')],{'$or':[{'ListId':_0x423df2['id']},{'ListId':null}]});if(_0x487db6['query'][_0xeeb0('0x3f')]){_0x3dec24['where']=_[_0xeeb0('0x40')](_0x3dec24[_0xeeb0('0x3d')],{'$or':_[_0xeeb0('0x2e')](_0x3dec24['attributes'],function(_0x4509fd){var _0x15ab77={};_0x15ab77[_0x4509fd]={'$like':'%'+_0x487db6['query'][_0xeeb0('0x3f')]+'%'};return _0x15ab77;})});}_0x3dec24=_[_0xeeb0('0x40')]({},_0x3dec24,_0x487db6[_0xeeb0('0x42')]);return db[_0xeeb0('0x60')][_0xeeb0('0x80')](_0x3dec24);}})[_0xeeb0('0x26')](respondWithResult(_0x9eaae5,null))[_0xeeb0('0x45')](handleError(_0x9eaae5,null));};exports[_0xeeb0('0x81')]=function(_0x50163a,_0x37f48d,_0x2880b4){return db['CmList'][_0xeeb0('0x48')]({'where':{'id':_0x50163a[_0xeeb0('0x46')]['id']}})[_0xeeb0('0x26')](handleEntityNotFound(_0x37f48d,null))['then'](function(_0x28c483){if(_0x28c483){return _0x28c483[_0xeeb0('0x81')](_0x50163a[_0xeeb0('0x4e')][_0xeeb0('0x5d')],_[_0xeeb0('0x5c')](_0x50163a['body'],[_0xeeb0('0x5d'),'id'])||{})[_0xeeb0('0x82')](function(_0x30ad7a){for(var _0x23e940=0x0;_0x23e940<_0x50163a[_0xeeb0('0x4e')][_0xeeb0('0x5d')][_0xeeb0('0x39')];_0x23e940+=0x1){socket[_0xeeb0('0x83')]('userCmList:save',{'UserId':Number(_0x50163a[_0xeeb0('0x4e')]['ids'][_0x23e940]),'CmListId':Number(_0x50163a[_0xeeb0('0x46')]['id'])});}return _0x30ad7a;});}})[_0xeeb0('0x26')](respondWithResult(_0x37f48d,null))[_0xeeb0('0x45')](handleError(_0x37f48d,null));};exports['removeAgents']=function(_0x348877,_0x379386,_0x49fc57){return db[_0xeeb0('0x2f')][_0xeeb0('0x48')]({'where':{'id':_0x348877[_0xeeb0('0x46')]['id']}})[_0xeeb0('0x26')](handleEntityNotFound(_0x379386,null))[_0xeeb0('0x26')](function(_0x4891e8){if(_0x4891e8){return _0x4891e8['removeAgents'](_0x348877['query']['ids'])['then'](function(){if(_[_0xeeb0('0x57')](_0x348877[_0xeeb0('0x33')][_0xeeb0('0x5d')])){for(var _0x228d64=0x0;_0x228d64<_0x348877[_0xeeb0('0x33')][_0xeeb0('0x5d')][_0xeeb0('0x39')];_0x228d64+=0x1){socket[_0xeeb0('0x83')]('userCmList:remove',{'UserId':Number(_0x348877[_0xeeb0('0x33')][_0xeeb0('0x5d')][_0x228d64]),'CmListId':Number(_0x348877['params']['id'])});}}else{socket['emit'](_0xeeb0('0x84'),{'UserId':Number(_0x348877[_0xeeb0('0x33')][_0xeeb0('0x5d')]),'CmListId':Number(_0x348877['params']['id'])});}});}})[_0xeeb0('0x26')](respondWithStatusCode(_0x379386,null))[_0xeeb0('0x45')](handleError(_0x379386,null));};exports[_0xeeb0('0x85')]=function(_0x509e51,_0x45885d,_0xab17e){var _0x25e556={};var _0x32f5ca={};var _0x461a65;var _0x3220fc;return db[_0xeeb0('0x2f')][_0xeeb0('0x52')]({'where':{'id':_0x509e51['params']['id']}})[_0xeeb0('0x26')](handleEntityNotFound(_0x45885d,null))[_0xeeb0('0x26')](function(_0x1bd8d1){if(_0x1bd8d1){_0x461a65=_0x1bd8d1;_0x32f5ca[_0xeeb0('0x37')]=_['keys'](db[_0xeeb0('0x86')][_0xeeb0('0x30')]);_0x32f5ca['query']=_[_0xeeb0('0x53')](_0x509e51[_0xeeb0('0x33')]);_0x32f5ca[_0xeeb0('0x34')]=_[_0xeeb0('0x35')](_0x32f5ca[_0xeeb0('0x37')],_0x32f5ca['query']);_0x25e556[_0xeeb0('0x36')]=_[_0xeeb0('0x35')](_0x32f5ca[_0xeeb0('0x37')],qs[_0xeeb0('0x38')](_0x509e51[_0xeeb0('0x33')][_0xeeb0('0x38')]));_0x25e556[_0xeeb0('0x36')]=_0x25e556[_0xeeb0('0x36')][_0xeeb0('0x39')]?_0x25e556['attributes']:_0x32f5ca[_0xeeb0('0x37')];_0x25e556[_0xeeb0('0x64')]=qs[_0xeeb0('0x3c')](_0x509e51[_0xeeb0('0x33')]['sort']);_0x25e556[_0xeeb0('0x3d')]=qs[_0xeeb0('0x34')](_['pick'](_0x509e51[_0xeeb0('0x33')],_0x32f5ca[_0xeeb0('0x34')]));if(_0x509e51[_0xeeb0('0x33')]['filter']){_0x25e556[_0xeeb0('0x3d')]=_[_0xeeb0('0x40')](_0x25e556[_0xeeb0('0x3d')],{'$or':_[_0xeeb0('0x2e')](_0x25e556['attributes'],function(_0x53c18d){var _0x30d2e2={};_0x30d2e2[_0x53c18d]={'$like':'%'+_0x509e51[_0xeeb0('0x33')]['filter']+'%'};return _0x30d2e2;})});}_0x25e556=_[_0xeeb0('0x40')]({},_0x25e556,_0x509e51[_0xeeb0('0x42')]);return _0x461a65['getAgents'](_0x25e556);}})[_0xeeb0('0x26')](function(_0x5b0ab9){if(_0x5b0ab9){_0x3220fc=_0x5b0ab9[_0xeeb0('0x39')];if(!_0x509e51[_0xeeb0('0x33')]['hasOwnProperty'](_0xeeb0('0x3b'))){_0x25e556[_0xeeb0('0x20')]=qs[_0xeeb0('0x20')](_0x509e51[_0xeeb0('0x33')][_0xeeb0('0x20')]);_0x25e556[_0xeeb0('0x1e')]=qs['offset'](_0x509e51['query'][_0xeeb0('0x1e')]);}return _0x461a65[_0xeeb0('0x85')](_0x25e556);}})['then'](function(_0x125963){if(_0x125963){return _0x125963?{'count':_0x3220fc,'rows':_0x125963}:null;}})[_0xeeb0('0x26')](respondWithResult(_0x45885d,null))['catch'](handleError(_0x45885d,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 86c9b81..b1e3d9a 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x346e06,_0x2593e8){_0x346e06=_0x346e06-0x0;var _0x49bc9c=_0x3e74[_0x346e06];return _0x49bc9c;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x5fc3[_0x4d1ee9];return _0x9a5456;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f24d38f..d1bbda2 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 _0xe5b5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x51674a,_0x2ca337){var _0x4a1f4e=function(_0x5ad4a5){while(--_0x5ad4a5){_0x51674a['push'](_0x51674a['shift']());}};_0x4a1f4e(++_0x2ca337);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xe5b5[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5db59c,_0x41f295){var _0xd9acfc=function(_0x1f4e72){while(--_0x1f4e72){_0x5db59c['push'](_0x5db59c['shift']());}};_0xd9acfc(++_0x41f295);}(_0x702d,0x147));var _0xd702=function(_0x51f8b7,_0x1ba641){_0x51f8b7=_0x51f8b7-0x0;var _0x1c4fa8=_0x702d[_0x51f8b7];return _0x1c4fa8;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index e925d4f..80ab2a4 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 _0x80fc=['then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80fc,0xcf));var _0xc80f=function(_0x18531f,_0x22cff4){_0x18531f=_0x18531f-0x0;var _0x5e0bc8=_0x80fc[_0x18531f];return _0x5e0bc8;};'use strict';var _=require(_0xc80f('0x0'));var util=require(_0xc80f('0x1'));var moment=require(_0xc80f('0x2'));var BPromise=require(_0xc80f('0x3'));var rs=require(_0xc80f('0x4'));var fs=require('fs');var Redis=require(_0xc80f('0x5'));var db=require(_0xc80f('0x6'))['db'];var utils=require(_0xc80f('0x7'));var logger=require('../../config/logger')(_0xc80f('0x8'));var config=require('../../config/environment');var jayson=require(_0xc80f('0x9'));var client=jayson['client'][_0xc80f('0xa')]({'port':0x232a});config['redis']=_[_0xc80f('0xb')](config[_0xc80f('0xc')],{'host':_0xc80f('0xd'),'port':0x18eb});var socket=require(_0xc80f('0xe'))(new Redis(config[_0xc80f('0xc')]));require(_0xc80f('0xf'))['register'](socket);function respondWithRpcPromise(_0x5aef87,_0x8f1a00,_0xc18298){return new BPromise(function(_0x46f6f8,_0x5d80a8){return client[_0xc80f('0x10')](_0x5aef87,_0xc18298)[_0xc80f('0x11')](function(_0x568055){logger[_0xc80f('0x12')](_0xc80f('0x13'),_0x8f1a00,_0xc80f('0x14'));logger[_0xc80f('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x8f1a00,_0xc80f('0x14'),JSON[_0xc80f('0x16')](_0x568055));if(_0x568055['error']){if(_0x568055[_0xc80f('0x17')][_0xc80f('0x18')]===0x1f4){logger[_0xc80f('0x17')]('CmList,\x20%s,\x20%s',_0x8f1a00,_0x568055[_0xc80f('0x17')]['message']);return _0x5d80a8(_0x568055[_0xc80f('0x17')][_0xc80f('0x19')]);}logger[_0xc80f('0x17')](_0xc80f('0x13'),_0x8f1a00,_0x568055[_0xc80f('0x17')][_0xc80f('0x19')]);return _0x46f6f8(_0x568055[_0xc80f('0x17')][_0xc80f('0x19')]);}else{logger[_0xc80f('0x12')](_0xc80f('0x13'),_0x8f1a00,_0xc80f('0x14'));_0x46f6f8(_0x568055[_0xc80f('0x1a')]['message']);}})[_0xc80f('0x1b')](function(_0x217b2e){logger['error'](_0xc80f('0x13'),_0x8f1a00,_0x217b2e);_0x5d80a8(_0x217b2e);});});} \ No newline at end of file +var _0x3fff=['CmList,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info'];(function(_0x3b39df,_0x2187a1){var _0x514167=function(_0x3b6b0e){while(--_0x3b6b0e){_0x3b39df['push'](_0x3b39df['shift']());}};_0x514167(++_0x2187a1);}(_0x3fff,0x19f));var _0xf3ff=function(_0x2de5cf,_0x4668fc){_0x2de5cf=_0x2de5cf-0x0;var _0x131b2b=_0x3fff[_0x2de5cf];return _0x131b2b;};'use strict';var _=require('lodash');var util=require(_0xf3ff('0x0'));var moment=require(_0xf3ff('0x1'));var BPromise=require(_0xf3ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3ff('0x3'));var db=require(_0xf3ff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3ff('0x5'))('rpc');var config=require(_0xf3ff('0x6'));var jayson=require(_0xf3ff('0x7'));var client=jayson[_0xf3ff('0x8')][_0xf3ff('0x9')]({'port':0x232a});config[_0xf3ff('0xa')]=_[_0xf3ff('0xb')](config[_0xf3ff('0xa')],{'host':_0xf3ff('0xc'),'port':0x18eb});var socket=require(_0xf3ff('0xd'))(new Redis(config[_0xf3ff('0xa')]));require('./cmList.socket')[_0xf3ff('0xe')](socket);function respondWithRpcPromise(_0x38b9aa,_0x26cca2,_0x32e42c){return new BPromise(function(_0x4dd117,_0x1a9dd4){return client['request'](_0x38b9aa,_0x32e42c)[_0xf3ff('0xf')](function(_0x5b6de3){logger[_0xf3ff('0x10')](_0xf3ff('0x11'),_0x26cca2,'request\x20sent');logger[_0xf3ff('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x26cca2,_0xf3ff('0x13'),JSON['stringify'](_0x5b6de3));if(_0x5b6de3[_0xf3ff('0x14')]){if(_0x5b6de3['error'][_0xf3ff('0x15')]===0x1f4){logger[_0xf3ff('0x14')](_0xf3ff('0x11'),_0x26cca2,_0x5b6de3[_0xf3ff('0x14')]['message']);return _0x1a9dd4(_0x5b6de3[_0xf3ff('0x14')][_0xf3ff('0x16')]);}logger[_0xf3ff('0x14')](_0xf3ff('0x11'),_0x26cca2,_0x5b6de3['error']['message']);return _0x4dd117(_0x5b6de3[_0xf3ff('0x14')][_0xf3ff('0x16')]);}else{logger['info'](_0xf3ff('0x11'),_0x26cca2,_0xf3ff('0x13'));_0x4dd117(_0x5b6de3['result']['message']);}})[_0xf3ff('0x17')](function(_0x4db6f0){logger[_0xf3ff('0x14')](_0xf3ff('0x11'),_0x26cca2,_0x4db6f0);_0x1a9dd4(_0x4db6f0);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e09100a..edd35a3 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 _0xec65=['length','cmList:','save','update','register'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xec65,0x101));var _0x5ec6=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0xec65[_0x5bf420];return _0x1c5255;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x5ec6('0x0'),'remove',_0x5ec6('0x1')];function createListener(_0x57a015,_0x510096){return function(_0x4f9aaa){_0x510096['emit'](_0x57a015,_0x4f9aaa);};}function removeListener(_0xf8873f,_0x49f147){return function(){CmListEvents['removeListener'](_0xf8873f,_0x49f147);};}exports[_0x5ec6('0x2')]=function(_0x2048d6){for(var _0x179082=0x0,_0x12b179=events[_0x5ec6('0x3')];_0x179082<_0x12b179;_0x179082++){var _0x2bfa25=events[_0x179082];var _0x270708=createListener(_0x5ec6('0x4')+_0x2bfa25,_0x2048d6);CmListEvents['on'](_0x2bfa25,_0x270708);}}; \ No newline at end of file +var _0x827e=['length','cmList:','save','remove','update','emit','removeListener'];(function(_0x44ae1b,_0x2cc392){var _0xd17918=function(_0x3a641a){while(--_0x3a641a){_0x44ae1b['push'](_0x44ae1b['shift']());}};_0xd17918(++_0x2cc392);}(_0x827e,0x1e5));var _0xe827=function(_0x68108e,_0x9cfc45){_0x68108e=_0x68108e-0x0;var _0x4c770a=_0x827e[_0x68108e];return _0x4c770a;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xe827('0x0'),_0xe827('0x1'),_0xe827('0x2')];function createListener(_0x25e5d0,_0x289e02){return function(_0x50bc35){_0x289e02[_0xe827('0x3')](_0x25e5d0,_0x50bc35);};}function removeListener(_0x1b488c,_0x265255){return function(){CmListEvents[_0xe827('0x4')](_0x1b488c,_0x265255);};}exports['register']=function(_0x58d1dc){for(var _0x1a314f=0x0,_0x3e8fb4=events[_0xe827('0x5')];_0x1a314f<_0x3e8fb4;_0x1a314f++){var _0xabddef=events[_0x1a314f];var _0x3a040e=createListener(_0xe827('0x6')+_0xabddef,_0x58d1dc);CmListEvents['on'](_0xabddef,_0x3a040e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3b46f3f..26d0450 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 _0x89b2=['put','/:id','update','delete','destroy','removeDispositions','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','isAuthenticated','show','/:id/dispositions','/:id/contacts/csv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','/:id/fields','addAgents'];(function(_0x489041,_0x777609){var _0xdad2ff=function(_0x516b5a){while(--_0x516b5a){_0x489041['push'](_0x489041['shift']());}};_0xdad2ff(++_0x777609);}(_0x89b2,0xc6));var _0x289b=function(_0x1cfc39,_0x15adef){_0x1cfc39=_0x1cfc39-0x0;var _0x1ae59b=_0x89b2[_0x1cfc39];return _0x1ae59b;};'use strict';var multer=require(_0x289b('0x0'));var util=require(_0x289b('0x1'));var path=require(_0x289b('0x2'));var timeout=require(_0x289b('0x3'));var express=require(_0x289b('0x4'));var router=express[_0x289b('0x5')]();var fs_extra=require(_0x289b('0x6'));var auth=require(_0x289b('0x7'));var interaction=require(_0x289b('0x8'));var config=require(_0x289b('0x9'));var controller=require(_0x289b('0xa'));router[_0x289b('0xb')]('/',auth['isAuthenticated'](),controller[_0x289b('0xc')]);router['get']('/describe',auth[_0x289b('0xd')](),controller['describe']);router['get']('/:id',auth[_0x289b('0xd')](),controller[_0x289b('0xe')]);router[_0x289b('0xb')](_0x289b('0xf'),auth[_0x289b('0xd')](),controller['getDispositions']);router[_0x289b('0xb')]('/:id/contacts',auth[_0x289b('0xd')](),controller['getContacts']);router['get'](_0x289b('0x10'),auth[_0x289b('0xd')](),controller['getContactsCsv']);router[_0x289b('0xb')]('/:id/fields',auth[_0x289b('0xd')](),controller[_0x289b('0x11')]);router[_0x289b('0xb')](_0x289b('0x12'),auth[_0x289b('0xd')](),controller[_0x289b('0x13')]);router[_0x289b('0x14')]('/',auth[_0x289b('0xd')](),controller[_0x289b('0x15')]);router[_0x289b('0x14')](_0x289b('0xf'),auth[_0x289b('0xd')](),controller[_0x289b('0x16')]);router[_0x289b('0x14')]('/:id/contacts',auth[_0x289b('0xd')](),controller[_0x289b('0x17')]);router[_0x289b('0x14')](_0x289b('0x18'),auth[_0x289b('0xd')](),controller['addCustomField']);router[_0x289b('0x14')](_0x289b('0x12'),auth['isAuthenticated'](),controller[_0x289b('0x19')]);router[_0x289b('0x1a')](_0x289b('0x1b'),auth[_0x289b('0xd')](),controller[_0x289b('0x1c')]);router[_0x289b('0x1d')](_0x289b('0x1b'),auth[_0x289b('0xd')](),controller[_0x289b('0x1e')]);router[_0x289b('0x1d')](_0x289b('0xf'),auth[_0x289b('0xd')](),controller[_0x289b('0x1f')]);router[_0x289b('0x1d')]('/:id/users',auth[_0x289b('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xb3a9=['post','/:id/fields','addCustomField','/:id/users','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getAgents'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xb3a9,0x14c));var _0x9b3a=function(_0x827b9a,_0x3b1f72){_0x827b9a=_0x827b9a-0x0;var _0x25d5a6=_0xb3a9[_0x827b9a];return _0x25d5a6;};'use strict';var multer=require(_0x9b3a('0x0'));var util=require('util');var path=require(_0x9b3a('0x1'));var timeout=require(_0x9b3a('0x2'));var express=require(_0x9b3a('0x3'));var router=express[_0x9b3a('0x4')]();var fs_extra=require(_0x9b3a('0x5'));var auth=require(_0x9b3a('0x6'));var interaction=require(_0x9b3a('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x9b3a('0x8')]('/',auth[_0x9b3a('0x9')](),controller[_0x9b3a('0xa')]);router[_0x9b3a('0x8')](_0x9b3a('0xb'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0xc')]);router[_0x9b3a('0x8')](_0x9b3a('0xd'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0xe')]);router[_0x9b3a('0x8')](_0x9b3a('0xf'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x10')]);router[_0x9b3a('0x8')](_0x9b3a('0x11'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x12')]);router[_0x9b3a('0x8')]('/:id/contacts/csv',auth[_0x9b3a('0x9')](),controller['getContactsCsv']);router[_0x9b3a('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getCustomFields']);router[_0x9b3a('0x8')]('/:id/users',auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x13')]);router[_0x9b3a('0x14')]('/',auth[_0x9b3a('0x9')](),controller['create']);router[_0x9b3a('0x14')](_0x9b3a('0xf'),auth[_0x9b3a('0x9')](),controller['addDisposition']);router[_0x9b3a('0x14')]('/:id/contacts',auth[_0x9b3a('0x9')](),controller['addContacts']);router[_0x9b3a('0x14')](_0x9b3a('0x15'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x16')]);router[_0x9b3a('0x14')](_0x9b3a('0x17'),auth['isAuthenticated'](),controller[_0x9b3a('0x18')]);router[_0x9b3a('0x19')](_0x9b3a('0xd'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x1a')]);router['delete'](_0x9b3a('0xd'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x1b')]);router[_0x9b3a('0x1c')](_0x9b3a('0xf'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x1d')]);router[_0x9b3a('0x1c')]('/:id/users',auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x1e')]);module[_0x9b3a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 7804053..1285520 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 _0xfd3a=['exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x259a3e,_0x4a62a1){var _0x5745f4=function(_0x68385f){while(--_0x68385f){_0x259a3e['push'](_0x259a3e['shift']());}};_0x5745f4(++_0x4a62a1);}(_0xfd3a,0x1a9));var _0xafd3=function(_0x3a36e4,_0x420a62){_0x3a36e4=_0x3a36e4-0x0;var _0x3e3628=_0xfd3a[_0x3a36e4];return _0x3e3628;};'use strict';var Sequelize=require('sequelize');module[_0xafd3('0x0')]={'name':{'type':Sequelize[_0xafd3('0x1')],'get':function(_0x743326){return this[_0xafd3('0x2')](_0xafd3('0x3'));}},'field':{'type':Sequelize[_0xafd3('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xafd3('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xafd3('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x0e41=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0e41,0x108));var _0x10e4=function(_0x3671aa,_0x4d4271){_0x3671aa=_0x3671aa-0x0;var _0x22b568=_0x0e41[_0x3671aa];return _0x22b568;};'use strict';var Sequelize=require(_0x10e4('0x0'));module[_0x10e4('0x1')]={'name':{'type':Sequelize[_0x10e4('0x2')],'get':function(_0xb4ccb5){return this[_0x10e4('0x3')](_0x10e4('0x4'));}},'field':{'type':Sequelize[_0x10e4('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x10e4('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x10e4('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 76e5350..7456121 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 _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xf0aae3,_0x5a7100){var _0x5963ba=function(_0x1c135f){while(--_0x1c135f){_0xf0aae3['push'](_0xf0aae3['shift']());}};_0x5963ba(++_0x5a7100);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x3bcdc3,_0x520f29){var _0x3db304=function(_0x265e85){while(--_0x265e85){_0x3bcdc3['push'](_0x3bcdc3['shift']());}};_0x3db304(++_0x520f29);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 86327f6..8224524 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 _0x5cd9=['../../config/environment','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5cd9,0xeb));var _0x95cd=function(_0x53f52c,_0x2444e3){_0x53f52c=_0x53f52c-0x0;var _0x5899a3=_0x5cd9[_0x53f52c];return _0x5899a3;};'use strict';var _=require(_0x95cd('0x0'));var util=require(_0x95cd('0x1'));var logger=require(_0x95cd('0x2'))(_0x95cd('0x3'));var moment=require(_0x95cd('0x4'));var BPromise=require(_0x95cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95cd('0x6'));var rimraf=require(_0x95cd('0x7'));var config=require(_0x95cd('0x8'));var attributes=require('./condition.attributes');module['exports']=function(_0x357a9c,_0x4f75fa){return _0x357a9c['define']('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd53=['api','moment','request-promise','path','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xfd53,0xae));var _0x3fd5=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xfd53[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x3fd5('0x0'));var util=require(_0x3fd5('0x1'));var logger=require('../../config/logger')(_0x3fd5('0x2'));var moment=require(_0x3fd5('0x3'));var BPromise=require('bluebird');var rp=require(_0x3fd5('0x4'));var fs=require('fs');var path=require(_0x3fd5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fd5('0x6'));module[_0x3fd5('0x7')]=function(_0x14f194,_0x1bf93e){return _0x14f194[_0x3fd5('0x8')](_0x3fd5('0x9'),attributes,{'tableName':_0x3fd5('0xa'),'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 7bbcf56..d4a20ad 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 _0x093c=['error','code','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','debug','stringify'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x093c,0x74));var _0xc093=function(_0x23276e,_0x575e65){_0x23276e=_0x23276e-0x0;var _0x3fe3be=_0x093c[_0x23276e];return _0x3fe3be;};'use strict';var _=require(_0xc093('0x0'));var util=require(_0xc093('0x1'));var moment=require(_0xc093('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc093('0x3'))['db'];var utils=require(_0xc093('0x4'));var logger=require(_0xc093('0x5'))(_0xc093('0x6'));var config=require(_0xc093('0x7'));var jayson=require(_0xc093('0x8'));var client=jayson[_0xc093('0x9')][_0xc093('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x437dc5,_0x1259a3,_0x402cc1){return new BPromise(function(_0x31332e,_0x21a8ac){return client['request'](_0x437dc5,_0x402cc1)[_0xc093('0xb')](function(_0xf44c14){logger[_0xc093('0xc')](_0xc093('0xd'),_0x1259a3,'request\x20sent');logger[_0xc093('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x1259a3,'request\x20sent',JSON[_0xc093('0xf')](_0xf44c14));if(_0xf44c14[_0xc093('0x10')]){if(_0xf44c14[_0xc093('0x10')][_0xc093('0x11')]===0x1f4){logger[_0xc093('0x10')](_0xc093('0xd'),_0x1259a3,_0xf44c14[_0xc093('0x10')][_0xc093('0x12')]);return _0x21a8ac(_0xf44c14[_0xc093('0x10')][_0xc093('0x12')]);}logger[_0xc093('0x10')]('Condition,\x20%s,\x20%s',_0x1259a3,_0xf44c14[_0xc093('0x10')][_0xc093('0x12')]);return _0x31332e(_0xf44c14['error'][_0xc093('0x12')]);}else{logger[_0xc093('0xc')]('Condition,\x20%s,\x20%s',_0x1259a3,_0xc093('0x13'));_0x31332e(_0xf44c14[_0xc093('0x14')][_0xc093('0x12')]);}})[_0xc093('0x15')](function(_0x142f5d){logger[_0xc093('0x10')](_0xc093('0xd'),_0x1259a3,_0x142f5d);_0x21a8ac(_0x142f5d);});});} \ No newline at end of file +var _0x5db4=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','ioredis'];(function(_0x3cd4a3,_0x192a4d){var _0x3eba9b=function(_0x402286){while(--_0x402286){_0x3cd4a3['push'](_0x3cd4a3['shift']());}};_0x3eba9b(++_0x192a4d);}(_0x5db4,0x1b1));var _0x45db=function(_0x540885,_0x1390e2){_0x540885=_0x540885-0x0;var _0x338d05=_0x5db4[_0x540885];return _0x338d05;};'use strict';var _=require('lodash');var util=require(_0x45db('0x0'));var moment=require(_0x45db('0x1'));var BPromise=require(_0x45db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45db('0x3'));var db=require(_0x45db('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x45db('0x5'))(_0x45db('0x6'));var config=require(_0x45db('0x7'));var jayson=require(_0x45db('0x8'));var client=jayson[_0x45db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36ff78,_0x2ebaa7,_0x16ff42){return new BPromise(function(_0x4472ae,_0x20f171){return client[_0x45db('0xa')](_0x36ff78,_0x16ff42)[_0x45db('0xb')](function(_0x468ca7){logger[_0x45db('0xc')](_0x45db('0xd'),_0x2ebaa7,'request\x20sent');logger[_0x45db('0xe')](_0x45db('0xf'),_0x2ebaa7,'request\x20sent',JSON[_0x45db('0x10')](_0x468ca7));if(_0x468ca7[_0x45db('0x11')]){if(_0x468ca7[_0x45db('0x11')][_0x45db('0x12')]===0x1f4){logger[_0x45db('0x11')]('Condition,\x20%s,\x20%s',_0x2ebaa7,_0x468ca7['error'][_0x45db('0x13')]);return _0x20f171(_0x468ca7[_0x45db('0x11')][_0x45db('0x13')]);}logger[_0x45db('0x11')](_0x45db('0xd'),_0x2ebaa7,_0x468ca7[_0x45db('0x11')]['message']);return _0x4472ae(_0x468ca7[_0x45db('0x11')][_0x45db('0x13')]);}else{logger['info'](_0x45db('0xd'),_0x2ebaa7,_0x45db('0x14'));_0x4472ae(_0x468ca7[_0x45db('0x15')][_0x45db('0x13')]);}})[_0x45db('0x16')](function(_0x27a7bc){logger[_0x45db('0x11')](_0x45db('0xd'),_0x2ebaa7,_0x27a7bc);_0x20f171(_0x27a7bc);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d1f73af..8206d7a 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 _0x82ec=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./condition.controller','put'];(function(_0x1b82d8,_0xee3528){var _0x18fa95=function(_0x2d1fe3){while(--_0x2d1fe3){_0x1b82d8['push'](_0x1b82d8['shift']());}};_0x18fa95(++_0xee3528);}(_0x82ec,0x106));var _0xc82e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x82ec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc82e('0x0'));var util=require(_0xc82e('0x1'));var path=require(_0xc82e('0x2'));var timeout=require(_0xc82e('0x3'));var express=require(_0xc82e('0x4'));var router=express[_0xc82e('0x5')]();var fs_extra=require(_0xc82e('0x6'));var auth=require(_0xc82e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc82e('0x8'));router[_0xc82e('0x9')](_0xc82e('0xa'),auth[_0xc82e('0xb')](),controller[_0xc82e('0xc')]);router[_0xc82e('0xd')](_0xc82e('0xa'),auth[_0xc82e('0xb')](),controller[_0xc82e('0xe')]);module[_0xc82e('0xf')]=router; \ No newline at end of file +var _0x58da=['../../components/interaction/service','../../config/environment','/:id','isAuthenticated','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x7d8569,_0x2810c8){var _0x1b7291=function(_0x59fa3){while(--_0x59fa3){_0x7d8569['push'](_0x7d8569['shift']());}};_0x1b7291(++_0x2810c8);}(_0x58da,0xcb));var _0xa58d=function(_0x185746,_0x139349){_0x185746=_0x185746-0x0;var _0xfe27ed=_0x58da[_0x185746];return _0xfe27ed;};'use strict';var multer=require(_0xa58d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa58d('0x1'));var router=express[_0xa58d('0x2')]();var fs_extra=require(_0xa58d('0x3'));var auth=require(_0xa58d('0x4'));var interaction=require(_0xa58d('0x5'));var config=require(_0xa58d('0x6'));var controller=require('./condition.controller');router['put'](_0xa58d('0x7'),auth[_0xa58d('0x8')](),controller[_0xa58d('0x9')]);router[_0xa58d('0xa')](_0xa58d('0x7'),auth[_0xa58d('0x8')](),controller[_0xa58d('0xb')]);module[_0xa58d('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c57c947..bfe7635 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x334fb8,_0x43a9d3){var _0x5d2f00=function(_0x5ec163){while(--_0x5ec163){_0x334fb8['push'](_0x334fb8['shift']());}};_0x5d2f00(++_0x43a9d3);}(_0x757a,0xde));var _0xa757=function(_0x3cc270,_0x4ea951){_0x3cc270=_0x3cc270-0x0;var _0x2386d1=_0x757a[_0x3cc270];return _0x2386d1;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x574088,_0x11d0cd){var _0xc563c8=function(_0x31faf5){while(--_0x31faf5){_0x574088['push'](_0x574088['shift']());}};_0xc563c8(++_0x11d0cd);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c4a8b,_0x402020){_0x4c4a8b=_0x4c4a8b-0x0;var _0x20fa14=_0xb10b[_0x4c4a8b];return _0x20fa14;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 73eec8d..ad2b72d 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 _0xde27=['model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','include','rows','show','params','intersection','merge','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','options','omit','createdAt','body','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','stringify','DashboardItem','getItems','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','get','CustomDashboards','UserProfileResource','end','sendStatus','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0xde27,0x18d));var _0x7de2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xde27[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x7de2('0x0'));var rimraf=require(_0x7de2('0x1'));var zipdir=require(_0x7de2('0x2'));var jsonpatch=require(_0x7de2('0x3'));var rp=require(_0x7de2('0x4'));var moment=require(_0x7de2('0x5'));var BPromise=require(_0x7de2('0x6'));var Mustache=require(_0x7de2('0x7'));var util=require(_0x7de2('0x8'));var path=require('path');var sox=require(_0x7de2('0x9'));var csv=require(_0x7de2('0xa'));var ejs=require(_0x7de2('0xb'));var fs=require('fs');var fs_extra=require(_0x7de2('0xc'));var _=require(_0x7de2('0xd'));var squel=require(_0x7de2('0xe'));var crypto=require(_0x7de2('0xf'));var jsforce=require(_0x7de2('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7de2('0xa'));var querystring=require(_0x7de2('0x11'));var Papa=require(_0x7de2('0x12'));var Redis=require('ioredis');var authService=require(_0x7de2('0x13'));var qs=require(_0x7de2('0x14'));var as=require(_0x7de2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7de2('0x16'));var utils=require('../../config/utils');var config=require(_0x7de2('0x17'));var licenseUtil=require(_0x7de2('0x18'));var db=require('../../mysqldb')['db'];config[_0x7de2('0x19')]=_[_0x7de2('0x1a')](config['redis'],{'host':_0x7de2('0x1b'),'port':0x18eb});var socket=require(_0x7de2('0x1c'))(new Redis(config[_0x7de2('0x19')]));require('./dashboard.socket')[_0x7de2('0x1d')](socket);function respondWithStatusCode(_0x4b85ab,_0x30a7b7){_0x30a7b7=_0x30a7b7||0xcc;return function(_0x2ae7dc){if(_0x2ae7dc){return _0x4b85ab['sendStatus'](_0x30a7b7);}return _0x4b85ab[_0x7de2('0x1e')](_0x30a7b7)['end']();};}function respondWithResult(_0x2d3013,_0x3b8304){_0x3b8304=_0x3b8304||0xc8;return function(_0x476b18){if(_0x476b18){return _0x2d3013['status'](_0x3b8304)[_0x7de2('0x1f')](_0x476b18);}};}function respondWithFilteredResult(_0x1dc440,_0x8d450f){return function(_0x2726f5){if(_0x2726f5){var _0x1b6dd0=typeof _0x8d450f[_0x7de2('0x20')]===_0x7de2('0x21')&&typeof _0x8d450f[_0x7de2('0x22')]===_0x7de2('0x21');var _0xba4280=_0x2726f5[_0x7de2('0x23')];var _0x315458=_0x1b6dd0?0x0:_0x8d450f[_0x7de2('0x20')];var _0x5232cf=_0x1b6dd0?_0x2726f5[_0x7de2('0x23')]:_0x8d450f['offset']+_0x8d450f['limit'];var _0x4111ce;if(_0x5232cf>=_0xba4280){_0x5232cf=_0xba4280;_0x4111ce=0xc8;}else{_0x4111ce=0xce;}_0x1dc440['status'](_0x4111ce);return _0x1dc440[_0x7de2('0x24')](_0x7de2('0x25'),_0x315458+'-'+_0x5232cf+'/'+_0xba4280)[_0x7de2('0x1f')](_0x2726f5);}return null;};}function patchUpdates(_0x19bec1){return function(_0x278398){try{jsonpatch['apply'](_0x278398,_0x19bec1,!![]);}catch(_0x7c4df6){return BPromise[_0x7de2('0x26')](_0x7c4df6);}return _0x278398['save']();};}function saveUpdates(_0x41470a,_0x5e3f7f){return function(_0x23a08f){if(_0x23a08f){return _0x23a08f[_0x7de2('0x27')](_0x41470a)['then'](function(_0x5134be){return _0x5134be;});}return null;};}function removeEntity(_0x5b97f4,_0x473eea){return function(_0x1ea268){if(_0x1ea268){return _0x1ea268[_0x7de2('0x28')]()[_0x7de2('0x29')](function(){var _0x5a7419=_0x1ea268[_0x7de2('0x2a')]({'plain':!![]});var _0xb52d64=_0x7de2('0x2b');return db[_0x7de2('0x2c')][_0x7de2('0x28')]({'where':{'type':_0xb52d64,'resourceId':_0x5a7419['id']}})[_0x7de2('0x29')](function(){return _0x1ea268;});})[_0x7de2('0x29')](function(){_0x5b97f4[_0x7de2('0x1e')](0xcc)[_0x7de2('0x2d')]();});}};}function handleEntityNotFound(_0x3248cf,_0x48e54b){return function(_0x54480b){if(!_0x54480b){_0x3248cf[_0x7de2('0x2e')](0x194);}return _0x54480b;};}function handleError(_0x54dd25,_0x51e4e5){_0x51e4e5=_0x51e4e5||0x1f4;return function(_0x2c0c59){logger[_0x7de2('0x2f')](_0x2c0c59['stack']);if(_0x2c0c59[_0x7de2('0x30')]){delete _0x2c0c59['name'];}_0x54dd25[_0x7de2('0x1e')](_0x51e4e5)[_0x7de2('0x31')](_0x2c0c59);};}exports[_0x7de2('0x32')]=function(_0x2e3e30,_0x3e949c){var _0x460462={},_0x4b322f={},_0x1254bf={'count':0x0,'rows':[]};var _0x218276=_[_0x7de2('0x33')](db[_0x7de2('0x34')][_0x7de2('0x35')],function(_0x478ee5){return{'name':_0x478ee5[_0x7de2('0x36')],'type':_0x478ee5[_0x7de2('0x37')][_0x7de2('0x38')]};});_0x4b322f['model']=_[_0x7de2('0x33')](_0x218276,_0x7de2('0x30'));_0x4b322f[_0x7de2('0x39')]=_[_0x7de2('0x3a')](_0x2e3e30[_0x7de2('0x39')]);_0x4b322f['filters']=_['intersection'](_0x4b322f[_0x7de2('0x3b')],_0x4b322f[_0x7de2('0x39')]);_0x460462[_0x7de2('0x3c')]=_['intersection'](_0x4b322f['model'],qs['fields'](_0x2e3e30[_0x7de2('0x39')][_0x7de2('0x3d')]));_0x460462[_0x7de2('0x3c')]=_0x460462[_0x7de2('0x3c')][_0x7de2('0x3e')]?_0x460462[_0x7de2('0x3c')]:_0x4b322f[_0x7de2('0x3b')];if(!_0x2e3e30[_0x7de2('0x39')]['hasOwnProperty'](_0x7de2('0x3f'))){_0x460462[_0x7de2('0x22')]=qs[_0x7de2('0x22')](_0x2e3e30[_0x7de2('0x39')][_0x7de2('0x22')]);_0x460462[_0x7de2('0x20')]=qs['offset'](_0x2e3e30[_0x7de2('0x39')][_0x7de2('0x20')]);}_0x460462[_0x7de2('0x40')]=qs['sort'](_0x2e3e30[_0x7de2('0x39')][_0x7de2('0x41')]);_0x460462['where']=qs[_0x7de2('0x42')](_[_0x7de2('0x43')](_0x2e3e30[_0x7de2('0x39')],_0x4b322f['filters']),_0x218276);if(_0x2e3e30[_0x7de2('0x39')][_0x7de2('0x44')]){_0x460462[_0x7de2('0x45')]=_['merge'](_0x460462[_0x7de2('0x45')],{'$or':_['map'](_0x218276,function(_0x203635){if(_0x203635[_0x7de2('0x37')]!==_0x7de2('0x46')){var _0x3f00cd={};_0x3f00cd[_0x203635[_0x7de2('0x30')]]={'$like':'%'+_0x2e3e30['query'][_0x7de2('0x44')]+'%'};return _0x3f00cd;}})});}_0x460462=_['merge']({},_0x460462,_0x2e3e30['options']);var _0x2760ff={'where':_0x460462[_0x7de2('0x45')]};return db[_0x7de2('0x34')][_0x7de2('0x23')](_0x2760ff)['then'](function(_0x33d162){_0x1254bf[_0x7de2('0x23')]=_0x33d162;if(_0x2e3e30[_0x7de2('0x39')][_0x7de2('0x47')]){_0x460462[_0x7de2('0x48')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x460462);})['then'](function(_0x222387){_0x1254bf[_0x7de2('0x49')]=_0x222387;return _0x1254bf;})[_0x7de2('0x29')](respondWithFilteredResult(_0x3e949c,_0x460462))['catch'](handleError(_0x3e949c,null));};exports[_0x7de2('0x4a')]=function(_0x10853d,_0x331b9e){var _0x4209dc={'raw':![],'where':{'id':_0x10853d[_0x7de2('0x4b')]['id']}},_0x50aad4={};_0x50aad4['model']=_[_0x7de2('0x3a')](db[_0x7de2('0x34')][_0x7de2('0x35')]);_0x50aad4['query']=_[_0x7de2('0x3a')](_0x10853d['query']);_0x50aad4[_0x7de2('0x42')]=_[_0x7de2('0x4c')](_0x50aad4['model'],_0x50aad4['query']);_0x4209dc['attributes']=_[_0x7de2('0x4c')](_0x50aad4[_0x7de2('0x3b')],qs['fields'](_0x10853d[_0x7de2('0x39')]['fields']));_0x4209dc[_0x7de2('0x3c')]=_0x4209dc[_0x7de2('0x3c')]['length']?_0x4209dc[_0x7de2('0x3c')]:_0x50aad4['model'];if(_0x10853d[_0x7de2('0x39')][_0x7de2('0x47')]){_0x4209dc[_0x7de2('0x48')]=[{'all':!![]}];}_0x4209dc=_[_0x7de2('0x4d')]({},_0x4209dc,_0x10853d['options']);return db[_0x7de2('0x34')][_0x7de2('0x4e')](_0x4209dc)[_0x7de2('0x29')](handleEntityNotFound(_0x331b9e,null))[_0x7de2('0x29')](respondWithResult(_0x331b9e,null))[_0x7de2('0x4f')](handleError(_0x331b9e,null));};exports[_0x7de2('0x50')]=function(_0x2758e5,_0x53f461){return db[_0x7de2('0x34')]['create'](_0x2758e5['body'],{})['then'](function(_0x321a23){var _0x33b510=_0x2758e5[_0x7de2('0x51')][_0x7de2('0x2a')]({'plain':!![]});if(!_0x33b510)throw new Error(_0x7de2('0x52'));if(_0x33b510[_0x7de2('0x53')]==='user'){var _0x10a292=_0x321a23[_0x7de2('0x2a')]({'plain':!![]});var _0x45be36=_0x7de2('0x2b');return db[_0x7de2('0x54')][_0x7de2('0x4e')]({'where':{'name':_0x45be36,'userProfileId':_0x33b510[_0x7de2('0x55')]},'raw':!![]})['then'](function(_0x1d4ff3){if(_0x1d4ff3&&_0x1d4ff3['autoAssociation']===0x0){return db[_0x7de2('0x2c')][_0x7de2('0x50')]({'name':_0x10a292[_0x7de2('0x30')],'resourceId':_0x10a292['id'],'type':_0x1d4ff3[_0x7de2('0x30')],'sectionId':_0x1d4ff3['id']},{})[_0x7de2('0x29')](function(){return _0x321a23;});}else{return _0x321a23;}})[_0x7de2('0x4f')](function(_0xebc284){logger[_0x7de2('0x2f')](_0x7de2('0x56'),_0xebc284);throw _0xebc284;});}return _0x321a23;})[_0x7de2('0x29')](respondWithResult(_0x53f461,0xc9))[_0x7de2('0x4f')](handleError(_0x53f461,null));};exports['clone']=function(_0x370071,_0x1b01dd){var _0x24f2b2={'where':{'id':_0x370071['params']['id']}},_0x292a1b={};_0x292a1b['model']=_[_0x7de2('0x3a')](db['Dashboard'][_0x7de2('0x35')]);_0x24f2b2[_0x7de2('0x3c')]=_[_0x7de2('0x4c')](_0x292a1b[_0x7de2('0x3b')],qs[_0x7de2('0x3d')](_0x370071[_0x7de2('0x39')][_0x7de2('0x3d')]));_0x24f2b2['attributes']=_0x24f2b2[_0x7de2('0x3c')]['length']?_0x24f2b2['attributes']:_0x292a1b[_0x7de2('0x3b')];if(_0x370071[_0x7de2('0x39')][_0x7de2('0x47')]){_0x24f2b2[_0x7de2('0x48')]=[{'all':!![]}];}_0x24f2b2=_[_0x7de2('0x4d')]({},_0x24f2b2,_0x370071[_0x7de2('0x57')]);return db[_0x7de2('0x34')][_0x7de2('0x4e')](_0x24f2b2)[_0x7de2('0x29')](handleEntityNotFound(_0x1b01dd,null))['then'](function(_0x4a30e1){if(_0x4a30e1){var _0x49ebb6=_0x4a30e1[_0x7de2('0x2a')]({'plain':!![]});_0x49ebb6=qs[_0x7de2('0x58')](_0x49ebb6,['id',_0x7de2('0x59'),'updatedAt']);_0x370071['body']=_[_0x7de2('0x58')](_0x370071[_0x7de2('0x5a')],['id',_0x7de2('0x59'),'updatedAt']);return db[_0x7de2('0x34')][_0x7de2('0x50')](_[_0x7de2('0x4d')](_0x49ebb6,_0x370071[_0x7de2('0x5a')]),{'include':_0x370071[_0x7de2('0x39')][_0x7de2('0x47')]?[{'all':!![]}]:undefined})[_0x7de2('0x29')](function(_0x21a915){var _0x288b46=_0x370071[_0x7de2('0x51')]['get']({'plain':!![]});if(!_0x288b46)throw new Error(_0x7de2('0x52'));if(_0x288b46[_0x7de2('0x53')]===_0x7de2('0x51')){var _0x4d1a90=_0x21a915['get']({'plain':!![]});var _0x4d6348=_0x7de2('0x2b');return db['UserProfileSection'][_0x7de2('0x4e')]({'where':{'name':_0x4d6348,'userProfileId':_0x288b46['userProfileId']},'raw':!![]})[_0x7de2('0x29')](function(_0xc7b592){if(_0xc7b592&&_0xc7b592['autoAssociation']===0x0){return db[_0x7de2('0x2c')][_0x7de2('0x50')]({'name':_0x4d1a90[_0x7de2('0x30')],'resourceId':_0x4d1a90['id'],'type':_0xc7b592[_0x7de2('0x30')],'sectionId':_0xc7b592['id']},{})[_0x7de2('0x29')](function(){return _0x21a915;});}else{return _0x21a915;}})['catch'](function(_0x2a0fff){logger[_0x7de2('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a0fff);throw _0x2a0fff;});}return _0x21a915;});}})[_0x7de2('0x29')](respondWithResult(_0x1b01dd,0xc9))['catch'](handleError(_0x1b01dd,null));};exports[_0x7de2('0x27')]=function(_0x4ff129,_0x2b8904){if(_0x4ff129[_0x7de2('0x5a')]['id']){delete _0x4ff129[_0x7de2('0x5a')]['id'];}return db[_0x7de2('0x34')][_0x7de2('0x4e')]({'where':{'id':_0x4ff129['params']['id']}})[_0x7de2('0x29')](handleEntityNotFound(_0x2b8904,null))['then'](saveUpdates(_0x4ff129[_0x7de2('0x5a')],null))[_0x7de2('0x29')](respondWithResult(_0x2b8904,null))[_0x7de2('0x4f')](handleError(_0x2b8904,null));};exports['destroy']=function(_0x20e09b,_0x114997){return db['Dashboard'][_0x7de2('0x4e')]({'where':{'id':_0x20e09b[_0x7de2('0x4b')]['id']}})[_0x7de2('0x29')](handleEntityNotFound(_0x114997,null))[_0x7de2('0x29')](removeEntity(_0x114997,null))[_0x7de2('0x4f')](handleError(_0x114997,null));};function widgetAttributes(_0x17f624){try{switch(_0x17f624[_0x7de2('0x37')]){case'iframe':return[{'name':_0x7de2('0x5b'),'value':_0x17f624[_0x7de2('0x5b')]||(_0x17f624['attrs']&&_0x17f624['attrs'][0x0]?_0x17f624[_0x7de2('0x5c')][0x0]['value']:undefined)||_0x7de2('0x5d')}];case _0x7de2('0x5e'):return[{'name':_0x7de2('0x5f'),'value':_0x17f624[_0x7de2('0x5f')]||(_0x17f624['attrs']&&_0x17f624[_0x7de2('0x5c')][0x0]?_0x17f624[_0x7de2('0x5c')][0x0][_0x7de2('0x60')]:undefined)||''}];case _0x7de2('0x61'):return[{'name':_0x7de2('0x62'),'value':_0x17f624[_0x7de2('0x62')]||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624['attrs'][0x0]?_0x17f624['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x7de2('0x63'),'value':_0x17f624[_0x7de2('0x63')]||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624[_0x7de2('0x5c')][0x1]?_0x17f624[_0x7de2('0x5c')][0x1][_0x7de2('0x60')]:undefined)||_0x7de2('0x64')},{'name':_0x7de2('0x65'),'value':_0x17f624[_0x7de2('0x65')]||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624[_0x7de2('0x5c')][0x2]?_0x17f624['attrs'][0x2][_0x7de2('0x60')]:undefined)||0xc}];case _0x7de2('0x66'):return[{'name':_0x7de2('0x67'),'value':_0x17f624[_0x7de2('0x67')]||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624[_0x7de2('0x5c')][0x0]?_0x17f624[_0x7de2('0x5c')][0x0][_0x7de2('0x60')]:undefined)||_0x7de2('0x68')},{'name':_0x7de2('0x69'),'value':_0x17f624['attrVoiceQueues']||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624['attrs'][0x1]?_0x17f624[_0x7de2('0x5c')][0x1][_0x7de2('0x60')]:undefined)||[]},{'name':_0x7de2('0x65'),'value':_0x17f624[_0x7de2('0x65')]||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624['attrs'][0x2]?_0x17f624['attrs'][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x17f624[_0x7de2('0x6a')]||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624[_0x7de2('0x5c')][0x0]?_0x17f624['attrs'][0x0][_0x7de2('0x60')]:undefined)||_0x7de2('0x68')},{'name':'attrSerie2','value':_0x17f624[_0x7de2('0x6b')]||(_0x17f624['attrs']&&_0x17f624[_0x7de2('0x5c')][0x1]?_0x17f624[_0x7de2('0x5c')][0x1][_0x7de2('0x60')]:undefined)||null},{'name':_0x7de2('0x6c'),'value':_0x17f624['attrSerie3']||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624['attrs'][0x2]?_0x17f624[_0x7de2('0x5c')][0x2][_0x7de2('0x60')]:undefined)||null},{'name':_0x7de2('0x69'),'value':_0x17f624['attrVoiceQueues']||(_0x17f624[_0x7de2('0x5c')]&&_0x17f624[_0x7de2('0x5c')][0x3]?_0x17f624[_0x7de2('0x5c')][0x3][_0x7de2('0x60')]:undefined)||[]}];case'web-report':return[{'name':_0x7de2('0x6d'),'type':_0x17f624['reportType']||(_0x17f624['attrs']&&_0x17f624[_0x7de2('0x5c')][0x0]?_0x17f624['attrs'][0x0][_0x7de2('0x37')]:undefined)||null,'value':_0x17f624['attrReport']||(_0x17f624['attrs']&&_0x17f624[_0x7de2('0x5c')][0x0]?_0x17f624[_0x7de2('0x5c')][0x0][_0x7de2('0x60')]:undefined)||null},{'name':_0x7de2('0x6e'),'value':_0x17f624[_0x7de2('0x6e')]||(_0x17f624['attrs']&&_0x17f624[_0x7de2('0x5c')][0x1]?_0x17f624[_0x7de2('0x5c')][0x1][_0x7de2('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x462623){logger['error']('widgetAttributes:\x20%s',JSON[_0x7de2('0x6f')](_0x462623));return[];}}exports['addItem']=function(_0x495678,_0x32a784,_0x24027e){if(_0x495678[_0x7de2('0x5a')]['id']){delete _0x495678['body']['id'];}return db[_0x7de2('0x34')][_0x7de2('0x4e')]({'where':{'id':_0x495678[_0x7de2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32a784,null))[_0x7de2('0x29')](function(_0x41d6e8){if(_0x41d6e8){_0x495678[_0x7de2('0x5a')]['DashboardId']=_0x41d6e8['id'];_0x495678[_0x7de2('0x5a')][_0x7de2('0x5c')]=widgetAttributes(_0x495678[_0x7de2('0x5a')]);return db[_0x7de2('0x70')][_0x7de2('0x50')](_0x495678[_0x7de2('0x5a')]);}})[_0x7de2('0x29')](respondWithResult(_0x32a784,null))[_0x7de2('0x4f')](handleError(_0x32a784,null));};exports[_0x7de2('0x71')]=function(_0xdbab15,_0x14ff51,_0xfd977b){var _0x201774={};var _0x18e74c={};var _0x1aa57c;var _0x165ee1;return db[_0x7de2('0x34')]['findOne']({'where':{'id':_0xdbab15[_0x7de2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14ff51,null))[_0x7de2('0x29')](function(_0x7f84f8){if(_0x7f84f8){_0x1aa57c=_0x7f84f8;_0x18e74c['model']=_[_0x7de2('0x3a')](db['DashboardItem']['rawAttributes']);_0x18e74c[_0x7de2('0x39')]=_['keys'](_0xdbab15[_0x7de2('0x39')]);_0x18e74c[_0x7de2('0x42')]=_['intersection'](_0x18e74c['model'],_0x18e74c[_0x7de2('0x39')]);_0x201774[_0x7de2('0x3c')]=_[_0x7de2('0x4c')](_0x18e74c['model'],qs[_0x7de2('0x3d')](_0xdbab15['query'][_0x7de2('0x3d')]));_0x201774[_0x7de2('0x3c')]=_0x201774[_0x7de2('0x3c')][_0x7de2('0x3e')]?_0x201774[_0x7de2('0x3c')]:_0x18e74c['model'];_0x201774[_0x7de2('0x40')]=qs['sort'](_0xdbab15[_0x7de2('0x39')]['sort']);_0x201774[_0x7de2('0x45')]=qs[_0x7de2('0x42')](_[_0x7de2('0x43')](_0xdbab15['query'],_0x18e74c['filters']));if(_0xdbab15[_0x7de2('0x39')][_0x7de2('0x44')]){_0x201774[_0x7de2('0x45')]=_[_0x7de2('0x4d')](_0x201774[_0x7de2('0x45')],{'$or':_[_0x7de2('0x33')](_0x201774[_0x7de2('0x3c')],function(_0x1b03c0){var _0x12aa15={};_0x12aa15[_0x1b03c0]={'$like':'%'+_0xdbab15['query']['filter']+'%'};return _0x12aa15;})});}_0x201774=_[_0x7de2('0x4d')]({},_0x201774,_0xdbab15[_0x7de2('0x57')]);return _0x1aa57c['getItems'](_0x201774);}})[_0x7de2('0x29')](function(_0x36f539){if(_0x36f539){_0x165ee1=_0x36f539['length'];if(!_0xdbab15['query']['hasOwnProperty'](_0x7de2('0x3f'))){_0x201774[_0x7de2('0x22')]=qs[_0x7de2('0x22')](_0xdbab15[_0x7de2('0x39')][_0x7de2('0x22')]);_0x201774['offset']=qs[_0x7de2('0x20')](_0xdbab15[_0x7de2('0x39')][_0x7de2('0x20')]);}return _0x1aa57c[_0x7de2('0x71')](_0x201774);}})[_0x7de2('0x29')](function(_0x592750){if(_0x592750){return _0x592750?{'count':_0x165ee1,'rows':_0x592750}:null;}})[_0x7de2('0x29')](respondWithResult(_0x14ff51,null))[_0x7de2('0x4f')](handleError(_0x14ff51,null));}; \ No newline at end of file +var _0x3c3a=['getItems','findOne','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','error','stack','name','index','rawAttributes','fieldName','key','model','map','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','Dashboard','includeAll','include','findAll','rows','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','updatedAt','omit','body','createdAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3c3a,0x180));var _0xa3c3=function(_0x593ee1,_0x55167f){_0x593ee1=_0x593ee1-0x0;var _0x1d2613=_0x3c3a[_0x593ee1];return _0x1d2613;};'use strict';var emlformat=require(_0xa3c3('0x0'));var rimraf=require(_0xa3c3('0x1'));var zipdir=require(_0xa3c3('0x2'));var jsonpatch=require(_0xa3c3('0x3'));var rp=require(_0xa3c3('0x4'));var moment=require(_0xa3c3('0x5'));var BPromise=require(_0xa3c3('0x6'));var Mustache=require('mustache');var util=require(_0xa3c3('0x7'));var path=require(_0xa3c3('0x8'));var sox=require(_0xa3c3('0x9'));var csv=require(_0xa3c3('0xa'));var ejs=require(_0xa3c3('0xb'));var fs=require('fs');var fs_extra=require(_0xa3c3('0xc'));var _=require('lodash');var squel=require(_0xa3c3('0xd'));var crypto=require(_0xa3c3('0xe'));var jsforce=require(_0xa3c3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3c3('0x10'));var Papa=require('papaparse');var Redis=require(_0xa3c3('0x11'));var authService=require(_0xa3c3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa3c3('0x13'));var hardwareService=require(_0xa3c3('0x14'));var logger=require(_0xa3c3('0x15'))(_0xa3c3('0x16'));var utils=require('../../config/utils');var config=require(_0xa3c3('0x17'));var licenseUtil=require(_0xa3c3('0x18'));var db=require(_0xa3c3('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa3c3('0x1a'),'port':0x18eb});var socket=require(_0xa3c3('0x1b'))(new Redis(config['redis']));require(_0xa3c3('0x1c'))[_0xa3c3('0x1d')](socket);function respondWithStatusCode(_0x29073c,_0x1c10aa){_0x1c10aa=_0x1c10aa||0xcc;return function(_0x24068e){if(_0x24068e){return _0x29073c[_0xa3c3('0x1e')](_0x1c10aa);}return _0x29073c[_0xa3c3('0x1f')](_0x1c10aa)[_0xa3c3('0x20')]();};}function respondWithResult(_0x150183,_0x3a9471){_0x3a9471=_0x3a9471||0xc8;return function(_0x591b13){if(_0x591b13){return _0x150183[_0xa3c3('0x1f')](_0x3a9471)[_0xa3c3('0x21')](_0x591b13);}};}function respondWithFilteredResult(_0x3c849a,_0x3ec957){return function(_0x591897){if(_0x591897){var _0x2c079e=typeof _0x3ec957[_0xa3c3('0x22')]===_0xa3c3('0x23')&&typeof _0x3ec957[_0xa3c3('0x24')]==='undefined';var _0x279ee8=_0x591897[_0xa3c3('0x25')];var _0x1e3287=_0x2c079e?0x0:_0x3ec957[_0xa3c3('0x22')];var _0x1d02a1=_0x2c079e?_0x591897[_0xa3c3('0x25')]:_0x3ec957['offset']+_0x3ec957['limit'];var _0x3d93e4;if(_0x1d02a1>=_0x279ee8){_0x1d02a1=_0x279ee8;_0x3d93e4=0xc8;}else{_0x3d93e4=0xce;}_0x3c849a['status'](_0x3d93e4);return _0x3c849a[_0xa3c3('0x26')](_0xa3c3('0x27'),_0x1e3287+'-'+_0x1d02a1+'/'+_0x279ee8)[_0xa3c3('0x21')](_0x591897);}return null;};}function patchUpdates(_0x132e62){return function(_0x133c80){try{jsonpatch[_0xa3c3('0x28')](_0x133c80,_0x132e62,!![]);}catch(_0x36be91){return BPromise[_0xa3c3('0x29')](_0x36be91);}return _0x133c80[_0xa3c3('0x2a')]();};}function saveUpdates(_0x4527fc,_0x1892ac){return function(_0x57da6c){if(_0x57da6c){return _0x57da6c[_0xa3c3('0x2b')](_0x4527fc)[_0xa3c3('0x2c')](function(_0x43142d){return _0x43142d;});}return null;};}function removeEntity(_0x29dc99,_0x3e70bf){return function(_0x443c3a){if(_0x443c3a){return _0x443c3a[_0xa3c3('0x2d')]()['then'](function(){var _0x3bfa4f=_0x443c3a[_0xa3c3('0x2e')]({'plain':!![]});var _0x2022aa=_0xa3c3('0x2f');return db['UserProfileResource'][_0xa3c3('0x2d')]({'where':{'type':_0x2022aa,'resourceId':_0x3bfa4f['id']}})['then'](function(){return _0x443c3a;});})[_0xa3c3('0x2c')](function(){_0x29dc99[_0xa3c3('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24b905,_0x58492c){return function(_0x310475){if(!_0x310475){_0x24b905[_0xa3c3('0x1e')](0x194);}return _0x310475;};}function handleError(_0x37ba02,_0x21d1a9){_0x21d1a9=_0x21d1a9||0x1f4;return function(_0xde644f){logger[_0xa3c3('0x30')](_0xde644f[_0xa3c3('0x31')]);if(_0xde644f[_0xa3c3('0x32')]){delete _0xde644f[_0xa3c3('0x32')];}_0x37ba02[_0xa3c3('0x1f')](_0x21d1a9)['send'](_0xde644f);};}exports[_0xa3c3('0x33')]=function(_0x30a70d,_0x24fba1){var _0x35ca11={},_0x23f9d4={},_0x279a59={'count':0x0,'rows':[]};var _0x3d3237=_['map'](db['Dashboard'][_0xa3c3('0x34')],function(_0x58345f){return{'name':_0x58345f[_0xa3c3('0x35')],'type':_0x58345f['type'][_0xa3c3('0x36')]};});_0x23f9d4[_0xa3c3('0x37')]=_[_0xa3c3('0x38')](_0x3d3237,'name');_0x23f9d4['query']=_[_0xa3c3('0x39')](_0x30a70d['query']);_0x23f9d4[_0xa3c3('0x3a')]=_[_0xa3c3('0x3b')](_0x23f9d4[_0xa3c3('0x37')],_0x23f9d4['query']);_0x35ca11['attributes']=_[_0xa3c3('0x3b')](_0x23f9d4[_0xa3c3('0x37')],qs[_0xa3c3('0x3c')](_0x30a70d[_0xa3c3('0x3d')][_0xa3c3('0x3c')]));_0x35ca11[_0xa3c3('0x3e')]=_0x35ca11['attributes'][_0xa3c3('0x3f')]?_0x35ca11[_0xa3c3('0x3e')]:_0x23f9d4[_0xa3c3('0x37')];if(!_0x30a70d[_0xa3c3('0x3d')][_0xa3c3('0x40')]('nolimit')){_0x35ca11[_0xa3c3('0x24')]=qs['limit'](_0x30a70d[_0xa3c3('0x3d')][_0xa3c3('0x24')]);_0x35ca11['offset']=qs[_0xa3c3('0x22')](_0x30a70d[_0xa3c3('0x3d')][_0xa3c3('0x22')]);}_0x35ca11[_0xa3c3('0x41')]=qs['sort'](_0x30a70d[_0xa3c3('0x3d')][_0xa3c3('0x42')]);_0x35ca11[_0xa3c3('0x43')]=qs[_0xa3c3('0x3a')](_[_0xa3c3('0x44')](_0x30a70d[_0xa3c3('0x3d')],_0x23f9d4['filters']),_0x3d3237);if(_0x30a70d[_0xa3c3('0x3d')][_0xa3c3('0x45')]){_0x35ca11[_0xa3c3('0x43')]=_[_0xa3c3('0x46')](_0x35ca11[_0xa3c3('0x43')],{'$or':_[_0xa3c3('0x38')](_0x3d3237,function(_0x4cd625){if(_0x4cd625[_0xa3c3('0x47')]!=='VIRTUAL'){var _0x3a1ea3={};_0x3a1ea3[_0x4cd625[_0xa3c3('0x32')]]={'$like':'%'+_0x30a70d[_0xa3c3('0x3d')][_0xa3c3('0x45')]+'%'};return _0x3a1ea3;}})});}_0x35ca11=_['merge']({},_0x35ca11,_0x30a70d['options']);var _0x347460={'where':_0x35ca11[_0xa3c3('0x43')]};return db[_0xa3c3('0x48')][_0xa3c3('0x25')](_0x347460)[_0xa3c3('0x2c')](function(_0x49dc05){_0x279a59[_0xa3c3('0x25')]=_0x49dc05;if(_0x30a70d['query'][_0xa3c3('0x49')]){_0x35ca11[_0xa3c3('0x4a')]=[{'all':!![]}];}return db['Dashboard'][_0xa3c3('0x4b')](_0x35ca11);})[_0xa3c3('0x2c')](function(_0xa6a283){_0x279a59[_0xa3c3('0x4c')]=_0xa6a283;return _0x279a59;})[_0xa3c3('0x2c')](respondWithFilteredResult(_0x24fba1,_0x35ca11))['catch'](handleError(_0x24fba1,null));};exports[_0xa3c3('0x4d')]=function(_0x21e49c,_0x255cf6){var _0x2d87f4={'raw':![],'where':{'id':_0x21e49c[_0xa3c3('0x4e')]['id']}},_0x45f5cb={};_0x45f5cb[_0xa3c3('0x37')]=_[_0xa3c3('0x39')](db[_0xa3c3('0x48')][_0xa3c3('0x34')]);_0x45f5cb[_0xa3c3('0x3d')]=_[_0xa3c3('0x39')](_0x21e49c['query']);_0x45f5cb[_0xa3c3('0x3a')]=_[_0xa3c3('0x3b')](_0x45f5cb[_0xa3c3('0x37')],_0x45f5cb[_0xa3c3('0x3d')]);_0x2d87f4[_0xa3c3('0x3e')]=_[_0xa3c3('0x3b')](_0x45f5cb[_0xa3c3('0x37')],qs[_0xa3c3('0x3c')](_0x21e49c[_0xa3c3('0x3d')][_0xa3c3('0x3c')]));_0x2d87f4['attributes']=_0x2d87f4['attributes']['length']?_0x2d87f4[_0xa3c3('0x3e')]:_0x45f5cb[_0xa3c3('0x37')];if(_0x21e49c['query'][_0xa3c3('0x49')]){_0x2d87f4['include']=[{'all':!![]}];}_0x2d87f4=_[_0xa3c3('0x46')]({},_0x2d87f4,_0x21e49c['options']);return db['Dashboard']['find'](_0x2d87f4)['then'](handleEntityNotFound(_0x255cf6,null))[_0xa3c3('0x2c')](respondWithResult(_0x255cf6,null))['catch'](handleError(_0x255cf6,null));};exports[_0xa3c3('0x4f')]=function(_0x3f1b62,_0x2ac61e){return db['Dashboard'][_0xa3c3('0x4f')](_0x3f1b62['body'],{})['then'](function(_0x27402c){var _0x3f922a=_0x3f1b62[_0xa3c3('0x50')][_0xa3c3('0x2e')]({'plain':!![]});if(!_0x3f922a)throw new Error(_0xa3c3('0x51'));if(_0x3f922a[_0xa3c3('0x52')]===_0xa3c3('0x50')){var _0x478c33=_0x27402c[_0xa3c3('0x2e')]({'plain':!![]});var _0x157413=_0xa3c3('0x2f');return db[_0xa3c3('0x53')][_0xa3c3('0x54')]({'where':{'name':_0x157413,'userProfileId':_0x3f922a[_0xa3c3('0x55')]},'raw':!![]})['then'](function(_0x125f44){if(_0x125f44&&_0x125f44[_0xa3c3('0x56')]===0x0){return db[_0xa3c3('0x57')][_0xa3c3('0x4f')]({'name':_0x478c33[_0xa3c3('0x32')],'resourceId':_0x478c33['id'],'type':_0x125f44['name'],'sectionId':_0x125f44['id']},{})[_0xa3c3('0x2c')](function(){return _0x27402c;});}else{return _0x27402c;}})[_0xa3c3('0x58')](function(_0x52dd42){logger[_0xa3c3('0x30')](_0xa3c3('0x59'),_0x52dd42);throw _0x52dd42;});}return _0x27402c;})[_0xa3c3('0x2c')](respondWithResult(_0x2ac61e,0xc9))[_0xa3c3('0x58')](handleError(_0x2ac61e,null));};exports['clone']=function(_0x6fb8e3,_0x792362){var _0x505d7={'where':{'id':_0x6fb8e3[_0xa3c3('0x4e')]['id']}},_0x2d11f7={};_0x2d11f7['model']=_[_0xa3c3('0x39')](db[_0xa3c3('0x48')][_0xa3c3('0x34')]);_0x505d7[_0xa3c3('0x3e')]=_[_0xa3c3('0x3b')](_0x2d11f7['model'],qs[_0xa3c3('0x3c')](_0x6fb8e3[_0xa3c3('0x3d')]['fields']));_0x505d7['attributes']=_0x505d7[_0xa3c3('0x3e')][_0xa3c3('0x3f')]?_0x505d7[_0xa3c3('0x3e')]:_0x2d11f7[_0xa3c3('0x37')];if(_0x6fb8e3[_0xa3c3('0x3d')]['includeAll']){_0x505d7[_0xa3c3('0x4a')]=[{'all':!![]}];}_0x505d7=_[_0xa3c3('0x46')]({},_0x505d7,_0x6fb8e3['options']);return db[_0xa3c3('0x48')][_0xa3c3('0x54')](_0x505d7)[_0xa3c3('0x2c')](handleEntityNotFound(_0x792362,null))[_0xa3c3('0x2c')](function(_0x3fe448){if(_0x3fe448){var _0x42599a=_0x3fe448[_0xa3c3('0x2e')]({'plain':!![]});_0x42599a=qs['omit'](_0x42599a,['id','createdAt',_0xa3c3('0x5a')]);_0x6fb8e3['body']=_[_0xa3c3('0x5b')](_0x6fb8e3[_0xa3c3('0x5c')],['id',_0xa3c3('0x5d'),_0xa3c3('0x5a')]);return db[_0xa3c3('0x48')][_0xa3c3('0x4f')](_['merge'](_0x42599a,_0x6fb8e3[_0xa3c3('0x5c')]),{'include':_0x6fb8e3['query']['includeAll']?[{'all':!![]}]:undefined})[_0xa3c3('0x2c')](function(_0x805a6f){var _0x5d41d1=_0x6fb8e3['user']['get']({'plain':!![]});if(!_0x5d41d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d41d1[_0xa3c3('0x52')]===_0xa3c3('0x50')){var _0x2bd92d=_0x805a6f[_0xa3c3('0x2e')]({'plain':!![]});var _0x46e8b7=_0xa3c3('0x2f');return db[_0xa3c3('0x53')]['find']({'where':{'name':_0x46e8b7,'userProfileId':_0x5d41d1['userProfileId']},'raw':!![]})[_0xa3c3('0x2c')](function(_0x1c29f5){if(_0x1c29f5&&_0x1c29f5[_0xa3c3('0x56')]===0x0){return db['UserProfileResource'][_0xa3c3('0x4f')]({'name':_0x2bd92d['name'],'resourceId':_0x2bd92d['id'],'type':_0x1c29f5['name'],'sectionId':_0x1c29f5['id']},{})['then'](function(){return _0x805a6f;});}else{return _0x805a6f;}})[_0xa3c3('0x58')](function(_0x5f12e0){logger[_0xa3c3('0x30')](_0xa3c3('0x59'),_0x5f12e0);throw _0x5f12e0;});}return _0x805a6f;});}})[_0xa3c3('0x2c')](respondWithResult(_0x792362,0xc9))[_0xa3c3('0x58')](handleError(_0x792362,null));};exports[_0xa3c3('0x2b')]=function(_0xb8aa85,_0x1139c3){if(_0xb8aa85[_0xa3c3('0x5c')]['id']){delete _0xb8aa85[_0xa3c3('0x5c')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xb8aa85['params']['id']}})[_0xa3c3('0x2c')](handleEntityNotFound(_0x1139c3,null))[_0xa3c3('0x2c')](saveUpdates(_0xb8aa85[_0xa3c3('0x5c')],null))['then'](respondWithResult(_0x1139c3,null))[_0xa3c3('0x58')](handleError(_0x1139c3,null));};exports[_0xa3c3('0x2d')]=function(_0x3afc60,_0x298734){return db['Dashboard']['find']({'where':{'id':_0x3afc60[_0xa3c3('0x4e')]['id']}})[_0xa3c3('0x2c')](handleEntityNotFound(_0x298734,null))['then'](removeEntity(_0x298734,null))[_0xa3c3('0x58')](handleError(_0x298734,null));};function widgetAttributes(_0x3c1133){try{switch(_0x3c1133['type']){case _0xa3c3('0x5e'):return[{'name':_0xa3c3('0x5f'),'value':_0x3c1133[_0xa3c3('0x5f')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133[_0xa3c3('0x60')][0x0]?_0x3c1133['attrs'][0x0][_0xa3c3('0x61')]:undefined)||_0xa3c3('0x62')}];case _0xa3c3('0x63'):return[{'name':_0xa3c3('0x64'),'value':_0x3c1133[_0xa3c3('0x64')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133[_0xa3c3('0x60')][0x0]?_0x3c1133[_0xa3c3('0x60')][0x0][_0xa3c3('0x61')]:undefined)||''}];case _0xa3c3('0x65'):return[{'name':_0xa3c3('0x66'),'value':_0x3c1133[_0xa3c3('0x66')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133[_0xa3c3('0x60')][0x0]?_0x3c1133['attrs'][0x0][_0xa3c3('0x61')]:undefined)||_0xa3c3('0x67')},{'name':_0xa3c3('0x68'),'value':_0x3c1133[_0xa3c3('0x68')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133['attrs'][0x1]?_0x3c1133[_0xa3c3('0x60')][0x1][_0xa3c3('0x61')]:undefined)||_0xa3c3('0x69')},{'name':'attrFontSize','value':_0x3c1133[_0xa3c3('0x6a')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133[_0xa3c3('0x60')][0x2]?_0x3c1133[_0xa3c3('0x60')][0x2][_0xa3c3('0x61')]:undefined)||0xc}];case _0xa3c3('0x6b'):return[{'name':_0xa3c3('0x6c'),'value':_0x3c1133[_0xa3c3('0x6c')]||(_0x3c1133['attrs']&&_0x3c1133[_0xa3c3('0x60')][0x0]?_0x3c1133[_0xa3c3('0x60')][0x0][_0xa3c3('0x61')]:undefined)||_0xa3c3('0x6d')},{'name':_0xa3c3('0x6e'),'value':_0x3c1133[_0xa3c3('0x6e')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133[_0xa3c3('0x60')][0x1]?_0x3c1133[_0xa3c3('0x60')][0x1][_0xa3c3('0x61')]:undefined)||[]},{'name':_0xa3c3('0x6a'),'value':_0x3c1133[_0xa3c3('0x6a')]||(_0x3c1133['attrs']&&_0x3c1133[_0xa3c3('0x60')][0x2]?_0x3c1133[_0xa3c3('0x60')][0x2][_0xa3c3('0x61')]:undefined)||0x14}];case _0xa3c3('0x6f'):case'pie-chart':return[{'name':_0xa3c3('0x70'),'value':_0x3c1133[_0xa3c3('0x70')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133['attrs'][0x0]?_0x3c1133[_0xa3c3('0x60')][0x0][_0xa3c3('0x61')]:undefined)||_0xa3c3('0x6d')},{'name':_0xa3c3('0x71'),'value':_0x3c1133[_0xa3c3('0x71')]||(_0x3c1133['attrs']&&_0x3c1133[_0xa3c3('0x60')][0x1]?_0x3c1133['attrs'][0x1][_0xa3c3('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0x3c1133[_0xa3c3('0x72')]||(_0x3c1133['attrs']&&_0x3c1133[_0xa3c3('0x60')][0x2]?_0x3c1133['attrs'][0x2][_0xa3c3('0x61')]:undefined)||null},{'name':_0xa3c3('0x6e'),'value':_0x3c1133[_0xa3c3('0x6e')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133[_0xa3c3('0x60')][0x3]?_0x3c1133[_0xa3c3('0x60')][0x3]['value']:undefined)||[]}];case _0xa3c3('0x73'):return[{'name':_0xa3c3('0x74'),'type':_0x3c1133[_0xa3c3('0x75')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133['attrs'][0x0]?_0x3c1133['attrs'][0x0][_0xa3c3('0x47')]:undefined)||null,'value':_0x3c1133[_0xa3c3('0x74')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133['attrs'][0x0]?_0x3c1133[_0xa3c3('0x60')][0x0][_0xa3c3('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x3c1133[_0xa3c3('0x76')]||(_0x3c1133[_0xa3c3('0x60')]&&_0x3c1133[_0xa3c3('0x60')][0x1]?_0x3c1133[_0xa3c3('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x180ad3){logger[_0xa3c3('0x30')](_0xa3c3('0x77'),JSON[_0xa3c3('0x78')](_0x180ad3));return[];}}exports[_0xa3c3('0x79')]=function(_0x442661,_0xa96f97,_0x42cec0){if(_0x442661[_0xa3c3('0x5c')]['id']){delete _0x442661[_0xa3c3('0x5c')]['id'];}return db[_0xa3c3('0x48')][_0xa3c3('0x54')]({'where':{'id':_0x442661[_0xa3c3('0x4e')]['id']}})[_0xa3c3('0x2c')](handleEntityNotFound(_0xa96f97,null))[_0xa3c3('0x2c')](function(_0x1de6e0){if(_0x1de6e0){_0x442661[_0xa3c3('0x5c')][_0xa3c3('0x7a')]=_0x1de6e0['id'];_0x442661[_0xa3c3('0x5c')][_0xa3c3('0x60')]=widgetAttributes(_0x442661[_0xa3c3('0x5c')]);return db[_0xa3c3('0x7b')][_0xa3c3('0x4f')](_0x442661[_0xa3c3('0x5c')]);}})[_0xa3c3('0x2c')](respondWithResult(_0xa96f97,null))['catch'](handleError(_0xa96f97,null));};exports[_0xa3c3('0x7c')]=function(_0x3a3d64,_0x3b2111,_0x43c9d1){var _0x15cbe8={};var _0x33101f={};var _0x12d029;var _0x2a2d22;return db['Dashboard'][_0xa3c3('0x7d')]({'where':{'id':_0x3a3d64[_0xa3c3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b2111,null))[_0xa3c3('0x2c')](function(_0x5b90a7){if(_0x5b90a7){_0x12d029=_0x5b90a7;_0x33101f[_0xa3c3('0x37')]=_[_0xa3c3('0x39')](db[_0xa3c3('0x7b')][_0xa3c3('0x34')]);_0x33101f[_0xa3c3('0x3d')]=_[_0xa3c3('0x39')](_0x3a3d64[_0xa3c3('0x3d')]);_0x33101f[_0xa3c3('0x3a')]=_[_0xa3c3('0x3b')](_0x33101f[_0xa3c3('0x37')],_0x33101f[_0xa3c3('0x3d')]);_0x15cbe8[_0xa3c3('0x3e')]=_[_0xa3c3('0x3b')](_0x33101f[_0xa3c3('0x37')],qs[_0xa3c3('0x3c')](_0x3a3d64[_0xa3c3('0x3d')][_0xa3c3('0x3c')]));_0x15cbe8[_0xa3c3('0x3e')]=_0x15cbe8[_0xa3c3('0x3e')][_0xa3c3('0x3f')]?_0x15cbe8[_0xa3c3('0x3e')]:_0x33101f[_0xa3c3('0x37')];_0x15cbe8[_0xa3c3('0x41')]=qs[_0xa3c3('0x42')](_0x3a3d64[_0xa3c3('0x3d')][_0xa3c3('0x42')]);_0x15cbe8[_0xa3c3('0x43')]=qs['filters'](_[_0xa3c3('0x44')](_0x3a3d64[_0xa3c3('0x3d')],_0x33101f['filters']));if(_0x3a3d64['query']['filter']){_0x15cbe8[_0xa3c3('0x43')]=_['merge'](_0x15cbe8[_0xa3c3('0x43')],{'$or':_[_0xa3c3('0x38')](_0x15cbe8[_0xa3c3('0x3e')],function(_0x23ee3f){var _0x4a6557={};_0x4a6557[_0x23ee3f]={'$like':'%'+_0x3a3d64[_0xa3c3('0x3d')]['filter']+'%'};return _0x4a6557;})});}_0x15cbe8=_['merge']({},_0x15cbe8,_0x3a3d64['options']);return _0x12d029[_0xa3c3('0x7c')](_0x15cbe8);}})[_0xa3c3('0x2c')](function(_0x5cfd8f){if(_0x5cfd8f){_0x2a2d22=_0x5cfd8f[_0xa3c3('0x3f')];if(!_0x3a3d64[_0xa3c3('0x3d')][_0xa3c3('0x40')](_0xa3c3('0x7e'))){_0x15cbe8[_0xa3c3('0x24')]=qs['limit'](_0x3a3d64['query'][_0xa3c3('0x24')]);_0x15cbe8['offset']=qs[_0xa3c3('0x22')](_0x3a3d64[_0xa3c3('0x3d')]['offset']);}return _0x12d029[_0xa3c3('0x7c')](_0x15cbe8);}})[_0xa3c3('0x2c')](function(_0x266688){if(_0x266688){return _0x266688?{'count':_0x2a2d22,'rows':_0x266688}:null;}})[_0xa3c3('0x2c')](respondWithResult(_0x3b2111,null))[_0xa3c3('0x58')](handleError(_0x3b2111,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b7a6961..8d09200 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 _0x8745=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5a43ab,_0x15a9e0){var _0x293a82=function(_0xc439f4){while(--_0xc439f4){_0x5a43ab['push'](_0x5a43ab['shift']());}};_0x293a82(++_0x15a9e0);}(_0x8745,0xc8));var _0x5874=function(_0x1eaa32,_0x12552){_0x1eaa32=_0x1eaa32-0x0;var _0x4946a7=_0x8745[_0x1eaa32];return _0x4946a7;};'use strict';var EventEmitter=require(_0x5874('0x0'));var Dashboard=require(_0x5874('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5874('0x2')](0x0);var events={'afterCreate':_0x5874('0x3'),'afterUpdate':'update','afterDestroy':_0x5874('0x4')};function emitEvent(_0x45a081){return function(_0x5a00e9,_0x57ac9,_0x3fa522){DashboardEvents[_0x5874('0x5')](_0x45a081+':'+_0x5a00e9['id'],_0x5a00e9);DashboardEvents[_0x5874('0x5')](_0x45a081,_0x5a00e9);_0x3fa522(null);};}for(var e in events){if(events[_0x5874('0x6')](e)){var event=events[e];Dashboard[_0x5874('0x7')](e,emitEvent(event));}}module[_0x5874('0x8')]=DashboardEvents; \ No newline at end of file +var _0x2d1d=['remove','emit','hook','exports','Dashboard','setMaxListeners','save'];(function(_0x415be3,_0x26aed5){var _0x44d987=function(_0x380411){while(--_0x380411){_0x415be3['push'](_0x415be3['shift']());}};_0x44d987(++_0x26aed5);}(_0x2d1d,0x10e));var _0xd2d1=function(_0xcffc1,_0x2bd0d6){_0xcffc1=_0xcffc1-0x0;var _0x34a376=_0x2d1d[_0xcffc1];return _0x34a376;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0xd2d1('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd2d1('0x1')](0x0);var events={'afterCreate':_0xd2d1('0x2'),'afterUpdate':'update','afterDestroy':_0xd2d1('0x3')};function emitEvent(_0x3438a5){return function(_0x30c0f0,_0x40b9d5,_0x5979f9){DashboardEvents['emit'](_0x3438a5+':'+_0x30c0f0['id'],_0x30c0f0);DashboardEvents[_0xd2d1('0x4')](_0x3438a5,_0x30c0f0);_0x5979f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xd2d1('0x5')](e,emitEvent(event));}}module[_0xd2d1('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index bc347d3..43130f2 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 _0x773a=['define','Dashboard','dashboards','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x1fed9d,_0x13b386){var _0x55e74a=function(_0x391311){while(--_0x391311){_0x1fed9d['push'](_0x1fed9d['shift']());}};_0x55e74a(++_0x13b386);}(_0x773a,0x1e0));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa773('0x0'));var BPromise=require(_0xa773('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa773('0x2'));var rimraf=require(_0xa773('0x3'));var config=require(_0xa773('0x4'));var attributes=require('./dashboard.attributes');module[_0xa773('0x5')]=function(_0x3cbebe,_0x3bf711){return _0x3cbebe[_0xa773('0x6')](_0xa773('0x7'),attributes,{'tableName':_0xa773('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6a5=['../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x584b9d,_0x1cb5c5){var _0x172053=function(_0x5036ec){while(--_0x5036ec){_0x584b9d['push'](_0x584b9d['shift']());}};_0x172053(++_0x1cb5c5);}(_0xf6a5,0x16d));var _0x5f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f6a('0x0'));var util=require(_0x5f6a('0x1'));var logger=require(_0x5f6a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5f6a('0x3'));var rp=require(_0x5f6a('0x4'));var fs=require('fs');var path=require(_0x5f6a('0x5'));var rimraf=require(_0x5f6a('0x6'));var config=require(_0x5f6a('0x7'));var attributes=require(_0x5f6a('0x8'));module['exports']=function(_0x2c0954,_0x59c438){return _0x2c0954[_0x5f6a('0x9')](_0x5f6a('0xa'),attributes,{'tableName':_0x5f6a('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 2b59677..849533c 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 _0x2443=['redis','defaults','localhost','socket.io-emitter','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x2443,0xce));var _0x3244=function(_0x52453b,_0x8b259b){_0x52453b=_0x52453b-0x0;var _0xa97239=_0x2443[_0x52453b];return _0xa97239;};'use strict';var _=require(_0x3244('0x0'));var util=require(_0x3244('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3244('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3244('0x3'))['db'];var utils=require(_0x3244('0x4'));var logger=require(_0x3244('0x5'))(_0x3244('0x6'));var config=require('../../config/environment');var jayson=require(_0x3244('0x7'));var client=jayson[_0x3244('0x8')][_0x3244('0x9')]({'port':0x232a});config[_0x3244('0xa')]=_[_0x3244('0xb')](config[_0x3244('0xa')],{'host':_0x3244('0xc'),'port':0x18eb});var socket=require(_0x3244('0xd'))(new Redis(config['redis']));require('./dashboard.socket')[_0x3244('0xe')](socket);function respondWithRpcPromise(_0x47ff89,_0x5ce57f,_0x30b67f){return new BPromise(function(_0x251534,_0x5f5da1){return client[_0x3244('0xf')](_0x47ff89,_0x30b67f)['then'](function(_0x1d3c94){logger['info'](_0x3244('0x10'),_0x5ce57f,_0x3244('0x11'));logger[_0x3244('0x12')](_0x3244('0x13'),_0x5ce57f,_0x3244('0x11'),JSON[_0x3244('0x14')](_0x1d3c94));if(_0x1d3c94[_0x3244('0x15')]){if(_0x1d3c94[_0x3244('0x15')][_0x3244('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x5ce57f,_0x1d3c94[_0x3244('0x15')]['message']);return _0x5f5da1(_0x1d3c94[_0x3244('0x15')][_0x3244('0x17')]);}logger[_0x3244('0x15')](_0x3244('0x10'),_0x5ce57f,_0x1d3c94['error'][_0x3244('0x17')]);return _0x251534(_0x1d3c94[_0x3244('0x15')][_0x3244('0x17')]);}else{logger[_0x3244('0x18')](_0x3244('0x10'),_0x5ce57f,_0x3244('0x11'));_0x251534(_0x1d3c94[_0x3244('0x19')][_0x3244('0x17')]);}})[_0x3244('0x1a')](function(_0x51c5cf){logger[_0x3244('0x15')](_0x3244('0x10'),_0x5ce57f,_0x51c5cf);_0x5f5da1(_0x51c5cf);});});} \ No newline at end of file +var _0x351b=['../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x467e57,_0x4b6ed4){var _0x431608=function(_0x21cc72){while(--_0x21cc72){_0x467e57['push'](_0x467e57['shift']());}};_0x431608(++_0x4b6ed4);}(_0x351b,0x17b));var _0xb351=function(_0x5193df,_0xee6ab5){_0x5193df=_0x5193df-0x0;var _0xf911fd=_0x351b[_0x5193df];return _0xf911fd;};'use strict';var _=require(_0xb351('0x0'));var util=require('util');var moment=require(_0xb351('0x1'));var BPromise=require('bluebird');var rs=require(_0xb351('0x2'));var fs=require('fs');var Redis=require(_0xb351('0x3'));var db=require(_0xb351('0x4'))['db'];var utils=require(_0xb351('0x5'));var logger=require(_0xb351('0x6'))(_0xb351('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb351('0x8')][_0xb351('0x9')]({'port':0x232a});config[_0xb351('0xa')]=_[_0xb351('0xb')](config[_0xb351('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb351('0xa')]));require(_0xb351('0xc'))[_0xb351('0xd')](socket);function respondWithRpcPromise(_0x2b634b,_0x4dfe2e,_0x4ee622){return new BPromise(function(_0x39244e,_0x233d8f){return client[_0xb351('0xe')](_0x2b634b,_0x4ee622)['then'](function(_0x2372c9){logger[_0xb351('0xf')](_0xb351('0x10'),_0x4dfe2e,_0xb351('0x11'));logger[_0xb351('0x12')](_0xb351('0x13'),_0x4dfe2e,_0xb351('0x11'),JSON['stringify'](_0x2372c9));if(_0x2372c9[_0xb351('0x14')]){if(_0x2372c9['error']['code']===0x1f4){logger[_0xb351('0x14')](_0xb351('0x10'),_0x4dfe2e,_0x2372c9[_0xb351('0x14')][_0xb351('0x15')]);return _0x233d8f(_0x2372c9[_0xb351('0x14')]['message']);}logger[_0xb351('0x14')](_0xb351('0x10'),_0x4dfe2e,_0x2372c9[_0xb351('0x14')][_0xb351('0x15')]);return _0x39244e(_0x2372c9['error'][_0xb351('0x15')]);}else{logger[_0xb351('0xf')](_0xb351('0x10'),_0x4dfe2e,_0xb351('0x11'));_0x39244e(_0x2372c9[_0xb351('0x16')][_0xb351('0x15')]);}})[_0xb351('0x17')](function(_0x4d73cb){logger[_0xb351('0x14')]('Dashboard,\x20%s,\x20%s',_0x4dfe2e,_0x4d73cb);_0x233d8f(_0x4d73cb);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 855eb71..e1543f1 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 _0x8a8d=['update','emit','register','length','remove'];(function(_0x454aae,_0x4604b6){var _0x58db87=function(_0x2394f8){while(--_0x2394f8){_0x454aae['push'](_0x454aae['shift']());}};_0x58db87(++_0x4604b6);}(_0x8a8d,0x1b7));var _0xd8a8=function(_0x2ca41b,_0x2315bd){_0x2ca41b=_0x2ca41b-0x0;var _0xd68a72=_0x8a8d[_0x2ca41b];return _0xd68a72;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xd8a8('0x0'),_0xd8a8('0x1')];function createListener(_0x801ec1,_0xc5fba9){return function(_0x139c1d){_0xc5fba9[_0xd8a8('0x2')](_0x801ec1,_0x139c1d);};}function removeListener(_0x4f2895,_0x19c8c2){return function(){DashboardEvents['removeListener'](_0x4f2895,_0x19c8c2);};}exports[_0xd8a8('0x3')]=function(_0x357e2e){for(var _0x2b11a3=0x0,_0xd15283=events[_0xd8a8('0x4')];_0x2b11a3<_0xd15283;_0x2b11a3++){var _0x18893b=events[_0x2b11a3];var _0x5c5b94=createListener('dashboard:'+_0x18893b,_0x357e2e);DashboardEvents['on'](_0x18893b,_0x5c5b94);}}; \ No newline at end of file +var _0x29a5=['dashboard:','./dashboard.events','save','update','removeListener','register','length'];(function(_0x5ce96b,_0x44f094){var _0xbe18=function(_0x52c8d1){while(--_0x52c8d1){_0x5ce96b['push'](_0x5ce96b['shift']());}};_0xbe18(++_0x44f094);}(_0x29a5,0x166));var _0x529a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x29a5[_0x8c43de];return _0xa6591b;};'use strict';var DashboardEvents=require(_0x529a('0x0'));var events=[_0x529a('0x1'),'remove',_0x529a('0x2')];function createListener(_0x59a193,_0x4f7202){return function(_0x30ce90){_0x4f7202['emit'](_0x59a193,_0x30ce90);};}function removeListener(_0x1e7d30,_0x472b91){return function(){DashboardEvents[_0x529a('0x3')](_0x1e7d30,_0x472b91);};}exports[_0x529a('0x4')]=function(_0x5ae510){for(var _0x5ece11=0x0,_0x1009db=events[_0x529a('0x5')];_0x5ece11<_0x1009db;_0x5ece11++){var _0x320878=events[_0x5ece11];var _0x6a099f=createListener(_0x529a('0x6')+_0x320878,_0x5ae510);DashboardEvents['on'](_0x320878,_0x6a099f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 94cb0b1..3b8012a 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 _0x02df=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','update','delete','destroy','exports'];(function(_0xbf6baf,_0x5c899){var _0x20dafd=function(_0x282793){while(--_0x282793){_0xbf6baf['push'](_0xbf6baf['shift']());}};_0x20dafd(++_0x5c899);}(_0x02df,0x142));var _0xf02d=function(_0x42239e,_0x2810f0){_0x42239e=_0x42239e-0x0;var _0x144cc3=_0x02df[_0x42239e];return _0x144cc3;};'use strict';var multer=require(_0xf02d('0x0'));var util=require(_0xf02d('0x1'));var path=require('path');var timeout=require(_0xf02d('0x2'));var express=require(_0xf02d('0x3'));var router=express['Router']();var fs_extra=require(_0xf02d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf02d('0x5'));var config=require(_0xf02d('0x6'));var controller=require('./dashboard.controller');router[_0xf02d('0x7')]('/',auth[_0xf02d('0x8')](),controller[_0xf02d('0x9')]);router[_0xf02d('0x7')](_0xf02d('0xa'),auth[_0xf02d('0x8')](),controller[_0xf02d('0xb')]);router[_0xf02d('0x7')](_0xf02d('0xc'),auth[_0xf02d('0x8')](),controller[_0xf02d('0xd')]);router[_0xf02d('0xe')]('/',auth['isAuthenticated'](),controller[_0xf02d('0xf')]);router['post'](_0xf02d('0x10'),auth[_0xf02d('0x8')](),controller[_0xf02d('0x11')]);router[_0xf02d('0xe')]('/:id/items',auth[_0xf02d('0x8')](),controller[_0xf02d('0x12')]);router['put']('/:id',auth[_0xf02d('0x8')](),controller[_0xf02d('0x13')]);router[_0xf02d('0x14')](_0xf02d('0xa'),auth['isAuthenticated'](),controller[_0xf02d('0x15')]);module[_0xf02d('0x16')]=router; \ No newline at end of file +var _0x9636=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','/:id','delete','destroy','exports','path'];(function(_0x1c5385,_0x3aba1a){var _0x478ddb=function(_0x7ca4a6){while(--_0x7ca4a6){_0x1c5385['push'](_0x1c5385['shift']());}};_0x478ddb(++_0x3aba1a);}(_0x9636,0x133));var _0x6963=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9636[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6963('0x0'));var timeout=require(_0x6963('0x1'));var express=require(_0x6963('0x2'));var router=express[_0x6963('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6963('0x4'));var interaction=require(_0x6963('0x5'));var config=require(_0x6963('0x6'));var controller=require(_0x6963('0x7'));router[_0x6963('0x8')]('/',auth[_0x6963('0x9')](),controller['index']);router[_0x6963('0x8')]('/:id',auth[_0x6963('0x9')](),controller[_0x6963('0xa')]);router[_0x6963('0x8')](_0x6963('0xb'),auth[_0x6963('0x9')](),controller[_0x6963('0xc')]);router[_0x6963('0xd')]('/',auth[_0x6963('0x9')](),controller['create']);router[_0x6963('0xd')](_0x6963('0xe'),auth['isAuthenticated'](),controller[_0x6963('0xf')]);router[_0x6963('0xd')](_0x6963('0xb'),auth[_0x6963('0x9')](),controller[_0x6963('0x10')]);router[_0x6963('0x11')](_0x6963('0x12'),auth[_0x6963('0x9')](),controller['update']);router[_0x6963('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6963('0x14')]);module[_0x6963('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 b9753c5..b6eb204 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 _0x7096=['setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7096,0x10c));var _0x6709=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x7096[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x6709('0x0'));var _=require('lodash');module[_0x6709('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6709('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6709('0x3')](_0x6709('0x4')),'get':function(){try{return JSON[_0x6709('0x5')](this[_0x6709('0x6')](_0x6709('0x7')));}catch(_0xb8fe6d){return[];}},'set':function(_0x9d630f){try{this[_0x6709('0x8')](_0x6709('0x7'),JSON[_0x6709('0x9')](_0x9d630f));}catch(_0x985814){this[_0x6709('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6709('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6709('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6709('0xa')]},'col':{'type':Sequelize[_0x6709('0xa')]},'background':{'type':Sequelize[_0x6709('0x2')],'allowNull':![],'defaultValue':_0x6709('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6709('0x2')]},'titleFontSize':{'type':Sequelize[_0x6709('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xacf4=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xacf4,0xe7));var _0x4acf=function(_0xdb5b37,_0x2ddbc4){_0xdb5b37=_0xdb5b37-0x0;var _0x16b9ab=_0xacf4[_0xdb5b37];return _0x16b9ab;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x4acf('0x0'));module[_0x4acf('0x1')]={'title':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4acf('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4acf('0x3')](_0x4acf('0x4')),'get':function(){try{return JSON[_0x4acf('0x5')](this['getDataValue'](_0x4acf('0x6')));}catch(_0x2124c8){return[];}},'set':function(_0x4e0c43){try{this[_0x4acf('0x7')](_0x4acf('0x6'),JSON[_0x4acf('0x8')](_0x4e0c43));}catch(_0x45a5a4){this[_0x4acf('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x4acf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4acf('0x9')]},'col':{'type':Sequelize[_0x4acf('0x9')]},'background':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':_0x4acf('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 5842f24..1c5349d 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 _0x9406=['then','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update'];(function(_0x6da648,_0x3f2c45){var _0x12819e=function(_0x56180f){while(--_0x56180f){_0x6da648['push'](_0x6da648['shift']());}};_0x12819e(++_0x3f2c45);}(_0x9406,0x14b));var _0x6940=function(_0x56dd7c,_0x3a82fd){_0x56dd7c=_0x56dd7c-0x0;var _0x475cdb=_0x9406[_0x56dd7c];return _0x475cdb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6940('0x0'));var jsonpatch=require(_0x6940('0x1'));var rp=require('request-promise');var moment=require(_0x6940('0x2'));var BPromise=require(_0x6940('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6940('0x4'));var sox=require(_0x6940('0x5'));var csv=require(_0x6940('0x6'));var ejs=require(_0x6940('0x7'));var fs=require('fs');var fs_extra=require(_0x6940('0x8'));var _=require(_0x6940('0x9'));var squel=require(_0x6940('0xa'));var crypto=require(_0x6940('0xb'));var jsforce=require(_0x6940('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6940('0x6'));var querystring=require(_0x6940('0xd'));var Papa=require(_0x6940('0xe'));var Redis=require(_0x6940('0xf'));var authService=require(_0x6940('0x10'));var qs=require(_0x6940('0x11'));var as=require(_0x6940('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6940('0x13'))(_0x6940('0x14'));var utils=require(_0x6940('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6940('0x16'));var db=require('../../mysqldb')['db'];config[_0x6940('0x17')]=_[_0x6940('0x18')](config[_0x6940('0x17')],{'host':_0x6940('0x19'),'port':0x18eb});var socket=require(_0x6940('0x1a'))(new Redis(config[_0x6940('0x17')]));require(_0x6940('0x1b'))[_0x6940('0x1c')](socket);function respondWithStatusCode(_0x38dd40,_0x4298bb){_0x4298bb=_0x4298bb||0xcc;return function(_0x3068a1){if(_0x3068a1){return _0x38dd40[_0x6940('0x1d')](_0x4298bb);}return _0x38dd40[_0x6940('0x1e')](_0x4298bb)[_0x6940('0x1f')]();};}function respondWithResult(_0x5e1f6b,_0x381776){_0x381776=_0x381776||0xc8;return function(_0x3cc4e0){if(_0x3cc4e0){return _0x5e1f6b['status'](_0x381776)['json'](_0x3cc4e0);}};}function respondWithFilteredResult(_0x5d8bb1,_0x306a4a){return function(_0x7e0eb7){if(_0x7e0eb7){var _0x3dbeaa=typeof _0x306a4a[_0x6940('0x20')]===_0x6940('0x21')&&typeof _0x306a4a[_0x6940('0x22')]===_0x6940('0x21');var _0x3c352e=_0x7e0eb7[_0x6940('0x23')];var _0x21be64=_0x3dbeaa?0x0:_0x306a4a['offset'];var _0x1ed5c6=_0x3dbeaa?_0x7e0eb7[_0x6940('0x23')]:_0x306a4a[_0x6940('0x20')]+_0x306a4a['limit'];var _0x276851;if(_0x1ed5c6>=_0x3c352e){_0x1ed5c6=_0x3c352e;_0x276851=0xc8;}else{_0x276851=0xce;}_0x5d8bb1[_0x6940('0x1e')](_0x276851);return _0x5d8bb1[_0x6940('0x24')]('Content-Range',_0x21be64+'-'+_0x1ed5c6+'/'+_0x3c352e)[_0x6940('0x25')](_0x7e0eb7);}return null;};}function patchUpdates(_0x5c3f2e){return function(_0x220575){try{jsonpatch[_0x6940('0x26')](_0x220575,_0x5c3f2e,!![]);}catch(_0x23f1c4){return BPromise['reject'](_0x23f1c4);}return _0x220575[_0x6940('0x27')]();};}function saveUpdates(_0x4fccae,_0x5bc0d3){return function(_0x2b08ed){if(_0x2b08ed){return _0x2b08ed[_0x6940('0x28')](_0x4fccae)[_0x6940('0x29')](function(_0x413845){return _0x413845;});}return null;};}function removeEntity(_0x4d21da,_0x2c56d1){return function(_0x2c25c6){if(_0x2c25c6){return _0x2c25c6['destroy']()[_0x6940('0x29')](function(){_0x4d21da['status'](0xcc)[_0x6940('0x1f')]();});}};}function handleEntityNotFound(_0x43d80a,_0x26bf88){return function(_0x1e6753){if(!_0x1e6753){_0x43d80a[_0x6940('0x1d')](0x194);}return _0x1e6753;};}function handleError(_0x128bf2,_0x33a4e0){_0x33a4e0=_0x33a4e0||0x1f4;return function(_0x2bac98){logger[_0x6940('0x2a')](_0x2bac98[_0x6940('0x2b')]);if(_0x2bac98[_0x6940('0x2c')]){delete _0x2bac98[_0x6940('0x2c')];}_0x128bf2['status'](_0x33a4e0)[_0x6940('0x2d')](_0x2bac98);};}exports[_0x6940('0x2e')]=function(_0x711f15,_0x34ea18){var _0x216c9a={'raw':![],'where':{'id':_0x711f15['params']['id']}},_0x27bfb4={};_0x27bfb4[_0x6940('0x2f')]=_[_0x6940('0x30')](db[_0x6940('0x31')][_0x6940('0x32')]);_0x27bfb4[_0x6940('0x33')]=_[_0x6940('0x30')](_0x711f15[_0x6940('0x33')]);_0x27bfb4['filters']=_[_0x6940('0x34')](_0x27bfb4['model'],_0x27bfb4['query']);_0x216c9a['attributes']=_[_0x6940('0x34')](_0x27bfb4[_0x6940('0x2f')],qs[_0x6940('0x35')](_0x711f15[_0x6940('0x33')][_0x6940('0x35')]));_0x216c9a[_0x6940('0x36')]=_0x216c9a['attributes'][_0x6940('0x37')]?_0x216c9a[_0x6940('0x36')]:_0x27bfb4[_0x6940('0x2f')];if(_0x711f15[_0x6940('0x33')][_0x6940('0x38')]){_0x216c9a[_0x6940('0x39')]=[{'all':!![]}];}_0x216c9a=_[_0x6940('0x3a')]({},_0x216c9a,_0x711f15[_0x6940('0x3b')]);return db[_0x6940('0x31')][_0x6940('0x3c')](_0x216c9a)[_0x6940('0x29')](handleEntityNotFound(_0x34ea18,null))['then'](respondWithResult(_0x34ea18,null))[_0x6940('0x3d')](handleError(_0x34ea18,null));};exports['destroy']=function(_0x7b5763,_0x2ead3f){return db[_0x6940('0x31')]['find']({'where':{'id':_0x7b5763[_0x6940('0x3e')]['id']}})[_0x6940('0x29')](handleEntityNotFound(_0x2ead3f,null))[_0x6940('0x29')](removeEntity(_0x2ead3f,null))['catch'](handleError(_0x2ead3f,null));};function widgetAttributes(_0x2b5bd8){try{switch(_0x2b5bd8[_0x6940('0x3f')]){case _0x6940('0x40'):return[{'name':_0x6940('0x41'),'value':_0x2b5bd8[_0x6940('0x41')]||(_0x2b5bd8['attrs']&&_0x2b5bd8[_0x6940('0x42')][0x0]?_0x2b5bd8[_0x6940('0x42')][0x0][_0x6940('0x43')]:undefined)||_0x6940('0x44')}];case _0x6940('0x45'):return[{'name':_0x6940('0x46'),'value':_0x2b5bd8[_0x6940('0x46')]||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8[_0x6940('0x42')][0x0]?_0x2b5bd8[_0x6940('0x42')][0x0]['value']:undefined)||''}];case _0x6940('0x47'):return[{'name':_0x6940('0x48'),'value':_0x2b5bd8[_0x6940('0x48')]||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8['attrs'][0x0]?_0x2b5bd8[_0x6940('0x42')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x6940('0x49'),'value':_0x2b5bd8[_0x6940('0x49')]||(_0x2b5bd8['attrs']&&_0x2b5bd8[_0x6940('0x42')][0x1]?_0x2b5bd8['attrs'][0x1][_0x6940('0x43')]:undefined)||_0x6940('0x4a')},{'name':_0x6940('0x4b'),'value':_0x2b5bd8[_0x6940('0x4b')]||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8['attrs'][0x2]?_0x2b5bd8[_0x6940('0x42')][0x2][_0x6940('0x43')]:undefined)||0xc}];case _0x6940('0x4c'):return[{'name':_0x6940('0x4d'),'value':_0x2b5bd8['attrMetric']||(_0x2b5bd8['attrs']&&_0x2b5bd8[_0x6940('0x42')][0x0]?_0x2b5bd8[_0x6940('0x42')][0x0]['value']:undefined)||_0x6940('0x4e')},{'name':_0x6940('0x4f'),'value':_0x2b5bd8['attrVoiceQueues']||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8['attrs'][0x1]?_0x2b5bd8[_0x6940('0x42')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x2b5bd8[_0x6940('0x4b')]||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8[_0x6940('0x42')][0x2]?_0x2b5bd8[_0x6940('0x42')][0x2][_0x6940('0x43')]:undefined)||0x14}];case _0x6940('0x50'):case _0x6940('0x51'):return[{'name':_0x6940('0x52'),'value':_0x2b5bd8[_0x6940('0x52')]||(_0x2b5bd8['attrs']&&_0x2b5bd8[_0x6940('0x42')][0x0]?_0x2b5bd8[_0x6940('0x42')][0x0]['value']:undefined)||'total'},{'name':_0x6940('0x53'),'value':_0x2b5bd8[_0x6940('0x53')]||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8[_0x6940('0x42')][0x1]?_0x2b5bd8[_0x6940('0x42')][0x1][_0x6940('0x43')]:undefined)||null},{'name':_0x6940('0x54'),'value':_0x2b5bd8['attrSerie3']||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8[_0x6940('0x42')][0x2]?_0x2b5bd8['attrs'][0x2]['value']:undefined)||null},{'name':_0x6940('0x4f'),'value':_0x2b5bd8[_0x6940('0x4f')]||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8[_0x6940('0x42')][0x3]?_0x2b5bd8['attrs'][0x3][_0x6940('0x43')]:undefined)||[]}];case _0x6940('0x55'):return[{'name':_0x6940('0x56'),'type':_0x2b5bd8[_0x6940('0x57')]||(_0x2b5bd8[_0x6940('0x42')]&&_0x2b5bd8[_0x6940('0x42')][0x0]?_0x2b5bd8[_0x6940('0x42')][0x0][_0x6940('0x3f')]:undefined)||null,'value':_0x2b5bd8['attrReport']||(_0x2b5bd8['attrs']&&_0x2b5bd8['attrs'][0x0]?_0x2b5bd8['attrs'][0x0][_0x6940('0x43')]:undefined)||null},{'name':_0x6940('0x58'),'value':_0x2b5bd8['attrRefresh']||(_0x2b5bd8['attrs']&&_0x2b5bd8[_0x6940('0x42')][0x1]?_0x2b5bd8[_0x6940('0x42')][0x1][_0x6940('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x590853){logger['error'](_0x6940('0x59'),JSON[_0x6940('0x5a')](_0x590853));return[];}}exports['create']=function(_0x17b6b7,_0x4d59a2){if(_0x17b6b7['body']){_0x17b6b7['body']['attrs']=widgetAttributes(_0x17b6b7[_0x6940('0x5b')]);}return db[_0x6940('0x31')][_0x6940('0x5c')](_0x17b6b7[_0x6940('0x5b')],{})['then'](respondWithResult(_0x4d59a2,0xc9))[_0x6940('0x3d')](handleError(_0x4d59a2,null));};exports[_0x6940('0x28')]=function(_0x28113e,_0x21ac12){if(_0x28113e[_0x6940('0x5b')]['id']){delete _0x28113e[_0x6940('0x5b')]['id'];}_0x28113e['body'][_0x6940('0x42')]=widgetAttributes(_0x28113e[_0x6940('0x5b')]);return db['DashboardItem'][_0x6940('0x3c')]({'where':{'id':_0x28113e[_0x6940('0x3e')]['id']}})['then'](handleEntityNotFound(_0x21ac12,null))['then'](saveUpdates(_0x28113e[_0x6940('0x5b')],null))['then'](respondWithResult(_0x21ac12,null))[_0x6940('0x3d')](handleError(_0x21ac12,null));}; \ No newline at end of file +var _0x7055=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','params','model','keys','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','DashboardItem','type','attrUrl','attrs','value','https://','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','catch','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x4dfecb,_0x8d2259){var _0x4fc85c=function(_0x10bcf7){while(--_0x10bcf7){_0x4dfecb['push'](_0x4dfecb['shift']());}};_0x4fc85c(++_0x8d2259);}(_0x7055,0x1a8));var _0x5705=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x7055[_0xf5d71c];return _0x5af672;};'use strict';var emlformat=require(_0x5705('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5705('0x1'));var jsonpatch=require(_0x5705('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5705('0x3'));var util=require(_0x5705('0x4'));var path=require('path');var sox=require(_0x5705('0x5'));var csv=require(_0x5705('0x6'));var ejs=require(_0x5705('0x7'));var fs=require('fs');var fs_extra=require(_0x5705('0x8'));var _=require('lodash');var squel=require(_0x5705('0x9'));var crypto=require(_0x5705('0xa'));var jsforce=require(_0x5705('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5705('0x6'));var querystring=require(_0x5705('0xc'));var Papa=require(_0x5705('0xd'));var Redis=require('ioredis');var authService=require(_0x5705('0xe'));var qs=require(_0x5705('0xf'));var as=require(_0x5705('0x10'));var hardwareService=require(_0x5705('0x11'));var logger=require(_0x5705('0x12'))(_0x5705('0x13'));var utils=require(_0x5705('0x14'));var config=require(_0x5705('0x15'));var licenseUtil=require(_0x5705('0x16'));var db=require(_0x5705('0x17'))['db'];config['redis']=_[_0x5705('0x18')](config[_0x5705('0x19')],{'host':_0x5705('0x1a'),'port':0x18eb});var socket=require(_0x5705('0x1b'))(new Redis(config[_0x5705('0x19')]));require(_0x5705('0x1c'))[_0x5705('0x1d')](socket);function respondWithStatusCode(_0x290480,_0x1a0e66){_0x1a0e66=_0x1a0e66||0xcc;return function(_0x339095){if(_0x339095){return _0x290480[_0x5705('0x1e')](_0x1a0e66);}return _0x290480['status'](_0x1a0e66)['end']();};}function respondWithResult(_0x6fabf2,_0xdcc5ec){_0xdcc5ec=_0xdcc5ec||0xc8;return function(_0x24cd17){if(_0x24cd17){return _0x6fabf2['status'](_0xdcc5ec)[_0x5705('0x1f')](_0x24cd17);}};}function respondWithFilteredResult(_0x45991e,_0x39a3fd){return function(_0x2c20b2){if(_0x2c20b2){var _0x42aaa5=typeof _0x39a3fd['offset']===_0x5705('0x20')&&typeof _0x39a3fd[_0x5705('0x21')]==='undefined';var _0x46fb7d=_0x2c20b2[_0x5705('0x22')];var _0x2e7df6=_0x42aaa5?0x0:_0x39a3fd[_0x5705('0x23')];var _0x4b8a5b=_0x42aaa5?_0x2c20b2[_0x5705('0x22')]:_0x39a3fd[_0x5705('0x23')]+_0x39a3fd[_0x5705('0x21')];var _0x778e1c;if(_0x4b8a5b>=_0x46fb7d){_0x4b8a5b=_0x46fb7d;_0x778e1c=0xc8;}else{_0x778e1c=0xce;}_0x45991e[_0x5705('0x24')](_0x778e1c);return _0x45991e[_0x5705('0x25')](_0x5705('0x26'),_0x2e7df6+'-'+_0x4b8a5b+'/'+_0x46fb7d)[_0x5705('0x1f')](_0x2c20b2);}return null;};}function patchUpdates(_0x1a77b4){return function(_0x11a632){try{jsonpatch[_0x5705('0x27')](_0x11a632,_0x1a77b4,!![]);}catch(_0x4af306){return BPromise[_0x5705('0x28')](_0x4af306);}return _0x11a632[_0x5705('0x29')]();};}function saveUpdates(_0x2c5ee8,_0x1935e2){return function(_0x1ab197){if(_0x1ab197){return _0x1ab197[_0x5705('0x2a')](_0x2c5ee8)[_0x5705('0x2b')](function(_0x1836ef){return _0x1836ef;});}return null;};}function removeEntity(_0x392162,_0xf44d2a){return function(_0x5886c9){if(_0x5886c9){return _0x5886c9[_0x5705('0x2c')]()['then'](function(){_0x392162[_0x5705('0x24')](0xcc)[_0x5705('0x2d')]();});}};}function handleEntityNotFound(_0x4b2c3e,_0x21a515){return function(_0x19be02){if(!_0x19be02){_0x4b2c3e[_0x5705('0x1e')](0x194);}return _0x19be02;};}function handleError(_0x21e2a5,_0xb02683){_0xb02683=_0xb02683||0x1f4;return function(_0x34194c){logger[_0x5705('0x2e')](_0x34194c[_0x5705('0x2f')]);if(_0x34194c[_0x5705('0x30')]){delete _0x34194c[_0x5705('0x30')];}_0x21e2a5[_0x5705('0x24')](_0xb02683)['send'](_0x34194c);};}exports['show']=function(_0x34db28,_0x344bbf){var _0x52865a={'raw':![],'where':{'id':_0x34db28[_0x5705('0x31')]['id']}},_0x44315b={};_0x44315b[_0x5705('0x32')]=_[_0x5705('0x33')](db['DashboardItem'][_0x5705('0x34')]);_0x44315b[_0x5705('0x35')]=_[_0x5705('0x33')](_0x34db28[_0x5705('0x35')]);_0x44315b['filters']=_['intersection'](_0x44315b['model'],_0x44315b[_0x5705('0x35')]);_0x52865a[_0x5705('0x36')]=_[_0x5705('0x37')](_0x44315b[_0x5705('0x32')],qs[_0x5705('0x38')](_0x34db28[_0x5705('0x35')][_0x5705('0x38')]));_0x52865a[_0x5705('0x36')]=_0x52865a[_0x5705('0x36')][_0x5705('0x39')]?_0x52865a[_0x5705('0x36')]:_0x44315b[_0x5705('0x32')];if(_0x34db28[_0x5705('0x35')][_0x5705('0x3a')]){_0x52865a[_0x5705('0x3b')]=[{'all':!![]}];}_0x52865a=_[_0x5705('0x3c')]({},_0x52865a,_0x34db28[_0x5705('0x3d')]);return db['DashboardItem'][_0x5705('0x3e')](_0x52865a)[_0x5705('0x2b')](handleEntityNotFound(_0x344bbf,null))[_0x5705('0x2b')](respondWithResult(_0x344bbf,null))['catch'](handleError(_0x344bbf,null));};exports['destroy']=function(_0x261f94,_0x1ce52e){return db[_0x5705('0x3f')]['find']({'where':{'id':_0x261f94[_0x5705('0x31')]['id']}})[_0x5705('0x2b')](handleEntityNotFound(_0x1ce52e,null))[_0x5705('0x2b')](removeEntity(_0x1ce52e,null))['catch'](handleError(_0x1ce52e,null));};function widgetAttributes(_0x50f6ac){try{switch(_0x50f6ac[_0x5705('0x40')]){case'iframe':return[{'name':'attrUrl','value':_0x50f6ac[_0x5705('0x41')]||(_0x50f6ac['attrs']&&_0x50f6ac[_0x5705('0x42')][0x0]?_0x50f6ac[_0x5705('0x42')][0x0][_0x5705('0x43')]:undefined)||_0x5705('0x44')}];case'custom':return[{'name':'attrPath','value':_0x50f6ac[_0x5705('0x45')]||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x0]?_0x50f6ac['attrs'][0x0][_0x5705('0x43')]:undefined)||''}];case _0x5705('0x46'):return[{'name':'attrHourFormat','value':_0x50f6ac['attrHourFormat']||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x0]?_0x50f6ac[_0x5705('0x42')][0x0][_0x5705('0x43')]:undefined)||_0x5705('0x47')},{'name':_0x5705('0x48'),'value':_0x50f6ac[_0x5705('0x48')]||(_0x50f6ac['attrs']&&_0x50f6ac[_0x5705('0x42')][0x1]?_0x50f6ac[_0x5705('0x42')][0x1][_0x5705('0x43')]:undefined)||'0.00'},{'name':_0x5705('0x49'),'value':_0x50f6ac['attrFontSize']||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac['attrs'][0x2]?_0x50f6ac[_0x5705('0x42')][0x2][_0x5705('0x43')]:undefined)||0xc}];case _0x5705('0x4a'):return[{'name':_0x5705('0x4b'),'value':_0x50f6ac[_0x5705('0x4b')]||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x0]?_0x50f6ac[_0x5705('0x42')][0x0][_0x5705('0x43')]:undefined)||_0x5705('0x4c')},{'name':'attrVoiceQueues','value':_0x50f6ac[_0x5705('0x4d')]||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x1]?_0x50f6ac['attrs'][0x1][_0x5705('0x43')]:undefined)||[]},{'name':_0x5705('0x49'),'value':_0x50f6ac['attrFontSize']||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x2]?_0x50f6ac[_0x5705('0x42')][0x2][_0x5705('0x43')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x5705('0x4e'),'value':_0x50f6ac[_0x5705('0x4e')]||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x0]?_0x50f6ac[_0x5705('0x42')][0x0]['value']:undefined)||_0x5705('0x4c')},{'name':_0x5705('0x4f'),'value':_0x50f6ac[_0x5705('0x4f')]||(_0x50f6ac['attrs']&&_0x50f6ac['attrs'][0x1]?_0x50f6ac[_0x5705('0x42')][0x1][_0x5705('0x43')]:undefined)||null},{'name':_0x5705('0x50'),'value':_0x50f6ac[_0x5705('0x50')]||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x2]?_0x50f6ac[_0x5705('0x42')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x50f6ac[_0x5705('0x4d')]||(_0x50f6ac['attrs']&&_0x50f6ac[_0x5705('0x42')][0x3]?_0x50f6ac[_0x5705('0x42')][0x3][_0x5705('0x43')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x50f6ac['reportType']||(_0x50f6ac['attrs']&&_0x50f6ac[_0x5705('0x42')][0x0]?_0x50f6ac[_0x5705('0x42')][0x0][_0x5705('0x40')]:undefined)||null,'value':_0x50f6ac[_0x5705('0x51')]||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x0]?_0x50f6ac[_0x5705('0x42')][0x0]['value']:undefined)||null},{'name':_0x5705('0x52'),'value':_0x50f6ac[_0x5705('0x52')]||(_0x50f6ac[_0x5705('0x42')]&&_0x50f6ac[_0x5705('0x42')][0x1]?_0x50f6ac['attrs'][0x1][_0x5705('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x53f052){logger[_0x5705('0x2e')](_0x5705('0x53'),JSON[_0x5705('0x54')](_0x53f052));return[];}}exports['create']=function(_0x16d386,_0x168165){if(_0x16d386['body']){_0x16d386[_0x5705('0x55')][_0x5705('0x42')]=widgetAttributes(_0x16d386['body']);}return db[_0x5705('0x3f')][_0x5705('0x56')](_0x16d386[_0x5705('0x55')],{})['then'](respondWithResult(_0x168165,0xc9))[_0x5705('0x57')](handleError(_0x168165,null));};exports[_0x5705('0x2a')]=function(_0x2e0722,_0x57f8ec){if(_0x2e0722[_0x5705('0x55')]['id']){delete _0x2e0722[_0x5705('0x55')]['id'];}_0x2e0722[_0x5705('0x55')]['attrs']=widgetAttributes(_0x2e0722['body']);return db['DashboardItem'][_0x5705('0x3e')]({'where':{'id':_0x2e0722['params']['id']}})[_0x5705('0x2b')](handleEntityNotFound(_0x57f8ec,null))[_0x5705('0x2b')](saveUpdates(_0x2e0722[_0x5705('0x55')],null))['then'](respondWithResult(_0x57f8ec,null))[_0x5705('0x57')](handleError(_0x57f8ec,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index eb1b3eb..5666b00 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 _0x9d76=['../../mysqldb','DashboardItem','update','emit','hook','events'];(function(_0x5067db,_0xf8d2f2){var _0x2771e4=function(_0x3d5cb2){while(--_0x3d5cb2){_0x5067db['push'](_0x5067db['shift']());}};_0x2771e4(++_0xf8d2f2);}(_0x9d76,0x95));var _0x69d7=function(_0x1a9e08,_0x3fbbeb){_0x1a9e08=_0x1a9e08-0x0;var _0x12aa58=_0x9d76[_0x1a9e08];return _0x12aa58;};'use strict';var EventEmitter=require(_0x69d7('0x0'));var DashboardItem=require(_0x69d7('0x1'))['db'][_0x69d7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x69d7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x242c63){return function(_0x4763bc,_0x3ebc44,_0x1e7a66){DashboardItemEvents[_0x69d7('0x4')](_0x242c63+':'+_0x4763bc['id'],_0x4763bc);DashboardItemEvents['emit'](_0x242c63,_0x4763bc);_0x1e7a66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x69d7('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x3a6e=['hasOwnProperty','exports','events','DashboardItem','setMaxListeners','save','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3a6e,0x12a));var _0xe3a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3a6e[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xe3a6('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xe3a6('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe3a6('0x2')](0x0);var events={'afterCreate':_0xe3a6('0x3'),'afterUpdate':'update','afterDestroy':_0xe3a6('0x4')};function emitEvent(_0x2d74c3){return function(_0x281fd3,_0x4471fc,_0x5f38af){DashboardItemEvents['emit'](_0x2d74c3+':'+_0x281fd3['id'],_0x281fd3);DashboardItemEvents[_0xe3a6('0x5')](_0x2d74c3,_0x281fd3);_0x5f38af(null);};}for(var e in events){if(events[_0xe3a6('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xe3a6('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d62e3c4..46a570c 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 _0xeba1=['path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items','lodash','util','moment','request-promise'];(function(_0x268483,_0x1f09fe){var _0xffcd2a=function(_0x4e39c7){while(--_0x4e39c7){_0x268483['push'](_0x268483['shift']());}};_0xffcd2a(++_0x1f09fe);}(_0xeba1,0x182));var _0x1eba=function(_0x45226b,_0x5cab97){_0x45226b=_0x45226b-0x0;var _0x38d5e2=_0xeba1[_0x45226b];return _0x38d5e2;};'use strict';var _=require(_0x1eba('0x0'));var util=require(_0x1eba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1eba('0x2'));var BPromise=require('bluebird');var rp=require(_0x1eba('0x3'));var fs=require('fs');var path=require(_0x1eba('0x4'));var rimraf=require(_0x1eba('0x5'));var config=require(_0x1eba('0x6'));var attributes=require(_0x1eba('0x7'));module['exports']=function(_0x1a071a,_0xe55f2c){return _0x1a071a[_0x1eba('0x8')]('DashboardItem',attributes,{'tableName':_0x1eba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc459=['exports','define','DashboardItem','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x526e00,_0xfb8be4){var _0x33ed12=function(_0x3540d7){while(--_0x3540d7){_0x526e00['push'](_0x526e00['shift']());}};_0x33ed12(++_0xfb8be4);}(_0xc459,0x1d9));var _0x9c45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc459[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9c45('0x0'));var logger=require('../../config/logger')(_0x9c45('0x1'));var moment=require('moment');var BPromise=require(_0x9c45('0x2'));var rp=require(_0x9c45('0x3'));var fs=require('fs');var path=require(_0x9c45('0x4'));var rimraf=require(_0x9c45('0x5'));var config=require(_0x9c45('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x9c45('0x7')]=function(_0x3fcb9f,_0x4ae79d){return _0x3fcb9f[_0x9c45('0x8')](_0x9c45('0x9'),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 947a989..be4be9f 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 _0x041f=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','result'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x041f,0x1dd));var _0xf041=function(_0x3e0f2b,_0x234ab3){_0x3e0f2b=_0x3e0f2b-0x0;var _0x2eb674=_0x041f[_0x3e0f2b];return _0x2eb674;};'use strict';var _=require(_0xf041('0x0'));var util=require(_0xf041('0x1'));var moment=require('moment');var BPromise=require(_0xf041('0x2'));var rs=require(_0xf041('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf041('0x4'))['db'];var utils=require(_0xf041('0x5'));var logger=require(_0xf041('0x6'))(_0xf041('0x7'));var config=require('../../config/environment');var jayson=require(_0xf041('0x8'));var client=jayson[_0xf041('0x9')][_0xf041('0xa')]({'port':0x232a});config['redis']=_[_0xf041('0xb')](config[_0xf041('0xc')],{'host':_0xf041('0xd'),'port':0x18eb});var socket=require(_0xf041('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xf041('0xf')](socket);function respondWithRpcPromise(_0x54065f,_0x51141b,_0x3c6285){return new BPromise(function(_0x148dcc,_0x4151d9){return client[_0xf041('0x10')](_0x54065f,_0x3c6285)[_0xf041('0x11')](function(_0xc708f4){logger['info']('DashboardItem,\x20%s,\x20%s',_0x51141b,'request\x20sent');logger['debug'](_0xf041('0x12'),_0x51141b,_0xf041('0x13'),JSON[_0xf041('0x14')](_0xc708f4));if(_0xc708f4[_0xf041('0x15')]){if(_0xc708f4[_0xf041('0x15')][_0xf041('0x16')]===0x1f4){logger['error'](_0xf041('0x17'),_0x51141b,_0xc708f4[_0xf041('0x15')][_0xf041('0x18')]);return _0x4151d9(_0xc708f4[_0xf041('0x15')][_0xf041('0x18')]);}logger[_0xf041('0x15')]('DashboardItem,\x20%s,\x20%s',_0x51141b,_0xc708f4[_0xf041('0x15')]['message']);return _0x148dcc(_0xc708f4[_0xf041('0x15')][_0xf041('0x18')]);}else{logger[_0xf041('0x19')]('DashboardItem,\x20%s,\x20%s',_0x51141b,_0xf041('0x13'));_0x148dcc(_0xc708f4[_0xf041('0x1a')][_0xf041('0x18')]);}})[_0xf041('0x1b')](function(_0x3a837b){logger[_0xf041('0x15')](_0xf041('0x17'),_0x51141b,_0x3a837b);_0x4151d9(_0x3a837b);});});} \ No newline at end of file +var _0xe787=['./dashboardItem.socket','register','request','then','request\x20sent','debug','stringify','error','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5e0c74,_0x379142){var _0x1df578=function(_0x28e480){while(--_0x28e480){_0x5e0c74['push'](_0x5e0c74['shift']());}};_0x1df578(++_0x379142);}(_0xe787,0x183));var _0x7e78=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0xe787[_0x571c1d];return _0x33c609;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e78('0x0'));var BPromise=require(_0x7e78('0x1'));var rs=require(_0x7e78('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e78('0x3'))['db'];var utils=require(_0x7e78('0x4'));var logger=require(_0x7e78('0x5'))('rpc');var config=require(_0x7e78('0x6'));var jayson=require(_0x7e78('0x7'));var client=jayson['client'][_0x7e78('0x8')]({'port':0x232a});config[_0x7e78('0x9')]=_[_0x7e78('0xa')](config['redis'],{'host':_0x7e78('0xb'),'port':0x18eb});var socket=require(_0x7e78('0xc'))(new Redis(config[_0x7e78('0x9')]));require(_0x7e78('0xd'))[_0x7e78('0xe')](socket);function respondWithRpcPromise(_0x51889a,_0x9fdf8d,_0x4c176f){return new BPromise(function(_0x5aa340,_0x147236){return client[_0x7e78('0xf')](_0x51889a,_0x4c176f)[_0x7e78('0x10')](function(_0x4e902b){logger['info']('DashboardItem,\x20%s,\x20%s',_0x9fdf8d,_0x7e78('0x11'));logger[_0x7e78('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x9fdf8d,_0x7e78('0x11'),JSON[_0x7e78('0x13')](_0x4e902b));if(_0x4e902b[_0x7e78('0x14')]){if(_0x4e902b[_0x7e78('0x14')]['code']===0x1f4){logger[_0x7e78('0x14')]('DashboardItem,\x20%s,\x20%s',_0x9fdf8d,_0x4e902b[_0x7e78('0x14')][_0x7e78('0x15')]);return _0x147236(_0x4e902b[_0x7e78('0x14')][_0x7e78('0x15')]);}logger[_0x7e78('0x14')]('DashboardItem,\x20%s,\x20%s',_0x9fdf8d,_0x4e902b[_0x7e78('0x14')][_0x7e78('0x15')]);return _0x5aa340(_0x4e902b[_0x7e78('0x14')]['message']);}else{logger[_0x7e78('0x16')]('DashboardItem,\x20%s,\x20%s',_0x9fdf8d,_0x7e78('0x11'));_0x5aa340(_0x4e902b[_0x7e78('0x17')][_0x7e78('0x15')]);}})[_0x7e78('0x18')](function(_0x5482ae){logger['error']('DashboardItem,\x20%s,\x20%s',_0x9fdf8d,_0x5482ae);_0x147236(_0x5482ae);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 41c9835..488190d 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 _0x6d67=['length','dashboardItem:','./dashboardItem.events','save','remove','update','removeListener','register'];(function(_0x9d527c,_0x18a99e){var _0x12af1e=function(_0x4ed025){while(--_0x4ed025){_0x9d527c['push'](_0x9d527c['shift']());}};_0x12af1e(++_0x18a99e);}(_0x6d67,0xe2));var _0x76d6=function(_0x40289b,_0x4b64cb){_0x40289b=_0x40289b-0x0;var _0x1935a0=_0x6d67[_0x40289b];return _0x1935a0;};'use strict';var DashboardItemEvents=require(_0x76d6('0x0'));var events=[_0x76d6('0x1'),_0x76d6('0x2'),_0x76d6('0x3')];function createListener(_0x5b5bfb,_0xbe0a0a){return function(_0x9892c0){_0xbe0a0a['emit'](_0x5b5bfb,_0x9892c0);};}function removeListener(_0x21f282,_0x1e0790){return function(){DashboardItemEvents[_0x76d6('0x4')](_0x21f282,_0x1e0790);};}exports[_0x76d6('0x5')]=function(_0xeb6328){for(var _0x3ef8b=0x0,_0x17b0ab=events[_0x76d6('0x6')];_0x3ef8b<_0x17b0ab;_0x3ef8b++){var _0x46b15a=events[_0x3ef8b];var _0x5b710a=createListener(_0x76d6('0x7')+_0x46b15a,_0xeb6328);DashboardItemEvents['on'](_0x46b15a,_0x5b710a);}}; \ No newline at end of file +var _0x4421=['update','removeListener','length','./dashboardItem.events','save','remove'];(function(_0x572791,_0x29f9cf){var _0x28078e=function(_0x382410){while(--_0x382410){_0x572791['push'](_0x572791['shift']());}};_0x28078e(++_0x29f9cf);}(_0x4421,0x123));var _0x1442=function(_0xe0645b,_0x5c5430){_0xe0645b=_0xe0645b-0x0;var _0x4f1db3=_0x4421[_0xe0645b];return _0x4f1db3;};'use strict';var DashboardItemEvents=require(_0x1442('0x0'));var events=[_0x1442('0x1'),_0x1442('0x2'),_0x1442('0x3')];function createListener(_0x1bb364,_0x3ef8d8){return function(_0x4866ac){_0x3ef8d8['emit'](_0x1bb364,_0x4866ac);};}function removeListener(_0xf11971,_0x477ef7){return function(){DashboardItemEvents[_0x1442('0x4')](_0xf11971,_0x477ef7);};}exports['register']=function(_0x1727ce){for(var _0x3b960d=0x0,_0x3d4277=events[_0x1442('0x5')];_0x3b960d<_0x3d4277;_0x3b960d++){var _0x1e77e7=events[_0x3b960d];var _0x32eaf1=createListener('dashboardItem:'+_0x1e77e7,_0x1727ce);DashboardItemEvents['on'](_0x1e77e7,_0x32eaf1);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 41a84cc..7bbbcaf 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 _0xaeae=['../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service'];(function(_0x4e324f,_0x4f0cfc){var _0x4e6076=function(_0x4b8227){while(--_0x4b8227){_0x4e324f['push'](_0x4e324f['shift']());}};_0x4e6076(++_0x4f0cfc);}(_0xaeae,0x1bb));var _0xeaea=function(_0x36db3f,_0x5e7b52){_0x36db3f=_0x36db3f-0x0;var _0x1421ac=_0xaeae[_0x36db3f];return _0x1421ac;};'use strict';var multer=require(_0xeaea('0x0'));var util=require(_0xeaea('0x1'));var path=require(_0xeaea('0x2'));var timeout=require('connect-timeout');var express=require(_0xeaea('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeaea('0x4'));var interaction=require(_0xeaea('0x5'));var config=require('../../config/environment');var controller=require(_0xeaea('0x6'));router[_0xeaea('0x7')](_0xeaea('0x8'),auth[_0xeaea('0x9')](),controller[_0xeaea('0xa')]);router['post']('/',auth[_0xeaea('0x9')](),controller[_0xeaea('0xb')]);router[_0xeaea('0xc')]('/:id',auth[_0xeaea('0x9')](),controller[_0xeaea('0xd')]);router[_0xeaea('0xe')](_0xeaea('0x8'),auth[_0xeaea('0x9')](),controller['destroy']);module[_0xeaea('0xf')]=router; \ No newline at end of file +var _0x638f=['/:id','show','create','put','delete','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0x638f,0x1bd));var _0xf638=function(_0x5dd6ab,_0x10d8e8){_0x5dd6ab=_0x5dd6ab-0x0;var _0xd9265f=_0x638f[_0x5dd6ab];return _0xd9265f;};'use strict';var multer=require(_0xf638('0x0'));var util=require('util');var path=require(_0xf638('0x1'));var timeout=require(_0xf638('0x2'));var express=require(_0xf638('0x3'));var router=express[_0xf638('0x4')]();var fs_extra=require(_0xf638('0x5'));var auth=require(_0xf638('0x6'));var interaction=require(_0xf638('0x7'));var config=require(_0xf638('0x8'));var controller=require(_0xf638('0x9'));router[_0xf638('0xa')](_0xf638('0xb'),auth['isAuthenticated'](),controller[_0xf638('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf638('0xd')]);router[_0xf638('0xe')](_0xf638('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf638('0xf')]('/:id',auth[_0xf638('0x10')](),controller[_0xf638('0x11')]);module[_0xf638('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index bd7e4dc..d747307 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 _0x386a=['first','second','third','exports','STRING','ENUM'];(function(_0x42d35d,_0x33e6fc){var _0x445dbc=function(_0x45fb03){while(--_0x45fb03){_0x42d35d['push'](_0x42d35d['shift']());}};_0x445dbc(++_0x33e6fc);}(_0x386a,0xdb));var _0xa386=function(_0x348945,_0xf3789a){_0x348945=_0x348945-0x0;var _0x9255dd=_0x386a[_0x348945];return _0x9255dd;};'use strict';var Sequelize=require('sequelize');module[_0xa386('0x0')]={'name':{'type':Sequelize[_0xa386('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xa386('0x2')](_0xa386('0x3'),_0xa386('0x4'),_0xa386('0x5')),'allowNull':![],'defaultValue':_0xa386('0x3')},'description':{'type':Sequelize[_0xa386('0x1')]}}; \ No newline at end of file +var _0x6298=['first','third','STRING','exports','ENUM'];(function(_0x1557f2,_0x355782){var _0xa0d19a=function(_0x52f395){while(--_0x52f395){_0x1557f2['push'](_0x1557f2['shift']());}};_0xa0d19a(++_0x355782);}(_0x6298,0x71));var _0x8629=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6298[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8629('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x8629('0x1')](_0x8629('0x2'),'second',_0x8629('0x3')),'allowNull':![],'defaultValue':_0x8629('0x2')},'description':{'type':Sequelize[_0x8629('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 297bba9..171a1e9 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 _0xdc9e=['Dispositions','sendStatus','error','stack','name','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','include','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','status','end','json','offset','undefined','count','limit','apply','reject','update','then','destroy'];(function(_0x114064,_0x4041b7){var _0x1fe3b7=function(_0x26b6a1){while(--_0x26b6a1){_0x114064['push'](_0x114064['shift']());}};_0x1fe3b7(++_0x4041b7);}(_0xdc9e,0x76));var _0xedc9=function(_0x4b512c,_0x593aaf){_0x4b512c=_0x4b512c-0x0;var _0x5b1f79=_0xdc9e[_0x4b512c];return _0x5b1f79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedc9('0x0'));var zipdir=require(_0xedc9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xedc9('0x2'));var BPromise=require(_0xedc9('0x3'));var Mustache=require(_0xedc9('0x4'));var util=require('util');var path=require('path');var sox=require(_0xedc9('0x5'));var csv=require(_0xedc9('0x6'));var ejs=require(_0xedc9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedc9('0x8'));var squel=require(_0xedc9('0x9'));var crypto=require(_0xedc9('0xa'));var jsforce=require(_0xedc9('0xb'));var deskjs=require(_0xedc9('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xedc9('0xd'));var Redis=require(_0xedc9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedc9('0xf'));var logger=require(_0xedc9('0x10'))(_0xedc9('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5447c6,_0x5c4002){_0x5c4002=_0x5c4002||0xcc;return function(_0x3d1e11){if(_0x3d1e11){return _0x5447c6['sendStatus'](_0x5c4002);}return _0x5447c6[_0xedc9('0x12')](_0x5c4002)[_0xedc9('0x13')]();};}function respondWithResult(_0x197659,_0x58c271){_0x58c271=_0x58c271||0xc8;return function(_0x23d94a){if(_0x23d94a){return _0x197659['status'](_0x58c271)[_0xedc9('0x14')](_0x23d94a);}};}function respondWithFilteredResult(_0x2063aa,_0x21b876){return function(_0x238665){if(_0x238665){var _0x201317=typeof _0x21b876[_0xedc9('0x15')]===_0xedc9('0x16')&&typeof _0x21b876['limit']===_0xedc9('0x16');var _0x579de1=_0x238665[_0xedc9('0x17')];var _0x4a5011=_0x201317?0x0:_0x21b876[_0xedc9('0x15')];var _0x2135ce=_0x201317?_0x238665[_0xedc9('0x17')]:_0x21b876[_0xedc9('0x15')]+_0x21b876[_0xedc9('0x18')];var _0x116315;if(_0x2135ce>=_0x579de1){_0x2135ce=_0x579de1;_0x116315=0xc8;}else{_0x116315=0xce;}_0x2063aa[_0xedc9('0x12')](_0x116315);return _0x2063aa['set']('Content-Range',_0x4a5011+'-'+_0x2135ce+'/'+_0x579de1)[_0xedc9('0x14')](_0x238665);}return null;};}function patchUpdates(_0x5eab5f){return function(_0x475860){try{jsonpatch[_0xedc9('0x19')](_0x475860,_0x5eab5f,!![]);}catch(_0x22f2fe){return BPromise[_0xedc9('0x1a')](_0x22f2fe);}return _0x475860['save']();};}function saveUpdates(_0x5cecce,_0x52babf){return function(_0x5502aa){if(_0x5502aa){return _0x5502aa[_0xedc9('0x1b')](_0x5cecce)[_0xedc9('0x1c')](function(_0x5d7485){return _0x5d7485;});}return null;};}function removeEntity(_0x3c2e96,_0x2b53b9){return function(_0x534176){if(_0x534176){return _0x534176[_0xedc9('0x1d')]()[_0xedc9('0x1c')](function(){var _0x3fa329=_0x534176['get']({'plain':!![]});var _0xf2c370=_0xedc9('0x1e');return db['UserProfileResource'][_0xedc9('0x1d')]({'where':{'type':_0xf2c370,'resourceId':_0x3fa329['id']}})[_0xedc9('0x1c')](function(){return _0x534176;});})[_0xedc9('0x1c')](function(){_0x3c2e96[_0xedc9('0x12')](0xcc)[_0xedc9('0x13')]();});}};}function handleEntityNotFound(_0x27ed9d,_0x3094ca){return function(_0x543e01){if(!_0x543e01){_0x27ed9d[_0xedc9('0x1f')](0x194);}return _0x543e01;};}function handleError(_0x3eb2a5,_0xf8648d){_0xf8648d=_0xf8648d||0x1f4;return function(_0xf04948){logger[_0xedc9('0x20')](_0xf04948[_0xedc9('0x21')]);if(_0xf04948[_0xedc9('0x22')]){delete _0xf04948[_0xedc9('0x22')];}_0x3eb2a5['status'](_0xf8648d)['send'](_0xf04948);};}exports['index']=function(_0x15633f,_0x5916d7){var _0x11ee21={},_0x31a4e2={},_0x963053={'count':0x0,'rows':[]};var _0x142916=_[_0xedc9('0x23')](db[_0xedc9('0x24')][_0xedc9('0x25')],function(_0x280d4c){return{'name':_0x280d4c[_0xedc9('0x26')],'type':_0x280d4c[_0xedc9('0x27')][_0xedc9('0x28')]};});_0x31a4e2[_0xedc9('0x29')]=_[_0xedc9('0x23')](_0x142916,_0xedc9('0x22'));_0x31a4e2[_0xedc9('0x2a')]=_[_0xedc9('0x2b')](_0x15633f[_0xedc9('0x2a')]);_0x31a4e2[_0xedc9('0x2c')]=_[_0xedc9('0x2d')](_0x31a4e2['model'],_0x31a4e2[_0xedc9('0x2a')]);_0x11ee21[_0xedc9('0x2e')]=_[_0xedc9('0x2d')](_0x31a4e2[_0xedc9('0x29')],qs[_0xedc9('0x2f')](_0x15633f['query'][_0xedc9('0x2f')]));_0x11ee21[_0xedc9('0x2e')]=_0x11ee21['attributes'][_0xedc9('0x30')]?_0x11ee21[_0xedc9('0x2e')]:_0x31a4e2['model'];if(!_0x15633f[_0xedc9('0x2a')][_0xedc9('0x31')](_0xedc9('0x32'))){_0x11ee21['limit']=qs[_0xedc9('0x18')](_0x15633f[_0xedc9('0x2a')][_0xedc9('0x18')]);_0x11ee21['offset']=qs['offset'](_0x15633f[_0xedc9('0x2a')][_0xedc9('0x15')]);}_0x11ee21[_0xedc9('0x33')]=qs[_0xedc9('0x34')](_0x15633f['query'][_0xedc9('0x34')]);_0x11ee21[_0xedc9('0x35')]=qs['filters'](_[_0xedc9('0x36')](_0x15633f[_0xedc9('0x2a')],_0x31a4e2['filters']),_0x142916);if(_0x15633f['query'][_0xedc9('0x37')]){_0x11ee21[_0xedc9('0x35')]=_[_0xedc9('0x38')](_0x11ee21[_0xedc9('0x35')],{'$or':_[_0xedc9('0x23')](_0x142916,function(_0x4c37cb){if(_0x4c37cb[_0xedc9('0x27')]!==_0xedc9('0x39')){var _0x13bb41={};_0x13bb41[_0x4c37cb['name']]={'$like':'%'+_0x15633f['query'][_0xedc9('0x37')]+'%'};return _0x13bb41;}})});}_0x11ee21=_['merge']({},_0x11ee21,_0x15633f[_0xedc9('0x3a')]);var _0x5a8cbb={'where':_0x11ee21[_0xedc9('0x35')]};return db[_0xedc9('0x24')]['count'](_0x5a8cbb)[_0xedc9('0x1c')](function(_0x4f2038){_0x963053[_0xedc9('0x17')]=_0x4f2038;if(_0x15633f[_0xedc9('0x2a')][_0xedc9('0x3b')]){_0x11ee21['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x11ee21);})[_0xedc9('0x1c')](function(_0x57e7f9){_0x963053[_0xedc9('0x3c')]=_0x57e7f9;return _0x963053;})[_0xedc9('0x1c')](respondWithFilteredResult(_0x5916d7,_0x11ee21))['catch'](handleError(_0x5916d7,null));};exports[_0xedc9('0x3d')]=function(_0x41222e,_0x628bf9){var _0x425d5e={'raw':!![],'where':{'id':_0x41222e['params']['id']}},_0x341cb0={};_0x341cb0[_0xedc9('0x29')]=_['keys'](db['Disposition'][_0xedc9('0x25')]);_0x341cb0[_0xedc9('0x2a')]=_[_0xedc9('0x2b')](_0x41222e[_0xedc9('0x2a')]);_0x341cb0[_0xedc9('0x2c')]=_['intersection'](_0x341cb0[_0xedc9('0x29')],_0x341cb0[_0xedc9('0x2a')]);_0x425d5e['attributes']=_[_0xedc9('0x2d')](_0x341cb0[_0xedc9('0x29')],qs[_0xedc9('0x2f')](_0x41222e[_0xedc9('0x2a')][_0xedc9('0x2f')]));_0x425d5e['attributes']=_0x425d5e[_0xedc9('0x2e')][_0xedc9('0x30')]?_0x425d5e['attributes']:_0x341cb0[_0xedc9('0x29')];if(_0x41222e[_0xedc9('0x2a')][_0xedc9('0x3b')]){_0x425d5e[_0xedc9('0x3e')]=[{'all':!![]}];}_0x425d5e=_[_0xedc9('0x38')]({},_0x425d5e,_0x41222e[_0xedc9('0x3a')]);return db[_0xedc9('0x24')][_0xedc9('0x3f')](_0x425d5e)[_0xedc9('0x1c')](handleEntityNotFound(_0x628bf9,null))[_0xedc9('0x1c')](respondWithResult(_0x628bf9,null))[_0xedc9('0x40')](handleError(_0x628bf9,null));};exports['create']=function(_0x5b3db2,_0x4856e1){return db[_0xedc9('0x24')]['create'](_0x5b3db2[_0xedc9('0x41')],{})[_0xedc9('0x1c')](function(_0x450caa){var _0x9deaa=_0x5b3db2['user']['get']({'plain':!![]});if(!_0x9deaa)throw new Error(_0xedc9('0x42'));if(_0x9deaa['role']==='user'){var _0x43b475=_0x450caa[_0xedc9('0x43')]({'plain':!![]});var _0x35af1a=_0xedc9('0x1e');return db['UserProfileSection']['find']({'where':{'name':_0x35af1a,'userProfileId':_0x9deaa[_0xedc9('0x44')]},'raw':!![]})['then'](function(_0x375dd4){if(_0x375dd4&&_0x375dd4[_0xedc9('0x45')]===0x0){return db[_0xedc9('0x46')][_0xedc9('0x47')]({'name':_0x43b475[_0xedc9('0x22')],'resourceId':_0x43b475['id'],'type':_0x375dd4[_0xedc9('0x22')],'sectionId':_0x375dd4['id']},{})[_0xedc9('0x1c')](function(){return _0x450caa;});}else{return _0x450caa;}})[_0xedc9('0x40')](function(_0x11da7f){logger['error'](_0xedc9('0x48'),_0x11da7f);throw _0x11da7f;});}return _0x450caa;})['then'](respondWithResult(_0x4856e1,0xc9))[_0xedc9('0x40')](handleError(_0x4856e1,null));};exports[_0xedc9('0x1b')]=function(_0x1a163d,_0x2274d0){if(_0x1a163d[_0xedc9('0x41')]['id']){delete _0x1a163d[_0xedc9('0x41')]['id'];}return db['Disposition']['find']({'where':{'id':_0x1a163d[_0xedc9('0x49')]['id']}})['then'](handleEntityNotFound(_0x2274d0,null))[_0xedc9('0x1c')](saveUpdates(_0x1a163d[_0xedc9('0x41')],null))['then'](respondWithResult(_0x2274d0,null))['catch'](handleError(_0x2274d0,null));};exports[_0xedc9('0x1d')]=function(_0x4c079e,_0x1003f2){return db[_0xedc9('0x24')]['find']({'where':{'id':_0x4c079e[_0xedc9('0x49')]['id']}})[_0xedc9('0x1c')](handleEntityNotFound(_0x1003f2,null))[_0xedc9('0x1c')](removeEntity(_0x1003f2,null))[_0xedc9('0x40')](handleError(_0x1003f2,null));}; \ No newline at end of file +var _0x91e7=['find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','get','Dispositions','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','Disposition','create','user','UserProfileSection'];(function(_0x552204,_0x222864){var _0x24988d=function(_0x5d893b){while(--_0x5d893b){_0x552204['push'](_0x552204['shift']());}};_0x24988d(++_0x222864);}(_0x91e7,0xf9));var _0x791e=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x91e7[_0x4d82ea];return _0x257f4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x791e('0x1'));var moment=require(_0x791e('0x2'));var BPromise=require(_0x791e('0x3'));var Mustache=require(_0x791e('0x4'));var util=require(_0x791e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x791e('0x6'));var ejs=require(_0x791e('0x7'));var fs=require('fs');var fs_extra=require(_0x791e('0x8'));var _=require(_0x791e('0x9'));var squel=require('squel');var crypto=require(_0x791e('0xa'));var jsforce=require(_0x791e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x791e('0x6'));var querystring=require(_0x791e('0xc'));var Papa=require(_0x791e('0xd'));var Redis=require(_0x791e('0xe'));var authService=require(_0x791e('0xf'));var qs=require(_0x791e('0x10'));var as=require(_0x791e('0x11'));var hardwareService=require(_0x791e('0x12'));var logger=require(_0x791e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x791e('0x14'));var licenseUtil=require(_0x791e('0x15'));var db=require(_0x791e('0x16'))['db'];function respondWithStatusCode(_0x5db3f1,_0x19c1c3){_0x19c1c3=_0x19c1c3||0xcc;return function(_0x15e8b3){if(_0x15e8b3){return _0x5db3f1['sendStatus'](_0x19c1c3);}return _0x5db3f1['status'](_0x19c1c3)['end']();};}function respondWithResult(_0x3f5c61,_0x291967){_0x291967=_0x291967||0xc8;return function(_0x58018f){if(_0x58018f){return _0x3f5c61[_0x791e('0x17')](_0x291967)[_0x791e('0x18')](_0x58018f);}};}function respondWithFilteredResult(_0x27acb3,_0x24514e){return function(_0x499c05){if(_0x499c05){var _0x5be547=typeof _0x24514e[_0x791e('0x19')]==='undefined'&&typeof _0x24514e[_0x791e('0x1a')]===_0x791e('0x1b');var _0x45349b=_0x499c05[_0x791e('0x1c')];var _0x2388e2=_0x5be547?0x0:_0x24514e[_0x791e('0x19')];var _0x4a4753=_0x5be547?_0x499c05['count']:_0x24514e[_0x791e('0x19')]+_0x24514e['limit'];var _0x44dd15;if(_0x4a4753>=_0x45349b){_0x4a4753=_0x45349b;_0x44dd15=0xc8;}else{_0x44dd15=0xce;}_0x27acb3[_0x791e('0x17')](_0x44dd15);return _0x27acb3['set'](_0x791e('0x1d'),_0x2388e2+'-'+_0x4a4753+'/'+_0x45349b)[_0x791e('0x18')](_0x499c05);}return null;};}function patchUpdates(_0x2958ac){return function(_0x3b26ae){try{jsonpatch['apply'](_0x3b26ae,_0x2958ac,!![]);}catch(_0x378efb){return BPromise[_0x791e('0x1e')](_0x378efb);}return _0x3b26ae[_0x791e('0x1f')]();};}function saveUpdates(_0x54bf3b,_0x506987){return function(_0x3016b7){if(_0x3016b7){return _0x3016b7[_0x791e('0x20')](_0x54bf3b)[_0x791e('0x21')](function(_0x37596e){return _0x37596e;});}return null;};}function removeEntity(_0x1ba250,_0x584054){return function(_0x545394){if(_0x545394){return _0x545394[_0x791e('0x22')]()[_0x791e('0x21')](function(){var _0x2a2a04=_0x545394[_0x791e('0x23')]({'plain':!![]});var _0x51a478=_0x791e('0x24');return db['UserProfileResource'][_0x791e('0x22')]({'where':{'type':_0x51a478,'resourceId':_0x2a2a04['id']}})[_0x791e('0x21')](function(){return _0x545394;});})[_0x791e('0x21')](function(){_0x1ba250[_0x791e('0x17')](0xcc)[_0x791e('0x25')]();});}};}function handleEntityNotFound(_0x166505,_0x2f88f6){return function(_0x5a7c7f){if(!_0x5a7c7f){_0x166505['sendStatus'](0x194);}return _0x5a7c7f;};}function handleError(_0x1545f4,_0x5307da){_0x5307da=_0x5307da||0x1f4;return function(_0x444c1d){logger[_0x791e('0x26')](_0x444c1d[_0x791e('0x27')]);if(_0x444c1d['name']){delete _0x444c1d[_0x791e('0x28')];}_0x1545f4[_0x791e('0x17')](_0x5307da)[_0x791e('0x29')](_0x444c1d);};}exports[_0x791e('0x2a')]=function(_0x39541a,_0x34a4e5){var _0x35b201={},_0xf947ca={},_0x1189f0={'count':0x0,'rows':[]};var _0x277da5=_[_0x791e('0x2b')](db['Disposition'][_0x791e('0x2c')],function(_0x194867){return{'name':_0x194867[_0x791e('0x2d')],'type':_0x194867[_0x791e('0x2e')][_0x791e('0x2f')]};});_0xf947ca[_0x791e('0x30')]=_[_0x791e('0x2b')](_0x277da5,_0x791e('0x28'));_0xf947ca[_0x791e('0x31')]=_['keys'](_0x39541a[_0x791e('0x31')]);_0xf947ca[_0x791e('0x32')]=_[_0x791e('0x33')](_0xf947ca[_0x791e('0x30')],_0xf947ca[_0x791e('0x31')]);_0x35b201['attributes']=_[_0x791e('0x33')](_0xf947ca[_0x791e('0x30')],qs[_0x791e('0x34')](_0x39541a[_0x791e('0x31')]['fields']));_0x35b201['attributes']=_0x35b201[_0x791e('0x35')][_0x791e('0x36')]?_0x35b201[_0x791e('0x35')]:_0xf947ca[_0x791e('0x30')];if(!_0x39541a[_0x791e('0x31')]['hasOwnProperty'](_0x791e('0x37'))){_0x35b201[_0x791e('0x1a')]=qs[_0x791e('0x1a')](_0x39541a[_0x791e('0x31')][_0x791e('0x1a')]);_0x35b201[_0x791e('0x19')]=qs[_0x791e('0x19')](_0x39541a['query']['offset']);}_0x35b201[_0x791e('0x38')]=qs[_0x791e('0x39')](_0x39541a[_0x791e('0x31')][_0x791e('0x39')]);_0x35b201[_0x791e('0x3a')]=qs[_0x791e('0x32')](_[_0x791e('0x3b')](_0x39541a[_0x791e('0x31')],_0xf947ca[_0x791e('0x32')]),_0x277da5);if(_0x39541a[_0x791e('0x31')][_0x791e('0x3c')]){_0x35b201[_0x791e('0x3a')]=_['merge'](_0x35b201[_0x791e('0x3a')],{'$or':_[_0x791e('0x2b')](_0x277da5,function(_0x9e310f){if(_0x9e310f[_0x791e('0x2e')]!=='VIRTUAL'){var _0xb6501={};_0xb6501[_0x9e310f[_0x791e('0x28')]]={'$like':'%'+_0x39541a['query'][_0x791e('0x3c')]+'%'};return _0xb6501;}})});}_0x35b201=_[_0x791e('0x3d')]({},_0x35b201,_0x39541a[_0x791e('0x3e')]);var _0x523040={'where':_0x35b201[_0x791e('0x3a')]};return db['Disposition']['count'](_0x523040)[_0x791e('0x21')](function(_0x1687f4){_0x1189f0[_0x791e('0x1c')]=_0x1687f4;if(_0x39541a[_0x791e('0x31')][_0x791e('0x3f')]){_0x35b201[_0x791e('0x40')]=[{'all':!![]}];}return db['Disposition'][_0x791e('0x41')](_0x35b201);})['then'](function(_0x598543){_0x1189f0[_0x791e('0x42')]=_0x598543;return _0x1189f0;})['then'](respondWithFilteredResult(_0x34a4e5,_0x35b201))[_0x791e('0x43')](handleError(_0x34a4e5,null));};exports[_0x791e('0x44')]=function(_0x160299,_0x222fa8){var _0x24a343={'raw':!![],'where':{'id':_0x160299[_0x791e('0x45')]['id']}},_0x3e1536={};_0x3e1536[_0x791e('0x30')]=_[_0x791e('0x46')](db[_0x791e('0x47')][_0x791e('0x2c')]);_0x3e1536[_0x791e('0x31')]=_[_0x791e('0x46')](_0x160299['query']);_0x3e1536[_0x791e('0x32')]=_[_0x791e('0x33')](_0x3e1536[_0x791e('0x30')],_0x3e1536['query']);_0x24a343['attributes']=_[_0x791e('0x33')](_0x3e1536[_0x791e('0x30')],qs[_0x791e('0x34')](_0x160299[_0x791e('0x31')][_0x791e('0x34')]));_0x24a343[_0x791e('0x35')]=_0x24a343[_0x791e('0x35')]['length']?_0x24a343[_0x791e('0x35')]:_0x3e1536[_0x791e('0x30')];if(_0x160299[_0x791e('0x31')][_0x791e('0x3f')]){_0x24a343[_0x791e('0x40')]=[{'all':!![]}];}_0x24a343=_[_0x791e('0x3d')]({},_0x24a343,_0x160299[_0x791e('0x3e')]);return db['Disposition']['find'](_0x24a343)['then'](handleEntityNotFound(_0x222fa8,null))[_0x791e('0x21')](respondWithResult(_0x222fa8,null))[_0x791e('0x43')](handleError(_0x222fa8,null));};exports[_0x791e('0x48')]=function(_0x1681a5,_0x3d1fca){return db[_0x791e('0x47')][_0x791e('0x48')](_0x1681a5['body'],{})[_0x791e('0x21')](function(_0x1ec72a){var _0x129dda=_0x1681a5[_0x791e('0x49')][_0x791e('0x23')]({'plain':!![]});if(!_0x129dda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x129dda['role']==='user'){var _0x58e6e0=_0x1ec72a[_0x791e('0x23')]({'plain':!![]});var _0x7703b1=_0x791e('0x24');return db[_0x791e('0x4a')][_0x791e('0x4b')]({'where':{'name':_0x7703b1,'userProfileId':_0x129dda[_0x791e('0x4c')]},'raw':!![]})['then'](function(_0x4bf1a6){if(_0x4bf1a6&&_0x4bf1a6[_0x791e('0x4d')]===0x0){return db[_0x791e('0x4e')][_0x791e('0x48')]({'name':_0x58e6e0[_0x791e('0x28')],'resourceId':_0x58e6e0['id'],'type':_0x4bf1a6[_0x791e('0x28')],'sectionId':_0x4bf1a6['id']},{})[_0x791e('0x21')](function(){return _0x1ec72a;});}else{return _0x1ec72a;}})['catch'](function(_0x32c0fc){logger[_0x791e('0x26')](_0x791e('0x4f'),_0x32c0fc);throw _0x32c0fc;});}return _0x1ec72a;})[_0x791e('0x21')](respondWithResult(_0x3d1fca,0xc9))[_0x791e('0x43')](handleError(_0x3d1fca,null));};exports['update']=function(_0x59743c,_0x33a436){if(_0x59743c['body']['id']){delete _0x59743c['body']['id'];}return db[_0x791e('0x47')]['find']({'where':{'id':_0x59743c[_0x791e('0x45')]['id']}})['then'](handleEntityNotFound(_0x33a436,null))[_0x791e('0x21')](saveUpdates(_0x59743c[_0x791e('0x50')],null))[_0x791e('0x21')](respondWithResult(_0x33a436,null))[_0x791e('0x43')](handleError(_0x33a436,null));};exports[_0x791e('0x22')]=function(_0x34e23d,_0x428b7f){return db[_0x791e('0x47')][_0x791e('0x4b')]({'where':{'id':_0x34e23d[_0x791e('0x45')]['id']}})[_0x791e('0x21')](handleEntityNotFound(_0x428b7f,null))[_0x791e('0x21')](removeEntity(_0x428b7f,null))[_0x791e('0x43')](handleError(_0x428b7f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 44fff2e..6339223 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 _0x7a7f=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x7a7f,0x11d));var _0xf7a7=function(_0x2bb317,_0x46afd9){_0x2bb317=_0x2bb317-0x0;var _0x16fc1a=_0x7a7f[_0x2bb317];return _0x16fc1a;};'use strict';var _=require('lodash');var util=require(_0xf7a7('0x0'));var logger=require(_0xf7a7('0x1'))(_0xf7a7('0x2'));var moment=require(_0xf7a7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf7a7('0x4'));var fs=require('fs');var path=require(_0xf7a7('0x5'));var rimraf=require('rimraf');var config=require(_0xf7a7('0x6'));var attributes=require(_0xf7a7('0x7'));module[_0xf7a7('0x8')]=function(_0x30e02f,_0x1ca3cc){return _0x30e02f[_0xf7a7('0x9')](_0xf7a7('0xa'),attributes,{'tableName':_0xf7a7('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf7a7('0xc'),'fields':[_0xf7a7('0xd'),_0xf7a7('0xe')]},{'unique':!![],'name':_0xf7a7('0xf'),'fields':[_0xf7a7('0xd'),_0xf7a7('0x10')]},{'unique':!![],'name':_0xf7a7('0x11'),'fields':[_0xf7a7('0xd'),_0xf7a7('0x12')]},{'unique':!![],'name':_0xf7a7('0x13'),'fields':[_0xf7a7('0xd'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xf7a7('0xd'),_0xf7a7('0x14')]},{'unique':!![],'name':_0xf7a7('0x15'),'fields':['name',_0xf7a7('0x16')]},{'unique':!![],'name':_0xf7a7('0x17'),'fields':[_0xf7a7('0xd'),_0xf7a7('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70fa=['exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','api','moment','bluebird','request-promise','./disposition.attributes'];(function(_0x4571fc,_0x3c7af8){var _0x4a9a0e=function(_0x258afb){while(--_0x258afb){_0x4571fc['push'](_0x4571fc['shift']());}};_0x4a9a0e(++_0x3c7af8);}(_0x70fa,0x15a));var _0xa70f=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x70fa[_0x58c20f];return _0x3b0318;};'use strict';var _=require('lodash');var util=require(_0xa70f('0x0'));var logger=require('../../config/logger')(_0xa70f('0x1'));var moment=require(_0xa70f('0x2'));var BPromise=require(_0xa70f('0x3'));var rp=require(_0xa70f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa70f('0x5'));module[_0xa70f('0x6')]=function(_0x529d9d,_0x133ddd){return _0x529d9d[_0xa70f('0x7')](_0xa70f('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xa70f('0x9'),'fields':[_0xa70f('0xa'),_0xa70f('0xb')]},{'unique':!![],'name':_0xa70f('0xc'),'fields':['name',_0xa70f('0xd')]},{'unique':!![],'name':_0xa70f('0xe'),'fields':[_0xa70f('0xa'),'MailAccountId']},{'unique':!![],'name':_0xa70f('0xf'),'fields':[_0xa70f('0xa'),_0xa70f('0x10')]},{'unique':!![],'name':_0xa70f('0x11'),'fields':[_0xa70f('0xa'),_0xa70f('0x12')]},{'unique':!![],'name':_0xa70f('0x13'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xa70f('0x14'),'fields':[_0xa70f('0xa'),_0xa70f('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index fc77ee0..5cdaf1d 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(_0x105fee,_0x135db3){var _0x9aaf31=function(_0x3e401a){while(--_0x3e401a){_0x105fee['push'](_0x105fee['shift']());}};_0x9aaf31(++_0x135db3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x22f971,_0x28989b){var _0x1a831d=function(_0x20663f){while(--_0x20663f){_0x22f971['push'](_0x22f971['shift']());}};_0x1a831d(++_0x28989b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 ca44554..7aea6e9 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 _0x1ec8=['get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x1ad9d3,_0x20772b){var _0x5a52cb=function(_0x5d999c){while(--_0x5d999c){_0x1ad9d3['push'](_0x1ad9d3['shift']());}};_0x5a52cb(++_0x20772b);}(_0x1ec8,0x82));var _0x81ec=function(_0x2c5b06,_0xe46b96){_0x2c5b06=_0x2c5b06-0x0;var _0x7c621c=_0x1ec8[_0x2c5b06];return _0x7c621c;};'use strict';var multer=require(_0x81ec('0x0'));var util=require(_0x81ec('0x1'));var path=require('path');var timeout=require(_0x81ec('0x2'));var express=require(_0x81ec('0x3'));var router=express['Router']();var fs_extra=require(_0x81ec('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x81ec('0x5')]('/',auth[_0x81ec('0x6')](),controller[_0x81ec('0x7')]);router[_0x81ec('0x5')](_0x81ec('0x8'),auth[_0x81ec('0x6')](),controller[_0x81ec('0x9')]);router['post']('/',auth[_0x81ec('0x6')](),controller[_0x81ec('0xa')]);router[_0x81ec('0xb')](_0x81ec('0x8'),auth[_0x81ec('0x6')](),controller['update']);router[_0x81ec('0xc')](_0x81ec('0x8'),auth[_0x81ec('0x6')](),controller[_0x81ec('0xd')]);module[_0x81ec('0xe')]=router; \ No newline at end of file +var _0x842d=['destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x526c13,_0x5d5bbf){var _0x107079=function(_0x435c92){while(--_0x435c92){_0x526c13['push'](_0x526c13['shift']());}};_0x107079(++_0x5d5bbf);}(_0x842d,0xbd));var _0xd842=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0x842d[_0x25b24a];return _0x224e68;};'use strict';var multer=require('multer');var util=require(_0xd842('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd842('0x1'));var router=express['Router']();var fs_extra=require(_0xd842('0x2'));var auth=require(_0xd842('0x3'));var interaction=require(_0xd842('0x4'));var config=require('../../config/environment');var controller=require(_0xd842('0x5'));router[_0xd842('0x6')]('/',auth['isAuthenticated'](),controller[_0xd842('0x7')]);router[_0xd842('0x6')](_0xd842('0x8'),auth[_0xd842('0x9')](),controller[_0xd842('0xa')]);router[_0xd842('0xb')]('/',auth[_0xd842('0x9')](),controller[_0xd842('0xc')]);router[_0xd842('0xd')](_0xd842('0x8'),auth[_0xd842('0x9')](),controller['update']);router[_0xd842('0xe')](_0xd842('0x8'),auth[_0xd842('0x9')](),controller[_0xd842('0xf')]);module[_0xd842('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 cfbd409..81107d9 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 _0x5f5f=['localstationid','ENUM','2400','4800','7200','9600','14400','12000','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f5f,0x1c3));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf5f5('0x0'));module[_0xf5f5('0x1')]={'name':{'type':Sequelize[_0xf5f5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf5f5('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf5f5('0x3')},'headerinfo':{'type':Sequelize[_0xf5f5('0x2')],'defaultValue':_0xf5f5('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf5f5('0x5')},'minrate':{'type':Sequelize[_0xf5f5('0x6')](_0xf5f5('0x7'),_0xf5f5('0x8'),_0xf5f5('0x9'),_0xf5f5('0xa'),'12000',_0xf5f5('0xb')),'defaultValue':_0xf5f5('0x8')},'maxrate':{'type':Sequelize[_0xf5f5('0x6')](_0xf5f5('0x7'),_0xf5f5('0x8'),_0xf5f5('0x9'),_0xf5f5('0xa'),_0xf5f5('0xc'),_0xf5f5('0xb')),'defaultValue':_0xf5f5('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xf5f5('0xd')},'gateway':{'type':Sequelize[_0xf5f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf5f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf5f5('0x6')](_0xf5f5('0xe'),_0xf5f5('0xf'),_0xf5f5('0x10'),_0xf5f5('0x11')),'defaultValue':_0xf5f5('0xe')},'key':{'type':Sequelize[_0xf5f5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf5f5('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf5f5('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf5f5('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf5f5('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf5f5('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf5f5('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf5f5('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf5f5('0x14')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf5f5('0x15'),'set':function(_0x5d5c21){if(!_0x5d5c21)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf5f5('0x16')](_0xf5f5('0x17'),_0x5d5c21);}}}; \ No newline at end of file +var _0x99ce=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','IAX','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x99ce,0x168));var _0xe99c=function(_0x38e6cd,_0x32637b){_0x38e6cd=_0x38e6cd-0x0;var _0x2fa526=_0x99ce[_0x38e6cd];return _0x2fa526;};'use strict';var Sequelize=require(_0xe99c('0x0'));module['exports']={'name':{'type':Sequelize[_0xe99c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe99c('0x1')]},'ecm':{'type':Sequelize[_0xe99c('0x2')](_0xe99c('0x3'),'no'),'defaultValue':_0xe99c('0x3')},'headerinfo':{'type':Sequelize[_0xe99c('0x1')],'defaultValue':_0xe99c('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xe99c('0x2')](_0xe99c('0x5'),_0xe99c('0x6'),_0xe99c('0x7'),_0xe99c('0x8'),_0xe99c('0x9'),_0xe99c('0xa')),'defaultValue':_0xe99c('0x6')},'maxrate':{'type':Sequelize[_0xe99c('0x2')](_0xe99c('0x5'),_0xe99c('0x6'),_0xe99c('0x7'),_0xe99c('0x8'),_0xe99c('0x9'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xe99c('0x1')],'defaultValue':_0xe99c('0xb')},'gateway':{'type':Sequelize[_0xe99c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe99c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe99c('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0xe99c('0xd'),'DADHI',_0xe99c('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xe99c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe99c('0xf');}},'notificationSound':{'type':Sequelize[_0xe99c('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe99c('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe99c('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe99c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe99c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe99c('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xe99c('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xe99c('0x10')],'defaultValue':![],'comment':_0xe99c('0x12'),'set':function(_0x341ca4){if(!_0x341ca4)this['setDataValue'](_0xe99c('0x13'),null);this[_0xe99c('0x14')]('mandatoryDisposition',_0x341ca4);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index df8d124..45bc529 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 _0x027c=['message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','merge','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','findOne','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','description','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','Send\x20Fax\x20failed','out','filename','dataValues','Messages','SendFax','info','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','register','client','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x22d7ae,_0x588bec){var _0x4155da=function(_0x3a3787){while(--_0x3a3787){_0x22d7ae['push'](_0x22d7ae['shift']());}};_0x4155da(++_0x588bec);}(_0x027c,0x9d));var _0xc027=function(_0x440d35,_0x343f7a){_0x440d35=_0x440d35-0x0;var _0x355cd6=_0x027c[_0x440d35];return _0x355cd6;};'use strict';var emlformat=require(_0xc027('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc027('0x1'));var jsonpatch=require(_0xc027('0x2'));var rp=require(_0xc027('0x3'));var moment=require(_0xc027('0x4'));var BPromise=require(_0xc027('0x5'));var Mustache=require(_0xc027('0x6'));var util=require(_0xc027('0x7'));var path=require(_0xc027('0x8'));var sox=require(_0xc027('0x9'));var csv=require(_0xc027('0xa'));var ejs=require(_0xc027('0xb'));var fs=require('fs');var fs_extra=require(_0xc027('0xc'));var _=require(_0xc027('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc027('0xa'));var querystring=require(_0xc027('0xe'));var Papa=require(_0xc027('0xf'));var Redis=require(_0xc027('0x10'));var authService=require(_0xc027('0x11'));var qs=require(_0xc027('0x12'));var as=require(_0xc027('0x13'));var hardwareService=require(_0xc027('0x14'));var logger=require(_0xc027('0x15'))(_0xc027('0x16'));var utils=require(_0xc027('0x17'));var config=require(_0xc027('0x18'));var licenseUtil=require(_0xc027('0x19'));var db=require('../../mysqldb')['db'];config[_0xc027('0x1a')]=_[_0xc027('0x1b')](config[_0xc027('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc027('0x1c'))(new Redis(config[_0xc027('0x1a')]));require(_0xc027('0x1d'))[_0xc027('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc027('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xc027('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e1b98,_0x1c8fcb,_0x316ff1,_0x3a001e){return new BPromise(function(_0x220214,_0x1050cf){var _0x32d2c4=_0x3a001e||client;return _0x32d2c4[_0xc027('0x20')](_0x1e1b98,_0x316ff1)[_0xc027('0x21')](function(_0xcc12ac){logger['info'](_0xc027('0x22'),_0x1c8fcb,_0xc027('0x23'));logger['debug'](_0xc027('0x24'),_0x1c8fcb,_0xc027('0x23'),JSON['stringify'](_0xcc12ac));if(_0xcc12ac[_0xc027('0x25')]){if(_0xcc12ac[_0xc027('0x25')][_0xc027('0x26')]===0x1f4){logger[_0xc027('0x25')](_0xc027('0x22'),_0x1c8fcb,_0xcc12ac[_0xc027('0x25')]['message']);return _0x1050cf(_0xcc12ac[_0xc027('0x25')]['message']);}logger[_0xc027('0x25')](_0xc027('0x22'),_0x1c8fcb,_0xcc12ac[_0xc027('0x25')]['message']);return _0x220214(_0xcc12ac[_0xc027('0x25')]['message']);}else{logger['info'](_0xc027('0x22'),_0x1c8fcb,_0xc027('0x23'));_0x220214(_0xcc12ac['result'][_0xc027('0x27')]);}})[_0xc027('0x28')](function(_0x1a483b){logger[_0xc027('0x25')](_0xc027('0x22'),_0x1c8fcb,_0x1a483b);_0x1050cf(_0x1a483b);});});}function respondWithStatusCode(_0x39f479,_0x4912e6){_0x4912e6=_0x4912e6||0xcc;return function(_0x16e750){if(_0x16e750){return _0x39f479[_0xc027('0x29')](_0x4912e6);}return _0x39f479[_0xc027('0x2a')](_0x4912e6)[_0xc027('0x2b')]();};}function respondWithResult(_0x3dd21a,_0x2277cf){_0x2277cf=_0x2277cf||0xc8;return function(_0x52feaa){if(_0x52feaa){return _0x3dd21a[_0xc027('0x2a')](_0x2277cf)[_0xc027('0x2c')](_0x52feaa);}};}function respondWithFilteredResult(_0x22c28c,_0x37c143){return function(_0x89d553){if(_0x89d553){var _0x58cc7c=typeof _0x37c143[_0xc027('0x2d')]===_0xc027('0x2e')&&typeof _0x37c143[_0xc027('0x2f')]===_0xc027('0x2e');var _0x428b27=_0x89d553[_0xc027('0x30')];var _0x542ff1=_0x58cc7c?0x0:_0x37c143[_0xc027('0x2d')];var _0xdf0e61=_0x58cc7c?_0x89d553[_0xc027('0x30')]:_0x37c143[_0xc027('0x2d')]+_0x37c143['limit'];var _0x41677b;if(_0xdf0e61>=_0x428b27){_0xdf0e61=_0x428b27;_0x41677b=0xc8;}else{_0x41677b=0xce;}_0x22c28c[_0xc027('0x2a')](_0x41677b);return _0x22c28c['set'](_0xc027('0x31'),_0x542ff1+'-'+_0xdf0e61+'/'+_0x428b27)['json'](_0x89d553);}return null;};}function patchUpdates(_0x4b403f){return function(_0x394c98){try{jsonpatch[_0xc027('0x32')](_0x394c98,_0x4b403f,!![]);}catch(_0x3d96a4){return BPromise[_0xc027('0x33')](_0x3d96a4);}return _0x394c98[_0xc027('0x34')]();};}function saveUpdates(_0xc80f88,_0x1ff84a){return function(_0x1847b8){if(_0x1847b8){return _0x1847b8[_0xc027('0x35')](_0xc80f88)['then'](function(_0x5c6610){return _0x5c6610;});}return null;};}function removeEntity(_0x3aa0be,_0x49cb5b){return function(_0x2595f3){if(_0x2595f3){return _0x2595f3[_0xc027('0x36')]()['then'](function(){var _0x39f33b=_0x2595f3[_0xc027('0x37')]({'plain':!![]});var _0x4a59ac='FaxAccounts';return db[_0xc027('0x38')][_0xc027('0x36')]({'where':{'type':_0x4a59ac,'resourceId':_0x39f33b['id']}})[_0xc027('0x21')](function(){return _0x2595f3;});})[_0xc027('0x21')](function(){_0x3aa0be['status'](0xcc)[_0xc027('0x2b')]();});}};}function handleEntityNotFound(_0x275bf4,_0x257c2e){return function(_0x43c714){if(!_0x43c714){_0x275bf4[_0xc027('0x29')](0x194);}return _0x43c714;};}function handleError(_0x49f500,_0x56a1c0){_0x56a1c0=_0x56a1c0||0x1f4;return function(_0xa6f3c2){logger[_0xc027('0x25')](_0xa6f3c2[_0xc027('0x39')]);if(_0xa6f3c2[_0xc027('0x3a')]){delete _0xa6f3c2[_0xc027('0x3a')];}_0x49f500[_0xc027('0x2a')](_0x56a1c0)[_0xc027('0x3b')](_0xa6f3c2);};}exports[_0xc027('0x3c')]=function(_0x3a791f,_0x4f794a){var _0x283711={'include':[{'model':db[_0xc027('0x3d')],'as':_0xc027('0x3e')}]},_0xac18c={},_0x357b3e={'count':0x0,'rows':[]};var _0x398ecf=_[_0xc027('0x3f')](db[_0xc027('0x40')][_0xc027('0x41')],function(_0x7aefed){return{'name':_0x7aefed[_0xc027('0x42')],'type':_0x7aefed['type'][_0xc027('0x43')]};});_0xac18c[_0xc027('0x44')]=_[_0xc027('0x3f')](_0x398ecf,_0xc027('0x3a'));_0xac18c['query']=_[_0xc027('0x45')](_0x3a791f[_0xc027('0x46')]);_0xac18c[_0xc027('0x47')]=_[_0xc027('0x48')](_0xac18c[_0xc027('0x44')],_0xac18c[_0xc027('0x46')]);_0x283711[_0xc027('0x49')]=_[_0xc027('0x48')](_0xac18c[_0xc027('0x44')],qs['fields'](_0x3a791f[_0xc027('0x46')][_0xc027('0x4a')]));_0x283711['attributes']=_0x283711[_0xc027('0x49')][_0xc027('0x4b')]?_0x283711[_0xc027('0x49')]:_0xac18c[_0xc027('0x44')];if(!_0x3a791f[_0xc027('0x46')][_0xc027('0x4c')](_0xc027('0x4d'))){_0x283711[_0xc027('0x2f')]=qs['limit'](_0x3a791f[_0xc027('0x46')][_0xc027('0x2f')]);_0x283711[_0xc027('0x2d')]=qs[_0xc027('0x2d')](_0x3a791f[_0xc027('0x46')]['offset']);}_0x283711[_0xc027('0x4e')]=qs[_0xc027('0x4f')](_0x3a791f[_0xc027('0x46')]['sort']);_0x283711['where']=qs[_0xc027('0x47')](_[_0xc027('0x50')](_0x3a791f[_0xc027('0x46')],_0xac18c[_0xc027('0x47')]),_0x398ecf);if(_0x3a791f['query'][_0xc027('0x51')]){_0x283711[_0xc027('0x52')]=_['merge'](_0x283711['where'],{'$or':_[_0xc027('0x3f')](_0x398ecf,function(_0x16a2a1){if(_0x16a2a1['type']!=='VIRTUAL'){var _0x3f3173={};_0x3f3173[_0x16a2a1[_0xc027('0x3a')]]={'$like':'%'+_0x3a791f['query'][_0xc027('0x51')]+'%'};return _0x3f3173;}})});}_0x283711=_['merge']({},_0x283711,_0x3a791f[_0xc027('0x53')]);var _0x558c99={'where':_0x283711[_0xc027('0x52')]};return db[_0xc027('0x40')]['count'](_0x558c99)[_0xc027('0x21')](function(_0x24e21a){_0x357b3e[_0xc027('0x30')]=_0x24e21a;if(_0x3a791f[_0xc027('0x46')][_0xc027('0x54')]){_0x283711[_0xc027('0x55')]=[{'all':!![]}];}return db[_0xc027('0x40')]['findAll'](_0x283711);})['then'](function(_0x4a5e97){_0x357b3e[_0xc027('0x56')]=_0x4a5e97;return _0x357b3e;})[_0xc027('0x21')](respondWithFilteredResult(_0x4f794a,_0x283711))[_0xc027('0x28')](handleError(_0x4f794a,null));};exports[_0xc027('0x57')]=function(_0x637239,_0x1960b0){var _0x4be2b3={'raw':![],'where':{'id':_0x637239[_0xc027('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5c918a={};_0x5c918a[_0xc027('0x44')]=_[_0xc027('0x45')](db[_0xc027('0x40')][_0xc027('0x41')]);_0x5c918a[_0xc027('0x46')]=_[_0xc027('0x45')](_0x637239[_0xc027('0x46')]);_0x5c918a[_0xc027('0x47')]=_[_0xc027('0x48')](_0x5c918a[_0xc027('0x44')],_0x5c918a[_0xc027('0x46')]);_0x4be2b3[_0xc027('0x49')]=_['intersection'](_0x5c918a[_0xc027('0x44')],qs['fields'](_0x637239['query'][_0xc027('0x4a')]));_0x4be2b3[_0xc027('0x49')]=_0x4be2b3[_0xc027('0x49')][_0xc027('0x4b')]?_0x4be2b3[_0xc027('0x49')]:_0x5c918a[_0xc027('0x44')];if(_0x637239[_0xc027('0x46')][_0xc027('0x54')]){_0x4be2b3[_0xc027('0x55')]=[{'all':!![]}];}_0x4be2b3=_['merge']({},_0x4be2b3,_0x637239[_0xc027('0x53')]);return db[_0xc027('0x40')][_0xc027('0x59')](_0x4be2b3)[_0xc027('0x21')](handleEntityNotFound(_0x1960b0,null))[_0xc027('0x21')](respondWithResult(_0x1960b0,null))['catch'](handleError(_0x1960b0,null));};exports[_0xc027('0x5a')]=function(_0x1bbc3f,_0x346fcb){return db[_0xc027('0x40')][_0xc027('0x5a')](_0x1bbc3f[_0xc027('0x5b')],{})['then'](function(_0x1231a2){var _0xe987bb=_0x1bbc3f['user'][_0xc027('0x37')]({'plain':!![]});if(!_0xe987bb)throw new Error(_0xc027('0x5c'));if(_0xe987bb[_0xc027('0x5d')]===_0xc027('0x5e')){var _0x549c3d=_0x1231a2[_0xc027('0x37')]({'plain':!![]});var _0x1bf6b6=_0xc027('0x5f');return db[_0xc027('0x60')][_0xc027('0x59')]({'where':{'name':_0x1bf6b6,'userProfileId':_0xe987bb['userProfileId']},'raw':!![]})[_0xc027('0x21')](function(_0x58cc5c){if(_0x58cc5c&&_0x58cc5c[_0xc027('0x61')]===0x0){return db[_0xc027('0x38')][_0xc027('0x5a')]({'name':_0x549c3d[_0xc027('0x3a')],'resourceId':_0x549c3d['id'],'type':_0x58cc5c['name'],'sectionId':_0x58cc5c['id']},{})[_0xc027('0x21')](function(){return _0x1231a2;});}else{return _0x1231a2;}})['catch'](function(_0x596396){logger[_0xc027('0x25')](_0xc027('0x62'),_0x596396);throw _0x596396;});}return _0x1231a2;})[_0xc027('0x21')](respondWithResult(_0x346fcb,0xc9))[_0xc027('0x28')](handleError(_0x346fcb,null));};exports[_0xc027('0x35')]=function(_0x3d3afd,_0x1638c4){if(_0x3d3afd[_0xc027('0x5b')]['id']){delete _0x3d3afd[_0xc027('0x5b')]['id'];}return db[_0xc027('0x40')][_0xc027('0x59')]({'where':{'id':_0x3d3afd[_0xc027('0x58')]['id']},'include':[{'model':db[_0xc027('0x3d')],'as':_0xc027('0x3e')}]})[_0xc027('0x21')](handleEntityNotFound(_0x1638c4,null))[_0xc027('0x21')](saveUpdates(_0x3d3afd['body'],null))[_0xc027('0x21')](respondWithResult(_0x1638c4,null))['catch'](handleError(_0x1638c4,null));};exports['destroy']=function(_0x49755e,_0x2e1007){return db['FaxAccount'][_0xc027('0x59')]({'where':{'id':_0x49755e[_0xc027('0x58')]['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x2e1007,null))['then'](removeEntity(_0x2e1007,null))[_0xc027('0x28')](handleError(_0x2e1007,null));};exports[_0xc027('0x63')]=function(_0xd5d365,_0xa150af){return db['FaxAccount'][_0xc027('0x63')]()['then'](respondWithResult(_0xa150af,null))[_0xc027('0x28')](handleError(_0xa150af,null));};exports['addDisposition']=function(_0x15622c,_0xa6af6,_0x4ba7fb){if(_0x15622c[_0xc027('0x5b')]['id']){delete _0x15622c['body']['id'];}return db[_0xc027('0x40')]['find']({'where':{'id':_0x15622c['params']['id']}})[_0xc027('0x21')](handleEntityNotFound(_0xa6af6,null))['then'](function(_0x1dd9a6){if(_0x1dd9a6){_0x15622c[_0xc027('0x5b')][_0xc027('0x64')]=_0x1dd9a6['id'];return db[_0xc027('0x65')][_0xc027('0x5a')](_0x15622c[_0xc027('0x5b')]);}})[_0xc027('0x21')](respondWithResult(_0xa6af6,null))['catch'](handleError(_0xa6af6,null));};exports[_0xc027('0x66')]=function(_0x871829,_0x440da2,_0x18c109){var _0x32e878={'raw':![],'where':{}};var _0x2a4135={};var _0x117b94={'count':0x0,'rows':[]};return db[_0xc027('0x40')]['findOne']({'where':{'id':_0x871829[_0xc027('0x58')]['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x440da2,null))[_0xc027('0x21')](function(_0x4c80d3){if(_0x4c80d3){_0x2a4135[_0xc027('0x44')]=_[_0xc027('0x45')](db[_0xc027('0x65')][_0xc027('0x41')]);_0x2a4135[_0xc027('0x46')]=_[_0xc027('0x45')](_0x871829[_0xc027('0x46')]);_0x2a4135[_0xc027('0x47')]=_[_0xc027('0x48')](_0x2a4135['model'],_0x2a4135[_0xc027('0x46')]);_0x32e878[_0xc027('0x49')]=_['intersection'](_0x2a4135[_0xc027('0x44')],qs[_0xc027('0x4a')](_0x871829[_0xc027('0x46')]['fields']));_0x32e878[_0xc027('0x49')]=_0x32e878[_0xc027('0x49')][_0xc027('0x4b')]?_0x32e878[_0xc027('0x49')]:_0x2a4135['model'];if(!_0x871829['query']['hasOwnProperty'](_0xc027('0x4d'))){_0x32e878[_0xc027('0x2f')]=qs[_0xc027('0x2f')](_0x871829['query'][_0xc027('0x2f')]);_0x32e878[_0xc027('0x2d')]=qs[_0xc027('0x2d')](_0x871829[_0xc027('0x46')][_0xc027('0x2d')]);}_0x32e878[_0xc027('0x4e')]=qs[_0xc027('0x4f')](_0x871829['query'][_0xc027('0x4f')]);_0x32e878[_0xc027('0x52')]=qs[_0xc027('0x47')](_[_0xc027('0x50')](_0x871829[_0xc027('0x46')],_0x2a4135[_0xc027('0x47')]));_0x32e878[_0xc027('0x52')]['FaxAccountId']=_0x4c80d3['id'];if(_0x871829[_0xc027('0x46')][_0xc027('0x51')]){_0x32e878[_0xc027('0x52')]=_[_0xc027('0x67')](_0x32e878[_0xc027('0x52')],{'$or':_['map'](_0x32e878[_0xc027('0x49')],function(_0xdb4db0){var _0x1e18f6={};_0x1e18f6[_0xdb4db0]={'$like':'%'+_0x871829[_0xc027('0x46')][_0xc027('0x51')]+'%'};return _0x1e18f6;})});}_0x32e878=_[_0xc027('0x67')]({},_0x32e878,_0x871829[_0xc027('0x53')]);return db[_0xc027('0x65')][_0xc027('0x30')]({'where':_0x32e878[_0xc027('0x52')]})[_0xc027('0x21')](function(_0x452ae6){_0x117b94[_0xc027('0x30')]=_0x452ae6;if(_0x871829[_0xc027('0x46')][_0xc027('0x54')]){_0x32e878[_0xc027('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xc027('0x68')](_0x32e878);})[_0xc027('0x21')](function(_0x1a42f6){_0x117b94[_0xc027('0x56')]=_0x1a42f6;return _0x117b94;});}})[_0xc027('0x21')](respondWithFilteredResult(_0x440da2,_0x32e878))[_0xc027('0x28')](handleError(_0x440da2,null));};exports[_0xc027('0x69')]=function(_0x4dc9ba,_0x2e80a0,_0xf0d43){return db['FaxAccount'][_0xc027('0x59')]({'where':{'id':_0x4dc9ba[_0xc027('0x58')]['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x2e80a0,null))[_0xc027('0x21')](function(_0x405b99){if(_0x405b99){return _0x405b99[_0xc027('0x69')](_0x4dc9ba[_0xc027('0x46')][_0xc027('0x6a')]);}})['then'](respondWithStatusCode(_0x2e80a0,null))[_0xc027('0x28')](handleError(_0x2e80a0,null));};exports[_0xc027('0x6b')]=function(_0x14e469,_0xd3abe8,_0xff0049){if(_0x14e469[_0xc027('0x5b')]['id']){delete _0x14e469[_0xc027('0x5b')]['id'];}return db[_0xc027('0x40')][_0xc027('0x59')]({'where':{'id':_0x14e469['params']['id']}})[_0xc027('0x21')](handleEntityNotFound(_0xd3abe8,null))['then'](function(_0x90d03c){if(_0x90d03c){_0x14e469[_0xc027('0x5b')][_0xc027('0x64')]=_0x90d03c['id'];return db[_0xc027('0x6c')]['create'](_0x14e469[_0xc027('0x5b')]);}})['then'](respondWithResult(_0xd3abe8,null))[_0xc027('0x28')](handleError(_0xd3abe8,null));};exports[_0xc027('0x6d')]=function(_0x15244e,_0x4c20ed,_0x1d5ba6){var _0xedf792={'raw':![],'where':{}};var _0x3f01e3={};var _0x22a3f3={'count':0x0,'rows':[]};return db[_0xc027('0x40')]['findOne']({'where':{'id':_0x15244e[_0xc027('0x58')]['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x4c20ed,null))['then'](function(_0x4fa2b4){if(_0x4fa2b4){_0x3f01e3[_0xc027('0x44')]=_[_0xc027('0x45')](db[_0xc027('0x6c')]['rawAttributes']);_0x3f01e3[_0xc027('0x46')]=_[_0xc027('0x45')](_0x15244e['query']);_0x3f01e3['filters']=_['intersection'](_0x3f01e3['model'],_0x3f01e3[_0xc027('0x46')]);_0xedf792[_0xc027('0x49')]=_[_0xc027('0x48')](_0x3f01e3[_0xc027('0x44')],qs[_0xc027('0x4a')](_0x15244e[_0xc027('0x46')]['fields']));_0xedf792['attributes']=_0xedf792[_0xc027('0x49')][_0xc027('0x4b')]?_0xedf792[_0xc027('0x49')]:_0x3f01e3[_0xc027('0x44')];if(!_0x15244e[_0xc027('0x46')][_0xc027('0x4c')]('nolimit')){_0xedf792['limit']=qs['limit'](_0x15244e[_0xc027('0x46')]['limit']);_0xedf792[_0xc027('0x2d')]=qs['offset'](_0x15244e[_0xc027('0x46')][_0xc027('0x2d')]);}_0xedf792[_0xc027('0x4e')]=qs[_0xc027('0x4f')](_0x15244e[_0xc027('0x46')][_0xc027('0x4f')]);_0xedf792[_0xc027('0x52')]=qs['filters'](_['pick'](_0x15244e[_0xc027('0x46')],_0x3f01e3['filters']));_0xedf792['where']['FaxAccountId']=_0x4fa2b4['id'];if(_0x15244e[_0xc027('0x46')][_0xc027('0x51')]){_0xedf792[_0xc027('0x52')]=_[_0xc027('0x67')](_0xedf792[_0xc027('0x52')],{'$or':_[_0xc027('0x3f')](_0xedf792[_0xc027('0x49')],function(_0x4eece2){var _0x43ebb4={};_0x43ebb4[_0x4eece2]={'$like':'%'+_0x15244e['query'][_0xc027('0x51')]+'%'};return _0x43ebb4;})});}_0xedf792=_['merge']({},_0xedf792,_0x15244e['options']);return db[_0xc027('0x6c')]['count']({'where':_0xedf792[_0xc027('0x52')]})['then'](function(_0x37ddd3){_0x22a3f3[_0xc027('0x30')]=_0x37ddd3;if(_0x15244e[_0xc027('0x46')]['includeAll']){_0xedf792['include']=[{'all':!![]}];}return db[_0xc027('0x6c')][_0xc027('0x68')](_0xedf792);})[_0xc027('0x21')](function(_0x5cf5d1){_0x22a3f3[_0xc027('0x56')]=_0x5cf5d1;return _0x22a3f3;});}})['then'](respondWithFilteredResult(_0x4c20ed,_0xedf792))[_0xc027('0x28')](handleError(_0x4c20ed,null));};exports[_0xc027('0x6e')]=function(_0x44d1a4,_0x1fb1ed,_0x4e5033){return db[_0xc027('0x40')][_0xc027('0x59')]({'where':{'id':_0x44d1a4[_0xc027('0x58')]['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x1fb1ed,null))['then'](function(_0x4ef54d){if(_0x4ef54d){return _0x4ef54d[_0xc027('0x6e')](_0x44d1a4[_0xc027('0x46')][_0xc027('0x6a')]);}})[_0xc027('0x21')](respondWithStatusCode(_0x1fb1ed,null))['catch'](handleError(_0x1fb1ed,null));};exports[_0xc027('0x6f')]=function(_0x4fd8ba,_0x5ea7db,_0x4ae513){return db[_0xc027('0x70')]['find']({'where':{'id':_0x4fd8ba[_0xc027('0x58')]['id']}})['then'](handleEntityNotFound(_0x5ea7db,null))[_0xc027('0x21')](function(_0x22240e){if(_0x22240e){return _0x22240e[_0xc027('0x6f')](_0x4fd8ba[_0xc027('0x5b')][_0xc027('0x6a')],_[_0xc027('0x71')](_0x4fd8ba[_0xc027('0x5b')],['ids','id'])||{});}})['then'](respondWithResult(_0x5ea7db,null))[_0xc027('0x28')](handleError(_0x5ea7db,null));};exports[_0xc027('0x72')]=function(_0x4f4303,_0x415c49,_0x20b673){var _0x29a38b={'raw':![],'where':{}};var _0x3a95bc={};var _0x425f7e={'count':0x0,'rows':[]};return db[_0xc027('0x40')][_0xc027('0x73')]({'where':{'id':_0x4f4303['params']['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x415c49,null))['then'](function(_0x14cde1){if(_0x14cde1){_0x3a95bc['model']=_['keys'](db[_0xc027('0x70')][_0xc027('0x41')]);_0x3a95bc[_0xc027('0x46')]=_[_0xc027('0x45')](_0x4f4303[_0xc027('0x46')]);_0x3a95bc[_0xc027('0x47')]=_[_0xc027('0x48')](_0x3a95bc[_0xc027('0x44')],_0x3a95bc[_0xc027('0x46')]);_0x29a38b['attributes']=_[_0xc027('0x48')](_0x3a95bc[_0xc027('0x44')],qs[_0xc027('0x4a')](_0x4f4303['query'][_0xc027('0x4a')]));_0x29a38b[_0xc027('0x49')]=_0x29a38b[_0xc027('0x49')][_0xc027('0x4b')]?_0x29a38b[_0xc027('0x49')]:_0x3a95bc[_0xc027('0x44')];if(!_0x4f4303[_0xc027('0x46')]['hasOwnProperty'](_0xc027('0x4d'))){_0x29a38b[_0xc027('0x2f')]=qs['limit'](_0x4f4303[_0xc027('0x46')][_0xc027('0x2f')]);_0x29a38b[_0xc027('0x2d')]=qs[_0xc027('0x2d')](_0x4f4303[_0xc027('0x46')][_0xc027('0x2d')]);}_0x29a38b[_0xc027('0x4e')]=qs[_0xc027('0x4f')](_0x4f4303[_0xc027('0x46')][_0xc027('0x4f')]);_0x29a38b[_0xc027('0x52')]=qs[_0xc027('0x47')](_[_0xc027('0x50')](_0x4f4303[_0xc027('0x46')],_0x3a95bc[_0xc027('0x47')]));_0x29a38b[_0xc027('0x52')][_0xc027('0x64')]=_0x14cde1['id'];if(_0x4f4303['query'][_0xc027('0x51')]){_0x29a38b[_0xc027('0x52')]=_[_0xc027('0x67')](_0x29a38b[_0xc027('0x52')],{'$or':_['map'](_0x29a38b[_0xc027('0x49')],function(_0x4a9624){var _0x206b13={};_0x206b13[_0x4a9624]={'$like':'%'+_0x4f4303[_0xc027('0x46')][_0xc027('0x51')]+'%'};return _0x206b13;})});}_0x29a38b=_[_0xc027('0x67')]({},_0x29a38b,_0x4f4303[_0xc027('0x53')]);return db[_0xc027('0x70')][_0xc027('0x30')]({'where':_0x29a38b[_0xc027('0x52')]})[_0xc027('0x21')](function(_0x1a6398){_0x425f7e[_0xc027('0x30')]=_0x1a6398;if(_0x4f4303[_0xc027('0x46')][_0xc027('0x54')]){_0x29a38b['include']=[{'model':db[_0xc027('0x74')],'as':_0xc027('0x75'),'required':![]},{'model':db[_0xc027('0x76')],'as':_0xc027('0x77'),'attributes':[_0xc027('0x3a'),'fullname',_0xc027('0x78')],'required':![]},{'model':db[_0xc027('0x79')],'as':'Tags','attributes':['id',_0xc027('0x3a'),_0xc027('0x7a')],'where':_0x4f4303[_0xc027('0x46')][_0xc027('0x7b')]?{'id':_0x4f4303[_0xc027('0x46')][_0xc027('0x7b')]}:undefined,'required':_0x4f4303[_0xc027('0x46')][_0xc027('0x7b')]?!![]:![]}];}return db[_0xc027('0x70')][_0xc027('0x68')](_0x29a38b);})['then'](function(_0xa1a186){_0x425f7e[_0xc027('0x56')]=_0xa1a186;return _0x425f7e;});}})[_0xc027('0x21')](respondWithFilteredResult(_0x415c49,_0x29a38b))['catch'](handleError(_0x415c49,null));};exports[_0xc027('0x7c')]=function(_0x30b0d0,_0x3eccdf,_0x415e73){return db['FaxAccount'][_0xc027('0x73')]({'where':{'id':_0x30b0d0[_0xc027('0x58')]['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x3eccdf,null))[_0xc027('0x21')](function(_0x2b724d){if(_0x2b724d){return db[_0xc027('0x7d')][_0xc027('0x7e')](function(_0x56b629){return db['FaxApplication'][_0xc027('0x36')]({'where':{'FaxAccountId':_0x30b0d0[_0xc027('0x58')]['id']},'transaction':_0x56b629})[_0xc027('0x21')](function(_0xbd1b34){var _0x4d843c=_[_0xc027('0x3f')](_0x30b0d0[_0xc027('0x5b')],function(_0x12d754){_0x12d754[_0xc027('0x64')]=_0x30b0d0['params']['id'];return _0x12d754;});return db[_0xc027('0x7f')][_0xc027('0x80')](_0x4d843c,{'transaction':_0x56b629});});})[_0xc027('0x21')](function(){return db[_0xc027('0x7f')][_0xc027('0x81')]({'where':{'FaxAccountId':_0x30b0d0[_0xc027('0x58')]['id']},'order':_0xc027('0x82')});});}})['then'](respondWithResult(_0x3eccdf,null))[_0xc027('0x28')](handleError(_0x3eccdf,null));};exports['getApplications']=function(_0x4c3743,_0x2b3fe6,_0x47ea2d){var _0xbd9d76={};var _0x755e93={};var _0x120e8c;var _0x45496a;return db[_0xc027('0x40')]['findOne']({'where':{'id':_0x4c3743[_0xc027('0x58')]['id']}})['then'](handleEntityNotFound(_0x2b3fe6,null))[_0xc027('0x21')](function(_0x429e76){if(_0x429e76){_0x120e8c=_0x429e76;_0x755e93[_0xc027('0x44')]=_[_0xc027('0x45')](db[_0xc027('0x7f')]['rawAttributes']);_0x755e93[_0xc027('0x46')]=_[_0xc027('0x45')](_0x4c3743[_0xc027('0x46')]);_0x755e93[_0xc027('0x47')]=_[_0xc027('0x48')](_0x755e93[_0xc027('0x44')],_0x755e93[_0xc027('0x46')]);_0xbd9d76['attributes']=_[_0xc027('0x48')](_0x755e93[_0xc027('0x44')],qs[_0xc027('0x4a')](_0x4c3743[_0xc027('0x46')]['fields']));_0xbd9d76['attributes']=_0xbd9d76[_0xc027('0x49')][_0xc027('0x4b')]?_0xbd9d76['attributes']:_0x755e93[_0xc027('0x44')];_0xbd9d76[_0xc027('0x4e')]=qs[_0xc027('0x4f')](_0x4c3743[_0xc027('0x46')][_0xc027('0x4f')]);_0xbd9d76['where']=qs['filters'](_[_0xc027('0x50')](_0x4c3743[_0xc027('0x46')],_0x755e93['filters']));if(_0x4c3743[_0xc027('0x46')][_0xc027('0x51')]){_0xbd9d76[_0xc027('0x52')]=_[_0xc027('0x67')](_0xbd9d76[_0xc027('0x52')],{'$or':_[_0xc027('0x3f')](_0xbd9d76['attributes'],function(_0x1f65cc){var _0x339dcc={};_0x339dcc[_0x1f65cc]={'$like':'%'+_0x4c3743[_0xc027('0x46')]['filter']+'%'};return _0x339dcc;})});}_0xbd9d76=_[_0xc027('0x67')]({},_0xbd9d76,_0x4c3743[_0xc027('0x53')]);return _0x120e8c[_0xc027('0x83')](_0xbd9d76);}})['then'](function(_0x249533){if(_0x249533){_0x45496a=_0x249533['length'];if(!_0x4c3743[_0xc027('0x46')][_0xc027('0x4c')]('nolimit')){_0xbd9d76['limit']=qs[_0xc027('0x2f')](_0x4c3743[_0xc027('0x46')][_0xc027('0x2f')]);_0xbd9d76[_0xc027('0x2d')]=qs[_0xc027('0x2d')](_0x4c3743[_0xc027('0x46')][_0xc027('0x2d')]);}return _0x120e8c['getApplications'](_0xbd9d76);}})[_0xc027('0x21')](function(_0x129c73){if(_0x129c73){return _0x129c73?{'count':_0x45496a,'rows':_0x129c73}:null;}})[_0xc027('0x21')](respondWithResult(_0x2b3fe6,null))[_0xc027('0x28')](handleError(_0x2b3fe6,null));};function Extension(_0x108d56,_0x2f3602,_0x10d9e8,_0x3a183e){this[_0xc027('0x84')]=_0xc027('0x85');this[_0xc027('0x86')]=_0x108d56[_0xc027('0x87')];this[_0xc027('0x88')]=_0x3a183e;this[_0xc027('0x89')]=_0xc027('0x8a');this[_0xc027('0x8b')]='Fax\x20Extension';this['FaxAccountId']=_0x108d56['id'];this[_0xc027('0x82')]=_0x2f3602;this[_0xc027('0x8c')]=_0x10d9e8;}function createExtensionsReciveFax(_0x6ce269){var _0x1f6dac=0x1;var _0x5c2224=[];_0x5c2224[_0xc027('0x8d')](new Extension(_0x6ce269,_0x1f6dac,'',_0xc027('0x8e')));_0x1f6dac+=0x1;_0x5c2224[_0xc027('0x8d')](new Extension(_0x6ce269,_0x1f6dac,'CDR(type)=inbound-fax',_0xc027('0x8f')));_0x1f6dac+=0x1;for(var _0x286f80 in _0x6ce269){if(_0x6ce269[_0xc027('0x4c')](_0x286f80)&&(_0x286f80===_0xc027('0x90')||_0x286f80===_0xc027('0x87')||_0x286f80===_0xc027('0x91')||_0x286f80===_0xc027('0x92')||_0x286f80===_0xc027('0x93')||_0x286f80===_0xc027('0x94')||_0x286f80===_0xc027('0x95')||_0x286f80===_0xc027('0x96')||_0x286f80==='t38timeout')){_0x5c2224[_0xc027('0x8d')](new Extension(_0x6ce269,_0x1f6dac,_0xc027('0x97')+_0x286f80+')='+_0x6ce269[_0x286f80],_0xc027('0x8f')));_0x1f6dac+=0x1;}}_0x5c2224[_0xc027('0x8d')](new Extension(_0x6ce269,_0x1f6dac,'6',_0xc027('0x98')));_0x1f6dac+=0x1;_0x5c2224[_0xc027('0x8d')](new Extension(_0x6ce269,_0x1f6dac,'/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',_0xc027('0x99')));_0x1f6dac=0x0;return _0x5c2224;}exports[_0xc027('0x9a')]=function(_0x333f5f,_0x43441f,_0x5c4883){var _0x389f36;return db[_0xc027('0x7d')][_0xc027('0x7e')](function(_0x2eaee0){return db[_0xc027('0x40')][_0xc027('0x5a')](_0x333f5f[_0xc027('0x5b')],{'transaction':_0x2eaee0})['then'](function(_0x489201){_0x389f36=_0x489201['get']({'plain':!![]});return db[_0xc027('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x389f36),{'transaction':_0x2eaee0});});})['then'](function(){return _0x389f36;})[_0xc027('0x21')](respondWithResult(_0x43441f,null))[_0xc027('0x28')](handleError(_0x43441f,null));};exports['updateAccountApplications']=function(_0x58a28e,_0x5da0db,_0x3667d6){var _0xa33423;return db[_0xc027('0x7d')][_0xc027('0x7e')](function(_0x457e38){return db[_0xc027('0x40')][_0xc027('0x35')](_0x58a28e[_0xc027('0x5b')],{'where':{'id':_0x58a28e['body']['id']},'transaction':_0x457e38})[_0xc027('0x21')](function(_0xbf0b1e){return db[_0xc027('0x9b')][_0xc027('0x36')]({'where':{'FaxAccountId':_0x58a28e[_0xc027('0x5b')]['id']},'transaction':_0x457e38})['then'](function(_0x152c54){return db[_0xc027('0x9b')][_0xc027('0x80')](createExtensionsReciveFax(_[_0xc027('0x71')](_0x58a28e[_0xc027('0x5b')],[_0xc027('0x9c'),_0xc027('0x43'),_0xc027('0x9d'),_0xc027('0x9e'),_0xc027('0x9f'),_0xc027('0xa0')])),{'transaction':_0x457e38});});});})['then'](function(){return db[_0xc027('0x40')][_0xc027('0xa1')](_0x58a28e[_0xc027('0x5b')]['id']);})[_0xc027('0x21')](respondWithResult(_0x5da0db,null))['catch'](handleError(_0x5da0db,null));};exports['getMessages']=function(_0x543675,_0x5a461c,_0x3576c5){var _0x1687dc={'raw':!![],'where':{}};var _0x4aeaf9={};var _0x99f41d={'count':0x0,'rows':[]};return db[_0xc027('0x40')]['findOne']({'where':{'id':_0x543675[_0xc027('0x58')]['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x5a461c,null))[_0xc027('0x21')](function(_0x3dce1c){if(_0x3dce1c){_0x4aeaf9[_0xc027('0x44')]=_[_0xc027('0x45')](db[_0xc027('0xa2')][_0xc027('0x41')]);_0x4aeaf9[_0xc027('0x46')]=_['keys'](_0x543675[_0xc027('0x46')]);_0x4aeaf9[_0xc027('0x47')]=_[_0xc027('0x48')](_0x4aeaf9[_0xc027('0x44')],_0x4aeaf9[_0xc027('0x46')]);_0x1687dc[_0xc027('0x49')]=_[_0xc027('0x48')](_0x4aeaf9['model'],qs[_0xc027('0x4a')](_0x543675[_0xc027('0x46')]['fields']));_0x1687dc[_0xc027('0x49')]=_0x1687dc[_0xc027('0x49')][_0xc027('0x4b')]?_0x1687dc[_0xc027('0x49')]:_0x4aeaf9['model'];if(!_0x543675['query'][_0xc027('0x4c')](_0xc027('0x4d'))){_0x1687dc['limit']=qs[_0xc027('0x2f')](_0x543675[_0xc027('0x46')][_0xc027('0x2f')]);_0x1687dc['offset']=qs[_0xc027('0x2d')](_0x543675[_0xc027('0x46')]['offset']);}_0x1687dc[_0xc027('0x4e')]=qs[_0xc027('0x4f')](_0x543675[_0xc027('0x46')][_0xc027('0x4f')]);_0x1687dc[_0xc027('0x52')]=qs[_0xc027('0x47')](_[_0xc027('0x50')](_0x543675['query'],_0x4aeaf9['filters']));_0x1687dc[_0xc027('0x52')][_0xc027('0x64')]=_0x3dce1c['id'];if(_0x543675['query'][_0xc027('0x51')]){_0x1687dc[_0xc027('0x52')]=_[_0xc027('0x67')](_0x1687dc[_0xc027('0x52')],{'$or':_[_0xc027('0x3f')](_0x1687dc[_0xc027('0x49')],function(_0x38a9a7){var _0x27a38d={};_0x27a38d[_0x38a9a7]={'$like':'%'+_0x543675[_0xc027('0x46')][_0xc027('0x51')]+'%'};return _0x27a38d;})});}if(_0x543675[_0xc027('0x46')][_0xc027('0xa3')]){var _0x35ec50=_0x543675[_0xc027('0x46')][_0xc027('0xa3')][_0xc027('0xa4')](',');var _0x156688={};_0x156688[_0x35ec50[0x0]]={'$gte':moment(_0x35ec50[0x1])[_0xc027('0xa5')](_0xc027('0xa6'))};_0x1687dc[_0xc027('0x52')]=_['merge'](_0x1687dc['where'],_0x156688);}_0x1687dc=_[_0xc027('0x67')]({},_0x1687dc,_0x543675[_0xc027('0x53')]);return db[_0xc027('0xa2')][_0xc027('0x30')]({'where':_0x1687dc['where']})[_0xc027('0x21')](function(_0x436383){_0x99f41d[_0xc027('0x30')]=_0x436383;if(_0x543675[_0xc027('0x46')]['includeAll']){_0x1687dc[_0xc027('0x55')]=[{'all':!![]}];}return db[_0xc027('0xa2')][_0xc027('0x68')](_0x1687dc);})[_0xc027('0x21')](function(_0x14e80d){_0x99f41d[_0xc027('0x56')]=_0x14e80d;return _0x99f41d;});}})[_0xc027('0x21')](respondWithFilteredResult(_0x5a461c,_0x1687dc))[_0xc027('0x28')](handleError(_0x5a461c,null));};exports[_0xc027('0x3b')]=function(_0x2db7be,_0x5c6acf,_0x27a4fb){var _0x104c5b,_0x5b07f6={},_0x29c9e8;if(_0x2db7be[_0xc027('0x5b')]['to']){_0x29c9e8=_0x2db7be[_0xc027('0x5b')]['to'][0x0];}return db[_0xc027('0x40')][_0xc027('0x59')]({'where':{'id':_0x2db7be['params']['id']},'include':[{'model':db[_0xc027('0xa7')],'as':_0xc027('0xa8'),'include':[{'model':db[_0xc027('0x74')],'as':'Contacts','where':{'fax':_0x29c9e8},'limit':0x1,'order':[[_0xc027('0x9e'),_0xc027('0xa9')]]}]}]})[_0xc027('0x21')](handleEntityNotFound(_0x5c6acf,null))['then'](function(_0x405412){_0x104c5b=_0x405412;if(_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')]&&_0x2db7be[_0xc027('0x5b')]['attachments'][_0xc027('0x4b')]){for(var _0x2c599a=0x0;_0x2c599a<_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][_0xc027('0x4b')];_0x2c599a+=0x1){_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][_0x2c599a]={'filename':_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][_0x2c599a][_0xc027('0x3a')],'id':_0x2db7be['body'][_0xc027('0xaa')][_0x2c599a]['id'],'path':path['join'](config[_0xc027('0xab')],_0xc027('0xac'),_0x2db7be['body'][_0xc027('0xaa')][_0x2c599a][_0xc027('0xad')])};}}return respondWithRpcPromise(_0xc027('0xae'),_0xc027('0xae'),{'FaxAccountId':_[_0xc027('0xaf')](_0x2db7be[_0xc027('0x58')]['id'])?undefined:_0x2db7be[_0xc027('0x58')]['id'],'path':_[_0xc027('0xaf')](_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0][_0xc027('0x8')])?undefined:_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0][_0xc027('0x8')],'fax':_[_0xc027('0xaf')](_0x2db7be[_0xc027('0x5b')]['to'][0x0])?undefined:_0x2db7be['body']['to'][0x0]},client9002);})[_0xc027('0x21')](function(){if(_0x104c5b){if(_[_0xc027('0xaf')](_0x2db7be[_0xc027('0x5b')][_0xc027('0xb0')])){_0x2db7be['body'][_0xc027('0xb0')]=util[_0xc027('0xa5')](_0xc027('0xb1'),_0x104c5b[_0xc027('0x3a')],_0x104c5b[_0xc027('0xb2')]);}if(_0x104c5b[_0xc027('0xa8')]){if(_0x104c5b[_0xc027('0xa8')][_0xc027('0xb3')][_0xc027('0x4b')]){return _0x104c5b[_0xc027('0xa8')][_0xc027('0xb3')][0x0];}else{return db[_0xc027('0x74')][_0xc027('0x5a')](_[_0xc027('0x1b')](_0x2db7be['body'],{'firstName':_0x2db7be['body']['to'][0x0],'phone':_0x2db7be[_0xc027('0x5b')]['to'][0x0],'fax':_0x2db7be[_0xc027('0x5b')]['to'][0x0],'ListId':_0x104c5b[_0xc027('0xa0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xc027('0xb4'));}})[_0xc027('0x21')](function(_0x3278f9){if(_0x3278f9){return db[_0xc027('0x70')][_0xc027('0x59')]({'where':{'ContactId':_0x3278f9['id'],'closed':![],'FaxAccountId':_0x104c5b['id']}})['then'](function(_0x32e438){if(_0x32e438){return[_0x32e438,![]];}return db[_0xc027('0x70')][_0xc027('0x5a')]({'UserId':_0x2db7be[_0xc027('0x5e')]['id'],'ContactId':_0x3278f9['id'],'FaxAccountId':_0x104c5b['id'],'fax':_0x2db7be[_0xc027('0x5b')]['to'][0x0],'firstMsgDirection':_0xc027('0xb5'),'Messages':[_[_0xc027('0x67')](_0x2db7be[_0xc027('0x5b')],{'read':![],'body':_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0][_0xc027('0xb6')],'FaxAccountId':_0x104c5b['id'],'UserId':_0x2db7be['user']['id'],'ContactId':_0x3278f9['id'],'AttachmentId':_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xc027('0xa2')],'as':'Messages'}]})[_0xc027('0x21')](function(_0xf3e562){return[_0xf3e562,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x355506,_0x341507){if(_0x341507){return _0x355506;}return db['FaxMessage']['create']({'direction':_0xc027('0xb5'),'read':![],'body':_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0][_0xc027('0xb6')],'FaxAccountId':_0x104c5b['id'],'FaxInteractionId':_0x355506['id'],'UserId':_0x2db7be[_0xc027('0x5e')]['id'],'ContactId':_0x355506['ContactId'],'AttachmentId':_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0]['id']})['then'](function(_0x5a9d5d){_0x355506[_0xc027('0xb7')][_0xc027('0xb8')]=[];_0x355506[_0xc027('0xb7')][_0xc027('0xb8')][_0xc027('0x8d')](_0x5a9d5d[_0xc027('0xb7')]);return _0x355506;});})[_0xc027('0x21')](function(_0x54c1f0){respondWithRpcPromise(_0xc027('0xb9'),_0xc027('0xb9'),{'FaxAccountId':_[_0xc027('0xaf')](_0x2db7be[_0xc027('0x58')]['id'])?undefined:_0x2db7be['params']['id'],'path':_[_0xc027('0xaf')](_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0]['path'])?undefined:_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0][_0xc027('0x8')],'fax':_[_0xc027('0xaf')](_0x2db7be[_0xc027('0x5b')]['to'][0x0])?undefined:_0x2db7be[_0xc027('0x5b')]['to'][0x0],'AttachmentId':_0x2db7be[_0xc027('0x5b')][_0xc027('0xaa')][0x0]['id']},client9002)[_0xc027('0x21')](function(_0x2f0479){logger[_0xc027('0xba')](_0xc027('0xbb'),_0x2f0479);})[_0xc027('0x28')](function(_0x2d6665){logger[_0xc027('0xba')](_0xc027('0xbb'),_0x2d6665);});return _0x54c1f0;})[_0xc027('0x21')](respondWithResult(_0x5c6acf,null))[_0xc027('0x28')](handleError(_0x5c6acf,null));};exports[_0xc027('0xbc')]=function(_0x4a2ce4,_0x3476b7,_0x235072){return db[_0xc027('0x40')][_0xc027('0x59')]({'where':{'id':_0x4a2ce4['params']['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x3476b7,null))[_0xc027('0x21')](function(_0x3ef325){if(_0x3ef325){return _0x3ef325[_0xc027('0xbc')](_0x4a2ce4[_0xc027('0x5b')][_0xc027('0x6a')],_['omit'](_0x4a2ce4[_0xc027('0x5b')],[_0xc027('0x6a'),'id'])||{})[_0xc027('0xbd')](function(_0x282a50){for(var _0x2d57ed=0x0;_0x2d57ed<_0x4a2ce4['body'][_0xc027('0x6a')][_0xc027('0x4b')];_0x2d57ed+=0x1){socket['emit'](_0xc027('0xbe'),{'UserId':Number(_0x4a2ce4[_0xc027('0x5b')][_0xc027('0x6a')][_0x2d57ed]),'FaxAccountId':Number(_0x4a2ce4['params']['id'])});}return _0x282a50;});}})[_0xc027('0x21')](respondWithResult(_0x3476b7,null))[_0xc027('0x28')](handleError(_0x3476b7,null));};exports[_0xc027('0xbf')]=function(_0x199827,_0x233eca,_0x21eb29){return db[_0xc027('0x40')][_0xc027('0x59')]({'where':{'id':_0x199827['params']['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x233eca,null))[_0xc027('0x21')](function(_0x408cd6){if(_0x408cd6){return _0x408cd6[_0xc027('0xbf')](_0x199827[_0xc027('0x46')]['ids'])[_0xc027('0x21')](function(){if(_[_0xc027('0xc0')](_0x199827[_0xc027('0x46')][_0xc027('0x6a')])){for(var _0x3d046=0x0;_0x3d046<_0x199827[_0xc027('0x46')][_0xc027('0x6a')][_0xc027('0x4b')];_0x3d046+=0x1){socket[_0xc027('0xc1')](_0xc027('0xc2'),{'UserId':Number(_0x199827[_0xc027('0x46')][_0xc027('0x6a')][_0x3d046]),'FaxAccountId':Number(_0x199827[_0xc027('0x58')]['id'])});}}else{socket[_0xc027('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x199827[_0xc027('0x46')]['ids']),'FaxAccountId':Number(_0x199827[_0xc027('0x58')]['id'])});}});}})[_0xc027('0x21')](respondWithStatusCode(_0x233eca,null))[_0xc027('0x28')](handleError(_0x233eca,null));};exports[_0xc027('0xc3')]=function(_0x9030e1,_0x1fdfcd,_0x276291){var _0x10ee9f={};var _0x2ab85f={};var _0x564271;var _0xadfcca;return db[_0xc027('0x40')][_0xc027('0x73')]({'where':{'id':_0x9030e1[_0xc027('0x58')]['id']}})[_0xc027('0x21')](handleEntityNotFound(_0x1fdfcd,null))['then'](function(_0x394550){if(_0x394550){_0x564271=_0x394550;_0x2ab85f[_0xc027('0x44')]=_['keys'](db[_0xc027('0x76')][_0xc027('0x41')]);_0x2ab85f['query']=_[_0xc027('0x45')](_0x9030e1[_0xc027('0x46')]);_0x2ab85f[_0xc027('0x47')]=_[_0xc027('0x48')](_0x2ab85f[_0xc027('0x44')],_0x2ab85f[_0xc027('0x46')]);_0x10ee9f[_0xc027('0x49')]=_[_0xc027('0x48')](_0x2ab85f[_0xc027('0x44')],qs['fields'](_0x9030e1['query'][_0xc027('0x4a')]));_0x10ee9f[_0xc027('0x49')]=_0x10ee9f[_0xc027('0x49')][_0xc027('0x4b')]?_0x10ee9f[_0xc027('0x49')]:_0x2ab85f[_0xc027('0x44')];_0x10ee9f['order']=qs[_0xc027('0x4f')](_0x9030e1[_0xc027('0x46')][_0xc027('0x4f')]);_0x10ee9f['where']=qs[_0xc027('0x47')](_[_0xc027('0x50')](_0x9030e1[_0xc027('0x46')],_0x2ab85f['filters']));if(_0x9030e1[_0xc027('0x46')][_0xc027('0x51')]){_0x10ee9f['where']=_[_0xc027('0x67')](_0x10ee9f[_0xc027('0x52')],{'$or':_[_0xc027('0x3f')](_0x10ee9f['attributes'],function(_0x393039){var _0x2cf3bc={};_0x2cf3bc[_0x393039]={'$like':'%'+_0x9030e1[_0xc027('0x46')]['filter']+'%'};return _0x2cf3bc;})});}_0x10ee9f=_[_0xc027('0x67')]({},_0x10ee9f,_0x9030e1[_0xc027('0x53')]);return _0x564271[_0xc027('0xc3')](_0x10ee9f);}})[_0xc027('0x21')](function(_0x317318){if(_0x317318){_0xadfcca=_0x317318[_0xc027('0x4b')];if(!_0x9030e1[_0xc027('0x46')]['hasOwnProperty']('nolimit')){_0x10ee9f['limit']=qs[_0xc027('0x2f')](_0x9030e1['query']['limit']);_0x10ee9f[_0xc027('0x2d')]=qs['offset'](_0x9030e1[_0xc027('0x46')][_0xc027('0x2d')]);}return _0x564271[_0xc027('0xc3')](_0x10ee9f);}})['then'](function(_0x5ac99b){if(_0x5ac99b){return _0x5ac99b?{'count':_0xadfcca,'rows':_0x5ac99b}:null;}})['then'](respondWithResult(_0x1fdfcd,null))[_0xc027('0x28')](handleError(_0x1fdfcd,null));}; \ No newline at end of file +var _0x8ed5=['eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxAccount.socket','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','mandatoryDispositionPause','keys','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','find','userProfileId','autoAssociation','describe','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','bulkCreate','updateAccountApplications','VoiceExtension','updatedAt','TrunkId','ListId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','Send\x20Fax\x20failed','out','filename','spread','ContactId','dataValues','Messages','SendFax','omit','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents'];(function(_0xe54217,_0x173067){var _0x2f7dbb=function(_0x2b9e34){while(--_0x2b9e34){_0xe54217['push'](_0xe54217['shift']());}};_0x2f7dbb(++_0x173067);}(_0x8ed5,0x182));var _0x58ed=function(_0x16dec6,_0x3e1cf3){_0x16dec6=_0x16dec6-0x0;var _0x234932=_0x8ed5[_0x16dec6];return _0x234932;};'use strict';var emlformat=require(_0x58ed('0x0'));var rimraf=require(_0x58ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x58ed('0x2'));var moment=require(_0x58ed('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x58ed('0x4'));var util=require(_0x58ed('0x5'));var path=require(_0x58ed('0x6'));var sox=require(_0x58ed('0x7'));var csv=require('to-csv');var ejs=require(_0x58ed('0x8'));var fs=require('fs');var fs_extra=require(_0x58ed('0x9'));var _=require(_0x58ed('0xa'));var squel=require('squel');var crypto=require(_0x58ed('0xb'));var jsforce=require(_0x58ed('0xc'));var deskjs=require(_0x58ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0x58ed('0xe'));var Papa=require(_0x58ed('0xf'));var Redis=require(_0x58ed('0x10'));var authService=require(_0x58ed('0x11'));var qs=require(_0x58ed('0x12'));var as=require(_0x58ed('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x58ed('0x14'));var utils=require(_0x58ed('0x15'));var config=require(_0x58ed('0x16'));var licenseUtil=require(_0x58ed('0x17'));var db=require(_0x58ed('0x18'))['db'];config['redis']=_[_0x58ed('0x19')](config[_0x58ed('0x1a')],{'host':_0x58ed('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58ed('0x1a')]));require(_0x58ed('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x58ed('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x58ed('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5dcda5,_0xa534c8,_0xf56ba0,_0x40be6c){return new BPromise(function(_0x4a16ef,_0x4980d7){var _0x40f835=_0x40be6c||client;return _0x40f835[_0x58ed('0x1f')](_0x5dcda5,_0xf56ba0)['then'](function(_0x2ca1ab){logger[_0x58ed('0x20')](_0x58ed('0x21'),_0xa534c8,_0x58ed('0x22'));logger[_0x58ed('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xa534c8,_0x58ed('0x22'),JSON[_0x58ed('0x24')](_0x2ca1ab));if(_0x2ca1ab[_0x58ed('0x25')]){if(_0x2ca1ab['error'][_0x58ed('0x26')]===0x1f4){logger[_0x58ed('0x25')](_0x58ed('0x21'),_0xa534c8,_0x2ca1ab[_0x58ed('0x25')][_0x58ed('0x27')]);return _0x4980d7(_0x2ca1ab[_0x58ed('0x25')][_0x58ed('0x27')]);}logger[_0x58ed('0x25')](_0x58ed('0x21'),_0xa534c8,_0x2ca1ab['error']['message']);return _0x4a16ef(_0x2ca1ab[_0x58ed('0x25')][_0x58ed('0x27')]);}else{logger[_0x58ed('0x20')](_0x58ed('0x21'),_0xa534c8,'request\x20sent');_0x4a16ef(_0x2ca1ab['result'][_0x58ed('0x27')]);}})['catch'](function(_0x1c5440){logger[_0x58ed('0x25')]('FaxAccount,\x20%s,\x20%s',_0xa534c8,_0x1c5440);_0x4980d7(_0x1c5440);});});}function respondWithStatusCode(_0x2c9047,_0x3716d6){_0x3716d6=_0x3716d6||0xcc;return function(_0x51d7e8){if(_0x51d7e8){return _0x2c9047[_0x58ed('0x28')](_0x3716d6);}return _0x2c9047[_0x58ed('0x29')](_0x3716d6)[_0x58ed('0x2a')]();};}function respondWithResult(_0x4b557a,_0x34abac){_0x34abac=_0x34abac||0xc8;return function(_0xf88cb){if(_0xf88cb){return _0x4b557a[_0x58ed('0x29')](_0x34abac)[_0x58ed('0x2b')](_0xf88cb);}};}function respondWithFilteredResult(_0x371025,_0x467437){return function(_0x86cf92){if(_0x86cf92){var _0x28f725=typeof _0x467437[_0x58ed('0x2c')]==='undefined'&&typeof _0x467437['limit']===_0x58ed('0x2d');var _0x28b922=_0x86cf92[_0x58ed('0x2e')];var _0x2a0639=_0x28f725?0x0:_0x467437[_0x58ed('0x2c')];var _0x3dff91=_0x28f725?_0x86cf92[_0x58ed('0x2e')]:_0x467437[_0x58ed('0x2c')]+_0x467437['limit'];var _0x4dc3d2;if(_0x3dff91>=_0x28b922){_0x3dff91=_0x28b922;_0x4dc3d2=0xc8;}else{_0x4dc3d2=0xce;}_0x371025[_0x58ed('0x29')](_0x4dc3d2);return _0x371025[_0x58ed('0x2f')](_0x58ed('0x30'),_0x2a0639+'-'+_0x3dff91+'/'+_0x28b922)[_0x58ed('0x2b')](_0x86cf92);}return null;};}function patchUpdates(_0x4efd8f){return function(_0xde5ee){try{jsonpatch[_0x58ed('0x31')](_0xde5ee,_0x4efd8f,!![]);}catch(_0x1d8e8f){return BPromise[_0x58ed('0x32')](_0x1d8e8f);}return _0xde5ee['save']();};}function saveUpdates(_0x870b6f,_0x197dec){return function(_0x46ec53){if(_0x46ec53){return _0x46ec53[_0x58ed('0x33')](_0x870b6f)[_0x58ed('0x34')](function(_0x2fd7f7){return _0x2fd7f7;});}return null;};}function removeEntity(_0x20fc6a,_0x2d9c7a){return function(_0x429a4e){if(_0x429a4e){return _0x429a4e[_0x58ed('0x35')]()[_0x58ed('0x34')](function(){var _0x3e1475=_0x429a4e[_0x58ed('0x36')]({'plain':!![]});var _0x2941df='FaxAccounts';return db[_0x58ed('0x37')][_0x58ed('0x35')]({'where':{'type':_0x2941df,'resourceId':_0x3e1475['id']}})[_0x58ed('0x34')](function(){return _0x429a4e;});})[_0x58ed('0x34')](function(){_0x20fc6a[_0x58ed('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37b9be,_0xb87b83){return function(_0x3a784f){if(!_0x3a784f){_0x37b9be['sendStatus'](0x194);}return _0x3a784f;};}function handleError(_0x56f3fc,_0x3d97bb){_0x3d97bb=_0x3d97bb||0x1f4;return function(_0x250380){logger[_0x58ed('0x25')](_0x250380[_0x58ed('0x38')]);if(_0x250380['name']){delete _0x250380['name'];}_0x56f3fc[_0x58ed('0x29')](_0x3d97bb)[_0x58ed('0x39')](_0x250380);};}exports[_0x58ed('0x3a')]=function(_0x2d1d1a,_0x38760a){var _0x19529f={'include':[{'model':db[_0x58ed('0x3b')],'as':'mandatoryDispositionPause'}]},_0x2db1fb={},_0x148bbb={'count':0x0,'rows':[]};var _0xca1af9=_[_0x58ed('0x3c')](db[_0x58ed('0x3d')][_0x58ed('0x3e')],function(_0x43bba9){return{'name':_0x43bba9[_0x58ed('0x3f')],'type':_0x43bba9[_0x58ed('0x40')][_0x58ed('0x41')]};});_0x2db1fb[_0x58ed('0x42')]=_[_0x58ed('0x3c')](_0xca1af9,_0x58ed('0x43'));_0x2db1fb['query']=_['keys'](_0x2d1d1a[_0x58ed('0x44')]);_0x2db1fb[_0x58ed('0x45')]=_[_0x58ed('0x46')](_0x2db1fb[_0x58ed('0x42')],_0x2db1fb[_0x58ed('0x44')]);_0x19529f[_0x58ed('0x47')]=_['intersection'](_0x2db1fb[_0x58ed('0x42')],qs[_0x58ed('0x48')](_0x2d1d1a[_0x58ed('0x44')][_0x58ed('0x48')]));_0x19529f['attributes']=_0x19529f[_0x58ed('0x47')][_0x58ed('0x49')]?_0x19529f[_0x58ed('0x47')]:_0x2db1fb[_0x58ed('0x42')];if(!_0x2d1d1a[_0x58ed('0x44')][_0x58ed('0x4a')](_0x58ed('0x4b'))){_0x19529f[_0x58ed('0x4c')]=qs['limit'](_0x2d1d1a[_0x58ed('0x44')]['limit']);_0x19529f[_0x58ed('0x2c')]=qs[_0x58ed('0x2c')](_0x2d1d1a[_0x58ed('0x44')]['offset']);}_0x19529f[_0x58ed('0x4d')]=qs[_0x58ed('0x4e')](_0x2d1d1a[_0x58ed('0x44')][_0x58ed('0x4e')]);_0x19529f[_0x58ed('0x4f')]=qs['filters'](_[_0x58ed('0x50')](_0x2d1d1a[_0x58ed('0x44')],_0x2db1fb[_0x58ed('0x45')]),_0xca1af9);if(_0x2d1d1a[_0x58ed('0x44')][_0x58ed('0x51')]){_0x19529f[_0x58ed('0x4f')]=_[_0x58ed('0x52')](_0x19529f[_0x58ed('0x4f')],{'$or':_[_0x58ed('0x3c')](_0xca1af9,function(_0x2c9cd){if(_0x2c9cd['type']!==_0x58ed('0x53')){var _0x2f6c10={};_0x2f6c10[_0x2c9cd[_0x58ed('0x43')]]={'$like':'%'+_0x2d1d1a['query'][_0x58ed('0x51')]+'%'};return _0x2f6c10;}})});}_0x19529f=_[_0x58ed('0x52')]({},_0x19529f,_0x2d1d1a[_0x58ed('0x54')]);var _0xadf095={'where':_0x19529f[_0x58ed('0x4f')]};return db[_0x58ed('0x3d')][_0x58ed('0x2e')](_0xadf095)[_0x58ed('0x34')](function(_0x1e52aa){_0x148bbb[_0x58ed('0x2e')]=_0x1e52aa;if(_0x2d1d1a[_0x58ed('0x44')]['includeAll']){_0x19529f[_0x58ed('0x55')]=[{'all':!![]}];}return db['FaxAccount'][_0x58ed('0x56')](_0x19529f);})[_0x58ed('0x34')](function(_0x1a2367){_0x148bbb[_0x58ed('0x57')]=_0x1a2367;return _0x148bbb;})[_0x58ed('0x34')](respondWithFilteredResult(_0x38760a,_0x19529f))['catch'](handleError(_0x38760a,null));};exports[_0x58ed('0x58')]=function(_0x987d6a,_0x1c0021){var _0x3b7031={'raw':![],'where':{'id':_0x987d6a[_0x58ed('0x59')]['id']},'include':[{'model':db[_0x58ed('0x3b')],'as':_0x58ed('0x5a')}]},_0x1c7804={};_0x1c7804[_0x58ed('0x42')]=_[_0x58ed('0x5b')](db[_0x58ed('0x3d')]['rawAttributes']);_0x1c7804['query']=_[_0x58ed('0x5b')](_0x987d6a['query']);_0x1c7804[_0x58ed('0x45')]=_[_0x58ed('0x46')](_0x1c7804[_0x58ed('0x42')],_0x1c7804[_0x58ed('0x44')]);_0x3b7031[_0x58ed('0x47')]=_[_0x58ed('0x46')](_0x1c7804[_0x58ed('0x42')],qs[_0x58ed('0x48')](_0x987d6a[_0x58ed('0x44')][_0x58ed('0x48')]));_0x3b7031[_0x58ed('0x47')]=_0x3b7031['attributes'][_0x58ed('0x49')]?_0x3b7031[_0x58ed('0x47')]:_0x1c7804['model'];if(_0x987d6a[_0x58ed('0x44')][_0x58ed('0x5c')]){_0x3b7031[_0x58ed('0x55')]=[{'all':!![]}];}_0x3b7031=_[_0x58ed('0x52')]({},_0x3b7031,_0x987d6a['options']);return db['FaxAccount']['find'](_0x3b7031)[_0x58ed('0x34')](handleEntityNotFound(_0x1c0021,null))[_0x58ed('0x34')](respondWithResult(_0x1c0021,null))[_0x58ed('0x5d')](handleError(_0x1c0021,null));};exports[_0x58ed('0x5e')]=function(_0x30e16f,_0x5bbb6b){return db[_0x58ed('0x3d')][_0x58ed('0x5e')](_0x30e16f[_0x58ed('0x5f')],{})[_0x58ed('0x34')](function(_0x117cdd){var _0x389e2f=_0x30e16f[_0x58ed('0x60')][_0x58ed('0x36')]({'plain':!![]});if(!_0x389e2f)throw new Error(_0x58ed('0x61'));if(_0x389e2f['role']===_0x58ed('0x60')){var _0x23c677=_0x117cdd['get']({'plain':!![]});var _0xf5003f=_0x58ed('0x62');return db['UserProfileSection'][_0x58ed('0x63')]({'where':{'name':_0xf5003f,'userProfileId':_0x389e2f[_0x58ed('0x64')]},'raw':!![]})[_0x58ed('0x34')](function(_0x497908){if(_0x497908&&_0x497908[_0x58ed('0x65')]===0x0){return db['UserProfileResource'][_0x58ed('0x5e')]({'name':_0x23c677[_0x58ed('0x43')],'resourceId':_0x23c677['id'],'type':_0x497908[_0x58ed('0x43')],'sectionId':_0x497908['id']},{})['then'](function(){return _0x117cdd;});}else{return _0x117cdd;}})[_0x58ed('0x5d')](function(_0x1ede98){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ede98);throw _0x1ede98;});}return _0x117cdd;})['then'](respondWithResult(_0x5bbb6b,0xc9))['catch'](handleError(_0x5bbb6b,null));};exports[_0x58ed('0x33')]=function(_0x300714,_0x4cb368){if(_0x300714[_0x58ed('0x5f')]['id']){delete _0x300714[_0x58ed('0x5f')]['id'];}return db['FaxAccount'][_0x58ed('0x63')]({'where':{'id':_0x300714[_0x58ed('0x59')]['id']},'include':[{'model':db[_0x58ed('0x3b')],'as':_0x58ed('0x5a')}]})[_0x58ed('0x34')](handleEntityNotFound(_0x4cb368,null))[_0x58ed('0x34')](saveUpdates(_0x300714[_0x58ed('0x5f')],null))['then'](respondWithResult(_0x4cb368,null))[_0x58ed('0x5d')](handleError(_0x4cb368,null));};exports[_0x58ed('0x35')]=function(_0x551181,_0x134819){return db[_0x58ed('0x3d')]['find']({'where':{'id':_0x551181[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x134819,null))[_0x58ed('0x34')](removeEntity(_0x134819,null))[_0x58ed('0x5d')](handleError(_0x134819,null));};exports[_0x58ed('0x66')]=function(_0x525b54,_0x533069){return db[_0x58ed('0x3d')][_0x58ed('0x66')]()[_0x58ed('0x34')](respondWithResult(_0x533069,null))[_0x58ed('0x5d')](handleError(_0x533069,null));};exports['addDisposition']=function(_0x24427a,_0x2147e5,_0x251106){if(_0x24427a['body']['id']){delete _0x24427a[_0x58ed('0x5f')]['id'];}return db[_0x58ed('0x3d')]['find']({'where':{'id':_0x24427a['params']['id']}})['then'](handleEntityNotFound(_0x2147e5,null))[_0x58ed('0x34')](function(_0x571073){if(_0x571073){_0x24427a[_0x58ed('0x5f')][_0x58ed('0x67')]=_0x571073['id'];return db[_0x58ed('0x68')][_0x58ed('0x5e')](_0x24427a[_0x58ed('0x5f')]);}})[_0x58ed('0x34')](respondWithResult(_0x2147e5,null))['catch'](handleError(_0x2147e5,null));};exports[_0x58ed('0x69')]=function(_0x5dce6b,_0x2a8360,_0x508869){var _0x59a8a0={'raw':![],'where':{}};var _0xd7ff61={};var _0x5e6a50={'count':0x0,'rows':[]};return db['FaxAccount'][_0x58ed('0x6a')]({'where':{'id':_0x5dce6b[_0x58ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a8360,null))[_0x58ed('0x34')](function(_0x2237f1){if(_0x2237f1){_0xd7ff61[_0x58ed('0x42')]=_[_0x58ed('0x5b')](db[_0x58ed('0x68')][_0x58ed('0x3e')]);_0xd7ff61[_0x58ed('0x44')]=_[_0x58ed('0x5b')](_0x5dce6b['query']);_0xd7ff61['filters']=_['intersection'](_0xd7ff61[_0x58ed('0x42')],_0xd7ff61['query']);_0x59a8a0[_0x58ed('0x47')]=_['intersection'](_0xd7ff61[_0x58ed('0x42')],qs[_0x58ed('0x48')](_0x5dce6b[_0x58ed('0x44')][_0x58ed('0x48')]));_0x59a8a0[_0x58ed('0x47')]=_0x59a8a0['attributes']['length']?_0x59a8a0[_0x58ed('0x47')]:_0xd7ff61[_0x58ed('0x42')];if(!_0x5dce6b[_0x58ed('0x44')][_0x58ed('0x4a')]('nolimit')){_0x59a8a0[_0x58ed('0x4c')]=qs['limit'](_0x5dce6b[_0x58ed('0x44')][_0x58ed('0x4c')]);_0x59a8a0[_0x58ed('0x2c')]=qs[_0x58ed('0x2c')](_0x5dce6b[_0x58ed('0x44')][_0x58ed('0x2c')]);}_0x59a8a0['order']=qs[_0x58ed('0x4e')](_0x5dce6b['query']['sort']);_0x59a8a0['where']=qs[_0x58ed('0x45')](_['pick'](_0x5dce6b[_0x58ed('0x44')],_0xd7ff61[_0x58ed('0x45')]));_0x59a8a0[_0x58ed('0x4f')][_0x58ed('0x67')]=_0x2237f1['id'];if(_0x5dce6b['query'][_0x58ed('0x51')]){_0x59a8a0[_0x58ed('0x4f')]=_[_0x58ed('0x52')](_0x59a8a0['where'],{'$or':_[_0x58ed('0x3c')](_0x59a8a0[_0x58ed('0x47')],function(_0xa24fd5){var _0x1b7b59={};_0x1b7b59[_0xa24fd5]={'$like':'%'+_0x5dce6b[_0x58ed('0x44')]['filter']+'%'};return _0x1b7b59;})});}_0x59a8a0=_[_0x58ed('0x52')]({},_0x59a8a0,_0x5dce6b[_0x58ed('0x54')]);return db[_0x58ed('0x68')][_0x58ed('0x2e')]({'where':_0x59a8a0[_0x58ed('0x4f')]})[_0x58ed('0x34')](function(_0x5a7137){_0x5e6a50[_0x58ed('0x2e')]=_0x5a7137;if(_0x5dce6b[_0x58ed('0x44')]['includeAll']){_0x59a8a0['include']=[{'all':!![]}];}return db['Disposition'][_0x58ed('0x56')](_0x59a8a0);})[_0x58ed('0x34')](function(_0x48925c){_0x5e6a50[_0x58ed('0x57')]=_0x48925c;return _0x5e6a50;});}})[_0x58ed('0x34')](respondWithFilteredResult(_0x2a8360,_0x59a8a0))[_0x58ed('0x5d')](handleError(_0x2a8360,null));};exports[_0x58ed('0x6b')]=function(_0xb043da,_0x297f51,_0x297796){return db['FaxAccount'][_0x58ed('0x63')]({'where':{'id':_0xb043da[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x297f51,null))['then'](function(_0x39ffae){if(_0x39ffae){return _0x39ffae[_0x58ed('0x6b')](_0xb043da['query'][_0x58ed('0x6c')]);}})['then'](respondWithStatusCode(_0x297f51,null))['catch'](handleError(_0x297f51,null));};exports[_0x58ed('0x6d')]=function(_0x398942,_0x53745d,_0x49eae5){if(_0x398942[_0x58ed('0x5f')]['id']){delete _0x398942[_0x58ed('0x5f')]['id'];}return db['FaxAccount'][_0x58ed('0x63')]({'where':{'id':_0x398942[_0x58ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x53745d,null))[_0x58ed('0x34')](function(_0x554e61){if(_0x554e61){_0x398942[_0x58ed('0x5f')][_0x58ed('0x67')]=_0x554e61['id'];return db[_0x58ed('0x6e')][_0x58ed('0x5e')](_0x398942[_0x58ed('0x5f')]);}})[_0x58ed('0x34')](respondWithResult(_0x53745d,null))[_0x58ed('0x5d')](handleError(_0x53745d,null));};exports[_0x58ed('0x6f')]=function(_0x3b3e0c,_0x4c2040,_0x5945bb){var _0x221844={'raw':![],'where':{}};var _0x13dbde={};var _0x4e3471={'count':0x0,'rows':[]};return db[_0x58ed('0x3d')][_0x58ed('0x6a')]({'where':{'id':_0x3b3e0c[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x4c2040,null))['then'](function(_0x299a40){if(_0x299a40){_0x13dbde[_0x58ed('0x42')]=_[_0x58ed('0x5b')](db[_0x58ed('0x6e')][_0x58ed('0x3e')]);_0x13dbde[_0x58ed('0x44')]=_[_0x58ed('0x5b')](_0x3b3e0c[_0x58ed('0x44')]);_0x13dbde[_0x58ed('0x45')]=_[_0x58ed('0x46')](_0x13dbde[_0x58ed('0x42')],_0x13dbde[_0x58ed('0x44')]);_0x221844[_0x58ed('0x47')]=_[_0x58ed('0x46')](_0x13dbde['model'],qs['fields'](_0x3b3e0c[_0x58ed('0x44')][_0x58ed('0x48')]));_0x221844[_0x58ed('0x47')]=_0x221844[_0x58ed('0x47')]['length']?_0x221844[_0x58ed('0x47')]:_0x13dbde[_0x58ed('0x42')];if(!_0x3b3e0c[_0x58ed('0x44')][_0x58ed('0x4a')](_0x58ed('0x4b'))){_0x221844[_0x58ed('0x4c')]=qs[_0x58ed('0x4c')](_0x3b3e0c[_0x58ed('0x44')][_0x58ed('0x4c')]);_0x221844[_0x58ed('0x2c')]=qs[_0x58ed('0x2c')](_0x3b3e0c[_0x58ed('0x44')][_0x58ed('0x2c')]);}_0x221844[_0x58ed('0x4d')]=qs[_0x58ed('0x4e')](_0x3b3e0c[_0x58ed('0x44')]['sort']);_0x221844[_0x58ed('0x4f')]=qs[_0x58ed('0x45')](_[_0x58ed('0x50')](_0x3b3e0c[_0x58ed('0x44')],_0x13dbde[_0x58ed('0x45')]));_0x221844[_0x58ed('0x4f')][_0x58ed('0x67')]=_0x299a40['id'];if(_0x3b3e0c[_0x58ed('0x44')][_0x58ed('0x51')]){_0x221844['where']=_[_0x58ed('0x52')](_0x221844[_0x58ed('0x4f')],{'$or':_[_0x58ed('0x3c')](_0x221844[_0x58ed('0x47')],function(_0x3ca1d5){var _0x4f9aa0={};_0x4f9aa0[_0x3ca1d5]={'$like':'%'+_0x3b3e0c['query'][_0x58ed('0x51')]+'%'};return _0x4f9aa0;})});}_0x221844=_['merge']({},_0x221844,_0x3b3e0c[_0x58ed('0x54')]);return db['CannedAnswer'][_0x58ed('0x2e')]({'where':_0x221844[_0x58ed('0x4f')]})[_0x58ed('0x34')](function(_0x37d177){_0x4e3471[_0x58ed('0x2e')]=_0x37d177;if(_0x3b3e0c[_0x58ed('0x44')][_0x58ed('0x5c')]){_0x221844['include']=[{'all':!![]}];}return db[_0x58ed('0x6e')][_0x58ed('0x56')](_0x221844);})[_0x58ed('0x34')](function(_0xc0d4dd){_0x4e3471[_0x58ed('0x57')]=_0xc0d4dd;return _0x4e3471;});}})[_0x58ed('0x34')](respondWithFilteredResult(_0x4c2040,_0x221844))[_0x58ed('0x5d')](handleError(_0x4c2040,null));};exports[_0x58ed('0x70')]=function(_0x815523,_0x7b8a1b,_0x30ad24){return db[_0x58ed('0x3d')][_0x58ed('0x63')]({'where':{'id':_0x815523['params']['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x7b8a1b,null))[_0x58ed('0x34')](function(_0x3d8799){if(_0x3d8799){return _0x3d8799[_0x58ed('0x70')](_0x815523[_0x58ed('0x44')]['ids']);}})[_0x58ed('0x34')](respondWithStatusCode(_0x7b8a1b,null))[_0x58ed('0x5d')](handleError(_0x7b8a1b,null));};exports[_0x58ed('0x71')]=function(_0x5e71c9,_0x495c0b,_0x4b1542){return db[_0x58ed('0x72')][_0x58ed('0x63')]({'where':{'id':_0x5e71c9[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x495c0b,null))[_0x58ed('0x34')](function(_0x3d4cb7){if(_0x3d4cb7){return _0x3d4cb7[_0x58ed('0x71')](_0x5e71c9['body']['ids'],_['omit'](_0x5e71c9[_0x58ed('0x5f')],[_0x58ed('0x6c'),'id'])||{});}})[_0x58ed('0x34')](respondWithResult(_0x495c0b,null))[_0x58ed('0x5d')](handleError(_0x495c0b,null));};exports[_0x58ed('0x73')]=function(_0xaf99d4,_0x23f3b8,_0x164372){var _0xaa97a7={'raw':![],'where':{}};var _0x1a4c6a={};var _0x3b65eb={'count':0x0,'rows':[]};return db[_0x58ed('0x3d')]['findOne']({'where':{'id':_0xaf99d4[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x23f3b8,null))['then'](function(_0x1e599f){if(_0x1e599f){_0x1a4c6a[_0x58ed('0x42')]=_[_0x58ed('0x5b')](db[_0x58ed('0x72')]['rawAttributes']);_0x1a4c6a[_0x58ed('0x44')]=_[_0x58ed('0x5b')](_0xaf99d4[_0x58ed('0x44')]);_0x1a4c6a['filters']=_[_0x58ed('0x46')](_0x1a4c6a[_0x58ed('0x42')],_0x1a4c6a[_0x58ed('0x44')]);_0xaa97a7['attributes']=_[_0x58ed('0x46')](_0x1a4c6a[_0x58ed('0x42')],qs[_0x58ed('0x48')](_0xaf99d4['query'][_0x58ed('0x48')]));_0xaa97a7[_0x58ed('0x47')]=_0xaa97a7[_0x58ed('0x47')][_0x58ed('0x49')]?_0xaa97a7[_0x58ed('0x47')]:_0x1a4c6a[_0x58ed('0x42')];if(!_0xaf99d4[_0x58ed('0x44')][_0x58ed('0x4a')](_0x58ed('0x4b'))){_0xaa97a7[_0x58ed('0x4c')]=qs[_0x58ed('0x4c')](_0xaf99d4[_0x58ed('0x44')]['limit']);_0xaa97a7['offset']=qs['offset'](_0xaf99d4[_0x58ed('0x44')][_0x58ed('0x2c')]);}_0xaa97a7['order']=qs['sort'](_0xaf99d4[_0x58ed('0x44')][_0x58ed('0x4e')]);_0xaa97a7[_0x58ed('0x4f')]=qs[_0x58ed('0x45')](_['pick'](_0xaf99d4[_0x58ed('0x44')],_0x1a4c6a[_0x58ed('0x45')]));_0xaa97a7['where']['FaxAccountId']=_0x1e599f['id'];if(_0xaf99d4[_0x58ed('0x44')][_0x58ed('0x51')]){_0xaa97a7[_0x58ed('0x4f')]=_['merge'](_0xaa97a7[_0x58ed('0x4f')],{'$or':_[_0x58ed('0x3c')](_0xaa97a7['attributes'],function(_0x34fb8a){var _0x526a2c={};_0x526a2c[_0x34fb8a]={'$like':'%'+_0xaf99d4[_0x58ed('0x44')][_0x58ed('0x51')]+'%'};return _0x526a2c;})});}_0xaa97a7=_[_0x58ed('0x52')]({},_0xaa97a7,_0xaf99d4[_0x58ed('0x54')]);return db[_0x58ed('0x72')]['count']({'where':_0xaa97a7[_0x58ed('0x4f')]})[_0x58ed('0x34')](function(_0x4bfb1c){_0x3b65eb[_0x58ed('0x2e')]=_0x4bfb1c;if(_0xaf99d4[_0x58ed('0x44')][_0x58ed('0x5c')]){_0xaa97a7[_0x58ed('0x55')]=[{'model':db[_0x58ed('0x74')],'as':_0x58ed('0x75'),'required':![]},{'model':db[_0x58ed('0x76')],'as':_0x58ed('0x77'),'attributes':[_0x58ed('0x43'),_0x58ed('0x78'),_0x58ed('0x79')],'required':![]},{'model':db[_0x58ed('0x7a')],'as':_0x58ed('0x7b'),'attributes':['id','name','color'],'where':_0xaf99d4['query']['tag']?{'id':_0xaf99d4[_0x58ed('0x44')][_0x58ed('0x7c')]}:undefined,'required':_0xaf99d4['query'][_0x58ed('0x7c')]?!![]:![]}];}return db[_0x58ed('0x72')][_0x58ed('0x56')](_0xaa97a7);})[_0x58ed('0x34')](function(_0x3d177e){_0x3b65eb[_0x58ed('0x57')]=_0x3d177e;return _0x3b65eb;});}})[_0x58ed('0x34')](respondWithFilteredResult(_0x23f3b8,_0xaa97a7))[_0x58ed('0x5d')](handleError(_0x23f3b8,null));};exports[_0x58ed('0x7d')]=function(_0x26dda8,_0x432c21,_0x822440){return db[_0x58ed('0x3d')][_0x58ed('0x6a')]({'where':{'id':_0x26dda8[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x432c21,null))[_0x58ed('0x34')](function(_0xbb9bae){if(_0xbb9bae){return db[_0x58ed('0x7e')][_0x58ed('0x7f')](function(_0x21e63b){return db[_0x58ed('0x80')][_0x58ed('0x35')]({'where':{'FaxAccountId':_0x26dda8[_0x58ed('0x59')]['id']},'transaction':_0x21e63b})[_0x58ed('0x34')](function(_0x35e87b){var _0x4c286b=_['map'](_0x26dda8[_0x58ed('0x5f')],function(_0x10c2e1){_0x10c2e1[_0x58ed('0x67')]=_0x26dda8['params']['id'];return _0x10c2e1;});return db['FaxApplication']['bulkCreate'](_0x4c286b,{'transaction':_0x21e63b});});})[_0x58ed('0x34')](function(){return db[_0x58ed('0x80')][_0x58ed('0x81')]({'where':{'FaxAccountId':_0x26dda8[_0x58ed('0x59')]['id']},'order':_0x58ed('0x82')});});}})[_0x58ed('0x34')](respondWithResult(_0x432c21,null))['catch'](handleError(_0x432c21,null));};exports[_0x58ed('0x83')]=function(_0x5ed994,_0x1c6b43,_0x40df82){var _0x5b6af9={};var _0x22efb5={};var _0x5821d3;var _0x16eb8c;return db[_0x58ed('0x3d')][_0x58ed('0x6a')]({'where':{'id':_0x5ed994[_0x58ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x1c6b43,null))[_0x58ed('0x34')](function(_0x157700){if(_0x157700){_0x5821d3=_0x157700;_0x22efb5[_0x58ed('0x42')]=_[_0x58ed('0x5b')](db['FaxApplication'][_0x58ed('0x3e')]);_0x22efb5['query']=_[_0x58ed('0x5b')](_0x5ed994[_0x58ed('0x44')]);_0x22efb5['filters']=_[_0x58ed('0x46')](_0x22efb5[_0x58ed('0x42')],_0x22efb5[_0x58ed('0x44')]);_0x5b6af9[_0x58ed('0x47')]=_[_0x58ed('0x46')](_0x22efb5['model'],qs[_0x58ed('0x48')](_0x5ed994['query'][_0x58ed('0x48')]));_0x5b6af9[_0x58ed('0x47')]=_0x5b6af9[_0x58ed('0x47')]['length']?_0x5b6af9[_0x58ed('0x47')]:_0x22efb5['model'];_0x5b6af9['order']=qs[_0x58ed('0x4e')](_0x5ed994['query'][_0x58ed('0x4e')]);_0x5b6af9[_0x58ed('0x4f')]=qs[_0x58ed('0x45')](_[_0x58ed('0x50')](_0x5ed994[_0x58ed('0x44')],_0x22efb5[_0x58ed('0x45')]));if(_0x5ed994[_0x58ed('0x44')][_0x58ed('0x51')]){_0x5b6af9['where']=_[_0x58ed('0x52')](_0x5b6af9[_0x58ed('0x4f')],{'$or':_[_0x58ed('0x3c')](_0x5b6af9[_0x58ed('0x47')],function(_0x3fc7bb){var _0x4cb8a6={};_0x4cb8a6[_0x3fc7bb]={'$like':'%'+_0x5ed994[_0x58ed('0x44')]['filter']+'%'};return _0x4cb8a6;})});}_0x5b6af9=_[_0x58ed('0x52')]({},_0x5b6af9,_0x5ed994[_0x58ed('0x54')]);return _0x5821d3[_0x58ed('0x83')](_0x5b6af9);}})[_0x58ed('0x34')](function(_0x31f051){if(_0x31f051){_0x16eb8c=_0x31f051[_0x58ed('0x49')];if(!_0x5ed994[_0x58ed('0x44')][_0x58ed('0x4a')](_0x58ed('0x4b'))){_0x5b6af9[_0x58ed('0x4c')]=qs[_0x58ed('0x4c')](_0x5ed994[_0x58ed('0x44')]['limit']);_0x5b6af9[_0x58ed('0x2c')]=qs[_0x58ed('0x2c')](_0x5ed994[_0x58ed('0x44')][_0x58ed('0x2c')]);}return _0x5821d3[_0x58ed('0x83')](_0x5b6af9);}})[_0x58ed('0x34')](function(_0x392717){if(_0x392717){return _0x392717?{'count':_0x16eb8c,'rows':_0x392717}:null;}})[_0x58ed('0x34')](respondWithResult(_0x1c6b43,null))['catch'](handleError(_0x1c6b43,null));};function Extension(_0x4ddc7e,_0x1f3072,_0x21011f,_0x3d23ba){this['context']=_0x58ed('0x84');this[_0x58ed('0x85')]=_0x4ddc7e[_0x58ed('0x86')];this[_0x58ed('0x87')]=_0x3d23ba;this[_0x58ed('0x40')]=_0x58ed('0x88');this[_0x58ed('0x89')]=_0x58ed('0x8a');this[_0x58ed('0x67')]=_0x4ddc7e['id'];this[_0x58ed('0x82')]=_0x1f3072;this[_0x58ed('0x8b')]=_0x21011f;}function createExtensionsReciveFax(_0x4c26fe){var _0x57f526=0x1;var _0x1695fe=[];_0x1695fe[_0x58ed('0x8c')](new Extension(_0x4c26fe,_0x57f526,'',_0x58ed('0x8d')));_0x57f526+=0x1;_0x1695fe[_0x58ed('0x8c')](new Extension(_0x4c26fe,_0x57f526,_0x58ed('0x8e'),_0x58ed('0x8f')));_0x57f526+=0x1;for(var _0x2d2925 in _0x4c26fe){if(_0x4c26fe[_0x58ed('0x4a')](_0x2d2925)&&(_0x2d2925===_0x58ed('0x90')||_0x2d2925===_0x58ed('0x86')||_0x2d2925===_0x58ed('0x91')||_0x2d2925==='faxdetect'||_0x2d2925===_0x58ed('0x92')||_0x2d2925===_0x58ed('0x93')||_0x2d2925===_0x58ed('0x94')||_0x2d2925===_0x58ed('0x95')||_0x2d2925===_0x58ed('0x96'))){_0x1695fe[_0x58ed('0x8c')](new Extension(_0x4c26fe,_0x57f526,_0x58ed('0x97')+_0x2d2925+')='+_0x4c26fe[_0x2d2925],_0x58ed('0x8f')));_0x57f526+=0x1;}}_0x1695fe[_0x58ed('0x8c')](new Extension(_0x4c26fe,_0x57f526,'6',_0x58ed('0x98')));_0x57f526+=0x1;_0x1695fe[_0x58ed('0x8c')](new Extension(_0x4c26fe,_0x57f526,_0x58ed('0x99'),'ReceiveFax'));_0x57f526=0x0;return _0x1695fe;}exports[_0x58ed('0x9a')]=function(_0x2e30bf,_0xcf1572,_0xcb5509){var _0x3cceb2;return db['sequelize'][_0x58ed('0x7f')](function(_0x14b16e){return db[_0x58ed('0x3d')][_0x58ed('0x5e')](_0x2e30bf[_0x58ed('0x5f')],{'transaction':_0x14b16e})[_0x58ed('0x34')](function(_0x244b6f){_0x3cceb2=_0x244b6f[_0x58ed('0x36')]({'plain':!![]});return db['VoiceExtension'][_0x58ed('0x9b')](createExtensionsReciveFax(_0x3cceb2),{'transaction':_0x14b16e});});})[_0x58ed('0x34')](function(){return _0x3cceb2;})['then'](respondWithResult(_0xcf1572,null))[_0x58ed('0x5d')](handleError(_0xcf1572,null));};exports[_0x58ed('0x9c')]=function(_0x13a7d7,_0x4c2463,_0xdaa731){var _0x2804ee;return db[_0x58ed('0x7e')][_0x58ed('0x7f')](function(_0x3e8fb9){return db[_0x58ed('0x3d')][_0x58ed('0x33')](_0x13a7d7[_0x58ed('0x5f')],{'where':{'id':_0x13a7d7['body']['id']},'transaction':_0x3e8fb9})[_0x58ed('0x34')](function(_0x1d6aaa){return db[_0x58ed('0x9d')]['destroy']({'where':{'FaxAccountId':_0x13a7d7[_0x58ed('0x5f')]['id']},'transaction':_0x3e8fb9})[_0x58ed('0x34')](function(_0x4de782){return db[_0x58ed('0x9d')][_0x58ed('0x9b')](createExtensionsReciveFax(_['omit'](_0x13a7d7[_0x58ed('0x5f')],['tech','key','createdAt',_0x58ed('0x9e'),_0x58ed('0x9f'),_0x58ed('0xa0')])),{'transaction':_0x3e8fb9});});});})[_0x58ed('0x34')](function(){return db[_0x58ed('0x3d')]['findById'](_0x13a7d7[_0x58ed('0x5f')]['id']);})[_0x58ed('0x34')](respondWithResult(_0x4c2463,null))[_0x58ed('0x5d')](handleError(_0x4c2463,null));};exports[_0x58ed('0xa1')]=function(_0xd65554,_0x13214e,_0x56f984){var _0x2f22c9={'raw':!![],'where':{}};var _0x1ff6d0={};var _0x33c032={'count':0x0,'rows':[]};return db['FaxAccount'][_0x58ed('0x6a')]({'where':{'id':_0xd65554[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x13214e,null))[_0x58ed('0x34')](function(_0x285474){if(_0x285474){_0x1ff6d0[_0x58ed('0x42')]=_[_0x58ed('0x5b')](db['FaxMessage'][_0x58ed('0x3e')]);_0x1ff6d0[_0x58ed('0x44')]=_[_0x58ed('0x5b')](_0xd65554[_0x58ed('0x44')]);_0x1ff6d0[_0x58ed('0x45')]=_[_0x58ed('0x46')](_0x1ff6d0[_0x58ed('0x42')],_0x1ff6d0[_0x58ed('0x44')]);_0x2f22c9[_0x58ed('0x47')]=_['intersection'](_0x1ff6d0[_0x58ed('0x42')],qs['fields'](_0xd65554['query'][_0x58ed('0x48')]));_0x2f22c9[_0x58ed('0x47')]=_0x2f22c9[_0x58ed('0x47')][_0x58ed('0x49')]?_0x2f22c9[_0x58ed('0x47')]:_0x1ff6d0[_0x58ed('0x42')];if(!_0xd65554[_0x58ed('0x44')]['hasOwnProperty'](_0x58ed('0x4b'))){_0x2f22c9[_0x58ed('0x4c')]=qs[_0x58ed('0x4c')](_0xd65554[_0x58ed('0x44')][_0x58ed('0x4c')]);_0x2f22c9['offset']=qs[_0x58ed('0x2c')](_0xd65554['query'][_0x58ed('0x2c')]);}_0x2f22c9[_0x58ed('0x4d')]=qs[_0x58ed('0x4e')](_0xd65554['query']['sort']);_0x2f22c9[_0x58ed('0x4f')]=qs[_0x58ed('0x45')](_['pick'](_0xd65554[_0x58ed('0x44')],_0x1ff6d0[_0x58ed('0x45')]));_0x2f22c9[_0x58ed('0x4f')][_0x58ed('0x67')]=_0x285474['id'];if(_0xd65554[_0x58ed('0x44')][_0x58ed('0x51')]){_0x2f22c9['where']=_[_0x58ed('0x52')](_0x2f22c9[_0x58ed('0x4f')],{'$or':_[_0x58ed('0x3c')](_0x2f22c9['attributes'],function(_0x577412){var _0x2b42b5={};_0x2b42b5[_0x577412]={'$like':'%'+_0xd65554[_0x58ed('0x44')]['filter']+'%'};return _0x2b42b5;})});}if(_0xd65554[_0x58ed('0x44')][_0x58ed('0xa2')]){var _0x1381c2=_0xd65554[_0x58ed('0x44')][_0x58ed('0xa2')][_0x58ed('0xa3')](',');var _0x5da498={};_0x5da498[_0x1381c2[0x0]]={'$gte':moment(_0x1381c2[0x1])[_0x58ed('0xa4')](_0x58ed('0xa5'))};_0x2f22c9[_0x58ed('0x4f')]=_[_0x58ed('0x52')](_0x2f22c9[_0x58ed('0x4f')],_0x5da498);}_0x2f22c9=_[_0x58ed('0x52')]({},_0x2f22c9,_0xd65554[_0x58ed('0x54')]);return db[_0x58ed('0xa6')][_0x58ed('0x2e')]({'where':_0x2f22c9['where']})[_0x58ed('0x34')](function(_0x485a79){_0x33c032['count']=_0x485a79;if(_0xd65554[_0x58ed('0x44')][_0x58ed('0x5c')]){_0x2f22c9[_0x58ed('0x55')]=[{'all':!![]}];}return db[_0x58ed('0xa6')][_0x58ed('0x56')](_0x2f22c9);})[_0x58ed('0x34')](function(_0x435ed7){_0x33c032[_0x58ed('0x57')]=_0x435ed7;return _0x33c032;});}})[_0x58ed('0x34')](respondWithFilteredResult(_0x13214e,_0x2f22c9))[_0x58ed('0x5d')](handleError(_0x13214e,null));};exports[_0x58ed('0x39')]=function(_0x5ca482,_0x412ee0,_0x3a0ce8){var _0x49bf49,_0x1a368c={},_0x7cbb2d;if(_0x5ca482[_0x58ed('0x5f')]['to']){_0x7cbb2d=_0x5ca482[_0x58ed('0x5f')]['to'][0x0];}return db['FaxAccount'][_0x58ed('0x63')]({'where':{'id':_0x5ca482['params']['id']},'include':[{'model':db[_0x58ed('0xa7')],'as':_0x58ed('0xa8'),'include':[{'model':db['CmContact'],'as':_0x58ed('0xa9'),'where':{'fax':_0x7cbb2d},'limit':0x1,'order':[[_0x58ed('0x9e'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x412ee0,null))[_0x58ed('0x34')](function(_0x508630){_0x49bf49=_0x508630;if(_0x5ca482['body'][_0x58ed('0xaa')]&&_0x5ca482[_0x58ed('0x5f')][_0x58ed('0xaa')][_0x58ed('0x49')]){for(var _0x586ebb=0x0;_0x586ebb<_0x5ca482[_0x58ed('0x5f')]['attachments'][_0x58ed('0x49')];_0x586ebb+=0x1){_0x5ca482['body'][_0x58ed('0xaa')][_0x586ebb]={'filename':_0x5ca482[_0x58ed('0x5f')]['attachments'][_0x586ebb][_0x58ed('0x43')],'id':_0x5ca482[_0x58ed('0x5f')]['attachments'][_0x586ebb]['id'],'path':path[_0x58ed('0xab')](config[_0x58ed('0xac')],_0x58ed('0xad'),_0x5ca482[_0x58ed('0x5f')][_0x58ed('0xaa')][_0x586ebb][_0x58ed('0xae')])};}}return respondWithRpcPromise(_0x58ed('0xaf'),_0x58ed('0xaf'),{'FaxAccountId':_[_0x58ed('0xb0')](_0x5ca482[_0x58ed('0x59')]['id'])?undefined:_0x5ca482['params']['id'],'path':_['isNil'](_0x5ca482[_0x58ed('0x5f')][_0x58ed('0xaa')][0x0][_0x58ed('0x6')])?undefined:_0x5ca482['body'][_0x58ed('0xaa')][0x0]['path'],'fax':_['isNil'](_0x5ca482[_0x58ed('0x5f')]['to'][0x0])?undefined:_0x5ca482[_0x58ed('0x5f')]['to'][0x0]},client9002);})[_0x58ed('0x34')](function(){if(_0x49bf49){if(_['isNil'](_0x5ca482[_0x58ed('0x5f')][_0x58ed('0xb1')])){_0x5ca482['body']['from']=util[_0x58ed('0xa4')]('\x22%s\x22\x20<%s>',_0x49bf49['name'],_0x49bf49['fax']);}if(_0x49bf49['List']){if(_0x49bf49[_0x58ed('0xa8')]['Contacts'][_0x58ed('0x49')]){return _0x49bf49['List'][_0x58ed('0xa9')][0x0];}else{return db[_0x58ed('0x74')][_0x58ed('0x5e')](_[_0x58ed('0x19')](_0x5ca482[_0x58ed('0x5f')],{'firstName':_0x5ca482[_0x58ed('0x5f')]['to'][0x0],'phone':_0x5ca482[_0x58ed('0x5f')]['to'][0x0],'fax':_0x5ca482[_0x58ed('0x5f')]['to'][0x0],'ListId':_0x49bf49[_0x58ed('0xa0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x58ed('0xb2'));}})[_0x58ed('0x34')](function(_0x153bb5){if(_0x153bb5){return db[_0x58ed('0x72')]['find']({'where':{'ContactId':_0x153bb5['id'],'closed':![],'FaxAccountId':_0x49bf49['id']}})[_0x58ed('0x34')](function(_0xefa7fd){if(_0xefa7fd){return[_0xefa7fd,![]];}return db[_0x58ed('0x72')][_0x58ed('0x5e')]({'UserId':_0x5ca482[_0x58ed('0x60')]['id'],'ContactId':_0x153bb5['id'],'FaxAccountId':_0x49bf49['id'],'fax':_0x5ca482[_0x58ed('0x5f')]['to'][0x0],'firstMsgDirection':_0x58ed('0xb3'),'Messages':[_[_0x58ed('0x52')](_0x5ca482[_0x58ed('0x5f')],{'read':![],'body':_0x5ca482['body'][_0x58ed('0xaa')][0x0][_0x58ed('0xb4')],'FaxAccountId':_0x49bf49['id'],'UserId':_0x5ca482[_0x58ed('0x60')]['id'],'ContactId':_0x153bb5['id'],'AttachmentId':_0x5ca482[_0x58ed('0x5f')][_0x58ed('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x43db47){return[_0x43db47,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x58ed('0xb5')](function(_0x402817,_0x944b45){if(_0x944b45){return _0x402817;}return db[_0x58ed('0xa6')][_0x58ed('0x5e')]({'direction':_0x58ed('0xb3'),'read':![],'body':_0x5ca482[_0x58ed('0x5f')][_0x58ed('0xaa')][0x0][_0x58ed('0xb4')],'FaxAccountId':_0x49bf49['id'],'FaxInteractionId':_0x402817['id'],'UserId':_0x5ca482['user']['id'],'ContactId':_0x402817[_0x58ed('0xb6')],'AttachmentId':_0x5ca482[_0x58ed('0x5f')]['attachments'][0x0]['id']})[_0x58ed('0x34')](function(_0x3b211b){_0x402817[_0x58ed('0xb7')]['Messages']=[];_0x402817['dataValues'][_0x58ed('0xb8')][_0x58ed('0x8c')](_0x3b211b[_0x58ed('0xb7')]);return _0x402817;});})[_0x58ed('0x34')](function(_0x17d43d){respondWithRpcPromise(_0x58ed('0xb9'),_0x58ed('0xb9'),{'FaxAccountId':_[_0x58ed('0xb0')](_0x5ca482[_0x58ed('0x59')]['id'])?undefined:_0x5ca482[_0x58ed('0x59')]['id'],'path':_[_0x58ed('0xb0')](_0x5ca482[_0x58ed('0x5f')][_0x58ed('0xaa')][0x0]['path'])?undefined:_0x5ca482[_0x58ed('0x5f')]['attachments'][0x0][_0x58ed('0x6')],'fax':_[_0x58ed('0xb0')](_0x5ca482[_0x58ed('0x5f')]['to'][0x0])?undefined:_0x5ca482['body']['to'][0x0],'AttachmentId':_0x5ca482[_0x58ed('0x5f')]['attachments'][0x0]['id']},client9002)['then'](function(_0xbc07ee){logger[_0x58ed('0x20')]('SendFaxRpc,\x20%s',_0xbc07ee);})['catch'](function(_0xb0a580){logger[_0x58ed('0x20')]('SendFaxRpc,\x20%s',_0xb0a580);});return _0x17d43d;})[_0x58ed('0x34')](respondWithResult(_0x412ee0,null))[_0x58ed('0x5d')](handleError(_0x412ee0,null));};exports['addAgents']=function(_0x2708f6,_0xab0127,_0x28def7){return db[_0x58ed('0x3d')]['find']({'where':{'id':_0x2708f6[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0xab0127,null))['then'](function(_0x4868f9){if(_0x4868f9){return _0x4868f9['addAgents'](_0x2708f6[_0x58ed('0x5f')][_0x58ed('0x6c')],_[_0x58ed('0xba')](_0x2708f6['body'],[_0x58ed('0x6c'),'id'])||{})[_0x58ed('0xb5')](function(_0x303446){for(var _0x1b5068=0x0;_0x1b5068<_0x2708f6[_0x58ed('0x5f')][_0x58ed('0x6c')][_0x58ed('0x49')];_0x1b5068+=0x1){socket[_0x58ed('0xbb')](_0x58ed('0xbc'),{'UserId':Number(_0x2708f6[_0x58ed('0x5f')][_0x58ed('0x6c')][_0x1b5068]),'FaxAccountId':Number(_0x2708f6[_0x58ed('0x59')]['id'])});}return _0x303446;});}})[_0x58ed('0x34')](respondWithResult(_0xab0127,null))[_0x58ed('0x5d')](handleError(_0xab0127,null));};exports[_0x58ed('0xbd')]=function(_0xea410c,_0x5ea809,_0x218884){return db[_0x58ed('0x3d')][_0x58ed('0x63')]({'where':{'id':_0xea410c['params']['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x5ea809,null))[_0x58ed('0x34')](function(_0x4e6606){if(_0x4e6606){return _0x4e6606[_0x58ed('0xbd')](_0xea410c[_0x58ed('0x44')]['ids'])['then'](function(){if(_[_0x58ed('0xbe')](_0xea410c[_0x58ed('0x44')]['ids'])){for(var _0x176d57=0x0;_0x176d57<_0xea410c[_0x58ed('0x44')][_0x58ed('0x6c')]['length'];_0x176d57+=0x1){socket[_0x58ed('0xbb')](_0x58ed('0xbf'),{'UserId':Number(_0xea410c['query'][_0x58ed('0x6c')][_0x176d57]),'FaxAccountId':Number(_0xea410c[_0x58ed('0x59')]['id'])});}}else{socket[_0x58ed('0xbb')](_0x58ed('0xbf'),{'UserId':Number(_0xea410c[_0x58ed('0x44')][_0x58ed('0x6c')]),'FaxAccountId':Number(_0xea410c[_0x58ed('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x5ea809,null))[_0x58ed('0x5d')](handleError(_0x5ea809,null));};exports[_0x58ed('0xc0')]=function(_0x1d5cfa,_0x10b1c0,_0x32b9b7){var _0xcd9b1d={};var _0x1680fd={};var _0x229130;var _0x39bc74;return db['FaxAccount'][_0x58ed('0x6a')]({'where':{'id':_0x1d5cfa[_0x58ed('0x59')]['id']}})[_0x58ed('0x34')](handleEntityNotFound(_0x10b1c0,null))['then'](function(_0x49101a){if(_0x49101a){_0x229130=_0x49101a;_0x1680fd[_0x58ed('0x42')]=_[_0x58ed('0x5b')](db[_0x58ed('0x76')][_0x58ed('0x3e')]);_0x1680fd[_0x58ed('0x44')]=_['keys'](_0x1d5cfa[_0x58ed('0x44')]);_0x1680fd['filters']=_[_0x58ed('0x46')](_0x1680fd['model'],_0x1680fd[_0x58ed('0x44')]);_0xcd9b1d[_0x58ed('0x47')]=_[_0x58ed('0x46')](_0x1680fd[_0x58ed('0x42')],qs[_0x58ed('0x48')](_0x1d5cfa[_0x58ed('0x44')][_0x58ed('0x48')]));_0xcd9b1d[_0x58ed('0x47')]=_0xcd9b1d[_0x58ed('0x47')][_0x58ed('0x49')]?_0xcd9b1d[_0x58ed('0x47')]:_0x1680fd[_0x58ed('0x42')];_0xcd9b1d[_0x58ed('0x4d')]=qs[_0x58ed('0x4e')](_0x1d5cfa[_0x58ed('0x44')][_0x58ed('0x4e')]);_0xcd9b1d[_0x58ed('0x4f')]=qs[_0x58ed('0x45')](_[_0x58ed('0x50')](_0x1d5cfa['query'],_0x1680fd['filters']));if(_0x1d5cfa['query'][_0x58ed('0x51')]){_0xcd9b1d[_0x58ed('0x4f')]=_['merge'](_0xcd9b1d['where'],{'$or':_[_0x58ed('0x3c')](_0xcd9b1d[_0x58ed('0x47')],function(_0x4fe651){var _0x59a03a={};_0x59a03a[_0x4fe651]={'$like':'%'+_0x1d5cfa[_0x58ed('0x44')]['filter']+'%'};return _0x59a03a;})});}_0xcd9b1d=_[_0x58ed('0x52')]({},_0xcd9b1d,_0x1d5cfa['options']);return _0x229130[_0x58ed('0xc0')](_0xcd9b1d);}})[_0x58ed('0x34')](function(_0x235880){if(_0x235880){_0x39bc74=_0x235880['length'];if(!_0x1d5cfa[_0x58ed('0x44')][_0x58ed('0x4a')]('nolimit')){_0xcd9b1d[_0x58ed('0x4c')]=qs[_0x58ed('0x4c')](_0x1d5cfa[_0x58ed('0x44')][_0x58ed('0x4c')]);_0xcd9b1d[_0x58ed('0x2c')]=qs[_0x58ed('0x2c')](_0x1d5cfa['query'][_0x58ed('0x2c')]);}return _0x229130[_0x58ed('0xc0')](_0xcd9b1d);}})[_0x58ed('0x34')](function(_0x524861){if(_0x524861){return _0x524861?{'count':_0x39bc74,'rows':_0x524861}:null;}})['then'](respondWithResult(_0x10b1c0,null))[_0x58ed('0x5d')](handleError(_0x10b1c0,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6332252..930cf29 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 _0x5b17=['update','remove','emit','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x438994,_0x45f7f5){var _0x4d6d84=function(_0x1a3196){while(--_0x1a3196){_0x438994['push'](_0x438994['shift']());}};_0x4d6d84(++_0x45f7f5);}(_0x5b17,0x94));var _0x75b1=function(_0x1bd40d,_0x4b8cd6){_0x1bd40d=_0x1bd40d-0x0;var _0x21676c=_0x5b17[_0x1bd40d];return _0x21676c;};'use strict';var EventEmitter=require(_0x75b1('0x0'));var FaxAccount=require(_0x75b1('0x1'))['db'][_0x75b1('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x75b1('0x3')](0x0);var events={'afterCreate':_0x75b1('0x4'),'afterUpdate':_0x75b1('0x5'),'afterDestroy':_0x75b1('0x6')};function emitEvent(_0x1439da){return function(_0xe4ed7a,_0x1a7c87,_0x3e2d61){FaxAccountEvents[_0x75b1('0x7')](_0x1439da+':'+_0xe4ed7a['id'],_0xe4ed7a);FaxAccountEvents['emit'](_0x1439da,_0xe4ed7a);_0x3e2d61(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x75b1('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x7cfa=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x91c2d1,_0x580af9){var _0x374617=function(_0x4613e5){while(--_0x4613e5){_0x91c2d1['push'](_0x91c2d1['shift']());}};_0x374617(++_0x580af9);}(_0x7cfa,0x137));var _0xa7cf=function(_0x636a1,_0xf5715){_0x636a1=_0x636a1-0x0;var _0x2b7e4c=_0x7cfa[_0x636a1];return _0x2b7e4c;};'use strict';var EventEmitter=require(_0xa7cf('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa7cf('0x1')](0x0);var events={'afterCreate':_0xa7cf('0x2'),'afterUpdate':_0xa7cf('0x3'),'afterDestroy':_0xa7cf('0x4')};function emitEvent(_0x541b45){return function(_0x319aed,_0x5c135c,_0xce9fa4){FaxAccountEvents[_0xa7cf('0x5')](_0x541b45+':'+_0x319aed['id'],_0x319aed);FaxAccountEvents[_0xa7cf('0x5')](_0x541b45,_0x319aed);_0xce9fa4(null);};}for(var e in events){if(events[_0xa7cf('0x6')](e)){var event=events[e];FaxAccount[_0xa7cf('0x7')](e,emitEvent(event));}}module[_0xa7cf('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 968085b..f70535f 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 _0xb00d=['../../config/environment','FaxAccount','fax_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb00d,0x1d9));var _0xdb00=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xb00d[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0xdb00('0x0'));var util=require('util');var logger=require(_0xdb00('0x1'))(_0xdb00('0x2'));var moment=require('moment');var BPromise=require(_0xdb00('0x3'));var rp=require(_0xdb00('0x4'));var fs=require('fs');var path=require(_0xdb00('0x5'));var rimraf=require(_0xdb00('0x6'));var config=require(_0xdb00('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x45a091,_0x3eff70){return _0x45a091['define'](_0xdb00('0x8'),attributes,{'tableName':_0xdb00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84a1=['path','../../config/environment','./faxAccount.attributes','define','fax_accounts','util','../../config/logger','bluebird','request-promise'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x84a1,0xb0));var _0x184a=function(_0x34f9cf,_0x5db8c7){_0x34f9cf=_0x34f9cf-0x0;var _0x5aa8c5=_0x84a1[_0x34f9cf];return _0x5aa8c5;};'use strict';var _=require('lodash');var util=require(_0x184a('0x0'));var logger=require(_0x184a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x184a('0x2'));var rp=require(_0x184a('0x3'));var fs=require('fs');var path=require(_0x184a('0x4'));var rimraf=require('rimraf');var config=require(_0x184a('0x5'));var attributes=require(_0x184a('0x6'));module['exports']=function(_0x1ffa4d,_0x589b31){return _0x1ffa4d[_0x184a('0x7')]('FaxAccount',attributes,{'tableName':_0x184a('0x8'),'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 d5a4bdb..7bd957e 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 _0xd410=['User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','NotifyFaxAccount','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','body','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','updatedAt','FaxApplication','Applications','get','account','list','applications','orderBy','length','defaults','contact','fax','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0xd410,0x16f));var _0x0d41=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xd410[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0d41('0x0'));var util=require(_0x0d41('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d41('0x2'));var fs=require('fs');var Redis=require(_0x0d41('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d41('0x4'));var logger=require(_0x0d41('0x5'))(_0x0d41('0x6'));var config=require(_0x0d41('0x7'));var jayson=require(_0x0d41('0x8'));var client=jayson[_0x0d41('0x9')][_0x0d41('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0x0d41('0xb')],{'host':_0x0d41('0xc'),'port':0x18eb});var socket=require(_0x0d41('0xd'))(new Redis(config[_0x0d41('0xb')]));require(_0x0d41('0xe'))[_0x0d41('0xf')](socket);function respondWithRpcPromise(_0x530118,_0x44c3a1,_0x107d72){return new BPromise(function(_0x20f0c8,_0x44aebc){return client[_0x0d41('0x10')](_0x530118,_0x107d72)['then'](function(_0x379314){logger['info'](_0x0d41('0x11'),_0x44c3a1,'request\x20sent');logger[_0x0d41('0x12')](_0x0d41('0x13'),_0x44c3a1,_0x0d41('0x14'),JSON['stringify'](_0x379314));if(_0x379314[_0x0d41('0x15')]){if(_0x379314[_0x0d41('0x15')]['code']===0x1f4){logger['error'](_0x0d41('0x11'),_0x44c3a1,_0x379314[_0x0d41('0x15')]['message']);return _0x44aebc(_0x379314[_0x0d41('0x15')][_0x0d41('0x16')]);}logger['error'](_0x0d41('0x11'),_0x44c3a1,_0x379314['error'][_0x0d41('0x16')]);return _0x20f0c8(_0x379314[_0x0d41('0x15')][_0x0d41('0x16')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x44c3a1,_0x0d41('0x14'));_0x20f0c8(_0x379314[_0x0d41('0x17')][_0x0d41('0x16')]);}})[_0x0d41('0x18')](function(_0x4a5126){logger[_0x0d41('0x15')](_0x0d41('0x11'),_0x44c3a1,_0x4a5126);_0x44aebc(_0x4a5126);});});}exports[_0x0d41('0x19')]=function(_0x121dc1){var _0x45bb9b=this;return new Promise(function(_0x31a57c,_0x1d0d6c){return db[_0x0d41('0x1a')][_0x0d41('0x1b')]({'raw':_0x121dc1[_0x0d41('0x1c')]?_0x121dc1[_0x0d41('0x1c')][_0x0d41('0x1d')]===undefined?!![]:![]:!![],'where':_0x121dc1[_0x0d41('0x1c')]?_0x121dc1[_0x0d41('0x1c')][_0x0d41('0x1e')]||null:null,'attributes':_0x121dc1['options']?_0x121dc1['options'][_0x0d41('0x1f')]||null:null,'limit':_0x121dc1[_0x0d41('0x1c')]?_0x121dc1['options'][_0x0d41('0x20')]||null:null,'include':_0x121dc1[_0x0d41('0x1c')]?_0x121dc1[_0x0d41('0x1c')][_0x0d41('0x21')]?_[_0x0d41('0x22')](_0x121dc1['options'][_0x0d41('0x21')],function(_0x579b10){return{'model':db[_0x579b10[_0x0d41('0x23')]],'as':_0x579b10['as'],'attributes':_0x579b10[_0x0d41('0x1f')],'include':_0x579b10[_0x0d41('0x21')]?_[_0x0d41('0x22')](_0x579b10['include'],function(_0x3176e4){return{'model':db[_0x3176e4[_0x0d41('0x23')]],'as':_0x3176e4['as'],'attributes':_0x3176e4[_0x0d41('0x1f')],'include':_0x3176e4[_0x0d41('0x21')]?_[_0x0d41('0x22')](_0x3176e4[_0x0d41('0x21')],function(_0x5c6b9c){return{'model':db[_0x5c6b9c[_0x0d41('0x23')]],'as':_0x5c6b9c['as'],'attributes':_0x5c6b9c[_0x0d41('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0d41('0x24')](function(_0x49f875){logger['info']('GetFaxAccount',_0x121dc1);logger['debug'](_0x0d41('0x19'),_0x121dc1,JSON[_0x0d41('0x25')](_0x49f875));_0x31a57c(_0x49f875);})[_0x0d41('0x18')](function(_0x3098e9){logger[_0x0d41('0x15')](_0x0d41('0x19'),_0x3098e9[_0x0d41('0x16')],_0x121dc1);_0x1d0d6c(_0x45bb9b['error'](0x1f4,_0x3098e9[_0x0d41('0x16')]));});});};exports[_0x0d41('0x26')]=function(_0x3c64ce,_0x16bf7f,_0x26cc40){var _0xa59afb=this;return new Promise(function(_0xe868b3,_0x2e730b){var _0x336eaf={'body':_0x3c64ce['body'],'channel':'fax'};var _0x4eafff=[];var _0x4062be=[];var _0x776ac2={};return db[_0x0d41('0x27')][_0x0d41('0x28')]()[_0x0d41('0x24')](function(_0x46a037){if(!_0x46a037){throw new db['Sequelize'][(_0x0d41('0x29'))](_0x0d41('0x2a'));}_0x4eafff=_[_0x0d41('0x2b')](_[_0x0d41('0x2c')](_0x46a037),[_0x0d41('0x2d'),'updatedAt']);_0x4062be=_[_0x0d41('0x2b')](_[_0x0d41('0x2c')](_0x46a037),['createdAt','updatedAt',_0x0d41('0x2e'),_0x0d41('0x2f')]);if(_0x3c64ce['body']['id']){delete _0x3c64ce[_0x0d41('0x30')]['id'];}if(_[_0x0d41('0x31')](_0x3c64ce['body'][_0x0d41('0x32')])){throw new db[(_0x0d41('0x33'))][(_0x0d41('0x29'))]('from\x20is\x20mandatory');}if(_[_0x0d41('0x31')](_0x3c64ce['body'][_0x0d41('0x30')])||_0x3c64ce[_0x0d41('0x30')][_0x0d41('0x30')]===''){throw new db['Sequelize'][(_0x0d41('0x29'))](_0x0d41('0x34'));}if(_[_0x0d41('0x31')](_0x3c64ce[_0x0d41('0x30')][_0x0d41('0x35')])){throw new db[(_0x0d41('0x33'))][(_0x0d41('0x29'))](_0x0d41('0x36')+_0x4062be);}if(!_['includes'](_0x4062be,_0x3c64ce[_0x0d41('0x30')]['mapKey'])){throw new db[(_0x0d41('0x33'))][(_0x0d41('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4062be);}_0x776ac2[_0x3c64ce['body']['mapKey']]=_0x3c64ce['body']['from'];})[_0x0d41('0x24')](function(){return db[_0x0d41('0x1a')][_0x0d41('0x37')]({'where':{'id':_0x3c64ce['account']['id']},'include':[{'model':db[_0x0d41('0x38')],'as':_0x0d41('0x39'),'include':[{'model':db[_0x0d41('0x27')],'as':_0x0d41('0x3a'),'where':_0x776ac2,'limit':0x1,'order':[[_0x0d41('0x3b'),'DESC']]}]},{'model':db[_0x0d41('0x3c')],'as':_0x0d41('0x3d')}]});})[_0x0d41('0x24')](function(_0x347fb1){if(_0x347fb1&&_0x347fb1[_0x0d41('0x39')]){var _0x5cf265=_0x347fb1[_0x0d41('0x3e')]({'plain':!![]});_0x336eaf[_0x0d41('0x3f')]=_0x5cf265;_0x336eaf['applications']=_0x5cf265['Applications'];_0x336eaf[_0x0d41('0x40')]=_0x5cf265[_0x0d41('0x39')];_0x336eaf[_0x0d41('0x41')]=_[_0x0d41('0x42')](_0x336eaf[_0x0d41('0x41')],['priority'],['asc']);if(_0x336eaf[_0x0d41('0x3f')][_0x0d41('0x3d')]){delete _0x336eaf[_0x0d41('0x3f')][_0x0d41('0x3d')];}if(_0x336eaf[_0x0d41('0x3f')][_0x0d41('0x39')]&&_0x336eaf[_0x0d41('0x3f')][_0x0d41('0x39')][_0x0d41('0x3a')][_0x0d41('0x43')]){return _0x336eaf[_0x0d41('0x3f')][_0x0d41('0x39')][_0x0d41('0x3a')][0x0];}var _0x54a2c2=_[_0x0d41('0x44')](_0x3c64ce['body'],{'firstName':_0x3c64ce[_0x0d41('0x30')][_0x0d41('0x32')],'ListId':_0x5cf265[_0x0d41('0x2f')]});_0x54a2c2[_0x3c64ce[_0x0d41('0x30')][_0x0d41('0x35')]]=_0x3c64ce[_0x0d41('0x30')]['from'];return db[_0x0d41('0x27')]['create'](_0x54a2c2,{'fields':_0x4eafff,'raw':!![]});}})['then'](function(_0x3d2d57){_0x336eaf[_0x0d41('0x45')]=_0x3d2d57;if(_0x3d2d57){var _0x546a96={'ContactId':_0x3d2d57['id'],'FaxAccountId':_0x3c64ce[_0x0d41('0x3f')]['id'],'fax':_0x3d2d57[_0x0d41('0x46')]};return db[_0x0d41('0x47')][_0x0d41('0x37')]({'where':{'ContactId':_0x3d2d57['id'],'closed':![],'FaxAccountId':_0x3c64ce[_0x0d41('0x3f')]['id']}})[_0x0d41('0x24')](function(_0x24168b){if(_0x24168b){return[_0x24168b,![]];}return db[_0x0d41('0x47')][_0x0d41('0x48')](_0x546a96)[_0x0d41('0x24')](function(_0x13a5be){return[_0x13a5be,!![]];});});}else{throw new Error(_0x0d41('0x49'));}})['spread'](function(_0x49b166,_0x17369a){var _0x4262da=_0x49b166['get']({'plain':!![]});if(_0x17369a){if(_0x336eaf[_0x0d41('0x3f')][_0x0d41('0x4a')]){_0x336eaf[_0x0d41('0x41')][_0x0d41('0x4b')]({'id':0x0,'priority':_0x336eaf[_0x0d41('0x41')][_0x0d41('0x43')]+0x1,'app':'close','appdata':_0x0d41('0x4c'),'interval':_0x0d41('0x4d')});}_0x4262da['created']=!![];}else{_0x4262da[_0x0d41('0x4e')]=![];}_0x336eaf[_0x0d41('0x4f')]=_0x4262da;return db[_0x0d41('0x50')]['create']({'body':_0x3c64ce['body'][_0x0d41('0x30')],'FaxAccountId':_0x3c64ce[_0x0d41('0x3f')]['id'],'FaxInteractionId':_0x49b166['id'],'direction':'in','ContactId':_0x49b166['ContactId'],'AttachmentId':_0x3c64ce[_0x0d41('0x30')][_0x0d41('0x51')]});})['then'](function(_0x30d536){_0x336eaf['message']=_0x30d536;if(_0x336eaf['interaction'][_0x0d41('0x52')]){return db[_0x0d41('0x53')]['find']({'attributes':['id',_0x0d41('0x54')],'where':{'id':_0x336eaf[_0x0d41('0x4f')][_0x0d41('0x52')]}})[_0x0d41('0x24')](function(_0x5ebe98){if(_0x5ebe98){_0x336eaf['applications'][_0x0d41('0x55')]({'id':0x0,'priority':0x0,'app':_0x0d41('0x56'),'appdata':_0x5ebe98[_0x0d41('0x54')]+','+(_0x336eaf[_0x0d41('0x3f')][_0x0d41('0x57')]||0xa),'interval':_0x0d41('0x4d')});}return respondWithRpcPromise(_0x0d41('0x58'),_0x0d41('0x59'),_0x336eaf);});}return respondWithRpcPromise(_0x0d41('0x58'),_0x0d41('0x59'),_0x336eaf);})[_0x0d41('0x24')](function(_0x22884d){_0xe868b3(_0x22884d);})[_0x0d41('0x18')](function(_0x34cbc8){_0x2e730b(_0xa59afb['error'](0x1f4,_0x34cbc8['message']));});});}; \ No newline at end of file +var _0x9023=['CompanyId','ListId','isNil','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','from','find','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','account','length','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','FaxAccount','findAll','options','attributes','include','map','model','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt'];(function(_0xa35666,_0x19fb8a){var _0x4b2d2f=function(_0x5d3fca){while(--_0x5d3fca){_0xa35666['push'](_0xa35666['shift']());}};_0x4b2d2f(++_0x19fb8a);}(_0x9023,0xdf));var _0x3902=function(_0x2d837f,_0x5c77d9){_0x2d837f=_0x2d837f-0x0;var _0x453692=_0x9023[_0x2d837f];return _0x453692;};'use strict';var _=require(_0x3902('0x0'));var util=require(_0x3902('0x1'));var moment=require('moment');var BPromise=require(_0x3902('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3902('0x3'));var db=require(_0x3902('0x4'))['db'];var utils=require(_0x3902('0x5'));var logger=require(_0x3902('0x6'))(_0x3902('0x7'));var config=require(_0x3902('0x8'));var jayson=require(_0x3902('0x9'));var client=jayson['client'][_0x3902('0xa')]({'port':0x232c});config[_0x3902('0xb')]=_[_0x3902('0xc')](config[_0x3902('0xb')],{'host':_0x3902('0xd'),'port':0x18eb});var socket=require(_0x3902('0xe'))(new Redis(config[_0x3902('0xb')]));require(_0x3902('0xf'))['register'](socket);function respondWithRpcPromise(_0x12c69b,_0x4d3115,_0x581786){return new BPromise(function(_0x30cfe7,_0xe45f42){return client[_0x3902('0x10')](_0x12c69b,_0x581786)[_0x3902('0x11')](function(_0x25fa75){logger[_0x3902('0x12')](_0x3902('0x13'),_0x4d3115,_0x3902('0x14'));logger[_0x3902('0x15')](_0x3902('0x16'),_0x4d3115,'request\x20sent',JSON['stringify'](_0x25fa75));if(_0x25fa75[_0x3902('0x17')]){if(_0x25fa75[_0x3902('0x17')][_0x3902('0x18')]===0x1f4){logger[_0x3902('0x17')](_0x3902('0x13'),_0x4d3115,_0x25fa75[_0x3902('0x17')][_0x3902('0x19')]);return _0xe45f42(_0x25fa75[_0x3902('0x17')][_0x3902('0x19')]);}logger[_0x3902('0x17')]('FaxAccount,\x20%s,\x20%s',_0x4d3115,_0x25fa75[_0x3902('0x17')][_0x3902('0x19')]);return _0x30cfe7(_0x25fa75[_0x3902('0x17')]['message']);}else{logger['info'](_0x3902('0x13'),_0x4d3115,_0x3902('0x14'));_0x30cfe7(_0x25fa75['result'][_0x3902('0x19')]);}})[_0x3902('0x1a')](function(_0x1fdf62){logger[_0x3902('0x17')](_0x3902('0x13'),_0x4d3115,_0x1fdf62);_0xe45f42(_0x1fdf62);});});}exports['GetFaxAccount']=function(_0x41d13a){var _0x5c1764=this;return new Promise(function(_0x594129,_0x38a754){return db[_0x3902('0x1b')][_0x3902('0x1c')]({'raw':_0x41d13a[_0x3902('0x1d')]?_0x41d13a[_0x3902('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x41d13a['options']?_0x41d13a['options']['where']||null:null,'attributes':_0x41d13a[_0x3902('0x1d')]?_0x41d13a[_0x3902('0x1d')][_0x3902('0x1e')]||null:null,'limit':_0x41d13a[_0x3902('0x1d')]?_0x41d13a[_0x3902('0x1d')]['limit']||null:null,'include':_0x41d13a['options']?_0x41d13a['options'][_0x3902('0x1f')]?_[_0x3902('0x20')](_0x41d13a[_0x3902('0x1d')]['include'],function(_0x1ac260){return{'model':db[_0x1ac260[_0x3902('0x21')]],'as':_0x1ac260['as'],'attributes':_0x1ac260[_0x3902('0x1e')],'include':_0x1ac260[_0x3902('0x1f')]?_[_0x3902('0x20')](_0x1ac260[_0x3902('0x1f')],function(_0x2db989){return{'model':db[_0x2db989[_0x3902('0x21')]],'as':_0x2db989['as'],'attributes':_0x2db989[_0x3902('0x1e')],'include':_0x2db989['include']?_[_0x3902('0x20')](_0x2db989[_0x3902('0x1f')],function(_0x1fc393){return{'model':db[_0x1fc393['model']],'as':_0x1fc393['as'],'attributes':_0x1fc393[_0x3902('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x182a49){logger[_0x3902('0x12')](_0x3902('0x22'),_0x41d13a);logger[_0x3902('0x15')](_0x3902('0x22'),_0x41d13a,JSON[_0x3902('0x23')](_0x182a49));_0x594129(_0x182a49);})[_0x3902('0x1a')](function(_0x3b9cf4){logger['error']('GetFaxAccount',_0x3b9cf4[_0x3902('0x19')],_0x41d13a);_0x38a754(_0x5c1764[_0x3902('0x17')](0x1f4,_0x3b9cf4[_0x3902('0x19')]));});});};exports[_0x3902('0x24')]=function(_0x4a18c4,_0x4199a2,_0x1ababf){var _0x14f9b0=this;return new Promise(function(_0x2abeff,_0x2e961a){var _0xb93f4d={'body':_0x4a18c4[_0x3902('0x25')],'channel':_0x3902('0x26')};var _0x2dc13c=[];var _0x5f02a9=[];var _0x4e7a91={};return db[_0x3902('0x27')][_0x3902('0x28')]()[_0x3902('0x11')](function(_0x49fbd9){if(!_0x49fbd9){throw new db[(_0x3902('0x29'))]['ValidationError'](_0x3902('0x2a'));}_0x2dc13c=_[_0x3902('0x2b')](_[_0x3902('0x2c')](_0x49fbd9),[_0x3902('0x2d'),_0x3902('0x2e')]);_0x5f02a9=_[_0x3902('0x2b')](_['keys'](_0x49fbd9),[_0x3902('0x2d'),_0x3902('0x2e'),_0x3902('0x2f'),_0x3902('0x30')]);if(_0x4a18c4[_0x3902('0x25')]['id']){delete _0x4a18c4[_0x3902('0x25')]['id'];}if(_[_0x3902('0x31')](_0x4a18c4['body']['from'])){throw new db[(_0x3902('0x29'))][(_0x3902('0x32'))]('from\x20is\x20mandatory');}if(_[_0x3902('0x31')](_0x4a18c4[_0x3902('0x25')][_0x3902('0x25')])||_0x4a18c4[_0x3902('0x25')][_0x3902('0x25')]===''){throw new db[(_0x3902('0x29'))][(_0x3902('0x32'))](_0x3902('0x33'));}if(_[_0x3902('0x31')](_0x4a18c4[_0x3902('0x25')][_0x3902('0x34')])){throw new db[(_0x3902('0x29'))][(_0x3902('0x32'))](_0x3902('0x35')+_0x5f02a9);}if(!_[_0x3902('0x36')](_0x5f02a9,_0x4a18c4['body']['mapKey'])){throw new db['Sequelize'][(_0x3902('0x32'))](_0x3902('0x37')+_0x5f02a9);}_0x4e7a91[_0x4a18c4[_0x3902('0x25')][_0x3902('0x34')]]=_0x4a18c4['body'][_0x3902('0x38')];})['then'](function(){return db[_0x3902('0x1b')][_0x3902('0x39')]({'where':{'id':_0x4a18c4['account']['id']},'include':[{'model':db['CmList'],'as':_0x3902('0x3a'),'include':[{'model':db[_0x3902('0x27')],'as':_0x3902('0x3b'),'where':_0x4e7a91,'limit':0x1,'order':[[_0x3902('0x2e'),_0x3902('0x3c')]]}]},{'model':db[_0x3902('0x3d')],'as':_0x3902('0x3e')}]});})[_0x3902('0x11')](function(_0x581208){if(_0x581208&&_0x581208['List']){var _0x428ae2=_0x581208[_0x3902('0x3f')]({'plain':!![]});_0xb93f4d['account']=_0x428ae2;_0xb93f4d[_0x3902('0x40')]=_0x428ae2['Applications'];_0xb93f4d[_0x3902('0x41')]=_0x428ae2[_0x3902('0x3a')];_0xb93f4d[_0x3902('0x40')]=_[_0x3902('0x42')](_0xb93f4d[_0x3902('0x40')],['priority'],[_0x3902('0x43')]);if(_0xb93f4d[_0x3902('0x44')][_0x3902('0x3e')]){delete _0xb93f4d[_0x3902('0x44')]['Applications'];}if(_0xb93f4d['account'][_0x3902('0x3a')]&&_0xb93f4d[_0x3902('0x44')][_0x3902('0x3a')][_0x3902('0x3b')][_0x3902('0x45')]){return _0xb93f4d[_0x3902('0x44')][_0x3902('0x3a')]['Contacts'][0x0];}var _0x512c9b=_['defaults'](_0x4a18c4['body'],{'firstName':_0x4a18c4[_0x3902('0x25')][_0x3902('0x38')],'ListId':_0x428ae2[_0x3902('0x30')]});_0x512c9b[_0x4a18c4[_0x3902('0x25')][_0x3902('0x34')]]=_0x4a18c4['body'][_0x3902('0x38')];return db[_0x3902('0x27')]['create'](_0x512c9b,{'fields':_0x2dc13c,'raw':!![]});}})['then'](function(_0x283a93){_0xb93f4d['contact']=_0x283a93;if(_0x283a93){var _0x173a65={'ContactId':_0x283a93['id'],'FaxAccountId':_0x4a18c4[_0x3902('0x44')]['id'],'fax':_0x283a93[_0x3902('0x26')]};return db[_0x3902('0x46')][_0x3902('0x39')]({'where':{'ContactId':_0x283a93['id'],'closed':![],'FaxAccountId':_0x4a18c4['account']['id']}})[_0x3902('0x11')](function(_0x4ae618){if(_0x4ae618){return[_0x4ae618,![]];}return db[_0x3902('0x46')][_0x3902('0x47')](_0x173a65)[_0x3902('0x11')](function(_0x5bcdc7){return[_0x5bcdc7,!![]];});});}else{throw new Error(_0x3902('0x48'));}})[_0x3902('0x49')](function(_0x2963f8,_0x132559){var _0x457709=_0x2963f8[_0x3902('0x3f')]({'plain':!![]});if(_0x132559){if(_0xb93f4d['account'][_0x3902('0x4a')]){_0xb93f4d[_0x3902('0x40')][_0x3902('0x4b')]({'id':0x0,'priority':_0xb93f4d[_0x3902('0x40')][_0x3902('0x45')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x3902('0x4c')});}_0x457709[_0x3902('0x4d')]=!![];}else{_0x457709[_0x3902('0x4d')]=![];}_0xb93f4d[_0x3902('0x4e')]=_0x457709;return db[_0x3902('0x4f')][_0x3902('0x47')]({'body':_0x4a18c4['body']['body'],'FaxAccountId':_0x4a18c4[_0x3902('0x44')]['id'],'FaxInteractionId':_0x2963f8['id'],'direction':'in','ContactId':_0x2963f8[_0x3902('0x50')],'AttachmentId':_0x4a18c4['body'][_0x3902('0x51')]});})[_0x3902('0x11')](function(_0x195704){_0xb93f4d[_0x3902('0x19')]=_0x195704;if(_0xb93f4d[_0x3902('0x4e')][_0x3902('0x52')]){return db[_0x3902('0x53')][_0x3902('0x39')]({'attributes':['id',_0x3902('0x54')],'where':{'id':_0xb93f4d[_0x3902('0x4e')][_0x3902('0x52')]}})[_0x3902('0x11')](function(_0xe45aed){if(_0xe45aed){_0xb93f4d[_0x3902('0x40')][_0x3902('0x55')]({'id':0x0,'priority':0x0,'app':_0x3902('0x56'),'appdata':_0xe45aed[_0x3902('0x54')]+','+(_0xb93f4d[_0x3902('0x44')][_0x3902('0x57')]||0xa),'interval':_0x3902('0x4c')});}return respondWithRpcPromise(_0x3902('0x58'),'startRouting',_0xb93f4d);});}return respondWithRpcPromise(_0x3902('0x58'),_0x3902('0x59'),_0xb93f4d);})[_0x3902('0x11')](function(_0x3b54df){_0x2abeff(_0x3b54df);})[_0x3902('0x1a')](function(_0x47dbc6){_0x2e961a(_0x14f9b0[_0x3902('0x17')](0x1f4,_0x47dbc6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e94182b..a54c586 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 _0x9afa=['removeListener','register','length','faxAccount:','update','emit'];(function(_0x3328bb,_0x3df503){var _0x138b4b=function(_0x55ba9c){while(--_0x55ba9c){_0x3328bb['push'](_0x3328bb['shift']());}};_0x138b4b(++_0x3df503);}(_0x9afa,0x16c));var _0xa9af=function(_0x52ba82,_0x151813){_0x52ba82=_0x52ba82-0x0;var _0x312d8b=_0x9afa[_0x52ba82];return _0x312d8b;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save','remove',_0xa9af('0x0')];function createListener(_0x562ff9,_0x72ae66){return function(_0x24389b){_0x72ae66[_0xa9af('0x1')](_0x562ff9,_0x24389b);};}function removeListener(_0x5e039f,_0x3a594d){return function(){FaxAccountEvents[_0xa9af('0x2')](_0x5e039f,_0x3a594d);};}exports[_0xa9af('0x3')]=function(_0x162f11){for(var _0x15e69e=0x0,_0x12bed9=events[_0xa9af('0x4')];_0x15e69e<_0x12bed9;_0x15e69e++){var _0x10858a=events[_0x15e69e];var _0x29ac6d=createListener(_0xa9af('0x5')+_0x10858a,_0x162f11);FaxAccountEvents['on'](_0x10858a,_0x29ac6d);}}; \ No newline at end of file +var _0x52e7=['removeListener','register','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x1a0799,_0x480b86){var _0x42f51=function(_0x521b00){while(--_0x521b00){_0x1a0799['push'](_0x1a0799['shift']());}};_0x42f51(++_0x480b86);}(_0x52e7,0x113));var _0x752e=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x52e7[_0x58afd5];return _0x3e503b;};'use strict';var FaxAccountEvents=require(_0x752e('0x0'));var events=[_0x752e('0x1'),_0x752e('0x2'),_0x752e('0x3')];function createListener(_0x5dda2f,_0x3ce0be){return function(_0x4bf9bd){_0x3ce0be[_0x752e('0x4')](_0x5dda2f,_0x4bf9bd);};}function removeListener(_0x5b6fa4,_0x422b2e){return function(){FaxAccountEvents[_0x752e('0x5')](_0x5b6fa4,_0x422b2e);};}exports[_0x752e('0x6')]=function(_0x5645db){for(var _0x252019=0x0,_0x532b56=events['length'];_0x252019<_0x532b56;_0x252019++){var _0x4388ad=events[_0x252019];var _0x25562d=createListener(_0x752e('0x7')+_0x4388ad,_0x5645db);FaxAccountEvents['on'](_0x4388ad,_0x25562d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c613df2..f682388 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2683d4,_0x1148c2){var _0x493266=function(_0x566c4a){while(--_0x566c4a){_0x2683d4['push'](_0x2683d4['shift']());}};_0x493266(++_0x1148c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b482a63..58cf2cf 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 _0x120a=['STRING','noop','TEXT','*,*,*,*'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x120a,0xa4));var _0xa120=function(_0xd5fd5c,_0x3e2a66){_0xd5fd5c=_0xd5fd5c-0x0;var _0x3b0663=_0x120a[_0xd5fd5c];return _0x3b0663;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa120('0x0')],'allowNull':![],'defaultValue':_0xa120('0x1')},'appdata':{'type':Sequelize[_0xa120('0x2')]()},'description':{'type':Sequelize[_0xa120('0x0')]},'interval':{'type':Sequelize[_0xa120('0x0')],'defaultValue':_0xa120('0x3')}}; \ No newline at end of file +var _0x4269=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x538673,_0x2bd911){var _0x97139f=function(_0x4556b6){while(--_0x4556b6){_0x538673['push'](_0x538673['shift']());}};_0x97139f(++_0x2bd911);}(_0x4269,0x172));var _0x9426=function(_0x2a8b21,_0x5cd96b){_0x2a8b21=_0x2a8b21-0x0;var _0x114314=_0x4269[_0x2a8b21];return _0x114314;};'use strict';var Sequelize=require('sequelize');module[_0x9426('0x0')]={'priority':{'type':Sequelize[_0x9426('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9426('0x2')],'allowNull':![],'defaultValue':_0x9426('0x3')},'appdata':{'type':Sequelize[_0x9426('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9426('0x2')],'defaultValue':_0x9426('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index cee874e..d1a29b6 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 _0x1d4a=['api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','name','send','index','FaxApplication','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x403c00,_0x14a828){var _0x57985c=function(_0xdd59e8){while(--_0xdd59e8){_0x403c00['push'](_0x403c00['shift']());}};_0x57985c(++_0x14a828);}(_0x1d4a,0x1ec));var _0xa1d4=function(_0x46363f,_0x37c62e){_0x46363f=_0x46363f-0x0;var _0x5bc670=_0x1d4a[_0x46363f];return _0x5bc670;};'use strict';var emlformat=require(_0xa1d4('0x0'));var rimraf=require(_0xa1d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1d4('0x2'));var rp=require('request-promise');var moment=require(_0xa1d4('0x3'));var BPromise=require(_0xa1d4('0x4'));var Mustache=require(_0xa1d4('0x5'));var util=require(_0xa1d4('0x6'));var path=require(_0xa1d4('0x7'));var sox=require(_0xa1d4('0x8'));var csv=require(_0xa1d4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1d4('0xa'));var _=require(_0xa1d4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa1d4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1d4('0x9'));var querystring=require(_0xa1d4('0xd'));var Papa=require(_0xa1d4('0xe'));var Redis=require('ioredis');var authService=require(_0xa1d4('0xf'));var qs=require(_0xa1d4('0x10'));var as=require(_0xa1d4('0x11'));var hardwareService=require(_0xa1d4('0x12'));var logger=require('../../config/logger')(_0xa1d4('0x13'));var utils=require(_0xa1d4('0x14'));var config=require(_0xa1d4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1d4('0x16'))['db'];function respondWithStatusCode(_0x3f2535,_0x47deea){_0x47deea=_0x47deea||0xcc;return function(_0xf5d282){if(_0xf5d282){return _0x3f2535['sendStatus'](_0x47deea);}return _0x3f2535['status'](_0x47deea)['end']();};}function respondWithResult(_0x2ad5fd,_0x418c84){_0x418c84=_0x418c84||0xc8;return function(_0x341c6d){if(_0x341c6d){return _0x2ad5fd[_0xa1d4('0x17')](_0x418c84)[_0xa1d4('0x18')](_0x341c6d);}};}function respondWithFilteredResult(_0x6849b3,_0x2e6395){return function(_0x2d1641){if(_0x2d1641){var _0x5fa5df=typeof _0x2e6395[_0xa1d4('0x19')]===_0xa1d4('0x1a')&&typeof _0x2e6395['limit']===_0xa1d4('0x1a');var _0x122b1f=_0x2d1641[_0xa1d4('0x1b')];var _0x2cae39=_0x5fa5df?0x0:_0x2e6395[_0xa1d4('0x19')];var _0x4d5f44=_0x5fa5df?_0x2d1641[_0xa1d4('0x1b')]:_0x2e6395[_0xa1d4('0x19')]+_0x2e6395[_0xa1d4('0x1c')];var _0x5c5db0;if(_0x4d5f44>=_0x122b1f){_0x4d5f44=_0x122b1f;_0x5c5db0=0xc8;}else{_0x5c5db0=0xce;}_0x6849b3[_0xa1d4('0x17')](_0x5c5db0);return _0x6849b3[_0xa1d4('0x1d')]('Content-Range',_0x2cae39+'-'+_0x4d5f44+'/'+_0x122b1f)[_0xa1d4('0x18')](_0x2d1641);}return null;};}function patchUpdates(_0x22e1e4){return function(_0xefecbd){try{jsonpatch[_0xa1d4('0x1e')](_0xefecbd,_0x22e1e4,!![]);}catch(_0x337d00){return BPromise[_0xa1d4('0x1f')](_0x337d00);}return _0xefecbd[_0xa1d4('0x20')]();};}function saveUpdates(_0x1cc419,_0x1f6fdf){return function(_0x27861e){if(_0x27861e){return _0x27861e[_0xa1d4('0x21')](_0x1cc419)[_0xa1d4('0x22')](function(_0x5d7d14){return _0x5d7d14;});}return null;};}function removeEntity(_0x417978,_0x4317d3){return function(_0x1880d9){if(_0x1880d9){return _0x1880d9[_0xa1d4('0x23')]()['then'](function(){_0x417978[_0xa1d4('0x17')](0xcc)[_0xa1d4('0x24')]();});}};}function handleEntityNotFound(_0x1c54df,_0x4fa2be){return function(_0x5b5877){if(!_0x5b5877){_0x1c54df['sendStatus'](0x194);}return _0x5b5877;};}function handleError(_0x993611,_0x4f5476){_0x4f5476=_0x4f5476||0x1f4;return function(_0xd11e08){logger['error'](_0xd11e08['stack']);if(_0xd11e08[_0xa1d4('0x25')]){delete _0xd11e08[_0xa1d4('0x25')];}_0x993611[_0xa1d4('0x17')](_0x4f5476)[_0xa1d4('0x26')](_0xd11e08);};}exports[_0xa1d4('0x27')]=function(_0x1a0bbc,_0x4b8b9d){var _0xd75d34={},_0x2ef769={},_0x45e1ac={'count':0x0,'rows':[]};var _0x8d3999=_['map'](db[_0xa1d4('0x28')][_0xa1d4('0x29')],function(_0x275d5c){return{'name':_0x275d5c['fieldName'],'type':_0x275d5c[_0xa1d4('0x2a')][_0xa1d4('0x2b')]};});_0x2ef769[_0xa1d4('0x2c')]=_[_0xa1d4('0x2d')](_0x8d3999,'name');_0x2ef769[_0xa1d4('0x2e')]=_[_0xa1d4('0x2f')](_0x1a0bbc['query']);_0x2ef769[_0xa1d4('0x30')]=_[_0xa1d4('0x31')](_0x2ef769[_0xa1d4('0x2c')],_0x2ef769['query']);_0xd75d34[_0xa1d4('0x32')]=_['intersection'](_0x2ef769['model'],qs['fields'](_0x1a0bbc[_0xa1d4('0x2e')][_0xa1d4('0x33')]));_0xd75d34[_0xa1d4('0x32')]=_0xd75d34['attributes'][_0xa1d4('0x34')]?_0xd75d34['attributes']:_0x2ef769[_0xa1d4('0x2c')];if(!_0x1a0bbc[_0xa1d4('0x2e')][_0xa1d4('0x35')](_0xa1d4('0x36'))){_0xd75d34[_0xa1d4('0x1c')]=qs[_0xa1d4('0x1c')](_0x1a0bbc['query'][_0xa1d4('0x1c')]);_0xd75d34[_0xa1d4('0x19')]=qs[_0xa1d4('0x19')](_0x1a0bbc[_0xa1d4('0x2e')]['offset']);}_0xd75d34[_0xa1d4('0x37')]=qs[_0xa1d4('0x38')](_0x1a0bbc['query']['sort']);_0xd75d34['where']=qs[_0xa1d4('0x30')](_[_0xa1d4('0x39')](_0x1a0bbc[_0xa1d4('0x2e')],_0x2ef769[_0xa1d4('0x30')]),_0x8d3999);if(_0x1a0bbc[_0xa1d4('0x2e')][_0xa1d4('0x3a')]){_0xd75d34[_0xa1d4('0x3b')]=_['merge'](_0xd75d34[_0xa1d4('0x3b')],{'$or':_[_0xa1d4('0x2d')](_0x8d3999,function(_0x4eebee){if(_0x4eebee[_0xa1d4('0x2a')]!==_0xa1d4('0x3c')){var _0x301f3d={};_0x301f3d[_0x4eebee[_0xa1d4('0x25')]]={'$like':'%'+_0x1a0bbc['query'][_0xa1d4('0x3a')]+'%'};return _0x301f3d;}})});}_0xd75d34=_[_0xa1d4('0x3d')]({},_0xd75d34,_0x1a0bbc[_0xa1d4('0x3e')]);var _0x5a55fe={'where':_0xd75d34[_0xa1d4('0x3b')]};return db[_0xa1d4('0x28')]['count'](_0x5a55fe)[_0xa1d4('0x22')](function(_0x10189c){_0x45e1ac['count']=_0x10189c;if(_0x1a0bbc[_0xa1d4('0x2e')][_0xa1d4('0x3f')]){_0xd75d34[_0xa1d4('0x40')]=[{'all':!![]}];}return db[_0xa1d4('0x28')][_0xa1d4('0x41')](_0xd75d34);})[_0xa1d4('0x22')](function(_0x5d714c){_0x45e1ac[_0xa1d4('0x42')]=_0x5d714c;return _0x45e1ac;})[_0xa1d4('0x22')](respondWithFilteredResult(_0x4b8b9d,_0xd75d34))[_0xa1d4('0x43')](handleError(_0x4b8b9d,null));};exports[_0xa1d4('0x44')]=function(_0x500dc2,_0x52e1ff){var _0x10b53c={'raw':!![],'where':{'id':_0x500dc2[_0xa1d4('0x45')]['id']}},_0x4318ad={};_0x4318ad[_0xa1d4('0x2c')]=_[_0xa1d4('0x2f')](db[_0xa1d4('0x28')][_0xa1d4('0x29')]);_0x4318ad[_0xa1d4('0x2e')]=_[_0xa1d4('0x2f')](_0x500dc2['query']);_0x4318ad['filters']=_['intersection'](_0x4318ad[_0xa1d4('0x2c')],_0x4318ad[_0xa1d4('0x2e')]);_0x10b53c[_0xa1d4('0x32')]=_['intersection'](_0x4318ad['model'],qs[_0xa1d4('0x33')](_0x500dc2[_0xa1d4('0x2e')][_0xa1d4('0x33')]));_0x10b53c['attributes']=_0x10b53c['attributes'][_0xa1d4('0x34')]?_0x10b53c[_0xa1d4('0x32')]:_0x4318ad[_0xa1d4('0x2c')];if(_0x500dc2[_0xa1d4('0x2e')][_0xa1d4('0x3f')]){_0x10b53c['include']=[{'all':!![]}];}_0x10b53c=_['merge']({},_0x10b53c,_0x500dc2[_0xa1d4('0x3e')]);return db['FaxApplication'][_0xa1d4('0x46')](_0x10b53c)[_0xa1d4('0x22')](handleEntityNotFound(_0x52e1ff,null))['then'](respondWithResult(_0x52e1ff,null))[_0xa1d4('0x43')](handleError(_0x52e1ff,null));};exports[_0xa1d4('0x47')]=function(_0x53d896,_0x4697fe){return db[_0xa1d4('0x28')][_0xa1d4('0x47')](_0x53d896[_0xa1d4('0x48')],{})['then'](respondWithResult(_0x4697fe,0xc9))[_0xa1d4('0x43')](handleError(_0x4697fe,null));};exports['update']=function(_0x5a3946,_0x49be16){if(_0x5a3946[_0xa1d4('0x48')]['id']){delete _0x5a3946[_0xa1d4('0x48')]['id'];}return db[_0xa1d4('0x28')][_0xa1d4('0x46')]({'where':{'id':_0x5a3946['params']['id']}})[_0xa1d4('0x22')](handleEntityNotFound(_0x49be16,null))[_0xa1d4('0x22')](saveUpdates(_0x5a3946['body'],null))[_0xa1d4('0x22')](respondWithResult(_0x49be16,null))[_0xa1d4('0x43')](handleError(_0x49be16,null));};exports[_0xa1d4('0x23')]=function(_0x565ec5,_0x1f01e0){return db[_0xa1d4('0x28')][_0xa1d4('0x46')]({'where':{'id':_0x565ec5[_0xa1d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f01e0,null))[_0xa1d4('0x22')](removeEntity(_0x1f01e0,null))[_0xa1d4('0x43')](handleError(_0x1f01e0,null));}; \ No newline at end of file +var _0x406b=['../../config/utils','../../config/environment','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','FaxApplication','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3d5780,_0x24cd34){var _0x3066ab=function(_0x4537f1){while(--_0x4537f1){_0x3d5780['push'](_0x3d5780['shift']());}};_0x3066ab(++_0x24cd34);}(_0x406b,0x1e1));var _0xb406=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x406b[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb406('0x0'));var jsonpatch=require(_0xb406('0x1'));var rp=require(_0xb406('0x2'));var moment=require(_0xb406('0x3'));var BPromise=require(_0xb406('0x4'));var Mustache=require(_0xb406('0x5'));var util=require(_0xb406('0x6'));var path=require(_0xb406('0x7'));var sox=require(_0xb406('0x8'));var csv=require(_0xb406('0x9'));var ejs=require(_0xb406('0xa'));var fs=require('fs');var fs_extra=require(_0xb406('0xb'));var _=require(_0xb406('0xc'));var squel=require(_0xb406('0xd'));var crypto=require('crypto');var jsforce=require(_0xb406('0xe'));var deskjs=require(_0xb406('0xf'));var toCsv=require(_0xb406('0x9'));var querystring=require(_0xb406('0x10'));var Papa=require(_0xb406('0x11'));var Redis=require(_0xb406('0x12'));var authService=require(_0xb406('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb406('0x14'));var hardwareService=require(_0xb406('0x15'));var logger=require('../../config/logger')(_0xb406('0x16'));var utils=require(_0xb406('0x17'));var config=require(_0xb406('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45f045,_0x9912de){_0x9912de=_0x9912de||0xcc;return function(_0x58e316){if(_0x58e316){return _0x45f045['sendStatus'](_0x9912de);}return _0x45f045[_0xb406('0x19')](_0x9912de)[_0xb406('0x1a')]();};}function respondWithResult(_0x5af7dc,_0x3c59b6){_0x3c59b6=_0x3c59b6||0xc8;return function(_0x3670be){if(_0x3670be){return _0x5af7dc['status'](_0x3c59b6)['json'](_0x3670be);}};}function respondWithFilteredResult(_0x19d0c5,_0x23ef60){return function(_0x1f068b){if(_0x1f068b){var _0x1bb048=typeof _0x23ef60[_0xb406('0x1b')]===_0xb406('0x1c')&&typeof _0x23ef60['limit']===_0xb406('0x1c');var _0x177967=_0x1f068b[_0xb406('0x1d')];var _0x24625f=_0x1bb048?0x0:_0x23ef60[_0xb406('0x1b')];var _0x21c0c0=_0x1bb048?_0x1f068b['count']:_0x23ef60[_0xb406('0x1b')]+_0x23ef60[_0xb406('0x1e')];var _0x819bbb;if(_0x21c0c0>=_0x177967){_0x21c0c0=_0x177967;_0x819bbb=0xc8;}else{_0x819bbb=0xce;}_0x19d0c5[_0xb406('0x19')](_0x819bbb);return _0x19d0c5[_0xb406('0x1f')](_0xb406('0x20'),_0x24625f+'-'+_0x21c0c0+'/'+_0x177967)[_0xb406('0x21')](_0x1f068b);}return null;};}function patchUpdates(_0x282541){return function(_0x228355){try{jsonpatch[_0xb406('0x22')](_0x228355,_0x282541,!![]);}catch(_0x38efef){return BPromise[_0xb406('0x23')](_0x38efef);}return _0x228355[_0xb406('0x24')]();};}function saveUpdates(_0x3b70b8,_0x5c8d50){return function(_0x3931ec){if(_0x3931ec){return _0x3931ec[_0xb406('0x25')](_0x3b70b8)[_0xb406('0x26')](function(_0x1c83d1){return _0x1c83d1;});}return null;};}function removeEntity(_0x3cff78,_0x348911){return function(_0x5bcf84){if(_0x5bcf84){return _0x5bcf84[_0xb406('0x27')]()[_0xb406('0x26')](function(){_0x3cff78[_0xb406('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ba02b,_0x485e88){return function(_0x58dd91){if(!_0x58dd91){_0x2ba02b[_0xb406('0x28')](0x194);}return _0x58dd91;};}function handleError(_0x2a6f41,_0x29736c){_0x29736c=_0x29736c||0x1f4;return function(_0x20b754){logger['error'](_0x20b754['stack']);if(_0x20b754[_0xb406('0x29')]){delete _0x20b754[_0xb406('0x29')];}_0x2a6f41[_0xb406('0x19')](_0x29736c)[_0xb406('0x2a')](_0x20b754);};}exports[_0xb406('0x2b')]=function(_0x5230c4,_0x7ac2d7){var _0x317734={},_0x129d1f={},_0x4a0461={'count':0x0,'rows':[]};var _0x4628ee=_[_0xb406('0x2c')](db[_0xb406('0x2d')]['rawAttributes'],function(_0x4e09d8){return{'name':_0x4e09d8[_0xb406('0x2e')],'type':_0x4e09d8['type'][_0xb406('0x2f')]};});_0x129d1f[_0xb406('0x30')]=_[_0xb406('0x2c')](_0x4628ee,_0xb406('0x29'));_0x129d1f[_0xb406('0x31')]=_[_0xb406('0x32')](_0x5230c4[_0xb406('0x31')]);_0x129d1f[_0xb406('0x33')]=_[_0xb406('0x34')](_0x129d1f[_0xb406('0x30')],_0x129d1f[_0xb406('0x31')]);_0x317734[_0xb406('0x35')]=_[_0xb406('0x34')](_0x129d1f[_0xb406('0x30')],qs[_0xb406('0x36')](_0x5230c4['query']['fields']));_0x317734[_0xb406('0x35')]=_0x317734[_0xb406('0x35')][_0xb406('0x37')]?_0x317734[_0xb406('0x35')]:_0x129d1f[_0xb406('0x30')];if(!_0x5230c4[_0xb406('0x31')]['hasOwnProperty'](_0xb406('0x38'))){_0x317734[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x5230c4['query'][_0xb406('0x1e')]);_0x317734[_0xb406('0x1b')]=qs[_0xb406('0x1b')](_0x5230c4[_0xb406('0x31')][_0xb406('0x1b')]);}_0x317734['order']=qs[_0xb406('0x39')](_0x5230c4[_0xb406('0x31')][_0xb406('0x39')]);_0x317734[_0xb406('0x3a')]=qs['filters'](_['pick'](_0x5230c4[_0xb406('0x31')],_0x129d1f[_0xb406('0x33')]),_0x4628ee);if(_0x5230c4[_0xb406('0x31')][_0xb406('0x3b')]){_0x317734['where']=_[_0xb406('0x3c')](_0x317734['where'],{'$or':_['map'](_0x4628ee,function(_0x31dd74){if(_0x31dd74['type']!==_0xb406('0x3d')){var _0x5c7bb5={};_0x5c7bb5[_0x31dd74[_0xb406('0x29')]]={'$like':'%'+_0x5230c4[_0xb406('0x31')]['filter']+'%'};return _0x5c7bb5;}})});}_0x317734=_['merge']({},_0x317734,_0x5230c4[_0xb406('0x3e')]);var _0x1124e2={'where':_0x317734['where']};return db['FaxApplication']['count'](_0x1124e2)[_0xb406('0x26')](function(_0x4fa7f8){_0x4a0461[_0xb406('0x1d')]=_0x4fa7f8;if(_0x5230c4['query'][_0xb406('0x3f')]){_0x317734[_0xb406('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0xb406('0x41')](_0x317734);})['then'](function(_0x29cfa9){_0x4a0461[_0xb406('0x42')]=_0x29cfa9;return _0x4a0461;})['then'](respondWithFilteredResult(_0x7ac2d7,_0x317734))[_0xb406('0x43')](handleError(_0x7ac2d7,null));};exports[_0xb406('0x44')]=function(_0x5e0a1c,_0xeadacf){var _0x1b9171={'raw':!![],'where':{'id':_0x5e0a1c['params']['id']}},_0x1eb2eb={};_0x1eb2eb['model']=_['keys'](db[_0xb406('0x2d')]['rawAttributes']);_0x1eb2eb['query']=_[_0xb406('0x32')](_0x5e0a1c[_0xb406('0x31')]);_0x1eb2eb[_0xb406('0x33')]=_[_0xb406('0x34')](_0x1eb2eb['model'],_0x1eb2eb['query']);_0x1b9171[_0xb406('0x35')]=_[_0xb406('0x34')](_0x1eb2eb[_0xb406('0x30')],qs[_0xb406('0x36')](_0x5e0a1c[_0xb406('0x31')][_0xb406('0x36')]));_0x1b9171[_0xb406('0x35')]=_0x1b9171[_0xb406('0x35')]['length']?_0x1b9171[_0xb406('0x35')]:_0x1eb2eb[_0xb406('0x30')];if(_0x5e0a1c['query'][_0xb406('0x3f')]){_0x1b9171['include']=[{'all':!![]}];}_0x1b9171=_[_0xb406('0x3c')]({},_0x1b9171,_0x5e0a1c['options']);return db[_0xb406('0x2d')][_0xb406('0x45')](_0x1b9171)[_0xb406('0x26')](handleEntityNotFound(_0xeadacf,null))[_0xb406('0x26')](respondWithResult(_0xeadacf,null))['catch'](handleError(_0xeadacf,null));};exports[_0xb406('0x46')]=function(_0x1be4c8,_0x3ca0dc){return db[_0xb406('0x2d')]['create'](_0x1be4c8[_0xb406('0x47')],{})[_0xb406('0x26')](respondWithResult(_0x3ca0dc,0xc9))[_0xb406('0x43')](handleError(_0x3ca0dc,null));};exports[_0xb406('0x25')]=function(_0x74b92,_0x4aa89a){if(_0x74b92[_0xb406('0x47')]['id']){delete _0x74b92[_0xb406('0x47')]['id'];}return db[_0xb406('0x2d')]['find']({'where':{'id':_0x74b92['params']['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x4aa89a,null))[_0xb406('0x26')](saveUpdates(_0x74b92[_0xb406('0x47')],null))['then'](respondWithResult(_0x4aa89a,null))[_0xb406('0x43')](handleError(_0x4aa89a,null));};exports[_0xb406('0x27')]=function(_0x2a9e43,_0x4a8d3c){return db[_0xb406('0x2d')][_0xb406('0x45')]({'where':{'id':_0x2a9e43['params']['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x4a8d3c,null))[_0xb406('0x26')](removeEntity(_0x4a8d3c,null))['catch'](handleError(_0x4a8d3c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f77860c..7be22df 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 _0xef3f=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','FaxApplication','fax_applications'];(function(_0x2d8a6f,_0x2d711a){var _0x1a6f81=function(_0x800727){while(--_0x800727){_0x2d8a6f['push'](_0x2d8a6f['shift']());}};_0x1a6f81(++_0x2d711a);}(_0xef3f,0x1f1));var _0xfef3=function(_0x452097,_0x1b2f4e){_0x452097=_0x452097-0x0;var _0x885e43=_0xef3f[_0x452097];return _0x885e43;};'use strict';var _=require(_0xfef3('0x0'));var util=require(_0xfef3('0x1'));var logger=require(_0xfef3('0x2'))(_0xfef3('0x3'));var moment=require(_0xfef3('0x4'));var BPromise=require(_0xfef3('0x5'));var rp=require(_0xfef3('0x6'));var fs=require('fs');var path=require(_0xfef3('0x7'));var rimraf=require(_0xfef3('0x8'));var config=require('../../config/environment');var attributes=require(_0xfef3('0x9'));module[_0xfef3('0xa')]=function(_0x2e0120,_0x1cea4b){return _0x2e0120['define'](_0xfef3('0xb'),attributes,{'tableName':_0xfef3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfef3('0xd'),'collate':_0xfef3('0xe')});}; \ No newline at end of file +var _0xcbd4=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','FaxApplication','fax_applications'];(function(_0x4d1f74,_0x57def8){var _0x3679dd=function(_0x171b5a){while(--_0x171b5a){_0x4d1f74['push'](_0x4d1f74['shift']());}};_0x3679dd(++_0x57def8);}(_0xcbd4,0xb8));var _0x4cbd=function(_0x1e5360,_0x31f7a2){_0x1e5360=_0x1e5360-0x0;var _0xf6a9a9=_0xcbd4[_0x1e5360];return _0xf6a9a9;};'use strict';var _=require(_0x4cbd('0x0'));var util=require(_0x4cbd('0x1'));var logger=require(_0x4cbd('0x2'))(_0x4cbd('0x3'));var moment=require('moment');var BPromise=require(_0x4cbd('0x4'));var rp=require(_0x4cbd('0x5'));var fs=require('fs');var path=require(_0x4cbd('0x6'));var rimraf=require('rimraf');var config=require(_0x4cbd('0x7'));var attributes=require('./faxApplication.attributes');module[_0x4cbd('0x8')]=function(_0x398f80,_0x4a2355){return _0x398f80['define'](_0x4cbd('0x9'),attributes,{'tableName':_0x4cbd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4cbd('0xb'),'collate':_0x4cbd('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index bad6604..38003cf 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 _0x8e0c=['code','message','FaxApplication,\x20%s,\x20%s','request\x20sent','catch','FaxApplication','update','body','options','raw','attributes','limit','UpdateFaxApplication','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3a4c07,_0x18440c){var _0x5a4943=function(_0x4afb24){while(--_0x4afb24){_0x3a4c07['push'](_0x3a4c07['shift']());}};_0x5a4943(++_0x18440c);}(_0x8e0c,0xe5));var _0xc8e0=function(_0x5bccad,_0x3dd8d8){_0x5bccad=_0x5bccad-0x0;var _0x3f53fc=_0x8e0c[_0x5bccad];return _0x3f53fc;};'use strict';var _=require(_0xc8e0('0x0'));var util=require('util');var moment=require(_0xc8e0('0x1'));var BPromise=require(_0xc8e0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8e0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8e0('0x4'));var logger=require(_0xc8e0('0x5'))('rpc');var config=require(_0xc8e0('0x6'));var jayson=require(_0xc8e0('0x7'));var client=jayson[_0xc8e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11397f,_0x1ff073,_0x15c5a4){return new BPromise(function(_0x3cc631,_0x1c2fcf){return client['request'](_0x11397f,_0x15c5a4)['then'](function(_0x1475fb){logger[_0xc8e0('0x9')]('FaxApplication,\x20%s,\x20%s',_0x1ff073,'request\x20sent');logger[_0xc8e0('0xa')](_0xc8e0('0xb'),_0x1ff073,'request\x20sent',JSON[_0xc8e0('0xc')](_0x1475fb));if(_0x1475fb[_0xc8e0('0xd')]){if(_0x1475fb[_0xc8e0('0xd')][_0xc8e0('0xe')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x1ff073,_0x1475fb[_0xc8e0('0xd')][_0xc8e0('0xf')]);return _0x1c2fcf(_0x1475fb[_0xc8e0('0xd')][_0xc8e0('0xf')]);}logger[_0xc8e0('0xd')](_0xc8e0('0x10'),_0x1ff073,_0x1475fb[_0xc8e0('0xd')][_0xc8e0('0xf')]);return _0x3cc631(_0x1475fb[_0xc8e0('0xd')]['message']);}else{logger[_0xc8e0('0x9')](_0xc8e0('0x10'),_0x1ff073,_0xc8e0('0x11'));_0x3cc631(_0x1475fb['result']['message']);}})[_0xc8e0('0x12')](function(_0x35df36){logger[_0xc8e0('0xd')](_0xc8e0('0x10'),_0x1ff073,_0x35df36);_0x1c2fcf(_0x35df36);});});}exports['UpdateFaxApplication']=function(_0x1d2b30){var _0x57fe01=this;return new Promise(function(_0x6fca73,_0x173465){return db[_0xc8e0('0x13')][_0xc8e0('0x14')](_0x1d2b30[_0xc8e0('0x15')],{'raw':_0x1d2b30[_0xc8e0('0x16')]?_0x1d2b30['options'][_0xc8e0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d2b30[_0xc8e0('0x16')]?_0x1d2b30[_0xc8e0('0x16')]['where']||null:null,'attributes':_0x1d2b30[_0xc8e0('0x16')]?_0x1d2b30[_0xc8e0('0x16')][_0xc8e0('0x18')]||null:null,'limit':_0x1d2b30[_0xc8e0('0x16')]?_0x1d2b30[_0xc8e0('0x16')][_0xc8e0('0x19')]||null:null})['then'](function(_0x4486bf){logger[_0xc8e0('0x9')](_0xc8e0('0x1a'),_0x1d2b30);logger[_0xc8e0('0xa')](_0xc8e0('0x1a'),_0x1d2b30,JSON[_0xc8e0('0xc')](_0x4486bf));_0x6fca73(_0x4486bf);})[_0xc8e0('0x12')](function(_0x4e3310){logger[_0xc8e0('0xd')](_0xc8e0('0x1a'),_0x4e3310[_0xc8e0('0xf')],_0x1d2b30);_0x173465(_0x57fe01[_0xc8e0('0xd')](0x1f4,_0x4e3310[_0xc8e0('0xf')]));});});}; \ No newline at end of file +var _0xf6b3=['FaxApplication','update','options','raw','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxApplication'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xf6b3,0x97));var _0x3f6b=function(_0x1f8eb8,_0xfc4345){_0x1f8eb8=_0x1f8eb8-0x0;var _0x37ca05=_0xf6b3[_0x1f8eb8];return _0x37ca05;};'use strict';var _=require(_0x3f6b('0x0'));var util=require('util');var moment=require(_0x3f6b('0x1'));var BPromise=require(_0x3f6b('0x2'));var rs=require(_0x3f6b('0x3'));var fs=require('fs');var Redis=require(_0x3f6b('0x4'));var db=require(_0x3f6b('0x5'))['db'];var utils=require(_0x3f6b('0x6'));var logger=require('../../config/logger')(_0x3f6b('0x7'));var config=require(_0x3f6b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f6b('0x9')][_0x3f6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55917c,_0x3bb158,_0x34a758){return new BPromise(function(_0x3499cf,_0x18a383){return client['request'](_0x55917c,_0x34a758)[_0x3f6b('0xb')](function(_0x23b00b){logger[_0x3f6b('0xc')](_0x3f6b('0xd'),_0x3bb158,'request\x20sent');logger[_0x3f6b('0xe')](_0x3f6b('0xf'),_0x3bb158,_0x3f6b('0x10'),JSON[_0x3f6b('0x11')](_0x23b00b));if(_0x23b00b[_0x3f6b('0x12')]){if(_0x23b00b[_0x3f6b('0x12')][_0x3f6b('0x13')]===0x1f4){logger[_0x3f6b('0x12')](_0x3f6b('0xd'),_0x3bb158,_0x23b00b[_0x3f6b('0x12')][_0x3f6b('0x14')]);return _0x18a383(_0x23b00b[_0x3f6b('0x12')]['message']);}logger['error'](_0x3f6b('0xd'),_0x3bb158,_0x23b00b[_0x3f6b('0x12')]['message']);return _0x3499cf(_0x23b00b[_0x3f6b('0x12')][_0x3f6b('0x14')]);}else{logger['info'](_0x3f6b('0xd'),_0x3bb158,_0x3f6b('0x10'));_0x3499cf(_0x23b00b['result'][_0x3f6b('0x14')]);}})[_0x3f6b('0x15')](function(_0x1fc318){logger[_0x3f6b('0x12')](_0x3f6b('0xd'),_0x3bb158,_0x1fc318);_0x18a383(_0x1fc318);});});}exports[_0x3f6b('0x16')]=function(_0x300999){var _0x59b60d=this;return new Promise(function(_0x1796cc,_0x471ef3){return db[_0x3f6b('0x17')][_0x3f6b('0x18')](_0x300999['body'],{'raw':_0x300999[_0x3f6b('0x19')]?_0x300999[_0x3f6b('0x19')][_0x3f6b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x300999['options']?_0x300999[_0x3f6b('0x19')][_0x3f6b('0x1b')]||null:null,'attributes':_0x300999[_0x3f6b('0x19')]?_0x300999['options'][_0x3f6b('0x1c')]||null:null,'limit':_0x300999[_0x3f6b('0x19')]?_0x300999[_0x3f6b('0x19')]['limit']||null:null})[_0x3f6b('0xb')](function(_0x26de22){logger[_0x3f6b('0xc')](_0x3f6b('0x16'),_0x300999);logger[_0x3f6b('0xe')](_0x3f6b('0x16'),_0x300999,JSON[_0x3f6b('0x11')](_0x26de22));_0x1796cc(_0x26de22);})['catch'](function(_0x441b16){logger[_0x3f6b('0x12')](_0x3f6b('0x16'),_0x441b16['message'],_0x300999);_0x471ef3(_0x59b60d[_0x3f6b('0x12')](0x1f4,_0x441b16[_0x3f6b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 6c102f2..74dc3b3 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 _0xd4a2=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0x2f509b,_0x29434e){var _0x3d8be2=function(_0x2858b2){while(--_0x2858b2){_0x2f509b['push'](_0x2f509b['shift']());}};_0x3d8be2(++_0x29434e);}(_0xd4a2,0x173));var _0x2d4a=function(_0x179cec,_0x63b238){_0x179cec=_0x179cec-0x0;var _0xdeb550=_0xd4a2[_0x179cec];return _0xdeb550;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0xf')](_0x2d4a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d4a('0x10')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','/:id'];(function(_0x4a3acd,_0x4bf641){var _0x3efdaa=function(_0x32842d){while(--_0x32842d){_0x4a3acd['push'](_0x4a3acd['shift']());}};_0x3efdaa(++_0x4bf641);}(_0x4fc2,0x111));var _0x24fc=function(_0x2eb898,_0x43c47b){_0x2eb898=_0x2eb898-0x0;var _0x58974f=_0x4fc2[_0x2eb898];return _0x58974f;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 067dc07..b797504 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 _0x53cd=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x53cd,0xf7));var _0xd53c=function(_0x3620c5,_0x1735c9){_0x3620c5=_0x3620c5-0x0;var _0x5d9008=_0x53cd[_0x3620c5];return _0x5d9008;};'use strict';var Sequelize=require(_0xd53c('0x0'));module[_0xd53c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd53c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd53c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd53c('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xd53c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd53c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd53c('0x4')]('in',_0xd53c('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xeaaf=['BOOLEAN','DATE','STRING','out'];(function(_0x12a5e1,_0x1fd631){var _0x3d4fc3=function(_0x862cf8){while(--_0x862cf8){_0x12a5e1['push'](_0x12a5e1['shift']());}};_0x3d4fc3(++_0x1fd631);}(_0xeaaf,0x1c8));var _0xfeaa=function(_0x207879,_0x25591a){_0x207879=_0x207879-0x0;var _0x543228=_0xeaaf[_0x207879];return _0x543228;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xfeaa('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfeaa('0x1')]},'disposition':{'type':Sequelize[_0xfeaa('0x2')]},'secondDisposition':{'type':Sequelize[_0xfeaa('0x2')]},'thirdDisposition':{'type':Sequelize[_0xfeaa('0x2')]},'note':{'type':Sequelize[_0xfeaa('0x2')]},'read1stAt':{'type':Sequelize[_0xfeaa('0x1')]},'fax':{'type':Sequelize[_0xfeaa('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfeaa('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfeaa('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfeaa('0x3')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 10b1d3e..3939fac 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 _0x3e95=['find','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','merge','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','toString','groupBy','FaxInteractionId','all','catch','show','params','rawAttributes','intersection','includeAll','options','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','include','findAll','setTags','emit','removeTags','download','unix','root','server','join','files','attachments','transcript-%d-%s.zip','Messages','get','Attachment','basename','createReadStream','createWriteStream','log','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','desk.js','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','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','destroy','then','error','stack','name','send','map','TagIds','Tags','split','forEach','push','index','FaxInteraction','fieldName','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions'];(function(_0x9b7f7d,_0x1337b1){var _0x3e43fe=function(_0xb58267){while(--_0xb58267){_0x9b7f7d['push'](_0x9b7f7d['shift']());}};_0x3e43fe(++_0x1337b1);}(_0x3e95,0x147));var _0x53e9=function(_0x162a92,_0x170f35){_0x162a92=_0x162a92-0x0;var _0x41277b=_0x3e95[_0x162a92];return _0x41277b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x53e9('0x0'));var jsonpatch=require(_0x53e9('0x1'));var rp=require(_0x53e9('0x2'));var moment=require(_0x53e9('0x3'));var BPromise=require(_0x53e9('0x4'));var Mustache=require(_0x53e9('0x5'));var util=require(_0x53e9('0x6'));var path=require('path');var sox=require(_0x53e9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53e9('0x8'));var _=require(_0x53e9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x53e9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x53e9('0xb'));var Papa=require(_0x53e9('0xc'));var Redis=require(_0x53e9('0xd'));var authService=require(_0x53e9('0xe'));var qs=require(_0x53e9('0xf'));var as=require(_0x53e9('0x10'));var hardwareService=require(_0x53e9('0x11'));var logger=require(_0x53e9('0x12'))(_0x53e9('0x13'));var utils=require(_0x53e9('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x53e9('0x15'))['db'];config[_0x53e9('0x16')]=_[_0x53e9('0x17')](config[_0x53e9('0x16')],{'host':_0x53e9('0x18'),'port':0x18eb});var socket=require(_0x53e9('0x19'))(new Redis(config[_0x53e9('0x16')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x11396a,_0x127f4e){_0x127f4e=_0x127f4e||0xcc;return function(_0xdc4666){if(_0xdc4666){return _0x11396a[_0x53e9('0x1a')](_0x127f4e);}return _0x11396a[_0x53e9('0x1b')](_0x127f4e)[_0x53e9('0x1c')]();};}function respondWithResult(_0x33034e,_0x53db4d){_0x53db4d=_0x53db4d||0xc8;return function(_0x1e77cf){if(_0x1e77cf){return _0x33034e[_0x53e9('0x1b')](_0x53db4d)['json'](_0x1e77cf);}};}function respondWithFilteredResult(_0x2c901a,_0x40b167){return function(_0x51be5d){if(_0x51be5d){var _0xed171=typeof _0x40b167[_0x53e9('0x1d')]===_0x53e9('0x1e')&&typeof _0x40b167[_0x53e9('0x1f')]===_0x53e9('0x1e');var _0x5c454d=_0x51be5d[_0x53e9('0x20')];var _0x324f90=_0xed171?0x0:_0x40b167[_0x53e9('0x1d')];var _0x27540c=_0xed171?_0x51be5d[_0x53e9('0x20')]:_0x40b167[_0x53e9('0x1d')]+_0x40b167[_0x53e9('0x1f')];var _0x460a23;if(_0x27540c>=_0x5c454d){_0x27540c=_0x5c454d;_0x460a23=0xc8;}else{_0x460a23=0xce;}_0x2c901a[_0x53e9('0x1b')](_0x460a23);return _0x2c901a['set'](_0x53e9('0x21'),_0x324f90+'-'+_0x27540c+'/'+_0x5c454d)[_0x53e9('0x22')](_0x51be5d);}return null;};}function patchUpdates(_0x4e125f){return function(_0x409a1e){try{jsonpatch['apply'](_0x409a1e,_0x4e125f,!![]);}catch(_0x24cdf7){return BPromise['reject'](_0x24cdf7);}return _0x409a1e[_0x53e9('0x23')]();};}function saveUpdates(_0x1d9fff,_0x3d16b8){return function(_0x19df94){if(_0x19df94){return _0x19df94['update'](_0x1d9fff)['then'](function(_0x496595){return _0x496595;});}return null;};}function removeEntity(_0x480d1f,_0x58fb40){return function(_0x444359){if(_0x444359){return _0x444359[_0x53e9('0x24')]()[_0x53e9('0x25')](function(){_0x480d1f[_0x53e9('0x1b')](0xcc)[_0x53e9('0x1c')]();});}};}function handleEntityNotFound(_0x573bfd,_0x3ac45f){return function(_0xeaaf98){if(!_0xeaaf98){_0x573bfd[_0x53e9('0x1a')](0x194);}return _0xeaaf98;};}function handleError(_0x3a31bf,_0x46bf46){_0x46bf46=_0x46bf46||0x1f4;return function(_0x5ce43f){logger[_0x53e9('0x26')](_0x5ce43f[_0x53e9('0x27')]);if(_0x5ce43f['name']){delete _0x5ce43f[_0x53e9('0x28')];}_0x3a31bf['status'](_0x46bf46)[_0x53e9('0x29')](_0x5ce43f);};}function getInteractionUsers(_0x1da5ed,_0x4c88ee){return new BPromise(function(_0x23001a,_0x24ed56){try{if(_0x4c88ee[_0x1da5ed['id']]){_0x1da5ed['Users']=_[_0x53e9('0x2a')](_0x4c88ee[_0x1da5ed['id']],function(_0x56ba5e){return{'id':_0x56ba5e['id'],'fullname':_0x56ba5e['fullname']};});}}catch(_0x5146b6){_0x24ed56(_0x5146b6);}_0x23001a(_0x1da5ed);});}function getInteractionTags(_0x5e5871,_0x3407ad){return new BPromise(function(_0x3cf1fd,_0x458567){try{if(_0x5e5871[_0x53e9('0x2b')]){_0x5e5871[_0x53e9('0x2c')]=[];_0x5e5871[_0x53e9('0x2b')][_0x53e9('0x2d')](',')[_0x53e9('0x2e')](function(_0x55c11c){_0x5e5871[_0x53e9('0x2c')][_0x53e9('0x2f')](_0x3407ad[_0x55c11c]);});}delete _0x5e5871['TagIds'];}catch(_0x216373){_0x458567(_0x216373);}_0x3cf1fd(_0x5e5871);});}function updateFaxInteraction(_0x1606a2,_0x35ccf6,_0x351b42){return new BPromise(function(_0x2c7fb9,_0x41afff){return getInteractionUsers(_0x1606a2,_0x351b42)[_0x53e9('0x25')](function(_0x5601c6){return getInteractionTags(_0x5601c6,_0x35ccf6);})[_0x53e9('0x25')](function(_0x99c99f){_0x2c7fb9(_0x99c99f);})['catch'](function(_0x3a801f){_0x41afff(_0x3a801f);});});}exports[_0x53e9('0x30')]=function(_0x31848f,_0x40417e){var _0x18ae79={},_0x2b7db3={},_0x26a331={'count':0x0,'rows':[]};var _0x1ab63c=_[_0x53e9('0x2a')](db[_0x53e9('0x31')]['rawAttributes'],function(_0x2764c1){return{'name':_0x2764c1[_0x53e9('0x32')],'type':_0x2764c1['type'][_0x53e9('0x33')]};});_0x2b7db3[_0x53e9('0x34')]=_['map'](_0x1ab63c,_0x53e9('0x28'));_0x2b7db3[_0x53e9('0x35')]=_[_0x53e9('0x36')](_0x31848f[_0x53e9('0x35')]);_0x2b7db3['filters']=_['intersection'](_0x2b7db3[_0x53e9('0x34')],_0x2b7db3['query']);_0x18ae79['attributes']=_['intersection'](_0x2b7db3[_0x53e9('0x34')],qs[_0x53e9('0x37')](_0x31848f[_0x53e9('0x35')]['fields']));_0x18ae79[_0x53e9('0x38')]=_0x18ae79[_0x53e9('0x38')][_0x53e9('0x39')]?_0x18ae79[_0x53e9('0x38')]:_0x2b7db3[_0x53e9('0x34')];if(!_0x31848f[_0x53e9('0x35')][_0x53e9('0x3a')](_0x53e9('0x3b'))){_0x18ae79[_0x53e9('0x1f')]=qs['limit'](_0x31848f[_0x53e9('0x35')][_0x53e9('0x1f')]);_0x18ae79[_0x53e9('0x1d')]=qs['offset'](_0x31848f[_0x53e9('0x35')]['offset']);}_0x18ae79[_0x53e9('0x3c')]=qs[_0x53e9('0x3d')](_0x31848f[_0x53e9('0x35')]['sort']);_0x18ae79[_0x53e9('0x3e')]=qs[_0x53e9('0x3f')](_[_0x53e9('0x40')](_0x31848f['query'],_0x2b7db3[_0x53e9('0x3f')]),_0x1ab63c);var _0xd37e67=[];var _0x2c4c0d=squel[_0x53e9('0x41')]()[_0x53e9('0x42')]('id')[_0x53e9('0x42')]('name')[_0x53e9('0x42')](_0x53e9('0x43'))[_0x53e9('0x44')](_0x53e9('0x45'));var _0x527558=squel[_0x53e9('0x41')]()['field'](_0x53e9('0x46'))['field'](_0x53e9('0x47'))[_0x53e9('0x42')](_0x53e9('0x48'))[_0x53e9('0x44')](_0x53e9('0x49'),'ui')[_0x53e9('0x4a')](_0x53e9('0x4b'),'u','u.id\x20=\x20ui.UserId');var _0x42afc3=squel['select']()['from'](_0x53e9('0x4c'),'i')[_0x53e9('0x4a')](_0x53e9('0x4d'),'c',_0x53e9('0x4e'))[_0x53e9('0x4a')]('users','o',_0x53e9('0x4f'))[_0x53e9('0x4a')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')[_0x53e9('0x4a')](_0x53e9('0x50'),'me',_0x53e9('0x51'))[_0x53e9('0x4a')](_0x53e9('0x52'),'it',_0x53e9('0x53'))[_0x53e9('0x4a')](_0x53e9('0x45'),'t',_0x53e9('0x54'));var _0x1f2eb9=squel[_0x53e9('0x55')]();var _0x41e576=[];var _0x4b831d=squel[_0x53e9('0x55')]();var _0xaeb1f3;if(_0x31848f[_0x53e9('0x35')][_0x53e9('0x56')]){_0xaeb1f3=as[_0x53e9('0x57')](_0x31848f[_0x53e9('0x35')][_0x53e9('0x56')]);var _0x3351f2=_0xaeb1f3['sqlOperator'];for(var _0x55e516=0x0;_0x55e516<_0xaeb1f3[_0x53e9('0x58')][_0x53e9('0x39')];_0x55e516++){var _0x363517=_0xaeb1f3[_0x53e9('0x58')][_0x55e516];var _0x353fe0='i';var _0x1c7b54=_[_0x53e9('0x59')](_0x1ab63c,['name',_0x363517['field']]);if(!_0x1c7b54){switch(_0x363517[_0x53e9('0x42')]){case'unreadMessages':if(_0x363517[_0x53e9('0x5a')]==0x1){_0x42afc3[_0x53e9('0x5b')]('`'+_0x363517[_0x53e9('0x42')]+'`\x20=\x200');}else{_0x42afc3[_0x53e9('0x5b')]('`'+_0x363517['field']+_0x53e9('0x5c'));}break;case _0x53e9('0x5d'):if(_0x363517[_0x53e9('0x5e')]===_0x53e9('0x5f')){if(_0x363517[_0x53e9('0x5a')][_0x53e9('0x2d')]('\x20')[_0x53e9('0x39')]>0x1){_0x1f2eb9[_0x3351f2](_0x53e9('0x60'),qs[_0x53e9('0x61')](_0x363517['value']),null);}else{var _0x38f0e2='%'+_0x363517[_0x53e9('0x5a')]+'%';_0x1f2eb9[_0x3351f2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x38f0e2,_0x38f0e2,_0x38f0e2);}}else{_0x1c7b54=_[_0x53e9('0x59')](_0x1ab63c,['name',_0x53e9('0x62')]);_0x363517[_0x53e9('0x42')]='ContactId';_0x3f279e=as['buildExpression'](_0x353fe0,_0x1c7b54[_0x53e9('0x63')],_0x363517);_0x1f2eb9[_0x3351f2](_0x3f279e['text'],_0x3f279e[_0x53e9('0x5a')][_0x53e9('0x64')],_0x3f279e[_0x53e9('0x5a')]['end']);}break;case _0x53e9('0x65'):var _0x5e9929=_0x363517['value']['split'](',')[_0x53e9('0x2a')](function(_0x16e5e1){return Number(_0x16e5e1);});_0x5e9929[_0x53e9('0x2e')](function(_0x465e27){_0x4b831d['or'](_0x53e9('0x66'),'%,'+_0x465e27+',%');});_0x41e576=_['union'](_0x41e576,_0x5e9929);break;case _0x53e9('0x67'):if(_0x363517[_0x53e9('0x5e')]===_0x53e9('0x5f')){_0x1f2eb9[_0x3351f2](_0x53e9('0x68'),'%'+_0x363517[_0x53e9('0x5a')]+'%',null);}else{_0x1c7b54=_[_0x53e9('0x59')](_0x1ab63c,[_0x53e9('0x28'),'UserId']);_0x363517[_0x53e9('0x42')]=_0x53e9('0x69');_0x3f279e=as[_0x53e9('0x6a')](_0x353fe0,_0x1c7b54[_0x53e9('0x63')],_0x363517);_0x1f2eb9[_0x3351f2](_0x3f279e[_0x53e9('0x6b')],_0x3f279e[_0x53e9('0x5a')][_0x53e9('0x64')],_0x3f279e[_0x53e9('0x5a')][_0x53e9('0x1c')]);}break;case'body':_0x3f279e=as[_0x53e9('0x6a')]('me',null,_0x363517);_0x1f2eb9[_0x3351f2](_0x3f279e[_0x53e9('0x6b')],_0x3f279e['value'][_0x53e9('0x64')],_0x3f279e[_0x53e9('0x5a')][_0x53e9('0x1c')]);break;}}else{var _0x3f279e=as[_0x53e9('0x6a')](_0x353fe0,_0x1c7b54[_0x53e9('0x63')],_0x363517);_0x1f2eb9[_0x3351f2](_0x3f279e[_0x53e9('0x6b')],_0x3f279e[_0x53e9('0x5a')][_0x53e9('0x64')],_0x3f279e[_0x53e9('0x5a')]['end']);}}}else{var _0xb7342d=_(_0x31848f[_0x53e9('0x35')])[_0x53e9('0x36')]()[_0x53e9('0x2a')](function(_0x1fec79){return _['some'](_0x1ab63c,[_0x53e9('0x28'),_0x1fec79])?_0x1fec79:undefined;})[_0x53e9('0x6c')]()['value']();if(!_[_0x53e9('0x6d')](_0xb7342d)){_0xb7342d[_0x53e9('0x2e')](function(_0x482f9){if(_0x482f9===_0x53e9('0x6e')){_0x42afc3[_0x53e9('0x3e')](_0x53e9('0x6f'),[][_0x53e9('0x70')](_0x31848f[_0x53e9('0x35')][_0x482f9]));}else if(_0x482f9===_0x53e9('0x71')){var _0x1c6f85=JSON['parse'](_0x31848f[_0x53e9('0x35')][_0x482f9])[_0x53e9('0x72')];var _0x72917f=JSON[_0x53e9('0x73')](_0x31848f[_0x53e9('0x35')][_0x482f9])[_0x53e9('0x74')];_0x42afc3[_0x53e9('0x3e')](_0x53e9('0x75'),_0x1c6f85,_0x72917f);}else{if(_0x31848f[_0x53e9('0x35')][_0x482f9]==='null'){_0x42afc3[_0x53e9('0x3e')]('i.'+_0x482f9+_0x53e9('0x76'));}else{_0x42afc3[_0x53e9('0x3e')]('i.'+_0x482f9+_0x53e9('0x77'),_0x31848f[_0x53e9('0x35')][_0x482f9]);}}});}if(_0x31848f[_0x53e9('0x35')][_0x53e9('0x78')]){if(_0x31848f[_0x53e9('0x35')][_0x53e9('0x78')]==0x1){_0x42afc3[_0x53e9('0x5b')](_0x53e9('0x79'));}else{_0x42afc3[_0x53e9('0x5b')](_0x53e9('0x7a'));}}if(_0x31848f[_0x53e9('0x35')][_0x53e9('0x7b')]){_0x41e576=_[_0x53e9('0x7c')](_0x31848f[_0x53e9('0x35')][_0x53e9('0x7b')])?_0x31848f['query']['tag']:new Array(_0x31848f['query'][_0x53e9('0x7b')]);_0x41e576[_0x53e9('0x2e')](function(_0x376052){_0x4b831d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x376052+',%');});}if(_0x31848f[_0x53e9('0x35')][_0x53e9('0x7d')]){var _0x42fc8c=_0x31848f[_0x53e9('0x35')]['filter'][_0x53e9('0x7e')]('\x5c','\x5c\x5c')[_0x53e9('0x7e')](/'/g,'\x27\x27');if(qs[_0x53e9('0x7f')](_0x42fc8c)){_0x1f2eb9['or'](_0x53e9('0x80'),_0x42fc8c+'%')['or'](_0x53e9('0x81'),_0x42fc8c+'%');}_0x1f2eb9['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x42fc8c+'%');}}_0x42afc3[_0x53e9('0x3e')](_0x1f2eb9);_0x42afc3[_0x53e9('0x82')](_0x53e9('0x83'));var _0x16efbb={'type':db['Sequelize'][_0x53e9('0x84')][_0x53e9('0x85')],'raw':!![]};var _0x3a2fd6=_0x42afc3[_0x53e9('0x86')]();_0x3a2fd6[_0x53e9('0x42')](_0x53e9('0x83'));_0x3a2fd6[_0x53e9('0x42')](_0x53e9('0x87'),_0x53e9('0x88'));if(_0x18ae79[_0x53e9('0x3c')]){_0x18ae79[_0x53e9('0x3c')][_0x53e9('0x2e')](function(_0x2b89b2){var _0x5e4302=_0x2b89b2[0x0]===_0x53e9('0x89')?_0x2b89b2[0x0]:'i.'+_0x2b89b2[0x0];_0x42afc3[_0x53e9('0x3c')](_0x5e4302,_0x2b89b2[0x1]===_0x53e9('0x8a')?![]:!![]);});}if(!_[_0x53e9('0x6d')](_0x41e576)){_0x42afc3[_0x53e9('0x5b')](_0x4b831d);_0x3a2fd6[_0x53e9('0x3e')](_0x53e9('0x8b'),_0x41e576);}BPromise[_0x53e9('0x8c')]()['then'](function(){if(!_0xaeb1f3){if(_0x31848f['query'][_0x53e9('0x6e')])return;_0x3a2fd6[_0x53e9('0x3e')](_0x53e9('0x8d'));_0x42afc3[_0x53e9('0x3e')](_0x53e9('0x8d'));return;}if(_0x31848f[_0x53e9('0x8e')][_0x53e9('0x8f')]!==_0x53e9('0x90'))return;return _0x31848f[_0x53e9('0x8e')][_0x53e9('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21b8ca){if(_[_0x53e9('0x6d')](_0x21b8ca)){_0x3a2fd6['where'](_0x53e9('0x92'));_0x42afc3['where'](_0x53e9('0x92'));}else{_0x3a2fd6[_0x53e9('0x3e')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x21b8ca,'id'));_0x42afc3[_0x53e9('0x3e')](_0x53e9('0x6f'),_[_0x53e9('0x2a')](_0x21b8ca,'id'));}});})['then'](function(){if(_0x31848f[_0x53e9('0x8e')][_0x53e9('0x8f')]===_0x53e9('0x90')&&!_0xaeb1f3&&!_0x31848f[_0x53e9('0x35')][_0x53e9('0x6e')])return[];return db[_0x53e9('0x93')]['query'](_0x3a2fd6['toString'](),_0x16efbb);})[_0x53e9('0x25')](function(_0xb39da6){_0x26a331[_0x53e9('0x20')]=_0xb39da6[_0x53e9('0x39')];if(_0x26a331[_0x53e9('0x20')]===0x0)return[];return db[_0x53e9('0x93')][_0x53e9('0x35')](_0x2c4c0d['toString'](),_0x16efbb)[_0x53e9('0x25')](function(_0x3eac1f){_0xd37e67=_['keyBy'](_0x3eac1f,'id');_0x16efbb=_[_0x53e9('0x94')](_0x16efbb,{'model':db[_0x53e9('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31848f['query']['fields']){_0x18ae79[_0x53e9('0x38')][_0x53e9('0x2e')](function(_0x43c1ab){_0x42afc3[_0x53e9('0x42')]('i.'+_0x43c1ab);});}else{_0x42afc3[_0x53e9('0x42')](_0x53e9('0x87'),'unreadMessages');_0x42afc3['field']('a.key','Account.key');_0x42afc3[_0x53e9('0x42')]('a.mandatoryDisposition',_0x53e9('0x95'));_0x42afc3[_0x53e9('0x42')](_0x53e9('0x96'),_0x53e9('0x89'));_0x42afc3['field'](_0x53e9('0x97'));_0x42afc3['field'](_0x53e9('0x98'),_0x53e9('0x99'));_0x42afc3[_0x53e9('0x42')](_0x53e9('0x9a'),_0x53e9('0x9b'));_0x42afc3['field']('c.email','Contact.email');_0x42afc3[_0x53e9('0x42')](_0x53e9('0x9c'),_0x53e9('0x9d'));_0x42afc3[_0x53e9('0x42')](_0x53e9('0x9e'),_0x53e9('0x9f'));_0x42afc3[_0x53e9('0x42')]('c.fax',_0x53e9('0xa0'));_0x42afc3[_0x53e9('0x42')](_0x53e9('0xa1'),_0x53e9('0xa2'));_0x42afc3[_0x53e9('0x42')]('o.internal',_0x53e9('0xa3'));_0x42afc3[_0x53e9('0x42')](_0x53e9('0xa4'),_0x53e9('0x2b'));}if(_0x18ae79['limit'])_0x42afc3['limit'](_0x18ae79[_0x53e9('0x1f')]);if(_0x18ae79['offset'])_0x42afc3[_0x53e9('0x1d')](_0x18ae79['offset']);return db[_0x53e9('0x93')][_0x53e9('0x35')](_0x42afc3['toString'](),_0x16efbb);})[_0x53e9('0x25')](function(_0x2b4211){if(_0x2b4211[_0x53e9('0x39')]>0x0)_0x527558[_0x53e9('0x3e')](_0x53e9('0xa5'),_['map'](_0x2b4211,'id'));return db[_0x53e9('0x93')][_0x53e9('0x35')](_0x527558[_0x53e9('0xa6')](),_0x16efbb)[_0x53e9('0x25')](function(_0x19743e){var _0x1cbe46=_[_0x53e9('0xa7')](_0x19743e,_0x53e9('0xa8'));var _0x2ff6e8=[];_0x2b4211['forEach'](function(_0x22f2ed){_0x2ff6e8[_0x53e9('0x2f')](updateFaxInteraction(_0x22f2ed,_0xd37e67,_0x1cbe46));});return BPromise[_0x53e9('0xa9')](_0x2ff6e8);});});})[_0x53e9('0x25')](function(_0x522e64){_0x26a331['rows']=_0x522e64;return _0x26a331;})[_0x53e9('0x25')](respondWithFilteredResult(_0x40417e,_0x18ae79))[_0x53e9('0xaa')](handleError(_0x40417e,null));};exports[_0x53e9('0xab')]=function(_0x595e02,_0x509fd1){var _0x2de9a5={'raw':![],'where':{'id':_0x595e02[_0x53e9('0xac')]['id']}},_0x1fe27d={};_0x1fe27d[_0x53e9('0x34')]=_[_0x53e9('0x36')](db[_0x53e9('0x31')][_0x53e9('0xad')]);_0x1fe27d['query']=_[_0x53e9('0x36')](_0x595e02[_0x53e9('0x35')]);_0x1fe27d[_0x53e9('0x3f')]=_['intersection'](_0x1fe27d[_0x53e9('0x34')],_0x1fe27d[_0x53e9('0x35')]);_0x2de9a5[_0x53e9('0x38')]=_[_0x53e9('0xae')](_0x1fe27d[_0x53e9('0x34')],qs[_0x53e9('0x37')](_0x595e02[_0x53e9('0x35')][_0x53e9('0x37')]));_0x2de9a5['attributes']=_0x2de9a5[_0x53e9('0x38')][_0x53e9('0x39')]?_0x2de9a5[_0x53e9('0x38')]:_0x1fe27d['model'];if(_0x595e02['query'][_0x53e9('0xaf')]){_0x2de9a5['include']=[{'all':!![]}];}_0x2de9a5=_[_0x53e9('0x94')]({},_0x2de9a5,_0x595e02[_0x53e9('0xb0')]);return db[_0x53e9('0x31')][_0x53e9('0x59')](_0x2de9a5)[_0x53e9('0x25')](handleEntityNotFound(_0x509fd1,null))[_0x53e9('0x25')](respondWithResult(_0x509fd1,null))[_0x53e9('0xaa')](handleError(_0x509fd1,null));};exports[_0x53e9('0xb1')]=function(_0x21387a,_0x1a09c2){return db[_0x53e9('0x31')][_0x53e9('0xb1')](_0x21387a[_0x53e9('0xb2')],{})['then'](respondWithResult(_0x1a09c2,0xc9))[_0x53e9('0xaa')](handleError(_0x1a09c2,null));};exports['update']=function(_0x37b633,_0x4eccb7){if(_0x37b633[_0x53e9('0xb2')]['id']){delete _0x37b633[_0x53e9('0xb2')]['id'];}return db[_0x53e9('0x31')][_0x53e9('0x59')]({'where':{'id':_0x37b633['params']['id']}})[_0x53e9('0x25')](handleEntityNotFound(_0x4eccb7,null))[_0x53e9('0x25')](saveUpdates(_0x37b633[_0x53e9('0xb2')],null))[_0x53e9('0x25')](respondWithResult(_0x4eccb7,null))[_0x53e9('0xaa')](handleError(_0x4eccb7,null));};exports[_0x53e9('0x24')]=function(_0x259883,_0x2e347a){return db[_0x53e9('0x31')][_0x53e9('0x59')]({'where':{'id':_0x259883[_0x53e9('0xac')]['id']}})[_0x53e9('0x25')](handleEntityNotFound(_0x2e347a,null))[_0x53e9('0x25')](removeEntity(_0x2e347a,null))[_0x53e9('0xaa')](handleError(_0x2e347a,null));};exports[_0x53e9('0xb3')]=function(_0x215816,_0x10a721){return db[_0x53e9('0x31')][_0x53e9('0xb3')]()['then'](respondWithResult(_0x10a721,null))['catch'](handleError(_0x10a721,null));};exports[_0x53e9('0xb4')]=function(_0xbf0d60,_0x1a9e13,_0x58d04c){return db[_0x53e9('0xb5')][_0x53e9('0x59')]({'where':{'id':_0xbf0d60[_0x53e9('0xac')]['id']}})[_0x53e9('0x25')](handleEntityNotFound(_0x1a9e13,null))[_0x53e9('0x25')](function(_0x405568){if(_0x405568){return _0x405568['addMessage'](_0xbf0d60[_0x53e9('0xb2')][_0x53e9('0xb6')],_[_0x53e9('0xb7')](_0xbf0d60['body'],[_0x53e9('0xb6'),'id'])||{});}})[_0x53e9('0x25')](respondWithResult(_0x1a9e13,null))[_0x53e9('0xaa')](handleError(_0x1a9e13,null));};exports[_0x53e9('0xb8')]=function(_0x2d7ae0,_0x3de7b9,_0x512a40){var _0x1b6832={'raw':![],'where':{}};var _0x55b126={};var _0x35f9c5={'count':0x0,'rows':[]};return db[_0x53e9('0x31')][_0x53e9('0xb9')]({'where':{'id':_0x2d7ae0['params']['id']}})[_0x53e9('0x25')](handleEntityNotFound(_0x3de7b9,null))[_0x53e9('0x25')](function(_0x55221e){if(_0x55221e){_0x55b126[_0x53e9('0x34')]=_[_0x53e9('0x36')](db[_0x53e9('0xb5')][_0x53e9('0xad')]);_0x55b126[_0x53e9('0x35')]=_[_0x53e9('0x36')](_0x2d7ae0[_0x53e9('0x35')]);_0x55b126[_0x53e9('0x3f')]=_[_0x53e9('0xae')](_0x55b126[_0x53e9('0x34')],_0x55b126[_0x53e9('0x35')]);_0x1b6832['attributes']=_[_0x53e9('0xae')](_0x55b126[_0x53e9('0x34')],qs[_0x53e9('0x37')](_0x2d7ae0[_0x53e9('0x35')]['fields']));_0x1b6832[_0x53e9('0x38')]=_0x1b6832[_0x53e9('0x38')]['length']?_0x1b6832[_0x53e9('0x38')]:_0x55b126['model'];if(!_0x2d7ae0[_0x53e9('0x35')]['hasOwnProperty'](_0x53e9('0x3b'))){_0x1b6832[_0x53e9('0x1f')]=qs[_0x53e9('0x1f')](_0x2d7ae0[_0x53e9('0x35')]['limit']);_0x1b6832[_0x53e9('0x1d')]=qs[_0x53e9('0x1d')](_0x2d7ae0[_0x53e9('0x35')][_0x53e9('0x1d')]);}_0x1b6832[_0x53e9('0x3c')]=qs['sort'](_0x2d7ae0['query'][_0x53e9('0x3d')]);_0x1b6832[_0x53e9('0x3e')]=qs[_0x53e9('0x3f')](_[_0x53e9('0x40')](_0x2d7ae0[_0x53e9('0x35')],_0x55b126['filters']));_0x1b6832['where'][_0x53e9('0xa8')]=_0x55221e['id'];if(_0x2d7ae0[_0x53e9('0x35')][_0x53e9('0x7d')]){_0x1b6832[_0x53e9('0x3e')]=_[_0x53e9('0x94')](_0x1b6832[_0x53e9('0x3e')],{'$or':_['map'](_0x1b6832[_0x53e9('0x38')],function(_0x211f45){var _0x3e4cd6={};_0x3e4cd6[_0x211f45]={'$like':'%'+_0x2d7ae0[_0x53e9('0x35')][_0x53e9('0x7d')]+'%'};return _0x3e4cd6;})});}if(_0x2d7ae0[_0x53e9('0x35')][_0x53e9('0x72')]){var _0x4c57a8=_0x2d7ae0[_0x53e9('0x35')][_0x53e9('0x72')][_0x53e9('0x2d')](',');var _0x10343f={};_0x10343f[_0x4c57a8[0x0]]={'$gte':moment(_0x4c57a8[0x1])[_0x53e9('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1b6832['where']=_[_0x53e9('0x94')](_0x1b6832[_0x53e9('0x3e')],_0x10343f);}_0x1b6832=_[_0x53e9('0x94')]({},_0x1b6832,_0x2d7ae0['options']);return db[_0x53e9('0xb5')][_0x53e9('0x20')]({'where':_0x1b6832[_0x53e9('0x3e')]})[_0x53e9('0x25')](function(_0xb3a5f0){_0x35f9c5[_0x53e9('0x20')]=_0xb3a5f0;if(_0x2d7ae0[_0x53e9('0x35')][_0x53e9('0xaf')]){_0x1b6832[_0x53e9('0xbb')]=[{'all':!![]}];}return db[_0x53e9('0xb5')][_0x53e9('0xbc')](_0x1b6832);})['then'](function(_0x4b19b8){_0x35f9c5['rows']=_0x4b19b8;return _0x35f9c5;});}})[_0x53e9('0x25')](respondWithFilteredResult(_0x3de7b9,_0x1b6832))[_0x53e9('0xaa')](handleError(_0x3de7b9,null));};exports['addTags']=function(_0x42a0e4,_0x291902,_0x320f96){return db[_0x53e9('0x31')][_0x53e9('0x59')]({'where':{'id':_0x42a0e4['params']['id']}})[_0x53e9('0x25')](handleEntityNotFound(_0x291902,null))[_0x53e9('0x25')](function(_0xf28f5d){if(_0xf28f5d){return _0xf28f5d[_0x53e9('0xbd')](_0x42a0e4[_0x53e9('0xb2')][_0x53e9('0xb6')],_[_0x53e9('0xb7')](_0x42a0e4[_0x53e9('0xb2')],['ids','id'])||{})['spread'](function(){return db[_0x53e9('0x65')][_0x53e9('0xbc')]({'attributes':['id',_0x53e9('0x28'),_0x53e9('0x43')],'where':{'id':_0x42a0e4[_0x53e9('0xb2')][_0x53e9('0xb6')]}});})[_0x53e9('0x25')](function(_0x1b7a6){socket[_0x53e9('0xbe')]('faxInteractionTags:save',{'id':Number(_0x42a0e4[_0x53e9('0xac')]['id']),'tags':_0x1b7a6||[]});return{'id':Number(_0x42a0e4[_0x53e9('0xac')]['id']),'tags':_0x1b7a6||[]};});}})['then'](respondWithResult(_0x291902,null))['catch'](handleError(_0x291902,null));};exports[_0x53e9('0xbf')]=function(_0x3923ca,_0x49b873,_0x5587d7){return db['FaxInteraction'][_0x53e9('0x59')]({'where':{'id':_0x3923ca[_0x53e9('0xac')]['id']}})[_0x53e9('0x25')](handleEntityNotFound(_0x49b873,null))['then'](function(_0x416d21){if(_0x416d21){return _0x416d21[_0x53e9('0xbf')](_0x3923ca[_0x53e9('0x35')][_0x53e9('0xb6')]);}})[_0x53e9('0x25')](respondWithStatusCode(_0x49b873,null))[_0x53e9('0xaa')](handleError(_0x49b873,null));};exports[_0x53e9('0xc0')]=function(_0x1ed991,_0x3dde59){var _0x12b248=moment()[_0x53e9('0xc1')]()[_0x53e9('0xa6')]();var _0xb5685e=path['join'](config[_0x53e9('0xc2')],_0x53e9('0xc3'),'files','tmp');var _0xc923a8=path[_0x53e9('0xc4')](config[_0x53e9('0xc2')],_0x53e9('0xc3'),_0x53e9('0xc5'),_0x53e9('0xc6'));var _0x4688c4=path['join'](_0xb5685e,_0x12b248);var _0x3660fa=util[_0x53e9('0xba')](_0x53e9('0xc7'),_0x1ed991['params']['id'],_0x12b248);var _0x388720=path[_0x53e9('0xc4')](_0xb5685e,_0x3660fa);var _0x223cb1=[];_0x223cb1[_0x53e9('0x2f')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x515aaf=[{'model':db[_0x53e9('0xb5')],'as':_0x53e9('0xc8'),'attributes':['id',_0x53e9('0xb2'),_0x53e9('0x71')],'include':_0x223cb1}];return db[_0x53e9('0x31')][_0x53e9('0x59')]({'where':{'id':_0x1ed991[_0x53e9('0xac')]['id']},'include':_0x515aaf})['then'](handleEntityNotFound(_0x3dde59,null))[_0x53e9('0x25')](function(_0x419b14){if(_0x419b14&&_0x419b14[_0x53e9('0xc8')]){var _0x3a0d4f=_0x419b14[_0x53e9('0xc9')]({'plain':!![]});fs['mkdirSync'](_0x4688c4);for(var _0x2abfe8=0x0;_0x2abfe8<_0x3a0d4f[_0x53e9('0xc8')][_0x53e9('0x39')];_0x2abfe8++){var _0x25cde9=_0x3a0d4f['Messages'][_0x2abfe8][_0x53e9('0xca')];if(_0x25cde9){var _0x2e62c6=path[_0x53e9('0xc4')](_0xc923a8,_0x25cde9[_0x53e9('0xcb')]);if(fs['existsSync'](_0x2e62c6)){fs[_0x53e9('0xcc')](_0x2e62c6)['pipe'](fs[_0x53e9('0xcd')](path[_0x53e9('0xc4')](_0x4688c4,_0x25cde9[_0x53e9('0xcb')])));}}}return BPromise[_0x53e9('0x8c')]()[_0x53e9('0x25')](function(){return new BPromise(function(_0x3c69b5,_0x1d5db1){zipdir(_0x4688c4,{'saveTo':_0x388720},function(_0x574000,_0x4b9c95){if(_0x574000)return _0x1d5db1(_0x574000);return _0x3c69b5(_0x4b9c95);});})[_0x53e9('0x25')](function(){return new BPromise(function(_0x5d42f7,_0x5a5b77){rimraf(_0x4688c4,function(_0x39421b){if(_0x39421b)_0x5a5b77(_0x39421b);return _0x5d42f7();});});})[_0x53e9('0x25')](function(){return _0x3dde59[_0x53e9('0xc0')](_0x388720,_0x3660fa,function(_0xe5aafd){if(_0xe5aafd){console[_0x53e9('0xce')]('err',_0xe5aafd);}else{fs[_0x53e9('0xcf')](_0x388720);}});});});}else{return _0x3dde59['sendStatus'](0xc8);}})['catch'](handleError(_0x3dde59,null));}; \ No newline at end of file +var _0xa2d0=['Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','rawAttributes','includeAll','merge','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','fax_messages','it.FaxInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','compact','FaxAccountId','where','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','FaxInteraction','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xa2d0,0x10a));var _0x0a2d=function(_0x54c0bb,_0x4a3965){_0x54c0bb=_0x54c0bb-0x0;var _0x480afe=_0xa2d0[_0x54c0bb];return _0x480afe;};'use strict';var emlformat=require(_0x0a2d('0x0'));var rimraf=require(_0x0a2d('0x1'));var zipdir=require(_0x0a2d('0x2'));var jsonpatch=require(_0x0a2d('0x3'));var rp=require(_0x0a2d('0x4'));var moment=require(_0x0a2d('0x5'));var BPromise=require(_0x0a2d('0x6'));var Mustache=require(_0x0a2d('0x7'));var util=require('util');var path=require(_0x0a2d('0x8'));var sox=require(_0x0a2d('0x9'));var csv=require(_0x0a2d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a2d('0xb'));var _=require('lodash');var squel=require(_0x0a2d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a2d('0xd'));var Papa=require(_0x0a2d('0xe'));var Redis=require(_0x0a2d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0a2d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a2d('0x11'));var logger=require(_0x0a2d('0x12'))(_0x0a2d('0x13'));var utils=require(_0x0a2d('0x14'));var config=require(_0x0a2d('0x15'));var licenseUtil=require(_0x0a2d('0x16'));var db=require(_0x0a2d('0x17'))['db'];config[_0x0a2d('0x18')]=_[_0x0a2d('0x19')](config[_0x0a2d('0x18')],{'host':_0x0a2d('0x1a'),'port':0x18eb});var socket=require(_0x0a2d('0x1b'))(new Redis(config[_0x0a2d('0x18')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x513575,_0x4016cd){_0x4016cd=_0x4016cd||0xcc;return function(_0x2df414){if(_0x2df414){return _0x513575[_0x0a2d('0x1c')](_0x4016cd);}return _0x513575[_0x0a2d('0x1d')](_0x4016cd)[_0x0a2d('0x1e')]();};}function respondWithResult(_0x4e695b,_0x391cf3){_0x391cf3=_0x391cf3||0xc8;return function(_0xb411de){if(_0xb411de){return _0x4e695b[_0x0a2d('0x1d')](_0x391cf3)[_0x0a2d('0x1f')](_0xb411de);}};}function respondWithFilteredResult(_0x4a3228,_0x15c7e8){return function(_0x278587){if(_0x278587){var _0x106169=typeof _0x15c7e8[_0x0a2d('0x20')]===_0x0a2d('0x21')&&typeof _0x15c7e8[_0x0a2d('0x22')]===_0x0a2d('0x21');var _0x116c2a=_0x278587[_0x0a2d('0x23')];var _0xaf64f6=_0x106169?0x0:_0x15c7e8[_0x0a2d('0x20')];var _0x171aab=_0x106169?_0x278587[_0x0a2d('0x23')]:_0x15c7e8['offset']+_0x15c7e8[_0x0a2d('0x22')];var _0x1beb6e;if(_0x171aab>=_0x116c2a){_0x171aab=_0x116c2a;_0x1beb6e=0xc8;}else{_0x1beb6e=0xce;}_0x4a3228[_0x0a2d('0x1d')](_0x1beb6e);return _0x4a3228[_0x0a2d('0x24')]('Content-Range',_0xaf64f6+'-'+_0x171aab+'/'+_0x116c2a)['json'](_0x278587);}return null;};}function patchUpdates(_0x2cac73){return function(_0x586384){try{jsonpatch['apply'](_0x586384,_0x2cac73,!![]);}catch(_0x1a47cb){return BPromise[_0x0a2d('0x25')](_0x1a47cb);}return _0x586384[_0x0a2d('0x26')]();};}function saveUpdates(_0x5d88ae,_0x253259){return function(_0x9a2125){if(_0x9a2125){return _0x9a2125[_0x0a2d('0x27')](_0x5d88ae)[_0x0a2d('0x28')](function(_0x6290f5){return _0x6290f5;});}return null;};}function removeEntity(_0x217f21,_0x221f2d){return function(_0x3d05ba){if(_0x3d05ba){return _0x3d05ba['destroy']()[_0x0a2d('0x28')](function(){_0x217f21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26cbe8,_0x4c339c){return function(_0x59dcb1){if(!_0x59dcb1){_0x26cbe8[_0x0a2d('0x1c')](0x194);}return _0x59dcb1;};}function handleError(_0x370e32,_0x3538bb){_0x3538bb=_0x3538bb||0x1f4;return function(_0x1d343e){logger[_0x0a2d('0x29')](_0x1d343e[_0x0a2d('0x2a')]);if(_0x1d343e[_0x0a2d('0x2b')]){delete _0x1d343e[_0x0a2d('0x2b')];}_0x370e32[_0x0a2d('0x1d')](_0x3538bb)['send'](_0x1d343e);};}function getInteractionUsers(_0x11b9c0,_0x276423){return new BPromise(function(_0x2011ae,_0x3be1b5){try{if(_0x276423[_0x11b9c0['id']]){_0x11b9c0[_0x0a2d('0x2c')]=_['map'](_0x276423[_0x11b9c0['id']],function(_0xddd0cb){return{'id':_0xddd0cb['id'],'fullname':_0xddd0cb[_0x0a2d('0x2d')]};});}}catch(_0x767b84){_0x3be1b5(_0x767b84);}_0x2011ae(_0x11b9c0);});}function getInteractionTags(_0x2a26a6,_0x571560){return new BPromise(function(_0x49dd02,_0x326709){try{if(_0x2a26a6[_0x0a2d('0x2e')]){_0x2a26a6[_0x0a2d('0x2f')]=[];_0x2a26a6['TagIds'][_0x0a2d('0x30')](',')[_0x0a2d('0x31')](function(_0x599070){_0x2a26a6[_0x0a2d('0x2f')][_0x0a2d('0x32')](_0x571560[_0x599070]);});}delete _0x2a26a6[_0x0a2d('0x2e')];}catch(_0x3c8e18){_0x326709(_0x3c8e18);}_0x49dd02(_0x2a26a6);});}function updateFaxInteraction(_0x4ce0dd,_0x2800bb,_0x300f77){return new BPromise(function(_0x21ba92,_0x29c7c9){return getInteractionUsers(_0x4ce0dd,_0x300f77)['then'](function(_0x1ecaab){return getInteractionTags(_0x1ecaab,_0x2800bb);})[_0x0a2d('0x28')](function(_0x352afc){_0x21ba92(_0x352afc);})[_0x0a2d('0x33')](function(_0x988479){_0x29c7c9(_0x988479);});});}exports['index']=function(_0x14e6f1,_0x2659f8){var _0x1030e8={},_0x306c83={},_0x17ea8b={'count':0x0,'rows':[]};var _0x1685a8=_[_0x0a2d('0x34')](db['FaxInteraction']['rawAttributes'],function(_0x1f08b8){return{'name':_0x1f08b8[_0x0a2d('0x35')],'type':_0x1f08b8['type'][_0x0a2d('0x36')]};});_0x306c83[_0x0a2d('0x37')]=_[_0x0a2d('0x34')](_0x1685a8,_0x0a2d('0x2b'));_0x306c83[_0x0a2d('0x38')]=_[_0x0a2d('0x39')](_0x14e6f1[_0x0a2d('0x38')]);_0x306c83[_0x0a2d('0x3a')]=_[_0x0a2d('0x3b')](_0x306c83['model'],_0x306c83[_0x0a2d('0x38')]);_0x1030e8[_0x0a2d('0x3c')]=_[_0x0a2d('0x3b')](_0x306c83[_0x0a2d('0x37')],qs[_0x0a2d('0x3d')](_0x14e6f1[_0x0a2d('0x38')][_0x0a2d('0x3d')]));_0x1030e8[_0x0a2d('0x3c')]=_0x1030e8[_0x0a2d('0x3c')][_0x0a2d('0x3e')]?_0x1030e8[_0x0a2d('0x3c')]:_0x306c83[_0x0a2d('0x37')];if(!_0x14e6f1[_0x0a2d('0x38')][_0x0a2d('0x3f')](_0x0a2d('0x40'))){_0x1030e8['limit']=qs['limit'](_0x14e6f1['query'][_0x0a2d('0x22')]);_0x1030e8['offset']=qs[_0x0a2d('0x20')](_0x14e6f1[_0x0a2d('0x38')]['offset']);}_0x1030e8[_0x0a2d('0x41')]=qs[_0x0a2d('0x42')](_0x14e6f1['query'][_0x0a2d('0x42')]);_0x1030e8['where']=qs[_0x0a2d('0x3a')](_[_0x0a2d('0x43')](_0x14e6f1[_0x0a2d('0x38')],_0x306c83[_0x0a2d('0x3a')]),_0x1685a8);var _0x543e25=[];var _0x23d5d4=squel[_0x0a2d('0x44')]()[_0x0a2d('0x45')]('id')[_0x0a2d('0x45')](_0x0a2d('0x2b'))['field'](_0x0a2d('0x46'))[_0x0a2d('0x47')]('tools_tags');var _0xe4eafb=squel['select']()[_0x0a2d('0x45')](_0x0a2d('0x48'))[_0x0a2d('0x45')]('u.fullname')[_0x0a2d('0x45')](_0x0a2d('0x49'))['from'](_0x0a2d('0x4a'),'ui')[_0x0a2d('0x4b')](_0x0a2d('0x4c'),'u',_0x0a2d('0x4d'));var _0x410722=squel['select']()[_0x0a2d('0x47')](_0x0a2d('0x4e'),'i')[_0x0a2d('0x4b')](_0x0a2d('0x4f'),'c',_0x0a2d('0x50'))[_0x0a2d('0x4b')](_0x0a2d('0x4c'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x0a2d('0x51'),'a','a.id\x20=\x20i.FaxAccountId')[_0x0a2d('0x4b')](_0x0a2d('0x52'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x0a2d('0x4b')]('fax_interaction_has_tags','it',_0x0a2d('0x53'))[_0x0a2d('0x4b')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x16e1de=squel['expr']();var _0x517825=[];var _0x197846=squel[_0x0a2d('0x54')]();var _0x5ef128;if(_0x14e6f1[_0x0a2d('0x38')]['search']){_0x5ef128=as[_0x0a2d('0x55')](_0x14e6f1[_0x0a2d('0x38')]['search']);var _0x15c2f2=_0x5ef128[_0x0a2d('0x56')];for(var _0x587d55=0x0;_0x587d55<_0x5ef128[_0x0a2d('0x57')]['length'];_0x587d55++){var _0x3d30f3=_0x5ef128[_0x0a2d('0x57')][_0x587d55];var _0x21190f='i';var _0x4edf72=_[_0x0a2d('0x58')](_0x1685a8,['name',_0x3d30f3[_0x0a2d('0x45')]]);if(!_0x4edf72){switch(_0x3d30f3[_0x0a2d('0x45')]){case _0x0a2d('0x59'):if(_0x3d30f3[_0x0a2d('0x5a')]==0x1){_0x410722[_0x0a2d('0x5b')]('`'+_0x3d30f3[_0x0a2d('0x45')]+_0x0a2d('0x5c'));}else{_0x410722[_0x0a2d('0x5b')]('`'+_0x3d30f3[_0x0a2d('0x45')]+_0x0a2d('0x5d'));}break;case _0x0a2d('0x5e'):if(_0x3d30f3[_0x0a2d('0x5f')]===_0x0a2d('0x60')){if(_0x3d30f3[_0x0a2d('0x5a')][_0x0a2d('0x30')]('\x20')[_0x0a2d('0x3e')]>0x1){_0x16e1de[_0x15c2f2](_0x0a2d('0x61'),qs[_0x0a2d('0x62')](_0x3d30f3[_0x0a2d('0x5a')]),null);}else{var _0x2bfaba='%'+_0x3d30f3[_0x0a2d('0x5a')]+'%';_0x16e1de[_0x15c2f2](_0x0a2d('0x63'),_0x2bfaba,_0x2bfaba,_0x2bfaba);}}else{_0x4edf72=_['find'](_0x1685a8,['name',_0x0a2d('0x64')]);_0x3d30f3[_0x0a2d('0x45')]=_0x0a2d('0x64');_0x16cdd9=as['buildExpression'](_0x21190f,_0x4edf72[_0x0a2d('0x65')],_0x3d30f3);_0x16e1de[_0x15c2f2](_0x16cdd9[_0x0a2d('0x66')],_0x16cdd9[_0x0a2d('0x5a')][_0x0a2d('0x67')],_0x16cdd9[_0x0a2d('0x5a')][_0x0a2d('0x1e')]);}break;case _0x0a2d('0x68'):var _0xeb6fc7=_0x3d30f3[_0x0a2d('0x5a')][_0x0a2d('0x30')](',')[_0x0a2d('0x34')](function(_0x3d94d4){return Number(_0x3d94d4);});_0xeb6fc7[_0x0a2d('0x31')](function(_0x2a2ad0){_0x197846['or'](_0x0a2d('0x69'),'%,'+_0x2a2ad0+',%');});_0x517825=_[_0x0a2d('0x6a')](_0x517825,_0xeb6fc7);break;case'User':if(_0x3d30f3['operator']==='$substring'){_0x16e1de[_0x15c2f2](_0x0a2d('0x6b'),'%'+_0x3d30f3[_0x0a2d('0x5a')]+'%',null);}else{_0x4edf72=_[_0x0a2d('0x58')](_0x1685a8,[_0x0a2d('0x2b'),'UserId']);_0x3d30f3[_0x0a2d('0x45')]=_0x0a2d('0x6c');_0x16cdd9=as[_0x0a2d('0x6d')](_0x21190f,_0x4edf72[_0x0a2d('0x65')],_0x3d30f3);_0x16e1de[_0x15c2f2](_0x16cdd9[_0x0a2d('0x66')],_0x16cdd9['value'][_0x0a2d('0x67')],_0x16cdd9[_0x0a2d('0x5a')]['end']);}break;case _0x0a2d('0x6e'):_0x16cdd9=as[_0x0a2d('0x6d')]('me',null,_0x3d30f3);_0x16e1de[_0x15c2f2](_0x16cdd9['text'],_0x16cdd9['value'][_0x0a2d('0x67')],_0x16cdd9[_0x0a2d('0x5a')]['end']);break;}}else{var _0x16cdd9=as[_0x0a2d('0x6d')](_0x21190f,_0x4edf72[_0x0a2d('0x65')],_0x3d30f3);_0x16e1de[_0x15c2f2](_0x16cdd9[_0x0a2d('0x66')],_0x16cdd9['value'][_0x0a2d('0x67')],_0x16cdd9[_0x0a2d('0x5a')][_0x0a2d('0x1e')]);}}}else{var _0x25199b=_(_0x14e6f1['query'])[_0x0a2d('0x39')]()[_0x0a2d('0x34')](function(_0x59372a){return _['some'](_0x1685a8,['name',_0x59372a])?_0x59372a:undefined;})[_0x0a2d('0x6f')]()[_0x0a2d('0x5a')]();if(!_['isEmpty'](_0x25199b)){_0x25199b['forEach'](function(_0xf40ed8){if(_0xf40ed8===_0x0a2d('0x70')){_0x410722[_0x0a2d('0x71')]('i.FaxAccountId\x20IN\x20?',[][_0x0a2d('0x72')](_0x14e6f1[_0x0a2d('0x38')][_0xf40ed8]));}else if(_0xf40ed8===_0x0a2d('0x73')){var _0x458590=JSON[_0x0a2d('0x74')](_0x14e6f1[_0x0a2d('0x38')][_0xf40ed8])['$gte'];var _0x263309=JSON[_0x0a2d('0x74')](_0x14e6f1[_0x0a2d('0x38')][_0xf40ed8])[_0x0a2d('0x75')];_0x410722[_0x0a2d('0x71')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x458590,_0x263309);}else{if(_0x14e6f1[_0x0a2d('0x38')][_0xf40ed8]==='null'){_0x410722[_0x0a2d('0x71')]('i.'+_0xf40ed8+_0x0a2d('0x76'));}else{_0x410722[_0x0a2d('0x71')]('i.'+_0xf40ed8+_0x0a2d('0x77'),_0x14e6f1[_0x0a2d('0x38')][_0xf40ed8]);}}});}if(_0x14e6f1['query']['read']){if(_0x14e6f1[_0x0a2d('0x38')][_0x0a2d('0x78')]==0x1){_0x410722['having'](_0x0a2d('0x79'));}else{_0x410722[_0x0a2d('0x5b')](_0x0a2d('0x7a'));}}if(_0x14e6f1[_0x0a2d('0x38')][_0x0a2d('0x7b')]){_0x517825=_[_0x0a2d('0x7c')](_0x14e6f1['query'][_0x0a2d('0x7b')])?_0x14e6f1['query'][_0x0a2d('0x7b')]:new Array(_0x14e6f1['query'][_0x0a2d('0x7b')]);_0x517825[_0x0a2d('0x31')](function(_0x4bb1e2){_0x197846['or'](_0x0a2d('0x69'),'%,'+_0x4bb1e2+',%');});}if(_0x14e6f1['query'][_0x0a2d('0x7d')]){var _0x474357=_0x14e6f1['query'][_0x0a2d('0x7d')]['replace']('\x5c','\x5c\x5c')[_0x0a2d('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a2d('0x7f')](_0x474357)){_0x16e1de['or']('i.id\x20LIKE\x20?',_0x474357+'%')['or'](_0x0a2d('0x80'),_0x474357+'%');}_0x16e1de['or'](_0x0a2d('0x81'),_0x474357+'%');}}_0x410722[_0x0a2d('0x71')](_0x16e1de);_0x410722['group'](_0x0a2d('0x82'));var _0x276ad9={'type':db[_0x0a2d('0x83')]['QueryTypes'][_0x0a2d('0x84')],'raw':!![]};var _0x4bc7f4=_0x410722[_0x0a2d('0x85')]();_0x4bc7f4[_0x0a2d('0x45')](_0x0a2d('0x82'));_0x4bc7f4[_0x0a2d('0x45')](_0x0a2d('0x86'),_0x0a2d('0x59'));if(_0x1030e8[_0x0a2d('0x41')]){_0x1030e8[_0x0a2d('0x41')]['forEach'](function(_0x4fb7ec){var _0x592d5a=_0x4fb7ec[0x0]===_0x0a2d('0x87')?_0x4fb7ec[0x0]:'i.'+_0x4fb7ec[0x0];_0x410722['order'](_0x592d5a,_0x4fb7ec[0x1]===_0x0a2d('0x88')?![]:!![]);});}if(!_['isEmpty'](_0x517825)){_0x410722[_0x0a2d('0x5b')](_0x197846);_0x4bc7f4[_0x0a2d('0x71')](_0x0a2d('0x89'),_0x517825);}BPromise[_0x0a2d('0x8a')]()[_0x0a2d('0x28')](function(){if(!_0x5ef128){if(_0x14e6f1[_0x0a2d('0x38')][_0x0a2d('0x70')])return;_0x4bc7f4['where'](_0x0a2d('0x8b'));_0x410722['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x14e6f1[_0x0a2d('0x8c')][_0x0a2d('0x8d')]!==_0x0a2d('0x8e'))return;return _0x14e6f1['user'][_0x0a2d('0x8f')]({'attributes':['id'],'raw':!![]})[_0x0a2d('0x28')](function(_0x1d341e){if(_[_0x0a2d('0x90')](_0x1d341e)){_0x4bc7f4[_0x0a2d('0x71')](_0x0a2d('0x91'));_0x410722[_0x0a2d('0x71')](_0x0a2d('0x91'));}else{_0x4bc7f4[_0x0a2d('0x71')]('i.FaxAccountId\x20IN\x20?',_[_0x0a2d('0x34')](_0x1d341e,'id'));_0x410722['where'](_0x0a2d('0x92'),_[_0x0a2d('0x34')](_0x1d341e,'id'));}});})[_0x0a2d('0x28')](function(){if(_0x14e6f1[_0x0a2d('0x8c')]['role']==='agent'&&!_0x5ef128&&!_0x14e6f1[_0x0a2d('0x38')]['FaxAccountId'])return[];return db[_0x0a2d('0x93')][_0x0a2d('0x38')](_0x4bc7f4['toString'](),_0x276ad9);})[_0x0a2d('0x28')](function(_0x515968){_0x17ea8b[_0x0a2d('0x23')]=_0x515968[_0x0a2d('0x3e')];if(_0x17ea8b[_0x0a2d('0x23')]===0x0)return[];return db['sequelize'][_0x0a2d('0x38')](_0x23d5d4[_0x0a2d('0x94')](),_0x276ad9)[_0x0a2d('0x28')](function(_0x45eee0){_0x543e25=_[_0x0a2d('0x95')](_0x45eee0,'id');_0x276ad9=_['merge'](_0x276ad9,{'model':db[_0x0a2d('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14e6f1['query'][_0x0a2d('0x3d')]){_0x1030e8[_0x0a2d('0x3c')]['forEach'](function(_0x46d8a2){_0x410722[_0x0a2d('0x45')]('i.'+_0x46d8a2);});}else{_0x410722['field'](_0x0a2d('0x86'),_0x0a2d('0x59'));_0x410722['field']('a.key','Account.key');_0x410722[_0x0a2d('0x45')](_0x0a2d('0x97'),_0x0a2d('0x98'));_0x410722[_0x0a2d('0x45')]('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',_0x0a2d('0x87'));_0x410722[_0x0a2d('0x45')]('i.*');_0x410722[_0x0a2d('0x45')](_0x0a2d('0x99'),_0x0a2d('0x9a'));_0x410722[_0x0a2d('0x45')](_0x0a2d('0x9b'),'Contact.lastName');_0x410722[_0x0a2d('0x45')](_0x0a2d('0x9c'),_0x0a2d('0x9d'));_0x410722[_0x0a2d('0x45')](_0x0a2d('0x9e'),'Contact.phone');_0x410722[_0x0a2d('0x45')](_0x0a2d('0x9f'),_0x0a2d('0xa0'));_0x410722[_0x0a2d('0x45')](_0x0a2d('0xa1'),_0x0a2d('0xa2'));_0x410722[_0x0a2d('0x45')](_0x0a2d('0xa3'),_0x0a2d('0xa4'));_0x410722[_0x0a2d('0x45')](_0x0a2d('0xa5'),'Owner.internal');_0x410722[_0x0a2d('0x45')](_0x0a2d('0xa6'),_0x0a2d('0x2e'));}if(_0x1030e8[_0x0a2d('0x22')])_0x410722['limit'](_0x1030e8[_0x0a2d('0x22')]);if(_0x1030e8[_0x0a2d('0x20')])_0x410722['offset'](_0x1030e8[_0x0a2d('0x20')]);return db['sequelize'][_0x0a2d('0x38')](_0x410722[_0x0a2d('0x94')](),_0x276ad9);})[_0x0a2d('0x28')](function(_0x436714){if(_0x436714[_0x0a2d('0x3e')]>0x0)_0xe4eafb['where'](_0x0a2d('0xa7'),_[_0x0a2d('0x34')](_0x436714,'id'));return db[_0x0a2d('0x93')][_0x0a2d('0x38')](_0xe4eafb[_0x0a2d('0x94')](),_0x276ad9)[_0x0a2d('0x28')](function(_0x50cb56){var _0x1809d1=_[_0x0a2d('0xa8')](_0x50cb56,_0x0a2d('0xa9'));var _0x270257=[];_0x436714[_0x0a2d('0x31')](function(_0x54ee0c){_0x270257[_0x0a2d('0x32')](updateFaxInteraction(_0x54ee0c,_0x543e25,_0x1809d1));});return BPromise[_0x0a2d('0xaa')](_0x270257);});});})[_0x0a2d('0x28')](function(_0x3b1fa7){_0x17ea8b['rows']=_0x3b1fa7;return _0x17ea8b;})['then'](respondWithFilteredResult(_0x2659f8,_0x1030e8))[_0x0a2d('0x33')](handleError(_0x2659f8,null));};exports[_0x0a2d('0xab')]=function(_0x45f248,_0x17807e){var _0xd54510={'raw':![],'where':{'id':_0x45f248[_0x0a2d('0xac')]['id']}},_0x13f2b1={};_0x13f2b1[_0x0a2d('0x37')]=_[_0x0a2d('0x39')](db['FaxInteraction'][_0x0a2d('0xad')]);_0x13f2b1['query']=_[_0x0a2d('0x39')](_0x45f248[_0x0a2d('0x38')]);_0x13f2b1[_0x0a2d('0x3a')]=_[_0x0a2d('0x3b')](_0x13f2b1[_0x0a2d('0x37')],_0x13f2b1[_0x0a2d('0x38')]);_0xd54510[_0x0a2d('0x3c')]=_['intersection'](_0x13f2b1[_0x0a2d('0x37')],qs[_0x0a2d('0x3d')](_0x45f248['query'][_0x0a2d('0x3d')]));_0xd54510['attributes']=_0xd54510[_0x0a2d('0x3c')][_0x0a2d('0x3e')]?_0xd54510['attributes']:_0x13f2b1[_0x0a2d('0x37')];if(_0x45f248[_0x0a2d('0x38')][_0x0a2d('0xae')]){_0xd54510['include']=[{'all':!![]}];}_0xd54510=_[_0x0a2d('0xaf')]({},_0xd54510,_0x45f248[_0x0a2d('0xb0')]);return db[_0x0a2d('0x96')][_0x0a2d('0x58')](_0xd54510)[_0x0a2d('0x28')](handleEntityNotFound(_0x17807e,null))[_0x0a2d('0x28')](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0x0a2d('0xb1')]=function(_0x3a3335,_0x2d309e){return db['FaxInteraction'][_0x0a2d('0xb1')](_0x3a3335[_0x0a2d('0x6e')],{})[_0x0a2d('0x28')](respondWithResult(_0x2d309e,0xc9))[_0x0a2d('0x33')](handleError(_0x2d309e,null));};exports[_0x0a2d('0x27')]=function(_0x5ceb85,_0x57f5ec){if(_0x5ceb85[_0x0a2d('0x6e')]['id']){delete _0x5ceb85[_0x0a2d('0x6e')]['id'];}return db[_0x0a2d('0x96')]['find']({'where':{'id':_0x5ceb85[_0x0a2d('0xac')]['id']}})['then'](handleEntityNotFound(_0x57f5ec,null))[_0x0a2d('0x28')](saveUpdates(_0x5ceb85[_0x0a2d('0x6e')],null))['then'](respondWithResult(_0x57f5ec,null))['catch'](handleError(_0x57f5ec,null));};exports['destroy']=function(_0x29a661,_0x1965fd){return db[_0x0a2d('0x96')][_0x0a2d('0x58')]({'where':{'id':_0x29a661[_0x0a2d('0xac')]['id']}})[_0x0a2d('0x28')](handleEntityNotFound(_0x1965fd,null))[_0x0a2d('0x28')](removeEntity(_0x1965fd,null))[_0x0a2d('0x33')](handleError(_0x1965fd,null));};exports[_0x0a2d('0xb2')]=function(_0xf51eec,_0x5f1121){return db[_0x0a2d('0x96')][_0x0a2d('0xb2')]()[_0x0a2d('0x28')](respondWithResult(_0x5f1121,null))['catch'](handleError(_0x5f1121,null));};exports[_0x0a2d('0xb3')]=function(_0xe31360,_0x453303,_0x1b66f4){return db[_0x0a2d('0xb4')][_0x0a2d('0x58')]({'where':{'id':_0xe31360['params']['id']}})[_0x0a2d('0x28')](handleEntityNotFound(_0x453303,null))['then'](function(_0x4a693e){if(_0x4a693e){return _0x4a693e[_0x0a2d('0xb3')](_0xe31360['body'][_0x0a2d('0xb5')],_[_0x0a2d('0xb6')](_0xe31360['body'],[_0x0a2d('0xb5'),'id'])||{});}})['then'](respondWithResult(_0x453303,null))[_0x0a2d('0x33')](handleError(_0x453303,null));};exports[_0x0a2d('0xb7')]=function(_0x2cce9b,_0x10212c,_0x5a40f0){var _0x1dd922={'raw':![],'where':{}};var _0xd49863={};var _0x1c41cf={'count':0x0,'rows':[]};return db[_0x0a2d('0x96')][_0x0a2d('0xb8')]({'where':{'id':_0x2cce9b['params']['id']}})[_0x0a2d('0x28')](handleEntityNotFound(_0x10212c,null))[_0x0a2d('0x28')](function(_0x2ee895){if(_0x2ee895){_0xd49863['model']=_[_0x0a2d('0x39')](db[_0x0a2d('0xb4')][_0x0a2d('0xad')]);_0xd49863[_0x0a2d('0x38')]=_['keys'](_0x2cce9b[_0x0a2d('0x38')]);_0xd49863[_0x0a2d('0x3a')]=_['intersection'](_0xd49863[_0x0a2d('0x37')],_0xd49863[_0x0a2d('0x38')]);_0x1dd922[_0x0a2d('0x3c')]=_[_0x0a2d('0x3b')](_0xd49863[_0x0a2d('0x37')],qs[_0x0a2d('0x3d')](_0x2cce9b[_0x0a2d('0x38')][_0x0a2d('0x3d')]));_0x1dd922[_0x0a2d('0x3c')]=_0x1dd922['attributes'][_0x0a2d('0x3e')]?_0x1dd922[_0x0a2d('0x3c')]:_0xd49863['model'];if(!_0x2cce9b[_0x0a2d('0x38')][_0x0a2d('0x3f')](_0x0a2d('0x40'))){_0x1dd922[_0x0a2d('0x22')]=qs[_0x0a2d('0x22')](_0x2cce9b['query'][_0x0a2d('0x22')]);_0x1dd922[_0x0a2d('0x20')]=qs[_0x0a2d('0x20')](_0x2cce9b[_0x0a2d('0x38')][_0x0a2d('0x20')]);}_0x1dd922[_0x0a2d('0x41')]=qs['sort'](_0x2cce9b[_0x0a2d('0x38')]['sort']);_0x1dd922[_0x0a2d('0x71')]=qs[_0x0a2d('0x3a')](_[_0x0a2d('0x43')](_0x2cce9b[_0x0a2d('0x38')],_0xd49863['filters']));_0x1dd922[_0x0a2d('0x71')][_0x0a2d('0xa9')]=_0x2ee895['id'];if(_0x2cce9b['query']['filter']){_0x1dd922['where']=_['merge'](_0x1dd922[_0x0a2d('0x71')],{'$or':_[_0x0a2d('0x34')](_0x1dd922[_0x0a2d('0x3c')],function(_0x49829c){var _0x436aeb={};_0x436aeb[_0x49829c]={'$like':'%'+_0x2cce9b[_0x0a2d('0x38')][_0x0a2d('0x7d')]+'%'};return _0x436aeb;})});}if(_0x2cce9b[_0x0a2d('0x38')][_0x0a2d('0xb9')]){var _0x3b8f9d=_0x2cce9b['query'][_0x0a2d('0xb9')][_0x0a2d('0x30')](',');var _0x61ecfc={};_0x61ecfc[_0x3b8f9d[0x0]]={'$gte':moment(_0x3b8f9d[0x1])[_0x0a2d('0xba')](_0x0a2d('0xbb'))};_0x1dd922[_0x0a2d('0x71')]=_['merge'](_0x1dd922[_0x0a2d('0x71')],_0x61ecfc);}_0x1dd922=_[_0x0a2d('0xaf')]({},_0x1dd922,_0x2cce9b[_0x0a2d('0xb0')]);return db[_0x0a2d('0xb4')][_0x0a2d('0x23')]({'where':_0x1dd922['where']})[_0x0a2d('0x28')](function(_0x5e050b){_0x1c41cf['count']=_0x5e050b;if(_0x2cce9b[_0x0a2d('0x38')][_0x0a2d('0xae')]){_0x1dd922[_0x0a2d('0xbc')]=[{'all':!![]}];}return db[_0x0a2d('0xb4')][_0x0a2d('0xbd')](_0x1dd922);})[_0x0a2d('0x28')](function(_0x354ef4){_0x1c41cf[_0x0a2d('0xbe')]=_0x354ef4;return _0x1c41cf;});}})['then'](respondWithFilteredResult(_0x10212c,_0x1dd922))[_0x0a2d('0x33')](handleError(_0x10212c,null));};exports[_0x0a2d('0xbf')]=function(_0x54035d,_0x146794,_0x19e7fd){return db[_0x0a2d('0x96')][_0x0a2d('0x58')]({'where':{'id':_0x54035d[_0x0a2d('0xac')]['id']}})[_0x0a2d('0x28')](handleEntityNotFound(_0x146794,null))[_0x0a2d('0x28')](function(_0x45b1e7){if(_0x45b1e7){return _0x45b1e7[_0x0a2d('0xc0')](_0x54035d['body']['ids'],_['omit'](_0x54035d['body'],[_0x0a2d('0xb5'),'id'])||{})['spread'](function(){return db[_0x0a2d('0x68')]['findAll']({'attributes':['id',_0x0a2d('0x2b'),_0x0a2d('0x46')],'where':{'id':_0x54035d[_0x0a2d('0x6e')][_0x0a2d('0xb5')]}});})[_0x0a2d('0x28')](function(_0x5606e1){socket[_0x0a2d('0xc1')](_0x0a2d('0xc2'),{'id':Number(_0x54035d['params']['id']),'tags':_0x5606e1||[]});return{'id':Number(_0x54035d[_0x0a2d('0xac')]['id']),'tags':_0x5606e1||[]};});}})[_0x0a2d('0x28')](respondWithResult(_0x146794,null))[_0x0a2d('0x33')](handleError(_0x146794,null));};exports[_0x0a2d('0xc3')]=function(_0x34674e,_0x3e387b,_0x1e3074){return db[_0x0a2d('0x96')][_0x0a2d('0x58')]({'where':{'id':_0x34674e[_0x0a2d('0xac')]['id']}})['then'](handleEntityNotFound(_0x3e387b,null))[_0x0a2d('0x28')](function(_0x24ef38){if(_0x24ef38){return _0x24ef38[_0x0a2d('0xc3')](_0x34674e[_0x0a2d('0x38')][_0x0a2d('0xb5')]);}})[_0x0a2d('0x28')](respondWithStatusCode(_0x3e387b,null))[_0x0a2d('0x33')](handleError(_0x3e387b,null));};exports[_0x0a2d('0xc4')]=function(_0x4ca71d,_0x2a156d){var _0x4cdf1f=moment()[_0x0a2d('0xc5')]()[_0x0a2d('0x94')]();var _0x2c56a6=path[_0x0a2d('0xc6')](config[_0x0a2d('0xc7')],_0x0a2d('0xc8'),'files',_0x0a2d('0xc9'));var _0x80579f=path['join'](config[_0x0a2d('0xc7')],_0x0a2d('0xc8'),_0x0a2d('0xca'),_0x0a2d('0xcb'));var _0x8be5e2=path[_0x0a2d('0xc6')](_0x2c56a6,_0x4cdf1f);var _0x2aa181=util['format'](_0x0a2d('0xcc'),_0x4ca71d[_0x0a2d('0xac')]['id'],_0x4cdf1f);var _0x37c107=path[_0x0a2d('0xc6')](_0x2c56a6,_0x2aa181);var _0x4f53b7=[];_0x4f53b7[_0x0a2d('0x32')]({'model':db['Attachment'],'as':_0x0a2d('0xcd'),'raw':!![]});var _0x2b2a65=[{'model':db[_0x0a2d('0xb4')],'as':_0x0a2d('0xce'),'attributes':['id',_0x0a2d('0x6e'),'createdAt'],'include':_0x4f53b7}];return db['FaxInteraction'][_0x0a2d('0x58')]({'where':{'id':_0x4ca71d[_0x0a2d('0xac')]['id']},'include':_0x2b2a65})[_0x0a2d('0x28')](handleEntityNotFound(_0x2a156d,null))['then'](function(_0x2ce266){if(_0x2ce266&&_0x2ce266[_0x0a2d('0xce')]){var _0x1e20af=_0x2ce266[_0x0a2d('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x8be5e2);for(var _0x2e1587=0x0;_0x2e1587<_0x1e20af[_0x0a2d('0xce')][_0x0a2d('0x3e')];_0x2e1587++){var _0x19bd1f=_0x1e20af['Messages'][_0x2e1587]['Attachment'];if(_0x19bd1f){var _0x1a558a=path[_0x0a2d('0xc6')](_0x80579f,_0x19bd1f[_0x0a2d('0xd0')]);if(fs[_0x0a2d('0xd1')](_0x1a558a)){fs[_0x0a2d('0xd2')](_0x1a558a)[_0x0a2d('0xd3')](fs[_0x0a2d('0xd4')](path[_0x0a2d('0xc6')](_0x8be5e2,_0x19bd1f[_0x0a2d('0xd0')])));}}}return BPromise[_0x0a2d('0x8a')]()['then'](function(){return new BPromise(function(_0x35dc3c,_0x248aec){zipdir(_0x8be5e2,{'saveTo':_0x37c107},function(_0x10515e,_0x110e6e){if(_0x10515e)return _0x248aec(_0x10515e);return _0x35dc3c(_0x110e6e);});})[_0x0a2d('0x28')](function(){return new BPromise(function(_0x14b328,_0x2b980a){rimraf(_0x8be5e2,function(_0x3c21db){if(_0x3c21db)_0x2b980a(_0x3c21db);return _0x14b328();});});})[_0x0a2d('0x28')](function(){return _0x2a156d['download'](_0x37c107,_0x2aa181,function(_0x20aaa9){if(_0x20aaa9){console[_0x0a2d('0xd5')](_0x0a2d('0xd6'),_0x20aaa9);}else{fs['unlinkSync'](_0x37c107);}});});});}else{return _0x2a156d[_0x0a2d('0x1c')](0xc8);}})[_0x0a2d('0x33')](handleError(_0x2a156d,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9108a20..9ec18c5 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 _0x5114=['FaxInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue','findAll','emit','hook','../../mysqldb'];(function(_0x4025df,_0x5bdc3a){var _0x3caeca=function(_0x394f34){while(--_0x394f34){_0x4025df['push'](_0x4025df['shift']());}};_0x3caeca(++_0x5bdc3a);}(_0x5114,0x196));var _0x4511=function(_0x452db4,_0x58e348){_0x452db4=_0x452db4-0x0;var _0x2a5672=_0x5114[_0x452db4];return _0x2a5672;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x4511('0x0'))['db'][_0x4511('0x1')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4511('0x2')](0x0);var events={'afterCreate':_0x4511('0x3'),'afterUpdate':'update','afterDestroy':_0x4511('0x4')};function emitEvent(_0x50d993){return function(_0x24e5a1,_0x5f2c7a,_0x20f5a2){_0x24e5a1[_0x4511('0x5')]({'attributes':['id'],'raw':!![]})[_0x4511('0x6')](function(_0x79df72){_0x24e5a1[_0x4511('0x7')]('Users',_0x79df72['map'](function(_0x4808e2){return{'id':_0x4808e2['id']};}));return FaxMessage[_0x4511('0x8')]({'where':{'FaxInteractionId':_0x24e5a1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x49e003){_0x24e5a1[_0x4511('0x7')]('unreadMessages',_0x49e003['length']);FaxInteractionEvents['emit'](_0x50d993+':'+_0x24e5a1['id'],_0x24e5a1);FaxInteractionEvents[_0x4511('0x9')](_0x50d993,_0x24e5a1);_0x20f5a2(null);})['catch'](_0x20f5a2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x4511('0xa')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x9e7a=['remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x374226,_0x56ec5c){var _0xb2e1e8=function(_0x3a4412){while(--_0x3a4412){_0x374226['push'](_0x374226['shift']());}};_0xb2e1e8(++_0x56ec5c);}(_0x9e7a,0x163));var _0xa9e7=function(_0xdc3b5f,_0x12b2c8){_0xdc3b5f=_0xdc3b5f-0x0;var _0x7eddfb=_0x9e7a[_0xdc3b5f];return _0x7eddfb;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0xa9e7('0x0')];var FaxMessage=require(_0xa9e7('0x1'))['db'][_0xa9e7('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa9e7('0x3')](0x0);var events={'afterCreate':_0xa9e7('0x4'),'afterUpdate':'update','afterDestroy':_0xa9e7('0x5')};function emitEvent(_0x1dbf1f){return function(_0x244732,_0x5b7a4d,_0x348366){_0x244732[_0xa9e7('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x132875){_0x244732['setDataValue'](_0xa9e7('0x7'),_0x132875[_0xa9e7('0x8')](function(_0x25e896){return{'id':_0x25e896['id']};}));return FaxMessage[_0xa9e7('0x9')]({'where':{'FaxInteractionId':_0x244732['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa9e7('0xa')](function(_0xd2c639){_0x244732[_0xa9e7('0xb')](_0xa9e7('0xc'),_0xd2c639[_0xa9e7('0xd')]);FaxInteractionEvents[_0xa9e7('0xe')](_0x1dbf1f+':'+_0x244732['id'],_0x244732);FaxInteractionEvents[_0xa9e7('0xe')](_0x1dbf1f,_0x244732);_0x348366(null);})[_0xa9e7('0xf')](_0x348366(null));};}for(var e in events){if(events[_0xa9e7('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xa9e7('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 4c4e590..dae0d5e 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 _0x9ed7=['changed','closedAt','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x394b87,_0x44a2d5){var _0x70b84a=function(_0xea1834){while(--_0xea1834){_0x394b87['push'](_0x394b87['shift']());}};_0x70b84a(++_0x44a2d5);}(_0x9ed7,0x1a6));var _0x79ed=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x9ed7[_0x430459];return _0x3a2439;};'use strict';var _=require(_0x79ed('0x0'));var util=require(_0x79ed('0x1'));var logger=require(_0x79ed('0x2'))('api');var moment=require(_0x79ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x79ed('0x4'));var fs=require('fs');var path=require(_0x79ed('0x5'));var rimraf=require(_0x79ed('0x6'));var config=require(_0x79ed('0x7'));var attributes=require(_0x79ed('0x8'));module[_0x79ed('0x9')]=function(_0x434250,_0x516d0c){return _0x434250[_0x79ed('0xa')](_0x79ed('0xb'),attributes,{'tableName':_0x79ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45d4fc,_0x1fb41e,_0x2cfb84){if(_0x45d4fc[_0x79ed('0xd')]('closed')){_0x45d4fc[_0x79ed('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2cfb84(null,_0x45d4fc);}}});}; \ No newline at end of file +var _0xbac6=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','FaxInteraction','fax_interactions','closedAt','format'];(function(_0x1bbb73,_0x4e946b){var _0x3a85df=function(_0x5726e9){while(--_0x5726e9){_0x1bbb73['push'](_0x1bbb73['shift']());}};_0x3a85df(++_0x4e946b);}(_0xbac6,0x1ec));var _0x6bac=function(_0x25e2a5,_0x2d7270){_0x25e2a5=_0x25e2a5-0x0;var _0x429243=_0xbac6[_0x25e2a5];return _0x429243;};'use strict';var _=require(_0x6bac('0x0'));var util=require(_0x6bac('0x1'));var logger=require(_0x6bac('0x2'))('api');var moment=require(_0x6bac('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bac('0x5'));var config=require(_0x6bac('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x6bac('0x7')]=function(_0x59da37,_0x178897){return _0x59da37['define'](_0x6bac('0x8'),attributes,{'tableName':_0x6bac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4add39,_0x4ba90b,_0x4c2aeb){if(_0x4add39['changed']('closed')){_0x4add39[_0x6bac('0xa')]=moment()[_0x6bac('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4c2aeb(null,_0x4add39);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6a8ce17..85878c5 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 _0xdcb6=['FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','debug','stringify','AddTagsToFaxInteraction','find','omit','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s'];(function(_0x23801c,_0x57c290){var _0x31b776=function(_0x77c6e0){while(--_0x77c6e0){_0x23801c['push'](_0x23801c['shift']());}};_0x31b776(++_0x57c290);}(_0xdcb6,0x94));var _0x6dcb=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xdcb6[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x6dcb('0x0'));var util=require('util');var moment=require(_0x6dcb('0x1'));var BPromise=require('bluebird');var rs=require(_0x6dcb('0x2'));var fs=require('fs');var Redis=require(_0x6dcb('0x3'));var db=require(_0x6dcb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6dcb('0x5'))(_0x6dcb('0x6'));var config=require(_0x6dcb('0x7'));var jayson=require(_0x6dcb('0x8'));var client=jayson['client'][_0x6dcb('0x9')]({'port':0x232a});config[_0x6dcb('0xa')]=_[_0x6dcb('0xb')](config['redis'],{'host':_0x6dcb('0xc'),'port':0x18eb});var socket=require(_0x6dcb('0xd'))(new Redis(config['redis']));require(_0x6dcb('0xe'))[_0x6dcb('0xf')](socket);function respondWithRpcPromise(_0x4b7d4f,_0x267118,_0x3d82f6){return new BPromise(function(_0x4dd6fe,_0x3b5883){return client[_0x6dcb('0x10')](_0x4b7d4f,_0x3d82f6)[_0x6dcb('0x11')](function(_0x5a29fc){logger[_0x6dcb('0x12')](_0x6dcb('0x13'),_0x267118,'request\x20sent');logger['debug'](_0x6dcb('0x14'),_0x267118,_0x6dcb('0x15'),JSON['stringify'](_0x5a29fc));if(_0x5a29fc[_0x6dcb('0x16')]){if(_0x5a29fc[_0x6dcb('0x16')]['code']===0x1f4){logger[_0x6dcb('0x16')](_0x6dcb('0x13'),_0x267118,_0x5a29fc[_0x6dcb('0x16')]['message']);return _0x3b5883(_0x5a29fc[_0x6dcb('0x16')][_0x6dcb('0x17')]);}logger['error'](_0x6dcb('0x13'),_0x267118,_0x5a29fc[_0x6dcb('0x16')][_0x6dcb('0x17')]);return _0x4dd6fe(_0x5a29fc['error']['message']);}else{logger[_0x6dcb('0x12')](_0x6dcb('0x13'),_0x267118,_0x6dcb('0x15'));_0x4dd6fe(_0x5a29fc[_0x6dcb('0x18')][_0x6dcb('0x17')]);}})[_0x6dcb('0x19')](function(_0xa233b1){logger['error'](_0x6dcb('0x13'),_0x267118,_0xa233b1);_0x3b5883(_0xa233b1);});});}exports[_0x6dcb('0x1a')]=function(_0x2418e7){var _0x134041=this;return new Promise(function(_0x2b999b,_0x207c56){return db[_0x6dcb('0x1b')][_0x6dcb('0x1c')](_0x2418e7[_0x6dcb('0x1d')],{'raw':_0x2418e7[_0x6dcb('0x1e')]?_0x2418e7[_0x6dcb('0x1e')][_0x6dcb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2418e7[_0x6dcb('0x1e')]?_0x2418e7[_0x6dcb('0x1e')][_0x6dcb('0x20')]||null:null,'attributes':_0x2418e7[_0x6dcb('0x1e')]?_0x2418e7[_0x6dcb('0x1e')]['attributes']||null:null,'limit':_0x2418e7['options']?_0x2418e7[_0x6dcb('0x1e')][_0x6dcb('0x21')]||null:null})[_0x6dcb('0x11')](function(_0x4bfdf9){logger['info'](_0x6dcb('0x1a'),_0x2418e7);logger[_0x6dcb('0x22')](_0x6dcb('0x1a'),_0x2418e7,JSON[_0x6dcb('0x23')](_0x4bfdf9));_0x2b999b(_0x4bfdf9);})[_0x6dcb('0x19')](function(_0x2a7310){logger[_0x6dcb('0x16')](_0x6dcb('0x1a'),_0x2a7310[_0x6dcb('0x17')],_0x2418e7);_0x207c56(_0x134041['error'](0x1f4,_0x2a7310[_0x6dcb('0x17')]));});});};exports[_0x6dcb('0x24')]=function(_0x329131){return new Promise(function(_0x25ccba,_0x2b22de){return db[_0x6dcb('0x1b')][_0x6dcb('0x25')]({'where':_0x329131[_0x6dcb('0x1e')]?_0x329131[_0x6dcb('0x1e')]['where']||null:null})['then'](function(_0x3a8cc6){if(_0x3a8cc6){return _0x3a8cc6['addTags'](_0x329131[_0x6dcb('0x1d')]['ids'],_[_0x6dcb('0x26')](_0x329131[_0x6dcb('0x1d')],[_0x6dcb('0x27'),'id'])||{});}})[_0x6dcb('0x28')](function(_0x2df8dc){logger['info'](_0x6dcb('0x29'),_0x329131);logger['debug'](_0x6dcb('0x29'),_0x329131,JSON[_0x6dcb('0x23')](_0x2df8dc));_0x25ccba(_0x2df8dc);})[_0x6dcb('0x19')](function(_0x3ecdbd){logger['error'](_0x6dcb('0x29'),_0x3ecdbd['message'],_0x329131);_0x2b22de(_this['error'](0x1f4,_0x3ecdbd[_0x6dcb('0x17')]));});});}; \ No newline at end of file +var _0x3597=['attributes','limit','where','then','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options'];(function(_0xc80702,_0x18ef50){var _0x4c4c76=function(_0x24ee31){while(--_0x24ee31){_0xc80702['push'](_0xc80702['shift']());}};_0x4c4c76(++_0x18ef50);}(_0x3597,0xab));var _0x7359=function(_0xec2037,_0x2e340a){_0xec2037=_0xec2037-0x0;var _0x24b803=_0x3597[_0xec2037];return _0x24b803;};'use strict';var _=require(_0x7359('0x0'));var util=require('util');var moment=require(_0x7359('0x1'));var BPromise=require(_0x7359('0x2'));var rs=require(_0x7359('0x3'));var fs=require('fs');var Redis=require(_0x7359('0x4'));var db=require(_0x7359('0x5'))['db'];var utils=require(_0x7359('0x6'));var logger=require(_0x7359('0x7'))('rpc');var config=require(_0x7359('0x8'));var jayson=require(_0x7359('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7359('0xa')](config[_0x7359('0xb')],{'host':_0x7359('0xc'),'port':0x18eb});var socket=require(_0x7359('0xd'))(new Redis(config[_0x7359('0xb')]));require(_0x7359('0xe'))[_0x7359('0xf')](socket);function respondWithRpcPromise(_0x36a1dc,_0x5fc397,_0x36eaea){return new BPromise(function(_0x462d16,_0x4eeb4b){return client[_0x7359('0x10')](_0x36a1dc,_0x36eaea)['then'](function(_0x17b262){logger[_0x7359('0x11')](_0x7359('0x12'),_0x5fc397,'request\x20sent');logger[_0x7359('0x13')](_0x7359('0x14'),_0x5fc397,_0x7359('0x15'),JSON[_0x7359('0x16')](_0x17b262));if(_0x17b262[_0x7359('0x17')]){if(_0x17b262[_0x7359('0x17')][_0x7359('0x18')]===0x1f4){logger[_0x7359('0x17')](_0x7359('0x12'),_0x5fc397,_0x17b262[_0x7359('0x17')]['message']);return _0x4eeb4b(_0x17b262['error'][_0x7359('0x19')]);}logger[_0x7359('0x17')](_0x7359('0x12'),_0x5fc397,_0x17b262[_0x7359('0x17')][_0x7359('0x19')]);return _0x462d16(_0x17b262[_0x7359('0x17')][_0x7359('0x19')]);}else{logger['info'](_0x7359('0x12'),_0x5fc397,'request\x20sent');_0x462d16(_0x17b262[_0x7359('0x1a')][_0x7359('0x19')]);}})[_0x7359('0x1b')](function(_0x4832f2){logger[_0x7359('0x17')](_0x7359('0x12'),_0x5fc397,_0x4832f2);_0x4eeb4b(_0x4832f2);});});}exports[_0x7359('0x1c')]=function(_0x38e871){var _0x4d5fc0=this;return new Promise(function(_0x4232d4,_0x5c0548){return db[_0x7359('0x1d')][_0x7359('0x1e')](_0x38e871[_0x7359('0x1f')],{'raw':_0x38e871['options']?_0x38e871['options'][_0x7359('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38e871[_0x7359('0x21')]?_0x38e871[_0x7359('0x21')]['where']||null:null,'attributes':_0x38e871[_0x7359('0x21')]?_0x38e871['options'][_0x7359('0x22')]||null:null,'limit':_0x38e871[_0x7359('0x21')]?_0x38e871[_0x7359('0x21')][_0x7359('0x23')]||null:null})['then'](function(_0x3c90cd){logger[_0x7359('0x11')](_0x7359('0x1c'),_0x38e871);logger['debug'](_0x7359('0x1c'),_0x38e871,JSON[_0x7359('0x16')](_0x3c90cd));_0x4232d4(_0x3c90cd);})[_0x7359('0x1b')](function(_0x37dd42){logger[_0x7359('0x17')](_0x7359('0x1c'),_0x37dd42[_0x7359('0x19')],_0x38e871);_0x5c0548(_0x4d5fc0['error'](0x1f4,_0x37dd42[_0x7359('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2ba7e3){return new Promise(function(_0x1a8eaa,_0xdede16){return db['FaxInteraction']['find']({'where':_0x2ba7e3[_0x7359('0x21')]?_0x2ba7e3[_0x7359('0x21')][_0x7359('0x24')]||null:null})[_0x7359('0x25')](function(_0x550aee){if(_0x550aee){return _0x550aee['addTags'](_0x2ba7e3[_0x7359('0x1f')][_0x7359('0x26')],_[_0x7359('0x27')](_0x2ba7e3[_0x7359('0x1f')],['ids','id'])||{});}})['spread'](function(_0x1b25f1){logger[_0x7359('0x11')](_0x7359('0x28'),_0x2ba7e3);logger[_0x7359('0x13')]('AddTags',_0x2ba7e3,JSON[_0x7359('0x16')](_0x1b25f1));_0x1a8eaa(_0x1b25f1);})[_0x7359('0x1b')](function(_0x298b14){logger[_0x7359('0x17')]('AddTags',_0x298b14[_0x7359('0x19')],_0x2ba7e3);_0xdede16(_this['error'](0x1f4,_0x298b14[_0x7359('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 26882f7..0f8175d 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 _0xbaa7=['remove','removeListener','length','faxInteraction:','./faxInteraction.events'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0xbaa7,0xe5));var _0x7baa=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xbaa7[_0x543084];return _0x306a57;};'use strict';var FaxInteractionEvents=require(_0x7baa('0x0'));var events=['save',_0x7baa('0x1'),'update'];function createListener(_0x5a4045,_0x49f6b4){return function(_0x215b39){_0x49f6b4['emit'](_0x5a4045,_0x215b39);};}function removeListener(_0x4d4569,_0x30b0cb){return function(){FaxInteractionEvents[_0x7baa('0x2')](_0x4d4569,_0x30b0cb);};}exports['register']=function(_0x3a08a3){for(var _0x13c023=0x0,_0x2a8282=events[_0x7baa('0x3')];_0x13c023<_0x2a8282;_0x13c023++){var _0x28b43a=events[_0x13c023];var _0x4f6e12=createListener(_0x7baa('0x4')+_0x28b43a,_0x3a08a3);FaxInteractionEvents['on'](_0x28b43a,_0x4f6e12);}}; \ No newline at end of file +var _0x0572=['update','emit','removeListener','register','length','faxInteraction:','save','remove'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0572,0x1ce));var _0x2057=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0572[_0x4a9fb1];return _0x348672;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x2057('0x0'),_0x2057('0x1'),_0x2057('0x2')];function createListener(_0x2af489,_0x1e49e7){return function(_0xfe2fc7){_0x1e49e7[_0x2057('0x3')](_0x2af489,_0xfe2fc7);};}function removeListener(_0x52c65d,_0x17aadd){return function(){FaxInteractionEvents[_0x2057('0x4')](_0x52c65d,_0x17aadd);};}exports[_0x2057('0x5')]=function(_0x3b276f){for(var _0x40cd46=0x0,_0xad4df0=events[_0x2057('0x6')];_0x40cd46<_0xad4df0;_0x40cd46++){var _0x3ed0a7=events[_0x40cd46];var _0x49be8a=createListener(_0x2057('0x7')+_0x3ed0a7,_0x3b276f);FaxInteractionEvents['on'](_0x3ed0a7,_0x49be8a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index afb7ae8..9b9c788 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 _0x4435=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','fax','faxinteraction:destroy','removeTags','exports','multer'];(function(_0x125856,_0x171bdf){var _0x1e42ec=function(_0x4bf960){while(--_0x4bf960){_0x125856['push'](_0x125856['shift']());}};_0x1e42ec(++_0x171bdf);}(_0x4435,0x1ef));var _0x5443=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4435[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0x5443('0x0'));var util=require(_0x5443('0x1'));var path=require(_0x5443('0x2'));var timeout=require(_0x5443('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5443('0x4'));var interaction=require(_0x5443('0x5'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x5443('0x6')]('/',auth[_0x5443('0x7')](),controller[_0x5443('0x8')]);router[_0x5443('0x6')](_0x5443('0x9'),auth[_0x5443('0x7')](),controller[_0x5443('0xa')]);router[_0x5443('0x6')](_0x5443('0xb'),auth[_0x5443('0x7')](),controller[_0x5443('0xc')]);router[_0x5443('0x6')](_0x5443('0xd'),auth[_0x5443('0x7')](),controller[_0x5443('0xe')]);router['get'](_0x5443('0xf'),auth[_0x5443('0x7')](),controller['download']);router[_0x5443('0x10')]('/',auth[_0x5443('0x7')](),controller[_0x5443('0x11')]);router[_0x5443('0x10')](_0x5443('0xd'),auth[_0x5443('0x7')](),controller[_0x5443('0x12')]);router[_0x5443('0x10')](_0x5443('0x13'),auth[_0x5443('0x7')](),interaction[_0x5443('0x14')]('fax',_0x5443('0x15')),controller[_0x5443('0x16')]);router[_0x5443('0x17')](_0x5443('0xb'),auth[_0x5443('0x7')](),interaction[_0x5443('0x14')]('fax',_0x5443('0x18')),controller[_0x5443('0x19')]);router[_0x5443('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x5443('0x14')](_0x5443('0x1b'),_0x5443('0x1c')),controller['destroy']);router[_0x5443('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5443('0x1d')]);module[_0x5443('0x1e')]=router; \ No newline at end of file +var _0xbe52=['delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','update'];(function(_0x57fa0b,_0x5df1ce){var _0x18669f=function(_0xb09fcc){while(--_0xb09fcc){_0x57fa0b['push'](_0x57fa0b['shift']());}};_0x18669f(++_0x5df1ce);}(_0xbe52,0x164));var _0x2be5=function(_0x29006f,_0x5bd855){_0x29006f=_0x29006f-0x0;var _0x424bae=_0xbe52[_0x29006f];return _0x424bae;};'use strict';var multer=require(_0x2be5('0x0'));var util=require(_0x2be5('0x1'));var path=require(_0x2be5('0x2'));var timeout=require(_0x2be5('0x3'));var express=require(_0x2be5('0x4'));var router=express['Router']();var fs_extra=require(_0x2be5('0x5'));var auth=require(_0x2be5('0x6'));var interaction=require(_0x2be5('0x7'));var config=require(_0x2be5('0x8'));var controller=require(_0x2be5('0x9'));router[_0x2be5('0xa')]('/',auth[_0x2be5('0xb')](),controller[_0x2be5('0xc')]);router[_0x2be5('0xa')](_0x2be5('0xd'),auth[_0x2be5('0xb')](),controller[_0x2be5('0xe')]);router['get'](_0x2be5('0xf'),auth[_0x2be5('0xb')](),controller[_0x2be5('0x10')]);router['get'](_0x2be5('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2be5('0xa')](_0x2be5('0x12'),auth[_0x2be5('0xb')](),controller[_0x2be5('0x13')]);router['post']('/',auth[_0x2be5('0xb')](),controller[_0x2be5('0x14')]);router['post']('/:id/messages',auth[_0x2be5('0xb')](),controller[_0x2be5('0x15')]);router['post'](_0x2be5('0x16'),auth[_0x2be5('0xb')](),interaction[_0x2be5('0x17')](_0x2be5('0x18'),_0x2be5('0x19')),controller[_0x2be5('0x1a')]);router['put']('/:id',auth[_0x2be5('0xb')](),interaction['tracked'](_0x2be5('0x18'),'faxinteraction:update'),controller[_0x2be5('0x1b')]);router[_0x2be5('0x1c')](_0x2be5('0xf'),auth['isAuthenticated'](),interaction[_0x2be5('0x17')](_0x2be5('0x18'),'faxinteraction:destroy'),controller[_0x2be5('0x1d')]);router[_0x2be5('0x1c')](_0x2be5('0x16'),auth[_0x2be5('0xb')](),controller[_0x2be5('0x1e')]);module[_0x2be5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 52c3139..01568c3 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 _0xdab2=['sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dab('0x0'));module[_0x2dab('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2dab('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2dab('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2dab('0x4')]('in',_0x2dab('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x2dab('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2dab('0x7')]}}; \ No newline at end of file +var _0xc576=['sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x5cc483,_0x33483a){var _0x9eea0=function(_0x1f296f){while(--_0x1f296f){_0x5cc483['push'](_0x5cc483['shift']());}};_0x9eea0(++_0x33483a);}(_0xc576,0x1ea));var _0x6c57=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0xc576[_0x15c5b8];return _0xd45fe6;};'use strict';var Sequelize=require(_0x6c57('0x0'));module[_0x6c57('0x1')]={'body':{'type':Sequelize[_0x6c57('0x2')](_0x6c57('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6c57('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x6c57('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x6c57('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 10b8182..dd20bfa 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 _0xdd8e=['merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE: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','Sequelize','SELECT','contact','User','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','rejectmessage','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','server','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','sendStatus','stack','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xdd8e,0x1f4));var _0xedd8=function(_0x170522,_0x273df0){_0x170522=_0x170522-0x0;var _0x2a0a7b=_0xdd8e[_0x170522];return _0x2a0a7b;};'use strict';var emlformat=require(_0xedd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedd8('0x1'));var jsonpatch=require(_0xedd8('0x2'));var rp=require(_0xedd8('0x3'));var moment=require(_0xedd8('0x4'));var BPromise=require(_0xedd8('0x5'));var Mustache=require(_0xedd8('0x6'));var util=require(_0xedd8('0x7'));var path=require(_0xedd8('0x8'));var sox=require(_0xedd8('0x9'));var csv=require(_0xedd8('0xa'));var ejs=require(_0xedd8('0xb'));var fs=require('fs');var fs_extra=require(_0xedd8('0xc'));var _=require(_0xedd8('0xd'));var squel=require(_0xedd8('0xe'));var crypto=require('crypto');var jsforce=require(_0xedd8('0xf'));var deskjs=require(_0xedd8('0x10'));var toCsv=require(_0xedd8('0xa'));var querystring=require('querystring');var Papa=require(_0xedd8('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedd8('0x12'));var as=require(_0xedd8('0x13'));var hardwareService=require(_0xedd8('0x14'));var logger=require(_0xedd8('0x15'))(_0xedd8('0x16'));var utils=require(_0xedd8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xedd8('0x18'));var db=require(_0xedd8('0x19'))['db'];config['redis']=_[_0xedd8('0x1a')](config[_0xedd8('0x1b')],{'host':_0xedd8('0x1c'),'port':0x18eb});var socket=require(_0xedd8('0x1d'))(new Redis(config['redis']));require(_0xedd8('0x1e'))[_0xedd8('0x1f')](socket);var jayson=require(_0xedd8('0x20'));var client=jayson['client'][_0xedd8('0x21')]({'port':0x232c});var client9002=jayson[_0xedd8('0x22')][_0xedd8('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x40238a,_0x191fdc,_0x6692db,_0x4fe4f8){return new BPromise(function(_0xb47137,_0x44970c){var _0x4211d0=_0x4fe4f8||client;return _0x4211d0[_0xedd8('0x23')](_0x40238a,_0x6692db)[_0xedd8('0x24')](function(_0x39386b){logger[_0xedd8('0x25')]('FaxMessage,\x20%s,\x20%s',_0x191fdc,_0xedd8('0x26'));logger[_0xedd8('0x27')](_0xedd8('0x28'),_0x191fdc,'request\x20sent',JSON[_0xedd8('0x29')](_0x39386b));if(_0x39386b[_0xedd8('0x2a')]){if(_0x39386b[_0xedd8('0x2a')][_0xedd8('0x2b')]===0x1f4){logger[_0xedd8('0x2a')](_0xedd8('0x2c'),_0x191fdc,_0x39386b['error'][_0xedd8('0x2d')]);return _0x44970c(_0x39386b[_0xedd8('0x2a')][_0xedd8('0x2d')]);}logger['error'](_0xedd8('0x2c'),_0x191fdc,_0x39386b['error'][_0xedd8('0x2d')]);return _0xb47137(_0x39386b[_0xedd8('0x2a')][_0xedd8('0x2d')]);}else{logger[_0xedd8('0x25')](_0xedd8('0x2c'),_0x191fdc,'request\x20sent');_0xb47137(_0x39386b[_0xedd8('0x2e')]['message']);}})[_0xedd8('0x2f')](function(_0x4d316a){logger[_0xedd8('0x2a')](_0xedd8('0x2c'),_0x191fdc,_0x4d316a);_0x44970c(_0x4d316a);});});}function respondWithStatusCode(_0xebeb34,_0x40610e){_0x40610e=_0x40610e||0xcc;return function(_0x298048){if(_0x298048){return _0xebeb34['sendStatus'](_0x40610e);}return _0xebeb34['status'](_0x40610e)[_0xedd8('0x30')]();};}function respondWithResult(_0x4e5839,_0x4856e9){_0x4856e9=_0x4856e9||0xc8;return function(_0x57263a){if(_0x57263a){return _0x4e5839[_0xedd8('0x31')](_0x4856e9)[_0xedd8('0x32')](_0x57263a);}};}function respondWithFilteredResult(_0xa38bb5,_0x3e9d6a){return function(_0x142620){if(_0x142620){var _0x382389=typeof _0x3e9d6a[_0xedd8('0x33')]===_0xedd8('0x34')&&typeof _0x3e9d6a[_0xedd8('0x35')]===_0xedd8('0x34');var _0x4c33dd=_0x142620[_0xedd8('0x36')];var _0x48a7db=_0x382389?0x0:_0x3e9d6a[_0xedd8('0x33')];var _0x498cf0=_0x382389?_0x142620['count']:_0x3e9d6a[_0xedd8('0x33')]+_0x3e9d6a[_0xedd8('0x35')];var _0x5603bb;if(_0x498cf0>=_0x4c33dd){_0x498cf0=_0x4c33dd;_0x5603bb=0xc8;}else{_0x5603bb=0xce;}_0xa38bb5[_0xedd8('0x31')](_0x5603bb);return _0xa38bb5[_0xedd8('0x37')](_0xedd8('0x38'),_0x48a7db+'-'+_0x498cf0+'/'+_0x4c33dd)[_0xedd8('0x32')](_0x142620);}return null;};}function patchUpdates(_0x130448){return function(_0x362b4a){try{jsonpatch['apply'](_0x362b4a,_0x130448,!![]);}catch(_0x4639f2){return BPromise[_0xedd8('0x39')](_0x4639f2);}return _0x362b4a[_0xedd8('0x3a')]();};}function saveUpdates(_0x5efc41,_0x47b8cd){return function(_0x41961c){if(_0x41961c){return _0x41961c[_0xedd8('0x3b')](_0x5efc41)[_0xedd8('0x24')](function(_0x240f35){return _0x240f35;});}return null;};}function removeEntity(_0x568574,_0x523ca2){return function(_0x215892){if(_0x215892){return _0x215892['destroy']()[_0xedd8('0x24')](function(){_0x568574[_0xedd8('0x31')](0xcc)[_0xedd8('0x30')]();});}};}function handleEntityNotFound(_0x11669a,_0x41f1be){return function(_0x5c2bf7){if(!_0x5c2bf7){_0x11669a[_0xedd8('0x3c')](0x194);}return _0x5c2bf7;};}function handleError(_0x14c41b,_0x5e4964){_0x5e4964=_0x5e4964||0x1f4;return function(_0x1f39c1){logger[_0xedd8('0x2a')](_0x1f39c1[_0xedd8('0x3d')]);if(_0x1f39c1['name']){delete _0x1f39c1['name'];}_0x14c41b['status'](_0x5e4964)[_0xedd8('0x3e')](_0x1f39c1);};}exports[_0xedd8('0x3f')]=function(_0x222d64,_0x311968){var _0x247b7c={},_0x4be1c7={},_0x41343a={'count':0x0,'rows':[]};var _0x3acedb=_[_0xedd8('0x40')](db[_0xedd8('0x41')][_0xedd8('0x42')],function(_0x38ace5){return{'name':_0x38ace5[_0xedd8('0x43')],'type':_0x38ace5[_0xedd8('0x44')][_0xedd8('0x45')]};});_0x4be1c7[_0xedd8('0x46')]=_[_0xedd8('0x40')](_0x3acedb,_0xedd8('0x47'));_0x4be1c7[_0xedd8('0x48')]=_[_0xedd8('0x49')](_0x222d64[_0xedd8('0x48')]);_0x4be1c7[_0xedd8('0x4a')]=_['intersection'](_0x4be1c7[_0xedd8('0x46')],_0x4be1c7[_0xedd8('0x48')]);_0x247b7c[_0xedd8('0x4b')]=_[_0xedd8('0x4c')](_0x4be1c7[_0xedd8('0x46')],qs[_0xedd8('0x4d')](_0x222d64[_0xedd8('0x48')]['fields']));_0x247b7c[_0xedd8('0x4b')]=_0x247b7c[_0xedd8('0x4b')][_0xedd8('0x4e')]?_0x247b7c[_0xedd8('0x4b')]:_0x4be1c7[_0xedd8('0x46')];if(!_0x222d64[_0xedd8('0x48')]['hasOwnProperty'](_0xedd8('0x4f'))){_0x247b7c['limit']=qs[_0xedd8('0x35')](_0x222d64[_0xedd8('0x48')][_0xedd8('0x35')]);_0x247b7c[_0xedd8('0x33')]=qs[_0xedd8('0x33')](_0x222d64[_0xedd8('0x48')][_0xedd8('0x33')]);}_0x247b7c[_0xedd8('0x50')]=qs[_0xedd8('0x51')](_0x222d64['query'][_0xedd8('0x51')]);_0x247b7c['where']=qs[_0xedd8('0x4a')](_['pick'](_0x222d64['query'],_0x4be1c7[_0xedd8('0x4a')]),_0x3acedb);if(_0x222d64[_0xedd8('0x48')][_0xedd8('0x52')]){_0x247b7c[_0xedd8('0x53')]=_[_0xedd8('0x54')](_0x247b7c[_0xedd8('0x53')],{'$or':_['map'](_0x3acedb,function(_0x25b821){if(_0x25b821[_0xedd8('0x44')]!==_0xedd8('0x55')){var _0x43f751={};_0x43f751[_0x25b821[_0xedd8('0x47')]]={'$like':'%'+_0x222d64[_0xedd8('0x48')][_0xedd8('0x52')]+'%'};return _0x43f751;}})});}_0x247b7c=_[_0xedd8('0x54')]({},_0x247b7c,_0x222d64[_0xedd8('0x56')]);var _0x534fd4={'where':_0x247b7c['where']};return db[_0xedd8('0x41')][_0xedd8('0x36')](_0x534fd4)['then'](function(_0x5c1f66){_0x41343a['count']=_0x5c1f66;if(_0x222d64[_0xedd8('0x48')][_0xedd8('0x57')]){_0x247b7c[_0xedd8('0x58')]=[{'all':!![]}];}return db[_0xedd8('0x41')][_0xedd8('0x59')](_0x247b7c);})[_0xedd8('0x24')](function(_0xf61774){_0x41343a['rows']=_0xf61774;return _0x41343a;})[_0xedd8('0x24')](respondWithFilteredResult(_0x311968,_0x247b7c))[_0xedd8('0x2f')](handleError(_0x311968,null));};exports[_0xedd8('0x5a')]=function(_0x2603ae,_0x581dfc){var _0x5aea6f={'raw':!![],'where':{'id':_0x2603ae[_0xedd8('0x5b')]['id']}},_0x276374={};_0x276374[_0xedd8('0x46')]=_['keys'](db[_0xedd8('0x41')]['rawAttributes']);_0x276374[_0xedd8('0x48')]=_[_0xedd8('0x49')](_0x2603ae[_0xedd8('0x48')]);_0x276374[_0xedd8('0x4a')]=_[_0xedd8('0x4c')](_0x276374[_0xedd8('0x46')],_0x276374[_0xedd8('0x48')]);_0x5aea6f[_0xedd8('0x4b')]=_['intersection'](_0x276374['model'],qs[_0xedd8('0x4d')](_0x2603ae[_0xedd8('0x48')][_0xedd8('0x4d')]));_0x5aea6f[_0xedd8('0x4b')]=_0x5aea6f[_0xedd8('0x4b')][_0xedd8('0x4e')]?_0x5aea6f['attributes']:_0x276374['model'];if(_0x2603ae['query'][_0xedd8('0x57')]){_0x5aea6f[_0xedd8('0x58')]=[{'all':!![]}];}_0x5aea6f=_[_0xedd8('0x54')]({},_0x5aea6f,_0x2603ae[_0xedd8('0x56')]);return db[_0xedd8('0x41')][_0xedd8('0x5c')](_0x5aea6f)[_0xedd8('0x24')](handleEntityNotFound(_0x581dfc,null))['then'](respondWithResult(_0x581dfc,null))[_0xedd8('0x2f')](handleError(_0x581dfc,null));};exports[_0xedd8('0x3b')]=function(_0x2bf950,_0x1e8f63){if(_0x2bf950[_0xedd8('0x5d')]['id']){delete _0x2bf950['body']['id'];}return db[_0xedd8('0x41')][_0xedd8('0x5c')]({'where':{'id':_0x2bf950[_0xedd8('0x5b')]['id']}})[_0xedd8('0x24')](handleEntityNotFound(_0x1e8f63,null))[_0xedd8('0x24')](saveUpdates(_0x2bf950[_0xedd8('0x5d')],null))[_0xedd8('0x24')](respondWithResult(_0x1e8f63,null))[_0xedd8('0x2f')](handleError(_0x1e8f63,null));};exports['destroy']=function(_0x3cc716,_0x3de324){return db[_0xedd8('0x41')][_0xedd8('0x5c')]({'where':{'id':_0x3cc716[_0xedd8('0x5b')]['id']}})[_0xedd8('0x24')](handleEntityNotFound(_0x3de324,null))[_0xedd8('0x24')](removeEntity(_0x3de324,null))[_0xedd8('0x2f')](handleError(_0x3de324,null));};exports['describe']=function(_0x339e1c,_0x200e81){return db[_0xedd8('0x41')]['describe']()['then'](respondWithResult(_0x200e81,null))[_0xedd8('0x2f')](handleError(_0x200e81,null));};var interaction_log=require('../../config/logger')(_0xedd8('0x5e'));exports[_0xedd8('0x5f')]=function(_0x4e9aa6,_0x81f72e,_0x453b3a){var _0x4f6920={'agent':{},'channel':_0xedd8('0x60')};if(_0x4e9aa6[_0xedd8('0x5d')]['id']){delete _0x4e9aa6[_0xedd8('0x5d')]['id'];}_0x4e9aa6[_0xedd8('0x5d')][_0xedd8('0x61')]=!![];_0x4e9aa6[_0xedd8('0x5d')][_0xedd8('0x62')]=moment()['format'](_0xedd8('0x63'));_0x4e9aa6[_0xedd8('0x5d')]['UserId']=_0x4e9aa6[_0xedd8('0x5d')]['UserId']||_0x4e9aa6[_0xedd8('0x64')]['id'];_0x4f6920[_0xedd8('0x65')]['id']=_0x4e9aa6['body'][_0xedd8('0x66')];return db['FaxMessage'][_0xedd8('0x5c')]({'where':{'id':_0x4e9aa6[_0xedd8('0x5b')]['id'],'UserId':null}})[_0xedd8('0x24')](handleEntityNotFound(_0x81f72e,null))[_0xedd8('0x24')](saveUpdates(_0x4e9aa6['body'],null))[_0xedd8('0x24')](function(_0x5e568e){if(_0x5e568e){_0x4f6920[_0xedd8('0x2d')]=_0x5e568e[_0xedd8('0x67')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x5e568e[_0xedd8('0x68')]}});}return null;})[_0xedd8('0x24')](handleEntityNotFound(_0x81f72e,null))[_0xedd8('0x24')](function(_0x42728d){if(_0x42728d){return _0x42728d['update']({'UserId':_0x4e9aa6[_0xedd8('0x5d')][_0xedd8('0x66')],'read1stAt':_[_0xedd8('0x69')](_0x42728d[_0xedd8('0x6a')])?moment()[_0xedd8('0x6b')](_0xedd8('0x63')):undefined});}return null;})[_0xedd8('0x24')](function(_0x752a19){if(_0x752a19){_0x4f6920[_0xedd8('0x6c')]=_0x752a19[_0xedd8('0x67')]({'plain':!![]});interaction_log[_0xedd8('0x25')](_0xedd8('0x6d'),_0x4e9aa6[_0xedd8('0x64')]['id'],_0x4e9aa6[_0xedd8('0x64')]['name'],_0x4e9aa6[_0xedd8('0x64')][_0xedd8('0x6e')],_0x4f6920[_0xedd8('0x6c')]['id'],_0x4e9aa6[_0xedd8('0x5d')]?JSON[_0xedd8('0x29')](_0x4e9aa6['body']):_0xedd8('0x6f'));return respondWithRpcPromise(_0xedd8('0x70'),_0xedd8('0x71'),_0x4f6920);}return null;})[_0xedd8('0x24')](function(_0x58aa2d){var _0xfe39f=_0xedd8('0x72')+_0x58aa2d[_0xedd8('0x2d')][_0xedd8('0x73')];return db[_0xedd8('0x74')]['query'](_0xfe39f,{'type':db[_0xedd8('0x75')]['QueryTypes'][_0xedd8('0x76')],'raw':!![]})['then'](function(_0xcb2700){return _0xcb2700;});})['then'](function(_0x47a122){if(_0x47a122){_0x4f6920[_0xedd8('0x2d')][_0xedd8('0x77')]=_0x47a122[0x0];if(!_0x4e9aa6[_0xedd8('0x5d')][_0xedd8('0x66')])return;return db[_0xedd8('0x78')][_0xedd8('0x5c')]({'where':{'id':_0x4e9aa6[_0xedd8('0x5d')]['UserId'],'role':_0xedd8('0x65')},'attributes':['id',_0xedd8('0x47'),'fullname','email',_0xedd8('0x79')],'raw':!![]});}return null;})[_0xedd8('0x24')](function(_0x2379b8){if(!_0x2379b8)return null;_0x4f6920[_0xedd8('0x2d')]['agent']=_0x2379b8;return _0x4f6920;})['then'](function(_0x35f1f9){if(_0x35f1f9){if(_0x4e9aa6[_0xedd8('0x5d')][_0xedd8('0x7a')]){_0x4f6920['message']['interface']=util['format'](_0xedd8('0x7b'),_0x4e9aa6[_0xedd8('0x64')][_0xedd8('0x47')]);_0x4f6920['message'][_0xedd8('0x7c')]=_0x4f6920[_0xedd8('0x7c')];_0x4f6920[_0xedd8('0x2d')][_0xedd8('0x7d')]=_0x4f6920[_0xedd8('0x7c')];_0x4f6920['message'][_0xedd8('0x7e')]='accept';return respondWithRpcPromise('EventManager',_0xedd8('0x7f'),{'event':'acceptmessage','message':_0x4f6920[_0xedd8('0x2d')]},client9002)['then'](function(){return _0x4f6920;});}return _0x4f6920;}return null;})[_0xedd8('0x24')](respondWithResult(_0x81f72e,null))[_0xedd8('0x2f')](handleError(_0x81f72e,null));};var interaction_log=require(_0xedd8('0x15'))(_0xedd8('0x5e'));exports[_0xedd8('0x39')]=function(_0x23a8e2,_0x861800,_0x3e2246){var _0x25eba5={'agent':{},'channel':_0xedd8('0x60')};if(_0x23a8e2[_0xedd8('0x5d')]['id']){delete _0x23a8e2[_0xedd8('0x5d')]['id'];}_0x23a8e2[_0xedd8('0x5d')][_0xedd8('0x66')]=_0x23a8e2['body']['UserId']||_0x23a8e2[_0xedd8('0x64')]['id'];_0x25eba5['agent']['id']=_0x23a8e2[_0xedd8('0x5d')][_0xedd8('0x66')];return db['FaxMessage']['find']({'where':{'id':_0x23a8e2[_0xedd8('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x861800,null))['then'](function(_0xfb8800){if(_0xfb8800){_0x25eba5[_0xedd8('0x2d')]=_0xfb8800[_0xedd8('0x67')]({'plain':!![]});return db[_0xedd8('0x80')]['find']({'where':{'id':_0xfb8800[_0xedd8('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x861800,null))[_0xedd8('0x24')](function(_0x5dd0c8){if(_0x5dd0c8){_0x25eba5['interaction']=_0x5dd0c8[_0xedd8('0x67')]({'plain':!![]});interaction_log['info'](_0xedd8('0x81'),_0x23a8e2['user']['id'],_0x23a8e2[_0xedd8('0x64')][_0xedd8('0x47')],_0x23a8e2['user']['role'],_0x25eba5[_0xedd8('0x6c')]['id'],_0x23a8e2['body']?JSON[_0xedd8('0x29')](_0x23a8e2[_0xedd8('0x5d')]):_0xedd8('0x6f'));return respondWithRpcPromise(_0xedd8('0x82'),_0xedd8('0x83'),_0x25eba5);}return null;})['then'](function(_0x51a2dc){var _0x2c9e31=_0xedd8('0x72')+_0x51a2dc[_0xedd8('0x2d')][_0xedd8('0x73')];return db['sequelize'][_0xedd8('0x48')](_0x2c9e31,{'type':db[_0xedd8('0x75')]['QueryTypes'][_0xedd8('0x76')],'raw':!![]})[_0xedd8('0x24')](function(_0xc2d2ab){return _0xc2d2ab;});})[_0xedd8('0x24')](function(_0x9cce11){if(_0x9cce11){_0x25eba5[_0xedd8('0x2d')][_0xedd8('0x77')]=_0x9cce11[0x0];if(!_0x23a8e2['body']['UserId'])return;return db['User'][_0xedd8('0x5c')]({'where':{'id':_0x23a8e2[_0xedd8('0x5d')][_0xedd8('0x66')],'role':_0xedd8('0x65')},'attributes':['id',_0xedd8('0x47'),_0xedd8('0x84'),_0xedd8('0x85'),'internal'],'raw':!![]});}return null;})['then'](function(_0x58fb0d){if(!_0x58fb0d)return null;_0x25eba5[_0xedd8('0x2d')]['agent']=_0x58fb0d;return _0x25eba5;})['then'](function(_0x239bd3){if(_0x239bd3){_0x239bd3[_0xedd8('0x2d')]['interface']=util[_0xedd8('0x6b')](_0xedd8('0x7b'),_0x23a8e2[_0xedd8('0x64')][_0xedd8('0x47')]);_0x239bd3[_0xedd8('0x2d')]['channel']=_0x25eba5[_0xedd8('0x7c')];_0x239bd3[_0xedd8('0x2d')][_0xedd8('0x7d')]=_0x25eba5['channel'];_0x239bd3[_0xedd8('0x2d')][_0xedd8('0x7e')]=_0xedd8('0x39');respondWithRpcPromise('EventManager','EventManager',{'event':_0xedd8('0x86'),'message':_0x239bd3['message']},client9002);return _0x25eba5;}return null;})[_0xedd8('0x24')](respondWithResult(_0x861800,null))[_0xedd8('0x2f')](handleError(_0x861800,null));};exports['create']=function(_0x258b11,_0x420227){var _0x48ff7a;return db[_0xedd8('0x41')]['create'](_0x258b11['body'],{})[_0xedd8('0x24')](function(_0x5df4f3){_0x48ff7a=_0x5df4f3;return db[_0xedd8('0x87')]['findOne']({'where':{'id':_0x48ff7a['ContactId']}});})[_0xedd8('0x24')](function(_0x31a171){if(_[_0xedd8('0x69')](_0x31a171)){return;}else{_0x48ff7a['fax']=_0x31a171[_0xedd8('0x60')];return db[_0xedd8('0x88')][_0xedd8('0x89')]({'where':{'id':_0x48ff7a[_0xedd8('0x8a')]}});}})[_0xedd8('0x24')](function(_0xb6686a){return respondWithRpcPromise(_0xedd8('0x8b'),_0xedd8('0x8b'),{'FaxAccountId':_[_0xedd8('0x69')](_0x258b11[_0xedd8('0x5d')])?undefined:_0x258b11[_0xedd8('0x5d')][_0xedd8('0x8c')],'path':_[_0xedd8('0x69')](_0xb6686a)?undefined:util[_0xedd8('0x6b')](_0xedd8('0x8d'),_0xb6686a[_0xedd8('0x8e')]),'fax':_[_0xedd8('0x69')](_0x48ff7a[_0xedd8('0x60')])?undefined:_0x48ff7a[_0xedd8('0x60')],'AttachmentId':_0x48ff7a[_0xedd8('0x8a')]},client9002);})[_0xedd8('0x24')](respondWithResult(_0x420227,0xc9))[_0xedd8('0x2f')](handleError(_0x420227,null));};exports['download']=function(_0x4a11ba,_0x4f53c2){var _0x46da9c=path[_0xedd8('0x8f')](config['root'],_0xedd8('0x90'),'files','attachments');return db[_0xedd8('0x41')][_0xedd8('0x5c')]({'where':{'id':_0x4a11ba[_0xedd8('0x5b')]['id']},'include':[{'model':db[_0xedd8('0x88')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x4f53c2,null))[_0xedd8('0x24')](function(_0x3de0e5){if(_0x3de0e5){return _0x4f53c2[_0xedd8('0x91')](path['join'](_0x46da9c,_0x3de0e5[_0xedd8('0x88')][_0xedd8('0x8e')]));}})[_0xedd8('0x2f')](handleError(_0x4f53c2,null));}; \ No newline at end of file +var _0x9cdf=['catch','params','include','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE: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','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','channel','motionChannel','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','rejectmessage','CmContact','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','pick','where','merge','filter','options','rows'];(function(_0x40c623,_0x5f45b7){var _0x982e14=function(_0x49dcef){while(--_0x49dcef){_0x40c623['push'](_0x40c623['shift']());}};_0x982e14(++_0x5f45b7);}(_0x9cdf,0x1e5));var _0xf9cd=function(_0x51a041,_0x2b9325){_0x51a041=_0x51a041-0x0;var _0x27984d=_0x9cdf[_0x51a041];return _0x27984d;};'use strict';var emlformat=require(_0xf9cd('0x0'));var rimraf=require(_0xf9cd('0x1'));var zipdir=require(_0xf9cd('0x2'));var jsonpatch=require(_0xf9cd('0x3'));var rp=require(_0xf9cd('0x4'));var moment=require(_0xf9cd('0x5'));var BPromise=require(_0xf9cd('0x6'));var Mustache=require(_0xf9cd('0x7'));var util=require(_0xf9cd('0x8'));var path=require('path');var sox=require(_0xf9cd('0x9'));var csv=require(_0xf9cd('0xa'));var ejs=require(_0xf9cd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9cd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf9cd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf9cd('0xe'));var Papa=require('papaparse');var Redis=require(_0xf9cd('0xf'));var authService=require(_0xf9cd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf9cd('0x11'));var hardwareService=require(_0xf9cd('0x12'));var logger=require(_0xf9cd('0x13'))('api');var utils=require(_0xf9cd('0x14'));var config=require(_0xf9cd('0x15'));var licenseUtil=require(_0xf9cd('0x16'));var db=require(_0xf9cd('0x17'))['db'];config[_0xf9cd('0x18')]=_[_0xf9cd('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf9cd('0x1a'))(new Redis(config[_0xf9cd('0x18')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xf9cd('0x1b'));var client=jayson[_0xf9cd('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xf9cd('0x1c')][_0xf9cd('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3b887a,_0x4c57dc,_0x143e55,_0x3952af){return new BPromise(function(_0x520c8d,_0x1a0b65){var _0x4b59ec=_0x3952af||client;return _0x4b59ec['request'](_0x3b887a,_0x143e55)[_0xf9cd('0x1e')](function(_0x53724d){logger[_0xf9cd('0x1f')](_0xf9cd('0x20'),_0x4c57dc,_0xf9cd('0x21'));logger[_0xf9cd('0x22')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4c57dc,'request\x20sent',JSON[_0xf9cd('0x23')](_0x53724d));if(_0x53724d[_0xf9cd('0x24')]){if(_0x53724d[_0xf9cd('0x24')][_0xf9cd('0x25')]===0x1f4){logger['error'](_0xf9cd('0x20'),_0x4c57dc,_0x53724d[_0xf9cd('0x24')]['message']);return _0x1a0b65(_0x53724d[_0xf9cd('0x24')][_0xf9cd('0x26')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x4c57dc,_0x53724d['error'][_0xf9cd('0x26')]);return _0x520c8d(_0x53724d[_0xf9cd('0x24')][_0xf9cd('0x26')]);}else{logger[_0xf9cd('0x1f')](_0xf9cd('0x20'),_0x4c57dc,'request\x20sent');_0x520c8d(_0x53724d[_0xf9cd('0x27')][_0xf9cd('0x26')]);}})['catch'](function(_0x58a28c){logger[_0xf9cd('0x24')](_0xf9cd('0x20'),_0x4c57dc,_0x58a28c);_0x1a0b65(_0x58a28c);});});}function respondWithStatusCode(_0x8fdb21,_0x48c60e){_0x48c60e=_0x48c60e||0xcc;return function(_0x449c43){if(_0x449c43){return _0x8fdb21[_0xf9cd('0x28')](_0x48c60e);}return _0x8fdb21['status'](_0x48c60e)[_0xf9cd('0x29')]();};}function respondWithResult(_0x517a71,_0x9c2df3){_0x9c2df3=_0x9c2df3||0xc8;return function(_0x1ea6fa){if(_0x1ea6fa){return _0x517a71[_0xf9cd('0x2a')](_0x9c2df3)[_0xf9cd('0x2b')](_0x1ea6fa);}};}function respondWithFilteredResult(_0x1f99d9,_0x38e32e){return function(_0x3463a6){if(_0x3463a6){var _0x198428=typeof _0x38e32e['offset']==='undefined'&&typeof _0x38e32e[_0xf9cd('0x2c')]===_0xf9cd('0x2d');var _0x7672c=_0x3463a6[_0xf9cd('0x2e')];var _0x5bd779=_0x198428?0x0:_0x38e32e[_0xf9cd('0x2f')];var _0x3f29c2=_0x198428?_0x3463a6[_0xf9cd('0x2e')]:_0x38e32e['offset']+_0x38e32e[_0xf9cd('0x2c')];var _0x16fde0;if(_0x3f29c2>=_0x7672c){_0x3f29c2=_0x7672c;_0x16fde0=0xc8;}else{_0x16fde0=0xce;}_0x1f99d9[_0xf9cd('0x2a')](_0x16fde0);return _0x1f99d9[_0xf9cd('0x30')](_0xf9cd('0x31'),_0x5bd779+'-'+_0x3f29c2+'/'+_0x7672c)['json'](_0x3463a6);}return null;};}function patchUpdates(_0x307462){return function(_0x2386d9){try{jsonpatch[_0xf9cd('0x32')](_0x2386d9,_0x307462,!![]);}catch(_0x291a4c){return BPromise[_0xf9cd('0x33')](_0x291a4c);}return _0x2386d9['save']();};}function saveUpdates(_0x2c08ff,_0xeabfd0){return function(_0x500ce5){if(_0x500ce5){return _0x500ce5[_0xf9cd('0x34')](_0x2c08ff)['then'](function(_0x3160f7){return _0x3160f7;});}return null;};}function removeEntity(_0x1a2077,_0x26221f){return function(_0x59ca56){if(_0x59ca56){return _0x59ca56[_0xf9cd('0x35')]()['then'](function(){_0x1a2077[_0xf9cd('0x2a')](0xcc)[_0xf9cd('0x29')]();});}};}function handleEntityNotFound(_0x2245df,_0x3716e8){return function(_0x2c49a2){if(!_0x2c49a2){_0x2245df[_0xf9cd('0x28')](0x194);}return _0x2c49a2;};}function handleError(_0x27ef8a,_0xc95ab5){_0xc95ab5=_0xc95ab5||0x1f4;return function(_0x127c7b){logger['error'](_0x127c7b[_0xf9cd('0x36')]);if(_0x127c7b[_0xf9cd('0x37')]){delete _0x127c7b['name'];}_0x27ef8a['status'](_0xc95ab5)[_0xf9cd('0x38')](_0x127c7b);};}exports[_0xf9cd('0x39')]=function(_0x153747,_0x4a2525){var _0x3ac842={},_0x8f4476={},_0x4d87ad={'count':0x0,'rows':[]};var _0x203059=_[_0xf9cd('0x3a')](db[_0xf9cd('0x3b')][_0xf9cd('0x3c')],function(_0x2878d9){return{'name':_0x2878d9[_0xf9cd('0x3d')],'type':_0x2878d9[_0xf9cd('0x3e')][_0xf9cd('0x3f')]};});_0x8f4476[_0xf9cd('0x40')]=_[_0xf9cd('0x3a')](_0x203059,_0xf9cd('0x37'));_0x8f4476['query']=_[_0xf9cd('0x41')](_0x153747[_0xf9cd('0x42')]);_0x8f4476[_0xf9cd('0x43')]=_['intersection'](_0x8f4476['model'],_0x8f4476[_0xf9cd('0x42')]);_0x3ac842['attributes']=_[_0xf9cd('0x44')](_0x8f4476[_0xf9cd('0x40')],qs[_0xf9cd('0x45')](_0x153747[_0xf9cd('0x42')][_0xf9cd('0x45')]));_0x3ac842['attributes']=_0x3ac842[_0xf9cd('0x46')]['length']?_0x3ac842[_0xf9cd('0x46')]:_0x8f4476[_0xf9cd('0x40')];if(!_0x153747[_0xf9cd('0x42')][_0xf9cd('0x47')]('nolimit')){_0x3ac842[_0xf9cd('0x2c')]=qs[_0xf9cd('0x2c')](_0x153747['query'][_0xf9cd('0x2c')]);_0x3ac842['offset']=qs[_0xf9cd('0x2f')](_0x153747['query'][_0xf9cd('0x2f')]);}_0x3ac842[_0xf9cd('0x48')]=qs['sort'](_0x153747[_0xf9cd('0x42')]['sort']);_0x3ac842['where']=qs[_0xf9cd('0x43')](_[_0xf9cd('0x49')](_0x153747[_0xf9cd('0x42')],_0x8f4476[_0xf9cd('0x43')]),_0x203059);if(_0x153747[_0xf9cd('0x42')]['filter']){_0x3ac842[_0xf9cd('0x4a')]=_[_0xf9cd('0x4b')](_0x3ac842[_0xf9cd('0x4a')],{'$or':_['map'](_0x203059,function(_0x4418be){if(_0x4418be[_0xf9cd('0x3e')]!=='VIRTUAL'){var _0x511b86={};_0x511b86[_0x4418be[_0xf9cd('0x37')]]={'$like':'%'+_0x153747[_0xf9cd('0x42')][_0xf9cd('0x4c')]+'%'};return _0x511b86;}})});}_0x3ac842=_[_0xf9cd('0x4b')]({},_0x3ac842,_0x153747[_0xf9cd('0x4d')]);var _0x78023={'where':_0x3ac842[_0xf9cd('0x4a')]};return db['FaxMessage'][_0xf9cd('0x2e')](_0x78023)['then'](function(_0x2e686c){_0x4d87ad[_0xf9cd('0x2e')]=_0x2e686c;if(_0x153747['query']['includeAll']){_0x3ac842['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3ac842);})[_0xf9cd('0x1e')](function(_0x5ec3f0){_0x4d87ad[_0xf9cd('0x4e')]=_0x5ec3f0;return _0x4d87ad;})[_0xf9cd('0x1e')](respondWithFilteredResult(_0x4a2525,_0x3ac842))[_0xf9cd('0x4f')](handleError(_0x4a2525,null));};exports['show']=function(_0x430988,_0x3ce665){var _0x389745={'raw':!![],'where':{'id':_0x430988[_0xf9cd('0x50')]['id']}},_0x54e2b9={};_0x54e2b9['model']=_[_0xf9cd('0x41')](db['FaxMessage']['rawAttributes']);_0x54e2b9['query']=_[_0xf9cd('0x41')](_0x430988[_0xf9cd('0x42')]);_0x54e2b9[_0xf9cd('0x43')]=_[_0xf9cd('0x44')](_0x54e2b9[_0xf9cd('0x40')],_0x54e2b9['query']);_0x389745[_0xf9cd('0x46')]=_[_0xf9cd('0x44')](_0x54e2b9[_0xf9cd('0x40')],qs['fields'](_0x430988[_0xf9cd('0x42')]['fields']));_0x389745[_0xf9cd('0x46')]=_0x389745[_0xf9cd('0x46')]['length']?_0x389745[_0xf9cd('0x46')]:_0x54e2b9[_0xf9cd('0x40')];if(_0x430988['query']['includeAll']){_0x389745[_0xf9cd('0x51')]=[{'all':!![]}];}_0x389745=_[_0xf9cd('0x4b')]({},_0x389745,_0x430988['options']);return db[_0xf9cd('0x3b')][_0xf9cd('0x52')](_0x389745)['then'](handleEntityNotFound(_0x3ce665,null))[_0xf9cd('0x1e')](respondWithResult(_0x3ce665,null))[_0xf9cd('0x4f')](handleError(_0x3ce665,null));};exports[_0xf9cd('0x34')]=function(_0x4224a7,_0x50624b){if(_0x4224a7[_0xf9cd('0x53')]['id']){delete _0x4224a7[_0xf9cd('0x53')]['id'];}return db['FaxMessage'][_0xf9cd('0x52')]({'where':{'id':_0x4224a7[_0xf9cd('0x50')]['id']}})[_0xf9cd('0x1e')](handleEntityNotFound(_0x50624b,null))[_0xf9cd('0x1e')](saveUpdates(_0x4224a7['body'],null))['then'](respondWithResult(_0x50624b,null))[_0xf9cd('0x4f')](handleError(_0x50624b,null));};exports[_0xf9cd('0x35')]=function(_0x37f3b,_0x157694){return db[_0xf9cd('0x3b')][_0xf9cd('0x52')]({'where':{'id':_0x37f3b[_0xf9cd('0x50')]['id']}})[_0xf9cd('0x1e')](handleEntityNotFound(_0x157694,null))['then'](removeEntity(_0x157694,null))['catch'](handleError(_0x157694,null));};exports[_0xf9cd('0x54')]=function(_0x38f4eb,_0xd6fff8){return db['FaxMessage'][_0xf9cd('0x54')]()['then'](respondWithResult(_0xd6fff8,null))[_0xf9cd('0x4f')](handleError(_0xd6fff8,null));};var interaction_log=require(_0xf9cd('0x13'))(_0xf9cd('0x55'));exports[_0xf9cd('0x56')]=function(_0x51fabc,_0xbabeb3,_0x4821df){var _0xf056aa={'agent':{},'channel':_0xf9cd('0x57')};if(_0x51fabc[_0xf9cd('0x53')]['id']){delete _0x51fabc[_0xf9cd('0x53')]['id'];}_0x51fabc[_0xf9cd('0x53')][_0xf9cd('0x58')]=!![];_0x51fabc[_0xf9cd('0x53')][_0xf9cd('0x59')]=moment()[_0xf9cd('0x5a')](_0xf9cd('0x5b'));_0x51fabc[_0xf9cd('0x53')][_0xf9cd('0x5c')]=_0x51fabc[_0xf9cd('0x53')]['UserId']||_0x51fabc[_0xf9cd('0x5d')]['id'];_0xf056aa[_0xf9cd('0x5e')]['id']=_0x51fabc[_0xf9cd('0x53')]['UserId'];return db[_0xf9cd('0x3b')]['find']({'where':{'id':_0x51fabc['params']['id'],'UserId':null}})[_0xf9cd('0x1e')](handleEntityNotFound(_0xbabeb3,null))[_0xf9cd('0x1e')](saveUpdates(_0x51fabc[_0xf9cd('0x53')],null))[_0xf9cd('0x1e')](function(_0xa87b56){if(_0xa87b56){_0xf056aa[_0xf9cd('0x26')]=_0xa87b56[_0xf9cd('0x5f')]({'plain':!![]});return db[_0xf9cd('0x60')][_0xf9cd('0x52')]({'where':{'id':_0xa87b56[_0xf9cd('0x61')]}});}return null;})[_0xf9cd('0x1e')](handleEntityNotFound(_0xbabeb3,null))['then'](function(_0x742043){if(_0x742043){return _0x742043[_0xf9cd('0x34')]({'UserId':_0x51fabc['body']['UserId'],'read1stAt':_['isNil'](_0x742043[_0xf9cd('0x62')])?moment()[_0xf9cd('0x5a')](_0xf9cd('0x5b')):undefined});}return null;})[_0xf9cd('0x1e')](function(_0x3b40fc){if(_0x3b40fc){_0xf056aa[_0xf9cd('0x63')]=_0x3b40fc[_0xf9cd('0x5f')]({'plain':!![]});interaction_log[_0xf9cd('0x1f')](_0xf9cd('0x64'),_0x51fabc[_0xf9cd('0x5d')]['id'],_0x51fabc[_0xf9cd('0x5d')][_0xf9cd('0x37')],_0x51fabc[_0xf9cd('0x5d')][_0xf9cd('0x65')],_0xf056aa[_0xf9cd('0x63')]['id'],_0x51fabc['body']?JSON['stringify'](_0x51fabc[_0xf9cd('0x53')]):_0xf9cd('0x66'));return respondWithRpcPromise(_0xf9cd('0x67'),_0xf9cd('0x68'),_0xf056aa);}return null;})[_0xf9cd('0x1e')](function(_0x1b0279){var _0x44d68a=_0xf9cd('0x69')+_0x1b0279[_0xf9cd('0x26')][_0xf9cd('0x6a')];return db[_0xf9cd('0x6b')][_0xf9cd('0x42')](_0x44d68a,{'type':db[_0xf9cd('0x6c')][_0xf9cd('0x6d')][_0xf9cd('0x6e')],'raw':!![]})[_0xf9cd('0x1e')](function(_0x2633dd){return _0x2633dd;});})['then'](function(_0x32546f){if(_0x32546f){_0xf056aa[_0xf9cd('0x26')][_0xf9cd('0x6f')]=_0x32546f[0x0];if(!_0x51fabc['body'][_0xf9cd('0x5c')])return;return db[_0xf9cd('0x70')][_0xf9cd('0x52')]({'where':{'id':_0x51fabc['body'][_0xf9cd('0x5c')],'role':_0xf9cd('0x5e')},'attributes':['id','name',_0xf9cd('0x71'),_0xf9cd('0x72'),_0xf9cd('0x73')],'raw':!![]});}return null;})[_0xf9cd('0x1e')](function(_0x7eb82f){if(!_0x7eb82f)return null;_0xf056aa['message'][_0xf9cd('0x5e')]=_0x7eb82f;return _0xf056aa;})[_0xf9cd('0x1e')](function(_0x5b7e2a){if(_0x5b7e2a){if(_0x51fabc[_0xf9cd('0x53')][_0xf9cd('0x74')]){_0xf056aa['message']['interface']=util[_0xf9cd('0x5a')]('SIP/%s',_0x51fabc['user']['name']);_0xf056aa[_0xf9cd('0x26')]['channel']=_0xf056aa[_0xf9cd('0x75')];_0xf056aa[_0xf9cd('0x26')][_0xf9cd('0x76')]=_0xf056aa[_0xf9cd('0x75')];_0xf056aa[_0xf9cd('0x26')]['event']=_0xf9cd('0x56');return respondWithRpcPromise(_0xf9cd('0x77'),'EventManager',{'event':_0xf9cd('0x78'),'message':_0xf056aa[_0xf9cd('0x26')]},client9002)[_0xf9cd('0x1e')](function(){return _0xf056aa;});}return _0xf056aa;}return null;})[_0xf9cd('0x1e')](respondWithResult(_0xbabeb3,null))[_0xf9cd('0x4f')](handleError(_0xbabeb3,null));};var interaction_log=require('../../config/logger')(_0xf9cd('0x55'));exports[_0xf9cd('0x33')]=function(_0x78cfad,_0x2b803d,_0x55f1ab){var _0x190f33={'agent':{},'channel':'fax'};if(_0x78cfad[_0xf9cd('0x53')]['id']){delete _0x78cfad[_0xf9cd('0x53')]['id'];}_0x78cfad[_0xf9cd('0x53')][_0xf9cd('0x5c')]=_0x78cfad['body']['UserId']||_0x78cfad['user']['id'];_0x190f33[_0xf9cd('0x5e')]['id']=_0x78cfad[_0xf9cd('0x53')][_0xf9cd('0x5c')];return db[_0xf9cd('0x3b')][_0xf9cd('0x52')]({'where':{'id':_0x78cfad[_0xf9cd('0x50')]['id'],'UserId':null}})[_0xf9cd('0x1e')](handleEntityNotFound(_0x2b803d,null))[_0xf9cd('0x1e')](function(_0x1dcc99){if(_0x1dcc99){_0x190f33['message']=_0x1dcc99[_0xf9cd('0x5f')]({'plain':!![]});return db['FaxInteraction'][_0xf9cd('0x52')]({'where':{'id':_0x1dcc99[_0xf9cd('0x61')]}});}return null;})[_0xf9cd('0x1e')](handleEntityNotFound(_0x2b803d,null))[_0xf9cd('0x1e')](function(_0x4a6012){if(_0x4a6012){_0x190f33[_0xf9cd('0x63')]=_0x4a6012[_0xf9cd('0x5f')]({'plain':!![]});interaction_log[_0xf9cd('0x1f')](_0xf9cd('0x79'),_0x78cfad[_0xf9cd('0x5d')]['id'],_0x78cfad[_0xf9cd('0x5d')][_0xf9cd('0x37')],_0x78cfad[_0xf9cd('0x5d')][_0xf9cd('0x65')],_0x190f33[_0xf9cd('0x63')]['id'],_0x78cfad['body']?JSON[_0xf9cd('0x23')](_0x78cfad[_0xf9cd('0x53')]):_0xf9cd('0x66'));return respondWithRpcPromise(_0xf9cd('0x7a'),_0xf9cd('0x7b'),_0x190f33);}return null;})['then'](function(_0x2cb5ee){var _0x5266e9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2cb5ee['message'][_0xf9cd('0x6a')];return db['sequelize']['query'](_0x5266e9,{'type':db[_0xf9cd('0x6c')]['QueryTypes'][_0xf9cd('0x6e')],'raw':!![]})[_0xf9cd('0x1e')](function(_0x461581){return _0x461581;});})['then'](function(_0xbe8202){if(_0xbe8202){_0x190f33['message'][_0xf9cd('0x6f')]=_0xbe8202[0x0];if(!_0x78cfad[_0xf9cd('0x53')][_0xf9cd('0x5c')])return;return db[_0xf9cd('0x70')][_0xf9cd('0x52')]({'where':{'id':_0x78cfad[_0xf9cd('0x53')][_0xf9cd('0x5c')],'role':_0xf9cd('0x5e')},'attributes':['id',_0xf9cd('0x37'),_0xf9cd('0x71'),_0xf9cd('0x72'),'internal'],'raw':!![]});}return null;})[_0xf9cd('0x1e')](function(_0x234888){if(!_0x234888)return null;_0x190f33[_0xf9cd('0x26')]['agent']=_0x234888;return _0x190f33;})[_0xf9cd('0x1e')](function(_0x1d2388){if(_0x1d2388){_0x1d2388[_0xf9cd('0x26')]['interface']=util[_0xf9cd('0x5a')](_0xf9cd('0x7c'),_0x78cfad[_0xf9cd('0x5d')][_0xf9cd('0x37')]);_0x1d2388['message'][_0xf9cd('0x75')]=_0x190f33['channel'];_0x1d2388[_0xf9cd('0x26')][_0xf9cd('0x76')]=_0x190f33['channel'];_0x1d2388['message'][_0xf9cd('0x7d')]='reject';respondWithRpcPromise(_0xf9cd('0x77'),'EventManager',{'event':_0xf9cd('0x7e'),'message':_0x1d2388[_0xf9cd('0x26')]},client9002);return _0x190f33;}return null;})[_0xf9cd('0x1e')](respondWithResult(_0x2b803d,null))[_0xf9cd('0x4f')](handleError(_0x2b803d,null));};exports['create']=function(_0x1e7945,_0x2b10d2){var _0x4f160f;return db['FaxMessage']['create'](_0x1e7945[_0xf9cd('0x53')],{})['then'](function(_0x3ed192){_0x4f160f=_0x3ed192;return db[_0xf9cd('0x7f')][_0xf9cd('0x80')]({'where':{'id':_0x4f160f['ContactId']}});})[_0xf9cd('0x1e')](function(_0x57ca8a){if(_[_0xf9cd('0x81')](_0x57ca8a)){return;}else{_0x4f160f[_0xf9cd('0x57')]=_0x57ca8a[_0xf9cd('0x57')];return db[_0xf9cd('0x82')][_0xf9cd('0x80')]({'where':{'id':_0x4f160f['AttachmentId']}});}})[_0xf9cd('0x1e')](function(_0x2b51c9){return respondWithRpcPromise(_0xf9cd('0x83'),'SendFax',{'FaxAccountId':_[_0xf9cd('0x81')](_0x1e7945[_0xf9cd('0x53')])?undefined:_0x1e7945[_0xf9cd('0x53')][_0xf9cd('0x84')],'path':_[_0xf9cd('0x81')](_0x2b51c9)?undefined:util[_0xf9cd('0x5a')](_0xf9cd('0x85'),_0x2b51c9[_0xf9cd('0x86')]),'fax':_[_0xf9cd('0x81')](_0x4f160f[_0xf9cd('0x57')])?undefined:_0x4f160f[_0xf9cd('0x57')],'AttachmentId':_0x4f160f[_0xf9cd('0x87')]},client9002);})[_0xf9cd('0x1e')](respondWithResult(_0x2b10d2,0xc9))[_0xf9cd('0x4f')](handleError(_0x2b10d2,null));};exports['download']=function(_0x1e708f,_0x5d81dc){var _0x4b8d91=path[_0xf9cd('0x88')](config[_0xf9cd('0x89')],_0xf9cd('0x8a'),_0xf9cd('0x8b'),_0xf9cd('0x8c'));return db[_0xf9cd('0x3b')]['find']({'where':{'id':_0x1e708f[_0xf9cd('0x50')]['id']},'include':[{'model':db[_0xf9cd('0x82')],'as':'Attachment'}]})[_0xf9cd('0x1e')](handleEntityNotFound(_0x5d81dc,null))[_0xf9cd('0x1e')](function(_0x1379ba){if(_0x1379ba){return _0x5d81dc['download'](path[_0xf9cd('0x88')](_0x4b8d91,_0x1379ba[_0xf9cd('0x82')]['basename']));}})[_0xf9cd('0x4f')](handleError(_0x5d81dc,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 4d59f1c..7204a1f 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 _0xee55=['events','FaxMessage','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee55,0x1a0));var _0x5ee5=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0xee55[_0x5b3950];return _0x41e436;};'use strict';var EventEmitter=require(_0x5ee5('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x5ee5('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ee5('0x2'),'afterUpdate':'update','afterDestroy':_0x5ee5('0x3')};function emitEvent(_0x2fc0fd){return function(_0x4e5f9b,_0x394334,_0x119392){FaxMessageEvents[_0x5ee5('0x4')](_0x2fc0fd+':'+_0x4e5f9b['id'],_0x4e5f9b);FaxMessageEvents[_0x5ee5('0x4')](_0x2fc0fd,_0x4e5f9b);_0x119392(null);};}for(var e in events){if(events[_0x5ee5('0x5')](e)){var event=events[e];FaxMessage[_0x5ee5('0x6')](e,emitEvent(event));}}module[_0x5ee5('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x15b2=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x929c7e,_0x38c4cc){var _0x5de099=function(_0xc4e8d8){while(--_0xc4e8d8){_0x929c7e['push'](_0x929c7e['shift']());}};_0x5de099(++_0x38c4cc);}(_0x15b2,0x145));var _0x215b=function(_0x3df7b8,_0x55db91){_0x3df7b8=_0x3df7b8-0x0;var _0x16f05d=_0x15b2[_0x3df7b8];return _0x16f05d;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x215b('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x215b('0x1')](0x0);var events={'afterCreate':_0x215b('0x2'),'afterUpdate':'update','afterDestroy':_0x215b('0x3')};function emitEvent(_0xe78f2d){return function(_0x62c5ce,_0x506d00,_0x56ada9){FaxMessageEvents[_0x215b('0x4')](_0xe78f2d+':'+_0x62c5ce['id'],_0x62c5ce);FaxMessageEvents['emit'](_0xe78f2d,_0x62c5ce);_0x56ada9(null);};}for(var e in events){if(events[_0x215b('0x5')](e)){var event=events[e];FaxMessage[_0x215b('0x6')](e,emitEvent(event));}}module[_0x215b('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index fc02dcb..8903b43 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 _0x7d63=['FaxMessage','fax_messages','models','get','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','update','direction','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./faxMessage.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d63,0xce));var _0x37d6=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x7d63[_0x3f0b30];return _0x2748a5;};'use strict';var _=require(_0x37d6('0x0'));var util=require(_0x37d6('0x1'));var logger=require(_0x37d6('0x2'))('api');var moment=require(_0x37d6('0x3'));var BPromise=require(_0x37d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37d6('0x5'));var rimraf=require(_0x37d6('0x6'));var config=require('../../config/environment');var attributes=require(_0x37d6('0x7'));module[_0x37d6('0x8')]=function(_0x23372f,_0x3df48){return _0x23372f[_0x37d6('0x9')](_0x37d6('0xa'),attributes,{'tableName':_0x37d6('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56b96c,_0x7f51ca,_0x216fd3){var _0x271de0=_0x23372f[_0x37d6('0xc')];var _0x1edf5e=_0x56b96c[_0x37d6('0xd')]({'plain':!![]});if(_0x1edf5e['direction'][_0x37d6('0xe')]()==='in'||_0x1edf5e['direction']['toLowerCase']()===_0x37d6('0xf')&&!_0x1edf5e[_0x37d6('0x10')]&&!_[_0x37d6('0x11')](_0x1edf5e[_0x37d6('0x12')])){_0x271de0['FaxInteraction'][_0x37d6('0x13')]({'where':{'id':_0x1edf5e[_0x37d6('0x14')]}})[_0x37d6('0x15')](function(_0x8e987c){if(_0x8e987c){_0x8e987c[_0x37d6('0x16')]({'lastMsgAt':_0x1edf5e['createdAt'],'lastMsgDirection':_0x1edf5e[_0x37d6('0x17')][_0x37d6('0xe')]()});}})[_0x37d6('0x18')](function(_0x5a3819){console['error'](_0x5a3819);});}_0x216fd3();}},'charset':_0x37d6('0x19'),'collate':_0x37d6('0x1a')});}; \ No newline at end of file +var _0x2806=['exports','fax_messages','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes'];(function(_0x27125a,_0x252d0d){var _0x391f7a=function(_0x4068fb){while(--_0x4068fb){_0x27125a['push'](_0x27125a['shift']());}};_0x391f7a(++_0x252d0d);}(_0x2806,0x12b));var _0x6280=function(_0x51c676,_0x26b35f){_0x51c676=_0x51c676-0x0;var _0x1befa4=_0x2806[_0x51c676];return _0x1befa4;};'use strict';var _=require(_0x6280('0x0'));var util=require(_0x6280('0x1'));var logger=require(_0x6280('0x2'))('api');var moment=require(_0x6280('0x3'));var BPromise=require(_0x6280('0x4'));var rp=require(_0x6280('0x5'));var fs=require('fs');var path=require(_0x6280('0x6'));var rimraf=require(_0x6280('0x7'));var config=require('../../config/environment');var attributes=require(_0x6280('0x8'));module[_0x6280('0x9')]=function(_0x1f02bd,_0x2f769){return _0x1f02bd['define']('FaxMessage',attributes,{'tableName':_0x6280('0xa'),'paranoid':![],'indexes':[{'name':_0x6280('0xb'),'fields':['body'],'type':_0x6280('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b2b85,_0x3ed483,_0x502c4e){var _0xee85d9=_0x1f02bd[_0x6280('0xd')];var _0x312ec0=_0x5b2b85['get']({'plain':!![]});if(_0x312ec0[_0x6280('0xe')]['toLowerCase']()==='in'||_0x312ec0['direction'][_0x6280('0xf')]()===_0x6280('0x10')&&!_0x312ec0[_0x6280('0x11')]&&!_[_0x6280('0x12')](_0x312ec0[_0x6280('0x13')])){_0xee85d9['FaxInteraction'][_0x6280('0x14')]({'where':{'id':_0x312ec0[_0x6280('0x15')]}})['then'](function(_0x1d0678){if(_0x1d0678){_0x1d0678[_0x6280('0x16')]({'lastMsgAt':_0x312ec0[_0x6280('0x17')],'lastMsgDirection':_0x312ec0[_0x6280('0xe')][_0x6280('0xf')]()});}})[_0x6280('0x18')](function(_0x44602e){console[_0x6280('0x19')](_0x44602e);});}_0x502c4e();}},'charset':_0x6280('0x1a'),'collate':_0x6280('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f99e201..3a822e8 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x16d7af,_0x485d45){var _0x4697cf=function(_0x173039){while(--_0x173039){_0x16d7af['push'](_0x16d7af['shift']());}};_0x4697cf(++_0x485d45);}(_0x008c,0x188));var _0xc008=function(_0x44c79f,_0x21f727){_0x44c79f=_0x44c79f-0x0;var _0x4089ef=_0x008c[_0x44c79f];return _0x4089ef;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file +var _0x4c4e=['localhost','socket.io-emitter','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','debug','stringify','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x30eb08,_0xcd9a6b){var _0x5356df=function(_0x1cf3eb){while(--_0x1cf3eb){_0x30eb08['push'](_0x30eb08['shift']());}};_0x5356df(++_0xcd9a6b);}(_0x4c4e,0x152));var _0xe4c4=function(_0x47deda,_0x703b0e){_0x47deda=_0x47deda-0x0;var _0x250c34=_0x4c4e[_0x47deda];return _0x250c34;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});config[_0xe4c4('0xa')]=_[_0xe4c4('0xb')](config[_0xe4c4('0xa')],{'host':_0xe4c4('0xc'),'port':0x18eb});var socket=require(_0xe4c4('0xd'))(new Redis(config[_0xe4c4('0xa')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x31f879,_0x6f2545,_0x27ad42){return new BPromise(function(_0x1bc786,_0x333c08){return client[_0xe4c4('0xe')](_0x31f879,_0x27ad42)['then'](function(_0x303d89){logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));logger['debug'](_0xe4c4('0x12'),_0x6f2545,_0xe4c4('0x11'),JSON['stringify'](_0x303d89));if(_0x303d89[_0xe4c4('0x13')]){if(_0x303d89[_0xe4c4('0x13')]['code']===0x1f4){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89['error'][_0xe4c4('0x14')]);return _0x333c08(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);return _0x1bc786(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}else{logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));_0x1bc786(_0x303d89[_0xe4c4('0x15')][_0xe4c4('0x14')]);}})[_0xe4c4('0x16')](function(_0x5a32b5){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x5a32b5);_0x333c08(_0x5a32b5);});});}exports[_0xe4c4('0x17')]=function(_0x317cc8){var _0x5da165=this;return new Promise(function(_0x3d5856,_0x1cad5d){return db[_0xe4c4('0x18')][_0xe4c4('0x19')](_0x317cc8[_0xe4c4('0x1a')],{'raw':_0x317cc8[_0xe4c4('0x1b')]?_0x317cc8[_0xe4c4('0x1b')][_0xe4c4('0x1c')]===undefined?!![]:![]:!![]})[_0xe4c4('0x1d')](function(_0x1a7690){logger[_0xe4c4('0xf')](_0xe4c4('0x17'),_0x317cc8);logger[_0xe4c4('0x1e')](_0xe4c4('0x17'),_0x317cc8,JSON[_0xe4c4('0x1f')](_0x1a7690));_0x3d5856(_0x1a7690);})['catch'](function(_0x49cadc){logger[_0xe4c4('0x13')]('CreateFaxMessage',_0x49cadc[_0xe4c4('0x14')],_0x317cc8);_0x1cad5d(_0x5da165['error'](0x1f4,_0x49cadc[_0xe4c4('0x14')]));});});};exports['UpdateFaxMessage']=function(_0x34d667){var _0x583393=this;return new Promise(function(_0xba53ef,_0x4a0199){return db['FaxMessage']['update'](_0x34d667['body'],{'raw':_0x34d667[_0xe4c4('0x1b')]?_0x34d667['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d667[_0xe4c4('0x1b')]?_0x34d667[_0xe4c4('0x1b')]['where']||null:null,'attributes':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x20')]||null:null,'limit':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x21')]||null:null})[_0xe4c4('0x1d')](function(_0x48060e){logger['info'](_0xe4c4('0x22'),_0x34d667);logger[_0xe4c4('0x1e')](_0xe4c4('0x22'),_0x34d667,JSON[_0xe4c4('0x1f')](_0x48060e));_0xba53ef(_0x48060e);})['catch'](function(_0x49c913){logger[_0xe4c4('0x13')](_0xe4c4('0x22'),_0x49c913['message'],_0x34d667);_0x4a0199(_0x583393[_0xe4c4('0x13')](0x1f4,_0x49c913[_0xe4c4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 9908fd8..3ca7685 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 _0x7a67=['save','remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x1149d4,_0x142918){var _0x41db59=function(_0x2394ed){while(--_0x2394ed){_0x1149d4['push'](_0x1149d4['shift']());}};_0x41db59(++_0x142918);}(_0x7a67,0x86));var _0x77a6=function(_0x2809eb,_0x4fe985){_0x2809eb=_0x2809eb-0x0;var _0x227578=_0x7a67[_0x2809eb];return _0x227578;};'use strict';var FaxMessageEvents=require(_0x77a6('0x0'));var events=[_0x77a6('0x1'),_0x77a6('0x2'),_0x77a6('0x3')];function createListener(_0x2c3791,_0x170718){return function(_0x4ab464){_0x170718[_0x77a6('0x4')](_0x2c3791,_0x4ab464);};}function removeListener(_0x26ad2d,_0x86d8b2){return function(){FaxMessageEvents[_0x77a6('0x5')](_0x26ad2d,_0x86d8b2);};}exports[_0x77a6('0x6')]=function(_0x450552){for(var _0x2d04ac=0x0,_0x1d9c6f=events[_0x77a6('0x7')];_0x2d04ac<_0x1d9c6f;_0x2d04ac++){var _0x13d8f1=events[_0x2d04ac];var _0x12a115=createListener(_0x77a6('0x8')+_0x13d8f1,_0x450552);FaxMessageEvents['on'](_0x13d8f1,_0x12a115);}}; \ No newline at end of file +var _0x11ff=['length','./faxMessage.events','save','removeListener','register'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x11ff,0x169));var _0xf11f=function(_0x278767,_0x5ec013){_0x278767=_0x278767-0x0;var _0x3a99e4=_0x11ff[_0x278767];return _0x3a99e4;};'use strict';var FaxMessageEvents=require(_0xf11f('0x0'));var events=[_0xf11f('0x1'),'remove','update'];function createListener(_0x47e3d7,_0x4de253){return function(_0x139965){_0x4de253['emit'](_0x47e3d7,_0x139965);};}function removeListener(_0x564935,_0x1e626f){return function(){FaxMessageEvents[_0xf11f('0x2')](_0x564935,_0x1e626f);};}exports[_0xf11f('0x3')]=function(_0x37d1f9){for(var _0xc2fac2=0x0,_0x8d9766=events[_0xf11f('0x4')];_0xc2fac2<_0x8d9766;_0xc2fac2++){var _0x5a1449=events[_0xc2fac2];var _0x57852e=createListener('faxMessage:'+_0x5a1449,_0x37d1f9);FaxMessageEvents['on'](_0x5a1449,_0x57852e);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index b2ba776..2939457 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 _0x96cc=['/:id/download','post','tracked','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x59ee82,_0x2fff12){var _0x4bf76a=function(_0x20c061){while(--_0x20c061){_0x59ee82['push'](_0x59ee82['shift']());}};_0x4bf76a(++_0x2fff12);}(_0x96cc,0x16c));var _0xc96c=function(_0xe4aa53,_0x5ba7cf){_0xe4aa53=_0xe4aa53-0x0;var _0x406c91=_0x96cc[_0xe4aa53];return _0x406c91;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['show']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['download']);router[_0xc96c('0xf')]('/',auth['isAuthenticated'](),interaction[_0xc96c('0x10')]('fax',_0xc96c('0x11')),controller[_0xc96c('0x12')]);router[_0xc96c('0x13')](_0xc96c('0xd'),auth['isAuthenticated'](),controller[_0xc96c('0x14')]);router[_0xc96c('0x13')](_0xc96c('0x15'),auth[_0xc96c('0xa')](),controller['accept']);router[_0xc96c('0x13')](_0xc96c('0x16'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x17')]);router[_0xc96c('0x18')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x19')]);module[_0xc96c('0x1a')]=router; \ No newline at end of file +var _0x222f=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','create','put','update','/:id/accept'];(function(_0x5b2a4f,_0xc77712){var _0x37908e=function(_0x5d524f){while(--_0x5d524f){_0x5b2a4f['push'](_0x5b2a4f['shift']());}};_0x37908e(++_0xc77712);}(_0x222f,0x1a4));var _0xf222=function(_0x3ec501,_0x1d035a){_0x3ec501=_0x3ec501-0x0;var _0x5a3037=_0x222f[_0x3ec501];return _0x5a3037;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./faxMessage.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/describe',auth[_0xf222('0xa')](),controller[_0xf222('0xb')]);router['get'](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0xd')]);router[_0xf222('0x8')](_0xf222('0xe'),auth[_0xf222('0xa')](),controller['download']);router[_0xf222('0xf')]('/',auth[_0xf222('0xa')](),interaction[_0xf222('0x10')](_0xf222('0x11'),'faxmessage:create'),controller[_0xf222('0x12')]);router[_0xf222('0x13')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x14')]);router[_0xf222('0x13')](_0xf222('0x15'),auth[_0xf222('0xa')](),controller['accept']);router['put'](_0xf222('0x16'),auth[_0xf222('0xa')](),controller['reject']);router[_0xf222('0x17')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x18')]);module[_0xf222('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 1bb5841..e8a2ed8 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 _0xd916=['rrmemory','INTEGER','sequelize','exports','STRING','name','ENUM'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xd916,0x18a));var _0x6d91=function(_0x24e943,_0x4c428f){_0x24e943=_0x24e943-0x0;var _0x25027b=_0xd916[_0x24e943];return _0x25027b;};'use strict';var Sequelize=require(_0x6d91('0x0'));module[_0x6d91('0x1')]={'name':{'type':Sequelize[_0x6d91('0x2')],'unique':_0x6d91('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6d91('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6d91('0x4')](_0x6d91('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6d91('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8277=['rrmemory','beepall','exports','STRING','INTEGER'];(function(_0x125f0b,_0x2bb4c8){var _0x88d0e=function(_0x65d282){while(--_0x65d282){_0x125f0b['push'](_0x125f0b['shift']());}};_0x88d0e(++_0x2bb4c8);}(_0x8277,0xcf));var _0x7827=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0x8277[_0x4fc80b];return _0x119dba;};'use strict';var Sequelize=require('sequelize');module[_0x7827('0x0')]={'name':{'type':Sequelize[_0x7827('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7827('0x1')]},'timeout':{'type':Sequelize[_0x7827('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7827('0x3'),_0x7827('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7827('0x2')],'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 61de10f..67f75f3 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 _0x8f6e=['field','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','compact','value','isEmpty','forEach','emit','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','then','destroy','get','FaxQueues','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','type','includeAll','findAll','rows','catch','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','faxPause','getTeams','Team','sort','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','removeTeams','User','select'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x8f6e,0x1c1));var _0xe8f6=function(_0xbf99dd,_0x255ca3){_0xbf99dd=_0xbf99dd-0x0;var _0x3f173d=_0x8f6e[_0xbf99dd];return _0x3f173d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8f6('0x0'));var zipdir=require(_0xe8f6('0x1'));var jsonpatch=require(_0xe8f6('0x2'));var rp=require(_0xe8f6('0x3'));var moment=require('moment');var BPromise=require(_0xe8f6('0x4'));var Mustache=require(_0xe8f6('0x5'));var util=require(_0xe8f6('0x6'));var path=require(_0xe8f6('0x7'));var sox=require(_0xe8f6('0x8'));var csv=require('to-csv');var ejs=require(_0xe8f6('0x9'));var fs=require('fs');var fs_extra=require(_0xe8f6('0xa'));var _=require('lodash');var squel=require(_0xe8f6('0xb'));var crypto=require(_0xe8f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe8f6('0xd'));var toCsv=require(_0xe8f6('0xe'));var querystring=require('querystring');var Papa=require(_0xe8f6('0xf'));var Redis=require(_0xe8f6('0x10'));var authService=require(_0xe8f6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8f6('0x12'));var logger=require(_0xe8f6('0x13'))('api');var utils=require(_0xe8f6('0x14'));var config=require(_0xe8f6('0x15'));var licenseUtil=require(_0xe8f6('0x16'));var db=require(_0xe8f6('0x17'))['db'];config['redis']=_[_0xe8f6('0x18')](config[_0xe8f6('0x19')],{'host':_0xe8f6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8f6('0x19')]));require(_0xe8f6('0x1b'))['register'](socket);function respondWithStatusCode(_0x120f56,_0x39d078){_0x39d078=_0x39d078||0xcc;return function(_0x38bcb2){if(_0x38bcb2){return _0x120f56[_0xe8f6('0x1c')](_0x39d078);}return _0x120f56[_0xe8f6('0x1d')](_0x39d078)[_0xe8f6('0x1e')]();};}function respondWithResult(_0x48343b,_0x51c142){_0x51c142=_0x51c142||0xc8;return function(_0x331386){if(_0x331386){return _0x48343b[_0xe8f6('0x1d')](_0x51c142)[_0xe8f6('0x1f')](_0x331386);}};}function respondWithFilteredResult(_0x58aa34,_0x44870e){return function(_0x492c99){if(_0x492c99){var _0x141ff2=typeof _0x44870e[_0xe8f6('0x20')]===_0xe8f6('0x21')&&typeof _0x44870e['limit']===_0xe8f6('0x21');var _0x16c380=_0x492c99[_0xe8f6('0x22')];var _0x7d005b=_0x141ff2?0x0:_0x44870e[_0xe8f6('0x20')];var _0x497238=_0x141ff2?_0x492c99[_0xe8f6('0x22')]:_0x44870e['offset']+_0x44870e['limit'];var _0x43ba98;if(_0x497238>=_0x16c380){_0x497238=_0x16c380;_0x43ba98=0xc8;}else{_0x43ba98=0xce;}_0x58aa34['status'](_0x43ba98);return _0x58aa34['set']('Content-Range',_0x7d005b+'-'+_0x497238+'/'+_0x16c380)[_0xe8f6('0x1f')](_0x492c99);}return null;};}function patchUpdates(_0x2bd37d){return function(_0x52e141){try{jsonpatch[_0xe8f6('0x23')](_0x52e141,_0x2bd37d,!![]);}catch(_0x24135b){return BPromise[_0xe8f6('0x24')](_0x24135b);}return _0x52e141[_0xe8f6('0x25')]();};}function saveUpdates(_0x9be28a,_0xec569d){return function(_0x2f4fc2){if(_0x2f4fc2){return _0x2f4fc2['update'](_0x9be28a)[_0xe8f6('0x26')](function(_0x476054){return _0x476054;});}return null;};}function removeEntity(_0x39d975,_0x19d276){return function(_0x1bf36a){if(_0x1bf36a){return _0x1bf36a[_0xe8f6('0x27')]()[_0xe8f6('0x26')](function(){var _0x44ba8c=_0x1bf36a[_0xe8f6('0x28')]({'plain':!![]});var _0x4979c9=_0xe8f6('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x4979c9,'resourceId':_0x44ba8c['id']}})[_0xe8f6('0x26')](function(){return _0x1bf36a;});})['then'](function(){_0x39d975[_0xe8f6('0x1d')](0xcc)[_0xe8f6('0x1e')]();});}};}function handleEntityNotFound(_0x482d74,_0x15798e){return function(_0x53db08){if(!_0x53db08){_0x482d74['sendStatus'](0x194);}return _0x53db08;};}function handleError(_0xc1b8c2,_0x1fbe68){_0x1fbe68=_0x1fbe68||0x1f4;return function(_0x12779e){logger[_0xe8f6('0x2a')](_0x12779e[_0xe8f6('0x2b')]);if(_0x12779e[_0xe8f6('0x2c')]){delete _0x12779e['name'];}_0xc1b8c2[_0xe8f6('0x1d')](_0x1fbe68)[_0xe8f6('0x2d')](_0x12779e);};}exports['index']=function(_0x5e4b27,_0x1e4e69){var _0x3e9cf0={},_0x55d278={},_0x4b2f85={'count':0x0,'rows':[]};var _0x444e4c=_[_0xe8f6('0x2e')](db[_0xe8f6('0x2f')][_0xe8f6('0x30')],function(_0xf9db68){return{'name':_0xf9db68[_0xe8f6('0x31')],'type':_0xf9db68['type']['key']};});_0x55d278['model']=_[_0xe8f6('0x2e')](_0x444e4c,_0xe8f6('0x2c'));_0x55d278['query']=_[_0xe8f6('0x32')](_0x5e4b27[_0xe8f6('0x33')]);_0x55d278[_0xe8f6('0x34')]=_[_0xe8f6('0x35')](_0x55d278[_0xe8f6('0x36')],_0x55d278[_0xe8f6('0x33')]);_0x3e9cf0[_0xe8f6('0x37')]=_[_0xe8f6('0x35')](_0x55d278[_0xe8f6('0x36')],qs[_0xe8f6('0x38')](_0x5e4b27[_0xe8f6('0x33')][_0xe8f6('0x38')]));_0x3e9cf0[_0xe8f6('0x37')]=_0x3e9cf0[_0xe8f6('0x37')][_0xe8f6('0x39')]?_0x3e9cf0[_0xe8f6('0x37')]:_0x55d278[_0xe8f6('0x36')];if(!_0x5e4b27[_0xe8f6('0x33')][_0xe8f6('0x3a')](_0xe8f6('0x3b'))){_0x3e9cf0[_0xe8f6('0x3c')]=qs[_0xe8f6('0x3c')](_0x5e4b27[_0xe8f6('0x33')][_0xe8f6('0x3c')]);_0x3e9cf0[_0xe8f6('0x20')]=qs[_0xe8f6('0x20')](_0x5e4b27[_0xe8f6('0x33')][_0xe8f6('0x20')]);}_0x3e9cf0[_0xe8f6('0x3d')]=qs['sort'](_0x5e4b27[_0xe8f6('0x33')]['sort']);_0x3e9cf0['where']=qs[_0xe8f6('0x34')](_[_0xe8f6('0x3e')](_0x5e4b27['query'],_0x55d278[_0xe8f6('0x34')]),_0x444e4c);if(_0x5e4b27[_0xe8f6('0x33')][_0xe8f6('0x3f')]){_0x3e9cf0[_0xe8f6('0x40')]=_[_0xe8f6('0x41')](_0x3e9cf0[_0xe8f6('0x40')],{'$or':_[_0xe8f6('0x2e')](_0x444e4c,function(_0xb6d184){if(_0xb6d184[_0xe8f6('0x42')]!=='VIRTUAL'){var _0x2697a0={};_0x2697a0[_0xb6d184[_0xe8f6('0x2c')]]={'$like':'%'+_0x5e4b27[_0xe8f6('0x33')]['filter']+'%'};return _0x2697a0;}})});}_0x3e9cf0=_[_0xe8f6('0x41')]({},_0x3e9cf0,_0x5e4b27['options']);var _0x568d20={'where':_0x3e9cf0[_0xe8f6('0x40')]};return db[_0xe8f6('0x2f')][_0xe8f6('0x22')](_0x568d20)['then'](function(_0x22fd43){_0x4b2f85[_0xe8f6('0x22')]=_0x22fd43;if(_0x5e4b27[_0xe8f6('0x33')][_0xe8f6('0x43')]){_0x3e9cf0['include']=[{'all':!![]}];}return db[_0xe8f6('0x2f')][_0xe8f6('0x44')](_0x3e9cf0);})['then'](function(_0x535af0){_0x4b2f85[_0xe8f6('0x45')]=_0x535af0;return _0x4b2f85;})[_0xe8f6('0x26')](respondWithFilteredResult(_0x1e4e69,_0x3e9cf0))[_0xe8f6('0x46')](handleError(_0x1e4e69,null));};exports[_0xe8f6('0x47')]=function(_0x1755a7,_0x2ce566){var _0x1be90f={'raw':!![],'where':{'id':_0x1755a7[_0xe8f6('0x48')]['id']}},_0x2b07ab={};_0x2b07ab[_0xe8f6('0x36')]=_[_0xe8f6('0x32')](db[_0xe8f6('0x2f')][_0xe8f6('0x30')]);_0x2b07ab[_0xe8f6('0x33')]=_[_0xe8f6('0x32')](_0x1755a7[_0xe8f6('0x33')]);_0x2b07ab[_0xe8f6('0x34')]=_[_0xe8f6('0x35')](_0x2b07ab[_0xe8f6('0x36')],_0x2b07ab[_0xe8f6('0x33')]);_0x1be90f[_0xe8f6('0x37')]=_['intersection'](_0x2b07ab[_0xe8f6('0x36')],qs[_0xe8f6('0x38')](_0x1755a7[_0xe8f6('0x33')][_0xe8f6('0x38')]));_0x1be90f[_0xe8f6('0x37')]=_0x1be90f[_0xe8f6('0x37')]['length']?_0x1be90f[_0xe8f6('0x37')]:_0x2b07ab['model'];if(_0x1755a7[_0xe8f6('0x33')][_0xe8f6('0x43')]){_0x1be90f[_0xe8f6('0x49')]=[{'all':!![]}];}_0x1be90f=_[_0xe8f6('0x41')]({},_0x1be90f,_0x1755a7[_0xe8f6('0x4a')]);return db[_0xe8f6('0x2f')]['find'](_0x1be90f)[_0xe8f6('0x26')](handleEntityNotFound(_0x2ce566,null))[_0xe8f6('0x26')](respondWithResult(_0x2ce566,null))[_0xe8f6('0x46')](handleError(_0x2ce566,null));};exports[_0xe8f6('0x4b')]=function(_0x3917f6,_0x402a95){return db[_0xe8f6('0x2f')][_0xe8f6('0x4b')](_0x3917f6[_0xe8f6('0x4c')],{})[_0xe8f6('0x26')](function(_0x3c3f1f){var _0x111b92=_0x3917f6[_0xe8f6('0x4d')][_0xe8f6('0x28')]({'plain':!![]});if(!_0x111b92)throw new Error(_0xe8f6('0x4e'));if(_0x111b92[_0xe8f6('0x4f')]==='user'){var _0x1ce772=_0x3c3f1f['get']({'plain':!![]});var _0x62be7f=_0xe8f6('0x29');return db[_0xe8f6('0x50')]['find']({'where':{'name':_0x62be7f,'userProfileId':_0x111b92[_0xe8f6('0x51')]},'raw':!![]})[_0xe8f6('0x26')](function(_0x5643dd){if(_0x5643dd&&_0x5643dd[_0xe8f6('0x52')]===0x0){return db['UserProfileResource'][_0xe8f6('0x4b')]({'name':_0x1ce772[_0xe8f6('0x2c')],'resourceId':_0x1ce772['id'],'type':_0x5643dd[_0xe8f6('0x2c')],'sectionId':_0x5643dd['id']},{})['then'](function(){return _0x3c3f1f;});}else{return _0x3c3f1f;}})['catch'](function(_0x1a7954){logger[_0xe8f6('0x2a')](_0xe8f6('0x53'),_0x1a7954);throw _0x1a7954;});}return _0x3c3f1f;})[_0xe8f6('0x26')](respondWithResult(_0x402a95,0xc9))[_0xe8f6('0x46')](handleError(_0x402a95,null));};exports[_0xe8f6('0x54')]=function(_0x1ed8e2,_0x271cbc){if(_0x1ed8e2['body']['id']){delete _0x1ed8e2[_0xe8f6('0x4c')]['id'];}return db['FaxQueue'][_0xe8f6('0x55')]({'where':{'id':_0x1ed8e2['params']['id']}})[_0xe8f6('0x26')](handleEntityNotFound(_0x271cbc,null))[_0xe8f6('0x26')](saveUpdates(_0x1ed8e2['body'],null))[_0xe8f6('0x26')](respondWithResult(_0x271cbc,null))[_0xe8f6('0x46')](handleError(_0x271cbc,null));};exports[_0xe8f6('0x27')]=function(_0x37d8c1,_0x42324e){return db[_0xe8f6('0x2f')]['find']({'where':{'id':_0x37d8c1[_0xe8f6('0x48')]['id']}})[_0xe8f6('0x26')](handleEntityNotFound(_0x42324e,null))[_0xe8f6('0x26')](removeEntity(_0x42324e,null))[_0xe8f6('0x46')](handleError(_0x42324e,null));};exports[_0xe8f6('0x56')]=function(_0x14478a,_0x3b1d9c){return db['FaxQueue'][_0xe8f6('0x56')]()['then'](respondWithResult(_0x3b1d9c,null))[_0xe8f6('0x46')](handleError(_0x3b1d9c,null));};exports[_0xe8f6('0x57')]=function(_0x46dc1a,_0x2c0f81,_0x309354){var _0x23c155={'raw':!![],'where':{}},_0x86463d={},_0x4ef076;return db[_0xe8f6('0x2f')][_0xe8f6('0x58')]({'where':{'id':_0x46dc1a[_0xe8f6('0x48')]['id']}})[_0xe8f6('0x26')](handleEntityNotFound(_0x2c0f81,null))[_0xe8f6('0x26')](function(_0x24b218){if(_0x24b218){_0x4ef076=_0x24b218[_0xe8f6('0x28')]({'plain':!![]});_0x86463d[_0xe8f6('0x36')]=_['keys'](db[_0xe8f6('0x59')][_0xe8f6('0x30')]);_0x86463d['query']=_[_0xe8f6('0x32')](_0x46dc1a[_0xe8f6('0x33')]);_0x86463d[_0xe8f6('0x34')]=_['intersection'](_0x86463d[_0xe8f6('0x36')],_0x86463d[_0xe8f6('0x33')]);_0x23c155[_0xe8f6('0x37')]=_['intersection'](_0x86463d[_0xe8f6('0x36')],qs['fields'](_0x46dc1a[_0xe8f6('0x33')][_0xe8f6('0x38')]));_0x23c155[_0xe8f6('0x37')]=_0x23c155[_0xe8f6('0x37')][_0xe8f6('0x39')]?_0x23c155['attributes']:_0x86463d['model'];if(!_0x46dc1a[_0xe8f6('0x33')][_0xe8f6('0x3a')](_0xe8f6('0x3b'))){_0x23c155['limit']=qs[_0xe8f6('0x3c')](_0x46dc1a[_0xe8f6('0x33')][_0xe8f6('0x3c')]);_0x23c155[_0xe8f6('0x20')]=qs[_0xe8f6('0x20')](_0x46dc1a[_0xe8f6('0x33')][_0xe8f6('0x20')]);}_0x23c155[_0xe8f6('0x3d')]=qs['sort'](_0x46dc1a[_0xe8f6('0x33')]['sort']);_0x23c155[_0xe8f6('0x40')]=qs[_0xe8f6('0x34')](_[_0xe8f6('0x3e')](_0x46dc1a['query'],_0x86463d[_0xe8f6('0x34')]));_0x23c155['where'][_0xe8f6('0x5a')]=_0x24b218['id'];if(_0x46dc1a[_0xe8f6('0x33')]['filter']){_0x23c155[_0xe8f6('0x40')]=_['merge'](_0x23c155['where'],{'$or':_[_0xe8f6('0x2e')](_0x23c155[_0xe8f6('0x37')],function(_0x38b724){var _0x120046={};_0x120046[_0x38b724]={'$like':'%'+_0x46dc1a[_0xe8f6('0x33')][_0xe8f6('0x3f')]+'%'};return _0x120046;})});}_0x23c155=_[_0xe8f6('0x41')]({},_0x23c155,_0x46dc1a[_0xe8f6('0x4a')]);return db[_0xe8f6('0x59')][_0xe8f6('0x44')](_0x23c155);}})['then'](function(_0x3d7cec){if(_0x3d7cec){return db['User'][_0xe8f6('0x5b')]({'where':{'id':_[_0xe8f6('0x2e')](_0x3d7cec,_0xe8f6('0x5c')),'role':_0xe8f6('0x5d')},'attributes':['id',_0xe8f6('0x2c'),'faxPause',_0xe8f6('0x5e'),_0xe8f6('0x5f')]});}})[_0xe8f6('0x26')](function(_0x3a6131){if(_0x3a6131){return{'count':_0x3a6131['count'],'rows':_['map'](_0x3a6131[_0xe8f6('0x45')],function(_0x2cde0b){return{'membername':_0x2cde0b[_0xe8f6('0x2c')],'UserId':_0x2cde0b['id'],'queue_name':_0x4ef076['name'],'FaxQueueId':_0x4ef076['id'],'interface':util['format'](_0xe8f6('0x60'),_0xe8f6('0x61'),_0x2cde0b[_0xe8f6('0x2c')]),'penalty':0x0,'paused':_0x2cde0b[_0xe8f6('0x62')],'createdAt':_0x2cde0b['createdAt'],'updatedAt':_0x2cde0b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe8f6('0x26')](respondWithFilteredResult(_0x2c0f81,_0x23c155))['catch'](handleError(_0x2c0f81,null));};exports[_0xe8f6('0x63')]=function(_0x41d94e,_0x1b9f98,_0x1298ef){var _0x10c8e3={};var _0x100971={};var _0x311a2d;var _0x5ddf24;return db[_0xe8f6('0x2f')][_0xe8f6('0x58')]({'where':{'id':_0x41d94e[_0xe8f6('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b9f98,null))['then'](function(_0x56a02e){if(_0x56a02e){_0x311a2d=_0x56a02e;_0x100971[_0xe8f6('0x36')]=_[_0xe8f6('0x32')](db[_0xe8f6('0x64')][_0xe8f6('0x30')]);_0x100971[_0xe8f6('0x33')]=_[_0xe8f6('0x32')](_0x41d94e['query']);_0x100971['filters']=_[_0xe8f6('0x35')](_0x100971[_0xe8f6('0x36')],_0x100971[_0xe8f6('0x33')]);_0x10c8e3[_0xe8f6('0x37')]=_[_0xe8f6('0x35')](_0x100971[_0xe8f6('0x36')],qs[_0xe8f6('0x38')](_0x41d94e[_0xe8f6('0x33')][_0xe8f6('0x38')]));_0x10c8e3['attributes']=_0x10c8e3[_0xe8f6('0x37')][_0xe8f6('0x39')]?_0x10c8e3['attributes']:_0x100971[_0xe8f6('0x36')];_0x10c8e3['order']=qs[_0xe8f6('0x65')](_0x41d94e[_0xe8f6('0x33')][_0xe8f6('0x65')]);_0x10c8e3[_0xe8f6('0x40')]=qs[_0xe8f6('0x34')](_[_0xe8f6('0x3e')](_0x41d94e[_0xe8f6('0x33')],_0x100971[_0xe8f6('0x34')]));if(_0x41d94e[_0xe8f6('0x33')][_0xe8f6('0x3f')]){_0x10c8e3[_0xe8f6('0x40')]=_['merge'](_0x10c8e3[_0xe8f6('0x40')],{'$or':_['map'](_0x10c8e3['attributes'],function(_0x315964){var _0x13c283={};_0x13c283[_0x315964]={'$like':'%'+_0x41d94e['query'][_0xe8f6('0x3f')]+'%'};return _0x13c283;})});}_0x10c8e3=_[_0xe8f6('0x41')]({},_0x10c8e3,_0x41d94e[_0xe8f6('0x4a')]);return _0x311a2d[_0xe8f6('0x63')](_0x10c8e3);}})[_0xe8f6('0x26')](function(_0x56fde9){if(_0x56fde9){_0x5ddf24=_0x56fde9['length'];if(!_0x41d94e['query'][_0xe8f6('0x3a')](_0xe8f6('0x3b'))){_0x10c8e3[_0xe8f6('0x3c')]=qs[_0xe8f6('0x3c')](_0x41d94e[_0xe8f6('0x33')][_0xe8f6('0x3c')]);_0x10c8e3['offset']=qs[_0xe8f6('0x20')](_0x41d94e[_0xe8f6('0x33')][_0xe8f6('0x20')]);}return _0x311a2d['getTeams'](_0x10c8e3);}})[_0xe8f6('0x26')](function(_0x68382a){if(_0x68382a){return _0x68382a?{'count':_0x5ddf24,'rows':_0x68382a}:null;}})[_0xe8f6('0x26')](respondWithResult(_0x1b9f98,null))[_0xe8f6('0x46')](handleError(_0x1b9f98,null));};exports[_0xe8f6('0x66')]=function(_0x1a6d0e,_0x30ff19,_0x550e7f){var _0x2a4597=_0x1a6d0e[_0xe8f6('0x4c')][_0xe8f6('0x67')];return db['Team'][_0xe8f6('0x44')]({'where':{'id':_0x2a4597},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe8f6('0x68'),'attributes':['id',_0xe8f6('0x2c'),_0xe8f6('0x69'),'voicePause',_0xe8f6('0x6a')],'raw':!![]}]})[_0xe8f6('0x26')](function(_0x3e687f){if(_0x3e687f){var _0x38d48c=_[_0xe8f6('0x6b')](_0x3e687f,function(_0x21de25){var _0x26fec3=_0x21de25[_0xe8f6('0x28')]({'plain':!![]});return _0x26fec3[_0xe8f6('0x68')];});return db[_0xe8f6('0x2f')][_0xe8f6('0x55')]({'where':{'id':_0x1a6d0e[_0xe8f6('0x48')]['id']}})[_0xe8f6('0x26')](function(_0x2db424){return db[_0xe8f6('0x6c')][_0xe8f6('0x6d')](function(_0x27c5cf){return _0x2db424[_0xe8f6('0x66')](_0x2a4597,{'transaction':_0x27c5cf})[_0xe8f6('0x26')](function(){return BPromise[_0xe8f6('0x6e')](_0x38d48c,function(_0x2ec4dd){return db[_0xe8f6('0x59')][_0xe8f6('0x6f')]({'where':{'UserId':_0x2ec4dd['id'],'FaxQueueId':_0x1a6d0e[_0xe8f6('0x48')]['id']},'transaction':_0x27c5cf});});})[_0xe8f6('0x26')](function(){_0x38d48c['forEach'](function(_0x536a82){socket['emit']('userFaxQueue:save',{'UserId':_0x536a82['id'],'FaxQueueId':_0x2db424['id']});});});});});}})[_0xe8f6('0x26')](respondWithStatusCode(_0x30ff19,null))[_0xe8f6('0x46')](handleError(_0x30ff19,null));};exports[_0xe8f6('0x70')]=function(_0x8cf28a,_0x54e19a,_0x4dbaee){return db['Team'][_0xe8f6('0x44')]({'where':{'id':_0x8cf28a[_0xe8f6('0x33')][_0xe8f6('0x67')]},'attributes':['id'],'include':[{'model':db[_0xe8f6('0x71')],'as':_0xe8f6('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe8f6('0x26')](handleEntityNotFound(_0x54e19a,null))[_0xe8f6('0x26')](function(_0x25688c){var _0x1c2ea8=_['map'](_0x25688c,'id');var _0x376f73=[];var _0x5b6960=[];var _0x1d6821=squel[_0xe8f6('0x72')]();_0x1d6821[_0xe8f6('0x73')]('tq.TeamId')['from'](_0xe8f6('0x74'),'tq')[_0xe8f6('0x75')](_0xe8f6('0x76'),'ut',_0xe8f6('0x77'))[_0xe8f6('0x40')](_0xe8f6('0x78'),_0x8cf28a[_0xe8f6('0x48')]['id']);for(var _0x1390d6=0x0;_0x1390d6<_0x25688c[_0xe8f6('0x39')];_0x1390d6+=0x1){let _0x37df83=_0x25688c[_0x1390d6];for(var _0x200794=0x0;_0x200794<_0x37df83[_0xe8f6('0x68')][_0xe8f6('0x39')];_0x200794+=0x1){let _0xe5091a=_0x37df83[_0xe8f6('0x68')][_0x200794];var _0x228611=_0x1d6821[_0xe8f6('0x79')]();_0x228611['where'](_0xe8f6('0x7a'),_0xe5091a['id']);_0x5b6960[_0xe8f6('0x7b')](db[_0xe8f6('0x6c')][_0xe8f6('0x33')](_0x228611[_0xe8f6('0x7c')](),{'type':db[_0xe8f6('0x6c')][_0xe8f6('0x7d')]['SELECT']})[_0xe8f6('0x26')](function(_0x225731){if(_0x225731['length']===0x1){return _0xe5091a['id'];}else{var _0x409c46=_[_0xe8f6('0x7e')](_[_0xe8f6('0x2e')](_0x225731,'TeamId'),function(_0x5091d4){return _[_0xe8f6('0x7f')](_0x1c2ea8,_0x5091d4);});if(_0x409c46){return _0xe5091a['id'];}}}));}}return BPromise['all'](_0x5b6960)[_0xe8f6('0x26')](function(_0x293dd6){_0x376f73=_(_0x376f73)['union'](_0x293dd6)[_0xe8f6('0x80')]()[_0xe8f6('0x81')]();return db[_0xe8f6('0x2f')][_0xe8f6('0x55')]({'where':{'id':_0x8cf28a['params']['id']}})['then'](function(_0x34ed41){return db[_0xe8f6('0x6c')][_0xe8f6('0x6d')](function(_0x82b262){return _0x34ed41[_0xe8f6('0x70')](_0x8cf28a[_0xe8f6('0x33')]['ids'],{'transaction':_0x82b262})[_0xe8f6('0x26')](function(){if(!_[_0xe8f6('0x82')](_0x376f73)){return _0x34ed41['removeAgents'](_0x376f73,{'transaction':_0x82b262});}})[_0xe8f6('0x26')](function(){_0x376f73[_0xe8f6('0x83')](function(_0x1a1563){socket[_0xe8f6('0x84')](_0xe8f6('0x85'),{'UserId':_0x1a1563,'FaxQueueId':_0x34ed41['id']});});});});});});})[_0xe8f6('0x26')](respondWithStatusCode(_0x54e19a,null))[_0xe8f6('0x46')](handleError(_0x54e19a,null));};exports[_0xe8f6('0x86')]=function(_0x321ecb,_0x358f1b,_0x4495c8){return db[_0xe8f6('0x2f')][_0xe8f6('0x55')]({'where':{'id':_0x321ecb[_0xe8f6('0x48')]['id']}})[_0xe8f6('0x26')](handleEntityNotFound(_0x358f1b,null))[_0xe8f6('0x26')](function(_0x12ec11){if(_0x12ec11){return _0x12ec11[_0xe8f6('0x86')](_0x321ecb[_0xe8f6('0x4c')][_0xe8f6('0x67')],_[_0xe8f6('0x87')](_0x321ecb['body'],['ids','id'])||{})[_0xe8f6('0x88')](function(_0xf7a2fa){for(var _0x25a561=0x0;_0x25a561<_0x321ecb[_0xe8f6('0x4c')][_0xe8f6('0x67')][_0xe8f6('0x39')];_0x25a561+=0x1){socket['emit'](_0xe8f6('0x89'),{'UserId':Number(_0x321ecb[_0xe8f6('0x4c')]['ids'][_0x25a561]),'FaxQueueId':Number(_0x321ecb[_0xe8f6('0x48')]['id'])});}return _0xf7a2fa;});}})[_0xe8f6('0x26')](respondWithResult(_0x358f1b,null))[_0xe8f6('0x46')](handleError(_0x358f1b,null));};exports[_0xe8f6('0x8a')]=function(_0x41890b,_0x435b90,_0x261601){return db[_0xe8f6('0x2f')][_0xe8f6('0x55')]({'where':{'id':_0x41890b[_0xe8f6('0x48')]['id']}})[_0xe8f6('0x26')](handleEntityNotFound(_0x435b90,null))[_0xe8f6('0x26')](function(_0x5dfe8f){if(_0x5dfe8f){return _0x5dfe8f[_0xe8f6('0x8a')](_0x41890b['query'][_0xe8f6('0x67')])['then'](function(){if(_[_0xe8f6('0x8b')](_0x41890b[_0xe8f6('0x33')][_0xe8f6('0x67')])){for(var _0x311162=0x0;_0x311162<_0x41890b['query']['ids']['length'];_0x311162+=0x1){socket[_0xe8f6('0x84')]('userFaxQueue:remove',{'UserId':Number(_0x41890b[_0xe8f6('0x33')][_0xe8f6('0x67')][_0x311162]),'FaxQueueId':Number(_0x41890b[_0xe8f6('0x48')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x41890b[_0xe8f6('0x33')]['ids']),'FaxQueueId':Number(_0x41890b[_0xe8f6('0x48')]['id'])});}});}})[_0xe8f6('0x26')](respondWithStatusCode(_0x435b90,null))[_0xe8f6('0x46')](handleError(_0x435b90,null));};exports[_0xe8f6('0x8c')]=function(_0x1ea5ce,_0xb5f08a,_0x3242e6){var _0x2fd4a5={};var _0x3261fc={};var _0x54993f;var _0x134624;return db[_0xe8f6('0x2f')]['findOne']({'where':{'id':_0x1ea5ce[_0xe8f6('0x48')]['id']}})[_0xe8f6('0x26')](handleEntityNotFound(_0xb5f08a,null))['then'](function(_0x3c76b3){if(_0x3c76b3){_0x54993f=_0x3c76b3;_0x3261fc[_0xe8f6('0x36')]=_[_0xe8f6('0x32')](db['User'][_0xe8f6('0x30')]);_0x3261fc[_0xe8f6('0x33')]=_[_0xe8f6('0x32')](_0x1ea5ce[_0xe8f6('0x33')]);_0x3261fc[_0xe8f6('0x34')]=_[_0xe8f6('0x35')](_0x3261fc[_0xe8f6('0x36')],_0x3261fc[_0xe8f6('0x33')]);_0x2fd4a5[_0xe8f6('0x37')]=_[_0xe8f6('0x35')](_0x3261fc[_0xe8f6('0x36')],qs[_0xe8f6('0x38')](_0x1ea5ce[_0xe8f6('0x33')]['fields']));_0x2fd4a5['attributes']=_0x2fd4a5['attributes'][_0xe8f6('0x39')]?_0x2fd4a5['attributes']:_0x3261fc[_0xe8f6('0x36')];_0x2fd4a5[_0xe8f6('0x3d')]=qs[_0xe8f6('0x65')](_0x1ea5ce[_0xe8f6('0x33')][_0xe8f6('0x65')]);_0x2fd4a5[_0xe8f6('0x40')]=qs['filters'](_[_0xe8f6('0x3e')](_0x1ea5ce['query'],_0x3261fc[_0xe8f6('0x34')]));if(_0x1ea5ce['query'][_0xe8f6('0x3f')]){_0x2fd4a5[_0xe8f6('0x40')]=_['merge'](_0x2fd4a5[_0xe8f6('0x40')],{'$or':_[_0xe8f6('0x2e')](_0x2fd4a5[_0xe8f6('0x37')],function(_0x14cce7){var _0x3d64e8={};_0x3d64e8[_0x14cce7]={'$like':'%'+_0x1ea5ce[_0xe8f6('0x33')][_0xe8f6('0x3f')]+'%'};return _0x3d64e8;})});}_0x2fd4a5=_[_0xe8f6('0x41')]({},_0x2fd4a5,_0x1ea5ce['options']);return _0x54993f[_0xe8f6('0x8c')](_0x2fd4a5);}})[_0xe8f6('0x26')](function(_0x11c649){if(_0x11c649){_0x134624=_0x11c649[_0xe8f6('0x39')];if(!_0x1ea5ce[_0xe8f6('0x33')][_0xe8f6('0x3a')]('nolimit')){_0x2fd4a5[_0xe8f6('0x3c')]=qs[_0xe8f6('0x3c')](_0x1ea5ce[_0xe8f6('0x33')][_0xe8f6('0x3c')]);_0x2fd4a5[_0xe8f6('0x20')]=qs[_0xe8f6('0x20')](_0x1ea5ce['query'][_0xe8f6('0x20')]);}return _0x54993f[_0xe8f6('0x8c')](_0x2fd4a5);}})[_0xe8f6('0x26')](function(_0x3e3fac){if(_0x3e3fac){return _0x3e3fac?{'count':_0x134624,'rows':_0x3e3fac}:null;}})[_0xe8f6('0x26')](respondWithResult(_0xb5f08a,null))[_0xe8f6('0x46')](handleError(_0xb5f08a,null));}; \ No newline at end of file +var _0x1cde=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','User','Agents','interface','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','toString','QueryTypes','SELECT','all','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','end','offset','undefined','count','limit','status','json','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','FaxQueue','rawAttributes','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','findAll','catch','show','params','includeAll','include','merge','options','find','create'];(function(_0x783834,_0x38c810){var _0x22055f=function(_0x6a6998){while(--_0x6a6998){_0x783834['push'](_0x783834['shift']());}};_0x22055f(++_0x38c810);}(_0x1cde,0x1dc));var _0xe1cd=function(_0x3f0b29,_0x1c9069){_0x3f0b29=_0x3f0b29-0x0;var _0x473abc=_0x1cde[_0x3f0b29];return _0x473abc;};'use strict';var emlformat=require(_0xe1cd('0x0'));var rimraf=require(_0xe1cd('0x1'));var zipdir=require(_0xe1cd('0x2'));var jsonpatch=require(_0xe1cd('0x3'));var rp=require(_0xe1cd('0x4'));var moment=require(_0xe1cd('0x5'));var BPromise=require(_0xe1cd('0x6'));var Mustache=require(_0xe1cd('0x7'));var util=require(_0xe1cd('0x8'));var path=require(_0xe1cd('0x9'));var sox=require(_0xe1cd('0xa'));var csv=require(_0xe1cd('0xb'));var ejs=require(_0xe1cd('0xc'));var fs=require('fs');var fs_extra=require(_0xe1cd('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe1cd('0xe'));var toCsv=require(_0xe1cd('0xb'));var querystring=require(_0xe1cd('0xf'));var Papa=require(_0xe1cd('0x10'));var Redis=require(_0xe1cd('0x11'));var authService=require(_0xe1cd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe1cd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1cd('0x14'))(_0xe1cd('0x15'));var utils=require(_0xe1cd('0x16'));var config=require(_0xe1cd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe1cd('0x18'))['db'];config[_0xe1cd('0x19')]=_['defaults'](config[_0xe1cd('0x19')],{'host':_0xe1cd('0x1a'),'port':0x18eb});var socket=require(_0xe1cd('0x1b'))(new Redis(config[_0xe1cd('0x19')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x2dbcc1,_0x5608ad){_0x5608ad=_0x5608ad||0xcc;return function(_0x4ec109){if(_0x4ec109){return _0x2dbcc1[_0xe1cd('0x1c')](_0x5608ad);}return _0x2dbcc1['status'](_0x5608ad)[_0xe1cd('0x1d')]();};}function respondWithResult(_0xa6deba,_0x29e8c3){_0x29e8c3=_0x29e8c3||0xc8;return function(_0x536dad){if(_0x536dad){return _0xa6deba['status'](_0x29e8c3)['json'](_0x536dad);}};}function respondWithFilteredResult(_0x42e64d,_0x130eb7){return function(_0x4b7207){if(_0x4b7207){var _0x26f061=typeof _0x130eb7[_0xe1cd('0x1e')]===_0xe1cd('0x1f')&&typeof _0x130eb7['limit']==='undefined';var _0x42ee7f=_0x4b7207['count'];var _0x24d728=_0x26f061?0x0:_0x130eb7['offset'];var _0x40b95a=_0x26f061?_0x4b7207[_0xe1cd('0x20')]:_0x130eb7['offset']+_0x130eb7[_0xe1cd('0x21')];var _0x463954;if(_0x40b95a>=_0x42ee7f){_0x40b95a=_0x42ee7f;_0x463954=0xc8;}else{_0x463954=0xce;}_0x42e64d[_0xe1cd('0x22')](_0x463954);return _0x42e64d['set']('Content-Range',_0x24d728+'-'+_0x40b95a+'/'+_0x42ee7f)[_0xe1cd('0x23')](_0x4b7207);}return null;};}function patchUpdates(_0x50abfb){return function(_0x487081){try{jsonpatch['apply'](_0x487081,_0x50abfb,!![]);}catch(_0x17a011){return BPromise[_0xe1cd('0x24')](_0x17a011);}return _0x487081[_0xe1cd('0x25')]();};}function saveUpdates(_0x3b766,_0x1df2c2){return function(_0x3d7581){if(_0x3d7581){return _0x3d7581[_0xe1cd('0x26')](_0x3b766)['then'](function(_0x52f8df){return _0x52f8df;});}return null;};}function removeEntity(_0x3d932a,_0x59cae1){return function(_0x4f1dac){if(_0x4f1dac){return _0x4f1dac['destroy']()[_0xe1cd('0x27')](function(){var _0x3de682=_0x4f1dac[_0xe1cd('0x28')]({'plain':!![]});var _0x381ce7=_0xe1cd('0x29');return db[_0xe1cd('0x2a')][_0xe1cd('0x2b')]({'where':{'type':_0x381ce7,'resourceId':_0x3de682['id']}})[_0xe1cd('0x27')](function(){return _0x4f1dac;});})['then'](function(){_0x3d932a['status'](0xcc)[_0xe1cd('0x1d')]();});}};}function handleEntityNotFound(_0x750a63,_0x441bc6){return function(_0x2e88a3){if(!_0x2e88a3){_0x750a63[_0xe1cd('0x1c')](0x194);}return _0x2e88a3;};}function handleError(_0x1cc1f9,_0x25f9ba){_0x25f9ba=_0x25f9ba||0x1f4;return function(_0x377ac7){logger[_0xe1cd('0x2c')](_0x377ac7[_0xe1cd('0x2d')]);if(_0x377ac7[_0xe1cd('0x2e')]){delete _0x377ac7[_0xe1cd('0x2e')];}_0x1cc1f9['status'](_0x25f9ba)[_0xe1cd('0x2f')](_0x377ac7);};}exports[_0xe1cd('0x30')]=function(_0x31b719,_0x222567){var _0x12ce73={},_0x4e3854={},_0x184059={'count':0x0,'rows':[]};var _0x264f38=_['map'](db[_0xe1cd('0x31')][_0xe1cd('0x32')],function(_0x45e186){return{'name':_0x45e186['fieldName'],'type':_0x45e186['type'][_0xe1cd('0x33')]};});_0x4e3854['model']=_[_0xe1cd('0x34')](_0x264f38,'name');_0x4e3854['query']=_[_0xe1cd('0x35')](_0x31b719[_0xe1cd('0x36')]);_0x4e3854[_0xe1cd('0x37')]=_[_0xe1cd('0x38')](_0x4e3854['model'],_0x4e3854[_0xe1cd('0x36')]);_0x12ce73[_0xe1cd('0x39')]=_[_0xe1cd('0x38')](_0x4e3854[_0xe1cd('0x3a')],qs[_0xe1cd('0x3b')](_0x31b719[_0xe1cd('0x36')][_0xe1cd('0x3b')]));_0x12ce73[_0xe1cd('0x39')]=_0x12ce73[_0xe1cd('0x39')][_0xe1cd('0x3c')]?_0x12ce73[_0xe1cd('0x39')]:_0x4e3854[_0xe1cd('0x3a')];if(!_0x31b719[_0xe1cd('0x36')][_0xe1cd('0x3d')](_0xe1cd('0x3e'))){_0x12ce73[_0xe1cd('0x21')]=qs[_0xe1cd('0x21')](_0x31b719[_0xe1cd('0x36')][_0xe1cd('0x21')]);_0x12ce73[_0xe1cd('0x1e')]=qs[_0xe1cd('0x1e')](_0x31b719[_0xe1cd('0x36')][_0xe1cd('0x1e')]);}_0x12ce73[_0xe1cd('0x3f')]=qs[_0xe1cd('0x40')](_0x31b719[_0xe1cd('0x36')][_0xe1cd('0x40')]);_0x12ce73[_0xe1cd('0x41')]=qs['filters'](_[_0xe1cd('0x42')](_0x31b719[_0xe1cd('0x36')],_0x4e3854[_0xe1cd('0x37')]),_0x264f38);if(_0x31b719[_0xe1cd('0x36')][_0xe1cd('0x43')]){_0x12ce73[_0xe1cd('0x41')]=_['merge'](_0x12ce73['where'],{'$or':_[_0xe1cd('0x34')](_0x264f38,function(_0x1b4f3c){if(_0x1b4f3c[_0xe1cd('0x44')]!==_0xe1cd('0x45')){var _0x3d780f={};_0x3d780f[_0x1b4f3c[_0xe1cd('0x2e')]]={'$like':'%'+_0x31b719['query'][_0xe1cd('0x43')]+'%'};return _0x3d780f;}})});}_0x12ce73=_['merge']({},_0x12ce73,_0x31b719['options']);var _0x32c677={'where':_0x12ce73[_0xe1cd('0x41')]};return db[_0xe1cd('0x31')][_0xe1cd('0x20')](_0x32c677)[_0xe1cd('0x27')](function(_0x1addf1){_0x184059[_0xe1cd('0x20')]=_0x1addf1;if(_0x31b719[_0xe1cd('0x36')]['includeAll']){_0x12ce73['include']=[{'all':!![]}];}return db['FaxQueue'][_0xe1cd('0x46')](_0x12ce73);})[_0xe1cd('0x27')](function(_0x20c4d4){_0x184059['rows']=_0x20c4d4;return _0x184059;})[_0xe1cd('0x27')](respondWithFilteredResult(_0x222567,_0x12ce73))[_0xe1cd('0x47')](handleError(_0x222567,null));};exports[_0xe1cd('0x48')]=function(_0x3e1d25,_0x280aac){var _0xd1fa29={'raw':!![],'where':{'id':_0x3e1d25[_0xe1cd('0x49')]['id']}},_0x5e4b05={};_0x5e4b05[_0xe1cd('0x3a')]=_[_0xe1cd('0x35')](db['FaxQueue'][_0xe1cd('0x32')]);_0x5e4b05[_0xe1cd('0x36')]=_[_0xe1cd('0x35')](_0x3e1d25['query']);_0x5e4b05[_0xe1cd('0x37')]=_['intersection'](_0x5e4b05[_0xe1cd('0x3a')],_0x5e4b05['query']);_0xd1fa29[_0xe1cd('0x39')]=_[_0xe1cd('0x38')](_0x5e4b05['model'],qs[_0xe1cd('0x3b')](_0x3e1d25[_0xe1cd('0x36')][_0xe1cd('0x3b')]));_0xd1fa29[_0xe1cd('0x39')]=_0xd1fa29['attributes'][_0xe1cd('0x3c')]?_0xd1fa29['attributes']:_0x5e4b05[_0xe1cd('0x3a')];if(_0x3e1d25['query'][_0xe1cd('0x4a')]){_0xd1fa29[_0xe1cd('0x4b')]=[{'all':!![]}];}_0xd1fa29=_[_0xe1cd('0x4c')]({},_0xd1fa29,_0x3e1d25[_0xe1cd('0x4d')]);return db[_0xe1cd('0x31')][_0xe1cd('0x4e')](_0xd1fa29)[_0xe1cd('0x27')](handleEntityNotFound(_0x280aac,null))[_0xe1cd('0x27')](respondWithResult(_0x280aac,null))['catch'](handleError(_0x280aac,null));};exports['create']=function(_0x14c8b8,_0x52949f){return db[_0xe1cd('0x31')][_0xe1cd('0x4f')](_0x14c8b8[_0xe1cd('0x50')],{})[_0xe1cd('0x27')](function(_0x428601){var _0x53f54f=_0x14c8b8['user']['get']({'plain':!![]});if(!_0x53f54f)throw new Error(_0xe1cd('0x51'));if(_0x53f54f[_0xe1cd('0x52')]===_0xe1cd('0x53')){var _0x28ac31=_0x428601[_0xe1cd('0x28')]({'plain':!![]});var _0x275800=_0xe1cd('0x29');return db[_0xe1cd('0x54')][_0xe1cd('0x4e')]({'where':{'name':_0x275800,'userProfileId':_0x53f54f[_0xe1cd('0x55')]},'raw':!![]})['then'](function(_0x1facca){if(_0x1facca&&_0x1facca[_0xe1cd('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x28ac31['name'],'resourceId':_0x28ac31['id'],'type':_0x1facca[_0xe1cd('0x2e')],'sectionId':_0x1facca['id']},{})[_0xe1cd('0x27')](function(){return _0x428601;});}else{return _0x428601;}})[_0xe1cd('0x47')](function(_0x20f99e){logger[_0xe1cd('0x2c')](_0xe1cd('0x57'),_0x20f99e);throw _0x20f99e;});}return _0x428601;})['then'](respondWithResult(_0x52949f,0xc9))[_0xe1cd('0x47')](handleError(_0x52949f,null));};exports[_0xe1cd('0x26')]=function(_0x1a8fa2,_0x5a7a00){if(_0x1a8fa2['body']['id']){delete _0x1a8fa2['body']['id'];}return db[_0xe1cd('0x31')][_0xe1cd('0x4e')]({'where':{'id':_0x1a8fa2[_0xe1cd('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a7a00,null))['then'](saveUpdates(_0x1a8fa2[_0xe1cd('0x50')],null))['then'](respondWithResult(_0x5a7a00,null))[_0xe1cd('0x47')](handleError(_0x5a7a00,null));};exports['destroy']=function(_0x2988b9,_0x34dd07){return db[_0xe1cd('0x31')][_0xe1cd('0x4e')]({'where':{'id':_0x2988b9['params']['id']}})['then'](handleEntityNotFound(_0x34dd07,null))[_0xe1cd('0x27')](removeEntity(_0x34dd07,null))[_0xe1cd('0x47')](handleError(_0x34dd07,null));};exports['describe']=function(_0x4fae0e,_0x1f515a){return db[_0xe1cd('0x31')]['describe']()[_0xe1cd('0x27')](respondWithResult(_0x1f515a,null))['catch'](handleError(_0x1f515a,null));};exports[_0xe1cd('0x58')]=function(_0x40c3e9,_0x51b8ef,_0x15c067){var _0x2ba83b={'raw':!![],'where':{}},_0x380834={},_0x515527;return db['FaxQueue']['findOne']({'where':{'id':_0x40c3e9[_0xe1cd('0x49')]['id']}})[_0xe1cd('0x27')](handleEntityNotFound(_0x51b8ef,null))[_0xe1cd('0x27')](function(_0x22a086){if(_0x22a086){_0x515527=_0x22a086[_0xe1cd('0x28')]({'plain':!![]});_0x380834['model']=_['keys'](db[_0xe1cd('0x59')]['rawAttributes']);_0x380834[_0xe1cd('0x36')]=_[_0xe1cd('0x35')](_0x40c3e9[_0xe1cd('0x36')]);_0x380834['filters']=_[_0xe1cd('0x38')](_0x380834[_0xe1cd('0x3a')],_0x380834['query']);_0x2ba83b[_0xe1cd('0x39')]=_[_0xe1cd('0x38')](_0x380834['model'],qs['fields'](_0x40c3e9[_0xe1cd('0x36')]['fields']));_0x2ba83b[_0xe1cd('0x39')]=_0x2ba83b[_0xe1cd('0x39')][_0xe1cd('0x3c')]?_0x2ba83b[_0xe1cd('0x39')]:_0x380834[_0xe1cd('0x3a')];if(!_0x40c3e9[_0xe1cd('0x36')][_0xe1cd('0x3d')]('nolimit')){_0x2ba83b[_0xe1cd('0x21')]=qs[_0xe1cd('0x21')](_0x40c3e9[_0xe1cd('0x36')]['limit']);_0x2ba83b[_0xe1cd('0x1e')]=qs['offset'](_0x40c3e9['query'][_0xe1cd('0x1e')]);}_0x2ba83b['order']=qs[_0xe1cd('0x40')](_0x40c3e9[_0xe1cd('0x36')][_0xe1cd('0x40')]);_0x2ba83b['where']=qs[_0xe1cd('0x37')](_[_0xe1cd('0x42')](_0x40c3e9[_0xe1cd('0x36')],_0x380834[_0xe1cd('0x37')]));_0x2ba83b[_0xe1cd('0x41')][_0xe1cd('0x5a')]=_0x22a086['id'];if(_0x40c3e9[_0xe1cd('0x36')]['filter']){_0x2ba83b[_0xe1cd('0x41')]=_[_0xe1cd('0x4c')](_0x2ba83b['where'],{'$or':_[_0xe1cd('0x34')](_0x2ba83b['attributes'],function(_0x238691){var _0x29beda={};_0x29beda[_0x238691]={'$like':'%'+_0x40c3e9[_0xe1cd('0x36')]['filter']+'%'};return _0x29beda;})});}_0x2ba83b=_[_0xe1cd('0x4c')]({},_0x2ba83b,_0x40c3e9[_0xe1cd('0x4d')]);return db[_0xe1cd('0x59')][_0xe1cd('0x46')](_0x2ba83b);}})[_0xe1cd('0x27')](function(_0x1f4d7b){if(_0x1f4d7b){return db['User'][_0xe1cd('0x5b')]({'where':{'id':_['map'](_0x1f4d7b,_0xe1cd('0x5c')),'role':_0xe1cd('0x5d')},'attributes':['id',_0xe1cd('0x2e'),_0xe1cd('0x5e'),_0xe1cd('0x5f'),_0xe1cd('0x60')]});}})['then'](function(_0x119d35){if(_0x119d35){return{'count':_0x119d35[_0xe1cd('0x20')],'rows':_['map'](_0x119d35['rows'],function(_0xfa2d02){return{'membername':_0xfa2d02['name'],'UserId':_0xfa2d02['id'],'queue_name':_0x515527['name'],'FaxQueueId':_0x515527['id'],'interface':util['format'](_0xe1cd('0x61'),_0xe1cd('0x62'),_0xfa2d02['name']),'penalty':0x0,'paused':_0xfa2d02['faxPause'],'createdAt':_0xfa2d02[_0xe1cd('0x60')],'updatedAt':_0xfa2d02['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x51b8ef,_0x2ba83b))[_0xe1cd('0x47')](handleError(_0x51b8ef,null));};exports[_0xe1cd('0x63')]=function(_0x15ab81,_0x14889c,_0x3a1ed4){var _0x45ed2e={};var _0x1ef898={};var _0x4dffec;var _0x67b65;return db[_0xe1cd('0x31')]['findOne']({'where':{'id':_0x15ab81['params']['id']}})['then'](handleEntityNotFound(_0x14889c,null))['then'](function(_0x292243){if(_0x292243){_0x4dffec=_0x292243;_0x1ef898['model']=_[_0xe1cd('0x35')](db['Team'][_0xe1cd('0x32')]);_0x1ef898[_0xe1cd('0x36')]=_[_0xe1cd('0x35')](_0x15ab81['query']);_0x1ef898[_0xe1cd('0x37')]=_[_0xe1cd('0x38')](_0x1ef898[_0xe1cd('0x3a')],_0x1ef898[_0xe1cd('0x36')]);_0x45ed2e[_0xe1cd('0x39')]=_[_0xe1cd('0x38')](_0x1ef898[_0xe1cd('0x3a')],qs[_0xe1cd('0x3b')](_0x15ab81[_0xe1cd('0x36')][_0xe1cd('0x3b')]));_0x45ed2e[_0xe1cd('0x39')]=_0x45ed2e['attributes'][_0xe1cd('0x3c')]?_0x45ed2e[_0xe1cd('0x39')]:_0x1ef898[_0xe1cd('0x3a')];_0x45ed2e[_0xe1cd('0x3f')]=qs['sort'](_0x15ab81[_0xe1cd('0x36')][_0xe1cd('0x40')]);_0x45ed2e['where']=qs[_0xe1cd('0x37')](_[_0xe1cd('0x42')](_0x15ab81[_0xe1cd('0x36')],_0x1ef898[_0xe1cd('0x37')]));if(_0x15ab81[_0xe1cd('0x36')]['filter']){_0x45ed2e[_0xe1cd('0x41')]=_[_0xe1cd('0x4c')](_0x45ed2e[_0xe1cd('0x41')],{'$or':_[_0xe1cd('0x34')](_0x45ed2e[_0xe1cd('0x39')],function(_0x5b4d29){var _0x3b3b35={};_0x3b3b35[_0x5b4d29]={'$like':'%'+_0x15ab81[_0xe1cd('0x36')][_0xe1cd('0x43')]+'%'};return _0x3b3b35;})});}_0x45ed2e=_[_0xe1cd('0x4c')]({},_0x45ed2e,_0x15ab81[_0xe1cd('0x4d')]);return _0x4dffec[_0xe1cd('0x63')](_0x45ed2e);}})[_0xe1cd('0x27')](function(_0x51ab74){if(_0x51ab74){_0x67b65=_0x51ab74['length'];if(!_0x15ab81[_0xe1cd('0x36')][_0xe1cd('0x3d')]('nolimit')){_0x45ed2e['limit']=qs[_0xe1cd('0x21')](_0x15ab81[_0xe1cd('0x36')][_0xe1cd('0x21')]);_0x45ed2e[_0xe1cd('0x1e')]=qs[_0xe1cd('0x1e')](_0x15ab81[_0xe1cd('0x36')][_0xe1cd('0x1e')]);}return _0x4dffec[_0xe1cd('0x63')](_0x45ed2e);}})[_0xe1cd('0x27')](function(_0xa43e54){if(_0xa43e54){return _0xa43e54?{'count':_0x67b65,'rows':_0xa43e54}:null;}})[_0xe1cd('0x27')](respondWithResult(_0x14889c,null))['catch'](handleError(_0x14889c,null));};exports[_0xe1cd('0x64')]=function(_0x833819,_0x3c1a97,_0x3991e3){var _0x2d24d6=_0x833819['body'][_0xe1cd('0x65')];return db[_0xe1cd('0x66')][_0xe1cd('0x46')]({'where':{'id':_0x2d24d6},'attributes':['id'],'include':[{'model':db[_0xe1cd('0x67')],'as':_0xe1cd('0x68'),'attributes':['id','name','online','voicePause',_0xe1cd('0x69')],'raw':!![]}]})[_0xe1cd('0x27')](function(_0x305faf){if(_0x305faf){var _0x3334f1=_['flatMap'](_0x305faf,function(_0x2317a7){var _0x5f3073=_0x2317a7[_0xe1cd('0x28')]({'plain':!![]});return _0x5f3073['Agents'];});return db[_0xe1cd('0x31')]['find']({'where':{'id':_0x833819['params']['id']}})[_0xe1cd('0x27')](function(_0x19d647){return db[_0xe1cd('0x6a')]['transaction'](function(_0x4c576e){return _0x19d647[_0xe1cd('0x64')](_0x2d24d6,{'transaction':_0x4c576e})['then'](function(){return BPromise[_0xe1cd('0x6b')](_0x3334f1,function(_0xa793fb){return db[_0xe1cd('0x59')][_0xe1cd('0x6c')]({'where':{'UserId':_0xa793fb['id'],'FaxQueueId':_0x833819[_0xe1cd('0x49')]['id']},'transaction':_0x4c576e});});})['then'](function(){_0x3334f1[_0xe1cd('0x6d')](function(_0x45e482){socket[_0xe1cd('0x6e')](_0xe1cd('0x6f'),{'UserId':_0x45e482['id'],'FaxQueueId':_0x19d647['id']});});});});});}})['then'](respondWithStatusCode(_0x3c1a97,null))['catch'](handleError(_0x3c1a97,null));};exports[_0xe1cd('0x70')]=function(_0x5da1c2,_0x5c0081,_0x185b7d){return db[_0xe1cd('0x66')]['findAll']({'where':{'id':_0x5da1c2['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe1cd('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe1cd('0x27')](handleEntityNotFound(_0x5c0081,null))[_0xe1cd('0x27')](function(_0x240c37){var _0x1691da=_[_0xe1cd('0x34')](_0x240c37,'id');var _0x39b2cc=[];var _0x7f971c=[];var _0x20f5b6=squel[_0xe1cd('0x71')]();_0x20f5b6[_0xe1cd('0x72')](_0xe1cd('0x73'))[_0xe1cd('0x74')](_0xe1cd('0x75'),'tq')[_0xe1cd('0x76')](_0xe1cd('0x77'),'ut',_0xe1cd('0x78'))[_0xe1cd('0x41')](_0xe1cd('0x79'),_0x5da1c2[_0xe1cd('0x49')]['id']);for(var _0x166b96=0x0;_0x166b96<_0x240c37['length'];_0x166b96+=0x1){let _0xa12b07=_0x240c37[_0x166b96];for(var _0x3df5f7=0x0;_0x3df5f7<_0xa12b07[_0xe1cd('0x68')]['length'];_0x3df5f7+=0x1){let _0x2cbca1=_0xa12b07[_0xe1cd('0x68')][_0x3df5f7];var _0x5c5d4f=_0x20f5b6['clone']();_0x5c5d4f[_0xe1cd('0x41')]('ut.UserId\x20=\x20?',_0x2cbca1['id']);_0x7f971c['push'](db['sequelize'][_0xe1cd('0x36')](_0x5c5d4f[_0xe1cd('0x7a')](),{'type':db[_0xe1cd('0x6a')][_0xe1cd('0x7b')][_0xe1cd('0x7c')]})['then'](function(_0x2afa70){if(_0x2afa70[_0xe1cd('0x3c')]===0x1){return _0x2cbca1['id'];}else{var _0x133509=_['every'](_[_0xe1cd('0x34')](_0x2afa70,'TeamId'),function(_0x3613c4){return _['includes'](_0x1691da,_0x3613c4);});if(_0x133509){return _0x2cbca1['id'];}}}));}}return BPromise[_0xe1cd('0x7d')](_0x7f971c)[_0xe1cd('0x27')](function(_0x4aa589){_0x39b2cc=_(_0x39b2cc)[_0xe1cd('0x7e')](_0x4aa589)[_0xe1cd('0x7f')]()[_0xe1cd('0x80')]();return db[_0xe1cd('0x31')][_0xe1cd('0x4e')]({'where':{'id':_0x5da1c2[_0xe1cd('0x49')]['id']}})[_0xe1cd('0x27')](function(_0x1680e8){return db['sequelize'][_0xe1cd('0x81')](function(_0x1929f5){return _0x1680e8['removeTeams'](_0x5da1c2[_0xe1cd('0x36')][_0xe1cd('0x65')],{'transaction':_0x1929f5})[_0xe1cd('0x27')](function(){if(!_[_0xe1cd('0x82')](_0x39b2cc)){return _0x1680e8[_0xe1cd('0x83')](_0x39b2cc,{'transaction':_0x1929f5});}})[_0xe1cd('0x27')](function(){_0x39b2cc['forEach'](function(_0x221568){socket['emit'](_0xe1cd('0x84'),{'UserId':_0x221568,'FaxQueueId':_0x1680e8['id']});});});});});});})['then'](respondWithStatusCode(_0x5c0081,null))[_0xe1cd('0x47')](handleError(_0x5c0081,null));};exports[_0xe1cd('0x85')]=function(_0x2e1590,_0x2a14c4,_0x16ae6b){return db['FaxQueue'][_0xe1cd('0x4e')]({'where':{'id':_0x2e1590[_0xe1cd('0x49')]['id']}})['then'](handleEntityNotFound(_0x2a14c4,null))[_0xe1cd('0x27')](function(_0x4a9683){if(_0x4a9683){return _0x4a9683[_0xe1cd('0x85')](_0x2e1590[_0xe1cd('0x50')][_0xe1cd('0x65')],_[_0xe1cd('0x86')](_0x2e1590[_0xe1cd('0x50')],[_0xe1cd('0x65'),'id'])||{})[_0xe1cd('0x87')](function(_0x2fac68){for(var _0x3aa0cb=0x0;_0x3aa0cb<_0x2e1590[_0xe1cd('0x50')][_0xe1cd('0x65')][_0xe1cd('0x3c')];_0x3aa0cb+=0x1){socket[_0xe1cd('0x6e')](_0xe1cd('0x6f'),{'UserId':Number(_0x2e1590[_0xe1cd('0x50')][_0xe1cd('0x65')][_0x3aa0cb]),'FaxQueueId':Number(_0x2e1590['params']['id'])});}return _0x2fac68;});}})['then'](respondWithResult(_0x2a14c4,null))[_0xe1cd('0x47')](handleError(_0x2a14c4,null));};exports[_0xe1cd('0x83')]=function(_0x43f54a,_0x553ddc,_0x5ae91){return db['FaxQueue'][_0xe1cd('0x4e')]({'where':{'id':_0x43f54a[_0xe1cd('0x49')]['id']}})[_0xe1cd('0x27')](handleEntityNotFound(_0x553ddc,null))[_0xe1cd('0x27')](function(_0x46aad3){if(_0x46aad3){return _0x46aad3['removeAgents'](_0x43f54a[_0xe1cd('0x36')][_0xe1cd('0x65')])[_0xe1cd('0x27')](function(){if(_[_0xe1cd('0x88')](_0x43f54a[_0xe1cd('0x36')][_0xe1cd('0x65')])){for(var _0x21bc8f=0x0;_0x21bc8f<_0x43f54a['query'][_0xe1cd('0x65')]['length'];_0x21bc8f+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x43f54a[_0xe1cd('0x36')]['ids'][_0x21bc8f]),'FaxQueueId':Number(_0x43f54a['params']['id'])});}}else{socket[_0xe1cd('0x6e')](_0xe1cd('0x84'),{'UserId':Number(_0x43f54a[_0xe1cd('0x36')][_0xe1cd('0x65')]),'FaxQueueId':Number(_0x43f54a[_0xe1cd('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x553ddc,null))[_0xe1cd('0x47')](handleError(_0x553ddc,null));};exports['getAgents']=function(_0x3ce081,_0xb42dc5,_0x4c8341){var _0x19aa1a={};var _0x451b02={};var _0x31ea51;var _0x378634;return db[_0xe1cd('0x31')][_0xe1cd('0x89')]({'where':{'id':_0x3ce081[_0xe1cd('0x49')]['id']}})['then'](handleEntityNotFound(_0xb42dc5,null))[_0xe1cd('0x27')](function(_0xf9330c){if(_0xf9330c){_0x31ea51=_0xf9330c;_0x451b02[_0xe1cd('0x3a')]=_[_0xe1cd('0x35')](db[_0xe1cd('0x67')][_0xe1cd('0x32')]);_0x451b02[_0xe1cd('0x36')]=_['keys'](_0x3ce081[_0xe1cd('0x36')]);_0x451b02[_0xe1cd('0x37')]=_[_0xe1cd('0x38')](_0x451b02[_0xe1cd('0x3a')],_0x451b02['query']);_0x19aa1a[_0xe1cd('0x39')]=_[_0xe1cd('0x38')](_0x451b02['model'],qs[_0xe1cd('0x3b')](_0x3ce081[_0xe1cd('0x36')][_0xe1cd('0x3b')]));_0x19aa1a['attributes']=_0x19aa1a[_0xe1cd('0x39')][_0xe1cd('0x3c')]?_0x19aa1a[_0xe1cd('0x39')]:_0x451b02[_0xe1cd('0x3a')];_0x19aa1a[_0xe1cd('0x3f')]=qs[_0xe1cd('0x40')](_0x3ce081[_0xe1cd('0x36')]['sort']);_0x19aa1a[_0xe1cd('0x41')]=qs['filters'](_['pick'](_0x3ce081[_0xe1cd('0x36')],_0x451b02[_0xe1cd('0x37')]));if(_0x3ce081[_0xe1cd('0x36')][_0xe1cd('0x43')]){_0x19aa1a[_0xe1cd('0x41')]=_['merge'](_0x19aa1a[_0xe1cd('0x41')],{'$or':_[_0xe1cd('0x34')](_0x19aa1a[_0xe1cd('0x39')],function(_0x446554){var _0x2daf24={};_0x2daf24[_0x446554]={'$like':'%'+_0x3ce081['query'][_0xe1cd('0x43')]+'%'};return _0x2daf24;})});}_0x19aa1a=_['merge']({},_0x19aa1a,_0x3ce081['options']);return _0x31ea51[_0xe1cd('0x8a')](_0x19aa1a);}})[_0xe1cd('0x27')](function(_0x51a09a){if(_0x51a09a){_0x378634=_0x51a09a[_0xe1cd('0x3c')];if(!_0x3ce081[_0xe1cd('0x36')][_0xe1cd('0x3d')](_0xe1cd('0x3e'))){_0x19aa1a[_0xe1cd('0x21')]=qs['limit'](_0x3ce081['query'][_0xe1cd('0x21')]);_0x19aa1a['offset']=qs[_0xe1cd('0x1e')](_0x3ce081['query'][_0xe1cd('0x1e')]);}return _0x31ea51[_0xe1cd('0x8a')](_0x19aa1a);}})[_0xe1cd('0x27')](function(_0x3faf96){if(_0x3faf96){return _0x3faf96?{'count':_0x378634,'rows':_0x3faf96}:null;}})[_0xe1cd('0x27')](respondWithResult(_0xb42dc5,null))[_0xe1cd('0x47')](handleError(_0xb42dc5,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5c83a15..e7a73ee 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 _0x1861=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x5aa992,_0x559ebb){var _0x2e2d59=function(_0x1e2e35){while(--_0x1e2e35){_0x5aa992['push'](_0x5aa992['shift']());}};_0x2e2d59(++_0x559ebb);}(_0x1861,0xa3));var _0x1186=function(_0x397e92,_0x8684c5){_0x397e92=_0x397e92-0x0;var _0x5888a2=_0x1861[_0x397e92];return _0x5888a2;};'use strict';var EventEmitter=require(_0x1186('0x0'));var FaxQueue=require(_0x1186('0x1'))['db'][_0x1186('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1186('0x3')](0x0);var events={'afterCreate':_0x1186('0x4'),'afterUpdate':'update','afterDestroy':_0x1186('0x5')};function emitEvent(_0x4d058b){return function(_0xf0f1f2,_0xba0c7e,_0x47a1a2){FaxQueueEvents[_0x1186('0x6')](_0x4d058b+':'+_0xf0f1f2['id'],_0xf0f1f2);FaxQueueEvents[_0x1186('0x6')](_0x4d058b,_0xf0f1f2);_0x47a1a2(null);};}for(var e in events){if(events[_0x1186('0x7')](e)){var event=events[e];FaxQueue[_0x1186('0x8')](e,emitEvent(event));}}module[_0x1186('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x3da1=['FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2b95df,_0x51422f){var _0x26bade=function(_0x310d7f){while(--_0x310d7f){_0x2b95df['push'](_0x2b95df['shift']());}};_0x26bade(++_0x51422f);}(_0x3da1,0x170));var _0x13da=function(_0x2a913b,_0x19676e){_0x2a913b=_0x2a913b-0x0;var _0xa143d=_0x3da1[_0x2a913b];return _0xa143d;};'use strict';var EventEmitter=require(_0x13da('0x0'));var FaxQueue=require(_0x13da('0x1'))['db'][_0x13da('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x13da('0x3')](0x0);var events={'afterCreate':_0x13da('0x4'),'afterUpdate':'update','afterDestroy':_0x13da('0x5')};function emitEvent(_0x47b9e0){return function(_0x36a68b,_0x961ec4,_0x51396f){FaxQueueEvents[_0x13da('0x6')](_0x47b9e0+':'+_0x36a68b['id'],_0x36a68b);FaxQueueEvents['emit'](_0x47b9e0,_0x36a68b);_0x51396f(null);};}for(var e in events){if(events[_0x13da('0x7')](e)){var event=events[e];FaxQueue[_0x13da('0x8')](e,emitEvent(event));}}module[_0x13da('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 7251822..e90be24 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 _0x3708=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','util','../../config/logger'];(function(_0xe559ad,_0xe65503){var _0x37703a=function(_0x27a796){while(--_0x27a796){_0xe559ad['push'](_0xe559ad['shift']());}};_0x37703a(++_0xe65503);}(_0x3708,0xa7));var _0x8370=function(_0x2f5f7a,_0x4b53f3){_0x2f5f7a=_0x2f5f7a-0x0;var _0xf5e2=_0x3708[_0x2f5f7a];return _0xf5e2;};'use strict';var _=require('lodash');var util=require(_0x8370('0x0'));var logger=require(_0x8370('0x1'))(_0x8370('0x2'));var moment=require(_0x8370('0x3'));var BPromise=require(_0x8370('0x4'));var rp=require(_0x8370('0x5'));var fs=require('fs');var path=require(_0x8370('0x6'));var rimraf=require(_0x8370('0x7'));var config=require(_0x8370('0x8'));var attributes=require(_0x8370('0x9'));module[_0x8370('0xa')]=function(_0x8007bd,_0x549658){return _0x8007bd[_0x8370('0xb')]('FaxQueue',attributes,{'tableName':_0x8370('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe30=['FaxQueue','util','../../config/logger','api','moment','rimraf','./faxQueue.attributes','exports','define'];(function(_0x42fc4b,_0x4f32e2){var _0x3d2704=function(_0x1943b3){while(--_0x1943b3){_0x42fc4b['push'](_0x42fc4b['shift']());}};_0x3d2704(++_0x4f32e2);}(_0xfe30,0x76));var _0x0fe3=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0xfe30[_0x27530d];return _0x59e561;};'use strict';var _=require('lodash');var util=require(_0x0fe3('0x0'));var logger=require(_0x0fe3('0x1'))(_0x0fe3('0x2'));var moment=require(_0x0fe3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fe3('0x4'));var config=require('../../config/environment');var attributes=require(_0x0fe3('0x5'));module[_0x0fe3('0x6')]=function(_0x1587ed,_0x523c20){return _0x1587ed[_0x0fe3('0x7')](_0x0fe3('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index cce5f45..daaa14d 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 _0xc9a2=['register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','ShowFaxQueue','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x141e6d,_0x50ad37){var _0x987993=function(_0x49c0b7){while(--_0x49c0b7){_0x141e6d['push'](_0x141e6d['shift']());}};_0x987993(++_0x50ad37);}(_0xc9a2,0x146));var _0x2c9a=function(_0x8f2a60,_0x349317){_0x8f2a60=_0x8f2a60-0x0;var _0x3d3f4d=_0xc9a2[_0x8f2a60];return _0x3d3f4d;};'use strict';var _=require(_0x2c9a('0x0'));var util=require(_0x2c9a('0x1'));var moment=require(_0x2c9a('0x2'));var BPromise=require(_0x2c9a('0x3'));var rs=require(_0x2c9a('0x4'));var fs=require('fs');var Redis=require(_0x2c9a('0x5'));var db=require(_0x2c9a('0x6'))['db'];var utils=require(_0x2c9a('0x7'));var logger=require(_0x2c9a('0x8'))(_0x2c9a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2c9a('0xa')][_0x2c9a('0xb')]({'port':0x232a});config[_0x2c9a('0xc')]=_[_0x2c9a('0xd')](config[_0x2c9a('0xc')],{'host':_0x2c9a('0xe'),'port':0x18eb});var socket=require(_0x2c9a('0xf'))(new Redis(config[_0x2c9a('0xc')]));require('./faxQueue.socket')[_0x2c9a('0x10')](socket);function respondWithRpcPromise(_0x4da251,_0x30797a,_0x4382f9){return new BPromise(function(_0x4f9cea,_0x463b8f){return client['request'](_0x4da251,_0x4382f9)[_0x2c9a('0x11')](function(_0x3b92da){logger[_0x2c9a('0x12')](_0x2c9a('0x13'),_0x30797a,_0x2c9a('0x14'));logger['debug'](_0x2c9a('0x15'),_0x30797a,_0x2c9a('0x14'),JSON[_0x2c9a('0x16')](_0x3b92da));if(_0x3b92da['error']){if(_0x3b92da['error']['code']===0x1f4){logger[_0x2c9a('0x17')]('FaxQueue,\x20%s,\x20%s',_0x30797a,_0x3b92da[_0x2c9a('0x17')][_0x2c9a('0x18')]);return _0x463b8f(_0x3b92da[_0x2c9a('0x17')][_0x2c9a('0x18')]);}logger[_0x2c9a('0x17')]('FaxQueue,\x20%s,\x20%s',_0x30797a,_0x3b92da[_0x2c9a('0x17')][_0x2c9a('0x18')]);return _0x4f9cea(_0x3b92da[_0x2c9a('0x17')]['message']);}else{logger[_0x2c9a('0x12')](_0x2c9a('0x13'),_0x30797a,_0x2c9a('0x14'));_0x4f9cea(_0x3b92da['result']['message']);}})[_0x2c9a('0x19')](function(_0x4e8fce){logger[_0x2c9a('0x17')](_0x2c9a('0x13'),_0x30797a,_0x4e8fce);_0x463b8f(_0x4e8fce);});});}exports[_0x2c9a('0x1a')]=function(_0x1c3d47){var _0x5956a0=this;return new Promise(function(_0x5ea75e,_0xeb4d0d){return db['FaxQueue'][_0x2c9a('0x1b')]({'raw':_0x1c3d47['options']?_0x1c3d47[_0x2c9a('0x1c')][_0x2c9a('0x1d')]===undefined?!![]:![]:!![],'where':_0x1c3d47[_0x2c9a('0x1c')]?_0x1c3d47[_0x2c9a('0x1c')][_0x2c9a('0x1e')]||null:null,'attributes':_0x1c3d47[_0x2c9a('0x1c')]?_0x1c3d47[_0x2c9a('0x1c')][_0x2c9a('0x1f')]||null:null,'limit':_0x1c3d47[_0x2c9a('0x1c')]?_0x1c3d47[_0x2c9a('0x1c')][_0x2c9a('0x20')]||null:null,'include':_0x1c3d47[_0x2c9a('0x1c')]?_0x1c3d47[_0x2c9a('0x1c')][_0x2c9a('0x21')]?_[_0x2c9a('0x22')](_0x1c3d47[_0x2c9a('0x1c')]['include'],function(_0x897933){return{'model':db[_0x897933['model']],'as':_0x897933['as'],'attributes':_0x897933[_0x2c9a('0x1f')],'include':_0x897933[_0x2c9a('0x21')]?_[_0x2c9a('0x22')](_0x897933['include'],function(_0x48ca11){return{'model':db[_0x48ca11['model']],'as':_0x48ca11['as'],'attributes':_0x48ca11[_0x2c9a('0x1f')],'include':_0x48ca11[_0x2c9a('0x21')]?_['map'](_0x48ca11[_0x2c9a('0x21')],function(_0x2a3d30){return{'model':db[_0x2a3d30['model']],'as':_0x2a3d30['as'],'attributes':_0x2a3d30['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28aa4f){logger[_0x2c9a('0x12')](_0x2c9a('0x1a'),_0x1c3d47);logger['debug'](_0x2c9a('0x1a'),_0x1c3d47,JSON[_0x2c9a('0x16')](_0x28aa4f));_0x5ea75e(_0x28aa4f);})['catch'](function(_0x31d725){logger[_0x2c9a('0x17')](_0x2c9a('0x1a'),_0x31d725['message'],_0x1c3d47);_0xeb4d0d(_0x5956a0['error'](0x1f4,_0x31d725[_0x2c9a('0x18')]));});});};exports[_0x2c9a('0x23')]=function(_0x2668c2){var _0x2fc17e=this;return new Promise(function(_0x1e3e98,_0x38f3ba){return db['FaxQueue']['find']({'raw':_0x2668c2[_0x2c9a('0x1c')]?_0x2668c2[_0x2c9a('0x1c')][_0x2c9a('0x1d')]===undefined?!![]:![]:!![],'where':_0x2668c2['options']?_0x2668c2[_0x2c9a('0x1c')][_0x2c9a('0x1e')]||null:null,'attributes':_0x2668c2[_0x2c9a('0x1c')]?_0x2668c2[_0x2c9a('0x1c')]['attributes']||null:null,'include':_0x2668c2[_0x2c9a('0x1c')]?_0x2668c2[_0x2c9a('0x1c')][_0x2c9a('0x21')]?_[_0x2c9a('0x22')](_0x2668c2['options'][_0x2c9a('0x21')],function(_0x255c57){return{'model':db[_0x255c57['model']],'as':_0x255c57['as'],'attributes':_0x255c57[_0x2c9a('0x1f')],'include':_0x255c57[_0x2c9a('0x21')]?_[_0x2c9a('0x22')](_0x255c57[_0x2c9a('0x21')],function(_0x41a8bb){return{'model':db[_0x41a8bb[_0x2c9a('0x24')]],'as':_0x41a8bb['as'],'attributes':_0x41a8bb[_0x2c9a('0x1f')],'include':_0x41a8bb[_0x2c9a('0x21')]?_[_0x2c9a('0x22')](_0x41a8bb[_0x2c9a('0x21')],function(_0x2d6661){return{'model':db[_0x2d6661[_0x2c9a('0x24')]],'as':_0x2d6661['as'],'attributes':_0x2d6661[_0x2c9a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2c9a('0x11')](function(_0x179485){logger['info'](_0x2c9a('0x23'),_0x2668c2);logger[_0x2c9a('0x25')]('ShowFaxQueue',_0x2668c2,JSON[_0x2c9a('0x16')](_0x179485));_0x1e3e98(_0x179485);})[_0x2c9a('0x19')](function(_0x190a11){logger[_0x2c9a('0x17')](_0x2c9a('0x23'),_0x190a11['message'],_0x2668c2);_0x38f3ba(_0x2fc17e['error'](0x1f4,_0x190a11[_0x2c9a('0x18')]));});});}; \ No newline at end of file +var _0x6b19=['error','code','message','catch','FaxQueue','findAll','options','raw','where','limit','map','model','attributes','include','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x131a70,_0x5f53b2){var _0x212967=function(_0x2a43ac){while(--_0x2a43ac){_0x131a70['push'](_0x131a70['shift']());}};_0x212967(++_0x5f53b2);}(_0x6b19,0x65));var _0x96b1=function(_0x475e0a,_0x1366bc){_0x475e0a=_0x475e0a-0x0;var _0x1dacd2=_0x6b19[_0x475e0a];return _0x1dacd2;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require(_0x96b1('0x2'));var BPromise=require(_0x96b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b1('0x4'));var db=require(_0x96b1('0x5'))['db'];var utils=require(_0x96b1('0x6'));var logger=require(_0x96b1('0x7'))(_0x96b1('0x8'));var config=require(_0x96b1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x96b1('0xa')][_0x96b1('0xb')]({'port':0x232a});config[_0x96b1('0xc')]=_[_0x96b1('0xd')](config[_0x96b1('0xc')],{'host':_0x96b1('0xe'),'port':0x18eb});var socket=require(_0x96b1('0xf'))(new Redis(config[_0x96b1('0xc')]));require(_0x96b1('0x10'))['register'](socket);function respondWithRpcPromise(_0x1f8226,_0x2756ce,_0x260440){return new BPromise(function(_0x33b485,_0x4f60d3){return client[_0x96b1('0x11')](_0x1f8226,_0x260440)[_0x96b1('0x12')](function(_0x2a4401){logger[_0x96b1('0x13')](_0x96b1('0x14'),_0x2756ce,_0x96b1('0x15'));logger[_0x96b1('0x16')](_0x96b1('0x17'),_0x2756ce,_0x96b1('0x15'),JSON[_0x96b1('0x18')](_0x2a4401));if(_0x2a4401[_0x96b1('0x19')]){if(_0x2a4401['error'][_0x96b1('0x1a')]===0x1f4){logger['error'](_0x96b1('0x14'),_0x2756ce,_0x2a4401[_0x96b1('0x19')]['message']);return _0x4f60d3(_0x2a4401['error'][_0x96b1('0x1b')]);}logger[_0x96b1('0x19')]('FaxQueue,\x20%s,\x20%s',_0x2756ce,_0x2a4401[_0x96b1('0x19')]['message']);return _0x33b485(_0x2a4401[_0x96b1('0x19')]['message']);}else{logger['info'](_0x96b1('0x14'),_0x2756ce,_0x96b1('0x15'));_0x33b485(_0x2a4401['result']['message']);}})[_0x96b1('0x1c')](function(_0x6fb1d2){logger[_0x96b1('0x19')]('FaxQueue,\x20%s,\x20%s',_0x2756ce,_0x6fb1d2);_0x4f60d3(_0x6fb1d2);});});}exports['GetFaxQueue']=function(_0x4f9a7e){var _0x495e35=this;return new Promise(function(_0x162c84,_0x3cce26){return db[_0x96b1('0x1d')][_0x96b1('0x1e')]({'raw':_0x4f9a7e[_0x96b1('0x1f')]?_0x4f9a7e['options'][_0x96b1('0x20')]===undefined?!![]:![]:!![],'where':_0x4f9a7e[_0x96b1('0x1f')]?_0x4f9a7e[_0x96b1('0x1f')][_0x96b1('0x21')]||null:null,'attributes':_0x4f9a7e[_0x96b1('0x1f')]?_0x4f9a7e[_0x96b1('0x1f')]['attributes']||null:null,'limit':_0x4f9a7e[_0x96b1('0x1f')]?_0x4f9a7e[_0x96b1('0x1f')][_0x96b1('0x22')]||null:null,'include':_0x4f9a7e[_0x96b1('0x1f')]?_0x4f9a7e[_0x96b1('0x1f')]['include']?_[_0x96b1('0x23')](_0x4f9a7e[_0x96b1('0x1f')]['include'],function(_0x9ab53b){return{'model':db[_0x9ab53b[_0x96b1('0x24')]],'as':_0x9ab53b['as'],'attributes':_0x9ab53b[_0x96b1('0x25')],'include':_0x9ab53b[_0x96b1('0x26')]?_[_0x96b1('0x23')](_0x9ab53b[_0x96b1('0x26')],function(_0x59823a){return{'model':db[_0x59823a[_0x96b1('0x24')]],'as':_0x59823a['as'],'attributes':_0x59823a[_0x96b1('0x25')],'include':_0x59823a[_0x96b1('0x26')]?_[_0x96b1('0x23')](_0x59823a[_0x96b1('0x26')],function(_0x123d06){return{'model':db[_0x123d06[_0x96b1('0x24')]],'as':_0x123d06['as'],'attributes':_0x123d06['attributes']};}):[]};}):[]};}):[]:[]})[_0x96b1('0x12')](function(_0x17dcc5){logger['info']('GetFaxQueue',_0x4f9a7e);logger['debug'](_0x96b1('0x27'),_0x4f9a7e,JSON[_0x96b1('0x18')](_0x17dcc5));_0x162c84(_0x17dcc5);})[_0x96b1('0x1c')](function(_0x5bbe6f){logger[_0x96b1('0x19')](_0x96b1('0x27'),_0x5bbe6f[_0x96b1('0x1b')],_0x4f9a7e);_0x3cce26(_0x495e35['error'](0x1f4,_0x5bbe6f[_0x96b1('0x1b')]));});});};exports[_0x96b1('0x28')]=function(_0x3a990c){var _0x541fe9=this;return new Promise(function(_0x16aa63,_0x42437e){return db[_0x96b1('0x1d')][_0x96b1('0x29')]({'raw':_0x3a990c[_0x96b1('0x1f')]?_0x3a990c[_0x96b1('0x1f')][_0x96b1('0x20')]===undefined?!![]:![]:!![],'where':_0x3a990c['options']?_0x3a990c['options'][_0x96b1('0x21')]||null:null,'attributes':_0x3a990c[_0x96b1('0x1f')]?_0x3a990c[_0x96b1('0x1f')][_0x96b1('0x25')]||null:null,'include':_0x3a990c['options']?_0x3a990c[_0x96b1('0x1f')]['include']?_[_0x96b1('0x23')](_0x3a990c['options'][_0x96b1('0x26')],function(_0x7c5a13){return{'model':db[_0x7c5a13[_0x96b1('0x24')]],'as':_0x7c5a13['as'],'attributes':_0x7c5a13[_0x96b1('0x25')],'include':_0x7c5a13[_0x96b1('0x26')]?_[_0x96b1('0x23')](_0x7c5a13[_0x96b1('0x26')],function(_0x4ae452){return{'model':db[_0x4ae452[_0x96b1('0x24')]],'as':_0x4ae452['as'],'attributes':_0x4ae452[_0x96b1('0x25')],'include':_0x4ae452[_0x96b1('0x26')]?_[_0x96b1('0x23')](_0x4ae452[_0x96b1('0x26')],function(_0x342a8d){return{'model':db[_0x342a8d['model']],'as':_0x342a8d['as'],'attributes':_0x342a8d[_0x96b1('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4262ce){logger['info'](_0x96b1('0x28'),_0x3a990c);logger[_0x96b1('0x16')]('ShowFaxQueue',_0x3a990c,JSON[_0x96b1('0x18')](_0x4262ce));_0x16aa63(_0x4262ce);})['catch'](function(_0x1c7614){logger[_0x96b1('0x19')](_0x96b1('0x28'),_0x1c7614[_0x96b1('0x1b')],_0x3a990c);_0x42437e(_0x541fe9[_0x96b1('0x19')](0x1f4,_0x1c7614[_0x96b1('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3404e83..e13c4b3 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 _0xa969=['emit','removeListener','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0xd17b,_0xdccac5){var _0x584c05=function(_0x13e480){while(--_0x13e480){_0xd17b['push'](_0xd17b['shift']());}};_0x584c05(++_0xdccac5);}(_0xa969,0x114));var _0x9a96=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xa969[_0x1c510a];return _0x23cedd;};'use strict';var FaxQueueEvents=require(_0x9a96('0x0'));var events=[_0x9a96('0x1'),_0x9a96('0x2'),_0x9a96('0x3')];function createListener(_0x325b70,_0x4342b1){return function(_0x4d92bf){_0x4342b1[_0x9a96('0x4')](_0x325b70,_0x4d92bf);};}function removeListener(_0x230174,_0x110c58){return function(){FaxQueueEvents[_0x9a96('0x5')](_0x230174,_0x110c58);};}exports['register']=function(_0x23e3a9){for(var _0x1c43a3=0x0,_0x5511b2=events[_0x9a96('0x6')];_0x1c43a3<_0x5511b2;_0x1c43a3++){var _0xfc56d8=events[_0x1c43a3];var _0x706334=createListener(_0x9a96('0x7')+_0xfc56d8,_0x23e3a9);FaxQueueEvents['on'](_0xfc56d8,_0x706334);}}; \ No newline at end of file +var _0x4fb6=['remove','update','length'];(function(_0x4a225c,_0x597c5b){var _0x30835e=function(_0x26fd35){while(--_0x26fd35){_0x4a225c['push'](_0x4a225c['shift']());}};_0x30835e(++_0x597c5b);}(_0x4fb6,0x15f));var _0x64fb=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0x4fb6[_0x1a0c59];return _0xed67c9;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x64fb('0x0'),_0x64fb('0x1')];function createListener(_0x18cd78,_0x186470){return function(_0x5e0d28){_0x186470['emit'](_0x18cd78,_0x5e0d28);};}function removeListener(_0x5f45f7,_0x1b04ea){return function(){FaxQueueEvents['removeListener'](_0x5f45f7,_0x1b04ea);};}exports['register']=function(_0x2588cb){for(var _0x40ac85=0x0,_0x25599c=events[_0x64fb('0x2')];_0x40ac85<_0x25599c;_0x40ac85++){var _0x2e0297=events[_0x40ac85];var _0x1b3ba0=createListener('faxQueue:'+_0x2e0297,_0x2588cb);FaxQueueEvents['on'](_0x2e0297,_0x1b3ba0);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6c00aee..4191f16 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 _0xe944=['/:id/teams','getTeams','/:id/users','create','post','addAgents','put','update','delete','destroy','removeTeams','exports','multer','connect-timeout','fs-extra','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members'];(function(_0x55b493,_0x1bf69b){var _0x532b6f=function(_0x55bc15){while(--_0x55bc15){_0x55b493['push'](_0x55b493['shift']());}};_0x532b6f(++_0x1bf69b);}(_0xe944,0x174));var _0x4e94=function(_0xfc4317,_0x20eadc){_0xfc4317=_0xfc4317-0x0;var _0xba0892=_0xe944[_0xfc4317];return _0xba0892;};'use strict';var multer=require(_0x4e94('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e94('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4e94('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e94('0x3'));var controller=require(_0x4e94('0x4'));router[_0x4e94('0x5')]('/',auth[_0x4e94('0x6')](),controller['index']);router[_0x4e94('0x5')](_0x4e94('0x7'),auth[_0x4e94('0x6')](),controller[_0x4e94('0x8')]);router['get'](_0x4e94('0x9'),auth['isAuthenticated'](),controller[_0x4e94('0xa')]);router[_0x4e94('0x5')](_0x4e94('0xb'),auth[_0x4e94('0x6')](),controller['getMembers']);router[_0x4e94('0x5')](_0x4e94('0xc'),auth[_0x4e94('0x6')](),controller[_0x4e94('0xd')]);router[_0x4e94('0x5')](_0x4e94('0xe'),auth[_0x4e94('0x6')](),controller['getAgents']);router['post']('/',auth[_0x4e94('0x6')](),controller[_0x4e94('0xf')]);router[_0x4e94('0x10')](_0x4e94('0xc'),auth[_0x4e94('0x6')](),controller['addTeams']);router[_0x4e94('0x10')](_0x4e94('0xe'),auth[_0x4e94('0x6')](),controller[_0x4e94('0x11')]);router[_0x4e94('0x12')](_0x4e94('0x9'),auth[_0x4e94('0x6')](),controller[_0x4e94('0x13')]);router[_0x4e94('0x14')](_0x4e94('0x9'),auth[_0x4e94('0x6')](),controller[_0x4e94('0x15')]);router['delete']('/:id/teams',auth[_0x4e94('0x6')](),controller[_0x4e94('0x16')]);router[_0x4e94('0x14')](_0x4e94('0xe'),auth[_0x4e94('0x6')](),controller['removeAgents']);module[_0x4e94('0x17')]=router; \ No newline at end of file +var _0x49c1=['put','/:id','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','get','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents'];(function(_0x6f99d3,_0x3d142b){var _0x4e8330=function(_0x49a128){while(--_0x49a128){_0x6f99d3['push'](_0x6f99d3['shift']());}};_0x4e8330(++_0x3d142b);}(_0x49c1,0xef));var _0x149c=function(_0x26304a,_0x415ced){_0x26304a=_0x26304a-0x0;var _0x4b720a=_0x49c1[_0x26304a];return _0x4b720a;};'use strict';var multer=require(_0x149c('0x0'));var util=require('util');var path=require(_0x149c('0x1'));var timeout=require(_0x149c('0x2'));var express=require(_0x149c('0x3'));var router=express['Router']();var fs_extra=require(_0x149c('0x4'));var auth=require(_0x149c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x149c('0x6'));var controller=require(_0x149c('0x7'));router['get']('/',auth[_0x149c('0x8')](),controller['index']);router[_0x149c('0x9')](_0x149c('0xa'),auth['isAuthenticated'](),controller[_0x149c('0xb')]);router[_0x149c('0x9')]('/:id',auth[_0x149c('0x8')](),controller[_0x149c('0xc')]);router['get'](_0x149c('0xd'),auth[_0x149c('0x8')](),controller[_0x149c('0xe')]);router[_0x149c('0x9')]('/:id/teams',auth[_0x149c('0x8')](),controller[_0x149c('0xf')]);router[_0x149c('0x9')](_0x149c('0x10'),auth[_0x149c('0x8')](),controller[_0x149c('0x11')]);router[_0x149c('0x12')]('/',auth[_0x149c('0x8')](),controller['create']);router[_0x149c('0x12')](_0x149c('0x13'),auth['isAuthenticated'](),controller[_0x149c('0x14')]);router['post'](_0x149c('0x10'),auth[_0x149c('0x8')](),controller[_0x149c('0x15')]);router[_0x149c('0x16')](_0x149c('0x17'),auth[_0x149c('0x8')](),controller[_0x149c('0x18')]);router[_0x149c('0x19')](_0x149c('0x17'),auth['isAuthenticated'](),controller[_0x149c('0x1a')]);router[_0x149c('0x19')](_0x149c('0x13'),auth[_0x149c('0x8')](),controller[_0x149c('0x1b')]);router[_0x149c('0x19')](_0x149c('0x10'),auth[_0x149c('0x8')](),controller['removeAgents']);module[_0x149c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c602afa..12d6bd9 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 _0x41e5=['exports','DATE','STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x41e5,0x193));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x541e('0x0'));module[_0x541e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x541e('0x2')]},'leaveAt':{'type':Sequelize[_0x541e('0x2')]},'acceptAt':{'type':Sequelize[_0x541e('0x2')]},'exitAt':{'type':Sequelize[_0x541e('0x2')]},'reason':{'type':Sequelize[_0x541e('0x3')]}}; \ No newline at end of file +var _0x3de9=['exports','STRING','DATE','moment'];(function(_0x50d7c7,_0x3cef1d){var _0x5cb0f5=function(_0x3c157c){while(--_0x3c157c){_0x50d7c7['push'](_0x50d7c7['shift']());}};_0x5cb0f5(++_0x3cef1d);}(_0x3de9,0x143));var _0x93de=function(_0xee3d53,_0x3f4e0b){_0xee3d53=_0xee3d53-0x0;var _0x3797a2=_0x3de9[_0xee3d53];return _0x3797a2;};'use strict';var moment=require(_0x93de('0x0'));var Sequelize=require('sequelize');module[_0x93de('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x93de('0x2')]},'joinAt':{'type':Sequelize[_0x93de('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x93de('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x93de('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8625a0f..c599d4c 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 _0xffdc=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','type','options','includeAll','include','FaxQueueReport','findAll','catch','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x353313,_0x5c3686){var _0x4cb750=function(_0x17ac7e){while(--_0x17ac7e){_0x353313['push'](_0x353313['shift']());}};_0x4cb750(++_0x5c3686);}(_0xffdc,0x7f));var _0xcffd=function(_0x816ac,_0x2d6822){_0x816ac=_0x816ac-0x0;var _0xb6d4f=_0xffdc[_0x816ac];return _0xb6d4f;};'use strict';var emlformat=require(_0xcffd('0x0'));var rimraf=require(_0xcffd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcffd('0x2'));var rp=require(_0xcffd('0x3'));var moment=require('moment');var BPromise=require(_0xcffd('0x4'));var Mustache=require(_0xcffd('0x5'));var util=require(_0xcffd('0x6'));var path=require(_0xcffd('0x7'));var sox=require(_0xcffd('0x8'));var csv=require('to-csv');var ejs=require(_0xcffd('0x9'));var fs=require('fs');var fs_extra=require(_0xcffd('0xa'));var _=require(_0xcffd('0xb'));var squel=require(_0xcffd('0xc'));var crypto=require(_0xcffd('0xd'));var jsforce=require(_0xcffd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcffd('0xf'));var querystring=require(_0xcffd('0x10'));var Papa=require('papaparse');var Redis=require(_0xcffd('0x11'));var authService=require(_0xcffd('0x12'));var qs=require(_0xcffd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcffd('0x14'));var logger=require(_0xcffd('0x15'))(_0xcffd('0x16'));var utils=require(_0xcffd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcffd('0x18'))['db'];function respondWithStatusCode(_0x187ca8,_0x1340b0){_0x1340b0=_0x1340b0||0xcc;return function(_0x4ec693){if(_0x4ec693){return _0x187ca8[_0xcffd('0x19')](_0x1340b0);}return _0x187ca8['status'](_0x1340b0)['end']();};}function respondWithResult(_0x765795,_0x20e134){_0x20e134=_0x20e134||0xc8;return function(_0x4edde4){if(_0x4edde4){return _0x765795[_0xcffd('0x1a')](_0x20e134)[_0xcffd('0x1b')](_0x4edde4);}};}function respondWithFilteredResult(_0x3d1e6e,_0x32f579){return function(_0x4ec386){if(_0x4ec386){var _0x4921d1=typeof _0x32f579[_0xcffd('0x1c')]===_0xcffd('0x1d')&&typeof _0x32f579[_0xcffd('0x1e')]===_0xcffd('0x1d');var _0x867e85=_0x4ec386['count'];var _0x4216c4=_0x4921d1?0x0:_0x32f579['offset'];var _0x18e9e1=_0x4921d1?_0x4ec386[_0xcffd('0x1f')]:_0x32f579[_0xcffd('0x1c')]+_0x32f579[_0xcffd('0x1e')];var _0x33a27e;if(_0x18e9e1>=_0x867e85){_0x18e9e1=_0x867e85;_0x33a27e=0xc8;}else{_0x33a27e=0xce;}_0x3d1e6e[_0xcffd('0x1a')](_0x33a27e);return _0x3d1e6e[_0xcffd('0x20')](_0xcffd('0x21'),_0x4216c4+'-'+_0x18e9e1+'/'+_0x867e85)['json'](_0x4ec386);}return null;};}function patchUpdates(_0x73d51a){return function(_0x1f36f4){try{jsonpatch[_0xcffd('0x22')](_0x1f36f4,_0x73d51a,!![]);}catch(_0x4029a7){return BPromise[_0xcffd('0x23')](_0x4029a7);}return _0x1f36f4[_0xcffd('0x24')]();};}function saveUpdates(_0x1ad69f,_0x5d2d3c){return function(_0x52fc51){if(_0x52fc51){return _0x52fc51[_0xcffd('0x25')](_0x1ad69f)[_0xcffd('0x26')](function(_0x44f901){return _0x44f901;});}return null;};}function removeEntity(_0x3935ff,_0x3c3839){return function(_0x345a4d){if(_0x345a4d){return _0x345a4d[_0xcffd('0x27')]()[_0xcffd('0x26')](function(){_0x3935ff[_0xcffd('0x1a')](0xcc)[_0xcffd('0x28')]();});}};}function handleEntityNotFound(_0x37185d,_0x1f232a){return function(_0x544ae7){if(!_0x544ae7){_0x37185d[_0xcffd('0x19')](0x194);}return _0x544ae7;};}function handleError(_0x2b5044,_0x2c66a7){_0x2c66a7=_0x2c66a7||0x1f4;return function(_0x547bdb){logger[_0xcffd('0x29')](_0x547bdb[_0xcffd('0x2a')]);if(_0x547bdb[_0xcffd('0x2b')]){delete _0x547bdb['name'];}_0x2b5044['status'](_0x2c66a7)[_0xcffd('0x2c')](_0x547bdb);};}exports[_0xcffd('0x2d')]=function(_0x4b1c7d,_0x3cb0dd){var _0x6641e={},_0x5a97cf={},_0x3f46ea={'count':0x0,'rows':[]};var _0x3ab051=_['map'](db['FaxQueueReport'][_0xcffd('0x2e')],function(_0x1c40fb){return{'name':_0x1c40fb[_0xcffd('0x2f')],'type':_0x1c40fb['type'][_0xcffd('0x30')]};});_0x5a97cf[_0xcffd('0x31')]=_['map'](_0x3ab051,_0xcffd('0x2b'));_0x5a97cf[_0xcffd('0x32')]=_['keys'](_0x4b1c7d[_0xcffd('0x32')]);_0x5a97cf['filters']=_[_0xcffd('0x33')](_0x5a97cf[_0xcffd('0x31')],_0x5a97cf['query']);_0x6641e[_0xcffd('0x34')]=_['intersection'](_0x5a97cf['model'],qs[_0xcffd('0x35')](_0x4b1c7d[_0xcffd('0x32')][_0xcffd('0x35')]));_0x6641e['attributes']=_0x6641e['attributes'][_0xcffd('0x36')]?_0x6641e[_0xcffd('0x34')]:_0x5a97cf['model'];if(!_0x4b1c7d['query'][_0xcffd('0x37')]('nolimit')){_0x6641e[_0xcffd('0x1e')]=qs[_0xcffd('0x1e')](_0x4b1c7d[_0xcffd('0x32')][_0xcffd('0x1e')]);_0x6641e[_0xcffd('0x1c')]=qs[_0xcffd('0x1c')](_0x4b1c7d['query'][_0xcffd('0x1c')]);}_0x6641e[_0xcffd('0x38')]=qs[_0xcffd('0x39')](_0x4b1c7d[_0xcffd('0x32')][_0xcffd('0x39')]);_0x6641e[_0xcffd('0x3a')]=qs['filters'](_[_0xcffd('0x3b')](_0x4b1c7d['query'],_0x5a97cf[_0xcffd('0x3c')]),_0x3ab051);if(_0x4b1c7d['query'][_0xcffd('0x3d')]){_0x6641e[_0xcffd('0x3a')]=_[_0xcffd('0x3e')](_0x6641e[_0xcffd('0x3a')],{'$or':_[_0xcffd('0x3f')](_0x3ab051,function(_0x345bcb){if(_0x345bcb[_0xcffd('0x40')]!=='VIRTUAL'){var _0x1d4960={};_0x1d4960[_0x345bcb[_0xcffd('0x2b')]]={'$like':'%'+_0x4b1c7d[_0xcffd('0x32')]['filter']+'%'};return _0x1d4960;}})});}_0x6641e=_[_0xcffd('0x3e')]({},_0x6641e,_0x4b1c7d[_0xcffd('0x41')]);var _0x464d82={'where':_0x6641e['where']};return db['FaxQueueReport']['count'](_0x464d82)[_0xcffd('0x26')](function(_0x214d4f){_0x3f46ea[_0xcffd('0x1f')]=_0x214d4f;if(_0x4b1c7d['query'][_0xcffd('0x42')]){_0x6641e[_0xcffd('0x43')]=[{'all':!![]}];}return db[_0xcffd('0x44')][_0xcffd('0x45')](_0x6641e);})[_0xcffd('0x26')](function(_0x10c868){_0x3f46ea['rows']=_0x10c868;return _0x3f46ea;})[_0xcffd('0x26')](respondWithFilteredResult(_0x3cb0dd,_0x6641e))[_0xcffd('0x46')](handleError(_0x3cb0dd,null));};exports['show']=function(_0x454735,_0x587a53){var _0x5cb0a9={'raw':!![],'where':{'id':_0x454735[_0xcffd('0x47')]['id']}},_0x23e8fc={};_0x23e8fc[_0xcffd('0x31')]=_[_0xcffd('0x48')](db[_0xcffd('0x44')][_0xcffd('0x2e')]);_0x23e8fc[_0xcffd('0x32')]=_[_0xcffd('0x48')](_0x454735[_0xcffd('0x32')]);_0x23e8fc[_0xcffd('0x3c')]=_['intersection'](_0x23e8fc[_0xcffd('0x31')],_0x23e8fc[_0xcffd('0x32')]);_0x5cb0a9['attributes']=_['intersection'](_0x23e8fc[_0xcffd('0x31')],qs[_0xcffd('0x35')](_0x454735[_0xcffd('0x32')][_0xcffd('0x35')]));_0x5cb0a9[_0xcffd('0x34')]=_0x5cb0a9['attributes']['length']?_0x5cb0a9['attributes']:_0x23e8fc[_0xcffd('0x31')];if(_0x454735[_0xcffd('0x32')][_0xcffd('0x42')]){_0x5cb0a9[_0xcffd('0x43')]=[{'all':!![]}];}_0x5cb0a9=_[_0xcffd('0x3e')]({},_0x5cb0a9,_0x454735[_0xcffd('0x41')]);return db[_0xcffd('0x44')][_0xcffd('0x49')](_0x5cb0a9)[_0xcffd('0x26')](handleEntityNotFound(_0x587a53,null))[_0xcffd('0x26')](respondWithResult(_0x587a53,null))[_0xcffd('0x46')](handleError(_0x587a53,null));};exports[_0xcffd('0x4a')]=function(_0x207d2a,_0x3f23c1){return db['FaxQueueReport'][_0xcffd('0x4a')](_0x207d2a['body'],{})['then'](respondWithResult(_0x3f23c1,0xc9))[_0xcffd('0x46')](handleError(_0x3f23c1,null));};exports['update']=function(_0x6e3701,_0x42b396){if(_0x6e3701['body']['id']){delete _0x6e3701[_0xcffd('0x4b')]['id'];}return db[_0xcffd('0x44')][_0xcffd('0x49')]({'where':{'id':_0x6e3701[_0xcffd('0x47')]['id']}})[_0xcffd('0x26')](handleEntityNotFound(_0x42b396,null))['then'](saveUpdates(_0x6e3701[_0xcffd('0x4b')],null))[_0xcffd('0x26')](respondWithResult(_0x42b396,null))[_0xcffd('0x46')](handleError(_0x42b396,null));};exports[_0xcffd('0x27')]=function(_0x16f8fe,_0x2cc53f){return db[_0xcffd('0x44')]['find']({'where':{'id':_0x16f8fe['params']['id']}})['then'](handleEntityNotFound(_0x2cc53f,null))['then'](removeEntity(_0x2cc53f,null))['catch'](handleError(_0x2cc53f,null));};exports[_0xcffd('0x4c')]=function(_0x5076ca,_0x53b879){return db[_0xcffd('0x44')][_0xcffd('0x4c')]()[_0xcffd('0x26')](respondWithResult(_0x53b879,null))[_0xcffd('0x46')](handleError(_0x53b879,null));}; \ No newline at end of file +var _0x6e16=['includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6e16,0x1d3));var _0x66e1=function(_0x434428,_0x538af5){_0x434428=_0x434428-0x0;var _0x347369=_0x6e16[_0x434428];return _0x347369;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66e1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66e1('0x1'));var moment=require('moment');var BPromise=require(_0x66e1('0x2'));var Mustache=require(_0x66e1('0x3'));var util=require('util');var path=require(_0x66e1('0x4'));var sox=require('sox');var csv=require(_0x66e1('0x5'));var ejs=require(_0x66e1('0x6'));var fs=require('fs');var fs_extra=require(_0x66e1('0x7'));var _=require('lodash');var squel=require(_0x66e1('0x8'));var crypto=require(_0x66e1('0x9'));var jsforce=require(_0x66e1('0xa'));var deskjs=require(_0x66e1('0xb'));var toCsv=require(_0x66e1('0x5'));var querystring=require(_0x66e1('0xc'));var Papa=require(_0x66e1('0xd'));var Redis=require(_0x66e1('0xe'));var authService=require(_0x66e1('0xf'));var qs=require(_0x66e1('0x10'));var as=require(_0x66e1('0x11'));var hardwareService=require(_0x66e1('0x12'));var logger=require(_0x66e1('0x13'))(_0x66e1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66e1('0x15'));var db=require(_0x66e1('0x16'))['db'];function respondWithStatusCode(_0x23e018,_0x497712){_0x497712=_0x497712||0xcc;return function(_0x58c184){if(_0x58c184){return _0x23e018[_0x66e1('0x17')](_0x497712);}return _0x23e018['status'](_0x497712)[_0x66e1('0x18')]();};}function respondWithResult(_0x3e36ff,_0x5b802b){_0x5b802b=_0x5b802b||0xc8;return function(_0x9c17f9){if(_0x9c17f9){return _0x3e36ff[_0x66e1('0x19')](_0x5b802b)['json'](_0x9c17f9);}};}function respondWithFilteredResult(_0x137f52,_0x12ca0b){return function(_0x18e2ab){if(_0x18e2ab){var _0x3a68b3=typeof _0x12ca0b['offset']===_0x66e1('0x1a')&&typeof _0x12ca0b[_0x66e1('0x1b')]===_0x66e1('0x1a');var _0x28e236=_0x18e2ab[_0x66e1('0x1c')];var _0x4f3276=_0x3a68b3?0x0:_0x12ca0b['offset'];var _0x2b5585=_0x3a68b3?_0x18e2ab['count']:_0x12ca0b[_0x66e1('0x1d')]+_0x12ca0b[_0x66e1('0x1b')];var _0x260e87;if(_0x2b5585>=_0x28e236){_0x2b5585=_0x28e236;_0x260e87=0xc8;}else{_0x260e87=0xce;}_0x137f52[_0x66e1('0x19')](_0x260e87);return _0x137f52[_0x66e1('0x1e')]('Content-Range',_0x4f3276+'-'+_0x2b5585+'/'+_0x28e236)[_0x66e1('0x1f')](_0x18e2ab);}return null;};}function patchUpdates(_0x23c6ce){return function(_0xe2822e){try{jsonpatch[_0x66e1('0x20')](_0xe2822e,_0x23c6ce,!![]);}catch(_0x28f6cf){return BPromise[_0x66e1('0x21')](_0x28f6cf);}return _0xe2822e[_0x66e1('0x22')]();};}function saveUpdates(_0x38cf5b,_0x11232c){return function(_0x350b81){if(_0x350b81){return _0x350b81[_0x66e1('0x23')](_0x38cf5b)[_0x66e1('0x24')](function(_0x43686e){return _0x43686e;});}return null;};}function removeEntity(_0x2ea42d,_0x756840){return function(_0x11b7f0){if(_0x11b7f0){return _0x11b7f0[_0x66e1('0x25')]()['then'](function(){_0x2ea42d[_0x66e1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203919,_0x414c30){return function(_0x181a7b){if(!_0x181a7b){_0x203919[_0x66e1('0x17')](0x194);}return _0x181a7b;};}function handleError(_0x1e0dfe,_0x4f500e){_0x4f500e=_0x4f500e||0x1f4;return function(_0x5c416d){logger[_0x66e1('0x26')](_0x5c416d[_0x66e1('0x27')]);if(_0x5c416d['name']){delete _0x5c416d[_0x66e1('0x28')];}_0x1e0dfe['status'](_0x4f500e)['send'](_0x5c416d);};}exports[_0x66e1('0x29')]=function(_0x3fcc99,_0xdd2360){var _0x2720af={},_0x218902={},_0xb6a4bf={'count':0x0,'rows':[]};var _0x411f53=_[_0x66e1('0x2a')](db[_0x66e1('0x2b')][_0x66e1('0x2c')],function(_0x87bf90){return{'name':_0x87bf90[_0x66e1('0x2d')],'type':_0x87bf90['type'][_0x66e1('0x2e')]};});_0x218902[_0x66e1('0x2f')]=_['map'](_0x411f53,_0x66e1('0x28'));_0x218902[_0x66e1('0x30')]=_[_0x66e1('0x31')](_0x3fcc99[_0x66e1('0x30')]);_0x218902['filters']=_[_0x66e1('0x32')](_0x218902[_0x66e1('0x2f')],_0x218902[_0x66e1('0x30')]);_0x2720af['attributes']=_[_0x66e1('0x32')](_0x218902['model'],qs['fields'](_0x3fcc99['query'][_0x66e1('0x33')]));_0x2720af[_0x66e1('0x34')]=_0x2720af['attributes'][_0x66e1('0x35')]?_0x2720af[_0x66e1('0x34')]:_0x218902['model'];if(!_0x3fcc99['query'][_0x66e1('0x36')](_0x66e1('0x37'))){_0x2720af[_0x66e1('0x1b')]=qs['limit'](_0x3fcc99[_0x66e1('0x30')][_0x66e1('0x1b')]);_0x2720af[_0x66e1('0x1d')]=qs[_0x66e1('0x1d')](_0x3fcc99['query'][_0x66e1('0x1d')]);}_0x2720af[_0x66e1('0x38')]=qs[_0x66e1('0x39')](_0x3fcc99[_0x66e1('0x30')][_0x66e1('0x39')]);_0x2720af[_0x66e1('0x3a')]=qs[_0x66e1('0x3b')](_[_0x66e1('0x3c')](_0x3fcc99[_0x66e1('0x30')],_0x218902[_0x66e1('0x3b')]),_0x411f53);if(_0x3fcc99[_0x66e1('0x30')][_0x66e1('0x3d')]){_0x2720af[_0x66e1('0x3a')]=_[_0x66e1('0x3e')](_0x2720af[_0x66e1('0x3a')],{'$or':_[_0x66e1('0x2a')](_0x411f53,function(_0x3b4b75){if(_0x3b4b75['type']!==_0x66e1('0x3f')){var _0x2eea39={};_0x2eea39[_0x3b4b75[_0x66e1('0x28')]]={'$like':'%'+_0x3fcc99['query'][_0x66e1('0x3d')]+'%'};return _0x2eea39;}})});}_0x2720af=_[_0x66e1('0x3e')]({},_0x2720af,_0x3fcc99[_0x66e1('0x40')]);var _0x37ae7f={'where':_0x2720af[_0x66e1('0x3a')]};return db[_0x66e1('0x2b')][_0x66e1('0x1c')](_0x37ae7f)[_0x66e1('0x24')](function(_0x4ca55d){_0xb6a4bf[_0x66e1('0x1c')]=_0x4ca55d;if(_0x3fcc99[_0x66e1('0x30')][_0x66e1('0x41')]){_0x2720af[_0x66e1('0x42')]=[{'all':!![]}];}return db[_0x66e1('0x2b')][_0x66e1('0x43')](_0x2720af);})[_0x66e1('0x24')](function(_0x42f58e){_0xb6a4bf[_0x66e1('0x44')]=_0x42f58e;return _0xb6a4bf;})[_0x66e1('0x24')](respondWithFilteredResult(_0xdd2360,_0x2720af))[_0x66e1('0x45')](handleError(_0xdd2360,null));};exports[_0x66e1('0x46')]=function(_0x573936,_0x29bd2a){var _0x180230={'raw':!![],'where':{'id':_0x573936[_0x66e1('0x47')]['id']}},_0x561b89={};_0x561b89[_0x66e1('0x2f')]=_[_0x66e1('0x31')](db[_0x66e1('0x2b')][_0x66e1('0x2c')]);_0x561b89[_0x66e1('0x30')]=_[_0x66e1('0x31')](_0x573936[_0x66e1('0x30')]);_0x561b89['filters']=_[_0x66e1('0x32')](_0x561b89['model'],_0x561b89[_0x66e1('0x30')]);_0x180230['attributes']=_['intersection'](_0x561b89[_0x66e1('0x2f')],qs[_0x66e1('0x33')](_0x573936[_0x66e1('0x30')]['fields']));_0x180230[_0x66e1('0x34')]=_0x180230[_0x66e1('0x34')][_0x66e1('0x35')]?_0x180230[_0x66e1('0x34')]:_0x561b89['model'];if(_0x573936['query'][_0x66e1('0x41')]){_0x180230[_0x66e1('0x42')]=[{'all':!![]}];}_0x180230=_[_0x66e1('0x3e')]({},_0x180230,_0x573936[_0x66e1('0x40')]);return db[_0x66e1('0x2b')]['find'](_0x180230)[_0x66e1('0x24')](handleEntityNotFound(_0x29bd2a,null))['then'](respondWithResult(_0x29bd2a,null))[_0x66e1('0x45')](handleError(_0x29bd2a,null));};exports['create']=function(_0x16088d,_0x4ce4ad){return db[_0x66e1('0x2b')][_0x66e1('0x48')](_0x16088d[_0x66e1('0x49')],{})[_0x66e1('0x24')](respondWithResult(_0x4ce4ad,0xc9))[_0x66e1('0x45')](handleError(_0x4ce4ad,null));};exports[_0x66e1('0x23')]=function(_0x529fe2,_0x317424){if(_0x529fe2['body']['id']){delete _0x529fe2[_0x66e1('0x49')]['id'];}return db[_0x66e1('0x2b')]['find']({'where':{'id':_0x529fe2[_0x66e1('0x47')]['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0x317424,null))[_0x66e1('0x24')](saveUpdates(_0x529fe2[_0x66e1('0x49')],null))[_0x66e1('0x24')](respondWithResult(_0x317424,null))['catch'](handleError(_0x317424,null));};exports[_0x66e1('0x25')]=function(_0x2db8f3,_0x1717bd){return db[_0x66e1('0x2b')][_0x66e1('0x4a')]({'where':{'id':_0x2db8f3[_0x66e1('0x47')]['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0x1717bd,null))[_0x66e1('0x24')](removeEntity(_0x1717bd,null))['catch'](handleError(_0x1717bd,null));};exports[_0x66e1('0x4b')]=function(_0x45cb6c,_0x44ad9f){return db['FaxQueueReport'][_0x66e1('0x4b')]()[_0x66e1('0x24')](respondWithResult(_0x44ad9f,null))['catch'](handleError(_0x44ad9f,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1573bd1..d275e02 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 _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x4d0e59,_0x210d87){var _0x3be34a=function(_0x2ea258){while(--_0x2ea258){_0x4d0e59['push'](_0x4d0e59['shift']());}};_0x3be34a(++_0x210d87);}(_0x5fab,0x177));var _0xb5fa=function(_0x4f8ef6,_0x31607b){_0x4f8ef6=_0x4f8ef6-0x0;var _0x4f6880=_0x5fab[_0x4f8ef6];return _0x4f6880;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x19f397,_0x501470){var _0x4e4e43=function(_0x1b3e20){while(--_0x1b3e20){_0x19f397['push'](_0x19f397['shift']());}};_0x4e4e43(++_0x501470);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index aa0cb95..77d02a0 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 _0x44e8=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','body','options','raw','then','CreateFaxQueueReport','FaxQueueReport','update','limit','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x52402d,_0x189832){var _0x4c1ca7=function(_0x5e77a6){while(--_0x5e77a6){_0x52402d['push'](_0x52402d['shift']());}};_0x4c1ca7(++_0x189832);}(_0x44e8,0x72));var _0x844e=function(_0x5eb0cc,_0x1afe5f){_0x5eb0cc=_0x5eb0cc-0x0;var _0xcfb3b9=_0x44e8[_0x5eb0cc];return _0xcfb3b9;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var moment=require(_0x844e('0x1'));var BPromise=require(_0x844e('0x2'));var rs=require(_0x844e('0x3'));var fs=require('fs');var Redis=require(_0x844e('0x4'));var db=require(_0x844e('0x5'))['db'];var utils=require(_0x844e('0x6'));var logger=require(_0x844e('0x7'))(_0x844e('0x8'));var config=require('../../config/environment');var jayson=require(_0x844e('0x9'));var client=jayson['client'][_0x844e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28cf7c,_0x28397f,_0x337df9){return new BPromise(function(_0x147aa4,_0x8d8af8){return client[_0x844e('0xb')](_0x28cf7c,_0x337df9)['then'](function(_0x121d22){logger[_0x844e('0xc')](_0x844e('0xd'),_0x28397f,_0x844e('0xe'));logger[_0x844e('0xf')](_0x844e('0x10'),_0x28397f,_0x844e('0xe'),JSON[_0x844e('0x11')](_0x121d22));if(_0x121d22[_0x844e('0x12')]){if(_0x121d22[_0x844e('0x12')]['code']===0x1f4){logger[_0x844e('0x12')](_0x844e('0xd'),_0x28397f,_0x121d22[_0x844e('0x12')]['message']);return _0x8d8af8(_0x121d22[_0x844e('0x12')][_0x844e('0x13')]);}logger[_0x844e('0x12')](_0x844e('0xd'),_0x28397f,_0x121d22[_0x844e('0x12')][_0x844e('0x13')]);return _0x147aa4(_0x121d22[_0x844e('0x12')]['message']);}else{logger['info'](_0x844e('0xd'),_0x28397f,_0x844e('0xe'));_0x147aa4(_0x121d22['result'][_0x844e('0x13')]);}})[_0x844e('0x14')](function(_0x204532){logger[_0x844e('0x12')](_0x844e('0xd'),_0x28397f,_0x204532);_0x8d8af8(_0x204532);});});}exports['CreateFaxQueueReport']=function(_0x20428b){var _0x2d6857=this;return new Promise(function(_0x2ba31f,_0x31a9df){return db['FaxQueueReport']['create'](_0x20428b[_0x844e('0x15')],{'raw':_0x20428b['options']?_0x20428b[_0x844e('0x16')][_0x844e('0x17')]===undefined?!![]:![]:!![]})[_0x844e('0x18')](function(_0x5e91bb){logger[_0x844e('0xc')](_0x844e('0x19'),_0x20428b);logger[_0x844e('0xf')](_0x844e('0x19'),_0x20428b,JSON[_0x844e('0x11')](_0x5e91bb));_0x2ba31f(_0x5e91bb);})[_0x844e('0x14')](function(_0x40e79c){logger[_0x844e('0x12')](_0x844e('0x19'),_0x40e79c[_0x844e('0x13')],_0x20428b);_0x31a9df(_0x2d6857[_0x844e('0x12')](0x1f4,_0x40e79c[_0x844e('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x299841){var _0x4d79a0=this;return new Promise(function(_0x5673ea,_0x3b0d6c){return db[_0x844e('0x1a')][_0x844e('0x1b')](_0x299841[_0x844e('0x15')],{'raw':_0x299841['options']?_0x299841[_0x844e('0x16')][_0x844e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x299841[_0x844e('0x16')]?_0x299841[_0x844e('0x16')]['where']||null:null,'attributes':_0x299841[_0x844e('0x16')]?_0x299841[_0x844e('0x16')]['attributes']||null:null,'limit':_0x299841[_0x844e('0x16')]?_0x299841[_0x844e('0x16')][_0x844e('0x1c')]||null:null})[_0x844e('0x18')](function(_0x4ac2a4){logger[_0x844e('0xc')](_0x844e('0x1d'),_0x299841);logger[_0x844e('0xf')]('UpdateFaxQueueReport',_0x299841,JSON[_0x844e('0x11')](_0x4ac2a4));_0x5673ea(_0x4ac2a4);})[_0x844e('0x14')](function(_0x44a347){logger[_0x844e('0x12')]('UpdateFaxQueueReport',_0x44a347[_0x844e('0x13')],_0x299841);_0x3b0d6c(_0x4d79a0[_0x844e('0x12')](0x1f4,_0x44a347[_0x844e('0x13')]));});});}; \ No newline at end of file +var _0x2bc8=['limit','UpdateFaxQueueReport','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','where','attributes'];(function(_0x353a57,_0x5476c9){var _0x333e00=function(_0x2f9851){while(--_0x2f9851){_0x353a57['push'](_0x353a57['shift']());}};_0x333e00(++_0x5476c9);}(_0x2bc8,0x1a6));var _0x82bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x82bc('0x0'));var moment=require('moment');var BPromise=require(_0x82bc('0x1'));var rs=require(_0x82bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x82bc('0x3'));var logger=require(_0x82bc('0x4'))(_0x82bc('0x5'));var config=require('../../config/environment');var jayson=require(_0x82bc('0x6'));var client=jayson[_0x82bc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c8fc2,_0x59e7cb,_0x49316d){return new BPromise(function(_0x26559d,_0x55209b){return client['request'](_0x1c8fc2,_0x49316d)['then'](function(_0x3ad971){logger['info'](_0x82bc('0x8'),_0x59e7cb,_0x82bc('0x9'));logger[_0x82bc('0xa')](_0x82bc('0xb'),_0x59e7cb,_0x82bc('0x9'),JSON[_0x82bc('0xc')](_0x3ad971));if(_0x3ad971[_0x82bc('0xd')]){if(_0x3ad971['error']['code']===0x1f4){logger[_0x82bc('0xd')](_0x82bc('0x8'),_0x59e7cb,_0x3ad971['error'][_0x82bc('0xe')]);return _0x55209b(_0x3ad971[_0x82bc('0xd')]['message']);}logger['error'](_0x82bc('0x8'),_0x59e7cb,_0x3ad971['error'][_0x82bc('0xe')]);return _0x26559d(_0x3ad971[_0x82bc('0xd')][_0x82bc('0xe')]);}else{logger[_0x82bc('0xf')](_0x82bc('0x8'),_0x59e7cb,'request\x20sent');_0x26559d(_0x3ad971['result'][_0x82bc('0xe')]);}})[_0x82bc('0x10')](function(_0x117ed0){logger[_0x82bc('0xd')](_0x82bc('0x8'),_0x59e7cb,_0x117ed0);_0x55209b(_0x117ed0);});});}exports[_0x82bc('0x11')]=function(_0x13cb97){var _0x4087b2=this;return new Promise(function(_0x1a6993,_0x2ad871){return db[_0x82bc('0x12')][_0x82bc('0x13')](_0x13cb97[_0x82bc('0x14')],{'raw':_0x13cb97['options']?_0x13cb97[_0x82bc('0x15')][_0x82bc('0x16')]===undefined?!![]:![]:!![]})[_0x82bc('0x17')](function(_0x317070){logger[_0x82bc('0xf')]('CreateFaxQueueReport',_0x13cb97);logger[_0x82bc('0xa')](_0x82bc('0x11'),_0x13cb97,JSON[_0x82bc('0xc')](_0x317070));_0x1a6993(_0x317070);})[_0x82bc('0x10')](function(_0x5f102b){logger[_0x82bc('0xd')]('CreateFaxQueueReport',_0x5f102b[_0x82bc('0xe')],_0x13cb97);_0x2ad871(_0x4087b2['error'](0x1f4,_0x5f102b[_0x82bc('0xe')]));});});};exports['UpdateFaxQueueReport']=function(_0x524630){var _0x4659e0=this;return new Promise(function(_0x445688,_0x287ca4){return db['FaxQueueReport']['update'](_0x524630[_0x82bc('0x14')],{'raw':_0x524630[_0x82bc('0x15')]?_0x524630['options'][_0x82bc('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x524630[_0x82bc('0x15')]?_0x524630[_0x82bc('0x15')][_0x82bc('0x18')]||null:null,'attributes':_0x524630[_0x82bc('0x15')]?_0x524630['options'][_0x82bc('0x19')]||null:null,'limit':_0x524630[_0x82bc('0x15')]?_0x524630['options'][_0x82bc('0x1a')]||null:null})[_0x82bc('0x17')](function(_0x32c77a){logger[_0x82bc('0xf')](_0x82bc('0x1b'),_0x524630);logger['debug'](_0x82bc('0x1b'),_0x524630,JSON['stringify'](_0x32c77a));_0x445688(_0x32c77a);})['catch'](function(_0x380927){logger[_0x82bc('0xd')](_0x82bc('0x1b'),_0x380927[_0x82bc('0xe')],_0x524630);_0x287ca4(_0x4659e0[_0x82bc('0xd')](0x1f4,_0x380927['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 1f04054..3cb0e10 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 _0x1c40=['/:id','show','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x57c8a5,_0x5ed185){var _0x76df13=function(_0xda49f1){while(--_0xda49f1){_0x57c8a5['push'](_0x57c8a5['shift']());}};_0x76df13(++_0x5ed185);}(_0x1c40,0x17f));var _0x01c4=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x1c40[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require(_0x01c4('0x0'));var util=require(_0x01c4('0x1'));var path=require('path');var timeout=require(_0x01c4('0x2'));var express=require(_0x01c4('0x3'));var router=express[_0x01c4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x01c4('0x5'));var interaction=require(_0x01c4('0x6'));var config=require('../../config/environment');var controller=require(_0x01c4('0x7'));router['get']('/',auth[_0x01c4('0x8')](),controller[_0x01c4('0x9')]);router[_0x01c4('0xa')](_0x01c4('0xb'),auth['isAuthenticated'](),controller[_0x01c4('0xc')]);router[_0x01c4('0xa')](_0x01c4('0xd'),auth[_0x01c4('0x8')](),controller[_0x01c4('0xe')]);router['post']('/',auth[_0x01c4('0x8')](),controller['create']);router['put'](_0x01c4('0xd'),auth['isAuthenticated'](),controller[_0x01c4('0xf')]);router['delete']('/:id',auth[_0x01c4('0x8')](),controller[_0x01c4('0x10')]);module[_0x01c4('0x11')]=router; \ No newline at end of file +var _0x18b3=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x3dc535,_0x594fb9){var _0xbda957=function(_0x4e3775){while(--_0x4e3775){_0x3dc535['push'](_0x3dc535['shift']());}};_0xbda957(++_0x594fb9);}(_0x18b3,0xda));var _0x318b=function(_0x59fde6,_0x20a995){_0x59fde6=_0x59fde6-0x0;var _0x24566b=_0x18b3[_0x59fde6];return _0x24566b;};'use strict';var multer=require(_0x318b('0x0'));var util=require('util');var path=require(_0x318b('0x1'));var timeout=require(_0x318b('0x2'));var express=require('express');var router=express[_0x318b('0x3')]();var fs_extra=require(_0x318b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x318b('0x5'));var controller=require(_0x318b('0x6'));router[_0x318b('0x7')]('/',auth[_0x318b('0x8')](),controller[_0x318b('0x9')]);router['get']('/describe',auth[_0x318b('0x8')](),controller['describe']);router[_0x318b('0x7')](_0x318b('0xa'),auth[_0x318b('0x8')](),controller[_0x318b('0xb')]);router[_0x318b('0xc')]('/',auth['isAuthenticated'](),controller[_0x318b('0xd')]);router[_0x318b('0xe')](_0x318b('0xa'),auth[_0x318b('0x8')](),controller[_0x318b('0xf')]);router['delete'](_0x318b('0xa'),auth[_0x318b('0x8')](),controller[_0x318b('0x10')]);module[_0x318b('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 1152826..179a9b2 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3888d6,_0x2ccd33){var _0x1ab2c6=function(_0x1b4494){while(--_0x1b4494){_0x3888d6['push'](_0x3888d6['shift']());}};_0x1ab2c6(++_0x2ccd33);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xf3cd[_0x220dbb];return _0x2b77de;};'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 +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x2fa7bf,_0x42fd1a){var _0x5a6224=function(_0x5c9721){while(--_0x5c9721){_0x2fa7bf['push'](_0x2fa7bf['shift']());}};_0x5a6224(++_0x42fd1a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x4b84[_0x412e27];return _0x53da42;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 30dc930..7e5a31d 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 _0x2aa8=['show','params','options','find','catch','body','destroy','describe','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','FaxTransferReport','includeAll','include','findAll','rows'];(function(_0x5b5947,_0x11623c){var _0x7623e0=function(_0x40d10e){while(--_0x40d10e){_0x5b5947['push'](_0x5b5947['shift']());}};_0x7623e0(++_0x11623c);}(_0x2aa8,0x1ca));var _0x82aa=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2aa8[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x82aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82aa('0x1'));var jsonpatch=require(_0x82aa('0x2'));var rp=require(_0x82aa('0x3'));var moment=require(_0x82aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82aa('0x5'));var util=require(_0x82aa('0x6'));var path=require(_0x82aa('0x7'));var sox=require(_0x82aa('0x8'));var csv=require(_0x82aa('0x9'));var ejs=require(_0x82aa('0xa'));var fs=require('fs');var fs_extra=require(_0x82aa('0xb'));var _=require('lodash');var squel=require(_0x82aa('0xc'));var crypto=require(_0x82aa('0xd'));var jsforce=require(_0x82aa('0xe'));var deskjs=require(_0x82aa('0xf'));var toCsv=require(_0x82aa('0x9'));var querystring=require(_0x82aa('0x10'));var Papa=require('papaparse');var Redis=require(_0x82aa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x82aa('0x12'));var as=require(_0x82aa('0x13'));var hardwareService=require(_0x82aa('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82aa('0x15'));var db=require(_0x82aa('0x16'))['db'];function respondWithStatusCode(_0x71e209,_0xd12f2e){_0xd12f2e=_0xd12f2e||0xcc;return function(_0x41201d){if(_0x41201d){return _0x71e209['sendStatus'](_0xd12f2e);}return _0x71e209[_0x82aa('0x17')](_0xd12f2e)[_0x82aa('0x18')]();};}function respondWithResult(_0x1ef907,_0x35fe9a){_0x35fe9a=_0x35fe9a||0xc8;return function(_0x14a6a0){if(_0x14a6a0){return _0x1ef907['status'](_0x35fe9a)['json'](_0x14a6a0);}};}function respondWithFilteredResult(_0x5d926c,_0x53ddcc){return function(_0x5478aa){if(_0x5478aa){var _0x4f9943=typeof _0x53ddcc[_0x82aa('0x19')]===_0x82aa('0x1a')&&typeof _0x53ddcc[_0x82aa('0x1b')]===_0x82aa('0x1a');var _0x468ddd=_0x5478aa[_0x82aa('0x1c')];var _0x3443c1=_0x4f9943?0x0:_0x53ddcc['offset'];var _0x1e12d6=_0x4f9943?_0x5478aa[_0x82aa('0x1c')]:_0x53ddcc[_0x82aa('0x19')]+_0x53ddcc[_0x82aa('0x1b')];var _0x3302cf;if(_0x1e12d6>=_0x468ddd){_0x1e12d6=_0x468ddd;_0x3302cf=0xc8;}else{_0x3302cf=0xce;}_0x5d926c[_0x82aa('0x17')](_0x3302cf);return _0x5d926c[_0x82aa('0x1d')](_0x82aa('0x1e'),_0x3443c1+'-'+_0x1e12d6+'/'+_0x468ddd)['json'](_0x5478aa);}return null;};}function patchUpdates(_0x55719b){return function(_0x20f0d5){try{jsonpatch[_0x82aa('0x1f')](_0x20f0d5,_0x55719b,!![]);}catch(_0x48e171){return BPromise[_0x82aa('0x20')](_0x48e171);}return _0x20f0d5['save']();};}function saveUpdates(_0x25aa88,_0x358e7c){return function(_0x1b9a3e){if(_0x1b9a3e){return _0x1b9a3e[_0x82aa('0x21')](_0x25aa88)[_0x82aa('0x22')](function(_0x59b3e3){return _0x59b3e3;});}return null;};}function removeEntity(_0x40cd6f,_0x50c15f){return function(_0x48032f){if(_0x48032f){return _0x48032f['destroy']()['then'](function(){_0x40cd6f[_0x82aa('0x17')](0xcc)[_0x82aa('0x18')]();});}};}function handleEntityNotFound(_0x19b5f3,_0x57e26e){return function(_0x490893){if(!_0x490893){_0x19b5f3[_0x82aa('0x23')](0x194);}return _0x490893;};}function handleError(_0x9e6843,_0x446c50){_0x446c50=_0x446c50||0x1f4;return function(_0x3378aa){logger[_0x82aa('0x24')](_0x3378aa[_0x82aa('0x25')]);if(_0x3378aa[_0x82aa('0x26')]){delete _0x3378aa[_0x82aa('0x26')];}_0x9e6843[_0x82aa('0x17')](_0x446c50)[_0x82aa('0x27')](_0x3378aa);};}exports['index']=function(_0x2aa575,_0x5dab6c){var _0x4ae4de={},_0x5d492f={},_0x2d4dd8={'count':0x0,'rows':[]};var _0x274e4f=_['map'](db['FaxTransferReport'][_0x82aa('0x28')],function(_0x598dc5){return{'name':_0x598dc5[_0x82aa('0x29')],'type':_0x598dc5[_0x82aa('0x2a')][_0x82aa('0x2b')]};});_0x5d492f['model']=_['map'](_0x274e4f,'name');_0x5d492f[_0x82aa('0x2c')]=_[_0x82aa('0x2d')](_0x2aa575[_0x82aa('0x2c')]);_0x5d492f[_0x82aa('0x2e')]=_[_0x82aa('0x2f')](_0x5d492f[_0x82aa('0x30')],_0x5d492f[_0x82aa('0x2c')]);_0x4ae4de[_0x82aa('0x31')]=_['intersection'](_0x5d492f['model'],qs[_0x82aa('0x32')](_0x2aa575[_0x82aa('0x2c')]['fields']));_0x4ae4de['attributes']=_0x4ae4de[_0x82aa('0x31')][_0x82aa('0x33')]?_0x4ae4de[_0x82aa('0x31')]:_0x5d492f[_0x82aa('0x30')];if(!_0x2aa575['query'][_0x82aa('0x34')](_0x82aa('0x35'))){_0x4ae4de[_0x82aa('0x1b')]=qs['limit'](_0x2aa575['query'][_0x82aa('0x1b')]);_0x4ae4de[_0x82aa('0x19')]=qs['offset'](_0x2aa575['query']['offset']);}_0x4ae4de[_0x82aa('0x36')]=qs[_0x82aa('0x37')](_0x2aa575['query'][_0x82aa('0x37')]);_0x4ae4de[_0x82aa('0x38')]=qs[_0x82aa('0x2e')](_[_0x82aa('0x39')](_0x2aa575[_0x82aa('0x2c')],_0x5d492f[_0x82aa('0x2e')]),_0x274e4f);if(_0x2aa575[_0x82aa('0x2c')]['filter']){_0x4ae4de['where']=_[_0x82aa('0x3a')](_0x4ae4de[_0x82aa('0x38')],{'$or':_[_0x82aa('0x3b')](_0x274e4f,function(_0x21ccc2){if(_0x21ccc2[_0x82aa('0x2a')]!==_0x82aa('0x3c')){var _0x431c34={};_0x431c34[_0x21ccc2[_0x82aa('0x26')]]={'$like':'%'+_0x2aa575[_0x82aa('0x2c')][_0x82aa('0x3d')]+'%'};return _0x431c34;}})});}_0x4ae4de=_[_0x82aa('0x3a')]({},_0x4ae4de,_0x2aa575['options']);var _0xb133d0={'where':_0x4ae4de[_0x82aa('0x38')]};return db[_0x82aa('0x3e')][_0x82aa('0x1c')](_0xb133d0)['then'](function(_0x4c697f){_0x2d4dd8[_0x82aa('0x1c')]=_0x4c697f;if(_0x2aa575[_0x82aa('0x2c')][_0x82aa('0x3f')]){_0x4ae4de[_0x82aa('0x40')]=[{'all':!![]}];}return db[_0x82aa('0x3e')][_0x82aa('0x41')](_0x4ae4de);})[_0x82aa('0x22')](function(_0x5d8537){_0x2d4dd8[_0x82aa('0x42')]=_0x5d8537;return _0x2d4dd8;})[_0x82aa('0x22')](respondWithFilteredResult(_0x5dab6c,_0x4ae4de))['catch'](handleError(_0x5dab6c,null));};exports[_0x82aa('0x43')]=function(_0x3eba60,_0x10a40b){var _0x5896ef={'raw':!![],'where':{'id':_0x3eba60[_0x82aa('0x44')]['id']}},_0x4299e4={};_0x4299e4[_0x82aa('0x30')]=_[_0x82aa('0x2d')](db[_0x82aa('0x3e')][_0x82aa('0x28')]);_0x4299e4[_0x82aa('0x2c')]=_[_0x82aa('0x2d')](_0x3eba60[_0x82aa('0x2c')]);_0x4299e4[_0x82aa('0x2e')]=_[_0x82aa('0x2f')](_0x4299e4[_0x82aa('0x30')],_0x4299e4[_0x82aa('0x2c')]);_0x5896ef[_0x82aa('0x31')]=_[_0x82aa('0x2f')](_0x4299e4[_0x82aa('0x30')],qs[_0x82aa('0x32')](_0x3eba60[_0x82aa('0x2c')][_0x82aa('0x32')]));_0x5896ef[_0x82aa('0x31')]=_0x5896ef[_0x82aa('0x31')][_0x82aa('0x33')]?_0x5896ef[_0x82aa('0x31')]:_0x4299e4[_0x82aa('0x30')];if(_0x3eba60[_0x82aa('0x2c')]['includeAll']){_0x5896ef[_0x82aa('0x40')]=[{'all':!![]}];}_0x5896ef=_[_0x82aa('0x3a')]({},_0x5896ef,_0x3eba60[_0x82aa('0x45')]);return db[_0x82aa('0x3e')][_0x82aa('0x46')](_0x5896ef)['then'](handleEntityNotFound(_0x10a40b,null))['then'](respondWithResult(_0x10a40b,null))[_0x82aa('0x47')](handleError(_0x10a40b,null));};exports['create']=function(_0x4523d7,_0x516dfc){return db['FaxTransferReport']['create'](_0x4523d7[_0x82aa('0x48')],{})['then'](respondWithResult(_0x516dfc,0xc9))['catch'](handleError(_0x516dfc,null));};exports[_0x82aa('0x21')]=function(_0x444865,_0x47fe4d){if(_0x444865[_0x82aa('0x48')]['id']){delete _0x444865[_0x82aa('0x48')]['id'];}return db[_0x82aa('0x3e')][_0x82aa('0x46')]({'where':{'id':_0x444865[_0x82aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x47fe4d,null))[_0x82aa('0x22')](saveUpdates(_0x444865[_0x82aa('0x48')],null))[_0x82aa('0x22')](respondWithResult(_0x47fe4d,null))[_0x82aa('0x47')](handleError(_0x47fe4d,null));};exports[_0x82aa('0x49')]=function(_0x468338,_0x3d483a){return db[_0x82aa('0x3e')][_0x82aa('0x46')]({'where':{'id':_0x468338[_0x82aa('0x44')]['id']}})[_0x82aa('0x22')](handleEntityNotFound(_0x3d483a,null))['then'](removeEntity(_0x3d483a,null))['catch'](handleError(_0x3d483a,null));};exports[_0x82aa('0x4a')]=function(_0x1b2353,_0x4d96f9){return db[_0x82aa('0x3e')][_0x82aa('0x4a')]()['then'](respondWithResult(_0x4d96f9,null))[_0x82aa('0x47')](handleError(_0x4d96f9,null));}; \ No newline at end of file +var _0x7294=['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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filters','where','merge','filter','FaxTransferReport','includeAll','include','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox'];(function(_0x77e5d6,_0x16e152){var _0x38b5bb=function(_0x31cb34){while(--_0x31cb34){_0x77e5d6['push'](_0x77e5d6['shift']());}};_0x38b5bb(++_0x16e152);}(_0x7294,0x86));var _0x4729=function(_0x3b4903,_0x4be99b){_0x3b4903=_0x3b4903-0x0;var _0x55202c=_0x7294[_0x3b4903];return _0x55202c;};'use strict';var emlformat=require(_0x4729('0x0'));var rimraf=require(_0x4729('0x1'));var zipdir=require(_0x4729('0x2'));var jsonpatch=require(_0x4729('0x3'));var rp=require(_0x4729('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4729('0x5'));var path=require(_0x4729('0x6'));var sox=require(_0x4729('0x7'));var csv=require(_0x4729('0x8'));var ejs=require(_0x4729('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4729('0xa'));var squel=require(_0x4729('0xb'));var crypto=require(_0x4729('0xc'));var jsforce=require(_0x4729('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4729('0xe'));var Papa=require('papaparse');var Redis=require(_0x4729('0xf'));var authService=require(_0x4729('0x10'));var qs=require(_0x4729('0x11'));var as=require(_0x4729('0x12'));var hardwareService=require(_0x4729('0x13'));var logger=require(_0x4729('0x14'))(_0x4729('0x15'));var utils=require(_0x4729('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4729('0x17'));var db=require(_0x4729('0x18'))['db'];function respondWithStatusCode(_0xe0b215,_0x103f66){_0x103f66=_0x103f66||0xcc;return function(_0x24dcba){if(_0x24dcba){return _0xe0b215[_0x4729('0x19')](_0x103f66);}return _0xe0b215[_0x4729('0x1a')](_0x103f66)[_0x4729('0x1b')]();};}function respondWithResult(_0x3faa76,_0xe60306){_0xe60306=_0xe60306||0xc8;return function(_0x54d5ee){if(_0x54d5ee){return _0x3faa76[_0x4729('0x1a')](_0xe60306)['json'](_0x54d5ee);}};}function respondWithFilteredResult(_0x3cc662,_0x502c66){return function(_0xffe9b){if(_0xffe9b){var _0x1a293c=typeof _0x502c66[_0x4729('0x1c')]===_0x4729('0x1d')&&typeof _0x502c66[_0x4729('0x1e')]==='undefined';var _0x444a66=_0xffe9b[_0x4729('0x1f')];var _0x2b3210=_0x1a293c?0x0:_0x502c66[_0x4729('0x1c')];var _0x526181=_0x1a293c?_0xffe9b[_0x4729('0x1f')]:_0x502c66['offset']+_0x502c66[_0x4729('0x1e')];var _0x5d8fc0;if(_0x526181>=_0x444a66){_0x526181=_0x444a66;_0x5d8fc0=0xc8;}else{_0x5d8fc0=0xce;}_0x3cc662['status'](_0x5d8fc0);return _0x3cc662[_0x4729('0x20')](_0x4729('0x21'),_0x2b3210+'-'+_0x526181+'/'+_0x444a66)[_0x4729('0x22')](_0xffe9b);}return null;};}function patchUpdates(_0x36df0a){return function(_0x210499){try{jsonpatch[_0x4729('0x23')](_0x210499,_0x36df0a,!![]);}catch(_0x5af12f){return BPromise['reject'](_0x5af12f);}return _0x210499['save']();};}function saveUpdates(_0x1e0922,_0xd2e044){return function(_0x115957){if(_0x115957){return _0x115957[_0x4729('0x24')](_0x1e0922)['then'](function(_0x208f8e){return _0x208f8e;});}return null;};}function removeEntity(_0x25d795,_0x48ff76){return function(_0x30643b){if(_0x30643b){return _0x30643b[_0x4729('0x25')]()[_0x4729('0x26')](function(){_0x25d795['status'](0xcc)[_0x4729('0x1b')]();});}};}function handleEntityNotFound(_0x18dca7,_0x2439e6){return function(_0x1210ed){if(!_0x1210ed){_0x18dca7[_0x4729('0x19')](0x194);}return _0x1210ed;};}function handleError(_0x267f36,_0x166c26){_0x166c26=_0x166c26||0x1f4;return function(_0x1d502f){logger['error'](_0x1d502f[_0x4729('0x27')]);if(_0x1d502f['name']){delete _0x1d502f[_0x4729('0x28')];}_0x267f36['status'](_0x166c26)[_0x4729('0x29')](_0x1d502f);};}exports['index']=function(_0xb430d8,_0x3a0b3d){var _0x268c31={},_0x459401={},_0x9f1948={'count':0x0,'rows':[]};var _0x886d2a=_[_0x4729('0x2a')](db['FaxTransferReport'][_0x4729('0x2b')],function(_0x2e8b4b){return{'name':_0x2e8b4b[_0x4729('0x2c')],'type':_0x2e8b4b[_0x4729('0x2d')]['key']};});_0x459401[_0x4729('0x2e')]=_[_0x4729('0x2a')](_0x886d2a,_0x4729('0x28'));_0x459401[_0x4729('0x2f')]=_[_0x4729('0x30')](_0xb430d8['query']);_0x459401['filters']=_[_0x4729('0x31')](_0x459401[_0x4729('0x2e')],_0x459401['query']);_0x268c31[_0x4729('0x32')]=_['intersection'](_0x459401['model'],qs['fields'](_0xb430d8[_0x4729('0x2f')][_0x4729('0x33')]));_0x268c31[_0x4729('0x32')]=_0x268c31['attributes'][_0x4729('0x34')]?_0x268c31['attributes']:_0x459401[_0x4729('0x2e')];if(!_0xb430d8[_0x4729('0x2f')][_0x4729('0x35')](_0x4729('0x36'))){_0x268c31[_0x4729('0x1e')]=qs[_0x4729('0x1e')](_0xb430d8[_0x4729('0x2f')][_0x4729('0x1e')]);_0x268c31[_0x4729('0x1c')]=qs[_0x4729('0x1c')](_0xb430d8[_0x4729('0x2f')]['offset']);}_0x268c31[_0x4729('0x37')]=qs['sort'](_0xb430d8[_0x4729('0x2f')]['sort']);_0x268c31['where']=qs['filters'](_[_0x4729('0x38')](_0xb430d8[_0x4729('0x2f')],_0x459401[_0x4729('0x39')]),_0x886d2a);if(_0xb430d8[_0x4729('0x2f')]['filter']){_0x268c31[_0x4729('0x3a')]=_[_0x4729('0x3b')](_0x268c31[_0x4729('0x3a')],{'$or':_['map'](_0x886d2a,function(_0x1a3fa3){if(_0x1a3fa3[_0x4729('0x2d')]!=='VIRTUAL'){var _0x4dcbe5={};_0x4dcbe5[_0x1a3fa3['name']]={'$like':'%'+_0xb430d8[_0x4729('0x2f')][_0x4729('0x3c')]+'%'};return _0x4dcbe5;}})});}_0x268c31=_['merge']({},_0x268c31,_0xb430d8['options']);var _0x372460={'where':_0x268c31['where']};return db[_0x4729('0x3d')]['count'](_0x372460)[_0x4729('0x26')](function(_0x5eeb87){_0x9f1948[_0x4729('0x1f')]=_0x5eeb87;if(_0xb430d8[_0x4729('0x2f')][_0x4729('0x3e')]){_0x268c31[_0x4729('0x3f')]=[{'all':!![]}];}return db[_0x4729('0x3d')]['findAll'](_0x268c31);})[_0x4729('0x26')](function(_0x3a247b){_0x9f1948['rows']=_0x3a247b;return _0x9f1948;})[_0x4729('0x26')](respondWithFilteredResult(_0x3a0b3d,_0x268c31))[_0x4729('0x40')](handleError(_0x3a0b3d,null));};exports[_0x4729('0x41')]=function(_0xf4dd3d,_0x1e3501){var _0x1583ad={'raw':!![],'where':{'id':_0xf4dd3d['params']['id']}},_0x5f154d={};_0x5f154d[_0x4729('0x2e')]=_[_0x4729('0x30')](db['FaxTransferReport'][_0x4729('0x2b')]);_0x5f154d[_0x4729('0x2f')]=_[_0x4729('0x30')](_0xf4dd3d[_0x4729('0x2f')]);_0x5f154d[_0x4729('0x39')]=_[_0x4729('0x31')](_0x5f154d[_0x4729('0x2e')],_0x5f154d['query']);_0x1583ad[_0x4729('0x32')]=_[_0x4729('0x31')](_0x5f154d[_0x4729('0x2e')],qs[_0x4729('0x33')](_0xf4dd3d[_0x4729('0x2f')][_0x4729('0x33')]));_0x1583ad[_0x4729('0x32')]=_0x1583ad[_0x4729('0x32')]['length']?_0x1583ad[_0x4729('0x32')]:_0x5f154d['model'];if(_0xf4dd3d[_0x4729('0x2f')][_0x4729('0x3e')]){_0x1583ad[_0x4729('0x3f')]=[{'all':!![]}];}_0x1583ad=_[_0x4729('0x3b')]({},_0x1583ad,_0xf4dd3d['options']);return db[_0x4729('0x3d')][_0x4729('0x42')](_0x1583ad)[_0x4729('0x26')](handleEntityNotFound(_0x1e3501,null))[_0x4729('0x26')](respondWithResult(_0x1e3501,null))[_0x4729('0x40')](handleError(_0x1e3501,null));};exports[_0x4729('0x43')]=function(_0x3d80ff,_0xec0919){return db['FaxTransferReport'][_0x4729('0x43')](_0x3d80ff['body'],{})['then'](respondWithResult(_0xec0919,0xc9))['catch'](handleError(_0xec0919,null));};exports[_0x4729('0x24')]=function(_0x4cde24,_0x1b07eb){if(_0x4cde24[_0x4729('0x44')]['id']){delete _0x4cde24['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4cde24[_0x4729('0x45')]['id']}})[_0x4729('0x26')](handleEntityNotFound(_0x1b07eb,null))[_0x4729('0x26')](saveUpdates(_0x4cde24['body'],null))[_0x4729('0x26')](respondWithResult(_0x1b07eb,null))[_0x4729('0x40')](handleError(_0x1b07eb,null));};exports['destroy']=function(_0x2525a9,_0x55fe4d){return db[_0x4729('0x3d')][_0x4729('0x42')]({'where':{'id':_0x2525a9['params']['id']}})[_0x4729('0x26')](handleEntityNotFound(_0x55fe4d,null))[_0x4729('0x26')](removeEntity(_0x55fe4d,null))['catch'](handleError(_0x55fe4d,null));};exports['describe']=function(_0x3bbb9d,_0x422001){return db[_0x4729('0x3d')][_0x4729('0x46')]()[_0x4729('0x26')](respondWithResult(_0x422001,null))[_0x4729('0x40')](handleError(_0x422001,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 44cdc5b..fbdd063 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 _0xd94d=['define','report_fax_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x582f98,_0x1cc3ab){var _0x5ebca2=function(_0x30ddcf){while(--_0x30ddcf){_0x582f98['push'](_0x582f98['shift']());}};_0x5ebca2(++_0x1cc3ab);}(_0xd94d,0x16f));var _0xdd94=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd94d[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xdd94('0x0'));var logger=require(_0xdd94('0x1'))(_0xdd94('0x2'));var moment=require('moment');var BPromise=require(_0xdd94('0x3'));var rp=require(_0xdd94('0x4'));var fs=require('fs');var path=require(_0xdd94('0x5'));var rimraf=require(_0xdd94('0x6'));var config=require(_0xdd94('0x7'));var attributes=require(_0xdd94('0x8'));module[_0xdd94('0x9')]=function(_0x580c88,_0x1fd8a8){return _0x580c88[_0xdd94('0xa')]('FaxTransferReport',attributes,{'tableName':_0xdd94('0xb'),'paranoid':![],'indexes':[{'name':_0xdd94('0xc'),'fields':[_0xdd94('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb3a=['exports','define','FaxTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes'];(function(_0x1bf8f5,_0x28f62c){var _0x36a54e=function(_0x43ba61){while(--_0x43ba61){_0x1bf8f5['push'](_0x1bf8f5['shift']());}};_0x36a54e(++_0x28f62c);}(_0xdb3a,0x163));var _0xadb3=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xdb3a[_0x44216d];return _0xeca523;};'use strict';var _=require(_0xadb3('0x0'));var util=require('util');var logger=require(_0xadb3('0x1'))(_0xadb3('0x2'));var moment=require(_0xadb3('0x3'));var BPromise=require(_0xadb3('0x4'));var rp=require(_0xadb3('0x5'));var fs=require('fs');var path=require(_0xadb3('0x6'));var rimraf=require(_0xadb3('0x7'));var config=require('../../config/environment');var attributes=require(_0xadb3('0x8'));module[_0xadb3('0x9')]=function(_0x591f3e,_0x49cef0){return _0x591f3e[_0xadb3('0xa')](_0xadb3('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xadb3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 3e8e73d..773f135 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 _0xc1f6=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1f6,0x1d7));var _0x6c1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1f6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c1f('0x0'));var util=require(_0x6c1f('0x1'));var moment=require('moment');var BPromise=require(_0x6c1f('0x2'));var rs=require(_0x6c1f('0x3'));var fs=require('fs');var Redis=require(_0x6c1f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c1f('0x5'));var logger=require(_0x6c1f('0x6'))(_0x6c1f('0x7'));var config=require(_0x6c1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6c1f('0x9')][_0x6c1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fbf2d,_0x203593,_0x59f7d2){return new BPromise(function(_0x1fdae2,_0x36d0dd){return client['request'](_0x2fbf2d,_0x59f7d2)[_0x6c1f('0xb')](function(_0x3fc486){logger['info'](_0x6c1f('0xc'),_0x203593,_0x6c1f('0xd'));logger[_0x6c1f('0xe')](_0x6c1f('0xf'),_0x203593,_0x6c1f('0xd'),JSON[_0x6c1f('0x10')](_0x3fc486));if(_0x3fc486[_0x6c1f('0x11')]){if(_0x3fc486[_0x6c1f('0x11')][_0x6c1f('0x12')]===0x1f4){logger[_0x6c1f('0x11')](_0x6c1f('0xc'),_0x203593,_0x3fc486[_0x6c1f('0x11')]['message']);return _0x36d0dd(_0x3fc486[_0x6c1f('0x11')]['message']);}logger[_0x6c1f('0x11')](_0x6c1f('0xc'),_0x203593,_0x3fc486[_0x6c1f('0x11')]['message']);return _0x1fdae2(_0x3fc486[_0x6c1f('0x11')]['message']);}else{logger[_0x6c1f('0x13')](_0x6c1f('0xc'),_0x203593,_0x6c1f('0xd'));_0x1fdae2(_0x3fc486[_0x6c1f('0x14')]['message']);}})['catch'](function(_0x1cab20){logger[_0x6c1f('0x11')](_0x6c1f('0xc'),_0x203593,_0x1cab20);_0x36d0dd(_0x1cab20);});});} \ No newline at end of file +var _0x0763=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1398b2,_0x2e1739){var _0x1a6ea0=function(_0x31160e){while(--_0x31160e){_0x1398b2['push'](_0x1398b2['shift']());}};_0x1a6ea0(++_0x2e1739);}(_0x0763,0xd7));var _0x3076=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x0763[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3076('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3076('0x1'))['db'];var utils=require(_0x3076('0x2'));var logger=require(_0x3076('0x3'))('rpc');var config=require(_0x3076('0x4'));var jayson=require(_0x3076('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c34e3,_0x37ccd1,_0xc8ff19){return new BPromise(function(_0x48649e,_0x2bd530){return client[_0x3076('0x6')](_0x5c34e3,_0xc8ff19)[_0x3076('0x7')](function(_0x26086a){logger[_0x3076('0x8')](_0x3076('0x9'),_0x37ccd1,_0x3076('0xa'));logger[_0x3076('0xb')](_0x3076('0xc'),_0x37ccd1,_0x3076('0xa'),JSON['stringify'](_0x26086a));if(_0x26086a[_0x3076('0xd')]){if(_0x26086a[_0x3076('0xd')][_0x3076('0xe')]===0x1f4){logger[_0x3076('0xd')](_0x3076('0x9'),_0x37ccd1,_0x26086a[_0x3076('0xd')][_0x3076('0xf')]);return _0x2bd530(_0x26086a[_0x3076('0xd')]['message']);}logger[_0x3076('0xd')](_0x3076('0x9'),_0x37ccd1,_0x26086a[_0x3076('0xd')][_0x3076('0xf')]);return _0x48649e(_0x26086a[_0x3076('0xd')][_0x3076('0xf')]);}else{logger['info'](_0x3076('0x9'),_0x37ccd1,'request\x20sent');_0x48649e(_0x26086a[_0x3076('0x10')][_0x3076('0xf')]);}})['catch'](function(_0x40e247){logger[_0x3076('0xd')](_0x3076('0x9'),_0x37ccd1,_0x40e247);_0x2bd530(_0x40e247);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 554d707..50f859c 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 _0x7af2=['get','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','index'];(function(_0x56c9d4,_0x2bebe4){var _0x564df7=function(_0x19c2bc){while(--_0x19c2bc){_0x56c9d4['push'](_0x56c9d4['shift']());}};_0x564df7(++_0x2bebe4);}(_0x7af2,0x1d7));var _0x27af=function(_0x9b3589,_0x4726ef){_0x9b3589=_0x9b3589-0x0;var _0x1cb999=_0x7af2[_0x9b3589];return _0x1cb999;};'use strict';var multer=require(_0x27af('0x0'));var util=require(_0x27af('0x1'));var path=require(_0x27af('0x2'));var timeout=require(_0x27af('0x3'));var express=require(_0x27af('0x4'));var router=express[_0x27af('0x5')]();var fs_extra=require(_0x27af('0x6'));var auth=require(_0x27af('0x7'));var interaction=require(_0x27af('0x8'));var config=require(_0x27af('0x9'));var controller=require(_0x27af('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x27af('0xb')]);router[_0x27af('0xc')](_0x27af('0xd'),auth[_0x27af('0xe')](),controller[_0x27af('0xf')]);router[_0x27af('0xc')](_0x27af('0x10'),auth[_0x27af('0xe')](),controller['show']);router[_0x27af('0x11')]('/',auth[_0x27af('0xe')](),controller[_0x27af('0x12')]);router[_0x27af('0x13')](_0x27af('0x10'),auth[_0x27af('0xe')](),controller['update']);router[_0x27af('0x14')]('/:id',auth[_0x27af('0xe')](),controller[_0x27af('0x15')]);module[_0x27af('0x16')]=router; \ No newline at end of file +var _0x434b=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy'];(function(_0xe09bb6,_0x40fbf5){var _0x1eb76a=function(_0x434097){while(--_0x434097){_0xe09bb6['push'](_0xe09bb6['shift']());}};_0x1eb76a(++_0x40fbf5);}(_0x434b,0xe8));var _0xb434=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0x434b[_0x395bfe];return _0x35c81c;};'use strict';var multer=require(_0xb434('0x0'));var util=require('util');var path=require(_0xb434('0x1'));var timeout=require('connect-timeout');var express=require(_0xb434('0x2'));var router=express[_0xb434('0x3')]();var fs_extra=require(_0xb434('0x4'));var auth=require(_0xb434('0x5'));var interaction=require(_0xb434('0x6'));var config=require(_0xb434('0x7'));var controller=require(_0xb434('0x8'));router[_0xb434('0x9')]('/',auth[_0xb434('0xa')](),controller[_0xb434('0xb')]);router[_0xb434('0x9')](_0xb434('0xc'),auth[_0xb434('0xa')](),controller['describe']);router[_0xb434('0x9')](_0xb434('0xd'),auth[_0xb434('0xa')](),controller[_0xb434('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb434('0xf')]);router[_0xb434('0x10')](_0xb434('0xd'),auth['isAuthenticated'](),controller[_0xb434('0x11')]);router[_0xb434('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb434('0x13')]);module[_0xb434('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c6d9699..363e329 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 _0x6dbd=['/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated','index','show'];(function(_0x22e3f0,_0x51f702){var _0x327a3e=function(_0x4c7e81){while(--_0x4c7e81){_0x22e3f0['push'](_0x22e3f0['shift']());}};_0x327a3e(++_0x51f702);}(_0x6dbd,0x17a));var _0xd6db=function(_0x25e607,_0x12ebef){_0x25e607=_0x25e607-0x0;var _0x2d355f=_0x6dbd[_0x25e607];return _0x2d355f;};'use strict';var multer=require(_0xd6db('0x0'));var util=require(_0xd6db('0x1'));var path=require(_0xd6db('0x2'));var timeout=require(_0xd6db('0x3'));var express=require(_0xd6db('0x4'));var router=express[_0xd6db('0x5')]();var fs_extra=require(_0xd6db('0x6'));var auth=require(_0xd6db('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd6db('0x8'));router[_0xd6db('0x9')]('/',auth[_0xd6db('0xa')](),controller[_0xd6db('0xb')]);router[_0xd6db('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd6db('0xc')]);router[_0xd6db('0x9')](_0xd6db('0xd'),auth[_0xd6db('0xa')](),controller[_0xd6db('0xe')]);router['get']('/:id/fields',auth[_0xd6db('0xa')](),controller[_0xd6db('0xf')]);router[_0xd6db('0x10')]('/',auth[_0xd6db('0xa')](),controller[_0xd6db('0x11')]);router['post'](_0xd6db('0xd'),auth['isAuthenticated'](),controller[_0xd6db('0x12')]);router['put'](_0xd6db('0x13'),auth[_0xd6db('0xa')](),controller[_0xd6db('0x14')]);router['delete']('/:id',auth[_0xd6db('0xa')](),controller[_0xd6db('0x15')]);module[_0xd6db('0x16')]=router; \ No newline at end of file +var _0x1f85=['post','addConfiguration','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/configurations','/:id/fields','getFields'];(function(_0x101e9c,_0xa6b12b){var _0x50e102=function(_0x1b607a){while(--_0x1b607a){_0x101e9c['push'](_0x101e9c['shift']());}};_0x50e102(++_0xa6b12b);}(_0x1f85,0x65));var _0x51f8=function(_0x322582,_0x56fe47){_0x322582=_0x322582-0x0;var _0x39a016=_0x1f85[_0x322582];return _0x39a016;};'use strict';var multer=require('multer');var util=require(_0x51f8('0x0'));var path=require(_0x51f8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x51f8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x51f8('0x3'));var interaction=require(_0x51f8('0x4'));var config=require(_0x51f8('0x5'));var controller=require('./intDeskAccount.controller');router[_0x51f8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51f8('0x7')]);router[_0x51f8('0x6')](_0x51f8('0x8'),auth[_0x51f8('0x9')](),controller['show']);router[_0x51f8('0x6')](_0x51f8('0xa'),auth[_0x51f8('0x9')](),controller['getConfigurations']);router[_0x51f8('0x6')](_0x51f8('0xb'),auth['isAuthenticated'](),controller[_0x51f8('0xc')]);router[_0x51f8('0xd')]('/',auth[_0x51f8('0x9')](),controller['create']);router[_0x51f8('0xd')](_0x51f8('0xa'),auth[_0x51f8('0x9')](),controller[_0x51f8('0xe')]);router['put'](_0x51f8('0x8'),auth[_0x51f8('0x9')](),controller[_0x51f8('0xf')]);router[_0x51f8('0x10')]('/:id',auth[_0x51f8('0x9')](),controller[_0x51f8('0x11')]);module[_0x51f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 28ee05c..7ea2f2a 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 _0x499c=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x277e1e,_0x36aab5){var _0x49245e=function(_0x576be5){while(--_0x576be5){_0x277e1e['push'](_0x277e1e['shift']());}};_0x49245e(++_0x36aab5);}(_0x499c,0x150));var _0xc499=function(_0x4c5e32,_0xe3678){_0x4c5e32=_0x4c5e32-0x0;var _0x59cf38=_0x499c[_0x4c5e32];return _0x59cf38;};'use strict';var Sequelize=require('sequelize');module[_0xc499('0x0')]={'name':{'type':Sequelize[_0xc499('0x1')]},'description':{'type':Sequelize[_0xc499('0x1')]},'username':{'type':Sequelize[_0xc499('0x1')]},'remoteUri':{'type':Sequelize[_0xc499('0x1')]},'authType':{'type':Sequelize[_0xc499('0x2')](_0xc499('0x3')),'defaultValue':_0xc499('0x3')},'password':{'type':Sequelize[_0xc499('0x1')]},'consumerKey':{'type':Sequelize[_0xc499('0x1')]},'consumerSecret':{'type':Sequelize[_0xc499('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xc499('0x1')]},'serverUrl':{'type':Sequelize[_0xc499('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc499('0x2')](_0xc499('0x4'),_0xc499('0x5')),'defaultValue':_0xc499('0x4')}}; \ No newline at end of file +var _0x38a3=['ENUM','basic','newTab','sequelize','exports','STRING'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x38a3,0x1ad));var _0x338a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x38a3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x338a('0x0'));module[_0x338a('0x1')]={'name':{'type':Sequelize[_0x338a('0x2')]},'description':{'type':Sequelize[_0x338a('0x2')]},'username':{'type':Sequelize[_0x338a('0x2')]},'remoteUri':{'type':Sequelize[_0x338a('0x2')]},'authType':{'type':Sequelize[_0x338a('0x3')](_0x338a('0x4')),'defaultValue':_0x338a('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x338a('0x2')]},'token':{'type':Sequelize[_0x338a('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x338a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x338a('0x3')]('integrationTab',_0x338a('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a0b3674..bb11add 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 _0x5579=['ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','where','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','destroy','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','lastIndexOf','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x58b835,_0x48d03c){var _0x27198b=function(_0x999001){while(--_0x999001){_0x58b835['push'](_0x58b835['shift']());}};_0x27198b(++_0x48d03c);}(_0x5579,0x14f));var _0x9557=function(_0xccba9c,_0x2b2f02){_0xccba9c=_0xccba9c-0x0;var _0xedbf08=_0x5579[_0xccba9c];return _0xedbf08;};'use strict';var emlformat=require(_0x9557('0x0'));var rimraf=require(_0x9557('0x1'));var zipdir=require(_0x9557('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9557('0x3'));var moment=require(_0x9557('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9557('0x5'));var util=require(_0x9557('0x6'));var path=require(_0x9557('0x7'));var sox=require(_0x9557('0x8'));var csv=require(_0x9557('0x9'));var ejs=require(_0x9557('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9557('0xb'));var crypto=require(_0x9557('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9557('0xd'));var toCsv=require(_0x9557('0x9'));var querystring=require(_0x9557('0xe'));var Papa=require(_0x9557('0xf'));var Redis=require(_0x9557('0x10'));var authService=require(_0x9557('0x11'));var qs=require(_0x9557('0x12'));var as=require(_0x9557('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9557('0x14'));var utils=require(_0x9557('0x15'));var config=require(_0x9557('0x16'));var licenseUtil=require(_0x9557('0x17'));var db=require(_0x9557('0x18'))['db'];var integrations=require(_0x9557('0x19'));function respondWithStatusCode(_0x3e629c,_0x1764a6){_0x1764a6=_0x1764a6||0xcc;return function(_0x340267){if(_0x340267){return _0x3e629c[_0x9557('0x1a')](_0x1764a6);}return _0x3e629c[_0x9557('0x1b')](_0x1764a6)[_0x9557('0x1c')]();};}function respondWithResult(_0x496f27,_0x4224bc){_0x4224bc=_0x4224bc||0xc8;return function(_0x30280f){if(_0x30280f){return _0x496f27['status'](_0x4224bc)[_0x9557('0x1d')](_0x30280f);}};}function respondWithFilteredResult(_0xa7cd18,_0x4ef61d){return function(_0x8afcdf){if(_0x8afcdf){var _0x28a5b5=typeof _0x4ef61d['offset']===_0x9557('0x1e')&&typeof _0x4ef61d[_0x9557('0x1f')]==='undefined';var _0x47d031=_0x8afcdf[_0x9557('0x20')];var _0x55e16e=_0x28a5b5?0x0:_0x4ef61d[_0x9557('0x21')];var _0x194854=_0x28a5b5?_0x8afcdf[_0x9557('0x20')]:_0x4ef61d[_0x9557('0x21')]+_0x4ef61d['limit'];var _0x4e7457;if(_0x194854>=_0x47d031){_0x194854=_0x47d031;_0x4e7457=0xc8;}else{_0x4e7457=0xce;}_0xa7cd18[_0x9557('0x1b')](_0x4e7457);return _0xa7cd18[_0x9557('0x22')](_0x9557('0x23'),_0x55e16e+'-'+_0x194854+'/'+_0x47d031)['json'](_0x8afcdf);}return null;};}function patchUpdates(_0x49f425){return function(_0x38ea24){try{jsonpatch[_0x9557('0x24')](_0x38ea24,_0x49f425,!![]);}catch(_0x33a56c){return BPromise[_0x9557('0x25')](_0x33a56c);}return _0x38ea24[_0x9557('0x26')]();};}function saveUpdates(_0x4154bc,_0x3c5dea){return function(_0x442f05){if(_0x442f05){return _0x442f05[_0x9557('0x27')](_0x4154bc)[_0x9557('0x28')](function(_0xc2c3ac){return _0xc2c3ac;});}return null;};}function removeEntity(_0x1cc79f,_0xcd43a1){return function(_0x51691c){if(_0x51691c){return _0x51691c['destroy']()[_0x9557('0x28')](function(){_0x1cc79f[_0x9557('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf529,_0x504e5e){return function(_0x4f1d04){if(!_0x4f1d04){_0x1cf529[_0x9557('0x1a')](0x194);}return _0x4f1d04;};}function handleError(_0x12c431,_0xf85e3c){_0xf85e3c=_0xf85e3c||0x1f4;return function(_0x338f60){logger[_0x9557('0x29')](_0x338f60[_0x9557('0x2a')]);if(_0x338f60[_0x9557('0x2b')]){delete _0x338f60[_0x9557('0x2b')];}_0x12c431[_0x9557('0x1b')](_0xf85e3c)[_0x9557('0x2c')](_0x338f60);};}exports[_0x9557('0x2d')]=function(_0x17f77c,_0x59dde1){var _0x7f2dfa={},_0x37bcd1={},_0x15e4b4={'count':0x0,'rows':[]};var _0x450a94=_['map'](db[_0x9557('0x2e')][_0x9557('0x2f')],function(_0x39b93f){return{'name':_0x39b93f[_0x9557('0x30')],'type':_0x39b93f[_0x9557('0x31')][_0x9557('0x32')]};});_0x37bcd1[_0x9557('0x33')]=_[_0x9557('0x34')](_0x450a94,'name');_0x37bcd1['query']=_[_0x9557('0x35')](_0x17f77c[_0x9557('0x36')]);_0x37bcd1[_0x9557('0x37')]=_['intersection'](_0x37bcd1['model'],_0x37bcd1[_0x9557('0x36')]);_0x7f2dfa[_0x9557('0x38')]=_[_0x9557('0x39')](_0x37bcd1[_0x9557('0x33')],qs['fields'](_0x17f77c[_0x9557('0x36')][_0x9557('0x3a')]));_0x7f2dfa[_0x9557('0x38')]=_0x7f2dfa[_0x9557('0x38')]['length']?_0x7f2dfa['attributes']:_0x37bcd1[_0x9557('0x33')];if(!_0x17f77c[_0x9557('0x36')][_0x9557('0x3b')]('nolimit')){_0x7f2dfa[_0x9557('0x1f')]=qs[_0x9557('0x1f')](_0x17f77c['query'][_0x9557('0x1f')]);_0x7f2dfa['offset']=qs['offset'](_0x17f77c[_0x9557('0x36')][_0x9557('0x21')]);}_0x7f2dfa['order']=qs[_0x9557('0x3c')](_0x17f77c[_0x9557('0x36')]['sort']);_0x7f2dfa['where']=qs[_0x9557('0x37')](_[_0x9557('0x3d')](_0x17f77c[_0x9557('0x36')],_0x37bcd1[_0x9557('0x37')]),_0x450a94);if(_0x17f77c['query'][_0x9557('0x3e')]){_0x7f2dfa['where']=_[_0x9557('0x3f')](_0x7f2dfa['where'],{'$or':_[_0x9557('0x34')](_0x450a94,function(_0xa9d4d7){if(_0xa9d4d7[_0x9557('0x31')]!==_0x9557('0x40')){var _0x2c33cd={};_0x2c33cd[_0xa9d4d7['name']]={'$like':'%'+_0x17f77c['query'][_0x9557('0x3e')]+'%'};return _0x2c33cd;}})});}_0x7f2dfa=_[_0x9557('0x3f')]({},_0x7f2dfa,_0x17f77c['options']);var _0x2d1e6e={'where':_0x7f2dfa[_0x9557('0x41')]};return db[_0x9557('0x2e')][_0x9557('0x20')](_0x2d1e6e)[_0x9557('0x28')](function(_0x16cf2d){_0x15e4b4[_0x9557('0x20')]=_0x16cf2d;if(_0x17f77c[_0x9557('0x36')][_0x9557('0x42')]){_0x7f2dfa['include']=[{'all':!![]}];}return db[_0x9557('0x2e')][_0x9557('0x43')](_0x7f2dfa);})[_0x9557('0x28')](function(_0x202896){_0x15e4b4[_0x9557('0x44')]=_0x202896;return _0x15e4b4;})[_0x9557('0x28')](respondWithFilteredResult(_0x59dde1,_0x7f2dfa))[_0x9557('0x45')](handleError(_0x59dde1,null));};exports[_0x9557('0x46')]=function(_0x358274,_0x2808d8){var _0x500d44={'raw':![],'where':{'id':_0x358274[_0x9557('0x47')]['id']}},_0x4fa876={};_0x4fa876[_0x9557('0x33')]=_['keys'](db[_0x9557('0x2e')][_0x9557('0x2f')]);_0x4fa876[_0x9557('0x36')]=_[_0x9557('0x35')](_0x358274[_0x9557('0x36')]);_0x4fa876[_0x9557('0x37')]=_[_0x9557('0x39')](_0x4fa876['model'],_0x4fa876[_0x9557('0x36')]);_0x500d44['attributes']=_[_0x9557('0x39')](_0x4fa876['model'],qs[_0x9557('0x3a')](_0x358274[_0x9557('0x36')]['fields']));_0x500d44[_0x9557('0x38')]=_0x500d44[_0x9557('0x38')][_0x9557('0x48')]?_0x500d44['attributes']:_0x4fa876[_0x9557('0x33')];if(_0x358274[_0x9557('0x36')][_0x9557('0x42')]){_0x500d44[_0x9557('0x49')]=[{'all':!![]}];}_0x500d44=_[_0x9557('0x3f')]({},_0x500d44,_0x358274[_0x9557('0x4a')]);return db[_0x9557('0x2e')][_0x9557('0x4b')](_0x500d44)[_0x9557('0x28')](handleEntityNotFound(_0x2808d8,null))[_0x9557('0x28')](respondWithResult(_0x2808d8,null))[_0x9557('0x45')](handleError(_0x2808d8,null));};exports[_0x9557('0x4c')]=function(_0x2ee90a,_0x408a73){return db[_0x9557('0x2e')][_0x9557('0x4c')](_0x2ee90a[_0x9557('0x4d')],{})[_0x9557('0x28')](respondWithResult(_0x408a73,0xc9))[_0x9557('0x45')](handleError(_0x408a73,null));};exports[_0x9557('0x27')]=function(_0x3cdfbe,_0x23911c){if(_0x3cdfbe['body']['id']){delete _0x3cdfbe['body']['id'];}return db[_0x9557('0x2e')][_0x9557('0x4b')]({'where':{'id':_0x3cdfbe[_0x9557('0x47')]['id']}})['then'](handleEntityNotFound(_0x23911c,null))[_0x9557('0x28')](saveUpdates(_0x3cdfbe[_0x9557('0x4d')],null))[_0x9557('0x28')](respondWithResult(_0x23911c,null))[_0x9557('0x45')](handleError(_0x23911c,null));};exports[_0x9557('0x4e')]=function(_0x72d95a,_0x1eed24){return db[_0x9557('0x2e')][_0x9557('0x4b')]({'where':{'id':_0x72d95a[_0x9557('0x47')]['id']}})[_0x9557('0x28')](handleEntityNotFound(_0x1eed24,null))[_0x9557('0x28')](removeEntity(_0x1eed24,null))[_0x9557('0x45')](handleError(_0x1eed24,null));};exports[_0x9557('0x4f')]=function(_0x35a4dc,_0x354428,_0x554fd7){var _0x2b2cc3={};var _0x1b4d88={};var _0x451d60;var _0x596e85;return db['DeskAccount'][_0x9557('0x50')]({'where':{'id':_0x35a4dc[_0x9557('0x47')]['id']}})[_0x9557('0x28')](handleEntityNotFound(_0x354428,null))[_0x9557('0x28')](function(_0x43f155){if(_0x43f155){_0x451d60=_0x43f155;_0x1b4d88[_0x9557('0x33')]=_[_0x9557('0x35')](db['DeskConfiguration'][_0x9557('0x2f')]);_0x1b4d88['query']=_[_0x9557('0x35')](_0x35a4dc[_0x9557('0x36')]);_0x1b4d88[_0x9557('0x37')]=_[_0x9557('0x39')](_0x1b4d88[_0x9557('0x33')],_0x1b4d88[_0x9557('0x36')]);_0x2b2cc3[_0x9557('0x38')]=_[_0x9557('0x39')](_0x1b4d88['model'],qs[_0x9557('0x3a')](_0x35a4dc[_0x9557('0x36')]['fields']));_0x2b2cc3['attributes']=_0x2b2cc3[_0x9557('0x38')][_0x9557('0x48')]?_0x2b2cc3[_0x9557('0x38')]:_0x1b4d88['model'];_0x2b2cc3['order']=qs[_0x9557('0x3c')](_0x35a4dc[_0x9557('0x36')][_0x9557('0x3c')]);_0x2b2cc3[_0x9557('0x41')]=qs[_0x9557('0x37')](_['pick'](_0x35a4dc[_0x9557('0x36')],_0x1b4d88[_0x9557('0x37')]));if(_0x35a4dc['query'][_0x9557('0x3e')]){_0x2b2cc3[_0x9557('0x41')]=_['merge'](_0x2b2cc3['where'],{'$or':_[_0x9557('0x34')](_0x2b2cc3['attributes'],function(_0x300b2f){var _0x3a8ba4={};_0x3a8ba4[_0x300b2f]={'$like':'%'+_0x35a4dc[_0x9557('0x36')][_0x9557('0x3e')]+'%'};return _0x3a8ba4;})});}_0x2b2cc3=_['merge']({},_0x2b2cc3,_0x35a4dc[_0x9557('0x4a')]);return _0x451d60['getConfigurations'](_0x2b2cc3);}})[_0x9557('0x28')](function(_0x29a4b4){if(_0x29a4b4){_0x596e85=_0x29a4b4[_0x9557('0x48')];if(!_0x35a4dc[_0x9557('0x36')]['hasOwnProperty'](_0x9557('0x51'))){_0x2b2cc3['limit']=qs[_0x9557('0x1f')](_0x35a4dc[_0x9557('0x36')][_0x9557('0x1f')]);_0x2b2cc3[_0x9557('0x21')]=qs[_0x9557('0x21')](_0x35a4dc['query'][_0x9557('0x21')]);}return _0x451d60['getConfigurations'](_0x2b2cc3);}})['then'](function(_0x5dbf05){if(_0x5dbf05){return _0x5dbf05?{'count':_0x596e85,'rows':_0x5dbf05}:null;}})[_0x9557('0x28')](respondWithResult(_0x354428,null))[_0x9557('0x45')](handleError(_0x354428,null));};exports[_0x9557('0x52')]=function(_0x4ac41e,_0x46a5fd,_0x1bf4f2){if(_0x4ac41e[_0x9557('0x4d')]['id']){delete _0x4ac41e[_0x9557('0x4d')]['id'];}return db[_0x9557('0x2e')][_0x9557('0x50')]({'where':{'id':_0x4ac41e[_0x9557('0x47')]['id']}})[_0x9557('0x28')](handleEntityNotFound(_0x46a5fd,null))[_0x9557('0x28')](function(_0x914a3c){if(_0x914a3c){_0x4ac41e[_0x9557('0x4d')][_0x9557('0x53')]=_0x914a3c['id'];_0x4ac41e['body'][_0x9557('0x54')]=integrations[_0x9557('0x55')](_0x4ac41e[_0x9557('0x4d')]['channel'],_0x4ac41e['body'][_0x9557('0x31')]);_0x4ac41e[_0x9557('0x4d')][_0x9557('0x56')]=integrations[_0x9557('0x57')](_0x4ac41e[_0x9557('0x4d')][_0x9557('0x58')],_0x4ac41e[_0x9557('0x4d')][_0x9557('0x31')]);return db['DeskConfiguration'][_0x9557('0x4c')](_0x4ac41e['body'],{'include':[{'model':db['DeskField'],'as':_0x9557('0x54')},{'model':db[_0x9557('0x59')],'as':_0x9557('0x56')}]});}return null;})[_0x9557('0x28')](respondWithResult(_0x46a5fd,null))['catch'](handleError(_0x46a5fd,null));};exports[_0x9557('0x5a')]=function(_0x2de01b,_0xb1256e,_0x4e63bd){var _0x571bb0=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2d6ecb='';return db[_0x9557('0x2e')]['findOne']({'where':{'id':_0x2de01b[_0x9557('0x47')]['id']},'attributes':['id',_0x9557('0x5b'),_0x9557('0x5c'),_0x9557('0x5d'),_0x9557('0x5e'),_0x9557('0x5f'),_0x9557('0x60'),_0x9557('0x61'),_0x9557('0x62')]})[_0x9557('0x28')](handleEntityNotFound(_0xb1256e,null))[_0x9557('0x28')](function(_0x11c3d6){if(_0x11c3d6){_0x2d6ecb=_0x11c3d6[_0x9557('0x5b')];var _0x4228a5=_0x2d6ecb['slice'](-0x1);if(_0x4228a5==='/'){_0x2d6ecb=_0x2d6ecb['substring'](0x0,_0x2d6ecb[_0x9557('0x63')](_0x4228a5));}var _0x1319ad={'method':'GET','uri':util[_0x9557('0x64')](_0x9557('0x65'),_0x2d6ecb),'headers':{'Content-Type':_0x9557('0x66'),'Accept':_0x9557('0x66')},'json':!![]};if(_0x11c3d6[_0x9557('0x5c')]===_0x9557('0x67')){_0x1319ad['headers'][_0x9557('0x68')]=util[_0x9557('0x64')](_0x9557('0x69'),new Buffer(util[_0x9557('0x64')](_0x9557('0x6a'),_0x11c3d6[_0x9557('0x5d')],_0x11c3d6['password']))[_0x9557('0x6b')](_0x9557('0x6c')));}return rp(_0x1319ad)[_0x9557('0x28')](function(_0x3b6868){return _0x571bb0[_0x9557('0x6d')](_[_0x9557('0x34')](_0x3b6868['_embedded'][_0x9557('0x6e')],function(_0x42b195){return{'id':_0x42b195[_0x9557('0x2b')],'name':_0x42b195[_0x9557('0x2b')],'type':_0x42b195[_0x9557('0x31')],'active':_0x42b195[_0x9557('0x6f')],'label':_0x42b195['label'],'custom':!![]};}));});}})[_0x9557('0x28')](function(_0x40608a){return{'count':_0x40608a[_0x9557('0x48')],'rows':_0x40608a};})[_0x9557('0x28')](respondWithResult(_0xb1256e,null))[_0x9557('0x45')](function(_0x1d909f){var _0xdabdd1=_0x2de01b[_0x9557('0x36')][_0x9557('0x70')]?0x1f4:_0x1d909f[_0x9557('0x71')]||0x1f4;logger[_0x9557('0x29')](_0x9557('0x72'),'getFields',_0xdabdd1,JSON['stringify'](_0x1d909f));delete _0x1d909f['name'];if(_0xdabdd1===0x191){_0xdabdd1=0x190;}_0xb1256e[_0x9557('0x1b')](_0xdabdd1)[_0x9557('0x2c')](_0x2de01b[_0x9557('0x36')][_0x9557('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x1d909f[_0x9557('0x71')]}:_0x1d909f);});}; \ No newline at end of file +var _0xa5fd=['Authorization','%s:%s','toString','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','zip-dir','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','undefined','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','map','DeskAccount','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','options','hasOwnProperty','AccountId','Subjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','basic','headers'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0xa5fd,0x1bc));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xda5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xda5f('0x2'));var util=require(_0xda5f('0x3'));var path=require(_0xda5f('0x4'));var sox=require(_0xda5f('0x5'));var csv=require(_0xda5f('0x6'));var ejs=require(_0xda5f('0x7'));var fs=require('fs');var fs_extra=require(_0xda5f('0x8'));var _=require('lodash');var squel=require(_0xda5f('0x9'));var crypto=require(_0xda5f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xda5f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda5f('0xc'));var Redis=require(_0xda5f('0xd'));var authService=require(_0xda5f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xda5f('0xf'));var hardwareService=require(_0xda5f('0x10'));var logger=require('../../config/logger')(_0xda5f('0x11'));var utils=require(_0xda5f('0x12'));var config=require(_0xda5f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xda5f('0x14'))['db'];var integrations=require(_0xda5f('0x15'));function respondWithStatusCode(_0x2bbed3,_0x469aaa){_0x469aaa=_0x469aaa||0xcc;return function(_0x22af39){if(_0x22af39){return _0x2bbed3['sendStatus'](_0x469aaa);}return _0x2bbed3['status'](_0x469aaa)[_0xda5f('0x16')]();};}function respondWithResult(_0x571de2,_0x474429){_0x474429=_0x474429||0xc8;return function(_0x492547){if(_0x492547){return _0x571de2[_0xda5f('0x17')](_0x474429)['json'](_0x492547);}};}function respondWithFilteredResult(_0x9e3885,_0x3b44da){return function(_0x1af6c){if(_0x1af6c){var _0x5d528c=typeof _0x3b44da['offset']==='undefined'&&typeof _0x3b44da['limit']===_0xda5f('0x18');var _0x19a1f1=_0x1af6c[_0xda5f('0x19')];var _0x231fce=_0x5d528c?0x0:_0x3b44da[_0xda5f('0x1a')];var _0x365d45=_0x5d528c?_0x1af6c[_0xda5f('0x19')]:_0x3b44da[_0xda5f('0x1a')]+_0x3b44da['limit'];var _0x32f39a;if(_0x365d45>=_0x19a1f1){_0x365d45=_0x19a1f1;_0x32f39a=0xc8;}else{_0x32f39a=0xce;}_0x9e3885[_0xda5f('0x17')](_0x32f39a);return _0x9e3885['set'](_0xda5f('0x1b'),_0x231fce+'-'+_0x365d45+'/'+_0x19a1f1)[_0xda5f('0x1c')](_0x1af6c);}return null;};}function patchUpdates(_0x44ca59){return function(_0x9e40f3){try{jsonpatch[_0xda5f('0x1d')](_0x9e40f3,_0x44ca59,!![]);}catch(_0x5e1adf){return BPromise[_0xda5f('0x1e')](_0x5e1adf);}return _0x9e40f3[_0xda5f('0x1f')]();};}function saveUpdates(_0x5e8e7b,_0x2e0a63){return function(_0x2a0033){if(_0x2a0033){return _0x2a0033[_0xda5f('0x20')](_0x5e8e7b)['then'](function(_0x118527){return _0x118527;});}return null;};}function removeEntity(_0x462f6f,_0x32ffb7){return function(_0x5ba489){if(_0x5ba489){return _0x5ba489[_0xda5f('0x21')]()[_0xda5f('0x22')](function(){_0x462f6f['status'](0xcc)[_0xda5f('0x16')]();});}};}function handleEntityNotFound(_0x5e6ee2,_0x19fe32){return function(_0x455461){if(!_0x455461){_0x5e6ee2[_0xda5f('0x23')](0x194);}return _0x455461;};}function handleError(_0x14a1d2,_0x2029d4){_0x2029d4=_0x2029d4||0x1f4;return function(_0x40620){logger[_0xda5f('0x24')](_0x40620[_0xda5f('0x25')]);if(_0x40620['name']){delete _0x40620[_0xda5f('0x26')];}_0x14a1d2[_0xda5f('0x17')](_0x2029d4)['send'](_0x40620);};}exports['index']=function(_0xb77d16,_0x1a307e){var _0x221e71={},_0x2f6ade={},_0x478834={'count':0x0,'rows':[]};var _0xaf5fd1=_[_0xda5f('0x27')](db[_0xda5f('0x28')][_0xda5f('0x29')],function(_0x3ffd34){return{'name':_0x3ffd34['fieldName'],'type':_0x3ffd34[_0xda5f('0x2a')]['key']};});_0x2f6ade['model']=_[_0xda5f('0x27')](_0xaf5fd1,_0xda5f('0x26'));_0x2f6ade[_0xda5f('0x2b')]=_[_0xda5f('0x2c')](_0xb77d16['query']);_0x2f6ade[_0xda5f('0x2d')]=_[_0xda5f('0x2e')](_0x2f6ade[_0xda5f('0x2f')],_0x2f6ade[_0xda5f('0x2b')]);_0x221e71['attributes']=_[_0xda5f('0x2e')](_0x2f6ade['model'],qs[_0xda5f('0x30')](_0xb77d16[_0xda5f('0x2b')][_0xda5f('0x30')]));_0x221e71[_0xda5f('0x31')]=_0x221e71[_0xda5f('0x31')][_0xda5f('0x32')]?_0x221e71[_0xda5f('0x31')]:_0x2f6ade['model'];if(!_0xb77d16[_0xda5f('0x2b')]['hasOwnProperty'](_0xda5f('0x33'))){_0x221e71[_0xda5f('0x34')]=qs[_0xda5f('0x34')](_0xb77d16[_0xda5f('0x2b')][_0xda5f('0x34')]);_0x221e71[_0xda5f('0x1a')]=qs['offset'](_0xb77d16[_0xda5f('0x2b')][_0xda5f('0x1a')]);}_0x221e71[_0xda5f('0x35')]=qs[_0xda5f('0x36')](_0xb77d16[_0xda5f('0x2b')][_0xda5f('0x36')]);_0x221e71[_0xda5f('0x37')]=qs[_0xda5f('0x2d')](_[_0xda5f('0x38')](_0xb77d16[_0xda5f('0x2b')],_0x2f6ade['filters']),_0xaf5fd1);if(_0xb77d16['query']['filter']){_0x221e71[_0xda5f('0x37')]=_[_0xda5f('0x39')](_0x221e71[_0xda5f('0x37')],{'$or':_[_0xda5f('0x27')](_0xaf5fd1,function(_0x2e9289){if(_0x2e9289['type']!==_0xda5f('0x3a')){var _0x3a5dcc={};_0x3a5dcc[_0x2e9289[_0xda5f('0x26')]]={'$like':'%'+_0xb77d16[_0xda5f('0x2b')][_0xda5f('0x3b')]+'%'};return _0x3a5dcc;}})});}_0x221e71=_[_0xda5f('0x39')]({},_0x221e71,_0xb77d16['options']);var _0x198c89={'where':_0x221e71[_0xda5f('0x37')]};return db[_0xda5f('0x28')][_0xda5f('0x19')](_0x198c89)['then'](function(_0x5edcd7){_0x478834[_0xda5f('0x19')]=_0x5edcd7;if(_0xb77d16[_0xda5f('0x2b')][_0xda5f('0x3c')]){_0x221e71[_0xda5f('0x3d')]=[{'all':!![]}];}return db[_0xda5f('0x28')][_0xda5f('0x3e')](_0x221e71);})[_0xda5f('0x22')](function(_0x38fa91){_0x478834[_0xda5f('0x3f')]=_0x38fa91;return _0x478834;})[_0xda5f('0x22')](respondWithFilteredResult(_0x1a307e,_0x221e71))[_0xda5f('0x40')](handleError(_0x1a307e,null));};exports[_0xda5f('0x41')]=function(_0x5ce472,_0x339050){var _0x1baaa8={'raw':![],'where':{'id':_0x5ce472[_0xda5f('0x42')]['id']}},_0x14be1f={};_0x14be1f['model']=_[_0xda5f('0x2c')](db[_0xda5f('0x28')][_0xda5f('0x29')]);_0x14be1f[_0xda5f('0x2b')]=_[_0xda5f('0x2c')](_0x5ce472['query']);_0x14be1f[_0xda5f('0x2d')]=_[_0xda5f('0x2e')](_0x14be1f[_0xda5f('0x2f')],_0x14be1f[_0xda5f('0x2b')]);_0x1baaa8[_0xda5f('0x31')]=_['intersection'](_0x14be1f[_0xda5f('0x2f')],qs[_0xda5f('0x30')](_0x5ce472[_0xda5f('0x2b')][_0xda5f('0x30')]));_0x1baaa8[_0xda5f('0x31')]=_0x1baaa8[_0xda5f('0x31')][_0xda5f('0x32')]?_0x1baaa8[_0xda5f('0x31')]:_0x14be1f[_0xda5f('0x2f')];if(_0x5ce472[_0xda5f('0x2b')]['includeAll']){_0x1baaa8[_0xda5f('0x3d')]=[{'all':!![]}];}_0x1baaa8=_[_0xda5f('0x39')]({},_0x1baaa8,_0x5ce472['options']);return db[_0xda5f('0x28')][_0xda5f('0x43')](_0x1baaa8)[_0xda5f('0x22')](handleEntityNotFound(_0x339050,null))['then'](respondWithResult(_0x339050,null))['catch'](handleError(_0x339050,null));};exports[_0xda5f('0x44')]=function(_0x2ae181,_0x28d70f){return db[_0xda5f('0x28')][_0xda5f('0x44')](_0x2ae181[_0xda5f('0x45')],{})[_0xda5f('0x22')](respondWithResult(_0x28d70f,0xc9))[_0xda5f('0x40')](handleError(_0x28d70f,null));};exports['update']=function(_0x4e9ce3,_0x468135){if(_0x4e9ce3['body']['id']){delete _0x4e9ce3[_0xda5f('0x45')]['id'];}return db[_0xda5f('0x28')][_0xda5f('0x43')]({'where':{'id':_0x4e9ce3['params']['id']}})[_0xda5f('0x22')](handleEntityNotFound(_0x468135,null))[_0xda5f('0x22')](saveUpdates(_0x4e9ce3[_0xda5f('0x45')],null))[_0xda5f('0x22')](respondWithResult(_0x468135,null))[_0xda5f('0x40')](handleError(_0x468135,null));};exports[_0xda5f('0x21')]=function(_0x36aacd,_0x5ab613){return db[_0xda5f('0x28')]['find']({'where':{'id':_0x36aacd['params']['id']}})[_0xda5f('0x22')](handleEntityNotFound(_0x5ab613,null))[_0xda5f('0x22')](removeEntity(_0x5ab613,null))[_0xda5f('0x40')](handleError(_0x5ab613,null));};exports[_0xda5f('0x46')]=function(_0x329fb0,_0x975ccc,_0x3c3ad0){var _0x110717={};var _0x5d2772={};var _0x508893;var _0x4ee02e;return db[_0xda5f('0x28')][_0xda5f('0x47')]({'where':{'id':_0x329fb0[_0xda5f('0x42')]['id']}})[_0xda5f('0x22')](handleEntityNotFound(_0x975ccc,null))[_0xda5f('0x22')](function(_0x16d065){if(_0x16d065){_0x508893=_0x16d065;_0x5d2772[_0xda5f('0x2f')]=_[_0xda5f('0x2c')](db[_0xda5f('0x48')][_0xda5f('0x29')]);_0x5d2772[_0xda5f('0x2b')]=_[_0xda5f('0x2c')](_0x329fb0['query']);_0x5d2772[_0xda5f('0x2d')]=_['intersection'](_0x5d2772[_0xda5f('0x2f')],_0x5d2772[_0xda5f('0x2b')]);_0x110717[_0xda5f('0x31')]=_[_0xda5f('0x2e')](_0x5d2772['model'],qs['fields'](_0x329fb0[_0xda5f('0x2b')][_0xda5f('0x30')]));_0x110717[_0xda5f('0x31')]=_0x110717['attributes'][_0xda5f('0x32')]?_0x110717[_0xda5f('0x31')]:_0x5d2772[_0xda5f('0x2f')];_0x110717[_0xda5f('0x35')]=qs[_0xda5f('0x36')](_0x329fb0['query']['sort']);_0x110717['where']=qs['filters'](_[_0xda5f('0x38')](_0x329fb0['query'],_0x5d2772[_0xda5f('0x2d')]));if(_0x329fb0['query'][_0xda5f('0x3b')]){_0x110717[_0xda5f('0x37')]=_[_0xda5f('0x39')](_0x110717[_0xda5f('0x37')],{'$or':_[_0xda5f('0x27')](_0x110717['attributes'],function(_0x2b3b48){var _0x1430f6={};_0x1430f6[_0x2b3b48]={'$like':'%'+_0x329fb0['query'][_0xda5f('0x3b')]+'%'};return _0x1430f6;})});}_0x110717=_[_0xda5f('0x39')]({},_0x110717,_0x329fb0[_0xda5f('0x49')]);return _0x508893[_0xda5f('0x46')](_0x110717);}})[_0xda5f('0x22')](function(_0x1feb26){if(_0x1feb26){_0x4ee02e=_0x1feb26[_0xda5f('0x32')];if(!_0x329fb0[_0xda5f('0x2b')][_0xda5f('0x4a')](_0xda5f('0x33'))){_0x110717['limit']=qs[_0xda5f('0x34')](_0x329fb0['query'][_0xda5f('0x34')]);_0x110717[_0xda5f('0x1a')]=qs[_0xda5f('0x1a')](_0x329fb0[_0xda5f('0x2b')]['offset']);}return _0x508893[_0xda5f('0x46')](_0x110717);}})[_0xda5f('0x22')](function(_0x652124){if(_0x652124){return _0x652124?{'count':_0x4ee02e,'rows':_0x652124}:null;}})[_0xda5f('0x22')](respondWithResult(_0x975ccc,null))[_0xda5f('0x40')](handleError(_0x975ccc,null));};exports['addConfiguration']=function(_0x11be0f,_0x54ab03,_0x3c16da){if(_0x11be0f[_0xda5f('0x45')]['id']){delete _0x11be0f[_0xda5f('0x45')]['id'];}return db[_0xda5f('0x28')]['findOne']({'where':{'id':_0x11be0f['params']['id']}})[_0xda5f('0x22')](handleEntityNotFound(_0x54ab03,null))[_0xda5f('0x22')](function(_0x539121){if(_0x539121){_0x11be0f['body'][_0xda5f('0x4b')]=_0x539121['id'];_0x11be0f[_0xda5f('0x45')][_0xda5f('0x4c')]=integrations['getSubjects'](_0x11be0f[_0xda5f('0x45')][_0xda5f('0x4d')],_0x11be0f[_0xda5f('0x45')][_0xda5f('0x2a')]);_0x11be0f[_0xda5f('0x45')][_0xda5f('0x4e')]=integrations['getDescriptions'](_0x11be0f[_0xda5f('0x45')][_0xda5f('0x4d')],_0x11be0f[_0xda5f('0x45')][_0xda5f('0x2a')]);return db[_0xda5f('0x48')][_0xda5f('0x44')](_0x11be0f['body'],{'include':[{'model':db[_0xda5f('0x4f')],'as':'Subjects'},{'model':db[_0xda5f('0x4f')],'as':_0xda5f('0x4e')}]});}return null;})[_0xda5f('0x22')](respondWithResult(_0x54ab03,null))['catch'](handleError(_0x54ab03,null));};exports[_0xda5f('0x50')]=function(_0x29bc66,_0x5b6436,_0x848d46){var _0x1641cb=[{'name':'priority','label':_0xda5f('0x51'),'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 _0x2defc2='';return db[_0xda5f('0x28')][_0xda5f('0x47')]({'where':{'id':_0x29bc66[_0xda5f('0x42')]['id']},'attributes':['id',_0xda5f('0x52'),'authType',_0xda5f('0x53'),_0xda5f('0x54'),_0xda5f('0x55'),'consumerSecret','token',_0xda5f('0x56')]})[_0xda5f('0x22')](handleEntityNotFound(_0x5b6436,null))['then'](function(_0x4b5dcb){if(_0x4b5dcb){_0x2defc2=_0x4b5dcb[_0xda5f('0x52')];var _0x117e7c=_0x2defc2[_0xda5f('0x57')](-0x1);if(_0x117e7c==='/'){_0x2defc2=_0x2defc2[_0xda5f('0x58')](0x0,_0x2defc2[_0xda5f('0x59')](_0x117e7c));}var _0x5d62dc={'method':'GET','uri':util[_0xda5f('0x5a')](_0xda5f('0x5b'),_0x2defc2),'headers':{'Content-Type':_0xda5f('0x5c'),'Accept':_0xda5f('0x5c')},'json':!![]};if(_0x4b5dcb[_0xda5f('0x5d')]===_0xda5f('0x5e')){_0x5d62dc[_0xda5f('0x5f')][_0xda5f('0x60')]=util['format']('Basic\x20%s',new Buffer(util['format'](_0xda5f('0x61'),_0x4b5dcb['username'],_0x4b5dcb[_0xda5f('0x54')]))[_0xda5f('0x62')]('base64'));}return rp(_0x5d62dc)[_0xda5f('0x22')](function(_0x3008a2){return _0x1641cb[_0xda5f('0x63')](_[_0xda5f('0x27')](_0x3008a2[_0xda5f('0x64')][_0xda5f('0x65')],function(_0x7740b7){return{'id':_0x7740b7[_0xda5f('0x26')],'name':_0x7740b7[_0xda5f('0x26')],'type':_0x7740b7[_0xda5f('0x2a')],'active':_0x7740b7['active'],'label':_0x7740b7[_0xda5f('0x66')],'custom':!![]};}));});}})[_0xda5f('0x22')](function(_0xe2dda){return{'count':_0xe2dda[_0xda5f('0x32')],'rows':_0xe2dda};})['then'](respondWithResult(_0x5b6436,null))[_0xda5f('0x40')](function(_0x20a015){var _0x252a47=_0x29bc66[_0xda5f('0x2b')][_0xda5f('0x67')]?0x1f4:_0x20a015[_0xda5f('0x68')]||0x1f4;logger['error'](_0xda5f('0x69'),_0xda5f('0x50'),_0x252a47,JSON[_0xda5f('0x6a')](_0x20a015));delete _0x20a015['name'];if(_0x252a47===0x191){_0x252a47=0x190;}_0x5b6436['status'](_0x252a47)[_0xda5f('0x6b')](_0x29bc66[_0xda5f('0x2b')][_0xda5f('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x20a015[_0xda5f('0x68')]}:_0x20a015);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index eba15f3..2564750 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 _0xd749=['bluebird','request-promise','path','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x405b46,_0x418896){var _0x28afd0=function(_0x340c0f){while(--_0x340c0f){_0x405b46['push'](_0x405b46['shift']());}};_0x28afd0(++_0x418896);}(_0xd749,0x193));var _0x9d74=function(_0x31fb71,_0x46a109){_0x31fb71=_0x31fb71-0x0;var _0x19e7d0=_0xd749[_0x31fb71];return _0x19e7d0;};'use strict';var _=require(_0x9d74('0x0'));var util=require(_0x9d74('0x1'));var logger=require(_0x9d74('0x2'))(_0x9d74('0x3'));var moment=require(_0x9d74('0x4'));var BPromise=require(_0x9d74('0x5'));var rp=require(_0x9d74('0x6'));var fs=require('fs');var path=require(_0x9d74('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d74('0x8'));var integrations=require(_0x9d74('0x9'));module['exports']=function(_0x1e9e5f,_0x1a9c33){return _0x1e9e5f['define'](_0x9d74('0xa'),attributes,{'tableName':_0x9d74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f80=['int_desk_accounts','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intDeskAccount.attributes','define','DeskAccount'];(function(_0x166f27,_0x4d36d0){var _0xefb1a8=function(_0x4ea3a8){while(--_0x4ea3a8){_0x166f27['push'](_0x166f27['shift']());}};_0xefb1a8(++_0x4d36d0);}(_0x8f80,0x1f0));var _0x08f8=function(_0x2fcf38,_0x1bea4e){_0x2fcf38=_0x2fcf38-0x0;var _0x170e08=_0x8f80[_0x2fcf38];return _0x170e08;};'use strict';var _=require(_0x08f8('0x0'));var util=require(_0x08f8('0x1'));var logger=require(_0x08f8('0x2'))(_0x08f8('0x3'));var moment=require('moment');var BPromise=require(_0x08f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x08f8('0x5'));var config=require(_0x08f8('0x6'));var attributes=require(_0x08f8('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x46238c,_0x2eb5c4){return _0x46238c[_0x08f8('0x8')](_0x08f8('0x9'),attributes,{'tableName':_0x08f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index abe3cd6..47d7f61 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 _0xb6b6=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb91b72,_0x2ee525){var _0x262c79=function(_0x394fb5){while(--_0x394fb5){_0xb91b72['push'](_0xb91b72['shift']());}};_0x262c79(++_0x2ee525);}(_0xb6b6,0x160));var _0x6b6b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb6b6[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x6b6b('0x0'));var util=require(_0x6b6b('0x1'));var moment=require(_0x6b6b('0x2'));var BPromise=require(_0x6b6b('0x3'));var rs=require(_0x6b6b('0x4'));var fs=require('fs');var Redis=require(_0x6b6b('0x5'));var db=require(_0x6b6b('0x6'))['db'];var utils=require(_0x6b6b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b6b('0x8'));var jayson=require(_0x6b6b('0x9'));var client=jayson[_0x6b6b('0xa')][_0x6b6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18c36d,_0x4293c8,_0x3ac19d){return new BPromise(function(_0x5881c5,_0x3d4abc){return client[_0x6b6b('0xc')](_0x18c36d,_0x3ac19d)[_0x6b6b('0xd')](function(_0x32ebb1){logger[_0x6b6b('0xe')](_0x6b6b('0xf'),_0x4293c8,_0x6b6b('0x10'));logger[_0x6b6b('0x11')](_0x6b6b('0x12'),_0x4293c8,'request\x20sent',JSON[_0x6b6b('0x13')](_0x32ebb1));if(_0x32ebb1[_0x6b6b('0x14')]){if(_0x32ebb1['error'][_0x6b6b('0x15')]===0x1f4){logger[_0x6b6b('0x14')](_0x6b6b('0xf'),_0x4293c8,_0x32ebb1[_0x6b6b('0x14')][_0x6b6b('0x16')]);return _0x3d4abc(_0x32ebb1['error'][_0x6b6b('0x16')]);}logger[_0x6b6b('0x14')](_0x6b6b('0xf'),_0x4293c8,_0x32ebb1[_0x6b6b('0x14')]['message']);return _0x5881c5(_0x32ebb1[_0x6b6b('0x14')]['message']);}else{logger['info'](_0x6b6b('0xf'),_0x4293c8,_0x6b6b('0x10'));_0x5881c5(_0x32ebb1[_0x6b6b('0x17')]['message']);}})['catch'](function(_0xa79189){logger[_0x6b6b('0x14')](_0x6b6b('0xf'),_0x4293c8,_0xa79189);_0x3d4abc(_0xa79189);});});}exports[_0x6b6b('0x18')]=function(_0x33edbd){var _0x22316c=this;return new Promise(function(_0x527839,_0x356eab){return db[_0x6b6b('0x19')]['findAll']({'raw':_0x33edbd[_0x6b6b('0x1a')]?_0x33edbd[_0x6b6b('0x1a')][_0x6b6b('0x1b')]===undefined?!![]:![]:!![],'where':_0x33edbd[_0x6b6b('0x1a')]?_0x33edbd['options'][_0x6b6b('0x1c')]||null:null,'attributes':_0x33edbd[_0x6b6b('0x1a')]?_0x33edbd[_0x6b6b('0x1a')][_0x6b6b('0x1d')]||null:null,'limit':_0x33edbd[_0x6b6b('0x1a')]?_0x33edbd[_0x6b6b('0x1a')][_0x6b6b('0x1e')]||null:null,'include':_0x33edbd[_0x6b6b('0x1a')]?_0x33edbd[_0x6b6b('0x1a')][_0x6b6b('0x1f')]?_[_0x6b6b('0x20')](_0x33edbd[_0x6b6b('0x1a')][_0x6b6b('0x1f')],function(_0x1bc805){return{'model':db[_0x1bc805[_0x6b6b('0x21')]],'as':_0x1bc805['as'],'attributes':_0x1bc805[_0x6b6b('0x1d')],'include':_0x1bc805[_0x6b6b('0x1f')]?_[_0x6b6b('0x20')](_0x1bc805[_0x6b6b('0x1f')],function(_0xb4a7a4){return{'model':db[_0xb4a7a4[_0x6b6b('0x21')]],'as':_0xb4a7a4['as'],'attributes':_0xb4a7a4[_0x6b6b('0x1d')],'include':_0xb4a7a4['include']?_[_0x6b6b('0x20')](_0xb4a7a4[_0x6b6b('0x1f')],function(_0x233398){return{'model':db[_0x233398[_0x6b6b('0x21')]],'as':_0x233398['as'],'attributes':_0x233398['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b6b('0xd')](function(_0xdf9198){logger[_0x6b6b('0xe')]('GetDeskAccount',_0x33edbd);logger['debug'](_0x6b6b('0x18'),_0x33edbd,JSON[_0x6b6b('0x13')](_0xdf9198));_0x527839(_0xdf9198);})[_0x6b6b('0x22')](function(_0x562a20){logger['error'](_0x6b6b('0x18'),_0x562a20[_0x6b6b('0x16')],_0x33edbd);_0x356eab(_0x22316c[_0x6b6b('0x14')](0x1f4,_0x562a20[_0x6b6b('0x16')]));});});};exports[_0x6b6b('0x23')]=function(_0x148d42){var _0xe521ee=this;return new Promise(function(_0x278995,_0x2c8814){return db[_0x6b6b('0x19')][_0x6b6b('0x24')]({'raw':_0x148d42[_0x6b6b('0x1a')]?_0x148d42[_0x6b6b('0x1a')][_0x6b6b('0x1b')]===undefined?!![]:![]:!![],'where':_0x148d42[_0x6b6b('0x1a')]?_0x148d42['options'][_0x6b6b('0x1c')]||null:null,'attributes':_0x148d42[_0x6b6b('0x1a')]?_0x148d42[_0x6b6b('0x1a')][_0x6b6b('0x1d')]||null:null,'include':_0x148d42['options']?_0x148d42[_0x6b6b('0x1a')][_0x6b6b('0x1f')]?_[_0x6b6b('0x20')](_0x148d42[_0x6b6b('0x1a')]['include'],function(_0x3a977e){return{'model':db[_0x3a977e[_0x6b6b('0x21')]],'as':_0x3a977e['as'],'attributes':_0x3a977e[_0x6b6b('0x1d')],'include':_0x3a977e[_0x6b6b('0x1f')]?_[_0x6b6b('0x20')](_0x3a977e[_0x6b6b('0x1f')],function(_0xbac782){return{'model':db[_0xbac782[_0x6b6b('0x21')]],'as':_0xbac782['as'],'attributes':_0xbac782[_0x6b6b('0x1d')],'include':_0xbac782[_0x6b6b('0x1f')]?_[_0x6b6b('0x20')](_0xbac782[_0x6b6b('0x1f')],function(_0xdb720c){return{'model':db[_0xdb720c[_0x6b6b('0x21')]],'as':_0xdb720c['as'],'attributes':_0xdb720c[_0x6b6b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6b6b('0xd')](function(_0x1261ad){logger[_0x6b6b('0xe')](_0x6b6b('0x23'),_0x148d42);logger[_0x6b6b('0x11')]('ShowDeskAccount',_0x148d42,JSON[_0x6b6b('0x13')](_0x1261ad));_0x278995(_0x1261ad);})[_0x6b6b('0x22')](function(_0x8cf696){logger[_0x6b6b('0x14')](_0x6b6b('0x23'),_0x8cf696[_0x6b6b('0x16')],_0x148d42);_0x2c8814(_0xe521ee[_0x6b6b('0x14')](0x1f4,_0x8cf696['message']));});});}; \ No newline at end of file +var _0x03c1=['http','request','info','request\x20sent','debug','stringify','code','error','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','limit','include','model','attributes','map','catch','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x48c6e9,_0x88320f){var _0x1def8d=function(_0x426aef){while(--_0x426aef){_0x48c6e9['push'](_0x48c6e9['shift']());}};_0x1def8d(++_0x88320f);}(_0x03c1,0xc2));var _0x103c=function(_0x54b0f3,_0x1fe2f7){_0x54b0f3=_0x54b0f3-0x0;var _0x5ae957=_0x03c1[_0x54b0f3];return _0x5ae957;};'use strict';var _=require(_0x103c('0x0'));var util=require(_0x103c('0x1'));var moment=require('moment');var BPromise=require(_0x103c('0x2'));var rs=require(_0x103c('0x3'));var fs=require('fs');var Redis=require(_0x103c('0x4'));var db=require(_0x103c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x103c('0x6'))(_0x103c('0x7'));var config=require('../../config/environment');var jayson=require(_0x103c('0x8'));var client=jayson[_0x103c('0x9')][_0x103c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143b48,_0x460d11,_0x398da9){return new BPromise(function(_0x3c63a6,_0x3ed100){return client[_0x103c('0xb')](_0x143b48,_0x398da9)['then'](function(_0xc371cd){logger[_0x103c('0xc')]('DeskAccount,\x20%s,\x20%s',_0x460d11,_0x103c('0xd'));logger[_0x103c('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x460d11,_0x103c('0xd'),JSON[_0x103c('0xf')](_0xc371cd));if(_0xc371cd['error']){if(_0xc371cd['error'][_0x103c('0x10')]===0x1f4){logger[_0x103c('0x11')](_0x103c('0x12'),_0x460d11,_0xc371cd[_0x103c('0x11')][_0x103c('0x13')]);return _0x3ed100(_0xc371cd[_0x103c('0x11')][_0x103c('0x13')]);}logger['error'](_0x103c('0x12'),_0x460d11,_0xc371cd[_0x103c('0x11')][_0x103c('0x13')]);return _0x3c63a6(_0xc371cd['error'][_0x103c('0x13')]);}else{logger[_0x103c('0xc')](_0x103c('0x12'),_0x460d11,_0x103c('0xd'));_0x3c63a6(_0xc371cd[_0x103c('0x14')][_0x103c('0x13')]);}})['catch'](function(_0x2e49ea){logger['error']('DeskAccount,\x20%s,\x20%s',_0x460d11,_0x2e49ea);_0x3ed100(_0x2e49ea);});});}exports[_0x103c('0x15')]=function(_0x8060ee){var _0x47f79e=this;return new Promise(function(_0x2f5319,_0x16ee41){return db[_0x103c('0x16')][_0x103c('0x17')]({'raw':_0x8060ee[_0x103c('0x18')]?_0x8060ee['options'][_0x103c('0x19')]===undefined?!![]:![]:!![],'where':_0x8060ee[_0x103c('0x18')]?_0x8060ee[_0x103c('0x18')]['where']||null:null,'attributes':_0x8060ee[_0x103c('0x18')]?_0x8060ee[_0x103c('0x18')]['attributes']||null:null,'limit':_0x8060ee[_0x103c('0x18')]?_0x8060ee[_0x103c('0x18')][_0x103c('0x1a')]||null:null,'include':_0x8060ee['options']?_0x8060ee[_0x103c('0x18')]['include']?_['map'](_0x8060ee[_0x103c('0x18')][_0x103c('0x1b')],function(_0x2a23e7){return{'model':db[_0x2a23e7[_0x103c('0x1c')]],'as':_0x2a23e7['as'],'attributes':_0x2a23e7[_0x103c('0x1d')],'include':_0x2a23e7[_0x103c('0x1b')]?_[_0x103c('0x1e')](_0x2a23e7['include'],function(_0x4ea9b1){return{'model':db[_0x4ea9b1['model']],'as':_0x4ea9b1['as'],'attributes':_0x4ea9b1[_0x103c('0x1d')],'include':_0x4ea9b1['include']?_[_0x103c('0x1e')](_0x4ea9b1[_0x103c('0x1b')],function(_0x147926){return{'model':db[_0x147926[_0x103c('0x1c')]],'as':_0x147926['as'],'attributes':_0x147926[_0x103c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x464cff){logger[_0x103c('0xc')](_0x103c('0x15'),_0x8060ee);logger['debug'](_0x103c('0x15'),_0x8060ee,JSON[_0x103c('0xf')](_0x464cff));_0x2f5319(_0x464cff);})[_0x103c('0x1f')](function(_0x3768ac){logger[_0x103c('0x11')](_0x103c('0x15'),_0x3768ac[_0x103c('0x13')],_0x8060ee);_0x16ee41(_0x47f79e[_0x103c('0x11')](0x1f4,_0x3768ac[_0x103c('0x13')]));});});};exports[_0x103c('0x20')]=function(_0x5f4844){var _0x37f53a=this;return new Promise(function(_0x106036,_0x74a578){return db[_0x103c('0x16')][_0x103c('0x21')]({'raw':_0x5f4844[_0x103c('0x18')]?_0x5f4844[_0x103c('0x18')][_0x103c('0x19')]===undefined?!![]:![]:!![],'where':_0x5f4844[_0x103c('0x18')]?_0x5f4844[_0x103c('0x18')]['where']||null:null,'attributes':_0x5f4844['options']?_0x5f4844[_0x103c('0x18')][_0x103c('0x1d')]||null:null,'include':_0x5f4844[_0x103c('0x18')]?_0x5f4844[_0x103c('0x18')][_0x103c('0x1b')]?_[_0x103c('0x1e')](_0x5f4844[_0x103c('0x18')][_0x103c('0x1b')],function(_0x143205){return{'model':db[_0x143205['model']],'as':_0x143205['as'],'attributes':_0x143205[_0x103c('0x1d')],'include':_0x143205[_0x103c('0x1b')]?_[_0x103c('0x1e')](_0x143205['include'],function(_0x2f4641){return{'model':db[_0x2f4641[_0x103c('0x1c')]],'as':_0x2f4641['as'],'attributes':_0x2f4641[_0x103c('0x1d')],'include':_0x2f4641[_0x103c('0x1b')]?_['map'](_0x2f4641[_0x103c('0x1b')],function(_0x1670b9){return{'model':db[_0x1670b9['model']],'as':_0x1670b9['as'],'attributes':_0x1670b9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cde46){logger[_0x103c('0xc')](_0x103c('0x20'),_0x5f4844);logger['debug'](_0x103c('0x20'),_0x5f4844,JSON[_0x103c('0xf')](_0x1cde46));_0x106036(_0x1cde46);})[_0x103c('0x1f')](function(_0x1e8bcc){logger['error']('ShowDeskAccount',_0x1e8bcc[_0x103c('0x13')],_0x5f4844);_0x74a578(_0x37f53a[_0x103c('0x11')](0x1f4,_0x1e8bcc['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 53e2b65..6ae9af5 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(_0x23c968,_0x3d0f22){var _0x433799=function(_0x512a9c){while(--_0x512a9c){_0x23c968['push'](_0x23c968['shift']());}};_0x433799(++_0x3d0f22);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x239f00,_0x5cd7b4){var _0x3f2ffe=function(_0x3f1b81){while(--_0x3f1b81){_0x239f00['push'](_0x239f00['shift']());}};_0x3f2ffe(++_0x5cd7b4);}(_0xedd9,0xfc));var _0x9edd=function(_0x2aee9e,_0x3b3652){_0x2aee9e=_0x2aee9e-0x0;var _0xcce03e=_0xedd9[_0x2aee9e];return _0xcce03e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 173b622..d6663c7 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 _0x904d=['STRING','sequelize','exports'];(function(_0x9d35cb,_0xa66f14){var _0x7c1125=function(_0x20e724){while(--_0x20e724){_0x9d35cb['push'](_0x9d35cb['shift']());}};_0x7c1125(++_0xa66f14);}(_0x904d,0x157));var _0xd904=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x904d[_0xaaf2e2];return _0x28bc36;};'use strict';var Sequelize=require(_0xd904('0x0'));module[_0xd904('0x1')]={'name':{'type':Sequelize[_0xd904('0x2')]},'description':{'type':Sequelize[_0xd904('0x2')]}}; \ No newline at end of file +var _0x15b0=['STRING','sequelize'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x15b0,0x109));var _0x015b=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x15b0[_0x29df9a];return _0x3a8e96;};'use strict';var Sequelize=require(_0x015b('0x0'));module['exports']={'name':{'type':Sequelize[_0x015b('0x1')]},'description':{'type':Sequelize[_0x015b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4e60c49..1ba4847 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 _0x9ad5=['getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','catch','show','params','include','DeskConfiguration','find','create','body','findOne','DeskField'];(function(_0x4353f3,_0x466f1e){var _0x372301=function(_0x33c2de){while(--_0x33c2de){_0x4353f3['push'](_0x4353f3['shift']());}};_0x372301(++_0x466f1e);}(_0x9ad5,0x1f3));var _0x59ad=function(_0x5c52e9,_0x71e1aa){_0x5c52e9=_0x5c52e9-0x0;var _0x1cbf09=_0x9ad5[_0x5c52e9];return _0x1cbf09;};'use strict';var emlformat=require(_0x59ad('0x0'));var rimraf=require(_0x59ad('0x1'));var zipdir=require(_0x59ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x59ad('0x4'));var util=require(_0x59ad('0x5'));var path=require(_0x59ad('0x6'));var sox=require(_0x59ad('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59ad('0x8'));var squel=require(_0x59ad('0x9'));var crypto=require(_0x59ad('0xa'));var jsforce=require(_0x59ad('0xb'));var deskjs=require(_0x59ad('0xc'));var toCsv=require('to-csv');var querystring=require(_0x59ad('0xd'));var Papa=require(_0x59ad('0xe'));var Redis=require(_0x59ad('0xf'));var authService=require(_0x59ad('0x10'));var qs=require(_0x59ad('0x11'));var as=require(_0x59ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59ad('0x13'))('api');var utils=require(_0x59ad('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x59ad('0x15'))['db'];function respondWithStatusCode(_0x4dc217,_0x21a212){_0x21a212=_0x21a212||0xcc;return function(_0x41d182){if(_0x41d182){return _0x4dc217[_0x59ad('0x16')](_0x21a212);}return _0x4dc217['status'](_0x21a212)[_0x59ad('0x17')]();};}function respondWithResult(_0x444d18,_0x23c5b2){_0x23c5b2=_0x23c5b2||0xc8;return function(_0x370802){if(_0x370802){return _0x444d18['status'](_0x23c5b2)[_0x59ad('0x18')](_0x370802);}};}function respondWithFilteredResult(_0x16ed7d,_0x56df14){return function(_0x44f35c){if(_0x44f35c){var _0x127f88=typeof _0x56df14[_0x59ad('0x19')]===_0x59ad('0x1a')&&typeof _0x56df14[_0x59ad('0x1b')]===_0x59ad('0x1a');var _0x28beea=_0x44f35c[_0x59ad('0x1c')];var _0x44c946=_0x127f88?0x0:_0x56df14[_0x59ad('0x19')];var _0x58ad08=_0x127f88?_0x44f35c[_0x59ad('0x1c')]:_0x56df14['offset']+_0x56df14[_0x59ad('0x1b')];var _0x547c6a;if(_0x58ad08>=_0x28beea){_0x58ad08=_0x28beea;_0x547c6a=0xc8;}else{_0x547c6a=0xce;}_0x16ed7d[_0x59ad('0x1d')](_0x547c6a);return _0x16ed7d[_0x59ad('0x1e')]('Content-Range',_0x44c946+'-'+_0x58ad08+'/'+_0x28beea)[_0x59ad('0x18')](_0x44f35c);}return null;};}function patchUpdates(_0x1a11ba){return function(_0x331bd0){try{jsonpatch[_0x59ad('0x1f')](_0x331bd0,_0x1a11ba,!![]);}catch(_0x3fb222){return BPromise[_0x59ad('0x20')](_0x3fb222);}return _0x331bd0[_0x59ad('0x21')]();};}function saveUpdates(_0x17d1d2,_0x484dc7){return function(_0xcefa60){if(_0xcefa60){return _0xcefa60['update'](_0x17d1d2)[_0x59ad('0x22')](function(_0x2a0369){return _0x2a0369;});}return null;};}function removeEntity(_0x55f934,_0x3a08a6){return function(_0x377fff){if(_0x377fff){return _0x377fff[_0x59ad('0x23')]()['then'](function(){_0x55f934[_0x59ad('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11ba7a,_0x319ef2){return function(_0x2d56a8){if(!_0x2d56a8){_0x11ba7a['sendStatus'](0x194);}return _0x2d56a8;};}function handleError(_0x51cd82,_0x3bfca8){_0x3bfca8=_0x3bfca8||0x1f4;return function(_0x2d8d62){logger[_0x59ad('0x24')](_0x2d8d62[_0x59ad('0x25')]);if(_0x2d8d62[_0x59ad('0x26')]){delete _0x2d8d62[_0x59ad('0x26')];}_0x51cd82['status'](_0x3bfca8)[_0x59ad('0x27')](_0x2d8d62);};}exports[_0x59ad('0x28')]=function(_0x3087db,_0x4fd4a4){var _0x27da3d={},_0x1e3420={},_0x5ed3f1={'count':0x0,'rows':[]};var _0x1ffefc=_[_0x59ad('0x29')](db['DeskConfiguration'][_0x59ad('0x2a')],function(_0xd8ea1a){return{'name':_0xd8ea1a[_0x59ad('0x2b')],'type':_0xd8ea1a[_0x59ad('0x2c')][_0x59ad('0x2d')]};});_0x1e3420['model']=_[_0x59ad('0x29')](_0x1ffefc,_0x59ad('0x26'));_0x1e3420[_0x59ad('0x2e')]=_[_0x59ad('0x2f')](_0x3087db['query']);_0x1e3420['filters']=_[_0x59ad('0x30')](_0x1e3420[_0x59ad('0x31')],_0x1e3420[_0x59ad('0x2e')]);_0x27da3d['attributes']=_['intersection'](_0x1e3420[_0x59ad('0x31')],qs[_0x59ad('0x32')](_0x3087db[_0x59ad('0x2e')]['fields']));_0x27da3d[_0x59ad('0x33')]=_0x27da3d[_0x59ad('0x33')][_0x59ad('0x34')]?_0x27da3d['attributes']:_0x1e3420[_0x59ad('0x31')];if(!_0x3087db['query'][_0x59ad('0x35')](_0x59ad('0x36'))){_0x27da3d[_0x59ad('0x1b')]=qs[_0x59ad('0x1b')](_0x3087db['query'][_0x59ad('0x1b')]);_0x27da3d[_0x59ad('0x19')]=qs[_0x59ad('0x19')](_0x3087db[_0x59ad('0x2e')]['offset']);}_0x27da3d[_0x59ad('0x37')]=qs['sort'](_0x3087db['query'][_0x59ad('0x38')]);_0x27da3d[_0x59ad('0x39')]=qs['filters'](_[_0x59ad('0x3a')](_0x3087db['query'],_0x1e3420[_0x59ad('0x3b')]),_0x1ffefc);if(_0x3087db[_0x59ad('0x2e')][_0x59ad('0x3c')]){_0x27da3d[_0x59ad('0x39')]=_[_0x59ad('0x3d')](_0x27da3d[_0x59ad('0x39')],{'$or':_['map'](_0x1ffefc,function(_0x5c3309){if(_0x5c3309[_0x59ad('0x2c')]!=='VIRTUAL'){var _0x3c60e7={};_0x3c60e7[_0x5c3309[_0x59ad('0x26')]]={'$like':'%'+_0x3087db[_0x59ad('0x2e')][_0x59ad('0x3c')]+'%'};return _0x3c60e7;}})});}_0x27da3d=_['merge']({},_0x27da3d,_0x3087db[_0x59ad('0x3e')]);var _0x200dee={'where':_0x27da3d['where']};return db['DeskConfiguration'][_0x59ad('0x1c')](_0x200dee)[_0x59ad('0x22')](function(_0x347f3a){_0x5ed3f1[_0x59ad('0x1c')]=_0x347f3a;if(_0x3087db[_0x59ad('0x2e')][_0x59ad('0x3f')]){_0x27da3d['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x59ad('0x40')](_0x27da3d);})[_0x59ad('0x22')](function(_0x53c540){_0x5ed3f1['rows']=_0x53c540;return _0x5ed3f1;})[_0x59ad('0x22')](respondWithFilteredResult(_0x4fd4a4,_0x27da3d))[_0x59ad('0x41')](handleError(_0x4fd4a4,null));};exports[_0x59ad('0x42')]=function(_0xecbc2c,_0x3f19d6){var _0x2e9c2c={'raw':![],'where':{'id':_0xecbc2c[_0x59ad('0x43')]['id']}},_0xa670f4={};_0xa670f4['model']=_['keys'](db['DeskConfiguration'][_0x59ad('0x2a')]);_0xa670f4['query']=_['keys'](_0xecbc2c[_0x59ad('0x2e')]);_0xa670f4[_0x59ad('0x3b')]=_['intersection'](_0xa670f4[_0x59ad('0x31')],_0xa670f4[_0x59ad('0x2e')]);_0x2e9c2c[_0x59ad('0x33')]=_['intersection'](_0xa670f4[_0x59ad('0x31')],qs[_0x59ad('0x32')](_0xecbc2c['query']['fields']));_0x2e9c2c[_0x59ad('0x33')]=_0x2e9c2c['attributes'][_0x59ad('0x34')]?_0x2e9c2c[_0x59ad('0x33')]:_0xa670f4[_0x59ad('0x31')];if(_0xecbc2c['query']['includeAll']){_0x2e9c2c[_0x59ad('0x44')]=[{'all':!![]}];}_0x2e9c2c=_[_0x59ad('0x3d')]({},_0x2e9c2c,_0xecbc2c['options']);return db[_0x59ad('0x45')][_0x59ad('0x46')](_0x2e9c2c)[_0x59ad('0x22')](handleEntityNotFound(_0x3f19d6,null))[_0x59ad('0x22')](respondWithResult(_0x3f19d6,null))[_0x59ad('0x41')](handleError(_0x3f19d6,null));};exports[_0x59ad('0x47')]=function(_0x42b8d5,_0xf6cfd1){return db[_0x59ad('0x45')][_0x59ad('0x47')](_0x42b8d5[_0x59ad('0x48')],{})[_0x59ad('0x22')](respondWithResult(_0xf6cfd1,0xc9))['catch'](handleError(_0xf6cfd1,null));};exports['update']=function(_0x5c06a6,_0x2f1e7d){if(_0x5c06a6[_0x59ad('0x48')]['id']){delete _0x5c06a6[_0x59ad('0x48')]['id'];}return db[_0x59ad('0x45')]['find']({'where':{'id':_0x5c06a6['params']['id']}})[_0x59ad('0x22')](handleEntityNotFound(_0x2f1e7d,null))[_0x59ad('0x22')](saveUpdates(_0x5c06a6['body'],null))['then'](respondWithResult(_0x2f1e7d,null))['catch'](handleError(_0x2f1e7d,null));};exports[_0x59ad('0x23')]=function(_0x43b746,_0x5aaf12){return db['DeskConfiguration'][_0x59ad('0x46')]({'where':{'id':_0x43b746[_0x59ad('0x43')]['id']}})[_0x59ad('0x22')](handleEntityNotFound(_0x5aaf12,null))[_0x59ad('0x22')](removeEntity(_0x5aaf12,null))[_0x59ad('0x41')](handleError(_0x5aaf12,null));};exports['getFields']=function(_0xa1182,_0x4cb03c,_0x360a26){var _0x24dcc9={};var _0x43894b={};var _0xabe1e8;var _0x3f4671;return db[_0x59ad('0x45')][_0x59ad('0x49')]({'where':{'id':_0xa1182[_0x59ad('0x43')]['id']}})[_0x59ad('0x22')](handleEntityNotFound(_0x4cb03c,null))['then'](function(_0x3c687d){if(_0x3c687d){_0xabe1e8=_0x3c687d;_0x43894b['model']=_['keys'](db[_0x59ad('0x4a')][_0x59ad('0x2a')]);_0x43894b['query']=_[_0x59ad('0x2f')](_0xa1182['query']);_0x43894b[_0x59ad('0x3b')]=_[_0x59ad('0x30')](_0x43894b[_0x59ad('0x31')],_0x43894b[_0x59ad('0x2e')]);_0x24dcc9[_0x59ad('0x33')]=_['intersection'](_0x43894b['model'],qs[_0x59ad('0x32')](_0xa1182[_0x59ad('0x2e')]['fields']));_0x24dcc9['attributes']=_0x24dcc9[_0x59ad('0x33')]['length']?_0x24dcc9[_0x59ad('0x33')]:_0x43894b['model'];_0x24dcc9[_0x59ad('0x37')]=qs['sort'](_0xa1182['query'][_0x59ad('0x38')]);_0x24dcc9[_0x59ad('0x39')]=qs[_0x59ad('0x3b')](_[_0x59ad('0x3a')](_0xa1182[_0x59ad('0x2e')],_0x43894b['filters']));if(_0xa1182[_0x59ad('0x2e')]['filter']){_0x24dcc9[_0x59ad('0x39')]=_['merge'](_0x24dcc9[_0x59ad('0x39')],{'$or':_[_0x59ad('0x29')](_0x24dcc9['attributes'],function(_0x3ad063){var _0x27adab={};_0x27adab[_0x3ad063]={'$like':'%'+_0xa1182[_0x59ad('0x2e')][_0x59ad('0x3c')]+'%'};return _0x27adab;})});}_0x24dcc9=_[_0x59ad('0x3d')]({},_0x24dcc9,_0xa1182['options']);return _0xabe1e8[_0x59ad('0x4b')](_0x24dcc9);}})['then'](function(_0x3214d2){if(_0x3214d2){_0x3f4671=_0x3214d2['length'];if(!_0xa1182[_0x59ad('0x2e')]['hasOwnProperty'](_0x59ad('0x36'))){_0x24dcc9[_0x59ad('0x1b')]=qs[_0x59ad('0x1b')](_0xa1182[_0x59ad('0x2e')][_0x59ad('0x1b')]);_0x24dcc9['offset']=qs['offset'](_0xa1182[_0x59ad('0x2e')]['offset']);}return _0xabe1e8[_0x59ad('0x4b')](_0x24dcc9);}})[_0x59ad('0x22')](function(_0x478804){if(_0x478804){return _0x478804?{'count':_0x3f4671,'rows':_0x478804}:null;}})[_0x59ad('0x22')](respondWithResult(_0x4cb03c,null))[_0x59ad('0x41')](handleError(_0x4cb03c,null));};exports['getSubjects']=function(_0x488b3b,_0x39e263,_0x438491){var _0x591436={};var _0x5d3122={};var _0x1e1f7e;var _0x8345c6;return db[_0x59ad('0x45')][_0x59ad('0x49')]({'where':{'id':_0x488b3b[_0x59ad('0x43')]['id']}})[_0x59ad('0x22')](handleEntityNotFound(_0x39e263,null))['then'](function(_0x2de367){if(_0x2de367){_0x1e1f7e=_0x2de367;_0x5d3122[_0x59ad('0x31')]=_['keys'](db[_0x59ad('0x4a')][_0x59ad('0x2a')]);_0x5d3122[_0x59ad('0x2e')]=_[_0x59ad('0x2f')](_0x488b3b[_0x59ad('0x2e')]);_0x5d3122[_0x59ad('0x3b')]=_[_0x59ad('0x30')](_0x5d3122['model'],_0x5d3122[_0x59ad('0x2e')]);_0x591436[_0x59ad('0x33')]=_[_0x59ad('0x30')](_0x5d3122[_0x59ad('0x31')],qs[_0x59ad('0x32')](_0x488b3b[_0x59ad('0x2e')][_0x59ad('0x32')]));_0x591436[_0x59ad('0x33')]=_0x591436[_0x59ad('0x33')][_0x59ad('0x34')]?_0x591436['attributes']:_0x5d3122['model'];_0x591436[_0x59ad('0x37')]=qs[_0x59ad('0x38')](_0x488b3b[_0x59ad('0x2e')][_0x59ad('0x38')]);_0x591436['where']=qs[_0x59ad('0x3b')](_['pick'](_0x488b3b['query'],_0x5d3122[_0x59ad('0x3b')]));if(_0x488b3b[_0x59ad('0x2e')][_0x59ad('0x3c')]){_0x591436[_0x59ad('0x39')]=_[_0x59ad('0x3d')](_0x591436['where'],{'$or':_[_0x59ad('0x29')](_0x591436[_0x59ad('0x33')],function(_0x175886){var _0x59813f={};_0x59813f[_0x175886]={'$like':'%'+_0x488b3b[_0x59ad('0x2e')][_0x59ad('0x3c')]+'%'};return _0x59813f;})});}_0x591436=_[_0x59ad('0x3d')]({},_0x591436,_0x488b3b[_0x59ad('0x3e')]);return _0x1e1f7e['getSubjects'](_0x591436);}})['then'](function(_0x3d0ad4){if(_0x3d0ad4){_0x8345c6=_0x3d0ad4[_0x59ad('0x34')];if(!_0x488b3b['query'][_0x59ad('0x35')](_0x59ad('0x36'))){_0x591436[_0x59ad('0x1b')]=qs['limit'](_0x488b3b['query']['limit']);_0x591436[_0x59ad('0x19')]=qs[_0x59ad('0x19')](_0x488b3b[_0x59ad('0x2e')][_0x59ad('0x19')]);}return _0x1e1f7e[_0x59ad('0x4c')](_0x591436);}})[_0x59ad('0x22')](function(_0x5775a9){if(_0x5775a9){return _0x5775a9?{'count':_0x8345c6,'rows':_0x5775a9}:null;}})['then'](respondWithResult(_0x39e263,null))[_0x59ad('0x41')](handleError(_0x39e263,null));};exports['getDescriptions']=function(_0x23b976,_0x4d5dfa,_0x5e7995){var _0x292e23={};var _0x3269a6={};var _0x25bcb1;var _0x3955c7;return db[_0x59ad('0x45')][_0x59ad('0x49')]({'where':{'id':_0x23b976[_0x59ad('0x43')]['id']}})[_0x59ad('0x22')](handleEntityNotFound(_0x4d5dfa,null))[_0x59ad('0x22')](function(_0x4d7934){if(_0x4d7934){_0x25bcb1=_0x4d7934;_0x3269a6[_0x59ad('0x31')]=_[_0x59ad('0x2f')](db[_0x59ad('0x4a')]['rawAttributes']);_0x3269a6[_0x59ad('0x2e')]=_[_0x59ad('0x2f')](_0x23b976['query']);_0x3269a6[_0x59ad('0x3b')]=_['intersection'](_0x3269a6[_0x59ad('0x31')],_0x3269a6['query']);_0x292e23[_0x59ad('0x33')]=_[_0x59ad('0x30')](_0x3269a6[_0x59ad('0x31')],qs['fields'](_0x23b976[_0x59ad('0x2e')][_0x59ad('0x32')]));_0x292e23[_0x59ad('0x33')]=_0x292e23['attributes'][_0x59ad('0x34')]?_0x292e23[_0x59ad('0x33')]:_0x3269a6[_0x59ad('0x31')];_0x292e23['order']=qs[_0x59ad('0x38')](_0x23b976[_0x59ad('0x2e')][_0x59ad('0x38')]);_0x292e23['where']=qs['filters'](_[_0x59ad('0x3a')](_0x23b976[_0x59ad('0x2e')],_0x3269a6['filters']));if(_0x23b976[_0x59ad('0x2e')][_0x59ad('0x3c')]){_0x292e23[_0x59ad('0x39')]=_[_0x59ad('0x3d')](_0x292e23[_0x59ad('0x39')],{'$or':_[_0x59ad('0x29')](_0x292e23[_0x59ad('0x33')],function(_0x89586f){var _0x4dd51a={};_0x4dd51a[_0x89586f]={'$like':'%'+_0x23b976[_0x59ad('0x2e')][_0x59ad('0x3c')]+'%'};return _0x4dd51a;})});}_0x292e23=_[_0x59ad('0x3d')]({},_0x292e23,_0x23b976['options']);return _0x25bcb1[_0x59ad('0x4d')](_0x292e23);}})['then'](function(_0x56be96){if(_0x56be96){_0x3955c7=_0x56be96[_0x59ad('0x34')];if(!_0x23b976[_0x59ad('0x2e')][_0x59ad('0x35')]('nolimit')){_0x292e23[_0x59ad('0x1b')]=qs['limit'](_0x23b976['query'][_0x59ad('0x1b')]);_0x292e23['offset']=qs[_0x59ad('0x19')](_0x23b976[_0x59ad('0x2e')]['offset']);}return _0x25bcb1[_0x59ad('0x4d')](_0x292e23);}})[_0x59ad('0x22')](function(_0x489f70){if(_0x489f70){return _0x489f70?{'count':_0x3955c7,'rows':_0x489f70}:null;}})['then'](respondWithResult(_0x4d5dfa,null))['catch'](handleError(_0x4d5dfa,null));};exports[_0x59ad('0x4e')]=function(_0x5efb1d,_0x48dd66,_0x41ffb6){var _0x22268f={};var _0x21b86e={};var _0x3b3a85;var _0x2faa68;return db['DeskConfiguration'][_0x59ad('0x49')]({'where':{'id':_0x5efb1d['params']['id']}})[_0x59ad('0x22')](handleEntityNotFound(_0x48dd66,null))['then'](function(_0x5da2b0){if(_0x5da2b0){_0x3b3a85=_0x5da2b0;_0x21b86e['model']=_[_0x59ad('0x2f')](db[_0x59ad('0x4f')][_0x59ad('0x2a')]);_0x21b86e[_0x59ad('0x2e')]=_[_0x59ad('0x2f')](_0x5efb1d[_0x59ad('0x2e')]);_0x21b86e['filters']=_[_0x59ad('0x30')](_0x21b86e['model'],_0x21b86e['query']);_0x22268f['attributes']=_[_0x59ad('0x30')](_0x21b86e[_0x59ad('0x31')],qs[_0x59ad('0x32')](_0x5efb1d[_0x59ad('0x2e')][_0x59ad('0x32')]));_0x22268f[_0x59ad('0x33')]=_0x22268f[_0x59ad('0x33')]['length']?_0x22268f[_0x59ad('0x33')]:_0x21b86e[_0x59ad('0x31')];_0x22268f[_0x59ad('0x37')]=qs[_0x59ad('0x38')](_0x5efb1d[_0x59ad('0x2e')]['sort']);_0x22268f['where']=qs[_0x59ad('0x3b')](_[_0x59ad('0x3a')](_0x5efb1d[_0x59ad('0x2e')],_0x21b86e[_0x59ad('0x3b')]));if(_0x5efb1d['query'][_0x59ad('0x3c')]){_0x22268f[_0x59ad('0x39')]=_[_0x59ad('0x3d')](_0x22268f[_0x59ad('0x39')],{'$or':_['map'](_0x22268f[_0x59ad('0x33')],function(_0x4ae53f){var _0x437728={};_0x437728[_0x4ae53f]={'$like':'%'+_0x5efb1d['query'][_0x59ad('0x3c')]+'%'};return _0x437728;})});}_0x22268f=_[_0x59ad('0x3d')]({},_0x22268f,_0x5efb1d['options']);return _0x3b3a85[_0x59ad('0x4e')](_0x22268f);}})['then'](function(_0x477e29){if(_0x477e29){_0x2faa68=_0x477e29[_0x59ad('0x34')];if(!_0x5efb1d[_0x59ad('0x2e')][_0x59ad('0x35')](_0x59ad('0x36'))){_0x22268f[_0x59ad('0x1b')]=qs['limit'](_0x5efb1d[_0x59ad('0x2e')]['limit']);_0x22268f[_0x59ad('0x19')]=qs[_0x59ad('0x19')](_0x5efb1d[_0x59ad('0x2e')]['offset']);}return _0x3b3a85[_0x59ad('0x4e')](_0x22268f);}})[_0x59ad('0x22')](function(_0x1c86c9){if(_0x1c86c9){return _0x1c86c9?{'count':_0x2faa68,'rows':_0x1c86c9}:null;}})['then'](respondWithResult(_0x48dd66,null))[_0x59ad('0x41')](handleError(_0x48dd66,null));};exports[_0x59ad('0x50')]=function(_0x7d606d,_0x2c59d5,_0x3515f4){if(_0x7d606d[_0x59ad('0x48')]['id']){delete _0x7d606d['body']['id'];}return db[_0x59ad('0x45')][_0x59ad('0x49')]({'where':{'id':_0x7d606d[_0x59ad('0x43')]['id']}})[_0x59ad('0x22')](handleEntityNotFound(_0x2c59d5,null))[_0x59ad('0x22')](function(_0x23f2c5){if(_0x23f2c5){return _0x23f2c5[_0x59ad('0x50')](_0x7d606d[_0x59ad('0x48')][_0x59ad('0x51')]||[]);}return null;})['then'](respondWithResult(_0x2c59d5,null))[_0x59ad('0x41')](handleError(_0x2c59d5,null));}; \ No newline at end of file +var _0x2d68=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','DeskConfiguration','includeAll','catch','show','params','include','create','body','destroy','find','getFields','findOne','DeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','ids'];(function(_0x4c9af1,_0x60a0dc){var _0x250bd4=function(_0x42d893){while(--_0x42d893){_0x4c9af1['push'](_0x4c9af1['shift']());}};_0x250bd4(++_0x60a0dc);}(_0x2d68,0x150));var _0x82d6=function(_0x5049e1,_0x4ac87a){_0x5049e1=_0x5049e1-0x0;var _0x37f162=_0x2d68[_0x5049e1];return _0x37f162;};'use strict';var emlformat=require(_0x82d6('0x0'));var rimraf=require(_0x82d6('0x1'));var zipdir=require(_0x82d6('0x2'));var jsonpatch=require(_0x82d6('0x3'));var rp=require(_0x82d6('0x4'));var moment=require(_0x82d6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x82d6('0x6'));var path=require(_0x82d6('0x7'));var sox=require(_0x82d6('0x8'));var csv=require(_0x82d6('0x9'));var ejs=require(_0x82d6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82d6('0xb'));var squel=require(_0x82d6('0xc'));var crypto=require(_0x82d6('0xd'));var jsforce=require(_0x82d6('0xe'));var deskjs=require(_0x82d6('0xf'));var toCsv=require(_0x82d6('0x9'));var querystring=require('querystring');var Papa=require(_0x82d6('0x10'));var Redis=require(_0x82d6('0x11'));var authService=require(_0x82d6('0x12'));var qs=require(_0x82d6('0x13'));var as=require(_0x82d6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x82d6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x82d6('0x16'));var licenseUtil=require(_0x82d6('0x17'));var db=require(_0x82d6('0x18'))['db'];function respondWithStatusCode(_0x1ad473,_0x2e58fc){_0x2e58fc=_0x2e58fc||0xcc;return function(_0x30f920){if(_0x30f920){return _0x1ad473['sendStatus'](_0x2e58fc);}return _0x1ad473['status'](_0x2e58fc)['end']();};}function respondWithResult(_0xf0e4f6,_0x4f0037){_0x4f0037=_0x4f0037||0xc8;return function(_0x250e6a){if(_0x250e6a){return _0xf0e4f6[_0x82d6('0x19')](_0x4f0037)[_0x82d6('0x1a')](_0x250e6a);}};}function respondWithFilteredResult(_0xf5ca18,_0x566a05){return function(_0x2fa093){if(_0x2fa093){var _0x549d2d=typeof _0x566a05[_0x82d6('0x1b')]===_0x82d6('0x1c')&&typeof _0x566a05[_0x82d6('0x1d')]==='undefined';var _0x1fd7da=_0x2fa093[_0x82d6('0x1e')];var _0x9de1b5=_0x549d2d?0x0:_0x566a05[_0x82d6('0x1b')];var _0x17470a=_0x549d2d?_0x2fa093[_0x82d6('0x1e')]:_0x566a05['offset']+_0x566a05[_0x82d6('0x1d')];var _0x2d9560;if(_0x17470a>=_0x1fd7da){_0x17470a=_0x1fd7da;_0x2d9560=0xc8;}else{_0x2d9560=0xce;}_0xf5ca18[_0x82d6('0x19')](_0x2d9560);return _0xf5ca18[_0x82d6('0x1f')](_0x82d6('0x20'),_0x9de1b5+'-'+_0x17470a+'/'+_0x1fd7da)[_0x82d6('0x1a')](_0x2fa093);}return null;};}function patchUpdates(_0x232660){return function(_0x23d470){try{jsonpatch['apply'](_0x23d470,_0x232660,!![]);}catch(_0x324316){return BPromise[_0x82d6('0x21')](_0x324316);}return _0x23d470[_0x82d6('0x22')]();};}function saveUpdates(_0x39ae17,_0x21fbd2){return function(_0x4c40a0){if(_0x4c40a0){return _0x4c40a0[_0x82d6('0x23')](_0x39ae17)[_0x82d6('0x24')](function(_0x5f475e){return _0x5f475e;});}return null;};}function removeEntity(_0x5199a4,_0x1d6d48){return function(_0x1558e8){if(_0x1558e8){return _0x1558e8['destroy']()[_0x82d6('0x24')](function(){_0x5199a4['status'](0xcc)[_0x82d6('0x25')]();});}};}function handleEntityNotFound(_0x20d150,_0x899dce){return function(_0x302cfb){if(!_0x302cfb){_0x20d150[_0x82d6('0x26')](0x194);}return _0x302cfb;};}function handleError(_0x32acce,_0x141247){_0x141247=_0x141247||0x1f4;return function(_0x1da057){logger['error'](_0x1da057[_0x82d6('0x27')]);if(_0x1da057[_0x82d6('0x28')]){delete _0x1da057['name'];}_0x32acce['status'](_0x141247)[_0x82d6('0x29')](_0x1da057);};}exports[_0x82d6('0x2a')]=function(_0x26bb81,_0xdc6eaf){var _0x49d880={},_0x497764={},_0x20ce5b={'count':0x0,'rows':[]};var _0x434314=_[_0x82d6('0x2b')](db['DeskConfiguration'][_0x82d6('0x2c')],function(_0x579f0a){return{'name':_0x579f0a[_0x82d6('0x2d')],'type':_0x579f0a[_0x82d6('0x2e')][_0x82d6('0x2f')]};});_0x497764[_0x82d6('0x30')]=_[_0x82d6('0x2b')](_0x434314,_0x82d6('0x28'));_0x497764[_0x82d6('0x31')]=_[_0x82d6('0x32')](_0x26bb81[_0x82d6('0x31')]);_0x497764[_0x82d6('0x33')]=_[_0x82d6('0x34')](_0x497764['model'],_0x497764[_0x82d6('0x31')]);_0x49d880['attributes']=_['intersection'](_0x497764[_0x82d6('0x30')],qs[_0x82d6('0x35')](_0x26bb81[_0x82d6('0x31')][_0x82d6('0x35')]));_0x49d880[_0x82d6('0x36')]=_0x49d880['attributes'][_0x82d6('0x37')]?_0x49d880[_0x82d6('0x36')]:_0x497764[_0x82d6('0x30')];if(!_0x26bb81['query']['hasOwnProperty'](_0x82d6('0x38'))){_0x49d880[_0x82d6('0x1d')]=qs[_0x82d6('0x1d')](_0x26bb81['query'][_0x82d6('0x1d')]);_0x49d880[_0x82d6('0x1b')]=qs[_0x82d6('0x1b')](_0x26bb81[_0x82d6('0x31')][_0x82d6('0x1b')]);}_0x49d880[_0x82d6('0x39')]=qs[_0x82d6('0x3a')](_0x26bb81['query']['sort']);_0x49d880[_0x82d6('0x3b')]=qs[_0x82d6('0x33')](_[_0x82d6('0x3c')](_0x26bb81['query'],_0x497764[_0x82d6('0x33')]),_0x434314);if(_0x26bb81[_0x82d6('0x31')][_0x82d6('0x3d')]){_0x49d880['where']=_['merge'](_0x49d880[_0x82d6('0x3b')],{'$or':_[_0x82d6('0x2b')](_0x434314,function(_0x2b1aef){if(_0x2b1aef[_0x82d6('0x2e')]!==_0x82d6('0x3e')){var _0x359b0f={};_0x359b0f[_0x2b1aef[_0x82d6('0x28')]]={'$like':'%'+_0x26bb81[_0x82d6('0x31')][_0x82d6('0x3d')]+'%'};return _0x359b0f;}})});}_0x49d880=_[_0x82d6('0x3f')]({},_0x49d880,_0x26bb81[_0x82d6('0x40')]);var _0x295977={'where':_0x49d880[_0x82d6('0x3b')]};return db[_0x82d6('0x41')][_0x82d6('0x1e')](_0x295977)[_0x82d6('0x24')](function(_0x386662){_0x20ce5b[_0x82d6('0x1e')]=_0x386662;if(_0x26bb81['query'][_0x82d6('0x42')]){_0x49d880['include']=[{'all':!![]}];}return db[_0x82d6('0x41')]['findAll'](_0x49d880);})['then'](function(_0x2776ce){_0x20ce5b['rows']=_0x2776ce;return _0x20ce5b;})[_0x82d6('0x24')](respondWithFilteredResult(_0xdc6eaf,_0x49d880))[_0x82d6('0x43')](handleError(_0xdc6eaf,null));};exports[_0x82d6('0x44')]=function(_0x24e72f,_0x3ab07c){var _0x42ffce={'raw':![],'where':{'id':_0x24e72f[_0x82d6('0x45')]['id']}},_0x27c81b={};_0x27c81b[_0x82d6('0x30')]=_[_0x82d6('0x32')](db['DeskConfiguration'][_0x82d6('0x2c')]);_0x27c81b[_0x82d6('0x31')]=_[_0x82d6('0x32')](_0x24e72f['query']);_0x27c81b[_0x82d6('0x33')]=_[_0x82d6('0x34')](_0x27c81b[_0x82d6('0x30')],_0x27c81b[_0x82d6('0x31')]);_0x42ffce['attributes']=_[_0x82d6('0x34')](_0x27c81b[_0x82d6('0x30')],qs[_0x82d6('0x35')](_0x24e72f[_0x82d6('0x31')][_0x82d6('0x35')]));_0x42ffce[_0x82d6('0x36')]=_0x42ffce[_0x82d6('0x36')][_0x82d6('0x37')]?_0x42ffce[_0x82d6('0x36')]:_0x27c81b[_0x82d6('0x30')];if(_0x24e72f['query'][_0x82d6('0x42')]){_0x42ffce[_0x82d6('0x46')]=[{'all':!![]}];}_0x42ffce=_[_0x82d6('0x3f')]({},_0x42ffce,_0x24e72f[_0x82d6('0x40')]);return db[_0x82d6('0x41')]['find'](_0x42ffce)[_0x82d6('0x24')](handleEntityNotFound(_0x3ab07c,null))[_0x82d6('0x24')](respondWithResult(_0x3ab07c,null))[_0x82d6('0x43')](handleError(_0x3ab07c,null));};exports[_0x82d6('0x47')]=function(_0x42ca28,_0x24e9ce){return db[_0x82d6('0x41')][_0x82d6('0x47')](_0x42ca28[_0x82d6('0x48')],{})[_0x82d6('0x24')](respondWithResult(_0x24e9ce,0xc9))['catch'](handleError(_0x24e9ce,null));};exports[_0x82d6('0x23')]=function(_0x5ec0a7,_0x4cb602){if(_0x5ec0a7[_0x82d6('0x48')]['id']){delete _0x5ec0a7[_0x82d6('0x48')]['id'];}return db[_0x82d6('0x41')]['find']({'where':{'id':_0x5ec0a7['params']['id']}})['then'](handleEntityNotFound(_0x4cb602,null))[_0x82d6('0x24')](saveUpdates(_0x5ec0a7[_0x82d6('0x48')],null))[_0x82d6('0x24')](respondWithResult(_0x4cb602,null))[_0x82d6('0x43')](handleError(_0x4cb602,null));};exports[_0x82d6('0x49')]=function(_0x2af737,_0x5b9d87){return db[_0x82d6('0x41')][_0x82d6('0x4a')]({'where':{'id':_0x2af737['params']['id']}})[_0x82d6('0x24')](handleEntityNotFound(_0x5b9d87,null))['then'](removeEntity(_0x5b9d87,null))[_0x82d6('0x43')](handleError(_0x5b9d87,null));};exports[_0x82d6('0x4b')]=function(_0x284fac,_0x12d13c,_0x32d2bc){var _0xee04e0={};var _0x453c56={};var _0x2afce7;var _0xdfb728;return db[_0x82d6('0x41')][_0x82d6('0x4c')]({'where':{'id':_0x284fac['params']['id']}})[_0x82d6('0x24')](handleEntityNotFound(_0x12d13c,null))[_0x82d6('0x24')](function(_0xc7cd5c){if(_0xc7cd5c){_0x2afce7=_0xc7cd5c;_0x453c56[_0x82d6('0x30')]=_['keys'](db[_0x82d6('0x4d')]['rawAttributes']);_0x453c56['query']=_[_0x82d6('0x32')](_0x284fac[_0x82d6('0x31')]);_0x453c56[_0x82d6('0x33')]=_[_0x82d6('0x34')](_0x453c56[_0x82d6('0x30')],_0x453c56[_0x82d6('0x31')]);_0xee04e0[_0x82d6('0x36')]=_['intersection'](_0x453c56[_0x82d6('0x30')],qs[_0x82d6('0x35')](_0x284fac[_0x82d6('0x31')]['fields']));_0xee04e0[_0x82d6('0x36')]=_0xee04e0[_0x82d6('0x36')][_0x82d6('0x37')]?_0xee04e0[_0x82d6('0x36')]:_0x453c56['model'];_0xee04e0[_0x82d6('0x39')]=qs[_0x82d6('0x3a')](_0x284fac[_0x82d6('0x31')][_0x82d6('0x3a')]);_0xee04e0['where']=qs[_0x82d6('0x33')](_['pick'](_0x284fac['query'],_0x453c56[_0x82d6('0x33')]));if(_0x284fac[_0x82d6('0x31')]['filter']){_0xee04e0[_0x82d6('0x3b')]=_[_0x82d6('0x3f')](_0xee04e0[_0x82d6('0x3b')],{'$or':_[_0x82d6('0x2b')](_0xee04e0[_0x82d6('0x36')],function(_0x4b344d){var _0x480dfa={};_0x480dfa[_0x4b344d]={'$like':'%'+_0x284fac[_0x82d6('0x31')][_0x82d6('0x3d')]+'%'};return _0x480dfa;})});}_0xee04e0=_[_0x82d6('0x3f')]({},_0xee04e0,_0x284fac[_0x82d6('0x40')]);return _0x2afce7['getFields'](_0xee04e0);}})[_0x82d6('0x24')](function(_0x37e0d2){if(_0x37e0d2){_0xdfb728=_0x37e0d2[_0x82d6('0x37')];if(!_0x284fac['query']['hasOwnProperty']('nolimit')){_0xee04e0[_0x82d6('0x1d')]=qs['limit'](_0x284fac[_0x82d6('0x31')][_0x82d6('0x1d')]);_0xee04e0[_0x82d6('0x1b')]=qs[_0x82d6('0x1b')](_0x284fac['query'][_0x82d6('0x1b')]);}return _0x2afce7['getFields'](_0xee04e0);}})['then'](function(_0x2db33c){if(_0x2db33c){return _0x2db33c?{'count':_0xdfb728,'rows':_0x2db33c}:null;}})[_0x82d6('0x24')](respondWithResult(_0x12d13c,null))[_0x82d6('0x43')](handleError(_0x12d13c,null));};exports[_0x82d6('0x4e')]=function(_0x42650b,_0x201233,_0x27333d){var _0x3a5df9={};var _0x481e35={};var _0xefe7b5;var _0x433188;return db[_0x82d6('0x41')][_0x82d6('0x4c')]({'where':{'id':_0x42650b['params']['id']}})[_0x82d6('0x24')](handleEntityNotFound(_0x201233,null))[_0x82d6('0x24')](function(_0x441271){if(_0x441271){_0xefe7b5=_0x441271;_0x481e35[_0x82d6('0x30')]=_[_0x82d6('0x32')](db[_0x82d6('0x4d')][_0x82d6('0x2c')]);_0x481e35['query']=_[_0x82d6('0x32')](_0x42650b[_0x82d6('0x31')]);_0x481e35[_0x82d6('0x33')]=_[_0x82d6('0x34')](_0x481e35['model'],_0x481e35['query']);_0x3a5df9['attributes']=_[_0x82d6('0x34')](_0x481e35[_0x82d6('0x30')],qs[_0x82d6('0x35')](_0x42650b['query'][_0x82d6('0x35')]));_0x3a5df9['attributes']=_0x3a5df9[_0x82d6('0x36')][_0x82d6('0x37')]?_0x3a5df9[_0x82d6('0x36')]:_0x481e35[_0x82d6('0x30')];_0x3a5df9['order']=qs[_0x82d6('0x3a')](_0x42650b['query'][_0x82d6('0x3a')]);_0x3a5df9[_0x82d6('0x3b')]=qs[_0x82d6('0x33')](_[_0x82d6('0x3c')](_0x42650b[_0x82d6('0x31')],_0x481e35[_0x82d6('0x33')]));if(_0x42650b[_0x82d6('0x31')][_0x82d6('0x3d')]){_0x3a5df9['where']=_[_0x82d6('0x3f')](_0x3a5df9['where'],{'$or':_[_0x82d6('0x2b')](_0x3a5df9['attributes'],function(_0x43c054){var _0x2cf4fc={};_0x2cf4fc[_0x43c054]={'$like':'%'+_0x42650b['query']['filter']+'%'};return _0x2cf4fc;})});}_0x3a5df9=_[_0x82d6('0x3f')]({},_0x3a5df9,_0x42650b[_0x82d6('0x40')]);return _0xefe7b5[_0x82d6('0x4e')](_0x3a5df9);}})[_0x82d6('0x24')](function(_0xcdba44){if(_0xcdba44){_0x433188=_0xcdba44[_0x82d6('0x37')];if(!_0x42650b[_0x82d6('0x31')][_0x82d6('0x4f')]('nolimit')){_0x3a5df9[_0x82d6('0x1d')]=qs[_0x82d6('0x1d')](_0x42650b[_0x82d6('0x31')][_0x82d6('0x1d')]);_0x3a5df9[_0x82d6('0x1b')]=qs[_0x82d6('0x1b')](_0x42650b[_0x82d6('0x31')][_0x82d6('0x1b')]);}return _0xefe7b5[_0x82d6('0x4e')](_0x3a5df9);}})[_0x82d6('0x24')](function(_0x2203c4){if(_0x2203c4){return _0x2203c4?{'count':_0x433188,'rows':_0x2203c4}:null;}})[_0x82d6('0x24')](respondWithResult(_0x201233,null))['catch'](handleError(_0x201233,null));};exports['getDescriptions']=function(_0x3b1ee1,_0x43c26e,_0x1ad9c8){var _0x4ca5c1={};var _0x181593={};var _0x130443;var _0xe08c2b;return db[_0x82d6('0x41')][_0x82d6('0x4c')]({'where':{'id':_0x3b1ee1[_0x82d6('0x45')]['id']}})['then'](handleEntityNotFound(_0x43c26e,null))[_0x82d6('0x24')](function(_0x68003e){if(_0x68003e){_0x130443=_0x68003e;_0x181593[_0x82d6('0x30')]=_[_0x82d6('0x32')](db['DeskField'][_0x82d6('0x2c')]);_0x181593['query']=_[_0x82d6('0x32')](_0x3b1ee1[_0x82d6('0x31')]);_0x181593[_0x82d6('0x33')]=_[_0x82d6('0x34')](_0x181593[_0x82d6('0x30')],_0x181593[_0x82d6('0x31')]);_0x4ca5c1[_0x82d6('0x36')]=_['intersection'](_0x181593[_0x82d6('0x30')],qs[_0x82d6('0x35')](_0x3b1ee1['query'][_0x82d6('0x35')]));_0x4ca5c1[_0x82d6('0x36')]=_0x4ca5c1[_0x82d6('0x36')][_0x82d6('0x37')]?_0x4ca5c1[_0x82d6('0x36')]:_0x181593['model'];_0x4ca5c1[_0x82d6('0x39')]=qs[_0x82d6('0x3a')](_0x3b1ee1[_0x82d6('0x31')][_0x82d6('0x3a')]);_0x4ca5c1['where']=qs['filters'](_[_0x82d6('0x3c')](_0x3b1ee1[_0x82d6('0x31')],_0x181593[_0x82d6('0x33')]));if(_0x3b1ee1[_0x82d6('0x31')]['filter']){_0x4ca5c1[_0x82d6('0x3b')]=_[_0x82d6('0x3f')](_0x4ca5c1[_0x82d6('0x3b')],{'$or':_[_0x82d6('0x2b')](_0x4ca5c1[_0x82d6('0x36')],function(_0x145524){var _0x1cec35={};_0x1cec35[_0x145524]={'$like':'%'+_0x3b1ee1[_0x82d6('0x31')][_0x82d6('0x3d')]+'%'};return _0x1cec35;})});}_0x4ca5c1=_[_0x82d6('0x3f')]({},_0x4ca5c1,_0x3b1ee1[_0x82d6('0x40')]);return _0x130443[_0x82d6('0x50')](_0x4ca5c1);}})[_0x82d6('0x24')](function(_0x2d5e04){if(_0x2d5e04){_0xe08c2b=_0x2d5e04['length'];if(!_0x3b1ee1[_0x82d6('0x31')][_0x82d6('0x4f')](_0x82d6('0x38'))){_0x4ca5c1[_0x82d6('0x1d')]=qs[_0x82d6('0x1d')](_0x3b1ee1[_0x82d6('0x31')]['limit']);_0x4ca5c1[_0x82d6('0x1b')]=qs[_0x82d6('0x1b')](_0x3b1ee1[_0x82d6('0x31')]['offset']);}return _0x130443[_0x82d6('0x50')](_0x4ca5c1);}})[_0x82d6('0x24')](function(_0x9e098e){if(_0x9e098e){return _0x9e098e?{'count':_0xe08c2b,'rows':_0x9e098e}:null;}})[_0x82d6('0x24')](respondWithResult(_0x43c26e,null))[_0x82d6('0x43')](handleError(_0x43c26e,null));};exports[_0x82d6('0x51')]=function(_0x243f35,_0x46d823,_0x1a1afc){var _0x5c259d={};var _0x5075cf={};var _0x5c9c17;var _0x423d3f;return db[_0x82d6('0x41')][_0x82d6('0x4c')]({'where':{'id':_0x243f35[_0x82d6('0x45')]['id']}})['then'](handleEntityNotFound(_0x46d823,null))[_0x82d6('0x24')](function(_0x5055ef){if(_0x5055ef){_0x5c9c17=_0x5055ef;_0x5075cf[_0x82d6('0x30')]=_['keys'](db['Tag'][_0x82d6('0x2c')]);_0x5075cf[_0x82d6('0x31')]=_['keys'](_0x243f35[_0x82d6('0x31')]);_0x5075cf['filters']=_[_0x82d6('0x34')](_0x5075cf[_0x82d6('0x30')],_0x5075cf['query']);_0x5c259d[_0x82d6('0x36')]=_['intersection'](_0x5075cf['model'],qs[_0x82d6('0x35')](_0x243f35[_0x82d6('0x31')][_0x82d6('0x35')]));_0x5c259d[_0x82d6('0x36')]=_0x5c259d[_0x82d6('0x36')][_0x82d6('0x37')]?_0x5c259d[_0x82d6('0x36')]:_0x5075cf['model'];_0x5c259d['order']=qs[_0x82d6('0x3a')](_0x243f35[_0x82d6('0x31')]['sort']);_0x5c259d[_0x82d6('0x3b')]=qs[_0x82d6('0x33')](_[_0x82d6('0x3c')](_0x243f35['query'],_0x5075cf[_0x82d6('0x33')]));if(_0x243f35[_0x82d6('0x31')][_0x82d6('0x3d')]){_0x5c259d[_0x82d6('0x3b')]=_[_0x82d6('0x3f')](_0x5c259d[_0x82d6('0x3b')],{'$or':_[_0x82d6('0x2b')](_0x5c259d[_0x82d6('0x36')],function(_0x2126d0){var _0x2fd491={};_0x2fd491[_0x2126d0]={'$like':'%'+_0x243f35['query']['filter']+'%'};return _0x2fd491;})});}_0x5c259d=_['merge']({},_0x5c259d,_0x243f35[_0x82d6('0x40')]);return _0x5c9c17[_0x82d6('0x51')](_0x5c259d);}})[_0x82d6('0x24')](function(_0x40f87a){if(_0x40f87a){_0x423d3f=_0x40f87a[_0x82d6('0x37')];if(!_0x243f35[_0x82d6('0x31')]['hasOwnProperty'](_0x82d6('0x38'))){_0x5c259d['limit']=qs[_0x82d6('0x1d')](_0x243f35[_0x82d6('0x31')][_0x82d6('0x1d')]);_0x5c259d[_0x82d6('0x1b')]=qs['offset'](_0x243f35[_0x82d6('0x31')]['offset']);}return _0x5c9c17[_0x82d6('0x51')](_0x5c259d);}})[_0x82d6('0x24')](function(_0xe710fb){if(_0xe710fb){return _0xe710fb?{'count':_0x423d3f,'rows':_0xe710fb}:null;}})[_0x82d6('0x24')](respondWithResult(_0x46d823,null))[_0x82d6('0x43')](handleError(_0x46d823,null));};exports[_0x82d6('0x52')]=function(_0x304cc9,_0x380402,_0x20e724){if(_0x304cc9[_0x82d6('0x48')]['id']){delete _0x304cc9[_0x82d6('0x48')]['id'];}return db[_0x82d6('0x41')][_0x82d6('0x4c')]({'where':{'id':_0x304cc9[_0x82d6('0x45')]['id']}})[_0x82d6('0x24')](handleEntityNotFound(_0x380402,null))[_0x82d6('0x24')](function(_0x22604d){if(_0x22604d){return _0x22604d['setTags'](_0x304cc9[_0x82d6('0x48')][_0x82d6('0x53')]||[]);}return null;})['then'](respondWithResult(_0x380402,null))[_0x82d6('0x43')](handleError(_0x380402,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index cb32d64..b8fbdd3 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 _0xd458=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x367288,_0x2f9772){var _0x2581af=function(_0x3b9b9e){while(--_0x3b9b9e){_0x367288['push'](_0x367288['shift']());}};_0x2581af(++_0x2f9772);}(_0xd458,0x1b9));var _0x8d45=function(_0x2db972,_0x31e8eb){_0x2db972=_0x2db972-0x0;var _0x5a13b0=_0xd458[_0x2db972];return _0x5a13b0;};'use strict';var _=require(_0x8d45('0x0'));var util=require(_0x8d45('0x1'));var logger=require(_0x8d45('0x2'))(_0x8d45('0x3'));var moment=require(_0x8d45('0x4'));var BPromise=require(_0x8d45('0x5'));var rp=require(_0x8d45('0x6'));var fs=require('fs');var path=require(_0x8d45('0x7'));var rimraf=require(_0x8d45('0x8'));var config=require(_0x8d45('0x9'));var attributes=require('./intDeskConfiguration.attributes');module[_0x8d45('0xa')]=function(_0xd5f443,_0xb43ce7){return _0xd5f443['define']('DeskConfiguration',attributes,{'tableName':_0x8d45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x530e=['request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x530e,0x193));var _0xe530=function(_0x289dc2,_0x35588b){_0x289dc2=_0x289dc2-0x0;var _0x28e2c3=_0x530e[_0x289dc2];return _0x28e2c3;};'use strict';var _=require('lodash');var util=require(_0xe530('0x0'));var logger=require(_0xe530('0x1'))(_0xe530('0x2'));var moment=require(_0xe530('0x3'));var BPromise=require(_0xe530('0x4'));var rp=require(_0xe530('0x5'));var fs=require('fs');var path=require(_0xe530('0x6'));var rimraf=require(_0xe530('0x7'));var config=require('../../config/environment');var attributes=require(_0xe530('0x8'));module[_0xe530('0x9')]=function(_0x385205,_0x2ebecd){return _0x385205[_0xe530('0xa')](_0xe530('0xb'),attributes,{'tableName':'int_desk_configurations','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 32f8da7..15fc881 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 _0x4849=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4fce10,_0x596096){var _0x180848=function(_0x26c514){while(--_0x26c514){_0x4fce10['push'](_0x4fce10['shift']());}};_0x180848(++_0x596096);}(_0x4849,0xf8));var _0x9484=function(_0x2b8c34,_0x199c93){_0x2b8c34=_0x2b8c34-0x0;var _0x352c58=_0x4849[_0x2b8c34];return _0x352c58;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var moment=require(_0x9484('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9484('0x3'));var db=require(_0x9484('0x4'))['db'];var utils=require(_0x9484('0x5'));var logger=require(_0x9484('0x6'))(_0x9484('0x7'));var config=require(_0x9484('0x8'));var jayson=require(_0x9484('0x9'));var client=jayson[_0x9484('0xa')][_0x9484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x536b43,_0x4a8a70,_0x11f2a1){return new BPromise(function(_0x583079,_0x3929b9){return client[_0x9484('0xc')](_0x536b43,_0x11f2a1)[_0x9484('0xd')](function(_0xe8b216){logger[_0x9484('0xe')](_0x9484('0xf'),_0x4a8a70,_0x9484('0x10'));logger[_0x9484('0x11')](_0x9484('0x12'),_0x4a8a70,_0x9484('0x10'),JSON[_0x9484('0x13')](_0xe8b216));if(_0xe8b216[_0x9484('0x14')]){if(_0xe8b216[_0x9484('0x14')][_0x9484('0x15')]===0x1f4){logger[_0x9484('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x4a8a70,_0xe8b216[_0x9484('0x14')]['message']);return _0x3929b9(_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);}logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);return _0x583079(_0xe8b216['error'][_0x9484('0x16')]);}else{logger[_0x9484('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x4a8a70,'request\x20sent');_0x583079(_0xe8b216[_0x9484('0x17')]['message']);}})[_0x9484('0x18')](function(_0x4e974f){logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0x4e974f);_0x3929b9(_0x4e974f);});});} \ No newline at end of file +var _0xa064=['stringify','error','message','DeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x494149,_0x28b12b){var _0x2391dc=function(_0x5f1fde){while(--_0x5f1fde){_0x494149['push'](_0x494149['shift']());}};_0x2391dc(++_0x28b12b);}(_0xa064,0x192));var _0x4a06=function(_0x2f8bc6,_0x4dc869){_0x2f8bc6=_0x2f8bc6-0x0;var _0x2d008a=_0xa064[_0x2f8bc6];return _0x2d008a;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var moment=require(_0x4a06('0x2'));var BPromise=require(_0x4a06('0x3'));var rs=require(_0x4a06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a06('0x5'));var logger=require('../../config/logger')(_0x4a06('0x6'));var config=require(_0x4a06('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a06('0x8')][_0x4a06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d4e3,_0x3b01cc,_0x454574){return new BPromise(function(_0x4c966b,_0x5e3342){return client[_0x4a06('0xa')](_0x55d4e3,_0x454574)[_0x4a06('0xb')](function(_0x3a8db5){logger[_0x4a06('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x3b01cc,_0x4a06('0xd'));logger[_0x4a06('0xe')](_0x4a06('0xf'),_0x3b01cc,_0x4a06('0xd'),JSON[_0x4a06('0x10')](_0x3a8db5));if(_0x3a8db5[_0x4a06('0x11')]){if(_0x3a8db5[_0x4a06('0x11')]['code']===0x1f4){logger[_0x4a06('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x3b01cc,_0x3a8db5[_0x4a06('0x11')][_0x4a06('0x12')]);return _0x5e3342(_0x3a8db5[_0x4a06('0x11')]['message']);}logger[_0x4a06('0x11')](_0x4a06('0x13'),_0x3b01cc,_0x3a8db5[_0x4a06('0x11')]['message']);return _0x4c966b(_0x3a8db5[_0x4a06('0x11')][_0x4a06('0x12')]);}else{logger[_0x4a06('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x3b01cc,_0x4a06('0xd'));_0x4c966b(_0x3a8db5[_0x4a06('0x14')][_0x4a06('0x12')]);}})[_0x4a06('0x15')](function(_0x15b067){logger['error'](_0x4a06('0x13'),_0x3b01cc,_0x15b067);_0x5e3342(_0x15b067);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0520ab5..ae20e7c 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 _0x781b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','/:id','show','post','update','isAuthenticated','exports','multer','util'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x781b,0x1c9));var _0xb781=function(_0xf30651,_0x964c8){_0xf30651=_0xf30651-0x0;var _0x5382a0=_0x781b[_0xf30651];return _0x5382a0;};'use strict';var multer=require(_0xb781('0x0'));var util=require(_0xb781('0x1'));var path=require(_0xb781('0x2'));var timeout=require(_0xb781('0x3'));var express=require(_0xb781('0x4'));var router=express[_0xb781('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb781('0x6'));var interaction=require(_0xb781('0x7'));var config=require(_0xb781('0x8'));var controller=require(_0xb781('0x9'));router[_0xb781('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb781('0xa')](_0xb781('0xb'),auth['isAuthenticated'](),controller[_0xb781('0xc')]);router[_0xb781('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb781('0xb'),auth['isAuthenticated'](),controller[_0xb781('0xe')]);router['delete'](_0xb781('0xb'),auth[_0xb781('0xf')](),controller['destroy']);module[_0xb781('0x10')]=router; \ No newline at end of file +var _0xd237=['../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xd237,0x14f));var _0x7d23=function(_0x3cb2be,_0x51cd28){_0x3cb2be=_0x3cb2be-0x0;var _0x46cae2=_0xd237[_0x3cb2be];return _0x46cae2;};'use strict';var multer=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var path=require(_0x7d23('0x2'));var timeout=require(_0x7d23('0x3'));var express=require('express');var router=express[_0x7d23('0x4')]();var fs_extra=require(_0x7d23('0x5'));var auth=require(_0x7d23('0x6'));var interaction=require(_0x7d23('0x7'));var config=require(_0x7d23('0x8'));var controller=require(_0x7d23('0x9'));router['get']('/',auth[_0x7d23('0xa')](),controller['index']);router['get']('/:id',auth[_0x7d23('0xa')](),controller[_0x7d23('0xb')]);router[_0x7d23('0xc')]('/',auth[_0x7d23('0xa')](),controller[_0x7d23('0xd')]);router[_0x7d23('0xe')](_0x7d23('0xf'),auth[_0x7d23('0xa')](),controller['update']);router[_0x7d23('0x10')](_0x7d23('0xf'),auth[_0x7d23('0xa')](),controller['destroy']);module[_0x7d23('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 382e591..c563b5a 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 _0xdae9=['STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue','picklist'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xdae9,0x7c));var _0x9dae=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xdae9[_0x26f1b2];return _0x1624a4;};'use strict';var Sequelize=require(_0x9dae('0x0'));module[_0x9dae('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9dae('0x2'),'variable',_0x9dae('0x3'),_0x9dae('0x4'),_0x9dae('0x5')),'defaultValue':_0x9dae('0x2')},'content':{'type':Sequelize[_0x9dae('0x6')]},'key':{'type':Sequelize[_0x9dae('0x6')]},'keyType':{'type':Sequelize[_0x9dae('0x7')](_0x9dae('0x2'),_0x9dae('0x8'),_0x9dae('0x3'))},'keyContent':{'type':Sequelize[_0x9dae('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9dae('0x6')]},'customField':{'type':Sequelize[_0x9dae('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9dae('0x6')]}}; \ No newline at end of file +var _0x61a9=['customVariable','keyValue','STRING','exports','ENUM','string','variable'];(function(_0x298e3d,_0x54ad84){var _0x57b0b6=function(_0x56f03d){while(--_0x56f03d){_0x298e3d['push'](_0x298e3d['shift']());}};_0x57b0b6(++_0x54ad84);}(_0x61a9,0x153));var _0x961a=function(_0x4ee53f,_0x1c2a76){_0x4ee53f=_0x4ee53f-0x0;var _0x3b24fb=_0x61a9[_0x4ee53f];return _0x3b24fb;};'use strict';var Sequelize=require('sequelize');module[_0x961a('0x0')]={'type':{'type':Sequelize[_0x961a('0x1')](_0x961a('0x2'),_0x961a('0x3'),_0x961a('0x4'),_0x961a('0x5'),'picklist'),'defaultValue':_0x961a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x961a('0x1')](_0x961a('0x2'),_0x961a('0x3'),_0x961a('0x4'))},'keyContent':{'type':Sequelize[_0x961a('0x6')]},'idField':{'type':Sequelize[_0x961a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x961a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 6780008..3e0d313 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 _0x0514=['sendStatus','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','json','offset','limit','count','apply','reject','save','update','then','destroy','end'];(function(_0x2a5c72,_0x237386){var _0x30afd9=function(_0x575445){while(--_0x575445){_0x2a5c72['push'](_0x2a5c72['shift']());}};_0x30afd9(++_0x237386);}(_0x0514,0x1f0));var _0x4051=function(_0x3dad59,_0x21a7ce){_0x3dad59=_0x3dad59-0x0;var _0x42a3b7=_0x0514[_0x3dad59];return _0x42a3b7;};'use strict';var emlformat=require(_0x4051('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4051('0x1'));var jsonpatch=require(_0x4051('0x2'));var rp=require('request-promise');var moment=require(_0x4051('0x3'));var BPromise=require(_0x4051('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4051('0x5'));var sox=require(_0x4051('0x6'));var csv=require(_0x4051('0x7'));var ejs=require(_0x4051('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4051('0x9'));var crypto=require(_0x4051('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4051('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4051('0xc'));var Papa=require(_0x4051('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4051('0xe'));var as=require(_0x4051('0xf'));var hardwareService=require(_0x4051('0x10'));var logger=require(_0x4051('0x11'))('api');var utils=require(_0x4051('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4051('0x13'))['db'];function respondWithStatusCode(_0x19fbd7,_0x1980a0){_0x1980a0=_0x1980a0||0xcc;return function(_0x1eb233){if(_0x1eb233){return _0x19fbd7['sendStatus'](_0x1980a0);}return _0x19fbd7[_0x4051('0x14')](_0x1980a0)['end']();};}function respondWithResult(_0x95d684,_0x347aea){_0x347aea=_0x347aea||0xc8;return function(_0x52ef89){if(_0x52ef89){return _0x95d684[_0x4051('0x14')](_0x347aea)[_0x4051('0x15')](_0x52ef89);}};}function respondWithFilteredResult(_0x406a34,_0x23394a){return function(_0x531d4f){if(_0x531d4f){var _0x25f125=typeof _0x23394a[_0x4051('0x16')]==='undefined'&&typeof _0x23394a[_0x4051('0x17')]==='undefined';var _0x1f61d3=_0x531d4f[_0x4051('0x18')];var _0x49811a=_0x25f125?0x0:_0x23394a[_0x4051('0x16')];var _0x415242=_0x25f125?_0x531d4f['count']:_0x23394a[_0x4051('0x16')]+_0x23394a[_0x4051('0x17')];var _0x40b8fb;if(_0x415242>=_0x1f61d3){_0x415242=_0x1f61d3;_0x40b8fb=0xc8;}else{_0x40b8fb=0xce;}_0x406a34[_0x4051('0x14')](_0x40b8fb);return _0x406a34['set']('Content-Range',_0x49811a+'-'+_0x415242+'/'+_0x1f61d3)[_0x4051('0x15')](_0x531d4f);}return null;};}function patchUpdates(_0x358095){return function(_0x16ae08){try{jsonpatch[_0x4051('0x19')](_0x16ae08,_0x358095,!![]);}catch(_0x1ed5a9){return BPromise[_0x4051('0x1a')](_0x1ed5a9);}return _0x16ae08[_0x4051('0x1b')]();};}function saveUpdates(_0x1442cc,_0x56c7bc){return function(_0x228ff6){if(_0x228ff6){return _0x228ff6[_0x4051('0x1c')](_0x1442cc)[_0x4051('0x1d')](function(_0x2b6fa8){return _0x2b6fa8;});}return null;};}function removeEntity(_0x1d6150,_0x4189dd){return function(_0x196d2e){if(_0x196d2e){return _0x196d2e[_0x4051('0x1e')]()[_0x4051('0x1d')](function(){_0x1d6150[_0x4051('0x14')](0xcc)[_0x4051('0x1f')]();});}};}function handleEntityNotFound(_0x4fc039,_0x6dd151){return function(_0x54deeb){if(!_0x54deeb){_0x4fc039[_0x4051('0x20')](0x194);}return _0x54deeb;};}function handleError(_0x3caa4d,_0x2a1bf0){_0x2a1bf0=_0x2a1bf0||0x1f4;return function(_0x427225){logger['error'](_0x427225[_0x4051('0x21')]);if(_0x427225[_0x4051('0x22')]){delete _0x427225[_0x4051('0x22')];}_0x3caa4d[_0x4051('0x14')](_0x2a1bf0)['send'](_0x427225);};}exports[_0x4051('0x23')]=function(_0x570e31,_0x473379){var _0x586d21={},_0x47f55a={},_0x4a084d={'count':0x0,'rows':[]};var _0x31641a=_[_0x4051('0x24')](db[_0x4051('0x25')][_0x4051('0x26')],function(_0x514c76){return{'name':_0x514c76[_0x4051('0x27')],'type':_0x514c76[_0x4051('0x28')][_0x4051('0x29')]};});_0x47f55a['model']=_[_0x4051('0x24')](_0x31641a,_0x4051('0x22'));_0x47f55a['query']=_[_0x4051('0x2a')](_0x570e31[_0x4051('0x2b')]);_0x47f55a[_0x4051('0x2c')]=_[_0x4051('0x2d')](_0x47f55a[_0x4051('0x2e')],_0x47f55a[_0x4051('0x2b')]);_0x586d21[_0x4051('0x2f')]=_[_0x4051('0x2d')](_0x47f55a[_0x4051('0x2e')],qs[_0x4051('0x30')](_0x570e31[_0x4051('0x2b')][_0x4051('0x30')]));_0x586d21['attributes']=_0x586d21[_0x4051('0x2f')][_0x4051('0x31')]?_0x586d21[_0x4051('0x2f')]:_0x47f55a[_0x4051('0x2e')];if(!_0x570e31[_0x4051('0x2b')][_0x4051('0x32')]('nolimit')){_0x586d21['limit']=qs[_0x4051('0x17')](_0x570e31[_0x4051('0x2b')][_0x4051('0x17')]);_0x586d21[_0x4051('0x16')]=qs['offset'](_0x570e31[_0x4051('0x2b')][_0x4051('0x16')]);}_0x586d21[_0x4051('0x33')]=qs[_0x4051('0x34')](_0x570e31[_0x4051('0x2b')][_0x4051('0x34')]);_0x586d21[_0x4051('0x35')]=qs[_0x4051('0x2c')](_[_0x4051('0x36')](_0x570e31[_0x4051('0x2b')],_0x47f55a['filters']),_0x31641a);if(_0x570e31[_0x4051('0x2b')]['filter']){_0x586d21[_0x4051('0x35')]=_[_0x4051('0x37')](_0x586d21[_0x4051('0x35')],{'$or':_['map'](_0x31641a,function(_0x3e5220){if(_0x3e5220[_0x4051('0x28')]!==_0x4051('0x38')){var _0x517aab={};_0x517aab[_0x3e5220['name']]={'$like':'%'+_0x570e31[_0x4051('0x2b')]['filter']+'%'};return _0x517aab;}})});}_0x586d21=_[_0x4051('0x37')]({},_0x586d21,_0x570e31[_0x4051('0x39')]);var _0x391253={'where':_0x586d21[_0x4051('0x35')]};return db['DeskField']['count'](_0x391253)[_0x4051('0x1d')](function(_0x5d81e4){_0x4a084d['count']=_0x5d81e4;if(_0x570e31[_0x4051('0x2b')][_0x4051('0x3a')]){_0x586d21[_0x4051('0x3b')]=[{'all':!![]}];}return db[_0x4051('0x25')]['findAll'](_0x586d21);})['then'](function(_0x4c9168){_0x4a084d['rows']=_0x4c9168;return _0x4a084d;})[_0x4051('0x1d')](respondWithFilteredResult(_0x473379,_0x586d21))[_0x4051('0x3c')](handleError(_0x473379,null));};exports[_0x4051('0x3d')]=function(_0x5e4def,_0x2e7429){var _0xd7821={'raw':!![],'where':{'id':_0x5e4def[_0x4051('0x3e')]['id']}},_0x7bc4ba={};_0x7bc4ba[_0x4051('0x2e')]=_[_0x4051('0x2a')](db[_0x4051('0x25')][_0x4051('0x26')]);_0x7bc4ba[_0x4051('0x2b')]=_[_0x4051('0x2a')](_0x5e4def['query']);_0x7bc4ba[_0x4051('0x2c')]=_[_0x4051('0x2d')](_0x7bc4ba[_0x4051('0x2e')],_0x7bc4ba[_0x4051('0x2b')]);_0xd7821[_0x4051('0x2f')]=_[_0x4051('0x2d')](_0x7bc4ba[_0x4051('0x2e')],qs[_0x4051('0x30')](_0x5e4def['query']['fields']));_0xd7821[_0x4051('0x2f')]=_0xd7821[_0x4051('0x2f')][_0x4051('0x31')]?_0xd7821['attributes']:_0x7bc4ba[_0x4051('0x2e')];if(_0x5e4def[_0x4051('0x2b')][_0x4051('0x3a')]){_0xd7821[_0x4051('0x3b')]=[{'all':!![]}];}_0xd7821=_[_0x4051('0x37')]({},_0xd7821,_0x5e4def[_0x4051('0x39')]);return db[_0x4051('0x25')][_0x4051('0x3f')](_0xd7821)['then'](handleEntityNotFound(_0x2e7429,null))[_0x4051('0x1d')](respondWithResult(_0x2e7429,null))['catch'](handleError(_0x2e7429,null));};exports[_0x4051('0x40')]=function(_0x1ccd91,_0x299e9c){return db[_0x4051('0x25')][_0x4051('0x40')](_0x1ccd91[_0x4051('0x41')],{})['then'](respondWithResult(_0x299e9c,0xc9))[_0x4051('0x3c')](handleError(_0x299e9c,null));};exports[_0x4051('0x1c')]=function(_0x49e116,_0x4ffef1){if(_0x49e116[_0x4051('0x41')]['id']){delete _0x49e116[_0x4051('0x41')]['id'];}return db['DeskField'][_0x4051('0x3f')]({'where':{'id':_0x49e116[_0x4051('0x3e')]['id']}})[_0x4051('0x1d')](handleEntityNotFound(_0x4ffef1,null))[_0x4051('0x1d')](saveUpdates(_0x49e116[_0x4051('0x41')],null))[_0x4051('0x1d')](respondWithResult(_0x4ffef1,null))[_0x4051('0x3c')](handleError(_0x4ffef1,null));};exports[_0x4051('0x1e')]=function(_0x1f5918,_0x105215){return db[_0x4051('0x25')][_0x4051('0x3f')]({'where':{'id':_0x1f5918[_0x4051('0x3e')]['id']}})[_0x4051('0x1d')](handleEntityNotFound(_0x105215,null))[_0x4051('0x1d')](removeEntity(_0x105215,null))['catch'](handleError(_0x105215,null));}; \ No newline at end of file +var _0x803f=['save','then','sendStatus','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','rows','catch','show','params','include','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','status','end','json','offset','limit','undefined','count','set','apply','reject'];(function(_0x51308d,_0x42cf02){var _0x37cde8=function(_0x527de4){while(--_0x527de4){_0x51308d['push'](_0x51308d['shift']());}};_0x37cde8(++_0x42cf02);}(_0x803f,0x144));var _0xf803=function(_0x54c039,_0x6dab5a){_0x54c039=_0x54c039-0x0;var _0x443f2b=_0x803f[_0x54c039];return _0x443f2b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf803('0x0'));var zipdir=require(_0xf803('0x1'));var jsonpatch=require(_0xf803('0x2'));var rp=require(_0xf803('0x3'));var moment=require(_0xf803('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf803('0x5'));var util=require(_0xf803('0x6'));var path=require(_0xf803('0x7'));var sox=require(_0xf803('0x8'));var csv=require(_0xf803('0x9'));var ejs=require(_0xf803('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf803('0xb'));var squel=require(_0xf803('0xc'));var crypto=require(_0xf803('0xd'));var jsforce=require(_0xf803('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf803('0xf'));var Papa=require('papaparse');var Redis=require(_0xf803('0x10'));var authService=require(_0xf803('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf803('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf803('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf803('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec5b3,_0x2785e2){_0x2785e2=_0x2785e2||0xcc;return function(_0x418246){if(_0x418246){return _0x3ec5b3['sendStatus'](_0x2785e2);}return _0x3ec5b3[_0xf803('0x15')](_0x2785e2)[_0xf803('0x16')]();};}function respondWithResult(_0x47c904,_0x5a34b7){_0x5a34b7=_0x5a34b7||0xc8;return function(_0xaf3d8d){if(_0xaf3d8d){return _0x47c904[_0xf803('0x15')](_0x5a34b7)[_0xf803('0x17')](_0xaf3d8d);}};}function respondWithFilteredResult(_0x30f924,_0x39de2f){return function(_0x369937){if(_0x369937){var _0x56a5db=typeof _0x39de2f[_0xf803('0x18')]==='undefined'&&typeof _0x39de2f[_0xf803('0x19')]===_0xf803('0x1a');var _0x1d645b=_0x369937[_0xf803('0x1b')];var _0x5641a0=_0x56a5db?0x0:_0x39de2f[_0xf803('0x18')];var _0x4d2ce7=_0x56a5db?_0x369937[_0xf803('0x1b')]:_0x39de2f[_0xf803('0x18')]+_0x39de2f[_0xf803('0x19')];var _0x398787;if(_0x4d2ce7>=_0x1d645b){_0x4d2ce7=_0x1d645b;_0x398787=0xc8;}else{_0x398787=0xce;}_0x30f924['status'](_0x398787);return _0x30f924[_0xf803('0x1c')]('Content-Range',_0x5641a0+'-'+_0x4d2ce7+'/'+_0x1d645b)['json'](_0x369937);}return null;};}function patchUpdates(_0x408ea6){return function(_0x140806){try{jsonpatch[_0xf803('0x1d')](_0x140806,_0x408ea6,!![]);}catch(_0xb3e488){return BPromise[_0xf803('0x1e')](_0xb3e488);}return _0x140806[_0xf803('0x1f')]();};}function saveUpdates(_0x5123bf,_0x1f9880){return function(_0x59f6f2){if(_0x59f6f2){return _0x59f6f2['update'](_0x5123bf)[_0xf803('0x20')](function(_0x35d11a){return _0x35d11a;});}return null;};}function removeEntity(_0x3122b3,_0x4cd887){return function(_0x1b998e){if(_0x1b998e){return _0x1b998e['destroy']()[_0xf803('0x20')](function(){_0x3122b3[_0xf803('0x15')](0xcc)[_0xf803('0x16')]();});}};}function handleEntityNotFound(_0x5390a8,_0xf14da4){return function(_0x69c7fc){if(!_0x69c7fc){_0x5390a8[_0xf803('0x21')](0x194);}return _0x69c7fc;};}function handleError(_0x53b084,_0x3f1952){_0x3f1952=_0x3f1952||0x1f4;return function(_0xf28b04){logger[_0xf803('0x22')](_0xf28b04[_0xf803('0x23')]);if(_0xf28b04['name']){delete _0xf28b04[_0xf803('0x24')];}_0x53b084['status'](_0x3f1952)[_0xf803('0x25')](_0xf28b04);};}exports[_0xf803('0x26')]=function(_0x1404de,_0x554d17){var _0x419229={},_0x4b82d3={},_0x33f804={'count':0x0,'rows':[]};var _0x2a3b39=_[_0xf803('0x27')](db[_0xf803('0x28')][_0xf803('0x29')],function(_0x4a8765){return{'name':_0x4a8765[_0xf803('0x2a')],'type':_0x4a8765['type'][_0xf803('0x2b')]};});_0x4b82d3[_0xf803('0x2c')]=_[_0xf803('0x27')](_0x2a3b39,_0xf803('0x24'));_0x4b82d3[_0xf803('0x2d')]=_[_0xf803('0x2e')](_0x1404de[_0xf803('0x2d')]);_0x4b82d3[_0xf803('0x2f')]=_['intersection'](_0x4b82d3[_0xf803('0x2c')],_0x4b82d3[_0xf803('0x2d')]);_0x419229[_0xf803('0x30')]=_[_0xf803('0x31')](_0x4b82d3['model'],qs[_0xf803('0x32')](_0x1404de[_0xf803('0x2d')][_0xf803('0x32')]));_0x419229[_0xf803('0x30')]=_0x419229[_0xf803('0x30')][_0xf803('0x33')]?_0x419229[_0xf803('0x30')]:_0x4b82d3[_0xf803('0x2c')];if(!_0x1404de['query'][_0xf803('0x34')]('nolimit')){_0x419229[_0xf803('0x19')]=qs[_0xf803('0x19')](_0x1404de[_0xf803('0x2d')][_0xf803('0x19')]);_0x419229[_0xf803('0x18')]=qs[_0xf803('0x18')](_0x1404de['query'][_0xf803('0x18')]);}_0x419229[_0xf803('0x35')]=qs['sort'](_0x1404de[_0xf803('0x2d')][_0xf803('0x36')]);_0x419229[_0xf803('0x37')]=qs[_0xf803('0x2f')](_[_0xf803('0x38')](_0x1404de['query'],_0x4b82d3[_0xf803('0x2f')]),_0x2a3b39);if(_0x1404de['query'][_0xf803('0x39')]){_0x419229[_0xf803('0x37')]=_[_0xf803('0x3a')](_0x419229[_0xf803('0x37')],{'$or':_[_0xf803('0x27')](_0x2a3b39,function(_0x19909f){if(_0x19909f[_0xf803('0x3b')]!==_0xf803('0x3c')){var _0x55b549={};_0x55b549[_0x19909f[_0xf803('0x24')]]={'$like':'%'+_0x1404de['query'][_0xf803('0x39')]+'%'};return _0x55b549;}})});}_0x419229=_['merge']({},_0x419229,_0x1404de['options']);var _0x45862a={'where':_0x419229['where']};return db[_0xf803('0x28')][_0xf803('0x1b')](_0x45862a)[_0xf803('0x20')](function(_0x448dd4){_0x33f804[_0xf803('0x1b')]=_0x448dd4;if(_0x1404de[_0xf803('0x2d')]['includeAll']){_0x419229['include']=[{'all':!![]}];}return db[_0xf803('0x28')]['findAll'](_0x419229);})[_0xf803('0x20')](function(_0x34680c){_0x33f804[_0xf803('0x3d')]=_0x34680c;return _0x33f804;})[_0xf803('0x20')](respondWithFilteredResult(_0x554d17,_0x419229))[_0xf803('0x3e')](handleError(_0x554d17,null));};exports[_0xf803('0x3f')]=function(_0x373eb2,_0x4ea211){var _0x9dd6ec={'raw':!![],'where':{'id':_0x373eb2[_0xf803('0x40')]['id']}},_0x117b65={};_0x117b65[_0xf803('0x2c')]=_['keys'](db[_0xf803('0x28')][_0xf803('0x29')]);_0x117b65[_0xf803('0x2d')]=_[_0xf803('0x2e')](_0x373eb2[_0xf803('0x2d')]);_0x117b65[_0xf803('0x2f')]=_['intersection'](_0x117b65[_0xf803('0x2c')],_0x117b65[_0xf803('0x2d')]);_0x9dd6ec[_0xf803('0x30')]=_[_0xf803('0x31')](_0x117b65[_0xf803('0x2c')],qs[_0xf803('0x32')](_0x373eb2['query'][_0xf803('0x32')]));_0x9dd6ec[_0xf803('0x30')]=_0x9dd6ec[_0xf803('0x30')][_0xf803('0x33')]?_0x9dd6ec[_0xf803('0x30')]:_0x117b65[_0xf803('0x2c')];if(_0x373eb2[_0xf803('0x2d')]['includeAll']){_0x9dd6ec[_0xf803('0x41')]=[{'all':!![]}];}_0x9dd6ec=_['merge']({},_0x9dd6ec,_0x373eb2[_0xf803('0x42')]);return db[_0xf803('0x28')][_0xf803('0x43')](_0x9dd6ec)[_0xf803('0x20')](handleEntityNotFound(_0x4ea211,null))[_0xf803('0x20')](respondWithResult(_0x4ea211,null))['catch'](handleError(_0x4ea211,null));};exports[_0xf803('0x44')]=function(_0x44b143,_0x3e9971){return db[_0xf803('0x28')][_0xf803('0x44')](_0x44b143['body'],{})[_0xf803('0x20')](respondWithResult(_0x3e9971,0xc9))[_0xf803('0x3e')](handleError(_0x3e9971,null));};exports['update']=function(_0x810538,_0x1f7fd3){if(_0x810538[_0xf803('0x45')]['id']){delete _0x810538['body']['id'];}return db[_0xf803('0x28')][_0xf803('0x43')]({'where':{'id':_0x810538[_0xf803('0x40')]['id']}})[_0xf803('0x20')](handleEntityNotFound(_0x1f7fd3,null))[_0xf803('0x20')](saveUpdates(_0x810538['body'],null))[_0xf803('0x20')](respondWithResult(_0x1f7fd3,null))[_0xf803('0x3e')](handleError(_0x1f7fd3,null));};exports[_0xf803('0x46')]=function(_0x1108c8,_0xd62958){return db[_0xf803('0x28')][_0xf803('0x43')]({'where':{'id':_0x1108c8[_0xf803('0x40')]['id']}})['then'](handleEntityNotFound(_0xd62958,null))['then'](removeEntity(_0xd62958,null))[_0xf803('0x3e')](handleError(_0xd62958,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f66d1dd..0bd3eb7 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 _0xfc21=['moment','bluebird','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xfc21,0xeb));var _0x1fc2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfc21[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x1fc2('0x0'));var util=require('util');var logger=require(_0x1fc2('0x1'))(_0x1fc2('0x2'));var moment=require(_0x1fc2('0x3'));var BPromise=require(_0x1fc2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fc2('0x5'));var rimraf=require('rimraf');var config=require(_0x1fc2('0x6'));var attributes=require(_0x1fc2('0x7'));module[_0x1fc2('0x8')]=function(_0x3d6d35,_0x4ef555){return _0x3d6d35[_0x1fc2('0x9')](_0x1fc2('0xa'),attributes,{'tableName':_0x1fc2('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x1fc2('0xc'),_0x1fc2('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5082=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','idField','FieldId','lodash'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x5082,0x16f));var _0x2508=function(_0x18d4ec,_0xd10dc1){_0x18d4ec=_0x18d4ec-0x0;var _0x22d467=_0x5082[_0x18d4ec];return _0x22d467;};'use strict';var _=require(_0x2508('0x0'));var util=require(_0x2508('0x1'));var logger=require(_0x2508('0x2'))(_0x2508('0x3'));var moment=require(_0x2508('0x4'));var BPromise=require(_0x2508('0x5'));var rp=require(_0x2508('0x6'));var fs=require('fs');var path=require(_0x2508('0x7'));var rimraf=require(_0x2508('0x8'));var config=require(_0x2508('0x9'));var attributes=require(_0x2508('0xa'));module[_0x2508('0xb')]=function(_0x1f60a0,_0x5a270a){return _0x1f60a0['define'](_0x2508('0xc'),attributes,{'tableName':_0x2508('0xd'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x2508('0xe'),_0x2508('0xf')],'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 4ac83fa..972c4f5 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 _0x161c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util'];(function(_0x347ba3,_0x56892b){var _0x4c6f34=function(_0x43331a){while(--_0x43331a){_0x347ba3['push'](_0x347ba3['shift']());}};_0x4c6f34(++_0x56892b);}(_0x161c,0x140));var _0xc161=function(_0x1d6bd9,_0x2c45f2){_0x1d6bd9=_0x1d6bd9-0x0;var _0x536cae=_0x161c[_0x1d6bd9];return _0x536cae;};'use strict';var _=require(_0xc161('0x0'));var util=require(_0xc161('0x1'));var moment=require(_0xc161('0x2'));var BPromise=require(_0xc161('0x3'));var rs=require(_0xc161('0x4'));var fs=require('fs');var Redis=require(_0xc161('0x5'));var db=require(_0xc161('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc161('0x7'))('rpc');var config=require(_0xc161('0x8'));var jayson=require(_0xc161('0x9'));var client=jayson[_0xc161('0xa')][_0xc161('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x407add,_0x1e6951,_0x3e3950){return new BPromise(function(_0x23b588,_0x589ff2){return client[_0xc161('0xc')](_0x407add,_0x3e3950)['then'](function(_0x3baa24){logger['info'](_0xc161('0xd'),_0x1e6951,'request\x20sent');logger['debug'](_0xc161('0xe'),_0x1e6951,'request\x20sent',JSON[_0xc161('0xf')](_0x3baa24));if(_0x3baa24[_0xc161('0x10')]){if(_0x3baa24[_0xc161('0x10')][_0xc161('0x11')]===0x1f4){logger['error'](_0xc161('0xd'),_0x1e6951,_0x3baa24[_0xc161('0x10')]['message']);return _0x589ff2(_0x3baa24[_0xc161('0x10')][_0xc161('0x12')]);}logger['error'](_0xc161('0xd'),_0x1e6951,_0x3baa24['error'][_0xc161('0x12')]);return _0x23b588(_0x3baa24['error'][_0xc161('0x12')]);}else{logger[_0xc161('0x13')]('DeskField,\x20%s,\x20%s',_0x1e6951,_0xc161('0x14'));_0x23b588(_0x3baa24[_0xc161('0x15')]['message']);}})[_0xc161('0x16')](function(_0x18c8c5){logger[_0xc161('0x10')](_0xc161('0xd'),_0x1e6951,_0x18c8c5);_0x589ff2(_0x18c8c5);});});} \ No newline at end of file +var _0x3f19=['result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2b0593,_0x994e00){var _0x4e6bbe=function(_0x276cc1){while(--_0x276cc1){_0x2b0593['push'](_0x2b0593['shift']());}};_0x4e6bbe(++_0x994e00);}(_0x3f19,0x189));var _0x93f1=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0x3f19[_0x5c365f];return _0x295e1b;};'use strict';var _=require('lodash');var util=require(_0x93f1('0x0'));var moment=require(_0x93f1('0x1'));var BPromise=require(_0x93f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93f1('0x4'));var logger=require('../../config/logger')(_0x93f1('0x5'));var config=require(_0x93f1('0x6'));var jayson=require(_0x93f1('0x7'));var client=jayson[_0x93f1('0x8')][_0x93f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x175083,_0x4d16c2,_0x293d93){return new BPromise(function(_0x368f63,_0x5d1f2f){return client[_0x93f1('0xa')](_0x175083,_0x293d93)[_0x93f1('0xb')](function(_0x1fcdad){logger[_0x93f1('0xc')](_0x93f1('0xd'),_0x4d16c2,_0x93f1('0xe'));logger[_0x93f1('0xf')](_0x93f1('0x10'),_0x4d16c2,'request\x20sent',JSON[_0x93f1('0x11')](_0x1fcdad));if(_0x1fcdad['error']){if(_0x1fcdad[_0x93f1('0x12')][_0x93f1('0x13')]===0x1f4){logger['error'](_0x93f1('0xd'),_0x4d16c2,_0x1fcdad['error'][_0x93f1('0x14')]);return _0x5d1f2f(_0x1fcdad[_0x93f1('0x12')]['message']);}logger[_0x93f1('0x12')](_0x93f1('0xd'),_0x4d16c2,_0x1fcdad['error'][_0x93f1('0x14')]);return _0x368f63(_0x1fcdad[_0x93f1('0x12')][_0x93f1('0x14')]);}else{logger[_0x93f1('0xc')](_0x93f1('0xd'),_0x4d16c2,'request\x20sent');_0x368f63(_0x1fcdad[_0x93f1('0x15')][_0x93f1('0x14')]);}})[_0x93f1('0x16')](function(_0x87af4f){logger['error'](_0x93f1('0xd'),_0x4d16c2,_0x87af4f);_0x5d1f2f(_0x87af4f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ea68c6e..a1ae04d 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 _0x2726=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ad040,_0x2c368b){var _0x3761f0=function(_0x29e454){while(--_0x29e454){_0x2ad040['push'](_0x2ad040['shift']());}};_0x3761f0(++_0x2c368b);}(_0x2726,0x1a1));var _0x6272=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x2726[_0xfc406a];return _0x395473;};'use strict';var multer=require(_0x6272('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6272('0x1'));var express=require(_0x6272('0x2'));var router=express[_0x6272('0x3')]();var fs_extra=require(_0x6272('0x4'));var auth=require(_0x6272('0x5'));var interaction=require(_0x6272('0x6'));var config=require(_0x6272('0x7'));var controller=require(_0x6272('0x8'));router[_0x6272('0x9')]('/',auth[_0x6272('0xa')](),controller[_0x6272('0xb')]);router[_0x6272('0x9')](_0x6272('0xc'),auth[_0x6272('0xa')](),controller[_0x6272('0xd')]);router[_0x6272('0x9')]('/:id/configurations',auth[_0x6272('0xa')](),controller[_0x6272('0xe')]);router[_0x6272('0x9')](_0x6272('0xf'),auth[_0x6272('0xa')](),controller[_0x6272('0x10')]);router[_0x6272('0x11')]('/',auth[_0x6272('0xa')](),controller[_0x6272('0x12')]);router[_0x6272('0x11')](_0x6272('0x13'),auth['isAuthenticated'](),controller[_0x6272('0x14')]);router[_0x6272('0x15')](_0x6272('0xc'),auth[_0x6272('0xa')](),controller['update']);router[_0x6272('0x16')](_0x6272('0xc'),auth[_0x6272('0xa')](),controller[_0x6272('0x17')]);module[_0x6272('0x18')]=router; \ No newline at end of file +var _0xa939=['getFields','create','post','/:id/configurations','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x396261,_0xdaec64){var _0x153b09=function(_0x17c319){while(--_0x17c319){_0x396261['push'](_0x396261['shift']());}};_0x153b09(++_0xdaec64);}(_0xa939,0x14a));var _0x9a93=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa939[_0x34bc30];return _0x5706de;};'use strict';var multer=require('multer');var util=require(_0x9a93('0x0'));var path=require(_0x9a93('0x1'));var timeout=require(_0x9a93('0x2'));var express=require('express');var router=express[_0x9a93('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9a93('0x4'));var interaction=require(_0x9a93('0x5'));var config=require(_0x9a93('0x6'));var controller=require(_0x9a93('0x7'));router[_0x9a93('0x8')]('/',auth[_0x9a93('0x9')](),controller[_0x9a93('0xa')]);router[_0x9a93('0x8')](_0x9a93('0xb'),auth[_0x9a93('0x9')](),controller[_0x9a93('0xc')]);router[_0x9a93('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x9a93('0xd')]);router[_0x9a93('0x8')](_0x9a93('0xe'),auth[_0x9a93('0x9')](),controller[_0x9a93('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9a93('0x10')]);router[_0x9a93('0x11')](_0x9a93('0x12'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x9a93('0x13')](_0x9a93('0xb'),auth[_0x9a93('0x9')](),controller['update']);router[_0x9a93('0x14')](_0x9a93('0xb'),auth[_0x9a93('0x9')](),controller[_0x9a93('0x15')]);module[_0x9a93('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 13618a6..0f12cf1 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 _0xbc43=['STRING'];(function(_0xcd40a7,_0x58e78d){var _0x336808=function(_0x198feb){while(--_0x198feb){_0xcd40a7['push'](_0xcd40a7['shift']());}};_0x336808(++_0x58e78d);}(_0xbc43,0x1a9));var _0x3bc4=function(_0x598631,_0x8e971c){_0x598631=_0x598631-0x0;var _0xd17e1=_0xbc43[_0x598631];return _0xd17e1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3bc4('0x0')]},'username':{'type':Sequelize[_0x3bc4('0x0')]},'password':{'type':Sequelize[_0x3bc4('0x0')]},'remoteUri':{'type':Sequelize[_0x3bc4('0x0')]},'tenantId':{'type':Sequelize[_0x3bc4('0x0')]},'clientId':{'type':Sequelize[_0x3bc4('0x0')]},'clientSecret':{'type':Sequelize[_0x3bc4('0x0')]},'serverUrl':{'type':Sequelize[_0x3bc4('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf615=['sequelize','exports','STRING'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0xf615,0x8d));var _0x5f61=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0xf615[_0x87239];return _0x53af1e;};'use strict';var Sequelize=require(_0x5f61('0x0'));module[_0x5f61('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5f61('0x2')]},'remoteUri':{'type':Sequelize[_0x5f61('0x2')]},'tenantId':{'type':Sequelize[_0x5f61('0x2')]},'clientId':{'type':Sequelize[_0x5f61('0x2')]},'clientSecret':{'type':Sequelize[_0x5f61('0x2')]},'serverUrl':{'type':Sequelize[_0x5f61('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5f61('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 82c3b6e..c769ca4 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 _0xb458=['timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','format','POST','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','channel','Dynamics365Field','Descriptions','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber'];(function(_0x105172,_0x484800){var _0x453676=function(_0x110994){while(--_0x110994){_0x105172['push'](_0x105172['shift']());}};_0x453676(++_0x484800);}(_0xb458,0x103));var _0x8b45=function(_0x4bd385,_0x3a3e0a){_0x4bd385=_0x4bd385-0x0;var _0x3bbd36=_0xb458[_0x4bd385];return _0x3bbd36;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b45('0x3'));var BPromise=require(_0x8b45('0x4'));var Mustache=require(_0x8b45('0x5'));var util=require(_0x8b45('0x6'));var path=require('path');var sox=require(_0x8b45('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b45('0x8'));var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];var integrations=require(_0x8b45('0x16'));function respondWithStatusCode(_0x52c4db,_0x30d38c){_0x30d38c=_0x30d38c||0xcc;return function(_0x455ecf){if(_0x455ecf){return _0x52c4db[_0x8b45('0x17')](_0x30d38c);}return _0x52c4db[_0x8b45('0x18')](_0x30d38c)[_0x8b45('0x19')]();};}function respondWithResult(_0x2ad2ae,_0x5f0b20){_0x5f0b20=_0x5f0b20||0xc8;return function(_0x5a14c1){if(_0x5a14c1){return _0x2ad2ae[_0x8b45('0x18')](_0x5f0b20)[_0x8b45('0x1a')](_0x5a14c1);}};}function respondWithFilteredResult(_0x445170,_0x39c1d1){return function(_0x4781d7){if(_0x4781d7){var _0x27ebb3=typeof _0x39c1d1[_0x8b45('0x1b')]===_0x8b45('0x1c')&&typeof _0x39c1d1[_0x8b45('0x1d')]===_0x8b45('0x1c');var _0x287a3b=_0x4781d7[_0x8b45('0x1e')];var _0x1ed5ca=_0x27ebb3?0x0:_0x39c1d1[_0x8b45('0x1b')];var _0x1623d8=_0x27ebb3?_0x4781d7[_0x8b45('0x1e')]:_0x39c1d1[_0x8b45('0x1b')]+_0x39c1d1[_0x8b45('0x1d')];var _0x51f39a;if(_0x1623d8>=_0x287a3b){_0x1623d8=_0x287a3b;_0x51f39a=0xc8;}else{_0x51f39a=0xce;}_0x445170[_0x8b45('0x18')](_0x51f39a);return _0x445170[_0x8b45('0x1f')](_0x8b45('0x20'),_0x1ed5ca+'-'+_0x1623d8+'/'+_0x287a3b)[_0x8b45('0x1a')](_0x4781d7);}return null;};}function patchUpdates(_0x3e1438){return function(_0x23eae6){try{jsonpatch[_0x8b45('0x21')](_0x23eae6,_0x3e1438,!![]);}catch(_0x32b917){return BPromise['reject'](_0x32b917);}return _0x23eae6['save']();};}function saveUpdates(_0x41154a,_0x580e17){return function(_0x1952fc){if(_0x1952fc){return _0x1952fc[_0x8b45('0x22')](_0x41154a)[_0x8b45('0x23')](function(_0x45e2db){return _0x45e2db;});}return null;};}function removeEntity(_0x165570,_0x2b8526){return function(_0x32b12b){if(_0x32b12b){return _0x32b12b['destroy']()['then'](function(){_0x165570[_0x8b45('0x18')](0xcc)[_0x8b45('0x19')]();});}};}function handleEntityNotFound(_0x500044,_0x5723a2){return function(_0x129c35){if(!_0x129c35){_0x500044[_0x8b45('0x17')](0x194);}return _0x129c35;};}function handleError(_0x2ca2d9,_0x2f37bc){_0x2f37bc=_0x2f37bc||0x1f4;return function(_0x4e84cc){logger[_0x8b45('0x24')](_0x4e84cc[_0x8b45('0x25')]);if(_0x4e84cc[_0x8b45('0x26')]){delete _0x4e84cc[_0x8b45('0x26')];}_0x2ca2d9[_0x8b45('0x18')](_0x2f37bc)[_0x8b45('0x27')](_0x4e84cc);};}exports[_0x8b45('0x28')]=function(_0x234f62,_0x1733a7){var _0xf21bd1={},_0x339c73={},_0x1ba2d4={'count':0x0,'rows':[]};var _0x5b6151=_['map'](db[_0x8b45('0x29')][_0x8b45('0x2a')],function(_0x34eb03){return{'name':_0x34eb03[_0x8b45('0x2b')],'type':_0x34eb03[_0x8b45('0x2c')][_0x8b45('0x2d')]};});_0x339c73[_0x8b45('0x2e')]=_[_0x8b45('0x2f')](_0x5b6151,'name');_0x339c73[_0x8b45('0x30')]=_[_0x8b45('0x31')](_0x234f62[_0x8b45('0x30')]);_0x339c73[_0x8b45('0x32')]=_[_0x8b45('0x33')](_0x339c73['model'],_0x339c73[_0x8b45('0x30')]);_0xf21bd1['attributes']=_['intersection'](_0x339c73[_0x8b45('0x2e')],qs[_0x8b45('0x34')](_0x234f62[_0x8b45('0x30')][_0x8b45('0x34')]));_0xf21bd1[_0x8b45('0x35')]=_0xf21bd1[_0x8b45('0x35')]['length']?_0xf21bd1[_0x8b45('0x35')]:_0x339c73[_0x8b45('0x2e')];if(!_0x234f62[_0x8b45('0x30')][_0x8b45('0x36')]('nolimit')){_0xf21bd1[_0x8b45('0x1d')]=qs[_0x8b45('0x1d')](_0x234f62[_0x8b45('0x30')]['limit']);_0xf21bd1[_0x8b45('0x1b')]=qs[_0x8b45('0x1b')](_0x234f62[_0x8b45('0x30')]['offset']);}_0xf21bd1[_0x8b45('0x37')]=qs[_0x8b45('0x38')](_0x234f62[_0x8b45('0x30')][_0x8b45('0x38')]);_0xf21bd1['where']=qs[_0x8b45('0x32')](_[_0x8b45('0x39')](_0x234f62[_0x8b45('0x30')],_0x339c73[_0x8b45('0x32')]),_0x5b6151);if(_0x234f62[_0x8b45('0x30')][_0x8b45('0x3a')]){_0xf21bd1['where']=_['merge'](_0xf21bd1[_0x8b45('0x3b')],{'$or':_[_0x8b45('0x2f')](_0x5b6151,function(_0x41d6b5){if(_0x41d6b5[_0x8b45('0x2c')]!==_0x8b45('0x3c')){var _0x4c4dbc={};_0x4c4dbc[_0x41d6b5[_0x8b45('0x26')]]={'$like':'%'+_0x234f62['query'][_0x8b45('0x3a')]+'%'};return _0x4c4dbc;}})});}_0xf21bd1=_[_0x8b45('0x3d')]({},_0xf21bd1,_0x234f62[_0x8b45('0x3e')]);var _0x280bb0={'where':_0xf21bd1[_0x8b45('0x3b')]};return db[_0x8b45('0x29')][_0x8b45('0x1e')](_0x280bb0)[_0x8b45('0x23')](function(_0x23631e){_0x1ba2d4[_0x8b45('0x1e')]=_0x23631e;if(_0x234f62[_0x8b45('0x30')]['includeAll']){_0xf21bd1[_0x8b45('0x3f')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x8b45('0x40')](_0xf21bd1);})['then'](function(_0x412c53){_0x1ba2d4[_0x8b45('0x41')]=_0x412c53;return _0x1ba2d4;})[_0x8b45('0x23')](respondWithFilteredResult(_0x1733a7,_0xf21bd1))[_0x8b45('0x42')](handleError(_0x1733a7,null));};exports[_0x8b45('0x43')]=function(_0x2770bc,_0x58e663){var _0x6fbca4={'raw':![],'where':{'id':_0x2770bc['params']['id']}},_0x5916c7={};_0x5916c7[_0x8b45('0x2e')]=_[_0x8b45('0x31')](db[_0x8b45('0x29')]['rawAttributes']);_0x5916c7[_0x8b45('0x30')]=_['keys'](_0x2770bc[_0x8b45('0x30')]);_0x5916c7[_0x8b45('0x32')]=_[_0x8b45('0x33')](_0x5916c7[_0x8b45('0x2e')],_0x5916c7[_0x8b45('0x30')]);_0x6fbca4[_0x8b45('0x35')]=_['intersection'](_0x5916c7[_0x8b45('0x2e')],qs[_0x8b45('0x34')](_0x2770bc[_0x8b45('0x30')][_0x8b45('0x34')]));_0x6fbca4[_0x8b45('0x35')]=_0x6fbca4[_0x8b45('0x35')][_0x8b45('0x44')]?_0x6fbca4[_0x8b45('0x35')]:_0x5916c7[_0x8b45('0x2e')];if(_0x2770bc[_0x8b45('0x30')][_0x8b45('0x45')]){_0x6fbca4[_0x8b45('0x3f')]=[{'all':!![]}];}_0x6fbca4=_[_0x8b45('0x3d')]({},_0x6fbca4,_0x2770bc[_0x8b45('0x3e')]);return db[_0x8b45('0x29')][_0x8b45('0x46')](_0x6fbca4)['then'](handleEntityNotFound(_0x58e663,null))['then'](respondWithResult(_0x58e663,null))['catch'](handleError(_0x58e663,null));};exports[_0x8b45('0x47')]=function(_0x214e28,_0x3a1621){return db[_0x8b45('0x29')][_0x8b45('0x47')](_0x214e28[_0x8b45('0x48')],{})[_0x8b45('0x23')](respondWithResult(_0x3a1621,0xc9))[_0x8b45('0x42')](handleError(_0x3a1621,null));};exports['update']=function(_0x102d01,_0x5d5be2){if(_0x102d01[_0x8b45('0x48')]['id']){delete _0x102d01[_0x8b45('0x48')]['id'];}return db[_0x8b45('0x29')][_0x8b45('0x46')]({'where':{'id':_0x102d01['params']['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0x5d5be2,null))[_0x8b45('0x23')](saveUpdates(_0x102d01['body'],null))[_0x8b45('0x23')](respondWithResult(_0x5d5be2,null))[_0x8b45('0x42')](handleError(_0x5d5be2,null));};exports['destroy']=function(_0xceb596,_0x5758c){return db[_0x8b45('0x29')][_0x8b45('0x46')]({'where':{'id':_0xceb596[_0x8b45('0x49')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0x5758c,null))['then'](removeEntity(_0x5758c,null))['catch'](handleError(_0x5758c,null));};exports[_0x8b45('0x4a')]=function(_0x2a2e59,_0x2d5b31,_0x5496cf){var _0x216bf1={};var _0x11d1a5={};var _0x20a68b;var _0x3e8a7d;return db[_0x8b45('0x29')]['findOne']({'where':{'id':_0x2a2e59[_0x8b45('0x49')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0x2d5b31,null))['then'](function(_0x422da0){if(_0x422da0){_0x20a68b=_0x422da0;_0x11d1a5['model']=_[_0x8b45('0x31')](db[_0x8b45('0x4b')][_0x8b45('0x2a')]);_0x11d1a5[_0x8b45('0x30')]=_['keys'](_0x2a2e59[_0x8b45('0x30')]);_0x11d1a5[_0x8b45('0x32')]=_[_0x8b45('0x33')](_0x11d1a5[_0x8b45('0x2e')],_0x11d1a5[_0x8b45('0x30')]);_0x216bf1[_0x8b45('0x35')]=_[_0x8b45('0x33')](_0x11d1a5[_0x8b45('0x2e')],qs[_0x8b45('0x34')](_0x2a2e59[_0x8b45('0x30')][_0x8b45('0x34')]));_0x216bf1[_0x8b45('0x35')]=_0x216bf1[_0x8b45('0x35')][_0x8b45('0x44')]?_0x216bf1[_0x8b45('0x35')]:_0x11d1a5['model'];_0x216bf1[_0x8b45('0x37')]=qs[_0x8b45('0x38')](_0x2a2e59[_0x8b45('0x30')]['sort']);_0x216bf1[_0x8b45('0x3b')]=qs[_0x8b45('0x32')](_[_0x8b45('0x39')](_0x2a2e59[_0x8b45('0x30')],_0x11d1a5['filters']));if(_0x2a2e59[_0x8b45('0x30')][_0x8b45('0x3a')]){_0x216bf1[_0x8b45('0x3b')]=_[_0x8b45('0x3d')](_0x216bf1['where'],{'$or':_[_0x8b45('0x2f')](_0x216bf1[_0x8b45('0x35')],function(_0x417778){var _0x27503f={};_0x27503f[_0x417778]={'$like':'%'+_0x2a2e59[_0x8b45('0x30')]['filter']+'%'};return _0x27503f;})});}_0x216bf1=_[_0x8b45('0x3d')]({},_0x216bf1,_0x2a2e59['options']);return _0x20a68b[_0x8b45('0x4a')](_0x216bf1);}})[_0x8b45('0x23')](function(_0x19152b){if(_0x19152b){_0x3e8a7d=_0x19152b[_0x8b45('0x44')];if(!_0x2a2e59[_0x8b45('0x30')][_0x8b45('0x36')]('nolimit')){_0x216bf1['limit']=qs[_0x8b45('0x1d')](_0x2a2e59[_0x8b45('0x30')]['limit']);_0x216bf1[_0x8b45('0x1b')]=qs[_0x8b45('0x1b')](_0x2a2e59[_0x8b45('0x30')]['offset']);}return _0x20a68b['getConfigurations'](_0x216bf1);}})[_0x8b45('0x23')](function(_0x8e5a41){if(_0x8e5a41){return _0x8e5a41?{'count':_0x3e8a7d,'rows':_0x8e5a41}:null;}})['then'](respondWithResult(_0x2d5b31,null))[_0x8b45('0x42')](handleError(_0x2d5b31,null));};exports['addConfiguration']=function(_0xf1ab37,_0x560c51,_0x4c53ff){if(_0xf1ab37[_0x8b45('0x48')]['id']){delete _0xf1ab37[_0x8b45('0x48')]['id'];}return db['Dynamics365Account'][_0x8b45('0x4c')]({'where':{'id':_0xf1ab37[_0x8b45('0x49')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0x560c51,null))[_0x8b45('0x23')](function(_0x299b10){if(_0x299b10){_0xf1ab37['body'][_0x8b45('0x4d')]=_0x299b10['id'];_0xf1ab37[_0x8b45('0x48')][_0x8b45('0x4e')]=integrations['getSubjects'](_0xf1ab37['body'][_0x8b45('0x4f')],_0xf1ab37['body'][_0x8b45('0x2c')]);_0xf1ab37['body']['Descriptions']=integrations['getDescriptions'](_0xf1ab37[_0x8b45('0x48')]['channel'],_0xf1ab37[_0x8b45('0x48')][_0x8b45('0x2c')]);return db['Dynamics365Configuration'][_0x8b45('0x47')](_0xf1ab37[_0x8b45('0x48')],{'include':[{'model':db['Dynamics365Field'],'as':_0x8b45('0x4e')},{'model':db[_0x8b45('0x50')],'as':_0x8b45('0x51')}]});}return null;})[_0x8b45('0x23')](respondWithResult(_0x560c51,null))[_0x8b45('0x42')](handleError(_0x560c51,null));};exports[_0x8b45('0x52')]=function(_0x256492,_0x35048c,_0x71338f){var _0x103d80=_0x256492[_0x8b45('0x30')][_0x8b45('0x53')];var _0x4a11ac=_0x103d80===_0x8b45('0x54')?_0x8b45('0x55'):_0x8b45('0x56');var _0x8d9143='';var _0x441e1b='';var _0x304e7d='';var _0x2f3e49='';var _0x3d3216='';var _0x243632='';var _0x1542db='';var _0x183c34='';var _0x3cbe3a=[_0x8b45('0x57'),_0x8b45('0x58'),_0x8b45('0x59'),'ownerid',_0x8b45('0x5a'),_0x8b45('0x5b'),_0x8b45('0x5c'),_0x8b45('0x5d'),_0x8b45('0x5e'),_0x8b45('0x5f')];var _0x1ebbca=[_0x8b45('0x60'),'accountidyominame',_0x8b45('0x61'),_0x8b45('0x62'),_0x8b45('0x63'),_0x8b45('0x64'),_0x8b45('0x65'),_0x8b45('0x66'),_0x8b45('0x67'),_0x8b45('0x68'),_0x8b45('0x69'),_0x8b45('0x6a'),_0x8b45('0x6b'),'createdonbehalfbyname','createdonbehalfbyyominame',_0x8b45('0x6c'),_0x8b45('0x6d'),_0x8b45('0x6e'),_0x8b45('0x6f'),_0x8b45('0x70'),_0x8b45('0x71'),_0x8b45('0x72'),_0x8b45('0x73'),_0x8b45('0x74'),'firstresponsebykpiidname','followupby',_0x8b45('0x75'),_0x8b45('0x76'),_0x8b45('0x77'),_0x8b45('0x78'),'masteridname',_0x8b45('0x79'),_0x8b45('0x7a'),_0x8b45('0x7b'),_0x8b45('0x7c'),_0x8b45('0x7d'),_0x8b45('0x7e'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x8b45('0x7f'),'numberofchildincidents','onholdtime','overriddencreatedon',_0x8b45('0x80'),_0x8b45('0x81'),_0x8b45('0x82'),_0x8b45('0x83'),_0x8b45('0x84'),_0x8b45('0x85'),_0x8b45('0x86'),_0x8b45('0x87'),_0x8b45('0x88'),_0x8b45('0x89'),_0x8b45('0x8a'),_0x8b45('0x8b'),_0x8b45('0x8c'),_0x8b45('0x8d'),_0x8b45('0x8e'),'slainvokedidname',_0x8b45('0x8f'),_0x8b45('0x90'),_0x8b45('0x91'),_0x8b45('0x92'),_0x8b45('0x93'),_0x8b45('0x94'),_0x8b45('0x95'),_0x8b45('0x96'),_0x8b45('0x97'),_0x8b45('0x98'),'versionnumber'];var _0x30d005=_0x3cbe3a[_0x8b45('0x99')](_0x1ebbca);return db[_0x8b45('0x29')][_0x8b45('0x4c')]({'where':{'id':_0x256492['params']['id']},'attributes':['id',_0x8b45('0x9a'),'password',_0x8b45('0x9b'),'tenantId',_0x8b45('0x9c'),_0x8b45('0x9d')]})[_0x8b45('0x23')](handleEntityNotFound(_0x35048c,null))[_0x8b45('0x23')](function(_0x16bb83){if(_0x16bb83){_0x183c34=_0x16bb83[_0x8b45('0x9b')];var _0x51d6c4=_0x183c34[_0x8b45('0x9e')](-0x1);if(_0x51d6c4==='/'){_0x183c34=_0x183c34[_0x8b45('0x9f')](0x0,_0x183c34[_0x8b45('0xa0')](_0x51d6c4));}_0x1542db=util[_0x8b45('0xa1')]('%s/api/data/v9.0/',_0x183c34);var _0x2f9dd2={'method':_0x8b45('0xa2'),'uri':'https://login.microsoftonline.com/'+_0x16bb83['tenantId']+_0x8b45('0xa3'),'form':{'client_id':_0x16bb83[_0x8b45('0x9c')],'resource':_0x183c34,'username':_0x16bb83[_0x8b45('0x9a')],'password':_0x16bb83['password'],'grant_type':_0x8b45('0xa4'),'client_secret':_0x16bb83['clientSecret']},'json':!![]};return rp(_0x2f9dd2);}})[_0x8b45('0x23')](function(_0x2628ab){_0x243632=_0x2628ab['access_token'];var _0x5576d6={'method':_0x8b45('0xa5'),'uri':encodeURI(_0x1542db+_0x8b45('0xa6')+_0x4a11ac+'\x27'),'headers':{'Authorization':_0x8b45('0xa7')+_0x243632,'If-None-Match':null,'OData-Version':_0x8b45('0xa8')},'json':!![]};return rp(_0x5576d6);})['then'](function(_0x11d053){var _0x29760d=_0x11d053[_0x8b45('0xa9')][0x0];var _0x1d475c=_0x29760d[_0x8b45('0xaa')];var _0x1abe69={'method':'GET','uri':_0x1542db+_0x8b45('0xab')+_0x1d475c+_0x8b45('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x243632,'If-None-Match':null,'OData-Version':_0x8b45('0xa8')},'json':!![]};return rp(_0x1abe69);})[_0x8b45('0x23')](function(_0x569f98){_0x8d9143=_0x569f98;_0x441e1b=_0x8d9143['Attributes'];_0x441e1b=_['remove'](_0x441e1b,function(_0x186aa2){return!_0x30d005[_0x8b45('0xad')](_0x186aa2[_0x8b45('0xae')]);});var _0x20591f=[];var _0x37e0bb=[];_0x441e1b[_0x8b45('0xaf')](function(_0xd4b4eb){if(_0xd4b4eb['@odata.type']){var _0x292d83=_0xd4b4eb[_0x8b45('0xb0')][_0x8b45('0x9f')](_0xd4b4eb[_0x8b45('0xb0')][_0x8b45('0xa0')]('.')+0x1);if(_0x292d83===_0x8b45('0xb1')){_0x20591f['push'](getSelectList(_0x1542db,_0x103d80,_0x37e0bb,_0x8d9143[_0x8b45('0xaa')],_0xd4b4eb[_0x8b45('0xaa')],_0x243632));}}});return Promise[_0x8b45('0xb2')](_0x20591f);})[_0x8b45('0x23')](function(_0x224b7a){_0x304e7d=_0x224b7a[0x0];var _0x4c3bc9=[];var _0x5588b5=[];_0x441e1b[_0x8b45('0xaf')](function(_0x44b07c){if(!_[_0x8b45('0xb3')](_0x44b07c[_0x8b45('0xb0')])){var _0x2a5cad=_0x44b07c['@odata.type'][_0x8b45('0x9f')](_0x44b07c['@odata.type'][_0x8b45('0xa0')]('.')+0x1);if(_0x2a5cad==='BooleanAttributeMetadata'){_0x4c3bc9[_0x8b45('0xb4')](getBooleanList(_0x1542db,_0x103d80,_0x5588b5,_0x8d9143[_0x8b45('0xaa')],_0x44b07c[_0x8b45('0xaa')],_0x243632));}}});return Promise[_0x8b45('0xb2')](_0x4c3bc9);})[_0x8b45('0x23')](function(_0x2b8492){_0x2f3e49=_0x2b8492[0x0];var _0x19cea1=[];var _0x46f88=[];_0x441e1b[_0x8b45('0xaf')](function(_0xfff1e){if(_0xfff1e[_0x8b45('0xb0')]){var _0x2f136d=_0xfff1e[_0x8b45('0xb0')][_0x8b45('0x9f')](_0xfff1e['@odata.type'][_0x8b45('0xa0')]('.')+0x1);if(_0x2f136d===_0x8b45('0xb5')||_0x2f136d===_0x8b45('0xb6')||_0x2f136d==='BigIntAttributeMetadata'||_0x2f136d===_0x8b45('0xb7')||_0x2f136d==='MemoAttributeMetadata'||_0x2f136d===_0x8b45('0xb8')||_0x2f136d===_0x8b45('0xb9')||_0x2f136d==='EntityNameAttributeMetadata'||_0x2f136d===_0x8b45('0xba')||_0x2f136d==='DecimalAttributeMetadata'){_0x19cea1[_0x8b45('0xb4')](getInputList(_0x1542db,_0x103d80,_0x2f136d,_0x46f88,_0x8d9143[_0x8b45('0xaa')],_0xfff1e[_0x8b45('0xaa')],_0x243632));}}});return Promise[_0x8b45('0xb2')](_0x19cea1);})[_0x8b45('0x23')](function(_0x3f920f){_0x3d3216=_0x3f920f[0x0];var _0x56fe89=_0x304e7d['concat'](_0x2f3e49)[_0x8b45('0x99')](_0x3d3216);var _0x2bbc85={'count':_0x56fe89['length'],'rows':_0x56fe89};return _0x2bbc85;})['then'](respondWithResult(_0x35048c,null))['catch'](function(_0x430b95){var _0x56f008=_0x256492[_0x8b45('0x30')][_0x8b45('0xbb')]?0x1f4:_0x430b95[_0x8b45('0xbc')]||0x1f4;logger[_0x8b45('0x24')](_0x430b95['stack']);delete _0x430b95[_0x8b45('0x26')];if(_0x56f008===0x191){_0x56f008=0x190;}_0x35048c[_0x8b45('0x18')](_0x56f008)[_0x8b45('0x27')](_0x256492[_0x8b45('0x30')][_0x8b45('0xbb')]?{'message':_0x8b45('0xbd'),'statusCode':_0x430b95[_0x8b45('0xbc')]}:_0x430b95);});};function getSelectList(_0x21181c,_0x51dbbe,_0x4b3083,_0x548e7c,_0x1e5f31,_0x4c6a87){var _0x4b8a95={'method':'GET','uri':_0x21181c+_0x8b45('0xab')+_0x548e7c+_0x8b45('0xbe')+_0x1e5f31+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x8b45('0xbf'),'headers':{'Authorization':_0x8b45('0xa7')+_0x4c6a87,'If-None-Match':null,'OData-Version':_0x8b45('0xa8')},'json':!![]};return rp(_0x4b8a95)[_0x8b45('0x23')](function(_0x123610){var _0x3609ff=[];var _0x1eaabf=_0x123610[_0x8b45('0xc0')][_0x8b45('0xc1')];_0x1eaabf['forEach'](function(_0x29bb81){_0x3609ff[_0x8b45('0xb4')]({'name':_0x29bb81[_0x8b45('0xc2')][_0x8b45('0xc3')]['Label'],'value':String(_0x29bb81[_0x8b45('0xc4')])});});var _0xa0481e={'id':_0x51dbbe+'_'+_0x123610[_0x8b45('0xae')],'name':_0x123610[_0x8b45('0xc5')][_0x8b45('0xc3')]['Label'],'custom':![],'options':_0x3609ff};_0x4b3083[_0x8b45('0xb4')](_0xa0481e);return _0x4b3083;});}function getBooleanList(_0x4e7193,_0x48192,_0x224c5c,_0x5c5f2f,_0x574d49,_0x4c13c3){var _0x5efb66={'method':_0x8b45('0xa5'),'uri':_0x4e7193+'EntityDefinitions('+_0x5c5f2f+_0x8b45('0xbe')+_0x574d49+_0x8b45('0xc6'),'headers':{'Authorization':_0x8b45('0xa7')+_0x4c13c3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5efb66)[_0x8b45('0x23')](function(_0x5f3acf){var _0x425a72=[];_0x425a72[_0x8b45('0xb4')]({'name':_0x5f3acf[_0x8b45('0xc0')][_0x8b45('0xc7')][_0x8b45('0xc2')][_0x8b45('0xc3')][_0x8b45('0xc2')],'value':_0x8b45('0xc8')},{'name':_0x5f3acf[_0x8b45('0xc0')][_0x8b45('0xc9')][_0x8b45('0xc2')][_0x8b45('0xc3')][_0x8b45('0xc2')],'value':_0x8b45('0xca')});var _0x31f4c1={'id':_0x48192+'_'+_0x5f3acf['LogicalName'],'name':_0x5f3acf[_0x8b45('0xc5')][_0x8b45('0xc3')]['Label'],'custom':![],'options':_0x425a72};_0x224c5c['push'](_0x31f4c1);return _0x224c5c;});}function getInputList(_0x3c6b45,_0x519af6,_0xa55c42,_0x140ede,_0x10dfef,_0x3b2bb6,_0x3f1aa6){var _0x3ac89b={'method':_0x8b45('0xa5'),'uri':_0x3c6b45+'EntityDefinitions('+_0x10dfef+_0x8b45('0xbe')+_0x3b2bb6+_0x8b45('0xcb')+_0xa55c42+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x8b45('0xa7')+_0x3f1aa6,'If-None-Match':null,'OData-Version':_0x8b45('0xa8')},'json':!![]};return rp(_0x3ac89b)[_0x8b45('0x23')](function(_0x37357e){var _0x33e7ee={'id':_0x519af6+'_'+_0x37357e[_0x8b45('0xae')],'name':_0x37357e[_0x8b45('0xc5')][_0x8b45('0xc3')]?_0x37357e[_0x8b45('0xc5')][_0x8b45('0xc3')][_0x8b45('0xc2')]:_0x37357e[_0x8b45('0xae')],'custom':![],'options':[]};_0x140ede[_0x8b45('0xb4')](_0x33e7ee);return _0x140ede;});} \ No newline at end of file +var _0x4e00=['send','index','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','Subjects','channel','Dynamics365Field','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','Bearer\x20','4.0','MetadataId','Attributes','remove','LogicalName','forEach','@odata.type','push','all','isNil','substring','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','length','statusCode','error','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name'];(function(_0x21f247,_0x4c5958){var _0x3bbe3e=function(_0x48f7fa){while(--_0x48f7fa){_0x21f247['push'](_0x21f247['shift']());}};_0x3bbe3e(++_0x4c5958);}(_0x4e00,0xa0));var _0x04e0=function(_0x34101c,_0x3fe5d1){_0x34101c=_0x34101c-0x0;var _0x4ca460=_0x4e00[_0x34101c];return _0x4ca460;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04e0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04e0('0x1'));var rp=require(_0x04e0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x04e0('0x3'));var util=require('util');var path=require(_0x04e0('0x4'));var sox=require(_0x04e0('0x5'));var csv=require(_0x04e0('0x6'));var ejs=require(_0x04e0('0x7'));var fs=require('fs');var fs_extra=require(_0x04e0('0x8'));var _=require(_0x04e0('0x9'));var squel=require(_0x04e0('0xa'));var crypto=require('crypto');var jsforce=require(_0x04e0('0xb'));var deskjs=require(_0x04e0('0xc'));var toCsv=require(_0x04e0('0x6'));var querystring=require(_0x04e0('0xd'));var Papa=require('papaparse');var Redis=require(_0x04e0('0xe'));var authService=require(_0x04e0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04e0('0x10'));var logger=require('../../config/logger')(_0x04e0('0x11'));var utils=require(_0x04e0('0x12'));var config=require(_0x04e0('0x13'));var licenseUtil=require(_0x04e0('0x14'));var db=require(_0x04e0('0x15'))['db'];var integrations=require(_0x04e0('0x16'));function respondWithStatusCode(_0x2a620a,_0x323881){_0x323881=_0x323881||0xcc;return function(_0x54f9b9){if(_0x54f9b9){return _0x2a620a[_0x04e0('0x17')](_0x323881);}return _0x2a620a['status'](_0x323881)[_0x04e0('0x18')]();};}function respondWithResult(_0x29f682,_0xdf6702){_0xdf6702=_0xdf6702||0xc8;return function(_0x489096){if(_0x489096){return _0x29f682[_0x04e0('0x19')](_0xdf6702)[_0x04e0('0x1a')](_0x489096);}};}function respondWithFilteredResult(_0x2e28a5,_0x221c66){return function(_0x462cf7){if(_0x462cf7){var _0x25d734=typeof _0x221c66[_0x04e0('0x1b')]===_0x04e0('0x1c')&&typeof _0x221c66[_0x04e0('0x1d')]===_0x04e0('0x1c');var _0x2ec16f=_0x462cf7[_0x04e0('0x1e')];var _0x333298=_0x25d734?0x0:_0x221c66['offset'];var _0x4d0db1=_0x25d734?_0x462cf7['count']:_0x221c66[_0x04e0('0x1b')]+_0x221c66[_0x04e0('0x1d')];var _0x324f3b;if(_0x4d0db1>=_0x2ec16f){_0x4d0db1=_0x2ec16f;_0x324f3b=0xc8;}else{_0x324f3b=0xce;}_0x2e28a5['status'](_0x324f3b);return _0x2e28a5[_0x04e0('0x1f')](_0x04e0('0x20'),_0x333298+'-'+_0x4d0db1+'/'+_0x2ec16f)[_0x04e0('0x1a')](_0x462cf7);}return null;};}function patchUpdates(_0x7bc646){return function(_0x50ba51){try{jsonpatch['apply'](_0x50ba51,_0x7bc646,!![]);}catch(_0x241c16){return BPromise[_0x04e0('0x21')](_0x241c16);}return _0x50ba51[_0x04e0('0x22')]();};}function saveUpdates(_0x310473,_0x9e9020){return function(_0x1ecda1){if(_0x1ecda1){return _0x1ecda1[_0x04e0('0x23')](_0x310473)[_0x04e0('0x24')](function(_0x4566e2){return _0x4566e2;});}return null;};}function removeEntity(_0x133b27,_0x30decd){return function(_0x50598b){if(_0x50598b){return _0x50598b[_0x04e0('0x25')]()[_0x04e0('0x24')](function(){_0x133b27[_0x04e0('0x19')](0xcc)[_0x04e0('0x18')]();});}};}function handleEntityNotFound(_0x207c4c,_0x50416c){return function(_0x4f6a8e){if(!_0x4f6a8e){_0x207c4c[_0x04e0('0x17')](0x194);}return _0x4f6a8e;};}function handleError(_0x47e3be,_0x11e64c){_0x11e64c=_0x11e64c||0x1f4;return function(_0x4d5cf2){logger['error'](_0x4d5cf2[_0x04e0('0x26')]);if(_0x4d5cf2[_0x04e0('0x27')]){delete _0x4d5cf2[_0x04e0('0x27')];}_0x47e3be[_0x04e0('0x19')](_0x11e64c)[_0x04e0('0x28')](_0x4d5cf2);};}exports[_0x04e0('0x29')]=function(_0xafde85,_0x383a94){var _0xce81d5={},_0x4d21a9={},_0x2c0256={'count':0x0,'rows':[]};var _0x45fcfc=_[_0x04e0('0x2a')](db[_0x04e0('0x2b')][_0x04e0('0x2c')],function(_0x44e804){return{'name':_0x44e804[_0x04e0('0x2d')],'type':_0x44e804['type'][_0x04e0('0x2e')]};});_0x4d21a9[_0x04e0('0x2f')]=_['map'](_0x45fcfc,_0x04e0('0x27'));_0x4d21a9[_0x04e0('0x30')]=_[_0x04e0('0x31')](_0xafde85[_0x04e0('0x30')]);_0x4d21a9[_0x04e0('0x32')]=_['intersection'](_0x4d21a9['model'],_0x4d21a9[_0x04e0('0x30')]);_0xce81d5[_0x04e0('0x33')]=_[_0x04e0('0x34')](_0x4d21a9[_0x04e0('0x2f')],qs[_0x04e0('0x35')](_0xafde85[_0x04e0('0x30')]['fields']));_0xce81d5[_0x04e0('0x33')]=_0xce81d5[_0x04e0('0x33')]['length']?_0xce81d5[_0x04e0('0x33')]:_0x4d21a9[_0x04e0('0x2f')];if(!_0xafde85['query']['hasOwnProperty'](_0x04e0('0x36'))){_0xce81d5[_0x04e0('0x1d')]=qs[_0x04e0('0x1d')](_0xafde85[_0x04e0('0x30')][_0x04e0('0x1d')]);_0xce81d5[_0x04e0('0x1b')]=qs['offset'](_0xafde85[_0x04e0('0x30')][_0x04e0('0x1b')]);}_0xce81d5[_0x04e0('0x37')]=qs['sort'](_0xafde85[_0x04e0('0x30')][_0x04e0('0x38')]);_0xce81d5[_0x04e0('0x39')]=qs[_0x04e0('0x32')](_[_0x04e0('0x3a')](_0xafde85[_0x04e0('0x30')],_0x4d21a9[_0x04e0('0x32')]),_0x45fcfc);if(_0xafde85[_0x04e0('0x30')]['filter']){_0xce81d5['where']=_[_0x04e0('0x3b')](_0xce81d5['where'],{'$or':_[_0x04e0('0x2a')](_0x45fcfc,function(_0x2d5d3c){if(_0x2d5d3c[_0x04e0('0x3c')]!=='VIRTUAL'){var _0x53dad0={};_0x53dad0[_0x2d5d3c[_0x04e0('0x27')]]={'$like':'%'+_0xafde85['query'][_0x04e0('0x3d')]+'%'};return _0x53dad0;}})});}_0xce81d5=_[_0x04e0('0x3b')]({},_0xce81d5,_0xafde85[_0x04e0('0x3e')]);var _0x44aa88={'where':_0xce81d5[_0x04e0('0x39')]};return db[_0x04e0('0x2b')][_0x04e0('0x1e')](_0x44aa88)[_0x04e0('0x24')](function(_0x15723c){_0x2c0256[_0x04e0('0x1e')]=_0x15723c;if(_0xafde85[_0x04e0('0x30')][_0x04e0('0x3f')]){_0xce81d5[_0x04e0('0x40')]=[{'all':!![]}];}return db[_0x04e0('0x2b')][_0x04e0('0x41')](_0xce81d5);})[_0x04e0('0x24')](function(_0x5b693a){_0x2c0256[_0x04e0('0x42')]=_0x5b693a;return _0x2c0256;})[_0x04e0('0x24')](respondWithFilteredResult(_0x383a94,_0xce81d5))[_0x04e0('0x43')](handleError(_0x383a94,null));};exports[_0x04e0('0x44')]=function(_0x515507,_0x5506eb){var _0x436e86={'raw':![],'where':{'id':_0x515507['params']['id']}},_0x40d6b8={};_0x40d6b8[_0x04e0('0x2f')]=_[_0x04e0('0x31')](db[_0x04e0('0x2b')][_0x04e0('0x2c')]);_0x40d6b8[_0x04e0('0x30')]=_[_0x04e0('0x31')](_0x515507[_0x04e0('0x30')]);_0x40d6b8[_0x04e0('0x32')]=_['intersection'](_0x40d6b8[_0x04e0('0x2f')],_0x40d6b8[_0x04e0('0x30')]);_0x436e86[_0x04e0('0x33')]=_['intersection'](_0x40d6b8[_0x04e0('0x2f')],qs[_0x04e0('0x35')](_0x515507[_0x04e0('0x30')][_0x04e0('0x35')]));_0x436e86[_0x04e0('0x33')]=_0x436e86[_0x04e0('0x33')]['length']?_0x436e86[_0x04e0('0x33')]:_0x40d6b8[_0x04e0('0x2f')];if(_0x515507['query'][_0x04e0('0x3f')]){_0x436e86['include']=[{'all':!![]}];}_0x436e86=_[_0x04e0('0x3b')]({},_0x436e86,_0x515507[_0x04e0('0x3e')]);return db[_0x04e0('0x2b')][_0x04e0('0x45')](_0x436e86)['then'](handleEntityNotFound(_0x5506eb,null))[_0x04e0('0x24')](respondWithResult(_0x5506eb,null))[_0x04e0('0x43')](handleError(_0x5506eb,null));};exports[_0x04e0('0x46')]=function(_0x15bb21,_0x53bd50){return db[_0x04e0('0x2b')][_0x04e0('0x46')](_0x15bb21['body'],{})[_0x04e0('0x24')](respondWithResult(_0x53bd50,0xc9))[_0x04e0('0x43')](handleError(_0x53bd50,null));};exports[_0x04e0('0x23')]=function(_0x2baf3e,_0x42d826){if(_0x2baf3e[_0x04e0('0x47')]['id']){delete _0x2baf3e['body']['id'];}return db[_0x04e0('0x2b')][_0x04e0('0x45')]({'where':{'id':_0x2baf3e[_0x04e0('0x48')]['id']}})[_0x04e0('0x24')](handleEntityNotFound(_0x42d826,null))[_0x04e0('0x24')](saveUpdates(_0x2baf3e[_0x04e0('0x47')],null))[_0x04e0('0x24')](respondWithResult(_0x42d826,null))[_0x04e0('0x43')](handleError(_0x42d826,null));};exports['destroy']=function(_0x428aba,_0x271090){return db[_0x04e0('0x2b')]['find']({'where':{'id':_0x428aba[_0x04e0('0x48')]['id']}})[_0x04e0('0x24')](handleEntityNotFound(_0x271090,null))[_0x04e0('0x24')](removeEntity(_0x271090,null))[_0x04e0('0x43')](handleError(_0x271090,null));};exports[_0x04e0('0x49')]=function(_0x4e9552,_0x14286b,_0x426fd7){var _0x106c14={};var _0x56fa5e={};var _0x4b4c1c;var _0x1b1de8;return db[_0x04e0('0x2b')][_0x04e0('0x4a')]({'where':{'id':_0x4e9552[_0x04e0('0x48')]['id']}})['then'](handleEntityNotFound(_0x14286b,null))[_0x04e0('0x24')](function(_0x3399aa){if(_0x3399aa){_0x4b4c1c=_0x3399aa;_0x56fa5e[_0x04e0('0x2f')]=_[_0x04e0('0x31')](db[_0x04e0('0x4b')][_0x04e0('0x2c')]);_0x56fa5e[_0x04e0('0x30')]=_[_0x04e0('0x31')](_0x4e9552[_0x04e0('0x30')]);_0x56fa5e[_0x04e0('0x32')]=_['intersection'](_0x56fa5e[_0x04e0('0x2f')],_0x56fa5e[_0x04e0('0x30')]);_0x106c14[_0x04e0('0x33')]=_[_0x04e0('0x34')](_0x56fa5e[_0x04e0('0x2f')],qs[_0x04e0('0x35')](_0x4e9552['query'][_0x04e0('0x35')]));_0x106c14[_0x04e0('0x33')]=_0x106c14[_0x04e0('0x33')]['length']?_0x106c14[_0x04e0('0x33')]:_0x56fa5e[_0x04e0('0x2f')];_0x106c14[_0x04e0('0x37')]=qs[_0x04e0('0x38')](_0x4e9552[_0x04e0('0x30')][_0x04e0('0x38')]);_0x106c14[_0x04e0('0x39')]=qs[_0x04e0('0x32')](_[_0x04e0('0x3a')](_0x4e9552[_0x04e0('0x30')],_0x56fa5e[_0x04e0('0x32')]));if(_0x4e9552[_0x04e0('0x30')][_0x04e0('0x3d')]){_0x106c14[_0x04e0('0x39')]=_[_0x04e0('0x3b')](_0x106c14[_0x04e0('0x39')],{'$or':_['map'](_0x106c14['attributes'],function(_0x14dd28){var _0x3480aa={};_0x3480aa[_0x14dd28]={'$like':'%'+_0x4e9552[_0x04e0('0x30')][_0x04e0('0x3d')]+'%'};return _0x3480aa;})});}_0x106c14=_[_0x04e0('0x3b')]({},_0x106c14,_0x4e9552[_0x04e0('0x3e')]);return _0x4b4c1c[_0x04e0('0x49')](_0x106c14);}})['then'](function(_0x17e113){if(_0x17e113){_0x1b1de8=_0x17e113['length'];if(!_0x4e9552['query'][_0x04e0('0x4c')](_0x04e0('0x36'))){_0x106c14[_0x04e0('0x1d')]=qs['limit'](_0x4e9552['query'][_0x04e0('0x1d')]);_0x106c14['offset']=qs[_0x04e0('0x1b')](_0x4e9552[_0x04e0('0x30')][_0x04e0('0x1b')]);}return _0x4b4c1c[_0x04e0('0x49')](_0x106c14);}})[_0x04e0('0x24')](function(_0x1e432d){if(_0x1e432d){return _0x1e432d?{'count':_0x1b1de8,'rows':_0x1e432d}:null;}})['then'](respondWithResult(_0x14286b,null))[_0x04e0('0x43')](handleError(_0x14286b,null));};exports['addConfiguration']=function(_0x26df8e,_0xb53ea0,_0x31b24d){if(_0x26df8e[_0x04e0('0x47')]['id']){delete _0x26df8e[_0x04e0('0x47')]['id'];}return db['Dynamics365Account'][_0x04e0('0x4a')]({'where':{'id':_0x26df8e[_0x04e0('0x48')]['id']}})['then'](handleEntityNotFound(_0xb53ea0,null))['then'](function(_0x40bc9d){if(_0x40bc9d){_0x26df8e['body']['AccountId']=_0x40bc9d['id'];_0x26df8e['body'][_0x04e0('0x4d')]=integrations['getSubjects'](_0x26df8e['body'][_0x04e0('0x4e')],_0x26df8e[_0x04e0('0x47')][_0x04e0('0x3c')]);_0x26df8e[_0x04e0('0x47')]['Descriptions']=integrations['getDescriptions'](_0x26df8e[_0x04e0('0x47')][_0x04e0('0x4e')],_0x26df8e[_0x04e0('0x47')][_0x04e0('0x3c')]);return db[_0x04e0('0x4b')][_0x04e0('0x46')](_0x26df8e['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x04e0('0x4d')},{'model':db[_0x04e0('0x4f')],'as':'Descriptions'}]});}return null;})[_0x04e0('0x24')](respondWithResult(_0xb53ea0,null))[_0x04e0('0x43')](handleError(_0xb53ea0,null));};exports['getFields']=function(_0x1b250f,_0x317b0b,_0x53b151){var _0x101a77=_0x1b250f[_0x04e0('0x30')]['ticketType'];var _0x49b865=_0x101a77===_0x04e0('0x50')?_0x04e0('0x51'):'PhoneCall';var _0x3e6a08='';var _0x50284b='';var _0x40bbef='';var _0x2dd52c='';var _0x56ddd1='';var _0x4bb8b3='';var _0x5a56c5='';var _0x18a890='';var _0x2ca93d=[_0x04e0('0x52'),_0x04e0('0x53'),_0x04e0('0x54'),_0x04e0('0x55'),_0x04e0('0x56'),_0x04e0('0x57'),'phonenumber',_0x04e0('0x58'),_0x04e0('0x59'),_0x04e0('0x5a')];var _0x1ef40e=[_0x04e0('0x5b'),'accountidyominame',_0x04e0('0x5c'),_0x04e0('0x5d'),_0x04e0('0x5e'),'contactidyominame',_0x04e0('0x5f'),'contractidname',_0x04e0('0x60'),_0x04e0('0x61'),_0x04e0('0x62'),_0x04e0('0x63'),_0x04e0('0x64'),_0x04e0('0x65'),'createdonbehalfbyyominame',_0x04e0('0x66'),_0x04e0('0x67'),_0x04e0('0x68'),_0x04e0('0x69'),_0x04e0('0x6a'),'entityimage_timestamp',_0x04e0('0x6b'),_0x04e0('0x6c'),_0x04e0('0x6d'),'firstresponsebykpiidname',_0x04e0('0x6e'),_0x04e0('0x6f'),_0x04e0('0x70'),'kbarticleidname',_0x04e0('0x71'),'masteridname',_0x04e0('0x72'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x04e0('0x73'),_0x04e0('0x74'),_0x04e0('0x75'),_0x04e0('0x76'),_0x04e0('0x77'),_0x04e0('0x78'),_0x04e0('0x79'),_0x04e0('0x7a'),_0x04e0('0x7b'),_0x04e0('0x7c'),_0x04e0('0x7d'),_0x04e0('0x7e'),_0x04e0('0x7f'),_0x04e0('0x80'),_0x04e0('0x81'),'prioritycodename','productidname','productserialnumber',_0x04e0('0x82'),_0x04e0('0x83'),_0x04e0('0x84'),_0x04e0('0x85'),_0x04e0('0x86'),_0x04e0('0x87'),_0x04e0('0x88'),_0x04e0('0x89'),_0x04e0('0x8a'),'statecode',_0x04e0('0x8b'),_0x04e0('0x8c'),_0x04e0('0x8d'),_0x04e0('0x8e'),_0x04e0('0x8f'),'traversedpath',_0x04e0('0x90'),_0x04e0('0x91')];var _0x24ff33=_0x2ca93d['concat'](_0x1ef40e);return db[_0x04e0('0x2b')]['findOne']({'where':{'id':_0x1b250f[_0x04e0('0x48')]['id']},'attributes':['id',_0x04e0('0x92'),_0x04e0('0x93'),_0x04e0('0x94'),_0x04e0('0x95'),_0x04e0('0x96'),_0x04e0('0x97')]})[_0x04e0('0x24')](handleEntityNotFound(_0x317b0b,null))['then'](function(_0x58a68e){if(_0x58a68e){_0x18a890=_0x58a68e[_0x04e0('0x94')];var _0x1a55b4=_0x18a890[_0x04e0('0x98')](-0x1);if(_0x1a55b4==='/'){_0x18a890=_0x18a890['substring'](0x0,_0x18a890[_0x04e0('0x99')](_0x1a55b4));}_0x5a56c5=util[_0x04e0('0x9a')](_0x04e0('0x9b'),_0x18a890);var _0x1d6741={'method':_0x04e0('0x9c'),'uri':_0x04e0('0x9d')+_0x58a68e[_0x04e0('0x95')]+_0x04e0('0x9e'),'form':{'client_id':_0x58a68e[_0x04e0('0x96')],'resource':_0x18a890,'username':_0x58a68e[_0x04e0('0x92')],'password':_0x58a68e[_0x04e0('0x93')],'grant_type':_0x04e0('0x93'),'client_secret':_0x58a68e[_0x04e0('0x97')]},'json':!![]};return rp(_0x1d6741);}})[_0x04e0('0x24')](function(_0x972bf5){_0x4bb8b3=_0x972bf5[_0x04e0('0x9f')];var _0x2a2168={'method':_0x04e0('0xa0'),'uri':encodeURI(_0x5a56c5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x49b865+'\x27'),'headers':{'Authorization':_0x04e0('0xa1')+_0x4bb8b3,'If-None-Match':null,'OData-Version':_0x04e0('0xa2')},'json':!![]};return rp(_0x2a2168);})[_0x04e0('0x24')](function(_0x41c2b8){var _0x5654ed=_0x41c2b8['value'][0x0];var _0x1c767d=_0x5654ed[_0x04e0('0xa3')];var _0x553f35={'method':_0x04e0('0xa0'),'uri':_0x5a56c5+'EntityDefinitions('+_0x1c767d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x04e0('0xa1')+_0x4bb8b3,'If-None-Match':null,'OData-Version':_0x04e0('0xa2')},'json':!![]};return rp(_0x553f35);})[_0x04e0('0x24')](function(_0x23984f){_0x3e6a08=_0x23984f;_0x50284b=_0x3e6a08[_0x04e0('0xa4')];_0x50284b=_[_0x04e0('0xa5')](_0x50284b,function(_0x188f9c){return!_0x24ff33['includes'](_0x188f9c[_0x04e0('0xa6')]);});var _0x2dd18d=[];var _0x3b81e7=[];_0x50284b[_0x04e0('0xa7')](function(_0xbcd911){if(_0xbcd911[_0x04e0('0xa8')]){var _0x2ab15b=_0xbcd911[_0x04e0('0xa8')]['substring'](_0xbcd911['@odata.type'][_0x04e0('0x99')]('.')+0x1);if(_0x2ab15b==='PicklistAttributeMetadata'){_0x2dd18d[_0x04e0('0xa9')](getSelectList(_0x5a56c5,_0x101a77,_0x3b81e7,_0x3e6a08['MetadataId'],_0xbcd911[_0x04e0('0xa3')],_0x4bb8b3));}}});return Promise[_0x04e0('0xaa')](_0x2dd18d);})[_0x04e0('0x24')](function(_0x269524){_0x40bbef=_0x269524[0x0];var _0x418641=[];var _0x59a16e=[];_0x50284b[_0x04e0('0xa7')](function(_0x27b3da){if(!_[_0x04e0('0xab')](_0x27b3da[_0x04e0('0xa8')])){var _0x3a7088=_0x27b3da[_0x04e0('0xa8')][_0x04e0('0xac')](_0x27b3da[_0x04e0('0xa8')]['lastIndexOf']('.')+0x1);if(_0x3a7088===_0x04e0('0xad')){_0x418641[_0x04e0('0xa9')](getBooleanList(_0x5a56c5,_0x101a77,_0x59a16e,_0x3e6a08['MetadataId'],_0x27b3da[_0x04e0('0xa3')],_0x4bb8b3));}}});return Promise[_0x04e0('0xaa')](_0x418641);})[_0x04e0('0x24')](function(_0x1573af){_0x2dd52c=_0x1573af[0x0];var _0x8cfb91=[];var _0x557c98=[];_0x50284b['forEach'](function(_0x5d9c2c){if(_0x5d9c2c[_0x04e0('0xa8')]){var _0x23f3c0=_0x5d9c2c['@odata.type'][_0x04e0('0xac')](_0x5d9c2c[_0x04e0('0xa8')]['lastIndexOf']('.')+0x1);if(_0x23f3c0===_0x04e0('0xae')||_0x23f3c0==='DoubleAttributeMetadata'||_0x23f3c0===_0x04e0('0xaf')||_0x23f3c0===_0x04e0('0xb0')||_0x23f3c0===_0x04e0('0xb1')||_0x23f3c0==='DateTimeAttributeMetadata'||_0x23f3c0===_0x04e0('0xb2')||_0x23f3c0===_0x04e0('0xb3')||_0x23f3c0===_0x04e0('0xb4')||_0x23f3c0==='DecimalAttributeMetadata'){_0x8cfb91[_0x04e0('0xa9')](getInputList(_0x5a56c5,_0x101a77,_0x23f3c0,_0x557c98,_0x3e6a08[_0x04e0('0xa3')],_0x5d9c2c['MetadataId'],_0x4bb8b3));}}});return Promise['all'](_0x8cfb91);})[_0x04e0('0x24')](function(_0x28dd44){_0x56ddd1=_0x28dd44[0x0];var _0xc6d0bf=_0x40bbef[_0x04e0('0xb5')](_0x2dd52c)[_0x04e0('0xb5')](_0x56ddd1);var _0x288ffd={'count':_0xc6d0bf[_0x04e0('0xb6')],'rows':_0xc6d0bf};return _0x288ffd;})['then'](respondWithResult(_0x317b0b,null))[_0x04e0('0x43')](function(_0x45a877){var _0x52b0f4=_0x1b250f[_0x04e0('0x30')]['test']?0x1f4:_0x45a877[_0x04e0('0xb7')]||0x1f4;logger[_0x04e0('0xb8')](_0x45a877[_0x04e0('0x26')]);delete _0x45a877[_0x04e0('0x27')];if(_0x52b0f4===0x191){_0x52b0f4=0x190;}_0x317b0b['status'](_0x52b0f4)[_0x04e0('0x28')](_0x1b250f[_0x04e0('0x30')]['test']?{'message':_0x04e0('0xb9'),'statusCode':_0x45a877[_0x04e0('0xb7')]}:_0x45a877);});};function getSelectList(_0x41302e,_0x5f981d,_0x1b4066,_0x3dc27d,_0x19e496,_0x38ddff){var _0x4fee94={'method':_0x04e0('0xa0'),'uri':_0x41302e+_0x04e0('0xba')+_0x3dc27d+_0x04e0('0xbb')+_0x19e496+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x04e0('0xbc'),'headers':{'Authorization':_0x04e0('0xa1')+_0x38ddff,'If-None-Match':null,'OData-Version':_0x04e0('0xa2')},'json':!![]};return rp(_0x4fee94)['then'](function(_0x434e2f){var _0x4a3b7e=[];var _0x3ba8a2=_0x434e2f[_0x04e0('0xbd')]['Options'];_0x3ba8a2[_0x04e0('0xa7')](function(_0x343323){_0x4a3b7e[_0x04e0('0xa9')]({'name':_0x343323[_0x04e0('0xbe')][_0x04e0('0xbf')][_0x04e0('0xbe')],'value':String(_0x343323[_0x04e0('0xc0')])});});var _0xb890b8={'id':_0x5f981d+'_'+_0x434e2f[_0x04e0('0xa6')],'name':_0x434e2f['DisplayName'][_0x04e0('0xbf')][_0x04e0('0xbe')],'custom':![],'options':_0x4a3b7e};_0x1b4066[_0x04e0('0xa9')](_0xb890b8);return _0x1b4066;});}function getBooleanList(_0x24bc9c,_0x27b11e,_0x199859,_0x48aec6,_0x582b8b,_0x41f2ec){var _0x3149a5={'method':_0x04e0('0xa0'),'uri':_0x24bc9c+_0x04e0('0xba')+_0x48aec6+')/Attributes('+_0x582b8b+_0x04e0('0xc1'),'headers':{'Authorization':_0x04e0('0xa1')+_0x41f2ec,'If-None-Match':null,'OData-Version':_0x04e0('0xa2')},'json':!![]};return rp(_0x3149a5)[_0x04e0('0x24')](function(_0x5243bb){var _0x19112e=[];_0x19112e[_0x04e0('0xa9')]({'name':_0x5243bb['OptionSet']['TrueOption'][_0x04e0('0xbe')][_0x04e0('0xbf')]['Label'],'value':_0x04e0('0xc2')},{'name':_0x5243bb[_0x04e0('0xbd')][_0x04e0('0xc3')][_0x04e0('0xbe')][_0x04e0('0xbf')][_0x04e0('0xbe')],'value':_0x04e0('0xc4')});var _0x2e092c={'id':_0x27b11e+'_'+_0x5243bb['LogicalName'],'name':_0x5243bb[_0x04e0('0xc5')][_0x04e0('0xbf')]['Label'],'custom':![],'options':_0x19112e};_0x199859[_0x04e0('0xa9')](_0x2e092c);return _0x199859;});}function getInputList(_0x450553,_0x408c64,_0x44aede,_0x194658,_0x3d6f08,_0x210d3b,_0x4ea675){var _0x4a19b0={'method':_0x04e0('0xa0'),'uri':_0x450553+'EntityDefinitions('+_0x3d6f08+_0x04e0('0xbb')+_0x210d3b+_0x04e0('0xc6')+_0x44aede+_0x04e0('0xc7'),'headers':{'Authorization':_0x04e0('0xa1')+_0x4ea675,'If-None-Match':null,'OData-Version':_0x04e0('0xa2')},'json':!![]};return rp(_0x4a19b0)[_0x04e0('0x24')](function(_0x211e11){var _0x4f46bd={'id':_0x408c64+'_'+_0x211e11['LogicalName'],'name':_0x211e11['DisplayName'][_0x04e0('0xbf')]?_0x211e11[_0x04e0('0xc5')][_0x04e0('0xbf')][_0x04e0('0xbe')]:_0x211e11[_0x04e0('0xa6')],'custom':![],'options':[]};_0x194658[_0x04e0('0xa9')](_0x4f46bd);return _0x194658;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 7e3b345..261c9e4 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4e9d32,_0x40109f){var _0x31247e=function(_0x5a582b){while(--_0x5a582b){_0x4e9d32['push'](_0x4e9d32['shift']());}};_0x31247e(++_0x40109f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x3b9ca2,_0x4a23af){var _0x34fdbf=function(_0x5cc228){while(--_0x5cc228){_0x3b9ca2['push'](_0x3b9ca2['shift']());}};_0x34fdbf(++_0x4a23af);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 900e12e..7bd26c6 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 _0xca5c=['http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','map','model','attributes','find','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xca5c,0xcd));var _0xcca5=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0xca5c[_0x1f5887];return _0x21774b;};'use strict';var _=require(_0xcca5('0x0'));var util=require(_0xcca5('0x1'));var moment=require(_0xcca5('0x2'));var BPromise=require(_0xcca5('0x3'));var rs=require(_0xcca5('0x4'));var fs=require('fs');var Redis=require(_0xcca5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcca5('0x6'));var logger=require(_0xcca5('0x7'))(_0xcca5('0x8'));var config=require('../../config/environment');var jayson=require(_0xcca5('0x9'));var client=jayson[_0xcca5('0xa')][_0xcca5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd0671b,_0x223ca0,_0xfc0920){return new BPromise(function(_0x13388c,_0x4dc474){return client[_0xcca5('0xc')](_0xd0671b,_0xfc0920)[_0xcca5('0xd')](function(_0x5e7081){logger[_0xcca5('0xe')](_0xcca5('0xf'),_0x223ca0,_0xcca5('0x10'));logger[_0xcca5('0x11')](_0xcca5('0x12'),_0x223ca0,_0xcca5('0x10'),JSON[_0xcca5('0x13')](_0x5e7081));if(_0x5e7081[_0xcca5('0x14')]){if(_0x5e7081['error'][_0xcca5('0x15')]===0x1f4){logger[_0xcca5('0x14')](_0xcca5('0xf'),_0x223ca0,_0x5e7081[_0xcca5('0x14')][_0xcca5('0x16')]);return _0x4dc474(_0x5e7081[_0xcca5('0x14')][_0xcca5('0x16')]);}logger[_0xcca5('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x223ca0,_0x5e7081[_0xcca5('0x14')][_0xcca5('0x16')]);return _0x13388c(_0x5e7081[_0xcca5('0x14')]['message']);}else{logger[_0xcca5('0xe')](_0xcca5('0xf'),_0x223ca0,'request\x20sent');_0x13388c(_0x5e7081['result']['message']);}})[_0xcca5('0x17')](function(_0x224f5d){logger['error'](_0xcca5('0xf'),_0x223ca0,_0x224f5d);_0x4dc474(_0x224f5d);});});}exports[_0xcca5('0x18')]=function(_0x4a45e3){var _0x5a7c6c=this;return new Promise(function(_0x310431,_0x1e01c1){return db[_0xcca5('0x19')][_0xcca5('0x1a')]({'raw':_0x4a45e3[_0xcca5('0x1b')]?_0x4a45e3[_0xcca5('0x1b')][_0xcca5('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a45e3[_0xcca5('0x1b')]?_0x4a45e3[_0xcca5('0x1b')][_0xcca5('0x1d')]||null:null,'attributes':_0x4a45e3[_0xcca5('0x1b')]?_0x4a45e3[_0xcca5('0x1b')]['attributes']||null:null,'limit':_0x4a45e3['options']?_0x4a45e3['options']['limit']||null:null,'include':_0x4a45e3[_0xcca5('0x1b')]?_0x4a45e3[_0xcca5('0x1b')][_0xcca5('0x1e')]?_[_0xcca5('0x1f')](_0x4a45e3['options'][_0xcca5('0x1e')],function(_0x5bdc11){return{'model':db[_0x5bdc11[_0xcca5('0x20')]],'as':_0x5bdc11['as'],'attributes':_0x5bdc11[_0xcca5('0x21')],'include':_0x5bdc11[_0xcca5('0x1e')]?_[_0xcca5('0x1f')](_0x5bdc11[_0xcca5('0x1e')],function(_0xb7039e){return{'model':db[_0xb7039e[_0xcca5('0x20')]],'as':_0xb7039e['as'],'attributes':_0xb7039e['attributes'],'include':_0xb7039e[_0xcca5('0x1e')]?_['map'](_0xb7039e[_0xcca5('0x1e')],function(_0x498daf){return{'model':db[_0x498daf[_0xcca5('0x20')]],'as':_0x498daf['as'],'attributes':_0x498daf[_0xcca5('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcca5('0xd')](function(_0x21a68f){logger[_0xcca5('0xe')](_0xcca5('0x18'),_0x4a45e3);logger['debug'](_0xcca5('0x18'),_0x4a45e3,JSON[_0xcca5('0x13')](_0x21a68f));_0x310431(_0x21a68f);})['catch'](function(_0x292b58){logger[_0xcca5('0x14')]('GetDynamics365Account',_0x292b58['message'],_0x4a45e3);_0x1e01c1(_0x5a7c6c['error'](0x1f4,_0x292b58[_0xcca5('0x16')]));});});};exports['ShowDynamics365Account']=function(_0xbf4ed1){var _0x47f98b=this;return new Promise(function(_0xa06863,_0x2d6428){return db['Dynamics365Account'][_0xcca5('0x22')]({'raw':_0xbf4ed1[_0xcca5('0x1b')]?_0xbf4ed1[_0xcca5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xbf4ed1[_0xcca5('0x1b')]?_0xbf4ed1[_0xcca5('0x1b')][_0xcca5('0x1d')]||null:null,'attributes':_0xbf4ed1['options']?_0xbf4ed1[_0xcca5('0x1b')][_0xcca5('0x21')]||null:null,'include':_0xbf4ed1[_0xcca5('0x1b')]?_0xbf4ed1[_0xcca5('0x1b')][_0xcca5('0x1e')]?_[_0xcca5('0x1f')](_0xbf4ed1[_0xcca5('0x1b')]['include'],function(_0x30a6fc){return{'model':db[_0x30a6fc['model']],'as':_0x30a6fc['as'],'attributes':_0x30a6fc[_0xcca5('0x21')],'include':_0x30a6fc[_0xcca5('0x1e')]?_['map'](_0x30a6fc[_0xcca5('0x1e')],function(_0x577735){return{'model':db[_0x577735[_0xcca5('0x20')]],'as':_0x577735['as'],'attributes':_0x577735[_0xcca5('0x21')],'include':_0x577735['include']?_[_0xcca5('0x1f')](_0x577735[_0xcca5('0x1e')],function(_0x5e869c){return{'model':db[_0x5e869c[_0xcca5('0x20')]],'as':_0x5e869c['as'],'attributes':_0x5e869c[_0xcca5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54555b){logger[_0xcca5('0xe')](_0xcca5('0x23'),_0xbf4ed1);logger[_0xcca5('0x11')](_0xcca5('0x23'),_0xbf4ed1,JSON['stringify'](_0x54555b));_0xa06863(_0x54555b);})[_0xcca5('0x17')](function(_0x1b56fe){logger[_0xcca5('0x14')](_0xcca5('0x23'),_0x1b56fe[_0xcca5('0x16')],_0xbf4ed1);_0x2d6428(_0x47f98b[_0xcca5('0x14')](0x1f4,_0x1b56fe['message']));});});}; \ No newline at end of file +var _0x0f36=['attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x0f36,0x9b));var _0x60f3=function(_0x32cc05,_0x106d41){_0x32cc05=_0x32cc05-0x0;var _0x445e74=_0x0f36[_0x32cc05];return _0x445e74;};'use strict';var _=require(_0x60f3('0x0'));var util=require(_0x60f3('0x1'));var moment=require(_0x60f3('0x2'));var BPromise=require(_0x60f3('0x3'));var rs=require(_0x60f3('0x4'));var fs=require('fs');var Redis=require(_0x60f3('0x5'));var db=require(_0x60f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x60f3('0x7'))(_0x60f3('0x8'));var config=require('../../config/environment');var jayson=require(_0x60f3('0x9'));var client=jayson[_0x60f3('0xa')][_0x60f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51c2cd,_0x289e4e,_0x3ef45f){return new BPromise(function(_0x9b9241,_0xbb107e){return client[_0x60f3('0xc')](_0x51c2cd,_0x3ef45f)[_0x60f3('0xd')](function(_0x1a27eb){logger['info'](_0x60f3('0xe'),_0x289e4e,_0x60f3('0xf'));logger[_0x60f3('0x10')](_0x60f3('0x11'),_0x289e4e,'request\x20sent',JSON[_0x60f3('0x12')](_0x1a27eb));if(_0x1a27eb[_0x60f3('0x13')]){if(_0x1a27eb[_0x60f3('0x13')][_0x60f3('0x14')]===0x1f4){logger[_0x60f3('0x13')](_0x60f3('0xe'),_0x289e4e,_0x1a27eb['error'][_0x60f3('0x15')]);return _0xbb107e(_0x1a27eb[_0x60f3('0x13')]['message']);}logger[_0x60f3('0x13')](_0x60f3('0xe'),_0x289e4e,_0x1a27eb[_0x60f3('0x13')][_0x60f3('0x15')]);return _0x9b9241(_0x1a27eb[_0x60f3('0x13')][_0x60f3('0x15')]);}else{logger[_0x60f3('0x16')](_0x60f3('0xe'),_0x289e4e,_0x60f3('0xf'));_0x9b9241(_0x1a27eb['result'][_0x60f3('0x15')]);}})[_0x60f3('0x17')](function(_0x33cda7){logger[_0x60f3('0x13')](_0x60f3('0xe'),_0x289e4e,_0x33cda7);_0xbb107e(_0x33cda7);});});}exports[_0x60f3('0x18')]=function(_0x34e51){var _0x5de983=this;return new Promise(function(_0x2f0a68,_0x5e048a){return db[_0x60f3('0x19')][_0x60f3('0x1a')]({'raw':_0x34e51[_0x60f3('0x1b')]?_0x34e51[_0x60f3('0x1b')][_0x60f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x34e51[_0x60f3('0x1b')]?_0x34e51[_0x60f3('0x1b')][_0x60f3('0x1d')]||null:null,'attributes':_0x34e51[_0x60f3('0x1b')]?_0x34e51['options'][_0x60f3('0x1e')]||null:null,'limit':_0x34e51[_0x60f3('0x1b')]?_0x34e51[_0x60f3('0x1b')][_0x60f3('0x1f')]||null:null,'include':_0x34e51[_0x60f3('0x1b')]?_0x34e51['options'][_0x60f3('0x20')]?_[_0x60f3('0x21')](_0x34e51['options'][_0x60f3('0x20')],function(_0x10a00c){return{'model':db[_0x10a00c[_0x60f3('0x22')]],'as':_0x10a00c['as'],'attributes':_0x10a00c[_0x60f3('0x1e')],'include':_0x10a00c[_0x60f3('0x20')]?_[_0x60f3('0x21')](_0x10a00c[_0x60f3('0x20')],function(_0x44c5f2){return{'model':db[_0x44c5f2[_0x60f3('0x22')]],'as':_0x44c5f2['as'],'attributes':_0x44c5f2[_0x60f3('0x1e')],'include':_0x44c5f2['include']?_[_0x60f3('0x21')](_0x44c5f2['include'],function(_0x15d299){return{'model':db[_0x15d299[_0x60f3('0x22')]],'as':_0x15d299['as'],'attributes':_0x15d299['attributes']};}):[]};}):[]};}):[]:[]})[_0x60f3('0xd')](function(_0x368f67){logger[_0x60f3('0x16')]('GetDynamics365Account',_0x34e51);logger[_0x60f3('0x10')](_0x60f3('0x18'),_0x34e51,JSON['stringify'](_0x368f67));_0x2f0a68(_0x368f67);})[_0x60f3('0x17')](function(_0x46af38){logger[_0x60f3('0x13')](_0x60f3('0x18'),_0x46af38[_0x60f3('0x15')],_0x34e51);_0x5e048a(_0x5de983[_0x60f3('0x13')](0x1f4,_0x46af38[_0x60f3('0x15')]));});});};exports[_0x60f3('0x23')]=function(_0x245572){var _0x5a6f56=this;return new Promise(function(_0x30a034,_0x2a6db2){return db['Dynamics365Account'][_0x60f3('0x24')]({'raw':_0x245572[_0x60f3('0x1b')]?_0x245572[_0x60f3('0x1b')][_0x60f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x245572[_0x60f3('0x1b')]?_0x245572[_0x60f3('0x1b')]['where']||null:null,'attributes':_0x245572[_0x60f3('0x1b')]?_0x245572[_0x60f3('0x1b')][_0x60f3('0x1e')]||null:null,'include':_0x245572[_0x60f3('0x1b')]?_0x245572['options'][_0x60f3('0x20')]?_[_0x60f3('0x21')](_0x245572[_0x60f3('0x1b')][_0x60f3('0x20')],function(_0x90021c){return{'model':db[_0x90021c['model']],'as':_0x90021c['as'],'attributes':_0x90021c[_0x60f3('0x1e')],'include':_0x90021c[_0x60f3('0x20')]?_[_0x60f3('0x21')](_0x90021c[_0x60f3('0x20')],function(_0x5389c1){return{'model':db[_0x5389c1[_0x60f3('0x22')]],'as':_0x5389c1['as'],'attributes':_0x5389c1['attributes'],'include':_0x5389c1[_0x60f3('0x20')]?_[_0x60f3('0x21')](_0x5389c1[_0x60f3('0x20')],function(_0x2f9f64){return{'model':db[_0x2f9f64[_0x60f3('0x22')]],'as':_0x2f9f64['as'],'attributes':_0x2f9f64[_0x60f3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x60f3('0xd')](function(_0xb08a37){logger[_0x60f3('0x16')](_0x60f3('0x23'),_0x245572);logger[_0x60f3('0x10')](_0x60f3('0x23'),_0x245572,JSON[_0x60f3('0x12')](_0xb08a37));_0x30a034(_0xb08a37);})[_0x60f3('0x17')](function(_0x1e6911){logger['error'](_0x60f3('0x23'),_0x1e6911[_0x60f3('0x15')],_0x245572);_0x2a6db2(_0x5a6f56[_0x60f3('0x13')](0x1f4,_0x1e6911[_0x60f3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5259e29..3397edb 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 _0x3bd3=['/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','show'];(function(_0x39fe0b,_0x4eaa8c){var _0x476970=function(_0x332d37){while(--_0x332d37){_0x39fe0b['push'](_0x39fe0b['shift']());}};_0x476970(++_0x4eaa8c);}(_0x3bd3,0x110));var _0x33bd=function(_0x4675e8,_0x54edc6){_0x4675e8=_0x4675e8-0x0;var _0x5875d0=_0x3bd3[_0x4675e8];return _0x5875d0;};'use strict';var multer=require(_0x33bd('0x0'));var util=require(_0x33bd('0x1'));var path=require(_0x33bd('0x2'));var timeout=require(_0x33bd('0x3'));var express=require(_0x33bd('0x4'));var router=express[_0x33bd('0x5')]();var fs_extra=require(_0x33bd('0x6'));var auth=require(_0x33bd('0x7'));var interaction=require(_0x33bd('0x8'));var config=require('../../config/environment');var controller=require(_0x33bd('0x9'));router[_0x33bd('0xa')]('/',auth[_0x33bd('0xb')](),controller[_0x33bd('0xc')]);router['get']('/:id',auth[_0x33bd('0xb')](),controller[_0x33bd('0xd')]);router[_0x33bd('0xa')](_0x33bd('0xe'),auth[_0x33bd('0xb')](),controller[_0x33bd('0xf')]);router[_0x33bd('0xa')]('/:id/subjects',auth[_0x33bd('0xb')](),controller[_0x33bd('0x10')]);router['get'](_0x33bd('0x11'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x12')]);router[_0x33bd('0x13')]('/',auth[_0x33bd('0xb')](),controller[_0x33bd('0x14')]);router[_0x33bd('0x15')](_0x33bd('0x16'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x17')]);router[_0x33bd('0x18')](_0x33bd('0x16'),auth['isAuthenticated'](),controller[_0x33bd('0x19')]);module['exports']=router; \ No newline at end of file +var _0x3939=['getSubjects','getDescriptions','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x41cec7,_0x2e1f4a){var _0x5ed26a=function(_0x447ad7){while(--_0x447ad7){_0x41cec7['push'](_0x41cec7['shift']());}};_0x5ed26a(++_0x2e1f4a);}(_0x3939,0x1aa));var _0x9393=function(_0x2388a9,_0x4d8889){_0x2388a9=_0x2388a9-0x0;var _0x1bccc6=_0x3939[_0x2388a9];return _0x1bccc6;};'use strict';var multer=require('multer');var util=require(_0x9393('0x0'));var path=require(_0x9393('0x1'));var timeout=require(_0x9393('0x2'));var express=require(_0x9393('0x3'));var router=express[_0x9393('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9393('0x5'));var config=require(_0x9393('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0x9393('0x7')]('/',auth[_0x9393('0x8')](),controller['index']);router['get'](_0x9393('0x9'),auth[_0x9393('0x8')](),controller[_0x9393('0xa')]);router[_0x9393('0x7')](_0x9393('0xb'),auth['isAuthenticated'](),controller[_0x9393('0xc')]);router[_0x9393('0x7')](_0x9393('0xd'),auth[_0x9393('0x8')](),controller[_0x9393('0xe')]);router[_0x9393('0x7')]('/:id/descriptions',auth[_0x9393('0x8')](),controller[_0x9393('0xf')]);router['post']('/',auth[_0x9393('0x8')](),controller[_0x9393('0x10')]);router[_0x9393('0x11')](_0x9393('0x9'),auth[_0x9393('0x8')](),controller['update']);router[_0x9393('0x12')](_0x9393('0x9'),auth[_0x9393('0x8')](),controller[_0x9393('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index baf20c2..9215ca0 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 _0x0a2e=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x0a2e,0x124));var _0xe0a2=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x0a2e[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require(_0xe0a2('0x0'));module[_0xe0a2('0x1')]={'name':{'type':Sequelize[_0xe0a2('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xe0a2('0x3')](_0xe0a2('0x4'),_0xe0a2('0x5')),'defaultValue':_0xe0a2('0x4')}}; \ No newline at end of file +var _0x85f4=['phonecall','STRING','ENUM','incident'];(function(_0x5c03b6,_0x10d437){var _0x553bb5=function(_0x5a9e19){while(--_0x5a9e19){_0x5c03b6['push'](_0x5c03b6['shift']());}};_0x553bb5(++_0x10d437);}(_0x85f4,0x9d));var _0x485f=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x85f4[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x485f('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x485f('0x1')](_0x485f('0x2'),_0x485f('0x3')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6359971..751663e 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 _0x00f4=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','then','destroy','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','key','query','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','catch','params','keys','fields','create','body','find','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0x00f4,0x1c7));var _0x400f=function(_0x41ed07,_0x49eea5){_0x41ed07=_0x41ed07-0x0;var _0x306029=_0x00f4[_0x41ed07];return _0x306029;};'use strict';var emlformat=require(_0x400f('0x0'));var rimraf=require(_0x400f('0x1'));var zipdir=require(_0x400f('0x2'));var jsonpatch=require(_0x400f('0x3'));var rp=require('request-promise');var moment=require(_0x400f('0x4'));var BPromise=require(_0x400f('0x5'));var Mustache=require(_0x400f('0x6'));var util=require(_0x400f('0x7'));var path=require(_0x400f('0x8'));var sox=require(_0x400f('0x9'));var csv=require(_0x400f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x400f('0xb'));var squel=require(_0x400f('0xc'));var crypto=require(_0x400f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x400f('0xe'));var toCsv=require(_0x400f('0xa'));var querystring=require(_0x400f('0xf'));var Papa=require(_0x400f('0x10'));var Redis=require(_0x400f('0x11'));var authService=require(_0x400f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x400f('0x13'));var hardwareService=require(_0x400f('0x14'));var logger=require('../../config/logger')(_0x400f('0x15'));var utils=require(_0x400f('0x16'));var config=require(_0x400f('0x17'));var licenseUtil=require(_0x400f('0x18'));var db=require(_0x400f('0x19'))['db'];function respondWithStatusCode(_0x1f1c5d,_0x4370ab){_0x4370ab=_0x4370ab||0xcc;return function(_0x23bb2f){if(_0x23bb2f){return _0x1f1c5d[_0x400f('0x1a')](_0x4370ab);}return _0x1f1c5d[_0x400f('0x1b')](_0x4370ab)[_0x400f('0x1c')]();};}function respondWithResult(_0x256170,_0x2f7120){_0x2f7120=_0x2f7120||0xc8;return function(_0x52a885){if(_0x52a885){return _0x256170[_0x400f('0x1b')](_0x2f7120)['json'](_0x52a885);}};}function respondWithFilteredResult(_0x12502e,_0x340b27){return function(_0x3db567){if(_0x3db567){var _0x15c4a2=typeof _0x340b27[_0x400f('0x1d')]===_0x400f('0x1e')&&typeof _0x340b27[_0x400f('0x1f')]===_0x400f('0x1e');var _0x392adb=_0x3db567['count'];var _0x48d155=_0x15c4a2?0x0:_0x340b27[_0x400f('0x1d')];var _0x4237fe=_0x15c4a2?_0x3db567[_0x400f('0x20')]:_0x340b27[_0x400f('0x1d')]+_0x340b27[_0x400f('0x1f')];var _0x55b0c9;if(_0x4237fe>=_0x392adb){_0x4237fe=_0x392adb;_0x55b0c9=0xc8;}else{_0x55b0c9=0xce;}_0x12502e[_0x400f('0x1b')](_0x55b0c9);return _0x12502e[_0x400f('0x21')]('Content-Range',_0x48d155+'-'+_0x4237fe+'/'+_0x392adb)[_0x400f('0x22')](_0x3db567);}return null;};}function patchUpdates(_0x3e83cc){return function(_0x461e03){try{jsonpatch['apply'](_0x461e03,_0x3e83cc,!![]);}catch(_0x14ff7c){return BPromise[_0x400f('0x23')](_0x14ff7c);}return _0x461e03['save']();};}function saveUpdates(_0x3ca236,_0x448021){return function(_0x424700){if(_0x424700){return _0x424700[_0x400f('0x24')](_0x3ca236)[_0x400f('0x25')](function(_0x46f373){return _0x46f373;});}return null;};}function removeEntity(_0x3a6389,_0x4be5cc){return function(_0x29ca35){if(_0x29ca35){return _0x29ca35[_0x400f('0x26')]()[_0x400f('0x25')](function(){_0x3a6389['status'](0xcc)[_0x400f('0x1c')]();});}};}function handleEntityNotFound(_0x196726,_0x431a41){return function(_0x453b71){if(!_0x453b71){_0x196726[_0x400f('0x1a')](0x194);}return _0x453b71;};}function handleError(_0x542c14,_0x4e05ab){_0x4e05ab=_0x4e05ab||0x1f4;return function(_0x258297){logger[_0x400f('0x27')](_0x258297[_0x400f('0x28')]);if(_0x258297[_0x400f('0x29')]){delete _0x258297[_0x400f('0x29')];}_0x542c14[_0x400f('0x1b')](_0x4e05ab)[_0x400f('0x2a')](_0x258297);};}exports['index']=function(_0x46faaa,_0x502771){var _0x53a7ad={},_0x5bce0d={},_0x1378db={'count':0x0,'rows':[]};var _0x2c5adb=_[_0x400f('0x2b')](db[_0x400f('0x2c')][_0x400f('0x2d')],function(_0x5215ba){return{'name':_0x5215ba['fieldName'],'type':_0x5215ba[_0x400f('0x2e')][_0x400f('0x2f')]};});_0x5bce0d['model']=_['map'](_0x2c5adb,_0x400f('0x29'));_0x5bce0d[_0x400f('0x30')]=_['keys'](_0x46faaa[_0x400f('0x30')]);_0x5bce0d['filters']=_[_0x400f('0x31')](_0x5bce0d[_0x400f('0x32')],_0x5bce0d['query']);_0x53a7ad[_0x400f('0x33')]=_[_0x400f('0x31')](_0x5bce0d[_0x400f('0x32')],qs['fields'](_0x46faaa[_0x400f('0x30')]['fields']));_0x53a7ad[_0x400f('0x33')]=_0x53a7ad[_0x400f('0x33')][_0x400f('0x34')]?_0x53a7ad['attributes']:_0x5bce0d[_0x400f('0x32')];if(!_0x46faaa[_0x400f('0x30')][_0x400f('0x35')](_0x400f('0x36'))){_0x53a7ad['limit']=qs['limit'](_0x46faaa[_0x400f('0x30')][_0x400f('0x1f')]);_0x53a7ad[_0x400f('0x1d')]=qs[_0x400f('0x1d')](_0x46faaa['query']['offset']);}_0x53a7ad['order']=qs[_0x400f('0x37')](_0x46faaa[_0x400f('0x30')]['sort']);_0x53a7ad['where']=qs['filters'](_[_0x400f('0x38')](_0x46faaa[_0x400f('0x30')],_0x5bce0d[_0x400f('0x39')]),_0x2c5adb);if(_0x46faaa['query'][_0x400f('0x3a')]){_0x53a7ad[_0x400f('0x3b')]=_[_0x400f('0x3c')](_0x53a7ad[_0x400f('0x3b')],{'$or':_['map'](_0x2c5adb,function(_0xb123ef){if(_0xb123ef['type']!=='VIRTUAL'){var _0x31d78e={};_0x31d78e[_0xb123ef[_0x400f('0x29')]]={'$like':'%'+_0x46faaa[_0x400f('0x30')][_0x400f('0x3a')]+'%'};return _0x31d78e;}})});}_0x53a7ad=_[_0x400f('0x3c')]({},_0x53a7ad,_0x46faaa[_0x400f('0x3d')]);var _0x410f58={'where':_0x53a7ad['where']};return db[_0x400f('0x2c')]['count'](_0x410f58)['then'](function(_0x4a2822){_0x1378db[_0x400f('0x20')]=_0x4a2822;if(_0x46faaa['query'][_0x400f('0x3e')]){_0x53a7ad[_0x400f('0x3f')]=[{'all':!![]}];}return db[_0x400f('0x2c')][_0x400f('0x40')](_0x53a7ad);})[_0x400f('0x25')](function(_0x4f0b1c){_0x1378db['rows']=_0x4f0b1c;return _0x1378db;})[_0x400f('0x25')](respondWithFilteredResult(_0x502771,_0x53a7ad))[_0x400f('0x41')](handleError(_0x502771,null));};exports['show']=function(_0x29a9a7,_0x53815){var _0x1b2749={'raw':![],'where':{'id':_0x29a9a7[_0x400f('0x42')]['id']}},_0x5e3210={};_0x5e3210['model']=_['keys'](db['Dynamics365Configuration'][_0x400f('0x2d')]);_0x5e3210[_0x400f('0x30')]=_[_0x400f('0x43')](_0x29a9a7[_0x400f('0x30')]);_0x5e3210[_0x400f('0x39')]=_['intersection'](_0x5e3210[_0x400f('0x32')],_0x5e3210[_0x400f('0x30')]);_0x1b2749[_0x400f('0x33')]=_['intersection'](_0x5e3210[_0x400f('0x32')],qs['fields'](_0x29a9a7[_0x400f('0x30')][_0x400f('0x44')]));_0x1b2749[_0x400f('0x33')]=_0x1b2749[_0x400f('0x33')][_0x400f('0x34')]?_0x1b2749['attributes']:_0x5e3210[_0x400f('0x32')];if(_0x29a9a7[_0x400f('0x30')][_0x400f('0x3e')]){_0x1b2749[_0x400f('0x3f')]=[{'all':!![]}];}_0x1b2749=_['merge']({},_0x1b2749,_0x29a9a7['options']);return db['Dynamics365Configuration']['find'](_0x1b2749)[_0x400f('0x25')](handleEntityNotFound(_0x53815,null))[_0x400f('0x25')](respondWithResult(_0x53815,null))['catch'](handleError(_0x53815,null));};exports[_0x400f('0x45')]=function(_0x4387ae,_0x106627){return db['Dynamics365Configuration'][_0x400f('0x45')](_0x4387ae[_0x400f('0x46')],{})[_0x400f('0x25')](respondWithResult(_0x106627,0xc9))[_0x400f('0x41')](handleError(_0x106627,null));};exports[_0x400f('0x24')]=function(_0x28d8b6,_0x357c22){if(_0x28d8b6[_0x400f('0x46')]['id']){delete _0x28d8b6[_0x400f('0x46')]['id'];}return db['Dynamics365Configuration'][_0x400f('0x47')]({'where':{'id':_0x28d8b6[_0x400f('0x42')]['id']}})[_0x400f('0x25')](handleEntityNotFound(_0x357c22,null))['then'](saveUpdates(_0x28d8b6[_0x400f('0x46')],null))[_0x400f('0x25')](respondWithResult(_0x357c22,null))[_0x400f('0x41')](handleError(_0x357c22,null));};exports['destroy']=function(_0x19d7f1,_0x48755f){return db[_0x400f('0x2c')][_0x400f('0x47')]({'where':{'id':_0x19d7f1[_0x400f('0x42')]['id']}})['then'](handleEntityNotFound(_0x48755f,null))[_0x400f('0x25')](removeEntity(_0x48755f,null))[_0x400f('0x41')](handleError(_0x48755f,null));};exports[_0x400f('0x48')]=function(_0x517998,_0x105d2e,_0x3f7af8){var _0x142c02={};var _0x2f9ad3={};var _0x43562f;var _0x1a3199;return db[_0x400f('0x2c')][_0x400f('0x49')]({'where':{'id':_0x517998[_0x400f('0x42')]['id']}})[_0x400f('0x25')](handleEntityNotFound(_0x105d2e,null))[_0x400f('0x25')](function(_0x240b52){if(_0x240b52){_0x43562f=_0x240b52;_0x2f9ad3[_0x400f('0x32')]=_[_0x400f('0x43')](db[_0x400f('0x4a')][_0x400f('0x2d')]);_0x2f9ad3[_0x400f('0x30')]=_[_0x400f('0x43')](_0x517998['query']);_0x2f9ad3[_0x400f('0x39')]=_['intersection'](_0x2f9ad3[_0x400f('0x32')],_0x2f9ad3[_0x400f('0x30')]);_0x142c02[_0x400f('0x33')]=_[_0x400f('0x31')](_0x2f9ad3[_0x400f('0x32')],qs['fields'](_0x517998[_0x400f('0x30')][_0x400f('0x44')]));_0x142c02[_0x400f('0x33')]=_0x142c02[_0x400f('0x33')][_0x400f('0x34')]?_0x142c02['attributes']:_0x2f9ad3[_0x400f('0x32')];_0x142c02[_0x400f('0x4b')]=qs['sort'](_0x517998[_0x400f('0x30')][_0x400f('0x37')]);_0x142c02['where']=qs[_0x400f('0x39')](_[_0x400f('0x38')](_0x517998[_0x400f('0x30')],_0x2f9ad3[_0x400f('0x39')]));if(_0x517998[_0x400f('0x30')]['filter']){_0x142c02[_0x400f('0x3b')]=_['merge'](_0x142c02[_0x400f('0x3b')],{'$or':_['map'](_0x142c02[_0x400f('0x33')],function(_0x29a002){var _0x3b0255={};_0x3b0255[_0x29a002]={'$like':'%'+_0x517998[_0x400f('0x30')][_0x400f('0x3a')]+'%'};return _0x3b0255;})});}_0x142c02=_['merge']({},_0x142c02,_0x517998[_0x400f('0x3d')]);return _0x43562f['getFields'](_0x142c02);}})[_0x400f('0x25')](function(_0x4dbb0a){if(_0x4dbb0a){_0x1a3199=_0x4dbb0a[_0x400f('0x34')];if(!_0x517998['query'][_0x400f('0x35')]('nolimit')){_0x142c02['limit']=qs['limit'](_0x517998[_0x400f('0x30')][_0x400f('0x1f')]);_0x142c02[_0x400f('0x1d')]=qs[_0x400f('0x1d')](_0x517998[_0x400f('0x30')][_0x400f('0x1d')]);}return _0x43562f[_0x400f('0x48')](_0x142c02);}})[_0x400f('0x25')](function(_0x40d368){if(_0x40d368){return _0x40d368?{'count':_0x1a3199,'rows':_0x40d368}:null;}})[_0x400f('0x25')](respondWithResult(_0x105d2e,null))[_0x400f('0x41')](handleError(_0x105d2e,null));};exports[_0x400f('0x4c')]=function(_0x556a1c,_0x46dcf4,_0xa54540){var _0x22ee50={};var _0x3e5739={};var _0x45c8be;var _0x3e9de8;return db[_0x400f('0x2c')][_0x400f('0x49')]({'where':{'id':_0x556a1c[_0x400f('0x42')]['id']}})[_0x400f('0x25')](handleEntityNotFound(_0x46dcf4,null))[_0x400f('0x25')](function(_0x1c879f){if(_0x1c879f){_0x45c8be=_0x1c879f;_0x3e5739[_0x400f('0x32')]=_[_0x400f('0x43')](db[_0x400f('0x4a')][_0x400f('0x2d')]);_0x3e5739[_0x400f('0x30')]=_[_0x400f('0x43')](_0x556a1c['query']);_0x3e5739[_0x400f('0x39')]=_['intersection'](_0x3e5739[_0x400f('0x32')],_0x3e5739[_0x400f('0x30')]);_0x22ee50[_0x400f('0x33')]=_[_0x400f('0x31')](_0x3e5739[_0x400f('0x32')],qs[_0x400f('0x44')](_0x556a1c[_0x400f('0x30')][_0x400f('0x44')]));_0x22ee50[_0x400f('0x33')]=_0x22ee50['attributes'][_0x400f('0x34')]?_0x22ee50[_0x400f('0x33')]:_0x3e5739['model'];_0x22ee50[_0x400f('0x4b')]=qs[_0x400f('0x37')](_0x556a1c[_0x400f('0x30')][_0x400f('0x37')]);_0x22ee50['where']=qs[_0x400f('0x39')](_[_0x400f('0x38')](_0x556a1c[_0x400f('0x30')],_0x3e5739['filters']));if(_0x556a1c['query'][_0x400f('0x3a')]){_0x22ee50[_0x400f('0x3b')]=_['merge'](_0x22ee50[_0x400f('0x3b')],{'$or':_['map'](_0x22ee50['attributes'],function(_0xb96d80){var _0x355529={};_0x355529[_0xb96d80]={'$like':'%'+_0x556a1c[_0x400f('0x30')]['filter']+'%'};return _0x355529;})});}_0x22ee50=_[_0x400f('0x3c')]({},_0x22ee50,_0x556a1c['options']);return _0x45c8be[_0x400f('0x4c')](_0x22ee50);}})[_0x400f('0x25')](function(_0x134007){if(_0x134007){_0x3e9de8=_0x134007[_0x400f('0x34')];if(!_0x556a1c['query'][_0x400f('0x35')](_0x400f('0x36'))){_0x22ee50[_0x400f('0x1f')]=qs[_0x400f('0x1f')](_0x556a1c['query'][_0x400f('0x1f')]);_0x22ee50[_0x400f('0x1d')]=qs[_0x400f('0x1d')](_0x556a1c[_0x400f('0x30')][_0x400f('0x1d')]);}return _0x45c8be['getSubjects'](_0x22ee50);}})['then'](function(_0x2430b5){if(_0x2430b5){return _0x2430b5?{'count':_0x3e9de8,'rows':_0x2430b5}:null;}})[_0x400f('0x25')](respondWithResult(_0x46dcf4,null))['catch'](handleError(_0x46dcf4,null));};exports['getDescriptions']=function(_0x582970,_0x245690,_0x4c22bb){var _0x3aa1be={};var _0x19dd27={};var _0x1afbd4;var _0x3944cd;return db[_0x400f('0x2c')][_0x400f('0x49')]({'where':{'id':_0x582970[_0x400f('0x42')]['id']}})[_0x400f('0x25')](handleEntityNotFound(_0x245690,null))[_0x400f('0x25')](function(_0x3716ac){if(_0x3716ac){_0x1afbd4=_0x3716ac;_0x19dd27[_0x400f('0x32')]=_[_0x400f('0x43')](db['Dynamics365Field'][_0x400f('0x2d')]);_0x19dd27['query']=_[_0x400f('0x43')](_0x582970[_0x400f('0x30')]);_0x19dd27[_0x400f('0x39')]=_[_0x400f('0x31')](_0x19dd27[_0x400f('0x32')],_0x19dd27[_0x400f('0x30')]);_0x3aa1be[_0x400f('0x33')]=_[_0x400f('0x31')](_0x19dd27[_0x400f('0x32')],qs[_0x400f('0x44')](_0x582970['query'][_0x400f('0x44')]));_0x3aa1be[_0x400f('0x33')]=_0x3aa1be[_0x400f('0x33')][_0x400f('0x34')]?_0x3aa1be[_0x400f('0x33')]:_0x19dd27['model'];_0x3aa1be[_0x400f('0x4b')]=qs['sort'](_0x582970[_0x400f('0x30')][_0x400f('0x37')]);_0x3aa1be['where']=qs[_0x400f('0x39')](_['pick'](_0x582970[_0x400f('0x30')],_0x19dd27[_0x400f('0x39')]));if(_0x582970[_0x400f('0x30')][_0x400f('0x3a')]){_0x3aa1be[_0x400f('0x3b')]=_[_0x400f('0x3c')](_0x3aa1be[_0x400f('0x3b')],{'$or':_[_0x400f('0x2b')](_0x3aa1be[_0x400f('0x33')],function(_0x181a5f){var _0x48810e={};_0x48810e[_0x181a5f]={'$like':'%'+_0x582970[_0x400f('0x30')][_0x400f('0x3a')]+'%'};return _0x48810e;})});}_0x3aa1be=_['merge']({},_0x3aa1be,_0x582970[_0x400f('0x3d')]);return _0x1afbd4[_0x400f('0x4d')](_0x3aa1be);}})[_0x400f('0x25')](function(_0x714093){if(_0x714093){_0x3944cd=_0x714093[_0x400f('0x34')];if(!_0x582970[_0x400f('0x30')]['hasOwnProperty'](_0x400f('0x36'))){_0x3aa1be[_0x400f('0x1f')]=qs['limit'](_0x582970[_0x400f('0x30')]['limit']);_0x3aa1be[_0x400f('0x1d')]=qs[_0x400f('0x1d')](_0x582970[_0x400f('0x30')][_0x400f('0x1d')]);}return _0x1afbd4[_0x400f('0x4d')](_0x3aa1be);}})[_0x400f('0x25')](function(_0x27fa2c){if(_0x27fa2c){return _0x27fa2c?{'count':_0x3944cd,'rows':_0x27fa2c}:null;}})[_0x400f('0x25')](respondWithResult(_0x245690,null))['catch'](handleError(_0x245690,null));}; \ No newline at end of file +var _0xe66a=['catch','show','params','rawAttributes','intersection','include','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','then','destroy','error','name','Dynamics365Configuration','fieldName','type','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xe66a,0x136));var _0xae66=function(_0x12f42c,_0x19e745){_0x12f42c=_0x12f42c-0x0;var _0x48b922=_0xe66a[_0x12f42c];return _0x48b922;};'use strict';var emlformat=require(_0xae66('0x0'));var rimraf=require(_0xae66('0x1'));var zipdir=require(_0xae66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae66('0x3'));var moment=require(_0xae66('0x4'));var BPromise=require(_0xae66('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xae66('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae66('0x7'));var _=require(_0xae66('0x8'));var squel=require(_0xae66('0x9'));var crypto=require(_0xae66('0xa'));var jsforce=require(_0xae66('0xb'));var deskjs=require(_0xae66('0xc'));var toCsv=require(_0xae66('0xd'));var querystring=require(_0xae66('0xe'));var Papa=require('papaparse');var Redis=require(_0xae66('0xf'));var authService=require(_0xae66('0x10'));var qs=require(_0xae66('0x11'));var as=require(_0xae66('0x12'));var hardwareService=require(_0xae66('0x13'));var logger=require(_0xae66('0x14'))(_0xae66('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xae66('0x16'))['db'];function respondWithStatusCode(_0x5c9b59,_0x3b0628){_0x3b0628=_0x3b0628||0xcc;return function(_0x205c0b){if(_0x205c0b){return _0x5c9b59[_0xae66('0x17')](_0x3b0628);}return _0x5c9b59['status'](_0x3b0628)[_0xae66('0x18')]();};}function respondWithResult(_0x3232cf,_0x293250){_0x293250=_0x293250||0xc8;return function(_0x8e5cd5){if(_0x8e5cd5){return _0x3232cf[_0xae66('0x19')](_0x293250)['json'](_0x8e5cd5);}};}function respondWithFilteredResult(_0x3bfe6b,_0x3dc526){return function(_0x5a3888){if(_0x5a3888){var _0x70b0c9=typeof _0x3dc526[_0xae66('0x1a')]===_0xae66('0x1b')&&typeof _0x3dc526[_0xae66('0x1c')]==='undefined';var _0x1880a6=_0x5a3888[_0xae66('0x1d')];var _0x179344=_0x70b0c9?0x0:_0x3dc526['offset'];var _0x6f9e1e=_0x70b0c9?_0x5a3888[_0xae66('0x1d')]:_0x3dc526[_0xae66('0x1a')]+_0x3dc526['limit'];var _0x41db53;if(_0x6f9e1e>=_0x1880a6){_0x6f9e1e=_0x1880a6;_0x41db53=0xc8;}else{_0x41db53=0xce;}_0x3bfe6b[_0xae66('0x19')](_0x41db53);return _0x3bfe6b[_0xae66('0x1e')]('Content-Range',_0x179344+'-'+_0x6f9e1e+'/'+_0x1880a6)['json'](_0x5a3888);}return null;};}function patchUpdates(_0x5e66fb){return function(_0x165bdf){try{jsonpatch[_0xae66('0x1f')](_0x165bdf,_0x5e66fb,!![]);}catch(_0x556f15){return BPromise[_0xae66('0x20')](_0x556f15);}return _0x165bdf['save']();};}function saveUpdates(_0x2667b7,_0x5938eb){return function(_0x5be37d){if(_0x5be37d){return _0x5be37d['update'](_0x2667b7)[_0xae66('0x21')](function(_0x5afe23){return _0x5afe23;});}return null;};}function removeEntity(_0x414b8b,_0x3b7658){return function(_0x3a48a5){if(_0x3a48a5){return _0x3a48a5[_0xae66('0x22')]()['then'](function(){_0x414b8b['status'](0xcc)[_0xae66('0x18')]();});}};}function handleEntityNotFound(_0x3ee264,_0x117e09){return function(_0x11a5a1){if(!_0x11a5a1){_0x3ee264[_0xae66('0x17')](0x194);}return _0x11a5a1;};}function handleError(_0x51c24d,_0x26fafe){_0x26fafe=_0x26fafe||0x1f4;return function(_0xb55c5f){logger[_0xae66('0x23')](_0xb55c5f['stack']);if(_0xb55c5f[_0xae66('0x24')]){delete _0xb55c5f[_0xae66('0x24')];}_0x51c24d[_0xae66('0x19')](_0x26fafe)['send'](_0xb55c5f);};}exports['index']=function(_0x50dd92,_0x538aa4){var _0xb1c3ed={},_0x3d01f2={},_0x35e4db={'count':0x0,'rows':[]};var _0x11c776=_['map'](db[_0xae66('0x25')]['rawAttributes'],function(_0x1a3663){return{'name':_0x1a3663[_0xae66('0x26')],'type':_0x1a3663[_0xae66('0x27')]['key']};});_0x3d01f2[_0xae66('0x28')]=_[_0xae66('0x29')](_0x11c776,'name');_0x3d01f2['query']=_[_0xae66('0x2a')](_0x50dd92[_0xae66('0x2b')]);_0x3d01f2[_0xae66('0x2c')]=_['intersection'](_0x3d01f2[_0xae66('0x28')],_0x3d01f2[_0xae66('0x2b')]);_0xb1c3ed[_0xae66('0x2d')]=_['intersection'](_0x3d01f2[_0xae66('0x28')],qs['fields'](_0x50dd92[_0xae66('0x2b')][_0xae66('0x2e')]));_0xb1c3ed[_0xae66('0x2d')]=_0xb1c3ed['attributes'][_0xae66('0x2f')]?_0xb1c3ed[_0xae66('0x2d')]:_0x3d01f2[_0xae66('0x28')];if(!_0x50dd92[_0xae66('0x2b')][_0xae66('0x30')](_0xae66('0x31'))){_0xb1c3ed[_0xae66('0x1c')]=qs[_0xae66('0x1c')](_0x50dd92[_0xae66('0x2b')][_0xae66('0x1c')]);_0xb1c3ed[_0xae66('0x1a')]=qs[_0xae66('0x1a')](_0x50dd92[_0xae66('0x2b')][_0xae66('0x1a')]);}_0xb1c3ed[_0xae66('0x32')]=qs[_0xae66('0x33')](_0x50dd92[_0xae66('0x2b')][_0xae66('0x33')]);_0xb1c3ed[_0xae66('0x34')]=qs['filters'](_[_0xae66('0x35')](_0x50dd92['query'],_0x3d01f2[_0xae66('0x2c')]),_0x11c776);if(_0x50dd92['query'][_0xae66('0x36')]){_0xb1c3ed[_0xae66('0x34')]=_[_0xae66('0x37')](_0xb1c3ed[_0xae66('0x34')],{'$or':_['map'](_0x11c776,function(_0x5704ca){if(_0x5704ca[_0xae66('0x27')]!==_0xae66('0x38')){var _0x26598e={};_0x26598e[_0x5704ca[_0xae66('0x24')]]={'$like':'%'+_0x50dd92[_0xae66('0x2b')][_0xae66('0x36')]+'%'};return _0x26598e;}})});}_0xb1c3ed=_['merge']({},_0xb1c3ed,_0x50dd92[_0xae66('0x39')]);var _0x1b1178={'where':_0xb1c3ed[_0xae66('0x34')]};return db[_0xae66('0x25')][_0xae66('0x1d')](_0x1b1178)[_0xae66('0x21')](function(_0x1ab96f){_0x35e4db[_0xae66('0x1d')]=_0x1ab96f;if(_0x50dd92[_0xae66('0x2b')][_0xae66('0x3a')]){_0xb1c3ed['include']=[{'all':!![]}];}return db[_0xae66('0x25')]['findAll'](_0xb1c3ed);})[_0xae66('0x21')](function(_0x583671){_0x35e4db[_0xae66('0x3b')]=_0x583671;return _0x35e4db;})[_0xae66('0x21')](respondWithFilteredResult(_0x538aa4,_0xb1c3ed))[_0xae66('0x3c')](handleError(_0x538aa4,null));};exports[_0xae66('0x3d')]=function(_0x1c6aa2,_0x5d95a4){var _0x314119={'raw':![],'where':{'id':_0x1c6aa2[_0xae66('0x3e')]['id']}},_0xc03517={};_0xc03517[_0xae66('0x28')]=_[_0xae66('0x2a')](db[_0xae66('0x25')][_0xae66('0x3f')]);_0xc03517[_0xae66('0x2b')]=_['keys'](_0x1c6aa2[_0xae66('0x2b')]);_0xc03517[_0xae66('0x2c')]=_[_0xae66('0x40')](_0xc03517[_0xae66('0x28')],_0xc03517[_0xae66('0x2b')]);_0x314119[_0xae66('0x2d')]=_['intersection'](_0xc03517['model'],qs['fields'](_0x1c6aa2['query'][_0xae66('0x2e')]));_0x314119[_0xae66('0x2d')]=_0x314119[_0xae66('0x2d')][_0xae66('0x2f')]?_0x314119[_0xae66('0x2d')]:_0xc03517[_0xae66('0x28')];if(_0x1c6aa2['query'][_0xae66('0x3a')]){_0x314119[_0xae66('0x41')]=[{'all':!![]}];}_0x314119=_[_0xae66('0x37')]({},_0x314119,_0x1c6aa2[_0xae66('0x39')]);return db[_0xae66('0x25')][_0xae66('0x42')](_0x314119)[_0xae66('0x21')](handleEntityNotFound(_0x5d95a4,null))[_0xae66('0x21')](respondWithResult(_0x5d95a4,null))[_0xae66('0x3c')](handleError(_0x5d95a4,null));};exports[_0xae66('0x43')]=function(_0x2f1138,_0x3cca0f){return db['Dynamics365Configuration'][_0xae66('0x43')](_0x2f1138[_0xae66('0x44')],{})[_0xae66('0x21')](respondWithResult(_0x3cca0f,0xc9))[_0xae66('0x3c')](handleError(_0x3cca0f,null));};exports['update']=function(_0x1aa81f,_0x367cae){if(_0x1aa81f['body']['id']){delete _0x1aa81f['body']['id'];}return db[_0xae66('0x25')]['find']({'where':{'id':_0x1aa81f['params']['id']}})[_0xae66('0x21')](handleEntityNotFound(_0x367cae,null))[_0xae66('0x21')](saveUpdates(_0x1aa81f[_0xae66('0x44')],null))[_0xae66('0x21')](respondWithResult(_0x367cae,null))[_0xae66('0x3c')](handleError(_0x367cae,null));};exports[_0xae66('0x22')]=function(_0x554648,_0x4d2924){return db[_0xae66('0x25')][_0xae66('0x42')]({'where':{'id':_0x554648[_0xae66('0x3e')]['id']}})[_0xae66('0x21')](handleEntityNotFound(_0x4d2924,null))['then'](removeEntity(_0x4d2924,null))[_0xae66('0x3c')](handleError(_0x4d2924,null));};exports[_0xae66('0x45')]=function(_0x316224,_0x2a77ff,_0x49ddf8){var _0x54a376={};var _0x23fa2a={};var _0x4f01fb;var _0x258344;return db[_0xae66('0x25')][_0xae66('0x46')]({'where':{'id':_0x316224[_0xae66('0x3e')]['id']}})[_0xae66('0x21')](handleEntityNotFound(_0x2a77ff,null))[_0xae66('0x21')](function(_0x66becd){if(_0x66becd){_0x4f01fb=_0x66becd;_0x23fa2a[_0xae66('0x28')]=_[_0xae66('0x2a')](db[_0xae66('0x47')][_0xae66('0x3f')]);_0x23fa2a[_0xae66('0x2b')]=_[_0xae66('0x2a')](_0x316224['query']);_0x23fa2a['filters']=_[_0xae66('0x40')](_0x23fa2a['model'],_0x23fa2a[_0xae66('0x2b')]);_0x54a376[_0xae66('0x2d')]=_[_0xae66('0x40')](_0x23fa2a[_0xae66('0x28')],qs[_0xae66('0x2e')](_0x316224[_0xae66('0x2b')]['fields']));_0x54a376['attributes']=_0x54a376[_0xae66('0x2d')][_0xae66('0x2f')]?_0x54a376[_0xae66('0x2d')]:_0x23fa2a['model'];_0x54a376[_0xae66('0x32')]=qs['sort'](_0x316224['query']['sort']);_0x54a376[_0xae66('0x34')]=qs[_0xae66('0x2c')](_['pick'](_0x316224['query'],_0x23fa2a['filters']));if(_0x316224['query'][_0xae66('0x36')]){_0x54a376[_0xae66('0x34')]=_['merge'](_0x54a376[_0xae66('0x34')],{'$or':_[_0xae66('0x29')](_0x54a376['attributes'],function(_0xdb8ab9){var _0x2f1cae={};_0x2f1cae[_0xdb8ab9]={'$like':'%'+_0x316224[_0xae66('0x2b')][_0xae66('0x36')]+'%'};return _0x2f1cae;})});}_0x54a376=_[_0xae66('0x37')]({},_0x54a376,_0x316224['options']);return _0x4f01fb[_0xae66('0x45')](_0x54a376);}})[_0xae66('0x21')](function(_0x14cfc2){if(_0x14cfc2){_0x258344=_0x14cfc2['length'];if(!_0x316224[_0xae66('0x2b')][_0xae66('0x30')](_0xae66('0x31'))){_0x54a376[_0xae66('0x1c')]=qs['limit'](_0x316224[_0xae66('0x2b')][_0xae66('0x1c')]);_0x54a376[_0xae66('0x1a')]=qs[_0xae66('0x1a')](_0x316224['query'][_0xae66('0x1a')]);}return _0x4f01fb[_0xae66('0x45')](_0x54a376);}})[_0xae66('0x21')](function(_0x1a96b5){if(_0x1a96b5){return _0x1a96b5?{'count':_0x258344,'rows':_0x1a96b5}:null;}})['then'](respondWithResult(_0x2a77ff,null))[_0xae66('0x3c')](handleError(_0x2a77ff,null));};exports[_0xae66('0x48')]=function(_0x5c097c,_0x9e8832,_0x14f841){var _0xc9048e={};var _0x91e6b2={};var _0x338dc6;var _0x5314c6;return db[_0xae66('0x25')]['findOne']({'where':{'id':_0x5c097c[_0xae66('0x3e')]['id']}})['then'](handleEntityNotFound(_0x9e8832,null))['then'](function(_0x581ee0){if(_0x581ee0){_0x338dc6=_0x581ee0;_0x91e6b2[_0xae66('0x28')]=_['keys'](db[_0xae66('0x47')]['rawAttributes']);_0x91e6b2[_0xae66('0x2b')]=_[_0xae66('0x2a')](_0x5c097c[_0xae66('0x2b')]);_0x91e6b2[_0xae66('0x2c')]=_[_0xae66('0x40')](_0x91e6b2['model'],_0x91e6b2[_0xae66('0x2b')]);_0xc9048e[_0xae66('0x2d')]=_[_0xae66('0x40')](_0x91e6b2[_0xae66('0x28')],qs[_0xae66('0x2e')](_0x5c097c[_0xae66('0x2b')][_0xae66('0x2e')]));_0xc9048e['attributes']=_0xc9048e[_0xae66('0x2d')]['length']?_0xc9048e[_0xae66('0x2d')]:_0x91e6b2['model'];_0xc9048e[_0xae66('0x32')]=qs['sort'](_0x5c097c[_0xae66('0x2b')]['sort']);_0xc9048e[_0xae66('0x34')]=qs[_0xae66('0x2c')](_[_0xae66('0x35')](_0x5c097c['query'],_0x91e6b2[_0xae66('0x2c')]));if(_0x5c097c[_0xae66('0x2b')][_0xae66('0x36')]){_0xc9048e[_0xae66('0x34')]=_[_0xae66('0x37')](_0xc9048e[_0xae66('0x34')],{'$or':_[_0xae66('0x29')](_0xc9048e['attributes'],function(_0x30ea33){var _0x2c923b={};_0x2c923b[_0x30ea33]={'$like':'%'+_0x5c097c[_0xae66('0x2b')][_0xae66('0x36')]+'%'};return _0x2c923b;})});}_0xc9048e=_[_0xae66('0x37')]({},_0xc9048e,_0x5c097c[_0xae66('0x39')]);return _0x338dc6[_0xae66('0x48')](_0xc9048e);}})['then'](function(_0x50b416){if(_0x50b416){_0x5314c6=_0x50b416[_0xae66('0x2f')];if(!_0x5c097c[_0xae66('0x2b')][_0xae66('0x30')](_0xae66('0x31'))){_0xc9048e['limit']=qs['limit'](_0x5c097c[_0xae66('0x2b')][_0xae66('0x1c')]);_0xc9048e[_0xae66('0x1a')]=qs[_0xae66('0x1a')](_0x5c097c[_0xae66('0x2b')][_0xae66('0x1a')]);}return _0x338dc6[_0xae66('0x48')](_0xc9048e);}})[_0xae66('0x21')](function(_0x1908d4){if(_0x1908d4){return _0x1908d4?{'count':_0x5314c6,'rows':_0x1908d4}:null;}})[_0xae66('0x21')](respondWithResult(_0x9e8832,null))[_0xae66('0x3c')](handleError(_0x9e8832,null));};exports[_0xae66('0x49')]=function(_0x146373,_0x5cfc9e,_0x3bf347){var _0xc8a041={};var _0x143e72={};var _0x10c61b;var _0x5b6d49;return db[_0xae66('0x25')][_0xae66('0x46')]({'where':{'id':_0x146373[_0xae66('0x3e')]['id']}})[_0xae66('0x21')](handleEntityNotFound(_0x5cfc9e,null))[_0xae66('0x21')](function(_0x2bf152){if(_0x2bf152){_0x10c61b=_0x2bf152;_0x143e72['model']=_['keys'](db[_0xae66('0x47')]['rawAttributes']);_0x143e72[_0xae66('0x2b')]=_[_0xae66('0x2a')](_0x146373[_0xae66('0x2b')]);_0x143e72['filters']=_[_0xae66('0x40')](_0x143e72['model'],_0x143e72['query']);_0xc8a041[_0xae66('0x2d')]=_[_0xae66('0x40')](_0x143e72[_0xae66('0x28')],qs[_0xae66('0x2e')](_0x146373['query'][_0xae66('0x2e')]));_0xc8a041[_0xae66('0x2d')]=_0xc8a041[_0xae66('0x2d')][_0xae66('0x2f')]?_0xc8a041[_0xae66('0x2d')]:_0x143e72[_0xae66('0x28')];_0xc8a041[_0xae66('0x32')]=qs[_0xae66('0x33')](_0x146373[_0xae66('0x2b')][_0xae66('0x33')]);_0xc8a041[_0xae66('0x34')]=qs[_0xae66('0x2c')](_[_0xae66('0x35')](_0x146373[_0xae66('0x2b')],_0x143e72['filters']));if(_0x146373[_0xae66('0x2b')][_0xae66('0x36')]){_0xc8a041[_0xae66('0x34')]=_[_0xae66('0x37')](_0xc8a041[_0xae66('0x34')],{'$or':_[_0xae66('0x29')](_0xc8a041[_0xae66('0x2d')],function(_0x38bff8){var _0x4123df={};_0x4123df[_0x38bff8]={'$like':'%'+_0x146373['query'][_0xae66('0x36')]+'%'};return _0x4123df;})});}_0xc8a041=_[_0xae66('0x37')]({},_0xc8a041,_0x146373[_0xae66('0x39')]);return _0x10c61b['getDescriptions'](_0xc8a041);}})['then'](function(_0x3fcb7d){if(_0x3fcb7d){_0x5b6d49=_0x3fcb7d[_0xae66('0x2f')];if(!_0x146373[_0xae66('0x2b')][_0xae66('0x30')]('nolimit')){_0xc8a041['limit']=qs['limit'](_0x146373['query'][_0xae66('0x1c')]);_0xc8a041[_0xae66('0x1a')]=qs['offset'](_0x146373['query']['offset']);}return _0x10c61b[_0xae66('0x49')](_0xc8a041);}})['then'](function(_0x4b4395){if(_0x4b4395){return _0x4b4395?{'count':_0x5b6d49,'rows':_0x4b4395}:null;}})[_0xae66('0x21')](respondWithResult(_0x5cfc9e,null))[_0xae66('0x3c')](handleError(_0x5cfc9e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 97ffd5a..df3cc73 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 _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x1eb7f3,_0x540872){var _0x570dcd=function(_0x47374d){while(--_0x47374d){_0x1eb7f3['push'](_0x1eb7f3['shift']());}};_0x570dcd(++_0x540872);}(_0xf109,0xce));var _0x9f10=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xf109[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0xca9235,_0x4b825d){var _0x49c694=function(_0xcac362){while(--_0xcac362){_0xca9235['push'](_0xca9235['shift']());}};_0x49c694(++_0x4b825d);}(_0xa41a,0x6b));var _0xaa41=function(_0x18cc08,_0x34c324){_0x18cc08=_0x18cc08-0x0;var _0x230d93=_0xa41a[_0x18cc08];return _0x230d93;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'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 31a2428..31898af 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 _0xcf17=['Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x116546,_0x427c25){var _0x18c601=function(_0x4f4813){while(--_0x4f4813){_0x116546['push'](_0x116546['shift']());}};_0x18c601(++_0x427c25);}(_0xcf17,0x190));var _0x7cf1=function(_0x43ae2d,_0x194fac){_0x43ae2d=_0x43ae2d-0x0;var _0x25e6a2=_0xcf17[_0x43ae2d];return _0x25e6a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7cf1('0x0'));var BPromise=require(_0x7cf1('0x1'));var rs=require(_0x7cf1('0x2'));var fs=require('fs');var Redis=require(_0x7cf1('0x3'));var db=require(_0x7cf1('0x4'))['db'];var utils=require(_0x7cf1('0x5'));var logger=require(_0x7cf1('0x6'))(_0x7cf1('0x7'));var config=require('../../config/environment');var jayson=require(_0x7cf1('0x8'));var client=jayson['client'][_0x7cf1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59651d,_0x2dcc42,_0x57bbe9){return new BPromise(function(_0x58192e,_0x3e3429){return client[_0x7cf1('0xa')](_0x59651d,_0x57bbe9)[_0x7cf1('0xb')](function(_0x53dff8){logger[_0x7cf1('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2dcc42,_0x7cf1('0xd'));logger[_0x7cf1('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2dcc42,_0x7cf1('0xd'),JSON[_0x7cf1('0xf')](_0x53dff8));if(_0x53dff8[_0x7cf1('0x10')]){if(_0x53dff8[_0x7cf1('0x10')][_0x7cf1('0x11')]===0x1f4){logger[_0x7cf1('0x10')](_0x7cf1('0x12'),_0x2dcc42,_0x53dff8[_0x7cf1('0x10')][_0x7cf1('0x13')]);return _0x3e3429(_0x53dff8[_0x7cf1('0x10')][_0x7cf1('0x13')]);}logger['error'](_0x7cf1('0x12'),_0x2dcc42,_0x53dff8[_0x7cf1('0x10')][_0x7cf1('0x13')]);return _0x58192e(_0x53dff8['error'][_0x7cf1('0x13')]);}else{logger[_0x7cf1('0xc')](_0x7cf1('0x12'),_0x2dcc42,'request\x20sent');_0x58192e(_0x53dff8[_0x7cf1('0x14')][_0x7cf1('0x13')]);}})[_0x7cf1('0x15')](function(_0x35aa33){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2dcc42,_0x35aa33);_0x3e3429(_0x35aa33);});});} \ No newline at end of file +var _0x1b65=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x1b65,0x16d));var _0x51b6=function(_0x4b3f3e,_0x47dfcc){_0x4b3f3e=_0x4b3f3e-0x0;var _0x921fc3=_0x1b65[_0x4b3f3e];return _0x921fc3;};'use strict';var _=require(_0x51b6('0x0'));var util=require('util');var moment=require(_0x51b6('0x1'));var BPromise=require(_0x51b6('0x2'));var rs=require(_0x51b6('0x3'));var fs=require('fs');var Redis=require(_0x51b6('0x4'));var db=require(_0x51b6('0x5'))['db'];var utils=require(_0x51b6('0x6'));var logger=require(_0x51b6('0x7'))(_0x51b6('0x8'));var config=require(_0x51b6('0x9'));var jayson=require(_0x51b6('0xa'));var client=jayson[_0x51b6('0xb')][_0x51b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x403917,_0x1fc1ec,_0x2c7cdf){return new BPromise(function(_0x17dbcc,_0xfe3ce6){return client[_0x51b6('0xd')](_0x403917,_0x2c7cdf)[_0x51b6('0xe')](function(_0x449bfe){logger[_0x51b6('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1fc1ec,'request\x20sent');logger[_0x51b6('0x10')](_0x51b6('0x11'),_0x1fc1ec,'request\x20sent',JSON[_0x51b6('0x12')](_0x449bfe));if(_0x449bfe[_0x51b6('0x13')]){if(_0x449bfe['error'][_0x51b6('0x14')]===0x1f4){logger[_0x51b6('0x13')](_0x51b6('0x15'),_0x1fc1ec,_0x449bfe['error'][_0x51b6('0x16')]);return _0xfe3ce6(_0x449bfe[_0x51b6('0x13')][_0x51b6('0x16')]);}logger[_0x51b6('0x13')](_0x51b6('0x15'),_0x1fc1ec,_0x449bfe[_0x51b6('0x13')][_0x51b6('0x16')]);return _0x17dbcc(_0x449bfe['error']['message']);}else{logger['info'](_0x51b6('0x15'),_0x1fc1ec,_0x51b6('0x17'));_0x17dbcc(_0x449bfe[_0x51b6('0x18')][_0x51b6('0x16')]);}})[_0x51b6('0x19')](function(_0x55d0c3){logger[_0x51b6('0x13')](_0x51b6('0x15'),_0x1fc1ec,_0x55d0c3);_0xfe3ce6(_0x55d0c3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 6c898b3..38d55f0 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 _0xe714=['../../components/interaction/service','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe714,0x7a));var _0x4e71=function(_0x380c29,_0x588586){_0x380c29=_0x380c29-0x0;var _0x36a503=_0xe714[_0x380c29];return _0x36a503;};'use strict';var multer=require(_0x4e71('0x0'));var util=require(_0x4e71('0x1'));var path=require(_0x4e71('0x2'));var timeout=require(_0x4e71('0x3'));var express=require(_0x4e71('0x4'));var router=express[_0x4e71('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4e71('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x4e71('0x7')]('/',auth['isAuthenticated'](),controller[_0x4e71('0x8')]);router[_0x4e71('0x7')](_0x4e71('0x9'),auth[_0x4e71('0xa')](),controller['show']);router[_0x4e71('0xb')]('/',auth[_0x4e71('0xa')](),controller['create']);router[_0x4e71('0xc')](_0x4e71('0x9'),auth[_0x4e71('0xa')](),controller[_0x4e71('0xd')]);router[_0x4e71('0xe')](_0x4e71('0x9'),auth[_0x4e71('0xa')](),controller[_0x4e71('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3077=['create','delete','destroy','exports','multer','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x43f491,_0x1ee6d5){var _0x22c281=function(_0x21de6e){while(--_0x21de6e){_0x43f491['push'](_0x43f491['shift']());}};_0x22c281(++_0x1ee6d5);}(_0x3077,0x1a8));var _0x7307=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3077[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x7307('0x0'));var util=require('util');var path=require(_0x7307('0x1'));var timeout=require(_0x7307('0x2'));var express=require(_0x7307('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(_0x7307('0x4'));var controller=require('./intDynamics365Field.controller');router[_0x7307('0x5')]('/',auth[_0x7307('0x6')](),controller[_0x7307('0x7')]);router['get'](_0x7307('0x8'),auth[_0x7307('0x6')](),controller[_0x7307('0x9')]);router[_0x7307('0xa')]('/',auth[_0x7307('0x6')](),controller[_0x7307('0xb')]);router['put'](_0x7307('0x8'),auth[_0x7307('0x6')](),controller['update']);router[_0x7307('0xc')](_0x7307('0x8'),auth[_0x7307('0x6')](),controller[_0x7307('0xd')]);module[_0x7307('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 1cb0d57..1541d78 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 _0x4c95=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x140202,_0x4245c7){var _0x3037c2=function(_0x525d19){while(--_0x525d19){_0x140202['push'](_0x140202['shift']());}};_0x3037c2(++_0x4245c7);}(_0x4c95,0xc9));var _0x54c9=function(_0x43e01b,_0x54a614){_0x43e01b=_0x43e01b-0x0;var _0x25a296=_0x4c95[_0x43e01b];return _0x25a296;};'use strict';var Sequelize=require(_0x54c9('0x0'));module[_0x54c9('0x1')]={'type':{'type':Sequelize[_0x54c9('0x2')](_0x54c9('0x3'),_0x54c9('0x4'),_0x54c9('0x5'),_0x54c9('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x54c9('0x7')]},'key':{'type':Sequelize[_0x54c9('0x7')]},'keyType':{'type':Sequelize[_0x54c9('0x2')](_0x54c9('0x3'),_0x54c9('0x4'),_0x54c9('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x54c9('0x7')]},'nameField':{'type':Sequelize[_0x54c9('0x7')]},'customField':{'type':Sequelize[_0x54c9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x54c9('0x7')]}}; \ No newline at end of file +var _0xc307=['BOOLEAN','sequelize','exports','string','variable','picklist','STRING','ENUM'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xc307,0xa9));var _0x7c30=function(_0x4a5785,_0x424371){_0x4a5785=_0x4a5785-0x0;var _0x22ec65=_0xc307[_0x4a5785];return _0x22ec65;};'use strict';var Sequelize=require(_0x7c30('0x0'));module[_0x7c30('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7c30('0x2'),_0x7c30('0x3'),'customVariable','keyValue',_0x7c30('0x4')),'defaultValue':_0x7c30('0x2')},'content':{'type':Sequelize[_0x7c30('0x5')]},'key':{'type':Sequelize[_0x7c30('0x5')]},'keyType':{'type':Sequelize[_0x7c30('0x6')](_0x7c30('0x2'),_0x7c30('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7c30('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7c30('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c30('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index cd82775..ff1e085 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 _0x7e53=['util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0x531dcc,_0x35bd71){var _0x4416dd=function(_0x2b3eee){while(--_0x2b3eee){_0x531dcc['push'](_0x531dcc['shift']());}};_0x4416dd(++_0x35bd71);}(_0x7e53,0x1b7));var _0x37e5=function(_0x344ac0,_0x165060){_0x344ac0=_0x344ac0-0x0;var _0x123342=_0x7e53[_0x344ac0];return _0x123342;};'use strict';var emlformat=require(_0x37e5('0x0'));var rimraf=require(_0x37e5('0x1'));var zipdir=require(_0x37e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x37e5('0x3'));var BPromise=require(_0x37e5('0x4'));var Mustache=require('mustache');var util=require(_0x37e5('0x5'));var path=require(_0x37e5('0x6'));var sox=require(_0x37e5('0x7'));var csv=require(_0x37e5('0x8'));var ejs=require(_0x37e5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x37e5('0xa'));var jsforce=require(_0x37e5('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x37e5('0xc'));var Papa=require(_0x37e5('0xd'));var Redis=require(_0x37e5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x37e5('0xf'));var as=require(_0x37e5('0x10'));var hardwareService=require(_0x37e5('0x11'));var logger=require('../../config/logger')(_0x37e5('0x12'));var utils=require(_0x37e5('0x13'));var config=require(_0x37e5('0x14'));var licenseUtil=require(_0x37e5('0x15'));var db=require(_0x37e5('0x16'))['db'];function respondWithStatusCode(_0x182875,_0x33469f){_0x33469f=_0x33469f||0xcc;return function(_0x3c9988){if(_0x3c9988){return _0x182875['sendStatus'](_0x33469f);}return _0x182875[_0x37e5('0x17')](_0x33469f)[_0x37e5('0x18')]();};}function respondWithResult(_0x5dbb5a,_0x29fb2a){_0x29fb2a=_0x29fb2a||0xc8;return function(_0x40735f){if(_0x40735f){return _0x5dbb5a[_0x37e5('0x17')](_0x29fb2a)['json'](_0x40735f);}};}function respondWithFilteredResult(_0x54b38e,_0x5369c1){return function(_0x8ba126){if(_0x8ba126){var _0x553284=typeof _0x5369c1[_0x37e5('0x19')]===_0x37e5('0x1a')&&typeof _0x5369c1[_0x37e5('0x1b')]===_0x37e5('0x1a');var _0x32bf85=_0x8ba126[_0x37e5('0x1c')];var _0x32e974=_0x553284?0x0:_0x5369c1[_0x37e5('0x19')];var _0x15bdee=_0x553284?_0x8ba126['count']:_0x5369c1[_0x37e5('0x19')]+_0x5369c1[_0x37e5('0x1b')];var _0x4b5ab8;if(_0x15bdee>=_0x32bf85){_0x15bdee=_0x32bf85;_0x4b5ab8=0xc8;}else{_0x4b5ab8=0xce;}_0x54b38e['status'](_0x4b5ab8);return _0x54b38e[_0x37e5('0x1d')](_0x37e5('0x1e'),_0x32e974+'-'+_0x15bdee+'/'+_0x32bf85)[_0x37e5('0x1f')](_0x8ba126);}return null;};}function patchUpdates(_0x116efe){return function(_0x51834e){try{jsonpatch[_0x37e5('0x20')](_0x51834e,_0x116efe,!![]);}catch(_0x5c4daf){return BPromise[_0x37e5('0x21')](_0x5c4daf);}return _0x51834e[_0x37e5('0x22')]();};}function saveUpdates(_0x3e7e67,_0x4da53d){return function(_0x581d05){if(_0x581d05){return _0x581d05[_0x37e5('0x23')](_0x3e7e67)[_0x37e5('0x24')](function(_0x3c146a){return _0x3c146a;});}return null;};}function removeEntity(_0x247514,_0x7793c1){return function(_0x42d9ac){if(_0x42d9ac){return _0x42d9ac[_0x37e5('0x25')]()[_0x37e5('0x24')](function(){_0x247514[_0x37e5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x571b98,_0xa8d3d){return function(_0x4322a8){if(!_0x4322a8){_0x571b98[_0x37e5('0x26')](0x194);}return _0x4322a8;};}function handleError(_0x357533,_0x3f1e5f){_0x3f1e5f=_0x3f1e5f||0x1f4;return function(_0x4f09c2){logger[_0x37e5('0x27')](_0x4f09c2[_0x37e5('0x28')]);if(_0x4f09c2[_0x37e5('0x29')]){delete _0x4f09c2[_0x37e5('0x29')];}_0x357533[_0x37e5('0x17')](_0x3f1e5f)['send'](_0x4f09c2);};}exports[_0x37e5('0x2a')]=function(_0x80a7ed,_0x10a4d0){var _0x4c90a1={},_0x3957f3={},_0x5a2752={'count':0x0,'rows':[]};var _0x14915e=_[_0x37e5('0x2b')](db[_0x37e5('0x2c')][_0x37e5('0x2d')],function(_0x1a8055){return{'name':_0x1a8055[_0x37e5('0x2e')],'type':_0x1a8055[_0x37e5('0x2f')][_0x37e5('0x30')]};});_0x3957f3[_0x37e5('0x31')]=_[_0x37e5('0x2b')](_0x14915e,_0x37e5('0x29'));_0x3957f3['query']=_[_0x37e5('0x32')](_0x80a7ed[_0x37e5('0x33')]);_0x3957f3[_0x37e5('0x34')]=_[_0x37e5('0x35')](_0x3957f3[_0x37e5('0x31')],_0x3957f3[_0x37e5('0x33')]);_0x4c90a1[_0x37e5('0x36')]=_[_0x37e5('0x35')](_0x3957f3[_0x37e5('0x31')],qs[_0x37e5('0x37')](_0x80a7ed[_0x37e5('0x33')]['fields']));_0x4c90a1['attributes']=_0x4c90a1[_0x37e5('0x36')][_0x37e5('0x38')]?_0x4c90a1[_0x37e5('0x36')]:_0x3957f3[_0x37e5('0x31')];if(!_0x80a7ed[_0x37e5('0x33')][_0x37e5('0x39')]('nolimit')){_0x4c90a1['limit']=qs[_0x37e5('0x1b')](_0x80a7ed[_0x37e5('0x33')][_0x37e5('0x1b')]);_0x4c90a1['offset']=qs[_0x37e5('0x19')](_0x80a7ed['query'][_0x37e5('0x19')]);}_0x4c90a1[_0x37e5('0x3a')]=qs[_0x37e5('0x3b')](_0x80a7ed[_0x37e5('0x33')][_0x37e5('0x3b')]);_0x4c90a1['where']=qs[_0x37e5('0x34')](_[_0x37e5('0x3c')](_0x80a7ed['query'],_0x3957f3[_0x37e5('0x34')]),_0x14915e);if(_0x80a7ed[_0x37e5('0x33')][_0x37e5('0x3d')]){_0x4c90a1[_0x37e5('0x3e')]=_[_0x37e5('0x3f')](_0x4c90a1[_0x37e5('0x3e')],{'$or':_[_0x37e5('0x2b')](_0x14915e,function(_0x125ce3){if(_0x125ce3['type']!==_0x37e5('0x40')){var _0x5d47bb={};_0x5d47bb[_0x125ce3[_0x37e5('0x29')]]={'$like':'%'+_0x80a7ed[_0x37e5('0x33')]['filter']+'%'};return _0x5d47bb;}})});}_0x4c90a1=_[_0x37e5('0x3f')]({},_0x4c90a1,_0x80a7ed[_0x37e5('0x41')]);var _0x439f20={'where':_0x4c90a1[_0x37e5('0x3e')]};return db[_0x37e5('0x2c')]['count'](_0x439f20)['then'](function(_0x4d1807){_0x5a2752['count']=_0x4d1807;if(_0x80a7ed['query'][_0x37e5('0x42')]){_0x4c90a1[_0x37e5('0x43')]=[{'all':!![]}];}return db[_0x37e5('0x2c')]['findAll'](_0x4c90a1);})[_0x37e5('0x24')](function(_0x1cd372){_0x5a2752[_0x37e5('0x44')]=_0x1cd372;return _0x5a2752;})['then'](respondWithFilteredResult(_0x10a4d0,_0x4c90a1))[_0x37e5('0x45')](handleError(_0x10a4d0,null));};exports['show']=function(_0x240fff,_0x10d188){var _0x11e377={'raw':!![],'where':{'id':_0x240fff[_0x37e5('0x46')]['id']}},_0x782c27={};_0x782c27[_0x37e5('0x31')]=_[_0x37e5('0x32')](db[_0x37e5('0x2c')]['rawAttributes']);_0x782c27['query']=_[_0x37e5('0x32')](_0x240fff[_0x37e5('0x33')]);_0x782c27[_0x37e5('0x34')]=_['intersection'](_0x782c27[_0x37e5('0x31')],_0x782c27[_0x37e5('0x33')]);_0x11e377['attributes']=_[_0x37e5('0x35')](_0x782c27[_0x37e5('0x31')],qs[_0x37e5('0x37')](_0x240fff[_0x37e5('0x33')][_0x37e5('0x37')]));_0x11e377[_0x37e5('0x36')]=_0x11e377[_0x37e5('0x36')][_0x37e5('0x38')]?_0x11e377['attributes']:_0x782c27[_0x37e5('0x31')];if(_0x240fff['query'][_0x37e5('0x42')]){_0x11e377[_0x37e5('0x43')]=[{'all':!![]}];}_0x11e377=_[_0x37e5('0x3f')]({},_0x11e377,_0x240fff[_0x37e5('0x41')]);return db[_0x37e5('0x2c')][_0x37e5('0x47')](_0x11e377)['then'](handleEntityNotFound(_0x10d188,null))[_0x37e5('0x24')](respondWithResult(_0x10d188,null))[_0x37e5('0x45')](handleError(_0x10d188,null));};exports[_0x37e5('0x48')]=function(_0x484f6a,_0x650dcd){return db[_0x37e5('0x2c')]['create'](_0x484f6a[_0x37e5('0x49')],{})[_0x37e5('0x24')](respondWithResult(_0x650dcd,0xc9))[_0x37e5('0x45')](handleError(_0x650dcd,null));};exports[_0x37e5('0x23')]=function(_0x524c21,_0x50f43c){if(_0x524c21['body']['id']){delete _0x524c21[_0x37e5('0x49')]['id'];}return db[_0x37e5('0x2c')][_0x37e5('0x47')]({'where':{'id':_0x524c21[_0x37e5('0x46')]['id']}})[_0x37e5('0x24')](handleEntityNotFound(_0x50f43c,null))[_0x37e5('0x24')](saveUpdates(_0x524c21[_0x37e5('0x49')],null))[_0x37e5('0x24')](respondWithResult(_0x50f43c,null))[_0x37e5('0x45')](handleError(_0x50f43c,null));};exports['destroy']=function(_0x2af9b5,_0x3f284e){return db[_0x37e5('0x2c')]['find']({'where':{'id':_0x2af9b5['params']['id']}})[_0x37e5('0x24')](handleEntityNotFound(_0x3f284e,null))[_0x37e5('0x24')](removeEntity(_0x3f284e,null))['catch'](handleError(_0x3f284e,null));}; \ No newline at end of file +var _0xd4fe=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x40c226,_0xf31bd6){var _0x5e92bb=function(_0x21e398){while(--_0x21e398){_0x40c226['push'](_0x40c226['shift']());}};_0x5e92bb(++_0xf31bd6);}(_0xd4fe,0xda));var _0xed4f=function(_0x12cc66,_0x50a056){_0x12cc66=_0x12cc66-0x0;var _0x4ce9d0=_0xd4fe[_0x12cc66];return _0x4ce9d0;};'use strict';var emlformat=require(_0xed4f('0x0'));var rimraf=require(_0xed4f('0x1'));var zipdir=require(_0xed4f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed4f('0x3'));var moment=require(_0xed4f('0x4'));var BPromise=require(_0xed4f('0x5'));var Mustache=require(_0xed4f('0x6'));var util=require('util');var path=require(_0xed4f('0x7'));var sox=require(_0xed4f('0x8'));var csv=require(_0xed4f('0x9'));var ejs=require(_0xed4f('0xa'));var fs=require('fs');var fs_extra=require(_0xed4f('0xb'));var _=require(_0xed4f('0xc'));var squel=require(_0xed4f('0xd'));var crypto=require(_0xed4f('0xe'));var jsforce=require(_0xed4f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed4f('0x10'));var Papa=require(_0xed4f('0x11'));var Redis=require(_0xed4f('0x12'));var authService=require(_0xed4f('0x13'));var qs=require(_0xed4f('0x14'));var as=require(_0xed4f('0x15'));var hardwareService=require(_0xed4f('0x16'));var logger=require(_0xed4f('0x17'))('api');var utils=require(_0xed4f('0x18'));var config=require(_0xed4f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xed4f('0x1a'))['db'];function respondWithStatusCode(_0x14250c,_0x46c6e2){_0x46c6e2=_0x46c6e2||0xcc;return function(_0x148c3f){if(_0x148c3f){return _0x14250c[_0xed4f('0x1b')](_0x46c6e2);}return _0x14250c[_0xed4f('0x1c')](_0x46c6e2)[_0xed4f('0x1d')]();};}function respondWithResult(_0x3916c7,_0x1f22ab){_0x1f22ab=_0x1f22ab||0xc8;return function(_0xd97080){if(_0xd97080){return _0x3916c7[_0xed4f('0x1c')](_0x1f22ab)[_0xed4f('0x1e')](_0xd97080);}};}function respondWithFilteredResult(_0x4a8b76,_0x5ea18d){return function(_0x501eca){if(_0x501eca){var _0x90c69=typeof _0x5ea18d[_0xed4f('0x1f')]==='undefined'&&typeof _0x5ea18d[_0xed4f('0x20')]===_0xed4f('0x21');var _0x41be80=_0x501eca[_0xed4f('0x22')];var _0x535a32=_0x90c69?0x0:_0x5ea18d['offset'];var _0x15a07c=_0x90c69?_0x501eca[_0xed4f('0x22')]:_0x5ea18d[_0xed4f('0x1f')]+_0x5ea18d[_0xed4f('0x20')];var _0x3b721e;if(_0x15a07c>=_0x41be80){_0x15a07c=_0x41be80;_0x3b721e=0xc8;}else{_0x3b721e=0xce;}_0x4a8b76['status'](_0x3b721e);return _0x4a8b76[_0xed4f('0x23')](_0xed4f('0x24'),_0x535a32+'-'+_0x15a07c+'/'+_0x41be80)['json'](_0x501eca);}return null;};}function patchUpdates(_0x24d91b){return function(_0x2bd1d7){try{jsonpatch[_0xed4f('0x25')](_0x2bd1d7,_0x24d91b,!![]);}catch(_0x239dc4){return BPromise[_0xed4f('0x26')](_0x239dc4);}return _0x2bd1d7[_0xed4f('0x27')]();};}function saveUpdates(_0x14bce8,_0x45ca18){return function(_0x2347f2){if(_0x2347f2){return _0x2347f2[_0xed4f('0x28')](_0x14bce8)[_0xed4f('0x29')](function(_0x2165bb){return _0x2165bb;});}return null;};}function removeEntity(_0x35933b,_0x48be03){return function(_0x43bd2a){if(_0x43bd2a){return _0x43bd2a['destroy']()[_0xed4f('0x29')](function(){_0x35933b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x221486,_0x45b15c){return function(_0x5aee5d){if(!_0x5aee5d){_0x221486[_0xed4f('0x1b')](0x194);}return _0x5aee5d;};}function handleError(_0xaecfe3,_0x1aedd0){_0x1aedd0=_0x1aedd0||0x1f4;return function(_0x591c9e){logger[_0xed4f('0x2a')](_0x591c9e[_0xed4f('0x2b')]);if(_0x591c9e[_0xed4f('0x2c')]){delete _0x591c9e[_0xed4f('0x2c')];}_0xaecfe3[_0xed4f('0x1c')](_0x1aedd0)[_0xed4f('0x2d')](_0x591c9e);};}exports[_0xed4f('0x2e')]=function(_0x1bc727,_0x584a1f){var _0x422260={},_0x57a937={},_0x4c8726={'count':0x0,'rows':[]};var _0x4f7915=_[_0xed4f('0x2f')](db[_0xed4f('0x30')][_0xed4f('0x31')],function(_0x2f869b){return{'name':_0x2f869b[_0xed4f('0x32')],'type':_0x2f869b[_0xed4f('0x33')][_0xed4f('0x34')]};});_0x57a937[_0xed4f('0x35')]=_[_0xed4f('0x2f')](_0x4f7915,_0xed4f('0x2c'));_0x57a937[_0xed4f('0x36')]=_[_0xed4f('0x37')](_0x1bc727[_0xed4f('0x36')]);_0x57a937['filters']=_[_0xed4f('0x38')](_0x57a937[_0xed4f('0x35')],_0x57a937['query']);_0x422260[_0xed4f('0x39')]=_[_0xed4f('0x38')](_0x57a937[_0xed4f('0x35')],qs[_0xed4f('0x3a')](_0x1bc727[_0xed4f('0x36')]['fields']));_0x422260[_0xed4f('0x39')]=_0x422260[_0xed4f('0x39')][_0xed4f('0x3b')]?_0x422260[_0xed4f('0x39')]:_0x57a937[_0xed4f('0x35')];if(!_0x1bc727['query']['hasOwnProperty'](_0xed4f('0x3c'))){_0x422260[_0xed4f('0x20')]=qs['limit'](_0x1bc727[_0xed4f('0x36')][_0xed4f('0x20')]);_0x422260[_0xed4f('0x1f')]=qs[_0xed4f('0x1f')](_0x1bc727[_0xed4f('0x36')]['offset']);}_0x422260[_0xed4f('0x3d')]=qs[_0xed4f('0x3e')](_0x1bc727[_0xed4f('0x36')][_0xed4f('0x3e')]);_0x422260[_0xed4f('0x3f')]=qs[_0xed4f('0x40')](_['pick'](_0x1bc727[_0xed4f('0x36')],_0x57a937[_0xed4f('0x40')]),_0x4f7915);if(_0x1bc727[_0xed4f('0x36')][_0xed4f('0x41')]){_0x422260['where']=_[_0xed4f('0x42')](_0x422260['where'],{'$or':_['map'](_0x4f7915,function(_0x1f90de){if(_0x1f90de[_0xed4f('0x33')]!=='VIRTUAL'){var _0x428355={};_0x428355[_0x1f90de[_0xed4f('0x2c')]]={'$like':'%'+_0x1bc727[_0xed4f('0x36')][_0xed4f('0x41')]+'%'};return _0x428355;}})});}_0x422260=_[_0xed4f('0x42')]({},_0x422260,_0x1bc727[_0xed4f('0x43')]);var _0x1028fe={'where':_0x422260[_0xed4f('0x3f')]};return db[_0xed4f('0x30')][_0xed4f('0x22')](_0x1028fe)[_0xed4f('0x29')](function(_0x55ec75){_0x4c8726['count']=_0x55ec75;if(_0x1bc727[_0xed4f('0x36')][_0xed4f('0x44')]){_0x422260['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xed4f('0x45')](_0x422260);})['then'](function(_0x2af163){_0x4c8726[_0xed4f('0x46')]=_0x2af163;return _0x4c8726;})[_0xed4f('0x29')](respondWithFilteredResult(_0x584a1f,_0x422260))[_0xed4f('0x47')](handleError(_0x584a1f,null));};exports[_0xed4f('0x48')]=function(_0x343af2,_0x27d094){var _0x39e04f={'raw':!![],'where':{'id':_0x343af2[_0xed4f('0x49')]['id']}},_0x4fda37={};_0x4fda37['model']=_[_0xed4f('0x37')](db['Dynamics365Field'][_0xed4f('0x31')]);_0x4fda37[_0xed4f('0x36')]=_[_0xed4f('0x37')](_0x343af2[_0xed4f('0x36')]);_0x4fda37['filters']=_[_0xed4f('0x38')](_0x4fda37[_0xed4f('0x35')],_0x4fda37['query']);_0x39e04f['attributes']=_['intersection'](_0x4fda37[_0xed4f('0x35')],qs[_0xed4f('0x3a')](_0x343af2[_0xed4f('0x36')][_0xed4f('0x3a')]));_0x39e04f[_0xed4f('0x39')]=_0x39e04f[_0xed4f('0x39')][_0xed4f('0x3b')]?_0x39e04f['attributes']:_0x4fda37[_0xed4f('0x35')];if(_0x343af2[_0xed4f('0x36')]['includeAll']){_0x39e04f[_0xed4f('0x4a')]=[{'all':!![]}];}_0x39e04f=_[_0xed4f('0x42')]({},_0x39e04f,_0x343af2[_0xed4f('0x43')]);return db['Dynamics365Field'][_0xed4f('0x4b')](_0x39e04f)[_0xed4f('0x29')](handleEntityNotFound(_0x27d094,null))[_0xed4f('0x29')](respondWithResult(_0x27d094,null))['catch'](handleError(_0x27d094,null));};exports[_0xed4f('0x4c')]=function(_0x41a38b,_0x406d64){return db[_0xed4f('0x30')]['create'](_0x41a38b[_0xed4f('0x4d')],{})[_0xed4f('0x29')](respondWithResult(_0x406d64,0xc9))[_0xed4f('0x47')](handleError(_0x406d64,null));};exports[_0xed4f('0x28')]=function(_0x281947,_0x4fd3a0){if(_0x281947[_0xed4f('0x4d')]['id']){delete _0x281947[_0xed4f('0x4d')]['id'];}return db[_0xed4f('0x30')][_0xed4f('0x4b')]({'where':{'id':_0x281947[_0xed4f('0x49')]['id']}})[_0xed4f('0x29')](handleEntityNotFound(_0x4fd3a0,null))['then'](saveUpdates(_0x281947['body'],null))['then'](respondWithResult(_0x4fd3a0,null))[_0xed4f('0x47')](handleError(_0x4fd3a0,null));};exports['destroy']=function(_0x52238c,_0x4dd813){return db['Dynamics365Field'][_0xed4f('0x4b')]({'where':{'id':_0x52238c[_0xed4f('0x49')]['id']}})[_0xed4f('0x29')](handleEntityNotFound(_0x4dd813,null))[_0xed4f('0x29')](removeEntity(_0x4dd813,null))['catch'](handleError(_0x4dd813,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 755a2bf..1c74681 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 _0xc6cb=['util','../../config/logger','moment','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','FieldId','lodash'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xc6cb,0x77));var _0xbc6c=function(_0xcb2409,_0x401674){_0xcb2409=_0xcb2409-0x0;var _0x30e960=_0xc6cb[_0xcb2409];return _0x30e960;};'use strict';var _=require(_0xbc6c('0x0'));var util=require(_0xbc6c('0x1'));var logger=require(_0xbc6c('0x2'))('api');var moment=require(_0xbc6c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc6c('0x4'));var rimraf=require(_0xbc6c('0x5'));var config=require(_0xbc6c('0x6'));var attributes=require(_0xbc6c('0x7'));module[_0xbc6c('0x8')]=function(_0x348c17,_0x2ccc47){return _0x348c17['define'](_0xbc6c('0x9'),attributes,{'tableName':_0xbc6c('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xbc6c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b77=['api','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','FieldId','util','../../config/logger'];(function(_0x53041d,_0x20b56d){var _0x593d98=function(_0x551ea2){while(--_0x551ea2){_0x53041d['push'](_0x53041d['shift']());}};_0x593d98(++_0x20b56d);}(_0x1b77,0xf0));var _0x71b7=function(_0x218687,_0x2d47d1){_0x218687=_0x218687-0x0;var _0x24329f=_0x1b77[_0x218687];return _0x24329f;};'use strict';var _=require('lodash');var util=require(_0x71b7('0x0'));var logger=require(_0x71b7('0x1'))(_0x71b7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x71b7('0x3'));var fs=require('fs');var path=require(_0x71b7('0x4'));var rimraf=require('rimraf');var config=require(_0x71b7('0x5'));var attributes=require(_0x71b7('0x6'));module[_0x71b7('0x7')]=function(_0x34519f,_0x5e2c5b){return _0x34519f['define']('Dynamics365Field',attributes,{'tableName':_0x71b7('0x8'),'paranoid':![],'indexes':[{'name':_0x71b7('0x9'),'fields':['idField',_0x71b7('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 2c6a52f..92c46a4 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 _0xcf58=['rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x56b440,_0x41f1e2){var _0x2548b4=function(_0x5e3687){while(--_0x5e3687){_0x56b440['push'](_0x56b440['shift']());}};_0x2548b4(++_0x41f1e2);}(_0xcf58,0x127));var _0x8cf5=function(_0x48af1e,_0x33b850){_0x48af1e=_0x48af1e-0x0;var _0x104d5f=_0xcf58[_0x48af1e];return _0x104d5f;};'use strict';var _=require(_0x8cf5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8cf5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8cf5('0x2'));var db=require(_0x8cf5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cf5('0x4'))(_0x8cf5('0x5'));var config=require('../../config/environment');var jayson=require(_0x8cf5('0x6'));var client=jayson[_0x8cf5('0x7')][_0x8cf5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdf3d39,_0x549152,_0x16baf3){return new BPromise(function(_0x4cd575,_0x402037){return client[_0x8cf5('0x9')](_0xdf3d39,_0x16baf3)[_0x8cf5('0xa')](function(_0x42f47d){logger[_0x8cf5('0xb')](_0x8cf5('0xc'),_0x549152,_0x8cf5('0xd'));logger[_0x8cf5('0xe')](_0x8cf5('0xf'),_0x549152,_0x8cf5('0xd'),JSON[_0x8cf5('0x10')](_0x42f47d));if(_0x42f47d[_0x8cf5('0x11')]){if(_0x42f47d[_0x8cf5('0x11')][_0x8cf5('0x12')]===0x1f4){logger[_0x8cf5('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x549152,_0x42f47d[_0x8cf5('0x11')][_0x8cf5('0x13')]);return _0x402037(_0x42f47d[_0x8cf5('0x11')][_0x8cf5('0x13')]);}logger[_0x8cf5('0x11')](_0x8cf5('0xc'),_0x549152,_0x42f47d[_0x8cf5('0x11')][_0x8cf5('0x13')]);return _0x4cd575(_0x42f47d['error'][_0x8cf5('0x13')]);}else{logger[_0x8cf5('0xb')](_0x8cf5('0xc'),_0x549152,_0x8cf5('0xd'));_0x4cd575(_0x42f47d['result'][_0x8cf5('0x13')]);}})['catch'](function(_0x155fa7){logger['error'](_0x8cf5('0xc'),_0x549152,_0x155fa7);_0x402037(_0x155fa7);});});} \ No newline at end of file +var _0x1901=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','info'];(function(_0xa13313,_0xcf709e){var _0x48ee48=function(_0x1ba259){while(--_0x1ba259){_0xa13313['push'](_0xa13313['shift']());}};_0x48ee48(++_0xcf709e);}(_0x1901,0x1b9));var _0x1190=function(_0x157712,_0xc29e01){_0x157712=_0x157712-0x0;var _0x23e9d9=_0x1901[_0x157712];return _0x23e9d9;};'use strict';var _=require(_0x1190('0x0'));var util=require(_0x1190('0x1'));var moment=require('moment');var BPromise=require(_0x1190('0x2'));var rs=require(_0x1190('0x3'));var fs=require('fs');var Redis=require(_0x1190('0x4'));var db=require(_0x1190('0x5'))['db'];var utils=require(_0x1190('0x6'));var logger=require(_0x1190('0x7'))(_0x1190('0x8'));var config=require(_0x1190('0x9'));var jayson=require(_0x1190('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x641615,_0x57adec,_0x1a0ded){return new BPromise(function(_0x3bffb7,_0x53bc81){return client[_0x1190('0xb')](_0x641615,_0x1a0ded)[_0x1190('0xc')](function(_0x361459){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x57adec,_0x1190('0xd'));logger[_0x1190('0xe')](_0x1190('0xf'),_0x57adec,_0x1190('0xd'),JSON['stringify'](_0x361459));if(_0x361459[_0x1190('0x10')]){if(_0x361459[_0x1190('0x10')][_0x1190('0x11')]===0x1f4){logger['error'](_0x1190('0x12'),_0x57adec,_0x361459[_0x1190('0x10')][_0x1190('0x13')]);return _0x53bc81(_0x361459[_0x1190('0x10')]['message']);}logger[_0x1190('0x10')](_0x1190('0x12'),_0x57adec,_0x361459[_0x1190('0x10')]['message']);return _0x3bffb7(_0x361459['error'][_0x1190('0x13')]);}else{logger[_0x1190('0x14')](_0x1190('0x12'),_0x57adec,'request\x20sent');_0x3bffb7(_0x361459[_0x1190('0x15')][_0x1190('0x13')]);}})['catch'](function(_0x8ba948){logger['error'](_0x1190('0x12'),_0x57adec,_0x8ba948);_0x53bc81(_0x8ba948);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 13ffff0..cade46a 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 _0x5d5c=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','get','getFields','post','create','addConfiguration','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x1223bb,_0x3f2f16){var _0x18a315=function(_0x4cfc01){while(--_0x4cfc01){_0x1223bb['push'](_0x1223bb['shift']());}};_0x18a315(++_0x3f2f16);}(_0x5d5c,0x12b));var _0xc5d5=function(_0x1c406b,_0x556cbd){_0x1c406b=_0x1c406b-0x0;var _0x7e56ff=_0x5d5c[_0x1c406b];return _0x7e56ff;};'use strict';var multer=require(_0xc5d5('0x0'));var util=require(_0xc5d5('0x1'));var path=require('path');var timeout=require(_0xc5d5('0x2'));var express=require(_0xc5d5('0x3'));var router=express[_0xc5d5('0x4')]();var fs_extra=require(_0xc5d5('0x5'));var auth=require(_0xc5d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc5d5('0x7'));var controller=require(_0xc5d5('0x8'));router['get']('/',auth[_0xc5d5('0x9')](),controller[_0xc5d5('0xa')]);router['get'](_0xc5d5('0xb'),auth[_0xc5d5('0x9')](),controller['show']);router['get'](_0xc5d5('0xc'),auth[_0xc5d5('0x9')](),controller[_0xc5d5('0xd')]);router[_0xc5d5('0xe')]('/:id/fields',auth[_0xc5d5('0x9')](),controller[_0xc5d5('0xf')]);router[_0xc5d5('0x10')]('/',auth[_0xc5d5('0x9')](),controller[_0xc5d5('0x11')]);router['post'](_0xc5d5('0xc'),auth['isAuthenticated'](),controller[_0xc5d5('0x12')]);router[_0xc5d5('0x13')]('/:id',auth[_0xc5d5('0x9')](),controller['update']);router[_0xc5d5('0x14')](_0xc5d5('0xb'),auth[_0xc5d5('0x9')](),controller['destroy']);module[_0xc5d5('0x15')]=router; \ No newline at end of file +var _0x085d=['/:id/configurations','/:id/fields','getFields','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x27fc25,_0x1cbcd1){var _0x9ede0=function(_0x33b54d){while(--_0x33b54d){_0x27fc25['push'](_0x27fc25['shift']());}};_0x9ede0(++_0x1cbcd1);}(_0x085d,0x162));var _0xd085=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0x085d[_0x324e86];return _0x592846;};'use strict';var multer=require('multer');var util=require(_0xd085('0x0'));var path=require(_0xd085('0x1'));var timeout=require(_0xd085('0x2'));var express=require(_0xd085('0x3'));var router=express[_0xd085('0x4')]();var fs_extra=require(_0xd085('0x5'));var auth=require(_0xd085('0x6'));var interaction=require(_0xd085('0x7'));var config=require(_0xd085('0x8'));var controller=require(_0xd085('0x9'));router[_0xd085('0xa')]('/',auth[_0xd085('0xb')](),controller[_0xd085('0xc')]);router[_0xd085('0xa')](_0xd085('0xd'),auth[_0xd085('0xb')](),controller['show']);router['get'](_0xd085('0xe'),auth[_0xd085('0xb')](),controller['getConfigurations']);router['get'](_0xd085('0xf'),auth[_0xd085('0xb')](),controller[_0xd085('0x10')]);router[_0xd085('0x11')]('/',auth[_0xd085('0xb')](),controller[_0xd085('0x12')]);router[_0xd085('0x11')](_0xd085('0xe'),auth[_0xd085('0xb')](),controller['addConfiguration']);router['put'](_0xd085('0xd'),auth[_0xd085('0xb')](),controller[_0xd085('0x13')]);router[_0xd085('0x14')](_0xd085('0xd'),auth[_0xd085('0xb')](),controller[_0xd085('0x15')]);module[_0xd085('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 4caede3..323c262 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 _0x0424=['username','STRING'];(function(_0x1af577,_0x1bd440){var _0x18ec4f=function(_0x4c9f95){while(--_0x4c9f95){_0x1af577['push'](_0x1af577['shift']());}};_0x18ec4f(++_0x1bd440);}(_0x0424,0x159));var _0x4042=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0x0424[_0x4a4a43];return _0x5893a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xeb3b=['sequelize','exports','STRING'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x57532c,_0x2c75cf){_0x57532c=_0x57532c-0x0;var _0x5cb9a6=_0xeb3b[_0x57532c];return _0x5cb9a6;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')]},'description':{'type':Sequelize[_0xbeb3('0x2')]},'username':{'type':Sequelize[_0xbeb3('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbeb3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 30bb30e..4223f0f 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 _0xcd31=['choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','count','offset','limit','status','set','apply','save','destroy','then','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','show','include','options','find','create','body','catch','params','getConfigurations','length','order','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','Subjects','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','apiKey','base64','requester','agent','description','priority','source','ticket_type','group','company','includes','default','custom_text','custom_dropdown','label'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd31,0x15d));var _0x1cd3=function(_0x188856,_0x180b4d){_0x188856=_0x188856-0x0;var _0x57fa26=_0xcd31[_0x188856];return _0x57fa26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cd3('0x0'));var zipdir=require(_0x1cd3('0x1'));var jsonpatch=require(_0x1cd3('0x2'));var rp=require('request-promise');var moment=require(_0x1cd3('0x3'));var BPromise=require(_0x1cd3('0x4'));var Mustache=require(_0x1cd3('0x5'));var util=require(_0x1cd3('0x6'));var path=require(_0x1cd3('0x7'));var sox=require(_0x1cd3('0x8'));var csv=require('to-csv');var ejs=require(_0x1cd3('0x9'));var fs=require('fs');var fs_extra=require(_0x1cd3('0xa'));var _=require(_0x1cd3('0xb'));var squel=require('squel');var crypto=require(_0x1cd3('0xc'));var jsforce=require(_0x1cd3('0xd'));var deskjs=require(_0x1cd3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1cd3('0xf'));var Papa=require(_0x1cd3('0x10'));var Redis=require(_0x1cd3('0x11'));var authService=require(_0x1cd3('0x12'));var qs=require(_0x1cd3('0x13'));var as=require(_0x1cd3('0x14'));var hardwareService=require(_0x1cd3('0x15'));var logger=require('../../config/logger')(_0x1cd3('0x16'));var utils=require(_0x1cd3('0x17'));var config=require(_0x1cd3('0x18'));var licenseUtil=require(_0x1cd3('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1cd3('0x1a'));function respondWithStatusCode(_0x4c9c6d,_0x41016f){_0x41016f=_0x41016f||0xcc;return function(_0x35a9ae){if(_0x35a9ae){return _0x4c9c6d[_0x1cd3('0x1b')](_0x41016f);}return _0x4c9c6d['status'](_0x41016f)['end']();};}function respondWithResult(_0x1a874c,_0x1def57){_0x1def57=_0x1def57||0xc8;return function(_0x41585f){if(_0x41585f){return _0x1a874c['status'](_0x1def57)[_0x1cd3('0x1c')](_0x41585f);}};}function respondWithFilteredResult(_0x40cbbf,_0x5a2b84){return function(_0x418da3){if(_0x418da3){var _0x576d7a=typeof _0x5a2b84['offset']==='undefined'&&typeof _0x5a2b84['limit']==='undefined';var _0x5acebb=_0x418da3[_0x1cd3('0x1d')];var _0x40a85e=_0x576d7a?0x0:_0x5a2b84[_0x1cd3('0x1e')];var _0xc3f461=_0x576d7a?_0x418da3[_0x1cd3('0x1d')]:_0x5a2b84[_0x1cd3('0x1e')]+_0x5a2b84[_0x1cd3('0x1f')];var _0x2d4f05;if(_0xc3f461>=_0x5acebb){_0xc3f461=_0x5acebb;_0x2d4f05=0xc8;}else{_0x2d4f05=0xce;}_0x40cbbf[_0x1cd3('0x20')](_0x2d4f05);return _0x40cbbf[_0x1cd3('0x21')]('Content-Range',_0x40a85e+'-'+_0xc3f461+'/'+_0x5acebb)[_0x1cd3('0x1c')](_0x418da3);}return null;};}function patchUpdates(_0x2368b3){return function(_0x58f10e){try{jsonpatch[_0x1cd3('0x22')](_0x58f10e,_0x2368b3,!![]);}catch(_0x1ec1b4){return BPromise['reject'](_0x1ec1b4);}return _0x58f10e[_0x1cd3('0x23')]();};}function saveUpdates(_0x159d22,_0x330741){return function(_0x2d5e9a){if(_0x2d5e9a){return _0x2d5e9a['update'](_0x159d22)['then'](function(_0x29ff8c){return _0x29ff8c;});}return null;};}function removeEntity(_0x1a6dad,_0x49c7b1){return function(_0x578cab){if(_0x578cab){return _0x578cab[_0x1cd3('0x24')]()[_0x1cd3('0x25')](function(){_0x1a6dad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34b15f,_0x1589fa){return function(_0x5ca367){if(!_0x5ca367){_0x34b15f['sendStatus'](0x194);}return _0x5ca367;};}function handleError(_0x1c86f6,_0xc311a9){_0xc311a9=_0xc311a9||0x1f4;return function(_0x3161d4){logger['error'](_0x3161d4['stack']);if(_0x3161d4[_0x1cd3('0x26')]){delete _0x3161d4['name'];}_0x1c86f6[_0x1cd3('0x20')](_0xc311a9)[_0x1cd3('0x27')](_0x3161d4);};}exports[_0x1cd3('0x28')]=function(_0x4b7c0b,_0xae9d0c){var _0x53979a={},_0x47578c={},_0x3e3afb={'count':0x0,'rows':[]};var _0x1eb3c8=_['map'](db[_0x1cd3('0x29')][_0x1cd3('0x2a')],function(_0x3d4963){return{'name':_0x3d4963[_0x1cd3('0x2b')],'type':_0x3d4963[_0x1cd3('0x2c')]['key']};});_0x47578c[_0x1cd3('0x2d')]=_[_0x1cd3('0x2e')](_0x1eb3c8,_0x1cd3('0x26'));_0x47578c[_0x1cd3('0x2f')]=_[_0x1cd3('0x30')](_0x4b7c0b[_0x1cd3('0x2f')]);_0x47578c['filters']=_[_0x1cd3('0x31')](_0x47578c[_0x1cd3('0x2d')],_0x47578c['query']);_0x53979a['attributes']=_[_0x1cd3('0x31')](_0x47578c[_0x1cd3('0x2d')],qs[_0x1cd3('0x32')](_0x4b7c0b[_0x1cd3('0x2f')][_0x1cd3('0x32')]));_0x53979a['attributes']=_0x53979a[_0x1cd3('0x33')]['length']?_0x53979a['attributes']:_0x47578c[_0x1cd3('0x2d')];if(!_0x4b7c0b[_0x1cd3('0x2f')][_0x1cd3('0x34')](_0x1cd3('0x35'))){_0x53979a['limit']=qs[_0x1cd3('0x1f')](_0x4b7c0b['query'][_0x1cd3('0x1f')]);_0x53979a[_0x1cd3('0x1e')]=qs[_0x1cd3('0x1e')](_0x4b7c0b[_0x1cd3('0x2f')]['offset']);}_0x53979a['order']=qs[_0x1cd3('0x36')](_0x4b7c0b['query'][_0x1cd3('0x36')]);_0x53979a[_0x1cd3('0x37')]=qs[_0x1cd3('0x38')](_[_0x1cd3('0x39')](_0x4b7c0b[_0x1cd3('0x2f')],_0x47578c['filters']),_0x1eb3c8);if(_0x4b7c0b['query']['filter']){_0x53979a['where']=_[_0x1cd3('0x3a')](_0x53979a['where'],{'$or':_[_0x1cd3('0x2e')](_0x1eb3c8,function(_0x4bd829){if(_0x4bd829[_0x1cd3('0x2c')]!==_0x1cd3('0x3b')){var _0x50c574={};_0x50c574[_0x4bd829[_0x1cd3('0x26')]]={'$like':'%'+_0x4b7c0b[_0x1cd3('0x2f')][_0x1cd3('0x3c')]+'%'};return _0x50c574;}})});}_0x53979a=_['merge']({},_0x53979a,_0x4b7c0b['options']);var _0x2d4fa7={'where':_0x53979a[_0x1cd3('0x37')]};return db[_0x1cd3('0x29')][_0x1cd3('0x1d')](_0x2d4fa7)[_0x1cd3('0x25')](function(_0x2fd106){_0x3e3afb[_0x1cd3('0x1d')]=_0x2fd106;if(_0x4b7c0b[_0x1cd3('0x2f')][_0x1cd3('0x3d')]){_0x53979a['include']=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x53979a);})[_0x1cd3('0x25')](function(_0x1da815){_0x3e3afb['rows']=_0x1da815;return _0x3e3afb;})[_0x1cd3('0x25')](respondWithFilteredResult(_0xae9d0c,_0x53979a))['catch'](handleError(_0xae9d0c,null));};exports[_0x1cd3('0x3e')]=function(_0x2f6a00,_0x2109a2){var _0x326f08={'raw':![],'where':{'id':_0x2f6a00['params']['id']}},_0x48f5ee={};_0x48f5ee['model']=_[_0x1cd3('0x30')](db['FreshdeskAccount']['rawAttributes']);_0x48f5ee[_0x1cd3('0x2f')]=_['keys'](_0x2f6a00[_0x1cd3('0x2f')]);_0x48f5ee[_0x1cd3('0x38')]=_[_0x1cd3('0x31')](_0x48f5ee[_0x1cd3('0x2d')],_0x48f5ee[_0x1cd3('0x2f')]);_0x326f08[_0x1cd3('0x33')]=_[_0x1cd3('0x31')](_0x48f5ee[_0x1cd3('0x2d')],qs['fields'](_0x2f6a00[_0x1cd3('0x2f')][_0x1cd3('0x32')]));_0x326f08[_0x1cd3('0x33')]=_0x326f08['attributes']['length']?_0x326f08[_0x1cd3('0x33')]:_0x48f5ee[_0x1cd3('0x2d')];if(_0x2f6a00[_0x1cd3('0x2f')][_0x1cd3('0x3d')]){_0x326f08[_0x1cd3('0x3f')]=[{'all':!![]}];}_0x326f08=_[_0x1cd3('0x3a')]({},_0x326f08,_0x2f6a00[_0x1cd3('0x40')]);return db['FreshdeskAccount'][_0x1cd3('0x41')](_0x326f08)[_0x1cd3('0x25')](handleEntityNotFound(_0x2109a2,null))[_0x1cd3('0x25')](respondWithResult(_0x2109a2,null))['catch'](handleError(_0x2109a2,null));};exports['create']=function(_0x2605c5,_0x105ddc){return db[_0x1cd3('0x29')][_0x1cd3('0x42')](_0x2605c5[_0x1cd3('0x43')],{})['then'](respondWithResult(_0x105ddc,0xc9))['catch'](handleError(_0x105ddc,null));};exports['update']=function(_0x3cde0b,_0x16f16c){if(_0x3cde0b[_0x1cd3('0x43')]['id']){delete _0x3cde0b[_0x1cd3('0x43')]['id'];}return db[_0x1cd3('0x29')]['find']({'where':{'id':_0x3cde0b['params']['id']}})[_0x1cd3('0x25')](handleEntityNotFound(_0x16f16c,null))[_0x1cd3('0x25')](saveUpdates(_0x3cde0b['body'],null))[_0x1cd3('0x25')](respondWithResult(_0x16f16c,null))[_0x1cd3('0x44')](handleError(_0x16f16c,null));};exports[_0x1cd3('0x24')]=function(_0x5c7d9c,_0x4ddfba){return db[_0x1cd3('0x29')]['find']({'where':{'id':_0x5c7d9c[_0x1cd3('0x45')]['id']}})[_0x1cd3('0x25')](handleEntityNotFound(_0x4ddfba,null))[_0x1cd3('0x25')](removeEntity(_0x4ddfba,null))[_0x1cd3('0x44')](handleError(_0x4ddfba,null));};exports[_0x1cd3('0x46')]=function(_0xfaecf0,_0x361bb2,_0x2a2a30){var _0x5734f0={};var _0x251822={};var _0xa261fc;var _0xbd4ea2;return db[_0x1cd3('0x29')]['findOne']({'where':{'id':_0xfaecf0[_0x1cd3('0x45')]['id']}})[_0x1cd3('0x25')](handleEntityNotFound(_0x361bb2,null))[_0x1cd3('0x25')](function(_0x4a493a){if(_0x4a493a){_0xa261fc=_0x4a493a;_0x251822['model']=_[_0x1cd3('0x30')](db['FreshdeskConfiguration'][_0x1cd3('0x2a')]);_0x251822[_0x1cd3('0x2f')]=_[_0x1cd3('0x30')](_0xfaecf0[_0x1cd3('0x2f')]);_0x251822['filters']=_[_0x1cd3('0x31')](_0x251822[_0x1cd3('0x2d')],_0x251822[_0x1cd3('0x2f')]);_0x5734f0[_0x1cd3('0x33')]=_['intersection'](_0x251822[_0x1cd3('0x2d')],qs[_0x1cd3('0x32')](_0xfaecf0['query']['fields']));_0x5734f0[_0x1cd3('0x33')]=_0x5734f0['attributes'][_0x1cd3('0x47')]?_0x5734f0[_0x1cd3('0x33')]:_0x251822[_0x1cd3('0x2d')];_0x5734f0[_0x1cd3('0x48')]=qs[_0x1cd3('0x36')](_0xfaecf0[_0x1cd3('0x2f')][_0x1cd3('0x36')]);_0x5734f0['where']=qs[_0x1cd3('0x38')](_[_0x1cd3('0x39')](_0xfaecf0[_0x1cd3('0x2f')],_0x251822[_0x1cd3('0x38')]));if(_0xfaecf0[_0x1cd3('0x2f')][_0x1cd3('0x3c')]){_0x5734f0[_0x1cd3('0x37')]=_[_0x1cd3('0x3a')](_0x5734f0[_0x1cd3('0x37')],{'$or':_[_0x1cd3('0x2e')](_0x5734f0[_0x1cd3('0x33')],function(_0x1c01e2){var _0x3d7bca={};_0x3d7bca[_0x1c01e2]={'$like':'%'+_0xfaecf0['query'][_0x1cd3('0x3c')]+'%'};return _0x3d7bca;})});}_0x5734f0=_['merge']({},_0x5734f0,_0xfaecf0[_0x1cd3('0x40')]);return _0xa261fc[_0x1cd3('0x46')](_0x5734f0);}})[_0x1cd3('0x25')](function(_0x4ee36a){if(_0x4ee36a){_0xbd4ea2=_0x4ee36a[_0x1cd3('0x47')];if(!_0xfaecf0[_0x1cd3('0x2f')][_0x1cd3('0x34')](_0x1cd3('0x35'))){_0x5734f0[_0x1cd3('0x1f')]=qs[_0x1cd3('0x1f')](_0xfaecf0[_0x1cd3('0x2f')][_0x1cd3('0x1f')]);_0x5734f0[_0x1cd3('0x1e')]=qs['offset'](_0xfaecf0[_0x1cd3('0x2f')][_0x1cd3('0x1e')]);}return _0xa261fc[_0x1cd3('0x46')](_0x5734f0);}})[_0x1cd3('0x25')](function(_0x512838){if(_0x512838){return _0x512838?{'count':_0xbd4ea2,'rows':_0x512838}:null;}})[_0x1cd3('0x25')](respondWithResult(_0x361bb2,null))[_0x1cd3('0x44')](handleError(_0x361bb2,null));};exports[_0x1cd3('0x49')]=function(_0x3b6033,_0x1541c9,_0x1ffff6){if(_0x3b6033['body']['id']){delete _0x3b6033[_0x1cd3('0x43')]['id'];}return db[_0x1cd3('0x29')][_0x1cd3('0x4a')]({'where':{'id':_0x3b6033[_0x1cd3('0x45')]['id']}})[_0x1cd3('0x25')](handleEntityNotFound(_0x1541c9,null))[_0x1cd3('0x25')](function(_0x332bd2){if(_0x332bd2){_0x3b6033[_0x1cd3('0x43')][_0x1cd3('0x4b')]=_0x332bd2['id'];_0x3b6033[_0x1cd3('0x43')]['Subjects']=integrations[_0x1cd3('0x4c')](_0x3b6033[_0x1cd3('0x43')][_0x1cd3('0x4d')],_0x3b6033[_0x1cd3('0x43')][_0x1cd3('0x2c')]);_0x3b6033[_0x1cd3('0x43')][_0x1cd3('0x4e')]=integrations[_0x1cd3('0x4f')](_0x3b6033[_0x1cd3('0x43')]['channel'],_0x3b6033[_0x1cd3('0x43')]['type']);return db[_0x1cd3('0x50')][_0x1cd3('0x42')](_0x3b6033['body'],{'include':[{'model':db[_0x1cd3('0x51')],'as':_0x1cd3('0x52')},{'model':db[_0x1cd3('0x51')],'as':'Descriptions'}]});}return null;})[_0x1cd3('0x25')](respondWithResult(_0x1541c9,null))[_0x1cd3('0x44')](handleError(_0x1541c9,null));};exports[_0x1cd3('0x53')]=function(_0x106a18,_0x2b9996,_0x48ef45){var _0x4affb2='';return db[_0x1cd3('0x29')][_0x1cd3('0x4a')]({'where':{'id':_0x106a18['params']['id']},'attributes':['id',_0x1cd3('0x54'),'apiKey']})[_0x1cd3('0x25')](handleEntityNotFound(_0x2b9996,null))['then'](function(_0x5ad6e1){if(_0x5ad6e1){_0x4affb2=_0x5ad6e1[_0x1cd3('0x54')];var _0x5d76b4=_0x4affb2[_0x1cd3('0x55')](-0x1);if(_0x5d76b4==='/'){_0x4affb2=_0x4affb2['substring'](0x0,_0x4affb2[_0x1cd3('0x56')](_0x5d76b4));}return rp({'method':_0x1cd3('0x57'),'uri':util[_0x1cd3('0x58')](_0x1cd3('0x59'),_0x4affb2,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x1cd3('0x58')](_0x1cd3('0x5a'),new Buffer(util['format'](_0x1cd3('0x5b'),_0x5ad6e1[_0x1cd3('0x5c')]))['toString'](_0x1cd3('0x5d')))},'json':!![]});}})[_0x1cd3('0x25')](function(_0x4b0f5a){if(_0x4b0f5a){var _0x5061c8=[_0x1cd3('0x5e'),'subject',_0x1cd3('0x5f'),_0x1cd3('0x60'),_0x1cd3('0x20'),_0x1cd3('0x61'),'group',_0x1cd3('0x62'),_0x1cd3('0x63'),_0x1cd3('0x64'),_0x1cd3('0x65')];_['remove'](_0x4b0f5a,function(_0x3f5f8f){return _0x5061c8[_0x1cd3('0x66')](_0x3f5f8f[_0x1cd3('0x26')])||!_0x3f5f8f[_0x1cd3('0x67')]&&_0x3f5f8f['type']!==_0x1cd3('0x68')&&_0x3f5f8f['type']!==_0x1cd3('0x69');});return{'count':_0x4b0f5a[_0x1cd3('0x47')],'rows':_[_0x1cd3('0x2e')](_0x4b0f5a,function(_0x5656cc){return{'id':_0x5656cc[_0x1cd3('0x26')],'name':_0x5656cc[_0x1cd3('0x6a')],'custom':!_0x5656cc[_0x1cd3('0x67')],'options':_0x5656cc[_0x1cd3('0x6b')]?_[_0x1cd3('0x2e')](_0x5656cc[_0x1cd3('0x6b')],function(_0x22e41e){return{'name':_[_0x1cd3('0x6c')](_0x22e41e),'value':_0x22e41e};}):[]};})};}})[_0x1cd3('0x25')](respondWithResult(_0x2b9996,null))[_0x1cd3('0x44')](function(_0x480aec){var _0x1022f7=_0x106a18[_0x1cd3('0x2f')]['test']?0x1f4:_0x480aec[_0x1cd3('0x6d')]||0x1f4;logger[_0x1cd3('0x6e')](_0x1cd3('0x6f'),_0x1cd3('0x53'),_0x1022f7,JSON[_0x1cd3('0x70')](_0x480aec));delete _0x480aec[_0x1cd3('0x26')];if(_0x1022f7===0x191){_0x1022f7=0x190;}_0x2b9996[_0x1cd3('0x20')](_0x1022f7)[_0x1cd3('0x27')](_0x106a18[_0x1cd3('0x2f')]['test']?{'message':_0x1cd3('0x71'),'statusCode':_0x480aec['statusCode']}:_0x480aec);});}; \ No newline at end of file +var _0x6b20=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','merge','create','body','find','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','api/v2/ticket_fields','Basic\x20%s','toString','requester','subject','agent','description','priority','group','source','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x56a180,_0x2a7d4f){var _0x47ae52=function(_0x2e24b0){while(--_0x2e24b0){_0x56a180['push'](_0x56a180['shift']());}};_0x47ae52(++_0x2a7d4f);}(_0x6b20,0xd1));var _0x06b2=function(_0x11f066,_0x43b2de){_0x11f066=_0x11f066-0x0;var _0x916b9d=_0x6b20[_0x11f066];return _0x916b9d;};'use strict';var emlformat=require(_0x06b2('0x0'));var rimraf=require(_0x06b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b2('0x2'));var rp=require('request-promise');var moment=require(_0x06b2('0x3'));var BPromise=require(_0x06b2('0x4'));var Mustache=require(_0x06b2('0x5'));var util=require('util');var path=require(_0x06b2('0x6'));var sox=require(_0x06b2('0x7'));var csv=require(_0x06b2('0x8'));var ejs=require(_0x06b2('0x9'));var fs=require('fs');var fs_extra=require(_0x06b2('0xa'));var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x8'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var licenseUtil=require(_0x06b2('0x15'));var db=require(_0x06b2('0x16'))['db'];var integrations=require(_0x06b2('0x17'));function respondWithStatusCode(_0x810a12,_0x3039c9){_0x3039c9=_0x3039c9||0xcc;return function(_0x926bf6){if(_0x926bf6){return _0x810a12[_0x06b2('0x18')](_0x3039c9);}return _0x810a12[_0x06b2('0x19')](_0x3039c9)[_0x06b2('0x1a')]();};}function respondWithResult(_0x2822e9,_0x26faee){_0x26faee=_0x26faee||0xc8;return function(_0x544de8){if(_0x544de8){return _0x2822e9[_0x06b2('0x19')](_0x26faee)[_0x06b2('0x1b')](_0x544de8);}};}function respondWithFilteredResult(_0x47496c,_0x3830e9){return function(_0xef0466){if(_0xef0466){var _0x45d5c5=typeof _0x3830e9['offset']===_0x06b2('0x1c')&&typeof _0x3830e9[_0x06b2('0x1d')]==='undefined';var _0x1e16d1=_0xef0466['count'];var _0x4c9cae=_0x45d5c5?0x0:_0x3830e9[_0x06b2('0x1e')];var _0x1b4ab0=_0x45d5c5?_0xef0466[_0x06b2('0x1f')]:_0x3830e9[_0x06b2('0x1e')]+_0x3830e9['limit'];var _0x288801;if(_0x1b4ab0>=_0x1e16d1){_0x1b4ab0=_0x1e16d1;_0x288801=0xc8;}else{_0x288801=0xce;}_0x47496c[_0x06b2('0x19')](_0x288801);return _0x47496c[_0x06b2('0x20')](_0x06b2('0x21'),_0x4c9cae+'-'+_0x1b4ab0+'/'+_0x1e16d1)[_0x06b2('0x1b')](_0xef0466);}return null;};}function patchUpdates(_0x368ad8){return function(_0x268e7d){try{jsonpatch['apply'](_0x268e7d,_0x368ad8,!![]);}catch(_0x18c9a9){return BPromise[_0x06b2('0x22')](_0x18c9a9);}return _0x268e7d[_0x06b2('0x23')]();};}function saveUpdates(_0x208384,_0x4e2a4c){return function(_0x4fa84f){if(_0x4fa84f){return _0x4fa84f[_0x06b2('0x24')](_0x208384)[_0x06b2('0x25')](function(_0x4fc95f){return _0x4fc95f;});}return null;};}function removeEntity(_0x39659f,_0x5e40f2){return function(_0x3d58c6){if(_0x3d58c6){return _0x3d58c6[_0x06b2('0x26')]()[_0x06b2('0x25')](function(){_0x39659f['status'](0xcc)[_0x06b2('0x1a')]();});}};}function handleEntityNotFound(_0x306ce,_0xc65820){return function(_0x1a94dc){if(!_0x1a94dc){_0x306ce[_0x06b2('0x18')](0x194);}return _0x1a94dc;};}function handleError(_0x4f5e90,_0xbb00ea){_0xbb00ea=_0xbb00ea||0x1f4;return function(_0x34370b){logger[_0x06b2('0x27')](_0x34370b[_0x06b2('0x28')]);if(_0x34370b[_0x06b2('0x29')]){delete _0x34370b[_0x06b2('0x29')];}_0x4f5e90['status'](_0xbb00ea)[_0x06b2('0x2a')](_0x34370b);};}exports[_0x06b2('0x2b')]=function(_0x2720fa,_0x13c0eb){var _0x1f02d8={},_0x1bfaa9={},_0x3668bb={'count':0x0,'rows':[]};var _0x51698b=_[_0x06b2('0x2c')](db[_0x06b2('0x2d')][_0x06b2('0x2e')],function(_0x15a78b){return{'name':_0x15a78b[_0x06b2('0x2f')],'type':_0x15a78b[_0x06b2('0x30')][_0x06b2('0x31')]};});_0x1bfaa9[_0x06b2('0x32')]=_['map'](_0x51698b,_0x06b2('0x29'));_0x1bfaa9[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x2720fa[_0x06b2('0x33')]);_0x1bfaa9[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x1bfaa9[_0x06b2('0x32')],_0x1bfaa9['query']);_0x1f02d8['attributes']=_[_0x06b2('0x36')](_0x1bfaa9[_0x06b2('0x32')],qs[_0x06b2('0x37')](_0x2720fa['query'][_0x06b2('0x37')]));_0x1f02d8[_0x06b2('0x38')]=_0x1f02d8[_0x06b2('0x38')][_0x06b2('0x39')]?_0x1f02d8[_0x06b2('0x38')]:_0x1bfaa9[_0x06b2('0x32')];if(!_0x2720fa['query'][_0x06b2('0x3a')](_0x06b2('0x3b'))){_0x1f02d8[_0x06b2('0x1d')]=qs['limit'](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x1d')]);_0x1f02d8['offset']=qs[_0x06b2('0x1e')](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x1e')]);}_0x1f02d8[_0x06b2('0x3c')]=qs[_0x06b2('0x3d')](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x3d')]);_0x1f02d8[_0x06b2('0x3e')]=qs[_0x06b2('0x35')](_[_0x06b2('0x3f')](_0x2720fa[_0x06b2('0x33')],_0x1bfaa9[_0x06b2('0x35')]),_0x51698b);if(_0x2720fa['query'][_0x06b2('0x40')]){_0x1f02d8['where']=_['merge'](_0x1f02d8[_0x06b2('0x3e')],{'$or':_['map'](_0x51698b,function(_0x26ab14){if(_0x26ab14['type']!==_0x06b2('0x41')){var _0x369673={};_0x369673[_0x26ab14[_0x06b2('0x29')]]={'$like':'%'+_0x2720fa[_0x06b2('0x33')][_0x06b2('0x40')]+'%'};return _0x369673;}})});}_0x1f02d8=_['merge']({},_0x1f02d8,_0x2720fa[_0x06b2('0x42')]);var _0xee3ec6={'where':_0x1f02d8[_0x06b2('0x3e')]};return db[_0x06b2('0x2d')][_0x06b2('0x1f')](_0xee3ec6)[_0x06b2('0x25')](function(_0x5f2549){_0x3668bb[_0x06b2('0x1f')]=_0x5f2549;if(_0x2720fa[_0x06b2('0x33')]['includeAll']){_0x1f02d8['include']=[{'all':!![]}];}return db[_0x06b2('0x2d')][_0x06b2('0x43')](_0x1f02d8);})[_0x06b2('0x25')](function(_0x3a8452){_0x3668bb[_0x06b2('0x44')]=_0x3a8452;return _0x3668bb;})[_0x06b2('0x25')](respondWithFilteredResult(_0x13c0eb,_0x1f02d8))[_0x06b2('0x45')](handleError(_0x13c0eb,null));};exports[_0x06b2('0x46')]=function(_0x2e2a80,_0x117bf4){var _0x1d7750={'raw':![],'where':{'id':_0x2e2a80[_0x06b2('0x47')]['id']}},_0xf9b9e={};_0xf9b9e[_0x06b2('0x32')]=_[_0x06b2('0x34')](db[_0x06b2('0x2d')][_0x06b2('0x2e')]);_0xf9b9e[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x2e2a80['query']);_0xf9b9e[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0xf9b9e[_0x06b2('0x32')],_0xf9b9e[_0x06b2('0x33')]);_0x1d7750['attributes']=_[_0x06b2('0x36')](_0xf9b9e[_0x06b2('0x32')],qs['fields'](_0x2e2a80[_0x06b2('0x33')][_0x06b2('0x37')]));_0x1d7750['attributes']=_0x1d7750[_0x06b2('0x38')][_0x06b2('0x39')]?_0x1d7750['attributes']:_0xf9b9e['model'];if(_0x2e2a80['query'][_0x06b2('0x48')]){_0x1d7750[_0x06b2('0x49')]=[{'all':!![]}];}_0x1d7750=_[_0x06b2('0x4a')]({},_0x1d7750,_0x2e2a80[_0x06b2('0x42')]);return db[_0x06b2('0x2d')]['find'](_0x1d7750)['then'](handleEntityNotFound(_0x117bf4,null))[_0x06b2('0x25')](respondWithResult(_0x117bf4,null))[_0x06b2('0x45')](handleError(_0x117bf4,null));};exports[_0x06b2('0x4b')]=function(_0x1f4d89,_0x33ac29){return db[_0x06b2('0x2d')]['create'](_0x1f4d89[_0x06b2('0x4c')],{})[_0x06b2('0x25')](respondWithResult(_0x33ac29,0xc9))[_0x06b2('0x45')](handleError(_0x33ac29,null));};exports[_0x06b2('0x24')]=function(_0x146c5c,_0x36a74a){if(_0x146c5c['body']['id']){delete _0x146c5c[_0x06b2('0x4c')]['id'];}return db[_0x06b2('0x2d')][_0x06b2('0x4d')]({'where':{'id':_0x146c5c[_0x06b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x36a74a,null))[_0x06b2('0x25')](saveUpdates(_0x146c5c[_0x06b2('0x4c')],null))[_0x06b2('0x25')](respondWithResult(_0x36a74a,null))[_0x06b2('0x45')](handleError(_0x36a74a,null));};exports['destroy']=function(_0x346f04,_0x8cf9fe){return db[_0x06b2('0x2d')][_0x06b2('0x4d')]({'where':{'id':_0x346f04[_0x06b2('0x47')]['id']}})[_0x06b2('0x25')](handleEntityNotFound(_0x8cf9fe,null))[_0x06b2('0x25')](removeEntity(_0x8cf9fe,null))[_0x06b2('0x45')](handleError(_0x8cf9fe,null));};exports['getConfigurations']=function(_0x33bc8e,_0x8288ae,_0x318a3b){var _0x5c328c={};var _0x2857d5={};var _0x2f75a0;var _0x4fba4c;return db['FreshdeskAccount'][_0x06b2('0x4e')]({'where':{'id':_0x33bc8e['params']['id']}})['then'](handleEntityNotFound(_0x8288ae,null))[_0x06b2('0x25')](function(_0x5899c1){if(_0x5899c1){_0x2f75a0=_0x5899c1;_0x2857d5[_0x06b2('0x32')]=_[_0x06b2('0x34')](db[_0x06b2('0x4f')][_0x06b2('0x2e')]);_0x2857d5[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x33bc8e[_0x06b2('0x33')]);_0x2857d5[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x2857d5[_0x06b2('0x32')],_0x2857d5['query']);_0x5c328c['attributes']=_[_0x06b2('0x36')](_0x2857d5[_0x06b2('0x32')],qs['fields'](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x37')]));_0x5c328c[_0x06b2('0x38')]=_0x5c328c[_0x06b2('0x38')]['length']?_0x5c328c['attributes']:_0x2857d5['model'];_0x5c328c[_0x06b2('0x3c')]=qs['sort'](_0x33bc8e['query'][_0x06b2('0x3d')]);_0x5c328c[_0x06b2('0x3e')]=qs[_0x06b2('0x35')](_[_0x06b2('0x3f')](_0x33bc8e[_0x06b2('0x33')],_0x2857d5[_0x06b2('0x35')]));if(_0x33bc8e['query'][_0x06b2('0x40')]){_0x5c328c[_0x06b2('0x3e')]=_['merge'](_0x5c328c[_0x06b2('0x3e')],{'$or':_[_0x06b2('0x2c')](_0x5c328c[_0x06b2('0x38')],function(_0x2e0388){var _0x23ce27={};_0x23ce27[_0x2e0388]={'$like':'%'+_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x40')]+'%'};return _0x23ce27;})});}_0x5c328c=_[_0x06b2('0x4a')]({},_0x5c328c,_0x33bc8e[_0x06b2('0x42')]);return _0x2f75a0[_0x06b2('0x50')](_0x5c328c);}})[_0x06b2('0x25')](function(_0x397b16){if(_0x397b16){_0x4fba4c=_0x397b16['length'];if(!_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x3a')]('nolimit')){_0x5c328c[_0x06b2('0x1d')]=qs[_0x06b2('0x1d')](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x1d')]);_0x5c328c['offset']=qs[_0x06b2('0x1e')](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x1e')]);}return _0x2f75a0['getConfigurations'](_0x5c328c);}})[_0x06b2('0x25')](function(_0x1ad9f7){if(_0x1ad9f7){return _0x1ad9f7?{'count':_0x4fba4c,'rows':_0x1ad9f7}:null;}})[_0x06b2('0x25')](respondWithResult(_0x8288ae,null))[_0x06b2('0x45')](handleError(_0x8288ae,null));};exports[_0x06b2('0x51')]=function(_0x43b907,_0x1aae55,_0x10faea){if(_0x43b907[_0x06b2('0x4c')]['id']){delete _0x43b907['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x43b907['params']['id']}})[_0x06b2('0x25')](handleEntityNotFound(_0x1aae55,null))['then'](function(_0x200a6e){if(_0x200a6e){_0x43b907[_0x06b2('0x4c')][_0x06b2('0x52')]=_0x200a6e['id'];_0x43b907[_0x06b2('0x4c')][_0x06b2('0x53')]=integrations[_0x06b2('0x54')](_0x43b907['body']['channel'],_0x43b907[_0x06b2('0x4c')][_0x06b2('0x30')]);_0x43b907['body'][_0x06b2('0x55')]=integrations[_0x06b2('0x56')](_0x43b907[_0x06b2('0x4c')][_0x06b2('0x57')],_0x43b907[_0x06b2('0x4c')][_0x06b2('0x30')]);return db['FreshdeskConfiguration'][_0x06b2('0x4b')](_0x43b907['body'],{'include':[{'model':db[_0x06b2('0x58')],'as':_0x06b2('0x53')},{'model':db[_0x06b2('0x58')],'as':'Descriptions'}]});}return null;})[_0x06b2('0x25')](respondWithResult(_0x1aae55,null))[_0x06b2('0x45')](handleError(_0x1aae55,null));};exports[_0x06b2('0x59')]=function(_0x4cc763,_0xc1010,_0x4900d2){var _0x15b345='';return db[_0x06b2('0x2d')][_0x06b2('0x4e')]({'where':{'id':_0x4cc763[_0x06b2('0x47')]['id']},'attributes':['id',_0x06b2('0x5a'),_0x06b2('0x5b')]})['then'](handleEntityNotFound(_0xc1010,null))[_0x06b2('0x25')](function(_0x711305){if(_0x711305){_0x15b345=_0x711305[_0x06b2('0x5a')];var _0x1857e8=_0x15b345['slice'](-0x1);if(_0x1857e8==='/'){_0x15b345=_0x15b345[_0x06b2('0x5c')](0x0,_0x15b345[_0x06b2('0x5d')](_0x1857e8));}return rp({'method':_0x06b2('0x5e'),'uri':util['format']('%s/%s',_0x15b345,_0x06b2('0x5f')),'headers':{'Authorization':util['format'](_0x06b2('0x60'),new Buffer(util['format']('%s:X',_0x711305[_0x06b2('0x5b')]))[_0x06b2('0x61')]('base64'))},'json':!![]});}})[_0x06b2('0x25')](function(_0x15f107){if(_0x15f107){var _0x206d66=[_0x06b2('0x62'),_0x06b2('0x63'),_0x06b2('0x64'),_0x06b2('0x65'),_0x06b2('0x19'),_0x06b2('0x66'),_0x06b2('0x67'),_0x06b2('0x68'),'ticket_type',_0x06b2('0x67'),'company'];_['remove'](_0x15f107,function(_0x3257b9){return _0x206d66[_0x06b2('0x69')](_0x3257b9['name'])||!_0x3257b9[_0x06b2('0x6a')]&&_0x3257b9[_0x06b2('0x30')]!==_0x06b2('0x6b')&&_0x3257b9['type']!==_0x06b2('0x6c');});return{'count':_0x15f107[_0x06b2('0x39')],'rows':_['map'](_0x15f107,function(_0x4797a1){return{'id':_0x4797a1['name'],'name':_0x4797a1['label'],'custom':!_0x4797a1[_0x06b2('0x6a')],'options':_0x4797a1['choices']?_[_0x06b2('0x2c')](_0x4797a1[_0x06b2('0x6d')],function(_0x1b1e6c){return{'name':_[_0x06b2('0x6e')](_0x1b1e6c),'value':_0x1b1e6c};}):[]};})};}})[_0x06b2('0x25')](respondWithResult(_0xc1010,null))[_0x06b2('0x45')](function(_0x406101){var _0x444725=_0x4cc763[_0x06b2('0x33')][_0x06b2('0x6f')]?0x1f4:_0x406101[_0x06b2('0x70')]||0x1f4;logger[_0x06b2('0x27')](_0x06b2('0x71'),'getFields',_0x444725,JSON['stringify'](_0x406101));delete _0x406101[_0x06b2('0x29')];if(_0x444725===0x191){_0x444725=0x190;}_0xc1010[_0x06b2('0x19')](_0x444725)[_0x06b2('0x2a')](_0x4cc763[_0x06b2('0x33')][_0x06b2('0x6f')]?{'message':_0x06b2('0x72'),'statusCode':_0x406101['statusCode']}:_0x406101);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ad44408..d6e1379 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 _0x8bd5=['util','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','lodash'];(function(_0x24aca2,_0x5c8395){var _0x2a188e=function(_0x3305cf){while(--_0x3305cf){_0x24aca2['push'](_0x24aca2['shift']());}};_0x2a188e(++_0x5c8395);}(_0x8bd5,0xb3));var _0x58bd=function(_0x3f7a9f,_0x125d99){_0x3f7a9f=_0x3f7a9f-0x0;var _0x438204=_0x8bd5[_0x3f7a9f];return _0x438204;};'use strict';var _=require(_0x58bd('0x0'));var util=require(_0x58bd('0x1'));var logger=require('../../config/logger')(_0x58bd('0x2'));var moment=require(_0x58bd('0x3'));var BPromise=require('bluebird');var rp=require(_0x58bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58bd('0x5'));var config=require(_0x58bd('0x6'));var attributes=require(_0x58bd('0x7'));var integrations=require(_0x58bd('0x8'));module['exports']=function(_0x4cc8f6,_0x23343c){return _0x4cc8f6[_0x58bd('0x9')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2771=['moment','bluebird','request-promise','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2771,0x74));var _0x1277=function(_0x3595d5,_0x5f2c14){_0x3595d5=_0x3595d5-0x0;var _0x2b4725=_0x2771[_0x3595d5];return _0x2b4725;};'use strict';var _=require(_0x1277('0x0'));var util=require(_0x1277('0x1'));var logger=require(_0x1277('0x2'))(_0x1277('0x3'));var moment=require(_0x1277('0x4'));var BPromise=require(_0x1277('0x5'));var rp=require(_0x1277('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1277('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1277('0x8')]=function(_0x595356,_0x442ca2){return _0x595356[_0x1277('0x9')](_0x1277('0xa'),attributes,{'tableName':_0x1277('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index a92c763..3ec6441 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 _0xbf9a=['http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowFreshdeskAccount','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x28d4cf,_0x4a5507){var _0x1600ab=function(_0x14f79a){while(--_0x14f79a){_0x28d4cf['push'](_0x28d4cf['shift']());}};_0x1600ab(++_0x4a5507);}(_0xbf9a,0x18c));var _0xabf9=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xbf9a[_0x1b64dd];return _0xeb464c;};'use strict';var _=require('lodash');var util=require(_0xabf9('0x0'));var moment=require(_0xabf9('0x1'));var BPromise=require(_0xabf9('0x2'));var rs=require(_0xabf9('0x3'));var fs=require('fs');var Redis=require(_0xabf9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xabf9('0x5'))(_0xabf9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xabf9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20dec2,_0x2e124e,_0x592056){return new BPromise(function(_0x4ef890,_0x105b49){return client[_0xabf9('0x8')](_0x20dec2,_0x592056)['then'](function(_0x361c9e){logger[_0xabf9('0x9')](_0xabf9('0xa'),_0x2e124e,_0xabf9('0xb'));logger[_0xabf9('0xc')](_0xabf9('0xd'),_0x2e124e,'request\x20sent',JSON[_0xabf9('0xe')](_0x361c9e));if(_0x361c9e[_0xabf9('0xf')]){if(_0x361c9e[_0xabf9('0xf')]['code']===0x1f4){logger[_0xabf9('0xf')](_0xabf9('0xa'),_0x2e124e,_0x361c9e[_0xabf9('0xf')][_0xabf9('0x10')]);return _0x105b49(_0x361c9e[_0xabf9('0xf')][_0xabf9('0x10')]);}logger[_0xabf9('0xf')](_0xabf9('0xa'),_0x2e124e,_0x361c9e[_0xabf9('0xf')][_0xabf9('0x10')]);return _0x4ef890(_0x361c9e[_0xabf9('0xf')][_0xabf9('0x10')]);}else{logger[_0xabf9('0x9')](_0xabf9('0xa'),_0x2e124e,_0xabf9('0xb'));_0x4ef890(_0x361c9e[_0xabf9('0x11')][_0xabf9('0x10')]);}})[_0xabf9('0x12')](function(_0x1b9f8a){logger[_0xabf9('0xf')](_0xabf9('0xa'),_0x2e124e,_0x1b9f8a);_0x105b49(_0x1b9f8a);});});}exports[_0xabf9('0x13')]=function(_0x2b8bc8){var _0x36694d=this;return new Promise(function(_0x1531d4,_0x262a2d){return db[_0xabf9('0x14')][_0xabf9('0x15')]({'raw':_0x2b8bc8[_0xabf9('0x16')]?_0x2b8bc8['options'][_0xabf9('0x17')]===undefined?!![]:![]:!![],'where':_0x2b8bc8[_0xabf9('0x16')]?_0x2b8bc8['options'][_0xabf9('0x18')]||null:null,'attributes':_0x2b8bc8[_0xabf9('0x16')]?_0x2b8bc8[_0xabf9('0x16')][_0xabf9('0x19')]||null:null,'limit':_0x2b8bc8[_0xabf9('0x16')]?_0x2b8bc8[_0xabf9('0x16')]['limit']||null:null,'include':_0x2b8bc8['options']?_0x2b8bc8['options'][_0xabf9('0x1a')]?_[_0xabf9('0x1b')](_0x2b8bc8[_0xabf9('0x16')]['include'],function(_0x469867){return{'model':db[_0x469867[_0xabf9('0x1c')]],'as':_0x469867['as'],'attributes':_0x469867[_0xabf9('0x19')],'include':_0x469867[_0xabf9('0x1a')]?_[_0xabf9('0x1b')](_0x469867[_0xabf9('0x1a')],function(_0x5c48d4){return{'model':db[_0x5c48d4[_0xabf9('0x1c')]],'as':_0x5c48d4['as'],'attributes':_0x5c48d4[_0xabf9('0x19')],'include':_0x5c48d4[_0xabf9('0x1a')]?_['map'](_0x5c48d4['include'],function(_0x481069){return{'model':db[_0x481069['model']],'as':_0x481069['as'],'attributes':_0x481069[_0xabf9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xabf9('0x1d')](function(_0x1bac1b){logger[_0xabf9('0x9')](_0xabf9('0x13'),_0x2b8bc8);logger['debug']('GetFreshdeskAccount',_0x2b8bc8,JSON[_0xabf9('0xe')](_0x1bac1b));_0x1531d4(_0x1bac1b);})['catch'](function(_0x12acc2){logger[_0xabf9('0xf')](_0xabf9('0x13'),_0x12acc2[_0xabf9('0x10')],_0x2b8bc8);_0x262a2d(_0x36694d[_0xabf9('0xf')](0x1f4,_0x12acc2['message']));});});};exports[_0xabf9('0x1e')]=function(_0x590de3){var _0x5c3066=this;return new Promise(function(_0xb77daa,_0xbbfcd7){return db['FreshdeskAccount']['find']({'raw':_0x590de3[_0xabf9('0x16')]?_0x590de3[_0xabf9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x590de3[_0xabf9('0x16')]?_0x590de3[_0xabf9('0x16')][_0xabf9('0x18')]||null:null,'attributes':_0x590de3[_0xabf9('0x16')]?_0x590de3[_0xabf9('0x16')][_0xabf9('0x19')]||null:null,'include':_0x590de3[_0xabf9('0x16')]?_0x590de3[_0xabf9('0x16')][_0xabf9('0x1a')]?_[_0xabf9('0x1b')](_0x590de3[_0xabf9('0x16')][_0xabf9('0x1a')],function(_0x475cd1){return{'model':db[_0x475cd1['model']],'as':_0x475cd1['as'],'attributes':_0x475cd1[_0xabf9('0x19')],'include':_0x475cd1[_0xabf9('0x1a')]?_[_0xabf9('0x1b')](_0x475cd1['include'],function(_0x22e3bc){return{'model':db[_0x22e3bc['model']],'as':_0x22e3bc['as'],'attributes':_0x22e3bc[_0xabf9('0x19')],'include':_0x22e3bc[_0xabf9('0x1a')]?_['map'](_0x22e3bc['include'],function(_0x2adf13){return{'model':db[_0x2adf13[_0xabf9('0x1c')]],'as':_0x2adf13['as'],'attributes':_0x2adf13[_0xabf9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b8d59){logger[_0xabf9('0x9')](_0xabf9('0x1e'),_0x590de3);logger['debug'](_0xabf9('0x1e'),_0x590de3,JSON['stringify'](_0x3b8d59));_0xb77daa(_0x3b8d59);})[_0xabf9('0x12')](function(_0x3f2f9f){logger[_0xabf9('0xf')](_0xabf9('0x1e'),_0x3f2f9f[_0xabf9('0x10')],_0x590de3);_0xbbfcd7(_0x5c3066[_0xabf9('0xf')](0x1f4,_0x3f2f9f[_0xabf9('0x10')]));});});}; \ No newline at end of file +var _0x331c=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','limit','include','attributes','map','model','then','ShowFreshdeskAccount','find','lodash','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x3bd1b1,_0x37ec08){var _0x36e5dd=function(_0x3121cc){while(--_0x3121cc){_0x3bd1b1['push'](_0x3bd1b1['shift']());}};_0x36e5dd(++_0x37ec08);}(_0x331c,0xf0));var _0xc331=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x331c[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xc331('0x0'));var util=require('util');var moment=require(_0xc331('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc331('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc331('0x3'))('rpc');var config=require(_0xc331('0x4'));var jayson=require(_0xc331('0x5'));var client=jayson['client'][_0xc331('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x200d28,_0x51aac6,_0x39a886){return new BPromise(function(_0x194bda,_0x634450){return client[_0xc331('0x7')](_0x200d28,_0x39a886)['then'](function(_0x15c4ac){logger['info'](_0xc331('0x8'),_0x51aac6,_0xc331('0x9'));logger[_0xc331('0xa')](_0xc331('0xb'),_0x51aac6,_0xc331('0x9'),JSON[_0xc331('0xc')](_0x15c4ac));if(_0x15c4ac[_0xc331('0xd')]){if(_0x15c4ac[_0xc331('0xd')][_0xc331('0xe')]===0x1f4){logger['error'](_0xc331('0x8'),_0x51aac6,_0x15c4ac[_0xc331('0xd')][_0xc331('0xf')]);return _0x634450(_0x15c4ac[_0xc331('0xd')][_0xc331('0xf')]);}logger[_0xc331('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x51aac6,_0x15c4ac[_0xc331('0xd')][_0xc331('0xf')]);return _0x194bda(_0x15c4ac['error'][_0xc331('0xf')]);}else{logger[_0xc331('0x10')](_0xc331('0x8'),_0x51aac6,_0xc331('0x9'));_0x194bda(_0x15c4ac['result']['message']);}})[_0xc331('0x11')](function(_0x18e6df){logger['error'](_0xc331('0x8'),_0x51aac6,_0x18e6df);_0x634450(_0x18e6df);});});}exports[_0xc331('0x12')]=function(_0x4ee88d){var _0x24f515=this;return new Promise(function(_0x43299a,_0x5207d5){return db[_0xc331('0x13')][_0xc331('0x14')]({'raw':_0x4ee88d[_0xc331('0x15')]?_0x4ee88d[_0xc331('0x15')][_0xc331('0x16')]===undefined?!![]:![]:!![],'where':_0x4ee88d['options']?_0x4ee88d[_0xc331('0x15')]['where']||null:null,'attributes':_0x4ee88d[_0xc331('0x15')]?_0x4ee88d[_0xc331('0x15')]['attributes']||null:null,'limit':_0x4ee88d[_0xc331('0x15')]?_0x4ee88d[_0xc331('0x15')][_0xc331('0x17')]||null:null,'include':_0x4ee88d['options']?_0x4ee88d[_0xc331('0x15')][_0xc331('0x18')]?_['map'](_0x4ee88d[_0xc331('0x15')]['include'],function(_0x5c1501){return{'model':db[_0x5c1501['model']],'as':_0x5c1501['as'],'attributes':_0x5c1501[_0xc331('0x19')],'include':_0x5c1501['include']?_[_0xc331('0x1a')](_0x5c1501[_0xc331('0x18')],function(_0x16ea9f){return{'model':db[_0x16ea9f[_0xc331('0x1b')]],'as':_0x16ea9f['as'],'attributes':_0x16ea9f['attributes'],'include':_0x16ea9f[_0xc331('0x18')]?_['map'](_0x16ea9f['include'],function(_0x55338e){return{'model':db[_0x55338e[_0xc331('0x1b')]],'as':_0x55338e['as'],'attributes':_0x55338e[_0xc331('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc331('0x1c')](function(_0x4dafd){logger[_0xc331('0x10')](_0xc331('0x12'),_0x4ee88d);logger[_0xc331('0xa')](_0xc331('0x12'),_0x4ee88d,JSON[_0xc331('0xc')](_0x4dafd));_0x43299a(_0x4dafd);})[_0xc331('0x11')](function(_0x345ae4){logger[_0xc331('0xd')]('GetFreshdeskAccount',_0x345ae4[_0xc331('0xf')],_0x4ee88d);_0x5207d5(_0x24f515[_0xc331('0xd')](0x1f4,_0x345ae4['message']));});});};exports[_0xc331('0x1d')]=function(_0x553f5d){var _0xa0f460=this;return new Promise(function(_0x5c1898,_0x3360e4){return db['FreshdeskAccount'][_0xc331('0x1e')]({'raw':_0x553f5d[_0xc331('0x15')]?_0x553f5d[_0xc331('0x15')][_0xc331('0x16')]===undefined?!![]:![]:!![],'where':_0x553f5d[_0xc331('0x15')]?_0x553f5d[_0xc331('0x15')]['where']||null:null,'attributes':_0x553f5d['options']?_0x553f5d[_0xc331('0x15')]['attributes']||null:null,'include':_0x553f5d[_0xc331('0x15')]?_0x553f5d['options'][_0xc331('0x18')]?_[_0xc331('0x1a')](_0x553f5d['options'][_0xc331('0x18')],function(_0x6627ce){return{'model':db[_0x6627ce[_0xc331('0x1b')]],'as':_0x6627ce['as'],'attributes':_0x6627ce[_0xc331('0x19')],'include':_0x6627ce[_0xc331('0x18')]?_[_0xc331('0x1a')](_0x6627ce[_0xc331('0x18')],function(_0x483041){return{'model':db[_0x483041[_0xc331('0x1b')]],'as':_0x483041['as'],'attributes':_0x483041[_0xc331('0x19')],'include':_0x483041['include']?_[_0xc331('0x1a')](_0x483041[_0xc331('0x18')],function(_0x426dfe){return{'model':db[_0x426dfe[_0xc331('0x1b')]],'as':_0x426dfe['as'],'attributes':_0x426dfe[_0xc331('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc331('0x1c')](function(_0x5314a3){logger['info'](_0xc331('0x1d'),_0x553f5d);logger['debug']('ShowFreshdeskAccount',_0x553f5d,JSON[_0xc331('0xc')](_0x5314a3));_0x5c1898(_0x5314a3);})['catch'](function(_0x5aa491){logger[_0xc331('0xd')](_0xc331('0x1d'),_0x5aa491[_0xc331('0xf')],_0x553f5d);_0x3360e4(_0xa0f460['error'](0x1f4,_0x5aa491['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 94002fb..6807611 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 _0xb1cf=['/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x27a76e,_0x1f6502){var _0x34940b=function(_0x36d2f6){while(--_0x36d2f6){_0x27a76e['push'](_0x27a76e['shift']());}};_0x34940b(++_0x1f6502);}(_0xb1cf,0x1d9));var _0xfb1c=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0xb1cf[_0x2bddf9];return _0x3f3ae9;};'use strict';var multer=require(_0xfb1c('0x0'));var util=require(_0xfb1c('0x1'));var path=require(_0xfb1c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfb1c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfb1c('0x4'));var interaction=require(_0xfb1c('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0xfb1c('0x6')]('/',auth[_0xfb1c('0x7')](),controller['index']);router[_0xfb1c('0x6')](_0xfb1c('0x8'),auth['isAuthenticated'](),controller[_0xfb1c('0x9')]);router[_0xfb1c('0x6')](_0xfb1c('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0xfb1c('0x6')](_0xfb1c('0xb'),auth[_0xfb1c('0x7')](),controller['getSubjects']);router['get'](_0xfb1c('0xc'),auth[_0xfb1c('0x7')](),controller[_0xfb1c('0xd')]);router[_0xfb1c('0x6')](_0xfb1c('0xe'),auth['isAuthenticated'](),controller[_0xfb1c('0xf')]);router['post']('/',auth[_0xfb1c('0x7')](),controller[_0xfb1c('0x10')]);router['post'](_0xfb1c('0xe'),auth[_0xfb1c('0x7')](),controller['setTags']);router[_0xfb1c('0x11')](_0xfb1c('0x8'),auth[_0xfb1c('0x7')](),controller[_0xfb1c('0x12')]);router[_0xfb1c('0x13')](_0xfb1c('0x8'),auth[_0xfb1c('0x7')](),controller[_0xfb1c('0x14')]);module[_0xfb1c('0x15')]=router; \ No newline at end of file +var _0x8fba=['post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x126314,_0x1882ba){var _0x157913=function(_0x5a60a6){while(--_0x5a60a6){_0x126314['push'](_0x126314['shift']());}};_0x157913(++_0x1882ba);}(_0x8fba,0x11c));var _0xa8fb=function(_0x38b066,_0x30da52){_0x38b066=_0x38b066-0x0;var _0x49ce46=_0x8fba[_0x38b066];return _0x49ce46;};'use strict';var multer=require('multer');var util=require(_0xa8fb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa8fb('0x1'));var router=express[_0xa8fb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa8fb('0x3'));var interaction=require(_0xa8fb('0x4'));var config=require('../../config/environment');var controller=require(_0xa8fb('0x5'));router[_0xa8fb('0x6')]('/',auth[_0xa8fb('0x7')](),controller[_0xa8fb('0x8')]);router['get'](_0xa8fb('0x9'),auth[_0xa8fb('0x7')](),controller['show']);router['get'](_0xa8fb('0xa'),auth[_0xa8fb('0x7')](),controller[_0xa8fb('0xb')]);router[_0xa8fb('0x6')](_0xa8fb('0xc'),auth[_0xa8fb('0x7')](),controller[_0xa8fb('0xd')]);router[_0xa8fb('0x6')](_0xa8fb('0xe'),auth[_0xa8fb('0x7')](),controller[_0xa8fb('0xf')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa8fb('0x10')]('/',auth[_0xa8fb('0x7')](),controller[_0xa8fb('0x11')]);router[_0xa8fb('0x10')](_0xa8fb('0x12'),auth[_0xa8fb('0x7')](),controller[_0xa8fb('0x13')]);router[_0xa8fb('0x14')](_0xa8fb('0x9'),auth[_0xa8fb('0x7')](),controller[_0xa8fb('0x15')]);router[_0xa8fb('0x16')]('/:id',auth[_0xa8fb('0x7')](),controller[_0xa8fb('0x17')]);module[_0xa8fb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b0757b5..171efdd 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 _0x6227=['STRING'];(function(_0xe81ed0,_0x6c7cd4){var _0x3a52db=function(_0x348e2b){while(--_0x348e2b){_0xe81ed0['push'](_0xe81ed0['shift']());}};_0x3a52db(++_0x6c7cd4);}(_0x6227,0x169));var _0x7622=function(_0x19e464,_0x26b550){_0x19e464=_0x19e464-0x0;var _0x35b913=_0x6227[_0x19e464];return _0x35b913;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7622('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb857=['STRING','exports'];(function(_0x5d8780,_0x56d9ca){var _0x4f96e0=function(_0xcf26a2){while(--_0xcf26a2){_0x5d8780['push'](_0x5d8780['shift']());}};_0x4f96e0(++_0x56d9ca);}(_0xb857,0x151));var _0x7b85=function(_0x406cd2,_0x107433){_0x406cd2=_0x406cd2-0x0;var _0x5c1b13=_0xb857[_0x406cd2];return _0x5c1b13;};'use strict';var Sequelize=require('sequelize');module[_0x7b85('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7b85('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a712211..8ec16d7 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 _0xd529=['keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','find','destroy','getFields','findOne','FreshdeskField','length','getSubjects','filter','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model'];(function(_0x192551,_0x160221){var _0x533857=function(_0x5047d3){while(--_0x5047d3){_0x192551['push'](_0x192551['shift']());}};_0x533857(++_0x160221);}(_0xd529,0x73));var _0x9d52=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd529[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x9d52('0x0'));var rimraf=require(_0x9d52('0x1'));var zipdir=require(_0x9d52('0x2'));var jsonpatch=require(_0x9d52('0x3'));var rp=require(_0x9d52('0x4'));var moment=require(_0x9d52('0x5'));var BPromise=require(_0x9d52('0x6'));var Mustache=require(_0x9d52('0x7'));var util=require(_0x9d52('0x8'));var path=require(_0x9d52('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d52('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d52('0xb'));var squel=require(_0x9d52('0xc'));var crypto=require(_0x9d52('0xd'));var jsforce=require(_0x9d52('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9d52('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9d52('0x10'));var authService=require(_0x9d52('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d52('0x12'));var logger=require(_0x9d52('0x13'))(_0x9d52('0x14'));var utils=require('../../config/utils');var config=require(_0x9d52('0x15'));var licenseUtil=require(_0x9d52('0x16'));var db=require(_0x9d52('0x17'))['db'];function respondWithStatusCode(_0x1cb1a7,_0x20ebe1){_0x20ebe1=_0x20ebe1||0xcc;return function(_0x1fc596){if(_0x1fc596){return _0x1cb1a7['sendStatus'](_0x20ebe1);}return _0x1cb1a7[_0x9d52('0x18')](_0x20ebe1)[_0x9d52('0x19')]();};}function respondWithResult(_0x5a3d08,_0x2c4271){_0x2c4271=_0x2c4271||0xc8;return function(_0x30fb87){if(_0x30fb87){return _0x5a3d08[_0x9d52('0x18')](_0x2c4271)[_0x9d52('0x1a')](_0x30fb87);}};}function respondWithFilteredResult(_0x1320d5,_0x10e637){return function(_0x547177){if(_0x547177){var _0x134616=typeof _0x10e637[_0x9d52('0x1b')]===_0x9d52('0x1c')&&typeof _0x10e637[_0x9d52('0x1d')]===_0x9d52('0x1c');var _0xbbe0ca=_0x547177[_0x9d52('0x1e')];var _0x33086b=_0x134616?0x0:_0x10e637[_0x9d52('0x1b')];var _0x358fd2=_0x134616?_0x547177[_0x9d52('0x1e')]:_0x10e637[_0x9d52('0x1b')]+_0x10e637[_0x9d52('0x1d')];var _0x1dd63c;if(_0x358fd2>=_0xbbe0ca){_0x358fd2=_0xbbe0ca;_0x1dd63c=0xc8;}else{_0x1dd63c=0xce;}_0x1320d5[_0x9d52('0x18')](_0x1dd63c);return _0x1320d5['set'](_0x9d52('0x1f'),_0x33086b+'-'+_0x358fd2+'/'+_0xbbe0ca)['json'](_0x547177);}return null;};}function patchUpdates(_0x37d0d3){return function(_0x4e4dce){try{jsonpatch[_0x9d52('0x20')](_0x4e4dce,_0x37d0d3,!![]);}catch(_0x260437){return BPromise[_0x9d52('0x21')](_0x260437);}return _0x4e4dce[_0x9d52('0x22')]();};}function saveUpdates(_0x2c2768,_0x3eaa66){return function(_0x33adaf){if(_0x33adaf){return _0x33adaf[_0x9d52('0x23')](_0x2c2768)[_0x9d52('0x24')](function(_0xd95935){return _0xd95935;});}return null;};}function removeEntity(_0x4e5535,_0x21726d){return function(_0x5eb18e){if(_0x5eb18e){return _0x5eb18e['destroy']()['then'](function(){_0x4e5535[_0x9d52('0x18')](0xcc)[_0x9d52('0x19')]();});}};}function handleEntityNotFound(_0x2f696e,_0x323bc4){return function(_0x27d933){if(!_0x27d933){_0x2f696e[_0x9d52('0x25')](0x194);}return _0x27d933;};}function handleError(_0x29307c,_0x258547){_0x258547=_0x258547||0x1f4;return function(_0xcfa20f){logger[_0x9d52('0x26')](_0xcfa20f['stack']);if(_0xcfa20f[_0x9d52('0x27')]){delete _0xcfa20f['name'];}_0x29307c['status'](_0x258547)[_0x9d52('0x28')](_0xcfa20f);};}exports['index']=function(_0x28be9b,_0xdb43d1){var _0x3d48f0={},_0x16d572={},_0x4fcd3a={'count':0x0,'rows':[]};var _0x74b0ef=_[_0x9d52('0x29')](db[_0x9d52('0x2a')][_0x9d52('0x2b')],function(_0x35542e){return{'name':_0x35542e[_0x9d52('0x2c')],'type':_0x35542e[_0x9d52('0x2d')]['key']};});_0x16d572[_0x9d52('0x2e')]=_[_0x9d52('0x29')](_0x74b0ef,'name');_0x16d572['query']=_[_0x9d52('0x2f')](_0x28be9b[_0x9d52('0x30')]);_0x16d572['filters']=_[_0x9d52('0x31')](_0x16d572['model'],_0x16d572[_0x9d52('0x30')]);_0x3d48f0[_0x9d52('0x32')]=_[_0x9d52('0x31')](_0x16d572[_0x9d52('0x2e')],qs[_0x9d52('0x33')](_0x28be9b[_0x9d52('0x30')][_0x9d52('0x33')]));_0x3d48f0[_0x9d52('0x32')]=_0x3d48f0[_0x9d52('0x32')]['length']?_0x3d48f0[_0x9d52('0x32')]:_0x16d572[_0x9d52('0x2e')];if(!_0x28be9b[_0x9d52('0x30')][_0x9d52('0x34')](_0x9d52('0x35'))){_0x3d48f0[_0x9d52('0x1d')]=qs['limit'](_0x28be9b[_0x9d52('0x30')]['limit']);_0x3d48f0['offset']=qs[_0x9d52('0x1b')](_0x28be9b[_0x9d52('0x30')]['offset']);}_0x3d48f0[_0x9d52('0x36')]=qs[_0x9d52('0x37')](_0x28be9b[_0x9d52('0x30')][_0x9d52('0x37')]);_0x3d48f0[_0x9d52('0x38')]=qs[_0x9d52('0x39')](_[_0x9d52('0x3a')](_0x28be9b[_0x9d52('0x30')],_0x16d572[_0x9d52('0x39')]),_0x74b0ef);if(_0x28be9b[_0x9d52('0x30')]['filter']){_0x3d48f0[_0x9d52('0x38')]=_[_0x9d52('0x3b')](_0x3d48f0['where'],{'$or':_[_0x9d52('0x29')](_0x74b0ef,function(_0x5c9dd0){if(_0x5c9dd0['type']!==_0x9d52('0x3c')){var _0x59d390={};_0x59d390[_0x5c9dd0[_0x9d52('0x27')]]={'$like':'%'+_0x28be9b[_0x9d52('0x30')]['filter']+'%'};return _0x59d390;}})});}_0x3d48f0=_[_0x9d52('0x3b')]({},_0x3d48f0,_0x28be9b['options']);var _0x2ee5b2={'where':_0x3d48f0[_0x9d52('0x38')]};return db[_0x9d52('0x2a')][_0x9d52('0x1e')](_0x2ee5b2)[_0x9d52('0x24')](function(_0x4c18cb){_0x4fcd3a[_0x9d52('0x1e')]=_0x4c18cb;if(_0x28be9b[_0x9d52('0x30')][_0x9d52('0x3d')]){_0x3d48f0[_0x9d52('0x3e')]=[{'all':!![]}];}return db[_0x9d52('0x2a')][_0x9d52('0x3f')](_0x3d48f0);})[_0x9d52('0x24')](function(_0x37f8bc){_0x4fcd3a['rows']=_0x37f8bc;return _0x4fcd3a;})[_0x9d52('0x24')](respondWithFilteredResult(_0xdb43d1,_0x3d48f0))[_0x9d52('0x40')](handleError(_0xdb43d1,null));};exports['show']=function(_0x38c570,_0x2d4568){var _0x30c5c9={'raw':![],'where':{'id':_0x38c570[_0x9d52('0x41')]['id']}},_0x5baee9={};_0x5baee9[_0x9d52('0x2e')]=_[_0x9d52('0x2f')](db['FreshdeskConfiguration'][_0x9d52('0x2b')]);_0x5baee9[_0x9d52('0x30')]=_[_0x9d52('0x2f')](_0x38c570[_0x9d52('0x30')]);_0x5baee9[_0x9d52('0x39')]=_[_0x9d52('0x31')](_0x5baee9[_0x9d52('0x2e')],_0x5baee9[_0x9d52('0x30')]);_0x30c5c9[_0x9d52('0x32')]=_['intersection'](_0x5baee9['model'],qs[_0x9d52('0x33')](_0x38c570[_0x9d52('0x30')][_0x9d52('0x33')]));_0x30c5c9['attributes']=_0x30c5c9[_0x9d52('0x32')]['length']?_0x30c5c9['attributes']:_0x5baee9[_0x9d52('0x2e')];if(_0x38c570[_0x9d52('0x30')][_0x9d52('0x3d')]){_0x30c5c9[_0x9d52('0x3e')]=[{'all':!![]}];}_0x30c5c9=_['merge']({},_0x30c5c9,_0x38c570[_0x9d52('0x42')]);return db[_0x9d52('0x2a')]['find'](_0x30c5c9)['then'](handleEntityNotFound(_0x2d4568,null))[_0x9d52('0x24')](respondWithResult(_0x2d4568,null))[_0x9d52('0x40')](handleError(_0x2d4568,null));};exports[_0x9d52('0x43')]=function(_0x4eb973,_0x32a5dd){return db[_0x9d52('0x2a')]['create'](_0x4eb973[_0x9d52('0x44')],{})['then'](respondWithResult(_0x32a5dd,0xc9))[_0x9d52('0x40')](handleError(_0x32a5dd,null));};exports[_0x9d52('0x23')]=function(_0x15925e,_0x50c566){if(_0x15925e[_0x9d52('0x44')]['id']){delete _0x15925e['body']['id'];}return db['FreshdeskConfiguration'][_0x9d52('0x45')]({'where':{'id':_0x15925e[_0x9d52('0x41')]['id']}})['then'](handleEntityNotFound(_0x50c566,null))[_0x9d52('0x24')](saveUpdates(_0x15925e[_0x9d52('0x44')],null))[_0x9d52('0x24')](respondWithResult(_0x50c566,null))[_0x9d52('0x40')](handleError(_0x50c566,null));};exports[_0x9d52('0x46')]=function(_0x288817,_0xdbe695){return db[_0x9d52('0x2a')][_0x9d52('0x45')]({'where':{'id':_0x288817['params']['id']}})[_0x9d52('0x24')](handleEntityNotFound(_0xdbe695,null))[_0x9d52('0x24')](removeEntity(_0xdbe695,null))[_0x9d52('0x40')](handleError(_0xdbe695,null));};exports[_0x9d52('0x47')]=function(_0x4aac9e,_0x4ce00c,_0xc9e11d){var _0xb0d0d5={};var _0x16ff23={};var _0x5cc4aa;var _0xbc96d9;return db[_0x9d52('0x2a')][_0x9d52('0x48')]({'where':{'id':_0x4aac9e['params']['id']}})[_0x9d52('0x24')](handleEntityNotFound(_0x4ce00c,null))[_0x9d52('0x24')](function(_0x5d8d52){if(_0x5d8d52){_0x5cc4aa=_0x5d8d52;_0x16ff23[_0x9d52('0x2e')]=_['keys'](db[_0x9d52('0x49')]['rawAttributes']);_0x16ff23[_0x9d52('0x30')]=_[_0x9d52('0x2f')](_0x4aac9e[_0x9d52('0x30')]);_0x16ff23[_0x9d52('0x39')]=_['intersection'](_0x16ff23['model'],_0x16ff23[_0x9d52('0x30')]);_0xb0d0d5['attributes']=_[_0x9d52('0x31')](_0x16ff23['model'],qs[_0x9d52('0x33')](_0x4aac9e[_0x9d52('0x30')][_0x9d52('0x33')]));_0xb0d0d5[_0x9d52('0x32')]=_0xb0d0d5[_0x9d52('0x32')][_0x9d52('0x4a')]?_0xb0d0d5[_0x9d52('0x32')]:_0x16ff23[_0x9d52('0x2e')];_0xb0d0d5[_0x9d52('0x36')]=qs[_0x9d52('0x37')](_0x4aac9e[_0x9d52('0x30')][_0x9d52('0x37')]);_0xb0d0d5[_0x9d52('0x38')]=qs[_0x9d52('0x39')](_[_0x9d52('0x3a')](_0x4aac9e[_0x9d52('0x30')],_0x16ff23[_0x9d52('0x39')]));if(_0x4aac9e[_0x9d52('0x30')]['filter']){_0xb0d0d5[_0x9d52('0x38')]=_[_0x9d52('0x3b')](_0xb0d0d5[_0x9d52('0x38')],{'$or':_[_0x9d52('0x29')](_0xb0d0d5[_0x9d52('0x32')],function(_0x448dad){var _0x4c89e2={};_0x4c89e2[_0x448dad]={'$like':'%'+_0x4aac9e[_0x9d52('0x30')]['filter']+'%'};return _0x4c89e2;})});}_0xb0d0d5=_['merge']({},_0xb0d0d5,_0x4aac9e[_0x9d52('0x42')]);return _0x5cc4aa['getFields'](_0xb0d0d5);}})['then'](function(_0x310ff5){if(_0x310ff5){_0xbc96d9=_0x310ff5[_0x9d52('0x4a')];if(!_0x4aac9e[_0x9d52('0x30')][_0x9d52('0x34')](_0x9d52('0x35'))){_0xb0d0d5[_0x9d52('0x1d')]=qs['limit'](_0x4aac9e['query'][_0x9d52('0x1d')]);_0xb0d0d5[_0x9d52('0x1b')]=qs[_0x9d52('0x1b')](_0x4aac9e[_0x9d52('0x30')][_0x9d52('0x1b')]);}return _0x5cc4aa[_0x9d52('0x47')](_0xb0d0d5);}})['then'](function(_0x926814){if(_0x926814){return _0x926814?{'count':_0xbc96d9,'rows':_0x926814}:null;}})[_0x9d52('0x24')](respondWithResult(_0x4ce00c,null))[_0x9d52('0x40')](handleError(_0x4ce00c,null));};exports[_0x9d52('0x4b')]=function(_0x231a24,_0x3097e8,_0x13c992){var _0x47b153={};var _0x1f9605={};var _0x376e99;var _0x265fae;return db[_0x9d52('0x2a')][_0x9d52('0x48')]({'where':{'id':_0x231a24[_0x9d52('0x41')]['id']}})[_0x9d52('0x24')](handleEntityNotFound(_0x3097e8,null))[_0x9d52('0x24')](function(_0x14f03f){if(_0x14f03f){_0x376e99=_0x14f03f;_0x1f9605['model']=_[_0x9d52('0x2f')](db[_0x9d52('0x49')]['rawAttributes']);_0x1f9605['query']=_[_0x9d52('0x2f')](_0x231a24['query']);_0x1f9605['filters']=_[_0x9d52('0x31')](_0x1f9605['model'],_0x1f9605[_0x9d52('0x30')]);_0x47b153[_0x9d52('0x32')]=_['intersection'](_0x1f9605[_0x9d52('0x2e')],qs[_0x9d52('0x33')](_0x231a24[_0x9d52('0x30')][_0x9d52('0x33')]));_0x47b153['attributes']=_0x47b153[_0x9d52('0x32')][_0x9d52('0x4a')]?_0x47b153[_0x9d52('0x32')]:_0x1f9605[_0x9d52('0x2e')];_0x47b153[_0x9d52('0x36')]=qs['sort'](_0x231a24['query'][_0x9d52('0x37')]);_0x47b153[_0x9d52('0x38')]=qs[_0x9d52('0x39')](_[_0x9d52('0x3a')](_0x231a24[_0x9d52('0x30')],_0x1f9605[_0x9d52('0x39')]));if(_0x231a24[_0x9d52('0x30')][_0x9d52('0x4c')]){_0x47b153[_0x9d52('0x38')]=_[_0x9d52('0x3b')](_0x47b153[_0x9d52('0x38')],{'$or':_['map'](_0x47b153[_0x9d52('0x32')],function(_0x631e90){var _0xd7a1e9={};_0xd7a1e9[_0x631e90]={'$like':'%'+_0x231a24[_0x9d52('0x30')]['filter']+'%'};return _0xd7a1e9;})});}_0x47b153=_[_0x9d52('0x3b')]({},_0x47b153,_0x231a24[_0x9d52('0x42')]);return _0x376e99['getSubjects'](_0x47b153);}})[_0x9d52('0x24')](function(_0x8a0cce){if(_0x8a0cce){_0x265fae=_0x8a0cce[_0x9d52('0x4a')];if(!_0x231a24['query'][_0x9d52('0x34')](_0x9d52('0x35'))){_0x47b153[_0x9d52('0x1d')]=qs[_0x9d52('0x1d')](_0x231a24['query'][_0x9d52('0x1d')]);_0x47b153['offset']=qs[_0x9d52('0x1b')](_0x231a24[_0x9d52('0x30')]['offset']);}return _0x376e99[_0x9d52('0x4b')](_0x47b153);}})[_0x9d52('0x24')](function(_0x1c4d30){if(_0x1c4d30){return _0x1c4d30?{'count':_0x265fae,'rows':_0x1c4d30}:null;}})[_0x9d52('0x24')](respondWithResult(_0x3097e8,null))[_0x9d52('0x40')](handleError(_0x3097e8,null));};exports[_0x9d52('0x4d')]=function(_0x18d2b1,_0x5b28ed,_0x23f7fc){var _0xf4a815={};var _0x4e2dc7={};var _0x3bf517;var _0x46351a;return db[_0x9d52('0x2a')]['findOne']({'where':{'id':_0x18d2b1[_0x9d52('0x41')]['id']}})[_0x9d52('0x24')](handleEntityNotFound(_0x5b28ed,null))['then'](function(_0x45705e){if(_0x45705e){_0x3bf517=_0x45705e;_0x4e2dc7[_0x9d52('0x2e')]=_[_0x9d52('0x2f')](db['FreshdeskField'][_0x9d52('0x2b')]);_0x4e2dc7['query']=_['keys'](_0x18d2b1[_0x9d52('0x30')]);_0x4e2dc7[_0x9d52('0x39')]=_[_0x9d52('0x31')](_0x4e2dc7[_0x9d52('0x2e')],_0x4e2dc7[_0x9d52('0x30')]);_0xf4a815['attributes']=_[_0x9d52('0x31')](_0x4e2dc7[_0x9d52('0x2e')],qs[_0x9d52('0x33')](_0x18d2b1['query'][_0x9d52('0x33')]));_0xf4a815['attributes']=_0xf4a815[_0x9d52('0x32')]['length']?_0xf4a815[_0x9d52('0x32')]:_0x4e2dc7['model'];_0xf4a815[_0x9d52('0x36')]=qs[_0x9d52('0x37')](_0x18d2b1[_0x9d52('0x30')][_0x9d52('0x37')]);_0xf4a815['where']=qs[_0x9d52('0x39')](_['pick'](_0x18d2b1[_0x9d52('0x30')],_0x4e2dc7['filters']));if(_0x18d2b1[_0x9d52('0x30')][_0x9d52('0x4c')]){_0xf4a815[_0x9d52('0x38')]=_[_0x9d52('0x3b')](_0xf4a815[_0x9d52('0x38')],{'$or':_[_0x9d52('0x29')](_0xf4a815['attributes'],function(_0x3b1235){var _0x306e69={};_0x306e69[_0x3b1235]={'$like':'%'+_0x18d2b1[_0x9d52('0x30')][_0x9d52('0x4c')]+'%'};return _0x306e69;})});}_0xf4a815=_[_0x9d52('0x3b')]({},_0xf4a815,_0x18d2b1[_0x9d52('0x42')]);return _0x3bf517[_0x9d52('0x4d')](_0xf4a815);}})[_0x9d52('0x24')](function(_0x4e4326){if(_0x4e4326){_0x46351a=_0x4e4326[_0x9d52('0x4a')];if(!_0x18d2b1['query'][_0x9d52('0x34')]('nolimit')){_0xf4a815[_0x9d52('0x1d')]=qs['limit'](_0x18d2b1[_0x9d52('0x30')][_0x9d52('0x1d')]);_0xf4a815[_0x9d52('0x1b')]=qs[_0x9d52('0x1b')](_0x18d2b1['query'][_0x9d52('0x1b')]);}return _0x3bf517[_0x9d52('0x4d')](_0xf4a815);}})[_0x9d52('0x24')](function(_0xc08d7f){if(_0xc08d7f){return _0xc08d7f?{'count':_0x46351a,'rows':_0xc08d7f}:null;}})[_0x9d52('0x24')](respondWithResult(_0x5b28ed,null))[_0x9d52('0x40')](handleError(_0x5b28ed,null));};exports[_0x9d52('0x4e')]=function(_0x305b7c,_0x556b02,_0x1b79dc){var _0x34b538={};var _0x29ea4c={};var _0x585787;var _0x3f364c;return db[_0x9d52('0x2a')]['findOne']({'where':{'id':_0x305b7c[_0x9d52('0x41')]['id']}})[_0x9d52('0x24')](handleEntityNotFound(_0x556b02,null))[_0x9d52('0x24')](function(_0x590958){if(_0x590958){_0x585787=_0x590958;_0x29ea4c[_0x9d52('0x2e')]=_['keys'](db['Tag']['rawAttributes']);_0x29ea4c[_0x9d52('0x30')]=_[_0x9d52('0x2f')](_0x305b7c[_0x9d52('0x30')]);_0x29ea4c[_0x9d52('0x39')]=_[_0x9d52('0x31')](_0x29ea4c[_0x9d52('0x2e')],_0x29ea4c[_0x9d52('0x30')]);_0x34b538[_0x9d52('0x32')]=_[_0x9d52('0x31')](_0x29ea4c[_0x9d52('0x2e')],qs[_0x9d52('0x33')](_0x305b7c[_0x9d52('0x30')]['fields']));_0x34b538[_0x9d52('0x32')]=_0x34b538['attributes'][_0x9d52('0x4a')]?_0x34b538[_0x9d52('0x32')]:_0x29ea4c['model'];_0x34b538[_0x9d52('0x36')]=qs[_0x9d52('0x37')](_0x305b7c[_0x9d52('0x30')]['sort']);_0x34b538[_0x9d52('0x38')]=qs['filters'](_[_0x9d52('0x3a')](_0x305b7c[_0x9d52('0x30')],_0x29ea4c[_0x9d52('0x39')]));if(_0x305b7c[_0x9d52('0x30')][_0x9d52('0x4c')]){_0x34b538[_0x9d52('0x38')]=_[_0x9d52('0x3b')](_0x34b538['where'],{'$or':_[_0x9d52('0x29')](_0x34b538[_0x9d52('0x32')],function(_0x454505){var _0x1ecc08={};_0x1ecc08[_0x454505]={'$like':'%'+_0x305b7c[_0x9d52('0x30')]['filter']+'%'};return _0x1ecc08;})});}_0x34b538=_['merge']({},_0x34b538,_0x305b7c['options']);return _0x585787[_0x9d52('0x4e')](_0x34b538);}})['then'](function(_0x11f63e){if(_0x11f63e){_0x3f364c=_0x11f63e['length'];if(!_0x305b7c[_0x9d52('0x30')][_0x9d52('0x34')]('nolimit')){_0x34b538[_0x9d52('0x1d')]=qs['limit'](_0x305b7c[_0x9d52('0x30')][_0x9d52('0x1d')]);_0x34b538[_0x9d52('0x1b')]=qs[_0x9d52('0x1b')](_0x305b7c['query'][_0x9d52('0x1b')]);}return _0x585787[_0x9d52('0x4e')](_0x34b538);}})['then'](function(_0x4e5949){if(_0x4e5949){return _0x4e5949?{'count':_0x3f364c,'rows':_0x4e5949}:null;}})[_0x9d52('0x24')](respondWithResult(_0x556b02,null))[_0x9d52('0x40')](handleError(_0x556b02,null));};exports[_0x9d52('0x4f')]=function(_0x1fedd3,_0x188e50,_0x43375f){if(_0x1fedd3[_0x9d52('0x44')]['id']){delete _0x1fedd3[_0x9d52('0x44')]['id'];}return db[_0x9d52('0x2a')][_0x9d52('0x48')]({'where':{'id':_0x1fedd3['params']['id']}})[_0x9d52('0x24')](handleEntityNotFound(_0x188e50,null))[_0x9d52('0x24')](function(_0x27f72e){if(_0x27f72e){return _0x27f72e[_0x9d52('0x4f')](_0x1fedd3[_0x9d52('0x44')][_0x9d52('0x50')]||[]);}return null;})[_0x9d52('0x24')](respondWithResult(_0x188e50,null))['catch'](handleError(_0x188e50,null));}; \ No newline at end of file +var _0x9874=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','options','include','FreshdeskConfiguration','show','params','length','find','catch','create','update','body','getFields','order','getSubjects','findOne','FreshdeskField','hasOwnProperty','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','error','stack'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0x9874,0x7b));var _0x4987=function(_0x4a40d1,_0x42858c){_0x4a40d1=_0x4a40d1-0x0;var _0x3e1cca=_0x9874[_0x4a40d1];return _0x3e1cca;};'use strict';var emlformat=require(_0x4987('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4987('0x1'));var jsonpatch=require(_0x4987('0x2'));var rp=require(_0x4987('0x3'));var moment=require('moment');var BPromise=require(_0x4987('0x4'));var Mustache=require(_0x4987('0x5'));var util=require(_0x4987('0x6'));var path=require(_0x4987('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4987('0x8'));var fs=require('fs');var fs_extra=require(_0x4987('0x9'));var _=require('lodash');var squel=require(_0x4987('0xa'));var crypto=require(_0x4987('0xb'));var jsforce=require(_0x4987('0xc'));var deskjs=require(_0x4987('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4987('0xe'));var Papa=require('papaparse');var Redis=require(_0x4987('0xf'));var authService=require(_0x4987('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4987('0x11'));var hardwareService=require(_0x4987('0x12'));var logger=require(_0x4987('0x13'))(_0x4987('0x14'));var utils=require('../../config/utils');var config=require(_0x4987('0x15'));var licenseUtil=require(_0x4987('0x16'));var db=require(_0x4987('0x17'))['db'];function respondWithStatusCode(_0x5b5e6b,_0x3fa144){_0x3fa144=_0x3fa144||0xcc;return function(_0x3b27d7){if(_0x3b27d7){return _0x5b5e6b[_0x4987('0x18')](_0x3fa144);}return _0x5b5e6b[_0x4987('0x19')](_0x3fa144)[_0x4987('0x1a')]();};}function respondWithResult(_0x2f100f,_0x579142){_0x579142=_0x579142||0xc8;return function(_0x221cc0){if(_0x221cc0){return _0x2f100f[_0x4987('0x19')](_0x579142)[_0x4987('0x1b')](_0x221cc0);}};}function respondWithFilteredResult(_0x3e2b28,_0x2b22b9){return function(_0x2754f7){if(_0x2754f7){var _0xa7e1f8=typeof _0x2b22b9[_0x4987('0x1c')]===_0x4987('0x1d')&&typeof _0x2b22b9[_0x4987('0x1e')]===_0x4987('0x1d');var _0x2b45fd=_0x2754f7['count'];var _0x3550d8=_0xa7e1f8?0x0:_0x2b22b9[_0x4987('0x1c')];var _0x513076=_0xa7e1f8?_0x2754f7[_0x4987('0x1f')]:_0x2b22b9['offset']+_0x2b22b9[_0x4987('0x1e')];var _0x45d87a;if(_0x513076>=_0x2b45fd){_0x513076=_0x2b45fd;_0x45d87a=0xc8;}else{_0x45d87a=0xce;}_0x3e2b28[_0x4987('0x19')](_0x45d87a);return _0x3e2b28[_0x4987('0x20')](_0x4987('0x21'),_0x3550d8+'-'+_0x513076+'/'+_0x2b45fd)[_0x4987('0x1b')](_0x2754f7);}return null;};}function patchUpdates(_0x5e5a16){return function(_0x28c1e5){try{jsonpatch['apply'](_0x28c1e5,_0x5e5a16,!![]);}catch(_0x24b52a){return BPromise[_0x4987('0x22')](_0x24b52a);}return _0x28c1e5['save']();};}function saveUpdates(_0x435f49,_0x908ba3){return function(_0x29da89){if(_0x29da89){return _0x29da89['update'](_0x435f49)['then'](function(_0x57453d){return _0x57453d;});}return null;};}function removeEntity(_0x42011d,_0x1faee6){return function(_0x47b755){if(_0x47b755){return _0x47b755[_0x4987('0x23')]()[_0x4987('0x24')](function(){_0x42011d[_0x4987('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e7c9,_0x233dce){return function(_0x3bd826){if(!_0x3bd826){_0x39e7c9['sendStatus'](0x194);}return _0x3bd826;};}function handleError(_0x549129,_0x5700e7){_0x5700e7=_0x5700e7||0x1f4;return function(_0x2303dd){logger[_0x4987('0x25')](_0x2303dd[_0x4987('0x26')]);if(_0x2303dd['name']){delete _0x2303dd[_0x4987('0x27')];}_0x549129[_0x4987('0x19')](_0x5700e7)[_0x4987('0x28')](_0x2303dd);};}exports[_0x4987('0x29')]=function(_0x3e189d,_0x5ad866){var _0x9b8ffd={},_0x653cbb={},_0x4ea34e={'count':0x0,'rows':[]};var _0x300509=_[_0x4987('0x2a')](db['FreshdeskConfiguration'][_0x4987('0x2b')],function(_0x472610){return{'name':_0x472610[_0x4987('0x2c')],'type':_0x472610[_0x4987('0x2d')][_0x4987('0x2e')]};});_0x653cbb[_0x4987('0x2f')]=_[_0x4987('0x2a')](_0x300509,_0x4987('0x27'));_0x653cbb[_0x4987('0x30')]=_[_0x4987('0x31')](_0x3e189d[_0x4987('0x30')]);_0x653cbb['filters']=_[_0x4987('0x32')](_0x653cbb[_0x4987('0x2f')],_0x653cbb[_0x4987('0x30')]);_0x9b8ffd[_0x4987('0x33')]=_[_0x4987('0x32')](_0x653cbb[_0x4987('0x2f')],qs['fields'](_0x3e189d[_0x4987('0x30')][_0x4987('0x34')]));_0x9b8ffd[_0x4987('0x33')]=_0x9b8ffd['attributes']['length']?_0x9b8ffd[_0x4987('0x33')]:_0x653cbb[_0x4987('0x2f')];if(!_0x3e189d[_0x4987('0x30')]['hasOwnProperty'](_0x4987('0x35'))){_0x9b8ffd['limit']=qs[_0x4987('0x1e')](_0x3e189d[_0x4987('0x30')][_0x4987('0x1e')]);_0x9b8ffd['offset']=qs[_0x4987('0x1c')](_0x3e189d[_0x4987('0x30')]['offset']);}_0x9b8ffd['order']=qs['sort'](_0x3e189d[_0x4987('0x30')][_0x4987('0x36')]);_0x9b8ffd[_0x4987('0x37')]=qs[_0x4987('0x38')](_[_0x4987('0x39')](_0x3e189d['query'],_0x653cbb[_0x4987('0x38')]),_0x300509);if(_0x3e189d['query'][_0x4987('0x3a')]){_0x9b8ffd[_0x4987('0x37')]=_[_0x4987('0x3b')](_0x9b8ffd[_0x4987('0x37')],{'$or':_[_0x4987('0x2a')](_0x300509,function(_0x1b8cbc){if(_0x1b8cbc['type']!=='VIRTUAL'){var _0x42bc95={};_0x42bc95[_0x1b8cbc[_0x4987('0x27')]]={'$like':'%'+_0x3e189d[_0x4987('0x30')][_0x4987('0x3a')]+'%'};return _0x42bc95;}})});}_0x9b8ffd=_[_0x4987('0x3b')]({},_0x9b8ffd,_0x3e189d[_0x4987('0x3c')]);var _0x2967e7={'where':_0x9b8ffd['where']};return db['FreshdeskConfiguration'][_0x4987('0x1f')](_0x2967e7)['then'](function(_0x469e1c){_0x4ea34e[_0x4987('0x1f')]=_0x469e1c;if(_0x3e189d[_0x4987('0x30')]['includeAll']){_0x9b8ffd[_0x4987('0x3d')]=[{'all':!![]}];}return db[_0x4987('0x3e')]['findAll'](_0x9b8ffd);})[_0x4987('0x24')](function(_0x4a10e0){_0x4ea34e['rows']=_0x4a10e0;return _0x4ea34e;})['then'](respondWithFilteredResult(_0x5ad866,_0x9b8ffd))['catch'](handleError(_0x5ad866,null));};exports[_0x4987('0x3f')]=function(_0x1c5fcb,_0x7f6a82){var _0x45c544={'raw':![],'where':{'id':_0x1c5fcb[_0x4987('0x40')]['id']}},_0x5005b9={};_0x5005b9[_0x4987('0x2f')]=_[_0x4987('0x31')](db[_0x4987('0x3e')][_0x4987('0x2b')]);_0x5005b9[_0x4987('0x30')]=_[_0x4987('0x31')](_0x1c5fcb['query']);_0x5005b9['filters']=_[_0x4987('0x32')](_0x5005b9['model'],_0x5005b9['query']);_0x45c544['attributes']=_[_0x4987('0x32')](_0x5005b9['model'],qs[_0x4987('0x34')](_0x1c5fcb['query'][_0x4987('0x34')]));_0x45c544[_0x4987('0x33')]=_0x45c544[_0x4987('0x33')][_0x4987('0x41')]?_0x45c544['attributes']:_0x5005b9[_0x4987('0x2f')];if(_0x1c5fcb[_0x4987('0x30')]['includeAll']){_0x45c544[_0x4987('0x3d')]=[{'all':!![]}];}_0x45c544=_[_0x4987('0x3b')]({},_0x45c544,_0x1c5fcb[_0x4987('0x3c')]);return db[_0x4987('0x3e')][_0x4987('0x42')](_0x45c544)[_0x4987('0x24')](handleEntityNotFound(_0x7f6a82,null))[_0x4987('0x24')](respondWithResult(_0x7f6a82,null))[_0x4987('0x43')](handleError(_0x7f6a82,null));};exports[_0x4987('0x44')]=function(_0x42b014,_0x220f87){return db['FreshdeskConfiguration'][_0x4987('0x44')](_0x42b014['body'],{})['then'](respondWithResult(_0x220f87,0xc9))[_0x4987('0x43')](handleError(_0x220f87,null));};exports[_0x4987('0x45')]=function(_0x38bf9d,_0x2ccb42){if(_0x38bf9d[_0x4987('0x46')]['id']){delete _0x38bf9d[_0x4987('0x46')]['id'];}return db[_0x4987('0x3e')][_0x4987('0x42')]({'where':{'id':_0x38bf9d['params']['id']}})[_0x4987('0x24')](handleEntityNotFound(_0x2ccb42,null))[_0x4987('0x24')](saveUpdates(_0x38bf9d['body'],null))[_0x4987('0x24')](respondWithResult(_0x2ccb42,null))['catch'](handleError(_0x2ccb42,null));};exports['destroy']=function(_0x4dcabd,_0x4b36b7){return db[_0x4987('0x3e')]['find']({'where':{'id':_0x4dcabd[_0x4987('0x40')]['id']}})[_0x4987('0x24')](handleEntityNotFound(_0x4b36b7,null))['then'](removeEntity(_0x4b36b7,null))[_0x4987('0x43')](handleError(_0x4b36b7,null));};exports[_0x4987('0x47')]=function(_0x4cc221,_0x56ff56,_0x86002){var _0x213315={};var _0x3c99ec={};var _0x4c9e57;var _0x4a26d1;return db[_0x4987('0x3e')]['findOne']({'where':{'id':_0x4cc221[_0x4987('0x40')]['id']}})[_0x4987('0x24')](handleEntityNotFound(_0x56ff56,null))[_0x4987('0x24')](function(_0x2dffb3){if(_0x2dffb3){_0x4c9e57=_0x2dffb3;_0x3c99ec[_0x4987('0x2f')]=_[_0x4987('0x31')](db['FreshdeskField'][_0x4987('0x2b')]);_0x3c99ec[_0x4987('0x30')]=_[_0x4987('0x31')](_0x4cc221[_0x4987('0x30')]);_0x3c99ec[_0x4987('0x38')]=_['intersection'](_0x3c99ec[_0x4987('0x2f')],_0x3c99ec[_0x4987('0x30')]);_0x213315[_0x4987('0x33')]=_[_0x4987('0x32')](_0x3c99ec[_0x4987('0x2f')],qs[_0x4987('0x34')](_0x4cc221['query']['fields']));_0x213315['attributes']=_0x213315[_0x4987('0x33')][_0x4987('0x41')]?_0x213315[_0x4987('0x33')]:_0x3c99ec[_0x4987('0x2f')];_0x213315[_0x4987('0x48')]=qs[_0x4987('0x36')](_0x4cc221[_0x4987('0x30')][_0x4987('0x36')]);_0x213315['where']=qs[_0x4987('0x38')](_[_0x4987('0x39')](_0x4cc221[_0x4987('0x30')],_0x3c99ec[_0x4987('0x38')]));if(_0x4cc221['query']['filter']){_0x213315[_0x4987('0x37')]=_['merge'](_0x213315[_0x4987('0x37')],{'$or':_[_0x4987('0x2a')](_0x213315['attributes'],function(_0x3ee942){var _0x23cb09={};_0x23cb09[_0x3ee942]={'$like':'%'+_0x4cc221[_0x4987('0x30')][_0x4987('0x3a')]+'%'};return _0x23cb09;})});}_0x213315=_[_0x4987('0x3b')]({},_0x213315,_0x4cc221['options']);return _0x4c9e57[_0x4987('0x47')](_0x213315);}})[_0x4987('0x24')](function(_0x10f16f){if(_0x10f16f){_0x4a26d1=_0x10f16f['length'];if(!_0x4cc221[_0x4987('0x30')]['hasOwnProperty']('nolimit')){_0x213315['limit']=qs[_0x4987('0x1e')](_0x4cc221[_0x4987('0x30')][_0x4987('0x1e')]);_0x213315[_0x4987('0x1c')]=qs[_0x4987('0x1c')](_0x4cc221['query'][_0x4987('0x1c')]);}return _0x4c9e57['getFields'](_0x213315);}})[_0x4987('0x24')](function(_0x48ae7a){if(_0x48ae7a){return _0x48ae7a?{'count':_0x4a26d1,'rows':_0x48ae7a}:null;}})[_0x4987('0x24')](respondWithResult(_0x56ff56,null))[_0x4987('0x43')](handleError(_0x56ff56,null));};exports[_0x4987('0x49')]=function(_0x156c53,_0x7ae440,_0x3c21a7){var _0x5cf486={};var _0x5e56fe={};var _0x4a7d01;var _0x5173c9;return db[_0x4987('0x3e')][_0x4987('0x4a')]({'where':{'id':_0x156c53[_0x4987('0x40')]['id']}})[_0x4987('0x24')](handleEntityNotFound(_0x7ae440,null))[_0x4987('0x24')](function(_0x230fb2){if(_0x230fb2){_0x4a7d01=_0x230fb2;_0x5e56fe[_0x4987('0x2f')]=_[_0x4987('0x31')](db[_0x4987('0x4b')][_0x4987('0x2b')]);_0x5e56fe[_0x4987('0x30')]=_[_0x4987('0x31')](_0x156c53['query']);_0x5e56fe[_0x4987('0x38')]=_['intersection'](_0x5e56fe['model'],_0x5e56fe['query']);_0x5cf486['attributes']=_['intersection'](_0x5e56fe[_0x4987('0x2f')],qs[_0x4987('0x34')](_0x156c53[_0x4987('0x30')][_0x4987('0x34')]));_0x5cf486[_0x4987('0x33')]=_0x5cf486[_0x4987('0x33')][_0x4987('0x41')]?_0x5cf486[_0x4987('0x33')]:_0x5e56fe['model'];_0x5cf486[_0x4987('0x48')]=qs[_0x4987('0x36')](_0x156c53[_0x4987('0x30')][_0x4987('0x36')]);_0x5cf486['where']=qs[_0x4987('0x38')](_[_0x4987('0x39')](_0x156c53[_0x4987('0x30')],_0x5e56fe[_0x4987('0x38')]));if(_0x156c53[_0x4987('0x30')]['filter']){_0x5cf486[_0x4987('0x37')]=_[_0x4987('0x3b')](_0x5cf486[_0x4987('0x37')],{'$or':_[_0x4987('0x2a')](_0x5cf486[_0x4987('0x33')],function(_0xbd9ced){var _0x3671d9={};_0x3671d9[_0xbd9ced]={'$like':'%'+_0x156c53[_0x4987('0x30')][_0x4987('0x3a')]+'%'};return _0x3671d9;})});}_0x5cf486=_['merge']({},_0x5cf486,_0x156c53[_0x4987('0x3c')]);return _0x4a7d01[_0x4987('0x49')](_0x5cf486);}})[_0x4987('0x24')](function(_0x3dd7e0){if(_0x3dd7e0){_0x5173c9=_0x3dd7e0[_0x4987('0x41')];if(!_0x156c53[_0x4987('0x30')][_0x4987('0x4c')](_0x4987('0x35'))){_0x5cf486[_0x4987('0x1e')]=qs[_0x4987('0x1e')](_0x156c53[_0x4987('0x30')][_0x4987('0x1e')]);_0x5cf486[_0x4987('0x1c')]=qs[_0x4987('0x1c')](_0x156c53[_0x4987('0x30')]['offset']);}return _0x4a7d01[_0x4987('0x49')](_0x5cf486);}})[_0x4987('0x24')](function(_0x30041b){if(_0x30041b){return _0x30041b?{'count':_0x5173c9,'rows':_0x30041b}:null;}})['then'](respondWithResult(_0x7ae440,null))[_0x4987('0x43')](handleError(_0x7ae440,null));};exports[_0x4987('0x4d')]=function(_0xf37bd3,_0x2a8b5d,_0xe29b9){var _0xce7af7={};var _0x523410={};var _0xf2c740;var _0x4948ce;return db[_0x4987('0x3e')]['findOne']({'where':{'id':_0xf37bd3[_0x4987('0x40')]['id']}})[_0x4987('0x24')](handleEntityNotFound(_0x2a8b5d,null))[_0x4987('0x24')](function(_0x250140){if(_0x250140){_0xf2c740=_0x250140;_0x523410['model']=_['keys'](db[_0x4987('0x4b')][_0x4987('0x2b')]);_0x523410['query']=_[_0x4987('0x31')](_0xf37bd3[_0x4987('0x30')]);_0x523410[_0x4987('0x38')]=_[_0x4987('0x32')](_0x523410[_0x4987('0x2f')],_0x523410[_0x4987('0x30')]);_0xce7af7[_0x4987('0x33')]=_['intersection'](_0x523410['model'],qs['fields'](_0xf37bd3[_0x4987('0x30')]['fields']));_0xce7af7[_0x4987('0x33')]=_0xce7af7[_0x4987('0x33')][_0x4987('0x41')]?_0xce7af7[_0x4987('0x33')]:_0x523410[_0x4987('0x2f')];_0xce7af7[_0x4987('0x48')]=qs[_0x4987('0x36')](_0xf37bd3[_0x4987('0x30')][_0x4987('0x36')]);_0xce7af7[_0x4987('0x37')]=qs[_0x4987('0x38')](_[_0x4987('0x39')](_0xf37bd3[_0x4987('0x30')],_0x523410[_0x4987('0x38')]));if(_0xf37bd3[_0x4987('0x30')]['filter']){_0xce7af7[_0x4987('0x37')]=_['merge'](_0xce7af7['where'],{'$or':_['map'](_0xce7af7[_0x4987('0x33')],function(_0x2e1183){var _0x40e020={};_0x40e020[_0x2e1183]={'$like':'%'+_0xf37bd3['query']['filter']+'%'};return _0x40e020;})});}_0xce7af7=_['merge']({},_0xce7af7,_0xf37bd3[_0x4987('0x3c')]);return _0xf2c740[_0x4987('0x4d')](_0xce7af7);}})[_0x4987('0x24')](function(_0x11083e){if(_0x11083e){_0x4948ce=_0x11083e[_0x4987('0x41')];if(!_0xf37bd3['query'][_0x4987('0x4c')](_0x4987('0x35'))){_0xce7af7[_0x4987('0x1e')]=qs[_0x4987('0x1e')](_0xf37bd3[_0x4987('0x30')][_0x4987('0x1e')]);_0xce7af7['offset']=qs[_0x4987('0x1c')](_0xf37bd3['query'][_0x4987('0x1c')]);}return _0xf2c740[_0x4987('0x4d')](_0xce7af7);}})[_0x4987('0x24')](function(_0x55fd98){if(_0x55fd98){return _0x55fd98?{'count':_0x4948ce,'rows':_0x55fd98}:null;}})[_0x4987('0x24')](respondWithResult(_0x2a8b5d,null))[_0x4987('0x43')](handleError(_0x2a8b5d,null));};exports[_0x4987('0x4e')]=function(_0xce22,_0x24c769,_0xdc0d00){var _0x12854b={};var _0x1584b5={};var _0x12aa25;var _0x58bc09;return db[_0x4987('0x3e')]['findOne']({'where':{'id':_0xce22[_0x4987('0x40')]['id']}})[_0x4987('0x24')](handleEntityNotFound(_0x24c769,null))[_0x4987('0x24')](function(_0x50fee1){if(_0x50fee1){_0x12aa25=_0x50fee1;_0x1584b5[_0x4987('0x2f')]=_['keys'](db['Tag'][_0x4987('0x2b')]);_0x1584b5['query']=_[_0x4987('0x31')](_0xce22[_0x4987('0x30')]);_0x1584b5[_0x4987('0x38')]=_[_0x4987('0x32')](_0x1584b5[_0x4987('0x2f')],_0x1584b5[_0x4987('0x30')]);_0x12854b[_0x4987('0x33')]=_[_0x4987('0x32')](_0x1584b5[_0x4987('0x2f')],qs[_0x4987('0x34')](_0xce22[_0x4987('0x30')][_0x4987('0x34')]));_0x12854b[_0x4987('0x33')]=_0x12854b[_0x4987('0x33')][_0x4987('0x41')]?_0x12854b[_0x4987('0x33')]:_0x1584b5[_0x4987('0x2f')];_0x12854b['order']=qs[_0x4987('0x36')](_0xce22[_0x4987('0x30')][_0x4987('0x36')]);_0x12854b['where']=qs[_0x4987('0x38')](_['pick'](_0xce22[_0x4987('0x30')],_0x1584b5[_0x4987('0x38')]));if(_0xce22[_0x4987('0x30')][_0x4987('0x3a')]){_0x12854b['where']=_[_0x4987('0x3b')](_0x12854b[_0x4987('0x37')],{'$or':_[_0x4987('0x2a')](_0x12854b[_0x4987('0x33')],function(_0x5c5219){var _0x3d7122={};_0x3d7122[_0x5c5219]={'$like':'%'+_0xce22['query'][_0x4987('0x3a')]+'%'};return _0x3d7122;})});}_0x12854b=_['merge']({},_0x12854b,_0xce22[_0x4987('0x3c')]);return _0x12aa25['getTags'](_0x12854b);}})[_0x4987('0x24')](function(_0x5bde99){if(_0x5bde99){_0x58bc09=_0x5bde99[_0x4987('0x41')];if(!_0xce22[_0x4987('0x30')]['hasOwnProperty'](_0x4987('0x35'))){_0x12854b['limit']=qs[_0x4987('0x1e')](_0xce22[_0x4987('0x30')]['limit']);_0x12854b[_0x4987('0x1c')]=qs[_0x4987('0x1c')](_0xce22[_0x4987('0x30')]['offset']);}return _0x12aa25[_0x4987('0x4e')](_0x12854b);}})[_0x4987('0x24')](function(_0x4778de){if(_0x4778de){return _0x4778de?{'count':_0x58bc09,'rows':_0x4778de}:null;}})['then'](respondWithResult(_0x24c769,null))[_0x4987('0x43')](handleError(_0x24c769,null));};exports['setTags']=function(_0x48eddb,_0xfd5daf,_0x280d01){if(_0x48eddb[_0x4987('0x46')]['id']){delete _0x48eddb[_0x4987('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x4987('0x4a')]({'where':{'id':_0x48eddb[_0x4987('0x40')]['id']}})['then'](handleEntityNotFound(_0xfd5daf,null))['then'](function(_0x3f6888){if(_0x3f6888){return _0x3f6888[_0x4987('0x4f')](_0x48eddb[_0x4987('0x46')][_0x4987('0x50')]||[]);}return null;})['then'](respondWithResult(_0xfd5daf,null))['catch'](handleError(_0xfd5daf,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 984d61b..8e68ea8 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 _0x89f0=['int_freshdesk_configurations','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','FreshdeskConfiguration'];(function(_0x555618,_0x1e6fac){var _0xc740a0=function(_0x398480){while(--_0x398480){_0x555618['push'](_0x555618['shift']());}};_0xc740a0(++_0x1e6fac);}(_0x89f0,0x1cc));var _0x089f=function(_0x4522d2,_0x4d384e){_0x4522d2=_0x4522d2-0x0;var _0x22a06f=_0x89f0[_0x4522d2];return _0x22a06f;};'use strict';var _=require('lodash');var util=require(_0x089f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x089f('0x1'));var BPromise=require(_0x089f('0x2'));var rp=require(_0x089f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x089f('0x4'));var config=require(_0x089f('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x089f('0x6')]=function(_0x10dcb3,_0x228bba){return _0x10dcb3['define'](_0x089f('0x7'),attributes,{'tableName':_0x089f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc822=['request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4f5df8,_0x23cd1c){var _0x51e906=function(_0x11a19d){while(--_0x11a19d){_0x4f5df8['push'](_0x4f5df8['shift']());}};_0x51e906(++_0x23cd1c);}(_0xc822,0x187));var _0x2c82=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xc822[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x2c82('0x0'));var util=require(_0x2c82('0x1'));var logger=require(_0x2c82('0x2'))('api');var moment=require(_0x2c82('0x3'));var BPromise=require(_0x2c82('0x4'));var rp=require(_0x2c82('0x5'));var fs=require('fs');var path=require(_0x2c82('0x6'));var rimraf=require(_0x2c82('0x7'));var config=require(_0x2c82('0x8'));var attributes=require(_0x2c82('0x9'));module['exports']=function(_0xae5a97,_0x5c50af){return _0xae5a97['define'](_0x2c82('0xa'),attributes,{'tableName':_0x2c82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 6e8ce55..98b8416 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 _0x75eb=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x75eb,0x18a));var _0xb75e=function(_0x2925aa,_0x124902){_0x2925aa=_0x2925aa-0x0;var _0x4edce7=_0x75eb[_0x2925aa];return _0x4edce7;};'use strict';var _=require(_0xb75e('0x0'));var util=require(_0xb75e('0x1'));var moment=require(_0xb75e('0x2'));var BPromise=require(_0xb75e('0x3'));var rs=require(_0xb75e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb75e('0x5'))['db'];var utils=require(_0xb75e('0x6'));var logger=require('../../config/logger')(_0xb75e('0x7'));var config=require(_0xb75e('0x8'));var jayson=require(_0xb75e('0x9'));var client=jayson[_0xb75e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a93dd,_0x3a2a46,_0x191fd4){return new BPromise(function(_0x421664,_0x49dac6){return client['request'](_0x4a93dd,_0x191fd4)[_0xb75e('0xb')](function(_0x512e8f){logger[_0xb75e('0xc')](_0xb75e('0xd'),_0x3a2a46,_0xb75e('0xe'));logger[_0xb75e('0xf')](_0xb75e('0x10'),_0x3a2a46,_0xb75e('0xe'),JSON[_0xb75e('0x11')](_0x512e8f));if(_0x512e8f[_0xb75e('0x12')]){if(_0x512e8f[_0xb75e('0x12')][_0xb75e('0x13')]===0x1f4){logger[_0xb75e('0x12')](_0xb75e('0xd'),_0x3a2a46,_0x512e8f['error']['message']);return _0x49dac6(_0x512e8f[_0xb75e('0x12')]['message']);}logger[_0xb75e('0x12')](_0xb75e('0xd'),_0x3a2a46,_0x512e8f[_0xb75e('0x12')][_0xb75e('0x14')]);return _0x421664(_0x512e8f[_0xb75e('0x12')][_0xb75e('0x14')]);}else{logger[_0xb75e('0xc')](_0xb75e('0xd'),_0x3a2a46,_0xb75e('0xe'));_0x421664(_0x512e8f[_0xb75e('0x15')][_0xb75e('0x14')]);}})[_0xb75e('0x16')](function(_0x2badbf){logger['error'](_0xb75e('0xd'),_0x3a2a46,_0x2badbf);_0x49dac6(_0x2badbf);});});} \ No newline at end of file +var _0x1a82=['request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4729ea,_0x478433){var _0x2a3aef=function(_0x2d54a8){while(--_0x2d54a8){_0x4729ea['push'](_0x4729ea['shift']());}};_0x2a3aef(++_0x478433);}(_0x1a82,0x1c2));var _0x21a8=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x1a82[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x21a8('0x0'));var util=require(_0x21a8('0x1'));var moment=require(_0x21a8('0x2'));var BPromise=require(_0x21a8('0x3'));var rs=require(_0x21a8('0x4'));var fs=require('fs');var Redis=require(_0x21a8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21a8('0x6'));var logger=require('../../config/logger')(_0x21a8('0x7'));var config=require(_0x21a8('0x8'));var jayson=require(_0x21a8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5873f4,_0xea0211,_0x2a8ff1){return new BPromise(function(_0x3e9086,_0x1a5f91){return client[_0x21a8('0xa')](_0x5873f4,_0x2a8ff1)['then'](function(_0x57606b){logger['info'](_0x21a8('0xb'),_0xea0211,_0x21a8('0xc'));logger[_0x21a8('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xea0211,'request\x20sent',JSON[_0x21a8('0xe')](_0x57606b));if(_0x57606b[_0x21a8('0xf')]){if(_0x57606b[_0x21a8('0xf')][_0x21a8('0x10')]===0x1f4){logger[_0x21a8('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xea0211,_0x57606b[_0x21a8('0xf')][_0x21a8('0x11')]);return _0x1a5f91(_0x57606b['error'][_0x21a8('0x11')]);}logger[_0x21a8('0xf')](_0x21a8('0xb'),_0xea0211,_0x57606b['error'][_0x21a8('0x11')]);return _0x3e9086(_0x57606b[_0x21a8('0xf')][_0x21a8('0x11')]);}else{logger[_0x21a8('0x12')](_0x21a8('0xb'),_0xea0211,_0x21a8('0xc'));_0x3e9086(_0x57606b[_0x21a8('0x13')]['message']);}})['catch'](function(_0x592dd9){logger['error'](_0x21a8('0xb'),_0xea0211,_0x592dd9);_0x1a5f91(_0x592dd9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index dbcf0a5..f690bc0 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 _0xaaa0=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5922f7,_0x23885e){var _0x145529=function(_0x34bd66){while(--_0x34bd66){_0x5922f7['push'](_0x5922f7['shift']());}};_0x145529(++_0x23885e);}(_0xaaa0,0x162));var _0x0aaa=function(_0x588bd,_0xbb456d){_0x588bd=_0x588bd-0x0;var _0x398ad0=_0xaaa0[_0x588bd];return _0x398ad0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0aaa('0x0'));var timeout=require(_0x0aaa('0x1'));var express=require(_0x0aaa('0x2'));var router=express['Router']();var fs_extra=require(_0x0aaa('0x3'));var auth=require(_0x0aaa('0x4'));var interaction=require(_0x0aaa('0x5'));var config=require(_0x0aaa('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x0aaa('0x7')]('/',auth[_0x0aaa('0x8')](),controller[_0x0aaa('0x9')]);router[_0x0aaa('0x7')](_0x0aaa('0xa'),auth['isAuthenticated'](),controller[_0x0aaa('0xb')]);router[_0x0aaa('0xc')]('/',auth[_0x0aaa('0x8')](),controller[_0x0aaa('0xd')]);router[_0x0aaa('0xe')]('/:id',auth[_0x0aaa('0x8')](),controller[_0x0aaa('0xf')]);router[_0x0aaa('0x10')](_0x0aaa('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x0aaa('0x11')]=router; \ No newline at end of file +var _0x2c2c=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','post'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x2c2c,0xa7));var _0xc2c2=function(_0x3b9753,_0x5d2a19){_0x3b9753=_0x3b9753-0x0;var _0xa6484d=_0x2c2c[_0x3b9753];return _0xa6484d;};'use strict';var multer=require(_0xc2c2('0x0'));var util=require(_0xc2c2('0x1'));var path=require(_0xc2c2('0x2'));var timeout=require(_0xc2c2('0x3'));var express=require(_0xc2c2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc2c2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc2c2('0x6'));var controller=require(_0xc2c2('0x7'));router[_0xc2c2('0x8')]('/',auth[_0xc2c2('0x9')](),controller['index']);router[_0xc2c2('0x8')](_0xc2c2('0xa'),auth[_0xc2c2('0x9')](),controller[_0xc2c2('0xb')]);router[_0xc2c2('0xc')]('/',auth[_0xc2c2('0x9')](),controller[_0xc2c2('0xd')]);router[_0xc2c2('0xe')](_0xc2c2('0xa'),auth[_0xc2c2('0x9')](),controller[_0xc2c2('0xf')]);router[_0xc2c2('0x10')](_0xc2c2('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc2c2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 2d18cd7..2a5f9da 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 _0x06df=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM'];(function(_0x1a0fb5,_0x55eb61){var _0x1bdb87=function(_0x321f0f){while(--_0x321f0f){_0x1a0fb5['push'](_0x1a0fb5['shift']());}};_0x1bdb87(++_0x55eb61);}(_0x06df,0x12e));var _0xf06d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x06df[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf06d('0x0'));module['exports']={'type':{'type':Sequelize[_0xf06d('0x1')](_0xf06d('0x2'),_0xf06d('0x3'),_0xf06d('0x4'),_0xf06d('0x5'),_0xf06d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf06d('0x1')](_0xf06d('0x2'),_0xf06d('0x3'),_0xf06d('0x4'))},'keyContent':{'type':Sequelize[_0xf06d('0x7')]},'idField':{'type':Sequelize[_0xf06d('0x7')]},'nameField':{'type':Sequelize[_0xf06d('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xff00=['variable','keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string'];(function(_0x47831f,_0x9a8e91){var _0x2c37c5=function(_0x3f432e){while(--_0x3f432e){_0x47831f['push'](_0x47831f['shift']());}};_0x2c37c5(++_0x9a8e91);}(_0xff00,0x15c));var _0x0ff0=function(_0x5c0192,_0x3ae030){_0x5c0192=_0x5c0192-0x0;var _0x5dd069=_0xff00[_0x5c0192];return _0x5dd069;};'use strict';var Sequelize=require(_0x0ff0('0x0'));module[_0x0ff0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0ff0('0x2'),_0x0ff0('0x3'),'customVariable',_0x0ff0('0x4'),'picklist'),'defaultValue':_0x0ff0('0x2')},'content':{'type':Sequelize[_0x0ff0('0x5')]},'key':{'type':Sequelize[_0x0ff0('0x5')]},'keyType':{'type':Sequelize[_0x0ff0('0x6')](_0x0ff0('0x2'),_0x0ff0('0x3'),_0x0ff0('0x7'))},'keyContent':{'type':Sequelize[_0x0ff0('0x5')]},'idField':{'type':Sequelize[_0x0ff0('0x5')]},'nameField':{'type':Sequelize[_0x0ff0('0x5')]},'customField':{'type':Sequelize[_0x0ff0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0ff0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e659393..bb1aefb 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 _0xe3d4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','destroy','error','name','index','FreshdeskField','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','keys','find','create','update','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x494fdb,_0x4acedc){var _0x5d4b96=function(_0x435edd){while(--_0x435edd){_0x494fdb['push'](_0x494fdb['shift']());}};_0x5d4b96(++_0x4acedc);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x1bafb1,_0x3f4d43){_0x1bafb1=_0x1bafb1-0x0;var _0x1e9aa9=_0xe3d4[_0x1bafb1];return _0x1e9aa9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e3d('0x0'));var zipdir=require(_0x4e3d('0x1'));var jsonpatch=require(_0x4e3d('0x2'));var rp=require('request-promise');var moment=require(_0x4e3d('0x3'));var BPromise=require(_0x4e3d('0x4'));var Mustache=require('mustache');var util=require(_0x4e3d('0x5'));var path=require('path');var sox=require(_0x4e3d('0x6'));var csv=require(_0x4e3d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e3d('0x8'));var _=require(_0x4e3d('0x9'));var squel=require('squel');var crypto=require(_0x4e3d('0xa'));var jsforce=require(_0x4e3d('0xb'));var deskjs=require(_0x4e3d('0xc'));var toCsv=require(_0x4e3d('0x7'));var querystring=require(_0x4e3d('0xd'));var Papa=require(_0x4e3d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e3d('0xf'));var as=require(_0x4e3d('0x10'));var hardwareService=require(_0x4e3d('0x11'));var logger=require(_0x4e3d('0x12'))(_0x4e3d('0x13'));var utils=require(_0x4e3d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4e3d('0x15'));var db=require(_0x4e3d('0x16'))['db'];function respondWithStatusCode(_0x2fc5f6,_0x30b359){_0x30b359=_0x30b359||0xcc;return function(_0x3556ec){if(_0x3556ec){return _0x2fc5f6[_0x4e3d('0x17')](_0x30b359);}return _0x2fc5f6[_0x4e3d('0x18')](_0x30b359)[_0x4e3d('0x19')]();};}function respondWithResult(_0x54debc,_0x44022b){_0x44022b=_0x44022b||0xc8;return function(_0x4325b4){if(_0x4325b4){return _0x54debc[_0x4e3d('0x18')](_0x44022b)['json'](_0x4325b4);}};}function respondWithFilteredResult(_0x3708be,_0x438973){return function(_0x46bf2b){if(_0x46bf2b){var _0xc20768=typeof _0x438973[_0x4e3d('0x1a')]===_0x4e3d('0x1b')&&typeof _0x438973[_0x4e3d('0x1c')]===_0x4e3d('0x1b');var _0x554ba6=_0x46bf2b[_0x4e3d('0x1d')];var _0x5129d5=_0xc20768?0x0:_0x438973['offset'];var _0x19010b=_0xc20768?_0x46bf2b['count']:_0x438973['offset']+_0x438973[_0x4e3d('0x1c')];var _0x2e37ad;if(_0x19010b>=_0x554ba6){_0x19010b=_0x554ba6;_0x2e37ad=0xc8;}else{_0x2e37ad=0xce;}_0x3708be[_0x4e3d('0x18')](_0x2e37ad);return _0x3708be[_0x4e3d('0x1e')]('Content-Range',_0x5129d5+'-'+_0x19010b+'/'+_0x554ba6)[_0x4e3d('0x1f')](_0x46bf2b);}return null;};}function patchUpdates(_0x552ca7){return function(_0x20c533){try{jsonpatch['apply'](_0x20c533,_0x552ca7,!![]);}catch(_0x170f88){return BPromise[_0x4e3d('0x20')](_0x170f88);}return _0x20c533[_0x4e3d('0x21')]();};}function saveUpdates(_0x534185,_0x224c05){return function(_0x2c8186){if(_0x2c8186){return _0x2c8186['update'](_0x534185)['then'](function(_0x18271a){return _0x18271a;});}return null;};}function removeEntity(_0x7a0b3c,_0x35a31b){return function(_0x49301f){if(_0x49301f){return _0x49301f[_0x4e3d('0x22')]()['then'](function(){_0x7a0b3c[_0x4e3d('0x18')](0xcc)[_0x4e3d('0x19')]();});}};}function handleEntityNotFound(_0x43bc1b,_0x50d9db){return function(_0x2434ea){if(!_0x2434ea){_0x43bc1b[_0x4e3d('0x17')](0x194);}return _0x2434ea;};}function handleError(_0x5b1a18,_0x192cb4){_0x192cb4=_0x192cb4||0x1f4;return function(_0x21d7e4){logger[_0x4e3d('0x23')](_0x21d7e4['stack']);if(_0x21d7e4[_0x4e3d('0x24')]){delete _0x21d7e4['name'];}_0x5b1a18[_0x4e3d('0x18')](_0x192cb4)['send'](_0x21d7e4);};}exports[_0x4e3d('0x25')]=function(_0x2d1991,_0x17c0f4){var _0x4dfc6b={},_0x2c5935={},_0x9133f9={'count':0x0,'rows':[]};var _0x492788=_['map'](db[_0x4e3d('0x26')][_0x4e3d('0x27')],function(_0x36621d){return{'name':_0x36621d['fieldName'],'type':_0x36621d[_0x4e3d('0x28')][_0x4e3d('0x29')]};});_0x2c5935['model']=_['map'](_0x492788,_0x4e3d('0x24'));_0x2c5935[_0x4e3d('0x2a')]=_['keys'](_0x2d1991[_0x4e3d('0x2a')]);_0x2c5935['filters']=_[_0x4e3d('0x2b')](_0x2c5935[_0x4e3d('0x2c')],_0x2c5935['query']);_0x4dfc6b[_0x4e3d('0x2d')]=_[_0x4e3d('0x2b')](_0x2c5935[_0x4e3d('0x2c')],qs['fields'](_0x2d1991[_0x4e3d('0x2a')][_0x4e3d('0x2e')]));_0x4dfc6b['attributes']=_0x4dfc6b[_0x4e3d('0x2d')][_0x4e3d('0x2f')]?_0x4dfc6b['attributes']:_0x2c5935[_0x4e3d('0x2c')];if(!_0x2d1991[_0x4e3d('0x2a')][_0x4e3d('0x30')](_0x4e3d('0x31'))){_0x4dfc6b[_0x4e3d('0x1c')]=qs[_0x4e3d('0x1c')](_0x2d1991[_0x4e3d('0x2a')][_0x4e3d('0x1c')]);_0x4dfc6b[_0x4e3d('0x1a')]=qs[_0x4e3d('0x1a')](_0x2d1991[_0x4e3d('0x2a')]['offset']);}_0x4dfc6b[_0x4e3d('0x32')]=qs[_0x4e3d('0x33')](_0x2d1991[_0x4e3d('0x2a')][_0x4e3d('0x33')]);_0x4dfc6b[_0x4e3d('0x34')]=qs[_0x4e3d('0x35')](_['pick'](_0x2d1991[_0x4e3d('0x2a')],_0x2c5935[_0x4e3d('0x35')]),_0x492788);if(_0x2d1991[_0x4e3d('0x2a')][_0x4e3d('0x36')]){_0x4dfc6b[_0x4e3d('0x34')]=_[_0x4e3d('0x37')](_0x4dfc6b[_0x4e3d('0x34')],{'$or':_[_0x4e3d('0x38')](_0x492788,function(_0x5ba9b5){if(_0x5ba9b5[_0x4e3d('0x28')]!==_0x4e3d('0x39')){var _0xdd79a0={};_0xdd79a0[_0x5ba9b5[_0x4e3d('0x24')]]={'$like':'%'+_0x2d1991[_0x4e3d('0x2a')][_0x4e3d('0x36')]+'%'};return _0xdd79a0;}})});}_0x4dfc6b=_['merge']({},_0x4dfc6b,_0x2d1991[_0x4e3d('0x3a')]);var _0x4e8745={'where':_0x4dfc6b[_0x4e3d('0x34')]};return db[_0x4e3d('0x26')][_0x4e3d('0x1d')](_0x4e8745)[_0x4e3d('0x3b')](function(_0x279e69){_0x9133f9[_0x4e3d('0x1d')]=_0x279e69;if(_0x2d1991['query'][_0x4e3d('0x3c')]){_0x4dfc6b[_0x4e3d('0x3d')]=[{'all':!![]}];}return db[_0x4e3d('0x26')][_0x4e3d('0x3e')](_0x4dfc6b);})[_0x4e3d('0x3b')](function(_0x4e1b89){_0x9133f9['rows']=_0x4e1b89;return _0x9133f9;})[_0x4e3d('0x3b')](respondWithFilteredResult(_0x17c0f4,_0x4dfc6b))[_0x4e3d('0x3f')](handleError(_0x17c0f4,null));};exports[_0x4e3d('0x40')]=function(_0x4f1c27,_0x36a36c){var _0x334275={'raw':!![],'where':{'id':_0x4f1c27[_0x4e3d('0x41')]['id']}},_0x572134={};_0x572134['model']=_[_0x4e3d('0x42')](db[_0x4e3d('0x26')][_0x4e3d('0x27')]);_0x572134['query']=_[_0x4e3d('0x42')](_0x4f1c27['query']);_0x572134[_0x4e3d('0x35')]=_[_0x4e3d('0x2b')](_0x572134[_0x4e3d('0x2c')],_0x572134['query']);_0x334275[_0x4e3d('0x2d')]=_[_0x4e3d('0x2b')](_0x572134[_0x4e3d('0x2c')],qs[_0x4e3d('0x2e')](_0x4f1c27[_0x4e3d('0x2a')][_0x4e3d('0x2e')]));_0x334275[_0x4e3d('0x2d')]=_0x334275[_0x4e3d('0x2d')][_0x4e3d('0x2f')]?_0x334275[_0x4e3d('0x2d')]:_0x572134['model'];if(_0x4f1c27[_0x4e3d('0x2a')][_0x4e3d('0x3c')]){_0x334275[_0x4e3d('0x3d')]=[{'all':!![]}];}_0x334275=_[_0x4e3d('0x37')]({},_0x334275,_0x4f1c27[_0x4e3d('0x3a')]);return db[_0x4e3d('0x26')][_0x4e3d('0x43')](_0x334275)[_0x4e3d('0x3b')](handleEntityNotFound(_0x36a36c,null))[_0x4e3d('0x3b')](respondWithResult(_0x36a36c,null))[_0x4e3d('0x3f')](handleError(_0x36a36c,null));};exports[_0x4e3d('0x44')]=function(_0x63bcae,_0x4fba01){return db['FreshdeskField'][_0x4e3d('0x44')](_0x63bcae['body'],{})[_0x4e3d('0x3b')](respondWithResult(_0x4fba01,0xc9))[_0x4e3d('0x3f')](handleError(_0x4fba01,null));};exports[_0x4e3d('0x45')]=function(_0x229b3f,_0x403fa7){if(_0x229b3f['body']['id']){delete _0x229b3f[_0x4e3d('0x46')]['id'];}return db[_0x4e3d('0x26')]['find']({'where':{'id':_0x229b3f['params']['id']}})['then'](handleEntityNotFound(_0x403fa7,null))['then'](saveUpdates(_0x229b3f[_0x4e3d('0x46')],null))[_0x4e3d('0x3b')](respondWithResult(_0x403fa7,null))[_0x4e3d('0x3f')](handleError(_0x403fa7,null));};exports[_0x4e3d('0x22')]=function(_0x1eeaf1,_0x2c59ec){return db[_0x4e3d('0x26')]['find']({'where':{'id':_0x1eeaf1[_0x4e3d('0x41')]['id']}})[_0x4e3d('0x3b')](handleEntityNotFound(_0x2c59ec,null))[_0x4e3d('0x3b')](removeEntity(_0x2c59ec,null))[_0x4e3d('0x3f')](handleError(_0x2c59ec,null));}; \ No newline at end of file +var _0xa75b=['filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','status','offset','limit','undefined','count','set','reject','then','destroy','end','sendStatus','error','index','map','FreshdeskField','rawAttributes','type','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa75b,0x170));var _0xba75=function(_0x3b5377,_0x4dd0bb){_0x3b5377=_0x3b5377-0x0;var _0x59358e=_0xa75b[_0x3b5377];return _0x59358e;};'use strict';var emlformat=require(_0xba75('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba75('0x1'));var rp=require(_0xba75('0x2'));var moment=require(_0xba75('0x3'));var BPromise=require(_0xba75('0x4'));var Mustache=require(_0xba75('0x5'));var util=require(_0xba75('0x6'));var path=require(_0xba75('0x7'));var sox=require(_0xba75('0x8'));var csv=require(_0xba75('0x9'));var ejs=require(_0xba75('0xa'));var fs=require('fs');var fs_extra=require(_0xba75('0xb'));var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var licenseUtil=require(_0xba75('0x18'));var db=require(_0xba75('0x19'))['db'];function respondWithStatusCode(_0x8116d8,_0x1ed697){_0x1ed697=_0x1ed697||0xcc;return function(_0x50db90){if(_0x50db90){return _0x8116d8['sendStatus'](_0x1ed697);}return _0x8116d8[_0xba75('0x1a')](_0x1ed697)['end']();};}function respondWithResult(_0x2f141a,_0x2df615){_0x2df615=_0x2df615||0xc8;return function(_0xa27f76){if(_0xa27f76){return _0x2f141a[_0xba75('0x1a')](_0x2df615)['json'](_0xa27f76);}};}function respondWithFilteredResult(_0x31b3b3,_0x18bab2){return function(_0x256678){if(_0x256678){var _0x4028f9=typeof _0x18bab2[_0xba75('0x1b')]==='undefined'&&typeof _0x18bab2[_0xba75('0x1c')]===_0xba75('0x1d');var _0x14bd83=_0x256678['count'];var _0x2822af=_0x4028f9?0x0:_0x18bab2[_0xba75('0x1b')];var _0xc4bf17=_0x4028f9?_0x256678[_0xba75('0x1e')]:_0x18bab2[_0xba75('0x1b')]+_0x18bab2[_0xba75('0x1c')];var _0x5811cb;if(_0xc4bf17>=_0x14bd83){_0xc4bf17=_0x14bd83;_0x5811cb=0xc8;}else{_0x5811cb=0xce;}_0x31b3b3[_0xba75('0x1a')](_0x5811cb);return _0x31b3b3[_0xba75('0x1f')]('Content-Range',_0x2822af+'-'+_0xc4bf17+'/'+_0x14bd83)['json'](_0x256678);}return null;};}function patchUpdates(_0x35ffd2){return function(_0x31bc33){try{jsonpatch['apply'](_0x31bc33,_0x35ffd2,!![]);}catch(_0x48206c){return BPromise[_0xba75('0x20')](_0x48206c);}return _0x31bc33['save']();};}function saveUpdates(_0x1b8a36,_0x2ece41){return function(_0x19b2d7){if(_0x19b2d7){return _0x19b2d7['update'](_0x1b8a36)[_0xba75('0x21')](function(_0x221d5e){return _0x221d5e;});}return null;};}function removeEntity(_0x139fa4,_0x3e9bd9){return function(_0x14c54b){if(_0x14c54b){return _0x14c54b[_0xba75('0x22')]()['then'](function(){_0x139fa4[_0xba75('0x1a')](0xcc)[_0xba75('0x23')]();});}};}function handleEntityNotFound(_0xe579fb,_0x5ec733){return function(_0x1caa6){if(!_0x1caa6){_0xe579fb[_0xba75('0x24')](0x194);}return _0x1caa6;};}function handleError(_0x26dd53,_0x37f7c8){_0x37f7c8=_0x37f7c8||0x1f4;return function(_0x35c571){logger[_0xba75('0x25')](_0x35c571['stack']);if(_0x35c571['name']){delete _0x35c571['name'];}_0x26dd53[_0xba75('0x1a')](_0x37f7c8)['send'](_0x35c571);};}exports[_0xba75('0x26')]=function(_0x58ea2d,_0x15b5bc){var _0x1afc1f={},_0x20ac78={},_0x4edc2e={'count':0x0,'rows':[]};var _0x3a1fd3=_[_0xba75('0x27')](db[_0xba75('0x28')][_0xba75('0x29')],function(_0x5d9f78){return{'name':_0x5d9f78['fieldName'],'type':_0x5d9f78[_0xba75('0x2a')]['key']};});_0x20ac78[_0xba75('0x2b')]=_[_0xba75('0x27')](_0x3a1fd3,_0xba75('0x2c'));_0x20ac78[_0xba75('0x2d')]=_['keys'](_0x58ea2d[_0xba75('0x2d')]);_0x20ac78[_0xba75('0x2e')]=_['intersection'](_0x20ac78[_0xba75('0x2b')],_0x20ac78[_0xba75('0x2d')]);_0x1afc1f[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x20ac78['model'],qs[_0xba75('0x31')](_0x58ea2d[_0xba75('0x2d')]['fields']));_0x1afc1f[_0xba75('0x2f')]=_0x1afc1f[_0xba75('0x2f')][_0xba75('0x32')]?_0x1afc1f['attributes']:_0x20ac78[_0xba75('0x2b')];if(!_0x58ea2d[_0xba75('0x2d')][_0xba75('0x33')](_0xba75('0x34'))){_0x1afc1f[_0xba75('0x1c')]=qs[_0xba75('0x1c')](_0x58ea2d[_0xba75('0x2d')]['limit']);_0x1afc1f['offset']=qs[_0xba75('0x1b')](_0x58ea2d[_0xba75('0x2d')][_0xba75('0x1b')]);}_0x1afc1f['order']=qs[_0xba75('0x35')](_0x58ea2d[_0xba75('0x2d')]['sort']);_0x1afc1f['where']=qs[_0xba75('0x2e')](_[_0xba75('0x36')](_0x58ea2d[_0xba75('0x2d')],_0x20ac78[_0xba75('0x2e')]),_0x3a1fd3);if(_0x58ea2d[_0xba75('0x2d')]['filter']){_0x1afc1f['where']=_[_0xba75('0x37')](_0x1afc1f[_0xba75('0x38')],{'$or':_[_0xba75('0x27')](_0x3a1fd3,function(_0x68526f){if(_0x68526f[_0xba75('0x2a')]!==_0xba75('0x39')){var _0x987cc1={};_0x987cc1[_0x68526f['name']]={'$like':'%'+_0x58ea2d[_0xba75('0x2d')][_0xba75('0x3a')]+'%'};return _0x987cc1;}})});}_0x1afc1f=_['merge']({},_0x1afc1f,_0x58ea2d[_0xba75('0x3b')]);var _0x3740bd={'where':_0x1afc1f[_0xba75('0x38')]};return db[_0xba75('0x28')][_0xba75('0x1e')](_0x3740bd)[_0xba75('0x21')](function(_0x20e857){_0x4edc2e['count']=_0x20e857;if(_0x58ea2d[_0xba75('0x2d')]['includeAll']){_0x1afc1f[_0xba75('0x3c')]=[{'all':!![]}];}return db['FreshdeskField'][_0xba75('0x3d')](_0x1afc1f);})[_0xba75('0x21')](function(_0x9c32ad){_0x4edc2e[_0xba75('0x3e')]=_0x9c32ad;return _0x4edc2e;})[_0xba75('0x21')](respondWithFilteredResult(_0x15b5bc,_0x1afc1f))[_0xba75('0x3f')](handleError(_0x15b5bc,null));};exports[_0xba75('0x40')]=function(_0x3f2a91,_0xfd400f){var _0x5c7c7f={'raw':!![],'where':{'id':_0x3f2a91[_0xba75('0x41')]['id']}},_0x30b5f0={};_0x30b5f0['model']=_[_0xba75('0x42')](db[_0xba75('0x28')][_0xba75('0x29')]);_0x30b5f0['query']=_['keys'](_0x3f2a91['query']);_0x30b5f0['filters']=_[_0xba75('0x30')](_0x30b5f0['model'],_0x30b5f0[_0xba75('0x2d')]);_0x5c7c7f[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x30b5f0[_0xba75('0x2b')],qs[_0xba75('0x31')](_0x3f2a91['query']['fields']));_0x5c7c7f[_0xba75('0x2f')]=_0x5c7c7f['attributes'][_0xba75('0x32')]?_0x5c7c7f['attributes']:_0x30b5f0[_0xba75('0x2b')];if(_0x3f2a91[_0xba75('0x2d')][_0xba75('0x43')]){_0x5c7c7f[_0xba75('0x3c')]=[{'all':!![]}];}_0x5c7c7f=_['merge']({},_0x5c7c7f,_0x3f2a91[_0xba75('0x3b')]);return db[_0xba75('0x28')][_0xba75('0x44')](_0x5c7c7f)[_0xba75('0x21')](handleEntityNotFound(_0xfd400f,null))[_0xba75('0x21')](respondWithResult(_0xfd400f,null))[_0xba75('0x3f')](handleError(_0xfd400f,null));};exports[_0xba75('0x45')]=function(_0x2cd995,_0x51cd22){return db[_0xba75('0x28')][_0xba75('0x45')](_0x2cd995[_0xba75('0x46')],{})[_0xba75('0x21')](respondWithResult(_0x51cd22,0xc9))[_0xba75('0x3f')](handleError(_0x51cd22,null));};exports['update']=function(_0x2a1f84,_0x25ae33){if(_0x2a1f84[_0xba75('0x46')]['id']){delete _0x2a1f84[_0xba75('0x46')]['id'];}return db[_0xba75('0x28')][_0xba75('0x44')]({'where':{'id':_0x2a1f84[_0xba75('0x41')]['id']}})['then'](handleEntityNotFound(_0x25ae33,null))[_0xba75('0x21')](saveUpdates(_0x2a1f84[_0xba75('0x46')],null))[_0xba75('0x21')](respondWithResult(_0x25ae33,null))['catch'](handleError(_0x25ae33,null));};exports[_0xba75('0x22')]=function(_0x29b4fc,_0x559f6f){return db['FreshdeskField'][_0xba75('0x44')]({'where':{'id':_0x29b4fc['params']['id']}})['then'](handleEntityNotFound(_0x559f6f,null))[_0xba75('0x21')](removeEntity(_0x559f6f,null))['catch'](handleError(_0x559f6f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 2daaa81..478b97c 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 _0xf774=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','idField','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x36b275,_0x156f00){var _0x4bfc22=function(_0x135409){while(--_0x135409){_0x36b275['push'](_0x36b275['shift']());}};_0x4bfc22(++_0x156f00);}(_0xf774,0x1e4));var _0x4f77=function(_0x3da485,_0x349bfb){_0x3da485=_0x3da485-0x0;var _0x17e6e5=_0xf774[_0x3da485];return _0x17e6e5;};'use strict';var _=require(_0x4f77('0x0'));var util=require(_0x4f77('0x1'));var logger=require(_0x4f77('0x2'))(_0x4f77('0x3'));var moment=require(_0x4f77('0x4'));var BPromise=require('bluebird');var rp=require(_0x4f77('0x5'));var fs=require('fs');var path=require(_0x4f77('0x6'));var rimraf=require(_0x4f77('0x7'));var config=require(_0x4f77('0x8'));var attributes=require(_0x4f77('0x9'));module['exports']=function(_0xb2d307,_0x167797){return _0xb2d307[_0x4f77('0xa')](_0x4f77('0xb'),attributes,{'tableName':_0x4f77('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x4f77('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2751=['exports','define','FieldId','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x18a71d,_0x56e344){var _0x423216=function(_0x3235e6){while(--_0x3235e6){_0x18a71d['push'](_0x18a71d['shift']());}};_0x423216(++_0x56e344);}(_0x2751,0xbe));var _0x1275=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2751[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1275('0x0'));var util=require(_0x1275('0x1'));var logger=require(_0x1275('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1275('0x3'));var rp=require(_0x1275('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1275('0x5'));var config=require(_0x1275('0x6'));var attributes=require(_0x1275('0x7'));module[_0x1275('0x8')]=function(_0x4516c8,_0x483199){return _0x4516c8[_0x1275('0x9')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x1275('0xa')],'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 e5f2ee3..882bc91 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 _0x1d5a=['jayson/promise','client','http','info','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1d5a,0x13b));var _0xa1d5=function(_0xe2b483,_0x4739ef){_0xe2b483=_0xe2b483-0x0;var _0x3ba818=_0x1d5a[_0xe2b483];return _0x3ba818;};'use strict';var _=require(_0xa1d5('0x0'));var util=require(_0xa1d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa1d5('0x2'));var fs=require('fs');var Redis=require(_0xa1d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1d5('0x4'));var logger=require(_0xa1d5('0x5'))(_0xa1d5('0x6'));var config=require(_0xa1d5('0x7'));var jayson=require(_0xa1d5('0x8'));var client=jayson[_0xa1d5('0x9')][_0xa1d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c4104,_0x50b594,_0x5671bf){return new BPromise(function(_0xf28035,_0x81c5ea){return client['request'](_0x1c4104,_0x5671bf)['then'](function(_0x36d00c){logger[_0xa1d5('0xb')](_0xa1d5('0xc'),_0x50b594,'request\x20sent');logger[_0xa1d5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x50b594,_0xa1d5('0xe'),JSON[_0xa1d5('0xf')](_0x36d00c));if(_0x36d00c[_0xa1d5('0x10')]){if(_0x36d00c[_0xa1d5('0x10')]['code']===0x1f4){logger[_0xa1d5('0x10')](_0xa1d5('0xc'),_0x50b594,_0x36d00c['error'][_0xa1d5('0x11')]);return _0x81c5ea(_0x36d00c[_0xa1d5('0x10')][_0xa1d5('0x11')]);}logger[_0xa1d5('0x10')](_0xa1d5('0xc'),_0x50b594,_0x36d00c[_0xa1d5('0x10')]['message']);return _0xf28035(_0x36d00c[_0xa1d5('0x10')]['message']);}else{logger['info'](_0xa1d5('0xc'),_0x50b594,'request\x20sent');_0xf28035(_0x36d00c['result'][_0xa1d5('0x11')]);}})[_0xa1d5('0x12')](function(_0x55d505){logger['error'](_0xa1d5('0xc'),_0x50b594,_0x55d505);_0x81c5ea(_0x55d505);});});} \ No newline at end of file +var _0x5374=['request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x545894,_0x49e368){var _0x365478=function(_0x3f5553){while(--_0x3f5553){_0x545894['push'](_0x545894['shift']());}};_0x365478(++_0x49e368);}(_0x5374,0x6b));var _0x4537=function(_0x347d78,_0x2f983e){_0x347d78=_0x347d78-0x0;var _0x4fbf71=_0x5374[_0x347d78];return _0x4fbf71;};'use strict';var _=require(_0x4537('0x0'));var util=require(_0x4537('0x1'));var moment=require(_0x4537('0x2'));var BPromise=require(_0x4537('0x3'));var rs=require(_0x4537('0x4'));var fs=require('fs');var Redis=require(_0x4537('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4537('0x6'));var logger=require(_0x4537('0x7'))(_0x4537('0x8'));var config=require(_0x4537('0x9'));var jayson=require(_0x4537('0xa'));var client=jayson[_0x4537('0xb')][_0x4537('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x486e80,_0x9c1b87,_0xf3b2c9){return new BPromise(function(_0x509bea,_0x1ef2dc){return client[_0x4537('0xd')](_0x486e80,_0xf3b2c9)[_0x4537('0xe')](function(_0x463135){logger[_0x4537('0xf')](_0x4537('0x10'),_0x9c1b87,_0x4537('0x11'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x9c1b87,_0x4537('0x11'),JSON[_0x4537('0x12')](_0x463135));if(_0x463135[_0x4537('0x13')]){if(_0x463135['error'][_0x4537('0x14')]===0x1f4){logger[_0x4537('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x9c1b87,_0x463135[_0x4537('0x13')][_0x4537('0x15')]);return _0x1ef2dc(_0x463135[_0x4537('0x13')][_0x4537('0x15')]);}logger[_0x4537('0x13')](_0x4537('0x10'),_0x9c1b87,_0x463135[_0x4537('0x13')]['message']);return _0x509bea(_0x463135[_0x4537('0x13')]['message']);}else{logger[_0x4537('0xf')](_0x4537('0x10'),_0x9c1b87,_0x4537('0x11'));_0x509bea(_0x463135[_0x4537('0x16')][_0x4537('0x15')]);}})[_0x4537('0x17')](function(_0x477976){logger[_0x4537('0x13')](_0x4537('0x10'),_0x9c1b87,_0x477976);_0x1ef2dc(_0x477976);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 8e19332..3297f59 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 _0xa75b=['post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields'];(function(_0xdf8bc2,_0x46f9ed){var _0x3f2cf6=function(_0x67cc9f){while(--_0x67cc9f){_0xdf8bc2['push'](_0xdf8bc2['shift']());}};_0x3f2cf6(++_0x46f9ed);}(_0xa75b,0x170));var _0xba75=function(_0x545e35,_0x5bc8d4){_0x545e35=_0x545e35-0x0;var _0x2f5bc5=_0xa75b[_0x545e35];return _0x2f5bc5;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x10')](_0xba75('0x12'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);router[_0xba75('0x14')](_0xba75('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xba75('0x15')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0x16')]);module[_0xba75('0x17')]=router; \ No newline at end of file +var _0x69d3=['path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','multer','util'];(function(_0x2879e7,_0x2c5d6c){var _0xb3f633=function(_0x2eb79d){while(--_0x2eb79d){_0x2879e7['push'](_0x2879e7['shift']());}};_0xb3f633(++_0x2c5d6c);}(_0x69d3,0xda));var _0x369d=function(_0x8a45d,_0x210fd3){_0x8a45d=_0x8a45d-0x0;var _0x1f9483=_0x69d3[_0x8a45d];return _0x1f9483;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var timeout=require('connect-timeout');var express=require(_0x369d('0x3'));var router=express[_0x369d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x369d('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0x369d('0x6')]('/',auth[_0x369d('0x7')](),controller[_0x369d('0x8')]);router[_0x369d('0x6')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller[_0x369d('0xa')]);router[_0x369d('0x6')](_0x369d('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x369d('0x6')](_0x369d('0xc'),auth[_0x369d('0x7')](),controller[_0x369d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x369d('0xe')]);router[_0x369d('0xf')](_0x369d('0xb'),auth[_0x369d('0x7')](),controller[_0x369d('0x10')]);router[_0x369d('0x11')]('/:id',auth[_0x369d('0x7')](),controller[_0x369d('0x12')]);router[_0x369d('0x13')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 4b7d054..1a5ce43 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 _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x3375bf,_0x2602d5){var _0x1fa537=function(_0x2c660d){while(--_0x2c660d){_0x3375bf['push'](_0x3375bf['shift']());}};_0x1fa537(++_0x2602d5);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x5d4398,_0x26461e){_0x5d4398=_0x5d4398-0x0;var _0x485af4=_0xcf2f[_0x5d4398];return _0x485af4;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['username','remoteUri','sequelize','exports','STRING'];(function(_0x1c45aa,_0x1743b4){var _0x32b2a4=function(_0x5196c){while(--_0x5196c){_0x1c45aa['push'](_0x1c45aa['shift']());}};_0x32b2a4(++_0x1743b4);}(_0xdb28,0x106));var _0x8db2=function(_0x54f8e9,_0x599c2b){_0x54f8e9=_0x54f8e9-0x0;var _0x4d28f2=_0xdb28[_0x54f8e9];return _0x4d28f2;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'name':{'type':Sequelize[_0x8db2('0x2')]},'description':{'type':Sequelize[_0x8db2('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8db2('0x3')},'apiKey':{'type':Sequelize[_0x8db2('0x2')]},'remoteUri':{'type':Sequelize[_0x8db2('0x2')],'unique':_0x8db2('0x4')},'serverUrl':{'type':Sequelize[_0x8db2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 4b0b5bb..a390613 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 _0x1127=['/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','apply','reject','save','update','destroy','end','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','format','%s%s'];(function(_0x3213b4,_0x3cddd0){var _0xa97785=function(_0x3c9282){while(--_0x3c9282){_0x3213b4['push'](_0x3213b4['shift']());}};_0xa97785(++_0x3cddd0);}(_0x1127,0x13c));var _0x7112=function(_0x2594dc,_0x33b3d0){_0x2594dc=_0x2594dc-0x0;var _0x4c4506=_0x1127[_0x2594dc];return _0x4c4506;};'use strict';var emlformat=require(_0x7112('0x0'));var rimraf=require(_0x7112('0x1'));var zipdir=require(_0x7112('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7112('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7112('0x4'));var sox=require(_0x7112('0x5'));var csv=require(_0x7112('0x6'));var ejs=require(_0x7112('0x7'));var fs=require('fs');var fs_extra=require(_0x7112('0x8'));var _=require(_0x7112('0x9'));var squel=require(_0x7112('0xa'));var crypto=require(_0x7112('0xb'));var jsforce=require(_0x7112('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7112('0x6'));var querystring=require(_0x7112('0xd'));var Papa=require(_0x7112('0xe'));var Redis=require('ioredis');var authService=require(_0x7112('0xf'));var qs=require(_0x7112('0x10'));var as=require(_0x7112('0x11'));var hardwareService=require(_0x7112('0x12'));var logger=require(_0x7112('0x13'))('api');var utils=require(_0x7112('0x14'));var config=require(_0x7112('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7112('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2bcca4,_0xfefd2e){_0xfefd2e=_0xfefd2e||0xcc;return function(_0x556073){if(_0x556073){return _0x2bcca4[_0x7112('0x17')](_0xfefd2e);}return _0x2bcca4[_0x7112('0x18')](_0xfefd2e)['end']();};}function respondWithResult(_0x1006d8,_0x261d2c){_0x261d2c=_0x261d2c||0xc8;return function(_0x5a4496){if(_0x5a4496){return _0x1006d8[_0x7112('0x18')](_0x261d2c)['json'](_0x5a4496);}};}function respondWithFilteredResult(_0x575b06,_0x5d0d26){return function(_0x35871e){if(_0x35871e){var _0x354407=typeof _0x5d0d26[_0x7112('0x19')]===_0x7112('0x1a')&&typeof _0x5d0d26[_0x7112('0x1b')]===_0x7112('0x1a');var _0x2558e8=_0x35871e[_0x7112('0x1c')];var _0xb583f2=_0x354407?0x0:_0x5d0d26[_0x7112('0x19')];var _0x510a6e=_0x354407?_0x35871e['count']:_0x5d0d26['offset']+_0x5d0d26[_0x7112('0x1b')];var _0x4cdf56;if(_0x510a6e>=_0x2558e8){_0x510a6e=_0x2558e8;_0x4cdf56=0xc8;}else{_0x4cdf56=0xce;}_0x575b06[_0x7112('0x18')](_0x4cdf56);return _0x575b06['set']('Content-Range',_0xb583f2+'-'+_0x510a6e+'/'+_0x2558e8)['json'](_0x35871e);}return null;};}function patchUpdates(_0x97116c){return function(_0x1e4e4a){try{jsonpatch[_0x7112('0x1d')](_0x1e4e4a,_0x97116c,!![]);}catch(_0x311bdf){return BPromise[_0x7112('0x1e')](_0x311bdf);}return _0x1e4e4a[_0x7112('0x1f')]();};}function saveUpdates(_0x13f422,_0x2d2479){return function(_0x544bd1){if(_0x544bd1){return _0x544bd1[_0x7112('0x20')](_0x13f422)['then'](function(_0x2098fa){return _0x2098fa;});}return null;};}function removeEntity(_0x327bd6,_0x372844){return function(_0x5d5257){if(_0x5d5257){return _0x5d5257[_0x7112('0x21')]()['then'](function(){_0x327bd6[_0x7112('0x18')](0xcc)[_0x7112('0x22')]();});}};}function handleEntityNotFound(_0x2b2440,_0x1d7e1d){return function(_0x36777d){if(!_0x36777d){_0x2b2440[_0x7112('0x17')](0x194);}return _0x36777d;};}function handleError(_0x3af642,_0x15150b){_0x15150b=_0x15150b||0x1f4;return function(_0x278f11){logger[_0x7112('0x23')](_0x278f11[_0x7112('0x24')]);if(_0x278f11[_0x7112('0x25')]){delete _0x278f11[_0x7112('0x25')];}_0x3af642[_0x7112('0x18')](_0x15150b)[_0x7112('0x26')](_0x278f11);};}exports[_0x7112('0x27')]=function(_0x11a40f,_0x3a5604){var _0x40e064={},_0x3f8ff3={},_0x2639fc={'count':0x0,'rows':[]};var _0x57502c=_['map'](db[_0x7112('0x28')][_0x7112('0x29')],function(_0x2991e5){return{'name':_0x2991e5[_0x7112('0x2a')],'type':_0x2991e5[_0x7112('0x2b')][_0x7112('0x2c')]};});_0x3f8ff3['model']=_[_0x7112('0x2d')](_0x57502c,'name');_0x3f8ff3['query']=_['keys'](_0x11a40f[_0x7112('0x2e')]);_0x3f8ff3[_0x7112('0x2f')]=_[_0x7112('0x30')](_0x3f8ff3[_0x7112('0x31')],_0x3f8ff3[_0x7112('0x2e')]);_0x40e064[_0x7112('0x32')]=_[_0x7112('0x30')](_0x3f8ff3[_0x7112('0x31')],qs[_0x7112('0x33')](_0x11a40f[_0x7112('0x2e')][_0x7112('0x33')]));_0x40e064[_0x7112('0x32')]=_0x40e064[_0x7112('0x32')][_0x7112('0x34')]?_0x40e064[_0x7112('0x32')]:_0x3f8ff3[_0x7112('0x31')];if(!_0x11a40f[_0x7112('0x2e')]['hasOwnProperty'](_0x7112('0x35'))){_0x40e064[_0x7112('0x1b')]=qs[_0x7112('0x1b')](_0x11a40f[_0x7112('0x2e')][_0x7112('0x1b')]);_0x40e064[_0x7112('0x19')]=qs[_0x7112('0x19')](_0x11a40f[_0x7112('0x2e')][_0x7112('0x19')]);}_0x40e064[_0x7112('0x36')]=qs['sort'](_0x11a40f[_0x7112('0x2e')]['sort']);_0x40e064[_0x7112('0x37')]=qs[_0x7112('0x2f')](_[_0x7112('0x38')](_0x11a40f[_0x7112('0x2e')],_0x3f8ff3['filters']),_0x57502c);if(_0x11a40f[_0x7112('0x2e')][_0x7112('0x39')]){_0x40e064[_0x7112('0x37')]=_[_0x7112('0x3a')](_0x40e064['where'],{'$or':_[_0x7112('0x2d')](_0x57502c,function(_0x539c6b){if(_0x539c6b['type']!==_0x7112('0x3b')){var _0x2987dd={};_0x2987dd[_0x539c6b[_0x7112('0x25')]]={'$like':'%'+_0x11a40f['query'][_0x7112('0x39')]+'%'};return _0x2987dd;}})});}_0x40e064=_['merge']({},_0x40e064,_0x11a40f[_0x7112('0x3c')]);var _0x37d6f0={'where':_0x40e064[_0x7112('0x37')]};return db[_0x7112('0x28')][_0x7112('0x1c')](_0x37d6f0)[_0x7112('0x3d')](function(_0x1d0fe7){_0x2639fc[_0x7112('0x1c')]=_0x1d0fe7;if(_0x11a40f[_0x7112('0x2e')][_0x7112('0x3e')]){_0x40e064['include']=[{'all':!![]}];}return db[_0x7112('0x28')][_0x7112('0x3f')](_0x40e064);})[_0x7112('0x3d')](function(_0x51e22f){_0x2639fc[_0x7112('0x40')]=_0x51e22f;return _0x2639fc;})[_0x7112('0x3d')](respondWithFilteredResult(_0x3a5604,_0x40e064))[_0x7112('0x41')](handleError(_0x3a5604,null));};exports[_0x7112('0x42')]=function(_0x2b3959,_0x113f48){var _0x1dc471={'raw':![],'where':{'id':_0x2b3959[_0x7112('0x43')]['id']}},_0xa17bea={};_0xa17bea[_0x7112('0x31')]=_[_0x7112('0x44')](db[_0x7112('0x28')][_0x7112('0x29')]);_0xa17bea[_0x7112('0x2e')]=_[_0x7112('0x44')](_0x2b3959[_0x7112('0x2e')]);_0xa17bea[_0x7112('0x2f')]=_[_0x7112('0x30')](_0xa17bea[_0x7112('0x31')],_0xa17bea[_0x7112('0x2e')]);_0x1dc471[_0x7112('0x32')]=_[_0x7112('0x30')](_0xa17bea[_0x7112('0x31')],qs[_0x7112('0x33')](_0x2b3959['query'][_0x7112('0x33')]));_0x1dc471[_0x7112('0x32')]=_0x1dc471[_0x7112('0x32')][_0x7112('0x34')]?_0x1dc471['attributes']:_0xa17bea['model'];if(_0x2b3959['query'][_0x7112('0x3e')]){_0x1dc471['include']=[{'all':!![]}];}_0x1dc471=_[_0x7112('0x3a')]({},_0x1dc471,_0x2b3959['options']);return db[_0x7112('0x28')][_0x7112('0x45')](_0x1dc471)['then'](handleEntityNotFound(_0x113f48,null))[_0x7112('0x3d')](respondWithResult(_0x113f48,null))['catch'](handleError(_0x113f48,null));};exports[_0x7112('0x46')]=function(_0x56257c,_0x52cef8){return db[_0x7112('0x28')][_0x7112('0x46')](_0x56257c[_0x7112('0x47')],{})[_0x7112('0x3d')](respondWithResult(_0x52cef8,0xc9))[_0x7112('0x41')](handleError(_0x52cef8,null));};exports['update']=function(_0x1a5275,_0x1ddd5d){if(_0x1a5275['body']['id']){delete _0x1a5275[_0x7112('0x47')]['id'];}return db[_0x7112('0x28')][_0x7112('0x45')]({'where':{'id':_0x1a5275[_0x7112('0x43')]['id']}})[_0x7112('0x3d')](handleEntityNotFound(_0x1ddd5d,null))[_0x7112('0x3d')](saveUpdates(_0x1a5275[_0x7112('0x47')],null))[_0x7112('0x3d')](respondWithResult(_0x1ddd5d,null))[_0x7112('0x41')](handleError(_0x1ddd5d,null));};exports[_0x7112('0x21')]=function(_0x11dafa,_0x528b82){return db[_0x7112('0x28')]['find']({'where':{'id':_0x11dafa['params']['id']}})[_0x7112('0x3d')](handleEntityNotFound(_0x528b82,null))[_0x7112('0x3d')](removeEntity(_0x528b82,null))[_0x7112('0x41')](handleError(_0x528b82,null));};exports[_0x7112('0x48')]=function(_0x137c83,_0xc85e60,_0x447683){var _0x270655={};var _0x489e48={};var _0xaec4af;var _0x37f3f9;return db[_0x7112('0x28')][_0x7112('0x49')]({'where':{'id':_0x137c83[_0x7112('0x43')]['id']}})['then'](handleEntityNotFound(_0xc85e60,null))[_0x7112('0x3d')](function(_0x39867b){if(_0x39867b){_0xaec4af=_0x39867b;_0x489e48['model']=_['keys'](db[_0x7112('0x4a')][_0x7112('0x29')]);_0x489e48['query']=_[_0x7112('0x44')](_0x137c83[_0x7112('0x2e')]);_0x489e48[_0x7112('0x2f')]=_[_0x7112('0x30')](_0x489e48[_0x7112('0x31')],_0x489e48[_0x7112('0x2e')]);_0x270655[_0x7112('0x32')]=_['intersection'](_0x489e48['model'],qs[_0x7112('0x33')](_0x137c83['query'][_0x7112('0x33')]));_0x270655[_0x7112('0x32')]=_0x270655['attributes'][_0x7112('0x34')]?_0x270655[_0x7112('0x32')]:_0x489e48[_0x7112('0x31')];_0x270655[_0x7112('0x36')]=qs['sort'](_0x137c83['query'][_0x7112('0x4b')]);_0x270655[_0x7112('0x37')]=qs[_0x7112('0x2f')](_[_0x7112('0x38')](_0x137c83['query'],_0x489e48['filters']));if(_0x137c83[_0x7112('0x2e')]['filter']){_0x270655[_0x7112('0x37')]=_[_0x7112('0x3a')](_0x270655['where'],{'$or':_[_0x7112('0x2d')](_0x270655[_0x7112('0x32')],function(_0x3182ed){var _0x42f8a4={};_0x42f8a4[_0x3182ed]={'$like':'%'+_0x137c83[_0x7112('0x2e')][_0x7112('0x39')]+'%'};return _0x42f8a4;})});}_0x270655=_[_0x7112('0x3a')]({},_0x270655,_0x137c83['options']);return _0xaec4af[_0x7112('0x48')](_0x270655);}})[_0x7112('0x3d')](function(_0x2cd5c8){if(_0x2cd5c8){_0x37f3f9=_0x2cd5c8[_0x7112('0x34')];if(!_0x137c83[_0x7112('0x2e')][_0x7112('0x4c')](_0x7112('0x35'))){_0x270655[_0x7112('0x1b')]=qs[_0x7112('0x1b')](_0x137c83[_0x7112('0x2e')][_0x7112('0x1b')]);_0x270655[_0x7112('0x19')]=qs[_0x7112('0x19')](_0x137c83[_0x7112('0x2e')][_0x7112('0x19')]);}return _0xaec4af['getConfigurations'](_0x270655);}})[_0x7112('0x3d')](function(_0x5ee5c4){if(_0x5ee5c4){return _0x5ee5c4?{'count':_0x37f3f9,'rows':_0x5ee5c4}:null;}})['then'](respondWithResult(_0xc85e60,null))[_0x7112('0x41')](handleError(_0xc85e60,null));};exports[_0x7112('0x4d')]=function(_0x367659,_0x5d2405,_0x1b983d){if(_0x367659[_0x7112('0x47')]['id']){delete _0x367659[_0x7112('0x47')]['id'];}return db[_0x7112('0x28')][_0x7112('0x49')]({'where':{'id':_0x367659[_0x7112('0x43')]['id']}})[_0x7112('0x3d')](handleEntityNotFound(_0x5d2405,null))[_0x7112('0x3d')](function(_0x35fac0){if(_0x35fac0){_0x367659[_0x7112('0x47')]['AccountId']=_0x35fac0['id'];_0x367659['body'][_0x7112('0x4e')]=integrations[_0x7112('0x4f')](_0x367659[_0x7112('0x47')][_0x7112('0x50')],_0x367659[_0x7112('0x47')]['type']);_0x367659[_0x7112('0x47')][_0x7112('0x51')]=integrations[_0x7112('0x52')](_0x367659[_0x7112('0x47')][_0x7112('0x50')],_0x367659[_0x7112('0x47')][_0x7112('0x2b')]);return db[_0x7112('0x4a')]['create'](_0x367659[_0x7112('0x47')],{'include':[{'model':db[_0x7112('0x53')],'as':'Subjects'},{'model':db[_0x7112('0x53')],'as':_0x7112('0x51')}]});}return null;})[_0x7112('0x3d')](respondWithResult(_0x5d2405,null))['catch'](handleError(_0x5d2405,null));};exports[_0x7112('0x54')]=function(_0x6e9051,_0x4662c2,_0x3d0c3f){var _0x29ec8d='';var _0x393a07='';return db['FreshsalesAccount'][_0x7112('0x49')]({'where':{'id':_0x6e9051[_0x7112('0x43')]['id']},'attributes':['id',_0x7112('0x55'),_0x7112('0x56'),'apiKey']})['then'](handleEntityNotFound(_0x4662c2,null))[_0x7112('0x3d')](function(_0x4d702a){if(_0x4d702a){_0x393a07=_0x4d702a[_0x7112('0x55')];_0x29ec8d=_0x4d702a[_0x7112('0x56')];var _0x298973=_0x4d702a[_0x7112('0x56')][_0x7112('0x57')](-0x1);if(_0x298973==='/'){_0x29ec8d=_0x29ec8d[_0x7112('0x58')](0x0,_0x29ec8d[_0x7112('0x59')](_0x298973));}return rp({'method':'GET','uri':util[_0x7112('0x5a')](_0x7112('0x5b'),_0x29ec8d,_0x7112('0x5c')),'headers':{'Authorization':_0x7112('0x5d')+_0x4d702a[_0x7112('0x5e')]},'json':!![]});}})[_0x7112('0x3d')](function(_0x5deb02){if(_0x5deb02){var _0x4fa62a=_0x5deb02[_0x7112('0x5f')];var _0x135078=![];var _0x589a6a=null;for(_0x589a6a=0x0;_0x589a6a<_0x4fa62a[_0x7112('0x34')];_0x589a6a++){if(_0x4fa62a[_0x589a6a][_0x7112('0x60')]===_0x393a07){_0x135078=!![];}}if(_0x135078){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7112('0x61')});}}})[_0x7112('0x3d')](respondWithResult(_0x4662c2,null))[_0x7112('0x41')](function(_0x39dc49){var _0x539dee=_0x6e9051['query'][_0x7112('0x62')]?0x1f4:_0x39dc49['statusCode']||0x1f4;logger[_0x7112('0x23')](_0x7112('0x63'),'getFields',_0x539dee,JSON[_0x7112('0x64')](_0x39dc49));delete _0x39dc49[_0x7112('0x25')];if(_0x539dee===0x191){_0x539dee=0x190;}_0x4662c2[_0x7112('0x18')](_0x539dee)['send'](_0x6e9051['query'][_0x7112('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x39dc49[_0x7112('0x65')]}:_0x39dc49);});}; \ No newline at end of file +var _0xe52f=['params','destroy','getConfigurations','findOne','FreshsalesConfiguration','filter','length','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','remoteUri','apiKey','username','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','stack','name','index','map','FreshsalesAccount','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xe52f,0x163));var _0xfe52=function(_0xabf73f,_0x376ad0){_0xabf73f=_0xabf73f-0x0;var _0x701e6e=_0xe52f[_0xabf73f];return _0x701e6e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfe52('0x0'));var jsonpatch=require(_0xfe52('0x1'));var rp=require('request-promise');var moment=require(_0xfe52('0x2'));var BPromise=require(_0xfe52('0x3'));var Mustache=require(_0xfe52('0x4'));var util=require(_0xfe52('0x5'));var path=require(_0xfe52('0x6'));var sox=require(_0xfe52('0x7'));var csv=require('to-csv');var ejs=require(_0xfe52('0x8'));var fs=require('fs');var fs_extra=require(_0xfe52('0x9'));var _=require(_0xfe52('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe52('0xb'));var toCsv=require(_0xfe52('0xc'));var querystring=require(_0xfe52('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe52('0xe'));var qs=require(_0xfe52('0xf'));var as=require(_0xfe52('0x10'));var hardwareService=require(_0xfe52('0x11'));var logger=require('../../config/logger')(_0xfe52('0x12'));var utils=require(_0xfe52('0x13'));var config=require(_0xfe52('0x14'));var licenseUtil=require(_0xfe52('0x15'));var db=require(_0xfe52('0x16'))['db'];var integrations=require(_0xfe52('0x17'));function respondWithStatusCode(_0x1a8058,_0x2fb9eb){_0x2fb9eb=_0x2fb9eb||0xcc;return function(_0xeab35d){if(_0xeab35d){return _0x1a8058[_0xfe52('0x18')](_0x2fb9eb);}return _0x1a8058[_0xfe52('0x19')](_0x2fb9eb)[_0xfe52('0x1a')]();};}function respondWithResult(_0x4b4cdf,_0x59c605){_0x59c605=_0x59c605||0xc8;return function(_0x262eb6){if(_0x262eb6){return _0x4b4cdf['status'](_0x59c605)[_0xfe52('0x1b')](_0x262eb6);}};}function respondWithFilteredResult(_0x543cd4,_0x19ffc6){return function(_0x284be2){if(_0x284be2){var _0x4bf188=typeof _0x19ffc6['offset']===_0xfe52('0x1c')&&typeof _0x19ffc6[_0xfe52('0x1d')]===_0xfe52('0x1c');var _0x299b61=_0x284be2[_0xfe52('0x1e')];var _0x43e456=_0x4bf188?0x0:_0x19ffc6[_0xfe52('0x1f')];var _0x1a4a8b=_0x4bf188?_0x284be2[_0xfe52('0x1e')]:_0x19ffc6[_0xfe52('0x1f')]+_0x19ffc6[_0xfe52('0x1d')];var _0xe9ebed;if(_0x1a4a8b>=_0x299b61){_0x1a4a8b=_0x299b61;_0xe9ebed=0xc8;}else{_0xe9ebed=0xce;}_0x543cd4[_0xfe52('0x19')](_0xe9ebed);return _0x543cd4['set'](_0xfe52('0x20'),_0x43e456+'-'+_0x1a4a8b+'/'+_0x299b61)[_0xfe52('0x1b')](_0x284be2);}return null;};}function patchUpdates(_0x4c9bb6){return function(_0x378553){try{jsonpatch[_0xfe52('0x21')](_0x378553,_0x4c9bb6,!![]);}catch(_0x530822){return BPromise[_0xfe52('0x22')](_0x530822);}return _0x378553['save']();};}function saveUpdates(_0x516698,_0x3ad05a){return function(_0x4a9570){if(_0x4a9570){return _0x4a9570[_0xfe52('0x23')](_0x516698)[_0xfe52('0x24')](function(_0xc93faa){return _0xc93faa;});}return null;};}function removeEntity(_0x2d205c,_0x3fd1fc){return function(_0x2eb044){if(_0x2eb044){return _0x2eb044['destroy']()[_0xfe52('0x24')](function(){_0x2d205c[_0xfe52('0x19')](0xcc)[_0xfe52('0x1a')]();});}};}function handleEntityNotFound(_0x10ac8b,_0x6e769c){return function(_0x776e27){if(!_0x776e27){_0x10ac8b['sendStatus'](0x194);}return _0x776e27;};}function handleError(_0x1b1558,_0x2315bb){_0x2315bb=_0x2315bb||0x1f4;return function(_0x19e84c){logger['error'](_0x19e84c[_0xfe52('0x25')]);if(_0x19e84c['name']){delete _0x19e84c[_0xfe52('0x26')];}_0x1b1558['status'](_0x2315bb)['send'](_0x19e84c);};}exports[_0xfe52('0x27')]=function(_0x3ada0d,_0x2ba6a2){var _0x1030e4={},_0x1721c1={},_0x582910={'count':0x0,'rows':[]};var _0x10a1c4=_[_0xfe52('0x28')](db[_0xfe52('0x29')]['rawAttributes'],function(_0x2061c0){return{'name':_0x2061c0[_0xfe52('0x2a')],'type':_0x2061c0['type'][_0xfe52('0x2b')]};});_0x1721c1[_0xfe52('0x2c')]=_[_0xfe52('0x28')](_0x10a1c4,_0xfe52('0x26'));_0x1721c1['query']=_[_0xfe52('0x2d')](_0x3ada0d[_0xfe52('0x2e')]);_0x1721c1[_0xfe52('0x2f')]=_[_0xfe52('0x30')](_0x1721c1[_0xfe52('0x2c')],_0x1721c1[_0xfe52('0x2e')]);_0x1030e4['attributes']=_[_0xfe52('0x30')](_0x1721c1[_0xfe52('0x2c')],qs['fields'](_0x3ada0d['query'][_0xfe52('0x31')]));_0x1030e4[_0xfe52('0x32')]=_0x1030e4['attributes']['length']?_0x1030e4[_0xfe52('0x32')]:_0x1721c1[_0xfe52('0x2c')];if(!_0x3ada0d[_0xfe52('0x2e')][_0xfe52('0x33')]('nolimit')){_0x1030e4[_0xfe52('0x1d')]=qs[_0xfe52('0x1d')](_0x3ada0d[_0xfe52('0x2e')]['limit']);_0x1030e4[_0xfe52('0x1f')]=qs['offset'](_0x3ada0d[_0xfe52('0x2e')][_0xfe52('0x1f')]);}_0x1030e4[_0xfe52('0x34')]=qs[_0xfe52('0x35')](_0x3ada0d[_0xfe52('0x2e')][_0xfe52('0x35')]);_0x1030e4[_0xfe52('0x36')]=qs[_0xfe52('0x2f')](_[_0xfe52('0x37')](_0x3ada0d[_0xfe52('0x2e')],_0x1721c1['filters']),_0x10a1c4);if(_0x3ada0d[_0xfe52('0x2e')]['filter']){_0x1030e4[_0xfe52('0x36')]=_['merge'](_0x1030e4[_0xfe52('0x36')],{'$or':_[_0xfe52('0x28')](_0x10a1c4,function(_0x36f399){if(_0x36f399['type']!==_0xfe52('0x38')){var _0x51da64={};_0x51da64[_0x36f399[_0xfe52('0x26')]]={'$like':'%'+_0x3ada0d['query']['filter']+'%'};return _0x51da64;}})});}_0x1030e4=_[_0xfe52('0x39')]({},_0x1030e4,_0x3ada0d[_0xfe52('0x3a')]);var _0x4a68a7={'where':_0x1030e4[_0xfe52('0x36')]};return db['FreshsalesAccount'][_0xfe52('0x1e')](_0x4a68a7)[_0xfe52('0x24')](function(_0x27efaf){_0x582910[_0xfe52('0x1e')]=_0x27efaf;if(_0x3ada0d['query']['includeAll']){_0x1030e4[_0xfe52('0x3b')]=[{'all':!![]}];}return db[_0xfe52('0x29')][_0xfe52('0x3c')](_0x1030e4);})[_0xfe52('0x24')](function(_0x13ddb7){_0x582910[_0xfe52('0x3d')]=_0x13ddb7;return _0x582910;})['then'](respondWithFilteredResult(_0x2ba6a2,_0x1030e4))[_0xfe52('0x3e')](handleError(_0x2ba6a2,null));};exports[_0xfe52('0x3f')]=function(_0x228873,_0x25b9f7){var _0x37a43b={'raw':![],'where':{'id':_0x228873['params']['id']}},_0x356db0={};_0x356db0[_0xfe52('0x2c')]=_[_0xfe52('0x2d')](db[_0xfe52('0x29')][_0xfe52('0x40')]);_0x356db0[_0xfe52('0x2e')]=_[_0xfe52('0x2d')](_0x228873[_0xfe52('0x2e')]);_0x356db0[_0xfe52('0x2f')]=_[_0xfe52('0x30')](_0x356db0[_0xfe52('0x2c')],_0x356db0[_0xfe52('0x2e')]);_0x37a43b[_0xfe52('0x32')]=_[_0xfe52('0x30')](_0x356db0[_0xfe52('0x2c')],qs[_0xfe52('0x31')](_0x228873['query'][_0xfe52('0x31')]));_0x37a43b['attributes']=_0x37a43b[_0xfe52('0x32')]['length']?_0x37a43b['attributes']:_0x356db0['model'];if(_0x228873[_0xfe52('0x2e')][_0xfe52('0x41')]){_0x37a43b[_0xfe52('0x3b')]=[{'all':!![]}];}_0x37a43b=_[_0xfe52('0x39')]({},_0x37a43b,_0x228873[_0xfe52('0x3a')]);return db['FreshsalesAccount'][_0xfe52('0x42')](_0x37a43b)[_0xfe52('0x24')](handleEntityNotFound(_0x25b9f7,null))[_0xfe52('0x24')](respondWithResult(_0x25b9f7,null))[_0xfe52('0x3e')](handleError(_0x25b9f7,null));};exports[_0xfe52('0x43')]=function(_0x53c9d4,_0x40c1b5){return db['FreshsalesAccount'][_0xfe52('0x43')](_0x53c9d4[_0xfe52('0x44')],{})[_0xfe52('0x24')](respondWithResult(_0x40c1b5,0xc9))[_0xfe52('0x3e')](handleError(_0x40c1b5,null));};exports['update']=function(_0x4dff3b,_0x3510a7){if(_0x4dff3b[_0xfe52('0x44')]['id']){delete _0x4dff3b['body']['id'];}return db[_0xfe52('0x29')][_0xfe52('0x42')]({'where':{'id':_0x4dff3b[_0xfe52('0x45')]['id']}})['then'](handleEntityNotFound(_0x3510a7,null))[_0xfe52('0x24')](saveUpdates(_0x4dff3b['body'],null))['then'](respondWithResult(_0x3510a7,null))[_0xfe52('0x3e')](handleError(_0x3510a7,null));};exports[_0xfe52('0x46')]=function(_0x7e5104,_0x3899ad){return db[_0xfe52('0x29')][_0xfe52('0x42')]({'where':{'id':_0x7e5104['params']['id']}})[_0xfe52('0x24')](handleEntityNotFound(_0x3899ad,null))[_0xfe52('0x24')](removeEntity(_0x3899ad,null))[_0xfe52('0x3e')](handleError(_0x3899ad,null));};exports[_0xfe52('0x47')]=function(_0x3af339,_0x122d94,_0x4de684){var _0x582ae4={};var _0x4eb7b9={};var _0x16be45;var _0x2a799d;return db[_0xfe52('0x29')][_0xfe52('0x48')]({'where':{'id':_0x3af339[_0xfe52('0x45')]['id']}})[_0xfe52('0x24')](handleEntityNotFound(_0x122d94,null))[_0xfe52('0x24')](function(_0x3bb757){if(_0x3bb757){_0x16be45=_0x3bb757;_0x4eb7b9['model']=_['keys'](db[_0xfe52('0x49')][_0xfe52('0x40')]);_0x4eb7b9['query']=_[_0xfe52('0x2d')](_0x3af339[_0xfe52('0x2e')]);_0x4eb7b9[_0xfe52('0x2f')]=_[_0xfe52('0x30')](_0x4eb7b9['model'],_0x4eb7b9[_0xfe52('0x2e')]);_0x582ae4['attributes']=_['intersection'](_0x4eb7b9[_0xfe52('0x2c')],qs[_0xfe52('0x31')](_0x3af339['query'][_0xfe52('0x31')]));_0x582ae4[_0xfe52('0x32')]=_0x582ae4[_0xfe52('0x32')]['length']?_0x582ae4[_0xfe52('0x32')]:_0x4eb7b9[_0xfe52('0x2c')];_0x582ae4['order']=qs[_0xfe52('0x35')](_0x3af339[_0xfe52('0x2e')][_0xfe52('0x35')]);_0x582ae4[_0xfe52('0x36')]=qs['filters'](_[_0xfe52('0x37')](_0x3af339[_0xfe52('0x2e')],_0x4eb7b9['filters']));if(_0x3af339['query']['filter']){_0x582ae4[_0xfe52('0x36')]=_[_0xfe52('0x39')](_0x582ae4[_0xfe52('0x36')],{'$or':_[_0xfe52('0x28')](_0x582ae4['attributes'],function(_0x20b2e0){var _0x5807e8={};_0x5807e8[_0x20b2e0]={'$like':'%'+_0x3af339[_0xfe52('0x2e')][_0xfe52('0x4a')]+'%'};return _0x5807e8;})});}_0x582ae4=_[_0xfe52('0x39')]({},_0x582ae4,_0x3af339[_0xfe52('0x3a')]);return _0x16be45[_0xfe52('0x47')](_0x582ae4);}})[_0xfe52('0x24')](function(_0x302b54){if(_0x302b54){_0x2a799d=_0x302b54[_0xfe52('0x4b')];if(!_0x3af339[_0xfe52('0x2e')]['hasOwnProperty'](_0xfe52('0x4c'))){_0x582ae4['limit']=qs[_0xfe52('0x1d')](_0x3af339['query'][_0xfe52('0x1d')]);_0x582ae4['offset']=qs[_0xfe52('0x1f')](_0x3af339[_0xfe52('0x2e')]['offset']);}return _0x16be45[_0xfe52('0x47')](_0x582ae4);}})[_0xfe52('0x24')](function(_0xf8d828){if(_0xf8d828){return _0xf8d828?{'count':_0x2a799d,'rows':_0xf8d828}:null;}})[_0xfe52('0x24')](respondWithResult(_0x122d94,null))[_0xfe52('0x3e')](handleError(_0x122d94,null));};exports[_0xfe52('0x4d')]=function(_0x4d4d6c,_0x5825f4,_0x134640){if(_0x4d4d6c[_0xfe52('0x44')]['id']){delete _0x4d4d6c[_0xfe52('0x44')]['id'];}return db[_0xfe52('0x29')]['findOne']({'where':{'id':_0x4d4d6c[_0xfe52('0x45')]['id']}})[_0xfe52('0x24')](handleEntityNotFound(_0x5825f4,null))[_0xfe52('0x24')](function(_0x684c40){if(_0x684c40){_0x4d4d6c[_0xfe52('0x44')][_0xfe52('0x4e')]=_0x684c40['id'];_0x4d4d6c[_0xfe52('0x44')]['Subjects']=integrations[_0xfe52('0x4f')](_0x4d4d6c['body'][_0xfe52('0x50')],_0x4d4d6c[_0xfe52('0x44')]['type']);_0x4d4d6c['body'][_0xfe52('0x51')]=integrations[_0xfe52('0x52')](_0x4d4d6c[_0xfe52('0x44')]['channel'],_0x4d4d6c[_0xfe52('0x44')]['type']);return db[_0xfe52('0x49')][_0xfe52('0x43')](_0x4d4d6c['body'],{'include':[{'model':db[_0xfe52('0x53')],'as':_0xfe52('0x54')},{'model':db['FreshsalesField'],'as':_0xfe52('0x51')}]});}return null;})[_0xfe52('0x24')](respondWithResult(_0x5825f4,null))['catch'](handleError(_0x5825f4,null));};exports[_0xfe52('0x55')]=function(_0x1facd7,_0x2e9827,_0xe70993){var _0x22953f='';var _0x500573='';return db[_0xfe52('0x29')][_0xfe52('0x48')]({'where':{'id':_0x1facd7[_0xfe52('0x45')]['id']},'attributes':['id','username',_0xfe52('0x56'),_0xfe52('0x57')]})['then'](handleEntityNotFound(_0x2e9827,null))[_0xfe52('0x24')](function(_0x16cec5){if(_0x16cec5){_0x500573=_0x16cec5[_0xfe52('0x58')];_0x22953f=_0x16cec5['remoteUri'];var _0x34abbb=_0x16cec5['remoteUri']['slice'](-0x1);if(_0x34abbb==='/'){_0x22953f=_0x22953f[_0xfe52('0x59')](0x0,_0x22953f[_0xfe52('0x5a')](_0x34abbb));}return rp({'method':_0xfe52('0x5b'),'uri':util[_0xfe52('0x5c')](_0xfe52('0x5d'),_0x22953f,_0xfe52('0x5e')),'headers':{'Authorization':_0xfe52('0x5f')+_0x16cec5[_0xfe52('0x57')]},'json':!![]});}})[_0xfe52('0x24')](function(_0x221098){if(_0x221098){var _0xf55855=_0x221098[_0xfe52('0x60')];var _0x2d2e47=![];var _0x1effbf=null;for(_0x1effbf=0x0;_0x1effbf<_0xf55855[_0xfe52('0x4b')];_0x1effbf++){if(_0xf55855[_0x1effbf][_0xfe52('0x61')]===_0x500573){_0x2d2e47=!![];}}if(_0x2d2e47){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xfe52('0x62')});}}})[_0xfe52('0x24')](respondWithResult(_0x2e9827,null))[_0xfe52('0x3e')](function(_0x18ef31){var _0x273e2e=_0x1facd7[_0xfe52('0x2e')][_0xfe52('0x63')]?0x1f4:_0x18ef31['statusCode']||0x1f4;logger[_0xfe52('0x64')](_0xfe52('0x65'),'getFields',_0x273e2e,JSON[_0xfe52('0x66')](_0x18ef31));delete _0x18ef31[_0xfe52('0x26')];if(_0x273e2e===0x191){_0x273e2e=0x190;}_0x2e9827[_0xfe52('0x19')](_0x273e2e)[_0xfe52('0x67')](_0x1facd7[_0xfe52('0x2e')]['test']?{'message':_0xfe52('0x68'),'statusCode':_0x18ef31[_0xfe52('0x69')]}:_0x18ef31);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2825467..34ee7bd 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 _0x82c4=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','exports'];(function(_0x3e8553,_0x3dcc10){var _0x22e21b=function(_0xd011b1){while(--_0xd011b1){_0x3e8553['push'](_0x3e8553['shift']());}};_0x22e21b(++_0x3dcc10);}(_0x82c4,0x1ca));var _0x482c=function(_0x322318,_0x276d64){_0x322318=_0x322318-0x0;var _0x59ce6f=_0x82c4[_0x322318];return _0x59ce6f;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x482c('0x9')]=function(_0x5d7c76,_0xfdb92){return _0x5d7c76[_0x482c('0xa')](_0x482c('0xb'),attributes,{'tableName':_0x482c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e24=['request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x3e24,0x167));var _0x43e2=function(_0x8bee69,_0x3c9bcb){_0x8bee69=_0x8bee69-0x0;var _0x32068f=_0x3e24[_0x8bee69];return _0x32068f;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));var integrations=require(_0x43e2('0x9'));module[_0x43e2('0xa')]=function(_0x43b5a7,_0x121e2e){return _0x43b5a7[_0x43e2('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x43e2('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 283a366..e3fd5ea 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 _0x0424=['info','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','model','map','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x52fe20,_0x3814d2){var _0x5ec4f5=function(_0xc16bc2){while(--_0xc16bc2){_0x52fe20['push'](_0x52fe20['shift']());}};_0x5ec4f5(++_0x3814d2);}(_0x0424,0x159));var _0x4042=function(_0x2a0346,_0x2c1300){_0x2a0346=_0x2a0346-0x0;var _0x1f5232=_0x0424[_0x2a0346];return _0x1f5232;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['findAll']({'raw':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x466077[_0x4042('0x17')]?_0x466077['options'][_0x4042('0x19')]||null:null,'attributes':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1a')]||null:null,'limit':_0x466077['options']?_0x466077[_0x4042('0x17')][_0x4042('0x1b')]||null:null,'include':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1c')]?_['map'](_0x466077[_0x4042('0x17')][_0x4042('0x1c')],function(_0x519f2c){return{'model':db[_0x519f2c[_0x4042('0x1d')]],'as':_0x519f2c['as'],'attributes':_0x519f2c['attributes'],'include':_0x519f2c[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x519f2c[_0x4042('0x1c')],function(_0x5d5c6d){return{'model':db[_0x5d5c6d[_0x4042('0x1d')]],'as':_0x5d5c6d['as'],'attributes':_0x5d5c6d[_0x4042('0x1a')],'include':_0x5d5c6d[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x5d5c6d[_0x4042('0x1c')],function(_0x52e575){return{'model':db[_0x52e575['model']],'as':_0x52e575['as'],'attributes':_0x52e575[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26542c){logger[_0x4042('0x12')](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('GetFreshsalesAccount',_0x466077,JSON[_0x4042('0xf')](_0x26542c));_0xe5c1ec(_0x26542c);})[_0x4042('0x14')](function(_0x4a6a6e){logger[_0x4042('0x10')](_0x4042('0x15'),_0x4a6a6e[_0x4042('0x11')],_0x466077);_0x4fe024(_0x4b02d4['error'](0x1f4,_0x4a6a6e['message']));});});};exports[_0x4042('0x1f')]=function(_0x43bd1c){var _0x59773f=this;return new Promise(function(_0x3e9304,_0xc42d70){return db[_0x4042('0x16')][_0x4042('0x20')]({'raw':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['where']||null:null,'attributes':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['attributes']||null:null,'include':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['include']?_[_0x4042('0x1e')](_0x43bd1c[_0x4042('0x17')][_0x4042('0x1c')],function(_0xaa7c99){return{'model':db[_0xaa7c99[_0x4042('0x1d')]],'as':_0xaa7c99['as'],'attributes':_0xaa7c99[_0x4042('0x1a')],'include':_0xaa7c99[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0xaa7c99[_0x4042('0x1c')],function(_0x37195b){return{'model':db[_0x37195b[_0x4042('0x1d')]],'as':_0x37195b['as'],'attributes':_0x37195b[_0x4042('0x1a')],'include':_0x37195b[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x37195b[_0x4042('0x1c')],function(_0x2b5f5e){return{'model':db[_0x2b5f5e[_0x4042('0x1d')]],'as':_0x2b5f5e['as'],'attributes':_0x2b5f5e[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26b7b0){logger[_0x4042('0x12')]('ShowFreshsalesAccount',_0x43bd1c);logger[_0x4042('0xd')](_0x4042('0x1f'),_0x43bd1c,JSON[_0x4042('0xf')](_0x26b7b0));_0x3e9304(_0x26b7b0);})[_0x4042('0x14')](function(_0x588932){logger[_0x4042('0x10')](_0x4042('0x1f'),_0x588932[_0x4042('0x11')],_0x43bd1c);_0xc42d70(_0x59773f[_0x4042('0x10')](0x1f4,_0x588932[_0x4042('0x11')]));});});}; \ No newline at end of file +var _0x5f2f=['map','include','model','attributes','then','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x527d1b,_0x27ce27){_0x527d1b=_0x527d1b-0x0;var _0x2793ca=_0x5f2f[_0x527d1b];return _0x2793ca;};'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')]('FreshsalesAccount,\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')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetFreshsalesAccount',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetFreshsalesAccount',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowFreshsalesAccount',_0x153924);logger[_0xf5f2('0xf')]('ShowFreshsalesAccount',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowFreshsalesAccount',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a823662..6e90d90 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 _0x2cdf=['/:id/fields','getFields','post','create','put','/:id','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id/subjects','isAuthenticated','getDescriptions'];(function(_0x4a8426,_0x563a62){var _0x56ea6f=function(_0x3c98eb){while(--_0x3c98eb){_0x4a8426['push'](_0x4a8426['shift']());}};_0x56ea6f(++_0x563a62);}(_0x2cdf,0xb0));var _0xf2cd=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x2cdf[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0xf2cd('0x0'));var util=require('util');var path=require(_0xf2cd('0x1'));var timeout=require(_0xf2cd('0x2'));var express=require(_0xf2cd('0x3'));var router=express[_0xf2cd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf2cd('0x5'));var interaction=require(_0xf2cd('0x6'));var config=require(_0xf2cd('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xf2cd('0x8')]('/',auth['isAuthenticated'](),controller[_0xf2cd('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf2cd('0x8')](_0xf2cd('0xa'),auth[_0xf2cd('0xb')](),controller['getSubjects']);router[_0xf2cd('0x8')]('/:id/descriptions',auth[_0xf2cd('0xb')](),controller[_0xf2cd('0xc')]);router['get'](_0xf2cd('0xd'),auth[_0xf2cd('0xb')](),controller[_0xf2cd('0xe')]);router[_0xf2cd('0xf')]('/',auth[_0xf2cd('0xb')](),controller[_0xf2cd('0x10')]);router[_0xf2cd('0x11')](_0xf2cd('0x12'),auth[_0xf2cd('0xb')](),controller[_0xf2cd('0x13')]);router[_0xf2cd('0x14')](_0xf2cd('0x12'),auth[_0xf2cd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3dac=['destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','delete'];(function(_0x4c9fa9,_0x478b86){var _0x3ca7e0=function(_0x3ae043){while(--_0x3ae043){_0x4c9fa9['push'](_0x4c9fa9['shift']());}};_0x3ca7e0(++_0x478b86);}(_0x3dac,0x109));var _0xc3da=function(_0x3e4f1a,_0x546a1d){_0x3e4f1a=_0x3e4f1a-0x0;var _0x2e3cee=_0x3dac[_0x3e4f1a];return _0x2e3cee;};'use strict';var multer=require('multer');var util=require(_0xc3da('0x0'));var path=require(_0xc3da('0x1'));var timeout=require(_0xc3da('0x2'));var express=require(_0xc3da('0x3'));var router=express[_0xc3da('0x4')]();var fs_extra=require(_0xc3da('0x5'));var auth=require(_0xc3da('0x6'));var interaction=require(_0xc3da('0x7'));var config=require(_0xc3da('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xc3da('0x9')]('/',auth[_0xc3da('0xa')](),controller[_0xc3da('0xb')]);router[_0xc3da('0x9')](_0xc3da('0xc'),auth['isAuthenticated'](),controller[_0xc3da('0xd')]);router['get'](_0xc3da('0xe'),auth[_0xc3da('0xa')](),controller[_0xc3da('0xf')]);router[_0xc3da('0x9')](_0xc3da('0x10'),auth['isAuthenticated'](),controller[_0xc3da('0x11')]);router['get'](_0xc3da('0x12'),auth[_0xc3da('0xa')](),controller[_0xc3da('0x13')]);router['post']('/',auth[_0xc3da('0xa')](),controller[_0xc3da('0x14')]);router[_0xc3da('0x15')](_0xc3da('0xc'),auth[_0xc3da('0xa')](),controller['update']);router[_0xc3da('0x16')](_0xc3da('0xc'),auth[_0xc3da('0xa')](),controller[_0xc3da('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 32de381..657bce8 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 _0xfa41=['STRING','sequelize','exports'];(function(_0x1749b8,_0x54b96f){var _0x98994f=function(_0x2b9db1){while(--_0x2b9db1){_0x1749b8['push'](_0x1749b8['shift']());}};_0x98994f(++_0x54b96f);}(_0xfa41,0x106));var _0x1fa4=function(_0x2c1101,_0x1909d9){_0x2c1101=_0x2c1101-0x0;var _0x56f52f=_0xfa41[_0x2c1101];return _0x56f52f;};'use strict';var Sequelize=require(_0x1fa4('0x0'));module[_0x1fa4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1fa4('0x2')]}}; \ No newline at end of file +var _0x4812=['exports','STRING','sequelize'];(function(_0x2c6232,_0x360bb7){var _0x2d6c82=function(_0xed56b3){while(--_0xed56b3){_0x2c6232['push'](_0x2c6232['shift']());}};_0x2d6c82(++_0x360bb7);}(_0x4812,0x113));var _0x2481=function(_0x3dedb3,_0x368cc4){_0x3dedb3=_0x3dedb3-0x0;var _0x14a1f6=_0x4812[_0x3dedb3];return _0x14a1f6;};'use strict';var Sequelize=require(_0x2481('0x0'));module[_0x2481('0x1')]={'name':{'type':Sequelize[_0x2481('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f8356f7..bba323f 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 _0x9999=['../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','keys','create','body','find','getSubjects','findOne','FreshsalesField','pick','length','getDescriptions','getFields','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x386c55,_0x57b978){var _0x23652b=function(_0x534904){while(--_0x534904){_0x386c55['push'](_0x386c55['shift']());}};_0x23652b(++_0x57b978);}(_0x9999,0x166));var _0x9999=function(_0xefc8af,_0x15a547){_0xefc8af=_0xefc8af-0x0;var _0x573ec3=_0x9999[_0xefc8af];return _0x573ec3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9999('0x0'));var zipdir=require(_0x9999('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9999('0x2'));var moment=require(_0x9999('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9999('0x4'));var util=require(_0x9999('0x5'));var path=require(_0x9999('0x6'));var sox=require('sox');var csv=require(_0x9999('0x7'));var ejs=require(_0x9999('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9999('0x9'));var squel=require(_0x9999('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9999('0x7'));var querystring=require(_0x9999('0xb'));var Papa=require(_0x9999('0xc'));var Redis=require(_0x9999('0xd'));var authService=require(_0x9999('0xe'));var qs=require(_0x9999('0xf'));var as=require(_0x9999('0x10'));var hardwareService=require(_0x9999('0x11'));var logger=require('../../config/logger')(_0x9999('0x12'));var utils=require(_0x9999('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9999('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x279056,_0x426172){_0x426172=_0x426172||0xcc;return function(_0x1a9151){if(_0x1a9151){return _0x279056[_0x9999('0x15')](_0x426172);}return _0x279056[_0x9999('0x16')](_0x426172)[_0x9999('0x17')]();};}function respondWithResult(_0x3a7caf,_0x584a12){_0x584a12=_0x584a12||0xc8;return function(_0x88bc49){if(_0x88bc49){return _0x3a7caf[_0x9999('0x16')](_0x584a12)[_0x9999('0x18')](_0x88bc49);}};}function respondWithFilteredResult(_0x36ab41,_0x2559a7){return function(_0xbee23){if(_0xbee23){var _0x2a8f83=typeof _0x2559a7[_0x9999('0x19')]===_0x9999('0x1a')&&typeof _0x2559a7[_0x9999('0x1b')]==='undefined';var _0x5cf5fd=_0xbee23[_0x9999('0x1c')];var _0x5456fe=_0x2a8f83?0x0:_0x2559a7[_0x9999('0x19')];var _0x5dfc85=_0x2a8f83?_0xbee23[_0x9999('0x1c')]:_0x2559a7[_0x9999('0x19')]+_0x2559a7[_0x9999('0x1b')];var _0x5e678f;if(_0x5dfc85>=_0x5cf5fd){_0x5dfc85=_0x5cf5fd;_0x5e678f=0xc8;}else{_0x5e678f=0xce;}_0x36ab41['status'](_0x5e678f);return _0x36ab41[_0x9999('0x1d')](_0x9999('0x1e'),_0x5456fe+'-'+_0x5dfc85+'/'+_0x5cf5fd)[_0x9999('0x18')](_0xbee23);}return null;};}function patchUpdates(_0x8d4001){return function(_0x4dc0f3){try{jsonpatch['apply'](_0x4dc0f3,_0x8d4001,!![]);}catch(_0x1d8ea4){return BPromise[_0x9999('0x1f')](_0x1d8ea4);}return _0x4dc0f3[_0x9999('0x20')]();};}function saveUpdates(_0x4482a9,_0x16d20e){return function(_0xea1d4c){if(_0xea1d4c){return _0xea1d4c[_0x9999('0x21')](_0x4482a9)[_0x9999('0x22')](function(_0x4d5837){return _0x4d5837;});}return null;};}function removeEntity(_0x4539a9,_0x3581ba){return function(_0x5eb245){if(_0x5eb245){return _0x5eb245[_0x9999('0x23')]()[_0x9999('0x22')](function(){_0x4539a9[_0x9999('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59acad,_0x204358){return function(_0x1e5b14){if(!_0x1e5b14){_0x59acad[_0x9999('0x15')](0x194);}return _0x1e5b14;};}function handleError(_0x3aeb0b,_0x49dce6){_0x49dce6=_0x49dce6||0x1f4;return function(_0xedc803){logger['error'](_0xedc803[_0x9999('0x24')]);if(_0xedc803[_0x9999('0x25')]){delete _0xedc803[_0x9999('0x25')];}_0x3aeb0b['status'](_0x49dce6)[_0x9999('0x26')](_0xedc803);};}exports['index']=function(_0x514b12,_0x1ed48b){var _0x17276c={},_0x38c4e1={},_0x34d59f={'count':0x0,'rows':[]};var _0x555180=_[_0x9999('0x27')](db[_0x9999('0x28')][_0x9999('0x29')],function(_0x52e42a){return{'name':_0x52e42a['fieldName'],'type':_0x52e42a[_0x9999('0x2a')][_0x9999('0x2b')]};});_0x38c4e1[_0x9999('0x2c')]=_[_0x9999('0x27')](_0x555180,'name');_0x38c4e1[_0x9999('0x2d')]=_['keys'](_0x514b12[_0x9999('0x2d')]);_0x38c4e1[_0x9999('0x2e')]=_[_0x9999('0x2f')](_0x38c4e1[_0x9999('0x2c')],_0x38c4e1[_0x9999('0x2d')]);_0x17276c[_0x9999('0x30')]=_[_0x9999('0x2f')](_0x38c4e1['model'],qs[_0x9999('0x31')](_0x514b12[_0x9999('0x2d')]['fields']));_0x17276c[_0x9999('0x30')]=_0x17276c['attributes']['length']?_0x17276c[_0x9999('0x30')]:_0x38c4e1[_0x9999('0x2c')];if(!_0x514b12[_0x9999('0x2d')][_0x9999('0x32')](_0x9999('0x33'))){_0x17276c[_0x9999('0x1b')]=qs['limit'](_0x514b12[_0x9999('0x2d')][_0x9999('0x1b')]);_0x17276c[_0x9999('0x19')]=qs[_0x9999('0x19')](_0x514b12[_0x9999('0x2d')][_0x9999('0x19')]);}_0x17276c[_0x9999('0x34')]=qs[_0x9999('0x35')](_0x514b12[_0x9999('0x2d')][_0x9999('0x35')]);_0x17276c[_0x9999('0x36')]=qs['filters'](_['pick'](_0x514b12['query'],_0x38c4e1['filters']),_0x555180);if(_0x514b12['query']['filter']){_0x17276c[_0x9999('0x36')]=_[_0x9999('0x37')](_0x17276c['where'],{'$or':_[_0x9999('0x27')](_0x555180,function(_0x566930){if(_0x566930['type']!==_0x9999('0x38')){var _0x1ca4c5={};_0x1ca4c5[_0x566930['name']]={'$like':'%'+_0x514b12[_0x9999('0x2d')][_0x9999('0x39')]+'%'};return _0x1ca4c5;}})});}_0x17276c=_['merge']({},_0x17276c,_0x514b12[_0x9999('0x3a')]);var _0x5c67da={'where':_0x17276c[_0x9999('0x36')]};return db[_0x9999('0x28')]['count'](_0x5c67da)['then'](function(_0x32146d){_0x34d59f[_0x9999('0x1c')]=_0x32146d;if(_0x514b12[_0x9999('0x2d')]['includeAll']){_0x17276c[_0x9999('0x3b')]=[{'all':!![]}];}return db[_0x9999('0x28')]['findAll'](_0x17276c);})[_0x9999('0x22')](function(_0x33dfca){_0x34d59f[_0x9999('0x3c')]=_0x33dfca;return _0x34d59f;})[_0x9999('0x22')](respondWithFilteredResult(_0x1ed48b,_0x17276c))[_0x9999('0x3d')](handleError(_0x1ed48b,null));};exports[_0x9999('0x3e')]=function(_0x5075d3,_0x360346){var _0x35bbd9={'raw':![],'where':{'id':_0x5075d3[_0x9999('0x3f')]['id']}},_0x345a75={};_0x345a75[_0x9999('0x2c')]=_[_0x9999('0x40')](db[_0x9999('0x28')][_0x9999('0x29')]);_0x345a75['query']=_[_0x9999('0x40')](_0x5075d3[_0x9999('0x2d')]);_0x345a75['filters']=_[_0x9999('0x2f')](_0x345a75[_0x9999('0x2c')],_0x345a75[_0x9999('0x2d')]);_0x35bbd9[_0x9999('0x30')]=_['intersection'](_0x345a75['model'],qs[_0x9999('0x31')](_0x5075d3[_0x9999('0x2d')][_0x9999('0x31')]));_0x35bbd9[_0x9999('0x30')]=_0x35bbd9[_0x9999('0x30')]['length']?_0x35bbd9[_0x9999('0x30')]:_0x345a75[_0x9999('0x2c')];if(_0x5075d3[_0x9999('0x2d')]['includeAll']){_0x35bbd9[_0x9999('0x3b')]=[{'all':!![]}];}_0x35bbd9=_[_0x9999('0x37')]({},_0x35bbd9,_0x5075d3[_0x9999('0x3a')]);return db[_0x9999('0x28')]['find'](_0x35bbd9)[_0x9999('0x22')](handleEntityNotFound(_0x360346,null))[_0x9999('0x22')](respondWithResult(_0x360346,null))[_0x9999('0x3d')](handleError(_0x360346,null));};exports[_0x9999('0x41')]=function(_0x5a364e,_0x39ee86){return db[_0x9999('0x28')]['create'](_0x5a364e[_0x9999('0x42')],{})[_0x9999('0x22')](respondWithResult(_0x39ee86,0xc9))[_0x9999('0x3d')](handleError(_0x39ee86,null));};exports[_0x9999('0x21')]=function(_0x2ec7d3,_0x5a68be){if(_0x2ec7d3[_0x9999('0x42')]['id']){delete _0x2ec7d3['body']['id'];}return db[_0x9999('0x28')][_0x9999('0x43')]({'where':{'id':_0x2ec7d3[_0x9999('0x3f')]['id']}})[_0x9999('0x22')](handleEntityNotFound(_0x5a68be,null))[_0x9999('0x22')](saveUpdates(_0x2ec7d3[_0x9999('0x42')],null))[_0x9999('0x22')](respondWithResult(_0x5a68be,null))[_0x9999('0x3d')](handleError(_0x5a68be,null));};exports[_0x9999('0x23')]=function(_0x7b1a75,_0xd58dd6){return db[_0x9999('0x28')][_0x9999('0x43')]({'where':{'id':_0x7b1a75[_0x9999('0x3f')]['id']}})[_0x9999('0x22')](handleEntityNotFound(_0xd58dd6,null))[_0x9999('0x22')](removeEntity(_0xd58dd6,null))[_0x9999('0x3d')](handleError(_0xd58dd6,null));};exports[_0x9999('0x44')]=function(_0x115ceb,_0x59a617,_0x5ecb30){var _0x536dab={};var _0x2e224a={};var _0x3d8ed2;var _0x55cd7c;return db[_0x9999('0x28')][_0x9999('0x45')]({'where':{'id':_0x115ceb[_0x9999('0x3f')]['id']}})[_0x9999('0x22')](handleEntityNotFound(_0x59a617,null))['then'](function(_0x188f26){if(_0x188f26){_0x3d8ed2=_0x188f26;_0x2e224a[_0x9999('0x2c')]=_[_0x9999('0x40')](db[_0x9999('0x46')]['rawAttributes']);_0x2e224a['query']=_[_0x9999('0x40')](_0x115ceb[_0x9999('0x2d')]);_0x2e224a[_0x9999('0x2e')]=_[_0x9999('0x2f')](_0x2e224a['model'],_0x2e224a['query']);_0x536dab[_0x9999('0x30')]=_[_0x9999('0x2f')](_0x2e224a[_0x9999('0x2c')],qs[_0x9999('0x31')](_0x115ceb[_0x9999('0x2d')][_0x9999('0x31')]));_0x536dab[_0x9999('0x30')]=_0x536dab[_0x9999('0x30')]['length']?_0x536dab['attributes']:_0x2e224a[_0x9999('0x2c')];_0x536dab['order']=qs[_0x9999('0x35')](_0x115ceb['query'][_0x9999('0x35')]);_0x536dab[_0x9999('0x36')]=qs[_0x9999('0x2e')](_[_0x9999('0x47')](_0x115ceb[_0x9999('0x2d')],_0x2e224a[_0x9999('0x2e')]));if(_0x115ceb[_0x9999('0x2d')]['filter']){_0x536dab[_0x9999('0x36')]=_['merge'](_0x536dab[_0x9999('0x36')],{'$or':_[_0x9999('0x27')](_0x536dab['attributes'],function(_0x3703f3){var _0x3a30b1={};_0x3a30b1[_0x3703f3]={'$like':'%'+_0x115ceb[_0x9999('0x2d')]['filter']+'%'};return _0x3a30b1;})});}_0x536dab=_['merge']({},_0x536dab,_0x115ceb[_0x9999('0x3a')]);return _0x3d8ed2[_0x9999('0x44')](_0x536dab);}})[_0x9999('0x22')](function(_0x5b2295){if(_0x5b2295){_0x55cd7c=_0x5b2295[_0x9999('0x48')];if(!_0x115ceb['query']['hasOwnProperty']('nolimit')){_0x536dab[_0x9999('0x1b')]=qs['limit'](_0x115ceb[_0x9999('0x2d')][_0x9999('0x1b')]);_0x536dab[_0x9999('0x19')]=qs['offset'](_0x115ceb['query']['offset']);}return _0x3d8ed2['getSubjects'](_0x536dab);}})[_0x9999('0x22')](function(_0x19b1c7){if(_0x19b1c7){return _0x19b1c7?{'count':_0x55cd7c,'rows':_0x19b1c7}:null;}})['then'](respondWithResult(_0x59a617,null))[_0x9999('0x3d')](handleError(_0x59a617,null));};exports[_0x9999('0x49')]=function(_0x366572,_0xb1be,_0x16f65f){var _0x7657b={};var _0x4f9f8d={};var _0x2cdf57;var _0x55272a;return db[_0x9999('0x28')][_0x9999('0x45')]({'where':{'id':_0x366572[_0x9999('0x3f')]['id']}})[_0x9999('0x22')](handleEntityNotFound(_0xb1be,null))[_0x9999('0x22')](function(_0x272862){if(_0x272862){_0x2cdf57=_0x272862;_0x4f9f8d[_0x9999('0x2c')]=_[_0x9999('0x40')](db[_0x9999('0x46')][_0x9999('0x29')]);_0x4f9f8d['query']=_[_0x9999('0x40')](_0x366572[_0x9999('0x2d')]);_0x4f9f8d[_0x9999('0x2e')]=_[_0x9999('0x2f')](_0x4f9f8d[_0x9999('0x2c')],_0x4f9f8d[_0x9999('0x2d')]);_0x7657b[_0x9999('0x30')]=_[_0x9999('0x2f')](_0x4f9f8d['model'],qs['fields'](_0x366572[_0x9999('0x2d')][_0x9999('0x31')]));_0x7657b[_0x9999('0x30')]=_0x7657b[_0x9999('0x30')][_0x9999('0x48')]?_0x7657b[_0x9999('0x30')]:_0x4f9f8d['model'];_0x7657b['order']=qs[_0x9999('0x35')](_0x366572['query'][_0x9999('0x35')]);_0x7657b[_0x9999('0x36')]=qs['filters'](_[_0x9999('0x47')](_0x366572[_0x9999('0x2d')],_0x4f9f8d['filters']));if(_0x366572[_0x9999('0x2d')][_0x9999('0x39')]){_0x7657b[_0x9999('0x36')]=_[_0x9999('0x37')](_0x7657b['where'],{'$or':_['map'](_0x7657b[_0x9999('0x30')],function(_0x2a3036){var _0xf60e55={};_0xf60e55[_0x2a3036]={'$like':'%'+_0x366572['query'][_0x9999('0x39')]+'%'};return _0xf60e55;})});}_0x7657b=_[_0x9999('0x37')]({},_0x7657b,_0x366572['options']);return _0x2cdf57['getDescriptions'](_0x7657b);}})['then'](function(_0x43b2c0){if(_0x43b2c0){_0x55272a=_0x43b2c0[_0x9999('0x48')];if(!_0x366572[_0x9999('0x2d')]['hasOwnProperty'](_0x9999('0x33'))){_0x7657b['limit']=qs[_0x9999('0x1b')](_0x366572['query'][_0x9999('0x1b')]);_0x7657b['offset']=qs[_0x9999('0x19')](_0x366572[_0x9999('0x2d')][_0x9999('0x19')]);}return _0x2cdf57[_0x9999('0x49')](_0x7657b);}})[_0x9999('0x22')](function(_0x366b61){if(_0x366b61){return _0x366b61?{'count':_0x55272a,'rows':_0x366b61}:null;}})[_0x9999('0x22')](respondWithResult(_0xb1be,null))[_0x9999('0x3d')](handleError(_0xb1be,null));};exports[_0x9999('0x4a')]=function(_0x5574ea,_0x24732e,_0x36eed7){var _0x89e800={};var _0x4c9b24={};var _0x27f5c1;var _0x32004d;return db[_0x9999('0x28')][_0x9999('0x45')]({'where':{'id':_0x5574ea[_0x9999('0x3f')]['id']}})[_0x9999('0x22')](handleEntityNotFound(_0x24732e,null))[_0x9999('0x22')](function(_0x46f48b){if(_0x46f48b){_0x27f5c1=_0x46f48b;_0x4c9b24['model']=_[_0x9999('0x40')](db['FreshsalesField'][_0x9999('0x29')]);_0x4c9b24['query']=_[_0x9999('0x40')](_0x5574ea[_0x9999('0x2d')]);_0x4c9b24['filters']=_[_0x9999('0x2f')](_0x4c9b24[_0x9999('0x2c')],_0x4c9b24['query']);_0x89e800['attributes']=_[_0x9999('0x2f')](_0x4c9b24[_0x9999('0x2c')],qs['fields'](_0x5574ea['query'][_0x9999('0x31')]));_0x89e800[_0x9999('0x30')]=_0x89e800[_0x9999('0x30')][_0x9999('0x48')]?_0x89e800[_0x9999('0x30')]:_0x4c9b24['model'];_0x89e800[_0x9999('0x34')]=qs[_0x9999('0x35')](_0x5574ea[_0x9999('0x2d')][_0x9999('0x35')]);_0x89e800[_0x9999('0x36')]=qs[_0x9999('0x2e')](_[_0x9999('0x47')](_0x5574ea[_0x9999('0x2d')],_0x4c9b24[_0x9999('0x2e')]));if(_0x5574ea[_0x9999('0x2d')][_0x9999('0x39')]){_0x89e800[_0x9999('0x36')]=_['merge'](_0x89e800[_0x9999('0x36')],{'$or':_[_0x9999('0x27')](_0x89e800[_0x9999('0x30')],function(_0x48132d){var _0x3be804={};_0x3be804[_0x48132d]={'$like':'%'+_0x5574ea['query'][_0x9999('0x39')]+'%'};return _0x3be804;})});}_0x89e800=_[_0x9999('0x37')]({},_0x89e800,_0x5574ea[_0x9999('0x3a')]);return _0x27f5c1['getFields'](_0x89e800);}})[_0x9999('0x22')](function(_0x2dfab7){if(_0x2dfab7){_0x32004d=_0x2dfab7[_0x9999('0x48')];if(!_0x5574ea['query'][_0x9999('0x32')](_0x9999('0x33'))){_0x89e800['limit']=qs[_0x9999('0x1b')](_0x5574ea[_0x9999('0x2d')][_0x9999('0x1b')]);_0x89e800[_0x9999('0x19')]=qs[_0x9999('0x19')](_0x5574ea[_0x9999('0x2d')][_0x9999('0x19')]);}return _0x27f5c1['getFields'](_0x89e800);}})[_0x9999('0x22')](function(_0x55956d){if(_0x55956d){return _0x55956d?{'count':_0x32004d,'rows':_0x55956d}:null;}})[_0x9999('0x22')](respondWithResult(_0x24732e,null))['catch'](handleError(_0x24732e,null));}; \ No newline at end of file +var _0x06f8=['destroy','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','findOne','FreshsalesField','getSubjects','getDescriptions','nolimit','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x06f8,0x178));var _0x806f=function(_0x20c700,_0x57495d){_0x20c700=_0x20c700-0x0;var _0x373f50=_0x06f8[_0x20c700];return _0x373f50;};'use strict';var emlformat=require(_0x806f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x806f('0x1'));var jsonpatch=require(_0x806f('0x2'));var rp=require(_0x806f('0x3'));var moment=require(_0x806f('0x4'));var BPromise=require(_0x806f('0x5'));var Mustache=require(_0x806f('0x6'));var util=require(_0x806f('0x7'));var path=require(_0x806f('0x8'));var sox=require(_0x806f('0x9'));var csv=require(_0x806f('0xa'));var ejs=require(_0x806f('0xb'));var fs=require('fs');var fs_extra=require(_0x806f('0xc'));var _=require(_0x806f('0xd'));var squel=require(_0x806f('0xe'));var crypto=require(_0x806f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x806f('0x10'));var toCsv=require(_0x806f('0xa'));var querystring=require(_0x806f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x806f('0x12'));var qs=require(_0x806f('0x13'));var as=require(_0x806f('0x14'));var hardwareService=require(_0x806f('0x15'));var logger=require(_0x806f('0x16'))('api');var utils=require(_0x806f('0x17'));var config=require(_0x806f('0x18'));var licenseUtil=require(_0x806f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47c92c,_0x164fb3){_0x164fb3=_0x164fb3||0xcc;return function(_0x365f64){if(_0x365f64){return _0x47c92c[_0x806f('0x1a')](_0x164fb3);}return _0x47c92c[_0x806f('0x1b')](_0x164fb3)[_0x806f('0x1c')]();};}function respondWithResult(_0x2e2866,_0x67e606){_0x67e606=_0x67e606||0xc8;return function(_0x5473a3){if(_0x5473a3){return _0x2e2866[_0x806f('0x1b')](_0x67e606)['json'](_0x5473a3);}};}function respondWithFilteredResult(_0x39e981,_0x1dd1d5){return function(_0x598669){if(_0x598669){var _0x4c00fa=typeof _0x1dd1d5[_0x806f('0x1d')]===_0x806f('0x1e')&&typeof _0x1dd1d5[_0x806f('0x1f')]===_0x806f('0x1e');var _0x5a839b=_0x598669['count'];var _0x4667d7=_0x4c00fa?0x0:_0x1dd1d5['offset'];var _0x2dd2a1=_0x4c00fa?_0x598669[_0x806f('0x20')]:_0x1dd1d5[_0x806f('0x1d')]+_0x1dd1d5[_0x806f('0x1f')];var _0x5d825e;if(_0x2dd2a1>=_0x5a839b){_0x2dd2a1=_0x5a839b;_0x5d825e=0xc8;}else{_0x5d825e=0xce;}_0x39e981[_0x806f('0x1b')](_0x5d825e);return _0x39e981[_0x806f('0x21')](_0x806f('0x22'),_0x4667d7+'-'+_0x2dd2a1+'/'+_0x5a839b)['json'](_0x598669);}return null;};}function patchUpdates(_0x59e0ee){return function(_0x303713){try{jsonpatch['apply'](_0x303713,_0x59e0ee,!![]);}catch(_0x31b053){return BPromise[_0x806f('0x23')](_0x31b053);}return _0x303713[_0x806f('0x24')]();};}function saveUpdates(_0x466cef,_0x4e9960){return function(_0x3aeb28){if(_0x3aeb28){return _0x3aeb28[_0x806f('0x25')](_0x466cef)[_0x806f('0x26')](function(_0x3ae830){return _0x3ae830;});}return null;};}function removeEntity(_0x4491e8,_0x1fcc32){return function(_0x4f8ecc){if(_0x4f8ecc){return _0x4f8ecc[_0x806f('0x27')]()['then'](function(){_0x4491e8[_0x806f('0x1b')](0xcc)[_0x806f('0x1c')]();});}};}function handleEntityNotFound(_0x11a3d0,_0x2208de){return function(_0x4aa895){if(!_0x4aa895){_0x11a3d0[_0x806f('0x1a')](0x194);}return _0x4aa895;};}function handleError(_0x16e2b8,_0x309de7){_0x309de7=_0x309de7||0x1f4;return function(_0xcf69b3){logger[_0x806f('0x28')](_0xcf69b3[_0x806f('0x29')]);if(_0xcf69b3[_0x806f('0x2a')]){delete _0xcf69b3[_0x806f('0x2a')];}_0x16e2b8['status'](_0x309de7)[_0x806f('0x2b')](_0xcf69b3);};}exports[_0x806f('0x2c')]=function(_0x1b4c01,_0x2969bd){var _0x286516={},_0x333fdf={},_0x57b9f3={'count':0x0,'rows':[]};var _0x6e41a4=_[_0x806f('0x2d')](db[_0x806f('0x2e')]['rawAttributes'],function(_0x5cdd42){return{'name':_0x5cdd42[_0x806f('0x2f')],'type':_0x5cdd42[_0x806f('0x30')][_0x806f('0x31')]};});_0x333fdf[_0x806f('0x32')]=_[_0x806f('0x2d')](_0x6e41a4,_0x806f('0x2a'));_0x333fdf[_0x806f('0x33')]=_[_0x806f('0x34')](_0x1b4c01[_0x806f('0x33')]);_0x333fdf['filters']=_[_0x806f('0x35')](_0x333fdf[_0x806f('0x32')],_0x333fdf[_0x806f('0x33')]);_0x286516[_0x806f('0x36')]=_[_0x806f('0x35')](_0x333fdf['model'],qs[_0x806f('0x37')](_0x1b4c01[_0x806f('0x33')][_0x806f('0x37')]));_0x286516[_0x806f('0x36')]=_0x286516[_0x806f('0x36')][_0x806f('0x38')]?_0x286516['attributes']:_0x333fdf[_0x806f('0x32')];if(!_0x1b4c01[_0x806f('0x33')][_0x806f('0x39')]('nolimit')){_0x286516['limit']=qs['limit'](_0x1b4c01['query'][_0x806f('0x1f')]);_0x286516[_0x806f('0x1d')]=qs[_0x806f('0x1d')](_0x1b4c01[_0x806f('0x33')][_0x806f('0x1d')]);}_0x286516[_0x806f('0x3a')]=qs['sort'](_0x1b4c01[_0x806f('0x33')][_0x806f('0x3b')]);_0x286516[_0x806f('0x3c')]=qs[_0x806f('0x3d')](_[_0x806f('0x3e')](_0x1b4c01[_0x806f('0x33')],_0x333fdf[_0x806f('0x3d')]),_0x6e41a4);if(_0x1b4c01['query'][_0x806f('0x3f')]){_0x286516[_0x806f('0x3c')]=_[_0x806f('0x40')](_0x286516[_0x806f('0x3c')],{'$or':_[_0x806f('0x2d')](_0x6e41a4,function(_0x5d8d14){if(_0x5d8d14['type']!=='VIRTUAL'){var _0x21eb35={};_0x21eb35[_0x5d8d14[_0x806f('0x2a')]]={'$like':'%'+_0x1b4c01['query'][_0x806f('0x3f')]+'%'};return _0x21eb35;}})});}_0x286516=_[_0x806f('0x40')]({},_0x286516,_0x1b4c01[_0x806f('0x41')]);var _0x30e0ee={'where':_0x286516[_0x806f('0x3c')]};return db[_0x806f('0x2e')][_0x806f('0x20')](_0x30e0ee)[_0x806f('0x26')](function(_0xfc8851){_0x57b9f3[_0x806f('0x20')]=_0xfc8851;if(_0x1b4c01[_0x806f('0x33')][_0x806f('0x42')]){_0x286516['include']=[{'all':!![]}];}return db[_0x806f('0x2e')][_0x806f('0x43')](_0x286516);})[_0x806f('0x26')](function(_0x315cde){_0x57b9f3[_0x806f('0x44')]=_0x315cde;return _0x57b9f3;})[_0x806f('0x26')](respondWithFilteredResult(_0x2969bd,_0x286516))[_0x806f('0x45')](handleError(_0x2969bd,null));};exports[_0x806f('0x46')]=function(_0x2c9ab2,_0x495d3c){var _0x2b5dbe={'raw':![],'where':{'id':_0x2c9ab2[_0x806f('0x47')]['id']}},_0x4826ed={};_0x4826ed[_0x806f('0x32')]=_[_0x806f('0x34')](db[_0x806f('0x2e')][_0x806f('0x48')]);_0x4826ed[_0x806f('0x33')]=_['keys'](_0x2c9ab2['query']);_0x4826ed['filters']=_['intersection'](_0x4826ed['model'],_0x4826ed[_0x806f('0x33')]);_0x2b5dbe[_0x806f('0x36')]=_[_0x806f('0x35')](_0x4826ed[_0x806f('0x32')],qs['fields'](_0x2c9ab2[_0x806f('0x33')][_0x806f('0x37')]));_0x2b5dbe[_0x806f('0x36')]=_0x2b5dbe[_0x806f('0x36')][_0x806f('0x38')]?_0x2b5dbe[_0x806f('0x36')]:_0x4826ed['model'];if(_0x2c9ab2[_0x806f('0x33')][_0x806f('0x42')]){_0x2b5dbe[_0x806f('0x49')]=[{'all':!![]}];}_0x2b5dbe=_[_0x806f('0x40')]({},_0x2b5dbe,_0x2c9ab2['options']);return db['FreshsalesConfiguration']['find'](_0x2b5dbe)[_0x806f('0x26')](handleEntityNotFound(_0x495d3c,null))[_0x806f('0x26')](respondWithResult(_0x495d3c,null))[_0x806f('0x45')](handleError(_0x495d3c,null));};exports[_0x806f('0x4a')]=function(_0x5d18ff,_0x341690){return db[_0x806f('0x2e')]['create'](_0x5d18ff[_0x806f('0x4b')],{})[_0x806f('0x26')](respondWithResult(_0x341690,0xc9))[_0x806f('0x45')](handleError(_0x341690,null));};exports[_0x806f('0x25')]=function(_0xff76a4,_0x5a4a18){if(_0xff76a4['body']['id']){delete _0xff76a4[_0x806f('0x4b')]['id'];}return db[_0x806f('0x2e')][_0x806f('0x4c')]({'where':{'id':_0xff76a4[_0x806f('0x47')]['id']}})[_0x806f('0x26')](handleEntityNotFound(_0x5a4a18,null))['then'](saveUpdates(_0xff76a4['body'],null))['then'](respondWithResult(_0x5a4a18,null))[_0x806f('0x45')](handleError(_0x5a4a18,null));};exports[_0x806f('0x27')]=function(_0x3e2e78,_0x4ff00b){return db[_0x806f('0x2e')][_0x806f('0x4c')]({'where':{'id':_0x3e2e78[_0x806f('0x47')]['id']}})[_0x806f('0x26')](handleEntityNotFound(_0x4ff00b,null))[_0x806f('0x26')](removeEntity(_0x4ff00b,null))[_0x806f('0x45')](handleError(_0x4ff00b,null));};exports['getSubjects']=function(_0x10e33f,_0x102161,_0x2428c9){var _0x4887e3={};var _0x539aab={};var _0x5eaa8f;var _0x2c0a60;return db['FreshsalesConfiguration'][_0x806f('0x4d')]({'where':{'id':_0x10e33f[_0x806f('0x47')]['id']}})[_0x806f('0x26')](handleEntityNotFound(_0x102161,null))['then'](function(_0x3787ea){if(_0x3787ea){_0x5eaa8f=_0x3787ea;_0x539aab['model']=_[_0x806f('0x34')](db[_0x806f('0x4e')]['rawAttributes']);_0x539aab[_0x806f('0x33')]=_[_0x806f('0x34')](_0x10e33f[_0x806f('0x33')]);_0x539aab[_0x806f('0x3d')]=_['intersection'](_0x539aab[_0x806f('0x32')],_0x539aab[_0x806f('0x33')]);_0x4887e3[_0x806f('0x36')]=_[_0x806f('0x35')](_0x539aab[_0x806f('0x32')],qs[_0x806f('0x37')](_0x10e33f[_0x806f('0x33')][_0x806f('0x37')]));_0x4887e3[_0x806f('0x36')]=_0x4887e3[_0x806f('0x36')][_0x806f('0x38')]?_0x4887e3['attributes']:_0x539aab[_0x806f('0x32')];_0x4887e3['order']=qs[_0x806f('0x3b')](_0x10e33f[_0x806f('0x33')][_0x806f('0x3b')]);_0x4887e3['where']=qs[_0x806f('0x3d')](_[_0x806f('0x3e')](_0x10e33f['query'],_0x539aab['filters']));if(_0x10e33f[_0x806f('0x33')][_0x806f('0x3f')]){_0x4887e3[_0x806f('0x3c')]=_[_0x806f('0x40')](_0x4887e3[_0x806f('0x3c')],{'$or':_[_0x806f('0x2d')](_0x4887e3[_0x806f('0x36')],function(_0x65de9e){var _0x3b4436={};_0x3b4436[_0x65de9e]={'$like':'%'+_0x10e33f[_0x806f('0x33')][_0x806f('0x3f')]+'%'};return _0x3b4436;})});}_0x4887e3=_['merge']({},_0x4887e3,_0x10e33f[_0x806f('0x41')]);return _0x5eaa8f[_0x806f('0x4f')](_0x4887e3);}})[_0x806f('0x26')](function(_0x205a8d){if(_0x205a8d){_0x2c0a60=_0x205a8d[_0x806f('0x38')];if(!_0x10e33f[_0x806f('0x33')]['hasOwnProperty']('nolimit')){_0x4887e3['limit']=qs[_0x806f('0x1f')](_0x10e33f[_0x806f('0x33')]['limit']);_0x4887e3['offset']=qs[_0x806f('0x1d')](_0x10e33f[_0x806f('0x33')]['offset']);}return _0x5eaa8f[_0x806f('0x4f')](_0x4887e3);}})[_0x806f('0x26')](function(_0x4bf2e7){if(_0x4bf2e7){return _0x4bf2e7?{'count':_0x2c0a60,'rows':_0x4bf2e7}:null;}})[_0x806f('0x26')](respondWithResult(_0x102161,null))['catch'](handleError(_0x102161,null));};exports[_0x806f('0x50')]=function(_0x25cb0c,_0x42d230,_0x205fc5){var _0x3ae785={};var _0x5f28bf={};var _0x449f4b;var _0x284203;return db['FreshsalesConfiguration'][_0x806f('0x4d')]({'where':{'id':_0x25cb0c[_0x806f('0x47')]['id']}})['then'](handleEntityNotFound(_0x42d230,null))[_0x806f('0x26')](function(_0x2ec1f3){if(_0x2ec1f3){_0x449f4b=_0x2ec1f3;_0x5f28bf[_0x806f('0x32')]=_[_0x806f('0x34')](db['FreshsalesField'][_0x806f('0x48')]);_0x5f28bf[_0x806f('0x33')]=_[_0x806f('0x34')](_0x25cb0c[_0x806f('0x33')]);_0x5f28bf[_0x806f('0x3d')]=_['intersection'](_0x5f28bf[_0x806f('0x32')],_0x5f28bf['query']);_0x3ae785[_0x806f('0x36')]=_[_0x806f('0x35')](_0x5f28bf[_0x806f('0x32')],qs[_0x806f('0x37')](_0x25cb0c[_0x806f('0x33')][_0x806f('0x37')]));_0x3ae785[_0x806f('0x36')]=_0x3ae785[_0x806f('0x36')][_0x806f('0x38')]?_0x3ae785[_0x806f('0x36')]:_0x5f28bf['model'];_0x3ae785[_0x806f('0x3a')]=qs[_0x806f('0x3b')](_0x25cb0c[_0x806f('0x33')][_0x806f('0x3b')]);_0x3ae785['where']=qs['filters'](_[_0x806f('0x3e')](_0x25cb0c[_0x806f('0x33')],_0x5f28bf[_0x806f('0x3d')]));if(_0x25cb0c[_0x806f('0x33')][_0x806f('0x3f')]){_0x3ae785['where']=_['merge'](_0x3ae785[_0x806f('0x3c')],{'$or':_[_0x806f('0x2d')](_0x3ae785[_0x806f('0x36')],function(_0x487feb){var _0x5edcfc={};_0x5edcfc[_0x487feb]={'$like':'%'+_0x25cb0c['query'][_0x806f('0x3f')]+'%'};return _0x5edcfc;})});}_0x3ae785=_['merge']({},_0x3ae785,_0x25cb0c[_0x806f('0x41')]);return _0x449f4b['getDescriptions'](_0x3ae785);}})[_0x806f('0x26')](function(_0x57eccd){if(_0x57eccd){_0x284203=_0x57eccd['length'];if(!_0x25cb0c[_0x806f('0x33')]['hasOwnProperty'](_0x806f('0x51'))){_0x3ae785[_0x806f('0x1f')]=qs[_0x806f('0x1f')](_0x25cb0c['query'][_0x806f('0x1f')]);_0x3ae785['offset']=qs[_0x806f('0x1d')](_0x25cb0c['query']['offset']);}return _0x449f4b[_0x806f('0x50')](_0x3ae785);}})[_0x806f('0x26')](function(_0x8edebe){if(_0x8edebe){return _0x8edebe?{'count':_0x284203,'rows':_0x8edebe}:null;}})['then'](respondWithResult(_0x42d230,null))[_0x806f('0x45')](handleError(_0x42d230,null));};exports[_0x806f('0x52')]=function(_0x4bdc35,_0x324b1c,_0x5003da){var _0x29ad7a={};var _0x227027={};var _0x54de6d;var _0x240af2;return db[_0x806f('0x2e')]['findOne']({'where':{'id':_0x4bdc35['params']['id']}})[_0x806f('0x26')](handleEntityNotFound(_0x324b1c,null))[_0x806f('0x26')](function(_0x5508bc){if(_0x5508bc){_0x54de6d=_0x5508bc;_0x227027[_0x806f('0x32')]=_['keys'](db['FreshsalesField'][_0x806f('0x48')]);_0x227027[_0x806f('0x33')]=_[_0x806f('0x34')](_0x4bdc35[_0x806f('0x33')]);_0x227027[_0x806f('0x3d')]=_['intersection'](_0x227027[_0x806f('0x32')],_0x227027[_0x806f('0x33')]);_0x29ad7a[_0x806f('0x36')]=_['intersection'](_0x227027['model'],qs[_0x806f('0x37')](_0x4bdc35[_0x806f('0x33')][_0x806f('0x37')]));_0x29ad7a[_0x806f('0x36')]=_0x29ad7a[_0x806f('0x36')][_0x806f('0x38')]?_0x29ad7a['attributes']:_0x227027[_0x806f('0x32')];_0x29ad7a['order']=qs[_0x806f('0x3b')](_0x4bdc35[_0x806f('0x33')]['sort']);_0x29ad7a[_0x806f('0x3c')]=qs[_0x806f('0x3d')](_[_0x806f('0x3e')](_0x4bdc35[_0x806f('0x33')],_0x227027[_0x806f('0x3d')]));if(_0x4bdc35['query']['filter']){_0x29ad7a[_0x806f('0x3c')]=_['merge'](_0x29ad7a[_0x806f('0x3c')],{'$or':_[_0x806f('0x2d')](_0x29ad7a['attributes'],function(_0x10749e){var _0x20ad6b={};_0x20ad6b[_0x10749e]={'$like':'%'+_0x4bdc35[_0x806f('0x33')][_0x806f('0x3f')]+'%'};return _0x20ad6b;})});}_0x29ad7a=_[_0x806f('0x40')]({},_0x29ad7a,_0x4bdc35['options']);return _0x54de6d['getFields'](_0x29ad7a);}})['then'](function(_0x522d7e){if(_0x522d7e){_0x240af2=_0x522d7e['length'];if(!_0x4bdc35[_0x806f('0x33')]['hasOwnProperty'](_0x806f('0x51'))){_0x29ad7a[_0x806f('0x1f')]=qs[_0x806f('0x1f')](_0x4bdc35[_0x806f('0x33')][_0x806f('0x1f')]);_0x29ad7a[_0x806f('0x1d')]=qs[_0x806f('0x1d')](_0x4bdc35[_0x806f('0x33')]['offset']);}return _0x54de6d[_0x806f('0x52')](_0x29ad7a);}})[_0x806f('0x26')](function(_0xfefb02){if(_0xfefb02){return _0xfefb02?{'count':_0x240af2,'rows':_0xfefb02}:null;}})[_0x806f('0x26')](respondWithResult(_0x324b1c,null))['catch'](handleError(_0x324b1c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b706b65..4c7f870 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 _0xaa58=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b47cf,_0x1133c5){var _0x58a228=function(_0x47d340){while(--_0x47d340){_0x4b47cf['push'](_0x4b47cf['shift']());}};_0x58a228(++_0x1133c5);}(_0xaa58,0x131));var _0x8aa5=function(_0x37a604,_0x253974){_0x37a604=_0x37a604-0x0;var _0xa9486b=_0xaa58[_0x37a604];return _0xa9486b;};'use strict';var _=require(_0x8aa5('0x0'));var util=require(_0x8aa5('0x1'));var logger=require(_0x8aa5('0x2'))(_0x8aa5('0x3'));var moment=require(_0x8aa5('0x4'));var BPromise=require('bluebird');var rp=require(_0x8aa5('0x5'));var fs=require('fs');var path=require(_0x8aa5('0x6'));var rimraf=require(_0x8aa5('0x7'));var config=require(_0x8aa5('0x8'));var attributes=require(_0x8aa5('0x9'));module['exports']=function(_0x113354,_0x3fc1c0){return _0x113354[_0x8aa5('0xa')](_0x8aa5('0xb'),attributes,{'tableName':_0x8aa5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea39=['api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger'];(function(_0x221eda,_0xcf03bf){var _0x132929=function(_0x18b5d4){while(--_0x18b5d4){_0x221eda['push'](_0x221eda['shift']());}};_0x132929(++_0xcf03bf);}(_0xea39,0x12a));var _0x9ea3=function(_0x50e130,_0xc030b1){_0x50e130=_0x50e130-0x0;var _0x1865b2=_0xea39[_0x50e130];return _0x1865b2;};'use strict';var _=require('lodash');var util=require(_0x9ea3('0x0'));var logger=require(_0x9ea3('0x1'))(_0x9ea3('0x2'));var moment=require(_0x9ea3('0x3'));var BPromise=require(_0x9ea3('0x4'));var rp=require(_0x9ea3('0x5'));var fs=require('fs');var path=require(_0x9ea3('0x6'));var rimraf=require('rimraf');var config=require(_0x9ea3('0x7'));var attributes=require(_0x9ea3('0x8'));module[_0x9ea3('0x9')]=function(_0x51a56c,_0x5d2ce3){return _0x51a56c['define'](_0x9ea3('0xa'),attributes,{'tableName':_0x9ea3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 544e3b4..ab8c0f6 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 _0x03d3=['../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x33e7a6,_0x61b668){var _0x267a33=function(_0x21718f){while(--_0x21718f){_0x33e7a6['push'](_0x33e7a6['shift']());}};_0x267a33(++_0x61b668);}(_0x03d3,0x14a));var _0x303d=function(_0x3904de,_0x2f6c7d){_0x3904de=_0x3904de-0x0;var _0x169a57=_0x03d3[_0x3904de];return _0x169a57;};'use strict';var _=require(_0x303d('0x0'));var util=require('util');var moment=require(_0x303d('0x1'));var BPromise=require(_0x303d('0x2'));var rs=require(_0x303d('0x3'));var fs=require('fs');var Redis=require(_0x303d('0x4'));var db=require(_0x303d('0x5'))['db'];var utils=require(_0x303d('0x6'));var logger=require('../../config/logger')(_0x303d('0x7'));var config=require(_0x303d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x303d('0x9')][_0x303d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427009,_0x596f7a,_0x2fb3aa){return new BPromise(function(_0x299ee2,_0x506f36){return client[_0x303d('0xb')](_0x427009,_0x2fb3aa)['then'](function(_0x9c5ca3){logger[_0x303d('0xc')](_0x303d('0xd'),_0x596f7a,'request\x20sent');logger['debug'](_0x303d('0xe'),_0x596f7a,'request\x20sent',JSON['stringify'](_0x9c5ca3));if(_0x9c5ca3['error']){if(_0x9c5ca3['error'][_0x303d('0xf')]===0x1f4){logger[_0x303d('0x10')](_0x303d('0xd'),_0x596f7a,_0x9c5ca3['error'][_0x303d('0x11')]);return _0x506f36(_0x9c5ca3[_0x303d('0x10')][_0x303d('0x11')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x596f7a,_0x9c5ca3[_0x303d('0x10')][_0x303d('0x11')]);return _0x299ee2(_0x9c5ca3['error'][_0x303d('0x11')]);}else{logger['info'](_0x303d('0xd'),_0x596f7a,_0x303d('0x12'));_0x299ee2(_0x9c5ca3[_0x303d('0x13')]['message']);}})[_0x303d('0x14')](function(_0x4d8f94){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x596f7a,_0x4d8f94);_0x506f36(_0x4d8f94);});});} \ No newline at end of file +var _0x4a98=['jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x43bc0d,_0x3ea603){var _0x4e8fb4=function(_0x465e8f){while(--_0x465e8f){_0x43bc0d['push'](_0x43bc0d['shift']());}};_0x4e8fb4(++_0x3ea603);}(_0x4a98,0x93));var _0x84a9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x4a98[_0x1ebce2];return _0x4a330c;};'use strict';var _=require(_0x84a9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x84a9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84a9('0x2'))['db'];var utils=require(_0x84a9('0x3'));var logger=require('../../config/logger')(_0x84a9('0x4'));var config=require('../../config/environment');var jayson=require(_0x84a9('0x5'));var client=jayson['client'][_0x84a9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x55afa1,_0xc04f5b,_0x373f58){return new BPromise(function(_0x562069,_0x6dd7e5){return client[_0x84a9('0x7')](_0x55afa1,_0x373f58)[_0x84a9('0x8')](function(_0x154de6){logger['info'](_0x84a9('0x9'),_0xc04f5b,_0x84a9('0xa'));logger[_0x84a9('0xb')](_0x84a9('0xc'),_0xc04f5b,_0x84a9('0xa'),JSON[_0x84a9('0xd')](_0x154de6));if(_0x154de6['error']){if(_0x154de6[_0x84a9('0xe')][_0x84a9('0xf')]===0x1f4){logger['error'](_0x84a9('0x9'),_0xc04f5b,_0x154de6[_0x84a9('0xe')]['message']);return _0x6dd7e5(_0x154de6[_0x84a9('0xe')][_0x84a9('0x10')]);}logger[_0x84a9('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xc04f5b,_0x154de6[_0x84a9('0xe')][_0x84a9('0x10')]);return _0x562069(_0x154de6['error'][_0x84a9('0x10')]);}else{logger['info'](_0x84a9('0x9'),_0xc04f5b,_0x84a9('0xa'));_0x562069(_0x154de6[_0x84a9('0x11')][_0x84a9('0x10')]);}})[_0x84a9('0x12')](function(_0x4215fb){logger[_0x84a9('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xc04f5b,_0x4215fb);_0x6dd7e5(_0x4215fb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 34f2be7..8c9095f 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 _0xf109=['index','/:id','post','create','put','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated'];(function(_0x42ffeb,_0x5595ab){var _0x3fd983=function(_0x3cba5c){while(--_0x3cba5c){_0x42ffeb['push'](_0x42ffeb['shift']());}};_0x3fd983(++_0x5595ab);}(_0xf109,0xce));var _0x9f10=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xf109[_0x4c445a];return _0x2f611c;};'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['show']);router[_0x9f10('0xc')]('/',auth[_0x9f10('0x9')](),controller[_0x9f10('0xd')]);router[_0x9f10('0xe')](_0x9f10('0xb'),auth['isAuthenticated'](),controller[_0x9f10('0xf')]);router[_0x9f10('0x10')](_0x9f10('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9f10('0x11')]=router; \ No newline at end of file +var _0x1fdc=['show','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4c2f17,_0x5c6821){var _0x20919e=function(_0x31eef7){while(--_0x31eef7){_0x4c2f17['push'](_0x4c2f17['shift']());}};_0x20919e(++_0x5c6821);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x1fdc[_0x17928f];return _0x500b63;};'use strict';var multer=require(_0xc1fd('0x0'));var util=require(_0xc1fd('0x1'));var path=require('path');var timeout=require(_0xc1fd('0x2'));var express=require(_0xc1fd('0x3'));var router=express[_0xc1fd('0x4')]();var fs_extra=require(_0xc1fd('0x5'));var auth=require(_0xc1fd('0x6'));var interaction=require(_0xc1fd('0x7'));var config=require(_0xc1fd('0x8'));var controller=require('./intFreshsalesField.controller');router[_0xc1fd('0x9')]('/',auth[_0xc1fd('0xa')](),controller[_0xc1fd('0xb')]);router[_0xc1fd('0x9')](_0xc1fd('0xc'),auth[_0xc1fd('0xa')](),controller[_0xc1fd('0xd')]);router[_0xc1fd('0xe')]('/',auth[_0xc1fd('0xa')](),controller[_0xc1fd('0xf')]);router[_0xc1fd('0x10')](_0xc1fd('0xc'),auth[_0xc1fd('0xa')](),controller['update']);router[_0xc1fd('0x11')](_0xc1fd('0xc'),auth['isAuthenticated'](),controller[_0xc1fd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 94d5ffe..4981188 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 _0xdcef=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x16f81e,_0x40c335){var _0x27f1c4=function(_0x5367cf){while(--_0x5367cf){_0x16f81e['push'](_0x16f81e['shift']());}};_0x27f1c4(++_0x40c335);}(_0xdcef,0x16e));var _0xfdce=function(_0x2dac64,_0x482934){_0x2dac64=_0x2dac64-0x0;var _0x5392e3=_0xdcef[_0x2dac64];return _0x5392e3;};'use strict';var Sequelize=require(_0xfdce('0x0'));module[_0xfdce('0x1')]={'type':{'type':Sequelize[_0xfdce('0x2')](_0xfdce('0x3'),_0xfdce('0x4'),_0xfdce('0x5'),_0xfdce('0x6'),_0xfdce('0x7')),'defaultValue':_0xfdce('0x3')},'content':{'type':Sequelize[_0xfdce('0x8')]},'key':{'type':Sequelize[_0xfdce('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0xfdce('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xfdce('0x8')]},'idField':{'type':Sequelize[_0xfdce('0x8')]},'nameField':{'type':Sequelize[_0xfdce('0x8')]},'customField':{'type':Sequelize[_0xfdce('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfdce('0x8')]}}; \ No newline at end of file +var _0xfc7f=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xfc7f,0x12d));var _0xffc7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc7f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xffc7('0x0'));module[_0xffc7('0x1')]={'type':{'type':Sequelize[_0xffc7('0x2')](_0xffc7('0x3'),_0xffc7('0x4'),'customVariable',_0xffc7('0x5'),_0xffc7('0x6')),'defaultValue':_0xffc7('0x3')},'content':{'type':Sequelize[_0xffc7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xffc7('0x2')](_0xffc7('0x3'),_0xffc7('0x4'),_0xffc7('0x8'))},'keyContent':{'type':Sequelize[_0xffc7('0x7')]},'idField':{'type':Sequelize[_0xffc7('0x7')]},'nameField':{'type':Sequelize[_0xffc7('0x7')]},'customField':{'type':Sequelize[_0xffc7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xffc7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2e682c8..bbca95d 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 _0x6b24=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','FreshsalesField','rawAttributes','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b24,0x1ab));var _0x46b2=function(_0x5c4a87,_0x35cd28){_0x5c4a87=_0x5c4a87-0x0;var _0x1a8c55=_0x6b24[_0x5c4a87];return _0x1a8c55;};'use strict';var emlformat=require(_0x46b2('0x0'));var rimraf=require(_0x46b2('0x1'));var zipdir=require(_0x46b2('0x2'));var jsonpatch=require(_0x46b2('0x3'));var rp=require(_0x46b2('0x4'));var moment=require(_0x46b2('0x5'));var BPromise=require(_0x46b2('0x6'));var Mustache=require(_0x46b2('0x7'));var util=require(_0x46b2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x46b2('0x9'));var ejs=require(_0x46b2('0xa'));var fs=require('fs');var fs_extra=require(_0x46b2('0xb'));var _=require('lodash');var squel=require(_0x46b2('0xc'));var crypto=require(_0x46b2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x46b2('0x9'));var querystring=require('querystring');var Papa=require(_0x46b2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46b2('0xf'));var as=require(_0x46b2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46b2('0x11'))('api');var utils=require(_0x46b2('0x12'));var config=require(_0x46b2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x46b2('0x14'))['db'];function respondWithStatusCode(_0x5d8e30,_0x57a261){_0x57a261=_0x57a261||0xcc;return function(_0x4c7a35){if(_0x4c7a35){return _0x5d8e30[_0x46b2('0x15')](_0x57a261);}return _0x5d8e30[_0x46b2('0x16')](_0x57a261)[_0x46b2('0x17')]();};}function respondWithResult(_0x134471,_0x5a74c8){_0x5a74c8=_0x5a74c8||0xc8;return function(_0x3aa957){if(_0x3aa957){return _0x134471['status'](_0x5a74c8)[_0x46b2('0x18')](_0x3aa957);}};}function respondWithFilteredResult(_0x3d503b,_0x30525a){return function(_0x28a87c){if(_0x28a87c){var _0x265ebe=typeof _0x30525a[_0x46b2('0x19')]===_0x46b2('0x1a')&&typeof _0x30525a[_0x46b2('0x1b')]===_0x46b2('0x1a');var _0x46ea93=_0x28a87c[_0x46b2('0x1c')];var _0x5b5812=_0x265ebe?0x0:_0x30525a[_0x46b2('0x19')];var _0x4d5fbe=_0x265ebe?_0x28a87c[_0x46b2('0x1c')]:_0x30525a['offset']+_0x30525a[_0x46b2('0x1b')];var _0x27ecb7;if(_0x4d5fbe>=_0x46ea93){_0x4d5fbe=_0x46ea93;_0x27ecb7=0xc8;}else{_0x27ecb7=0xce;}_0x3d503b[_0x46b2('0x16')](_0x27ecb7);return _0x3d503b['set'](_0x46b2('0x1d'),_0x5b5812+'-'+_0x4d5fbe+'/'+_0x46ea93)[_0x46b2('0x18')](_0x28a87c);}return null;};}function patchUpdates(_0x50beee){return function(_0x4db33d){try{jsonpatch['apply'](_0x4db33d,_0x50beee,!![]);}catch(_0x475a3b){return BPromise['reject'](_0x475a3b);}return _0x4db33d[_0x46b2('0x1e')]();};}function saveUpdates(_0x5be615,_0x2e14d0){return function(_0x3ad2b0){if(_0x3ad2b0){return _0x3ad2b0[_0x46b2('0x1f')](_0x5be615)[_0x46b2('0x20')](function(_0xf1ae92){return _0xf1ae92;});}return null;};}function removeEntity(_0x12e683,_0x269038){return function(_0x33a39f){if(_0x33a39f){return _0x33a39f[_0x46b2('0x21')]()[_0x46b2('0x20')](function(){_0x12e683[_0x46b2('0x16')](0xcc)[_0x46b2('0x17')]();});}};}function handleEntityNotFound(_0x40bc7b,_0x262dd7){return function(_0x55ba53){if(!_0x55ba53){_0x40bc7b[_0x46b2('0x15')](0x194);}return _0x55ba53;};}function handleError(_0x45b335,_0x265f2d){_0x265f2d=_0x265f2d||0x1f4;return function(_0x1cf816){logger[_0x46b2('0x22')](_0x1cf816[_0x46b2('0x23')]);if(_0x1cf816[_0x46b2('0x24')]){delete _0x1cf816['name'];}_0x45b335[_0x46b2('0x16')](_0x265f2d)[_0x46b2('0x25')](_0x1cf816);};}exports['index']=function(_0x46da4a,_0x2f51db){var _0x2b0d02={},_0x39c392={},_0x2e34d4={'count':0x0,'rows':[]};var _0x412ed2=_['map'](db[_0x46b2('0x26')][_0x46b2('0x27')],function(_0x4fc4a0){return{'name':_0x4fc4a0['fieldName'],'type':_0x4fc4a0[_0x46b2('0x28')]['key']};});_0x39c392[_0x46b2('0x29')]=_[_0x46b2('0x2a')](_0x412ed2,_0x46b2('0x24'));_0x39c392[_0x46b2('0x2b')]=_[_0x46b2('0x2c')](_0x46da4a[_0x46b2('0x2b')]);_0x39c392['filters']=_['intersection'](_0x39c392[_0x46b2('0x29')],_0x39c392[_0x46b2('0x2b')]);_0x2b0d02[_0x46b2('0x2d')]=_[_0x46b2('0x2e')](_0x39c392[_0x46b2('0x29')],qs[_0x46b2('0x2f')](_0x46da4a['query'][_0x46b2('0x2f')]));_0x2b0d02[_0x46b2('0x2d')]=_0x2b0d02[_0x46b2('0x2d')][_0x46b2('0x30')]?_0x2b0d02[_0x46b2('0x2d')]:_0x39c392[_0x46b2('0x29')];if(!_0x46da4a[_0x46b2('0x2b')][_0x46b2('0x31')](_0x46b2('0x32'))){_0x2b0d02['limit']=qs['limit'](_0x46da4a[_0x46b2('0x2b')][_0x46b2('0x1b')]);_0x2b0d02[_0x46b2('0x19')]=qs['offset'](_0x46da4a[_0x46b2('0x2b')][_0x46b2('0x19')]);}_0x2b0d02['order']=qs[_0x46b2('0x33')](_0x46da4a[_0x46b2('0x2b')][_0x46b2('0x33')]);_0x2b0d02['where']=qs[_0x46b2('0x34')](_[_0x46b2('0x35')](_0x46da4a[_0x46b2('0x2b')],_0x39c392[_0x46b2('0x34')]),_0x412ed2);if(_0x46da4a[_0x46b2('0x2b')][_0x46b2('0x36')]){_0x2b0d02[_0x46b2('0x37')]=_[_0x46b2('0x38')](_0x2b0d02[_0x46b2('0x37')],{'$or':_[_0x46b2('0x2a')](_0x412ed2,function(_0x52c3e1){if(_0x52c3e1[_0x46b2('0x28')]!==_0x46b2('0x39')){var _0xb7095d={};_0xb7095d[_0x52c3e1[_0x46b2('0x24')]]={'$like':'%'+_0x46da4a[_0x46b2('0x2b')][_0x46b2('0x36')]+'%'};return _0xb7095d;}})});}_0x2b0d02=_[_0x46b2('0x38')]({},_0x2b0d02,_0x46da4a[_0x46b2('0x3a')]);var _0x4f4dae={'where':_0x2b0d02[_0x46b2('0x37')]};return db[_0x46b2('0x26')][_0x46b2('0x1c')](_0x4f4dae)[_0x46b2('0x20')](function(_0x268cf7){_0x2e34d4[_0x46b2('0x1c')]=_0x268cf7;if(_0x46da4a['query'][_0x46b2('0x3b')]){_0x2b0d02[_0x46b2('0x3c')]=[{'all':!![]}];}return db[_0x46b2('0x26')][_0x46b2('0x3d')](_0x2b0d02);})['then'](function(_0x172200){_0x2e34d4[_0x46b2('0x3e')]=_0x172200;return _0x2e34d4;})[_0x46b2('0x20')](respondWithFilteredResult(_0x2f51db,_0x2b0d02))['catch'](handleError(_0x2f51db,null));};exports[_0x46b2('0x3f')]=function(_0x1c7639,_0xc8c3f1){var _0x13f6b1={'raw':!![],'where':{'id':_0x1c7639[_0x46b2('0x40')]['id']}},_0x20ca3f={};_0x20ca3f[_0x46b2('0x29')]=_[_0x46b2('0x2c')](db[_0x46b2('0x26')][_0x46b2('0x27')]);_0x20ca3f[_0x46b2('0x2b')]=_['keys'](_0x1c7639[_0x46b2('0x2b')]);_0x20ca3f['filters']=_[_0x46b2('0x2e')](_0x20ca3f[_0x46b2('0x29')],_0x20ca3f[_0x46b2('0x2b')]);_0x13f6b1[_0x46b2('0x2d')]=_['intersection'](_0x20ca3f[_0x46b2('0x29')],qs[_0x46b2('0x2f')](_0x1c7639['query'][_0x46b2('0x2f')]));_0x13f6b1[_0x46b2('0x2d')]=_0x13f6b1[_0x46b2('0x2d')][_0x46b2('0x30')]?_0x13f6b1['attributes']:_0x20ca3f[_0x46b2('0x29')];if(_0x1c7639[_0x46b2('0x2b')]['includeAll']){_0x13f6b1[_0x46b2('0x3c')]=[{'all':!![]}];}_0x13f6b1=_[_0x46b2('0x38')]({},_0x13f6b1,_0x1c7639[_0x46b2('0x3a')]);return db[_0x46b2('0x26')][_0x46b2('0x41')](_0x13f6b1)[_0x46b2('0x20')](handleEntityNotFound(_0xc8c3f1,null))[_0x46b2('0x20')](respondWithResult(_0xc8c3f1,null))[_0x46b2('0x42')](handleError(_0xc8c3f1,null));};exports[_0x46b2('0x43')]=function(_0x298a7d,_0xfc1f94){return db[_0x46b2('0x26')]['create'](_0x298a7d[_0x46b2('0x44')],{})['then'](respondWithResult(_0xfc1f94,0xc9))['catch'](handleError(_0xfc1f94,null));};exports['update']=function(_0x44d74f,_0x1797ff){if(_0x44d74f[_0x46b2('0x44')]['id']){delete _0x44d74f[_0x46b2('0x44')]['id'];}return db[_0x46b2('0x26')][_0x46b2('0x41')]({'where':{'id':_0x44d74f[_0x46b2('0x40')]['id']}})[_0x46b2('0x20')](handleEntityNotFound(_0x1797ff,null))[_0x46b2('0x20')](saveUpdates(_0x44d74f['body'],null))[_0x46b2('0x20')](respondWithResult(_0x1797ff,null))[_0x46b2('0x42')](handleError(_0x1797ff,null));};exports['destroy']=function(_0x3e4ffd,_0x1d8a69){return db[_0x46b2('0x26')][_0x46b2('0x41')]({'where':{'id':_0x3e4ffd['params']['id']}})[_0x46b2('0x20')](handleEntityNotFound(_0x1d8a69,null))[_0x46b2('0x20')](removeEntity(_0x1d8a69,null))[_0x46b2('0x42')](handleError(_0x1d8a69,null));}; \ No newline at end of file +var _0xaa92=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','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','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','index','map','FreshsalesField','rawAttributes','fieldName','type','key','name','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x4faf29,_0x19b217){var _0x435100=function(_0x138308){while(--_0x138308){_0x4faf29['push'](_0x4faf29['shift']());}};_0x435100(++_0x19b217);}(_0xaa92,0x9d));var _0x2aa9=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0xaa92[_0x1857c6];return _0x51011c;};'use strict';var emlformat=require(_0x2aa9('0x0'));var rimraf=require(_0x2aa9('0x1'));var zipdir=require(_0x2aa9('0x2'));var jsonpatch=require(_0x2aa9('0x3'));var rp=require(_0x2aa9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2aa9('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2aa9('0x6'));var csv=require(_0x2aa9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2aa9('0x8'));var crypto=require(_0x2aa9('0x9'));var jsforce=require(_0x2aa9('0xa'));var deskjs=require(_0x2aa9('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2aa9('0xc'));var authService=require(_0x2aa9('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x2aa9('0xe'));var hardwareService=require(_0x2aa9('0xf'));var logger=require(_0x2aa9('0x10'))(_0x2aa9('0x11'));var utils=require(_0x2aa9('0x12'));var config=require(_0x2aa9('0x13'));var licenseUtil=require(_0x2aa9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51fc84,_0x2a66ed){_0x2a66ed=_0x2a66ed||0xcc;return function(_0x55d1cd){if(_0x55d1cd){return _0x51fc84[_0x2aa9('0x15')](_0x2a66ed);}return _0x51fc84[_0x2aa9('0x16')](_0x2a66ed)['end']();};}function respondWithResult(_0x39f6ee,_0xd392c8){_0xd392c8=_0xd392c8||0xc8;return function(_0x2f7708){if(_0x2f7708){return _0x39f6ee[_0x2aa9('0x16')](_0xd392c8)[_0x2aa9('0x17')](_0x2f7708);}};}function respondWithFilteredResult(_0x3e5af4,_0x31838b){return function(_0x16f2bd){if(_0x16f2bd){var _0x1e6e17=typeof _0x31838b[_0x2aa9('0x18')]===_0x2aa9('0x19')&&typeof _0x31838b[_0x2aa9('0x1a')]===_0x2aa9('0x19');var _0x148db3=_0x16f2bd[_0x2aa9('0x1b')];var _0x1bbbf5=_0x1e6e17?0x0:_0x31838b[_0x2aa9('0x18')];var _0x50e012=_0x1e6e17?_0x16f2bd['count']:_0x31838b[_0x2aa9('0x18')]+_0x31838b['limit'];var _0x2c14da;if(_0x50e012>=_0x148db3){_0x50e012=_0x148db3;_0x2c14da=0xc8;}else{_0x2c14da=0xce;}_0x3e5af4[_0x2aa9('0x16')](_0x2c14da);return _0x3e5af4[_0x2aa9('0x1c')](_0x2aa9('0x1d'),_0x1bbbf5+'-'+_0x50e012+'/'+_0x148db3)[_0x2aa9('0x17')](_0x16f2bd);}return null;};}function patchUpdates(_0x781dfb){return function(_0x381cbe){try{jsonpatch[_0x2aa9('0x1e')](_0x381cbe,_0x781dfb,!![]);}catch(_0x5656b4){return BPromise[_0x2aa9('0x1f')](_0x5656b4);}return _0x381cbe[_0x2aa9('0x20')]();};}function saveUpdates(_0x25fb24,_0x1a4e69){return function(_0x3b7110){if(_0x3b7110){return _0x3b7110[_0x2aa9('0x21')](_0x25fb24)[_0x2aa9('0x22')](function(_0x342b16){return _0x342b16;});}return null;};}function removeEntity(_0x19abfd,_0x40e888){return function(_0xebf93f){if(_0xebf93f){return _0xebf93f[_0x2aa9('0x23')]()[_0x2aa9('0x22')](function(){_0x19abfd[_0x2aa9('0x16')](0xcc)[_0x2aa9('0x24')]();});}};}function handleEntityNotFound(_0x401ab1,_0x4807f2){return function(_0x16bf94){if(!_0x16bf94){_0x401ab1[_0x2aa9('0x15')](0x194);}return _0x16bf94;};}function handleError(_0xa507d5,_0x108f37){_0x108f37=_0x108f37||0x1f4;return function(_0x46fbec){logger[_0x2aa9('0x25')](_0x46fbec['stack']);if(_0x46fbec['name']){delete _0x46fbec['name'];}_0xa507d5['status'](_0x108f37)['send'](_0x46fbec);};}exports[_0x2aa9('0x26')]=function(_0x153f41,_0x5b08ac){var _0x3a7419={},_0x48b2db={},_0x5591d6={'count':0x0,'rows':[]};var _0x262bfd=_[_0x2aa9('0x27')](db[_0x2aa9('0x28')][_0x2aa9('0x29')],function(_0x24ceed){return{'name':_0x24ceed[_0x2aa9('0x2a')],'type':_0x24ceed[_0x2aa9('0x2b')][_0x2aa9('0x2c')]};});_0x48b2db['model']=_[_0x2aa9('0x27')](_0x262bfd,_0x2aa9('0x2d'));_0x48b2db['query']=_[_0x2aa9('0x2e')](_0x153f41[_0x2aa9('0x2f')]);_0x48b2db[_0x2aa9('0x30')]=_['intersection'](_0x48b2db[_0x2aa9('0x31')],_0x48b2db[_0x2aa9('0x2f')]);_0x3a7419[_0x2aa9('0x32')]=_[_0x2aa9('0x33')](_0x48b2db[_0x2aa9('0x31')],qs[_0x2aa9('0x34')](_0x153f41[_0x2aa9('0x2f')]['fields']));_0x3a7419['attributes']=_0x3a7419[_0x2aa9('0x32')][_0x2aa9('0x35')]?_0x3a7419['attributes']:_0x48b2db[_0x2aa9('0x31')];if(!_0x153f41['query'][_0x2aa9('0x36')](_0x2aa9('0x37'))){_0x3a7419[_0x2aa9('0x1a')]=qs[_0x2aa9('0x1a')](_0x153f41[_0x2aa9('0x2f')][_0x2aa9('0x1a')]);_0x3a7419[_0x2aa9('0x18')]=qs[_0x2aa9('0x18')](_0x153f41['query'][_0x2aa9('0x18')]);}_0x3a7419[_0x2aa9('0x38')]=qs[_0x2aa9('0x39')](_0x153f41['query'][_0x2aa9('0x39')]);_0x3a7419[_0x2aa9('0x3a')]=qs[_0x2aa9('0x30')](_[_0x2aa9('0x3b')](_0x153f41[_0x2aa9('0x2f')],_0x48b2db[_0x2aa9('0x30')]),_0x262bfd);if(_0x153f41[_0x2aa9('0x2f')][_0x2aa9('0x3c')]){_0x3a7419[_0x2aa9('0x3a')]=_[_0x2aa9('0x3d')](_0x3a7419[_0x2aa9('0x3a')],{'$or':_[_0x2aa9('0x27')](_0x262bfd,function(_0x2f207e){if(_0x2f207e['type']!==_0x2aa9('0x3e')){var _0x1f31a3={};_0x1f31a3[_0x2f207e[_0x2aa9('0x2d')]]={'$like':'%'+_0x153f41[_0x2aa9('0x2f')][_0x2aa9('0x3c')]+'%'};return _0x1f31a3;}})});}_0x3a7419=_[_0x2aa9('0x3d')]({},_0x3a7419,_0x153f41[_0x2aa9('0x3f')]);var _0x531112={'where':_0x3a7419[_0x2aa9('0x3a')]};return db[_0x2aa9('0x28')][_0x2aa9('0x1b')](_0x531112)[_0x2aa9('0x22')](function(_0x174d3c){_0x5591d6['count']=_0x174d3c;if(_0x153f41['query'][_0x2aa9('0x40')]){_0x3a7419['include']=[{'all':!![]}];}return db[_0x2aa9('0x28')]['findAll'](_0x3a7419);})[_0x2aa9('0x22')](function(_0xa27793){_0x5591d6[_0x2aa9('0x41')]=_0xa27793;return _0x5591d6;})[_0x2aa9('0x22')](respondWithFilteredResult(_0x5b08ac,_0x3a7419))['catch'](handleError(_0x5b08ac,null));};exports[_0x2aa9('0x42')]=function(_0x46f593,_0x49f306){var _0x1c5d9e={'raw':!![],'where':{'id':_0x46f593[_0x2aa9('0x43')]['id']}},_0x298714={};_0x298714[_0x2aa9('0x31')]=_[_0x2aa9('0x2e')](db[_0x2aa9('0x28')][_0x2aa9('0x29')]);_0x298714['query']=_[_0x2aa9('0x2e')](_0x46f593[_0x2aa9('0x2f')]);_0x298714[_0x2aa9('0x30')]=_['intersection'](_0x298714['model'],_0x298714[_0x2aa9('0x2f')]);_0x1c5d9e[_0x2aa9('0x32')]=_[_0x2aa9('0x33')](_0x298714[_0x2aa9('0x31')],qs[_0x2aa9('0x34')](_0x46f593[_0x2aa9('0x2f')][_0x2aa9('0x34')]));_0x1c5d9e['attributes']=_0x1c5d9e[_0x2aa9('0x32')][_0x2aa9('0x35')]?_0x1c5d9e[_0x2aa9('0x32')]:_0x298714[_0x2aa9('0x31')];if(_0x46f593['query']['includeAll']){_0x1c5d9e['include']=[{'all':!![]}];}_0x1c5d9e=_[_0x2aa9('0x3d')]({},_0x1c5d9e,_0x46f593[_0x2aa9('0x3f')]);return db[_0x2aa9('0x28')]['find'](_0x1c5d9e)[_0x2aa9('0x22')](handleEntityNotFound(_0x49f306,null))['then'](respondWithResult(_0x49f306,null))[_0x2aa9('0x44')](handleError(_0x49f306,null));};exports[_0x2aa9('0x45')]=function(_0x17dd44,_0x5c71ae){return db['FreshsalesField'][_0x2aa9('0x45')](_0x17dd44['body'],{})[_0x2aa9('0x22')](respondWithResult(_0x5c71ae,0xc9))['catch'](handleError(_0x5c71ae,null));};exports['update']=function(_0x5a54bc,_0x5406dc){if(_0x5a54bc['body']['id']){delete _0x5a54bc[_0x2aa9('0x46')]['id'];}return db[_0x2aa9('0x28')]['find']({'where':{'id':_0x5a54bc[_0x2aa9('0x43')]['id']}})[_0x2aa9('0x22')](handleEntityNotFound(_0x5406dc,null))[_0x2aa9('0x22')](saveUpdates(_0x5a54bc['body'],null))[_0x2aa9('0x22')](respondWithResult(_0x5406dc,null))['catch'](handleError(_0x5406dc,null));};exports[_0x2aa9('0x23')]=function(_0x31c4f6,_0x544191){return db[_0x2aa9('0x28')]['find']({'where':{'id':_0x31c4f6[_0x2aa9('0x43')]['id']}})[_0x2aa9('0x22')](handleEntityNotFound(_0x544191,null))[_0x2aa9('0x22')](removeEntity(_0x544191,null))[_0x2aa9('0x44')](handleError(_0x544191,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 322a663..a67b79d 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 _0xdeb3=['FieldId','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdeb3,0xb7));var _0x3deb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdeb3[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var logger=require(_0x3deb('0x1'))(_0x3deb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3deb('0x3'));var fs=require('fs');var path=require(_0x3deb('0x4'));var rimraf=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var attributes=require(_0x3deb('0x7'));module['exports']=function(_0x193700,_0x47d2d4){return _0x193700[_0x3deb('0x8')]('FreshsalesField',attributes,{'tableName':_0x3deb('0x9'),'paranoid':![],'indexes':[{'name':_0x3deb('0xa'),'fields':[_0x3deb('0xb'),_0x3deb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x349e=['path','rimraf','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0x349e,0xcb));var _0xe349=function(_0x4e82a2,_0x4a577b){_0x4e82a2=_0x4e82a2-0x0;var _0x15b166=_0x349e[_0x4e82a2];return _0x15b166;};'use strict';var _=require(_0xe349('0x0'));var util=require(_0xe349('0x1'));var logger=require(_0xe349('0x2'))(_0xe349('0x3'));var moment=require(_0xe349('0x4'));var BPromise=require(_0xe349('0x5'));var rp=require(_0xe349('0x6'));var fs=require('fs');var path=require(_0xe349('0x7'));var rimraf=require(_0xe349('0x8'));var config=require('../../config/environment');var attributes=require(_0xe349('0x9'));module['exports']=function(_0x55aae6,_0xb21068){return _0x55aae6['define'](_0xe349('0xa'),attributes,{'tableName':_0xe349('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xe349('0xc'),_0xe349('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 7bf702d..764f5a2 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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x26cae5,_0x1dce79){var _0x294db7=function(_0x4c7d0b){while(--_0x4c7d0b){_0x26cae5['push'](_0x26cae5['shift']());}};_0x294db7(++_0x1dce79);}(_0xba34,0x119));var _0x4ba3=function(_0x1cc1de,_0x956593){_0x1cc1de=_0x1cc1de-0x0;var _0x3ca7fe=_0xba34[_0x1cc1de];return _0x3ca7fe;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x1205e4,_0x237372){var _0x1ece0a=function(_0x2f688c){while(--_0x2f688c){_0x1205e4['push'](_0x1205e4['shift']());}};_0x1ece0a(++_0x237372);}(_0xba34,0x119));var _0x4ba3=function(_0x737326,_0x41620e){_0x737326=_0x737326-0x0;var _0x1b301f=_0xba34[_0x737326];return _0x1b301f;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0cd7489..b7d9f3d 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(_0x5a1a69,_0xa479b5){var _0x404ea1=function(_0x5bd8a0){while(--_0x5bd8a0){_0x5a1a69['push'](_0x5a1a69['shift']());}};_0x404ea1(++_0xa479b5);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x2bfbc7,_0x6275a2){var _0x2c2c27=function(_0x19c749){while(--_0x19c749){_0x2bfbc7['push'](_0x2bfbc7['shift']());}};_0x2c2c27(++_0x6275a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 11e54d3..cb00c05 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 _0x44c2=['integrationTab','sequelize','exports','STRING','username'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x44c2,0x100));var _0x244c=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0x44c2[_0x5bb4e8];return _0x2a86f2;};'use strict';var Sequelize=require(_0x244c('0x0'));module[_0x244c('0x1')]={'name':{'type':Sequelize[_0x244c('0x2')]},'description':{'type':Sequelize[_0x244c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x244c('0x3')},'remoteUri':{'type':Sequelize[_0x244c('0x2')]},'password':{'type':Sequelize[_0x244c('0x2')]},'clientId':{'type':Sequelize[_0x244c('0x2')]},'clientSecret':{'type':Sequelize[_0x244c('0x2')]},'securityToken':{'type':Sequelize[_0x244c('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x244c('0x4'),'newTab'),'defaultValue':_0x244c('0x4')}}; \ No newline at end of file +var _0x86c0=['newTab','sequelize','STRING','username','ENUM','integrationTab'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x86c0,0x133));var _0x086c=function(_0x3a0e2d,_0x1a9695){_0x3a0e2d=_0x3a0e2d-0x0;var _0x2980b8=_0x86c0[_0x3a0e2d];return _0x2980b8;};'use strict';var Sequelize=require(_0x086c('0x0'));module['exports']={'name':{'type':Sequelize[_0x086c('0x1')]},'description':{'type':Sequelize[_0x086c('0x1')]},'username':{'type':Sequelize[_0x086c('0x1')],'unique':_0x086c('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x086c('0x1')]},'clientId':{'type':Sequelize[_0x086c('0x1')]},'clientSecret':{'type':Sequelize[_0x086c('0x1')]},'securityToken':{'type':Sequelize[_0x086c('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x086c('0x3')](_0x086c('0x4'),_0x086c('0x5')),'defaultValue':_0x086c('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2182026..7d867c0 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 _0x446d=['undefined','count','status','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','getConfigurations','findOne','keys','SalesforceConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','lastIndexOf','Connection','login','username','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','picklistValues','label','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset'];(function(_0x603816,_0x36c7df){var _0x4d5f6a=function(_0x14b33f){while(--_0x14b33f){_0x603816['push'](_0x603816['shift']());}};_0x4d5f6a(++_0x36c7df);}(_0x446d,0xe5));var _0xd446=function(_0x22f963,_0x4bb343){_0x22f963=_0x22f963-0x0;var _0x3ef3ee=_0x446d[_0x22f963];return _0x3ef3ee;};'use strict';var emlformat=require(_0xd446('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd446('0x1'));var jsonpatch=require(_0xd446('0x2'));var rp=require(_0xd446('0x3'));var moment=require(_0xd446('0x4'));var BPromise=require(_0xd446('0x5'));var Mustache=require(_0xd446('0x6'));var util=require(_0xd446('0x7'));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(_0xd446('0x8'));var squel=require('squel');var crypto=require(_0xd446('0x9'));var jsforce=require(_0xd446('0xa'));var deskjs=require(_0xd446('0xb'));var toCsv=require(_0xd446('0xc'));var querystring=require(_0xd446('0xd'));var Papa=require(_0xd446('0xe'));var Redis=require('ioredis');var authService=require(_0xd446('0xf'));var qs=require(_0xd446('0x10'));var as=require(_0xd446('0x11'));var hardwareService=require(_0xd446('0x12'));var logger=require('../../config/logger')(_0xd446('0x13'));var utils=require(_0xd446('0x14'));var config=require(_0xd446('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd446('0x16'))['db'];var integrations=require(_0xd446('0x17'));function respondWithStatusCode(_0x526cfc,_0x2e390c){_0x2e390c=_0x2e390c||0xcc;return function(_0x574481){if(_0x574481){return _0x526cfc[_0xd446('0x18')](_0x2e390c);}return _0x526cfc['status'](_0x2e390c)['end']();};}function respondWithResult(_0x291049,_0xb98cb0){_0xb98cb0=_0xb98cb0||0xc8;return function(_0x441e99){if(_0x441e99){return _0x291049['status'](_0xb98cb0)[_0xd446('0x19')](_0x441e99);}};}function respondWithFilteredResult(_0x5b96e4,_0x4c6225){return function(_0xf8d129){if(_0xf8d129){var _0x3d7dbc=typeof _0x4c6225[_0xd446('0x1a')]===_0xd446('0x1b')&&typeof _0x4c6225['limit']===_0xd446('0x1b');var _0x297ebc=_0xf8d129['count'];var _0x1b6db3=_0x3d7dbc?0x0:_0x4c6225[_0xd446('0x1a')];var _0x5af30a=_0x3d7dbc?_0xf8d129[_0xd446('0x1c')]:_0x4c6225[_0xd446('0x1a')]+_0x4c6225['limit'];var _0x2287c5;if(_0x5af30a>=_0x297ebc){_0x5af30a=_0x297ebc;_0x2287c5=0xc8;}else{_0x2287c5=0xce;}_0x5b96e4[_0xd446('0x1d')](_0x2287c5);return _0x5b96e4['set'](_0xd446('0x1e'),_0x1b6db3+'-'+_0x5af30a+'/'+_0x297ebc)['json'](_0xf8d129);}return null;};}function patchUpdates(_0x1fb7c3){return function(_0x565db9){try{jsonpatch[_0xd446('0x1f')](_0x565db9,_0x1fb7c3,!![]);}catch(_0x5449c6){return BPromise['reject'](_0x5449c6);}return _0x565db9[_0xd446('0x20')]();};}function saveUpdates(_0x5bed51,_0x41e3e5){return function(_0x446c0b){if(_0x446c0b){return _0x446c0b['update'](_0x5bed51)[_0xd446('0x21')](function(_0x3bcee2){return _0x3bcee2;});}return null;};}function removeEntity(_0x3d2c02,_0x33847a){return function(_0x5945d6){if(_0x5945d6){return _0x5945d6[_0xd446('0x22')]()['then'](function(){_0x3d2c02[_0xd446('0x1d')](0xcc)[_0xd446('0x23')]();});}};}function handleEntityNotFound(_0x5549d5,_0x510282){return function(_0x46630b){if(!_0x46630b){_0x5549d5[_0xd446('0x18')](0x194);}return _0x46630b;};}function handleError(_0x197390,_0x26132c){_0x26132c=_0x26132c||0x1f4;return function(_0x4beb5f){logger[_0xd446('0x24')](_0x4beb5f[_0xd446('0x25')]);if(_0x4beb5f['name']){delete _0x4beb5f[_0xd446('0x26')];}_0x197390[_0xd446('0x1d')](_0x26132c)[_0xd446('0x27')](_0x4beb5f);};}exports[_0xd446('0x28')]=function(_0x717454,_0x57753a){var _0x89d756={},_0x48f3d7={},_0x5d048c={'count':0x0,'rows':[]};var _0x354ea4=_['map'](db[_0xd446('0x29')][_0xd446('0x2a')],function(_0x19e0f8){return{'name':_0x19e0f8[_0xd446('0x2b')],'type':_0x19e0f8[_0xd446('0x2c')][_0xd446('0x2d')]};});_0x48f3d7[_0xd446('0x2e')]=_[_0xd446('0x2f')](_0x354ea4,_0xd446('0x26'));_0x48f3d7['query']=_['keys'](_0x717454[_0xd446('0x30')]);_0x48f3d7[_0xd446('0x31')]=_[_0xd446('0x32')](_0x48f3d7[_0xd446('0x2e')],_0x48f3d7['query']);_0x89d756['attributes']=_[_0xd446('0x32')](_0x48f3d7['model'],qs[_0xd446('0x33')](_0x717454[_0xd446('0x30')]['fields']));_0x89d756[_0xd446('0x34')]=_0x89d756[_0xd446('0x34')][_0xd446('0x35')]?_0x89d756[_0xd446('0x34')]:_0x48f3d7['model'];if(!_0x717454[_0xd446('0x30')][_0xd446('0x36')](_0xd446('0x37'))){_0x89d756[_0xd446('0x38')]=qs['limit'](_0x717454[_0xd446('0x30')][_0xd446('0x38')]);_0x89d756[_0xd446('0x1a')]=qs[_0xd446('0x1a')](_0x717454['query'][_0xd446('0x1a')]);}_0x89d756[_0xd446('0x39')]=qs[_0xd446('0x3a')](_0x717454[_0xd446('0x30')]['sort']);_0x89d756[_0xd446('0x3b')]=qs[_0xd446('0x31')](_['pick'](_0x717454[_0xd446('0x30')],_0x48f3d7[_0xd446('0x31')]),_0x354ea4);if(_0x717454[_0xd446('0x30')][_0xd446('0x3c')]){_0x89d756[_0xd446('0x3b')]=_[_0xd446('0x3d')](_0x89d756[_0xd446('0x3b')],{'$or':_['map'](_0x354ea4,function(_0x456a9e){if(_0x456a9e[_0xd446('0x2c')]!==_0xd446('0x3e')){var _0x1c99ce={};_0x1c99ce[_0x456a9e[_0xd446('0x26')]]={'$like':'%'+_0x717454['query'][_0xd446('0x3c')]+'%'};return _0x1c99ce;}})});}_0x89d756=_['merge']({},_0x89d756,_0x717454['options']);var _0x8fae78={'where':_0x89d756[_0xd446('0x3b')]};return db[_0xd446('0x29')][_0xd446('0x1c')](_0x8fae78)['then'](function(_0x1af5c7){_0x5d048c[_0xd446('0x1c')]=_0x1af5c7;if(_0x717454[_0xd446('0x30')][_0xd446('0x3f')]){_0x89d756[_0xd446('0x40')]=[{'all':!![]}];}return db[_0xd446('0x29')][_0xd446('0x41')](_0x89d756);})[_0xd446('0x21')](function(_0x54c85c){_0x5d048c[_0xd446('0x42')]=_0x54c85c;return _0x5d048c;})[_0xd446('0x21')](respondWithFilteredResult(_0x57753a,_0x89d756))[_0xd446('0x43')](handleError(_0x57753a,null));};exports[_0xd446('0x44')]=function(_0x26f836,_0x5125de){var _0x2d1941={'raw':![],'where':{'id':_0x26f836[_0xd446('0x45')]['id']}},_0x20330f={};_0x20330f[_0xd446('0x2e')]=_['keys'](db[_0xd446('0x29')]['rawAttributes']);_0x20330f['query']=_['keys'](_0x26f836[_0xd446('0x30')]);_0x20330f[_0xd446('0x31')]=_[_0xd446('0x32')](_0x20330f[_0xd446('0x2e')],_0x20330f[_0xd446('0x30')]);_0x2d1941[_0xd446('0x34')]=_[_0xd446('0x32')](_0x20330f[_0xd446('0x2e')],qs[_0xd446('0x33')](_0x26f836[_0xd446('0x30')][_0xd446('0x33')]));_0x2d1941[_0xd446('0x34')]=_0x2d1941[_0xd446('0x34')][_0xd446('0x35')]?_0x2d1941[_0xd446('0x34')]:_0x20330f[_0xd446('0x2e')];if(_0x26f836['query'][_0xd446('0x3f')]){_0x2d1941[_0xd446('0x40')]=[{'all':!![]}];}_0x2d1941=_[_0xd446('0x3d')]({},_0x2d1941,_0x26f836[_0xd446('0x46')]);return db[_0xd446('0x29')][_0xd446('0x47')](_0x2d1941)['then'](handleEntityNotFound(_0x5125de,null))[_0xd446('0x21')](respondWithResult(_0x5125de,null))[_0xd446('0x43')](handleError(_0x5125de,null));};exports[_0xd446('0x48')]=function(_0x4785aa,_0x5b539c){return db[_0xd446('0x29')][_0xd446('0x48')](_0x4785aa[_0xd446('0x49')],{})[_0xd446('0x21')](respondWithResult(_0x5b539c,0xc9))[_0xd446('0x43')](handleError(_0x5b539c,null));};exports[_0xd446('0x4a')]=function(_0x54b767,_0x5b1153){if(_0x54b767['body']['id']){delete _0x54b767[_0xd446('0x49')]['id'];}return db[_0xd446('0x29')][_0xd446('0x47')]({'where':{'id':_0x54b767[_0xd446('0x45')]['id']}})[_0xd446('0x21')](handleEntityNotFound(_0x5b1153,null))['then'](saveUpdates(_0x54b767['body'],null))[_0xd446('0x21')](respondWithResult(_0x5b1153,null))[_0xd446('0x43')](handleError(_0x5b1153,null));};exports[_0xd446('0x22')]=function(_0x4301dd,_0x475411){return db['SalesforceAccount'][_0xd446('0x47')]({'where':{'id':_0x4301dd[_0xd446('0x45')]['id']}})[_0xd446('0x21')](handleEntityNotFound(_0x475411,null))[_0xd446('0x21')](removeEntity(_0x475411,null))[_0xd446('0x43')](handleError(_0x475411,null));};exports[_0xd446('0x4b')]=function(_0x1c7e53,_0x3bb361,_0x31c4ca){var _0x31d7fc={};var _0xee2a6a={};var _0x9d867a;var _0x3477a1;return db[_0xd446('0x29')][_0xd446('0x4c')]({'where':{'id':_0x1c7e53['params']['id']}})[_0xd446('0x21')](handleEntityNotFound(_0x3bb361,null))[_0xd446('0x21')](function(_0x554d46){if(_0x554d46){_0x9d867a=_0x554d46;_0xee2a6a[_0xd446('0x2e')]=_[_0xd446('0x4d')](db[_0xd446('0x4e')]['rawAttributes']);_0xee2a6a['query']=_['keys'](_0x1c7e53[_0xd446('0x30')]);_0xee2a6a['filters']=_['intersection'](_0xee2a6a[_0xd446('0x2e')],_0xee2a6a['query']);_0x31d7fc['attributes']=_['intersection'](_0xee2a6a[_0xd446('0x2e')],qs[_0xd446('0x33')](_0x1c7e53[_0xd446('0x30')][_0xd446('0x33')]));_0x31d7fc[_0xd446('0x34')]=_0x31d7fc[_0xd446('0x34')]['length']?_0x31d7fc['attributes']:_0xee2a6a[_0xd446('0x2e')];_0x31d7fc[_0xd446('0x39')]=qs[_0xd446('0x3a')](_0x1c7e53[_0xd446('0x30')][_0xd446('0x3a')]);_0x31d7fc[_0xd446('0x3b')]=qs['filters'](_[_0xd446('0x4f')](_0x1c7e53[_0xd446('0x30')],_0xee2a6a[_0xd446('0x31')]));if(_0x1c7e53['query'][_0xd446('0x3c')]){_0x31d7fc['where']=_[_0xd446('0x3d')](_0x31d7fc[_0xd446('0x3b')],{'$or':_[_0xd446('0x2f')](_0x31d7fc[_0xd446('0x34')],function(_0x3cf1ad){var _0x3e52d1={};_0x3e52d1[_0x3cf1ad]={'$like':'%'+_0x1c7e53[_0xd446('0x30')]['filter']+'%'};return _0x3e52d1;})});}_0x31d7fc=_[_0xd446('0x3d')]({},_0x31d7fc,_0x1c7e53[_0xd446('0x46')]);return _0x9d867a[_0xd446('0x4b')](_0x31d7fc);}})[_0xd446('0x21')](function(_0x2c3a88){if(_0x2c3a88){_0x3477a1=_0x2c3a88[_0xd446('0x35')];if(!_0x1c7e53[_0xd446('0x30')][_0xd446('0x36')](_0xd446('0x37'))){_0x31d7fc[_0xd446('0x38')]=qs[_0xd446('0x38')](_0x1c7e53[_0xd446('0x30')]['limit']);_0x31d7fc[_0xd446('0x1a')]=qs[_0xd446('0x1a')](_0x1c7e53['query'][_0xd446('0x1a')]);}return _0x9d867a[_0xd446('0x4b')](_0x31d7fc);}})[_0xd446('0x21')](function(_0x57d6fc){if(_0x57d6fc){return _0x57d6fc?{'count':_0x3477a1,'rows':_0x57d6fc}:null;}})[_0xd446('0x21')](respondWithResult(_0x3bb361,null))['catch'](handleError(_0x3bb361,null));};exports[_0xd446('0x50')]=function(_0x1a7838,_0x47aa49,_0x1fbc64){if(_0x1a7838[_0xd446('0x49')]['id']){delete _0x1a7838['body']['id'];}return db[_0xd446('0x29')]['findOne']({'where':{'id':_0x1a7838[_0xd446('0x45')]['id']}})[_0xd446('0x21')](handleEntityNotFound(_0x47aa49,null))[_0xd446('0x21')](function(_0xba7b6b){if(_0xba7b6b){_0x1a7838[_0xd446('0x49')][_0xd446('0x51')]=_0xba7b6b['id'];_0x1a7838[_0xd446('0x49')][_0xd446('0x52')]=integrations[_0xd446('0x53')](_0x1a7838['body'][_0xd446('0x54')],_0x1a7838[_0xd446('0x49')]['type']);_0x1a7838[_0xd446('0x49')][_0xd446('0x55')]=integrations[_0xd446('0x56')](_0x1a7838['body'][_0xd446('0x54')],_0x1a7838[_0xd446('0x49')][_0xd446('0x2c')]);return db[_0xd446('0x4e')][_0xd446('0x48')](_0x1a7838['body'],{'include':[{'model':db[_0xd446('0x57')],'as':_0xd446('0x52')},{'model':db['SalesforceField'],'as':_0xd446('0x55')}]});}return null;})[_0xd446('0x21')](respondWithResult(_0x47aa49,null))[_0xd446('0x43')](handleError(_0x47aa49,null));};exports[_0xd446('0x58')]=function(_0x198a3c,_0x1ab56a,_0x5c0279){var _0x51b9a3;var _0x325b75='';var _0x463b77=_0xd446('0x59');return db[_0xd446('0x29')]['findOne']({'where':{'id':_0x198a3c[_0xd446('0x45')]['id']},'attributes':['id',_0xd446('0x5a'),_0xd446('0x5b'),_0xd446('0x5c'),'username',_0xd446('0x5d'),_0xd446('0x5e')]})['then'](handleEntityNotFound(_0x1ab56a,null))[_0xd446('0x21')](function(_0x3f870b){if(_0x3f870b){_0x325b75=_0x3f870b[_0xd446('0x5a')];var _0x39ed64=_0x325b75[_0xd446('0x5f')](-0x1);if(_0x39ed64==='/'){_0x325b75=_0x325b75['substring'](0x0,_0x325b75[_0xd446('0x60')](_0x39ed64));}_0x51b9a3=new jsforce[(_0xd446('0x61'))]({'oauth2':{'loginUrl':_0x325b75,'clientId':_0x3f870b[_0xd446('0x5b')],'clientSecret':_0x3f870b[_0xd446('0x5c')]}});return _0x51b9a3[_0xd446('0x62')](_0x3f870b[_0xd446('0x63')],_0x3f870b[_0xd446('0x5d')]['concat'](_0x3f870b['securityToken']));}})[_0xd446('0x21')](function(_0x5b64e4){if(_0x5b64e4){if(!_[_0xd446('0x64')](_0x198a3c['query'][_0xd446('0x65')])){_0x463b77=_0x198a3c[_0xd446('0x30')][_0xd446('0x65')];}return _0x51b9a3[_0xd446('0x66')](_0x463b77)[_0xd446('0x67')]();}})[_0xd446('0x21')](function(_0x48a65a){var _0x54eb54=[_0xd446('0x68'),_0xd446('0x69'),'IsReminderSet','IsRecurrence',_0xd446('0x6a'),_0xd446('0x6b')];var _0x51e5d1=[_0xd446('0x6c'),_0xd446('0x6d'),_0xd446('0x6e'),_0xd446('0x6f'),_0xd446('0x70'),_0xd446('0x71'),_0xd446('0x72')];if(_0x48a65a){_[_0xd446('0x73')](_0x48a65a['fields'],function(_0x12b366){return _0x54eb54['includes'](_0x12b366['name'])||!_0x51e5d1[_0xd446('0x74')](_0x12b366[_0xd446('0x2c')]);});return{'count':_0x48a65a[_0xd446('0x33')][_0xd446('0x35')],'rows':_['map'](_0x48a65a[_0xd446('0x33')],function(_0x2a43b7){return{'id':_0x2a43b7[_0xd446('0x26')],'name':_0x2a43b7['label'],'custom':_0x2a43b7['custom'],'options':_0x2a43b7[_0xd446('0x75')]['length']>0x0?_[_0xd446('0x2f')](_0x2a43b7[_0xd446('0x75')],function(_0x2cdef0){return{'name':_0x2cdef0[_0xd446('0x76')],'value':_0x2cdef0[_0xd446('0x77')]};}):_0x2a43b7[_0xd446('0x2c')]==_0xd446('0x6f')?[{'name':'True','value':_0xd446('0x78')},{'name':_0xd446('0x79'),'value':_0xd446('0x7a')}]:[]};})};}})[_0xd446('0x21')](respondWithResult(_0x1ab56a,null))[_0xd446('0x43')](function(_0x727b35){var _0x57254f=_0x198a3c['query']['test']?0x1f4:_0x727b35[_0xd446('0x7b')]||0x1f4;logger[_0xd446('0x24')](_0xd446('0x7c'),_0xd446('0x58'),_0x57254f,JSON[_0xd446('0x7d')](_0x727b35));delete _0x727b35[_0xd446('0x26')];if(_0x57254f===0x191){_0x57254f=0x190;}_0x1ab56a[_0xd446('0x1d')](_0x57254f)[_0xd446('0x27')](_0x198a3c[_0xd446('0x30')][_0xd446('0x7e')]?{'message':_0xd446('0x7f'),'statusCode':_0x727b35['statusCode']}:_0x727b35);});}; \ No newline at end of file +var _0xddb3=['getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','clientId','clientSecret','securityToken','remoteUri','slice','substring','lastIndexOf','login','username','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','false','test','statusCode','stringify','Wrong\x20credentials','eml-format','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','SalesforceAccount','includeAll','rows','show','find','create','body','catch','params','getConfigurations','options','addConfiguration','findOne','AccountId','Subjects'];(function(_0x4296e7,_0x1473a4){var _0x254724=function(_0x57c691){while(--_0x57c691){_0x4296e7['push'](_0x4296e7['shift']());}};_0x254724(++_0x1473a4);}(_0xddb3,0x1a3));var _0x3ddb=function(_0x40d502,_0x1ba3c3){_0x40d502=_0x40d502-0x0;var _0x2cffb9=_0xddb3[_0x40d502];return _0x2cffb9;};'use strict';var emlformat=require(_0x3ddb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ddb('0x1'));var BPromise=require(_0x3ddb('0x2'));var Mustache=require(_0x3ddb('0x3'));var util=require(_0x3ddb('0x4'));var path=require('path');var sox=require(_0x3ddb('0x5'));var csv=require(_0x3ddb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ddb('0x7'));var _=require(_0x3ddb('0x8'));var squel=require('squel');var crypto=require(_0x3ddb('0x9'));var jsforce=require(_0x3ddb('0xa'));var deskjs=require(_0x3ddb('0xb'));var toCsv=require(_0x3ddb('0x6'));var querystring=require(_0x3ddb('0xc'));var Papa=require('papaparse');var Redis=require(_0x3ddb('0xd'));var authService=require(_0x3ddb('0xe'));var qs=require(_0x3ddb('0xf'));var as=require(_0x3ddb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ddb('0x11'));var utils=require(_0x3ddb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3ddb('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3ddb('0x14'));function respondWithStatusCode(_0x2d4b64,_0x47d7ec){_0x47d7ec=_0x47d7ec||0xcc;return function(_0x1e95a7){if(_0x1e95a7){return _0x2d4b64[_0x3ddb('0x15')](_0x47d7ec);}return _0x2d4b64['status'](_0x47d7ec)['end']();};}function respondWithResult(_0x5f2f8e,_0x4c4d95){_0x4c4d95=_0x4c4d95||0xc8;return function(_0x49f295){if(_0x49f295){return _0x5f2f8e[_0x3ddb('0x16')](_0x4c4d95)[_0x3ddb('0x17')](_0x49f295);}};}function respondWithFilteredResult(_0x497961,_0x1ce1b6){return function(_0x335f2e){if(_0x335f2e){var _0x1a43bb=typeof _0x1ce1b6[_0x3ddb('0x18')]==='undefined'&&typeof _0x1ce1b6['limit']===_0x3ddb('0x19');var _0x29fe49=_0x335f2e[_0x3ddb('0x1a')];var _0x101041=_0x1a43bb?0x0:_0x1ce1b6[_0x3ddb('0x18')];var _0x2a5d81=_0x1a43bb?_0x335f2e[_0x3ddb('0x1a')]:_0x1ce1b6[_0x3ddb('0x18')]+_0x1ce1b6[_0x3ddb('0x1b')];var _0x1fbfdd;if(_0x2a5d81>=_0x29fe49){_0x2a5d81=_0x29fe49;_0x1fbfdd=0xc8;}else{_0x1fbfdd=0xce;}_0x497961[_0x3ddb('0x16')](_0x1fbfdd);return _0x497961[_0x3ddb('0x1c')](_0x3ddb('0x1d'),_0x101041+'-'+_0x2a5d81+'/'+_0x29fe49)[_0x3ddb('0x17')](_0x335f2e);}return null;};}function patchUpdates(_0x10536e){return function(_0x751a7d){try{jsonpatch[_0x3ddb('0x1e')](_0x751a7d,_0x10536e,!![]);}catch(_0x93d82b){return BPromise[_0x3ddb('0x1f')](_0x93d82b);}return _0x751a7d[_0x3ddb('0x20')]();};}function saveUpdates(_0x4534a8,_0x5c5c1e){return function(_0x5622a2){if(_0x5622a2){return _0x5622a2[_0x3ddb('0x21')](_0x4534a8)[_0x3ddb('0x22')](function(_0x3146cb){return _0x3146cb;});}return null;};}function removeEntity(_0x4c207a,_0xe11e63){return function(_0xafb94d){if(_0xafb94d){return _0xafb94d[_0x3ddb('0x23')]()[_0x3ddb('0x22')](function(){_0x4c207a[_0x3ddb('0x16')](0xcc)[_0x3ddb('0x24')]();});}};}function handleEntityNotFound(_0x4f5f60,_0x270d3f){return function(_0x1232d2){if(!_0x1232d2){_0x4f5f60['sendStatus'](0x194);}return _0x1232d2;};}function handleError(_0x1c515b,_0x33a685){_0x33a685=_0x33a685||0x1f4;return function(_0x52f47f){logger[_0x3ddb('0x25')](_0x52f47f[_0x3ddb('0x26')]);if(_0x52f47f[_0x3ddb('0x27')]){delete _0x52f47f[_0x3ddb('0x27')];}_0x1c515b[_0x3ddb('0x16')](_0x33a685)[_0x3ddb('0x28')](_0x52f47f);};}exports[_0x3ddb('0x29')]=function(_0x360cde,_0x4a99bf){var _0xd8d2c3={},_0x25bb69={},_0x395215={'count':0x0,'rows':[]};var _0x5ed42b=_[_0x3ddb('0x2a')](db['SalesforceAccount'][_0x3ddb('0x2b')],function(_0x1b5682){return{'name':_0x1b5682[_0x3ddb('0x2c')],'type':_0x1b5682[_0x3ddb('0x2d')]['key']};});_0x25bb69['model']=_[_0x3ddb('0x2a')](_0x5ed42b,_0x3ddb('0x27'));_0x25bb69[_0x3ddb('0x2e')]=_[_0x3ddb('0x2f')](_0x360cde[_0x3ddb('0x2e')]);_0x25bb69[_0x3ddb('0x30')]=_[_0x3ddb('0x31')](_0x25bb69['model'],_0x25bb69[_0x3ddb('0x2e')]);_0xd8d2c3[_0x3ddb('0x32')]=_['intersection'](_0x25bb69[_0x3ddb('0x33')],qs[_0x3ddb('0x34')](_0x360cde[_0x3ddb('0x2e')][_0x3ddb('0x34')]));_0xd8d2c3[_0x3ddb('0x32')]=_0xd8d2c3[_0x3ddb('0x32')][_0x3ddb('0x35')]?_0xd8d2c3[_0x3ddb('0x32')]:_0x25bb69[_0x3ddb('0x33')];if(!_0x360cde['query'][_0x3ddb('0x36')](_0x3ddb('0x37'))){_0xd8d2c3[_0x3ddb('0x1b')]=qs['limit'](_0x360cde['query'][_0x3ddb('0x1b')]);_0xd8d2c3[_0x3ddb('0x18')]=qs[_0x3ddb('0x18')](_0x360cde[_0x3ddb('0x2e')][_0x3ddb('0x18')]);}_0xd8d2c3[_0x3ddb('0x38')]=qs[_0x3ddb('0x39')](_0x360cde[_0x3ddb('0x2e')][_0x3ddb('0x39')]);_0xd8d2c3[_0x3ddb('0x3a')]=qs[_0x3ddb('0x30')](_[_0x3ddb('0x3b')](_0x360cde[_0x3ddb('0x2e')],_0x25bb69[_0x3ddb('0x30')]),_0x5ed42b);if(_0x360cde[_0x3ddb('0x2e')]['filter']){_0xd8d2c3[_0x3ddb('0x3a')]=_[_0x3ddb('0x3c')](_0xd8d2c3[_0x3ddb('0x3a')],{'$or':_[_0x3ddb('0x2a')](_0x5ed42b,function(_0x5ea127){if(_0x5ea127[_0x3ddb('0x2d')]!=='VIRTUAL'){var _0x83747a={};_0x83747a[_0x5ea127['name']]={'$like':'%'+_0x360cde[_0x3ddb('0x2e')][_0x3ddb('0x3d')]+'%'};return _0x83747a;}})});}_0xd8d2c3=_[_0x3ddb('0x3c')]({},_0xd8d2c3,_0x360cde['options']);var _0x250ae1={'where':_0xd8d2c3[_0x3ddb('0x3a')]};return db[_0x3ddb('0x3e')][_0x3ddb('0x1a')](_0x250ae1)['then'](function(_0x541de0){_0x395215[_0x3ddb('0x1a')]=_0x541de0;if(_0x360cde['query'][_0x3ddb('0x3f')]){_0xd8d2c3['include']=[{'all':!![]}];}return db[_0x3ddb('0x3e')]['findAll'](_0xd8d2c3);})[_0x3ddb('0x22')](function(_0xf39d88){_0x395215[_0x3ddb('0x40')]=_0xf39d88;return _0x395215;})[_0x3ddb('0x22')](respondWithFilteredResult(_0x4a99bf,_0xd8d2c3))['catch'](handleError(_0x4a99bf,null));};exports[_0x3ddb('0x41')]=function(_0x301411,_0x2393f0){var _0x1a4066={'raw':![],'where':{'id':_0x301411['params']['id']}},_0x3e1c26={};_0x3e1c26[_0x3ddb('0x33')]=_[_0x3ddb('0x2f')](db[_0x3ddb('0x3e')][_0x3ddb('0x2b')]);_0x3e1c26[_0x3ddb('0x2e')]=_[_0x3ddb('0x2f')](_0x301411[_0x3ddb('0x2e')]);_0x3e1c26[_0x3ddb('0x30')]=_[_0x3ddb('0x31')](_0x3e1c26['model'],_0x3e1c26[_0x3ddb('0x2e')]);_0x1a4066[_0x3ddb('0x32')]=_[_0x3ddb('0x31')](_0x3e1c26[_0x3ddb('0x33')],qs[_0x3ddb('0x34')](_0x301411[_0x3ddb('0x2e')][_0x3ddb('0x34')]));_0x1a4066['attributes']=_0x1a4066[_0x3ddb('0x32')][_0x3ddb('0x35')]?_0x1a4066[_0x3ddb('0x32')]:_0x3e1c26['model'];if(_0x301411['query'][_0x3ddb('0x3f')]){_0x1a4066['include']=[{'all':!![]}];}_0x1a4066=_[_0x3ddb('0x3c')]({},_0x1a4066,_0x301411['options']);return db[_0x3ddb('0x3e')][_0x3ddb('0x42')](_0x1a4066)[_0x3ddb('0x22')](handleEntityNotFound(_0x2393f0,null))['then'](respondWithResult(_0x2393f0,null))['catch'](handleError(_0x2393f0,null));};exports['create']=function(_0x36c300,_0x109287){return db[_0x3ddb('0x3e')][_0x3ddb('0x43')](_0x36c300[_0x3ddb('0x44')],{})[_0x3ddb('0x22')](respondWithResult(_0x109287,0xc9))[_0x3ddb('0x45')](handleError(_0x109287,null));};exports[_0x3ddb('0x21')]=function(_0x2c34e7,_0x46aced){if(_0x2c34e7[_0x3ddb('0x44')]['id']){delete _0x2c34e7[_0x3ddb('0x44')]['id'];}return db[_0x3ddb('0x3e')]['find']({'where':{'id':_0x2c34e7[_0x3ddb('0x46')]['id']}})[_0x3ddb('0x22')](handleEntityNotFound(_0x46aced,null))[_0x3ddb('0x22')](saveUpdates(_0x2c34e7[_0x3ddb('0x44')],null))[_0x3ddb('0x22')](respondWithResult(_0x46aced,null))[_0x3ddb('0x45')](handleError(_0x46aced,null));};exports[_0x3ddb('0x23')]=function(_0x52adf4,_0x2f3f7d){return db[_0x3ddb('0x3e')][_0x3ddb('0x42')]({'where':{'id':_0x52adf4[_0x3ddb('0x46')]['id']}})[_0x3ddb('0x22')](handleEntityNotFound(_0x2f3f7d,null))[_0x3ddb('0x22')](removeEntity(_0x2f3f7d,null))[_0x3ddb('0x45')](handleError(_0x2f3f7d,null));};exports[_0x3ddb('0x47')]=function(_0x26641d,_0x5523a0,_0x36b0e2){var _0x3332e1={};var _0x3baa68={};var _0x1c3720;var _0x5be001;return db[_0x3ddb('0x3e')]['findOne']({'where':{'id':_0x26641d['params']['id']}})[_0x3ddb('0x22')](handleEntityNotFound(_0x5523a0,null))[_0x3ddb('0x22')](function(_0x4c7ef7){if(_0x4c7ef7){_0x1c3720=_0x4c7ef7;_0x3baa68[_0x3ddb('0x33')]=_[_0x3ddb('0x2f')](db['SalesforceConfiguration']['rawAttributes']);_0x3baa68[_0x3ddb('0x2e')]=_[_0x3ddb('0x2f')](_0x26641d[_0x3ddb('0x2e')]);_0x3baa68[_0x3ddb('0x30')]=_[_0x3ddb('0x31')](_0x3baa68['model'],_0x3baa68['query']);_0x3332e1[_0x3ddb('0x32')]=_[_0x3ddb('0x31')](_0x3baa68[_0x3ddb('0x33')],qs[_0x3ddb('0x34')](_0x26641d[_0x3ddb('0x2e')][_0x3ddb('0x34')]));_0x3332e1[_0x3ddb('0x32')]=_0x3332e1[_0x3ddb('0x32')][_0x3ddb('0x35')]?_0x3332e1[_0x3ddb('0x32')]:_0x3baa68[_0x3ddb('0x33')];_0x3332e1[_0x3ddb('0x38')]=qs['sort'](_0x26641d[_0x3ddb('0x2e')][_0x3ddb('0x39')]);_0x3332e1[_0x3ddb('0x3a')]=qs[_0x3ddb('0x30')](_[_0x3ddb('0x3b')](_0x26641d[_0x3ddb('0x2e')],_0x3baa68[_0x3ddb('0x30')]));if(_0x26641d['query'][_0x3ddb('0x3d')]){_0x3332e1[_0x3ddb('0x3a')]=_['merge'](_0x3332e1[_0x3ddb('0x3a')],{'$or':_[_0x3ddb('0x2a')](_0x3332e1[_0x3ddb('0x32')],function(_0x302538){var _0x48d1fa={};_0x48d1fa[_0x302538]={'$like':'%'+_0x26641d[_0x3ddb('0x2e')][_0x3ddb('0x3d')]+'%'};return _0x48d1fa;})});}_0x3332e1=_[_0x3ddb('0x3c')]({},_0x3332e1,_0x26641d[_0x3ddb('0x48')]);return _0x1c3720[_0x3ddb('0x47')](_0x3332e1);}})[_0x3ddb('0x22')](function(_0x4a4703){if(_0x4a4703){_0x5be001=_0x4a4703['length'];if(!_0x26641d[_0x3ddb('0x2e')][_0x3ddb('0x36')](_0x3ddb('0x37'))){_0x3332e1[_0x3ddb('0x1b')]=qs[_0x3ddb('0x1b')](_0x26641d[_0x3ddb('0x2e')]['limit']);_0x3332e1[_0x3ddb('0x18')]=qs[_0x3ddb('0x18')](_0x26641d[_0x3ddb('0x2e')]['offset']);}return _0x1c3720[_0x3ddb('0x47')](_0x3332e1);}})[_0x3ddb('0x22')](function(_0x2c337c){if(_0x2c337c){return _0x2c337c?{'count':_0x5be001,'rows':_0x2c337c}:null;}})[_0x3ddb('0x22')](respondWithResult(_0x5523a0,null))[_0x3ddb('0x45')](handleError(_0x5523a0,null));};exports[_0x3ddb('0x49')]=function(_0x43e506,_0x2e53b6,_0x2035fb){if(_0x43e506[_0x3ddb('0x44')]['id']){delete _0x43e506[_0x3ddb('0x44')]['id'];}return db[_0x3ddb('0x3e')][_0x3ddb('0x4a')]({'where':{'id':_0x43e506['params']['id']}})[_0x3ddb('0x22')](handleEntityNotFound(_0x2e53b6,null))[_0x3ddb('0x22')](function(_0x15425d){if(_0x15425d){_0x43e506[_0x3ddb('0x44')][_0x3ddb('0x4b')]=_0x15425d['id'];_0x43e506[_0x3ddb('0x44')][_0x3ddb('0x4c')]=integrations[_0x3ddb('0x4d')](_0x43e506['body'][_0x3ddb('0x4e')],_0x43e506['body']['type']);_0x43e506[_0x3ddb('0x44')][_0x3ddb('0x4f')]=integrations[_0x3ddb('0x50')](_0x43e506[_0x3ddb('0x44')][_0x3ddb('0x4e')],_0x43e506[_0x3ddb('0x44')]['type']);return db[_0x3ddb('0x51')]['create'](_0x43e506['body'],{'include':[{'model':db['SalesforceField'],'as':_0x3ddb('0x4c')},{'model':db[_0x3ddb('0x52')],'as':_0x3ddb('0x4f')}]});}return null;})[_0x3ddb('0x22')](respondWithResult(_0x2e53b6,null))[_0x3ddb('0x45')](handleError(_0x2e53b6,null));};exports[_0x3ddb('0x53')]=function(_0x3beebc,_0x575dea,_0xcc61f4){var _0x533059;var _0x5de0b1='';var _0x4fe24f=_0x3ddb('0x54');return db[_0x3ddb('0x3e')][_0x3ddb('0x4a')]({'where':{'id':_0x3beebc[_0x3ddb('0x46')]['id']},'attributes':['id','remoteUri',_0x3ddb('0x55'),_0x3ddb('0x56'),'username','password',_0x3ddb('0x57')]})[_0x3ddb('0x22')](handleEntityNotFound(_0x575dea,null))[_0x3ddb('0x22')](function(_0x26a1fa){if(_0x26a1fa){_0x5de0b1=_0x26a1fa[_0x3ddb('0x58')];var _0x338e74=_0x5de0b1[_0x3ddb('0x59')](-0x1);if(_0x338e74==='/'){_0x5de0b1=_0x5de0b1[_0x3ddb('0x5a')](0x0,_0x5de0b1[_0x3ddb('0x5b')](_0x338e74));}_0x533059=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5de0b1,'clientId':_0x26a1fa[_0x3ddb('0x55')],'clientSecret':_0x26a1fa['clientSecret']}});return _0x533059[_0x3ddb('0x5c')](_0x26a1fa[_0x3ddb('0x5d')],_0x26a1fa[_0x3ddb('0x5e')][_0x3ddb('0x5f')](_0x26a1fa[_0x3ddb('0x57')]));}})[_0x3ddb('0x22')](function(_0xb1f661){if(_0xb1f661){if(!_[_0x3ddb('0x60')](_0x3beebc[_0x3ddb('0x2e')][_0x3ddb('0x61')])){_0x4fe24f=_0x3beebc[_0x3ddb('0x2e')][_0x3ddb('0x61')];}return _0x533059[_0x3ddb('0x62')](_0x4fe24f)[_0x3ddb('0x63')]();}})[_0x3ddb('0x22')](function(_0x5a6ca1){var _0x2ab57f=[_0x3ddb('0x64'),_0x3ddb('0x65'),_0x3ddb('0x66'),_0x3ddb('0x67'),'Subject',_0x3ddb('0x68')];var _0x54f63d=[_0x3ddb('0x69'),_0x3ddb('0x6a'),_0x3ddb('0x6b'),_0x3ddb('0x6c'),_0x3ddb('0x6d'),_0x3ddb('0x6e'),'phone'];if(_0x5a6ca1){_[_0x3ddb('0x6f')](_0x5a6ca1[_0x3ddb('0x34')],function(_0x2cee06){return _0x2ab57f[_0x3ddb('0x70')](_0x2cee06[_0x3ddb('0x27')])||!_0x54f63d[_0x3ddb('0x70')](_0x2cee06[_0x3ddb('0x2d')]);});return{'count':_0x5a6ca1[_0x3ddb('0x34')]['length'],'rows':_[_0x3ddb('0x2a')](_0x5a6ca1[_0x3ddb('0x34')],function(_0x495222){return{'id':_0x495222[_0x3ddb('0x27')],'name':_0x495222[_0x3ddb('0x71')],'custom':_0x495222[_0x3ddb('0x72')],'options':_0x495222[_0x3ddb('0x73')]['length']>0x0?_[_0x3ddb('0x2a')](_0x495222[_0x3ddb('0x73')],function(_0x5dffbd){return{'name':_0x5dffbd['label'],'value':_0x5dffbd[_0x3ddb('0x74')]};}):_0x495222[_0x3ddb('0x2d')]==_0x3ddb('0x6c')?[{'name':_0x3ddb('0x75'),'value':_0x3ddb('0x76')},{'name':'False','value':_0x3ddb('0x77')}]:[]};})};}})['then'](respondWithResult(_0x575dea,null))[_0x3ddb('0x45')](function(_0x345c33){var _0x4ab950=_0x3beebc[_0x3ddb('0x2e')][_0x3ddb('0x78')]?0x1f4:_0x345c33[_0x3ddb('0x79')]||0x1f4;logger[_0x3ddb('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x3ddb('0x53'),_0x4ab950,JSON[_0x3ddb('0x7a')](_0x345c33));delete _0x345c33[_0x3ddb('0x27')];if(_0x4ab950===0x191){_0x4ab950=0x190;}_0x575dea[_0x3ddb('0x16')](_0x4ab950)[_0x3ddb('0x28')](_0x3beebc[_0x3ddb('0x2e')][_0x3ddb('0x78')]?{'message':_0x3ddb('0x7b'),'statusCode':_0x345c33['statusCode']}:_0x345c33);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index fedc314..af5eb3f 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 _0x36f1=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x36f1,0x19f));var _0x136f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36f1[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x136f('0x0'));var util=require(_0x136f('0x1'));var logger=require(_0x136f('0x2'))('api');var moment=require(_0x136f('0x3'));var BPromise=require(_0x136f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));var integrations=require(_0x136f('0x9'));module['exports']=function(_0x11b000,_0x4b9772){return _0x11b000['define'](_0x136f('0xa'),attributes,{'tableName':_0x136f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c57=['../../components/integrations/configuration','define','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x1dca87,_0x2435b3){var _0x521ffa=function(_0x56f0ca){while(--_0x56f0ca){_0x1dca87['push'](_0x1dca87['shift']());}};_0x521ffa(++_0x2435b3);}(_0x1c57,0xf5));var _0x71c5=function(_0x28d4a7,_0x2cd31d){_0x28d4a7=_0x28d4a7-0x0;var _0x7ac70b=_0x1c57[_0x28d4a7];return _0x7ac70b;};'use strict';var _=require(_0x71c5('0x0'));var util=require('util');var logger=require(_0x71c5('0x1'))(_0x71c5('0x2'));var moment=require('moment');var BPromise=require(_0x71c5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c5('0x4'));var rimraf=require(_0x71c5('0x5'));var config=require(_0x71c5('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x71c5('0x7'));module['exports']=function(_0xa0ff77,_0x2d9d78){return _0xa0ff77[_0x71c5('0x8')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 462af4e..e8552db 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 _0x2daa=['SalesforceAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','GetSalesforceAccount','stringify','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3fb247,_0x2eecfc){var _0x588f8b=function(_0x4d818e){while(--_0x4d818e){_0x3fb247['push'](_0x3fb247['shift']());}};_0x588f8b(++_0x2eecfc);}(_0x2daa,0x167));var _0xa2da=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0x2daa[_0x383dbb];return _0x6e8bde;};'use strict';var _=require('lodash');var util=require(_0xa2da('0x0'));var moment=require(_0xa2da('0x1'));var BPromise=require(_0xa2da('0x2'));var rs=require(_0xa2da('0x3'));var fs=require('fs');var Redis=require(_0xa2da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2da('0x5'));var logger=require('../../config/logger')(_0xa2da('0x6'));var config=require('../../config/environment');var jayson=require(_0xa2da('0x7'));var client=jayson['client'][_0xa2da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x426e0e,_0x1f181e,_0x10744c){return new BPromise(function(_0x11d880,_0x314e4a){return client[_0xa2da('0x9')](_0x426e0e,_0x10744c)[_0xa2da('0xa')](function(_0x1cbc24){logger[_0xa2da('0xb')](_0xa2da('0xc'),_0x1f181e,_0xa2da('0xd'));logger[_0xa2da('0xe')](_0xa2da('0xf'),_0x1f181e,'request\x20sent',JSON['stringify'](_0x1cbc24));if(_0x1cbc24['error']){if(_0x1cbc24['error'][_0xa2da('0x10')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1f181e,_0x1cbc24[_0xa2da('0x11')][_0xa2da('0x12')]);return _0x314e4a(_0x1cbc24['error'][_0xa2da('0x12')]);}logger[_0xa2da('0x11')](_0xa2da('0xc'),_0x1f181e,_0x1cbc24[_0xa2da('0x11')][_0xa2da('0x12')]);return _0x11d880(_0x1cbc24['error']['message']);}else{logger[_0xa2da('0xb')](_0xa2da('0xc'),_0x1f181e,_0xa2da('0xd'));_0x11d880(_0x1cbc24[_0xa2da('0x13')][_0xa2da('0x12')]);}})[_0xa2da('0x14')](function(_0x4ee507){logger[_0xa2da('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x1f181e,_0x4ee507);_0x314e4a(_0x4ee507);});});}exports['GetSalesforceAccount']=function(_0x4d1c3c){var _0x1d0dee=this;return new Promise(function(_0x5ea47a,_0x750d05){return db[_0xa2da('0x15')][_0xa2da('0x16')]({'raw':_0x4d1c3c[_0xa2da('0x17')]?_0x4d1c3c[_0xa2da('0x17')][_0xa2da('0x18')]===undefined?!![]:![]:!![],'where':_0x4d1c3c[_0xa2da('0x17')]?_0x4d1c3c[_0xa2da('0x17')]['where']||null:null,'attributes':_0x4d1c3c[_0xa2da('0x17')]?_0x4d1c3c['options'][_0xa2da('0x19')]||null:null,'limit':_0x4d1c3c['options']?_0x4d1c3c[_0xa2da('0x17')][_0xa2da('0x1a')]||null:null,'include':_0x4d1c3c[_0xa2da('0x17')]?_0x4d1c3c['options'][_0xa2da('0x1b')]?_[_0xa2da('0x1c')](_0x4d1c3c['options'][_0xa2da('0x1b')],function(_0x3e1052){return{'model':db[_0x3e1052[_0xa2da('0x1d')]],'as':_0x3e1052['as'],'attributes':_0x3e1052[_0xa2da('0x19')],'include':_0x3e1052[_0xa2da('0x1b')]?_[_0xa2da('0x1c')](_0x3e1052[_0xa2da('0x1b')],function(_0x29cc79){return{'model':db[_0x29cc79[_0xa2da('0x1d')]],'as':_0x29cc79['as'],'attributes':_0x29cc79[_0xa2da('0x19')],'include':_0x29cc79[_0xa2da('0x1b')]?_[_0xa2da('0x1c')](_0x29cc79[_0xa2da('0x1b')],function(_0x1c243b){return{'model':db[_0x1c243b[_0xa2da('0x1d')]],'as':_0x1c243b['as'],'attributes':_0x1c243b[_0xa2da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa2da('0xa')](function(_0x3334cc){logger['info'](_0xa2da('0x1e'),_0x4d1c3c);logger['debug']('GetSalesforceAccount',_0x4d1c3c,JSON[_0xa2da('0x1f')](_0x3334cc));_0x5ea47a(_0x3334cc);})[_0xa2da('0x14')](function(_0x2a6529){logger[_0xa2da('0x11')](_0xa2da('0x1e'),_0x2a6529[_0xa2da('0x12')],_0x4d1c3c);_0x750d05(_0x1d0dee[_0xa2da('0x11')](0x1f4,_0x2a6529[_0xa2da('0x12')]));});});};exports[_0xa2da('0x20')]=function(_0x172766){var _0x3de772=this;return new Promise(function(_0x155f63,_0x4e17b1){return db[_0xa2da('0x15')][_0xa2da('0x21')]({'raw':_0x172766[_0xa2da('0x17')]?_0x172766[_0xa2da('0x17')][_0xa2da('0x18')]===undefined?!![]:![]:!![],'where':_0x172766['options']?_0x172766[_0xa2da('0x17')]['where']||null:null,'attributes':_0x172766[_0xa2da('0x17')]?_0x172766[_0xa2da('0x17')][_0xa2da('0x19')]||null:null,'include':_0x172766[_0xa2da('0x17')]?_0x172766['options'][_0xa2da('0x1b')]?_[_0xa2da('0x1c')](_0x172766[_0xa2da('0x17')][_0xa2da('0x1b')],function(_0x143d64){return{'model':db[_0x143d64[_0xa2da('0x1d')]],'as':_0x143d64['as'],'attributes':_0x143d64[_0xa2da('0x19')],'include':_0x143d64[_0xa2da('0x1b')]?_[_0xa2da('0x1c')](_0x143d64['include'],function(_0x590705){return{'model':db[_0x590705[_0xa2da('0x1d')]],'as':_0x590705['as'],'attributes':_0x590705[_0xa2da('0x19')],'include':_0x590705[_0xa2da('0x1b')]?_[_0xa2da('0x1c')](_0x590705[_0xa2da('0x1b')],function(_0x4f1319){return{'model':db[_0x4f1319[_0xa2da('0x1d')]],'as':_0x4f1319['as'],'attributes':_0x4f1319['attributes']};}):[]};}):[]};}):[]:[]})[_0xa2da('0xa')](function(_0x742252){logger[_0xa2da('0xb')]('ShowSalesforceAccount',_0x172766);logger[_0xa2da('0xe')](_0xa2da('0x20'),_0x172766,JSON[_0xa2da('0x1f')](_0x742252));_0x155f63(_0x742252);})[_0xa2da('0x14')](function(_0x4ee34a){logger[_0xa2da('0x11')](_0xa2da('0x20'),_0x4ee34a['message'],_0x172766);_0x4e17b1(_0x3de772[_0xa2da('0x11')](0x1f4,_0x4ee34a[_0xa2da('0x12')]));});});}; \ No newline at end of file +var _0x2f9b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowSalesforceAccount','find','lodash','randomstring'];(function(_0x230bed,_0x44f86c){var _0x17f4b0=function(_0x2d0f59){while(--_0x2d0f59){_0x230bed['push'](_0x230bed['shift']());}};_0x17f4b0(++_0x44f86c);}(_0x2f9b,0x1b8));var _0xb2f9=function(_0x7ec41,_0x3b5c36){_0x7ec41=_0x7ec41-0x0;var _0x48c58e=_0x2f9b[_0x7ec41];return _0x48c58e;};'use strict';var _=require(_0xb2f9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb2f9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2f9('0x2'))['db'];var utils=require(_0xb2f9('0x3'));var logger=require(_0xb2f9('0x4'))(_0xb2f9('0x5'));var config=require(_0xb2f9('0x6'));var jayson=require(_0xb2f9('0x7'));var client=jayson[_0xb2f9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50abf9,_0x2bd682,_0x35bd9c){return new BPromise(function(_0x204e3d,_0x4dc252){return client['request'](_0x50abf9,_0x35bd9c)[_0xb2f9('0x9')](function(_0x3ac88e){logger[_0xb2f9('0xa')](_0xb2f9('0xb'),_0x2bd682,_0xb2f9('0xc'));logger['debug'](_0xb2f9('0xd'),_0x2bd682,_0xb2f9('0xc'),JSON[_0xb2f9('0xe')](_0x3ac88e));if(_0x3ac88e[_0xb2f9('0xf')]){if(_0x3ac88e[_0xb2f9('0xf')][_0xb2f9('0x10')]===0x1f4){logger[_0xb2f9('0xf')](_0xb2f9('0xb'),_0x2bd682,_0x3ac88e['error']['message']);return _0x4dc252(_0x3ac88e[_0xb2f9('0xf')][_0xb2f9('0x11')]);}logger[_0xb2f9('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2bd682,_0x3ac88e[_0xb2f9('0xf')][_0xb2f9('0x11')]);return _0x204e3d(_0x3ac88e[_0xb2f9('0xf')][_0xb2f9('0x11')]);}else{logger[_0xb2f9('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x2bd682,_0xb2f9('0xc'));_0x204e3d(_0x3ac88e[_0xb2f9('0x12')]['message']);}})[_0xb2f9('0x13')](function(_0x48989c){logger[_0xb2f9('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2bd682,_0x48989c);_0x4dc252(_0x48989c);});});}exports[_0xb2f9('0x14')]=function(_0x1a5d6f){var _0x348d00=this;return new Promise(function(_0x28957f,_0x3319b9){return db[_0xb2f9('0x15')][_0xb2f9('0x16')]({'raw':_0x1a5d6f['options']?_0x1a5d6f[_0xb2f9('0x17')][_0xb2f9('0x18')]===undefined?!![]:![]:!![],'where':_0x1a5d6f['options']?_0x1a5d6f[_0xb2f9('0x17')][_0xb2f9('0x19')]||null:null,'attributes':_0x1a5d6f['options']?_0x1a5d6f[_0xb2f9('0x17')][_0xb2f9('0x1a')]||null:null,'limit':_0x1a5d6f[_0xb2f9('0x17')]?_0x1a5d6f['options'][_0xb2f9('0x1b')]||null:null,'include':_0x1a5d6f[_0xb2f9('0x17')]?_0x1a5d6f[_0xb2f9('0x17')][_0xb2f9('0x1c')]?_[_0xb2f9('0x1d')](_0x1a5d6f['options']['include'],function(_0x3fa19a){return{'model':db[_0x3fa19a['model']],'as':_0x3fa19a['as'],'attributes':_0x3fa19a[_0xb2f9('0x1a')],'include':_0x3fa19a[_0xb2f9('0x1c')]?_[_0xb2f9('0x1d')](_0x3fa19a[_0xb2f9('0x1c')],function(_0x2c5eca){return{'model':db[_0x2c5eca[_0xb2f9('0x1e')]],'as':_0x2c5eca['as'],'attributes':_0x2c5eca[_0xb2f9('0x1a')],'include':_0x2c5eca[_0xb2f9('0x1c')]?_[_0xb2f9('0x1d')](_0x2c5eca['include'],function(_0x266815){return{'model':db[_0x266815[_0xb2f9('0x1e')]],'as':_0x266815['as'],'attributes':_0x266815[_0xb2f9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee3a9){logger[_0xb2f9('0xa')](_0xb2f9('0x14'),_0x1a5d6f);logger[_0xb2f9('0x1f')]('GetSalesforceAccount',_0x1a5d6f,JSON['stringify'](_0x4ee3a9));_0x28957f(_0x4ee3a9);})['catch'](function(_0x10f267){logger[_0xb2f9('0xf')]('GetSalesforceAccount',_0x10f267[_0xb2f9('0x11')],_0x1a5d6f);_0x3319b9(_0x348d00[_0xb2f9('0xf')](0x1f4,_0x10f267[_0xb2f9('0x11')]));});});};exports[_0xb2f9('0x20')]=function(_0x33f4ea){var _0x49e893=this;return new Promise(function(_0x338d63,_0x53a6a8){return db[_0xb2f9('0x15')][_0xb2f9('0x21')]({'raw':_0x33f4ea[_0xb2f9('0x17')]?_0x33f4ea[_0xb2f9('0x17')][_0xb2f9('0x18')]===undefined?!![]:![]:!![],'where':_0x33f4ea[_0xb2f9('0x17')]?_0x33f4ea[_0xb2f9('0x17')][_0xb2f9('0x19')]||null:null,'attributes':_0x33f4ea[_0xb2f9('0x17')]?_0x33f4ea[_0xb2f9('0x17')]['attributes']||null:null,'include':_0x33f4ea[_0xb2f9('0x17')]?_0x33f4ea[_0xb2f9('0x17')][_0xb2f9('0x1c')]?_[_0xb2f9('0x1d')](_0x33f4ea[_0xb2f9('0x17')]['include'],function(_0x1974b6){return{'model':db[_0x1974b6[_0xb2f9('0x1e')]],'as':_0x1974b6['as'],'attributes':_0x1974b6[_0xb2f9('0x1a')],'include':_0x1974b6[_0xb2f9('0x1c')]?_['map'](_0x1974b6[_0xb2f9('0x1c')],function(_0x1a7d58){return{'model':db[_0x1a7d58[_0xb2f9('0x1e')]],'as':_0x1a7d58['as'],'attributes':_0x1a7d58[_0xb2f9('0x1a')],'include':_0x1a7d58[_0xb2f9('0x1c')]?_['map'](_0x1a7d58['include'],function(_0x2e62cd){return{'model':db[_0x2e62cd[_0xb2f9('0x1e')]],'as':_0x2e62cd['as'],'attributes':_0x2e62cd[_0xb2f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb2f9('0x9')](function(_0x31ac45){logger[_0xb2f9('0xa')](_0xb2f9('0x20'),_0x33f4ea);logger[_0xb2f9('0x1f')](_0xb2f9('0x20'),_0x33f4ea,JSON[_0xb2f9('0xe')](_0x31ac45));_0x338d63(_0x31ac45);})['catch'](function(_0x151bed){logger[_0xb2f9('0xf')](_0xb2f9('0x20'),_0x151bed[_0xb2f9('0x11')],_0x33f4ea);_0x53a6a8(_0x49e893[_0xb2f9('0xf')](0x1f4,_0x151bed[_0xb2f9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index a15191b..6c3f713 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0x0b0e[_0x1faaa1];return _0x994ec;};'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['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=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(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xdb28,0x106));var _0x8db2=function(_0x3b809d,_0x97ee4f){_0x3b809d=_0x3b809d-0x0;var _0x122f95=_0xdb28[_0x3b809d];return _0x122f95;};'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 0aaca46..44a4d26 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 _0xfc90=['contact_lead','contact','account_contact_lead','account','lead','STRING','ENUM','Case','Task'];(function(_0x5ecfa8,_0x4a1de2){var _0x4d8897=function(_0x28653d){while(--_0x28653d){_0x5ecfa8['push'](_0x5ecfa8['shift']());}};_0x4d8897(++_0x4a1de2);}(_0xfc90,0xf8));var _0x0fc9=function(_0x4f7deb,_0x1b3e20){_0x4f7deb=_0x4f7deb-0x0;var _0x5c93f9=_0xfc90[_0x4f7deb];return _0x5c93f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0fc9('0x0')]},'ticketType':{'type':Sequelize[_0x0fc9('0x1')]('Task',_0x0fc9('0x2')),'defaultValue':_0x0fc9('0x3')},'moduleSearch':{'type':Sequelize[_0x0fc9('0x1')](_0x0fc9('0x4'),_0x0fc9('0x5'),'lead',_0x0fc9('0x6'),_0x0fc9('0x7')),'defaultValue':_0x0fc9('0x4')},'moduleCreate':{'type':Sequelize[_0x0fc9('0x1')]('nothing',_0x0fc9('0x5'),_0x0fc9('0x8'),'account'),'defaultValue':_0x0fc9('0x8')},'leadId':{'type':Sequelize[_0x0fc9('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x0fc9('0x0')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x0fc9('0x0')]}}; \ No newline at end of file +var _0xbd12=['ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xbd12,0x129));var _0x2bd1=function(_0x578913,_0x3808c7){_0x578913=_0x578913-0x0;var _0x5e135e=_0xbd12[_0x578913];return _0x5e135e;};'use strict';var Sequelize=require(_0x2bd1('0x0'));module[_0x2bd1('0x1')]={'name':{'type':Sequelize[_0x2bd1('0x2')]},'description':{'type':Sequelize[_0x2bd1('0x2')]},'ticketType':{'type':Sequelize[_0x2bd1('0x3')](_0x2bd1('0x4'),_0x2bd1('0x5')),'defaultValue':_0x2bd1('0x4')},'moduleSearch':{'type':Sequelize[_0x2bd1('0x3')](_0x2bd1('0x6'),_0x2bd1('0x7'),_0x2bd1('0x8'),_0x2bd1('0x9'),_0x2bd1('0xa')),'defaultValue':_0x2bd1('0x6')},'moduleCreate':{'type':Sequelize[_0x2bd1('0x3')](_0x2bd1('0xb'),_0x2bd1('0x7'),'lead',_0x2bd1('0xa')),'defaultValue':_0x2bd1('0x8')},'leadId':{'type':Sequelize[_0x2bd1('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x2bd1('0x2')]},'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 d9694ec..379e1bc 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 _0xb592=['index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','then','rows','catch','show','params','options','create','body','find','findOne','SalesforceField','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','sendStatus','error','name'];(function(_0x2b577c,_0x12ba5f){var _0x442701=function(_0x28fdfe){while(--_0x28fdfe){_0x2b577c['push'](_0x2b577c['shift']());}};_0x442701(++_0x12ba5f);}(_0xb592,0x10b));var _0x2b59=function(_0x44650b,_0x5af069){_0x44650b=_0x44650b-0x0;var _0x13b205=_0xb592[_0x44650b];return _0x13b205;};'use strict';var emlformat=require(_0x2b59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b59('0x1'));var rp=require('request-promise');var moment=require(_0x2b59('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2b59('0x3'));var util=require(_0x2b59('0x4'));var path=require(_0x2b59('0x5'));var sox=require(_0x2b59('0x6'));var csv=require(_0x2b59('0x7'));var ejs=require(_0x2b59('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2b59('0x9'));var crypto=require('crypto');var jsforce=require(_0x2b59('0xa'));var deskjs=require(_0x2b59('0xb'));var toCsv=require(_0x2b59('0x7'));var querystring=require(_0x2b59('0xc'));var Papa=require('papaparse');var Redis=require(_0x2b59('0xd'));var authService=require(_0x2b59('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2b59('0xf'));var hardwareService=require(_0x2b59('0x10'));var logger=require(_0x2b59('0x11'))(_0x2b59('0x12'));var utils=require(_0x2b59('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2b59('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18653d,_0x3af1e2){_0x3af1e2=_0x3af1e2||0xcc;return function(_0x2bbf39){if(_0x2bbf39){return _0x18653d['sendStatus'](_0x3af1e2);}return _0x18653d[_0x2b59('0x15')](_0x3af1e2)[_0x2b59('0x16')]();};}function respondWithResult(_0x11c59b,_0x1b56cb){_0x1b56cb=_0x1b56cb||0xc8;return function(_0x1b548c){if(_0x1b548c){return _0x11c59b[_0x2b59('0x15')](_0x1b56cb)['json'](_0x1b548c);}};}function respondWithFilteredResult(_0x355bba,_0x18ee0a){return function(_0x42d5e8){if(_0x42d5e8){var _0x47a6c5=typeof _0x18ee0a[_0x2b59('0x17')]===_0x2b59('0x18')&&typeof _0x18ee0a[_0x2b59('0x19')]===_0x2b59('0x18');var _0x3e1e2f=_0x42d5e8['count'];var _0x22ca4f=_0x47a6c5?0x0:_0x18ee0a[_0x2b59('0x17')];var _0x118d81=_0x47a6c5?_0x42d5e8[_0x2b59('0x1a')]:_0x18ee0a[_0x2b59('0x17')]+_0x18ee0a[_0x2b59('0x19')];var _0x1cfc0e;if(_0x118d81>=_0x3e1e2f){_0x118d81=_0x3e1e2f;_0x1cfc0e=0xc8;}else{_0x1cfc0e=0xce;}_0x355bba[_0x2b59('0x15')](_0x1cfc0e);return _0x355bba[_0x2b59('0x1b')](_0x2b59('0x1c'),_0x22ca4f+'-'+_0x118d81+'/'+_0x3e1e2f)[_0x2b59('0x1d')](_0x42d5e8);}return null;};}function patchUpdates(_0x6d4661){return function(_0x4f202d){try{jsonpatch[_0x2b59('0x1e')](_0x4f202d,_0x6d4661,!![]);}catch(_0x33870b){return BPromise[_0x2b59('0x1f')](_0x33870b);}return _0x4f202d['save']();};}function saveUpdates(_0x17cf0d,_0x2c1808){return function(_0x41637e){if(_0x41637e){return _0x41637e[_0x2b59('0x20')](_0x17cf0d)['then'](function(_0x40427d){return _0x40427d;});}return null;};}function removeEntity(_0x1071f2,_0x59190d){return function(_0x5bd71a){if(_0x5bd71a){return _0x5bd71a[_0x2b59('0x21')]()['then'](function(){_0x1071f2[_0x2b59('0x15')](0xcc)[_0x2b59('0x16')]();});}};}function handleEntityNotFound(_0x47158e,_0x50fa24){return function(_0x1f0879){if(!_0x1f0879){_0x47158e[_0x2b59('0x22')](0x194);}return _0x1f0879;};}function handleError(_0x3fdaa9,_0x31e18f){_0x31e18f=_0x31e18f||0x1f4;return function(_0xf2991e){logger[_0x2b59('0x23')](_0xf2991e['stack']);if(_0xf2991e['name']){delete _0xf2991e[_0x2b59('0x24')];}_0x3fdaa9[_0x2b59('0x15')](_0x31e18f)['send'](_0xf2991e);};}exports[_0x2b59('0x25')]=function(_0x2a4870,_0x3d4982){var _0x2b1b6a={},_0x399294={},_0x2bae18={'count':0x0,'rows':[]};var _0x2a3c77=_[_0x2b59('0x26')](db[_0x2b59('0x27')][_0x2b59('0x28')],function(_0x9d35f){return{'name':_0x9d35f[_0x2b59('0x29')],'type':_0x9d35f[_0x2b59('0x2a')]['key']};});_0x399294[_0x2b59('0x2b')]=_['map'](_0x2a3c77,_0x2b59('0x24'));_0x399294[_0x2b59('0x2c')]=_[_0x2b59('0x2d')](_0x2a4870[_0x2b59('0x2c')]);_0x399294[_0x2b59('0x2e')]=_[_0x2b59('0x2f')](_0x399294['model'],_0x399294['query']);_0x2b1b6a['attributes']=_['intersection'](_0x399294[_0x2b59('0x2b')],qs[_0x2b59('0x30')](_0x2a4870[_0x2b59('0x2c')][_0x2b59('0x30')]));_0x2b1b6a[_0x2b59('0x31')]=_0x2b1b6a[_0x2b59('0x31')][_0x2b59('0x32')]?_0x2b1b6a[_0x2b59('0x31')]:_0x399294[_0x2b59('0x2b')];if(!_0x2a4870[_0x2b59('0x2c')][_0x2b59('0x33')](_0x2b59('0x34'))){_0x2b1b6a[_0x2b59('0x19')]=qs[_0x2b59('0x19')](_0x2a4870['query'][_0x2b59('0x19')]);_0x2b1b6a[_0x2b59('0x17')]=qs[_0x2b59('0x17')](_0x2a4870[_0x2b59('0x2c')][_0x2b59('0x17')]);}_0x2b1b6a[_0x2b59('0x35')]=qs['sort'](_0x2a4870[_0x2b59('0x2c')][_0x2b59('0x36')]);_0x2b1b6a[_0x2b59('0x37')]=qs[_0x2b59('0x2e')](_[_0x2b59('0x38')](_0x2a4870[_0x2b59('0x2c')],_0x399294[_0x2b59('0x2e')]),_0x2a3c77);if(_0x2a4870[_0x2b59('0x2c')]['filter']){_0x2b1b6a[_0x2b59('0x37')]=_[_0x2b59('0x39')](_0x2b1b6a[_0x2b59('0x37')],{'$or':_[_0x2b59('0x26')](_0x2a3c77,function(_0x11d534){if(_0x11d534[_0x2b59('0x2a')]!==_0x2b59('0x3a')){var _0x58051c={};_0x58051c[_0x11d534[_0x2b59('0x24')]]={'$like':'%'+_0x2a4870['query'][_0x2b59('0x3b')]+'%'};return _0x58051c;}})});}_0x2b1b6a=_['merge']({},_0x2b1b6a,_0x2a4870['options']);var _0x4cd319={'where':_0x2b1b6a['where']};return db['SalesforceConfiguration']['count'](_0x4cd319)['then'](function(_0x2392aa){_0x2bae18[_0x2b59('0x1a')]=_0x2392aa;if(_0x2a4870['query'][_0x2b59('0x3c')]){_0x2b1b6a[_0x2b59('0x3d')]=[{'all':!![]}];}return db[_0x2b59('0x27')]['findAll'](_0x2b1b6a);})[_0x2b59('0x3e')](function(_0x2a022e){_0x2bae18[_0x2b59('0x3f')]=_0x2a022e;return _0x2bae18;})['then'](respondWithFilteredResult(_0x3d4982,_0x2b1b6a))[_0x2b59('0x40')](handleError(_0x3d4982,null));};exports[_0x2b59('0x41')]=function(_0x3922bc,_0x5bf852){var _0x306fee={'raw':![],'where':{'id':_0x3922bc[_0x2b59('0x42')]['id']}},_0x4f1f86={};_0x4f1f86[_0x2b59('0x2b')]=_[_0x2b59('0x2d')](db[_0x2b59('0x27')][_0x2b59('0x28')]);_0x4f1f86[_0x2b59('0x2c')]=_['keys'](_0x3922bc[_0x2b59('0x2c')]);_0x4f1f86[_0x2b59('0x2e')]=_[_0x2b59('0x2f')](_0x4f1f86[_0x2b59('0x2b')],_0x4f1f86['query']);_0x306fee[_0x2b59('0x31')]=_[_0x2b59('0x2f')](_0x4f1f86[_0x2b59('0x2b')],qs[_0x2b59('0x30')](_0x3922bc[_0x2b59('0x2c')]['fields']));_0x306fee[_0x2b59('0x31')]=_0x306fee[_0x2b59('0x31')][_0x2b59('0x32')]?_0x306fee[_0x2b59('0x31')]:_0x4f1f86[_0x2b59('0x2b')];if(_0x3922bc[_0x2b59('0x2c')][_0x2b59('0x3c')]){_0x306fee['include']=[{'all':!![]}];}_0x306fee=_[_0x2b59('0x39')]({},_0x306fee,_0x3922bc[_0x2b59('0x43')]);return db[_0x2b59('0x27')]['find'](_0x306fee)[_0x2b59('0x3e')](handleEntityNotFound(_0x5bf852,null))[_0x2b59('0x3e')](respondWithResult(_0x5bf852,null))[_0x2b59('0x40')](handleError(_0x5bf852,null));};exports['create']=function(_0x2f73fb,_0x194b1b){return db[_0x2b59('0x27')][_0x2b59('0x44')](_0x2f73fb[_0x2b59('0x45')],{})[_0x2b59('0x3e')](respondWithResult(_0x194b1b,0xc9))[_0x2b59('0x40')](handleError(_0x194b1b,null));};exports[_0x2b59('0x20')]=function(_0x440055,_0x40e469){if(_0x440055['body']['id']){delete _0x440055[_0x2b59('0x45')]['id'];}return db[_0x2b59('0x27')][_0x2b59('0x46')]({'where':{'id':_0x440055[_0x2b59('0x42')]['id']}})[_0x2b59('0x3e')](handleEntityNotFound(_0x40e469,null))[_0x2b59('0x3e')](saveUpdates(_0x440055[_0x2b59('0x45')],null))[_0x2b59('0x3e')](respondWithResult(_0x40e469,null))[_0x2b59('0x40')](handleError(_0x40e469,null));};exports[_0x2b59('0x21')]=function(_0x1e8138,_0x16f6b8){return db['SalesforceConfiguration'][_0x2b59('0x46')]({'where':{'id':_0x1e8138[_0x2b59('0x42')]['id']}})[_0x2b59('0x3e')](handleEntityNotFound(_0x16f6b8,null))['then'](removeEntity(_0x16f6b8,null))[_0x2b59('0x40')](handleError(_0x16f6b8,null));};exports['getFields']=function(_0x3415d8,_0x69b534,_0x57d60f){var _0x260cc9={};var _0x25ccd7={};var _0x3559d8;var _0x5e6b46;return db[_0x2b59('0x27')][_0x2b59('0x47')]({'where':{'id':_0x3415d8[_0x2b59('0x42')]['id']}})[_0x2b59('0x3e')](handleEntityNotFound(_0x69b534,null))['then'](function(_0x3f836d){if(_0x3f836d){_0x3559d8=_0x3f836d;_0x25ccd7[_0x2b59('0x2b')]=_[_0x2b59('0x2d')](db[_0x2b59('0x48')][_0x2b59('0x28')]);_0x25ccd7[_0x2b59('0x2c')]=_[_0x2b59('0x2d')](_0x3415d8['query']);_0x25ccd7[_0x2b59('0x2e')]=_['intersection'](_0x25ccd7[_0x2b59('0x2b')],_0x25ccd7[_0x2b59('0x2c')]);_0x260cc9[_0x2b59('0x31')]=_[_0x2b59('0x2f')](_0x25ccd7['model'],qs[_0x2b59('0x30')](_0x3415d8[_0x2b59('0x2c')][_0x2b59('0x30')]));_0x260cc9[_0x2b59('0x31')]=_0x260cc9[_0x2b59('0x31')]['length']?_0x260cc9['attributes']:_0x25ccd7[_0x2b59('0x2b')];_0x260cc9[_0x2b59('0x35')]=qs[_0x2b59('0x36')](_0x3415d8[_0x2b59('0x2c')][_0x2b59('0x36')]);_0x260cc9[_0x2b59('0x37')]=qs[_0x2b59('0x2e')](_[_0x2b59('0x38')](_0x3415d8[_0x2b59('0x2c')],_0x25ccd7[_0x2b59('0x2e')]));if(_0x3415d8['query']['filter']){_0x260cc9[_0x2b59('0x37')]=_[_0x2b59('0x39')](_0x260cc9[_0x2b59('0x37')],{'$or':_[_0x2b59('0x26')](_0x260cc9[_0x2b59('0x31')],function(_0x523717){var _0x15bcb7={};_0x15bcb7[_0x523717]={'$like':'%'+_0x3415d8[_0x2b59('0x2c')][_0x2b59('0x3b')]+'%'};return _0x15bcb7;})});}_0x260cc9=_['merge']({},_0x260cc9,_0x3415d8[_0x2b59('0x43')]);return _0x3559d8[_0x2b59('0x49')](_0x260cc9);}})[_0x2b59('0x3e')](function(_0xcdc13c){if(_0xcdc13c){_0x5e6b46=_0xcdc13c[_0x2b59('0x32')];if(!_0x3415d8['query'][_0x2b59('0x33')](_0x2b59('0x34'))){_0x260cc9[_0x2b59('0x19')]=qs['limit'](_0x3415d8[_0x2b59('0x2c')][_0x2b59('0x19')]);_0x260cc9[_0x2b59('0x17')]=qs[_0x2b59('0x17')](_0x3415d8[_0x2b59('0x2c')]['offset']);}return _0x3559d8['getFields'](_0x260cc9);}})[_0x2b59('0x3e')](function(_0x21f4a6){if(_0x21f4a6){return _0x21f4a6?{'count':_0x5e6b46,'rows':_0x21f4a6}:null;}})[_0x2b59('0x3e')](respondWithResult(_0x69b534,null))['catch'](handleError(_0x69b534,null));};exports[_0x2b59('0x4a')]=function(_0x2733e6,_0x1c9a60,_0x1d9718){var _0x107a91={};var _0x2713c7={};var _0x3b6db9;var _0x11fe1a;return db['SalesforceConfiguration'][_0x2b59('0x47')]({'where':{'id':_0x2733e6[_0x2b59('0x42')]['id']}})[_0x2b59('0x3e')](handleEntityNotFound(_0x1c9a60,null))['then'](function(_0x284829){if(_0x284829){_0x3b6db9=_0x284829;_0x2713c7[_0x2b59('0x2b')]=_[_0x2b59('0x2d')](db[_0x2b59('0x48')]['rawAttributes']);_0x2713c7[_0x2b59('0x2c')]=_[_0x2b59('0x2d')](_0x2733e6[_0x2b59('0x2c')]);_0x2713c7['filters']=_[_0x2b59('0x2f')](_0x2713c7[_0x2b59('0x2b')],_0x2713c7['query']);_0x107a91[_0x2b59('0x31')]=_['intersection'](_0x2713c7[_0x2b59('0x2b')],qs['fields'](_0x2733e6[_0x2b59('0x2c')][_0x2b59('0x30')]));_0x107a91['attributes']=_0x107a91[_0x2b59('0x31')][_0x2b59('0x32')]?_0x107a91[_0x2b59('0x31')]:_0x2713c7[_0x2b59('0x2b')];_0x107a91[_0x2b59('0x35')]=qs['sort'](_0x2733e6[_0x2b59('0x2c')][_0x2b59('0x36')]);_0x107a91[_0x2b59('0x37')]=qs[_0x2b59('0x2e')](_['pick'](_0x2733e6[_0x2b59('0x2c')],_0x2713c7[_0x2b59('0x2e')]));if(_0x2733e6['query']['filter']){_0x107a91[_0x2b59('0x37')]=_[_0x2b59('0x39')](_0x107a91[_0x2b59('0x37')],{'$or':_['map'](_0x107a91[_0x2b59('0x31')],function(_0x54711a){var _0x3bf128={};_0x3bf128[_0x54711a]={'$like':'%'+_0x2733e6[_0x2b59('0x2c')][_0x2b59('0x3b')]+'%'};return _0x3bf128;})});}_0x107a91=_[_0x2b59('0x39')]({},_0x107a91,_0x2733e6[_0x2b59('0x43')]);return _0x3b6db9[_0x2b59('0x4a')](_0x107a91);}})[_0x2b59('0x3e')](function(_0x20fffc){if(_0x20fffc){_0x11fe1a=_0x20fffc[_0x2b59('0x32')];if(!_0x2733e6[_0x2b59('0x2c')][_0x2b59('0x33')](_0x2b59('0x34'))){_0x107a91[_0x2b59('0x19')]=qs[_0x2b59('0x19')](_0x2733e6['query'][_0x2b59('0x19')]);_0x107a91['offset']=qs[_0x2b59('0x17')](_0x2733e6[_0x2b59('0x2c')][_0x2b59('0x17')]);}return _0x3b6db9[_0x2b59('0x4a')](_0x107a91);}})[_0x2b59('0x3e')](function(_0x20818f){if(_0x20818f){return _0x20818f?{'count':_0x11fe1a,'rows':_0x20818f}:null;}})[_0x2b59('0x3e')](respondWithResult(_0x1c9a60,null))[_0x2b59('0x40')](handleError(_0x1c9a60,null));};exports['getDescriptions']=function(_0x27a42a,_0x330118,_0x46a104){var _0x865ff5={};var _0x3dcd86={};var _0x52bc0f;var _0x3d2a26;return db[_0x2b59('0x27')]['findOne']({'where':{'id':_0x27a42a['params']['id']}})['then'](handleEntityNotFound(_0x330118,null))[_0x2b59('0x3e')](function(_0x3d5ab1){if(_0x3d5ab1){_0x52bc0f=_0x3d5ab1;_0x3dcd86[_0x2b59('0x2b')]=_['keys'](db[_0x2b59('0x48')][_0x2b59('0x28')]);_0x3dcd86[_0x2b59('0x2c')]=_[_0x2b59('0x2d')](_0x27a42a[_0x2b59('0x2c')]);_0x3dcd86['filters']=_[_0x2b59('0x2f')](_0x3dcd86[_0x2b59('0x2b')],_0x3dcd86[_0x2b59('0x2c')]);_0x865ff5[_0x2b59('0x31')]=_[_0x2b59('0x2f')](_0x3dcd86['model'],qs[_0x2b59('0x30')](_0x27a42a[_0x2b59('0x2c')]['fields']));_0x865ff5[_0x2b59('0x31')]=_0x865ff5[_0x2b59('0x31')]['length']?_0x865ff5[_0x2b59('0x31')]:_0x3dcd86[_0x2b59('0x2b')];_0x865ff5[_0x2b59('0x35')]=qs[_0x2b59('0x36')](_0x27a42a[_0x2b59('0x2c')]['sort']);_0x865ff5[_0x2b59('0x37')]=qs[_0x2b59('0x2e')](_[_0x2b59('0x38')](_0x27a42a[_0x2b59('0x2c')],_0x3dcd86['filters']));if(_0x27a42a[_0x2b59('0x2c')][_0x2b59('0x3b')]){_0x865ff5[_0x2b59('0x37')]=_[_0x2b59('0x39')](_0x865ff5[_0x2b59('0x37')],{'$or':_['map'](_0x865ff5[_0x2b59('0x31')],function(_0xbb322b){var _0x1e3afc={};_0x1e3afc[_0xbb322b]={'$like':'%'+_0x27a42a['query'][_0x2b59('0x3b')]+'%'};return _0x1e3afc;})});}_0x865ff5=_[_0x2b59('0x39')]({},_0x865ff5,_0x27a42a[_0x2b59('0x43')]);return _0x52bc0f['getDescriptions'](_0x865ff5);}})['then'](function(_0x3e2d7b){if(_0x3e2d7b){_0x3d2a26=_0x3e2d7b[_0x2b59('0x32')];if(!_0x27a42a[_0x2b59('0x2c')]['hasOwnProperty'](_0x2b59('0x34'))){_0x865ff5[_0x2b59('0x19')]=qs['limit'](_0x27a42a[_0x2b59('0x2c')][_0x2b59('0x19')]);_0x865ff5[_0x2b59('0x17')]=qs[_0x2b59('0x17')](_0x27a42a[_0x2b59('0x2c')][_0x2b59('0x17')]);}return _0x52bc0f[_0x2b59('0x4b')](_0x865ff5);}})[_0x2b59('0x3e')](function(_0x1bdb65){if(_0x1bdb65){return _0x1bdb65?{'count':_0x3d2a26,'rows':_0x1bdb65}:null;}})[_0x2b59('0x3e')](respondWithResult(_0x330118,null))['catch'](handleError(_0x330118,null));}; \ No newline at end of file +var _0x655e=['attributes','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','SalesforceConfiguration','includeAll','include','findAll','rows','fields','options','catch','create','body','params','find','getFields','findOne','SalesforceField','pick','filter','getSubjects','getDescriptions','rawAttributes','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','keys','filters','intersection','query'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x655e,0x19f));var _0xe655=function(_0x29cf08,_0x3a6b33){_0x29cf08=_0x29cf08-0x0;var _0x588546=_0x655e[_0x29cf08];return _0x588546;};'use strict';var emlformat=require(_0xe655('0x0'));var rimraf=require(_0xe655('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe655('0x2'));var rp=require(_0xe655('0x3'));var moment=require('moment');var BPromise=require(_0xe655('0x4'));var Mustache=require('mustache');var util=require(_0xe655('0x5'));var path=require(_0xe655('0x6'));var sox=require('sox');var csv=require(_0xe655('0x7'));var ejs=require(_0xe655('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe655('0x9'));var jsforce=require(_0xe655('0xa'));var deskjs=require(_0xe655('0xb'));var toCsv=require(_0xe655('0x7'));var querystring=require('querystring');var Papa=require(_0xe655('0xc'));var Redis=require(_0xe655('0xd'));var authService=require(_0xe655('0xe'));var qs=require(_0xe655('0xf'));var as=require(_0xe655('0x10'));var hardwareService=require(_0xe655('0x11'));var logger=require(_0xe655('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe655('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x445540,_0x269e1c){_0x269e1c=_0x269e1c||0xcc;return function(_0x4a2711){if(_0x4a2711){return _0x445540['sendStatus'](_0x269e1c);}return _0x445540[_0xe655('0x14')](_0x269e1c)[_0xe655('0x15')]();};}function respondWithResult(_0x548175,_0x4f4113){_0x4f4113=_0x4f4113||0xc8;return function(_0x2b58ba){if(_0x2b58ba){return _0x548175[_0xe655('0x14')](_0x4f4113)[_0xe655('0x16')](_0x2b58ba);}};}function respondWithFilteredResult(_0x305a69,_0x46df2d){return function(_0xe0cb2c){if(_0xe0cb2c){var _0x15a58a=typeof _0x46df2d[_0xe655('0x17')]==='undefined'&&typeof _0x46df2d['limit']===_0xe655('0x18');var _0x3f89a2=_0xe0cb2c[_0xe655('0x19')];var _0x2d054a=_0x15a58a?0x0:_0x46df2d['offset'];var _0x42e396=_0x15a58a?_0xe0cb2c['count']:_0x46df2d[_0xe655('0x17')]+_0x46df2d['limit'];var _0x1a0c92;if(_0x42e396>=_0x3f89a2){_0x42e396=_0x3f89a2;_0x1a0c92=0xc8;}else{_0x1a0c92=0xce;}_0x305a69[_0xe655('0x14')](_0x1a0c92);return _0x305a69[_0xe655('0x1a')](_0xe655('0x1b'),_0x2d054a+'-'+_0x42e396+'/'+_0x3f89a2)[_0xe655('0x16')](_0xe0cb2c);}return null;};}function patchUpdates(_0x2a4a97){return function(_0x5b25e3){try{jsonpatch[_0xe655('0x1c')](_0x5b25e3,_0x2a4a97,!![]);}catch(_0xf38056){return BPromise[_0xe655('0x1d')](_0xf38056);}return _0x5b25e3[_0xe655('0x1e')]();};}function saveUpdates(_0x272939,_0x427a0e){return function(_0x1e26aa){if(_0x1e26aa){return _0x1e26aa[_0xe655('0x1f')](_0x272939)[_0xe655('0x20')](function(_0x5c3ba5){return _0x5c3ba5;});}return null;};}function removeEntity(_0x1e8820,_0x32842d){return function(_0x442d9b){if(_0x442d9b){return _0x442d9b[_0xe655('0x21')]()[_0xe655('0x20')](function(){_0x1e8820['status'](0xcc)[_0xe655('0x15')]();});}};}function handleEntityNotFound(_0x413e0a,_0x5ac9dc){return function(_0x337f81){if(!_0x337f81){_0x413e0a['sendStatus'](0x194);}return _0x337f81;};}function handleError(_0xf65446,_0x5e01d0){_0x5e01d0=_0x5e01d0||0x1f4;return function(_0x2bad3b){logger[_0xe655('0x22')](_0x2bad3b[_0xe655('0x23')]);if(_0x2bad3b[_0xe655('0x24')]){delete _0x2bad3b[_0xe655('0x24')];}_0xf65446[_0xe655('0x14')](_0x5e01d0)[_0xe655('0x25')](_0x2bad3b);};}exports['index']=function(_0x52fcd1,_0x3451fe){var _0x554e0c={},_0x3f00a1={},_0x1adc6e={'count':0x0,'rows':[]};var _0x4f8e6e=_[_0xe655('0x26')](db['SalesforceConfiguration']['rawAttributes'],function(_0x5eea28){return{'name':_0x5eea28[_0xe655('0x27')],'type':_0x5eea28[_0xe655('0x28')][_0xe655('0x29')]};});_0x3f00a1[_0xe655('0x2a')]=_[_0xe655('0x26')](_0x4f8e6e,_0xe655('0x24'));_0x3f00a1['query']=_[_0xe655('0x2b')](_0x52fcd1['query']);_0x3f00a1[_0xe655('0x2c')]=_[_0xe655('0x2d')](_0x3f00a1['model'],_0x3f00a1[_0xe655('0x2e')]);_0x554e0c[_0xe655('0x2f')]=_['intersection'](_0x3f00a1[_0xe655('0x2a')],qs['fields'](_0x52fcd1[_0xe655('0x2e')]['fields']));_0x554e0c[_0xe655('0x2f')]=_0x554e0c[_0xe655('0x2f')][_0xe655('0x30')]?_0x554e0c[_0xe655('0x2f')]:_0x3f00a1[_0xe655('0x2a')];if(!_0x52fcd1['query'][_0xe655('0x31')](_0xe655('0x32'))){_0x554e0c['limit']=qs[_0xe655('0x33')](_0x52fcd1[_0xe655('0x2e')]['limit']);_0x554e0c[_0xe655('0x17')]=qs[_0xe655('0x17')](_0x52fcd1[_0xe655('0x2e')][_0xe655('0x17')]);}_0x554e0c[_0xe655('0x34')]=qs[_0xe655('0x35')](_0x52fcd1[_0xe655('0x2e')][_0xe655('0x35')]);_0x554e0c['where']=qs[_0xe655('0x2c')](_['pick'](_0x52fcd1['query'],_0x3f00a1[_0xe655('0x2c')]),_0x4f8e6e);if(_0x52fcd1['query']['filter']){_0x554e0c['where']=_[_0xe655('0x36')](_0x554e0c[_0xe655('0x37')],{'$or':_[_0xe655('0x26')](_0x4f8e6e,function(_0x3d6849){if(_0x3d6849[_0xe655('0x28')]!==_0xe655('0x38')){var _0x5ee0af={};_0x5ee0af[_0x3d6849[_0xe655('0x24')]]={'$like':'%'+_0x52fcd1['query']['filter']+'%'};return _0x5ee0af;}})});}_0x554e0c=_[_0xe655('0x36')]({},_0x554e0c,_0x52fcd1['options']);var _0x3e1ae6={'where':_0x554e0c[_0xe655('0x37')]};return db[_0xe655('0x39')][_0xe655('0x19')](_0x3e1ae6)['then'](function(_0x2d594a){_0x1adc6e['count']=_0x2d594a;if(_0x52fcd1[_0xe655('0x2e')][_0xe655('0x3a')]){_0x554e0c[_0xe655('0x3b')]=[{'all':!![]}];}return db[_0xe655('0x39')][_0xe655('0x3c')](_0x554e0c);})['then'](function(_0x3067e5){_0x1adc6e[_0xe655('0x3d')]=_0x3067e5;return _0x1adc6e;})['then'](respondWithFilteredResult(_0x3451fe,_0x554e0c))['catch'](handleError(_0x3451fe,null));};exports['show']=function(_0xbe362c,_0x43e045){var _0x19d4c9={'raw':![],'where':{'id':_0xbe362c['params']['id']}},_0x211eac={};_0x211eac[_0xe655('0x2a')]=_[_0xe655('0x2b')](db['SalesforceConfiguration']['rawAttributes']);_0x211eac['query']=_[_0xe655('0x2b')](_0xbe362c['query']);_0x211eac['filters']=_[_0xe655('0x2d')](_0x211eac['model'],_0x211eac['query']);_0x19d4c9[_0xe655('0x2f')]=_[_0xe655('0x2d')](_0x211eac[_0xe655('0x2a')],qs[_0xe655('0x3e')](_0xbe362c['query']['fields']));_0x19d4c9[_0xe655('0x2f')]=_0x19d4c9[_0xe655('0x2f')][_0xe655('0x30')]?_0x19d4c9['attributes']:_0x211eac[_0xe655('0x2a')];if(_0xbe362c[_0xe655('0x2e')][_0xe655('0x3a')]){_0x19d4c9[_0xe655('0x3b')]=[{'all':!![]}];}_0x19d4c9=_[_0xe655('0x36')]({},_0x19d4c9,_0xbe362c[_0xe655('0x3f')]);return db[_0xe655('0x39')]['find'](_0x19d4c9)[_0xe655('0x20')](handleEntityNotFound(_0x43e045,null))['then'](respondWithResult(_0x43e045,null))[_0xe655('0x40')](handleError(_0x43e045,null));};exports[_0xe655('0x41')]=function(_0x453c7c,_0x5365ba){return db[_0xe655('0x39')]['create'](_0x453c7c['body'],{})[_0xe655('0x20')](respondWithResult(_0x5365ba,0xc9))[_0xe655('0x40')](handleError(_0x5365ba,null));};exports[_0xe655('0x1f')]=function(_0x23605e,_0x1ee63f){if(_0x23605e[_0xe655('0x42')]['id']){delete _0x23605e[_0xe655('0x42')]['id'];}return db[_0xe655('0x39')]['find']({'where':{'id':_0x23605e[_0xe655('0x43')]['id']}})[_0xe655('0x20')](handleEntityNotFound(_0x1ee63f,null))['then'](saveUpdates(_0x23605e[_0xe655('0x42')],null))[_0xe655('0x20')](respondWithResult(_0x1ee63f,null))[_0xe655('0x40')](handleError(_0x1ee63f,null));};exports[_0xe655('0x21')]=function(_0x1467b1,_0x445472){return db['SalesforceConfiguration'][_0xe655('0x44')]({'where':{'id':_0x1467b1['params']['id']}})[_0xe655('0x20')](handleEntityNotFound(_0x445472,null))[_0xe655('0x20')](removeEntity(_0x445472,null))[_0xe655('0x40')](handleError(_0x445472,null));};exports[_0xe655('0x45')]=function(_0x467d4c,_0x4e5914,_0x16a05e){var _0x26314d={};var _0x20ecd1={};var _0x300901;var _0xa30b57;return db['SalesforceConfiguration'][_0xe655('0x46')]({'where':{'id':_0x467d4c[_0xe655('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e5914,null))[_0xe655('0x20')](function(_0x4aab2e){if(_0x4aab2e){_0x300901=_0x4aab2e;_0x20ecd1[_0xe655('0x2a')]=_[_0xe655('0x2b')](db[_0xe655('0x47')]['rawAttributes']);_0x20ecd1[_0xe655('0x2e')]=_['keys'](_0x467d4c[_0xe655('0x2e')]);_0x20ecd1[_0xe655('0x2c')]=_[_0xe655('0x2d')](_0x20ecd1['model'],_0x20ecd1[_0xe655('0x2e')]);_0x26314d[_0xe655('0x2f')]=_[_0xe655('0x2d')](_0x20ecd1['model'],qs[_0xe655('0x3e')](_0x467d4c[_0xe655('0x2e')][_0xe655('0x3e')]));_0x26314d['attributes']=_0x26314d[_0xe655('0x2f')][_0xe655('0x30')]?_0x26314d['attributes']:_0x20ecd1['model'];_0x26314d[_0xe655('0x34')]=qs['sort'](_0x467d4c[_0xe655('0x2e')]['sort']);_0x26314d[_0xe655('0x37')]=qs[_0xe655('0x2c')](_[_0xe655('0x48')](_0x467d4c[_0xe655('0x2e')],_0x20ecd1[_0xe655('0x2c')]));if(_0x467d4c[_0xe655('0x2e')]['filter']){_0x26314d[_0xe655('0x37')]=_[_0xe655('0x36')](_0x26314d[_0xe655('0x37')],{'$or':_[_0xe655('0x26')](_0x26314d[_0xe655('0x2f')],function(_0x57fc63){var _0x97f716={};_0x97f716[_0x57fc63]={'$like':'%'+_0x467d4c[_0xe655('0x2e')][_0xe655('0x49')]+'%'};return _0x97f716;})});}_0x26314d=_['merge']({},_0x26314d,_0x467d4c[_0xe655('0x3f')]);return _0x300901[_0xe655('0x45')](_0x26314d);}})[_0xe655('0x20')](function(_0x3d5d92){if(_0x3d5d92){_0xa30b57=_0x3d5d92[_0xe655('0x30')];if(!_0x467d4c[_0xe655('0x2e')][_0xe655('0x31')]('nolimit')){_0x26314d['limit']=qs[_0xe655('0x33')](_0x467d4c['query'][_0xe655('0x33')]);_0x26314d[_0xe655('0x17')]=qs[_0xe655('0x17')](_0x467d4c[_0xe655('0x2e')][_0xe655('0x17')]);}return _0x300901['getFields'](_0x26314d);}})[_0xe655('0x20')](function(_0x3795a5){if(_0x3795a5){return _0x3795a5?{'count':_0xa30b57,'rows':_0x3795a5}:null;}})[_0xe655('0x20')](respondWithResult(_0x4e5914,null))[_0xe655('0x40')](handleError(_0x4e5914,null));};exports[_0xe655('0x4a')]=function(_0x34fdaf,_0xf581f1,_0x4e9fe0){var _0x39654c={};var _0x442901={};var _0x533e4e;var _0x15aae7;return db[_0xe655('0x39')][_0xe655('0x46')]({'where':{'id':_0x34fdaf[_0xe655('0x43')]['id']}})[_0xe655('0x20')](handleEntityNotFound(_0xf581f1,null))[_0xe655('0x20')](function(_0x17b8b1){if(_0x17b8b1){_0x533e4e=_0x17b8b1;_0x442901[_0xe655('0x2a')]=_['keys'](db[_0xe655('0x47')]['rawAttributes']);_0x442901['query']=_['keys'](_0x34fdaf[_0xe655('0x2e')]);_0x442901['filters']=_[_0xe655('0x2d')](_0x442901['model'],_0x442901[_0xe655('0x2e')]);_0x39654c['attributes']=_['intersection'](_0x442901[_0xe655('0x2a')],qs['fields'](_0x34fdaf[_0xe655('0x2e')][_0xe655('0x3e')]));_0x39654c[_0xe655('0x2f')]=_0x39654c[_0xe655('0x2f')]['length']?_0x39654c[_0xe655('0x2f')]:_0x442901[_0xe655('0x2a')];_0x39654c[_0xe655('0x34')]=qs[_0xe655('0x35')](_0x34fdaf[_0xe655('0x2e')][_0xe655('0x35')]);_0x39654c['where']=qs[_0xe655('0x2c')](_[_0xe655('0x48')](_0x34fdaf['query'],_0x442901[_0xe655('0x2c')]));if(_0x34fdaf[_0xe655('0x2e')][_0xe655('0x49')]){_0x39654c[_0xe655('0x37')]=_[_0xe655('0x36')](_0x39654c['where'],{'$or':_[_0xe655('0x26')](_0x39654c['attributes'],function(_0x512e81){var _0x1a471b={};_0x1a471b[_0x512e81]={'$like':'%'+_0x34fdaf[_0xe655('0x2e')][_0xe655('0x49')]+'%'};return _0x1a471b;})});}_0x39654c=_[_0xe655('0x36')]({},_0x39654c,_0x34fdaf[_0xe655('0x3f')]);return _0x533e4e[_0xe655('0x4a')](_0x39654c);}})['then'](function(_0x5c4d7f){if(_0x5c4d7f){_0x15aae7=_0x5c4d7f[_0xe655('0x30')];if(!_0x34fdaf[_0xe655('0x2e')]['hasOwnProperty'](_0xe655('0x32'))){_0x39654c['limit']=qs[_0xe655('0x33')](_0x34fdaf[_0xe655('0x2e')][_0xe655('0x33')]);_0x39654c['offset']=qs[_0xe655('0x17')](_0x34fdaf[_0xe655('0x2e')][_0xe655('0x17')]);}return _0x533e4e[_0xe655('0x4a')](_0x39654c);}})[_0xe655('0x20')](function(_0x150da3){if(_0x150da3){return _0x150da3?{'count':_0x15aae7,'rows':_0x150da3}:null;}})[_0xe655('0x20')](respondWithResult(_0xf581f1,null))['catch'](handleError(_0xf581f1,null));};exports[_0xe655('0x4b')]=function(_0x58e743,_0x32a1b1,_0x47a072){var _0x3cf1d9={};var _0x1f3cdb={};var _0x7f970a;var _0x448d10;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x58e743[_0xe655('0x43')]['id']}})[_0xe655('0x20')](handleEntityNotFound(_0x32a1b1,null))[_0xe655('0x20')](function(_0x45dc98){if(_0x45dc98){_0x7f970a=_0x45dc98;_0x1f3cdb[_0xe655('0x2a')]=_[_0xe655('0x2b')](db['SalesforceField'][_0xe655('0x4c')]);_0x1f3cdb[_0xe655('0x2e')]=_[_0xe655('0x2b')](_0x58e743[_0xe655('0x2e')]);_0x1f3cdb[_0xe655('0x2c')]=_[_0xe655('0x2d')](_0x1f3cdb[_0xe655('0x2a')],_0x1f3cdb[_0xe655('0x2e')]);_0x3cf1d9['attributes']=_[_0xe655('0x2d')](_0x1f3cdb['model'],qs[_0xe655('0x3e')](_0x58e743['query'][_0xe655('0x3e')]));_0x3cf1d9[_0xe655('0x2f')]=_0x3cf1d9[_0xe655('0x2f')][_0xe655('0x30')]?_0x3cf1d9['attributes']:_0x1f3cdb[_0xe655('0x2a')];_0x3cf1d9['order']=qs[_0xe655('0x35')](_0x58e743[_0xe655('0x2e')][_0xe655('0x35')]);_0x3cf1d9[_0xe655('0x37')]=qs[_0xe655('0x2c')](_[_0xe655('0x48')](_0x58e743['query'],_0x1f3cdb[_0xe655('0x2c')]));if(_0x58e743[_0xe655('0x2e')][_0xe655('0x49')]){_0x3cf1d9[_0xe655('0x37')]=_[_0xe655('0x36')](_0x3cf1d9[_0xe655('0x37')],{'$or':_[_0xe655('0x26')](_0x3cf1d9[_0xe655('0x2f')],function(_0x2506c3){var _0x5b8986={};_0x5b8986[_0x2506c3]={'$like':'%'+_0x58e743[_0xe655('0x2e')][_0xe655('0x49')]+'%'};return _0x5b8986;})});}_0x3cf1d9=_[_0xe655('0x36')]({},_0x3cf1d9,_0x58e743['options']);return _0x7f970a[_0xe655('0x4b')](_0x3cf1d9);}})[_0xe655('0x20')](function(_0x415ba8){if(_0x415ba8){_0x448d10=_0x415ba8[_0xe655('0x30')];if(!_0x58e743[_0xe655('0x2e')][_0xe655('0x31')](_0xe655('0x32'))){_0x3cf1d9['limit']=qs[_0xe655('0x33')](_0x58e743[_0xe655('0x2e')][_0xe655('0x33')]);_0x3cf1d9['offset']=qs[_0xe655('0x17')](_0x58e743[_0xe655('0x2e')][_0xe655('0x17')]);}return _0x7f970a[_0xe655('0x4b')](_0x3cf1d9);}})[_0xe655('0x20')](function(_0xe2a505){if(_0xe2a505){return _0xe2a505?{'count':_0x448d10,'rows':_0xe2a505}:null;}})[_0xe655('0x20')](respondWithResult(_0x32a1b1,null))['catch'](handleError(_0x32a1b1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9818430..8e1a8c5 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 _0x99d7=['SalesforceConfiguration','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x45aa18,_0x412fc5){var _0x26119d=function(_0x68dcc6){while(--_0x68dcc6){_0x45aa18['push'](_0x45aa18['shift']());}};_0x26119d(++_0x412fc5);}(_0x99d7,0x129));var _0x799d=function(_0x5bfaa1,_0x1aeaf2){_0x5bfaa1=_0x5bfaa1-0x0;var _0x2a4846=_0x99d7[_0x5bfaa1];return _0x2a4846;};'use strict';var _=require(_0x799d('0x0'));var util=require('util');var logger=require(_0x799d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x799d('0x2'));var rp=require(_0x799d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x799d('0x4'));var attributes=require(_0x799d('0x5'));module[_0x799d('0x6')]=function(_0x31e504,_0x15002a){return _0x31e504['define'](_0x799d('0x7'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf85e=['bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','int_salesforce_configurations','util','../../config/logger','api','moment'];(function(_0x2cce72,_0x432665){var _0xe78e46=function(_0x5d2992){while(--_0x5d2992){_0x2cce72['push'](_0x2cce72['shift']());}};_0xe78e46(++_0x432665);}(_0xf85e,0x18c));var _0xef85=function(_0xee29b8,_0x27136a){_0xee29b8=_0xee29b8-0x0;var _0x1ecc43=_0xf85e[_0xee29b8];return _0x1ecc43;};'use strict';var _=require('lodash');var util=require(_0xef85('0x0'));var logger=require(_0xef85('0x1'))(_0xef85('0x2'));var moment=require(_0xef85('0x3'));var BPromise=require(_0xef85('0x4'));var rp=require(_0xef85('0x5'));var fs=require('fs');var path=require(_0xef85('0x6'));var rimraf=require('rimraf');var config=require(_0xef85('0x7'));var attributes=require(_0xef85('0x8'));module['exports']=function(_0x1acbd0,_0x3d0082){return _0x1acbd0['define']('SalesforceConfiguration',attributes,{'tableName':_0xef85('0x9'),'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 8e28da4..0ad7e16 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 _0xd1ee=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5207b3,_0x50a1ef){var _0x59babd=function(_0x2aeeff){while(--_0x2aeeff){_0x5207b3['push'](_0x5207b3['shift']());}};_0x59babd(++_0x50a1ef);}(_0xd1ee,0x1ca));var _0xed1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd1ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xed1e('0x0'));var util=require(_0xed1e('0x1'));var moment=require(_0xed1e('0x2'));var BPromise=require('bluebird');var rs=require(_0xed1e('0x3'));var fs=require('fs');var Redis=require(_0xed1e('0x4'));var db=require(_0xed1e('0x5'))['db'];var utils=require(_0xed1e('0x6'));var logger=require(_0xed1e('0x7'))(_0xed1e('0x8'));var config=require(_0xed1e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xed1e('0xa')][_0xed1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x434333,_0x56467d,_0x2d8864){return new BPromise(function(_0xce411,_0x2683c6){return client[_0xed1e('0xc')](_0x434333,_0x2d8864)[_0xed1e('0xd')](function(_0x1381b6){logger['info'](_0xed1e('0xe'),_0x56467d,_0xed1e('0xf'));logger[_0xed1e('0x10')](_0xed1e('0x11'),_0x56467d,_0xed1e('0xf'),JSON[_0xed1e('0x12')](_0x1381b6));if(_0x1381b6[_0xed1e('0x13')]){if(_0x1381b6['error'][_0xed1e('0x14')]===0x1f4){logger['error'](_0xed1e('0xe'),_0x56467d,_0x1381b6[_0xed1e('0x13')][_0xed1e('0x15')]);return _0x2683c6(_0x1381b6[_0xed1e('0x13')][_0xed1e('0x15')]);}logger[_0xed1e('0x13')](_0xed1e('0xe'),_0x56467d,_0x1381b6[_0xed1e('0x13')][_0xed1e('0x15')]);return _0xce411(_0x1381b6[_0xed1e('0x13')][_0xed1e('0x15')]);}else{logger['info'](_0xed1e('0xe'),_0x56467d,'request\x20sent');_0xce411(_0x1381b6[_0xed1e('0x16')][_0xed1e('0x15')]);}})[_0xed1e('0x17')](function(_0x1d20d5){logger[_0xed1e('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x56467d,_0x1d20d5);_0x2683c6(_0x1d20d5);});});} \ No newline at end of file +var _0x1c6f=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis'];(function(_0x309b7d,_0x4ebcba){var _0x3cd371=function(_0x1538ad){while(--_0x1538ad){_0x309b7d['push'](_0x309b7d['shift']());}};_0x3cd371(++_0x4ebcba);}(_0x1c6f,0x1c9));var _0xf1c6=function(_0x45fd10,_0x5a1081){_0x45fd10=_0x45fd10-0x0;var _0x45c634=_0x1c6f[_0x45fd10];return _0x45c634;};'use strict';var _=require(_0xf1c6('0x0'));var util=require(_0xf1c6('0x1'));var moment=require('moment');var BPromise=require(_0xf1c6('0x2'));var rs=require(_0xf1c6('0x3'));var fs=require('fs');var Redis=require(_0xf1c6('0x4'));var db=require(_0xf1c6('0x5'))['db'];var utils=require(_0xf1c6('0x6'));var logger=require('../../config/logger')(_0xf1c6('0x7'));var config=require(_0xf1c6('0x8'));var jayson=require(_0xf1c6('0x9'));var client=jayson[_0xf1c6('0xa')][_0xf1c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ed79b,_0x13fede,_0x1e96f2){return new BPromise(function(_0x4d1c42,_0x39bd5c){return client['request'](_0x3ed79b,_0x1e96f2)[_0xf1c6('0xc')](function(_0x36b71f){logger[_0xf1c6('0xd')](_0xf1c6('0xe'),_0x13fede,'request\x20sent');logger[_0xf1c6('0xf')](_0xf1c6('0x10'),_0x13fede,_0xf1c6('0x11'),JSON[_0xf1c6('0x12')](_0x36b71f));if(_0x36b71f[_0xf1c6('0x13')]){if(_0x36b71f[_0xf1c6('0x13')][_0xf1c6('0x14')]===0x1f4){logger[_0xf1c6('0x13')](_0xf1c6('0xe'),_0x13fede,_0x36b71f[_0xf1c6('0x13')]['message']);return _0x39bd5c(_0x36b71f[_0xf1c6('0x13')][_0xf1c6('0x15')]);}logger[_0xf1c6('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x13fede,_0x36b71f['error'][_0xf1c6('0x15')]);return _0x4d1c42(_0x36b71f['error'][_0xf1c6('0x15')]);}else{logger[_0xf1c6('0xd')](_0xf1c6('0xe'),_0x13fede,'request\x20sent');_0x4d1c42(_0x36b71f['result']['message']);}})['catch'](function(_0x5739fc){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x13fede,_0x5739fc);_0x39bd5c(_0x5739fc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 209fada..3f6610a 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 _0x80b2=['/:id','show','post','create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x57532c,_0x2c75cf){var _0x5cb9a6=function(_0x3a4dea){while(--_0x3a4dea){_0x57532c['push'](_0x57532c['shift']());}};_0x5cb9a6(++_0x2c75cf);}(_0x80b2,0x137));var _0x280b=function(_0x5dbac8,_0x2a86b3){_0x5dbac8=_0x5dbac8-0x0;var _0x4f5535=_0x80b2[_0x5dbac8];return _0x4f5535;};'use strict';var multer=require(_0x280b('0x0'));var util=require(_0x280b('0x1'));var path=require(_0x280b('0x2'));var timeout=require('connect-timeout');var express=require(_0x280b('0x3'));var router=express[_0x280b('0x4')]();var fs_extra=require(_0x280b('0x5'));var auth=require(_0x280b('0x6'));var interaction=require(_0x280b('0x7'));var config=require(_0x280b('0x8'));var controller=require('./intSalesforceField.controller');router[_0x280b('0x9')]('/',auth[_0x280b('0xa')](),controller[_0x280b('0xb')]);router[_0x280b('0x9')](_0x280b('0xc'),auth[_0x280b('0xa')](),controller[_0x280b('0xd')]);router[_0x280b('0xe')]('/',auth[_0x280b('0xa')](),controller[_0x280b('0xf')]);router[_0x280b('0x10')](_0x280b('0xc'),auth[_0x280b('0xa')](),controller['update']);router[_0x280b('0x11')](_0x280b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x280b('0x12')]=router; \ No newline at end of file +var _0x8950=['./intSalesforceField.controller','get','isAuthenticated','show','post','/:id','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x46a4bb,_0x2b1149){var _0x45660f=function(_0x1fe1b5){while(--_0x1fe1b5){_0x46a4bb['push'](_0x46a4bb['shift']());}};_0x45660f(++_0x2b1149);}(_0x8950,0x171));var _0x0895=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8950[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x0895('0x0'));var util=require(_0x0895('0x1'));var path=require(_0x0895('0x2'));var timeout=require(_0x0895('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0895('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0895('0x5'));var controller=require(_0x0895('0x6'));router[_0x0895('0x7')]('/',auth[_0x0895('0x8')](),controller['index']);router['get']('/:id',auth[_0x0895('0x8')](),controller[_0x0895('0x9')]);router[_0x0895('0xa')]('/',auth[_0x0895('0x8')](),controller['create']);router['put'](_0x0895('0xb'),auth[_0x0895('0x8')](),controller[_0x0895('0xc')]);router[_0x0895('0xd')](_0x0895('0xb'),auth[_0x0895('0x8')](),controller['destroy']);module[_0x0895('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 58e398e..9c17ebb 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 _0x4d89=['variable','customVariable','keyValue','picklist','STRING','sequelize','string'];(function(_0x5d25ac,_0x3f57f5){var _0x1c7b34=function(_0x41a6da){while(--_0x41a6da){_0x5d25ac['push'](_0x5d25ac['shift']());}};_0x1c7b34(++_0x3f57f5);}(_0x4d89,0x108));var _0x94d8=function(_0x58c7b5,_0x2cb0cf){_0x58c7b5=_0x58c7b5-0x0;var _0x2a7da1=_0x4d89[_0x58c7b5];return _0x2a7da1;};'use strict';var Sequelize=require(_0x94d8('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x94d8('0x1'),_0x94d8('0x2'),_0x94d8('0x3'),_0x94d8('0x4'),_0x94d8('0x5')),'defaultValue':_0x94d8('0x1')},'content':{'type':Sequelize[_0x94d8('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x94d8('0x1'),_0x94d8('0x2'),_0x94d8('0x3'))},'keyContent':{'type':Sequelize[_0x94d8('0x6')]},'idField':{'type':Sequelize[_0x94d8('0x6')]},'variableName':{'type':Sequelize[_0x94d8('0x6')]}}; \ No newline at end of file +var _0x15e2=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x579b84,_0x1f6922){var _0x423049=function(_0x32a1ac){while(--_0x32a1ac){_0x579b84['push'](_0x579b84['shift']());}};_0x423049(++_0x1f6922);}(_0x15e2,0x7c));var _0x215e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x15e2[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0x215e('0x0'));module[_0x215e('0x1')]={'type':{'type':Sequelize[_0x215e('0x2')](_0x215e('0x3'),_0x215e('0x4'),_0x215e('0x5'),'keyValue',_0x215e('0x6')),'defaultValue':_0x215e('0x3')},'content':{'type':Sequelize[_0x215e('0x7')]},'key':{'type':Sequelize[_0x215e('0x7')]},'keyType':{'type':Sequelize[_0x215e('0x2')]('string',_0x215e('0x4'),_0x215e('0x5'))},'keyContent':{'type':Sequelize[_0x215e('0x7')]},'idField':{'type':Sequelize[_0x215e('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f1da292..0c9acaa 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 _0xc2fb=['fieldName','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','keys','rawAttributes','fields','length','options','find','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','name','index','map','SalesforceField'];(function(_0x2da69c,_0x4f12bf){var _0x546d6c=function(_0x4b233a){while(--_0x4b233a){_0x2da69c['push'](_0x2da69c['shift']());}};_0x546d6c(++_0x4f12bf);}(_0xc2fb,0x1d8));var _0xbc2f=function(_0x436c8c,_0x6b37b){_0x436c8c=_0x436c8c-0x0;var _0x5f5739=_0xc2fb[_0x436c8c];return _0x5f5739;};'use strict';var emlformat=require(_0xbc2f('0x0'));var rimraf=require(_0xbc2f('0x1'));var zipdir=require(_0xbc2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc2f('0x3'));var moment=require(_0xbc2f('0x4'));var BPromise=require(_0xbc2f('0x5'));var Mustache=require('mustache');var util=require(_0xbc2f('0x6'));var path=require(_0xbc2f('0x7'));var sox=require(_0xbc2f('0x8'));var csv=require(_0xbc2f('0x9'));var ejs=require(_0xbc2f('0xa'));var fs=require('fs');var fs_extra=require(_0xbc2f('0xb'));var _=require(_0xbc2f('0xc'));var squel=require('squel');var crypto=require(_0xbc2f('0xd'));var jsforce=require(_0xbc2f('0xe'));var deskjs=require(_0xbc2f('0xf'));var toCsv=require(_0xbc2f('0x9'));var querystring=require(_0xbc2f('0x10'));var Papa=require(_0xbc2f('0x11'));var Redis=require('ioredis');var authService=require(_0xbc2f('0x12'));var qs=require(_0xbc2f('0x13'));var as=require(_0xbc2f('0x14'));var hardwareService=require(_0xbc2f('0x15'));var logger=require(_0xbc2f('0x16'))('api');var utils=require(_0xbc2f('0x17'));var config=require(_0xbc2f('0x18'));var licenseUtil=require(_0xbc2f('0x19'));var db=require(_0xbc2f('0x1a'))['db'];function respondWithStatusCode(_0x19d1cf,_0x3635d3){_0x3635d3=_0x3635d3||0xcc;return function(_0x1185df){if(_0x1185df){return _0x19d1cf[_0xbc2f('0x1b')](_0x3635d3);}return _0x19d1cf[_0xbc2f('0x1c')](_0x3635d3)[_0xbc2f('0x1d')]();};}function respondWithResult(_0x307cbc,_0x4d73e3){_0x4d73e3=_0x4d73e3||0xc8;return function(_0x4be97c){if(_0x4be97c){return _0x307cbc[_0xbc2f('0x1c')](_0x4d73e3)[_0xbc2f('0x1e')](_0x4be97c);}};}function respondWithFilteredResult(_0x336140,_0x37910c){return function(_0x4f4466){if(_0x4f4466){var _0x5efe0f=typeof _0x37910c[_0xbc2f('0x1f')]===_0xbc2f('0x20')&&typeof _0x37910c[_0xbc2f('0x21')]==='undefined';var _0x17a0b7=_0x4f4466[_0xbc2f('0x22')];var _0x4e731d=_0x5efe0f?0x0:_0x37910c['offset'];var _0x2a7db2=_0x5efe0f?_0x4f4466[_0xbc2f('0x22')]:_0x37910c['offset']+_0x37910c[_0xbc2f('0x21')];var _0x28eb3e;if(_0x2a7db2>=_0x17a0b7){_0x2a7db2=_0x17a0b7;_0x28eb3e=0xc8;}else{_0x28eb3e=0xce;}_0x336140[_0xbc2f('0x1c')](_0x28eb3e);return _0x336140[_0xbc2f('0x23')](_0xbc2f('0x24'),_0x4e731d+'-'+_0x2a7db2+'/'+_0x17a0b7)[_0xbc2f('0x1e')](_0x4f4466);}return null;};}function patchUpdates(_0x45afdd){return function(_0x14aad3){try{jsonpatch['apply'](_0x14aad3,_0x45afdd,!![]);}catch(_0x11df90){return BPromise[_0xbc2f('0x25')](_0x11df90);}return _0x14aad3['save']();};}function saveUpdates(_0x1523dd,_0x3e7635){return function(_0x4bf959){if(_0x4bf959){return _0x4bf959[_0xbc2f('0x26')](_0x1523dd)[_0xbc2f('0x27')](function(_0x26de67){return _0x26de67;});}return null;};}function removeEntity(_0x25a198,_0x45ef12){return function(_0x2f6e87){if(_0x2f6e87){return _0x2f6e87[_0xbc2f('0x28')]()['then'](function(){_0x25a198[_0xbc2f('0x1c')](0xcc)[_0xbc2f('0x1d')]();});}};}function handleEntityNotFound(_0x187613,_0x45b148){return function(_0x5b1fe5){if(!_0x5b1fe5){_0x187613['sendStatus'](0x194);}return _0x5b1fe5;};}function handleError(_0x3a0d05,_0x5bed89){_0x5bed89=_0x5bed89||0x1f4;return function(_0x5959b8){logger[_0xbc2f('0x29')](_0x5959b8['stack']);if(_0x5959b8[_0xbc2f('0x2a')]){delete _0x5959b8[_0xbc2f('0x2a')];}_0x3a0d05[_0xbc2f('0x1c')](_0x5bed89)['send'](_0x5959b8);};}exports[_0xbc2f('0x2b')]=function(_0x26ecd4,_0x258e3a){var _0x464fde={},_0x42ecc4={},_0x53b4c6={'count':0x0,'rows':[]};var _0xab03a3=_[_0xbc2f('0x2c')](db[_0xbc2f('0x2d')]['rawAttributes'],function(_0x349453){return{'name':_0x349453[_0xbc2f('0x2e')],'type':_0x349453[_0xbc2f('0x2f')]['key']};});_0x42ecc4[_0xbc2f('0x30')]=_['map'](_0xab03a3,_0xbc2f('0x2a'));_0x42ecc4[_0xbc2f('0x31')]=_['keys'](_0x26ecd4[_0xbc2f('0x31')]);_0x42ecc4[_0xbc2f('0x32')]=_['intersection'](_0x42ecc4[_0xbc2f('0x30')],_0x42ecc4[_0xbc2f('0x31')]);_0x464fde['attributes']=_[_0xbc2f('0x33')](_0x42ecc4[_0xbc2f('0x30')],qs['fields'](_0x26ecd4[_0xbc2f('0x31')]['fields']));_0x464fde['attributes']=_0x464fde[_0xbc2f('0x34')]['length']?_0x464fde[_0xbc2f('0x34')]:_0x42ecc4['model'];if(!_0x26ecd4[_0xbc2f('0x31')][_0xbc2f('0x35')](_0xbc2f('0x36'))){_0x464fde[_0xbc2f('0x21')]=qs[_0xbc2f('0x21')](_0x26ecd4['query']['limit']);_0x464fde[_0xbc2f('0x1f')]=qs[_0xbc2f('0x1f')](_0x26ecd4[_0xbc2f('0x31')]['offset']);}_0x464fde[_0xbc2f('0x37')]=qs[_0xbc2f('0x38')](_0x26ecd4['query']['sort']);_0x464fde[_0xbc2f('0x39')]=qs['filters'](_[_0xbc2f('0x3a')](_0x26ecd4[_0xbc2f('0x31')],_0x42ecc4[_0xbc2f('0x32')]),_0xab03a3);if(_0x26ecd4[_0xbc2f('0x31')][_0xbc2f('0x3b')]){_0x464fde[_0xbc2f('0x39')]=_[_0xbc2f('0x3c')](_0x464fde[_0xbc2f('0x39')],{'$or':_[_0xbc2f('0x2c')](_0xab03a3,function(_0xd9cfbc){if(_0xd9cfbc[_0xbc2f('0x2f')]!=='VIRTUAL'){var _0x453d4e={};_0x453d4e[_0xd9cfbc[_0xbc2f('0x2a')]]={'$like':'%'+_0x26ecd4[_0xbc2f('0x31')][_0xbc2f('0x3b')]+'%'};return _0x453d4e;}})});}_0x464fde=_[_0xbc2f('0x3c')]({},_0x464fde,_0x26ecd4['options']);var _0x37e730={'where':_0x464fde[_0xbc2f('0x39')]};return db[_0xbc2f('0x2d')][_0xbc2f('0x22')](_0x37e730)['then'](function(_0x25346a){_0x53b4c6['count']=_0x25346a;if(_0x26ecd4[_0xbc2f('0x31')][_0xbc2f('0x3d')]){_0x464fde[_0xbc2f('0x3e')]=[{'all':!![]}];}return db['SalesforceField'][_0xbc2f('0x3f')](_0x464fde);})[_0xbc2f('0x27')](function(_0x9ba21a){_0x53b4c6['rows']=_0x9ba21a;return _0x53b4c6;})[_0xbc2f('0x27')](respondWithFilteredResult(_0x258e3a,_0x464fde))[_0xbc2f('0x40')](handleError(_0x258e3a,null));};exports[_0xbc2f('0x41')]=function(_0xb8b718,_0x3e31ec){var _0x4ac011={'raw':!![],'where':{'id':_0xb8b718[_0xbc2f('0x42')]['id']}},_0x60ac57={};_0x60ac57['model']=_[_0xbc2f('0x43')](db[_0xbc2f('0x2d')][_0xbc2f('0x44')]);_0x60ac57[_0xbc2f('0x31')]=_[_0xbc2f('0x43')](_0xb8b718[_0xbc2f('0x31')]);_0x60ac57[_0xbc2f('0x32')]=_[_0xbc2f('0x33')](_0x60ac57[_0xbc2f('0x30')],_0x60ac57['query']);_0x4ac011[_0xbc2f('0x34')]=_['intersection'](_0x60ac57[_0xbc2f('0x30')],qs[_0xbc2f('0x45')](_0xb8b718[_0xbc2f('0x31')][_0xbc2f('0x45')]));_0x4ac011[_0xbc2f('0x34')]=_0x4ac011[_0xbc2f('0x34')][_0xbc2f('0x46')]?_0x4ac011['attributes']:_0x60ac57[_0xbc2f('0x30')];if(_0xb8b718[_0xbc2f('0x31')]['includeAll']){_0x4ac011['include']=[{'all':!![]}];}_0x4ac011=_[_0xbc2f('0x3c')]({},_0x4ac011,_0xb8b718[_0xbc2f('0x47')]);return db[_0xbc2f('0x2d')][_0xbc2f('0x48')](_0x4ac011)[_0xbc2f('0x27')](handleEntityNotFound(_0x3e31ec,null))[_0xbc2f('0x27')](respondWithResult(_0x3e31ec,null))[_0xbc2f('0x40')](handleError(_0x3e31ec,null));};exports['create']=function(_0x288c02,_0x2b9a09){return db[_0xbc2f('0x2d')]['create'](_0x288c02[_0xbc2f('0x49')],{})[_0xbc2f('0x27')](respondWithResult(_0x2b9a09,0xc9))[_0xbc2f('0x40')](handleError(_0x2b9a09,null));};exports['update']=function(_0x57767b,_0x391ec0){if(_0x57767b['body']['id']){delete _0x57767b[_0xbc2f('0x49')]['id'];}return db[_0xbc2f('0x2d')]['find']({'where':{'id':_0x57767b['params']['id']}})[_0xbc2f('0x27')](handleEntityNotFound(_0x391ec0,null))[_0xbc2f('0x27')](saveUpdates(_0x57767b[_0xbc2f('0x49')],null))[_0xbc2f('0x27')](respondWithResult(_0x391ec0,null))[_0xbc2f('0x40')](handleError(_0x391ec0,null));};exports[_0xbc2f('0x28')]=function(_0x430714,_0x5dea11){return db['SalesforceField']['find']({'where':{'id':_0x430714['params']['id']}})[_0xbc2f('0x27')](handleEntityNotFound(_0x5dea11,null))[_0xbc2f('0x27')](removeEntity(_0x5dea11,null))[_0xbc2f('0x40')](handleError(_0x5dea11,null));}; \ No newline at end of file +var _0x843b=['create','body','update','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','reject','then','destroy','error','name','send','index','SalesforceField','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x5e800a,_0x3d2d3e){var _0xe64935=function(_0x3654b4){while(--_0x3654b4){_0x5e800a['push'](_0x5e800a['shift']());}};_0xe64935(++_0x3d2d3e);}(_0x843b,0x1f4));var _0xb843=function(_0x1e64d0,_0x430bb7){_0x1e64d0=_0x1e64d0-0x0;var _0x544098=_0x843b[_0x1e64d0];return _0x544098;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb843('0x0'));var rp=require(_0xb843('0x1'));var moment=require(_0xb843('0x2'));var BPromise=require(_0xb843('0x3'));var Mustache=require(_0xb843('0x4'));var util=require('util');var path=require(_0xb843('0x5'));var sox=require('sox');var csv=require(_0xb843('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb843('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb843('0x8'));var jsforce=require(_0xb843('0x9'));var deskjs=require(_0xb843('0xa'));var toCsv=require(_0xb843('0x6'));var querystring=require(_0xb843('0xb'));var Papa=require(_0xb843('0xc'));var Redis=require(_0xb843('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb843('0xe'));var as=require(_0xb843('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb843('0x10'))(_0xb843('0x11'));var utils=require('../../config/utils');var config=require(_0xb843('0x12'));var licenseUtil=require(_0xb843('0x13'));var db=require(_0xb843('0x14'))['db'];function respondWithStatusCode(_0xe83a14,_0x58e93d){_0x58e93d=_0x58e93d||0xcc;return function(_0x1cf5e6){if(_0x1cf5e6){return _0xe83a14[_0xb843('0x15')](_0x58e93d);}return _0xe83a14[_0xb843('0x16')](_0x58e93d)[_0xb843('0x17')]();};}function respondWithResult(_0x54622a,_0x12cdb8){_0x12cdb8=_0x12cdb8||0xc8;return function(_0x7413ee){if(_0x7413ee){return _0x54622a['status'](_0x12cdb8)['json'](_0x7413ee);}};}function respondWithFilteredResult(_0x5cf6c4,_0xe9586c){return function(_0x40d4b1){if(_0x40d4b1){var _0xf8b823=typeof _0xe9586c[_0xb843('0x18')]===_0xb843('0x19')&&typeof _0xe9586c['limit']===_0xb843('0x19');var _0x1e5e74=_0x40d4b1['count'];var _0x48f581=_0xf8b823?0x0:_0xe9586c['offset'];var _0x42c53d=_0xf8b823?_0x40d4b1['count']:_0xe9586c['offset']+_0xe9586c[_0xb843('0x1a')];var _0x40aa89;if(_0x42c53d>=_0x1e5e74){_0x42c53d=_0x1e5e74;_0x40aa89=0xc8;}else{_0x40aa89=0xce;}_0x5cf6c4[_0xb843('0x16')](_0x40aa89);return _0x5cf6c4[_0xb843('0x1b')]('Content-Range',_0x48f581+'-'+_0x42c53d+'/'+_0x1e5e74)['json'](_0x40d4b1);}return null;};}function patchUpdates(_0x4f0e4c){return function(_0x16d791){try{jsonpatch['apply'](_0x16d791,_0x4f0e4c,!![]);}catch(_0x27625d){return BPromise[_0xb843('0x1c')](_0x27625d);}return _0x16d791['save']();};}function saveUpdates(_0x3e578c,_0x28d155){return function(_0x50ac3c){if(_0x50ac3c){return _0x50ac3c['update'](_0x3e578c)[_0xb843('0x1d')](function(_0x325eef){return _0x325eef;});}return null;};}function removeEntity(_0x5b86a8,_0x559835){return function(_0x1fb3a1){if(_0x1fb3a1){return _0x1fb3a1[_0xb843('0x1e')]()[_0xb843('0x1d')](function(){_0x5b86a8[_0xb843('0x16')](0xcc)[_0xb843('0x17')]();});}};}function handleEntityNotFound(_0x2eb8c7,_0x5b1ee0){return function(_0x41347b){if(!_0x41347b){_0x2eb8c7[_0xb843('0x15')](0x194);}return _0x41347b;};}function handleError(_0x2e5305,_0xe312ee){_0xe312ee=_0xe312ee||0x1f4;return function(_0x464a24){logger[_0xb843('0x1f')](_0x464a24['stack']);if(_0x464a24[_0xb843('0x20')]){delete _0x464a24[_0xb843('0x20')];}_0x2e5305['status'](_0xe312ee)[_0xb843('0x21')](_0x464a24);};}exports[_0xb843('0x22')]=function(_0x2bf48f,_0x580338){var _0x1119af={},_0x49dcd6={},_0x50d32c={'count':0x0,'rows':[]};var _0x4330fd=_['map'](db[_0xb843('0x23')][_0xb843('0x24')],function(_0x1e721c){return{'name':_0x1e721c[_0xb843('0x25')],'type':_0x1e721c['type'][_0xb843('0x26')]};});_0x49dcd6['model']=_[_0xb843('0x27')](_0x4330fd,_0xb843('0x20'));_0x49dcd6[_0xb843('0x28')]=_[_0xb843('0x29')](_0x2bf48f[_0xb843('0x28')]);_0x49dcd6['filters']=_[_0xb843('0x2a')](_0x49dcd6[_0xb843('0x2b')],_0x49dcd6[_0xb843('0x28')]);_0x1119af[_0xb843('0x2c')]=_[_0xb843('0x2a')](_0x49dcd6[_0xb843('0x2b')],qs[_0xb843('0x2d')](_0x2bf48f['query'][_0xb843('0x2d')]));_0x1119af[_0xb843('0x2c')]=_0x1119af[_0xb843('0x2c')][_0xb843('0x2e')]?_0x1119af[_0xb843('0x2c')]:_0x49dcd6[_0xb843('0x2b')];if(!_0x2bf48f[_0xb843('0x28')][_0xb843('0x2f')](_0xb843('0x30'))){_0x1119af[_0xb843('0x1a')]=qs[_0xb843('0x1a')](_0x2bf48f[_0xb843('0x28')][_0xb843('0x1a')]);_0x1119af[_0xb843('0x18')]=qs[_0xb843('0x18')](_0x2bf48f[_0xb843('0x28')][_0xb843('0x18')]);}_0x1119af[_0xb843('0x31')]=qs[_0xb843('0x32')](_0x2bf48f['query'][_0xb843('0x32')]);_0x1119af[_0xb843('0x33')]=qs[_0xb843('0x34')](_[_0xb843('0x35')](_0x2bf48f[_0xb843('0x28')],_0x49dcd6[_0xb843('0x34')]),_0x4330fd);if(_0x2bf48f[_0xb843('0x28')][_0xb843('0x36')]){_0x1119af['where']=_['merge'](_0x1119af['where'],{'$or':_[_0xb843('0x27')](_0x4330fd,function(_0x4f6449){if(_0x4f6449[_0xb843('0x37')]!==_0xb843('0x38')){var _0x3f7c56={};_0x3f7c56[_0x4f6449[_0xb843('0x20')]]={'$like':'%'+_0x2bf48f[_0xb843('0x28')][_0xb843('0x36')]+'%'};return _0x3f7c56;}})});}_0x1119af=_[_0xb843('0x39')]({},_0x1119af,_0x2bf48f[_0xb843('0x3a')]);var _0x381f03={'where':_0x1119af['where']};return db['SalesforceField']['count'](_0x381f03)['then'](function(_0x31f1c3){_0x50d32c[_0xb843('0x3b')]=_0x31f1c3;if(_0x2bf48f[_0xb843('0x28')][_0xb843('0x3c')]){_0x1119af['include']=[{'all':!![]}];}return db[_0xb843('0x23')][_0xb843('0x3d')](_0x1119af);})[_0xb843('0x1d')](function(_0x5e5577){_0x50d32c[_0xb843('0x3e')]=_0x5e5577;return _0x50d32c;})[_0xb843('0x1d')](respondWithFilteredResult(_0x580338,_0x1119af))[_0xb843('0x3f')](handleError(_0x580338,null));};exports[_0xb843('0x40')]=function(_0x15bc77,_0x1f68e4){var _0x47e7c7={'raw':!![],'where':{'id':_0x15bc77[_0xb843('0x41')]['id']}},_0xcda567={};_0xcda567[_0xb843('0x2b')]=_['keys'](db[_0xb843('0x23')][_0xb843('0x24')]);_0xcda567[_0xb843('0x28')]=_['keys'](_0x15bc77[_0xb843('0x28')]);_0xcda567[_0xb843('0x34')]=_[_0xb843('0x2a')](_0xcda567['model'],_0xcda567[_0xb843('0x28')]);_0x47e7c7['attributes']=_[_0xb843('0x2a')](_0xcda567[_0xb843('0x2b')],qs['fields'](_0x15bc77[_0xb843('0x28')][_0xb843('0x2d')]));_0x47e7c7[_0xb843('0x2c')]=_0x47e7c7[_0xb843('0x2c')][_0xb843('0x2e')]?_0x47e7c7[_0xb843('0x2c')]:_0xcda567[_0xb843('0x2b')];if(_0x15bc77[_0xb843('0x28')][_0xb843('0x3c')]){_0x47e7c7[_0xb843('0x42')]=[{'all':!![]}];}_0x47e7c7=_[_0xb843('0x39')]({},_0x47e7c7,_0x15bc77['options']);return db[_0xb843('0x23')][_0xb843('0x43')](_0x47e7c7)[_0xb843('0x1d')](handleEntityNotFound(_0x1f68e4,null))[_0xb843('0x1d')](respondWithResult(_0x1f68e4,null))[_0xb843('0x3f')](handleError(_0x1f68e4,null));};exports[_0xb843('0x44')]=function(_0x1b267d,_0x59202f){return db[_0xb843('0x23')][_0xb843('0x44')](_0x1b267d[_0xb843('0x45')],{})[_0xb843('0x1d')](respondWithResult(_0x59202f,0xc9))[_0xb843('0x3f')](handleError(_0x59202f,null));};exports[_0xb843('0x46')]=function(_0x32ccdf,_0x44da14){if(_0x32ccdf[_0xb843('0x45')]['id']){delete _0x32ccdf[_0xb843('0x45')]['id'];}return db['SalesforceField'][_0xb843('0x43')]({'where':{'id':_0x32ccdf[_0xb843('0x41')]['id']}})['then'](handleEntityNotFound(_0x44da14,null))[_0xb843('0x1d')](saveUpdates(_0x32ccdf[_0xb843('0x45')],null))[_0xb843('0x1d')](respondWithResult(_0x44da14,null))[_0xb843('0x3f')](handleError(_0x44da14,null));};exports[_0xb843('0x1e')]=function(_0x1aa724,_0x15c994){return db[_0xb843('0x23')][_0xb843('0x43')]({'where':{'id':_0x1aa724[_0xb843('0x41')]['id']}})['then'](handleEntityNotFound(_0x15c994,null))['then'](removeEntity(_0x15c994,null))[_0xb843('0x3f')](handleError(_0x15c994,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b62be12..1de32f4 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 _0x5e69=['rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','idField','util','../../config/logger','api','moment','request-promise'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0x5e69,0x1c3));var _0x95e6=function(_0x17e4ac,_0x315ed6){_0x17e4ac=_0x17e4ac-0x0;var _0x7a9a6a=_0x5e69[_0x17e4ac];return _0x7a9a6a;};'use strict';var _=require('lodash');var util=require(_0x95e6('0x0'));var logger=require(_0x95e6('0x1'))(_0x95e6('0x2'));var moment=require(_0x95e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x95e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95e6('0x5'));var config=require(_0x95e6('0x6'));var attributes=require(_0x95e6('0x7'));module['exports']=function(_0x2d0fb3,_0x47cdec){return _0x2d0fb3[_0x95e6('0x8')](_0x95e6('0x9'),attributes,{'tableName':_0x95e6('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x95e6('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33b6=['salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SalesforceField'];(function(_0x5aa21c,_0x930a47){var _0x5828c9=function(_0x2fea2a){while(--_0x2fea2a){_0x5aa21c['push'](_0x5aa21c['shift']());}};_0x5828c9(++_0x930a47);}(_0x33b6,0x1c3));var _0x633b=function(_0x32a6b6,_0x5b4051){_0x32a6b6=_0x32a6b6-0x0;var _0x1f0d46=_0x33b6[_0x32a6b6];return _0x1f0d46;};'use strict';var _=require(_0x633b('0x0'));var util=require('util');var logger=require(_0x633b('0x1'))(_0x633b('0x2'));var moment=require(_0x633b('0x3'));var BPromise=require(_0x633b('0x4'));var rp=require(_0x633b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x633b('0x6'));var config=require(_0x633b('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x633b('0x8')]=function(_0x7906d7,_0x5978fc){return _0x7906d7[_0x633b('0x9')](_0x633b('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x633b('0xb'),'fields':[_0x633b('0xc'),_0x633b('0xd')],'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 03d14f0..5b6af3e 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 _0x49ba=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0x49ba,0x130));var _0xa49b=function(_0x450a2f,_0x4ce6ce){_0x450a2f=_0x450a2f-0x0;var _0x98eebb=_0x49ba[_0x450a2f];return _0x98eebb;};'use strict';var _=require('lodash');var util=require(_0xa49b('0x0'));var moment=require('moment');var BPromise=require(_0xa49b('0x1'));var rs=require(_0xa49b('0x2'));var fs=require('fs');var Redis=require(_0xa49b('0x3'));var db=require(_0xa49b('0x4'))['db'];var utils=require(_0xa49b('0x5'));var logger=require(_0xa49b('0x6'))(_0xa49b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa49b('0x8')][_0xa49b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29971c,_0xe97f2a,_0x3c3145){return new BPromise(function(_0x565232,_0x4cae69){return client[_0xa49b('0xa')](_0x29971c,_0x3c3145)[_0xa49b('0xb')](function(_0x15e50f){logger[_0xa49b('0xc')]('SalesforceField,\x20%s,\x20%s',_0xe97f2a,_0xa49b('0xd'));logger[_0xa49b('0xe')](_0xa49b('0xf'),_0xe97f2a,'request\x20sent',JSON['stringify'](_0x15e50f));if(_0x15e50f[_0xa49b('0x10')]){if(_0x15e50f['error'][_0xa49b('0x11')]===0x1f4){logger[_0xa49b('0x10')](_0xa49b('0x12'),_0xe97f2a,_0x15e50f[_0xa49b('0x10')]['message']);return _0x4cae69(_0x15e50f[_0xa49b('0x10')][_0xa49b('0x13')]);}logger[_0xa49b('0x10')](_0xa49b('0x12'),_0xe97f2a,_0x15e50f['error'][_0xa49b('0x13')]);return _0x565232(_0x15e50f[_0xa49b('0x10')][_0xa49b('0x13')]);}else{logger[_0xa49b('0xc')](_0xa49b('0x12'),_0xe97f2a,_0xa49b('0xd'));_0x565232(_0x15e50f[_0xa49b('0x14')]['message']);}})[_0xa49b('0x15')](function(_0xaedb13){logger[_0xa49b('0x10')]('SalesforceField,\x20%s,\x20%s',_0xe97f2a,_0xaedb13);_0x4cae69(_0xaedb13);});});} \ No newline at end of file +var _0xa220=['info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0xa220,0x14d));var _0x0a22=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa220[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0a22('0x0'));var util=require('util');var moment=require(_0x0a22('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a22('0x2'));var logger=require('../../config/logger')(_0x0a22('0x3'));var config=require(_0x0a22('0x4'));var jayson=require(_0x0a22('0x5'));var client=jayson[_0x0a22('0x6')][_0x0a22('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x193ffe,_0x131ddb,_0x4144c8){return new BPromise(function(_0x32f335,_0x1407f3){return client['request'](_0x193ffe,_0x4144c8)[_0x0a22('0x8')](function(_0x2b12c5){logger[_0x0a22('0x9')](_0x0a22('0xa'),_0x131ddb,_0x0a22('0xb'));logger[_0x0a22('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x131ddb,'request\x20sent',JSON[_0x0a22('0xd')](_0x2b12c5));if(_0x2b12c5[_0x0a22('0xe')]){if(_0x2b12c5[_0x0a22('0xe')][_0x0a22('0xf')]===0x1f4){logger['error'](_0x0a22('0xa'),_0x131ddb,_0x2b12c5[_0x0a22('0xe')][_0x0a22('0x10')]);return _0x1407f3(_0x2b12c5[_0x0a22('0xe')][_0x0a22('0x10')]);}logger['error'](_0x0a22('0xa'),_0x131ddb,_0x2b12c5[_0x0a22('0xe')][_0x0a22('0x10')]);return _0x32f335(_0x2b12c5['error'][_0x0a22('0x10')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x131ddb,_0x0a22('0xb'));_0x32f335(_0x2b12c5['result'][_0x0a22('0x10')]);}})[_0x0a22('0x11')](function(_0xeadd6d){logger[_0x0a22('0xe')]('SalesforceField,\x20%s,\x20%s',_0x131ddb,_0xeadd6d);_0x1407f3(_0xeadd6d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 324e838..874b335 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 _0x4560=['/:id','isAuthenticated','/:id/configurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4560,0x1d4));var _0x0456=function(_0xd0aa32,_0xa9fdad){_0xd0aa32=_0xd0aa32-0x0;var _0x11d737=_0x4560[_0xd0aa32];return _0x11d737;};'use strict';var multer=require(_0x0456('0x0'));var util=require(_0x0456('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0456('0x2'));var interaction=require(_0x0456('0x3'));var config=require(_0x0456('0x4'));var controller=require(_0x0456('0x5'));router[_0x0456('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0456('0x7'),auth[_0x0456('0x8')](),controller['show']);router[_0x0456('0x6')](_0x0456('0x9'),auth[_0x0456('0x8')](),controller['getConfigurations']);router[_0x0456('0x6')](_0x0456('0xa'),auth['isAuthenticated'](),controller[_0x0456('0xb')]);router['post']('/',auth[_0x0456('0x8')](),controller[_0x0456('0xc')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0456('0xd')]);router[_0x0456('0xe')](_0x0456('0x7'),auth[_0x0456('0x8')](),controller[_0x0456('0xf')]);router[_0x0456('0x10')](_0x0456('0x7'),auth[_0x0456('0x8')](),controller[_0x0456('0x11')]);module[_0x0456('0x12')]=router; \ No newline at end of file +var _0xd20e=['/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3ff10c,_0x56a1c0){var _0x303df4=function(_0x38266a){while(--_0x38266a){_0x3ff10c['push'](_0x3ff10c['shift']());}};_0x303df4(++_0x56a1c0);}(_0xd20e,0xbb));var _0xed20=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xd20e[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xed20('0x0'));var util=require(_0xed20('0x1'));var path=require(_0xed20('0x2'));var timeout=require(_0xed20('0x3'));var express=require('express');var router=express[_0xed20('0x4')]();var fs_extra=require(_0xed20('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed20('0x6'));var config=require(_0xed20('0x7'));var controller=require('./intServicenowAccount.controller');router[_0xed20('0x8')]('/',auth[_0xed20('0x9')](),controller[_0xed20('0xa')]);router['get'](_0xed20('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xed20('0x8')](_0xed20('0xc'),auth[_0xed20('0x9')](),controller['getConfigurations']);router[_0xed20('0x8')](_0xed20('0xd'),auth[_0xed20('0x9')](),controller[_0xed20('0xe')]);router[_0xed20('0xf')]('/',auth['isAuthenticated'](),controller[_0xed20('0x10')]);router['post'](_0xed20('0xc'),auth[_0xed20('0x9')](),controller[_0xed20('0x11')]);router[_0xed20('0x12')](_0xed20('0xb'),auth[_0xed20('0x9')](),controller[_0xed20('0x13')]);router['delete'](_0xed20('0xb'),auth[_0xed20('0x9')](),controller[_0xed20('0x14')]);module[_0xed20('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b624211..9a79ff1 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 _0x7979=['sequelize','STRING'];(function(_0x1c0b6c,_0x430167){var _0x1a13c5=function(_0x529a91){while(--_0x529a91){_0x1c0b6c['push'](_0x1c0b6c['shift']());}};_0x1a13c5(++_0x430167);}(_0x7979,0x10a));var _0x9797=function(_0x212c94,_0x4f23df){_0x212c94=_0x212c94-0x0;var _0x27ec9f=_0x7979[_0x212c94];return _0x27ec9f;};'use strict';var Sequelize=require(_0x9797('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9797('0x1')]},'username':{'type':Sequelize[_0x9797('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x9797('0x1')]},'email':{'type':Sequelize[_0x9797('0x1')]},'remoteUri':{'type':Sequelize[_0x9797('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x9797('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2be1=['remoteUri','sequelize','exports','STRING'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x2be1,0x71));var _0x12be=function(_0x40f5b7,_0xb3243e){_0x40f5b7=_0x40f5b7-0x0;var _0x3c884a=_0x2be1[_0x40f5b7];return _0x3c884a;};'use strict';var Sequelize=require(_0x12be('0x0'));module[_0x12be('0x1')]={'name':{'type':Sequelize[_0x12be('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x12be('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x12be('0x2')],'unique':_0x12be('0x3')},'serverUrl':{'type':Sequelize[_0x12be('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 fd761e7..8ab40e2 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 _0xf3b8=['length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','intersection','include','find','create','body','update','destroy','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','knowledge','subcategory','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','sys_updated_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','work_notes','short_description','close_code','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','assigned_to','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','password','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','forEach','internalType','label','push','all','assign','TCL:\x20_object','remove','includes','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','then','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields'];(function(_0x415d4d,_0x106e24){var _0x41ad03=function(_0x581680){while(--_0x581680){_0x415d4d['push'](_0x415d4d['shift']());}};_0x41ad03(++_0x106e24);}(_0xf3b8,0x13d));var _0x8f3b=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xf3b8[_0x4ae625];return _0x31accf;};'use strict';var emlformat=require(_0x8f3b('0x0'));var rimraf=require(_0x8f3b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f3b('0x2'));var rp=require('request-promise');var moment=require(_0x8f3b('0x3'));var BPromise=require(_0x8f3b('0x4'));var Mustache=require(_0x8f3b('0x5'));var util=require('util');var path=require(_0x8f3b('0x6'));var sox=require(_0x8f3b('0x7'));var csv=require(_0x8f3b('0x8'));var ejs=require(_0x8f3b('0x9'));var fs=require('fs');var fs_extra=require(_0x8f3b('0xa'));var _=require(_0x8f3b('0xb'));var squel=require(_0x8f3b('0xc'));var crypto=require(_0x8f3b('0xd'));var jsforce=require(_0x8f3b('0xe'));var deskjs=require(_0x8f3b('0xf'));var toCsv=require(_0x8f3b('0x8'));var querystring=require(_0x8f3b('0x10'));var Papa=require(_0x8f3b('0x11'));var Redis=require(_0x8f3b('0x12'));var authService=require(_0x8f3b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8f3b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f3b('0x15'));var utils=require(_0x8f3b('0x16'));var config=require(_0x8f3b('0x17'));var licenseUtil=require(_0x8f3b('0x18'));var db=require(_0x8f3b('0x19'))['db'];var integrations=require(_0x8f3b('0x1a'));function respondWithStatusCode(_0x27429b,_0x36a007){_0x36a007=_0x36a007||0xcc;return function(_0x4f88e4){if(_0x4f88e4){return _0x27429b[_0x8f3b('0x1b')](_0x36a007);}return _0x27429b[_0x8f3b('0x1c')](_0x36a007)[_0x8f3b('0x1d')]();};}function respondWithResult(_0x42e6dc,_0x3fee7d){_0x3fee7d=_0x3fee7d||0xc8;return function(_0x132773){if(_0x132773){return _0x42e6dc[_0x8f3b('0x1c')](_0x3fee7d)[_0x8f3b('0x1e')](_0x132773);}};}function respondWithFilteredResult(_0x425876,_0x284448){return function(_0x470fc1){if(_0x470fc1){var _0x49f37a=typeof _0x284448['offset']===_0x8f3b('0x1f')&&typeof _0x284448[_0x8f3b('0x20')]===_0x8f3b('0x1f');var _0x3d7bfe=_0x470fc1[_0x8f3b('0x21')];var _0x21ce2c=_0x49f37a?0x0:_0x284448[_0x8f3b('0x22')];var _0x49bf19=_0x49f37a?_0x470fc1[_0x8f3b('0x21')]:_0x284448[_0x8f3b('0x22')]+_0x284448[_0x8f3b('0x20')];var _0x3e35b5;if(_0x49bf19>=_0x3d7bfe){_0x49bf19=_0x3d7bfe;_0x3e35b5=0xc8;}else{_0x3e35b5=0xce;}_0x425876[_0x8f3b('0x1c')](_0x3e35b5);return _0x425876['set'](_0x8f3b('0x23'),_0x21ce2c+'-'+_0x49bf19+'/'+_0x3d7bfe)[_0x8f3b('0x1e')](_0x470fc1);}return null;};}function patchUpdates(_0x3e2bfb){return function(_0x3a090d){try{jsonpatch[_0x8f3b('0x24')](_0x3a090d,_0x3e2bfb,!![]);}catch(_0x2a4782){return BPromise['reject'](_0x2a4782);}return _0x3a090d['save']();};}function saveUpdates(_0x229926,_0x12baf8){return function(_0x274ad3){if(_0x274ad3){return _0x274ad3['update'](_0x229926)['then'](function(_0x107cf5){return _0x107cf5;});}return null;};}function removeEntity(_0x5d5ace,_0x17a5e9){return function(_0x57dce4){if(_0x57dce4){return _0x57dce4['destroy']()[_0x8f3b('0x25')](function(){_0x5d5ace[_0x8f3b('0x1c')](0xcc)[_0x8f3b('0x1d')]();});}};}function handleEntityNotFound(_0x568dc2,_0x485577){return function(_0x475bd1){if(!_0x475bd1){_0x568dc2['sendStatus'](0x194);}return _0x475bd1;};}function handleError(_0x14cd06,_0x586965){_0x586965=_0x586965||0x1f4;return function(_0x15e6ac){logger[_0x8f3b('0x26')](_0x15e6ac[_0x8f3b('0x27')]);if(_0x15e6ac['name']){delete _0x15e6ac[_0x8f3b('0x28')];}_0x14cd06['status'](_0x586965)[_0x8f3b('0x29')](_0x15e6ac);};}exports['index']=function(_0x220059,_0x2993a3){var _0x299319={},_0x117cad={},_0x33ebeb={'count':0x0,'rows':[]};var _0x40da6c=_[_0x8f3b('0x2a')](db[_0x8f3b('0x2b')][_0x8f3b('0x2c')],function(_0x1f4432){return{'name':_0x1f4432[_0x8f3b('0x2d')],'type':_0x1f4432['type'][_0x8f3b('0x2e')]};});_0x117cad['model']=_['map'](_0x40da6c,'name');_0x117cad[_0x8f3b('0x2f')]=_[_0x8f3b('0x30')](_0x220059[_0x8f3b('0x2f')]);_0x117cad[_0x8f3b('0x31')]=_['intersection'](_0x117cad[_0x8f3b('0x32')],_0x117cad[_0x8f3b('0x2f')]);_0x299319[_0x8f3b('0x33')]=_['intersection'](_0x117cad[_0x8f3b('0x32')],qs[_0x8f3b('0x34')](_0x220059[_0x8f3b('0x2f')][_0x8f3b('0x34')]));_0x299319[_0x8f3b('0x33')]=_0x299319['attributes'][_0x8f3b('0x35')]?_0x299319[_0x8f3b('0x33')]:_0x117cad[_0x8f3b('0x32')];if(!_0x220059[_0x8f3b('0x2f')][_0x8f3b('0x36')]('nolimit')){_0x299319[_0x8f3b('0x20')]=qs[_0x8f3b('0x20')](_0x220059['query'][_0x8f3b('0x20')]);_0x299319[_0x8f3b('0x22')]=qs['offset'](_0x220059['query'][_0x8f3b('0x22')]);}_0x299319[_0x8f3b('0x37')]=qs['sort'](_0x220059[_0x8f3b('0x2f')][_0x8f3b('0x38')]);_0x299319[_0x8f3b('0x39')]=qs['filters'](_[_0x8f3b('0x3a')](_0x220059[_0x8f3b('0x2f')],_0x117cad[_0x8f3b('0x31')]),_0x40da6c);if(_0x220059['query'][_0x8f3b('0x3b')]){_0x299319['where']=_[_0x8f3b('0x3c')](_0x299319[_0x8f3b('0x39')],{'$or':_[_0x8f3b('0x2a')](_0x40da6c,function(_0x55492c){if(_0x55492c[_0x8f3b('0x3d')]!==_0x8f3b('0x3e')){var _0xe1d75f={};_0xe1d75f[_0x55492c[_0x8f3b('0x28')]]={'$like':'%'+_0x220059['query'][_0x8f3b('0x3b')]+'%'};return _0xe1d75f;}})});}_0x299319=_['merge']({},_0x299319,_0x220059[_0x8f3b('0x3f')]);var _0x2a83d4={'where':_0x299319[_0x8f3b('0x39')]};return db[_0x8f3b('0x2b')][_0x8f3b('0x21')](_0x2a83d4)[_0x8f3b('0x25')](function(_0x24226a){_0x33ebeb['count']=_0x24226a;if(_0x220059['query'][_0x8f3b('0x40')]){_0x299319['include']=[{'all':!![]}];}return db[_0x8f3b('0x2b')]['findAll'](_0x299319);})[_0x8f3b('0x25')](function(_0x2ef389){_0x33ebeb['rows']=_0x2ef389;return _0x33ebeb;})[_0x8f3b('0x25')](respondWithFilteredResult(_0x2993a3,_0x299319))[_0x8f3b('0x41')](handleError(_0x2993a3,null));};exports[_0x8f3b('0x42')]=function(_0x115382,_0x172fd9){var _0x495dc9={'raw':![],'where':{'id':_0x115382[_0x8f3b('0x43')]['id']}},_0x581258={};_0x581258[_0x8f3b('0x32')]=_[_0x8f3b('0x30')](db[_0x8f3b('0x2b')][_0x8f3b('0x2c')]);_0x581258[_0x8f3b('0x2f')]=_[_0x8f3b('0x30')](_0x115382[_0x8f3b('0x2f')]);_0x581258[_0x8f3b('0x31')]=_[_0x8f3b('0x44')](_0x581258['model'],_0x581258[_0x8f3b('0x2f')]);_0x495dc9[_0x8f3b('0x33')]=_[_0x8f3b('0x44')](_0x581258['model'],qs['fields'](_0x115382[_0x8f3b('0x2f')]['fields']));_0x495dc9['attributes']=_0x495dc9['attributes'][_0x8f3b('0x35')]?_0x495dc9[_0x8f3b('0x33')]:_0x581258[_0x8f3b('0x32')];if(_0x115382['query']['includeAll']){_0x495dc9[_0x8f3b('0x45')]=[{'all':!![]}];}_0x495dc9=_[_0x8f3b('0x3c')]({},_0x495dc9,_0x115382[_0x8f3b('0x3f')]);return db[_0x8f3b('0x2b')][_0x8f3b('0x46')](_0x495dc9)['then'](handleEntityNotFound(_0x172fd9,null))[_0x8f3b('0x25')](respondWithResult(_0x172fd9,null))[_0x8f3b('0x41')](handleError(_0x172fd9,null));};exports[_0x8f3b('0x47')]=function(_0x4d8e73,_0xc7e920){return db['ServicenowAccount'][_0x8f3b('0x47')](_0x4d8e73[_0x8f3b('0x48')],{})[_0x8f3b('0x25')](respondWithResult(_0xc7e920,0xc9))['catch'](handleError(_0xc7e920,null));};exports[_0x8f3b('0x49')]=function(_0x11f460,_0x324526){if(_0x11f460[_0x8f3b('0x48')]['id']){delete _0x11f460[_0x8f3b('0x48')]['id'];}return db[_0x8f3b('0x2b')][_0x8f3b('0x46')]({'where':{'id':_0x11f460[_0x8f3b('0x43')]['id']}})[_0x8f3b('0x25')](handleEntityNotFound(_0x324526,null))[_0x8f3b('0x25')](saveUpdates(_0x11f460[_0x8f3b('0x48')],null))[_0x8f3b('0x25')](respondWithResult(_0x324526,null))['catch'](handleError(_0x324526,null));};exports[_0x8f3b('0x4a')]=function(_0x30957c,_0x2ede8a){return db[_0x8f3b('0x2b')][_0x8f3b('0x46')]({'where':{'id':_0x30957c[_0x8f3b('0x43')]['id']}})[_0x8f3b('0x25')](handleEntityNotFound(_0x2ede8a,null))[_0x8f3b('0x25')](removeEntity(_0x2ede8a,null))[_0x8f3b('0x41')](handleError(_0x2ede8a,null));};exports[_0x8f3b('0x4b')]=function(_0x5eec3e,_0x2db7e8,_0x415ad6){var _0x532757={};var _0x4d7bd={};var _0x385309;var _0x137055;return db[_0x8f3b('0x2b')]['findOne']({'where':{'id':_0x5eec3e[_0x8f3b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2db7e8,null))[_0x8f3b('0x25')](function(_0x2568e8){if(_0x2568e8){_0x385309=_0x2568e8;_0x4d7bd[_0x8f3b('0x32')]=_[_0x8f3b('0x30')](db['ServicenowConfiguration'][_0x8f3b('0x2c')]);_0x4d7bd['query']=_[_0x8f3b('0x30')](_0x5eec3e[_0x8f3b('0x2f')]);_0x4d7bd[_0x8f3b('0x31')]=_['intersection'](_0x4d7bd[_0x8f3b('0x32')],_0x4d7bd['query']);_0x532757[_0x8f3b('0x33')]=_[_0x8f3b('0x44')](_0x4d7bd[_0x8f3b('0x32')],qs[_0x8f3b('0x34')](_0x5eec3e[_0x8f3b('0x2f')][_0x8f3b('0x34')]));_0x532757[_0x8f3b('0x33')]=_0x532757[_0x8f3b('0x33')][_0x8f3b('0x35')]?_0x532757['attributes']:_0x4d7bd['model'];_0x532757[_0x8f3b('0x37')]=qs[_0x8f3b('0x38')](_0x5eec3e[_0x8f3b('0x2f')][_0x8f3b('0x38')]);_0x532757[_0x8f3b('0x39')]=qs[_0x8f3b('0x31')](_[_0x8f3b('0x3a')](_0x5eec3e[_0x8f3b('0x2f')],_0x4d7bd['filters']));if(_0x5eec3e['query'][_0x8f3b('0x3b')]){_0x532757['where']=_[_0x8f3b('0x3c')](_0x532757[_0x8f3b('0x39')],{'$or':_[_0x8f3b('0x2a')](_0x532757['attributes'],function(_0x46adda){var _0x563bfe={};_0x563bfe[_0x46adda]={'$like':'%'+_0x5eec3e['query']['filter']+'%'};return _0x563bfe;})});}_0x532757=_[_0x8f3b('0x3c')]({},_0x532757,_0x5eec3e[_0x8f3b('0x3f')]);return _0x385309[_0x8f3b('0x4b')](_0x532757);}})['then'](function(_0x55b4ec){if(_0x55b4ec){_0x137055=_0x55b4ec[_0x8f3b('0x35')];if(!_0x5eec3e['query']['hasOwnProperty'](_0x8f3b('0x4c'))){_0x532757[_0x8f3b('0x20')]=qs[_0x8f3b('0x20')](_0x5eec3e[_0x8f3b('0x2f')]['limit']);_0x532757[_0x8f3b('0x22')]=qs[_0x8f3b('0x22')](_0x5eec3e[_0x8f3b('0x2f')][_0x8f3b('0x22')]);}return _0x385309[_0x8f3b('0x4b')](_0x532757);}})[_0x8f3b('0x25')](function(_0x3522d0){if(_0x3522d0){return _0x3522d0?{'count':_0x137055,'rows':_0x3522d0}:null;}})[_0x8f3b('0x25')](respondWithResult(_0x2db7e8,null))[_0x8f3b('0x41')](handleError(_0x2db7e8,null));};exports[_0x8f3b('0x4d')]=function(_0x4f34e8,_0x1237ca,_0xac6e17){if(_0x4f34e8[_0x8f3b('0x48')]['id']){delete _0x4f34e8[_0x8f3b('0x48')]['id'];}return db[_0x8f3b('0x2b')][_0x8f3b('0x4e')]({'where':{'id':_0x4f34e8[_0x8f3b('0x43')]['id']}})[_0x8f3b('0x25')](handleEntityNotFound(_0x1237ca,null))[_0x8f3b('0x25')](function(_0x169937){if(_0x169937){_0x4f34e8[_0x8f3b('0x48')][_0x8f3b('0x4f')]=_0x169937['id'];_0x4f34e8[_0x8f3b('0x48')][_0x8f3b('0x50')]=integrations[_0x8f3b('0x51')](_0x4f34e8[_0x8f3b('0x48')][_0x8f3b('0x52')],_0x4f34e8['body'][_0x8f3b('0x3d')]);_0x4f34e8['body'][_0x8f3b('0x53')]=integrations['getDescriptions'](_0x4f34e8['body'][_0x8f3b('0x52')],_0x4f34e8[_0x8f3b('0x48')]['type']);return db[_0x8f3b('0x54')][_0x8f3b('0x47')](_0x4f34e8['body'],{'include':[{'model':db[_0x8f3b('0x55')],'as':_0x8f3b('0x50')},{'model':db[_0x8f3b('0x55')],'as':_0x8f3b('0x53')}]});}return null;})[_0x8f3b('0x25')](respondWithResult(_0x1237ca,null))[_0x8f3b('0x41')](handleError(_0x1237ca,null));};exports[_0x8f3b('0x56')]=function(_0x4b727b,_0x29afd1,_0x29f85f){var _0x4542f5=[_0x8f3b('0x57'),'hold_reason',_0x8f3b('0x58'),_0x8f3b('0x59'),'close_code',_0x8f3b('0x5a'),_0x8f3b('0x5b'),_0x8f3b('0x5c'),_0x8f3b('0x5d')];var _0x5ea6d5=[_0x8f3b('0x5e'),_0x8f3b('0x57'),_0x8f3b('0x5f'),_0x8f3b('0x60'),_0x8f3b('0x61'),_0x8f3b('0x62'),_0x8f3b('0x63'),_0x8f3b('0x64'),_0x8f3b('0x65'),_0x8f3b('0x66'),'resolved_by',_0x8f3b('0x67'),'opened_by',_0x8f3b('0x68'),'sys_created_on',_0x8f3b('0x69'),_0x8f3b('0x6a'),_0x8f3b('0x6b'),'knowledge','order',_0x8f3b('0x6c'),_0x8f3b('0x6d'),_0x8f3b('0x6e'),'delivery_plan',_0x8f3b('0x6f'),_0x8f3b('0x70'),_0x8f3b('0x71'),_0x8f3b('0x72'),_0x8f3b('0x73'),_0x8f3b('0x74'),_0x8f3b('0x75'),_0x8f3b('0x76'),'expected_start',_0x8f3b('0x77'),_0x8f3b('0x78'),_0x8f3b('0x79'),_0x8f3b('0x7a'),_0x8f3b('0x7b'),_0x8f3b('0x7c'),'caller_id','approval_set',_0x8f3b('0x59'),_0x8f3b('0x7d'),_0x8f3b('0x7e'),_0x8f3b('0x7f'),'correlation_display',_0x8f3b('0x80'),'work_start',_0x8f3b('0x81'),_0x8f3b('0x82'),_0x8f3b('0x83'),_0x8f3b('0x84'),_0x8f3b('0x85'),_0x8f3b('0x5a'),_0x8f3b('0x86'),_0x8f3b('0x87'),_0x8f3b('0x88'),_0x8f3b('0x89'),_0x8f3b('0x8a'),_0x8f3b('0x8b'),_0x8f3b('0x8c'),_0x8f3b('0x8d'),_0x8f3b('0x5b'),_0x8f3b('0x8e'),'problem_id',_0x8f3b('0x8f'),'reassignment_count','activity_due',_0x8f3b('0x90'),_0x8f3b('0x5c'),_0x8f3b('0x91'),_0x8f3b('0x92'),'approval','comments_and_work_notes',_0x8f3b('0x93'),_0x8f3b('0x94'),_0x8f3b('0x95'),_0x8f3b('0x96'),'escalation',_0x8f3b('0x97'),_0x8f3b('0x98'),_0x8f3b('0x99'),_0x8f3b('0x5d')];var _0x17ab6d='';var _0xb96865='';var _0x2c163c=[];var _0x356a59='';var _0x559a56='';var _0x319e2b=[];var _0x246528='';var _0x3227b7='';var _0x575448={};var _0x2e388e='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x4b727b['params']['id']},'attributes':['id','username',_0x8f3b('0x9a'),'email',_0x8f3b('0x9b'),_0x8f3b('0x9c')]})[_0x8f3b('0x25')](handleEntityNotFound(_0x29afd1,null))[_0x8f3b('0x25')](function(_0x355bed){if(_0x355bed){_0x2e388e=_0x355bed[_0x8f3b('0x9b')];var _0x1bc840=_0x2e388e[_0x8f3b('0x9d')](-0x1);if(_0x1bc840==='/'){_0x2e388e=_0x2e388e[_0x8f3b('0x9e')](0x0,_0x2e388e['lastIndexOf'](_0x1bc840));}_0x3227b7=util['format'](_0x8f3b('0x9f'),_0x2e388e);_0x246528=util[_0x8f3b('0xa0')]('%s/api/now/table/',_0x2e388e);_0x575448={'user':_0x355bed[_0x8f3b('0xa1')],'pass':_0x355bed[_0x8f3b('0x9a')]};var _0x120749={'method':_0x8f3b('0xa2'),'uri':_0x3227b7+_0x8f3b('0xa3'),'auth':_0x575448,'json':!![]};return rp(_0x120749);}})[_0x8f3b('0x25')](function(_0x412b1a){if(_0x412b1a[_0x8f3b('0xa4')]['length']>0x0){_0x17ab6d=_0x412b1a[_0x8f3b('0xa4')];}console[_0x8f3b('0xa5')](_0x8f3b('0xa6'),_0x17ab6d);_0x319e2b=[];_0xb96865=Object['assign']([],_0x17ab6d);_['remove'](_0xb96865,function(_0x4b15fb){return!_0x4542f5['includes'](_0x4b15fb[_0x8f3b('0x28')]);});_0xb96865[_0x8f3b('0xa7')](function(_0x27ef2d){var _0x4d9989=createFieldObject(_0x246528,_0x575448,_0x27ef2d[_0x8f3b('0xa8')],_0x27ef2d[_0x8f3b('0x28')],_0x27ef2d[_0x8f3b('0xa9')],![]);_0x319e2b[_0x8f3b('0xaa')](_0x4d9989);});return Promise[_0x8f3b('0xab')](_0x319e2b);})[_0x8f3b('0x25')](function(_0x1adcbe){_0x2c163c=_0x1adcbe;_0x356a59=Object[_0x8f3b('0xac')]([],_0x17ab6d);console['log'](_0x8f3b('0xad'),_0x17ab6d);_[_0x8f3b('0xae')](_0x356a59,function(_0x101d4f){return _0x5ea6d5[_0x8f3b('0xaf')](_0x101d4f[_0x8f3b('0x28')]);});console[_0x8f3b('0xa5')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x356a59);_0x319e2b=[];_0x356a59[_0x8f3b('0xa7')](function(_0x933975){var _0x170de4=createFieldObject(_0x246528,_0x575448,_0x933975[_0x8f3b('0xa8')],_0x933975[_0x8f3b('0x28')],_0x933975['label'],!![]);_0x319e2b[_0x8f3b('0xaa')](_0x170de4);});return Promise[_0x8f3b('0xab')](_0x319e2b);})['then'](function(_0x5d01dd){_0x559a56=_0x5d01dd;var _0x4d224a=_0x2c163c['concat'](_0x559a56);return{'count':_0x4d224a[_0x8f3b('0x35')],'rows':_0x4d224a};})[_0x8f3b('0x25')](respondWithResult(_0x29afd1,null))[_0x8f3b('0x41')](function(_0x180f2a){console[_0x8f3b('0xa5')](_0x8f3b('0xb0')+_0x180f2a);var _0x1280b6=_0x4b727b[_0x8f3b('0x2f')][_0x8f3b('0xb1')]?0x1f4:_0x180f2a['statusCode']||0x1f4;logger['error'](_0x180f2a[_0x8f3b('0x27')]);delete _0x180f2a[_0x8f3b('0x28')];if(_0x1280b6===0x191){_0x1280b6=0x190;}_0x29afd1['status'](_0x1280b6)[_0x8f3b('0x29')](_0x4b727b[_0x8f3b('0x2f')][_0x8f3b('0xb1')]?{'message':_0x8f3b('0xb2'),'statusCode':_0x180f2a[_0x8f3b('0xb3')]}:_0x180f2a);});};function createFieldObject(_0x1c57f4,_0x5ef640,_0xb6ec98,_0x302efc,_0xcda1f,_0x2823cf){return new Promise(function(_0xae4e03,_0x3fb259){var _0x3d7aa8={'id':_0x302efc,'name':_0xcda1f,'custom':_0x2823cf};if(_0xb6ec98==='boolean'){_0x3d7aa8[_0x8f3b('0x3f')]=[{'name':_0x8f3b('0xb4'),'value':_0x8f3b('0xb5')},{'name':'False','value':_0x8f3b('0xb6')}];_0xae4e03(_0x3d7aa8);}else{var _0xebc8e4={'method':_0x8f3b('0xa2'),'uri':_0x1c57f4+_0x8f3b('0xb7')+_0x302efc,'auth':_0x5ef640,'json':!![]};return rp(_0xebc8e4)['then'](function(_0x3edcdb){var _0x1832ae=[];if(_0x3edcdb[_0x8f3b('0xa4')][_0x8f3b('0x35')]>0x0){_0x3edcdb[_0x8f3b('0xa4')]['forEach'](function(_0x355344){if(_0x355344[_0x8f3b('0xb8')]===_0x8f3b('0xb6')){var _0x5d169={'name':_0x355344[_0x8f3b('0xa9')],'value':_0x355344['value']};_0x1832ae[_0x8f3b('0xaa')](_0x5d169);}});}_0x3d7aa8[_0x8f3b('0x3f')]=_0x1832ae;if(_0x3d7aa8[_0x8f3b('0x3f')][_0x8f3b('0x35')]>0x0){_0xae4e03(_0x3d7aa8);}else{if(_0x2823cf==![]){_0xae4e03();}else{_0xae4e03(_0x3d7aa8);}}});}});} \ No newline at end of file +var _0xd1a1=['where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','find','body','destroy','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getFields','made_sla','subcategory','notify','severity','parent','caused_by','watch_list','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','reopened_by','incident_state','urgency','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','send','Wrong\x20credentials','statusCode','boolean','True','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd1a1,0x7d));var _0x1d1a=function(_0x372e96,_0x3fb445){_0x372e96=_0x372e96-0x0;var _0x3f8208=_0xd1a1[_0x372e96];return _0x3f8208;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d1a('0x0'));var zipdir=require(_0x1d1a('0x1'));var jsonpatch=require(_0x1d1a('0x2'));var rp=require(_0x1d1a('0x3'));var moment=require(_0x1d1a('0x4'));var BPromise=require(_0x1d1a('0x5'));var Mustache=require('mustache');var util=require(_0x1d1a('0x6'));var path=require(_0x1d1a('0x7'));var sox=require('sox');var csv=require(_0x1d1a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d1a('0x9'));var squel=require(_0x1d1a('0xa'));var crypto=require(_0x1d1a('0xb'));var jsforce=require(_0x1d1a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1d1a('0x8'));var querystring=require(_0x1d1a('0xd'));var Papa=require('papaparse');var Redis=require(_0x1d1a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1d1a('0xf'));var as=require(_0x1d1a('0x10'));var hardwareService=require(_0x1d1a('0x11'));var logger=require(_0x1d1a('0x12'))(_0x1d1a('0x13'));var utils=require('../../config/utils');var config=require(_0x1d1a('0x14'));var licenseUtil=require(_0x1d1a('0x15'));var db=require(_0x1d1a('0x16'))['db'];var integrations=require(_0x1d1a('0x17'));function respondWithStatusCode(_0x11bf73,_0x4740bc){_0x4740bc=_0x4740bc||0xcc;return function(_0xec80ad){if(_0xec80ad){return _0x11bf73[_0x1d1a('0x18')](_0x4740bc);}return _0x11bf73['status'](_0x4740bc)[_0x1d1a('0x19')]();};}function respondWithResult(_0x5851ff,_0x107e61){_0x107e61=_0x107e61||0xc8;return function(_0x48c3ef){if(_0x48c3ef){return _0x5851ff[_0x1d1a('0x1a')](_0x107e61)[_0x1d1a('0x1b')](_0x48c3ef);}};}function respondWithFilteredResult(_0x25a613,_0x3319f0){return function(_0x47897b){if(_0x47897b){var _0x1ccd14=typeof _0x3319f0[_0x1d1a('0x1c')]===_0x1d1a('0x1d')&&typeof _0x3319f0[_0x1d1a('0x1e')]===_0x1d1a('0x1d');var _0x57a21b=_0x47897b[_0x1d1a('0x1f')];var _0x50fe34=_0x1ccd14?0x0:_0x3319f0[_0x1d1a('0x1c')];var _0x3db90f=_0x1ccd14?_0x47897b['count']:_0x3319f0['offset']+_0x3319f0[_0x1d1a('0x1e')];var _0x2b91aa;if(_0x3db90f>=_0x57a21b){_0x3db90f=_0x57a21b;_0x2b91aa=0xc8;}else{_0x2b91aa=0xce;}_0x25a613['status'](_0x2b91aa);return _0x25a613['set'](_0x1d1a('0x20'),_0x50fe34+'-'+_0x3db90f+'/'+_0x57a21b)[_0x1d1a('0x1b')](_0x47897b);}return null;};}function patchUpdates(_0x55d4d2){return function(_0x20e4fe){try{jsonpatch['apply'](_0x20e4fe,_0x55d4d2,!![]);}catch(_0x4c621c){return BPromise[_0x1d1a('0x21')](_0x4c621c);}return _0x20e4fe[_0x1d1a('0x22')]();};}function saveUpdates(_0x3e182a,_0x540505){return function(_0x1bc061){if(_0x1bc061){return _0x1bc061['update'](_0x3e182a)[_0x1d1a('0x23')](function(_0x3a894a){return _0x3a894a;});}return null;};}function removeEntity(_0x4fbc70,_0x4d0123){return function(_0x18c417){if(_0x18c417){return _0x18c417['destroy']()[_0x1d1a('0x23')](function(){_0x4fbc70[_0x1d1a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549f36,_0x484bd6){return function(_0x1cb55a){if(!_0x1cb55a){_0x549f36[_0x1d1a('0x18')](0x194);}return _0x1cb55a;};}function handleError(_0x32da76,_0x1a4c8e){_0x1a4c8e=_0x1a4c8e||0x1f4;return function(_0x30df7e){logger[_0x1d1a('0x24')](_0x30df7e[_0x1d1a('0x25')]);if(_0x30df7e[_0x1d1a('0x26')]){delete _0x30df7e[_0x1d1a('0x26')];}_0x32da76['status'](_0x1a4c8e)['send'](_0x30df7e);};}exports['index']=function(_0x47e008,_0x45a489){var _0x42a88b={},_0x2f5299={},_0x2626bc={'count':0x0,'rows':[]};var _0x68a05c=_['map'](db[_0x1d1a('0x27')][_0x1d1a('0x28')],function(_0x2dbe75){return{'name':_0x2dbe75[_0x1d1a('0x29')],'type':_0x2dbe75[_0x1d1a('0x2a')][_0x1d1a('0x2b')]};});_0x2f5299[_0x1d1a('0x2c')]=_[_0x1d1a('0x2d')](_0x68a05c,_0x1d1a('0x26'));_0x2f5299[_0x1d1a('0x2e')]=_['keys'](_0x47e008['query']);_0x2f5299['filters']=_['intersection'](_0x2f5299['model'],_0x2f5299[_0x1d1a('0x2e')]);_0x42a88b[_0x1d1a('0x2f')]=_[_0x1d1a('0x30')](_0x2f5299['model'],qs[_0x1d1a('0x31')](_0x47e008[_0x1d1a('0x2e')]['fields']));_0x42a88b[_0x1d1a('0x2f')]=_0x42a88b['attributes'][_0x1d1a('0x32')]?_0x42a88b[_0x1d1a('0x2f')]:_0x2f5299[_0x1d1a('0x2c')];if(!_0x47e008[_0x1d1a('0x2e')][_0x1d1a('0x33')](_0x1d1a('0x34'))){_0x42a88b[_0x1d1a('0x1e')]=qs['limit'](_0x47e008[_0x1d1a('0x2e')][_0x1d1a('0x1e')]);_0x42a88b['offset']=qs['offset'](_0x47e008[_0x1d1a('0x2e')][_0x1d1a('0x1c')]);}_0x42a88b[_0x1d1a('0x35')]=qs[_0x1d1a('0x36')](_0x47e008['query']['sort']);_0x42a88b['where']=qs['filters'](_[_0x1d1a('0x37')](_0x47e008[_0x1d1a('0x2e')],_0x2f5299[_0x1d1a('0x38')]),_0x68a05c);if(_0x47e008[_0x1d1a('0x2e')][_0x1d1a('0x39')]){_0x42a88b[_0x1d1a('0x3a')]=_[_0x1d1a('0x3b')](_0x42a88b[_0x1d1a('0x3a')],{'$or':_[_0x1d1a('0x2d')](_0x68a05c,function(_0x164fc4){if(_0x164fc4['type']!==_0x1d1a('0x3c')){var _0x58785f={};_0x58785f[_0x164fc4[_0x1d1a('0x26')]]={'$like':'%'+_0x47e008[_0x1d1a('0x2e')][_0x1d1a('0x39')]+'%'};return _0x58785f;}})});}_0x42a88b=_[_0x1d1a('0x3b')]({},_0x42a88b,_0x47e008[_0x1d1a('0x3d')]);var _0x4be8ce={'where':_0x42a88b[_0x1d1a('0x3a')]};return db[_0x1d1a('0x27')][_0x1d1a('0x1f')](_0x4be8ce)['then'](function(_0x158ea6){_0x2626bc[_0x1d1a('0x1f')]=_0x158ea6;if(_0x47e008[_0x1d1a('0x2e')]['includeAll']){_0x42a88b[_0x1d1a('0x3e')]=[{'all':!![]}];}return db[_0x1d1a('0x27')][_0x1d1a('0x3f')](_0x42a88b);})[_0x1d1a('0x23')](function(_0x2a81a8){_0x2626bc[_0x1d1a('0x40')]=_0x2a81a8;return _0x2626bc;})['then'](respondWithFilteredResult(_0x45a489,_0x42a88b))[_0x1d1a('0x41')](handleError(_0x45a489,null));};exports[_0x1d1a('0x42')]=function(_0x55b803,_0x48a783){var _0x58e6ea={'raw':![],'where':{'id':_0x55b803[_0x1d1a('0x43')]['id']}},_0x5d14c0={};_0x5d14c0['model']=_['keys'](db['ServicenowAccount'][_0x1d1a('0x28')]);_0x5d14c0[_0x1d1a('0x2e')]=_[_0x1d1a('0x44')](_0x55b803['query']);_0x5d14c0['filters']=_['intersection'](_0x5d14c0[_0x1d1a('0x2c')],_0x5d14c0['query']);_0x58e6ea[_0x1d1a('0x2f')]=_[_0x1d1a('0x30')](_0x5d14c0[_0x1d1a('0x2c')],qs[_0x1d1a('0x31')](_0x55b803['query'][_0x1d1a('0x31')]));_0x58e6ea['attributes']=_0x58e6ea[_0x1d1a('0x2f')][_0x1d1a('0x32')]?_0x58e6ea[_0x1d1a('0x2f')]:_0x5d14c0['model'];if(_0x55b803['query'][_0x1d1a('0x45')]){_0x58e6ea[_0x1d1a('0x3e')]=[{'all':!![]}];}_0x58e6ea=_[_0x1d1a('0x3b')]({},_0x58e6ea,_0x55b803[_0x1d1a('0x3d')]);return db[_0x1d1a('0x27')]['find'](_0x58e6ea)[_0x1d1a('0x23')](handleEntityNotFound(_0x48a783,null))[_0x1d1a('0x23')](respondWithResult(_0x48a783,null))[_0x1d1a('0x41')](handleError(_0x48a783,null));};exports[_0x1d1a('0x46')]=function(_0x19ee12,_0x1eeeca){return db[_0x1d1a('0x27')][_0x1d1a('0x46')](_0x19ee12['body'],{})[_0x1d1a('0x23')](respondWithResult(_0x1eeeca,0xc9))['catch'](handleError(_0x1eeeca,null));};exports['update']=function(_0x17aadf,_0x3695e7){if(_0x17aadf['body']['id']){delete _0x17aadf['body']['id'];}return db[_0x1d1a('0x27')][_0x1d1a('0x47')]({'where':{'id':_0x17aadf[_0x1d1a('0x43')]['id']}})[_0x1d1a('0x23')](handleEntityNotFound(_0x3695e7,null))['then'](saveUpdates(_0x17aadf[_0x1d1a('0x48')],null))[_0x1d1a('0x23')](respondWithResult(_0x3695e7,null))['catch'](handleError(_0x3695e7,null));};exports[_0x1d1a('0x49')]=function(_0x1da387,_0x324b2d){return db['ServicenowAccount'][_0x1d1a('0x47')]({'where':{'id':_0x1da387['params']['id']}})['then'](handleEntityNotFound(_0x324b2d,null))[_0x1d1a('0x23')](removeEntity(_0x324b2d,null))[_0x1d1a('0x41')](handleError(_0x324b2d,null));};exports[_0x1d1a('0x4a')]=function(_0x4e8c08,_0x8faf06,_0x57d6a8){var _0xc30d66={};var _0x38e8f4={};var _0x224717;var _0x397ba4;return db[_0x1d1a('0x27')][_0x1d1a('0x4b')]({'where':{'id':_0x4e8c08[_0x1d1a('0x43')]['id']}})[_0x1d1a('0x23')](handleEntityNotFound(_0x8faf06,null))['then'](function(_0x2ba76a){if(_0x2ba76a){_0x224717=_0x2ba76a;_0x38e8f4[_0x1d1a('0x2c')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x38e8f4[_0x1d1a('0x2e')]=_[_0x1d1a('0x44')](_0x4e8c08[_0x1d1a('0x2e')]);_0x38e8f4[_0x1d1a('0x38')]=_[_0x1d1a('0x30')](_0x38e8f4[_0x1d1a('0x2c')],_0x38e8f4[_0x1d1a('0x2e')]);_0xc30d66[_0x1d1a('0x2f')]=_[_0x1d1a('0x30')](_0x38e8f4['model'],qs[_0x1d1a('0x31')](_0x4e8c08['query']['fields']));_0xc30d66['attributes']=_0xc30d66[_0x1d1a('0x2f')]['length']?_0xc30d66['attributes']:_0x38e8f4['model'];_0xc30d66['order']=qs[_0x1d1a('0x36')](_0x4e8c08[_0x1d1a('0x2e')][_0x1d1a('0x36')]);_0xc30d66['where']=qs[_0x1d1a('0x38')](_['pick'](_0x4e8c08[_0x1d1a('0x2e')],_0x38e8f4[_0x1d1a('0x38')]));if(_0x4e8c08[_0x1d1a('0x2e')][_0x1d1a('0x39')]){_0xc30d66['where']=_[_0x1d1a('0x3b')](_0xc30d66[_0x1d1a('0x3a')],{'$or':_[_0x1d1a('0x2d')](_0xc30d66[_0x1d1a('0x2f')],function(_0x5604f3){var _0x3f3360={};_0x3f3360[_0x5604f3]={'$like':'%'+_0x4e8c08['query']['filter']+'%'};return _0x3f3360;})});}_0xc30d66=_[_0x1d1a('0x3b')]({},_0xc30d66,_0x4e8c08[_0x1d1a('0x3d')]);return _0x224717[_0x1d1a('0x4a')](_0xc30d66);}})[_0x1d1a('0x23')](function(_0x11b8a0){if(_0x11b8a0){_0x397ba4=_0x11b8a0['length'];if(!_0x4e8c08[_0x1d1a('0x2e')][_0x1d1a('0x33')](_0x1d1a('0x34'))){_0xc30d66['limit']=qs[_0x1d1a('0x1e')](_0x4e8c08['query']['limit']);_0xc30d66['offset']=qs[_0x1d1a('0x1c')](_0x4e8c08['query'][_0x1d1a('0x1c')]);}return _0x224717['getConfigurations'](_0xc30d66);}})['then'](function(_0x1f90b7){if(_0x1f90b7){return _0x1f90b7?{'count':_0x397ba4,'rows':_0x1f90b7}:null;}})[_0x1d1a('0x23')](respondWithResult(_0x8faf06,null))[_0x1d1a('0x41')](handleError(_0x8faf06,null));};exports[_0x1d1a('0x4c')]=function(_0x3a9e3f,_0x202832,_0x32900c){if(_0x3a9e3f['body']['id']){delete _0x3a9e3f[_0x1d1a('0x48')]['id'];}return db[_0x1d1a('0x27')][_0x1d1a('0x4b')]({'where':{'id':_0x3a9e3f['params']['id']}})[_0x1d1a('0x23')](handleEntityNotFound(_0x202832,null))[_0x1d1a('0x23')](function(_0x1faabe){if(_0x1faabe){_0x3a9e3f['body']['AccountId']=_0x1faabe['id'];_0x3a9e3f[_0x1d1a('0x48')][_0x1d1a('0x4d')]=integrations[_0x1d1a('0x4e')](_0x3a9e3f['body'][_0x1d1a('0x4f')],_0x3a9e3f[_0x1d1a('0x48')][_0x1d1a('0x2a')]);_0x3a9e3f[_0x1d1a('0x48')][_0x1d1a('0x50')]=integrations['getDescriptions'](_0x3a9e3f[_0x1d1a('0x48')][_0x1d1a('0x4f')],_0x3a9e3f[_0x1d1a('0x48')][_0x1d1a('0x2a')]);return db['ServicenowConfiguration']['create'](_0x3a9e3f[_0x1d1a('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0x1d1a('0x4d')},{'model':db['ServicenowField'],'as':_0x1d1a('0x50')}]});}return null;})[_0x1d1a('0x23')](respondWithResult(_0x202832,null))[_0x1d1a('0x41')](handleError(_0x202832,null));};exports[_0x1d1a('0x51')]=function(_0x320d86,_0x17133c,_0x17617b){var _0x2d45af=[_0x1d1a('0x52'),'hold_reason','knowledge',_0x1d1a('0x53'),'close_code',_0x1d1a('0x54'),'incident_state',_0x1d1a('0x55'),'category'];var _0x5afcd0=[_0x1d1a('0x56'),'made_sla',_0x1d1a('0x57'),_0x1d1a('0x58'),'upon_reject','sys_updated_on',_0x1d1a('0x59'),_0x1d1a('0x5a'),_0x1d1a('0x5b'),_0x1d1a('0x5c'),_0x1d1a('0x5d'),_0x1d1a('0x5e'),_0x1d1a('0x5f'),_0x1d1a('0x60'),_0x1d1a('0x61'),'sys_domain',_0x1d1a('0x62'),_0x1d1a('0x63'),_0x1d1a('0x64'),'order',_0x1d1a('0x65'),_0x1d1a('0x66'),_0x1d1a('0x67'),'delivery_plan',_0x1d1a('0x68'),_0x1d1a('0x69'),_0x1d1a('0x6a'),'business_service',_0x1d1a('0x6b'),_0x1d1a('0x6c'),_0x1d1a('0x6d'),'time_worked',_0x1d1a('0x6e'),_0x1d1a('0x6f'),_0x1d1a('0x70'),_0x1d1a('0x71'),_0x1d1a('0x72'),'reopened_time',_0x1d1a('0x73'),_0x1d1a('0x74'),_0x1d1a('0x75'),'subcategory',_0x1d1a('0x76'),_0x1d1a('0x77'),'close_code',_0x1d1a('0x78'),_0x1d1a('0x79'),_0x1d1a('0x7a'),_0x1d1a('0x7b'),_0x1d1a('0x7c'),_0x1d1a('0x7d'),_0x1d1a('0x7e'),_0x1d1a('0x7f'),'notify',_0x1d1a('0x80'),'close_notes',_0x1d1a('0x81'),_0x1d1a('0x82'),_0x1d1a('0x83'),_0x1d1a('0x84'),'contact_type',_0x1d1a('0x85'),_0x1d1a('0x86'),_0x1d1a('0x87'),'problem_id',_0x1d1a('0x88'),'reassignment_count',_0x1d1a('0x89'),_0x1d1a('0x8a'),_0x1d1a('0x55'),_0x1d1a('0x8b'),_0x1d1a('0x8c'),_0x1d1a('0x8d'),_0x1d1a('0x8e'),_0x1d1a('0x8f'),'sys_mod_count',_0x1d1a('0x90'),_0x1d1a('0x91'),_0x1d1a('0x92'),_0x1d1a('0x93'),_0x1d1a('0x94'),_0x1d1a('0x95'),'category'];var _0x2320f2='';var _0x101453='';var _0x1b9ea8=[];var _0x9f452b='';var _0x26146c='';var _0x3d2aaf=[];var _0x4720f6='';var _0x541bca='';var _0x3cb0e3={};var _0xfaf9d='';return db[_0x1d1a('0x27')][_0x1d1a('0x4b')]({'where':{'id':_0x320d86[_0x1d1a('0x43')]['id']},'attributes':['id',_0x1d1a('0x96'),_0x1d1a('0x97'),_0x1d1a('0x98'),_0x1d1a('0x99'),'serverUrl']})[_0x1d1a('0x23')](handleEntityNotFound(_0x17133c,null))[_0x1d1a('0x23')](function(_0x3b8e3d){if(_0x3b8e3d){_0xfaf9d=_0x3b8e3d[_0x1d1a('0x99')];var _0x4d9e7e=_0xfaf9d[_0x1d1a('0x9a')](-0x1);if(_0x4d9e7e==='/'){_0xfaf9d=_0xfaf9d['substring'](0x0,_0xfaf9d[_0x1d1a('0x9b')](_0x4d9e7e));}_0x541bca=util[_0x1d1a('0x9c')](_0x1d1a('0x9d'),_0xfaf9d);_0x4720f6=util[_0x1d1a('0x9c')](_0x1d1a('0x9e'),_0xfaf9d);_0x3cb0e3={'user':_0x3b8e3d[_0x1d1a('0x96')],'pass':_0x3b8e3d[_0x1d1a('0x97')]};var _0x1fdce5={'method':_0x1d1a('0x9f'),'uri':_0x541bca+'incident?sysparm_display_value=all','auth':_0x3cb0e3,'json':!![]};return rp(_0x1fdce5);}})['then'](function(_0x673460){if(_0x673460[_0x1d1a('0xa0')][_0x1d1a('0x32')]>0x0){_0x2320f2=_0x673460[_0x1d1a('0xa0')];}console[_0x1d1a('0xa1')]('incident\x20table\x20objects',_0x2320f2);_0x3d2aaf=[];_0x101453=Object[_0x1d1a('0xa2')]([],_0x2320f2);_['remove'](_0x101453,function(_0x56ab26){return!_0x2d45af[_0x1d1a('0xa3')](_0x56ab26[_0x1d1a('0x26')]);});_0x101453[_0x1d1a('0xa4')](function(_0x4d5417){var _0x112889=createFieldObject(_0x4720f6,_0x3cb0e3,_0x4d5417[_0x1d1a('0xa5')],_0x4d5417['name'],_0x4d5417[_0x1d1a('0xa6')],![]);_0x3d2aaf[_0x1d1a('0xa7')](_0x112889);});return Promise[_0x1d1a('0xa8')](_0x3d2aaf);})[_0x1d1a('0x23')](function(_0x52593c){_0x1b9ea8=_0x52593c;_0x9f452b=Object[_0x1d1a('0xa2')]([],_0x2320f2);console['log'](_0x1d1a('0xa9'),_0x2320f2);_[_0x1d1a('0xaa')](_0x9f452b,function(_0x1d2be2){return _0x5afcd0[_0x1d1a('0xa3')](_0x1d2be2[_0x1d1a('0x26')]);});console['log'](_0x1d1a('0xab'),_0x9f452b);_0x3d2aaf=[];_0x9f452b[_0x1d1a('0xa4')](function(_0x15aac5){var _0x2f9c4d=createFieldObject(_0x4720f6,_0x3cb0e3,_0x15aac5['internalType'],_0x15aac5[_0x1d1a('0x26')],_0x15aac5[_0x1d1a('0xa6')],!![]);_0x3d2aaf[_0x1d1a('0xa7')](_0x2f9c4d);});return Promise[_0x1d1a('0xa8')](_0x3d2aaf);})['then'](function(_0x5a23e8){_0x26146c=_0x5a23e8;var _0x2bb238=_0x1b9ea8['concat'](_0x26146c);return{'count':_0x2bb238[_0x1d1a('0x32')],'rows':_0x2bb238};})[_0x1d1a('0x23')](respondWithResult(_0x17133c,null))[_0x1d1a('0x41')](function(_0x4961c5){console[_0x1d1a('0xa1')](_0x1d1a('0xac')+_0x4961c5);var _0x4d7083=_0x320d86[_0x1d1a('0x2e')][_0x1d1a('0xad')]?0x1f4:_0x4961c5['statusCode']||0x1f4;logger[_0x1d1a('0x24')](_0x4961c5[_0x1d1a('0x25')]);delete _0x4961c5[_0x1d1a('0x26')];if(_0x4d7083===0x191){_0x4d7083=0x190;}_0x17133c[_0x1d1a('0x1a')](_0x4d7083)[_0x1d1a('0xae')](_0x320d86[_0x1d1a('0x2e')][_0x1d1a('0xad')]?{'message':_0x1d1a('0xaf'),'statusCode':_0x4961c5[_0x1d1a('0xb0')]}:_0x4961c5);});};function createFieldObject(_0x468532,_0x27c3c6,_0x3267f4,_0x41b0c3,_0x59e4bc,_0xa0fe4e){return new Promise(function(_0x852d3e,_0x3ea605){var _0x3248a7={'id':_0x41b0c3,'name':_0x59e4bc,'custom':_0xa0fe4e};if(_0x3267f4===_0x1d1a('0xb1')){_0x3248a7[_0x1d1a('0x3d')]=[{'name':_0x1d1a('0xb2'),'value':'true'},{'name':'False','value':'false'}];_0x852d3e(_0x3248a7);}else{var _0x27d20e={'method':_0x1d1a('0x9f'),'uri':_0x468532+_0x1d1a('0xb3')+_0x41b0c3,'auth':_0x27c3c6,'json':!![]};return rp(_0x27d20e)[_0x1d1a('0x23')](function(_0x282ced){var _0x107668=[];if(_0x282ced[_0x1d1a('0xa0')][_0x1d1a('0x32')]>0x0){_0x282ced[_0x1d1a('0xa0')][_0x1d1a('0xa4')](function(_0x24c0ac){if(_0x24c0ac[_0x1d1a('0xb4')]===_0x1d1a('0xb5')){var _0x71a419={'name':_0x24c0ac[_0x1d1a('0xa6')],'value':_0x24c0ac[_0x1d1a('0xb6')]};_0x107668[_0x1d1a('0xa7')](_0x71a419);}});}_0x3248a7[_0x1d1a('0x3d')]=_0x107668;if(_0x3248a7[_0x1d1a('0x3d')][_0x1d1a('0x32')]>0x0){_0x852d3e(_0x3248a7);}else{if(_0xa0fe4e==![]){_0x852d3e();}else{_0x852d3e(_0x3248a7);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0319bdc..756fe74 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','exports','int_servicenow_accounts'];(function(_0x500bf5,_0x4f5a26){var _0x1d254f=function(_0x17e9ef){while(--_0x17e9ef){_0x500bf5['push'](_0x500bf5['shift']());}};_0x1d254f(++_0x4f5a26);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3ca7a9,_0x4fc0c7){_0x3ca7a9=_0x3ca7a9-0x0;var _0x399428=_0xfdbd[_0x3ca7a9];return _0x399428;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('ServicenowAccount',attributes,{'tableName':_0xdfdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','../../config/logger','api'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x18ab9b,_0x5de071){_0x18ab9b=_0x18ab9b-0x0;var _0x15087=_0x7fbe[_0x18ab9b];return _0x15087;};'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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 3289333..f249209 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 _0xb9d8=['stringify','error','code','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0x63eb47,_0x52c242){var _0x26cefe=function(_0x2e2e11){while(--_0x2e2e11){_0x63eb47['push'](_0x63eb47['shift']());}};_0x26cefe(++_0x52c242);}(_0xb9d8,0x125));var _0x8b9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b9d('0x0'));var util=require(_0x8b9d('0x1'));var moment=require(_0x8b9d('0x2'));var BPromise=require(_0x8b9d('0x3'));var rs=require(_0x8b9d('0x4'));var fs=require('fs');var Redis=require(_0x8b9d('0x5'));var db=require(_0x8b9d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b9d('0x7'))(_0x8b9d('0x8'));var config=require(_0x8b9d('0x9'));var jayson=require(_0x8b9d('0xa'));var client=jayson[_0x8b9d('0xb')][_0x8b9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3954da,_0x1d24f4,_0x2688e4){return new BPromise(function(_0x25f2a3,_0x2f6924){return client[_0x8b9d('0xd')](_0x3954da,_0x2688e4)[_0x8b9d('0xe')](function(_0x223167){logger['info'](_0x8b9d('0xf'),_0x1d24f4,_0x8b9d('0x10'));logger[_0x8b9d('0x11')](_0x8b9d('0x12'),_0x1d24f4,_0x8b9d('0x10'),JSON[_0x8b9d('0x13')](_0x223167));if(_0x223167[_0x8b9d('0x14')]){if(_0x223167[_0x8b9d('0x14')][_0x8b9d('0x15')]===0x1f4){logger[_0x8b9d('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x1d24f4,_0x223167[_0x8b9d('0x14')][_0x8b9d('0x16')]);return _0x2f6924(_0x223167['error'][_0x8b9d('0x16')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1d24f4,_0x223167[_0x8b9d('0x14')][_0x8b9d('0x16')]);return _0x25f2a3(_0x223167[_0x8b9d('0x14')][_0x8b9d('0x16')]);}else{logger[_0x8b9d('0x17')](_0x8b9d('0xf'),_0x1d24f4,_0x8b9d('0x10'));_0x25f2a3(_0x223167[_0x8b9d('0x18')][_0x8b9d('0x16')]);}})[_0x8b9d('0x19')](function(_0x7494f5){logger[_0x8b9d('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x1d24f4,_0x7494f5);_0x2f6924(_0x7494f5);});});}exports[_0x8b9d('0x1a')]=function(_0x85d33f){var _0x36d1d3=this;return new Promise(function(_0x6b3898,_0x28de2d){return db[_0x8b9d('0x1b')][_0x8b9d('0x1c')]({'raw':_0x85d33f[_0x8b9d('0x1d')]?_0x85d33f[_0x8b9d('0x1d')][_0x8b9d('0x1e')]===undefined?!![]:![]:!![],'where':_0x85d33f[_0x8b9d('0x1d')]?_0x85d33f['options'][_0x8b9d('0x1f')]||null:null,'attributes':_0x85d33f['options']?_0x85d33f[_0x8b9d('0x1d')][_0x8b9d('0x20')]||null:null,'limit':_0x85d33f['options']?_0x85d33f[_0x8b9d('0x1d')][_0x8b9d('0x21')]||null:null,'include':_0x85d33f[_0x8b9d('0x1d')]?_0x85d33f['options'][_0x8b9d('0x22')]?_[_0x8b9d('0x23')](_0x85d33f[_0x8b9d('0x1d')][_0x8b9d('0x22')],function(_0x269f43){return{'model':db[_0x269f43[_0x8b9d('0x24')]],'as':_0x269f43['as'],'attributes':_0x269f43[_0x8b9d('0x20')],'include':_0x269f43['include']?_[_0x8b9d('0x23')](_0x269f43[_0x8b9d('0x22')],function(_0x47ee30){return{'model':db[_0x47ee30['model']],'as':_0x47ee30['as'],'attributes':_0x47ee30[_0x8b9d('0x20')],'include':_0x47ee30['include']?_['map'](_0x47ee30[_0x8b9d('0x22')],function(_0x10fed3){return{'model':db[_0x10fed3['model']],'as':_0x10fed3['as'],'attributes':_0x10fed3[_0x8b9d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b9d('0xe')](function(_0x3fd1a7){logger[_0x8b9d('0x17')](_0x8b9d('0x1a'),_0x85d33f);logger[_0x8b9d('0x11')](_0x8b9d('0x1a'),_0x85d33f,JSON[_0x8b9d('0x13')](_0x3fd1a7));_0x6b3898(_0x3fd1a7);})[_0x8b9d('0x19')](function(_0x374ff4){logger['error'](_0x8b9d('0x1a'),_0x374ff4[_0x8b9d('0x16')],_0x85d33f);_0x28de2d(_0x36d1d3[_0x8b9d('0x14')](0x1f4,_0x374ff4['message']));});});};exports['ShowServicenowAccount']=function(_0x5a7480){var _0x15667b=this;return new Promise(function(_0x38bd80,_0x2a8b21){return db['ServicenowAccount'][_0x8b9d('0x25')]({'raw':_0x5a7480[_0x8b9d('0x1d')]?_0x5a7480['options'][_0x8b9d('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a7480[_0x8b9d('0x1d')]?_0x5a7480[_0x8b9d('0x1d')][_0x8b9d('0x1f')]||null:null,'attributes':_0x5a7480['options']?_0x5a7480[_0x8b9d('0x1d')][_0x8b9d('0x20')]||null:null,'include':_0x5a7480[_0x8b9d('0x1d')]?_0x5a7480[_0x8b9d('0x1d')][_0x8b9d('0x22')]?_[_0x8b9d('0x23')](_0x5a7480[_0x8b9d('0x1d')][_0x8b9d('0x22')],function(_0x339e1b){return{'model':db[_0x339e1b[_0x8b9d('0x24')]],'as':_0x339e1b['as'],'attributes':_0x339e1b['attributes'],'include':_0x339e1b[_0x8b9d('0x22')]?_[_0x8b9d('0x23')](_0x339e1b[_0x8b9d('0x22')],function(_0x85d921){return{'model':db[_0x85d921[_0x8b9d('0x24')]],'as':_0x85d921['as'],'attributes':_0x85d921['attributes'],'include':_0x85d921['include']?_[_0x8b9d('0x23')](_0x85d921['include'],function(_0xcffee5){return{'model':db[_0xcffee5[_0x8b9d('0x24')]],'as':_0xcffee5['as'],'attributes':_0xcffee5[_0x8b9d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x582d27){logger[_0x8b9d('0x17')](_0x8b9d('0x26'),_0x5a7480);logger['debug'](_0x8b9d('0x26'),_0x5a7480,JSON[_0x8b9d('0x13')](_0x582d27));_0x38bd80(_0x582d27);})['catch'](function(_0x310fa5){logger[_0x8b9d('0x14')](_0x8b9d('0x26'),_0x310fa5[_0x8b9d('0x16')],_0x5a7480);_0x2a8b21(_0x15667b[_0x8b9d('0x14')](0x1f4,_0x310fa5[_0x8b9d('0x16')]));});});}; \ No newline at end of file +var _0x73ed=['../../config/environment','jayson/promise','client','http','request','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','options','raw','attributes','limit','map','include','model','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0x73ed,0xb1));var _0xd73e=function(_0x5293a1,_0x1f58fd){_0x5293a1=_0x5293a1-0x0;var _0x473c73=_0x73ed[_0x5293a1];return _0x473c73;};'use strict';var _=require(_0xd73e('0x0'));var util=require(_0xd73e('0x1'));var moment=require(_0xd73e('0x2'));var BPromise=require(_0xd73e('0x3'));var rs=require(_0xd73e('0x4'));var fs=require('fs');var Redis=require(_0xd73e('0x5'));var db=require(_0xd73e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd73e('0x7'))('rpc');var config=require(_0xd73e('0x8'));var jayson=require(_0xd73e('0x9'));var client=jayson[_0xd73e('0xa')][_0xd73e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa3a764,_0x5af8f5,_0x1978c2){return new BPromise(function(_0x22c0a9,_0x369728){return client[_0xd73e('0xc')](_0xa3a764,_0x1978c2)[_0xd73e('0xd')](function(_0x1455e5){logger[_0xd73e('0xe')](_0xd73e('0xf'),_0x5af8f5,_0xd73e('0x10'));logger[_0xd73e('0x11')](_0xd73e('0x12'),_0x5af8f5,_0xd73e('0x10'),JSON[_0xd73e('0x13')](_0x1455e5));if(_0x1455e5['error']){if(_0x1455e5[_0xd73e('0x14')][_0xd73e('0x15')]===0x1f4){logger[_0xd73e('0x14')](_0xd73e('0xf'),_0x5af8f5,_0x1455e5[_0xd73e('0x14')][_0xd73e('0x16')]);return _0x369728(_0x1455e5[_0xd73e('0x14')][_0xd73e('0x16')]);}logger['error'](_0xd73e('0xf'),_0x5af8f5,_0x1455e5[_0xd73e('0x14')][_0xd73e('0x16')]);return _0x22c0a9(_0x1455e5[_0xd73e('0x14')]['message']);}else{logger[_0xd73e('0xe')](_0xd73e('0xf'),_0x5af8f5,_0xd73e('0x10'));_0x22c0a9(_0x1455e5[_0xd73e('0x17')]['message']);}})[_0xd73e('0x18')](function(_0x54ded0){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5af8f5,_0x54ded0);_0x369728(_0x54ded0);});});}exports[_0xd73e('0x19')]=function(_0x3fd026){var _0x3ff10c=this;return new Promise(function(_0x337a95,_0xe6b201){return db[_0xd73e('0x1a')]['findAll']({'raw':_0x3fd026[_0xd73e('0x1b')]?_0x3fd026[_0xd73e('0x1b')][_0xd73e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3fd026[_0xd73e('0x1b')]?_0x3fd026[_0xd73e('0x1b')]['where']||null:null,'attributes':_0x3fd026[_0xd73e('0x1b')]?_0x3fd026[_0xd73e('0x1b')][_0xd73e('0x1d')]||null:null,'limit':_0x3fd026['options']?_0x3fd026['options'][_0xd73e('0x1e')]||null:null,'include':_0x3fd026[_0xd73e('0x1b')]?_0x3fd026[_0xd73e('0x1b')]['include']?_[_0xd73e('0x1f')](_0x3fd026[_0xd73e('0x1b')][_0xd73e('0x20')],function(_0x2c016e){return{'model':db[_0x2c016e[_0xd73e('0x21')]],'as':_0x2c016e['as'],'attributes':_0x2c016e['attributes'],'include':_0x2c016e[_0xd73e('0x20')]?_['map'](_0x2c016e['include'],function(_0x440009){return{'model':db[_0x440009[_0xd73e('0x21')]],'as':_0x440009['as'],'attributes':_0x440009[_0xd73e('0x1d')],'include':_0x440009[_0xd73e('0x20')]?_[_0xd73e('0x1f')](_0x440009['include'],function(_0x4da3c0){return{'model':db[_0x4da3c0[_0xd73e('0x21')]],'as':_0x4da3c0['as'],'attributes':_0x4da3c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd73e('0xd')](function(_0x52d4af){logger[_0xd73e('0xe')](_0xd73e('0x19'),_0x3fd026);logger[_0xd73e('0x11')]('GetServicenowAccount',_0x3fd026,JSON[_0xd73e('0x13')](_0x52d4af));_0x337a95(_0x52d4af);})['catch'](function(_0x1943e1){logger[_0xd73e('0x14')](_0xd73e('0x19'),_0x1943e1[_0xd73e('0x16')],_0x3fd026);_0xe6b201(_0x3ff10c['error'](0x1f4,_0x1943e1[_0xd73e('0x16')]));});});};exports[_0xd73e('0x22')]=function(_0xc60169){var _0x510aa1=this;return new Promise(function(_0x5acc5d,_0x5c1096){return db['ServicenowAccount'][_0xd73e('0x23')]({'raw':_0xc60169[_0xd73e('0x1b')]?_0xc60169['options'][_0xd73e('0x1c')]===undefined?!![]:![]:!![],'where':_0xc60169['options']?_0xc60169[_0xd73e('0x1b')][_0xd73e('0x24')]||null:null,'attributes':_0xc60169[_0xd73e('0x1b')]?_0xc60169['options'][_0xd73e('0x1d')]||null:null,'include':_0xc60169['options']?_0xc60169[_0xd73e('0x1b')]['include']?_[_0xd73e('0x1f')](_0xc60169[_0xd73e('0x1b')]['include'],function(_0x5d3853){return{'model':db[_0x5d3853['model']],'as':_0x5d3853['as'],'attributes':_0x5d3853[_0xd73e('0x1d')],'include':_0x5d3853[_0xd73e('0x20')]?_['map'](_0x5d3853[_0xd73e('0x20')],function(_0x52f3cc){return{'model':db[_0x52f3cc['model']],'as':_0x52f3cc['as'],'attributes':_0x52f3cc['attributes'],'include':_0x52f3cc[_0xd73e('0x20')]?_['map'](_0x52f3cc[_0xd73e('0x20')],function(_0x343c7c){return{'model':db[_0x343c7c['model']],'as':_0x343c7c['as'],'attributes':_0x343c7c[_0xd73e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd73e('0xd')](function(_0x2f442e){logger[_0xd73e('0xe')](_0xd73e('0x22'),_0xc60169);logger[_0xd73e('0x11')](_0xd73e('0x22'),_0xc60169,JSON[_0xd73e('0x13')](_0x2f442e));_0x5acc5d(_0x2f442e);})[_0xd73e('0x18')](function(_0x243087){logger[_0xd73e('0x14')](_0xd73e('0x22'),_0x243087[_0xd73e('0x16')],_0xc60169);_0x5c1096(_0x510aa1[_0xd73e('0x14')](0x1f4,_0x243087[_0xd73e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e8e8376..e74ae0e 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 _0x7a5e=['multer','util','path','connect-timeout','Router','../../config/environment','./intServicenowConfiguration.controller','get','show','getFields','/:id/subjects','/:id/descriptions','isAuthenticated','getDescriptions','put','/:id','update','delete','destroy','exports'];(function(_0x45c95c,_0xa0b806){var _0x52239b=function(_0x87c9da){while(--_0x87c9da){_0x45c95c['push'](_0x45c95c['shift']());}};_0x52239b(++_0xa0b806);}(_0x7a5e,0xf0));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe7a5('0x0'));var util=require(_0xe7a5('0x1'));var path=require(_0xe7a5('0x2'));var timeout=require(_0xe7a5('0x3'));var express=require('express');var router=express[_0xe7a5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe7a5('0x5'));var controller=require(_0xe7a5('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe7a5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe7a5('0x8')]);router[_0xe7a5('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe7a5('0x9')]);router[_0xe7a5('0x7')](_0xe7a5('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xe7a5('0x7')](_0xe7a5('0xb'),auth[_0xe7a5('0xc')](),controller[_0xe7a5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe7a5('0xe')](_0xe7a5('0xf'),auth[_0xe7a5('0xc')](),controller[_0xe7a5('0x10')]);router[_0xe7a5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe7a5('0x12')]);module[_0xe7a5('0x13')]=router; \ No newline at end of file +var _0xabf9=['isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xabf9,0x1f1));var _0x9abf=function(_0x15d9b6,_0x4e0772){_0x15d9b6=_0x15d9b6-0x0;var _0xb44729=_0xabf9[_0x15d9b6];return _0xb44729;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9abf('0x0'));var express=require(_0x9abf('0x1'));var router=express[_0x9abf('0x2')]();var fs_extra=require(_0x9abf('0x3'));var auth=require(_0x9abf('0x4'));var interaction=require(_0x9abf('0x5'));var config=require(_0x9abf('0x6'));var controller=require(_0x9abf('0x7'));router[_0x9abf('0x8')]('/',auth[_0x9abf('0x9')](),controller[_0x9abf('0xa')]);router['get'](_0x9abf('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9abf('0xc'),auth['isAuthenticated'](),controller[_0x9abf('0xd')]);router[_0x9abf('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x9abf('0xe')]);router[_0x9abf('0x8')](_0x9abf('0xf'),auth[_0x9abf('0x9')](),controller['getDescriptions']);router[_0x9abf('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9abf('0x11')]('/:id',auth[_0x9abf('0x9')](),controller[_0x9abf('0x12')]);router[_0x9abf('0x13')](_0x9abf('0xb'),auth[_0x9abf('0x9')](),controller[_0x9abf('0x14')]);module[_0x9abf('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0c2b175..66d94b2 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 _0xe09b=['exports','STRING'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xe09b,0x15e));var _0xbe09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe09b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xbe09('0x0')]={'name':{'type':Sequelize[_0xbe09('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7dbb=['STRING','sequelize','exports'];(function(_0x35a302,_0x4ca31f){var _0x5272cc=function(_0x5373f5){while(--_0x5373f5){_0x35a302['push'](_0x35a302['shift']());}};_0x5272cc(++_0x4ca31f);}(_0x7dbb,0x1c3));var _0xb7db=function(_0x36f85c,_0x3df8d2){_0x36f85c=_0x36f85c-0x0;var _0x25c138=_0x7dbb[_0x36f85c];return _0x25c138;};'use strict';var Sequelize=require(_0xb7db('0x0'));module[_0xb7db('0x1')]={'name':{'type':Sequelize[_0xb7db('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 218cabb..b209b91 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 _0x5475=['fields','includeAll','options','find','create','body','params','ServicenowField','hasOwnProperty','getFields','getSubjects','findOne','order','getDescriptions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','attributes','length','model','sort','where','pick','filter','type','VIRTUAL','merge','include','ServicenowConfiguration','rows','catch','show','keys'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x5475,0x1ae));var _0x5547=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x5475[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require(_0x5547('0x0'));var rimraf=require(_0x5547('0x1'));var zipdir=require(_0x5547('0x2'));var jsonpatch=require(_0x5547('0x3'));var rp=require(_0x5547('0x4'));var moment=require('moment');var BPromise=require(_0x5547('0x5'));var Mustache=require(_0x5547('0x6'));var util=require(_0x5547('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5547('0x8'));var fs=require('fs');var fs_extra=require(_0x5547('0x9'));var _=require(_0x5547('0xa'));var squel=require(_0x5547('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5547('0xc'));var querystring=require(_0x5547('0xd'));var Papa=require(_0x5547('0xe'));var Redis=require(_0x5547('0xf'));var authService=require(_0x5547('0x10'));var qs=require(_0x5547('0x11'));var as=require(_0x5547('0x12'));var hardwareService=require(_0x5547('0x13'));var logger=require(_0x5547('0x14'))(_0x5547('0x15'));var utils=require(_0x5547('0x16'));var config=require(_0x5547('0x17'));var licenseUtil=require(_0x5547('0x18'));var db=require(_0x5547('0x19'))['db'];function respondWithStatusCode(_0x25d450,_0x386019){_0x386019=_0x386019||0xcc;return function(_0x384b65){if(_0x384b65){return _0x25d450[_0x5547('0x1a')](_0x386019);}return _0x25d450[_0x5547('0x1b')](_0x386019)[_0x5547('0x1c')]();};}function respondWithResult(_0x11692a,_0x32ba77){_0x32ba77=_0x32ba77||0xc8;return function(_0x3efa8d){if(_0x3efa8d){return _0x11692a[_0x5547('0x1b')](_0x32ba77)[_0x5547('0x1d')](_0x3efa8d);}};}function respondWithFilteredResult(_0x5bda5e,_0x935ec2){return function(_0x2ba22c){if(_0x2ba22c){var _0x430e40=typeof _0x935ec2[_0x5547('0x1e')]===_0x5547('0x1f')&&typeof _0x935ec2[_0x5547('0x20')]==='undefined';var _0x2a30da=_0x2ba22c[_0x5547('0x21')];var _0x2dca08=_0x430e40?0x0:_0x935ec2[_0x5547('0x1e')];var _0x416225=_0x430e40?_0x2ba22c[_0x5547('0x21')]:_0x935ec2[_0x5547('0x1e')]+_0x935ec2['limit'];var _0x580ad4;if(_0x416225>=_0x2a30da){_0x416225=_0x2a30da;_0x580ad4=0xc8;}else{_0x580ad4=0xce;}_0x5bda5e[_0x5547('0x1b')](_0x580ad4);return _0x5bda5e[_0x5547('0x22')](_0x5547('0x23'),_0x2dca08+'-'+_0x416225+'/'+_0x2a30da)['json'](_0x2ba22c);}return null;};}function patchUpdates(_0x219019){return function(_0x398b2c){try{jsonpatch[_0x5547('0x24')](_0x398b2c,_0x219019,!![]);}catch(_0x4b1a10){return BPromise[_0x5547('0x25')](_0x4b1a10);}return _0x398b2c[_0x5547('0x26')]();};}function saveUpdates(_0x559bcd,_0x443bdf){return function(_0x1d062c){if(_0x1d062c){return _0x1d062c[_0x5547('0x27')](_0x559bcd)[_0x5547('0x28')](function(_0x40c43d){return _0x40c43d;});}return null;};}function removeEntity(_0x5e9499,_0x4fbf1f){return function(_0x5691a7){if(_0x5691a7){return _0x5691a7[_0x5547('0x29')]()[_0x5547('0x28')](function(){_0x5e9499[_0x5547('0x1b')](0xcc)[_0x5547('0x1c')]();});}};}function handleEntityNotFound(_0xbe2063,_0x40a157){return function(_0x1aa924){if(!_0x1aa924){_0xbe2063[_0x5547('0x1a')](0x194);}return _0x1aa924;};}function handleError(_0x56685a,_0x2a4d2f){_0x2a4d2f=_0x2a4d2f||0x1f4;return function(_0x4abc6e){logger['error'](_0x4abc6e['stack']);if(_0x4abc6e[_0x5547('0x2a')]){delete _0x4abc6e[_0x5547('0x2a')];}_0x56685a[_0x5547('0x1b')](_0x2a4d2f)[_0x5547('0x2b')](_0x4abc6e);};}exports[_0x5547('0x2c')]=function(_0x38220b,_0x2dc617){var _0x37a1a5={},_0x339522={},_0x3912f0={'count':0x0,'rows':[]};var _0x1df6da=_[_0x5547('0x2d')](db['ServicenowConfiguration'][_0x5547('0x2e')],function(_0x4557c3){return{'name':_0x4557c3[_0x5547('0x2f')],'type':_0x4557c3['type'][_0x5547('0x30')]};});_0x339522['model']=_['map'](_0x1df6da,_0x5547('0x2a'));_0x339522[_0x5547('0x31')]=_['keys'](_0x38220b[_0x5547('0x31')]);_0x339522[_0x5547('0x32')]=_[_0x5547('0x33')](_0x339522['model'],_0x339522['query']);_0x37a1a5[_0x5547('0x34')]=_['intersection'](_0x339522['model'],qs['fields'](_0x38220b['query']['fields']));_0x37a1a5['attributes']=_0x37a1a5[_0x5547('0x34')][_0x5547('0x35')]?_0x37a1a5['attributes']:_0x339522[_0x5547('0x36')];if(!_0x38220b[_0x5547('0x31')]['hasOwnProperty']('nolimit')){_0x37a1a5['limit']=qs[_0x5547('0x20')](_0x38220b['query']['limit']);_0x37a1a5[_0x5547('0x1e')]=qs[_0x5547('0x1e')](_0x38220b[_0x5547('0x31')][_0x5547('0x1e')]);}_0x37a1a5['order']=qs[_0x5547('0x37')](_0x38220b[_0x5547('0x31')][_0x5547('0x37')]);_0x37a1a5[_0x5547('0x38')]=qs['filters'](_[_0x5547('0x39')](_0x38220b[_0x5547('0x31')],_0x339522[_0x5547('0x32')]),_0x1df6da);if(_0x38220b['query'][_0x5547('0x3a')]){_0x37a1a5[_0x5547('0x38')]=_['merge'](_0x37a1a5[_0x5547('0x38')],{'$or':_[_0x5547('0x2d')](_0x1df6da,function(_0x23a239){if(_0x23a239[_0x5547('0x3b')]!==_0x5547('0x3c')){var _0x33eff0={};_0x33eff0[_0x23a239[_0x5547('0x2a')]]={'$like':'%'+_0x38220b[_0x5547('0x31')]['filter']+'%'};return _0x33eff0;}})});}_0x37a1a5=_[_0x5547('0x3d')]({},_0x37a1a5,_0x38220b['options']);var _0x745d84={'where':_0x37a1a5[_0x5547('0x38')]};return db['ServicenowConfiguration'][_0x5547('0x21')](_0x745d84)[_0x5547('0x28')](function(_0x1d2184){_0x3912f0[_0x5547('0x21')]=_0x1d2184;if(_0x38220b[_0x5547('0x31')]['includeAll']){_0x37a1a5[_0x5547('0x3e')]=[{'all':!![]}];}return db[_0x5547('0x3f')]['findAll'](_0x37a1a5);})[_0x5547('0x28')](function(_0x42a298){_0x3912f0[_0x5547('0x40')]=_0x42a298;return _0x3912f0;})[_0x5547('0x28')](respondWithFilteredResult(_0x2dc617,_0x37a1a5))[_0x5547('0x41')](handleError(_0x2dc617,null));};exports[_0x5547('0x42')]=function(_0x57c400,_0x4460d9){var _0x37eba9={'raw':![],'where':{'id':_0x57c400['params']['id']}},_0xc34d6f={};_0xc34d6f['model']=_[_0x5547('0x43')](db[_0x5547('0x3f')][_0x5547('0x2e')]);_0xc34d6f[_0x5547('0x31')]=_[_0x5547('0x43')](_0x57c400['query']);_0xc34d6f[_0x5547('0x32')]=_[_0x5547('0x33')](_0xc34d6f[_0x5547('0x36')],_0xc34d6f['query']);_0x37eba9['attributes']=_[_0x5547('0x33')](_0xc34d6f[_0x5547('0x36')],qs['fields'](_0x57c400['query'][_0x5547('0x44')]));_0x37eba9['attributes']=_0x37eba9[_0x5547('0x34')][_0x5547('0x35')]?_0x37eba9['attributes']:_0xc34d6f[_0x5547('0x36')];if(_0x57c400[_0x5547('0x31')][_0x5547('0x45')]){_0x37eba9[_0x5547('0x3e')]=[{'all':!![]}];}_0x37eba9=_[_0x5547('0x3d')]({},_0x37eba9,_0x57c400[_0x5547('0x46')]);return db[_0x5547('0x3f')][_0x5547('0x47')](_0x37eba9)[_0x5547('0x28')](handleEntityNotFound(_0x4460d9,null))['then'](respondWithResult(_0x4460d9,null))[_0x5547('0x41')](handleError(_0x4460d9,null));};exports['create']=function(_0x7eb798,_0x387ea9){return db[_0x5547('0x3f')][_0x5547('0x48')](_0x7eb798[_0x5547('0x49')],{})[_0x5547('0x28')](respondWithResult(_0x387ea9,0xc9))[_0x5547('0x41')](handleError(_0x387ea9,null));};exports[_0x5547('0x27')]=function(_0x48b454,_0x229124){if(_0x48b454['body']['id']){delete _0x48b454[_0x5547('0x49')]['id'];}return db[_0x5547('0x3f')][_0x5547('0x47')]({'where':{'id':_0x48b454[_0x5547('0x4a')]['id']}})[_0x5547('0x28')](handleEntityNotFound(_0x229124,null))['then'](saveUpdates(_0x48b454[_0x5547('0x49')],null))[_0x5547('0x28')](respondWithResult(_0x229124,null))[_0x5547('0x41')](handleError(_0x229124,null));};exports[_0x5547('0x29')]=function(_0x38413a,_0x2d7f4a){return db['ServicenowConfiguration'][_0x5547('0x47')]({'where':{'id':_0x38413a['params']['id']}})['then'](handleEntityNotFound(_0x2d7f4a,null))[_0x5547('0x28')](removeEntity(_0x2d7f4a,null))[_0x5547('0x41')](handleError(_0x2d7f4a,null));};exports['getFields']=function(_0x16108a,_0x1d8b1a,_0x18be88){var _0x3755ce={};var _0x3d508d={};var _0x48eab7;var _0x5ca052;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x16108a['params']['id']}})[_0x5547('0x28')](handleEntityNotFound(_0x1d8b1a,null))['then'](function(_0x4e3d63){if(_0x4e3d63){_0x48eab7=_0x4e3d63;_0x3d508d[_0x5547('0x36')]=_[_0x5547('0x43')](db[_0x5547('0x4b')]['rawAttributes']);_0x3d508d[_0x5547('0x31')]=_['keys'](_0x16108a[_0x5547('0x31')]);_0x3d508d[_0x5547('0x32')]=_['intersection'](_0x3d508d[_0x5547('0x36')],_0x3d508d[_0x5547('0x31')]);_0x3755ce[_0x5547('0x34')]=_[_0x5547('0x33')](_0x3d508d[_0x5547('0x36')],qs[_0x5547('0x44')](_0x16108a[_0x5547('0x31')][_0x5547('0x44')]));_0x3755ce[_0x5547('0x34')]=_0x3755ce['attributes']['length']?_0x3755ce[_0x5547('0x34')]:_0x3d508d['model'];_0x3755ce['order']=qs[_0x5547('0x37')](_0x16108a[_0x5547('0x31')][_0x5547('0x37')]);_0x3755ce['where']=qs[_0x5547('0x32')](_[_0x5547('0x39')](_0x16108a['query'],_0x3d508d[_0x5547('0x32')]));if(_0x16108a[_0x5547('0x31')][_0x5547('0x3a')]){_0x3755ce[_0x5547('0x38')]=_[_0x5547('0x3d')](_0x3755ce[_0x5547('0x38')],{'$or':_[_0x5547('0x2d')](_0x3755ce[_0x5547('0x34')],function(_0x151e1d){var _0x130e26={};_0x130e26[_0x151e1d]={'$like':'%'+_0x16108a[_0x5547('0x31')]['filter']+'%'};return _0x130e26;})});}_0x3755ce=_[_0x5547('0x3d')]({},_0x3755ce,_0x16108a[_0x5547('0x46')]);return _0x48eab7['getFields'](_0x3755ce);}})[_0x5547('0x28')](function(_0x46f369){if(_0x46f369){_0x5ca052=_0x46f369['length'];if(!_0x16108a['query'][_0x5547('0x4c')]('nolimit')){_0x3755ce[_0x5547('0x20')]=qs[_0x5547('0x20')](_0x16108a[_0x5547('0x31')]['limit']);_0x3755ce[_0x5547('0x1e')]=qs[_0x5547('0x1e')](_0x16108a[_0x5547('0x31')][_0x5547('0x1e')]);}return _0x48eab7[_0x5547('0x4d')](_0x3755ce);}})[_0x5547('0x28')](function(_0x4751c9){if(_0x4751c9){return _0x4751c9?{'count':_0x5ca052,'rows':_0x4751c9}:null;}})[_0x5547('0x28')](respondWithResult(_0x1d8b1a,null))[_0x5547('0x41')](handleError(_0x1d8b1a,null));};exports[_0x5547('0x4e')]=function(_0x42dc98,_0x2401d0,_0x537e7a){var _0x2519f7={};var _0xbae87b={};var _0x2f9921;var _0x5d2d8f;return db[_0x5547('0x3f')][_0x5547('0x4f')]({'where':{'id':_0x42dc98[_0x5547('0x4a')]['id']}})[_0x5547('0x28')](handleEntityNotFound(_0x2401d0,null))[_0x5547('0x28')](function(_0x821a0a){if(_0x821a0a){_0x2f9921=_0x821a0a;_0xbae87b['model']=_[_0x5547('0x43')](db[_0x5547('0x4b')][_0x5547('0x2e')]);_0xbae87b[_0x5547('0x31')]=_[_0x5547('0x43')](_0x42dc98[_0x5547('0x31')]);_0xbae87b[_0x5547('0x32')]=_['intersection'](_0xbae87b[_0x5547('0x36')],_0xbae87b['query']);_0x2519f7[_0x5547('0x34')]=_[_0x5547('0x33')](_0xbae87b[_0x5547('0x36')],qs[_0x5547('0x44')](_0x42dc98[_0x5547('0x31')][_0x5547('0x44')]));_0x2519f7['attributes']=_0x2519f7[_0x5547('0x34')][_0x5547('0x35')]?_0x2519f7[_0x5547('0x34')]:_0xbae87b[_0x5547('0x36')];_0x2519f7[_0x5547('0x50')]=qs[_0x5547('0x37')](_0x42dc98[_0x5547('0x31')][_0x5547('0x37')]);_0x2519f7[_0x5547('0x38')]=qs[_0x5547('0x32')](_[_0x5547('0x39')](_0x42dc98[_0x5547('0x31')],_0xbae87b['filters']));if(_0x42dc98[_0x5547('0x31')][_0x5547('0x3a')]){_0x2519f7[_0x5547('0x38')]=_[_0x5547('0x3d')](_0x2519f7[_0x5547('0x38')],{'$or':_['map'](_0x2519f7[_0x5547('0x34')],function(_0x52718d){var _0x58bf95={};_0x58bf95[_0x52718d]={'$like':'%'+_0x42dc98[_0x5547('0x31')]['filter']+'%'};return _0x58bf95;})});}_0x2519f7=_[_0x5547('0x3d')]({},_0x2519f7,_0x42dc98['options']);return _0x2f9921[_0x5547('0x4e')](_0x2519f7);}})[_0x5547('0x28')](function(_0x25aacc){if(_0x25aacc){_0x5d2d8f=_0x25aacc[_0x5547('0x35')];if(!_0x42dc98['query'][_0x5547('0x4c')]('nolimit')){_0x2519f7[_0x5547('0x20')]=qs['limit'](_0x42dc98[_0x5547('0x31')]['limit']);_0x2519f7[_0x5547('0x1e')]=qs[_0x5547('0x1e')](_0x42dc98['query']['offset']);}return _0x2f9921[_0x5547('0x4e')](_0x2519f7);}})[_0x5547('0x28')](function(_0xd753ad){if(_0xd753ad){return _0xd753ad?{'count':_0x5d2d8f,'rows':_0xd753ad}:null;}})[_0x5547('0x28')](respondWithResult(_0x2401d0,null))[_0x5547('0x41')](handleError(_0x2401d0,null));};exports[_0x5547('0x51')]=function(_0x290e70,_0x320100,_0x2a2c87){var _0x1177b6={};var _0x3bdae8={};var _0x349335;var _0x17fa5d;return db[_0x5547('0x3f')][_0x5547('0x4f')]({'where':{'id':_0x290e70[_0x5547('0x4a')]['id']}})[_0x5547('0x28')](handleEntityNotFound(_0x320100,null))['then'](function(_0x1b6855){if(_0x1b6855){_0x349335=_0x1b6855;_0x3bdae8['model']=_['keys'](db[_0x5547('0x4b')][_0x5547('0x2e')]);_0x3bdae8[_0x5547('0x31')]=_[_0x5547('0x43')](_0x290e70[_0x5547('0x31')]);_0x3bdae8[_0x5547('0x32')]=_[_0x5547('0x33')](_0x3bdae8['model'],_0x3bdae8[_0x5547('0x31')]);_0x1177b6[_0x5547('0x34')]=_[_0x5547('0x33')](_0x3bdae8['model'],qs[_0x5547('0x44')](_0x290e70['query'][_0x5547('0x44')]));_0x1177b6[_0x5547('0x34')]=_0x1177b6['attributes'][_0x5547('0x35')]?_0x1177b6[_0x5547('0x34')]:_0x3bdae8[_0x5547('0x36')];_0x1177b6[_0x5547('0x50')]=qs['sort'](_0x290e70[_0x5547('0x31')][_0x5547('0x37')]);_0x1177b6[_0x5547('0x38')]=qs[_0x5547('0x32')](_[_0x5547('0x39')](_0x290e70[_0x5547('0x31')],_0x3bdae8[_0x5547('0x32')]));if(_0x290e70[_0x5547('0x31')][_0x5547('0x3a')]){_0x1177b6[_0x5547('0x38')]=_[_0x5547('0x3d')](_0x1177b6['where'],{'$or':_['map'](_0x1177b6[_0x5547('0x34')],function(_0x3512a3){var _0x531bca={};_0x531bca[_0x3512a3]={'$like':'%'+_0x290e70['query'][_0x5547('0x3a')]+'%'};return _0x531bca;})});}_0x1177b6=_[_0x5547('0x3d')]({},_0x1177b6,_0x290e70[_0x5547('0x46')]);return _0x349335[_0x5547('0x51')](_0x1177b6);}})['then'](function(_0x3bfdac){if(_0x3bfdac){_0x17fa5d=_0x3bfdac[_0x5547('0x35')];if(!_0x290e70[_0x5547('0x31')][_0x5547('0x4c')](_0x5547('0x52'))){_0x1177b6[_0x5547('0x20')]=qs['limit'](_0x290e70[_0x5547('0x31')][_0x5547('0x20')]);_0x1177b6[_0x5547('0x1e')]=qs[_0x5547('0x1e')](_0x290e70[_0x5547('0x31')][_0x5547('0x1e')]);}return _0x349335[_0x5547('0x51')](_0x1177b6);}})[_0x5547('0x28')](function(_0x5aae29){if(_0x5aae29){return _0x5aae29?{'count':_0x17fa5d,'rows':_0x5aae29}:null;}})[_0x5547('0x28')](respondWithResult(_0x320100,null))[_0x5547('0x41')](handleError(_0x320100,null));}; \ No newline at end of file +var _0x890e=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','show','params','rawAttributes','find','catch','create','body','getFields','findOne','getSubjects','getDescriptions','ServicenowField','rimraf','zip-dir','bluebird','util','sox','ejs','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','ServicenowConfiguration','fieldName','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0x890e,0x13b));var _0xe890=function(_0x308ced,_0xe1baab){_0x308ced=_0x308ced-0x0;var _0x3e185b=_0x890e[_0x308ced];return _0x3e185b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe890('0x0'));var zipdir=require(_0xe890('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe890('0x2'));var Mustache=require('mustache');var util=require(_0xe890('0x3'));var path=require('path');var sox=require(_0xe890('0x4'));var csv=require('to-csv');var ejs=require(_0xe890('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe890('0x6'));var toCsv=require(_0xe890('0x7'));var querystring=require(_0xe890('0x8'));var Papa=require(_0xe890('0x9'));var Redis=require('ioredis');var authService=require(_0xe890('0xa'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe890('0xb'))(_0xe890('0xc'));var utils=require(_0xe890('0xd'));var config=require(_0xe890('0xe'));var licenseUtil=require(_0xe890('0xf'));var db=require(_0xe890('0x10'))['db'];function respondWithStatusCode(_0x4ea0dc,_0x5c3d6){_0x5c3d6=_0x5c3d6||0xcc;return function(_0x5d7092){if(_0x5d7092){return _0x4ea0dc[_0xe890('0x11')](_0x5c3d6);}return _0x4ea0dc[_0xe890('0x12')](_0x5c3d6)['end']();};}function respondWithResult(_0x5e152e,_0x24d8b1){_0x24d8b1=_0x24d8b1||0xc8;return function(_0x1004ce){if(_0x1004ce){return _0x5e152e[_0xe890('0x12')](_0x24d8b1)[_0xe890('0x13')](_0x1004ce);}};}function respondWithFilteredResult(_0x4486a5,_0x2fc2d7){return function(_0x368928){if(_0x368928){var _0x150baf=typeof _0x2fc2d7[_0xe890('0x14')]==='undefined'&&typeof _0x2fc2d7[_0xe890('0x15')]===_0xe890('0x16');var _0xb247e9=_0x368928['count'];var _0x5522ce=_0x150baf?0x0:_0x2fc2d7[_0xe890('0x14')];var _0x2dec5f=_0x150baf?_0x368928[_0xe890('0x17')]:_0x2fc2d7[_0xe890('0x14')]+_0x2fc2d7[_0xe890('0x15')];var _0x35c47d;if(_0x2dec5f>=_0xb247e9){_0x2dec5f=_0xb247e9;_0x35c47d=0xc8;}else{_0x35c47d=0xce;}_0x4486a5[_0xe890('0x12')](_0x35c47d);return _0x4486a5[_0xe890('0x18')](_0xe890('0x19'),_0x5522ce+'-'+_0x2dec5f+'/'+_0xb247e9)[_0xe890('0x13')](_0x368928);}return null;};}function patchUpdates(_0x188664){return function(_0x180c09){try{jsonpatch[_0xe890('0x1a')](_0x180c09,_0x188664,!![]);}catch(_0x46a590){return BPromise[_0xe890('0x1b')](_0x46a590);}return _0x180c09['save']();};}function saveUpdates(_0x2a0139,_0x5043cf){return function(_0x303900){if(_0x303900){return _0x303900[_0xe890('0x1c')](_0x2a0139)[_0xe890('0x1d')](function(_0xf244a4){return _0xf244a4;});}return null;};}function removeEntity(_0x58bd4d,_0x13611d){return function(_0x5c6a2e){if(_0x5c6a2e){return _0x5c6a2e[_0xe890('0x1e')]()[_0xe890('0x1d')](function(){_0x58bd4d[_0xe890('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ec8d2,_0x26bddc){return function(_0x297fe1){if(!_0x297fe1){_0x4ec8d2[_0xe890('0x11')](0x194);}return _0x297fe1;};}function handleError(_0x270a85,_0x59e340){_0x59e340=_0x59e340||0x1f4;return function(_0x144def){logger['error'](_0x144def[_0xe890('0x1f')]);if(_0x144def[_0xe890('0x20')]){delete _0x144def[_0xe890('0x20')];}_0x270a85[_0xe890('0x12')](_0x59e340)[_0xe890('0x21')](_0x144def);};}exports[_0xe890('0x22')]=function(_0x33c224,_0x224bd1){var _0xadd080={},_0x34b0f0={},_0x170c78={'count':0x0,'rows':[]};var _0x3c43f6=_['map'](db[_0xe890('0x23')]['rawAttributes'],function(_0x364bf3){return{'name':_0x364bf3[_0xe890('0x24')],'type':_0x364bf3['type'][_0xe890('0x25')]};});_0x34b0f0[_0xe890('0x26')]=_[_0xe890('0x27')](_0x3c43f6,_0xe890('0x20'));_0x34b0f0[_0xe890('0x28')]=_[_0xe890('0x29')](_0x33c224[_0xe890('0x28')]);_0x34b0f0[_0xe890('0x2a')]=_[_0xe890('0x2b')](_0x34b0f0[_0xe890('0x26')],_0x34b0f0[_0xe890('0x28')]);_0xadd080[_0xe890('0x2c')]=_[_0xe890('0x2b')](_0x34b0f0[_0xe890('0x26')],qs[_0xe890('0x2d')](_0x33c224[_0xe890('0x28')][_0xe890('0x2d')]));_0xadd080[_0xe890('0x2c')]=_0xadd080['attributes'][_0xe890('0x2e')]?_0xadd080['attributes']:_0x34b0f0['model'];if(!_0x33c224[_0xe890('0x28')][_0xe890('0x2f')](_0xe890('0x30'))){_0xadd080[_0xe890('0x15')]=qs[_0xe890('0x15')](_0x33c224[_0xe890('0x28')][_0xe890('0x15')]);_0xadd080['offset']=qs[_0xe890('0x14')](_0x33c224[_0xe890('0x28')][_0xe890('0x14')]);}_0xadd080[_0xe890('0x31')]=qs[_0xe890('0x32')](_0x33c224['query']['sort']);_0xadd080[_0xe890('0x33')]=qs[_0xe890('0x2a')](_[_0xe890('0x34')](_0x33c224[_0xe890('0x28')],_0x34b0f0[_0xe890('0x2a')]),_0x3c43f6);if(_0x33c224['query'][_0xe890('0x35')]){_0xadd080[_0xe890('0x33')]=_[_0xe890('0x36')](_0xadd080[_0xe890('0x33')],{'$or':_['map'](_0x3c43f6,function(_0x2e0842){if(_0x2e0842[_0xe890('0x37')]!==_0xe890('0x38')){var _0x56dd90={};_0x56dd90[_0x2e0842[_0xe890('0x20')]]={'$like':'%'+_0x33c224['query'][_0xe890('0x35')]+'%'};return _0x56dd90;}})});}_0xadd080=_[_0xe890('0x36')]({},_0xadd080,_0x33c224[_0xe890('0x39')]);var _0x33fd72={'where':_0xadd080[_0xe890('0x33')]};return db['ServicenowConfiguration'][_0xe890('0x17')](_0x33fd72)[_0xe890('0x1d')](function(_0x3512c1){_0x170c78[_0xe890('0x17')]=_0x3512c1;if(_0x33c224[_0xe890('0x28')]['includeAll']){_0xadd080[_0xe890('0x3a')]=[{'all':!![]}];}return db[_0xe890('0x23')]['findAll'](_0xadd080);})[_0xe890('0x1d')](function(_0x3cd886){_0x170c78[_0xe890('0x3b')]=_0x3cd886;return _0x170c78;})[_0xe890('0x1d')](respondWithFilteredResult(_0x224bd1,_0xadd080))['catch'](handleError(_0x224bd1,null));};exports[_0xe890('0x3c')]=function(_0x5b18da,_0x3ba6ea){var _0x5f0058={'raw':![],'where':{'id':_0x5b18da[_0xe890('0x3d')]['id']}},_0x21e799={};_0x21e799[_0xe890('0x26')]=_[_0xe890('0x29')](db[_0xe890('0x23')][_0xe890('0x3e')]);_0x21e799[_0xe890('0x28')]=_[_0xe890('0x29')](_0x5b18da[_0xe890('0x28')]);_0x21e799[_0xe890('0x2a')]=_[_0xe890('0x2b')](_0x21e799[_0xe890('0x26')],_0x21e799[_0xe890('0x28')]);_0x5f0058[_0xe890('0x2c')]=_[_0xe890('0x2b')](_0x21e799[_0xe890('0x26')],qs[_0xe890('0x2d')](_0x5b18da['query'][_0xe890('0x2d')]));_0x5f0058[_0xe890('0x2c')]=_0x5f0058[_0xe890('0x2c')][_0xe890('0x2e')]?_0x5f0058[_0xe890('0x2c')]:_0x21e799[_0xe890('0x26')];if(_0x5b18da[_0xe890('0x28')]['includeAll']){_0x5f0058[_0xe890('0x3a')]=[{'all':!![]}];}_0x5f0058=_[_0xe890('0x36')]({},_0x5f0058,_0x5b18da['options']);return db[_0xe890('0x23')][_0xe890('0x3f')](_0x5f0058)[_0xe890('0x1d')](handleEntityNotFound(_0x3ba6ea,null))[_0xe890('0x1d')](respondWithResult(_0x3ba6ea,null))[_0xe890('0x40')](handleError(_0x3ba6ea,null));};exports[_0xe890('0x41')]=function(_0x4ede75,_0x507e09){return db[_0xe890('0x23')][_0xe890('0x41')](_0x4ede75[_0xe890('0x42')],{})[_0xe890('0x1d')](respondWithResult(_0x507e09,0xc9))[_0xe890('0x40')](handleError(_0x507e09,null));};exports[_0xe890('0x1c')]=function(_0x4acd5e,_0x5be904){if(_0x4acd5e['body']['id']){delete _0x4acd5e[_0xe890('0x42')]['id'];}return db[_0xe890('0x23')][_0xe890('0x3f')]({'where':{'id':_0x4acd5e[_0xe890('0x3d')]['id']}})[_0xe890('0x1d')](handleEntityNotFound(_0x5be904,null))[_0xe890('0x1d')](saveUpdates(_0x4acd5e[_0xe890('0x42')],null))[_0xe890('0x1d')](respondWithResult(_0x5be904,null))[_0xe890('0x40')](handleError(_0x5be904,null));};exports[_0xe890('0x1e')]=function(_0x4cb968,_0x469abf){return db[_0xe890('0x23')][_0xe890('0x3f')]({'where':{'id':_0x4cb968['params']['id']}})[_0xe890('0x1d')](handleEntityNotFound(_0x469abf,null))[_0xe890('0x1d')](removeEntity(_0x469abf,null))[_0xe890('0x40')](handleError(_0x469abf,null));};exports[_0xe890('0x43')]=function(_0x58a64e,_0x1c890c,_0x2d3bd1){var _0x3944e4={};var _0x568718={};var _0x4ac98c;var _0x26afee;return db[_0xe890('0x23')][_0xe890('0x44')]({'where':{'id':_0x58a64e[_0xe890('0x3d')]['id']}})[_0xe890('0x1d')](handleEntityNotFound(_0x1c890c,null))[_0xe890('0x1d')](function(_0x2b8df5){if(_0x2b8df5){_0x4ac98c=_0x2b8df5;_0x568718[_0xe890('0x26')]=_['keys'](db['ServicenowField'][_0xe890('0x3e')]);_0x568718[_0xe890('0x28')]=_[_0xe890('0x29')](_0x58a64e['query']);_0x568718['filters']=_[_0xe890('0x2b')](_0x568718[_0xe890('0x26')],_0x568718[_0xe890('0x28')]);_0x3944e4[_0xe890('0x2c')]=_['intersection'](_0x568718[_0xe890('0x26')],qs[_0xe890('0x2d')](_0x58a64e[_0xe890('0x28')][_0xe890('0x2d')]));_0x3944e4[_0xe890('0x2c')]=_0x3944e4[_0xe890('0x2c')][_0xe890('0x2e')]?_0x3944e4[_0xe890('0x2c')]:_0x568718[_0xe890('0x26')];_0x3944e4[_0xe890('0x31')]=qs[_0xe890('0x32')](_0x58a64e[_0xe890('0x28')][_0xe890('0x32')]);_0x3944e4[_0xe890('0x33')]=qs[_0xe890('0x2a')](_[_0xe890('0x34')](_0x58a64e[_0xe890('0x28')],_0x568718[_0xe890('0x2a')]));if(_0x58a64e[_0xe890('0x28')]['filter']){_0x3944e4[_0xe890('0x33')]=_[_0xe890('0x36')](_0x3944e4[_0xe890('0x33')],{'$or':_['map'](_0x3944e4[_0xe890('0x2c')],function(_0x138a08){var _0x1335b4={};_0x1335b4[_0x138a08]={'$like':'%'+_0x58a64e[_0xe890('0x28')][_0xe890('0x35')]+'%'};return _0x1335b4;})});}_0x3944e4=_[_0xe890('0x36')]({},_0x3944e4,_0x58a64e[_0xe890('0x39')]);return _0x4ac98c[_0xe890('0x43')](_0x3944e4);}})['then'](function(_0x529feb){if(_0x529feb){_0x26afee=_0x529feb[_0xe890('0x2e')];if(!_0x58a64e[_0xe890('0x28')]['hasOwnProperty'](_0xe890('0x30'))){_0x3944e4['limit']=qs[_0xe890('0x15')](_0x58a64e[_0xe890('0x28')]['limit']);_0x3944e4['offset']=qs['offset'](_0x58a64e[_0xe890('0x28')][_0xe890('0x14')]);}return _0x4ac98c[_0xe890('0x43')](_0x3944e4);}})[_0xe890('0x1d')](function(_0x4d92f5){if(_0x4d92f5){return _0x4d92f5?{'count':_0x26afee,'rows':_0x4d92f5}:null;}})[_0xe890('0x1d')](respondWithResult(_0x1c890c,null))[_0xe890('0x40')](handleError(_0x1c890c,null));};exports['getSubjects']=function(_0x4c2d86,_0x37f002,_0xaa1013){var _0x59733a={};var _0x42b5cb={};var _0x39d56f;var _0x30bcc0;return db[_0xe890('0x23')][_0xe890('0x44')]({'where':{'id':_0x4c2d86['params']['id']}})[_0xe890('0x1d')](handleEntityNotFound(_0x37f002,null))['then'](function(_0xbfb3c5){if(_0xbfb3c5){_0x39d56f=_0xbfb3c5;_0x42b5cb[_0xe890('0x26')]=_[_0xe890('0x29')](db['ServicenowField']['rawAttributes']);_0x42b5cb[_0xe890('0x28')]=_[_0xe890('0x29')](_0x4c2d86[_0xe890('0x28')]);_0x42b5cb[_0xe890('0x2a')]=_[_0xe890('0x2b')](_0x42b5cb['model'],_0x42b5cb['query']);_0x59733a[_0xe890('0x2c')]=_[_0xe890('0x2b')](_0x42b5cb[_0xe890('0x26')],qs['fields'](_0x4c2d86[_0xe890('0x28')][_0xe890('0x2d')]));_0x59733a['attributes']=_0x59733a[_0xe890('0x2c')][_0xe890('0x2e')]?_0x59733a[_0xe890('0x2c')]:_0x42b5cb[_0xe890('0x26')];_0x59733a[_0xe890('0x31')]=qs[_0xe890('0x32')](_0x4c2d86[_0xe890('0x28')]['sort']);_0x59733a[_0xe890('0x33')]=qs[_0xe890('0x2a')](_['pick'](_0x4c2d86[_0xe890('0x28')],_0x42b5cb[_0xe890('0x2a')]));if(_0x4c2d86[_0xe890('0x28')][_0xe890('0x35')]){_0x59733a[_0xe890('0x33')]=_[_0xe890('0x36')](_0x59733a['where'],{'$or':_[_0xe890('0x27')](_0x59733a['attributes'],function(_0x1cb6b3){var _0x43eb99={};_0x43eb99[_0x1cb6b3]={'$like':'%'+_0x4c2d86[_0xe890('0x28')][_0xe890('0x35')]+'%'};return _0x43eb99;})});}_0x59733a=_['merge']({},_0x59733a,_0x4c2d86[_0xe890('0x39')]);return _0x39d56f['getSubjects'](_0x59733a);}})[_0xe890('0x1d')](function(_0x5d927f){if(_0x5d927f){_0x30bcc0=_0x5d927f[_0xe890('0x2e')];if(!_0x4c2d86['query'][_0xe890('0x2f')](_0xe890('0x30'))){_0x59733a['limit']=qs[_0xe890('0x15')](_0x4c2d86[_0xe890('0x28')][_0xe890('0x15')]);_0x59733a['offset']=qs['offset'](_0x4c2d86[_0xe890('0x28')][_0xe890('0x14')]);}return _0x39d56f[_0xe890('0x45')](_0x59733a);}})['then'](function(_0xbdc40d){if(_0xbdc40d){return _0xbdc40d?{'count':_0x30bcc0,'rows':_0xbdc40d}:null;}})['then'](respondWithResult(_0x37f002,null))['catch'](handleError(_0x37f002,null));};exports[_0xe890('0x46')]=function(_0x1a63f4,_0x5ae892,_0x31be1a){var _0xc27454={};var _0x1f8079={};var _0x1033ea;var _0x5eb5d8;return db[_0xe890('0x23')][_0xe890('0x44')]({'where':{'id':_0x1a63f4[_0xe890('0x3d')]['id']}})[_0xe890('0x1d')](handleEntityNotFound(_0x5ae892,null))[_0xe890('0x1d')](function(_0x2db77d){if(_0x2db77d){_0x1033ea=_0x2db77d;_0x1f8079[_0xe890('0x26')]=_[_0xe890('0x29')](db[_0xe890('0x47')]['rawAttributes']);_0x1f8079['query']=_[_0xe890('0x29')](_0x1a63f4[_0xe890('0x28')]);_0x1f8079[_0xe890('0x2a')]=_['intersection'](_0x1f8079[_0xe890('0x26')],_0x1f8079[_0xe890('0x28')]);_0xc27454[_0xe890('0x2c')]=_[_0xe890('0x2b')](_0x1f8079[_0xe890('0x26')],qs[_0xe890('0x2d')](_0x1a63f4['query'][_0xe890('0x2d')]));_0xc27454[_0xe890('0x2c')]=_0xc27454[_0xe890('0x2c')]['length']?_0xc27454[_0xe890('0x2c')]:_0x1f8079['model'];_0xc27454[_0xe890('0x31')]=qs['sort'](_0x1a63f4[_0xe890('0x28')][_0xe890('0x32')]);_0xc27454[_0xe890('0x33')]=qs[_0xe890('0x2a')](_[_0xe890('0x34')](_0x1a63f4[_0xe890('0x28')],_0x1f8079[_0xe890('0x2a')]));if(_0x1a63f4['query'][_0xe890('0x35')]){_0xc27454[_0xe890('0x33')]=_[_0xe890('0x36')](_0xc27454[_0xe890('0x33')],{'$or':_[_0xe890('0x27')](_0xc27454['attributes'],function(_0x89e3ac){var _0x591cc1={};_0x591cc1[_0x89e3ac]={'$like':'%'+_0x1a63f4[_0xe890('0x28')]['filter']+'%'};return _0x591cc1;})});}_0xc27454=_[_0xe890('0x36')]({},_0xc27454,_0x1a63f4['options']);return _0x1033ea[_0xe890('0x46')](_0xc27454);}})[_0xe890('0x1d')](function(_0x4c5b0b){if(_0x4c5b0b){_0x5eb5d8=_0x4c5b0b['length'];if(!_0x1a63f4[_0xe890('0x28')]['hasOwnProperty']('nolimit')){_0xc27454[_0xe890('0x15')]=qs[_0xe890('0x15')](_0x1a63f4[_0xe890('0x28')][_0xe890('0x15')]);_0xc27454['offset']=qs['offset'](_0x1a63f4[_0xe890('0x28')][_0xe890('0x14')]);}return _0x1033ea[_0xe890('0x46')](_0xc27454);}})['then'](function(_0x573fbd){if(_0x573fbd){return _0x573fbd?{'count':_0x5eb5d8,'rows':_0x573fbd}:null;}})[_0xe890('0x1d')](respondWithResult(_0x5ae892,null))[_0xe890('0x40')](handleError(_0x5ae892,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 4440ef2..a1bbc44 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 _0x7427=['api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x25bca6,_0xe415ea){var _0x3f8d02=function(_0x3e581b){while(--_0x3e581b){_0x25bca6['push'](_0x25bca6['shift']());}};_0x3f8d02(++_0xe415ea);}(_0x7427,0x111));var _0x7742=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x7427[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0x7742('0x0'));var util=require(_0x7742('0x1'));var logger=require(_0x7742('0x2'))(_0x7742('0x3'));var moment=require('moment');var BPromise=require(_0x7742('0x4'));var rp=require(_0x7742('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7742('0x6'));var config=require(_0x7742('0x7'));var attributes=require(_0x7742('0x8'));module[_0x7742('0x9')]=function(_0x360d59,_0x57fa9a){return _0x360d59['define'](_0x7742('0xa'),attributes,{'tableName':_0x7742('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe511=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','lodash','util','api'];(function(_0x506341,_0x40b3c6){var _0x57fea0=function(_0x445028){while(--_0x445028){_0x506341['push'](_0x506341['shift']());}};_0x57fea0(++_0x40b3c6);}(_0xe511,0x16f));var _0x1e51=function(_0xf237f7,_0xb11ac){_0xf237f7=_0xf237f7-0x0;var _0x2c183b=_0xe511[_0xf237f7];return _0x2c183b;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('ServicenowConfiguration',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 bb5ab22..beba9c9 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 _0x9767=['request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x4e6d97,_0x7871e8){var _0x2dc8bd=function(_0x12b6cb){while(--_0x12b6cb){_0x4e6d97['push'](_0x4e6d97['shift']());}};_0x2dc8bd(++_0x7871e8);}(_0x9767,0xb9));var _0x7976=function(_0x4bfcec,_0x56aeee){_0x4bfcec=_0x4bfcec-0x0;var _0x1f5793=_0x9767[_0x4bfcec];return _0x1f5793;};'use strict';var _=require(_0x7976('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7976('0x1'));var rs=require(_0x7976('0x2'));var fs=require('fs');var Redis=require(_0x7976('0x3'));var db=require(_0x7976('0x4'))['db'];var utils=require(_0x7976('0x5'));var logger=require(_0x7976('0x6'))(_0x7976('0x7'));var config=require(_0x7976('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7976('0x9')][_0x7976('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11fd25,_0x454eb9,_0x1a8dc6){return new BPromise(function(_0x24bb6b,_0x357e5f){return client[_0x7976('0xb')](_0x11fd25,_0x1a8dc6)['then'](function(_0xaa9292){logger[_0x7976('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x454eb9,_0x7976('0xd'));logger['debug'](_0x7976('0xe'),_0x454eb9,_0x7976('0xd'),JSON[_0x7976('0xf')](_0xaa9292));if(_0xaa9292[_0x7976('0x10')]){if(_0xaa9292[_0x7976('0x10')][_0x7976('0x11')]===0x1f4){logger['error'](_0x7976('0x12'),_0x454eb9,_0xaa9292[_0x7976('0x10')][_0x7976('0x13')]);return _0x357e5f(_0xaa9292[_0x7976('0x10')][_0x7976('0x13')]);}logger[_0x7976('0x10')](_0x7976('0x12'),_0x454eb9,_0xaa9292[_0x7976('0x10')][_0x7976('0x13')]);return _0x24bb6b(_0xaa9292[_0x7976('0x10')][_0x7976('0x13')]);}else{logger[_0x7976('0xc')](_0x7976('0x12'),_0x454eb9,_0x7976('0xd'));_0x24bb6b(_0xaa9292[_0x7976('0x14')]['message']);}})[_0x7976('0x15')](function(_0x296b95){logger[_0x7976('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x454eb9,_0x296b95);_0x357e5f(_0x296b95);});});} \ No newline at end of file +var _0x0b04=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x64d0bf,_0x514d37){var _0x581396=function(_0xf1d78){while(--_0xf1d78){_0x64d0bf['push'](_0x64d0bf['shift']());}};_0x581396(++_0x514d37);}(_0x0b04,0x164));var _0x40b0=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0b04[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x40b0('0x0'));var util=require(_0x40b0('0x1'));var moment=require(_0x40b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x40b0('0x3'));var fs=require('fs');var Redis=require(_0x40b0('0x4'));var db=require(_0x40b0('0x5'))['db'];var utils=require(_0x40b0('0x6'));var logger=require(_0x40b0('0x7'))('rpc');var config=require(_0x40b0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x40b0('0x9')][_0x40b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14433f,_0x524cb9,_0x478992){return new BPromise(function(_0x5127ca,_0x19a5f0){return client[_0x40b0('0xb')](_0x14433f,_0x478992)[_0x40b0('0xc')](function(_0x30f5cb){logger[_0x40b0('0xd')](_0x40b0('0xe'),_0x524cb9,_0x40b0('0xf'));logger[_0x40b0('0x10')](_0x40b0('0x11'),_0x524cb9,_0x40b0('0xf'),JSON[_0x40b0('0x12')](_0x30f5cb));if(_0x30f5cb[_0x40b0('0x13')]){if(_0x30f5cb['error'][_0x40b0('0x14')]===0x1f4){logger['error'](_0x40b0('0xe'),_0x524cb9,_0x30f5cb[_0x40b0('0x13')][_0x40b0('0x15')]);return _0x19a5f0(_0x30f5cb['error'][_0x40b0('0x15')]);}logger[_0x40b0('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x524cb9,_0x30f5cb[_0x40b0('0x13')]['message']);return _0x5127ca(_0x30f5cb[_0x40b0('0x13')][_0x40b0('0x15')]);}else{logger[_0x40b0('0xd')](_0x40b0('0xe'),_0x524cb9,_0x40b0('0xf'));_0x5127ca(_0x30f5cb[_0x40b0('0x16')][_0x40b0('0x15')]);}})[_0x40b0('0x17')](function(_0x4df8b6){logger['error'](_0x40b0('0xe'),_0x524cb9,_0x4df8b6);_0x19a5f0(_0x4df8b6);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e773192..5f0da7c 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 _0x1e64=['exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x4eabf4,_0x4f0134){var _0x130318=function(_0x566cf3){while(--_0x566cf3){_0x4eabf4['push'](_0x4eabf4['shift']());}};_0x130318(++_0x4f0134);}(_0x1e64,0x18d));var _0x41e6=function(_0x12e71e,_0x3d9790){_0x12e71e=_0x12e71e-0x0;var _0x5a83af=_0x1e64[_0x12e71e];return _0x5a83af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x41e6('0x0'));var timeout=require(_0x41e6('0x1'));var express=require('express');var router=express[_0x41e6('0x2')]();var fs_extra=require(_0x41e6('0x3'));var auth=require(_0x41e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x41e6('0x5'));var controller=require(_0x41e6('0x6'));router[_0x41e6('0x7')]('/',auth[_0x41e6('0x8')](),controller['index']);router['get'](_0x41e6('0x9'),auth[_0x41e6('0x8')](),controller[_0x41e6('0xa')]);router[_0x41e6('0xb')]('/',auth[_0x41e6('0x8')](),controller[_0x41e6('0xc')]);router[_0x41e6('0xd')](_0x41e6('0x9'),auth[_0x41e6('0x8')](),controller[_0x41e6('0xe')]);router[_0x41e6('0xf')]('/:id',auth[_0x41e6('0x8')](),controller[_0x41e6('0x10')]);module[_0x41e6('0x11')]=router; \ No newline at end of file +var _0x409e=['put','update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x409e,0x125));var _0xe409=function(_0x564242,_0x4159f7){_0x564242=_0x564242-0x0;var _0x2906fb=_0x409e[_0x564242];return _0x2906fb;};'use strict';var multer=require(_0xe409('0x0'));var util=require(_0xe409('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe409('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe409('0x3'));var interaction=require(_0xe409('0x4'));var config=require(_0xe409('0x5'));var controller=require(_0xe409('0x6'));router[_0xe409('0x7')]('/',auth[_0xe409('0x8')](),controller[_0xe409('0x9')]);router['get'](_0xe409('0xa'),auth['isAuthenticated'](),controller[_0xe409('0xb')]);router['post']('/',auth[_0xe409('0x8')](),controller[_0xe409('0xc')]);router[_0xe409('0xd')](_0xe409('0xa'),auth[_0xe409('0x8')](),controller[_0xe409('0xe')]);router[_0xe409('0xf')](_0xe409('0xa'),auth[_0xe409('0x8')](),controller['destroy']);module[_0xe409('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 04a589a..36e10a3 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 _0x9c03=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x9c03,0x112));var _0x39c0=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9c03[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x39c0('0x0'));module[_0x39c0('0x1')]={'type':{'type':Sequelize[_0x39c0('0x2')](_0x39c0('0x3'),_0x39c0('0x4'),_0x39c0('0x5'),_0x39c0('0x6'),'picklist'),'defaultValue':_0x39c0('0x3')},'content':{'type':Sequelize[_0x39c0('0x7')]},'key':{'type':Sequelize[_0x39c0('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x39c0('0x3'),_0x39c0('0x4'),_0x39c0('0x5'))},'keyContent':{'type':Sequelize[_0x39c0('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x39c0('0x7')]},'customField':{'type':Sequelize[_0x39c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x39c0('0x7')]}}; \ No newline at end of file +var _0xb30c=['keyValue','picklist','STRING','ENUM','BOOLEAN','string','variable','customVariable'];(function(_0x5968aa,_0xe0e979){var _0x2e0499=function(_0xa0512d){while(--_0xa0512d){_0x5968aa['push'](_0x5968aa['shift']());}};_0x2e0499(++_0xe0e979);}(_0xb30c,0x10d));var _0xcb30=function(_0x3775e6,_0x3bfa5e){_0x3775e6=_0x3775e6-0x0;var _0x50e289=_0xb30c[_0x3775e6];return _0x50e289;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xcb30('0x0'),_0xcb30('0x1'),_0xcb30('0x2'),_0xcb30('0x3'),_0xcb30('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcb30('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcb30('0x6')](_0xcb30('0x0'),_0xcb30('0x1'),_0xcb30('0x2'))},'keyContent':{'type':Sequelize[_0xcb30('0x5')]},'idField':{'type':Sequelize[_0xcb30('0x5')]},'nameField':{'type':Sequelize[_0xcb30('0x5')]},'customField':{'type':Sequelize[_0xcb30('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcb30('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index cd19f87..904a364 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 _0x00db=['pick','filters','filter','merge','VIRTUAL','options','ServicenowField','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x00db,0x1bd));var _0xb00d=function(_0x138479,_0x2164c6){_0x138479=_0x138479-0x0;var _0x46e691=_0x00db[_0x138479];return _0x46e691;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb00d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00d('0x1'));var moment=require(_0xb00d('0x2'));var BPromise=require(_0xb00d('0x3'));var Mustache=require(_0xb00d('0x4'));var util=require(_0xb00d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb00d('0x6'));var ejs=require(_0xb00d('0x7'));var fs=require('fs');var fs_extra=require(_0xb00d('0x8'));var _=require('lodash');var squel=require(_0xb00d('0x9'));var crypto=require(_0xb00d('0xa'));var jsforce=require(_0xb00d('0xb'));var deskjs=require(_0xb00d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb00d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb00d('0xe'));var as=require(_0xb00d('0xf'));var hardwareService=require(_0xb00d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xb00d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xb00d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7e54f7,_0x113e73){_0x113e73=_0x113e73||0xcc;return function(_0x248e4e){if(_0x248e4e){return _0x7e54f7[_0xb00d('0x13')](_0x113e73);}return _0x7e54f7['status'](_0x113e73)[_0xb00d('0x14')]();};}function respondWithResult(_0x54fbb5,_0xbf89ca){_0xbf89ca=_0xbf89ca||0xc8;return function(_0x3ba7db){if(_0x3ba7db){return _0x54fbb5[_0xb00d('0x15')](_0xbf89ca)[_0xb00d('0x16')](_0x3ba7db);}};}function respondWithFilteredResult(_0x4ce7d9,_0x5b5fd7){return function(_0x3dddbf){if(_0x3dddbf){var _0x8528ff=typeof _0x5b5fd7[_0xb00d('0x17')]===_0xb00d('0x18')&&typeof _0x5b5fd7['limit']==='undefined';var _0x3eb908=_0x3dddbf[_0xb00d('0x19')];var _0x1b1e28=_0x8528ff?0x0:_0x5b5fd7[_0xb00d('0x17')];var _0x115287=_0x8528ff?_0x3dddbf['count']:_0x5b5fd7[_0xb00d('0x17')]+_0x5b5fd7[_0xb00d('0x1a')];var _0xaa9684;if(_0x115287>=_0x3eb908){_0x115287=_0x3eb908;_0xaa9684=0xc8;}else{_0xaa9684=0xce;}_0x4ce7d9['status'](_0xaa9684);return _0x4ce7d9[_0xb00d('0x1b')]('Content-Range',_0x1b1e28+'-'+_0x115287+'/'+_0x3eb908)[_0xb00d('0x16')](_0x3dddbf);}return null;};}function patchUpdates(_0x4bb8ce){return function(_0x6e264d){try{jsonpatch[_0xb00d('0x1c')](_0x6e264d,_0x4bb8ce,!![]);}catch(_0x4b657e){return BPromise[_0xb00d('0x1d')](_0x4b657e);}return _0x6e264d[_0xb00d('0x1e')]();};}function saveUpdates(_0x435648,_0x58a671){return function(_0x58c807){if(_0x58c807){return _0x58c807[_0xb00d('0x1f')](_0x435648)[_0xb00d('0x20')](function(_0x220eab){return _0x220eab;});}return null;};}function removeEntity(_0x8a5f73,_0x207a52){return function(_0x13cd6f){if(_0x13cd6f){return _0x13cd6f['destroy']()[_0xb00d('0x20')](function(){_0x8a5f73[_0xb00d('0x15')](0xcc)[_0xb00d('0x14')]();});}};}function handleEntityNotFound(_0x362553,_0x4e275b){return function(_0x403651){if(!_0x403651){_0x362553[_0xb00d('0x13')](0x194);}return _0x403651;};}function handleError(_0x1f9038,_0x42199c){_0x42199c=_0x42199c||0x1f4;return function(_0x433e82){logger[_0xb00d('0x21')](_0x433e82[_0xb00d('0x22')]);if(_0x433e82[_0xb00d('0x23')]){delete _0x433e82['name'];}_0x1f9038[_0xb00d('0x15')](_0x42199c)[_0xb00d('0x24')](_0x433e82);};}exports[_0xb00d('0x25')]=function(_0x4a358d,_0x574b7a){var _0x542396={},_0x5e6f10={},_0x37a5b2={'count':0x0,'rows':[]};var _0x42b4fb=_[_0xb00d('0x26')](db['ServicenowField'][_0xb00d('0x27')],function(_0x472726){return{'name':_0x472726['fieldName'],'type':_0x472726[_0xb00d('0x28')][_0xb00d('0x29')]};});_0x5e6f10[_0xb00d('0x2a')]=_[_0xb00d('0x26')](_0x42b4fb,_0xb00d('0x23'));_0x5e6f10[_0xb00d('0x2b')]=_['keys'](_0x4a358d['query']);_0x5e6f10['filters']=_[_0xb00d('0x2c')](_0x5e6f10['model'],_0x5e6f10['query']);_0x542396[_0xb00d('0x2d')]=_['intersection'](_0x5e6f10['model'],qs[_0xb00d('0x2e')](_0x4a358d[_0xb00d('0x2b')][_0xb00d('0x2e')]));_0x542396[_0xb00d('0x2d')]=_0x542396[_0xb00d('0x2d')]['length']?_0x542396[_0xb00d('0x2d')]:_0x5e6f10[_0xb00d('0x2a')];if(!_0x4a358d[_0xb00d('0x2b')][_0xb00d('0x2f')](_0xb00d('0x30'))){_0x542396[_0xb00d('0x1a')]=qs[_0xb00d('0x1a')](_0x4a358d['query'][_0xb00d('0x1a')]);_0x542396[_0xb00d('0x17')]=qs['offset'](_0x4a358d['query'][_0xb00d('0x17')]);}_0x542396[_0xb00d('0x31')]=qs['sort'](_0x4a358d['query'][_0xb00d('0x32')]);_0x542396[_0xb00d('0x33')]=qs['filters'](_[_0xb00d('0x34')](_0x4a358d[_0xb00d('0x2b')],_0x5e6f10[_0xb00d('0x35')]),_0x42b4fb);if(_0x4a358d[_0xb00d('0x2b')][_0xb00d('0x36')]){_0x542396[_0xb00d('0x33')]=_[_0xb00d('0x37')](_0x542396[_0xb00d('0x33')],{'$or':_[_0xb00d('0x26')](_0x42b4fb,function(_0x2da2c7){if(_0x2da2c7[_0xb00d('0x28')]!==_0xb00d('0x38')){var _0x46486b={};_0x46486b[_0x2da2c7[_0xb00d('0x23')]]={'$like':'%'+_0x4a358d[_0xb00d('0x2b')][_0xb00d('0x36')]+'%'};return _0x46486b;}})});}_0x542396=_[_0xb00d('0x37')]({},_0x542396,_0x4a358d[_0xb00d('0x39')]);var _0x552390={'where':_0x542396[_0xb00d('0x33')]};return db[_0xb00d('0x3a')][_0xb00d('0x19')](_0x552390)['then'](function(_0x24234e){_0x37a5b2['count']=_0x24234e;if(_0x4a358d[_0xb00d('0x2b')][_0xb00d('0x3b')]){_0x542396[_0xb00d('0x3c')]=[{'all':!![]}];}return db[_0xb00d('0x3a')][_0xb00d('0x3d')](_0x542396);})[_0xb00d('0x20')](function(_0x5ed5b1){_0x37a5b2[_0xb00d('0x3e')]=_0x5ed5b1;return _0x37a5b2;})[_0xb00d('0x20')](respondWithFilteredResult(_0x574b7a,_0x542396))[_0xb00d('0x3f')](handleError(_0x574b7a,null));};exports[_0xb00d('0x40')]=function(_0x41e787,_0xd06d2c){var _0x6555a9={'raw':!![],'where':{'id':_0x41e787[_0xb00d('0x41')]['id']}},_0xd18187={};_0xd18187[_0xb00d('0x2a')]=_[_0xb00d('0x42')](db[_0xb00d('0x3a')][_0xb00d('0x27')]);_0xd18187[_0xb00d('0x2b')]=_[_0xb00d('0x42')](_0x41e787[_0xb00d('0x2b')]);_0xd18187[_0xb00d('0x35')]=_[_0xb00d('0x2c')](_0xd18187[_0xb00d('0x2a')],_0xd18187[_0xb00d('0x2b')]);_0x6555a9[_0xb00d('0x2d')]=_[_0xb00d('0x2c')](_0xd18187[_0xb00d('0x2a')],qs[_0xb00d('0x2e')](_0x41e787[_0xb00d('0x2b')][_0xb00d('0x2e')]));_0x6555a9[_0xb00d('0x2d')]=_0x6555a9['attributes']['length']?_0x6555a9[_0xb00d('0x2d')]:_0xd18187['model'];if(_0x41e787[_0xb00d('0x2b')]['includeAll']){_0x6555a9[_0xb00d('0x3c')]=[{'all':!![]}];}_0x6555a9=_['merge']({},_0x6555a9,_0x41e787['options']);return db['ServicenowField'][_0xb00d('0x43')](_0x6555a9)['then'](handleEntityNotFound(_0xd06d2c,null))['then'](respondWithResult(_0xd06d2c,null))['catch'](handleError(_0xd06d2c,null));};exports[_0xb00d('0x44')]=function(_0x5e0a28,_0x5b6804){return db[_0xb00d('0x3a')]['create'](_0x5e0a28[_0xb00d('0x45')],{})[_0xb00d('0x20')](respondWithResult(_0x5b6804,0xc9))[_0xb00d('0x3f')](handleError(_0x5b6804,null));};exports[_0xb00d('0x1f')]=function(_0xb3be5e,_0x42e96c){if(_0xb3be5e[_0xb00d('0x45')]['id']){delete _0xb3be5e[_0xb00d('0x45')]['id'];}return db[_0xb00d('0x3a')][_0xb00d('0x43')]({'where':{'id':_0xb3be5e[_0xb00d('0x41')]['id']}})[_0xb00d('0x20')](handleEntityNotFound(_0x42e96c,null))[_0xb00d('0x20')](saveUpdates(_0xb3be5e[_0xb00d('0x45')],null))['then'](respondWithResult(_0x42e96c,null))['catch'](handleError(_0x42e96c,null));};exports[_0xb00d('0x46')]=function(_0x2c161f,_0x41688c){return db[_0xb00d('0x3a')]['find']({'where':{'id':_0x2c161f[_0xb00d('0x41')]['id']}})[_0xb00d('0x20')](handleEntityNotFound(_0x41688c,null))[_0xb00d('0x20')](removeEntity(_0x41688c,null))[_0xb00d('0x3f')](handleError(_0x41688c,null));}; \ No newline at end of file +var _0x3d06=['json','undefined','limit','count','offset','set','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','ServicenowField','findAll','rows','catch','show','params','find','create','body','update','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x3d06,0x1a8));var _0x63d0=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x3d06[_0xf51c06];return _0x1d5420;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63d0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63d0('0x1'));var rp=require(_0x63d0('0x2'));var moment=require('moment');var BPromise=require(_0x63d0('0x3'));var Mustache=require(_0x63d0('0x4'));var util=require(_0x63d0('0x5'));var path=require(_0x63d0('0x6'));var sox=require(_0x63d0('0x7'));var csv=require(_0x63d0('0x8'));var ejs=require(_0x63d0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x63d0('0xa'));var crypto=require(_0x63d0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x63d0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x63d0('0xd'));var Redis=require(_0x63d0('0xe'));var authService=require(_0x63d0('0xf'));var qs=require(_0x63d0('0x10'));var as=require(_0x63d0('0x11'));var hardwareService=require(_0x63d0('0x12'));var logger=require(_0x63d0('0x13'))('api');var utils=require(_0x63d0('0x14'));var config=require(_0x63d0('0x15'));var licenseUtil=require(_0x63d0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a9cc1,_0x17e969){_0x17e969=_0x17e969||0xcc;return function(_0x223dd0){if(_0x223dd0){return _0x4a9cc1[_0x63d0('0x17')](_0x17e969);}return _0x4a9cc1[_0x63d0('0x18')](_0x17e969)[_0x63d0('0x19')]();};}function respondWithResult(_0x5909a2,_0x56ce7e){_0x56ce7e=_0x56ce7e||0xc8;return function(_0x16e8bc){if(_0x16e8bc){return _0x5909a2[_0x63d0('0x18')](_0x56ce7e)[_0x63d0('0x1a')](_0x16e8bc);}};}function respondWithFilteredResult(_0x26fa1c,_0x3c74f5){return function(_0x27a8d5){if(_0x27a8d5){var _0x244df=typeof _0x3c74f5['offset']===_0x63d0('0x1b')&&typeof _0x3c74f5[_0x63d0('0x1c')]===_0x63d0('0x1b');var _0x5723fa=_0x27a8d5[_0x63d0('0x1d')];var _0x133731=_0x244df?0x0:_0x3c74f5[_0x63d0('0x1e')];var _0x4a8671=_0x244df?_0x27a8d5[_0x63d0('0x1d')]:_0x3c74f5[_0x63d0('0x1e')]+_0x3c74f5['limit'];var _0x7146d7;if(_0x4a8671>=_0x5723fa){_0x4a8671=_0x5723fa;_0x7146d7=0xc8;}else{_0x7146d7=0xce;}_0x26fa1c[_0x63d0('0x18')](_0x7146d7);return _0x26fa1c[_0x63d0('0x1f')]('Content-Range',_0x133731+'-'+_0x4a8671+'/'+_0x5723fa)[_0x63d0('0x1a')](_0x27a8d5);}return null;};}function patchUpdates(_0xe5ba98){return function(_0x12198c){try{jsonpatch['apply'](_0x12198c,_0xe5ba98,!![]);}catch(_0x1b07ff){return BPromise[_0x63d0('0x20')](_0x1b07ff);}return _0x12198c[_0x63d0('0x21')]();};}function saveUpdates(_0x5a3556,_0x51dfcf){return function(_0x38e916){if(_0x38e916){return _0x38e916['update'](_0x5a3556)[_0x63d0('0x22')](function(_0x5cda77){return _0x5cda77;});}return null;};}function removeEntity(_0x36cccd,_0x36ef6f){return function(_0x5872b6){if(_0x5872b6){return _0x5872b6[_0x63d0('0x23')]()[_0x63d0('0x22')](function(){_0x36cccd[_0x63d0('0x18')](0xcc)[_0x63d0('0x19')]();});}};}function handleEntityNotFound(_0x93ad9c,_0x4e30af){return function(_0x3409a1){if(!_0x3409a1){_0x93ad9c['sendStatus'](0x194);}return _0x3409a1;};}function handleError(_0x357094,_0x593d0e){_0x593d0e=_0x593d0e||0x1f4;return function(_0xf68353){logger[_0x63d0('0x24')](_0xf68353[_0x63d0('0x25')]);if(_0xf68353[_0x63d0('0x26')]){delete _0xf68353['name'];}_0x357094['status'](_0x593d0e)[_0x63d0('0x27')](_0xf68353);};}exports[_0x63d0('0x28')]=function(_0x2e0db3,_0x4fbffe){var _0x182e5c={},_0x7df647={},_0x50a8fd={'count':0x0,'rows':[]};var _0x548304=_[_0x63d0('0x29')](db['ServicenowField'][_0x63d0('0x2a')],function(_0x1a0d89){return{'name':_0x1a0d89[_0x63d0('0x2b')],'type':_0x1a0d89[_0x63d0('0x2c')][_0x63d0('0x2d')]};});_0x7df647['model']=_['map'](_0x548304,'name');_0x7df647[_0x63d0('0x2e')]=_[_0x63d0('0x2f')](_0x2e0db3[_0x63d0('0x2e')]);_0x7df647[_0x63d0('0x30')]=_['intersection'](_0x7df647[_0x63d0('0x31')],_0x7df647[_0x63d0('0x2e')]);_0x182e5c['attributes']=_[_0x63d0('0x32')](_0x7df647[_0x63d0('0x31')],qs[_0x63d0('0x33')](_0x2e0db3['query'][_0x63d0('0x33')]));_0x182e5c['attributes']=_0x182e5c[_0x63d0('0x34')][_0x63d0('0x35')]?_0x182e5c[_0x63d0('0x34')]:_0x7df647['model'];if(!_0x2e0db3[_0x63d0('0x2e')][_0x63d0('0x36')](_0x63d0('0x37'))){_0x182e5c['limit']=qs[_0x63d0('0x1c')](_0x2e0db3[_0x63d0('0x2e')][_0x63d0('0x1c')]);_0x182e5c['offset']=qs['offset'](_0x2e0db3[_0x63d0('0x2e')][_0x63d0('0x1e')]);}_0x182e5c[_0x63d0('0x38')]=qs[_0x63d0('0x39')](_0x2e0db3['query']['sort']);_0x182e5c[_0x63d0('0x3a')]=qs['filters'](_[_0x63d0('0x3b')](_0x2e0db3[_0x63d0('0x2e')],_0x7df647['filters']),_0x548304);if(_0x2e0db3[_0x63d0('0x2e')][_0x63d0('0x3c')]){_0x182e5c[_0x63d0('0x3a')]=_[_0x63d0('0x3d')](_0x182e5c[_0x63d0('0x3a')],{'$or':_['map'](_0x548304,function(_0x51a5f2){if(_0x51a5f2[_0x63d0('0x2c')]!==_0x63d0('0x3e')){var _0x44be9d={};_0x44be9d[_0x51a5f2['name']]={'$like':'%'+_0x2e0db3[_0x63d0('0x2e')]['filter']+'%'};return _0x44be9d;}})});}_0x182e5c=_[_0x63d0('0x3d')]({},_0x182e5c,_0x2e0db3[_0x63d0('0x3f')]);var _0x279f5b={'where':_0x182e5c[_0x63d0('0x3a')]};return db['ServicenowField']['count'](_0x279f5b)[_0x63d0('0x22')](function(_0x515200){_0x50a8fd['count']=_0x515200;if(_0x2e0db3[_0x63d0('0x2e')]['includeAll']){_0x182e5c[_0x63d0('0x40')]=[{'all':!![]}];}return db[_0x63d0('0x41')][_0x63d0('0x42')](_0x182e5c);})[_0x63d0('0x22')](function(_0x318794){_0x50a8fd[_0x63d0('0x43')]=_0x318794;return _0x50a8fd;})['then'](respondWithFilteredResult(_0x4fbffe,_0x182e5c))[_0x63d0('0x44')](handleError(_0x4fbffe,null));};exports[_0x63d0('0x45')]=function(_0x4125b2,_0x2b02ec){var _0x2b60d7={'raw':!![],'where':{'id':_0x4125b2[_0x63d0('0x46')]['id']}},_0x4ac549={};_0x4ac549[_0x63d0('0x31')]=_[_0x63d0('0x2f')](db[_0x63d0('0x41')]['rawAttributes']);_0x4ac549['query']=_['keys'](_0x4125b2['query']);_0x4ac549[_0x63d0('0x30')]=_[_0x63d0('0x32')](_0x4ac549[_0x63d0('0x31')],_0x4ac549[_0x63d0('0x2e')]);_0x2b60d7[_0x63d0('0x34')]=_[_0x63d0('0x32')](_0x4ac549['model'],qs[_0x63d0('0x33')](_0x4125b2[_0x63d0('0x2e')]['fields']));_0x2b60d7[_0x63d0('0x34')]=_0x2b60d7[_0x63d0('0x34')]['length']?_0x2b60d7[_0x63d0('0x34')]:_0x4ac549[_0x63d0('0x31')];if(_0x4125b2[_0x63d0('0x2e')]['includeAll']){_0x2b60d7['include']=[{'all':!![]}];}_0x2b60d7=_[_0x63d0('0x3d')]({},_0x2b60d7,_0x4125b2[_0x63d0('0x3f')]);return db[_0x63d0('0x41')][_0x63d0('0x47')](_0x2b60d7)[_0x63d0('0x22')](handleEntityNotFound(_0x2b02ec,null))[_0x63d0('0x22')](respondWithResult(_0x2b02ec,null))['catch'](handleError(_0x2b02ec,null));};exports['create']=function(_0x378c54,_0x236c34){return db[_0x63d0('0x41')][_0x63d0('0x48')](_0x378c54[_0x63d0('0x49')],{})[_0x63d0('0x22')](respondWithResult(_0x236c34,0xc9))[_0x63d0('0x44')](handleError(_0x236c34,null));};exports[_0x63d0('0x4a')]=function(_0x17e67b,_0x4046c4){if(_0x17e67b[_0x63d0('0x49')]['id']){delete _0x17e67b[_0x63d0('0x49')]['id'];}return db[_0x63d0('0x41')][_0x63d0('0x47')]({'where':{'id':_0x17e67b[_0x63d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x4046c4,null))[_0x63d0('0x22')](saveUpdates(_0x17e67b[_0x63d0('0x49')],null))[_0x63d0('0x22')](respondWithResult(_0x4046c4,null))[_0x63d0('0x44')](handleError(_0x4046c4,null));};exports['destroy']=function(_0x409321,_0x1f1d95){return db['ServicenowField'][_0x63d0('0x47')]({'where':{'id':_0x409321[_0x63d0('0x46')]['id']}})[_0x63d0('0x22')](handleEntityNotFound(_0x1f1d95,null))[_0x63d0('0x22')](removeEntity(_0x1f1d95,null))[_0x63d0('0x44')](handleError(_0x1f1d95,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5cad2b7..5cd3a7e 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 _0xc011=['request-promise','path','rimraf','./intServicenowField.attributes','idField','lodash','util','../../config/logger','api','bluebird'];(function(_0x501416,_0x6f9619){var _0xf09d62=function(_0x556289){while(--_0x556289){_0x501416['push'](_0x501416['shift']());}};_0xf09d62(++_0x6f9619);}(_0xc011,0xa5));var _0x1c01=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0xc011[_0x2c93e2];return _0x57264e;};'use strict';var _=require(_0x1c01('0x0'));var util=require(_0x1c01('0x1'));var logger=require(_0x1c01('0x2'))(_0x1c01('0x3'));var moment=require('moment');var BPromise=require(_0x1c01('0x4'));var rp=require(_0x1c01('0x5'));var fs=require('fs');var path=require(_0x1c01('0x6'));var rimraf=require(_0x1c01('0x7'));var config=require('../../config/environment');var attributes=require(_0x1c01('0x8'));module['exports']=function(_0x56cf6f,_0x403b22){return _0x56cf6f['define']('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1c01('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x94a0=['int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x94a0,0x85));var _0x094a=function(_0x5e6f73,_0x3f27d8){_0x5e6f73=_0x5e6f73-0x0;var _0x432614=_0x94a0[_0x5e6f73];return _0x432614;};'use strict';var _=require(_0x094a('0x0'));var util=require('util');var logger=require(_0x094a('0x1'))(_0x094a('0x2'));var moment=require('moment');var BPromise=require(_0x094a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x094a('0x4'));var config=require(_0x094a('0x5'));var attributes=require(_0x094a('0x6'));module[_0x094a('0x7')]=function(_0x2ede7c,_0x251ceb){return _0x2ede7c[_0x094a('0x8')](_0x094a('0x9'),attributes,{'tableName':_0x094a('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x094a('0xb'),_0x094a('0xc')],'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 1f75e12..eb78786 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x2e16db,_0x1ded40){var _0x11a2d9=function(_0x3af5e4){while(--_0x3af5e4){_0x2e16db['push'](_0x2e16db['shift']());}};_0x11a2d9(++_0x1ded40);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xb7e7[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb080ae,_0xda7782){var _0x56c3dd=function(_0x49fedb){while(--_0x49fedb){_0xb080ae['push'](_0xb080ae['shift']());}};_0x56c3dd(++_0xda7782);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index aeee3bf..e7a9f54 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(_0x531729,_0x1b2520){var _0x40edfb=function(_0x2c21e4){while(--_0x2c21e4){_0x531729['push'](_0x531729['shift']());}};_0x40edfb(++_0x1b2520);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x22eb47,_0x5cd02e){var _0x52994e=function(_0x25ffd2){while(--_0x25ffd2){_0x22eb47['push'](_0x22eb47['shift']());}};_0x52994e(++_0x5cd02e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e13e421..69b7e7d 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(_0x5293fd,_0x959063){var _0x1449cf=function(_0x30dcf5){while(--_0x30dcf5){_0x5293fd['push'](_0x5293fd['shift']());}};_0x1449cf(++_0x959063);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x3b99d6,_0x5c5cec){var _0x324e3c=function(_0x29903){while(--_0x29903){_0x3b99d6['push'](_0x3b99d6['shift']());}};_0x324e3c(++_0x5c5cec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 3c8f432..738a58b 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 _0xae73=['remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','stack','name','map','SugarcrmAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','body','update','destroy','rawAttributes','length','pick','filter','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','created_by','description','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','stringify','values'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xae73,0x16a));var _0x3ae7=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xae73[_0x5e6ea3];return _0x4048b5;};'use strict';var emlformat=require(_0x3ae7('0x0'));var rimraf=require(_0x3ae7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ae7('0x2'));var rp=require(_0x3ae7('0x3'));var moment=require(_0x3ae7('0x4'));var BPromise=require(_0x3ae7('0x5'));var Mustache=require('mustache');var util=require(_0x3ae7('0x6'));var path=require(_0x3ae7('0x7'));var sox=require('sox');var csv=require(_0x3ae7('0x8'));var ejs=require(_0x3ae7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ae7('0xa'));var crypto=require(_0x3ae7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3ae7('0xc'));var toCsv=require(_0x3ae7('0x8'));var querystring=require('querystring');var Papa=require(_0x3ae7('0xd'));var Redis=require(_0x3ae7('0xe'));var authService=require(_0x3ae7('0xf'));var qs=require(_0x3ae7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ae7('0x11'));var logger=require('../../config/logger')(_0x3ae7('0x12'));var utils=require(_0x3ae7('0x13'));var config=require(_0x3ae7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ae7('0x15'))['db'];var integrations=require(_0x3ae7('0x16'));function respondWithStatusCode(_0x23c4ba,_0x3a902c){_0x3a902c=_0x3a902c||0xcc;return function(_0x52ce93){if(_0x52ce93){return _0x23c4ba[_0x3ae7('0x17')](_0x3a902c);}return _0x23c4ba[_0x3ae7('0x18')](_0x3a902c)[_0x3ae7('0x19')]();};}function respondWithResult(_0xf62535,_0x4edcd7){_0x4edcd7=_0x4edcd7||0xc8;return function(_0x34ab93){if(_0x34ab93){return _0xf62535[_0x3ae7('0x18')](_0x4edcd7)[_0x3ae7('0x1a')](_0x34ab93);}};}function respondWithFilteredResult(_0x275cab,_0x312e75){return function(_0x34d7ad){if(_0x34d7ad){var _0x40a709=typeof _0x312e75[_0x3ae7('0x1b')]==='undefined'&&typeof _0x312e75[_0x3ae7('0x1c')]===_0x3ae7('0x1d');var _0x3f1901=_0x34d7ad['count'];var _0x31c545=_0x40a709?0x0:_0x312e75[_0x3ae7('0x1b')];var _0x118ac2=_0x40a709?_0x34d7ad[_0x3ae7('0x1e')]:_0x312e75[_0x3ae7('0x1b')]+_0x312e75[_0x3ae7('0x1c')];var _0x3d36bb;if(_0x118ac2>=_0x3f1901){_0x118ac2=_0x3f1901;_0x3d36bb=0xc8;}else{_0x3d36bb=0xce;}_0x275cab[_0x3ae7('0x18')](_0x3d36bb);return _0x275cab[_0x3ae7('0x1f')]('Content-Range',_0x31c545+'-'+_0x118ac2+'/'+_0x3f1901)['json'](_0x34d7ad);}return null;};}function patchUpdates(_0x3f2b46){return function(_0x28fb2f){try{jsonpatch[_0x3ae7('0x20')](_0x28fb2f,_0x3f2b46,!![]);}catch(_0xc0d607){return BPromise[_0x3ae7('0x21')](_0xc0d607);}return _0x28fb2f[_0x3ae7('0x22')]();};}function saveUpdates(_0x5ea9db,_0xc04165){return function(_0x32fa93){if(_0x32fa93){return _0x32fa93['update'](_0x5ea9db)[_0x3ae7('0x23')](function(_0x1fd78c){return _0x1fd78c;});}return null;};}function removeEntity(_0x3121ac,_0x48d5e4){return function(_0x3cab61){if(_0x3cab61){return _0x3cab61['destroy']()['then'](function(){_0x3121ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e571b,_0x1231f8){return function(_0xb3d7b0){if(!_0xb3d7b0){_0x3e571b[_0x3ae7('0x17')](0x194);}return _0xb3d7b0;};}function handleError(_0x2a7734,_0x3c631b){_0x3c631b=_0x3c631b||0x1f4;return function(_0x275fd9){logger['error'](_0x275fd9[_0x3ae7('0x24')]);if(_0x275fd9[_0x3ae7('0x25')]){delete _0x275fd9[_0x3ae7('0x25')];}_0x2a7734[_0x3ae7('0x18')](_0x3c631b)['send'](_0x275fd9);};}exports['index']=function(_0x5b79dd,_0x47bceb){var _0x4dba5e={},_0x59e71e={},_0x35d2d5={'count':0x0,'rows':[]};var _0x1d18a8=_[_0x3ae7('0x26')](db[_0x3ae7('0x27')]['rawAttributes'],function(_0x256a4a){return{'name':_0x256a4a[_0x3ae7('0x28')],'type':_0x256a4a[_0x3ae7('0x29')][_0x3ae7('0x2a')]};});_0x59e71e[_0x3ae7('0x2b')]=_['map'](_0x1d18a8,_0x3ae7('0x25'));_0x59e71e[_0x3ae7('0x2c')]=_[_0x3ae7('0x2d')](_0x5b79dd[_0x3ae7('0x2c')]);_0x59e71e[_0x3ae7('0x2e')]=_['intersection'](_0x59e71e[_0x3ae7('0x2b')],_0x59e71e[_0x3ae7('0x2c')]);_0x4dba5e['attributes']=_[_0x3ae7('0x2f')](_0x59e71e[_0x3ae7('0x2b')],qs[_0x3ae7('0x30')](_0x5b79dd[_0x3ae7('0x2c')][_0x3ae7('0x30')]));_0x4dba5e[_0x3ae7('0x31')]=_0x4dba5e[_0x3ae7('0x31')]['length']?_0x4dba5e[_0x3ae7('0x31')]:_0x59e71e[_0x3ae7('0x2b')];if(!_0x5b79dd[_0x3ae7('0x2c')][_0x3ae7('0x32')](_0x3ae7('0x33'))){_0x4dba5e[_0x3ae7('0x1c')]=qs['limit'](_0x5b79dd[_0x3ae7('0x2c')][_0x3ae7('0x1c')]);_0x4dba5e['offset']=qs[_0x3ae7('0x1b')](_0x5b79dd['query'][_0x3ae7('0x1b')]);}_0x4dba5e[_0x3ae7('0x34')]=qs[_0x3ae7('0x35')](_0x5b79dd['query']['sort']);_0x4dba5e['where']=qs['filters'](_['pick'](_0x5b79dd[_0x3ae7('0x2c')],_0x59e71e[_0x3ae7('0x2e')]),_0x1d18a8);if(_0x5b79dd[_0x3ae7('0x2c')]['filter']){_0x4dba5e[_0x3ae7('0x36')]=_[_0x3ae7('0x37')](_0x4dba5e[_0x3ae7('0x36')],{'$or':_['map'](_0x1d18a8,function(_0x45a4fc){if(_0x45a4fc[_0x3ae7('0x29')]!==_0x3ae7('0x38')){var _0x825238={};_0x825238[_0x45a4fc[_0x3ae7('0x25')]]={'$like':'%'+_0x5b79dd[_0x3ae7('0x2c')]['filter']+'%'};return _0x825238;}})});}_0x4dba5e=_[_0x3ae7('0x37')]({},_0x4dba5e,_0x5b79dd[_0x3ae7('0x39')]);var _0x228869={'where':_0x4dba5e[_0x3ae7('0x36')]};return db['SugarcrmAccount'][_0x3ae7('0x1e')](_0x228869)[_0x3ae7('0x23')](function(_0x10d23f){_0x35d2d5['count']=_0x10d23f;if(_0x5b79dd[_0x3ae7('0x2c')][_0x3ae7('0x3a')]){_0x4dba5e[_0x3ae7('0x3b')]=[{'all':!![]}];}return db[_0x3ae7('0x27')]['findAll'](_0x4dba5e);})[_0x3ae7('0x23')](function(_0x87759c){_0x35d2d5[_0x3ae7('0x3c')]=_0x87759c;return _0x35d2d5;})[_0x3ae7('0x23')](respondWithFilteredResult(_0x47bceb,_0x4dba5e))[_0x3ae7('0x3d')](handleError(_0x47bceb,null));};exports['show']=function(_0x3ca5c9,_0x18ad19){var _0x268100={'raw':![],'where':{'id':_0x3ca5c9[_0x3ae7('0x3e')]['id']}},_0x55e289={};_0x55e289['model']=_[_0x3ae7('0x2d')](db[_0x3ae7('0x27')]['rawAttributes']);_0x55e289['query']=_['keys'](_0x3ca5c9[_0x3ae7('0x2c')]);_0x55e289['filters']=_[_0x3ae7('0x2f')](_0x55e289[_0x3ae7('0x2b')],_0x55e289[_0x3ae7('0x2c')]);_0x268100[_0x3ae7('0x31')]=_[_0x3ae7('0x2f')](_0x55e289['model'],qs[_0x3ae7('0x30')](_0x3ca5c9[_0x3ae7('0x2c')][_0x3ae7('0x30')]));_0x268100[_0x3ae7('0x31')]=_0x268100[_0x3ae7('0x31')]['length']?_0x268100[_0x3ae7('0x31')]:_0x55e289['model'];if(_0x3ca5c9[_0x3ae7('0x2c')][_0x3ae7('0x3a')]){_0x268100[_0x3ae7('0x3b')]=[{'all':!![]}];}_0x268100=_[_0x3ae7('0x37')]({},_0x268100,_0x3ca5c9[_0x3ae7('0x39')]);return db[_0x3ae7('0x27')][_0x3ae7('0x3f')](_0x268100)[_0x3ae7('0x23')](handleEntityNotFound(_0x18ad19,null))[_0x3ae7('0x23')](respondWithResult(_0x18ad19,null))[_0x3ae7('0x3d')](handleError(_0x18ad19,null));};exports['create']=function(_0x3eec8f,_0x2de377){return db['SugarcrmAccount']['create'](_0x3eec8f[_0x3ae7('0x40')],{})[_0x3ae7('0x23')](respondWithResult(_0x2de377,0xc9))[_0x3ae7('0x3d')](handleError(_0x2de377,null));};exports[_0x3ae7('0x41')]=function(_0x23a785,_0x346c0e){if(_0x23a785[_0x3ae7('0x40')]['id']){delete _0x23a785[_0x3ae7('0x40')]['id'];}return db[_0x3ae7('0x27')][_0x3ae7('0x3f')]({'where':{'id':_0x23a785[_0x3ae7('0x3e')]['id']}})[_0x3ae7('0x23')](handleEntityNotFound(_0x346c0e,null))[_0x3ae7('0x23')](saveUpdates(_0x23a785[_0x3ae7('0x40')],null))[_0x3ae7('0x23')](respondWithResult(_0x346c0e,null))[_0x3ae7('0x3d')](handleError(_0x346c0e,null));};exports[_0x3ae7('0x42')]=function(_0x448889,_0x501814){return db[_0x3ae7('0x27')][_0x3ae7('0x3f')]({'where':{'id':_0x448889[_0x3ae7('0x3e')]['id']}})[_0x3ae7('0x23')](handleEntityNotFound(_0x501814,null))['then'](removeEntity(_0x501814,null))['catch'](handleError(_0x501814,null));};exports['getConfigurations']=function(_0x256f0f,_0x314ad5,_0x51862f){var _0xfd2913={};var _0x331fc1={};var _0xec3a4;var _0xba7588;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x256f0f[_0x3ae7('0x3e')]['id']}})[_0x3ae7('0x23')](handleEntityNotFound(_0x314ad5,null))[_0x3ae7('0x23')](function(_0x44fd70){if(_0x44fd70){_0xec3a4=_0x44fd70;_0x331fc1['model']=_[_0x3ae7('0x2d')](db['SugarcrmConfiguration'][_0x3ae7('0x43')]);_0x331fc1['query']=_[_0x3ae7('0x2d')](_0x256f0f[_0x3ae7('0x2c')]);_0x331fc1[_0x3ae7('0x2e')]=_['intersection'](_0x331fc1[_0x3ae7('0x2b')],_0x331fc1[_0x3ae7('0x2c')]);_0xfd2913['attributes']=_[_0x3ae7('0x2f')](_0x331fc1[_0x3ae7('0x2b')],qs[_0x3ae7('0x30')](_0x256f0f[_0x3ae7('0x2c')][_0x3ae7('0x30')]));_0xfd2913[_0x3ae7('0x31')]=_0xfd2913[_0x3ae7('0x31')][_0x3ae7('0x44')]?_0xfd2913[_0x3ae7('0x31')]:_0x331fc1['model'];_0xfd2913['order']=qs['sort'](_0x256f0f[_0x3ae7('0x2c')][_0x3ae7('0x35')]);_0xfd2913[_0x3ae7('0x36')]=qs[_0x3ae7('0x2e')](_[_0x3ae7('0x45')](_0x256f0f['query'],_0x331fc1[_0x3ae7('0x2e')]));if(_0x256f0f[_0x3ae7('0x2c')][_0x3ae7('0x46')]){_0xfd2913[_0x3ae7('0x36')]=_[_0x3ae7('0x37')](_0xfd2913[_0x3ae7('0x36')],{'$or':_[_0x3ae7('0x26')](_0xfd2913[_0x3ae7('0x31')],function(_0x2b8b6c){var _0x45e4b4={};_0x45e4b4[_0x2b8b6c]={'$like':'%'+_0x256f0f['query']['filter']+'%'};return _0x45e4b4;})});}_0xfd2913=_[_0x3ae7('0x37')]({},_0xfd2913,_0x256f0f[_0x3ae7('0x39')]);return _0xec3a4[_0x3ae7('0x47')](_0xfd2913);}})[_0x3ae7('0x23')](function(_0x88d243){if(_0x88d243){_0xba7588=_0x88d243[_0x3ae7('0x44')];if(!_0x256f0f[_0x3ae7('0x2c')][_0x3ae7('0x32')](_0x3ae7('0x33'))){_0xfd2913[_0x3ae7('0x1c')]=qs['limit'](_0x256f0f[_0x3ae7('0x2c')][_0x3ae7('0x1c')]);_0xfd2913[_0x3ae7('0x1b')]=qs[_0x3ae7('0x1b')](_0x256f0f[_0x3ae7('0x2c')][_0x3ae7('0x1b')]);}return _0xec3a4['getConfigurations'](_0xfd2913);}})[_0x3ae7('0x23')](function(_0x5ed0d9){if(_0x5ed0d9){return _0x5ed0d9?{'count':_0xba7588,'rows':_0x5ed0d9}:null;}})[_0x3ae7('0x23')](respondWithResult(_0x314ad5,null))['catch'](handleError(_0x314ad5,null));};exports[_0x3ae7('0x48')]=function(_0x151721,_0x2171f9,_0x2bbb2f){if(_0x151721[_0x3ae7('0x40')]['id']){delete _0x151721[_0x3ae7('0x40')]['id'];}return db['SugarcrmAccount'][_0x3ae7('0x49')]({'where':{'id':_0x151721[_0x3ae7('0x3e')]['id']}})[_0x3ae7('0x23')](handleEntityNotFound(_0x2171f9,null))[_0x3ae7('0x23')](function(_0x33ad7c){if(_0x33ad7c){_0x151721[_0x3ae7('0x40')][_0x3ae7('0x4a')]=_0x33ad7c['id'];_0x151721[_0x3ae7('0x40')][_0x3ae7('0x4b')]=integrations['getSubjects'](_0x151721[_0x3ae7('0x40')][_0x3ae7('0x4c')],_0x151721['body']['type']);_0x151721[_0x3ae7('0x40')][_0x3ae7('0x4d')]=integrations[_0x3ae7('0x4e')](_0x151721[_0x3ae7('0x40')][_0x3ae7('0x4c')],_0x151721['body'][_0x3ae7('0x29')]);return db[_0x3ae7('0x4f')]['create'](_0x151721[_0x3ae7('0x40')],{'include':[{'model':db[_0x3ae7('0x50')],'as':'Subjects'},{'model':db[_0x3ae7('0x50')],'as':_0x3ae7('0x4d')}]});}return null;})[_0x3ae7('0x23')](respondWithResult(_0x2171f9,null))[_0x3ae7('0x3d')](handleError(_0x2171f9,null));};exports[_0x3ae7('0x51')]=function(_0xcb8df5,_0x131e2c,_0x42bb2f){var _0x22b1cb='';var _0x288325=['id',_0x3ae7('0x25'),'assigned_user_id',_0x3ae7('0x52'),_0x3ae7('0x53'),'date_start','duration_hours',_0x3ae7('0x54'),_0x3ae7('0x55'),_0x3ae7('0x56'),_0x3ae7('0x57'),_0x3ae7('0x58')];return db[_0x3ae7('0x27')][_0x3ae7('0x49')]({'where':{'id':_0xcb8df5[_0x3ae7('0x3e')]['id']},'attributes':['id','username',_0x3ae7('0x59'),_0x3ae7('0x5a')]})['then'](handleEntityNotFound(_0x131e2c,null))[_0x3ae7('0x23')](function(_0x489541){if(_0x489541){_0x22b1cb=_0x489541[_0x3ae7('0x5a')];var _0x396637=_0x22b1cb[_0x3ae7('0x5b')](-0x1);if(_0x396637==='/'){_0x22b1cb=_0x22b1cb[_0x3ae7('0x5c')](0x0,_0x22b1cb[_0x3ae7('0x5d')](_0x396637));}return rp({'method':_0x3ae7('0x5e'),'uri':util[_0x3ae7('0x5f')](_0x3ae7('0x60'),_0x22b1cb,_0x3ae7('0x61')),'json':!![],'form':{'method':_0x3ae7('0x62'),'input_type':'JSON','response_type':_0x3ae7('0x63'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x489541[_0x3ae7('0x64')],'password':_0x489541['password'],'encryption':_0x3ae7('0x65')},'application':_0x3ae7('0x66')})}});}})[_0x3ae7('0x23')](function(_0x429dfd){if(_0x429dfd&&_0x429dfd[_0x3ae7('0x25')]!=='Invalid\x20Login'&&_0x429dfd[_0x3ae7('0x25')]!=='Password\x20Expired'){return rp({'method':_0x3ae7('0x5e'),'uri':util[_0x3ae7('0x5f')](_0x3ae7('0x60'),_0x22b1cb,_0x3ae7('0x61')),'json':!![],'form':{'method':_0x3ae7('0x67'),'input_type':_0x3ae7('0x63'),'response_type':'JSON','rest_data':JSON[_0x3ae7('0x68')]({'session':_0x429dfd['id'],'module_name':'Calls'})}})[_0x3ae7('0x23')](function(_0x149112){if(_0x149112){var _0x5832e1=_[_0x3ae7('0x69')](_0x149112['module_fields']);_[_0x3ae7('0x6a')](_0x5832e1,function(_0xa0af56){return _0x288325[_0x3ae7('0x6b')](_0xa0af56[_0x3ae7('0x25')]);});return{'count':_0x5832e1[_0x3ae7('0x44')],'rows':_['map'](_0x5832e1,function(_0x58c6c1){return{'id':_0x58c6c1[_0x3ae7('0x25')],'name':_0x58c6c1[_0x3ae7('0x6c')],'custom':_[_0x3ae7('0x6d')](_0x58c6c1[_0x3ae7('0x25')],'_c')?!![]:![],'options':_0x58c6c1[_0x3ae7('0x39')]?_['map'](_['values'](_0x58c6c1[_0x3ae7('0x39')]),function(_0x214433){return{'name':_0x214433[_0x3ae7('0x6e')],'value':_0x214433['name']};}):[]};})};}})['then'](respondWithResult(_0x131e2c,null))[_0x3ae7('0x3d')](function(_0x4c67dd){var _0xe1160c=_0xcb8df5['query'][_0x3ae7('0x6f')]?0x1f4:_0x4c67dd[_0x3ae7('0x70')]||0x1f4;logger[_0x3ae7('0x71')](_0x3ae7('0x72'),_0x3ae7('0x51'),_0xe1160c,JSON[_0x3ae7('0x68')](_0x4c67dd));delete _0x4c67dd[_0x3ae7('0x25')];if(_0xe1160c===0x191){_0xe1160c=0x190;}_0x131e2c[_0x3ae7('0x18')](_0xe1160c)[_0x3ae7('0x73')](_0xcb8df5[_0x3ae7('0x2c')][_0x3ae7('0x6f')]?{'message':_0x3ae7('0x74'),'statusCode':_0x4c67dd[_0x3ae7('0x70')]}:_0x4c67dd);});}else{var _0x513da9=0x1f4;_0x131e2c['status'](_0x513da9)[_0x3ae7('0x73')]({'message':_0x3ae7('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2cc1=['index','map','SugarcrmAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','include','find','create','body','update','destroy','params','findOne','SugarcrmConfiguration','getConfigurations','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','format','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','%s%s','get_module_fields','stringify','Calls','values','module_fields','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x3cbee0,_0x352a0a){_0x3cbee0=_0x3cbee0-0x0;var _0x2ed094=_0x2cc1[_0x3cbee0];return _0x2ed094;};'use strict';var emlformat=require(_0x12cc('0x0'));var rimraf=require(_0x12cc('0x1'));var zipdir=require(_0x12cc('0x2'));var jsonpatch=require(_0x12cc('0x3'));var rp=require(_0x12cc('0x4'));var moment=require(_0x12cc('0x5'));var BPromise=require(_0x12cc('0x6'));var Mustache=require(_0x12cc('0x7'));var util=require('util');var path=require('path');var sox=require(_0x12cc('0x8'));var csv=require(_0x12cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12cc('0xa'));var squel=require(_0x12cc('0xb'));var crypto=require(_0x12cc('0xc'));var jsforce=require(_0x12cc('0xd'));var deskjs=require(_0x12cc('0xe'));var toCsv=require(_0x12cc('0x9'));var querystring=require(_0x12cc('0xf'));var Papa=require(_0x12cc('0x10'));var Redis=require(_0x12cc('0x11'));var authService=require(_0x12cc('0x12'));var qs=require(_0x12cc('0x13'));var as=require(_0x12cc('0x14'));var hardwareService=require(_0x12cc('0x15'));var logger=require('../../config/logger')(_0x12cc('0x16'));var utils=require('../../config/utils');var config=require(_0x12cc('0x17'));var licenseUtil=require(_0x12cc('0x18'));var db=require(_0x12cc('0x19'))['db'];var integrations=require(_0x12cc('0x1a'));function respondWithStatusCode(_0x29a902,_0x7bf7fc){_0x7bf7fc=_0x7bf7fc||0xcc;return function(_0x5f3fb6){if(_0x5f3fb6){return _0x29a902['sendStatus'](_0x7bf7fc);}return _0x29a902[_0x12cc('0x1b')](_0x7bf7fc)['end']();};}function respondWithResult(_0xbe9117,_0x57f008){_0x57f008=_0x57f008||0xc8;return function(_0x3451b5){if(_0x3451b5){return _0xbe9117[_0x12cc('0x1b')](_0x57f008)[_0x12cc('0x1c')](_0x3451b5);}};}function respondWithFilteredResult(_0xc0a469,_0x10e22a){return function(_0x33753a){if(_0x33753a){var _0x511857=typeof _0x10e22a[_0x12cc('0x1d')]===_0x12cc('0x1e')&&typeof _0x10e22a['limit']===_0x12cc('0x1e');var _0x28134a=_0x33753a[_0x12cc('0x1f')];var _0x33db40=_0x511857?0x0:_0x10e22a[_0x12cc('0x1d')];var _0xe6f84=_0x511857?_0x33753a[_0x12cc('0x1f')]:_0x10e22a[_0x12cc('0x1d')]+_0x10e22a[_0x12cc('0x20')];var _0x50e077;if(_0xe6f84>=_0x28134a){_0xe6f84=_0x28134a;_0x50e077=0xc8;}else{_0x50e077=0xce;}_0xc0a469['status'](_0x50e077);return _0xc0a469['set'](_0x12cc('0x21'),_0x33db40+'-'+_0xe6f84+'/'+_0x28134a)[_0x12cc('0x1c')](_0x33753a);}return null;};}function patchUpdates(_0x2973d4){return function(_0x4180f1){try{jsonpatch[_0x12cc('0x22')](_0x4180f1,_0x2973d4,!![]);}catch(_0xd92481){return BPromise[_0x12cc('0x23')](_0xd92481);}return _0x4180f1[_0x12cc('0x24')]();};}function saveUpdates(_0x2837bf,_0x5c1fdf){return function(_0x3358a2){if(_0x3358a2){return _0x3358a2['update'](_0x2837bf)[_0x12cc('0x25')](function(_0x1a5f8e){return _0x1a5f8e;});}return null;};}function removeEntity(_0x4814b8,_0x2f5aab){return function(_0x797a61){if(_0x797a61){return _0x797a61['destroy']()['then'](function(){_0x4814b8[_0x12cc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3769b2,_0x11d4bc){return function(_0x1fb084){if(!_0x1fb084){_0x3769b2[_0x12cc('0x26')](0x194);}return _0x1fb084;};}function handleError(_0x448b5a,_0x281da6){_0x281da6=_0x281da6||0x1f4;return function(_0x30439d){logger[_0x12cc('0x27')](_0x30439d[_0x12cc('0x28')]);if(_0x30439d[_0x12cc('0x29')]){delete _0x30439d[_0x12cc('0x29')];}_0x448b5a[_0x12cc('0x1b')](_0x281da6)[_0x12cc('0x2a')](_0x30439d);};}exports[_0x12cc('0x2b')]=function(_0x214f24,_0x1c8bca){var _0x5cb159={},_0x38413b={},_0xfbb4f2={'count':0x0,'rows':[]};var _0x781b72=_[_0x12cc('0x2c')](db[_0x12cc('0x2d')][_0x12cc('0x2e')],function(_0x363041){return{'name':_0x363041['fieldName'],'type':_0x363041[_0x12cc('0x2f')][_0x12cc('0x30')]};});_0x38413b[_0x12cc('0x31')]=_[_0x12cc('0x2c')](_0x781b72,_0x12cc('0x29'));_0x38413b['query']=_[_0x12cc('0x32')](_0x214f24[_0x12cc('0x33')]);_0x38413b[_0x12cc('0x34')]=_[_0x12cc('0x35')](_0x38413b[_0x12cc('0x31')],_0x38413b[_0x12cc('0x33')]);_0x5cb159[_0x12cc('0x36')]=_[_0x12cc('0x35')](_0x38413b[_0x12cc('0x31')],qs[_0x12cc('0x37')](_0x214f24[_0x12cc('0x33')][_0x12cc('0x37')]));_0x5cb159[_0x12cc('0x36')]=_0x5cb159[_0x12cc('0x36')][_0x12cc('0x38')]?_0x5cb159['attributes']:_0x38413b[_0x12cc('0x31')];if(!_0x214f24[_0x12cc('0x33')][_0x12cc('0x39')](_0x12cc('0x3a'))){_0x5cb159[_0x12cc('0x20')]=qs[_0x12cc('0x20')](_0x214f24['query'][_0x12cc('0x20')]);_0x5cb159[_0x12cc('0x1d')]=qs[_0x12cc('0x1d')](_0x214f24['query'][_0x12cc('0x1d')]);}_0x5cb159[_0x12cc('0x3b')]=qs[_0x12cc('0x3c')](_0x214f24[_0x12cc('0x33')][_0x12cc('0x3c')]);_0x5cb159['where']=qs[_0x12cc('0x34')](_[_0x12cc('0x3d')](_0x214f24[_0x12cc('0x33')],_0x38413b[_0x12cc('0x34')]),_0x781b72);if(_0x214f24[_0x12cc('0x33')][_0x12cc('0x3e')]){_0x5cb159[_0x12cc('0x3f')]=_[_0x12cc('0x40')](_0x5cb159[_0x12cc('0x3f')],{'$or':_[_0x12cc('0x2c')](_0x781b72,function(_0x2ece53){if(_0x2ece53['type']!==_0x12cc('0x41')){var _0x39f443={};_0x39f443[_0x2ece53[_0x12cc('0x29')]]={'$like':'%'+_0x214f24[_0x12cc('0x33')][_0x12cc('0x3e')]+'%'};return _0x39f443;}})});}_0x5cb159=_['merge']({},_0x5cb159,_0x214f24[_0x12cc('0x42')]);var _0x5adae7={'where':_0x5cb159[_0x12cc('0x3f')]};return db[_0x12cc('0x2d')][_0x12cc('0x1f')](_0x5adae7)[_0x12cc('0x25')](function(_0x1463fd){_0xfbb4f2[_0x12cc('0x1f')]=_0x1463fd;if(_0x214f24[_0x12cc('0x33')][_0x12cc('0x43')]){_0x5cb159['include']=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x5cb159);})['then'](function(_0x3c856d){_0xfbb4f2[_0x12cc('0x44')]=_0x3c856d;return _0xfbb4f2;})[_0x12cc('0x25')](respondWithFilteredResult(_0x1c8bca,_0x5cb159))[_0x12cc('0x45')](handleError(_0x1c8bca,null));};exports[_0x12cc('0x46')]=function(_0x426926,_0xdae983){var _0x33dfe1={'raw':![],'where':{'id':_0x426926['params']['id']}},_0xf38a14={};_0xf38a14[_0x12cc('0x31')]=_[_0x12cc('0x32')](db[_0x12cc('0x2d')][_0x12cc('0x2e')]);_0xf38a14['query']=_['keys'](_0x426926[_0x12cc('0x33')]);_0xf38a14[_0x12cc('0x34')]=_[_0x12cc('0x35')](_0xf38a14[_0x12cc('0x31')],_0xf38a14[_0x12cc('0x33')]);_0x33dfe1[_0x12cc('0x36')]=_[_0x12cc('0x35')](_0xf38a14[_0x12cc('0x31')],qs[_0x12cc('0x37')](_0x426926['query'][_0x12cc('0x37')]));_0x33dfe1[_0x12cc('0x36')]=_0x33dfe1['attributes'][_0x12cc('0x38')]?_0x33dfe1['attributes']:_0xf38a14[_0x12cc('0x31')];if(_0x426926[_0x12cc('0x33')]['includeAll']){_0x33dfe1[_0x12cc('0x47')]=[{'all':!![]}];}_0x33dfe1=_['merge']({},_0x33dfe1,_0x426926[_0x12cc('0x42')]);return db['SugarcrmAccount'][_0x12cc('0x48')](_0x33dfe1)['then'](handleEntityNotFound(_0xdae983,null))[_0x12cc('0x25')](respondWithResult(_0xdae983,null))[_0x12cc('0x45')](handleError(_0xdae983,null));};exports['create']=function(_0x43d0f1,_0x8e888d){return db[_0x12cc('0x2d')][_0x12cc('0x49')](_0x43d0f1[_0x12cc('0x4a')],{})[_0x12cc('0x25')](respondWithResult(_0x8e888d,0xc9))[_0x12cc('0x45')](handleError(_0x8e888d,null));};exports[_0x12cc('0x4b')]=function(_0x37baac,_0x2b3462){if(_0x37baac['body']['id']){delete _0x37baac[_0x12cc('0x4a')]['id'];}return db['SugarcrmAccount'][_0x12cc('0x48')]({'where':{'id':_0x37baac['params']['id']}})[_0x12cc('0x25')](handleEntityNotFound(_0x2b3462,null))[_0x12cc('0x25')](saveUpdates(_0x37baac[_0x12cc('0x4a')],null))[_0x12cc('0x25')](respondWithResult(_0x2b3462,null))[_0x12cc('0x45')](handleError(_0x2b3462,null));};exports[_0x12cc('0x4c')]=function(_0x10b73d,_0xe7868d){return db[_0x12cc('0x2d')][_0x12cc('0x48')]({'where':{'id':_0x10b73d[_0x12cc('0x4d')]['id']}})[_0x12cc('0x25')](handleEntityNotFound(_0xe7868d,null))[_0x12cc('0x25')](removeEntity(_0xe7868d,null))[_0x12cc('0x45')](handleError(_0xe7868d,null));};exports['getConfigurations']=function(_0x4a1404,_0x31273b,_0x41eb51){var _0x489e8b={};var _0x3bd84a={};var _0x31290e;var _0x2a9239;return db[_0x12cc('0x2d')][_0x12cc('0x4e')]({'where':{'id':_0x4a1404[_0x12cc('0x4d')]['id']}})[_0x12cc('0x25')](handleEntityNotFound(_0x31273b,null))[_0x12cc('0x25')](function(_0x1e778b){if(_0x1e778b){_0x31290e=_0x1e778b;_0x3bd84a[_0x12cc('0x31')]=_[_0x12cc('0x32')](db[_0x12cc('0x4f')][_0x12cc('0x2e')]);_0x3bd84a[_0x12cc('0x33')]=_[_0x12cc('0x32')](_0x4a1404[_0x12cc('0x33')]);_0x3bd84a[_0x12cc('0x34')]=_[_0x12cc('0x35')](_0x3bd84a['model'],_0x3bd84a[_0x12cc('0x33')]);_0x489e8b[_0x12cc('0x36')]=_[_0x12cc('0x35')](_0x3bd84a[_0x12cc('0x31')],qs[_0x12cc('0x37')](_0x4a1404[_0x12cc('0x33')][_0x12cc('0x37')]));_0x489e8b[_0x12cc('0x36')]=_0x489e8b[_0x12cc('0x36')][_0x12cc('0x38')]?_0x489e8b[_0x12cc('0x36')]:_0x3bd84a['model'];_0x489e8b['order']=qs['sort'](_0x4a1404[_0x12cc('0x33')][_0x12cc('0x3c')]);_0x489e8b[_0x12cc('0x3f')]=qs['filters'](_[_0x12cc('0x3d')](_0x4a1404[_0x12cc('0x33')],_0x3bd84a['filters']));if(_0x4a1404['query'][_0x12cc('0x3e')]){_0x489e8b[_0x12cc('0x3f')]=_[_0x12cc('0x40')](_0x489e8b[_0x12cc('0x3f')],{'$or':_['map'](_0x489e8b['attributes'],function(_0x4cc69a){var _0x515897={};_0x515897[_0x4cc69a]={'$like':'%'+_0x4a1404[_0x12cc('0x33')][_0x12cc('0x3e')]+'%'};return _0x515897;})});}_0x489e8b=_[_0x12cc('0x40')]({},_0x489e8b,_0x4a1404[_0x12cc('0x42')]);return _0x31290e[_0x12cc('0x50')](_0x489e8b);}})[_0x12cc('0x25')](function(_0x3ad7d2){if(_0x3ad7d2){_0x2a9239=_0x3ad7d2[_0x12cc('0x38')];if(!_0x4a1404[_0x12cc('0x33')]['hasOwnProperty'](_0x12cc('0x3a'))){_0x489e8b[_0x12cc('0x20')]=qs['limit'](_0x4a1404[_0x12cc('0x33')][_0x12cc('0x20')]);_0x489e8b[_0x12cc('0x1d')]=qs[_0x12cc('0x1d')](_0x4a1404['query']['offset']);}return _0x31290e[_0x12cc('0x50')](_0x489e8b);}})[_0x12cc('0x25')](function(_0x3ebc79){if(_0x3ebc79){return _0x3ebc79?{'count':_0x2a9239,'rows':_0x3ebc79}:null;}})[_0x12cc('0x25')](respondWithResult(_0x31273b,null))['catch'](handleError(_0x31273b,null));};exports['addConfiguration']=function(_0x5b4466,_0x5a3d5a,_0x1ab2a2){if(_0x5b4466[_0x12cc('0x4a')]['id']){delete _0x5b4466['body']['id'];}return db[_0x12cc('0x2d')][_0x12cc('0x4e')]({'where':{'id':_0x5b4466[_0x12cc('0x4d')]['id']}})[_0x12cc('0x25')](handleEntityNotFound(_0x5a3d5a,null))['then'](function(_0x3ad014){if(_0x3ad014){_0x5b4466['body'][_0x12cc('0x51')]=_0x3ad014['id'];_0x5b4466[_0x12cc('0x4a')][_0x12cc('0x52')]=integrations['getSubjects'](_0x5b4466['body'][_0x12cc('0x53')],_0x5b4466['body'][_0x12cc('0x2f')]);_0x5b4466[_0x12cc('0x4a')]['Descriptions']=integrations[_0x12cc('0x54')](_0x5b4466[_0x12cc('0x4a')][_0x12cc('0x53')],_0x5b4466['body'][_0x12cc('0x2f')]);return db[_0x12cc('0x4f')]['create'](_0x5b4466[_0x12cc('0x4a')],{'include':[{'model':db[_0x12cc('0x55')],'as':_0x12cc('0x52')},{'model':db[_0x12cc('0x55')],'as':_0x12cc('0x56')}]});}return null;})[_0x12cc('0x25')](respondWithResult(_0x5a3d5a,null))[_0x12cc('0x45')](handleError(_0x5a3d5a,null));};exports[_0x12cc('0x57')]=function(_0x26cadd,_0x1ee804,_0x52e7c1){var _0x414966='';var _0xfa73e1=['id',_0x12cc('0x29'),_0x12cc('0x58'),_0x12cc('0x59'),_0x12cc('0x5a'),_0x12cc('0x5b'),_0x12cc('0x5c'),'duration_minutes',_0x12cc('0x5d'),_0x12cc('0x5e'),'parent_name',_0x12cc('0x5f')];return db[_0x12cc('0x2d')][_0x12cc('0x4e')]({'where':{'id':_0x26cadd['params']['id']},'attributes':['id',_0x12cc('0x60'),_0x12cc('0x61'),_0x12cc('0x62')]})[_0x12cc('0x25')](handleEntityNotFound(_0x1ee804,null))[_0x12cc('0x25')](function(_0x556bc5){if(_0x556bc5){_0x414966=_0x556bc5[_0x12cc('0x62')];var _0x335cde=_0x414966[_0x12cc('0x63')](-0x1);if(_0x335cde==='/'){_0x414966=_0x414966[_0x12cc('0x64')](0x0,_0x414966['lastIndexOf'](_0x335cde));}return rp({'method':'POST','uri':util[_0x12cc('0x65')]('%s%s',_0x414966,_0x12cc('0x66')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x12cc('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x556bc5[_0x12cc('0x60')],'password':_0x556bc5[_0x12cc('0x61')],'encryption':_0x12cc('0x68')},'application':_0x12cc('0x69')})}});}})[_0x12cc('0x25')](function(_0x2caf94){if(_0x2caf94&&_0x2caf94[_0x12cc('0x29')]!==_0x12cc('0x6a')&&_0x2caf94[_0x12cc('0x29')]!==_0x12cc('0x6b')){return rp({'method':_0x12cc('0x6c'),'uri':util[_0x12cc('0x65')](_0x12cc('0x6d'),_0x414966,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x12cc('0x6e'),'input_type':'JSON','response_type':_0x12cc('0x67'),'rest_data':JSON[_0x12cc('0x6f')]({'session':_0x2caf94['id'],'module_name':_0x12cc('0x70')})}})[_0x12cc('0x25')](function(_0x52df66){if(_0x52df66){var _0xc150e1=_[_0x12cc('0x71')](_0x52df66[_0x12cc('0x72')]);_['remove'](_0xc150e1,function(_0x22768c){return _0xfa73e1[_0x12cc('0x73')](_0x22768c['name']);});return{'count':_0xc150e1[_0x12cc('0x38')],'rows':_[_0x12cc('0x2c')](_0xc150e1,function(_0x5424b2){return{'id':_0x5424b2[_0x12cc('0x29')],'name':_0x5424b2[_0x12cc('0x74')],'custom':_[_0x12cc('0x75')](_0x5424b2[_0x12cc('0x29')],'_c')?!![]:![],'options':_0x5424b2[_0x12cc('0x42')]?_[_0x12cc('0x2c')](_[_0x12cc('0x71')](_0x5424b2[_0x12cc('0x42')]),function(_0x2c3664){return{'name':_0x2c3664['value'],'value':_0x2c3664[_0x12cc('0x29')]};}):[]};})};}})[_0x12cc('0x25')](respondWithResult(_0x1ee804,null))[_0x12cc('0x45')](function(_0x562c8e){var _0x488d39=_0x26cadd[_0x12cc('0x33')][_0x12cc('0x76')]?0x1f4:_0x562c8e[_0x12cc('0x77')]||0x1f4;logger['error'](_0x12cc('0x78'),_0x12cc('0x57'),_0x488d39,JSON[_0x12cc('0x6f')](_0x562c8e));delete _0x562c8e[_0x12cc('0x29')];if(_0x488d39===0x191){_0x488d39=0x190;}_0x1ee804[_0x12cc('0x1b')](_0x488d39)['send'](_0x26cadd[_0x12cc('0x33')][_0x12cc('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x562c8e[_0x12cc('0x77')]}:_0x562c8e);});}else{var _0x3e2d07=0x1f4;_0x1ee804[_0x12cc('0x1b')](_0x3e2d07)[_0x12cc('0x2a')]({'message':_0x12cc('0x79'),'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 c818fff..db298e6 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 _0xb120=['int_sugarcrm_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x1a745e,_0x63c2e4){var _0x2aa284=function(_0x269f91){while(--_0x269f91){_0x1a745e['push'](_0x1a745e['shift']());}};_0x2aa284(++_0x63c2e4);}(_0xb120,0x7f));var _0x0b12=function(_0x4eee88,_0x3ef26c){_0x4eee88=_0x4eee88-0x0;var _0xc232ec=_0xb120[_0x4eee88];return _0xc232ec;};'use strict';var _=require('lodash');var util=require(_0x0b12('0x0'));var logger=require(_0x0b12('0x1'))(_0x0b12('0x2'));var moment=require(_0x0b12('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b12('0x4'));var fs=require('fs');var path=require(_0x0b12('0x5'));var rimraf=require(_0x0b12('0x6'));var config=require(_0x0b12('0x7'));var attributes=require(_0x0b12('0x8'));var integrations=require(_0x0b12('0x9'));module[_0x0b12('0xa')]=function(_0x172162,_0x1090e4){return _0x172162[_0x0b12('0xb')](_0x0b12('0xc'),attributes,{'tableName':_0x0b12('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0d7=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','api','moment','bluebird','request-promise','path'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x4534a5,_0x5bfa12){_0x4534a5=_0x4534a5-0x0;var _0x42fbea=_0xc0d7[_0x4534a5];return _0x42fbea;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7c0d('0x0'));var moment=require(_0x7c0d('0x1'));var BPromise=require(_0x7c0d('0x2'));var rp=require(_0x7c0d('0x3'));var fs=require('fs');var path=require(_0x7c0d('0x4'));var rimraf=require(_0x7c0d('0x5'));var config=require(_0x7c0d('0x6'));var attributes=require(_0x7c0d('0x7'));var integrations=require(_0x7c0d('0x8'));module['exports']=function(_0x507bc0,_0x14f205){return _0x507bc0[_0x7c0d('0x9')](_0x7c0d('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','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 d09226b..928f665 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 _0xdfed=['http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSugarcrmAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0xe6f4ef,_0x4e34cc){var _0x4f3447=function(_0x1538ff){while(--_0x1538ff){_0xe6f4ef['push'](_0xe6f4ef['shift']());}};_0x4f3447(++_0x4e34cc);}(_0xdfed,0x1e6));var _0xddfe=function(_0x43e97d,_0x56a06b){_0x43e97d=_0x43e97d-0x0;var _0x424cd9=_0xdfed[_0x43e97d];return _0x424cd9;};'use strict';var _=require(_0xddfe('0x0'));var util=require(_0xddfe('0x1'));var moment=require(_0xddfe('0x2'));var BPromise=require(_0xddfe('0x3'));var rs=require(_0xddfe('0x4'));var fs=require('fs');var Redis=require(_0xddfe('0x5'));var db=require(_0xddfe('0x6'))['db'];var utils=require(_0xddfe('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xddfe('0x8'));var client=jayson['client'][_0xddfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x243cb,_0xd6db1,_0x5ef621){return new BPromise(function(_0x8ab54e,_0x8cfbdb){return client[_0xddfe('0xa')](_0x243cb,_0x5ef621)[_0xddfe('0xb')](function(_0x21fb48){logger[_0xddfe('0xc')](_0xddfe('0xd'),_0xd6db1,'request\x20sent');logger[_0xddfe('0xe')](_0xddfe('0xf'),_0xd6db1,_0xddfe('0x10'),JSON[_0xddfe('0x11')](_0x21fb48));if(_0x21fb48[_0xddfe('0x12')]){if(_0x21fb48[_0xddfe('0x12')]['code']===0x1f4){logger[_0xddfe('0x12')](_0xddfe('0xd'),_0xd6db1,_0x21fb48[_0xddfe('0x12')][_0xddfe('0x13')]);return _0x8cfbdb(_0x21fb48[_0xddfe('0x12')][_0xddfe('0x13')]);}logger[_0xddfe('0x12')](_0xddfe('0xd'),_0xd6db1,_0x21fb48[_0xddfe('0x12')][_0xddfe('0x13')]);return _0x8ab54e(_0x21fb48[_0xddfe('0x12')][_0xddfe('0x13')]);}else{logger[_0xddfe('0xc')](_0xddfe('0xd'),_0xd6db1,'request\x20sent');_0x8ab54e(_0x21fb48[_0xddfe('0x14')][_0xddfe('0x13')]);}})['catch'](function(_0x37a61f){logger['error'](_0xddfe('0xd'),_0xd6db1,_0x37a61f);_0x8cfbdb(_0x37a61f);});});}exports[_0xddfe('0x15')]=function(_0x57204d){var _0x46b465=this;return new Promise(function(_0x178184,_0x4e5d75){return db[_0xddfe('0x16')][_0xddfe('0x17')]({'raw':_0x57204d[_0xddfe('0x18')]?_0x57204d[_0xddfe('0x18')][_0xddfe('0x19')]===undefined?!![]:![]:!![],'where':_0x57204d['options']?_0x57204d[_0xddfe('0x18')]['where']||null:null,'attributes':_0x57204d[_0xddfe('0x18')]?_0x57204d['options'][_0xddfe('0x1a')]||null:null,'limit':_0x57204d['options']?_0x57204d['options'][_0xddfe('0x1b')]||null:null,'include':_0x57204d[_0xddfe('0x18')]?_0x57204d['options'][_0xddfe('0x1c')]?_[_0xddfe('0x1d')](_0x57204d[_0xddfe('0x18')]['include'],function(_0x2ea377){return{'model':db[_0x2ea377[_0xddfe('0x1e')]],'as':_0x2ea377['as'],'attributes':_0x2ea377[_0xddfe('0x1a')],'include':_0x2ea377['include']?_['map'](_0x2ea377[_0xddfe('0x1c')],function(_0x146032){return{'model':db[_0x146032['model']],'as':_0x146032['as'],'attributes':_0x146032[_0xddfe('0x1a')],'include':_0x146032[_0xddfe('0x1c')]?_['map'](_0x146032[_0xddfe('0x1c')],function(_0x5b66b4){return{'model':db[_0x5b66b4[_0xddfe('0x1e')]],'as':_0x5b66b4['as'],'attributes':_0x5b66b4[_0xddfe('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x497e7a){logger['info'](_0xddfe('0x15'),_0x57204d);logger[_0xddfe('0xe')](_0xddfe('0x15'),_0x57204d,JSON['stringify'](_0x497e7a));_0x178184(_0x497e7a);})['catch'](function(_0x24c00a){logger[_0xddfe('0x12')](_0xddfe('0x15'),_0x24c00a[_0xddfe('0x13')],_0x57204d);_0x4e5d75(_0x46b465[_0xddfe('0x12')](0x1f4,_0x24c00a[_0xddfe('0x13')]));});});};exports[_0xddfe('0x1f')]=function(_0x51d085){var _0x4058a0=this;return new Promise(function(_0x1e0ed3,_0x4cb403){return db[_0xddfe('0x16')]['find']({'raw':_0x51d085[_0xddfe('0x18')]?_0x51d085['options'][_0xddfe('0x19')]===undefined?!![]:![]:!![],'where':_0x51d085[_0xddfe('0x18')]?_0x51d085[_0xddfe('0x18')]['where']||null:null,'attributes':_0x51d085[_0xddfe('0x18')]?_0x51d085[_0xddfe('0x18')][_0xddfe('0x1a')]||null:null,'include':_0x51d085[_0xddfe('0x18')]?_0x51d085['options'][_0xddfe('0x1c')]?_[_0xddfe('0x1d')](_0x51d085['options'][_0xddfe('0x1c')],function(_0x29be19){return{'model':db[_0x29be19[_0xddfe('0x1e')]],'as':_0x29be19['as'],'attributes':_0x29be19[_0xddfe('0x1a')],'include':_0x29be19[_0xddfe('0x1c')]?_['map'](_0x29be19[_0xddfe('0x1c')],function(_0xced9e1){return{'model':db[_0xced9e1[_0xddfe('0x1e')]],'as':_0xced9e1['as'],'attributes':_0xced9e1[_0xddfe('0x1a')],'include':_0xced9e1['include']?_['map'](_0xced9e1[_0xddfe('0x1c')],function(_0x1ef50e){return{'model':db[_0x1ef50e[_0xddfe('0x1e')]],'as':_0x1ef50e['as'],'attributes':_0x1ef50e[_0xddfe('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2476dc){logger[_0xddfe('0xc')](_0xddfe('0x1f'),_0x51d085);logger[_0xddfe('0xe')](_0xddfe('0x1f'),_0x51d085,JSON[_0xddfe('0x11')](_0x2476dc));_0x1e0ed3(_0x2476dc);})[_0xddfe('0x20')](function(_0x4f8a56){logger['error'](_0xddfe('0x1f'),_0x4f8a56['message'],_0x51d085);_0x4cb403(_0x4058a0[_0xddfe('0x12')](0x1f4,_0x4f8a56[_0xddfe('0x13')]));});});}; \ No newline at end of file +var _0x2c61=['SugarcrmAccount,\x20%s,\x20%s','message','catch','GetSugarcrmAccount','findAll','options','attributes','limit','include','map','model','ShowSugarcrmAccount','raw','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1a896a,_0x3d7b46){var _0x568f41=function(_0xdc75a7){while(--_0xdc75a7){_0x1a896a['push'](_0x1a896a['shift']());}};_0x568f41(++_0x3d7b46);}(_0x2c61,0x157));var _0x12c6=function(_0x721b03,_0x19d938){_0x721b03=_0x721b03-0x0;var _0x3bb4e4=_0x2c61[_0x721b03];return _0x3bb4e4;};'use strict';var _=require(_0x12c6('0x0'));var util=require('util');var moment=require(_0x12c6('0x1'));var BPromise=require(_0x12c6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12c6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12c6('0x4'))(_0x12c6('0x5'));var config=require(_0x12c6('0x6'));var jayson=require(_0x12c6('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33c836,_0x7f01be,_0x3b734a){return new BPromise(function(_0x36106d,_0x258e5f){return client[_0x12c6('0x8')](_0x33c836,_0x3b734a)[_0x12c6('0x9')](function(_0x2a955b){logger[_0x12c6('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x7f01be,_0x12c6('0xb'));logger[_0x12c6('0xc')](_0x12c6('0xd'),_0x7f01be,_0x12c6('0xb'),JSON[_0x12c6('0xe')](_0x2a955b));if(_0x2a955b[_0x12c6('0xf')]){if(_0x2a955b[_0x12c6('0xf')][_0x12c6('0x10')]===0x1f4){logger[_0x12c6('0xf')](_0x12c6('0x11'),_0x7f01be,_0x2a955b[_0x12c6('0xf')][_0x12c6('0x12')]);return _0x258e5f(_0x2a955b['error'][_0x12c6('0x12')]);}logger[_0x12c6('0xf')](_0x12c6('0x11'),_0x7f01be,_0x2a955b['error'][_0x12c6('0x12')]);return _0x36106d(_0x2a955b['error'][_0x12c6('0x12')]);}else{logger[_0x12c6('0xa')](_0x12c6('0x11'),_0x7f01be,_0x12c6('0xb'));_0x36106d(_0x2a955b['result'][_0x12c6('0x12')]);}})[_0x12c6('0x13')](function(_0x48315b){logger[_0x12c6('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x7f01be,_0x48315b);_0x258e5f(_0x48315b);});});}exports[_0x12c6('0x14')]=function(_0x35e4cb){var _0x317b70=this;return new Promise(function(_0x13f3a4,_0x120d3f){return db['SugarcrmAccount'][_0x12c6('0x15')]({'raw':_0x35e4cb['options']?_0x35e4cb[_0x12c6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x35e4cb['options']?_0x35e4cb[_0x12c6('0x16')]['where']||null:null,'attributes':_0x35e4cb[_0x12c6('0x16')]?_0x35e4cb['options'][_0x12c6('0x17')]||null:null,'limit':_0x35e4cb[_0x12c6('0x16')]?_0x35e4cb['options'][_0x12c6('0x18')]||null:null,'include':_0x35e4cb[_0x12c6('0x16')]?_0x35e4cb[_0x12c6('0x16')][_0x12c6('0x19')]?_[_0x12c6('0x1a')](_0x35e4cb[_0x12c6('0x16')][_0x12c6('0x19')],function(_0x17aac9){return{'model':db[_0x17aac9['model']],'as':_0x17aac9['as'],'attributes':_0x17aac9[_0x12c6('0x17')],'include':_0x17aac9[_0x12c6('0x19')]?_[_0x12c6('0x1a')](_0x17aac9['include'],function(_0x4631af){return{'model':db[_0x4631af[_0x12c6('0x1b')]],'as':_0x4631af['as'],'attributes':_0x4631af['attributes'],'include':_0x4631af['include']?_[_0x12c6('0x1a')](_0x4631af[_0x12c6('0x19')],function(_0x34e2a4){return{'model':db[_0x34e2a4[_0x12c6('0x1b')]],'as':_0x34e2a4['as'],'attributes':_0x34e2a4[_0x12c6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x12c6('0x9')](function(_0x187280){logger[_0x12c6('0xa')](_0x12c6('0x14'),_0x35e4cb);logger[_0x12c6('0xc')](_0x12c6('0x14'),_0x35e4cb,JSON[_0x12c6('0xe')](_0x187280));_0x13f3a4(_0x187280);})['catch'](function(_0x3b4f49){logger['error']('GetSugarcrmAccount',_0x3b4f49[_0x12c6('0x12')],_0x35e4cb);_0x120d3f(_0x317b70['error'](0x1f4,_0x3b4f49['message']));});});};exports[_0x12c6('0x1c')]=function(_0x1ead57){var _0x4d8f08=this;return new Promise(function(_0x5dc266,_0x569d68){return db['SugarcrmAccount']['find']({'raw':_0x1ead57[_0x12c6('0x16')]?_0x1ead57['options'][_0x12c6('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ead57['options']?_0x1ead57[_0x12c6('0x16')]['where']||null:null,'attributes':_0x1ead57[_0x12c6('0x16')]?_0x1ead57[_0x12c6('0x16')][_0x12c6('0x17')]||null:null,'include':_0x1ead57[_0x12c6('0x16')]?_0x1ead57[_0x12c6('0x16')]['include']?_[_0x12c6('0x1a')](_0x1ead57[_0x12c6('0x16')][_0x12c6('0x19')],function(_0x17ee08){return{'model':db[_0x17ee08[_0x12c6('0x1b')]],'as':_0x17ee08['as'],'attributes':_0x17ee08['attributes'],'include':_0x17ee08[_0x12c6('0x19')]?_[_0x12c6('0x1a')](_0x17ee08[_0x12c6('0x19')],function(_0x4bc5a0){return{'model':db[_0x4bc5a0['model']],'as':_0x4bc5a0['as'],'attributes':_0x4bc5a0[_0x12c6('0x17')],'include':_0x4bc5a0[_0x12c6('0x19')]?_[_0x12c6('0x1a')](_0x4bc5a0[_0x12c6('0x19')],function(_0x2e3c01){return{'model':db[_0x2e3c01[_0x12c6('0x1b')]],'as':_0x2e3c01['as'],'attributes':_0x2e3c01[_0x12c6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x12c6('0x9')](function(_0x44c76b){logger[_0x12c6('0xa')](_0x12c6('0x1c'),_0x1ead57);logger['debug'](_0x12c6('0x1c'),_0x1ead57,JSON[_0x12c6('0xe')](_0x44c76b));_0x5dc266(_0x44c76b);})[_0x12c6('0x13')](function(_0x161612){logger['error'](_0x12c6('0x1c'),_0x161612['message'],_0x1ead57);_0x569d68(_0x4d8f08[_0x12c6('0xf')](0x1f4,_0x161612[_0x12c6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 076d33f..dc8a387 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 _0x8fd7=['/:id/descriptions','getDescriptions','post','create','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects'];(function(_0x481df5,_0x216652){var _0x32726e=function(_0x2133f4){while(--_0x2133f4){_0x481df5['push'](_0x481df5['shift']());}};_0x32726e(++_0x216652);}(_0x8fd7,0x1e9));var _0x78fd=function(_0x3425d1,_0xa61924){_0x3425d1=_0x3425d1-0x0;var _0x20d42f=_0x8fd7[_0x3425d1];return _0x20d42f;};'use strict';var multer=require('multer');var util=require(_0x78fd('0x0'));var path=require(_0x78fd('0x1'));var timeout=require(_0x78fd('0x2'));var express=require('express');var router=express[_0x78fd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x78fd('0x4'));var interaction=require(_0x78fd('0x5'));var config=require(_0x78fd('0x6'));var controller=require(_0x78fd('0x7'));router[_0x78fd('0x8')]('/',auth[_0x78fd('0x9')](),controller[_0x78fd('0xa')]);router[_0x78fd('0x8')](_0x78fd('0xb'),auth[_0x78fd('0x9')](),controller[_0x78fd('0xc')]);router['get'](_0x78fd('0xd'),auth[_0x78fd('0x9')](),controller['getFields']);router[_0x78fd('0x8')](_0x78fd('0xe'),auth[_0x78fd('0x9')](),controller['getSubjects']);router[_0x78fd('0x8')](_0x78fd('0xf'),auth['isAuthenticated'](),controller[_0x78fd('0x10')]);router[_0x78fd('0x11')]('/',auth[_0x78fd('0x9')](),controller[_0x78fd('0x12')]);router['put'](_0x78fd('0xb'),auth[_0x78fd('0x9')](),controller['update']);router[_0x78fd('0x13')](_0x78fd('0xb'),auth[_0x78fd('0x9')](),controller['destroy']);module[_0x78fd('0x14')]=router; \ No newline at end of file +var _0x72bf=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update'];(function(_0x2c4a42,_0x49264e){var _0x19ceab=function(_0x43ce82){while(--_0x43ce82){_0x2c4a42['push'](_0x2c4a42['shift']());}};_0x19ceab(++_0x49264e);}(_0x72bf,0xb2));var _0xf72b=function(_0x1107f2,_0x30676c){_0x1107f2=_0x1107f2-0x0;var _0x239df3=_0x72bf[_0x1107f2];return _0x239df3;};'use strict';var multer=require('multer');var util=require(_0xf72b('0x0'));var path=require(_0xf72b('0x1'));var timeout=require('connect-timeout');var express=require(_0xf72b('0x2'));var router=express[_0xf72b('0x3')]();var fs_extra=require(_0xf72b('0x4'));var auth=require(_0xf72b('0x5'));var interaction=require(_0xf72b('0x6'));var config=require(_0xf72b('0x7'));var controller=require(_0xf72b('0x8'));router[_0xf72b('0x9')]('/',auth[_0xf72b('0xa')](),controller[_0xf72b('0xb')]);router[_0xf72b('0x9')](_0xf72b('0xc'),auth['isAuthenticated'](),controller[_0xf72b('0xd')]);router[_0xf72b('0x9')]('/:id/fields',auth[_0xf72b('0xa')](),controller[_0xf72b('0xe')]);router[_0xf72b('0x9')](_0xf72b('0xf'),auth[_0xf72b('0xa')](),controller[_0xf72b('0x10')]);router[_0xf72b('0x9')](_0xf72b('0x11'),auth['isAuthenticated'](),controller[_0xf72b('0x12')]);router[_0xf72b('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf72b('0x14')]('/:id',auth[_0xf72b('0xa')](),controller[_0xf72b('0x15')]);router[_0xf72b('0x16')](_0xf72b('0xc'),auth[_0xf72b('0xa')](),controller[_0xf72b('0x17')]);module[_0xf72b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index ff1344d..6487e16 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 _0x6325=['exports','STRING','sequelize'];(function(_0x352d6b,_0xfd0e0b){var _0x3e6e56=function(_0x508c37){while(--_0x508c37){_0x352d6b['push'](_0x352d6b['shift']());}};_0x3e6e56(++_0xfd0e0b);}(_0x6325,0x1c1));var _0x5632=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6325[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5632('0x0'));module[_0x5632('0x1')]={'name':{'type':Sequelize[_0x5632('0x2')]},'description':{'type':Sequelize[_0x5632('0x2')]}}; \ No newline at end of file +var _0x9278=['sequelize','exports','STRING'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x9278,0x93));var _0x8927=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9278[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x8927('0x0'));module[_0x8927('0x1')]={'name':{'type':Sequelize[_0x8927('0x2')]},'description':{'type':Sequelize[_0x8927('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 01fcba1..ed9f9f8 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 _0x6d4a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','getFields','findOne','SugarcrmField','options','getSubjects','getDescriptions','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','end','error','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields'];(function(_0x49ee13,_0x325af9){var _0x183e6a=function(_0x1162b0){while(--_0x1162b0){_0x49ee13['push'](_0x49ee13['shift']());}};_0x183e6a(++_0x325af9);}(_0x6d4a,0x161));var _0xa6d4=function(_0x3d4c21,_0x8011e0){_0x3d4c21=_0x3d4c21-0x0;var _0x63247d=_0x6d4a[_0x3d4c21];return _0x63247d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6d4('0x0'));var zipdir=require(_0xa6d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa6d4('0x2'));var Mustache=require(_0xa6d4('0x3'));var util=require(_0xa6d4('0x4'));var path=require(_0xa6d4('0x5'));var sox=require(_0xa6d4('0x6'));var csv=require('to-csv');var ejs=require(_0xa6d4('0x7'));var fs=require('fs');var fs_extra=require(_0xa6d4('0x8'));var _=require(_0xa6d4('0x9'));var squel=require(_0xa6d4('0xa'));var crypto=require(_0xa6d4('0xb'));var jsforce=require(_0xa6d4('0xc'));var deskjs=require(_0xa6d4('0xd'));var toCsv=require(_0xa6d4('0xe'));var querystring=require(_0xa6d4('0xf'));var Papa=require(_0xa6d4('0x10'));var Redis=require(_0xa6d4('0x11'));var authService=require(_0xa6d4('0x12'));var qs=require(_0xa6d4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6d4('0x14'));var logger=require(_0xa6d4('0x15'))(_0xa6d4('0x16'));var utils=require(_0xa6d4('0x17'));var config=require(_0xa6d4('0x18'));var licenseUtil=require(_0xa6d4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55d8cf,_0x1a03c){_0x1a03c=_0x1a03c||0xcc;return function(_0x324cc9){if(_0x324cc9){return _0x55d8cf[_0xa6d4('0x1a')](_0x1a03c);}return _0x55d8cf[_0xa6d4('0x1b')](_0x1a03c)['end']();};}function respondWithResult(_0x4a1cca,_0x156e0f){_0x156e0f=_0x156e0f||0xc8;return function(_0x454317){if(_0x454317){return _0x4a1cca[_0xa6d4('0x1b')](_0x156e0f)[_0xa6d4('0x1c')](_0x454317);}};}function respondWithFilteredResult(_0x10dfd1,_0x561b48){return function(_0x4f7322){if(_0x4f7322){var _0x250ff7=typeof _0x561b48[_0xa6d4('0x1d')]===_0xa6d4('0x1e')&&typeof _0x561b48[_0xa6d4('0x1f')]===_0xa6d4('0x1e');var _0x4f26b3=_0x4f7322[_0xa6d4('0x20')];var _0x329570=_0x250ff7?0x0:_0x561b48['offset'];var _0x3d600f=_0x250ff7?_0x4f7322['count']:_0x561b48[_0xa6d4('0x1d')]+_0x561b48['limit'];var _0x455140;if(_0x3d600f>=_0x4f26b3){_0x3d600f=_0x4f26b3;_0x455140=0xc8;}else{_0x455140=0xce;}_0x10dfd1[_0xa6d4('0x1b')](_0x455140);return _0x10dfd1[_0xa6d4('0x21')]('Content-Range',_0x329570+'-'+_0x3d600f+'/'+_0x4f26b3)[_0xa6d4('0x1c')](_0x4f7322);}return null;};}function patchUpdates(_0x4d2d95){return function(_0x45b487){try{jsonpatch[_0xa6d4('0x22')](_0x45b487,_0x4d2d95,!![]);}catch(_0x3ef380){return BPromise[_0xa6d4('0x23')](_0x3ef380);}return _0x45b487['save']();};}function saveUpdates(_0x1ea72a,_0x2dce7d){return function(_0x3a0624){if(_0x3a0624){return _0x3a0624['update'](_0x1ea72a)[_0xa6d4('0x24')](function(_0x3eff3d){return _0x3eff3d;});}return null;};}function removeEntity(_0x386d83,_0x2fec1a){return function(_0x35c57f){if(_0x35c57f){return _0x35c57f[_0xa6d4('0x25')]()[_0xa6d4('0x24')](function(){_0x386d83[_0xa6d4('0x1b')](0xcc)[_0xa6d4('0x26')]();});}};}function handleEntityNotFound(_0x1f79b3,_0x3ab422){return function(_0x3cad69){if(!_0x3cad69){_0x1f79b3[_0xa6d4('0x1a')](0x194);}return _0x3cad69;};}function handleError(_0x2d940c,_0x44be8f){_0x44be8f=_0x44be8f||0x1f4;return function(_0xbdda6f){logger[_0xa6d4('0x27')](_0xbdda6f['stack']);if(_0xbdda6f[_0xa6d4('0x28')]){delete _0xbdda6f[_0xa6d4('0x28')];}_0x2d940c[_0xa6d4('0x1b')](_0x44be8f)[_0xa6d4('0x29')](_0xbdda6f);};}exports[_0xa6d4('0x2a')]=function(_0x1e7d69,_0x5cc289){var _0x3d831c={},_0x9ece25={},_0x67d09a={'count':0x0,'rows':[]};var _0x1209a7=_[_0xa6d4('0x2b')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x118a07){return{'name':_0x118a07[_0xa6d4('0x2c')],'type':_0x118a07[_0xa6d4('0x2d')]['key']};});_0x9ece25[_0xa6d4('0x2e')]=_[_0xa6d4('0x2b')](_0x1209a7,_0xa6d4('0x28'));_0x9ece25['query']=_['keys'](_0x1e7d69[_0xa6d4('0x2f')]);_0x9ece25[_0xa6d4('0x30')]=_[_0xa6d4('0x31')](_0x9ece25[_0xa6d4('0x2e')],_0x9ece25[_0xa6d4('0x2f')]);_0x3d831c[_0xa6d4('0x32')]=_['intersection'](_0x9ece25[_0xa6d4('0x2e')],qs[_0xa6d4('0x33')](_0x1e7d69[_0xa6d4('0x2f')][_0xa6d4('0x33')]));_0x3d831c['attributes']=_0x3d831c[_0xa6d4('0x32')][_0xa6d4('0x34')]?_0x3d831c['attributes']:_0x9ece25[_0xa6d4('0x2e')];if(!_0x1e7d69[_0xa6d4('0x2f')][_0xa6d4('0x35')](_0xa6d4('0x36'))){_0x3d831c[_0xa6d4('0x1f')]=qs['limit'](_0x1e7d69[_0xa6d4('0x2f')]['limit']);_0x3d831c[_0xa6d4('0x1d')]=qs[_0xa6d4('0x1d')](_0x1e7d69['query']['offset']);}_0x3d831c[_0xa6d4('0x37')]=qs[_0xa6d4('0x38')](_0x1e7d69[_0xa6d4('0x2f')][_0xa6d4('0x38')]);_0x3d831c[_0xa6d4('0x39')]=qs[_0xa6d4('0x30')](_[_0xa6d4('0x3a')](_0x1e7d69[_0xa6d4('0x2f')],_0x9ece25[_0xa6d4('0x30')]),_0x1209a7);if(_0x1e7d69[_0xa6d4('0x2f')][_0xa6d4('0x3b')]){_0x3d831c[_0xa6d4('0x39')]=_[_0xa6d4('0x3c')](_0x3d831c[_0xa6d4('0x39')],{'$or':_[_0xa6d4('0x2b')](_0x1209a7,function(_0x17ea14){if(_0x17ea14[_0xa6d4('0x2d')]!==_0xa6d4('0x3d')){var _0x4b1e63={};_0x4b1e63[_0x17ea14['name']]={'$like':'%'+_0x1e7d69[_0xa6d4('0x2f')][_0xa6d4('0x3b')]+'%'};return _0x4b1e63;}})});}_0x3d831c=_[_0xa6d4('0x3c')]({},_0x3d831c,_0x1e7d69['options']);var _0x369a19={'where':_0x3d831c[_0xa6d4('0x39')]};return db[_0xa6d4('0x3e')][_0xa6d4('0x20')](_0x369a19)[_0xa6d4('0x24')](function(_0x10a85){_0x67d09a['count']=_0x10a85;if(_0x1e7d69[_0xa6d4('0x2f')][_0xa6d4('0x3f')]){_0x3d831c[_0xa6d4('0x40')]=[{'all':!![]}];}return db[_0xa6d4('0x3e')][_0xa6d4('0x41')](_0x3d831c);})['then'](function(_0x316f3b){_0x67d09a[_0xa6d4('0x42')]=_0x316f3b;return _0x67d09a;})['then'](respondWithFilteredResult(_0x5cc289,_0x3d831c))[_0xa6d4('0x43')](handleError(_0x5cc289,null));};exports[_0xa6d4('0x44')]=function(_0x355c21,_0x592599){var _0x832ee8={'raw':![],'where':{'id':_0x355c21[_0xa6d4('0x45')]['id']}},_0x2b1465={};_0x2b1465['model']=_['keys'](db[_0xa6d4('0x3e')][_0xa6d4('0x46')]);_0x2b1465[_0xa6d4('0x2f')]=_[_0xa6d4('0x47')](_0x355c21[_0xa6d4('0x2f')]);_0x2b1465[_0xa6d4('0x30')]=_['intersection'](_0x2b1465[_0xa6d4('0x2e')],_0x2b1465[_0xa6d4('0x2f')]);_0x832ee8[_0xa6d4('0x32')]=_[_0xa6d4('0x31')](_0x2b1465[_0xa6d4('0x2e')],qs[_0xa6d4('0x33')](_0x355c21['query'][_0xa6d4('0x33')]));_0x832ee8['attributes']=_0x832ee8[_0xa6d4('0x32')][_0xa6d4('0x34')]?_0x832ee8[_0xa6d4('0x32')]:_0x2b1465[_0xa6d4('0x2e')];if(_0x355c21[_0xa6d4('0x2f')][_0xa6d4('0x3f')]){_0x832ee8['include']=[{'all':!![]}];}_0x832ee8=_[_0xa6d4('0x3c')]({},_0x832ee8,_0x355c21['options']);return db[_0xa6d4('0x3e')][_0xa6d4('0x48')](_0x832ee8)[_0xa6d4('0x24')](handleEntityNotFound(_0x592599,null))[_0xa6d4('0x24')](respondWithResult(_0x592599,null))['catch'](handleError(_0x592599,null));};exports['create']=function(_0x3c5c8f,_0x2cdd7f){return db[_0xa6d4('0x3e')][_0xa6d4('0x49')](_0x3c5c8f['body'],{})[_0xa6d4('0x24')](respondWithResult(_0x2cdd7f,0xc9))['catch'](handleError(_0x2cdd7f,null));};exports['update']=function(_0x30df5b,_0x312b2c){if(_0x30df5b[_0xa6d4('0x4a')]['id']){delete _0x30df5b['body']['id'];}return db[_0xa6d4('0x3e')][_0xa6d4('0x48')]({'where':{'id':_0x30df5b[_0xa6d4('0x45')]['id']}})[_0xa6d4('0x24')](handleEntityNotFound(_0x312b2c,null))[_0xa6d4('0x24')](saveUpdates(_0x30df5b[_0xa6d4('0x4a')],null))[_0xa6d4('0x24')](respondWithResult(_0x312b2c,null))['catch'](handleError(_0x312b2c,null));};exports[_0xa6d4('0x25')]=function(_0x436bf0,_0x51ebd2){return db[_0xa6d4('0x3e')][_0xa6d4('0x48')]({'where':{'id':_0x436bf0['params']['id']}})[_0xa6d4('0x24')](handleEntityNotFound(_0x51ebd2,null))[_0xa6d4('0x24')](removeEntity(_0x51ebd2,null))[_0xa6d4('0x43')](handleError(_0x51ebd2,null));};exports[_0xa6d4('0x4b')]=function(_0x348e3e,_0x52e48e,_0x43f563){var _0x6139d2={};var _0x425633={};var _0x39b683;var _0x303b0d;return db[_0xa6d4('0x3e')][_0xa6d4('0x4c')]({'where':{'id':_0x348e3e['params']['id']}})[_0xa6d4('0x24')](handleEntityNotFound(_0x52e48e,null))['then'](function(_0x445f1f){if(_0x445f1f){_0x39b683=_0x445f1f;_0x425633[_0xa6d4('0x2e')]=_['keys'](db[_0xa6d4('0x4d')]['rawAttributes']);_0x425633['query']=_[_0xa6d4('0x47')](_0x348e3e[_0xa6d4('0x2f')]);_0x425633[_0xa6d4('0x30')]=_[_0xa6d4('0x31')](_0x425633['model'],_0x425633[_0xa6d4('0x2f')]);_0x6139d2[_0xa6d4('0x32')]=_[_0xa6d4('0x31')](_0x425633[_0xa6d4('0x2e')],qs['fields'](_0x348e3e[_0xa6d4('0x2f')][_0xa6d4('0x33')]));_0x6139d2[_0xa6d4('0x32')]=_0x6139d2[_0xa6d4('0x32')][_0xa6d4('0x34')]?_0x6139d2[_0xa6d4('0x32')]:_0x425633['model'];_0x6139d2[_0xa6d4('0x37')]=qs[_0xa6d4('0x38')](_0x348e3e[_0xa6d4('0x2f')][_0xa6d4('0x38')]);_0x6139d2[_0xa6d4('0x39')]=qs[_0xa6d4('0x30')](_['pick'](_0x348e3e['query'],_0x425633[_0xa6d4('0x30')]));if(_0x348e3e['query'][_0xa6d4('0x3b')]){_0x6139d2[_0xa6d4('0x39')]=_[_0xa6d4('0x3c')](_0x6139d2['where'],{'$or':_[_0xa6d4('0x2b')](_0x6139d2[_0xa6d4('0x32')],function(_0x2f8a6f){var _0x1d96bb={};_0x1d96bb[_0x2f8a6f]={'$like':'%'+_0x348e3e[_0xa6d4('0x2f')][_0xa6d4('0x3b')]+'%'};return _0x1d96bb;})});}_0x6139d2=_[_0xa6d4('0x3c')]({},_0x6139d2,_0x348e3e[_0xa6d4('0x4e')]);return _0x39b683[_0xa6d4('0x4b')](_0x6139d2);}})[_0xa6d4('0x24')](function(_0x3eddde){if(_0x3eddde){_0x303b0d=_0x3eddde[_0xa6d4('0x34')];if(!_0x348e3e[_0xa6d4('0x2f')]['hasOwnProperty']('nolimit')){_0x6139d2[_0xa6d4('0x1f')]=qs[_0xa6d4('0x1f')](_0x348e3e[_0xa6d4('0x2f')][_0xa6d4('0x1f')]);_0x6139d2[_0xa6d4('0x1d')]=qs['offset'](_0x348e3e[_0xa6d4('0x2f')][_0xa6d4('0x1d')]);}return _0x39b683[_0xa6d4('0x4b')](_0x6139d2);}})[_0xa6d4('0x24')](function(_0x37a055){if(_0x37a055){return _0x37a055?{'count':_0x303b0d,'rows':_0x37a055}:null;}})[_0xa6d4('0x24')](respondWithResult(_0x52e48e,null))[_0xa6d4('0x43')](handleError(_0x52e48e,null));};exports[_0xa6d4('0x4f')]=function(_0x484d55,_0x377c58,_0x5139b6){var _0x3317f6={};var _0x113a63={};var _0xfc7fd;var _0x2b3070;return db[_0xa6d4('0x3e')][_0xa6d4('0x4c')]({'where':{'id':_0x484d55[_0xa6d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x377c58,null))[_0xa6d4('0x24')](function(_0x299e2d){if(_0x299e2d){_0xfc7fd=_0x299e2d;_0x113a63[_0xa6d4('0x2e')]=_[_0xa6d4('0x47')](db[_0xa6d4('0x4d')][_0xa6d4('0x46')]);_0x113a63[_0xa6d4('0x2f')]=_[_0xa6d4('0x47')](_0x484d55[_0xa6d4('0x2f')]);_0x113a63[_0xa6d4('0x30')]=_[_0xa6d4('0x31')](_0x113a63['model'],_0x113a63['query']);_0x3317f6[_0xa6d4('0x32')]=_['intersection'](_0x113a63[_0xa6d4('0x2e')],qs['fields'](_0x484d55[_0xa6d4('0x2f')][_0xa6d4('0x33')]));_0x3317f6[_0xa6d4('0x32')]=_0x3317f6[_0xa6d4('0x32')]['length']?_0x3317f6[_0xa6d4('0x32')]:_0x113a63['model'];_0x3317f6[_0xa6d4('0x37')]=qs[_0xa6d4('0x38')](_0x484d55[_0xa6d4('0x2f')][_0xa6d4('0x38')]);_0x3317f6[_0xa6d4('0x39')]=qs['filters'](_[_0xa6d4('0x3a')](_0x484d55['query'],_0x113a63['filters']));if(_0x484d55[_0xa6d4('0x2f')][_0xa6d4('0x3b')]){_0x3317f6[_0xa6d4('0x39')]=_['merge'](_0x3317f6[_0xa6d4('0x39')],{'$or':_['map'](_0x3317f6[_0xa6d4('0x32')],function(_0x26a3bb){var _0x3a59f9={};_0x3a59f9[_0x26a3bb]={'$like':'%'+_0x484d55['query']['filter']+'%'};return _0x3a59f9;})});}_0x3317f6=_['merge']({},_0x3317f6,_0x484d55['options']);return _0xfc7fd[_0xa6d4('0x4f')](_0x3317f6);}})[_0xa6d4('0x24')](function(_0x59fde9){if(_0x59fde9){_0x2b3070=_0x59fde9['length'];if(!_0x484d55[_0xa6d4('0x2f')]['hasOwnProperty'](_0xa6d4('0x36'))){_0x3317f6[_0xa6d4('0x1f')]=qs[_0xa6d4('0x1f')](_0x484d55[_0xa6d4('0x2f')][_0xa6d4('0x1f')]);_0x3317f6['offset']=qs[_0xa6d4('0x1d')](_0x484d55['query'][_0xa6d4('0x1d')]);}return _0xfc7fd[_0xa6d4('0x4f')](_0x3317f6);}})[_0xa6d4('0x24')](function(_0x59ef2a){if(_0x59ef2a){return _0x59ef2a?{'count':_0x2b3070,'rows':_0x59ef2a}:null;}})['then'](respondWithResult(_0x377c58,null))[_0xa6d4('0x43')](handleError(_0x377c58,null));};exports[_0xa6d4('0x50')]=function(_0x5b319c,_0x2bed31,_0x1a76d5){var _0x213730={};var _0x21f6d5={};var _0x2edc04;var _0xce7c8b;return db[_0xa6d4('0x3e')][_0xa6d4('0x4c')]({'where':{'id':_0x5b319c[_0xa6d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x2bed31,null))[_0xa6d4('0x24')](function(_0x3871ed){if(_0x3871ed){_0x2edc04=_0x3871ed;_0x21f6d5[_0xa6d4('0x2e')]=_[_0xa6d4('0x47')](db[_0xa6d4('0x4d')][_0xa6d4('0x46')]);_0x21f6d5[_0xa6d4('0x2f')]=_[_0xa6d4('0x47')](_0x5b319c['query']);_0x21f6d5[_0xa6d4('0x30')]=_[_0xa6d4('0x31')](_0x21f6d5[_0xa6d4('0x2e')],_0x21f6d5[_0xa6d4('0x2f')]);_0x213730['attributes']=_['intersection'](_0x21f6d5[_0xa6d4('0x2e')],qs[_0xa6d4('0x33')](_0x5b319c['query']['fields']));_0x213730[_0xa6d4('0x32')]=_0x213730[_0xa6d4('0x32')][_0xa6d4('0x34')]?_0x213730[_0xa6d4('0x32')]:_0x21f6d5['model'];_0x213730[_0xa6d4('0x37')]=qs[_0xa6d4('0x38')](_0x5b319c[_0xa6d4('0x2f')][_0xa6d4('0x38')]);_0x213730[_0xa6d4('0x39')]=qs['filters'](_['pick'](_0x5b319c['query'],_0x21f6d5[_0xa6d4('0x30')]));if(_0x5b319c[_0xa6d4('0x2f')][_0xa6d4('0x3b')]){_0x213730[_0xa6d4('0x39')]=_[_0xa6d4('0x3c')](_0x213730['where'],{'$or':_[_0xa6d4('0x2b')](_0x213730[_0xa6d4('0x32')],function(_0xdbf061){var _0x15de25={};_0x15de25[_0xdbf061]={'$like':'%'+_0x5b319c[_0xa6d4('0x2f')][_0xa6d4('0x3b')]+'%'};return _0x15de25;})});}_0x213730=_['merge']({},_0x213730,_0x5b319c[_0xa6d4('0x4e')]);return _0x2edc04[_0xa6d4('0x50')](_0x213730);}})[_0xa6d4('0x24')](function(_0x110be5){if(_0x110be5){_0xce7c8b=_0x110be5[_0xa6d4('0x34')];if(!_0x5b319c[_0xa6d4('0x2f')][_0xa6d4('0x35')](_0xa6d4('0x36'))){_0x213730[_0xa6d4('0x1f')]=qs[_0xa6d4('0x1f')](_0x5b319c[_0xa6d4('0x2f')]['limit']);_0x213730[_0xa6d4('0x1d')]=qs['offset'](_0x5b319c['query']['offset']);}return _0x2edc04[_0xa6d4('0x50')](_0x213730);}})['then'](function(_0x4a6e89){if(_0x4a6e89){return _0x4a6e89?{'count':_0xce7c8b,'rows':_0x4a6e89}:null;}})['then'](respondWithResult(_0x2bed31,null))[_0xa6d4('0x43')](handleError(_0x2bed31,null));}; \ No newline at end of file +var _0xb5fd=['path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','SugarcrmField','filter','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x1ccff8,_0x2573c4){var _0xe2f066=function(_0x15ee6c){while(--_0x15ee6c){_0x1ccff8['push'](_0x1ccff8['shift']());}};_0xe2f066(++_0x2573c4);}(_0xb5fd,0xe4));var _0xdb5f=function(_0x13cf5f,_0x5427f5){_0x13cf5f=_0x13cf5f-0x0;var _0x4c5537=_0xb5fd[_0x13cf5f];return _0x4c5537;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdb5f('0x0'));var jsonpatch=require(_0xdb5f('0x1'));var rp=require(_0xdb5f('0x2'));var moment=require('moment');var BPromise=require(_0xdb5f('0x3'));var Mustache=require(_0xdb5f('0x4'));var util=require(_0xdb5f('0x5'));var path=require(_0xdb5f('0x6'));var sox=require(_0xdb5f('0x7'));var csv=require(_0xdb5f('0x8'));var ejs=require(_0xdb5f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdb5f('0xa'));var crypto=require(_0xdb5f('0xb'));var jsforce=require(_0xdb5f('0xc'));var deskjs=require(_0xdb5f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdb5f('0xe'));var Papa=require('papaparse');var Redis=require(_0xdb5f('0xf'));var authService=require(_0xdb5f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdb5f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb5f('0x12'))(_0xdb5f('0x13'));var utils=require(_0xdb5f('0x14'));var config=require(_0xdb5f('0x15'));var licenseUtil=require(_0xdb5f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x390bde,_0x3a14d5){_0x3a14d5=_0x3a14d5||0xcc;return function(_0x43ca57){if(_0x43ca57){return _0x390bde[_0xdb5f('0x17')](_0x3a14d5);}return _0x390bde[_0xdb5f('0x18')](_0x3a14d5)[_0xdb5f('0x19')]();};}function respondWithResult(_0x4f0bfa,_0x537f76){_0x537f76=_0x537f76||0xc8;return function(_0x98cf84){if(_0x98cf84){return _0x4f0bfa[_0xdb5f('0x18')](_0x537f76)[_0xdb5f('0x1a')](_0x98cf84);}};}function respondWithFilteredResult(_0x68fc5f,_0x1158ee){return function(_0x4fb9c6){if(_0x4fb9c6){var _0x3f064a=typeof _0x1158ee['offset']===_0xdb5f('0x1b')&&typeof _0x1158ee[_0xdb5f('0x1c')]===_0xdb5f('0x1b');var _0x49cb8e=_0x4fb9c6[_0xdb5f('0x1d')];var _0x149904=_0x3f064a?0x0:_0x1158ee[_0xdb5f('0x1e')];var _0x153070=_0x3f064a?_0x4fb9c6[_0xdb5f('0x1d')]:_0x1158ee['offset']+_0x1158ee[_0xdb5f('0x1c')];var _0x424ad8;if(_0x153070>=_0x49cb8e){_0x153070=_0x49cb8e;_0x424ad8=0xc8;}else{_0x424ad8=0xce;}_0x68fc5f[_0xdb5f('0x18')](_0x424ad8);return _0x68fc5f[_0xdb5f('0x1f')](_0xdb5f('0x20'),_0x149904+'-'+_0x153070+'/'+_0x49cb8e)['json'](_0x4fb9c6);}return null;};}function patchUpdates(_0x3cbd6a){return function(_0x1e2b49){try{jsonpatch[_0xdb5f('0x21')](_0x1e2b49,_0x3cbd6a,!![]);}catch(_0x4e2623){return BPromise[_0xdb5f('0x22')](_0x4e2623);}return _0x1e2b49[_0xdb5f('0x23')]();};}function saveUpdates(_0x2fda5b,_0x1bf6db){return function(_0x332396){if(_0x332396){return _0x332396[_0xdb5f('0x24')](_0x2fda5b)['then'](function(_0x3fe241){return _0x3fe241;});}return null;};}function removeEntity(_0xd6b075,_0x1bc89f){return function(_0x2cf2be){if(_0x2cf2be){return _0x2cf2be['destroy']()[_0xdb5f('0x25')](function(){_0xd6b075['status'](0xcc)[_0xdb5f('0x19')]();});}};}function handleEntityNotFound(_0x584d85,_0xbe4b93){return function(_0x4e75a1){if(!_0x4e75a1){_0x584d85[_0xdb5f('0x17')](0x194);}return _0x4e75a1;};}function handleError(_0xa6b197,_0x14d63d){_0x14d63d=_0x14d63d||0x1f4;return function(_0x319544){logger[_0xdb5f('0x26')](_0x319544['stack']);if(_0x319544[_0xdb5f('0x27')]){delete _0x319544[_0xdb5f('0x27')];}_0xa6b197[_0xdb5f('0x18')](_0x14d63d)[_0xdb5f('0x28')](_0x319544);};}exports[_0xdb5f('0x29')]=function(_0x568c79,_0x5c2868){var _0x11be42={},_0x524e93={},_0x35b16c={'count':0x0,'rows':[]};var _0xea0445=_[_0xdb5f('0x2a')](db[_0xdb5f('0x2b')][_0xdb5f('0x2c')],function(_0x277361){return{'name':_0x277361['fieldName'],'type':_0x277361['type'][_0xdb5f('0x2d')]};});_0x524e93[_0xdb5f('0x2e')]=_[_0xdb5f('0x2a')](_0xea0445,'name');_0x524e93[_0xdb5f('0x2f')]=_[_0xdb5f('0x30')](_0x568c79[_0xdb5f('0x2f')]);_0x524e93[_0xdb5f('0x31')]=_[_0xdb5f('0x32')](_0x524e93[_0xdb5f('0x2e')],_0x524e93['query']);_0x11be42[_0xdb5f('0x33')]=_['intersection'](_0x524e93['model'],qs['fields'](_0x568c79[_0xdb5f('0x2f')][_0xdb5f('0x34')]));_0x11be42['attributes']=_0x11be42['attributes'][_0xdb5f('0x35')]?_0x11be42[_0xdb5f('0x33')]:_0x524e93[_0xdb5f('0x2e')];if(!_0x568c79[_0xdb5f('0x2f')][_0xdb5f('0x36')](_0xdb5f('0x37'))){_0x11be42[_0xdb5f('0x1c')]=qs[_0xdb5f('0x1c')](_0x568c79[_0xdb5f('0x2f')][_0xdb5f('0x1c')]);_0x11be42[_0xdb5f('0x1e')]=qs[_0xdb5f('0x1e')](_0x568c79[_0xdb5f('0x2f')][_0xdb5f('0x1e')]);}_0x11be42[_0xdb5f('0x38')]=qs[_0xdb5f('0x39')](_0x568c79[_0xdb5f('0x2f')][_0xdb5f('0x39')]);_0x11be42[_0xdb5f('0x3a')]=qs[_0xdb5f('0x31')](_[_0xdb5f('0x3b')](_0x568c79[_0xdb5f('0x2f')],_0x524e93[_0xdb5f('0x31')]),_0xea0445);if(_0x568c79[_0xdb5f('0x2f')]['filter']){_0x11be42[_0xdb5f('0x3a')]=_['merge'](_0x11be42[_0xdb5f('0x3a')],{'$or':_[_0xdb5f('0x2a')](_0xea0445,function(_0x4fcaec){if(_0x4fcaec['type']!=='VIRTUAL'){var _0x553b74={};_0x553b74[_0x4fcaec[_0xdb5f('0x27')]]={'$like':'%'+_0x568c79[_0xdb5f('0x2f')]['filter']+'%'};return _0x553b74;}})});}_0x11be42=_[_0xdb5f('0x3c')]({},_0x11be42,_0x568c79[_0xdb5f('0x3d')]);var _0x4c4bf8={'where':_0x11be42['where']};return db[_0xdb5f('0x2b')][_0xdb5f('0x1d')](_0x4c4bf8)[_0xdb5f('0x25')](function(_0x58056a){_0x35b16c[_0xdb5f('0x1d')]=_0x58056a;if(_0x568c79['query'][_0xdb5f('0x3e')]){_0x11be42[_0xdb5f('0x3f')]=[{'all':!![]}];}return db[_0xdb5f('0x2b')][_0xdb5f('0x40')](_0x11be42);})[_0xdb5f('0x25')](function(_0xaee217){_0x35b16c[_0xdb5f('0x41')]=_0xaee217;return _0x35b16c;})[_0xdb5f('0x25')](respondWithFilteredResult(_0x5c2868,_0x11be42))[_0xdb5f('0x42')](handleError(_0x5c2868,null));};exports[_0xdb5f('0x43')]=function(_0x3836c6,_0x237f91){var _0x2976f3={'raw':![],'where':{'id':_0x3836c6['params']['id']}},_0xf0f9d0={};_0xf0f9d0[_0xdb5f('0x2e')]=_[_0xdb5f('0x30')](db[_0xdb5f('0x2b')]['rawAttributes']);_0xf0f9d0[_0xdb5f('0x2f')]=_[_0xdb5f('0x30')](_0x3836c6[_0xdb5f('0x2f')]);_0xf0f9d0[_0xdb5f('0x31')]=_['intersection'](_0xf0f9d0[_0xdb5f('0x2e')],_0xf0f9d0[_0xdb5f('0x2f')]);_0x2976f3['attributes']=_[_0xdb5f('0x32')](_0xf0f9d0[_0xdb5f('0x2e')],qs['fields'](_0x3836c6[_0xdb5f('0x2f')]['fields']));_0x2976f3[_0xdb5f('0x33')]=_0x2976f3[_0xdb5f('0x33')][_0xdb5f('0x35')]?_0x2976f3[_0xdb5f('0x33')]:_0xf0f9d0['model'];if(_0x3836c6[_0xdb5f('0x2f')][_0xdb5f('0x3e')]){_0x2976f3['include']=[{'all':!![]}];}_0x2976f3=_['merge']({},_0x2976f3,_0x3836c6['options']);return db[_0xdb5f('0x2b')][_0xdb5f('0x44')](_0x2976f3)['then'](handleEntityNotFound(_0x237f91,null))[_0xdb5f('0x25')](respondWithResult(_0x237f91,null))[_0xdb5f('0x42')](handleError(_0x237f91,null));};exports[_0xdb5f('0x45')]=function(_0x484415,_0x136460){return db['SugarcrmConfiguration'][_0xdb5f('0x45')](_0x484415['body'],{})[_0xdb5f('0x25')](respondWithResult(_0x136460,0xc9))[_0xdb5f('0x42')](handleError(_0x136460,null));};exports[_0xdb5f('0x24')]=function(_0x1bb235,_0xabd7a1){if(_0x1bb235[_0xdb5f('0x46')]['id']){delete _0x1bb235[_0xdb5f('0x46')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1bb235[_0xdb5f('0x47')]['id']}})['then'](handleEntityNotFound(_0xabd7a1,null))[_0xdb5f('0x25')](saveUpdates(_0x1bb235[_0xdb5f('0x46')],null))[_0xdb5f('0x25')](respondWithResult(_0xabd7a1,null))[_0xdb5f('0x42')](handleError(_0xabd7a1,null));};exports['destroy']=function(_0x4dc8fb,_0xb14952){return db[_0xdb5f('0x2b')][_0xdb5f('0x44')]({'where':{'id':_0x4dc8fb['params']['id']}})[_0xdb5f('0x25')](handleEntityNotFound(_0xb14952,null))['then'](removeEntity(_0xb14952,null))[_0xdb5f('0x42')](handleError(_0xb14952,null));};exports[_0xdb5f('0x48')]=function(_0x25872b,_0x3887b9,_0x393983){var _0x4e2109={};var _0x463bbb={};var _0x4ad29b;var _0x23e28e;return db[_0xdb5f('0x2b')][_0xdb5f('0x49')]({'where':{'id':_0x25872b[_0xdb5f('0x47')]['id']}})[_0xdb5f('0x25')](handleEntityNotFound(_0x3887b9,null))[_0xdb5f('0x25')](function(_0x1b980a){if(_0x1b980a){_0x4ad29b=_0x1b980a;_0x463bbb[_0xdb5f('0x2e')]=_[_0xdb5f('0x30')](db[_0xdb5f('0x4a')][_0xdb5f('0x2c')]);_0x463bbb[_0xdb5f('0x2f')]=_[_0xdb5f('0x30')](_0x25872b[_0xdb5f('0x2f')]);_0x463bbb[_0xdb5f('0x31')]=_['intersection'](_0x463bbb[_0xdb5f('0x2e')],_0x463bbb[_0xdb5f('0x2f')]);_0x4e2109[_0xdb5f('0x33')]=_[_0xdb5f('0x32')](_0x463bbb[_0xdb5f('0x2e')],qs[_0xdb5f('0x34')](_0x25872b[_0xdb5f('0x2f')][_0xdb5f('0x34')]));_0x4e2109['attributes']=_0x4e2109[_0xdb5f('0x33')][_0xdb5f('0x35')]?_0x4e2109[_0xdb5f('0x33')]:_0x463bbb[_0xdb5f('0x2e')];_0x4e2109[_0xdb5f('0x38')]=qs[_0xdb5f('0x39')](_0x25872b['query'][_0xdb5f('0x39')]);_0x4e2109[_0xdb5f('0x3a')]=qs[_0xdb5f('0x31')](_[_0xdb5f('0x3b')](_0x25872b[_0xdb5f('0x2f')],_0x463bbb[_0xdb5f('0x31')]));if(_0x25872b[_0xdb5f('0x2f')]['filter']){_0x4e2109[_0xdb5f('0x3a')]=_[_0xdb5f('0x3c')](_0x4e2109['where'],{'$or':_['map'](_0x4e2109[_0xdb5f('0x33')],function(_0x1f2d3b){var _0x38e41f={};_0x38e41f[_0x1f2d3b]={'$like':'%'+_0x25872b[_0xdb5f('0x2f')]['filter']+'%'};return _0x38e41f;})});}_0x4e2109=_['merge']({},_0x4e2109,_0x25872b[_0xdb5f('0x3d')]);return _0x4ad29b['getFields'](_0x4e2109);}})[_0xdb5f('0x25')](function(_0x312818){if(_0x312818){_0x23e28e=_0x312818[_0xdb5f('0x35')];if(!_0x25872b[_0xdb5f('0x2f')][_0xdb5f('0x36')](_0xdb5f('0x37'))){_0x4e2109[_0xdb5f('0x1c')]=qs[_0xdb5f('0x1c')](_0x25872b[_0xdb5f('0x2f')][_0xdb5f('0x1c')]);_0x4e2109[_0xdb5f('0x1e')]=qs[_0xdb5f('0x1e')](_0x25872b[_0xdb5f('0x2f')][_0xdb5f('0x1e')]);}return _0x4ad29b[_0xdb5f('0x48')](_0x4e2109);}})[_0xdb5f('0x25')](function(_0x5ee652){if(_0x5ee652){return _0x5ee652?{'count':_0x23e28e,'rows':_0x5ee652}:null;}})[_0xdb5f('0x25')](respondWithResult(_0x3887b9,null))[_0xdb5f('0x42')](handleError(_0x3887b9,null));};exports['getSubjects']=function(_0xc30b2c,_0x184a44,_0x386a5e){var _0x4122d2={};var _0x582600={};var _0x2b0172;var _0x5bd1f6;return db['SugarcrmConfiguration'][_0xdb5f('0x49')]({'where':{'id':_0xc30b2c[_0xdb5f('0x47')]['id']}})['then'](handleEntityNotFound(_0x184a44,null))[_0xdb5f('0x25')](function(_0x12ce7f){if(_0x12ce7f){_0x2b0172=_0x12ce7f;_0x582600['model']=_[_0xdb5f('0x30')](db['SugarcrmField']['rawAttributes']);_0x582600[_0xdb5f('0x2f')]=_[_0xdb5f('0x30')](_0xc30b2c['query']);_0x582600[_0xdb5f('0x31')]=_[_0xdb5f('0x32')](_0x582600[_0xdb5f('0x2e')],_0x582600[_0xdb5f('0x2f')]);_0x4122d2['attributes']=_[_0xdb5f('0x32')](_0x582600[_0xdb5f('0x2e')],qs[_0xdb5f('0x34')](_0xc30b2c['query'][_0xdb5f('0x34')]));_0x4122d2[_0xdb5f('0x33')]=_0x4122d2['attributes'][_0xdb5f('0x35')]?_0x4122d2[_0xdb5f('0x33')]:_0x582600[_0xdb5f('0x2e')];_0x4122d2[_0xdb5f('0x38')]=qs['sort'](_0xc30b2c[_0xdb5f('0x2f')][_0xdb5f('0x39')]);_0x4122d2[_0xdb5f('0x3a')]=qs[_0xdb5f('0x31')](_['pick'](_0xc30b2c[_0xdb5f('0x2f')],_0x582600[_0xdb5f('0x31')]));if(_0xc30b2c[_0xdb5f('0x2f')][_0xdb5f('0x4b')]){_0x4122d2[_0xdb5f('0x3a')]=_[_0xdb5f('0x3c')](_0x4122d2[_0xdb5f('0x3a')],{'$or':_[_0xdb5f('0x2a')](_0x4122d2[_0xdb5f('0x33')],function(_0x49170b){var _0xf41d5d={};_0xf41d5d[_0x49170b]={'$like':'%'+_0xc30b2c['query'][_0xdb5f('0x4b')]+'%'};return _0xf41d5d;})});}_0x4122d2=_[_0xdb5f('0x3c')]({},_0x4122d2,_0xc30b2c[_0xdb5f('0x3d')]);return _0x2b0172[_0xdb5f('0x4c')](_0x4122d2);}})[_0xdb5f('0x25')](function(_0x1c498b){if(_0x1c498b){_0x5bd1f6=_0x1c498b['length'];if(!_0xc30b2c[_0xdb5f('0x2f')]['hasOwnProperty']('nolimit')){_0x4122d2[_0xdb5f('0x1c')]=qs[_0xdb5f('0x1c')](_0xc30b2c[_0xdb5f('0x2f')][_0xdb5f('0x1c')]);_0x4122d2[_0xdb5f('0x1e')]=qs[_0xdb5f('0x1e')](_0xc30b2c[_0xdb5f('0x2f')][_0xdb5f('0x1e')]);}return _0x2b0172[_0xdb5f('0x4c')](_0x4122d2);}})[_0xdb5f('0x25')](function(_0x45b4ab){if(_0x45b4ab){return _0x45b4ab?{'count':_0x5bd1f6,'rows':_0x45b4ab}:null;}})[_0xdb5f('0x25')](respondWithResult(_0x184a44,null))['catch'](handleError(_0x184a44,null));};exports[_0xdb5f('0x4d')]=function(_0x2fd515,_0x340feb,_0x5792ff){var _0xcb1392={};var _0x38c909={};var _0x56e7a9;var _0x51da84;return db['SugarcrmConfiguration'][_0xdb5f('0x49')]({'where':{'id':_0x2fd515[_0xdb5f('0x47')]['id']}})[_0xdb5f('0x25')](handleEntityNotFound(_0x340feb,null))[_0xdb5f('0x25')](function(_0x3dc8aa){if(_0x3dc8aa){_0x56e7a9=_0x3dc8aa;_0x38c909[_0xdb5f('0x2e')]=_['keys'](db[_0xdb5f('0x4a')][_0xdb5f('0x2c')]);_0x38c909[_0xdb5f('0x2f')]=_['keys'](_0x2fd515[_0xdb5f('0x2f')]);_0x38c909['filters']=_[_0xdb5f('0x32')](_0x38c909[_0xdb5f('0x2e')],_0x38c909['query']);_0xcb1392[_0xdb5f('0x33')]=_[_0xdb5f('0x32')](_0x38c909['model'],qs[_0xdb5f('0x34')](_0x2fd515[_0xdb5f('0x2f')][_0xdb5f('0x34')]));_0xcb1392[_0xdb5f('0x33')]=_0xcb1392[_0xdb5f('0x33')]['length']?_0xcb1392[_0xdb5f('0x33')]:_0x38c909[_0xdb5f('0x2e')];_0xcb1392['order']=qs[_0xdb5f('0x39')](_0x2fd515[_0xdb5f('0x2f')][_0xdb5f('0x39')]);_0xcb1392[_0xdb5f('0x3a')]=qs['filters'](_[_0xdb5f('0x3b')](_0x2fd515[_0xdb5f('0x2f')],_0x38c909[_0xdb5f('0x31')]));if(_0x2fd515[_0xdb5f('0x2f')][_0xdb5f('0x4b')]){_0xcb1392[_0xdb5f('0x3a')]=_[_0xdb5f('0x3c')](_0xcb1392[_0xdb5f('0x3a')],{'$or':_[_0xdb5f('0x2a')](_0xcb1392[_0xdb5f('0x33')],function(_0x47ce50){var _0x146439={};_0x146439[_0x47ce50]={'$like':'%'+_0x2fd515[_0xdb5f('0x2f')][_0xdb5f('0x4b')]+'%'};return _0x146439;})});}_0xcb1392=_[_0xdb5f('0x3c')]({},_0xcb1392,_0x2fd515[_0xdb5f('0x3d')]);return _0x56e7a9['getDescriptions'](_0xcb1392);}})[_0xdb5f('0x25')](function(_0x460794){if(_0x460794){_0x51da84=_0x460794[_0xdb5f('0x35')];if(!_0x2fd515[_0xdb5f('0x2f')][_0xdb5f('0x36')]('nolimit')){_0xcb1392['limit']=qs[_0xdb5f('0x1c')](_0x2fd515[_0xdb5f('0x2f')][_0xdb5f('0x1c')]);_0xcb1392[_0xdb5f('0x1e')]=qs[_0xdb5f('0x1e')](_0x2fd515[_0xdb5f('0x2f')][_0xdb5f('0x1e')]);}return _0x56e7a9[_0xdb5f('0x4d')](_0xcb1392);}})['then'](function(_0x7eaee6){if(_0x7eaee6){return _0x7eaee6?{'count':_0x51da84,'rows':_0x7eaee6}:null;}})[_0xdb5f('0x25')](respondWithResult(_0x340feb,null))[_0xdb5f('0x42')](handleError(_0x340feb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c5e748c..6471f89 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 _0x116d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash'];(function(_0x4c3593,_0x4ea381){var _0x1172d1=function(_0x434b93){while(--_0x434b93){_0x4c3593['push'](_0x4c3593['shift']());}};_0x1172d1(++_0x4ea381);}(_0x116d,0x178));var _0xd116=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x116d[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xd116('0x0'));var util=require(_0xd116('0x1'));var logger=require(_0xd116('0x2'))(_0xd116('0x3'));var moment=require(_0xd116('0x4'));var BPromise=require('bluebird');var rp=require(_0xd116('0x5'));var fs=require('fs');var path=require(_0xd116('0x6'));var rimraf=require(_0xd116('0x7'));var config=require(_0xd116('0x8'));var attributes=require(_0xd116('0x9'));module[_0xd116('0xa')]=function(_0x44e97b,_0x403776){return _0x44e97b[_0xd116('0xb')]('SugarcrmConfiguration',attributes,{'tableName':_0xd116('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa49=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2ada90,_0x38afba){var _0x27aed5=function(_0xd7d13b){while(--_0xd7d13b){_0x2ada90['push'](_0x2ada90['shift']());}};_0x27aed5(++_0x38afba);}(_0xfa49,0x12c));var _0x9fa4=function(_0x1d996d,_0x509248){_0x1d996d=_0x1d996d-0x0;var _0xb78fb1=_0xfa49[_0x1d996d];return _0xb78fb1;};'use strict';var _=require(_0x9fa4('0x0'));var util=require(_0x9fa4('0x1'));var logger=require(_0x9fa4('0x2'))(_0x9fa4('0x3'));var moment=require(_0x9fa4('0x4'));var BPromise=require(_0x9fa4('0x5'));var rp=require(_0x9fa4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fa4('0x7'));var config=require(_0x9fa4('0x8'));var attributes=require(_0x9fa4('0x9'));module[_0x9fa4('0xa')]=function(_0x57e8a9,_0x5c7e6a){return _0x57e8a9[_0x9fa4('0xb')](_0x9fa4('0xc'),attributes,{'tableName':_0x9fa4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 7be4b18..7ec6494 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 _0x6b2f=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x16bc52,_0x17b5bc){var _0xe2049b=function(_0x2c5b83){while(--_0x2c5b83){_0x16bc52['push'](_0x16bc52['shift']());}};_0xe2049b(++_0x17b5bc);}(_0x6b2f,0x167));var _0xf6b2=function(_0x257bec,_0x230628){_0x257bec=_0x257bec-0x0;var _0x208e8d=_0x6b2f[_0x257bec];return _0x208e8d;};'use strict';var _=require(_0xf6b2('0x0'));var util=require(_0xf6b2('0x1'));var moment=require(_0xf6b2('0x2'));var BPromise=require(_0xf6b2('0x3'));var rs=require(_0xf6b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6b2('0x5'))['db'];var utils=require(_0xf6b2('0x6'));var logger=require(_0xf6b2('0x7'))(_0xf6b2('0x8'));var config=require(_0xf6b2('0x9'));var jayson=require(_0xf6b2('0xa'));var client=jayson[_0xf6b2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c88a8,_0x187972,_0x4e02f0){return new BPromise(function(_0xd2259d,_0x2d9844){return client[_0xf6b2('0xc')](_0x1c88a8,_0x4e02f0)['then'](function(_0x12f35d){logger[_0xf6b2('0xd')](_0xf6b2('0xe'),_0x187972,_0xf6b2('0xf'));logger[_0xf6b2('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x187972,'request\x20sent',JSON[_0xf6b2('0x11')](_0x12f35d));if(_0x12f35d[_0xf6b2('0x12')]){if(_0x12f35d[_0xf6b2('0x12')][_0xf6b2('0x13')]===0x1f4){logger[_0xf6b2('0x12')](_0xf6b2('0xe'),_0x187972,_0x12f35d[_0xf6b2('0x12')][_0xf6b2('0x14')]);return _0x2d9844(_0x12f35d[_0xf6b2('0x12')][_0xf6b2('0x14')]);}logger['error'](_0xf6b2('0xe'),_0x187972,_0x12f35d[_0xf6b2('0x12')][_0xf6b2('0x14')]);return _0xd2259d(_0x12f35d[_0xf6b2('0x12')]['message']);}else{logger[_0xf6b2('0xd')](_0xf6b2('0xe'),_0x187972,_0xf6b2('0xf'));_0xd2259d(_0x12f35d[_0xf6b2('0x15')]['message']);}})['catch'](function(_0x526f29){logger[_0xf6b2('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x187972,_0x526f29);_0x2d9844(_0x526f29);});});} \ No newline at end of file +var _0x422a=['result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x388919,_0x2dd828){var _0x409405=function(_0x941e5b){while(--_0x941e5b){_0x388919['push'](_0x388919['shift']());}};_0x409405(++_0x2dd828);}(_0x422a,0x1e5));var _0xa422=function(_0x121b00,_0x28eeb5){_0x121b00=_0x121b00-0x0;var _0x1439eb=_0x422a[_0x121b00];return _0x1439eb;};'use strict';var _=require(_0xa422('0x0'));var util=require(_0xa422('0x1'));var moment=require(_0xa422('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa422('0x3'))['db'];var utils=require(_0xa422('0x4'));var logger=require(_0xa422('0x5'))(_0xa422('0x6'));var config=require(_0xa422('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa422('0x8')][_0xa422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d811d,_0x156b3e,_0x114049){return new BPromise(function(_0x479159,_0x49512a){return client[_0xa422('0xa')](_0x4d811d,_0x114049)[_0xa422('0xb')](function(_0x34eab4){logger[_0xa422('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x156b3e,_0xa422('0xd'));logger[_0xa422('0xe')](_0xa422('0xf'),_0x156b3e,_0xa422('0xd'),JSON[_0xa422('0x10')](_0x34eab4));if(_0x34eab4[_0xa422('0x11')]){if(_0x34eab4[_0xa422('0x11')][_0xa422('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x156b3e,_0x34eab4[_0xa422('0x11')][_0xa422('0x13')]);return _0x49512a(_0x34eab4[_0xa422('0x11')][_0xa422('0x13')]);}logger['error'](_0xa422('0x14'),_0x156b3e,_0x34eab4[_0xa422('0x11')][_0xa422('0x13')]);return _0x479159(_0x34eab4[_0xa422('0x11')]['message']);}else{logger[_0xa422('0xc')](_0xa422('0x14'),_0x156b3e,'request\x20sent');_0x479159(_0x34eab4[_0xa422('0x15')]['message']);}})[_0xa422('0x16')](function(_0x472f01){logger[_0xa422('0x11')](_0xa422('0x14'),_0x156b3e,_0x472f01);_0x49512a(_0x472f01);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 67d1800..80a89a4 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 _0xdf01=['show','create','put','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0xdf01,0x184));var _0x1df0=function(_0x2d8e9f,_0x3a0c91){_0x2d8e9f=_0x2d8e9f-0x0;var _0x274b08=_0xdf01[_0x2d8e9f];return _0x274b08;};'use strict';var multer=require('multer');var util=require(_0x1df0('0x0'));var path=require(_0x1df0('0x1'));var timeout=require(_0x1df0('0x2'));var express=require(_0x1df0('0x3'));var router=express[_0x1df0('0x4')]();var fs_extra=require(_0x1df0('0x5'));var auth=require(_0x1df0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1df0('0x7'));var controller=require('./intSugarcrmField.controller');router[_0x1df0('0x8')]('/',auth['isAuthenticated'](),controller[_0x1df0('0x9')]);router[_0x1df0('0x8')](_0x1df0('0xa'),auth['isAuthenticated'](),controller[_0x1df0('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1df0('0xc')]);router[_0x1df0('0xd')]('/:id',auth[_0x1df0('0xe')](),controller[_0x1df0('0xf')]);router[_0x1df0('0x10')](_0x1df0('0xa'),auth[_0x1df0('0xe')](),controller[_0x1df0('0x11')]);module[_0x1df0('0x12')]=router; \ No newline at end of file +var _0x5c5a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','destroy'];(function(_0x44fd29,_0x95314e){var _0x5039bb=function(_0x14dccf){while(--_0x14dccf){_0x44fd29['push'](_0x44fd29['shift']());}};_0x5039bb(++_0x95314e);}(_0x5c5a,0x1e7));var _0xa5c5=function(_0x8cf7a6,_0x27a95b){_0x8cf7a6=_0x8cf7a6-0x0;var _0x74ea4b=_0x5c5a[_0x8cf7a6];return _0x74ea4b;};'use strict';var multer=require(_0xa5c5('0x0'));var util=require(_0xa5c5('0x1'));var path=require(_0xa5c5('0x2'));var timeout=require(_0xa5c5('0x3'));var express=require(_0xa5c5('0x4'));var router=express[_0xa5c5('0x5')]();var fs_extra=require(_0xa5c5('0x6'));var auth=require(_0xa5c5('0x7'));var interaction=require(_0xa5c5('0x8'));var config=require(_0xa5c5('0x9'));var controller=require('./intSugarcrmField.controller');router[_0xa5c5('0xa')]('/',auth[_0xa5c5('0xb')](),controller[_0xa5c5('0xc')]);router[_0xa5c5('0xa')](_0xa5c5('0xd'),auth[_0xa5c5('0xb')](),controller[_0xa5c5('0xe')]);router[_0xa5c5('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa5c5('0xd'),auth[_0xa5c5('0xb')](),controller['update']);router['delete'](_0xa5c5('0xd'),auth[_0xa5c5('0xb')](),controller[_0xa5c5('0x10')]);module[_0xa5c5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index bc8d6bd..3627279 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 _0xa056=['variable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xa056,0x1d2));var _0x6a05=function(_0x4cba78,_0x4ba41e){_0x4cba78=_0x4cba78-0x0;var _0x9f8761=_0xa056[_0x4cba78];return _0x9f8761;};'use strict';var Sequelize=require(_0x6a05('0x0'));module[_0x6a05('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6a05('0x2'),'customVariable',_0x6a05('0x3'),_0x6a05('0x4')),'defaultValue':_0x6a05('0x5')},'content':{'type':Sequelize[_0x6a05('0x6')]},'key':{'type':Sequelize[_0x6a05('0x6')]},'keyType':{'type':Sequelize[_0x6a05('0x7')](_0x6a05('0x5'),_0x6a05('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x6a05('0x6')]},'idField':{'type':Sequelize[_0x6a05('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6a05('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a05('0x6')]}}; \ No newline at end of file +var _0xef2c=['STRING','customVariable','BOOLEAN','exports','ENUM','string','keyValue','picklist'];(function(_0x63d011,_0x541cec){var _0x167cb2=function(_0x2b76a7){while(--_0x2b76a7){_0x63d011['push'](_0x63d011['shift']());}};_0x167cb2(++_0x541cec);}(_0xef2c,0x1c3));var _0xcef2=function(_0x263b0e,_0xc6479f){_0x263b0e=_0x263b0e-0x0;var _0x113fee=_0xef2c[_0x263b0e];return _0x113fee;};'use strict';var Sequelize=require('sequelize');module[_0xcef2('0x0')]={'type':{'type':Sequelize[_0xcef2('0x1')](_0xcef2('0x2'),'variable','customVariable',_0xcef2('0x3'),_0xcef2('0x4')),'defaultValue':_0xcef2('0x2')},'content':{'type':Sequelize[_0xcef2('0x5')]},'key':{'type':Sequelize[_0xcef2('0x5')]},'keyType':{'type':Sequelize[_0xcef2('0x1')](_0xcef2('0x2'),'variable',_0xcef2('0x6'))},'keyContent':{'type':Sequelize[_0xcef2('0x5')]},'idField':{'type':Sequelize[_0xcef2('0x5')]},'nameField':{'type':Sequelize[_0xcef2('0x5')]},'customField':{'type':Sequelize[_0xcef2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcef2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index a29b9bb..ad1aff7 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 _0x6ec6=['filter','map','VIRTUAL','merge','includeAll','include','findAll','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','SugarcrmField','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick'];(function(_0x2bb1c2,_0x4471c9){var _0x468612=function(_0xc05f67){while(--_0xc05f67){_0x2bb1c2['push'](_0x2bb1c2['shift']());}};_0x468612(++_0x4471c9);}(_0x6ec6,0x189));var _0x66ec=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x6ec6[_0x43a1b8];return _0x324ecc;};'use strict';var emlformat=require(_0x66ec('0x0'));var rimraf=require(_0x66ec('0x1'));var zipdir=require(_0x66ec('0x2'));var jsonpatch=require(_0x66ec('0x3'));var rp=require(_0x66ec('0x4'));var moment=require(_0x66ec('0x5'));var BPromise=require(_0x66ec('0x6'));var Mustache=require(_0x66ec('0x7'));var util=require(_0x66ec('0x8'));var path=require(_0x66ec('0x9'));var sox=require(_0x66ec('0xa'));var csv=require(_0x66ec('0xb'));var ejs=require(_0x66ec('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66ec('0xd'));var squel=require(_0x66ec('0xe'));var crypto=require('crypto');var jsforce=require(_0x66ec('0xf'));var deskjs=require(_0x66ec('0x10'));var toCsv=require(_0x66ec('0xb'));var querystring=require(_0x66ec('0x11'));var Papa=require(_0x66ec('0x12'));var Redis=require(_0x66ec('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x66ec('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66ec('0x15'));var logger=require(_0x66ec('0x16'))(_0x66ec('0x17'));var utils=require(_0x66ec('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x66ec('0x19'));var db=require(_0x66ec('0x1a'))['db'];function respondWithStatusCode(_0x332a2e,_0x483524){_0x483524=_0x483524||0xcc;return function(_0x362474){if(_0x362474){return _0x332a2e[_0x66ec('0x1b')](_0x483524);}return _0x332a2e[_0x66ec('0x1c')](_0x483524)[_0x66ec('0x1d')]();};}function respondWithResult(_0x2c095b,_0x15e63a){_0x15e63a=_0x15e63a||0xc8;return function(_0x2dfde6){if(_0x2dfde6){return _0x2c095b['status'](_0x15e63a)[_0x66ec('0x1e')](_0x2dfde6);}};}function respondWithFilteredResult(_0x484d9f,_0x44c562){return function(_0xe6a86){if(_0xe6a86){var _0x1c18ba=typeof _0x44c562['offset']===_0x66ec('0x1f')&&typeof _0x44c562['limit']===_0x66ec('0x1f');var _0x2e15f4=_0xe6a86['count'];var _0x3aaa29=_0x1c18ba?0x0:_0x44c562[_0x66ec('0x20')];var _0x2c8f0f=_0x1c18ba?_0xe6a86[_0x66ec('0x21')]:_0x44c562[_0x66ec('0x20')]+_0x44c562['limit'];var _0x5c6da5;if(_0x2c8f0f>=_0x2e15f4){_0x2c8f0f=_0x2e15f4;_0x5c6da5=0xc8;}else{_0x5c6da5=0xce;}_0x484d9f[_0x66ec('0x1c')](_0x5c6da5);return _0x484d9f[_0x66ec('0x22')](_0x66ec('0x23'),_0x3aaa29+'-'+_0x2c8f0f+'/'+_0x2e15f4)[_0x66ec('0x1e')](_0xe6a86);}return null;};}function patchUpdates(_0x2b4c14){return function(_0x915006){try{jsonpatch[_0x66ec('0x24')](_0x915006,_0x2b4c14,!![]);}catch(_0x3868bd){return BPromise[_0x66ec('0x25')](_0x3868bd);}return _0x915006[_0x66ec('0x26')]();};}function saveUpdates(_0x26e238,_0x4852ab){return function(_0x5004dc){if(_0x5004dc){return _0x5004dc[_0x66ec('0x27')](_0x26e238)['then'](function(_0x12d62a){return _0x12d62a;});}return null;};}function removeEntity(_0x7bc600,_0x569a77){return function(_0xb49e9f){if(_0xb49e9f){return _0xb49e9f[_0x66ec('0x28')]()[_0x66ec('0x29')](function(){_0x7bc600[_0x66ec('0x1c')](0xcc)[_0x66ec('0x1d')]();});}};}function handleEntityNotFound(_0x2735d3,_0x54a522){return function(_0x15658b){if(!_0x15658b){_0x2735d3[_0x66ec('0x1b')](0x194);}return _0x15658b;};}function handleError(_0x548b5f,_0x431f45){_0x431f45=_0x431f45||0x1f4;return function(_0xdd067c){logger[_0x66ec('0x2a')](_0xdd067c[_0x66ec('0x2b')]);if(_0xdd067c[_0x66ec('0x2c')]){delete _0xdd067c[_0x66ec('0x2c')];}_0x548b5f[_0x66ec('0x1c')](_0x431f45)[_0x66ec('0x2d')](_0xdd067c);};}exports['index']=function(_0x22b2ff,_0xc10eb){var _0x1dded3={},_0x3ebdfb={},_0x47ff3d={'count':0x0,'rows':[]};var _0x1b09b0=_['map'](db[_0x66ec('0x2e')]['rawAttributes'],function(_0x1a2eb5){return{'name':_0x1a2eb5['fieldName'],'type':_0x1a2eb5[_0x66ec('0x2f')][_0x66ec('0x30')]};});_0x3ebdfb[_0x66ec('0x31')]=_['map'](_0x1b09b0,'name');_0x3ebdfb[_0x66ec('0x32')]=_[_0x66ec('0x33')](_0x22b2ff['query']);_0x3ebdfb[_0x66ec('0x34')]=_['intersection'](_0x3ebdfb[_0x66ec('0x31')],_0x3ebdfb['query']);_0x1dded3[_0x66ec('0x35')]=_[_0x66ec('0x36')](_0x3ebdfb[_0x66ec('0x31')],qs[_0x66ec('0x37')](_0x22b2ff['query'][_0x66ec('0x37')]));_0x1dded3[_0x66ec('0x35')]=_0x1dded3[_0x66ec('0x35')][_0x66ec('0x38')]?_0x1dded3[_0x66ec('0x35')]:_0x3ebdfb[_0x66ec('0x31')];if(!_0x22b2ff[_0x66ec('0x32')][_0x66ec('0x39')]('nolimit')){_0x1dded3[_0x66ec('0x3a')]=qs[_0x66ec('0x3a')](_0x22b2ff[_0x66ec('0x32')]['limit']);_0x1dded3[_0x66ec('0x20')]=qs[_0x66ec('0x20')](_0x22b2ff['query']['offset']);}_0x1dded3[_0x66ec('0x3b')]=qs[_0x66ec('0x3c')](_0x22b2ff['query'][_0x66ec('0x3c')]);_0x1dded3[_0x66ec('0x3d')]=qs[_0x66ec('0x34')](_[_0x66ec('0x3e')](_0x22b2ff[_0x66ec('0x32')],_0x3ebdfb[_0x66ec('0x34')]),_0x1b09b0);if(_0x22b2ff[_0x66ec('0x32')][_0x66ec('0x3f')]){_0x1dded3[_0x66ec('0x3d')]=_['merge'](_0x1dded3[_0x66ec('0x3d')],{'$or':_[_0x66ec('0x40')](_0x1b09b0,function(_0x536038){if(_0x536038[_0x66ec('0x2f')]!==_0x66ec('0x41')){var _0x12dbed={};_0x12dbed[_0x536038[_0x66ec('0x2c')]]={'$like':'%'+_0x22b2ff[_0x66ec('0x32')][_0x66ec('0x3f')]+'%'};return _0x12dbed;}})});}_0x1dded3=_[_0x66ec('0x42')]({},_0x1dded3,_0x22b2ff['options']);var _0x322946={'where':_0x1dded3[_0x66ec('0x3d')]};return db[_0x66ec('0x2e')][_0x66ec('0x21')](_0x322946)[_0x66ec('0x29')](function(_0x47a1bf){_0x47ff3d[_0x66ec('0x21')]=_0x47a1bf;if(_0x22b2ff[_0x66ec('0x32')][_0x66ec('0x43')]){_0x1dded3[_0x66ec('0x44')]=[{'all':!![]}];}return db['SugarcrmField'][_0x66ec('0x45')](_0x1dded3);})['then'](function(_0x10b8f6){_0x47ff3d['rows']=_0x10b8f6;return _0x47ff3d;})[_0x66ec('0x29')](respondWithFilteredResult(_0xc10eb,_0x1dded3))[_0x66ec('0x46')](handleError(_0xc10eb,null));};exports[_0x66ec('0x47')]=function(_0x43b263,_0x5549a9){var _0x45e574={'raw':!![],'where':{'id':_0x43b263['params']['id']}},_0x4e2553={};_0x4e2553[_0x66ec('0x31')]=_[_0x66ec('0x33')](db[_0x66ec('0x2e')]['rawAttributes']);_0x4e2553[_0x66ec('0x32')]=_[_0x66ec('0x33')](_0x43b263[_0x66ec('0x32')]);_0x4e2553[_0x66ec('0x34')]=_[_0x66ec('0x36')](_0x4e2553['model'],_0x4e2553[_0x66ec('0x32')]);_0x45e574[_0x66ec('0x35')]=_[_0x66ec('0x36')](_0x4e2553[_0x66ec('0x31')],qs[_0x66ec('0x37')](_0x43b263['query'][_0x66ec('0x37')]));_0x45e574[_0x66ec('0x35')]=_0x45e574[_0x66ec('0x35')][_0x66ec('0x38')]?_0x45e574[_0x66ec('0x35')]:_0x4e2553[_0x66ec('0x31')];if(_0x43b263[_0x66ec('0x32')][_0x66ec('0x43')]){_0x45e574[_0x66ec('0x44')]=[{'all':!![]}];}_0x45e574=_[_0x66ec('0x42')]({},_0x45e574,_0x43b263['options']);return db[_0x66ec('0x2e')][_0x66ec('0x48')](_0x45e574)[_0x66ec('0x29')](handleEntityNotFound(_0x5549a9,null))[_0x66ec('0x29')](respondWithResult(_0x5549a9,null))[_0x66ec('0x46')](handleError(_0x5549a9,null));};exports[_0x66ec('0x49')]=function(_0x1f1aff,_0x1ef772){return db['SugarcrmField'][_0x66ec('0x49')](_0x1f1aff['body'],{})['then'](respondWithResult(_0x1ef772,0xc9))[_0x66ec('0x46')](handleError(_0x1ef772,null));};exports[_0x66ec('0x27')]=function(_0x485294,_0x3aa98a){if(_0x485294[_0x66ec('0x4a')]['id']){delete _0x485294[_0x66ec('0x4a')]['id'];}return db[_0x66ec('0x2e')][_0x66ec('0x48')]({'where':{'id':_0x485294[_0x66ec('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3aa98a,null))['then'](saveUpdates(_0x485294[_0x66ec('0x4a')],null))[_0x66ec('0x29')](respondWithResult(_0x3aa98a,null))[_0x66ec('0x46')](handleError(_0x3aa98a,null));};exports[_0x66ec('0x28')]=function(_0x16a51a,_0x1a90a1){return db[_0x66ec('0x2e')][_0x66ec('0x48')]({'where':{'id':_0x16a51a['params']['id']}})[_0x66ec('0x29')](handleEntityNotFound(_0x1a90a1,null))[_0x66ec('0x29')](removeEntity(_0x1a90a1,null))[_0x66ec('0x46')](handleError(_0x1a90a1,null));}; \ No newline at end of file +var _0x9160=['rows','catch','show','find','create','body','params','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../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','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','fieldName','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll'];(function(_0xcbf451,_0x1e3a9a){var _0x49a88a=function(_0x5527dd){while(--_0x5527dd){_0xcbf451['push'](_0xcbf451['shift']());}};_0x49a88a(++_0x1e3a9a);}(_0x9160,0x97));var _0x0916=function(_0x376582,_0x5353d6){_0x376582=_0x376582-0x0;var _0x29f923=_0x9160[_0x376582];return _0x29f923;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0916('0x0'));var zipdir=require(_0x0916('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0916('0x2'));var moment=require(_0x0916('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0916('0x4'));var util=require(_0x0916('0x5'));var path=require(_0x0916('0x6'));var sox=require(_0x0916('0x7'));var csv=require('to-csv');var ejs=require(_0x0916('0x8'));var fs=require('fs');var fs_extra=require(_0x0916('0x9'));var _=require(_0x0916('0xa'));var squel=require('squel');var crypto=require(_0x0916('0xb'));var jsforce=require(_0x0916('0xc'));var deskjs=require(_0x0916('0xd'));var toCsv=require(_0x0916('0xe'));var querystring=require('querystring');var Papa=require(_0x0916('0xf'));var Redis=require(_0x0916('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0916('0x11'));var as=require(_0x0916('0x12'));var hardwareService=require(_0x0916('0x13'));var logger=require(_0x0916('0x14'))(_0x0916('0x15'));var utils=require(_0x0916('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0916('0x17'));var db=require(_0x0916('0x18'))['db'];function respondWithStatusCode(_0x1bda4a,_0x340944){_0x340944=_0x340944||0xcc;return function(_0x5c89ba){if(_0x5c89ba){return _0x1bda4a[_0x0916('0x19')](_0x340944);}return _0x1bda4a[_0x0916('0x1a')](_0x340944)['end']();};}function respondWithResult(_0x19e0a9,_0x523652){_0x523652=_0x523652||0xc8;return function(_0x4eb733){if(_0x4eb733){return _0x19e0a9[_0x0916('0x1a')](_0x523652)[_0x0916('0x1b')](_0x4eb733);}};}function respondWithFilteredResult(_0x25a49f,_0x33fcd7){return function(_0x2ecac6){if(_0x2ecac6){var _0xbf2b81=typeof _0x33fcd7[_0x0916('0x1c')]===_0x0916('0x1d')&&typeof _0x33fcd7[_0x0916('0x1e')]===_0x0916('0x1d');var _0x4fe8db=_0x2ecac6[_0x0916('0x1f')];var _0x1f91ea=_0xbf2b81?0x0:_0x33fcd7['offset'];var _0x45661b=_0xbf2b81?_0x2ecac6['count']:_0x33fcd7['offset']+_0x33fcd7[_0x0916('0x1e')];var _0x2a842d;if(_0x45661b>=_0x4fe8db){_0x45661b=_0x4fe8db;_0x2a842d=0xc8;}else{_0x2a842d=0xce;}_0x25a49f[_0x0916('0x1a')](_0x2a842d);return _0x25a49f['set']('Content-Range',_0x1f91ea+'-'+_0x45661b+'/'+_0x4fe8db)[_0x0916('0x1b')](_0x2ecac6);}return null;};}function patchUpdates(_0x188f7d){return function(_0x494df0){try{jsonpatch[_0x0916('0x20')](_0x494df0,_0x188f7d,!![]);}catch(_0x3acf17){return BPromise[_0x0916('0x21')](_0x3acf17);}return _0x494df0[_0x0916('0x22')]();};}function saveUpdates(_0x2410a4,_0x5e60e3){return function(_0x439e3a){if(_0x439e3a){return _0x439e3a[_0x0916('0x23')](_0x2410a4)[_0x0916('0x24')](function(_0x319be7){return _0x319be7;});}return null;};}function removeEntity(_0x5500a0,_0x59031d){return function(_0x5db9f3){if(_0x5db9f3){return _0x5db9f3[_0x0916('0x25')]()[_0x0916('0x24')](function(){_0x5500a0[_0x0916('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265d27,_0x53b06d){return function(_0x298a94){if(!_0x298a94){_0x265d27[_0x0916('0x19')](0x194);}return _0x298a94;};}function handleError(_0x3fa0da,_0x351ff0){_0x351ff0=_0x351ff0||0x1f4;return function(_0x4ab305){logger[_0x0916('0x26')](_0x4ab305[_0x0916('0x27')]);if(_0x4ab305[_0x0916('0x28')]){delete _0x4ab305[_0x0916('0x28')];}_0x3fa0da[_0x0916('0x1a')](_0x351ff0)[_0x0916('0x29')](_0x4ab305);};}exports[_0x0916('0x2a')]=function(_0x5ec151,_0x1bb078){var _0x439790={},_0x46155a={},_0x366f1f={'count':0x0,'rows':[]};var _0x3e30c3=_[_0x0916('0x2b')](db[_0x0916('0x2c')]['rawAttributes'],function(_0x494dca){return{'name':_0x494dca[_0x0916('0x2d')],'type':_0x494dca['type']['key']};});_0x46155a['model']=_[_0x0916('0x2b')](_0x3e30c3,'name');_0x46155a['query']=_[_0x0916('0x2e')](_0x5ec151['query']);_0x46155a[_0x0916('0x2f')]=_[_0x0916('0x30')](_0x46155a[_0x0916('0x31')],_0x46155a[_0x0916('0x32')]);_0x439790[_0x0916('0x33')]=_['intersection'](_0x46155a[_0x0916('0x31')],qs[_0x0916('0x34')](_0x5ec151[_0x0916('0x32')][_0x0916('0x34')]));_0x439790[_0x0916('0x33')]=_0x439790[_0x0916('0x33')][_0x0916('0x35')]?_0x439790[_0x0916('0x33')]:_0x46155a[_0x0916('0x31')];if(!_0x5ec151[_0x0916('0x32')]['hasOwnProperty'](_0x0916('0x36'))){_0x439790[_0x0916('0x1e')]=qs[_0x0916('0x1e')](_0x5ec151[_0x0916('0x32')][_0x0916('0x1e')]);_0x439790[_0x0916('0x1c')]=qs[_0x0916('0x1c')](_0x5ec151[_0x0916('0x32')][_0x0916('0x1c')]);}_0x439790[_0x0916('0x37')]=qs[_0x0916('0x38')](_0x5ec151[_0x0916('0x32')][_0x0916('0x38')]);_0x439790['where']=qs[_0x0916('0x2f')](_['pick'](_0x5ec151['query'],_0x46155a[_0x0916('0x2f')]),_0x3e30c3);if(_0x5ec151[_0x0916('0x32')][_0x0916('0x39')]){_0x439790[_0x0916('0x3a')]=_[_0x0916('0x3b')](_0x439790[_0x0916('0x3a')],{'$or':_[_0x0916('0x2b')](_0x3e30c3,function(_0x342a3d){if(_0x342a3d[_0x0916('0x3c')]!==_0x0916('0x3d')){var _0xfc28={};_0xfc28[_0x342a3d['name']]={'$like':'%'+_0x5ec151[_0x0916('0x32')][_0x0916('0x39')]+'%'};return _0xfc28;}})});}_0x439790=_[_0x0916('0x3b')]({},_0x439790,_0x5ec151[_0x0916('0x3e')]);var _0x13e085={'where':_0x439790['where']};return db[_0x0916('0x2c')][_0x0916('0x1f')](_0x13e085)['then'](function(_0x556c7b){_0x366f1f[_0x0916('0x1f')]=_0x556c7b;if(_0x5ec151[_0x0916('0x32')][_0x0916('0x3f')]){_0x439790['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x0916('0x40')](_0x439790);})['then'](function(_0x1f7eab){_0x366f1f[_0x0916('0x41')]=_0x1f7eab;return _0x366f1f;})[_0x0916('0x24')](respondWithFilteredResult(_0x1bb078,_0x439790))[_0x0916('0x42')](handleError(_0x1bb078,null));};exports[_0x0916('0x43')]=function(_0x393edb,_0x4ff58d){var _0x2bbb78={'raw':!![],'where':{'id':_0x393edb['params']['id']}},_0x34118b={};_0x34118b[_0x0916('0x31')]=_['keys'](db[_0x0916('0x2c')]['rawAttributes']);_0x34118b[_0x0916('0x32')]=_[_0x0916('0x2e')](_0x393edb['query']);_0x34118b[_0x0916('0x2f')]=_['intersection'](_0x34118b[_0x0916('0x31')],_0x34118b[_0x0916('0x32')]);_0x2bbb78[_0x0916('0x33')]=_[_0x0916('0x30')](_0x34118b['model'],qs[_0x0916('0x34')](_0x393edb[_0x0916('0x32')][_0x0916('0x34')]));_0x2bbb78[_0x0916('0x33')]=_0x2bbb78[_0x0916('0x33')][_0x0916('0x35')]?_0x2bbb78['attributes']:_0x34118b['model'];if(_0x393edb[_0x0916('0x32')][_0x0916('0x3f')]){_0x2bbb78['include']=[{'all':!![]}];}_0x2bbb78=_[_0x0916('0x3b')]({},_0x2bbb78,_0x393edb['options']);return db['SugarcrmField'][_0x0916('0x44')](_0x2bbb78)[_0x0916('0x24')](handleEntityNotFound(_0x4ff58d,null))[_0x0916('0x24')](respondWithResult(_0x4ff58d,null))[_0x0916('0x42')](handleError(_0x4ff58d,null));};exports[_0x0916('0x45')]=function(_0x456997,_0x3b0121){return db['SugarcrmField'][_0x0916('0x45')](_0x456997[_0x0916('0x46')],{})[_0x0916('0x24')](respondWithResult(_0x3b0121,0xc9))['catch'](handleError(_0x3b0121,null));};exports['update']=function(_0x11704b,_0x43d4f6){if(_0x11704b[_0x0916('0x46')]['id']){delete _0x11704b['body']['id'];}return db[_0x0916('0x2c')][_0x0916('0x44')]({'where':{'id':_0x11704b[_0x0916('0x47')]['id']}})[_0x0916('0x24')](handleEntityNotFound(_0x43d4f6,null))[_0x0916('0x24')](saveUpdates(_0x11704b['body'],null))[_0x0916('0x24')](respondWithResult(_0x43d4f6,null))['catch'](handleError(_0x43d4f6,null));};exports[_0x0916('0x25')]=function(_0x5d9616,_0x44c668){return db[_0x0916('0x2c')]['find']({'where':{'id':_0x5d9616['params']['id']}})['then'](handleEntityNotFound(_0x44c668,null))[_0x0916('0x24')](removeEntity(_0x44c668,null))[_0x0916('0x42')](handleError(_0x44c668,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 9a9cd54..75c2d16 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 _0xb111=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','../../config/logger','api'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb111,0xb4));var _0x1b11=function(_0xc376e1,_0x1a2b83){_0xc376e1=_0xc376e1-0x0;var _0x63e01c=_0xb111[_0xc376e1];return _0x63e01c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b11('0x0'))(_0x1b11('0x1'));var moment=require(_0x1b11('0x2'));var BPromise=require(_0x1b11('0x3'));var rp=require(_0x1b11('0x4'));var fs=require('fs');var path=require(_0x1b11('0x5'));var rimraf=require(_0x1b11('0x6'));var config=require(_0x1b11('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x2c8314,_0x3f552c){return _0x2c8314[_0x1b11('0x8')](_0x1b11('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x1b11('0xa'),'fields':[_0x1b11('0xb'),_0x1b11('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaab8=['api','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xaab8,0x1b0));var _0x8aab=function(_0x3ec747,_0x948158){_0x3ec747=_0x3ec747-0x0;var _0x363a2c=_0xaab8[_0x3ec747];return _0x363a2c;};'use strict';var _=require(_0x8aab('0x0'));var util=require(_0x8aab('0x1'));var logger=require(_0x8aab('0x2'))(_0x8aab('0x3'));var moment=require('moment');var BPromise=require(_0x8aab('0x4'));var rp=require(_0x8aab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8aab('0x6'));var config=require(_0x8aab('0x7'));var attributes=require(_0x8aab('0x8'));module[_0x8aab('0x9')]=function(_0x35ea3b,_0x441ce7){return _0x35ea3b[_0x8aab('0xa')](_0x8aab('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x8aab('0xc'),'fields':[_0x8aab('0xd'),_0x8aab('0xe')],'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 bd39e8c..3a1ca15 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 _0x4272=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x4272,0xc1));var _0x2427=function(_0x509017,_0x484c73){_0x509017=_0x509017-0x0;var _0x4abfd7=_0x4272[_0x509017];return _0x4abfd7;};'use strict';var _=require(_0x2427('0x0'));var util=require(_0x2427('0x1'));var moment=require(_0x2427('0x2'));var BPromise=require(_0x2427('0x3'));var rs=require(_0x2427('0x4'));var fs=require('fs');var Redis=require(_0x2427('0x5'));var db=require(_0x2427('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2427('0x7'));var config=require(_0x2427('0x8'));var jayson=require(_0x2427('0x9'));var client=jayson[_0x2427('0xa')][_0x2427('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x455798,_0x408071,_0x149694){return new BPromise(function(_0x1da27d,_0x48151e){return client[_0x2427('0xc')](_0x455798,_0x149694)[_0x2427('0xd')](function(_0x482b7f){logger[_0x2427('0xe')](_0x2427('0xf'),_0x408071,_0x2427('0x10'));logger[_0x2427('0x11')](_0x2427('0x12'),_0x408071,_0x2427('0x10'),JSON['stringify'](_0x482b7f));if(_0x482b7f[_0x2427('0x13')]){if(_0x482b7f['error'][_0x2427('0x14')]===0x1f4){logger[_0x2427('0x13')](_0x2427('0xf'),_0x408071,_0x482b7f['error'][_0x2427('0x15')]);return _0x48151e(_0x482b7f['error'][_0x2427('0x15')]);}logger['error'](_0x2427('0xf'),_0x408071,_0x482b7f['error'][_0x2427('0x15')]);return _0x1da27d(_0x482b7f['error'][_0x2427('0x15')]);}else{logger[_0x2427('0xe')](_0x2427('0xf'),_0x408071,_0x2427('0x10'));_0x1da27d(_0x482b7f[_0x2427('0x16')][_0x2427('0x15')]);}})[_0x2427('0x17')](function(_0x241275){logger['error'](_0x2427('0xf'),_0x408071,_0x241275);_0x48151e(_0x241275);});});} \ No newline at end of file +var _0x9ea4=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','util','moment'];(function(_0x5c62c6,_0x903ff1){var _0x5df024=function(_0x56dc6f){while(--_0x56dc6f){_0x5c62c6['push'](_0x5c62c6['shift']());}};_0x5df024(++_0x903ff1);}(_0x9ea4,0x17a));var _0x49ea=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9ea4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x49ea('0x0'));var moment=require(_0x49ea('0x1'));var BPromise=require(_0x49ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49ea('0x3'));var db=require(_0x49ea('0x4'))['db'];var utils=require(_0x49ea('0x5'));var logger=require(_0x49ea('0x6'))(_0x49ea('0x7'));var config=require(_0x49ea('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fbea0,_0x9114ab,_0x53c277){return new BPromise(function(_0x2053d0,_0x5c1acf){return client[_0x49ea('0x9')](_0x4fbea0,_0x53c277)[_0x49ea('0xa')](function(_0x67ee71){logger[_0x49ea('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x9114ab,_0x49ea('0xc'));logger[_0x49ea('0xd')](_0x49ea('0xe'),_0x9114ab,_0x49ea('0xc'),JSON['stringify'](_0x67ee71));if(_0x67ee71[_0x49ea('0xf')]){if(_0x67ee71[_0x49ea('0xf')][_0x49ea('0x10')]===0x1f4){logger['error'](_0x49ea('0x11'),_0x9114ab,_0x67ee71[_0x49ea('0xf')][_0x49ea('0x12')]);return _0x5c1acf(_0x67ee71[_0x49ea('0xf')][_0x49ea('0x12')]);}logger[_0x49ea('0xf')](_0x49ea('0x11'),_0x9114ab,_0x67ee71[_0x49ea('0xf')][_0x49ea('0x12')]);return _0x2053d0(_0x67ee71[_0x49ea('0xf')][_0x49ea('0x12')]);}else{logger['info'](_0x49ea('0x11'),_0x9114ab,'request\x20sent');_0x2053d0(_0x67ee71['result'][_0x49ea('0x12')]);}})['catch'](function(_0x166677){logger[_0x49ea('0xf')](_0x49ea('0x11'),_0x9114ab,_0x166677);_0x5c1acf(_0x166677);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 7d4b56c..43e966d 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 _0x884d=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x884d,0x1b2));var _0xd884=function(_0x46d568,_0x4fcab6){_0x46d568=_0x46d568-0x0;var _0x8c2b7e=_0x884d[_0x46d568];return _0x8c2b7e;};'use strict';var multer=require(_0xd884('0x0'));var util=require(_0xd884('0x1'));var path=require(_0xd884('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd884('0x3')]();var fs_extra=require(_0xd884('0x4'));var auth=require(_0xd884('0x5'));var interaction=require(_0xd884('0x6'));var config=require(_0xd884('0x7'));var controller=require(_0xd884('0x8'));router[_0xd884('0x9')]('/',auth[_0xd884('0xa')](),controller['index']);router[_0xd884('0x9')](_0xd884('0xb'),auth[_0xd884('0xa')](),controller[_0xd884('0xc')]);router['get'](_0xd884('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd884('0x9')](_0xd884('0xe'),auth['isAuthenticated'](),controller[_0xd884('0xf')]);router[_0xd884('0x10')]('/',auth[_0xd884('0xa')](),controller[_0xd884('0x11')]);router[_0xd884('0x10')](_0xd884('0xd'),auth[_0xd884('0xa')](),controller[_0xd884('0x12')]);router['put'](_0xd884('0xb'),auth[_0xd884('0xa')](),controller[_0xd884('0x13')]);router['delete']('/:id',auth[_0xd884('0xa')](),controller[_0xd884('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2da1=['delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','update'];(function(_0x136a01,_0x3e0f10){var _0x39ccee=function(_0x1fa530){while(--_0x1fa530){_0x136a01['push'](_0x136a01['shift']());}};_0x39ccee(++_0x3e0f10);}(_0x2da1,0xca));var _0x12da=function(_0x45862f,_0xf5f0a6){_0x45862f=_0x45862f-0x0;var _0x35b20b=_0x2da1[_0x45862f];return _0x35b20b;};'use strict';var multer=require(_0x12da('0x0'));var util=require(_0x12da('0x1'));var path=require('path');var timeout=require(_0x12da('0x2'));var express=require('express');var router=express[_0x12da('0x3')]();var fs_extra=require(_0x12da('0x4'));var auth=require(_0x12da('0x5'));var interaction=require(_0x12da('0x6'));var config=require('../../config/environment');var controller=require(_0x12da('0x7'));router[_0x12da('0x8')]('/',auth[_0x12da('0x9')](),controller[_0x12da('0xa')]);router[_0x12da('0x8')](_0x12da('0xb'),auth[_0x12da('0x9')](),controller['show']);router[_0x12da('0x8')](_0x12da('0xc'),auth[_0x12da('0x9')](),controller['getConfigurations']);router[_0x12da('0x8')](_0x12da('0xd'),auth[_0x12da('0x9')](),controller[_0x12da('0xe')]);router[_0x12da('0xf')]('/',auth['isAuthenticated'](),controller[_0x12da('0x10')]);router['post'](_0x12da('0xc'),auth[_0x12da('0x9')](),controller['addConfiguration']);router['put'](_0x12da('0xb'),auth['isAuthenticated'](),controller[_0x12da('0x11')]);router[_0x12da('0x12')](_0x12da('0xb'),auth[_0x12da('0x9')](),controller['destroy']);module[_0x12da('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 3bbb1e0..e198cfb 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 _0xdf34=['exports','STRING','HelpDesk','sequelize'];(function(_0x183a81,_0x53ccf0){var _0x477568=function(_0x3ef8d0){while(--_0x3ef8d0){_0x183a81['push'](_0x183a81['shift']());}};_0x477568(++_0x53ccf0);}(_0xdf34,0xf3));var _0x4df3=function(_0xf592b5,_0x218a78){_0xf592b5=_0xf592b5-0x0;var _0x43fd4a=_0xdf34[_0xf592b5];return _0x43fd4a;};'use strict';var Sequelize=require(_0x4df3('0x0'));module[_0x4df3('0x1')]={'name':{'type':Sequelize[_0x4df3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4df3('0x2')]},'username':{'type':Sequelize[_0x4df3('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4df3('0x3')},'remoteUri':{'type':Sequelize[_0x4df3('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4df3('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4df3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4390=['sequelize','exports','STRING','HelpDesk'];(function(_0x86d172,_0x13a4d9){var _0x1f163b=function(_0x2e38c4){while(--_0x2e38c4){_0x86d172['push'](_0x86d172['shift']());}};_0x1f163b(++_0x13a4d9);}(_0x4390,0x180));var _0x0439=function(_0x561026,_0x3195dc){_0x561026=_0x561026-0x0;var _0x4da52d=_0x4390[_0x561026];return _0x4da52d;};'use strict';var Sequelize=require(_0x0439('0x0'));module[_0x0439('0x1')]={'name':{'type':Sequelize[_0x0439('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0439('0x2')]},'username':{'type':Sequelize[_0x0439('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0439('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0439('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0439('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 68900f7..7899b64 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 _0x796d=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','pick','filter','merge','type','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','findOne','VtigerConfiguration','sort','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','format','%s/webservice.php','getchallenge','success','POST','login','result','GET','describe','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus'];(function(_0x13f1b8,_0xa90172){var _0x3bb9cd=function(_0x5326d7){while(--_0x5326d7){_0x13f1b8['push'](_0x13f1b8['shift']());}};_0x3bb9cd(++_0xa90172);}(_0x796d,0x148));var _0xd796=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x796d[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0xd796('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd796('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd796('0x2'));var Mustache=require(_0xd796('0x3'));var util=require(_0xd796('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd796('0x5'));var ejs=require(_0xd796('0x6'));var fs=require('fs');var fs_extra=require(_0xd796('0x7'));var _=require(_0xd796('0x8'));var squel=require(_0xd796('0x9'));var crypto=require(_0xd796('0xa'));var jsforce=require(_0xd796('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd796('0x5'));var querystring=require('querystring');var Papa=require(_0xd796('0xc'));var Redis=require(_0xd796('0xd'));var authService=require(_0xd796('0xe'));var qs=require(_0xd796('0xf'));var as=require(_0xd796('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd796('0x11'));var utils=require(_0xd796('0x12'));var config=require(_0xd796('0x13'));var licenseUtil=require(_0xd796('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd796('0x15'));function respondWithStatusCode(_0x51b98c,_0x29f42b){_0x29f42b=_0x29f42b||0xcc;return function(_0x3dae85){if(_0x3dae85){return _0x51b98c[_0xd796('0x16')](_0x29f42b);}return _0x51b98c[_0xd796('0x17')](_0x29f42b)[_0xd796('0x18')]();};}function respondWithResult(_0x1762de,_0xb3c0c4){_0xb3c0c4=_0xb3c0c4||0xc8;return function(_0x5c3090){if(_0x5c3090){return _0x1762de[_0xd796('0x17')](_0xb3c0c4)[_0xd796('0x19')](_0x5c3090);}};}function respondWithFilteredResult(_0x5b0a12,_0x5a5d4f){return function(_0x4a1315){if(_0x4a1315){var _0x583cf2=typeof _0x5a5d4f['offset']===_0xd796('0x1a')&&typeof _0x5a5d4f[_0xd796('0x1b')]===_0xd796('0x1a');var _0x2cb332=_0x4a1315[_0xd796('0x1c')];var _0x47a38a=_0x583cf2?0x0:_0x5a5d4f[_0xd796('0x1d')];var _0x3b6468=_0x583cf2?_0x4a1315[_0xd796('0x1c')]:_0x5a5d4f[_0xd796('0x1d')]+_0x5a5d4f['limit'];var _0x336eda;if(_0x3b6468>=_0x2cb332){_0x3b6468=_0x2cb332;_0x336eda=0xc8;}else{_0x336eda=0xce;}_0x5b0a12[_0xd796('0x17')](_0x336eda);return _0x5b0a12[_0xd796('0x1e')](_0xd796('0x1f'),_0x47a38a+'-'+_0x3b6468+'/'+_0x2cb332)[_0xd796('0x19')](_0x4a1315);}return null;};}function patchUpdates(_0x4f94ee){return function(_0x18b10a){try{jsonpatch[_0xd796('0x20')](_0x18b10a,_0x4f94ee,!![]);}catch(_0x2436c3){return BPromise[_0xd796('0x21')](_0x2436c3);}return _0x18b10a['save']();};}function saveUpdates(_0x349f96,_0x22ba91){return function(_0x5a769c){if(_0x5a769c){return _0x5a769c[_0xd796('0x22')](_0x349f96)[_0xd796('0x23')](function(_0x57ca8b){return _0x57ca8b;});}return null;};}function removeEntity(_0x52df3b,_0x62a05f){return function(_0x5502c8){if(_0x5502c8){return _0x5502c8[_0xd796('0x24')]()[_0xd796('0x23')](function(){_0x52df3b[_0xd796('0x17')](0xcc)[_0xd796('0x18')]();});}};}function handleEntityNotFound(_0xba05b2,_0x117a4f){return function(_0x520519){if(!_0x520519){_0xba05b2[_0xd796('0x16')](0x194);}return _0x520519;};}function handleError(_0x35dcd4,_0x3030db){_0x3030db=_0x3030db||0x1f4;return function(_0x65c7eb){logger['error'](_0x65c7eb[_0xd796('0x25')]);if(_0x65c7eb['name']){delete _0x65c7eb[_0xd796('0x26')];}_0x35dcd4['status'](_0x3030db)[_0xd796('0x27')](_0x65c7eb);};}exports[_0xd796('0x28')]=function(_0x3e29f1,_0x6107b2){var _0x5b1cfb={},_0x1cd46b={},_0x23edd3={'count':0x0,'rows':[]};var _0x38047f=_[_0xd796('0x29')](db[_0xd796('0x2a')][_0xd796('0x2b')],function(_0x12d059){return{'name':_0x12d059['fieldName'],'type':_0x12d059['type'][_0xd796('0x2c')]};});_0x1cd46b['model']=_[_0xd796('0x29')](_0x38047f,_0xd796('0x26'));_0x1cd46b[_0xd796('0x2d')]=_[_0xd796('0x2e')](_0x3e29f1[_0xd796('0x2d')]);_0x1cd46b[_0xd796('0x2f')]=_[_0xd796('0x30')](_0x1cd46b[_0xd796('0x31')],_0x1cd46b['query']);_0x5b1cfb[_0xd796('0x32')]=_[_0xd796('0x30')](_0x1cd46b['model'],qs['fields'](_0x3e29f1[_0xd796('0x2d')][_0xd796('0x33')]));_0x5b1cfb[_0xd796('0x32')]=_0x5b1cfb[_0xd796('0x32')][_0xd796('0x34')]?_0x5b1cfb[_0xd796('0x32')]:_0x1cd46b['model'];if(!_0x3e29f1[_0xd796('0x2d')][_0xd796('0x35')]('nolimit')){_0x5b1cfb['limit']=qs[_0xd796('0x1b')](_0x3e29f1[_0xd796('0x2d')]['limit']);_0x5b1cfb[_0xd796('0x1d')]=qs[_0xd796('0x1d')](_0x3e29f1[_0xd796('0x2d')][_0xd796('0x1d')]);}_0x5b1cfb[_0xd796('0x36')]=qs['sort'](_0x3e29f1[_0xd796('0x2d')]['sort']);_0x5b1cfb['where']=qs[_0xd796('0x2f')](_[_0xd796('0x37')](_0x3e29f1[_0xd796('0x2d')],_0x1cd46b['filters']),_0x38047f);if(_0x3e29f1[_0xd796('0x2d')][_0xd796('0x38')]){_0x5b1cfb['where']=_[_0xd796('0x39')](_0x5b1cfb['where'],{'$or':_[_0xd796('0x29')](_0x38047f,function(_0x17b6dd){if(_0x17b6dd[_0xd796('0x3a')]!==_0xd796('0x3b')){var _0x7f9c2={};_0x7f9c2[_0x17b6dd[_0xd796('0x26')]]={'$like':'%'+_0x3e29f1['query'][_0xd796('0x38')]+'%'};return _0x7f9c2;}})});}_0x5b1cfb=_[_0xd796('0x39')]({},_0x5b1cfb,_0x3e29f1['options']);var _0x3e3bd9={'where':_0x5b1cfb[_0xd796('0x3c')]};return db[_0xd796('0x2a')][_0xd796('0x1c')](_0x3e3bd9)[_0xd796('0x23')](function(_0x38c11d){_0x23edd3[_0xd796('0x1c')]=_0x38c11d;if(_0x3e29f1['query'][_0xd796('0x3d')]){_0x5b1cfb[_0xd796('0x3e')]=[{'all':!![]}];}return db[_0xd796('0x2a')][_0xd796('0x3f')](_0x5b1cfb);})['then'](function(_0x2218a1){_0x23edd3[_0xd796('0x40')]=_0x2218a1;return _0x23edd3;})['then'](respondWithFilteredResult(_0x6107b2,_0x5b1cfb))[_0xd796('0x41')](handleError(_0x6107b2,null));};exports[_0xd796('0x42')]=function(_0x128286,_0x2fccd2){var _0x3d1b3c={'raw':![],'where':{'id':_0x128286[_0xd796('0x43')]['id']}},_0x39148c={};_0x39148c[_0xd796('0x31')]=_[_0xd796('0x2e')](db[_0xd796('0x2a')][_0xd796('0x2b')]);_0x39148c['query']=_[_0xd796('0x2e')](_0x128286[_0xd796('0x2d')]);_0x39148c[_0xd796('0x2f')]=_[_0xd796('0x30')](_0x39148c[_0xd796('0x31')],_0x39148c[_0xd796('0x2d')]);_0x3d1b3c[_0xd796('0x32')]=_[_0xd796('0x30')](_0x39148c['model'],qs[_0xd796('0x33')](_0x128286['query'][_0xd796('0x33')]));_0x3d1b3c['attributes']=_0x3d1b3c[_0xd796('0x32')][_0xd796('0x34')]?_0x3d1b3c[_0xd796('0x32')]:_0x39148c[_0xd796('0x31')];if(_0x128286[_0xd796('0x2d')][_0xd796('0x3d')]){_0x3d1b3c[_0xd796('0x3e')]=[{'all':!![]}];}_0x3d1b3c=_[_0xd796('0x39')]({},_0x3d1b3c,_0x128286[_0xd796('0x44')]);return db['VtigerAccount'][_0xd796('0x45')](_0x3d1b3c)[_0xd796('0x23')](handleEntityNotFound(_0x2fccd2,null))[_0xd796('0x23')](respondWithResult(_0x2fccd2,null))['catch'](handleError(_0x2fccd2,null));};exports['create']=function(_0x1e8991,_0x1744eb){return db['VtigerAccount'][_0xd796('0x46')](_0x1e8991[_0xd796('0x47')],{})[_0xd796('0x23')](respondWithResult(_0x1744eb,0xc9))['catch'](handleError(_0x1744eb,null));};exports['update']=function(_0x39947d,_0x488934){if(_0x39947d[_0xd796('0x47')]['id']){delete _0x39947d[_0xd796('0x47')]['id'];}return db[_0xd796('0x2a')]['find']({'where':{'id':_0x39947d['params']['id']}})[_0xd796('0x23')](handleEntityNotFound(_0x488934,null))[_0xd796('0x23')](saveUpdates(_0x39947d['body'],null))['then'](respondWithResult(_0x488934,null))[_0xd796('0x41')](handleError(_0x488934,null));};exports['destroy']=function(_0x27ff74,_0x11faec){return db[_0xd796('0x2a')][_0xd796('0x45')]({'where':{'id':_0x27ff74[_0xd796('0x43')]['id']}})['then'](handleEntityNotFound(_0x11faec,null))[_0xd796('0x23')](removeEntity(_0x11faec,null))['catch'](handleError(_0x11faec,null));};exports['getConfigurations']=function(_0x426679,_0x58c08a,_0x484b10){var _0x2df234={};var _0xc30ab4={};var _0x43b333;var _0x9e5f2c;return db[_0xd796('0x2a')][_0xd796('0x48')]({'where':{'id':_0x426679[_0xd796('0x43')]['id']}})[_0xd796('0x23')](handleEntityNotFound(_0x58c08a,null))[_0xd796('0x23')](function(_0x295204){if(_0x295204){_0x43b333=_0x295204;_0xc30ab4[_0xd796('0x31')]=_['keys'](db[_0xd796('0x49')][_0xd796('0x2b')]);_0xc30ab4[_0xd796('0x2d')]=_[_0xd796('0x2e')](_0x426679[_0xd796('0x2d')]);_0xc30ab4['filters']=_[_0xd796('0x30')](_0xc30ab4[_0xd796('0x31')],_0xc30ab4[_0xd796('0x2d')]);_0x2df234[_0xd796('0x32')]=_['intersection'](_0xc30ab4[_0xd796('0x31')],qs[_0xd796('0x33')](_0x426679[_0xd796('0x2d')][_0xd796('0x33')]));_0x2df234[_0xd796('0x32')]=_0x2df234[_0xd796('0x32')][_0xd796('0x34')]?_0x2df234[_0xd796('0x32')]:_0xc30ab4[_0xd796('0x31')];_0x2df234[_0xd796('0x36')]=qs[_0xd796('0x4a')](_0x426679[_0xd796('0x2d')][_0xd796('0x4a')]);_0x2df234[_0xd796('0x3c')]=qs[_0xd796('0x2f')](_[_0xd796('0x37')](_0x426679['query'],_0xc30ab4[_0xd796('0x2f')]));if(_0x426679[_0xd796('0x2d')]['filter']){_0x2df234[_0xd796('0x3c')]=_['merge'](_0x2df234[_0xd796('0x3c')],{'$or':_[_0xd796('0x29')](_0x2df234[_0xd796('0x32')],function(_0x40fd3b){var _0x4d6b37={};_0x4d6b37[_0x40fd3b]={'$like':'%'+_0x426679[_0xd796('0x2d')][_0xd796('0x38')]+'%'};return _0x4d6b37;})});}_0x2df234=_[_0xd796('0x39')]({},_0x2df234,_0x426679[_0xd796('0x44')]);return _0x43b333[_0xd796('0x4b')](_0x2df234);}})['then'](function(_0x532fb0){if(_0x532fb0){_0x9e5f2c=_0x532fb0['length'];if(!_0x426679[_0xd796('0x2d')][_0xd796('0x35')]('nolimit')){_0x2df234[_0xd796('0x1b')]=qs['limit'](_0x426679[_0xd796('0x2d')][_0xd796('0x1b')]);_0x2df234[_0xd796('0x1d')]=qs[_0xd796('0x1d')](_0x426679['query'][_0xd796('0x1d')]);}return _0x43b333[_0xd796('0x4b')](_0x2df234);}})[_0xd796('0x23')](function(_0x1d7146){if(_0x1d7146){return _0x1d7146?{'count':_0x9e5f2c,'rows':_0x1d7146}:null;}})[_0xd796('0x23')](respondWithResult(_0x58c08a,null))[_0xd796('0x41')](handleError(_0x58c08a,null));};exports['addConfiguration']=function(_0x27a431,_0x4ed672,_0x7e9aab){if(_0x27a431['body']['id']){delete _0x27a431[_0xd796('0x47')]['id'];}return db[_0xd796('0x2a')]['findOne']({'where':{'id':_0x27a431[_0xd796('0x43')]['id']}})[_0xd796('0x23')](handleEntityNotFound(_0x4ed672,null))[_0xd796('0x23')](function(_0x44bcfc){if(_0x44bcfc){_0x27a431['body'][_0xd796('0x4c')]=_0x44bcfc['id'];_0x27a431[_0xd796('0x47')][_0xd796('0x4d')]=integrations[_0xd796('0x4e')](_0x27a431[_0xd796('0x47')][_0xd796('0x4f')],_0x27a431['body'][_0xd796('0x3a')]);_0x27a431[_0xd796('0x47')][_0xd796('0x50')]=integrations[_0xd796('0x51')](_0x27a431[_0xd796('0x47')]['channel'],_0x27a431[_0xd796('0x47')][_0xd796('0x3a')]);return db[_0xd796('0x49')][_0xd796('0x46')](_0x27a431[_0xd796('0x47')],{'include':[{'model':db[_0xd796('0x52')],'as':_0xd796('0x4d')},{'model':db[_0xd796('0x52')],'as':'Descriptions'}]});}return null;})[_0xd796('0x23')](respondWithResult(_0x4ed672,null))[_0xd796('0x41')](handleError(_0x4ed672,null));};var md5=require(_0xd796('0x53'));exports[_0xd796('0x54')]=function(_0x49d167,_0x24dfb7,_0xb77b50){var _0x542925=null;var _0x298e67=null;var _0x2747f1=null;var _0x3a7494=null;var _0x8152b3='';return db[_0xd796('0x2a')]['findOne']({'where':{'id':_0x49d167[_0xd796('0x43')]['id']},'attributes':['id',_0xd796('0x26'),_0xd796('0x55'),_0xd796('0x56'),_0xd796('0x57'),_0xd796('0x58'),'serverUrl',_0xd796('0x59')]})['then'](handleEntityNotFound(_0x24dfb7,null))[_0xd796('0x23')](function(_0x10bf3a){if(_0x10bf3a){_0x542925=_0x10bf3a['username'];_0x298e67=_0x10bf3a[_0xd796('0x59')];_0x2747f1=_0x10bf3a[_0xd796('0x57')];_0x8152b3=_0x10bf3a[_0xd796('0x58')];var _0x4f62af=_0x8152b3[_0xd796('0x5a')](-0x1);if(_0x4f62af==='/'){_0x8152b3=_0x8152b3[_0xd796('0x5b')](0x0,_0x8152b3['lastIndexOf'](_0x4f62af));}_0x3a7494=util[_0xd796('0x5c')](_0xd796('0x5d'),_0x8152b3);var _0x287cdb={'method':'GET','uri':_0x3a7494,'qs':{'operation':_0xd796('0x5e'),'username':_0x10bf3a['username']},'json':!![]};return rp(_0x287cdb);}})[_0xd796('0x23')](function(_0x33a72d){if(_0x33a72d[_0xd796('0x5f')]){var _0x15f035={'method':_0xd796('0x60'),'uri':_0x3a7494,'form':{'operation':_0xd796('0x61'),'username':_0x542925,'accessKey':md5(_0x33a72d[_0xd796('0x62')]['token']+_0x298e67)},'json':!![]};return rp(_0x15f035);}})[_0xd796('0x23')](function(_0x526971){if(_0x526971['success']){var _0x4d8e57={'method':_0xd796('0x63'),'uri':_0x3a7494,'qs':{'operation':_0xd796('0x64'),'username':_0x542925,'sessionName':_0x526971[_0xd796('0x62')]['sessionName'],'elementType':_0x2747f1},'json':!![]};return rp(_0x4d8e57);}})[_0xd796('0x23')](function(_0x5e5939){if(_0x5e5939[_0xd796('0x5f')]){var _0x1f02ed=[_0xd796('0x65'),'reference',_0xd796('0x66')];_[_0xd796('0x67')](_0x5e5939[_0xd796('0x62')][_0xd796('0x33')],function(_0x345bd8){return _0x1f02ed[_0xd796('0x68')](_0x345bd8[_0xd796('0x3a')]['name']);});_[_0xd796('0x67')](_0x5e5939['result']['fields'],function(_0x7c0cb8){return _0x7c0cb8[_0xd796('0x69')]===_0xd796('0x6a');});return{'count':_0x5e5939['result'][_0xd796('0x33')][_0xd796('0x34')],'rows':_[_0xd796('0x29')](_0x5e5939[_0xd796('0x62')][_0xd796('0x33')],function(_0x4800f1){return{'id':_0x4800f1[_0xd796('0x26')],'name':_0x4800f1[_0xd796('0x6b')],'custom':_[_0xd796('0x6c')](_0x4800f1['name'],_0xd796('0x6d'))?!![]:![],'options':_0x4800f1[_0xd796('0x3a')][_0xd796('0x26')]===_0xd796('0x6e')&&_0x4800f1[_0xd796('0x3a')][_0xd796('0x6f')][_0xd796('0x34')]>0x0?_['map'](_0x4800f1[_0xd796('0x3a')][_0xd796('0x6f')],function(_0x2ca668){return{'name':_0x2ca668['label'],'value':_0x2ca668[_0xd796('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x24dfb7,null))[_0xd796('0x41')](function(_0x59139c){console[_0xd796('0x71')]('vTiger\x20error:\x20'+_0x59139c);var _0x1a8b23=_0x49d167[_0xd796('0x2d')][_0xd796('0x72')]?0x1f4:_0x59139c['statusCode']||0x1f4;logger[_0xd796('0x73')](_0xd796('0x74'),_0xd796('0x54'),_0x1a8b23,JSON['stringify'](_0x59139c));delete _0x59139c[_0xd796('0x26')];if(_0x1a8b23===0x191){_0x1a8b23=0x190;}_0x24dfb7['status'](_0x1a8b23)[_0xd796('0x27')](_0x49d167['query'][_0xd796('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x59139c['statusCode']}:_0x59139c);});}; \ No newline at end of file +var _0xc02c=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','VtigerAccount','rawAttributes','type','key','keys','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','update','body','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','reference','owner','includes','remove','editable','false','startsWith','cf_','picklistValues','label','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis'];(function(_0x459c09,_0x596ed4){var _0x2aee20=function(_0x113d25){while(--_0x113d25){_0x459c09['push'](_0x459c09['shift']());}};_0x2aee20(++_0x596ed4);}(_0xc02c,0x67));var _0xcc02=function(_0x577acd,_0x2dddb2){_0x577acd=_0x577acd-0x0;var _0x2bfd74=_0xc02c[_0x577acd];return _0x2bfd74;};'use strict';var emlformat=require(_0xcc02('0x0'));var rimraf=require(_0xcc02('0x1'));var zipdir=require(_0xcc02('0x2'));var jsonpatch=require(_0xcc02('0x3'));var rp=require(_0xcc02('0x4'));var moment=require('moment');var BPromise=require(_0xcc02('0x5'));var Mustache=require(_0xcc02('0x6'));var util=require(_0xcc02('0x7'));var path=require(_0xcc02('0x8'));var sox=require(_0xcc02('0x9'));var csv=require(_0xcc02('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc02('0xb'));var _=require(_0xcc02('0xc'));var squel=require(_0xcc02('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc02('0xe'));var toCsv=require(_0xcc02('0xa'));var querystring=require(_0xcc02('0xf'));var Papa=require(_0xcc02('0x10'));var Redis=require(_0xcc02('0x11'));var authService=require(_0xcc02('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc02('0x13'));var logger=require(_0xcc02('0x14'))(_0xcc02('0x15'));var utils=require('../../config/utils');var config=require(_0xcc02('0x16'));var licenseUtil=require(_0xcc02('0x17'));var db=require(_0xcc02('0x18'))['db'];var integrations=require(_0xcc02('0x19'));function respondWithStatusCode(_0x36bca1,_0x1ce3eb){_0x1ce3eb=_0x1ce3eb||0xcc;return function(_0x376402){if(_0x376402){return _0x36bca1[_0xcc02('0x1a')](_0x1ce3eb);}return _0x36bca1[_0xcc02('0x1b')](_0x1ce3eb)[_0xcc02('0x1c')]();};}function respondWithResult(_0x6a5e6e,_0x26491b){_0x26491b=_0x26491b||0xc8;return function(_0x2c105d){if(_0x2c105d){return _0x6a5e6e['status'](_0x26491b)[_0xcc02('0x1d')](_0x2c105d);}};}function respondWithFilteredResult(_0x469df2,_0xabad62){return function(_0x38bdcc){if(_0x38bdcc){var _0x27c9c4=typeof _0xabad62[_0xcc02('0x1e')]==='undefined'&&typeof _0xabad62['limit']==='undefined';var _0x488ca8=_0x38bdcc[_0xcc02('0x1f')];var _0x31c7db=_0x27c9c4?0x0:_0xabad62[_0xcc02('0x1e')];var _0x2ac39a=_0x27c9c4?_0x38bdcc[_0xcc02('0x1f')]:_0xabad62[_0xcc02('0x1e')]+_0xabad62[_0xcc02('0x20')];var _0x4ad401;if(_0x2ac39a>=_0x488ca8){_0x2ac39a=_0x488ca8;_0x4ad401=0xc8;}else{_0x4ad401=0xce;}_0x469df2[_0xcc02('0x1b')](_0x4ad401);return _0x469df2[_0xcc02('0x21')](_0xcc02('0x22'),_0x31c7db+'-'+_0x2ac39a+'/'+_0x488ca8)[_0xcc02('0x1d')](_0x38bdcc);}return null;};}function patchUpdates(_0x5f3e12){return function(_0x20e883){try{jsonpatch[_0xcc02('0x23')](_0x20e883,_0x5f3e12,!![]);}catch(_0x513e27){return BPromise['reject'](_0x513e27);}return _0x20e883[_0xcc02('0x24')]();};}function saveUpdates(_0x43dc6e,_0xe644d3){return function(_0x2b5033){if(_0x2b5033){return _0x2b5033['update'](_0x43dc6e)[_0xcc02('0x25')](function(_0x48ae8e){return _0x48ae8e;});}return null;};}function removeEntity(_0xc923d5,_0x29d062){return function(_0x870cd0){if(_0x870cd0){return _0x870cd0[_0xcc02('0x26')]()[_0xcc02('0x25')](function(){_0xc923d5[_0xcc02('0x1b')](0xcc)[_0xcc02('0x1c')]();});}};}function handleEntityNotFound(_0x444173,_0x33b27f){return function(_0x358170){if(!_0x358170){_0x444173[_0xcc02('0x1a')](0x194);}return _0x358170;};}function handleError(_0x478526,_0x1139a5){_0x1139a5=_0x1139a5||0x1f4;return function(_0x182dfa){logger[_0xcc02('0x27')](_0x182dfa[_0xcc02('0x28')]);if(_0x182dfa['name']){delete _0x182dfa[_0xcc02('0x29')];}_0x478526['status'](_0x1139a5)[_0xcc02('0x2a')](_0x182dfa);};}exports['index']=function(_0x5c4bc7,_0x277691){var _0x106915={},_0x141632={},_0x43d8c2={'count':0x0,'rows':[]};var _0x3cd293=_['map'](db[_0xcc02('0x2b')][_0xcc02('0x2c')],function(_0x37f181){return{'name':_0x37f181['fieldName'],'type':_0x37f181[_0xcc02('0x2d')][_0xcc02('0x2e')]};});_0x141632['model']=_['map'](_0x3cd293,_0xcc02('0x29'));_0x141632['query']=_[_0xcc02('0x2f')](_0x5c4bc7[_0xcc02('0x30')]);_0x141632['filters']=_[_0xcc02('0x31')](_0x141632['model'],_0x141632[_0xcc02('0x30')]);_0x106915[_0xcc02('0x32')]=_[_0xcc02('0x31')](_0x141632['model'],qs[_0xcc02('0x33')](_0x5c4bc7['query'][_0xcc02('0x33')]));_0x106915['attributes']=_0x106915['attributes'][_0xcc02('0x34')]?_0x106915[_0xcc02('0x32')]:_0x141632[_0xcc02('0x35')];if(!_0x5c4bc7[_0xcc02('0x30')][_0xcc02('0x36')](_0xcc02('0x37'))){_0x106915[_0xcc02('0x20')]=qs['limit'](_0x5c4bc7['query'][_0xcc02('0x20')]);_0x106915[_0xcc02('0x1e')]=qs['offset'](_0x5c4bc7[_0xcc02('0x30')][_0xcc02('0x1e')]);}_0x106915[_0xcc02('0x38')]=qs[_0xcc02('0x39')](_0x5c4bc7[_0xcc02('0x30')][_0xcc02('0x39')]);_0x106915['where']=qs[_0xcc02('0x3a')](_[_0xcc02('0x3b')](_0x5c4bc7[_0xcc02('0x30')],_0x141632[_0xcc02('0x3a')]),_0x3cd293);if(_0x5c4bc7['query'][_0xcc02('0x3c')]){_0x106915['where']=_['merge'](_0x106915[_0xcc02('0x3d')],{'$or':_[_0xcc02('0x3e')](_0x3cd293,function(_0x2a366d){if(_0x2a366d[_0xcc02('0x2d')]!==_0xcc02('0x3f')){var _0x3f69cd={};_0x3f69cd[_0x2a366d[_0xcc02('0x29')]]={'$like':'%'+_0x5c4bc7['query'][_0xcc02('0x3c')]+'%'};return _0x3f69cd;}})});}_0x106915=_[_0xcc02('0x40')]({},_0x106915,_0x5c4bc7[_0xcc02('0x41')]);var _0x4d50e3={'where':_0x106915[_0xcc02('0x3d')]};return db[_0xcc02('0x2b')][_0xcc02('0x1f')](_0x4d50e3)['then'](function(_0x4fb5ee){_0x43d8c2[_0xcc02('0x1f')]=_0x4fb5ee;if(_0x5c4bc7['query'][_0xcc02('0x42')]){_0x106915[_0xcc02('0x43')]=[{'all':!![]}];}return db[_0xcc02('0x2b')]['findAll'](_0x106915);})[_0xcc02('0x25')](function(_0x5ce105){_0x43d8c2[_0xcc02('0x44')]=_0x5ce105;return _0x43d8c2;})[_0xcc02('0x25')](respondWithFilteredResult(_0x277691,_0x106915))[_0xcc02('0x45')](handleError(_0x277691,null));};exports['show']=function(_0x3eb1c1,_0x30268f){var _0x3b58c3={'raw':![],'where':{'id':_0x3eb1c1[_0xcc02('0x46')]['id']}},_0x13b674={};_0x13b674['model']=_[_0xcc02('0x2f')](db[_0xcc02('0x2b')][_0xcc02('0x2c')]);_0x13b674['query']=_[_0xcc02('0x2f')](_0x3eb1c1[_0xcc02('0x30')]);_0x13b674[_0xcc02('0x3a')]=_[_0xcc02('0x31')](_0x13b674[_0xcc02('0x35')],_0x13b674[_0xcc02('0x30')]);_0x3b58c3[_0xcc02('0x32')]=_[_0xcc02('0x31')](_0x13b674[_0xcc02('0x35')],qs[_0xcc02('0x33')](_0x3eb1c1[_0xcc02('0x30')][_0xcc02('0x33')]));_0x3b58c3[_0xcc02('0x32')]=_0x3b58c3['attributes']['length']?_0x3b58c3[_0xcc02('0x32')]:_0x13b674[_0xcc02('0x35')];if(_0x3eb1c1['query']['includeAll']){_0x3b58c3['include']=[{'all':!![]}];}_0x3b58c3=_['merge']({},_0x3b58c3,_0x3eb1c1[_0xcc02('0x41')]);return db['VtigerAccount'][_0xcc02('0x47')](_0x3b58c3)[_0xcc02('0x25')](handleEntityNotFound(_0x30268f,null))['then'](respondWithResult(_0x30268f,null))[_0xcc02('0x45')](handleError(_0x30268f,null));};exports['create']=function(_0x9135ff,_0x24b1b1){return db[_0xcc02('0x2b')][_0xcc02('0x48')](_0x9135ff['body'],{})[_0xcc02('0x25')](respondWithResult(_0x24b1b1,0xc9))[_0xcc02('0x45')](handleError(_0x24b1b1,null));};exports[_0xcc02('0x49')]=function(_0x53e1d8,_0x350749){if(_0x53e1d8[_0xcc02('0x4a')]['id']){delete _0x53e1d8['body']['id'];}return db[_0xcc02('0x2b')][_0xcc02('0x47')]({'where':{'id':_0x53e1d8[_0xcc02('0x46')]['id']}})[_0xcc02('0x25')](handleEntityNotFound(_0x350749,null))[_0xcc02('0x25')](saveUpdates(_0x53e1d8[_0xcc02('0x4a')],null))['then'](respondWithResult(_0x350749,null))[_0xcc02('0x45')](handleError(_0x350749,null));};exports['destroy']=function(_0x4f89fb,_0x37da46){return db['VtigerAccount'][_0xcc02('0x47')]({'where':{'id':_0x4f89fb['params']['id']}})[_0xcc02('0x25')](handleEntityNotFound(_0x37da46,null))[_0xcc02('0x25')](removeEntity(_0x37da46,null))[_0xcc02('0x45')](handleError(_0x37da46,null));};exports[_0xcc02('0x4b')]=function(_0x5d5d5e,_0xceefce,_0x16e979){var _0x122f2b={};var _0x3aed1a={};var _0x381e04;var _0x335874;return db[_0xcc02('0x2b')][_0xcc02('0x4c')]({'where':{'id':_0x5d5d5e[_0xcc02('0x46')]['id']}})[_0xcc02('0x25')](handleEntityNotFound(_0xceefce,null))[_0xcc02('0x25')](function(_0x5d7ac0){if(_0x5d7ac0){_0x381e04=_0x5d7ac0;_0x3aed1a[_0xcc02('0x35')]=_[_0xcc02('0x2f')](db[_0xcc02('0x4d')]['rawAttributes']);_0x3aed1a[_0xcc02('0x30')]=_[_0xcc02('0x2f')](_0x5d5d5e[_0xcc02('0x30')]);_0x3aed1a[_0xcc02('0x3a')]=_[_0xcc02('0x31')](_0x3aed1a[_0xcc02('0x35')],_0x3aed1a[_0xcc02('0x30')]);_0x122f2b[_0xcc02('0x32')]=_[_0xcc02('0x31')](_0x3aed1a['model'],qs[_0xcc02('0x33')](_0x5d5d5e[_0xcc02('0x30')][_0xcc02('0x33')]));_0x122f2b[_0xcc02('0x32')]=_0x122f2b[_0xcc02('0x32')]['length']?_0x122f2b[_0xcc02('0x32')]:_0x3aed1a[_0xcc02('0x35')];_0x122f2b[_0xcc02('0x38')]=qs['sort'](_0x5d5d5e[_0xcc02('0x30')][_0xcc02('0x39')]);_0x122f2b[_0xcc02('0x3d')]=qs[_0xcc02('0x3a')](_['pick'](_0x5d5d5e[_0xcc02('0x30')],_0x3aed1a[_0xcc02('0x3a')]));if(_0x5d5d5e[_0xcc02('0x30')][_0xcc02('0x3c')]){_0x122f2b[_0xcc02('0x3d')]=_[_0xcc02('0x40')](_0x122f2b[_0xcc02('0x3d')],{'$or':_['map'](_0x122f2b[_0xcc02('0x32')],function(_0x5684e3){var _0x3cef66={};_0x3cef66[_0x5684e3]={'$like':'%'+_0x5d5d5e[_0xcc02('0x30')][_0xcc02('0x3c')]+'%'};return _0x3cef66;})});}_0x122f2b=_['merge']({},_0x122f2b,_0x5d5d5e[_0xcc02('0x41')]);return _0x381e04[_0xcc02('0x4b')](_0x122f2b);}})[_0xcc02('0x25')](function(_0x49eb48){if(_0x49eb48){_0x335874=_0x49eb48[_0xcc02('0x34')];if(!_0x5d5d5e[_0xcc02('0x30')]['hasOwnProperty'](_0xcc02('0x37'))){_0x122f2b[_0xcc02('0x20')]=qs[_0xcc02('0x20')](_0x5d5d5e[_0xcc02('0x30')][_0xcc02('0x20')]);_0x122f2b[_0xcc02('0x1e')]=qs[_0xcc02('0x1e')](_0x5d5d5e[_0xcc02('0x30')][_0xcc02('0x1e')]);}return _0x381e04[_0xcc02('0x4b')](_0x122f2b);}})['then'](function(_0x17446c){if(_0x17446c){return _0x17446c?{'count':_0x335874,'rows':_0x17446c}:null;}})[_0xcc02('0x25')](respondWithResult(_0xceefce,null))[_0xcc02('0x45')](handleError(_0xceefce,null));};exports['addConfiguration']=function(_0x5b66b1,_0x340849,_0x5840d6){if(_0x5b66b1['body']['id']){delete _0x5b66b1['body']['id'];}return db[_0xcc02('0x2b')][_0xcc02('0x4c')]({'where':{'id':_0x5b66b1[_0xcc02('0x46')]['id']}})[_0xcc02('0x25')](handleEntityNotFound(_0x340849,null))['then'](function(_0x3ca0a7){if(_0x3ca0a7){_0x5b66b1['body'][_0xcc02('0x4e')]=_0x3ca0a7['id'];_0x5b66b1[_0xcc02('0x4a')][_0xcc02('0x4f')]=integrations[_0xcc02('0x50')](_0x5b66b1['body'][_0xcc02('0x51')],_0x5b66b1[_0xcc02('0x4a')][_0xcc02('0x2d')]);_0x5b66b1[_0xcc02('0x4a')][_0xcc02('0x52')]=integrations[_0xcc02('0x53')](_0x5b66b1[_0xcc02('0x4a')][_0xcc02('0x51')],_0x5b66b1[_0xcc02('0x4a')][_0xcc02('0x2d')]);return db[_0xcc02('0x4d')][_0xcc02('0x48')](_0x5b66b1['body'],{'include':[{'model':db['VtigerField'],'as':_0xcc02('0x4f')},{'model':db[_0xcc02('0x54')],'as':_0xcc02('0x52')}]});}return null;})['then'](respondWithResult(_0x340849,null))[_0xcc02('0x45')](handleError(_0x340849,null));};var md5=require(_0xcc02('0x55'));exports[_0xcc02('0x56')]=function(_0x5b59d4,_0x385dc7,_0x3cbad2){var _0x410edd=null;var _0x5dab6a=null;var _0x2f78a0=null;var _0x1d1798=null;var _0x497d30='';return db[_0xcc02('0x2b')][_0xcc02('0x4c')]({'where':{'id':_0x5b59d4[_0xcc02('0x46')]['id']},'attributes':['id',_0xcc02('0x29'),_0xcc02('0x57'),_0xcc02('0x58'),_0xcc02('0x59'),_0xcc02('0x5a'),'serverUrl',_0xcc02('0x5b')]})['then'](handleEntityNotFound(_0x385dc7,null))[_0xcc02('0x25')](function(_0x18796e){if(_0x18796e){_0x410edd=_0x18796e[_0xcc02('0x57')];_0x5dab6a=_0x18796e[_0xcc02('0x5b')];_0x2f78a0=_0x18796e[_0xcc02('0x59')];_0x497d30=_0x18796e[_0xcc02('0x5a')];var _0x44d95c=_0x497d30[_0xcc02('0x5c')](-0x1);if(_0x44d95c==='/'){_0x497d30=_0x497d30[_0xcc02('0x5d')](0x0,_0x497d30[_0xcc02('0x5e')](_0x44d95c));}_0x1d1798=util[_0xcc02('0x5f')](_0xcc02('0x60'),_0x497d30);var _0x13673c={'method':_0xcc02('0x61'),'uri':_0x1d1798,'qs':{'operation':_0xcc02('0x62'),'username':_0x18796e['username']},'json':!![]};return rp(_0x13673c);}})[_0xcc02('0x25')](function(_0x4b8426){if(_0x4b8426[_0xcc02('0x63')]){var _0xf5f37={'method':_0xcc02('0x64'),'uri':_0x1d1798,'form':{'operation':_0xcc02('0x65'),'username':_0x410edd,'accessKey':md5(_0x4b8426[_0xcc02('0x66')][_0xcc02('0x67')]+_0x5dab6a)},'json':!![]};return rp(_0xf5f37);}})[_0xcc02('0x25')](function(_0x548604){if(_0x548604[_0xcc02('0x63')]){var _0x16faf8={'method':_0xcc02('0x61'),'uri':_0x1d1798,'qs':{'operation':_0xcc02('0x68'),'username':_0x410edd,'sessionName':_0x548604[_0xcc02('0x66')][_0xcc02('0x69')],'elementType':_0x2f78a0},'json':!![]};return rp(_0x16faf8);}})[_0xcc02('0x25')](function(_0xdf203a){if(_0xdf203a[_0xcc02('0x63')]){var _0x40c3a9=['autogenerated',_0xcc02('0x6a'),_0xcc02('0x6b')];_['remove'](_0xdf203a[_0xcc02('0x66')][_0xcc02('0x33')],function(_0x51cf62){return _0x40c3a9[_0xcc02('0x6c')](_0x51cf62[_0xcc02('0x2d')]['name']);});_[_0xcc02('0x6d')](_0xdf203a['result'][_0xcc02('0x33')],function(_0x50d252){return _0x50d252[_0xcc02('0x6e')]===_0xcc02('0x6f');});return{'count':_0xdf203a[_0xcc02('0x66')][_0xcc02('0x33')][_0xcc02('0x34')],'rows':_[_0xcc02('0x3e')](_0xdf203a[_0xcc02('0x66')][_0xcc02('0x33')],function(_0x2524bb){return{'id':_0x2524bb[_0xcc02('0x29')],'name':_0x2524bb['label'],'custom':_[_0xcc02('0x70')](_0x2524bb[_0xcc02('0x29')],_0xcc02('0x71'))?!![]:![],'options':_0x2524bb[_0xcc02('0x2d')][_0xcc02('0x29')]==='picklist'&&_0x2524bb[_0xcc02('0x2d')][_0xcc02('0x72')]['length']>0x0?_[_0xcc02('0x3e')](_0x2524bb[_0xcc02('0x2d')][_0xcc02('0x72')],function(_0x183fb9){return{'name':_0x183fb9[_0xcc02('0x73')],'value':_0x183fb9['value']};}):[]};})};}})[_0xcc02('0x25')](respondWithResult(_0x385dc7,null))[_0xcc02('0x45')](function(_0xcbd832){console[_0xcc02('0x74')](_0xcc02('0x75')+_0xcbd832);var _0x230101=_0x5b59d4[_0xcc02('0x30')][_0xcc02('0x76')]?0x1f4:_0xcbd832[_0xcc02('0x77')]||0x1f4;logger[_0xcc02('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x230101,JSON['stringify'](_0xcbd832));delete _0xcbd832['name'];if(_0x230101===0x191){_0x230101=0x190;}_0x385dc7['status'](_0x230101)[_0xcc02('0x2a')](_0x5b59d4[_0xcc02('0x30')]['test']?{'message':_0xcc02('0x78'),'statusCode':_0xcbd832[_0xcc02('0x77')]}:_0xcbd832);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8c78a9a..697c7f8 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 _0x3a24=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3a24,0x1ef));var _0x43a2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x3a24[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x43a2('0x0'));var util=require(_0x43a2('0x1'));var logger=require(_0x43a2('0x2'))(_0x43a2('0x3'));var moment=require('moment');var BPromise=require(_0x43a2('0x4'));var rp=require(_0x43a2('0x5'));var fs=require('fs');var path=require(_0x43a2('0x6'));var rimraf=require('rimraf');var config=require(_0x43a2('0x7'));var attributes=require(_0x43a2('0x8'));var integrations=require(_0x43a2('0x9'));module[_0x43a2('0xa')]=function(_0x518378,_0x280e8e){return _0x518378[_0x43a2('0xb')](_0x43a2('0xc'),attributes,{'tableName':_0x43a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf1f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','api','moment'];(function(_0x558a69,_0x4eb75a){var _0x3febd8=function(_0x227738){while(--_0x227738){_0x558a69['push'](_0x558a69['shift']());}};_0x3febd8(++_0x4eb75a);}(_0xbf1f,0xd8));var _0xfbf1=function(_0x23a7aa,_0x51647e){_0x23a7aa=_0x23a7aa-0x0;var _0x5a6172=_0xbf1f[_0x23a7aa];return _0x5a6172;};'use strict';var _=require(_0xfbf1('0x0'));var util=require(_0xfbf1('0x1'));var logger=require('../../config/logger')(_0xfbf1('0x2'));var moment=require(_0xfbf1('0x3'));var BPromise=require(_0xfbf1('0x4'));var rp=require(_0xfbf1('0x5'));var fs=require('fs');var path=require(_0xfbf1('0x6'));var rimraf=require(_0xfbf1('0x7'));var config=require(_0xfbf1('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xfbf1('0x9')]=function(_0x9920ca,_0x5ced46){return _0x9920ca[_0xfbf1('0xa')]('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 d2e7683..bde5d67 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 _0x91a7=['VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','ShowVtigerAccount','VtigerAccount','find','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x65834e,_0x5e8872){var _0x26a46f=function(_0x44bbed){while(--_0x44bbed){_0x65834e['push'](_0x65834e['shift']());}};_0x26a46f(++_0x5e8872);}(_0x91a7,0xe7));var _0x791a=function(_0xf62717,_0x3f7c11){_0xf62717=_0xf62717-0x0;var _0x9f6b9d=_0x91a7[_0xf62717];return _0x9f6b9d;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});}exports[_0x791a('0x13')]=function(_0x52941d){var _0x4a84ee=this;return new Promise(function(_0x588d00,_0x40f0d3){return db['VtigerAccount']['findAll']({'raw':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x15')]===undefined?!![]:![]:!![],'where':_0x52941d[_0x791a('0x14')]?_0x52941d['options'][_0x791a('0x16')]||null:null,'attributes':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x17')]||null:null,'limit':_0x52941d['options']?_0x52941d[_0x791a('0x14')][_0x791a('0x18')]||null:null,'include':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x52941d[_0x791a('0x14')][_0x791a('0x19')],function(_0x323c6a){return{'model':db[_0x323c6a[_0x791a('0x1b')]],'as':_0x323c6a['as'],'attributes':_0x323c6a[_0x791a('0x17')],'include':_0x323c6a['include']?_[_0x791a('0x1a')](_0x323c6a[_0x791a('0x19')],function(_0x380329){return{'model':db[_0x380329[_0x791a('0x1b')]],'as':_0x380329['as'],'attributes':_0x380329['attributes'],'include':_0x380329[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x380329['include'],function(_0xdfa84f){return{'model':db[_0xdfa84f[_0x791a('0x1b')]],'as':_0xdfa84f['as'],'attributes':_0xdfa84f[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29194d){logger[_0x791a('0xa')](_0x791a('0x13'),_0x52941d);logger[_0x791a('0xc')](_0x791a('0x13'),_0x52941d,JSON[_0x791a('0xd')](_0x29194d));_0x588d00(_0x29194d);})[_0x791a('0x12')](function(_0x889534){logger['error'](_0x791a('0x13'),_0x889534[_0x791a('0x10')],_0x52941d);_0x40f0d3(_0x4a84ee[_0x791a('0xe')](0x1f4,_0x889534['message']));});});};exports[_0x791a('0x1c')]=function(_0x5df656){var _0xc59f5e=this;return new Promise(function(_0x2e4ec8,_0xcde862){return db[_0x791a('0x1d')][_0x791a('0x1e')]({'raw':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x16')]||null:null,'attributes':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['attributes']||null:null,'include':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x5df656[_0x791a('0x14')]['include'],function(_0x305836){return{'model':db[_0x305836[_0x791a('0x1b')]],'as':_0x305836['as'],'attributes':_0x305836[_0x791a('0x17')],'include':_0x305836[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x305836['include'],function(_0xd5609){return{'model':db[_0xd5609['model']],'as':_0xd5609['as'],'attributes':_0xd5609[_0x791a('0x17')],'include':_0xd5609['include']?_['map'](_0xd5609[_0x791a('0x19')],function(_0x404530){return{'model':db[_0x404530[_0x791a('0x1b')]],'as':_0x404530['as'],'attributes':_0x404530[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x791a('0x9')](function(_0x3f46be){logger[_0x791a('0xa')]('ShowVtigerAccount',_0x5df656);logger[_0x791a('0xc')]('ShowVtigerAccount',_0x5df656,JSON[_0x791a('0xd')](_0x3f46be));_0x2e4ec8(_0x3f46be);})['catch'](function(_0x25e8cc){logger[_0x791a('0xe')]('ShowVtigerAccount',_0x25e8cc[_0x791a('0x10')],_0x5df656);_0xcde862(_0xc59f5e[_0x791a('0xe')](0x1f4,_0x25e8cc['message']));});});}; \ No newline at end of file +var _0x96cc=['model','map','debug','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x71ae3c,_0x404627){var _0x194072=function(_0x13c008){while(--_0x13c008){_0x71ae3c['push'](_0x71ae3c['shift']());}};_0x194072(++_0x404627);}(_0x96cc,0x16c));var _0xc96c=function(_0x252805,_0x1d1e8e){_0x252805=_0x252805-0x0;var _0x3e74b9=_0x96cc[_0x252805];return _0x3e74b9;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});}exports[_0xc96c('0x17')]=function(_0x99c402){var _0x16b6ce=this;return new Promise(function(_0x2ae19a,_0x4aa6a3){return db[_0xc96c('0x18')][_0xc96c('0x19')]({'raw':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1b')]===undefined?!![]:![]:!![],'where':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1c')]||null:null,'attributes':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1d')]||null:null,'limit':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1e')]||null:null,'include':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1f')]?_['map'](_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1f')],function(_0x4456bf){return{'model':db[_0x4456bf[_0xc96c('0x20')]],'as':_0x4456bf['as'],'attributes':_0x4456bf[_0xc96c('0x1d')],'include':_0x4456bf[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x4456bf[_0xc96c('0x1f')],function(_0x1a77df){return{'model':db[_0x1a77df[_0xc96c('0x20')]],'as':_0x1a77df['as'],'attributes':_0x1a77df['attributes'],'include':_0x1a77df[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x1a77df[_0xc96c('0x1f')],function(_0x294fee){return{'model':db[_0x294fee['model']],'as':_0x294fee['as'],'attributes':_0x294fee['attributes']};}):[]};}):[]};}):[]:[]})[_0xc96c('0xc')](function(_0x12c293){logger[_0xc96c('0xd')](_0xc96c('0x17'),_0x99c402);logger[_0xc96c('0x22')](_0xc96c('0x17'),_0x99c402,JSON[_0xc96c('0x11')](_0x12c293));_0x2ae19a(_0x12c293);})[_0xc96c('0x16')](function(_0xa0efbc){logger[_0xc96c('0x12')](_0xc96c('0x17'),_0xa0efbc[_0xc96c('0x14')],_0x99c402);_0x4aa6a3(_0x16b6ce[_0xc96c('0x12')](0x1f4,_0xa0efbc[_0xc96c('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x3aa436){var _0x53c994=this;return new Promise(function(_0x3f4b0e,_0x442c7f){return db[_0xc96c('0x18')]['find']({'raw':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436['options']['where']||null:null,'attributes':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1d')]||null:null,'include':_0x3aa436['options']?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x3aa436[_0xc96c('0x1a')]['include'],function(_0x4132a9){return{'model':db[_0x4132a9[_0xc96c('0x20')]],'as':_0x4132a9['as'],'attributes':_0x4132a9['attributes'],'include':_0x4132a9[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x4132a9[_0xc96c('0x1f')],function(_0x2d2595){return{'model':db[_0x2d2595[_0xc96c('0x20')]],'as':_0x2d2595['as'],'attributes':_0x2d2595[_0xc96c('0x1d')],'include':_0x2d2595['include']?_[_0xc96c('0x21')](_0x2d2595[_0xc96c('0x1f')],function(_0x15b68b){return{'model':db[_0x15b68b[_0xc96c('0x20')]],'as':_0x15b68b['as'],'attributes':_0x15b68b[_0xc96c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc96c('0xc')](function(_0x52d4a2){logger['info'](_0xc96c('0x23'),_0x3aa436);logger[_0xc96c('0x22')]('ShowVtigerAccount',_0x3aa436,JSON['stringify'](_0x52d4a2));_0x3f4b0e(_0x52d4a2);})[_0xc96c('0x16')](function(_0x1df393){logger[_0xc96c('0x12')](_0xc96c('0x23'),_0x1df393[_0xc96c('0x14')],_0x3aa436);_0x442c7f(_0x53c994[_0xc96c('0x12')](0x1f4,_0x1df393[_0xc96c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a50014a..ba813f0 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 _0x9800=['/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3f4a9b,_0x31386f){var _0x54ea77=function(_0x197e56){while(--_0x197e56){_0x3f4a9b['push'](_0x3f4a9b['shift']());}};_0x54ea77(++_0x31386f);}(_0x9800,0x164));var _0x0980=function(_0xa6d7da,_0x3042fd){_0xa6d7da=_0xa6d7da-0x0;var _0x4f6754=_0x9800[_0xa6d7da];return _0x4f6754;};'use strict';var multer=require(_0x0980('0x0'));var util=require(_0x0980('0x1'));var path=require(_0x0980('0x2'));var timeout=require('connect-timeout');var express=require(_0x0980('0x3'));var router=express[_0x0980('0x4')]();var fs_extra=require(_0x0980('0x5'));var auth=require(_0x0980('0x6'));var interaction=require(_0x0980('0x7'));var config=require(_0x0980('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x0980('0x9')]('/',auth[_0x0980('0xa')](),controller[_0x0980('0xb')]);router[_0x0980('0x9')](_0x0980('0xc'),auth['isAuthenticated'](),controller[_0x0980('0xd')]);router[_0x0980('0x9')](_0x0980('0xe'),auth['isAuthenticated'](),controller[_0x0980('0xf')]);router['get']('/:id/subjects',auth[_0x0980('0xa')](),controller[_0x0980('0x10')]);router[_0x0980('0x9')](_0x0980('0x11'),auth[_0x0980('0xa')](),controller['getDescriptions']);router[_0x0980('0x12')]('/',auth[_0x0980('0xa')](),controller['create']);router[_0x0980('0x13')]('/:id',auth[_0x0980('0xa')](),controller[_0x0980('0x14')]);router[_0x0980('0x15')](_0x0980('0xc'),auth[_0x0980('0xa')](),controller['destroy']);module[_0x0980('0x16')]=router; \ No newline at end of file +var _0x1a17=['/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x236e4b,_0x136c92){var _0x5cce4e=function(_0x4c29eb){while(--_0x4c29eb){_0x236e4b['push'](_0x236e4b['shift']());}};_0x5cce4e(++_0x136c92);}(_0x1a17,0x9e));var _0x71a1=function(_0x36e14a,_0x55d29b){_0x36e14a=_0x36e14a-0x0;var _0x33a7b6=_0x1a17[_0x36e14a];return _0x33a7b6;};'use strict';var multer=require(_0x71a1('0x0'));var util=require(_0x71a1('0x1'));var path=require(_0x71a1('0x2'));var timeout=require(_0x71a1('0x3'));var express=require(_0x71a1('0x4'));var router=express[_0x71a1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x71a1('0x6'));var interaction=require(_0x71a1('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0x71a1('0x8')]('/',auth[_0x71a1('0x9')](),controller[_0x71a1('0xa')]);router[_0x71a1('0x8')]('/:id',auth[_0x71a1('0x9')](),controller[_0x71a1('0xb')]);router[_0x71a1('0x8')](_0x71a1('0xc'),auth[_0x71a1('0x9')](),controller['getFields']);router[_0x71a1('0x8')]('/:id/subjects',auth[_0x71a1('0x9')](),controller[_0x71a1('0xd')]);router[_0x71a1('0x8')](_0x71a1('0xe'),auth[_0x71a1('0x9')](),controller[_0x71a1('0xf')]);router[_0x71a1('0x10')]('/',auth['isAuthenticated'](),controller[_0x71a1('0x11')]);router['put'](_0x71a1('0x12'),auth[_0x71a1('0x9')](),controller['update']);router[_0x71a1('0x13')](_0x71a1('0x12'),auth['isAuthenticated'](),controller[_0x71a1('0x14')]);module[_0x71a1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c311b92..54cdd1d 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 _0xc041=['sequelize','STRING'];(function(_0x57fa5c,_0x22d1e7){var _0x270ebe=function(_0xf97a43){while(--_0xf97a43){_0x57fa5c['push'](_0x57fa5c['shift']());}};_0x270ebe(++_0x22d1e7);}(_0xc041,0x82));var _0x1c04=function(_0x536128,_0x205e2b){_0x536128=_0x536128-0x0;var _0x19eb75=_0xc041[_0x536128];return _0x19eb75;};'use strict';var Sequelize=require(_0x1c04('0x0'));module['exports']={'name':{'type':Sequelize[_0x1c04('0x1')]},'description':{'type':Sequelize[_0x1c04('0x1')]}}; \ No newline at end of file +var _0x6eac=['sequelize','exports','STRING'];(function(_0x27c3a0,_0xbc472f){var _0x56f275=function(_0xd2df04){while(--_0xd2df04){_0x27c3a0['push'](_0x27c3a0['shift']());}};_0x56f275(++_0xbc472f);}(_0x6eac,0x72));var _0xc6ea=function(_0xc5ebca,_0x40d7ca){_0xc5ebca=_0xc5ebca-0x0;var _0x360b94=_0x6eac[_0xc5ebca];return _0x360b94;};'use strict';var Sequelize=require(_0xc6ea('0x0'));module[_0xc6ea('0x1')]={'name':{'type':Sequelize[_0xc6ea('0x2')]},'description':{'type':Sequelize[_0xc6ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c4a3382..763221e 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 _0xabf2=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','error','name','index','map','VtigerConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getFields','VtigerField','getSubjects','getDescriptions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xabf2,0xe6));var _0x2abf=function(_0x1839b8,_0x576781){_0x1839b8=_0x1839b8-0x0;var _0x2e1b33=_0xabf2[_0x1839b8];return _0x2e1b33;};'use strict';var emlformat=require(_0x2abf('0x0'));var rimraf=require(_0x2abf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2abf('0x2'));var rp=require(_0x2abf('0x3'));var moment=require(_0x2abf('0x4'));var BPromise=require(_0x2abf('0x5'));var Mustache=require(_0x2abf('0x6'));var util=require(_0x2abf('0x7'));var path=require('path');var sox=require(_0x2abf('0x8'));var csv=require(_0x2abf('0x9'));var ejs=require(_0x2abf('0xa'));var fs=require('fs');var fs_extra=require(_0x2abf('0xb'));var _=require(_0x2abf('0xc'));var squel=require(_0x2abf('0xd'));var crypto=require(_0x2abf('0xe'));var jsforce=require(_0x2abf('0xf'));var deskjs=require(_0x2abf('0x10'));var toCsv=require(_0x2abf('0x9'));var querystring=require('querystring');var Papa=require(_0x2abf('0x11'));var Redis=require(_0x2abf('0x12'));var authService=require(_0x2abf('0x13'));var qs=require(_0x2abf('0x14'));var as=require(_0x2abf('0x15'));var hardwareService=require(_0x2abf('0x16'));var logger=require(_0x2abf('0x17'))('api');var utils=require(_0x2abf('0x18'));var config=require(_0x2abf('0x19'));var licenseUtil=require(_0x2abf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23f8fe,_0x3e2ed4){_0x3e2ed4=_0x3e2ed4||0xcc;return function(_0x10aa3a){if(_0x10aa3a){return _0x23f8fe[_0x2abf('0x1b')](_0x3e2ed4);}return _0x23f8fe[_0x2abf('0x1c')](_0x3e2ed4)[_0x2abf('0x1d')]();};}function respondWithResult(_0x5376ff,_0x597c2d){_0x597c2d=_0x597c2d||0xc8;return function(_0x21af97){if(_0x21af97){return _0x5376ff[_0x2abf('0x1c')](_0x597c2d)['json'](_0x21af97);}};}function respondWithFilteredResult(_0x293712,_0x74a4f3){return function(_0x1b4339){if(_0x1b4339){var _0xfdc5e1=typeof _0x74a4f3[_0x2abf('0x1e')]===_0x2abf('0x1f')&&typeof _0x74a4f3[_0x2abf('0x20')]==='undefined';var _0x1c574b=_0x1b4339['count'];var _0x1b29f9=_0xfdc5e1?0x0:_0x74a4f3[_0x2abf('0x1e')];var _0x3daec1=_0xfdc5e1?_0x1b4339[_0x2abf('0x21')]:_0x74a4f3[_0x2abf('0x1e')]+_0x74a4f3[_0x2abf('0x20')];var _0x4a23a9;if(_0x3daec1>=_0x1c574b){_0x3daec1=_0x1c574b;_0x4a23a9=0xc8;}else{_0x4a23a9=0xce;}_0x293712['status'](_0x4a23a9);return _0x293712['set']('Content-Range',_0x1b29f9+'-'+_0x3daec1+'/'+_0x1c574b)[_0x2abf('0x22')](_0x1b4339);}return null;};}function patchUpdates(_0xf0a587){return function(_0x103f4e){try{jsonpatch[_0x2abf('0x23')](_0x103f4e,_0xf0a587,!![]);}catch(_0x561768){return BPromise[_0x2abf('0x24')](_0x561768);}return _0x103f4e[_0x2abf('0x25')]();};}function saveUpdates(_0x32e69f,_0x28496d){return function(_0x53b909){if(_0x53b909){return _0x53b909[_0x2abf('0x26')](_0x32e69f)[_0x2abf('0x27')](function(_0x140bcd){return _0x140bcd;});}return null;};}function removeEntity(_0x3019d4,_0x7998bb){return function(_0x5981be){if(_0x5981be){return _0x5981be['destroy']()['then'](function(){_0x3019d4[_0x2abf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dd21b,_0x79e77a){return function(_0xd5c483){if(!_0xd5c483){_0x4dd21b['sendStatus'](0x194);}return _0xd5c483;};}function handleError(_0x9ec52b,_0x45ae91){_0x45ae91=_0x45ae91||0x1f4;return function(_0x58cfe1){logger[_0x2abf('0x28')](_0x58cfe1['stack']);if(_0x58cfe1[_0x2abf('0x29')]){delete _0x58cfe1['name'];}_0x9ec52b[_0x2abf('0x1c')](_0x45ae91)['send'](_0x58cfe1);};}exports[_0x2abf('0x2a')]=function(_0x589cdd,_0x4f95f0){var _0x2d94a0={},_0x4ae6d7={},_0x30590e={'count':0x0,'rows':[]};var _0x4f6162=_[_0x2abf('0x2b')](db[_0x2abf('0x2c')]['rawAttributes'],function(_0x3d15ee){return{'name':_0x3d15ee[_0x2abf('0x2d')],'type':_0x3d15ee[_0x2abf('0x2e')][_0x2abf('0x2f')]};});_0x4ae6d7['model']=_['map'](_0x4f6162,_0x2abf('0x29'));_0x4ae6d7[_0x2abf('0x30')]=_[_0x2abf('0x31')](_0x589cdd[_0x2abf('0x30')]);_0x4ae6d7[_0x2abf('0x32')]=_[_0x2abf('0x33')](_0x4ae6d7[_0x2abf('0x34')],_0x4ae6d7[_0x2abf('0x30')]);_0x2d94a0[_0x2abf('0x35')]=_[_0x2abf('0x33')](_0x4ae6d7[_0x2abf('0x34')],qs[_0x2abf('0x36')](_0x589cdd[_0x2abf('0x30')][_0x2abf('0x36')]));_0x2d94a0[_0x2abf('0x35')]=_0x2d94a0[_0x2abf('0x35')][_0x2abf('0x37')]?_0x2d94a0[_0x2abf('0x35')]:_0x4ae6d7[_0x2abf('0x34')];if(!_0x589cdd[_0x2abf('0x30')][_0x2abf('0x38')](_0x2abf('0x39'))){_0x2d94a0[_0x2abf('0x20')]=qs[_0x2abf('0x20')](_0x589cdd[_0x2abf('0x30')][_0x2abf('0x20')]);_0x2d94a0[_0x2abf('0x1e')]=qs['offset'](_0x589cdd[_0x2abf('0x30')][_0x2abf('0x1e')]);}_0x2d94a0[_0x2abf('0x3a')]=qs[_0x2abf('0x3b')](_0x589cdd[_0x2abf('0x30')]['sort']);_0x2d94a0[_0x2abf('0x3c')]=qs[_0x2abf('0x32')](_[_0x2abf('0x3d')](_0x589cdd['query'],_0x4ae6d7['filters']),_0x4f6162);if(_0x589cdd[_0x2abf('0x30')][_0x2abf('0x3e')]){_0x2d94a0[_0x2abf('0x3c')]=_[_0x2abf('0x3f')](_0x2d94a0[_0x2abf('0x3c')],{'$or':_['map'](_0x4f6162,function(_0x36cc55){if(_0x36cc55[_0x2abf('0x2e')]!==_0x2abf('0x40')){var _0x301df6={};_0x301df6[_0x36cc55[_0x2abf('0x29')]]={'$like':'%'+_0x589cdd[_0x2abf('0x30')][_0x2abf('0x3e')]+'%'};return _0x301df6;}})});}_0x2d94a0=_[_0x2abf('0x3f')]({},_0x2d94a0,_0x589cdd[_0x2abf('0x41')]);var _0x525ef4={'where':_0x2d94a0[_0x2abf('0x3c')]};return db[_0x2abf('0x2c')]['count'](_0x525ef4)[_0x2abf('0x27')](function(_0x23dbf9){_0x30590e['count']=_0x23dbf9;if(_0x589cdd[_0x2abf('0x30')][_0x2abf('0x42')]){_0x2d94a0[_0x2abf('0x43')]=[{'all':!![]}];}return db[_0x2abf('0x2c')]['findAll'](_0x2d94a0);})[_0x2abf('0x27')](function(_0x2599e8){_0x30590e[_0x2abf('0x44')]=_0x2599e8;return _0x30590e;})[_0x2abf('0x27')](respondWithFilteredResult(_0x4f95f0,_0x2d94a0))[_0x2abf('0x45')](handleError(_0x4f95f0,null));};exports[_0x2abf('0x46')]=function(_0x5319cd,_0x1d49a8){var _0x4257a4={'raw':![],'where':{'id':_0x5319cd[_0x2abf('0x47')]['id']}},_0x209aa3={};_0x209aa3[_0x2abf('0x34')]=_[_0x2abf('0x31')](db[_0x2abf('0x2c')][_0x2abf('0x48')]);_0x209aa3[_0x2abf('0x30')]=_[_0x2abf('0x31')](_0x5319cd[_0x2abf('0x30')]);_0x209aa3[_0x2abf('0x32')]=_[_0x2abf('0x33')](_0x209aa3[_0x2abf('0x34')],_0x209aa3['query']);_0x4257a4['attributes']=_[_0x2abf('0x33')](_0x209aa3[_0x2abf('0x34')],qs[_0x2abf('0x36')](_0x5319cd['query']['fields']));_0x4257a4[_0x2abf('0x35')]=_0x4257a4[_0x2abf('0x35')]['length']?_0x4257a4['attributes']:_0x209aa3[_0x2abf('0x34')];if(_0x5319cd[_0x2abf('0x30')][_0x2abf('0x42')]){_0x4257a4[_0x2abf('0x43')]=[{'all':!![]}];}_0x4257a4=_['merge']({},_0x4257a4,_0x5319cd[_0x2abf('0x41')]);return db[_0x2abf('0x2c')][_0x2abf('0x49')](_0x4257a4)[_0x2abf('0x27')](handleEntityNotFound(_0x1d49a8,null))['then'](respondWithResult(_0x1d49a8,null))['catch'](handleError(_0x1d49a8,null));};exports['create']=function(_0x294f18,_0x1d200d){return db[_0x2abf('0x2c')][_0x2abf('0x4a')](_0x294f18[_0x2abf('0x4b')],{})[_0x2abf('0x27')](respondWithResult(_0x1d200d,0xc9))['catch'](handleError(_0x1d200d,null));};exports[_0x2abf('0x26')]=function(_0x18bf74,_0x2cda36){if(_0x18bf74[_0x2abf('0x4b')]['id']){delete _0x18bf74[_0x2abf('0x4b')]['id'];}return db[_0x2abf('0x2c')][_0x2abf('0x49')]({'where':{'id':_0x18bf74['params']['id']}})[_0x2abf('0x27')](handleEntityNotFound(_0x2cda36,null))['then'](saveUpdates(_0x18bf74[_0x2abf('0x4b')],null))['then'](respondWithResult(_0x2cda36,null))[_0x2abf('0x45')](handleError(_0x2cda36,null));};exports['destroy']=function(_0xfa459d,_0x42d7e4){return db[_0x2abf('0x2c')][_0x2abf('0x49')]({'where':{'id':_0xfa459d[_0x2abf('0x47')]['id']}})[_0x2abf('0x27')](handleEntityNotFound(_0x42d7e4,null))[_0x2abf('0x27')](removeEntity(_0x42d7e4,null))[_0x2abf('0x45')](handleError(_0x42d7e4,null));};exports[_0x2abf('0x4c')]=function(_0x42be06,_0x5b8711,_0x18c7cf){var _0x12621f={};var _0x40b327={};var _0x556443;var _0x332414;return db[_0x2abf('0x2c')]['findOne']({'where':{'id':_0x42be06[_0x2abf('0x47')]['id']}})[_0x2abf('0x27')](handleEntityNotFound(_0x5b8711,null))[_0x2abf('0x27')](function(_0x41bb81){if(_0x41bb81){_0x556443=_0x41bb81;_0x40b327['model']=_[_0x2abf('0x31')](db[_0x2abf('0x4d')][_0x2abf('0x48')]);_0x40b327['query']=_[_0x2abf('0x31')](_0x42be06[_0x2abf('0x30')]);_0x40b327['filters']=_[_0x2abf('0x33')](_0x40b327[_0x2abf('0x34')],_0x40b327[_0x2abf('0x30')]);_0x12621f['attributes']=_[_0x2abf('0x33')](_0x40b327[_0x2abf('0x34')],qs['fields'](_0x42be06[_0x2abf('0x30')]['fields']));_0x12621f['attributes']=_0x12621f['attributes'][_0x2abf('0x37')]?_0x12621f['attributes']:_0x40b327[_0x2abf('0x34')];_0x12621f[_0x2abf('0x3a')]=qs[_0x2abf('0x3b')](_0x42be06[_0x2abf('0x30')][_0x2abf('0x3b')]);_0x12621f[_0x2abf('0x3c')]=qs[_0x2abf('0x32')](_['pick'](_0x42be06['query'],_0x40b327['filters']));if(_0x42be06[_0x2abf('0x30')][_0x2abf('0x3e')]){_0x12621f[_0x2abf('0x3c')]=_[_0x2abf('0x3f')](_0x12621f[_0x2abf('0x3c')],{'$or':_[_0x2abf('0x2b')](_0x12621f['attributes'],function(_0x1076a6){var _0x1f0a05={};_0x1f0a05[_0x1076a6]={'$like':'%'+_0x42be06[_0x2abf('0x30')][_0x2abf('0x3e')]+'%'};return _0x1f0a05;})});}_0x12621f=_[_0x2abf('0x3f')]({},_0x12621f,_0x42be06[_0x2abf('0x41')]);return _0x556443[_0x2abf('0x4c')](_0x12621f);}})['then'](function(_0x27d775){if(_0x27d775){_0x332414=_0x27d775[_0x2abf('0x37')];if(!_0x42be06[_0x2abf('0x30')][_0x2abf('0x38')](_0x2abf('0x39'))){_0x12621f['limit']=qs[_0x2abf('0x20')](_0x42be06[_0x2abf('0x30')][_0x2abf('0x20')]);_0x12621f[_0x2abf('0x1e')]=qs[_0x2abf('0x1e')](_0x42be06['query']['offset']);}return _0x556443[_0x2abf('0x4c')](_0x12621f);}})[_0x2abf('0x27')](function(_0x3bae9e){if(_0x3bae9e){return _0x3bae9e?{'count':_0x332414,'rows':_0x3bae9e}:null;}})['then'](respondWithResult(_0x5b8711,null))[_0x2abf('0x45')](handleError(_0x5b8711,null));};exports[_0x2abf('0x4e')]=function(_0x1cdffd,_0x3f3074,_0x345131){var _0x108d0d={};var _0x949fc1={};var _0x1f151e;var _0x57e97c;return db[_0x2abf('0x2c')]['findOne']({'where':{'id':_0x1cdffd[_0x2abf('0x47')]['id']}})[_0x2abf('0x27')](handleEntityNotFound(_0x3f3074,null))[_0x2abf('0x27')](function(_0x5422ae){if(_0x5422ae){_0x1f151e=_0x5422ae;_0x949fc1[_0x2abf('0x34')]=_[_0x2abf('0x31')](db[_0x2abf('0x4d')][_0x2abf('0x48')]);_0x949fc1[_0x2abf('0x30')]=_['keys'](_0x1cdffd['query']);_0x949fc1[_0x2abf('0x32')]=_[_0x2abf('0x33')](_0x949fc1[_0x2abf('0x34')],_0x949fc1[_0x2abf('0x30')]);_0x108d0d[_0x2abf('0x35')]=_[_0x2abf('0x33')](_0x949fc1['model'],qs[_0x2abf('0x36')](_0x1cdffd[_0x2abf('0x30')][_0x2abf('0x36')]));_0x108d0d['attributes']=_0x108d0d['attributes'][_0x2abf('0x37')]?_0x108d0d['attributes']:_0x949fc1['model'];_0x108d0d['order']=qs['sort'](_0x1cdffd[_0x2abf('0x30')][_0x2abf('0x3b')]);_0x108d0d[_0x2abf('0x3c')]=qs['filters'](_[_0x2abf('0x3d')](_0x1cdffd[_0x2abf('0x30')],_0x949fc1['filters']));if(_0x1cdffd[_0x2abf('0x30')][_0x2abf('0x3e')]){_0x108d0d[_0x2abf('0x3c')]=_[_0x2abf('0x3f')](_0x108d0d[_0x2abf('0x3c')],{'$or':_[_0x2abf('0x2b')](_0x108d0d[_0x2abf('0x35')],function(_0x585ac1){var _0x537950={};_0x537950[_0x585ac1]={'$like':'%'+_0x1cdffd[_0x2abf('0x30')][_0x2abf('0x3e')]+'%'};return _0x537950;})});}_0x108d0d=_[_0x2abf('0x3f')]({},_0x108d0d,_0x1cdffd[_0x2abf('0x41')]);return _0x1f151e['getSubjects'](_0x108d0d);}})['then'](function(_0x4f7039){if(_0x4f7039){_0x57e97c=_0x4f7039['length'];if(!_0x1cdffd['query'][_0x2abf('0x38')](_0x2abf('0x39'))){_0x108d0d[_0x2abf('0x20')]=qs[_0x2abf('0x20')](_0x1cdffd[_0x2abf('0x30')][_0x2abf('0x20')]);_0x108d0d['offset']=qs[_0x2abf('0x1e')](_0x1cdffd[_0x2abf('0x30')][_0x2abf('0x1e')]);}return _0x1f151e[_0x2abf('0x4e')](_0x108d0d);}})[_0x2abf('0x27')](function(_0x341b89){if(_0x341b89){return _0x341b89?{'count':_0x57e97c,'rows':_0x341b89}:null;}})[_0x2abf('0x27')](respondWithResult(_0x3f3074,null))['catch'](handleError(_0x3f3074,null));};exports[_0x2abf('0x4f')]=function(_0x1e0659,_0x86ef4b,_0xb7069e){var _0x59713d={};var _0x52dc94={};var _0x9b66af;var _0x66d037;return db[_0x2abf('0x2c')][_0x2abf('0x50')]({'where':{'id':_0x1e0659['params']['id']}})[_0x2abf('0x27')](handleEntityNotFound(_0x86ef4b,null))[_0x2abf('0x27')](function(_0x1ef4dc){if(_0x1ef4dc){_0x9b66af=_0x1ef4dc;_0x52dc94[_0x2abf('0x34')]=_['keys'](db[_0x2abf('0x4d')][_0x2abf('0x48')]);_0x52dc94[_0x2abf('0x30')]=_[_0x2abf('0x31')](_0x1e0659[_0x2abf('0x30')]);_0x52dc94[_0x2abf('0x32')]=_['intersection'](_0x52dc94[_0x2abf('0x34')],_0x52dc94[_0x2abf('0x30')]);_0x59713d[_0x2abf('0x35')]=_[_0x2abf('0x33')](_0x52dc94[_0x2abf('0x34')],qs[_0x2abf('0x36')](_0x1e0659[_0x2abf('0x30')][_0x2abf('0x36')]));_0x59713d[_0x2abf('0x35')]=_0x59713d[_0x2abf('0x35')][_0x2abf('0x37')]?_0x59713d[_0x2abf('0x35')]:_0x52dc94['model'];_0x59713d[_0x2abf('0x3a')]=qs[_0x2abf('0x3b')](_0x1e0659['query']['sort']);_0x59713d[_0x2abf('0x3c')]=qs[_0x2abf('0x32')](_[_0x2abf('0x3d')](_0x1e0659[_0x2abf('0x30')],_0x52dc94['filters']));if(_0x1e0659[_0x2abf('0x30')][_0x2abf('0x3e')]){_0x59713d[_0x2abf('0x3c')]=_['merge'](_0x59713d[_0x2abf('0x3c')],{'$or':_[_0x2abf('0x2b')](_0x59713d[_0x2abf('0x35')],function(_0x181f48){var _0x21a5de={};_0x21a5de[_0x181f48]={'$like':'%'+_0x1e0659[_0x2abf('0x30')][_0x2abf('0x3e')]+'%'};return _0x21a5de;})});}_0x59713d=_[_0x2abf('0x3f')]({},_0x59713d,_0x1e0659['options']);return _0x9b66af[_0x2abf('0x4f')](_0x59713d);}})['then'](function(_0xfc78f8){if(_0xfc78f8){_0x66d037=_0xfc78f8[_0x2abf('0x37')];if(!_0x1e0659[_0x2abf('0x30')][_0x2abf('0x38')]('nolimit')){_0x59713d[_0x2abf('0x20')]=qs[_0x2abf('0x20')](_0x1e0659[_0x2abf('0x30')][_0x2abf('0x20')]);_0x59713d[_0x2abf('0x1e')]=qs[_0x2abf('0x1e')](_0x1e0659[_0x2abf('0x30')]['offset']);}return _0x9b66af[_0x2abf('0x4f')](_0x59713d);}})[_0x2abf('0x27')](function(_0x16a282){if(_0x16a282){return _0x16a282?{'count':_0x66d037,'rows':_0x16a282}:null;}})[_0x2abf('0x27')](respondWithResult(_0x86ef4b,null))[_0x2abf('0x45')](handleError(_0x86ef4b,null));}; \ No newline at end of file +var _0xeb7c=['update','then','destroy','error','stack','index','map','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','VtigerConfiguration','findAll','rows','params','rawAttributes','keys','catch','body','find','findOne','getFields','hasOwnProperty','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','json','apply','reject'];(function(_0x308c6a,_0xe04d64){var _0x257b4d=function(_0x31125c){while(--_0x31125c){_0x308c6a['push'](_0x308c6a['shift']());}};_0x257b4d(++_0xe04d64);}(_0xeb7c,0xcb));var _0xceb7=function(_0x625396,_0x454ab6){_0x625396=_0x625396-0x0;var _0x483738=_0xeb7c[_0x625396];return _0x483738;};'use strict';var emlformat=require(_0xceb7('0x0'));var rimraf=require(_0xceb7('0x1'));var zipdir=require(_0xceb7('0x2'));var jsonpatch=require(_0xceb7('0x3'));var rp=require('request-promise');var moment=require(_0xceb7('0x4'));var BPromise=require(_0xceb7('0x5'));var Mustache=require(_0xceb7('0x6'));var util=require('util');var path=require(_0xceb7('0x7'));var sox=require(_0xceb7('0x8'));var csv=require(_0xceb7('0x9'));var ejs=require(_0xceb7('0xa'));var fs=require('fs');var fs_extra=require(_0xceb7('0xb'));var _=require(_0xceb7('0xc'));var squel=require(_0xceb7('0xd'));var crypto=require(_0xceb7('0xe'));var jsforce=require(_0xceb7('0xf'));var deskjs=require(_0xceb7('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xceb7('0x11'));var Redis=require(_0xceb7('0x12'));var authService=require(_0xceb7('0x13'));var qs=require(_0xceb7('0x14'));var as=require(_0xceb7('0x15'));var hardwareService=require(_0xceb7('0x16'));var logger=require('../../config/logger')(_0xceb7('0x17'));var utils=require(_0xceb7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xceb7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e4686,_0x820fe6){_0x820fe6=_0x820fe6||0xcc;return function(_0x4daf45){if(_0x4daf45){return _0x5e4686[_0xceb7('0x1a')](_0x820fe6);}return _0x5e4686[_0xceb7('0x1b')](_0x820fe6)[_0xceb7('0x1c')]();};}function respondWithResult(_0x4ad8a5,_0x23e147){_0x23e147=_0x23e147||0xc8;return function(_0x558433){if(_0x558433){return _0x4ad8a5[_0xceb7('0x1b')](_0x23e147)['json'](_0x558433);}};}function respondWithFilteredResult(_0x3ee599,_0x39ac1a){return function(_0xcc3964){if(_0xcc3964){var _0x27c618=typeof _0x39ac1a[_0xceb7('0x1d')]==='undefined'&&typeof _0x39ac1a[_0xceb7('0x1e')]==='undefined';var _0x563029=_0xcc3964['count'];var _0x2f1b63=_0x27c618?0x0:_0x39ac1a['offset'];var _0x36093e=_0x27c618?_0xcc3964['count']:_0x39ac1a[_0xceb7('0x1d')]+_0x39ac1a['limit'];var _0x5225bf;if(_0x36093e>=_0x563029){_0x36093e=_0x563029;_0x5225bf=0xc8;}else{_0x5225bf=0xce;}_0x3ee599['status'](_0x5225bf);return _0x3ee599['set']('Content-Range',_0x2f1b63+'-'+_0x36093e+'/'+_0x563029)[_0xceb7('0x1f')](_0xcc3964);}return null;};}function patchUpdates(_0x2deff8){return function(_0x52250b){try{jsonpatch[_0xceb7('0x20')](_0x52250b,_0x2deff8,!![]);}catch(_0x32cd7e){return BPromise[_0xceb7('0x21')](_0x32cd7e);}return _0x52250b['save']();};}function saveUpdates(_0x4cde5,_0x528176){return function(_0x40b699){if(_0x40b699){return _0x40b699[_0xceb7('0x22')](_0x4cde5)[_0xceb7('0x23')](function(_0x398cef){return _0x398cef;});}return null;};}function removeEntity(_0x4ba2bc,_0x534afd){return function(_0x40a06f){if(_0x40a06f){return _0x40a06f[_0xceb7('0x24')]()['then'](function(){_0x4ba2bc[_0xceb7('0x1b')](0xcc)[_0xceb7('0x1c')]();});}};}function handleEntityNotFound(_0x1e4fb9,_0x2858f7){return function(_0x3ef3e3){if(!_0x3ef3e3){_0x1e4fb9[_0xceb7('0x1a')](0x194);}return _0x3ef3e3;};}function handleError(_0x5ae48c,_0x26eb9e){_0x26eb9e=_0x26eb9e||0x1f4;return function(_0x422cfa){logger[_0xceb7('0x25')](_0x422cfa[_0xceb7('0x26')]);if(_0x422cfa['name']){delete _0x422cfa['name'];}_0x5ae48c['status'](_0x26eb9e)['send'](_0x422cfa);};}exports[_0xceb7('0x27')]=function(_0x365337,_0x4adb58){var _0x354fff={},_0x286b9a={},_0x5b79c5={'count':0x0,'rows':[]};var _0x4222e5=_[_0xceb7('0x28')](db['VtigerConfiguration']['rawAttributes'],function(_0x2dfd3d){return{'name':_0x2dfd3d[_0xceb7('0x29')],'type':_0x2dfd3d[_0xceb7('0x2a')][_0xceb7('0x2b')]};});_0x286b9a['model']=_[_0xceb7('0x28')](_0x4222e5,_0xceb7('0x2c'));_0x286b9a[_0xceb7('0x2d')]=_['keys'](_0x365337[_0xceb7('0x2d')]);_0x286b9a[_0xceb7('0x2e')]=_[_0xceb7('0x2f')](_0x286b9a[_0xceb7('0x30')],_0x286b9a[_0xceb7('0x2d')]);_0x354fff[_0xceb7('0x31')]=_[_0xceb7('0x2f')](_0x286b9a[_0xceb7('0x30')],qs[_0xceb7('0x32')](_0x365337[_0xceb7('0x2d')][_0xceb7('0x32')]));_0x354fff[_0xceb7('0x31')]=_0x354fff[_0xceb7('0x31')][_0xceb7('0x33')]?_0x354fff[_0xceb7('0x31')]:_0x286b9a[_0xceb7('0x30')];if(!_0x365337[_0xceb7('0x2d')]['hasOwnProperty'](_0xceb7('0x34'))){_0x354fff[_0xceb7('0x1e')]=qs[_0xceb7('0x1e')](_0x365337['query'][_0xceb7('0x1e')]);_0x354fff[_0xceb7('0x1d')]=qs[_0xceb7('0x1d')](_0x365337[_0xceb7('0x2d')][_0xceb7('0x1d')]);}_0x354fff[_0xceb7('0x35')]=qs[_0xceb7('0x36')](_0x365337[_0xceb7('0x2d')][_0xceb7('0x36')]);_0x354fff['where']=qs[_0xceb7('0x2e')](_[_0xceb7('0x37')](_0x365337[_0xceb7('0x2d')],_0x286b9a[_0xceb7('0x2e')]),_0x4222e5);if(_0x365337['query'][_0xceb7('0x38')]){_0x354fff[_0xceb7('0x39')]=_[_0xceb7('0x3a')](_0x354fff['where'],{'$or':_['map'](_0x4222e5,function(_0x480a6e){if(_0x480a6e['type']!==_0xceb7('0x3b')){var _0x3b4666={};_0x3b4666[_0x480a6e['name']]={'$like':'%'+_0x365337['query'][_0xceb7('0x38')]+'%'};return _0x3b4666;}})});}_0x354fff=_['merge']({},_0x354fff,_0x365337[_0xceb7('0x3c')]);var _0x9cdc04={'where':_0x354fff['where']};return db['VtigerConfiguration'][_0xceb7('0x3d')](_0x9cdc04)[_0xceb7('0x23')](function(_0x4c2aca){_0x5b79c5[_0xceb7('0x3d')]=_0x4c2aca;if(_0x365337[_0xceb7('0x2d')][_0xceb7('0x3e')]){_0x354fff[_0xceb7('0x3f')]=[{'all':!![]}];}return db[_0xceb7('0x40')][_0xceb7('0x41')](_0x354fff);})[_0xceb7('0x23')](function(_0x1ddda6){_0x5b79c5[_0xceb7('0x42')]=_0x1ddda6;return _0x5b79c5;})[_0xceb7('0x23')](respondWithFilteredResult(_0x4adb58,_0x354fff))['catch'](handleError(_0x4adb58,null));};exports['show']=function(_0x5d1ac1,_0x3a13fa){var _0x490d21={'raw':![],'where':{'id':_0x5d1ac1[_0xceb7('0x43')]['id']}},_0x3273e3={};_0x3273e3['model']=_['keys'](db[_0xceb7('0x40')][_0xceb7('0x44')]);_0x3273e3[_0xceb7('0x2d')]=_[_0xceb7('0x45')](_0x5d1ac1[_0xceb7('0x2d')]);_0x3273e3[_0xceb7('0x2e')]=_[_0xceb7('0x2f')](_0x3273e3[_0xceb7('0x30')],_0x3273e3[_0xceb7('0x2d')]);_0x490d21[_0xceb7('0x31')]=_[_0xceb7('0x2f')](_0x3273e3[_0xceb7('0x30')],qs[_0xceb7('0x32')](_0x5d1ac1[_0xceb7('0x2d')][_0xceb7('0x32')]));_0x490d21[_0xceb7('0x31')]=_0x490d21[_0xceb7('0x31')][_0xceb7('0x33')]?_0x490d21[_0xceb7('0x31')]:_0x3273e3[_0xceb7('0x30')];if(_0x5d1ac1[_0xceb7('0x2d')][_0xceb7('0x3e')]){_0x490d21[_0xceb7('0x3f')]=[{'all':!![]}];}_0x490d21=_[_0xceb7('0x3a')]({},_0x490d21,_0x5d1ac1[_0xceb7('0x3c')]);return db['VtigerConfiguration']['find'](_0x490d21)[_0xceb7('0x23')](handleEntityNotFound(_0x3a13fa,null))[_0xceb7('0x23')](respondWithResult(_0x3a13fa,null))[_0xceb7('0x46')](handleError(_0x3a13fa,null));};exports['create']=function(_0x4a0693,_0x5a6d81){return db[_0xceb7('0x40')]['create'](_0x4a0693[_0xceb7('0x47')],{})[_0xceb7('0x23')](respondWithResult(_0x5a6d81,0xc9))['catch'](handleError(_0x5a6d81,null));};exports['update']=function(_0x580d05,_0x1955f5){if(_0x580d05[_0xceb7('0x47')]['id']){delete _0x580d05[_0xceb7('0x47')]['id'];}return db[_0xceb7('0x40')][_0xceb7('0x48')]({'where':{'id':_0x580d05['params']['id']}})['then'](handleEntityNotFound(_0x1955f5,null))[_0xceb7('0x23')](saveUpdates(_0x580d05[_0xceb7('0x47')],null))['then'](respondWithResult(_0x1955f5,null))[_0xceb7('0x46')](handleError(_0x1955f5,null));};exports[_0xceb7('0x24')]=function(_0x1b2757,_0x3e167a){return db[_0xceb7('0x40')][_0xceb7('0x48')]({'where':{'id':_0x1b2757['params']['id']}})[_0xceb7('0x23')](handleEntityNotFound(_0x3e167a,null))[_0xceb7('0x23')](removeEntity(_0x3e167a,null))[_0xceb7('0x46')](handleError(_0x3e167a,null));};exports['getFields']=function(_0x30781c,_0x47b0c4,_0xbefb40){var _0x667ae8={};var _0x1b4680={};var _0x5068c6;var _0x88f91c;return db[_0xceb7('0x40')][_0xceb7('0x49')]({'where':{'id':_0x30781c['params']['id']}})[_0xceb7('0x23')](handleEntityNotFound(_0x47b0c4,null))[_0xceb7('0x23')](function(_0x57635f){if(_0x57635f){_0x5068c6=_0x57635f;_0x1b4680[_0xceb7('0x30')]=_[_0xceb7('0x45')](db['VtigerField'][_0xceb7('0x44')]);_0x1b4680[_0xceb7('0x2d')]=_[_0xceb7('0x45')](_0x30781c['query']);_0x1b4680[_0xceb7('0x2e')]=_['intersection'](_0x1b4680[_0xceb7('0x30')],_0x1b4680[_0xceb7('0x2d')]);_0x667ae8[_0xceb7('0x31')]=_[_0xceb7('0x2f')](_0x1b4680[_0xceb7('0x30')],qs['fields'](_0x30781c[_0xceb7('0x2d')][_0xceb7('0x32')]));_0x667ae8[_0xceb7('0x31')]=_0x667ae8[_0xceb7('0x31')][_0xceb7('0x33')]?_0x667ae8[_0xceb7('0x31')]:_0x1b4680['model'];_0x667ae8[_0xceb7('0x35')]=qs[_0xceb7('0x36')](_0x30781c['query'][_0xceb7('0x36')]);_0x667ae8[_0xceb7('0x39')]=qs[_0xceb7('0x2e')](_[_0xceb7('0x37')](_0x30781c['query'],_0x1b4680['filters']));if(_0x30781c[_0xceb7('0x2d')][_0xceb7('0x38')]){_0x667ae8[_0xceb7('0x39')]=_[_0xceb7('0x3a')](_0x667ae8[_0xceb7('0x39')],{'$or':_[_0xceb7('0x28')](_0x667ae8[_0xceb7('0x31')],function(_0x251f21){var _0x3b9497={};_0x3b9497[_0x251f21]={'$like':'%'+_0x30781c[_0xceb7('0x2d')][_0xceb7('0x38')]+'%'};return _0x3b9497;})});}_0x667ae8=_[_0xceb7('0x3a')]({},_0x667ae8,_0x30781c[_0xceb7('0x3c')]);return _0x5068c6[_0xceb7('0x4a')](_0x667ae8);}})['then'](function(_0x36917e){if(_0x36917e){_0x88f91c=_0x36917e[_0xceb7('0x33')];if(!_0x30781c[_0xceb7('0x2d')][_0xceb7('0x4b')](_0xceb7('0x34'))){_0x667ae8[_0xceb7('0x1e')]=qs[_0xceb7('0x1e')](_0x30781c[_0xceb7('0x2d')][_0xceb7('0x1e')]);_0x667ae8[_0xceb7('0x1d')]=qs['offset'](_0x30781c[_0xceb7('0x2d')]['offset']);}return _0x5068c6[_0xceb7('0x4a')](_0x667ae8);}})['then'](function(_0x138d85){if(_0x138d85){return _0x138d85?{'count':_0x88f91c,'rows':_0x138d85}:null;}})[_0xceb7('0x23')](respondWithResult(_0x47b0c4,null))[_0xceb7('0x46')](handleError(_0x47b0c4,null));};exports[_0xceb7('0x4c')]=function(_0x5543ce,_0x3ee0c1,_0x10c785){var _0x2ae338={};var _0x16c234={};var _0x52677a;var _0x29522e;return db[_0xceb7('0x40')][_0xceb7('0x49')]({'where':{'id':_0x5543ce[_0xceb7('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ee0c1,null))['then'](function(_0x260120){if(_0x260120){_0x52677a=_0x260120;_0x16c234[_0xceb7('0x30')]=_[_0xceb7('0x45')](db[_0xceb7('0x4d')]['rawAttributes']);_0x16c234[_0xceb7('0x2d')]=_[_0xceb7('0x45')](_0x5543ce[_0xceb7('0x2d')]);_0x16c234[_0xceb7('0x2e')]=_[_0xceb7('0x2f')](_0x16c234['model'],_0x16c234[_0xceb7('0x2d')]);_0x2ae338[_0xceb7('0x31')]=_['intersection'](_0x16c234['model'],qs[_0xceb7('0x32')](_0x5543ce[_0xceb7('0x2d')][_0xceb7('0x32')]));_0x2ae338[_0xceb7('0x31')]=_0x2ae338['attributes'][_0xceb7('0x33')]?_0x2ae338[_0xceb7('0x31')]:_0x16c234[_0xceb7('0x30')];_0x2ae338[_0xceb7('0x35')]=qs[_0xceb7('0x36')](_0x5543ce[_0xceb7('0x2d')][_0xceb7('0x36')]);_0x2ae338[_0xceb7('0x39')]=qs['filters'](_[_0xceb7('0x37')](_0x5543ce['query'],_0x16c234[_0xceb7('0x2e')]));if(_0x5543ce[_0xceb7('0x2d')][_0xceb7('0x38')]){_0x2ae338[_0xceb7('0x39')]=_[_0xceb7('0x3a')](_0x2ae338[_0xceb7('0x39')],{'$or':_[_0xceb7('0x28')](_0x2ae338[_0xceb7('0x31')],function(_0x1a7c1f){var _0xc1ac10={};_0xc1ac10[_0x1a7c1f]={'$like':'%'+_0x5543ce[_0xceb7('0x2d')]['filter']+'%'};return _0xc1ac10;})});}_0x2ae338=_[_0xceb7('0x3a')]({},_0x2ae338,_0x5543ce[_0xceb7('0x3c')]);return _0x52677a['getSubjects'](_0x2ae338);}})[_0xceb7('0x23')](function(_0x567691){if(_0x567691){_0x29522e=_0x567691[_0xceb7('0x33')];if(!_0x5543ce[_0xceb7('0x2d')][_0xceb7('0x4b')](_0xceb7('0x34'))){_0x2ae338[_0xceb7('0x1e')]=qs[_0xceb7('0x1e')](_0x5543ce[_0xceb7('0x2d')][_0xceb7('0x1e')]);_0x2ae338[_0xceb7('0x1d')]=qs['offset'](_0x5543ce[_0xceb7('0x2d')][_0xceb7('0x1d')]);}return _0x52677a['getSubjects'](_0x2ae338);}})['then'](function(_0x6fb1c2){if(_0x6fb1c2){return _0x6fb1c2?{'count':_0x29522e,'rows':_0x6fb1c2}:null;}})[_0xceb7('0x23')](respondWithResult(_0x3ee0c1,null))[_0xceb7('0x46')](handleError(_0x3ee0c1,null));};exports[_0xceb7('0x4e')]=function(_0x5bd829,_0xa69a6b,_0x567ed9){var _0xdfa4df={};var _0x3d8742={};var _0x3f5dd5;var _0x567cdd;return db[_0xceb7('0x40')][_0xceb7('0x49')]({'where':{'id':_0x5bd829[_0xceb7('0x43')]['id']}})[_0xceb7('0x23')](handleEntityNotFound(_0xa69a6b,null))[_0xceb7('0x23')](function(_0x27f578){if(_0x27f578){_0x3f5dd5=_0x27f578;_0x3d8742['model']=_['keys'](db['VtigerField'][_0xceb7('0x44')]);_0x3d8742[_0xceb7('0x2d')]=_[_0xceb7('0x45')](_0x5bd829['query']);_0x3d8742['filters']=_[_0xceb7('0x2f')](_0x3d8742['model'],_0x3d8742[_0xceb7('0x2d')]);_0xdfa4df[_0xceb7('0x31')]=_[_0xceb7('0x2f')](_0x3d8742[_0xceb7('0x30')],qs['fields'](_0x5bd829[_0xceb7('0x2d')]['fields']));_0xdfa4df['attributes']=_0xdfa4df['attributes']['length']?_0xdfa4df[_0xceb7('0x31')]:_0x3d8742[_0xceb7('0x30')];_0xdfa4df[_0xceb7('0x35')]=qs[_0xceb7('0x36')](_0x5bd829[_0xceb7('0x2d')]['sort']);_0xdfa4df[_0xceb7('0x39')]=qs[_0xceb7('0x2e')](_[_0xceb7('0x37')](_0x5bd829['query'],_0x3d8742[_0xceb7('0x2e')]));if(_0x5bd829['query'][_0xceb7('0x38')]){_0xdfa4df[_0xceb7('0x39')]=_[_0xceb7('0x3a')](_0xdfa4df[_0xceb7('0x39')],{'$or':_[_0xceb7('0x28')](_0xdfa4df[_0xceb7('0x31')],function(_0x10acb8){var _0x306e59={};_0x306e59[_0x10acb8]={'$like':'%'+_0x5bd829[_0xceb7('0x2d')][_0xceb7('0x38')]+'%'};return _0x306e59;})});}_0xdfa4df=_[_0xceb7('0x3a')]({},_0xdfa4df,_0x5bd829[_0xceb7('0x3c')]);return _0x3f5dd5[_0xceb7('0x4e')](_0xdfa4df);}})[_0xceb7('0x23')](function(_0x51a420){if(_0x51a420){_0x567cdd=_0x51a420[_0xceb7('0x33')];if(!_0x5bd829[_0xceb7('0x2d')][_0xceb7('0x4b')](_0xceb7('0x34'))){_0xdfa4df[_0xceb7('0x1e')]=qs[_0xceb7('0x1e')](_0x5bd829[_0xceb7('0x2d')]['limit']);_0xdfa4df[_0xceb7('0x1d')]=qs[_0xceb7('0x1d')](_0x5bd829[_0xceb7('0x2d')][_0xceb7('0x1d')]);}return _0x3f5dd5['getDescriptions'](_0xdfa4df);}})[_0xceb7('0x23')](function(_0x41509d){if(_0x41509d){return _0x41509d?{'count':_0x567cdd,'rows':_0x41509d}:null;}})[_0xceb7('0x23')](respondWithResult(_0xa69a6b,null))[_0xceb7('0x46')](handleError(_0xa69a6b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 66df311..e460435 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 _0x2b54=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','rimraf'];(function(_0x1db347,_0x50526b){var _0x4ec95f=function(_0x311de3){while(--_0x311de3){_0x1db347['push'](_0x1db347['shift']());}};_0x4ec95f(++_0x50526b);}(_0x2b54,0xcd));var _0x42b5=function(_0x271e60,_0x3b3af3){_0x271e60=_0x271e60-0x0;var _0x3c81f7=_0x2b54[_0x271e60];return _0x3c81f7;};'use strict';var _=require(_0x42b5('0x0'));var util=require(_0x42b5('0x1'));var logger=require('../../config/logger')(_0x42b5('0x2'));var moment=require(_0x42b5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x42b5('0x4'));var config=require(_0x42b5('0x5'));var attributes=require(_0x42b5('0x6'));module['exports']=function(_0x2ef088,_0x2accd5){return _0x2ef088[_0x42b5('0x7')](_0x42b5('0x8'),attributes,{'tableName':_0x42b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a4b=['VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x27b404,_0x597b32){var _0x4ea80b=function(_0x20b9c0){while(--_0x20b9c0){_0x27b404['push'](_0x27b404['shift']());}};_0x4ea80b(++_0x597b32);}(_0x0a4b,0x1b4));var _0xb0a4=function(_0x273112,_0x4eb5dd){_0x273112=_0x273112-0x0;var _0x42b480=_0x0a4b[_0x273112];return _0x42b480;};'use strict';var _=require(_0xb0a4('0x0'));var util=require('util');var logger=require(_0xb0a4('0x1'))(_0xb0a4('0x2'));var moment=require(_0xb0a4('0x3'));var BPromise=require(_0xb0a4('0x4'));var rp=require(_0xb0a4('0x5'));var fs=require('fs');var path=require(_0xb0a4('0x6'));var rimraf=require(_0xb0a4('0x7'));var config=require(_0xb0a4('0x8'));var attributes=require(_0xb0a4('0x9'));module[_0xb0a4('0xa')]=function(_0xca0ac9,_0x387939){return _0xca0ac9[_0xb0a4('0xb')](_0xb0a4('0xc'),attributes,{'tableName':_0xb0a4('0xd'),'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 0f201a0..5da4a2a 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 _0xa164=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xa164,0x13e));var _0x4a16=function(_0x7750c9,_0x205ccc){_0x7750c9=_0x7750c9-0x0;var _0x57f2c0=_0xa164[_0x7750c9];return _0x57f2c0;};'use strict';var _=require(_0x4a16('0x0'));var util=require(_0x4a16('0x1'));var moment=require('moment');var BPromise=require(_0x4a16('0x2'));var rs=require(_0x4a16('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a16('0x4'))['db'];var utils=require(_0x4a16('0x5'));var logger=require(_0x4a16('0x6'))(_0x4a16('0x7'));var config=require(_0x4a16('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a16('0x9')][_0x4a16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48c2a9,_0x49eab4,_0x115359){return new BPromise(function(_0x3c55b5,_0x43be5e){return client[_0x4a16('0xb')](_0x48c2a9,_0x115359)[_0x4a16('0xc')](function(_0x2c076f){logger[_0x4a16('0xd')](_0x4a16('0xe'),_0x49eab4,_0x4a16('0xf'));logger[_0x4a16('0x10')](_0x4a16('0x11'),_0x49eab4,_0x4a16('0xf'),JSON[_0x4a16('0x12')](_0x2c076f));if(_0x2c076f[_0x4a16('0x13')]){if(_0x2c076f[_0x4a16('0x13')][_0x4a16('0x14')]===0x1f4){logger[_0x4a16('0x13')](_0x4a16('0xe'),_0x49eab4,_0x2c076f[_0x4a16('0x13')][_0x4a16('0x15')]);return _0x43be5e(_0x2c076f[_0x4a16('0x13')]['message']);}logger[_0x4a16('0x13')](_0x4a16('0xe'),_0x49eab4,_0x2c076f[_0x4a16('0x13')][_0x4a16('0x15')]);return _0x3c55b5(_0x2c076f[_0x4a16('0x13')][_0x4a16('0x15')]);}else{logger[_0x4a16('0xd')](_0x4a16('0xe'),_0x49eab4,_0x4a16('0xf'));_0x3c55b5(_0x2c076f[_0x4a16('0x16')][_0x4a16('0x15')]);}})[_0x4a16('0x17')](function(_0x5a43b4){logger[_0x4a16('0x13')](_0x4a16('0xe'),_0x49eab4,_0x5a43b4);_0x43be5e(_0x5a43b4);});});} \ No newline at end of file +var _0xba2d=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xba2d,0xeb));var _0xdba2=function(_0x4133d3,_0x201a09){_0x4133d3=_0x4133d3-0x0;var _0x3699eb=_0xba2d[_0x4133d3];return _0x3699eb;};'use strict';var _=require('lodash');var util=require(_0xdba2('0x0'));var moment=require('moment');var BPromise=require(_0xdba2('0x1'));var rs=require(_0xdba2('0x2'));var fs=require('fs');var Redis=require(_0xdba2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdba2('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdba2('0x5'));var jayson=require(_0xdba2('0x6'));var client=jayson[_0xdba2('0x7')][_0xdba2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ba8b,_0x58daef,_0x4274c8){return new BPromise(function(_0x103da0,_0x388fc2){return client[_0xdba2('0x9')](_0x25ba8b,_0x4274c8)[_0xdba2('0xa')](function(_0x57d62f){logger[_0xdba2('0xb')](_0xdba2('0xc'),_0x58daef,_0xdba2('0xd'));logger['debug'](_0xdba2('0xe'),_0x58daef,_0xdba2('0xd'),JSON['stringify'](_0x57d62f));if(_0x57d62f[_0xdba2('0xf')]){if(_0x57d62f[_0xdba2('0xf')]['code']===0x1f4){logger[_0xdba2('0xf')](_0xdba2('0xc'),_0x58daef,_0x57d62f[_0xdba2('0xf')][_0xdba2('0x10')]);return _0x388fc2(_0x57d62f[_0xdba2('0xf')][_0xdba2('0x10')]);}logger[_0xdba2('0xf')](_0xdba2('0xc'),_0x58daef,_0x57d62f[_0xdba2('0xf')][_0xdba2('0x10')]);return _0x103da0(_0x57d62f[_0xdba2('0xf')][_0xdba2('0x10')]);}else{logger[_0xdba2('0xb')](_0xdba2('0xc'),_0x58daef,_0xdba2('0xd'));_0x103da0(_0x57d62f[_0xdba2('0x11')]['message']);}})[_0xdba2('0x12')](function(_0x4c3f1d){logger['error'](_0xdba2('0xc'),_0x58daef,_0x4c3f1d);_0x388fc2(_0x4c3f1d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 26d3d9f..dd857f0 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 _0x2895=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','/:id'];(function(_0x5aac98,_0x5457f2){var _0x348643=function(_0x29bdb6){while(--_0x29bdb6){_0x5aac98['push'](_0x5aac98['shift']());}};_0x348643(++_0x5457f2);}(_0x2895,0x1ce));var _0x5289=function(_0x2ca103,_0x55400c){_0x2ca103=_0x2ca103-0x0;var _0x2e6cc2=_0x2895[_0x2ca103];return _0x2e6cc2;};'use strict';var multer=require(_0x5289('0x0'));var util=require(_0x5289('0x1'));var path=require(_0x5289('0x2'));var timeout=require(_0x5289('0x3'));var express=require(_0x5289('0x4'));var router=express[_0x5289('0x5')]();var fs_extra=require(_0x5289('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5289('0x7'));var controller=require(_0x5289('0x8'));router[_0x5289('0x9')]('/',auth[_0x5289('0xa')](),controller[_0x5289('0xb')]);router[_0x5289('0x9')]('/:id',auth[_0x5289('0xa')](),controller[_0x5289('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5289('0xd'),auth['isAuthenticated'](),controller[_0x5289('0xe')]);router[_0x5289('0xf')](_0x5289('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5289('0x10')]=router; \ No newline at end of file +var _0x9323=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x2fdf42,_0x3d72c6){var _0x356a98=function(_0x1c8c7c){while(--_0x1c8c7c){_0x2fdf42['push'](_0x2fdf42['shift']());}};_0x356a98(++_0x3d72c6);}(_0x9323,0x118));var _0x3932=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9323[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x3932('0x0'));var util=require(_0x3932('0x1'));var path=require('path');var timeout=require(_0x3932('0x2'));var express=require(_0x3932('0x3'));var router=express['Router']();var fs_extra=require(_0x3932('0x4'));var auth=require(_0x3932('0x5'));var interaction=require(_0x3932('0x6'));var config=require(_0x3932('0x7'));var controller=require('./intVtigerField.controller');router[_0x3932('0x8')]('/',auth[_0x3932('0x9')](),controller[_0x3932('0xa')]);router[_0x3932('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3932('0xb')]);router[_0x3932('0xc')]('/',auth[_0x3932('0x9')](),controller[_0x3932('0xd')]);router[_0x3932('0xe')](_0x3932('0xf'),auth[_0x3932('0x9')](),controller[_0x3932('0x10')]);router[_0x3932('0x11')](_0x3932('0xf'),auth[_0x3932('0x9')](),controller[_0x3932('0x12')]);module[_0x3932('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 bddc27e..018492d 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 _0xc6d3=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc6d3,0x70));var _0x3c6d=function(_0x2d663c,_0x4b8eee){_0x2d663c=_0x2d663c-0x0;var _0x5af4dd=_0xc6d3[_0x2d663c];return _0x5af4dd;};'use strict';var Sequelize=require(_0x3c6d('0x0'));module[_0x3c6d('0x1')]={'type':{'type':Sequelize[_0x3c6d('0x2')]('string',_0x3c6d('0x3'),_0x3c6d('0x4'),_0x3c6d('0x5'),_0x3c6d('0x6')),'defaultValue':_0x3c6d('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3c6d('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x3c6d('0x7'),_0x3c6d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3c6d('0x8')]},'customField':{'type':Sequelize[_0x3c6d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c6d('0x8')]}}; \ No newline at end of file +var _0x3391=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x30fe56,_0x32ac39){var _0x409a20=function(_0x31085f){while(--_0x31085f){_0x30fe56['push'](_0x30fe56['shift']());}};_0x409a20(++_0x32ac39);}(_0x3391,0x17a));var _0x1339=function(_0x10dd98,_0x49779c){_0x10dd98=_0x10dd98-0x0;var _0x47a90e=_0x3391[_0x10dd98];return _0x47a90e;};'use strict';var Sequelize=require(_0x1339('0x0'));module[_0x1339('0x1')]={'type':{'type':Sequelize[_0x1339('0x2')](_0x1339('0x3'),_0x1339('0x4'),_0x1339('0x5'),_0x1339('0x6'),_0x1339('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1339('0x2')](_0x1339('0x3'),'variable',_0x1339('0x5'))},'keyContent':{'type':Sequelize[_0x1339('0x8')]},'idField':{'type':Sequelize[_0x1339('0x8')]},'nameField':{'type':Sequelize[_0x1339('0x8')]},'customField':{'type':Sequelize[_0x1339('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1339('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 1c6d71d..12f425f 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 _0x13e2=['intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','catch','show','params','includeAll','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','save','then','destroy','error','name','send','index','map','VtigerField','rawAttributes','fieldName','model','query','keys','filters','attributes'];(function(_0x131203,_0x5b8f2b){var _0x373025=function(_0x5772de){while(--_0x5772de){_0x131203['push'](_0x131203['shift']());}};_0x373025(++_0x5b8f2b);}(_0x13e2,0x142));var _0x213e=function(_0x4e74e7,_0x20e1d4){_0x4e74e7=_0x4e74e7-0x0;var _0x216db7=_0x13e2[_0x4e74e7];return _0x216db7;};'use strict';var emlformat=require(_0x213e('0x0'));var rimraf=require(_0x213e('0x1'));var zipdir=require(_0x213e('0x2'));var jsonpatch=require(_0x213e('0x3'));var rp=require(_0x213e('0x4'));var moment=require(_0x213e('0x5'));var BPromise=require(_0x213e('0x6'));var Mustache=require(_0x213e('0x7'));var util=require(_0x213e('0x8'));var path=require('path');var sox=require(_0x213e('0x9'));var csv=require(_0x213e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x213e('0xb'));var squel=require(_0x213e('0xc'));var crypto=require(_0x213e('0xd'));var jsforce=require(_0x213e('0xe'));var deskjs=require(_0x213e('0xf'));var toCsv=require(_0x213e('0xa'));var querystring=require(_0x213e('0x10'));var Papa=require(_0x213e('0x11'));var Redis=require(_0x213e('0x12'));var authService=require(_0x213e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x213e('0x14'));var hardwareService=require(_0x213e('0x15'));var logger=require(_0x213e('0x16'))(_0x213e('0x17'));var utils=require('../../config/utils');var config=require(_0x213e('0x18'));var licenseUtil=require(_0x213e('0x19'));var db=require(_0x213e('0x1a'))['db'];function respondWithStatusCode(_0x5766b4,_0x414f99){_0x414f99=_0x414f99||0xcc;return function(_0x274771){if(_0x274771){return _0x5766b4['sendStatus'](_0x414f99);}return _0x5766b4['status'](_0x414f99)[_0x213e('0x1b')]();};}function respondWithResult(_0x5a2057,_0x36edc9){_0x36edc9=_0x36edc9||0xc8;return function(_0x51ea1d){if(_0x51ea1d){return _0x5a2057[_0x213e('0x1c')](_0x36edc9)['json'](_0x51ea1d);}};}function respondWithFilteredResult(_0x4b5bd7,_0x4e439d){return function(_0x9b14ce){if(_0x9b14ce){var _0x5c0250=typeof _0x4e439d[_0x213e('0x1d')]===_0x213e('0x1e')&&typeof _0x4e439d[_0x213e('0x1f')]===_0x213e('0x1e');var _0x232971=_0x9b14ce[_0x213e('0x20')];var _0x5d5d05=_0x5c0250?0x0:_0x4e439d['offset'];var _0x53d0c0=_0x5c0250?_0x9b14ce['count']:_0x4e439d[_0x213e('0x1d')]+_0x4e439d[_0x213e('0x1f')];var _0x524d8f;if(_0x53d0c0>=_0x232971){_0x53d0c0=_0x232971;_0x524d8f=0xc8;}else{_0x524d8f=0xce;}_0x4b5bd7[_0x213e('0x1c')](_0x524d8f);return _0x4b5bd7[_0x213e('0x21')](_0x213e('0x22'),_0x5d5d05+'-'+_0x53d0c0+'/'+_0x232971)[_0x213e('0x23')](_0x9b14ce);}return null;};}function patchUpdates(_0x11652f){return function(_0x5ceb58){try{jsonpatch[_0x213e('0x24')](_0x5ceb58,_0x11652f,!![]);}catch(_0x1f2db9){return BPromise['reject'](_0x1f2db9);}return _0x5ceb58[_0x213e('0x25')]();};}function saveUpdates(_0x2fc321,_0x518a65){return function(_0x5ef50c){if(_0x5ef50c){return _0x5ef50c['update'](_0x2fc321)[_0x213e('0x26')](function(_0x4ebbe7){return _0x4ebbe7;});}return null;};}function removeEntity(_0x36b950,_0x4265ec){return function(_0x2b32e3){if(_0x2b32e3){return _0x2b32e3[_0x213e('0x27')]()[_0x213e('0x26')](function(){_0x36b950[_0x213e('0x1c')](0xcc)[_0x213e('0x1b')]();});}};}function handleEntityNotFound(_0x57bda5,_0x9d5732){return function(_0x3fb09a){if(!_0x3fb09a){_0x57bda5['sendStatus'](0x194);}return _0x3fb09a;};}function handleError(_0x3d7979,_0x2cfe90){_0x2cfe90=_0x2cfe90||0x1f4;return function(_0x5e80cb){logger[_0x213e('0x28')](_0x5e80cb['stack']);if(_0x5e80cb[_0x213e('0x29')]){delete _0x5e80cb[_0x213e('0x29')];}_0x3d7979['status'](_0x2cfe90)[_0x213e('0x2a')](_0x5e80cb);};}exports[_0x213e('0x2b')]=function(_0x50b507,_0x39449b){var _0x8266b={},_0x2e712c={},_0x36f332={'count':0x0,'rows':[]};var _0x35059d=_[_0x213e('0x2c')](db[_0x213e('0x2d')][_0x213e('0x2e')],function(_0x4b0214){return{'name':_0x4b0214[_0x213e('0x2f')],'type':_0x4b0214['type']['key']};});_0x2e712c[_0x213e('0x30')]=_[_0x213e('0x2c')](_0x35059d,_0x213e('0x29'));_0x2e712c[_0x213e('0x31')]=_[_0x213e('0x32')](_0x50b507[_0x213e('0x31')]);_0x2e712c[_0x213e('0x33')]=_['intersection'](_0x2e712c[_0x213e('0x30')],_0x2e712c[_0x213e('0x31')]);_0x8266b[_0x213e('0x34')]=_[_0x213e('0x35')](_0x2e712c[_0x213e('0x30')],qs[_0x213e('0x36')](_0x50b507[_0x213e('0x31')][_0x213e('0x36')]));_0x8266b['attributes']=_0x8266b[_0x213e('0x34')][_0x213e('0x37')]?_0x8266b['attributes']:_0x2e712c['model'];if(!_0x50b507[_0x213e('0x31')]['hasOwnProperty'](_0x213e('0x38'))){_0x8266b[_0x213e('0x1f')]=qs['limit'](_0x50b507[_0x213e('0x31')][_0x213e('0x1f')]);_0x8266b[_0x213e('0x1d')]=qs[_0x213e('0x1d')](_0x50b507[_0x213e('0x31')][_0x213e('0x1d')]);}_0x8266b[_0x213e('0x39')]=qs['sort'](_0x50b507[_0x213e('0x31')][_0x213e('0x3a')]);_0x8266b['where']=qs[_0x213e('0x33')](_[_0x213e('0x3b')](_0x50b507[_0x213e('0x31')],_0x2e712c[_0x213e('0x33')]),_0x35059d);if(_0x50b507['query'][_0x213e('0x3c')]){_0x8266b[_0x213e('0x3d')]=_[_0x213e('0x3e')](_0x8266b[_0x213e('0x3d')],{'$or':_[_0x213e('0x2c')](_0x35059d,function(_0x19f239){if(_0x19f239[_0x213e('0x3f')]!=='VIRTUAL'){var _0x343849={};_0x343849[_0x19f239[_0x213e('0x29')]]={'$like':'%'+_0x50b507[_0x213e('0x31')][_0x213e('0x3c')]+'%'};return _0x343849;}})});}_0x8266b=_[_0x213e('0x3e')]({},_0x8266b,_0x50b507['options']);var _0x1e4dc8={'where':_0x8266b[_0x213e('0x3d')]};return db[_0x213e('0x2d')][_0x213e('0x20')](_0x1e4dc8)['then'](function(_0x13a271){_0x36f332['count']=_0x13a271;if(_0x50b507[_0x213e('0x31')]['includeAll']){_0x8266b[_0x213e('0x40')]=[{'all':!![]}];}return db[_0x213e('0x2d')][_0x213e('0x41')](_0x8266b);})[_0x213e('0x26')](function(_0x5d63f7){_0x36f332['rows']=_0x5d63f7;return _0x36f332;})[_0x213e('0x26')](respondWithFilteredResult(_0x39449b,_0x8266b))[_0x213e('0x42')](handleError(_0x39449b,null));};exports[_0x213e('0x43')]=function(_0x1a5c5d,_0x4a909f){var _0x367ffa={'raw':!![],'where':{'id':_0x1a5c5d[_0x213e('0x44')]['id']}},_0x489edc={};_0x489edc[_0x213e('0x30')]=_[_0x213e('0x32')](db[_0x213e('0x2d')][_0x213e('0x2e')]);_0x489edc[_0x213e('0x31')]=_[_0x213e('0x32')](_0x1a5c5d[_0x213e('0x31')]);_0x489edc[_0x213e('0x33')]=_[_0x213e('0x35')](_0x489edc['model'],_0x489edc[_0x213e('0x31')]);_0x367ffa[_0x213e('0x34')]=_['intersection'](_0x489edc[_0x213e('0x30')],qs['fields'](_0x1a5c5d['query'][_0x213e('0x36')]));_0x367ffa[_0x213e('0x34')]=_0x367ffa['attributes']['length']?_0x367ffa[_0x213e('0x34')]:_0x489edc[_0x213e('0x30')];if(_0x1a5c5d[_0x213e('0x31')][_0x213e('0x45')]){_0x367ffa[_0x213e('0x40')]=[{'all':!![]}];}_0x367ffa=_['merge']({},_0x367ffa,_0x1a5c5d[_0x213e('0x46')]);return db['VtigerField'][_0x213e('0x47')](_0x367ffa)[_0x213e('0x26')](handleEntityNotFound(_0x4a909f,null))[_0x213e('0x26')](respondWithResult(_0x4a909f,null))[_0x213e('0x42')](handleError(_0x4a909f,null));};exports[_0x213e('0x48')]=function(_0x447be7,_0x993a3){return db['VtigerField'][_0x213e('0x48')](_0x447be7[_0x213e('0x49')],{})[_0x213e('0x26')](respondWithResult(_0x993a3,0xc9))['catch'](handleError(_0x993a3,null));};exports[_0x213e('0x4a')]=function(_0x43fb77,_0x4aa131){if(_0x43fb77['body']['id']){delete _0x43fb77[_0x213e('0x49')]['id'];}return db[_0x213e('0x2d')][_0x213e('0x47')]({'where':{'id':_0x43fb77[_0x213e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4aa131,null))['then'](saveUpdates(_0x43fb77[_0x213e('0x49')],null))[_0x213e('0x26')](respondWithResult(_0x4aa131,null))[_0x213e('0x42')](handleError(_0x4aa131,null));};exports[_0x213e('0x27')]=function(_0x366f09,_0x44fc1a){return db['VtigerField']['find']({'where':{'id':_0x366f09[_0x213e('0x44')]['id']}})['then'](handleEntityNotFound(_0x44fc1a,null))[_0x213e('0x26')](removeEntity(_0x44fc1a,null))[_0x213e('0x42')](handleError(_0x44fc1a,null));}; \ No newline at end of file +var _0xf617=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','show','params','find','catch','body','update','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','error','name','index','VtigerField','rawAttributes','fieldName','type','key','map','query'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf617,0x145));var _0x7f61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf617[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7f61('0x0'));var rimraf=require(_0x7f61('0x1'));var zipdir=require(_0x7f61('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7f61('0x3'));var BPromise=require(_0x7f61('0x4'));var Mustache=require(_0x7f61('0x5'));var util=require(_0x7f61('0x6'));var path=require(_0x7f61('0x7'));var sox=require('sox');var csv=require(_0x7f61('0x8'));var ejs=require(_0x7f61('0x9'));var fs=require('fs');var fs_extra=require(_0x7f61('0xa'));var _=require(_0x7f61('0xb'));var squel=require(_0x7f61('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f61('0xd'));var deskjs=require(_0x7f61('0xe'));var toCsv=require(_0x7f61('0x8'));var querystring=require(_0x7f61('0xf'));var Papa=require(_0x7f61('0x10'));var Redis=require(_0x7f61('0x11'));var authService=require(_0x7f61('0x12'));var qs=require(_0x7f61('0x13'));var as=require(_0x7f61('0x14'));var hardwareService=require(_0x7f61('0x15'));var logger=require(_0x7f61('0x16'))(_0x7f61('0x17'));var utils=require('../../config/utils');var config=require(_0x7f61('0x18'));var licenseUtil=require(_0x7f61('0x19'));var db=require(_0x7f61('0x1a'))['db'];function respondWithStatusCode(_0x1d3c4e,_0x124d60){_0x124d60=_0x124d60||0xcc;return function(_0x332d5b){if(_0x332d5b){return _0x1d3c4e[_0x7f61('0x1b')](_0x124d60);}return _0x1d3c4e[_0x7f61('0x1c')](_0x124d60)['end']();};}function respondWithResult(_0x2238dd,_0x4a1430){_0x4a1430=_0x4a1430||0xc8;return function(_0x2b76dc){if(_0x2b76dc){return _0x2238dd[_0x7f61('0x1c')](_0x4a1430)[_0x7f61('0x1d')](_0x2b76dc);}};}function respondWithFilteredResult(_0xf21439,_0xe7f38c){return function(_0x28a2c6){if(_0x28a2c6){var _0x41b582=typeof _0xe7f38c[_0x7f61('0x1e')]===_0x7f61('0x1f')&&typeof _0xe7f38c[_0x7f61('0x20')]===_0x7f61('0x1f');var _0x598fc5=_0x28a2c6[_0x7f61('0x21')];var _0x121d3e=_0x41b582?0x0:_0xe7f38c['offset'];var _0x2f2600=_0x41b582?_0x28a2c6['count']:_0xe7f38c[_0x7f61('0x1e')]+_0xe7f38c[_0x7f61('0x20')];var _0x3ea4d0;if(_0x2f2600>=_0x598fc5){_0x2f2600=_0x598fc5;_0x3ea4d0=0xc8;}else{_0x3ea4d0=0xce;}_0xf21439[_0x7f61('0x1c')](_0x3ea4d0);return _0xf21439[_0x7f61('0x22')](_0x7f61('0x23'),_0x121d3e+'-'+_0x2f2600+'/'+_0x598fc5)[_0x7f61('0x1d')](_0x28a2c6);}return null;};}function patchUpdates(_0x3d8d4a){return function(_0x394be5){try{jsonpatch[_0x7f61('0x24')](_0x394be5,_0x3d8d4a,!![]);}catch(_0x257a3c){return BPromise[_0x7f61('0x25')](_0x257a3c);}return _0x394be5['save']();};}function saveUpdates(_0x412eb4,_0x114295){return function(_0x3d4b30){if(_0x3d4b30){return _0x3d4b30['update'](_0x412eb4)['then'](function(_0x554568){return _0x554568;});}return null;};}function removeEntity(_0x62bf82,_0x847a38){return function(_0x2ef93c){if(_0x2ef93c){return _0x2ef93c['destroy']()[_0x7f61('0x26')](function(){_0x62bf82[_0x7f61('0x1c')](0xcc)[_0x7f61('0x27')]();});}};}function handleEntityNotFound(_0x2bcf2a,_0x41bb0b){return function(_0x54b5f6){if(!_0x54b5f6){_0x2bcf2a[_0x7f61('0x1b')](0x194);}return _0x54b5f6;};}function handleError(_0x4e6d6b,_0x4f9ad6){_0x4f9ad6=_0x4f9ad6||0x1f4;return function(_0x1250dc){logger[_0x7f61('0x28')](_0x1250dc['stack']);if(_0x1250dc[_0x7f61('0x29')]){delete _0x1250dc[_0x7f61('0x29')];}_0x4e6d6b[_0x7f61('0x1c')](_0x4f9ad6)['send'](_0x1250dc);};}exports[_0x7f61('0x2a')]=function(_0x48405a,_0x1840fe){var _0x1386b4={},_0x2ae393={},_0x25231b={'count':0x0,'rows':[]};var _0x223907=_['map'](db[_0x7f61('0x2b')][_0x7f61('0x2c')],function(_0x289b80){return{'name':_0x289b80[_0x7f61('0x2d')],'type':_0x289b80[_0x7f61('0x2e')][_0x7f61('0x2f')]};});_0x2ae393['model']=_[_0x7f61('0x30')](_0x223907,_0x7f61('0x29'));_0x2ae393[_0x7f61('0x31')]=_[_0x7f61('0x32')](_0x48405a[_0x7f61('0x31')]);_0x2ae393[_0x7f61('0x33')]=_[_0x7f61('0x34')](_0x2ae393[_0x7f61('0x35')],_0x2ae393[_0x7f61('0x31')]);_0x1386b4[_0x7f61('0x36')]=_['intersection'](_0x2ae393['model'],qs[_0x7f61('0x37')](_0x48405a[_0x7f61('0x31')][_0x7f61('0x37')]));_0x1386b4[_0x7f61('0x36')]=_0x1386b4[_0x7f61('0x36')][_0x7f61('0x38')]?_0x1386b4[_0x7f61('0x36')]:_0x2ae393[_0x7f61('0x35')];if(!_0x48405a[_0x7f61('0x31')][_0x7f61('0x39')](_0x7f61('0x3a'))){_0x1386b4[_0x7f61('0x20')]=qs[_0x7f61('0x20')](_0x48405a[_0x7f61('0x31')][_0x7f61('0x20')]);_0x1386b4[_0x7f61('0x1e')]=qs[_0x7f61('0x1e')](_0x48405a['query'][_0x7f61('0x1e')]);}_0x1386b4[_0x7f61('0x3b')]=qs[_0x7f61('0x3c')](_0x48405a[_0x7f61('0x31')][_0x7f61('0x3c')]);_0x1386b4[_0x7f61('0x3d')]=qs[_0x7f61('0x33')](_[_0x7f61('0x3e')](_0x48405a[_0x7f61('0x31')],_0x2ae393['filters']),_0x223907);if(_0x48405a[_0x7f61('0x31')]['filter']){_0x1386b4[_0x7f61('0x3d')]=_[_0x7f61('0x3f')](_0x1386b4[_0x7f61('0x3d')],{'$or':_['map'](_0x223907,function(_0x380ee3){if(_0x380ee3[_0x7f61('0x2e')]!=='VIRTUAL'){var _0x43dbba={};_0x43dbba[_0x380ee3[_0x7f61('0x29')]]={'$like':'%'+_0x48405a[_0x7f61('0x31')]['filter']+'%'};return _0x43dbba;}})});}_0x1386b4=_[_0x7f61('0x3f')]({},_0x1386b4,_0x48405a[_0x7f61('0x40')]);var _0x331e8b={'where':_0x1386b4[_0x7f61('0x3d')]};return db['VtigerField'][_0x7f61('0x21')](_0x331e8b)[_0x7f61('0x26')](function(_0x564cee){_0x25231b[_0x7f61('0x21')]=_0x564cee;if(_0x48405a['query'][_0x7f61('0x41')]){_0x1386b4[_0x7f61('0x42')]=[{'all':!![]}];}return db[_0x7f61('0x2b')][_0x7f61('0x43')](_0x1386b4);})[_0x7f61('0x26')](function(_0x973d33){_0x25231b['rows']=_0x973d33;return _0x25231b;})[_0x7f61('0x26')](respondWithFilteredResult(_0x1840fe,_0x1386b4))['catch'](handleError(_0x1840fe,null));};exports[_0x7f61('0x44')]=function(_0x335e4a,_0x1f3ca){var _0x86f03e={'raw':!![],'where':{'id':_0x335e4a[_0x7f61('0x45')]['id']}},_0x3b2829={};_0x3b2829[_0x7f61('0x35')]=_['keys'](db[_0x7f61('0x2b')]['rawAttributes']);_0x3b2829[_0x7f61('0x31')]=_[_0x7f61('0x32')](_0x335e4a['query']);_0x3b2829[_0x7f61('0x33')]=_[_0x7f61('0x34')](_0x3b2829[_0x7f61('0x35')],_0x3b2829[_0x7f61('0x31')]);_0x86f03e[_0x7f61('0x36')]=_[_0x7f61('0x34')](_0x3b2829[_0x7f61('0x35')],qs[_0x7f61('0x37')](_0x335e4a[_0x7f61('0x31')][_0x7f61('0x37')]));_0x86f03e[_0x7f61('0x36')]=_0x86f03e[_0x7f61('0x36')][_0x7f61('0x38')]?_0x86f03e['attributes']:_0x3b2829['model'];if(_0x335e4a[_0x7f61('0x31')][_0x7f61('0x41')]){_0x86f03e[_0x7f61('0x42')]=[{'all':!![]}];}_0x86f03e=_[_0x7f61('0x3f')]({},_0x86f03e,_0x335e4a[_0x7f61('0x40')]);return db['VtigerField'][_0x7f61('0x46')](_0x86f03e)[_0x7f61('0x26')](handleEntityNotFound(_0x1f3ca,null))[_0x7f61('0x26')](respondWithResult(_0x1f3ca,null))[_0x7f61('0x47')](handleError(_0x1f3ca,null));};exports['create']=function(_0x4368bb,_0x137125){return db[_0x7f61('0x2b')]['create'](_0x4368bb[_0x7f61('0x48')],{})[_0x7f61('0x26')](respondWithResult(_0x137125,0xc9))['catch'](handleError(_0x137125,null));};exports[_0x7f61('0x49')]=function(_0x5e1ea2,_0x1950d2){if(_0x5e1ea2['body']['id']){delete _0x5e1ea2[_0x7f61('0x48')]['id'];}return db[_0x7f61('0x2b')][_0x7f61('0x46')]({'where':{'id':_0x5e1ea2[_0x7f61('0x45')]['id']}})[_0x7f61('0x26')](handleEntityNotFound(_0x1950d2,null))[_0x7f61('0x26')](saveUpdates(_0x5e1ea2['body'],null))[_0x7f61('0x26')](respondWithResult(_0x1950d2,null))[_0x7f61('0x47')](handleError(_0x1950d2,null));};exports[_0x7f61('0x4a')]=function(_0x42f2c3,_0x37b3a1){return db[_0x7f61('0x2b')]['find']({'where':{'id':_0x42f2c3[_0x7f61('0x45')]['id']}})[_0x7f61('0x26')](handleEntityNotFound(_0x37b3a1,null))[_0x7f61('0x26')](removeEntity(_0x37b3a1,null))['catch'](handleError(_0x37b3a1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7a63136..e808350 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 _0x799c=['VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x799c,0x9b));var _0xc799=function(_0x2aaeab,_0x3aa20d){_0x2aaeab=_0x2aaeab-0x0;var _0x35b164=_0x799c[_0x2aaeab];return _0x35b164;};'use strict';var _=require(_0xc799('0x0'));var util=require(_0xc799('0x1'));var logger=require(_0xc799('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc799('0x3'));var rp=require(_0xc799('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc799('0x5'));var config=require(_0xc799('0x6'));var attributes=require(_0xc799('0x7'));module[_0xc799('0x8')]=function(_0x7b9e8b,_0x448486){return _0x7b9e8b[_0xc799('0x9')](_0xc799('0xa'),attributes,{'tableName':_0xc799('0xb'),'paranoid':![],'indexes':[{'name':_0xc799('0xc'),'fields':[_0xc799('0xd'),_0xc799('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1682=['../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x32811c,_0x56ed01){var _0x217d6d=function(_0x305651){while(--_0x305651){_0x32811c['push'](_0x32811c['shift']());}};_0x217d6d(++_0x56ed01);}(_0x1682,0x165));var _0x2168=function(_0xcc78b5,_0x2e75c9){_0xcc78b5=_0xcc78b5-0x0;var _0x3b57bc=_0x1682[_0xcc78b5];return _0x3b57bc;};'use strict';var _=require(_0x2168('0x0'));var util=require(_0x2168('0x1'));var logger=require(_0x2168('0x2'))(_0x2168('0x3'));var moment=require('moment');var BPromise=require(_0x2168('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2168('0x5'));var rimraf=require(_0x2168('0x6'));var config=require(_0x2168('0x7'));var attributes=require(_0x2168('0x8'));module[_0x2168('0x9')]=function(_0x1dad37,_0x221091){return _0x1dad37[_0x2168('0xa')]('VtigerField',attributes,{'tableName':_0x2168('0xb'),'paranoid':![],'indexes':[{'name':_0x2168('0xc'),'fields':['idField',_0x2168('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 383fa24..f52d3de 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 _0x0737=['jayson/promise','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x2073ad,_0x569e7e){var _0x2ee4a3=function(_0x2c9710){while(--_0x2c9710){_0x2073ad['push'](_0x2073ad['shift']());}};_0x2ee4a3(++_0x569e7e);}(_0x0737,0x116));var _0x7073=function(_0x1cac4d,_0x14335e){_0x1cac4d=_0x1cac4d-0x0;var _0xfdc1f8=_0x0737[_0x1cac4d];return _0xfdc1f8;};'use strict';var _=require(_0x7073('0x0'));var util=require(_0x7073('0x1'));var moment=require(_0x7073('0x2'));var BPromise=require(_0x7073('0x3'));var rs=require(_0x7073('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7073('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7073('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7073('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1d64,_0x4f0bfa,_0x5e333d){return new BPromise(function(_0x3161cc,_0x589b08){return client[_0x7073('0x8')](_0x3e1d64,_0x5e333d)[_0x7073('0x9')](function(_0x1d4323){logger[_0x7073('0xa')](_0x7073('0xb'),_0x4f0bfa,_0x7073('0xc'));logger[_0x7073('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4f0bfa,'request\x20sent',JSON[_0x7073('0xe')](_0x1d4323));if(_0x1d4323['error']){if(_0x1d4323[_0x7073('0xf')][_0x7073('0x10')]===0x1f4){logger[_0x7073('0xf')]('VtigerField,\x20%s,\x20%s',_0x4f0bfa,_0x1d4323['error'][_0x7073('0x11')]);return _0x589b08(_0x1d4323['error'][_0x7073('0x11')]);}logger[_0x7073('0xf')](_0x7073('0xb'),_0x4f0bfa,_0x1d4323[_0x7073('0xf')]['message']);return _0x3161cc(_0x1d4323[_0x7073('0xf')][_0x7073('0x11')]);}else{logger[_0x7073('0xa')](_0x7073('0xb'),_0x4f0bfa,_0x7073('0xc'));_0x3161cc(_0x1d4323['result']['message']);}})[_0x7073('0x12')](function(_0x2b78cd){logger['error'](_0x7073('0xb'),_0x4f0bfa,_0x2b78cd);_0x589b08(_0x2b78cd);});});} \ No newline at end of file +var _0x2c64=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5da3a4,_0xe6af4a){var _0x40c49a=function(_0x19bd38){while(--_0x19bd38){_0x5da3a4['push'](_0x5da3a4['shift']());}};_0x40c49a(++_0xe6af4a);}(_0x2c64,0xbf));var _0x42c6=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x2c64[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x42c6('0x0'));var util=require('util');var moment=require(_0x42c6('0x1'));var BPromise=require(_0x42c6('0x2'));var rs=require(_0x42c6('0x3'));var fs=require('fs');var Redis=require(_0x42c6('0x4'));var db=require(_0x42c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x42c6('0x6'))(_0x42c6('0x7'));var config=require('../../config/environment');var jayson=require(_0x42c6('0x8'));var client=jayson[_0x42c6('0x9')][_0x42c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cb582,_0xc33b6a,_0x3e9703){return new BPromise(function(_0x4a1857,_0x34faad){return client[_0x42c6('0xb')](_0x4cb582,_0x3e9703)['then'](function(_0x4f9ecd){logger[_0x42c6('0xc')](_0x42c6('0xd'),_0xc33b6a,_0x42c6('0xe'));logger[_0x42c6('0xf')](_0x42c6('0x10'),_0xc33b6a,_0x42c6('0xe'),JSON[_0x42c6('0x11')](_0x4f9ecd));if(_0x4f9ecd['error']){if(_0x4f9ecd['error'][_0x42c6('0x12')]===0x1f4){logger[_0x42c6('0x13')]('VtigerField,\x20%s,\x20%s',_0xc33b6a,_0x4f9ecd[_0x42c6('0x13')][_0x42c6('0x14')]);return _0x34faad(_0x4f9ecd[_0x42c6('0x13')][_0x42c6('0x14')]);}logger[_0x42c6('0x13')](_0x42c6('0xd'),_0xc33b6a,_0x4f9ecd['error'][_0x42c6('0x14')]);return _0x4a1857(_0x4f9ecd[_0x42c6('0x13')][_0x42c6('0x14')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0xc33b6a,'request\x20sent');_0x4a1857(_0x4f9ecd[_0x42c6('0x15')][_0x42c6('0x14')]);}})[_0x42c6('0x16')](function(_0xa47b34){logger[_0x42c6('0x13')](_0x42c6('0xd'),_0xc33b6a,_0xa47b34);_0x34faad(_0xa47b34);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e7e9725..be2d3e2 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 _0x69d1=['isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x69d1,0x98));var _0x169d=function(_0x57d7f7,_0x335c81){_0x57d7f7=_0x57d7f7-0x0;var _0x1a6800=_0x69d1[_0x57d7f7];return _0x1a6800;};'use strict';var multer=require(_0x169d('0x0'));var util=require(_0x169d('0x1'));var path=require(_0x169d('0x2'));var timeout=require('connect-timeout');var express=require(_0x169d('0x3'));var router=express['Router']();var fs_extra=require(_0x169d('0x4'));var auth=require(_0x169d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x169d('0x6'));var controller=require(_0x169d('0x7'));router[_0x169d('0x8')]('/',auth[_0x169d('0x9')](),controller[_0x169d('0xa')]);router[_0x169d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x169d('0xb')]);router['get'](_0x169d('0xc'),auth[_0x169d('0x9')](),controller[_0x169d('0xd')]);router[_0x169d('0x8')](_0x169d('0xe'),auth[_0x169d('0x9')](),controller[_0x169d('0xf')]);router[_0x169d('0x10')]('/',auth[_0x169d('0x9')](),controller[_0x169d('0x11')]);router['post'](_0x169d('0xc'),auth['isAuthenticated'](),controller[_0x169d('0x12')]);router['put'](_0x169d('0x13'),auth[_0x169d('0x9')](),controller[_0x169d('0x14')]);router[_0x169d('0x15')](_0x169d('0x13'),auth[_0x169d('0x9')](),controller['destroy']);module[_0x169d('0x16')]=router; \ No newline at end of file +var _0x4d49=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x322486,_0xd0968f){var _0x21a835=function(_0x39a1a1){while(--_0x39a1a1){_0x322486['push'](_0x322486['shift']());}};_0x21a835(++_0xd0968f);}(_0x4d49,0x141));var _0x94d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4d49[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x94d4('0x0'));var path=require('path');var timeout=require(_0x94d4('0x1'));var express=require(_0x94d4('0x2'));var router=express[_0x94d4('0x3')]();var fs_extra=require(_0x94d4('0x4'));var auth=require(_0x94d4('0x5'));var interaction=require(_0x94d4('0x6'));var config=require(_0x94d4('0x7'));var controller=require(_0x94d4('0x8'));router[_0x94d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x94d4('0xa')]);router[_0x94d4('0x9')](_0x94d4('0xb'),auth[_0x94d4('0xc')](),controller[_0x94d4('0xd')]);router[_0x94d4('0x9')]('/:id/configurations',auth[_0x94d4('0xc')](),controller[_0x94d4('0xe')]);router['get'](_0x94d4('0xf'),auth[_0x94d4('0xc')](),controller[_0x94d4('0x10')]);router[_0x94d4('0x11')]('/',auth['isAuthenticated'](),controller[_0x94d4('0x12')]);router[_0x94d4('0x11')](_0x94d4('0x13'),auth[_0x94d4('0xc')](),controller[_0x94d4('0x14')]);router[_0x94d4('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x94d4('0x16')](_0x94d4('0xb'),auth['isAuthenticated'](),controller[_0x94d4('0x17')]);module[_0x94d4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e2566c2..b426fef 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 _0x5226=['exports','STRING','ENUM','token','password','integrationTab','newTab','sequelize'];(function(_0x470ce2,_0x4b3815){var _0x739076=function(_0x1f16f3){while(--_0x1f16f3){_0x470ce2['push'](_0x470ce2['shift']());}};_0x739076(++_0x4b3815);}(_0x5226,0x137));var _0x6522=function(_0xa157e,_0x16aa82){_0xa157e=_0xa157e-0x0;var _0x1b8e53=_0x5226[_0xa157e];return _0x1b8e53;};'use strict';var Sequelize=require(_0x6522('0x0'));module[_0x6522('0x1')]={'name':{'type':Sequelize[_0x6522('0x2')]},'description':{'type':Sequelize[_0x6522('0x2')]},'username':{'type':Sequelize[_0x6522('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x6522('0x2')]},'token':{'type':Sequelize[_0x6522('0x2')]},'remoteUri':{'type':Sequelize[_0x6522('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x6522('0x3')]('password',_0x6522('0x4')),'defaultValue':_0x6522('0x5')},'serverUrl':{'type':Sequelize[_0x6522('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6522('0x3')](_0x6522('0x6'),_0x6522('0x7')),'defaultValue':_0x6522('0x6')}}; \ No newline at end of file +var _0xfb0b=['password','token','newTab','integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x523e17,_0xf6555d){var _0x49ebb9=function(_0x56f065){while(--_0x56f065){_0x523e17['push'](_0x523e17['shift']());}};_0x49ebb9(++_0xf6555d);}(_0xfb0b,0x94));var _0xbfb0=function(_0x51d4e2,_0x1dfeaf){_0x51d4e2=_0x51d4e2-0x0;var _0x1eeab3=_0xfb0b[_0x51d4e2];return _0x1eeab3;};'use strict';var Sequelize=require(_0xbfb0('0x0'));module[_0xbfb0('0x1')]={'name':{'type':Sequelize[_0xbfb0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbfb0('0x2')],'unique':_0xbfb0('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbfb0('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xbfb0('0x4')](_0xbfb0('0x5'),_0xbfb0('0x6')),'defaultValue':_0xbfb0('0x5')},'serverUrl':{'type':Sequelize[_0xbfb0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbfb0('0x4')]('integrationTab',_0xbfb0('0x7')),'defaultValue':_0xbfb0('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1e75afa..b571996 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 _0x02ce=['sendStatus','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','show','params','length','merge','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','channel','getDescriptions','Subjects','ZendeskField','Descriptions','username','password','authType','remoteUri','GET','format','%s/%s','ticket_fields','headers','toString','base64','%s/token:%s','token','Sequelize','ValidationError','subject','description','group','assignee','remove','title','position','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','limit','undefined','count','set','reject','update','then','destroy'];(function(_0x5cacf4,_0x16e8a3){var _0x25fe46=function(_0x4282a8){while(--_0x4282a8){_0x5cacf4['push'](_0x5cacf4['shift']());}};_0x25fe46(++_0x16e8a3);}(_0x02ce,0x1ac));var _0xe02c=function(_0xed156d,_0x17e195){_0xed156d=_0xed156d-0x0;var _0x164dd7=_0x02ce[_0xed156d];return _0x164dd7;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];var integrations=require(_0xe02c('0x1c'));function respondWithStatusCode(_0x32fc45,_0x5d6d13){_0x5d6d13=_0x5d6d13||0xcc;return function(_0x43079c){if(_0x43079c){return _0x32fc45['sendStatus'](_0x5d6d13);}return _0x32fc45['status'](_0x5d6d13)[_0xe02c('0x1d')]();};}function respondWithResult(_0x56405a,_0x221910){_0x221910=_0x221910||0xc8;return function(_0x59614c){if(_0x59614c){return _0x56405a[_0xe02c('0x1e')](_0x221910)['json'](_0x59614c);}};}function respondWithFilteredResult(_0x256311,_0x366893){return function(_0x59f2f6){if(_0x59f2f6){var _0x10a2a6=typeof _0x366893[_0xe02c('0x1f')]==='undefined'&&typeof _0x366893[_0xe02c('0x20')]===_0xe02c('0x21');var _0x5a4583=_0x59f2f6['count'];var _0x3e37bf=_0x10a2a6?0x0:_0x366893['offset'];var _0x1f8f37=_0x10a2a6?_0x59f2f6[_0xe02c('0x22')]:_0x366893[_0xe02c('0x1f')]+_0x366893[_0xe02c('0x20')];var _0x3898dc;if(_0x1f8f37>=_0x5a4583){_0x1f8f37=_0x5a4583;_0x3898dc=0xc8;}else{_0x3898dc=0xce;}_0x256311['status'](_0x3898dc);return _0x256311[_0xe02c('0x23')]('Content-Range',_0x3e37bf+'-'+_0x1f8f37+'/'+_0x5a4583)['json'](_0x59f2f6);}return null;};}function patchUpdates(_0x393621){return function(_0x4514ac){try{jsonpatch['apply'](_0x4514ac,_0x393621,!![]);}catch(_0x3fe8f7){return BPromise[_0xe02c('0x24')](_0x3fe8f7);}return _0x4514ac['save']();};}function saveUpdates(_0x38dce2,_0x45fd82){return function(_0x39b00c){if(_0x39b00c){return _0x39b00c[_0xe02c('0x25')](_0x38dce2)[_0xe02c('0x26')](function(_0x557142){return _0x557142;});}return null;};}function removeEntity(_0x3e80e3,_0xf41d4c){return function(_0xeae877){if(_0xeae877){return _0xeae877[_0xe02c('0x27')]()[_0xe02c('0x26')](function(){_0x3e80e3['status'](0xcc)[_0xe02c('0x1d')]();});}};}function handleEntityNotFound(_0x4411d8,_0x3592ca){return function(_0x14ffba){if(!_0x14ffba){_0x4411d8[_0xe02c('0x28')](0x194);}return _0x14ffba;};}function handleError(_0x303d24,_0x43dc78){_0x43dc78=_0x43dc78||0x1f4;return function(_0x1c14d6){logger['error'](_0x1c14d6[_0xe02c('0x29')]);if(_0x1c14d6[_0xe02c('0x2a')]){delete _0x1c14d6[_0xe02c('0x2a')];}_0x303d24['status'](_0x43dc78)[_0xe02c('0x2b')](_0x1c14d6);};}exports[_0xe02c('0x2c')]=function(_0x445421,_0x287f7e){var _0x1e7eab={},_0x35a309={},_0x22a285={'count':0x0,'rows':[]};var _0x1b8f21=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x5a2da0){return{'name':_0x5a2da0[_0xe02c('0x30')],'type':_0x5a2da0[_0xe02c('0x31')][_0xe02c('0x32')]};});_0x35a309[_0xe02c('0x33')]=_[_0xe02c('0x2d')](_0x1b8f21,_0xe02c('0x2a'));_0x35a309['query']=_[_0xe02c('0x34')](_0x445421[_0xe02c('0x35')]);_0x35a309['filters']=_[_0xe02c('0x36')](_0x35a309[_0xe02c('0x33')],_0x35a309[_0xe02c('0x35')]);_0x1e7eab[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x35a309['model'],qs['fields'](_0x445421[_0xe02c('0x35')][_0xe02c('0x38')]));_0x1e7eab['attributes']=_0x1e7eab[_0xe02c('0x37')]['length']?_0x1e7eab[_0xe02c('0x37')]:_0x35a309[_0xe02c('0x33')];if(!_0x445421[_0xe02c('0x35')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x1e7eab['limit']=qs[_0xe02c('0x20')](_0x445421['query'][_0xe02c('0x20')]);_0x1e7eab[_0xe02c('0x1f')]=qs[_0xe02c('0x1f')](_0x445421[_0xe02c('0x35')][_0xe02c('0x1f')]);}_0x1e7eab[_0xe02c('0x3b')]=qs['sort'](_0x445421[_0xe02c('0x35')][_0xe02c('0x3c')]);_0x1e7eab['where']=qs[_0xe02c('0x3d')](_[_0xe02c('0x3e')](_0x445421['query'],_0x35a309[_0xe02c('0x3d')]),_0x1b8f21);if(_0x445421['query'][_0xe02c('0x3f')]){_0x1e7eab[_0xe02c('0x40')]=_['merge'](_0x1e7eab[_0xe02c('0x40')],{'$or':_[_0xe02c('0x2d')](_0x1b8f21,function(_0x2502c8){if(_0x2502c8[_0xe02c('0x31')]!==_0xe02c('0x41')){var _0x28922a={};_0x28922a[_0x2502c8['name']]={'$like':'%'+_0x445421[_0xe02c('0x35')]['filter']+'%'};return _0x28922a;}})});}_0x1e7eab=_['merge']({},_0x1e7eab,_0x445421[_0xe02c('0x42')]);var _0x1095fb={'where':_0x1e7eab[_0xe02c('0x40')]};return db[_0xe02c('0x2e')]['count'](_0x1095fb)[_0xe02c('0x26')](function(_0x17830e){_0x22a285[_0xe02c('0x22')]=_0x17830e;if(_0x445421['query']['includeAll']){_0x1e7eab[_0xe02c('0x43')]=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x44')](_0x1e7eab);})[_0xe02c('0x26')](function(_0x1b0876){_0x22a285[_0xe02c('0x45')]=_0x1b0876;return _0x22a285;})[_0xe02c('0x26')](respondWithFilteredResult(_0x287f7e,_0x1e7eab))[_0xe02c('0x46')](handleError(_0x287f7e,null));};exports[_0xe02c('0x47')]=function(_0x53d123,_0xc7e935){var _0x5ef4a1={'raw':![],'where':{'id':_0x53d123[_0xe02c('0x48')]['id']}},_0x4d4be5={};_0x4d4be5[_0xe02c('0x33')]=_[_0xe02c('0x34')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x4d4be5[_0xe02c('0x35')]=_[_0xe02c('0x34')](_0x53d123[_0xe02c('0x35')]);_0x4d4be5['filters']=_['intersection'](_0x4d4be5[_0xe02c('0x33')],_0x4d4be5[_0xe02c('0x35')]);_0x5ef4a1[_0xe02c('0x37')]=_['intersection'](_0x4d4be5[_0xe02c('0x33')],qs[_0xe02c('0x38')](_0x53d123[_0xe02c('0x35')][_0xe02c('0x38')]));_0x5ef4a1[_0xe02c('0x37')]=_0x5ef4a1[_0xe02c('0x37')][_0xe02c('0x49')]?_0x5ef4a1[_0xe02c('0x37')]:_0x4d4be5[_0xe02c('0x33')];if(_0x53d123[_0xe02c('0x35')]['includeAll']){_0x5ef4a1[_0xe02c('0x43')]=[{'all':!![]}];}_0x5ef4a1=_[_0xe02c('0x4a')]({},_0x5ef4a1,_0x53d123[_0xe02c('0x42')]);return db[_0xe02c('0x2e')][_0xe02c('0x4b')](_0x5ef4a1)[_0xe02c('0x26')](handleEntityNotFound(_0xc7e935,null))[_0xe02c('0x26')](respondWithResult(_0xc7e935,null))[_0xe02c('0x46')](handleError(_0xc7e935,null));};exports[_0xe02c('0x4c')]=function(_0x1176c9,_0xfed475){return db[_0xe02c('0x2e')][_0xe02c('0x4c')](_0x1176c9['body'],{})[_0xe02c('0x26')](respondWithResult(_0xfed475,0xc9))['catch'](handleError(_0xfed475,null));};exports[_0xe02c('0x25')]=function(_0x324911,_0x45a6df){if(_0x324911[_0xe02c('0x4d')]['id']){delete _0x324911[_0xe02c('0x4d')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x4b')]({'where':{'id':_0x324911[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x45a6df,null))[_0xe02c('0x26')](saveUpdates(_0x324911['body'],null))[_0xe02c('0x26')](respondWithResult(_0x45a6df,null))[_0xe02c('0x46')](handleError(_0x45a6df,null));};exports[_0xe02c('0x27')]=function(_0x536cf7,_0xdab6cb){return db['ZendeskAccount'][_0xe02c('0x4b')]({'where':{'id':_0x536cf7['params']['id']}})['then'](handleEntityNotFound(_0xdab6cb,null))['then'](removeEntity(_0xdab6cb,null))['catch'](handleError(_0xdab6cb,null));};exports['getConfigurations']=function(_0x5740df,_0x107f3f,_0x3ac0a5){var _0x1510aa={};var _0x35fbe2={};var _0x5d963d;var _0x274beb;return db[_0xe02c('0x2e')]['findOne']({'where':{'id':_0x5740df[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x107f3f,null))[_0xe02c('0x26')](function(_0x51f940){if(_0x51f940){_0x5d963d=_0x51f940;_0x35fbe2['model']=_[_0xe02c('0x34')](db[_0xe02c('0x4e')][_0xe02c('0x2f')]);_0x35fbe2['query']=_[_0xe02c('0x34')](_0x5740df['query']);_0x35fbe2['filters']=_[_0xe02c('0x36')](_0x35fbe2[_0xe02c('0x33')],_0x35fbe2['query']);_0x1510aa[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x35fbe2[_0xe02c('0x33')],qs['fields'](_0x5740df[_0xe02c('0x35')][_0xe02c('0x38')]));_0x1510aa['attributes']=_0x1510aa[_0xe02c('0x37')][_0xe02c('0x49')]?_0x1510aa[_0xe02c('0x37')]:_0x35fbe2[_0xe02c('0x33')];_0x1510aa[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x5740df[_0xe02c('0x35')][_0xe02c('0x3c')]);_0x1510aa[_0xe02c('0x40')]=qs['filters'](_['pick'](_0x5740df['query'],_0x35fbe2[_0xe02c('0x3d')]));if(_0x5740df[_0xe02c('0x35')][_0xe02c('0x3f')]){_0x1510aa['where']=_['merge'](_0x1510aa[_0xe02c('0x40')],{'$or':_[_0xe02c('0x2d')](_0x1510aa[_0xe02c('0x37')],function(_0xb50cfa){var _0xe02798={};_0xe02798[_0xb50cfa]={'$like':'%'+_0x5740df['query'][_0xe02c('0x3f')]+'%'};return _0xe02798;})});}_0x1510aa=_[_0xe02c('0x4a')]({},_0x1510aa,_0x5740df['options']);return _0x5d963d['getConfigurations'](_0x1510aa);}})[_0xe02c('0x26')](function(_0x566204){if(_0x566204){_0x274beb=_0x566204['length'];if(!_0x5740df['query'][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x1510aa[_0xe02c('0x20')]=qs[_0xe02c('0x20')](_0x5740df[_0xe02c('0x35')][_0xe02c('0x20')]);_0x1510aa['offset']=qs[_0xe02c('0x1f')](_0x5740df['query']['offset']);}return _0x5d963d[_0xe02c('0x4f')](_0x1510aa);}})[_0xe02c('0x26')](function(_0x44ba68){if(_0x44ba68){return _0x44ba68?{'count':_0x274beb,'rows':_0x44ba68}:null;}})[_0xe02c('0x26')](respondWithResult(_0x107f3f,null))['catch'](handleError(_0x107f3f,null));};exports[_0xe02c('0x50')]=function(_0x31c287,_0x5d2119,_0xa7133f){if(_0x31c287[_0xe02c('0x4d')]['id']){delete _0x31c287['body']['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x51')]({'where':{'id':_0x31c287[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x5d2119,null))[_0xe02c('0x26')](function(_0x3a62a2){if(_0x3a62a2){_0x31c287[_0xe02c('0x4d')]['AccountId']=_0x3a62a2['id'];_0x31c287[_0xe02c('0x4d')]['Subjects']=integrations['getSubjects'](_0x31c287['body'][_0xe02c('0x52')],_0x31c287[_0xe02c('0x4d')][_0xe02c('0x31')]);_0x31c287[_0xe02c('0x4d')]['Descriptions']=integrations[_0xe02c('0x53')](_0x31c287[_0xe02c('0x4d')]['channel'],_0x31c287['body']['type']);return db[_0xe02c('0x4e')][_0xe02c('0x4c')](_0x31c287['body'],{'include':[{'model':db['ZendeskField'],'as':_0xe02c('0x54')},{'model':db[_0xe02c('0x55')],'as':_0xe02c('0x56')}]});}return null;})[_0xe02c('0x26')](respondWithResult(_0x5d2119,null))[_0xe02c('0x46')](handleError(_0x5d2119,null));};exports['getFields']=function(_0x39c7db,_0x12ac9f,_0x3f277b){var _0x2776c0='';return db[_0xe02c('0x2e')][_0xe02c('0x51')]({'where':{'id':_0x39c7db['params']['id']},'attributes':['id',_0xe02c('0x57'),_0xe02c('0x58'),'token',_0xe02c('0x59'),_0xe02c('0x5a')]})[_0xe02c('0x26')](handleEntityNotFound(_0x12ac9f,null))[_0xe02c('0x26')](function(_0x5d2455){if(_0x5d2455){_0x2776c0=_0x5d2455[_0xe02c('0x5a')];var _0x2229ae=_0x2776c0['slice'](-0x1);if(_0x2229ae==='/'){_0x2776c0=_0x2776c0['substring'](0x0,_0x2776c0['lastIndexOf'](_0x2229ae));}var _0x43977c={'method':_0xe02c('0x5b'),'uri':util[_0xe02c('0x5c')](_0xe02c('0x5d'),_0x2776c0,_0xe02c('0x5e')),'json':!![]};switch(_0x5d2455['authType']){case _0xe02c('0x58'):_0x43977c[_0xe02c('0x5f')]={'Authorization':util[_0xe02c('0x5c')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x5d2455[_0xe02c('0x57')],_0x5d2455[_0xe02c('0x58')]))[_0xe02c('0x60')](_0xe02c('0x61')))};break;case'token':_0x43977c[_0xe02c('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe02c('0x5c')](_0xe02c('0x62'),_0x5d2455[_0xe02c('0x57')],_0x5d2455[_0xe02c('0x63')]))[_0xe02c('0x60')](_0xe02c('0x61')))};break;default:throw new db[(_0xe02c('0x64'))][(_0xe02c('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x43977c);}})[_0xe02c('0x26')](function(_0x21049f){if(_0x21049f){var _0x2386cf=[_0xe02c('0x66'),_0xe02c('0x67'),_0xe02c('0x68'),_0xe02c('0x69')];_[_0xe02c('0x6a')](_0x21049f[_0xe02c('0x5e')],function(_0x411cd5){return _0x2386cf['includes'](_0x411cd5['type']);});return{'count':_0x21049f[_0xe02c('0x5e')][_0xe02c('0x49')],'rows':_[_0xe02c('0x2d')](_0x21049f[_0xe02c('0x5e')],function(_0x108566){return{'id':_0x108566['id'],'name':_0x108566['position']>0x7?_0x108566[_0xe02c('0x6b')]:_0x108566[_0xe02c('0x31')],'custom':_0x108566[_0xe02c('0x6c')]>0x7?!![]:![],'options':_0x108566[_0xe02c('0x6d')]?_0x108566[_0xe02c('0x6d')]:_0x108566[_0xe02c('0x6e')]?_0x108566[_0xe02c('0x6e')]:[]};})};}})[_0xe02c('0x26')](respondWithResult(_0x12ac9f,null))[_0xe02c('0x46')](function(_0x159f58){var _0x287eca=_0x39c7db[_0xe02c('0x35')]['test']?0x1f4:_0x159f58['statusCode']||0x1f4;logger[_0xe02c('0x6f')](_0xe02c('0x70'),'getFields',_0x287eca,JSON[_0xe02c('0x71')](_0x159f58));delete _0x159f58['name'];if(_0x287eca===0x191){_0x287eca=0x190;}_0x12ac9f[_0xe02c('0x1e')](_0x287eca)['send'](_0x39c7db[_0xe02c('0x35')][_0xe02c('0x72')]?{'message':_0xe02c('0x73'),'statusCode':_0x159f58[_0xe02c('0x74')]}:_0x159f58);});}; \ No newline at end of file +var _0x236c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','fields','order','nolimit','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','%s:%s','toString','Basic\x20%s','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','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'];(function(_0x1c80e9,_0x3b7f77){var _0x509563=function(_0x33112d){while(--_0x33112d){_0x1c80e9['push'](_0x1c80e9['shift']());}};_0x509563(++_0x3b7f77);}(_0x236c,0x155));var _0xc236=function(_0x2f4508,_0x55181b){_0x2f4508=_0x2f4508-0x0;var _0x88fb05=_0x236c[_0x2f4508];return _0x88fb05;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b9638,_0x5bce83){_0x5bce83=_0x5bce83||0xcc;return function(_0x599d36){if(_0x599d36){return _0x5b9638[_0xc236('0x18')](_0x5bce83);}return _0x5b9638[_0xc236('0x19')](_0x5bce83)[_0xc236('0x1a')]();};}function respondWithResult(_0x71bce2,_0x5052db){_0x5052db=_0x5052db||0xc8;return function(_0x13a42b){if(_0x13a42b){return _0x71bce2['status'](_0x5052db)['json'](_0x13a42b);}};}function respondWithFilteredResult(_0x9a65e8,_0x32f2fd){return function(_0x443a46){if(_0x443a46){var _0x1aeafc=typeof _0x32f2fd[_0xc236('0x1b')]==='undefined'&&typeof _0x32f2fd['limit']==='undefined';var _0x3f5884=_0x443a46[_0xc236('0x1c')];var _0x11ec65=_0x1aeafc?0x0:_0x32f2fd['offset'];var _0x13b432=_0x1aeafc?_0x443a46['count']:_0x32f2fd['offset']+_0x32f2fd[_0xc236('0x1d')];var _0x30adeb;if(_0x13b432>=_0x3f5884){_0x13b432=_0x3f5884;_0x30adeb=0xc8;}else{_0x30adeb=0xce;}_0x9a65e8[_0xc236('0x19')](_0x30adeb);return _0x9a65e8[_0xc236('0x1e')](_0xc236('0x1f'),_0x11ec65+'-'+_0x13b432+'/'+_0x3f5884)[_0xc236('0x20')](_0x443a46);}return null;};}function patchUpdates(_0x3f0e2f){return function(_0x27c96a){try{jsonpatch[_0xc236('0x21')](_0x27c96a,_0x3f0e2f,!![]);}catch(_0x32876d){return BPromise[_0xc236('0x22')](_0x32876d);}return _0x27c96a['save']();};}function saveUpdates(_0x208c3f,_0x34d73a){return function(_0x3bd41b){if(_0x3bd41b){return _0x3bd41b[_0xc236('0x23')](_0x208c3f)[_0xc236('0x24')](function(_0x21fab8){return _0x21fab8;});}return null;};}function removeEntity(_0x3a315b,_0xf921e6){return function(_0x1d65e2){if(_0x1d65e2){return _0x1d65e2[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x3a315b['status'](0xcc)[_0xc236('0x1a')]();});}};}function handleEntityNotFound(_0x21d78f,_0x356042){return function(_0x9017ec){if(!_0x9017ec){_0x21d78f['sendStatus'](0x194);}return _0x9017ec;};}function handleError(_0x42f248,_0x5da4b2){_0x5da4b2=_0x5da4b2||0x1f4;return function(_0x5351bc){logger[_0xc236('0x26')](_0x5351bc['stack']);if(_0x5351bc[_0xc236('0x27')]){delete _0x5351bc['name'];}_0x42f248[_0xc236('0x19')](_0x5da4b2)['send'](_0x5351bc);};}exports[_0xc236('0x28')]=function(_0x1d144b,_0x4f5175){var _0x5a61b5={},_0x265c8d={},_0x1fd31d={'count':0x0,'rows':[]};var _0x1f4995=_[_0xc236('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x28ffa5){return{'name':_0x28ffa5['fieldName'],'type':_0x28ffa5[_0xc236('0x2a')]['key']};});_0x265c8d[_0xc236('0x2b')]=_[_0xc236('0x29')](_0x1f4995,'name');_0x265c8d['query']=_[_0xc236('0x2c')](_0x1d144b[_0xc236('0x2d')]);_0x265c8d[_0xc236('0x2e')]=_[_0xc236('0x2f')](_0x265c8d[_0xc236('0x2b')],_0x265c8d[_0xc236('0x2d')]);_0x5a61b5[_0xc236('0x30')]=_[_0xc236('0x2f')](_0x265c8d[_0xc236('0x2b')],qs['fields'](_0x1d144b['query']['fields']));_0x5a61b5[_0xc236('0x30')]=_0x5a61b5[_0xc236('0x30')][_0xc236('0x31')]?_0x5a61b5[_0xc236('0x30')]:_0x265c8d[_0xc236('0x2b')];if(!_0x1d144b[_0xc236('0x2d')][_0xc236('0x32')]('nolimit')){_0x5a61b5[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x1d144b[_0xc236('0x2d')]['limit']);_0x5a61b5[_0xc236('0x1b')]=qs[_0xc236('0x1b')](_0x1d144b[_0xc236('0x2d')][_0xc236('0x1b')]);}_0x5a61b5['order']=qs[_0xc236('0x33')](_0x1d144b[_0xc236('0x2d')][_0xc236('0x33')]);_0x5a61b5[_0xc236('0x34')]=qs[_0xc236('0x2e')](_[_0xc236('0x35')](_0x1d144b[_0xc236('0x2d')],_0x265c8d[_0xc236('0x2e')]),_0x1f4995);if(_0x1d144b[_0xc236('0x2d')][_0xc236('0x36')]){_0x5a61b5[_0xc236('0x34')]=_[_0xc236('0x37')](_0x5a61b5[_0xc236('0x34')],{'$or':_[_0xc236('0x29')](_0x1f4995,function(_0x12e802){if(_0x12e802[_0xc236('0x2a')]!==_0xc236('0x38')){var _0x4f5490={};_0x4f5490[_0x12e802['name']]={'$like':'%'+_0x1d144b['query']['filter']+'%'};return _0x4f5490;}})});}_0x5a61b5=_[_0xc236('0x37')]({},_0x5a61b5,_0x1d144b['options']);var _0x35905c={'where':_0x5a61b5[_0xc236('0x34')]};return db[_0xc236('0x39')][_0xc236('0x1c')](_0x35905c)[_0xc236('0x24')](function(_0x3b95ec){_0x1fd31d[_0xc236('0x1c')]=_0x3b95ec;if(_0x1d144b[_0xc236('0x2d')][_0xc236('0x3a')]){_0x5a61b5[_0xc236('0x3b')]=[{'all':!![]}];}return db[_0xc236('0x39')][_0xc236('0x3c')](_0x5a61b5);})[_0xc236('0x24')](function(_0x3df25e){_0x1fd31d[_0xc236('0x3d')]=_0x3df25e;return _0x1fd31d;})['then'](respondWithFilteredResult(_0x4f5175,_0x5a61b5))[_0xc236('0x3e')](handleError(_0x4f5175,null));};exports[_0xc236('0x3f')]=function(_0x506ba0,_0xb90a83){var _0x5b0bc5={'raw':![],'where':{'id':_0x506ba0['params']['id']}},_0x1cecc5={};_0x1cecc5[_0xc236('0x2b')]=_[_0xc236('0x2c')](db[_0xc236('0x39')]['rawAttributes']);_0x1cecc5[_0xc236('0x2d')]=_[_0xc236('0x2c')](_0x506ba0[_0xc236('0x2d')]);_0x1cecc5['filters']=_[_0xc236('0x2f')](_0x1cecc5[_0xc236('0x2b')],_0x1cecc5[_0xc236('0x2d')]);_0x5b0bc5[_0xc236('0x30')]=_[_0xc236('0x2f')](_0x1cecc5[_0xc236('0x2b')],qs['fields'](_0x506ba0[_0xc236('0x2d')]['fields']));_0x5b0bc5[_0xc236('0x30')]=_0x5b0bc5[_0xc236('0x30')][_0xc236('0x31')]?_0x5b0bc5[_0xc236('0x30')]:_0x1cecc5[_0xc236('0x2b')];if(_0x506ba0[_0xc236('0x2d')][_0xc236('0x3a')]){_0x5b0bc5['include']=[{'all':!![]}];}_0x5b0bc5=_[_0xc236('0x37')]({},_0x5b0bc5,_0x506ba0['options']);return db[_0xc236('0x39')][_0xc236('0x40')](_0x5b0bc5)['then'](handleEntityNotFound(_0xb90a83,null))[_0xc236('0x24')](respondWithResult(_0xb90a83,null))[_0xc236('0x3e')](handleError(_0xb90a83,null));};exports[_0xc236('0x41')]=function(_0x161890,_0x181dd6){return db[_0xc236('0x39')][_0xc236('0x41')](_0x161890['body'],{})['then'](respondWithResult(_0x181dd6,0xc9))[_0xc236('0x3e')](handleError(_0x181dd6,null));};exports[_0xc236('0x23')]=function(_0x510f7f,_0xcfaa44){if(_0x510f7f[_0xc236('0x42')]['id']){delete _0x510f7f[_0xc236('0x42')]['id'];}return db[_0xc236('0x39')][_0xc236('0x40')]({'where':{'id':_0x510f7f[_0xc236('0x43')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0xcfaa44,null))[_0xc236('0x24')](saveUpdates(_0x510f7f[_0xc236('0x42')],null))['then'](respondWithResult(_0xcfaa44,null))[_0xc236('0x3e')](handleError(_0xcfaa44,null));};exports[_0xc236('0x25')]=function(_0x41b7d5,_0x447a83){return db[_0xc236('0x39')][_0xc236('0x40')]({'where':{'id':_0x41b7d5[_0xc236('0x43')]['id']}})['then'](handleEntityNotFound(_0x447a83,null))[_0xc236('0x24')](removeEntity(_0x447a83,null))[_0xc236('0x3e')](handleError(_0x447a83,null));};exports[_0xc236('0x44')]=function(_0x16ff63,_0x4860d8,_0xa34c01){var _0x3e6da6={};var _0xad71ea={};var _0x2f3d08;var _0x9d81c8;return db['ZendeskAccount'][_0xc236('0x45')]({'where':{'id':_0x16ff63['params']['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x4860d8,null))[_0xc236('0x24')](function(_0x3f9e85){if(_0x3f9e85){_0x2f3d08=_0x3f9e85;_0xad71ea[_0xc236('0x2b')]=_[_0xc236('0x2c')](db['ZendeskConfiguration']['rawAttributes']);_0xad71ea[_0xc236('0x2d')]=_[_0xc236('0x2c')](_0x16ff63[_0xc236('0x2d')]);_0xad71ea[_0xc236('0x2e')]=_[_0xc236('0x2f')](_0xad71ea[_0xc236('0x2b')],_0xad71ea[_0xc236('0x2d')]);_0x3e6da6[_0xc236('0x30')]=_[_0xc236('0x2f')](_0xad71ea[_0xc236('0x2b')],qs['fields'](_0x16ff63['query'][_0xc236('0x46')]));_0x3e6da6[_0xc236('0x30')]=_0x3e6da6[_0xc236('0x30')][_0xc236('0x31')]?_0x3e6da6['attributes']:_0xad71ea[_0xc236('0x2b')];_0x3e6da6[_0xc236('0x47')]=qs['sort'](_0x16ff63[_0xc236('0x2d')][_0xc236('0x33')]);_0x3e6da6[_0xc236('0x34')]=qs[_0xc236('0x2e')](_['pick'](_0x16ff63[_0xc236('0x2d')],_0xad71ea[_0xc236('0x2e')]));if(_0x16ff63[_0xc236('0x2d')][_0xc236('0x36')]){_0x3e6da6[_0xc236('0x34')]=_[_0xc236('0x37')](_0x3e6da6[_0xc236('0x34')],{'$or':_['map'](_0x3e6da6[_0xc236('0x30')],function(_0x4c99a4){var _0x4289c5={};_0x4289c5[_0x4c99a4]={'$like':'%'+_0x16ff63[_0xc236('0x2d')][_0xc236('0x36')]+'%'};return _0x4289c5;})});}_0x3e6da6=_[_0xc236('0x37')]({},_0x3e6da6,_0x16ff63['options']);return _0x2f3d08[_0xc236('0x44')](_0x3e6da6);}})[_0xc236('0x24')](function(_0x379e99){if(_0x379e99){_0x9d81c8=_0x379e99['length'];if(!_0x16ff63[_0xc236('0x2d')][_0xc236('0x32')](_0xc236('0x48'))){_0x3e6da6[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x16ff63[_0xc236('0x2d')]['limit']);_0x3e6da6['offset']=qs[_0xc236('0x1b')](_0x16ff63[_0xc236('0x2d')][_0xc236('0x1b')]);}return _0x2f3d08[_0xc236('0x44')](_0x3e6da6);}})[_0xc236('0x24')](function(_0x4649a3){if(_0x4649a3){return _0x4649a3?{'count':_0x9d81c8,'rows':_0x4649a3}:null;}})[_0xc236('0x24')](respondWithResult(_0x4860d8,null))['catch'](handleError(_0x4860d8,null));};exports['addConfiguration']=function(_0x4b59d3,_0x119710,_0x3c11da){if(_0x4b59d3[_0xc236('0x42')]['id']){delete _0x4b59d3[_0xc236('0x42')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x4b59d3['params']['id']}})['then'](handleEntityNotFound(_0x119710,null))[_0xc236('0x24')](function(_0x5df2ba){if(_0x5df2ba){_0x4b59d3[_0xc236('0x42')]['AccountId']=_0x5df2ba['id'];_0x4b59d3[_0xc236('0x42')][_0xc236('0x49')]=integrations[_0xc236('0x4a')](_0x4b59d3[_0xc236('0x42')][_0xc236('0x4b')],_0x4b59d3[_0xc236('0x42')][_0xc236('0x2a')]);_0x4b59d3['body'][_0xc236('0x4c')]=integrations['getDescriptions'](_0x4b59d3[_0xc236('0x42')][_0xc236('0x4b')],_0x4b59d3[_0xc236('0x42')][_0xc236('0x2a')]);return db[_0xc236('0x4d')][_0xc236('0x41')](_0x4b59d3['body'],{'include':[{'model':db[_0xc236('0x4e')],'as':_0xc236('0x49')},{'model':db['ZendeskField'],'as':_0xc236('0x4c')}]});}return null;})[_0xc236('0x24')](respondWithResult(_0x119710,null))[_0xc236('0x3e')](handleError(_0x119710,null));};exports['getFields']=function(_0x226573,_0x45fe5a,_0x5897a1){var _0x2c8f89='';return db[_0xc236('0x39')][_0xc236('0x45')]({'where':{'id':_0x226573[_0xc236('0x43')]['id']},'attributes':['id',_0xc236('0x4f'),_0xc236('0x50'),_0xc236('0x51'),_0xc236('0x52'),_0xc236('0x53')]})['then'](handleEntityNotFound(_0x45fe5a,null))[_0xc236('0x24')](function(_0x2b9fd8){if(_0x2b9fd8){_0x2c8f89=_0x2b9fd8[_0xc236('0x53')];var _0x5d395b=_0x2c8f89[_0xc236('0x54')](-0x1);if(_0x5d395b==='/'){_0x2c8f89=_0x2c8f89[_0xc236('0x55')](0x0,_0x2c8f89[_0xc236('0x56')](_0x5d395b));}var _0x4ef002={'method':'GET','uri':util[_0xc236('0x57')]('%s/%s',_0x2c8f89,_0xc236('0x58')),'json':!![]};switch(_0x2b9fd8['authType']){case _0xc236('0x50'):_0x4ef002[_0xc236('0x59')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xc236('0x5a'),_0x2b9fd8['username'],_0x2b9fd8[_0xc236('0x50')]))[_0xc236('0x5b')]('base64'))};break;case _0xc236('0x51'):_0x4ef002[_0xc236('0x59')]={'Authorization':util['format'](_0xc236('0x5c'),new Buffer(util[_0xc236('0x57')](_0xc236('0x5d'),_0x2b9fd8[_0xc236('0x4f')],_0x2b9fd8['token']))[_0xc236('0x5b')](_0xc236('0x5e')))};break;default:throw new db[(_0xc236('0x5f'))][(_0xc236('0x60'))](_0xc236('0x61'));}return rp(_0x4ef002);}})[_0xc236('0x24')](function(_0x141497){if(_0x141497){var _0x509f3b=['subject',_0xc236('0x62'),_0xc236('0x63'),_0xc236('0x64')];_[_0xc236('0x65')](_0x141497[_0xc236('0x58')],function(_0x49e417){return _0x509f3b[_0xc236('0x66')](_0x49e417[_0xc236('0x2a')]);});return{'count':_0x141497['ticket_fields']['length'],'rows':_[_0xc236('0x29')](_0x141497['ticket_fields'],function(_0x35e0d8){return{'id':_0x35e0d8['id'],'name':_0x35e0d8[_0xc236('0x67')]>0x7?_0x35e0d8[_0xc236('0x68')]:_0x35e0d8['type'],'custom':_0x35e0d8[_0xc236('0x67')]>0x7?!![]:![],'options':_0x35e0d8['system_field_options']?_0x35e0d8[_0xc236('0x69')]:_0x35e0d8[_0xc236('0x6a')]?_0x35e0d8[_0xc236('0x6a')]:[]};})};}})[_0xc236('0x24')](respondWithResult(_0x45fe5a,null))['catch'](function(_0x41c76d){var _0x22b942=_0x226573['query'][_0xc236('0x6b')]?0x1f4:_0x41c76d[_0xc236('0x6c')]||0x1f4;logger[_0xc236('0x26')](_0xc236('0x6d'),_0xc236('0x6e'),_0x22b942,JSON[_0xc236('0x6f')](_0x41c76d));delete _0x41c76d[_0xc236('0x27')];if(_0x22b942===0x191){_0x22b942=0x190;}_0x45fe5a['status'](_0x22b942)[_0xc236('0x70')](_0x226573[_0xc236('0x2d')][_0xc236('0x6b')]?{'message':_0xc236('0x71'),'statusCode':_0x41c76d['statusCode']}:_0x41c76d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1792f83..6018947 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 _0x00dc=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1d8990,_0x4382b5){var _0x5ce380=function(_0x195a34){while(--_0x195a34){_0x1d8990['push'](_0x1d8990['shift']());}};_0x5ce380(++_0x4382b5);}(_0x00dc,0x1e4));var _0xc00d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00dc[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xc00d('0x0'));var util=require(_0xc00d('0x1'));var logger=require(_0xc00d('0x2'))(_0xc00d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc00d('0x4'));var rimraf=require(_0xc00d('0x5'));var config=require(_0xc00d('0x6'));var attributes=require(_0xc00d('0x7'));var integrations=require(_0xc00d('0x8'));module[_0xc00d('0x9')]=function(_0x48952c,_0x26e1e3){return _0x48952c[_0xc00d('0xa')](_0xc00d('0xb'),attributes,{'tableName':_0xc00d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac05=['bluebird','request-promise','path','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger'];(function(_0x3312b0,_0x4d69b7){var _0x280c06=function(_0x5d2c10){while(--_0x5d2c10){_0x3312b0['push'](_0x3312b0['shift']());}};_0x280c06(++_0x4d69b7);}(_0xac05,0xd6));var _0x5ac0=function(_0x5e0c95,_0x21dbe6){_0x5e0c95=_0x5e0c95-0x0;var _0x12906f=_0xac05[_0x5e0c95];return _0x12906f;};'use strict';var _=require('lodash');var util=require(_0x5ac0('0x0'));var logger=require(_0x5ac0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5ac0('0x2'));var rp=require(_0x5ac0('0x3'));var fs=require('fs');var path=require(_0x5ac0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ac0('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x319a70,_0x27da9c){return _0x319a70[_0x5ac0('0x6')](_0x5ac0('0x7'),attributes,{'tableName':_0x5ac0('0x8'),'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 6a21ae3..3f64776 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 _0x22a8=['model','attributes','ShowZendeskAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map'];(function(_0x259cf5,_0x581086){var _0x4c5b50=function(_0x3bf660){while(--_0x3bf660){_0x259cf5['push'](_0x259cf5['shift']());}};_0x4c5b50(++_0x581086);}(_0x22a8,0x16d));var _0x822a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x22a8[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x822a('0x0'));var util=require(_0x822a('0x1'));var moment=require(_0x822a('0x2'));var BPromise=require(_0x822a('0x3'));var rs=require(_0x822a('0x4'));var fs=require('fs');var Redis=require(_0x822a('0x5'));var db=require(_0x822a('0x6'))['db'];var utils=require(_0x822a('0x7'));var logger=require(_0x822a('0x8'))('rpc');var config=require(_0x822a('0x9'));var jayson=require(_0x822a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3eeb4c,_0xded59d,_0x294b2c){return new BPromise(function(_0x5ebe98,_0x5108a5){return client[_0x822a('0xb')](_0x3eeb4c,_0x294b2c)[_0x822a('0xc')](function(_0x2a9a89){logger[_0x822a('0xd')](_0x822a('0xe'),_0xded59d,_0x822a('0xf'));logger[_0x822a('0x10')](_0x822a('0x11'),_0xded59d,_0x822a('0xf'),JSON['stringify'](_0x2a9a89));if(_0x2a9a89[_0x822a('0x12')]){if(_0x2a9a89[_0x822a('0x12')][_0x822a('0x13')]===0x1f4){logger[_0x822a('0x12')](_0x822a('0xe'),_0xded59d,_0x2a9a89[_0x822a('0x12')][_0x822a('0x14')]);return _0x5108a5(_0x2a9a89[_0x822a('0x12')][_0x822a('0x14')]);}logger[_0x822a('0x12')](_0x822a('0xe'),_0xded59d,_0x2a9a89[_0x822a('0x12')]['message']);return _0x5ebe98(_0x2a9a89['error'][_0x822a('0x14')]);}else{logger[_0x822a('0xd')](_0x822a('0xe'),_0xded59d,_0x822a('0xf'));_0x5ebe98(_0x2a9a89['result']['message']);}})[_0x822a('0x15')](function(_0x1c2225){logger[_0x822a('0x12')](_0x822a('0xe'),_0xded59d,_0x1c2225);_0x5108a5(_0x1c2225);});});}exports[_0x822a('0x16')]=function(_0x322898){var _0x353ad2=this;return new Promise(function(_0x2a20e1,_0x206f2a){return db[_0x822a('0x17')][_0x822a('0x18')]({'raw':_0x322898[_0x822a('0x19')]?_0x322898['options'][_0x822a('0x1a')]===undefined?!![]:![]:!![],'where':_0x322898[_0x822a('0x19')]?_0x322898[_0x822a('0x19')][_0x822a('0x1b')]||null:null,'attributes':_0x322898['options']?_0x322898['options']['attributes']||null:null,'limit':_0x322898['options']?_0x322898[_0x822a('0x19')][_0x822a('0x1c')]||null:null,'include':_0x322898['options']?_0x322898[_0x822a('0x19')][_0x822a('0x1d')]?_[_0x822a('0x1e')](_0x322898['options'][_0x822a('0x1d')],function(_0x1b0b63){return{'model':db[_0x1b0b63[_0x822a('0x1f')]],'as':_0x1b0b63['as'],'attributes':_0x1b0b63[_0x822a('0x20')],'include':_0x1b0b63[_0x822a('0x1d')]?_[_0x822a('0x1e')](_0x1b0b63['include'],function(_0x23f11b){return{'model':db[_0x23f11b[_0x822a('0x1f')]],'as':_0x23f11b['as'],'attributes':_0x23f11b[_0x822a('0x20')],'include':_0x23f11b[_0x822a('0x1d')]?_['map'](_0x23f11b[_0x822a('0x1d')],function(_0xdc557f){return{'model':db[_0xdc557f['model']],'as':_0xdc557f['as'],'attributes':_0xdc557f[_0x822a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x822a('0xc')](function(_0x47ba65){logger[_0x822a('0xd')]('GetZendeskAccount',_0x322898);logger['debug']('GetZendeskAccount',_0x322898,JSON['stringify'](_0x47ba65));_0x2a20e1(_0x47ba65);})['catch'](function(_0x5289e6){logger[_0x822a('0x12')]('GetZendeskAccount',_0x5289e6[_0x822a('0x14')],_0x322898);_0x206f2a(_0x353ad2[_0x822a('0x12')](0x1f4,_0x5289e6[_0x822a('0x14')]));});});};exports[_0x822a('0x21')]=function(_0x1792b3){var _0x5a39ac=this;return new Promise(function(_0x2e0f13,_0x2bcad1){return db[_0x822a('0x17')][_0x822a('0x22')]({'raw':_0x1792b3[_0x822a('0x19')]?_0x1792b3['options'][_0x822a('0x1a')]===undefined?!![]:![]:!![],'where':_0x1792b3['options']?_0x1792b3[_0x822a('0x19')][_0x822a('0x1b')]||null:null,'attributes':_0x1792b3[_0x822a('0x19')]?_0x1792b3['options'][_0x822a('0x20')]||null:null,'include':_0x1792b3[_0x822a('0x19')]?_0x1792b3[_0x822a('0x19')][_0x822a('0x1d')]?_[_0x822a('0x1e')](_0x1792b3[_0x822a('0x19')][_0x822a('0x1d')],function(_0x36cccf){return{'model':db[_0x36cccf['model']],'as':_0x36cccf['as'],'attributes':_0x36cccf[_0x822a('0x20')],'include':_0x36cccf[_0x822a('0x1d')]?_['map'](_0x36cccf['include'],function(_0x5f41a9){return{'model':db[_0x5f41a9[_0x822a('0x1f')]],'as':_0x5f41a9['as'],'attributes':_0x5f41a9[_0x822a('0x20')],'include':_0x5f41a9[_0x822a('0x1d')]?_[_0x822a('0x1e')](_0x5f41a9[_0x822a('0x1d')],function(_0xf52583){return{'model':db[_0xf52583[_0x822a('0x1f')]],'as':_0xf52583['as'],'attributes':_0xf52583[_0x822a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x822a('0xc')](function(_0x453f58){logger[_0x822a('0xd')](_0x822a('0x21'),_0x1792b3);logger[_0x822a('0x10')](_0x822a('0x21'),_0x1792b3,JSON[_0x822a('0x23')](_0x453f58));_0x2e0f13(_0x453f58);})[_0x822a('0x15')](function(_0xff0696){logger[_0x822a('0x12')](_0x822a('0x21'),_0xff0696[_0x822a('0x14')],_0x1792b3);_0x2bcad1(_0x5a39ac[_0x822a('0x12')](0x1f4,_0xff0696['message']));});});}; \ No newline at end of file +var _0x4dba=['info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','catch','ZendeskAccount','options','raw','where','attributes','limit','map','include','model','GetZendeskAccount','ShowZendeskAccount','find','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x180df3,_0x2c12ee){var _0xa5ff44=function(_0x5be799){while(--_0x5be799){_0x180df3['push'](_0x180df3['shift']());}};_0xa5ff44(++_0x2c12ee);}(_0x4dba,0x15f));var _0xa4db=function(_0x4acc36,_0x51c78b){_0x4acc36=_0x4acc36-0x0;var _0x38a1ad=_0x4dba[_0x4acc36];return _0x38a1ad;};'use strict';var _=require(_0xa4db('0x0'));var util=require(_0xa4db('0x1'));var moment=require(_0xa4db('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4db('0x3'));var fs=require('fs');var Redis=require(_0xa4db('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa4db('0x5'))(_0xa4db('0x6'));var config=require('../../config/environment');var jayson=require(_0xa4db('0x7'));var client=jayson[_0xa4db('0x8')][_0xa4db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a9a70,_0xec9662,_0x395a99){return new BPromise(function(_0x4e6d3b,_0x463ef5){return client[_0xa4db('0xa')](_0x4a9a70,_0x395a99)[_0xa4db('0xb')](function(_0x1f7ec4){logger[_0xa4db('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0xec9662,_0xa4db('0xd'));logger[_0xa4db('0xe')](_0xa4db('0xf'),_0xec9662,'request\x20sent',JSON[_0xa4db('0x10')](_0x1f7ec4));if(_0x1f7ec4['error']){if(_0x1f7ec4[_0xa4db('0x11')]['code']===0x1f4){logger['error'](_0xa4db('0x12'),_0xec9662,_0x1f7ec4[_0xa4db('0x11')][_0xa4db('0x13')]);return _0x463ef5(_0x1f7ec4[_0xa4db('0x11')][_0xa4db('0x13')]);}logger[_0xa4db('0x11')](_0xa4db('0x12'),_0xec9662,_0x1f7ec4[_0xa4db('0x11')]['message']);return _0x4e6d3b(_0x1f7ec4[_0xa4db('0x11')][_0xa4db('0x13')]);}else{logger[_0xa4db('0xc')](_0xa4db('0x12'),_0xec9662,_0xa4db('0xd'));_0x4e6d3b(_0x1f7ec4['result'][_0xa4db('0x13')]);}})[_0xa4db('0x14')](function(_0xd5e36e){logger[_0xa4db('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0xec9662,_0xd5e36e);_0x463ef5(_0xd5e36e);});});}exports['GetZendeskAccount']=function(_0x1c16b0){var _0x46b933=this;return new Promise(function(_0x5426a4,_0x12f979){return db[_0xa4db('0x15')]['findAll']({'raw':_0x1c16b0[_0xa4db('0x16')]?_0x1c16b0['options'][_0xa4db('0x17')]===undefined?!![]:![]:!![],'where':_0x1c16b0[_0xa4db('0x16')]?_0x1c16b0[_0xa4db('0x16')][_0xa4db('0x18')]||null:null,'attributes':_0x1c16b0['options']?_0x1c16b0[_0xa4db('0x16')][_0xa4db('0x19')]||null:null,'limit':_0x1c16b0[_0xa4db('0x16')]?_0x1c16b0[_0xa4db('0x16')][_0xa4db('0x1a')]||null:null,'include':_0x1c16b0[_0xa4db('0x16')]?_0x1c16b0['options']['include']?_[_0xa4db('0x1b')](_0x1c16b0[_0xa4db('0x16')][_0xa4db('0x1c')],function(_0xdd428a){return{'model':db[_0xdd428a[_0xa4db('0x1d')]],'as':_0xdd428a['as'],'attributes':_0xdd428a['attributes'],'include':_0xdd428a[_0xa4db('0x1c')]?_['map'](_0xdd428a['include'],function(_0x3c71a0){return{'model':db[_0x3c71a0[_0xa4db('0x1d')]],'as':_0x3c71a0['as'],'attributes':_0x3c71a0[_0xa4db('0x19')],'include':_0x3c71a0[_0xa4db('0x1c')]?_[_0xa4db('0x1b')](_0x3c71a0[_0xa4db('0x1c')],function(_0x345dd7){return{'model':db[_0x345dd7[_0xa4db('0x1d')]],'as':_0x345dd7['as'],'attributes':_0x345dd7[_0xa4db('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa4db('0xb')](function(_0x5ede53){logger['info'](_0xa4db('0x1e'),_0x1c16b0);logger[_0xa4db('0xe')](_0xa4db('0x1e'),_0x1c16b0,JSON['stringify'](_0x5ede53));_0x5426a4(_0x5ede53);})['catch'](function(_0x22f5e5){logger[_0xa4db('0x11')](_0xa4db('0x1e'),_0x22f5e5[_0xa4db('0x13')],_0x1c16b0);_0x12f979(_0x46b933[_0xa4db('0x11')](0x1f4,_0x22f5e5[_0xa4db('0x13')]));});});};exports[_0xa4db('0x1f')]=function(_0x276875){var _0x294161=this;return new Promise(function(_0x311b9c,_0x2453f8){return db[_0xa4db('0x15')][_0xa4db('0x20')]({'raw':_0x276875[_0xa4db('0x16')]?_0x276875[_0xa4db('0x16')][_0xa4db('0x17')]===undefined?!![]:![]:!![],'where':_0x276875[_0xa4db('0x16')]?_0x276875[_0xa4db('0x16')][_0xa4db('0x18')]||null:null,'attributes':_0x276875[_0xa4db('0x16')]?_0x276875[_0xa4db('0x16')][_0xa4db('0x19')]||null:null,'include':_0x276875[_0xa4db('0x16')]?_0x276875[_0xa4db('0x16')]['include']?_[_0xa4db('0x1b')](_0x276875[_0xa4db('0x16')]['include'],function(_0x2be395){return{'model':db[_0x2be395[_0xa4db('0x1d')]],'as':_0x2be395['as'],'attributes':_0x2be395[_0xa4db('0x19')],'include':_0x2be395[_0xa4db('0x1c')]?_[_0xa4db('0x1b')](_0x2be395['include'],function(_0x42a47e){return{'model':db[_0x42a47e[_0xa4db('0x1d')]],'as':_0x42a47e['as'],'attributes':_0x42a47e[_0xa4db('0x19')],'include':_0x42a47e['include']?_['map'](_0x42a47e[_0xa4db('0x1c')],function(_0x36e754){return{'model':db[_0x36e754['model']],'as':_0x36e754['as'],'attributes':_0x36e754['attributes']};}):[]};}):[]};}):[]:[]})[_0xa4db('0xb')](function(_0x51b347){logger[_0xa4db('0xc')]('ShowZendeskAccount',_0x276875);logger['debug'](_0xa4db('0x1f'),_0x276875,JSON[_0xa4db('0x10')](_0x51b347));_0x311b9c(_0x51b347);})[_0xa4db('0x14')](function(_0x4d36a3){logger[_0xa4db('0x11')](_0xa4db('0x1f'),_0x4d36a3[_0xa4db('0x13')],_0x276875);_0x2453f8(_0x294161[_0xa4db('0x11')](0x1f4,_0x4d36a3[_0xa4db('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8da6523..bd7e2e8 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 _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x63f45c,_0x29b9d3){var _0x12d04f=function(_0x51a5d6){while(--_0x51a5d6){_0x63f45c['push'](_0x63f45c['shift']());}};_0x12d04f(++_0x29b9d3);}(_0x750a,0x140));var _0xa750=function(_0xda6f2c,_0x4d5932){_0xda6f2c=_0xda6f2c-0x0;var _0x20ee51=_0x750a[_0xda6f2c];return _0x20ee51;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('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(_0x4c8e93,_0x3f101e){var _0x54dbb3=function(_0x266968){while(--_0x266968){_0x4c8e93['push'](_0x4c8e93['shift']());}};_0x54dbb3(++_0x3f101e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x111f6d,_0x53bc7b){_0x111f6d=_0x111f6d-0x0;var _0x4ea3c1=_0xf4eb[_0x111f6d];return _0x4ea3c1;};'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 aa7e9d2..92d5d11 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 _0x602b=['STRING','sequelize','exports'];(function(_0x22a9b7,_0x58e5d4){var _0x8a8568=function(_0x271479){while(--_0x271479){_0x22a9b7['push'](_0x22a9b7['shift']());}};_0x8a8568(++_0x58e5d4);}(_0x602b,0x64));var _0xb602=function(_0xc0a1f5,_0x236d8d){_0xc0a1f5=_0xc0a1f5-0x0;var _0x78bcdb=_0x602b[_0xc0a1f5];return _0x78bcdb;};'use strict';var Sequelize=require(_0xb602('0x0'));module[_0xb602('0x1')]={'name':{'type':Sequelize[_0xb602('0x2')]},'description':{'type':Sequelize[_0xb602('0x2')]}}; \ No newline at end of file +var _0x27fa=['STRING','sequelize','exports'];(function(_0x1db893,_0x1788e6){var _0x451f62=function(_0x43b1f5){while(--_0x43b1f5){_0x1db893['push'](_0x1db893['shift']());}};_0x451f62(++_0x1788e6);}(_0x27fa,0x103));var _0xa27f=function(_0x4b368d,_0x300518){_0x4b368d=_0x4b368d-0x0;var _0x1ee204=_0x27fa[_0x4b368d];return _0x1ee204;};'use strict';var Sequelize=require(_0xa27f('0x0'));module[_0xa27f('0x1')]={'name':{'type':Sequelize[_0xa27f('0x2')]},'description':{'type':Sequelize[_0xa27f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index a693bd4..09f54db 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 _0xc029=['apply','reject','save','update','then','destroy','error','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','findOne','ZendeskField','merge','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','body','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0xc029,0x8a));var _0x9c02=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0xc029[_0x45b1ba];return _0x145ddb;};'use strict';var emlformat=require(_0x9c02('0x0'));var rimraf=require(_0x9c02('0x1'));var zipdir=require(_0x9c02('0x2'));var jsonpatch=require(_0x9c02('0x3'));var rp=require(_0x9c02('0x4'));var moment=require('moment');var BPromise=require(_0x9c02('0x5'));var Mustache=require(_0x9c02('0x6'));var util=require(_0x9c02('0x7'));var path=require(_0x9c02('0x8'));var sox=require(_0x9c02('0x9'));var csv=require('to-csv');var ejs=require(_0x9c02('0xa'));var fs=require('fs');var fs_extra=require(_0x9c02('0xb'));var _=require(_0x9c02('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9c02('0xd'));var deskjs=require(_0x9c02('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9c02('0xf'));var Papa=require(_0x9c02('0x10'));var Redis=require(_0x9c02('0x11'));var authService=require(_0x9c02('0x12'));var qs=require(_0x9c02('0x13'));var as=require(_0x9c02('0x14'));var hardwareService=require(_0x9c02('0x15'));var logger=require(_0x9c02('0x16'))(_0x9c02('0x17'));var utils=require(_0x9c02('0x18'));var config=require(_0x9c02('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c02('0x1a'))['db'];function respondWithStatusCode(_0x4c8738,_0x5e0f45){_0x5e0f45=_0x5e0f45||0xcc;return function(_0x474f5a){if(_0x474f5a){return _0x4c8738[_0x9c02('0x1b')](_0x5e0f45);}return _0x4c8738[_0x9c02('0x1c')](_0x5e0f45)[_0x9c02('0x1d')]();};}function respondWithResult(_0xf877a0,_0x48090a){_0x48090a=_0x48090a||0xc8;return function(_0x4426f6){if(_0x4426f6){return _0xf877a0['status'](_0x48090a)[_0x9c02('0x1e')](_0x4426f6);}};}function respondWithFilteredResult(_0x25b9ce,_0x5a822b){return function(_0x59f580){if(_0x59f580){var _0x1a19bf=typeof _0x5a822b[_0x9c02('0x1f')]===_0x9c02('0x20')&&typeof _0x5a822b[_0x9c02('0x21')]===_0x9c02('0x20');var _0xf41fa6=_0x59f580[_0x9c02('0x22')];var _0x3934e6=_0x1a19bf?0x0:_0x5a822b['offset'];var _0x20b857=_0x1a19bf?_0x59f580[_0x9c02('0x22')]:_0x5a822b[_0x9c02('0x1f')]+_0x5a822b['limit'];var _0x44cea7;if(_0x20b857>=_0xf41fa6){_0x20b857=_0xf41fa6;_0x44cea7=0xc8;}else{_0x44cea7=0xce;}_0x25b9ce[_0x9c02('0x1c')](_0x44cea7);return _0x25b9ce['set'](_0x9c02('0x23'),_0x3934e6+'-'+_0x20b857+'/'+_0xf41fa6)[_0x9c02('0x1e')](_0x59f580);}return null;};}function patchUpdates(_0x42b23c){return function(_0x408216){try{jsonpatch[_0x9c02('0x24')](_0x408216,_0x42b23c,!![]);}catch(_0x558cd4){return BPromise[_0x9c02('0x25')](_0x558cd4);}return _0x408216[_0x9c02('0x26')]();};}function saveUpdates(_0x46f000,_0x457327){return function(_0x1d36fe){if(_0x1d36fe){return _0x1d36fe[_0x9c02('0x27')](_0x46f000)[_0x9c02('0x28')](function(_0x3b6e65){return _0x3b6e65;});}return null;};}function removeEntity(_0xb2ade7,_0x5d6c81){return function(_0x4af1f9){if(_0x4af1f9){return _0x4af1f9[_0x9c02('0x29')]()[_0x9c02('0x28')](function(){_0xb2ade7[_0x9c02('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f017,_0xd4dcf1){return function(_0x545ad4){if(!_0x545ad4){_0x19f017[_0x9c02('0x1b')](0x194);}return _0x545ad4;};}function handleError(_0x51c8b7,_0x2abe19){_0x2abe19=_0x2abe19||0x1f4;return function(_0x35147d){logger[_0x9c02('0x2a')](_0x35147d['stack']);if(_0x35147d[_0x9c02('0x2b')]){delete _0x35147d[_0x9c02('0x2b')];}_0x51c8b7[_0x9c02('0x1c')](_0x2abe19)[_0x9c02('0x2c')](_0x35147d);};}exports['index']=function(_0x39fa1e,_0x1a4043){var _0x10c3a1={},_0x59c544={},_0x2e6eed={'count':0x0,'rows':[]};var _0x3eeffd=_[_0x9c02('0x2d')](db[_0x9c02('0x2e')][_0x9c02('0x2f')],function(_0x47e8f8){return{'name':_0x47e8f8[_0x9c02('0x30')],'type':_0x47e8f8[_0x9c02('0x31')][_0x9c02('0x32')]};});_0x59c544['model']=_['map'](_0x3eeffd,'name');_0x59c544[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x39fa1e[_0x9c02('0x33')]);_0x59c544[_0x9c02('0x35')]=_[_0x9c02('0x36')](_0x59c544[_0x9c02('0x37')],_0x59c544[_0x9c02('0x33')]);_0x10c3a1[_0x9c02('0x38')]=_[_0x9c02('0x36')](_0x59c544[_0x9c02('0x37')],qs['fields'](_0x39fa1e[_0x9c02('0x33')]['fields']));_0x10c3a1[_0x9c02('0x38')]=_0x10c3a1[_0x9c02('0x38')]['length']?_0x10c3a1[_0x9c02('0x38')]:_0x59c544['model'];if(!_0x39fa1e[_0x9c02('0x33')]['hasOwnProperty'](_0x9c02('0x39'))){_0x10c3a1['limit']=qs['limit'](_0x39fa1e['query']['limit']);_0x10c3a1['offset']=qs[_0x9c02('0x1f')](_0x39fa1e[_0x9c02('0x33')][_0x9c02('0x1f')]);}_0x10c3a1[_0x9c02('0x3a')]=qs[_0x9c02('0x3b')](_0x39fa1e['query'][_0x9c02('0x3b')]);_0x10c3a1[_0x9c02('0x3c')]=qs[_0x9c02('0x35')](_[_0x9c02('0x3d')](_0x39fa1e[_0x9c02('0x33')],_0x59c544['filters']),_0x3eeffd);if(_0x39fa1e[_0x9c02('0x33')][_0x9c02('0x3e')]){_0x10c3a1[_0x9c02('0x3c')]=_['merge'](_0x10c3a1[_0x9c02('0x3c')],{'$or':_[_0x9c02('0x2d')](_0x3eeffd,function(_0x145da5){if(_0x145da5[_0x9c02('0x31')]!==_0x9c02('0x3f')){var _0x216c7c={};_0x216c7c[_0x145da5[_0x9c02('0x2b')]]={'$like':'%'+_0x39fa1e[_0x9c02('0x33')][_0x9c02('0x3e')]+'%'};return _0x216c7c;}})});}_0x10c3a1=_['merge']({},_0x10c3a1,_0x39fa1e[_0x9c02('0x40')]);var _0x5aae73={'where':_0x10c3a1['where']};return db['ZendeskConfiguration']['count'](_0x5aae73)['then'](function(_0x3a1016){_0x2e6eed[_0x9c02('0x22')]=_0x3a1016;if(_0x39fa1e[_0x9c02('0x33')][_0x9c02('0x41')]){_0x10c3a1[_0x9c02('0x42')]=[{'all':!![]}];}return db[_0x9c02('0x2e')][_0x9c02('0x43')](_0x10c3a1);})[_0x9c02('0x28')](function(_0x4b452b){_0x2e6eed[_0x9c02('0x44')]=_0x4b452b;return _0x2e6eed;})[_0x9c02('0x28')](respondWithFilteredResult(_0x1a4043,_0x10c3a1))[_0x9c02('0x45')](handleError(_0x1a4043,null));};exports[_0x9c02('0x46')]=function(_0x579d03,_0x284c39){var _0x46c5aa={'raw':![],'where':{'id':_0x579d03[_0x9c02('0x47')]['id']}},_0x540b2a={};_0x540b2a['model']=_['keys'](db[_0x9c02('0x2e')][_0x9c02('0x2f')]);_0x540b2a[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x579d03['query']);_0x540b2a[_0x9c02('0x35')]=_[_0x9c02('0x36')](_0x540b2a[_0x9c02('0x37')],_0x540b2a[_0x9c02('0x33')]);_0x46c5aa[_0x9c02('0x38')]=_[_0x9c02('0x36')](_0x540b2a[_0x9c02('0x37')],qs['fields'](_0x579d03['query'][_0x9c02('0x48')]));_0x46c5aa[_0x9c02('0x38')]=_0x46c5aa[_0x9c02('0x38')][_0x9c02('0x49')]?_0x46c5aa[_0x9c02('0x38')]:_0x540b2a[_0x9c02('0x37')];if(_0x579d03[_0x9c02('0x33')][_0x9c02('0x41')]){_0x46c5aa['include']=[{'all':!![]}];}_0x46c5aa=_['merge']({},_0x46c5aa,_0x579d03[_0x9c02('0x40')]);return db[_0x9c02('0x2e')][_0x9c02('0x4a')](_0x46c5aa)[_0x9c02('0x28')](handleEntityNotFound(_0x284c39,null))[_0x9c02('0x28')](respondWithResult(_0x284c39,null))[_0x9c02('0x45')](handleError(_0x284c39,null));};exports['create']=function(_0xc15914,_0x4e46be){return db[_0x9c02('0x2e')][_0x9c02('0x4b')](_0xc15914['body'],{})['then'](respondWithResult(_0x4e46be,0xc9))[_0x9c02('0x45')](handleError(_0x4e46be,null));};exports[_0x9c02('0x27')]=function(_0x114ae2,_0x3ad048){if(_0x114ae2['body']['id']){delete _0x114ae2['body']['id'];}return db['ZendeskConfiguration'][_0x9c02('0x4a')]({'where':{'id':_0x114ae2[_0x9c02('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ad048,null))['then'](saveUpdates(_0x114ae2['body'],null))[_0x9c02('0x28')](respondWithResult(_0x3ad048,null))[_0x9c02('0x45')](handleError(_0x3ad048,null));};exports['destroy']=function(_0x43e1af,_0x2461b0){return db[_0x9c02('0x2e')][_0x9c02('0x4a')]({'where':{'id':_0x43e1af['params']['id']}})[_0x9c02('0x28')](handleEntityNotFound(_0x2461b0,null))[_0x9c02('0x28')](removeEntity(_0x2461b0,null))['catch'](handleError(_0x2461b0,null));};exports['getFields']=function(_0x559b55,_0x32def1,_0x44c9d0){var _0x626056={};var _0x97a149={};var _0xac9a41;var _0x6874e7;return db[_0x9c02('0x2e')][_0x9c02('0x4c')]({'where':{'id':_0x559b55[_0x9c02('0x47')]['id']}})['then'](handleEntityNotFound(_0x32def1,null))[_0x9c02('0x28')](function(_0x134e39){if(_0x134e39){_0xac9a41=_0x134e39;_0x97a149[_0x9c02('0x37')]=_[_0x9c02('0x34')](db[_0x9c02('0x4d')]['rawAttributes']);_0x97a149[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x559b55[_0x9c02('0x33')]);_0x97a149[_0x9c02('0x35')]=_[_0x9c02('0x36')](_0x97a149[_0x9c02('0x37')],_0x97a149[_0x9c02('0x33')]);_0x626056[_0x9c02('0x38')]=_[_0x9c02('0x36')](_0x97a149[_0x9c02('0x37')],qs[_0x9c02('0x48')](_0x559b55['query'][_0x9c02('0x48')]));_0x626056[_0x9c02('0x38')]=_0x626056[_0x9c02('0x38')][_0x9c02('0x49')]?_0x626056[_0x9c02('0x38')]:_0x97a149[_0x9c02('0x37')];_0x626056['order']=qs[_0x9c02('0x3b')](_0x559b55[_0x9c02('0x33')][_0x9c02('0x3b')]);_0x626056[_0x9c02('0x3c')]=qs['filters'](_[_0x9c02('0x3d')](_0x559b55[_0x9c02('0x33')],_0x97a149[_0x9c02('0x35')]));if(_0x559b55['query'][_0x9c02('0x3e')]){_0x626056[_0x9c02('0x3c')]=_[_0x9c02('0x4e')](_0x626056[_0x9c02('0x3c')],{'$or':_[_0x9c02('0x2d')](_0x626056[_0x9c02('0x38')],function(_0x529694){var _0xccb50a={};_0xccb50a[_0x529694]={'$like':'%'+_0x559b55[_0x9c02('0x33')][_0x9c02('0x3e')]+'%'};return _0xccb50a;})});}_0x626056=_[_0x9c02('0x4e')]({},_0x626056,_0x559b55[_0x9c02('0x40')]);return _0xac9a41[_0x9c02('0x4f')](_0x626056);}})[_0x9c02('0x28')](function(_0x19ca49){if(_0x19ca49){_0x6874e7=_0x19ca49[_0x9c02('0x49')];if(!_0x559b55['query'][_0x9c02('0x50')](_0x9c02('0x39'))){_0x626056[_0x9c02('0x21')]=qs[_0x9c02('0x21')](_0x559b55[_0x9c02('0x33')]['limit']);_0x626056[_0x9c02('0x1f')]=qs[_0x9c02('0x1f')](_0x559b55[_0x9c02('0x33')][_0x9c02('0x1f')]);}return _0xac9a41[_0x9c02('0x4f')](_0x626056);}})[_0x9c02('0x28')](function(_0x34c01a){if(_0x34c01a){return _0x34c01a?{'count':_0x6874e7,'rows':_0x34c01a}:null;}})['then'](respondWithResult(_0x32def1,null))[_0x9c02('0x45')](handleError(_0x32def1,null));};exports[_0x9c02('0x51')]=function(_0x1d3346,_0x258e2e,_0x835642){var _0x100f4e={};var _0x24f019={};var _0x3133fd;var _0x159e24;return db[_0x9c02('0x2e')][_0x9c02('0x4c')]({'where':{'id':_0x1d3346['params']['id']}})[_0x9c02('0x28')](handleEntityNotFound(_0x258e2e,null))[_0x9c02('0x28')](function(_0x47d37b){if(_0x47d37b){_0x3133fd=_0x47d37b;_0x24f019[_0x9c02('0x37')]=_['keys'](db[_0x9c02('0x4d')]['rawAttributes']);_0x24f019[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x1d3346['query']);_0x24f019['filters']=_[_0x9c02('0x36')](_0x24f019[_0x9c02('0x37')],_0x24f019['query']);_0x100f4e[_0x9c02('0x38')]=_[_0x9c02('0x36')](_0x24f019[_0x9c02('0x37')],qs['fields'](_0x1d3346['query']['fields']));_0x100f4e[_0x9c02('0x38')]=_0x100f4e[_0x9c02('0x38')]['length']?_0x100f4e[_0x9c02('0x38')]:_0x24f019[_0x9c02('0x37')];_0x100f4e['order']=qs[_0x9c02('0x3b')](_0x1d3346['query'][_0x9c02('0x3b')]);_0x100f4e['where']=qs[_0x9c02('0x35')](_[_0x9c02('0x3d')](_0x1d3346['query'],_0x24f019['filters']));if(_0x1d3346[_0x9c02('0x33')][_0x9c02('0x3e')]){_0x100f4e['where']=_[_0x9c02('0x4e')](_0x100f4e['where'],{'$or':_[_0x9c02('0x2d')](_0x100f4e[_0x9c02('0x38')],function(_0x43d842){var _0x4820fa={};_0x4820fa[_0x43d842]={'$like':'%'+_0x1d3346['query'][_0x9c02('0x3e')]+'%'};return _0x4820fa;})});}_0x100f4e=_[_0x9c02('0x4e')]({},_0x100f4e,_0x1d3346['options']);return _0x3133fd[_0x9c02('0x51')](_0x100f4e);}})[_0x9c02('0x28')](function(_0x4c2943){if(_0x4c2943){_0x159e24=_0x4c2943[_0x9c02('0x49')];if(!_0x1d3346['query'][_0x9c02('0x50')](_0x9c02('0x39'))){_0x100f4e['limit']=qs[_0x9c02('0x21')](_0x1d3346[_0x9c02('0x33')][_0x9c02('0x21')]);_0x100f4e[_0x9c02('0x1f')]=qs[_0x9c02('0x1f')](_0x1d3346['query'][_0x9c02('0x1f')]);}return _0x3133fd[_0x9c02('0x51')](_0x100f4e);}})[_0x9c02('0x28')](function(_0x18e31e){if(_0x18e31e){return _0x18e31e?{'count':_0x159e24,'rows':_0x18e31e}:null;}})[_0x9c02('0x28')](respondWithResult(_0x258e2e,null))['catch'](handleError(_0x258e2e,null));};exports[_0x9c02('0x52')]=function(_0x50bb8f,_0x4a3e59,_0x3be6c6){var _0x6baaf2={};var _0x4a146e={};var _0x451a87;var _0x142099;return db[_0x9c02('0x2e')][_0x9c02('0x4c')]({'where':{'id':_0x50bb8f['params']['id']}})[_0x9c02('0x28')](handleEntityNotFound(_0x4a3e59,null))[_0x9c02('0x28')](function(_0x410177){if(_0x410177){_0x451a87=_0x410177;_0x4a146e[_0x9c02('0x37')]=_[_0x9c02('0x34')](db[_0x9c02('0x4d')][_0x9c02('0x2f')]);_0x4a146e[_0x9c02('0x33')]=_['keys'](_0x50bb8f[_0x9c02('0x33')]);_0x4a146e[_0x9c02('0x35')]=_[_0x9c02('0x36')](_0x4a146e[_0x9c02('0x37')],_0x4a146e[_0x9c02('0x33')]);_0x6baaf2['attributes']=_[_0x9c02('0x36')](_0x4a146e[_0x9c02('0x37')],qs[_0x9c02('0x48')](_0x50bb8f['query'][_0x9c02('0x48')]));_0x6baaf2[_0x9c02('0x38')]=_0x6baaf2[_0x9c02('0x38')]['length']?_0x6baaf2['attributes']:_0x4a146e[_0x9c02('0x37')];_0x6baaf2[_0x9c02('0x3a')]=qs[_0x9c02('0x3b')](_0x50bb8f[_0x9c02('0x33')][_0x9c02('0x3b')]);_0x6baaf2[_0x9c02('0x3c')]=qs[_0x9c02('0x35')](_[_0x9c02('0x3d')](_0x50bb8f[_0x9c02('0x33')],_0x4a146e[_0x9c02('0x35')]));if(_0x50bb8f[_0x9c02('0x33')]['filter']){_0x6baaf2['where']=_['merge'](_0x6baaf2['where'],{'$or':_['map'](_0x6baaf2['attributes'],function(_0x586b72){var _0x19210f={};_0x19210f[_0x586b72]={'$like':'%'+_0x50bb8f[_0x9c02('0x33')][_0x9c02('0x3e')]+'%'};return _0x19210f;})});}_0x6baaf2=_['merge']({},_0x6baaf2,_0x50bb8f[_0x9c02('0x40')]);return _0x451a87['getDescriptions'](_0x6baaf2);}})['then'](function(_0x484570){if(_0x484570){_0x142099=_0x484570[_0x9c02('0x49')];if(!_0x50bb8f['query']['hasOwnProperty']('nolimit')){_0x6baaf2[_0x9c02('0x21')]=qs['limit'](_0x50bb8f[_0x9c02('0x33')][_0x9c02('0x21')]);_0x6baaf2[_0x9c02('0x1f')]=qs[_0x9c02('0x1f')](_0x50bb8f[_0x9c02('0x33')]['offset']);}return _0x451a87[_0x9c02('0x52')](_0x6baaf2);}})[_0x9c02('0x28')](function(_0x5a7fc6){if(_0x5a7fc6){return _0x5a7fc6?{'count':_0x142099,'rows':_0x5a7fc6}:null;}})[_0x9c02('0x28')](respondWithResult(_0x4a3e59,null))[_0x9c02('0x45')](handleError(_0x4a3e59,null));};exports[_0x9c02('0x53')]=function(_0xbe9788,_0xec271c,_0x15243a){var _0x2fc441={};var _0x3a0336={};var _0x53e2af;var _0x1f970a;return db['ZendeskConfiguration'][_0x9c02('0x4c')]({'where':{'id':_0xbe9788[_0x9c02('0x47')]['id']}})['then'](handleEntityNotFound(_0xec271c,null))[_0x9c02('0x28')](function(_0x95469f){if(_0x95469f){_0x53e2af=_0x95469f;_0x3a0336[_0x9c02('0x37')]=_[_0x9c02('0x34')](db['Tag'][_0x9c02('0x2f')]);_0x3a0336[_0x9c02('0x33')]=_['keys'](_0xbe9788[_0x9c02('0x33')]);_0x3a0336[_0x9c02('0x35')]=_[_0x9c02('0x36')](_0x3a0336['model'],_0x3a0336[_0x9c02('0x33')]);_0x2fc441['attributes']=_[_0x9c02('0x36')](_0x3a0336[_0x9c02('0x37')],qs[_0x9c02('0x48')](_0xbe9788['query'][_0x9c02('0x48')]));_0x2fc441[_0x9c02('0x38')]=_0x2fc441[_0x9c02('0x38')][_0x9c02('0x49')]?_0x2fc441[_0x9c02('0x38')]:_0x3a0336[_0x9c02('0x37')];_0x2fc441[_0x9c02('0x3a')]=qs['sort'](_0xbe9788[_0x9c02('0x33')]['sort']);_0x2fc441[_0x9c02('0x3c')]=qs[_0x9c02('0x35')](_[_0x9c02('0x3d')](_0xbe9788[_0x9c02('0x33')],_0x3a0336[_0x9c02('0x35')]));if(_0xbe9788[_0x9c02('0x33')][_0x9c02('0x3e')]){_0x2fc441[_0x9c02('0x3c')]=_['merge'](_0x2fc441[_0x9c02('0x3c')],{'$or':_[_0x9c02('0x2d')](_0x2fc441[_0x9c02('0x38')],function(_0x5a3d2a){var _0x4b7959={};_0x4b7959[_0x5a3d2a]={'$like':'%'+_0xbe9788[_0x9c02('0x33')][_0x9c02('0x3e')]+'%'};return _0x4b7959;})});}_0x2fc441=_[_0x9c02('0x4e')]({},_0x2fc441,_0xbe9788[_0x9c02('0x40')]);return _0x53e2af[_0x9c02('0x53')](_0x2fc441);}})[_0x9c02('0x28')](function(_0x3935ca){if(_0x3935ca){_0x1f970a=_0x3935ca[_0x9c02('0x49')];if(!_0xbe9788[_0x9c02('0x33')]['hasOwnProperty']('nolimit')){_0x2fc441[_0x9c02('0x21')]=qs[_0x9c02('0x21')](_0xbe9788[_0x9c02('0x33')][_0x9c02('0x21')]);_0x2fc441['offset']=qs[_0x9c02('0x1f')](_0xbe9788[_0x9c02('0x33')][_0x9c02('0x1f')]);}return _0x53e2af[_0x9c02('0x53')](_0x2fc441);}})[_0x9c02('0x28')](function(_0x19120e){if(_0x19120e){return _0x19120e?{'count':_0x1f970a,'rows':_0x19120e}:null;}})['then'](respondWithResult(_0xec271c,null))[_0x9c02('0x45')](handleError(_0xec271c,null));};exports[_0x9c02('0x54')]=function(_0x1e8116,_0x1ec4df,_0x2c7c8e){if(_0x1e8116[_0x9c02('0x55')]['id']){delete _0x1e8116[_0x9c02('0x55')]['id'];}return db['ZendeskConfiguration'][_0x9c02('0x4c')]({'where':{'id':_0x1e8116[_0x9c02('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ec4df,null))[_0x9c02('0x28')](function(_0x255cda){if(_0x255cda){return _0x255cda[_0x9c02('0x54')](_0x1e8116[_0x9c02('0x55')][_0x9c02('0x56')]||[]);}return null;})[_0x9c02('0x28')](respondWithResult(_0x1ec4df,null))['catch'](handleError(_0x1ec4df,null));}; \ No newline at end of file +var _0x6f5c=['ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','filters','pick','where','merge','filter','includeAll','include','ZendeskConfiguration','findAll','rows','catch','show','params','find','create','body','destroy','findOne','ZendeskField','order','options','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x2293d9,_0x1f264b){var _0x4a6243=function(_0x3b722d){while(--_0x3b722d){_0x2293d9['push'](_0x2293d9['shift']());}};_0x4a6243(++_0x1f264b);}(_0x6f5c,0x199));var _0xc6f5=function(_0x5b919f,_0x2401b1){_0x5b919f=_0x5b919f-0x0;var _0x16bfff=_0x6f5c[_0x5b919f];return _0x16bfff;};'use strict';var emlformat=require(_0xc6f5('0x0'));var rimraf=require(_0xc6f5('0x1'));var zipdir=require(_0xc6f5('0x2'));var jsonpatch=require(_0xc6f5('0x3'));var rp=require(_0xc6f5('0x4'));var moment=require(_0xc6f5('0x5'));var BPromise=require(_0xc6f5('0x6'));var Mustache=require('mustache');var util=require(_0xc6f5('0x7'));var path=require(_0xc6f5('0x8'));var sox=require(_0xc6f5('0x9'));var csv=require(_0xc6f5('0xa'));var ejs=require(_0xc6f5('0xb'));var fs=require('fs');var fs_extra=require(_0xc6f5('0xc'));var _=require(_0xc6f5('0xd'));var squel=require('squel');var crypto=require(_0xc6f5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6f5('0xf'));var Papa=require('papaparse');var Redis=require(_0xc6f5('0x10'));var authService=require(_0xc6f5('0x11'));var qs=require(_0xc6f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6f5('0x13'));var logger=require(_0xc6f5('0x14'))('api');var utils=require(_0xc6f5('0x15'));var config=require(_0xc6f5('0x16'));var licenseUtil=require(_0xc6f5('0x17'));var db=require(_0xc6f5('0x18'))['db'];function respondWithStatusCode(_0x319560,_0x52d109){_0x52d109=_0x52d109||0xcc;return function(_0x364b75){if(_0x364b75){return _0x319560[_0xc6f5('0x19')](_0x52d109);}return _0x319560[_0xc6f5('0x1a')](_0x52d109)[_0xc6f5('0x1b')]();};}function respondWithResult(_0xa8b0c7,_0x336a5a){_0x336a5a=_0x336a5a||0xc8;return function(_0x1146eb){if(_0x1146eb){return _0xa8b0c7[_0xc6f5('0x1a')](_0x336a5a)[_0xc6f5('0x1c')](_0x1146eb);}};}function respondWithFilteredResult(_0x5e32c3,_0x4b8278){return function(_0xc2486f){if(_0xc2486f){var _0x4905c5=typeof _0x4b8278[_0xc6f5('0x1d')]===_0xc6f5('0x1e')&&typeof _0x4b8278['limit']==='undefined';var _0x23ceb6=_0xc2486f[_0xc6f5('0x1f')];var _0x60e991=_0x4905c5?0x0:_0x4b8278[_0xc6f5('0x1d')];var _0x2d10cd=_0x4905c5?_0xc2486f[_0xc6f5('0x1f')]:_0x4b8278['offset']+_0x4b8278[_0xc6f5('0x20')];var _0x1bef38;if(_0x2d10cd>=_0x23ceb6){_0x2d10cd=_0x23ceb6;_0x1bef38=0xc8;}else{_0x1bef38=0xce;}_0x5e32c3[_0xc6f5('0x1a')](_0x1bef38);return _0x5e32c3['set']('Content-Range',_0x60e991+'-'+_0x2d10cd+'/'+_0x23ceb6)[_0xc6f5('0x1c')](_0xc2486f);}return null;};}function patchUpdates(_0xcb54ba){return function(_0x5d92e5){try{jsonpatch[_0xc6f5('0x21')](_0x5d92e5,_0xcb54ba,!![]);}catch(_0x512e7d){return BPromise['reject'](_0x512e7d);}return _0x5d92e5[_0xc6f5('0x22')]();};}function saveUpdates(_0x2c4074,_0x5d75c3){return function(_0x27cc17){if(_0x27cc17){return _0x27cc17[_0xc6f5('0x23')](_0x2c4074)[_0xc6f5('0x24')](function(_0x2a39f5){return _0x2a39f5;});}return null;};}function removeEntity(_0x51933e,_0x4357f9){return function(_0x43ef6d){if(_0x43ef6d){return _0x43ef6d['destroy']()['then'](function(){_0x51933e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x121476,_0x5d79f5){return function(_0x52c88c){if(!_0x52c88c){_0x121476['sendStatus'](0x194);}return _0x52c88c;};}function handleError(_0x395a21,_0x4dfd52){_0x4dfd52=_0x4dfd52||0x1f4;return function(_0x5833a4){logger[_0xc6f5('0x25')](_0x5833a4[_0xc6f5('0x26')]);if(_0x5833a4['name']){delete _0x5833a4[_0xc6f5('0x27')];}_0x395a21[_0xc6f5('0x1a')](_0x4dfd52)[_0xc6f5('0x28')](_0x5833a4);};}exports[_0xc6f5('0x29')]=function(_0x2d9b20,_0x565ada){var _0x2a7657={},_0x2bcaa8={},_0x1ced70={'count':0x0,'rows':[]};var _0x2c61fd=_[_0xc6f5('0x2a')](db['ZendeskConfiguration'][_0xc6f5('0x2b')],function(_0x12d4fe){return{'name':_0x12d4fe[_0xc6f5('0x2c')],'type':_0x12d4fe[_0xc6f5('0x2d')][_0xc6f5('0x2e')]};});_0x2bcaa8[_0xc6f5('0x2f')]=_['map'](_0x2c61fd,_0xc6f5('0x27'));_0x2bcaa8[_0xc6f5('0x30')]=_[_0xc6f5('0x31')](_0x2d9b20['query']);_0x2bcaa8['filters']=_['intersection'](_0x2bcaa8['model'],_0x2bcaa8[_0xc6f5('0x30')]);_0x2a7657[_0xc6f5('0x32')]=_[_0xc6f5('0x33')](_0x2bcaa8[_0xc6f5('0x2f')],qs[_0xc6f5('0x34')](_0x2d9b20[_0xc6f5('0x30')]['fields']));_0x2a7657[_0xc6f5('0x32')]=_0x2a7657[_0xc6f5('0x32')][_0xc6f5('0x35')]?_0x2a7657[_0xc6f5('0x32')]:_0x2bcaa8[_0xc6f5('0x2f')];if(!_0x2d9b20[_0xc6f5('0x30')]['hasOwnProperty'](_0xc6f5('0x36'))){_0x2a7657[_0xc6f5('0x20')]=qs[_0xc6f5('0x20')](_0x2d9b20[_0xc6f5('0x30')][_0xc6f5('0x20')]);_0x2a7657[_0xc6f5('0x1d')]=qs[_0xc6f5('0x1d')](_0x2d9b20[_0xc6f5('0x30')][_0xc6f5('0x1d')]);}_0x2a7657['order']=qs[_0xc6f5('0x37')](_0x2d9b20[_0xc6f5('0x30')][_0xc6f5('0x37')]);_0x2a7657['where']=qs[_0xc6f5('0x38')](_[_0xc6f5('0x39')](_0x2d9b20['query'],_0x2bcaa8[_0xc6f5('0x38')]),_0x2c61fd);if(_0x2d9b20[_0xc6f5('0x30')]['filter']){_0x2a7657[_0xc6f5('0x3a')]=_[_0xc6f5('0x3b')](_0x2a7657[_0xc6f5('0x3a')],{'$or':_[_0xc6f5('0x2a')](_0x2c61fd,function(_0x515c2a){if(_0x515c2a[_0xc6f5('0x2d')]!=='VIRTUAL'){var _0x2c2bfe={};_0x2c2bfe[_0x515c2a[_0xc6f5('0x27')]]={'$like':'%'+_0x2d9b20[_0xc6f5('0x30')][_0xc6f5('0x3c')]+'%'};return _0x2c2bfe;}})});}_0x2a7657=_[_0xc6f5('0x3b')]({},_0x2a7657,_0x2d9b20['options']);var _0x21b034={'where':_0x2a7657['where']};return db['ZendeskConfiguration']['count'](_0x21b034)[_0xc6f5('0x24')](function(_0xcfcc45){_0x1ced70[_0xc6f5('0x1f')]=_0xcfcc45;if(_0x2d9b20[_0xc6f5('0x30')][_0xc6f5('0x3d')]){_0x2a7657[_0xc6f5('0x3e')]=[{'all':!![]}];}return db[_0xc6f5('0x3f')][_0xc6f5('0x40')](_0x2a7657);})[_0xc6f5('0x24')](function(_0x5e312f){_0x1ced70[_0xc6f5('0x41')]=_0x5e312f;return _0x1ced70;})['then'](respondWithFilteredResult(_0x565ada,_0x2a7657))[_0xc6f5('0x42')](handleError(_0x565ada,null));};exports[_0xc6f5('0x43')]=function(_0x29b0c0,_0x1a02b2){var _0x41d801={'raw':![],'where':{'id':_0x29b0c0[_0xc6f5('0x44')]['id']}},_0x48dfea={};_0x48dfea[_0xc6f5('0x2f')]=_[_0xc6f5('0x31')](db[_0xc6f5('0x3f')][_0xc6f5('0x2b')]);_0x48dfea[_0xc6f5('0x30')]=_[_0xc6f5('0x31')](_0x29b0c0[_0xc6f5('0x30')]);_0x48dfea['filters']=_['intersection'](_0x48dfea['model'],_0x48dfea['query']);_0x41d801[_0xc6f5('0x32')]=_[_0xc6f5('0x33')](_0x48dfea[_0xc6f5('0x2f')],qs[_0xc6f5('0x34')](_0x29b0c0[_0xc6f5('0x30')]['fields']));_0x41d801['attributes']=_0x41d801[_0xc6f5('0x32')][_0xc6f5('0x35')]?_0x41d801[_0xc6f5('0x32')]:_0x48dfea[_0xc6f5('0x2f')];if(_0x29b0c0['query']['includeAll']){_0x41d801['include']=[{'all':!![]}];}_0x41d801=_['merge']({},_0x41d801,_0x29b0c0['options']);return db[_0xc6f5('0x3f')][_0xc6f5('0x45')](_0x41d801)[_0xc6f5('0x24')](handleEntityNotFound(_0x1a02b2,null))[_0xc6f5('0x24')](respondWithResult(_0x1a02b2,null))[_0xc6f5('0x42')](handleError(_0x1a02b2,null));};exports[_0xc6f5('0x46')]=function(_0x4e1a94,_0x3b77aa){return db['ZendeskConfiguration']['create'](_0x4e1a94[_0xc6f5('0x47')],{})[_0xc6f5('0x24')](respondWithResult(_0x3b77aa,0xc9))[_0xc6f5('0x42')](handleError(_0x3b77aa,null));};exports[_0xc6f5('0x23')]=function(_0x2695bd,_0x17a1c5){if(_0x2695bd[_0xc6f5('0x47')]['id']){delete _0x2695bd['body']['id'];}return db[_0xc6f5('0x3f')][_0xc6f5('0x45')]({'where':{'id':_0x2695bd['params']['id']}})[_0xc6f5('0x24')](handleEntityNotFound(_0x17a1c5,null))[_0xc6f5('0x24')](saveUpdates(_0x2695bd[_0xc6f5('0x47')],null))[_0xc6f5('0x24')](respondWithResult(_0x17a1c5,null))[_0xc6f5('0x42')](handleError(_0x17a1c5,null));};exports[_0xc6f5('0x48')]=function(_0x1a28f7,_0x40ffe4){return db[_0xc6f5('0x3f')][_0xc6f5('0x45')]({'where':{'id':_0x1a28f7[_0xc6f5('0x44')]['id']}})[_0xc6f5('0x24')](handleEntityNotFound(_0x40ffe4,null))[_0xc6f5('0x24')](removeEntity(_0x40ffe4,null))[_0xc6f5('0x42')](handleError(_0x40ffe4,null));};exports['getFields']=function(_0x20758d,_0x1b91cc,_0x22dd6a){var _0x3b0a35={};var _0x410660={};var _0x3ab412;var _0x48d058;return db[_0xc6f5('0x3f')][_0xc6f5('0x49')]({'where':{'id':_0x20758d[_0xc6f5('0x44')]['id']}})[_0xc6f5('0x24')](handleEntityNotFound(_0x1b91cc,null))[_0xc6f5('0x24')](function(_0x137f7e){if(_0x137f7e){_0x3ab412=_0x137f7e;_0x410660['model']=_[_0xc6f5('0x31')](db[_0xc6f5('0x4a')][_0xc6f5('0x2b')]);_0x410660[_0xc6f5('0x30')]=_[_0xc6f5('0x31')](_0x20758d[_0xc6f5('0x30')]);_0x410660[_0xc6f5('0x38')]=_['intersection'](_0x410660[_0xc6f5('0x2f')],_0x410660[_0xc6f5('0x30')]);_0x3b0a35['attributes']=_['intersection'](_0x410660[_0xc6f5('0x2f')],qs[_0xc6f5('0x34')](_0x20758d[_0xc6f5('0x30')][_0xc6f5('0x34')]));_0x3b0a35[_0xc6f5('0x32')]=_0x3b0a35[_0xc6f5('0x32')][_0xc6f5('0x35')]?_0x3b0a35[_0xc6f5('0x32')]:_0x410660[_0xc6f5('0x2f')];_0x3b0a35[_0xc6f5('0x4b')]=qs['sort'](_0x20758d[_0xc6f5('0x30')][_0xc6f5('0x37')]);_0x3b0a35[_0xc6f5('0x3a')]=qs[_0xc6f5('0x38')](_['pick'](_0x20758d[_0xc6f5('0x30')],_0x410660[_0xc6f5('0x38')]));if(_0x20758d[_0xc6f5('0x30')]['filter']){_0x3b0a35[_0xc6f5('0x3a')]=_[_0xc6f5('0x3b')](_0x3b0a35[_0xc6f5('0x3a')],{'$or':_[_0xc6f5('0x2a')](_0x3b0a35[_0xc6f5('0x32')],function(_0x5e8144){var _0x309bfb={};_0x309bfb[_0x5e8144]={'$like':'%'+_0x20758d[_0xc6f5('0x30')][_0xc6f5('0x3c')]+'%'};return _0x309bfb;})});}_0x3b0a35=_['merge']({},_0x3b0a35,_0x20758d[_0xc6f5('0x4c')]);return _0x3ab412[_0xc6f5('0x4d')](_0x3b0a35);}})[_0xc6f5('0x24')](function(_0x5c03d8){if(_0x5c03d8){_0x48d058=_0x5c03d8['length'];if(!_0x20758d[_0xc6f5('0x30')][_0xc6f5('0x4e')](_0xc6f5('0x36'))){_0x3b0a35[_0xc6f5('0x20')]=qs['limit'](_0x20758d['query'][_0xc6f5('0x20')]);_0x3b0a35[_0xc6f5('0x1d')]=qs[_0xc6f5('0x1d')](_0x20758d[_0xc6f5('0x30')][_0xc6f5('0x1d')]);}return _0x3ab412[_0xc6f5('0x4d')](_0x3b0a35);}})['then'](function(_0xcf9671){if(_0xcf9671){return _0xcf9671?{'count':_0x48d058,'rows':_0xcf9671}:null;}})[_0xc6f5('0x24')](respondWithResult(_0x1b91cc,null))[_0xc6f5('0x42')](handleError(_0x1b91cc,null));};exports[_0xc6f5('0x4f')]=function(_0x2192f8,_0x75acf2,_0x2379c9){var _0x1dc43f={};var _0x42670e={};var _0x5ed39e;var _0x2bc97a;return db[_0xc6f5('0x3f')][_0xc6f5('0x49')]({'where':{'id':_0x2192f8['params']['id']}})[_0xc6f5('0x24')](handleEntityNotFound(_0x75acf2,null))[_0xc6f5('0x24')](function(_0x5eed94){if(_0x5eed94){_0x5ed39e=_0x5eed94;_0x42670e['model']=_[_0xc6f5('0x31')](db[_0xc6f5('0x4a')][_0xc6f5('0x2b')]);_0x42670e[_0xc6f5('0x30')]=_[_0xc6f5('0x31')](_0x2192f8[_0xc6f5('0x30')]);_0x42670e[_0xc6f5('0x38')]=_[_0xc6f5('0x33')](_0x42670e[_0xc6f5('0x2f')],_0x42670e[_0xc6f5('0x30')]);_0x1dc43f[_0xc6f5('0x32')]=_['intersection'](_0x42670e[_0xc6f5('0x2f')],qs['fields'](_0x2192f8[_0xc6f5('0x30')]['fields']));_0x1dc43f['attributes']=_0x1dc43f[_0xc6f5('0x32')][_0xc6f5('0x35')]?_0x1dc43f['attributes']:_0x42670e[_0xc6f5('0x2f')];_0x1dc43f[_0xc6f5('0x4b')]=qs[_0xc6f5('0x37')](_0x2192f8['query'][_0xc6f5('0x37')]);_0x1dc43f[_0xc6f5('0x3a')]=qs['filters'](_[_0xc6f5('0x39')](_0x2192f8[_0xc6f5('0x30')],_0x42670e[_0xc6f5('0x38')]));if(_0x2192f8[_0xc6f5('0x30')][_0xc6f5('0x3c')]){_0x1dc43f[_0xc6f5('0x3a')]=_['merge'](_0x1dc43f[_0xc6f5('0x3a')],{'$or':_[_0xc6f5('0x2a')](_0x1dc43f[_0xc6f5('0x32')],function(_0x25cd37){var _0x4ea53e={};_0x4ea53e[_0x25cd37]={'$like':'%'+_0x2192f8[_0xc6f5('0x30')]['filter']+'%'};return _0x4ea53e;})});}_0x1dc43f=_[_0xc6f5('0x3b')]({},_0x1dc43f,_0x2192f8[_0xc6f5('0x4c')]);return _0x5ed39e[_0xc6f5('0x4f')](_0x1dc43f);}})['then'](function(_0x562555){if(_0x562555){_0x2bc97a=_0x562555[_0xc6f5('0x35')];if(!_0x2192f8['query'][_0xc6f5('0x4e')]('nolimit')){_0x1dc43f[_0xc6f5('0x20')]=qs['limit'](_0x2192f8[_0xc6f5('0x30')][_0xc6f5('0x20')]);_0x1dc43f[_0xc6f5('0x1d')]=qs[_0xc6f5('0x1d')](_0x2192f8[_0xc6f5('0x30')][_0xc6f5('0x1d')]);}return _0x5ed39e[_0xc6f5('0x4f')](_0x1dc43f);}})[_0xc6f5('0x24')](function(_0x384212){if(_0x384212){return _0x384212?{'count':_0x2bc97a,'rows':_0x384212}:null;}})[_0xc6f5('0x24')](respondWithResult(_0x75acf2,null))[_0xc6f5('0x42')](handleError(_0x75acf2,null));};exports[_0xc6f5('0x50')]=function(_0x27b0d1,_0x2afa2e,_0x1098c1){var _0x56d99f={};var _0x4bd119={};var _0x2a7f64;var _0x1a09b4;return db[_0xc6f5('0x3f')][_0xc6f5('0x49')]({'where':{'id':_0x27b0d1[_0xc6f5('0x44')]['id']}})[_0xc6f5('0x24')](handleEntityNotFound(_0x2afa2e,null))[_0xc6f5('0x24')](function(_0x297721){if(_0x297721){_0x2a7f64=_0x297721;_0x4bd119['model']=_['keys'](db[_0xc6f5('0x4a')][_0xc6f5('0x2b')]);_0x4bd119['query']=_[_0xc6f5('0x31')](_0x27b0d1[_0xc6f5('0x30')]);_0x4bd119['filters']=_['intersection'](_0x4bd119[_0xc6f5('0x2f')],_0x4bd119[_0xc6f5('0x30')]);_0x56d99f[_0xc6f5('0x32')]=_['intersection'](_0x4bd119[_0xc6f5('0x2f')],qs[_0xc6f5('0x34')](_0x27b0d1[_0xc6f5('0x30')][_0xc6f5('0x34')]));_0x56d99f['attributes']=_0x56d99f[_0xc6f5('0x32')][_0xc6f5('0x35')]?_0x56d99f[_0xc6f5('0x32')]:_0x4bd119['model'];_0x56d99f['order']=qs['sort'](_0x27b0d1[_0xc6f5('0x30')][_0xc6f5('0x37')]);_0x56d99f[_0xc6f5('0x3a')]=qs['filters'](_['pick'](_0x27b0d1[_0xc6f5('0x30')],_0x4bd119[_0xc6f5('0x38')]));if(_0x27b0d1[_0xc6f5('0x30')][_0xc6f5('0x3c')]){_0x56d99f['where']=_[_0xc6f5('0x3b')](_0x56d99f[_0xc6f5('0x3a')],{'$or':_[_0xc6f5('0x2a')](_0x56d99f['attributes'],function(_0x2e7de5){var _0x42cb23={};_0x42cb23[_0x2e7de5]={'$like':'%'+_0x27b0d1[_0xc6f5('0x30')]['filter']+'%'};return _0x42cb23;})});}_0x56d99f=_[_0xc6f5('0x3b')]({},_0x56d99f,_0x27b0d1[_0xc6f5('0x4c')]);return _0x2a7f64[_0xc6f5('0x50')](_0x56d99f);}})['then'](function(_0xf5d614){if(_0xf5d614){_0x1a09b4=_0xf5d614[_0xc6f5('0x35')];if(!_0x27b0d1[_0xc6f5('0x30')][_0xc6f5('0x4e')](_0xc6f5('0x36'))){_0x56d99f[_0xc6f5('0x20')]=qs[_0xc6f5('0x20')](_0x27b0d1[_0xc6f5('0x30')][_0xc6f5('0x20')]);_0x56d99f[_0xc6f5('0x1d')]=qs[_0xc6f5('0x1d')](_0x27b0d1[_0xc6f5('0x30')][_0xc6f5('0x1d')]);}return _0x2a7f64['getDescriptions'](_0x56d99f);}})[_0xc6f5('0x24')](function(_0x50bc1f){if(_0x50bc1f){return _0x50bc1f?{'count':_0x1a09b4,'rows':_0x50bc1f}:null;}})[_0xc6f5('0x24')](respondWithResult(_0x2afa2e,null))[_0xc6f5('0x42')](handleError(_0x2afa2e,null));};exports[_0xc6f5('0x51')]=function(_0x24ac65,_0x31cfb9,_0xf6764e){var _0x4698ff={};var _0x2478bd={};var _0x4b9bdf;var _0x6eb72b;return db['ZendeskConfiguration'][_0xc6f5('0x49')]({'where':{'id':_0x24ac65[_0xc6f5('0x44')]['id']}})[_0xc6f5('0x24')](handleEntityNotFound(_0x31cfb9,null))['then'](function(_0x284747){if(_0x284747){_0x4b9bdf=_0x284747;_0x2478bd[_0xc6f5('0x2f')]=_[_0xc6f5('0x31')](db[_0xc6f5('0x52')][_0xc6f5('0x2b')]);_0x2478bd['query']=_['keys'](_0x24ac65['query']);_0x2478bd['filters']=_[_0xc6f5('0x33')](_0x2478bd[_0xc6f5('0x2f')],_0x2478bd[_0xc6f5('0x30')]);_0x4698ff[_0xc6f5('0x32')]=_[_0xc6f5('0x33')](_0x2478bd[_0xc6f5('0x2f')],qs[_0xc6f5('0x34')](_0x24ac65[_0xc6f5('0x30')][_0xc6f5('0x34')]));_0x4698ff['attributes']=_0x4698ff[_0xc6f5('0x32')]['length']?_0x4698ff[_0xc6f5('0x32')]:_0x2478bd['model'];_0x4698ff[_0xc6f5('0x4b')]=qs[_0xc6f5('0x37')](_0x24ac65[_0xc6f5('0x30')]['sort']);_0x4698ff[_0xc6f5('0x3a')]=qs[_0xc6f5('0x38')](_['pick'](_0x24ac65[_0xc6f5('0x30')],_0x2478bd[_0xc6f5('0x38')]));if(_0x24ac65[_0xc6f5('0x30')]['filter']){_0x4698ff['where']=_[_0xc6f5('0x3b')](_0x4698ff['where'],{'$or':_[_0xc6f5('0x2a')](_0x4698ff[_0xc6f5('0x32')],function(_0x12724f){var _0x5e6cc1={};_0x5e6cc1[_0x12724f]={'$like':'%'+_0x24ac65['query']['filter']+'%'};return _0x5e6cc1;})});}_0x4698ff=_[_0xc6f5('0x3b')]({},_0x4698ff,_0x24ac65['options']);return _0x4b9bdf[_0xc6f5('0x51')](_0x4698ff);}})[_0xc6f5('0x24')](function(_0x46a65f){if(_0x46a65f){_0x6eb72b=_0x46a65f[_0xc6f5('0x35')];if(!_0x24ac65[_0xc6f5('0x30')][_0xc6f5('0x4e')]('nolimit')){_0x4698ff[_0xc6f5('0x20')]=qs[_0xc6f5('0x20')](_0x24ac65['query'][_0xc6f5('0x20')]);_0x4698ff[_0xc6f5('0x1d')]=qs[_0xc6f5('0x1d')](_0x24ac65[_0xc6f5('0x30')][_0xc6f5('0x1d')]);}return _0x4b9bdf[_0xc6f5('0x51')](_0x4698ff);}})[_0xc6f5('0x24')](function(_0x3a45a2){if(_0x3a45a2){return _0x3a45a2?{'count':_0x6eb72b,'rows':_0x3a45a2}:null;}})[_0xc6f5('0x24')](respondWithResult(_0x31cfb9,null))[_0xc6f5('0x42')](handleError(_0x31cfb9,null));};exports[_0xc6f5('0x53')]=function(_0x48fb9b,_0x5d320d,_0x3b0c34){if(_0x48fb9b[_0xc6f5('0x47')]['id']){delete _0x48fb9b['body']['id'];}return db[_0xc6f5('0x3f')][_0xc6f5('0x49')]({'where':{'id':_0x48fb9b[_0xc6f5('0x44')]['id']}})[_0xc6f5('0x24')](handleEntityNotFound(_0x5d320d,null))['then'](function(_0x29b883){if(_0x29b883){return _0x29b883[_0xc6f5('0x53')](_0x48fb9b[_0xc6f5('0x47')]['ids']||[]);}return null;})[_0xc6f5('0x24')](respondWithResult(_0x5d320d,null))[_0xc6f5('0x42')](handleError(_0x5d320d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ca6746b..9f2514c 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 _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x4fc2,0x111));var _0x24fc=function(_0x32bcda,_0x156e9c){_0x32bcda=_0x32bcda-0x0;var _0x4e6191=_0x4fc2[_0x32bcda];return _0x4e6191;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x1150b2,_0x18c83d){var _0xab2573=function(_0xfceac7){while(--_0xfceac7){_0x1150b2['push'](_0x1150b2['shift']());}};_0xab2573(++_0x18c83d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x45d80c,_0x35c0ff){_0x45d80c=_0x45d80c-0x0;var _0x449a98=_0x0b0e[_0x45d80c];return _0x449a98;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 75f6e6a..8064dd7 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 _0x46ce=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird'];(function(_0x463b90,_0x234189){var _0x5ee41d=function(_0x46c226){while(--_0x46c226){_0x463b90['push'](_0x463b90['shift']());}};_0x5ee41d(++_0x234189);}(_0x46ce,0x141));var _0xe46c=function(_0x261545,_0x5d317b){_0x261545=_0x261545-0x0;var _0x539d75=_0x46ce[_0x261545];return _0x539d75;};'use strict';var _=require(_0xe46c('0x0'));var util=require(_0xe46c('0x1'));var moment=require(_0xe46c('0x2'));var BPromise=require(_0xe46c('0x3'));var rs=require(_0xe46c('0x4'));var fs=require('fs');var Redis=require(_0xe46c('0x5'));var db=require(_0xe46c('0x6'))['db'];var utils=require(_0xe46c('0x7'));var logger=require(_0xe46c('0x8'))(_0xe46c('0x9'));var config=require(_0xe46c('0xa'));var jayson=require(_0xe46c('0xb'));var client=jayson[_0xe46c('0xc')][_0xe46c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5701bd,_0x5c8f2a,_0x13273f){return new BPromise(function(_0x34fbde,_0x186a8d){return client[_0xe46c('0xe')](_0x5701bd,_0x13273f)[_0xe46c('0xf')](function(_0x5deec8){logger['info'](_0xe46c('0x10'),_0x5c8f2a,_0xe46c('0x11'));logger[_0xe46c('0x12')](_0xe46c('0x13'),_0x5c8f2a,_0xe46c('0x11'),JSON[_0xe46c('0x14')](_0x5deec8));if(_0x5deec8[_0xe46c('0x15')]){if(_0x5deec8['error'][_0xe46c('0x16')]===0x1f4){logger[_0xe46c('0x15')](_0xe46c('0x10'),_0x5c8f2a,_0x5deec8[_0xe46c('0x15')][_0xe46c('0x17')]);return _0x186a8d(_0x5deec8[_0xe46c('0x15')][_0xe46c('0x17')]);}logger[_0xe46c('0x15')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5c8f2a,_0x5deec8[_0xe46c('0x15')]['message']);return _0x34fbde(_0x5deec8[_0xe46c('0x15')]['message']);}else{logger[_0xe46c('0x18')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5c8f2a,_0xe46c('0x11'));_0x34fbde(_0x5deec8['result'][_0xe46c('0x17')]);}})['catch'](function(_0x3c3cfe){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5c8f2a,_0x3c3cfe);_0x186a8d(_0x3c3cfe);});});} \ No newline at end of file +var _0xc244=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x12d1b8,_0x2f94c2){var _0x1ce3fc=function(_0x4be68b){while(--_0x4be68b){_0x12d1b8['push'](_0x12d1b8['shift']());}};_0x1ce3fc(++_0x2f94c2);}(_0xc244,0xe2));var _0x4c24=function(_0x49dd0b,_0x2f6477){_0x49dd0b=_0x49dd0b-0x0;var _0x59d9a4=_0xc244[_0x49dd0b];return _0x59d9a4;};'use strict';var _=require(_0x4c24('0x0'));var util=require('util');var moment=require(_0x4c24('0x1'));var BPromise=require(_0x4c24('0x2'));var rs=require(_0x4c24('0x3'));var fs=require('fs');var Redis=require(_0x4c24('0x4'));var db=require(_0x4c24('0x5'))['db'];var utils=require(_0x4c24('0x6'));var logger=require(_0x4c24('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4c24('0x8'));var client=jayson['client'][_0x4c24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a136,_0x52ebb3,_0x24d970){return new BPromise(function(_0x91353d,_0x2daeab){return client[_0x4c24('0xa')](_0x46a136,_0x24d970)[_0x4c24('0xb')](function(_0x28d9cb){logger[_0x4c24('0xc')](_0x4c24('0xd'),_0x52ebb3,_0x4c24('0xe'));logger[_0x4c24('0xf')](_0x4c24('0x10'),_0x52ebb3,'request\x20sent',JSON[_0x4c24('0x11')](_0x28d9cb));if(_0x28d9cb[_0x4c24('0x12')]){if(_0x28d9cb[_0x4c24('0x12')]['code']===0x1f4){logger[_0x4c24('0x12')](_0x4c24('0xd'),_0x52ebb3,_0x28d9cb[_0x4c24('0x12')][_0x4c24('0x13')]);return _0x2daeab(_0x28d9cb[_0x4c24('0x12')][_0x4c24('0x13')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x52ebb3,_0x28d9cb[_0x4c24('0x12')][_0x4c24('0x13')]);return _0x91353d(_0x28d9cb[_0x4c24('0x12')][_0x4c24('0x13')]);}else{logger[_0x4c24('0xc')](_0x4c24('0xd'),_0x52ebb3,_0x4c24('0xe'));_0x91353d(_0x28d9cb['result'][_0x4c24('0x13')]);}})[_0x4c24('0x14')](function(_0x2145aa){logger[_0x4c24('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x52ebb3,_0x2145aa);_0x2daeab(_0x2145aa);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8b4726d..9c32753 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 _0x16ea=['index','get','show','create','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../config/environment','./intZendeskField.controller','isAuthenticated'];(function(_0x32c0db,_0x438fcd){var _0x323588=function(_0x546533){while(--_0x546533){_0x32c0db['push'](_0x32c0db['shift']());}};_0x323588(++_0x438fcd);}(_0x16ea,0x12b));var _0xa16e=function(_0x553252,_0x53e3b9){_0x553252=_0x553252-0x0;var _0x4fab76=_0x16ea[_0x553252];return _0x4fab76;};'use strict';var multer=require(_0xa16e('0x0'));var util=require('util');var path=require(_0xa16e('0x1'));var timeout=require('connect-timeout');var express=require(_0xa16e('0x2'));var router=express['Router']();var fs_extra=require(_0xa16e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa16e('0x4'));var controller=require(_0xa16e('0x5'));router['get']('/',auth[_0xa16e('0x6')](),controller[_0xa16e('0x7')]);router[_0xa16e('0x8')]('/:id',auth[_0xa16e('0x6')](),controller[_0xa16e('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa16e('0xa')]);router[_0xa16e('0xb')](_0xa16e('0xc'),auth[_0xa16e('0x6')](),controller[_0xa16e('0xd')]);router[_0xa16e('0xe')](_0xa16e('0xc'),auth['isAuthenticated'](),controller[_0xa16e('0xf')]);module[_0xa16e('0x10')]=router; \ No newline at end of file +var _0x3bad=['index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0xf95bde,_0xc64908){var _0x2f29f5=function(_0x47a25c){while(--_0x47a25c){_0xf95bde['push'](_0xf95bde['shift']());}};_0x2f29f5(++_0xc64908);}(_0x3bad,0x186));var _0xd3ba=function(_0x3c3732,_0x4e2d24){_0x3c3732=_0x3c3732-0x0;var _0x15fa2d=_0x3bad[_0x3c3732];return _0x15fa2d;};'use strict';var multer=require(_0xd3ba('0x0'));var util=require(_0xd3ba('0x1'));var path=require(_0xd3ba('0x2'));var timeout=require(_0xd3ba('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd3ba('0x4'));var auth=require(_0xd3ba('0x5'));var interaction=require(_0xd3ba('0x6'));var config=require(_0xd3ba('0x7'));var controller=require(_0xd3ba('0x8'));router[_0xd3ba('0x9')]('/',auth['isAuthenticated'](),controller[_0xd3ba('0xa')]);router['get'](_0xd3ba('0xb'),auth['isAuthenticated'](),controller[_0xd3ba('0xc')]);router['post']('/',auth[_0xd3ba('0xd')](),controller[_0xd3ba('0xe')]);router[_0xd3ba('0xf')]('/:id',auth[_0xd3ba('0xd')](),controller[_0xd3ba('0x10')]);router[_0xd3ba('0x11')](_0xd3ba('0xb'),auth[_0xd3ba('0xd')](),controller[_0xd3ba('0x12')]);module[_0xd3ba('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 8b1073b..27cb689 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 _0x113c=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x113c,0xc3));var _0xc113=function(_0x32bd27,_0x2368b2){_0x32bd27=_0x32bd27-0x0;var _0x12c88a=_0x113c[_0x32bd27];return _0x12c88a;};'use strict';var Sequelize=require(_0xc113('0x0'));module[_0xc113('0x1')]={'type':{'type':Sequelize[_0xc113('0x2')](_0xc113('0x3'),_0xc113('0x4'),_0xc113('0x5'),'keyValue',_0xc113('0x6')),'defaultValue':_0xc113('0x3')},'content':{'type':Sequelize[_0xc113('0x7')]},'key':{'type':Sequelize[_0xc113('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc113('0x3'),'variable',_0xc113('0x5'))},'keyContent':{'type':Sequelize[_0xc113('0x7')]},'idField':{'type':Sequelize[_0xc113('0x7')]},'nameField':{'type':Sequelize[_0xc113('0x7')]},'customField':{'type':Sequelize[_0xc113('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc113('0x7')]}}; \ No newline at end of file +var _0x7303=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','customVariable'];(function(_0x416f87,_0x42b830){var _0x2bb8d7=function(_0x1aa5a8){while(--_0x1aa5a8){_0x416f87['push'](_0x416f87['shift']());}};_0x2bb8d7(++_0x42b830);}(_0x7303,0xbf));var _0x3730=function(_0x5928ed,_0x2e8c47){_0x5928ed=_0x5928ed-0x0;var _0x1f34e3=_0x7303[_0x5928ed];return _0x1f34e3;};'use strict';var Sequelize=require(_0x3730('0x0'));module[_0x3730('0x1')]={'type':{'type':Sequelize[_0x3730('0x2')](_0x3730('0x3'),'variable','customVariable',_0x3730('0x4'),_0x3730('0x5')),'defaultValue':_0x3730('0x3')},'content':{'type':Sequelize[_0x3730('0x6')]},'key':{'type':Sequelize[_0x3730('0x6')]},'keyType':{'type':Sequelize[_0x3730('0x2')](_0x3730('0x3'),_0x3730('0x7'),_0x3730('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3730('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3730('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3730('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d9e0447..d65a6aa 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 _0xc0f2=['apply','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc0f2,0x75));var _0x2c0f=function(_0x403adf,_0x4e9e35){_0x403adf=_0x403adf-0x0;var _0x54b1be=_0xc0f2[_0x403adf];return _0x54b1be;};'use strict';var emlformat=require(_0x2c0f('0x0'));var rimraf=require(_0x2c0f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c0f('0x2'));var rp=require('request-promise');var moment=require(_0x2c0f('0x3'));var BPromise=require(_0x2c0f('0x4'));var Mustache=require(_0x2c0f('0x5'));var util=require(_0x2c0f('0x6'));var path=require('path');var sox=require(_0x2c0f('0x7'));var csv=require(_0x2c0f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c0f('0x9'));var _=require(_0x2c0f('0xa'));var squel=require('squel');var crypto=require(_0x2c0f('0xb'));var jsforce=require(_0x2c0f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2c0f('0x8'));var querystring=require(_0x2c0f('0xd'));var Papa=require(_0x2c0f('0xe'));var Redis=require(_0x2c0f('0xf'));var authService=require(_0x2c0f('0x10'));var qs=require(_0x2c0f('0x11'));var as=require(_0x2c0f('0x12'));var hardwareService=require(_0x2c0f('0x13'));var logger=require(_0x2c0f('0x14'))(_0x2c0f('0x15'));var utils=require('../../config/utils');var config=require(_0x2c0f('0x16'));var licenseUtil=require(_0x2c0f('0x17'));var db=require(_0x2c0f('0x18'))['db'];function respondWithStatusCode(_0x4876f6,_0x1aa0c1){_0x1aa0c1=_0x1aa0c1||0xcc;return function(_0x17c760){if(_0x17c760){return _0x4876f6[_0x2c0f('0x19')](_0x1aa0c1);}return _0x4876f6[_0x2c0f('0x1a')](_0x1aa0c1)['end']();};}function respondWithResult(_0x452bfc,_0x55ff03){_0x55ff03=_0x55ff03||0xc8;return function(_0x2648cd){if(_0x2648cd){return _0x452bfc['status'](_0x55ff03)[_0x2c0f('0x1b')](_0x2648cd);}};}function respondWithFilteredResult(_0x58f339,_0x103adc){return function(_0x16c7e6){if(_0x16c7e6){var _0x1bbd6f=typeof _0x103adc[_0x2c0f('0x1c')]===_0x2c0f('0x1d')&&typeof _0x103adc['limit']===_0x2c0f('0x1d');var _0x1883c8=_0x16c7e6[_0x2c0f('0x1e')];var _0x585968=_0x1bbd6f?0x0:_0x103adc[_0x2c0f('0x1c')];var _0x41be89=_0x1bbd6f?_0x16c7e6[_0x2c0f('0x1e')]:_0x103adc[_0x2c0f('0x1c')]+_0x103adc['limit'];var _0x4ca62e;if(_0x41be89>=_0x1883c8){_0x41be89=_0x1883c8;_0x4ca62e=0xc8;}else{_0x4ca62e=0xce;}_0x58f339[_0x2c0f('0x1a')](_0x4ca62e);return _0x58f339[_0x2c0f('0x1f')](_0x2c0f('0x20'),_0x585968+'-'+_0x41be89+'/'+_0x1883c8)['json'](_0x16c7e6);}return null;};}function patchUpdates(_0x4f0a42){return function(_0x8ae0e0){try{jsonpatch[_0x2c0f('0x21')](_0x8ae0e0,_0x4f0a42,!![]);}catch(_0x5308cc){return BPromise['reject'](_0x5308cc);}return _0x8ae0e0['save']();};}function saveUpdates(_0x47a6f9,_0x36a680){return function(_0xea7d09){if(_0xea7d09){return _0xea7d09[_0x2c0f('0x22')](_0x47a6f9)[_0x2c0f('0x23')](function(_0x133b9c){return _0x133b9c;});}return null;};}function removeEntity(_0x293adf,_0x46b77f){return function(_0x5b2707){if(_0x5b2707){return _0x5b2707[_0x2c0f('0x24')]()['then'](function(){_0x293adf[_0x2c0f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3078a2,_0x34dda8){return function(_0x10bd6a){if(!_0x10bd6a){_0x3078a2[_0x2c0f('0x19')](0x194);}return _0x10bd6a;};}function handleError(_0x35c36d,_0x46d7e9){_0x46d7e9=_0x46d7e9||0x1f4;return function(_0x1a24af){logger['error'](_0x1a24af[_0x2c0f('0x25')]);if(_0x1a24af['name']){delete _0x1a24af[_0x2c0f('0x26')];}_0x35c36d[_0x2c0f('0x1a')](_0x46d7e9)['send'](_0x1a24af);};}exports[_0x2c0f('0x27')]=function(_0x446bbf,_0x1daec4){var _0x4cb0ec={},_0x1b788d={},_0x1d6831={'count':0x0,'rows':[]};var _0x5f2673=_[_0x2c0f('0x28')](db['ZendeskField'][_0x2c0f('0x29')],function(_0xf238b){return{'name':_0xf238b[_0x2c0f('0x2a')],'type':_0xf238b[_0x2c0f('0x2b')][_0x2c0f('0x2c')]};});_0x1b788d[_0x2c0f('0x2d')]=_['map'](_0x5f2673,_0x2c0f('0x26'));_0x1b788d['query']=_[_0x2c0f('0x2e')](_0x446bbf[_0x2c0f('0x2f')]);_0x1b788d[_0x2c0f('0x30')]=_[_0x2c0f('0x31')](_0x1b788d[_0x2c0f('0x2d')],_0x1b788d['query']);_0x4cb0ec[_0x2c0f('0x32')]=_[_0x2c0f('0x31')](_0x1b788d[_0x2c0f('0x2d')],qs[_0x2c0f('0x33')](_0x446bbf['query'][_0x2c0f('0x33')]));_0x4cb0ec['attributes']=_0x4cb0ec[_0x2c0f('0x32')][_0x2c0f('0x34')]?_0x4cb0ec[_0x2c0f('0x32')]:_0x1b788d[_0x2c0f('0x2d')];if(!_0x446bbf['query'][_0x2c0f('0x35')](_0x2c0f('0x36'))){_0x4cb0ec[_0x2c0f('0x37')]=qs['limit'](_0x446bbf[_0x2c0f('0x2f')][_0x2c0f('0x37')]);_0x4cb0ec[_0x2c0f('0x1c')]=qs[_0x2c0f('0x1c')](_0x446bbf['query'][_0x2c0f('0x1c')]);}_0x4cb0ec[_0x2c0f('0x38')]=qs[_0x2c0f('0x39')](_0x446bbf[_0x2c0f('0x2f')]['sort']);_0x4cb0ec['where']=qs[_0x2c0f('0x30')](_[_0x2c0f('0x3a')](_0x446bbf[_0x2c0f('0x2f')],_0x1b788d[_0x2c0f('0x30')]),_0x5f2673);if(_0x446bbf['query'][_0x2c0f('0x3b')]){_0x4cb0ec[_0x2c0f('0x3c')]=_[_0x2c0f('0x3d')](_0x4cb0ec['where'],{'$or':_[_0x2c0f('0x28')](_0x5f2673,function(_0x4f826e){if(_0x4f826e[_0x2c0f('0x2b')]!==_0x2c0f('0x3e')){var _0x20d230={};_0x20d230[_0x4f826e['name']]={'$like':'%'+_0x446bbf[_0x2c0f('0x2f')][_0x2c0f('0x3b')]+'%'};return _0x20d230;}})});}_0x4cb0ec=_['merge']({},_0x4cb0ec,_0x446bbf[_0x2c0f('0x3f')]);var _0x40e3e3={'where':_0x4cb0ec['where']};return db[_0x2c0f('0x40')][_0x2c0f('0x1e')](_0x40e3e3)[_0x2c0f('0x23')](function(_0x2c0fff){_0x1d6831[_0x2c0f('0x1e')]=_0x2c0fff;if(_0x446bbf[_0x2c0f('0x2f')][_0x2c0f('0x41')]){_0x4cb0ec[_0x2c0f('0x42')]=[{'all':!![]}];}return db[_0x2c0f('0x40')][_0x2c0f('0x43')](_0x4cb0ec);})[_0x2c0f('0x23')](function(_0x5645a3){_0x1d6831[_0x2c0f('0x44')]=_0x5645a3;return _0x1d6831;})[_0x2c0f('0x23')](respondWithFilteredResult(_0x1daec4,_0x4cb0ec))[_0x2c0f('0x45')](handleError(_0x1daec4,null));};exports[_0x2c0f('0x46')]=function(_0x57599a,_0x401a63){var _0x239f53={'raw':!![],'where':{'id':_0x57599a[_0x2c0f('0x47')]['id']}},_0x4d716a={};_0x4d716a['model']=_[_0x2c0f('0x2e')](db[_0x2c0f('0x40')][_0x2c0f('0x29')]);_0x4d716a[_0x2c0f('0x2f')]=_['keys'](_0x57599a[_0x2c0f('0x2f')]);_0x4d716a[_0x2c0f('0x30')]=_[_0x2c0f('0x31')](_0x4d716a[_0x2c0f('0x2d')],_0x4d716a['query']);_0x239f53[_0x2c0f('0x32')]=_[_0x2c0f('0x31')](_0x4d716a[_0x2c0f('0x2d')],qs[_0x2c0f('0x33')](_0x57599a[_0x2c0f('0x2f')][_0x2c0f('0x33')]));_0x239f53[_0x2c0f('0x32')]=_0x239f53[_0x2c0f('0x32')][_0x2c0f('0x34')]?_0x239f53['attributes']:_0x4d716a[_0x2c0f('0x2d')];if(_0x57599a[_0x2c0f('0x2f')][_0x2c0f('0x41')]){_0x239f53[_0x2c0f('0x42')]=[{'all':!![]}];}_0x239f53=_[_0x2c0f('0x3d')]({},_0x239f53,_0x57599a[_0x2c0f('0x3f')]);return db[_0x2c0f('0x40')][_0x2c0f('0x48')](_0x239f53)[_0x2c0f('0x23')](handleEntityNotFound(_0x401a63,null))[_0x2c0f('0x23')](respondWithResult(_0x401a63,null))[_0x2c0f('0x45')](handleError(_0x401a63,null));};exports[_0x2c0f('0x49')]=function(_0x16c969,_0x2a677d){return db[_0x2c0f('0x40')][_0x2c0f('0x49')](_0x16c969['body'],{})['then'](respondWithResult(_0x2a677d,0xc9))[_0x2c0f('0x45')](handleError(_0x2a677d,null));};exports['update']=function(_0x55f3dc,_0x183c14){if(_0x55f3dc[_0x2c0f('0x4a')]['id']){delete _0x55f3dc[_0x2c0f('0x4a')]['id'];}return db[_0x2c0f('0x40')][_0x2c0f('0x48')]({'where':{'id':_0x55f3dc[_0x2c0f('0x47')]['id']}})[_0x2c0f('0x23')](handleEntityNotFound(_0x183c14,null))[_0x2c0f('0x23')](saveUpdates(_0x55f3dc['body'],null))['then'](respondWithResult(_0x183c14,null))[_0x2c0f('0x45')](handleError(_0x183c14,null));};exports['destroy']=function(_0x10e873,_0x5c07a0){return db[_0x2c0f('0x40')][_0x2c0f('0x48')]({'where':{'id':_0x10e873[_0x2c0f('0x47')]['id']}})[_0x2c0f('0x23')](handleEntityNotFound(_0x5c07a0,null))[_0x2c0f('0x23')](removeEntity(_0x5c07a0,null))[_0x2c0f('0x45')](handleError(_0x5c07a0,null));}; \ No newline at end of file +var _0xc799=['sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','stack','name','send','index','ZendeskField','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x35ae04,_0x136ba2){var _0x4309b5=function(_0x65a3d4){while(--_0x65a3d4){_0x35ae04['push'](_0x35ae04['shift']());}};_0x4309b5(++_0x136ba2);}(_0xc799,0x1a6));var _0x9c79=function(_0x128fc4,_0x3e4bbd){_0x128fc4=_0x128fc4-0x0;var _0x3a7e51=_0xc799[_0x128fc4];return _0x3a7e51;};'use strict';var emlformat=require(_0x9c79('0x0'));var rimraf=require(_0x9c79('0x1'));var zipdir=require(_0x9c79('0x2'));var jsonpatch=require(_0x9c79('0x3'));var rp=require(_0x9c79('0x4'));var moment=require(_0x9c79('0x5'));var BPromise=require(_0x9c79('0x6'));var Mustache=require(_0x9c79('0x7'));var util=require(_0x9c79('0x8'));var path=require('path');var sox=require(_0x9c79('0x9'));var csv=require(_0x9c79('0xa'));var ejs=require(_0x9c79('0xb'));var fs=require('fs');var fs_extra=require(_0x9c79('0xc'));var _=require(_0x9c79('0xd'));var squel=require(_0x9c79('0xe'));var crypto=require(_0x9c79('0xf'));var jsforce=require(_0x9c79('0x10'));var deskjs=require(_0x9c79('0x11'));var toCsv=require(_0x9c79('0xa'));var querystring=require(_0x9c79('0x12'));var Papa=require(_0x9c79('0x13'));var Redis=require(_0x9c79('0x14'));var authService=require(_0x9c79('0x15'));var qs=require(_0x9c79('0x16'));var as=require(_0x9c79('0x17'));var hardwareService=require(_0x9c79('0x18'));var logger=require(_0x9c79('0x19'))(_0x9c79('0x1a'));var utils=require(_0x9c79('0x1b'));var config=require(_0x9c79('0x1c'));var licenseUtil=require(_0x9c79('0x1d'));var db=require(_0x9c79('0x1e'))['db'];function respondWithStatusCode(_0x4f383c,_0x346f4d){_0x346f4d=_0x346f4d||0xcc;return function(_0x22802d){if(_0x22802d){return _0x4f383c[_0x9c79('0x1f')](_0x346f4d);}return _0x4f383c[_0x9c79('0x20')](_0x346f4d)[_0x9c79('0x21')]();};}function respondWithResult(_0x2891cf,_0x3fb1a3){_0x3fb1a3=_0x3fb1a3||0xc8;return function(_0x204c5d){if(_0x204c5d){return _0x2891cf[_0x9c79('0x20')](_0x3fb1a3)[_0x9c79('0x22')](_0x204c5d);}};}function respondWithFilteredResult(_0x437b10,_0x3edbfc){return function(_0x3fe296){if(_0x3fe296){var _0x4e7323=typeof _0x3edbfc[_0x9c79('0x23')]===_0x9c79('0x24')&&typeof _0x3edbfc[_0x9c79('0x25')]===_0x9c79('0x24');var _0x340933=_0x3fe296['count'];var _0x409183=_0x4e7323?0x0:_0x3edbfc[_0x9c79('0x23')];var _0x329582=_0x4e7323?_0x3fe296[_0x9c79('0x26')]:_0x3edbfc[_0x9c79('0x23')]+_0x3edbfc['limit'];var _0x2684d1;if(_0x329582>=_0x340933){_0x329582=_0x340933;_0x2684d1=0xc8;}else{_0x2684d1=0xce;}_0x437b10[_0x9c79('0x20')](_0x2684d1);return _0x437b10[_0x9c79('0x27')](_0x9c79('0x28'),_0x409183+'-'+_0x329582+'/'+_0x340933)['json'](_0x3fe296);}return null;};}function patchUpdates(_0x3ccdd2){return function(_0xf2fa08){try{jsonpatch['apply'](_0xf2fa08,_0x3ccdd2,!![]);}catch(_0x511e54){return BPromise[_0x9c79('0x29')](_0x511e54);}return _0xf2fa08['save']();};}function saveUpdates(_0x4c4f81,_0x5f31ba){return function(_0x223117){if(_0x223117){return _0x223117[_0x9c79('0x2a')](_0x4c4f81)[_0x9c79('0x2b')](function(_0x5ecb5c){return _0x5ecb5c;});}return null;};}function removeEntity(_0x1983f9,_0x3db0b2){return function(_0x3c6563){if(_0x3c6563){return _0x3c6563[_0x9c79('0x2c')]()[_0x9c79('0x2b')](function(){_0x1983f9['status'](0xcc)[_0x9c79('0x21')]();});}};}function handleEntityNotFound(_0x427a29,_0x50e1c8){return function(_0x4c1e2a){if(!_0x4c1e2a){_0x427a29['sendStatus'](0x194);}return _0x4c1e2a;};}function handleError(_0x1f06e4,_0x3a5cca){_0x3a5cca=_0x3a5cca||0x1f4;return function(_0x205892){logger['error'](_0x205892[_0x9c79('0x2d')]);if(_0x205892[_0x9c79('0x2e')]){delete _0x205892[_0x9c79('0x2e')];}_0x1f06e4['status'](_0x3a5cca)[_0x9c79('0x2f')](_0x205892);};}exports[_0x9c79('0x30')]=function(_0x40b0ef,_0x5223d0){var _0x5343f0={},_0x3db576={},_0x216075={'count':0x0,'rows':[]};var _0x4fad9c=_['map'](db[_0x9c79('0x31')][_0x9c79('0x32')],function(_0x423745){return{'name':_0x423745[_0x9c79('0x33')],'type':_0x423745['type'][_0x9c79('0x34')]};});_0x3db576[_0x9c79('0x35')]=_[_0x9c79('0x36')](_0x4fad9c,_0x9c79('0x2e'));_0x3db576[_0x9c79('0x37')]=_[_0x9c79('0x38')](_0x40b0ef[_0x9c79('0x37')]);_0x3db576['filters']=_[_0x9c79('0x39')](_0x3db576[_0x9c79('0x35')],_0x3db576['query']);_0x5343f0[_0x9c79('0x3a')]=_[_0x9c79('0x39')](_0x3db576[_0x9c79('0x35')],qs['fields'](_0x40b0ef['query'][_0x9c79('0x3b')]));_0x5343f0['attributes']=_0x5343f0[_0x9c79('0x3a')][_0x9c79('0x3c')]?_0x5343f0['attributes']:_0x3db576[_0x9c79('0x35')];if(!_0x40b0ef[_0x9c79('0x37')][_0x9c79('0x3d')](_0x9c79('0x3e'))){_0x5343f0[_0x9c79('0x25')]=qs[_0x9c79('0x25')](_0x40b0ef[_0x9c79('0x37')][_0x9c79('0x25')]);_0x5343f0[_0x9c79('0x23')]=qs[_0x9c79('0x23')](_0x40b0ef['query'][_0x9c79('0x23')]);}_0x5343f0[_0x9c79('0x3f')]=qs[_0x9c79('0x40')](_0x40b0ef['query']['sort']);_0x5343f0[_0x9c79('0x41')]=qs[_0x9c79('0x42')](_['pick'](_0x40b0ef[_0x9c79('0x37')],_0x3db576[_0x9c79('0x42')]),_0x4fad9c);if(_0x40b0ef[_0x9c79('0x37')][_0x9c79('0x43')]){_0x5343f0[_0x9c79('0x41')]=_[_0x9c79('0x44')](_0x5343f0[_0x9c79('0x41')],{'$or':_[_0x9c79('0x36')](_0x4fad9c,function(_0x5f2ffe){if(_0x5f2ffe[_0x9c79('0x45')]!==_0x9c79('0x46')){var _0x2cb83d={};_0x2cb83d[_0x5f2ffe[_0x9c79('0x2e')]]={'$like':'%'+_0x40b0ef[_0x9c79('0x37')]['filter']+'%'};return _0x2cb83d;}})});}_0x5343f0=_[_0x9c79('0x44')]({},_0x5343f0,_0x40b0ef['options']);var _0x1281ea={'where':_0x5343f0[_0x9c79('0x41')]};return db[_0x9c79('0x31')]['count'](_0x1281ea)[_0x9c79('0x2b')](function(_0x2e4857){_0x216075[_0x9c79('0x26')]=_0x2e4857;if(_0x40b0ef[_0x9c79('0x37')][_0x9c79('0x47')]){_0x5343f0[_0x9c79('0x48')]=[{'all':!![]}];}return db[_0x9c79('0x31')][_0x9c79('0x49')](_0x5343f0);})[_0x9c79('0x2b')](function(_0x48d630){_0x216075[_0x9c79('0x4a')]=_0x48d630;return _0x216075;})[_0x9c79('0x2b')](respondWithFilteredResult(_0x5223d0,_0x5343f0))['catch'](handleError(_0x5223d0,null));};exports[_0x9c79('0x4b')]=function(_0xa454ab,_0x5909df){var _0x193888={'raw':!![],'where':{'id':_0xa454ab[_0x9c79('0x4c')]['id']}},_0x352391={};_0x352391[_0x9c79('0x35')]=_['keys'](db[_0x9c79('0x31')]['rawAttributes']);_0x352391[_0x9c79('0x37')]=_[_0x9c79('0x38')](_0xa454ab['query']);_0x352391[_0x9c79('0x42')]=_['intersection'](_0x352391[_0x9c79('0x35')],_0x352391[_0x9c79('0x37')]);_0x193888[_0x9c79('0x3a')]=_[_0x9c79('0x39')](_0x352391[_0x9c79('0x35')],qs['fields'](_0xa454ab[_0x9c79('0x37')][_0x9c79('0x3b')]));_0x193888['attributes']=_0x193888[_0x9c79('0x3a')][_0x9c79('0x3c')]?_0x193888['attributes']:_0x352391[_0x9c79('0x35')];if(_0xa454ab[_0x9c79('0x37')]['includeAll']){_0x193888[_0x9c79('0x48')]=[{'all':!![]}];}_0x193888=_[_0x9c79('0x44')]({},_0x193888,_0xa454ab['options']);return db[_0x9c79('0x31')][_0x9c79('0x4d')](_0x193888)[_0x9c79('0x2b')](handleEntityNotFound(_0x5909df,null))[_0x9c79('0x2b')](respondWithResult(_0x5909df,null))[_0x9c79('0x4e')](handleError(_0x5909df,null));};exports[_0x9c79('0x4f')]=function(_0x278b19,_0x346420){return db[_0x9c79('0x31')][_0x9c79('0x4f')](_0x278b19[_0x9c79('0x50')],{})[_0x9c79('0x2b')](respondWithResult(_0x346420,0xc9))[_0x9c79('0x4e')](handleError(_0x346420,null));};exports[_0x9c79('0x2a')]=function(_0x5138a4,_0x559a5f){if(_0x5138a4['body']['id']){delete _0x5138a4['body']['id'];}return db[_0x9c79('0x31')]['find']({'where':{'id':_0x5138a4[_0x9c79('0x4c')]['id']}})['then'](handleEntityNotFound(_0x559a5f,null))[_0x9c79('0x2b')](saveUpdates(_0x5138a4['body'],null))[_0x9c79('0x2b')](respondWithResult(_0x559a5f,null))[_0x9c79('0x4e')](handleError(_0x559a5f,null));};exports[_0x9c79('0x2c')]=function(_0x61b94e,_0x219509){return db['ZendeskField'][_0x9c79('0x4d')]({'where':{'id':_0x61b94e['params']['id']}})[_0x9c79('0x2b')](handleEntityNotFound(_0x219509,null))[_0x9c79('0x2b')](removeEntity(_0x219509,null))[_0x9c79('0x4e')](handleError(_0x219509,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f589ec7..a688f05 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 _0xeae0=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField'];(function(_0x2417d4,_0xceb26e){var _0x38a31b=function(_0x501b98){while(--_0x501b98){_0x2417d4['push'](_0x2417d4['shift']());}};_0x38a31b(++_0xceb26e);}(_0xeae0,0xc4));var _0x0eae=function(_0x1d8b10,_0x9603a6){_0x1d8b10=_0x1d8b10-0x0;var _0x123f31=_0xeae0[_0x1d8b10];return _0x123f31;};'use strict';var _=require(_0x0eae('0x0'));var util=require(_0x0eae('0x1'));var logger=require('../../config/logger')(_0x0eae('0x2'));var moment=require(_0x0eae('0x3'));var BPromise=require(_0x0eae('0x4'));var rp=require(_0x0eae('0x5'));var fs=require('fs');var path=require(_0x0eae('0x6'));var rimraf=require(_0x0eae('0x7'));var config=require(_0x0eae('0x8'));var attributes=require(_0x0eae('0x9'));module[_0x0eae('0xa')]=function(_0x41ed85,_0x505039){return _0x41ed85['define'](_0x0eae('0xb'),attributes,{'tableName':_0x0eae('0xc'),'paranoid':![],'indexes':[{'name':_0x0eae('0xd'),'fields':[_0x0eae('0xe'),_0x0eae('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0539=['idField','FieldId','util','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index'];(function(_0x51f40e,_0x14e8ea){var _0xb37761=function(_0x10bce3){while(--_0x10bce3){_0x51f40e['push'](_0x51f40e['shift']());}};_0xb37761(++_0x14e8ea);}(_0x0539,0x1d0));var _0x9053=function(_0x4fdd06,_0x10bd5b){_0x4fdd06=_0x4fdd06-0x0;var _0x123bde=_0x0539[_0x4fdd06];return _0x123bde;};'use strict';var _=require('lodash');var util=require(_0x9053('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9053('0x1'));var rp=require(_0x9053('0x2'));var fs=require('fs');var path=require(_0x9053('0x3'));var rimraf=require(_0x9053('0x4'));var config=require('../../config/environment');var attributes=require(_0x9053('0x5'));module[_0x9053('0x6')]=function(_0x40c06e,_0x58a063){return _0x40c06e['define']('ZendeskField',attributes,{'tableName':_0x9053('0x7'),'paranoid':![],'indexes':[{'name':_0x9053('0x8'),'fields':[_0x9053('0x9'),_0x9053('0xa')],'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 24c3b15..eeb2bf6 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 _0x9ad6=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x1c0d19,_0x2b9a0){var _0x579779=function(_0x4ac5f1){while(--_0x4ac5f1){_0x1c0d19['push'](_0x1c0d19['shift']());}};_0x579779(++_0x2b9a0);}(_0x9ad6,0x14f));var _0x69ad=function(_0x14e945,_0x407ec3){_0x14e945=_0x14e945-0x0;var _0x560cec=_0x9ad6[_0x14e945];return _0x560cec;};'use strict';var _=require(_0x69ad('0x0'));var util=require(_0x69ad('0x1'));var moment=require(_0x69ad('0x2'));var BPromise=require('bluebird');var rs=require(_0x69ad('0x3'));var fs=require('fs');var Redis=require(_0x69ad('0x4'));var db=require(_0x69ad('0x5'))['db'];var utils=require(_0x69ad('0x6'));var logger=require(_0x69ad('0x7'))(_0x69ad('0x8'));var config=require('../../config/environment');var jayson=require(_0x69ad('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x457dc5,_0x462b07,_0x4f4668){return new BPromise(function(_0x528748,_0x49d127){return client[_0x69ad('0xa')](_0x457dc5,_0x4f4668)[_0x69ad('0xb')](function(_0x32d430){logger[_0x69ad('0xc')](_0x69ad('0xd'),_0x462b07,_0x69ad('0xe'));logger[_0x69ad('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x462b07,_0x69ad('0xe'),JSON[_0x69ad('0x10')](_0x32d430));if(_0x32d430[_0x69ad('0x11')]){if(_0x32d430[_0x69ad('0x11')]['code']===0x1f4){logger[_0x69ad('0x11')](_0x69ad('0xd'),_0x462b07,_0x32d430[_0x69ad('0x11')][_0x69ad('0x12')]);return _0x49d127(_0x32d430[_0x69ad('0x11')][_0x69ad('0x12')]);}logger[_0x69ad('0x11')](_0x69ad('0xd'),_0x462b07,_0x32d430[_0x69ad('0x11')][_0x69ad('0x12')]);return _0x528748(_0x32d430[_0x69ad('0x11')][_0x69ad('0x12')]);}else{logger['info'](_0x69ad('0xd'),_0x462b07,_0x69ad('0xe'));_0x528748(_0x32d430['result'][_0x69ad('0x12')]);}})[_0x69ad('0x13')](function(_0x4d26ab){logger['error'](_0x69ad('0xd'),_0x462b07,_0x4d26ab);_0x49d127(_0x4d26ab);});});} \ No newline at end of file +var _0x62a4=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x62a4,0x1c0));var _0x462a=function(_0x7f4dbc,_0x344984){_0x7f4dbc=_0x7f4dbc-0x0;var _0x3229c9=_0x62a4[_0x7f4dbc];return _0x3229c9;};'use strict';var _=require('lodash');var util=require(_0x462a('0x0'));var moment=require(_0x462a('0x1'));var BPromise=require('bluebird');var rs=require(_0x462a('0x2'));var fs=require('fs');var Redis=require(_0x462a('0x3'));var db=require(_0x462a('0x4'))['db'];var utils=require(_0x462a('0x5'));var logger=require('../../config/logger')(_0x462a('0x6'));var config=require(_0x462a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x462a('0x8')][_0x462a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x254031,_0x247dec,_0x2dbbe4){return new BPromise(function(_0x5a60a6,_0x54dbb2){return client['request'](_0x254031,_0x2dbbe4)[_0x462a('0xa')](function(_0x5195be){logger['info'](_0x462a('0xb'),_0x247dec,_0x462a('0xc'));logger[_0x462a('0xd')](_0x462a('0xe'),_0x247dec,_0x462a('0xc'),JSON[_0x462a('0xf')](_0x5195be));if(_0x5195be[_0x462a('0x10')]){if(_0x5195be[_0x462a('0x10')][_0x462a('0x11')]===0x1f4){logger[_0x462a('0x10')](_0x462a('0xb'),_0x247dec,_0x5195be[_0x462a('0x10')][_0x462a('0x12')]);return _0x54dbb2(_0x5195be['error']['message']);}logger['error'](_0x462a('0xb'),_0x247dec,_0x5195be[_0x462a('0x10')][_0x462a('0x12')]);return _0x5a60a6(_0x5195be[_0x462a('0x10')][_0x462a('0x12')]);}else{logger[_0x462a('0x13')](_0x462a('0xb'),_0x247dec,_0x462a('0xc'));_0x5a60a6(_0x5195be[_0x462a('0x14')]['message']);}})[_0x462a('0x15')](function(_0x49ce50){logger[_0x462a('0x10')]('ZendeskField,\x20%s,\x20%s',_0x247dec,_0x49ce50);_0x54dbb2(_0x49ce50);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 20c4f0d..81b6a42 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 _0x32d8=['/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x32d8,0x68));var _0x832d=function(_0x540178,_0x1feb3d){_0x540178=_0x540178-0x0;var _0x58a85c=_0x32d8[_0x540178];return _0x58a85c;};'use strict';var multer=require(_0x832d('0x0'));var util=require(_0x832d('0x1'));var path=require(_0x832d('0x2'));var timeout=require(_0x832d('0x3'));var express=require(_0x832d('0x4'));var router=express[_0x832d('0x5')]();var fs_extra=require(_0x832d('0x6'));var auth=require(_0x832d('0x7'));var interaction=require(_0x832d('0x8'));var config=require(_0x832d('0x9'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x832d('0xa')](),controller[_0x832d('0xb')]);router[_0x832d('0xc')](_0x832d('0xd'),auth[_0x832d('0xa')](),controller[_0x832d('0xe')]);router[_0x832d('0xc')](_0x832d('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x832d('0xc')](_0x832d('0x10'),auth[_0x832d('0xa')](),controller['getFields']);router[_0x832d('0x11')]('/',auth[_0x832d('0xa')](),controller[_0x832d('0x12')]);router['post']('/:id/configurations',auth[_0x832d('0xa')](),controller[_0x832d('0x13')]);router[_0x832d('0x14')]('/:id',auth[_0x832d('0xa')](),controller[_0x832d('0x15')]);router[_0x832d('0x16')]('/:id',auth[_0x832d('0xa')](),controller[_0x832d('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd943=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd943,0x162));var _0x3d94=function(_0x569dde,_0x25bee5){_0x569dde=_0x569dde-0x0;var _0x270121=_0xd943[_0x569dde];return _0x270121;};'use strict';var multer=require(_0x3d94('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3d94('0x1'));var express=require(_0x3d94('0x2'));var router=express[_0x3d94('0x3')]();var fs_extra=require(_0x3d94('0x4'));var auth=require(_0x3d94('0x5'));var interaction=require(_0x3d94('0x6'));var config=require(_0x3d94('0x7'));var controller=require(_0x3d94('0x8'));router[_0x3d94('0x9')]('/',auth[_0x3d94('0xa')](),controller[_0x3d94('0xb')]);router[_0x3d94('0x9')]('/:id',auth[_0x3d94('0xa')](),controller[_0x3d94('0xc')]);router[_0x3d94('0x9')](_0x3d94('0xd'),auth[_0x3d94('0xa')](),controller[_0x3d94('0xe')]);router[_0x3d94('0x9')](_0x3d94('0xf'),auth['isAuthenticated'](),controller[_0x3d94('0x10')]);router[_0x3d94('0x11')]('/',auth[_0x3d94('0xa')](),controller['create']);router[_0x3d94('0x11')]('/:id/configurations',auth[_0x3d94('0xa')](),controller['addConfiguration']);router[_0x3d94('0x12')](_0x3d94('0x13'),auth['isAuthenticated'](),controller[_0x3d94('0x14')]);router[_0x3d94('0x15')]('/:id',auth[_0x3d94('0xa')](),controller[_0x3d94('0x16')]);module[_0x3d94('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 62e7008..0c1cc09 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 _0x702d=['sequelize','exports','STRING'];(function(_0x57bda4,_0x4bc278){var _0x56103e=function(_0x552ce0){while(--_0x552ce0){_0x57bda4['push'](_0x57bda4['shift']());}};_0x56103e(++_0x4bc278);}(_0x702d,0x147));var _0xd702=function(_0x39ea6d,_0x4d85e2){_0x39ea6d=_0x39ea6d-0x0;var _0x548037=_0x702d[_0x39ea6d];return _0x548037;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x70e0=['STRING','sequelize','exports'];(function(_0x2c06b1,_0x1961df){var _0x266ea1=function(_0x35b2ac){while(--_0x35b2ac){_0x2c06b1['push'](_0x2c06b1['shift']());}};_0x266ea1(++_0x1961df);}(_0x70e0,0x17b));var _0x070e=function(_0x4ecab6,_0xdaa9ee){_0x4ecab6=_0x4ecab6-0x0;var _0x4f6e91=_0x70e0[_0x4ecab6];return _0x4f6e91;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'name':{'type':Sequelize[_0x070e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x070e('0x2')]},'clientId':{'type':Sequelize[_0x070e('0x2')]},'clientSecret':{'type':Sequelize[_0x070e('0x2')]},'serverUrl':{'type':Sequelize[_0x070e('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x070e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index e62f140..a20e80e 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 _0x853d=['Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','refreshToken','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','keys','find','catch','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientSecret','refresh_token'];(function(_0x47e62e,_0x5827c8){var _0x4b08ec=function(_0x1030ab){while(--_0x1030ab){_0x47e62e['push'](_0x47e62e['shift']());}};_0x4b08ec(++_0x5827c8);}(_0x853d,0x1b1));var _0xd853=function(_0xa4a9b3,_0x3b271c){_0xa4a9b3=_0xa4a9b3-0x0;var _0xb7a49e=_0x853d[_0xa4a9b3];return _0xb7a49e;};'use strict';var emlformat=require(_0xd853('0x0'));var rimraf=require(_0xd853('0x1'));var zipdir=require(_0xd853('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd853('0x3'));var moment=require(_0xd853('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd853('0x5'));var util=require(_0xd853('0x6'));var path=require(_0xd853('0x7'));var sox=require(_0xd853('0x8'));var csv=require(_0xd853('0x9'));var ejs=require(_0xd853('0xa'));var fs=require('fs');var fs_extra=require(_0xd853('0xb'));var _=require(_0xd853('0xc'));var squel=require(_0xd853('0xd'));var crypto=require(_0xd853('0xe'));var jsforce=require(_0xd853('0xf'));var deskjs=require(_0xd853('0x10'));var toCsv=require(_0xd853('0x9'));var querystring=require(_0xd853('0x11'));var Papa=require('papaparse');var Redis=require(_0xd853('0x12'));var authService=require(_0xd853('0x13'));var qs=require(_0xd853('0x14'));var as=require(_0xd853('0x15'));var hardwareService=require(_0xd853('0x16'));var logger=require(_0xd853('0x17'))(_0xd853('0x18'));var utils=require('../../config/utils');var config=require(_0xd853('0x19'));var licenseUtil=require(_0xd853('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd853('0x1b'));function respondWithStatusCode(_0x36390b,_0x3ed3ca){_0x3ed3ca=_0x3ed3ca||0xcc;return function(_0x1e4c08){if(_0x1e4c08){return _0x36390b[_0xd853('0x1c')](_0x3ed3ca);}return _0x36390b[_0xd853('0x1d')](_0x3ed3ca)[_0xd853('0x1e')]();};}function respondWithResult(_0xa2e1b0,_0xb589b9){_0xb589b9=_0xb589b9||0xc8;return function(_0x2f244e){if(_0x2f244e){return _0xa2e1b0['status'](_0xb589b9)['json'](_0x2f244e);}};}function respondWithFilteredResult(_0x56ad72,_0x23f672){return function(_0x3449da){if(_0x3449da){var _0x5b2d42=typeof _0x23f672[_0xd853('0x1f')]===_0xd853('0x20')&&typeof _0x23f672['limit']===_0xd853('0x20');var _0x26b275=_0x3449da[_0xd853('0x21')];var _0x8420dd=_0x5b2d42?0x0:_0x23f672[_0xd853('0x1f')];var _0x30838d=_0x5b2d42?_0x3449da[_0xd853('0x21')]:_0x23f672[_0xd853('0x1f')]+_0x23f672['limit'];var _0x3f133e;if(_0x30838d>=_0x26b275){_0x30838d=_0x26b275;_0x3f133e=0xc8;}else{_0x3f133e=0xce;}_0x56ad72[_0xd853('0x1d')](_0x3f133e);return _0x56ad72[_0xd853('0x22')](_0xd853('0x23'),_0x8420dd+'-'+_0x30838d+'/'+_0x26b275)[_0xd853('0x24')](_0x3449da);}return null;};}function patchUpdates(_0x57e35a){return function(_0x11ae83){try{jsonpatch[_0xd853('0x25')](_0x11ae83,_0x57e35a,!![]);}catch(_0x50d744){return BPromise[_0xd853('0x26')](_0x50d744);}return _0x11ae83[_0xd853('0x27')]();};}function saveUpdates(_0x15859f,_0x26faf6){return function(_0x5f1bf4){if(_0x5f1bf4){return _0x5f1bf4[_0xd853('0x28')](_0x15859f)['then'](function(_0x2d5276){return _0x2d5276;});}return null;};}function removeEntity(_0x39f0b4,_0x2a18fa){return function(_0x492a39){if(_0x492a39){return _0x492a39[_0xd853('0x29')]()[_0xd853('0x2a')](function(){_0x39f0b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ce76,_0x3ffac5){return function(_0x3c9037){if(!_0x3c9037){_0x16ce76['sendStatus'](0x194);}return _0x3c9037;};}function handleError(_0x14d300,_0x55a3e8){_0x55a3e8=_0x55a3e8||0x1f4;return function(_0x1ca2b6){logger['error'](_0x1ca2b6[_0xd853('0x2b')]);if(_0x1ca2b6[_0xd853('0x2c')]){delete _0x1ca2b6[_0xd853('0x2c')];}_0x14d300[_0xd853('0x1d')](_0x55a3e8)['send'](_0x1ca2b6);};}exports[_0xd853('0x2d')]=function(_0x499f3f,_0x1c5076){var _0x300e50={},_0x313b1f={},_0x1aa716={'count':0x0,'rows':[]};var _0xe27cd1=_[_0xd853('0x2e')](db[_0xd853('0x2f')][_0xd853('0x30')],function(_0x2a304f){return{'name':_0x2a304f[_0xd853('0x31')],'type':_0x2a304f[_0xd853('0x32')]['key']};});_0x313b1f[_0xd853('0x33')]=_[_0xd853('0x2e')](_0xe27cd1,_0xd853('0x2c'));_0x313b1f[_0xd853('0x34')]=_['keys'](_0x499f3f[_0xd853('0x34')]);_0x313b1f[_0xd853('0x35')]=_[_0xd853('0x36')](_0x313b1f[_0xd853('0x33')],_0x313b1f[_0xd853('0x34')]);_0x300e50[_0xd853('0x37')]=_[_0xd853('0x36')](_0x313b1f['model'],qs[_0xd853('0x38')](_0x499f3f[_0xd853('0x34')][_0xd853('0x38')]));_0x300e50['attributes']=_0x300e50[_0xd853('0x37')][_0xd853('0x39')]?_0x300e50[_0xd853('0x37')]:_0x313b1f[_0xd853('0x33')];if(!_0x499f3f['query'][_0xd853('0x3a')](_0xd853('0x3b'))){_0x300e50[_0xd853('0x3c')]=qs['limit'](_0x499f3f[_0xd853('0x34')][_0xd853('0x3c')]);_0x300e50[_0xd853('0x1f')]=qs['offset'](_0x499f3f[_0xd853('0x34')][_0xd853('0x1f')]);}_0x300e50[_0xd853('0x3d')]=qs[_0xd853('0x3e')](_0x499f3f[_0xd853('0x34')][_0xd853('0x3e')]);_0x300e50[_0xd853('0x3f')]=qs[_0xd853('0x35')](_[_0xd853('0x40')](_0x499f3f['query'],_0x313b1f[_0xd853('0x35')]),_0xe27cd1);if(_0x499f3f['query'][_0xd853('0x41')]){_0x300e50['where']=_[_0xd853('0x42')](_0x300e50['where'],{'$or':_[_0xd853('0x2e')](_0xe27cd1,function(_0x4cff85){if(_0x4cff85['type']!=='VIRTUAL'){var _0x33fe7c={};_0x33fe7c[_0x4cff85[_0xd853('0x2c')]]={'$like':'%'+_0x499f3f[_0xd853('0x34')]['filter']+'%'};return _0x33fe7c;}})});}_0x300e50=_[_0xd853('0x42')]({},_0x300e50,_0x499f3f[_0xd853('0x43')]);var _0x41da35={'where':_0x300e50[_0xd853('0x3f')]};return db[_0xd853('0x2f')][_0xd853('0x21')](_0x41da35)['then'](function(_0x4255ff){_0x1aa716[_0xd853('0x21')]=_0x4255ff;if(_0x499f3f['query']['includeAll']){_0x300e50[_0xd853('0x44')]=[{'all':!![]}];}return db[_0xd853('0x2f')][_0xd853('0x45')](_0x300e50);})[_0xd853('0x2a')](function(_0x50b8aa){_0x1aa716[_0xd853('0x46')]=_0x50b8aa;return _0x1aa716;})[_0xd853('0x2a')](respondWithFilteredResult(_0x1c5076,_0x300e50))['catch'](handleError(_0x1c5076,null));};exports['show']=function(_0x5205dc,_0x5c6fe1){var _0x3c0cf3={'raw':![],'where':{'id':_0x5205dc[_0xd853('0x47')]['id']}},_0x5b6624={};_0x5b6624[_0xd853('0x33')]=_[_0xd853('0x48')](db[_0xd853('0x2f')][_0xd853('0x30')]);_0x5b6624[_0xd853('0x34')]=_[_0xd853('0x48')](_0x5205dc[_0xd853('0x34')]);_0x5b6624['filters']=_['intersection'](_0x5b6624[_0xd853('0x33')],_0x5b6624['query']);_0x3c0cf3[_0xd853('0x37')]=_[_0xd853('0x36')](_0x5b6624[_0xd853('0x33')],qs['fields'](_0x5205dc['query']['fields']));_0x3c0cf3[_0xd853('0x37')]=_0x3c0cf3[_0xd853('0x37')][_0xd853('0x39')]?_0x3c0cf3['attributes']:_0x5b6624['model'];if(_0x5205dc[_0xd853('0x34')]['includeAll']){_0x3c0cf3[_0xd853('0x44')]=[{'all':!![]}];}_0x3c0cf3=_[_0xd853('0x42')]({},_0x3c0cf3,_0x5205dc['options']);return db[_0xd853('0x2f')][_0xd853('0x49')](_0x3c0cf3)[_0xd853('0x2a')](handleEntityNotFound(_0x5c6fe1,null))[_0xd853('0x2a')](respondWithResult(_0x5c6fe1,null))[_0xd853('0x4a')](handleError(_0x5c6fe1,null));};exports[_0xd853('0x4b')]=function(_0x171d93,_0x2ee6fe){return db[_0xd853('0x2f')][_0xd853('0x4b')](_0x171d93[_0xd853('0x4c')],{})[_0xd853('0x2a')](respondWithResult(_0x2ee6fe,0xc9))[_0xd853('0x4a')](handleError(_0x2ee6fe,null));};exports[_0xd853('0x28')]=function(_0x175a27,_0x2c7f8f){if(_0x175a27[_0xd853('0x4c')]['id']){delete _0x175a27[_0xd853('0x4c')]['id'];}return db[_0xd853('0x2f')][_0xd853('0x49')]({'where':{'id':_0x175a27[_0xd853('0x47')]['id']}})[_0xd853('0x2a')](handleEntityNotFound(_0x2c7f8f,null))[_0xd853('0x2a')](saveUpdates(_0x175a27[_0xd853('0x4c')],null))['then'](respondWithResult(_0x2c7f8f,null))[_0xd853('0x4a')](handleError(_0x2c7f8f,null));};exports[_0xd853('0x29')]=function(_0x278322,_0x95cbb8){return db[_0xd853('0x2f')][_0xd853('0x49')]({'where':{'id':_0x278322['params']['id']}})[_0xd853('0x2a')](handleEntityNotFound(_0x95cbb8,null))[_0xd853('0x2a')](removeEntity(_0x95cbb8,null))[_0xd853('0x4a')](handleError(_0x95cbb8,null));};exports[_0xd853('0x4d')]=function(_0x67a27b,_0x47334d,_0x2aa617){var _0x2ac348={};var _0x1f25b5={};var _0x1501c4;var _0x549fdb;return db[_0xd853('0x2f')][_0xd853('0x4e')]({'where':{'id':_0x67a27b[_0xd853('0x47')]['id']}})[_0xd853('0x2a')](handleEntityNotFound(_0x47334d,null))[_0xd853('0x2a')](function(_0x5cc315){if(_0x5cc315){_0x1501c4=_0x5cc315;_0x1f25b5[_0xd853('0x33')]=_['keys'](db['ZohoConfiguration'][_0xd853('0x30')]);_0x1f25b5[_0xd853('0x34')]=_[_0xd853('0x48')](_0x67a27b['query']);_0x1f25b5['filters']=_['intersection'](_0x1f25b5['model'],_0x1f25b5['query']);_0x2ac348[_0xd853('0x37')]=_[_0xd853('0x36')](_0x1f25b5[_0xd853('0x33')],qs[_0xd853('0x38')](_0x67a27b[_0xd853('0x34')][_0xd853('0x38')]));_0x2ac348[_0xd853('0x37')]=_0x2ac348[_0xd853('0x37')][_0xd853('0x39')]?_0x2ac348[_0xd853('0x37')]:_0x1f25b5[_0xd853('0x33')];_0x2ac348[_0xd853('0x3d')]=qs[_0xd853('0x3e')](_0x67a27b[_0xd853('0x34')][_0xd853('0x3e')]);_0x2ac348[_0xd853('0x3f')]=qs[_0xd853('0x35')](_[_0xd853('0x40')](_0x67a27b[_0xd853('0x34')],_0x1f25b5[_0xd853('0x35')]));if(_0x67a27b[_0xd853('0x34')]['filter']){_0x2ac348[_0xd853('0x3f')]=_['merge'](_0x2ac348[_0xd853('0x3f')],{'$or':_[_0xd853('0x2e')](_0x2ac348[_0xd853('0x37')],function(_0x58f97b){var _0x2f4fde={};_0x2f4fde[_0x58f97b]={'$like':'%'+_0x67a27b[_0xd853('0x34')]['filter']+'%'};return _0x2f4fde;})});}_0x2ac348=_['merge']({},_0x2ac348,_0x67a27b[_0xd853('0x43')]);return _0x1501c4[_0xd853('0x4d')](_0x2ac348);}})[_0xd853('0x2a')](function(_0x35a814){if(_0x35a814){_0x549fdb=_0x35a814[_0xd853('0x39')];if(!_0x67a27b[_0xd853('0x34')]['hasOwnProperty'](_0xd853('0x3b'))){_0x2ac348[_0xd853('0x3c')]=qs[_0xd853('0x3c')](_0x67a27b[_0xd853('0x34')][_0xd853('0x3c')]);_0x2ac348[_0xd853('0x1f')]=qs[_0xd853('0x1f')](_0x67a27b[_0xd853('0x34')][_0xd853('0x1f')]);}return _0x1501c4[_0xd853('0x4d')](_0x2ac348);}})[_0xd853('0x2a')](function(_0x37aaab){if(_0x37aaab){return _0x37aaab?{'count':_0x549fdb,'rows':_0x37aaab}:null;}})[_0xd853('0x2a')](respondWithResult(_0x47334d,null))['catch'](handleError(_0x47334d,null));};exports[_0xd853('0x4f')]=function(_0x157590,_0x4cce80,_0xf34571){if(_0x157590['body']['id']){delete _0x157590['body']['id'];}return db[_0xd853('0x2f')]['findOne']({'where':{'id':_0x157590[_0xd853('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cce80,null))[_0xd853('0x2a')](function(_0x5c622d){if(_0x5c622d){_0x157590[_0xd853('0x4c')][_0xd853('0x50')]=_0x5c622d['id'];_0x157590['body'][_0xd853('0x51')]=integrations[_0xd853('0x52')](_0x157590[_0xd853('0x4c')][_0xd853('0x53')],_0x157590['body'][_0xd853('0x32')]);_0x157590[_0xd853('0x4c')][_0xd853('0x54')]=integrations['getDescriptions'](_0x157590[_0xd853('0x4c')]['channel'],_0x157590[_0xd853('0x4c')][_0xd853('0x32')]);return db[_0xd853('0x55')][_0xd853('0x4b')](_0x157590[_0xd853('0x4c')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xd853('0x56')],'as':_0xd853('0x54')}]});}return null;})['then'](respondWithResult(_0x4cce80,null))['catch'](handleError(_0x4cce80,null));};function getAccessToken(_0x14a3d9){return new Promise(function(_0x26f065,_0xd73f3e){var _0x3e4ce3;switch(_0x14a3d9[_0xd853('0x57')]){case'US':_0x3e4ce3='https://accounts.zoho.com';break;case'AU':_0x3e4ce3=_0xd853('0x58');break;case'EU':_0x3e4ce3=_0xd853('0x59');break;case'IN':_0x3e4ce3=_0xd853('0x5a');break;case'CN':_0x3e4ce3=_0xd853('0x5b');break;default:_0x3e4ce3=_0xd853('0x59');break;}var _0x1ccc25={'method':'POST','uri':_0x3e4ce3+_0xd853('0x5c'),'qs':{'refresh_token':_0x14a3d9['refreshToken'],'client_id':_0x14a3d9['clientId'],'client_secret':_0x14a3d9[_0xd853('0x5d')],'grant_type':_0xd853('0x5e')},'json':!![]};return rp(_0x1ccc25)[_0xd853('0x2a')](function(_0x204254){if(_0x204254['access_token']){_0x26f065(_0x204254['access_token']);}else{_0xd73f3e(_0xd853('0x5f'));}})[_0xd853('0x4a')](function(_0x5331f3){_0xd73f3e(_0x5331f3);});});}exports[_0xd853('0x60')]=function(_0x303306,_0x749b77,_0x240189){var _0x20e55d,_0x3c2b8a,_0x429ae0,_0x5d3aff,_0x2513e0;return db[_0xd853('0x2f')][_0xd853('0x4e')]({'where':{'id':_0x303306['params']['id']},'attributes':['id',_0xd853('0x61'),_0xd853('0x57'),_0xd853('0x62'),_0xd853('0x5d'),_0xd853('0x63'),'code',_0xd853('0x64')]})[_0xd853('0x2a')](handleEntityNotFound(_0x749b77,null))[_0xd853('0x2a')](function(_0x23cbf6){_0x2513e0=_0x23cbf6;_0x20e55d=_0x2513e0[_0xd853('0x61')];_0x3c2b8a=_0x20e55d===_0xd853('0x65')?'eu':'com';_0x429ae0=_0x2513e0[_0xd853('0x63')];var _0x339070=_0x429ae0[_0xd853('0x66')](-0x1);if(_0x339070==='/'||_0x339070==='\x5c'||_0x339070===':'){_0x429ae0=_0x429ae0[_0xd853('0x67')](0x0,_0x429ae0[_0xd853('0x68')](_0x339070));}if(!_0x2513e0['refreshToken']){throw new Error(_0xd853('0x69'));}return getAccessToken(_0x2513e0);})[_0xd853('0x2a')](function(_0x3aa68a){if(_0x3aa68a){return rp({'method':_0xd853('0x6a'),'uri':util['format'](_0xd853('0x6b'),_0x3c2b8a),'qs':{'module':_0xd853('0x6c')},'headers':{'Authorization':_0xd853('0x6d')+_0x3aa68a},'json':!![]});}})[_0xd853('0x2a')](function(_0x1bd846){if(_0x1bd846){if(_0x1bd846[_0xd853('0x6e')]&&_0x1bd846['response']['error']){throw new Error(_0x1bd846[_0xd853('0x6e')][_0xd853('0x6f')]['message']);}var _0x57f7c9=[];var _0x5647d3=[];var _0x27f13=[_0xd853('0x70'),_0xd853('0x71'),_0xd853('0x72'),_0xd853('0x73'),_0xd853('0x74'),_0xd853('0x75'),_0xd853('0x76'),_0xd853('0x77')];_0x5647d3=_['remove'](_0x1bd846[_0xd853('0x38')],function(_0x30c7b0){return _0x27f13[_0xd853('0x78')](_0x30c7b0[_0xd853('0x79')]);});for(var _0xfd27f4=0x0;_0xfd27f4<_0x5647d3['length'];_0xfd27f4++){if(_0x5647d3[_0xfd27f4][_0xd853('0x7a')]===![]){_0x57f7c9[_0xd853('0x7b')]({'id':_0x5647d3[_0xfd27f4]['id'],'name':_0x5647d3[_0xfd27f4][_0xd853('0x7c')],'custom':_0x5647d3[_0xfd27f4][_0xd853('0x7d')],'options':_0x5647d3[_0xfd27f4][_0xd853('0x7e')]==='picklist'&&_0x5647d3[_0xfd27f4][_0xd853('0x7f')][_0xd853('0x39')]>-0x1?_[_0xd853('0x2e')](_0x5647d3[_0xfd27f4]['pick_list_values'],function(_0x38f735){return{'name':_0x38f735,'value':_0x38f735};}):[]});}}return{'count':_0x57f7c9[_0xd853('0x39')],'rows':_0x57f7c9};}else{return{'count':0x0,'rows':[]};}})[_0xd853('0x2a')](respondWithResult(_0x749b77,null))[_0xd853('0x4a')](function(_0x89dbba){var _0x1e8bff=_0x303306[_0xd853('0x34')]['test']?0x1f4:_0x89dbba[_0xd853('0x80')]||0x1f4;logger[_0xd853('0x6f')](_0xd853('0x81'),'getFields',_0x1e8bff,JSON[_0xd853('0x82')](_0x89dbba));delete _0x89dbba[_0xd853('0x2c')];if(_0x1e8bff===0x191){_0x1e8bff=0x190;}_0x749b77['status'](_0x1e8bff)['send'](_0x303306[_0xd853('0x34')]['test']?{'message':_0xd853('0x83'),'statusCode':_0x89dbba['statusCode']}:_0x89dbba);});}; \ No newline at end of file +var _0x7fa6=['end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','ZohoConfiguration','options','findOne','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientId','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','display_label','custom_field','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0xc45747,_0x46bbe9){var _0x51b27d=function(_0xee7d95){while(--_0xee7d95){_0xc45747['push'](_0xc45747['shift']());}};_0x51b27d(++_0x46bbe9);}(_0x7fa6,0xed));var _0x67fa=function(_0x25cf8c,_0x270994){_0x25cf8c=_0x25cf8c-0x0;var _0x54f971=_0x7fa6[_0x25cf8c];return _0x54f971;};'use strict';var emlformat=require(_0x67fa('0x0'));var rimraf=require(_0x67fa('0x1'));var zipdir=require(_0x67fa('0x2'));var jsonpatch=require(_0x67fa('0x3'));var rp=require(_0x67fa('0x4'));var moment=require(_0x67fa('0x5'));var BPromise=require(_0x67fa('0x6'));var Mustache=require(_0x67fa('0x7'));var util=require(_0x67fa('0x8'));var path=require('path');var sox=require(_0x67fa('0x9'));var csv=require('to-csv');var ejs=require(_0x67fa('0xa'));var fs=require('fs');var fs_extra=require(_0x67fa('0xb'));var _=require(_0x67fa('0xc'));var squel=require(_0x67fa('0xd'));var crypto=require('crypto');var jsforce=require(_0x67fa('0xe'));var deskjs=require(_0x67fa('0xf'));var toCsv=require('to-csv');var querystring=require(_0x67fa('0x10'));var Papa=require(_0x67fa('0x11'));var Redis=require(_0x67fa('0x12'));var authService=require(_0x67fa('0x13'));var qs=require(_0x67fa('0x14'));var as=require(_0x67fa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67fa('0x16'))(_0x67fa('0x17'));var utils=require(_0x67fa('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x67fa('0x19'))['db'];var integrations=require(_0x67fa('0x1a'));function respondWithStatusCode(_0xff8c01,_0x5a47ed){_0x5a47ed=_0x5a47ed||0xcc;return function(_0x4c0d61){if(_0x4c0d61){return _0xff8c01[_0x67fa('0x1b')](_0x5a47ed);}return _0xff8c01[_0x67fa('0x1c')](_0x5a47ed)[_0x67fa('0x1d')]();};}function respondWithResult(_0x30085b,_0x1858d2){_0x1858d2=_0x1858d2||0xc8;return function(_0x35429c){if(_0x35429c){return _0x30085b[_0x67fa('0x1c')](_0x1858d2)[_0x67fa('0x1e')](_0x35429c);}};}function respondWithFilteredResult(_0x26483d,_0x44118c){return function(_0x507ab5){if(_0x507ab5){var _0x12ef41=typeof _0x44118c['offset']===_0x67fa('0x1f')&&typeof _0x44118c[_0x67fa('0x20')]==='undefined';var _0x377d59=_0x507ab5[_0x67fa('0x21')];var _0xccb14c=_0x12ef41?0x0:_0x44118c[_0x67fa('0x22')];var _0x3788a2=_0x12ef41?_0x507ab5['count']:_0x44118c[_0x67fa('0x22')]+_0x44118c[_0x67fa('0x20')];var _0xfabc2a;if(_0x3788a2>=_0x377d59){_0x3788a2=_0x377d59;_0xfabc2a=0xc8;}else{_0xfabc2a=0xce;}_0x26483d[_0x67fa('0x1c')](_0xfabc2a);return _0x26483d[_0x67fa('0x23')]('Content-Range',_0xccb14c+'-'+_0x3788a2+'/'+_0x377d59)[_0x67fa('0x1e')](_0x507ab5);}return null;};}function patchUpdates(_0x20ebe0){return function(_0x4242b7){try{jsonpatch[_0x67fa('0x24')](_0x4242b7,_0x20ebe0,!![]);}catch(_0x13f810){return BPromise[_0x67fa('0x25')](_0x13f810);}return _0x4242b7[_0x67fa('0x26')]();};}function saveUpdates(_0x270b0e,_0x2982f1){return function(_0x3863a0){if(_0x3863a0){return _0x3863a0[_0x67fa('0x27')](_0x270b0e)[_0x67fa('0x28')](function(_0x1fae4d){return _0x1fae4d;});}return null;};}function removeEntity(_0xd8d1c5,_0x366bf7){return function(_0x4950e9){if(_0x4950e9){return _0x4950e9[_0x67fa('0x29')]()[_0x67fa('0x28')](function(){_0xd8d1c5['status'](0xcc)[_0x67fa('0x1d')]();});}};}function handleEntityNotFound(_0x5d844b,_0x4999b2){return function(_0x2a47a7){if(!_0x2a47a7){_0x5d844b[_0x67fa('0x1b')](0x194);}return _0x2a47a7;};}function handleError(_0x102661,_0x4c0c98){_0x4c0c98=_0x4c0c98||0x1f4;return function(_0x14a93b){logger[_0x67fa('0x2a')](_0x14a93b[_0x67fa('0x2b')]);if(_0x14a93b['name']){delete _0x14a93b[_0x67fa('0x2c')];}_0x102661[_0x67fa('0x1c')](_0x4c0c98)['send'](_0x14a93b);};}exports[_0x67fa('0x2d')]=function(_0x5f12c4,_0x41a45a){var _0x5afdae={},_0x3f5eb1={},_0xbd2336={'count':0x0,'rows':[]};var _0x3562bd=_[_0x67fa('0x2e')](db[_0x67fa('0x2f')][_0x67fa('0x30')],function(_0x5924e1){return{'name':_0x5924e1[_0x67fa('0x31')],'type':_0x5924e1['type'][_0x67fa('0x32')]};});_0x3f5eb1[_0x67fa('0x33')]=_['map'](_0x3562bd,'name');_0x3f5eb1[_0x67fa('0x34')]=_[_0x67fa('0x35')](_0x5f12c4[_0x67fa('0x34')]);_0x3f5eb1[_0x67fa('0x36')]=_[_0x67fa('0x37')](_0x3f5eb1[_0x67fa('0x33')],_0x3f5eb1[_0x67fa('0x34')]);_0x5afdae['attributes']=_[_0x67fa('0x37')](_0x3f5eb1[_0x67fa('0x33')],qs['fields'](_0x5f12c4[_0x67fa('0x34')][_0x67fa('0x38')]));_0x5afdae[_0x67fa('0x39')]=_0x5afdae['attributes']['length']?_0x5afdae[_0x67fa('0x39')]:_0x3f5eb1['model'];if(!_0x5f12c4[_0x67fa('0x34')][_0x67fa('0x3a')](_0x67fa('0x3b'))){_0x5afdae[_0x67fa('0x20')]=qs[_0x67fa('0x20')](_0x5f12c4[_0x67fa('0x34')]['limit']);_0x5afdae[_0x67fa('0x22')]=qs[_0x67fa('0x22')](_0x5f12c4[_0x67fa('0x34')][_0x67fa('0x22')]);}_0x5afdae[_0x67fa('0x3c')]=qs['sort'](_0x5f12c4[_0x67fa('0x34')][_0x67fa('0x3d')]);_0x5afdae[_0x67fa('0x3e')]=qs[_0x67fa('0x36')](_[_0x67fa('0x3f')](_0x5f12c4[_0x67fa('0x34')],_0x3f5eb1[_0x67fa('0x36')]),_0x3562bd);if(_0x5f12c4[_0x67fa('0x34')][_0x67fa('0x40')]){_0x5afdae[_0x67fa('0x3e')]=_['merge'](_0x5afdae[_0x67fa('0x3e')],{'$or':_['map'](_0x3562bd,function(_0x51d2a4){if(_0x51d2a4['type']!==_0x67fa('0x41')){var _0x34bbaf={};_0x34bbaf[_0x51d2a4[_0x67fa('0x2c')]]={'$like':'%'+_0x5f12c4[_0x67fa('0x34')]['filter']+'%'};return _0x34bbaf;}})});}_0x5afdae=_[_0x67fa('0x42')]({},_0x5afdae,_0x5f12c4['options']);var _0x233aeb={'where':_0x5afdae[_0x67fa('0x3e')]};return db[_0x67fa('0x2f')]['count'](_0x233aeb)['then'](function(_0x4be632){_0xbd2336[_0x67fa('0x21')]=_0x4be632;if(_0x5f12c4[_0x67fa('0x34')][_0x67fa('0x43')]){_0x5afdae[_0x67fa('0x44')]=[{'all':!![]}];}return db['ZohoAccount'][_0x67fa('0x45')](_0x5afdae);})[_0x67fa('0x28')](function(_0x17b6c5){_0xbd2336[_0x67fa('0x46')]=_0x17b6c5;return _0xbd2336;})[_0x67fa('0x28')](respondWithFilteredResult(_0x41a45a,_0x5afdae))[_0x67fa('0x47')](handleError(_0x41a45a,null));};exports[_0x67fa('0x48')]=function(_0x2429f2,_0x576fe8){var _0x3e9daf={'raw':![],'where':{'id':_0x2429f2['params']['id']}},_0x484eee={};_0x484eee[_0x67fa('0x33')]=_['keys'](db[_0x67fa('0x2f')][_0x67fa('0x30')]);_0x484eee[_0x67fa('0x34')]=_[_0x67fa('0x35')](_0x2429f2[_0x67fa('0x34')]);_0x484eee['filters']=_[_0x67fa('0x37')](_0x484eee[_0x67fa('0x33')],_0x484eee[_0x67fa('0x34')]);_0x3e9daf[_0x67fa('0x39')]=_['intersection'](_0x484eee[_0x67fa('0x33')],qs[_0x67fa('0x38')](_0x2429f2[_0x67fa('0x34')][_0x67fa('0x38')]));_0x3e9daf[_0x67fa('0x39')]=_0x3e9daf[_0x67fa('0x39')][_0x67fa('0x49')]?_0x3e9daf[_0x67fa('0x39')]:_0x484eee[_0x67fa('0x33')];if(_0x2429f2[_0x67fa('0x34')]['includeAll']){_0x3e9daf[_0x67fa('0x44')]=[{'all':!![]}];}_0x3e9daf=_['merge']({},_0x3e9daf,_0x2429f2['options']);return db[_0x67fa('0x2f')][_0x67fa('0x4a')](_0x3e9daf)[_0x67fa('0x28')](handleEntityNotFound(_0x576fe8,null))['then'](respondWithResult(_0x576fe8,null))[_0x67fa('0x47')](handleError(_0x576fe8,null));};exports[_0x67fa('0x4b')]=function(_0x3a1780,_0x12d845){return db[_0x67fa('0x2f')]['create'](_0x3a1780[_0x67fa('0x4c')],{})[_0x67fa('0x28')](respondWithResult(_0x12d845,0xc9))['catch'](handleError(_0x12d845,null));};exports['update']=function(_0x43f8dc,_0x26ece){if(_0x43f8dc['body']['id']){delete _0x43f8dc[_0x67fa('0x4c')]['id'];}return db[_0x67fa('0x2f')][_0x67fa('0x4a')]({'where':{'id':_0x43f8dc[_0x67fa('0x4d')]['id']}})[_0x67fa('0x28')](handleEntityNotFound(_0x26ece,null))[_0x67fa('0x28')](saveUpdates(_0x43f8dc[_0x67fa('0x4c')],null))[_0x67fa('0x28')](respondWithResult(_0x26ece,null))['catch'](handleError(_0x26ece,null));};exports['destroy']=function(_0x52a926,_0x25efc){return db[_0x67fa('0x2f')][_0x67fa('0x4a')]({'where':{'id':_0x52a926[_0x67fa('0x4d')]['id']}})[_0x67fa('0x28')](handleEntityNotFound(_0x25efc,null))['then'](removeEntity(_0x25efc,null))[_0x67fa('0x47')](handleError(_0x25efc,null));};exports[_0x67fa('0x4e')]=function(_0x22f2ab,_0x2850cf,_0x304ecd){var _0x223f8a={};var _0x3cf091={};var _0x477517;var _0x9c3029;return db[_0x67fa('0x2f')]['findOne']({'where':{'id':_0x22f2ab[_0x67fa('0x4d')]['id']}})[_0x67fa('0x28')](handleEntityNotFound(_0x2850cf,null))[_0x67fa('0x28')](function(_0x2e402e){if(_0x2e402e){_0x477517=_0x2e402e;_0x3cf091['model']=_[_0x67fa('0x35')](db[_0x67fa('0x4f')][_0x67fa('0x30')]);_0x3cf091['query']=_['keys'](_0x22f2ab['query']);_0x3cf091['filters']=_[_0x67fa('0x37')](_0x3cf091[_0x67fa('0x33')],_0x3cf091[_0x67fa('0x34')]);_0x223f8a[_0x67fa('0x39')]=_[_0x67fa('0x37')](_0x3cf091['model'],qs[_0x67fa('0x38')](_0x22f2ab[_0x67fa('0x34')][_0x67fa('0x38')]));_0x223f8a['attributes']=_0x223f8a[_0x67fa('0x39')][_0x67fa('0x49')]?_0x223f8a[_0x67fa('0x39')]:_0x3cf091['model'];_0x223f8a[_0x67fa('0x3c')]=qs[_0x67fa('0x3d')](_0x22f2ab[_0x67fa('0x34')][_0x67fa('0x3d')]);_0x223f8a[_0x67fa('0x3e')]=qs['filters'](_['pick'](_0x22f2ab['query'],_0x3cf091[_0x67fa('0x36')]));if(_0x22f2ab['query'][_0x67fa('0x40')]){_0x223f8a[_0x67fa('0x3e')]=_[_0x67fa('0x42')](_0x223f8a[_0x67fa('0x3e')],{'$or':_[_0x67fa('0x2e')](_0x223f8a['attributes'],function(_0x4df645){var _0x48fbb5={};_0x48fbb5[_0x4df645]={'$like':'%'+_0x22f2ab[_0x67fa('0x34')][_0x67fa('0x40')]+'%'};return _0x48fbb5;})});}_0x223f8a=_[_0x67fa('0x42')]({},_0x223f8a,_0x22f2ab[_0x67fa('0x50')]);return _0x477517[_0x67fa('0x4e')](_0x223f8a);}})['then'](function(_0x23fe9c){if(_0x23fe9c){_0x9c3029=_0x23fe9c[_0x67fa('0x49')];if(!_0x22f2ab[_0x67fa('0x34')][_0x67fa('0x3a')](_0x67fa('0x3b'))){_0x223f8a['limit']=qs['limit'](_0x22f2ab[_0x67fa('0x34')]['limit']);_0x223f8a[_0x67fa('0x22')]=qs['offset'](_0x22f2ab['query'][_0x67fa('0x22')]);}return _0x477517[_0x67fa('0x4e')](_0x223f8a);}})['then'](function(_0x1e8959){if(_0x1e8959){return _0x1e8959?{'count':_0x9c3029,'rows':_0x1e8959}:null;}})['then'](respondWithResult(_0x2850cf,null))[_0x67fa('0x47')](handleError(_0x2850cf,null));};exports['addConfiguration']=function(_0x2c8ca3,_0x2311e3,_0x2e4862){if(_0x2c8ca3['body']['id']){delete _0x2c8ca3[_0x67fa('0x4c')]['id'];}return db[_0x67fa('0x2f')][_0x67fa('0x51')]({'where':{'id':_0x2c8ca3['params']['id']}})[_0x67fa('0x28')](handleEntityNotFound(_0x2311e3,null))[_0x67fa('0x28')](function(_0x4f541f){if(_0x4f541f){_0x2c8ca3[_0x67fa('0x4c')][_0x67fa('0x52')]=_0x4f541f['id'];_0x2c8ca3[_0x67fa('0x4c')][_0x67fa('0x53')]=integrations[_0x67fa('0x54')](_0x2c8ca3['body'][_0x67fa('0x55')],_0x2c8ca3[_0x67fa('0x4c')][_0x67fa('0x56')]);_0x2c8ca3['body'][_0x67fa('0x57')]=integrations[_0x67fa('0x58')](_0x2c8ca3[_0x67fa('0x4c')][_0x67fa('0x55')],_0x2c8ca3['body'][_0x67fa('0x56')]);return db[_0x67fa('0x4f')][_0x67fa('0x4b')](_0x2c8ca3[_0x67fa('0x4c')],{'include':[{'model':db[_0x67fa('0x59')],'as':_0x67fa('0x53')},{'model':db[_0x67fa('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2311e3,null))[_0x67fa('0x47')](handleError(_0x2311e3,null));};function getAccessToken(_0x9ad314){return new Promise(function(_0x5557b2,_0x4781ea){var _0x4c4c90;switch(_0x9ad314['zone']){case'US':_0x4c4c90=_0x67fa('0x5a');break;case'AU':_0x4c4c90=_0x67fa('0x5b');break;case'EU':_0x4c4c90='https://accounts.zoho.eu';break;case'IN':_0x4c4c90=_0x67fa('0x5c');break;case'CN':_0x4c4c90=_0x67fa('0x5d');break;default:_0x4c4c90='https://accounts.zoho.eu';break;}var _0x225164={'method':'POST','uri':_0x4c4c90+_0x67fa('0x5e'),'qs':{'refresh_token':_0x9ad314[_0x67fa('0x5f')],'client_id':_0x9ad314['clientId'],'client_secret':_0x9ad314[_0x67fa('0x60')],'grant_type':_0x67fa('0x61')},'json':!![]};return rp(_0x225164)[_0x67fa('0x28')](function(_0x489410){if(_0x489410[_0x67fa('0x62')]){_0x5557b2(_0x489410['access_token']);}else{_0x4781ea(_0x67fa('0x63'));}})[_0x67fa('0x47')](function(_0x433a17){_0x4781ea(_0x433a17);});});}exports['getFields']=function(_0x9d3189,_0x4199c8,_0x1dd675){var _0x395c84,_0x46bac3,_0xf6d8d9,_0x4564c5,_0x4f7c98;return db['ZohoAccount'][_0x67fa('0x51')]({'where':{'id':_0x9d3189[_0x67fa('0x4d')]['id']},'attributes':['id',_0x67fa('0x64'),_0x67fa('0x65'),_0x67fa('0x66'),_0x67fa('0x60'),_0x67fa('0x67'),_0x67fa('0x68'),_0x67fa('0x5f')]})[_0x67fa('0x28')](handleEntityNotFound(_0x4199c8,null))[_0x67fa('0x28')](function(_0x1ad477){_0x4f7c98=_0x1ad477;_0x395c84=_0x4f7c98[_0x67fa('0x64')];_0x46bac3=_0x395c84==='zoho.eu'?'eu':_0x67fa('0x69');_0xf6d8d9=_0x4f7c98[_0x67fa('0x67')];var _0xd6decd=_0xf6d8d9[_0x67fa('0x6a')](-0x1);if(_0xd6decd==='/'||_0xd6decd==='\x5c'||_0xd6decd===':'){_0xf6d8d9=_0xf6d8d9[_0x67fa('0x6b')](0x0,_0xf6d8d9[_0x67fa('0x6c')](_0xd6decd));}if(!_0x4f7c98['refreshToken']){throw new Error(_0x67fa('0x6d'));}return getAccessToken(_0x4f7c98);})[_0x67fa('0x28')](function(_0x3430db){if(_0x3430db){return rp({'method':_0x67fa('0x6e'),'uri':util['format'](_0x67fa('0x6f'),_0x46bac3),'qs':{'module':_0x67fa('0x70')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3430db},'json':!![]});}})[_0x67fa('0x28')](function(_0x37b0fb){if(_0x37b0fb){if(_0x37b0fb['response']&&_0x37b0fb[_0x67fa('0x71')][_0x67fa('0x2a')]){throw new Error(_0x37b0fb[_0x67fa('0x71')]['error']['message']);}var _0x20ab57=[];var _0x4be9fc=[];var _0x2f79f6=[_0x67fa('0x72'),'Subject',_0x67fa('0x73'),_0x67fa('0x74'),_0x67fa('0x75'),_0x67fa('0x76'),_0x67fa('0x77'),_0x67fa('0x78')];_0x4be9fc=_['remove'](_0x37b0fb['fields'],function(_0x4826ef){return _0x2f79f6[_0x67fa('0x79')](_0x4826ef['api_name']);});for(var _0x5e6ab2=0x0;_0x5e6ab2<_0x4be9fc[_0x67fa('0x49')];_0x5e6ab2++){if(_0x4be9fc[_0x5e6ab2][_0x67fa('0x7a')]===![]){_0x20ab57[_0x67fa('0x7b')]({'id':_0x4be9fc[_0x5e6ab2]['id'],'name':_0x4be9fc[_0x5e6ab2][_0x67fa('0x7c')],'custom':_0x4be9fc[_0x5e6ab2][_0x67fa('0x7d')],'options':_0x4be9fc[_0x5e6ab2]['data_type']==='picklist'&&_0x4be9fc[_0x5e6ab2]['pick_list_values']['length']>-0x1?_[_0x67fa('0x2e')](_0x4be9fc[_0x5e6ab2][_0x67fa('0x7e')],function(_0x41ad3a){return{'name':_0x41ad3a,'value':_0x41ad3a};}):[]});}}return{'count':_0x20ab57[_0x67fa('0x49')],'rows':_0x20ab57};}else{return{'count':0x0,'rows':[]};}})[_0x67fa('0x28')](respondWithResult(_0x4199c8,null))[_0x67fa('0x47')](function(_0x10de21){var _0x91545f=_0x9d3189['query']['test']?0x1f4:_0x10de21[_0x67fa('0x7f')]||0x1f4;logger['error'](_0x67fa('0x80'),_0x67fa('0x81'),_0x91545f,JSON[_0x67fa('0x82')](_0x10de21));delete _0x10de21[_0x67fa('0x2c')];if(_0x91545f===0x191){_0x91545f=0x190;}_0x4199c8[_0x67fa('0x1c')](_0x91545f)[_0x67fa('0x83')](_0x9d3189[_0x67fa('0x34')][_0x67fa('0x84')]?{'message':'Wrong\x20credentials','statusCode':_0x10de21['statusCode']}:_0x10de21);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f7209e1..1ab2abd 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 _0x3f14=['catch','application/x-www-form-urlencoded','inspect','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refresh_token','refreshToken','info','format','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'];(function(_0x51b8f3,_0x289e3d){var _0x496bec=function(_0x22a913){while(--_0x22a913){_0x51b8f3['push'](_0x51b8f3['shift']());}};_0x496bec(++_0x289e3d);}(_0x3f14,0x163));var _0x43f1=function(_0x44b3fb,_0x5997aa){_0x44b3fb=_0x44b3fb-0x0;var _0xb755da=_0x3f14[_0x44b3fb];return _0xb755da;};'use strict';var _=require(_0x43f1('0x0'));var util=require('util');var logger=require(_0x43f1('0x1'))(_0x43f1('0x2'));var moment=require(_0x43f1('0x3'));var BPromise=require(_0x43f1('0x4'));var rp=require(_0x43f1('0x5'));var fs=require('fs');var path=require(_0x43f1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x43f1('0x7'));var integrations=require(_0x43f1('0x8'));module[_0x43f1('0x9')]=function(_0x4a0abf,_0x347cee){return _0x4a0abf[_0x43f1('0xa')](_0x43f1('0xb'),attributes,{'tableName':_0x43f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x235813,_0x4976e5,_0x51a110){if(_0x235813[_0x43f1('0xd')](_0x43f1('0xe'))||_0x235813[_0x43f1('0xd')](_0x43f1('0xf'))||_0x235813['changed'](_0x43f1('0x10'))||_0x235813['changed'](_0x43f1('0x11'))||_0x235813[_0x43f1('0xd')](_0x43f1('0x12'))||_0x235813['changed'](_0x43f1('0x13'))){var _0x41ebb4,_0x2f8f5b;_0x41ebb4=_0x235813[_0x43f1('0xf')];var _0x100b63=_0x41ebb4[_0x43f1('0x14')](-0x1);if(_0x100b63==='/'||_0x100b63==='\x5c'||_0x100b63===':'){_0x41ebb4=_0x41ebb4[_0x43f1('0x15')](0x0,_0x41ebb4[_0x43f1('0x16')](_0x100b63));}switch(_0x235813['zone']){case'US':_0x2f8f5b=_0x43f1('0x17');break;case'AU':_0x2f8f5b=_0x43f1('0x18');break;case'IN':_0x2f8f5b=_0x43f1('0x19');break;case'CN':_0x2f8f5b=_0x43f1('0x1a');break;default:_0x2f8f5b=_0x43f1('0x1b');break;}var _0x4875ac={'method':_0x43f1('0x1c'),'uri':_0x2f8f5b+_0x43f1('0x1d'),'form':{'grant_type':_0x43f1('0x1e'),'client_id':_0x235813[_0x43f1('0x10')],'client_secret':_0x235813['clientSecret'],'redirect_uri':_0x235813['serverUrl'],'code':_0x235813[_0x43f1('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4875ac)[_0x43f1('0x1f')](function(_0xc4dd6){var _0x23790e=JSON[_0x43f1('0x20')](_0xc4dd6);if(_0x23790e[_0x43f1('0x21')]){_0x235813[_0x43f1('0x22')]=_0x23790e[_0x43f1('0x21')];logger[_0x43f1('0x23')](util[_0x43f1('0x24')](_0x43f1('0x25'),_0x235813[_0x43f1('0x26')],_0x235813['id']));}else{logger[_0x43f1('0x27')](util[_0x43f1('0x24')](_0x43f1('0x28'),_0x235813[_0x43f1('0x26')],_0x235813['id']),util['inspect'](_0x23790e,{'showHidden':![],'depth':null}));}return _0x51a110(null,_0x4976e5);})[_0x43f1('0x29')](function(_0x59674a){logger[_0x43f1('0x27')](util[_0x43f1('0x24')](_0x43f1('0x28'),_0x235813[_0x43f1('0x26')],_0x235813['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x51a110(_0x59674a);});}else{return _0x51a110(null,_0x4976e5);}},'beforeUpdate':function(_0x14f79a,_0x148641,_0x367a6c){if(_0x14f79a[_0x43f1('0xd')](_0x43f1('0xe'))||_0x14f79a[_0x43f1('0xd')](_0x43f1('0xf'))||_0x14f79a[_0x43f1('0xd')](_0x43f1('0x10'))||_0x14f79a[_0x43f1('0xd')]('clientSecret')||_0x14f79a[_0x43f1('0xd')](_0x43f1('0x12'))||_0x14f79a[_0x43f1('0xd')](_0x43f1('0x13'))){var _0x13fae2,_0x54cd1e;_0x13fae2=_0x14f79a[_0x43f1('0xf')];var _0x47d84e=_0x13fae2['slice'](-0x1);if(_0x47d84e==='/'||_0x47d84e==='\x5c'||_0x47d84e===':'){_0x13fae2=_0x13fae2[_0x43f1('0x15')](0x0,_0x13fae2[_0x43f1('0x16')](_0x47d84e));}switch(_0x14f79a['zone']){case'US':_0x54cd1e=_0x43f1('0x17');break;case'AU':_0x54cd1e=_0x43f1('0x18');break;case'IN':_0x54cd1e=_0x43f1('0x19');break;case'CN':_0x54cd1e=_0x43f1('0x1a');break;default:_0x54cd1e=_0x43f1('0x1b');break;}var _0x40643e={'method':_0x43f1('0x1c'),'uri':_0x54cd1e+_0x43f1('0x1d'),'form':{'grant_type':_0x43f1('0x1e'),'client_id':_0x14f79a['clientId'],'client_secret':_0x14f79a[_0x43f1('0x11')],'redirect_uri':_0x14f79a[_0x43f1('0xf')],'code':_0x14f79a['code']},'headers':{'Content-Type':_0x43f1('0x2a')}};return rp(_0x40643e)[_0x43f1('0x1f')](function(_0x3553fd){var _0x295c17=JSON['parse'](_0x3553fd);if(_0x295c17['refresh_token']){_0x14f79a[_0x43f1('0x22')]=_0x295c17[_0x43f1('0x21')];logger['info'](util['format'](_0x43f1('0x25'),_0x14f79a['name'],_0x14f79a['id']));}else{logger[_0x43f1('0x27')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x14f79a[_0x43f1('0x26')],_0x14f79a['id']),util['inspect'](_0x295c17,{'showHidden':![],'depth':null}));}return _0x367a6c(null,_0x148641);})[_0x43f1('0x29')](function(_0x1a65b){logger['error'](util[_0x43f1('0x24')](_0x43f1('0x28'),_0x14f79a['name'],_0x14f79a['id']),util[_0x43f1('0x2b')](parsedResult,{'showHidden':![],'depth':null}));return _0x367a6c(_0x1a65b);});}else{return _0x367a6c(null,_0x148641);}}}});}; \ No newline at end of file +var _0x99a9=['../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','host','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','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','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','application/x-www-form-urlencoded','parse','lodash','util'];(function(_0x2e7087,_0x112eec){var _0xb5b3a6=function(_0x296310){while(--_0x296310){_0x2e7087['push'](_0x2e7087['shift']());}};_0xb5b3a6(++_0x112eec);}(_0x99a9,0x1e2));var _0x999a=function(_0xc80e09,_0x56c83a){_0xc80e09=_0xc80e09-0x0;var _0x27258a=_0x99a9[_0xc80e09];return _0x27258a;};'use strict';var _=require(_0x999a('0x0'));var util=require(_0x999a('0x1'));var logger=require(_0x999a('0x2'))(_0x999a('0x3'));var moment=require(_0x999a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x999a('0x5'));var rimraf=require(_0x999a('0x6'));var config=require(_0x999a('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x999a('0x8'));module[_0x999a('0x9')]=function(_0x2b337f,_0x1fe9c7){return _0x2b337f[_0x999a('0xa')](_0x999a('0xb'),attributes,{'tableName':_0x999a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53b020,_0x1cf2a5,_0x2690e8){if(_0x53b020['changed'](_0x999a('0xd'))||_0x53b020[_0x999a('0xe')](_0x999a('0xf'))||_0x53b020[_0x999a('0xe')](_0x999a('0x10'))||_0x53b020[_0x999a('0xe')](_0x999a('0x11'))||_0x53b020[_0x999a('0xe')](_0x999a('0x12'))||_0x53b020['changed'](_0x999a('0x13'))){var _0x212c6e,_0x54176d;_0x212c6e=_0x53b020[_0x999a('0xf')];var _0x59d12c=_0x212c6e['slice'](-0x1);if(_0x59d12c==='/'||_0x59d12c==='\x5c'||_0x59d12c===':'){_0x212c6e=_0x212c6e['substring'](0x0,_0x212c6e[_0x999a('0x14')](_0x59d12c));}switch(_0x53b020['zone']){case'US':_0x54176d=_0x999a('0x15');break;case'AU':_0x54176d='https://accounts.zoho.com.au';break;case'IN':_0x54176d=_0x999a('0x16');break;case'CN':_0x54176d='https://accounts.zoho.com.cn';break;default:_0x54176d=_0x999a('0x17');break;}var _0x1277d3={'method':_0x999a('0x18'),'uri':_0x54176d+_0x999a('0x19'),'form':{'grant_type':_0x999a('0x1a'),'client_id':_0x53b020[_0x999a('0x10')],'client_secret':_0x53b020['clientSecret'],'redirect_uri':_0x53b020[_0x999a('0xf')],'code':_0x53b020[_0x999a('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1277d3)[_0x999a('0x1b')](function(_0x2d5d0a){var _0x2f6d22=JSON['parse'](_0x2d5d0a);if(_0x2f6d22[_0x999a('0x1c')]){_0x53b020[_0x999a('0x1d')]=_0x2f6d22[_0x999a('0x1c')];logger[_0x999a('0x1e')](util[_0x999a('0x1f')](_0x999a('0x20'),_0x53b020[_0x999a('0x21')],_0x53b020['id']));}else{logger[_0x999a('0x22')](util[_0x999a('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x53b020[_0x999a('0x21')],_0x53b020['id']),util[_0x999a('0x23')](_0x2f6d22,{'showHidden':![],'depth':null}));}return _0x2690e8(null,_0x1cf2a5);})[_0x999a('0x24')](function(_0x50207d){logger[_0x999a('0x22')](util['format'](_0x999a('0x25'),_0x53b020[_0x999a('0x21')],_0x53b020['id']),util[_0x999a('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x2690e8(_0x50207d);});}else{return _0x2690e8(null,_0x1cf2a5);}},'beforeUpdate':function(_0x1ec2b9,_0x67b816,_0x2f3265){if(_0x1ec2b9[_0x999a('0xe')]('zone')||_0x1ec2b9[_0x999a('0xe')](_0x999a('0xf'))||_0x1ec2b9[_0x999a('0xe')]('clientId')||_0x1ec2b9['changed'](_0x999a('0x11'))||_0x1ec2b9[_0x999a('0xe')](_0x999a('0x12'))||_0x1ec2b9[_0x999a('0xe')](_0x999a('0x13'))){var _0x5a3f6d,_0x42e6ab;_0x5a3f6d=_0x1ec2b9[_0x999a('0xf')];var _0x4975cd=_0x5a3f6d[_0x999a('0x26')](-0x1);if(_0x4975cd==='/'||_0x4975cd==='\x5c'||_0x4975cd===':'){_0x5a3f6d=_0x5a3f6d[_0x999a('0x27')](0x0,_0x5a3f6d[_0x999a('0x14')](_0x4975cd));}switch(_0x1ec2b9['zone']){case'US':_0x42e6ab=_0x999a('0x15');break;case'AU':_0x42e6ab=_0x999a('0x28');break;case'IN':_0x42e6ab=_0x999a('0x16');break;case'CN':_0x42e6ab=_0x999a('0x29');break;default:_0x42e6ab=_0x999a('0x17');break;}var _0xf29fda={'method':_0x999a('0x18'),'uri':_0x42e6ab+_0x999a('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x1ec2b9['clientId'],'client_secret':_0x1ec2b9[_0x999a('0x11')],'redirect_uri':_0x1ec2b9[_0x999a('0xf')],'code':_0x1ec2b9[_0x999a('0x12')]},'headers':{'Content-Type':_0x999a('0x2a')}};return rp(_0xf29fda)[_0x999a('0x1b')](function(_0x534eef){var _0x17b92e=JSON[_0x999a('0x2b')](_0x534eef);if(_0x17b92e['refresh_token']){_0x1ec2b9[_0x999a('0x1d')]=_0x17b92e[_0x999a('0x1c')];logger['info'](util['format'](_0x999a('0x20'),_0x1ec2b9['name'],_0x1ec2b9['id']));}else{logger[_0x999a('0x22')](util[_0x999a('0x1f')](_0x999a('0x25'),_0x1ec2b9[_0x999a('0x21')],_0x1ec2b9['id']),util[_0x999a('0x23')](_0x17b92e,{'showHidden':![],'depth':null}));}return _0x2f3265(null,_0x67b816);})[_0x999a('0x24')](function(_0x5dc2a0){logger[_0x999a('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1ec2b9[_0x999a('0x21')],_0x1ec2b9['id']),util[_0x999a('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x2f3265(_0x5dc2a0);});}else{return _0x2f3265(null,_0x67b816);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 243f29a..1a24d0d 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 _0x3423=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','stringify','error','code','message','info','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowZohoAccount','find','debug','moment','bluebird','randomstring','ioredis'];(function(_0x3ef44d,_0x152cf0){var _0x37cd6=function(_0x3d32a1){while(--_0x3d32a1){_0x3ef44d['push'](_0x3ef44d['shift']());}};_0x37cd6(++_0x152cf0);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c40c,_0x420d4b,_0x76422d){return new BPromise(function(_0xce08ab,_0x305d13){return client[_0x3342('0xc')](_0x29c40c,_0x76422d)[_0x3342('0xd')](function(_0x4ae4f3){logger['info'](_0x3342('0xe'),_0x420d4b,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x420d4b,'request\x20sent',JSON[_0x3342('0xf')](_0x4ae4f3));if(_0x4ae4f3[_0x3342('0x10')]){if(_0x4ae4f3['error'][_0x3342('0x11')]===0x1f4){logger['error'](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')]['message']);return _0x305d13(_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);}logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);return _0xce08ab(_0x4ae4f3[_0x3342('0x10')]['message']);}else{logger[_0x3342('0x13')](_0x3342('0xe'),_0x420d4b,'request\x20sent');_0xce08ab(_0x4ae4f3[_0x3342('0x14')][_0x3342('0x12')]);}})['catch'](function(_0x554f9c){logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x554f9c);_0x305d13(_0x554f9c);});});}exports[_0x3342('0x15')]=function(_0x2075cb){var _0x12947a=this;return new Promise(function(_0x156c24,_0x45a3ca){return db[_0x3342('0x16')][_0x3342('0x17')]({'raw':_0x2075cb['options']?_0x2075cb[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1a')]||null:null,'attributes':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1b')]||null:null,'limit':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1c')]||null:null,'include':_0x2075cb['options']?_0x2075cb[_0x3342('0x18')][_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x2075cb[_0x3342('0x18')][_0x3342('0x1d')],function(_0x2925a2){return{'model':db[_0x2925a2[_0x3342('0x1f')]],'as':_0x2925a2['as'],'attributes':_0x2925a2[_0x3342('0x1b')],'include':_0x2925a2['include']?_[_0x3342('0x1e')](_0x2925a2['include'],function(_0x51cf45){return{'model':db[_0x51cf45[_0x3342('0x1f')]],'as':_0x51cf45['as'],'attributes':_0x51cf45['attributes'],'include':_0x51cf45['include']?_[_0x3342('0x1e')](_0x51cf45['include'],function(_0x37df78){return{'model':db[_0x37df78['model']],'as':_0x37df78['as'],'attributes':_0x37df78['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1497d9){logger[_0x3342('0x13')](_0x3342('0x15'),_0x2075cb);logger['debug'](_0x3342('0x15'),_0x2075cb,JSON[_0x3342('0xf')](_0x1497d9));_0x156c24(_0x1497d9);})[_0x3342('0x20')](function(_0x272a52){logger['error'](_0x3342('0x15'),_0x272a52[_0x3342('0x12')],_0x2075cb);_0x45a3ca(_0x12947a[_0x3342('0x10')](0x1f4,_0x272a52[_0x3342('0x12')]));});});};exports[_0x3342('0x21')]=function(_0x2cc691){var _0x135760=this;return new Promise(function(_0x47b2a0,_0x2e0bde){return db['ZohoAccount'][_0x3342('0x22')]({'raw':_0x2cc691[_0x3342('0x18')]?_0x2cc691['options'][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x2cc691[_0x3342('0x18')]?_0x2cc691[_0x3342('0x18')][_0x3342('0x1a')]||null:null,'attributes':_0x2cc691['options']?_0x2cc691[_0x3342('0x18')][_0x3342('0x1b')]||null:null,'include':_0x2cc691[_0x3342('0x18')]?_0x2cc691[_0x3342('0x18')][_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x2cc691[_0x3342('0x18')][_0x3342('0x1d')],function(_0x2531fb){return{'model':db[_0x2531fb[_0x3342('0x1f')]],'as':_0x2531fb['as'],'attributes':_0x2531fb[_0x3342('0x1b')],'include':_0x2531fb[_0x3342('0x1d')]?_['map'](_0x2531fb['include'],function(_0x1dc9b3){return{'model':db[_0x1dc9b3['model']],'as':_0x1dc9b3['as'],'attributes':_0x1dc9b3[_0x3342('0x1b')],'include':_0x1dc9b3[_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x1dc9b3[_0x3342('0x1d')],function(_0x2dbc02){return{'model':db[_0x2dbc02[_0x3342('0x1f')]],'as':_0x2dbc02['as'],'attributes':_0x2dbc02[_0x3342('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4754d9){logger[_0x3342('0x13')](_0x3342('0x21'),_0x2cc691);logger[_0x3342('0x23')](_0x3342('0x21'),_0x2cc691,JSON['stringify'](_0x4754d9));_0x47b2a0(_0x4754d9);})[_0x3342('0x20')](function(_0x4d1a59){logger[_0x3342('0x10')](_0x3342('0x21'),_0x4d1a59[_0x3342('0x12')],_0x2cc691);_0x2e0bde(_0x135760[_0x3342('0x10')](0x1f4,_0x4d1a59['message']));});});}; \ No newline at end of file +var _0xad5f=['rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZohoAccount','findAll','options','attributes','limit','map','include','model','ShowZohoAccount','ZohoAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xad5f,0x1a8));var _0xfad5=function(_0x4ed786,_0x74f270){_0x4ed786=_0x4ed786-0x0;var _0x2f0243=_0xad5f[_0x4ed786];return _0x2f0243;};'use strict';var _=require(_0xfad5('0x0'));var util=require(_0xfad5('0x1'));var moment=require(_0xfad5('0x2'));var BPromise=require(_0xfad5('0x3'));var rs=require(_0xfad5('0x4'));var fs=require('fs');var Redis=require(_0xfad5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfad5('0x6'));var logger=require(_0xfad5('0x7'))(_0xfad5('0x8'));var config=require(_0xfad5('0x9'));var jayson=require(_0xfad5('0xa'));var client=jayson[_0xfad5('0xb')][_0xfad5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5811f7,_0xf71084,_0x28566c){return new BPromise(function(_0x39d228,_0xbe8f56){return client['request'](_0x5811f7,_0x28566c)[_0xfad5('0xd')](function(_0xac127d){logger[_0xfad5('0xe')](_0xfad5('0xf'),_0xf71084,_0xfad5('0x10'));logger[_0xfad5('0x11')](_0xfad5('0x12'),_0xf71084,'request\x20sent',JSON[_0xfad5('0x13')](_0xac127d));if(_0xac127d[_0xfad5('0x14')]){if(_0xac127d[_0xfad5('0x14')]['code']===0x1f4){logger['error'](_0xfad5('0xf'),_0xf71084,_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);return _0xbe8f56(_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);}logger['error'](_0xfad5('0xf'),_0xf71084,_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);return _0x39d228(_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);}else{logger[_0xfad5('0xe')](_0xfad5('0xf'),_0xf71084,'request\x20sent');_0x39d228(_0xac127d['result'][_0xfad5('0x15')]);}})[_0xfad5('0x16')](function(_0x311e75){logger[_0xfad5('0x14')](_0xfad5('0xf'),_0xf71084,_0x311e75);_0xbe8f56(_0x311e75);});});}exports[_0xfad5('0x17')]=function(_0x10ae77){var _0x2fc3ed=this;return new Promise(function(_0x259766,_0x558590){return db['ZohoAccount'][_0xfad5('0x18')]({'raw':_0x10ae77[_0xfad5('0x19')]?_0x10ae77['options']['raw']===undefined?!![]:![]:!![],'where':_0x10ae77[_0xfad5('0x19')]?_0x10ae77[_0xfad5('0x19')]['where']||null:null,'attributes':_0x10ae77['options']?_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1a')]||null:null,'limit':_0x10ae77[_0xfad5('0x19')]?_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1b')]||null:null,'include':_0x10ae77['options']?_0x10ae77[_0xfad5('0x19')]['include']?_[_0xfad5('0x1c')](_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1d')],function(_0x16e903){return{'model':db[_0x16e903[_0xfad5('0x1e')]],'as':_0x16e903['as'],'attributes':_0x16e903[_0xfad5('0x1a')],'include':_0x16e903[_0xfad5('0x1d')]?_[_0xfad5('0x1c')](_0x16e903[_0xfad5('0x1d')],function(_0x45c149){return{'model':db[_0x45c149[_0xfad5('0x1e')]],'as':_0x45c149['as'],'attributes':_0x45c149['attributes'],'include':_0x45c149[_0xfad5('0x1d')]?_[_0xfad5('0x1c')](_0x45c149[_0xfad5('0x1d')],function(_0xc772e6){return{'model':db[_0xc772e6[_0xfad5('0x1e')]],'as':_0xc772e6['as'],'attributes':_0xc772e6['attributes']};}):[]};}):[]};}):[]:[]})[_0xfad5('0xd')](function(_0x3d9d95){logger[_0xfad5('0xe')]('GetZohoAccount',_0x10ae77);logger[_0xfad5('0x11')]('GetZohoAccount',_0x10ae77,JSON[_0xfad5('0x13')](_0x3d9d95));_0x259766(_0x3d9d95);})[_0xfad5('0x16')](function(_0x30ce5b){logger['error'](_0xfad5('0x17'),_0x30ce5b['message'],_0x10ae77);_0x558590(_0x2fc3ed['error'](0x1f4,_0x30ce5b['message']));});});};exports[_0xfad5('0x1f')]=function(_0x1f5329){var _0x3c3f0f=this;return new Promise(function(_0x1133fd,_0x1e789a){return db[_0xfad5('0x20')][_0xfad5('0x21')]({'raw':_0x1f5329[_0xfad5('0x19')]?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x22')]===undefined?!![]:![]:!![],'where':_0x1f5329['options']?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x23')]||null:null,'attributes':_0x1f5329[_0xfad5('0x19')]?_0x1f5329['options'][_0xfad5('0x1a')]||null:null,'include':_0x1f5329[_0xfad5('0x19')]?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x1d')]?_['map'](_0x1f5329[_0xfad5('0x19')][_0xfad5('0x1d')],function(_0x147aa6){return{'model':db[_0x147aa6[_0xfad5('0x1e')]],'as':_0x147aa6['as'],'attributes':_0x147aa6[_0xfad5('0x1a')],'include':_0x147aa6['include']?_[_0xfad5('0x1c')](_0x147aa6[_0xfad5('0x1d')],function(_0x37fff5){return{'model':db[_0x37fff5['model']],'as':_0x37fff5['as'],'attributes':_0x37fff5[_0xfad5('0x1a')],'include':_0x37fff5[_0xfad5('0x1d')]?_['map'](_0x37fff5['include'],function(_0x334b10){return{'model':db[_0x334b10[_0xfad5('0x1e')]],'as':_0x334b10['as'],'attributes':_0x334b10[_0xfad5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfad5('0xd')](function(_0x232192){logger[_0xfad5('0xe')](_0xfad5('0x1f'),_0x1f5329);logger['debug'](_0xfad5('0x1f'),_0x1f5329,JSON[_0xfad5('0x13')](_0x232192));_0x1133fd(_0x232192);})[_0xfad5('0x16')](function(_0x3aa0e2){logger[_0xfad5('0x14')]('ShowZohoAccount',_0x3aa0e2[_0xfad5('0x15')],_0x1f5329);_0x1e789a(_0x3c3f0f[_0xfad5('0x14')](0x1f4,_0x3aa0e2['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 19df9bb..f992da0 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 _0x5781=['../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2bc131,_0x524fbb){var _0x49862c=function(_0x57593b){while(--_0x57593b){_0x2bc131['push'](_0x2bc131['shift']());}};_0x49862c(++_0x524fbb);}(_0x5781,0x13b));var _0x1578=function(_0x5658d3,_0xa3510){_0x5658d3=_0x5658d3-0x0;var _0x1f7ece=_0x5781[_0x5658d3];return _0x1f7ece;};'use strict';var multer=require(_0x1578('0x0'));var util=require(_0x1578('0x1'));var path=require(_0x1578('0x2'));var timeout=require(_0x1578('0x3'));var express=require(_0x1578('0x4'));var router=express[_0x1578('0x5')]();var fs_extra=require(_0x1578('0x6'));var auth=require(_0x1578('0x7'));var interaction=require(_0x1578('0x8'));var config=require('../../config/environment');var controller=require(_0x1578('0x9'));router[_0x1578('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1578('0xa')](_0x1578('0xb'),auth[_0x1578('0xc')](),controller[_0x1578('0xd')]);router[_0x1578('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1578('0xe')]);router[_0x1578('0xa')](_0x1578('0xf'),auth['isAuthenticated'](),controller[_0x1578('0x10')]);router[_0x1578('0xa')]('/:id/descriptions',auth[_0x1578('0xc')](),controller[_0x1578('0x11')]);router[_0x1578('0x12')]('/',auth['isAuthenticated'](),controller[_0x1578('0x13')]);router[_0x1578('0x14')](_0x1578('0xb'),auth[_0x1578('0xc')](),controller['update']);router['delete'](_0x1578('0xb'),auth[_0x1578('0xc')](),controller[_0x1578('0x15')]);module[_0x1578('0x16')]=router; \ No newline at end of file +var _0x502b=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x2ea7ee,_0x3ce8eb){var _0x1e73b6=function(_0x17fb03){while(--_0x17fb03){_0x2ea7ee['push'](_0x2ea7ee['shift']());}};_0x1e73b6(++_0x3ce8eb);}(_0x502b,0x157));var _0xb502=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x502b[_0x40df5f];return _0x1573f1;};'use strict';var multer=require(_0xb502('0x0'));var util=require(_0xb502('0x1'));var path=require(_0xb502('0x2'));var timeout=require(_0xb502('0x3'));var express=require(_0xb502('0x4'));var router=express[_0xb502('0x5')]();var fs_extra=require(_0xb502('0x6'));var auth=require(_0xb502('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb502('0x8'));var controller=require(_0xb502('0x9'));router[_0xb502('0xa')]('/',auth[_0xb502('0xb')](),controller[_0xb502('0xc')]);router[_0xb502('0xa')](_0xb502('0xd'),auth['isAuthenticated'](),controller[_0xb502('0xe')]);router['get'](_0xb502('0xf'),auth[_0xb502('0xb')](),controller['getFields']);router[_0xb502('0xa')](_0xb502('0x10'),auth[_0xb502('0xb')](),controller[_0xb502('0x11')]);router[_0xb502('0xa')](_0xb502('0x12'),auth['isAuthenticated'](),controller[_0xb502('0x13')]);router[_0xb502('0x14')]('/',auth['isAuthenticated'](),controller[_0xb502('0x15')]);router[_0xb502('0x16')](_0xb502('0xd'),auth['isAuthenticated'](),controller[_0xb502('0x17')]);router[_0xb502('0x18')](_0xb502('0xd'),auth['isAuthenticated'](),controller[_0xb502('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index d3ff377..7da5243 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 _0x8e69=['contact_lead','sequelize','exports','STRING','lead','contact','nothing','ENUM'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x8e69,0x1d9));var _0x98e6=function(_0x3790b1,_0x479c76){_0x3790b1=_0x3790b1-0x0;var _0xa28e9f=_0x8e69[_0x3790b1];return _0xa28e9f;};'use strict';var Sequelize=require(_0x98e6('0x0'));module[_0x98e6('0x1')]={'name':{'type':Sequelize[_0x98e6('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x98e6('0x3'),_0x98e6('0x4'),_0x98e6('0x5')),'defaultValue':_0x98e6('0x3')},'moduleSearch':{'type':Sequelize[_0x98e6('0x6')](_0x98e6('0x7'),_0x98e6('0x4'),_0x98e6('0x3')),'defaultValue':_0x98e6('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x786f=['contact_lead','STRING','sequelize','exports','ENUM','lead'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x786f,0xc8));var _0xf786=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x786f[_0x1ae491];return _0x4958a5;};'use strict';var Sequelize=require(_0xf786('0x0'));module[_0xf786('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xf786('0x2')](_0xf786('0x3'),'contact','nothing'),'defaultValue':_0xf786('0x3')},'moduleSearch':{'type':Sequelize[_0xf786('0x2')](_0xf786('0x4'),'contact',_0xf786('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xf786('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index e3b8c22..6fc823b 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 _0x3548=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','ZohoConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x53b93b,_0x1bfab1){var _0x485761=function(_0x41592e){while(--_0x41592e){_0x53b93b['push'](_0x53b93b['shift']());}};_0x485761(++_0x1bfab1);}(_0x3548,0x12a));var _0x8354=function(_0xff44cb,_0x1ca3c6){_0xff44cb=_0xff44cb-0x0;var _0x117fc0=_0x3548[_0xff44cb];return _0x117fc0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8354('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8354('0x1'));var rp=require(_0x8354('0x2'));var moment=require(_0x8354('0x3'));var BPromise=require(_0x8354('0x4'));var Mustache=require(_0x8354('0x5'));var util=require(_0x8354('0x6'));var path=require('path');var sox=require(_0x8354('0x7'));var csv=require('to-csv');var ejs=require(_0x8354('0x8'));var fs=require('fs');var fs_extra=require(_0x8354('0x9'));var _=require(_0x8354('0xa'));var squel=require(_0x8354('0xb'));var crypto=require(_0x8354('0xc'));var jsforce=require(_0x8354('0xd'));var deskjs=require(_0x8354('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8354('0xf'));var Papa=require('papaparse');var Redis=require(_0x8354('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8354('0x11'));var as=require(_0x8354('0x12'));var hardwareService=require(_0x8354('0x13'));var logger=require(_0x8354('0x14'))(_0x8354('0x15'));var utils=require(_0x8354('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8354('0x17'));var db=require(_0x8354('0x18'))['db'];function respondWithStatusCode(_0x2aac43,_0x3356a6){_0x3356a6=_0x3356a6||0xcc;return function(_0x28de7a){if(_0x28de7a){return _0x2aac43[_0x8354('0x19')](_0x3356a6);}return _0x2aac43[_0x8354('0x1a')](_0x3356a6)[_0x8354('0x1b')]();};}function respondWithResult(_0x114c44,_0xe1c912){_0xe1c912=_0xe1c912||0xc8;return function(_0x3b4ef6){if(_0x3b4ef6){return _0x114c44[_0x8354('0x1a')](_0xe1c912)[_0x8354('0x1c')](_0x3b4ef6);}};}function respondWithFilteredResult(_0x487ab4,_0x508a02){return function(_0x562cc8){if(_0x562cc8){var _0x4aa8be=typeof _0x508a02[_0x8354('0x1d')]==='undefined'&&typeof _0x508a02['limit']===_0x8354('0x1e');var _0x96ca06=_0x562cc8[_0x8354('0x1f')];var _0xcca59a=_0x4aa8be?0x0:_0x508a02[_0x8354('0x1d')];var _0x19cf3c=_0x4aa8be?_0x562cc8['count']:_0x508a02['offset']+_0x508a02[_0x8354('0x20')];var _0x171d77;if(_0x19cf3c>=_0x96ca06){_0x19cf3c=_0x96ca06;_0x171d77=0xc8;}else{_0x171d77=0xce;}_0x487ab4[_0x8354('0x1a')](_0x171d77);return _0x487ab4[_0x8354('0x21')](_0x8354('0x22'),_0xcca59a+'-'+_0x19cf3c+'/'+_0x96ca06)['json'](_0x562cc8);}return null;};}function patchUpdates(_0x23b4e7){return function(_0xc0c019){try{jsonpatch[_0x8354('0x23')](_0xc0c019,_0x23b4e7,!![]);}catch(_0x8ea3a3){return BPromise[_0x8354('0x24')](_0x8ea3a3);}return _0xc0c019['save']();};}function saveUpdates(_0xe771ff,_0x3fd466){return function(_0x40939e){if(_0x40939e){return _0x40939e[_0x8354('0x25')](_0xe771ff)[_0x8354('0x26')](function(_0x23274c){return _0x23274c;});}return null;};}function removeEntity(_0x23f363,_0x598f1d){return function(_0x4d6cb5){if(_0x4d6cb5){return _0x4d6cb5[_0x8354('0x27')]()[_0x8354('0x26')](function(){_0x23f363[_0x8354('0x1a')](0xcc)[_0x8354('0x1b')]();});}};}function handleEntityNotFound(_0x412ec5,_0x3f155e){return function(_0x546b93){if(!_0x546b93){_0x412ec5[_0x8354('0x19')](0x194);}return _0x546b93;};}function handleError(_0x25cd9e,_0x24268c){_0x24268c=_0x24268c||0x1f4;return function(_0x3e3c22){logger['error'](_0x3e3c22[_0x8354('0x28')]);if(_0x3e3c22[_0x8354('0x29')]){delete _0x3e3c22['name'];}_0x25cd9e[_0x8354('0x1a')](_0x24268c)[_0x8354('0x2a')](_0x3e3c22);};}exports['index']=function(_0x49025a,_0xdb4228){var _0x41f822={},_0x5b0734={},_0x45057d={'count':0x0,'rows':[]};var _0xced6b0=_['map'](db[_0x8354('0x2b')][_0x8354('0x2c')],function(_0x3fa897){return{'name':_0x3fa897[_0x8354('0x2d')],'type':_0x3fa897[_0x8354('0x2e')]['key']};});_0x5b0734[_0x8354('0x2f')]=_[_0x8354('0x30')](_0xced6b0,_0x8354('0x29'));_0x5b0734[_0x8354('0x31')]=_[_0x8354('0x32')](_0x49025a[_0x8354('0x31')]);_0x5b0734[_0x8354('0x33')]=_[_0x8354('0x34')](_0x5b0734[_0x8354('0x2f')],_0x5b0734[_0x8354('0x31')]);_0x41f822[_0x8354('0x35')]=_[_0x8354('0x34')](_0x5b0734['model'],qs[_0x8354('0x36')](_0x49025a[_0x8354('0x31')][_0x8354('0x36')]));_0x41f822[_0x8354('0x35')]=_0x41f822[_0x8354('0x35')][_0x8354('0x37')]?_0x41f822[_0x8354('0x35')]:_0x5b0734['model'];if(!_0x49025a[_0x8354('0x31')][_0x8354('0x38')](_0x8354('0x39'))){_0x41f822[_0x8354('0x20')]=qs[_0x8354('0x20')](_0x49025a[_0x8354('0x31')]['limit']);_0x41f822[_0x8354('0x1d')]=qs['offset'](_0x49025a[_0x8354('0x31')][_0x8354('0x1d')]);}_0x41f822[_0x8354('0x3a')]=qs['sort'](_0x49025a[_0x8354('0x31')][_0x8354('0x3b')]);_0x41f822[_0x8354('0x3c')]=qs[_0x8354('0x33')](_['pick'](_0x49025a[_0x8354('0x31')],_0x5b0734['filters']),_0xced6b0);if(_0x49025a[_0x8354('0x31')][_0x8354('0x3d')]){_0x41f822[_0x8354('0x3c')]=_[_0x8354('0x3e')](_0x41f822[_0x8354('0x3c')],{'$or':_[_0x8354('0x30')](_0xced6b0,function(_0x486ba1){if(_0x486ba1[_0x8354('0x2e')]!==_0x8354('0x3f')){var _0x8ea3eb={};_0x8ea3eb[_0x486ba1[_0x8354('0x29')]]={'$like':'%'+_0x49025a[_0x8354('0x31')][_0x8354('0x3d')]+'%'};return _0x8ea3eb;}})});}_0x41f822=_[_0x8354('0x3e')]({},_0x41f822,_0x49025a[_0x8354('0x40')]);var _0x5e6394={'where':_0x41f822[_0x8354('0x3c')]};return db['ZohoConfiguration'][_0x8354('0x1f')](_0x5e6394)[_0x8354('0x26')](function(_0x2cc7fe){_0x45057d['count']=_0x2cc7fe;if(_0x49025a['query']['includeAll']){_0x41f822['include']=[{'all':!![]}];}return db[_0x8354('0x2b')][_0x8354('0x41')](_0x41f822);})[_0x8354('0x26')](function(_0x5862cc){_0x45057d[_0x8354('0x42')]=_0x5862cc;return _0x45057d;})[_0x8354('0x26')](respondWithFilteredResult(_0xdb4228,_0x41f822))[_0x8354('0x43')](handleError(_0xdb4228,null));};exports[_0x8354('0x44')]=function(_0x454aed,_0x45d8cb){var _0x35be4f={'raw':![],'where':{'id':_0x454aed[_0x8354('0x45')]['id']}},_0x23ed81={};_0x23ed81[_0x8354('0x2f')]=_[_0x8354('0x32')](db[_0x8354('0x2b')]['rawAttributes']);_0x23ed81[_0x8354('0x31')]=_[_0x8354('0x32')](_0x454aed[_0x8354('0x31')]);_0x23ed81[_0x8354('0x33')]=_['intersection'](_0x23ed81['model'],_0x23ed81[_0x8354('0x31')]);_0x35be4f['attributes']=_[_0x8354('0x34')](_0x23ed81['model'],qs[_0x8354('0x36')](_0x454aed[_0x8354('0x31')][_0x8354('0x36')]));_0x35be4f[_0x8354('0x35')]=_0x35be4f[_0x8354('0x35')][_0x8354('0x37')]?_0x35be4f[_0x8354('0x35')]:_0x23ed81['model'];if(_0x454aed[_0x8354('0x31')][_0x8354('0x46')]){_0x35be4f[_0x8354('0x47')]=[{'all':!![]}];}_0x35be4f=_[_0x8354('0x3e')]({},_0x35be4f,_0x454aed[_0x8354('0x40')]);return db[_0x8354('0x2b')][_0x8354('0x48')](_0x35be4f)[_0x8354('0x26')](handleEntityNotFound(_0x45d8cb,null))[_0x8354('0x26')](respondWithResult(_0x45d8cb,null))['catch'](handleError(_0x45d8cb,null));};exports[_0x8354('0x49')]=function(_0x28edbd,_0x3bed3f){return db[_0x8354('0x2b')]['create'](_0x28edbd[_0x8354('0x4a')],{})['then'](respondWithResult(_0x3bed3f,0xc9))[_0x8354('0x43')](handleError(_0x3bed3f,null));};exports[_0x8354('0x25')]=function(_0xbef6a9,_0x53a596){if(_0xbef6a9[_0x8354('0x4a')]['id']){delete _0xbef6a9['body']['id'];}return db[_0x8354('0x2b')]['find']({'where':{'id':_0xbef6a9[_0x8354('0x45')]['id']}})[_0x8354('0x26')](handleEntityNotFound(_0x53a596,null))[_0x8354('0x26')](saveUpdates(_0xbef6a9[_0x8354('0x4a')],null))['then'](respondWithResult(_0x53a596,null))[_0x8354('0x43')](handleError(_0x53a596,null));};exports[_0x8354('0x27')]=function(_0x52cedb,_0x236f88){return db[_0x8354('0x2b')]['find']({'where':{'id':_0x52cedb['params']['id']}})[_0x8354('0x26')](handleEntityNotFound(_0x236f88,null))['then'](removeEntity(_0x236f88,null))[_0x8354('0x43')](handleError(_0x236f88,null));};exports[_0x8354('0x4b')]=function(_0x79765b,_0x3fcecc,_0x14495a){var _0x5d7e0d={};var _0x5873d3={};var _0x173605;var _0x241782;return db['ZohoConfiguration'][_0x8354('0x4c')]({'where':{'id':_0x79765b[_0x8354('0x45')]['id']}})[_0x8354('0x26')](handleEntityNotFound(_0x3fcecc,null))[_0x8354('0x26')](function(_0x2410d8){if(_0x2410d8){_0x173605=_0x2410d8;_0x5873d3['model']=_[_0x8354('0x32')](db[_0x8354('0x4d')][_0x8354('0x2c')]);_0x5873d3[_0x8354('0x31')]=_[_0x8354('0x32')](_0x79765b[_0x8354('0x31')]);_0x5873d3[_0x8354('0x33')]=_['intersection'](_0x5873d3[_0x8354('0x2f')],_0x5873d3[_0x8354('0x31')]);_0x5d7e0d[_0x8354('0x35')]=_[_0x8354('0x34')](_0x5873d3[_0x8354('0x2f')],qs[_0x8354('0x36')](_0x79765b[_0x8354('0x31')][_0x8354('0x36')]));_0x5d7e0d[_0x8354('0x35')]=_0x5d7e0d[_0x8354('0x35')]['length']?_0x5d7e0d[_0x8354('0x35')]:_0x5873d3[_0x8354('0x2f')];_0x5d7e0d['order']=qs[_0x8354('0x3b')](_0x79765b['query'][_0x8354('0x3b')]);_0x5d7e0d['where']=qs['filters'](_['pick'](_0x79765b[_0x8354('0x31')],_0x5873d3[_0x8354('0x33')]));if(_0x79765b[_0x8354('0x31')][_0x8354('0x3d')]){_0x5d7e0d[_0x8354('0x3c')]=_['merge'](_0x5d7e0d[_0x8354('0x3c')],{'$or':_['map'](_0x5d7e0d['attributes'],function(_0x69a226){var _0x1d2ba2={};_0x1d2ba2[_0x69a226]={'$like':'%'+_0x79765b[_0x8354('0x31')][_0x8354('0x3d')]+'%'};return _0x1d2ba2;})});}_0x5d7e0d=_[_0x8354('0x3e')]({},_0x5d7e0d,_0x79765b[_0x8354('0x40')]);return _0x173605[_0x8354('0x4b')](_0x5d7e0d);}})['then'](function(_0x38d1da){if(_0x38d1da){_0x241782=_0x38d1da[_0x8354('0x37')];if(!_0x79765b['query'][_0x8354('0x38')]('nolimit')){_0x5d7e0d[_0x8354('0x20')]=qs['limit'](_0x79765b[_0x8354('0x31')][_0x8354('0x20')]);_0x5d7e0d[_0x8354('0x1d')]=qs['offset'](_0x79765b[_0x8354('0x31')]['offset']);}return _0x173605[_0x8354('0x4b')](_0x5d7e0d);}})['then'](function(_0x18f529){if(_0x18f529){return _0x18f529?{'count':_0x241782,'rows':_0x18f529}:null;}})[_0x8354('0x26')](respondWithResult(_0x3fcecc,null))[_0x8354('0x43')](handleError(_0x3fcecc,null));};exports['getSubjects']=function(_0x1074c7,_0x57b485,_0x102491){var _0x3e956f={};var _0x3236bc={};var _0x439162;var _0x3f144d;return db[_0x8354('0x2b')][_0x8354('0x4c')]({'where':{'id':_0x1074c7['params']['id']}})['then'](handleEntityNotFound(_0x57b485,null))[_0x8354('0x26')](function(_0x28b1d3){if(_0x28b1d3){_0x439162=_0x28b1d3;_0x3236bc[_0x8354('0x2f')]=_['keys'](db[_0x8354('0x4d')][_0x8354('0x2c')]);_0x3236bc[_0x8354('0x31')]=_[_0x8354('0x32')](_0x1074c7[_0x8354('0x31')]);_0x3236bc[_0x8354('0x33')]=_['intersection'](_0x3236bc['model'],_0x3236bc[_0x8354('0x31')]);_0x3e956f[_0x8354('0x35')]=_['intersection'](_0x3236bc[_0x8354('0x2f')],qs['fields'](_0x1074c7['query'][_0x8354('0x36')]));_0x3e956f[_0x8354('0x35')]=_0x3e956f['attributes']['length']?_0x3e956f['attributes']:_0x3236bc[_0x8354('0x2f')];_0x3e956f[_0x8354('0x3a')]=qs[_0x8354('0x3b')](_0x1074c7[_0x8354('0x31')][_0x8354('0x3b')]);_0x3e956f['where']=qs['filters'](_[_0x8354('0x4e')](_0x1074c7[_0x8354('0x31')],_0x3236bc[_0x8354('0x33')]));if(_0x1074c7['query'][_0x8354('0x3d')]){_0x3e956f[_0x8354('0x3c')]=_[_0x8354('0x3e')](_0x3e956f[_0x8354('0x3c')],{'$or':_[_0x8354('0x30')](_0x3e956f['attributes'],function(_0x4c3b8d){var _0x40e715={};_0x40e715[_0x4c3b8d]={'$like':'%'+_0x1074c7[_0x8354('0x31')][_0x8354('0x3d')]+'%'};return _0x40e715;})});}_0x3e956f=_['merge']({},_0x3e956f,_0x1074c7['options']);return _0x439162[_0x8354('0x4f')](_0x3e956f);}})[_0x8354('0x26')](function(_0x36a6e7){if(_0x36a6e7){_0x3f144d=_0x36a6e7[_0x8354('0x37')];if(!_0x1074c7[_0x8354('0x31')][_0x8354('0x38')](_0x8354('0x39'))){_0x3e956f['limit']=qs[_0x8354('0x20')](_0x1074c7[_0x8354('0x31')]['limit']);_0x3e956f['offset']=qs[_0x8354('0x1d')](_0x1074c7[_0x8354('0x31')][_0x8354('0x1d')]);}return _0x439162[_0x8354('0x4f')](_0x3e956f);}})[_0x8354('0x26')](function(_0x3ec6f7){if(_0x3ec6f7){return _0x3ec6f7?{'count':_0x3f144d,'rows':_0x3ec6f7}:null;}})[_0x8354('0x26')](respondWithResult(_0x57b485,null))[_0x8354('0x43')](handleError(_0x57b485,null));};exports[_0x8354('0x50')]=function(_0x3a6425,_0x44687c,_0x12ea9c){var _0x499846={};var _0x4de276={};var _0x290f8e;var _0xcf1086;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x3a6425['params']['id']}})[_0x8354('0x26')](handleEntityNotFound(_0x44687c,null))[_0x8354('0x26')](function(_0x39023a){if(_0x39023a){_0x290f8e=_0x39023a;_0x4de276[_0x8354('0x2f')]=_[_0x8354('0x32')](db[_0x8354('0x4d')]['rawAttributes']);_0x4de276['query']=_['keys'](_0x3a6425['query']);_0x4de276[_0x8354('0x33')]=_[_0x8354('0x34')](_0x4de276[_0x8354('0x2f')],_0x4de276['query']);_0x499846['attributes']=_[_0x8354('0x34')](_0x4de276['model'],qs['fields'](_0x3a6425[_0x8354('0x31')]['fields']));_0x499846[_0x8354('0x35')]=_0x499846[_0x8354('0x35')]['length']?_0x499846[_0x8354('0x35')]:_0x4de276[_0x8354('0x2f')];_0x499846[_0x8354('0x3a')]=qs['sort'](_0x3a6425[_0x8354('0x31')]['sort']);_0x499846['where']=qs[_0x8354('0x33')](_[_0x8354('0x4e')](_0x3a6425[_0x8354('0x31')],_0x4de276[_0x8354('0x33')]));if(_0x3a6425[_0x8354('0x31')]['filter']){_0x499846[_0x8354('0x3c')]=_[_0x8354('0x3e')](_0x499846[_0x8354('0x3c')],{'$or':_['map'](_0x499846[_0x8354('0x35')],function(_0x4ec5f3){var _0x11945a={};_0x11945a[_0x4ec5f3]={'$like':'%'+_0x3a6425[_0x8354('0x31')][_0x8354('0x3d')]+'%'};return _0x11945a;})});}_0x499846=_[_0x8354('0x3e')]({},_0x499846,_0x3a6425[_0x8354('0x40')]);return _0x290f8e[_0x8354('0x50')](_0x499846);}})[_0x8354('0x26')](function(_0x1ba15f){if(_0x1ba15f){_0xcf1086=_0x1ba15f[_0x8354('0x37')];if(!_0x3a6425['query'][_0x8354('0x38')](_0x8354('0x39'))){_0x499846[_0x8354('0x20')]=qs[_0x8354('0x20')](_0x3a6425['query'][_0x8354('0x20')]);_0x499846[_0x8354('0x1d')]=qs['offset'](_0x3a6425[_0x8354('0x31')][_0x8354('0x1d')]);}return _0x290f8e[_0x8354('0x50')](_0x499846);}})[_0x8354('0x26')](function(_0x38bcfe){if(_0x38bcfe){return _0x38bcfe?{'count':_0xcf1086,'rows':_0x38bcfe}:null;}})[_0x8354('0x26')](respondWithResult(_0x44687c,null))['catch'](handleError(_0x44687c,null));}; \ No newline at end of file +var _0xfd3b=['then','sendStatus','stack','name','send','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','destroy','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','eml-format','rimraf','bluebird','mustache','util','path','sox','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','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','save'];(function(_0x173e02,_0x1522ff){var _0x5d5dc8=function(_0x529415){while(--_0x529415){_0x173e02['push'](_0x173e02['shift']());}};_0x5d5dc8(++_0x1522ff);}(_0xfd3b,0x169));var _0xbfd3=function(_0xf8d45b,_0x5039ce){_0xf8d45b=_0xf8d45b-0x0;var _0x1a7720=_0xfd3b[_0xf8d45b];return _0x1a7720;};'use strict';var emlformat=require(_0xbfd3('0x0'));var rimraf=require(_0xbfd3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbfd3('0x2'));var Mustache=require(_0xbfd3('0x3'));var util=require(_0xbfd3('0x4'));var path=require(_0xbfd3('0x5'));var sox=require(_0xbfd3('0x6'));var csv=require(_0xbfd3('0x7'));var ejs=require(_0xbfd3('0x8'));var fs=require('fs');var fs_extra=require(_0xbfd3('0x9'));var _=require(_0xbfd3('0xa'));var squel=require('squel');var crypto=require(_0xbfd3('0xb'));var jsforce=require(_0xbfd3('0xc'));var deskjs=require(_0xbfd3('0xd'));var toCsv=require(_0xbfd3('0x7'));var querystring=require(_0xbfd3('0xe'));var Papa=require('papaparse');var Redis=require(_0xbfd3('0xf'));var authService=require(_0xbfd3('0x10'));var qs=require(_0xbfd3('0x11'));var as=require(_0xbfd3('0x12'));var hardwareService=require(_0xbfd3('0x13'));var logger=require(_0xbfd3('0x14'))('api');var utils=require(_0xbfd3('0x15'));var config=require(_0xbfd3('0x16'));var licenseUtil=require(_0xbfd3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26d510,_0x2fd876){_0x2fd876=_0x2fd876||0xcc;return function(_0xe5b799){if(_0xe5b799){return _0x26d510['sendStatus'](_0x2fd876);}return _0x26d510[_0xbfd3('0x18')](_0x2fd876)[_0xbfd3('0x19')]();};}function respondWithResult(_0x4421ca,_0x18f1c0){_0x18f1c0=_0x18f1c0||0xc8;return function(_0x1ca24d){if(_0x1ca24d){return _0x4421ca[_0xbfd3('0x18')](_0x18f1c0)['json'](_0x1ca24d);}};}function respondWithFilteredResult(_0x49559b,_0xacf94d){return function(_0x253b28){if(_0x253b28){var _0x8334b2=typeof _0xacf94d[_0xbfd3('0x1a')]===_0xbfd3('0x1b')&&typeof _0xacf94d[_0xbfd3('0x1c')]===_0xbfd3('0x1b');var _0x547a65=_0x253b28['count'];var _0x1e78dc=_0x8334b2?0x0:_0xacf94d[_0xbfd3('0x1a')];var _0x5b786b=_0x8334b2?_0x253b28[_0xbfd3('0x1d')]:_0xacf94d['offset']+_0xacf94d[_0xbfd3('0x1c')];var _0x2fdcdd;if(_0x5b786b>=_0x547a65){_0x5b786b=_0x547a65;_0x2fdcdd=0xc8;}else{_0x2fdcdd=0xce;}_0x49559b['status'](_0x2fdcdd);return _0x49559b[_0xbfd3('0x1e')](_0xbfd3('0x1f'),_0x1e78dc+'-'+_0x5b786b+'/'+_0x547a65)[_0xbfd3('0x20')](_0x253b28);}return null;};}function patchUpdates(_0x7f602e){return function(_0x2dd266){try{jsonpatch['apply'](_0x2dd266,_0x7f602e,!![]);}catch(_0xd878d1){return BPromise['reject'](_0xd878d1);}return _0x2dd266[_0xbfd3('0x21')]();};}function saveUpdates(_0x36b64b,_0x25172e){return function(_0x281b40){if(_0x281b40){return _0x281b40['update'](_0x36b64b)[_0xbfd3('0x22')](function(_0x540eed){return _0x540eed;});}return null;};}function removeEntity(_0x414976,_0x41ffa3){return function(_0x2690f8){if(_0x2690f8){return _0x2690f8['destroy']()[_0xbfd3('0x22')](function(){_0x414976['status'](0xcc)[_0xbfd3('0x19')]();});}};}function handleEntityNotFound(_0x10fb68,_0xe05011){return function(_0x1796f1){if(!_0x1796f1){_0x10fb68[_0xbfd3('0x23')](0x194);}return _0x1796f1;};}function handleError(_0x2510c4,_0x2e1181){_0x2e1181=_0x2e1181||0x1f4;return function(_0x52d166){logger['error'](_0x52d166[_0xbfd3('0x24')]);if(_0x52d166[_0xbfd3('0x25')]){delete _0x52d166['name'];}_0x2510c4[_0xbfd3('0x18')](_0x2e1181)[_0xbfd3('0x26')](_0x52d166);};}exports['index']=function(_0x382c7b,_0x4fe63b){var _0x1ae39e={},_0x3203c9={},_0x4a070e={'count':0x0,'rows':[]};var _0x534d3f=_[_0xbfd3('0x27')](db[_0xbfd3('0x28')][_0xbfd3('0x29')],function(_0x2065c0){return{'name':_0x2065c0['fieldName'],'type':_0x2065c0[_0xbfd3('0x2a')][_0xbfd3('0x2b')]};});_0x3203c9[_0xbfd3('0x2c')]=_[_0xbfd3('0x27')](_0x534d3f,_0xbfd3('0x25'));_0x3203c9[_0xbfd3('0x2d')]=_[_0xbfd3('0x2e')](_0x382c7b[_0xbfd3('0x2d')]);_0x3203c9[_0xbfd3('0x2f')]=_[_0xbfd3('0x30')](_0x3203c9[_0xbfd3('0x2c')],_0x3203c9[_0xbfd3('0x2d')]);_0x1ae39e[_0xbfd3('0x31')]=_[_0xbfd3('0x30')](_0x3203c9[_0xbfd3('0x2c')],qs['fields'](_0x382c7b['query'][_0xbfd3('0x32')]));_0x1ae39e[_0xbfd3('0x31')]=_0x1ae39e[_0xbfd3('0x31')][_0xbfd3('0x33')]?_0x1ae39e[_0xbfd3('0x31')]:_0x3203c9[_0xbfd3('0x2c')];if(!_0x382c7b[_0xbfd3('0x2d')][_0xbfd3('0x34')](_0xbfd3('0x35'))){_0x1ae39e[_0xbfd3('0x1c')]=qs[_0xbfd3('0x1c')](_0x382c7b[_0xbfd3('0x2d')][_0xbfd3('0x1c')]);_0x1ae39e[_0xbfd3('0x1a')]=qs[_0xbfd3('0x1a')](_0x382c7b[_0xbfd3('0x2d')][_0xbfd3('0x1a')]);}_0x1ae39e['order']=qs[_0xbfd3('0x36')](_0x382c7b[_0xbfd3('0x2d')][_0xbfd3('0x36')]);_0x1ae39e[_0xbfd3('0x37')]=qs['filters'](_[_0xbfd3('0x38')](_0x382c7b['query'],_0x3203c9[_0xbfd3('0x2f')]),_0x534d3f);if(_0x382c7b[_0xbfd3('0x2d')][_0xbfd3('0x39')]){_0x1ae39e['where']=_['merge'](_0x1ae39e[_0xbfd3('0x37')],{'$or':_[_0xbfd3('0x27')](_0x534d3f,function(_0x2bebc5){if(_0x2bebc5['type']!==_0xbfd3('0x3a')){var _0x140503={};_0x140503[_0x2bebc5['name']]={'$like':'%'+_0x382c7b['query'][_0xbfd3('0x39')]+'%'};return _0x140503;}})});}_0x1ae39e=_['merge']({},_0x1ae39e,_0x382c7b[_0xbfd3('0x3b')]);var _0x5173ed={'where':_0x1ae39e['where']};return db[_0xbfd3('0x28')]['count'](_0x5173ed)[_0xbfd3('0x22')](function(_0x51ea65){_0x4a070e[_0xbfd3('0x1d')]=_0x51ea65;if(_0x382c7b['query'][_0xbfd3('0x3c')]){_0x1ae39e[_0xbfd3('0x3d')]=[{'all':!![]}];}return db[_0xbfd3('0x28')][_0xbfd3('0x3e')](_0x1ae39e);})['then'](function(_0x2087a6){_0x4a070e[_0xbfd3('0x3f')]=_0x2087a6;return _0x4a070e;})['then'](respondWithFilteredResult(_0x4fe63b,_0x1ae39e))[_0xbfd3('0x40')](handleError(_0x4fe63b,null));};exports[_0xbfd3('0x41')]=function(_0x553b98,_0x56e8f1){var _0x3aeb39={'raw':![],'where':{'id':_0x553b98[_0xbfd3('0x42')]['id']}},_0x3b54e0={};_0x3b54e0[_0xbfd3('0x2c')]=_['keys'](db[_0xbfd3('0x28')]['rawAttributes']);_0x3b54e0['query']=_[_0xbfd3('0x2e')](_0x553b98[_0xbfd3('0x2d')]);_0x3b54e0[_0xbfd3('0x2f')]=_[_0xbfd3('0x30')](_0x3b54e0[_0xbfd3('0x2c')],_0x3b54e0['query']);_0x3aeb39[_0xbfd3('0x31')]=_[_0xbfd3('0x30')](_0x3b54e0[_0xbfd3('0x2c')],qs[_0xbfd3('0x32')](_0x553b98[_0xbfd3('0x2d')][_0xbfd3('0x32')]));_0x3aeb39[_0xbfd3('0x31')]=_0x3aeb39[_0xbfd3('0x31')]['length']?_0x3aeb39[_0xbfd3('0x31')]:_0x3b54e0[_0xbfd3('0x2c')];if(_0x553b98[_0xbfd3('0x2d')]['includeAll']){_0x3aeb39[_0xbfd3('0x3d')]=[{'all':!![]}];}_0x3aeb39=_[_0xbfd3('0x43')]({},_0x3aeb39,_0x553b98['options']);return db[_0xbfd3('0x28')][_0xbfd3('0x44')](_0x3aeb39)[_0xbfd3('0x22')](handleEntityNotFound(_0x56e8f1,null))[_0xbfd3('0x22')](respondWithResult(_0x56e8f1,null))['catch'](handleError(_0x56e8f1,null));};exports[_0xbfd3('0x45')]=function(_0x5dfdb1,_0x5ee04c){return db[_0xbfd3('0x28')][_0xbfd3('0x45')](_0x5dfdb1[_0xbfd3('0x46')],{})[_0xbfd3('0x22')](respondWithResult(_0x5ee04c,0xc9))[_0xbfd3('0x40')](handleError(_0x5ee04c,null));};exports[_0xbfd3('0x47')]=function(_0x46ce2e,_0xb95512){if(_0x46ce2e['body']['id']){delete _0x46ce2e[_0xbfd3('0x46')]['id'];}return db[_0xbfd3('0x28')][_0xbfd3('0x44')]({'where':{'id':_0x46ce2e['params']['id']}})[_0xbfd3('0x22')](handleEntityNotFound(_0xb95512,null))['then'](saveUpdates(_0x46ce2e[_0xbfd3('0x46')],null))['then'](respondWithResult(_0xb95512,null))['catch'](handleError(_0xb95512,null));};exports[_0xbfd3('0x48')]=function(_0x737723,_0x1cff06){return db[_0xbfd3('0x28')]['find']({'where':{'id':_0x737723['params']['id']}})[_0xbfd3('0x22')](handleEntityNotFound(_0x1cff06,null))['then'](removeEntity(_0x1cff06,null))[_0xbfd3('0x40')](handleError(_0x1cff06,null));};exports[_0xbfd3('0x49')]=function(_0x792507,_0x51b78a,_0x4cf96c){var _0x70ce37={};var _0x26e8ab={};var _0x45b166;var _0x14617b;return db[_0xbfd3('0x28')][_0xbfd3('0x4a')]({'where':{'id':_0x792507[_0xbfd3('0x42')]['id']}})[_0xbfd3('0x22')](handleEntityNotFound(_0x51b78a,null))[_0xbfd3('0x22')](function(_0x43f901){if(_0x43f901){_0x45b166=_0x43f901;_0x26e8ab[_0xbfd3('0x2c')]=_[_0xbfd3('0x2e')](db[_0xbfd3('0x4b')][_0xbfd3('0x29')]);_0x26e8ab[_0xbfd3('0x2d')]=_['keys'](_0x792507[_0xbfd3('0x2d')]);_0x26e8ab[_0xbfd3('0x2f')]=_[_0xbfd3('0x30')](_0x26e8ab[_0xbfd3('0x2c')],_0x26e8ab[_0xbfd3('0x2d')]);_0x70ce37[_0xbfd3('0x31')]=_[_0xbfd3('0x30')](_0x26e8ab['model'],qs['fields'](_0x792507[_0xbfd3('0x2d')][_0xbfd3('0x32')]));_0x70ce37[_0xbfd3('0x31')]=_0x70ce37['attributes'][_0xbfd3('0x33')]?_0x70ce37[_0xbfd3('0x31')]:_0x26e8ab[_0xbfd3('0x2c')];_0x70ce37[_0xbfd3('0x4c')]=qs[_0xbfd3('0x36')](_0x792507['query'][_0xbfd3('0x36')]);_0x70ce37['where']=qs[_0xbfd3('0x2f')](_[_0xbfd3('0x38')](_0x792507[_0xbfd3('0x2d')],_0x26e8ab[_0xbfd3('0x2f')]));if(_0x792507[_0xbfd3('0x2d')][_0xbfd3('0x39')]){_0x70ce37[_0xbfd3('0x37')]=_[_0xbfd3('0x43')](_0x70ce37[_0xbfd3('0x37')],{'$or':_[_0xbfd3('0x27')](_0x70ce37[_0xbfd3('0x31')],function(_0x2445a2){var _0x2b9164={};_0x2b9164[_0x2445a2]={'$like':'%'+_0x792507[_0xbfd3('0x2d')][_0xbfd3('0x39')]+'%'};return _0x2b9164;})});}_0x70ce37=_['merge']({},_0x70ce37,_0x792507[_0xbfd3('0x3b')]);return _0x45b166[_0xbfd3('0x49')](_0x70ce37);}})[_0xbfd3('0x22')](function(_0x6b6014){if(_0x6b6014){_0x14617b=_0x6b6014[_0xbfd3('0x33')];if(!_0x792507[_0xbfd3('0x2d')][_0xbfd3('0x34')]('nolimit')){_0x70ce37[_0xbfd3('0x1c')]=qs[_0xbfd3('0x1c')](_0x792507[_0xbfd3('0x2d')][_0xbfd3('0x1c')]);_0x70ce37[_0xbfd3('0x1a')]=qs['offset'](_0x792507[_0xbfd3('0x2d')][_0xbfd3('0x1a')]);}return _0x45b166[_0xbfd3('0x49')](_0x70ce37);}})[_0xbfd3('0x22')](function(_0x149a69){if(_0x149a69){return _0x149a69?{'count':_0x14617b,'rows':_0x149a69}:null;}})[_0xbfd3('0x22')](respondWithResult(_0x51b78a,null))[_0xbfd3('0x40')](handleError(_0x51b78a,null));};exports[_0xbfd3('0x4d')]=function(_0x29dee5,_0x109d45,_0x2faff7){var _0x9229bb={};var _0x13f750={};var _0xc3f74c;var _0x25350d;return db[_0xbfd3('0x28')][_0xbfd3('0x4a')]({'where':{'id':_0x29dee5[_0xbfd3('0x42')]['id']}})[_0xbfd3('0x22')](handleEntityNotFound(_0x109d45,null))[_0xbfd3('0x22')](function(_0xf7e43a){if(_0xf7e43a){_0xc3f74c=_0xf7e43a;_0x13f750[_0xbfd3('0x2c')]=_[_0xbfd3('0x2e')](db['ZohoField'][_0xbfd3('0x29')]);_0x13f750[_0xbfd3('0x2d')]=_['keys'](_0x29dee5[_0xbfd3('0x2d')]);_0x13f750['filters']=_[_0xbfd3('0x30')](_0x13f750['model'],_0x13f750[_0xbfd3('0x2d')]);_0x9229bb[_0xbfd3('0x31')]=_[_0xbfd3('0x30')](_0x13f750[_0xbfd3('0x2c')],qs['fields'](_0x29dee5['query'][_0xbfd3('0x32')]));_0x9229bb[_0xbfd3('0x31')]=_0x9229bb['attributes'][_0xbfd3('0x33')]?_0x9229bb['attributes']:_0x13f750['model'];_0x9229bb[_0xbfd3('0x4c')]=qs[_0xbfd3('0x36')](_0x29dee5[_0xbfd3('0x2d')][_0xbfd3('0x36')]);_0x9229bb[_0xbfd3('0x37')]=qs[_0xbfd3('0x2f')](_[_0xbfd3('0x38')](_0x29dee5[_0xbfd3('0x2d')],_0x13f750[_0xbfd3('0x2f')]));if(_0x29dee5[_0xbfd3('0x2d')][_0xbfd3('0x39')]){_0x9229bb[_0xbfd3('0x37')]=_[_0xbfd3('0x43')](_0x9229bb['where'],{'$or':_[_0xbfd3('0x27')](_0x9229bb[_0xbfd3('0x31')],function(_0x1d7d77){var _0x474100={};_0x474100[_0x1d7d77]={'$like':'%'+_0x29dee5[_0xbfd3('0x2d')][_0xbfd3('0x39')]+'%'};return _0x474100;})});}_0x9229bb=_['merge']({},_0x9229bb,_0x29dee5['options']);return _0xc3f74c[_0xbfd3('0x4d')](_0x9229bb);}})[_0xbfd3('0x22')](function(_0x7d956c){if(_0x7d956c){_0x25350d=_0x7d956c['length'];if(!_0x29dee5[_0xbfd3('0x2d')][_0xbfd3('0x34')](_0xbfd3('0x35'))){_0x9229bb[_0xbfd3('0x1c')]=qs[_0xbfd3('0x1c')](_0x29dee5['query'][_0xbfd3('0x1c')]);_0x9229bb[_0xbfd3('0x1a')]=qs[_0xbfd3('0x1a')](_0x29dee5[_0xbfd3('0x2d')][_0xbfd3('0x1a')]);}return _0xc3f74c['getSubjects'](_0x9229bb);}})[_0xbfd3('0x22')](function(_0x1cad86){if(_0x1cad86){return _0x1cad86?{'count':_0x25350d,'rows':_0x1cad86}:null;}})[_0xbfd3('0x22')](respondWithResult(_0x109d45,null))[_0xbfd3('0x40')](handleError(_0x109d45,null));};exports[_0xbfd3('0x4e')]=function(_0x3479c4,_0x53841e,_0x1a4dc4){var _0xc773d7={};var _0x3a67a6={};var _0x535caa;var _0x2ccdf0;return db[_0xbfd3('0x28')]['findOne']({'where':{'id':_0x3479c4[_0xbfd3('0x42')]['id']}})[_0xbfd3('0x22')](handleEntityNotFound(_0x53841e,null))['then'](function(_0x4f90c2){if(_0x4f90c2){_0x535caa=_0x4f90c2;_0x3a67a6['model']=_[_0xbfd3('0x2e')](db['ZohoField'][_0xbfd3('0x29')]);_0x3a67a6['query']=_[_0xbfd3('0x2e')](_0x3479c4[_0xbfd3('0x2d')]);_0x3a67a6['filters']=_[_0xbfd3('0x30')](_0x3a67a6['model'],_0x3a67a6[_0xbfd3('0x2d')]);_0xc773d7[_0xbfd3('0x31')]=_[_0xbfd3('0x30')](_0x3a67a6['model'],qs[_0xbfd3('0x32')](_0x3479c4[_0xbfd3('0x2d')]['fields']));_0xc773d7[_0xbfd3('0x31')]=_0xc773d7[_0xbfd3('0x31')][_0xbfd3('0x33')]?_0xc773d7['attributes']:_0x3a67a6[_0xbfd3('0x2c')];_0xc773d7[_0xbfd3('0x4c')]=qs['sort'](_0x3479c4[_0xbfd3('0x2d')][_0xbfd3('0x36')]);_0xc773d7[_0xbfd3('0x37')]=qs['filters'](_[_0xbfd3('0x38')](_0x3479c4[_0xbfd3('0x2d')],_0x3a67a6[_0xbfd3('0x2f')]));if(_0x3479c4[_0xbfd3('0x2d')]['filter']){_0xc773d7[_0xbfd3('0x37')]=_[_0xbfd3('0x43')](_0xc773d7[_0xbfd3('0x37')],{'$or':_[_0xbfd3('0x27')](_0xc773d7[_0xbfd3('0x31')],function(_0x4cc7dc){var _0x2f38e5={};_0x2f38e5[_0x4cc7dc]={'$like':'%'+_0x3479c4['query'][_0xbfd3('0x39')]+'%'};return _0x2f38e5;})});}_0xc773d7=_[_0xbfd3('0x43')]({},_0xc773d7,_0x3479c4['options']);return _0x535caa[_0xbfd3('0x4e')](_0xc773d7);}})[_0xbfd3('0x22')](function(_0x52fbb3){if(_0x52fbb3){_0x2ccdf0=_0x52fbb3[_0xbfd3('0x33')];if(!_0x3479c4[_0xbfd3('0x2d')][_0xbfd3('0x34')](_0xbfd3('0x35'))){_0xc773d7[_0xbfd3('0x1c')]=qs[_0xbfd3('0x1c')](_0x3479c4[_0xbfd3('0x2d')]['limit']);_0xc773d7[_0xbfd3('0x1a')]=qs[_0xbfd3('0x1a')](_0x3479c4[_0xbfd3('0x2d')][_0xbfd3('0x1a')]);}return _0x535caa[_0xbfd3('0x4e')](_0xc773d7);}})[_0xbfd3('0x22')](function(_0x1e2c2e){if(_0x1e2c2e){return _0x1e2c2e?{'count':_0x2ccdf0,'rows':_0x1e2c2e}:null;}})[_0xbfd3('0x22')](respondWithResult(_0x53841e,null))['catch'](handleError(_0x53841e,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 11ed5dd..09e4e2c 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 _0x3228=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x3228,0xd8));var _0x8322=function(_0x4de2f3,_0x42f3a0){_0x4de2f3=_0x4de2f3-0x0;var _0x124541=_0x3228[_0x4de2f3];return _0x124541;};'use strict';var _=require(_0x8322('0x0'));var util=require(_0x8322('0x1'));var logger=require(_0x8322('0x2'))(_0x8322('0x3'));var moment=require(_0x8322('0x4'));var BPromise=require(_0x8322('0x5'));var rp=require(_0x8322('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8322('0x7'));var config=require(_0x8322('0x8'));var attributes=require(_0x8322('0x9'));module[_0x8322('0xa')]=function(_0x3d63f0,_0x2d86e9){return _0x3d63f0[_0x8322('0xb')](_0x8322('0xc'),attributes,{'tableName':_0x8322('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe286=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x1df399,_0x302df4){var _0x2f9a5f=function(_0x822851){while(--_0x822851){_0x1df399['push'](_0x1df399['shift']());}};_0x2f9a5f(++_0x302df4);}(_0xe286,0x1dd));var _0x6e28=function(_0xeebd52,_0x5059bc){_0xeebd52=_0xeebd52-0x0;var _0x1c51de=_0xe286[_0xeebd52];return _0x1c51de;};'use strict';var _=require(_0x6e28('0x0'));var util=require(_0x6e28('0x1'));var logger=require(_0x6e28('0x2'))(_0x6e28('0x3'));var moment=require(_0x6e28('0x4'));var BPromise=require(_0x6e28('0x5'));var rp=require(_0x6e28('0x6'));var fs=require('fs');var path=require(_0x6e28('0x7'));var rimraf=require(_0x6e28('0x8'));var config=require(_0x6e28('0x9'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x5a0ac5,_0x3c186f){return _0x5a0ac5[_0x6e28('0xa')](_0x6e28('0xb'),attributes,{'tableName':_0x6e28('0xc'),'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 ca2e35c..e7475ac 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 _0x4265=['request','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4103d4,_0x530cdc){var _0x5a0e3f=function(_0x382bc6){while(--_0x382bc6){_0x4103d4['push'](_0x4103d4['shift']());}};_0x5a0e3f(++_0x530cdc);}(_0x4265,0x15d));var _0x5426=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4265[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5426('0x0'));var util=require(_0x5426('0x1'));var moment=require(_0x5426('0x2'));var BPromise=require('bluebird');var rs=require(_0x5426('0x3'));var fs=require('fs');var Redis=require(_0x5426('0x4'));var db=require(_0x5426('0x5'))['db'];var utils=require(_0x5426('0x6'));var logger=require(_0x5426('0x7'))('rpc');var config=require(_0x5426('0x8'));var jayson=require(_0x5426('0x9'));var client=jayson[_0x5426('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x330152,_0xdb8cbe,_0x8f15ef){return new BPromise(function(_0x3f16b6,_0x38c4f9){return client[_0x5426('0xb')](_0x330152,_0x8f15ef)[_0x5426('0xc')](function(_0x44b89e){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0xdb8cbe,_0x5426('0xd'));logger[_0x5426('0xe')](_0x5426('0xf'),_0xdb8cbe,'request\x20sent',JSON[_0x5426('0x10')](_0x44b89e));if(_0x44b89e[_0x5426('0x11')]){if(_0x44b89e[_0x5426('0x11')][_0x5426('0x12')]===0x1f4){logger['error'](_0x5426('0x13'),_0xdb8cbe,_0x44b89e[_0x5426('0x11')][_0x5426('0x14')]);return _0x38c4f9(_0x44b89e[_0x5426('0x11')][_0x5426('0x14')]);}logger[_0x5426('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0xdb8cbe,_0x44b89e[_0x5426('0x11')]['message']);return _0x3f16b6(_0x44b89e[_0x5426('0x11')][_0x5426('0x14')]);}else{logger[_0x5426('0x15')](_0x5426('0x13'),_0xdb8cbe,_0x5426('0xd'));_0x3f16b6(_0x44b89e[_0x5426('0x16')][_0x5426('0x14')]);}})[_0x5426('0x17')](function(_0x3c2b4f){logger[_0x5426('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0xdb8cbe,_0x3c2b4f);_0x38c4f9(_0x3c2b4f);});});} \ No newline at end of file +var _0xe3f0=['../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis'];(function(_0x4e97f8,_0x3862c1){var _0x3555a3=function(_0x24160f){while(--_0x24160f){_0x4e97f8['push'](_0x4e97f8['shift']());}};_0x3555a3(++_0x3862c1);}(_0xe3f0,0x1a1));var _0x0e3f=function(_0x2c9e23,_0x45c8a5){_0x2c9e23=_0x2c9e23-0x0;var _0x288b88=_0xe3f0[_0x2c9e23];return _0x288b88;};'use strict';var _=require(_0x0e3f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0e3f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e3f('0x2'));var db=require(_0x0e3f('0x3'))['db'];var utils=require(_0x0e3f('0x4'));var logger=require(_0x0e3f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0e3f('0x6')][_0x0e3f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5161ad,_0x1a2f51,_0x31c223){return new BPromise(function(_0x12ba9b,_0x112026){return client[_0x0e3f('0x8')](_0x5161ad,_0x31c223)[_0x0e3f('0x9')](function(_0x921112){logger[_0x0e3f('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a2f51,'request\x20sent');logger[_0x0e3f('0xb')](_0x0e3f('0xc'),_0x1a2f51,_0x0e3f('0xd'),JSON[_0x0e3f('0xe')](_0x921112));if(_0x921112[_0x0e3f('0xf')]){if(_0x921112[_0x0e3f('0xf')][_0x0e3f('0x10')]===0x1f4){logger['error'](_0x0e3f('0x11'),_0x1a2f51,_0x921112[_0x0e3f('0xf')][_0x0e3f('0x12')]);return _0x112026(_0x921112[_0x0e3f('0xf')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x1a2f51,_0x921112[_0x0e3f('0xf')]['message']);return _0x12ba9b(_0x921112[_0x0e3f('0xf')][_0x0e3f('0x12')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x1a2f51,_0x0e3f('0xd'));_0x12ba9b(_0x921112[_0x0e3f('0x13')][_0x0e3f('0x12')]);}})[_0x0e3f('0x14')](function(_0x2e9b4c){logger[_0x0e3f('0xf')](_0x0e3f('0x11'),_0x1a2f51,_0x2e9b4c);_0x112026(_0x2e9b4c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 51f87c4..1da1515 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 _0x9002=['isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x9002,0x13c));var _0x2900=function(_0x214c47,_0x49f280){_0x214c47=_0x214c47-0x0;var _0x4e8856=_0x9002[_0x214c47];return _0x4e8856;};'use strict';var multer=require('multer');var util=require(_0x2900('0x0'));var path=require(_0x2900('0x1'));var timeout=require(_0x2900('0x2'));var express=require('express');var router=express[_0x2900('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2900('0x4'));var interaction=require(_0x2900('0x5'));var config=require(_0x2900('0x6'));var controller=require(_0x2900('0x7'));router['get']('/',auth[_0x2900('0x8')](),controller[_0x2900('0x9')]);router['get']('/:id',auth[_0x2900('0x8')](),controller[_0x2900('0xa')]);router['post']('/',auth[_0x2900('0x8')](),controller[_0x2900('0xb')]);router[_0x2900('0xc')](_0x2900('0xd'),auth[_0x2900('0x8')](),controller[_0x2900('0xe')]);router[_0x2900('0xf')]('/:id',auth[_0x2900('0x8')](),controller[_0x2900('0x10')]);module[_0x2900('0x11')]=router; \ No newline at end of file +var _0xc74e=['/:id','show','post','create','update','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x500f84,_0x3b8137){var _0x23f5a9=function(_0x28f098){while(--_0x28f098){_0x500f84['push'](_0x500f84['shift']());}};_0x23f5a9(++_0x3b8137);}(_0xc74e,0x159));var _0xec74=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc74e[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xec74('0x0'));var util=require(_0xec74('0x1'));var path=require(_0xec74('0x2'));var timeout=require(_0xec74('0x3'));var express=require(_0xec74('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xec74('0x5'));var interaction=require(_0xec74('0x6'));var config=require(_0xec74('0x7'));var controller=require(_0xec74('0x8'));router[_0xec74('0x9')]('/',auth[_0xec74('0xa')](),controller[_0xec74('0xb')]);router[_0xec74('0x9')](_0xec74('0xc'),auth[_0xec74('0xa')](),controller[_0xec74('0xd')]);router[_0xec74('0xe')]('/',auth['isAuthenticated'](),controller[_0xec74('0xf')]);router['put'](_0xec74('0xc'),auth[_0xec74('0xa')](),controller[_0xec74('0x10')]);router['delete'](_0xec74('0xc'),auth[_0xec74('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index ada95c2..acbe472 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 _0xa92f=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x4ee773,_0x3dd945){var _0x1cffbb=function(_0x1d6f83){while(--_0x1d6f83){_0x4ee773['push'](_0x4ee773['shift']());}};_0x1cffbb(++_0x3dd945);}(_0xa92f,0x88));var _0xfa92=function(_0x378867,_0x5ce806){_0x378867=_0x378867-0x0;var _0x1c2de2=_0xa92f[_0x378867];return _0x1c2de2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xfa92('0x0')](_0xfa92('0x1'),_0xfa92('0x2'),_0xfa92('0x3'),_0xfa92('0x4'),_0xfa92('0x5')),'defaultValue':_0xfa92('0x1')},'content':{'type':Sequelize[_0xfa92('0x6')]},'key':{'type':Sequelize[_0xfa92('0x6')]},'keyType':{'type':Sequelize[_0xfa92('0x0')](_0xfa92('0x1'),_0xfa92('0x2'),_0xfa92('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfa92('0x6')]},'customField':{'type':Sequelize[_0xfa92('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfa92('0x6')]}}; \ No newline at end of file +var _0x4057=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4057,0x14b));var _0x7405=function(_0x34b245,_0xfe65b4){_0x34b245=_0x34b245-0x0;var _0x3a8984=_0x4057[_0x34b245];return _0x3a8984;};'use strict';var Sequelize=require(_0x7405('0x0'));module[_0x7405('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7405('0x2'),_0x7405('0x3'),_0x7405('0x4'),_0x7405('0x5'),_0x7405('0x6')),'defaultValue':_0x7405('0x2')},'content':{'type':Sequelize[_0x7405('0x7')]},'key':{'type':Sequelize[_0x7405('0x7')]},'keyType':{'type':Sequelize[_0x7405('0x8')](_0x7405('0x2'),_0x7405('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7405('0x7')]},'customField':{'type':Sequelize[_0x7405('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7405('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 3e4b5da..bd9126c 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 _0x10fd=['moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','ZohoField','fieldName','type','key','model','map','query','intersection','attributes','length','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','keys','fields','create','body','params','eml-format','request-promise'];(function(_0x27134b,_0x39f2c6){var _0x3efaeb=function(_0x472972){while(--_0x472972){_0x27134b['push'](_0x27134b['shift']());}};_0x3efaeb(++_0x39f2c6);}(_0x10fd,0xc4));var _0xd10f=function(_0xbf52f3,_0x2b2bb2){_0xbf52f3=_0xbf52f3-0x0;var _0x25edcc=_0x10fd[_0xbf52f3];return _0x25edcc;};'use strict';var emlformat=require(_0xd10f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd10f('0x1'));var moment=require(_0xd10f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd10f('0x3'));var util=require(_0xd10f('0x4'));var path=require('path');var sox=require(_0xd10f('0x5'));var csv=require(_0xd10f('0x6'));var ejs=require(_0xd10f('0x7'));var fs=require('fs');var fs_extra=require(_0xd10f('0x8'));var _=require('lodash');var squel=require(_0xd10f('0x9'));var crypto=require('crypto');var jsforce=require(_0xd10f('0xa'));var deskjs=require(_0xd10f('0xb'));var toCsv=require(_0xd10f('0x6'));var querystring=require('querystring');var Papa=require(_0xd10f('0xc'));var Redis=require(_0xd10f('0xd'));var authService=require(_0xd10f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd10f('0xf'));var hardwareService=require(_0xd10f('0x10'));var logger=require(_0xd10f('0x11'))(_0xd10f('0x12'));var utils=require('../../config/utils');var config=require(_0xd10f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd10f('0x14'))['db'];function respondWithStatusCode(_0x5a7c12,_0x2ee335){_0x2ee335=_0x2ee335||0xcc;return function(_0x1d60d5){if(_0x1d60d5){return _0x5a7c12['sendStatus'](_0x2ee335);}return _0x5a7c12[_0xd10f('0x15')](_0x2ee335)['end']();};}function respondWithResult(_0x24dde7,_0x568b21){_0x568b21=_0x568b21||0xc8;return function(_0x54e6d9){if(_0x54e6d9){return _0x24dde7[_0xd10f('0x15')](_0x568b21)[_0xd10f('0x16')](_0x54e6d9);}};}function respondWithFilteredResult(_0x314b2d,_0x39829f){return function(_0x441186){if(_0x441186){var _0x1f1d4a=typeof _0x39829f[_0xd10f('0x17')]===_0xd10f('0x18')&&typeof _0x39829f[_0xd10f('0x19')]==='undefined';var _0x5e1b6e=_0x441186[_0xd10f('0x1a')];var _0x16500f=_0x1f1d4a?0x0:_0x39829f[_0xd10f('0x17')];var _0x2375e9=_0x1f1d4a?_0x441186[_0xd10f('0x1a')]:_0x39829f[_0xd10f('0x17')]+_0x39829f[_0xd10f('0x19')];var _0x499978;if(_0x2375e9>=_0x5e1b6e){_0x2375e9=_0x5e1b6e;_0x499978=0xc8;}else{_0x499978=0xce;}_0x314b2d['status'](_0x499978);return _0x314b2d[_0xd10f('0x1b')]('Content-Range',_0x16500f+'-'+_0x2375e9+'/'+_0x5e1b6e)[_0xd10f('0x16')](_0x441186);}return null;};}function patchUpdates(_0x223eb1){return function(_0x17f7fa){try{jsonpatch[_0xd10f('0x1c')](_0x17f7fa,_0x223eb1,!![]);}catch(_0x2ee687){return BPromise[_0xd10f('0x1d')](_0x2ee687);}return _0x17f7fa['save']();};}function saveUpdates(_0x241c07,_0x6e6db){return function(_0x14cf5b){if(_0x14cf5b){return _0x14cf5b[_0xd10f('0x1e')](_0x241c07)[_0xd10f('0x1f')](function(_0xbf0fa4){return _0xbf0fa4;});}return null;};}function removeEntity(_0x3b798b,_0x2d4fe3){return function(_0x32d0d9){if(_0x32d0d9){return _0x32d0d9[_0xd10f('0x20')]()[_0xd10f('0x1f')](function(){_0x3b798b[_0xd10f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1cd6,_0x4722e0){return function(_0x45947e){if(!_0x45947e){_0x5b1cd6[_0xd10f('0x21')](0x194);}return _0x45947e;};}function handleError(_0x1dbc9b,_0x45399d){_0x45399d=_0x45399d||0x1f4;return function(_0x2a3956){logger[_0xd10f('0x22')](_0x2a3956[_0xd10f('0x23')]);if(_0x2a3956[_0xd10f('0x24')]){delete _0x2a3956[_0xd10f('0x24')];}_0x1dbc9b[_0xd10f('0x15')](_0x45399d)['send'](_0x2a3956);};}exports[_0xd10f('0x25')]=function(_0x448ce1,_0x5bf210){var _0x579d2a={},_0x5ba05d={},_0x2a30d9={'count':0x0,'rows':[]};var _0x1febdc=_['map'](db[_0xd10f('0x26')]['rawAttributes'],function(_0x130446){return{'name':_0x130446[_0xd10f('0x27')],'type':_0x130446[_0xd10f('0x28')][_0xd10f('0x29')]};});_0x5ba05d[_0xd10f('0x2a')]=_[_0xd10f('0x2b')](_0x1febdc,_0xd10f('0x24'));_0x5ba05d[_0xd10f('0x2c')]=_['keys'](_0x448ce1[_0xd10f('0x2c')]);_0x5ba05d['filters']=_[_0xd10f('0x2d')](_0x5ba05d[_0xd10f('0x2a')],_0x5ba05d[_0xd10f('0x2c')]);_0x579d2a[_0xd10f('0x2e')]=_['intersection'](_0x5ba05d[_0xd10f('0x2a')],qs['fields'](_0x448ce1[_0xd10f('0x2c')]['fields']));_0x579d2a[_0xd10f('0x2e')]=_0x579d2a[_0xd10f('0x2e')][_0xd10f('0x2f')]?_0x579d2a['attributes']:_0x5ba05d[_0xd10f('0x2a')];if(!_0x448ce1[_0xd10f('0x2c')]['hasOwnProperty']('nolimit')){_0x579d2a['limit']=qs['limit'](_0x448ce1[_0xd10f('0x2c')][_0xd10f('0x19')]);_0x579d2a['offset']=qs[_0xd10f('0x17')](_0x448ce1['query'][_0xd10f('0x17')]);}_0x579d2a[_0xd10f('0x30')]=qs[_0xd10f('0x31')](_0x448ce1['query'][_0xd10f('0x31')]);_0x579d2a['where']=qs[_0xd10f('0x32')](_[_0xd10f('0x33')](_0x448ce1[_0xd10f('0x2c')],_0x5ba05d[_0xd10f('0x32')]),_0x1febdc);if(_0x448ce1['query']['filter']){_0x579d2a[_0xd10f('0x34')]=_['merge'](_0x579d2a[_0xd10f('0x34')],{'$or':_[_0xd10f('0x2b')](_0x1febdc,function(_0x57edee){if(_0x57edee[_0xd10f('0x28')]!==_0xd10f('0x35')){var _0x15ac02={};_0x15ac02[_0x57edee[_0xd10f('0x24')]]={'$like':'%'+_0x448ce1[_0xd10f('0x2c')][_0xd10f('0x36')]+'%'};return _0x15ac02;}})});}_0x579d2a=_[_0xd10f('0x37')]({},_0x579d2a,_0x448ce1[_0xd10f('0x38')]);var _0x43c462={'where':_0x579d2a[_0xd10f('0x34')]};return db[_0xd10f('0x26')][_0xd10f('0x1a')](_0x43c462)['then'](function(_0x22160a){_0x2a30d9[_0xd10f('0x1a')]=_0x22160a;if(_0x448ce1[_0xd10f('0x2c')][_0xd10f('0x39')]){_0x579d2a[_0xd10f('0x3a')]=[{'all':!![]}];}return db[_0xd10f('0x26')][_0xd10f('0x3b')](_0x579d2a);})['then'](function(_0x532f2d){_0x2a30d9['rows']=_0x532f2d;return _0x2a30d9;})[_0xd10f('0x1f')](respondWithFilteredResult(_0x5bf210,_0x579d2a))[_0xd10f('0x3c')](handleError(_0x5bf210,null));};exports['show']=function(_0x4ce324,_0x36a499){var _0x460340={'raw':!![],'where':{'id':_0x4ce324['params']['id']}},_0x377902={};_0x377902[_0xd10f('0x2a')]=_['keys'](db[_0xd10f('0x26')]['rawAttributes']);_0x377902['query']=_[_0xd10f('0x3d')](_0x4ce324[_0xd10f('0x2c')]);_0x377902[_0xd10f('0x32')]=_['intersection'](_0x377902[_0xd10f('0x2a')],_0x377902[_0xd10f('0x2c')]);_0x460340['attributes']=_[_0xd10f('0x2d')](_0x377902['model'],qs[_0xd10f('0x3e')](_0x4ce324[_0xd10f('0x2c')]['fields']));_0x460340['attributes']=_0x460340['attributes'][_0xd10f('0x2f')]?_0x460340[_0xd10f('0x2e')]:_0x377902['model'];if(_0x4ce324['query'][_0xd10f('0x39')]){_0x460340[_0xd10f('0x3a')]=[{'all':!![]}];}_0x460340=_[_0xd10f('0x37')]({},_0x460340,_0x4ce324[_0xd10f('0x38')]);return db[_0xd10f('0x26')]['find'](_0x460340)[_0xd10f('0x1f')](handleEntityNotFound(_0x36a499,null))[_0xd10f('0x1f')](respondWithResult(_0x36a499,null))[_0xd10f('0x3c')](handleError(_0x36a499,null));};exports[_0xd10f('0x3f')]=function(_0x135ca4,_0x179747){return db['ZohoField'][_0xd10f('0x3f')](_0x135ca4[_0xd10f('0x40')],{})['then'](respondWithResult(_0x179747,0xc9))[_0xd10f('0x3c')](handleError(_0x179747,null));};exports[_0xd10f('0x1e')]=function(_0x287a6b,_0x557170){if(_0x287a6b['body']['id']){delete _0x287a6b[_0xd10f('0x40')]['id'];}return db[_0xd10f('0x26')]['find']({'where':{'id':_0x287a6b[_0xd10f('0x41')]['id']}})[_0xd10f('0x1f')](handleEntityNotFound(_0x557170,null))[_0xd10f('0x1f')](saveUpdates(_0x287a6b[_0xd10f('0x40')],null))[_0xd10f('0x1f')](respondWithResult(_0x557170,null))[_0xd10f('0x3c')](handleError(_0x557170,null));};exports[_0xd10f('0x20')]=function(_0x35f611,_0x2668a0){return db[_0xd10f('0x26')]['find']({'where':{'id':_0x35f611[_0xd10f('0x41')]['id']}})[_0xd10f('0x1f')](handleEntityNotFound(_0x2668a0,null))['then'](removeEntity(_0x2668a0,null))['catch'](handleError(_0x2668a0,null));}; \ No newline at end of file +var _0x70e3=['params','keys','rawAttributes','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4a379b,_0x334e8b){var _0x2e2509=function(_0x82c3b3){while(--_0x82c3b3){_0x4a379b['push'](_0x4a379b['shift']());}};_0x2e2509(++_0x334e8b);}(_0x70e3,0x9d));var _0x370e=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x70e3[_0x179b53];return _0x38a146;};'use strict';var emlformat=require(_0x370e('0x0'));var rimraf=require(_0x370e('0x1'));var zipdir=require(_0x370e('0x2'));var jsonpatch=require(_0x370e('0x3'));var rp=require('request-promise');var moment=require(_0x370e('0x4'));var BPromise=require(_0x370e('0x5'));var Mustache=require(_0x370e('0x6'));var util=require('util');var path=require(_0x370e('0x7'));var sox=require(_0x370e('0x8'));var csv=require(_0x370e('0x9'));var ejs=require(_0x370e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x370e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x370e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x370e('0xd'));var Papa=require('papaparse');var Redis=require(_0x370e('0xe'));var authService=require(_0x370e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x370e('0x10'));var logger=require(_0x370e('0x11'))(_0x370e('0x12'));var utils=require(_0x370e('0x13'));var config=require(_0x370e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x370e('0x15'))['db'];function respondWithStatusCode(_0x17115f,_0x26f9f6){_0x26f9f6=_0x26f9f6||0xcc;return function(_0xc21653){if(_0xc21653){return _0x17115f[_0x370e('0x16')](_0x26f9f6);}return _0x17115f[_0x370e('0x17')](_0x26f9f6)[_0x370e('0x18')]();};}function respondWithResult(_0x8b678d,_0x42ba1c){_0x42ba1c=_0x42ba1c||0xc8;return function(_0x2715c9){if(_0x2715c9){return _0x8b678d[_0x370e('0x17')](_0x42ba1c)['json'](_0x2715c9);}};}function respondWithFilteredResult(_0x49c2dd,_0x5e43fb){return function(_0x32e9d7){if(_0x32e9d7){var _0x44a6a1=typeof _0x5e43fb[_0x370e('0x19')]===_0x370e('0x1a')&&typeof _0x5e43fb[_0x370e('0x1b')]===_0x370e('0x1a');var _0x56076d=_0x32e9d7[_0x370e('0x1c')];var _0x2e394a=_0x44a6a1?0x0:_0x5e43fb['offset'];var _0x407789=_0x44a6a1?_0x32e9d7[_0x370e('0x1c')]:_0x5e43fb['offset']+_0x5e43fb[_0x370e('0x1b')];var _0x25fe44;if(_0x407789>=_0x56076d){_0x407789=_0x56076d;_0x25fe44=0xc8;}else{_0x25fe44=0xce;}_0x49c2dd[_0x370e('0x17')](_0x25fe44);return _0x49c2dd['set'](_0x370e('0x1d'),_0x2e394a+'-'+_0x407789+'/'+_0x56076d)[_0x370e('0x1e')](_0x32e9d7);}return null;};}function patchUpdates(_0xb7887c){return function(_0x4eb5e4){try{jsonpatch[_0x370e('0x1f')](_0x4eb5e4,_0xb7887c,!![]);}catch(_0x82f22a){return BPromise['reject'](_0x82f22a);}return _0x4eb5e4[_0x370e('0x20')]();};}function saveUpdates(_0x1edda5,_0x4fc0d3){return function(_0x455342){if(_0x455342){return _0x455342[_0x370e('0x21')](_0x1edda5)[_0x370e('0x22')](function(_0x1d0860){return _0x1d0860;});}return null;};}function removeEntity(_0x130ebd,_0x18c058){return function(_0x4f23ec){if(_0x4f23ec){return _0x4f23ec[_0x370e('0x23')]()[_0x370e('0x22')](function(){_0x130ebd[_0x370e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7d1f,_0x1c2950){return function(_0xd9d1d6){if(!_0xd9d1d6){_0x2f7d1f['sendStatus'](0x194);}return _0xd9d1d6;};}function handleError(_0x94e3e7,_0x25d975){_0x25d975=_0x25d975||0x1f4;return function(_0x210a46){logger[_0x370e('0x24')](_0x210a46[_0x370e('0x25')]);if(_0x210a46[_0x370e('0x26')]){delete _0x210a46[_0x370e('0x26')];}_0x94e3e7['status'](_0x25d975)[_0x370e('0x27')](_0x210a46);};}exports[_0x370e('0x28')]=function(_0x3562a3,_0x43d706){var _0x3fd78e={},_0x5a7c26={},_0x4fd876={'count':0x0,'rows':[]};var _0x18231e=_[_0x370e('0x29')](db[_0x370e('0x2a')]['rawAttributes'],function(_0x1518a5){return{'name':_0x1518a5[_0x370e('0x2b')],'type':_0x1518a5[_0x370e('0x2c')][_0x370e('0x2d')]};});_0x5a7c26[_0x370e('0x2e')]=_[_0x370e('0x29')](_0x18231e,_0x370e('0x26'));_0x5a7c26['query']=_['keys'](_0x3562a3[_0x370e('0x2f')]);_0x5a7c26[_0x370e('0x30')]=_[_0x370e('0x31')](_0x5a7c26[_0x370e('0x2e')],_0x5a7c26['query']);_0x3fd78e[_0x370e('0x32')]=_[_0x370e('0x31')](_0x5a7c26[_0x370e('0x2e')],qs[_0x370e('0x33')](_0x3562a3['query'][_0x370e('0x33')]));_0x3fd78e[_0x370e('0x32')]=_0x3fd78e[_0x370e('0x32')][_0x370e('0x34')]?_0x3fd78e[_0x370e('0x32')]:_0x5a7c26[_0x370e('0x2e')];if(!_0x3562a3['query'][_0x370e('0x35')](_0x370e('0x36'))){_0x3fd78e['limit']=qs['limit'](_0x3562a3['query'][_0x370e('0x1b')]);_0x3fd78e['offset']=qs['offset'](_0x3562a3[_0x370e('0x2f')]['offset']);}_0x3fd78e[_0x370e('0x37')]=qs[_0x370e('0x38')](_0x3562a3[_0x370e('0x2f')][_0x370e('0x38')]);_0x3fd78e[_0x370e('0x39')]=qs[_0x370e('0x30')](_[_0x370e('0x3a')](_0x3562a3['query'],_0x5a7c26[_0x370e('0x30')]),_0x18231e);if(_0x3562a3[_0x370e('0x2f')][_0x370e('0x3b')]){_0x3fd78e[_0x370e('0x39')]=_['merge'](_0x3fd78e['where'],{'$or':_[_0x370e('0x29')](_0x18231e,function(_0x750cfd){if(_0x750cfd['type']!==_0x370e('0x3c')){var _0x4ae9dd={};_0x4ae9dd[_0x750cfd['name']]={'$like':'%'+_0x3562a3[_0x370e('0x2f')][_0x370e('0x3b')]+'%'};return _0x4ae9dd;}})});}_0x3fd78e=_['merge']({},_0x3fd78e,_0x3562a3[_0x370e('0x3d')]);var _0x1ff3db={'where':_0x3fd78e[_0x370e('0x39')]};return db[_0x370e('0x2a')][_0x370e('0x1c')](_0x1ff3db)[_0x370e('0x22')](function(_0x13b8ec){_0x4fd876[_0x370e('0x1c')]=_0x13b8ec;if(_0x3562a3[_0x370e('0x2f')][_0x370e('0x3e')]){_0x3fd78e[_0x370e('0x3f')]=[{'all':!![]}];}return db['ZohoField'][_0x370e('0x40')](_0x3fd78e);})[_0x370e('0x22')](function(_0x2ded9e){_0x4fd876[_0x370e('0x41')]=_0x2ded9e;return _0x4fd876;})[_0x370e('0x22')](respondWithFilteredResult(_0x43d706,_0x3fd78e))[_0x370e('0x42')](handleError(_0x43d706,null));};exports[_0x370e('0x43')]=function(_0x221183,_0x266932){var _0x3d60ac={'raw':!![],'where':{'id':_0x221183[_0x370e('0x44')]['id']}},_0x36bd43={};_0x36bd43[_0x370e('0x2e')]=_[_0x370e('0x45')](db['ZohoField'][_0x370e('0x46')]);_0x36bd43['query']=_[_0x370e('0x45')](_0x221183[_0x370e('0x2f')]);_0x36bd43[_0x370e('0x30')]=_[_0x370e('0x31')](_0x36bd43[_0x370e('0x2e')],_0x36bd43[_0x370e('0x2f')]);_0x3d60ac[_0x370e('0x32')]=_[_0x370e('0x31')](_0x36bd43['model'],qs[_0x370e('0x33')](_0x221183[_0x370e('0x2f')][_0x370e('0x33')]));_0x3d60ac[_0x370e('0x32')]=_0x3d60ac[_0x370e('0x32')][_0x370e('0x34')]?_0x3d60ac[_0x370e('0x32')]:_0x36bd43[_0x370e('0x2e')];if(_0x221183[_0x370e('0x2f')]['includeAll']){_0x3d60ac['include']=[{'all':!![]}];}_0x3d60ac=_[_0x370e('0x47')]({},_0x3d60ac,_0x221183[_0x370e('0x3d')]);return db[_0x370e('0x2a')][_0x370e('0x48')](_0x3d60ac)[_0x370e('0x22')](handleEntityNotFound(_0x266932,null))[_0x370e('0x22')](respondWithResult(_0x266932,null))[_0x370e('0x42')](handleError(_0x266932,null));};exports[_0x370e('0x49')]=function(_0x5250d0,_0x23644e){return db[_0x370e('0x2a')][_0x370e('0x49')](_0x5250d0[_0x370e('0x4a')],{})[_0x370e('0x22')](respondWithResult(_0x23644e,0xc9))['catch'](handleError(_0x23644e,null));};exports[_0x370e('0x21')]=function(_0x464c5a,_0x49e414){if(_0x464c5a['body']['id']){delete _0x464c5a[_0x370e('0x4a')]['id'];}return db[_0x370e('0x2a')][_0x370e('0x48')]({'where':{'id':_0x464c5a[_0x370e('0x44')]['id']}})[_0x370e('0x22')](handleEntityNotFound(_0x49e414,null))[_0x370e('0x22')](saveUpdates(_0x464c5a['body'],null))[_0x370e('0x22')](respondWithResult(_0x49e414,null))[_0x370e('0x42')](handleError(_0x49e414,null));};exports[_0x370e('0x23')]=function(_0x5905b8,_0x5a480f){return db[_0x370e('0x2a')][_0x370e('0x48')]({'where':{'id':_0x5905b8[_0x370e('0x44')]['id']}})[_0x370e('0x22')](handleEntityNotFound(_0x5a480f,null))[_0x370e('0x22')](removeEntity(_0x5a480f,null))['catch'](handleError(_0x5a480f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index c0f6db6..e0d33cb 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 _0x3a6d=['../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x57a364,_0x3f9919){var _0x2849fe=function(_0x19c45e){while(--_0x19c45e){_0x57a364['push'](_0x57a364['shift']());}};_0x2849fe(++_0x3f9919);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x3a6d[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require('../../config/logger')(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd3a6('0x7'));var attributes=require(_0xd3a6('0x8'));module[_0xd3a6('0x9')]=function(_0x1fc450,_0x25b042){return _0x1fc450[_0xd3a6('0xa')]('ZohoField',attributes,{'tableName':_0xd3a6('0xb'),'paranoid':![],'indexes':[{'name':_0xd3a6('0xc'),'fields':[_0xd3a6('0xd'),_0xd3a6('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['api','moment','bluebird','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','util','../../config/logger'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xac4a('0xc')],'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 78fdb10..ae091e0 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 _0x43e1=['../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c6021,_0x4221b0){var _0xccdeff=function(_0x2ca10e){while(--_0x2ca10e){_0x1c6021['push'](_0x1c6021['shift']());}};_0xccdeff(++_0x4221b0);}(_0x43e1,0x130));var _0x143e=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x43e1[_0x810e4d];return _0x13f01c;};'use strict';var _=require(_0x143e('0x0'));var util=require(_0x143e('0x1'));var moment=require(_0x143e('0x2'));var BPromise=require(_0x143e('0x3'));var rs=require(_0x143e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x143e('0x5'))['db'];var utils=require(_0x143e('0x6'));var logger=require(_0x143e('0x7'))('rpc');var config=require(_0x143e('0x8'));var jayson=require(_0x143e('0x9'));var client=jayson[_0x143e('0xa')][_0x143e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f87c2,_0x1d26b2,_0x3616d3){return new BPromise(function(_0x4030af,_0x23ba0a){return client[_0x143e('0xc')](_0x3f87c2,_0x3616d3)[_0x143e('0xd')](function(_0x2e1821){logger['info'](_0x143e('0xe'),_0x1d26b2,_0x143e('0xf'));logger[_0x143e('0x10')](_0x143e('0x11'),_0x1d26b2,_0x143e('0xf'),JSON[_0x143e('0x12')](_0x2e1821));if(_0x2e1821[_0x143e('0x13')]){if(_0x2e1821[_0x143e('0x13')]['code']===0x1f4){logger[_0x143e('0x13')](_0x143e('0xe'),_0x1d26b2,_0x2e1821[_0x143e('0x13')]['message']);return _0x23ba0a(_0x2e1821['error'][_0x143e('0x14')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x1d26b2,_0x2e1821[_0x143e('0x13')][_0x143e('0x14')]);return _0x4030af(_0x2e1821[_0x143e('0x13')][_0x143e('0x14')]);}else{logger[_0x143e('0x15')](_0x143e('0xe'),_0x1d26b2,_0x143e('0xf'));_0x4030af(_0x2e1821[_0x143e('0x16')][_0x143e('0x14')]);}})[_0x143e('0x17')](function(_0x502fe0){logger[_0x143e('0x13')](_0x143e('0xe'),_0x1d26b2,_0x502fe0);_0x23ba0a(_0x502fe0);});});} \ No newline at end of file +var _0xdfe2=['then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3d7478,_0xbfb261){var _0x41e45a=function(_0x13a173){while(--_0x13a173){_0x3d7478['push'](_0x3d7478['shift']());}};_0x41e45a(++_0xbfb261);}(_0xdfe2,0xa5));var _0x2dfe=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xdfe2[_0x4ae829];return _0x256b31;};'use strict';var _=require('lodash');var util=require(_0x2dfe('0x0'));var moment=require(_0x2dfe('0x1'));var BPromise=require('bluebird');var rs=require(_0x2dfe('0x2'));var fs=require('fs');var Redis=require(_0x2dfe('0x3'));var db=require(_0x2dfe('0x4'))['db'];var utils=require(_0x2dfe('0x5'));var logger=require(_0x2dfe('0x6'))(_0x2dfe('0x7'));var config=require(_0x2dfe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2dfe('0x9')][_0x2dfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d7dc1,_0x5a094d,_0x330f11){return new BPromise(function(_0x4b2f0d,_0x513c1a){return client['request'](_0x2d7dc1,_0x330f11)[_0x2dfe('0xb')](function(_0x5c2621){logger['info'](_0x2dfe('0xc'),_0x5a094d,_0x2dfe('0xd'));logger[_0x2dfe('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x5a094d,_0x2dfe('0xd'),JSON[_0x2dfe('0xf')](_0x5c2621));if(_0x5c2621[_0x2dfe('0x10')]){if(_0x5c2621['error'][_0x2dfe('0x11')]===0x1f4){logger['error'](_0x2dfe('0xc'),_0x5a094d,_0x5c2621[_0x2dfe('0x10')][_0x2dfe('0x12')]);return _0x513c1a(_0x5c2621[_0x2dfe('0x10')][_0x2dfe('0x12')]);}logger['error'](_0x2dfe('0xc'),_0x5a094d,_0x5c2621['error']['message']);return _0x4b2f0d(_0x5c2621[_0x2dfe('0x10')][_0x2dfe('0x12')]);}else{logger[_0x2dfe('0x13')](_0x2dfe('0xc'),_0x5a094d,'request\x20sent');_0x4b2f0d(_0x5c2621[_0x2dfe('0x14')]['message']);}})[_0x2dfe('0x15')](function(_0x24b139){logger[_0x2dfe('0x10')](_0x2dfe('0xc'),_0x5a094d,_0x24b139);_0x513c1a(_0x24b139);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 965dffb..e532eff 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1ee7e4,_0x4ba132){var _0x4a99aa=function(_0x115d2d){while(--_0x115d2d){_0x1ee7e4['push'](_0x1ee7e4['shift']());}};_0x4a99aa(++_0x4ba132);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5defe5,_0x454030){var _0x1a53f2=function(_0x5d5502){while(--_0x5d5502){_0x5defe5['push'](_0x5defe5['shift']());}};_0x1a53f2(++_0x454030);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 28fbce1..92bd4b0 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 _0x5c89=['STRING','INTEGER','state','sequelize','exports','unique_name_and_version'];(function(_0x15f6f8,_0x8932b8){var _0x477e10=function(_0xf68fc9){while(--_0xf68fc9){_0x15f6f8['push'](_0x15f6f8['shift']());}};_0x477e10(++_0x8932b8);}(_0x5c89,0x69));var _0x95c8=function(_0xfa79a5,_0x256ce5){_0xfa79a5=_0xfa79a5-0x0;var _0x41e7b9=_0x5c89[_0xfa79a5];return _0x41e7b9;};'use strict';var Sequelize=require(_0x95c8('0x0'));module[_0x95c8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x95c8('0x2')},'version':{'type':Sequelize[_0x95c8('0x3')],'allowNull':![],'unique':_0x95c8('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x95c8('0x3')]},'path':{'type':Sequelize[_0x95c8('0x3')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x95c8('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x95c8('0x3')]},'logo':{'type':Sequelize[_0x95c8('0x3')]},'state':{'type':Sequelize[_0x95c8('0x3')],'unique':_0x95c8('0x5')},'description':{'type':Sequelize[_0x95c8('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x95c8('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4d04=['INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x4d04,0xf3));var _0x44d0=function(_0x1162b8,_0x2a9bcf){_0x1162b8=_0x1162b8-0x0;var _0x1e9b84=_0x4d04[_0x1162b8];return _0x1e9b84;};'use strict';var Sequelize=require('sequelize');module[_0x44d0('0x0')]={'name':{'type':Sequelize[_0x44d0('0x1')],'allowNull':![],'unique':_0x44d0('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x44d0('0x2')},'main':{'type':Sequelize[_0x44d0('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x44d0('0x1')]},'path':{'type':Sequelize[_0x44d0('0x1')]},'type':{'type':Sequelize[_0x44d0('0x1')]},'size':{'type':Sequelize[_0x44d0('0x3')]},'active':{'type':Sequelize[_0x44d0('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x44d0('0x1')]},'logo':{'type':Sequelize[_0x44d0('0x1')]},'state':{'type':Sequelize[_0x44d0('0x1')],'unique':_0x44d0('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x44d0('0x1')]},'link':{'type':Sequelize[_0x44d0('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 456dfa1..2aa8f57 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 _0x4888=['lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','Integration','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x47d408,_0x581ad4){var _0x700cd2=function(_0x17c587){while(--_0x17c587){_0x47d408['push'](_0x47d408['shift']());}};_0x700cd2(++_0x581ad4);}(_0x4888,0x198));var _0x8488=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x4888[_0x34325b];return _0x3da348;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['Integration']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));}; \ No newline at end of file +var _0x2a07=['name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2a07,0x74));var _0x72a0=function(_0x28fde4,_0x4fbc40){_0x28fde4=_0x28fde4-0x0;var _0xdc3f1b=_0x2a07[_0x28fde4];return _0xdc3f1b;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['Integration'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['Integration']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1435705..5cdee5c 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 _0x8d42=['define','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./integration.attributes','exports'];(function(_0x2bea3a,_0x43b0de){var _0x371f0f=function(_0x42f2b6){while(--_0x42f2b6){_0x2bea3a['push'](_0x2bea3a['shift']());}};_0x371f0f(++_0x43b0de);}(_0x8d42,0xdd));var _0x28d4=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x8d42[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x28d4('0x0'));var util=require('util');var logger=require(_0x28d4('0x1'))(_0x28d4('0x2'));var moment=require(_0x28d4('0x3'));var BPromise=require(_0x28d4('0x4'));var rp=require(_0x28d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x28d4('0x7'));module[_0x28d4('0x8')]=function(_0x5ebbe5,_0x45ee9d){return _0x5ebbe5[_0x28d4('0x9')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x886c=['rimraf','../../config/environment','./integration.attributes','exports','define','integrations','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x886c,0x72));var _0xc886=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x886c[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xc886('0x0'));var logger=require(_0xc886('0x1'))(_0xc886('0x2'));var moment=require(_0xc886('0x3'));var BPromise=require('bluebird');var rp=require(_0xc886('0x4'));var fs=require('fs');var path=require(_0xc886('0x5'));var rimraf=require(_0xc886('0x6'));var config=require(_0xc886('0x7'));var attributes=require(_0xc886('0x8'));module[_0xc886('0x9')]=function(_0x286241,_0x18c210){return _0x286241[_0xc886('0xa')]('Integration',attributes,{'tableName':_0xc886('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 03afb64..5fcdd1e 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x3f3bcf,_0x54a737){var _0x29fbc1=function(_0x367ba4){while(--_0x367ba4){_0x3f3bcf['push'](_0x3f3bcf['shift']());}};_0x29fbc1(++_0x54a737);}(_0x66fa,0x117));var _0xa66f=function(_0x5ea73d,_0x3b5bd9){_0x5ea73d=_0x5ea73d-0x0;var _0x5cdce2=_0x66fa[_0x5ea73d];return _0x5cdce2;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x50d527,_0x5a9e5b){var _0x57f1b1=function(_0x545805){while(--_0x545805){_0x50d527['push'](_0x50d527['shift']());}};_0x57f1b1(++_0x5a9e5b);}(_0x14a0,0x8e));var _0x014a=function(_0x230b13,_0x2b43ae){_0x230b13=_0x230b13-0x0;var _0x14890e=_0x14a0[_0x230b13];return _0x14890e;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index c905fd0..bd98476 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(_0x9fa52e,_0x2c1233){var _0x3794d8=function(_0x751b66){while(--_0x751b66){_0x9fa52e['push'](_0x9fa52e['shift']());}};_0x3794d8(++_0x2c1233);}(_0x955f,0x1eb));var _0xf955=function(_0x4c7396,_0x5120a4){_0x4c7396=_0x4c7396-0x0;var _0x55c8bb=_0x955f[_0x4c7396];return _0x55c8bb;};'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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 32e8015..8fe054f 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 _0xd76e=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xd76e,0x18b));var _0xed76=function(_0x32f1b6,_0x454001){_0x32f1b6=_0x32f1b6-0x0;var _0x5dbabf=_0xd76e[_0x32f1b6];return _0x5dbabf;};'use strict';var Sequelize=require('sequelize');module[_0xed76('0x0')]={'integration':{'type':Sequelize[_0xed76('0x1')]},'eventChannel':{'type':Sequelize[_0xed76('0x1')]},'exitStatus':{'type':Sequelize[_0xed76('0x1')]},'ticketId':{'type':Sequelize[_0xed76('0x1')]},'integrationId':{'type':Sequelize[_0xed76('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xed76('0x1')]},'calleridnum':{'type':Sequelize[_0xed76('0x1')]},'calleridname':{'type':Sequelize[_0xed76('0x1')]},'queue':{'type':Sequelize[_0xed76('0x1')]},'interface':{'type':Sequelize[_0xed76('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xed76('0x3')]},'agentconnectAt':{'type':Sequelize[_0xed76('0x3')]},'holdtime':{'type':Sequelize[_0xed76('0x2')]},'agentcomplete':{'type':Sequelize[_0xed76('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xed76('0x3')]},'talktime':{'type':Sequelize[_0xed76('0x2')]},'agentacw':{'type':Sequelize[_0xed76('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xed76('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xed76('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xed76('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xed76('0x3')]},'lastevent':{'type':Sequelize[_0xed76('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xed76('0x1')]},'connectedlinenum':{'type':Sequelize[_0xed76('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xed76('0x1')]},'accountcode':{'type':Sequelize[_0xed76('0x1')]},'context':{'type':Sequelize[_0xed76('0x1')]},'exten':{'type':Sequelize[_0xed76('0x1')]},'priority':{'type':Sequelize[_0xed76('0x1')]},'destchannel':{'type':Sequelize[_0xed76('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xed76('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xed76('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xed76('0x1')]},'destaccountcode':{'type':Sequelize[_0xed76('0x1')]},'destcontext':{'type':Sequelize[_0xed76('0x1')]},'destexten':{'type':Sequelize[_0xed76('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xed76('0x1')]},'messageId':{'type':Sequelize[_0xed76('0x1')]},'inReplyTo':{'type':Sequelize[_0xed76('0x1')]},'subject':{'type':Sequelize[_0xed76('0x1')]},'from':{'type':Sequelize[_0xed76('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xed76('0x1')]},'attachment':{'type':Sequelize[_0xed76('0x5')]},'html':{'type':Sequelize[_0xed76('0x5')]},'text':{'type':Sequelize[_0xed76('0x5')]},'status':{'type':Sequelize[_0xed76('0x6')]('SENT',_0xed76('0x7'),_0xed76('0x8'),'FAILED')},'url':{'type':Sequelize[_0xed76('0x1')]},'app':{'type':Sequelize[_0xed76('0x1')]},'appdata':{'type':Sequelize[_0xed76('0x1')]},'projectId':{'type':Sequelize[_0xed76('0x2')]}}; \ No newline at end of file +var _0xecf0=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','sequelize','exports','STRING'];(function(_0x20ecff,_0xbf3b22){var _0x4cf446=function(_0x15555b){while(--_0x15555b){_0x20ecff['push'](_0x20ecff['shift']());}};_0x4cf446(++_0xbf3b22);}(_0xecf0,0x84));var _0x0ecf=function(_0x4879ec,_0x244a74){_0x4879ec=_0x4879ec-0x0;var _0xbbe1ad=_0xecf0[_0x4879ec];return _0xbbe1ad;};'use strict';var Sequelize=require(_0x0ecf('0x0'));module[_0x0ecf('0x1')]={'integration':{'type':Sequelize[_0x0ecf('0x2')]},'eventChannel':{'type':Sequelize[_0x0ecf('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x0ecf('0x2')]},'integrationId':{'type':Sequelize[_0x0ecf('0x3')]},'contacts':{'type':Sequelize[_0x0ecf('0x2')]},'uniqueid':{'type':Sequelize[_0x0ecf('0x2')]},'calleridnum':{'type':Sequelize[_0x0ecf('0x2')]},'calleridname':{'type':Sequelize[_0x0ecf('0x2')]},'queue':{'type':Sequelize[_0x0ecf('0x2')]},'interface':{'type':Sequelize[_0x0ecf('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0ecf('0x4')]},'agentconnectAt':{'type':Sequelize[_0x0ecf('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0ecf('0x4')]},'talktime':{'type':Sequelize[_0x0ecf('0x3')]},'agentacw':{'type':Sequelize[_0x0ecf('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0ecf('0x3')]},'reason':{'type':Sequelize[_0x0ecf('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x0ecf('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0ecf('0x4')]},'agentdump':{'type':Sequelize[_0x0ecf('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x0ecf('0x2')]},'channel':{'type':Sequelize[_0x0ecf('0x2')]},'channelstate':{'type':Sequelize[_0x0ecf('0x3')]},'channelstatedesc':{'type':Sequelize[_0x0ecf('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0ecf('0x2')]},'connectedlinename':{'type':Sequelize[_0x0ecf('0x2')]},'language':{'type':Sequelize[_0x0ecf('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0ecf('0x2')]},'exten':{'type':Sequelize[_0x0ecf('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x0ecf('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0ecf('0x2')]},'destcalleridname':{'type':Sequelize[_0x0ecf('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x0ecf('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x0ecf('0x2')]},'destlanguage':{'type':Sequelize[_0x0ecf('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x0ecf('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x0ecf('0x2')]},'destuniqueid':{'type':Sequelize[_0x0ecf('0x2')]},'messageId':{'type':Sequelize[_0x0ecf('0x2')]},'inReplyTo':{'type':Sequelize[_0x0ecf('0x2')]},'subject':{'type':Sequelize[_0x0ecf('0x2')]},'from':{'type':Sequelize[_0x0ecf('0x2')]},'to':{'type':Sequelize[_0x0ecf('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x0ecf('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x0ecf('0x6')]},'status':{'type':Sequelize[_0x0ecf('0x7')]('SENT',_0x0ecf('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x0ecf('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x0ecf('0x2')]},'projectId':{'type':Sequelize[_0x0ecf('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8711f2a..4813aa2 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 _0xc187=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','type','VIRTUAL','options','IntegrationReport','includeAll','include','rows','catch','show','params','merge','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2b20cc,_0x34eadd){var _0x19c1aa=function(_0x3051bc){while(--_0x3051bc){_0x2b20cc['push'](_0x2b20cc['shift']());}};_0x19c1aa(++_0x34eadd);}(_0xc187,0x1b2));var _0x7c18=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc187[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x7c18('0x0'));var rimraf=require(_0x7c18('0x1'));var zipdir=require(_0x7c18('0x2'));var jsonpatch=require(_0x7c18('0x3'));var rp=require(_0x7c18('0x4'));var moment=require(_0x7c18('0x5'));var BPromise=require(_0x7c18('0x6'));var Mustache=require(_0x7c18('0x7'));var util=require(_0x7c18('0x8'));var path=require(_0x7c18('0x9'));var sox=require(_0x7c18('0xa'));var csv=require(_0x7c18('0xb'));var ejs=require(_0x7c18('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c18('0xd'));var squel=require(_0x7c18('0xe'));var crypto=require(_0x7c18('0xf'));var jsforce=require(_0x7c18('0x10'));var deskjs=require(_0x7c18('0x11'));var toCsv=require(_0x7c18('0xb'));var querystring=require('querystring');var Papa=require(_0x7c18('0x12'));var Redis=require(_0x7c18('0x13'));var authService=require(_0x7c18('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7c18('0x15'));var utils=require(_0x7c18('0x16'));var config=require(_0x7c18('0x17'));var licenseUtil=require(_0x7c18('0x18'));var db=require(_0x7c18('0x19'))['db'];function respondWithStatusCode(_0x1369c9,_0x5222c4){_0x5222c4=_0x5222c4||0xcc;return function(_0x511085){if(_0x511085){return _0x1369c9[_0x7c18('0x1a')](_0x5222c4);}return _0x1369c9[_0x7c18('0x1b')](_0x5222c4)[_0x7c18('0x1c')]();};}function respondWithResult(_0x6951d2,_0x33d851){_0x33d851=_0x33d851||0xc8;return function(_0x222a71){if(_0x222a71){return _0x6951d2[_0x7c18('0x1b')](_0x33d851)['json'](_0x222a71);}};}function respondWithFilteredResult(_0x3c8b40,_0x2769df){return function(_0x3abf5a){if(_0x3abf5a){var _0x4cc650=typeof _0x2769df[_0x7c18('0x1d')]===_0x7c18('0x1e')&&typeof _0x2769df[_0x7c18('0x1f')]==='undefined';var _0x38f581=_0x3abf5a[_0x7c18('0x20')];var _0x4a68e9=_0x4cc650?0x0:_0x2769df['offset'];var _0x5c6aa7=_0x4cc650?_0x3abf5a['count']:_0x2769df['offset']+_0x2769df[_0x7c18('0x1f')];var _0x225bef;if(_0x5c6aa7>=_0x38f581){_0x5c6aa7=_0x38f581;_0x225bef=0xc8;}else{_0x225bef=0xce;}_0x3c8b40[_0x7c18('0x1b')](_0x225bef);return _0x3c8b40[_0x7c18('0x21')]('Content-Range',_0x4a68e9+'-'+_0x5c6aa7+'/'+_0x38f581)[_0x7c18('0x22')](_0x3abf5a);}return null;};}function patchUpdates(_0xd7afc7){return function(_0x556543){try{jsonpatch[_0x7c18('0x23')](_0x556543,_0xd7afc7,!![]);}catch(_0x226db2){return BPromise['reject'](_0x226db2);}return _0x556543['save']();};}function saveUpdates(_0x391110,_0x1af890){return function(_0x15ecf6){if(_0x15ecf6){return _0x15ecf6[_0x7c18('0x24')](_0x391110)[_0x7c18('0x25')](function(_0x36d369){return _0x36d369;});}return null;};}function removeEntity(_0x42eb12,_0x189f5d){return function(_0x9978f8){if(_0x9978f8){return _0x9978f8[_0x7c18('0x26')]()[_0x7c18('0x25')](function(){_0x42eb12['status'](0xcc)[_0x7c18('0x1c')]();});}};}function handleEntityNotFound(_0x337cdf,_0x567f93){return function(_0x437097){if(!_0x437097){_0x337cdf[_0x7c18('0x1a')](0x194);}return _0x437097;};}function handleError(_0x1f9183,_0x44eff4){_0x44eff4=_0x44eff4||0x1f4;return function(_0x29fcba){logger[_0x7c18('0x27')](_0x29fcba[_0x7c18('0x28')]);if(_0x29fcba[_0x7c18('0x29')]){delete _0x29fcba[_0x7c18('0x29')];}_0x1f9183['status'](_0x44eff4)[_0x7c18('0x2a')](_0x29fcba);};}exports[_0x7c18('0x2b')]=function(_0x3ef505,_0xbcd78f){var _0xc2e442={},_0x20faba={},_0x3bde95={'count':0x0,'rows':[]};var _0x4de6be=_[_0x7c18('0x2c')](db['IntegrationReport'][_0x7c18('0x2d')],function(_0x3d67dd){return{'name':_0x3d67dd['fieldName'],'type':_0x3d67dd['type'][_0x7c18('0x2e')]};});_0x20faba[_0x7c18('0x2f')]=_[_0x7c18('0x2c')](_0x4de6be,_0x7c18('0x29'));_0x20faba['query']=_[_0x7c18('0x30')](_0x3ef505[_0x7c18('0x31')]);_0x20faba['filters']=_['intersection'](_0x20faba[_0x7c18('0x2f')],_0x20faba['query']);_0xc2e442[_0x7c18('0x32')]=_[_0x7c18('0x33')](_0x20faba[_0x7c18('0x2f')],qs[_0x7c18('0x34')](_0x3ef505['query'][_0x7c18('0x34')]));_0xc2e442[_0x7c18('0x32')]=_0xc2e442['attributes'][_0x7c18('0x35')]?_0xc2e442[_0x7c18('0x32')]:_0x20faba[_0x7c18('0x2f')];if(!_0x3ef505[_0x7c18('0x31')]['hasOwnProperty'](_0x7c18('0x36'))){_0xc2e442[_0x7c18('0x1f')]=qs[_0x7c18('0x1f')](_0x3ef505[_0x7c18('0x31')][_0x7c18('0x1f')]);_0xc2e442[_0x7c18('0x1d')]=qs['offset'](_0x3ef505[_0x7c18('0x31')][_0x7c18('0x1d')]);}_0xc2e442['order']=qs[_0x7c18('0x37')](_0x3ef505[_0x7c18('0x31')][_0x7c18('0x37')]);_0xc2e442[_0x7c18('0x38')]=qs['filters'](_['pick'](_0x3ef505[_0x7c18('0x31')],_0x20faba[_0x7c18('0x39')]),_0x4de6be);if(_0x3ef505[_0x7c18('0x31')][_0x7c18('0x3a')]){_0xc2e442['where']=_['merge'](_0xc2e442['where'],{'$or':_[_0x7c18('0x2c')](_0x4de6be,function(_0x3aeeae){if(_0x3aeeae[_0x7c18('0x3b')]!==_0x7c18('0x3c')){var _0x574dff={};_0x574dff[_0x3aeeae[_0x7c18('0x29')]]={'$like':'%'+_0x3ef505[_0x7c18('0x31')][_0x7c18('0x3a')]+'%'};return _0x574dff;}})});}_0xc2e442=_['merge']({},_0xc2e442,_0x3ef505[_0x7c18('0x3d')]);var _0x190f29={'where':_0xc2e442['where']};return db[_0x7c18('0x3e')][_0x7c18('0x20')](_0x190f29)['then'](function(_0x29500a){_0x3bde95[_0x7c18('0x20')]=_0x29500a;if(_0x3ef505['query'][_0x7c18('0x3f')]){_0xc2e442[_0x7c18('0x40')]=[{'all':!![]}];}return db[_0x7c18('0x3e')]['findAll'](_0xc2e442);})[_0x7c18('0x25')](function(_0x100665){_0x3bde95[_0x7c18('0x41')]=_0x100665;return _0x3bde95;})[_0x7c18('0x25')](respondWithFilteredResult(_0xbcd78f,_0xc2e442))[_0x7c18('0x42')](handleError(_0xbcd78f,null));};exports[_0x7c18('0x43')]=function(_0x23c936,_0xae3958){var _0x1929ad={'raw':![],'where':{'id':_0x23c936[_0x7c18('0x44')]['id']}},_0x3522b5={};_0x3522b5['model']=_['keys'](db[_0x7c18('0x3e')][_0x7c18('0x2d')]);_0x3522b5[_0x7c18('0x31')]=_['keys'](_0x23c936[_0x7c18('0x31')]);_0x3522b5[_0x7c18('0x39')]=_[_0x7c18('0x33')](_0x3522b5[_0x7c18('0x2f')],_0x3522b5[_0x7c18('0x31')]);_0x1929ad['attributes']=_['intersection'](_0x3522b5[_0x7c18('0x2f')],qs[_0x7c18('0x34')](_0x23c936[_0x7c18('0x31')]['fields']));_0x1929ad[_0x7c18('0x32')]=_0x1929ad[_0x7c18('0x32')]['length']?_0x1929ad['attributes']:_0x3522b5[_0x7c18('0x2f')];if(_0x23c936[_0x7c18('0x31')][_0x7c18('0x3f')]){_0x1929ad['include']=[{'all':!![]}];}_0x1929ad=_[_0x7c18('0x45')]({},_0x1929ad,_0x23c936[_0x7c18('0x3d')]);return db[_0x7c18('0x3e')]['find'](_0x1929ad)['then'](handleEntityNotFound(_0xae3958,null))['then'](respondWithResult(_0xae3958,null))[_0x7c18('0x42')](handleError(_0xae3958,null));};exports[_0x7c18('0x46')]=function(_0x4ab1a9,_0x4cd291){return db['IntegrationReport'][_0x7c18('0x46')](_0x4ab1a9[_0x7c18('0x47')],{})[_0x7c18('0x25')](respondWithResult(_0x4cd291,0xc9))[_0x7c18('0x42')](handleError(_0x4cd291,null));};exports[_0x7c18('0x24')]=function(_0x54962b,_0xf626ac){if(_0x54962b['body']['id']){delete _0x54962b[_0x7c18('0x47')]['id'];}return db[_0x7c18('0x3e')][_0x7c18('0x48')]({'where':{'id':_0x54962b[_0x7c18('0x44')]['id']}})[_0x7c18('0x25')](handleEntityNotFound(_0xf626ac,null))[_0x7c18('0x25')](saveUpdates(_0x54962b[_0x7c18('0x47')],null))[_0x7c18('0x25')](respondWithResult(_0xf626ac,null))[_0x7c18('0x42')](handleError(_0xf626ac,null));};exports[_0x7c18('0x26')]=function(_0x2beec3,_0x5d1d88){return db['IntegrationReport']['find']({'where':{'id':_0x2beec3[_0x7c18('0x44')]['id']}})[_0x7c18('0x25')](handleEntityNotFound(_0x5d1d88,null))['then'](removeEntity(_0x5d1d88,null))[_0x7c18('0x42')](handleError(_0x5d1d88,null));};exports[_0x7c18('0x49')]=function(_0x5e5770,_0xc31deb){return db[_0x7c18('0x3e')][_0x7c18('0x49')]()[_0x7c18('0x25')](respondWithResult(_0xc31deb,null))[_0x7c18('0x42')](handleError(_0xc31deb,null));}; \ No newline at end of file +var _0x82e4=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','IntegrationReport','fieldName','type','model','map','query','keys','filters','intersection'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x82e4,0x184));var _0x482e=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x82e4[_0x1e17eb];return _0x4de4c7;};'use strict';var emlformat=require(_0x482e('0x0'));var rimraf=require(_0x482e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x482e('0x2'));var moment=require(_0x482e('0x3'));var BPromise=require(_0x482e('0x4'));var Mustache=require(_0x482e('0x5'));var util=require(_0x482e('0x6'));var path=require(_0x482e('0x7'));var sox=require('sox');var csv=require(_0x482e('0x8'));var ejs=require(_0x482e('0x9'));var fs=require('fs');var fs_extra=require(_0x482e('0xa'));var _=require(_0x482e('0xb'));var squel=require(_0x482e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x482e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x482e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x482e('0xf'));var hardwareService=require(_0x482e('0x10'));var logger=require('../../config/logger')(_0x482e('0x11'));var utils=require(_0x482e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x482e('0x13'));var db=require(_0x482e('0x14'))['db'];function respondWithStatusCode(_0x38196e,_0x4d24be){_0x4d24be=_0x4d24be||0xcc;return function(_0x483588){if(_0x483588){return _0x38196e[_0x482e('0x15')](_0x4d24be);}return _0x38196e[_0x482e('0x16')](_0x4d24be)[_0x482e('0x17')]();};}function respondWithResult(_0x1d3507,_0x140e27){_0x140e27=_0x140e27||0xc8;return function(_0x5ae036){if(_0x5ae036){return _0x1d3507['status'](_0x140e27)[_0x482e('0x18')](_0x5ae036);}};}function respondWithFilteredResult(_0x3668d,_0x3fc63b){return function(_0x3cc21a){if(_0x3cc21a){var _0x36430c=typeof _0x3fc63b[_0x482e('0x19')]===_0x482e('0x1a')&&typeof _0x3fc63b['limit']===_0x482e('0x1a');var _0x5c076a=_0x3cc21a[_0x482e('0x1b')];var _0x3f4903=_0x36430c?0x0:_0x3fc63b[_0x482e('0x19')];var _0x2f0ecd=_0x36430c?_0x3cc21a['count']:_0x3fc63b[_0x482e('0x19')]+_0x3fc63b[_0x482e('0x1c')];var _0x5dacde;if(_0x2f0ecd>=_0x5c076a){_0x2f0ecd=_0x5c076a;_0x5dacde=0xc8;}else{_0x5dacde=0xce;}_0x3668d['status'](_0x5dacde);return _0x3668d['set'](_0x482e('0x1d'),_0x3f4903+'-'+_0x2f0ecd+'/'+_0x5c076a)[_0x482e('0x18')](_0x3cc21a);}return null;};}function patchUpdates(_0x5ba7fd){return function(_0x61d872){try{jsonpatch[_0x482e('0x1e')](_0x61d872,_0x5ba7fd,!![]);}catch(_0x3891cd){return BPromise[_0x482e('0x1f')](_0x3891cd);}return _0x61d872[_0x482e('0x20')]();};}function saveUpdates(_0x27fef2,_0x3689f3){return function(_0x13df13){if(_0x13df13){return _0x13df13[_0x482e('0x21')](_0x27fef2)[_0x482e('0x22')](function(_0x1a703c){return _0x1a703c;});}return null;};}function removeEntity(_0x560063,_0x4c7396){return function(_0x32492b){if(_0x32492b){return _0x32492b[_0x482e('0x23')]()[_0x482e('0x22')](function(){_0x560063[_0x482e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa6053,_0x4d6021){return function(_0x1c65f8){if(!_0x1c65f8){_0xa6053['sendStatus'](0x194);}return _0x1c65f8;};}function handleError(_0x2fd4b6,_0x4b0c53){_0x4b0c53=_0x4b0c53||0x1f4;return function(_0x3fcaa2){logger[_0x482e('0x24')](_0x3fcaa2[_0x482e('0x25')]);if(_0x3fcaa2[_0x482e('0x26')]){delete _0x3fcaa2['name'];}_0x2fd4b6[_0x482e('0x16')](_0x4b0c53)[_0x482e('0x27')](_0x3fcaa2);};}exports[_0x482e('0x28')]=function(_0x16a43e,_0x3f5870){var _0x335005={},_0x180abe={},_0x38ecde={'count':0x0,'rows':[]};var _0x248cd6=_['map'](db[_0x482e('0x29')]['rawAttributes'],function(_0x57306a){return{'name':_0x57306a[_0x482e('0x2a')],'type':_0x57306a[_0x482e('0x2b')]['key']};});_0x180abe[_0x482e('0x2c')]=_[_0x482e('0x2d')](_0x248cd6,_0x482e('0x26'));_0x180abe[_0x482e('0x2e')]=_[_0x482e('0x2f')](_0x16a43e[_0x482e('0x2e')]);_0x180abe[_0x482e('0x30')]=_[_0x482e('0x31')](_0x180abe[_0x482e('0x2c')],_0x180abe[_0x482e('0x2e')]);_0x335005[_0x482e('0x32')]=_[_0x482e('0x31')](_0x180abe[_0x482e('0x2c')],qs[_0x482e('0x33')](_0x16a43e[_0x482e('0x2e')][_0x482e('0x33')]));_0x335005[_0x482e('0x32')]=_0x335005[_0x482e('0x32')][_0x482e('0x34')]?_0x335005[_0x482e('0x32')]:_0x180abe[_0x482e('0x2c')];if(!_0x16a43e[_0x482e('0x2e')][_0x482e('0x35')](_0x482e('0x36'))){_0x335005['limit']=qs[_0x482e('0x1c')](_0x16a43e[_0x482e('0x2e')][_0x482e('0x1c')]);_0x335005[_0x482e('0x19')]=qs[_0x482e('0x19')](_0x16a43e[_0x482e('0x2e')][_0x482e('0x19')]);}_0x335005[_0x482e('0x37')]=qs[_0x482e('0x38')](_0x16a43e[_0x482e('0x2e')]['sort']);_0x335005[_0x482e('0x39')]=qs[_0x482e('0x30')](_[_0x482e('0x3a')](_0x16a43e['query'],_0x180abe[_0x482e('0x30')]),_0x248cd6);if(_0x16a43e[_0x482e('0x2e')]['filter']){_0x335005[_0x482e('0x39')]=_[_0x482e('0x3b')](_0x335005['where'],{'$or':_['map'](_0x248cd6,function(_0xcfa4cd){if(_0xcfa4cd['type']!==_0x482e('0x3c')){var _0x49a704={};_0x49a704[_0xcfa4cd[_0x482e('0x26')]]={'$like':'%'+_0x16a43e[_0x482e('0x2e')]['filter']+'%'};return _0x49a704;}})});}_0x335005=_[_0x482e('0x3b')]({},_0x335005,_0x16a43e[_0x482e('0x3d')]);var _0x54eb43={'where':_0x335005[_0x482e('0x39')]};return db[_0x482e('0x29')][_0x482e('0x1b')](_0x54eb43)[_0x482e('0x22')](function(_0x5031c6){_0x38ecde[_0x482e('0x1b')]=_0x5031c6;if(_0x16a43e['query'][_0x482e('0x3e')]){_0x335005[_0x482e('0x3f')]=[{'all':!![]}];}return db['IntegrationReport'][_0x482e('0x40')](_0x335005);})[_0x482e('0x22')](function(_0xf716a9){_0x38ecde[_0x482e('0x41')]=_0xf716a9;return _0x38ecde;})[_0x482e('0x22')](respondWithFilteredResult(_0x3f5870,_0x335005))[_0x482e('0x42')](handleError(_0x3f5870,null));};exports['show']=function(_0x5eb07d,_0x599f01){var _0x2ab586={'raw':![],'where':{'id':_0x5eb07d['params']['id']}},_0x571384={};_0x571384[_0x482e('0x2c')]=_['keys'](db[_0x482e('0x29')][_0x482e('0x43')]);_0x571384[_0x482e('0x2e')]=_[_0x482e('0x2f')](_0x5eb07d['query']);_0x571384[_0x482e('0x30')]=_[_0x482e('0x31')](_0x571384['model'],_0x571384[_0x482e('0x2e')]);_0x2ab586[_0x482e('0x32')]=_[_0x482e('0x31')](_0x571384['model'],qs[_0x482e('0x33')](_0x5eb07d[_0x482e('0x2e')]['fields']));_0x2ab586[_0x482e('0x32')]=_0x2ab586[_0x482e('0x32')]['length']?_0x2ab586[_0x482e('0x32')]:_0x571384[_0x482e('0x2c')];if(_0x5eb07d[_0x482e('0x2e')]['includeAll']){_0x2ab586[_0x482e('0x3f')]=[{'all':!![]}];}_0x2ab586=_[_0x482e('0x3b')]({},_0x2ab586,_0x5eb07d[_0x482e('0x3d')]);return db[_0x482e('0x29')][_0x482e('0x44')](_0x2ab586)['then'](handleEntityNotFound(_0x599f01,null))[_0x482e('0x22')](respondWithResult(_0x599f01,null))[_0x482e('0x42')](handleError(_0x599f01,null));};exports[_0x482e('0x45')]=function(_0x5c0690,_0x2c24ae){return db[_0x482e('0x29')][_0x482e('0x45')](_0x5c0690[_0x482e('0x46')],{})[_0x482e('0x22')](respondWithResult(_0x2c24ae,0xc9))[_0x482e('0x42')](handleError(_0x2c24ae,null));};exports[_0x482e('0x21')]=function(_0xf12e32,_0x18e2a5){if(_0xf12e32['body']['id']){delete _0xf12e32['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0xf12e32['params']['id']}})[_0x482e('0x22')](handleEntityNotFound(_0x18e2a5,null))[_0x482e('0x22')](saveUpdates(_0xf12e32[_0x482e('0x46')],null))[_0x482e('0x22')](respondWithResult(_0x18e2a5,null))['catch'](handleError(_0x18e2a5,null));};exports[_0x482e('0x23')]=function(_0x49390f,_0x35c938){return db[_0x482e('0x29')]['find']({'where':{'id':_0x49390f[_0x482e('0x47')]['id']}})[_0x482e('0x22')](handleEntityNotFound(_0x35c938,null))[_0x482e('0x22')](removeEntity(_0x35c938,null))['catch'](handleError(_0x35c938,null));};exports[_0x482e('0x48')]=function(_0x484025,_0x352cf2){return db[_0x482e('0x29')]['describe']()[_0x482e('0x22')](respondWithResult(_0x352cf2,null))[_0x482e('0x42')](handleError(_0x352cf2,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a8621ce..1afe893 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 _0xc3fc=['../../config/logger','api','moment','bluebird','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x32a933,_0x42db57){var _0x174076=function(_0x3f4f3c){while(--_0x3f4f3c){_0x32a933['push'](_0x32a933['shift']());}};_0x174076(++_0x42db57);}(_0xc3fc,0x106));var _0xcc3f=function(_0xb8695,_0x104627){_0xb8695=_0xb8695-0x0;var _0x5b7532=_0xc3fc[_0xb8695];return _0x5b7532;};'use strict';var _=require(_0xcc3f('0x0'));var util=require(_0xcc3f('0x1'));var logger=require(_0xcc3f('0x2'))(_0xcc3f('0x3'));var moment=require(_0xcc3f('0x4'));var BPromise=require(_0xcc3f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcc3f('0x6'));var config=require('../../config/environment');var attributes=require(_0xcc3f('0x7'));module[_0xcc3f('0x8')]=function(_0x324b8e,_0x542e86){return _0x324b8e[_0xcc3f('0x9')](_0xcc3f('0xa'),attributes,{'tableName':_0xcc3f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1144=['api','moment','path','../../config/environment','IntegrationReport','report_integration','util','../../config/logger'];(function(_0x5d71c9,_0xd8f0d2){var _0x160f2c=function(_0xcb697a){while(--_0xcb697a){_0x5d71c9['push'](_0x5d71c9['shift']());}};_0x160f2c(++_0xd8f0d2);}(_0x1144,0xd6));var _0x4114=function(_0x36bfec,_0x44cae7){_0x36bfec=_0x36bfec-0x0;var _0x466fc4=_0x1144[_0x36bfec];return _0x466fc4;};'use strict';var _=require('lodash');var util=require(_0x4114('0x0'));var logger=require(_0x4114('0x1'))(_0x4114('0x2'));var moment=require(_0x4114('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4114('0x4'));var rimraf=require('rimraf');var config=require(_0x4114('0x5'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x126641,_0x118c4e){return _0x126641['define'](_0x4114('0x6'),attributes,{'tableName':_0x4114('0x7'),'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 6eefad2..6d5f3dd 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x7a29b7,_0x2e44fe){var _0x3bdfdf=function(_0x4927a4){while(--_0x4927a4){_0x7a29b7['push'](_0x7a29b7['shift']());}};_0x3bdfdf(++_0x2e44fe);}(_0x5fab,0x177));var _0xb5fa=function(_0x4a7193,_0x556c6a){_0x4a7193=_0x4a7193-0x0;var _0xc33d94=_0x5fab[_0x4a7193];return _0xc33d94;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 3d61e5a..f5d0b4d 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 _0x873a=['./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addIntervals','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3b0422,_0x820084){var _0x545e14=function(_0x1972c4){while(--_0x1972c4){_0x3b0422['push'](_0x3b0422['shift']());}};_0x545e14(++_0x820084);}(_0x873a,0x1c2));var _0xa873=function(_0x19211b,_0x455f08){_0x19211b=_0x19211b-0x0;var _0x250398=_0x873a[_0x19211b];return _0x250398;};'use strict';var multer=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var path=require(_0xa873('0x2'));var timeout=require('connect-timeout');var express=require(_0xa873('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa873('0x4'));var interaction=require(_0xa873('0x5'));var config=require('../../config/environment');var controller=require(_0xa873('0x6'));router[_0xa873('0x7')]('/',auth['isAuthenticated'](),controller[_0xa873('0x8')]);router['get'](_0xa873('0x9'),auth[_0xa873('0xa')](),controller[_0xa873('0xb')]);router[_0xa873('0x7')](_0xa873('0xc'),auth[_0xa873('0xa')](),controller[_0xa873('0xd')]);router[_0xa873('0xe')]('/',auth[_0xa873('0xa')](),controller[_0xa873('0xf')]);router[_0xa873('0xe')]('/:id/sub_intervals',auth[_0xa873('0xa')](),controller['addInterval']);router[_0xa873('0xe')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0xa873('0x10')]);router['put'](_0xa873('0x9'),auth[_0xa873('0xa')](),controller['update']);router[_0xa873('0x11')](_0xa873('0x9'),auth[_0xa873('0xa')](),controller['destroy']);module[_0xa873('0x12')]=router; \ No newline at end of file +var _0x72bd=['create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x72bd,0xcf));var _0xd72b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x72bd[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xd72b('0x0'));var util=require('util');var path=require(_0xd72b('0x1'));var timeout=require(_0xd72b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd72b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd72b('0x4'));var config=require(_0xd72b('0x5'));var controller=require(_0xd72b('0x6'));router['get']('/',auth[_0xd72b('0x7')](),controller[_0xd72b('0x8')]);router[_0xd72b('0x9')](_0xd72b('0xa'),auth[_0xd72b('0x7')](),controller[_0xd72b('0xb')]);router[_0xd72b('0x9')](_0xd72b('0xc'),auth[_0xd72b('0x7')](),controller['getIntervals']);router['post']('/',auth[_0xd72b('0x7')](),controller[_0xd72b('0xd')]);router[_0xd72b('0xe')](_0xd72b('0xc'),auth['isAuthenticated'](),controller[_0xd72b('0xf')]);router[_0xd72b('0xe')](_0xd72b('0x10'),auth[_0xd72b('0x7')](),controller[_0xd72b('0x11')]);router[_0xd72b('0x12')]('/:id',auth[_0xd72b('0x7')](),controller['update']);router[_0xd72b('0x13')](_0xd72b('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 03c19a1..ff1f030 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 _0x6fe9=['sequelize','STRING'];(function(_0x10152c,_0x33ead9){var _0x36e5a0=function(_0x163724){while(--_0x163724){_0x10152c['push'](_0x10152c['shift']());}};_0x36e5a0(++_0x33ead9);}(_0x6fe9,0x16a));var _0x96fe=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x6fe9[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0x96fe('0x0'));module['exports']={'name':{'type':Sequelize[_0x96fe('0x1')]},'description':{'type':Sequelize[_0x96fe('0x1')]},'interval':{'type':Sequelize[_0x96fe('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x85d5=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85d5,0x9a));var _0x585d=function(_0x24e48b,_0x25952f){_0x24e48b=_0x24e48b-0x0;var _0x306bea=_0x85d5[_0x24e48b];return _0x306bea;};'use strict';var Sequelize=require(_0x585d('0x0'));module[_0x585d('0x1')]={'name':{'type':Sequelize[_0x585d('0x2')]},'description':{'type':Sequelize[_0x585d('0x2')]},'interval':{'type':Sequelize[_0x585d('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 66b0e61..af316a5 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 _0x7f25=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','order','sort','options','nolimit','addIntervals','sequelize','transaction','destroy','bulkCreate','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','status','json','limit','undefined','offset','count','set','apply','save','then','Intervals','stack','name','index','map','Interval','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f25,0x177));var _0x57f2=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x7f25[_0x307086];return _0x699043;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57f2('0x0'));var zipdir=require(_0x57f2('0x1'));var jsonpatch=require(_0x57f2('0x2'));var rp=require('request-promise');var moment=require(_0x57f2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x57f2('0x4'));var util=require(_0x57f2('0x5'));var path=require(_0x57f2('0x6'));var sox=require(_0x57f2('0x7'));var csv=require(_0x57f2('0x8'));var ejs=require(_0x57f2('0x9'));var fs=require('fs');var fs_extra=require(_0x57f2('0xa'));var _=require('lodash');var squel=require(_0x57f2('0xb'));var crypto=require(_0x57f2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x57f2('0xd'));var toCsv=require(_0x57f2('0x8'));var querystring=require(_0x57f2('0xe'));var Papa=require('papaparse');var Redis=require(_0x57f2('0xf'));var authService=require(_0x57f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x57f2('0x11'));var hardwareService=require(_0x57f2('0x12'));var logger=require('../../config/logger')(_0x57f2('0x13'));var utils=require(_0x57f2('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x57f2('0x15'))['db'];var extensions=require(_0x57f2('0x16'));function respondWithStatusCode(_0x5eac67,_0x57071d){_0x57071d=_0x57071d||0xcc;return function(_0x6210da){if(_0x6210da){return _0x5eac67['sendStatus'](_0x57071d);}return _0x5eac67['status'](_0x57071d)['end']();};}function respondWithResult(_0x5d2324,_0x217dbb){_0x217dbb=_0x217dbb||0xc8;return function(_0x3380e7){if(_0x3380e7){return _0x5d2324[_0x57f2('0x17')](_0x217dbb)[_0x57f2('0x18')](_0x3380e7);}};}function respondWithFilteredResult(_0x1c621f,_0x431a0c){return function(_0x234a44){if(_0x234a44){var _0x48a3bf=typeof _0x431a0c['offset']==='undefined'&&typeof _0x431a0c[_0x57f2('0x19')]===_0x57f2('0x1a');var _0x3a14e0=_0x234a44['count'];var _0x1c92c0=_0x48a3bf?0x0:_0x431a0c[_0x57f2('0x1b')];var _0xeda7d2=_0x48a3bf?_0x234a44[_0x57f2('0x1c')]:_0x431a0c['offset']+_0x431a0c[_0x57f2('0x19')];var _0x518bc4;if(_0xeda7d2>=_0x3a14e0){_0xeda7d2=_0x3a14e0;_0x518bc4=0xc8;}else{_0x518bc4=0xce;}_0x1c621f[_0x57f2('0x17')](_0x518bc4);return _0x1c621f[_0x57f2('0x1d')]('Content-Range',_0x1c92c0+'-'+_0xeda7d2+'/'+_0x3a14e0)[_0x57f2('0x18')](_0x234a44);}return null;};}function patchUpdates(_0x4f1600){return function(_0x13f201){try{jsonpatch[_0x57f2('0x1e')](_0x13f201,_0x4f1600,!![]);}catch(_0x3fb719){return BPromise['reject'](_0x3fb719);}return _0x13f201[_0x57f2('0x1f')]();};}function saveUpdates(_0x4f7aa7,_0x5084f2){return function(_0x5bf04c){if(_0x5bf04c){return _0x5bf04c['update'](_0x4f7aa7)['then'](function(_0x196618){return _0x196618;});}return null;};}function removeEntity(_0x553d74,_0x2eec26){return function(_0x4c127d){if(_0x4c127d){return _0x4c127d['destroy']()[_0x57f2('0x20')](function(){var _0xd439b9=_0x4c127d['get']({'plain':!![]});var _0x301f07=_0x57f2('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x301f07,'resourceId':_0xd439b9['id']}})[_0x57f2('0x20')](function(){return _0x4c127d;});})['then'](function(){_0x553d74['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f11f,_0x477412){return function(_0x3484f2){if(!_0x3484f2){_0x22f11f['sendStatus'](0x194);}return _0x3484f2;};}function handleError(_0x4fb9c,_0x34318a){_0x34318a=_0x34318a||0x1f4;return function(_0x380638){logger['error'](_0x380638[_0x57f2('0x22')]);if(_0x380638[_0x57f2('0x23')]){delete _0x380638['name'];}_0x4fb9c[_0x57f2('0x17')](_0x34318a)['send'](_0x380638);};}exports[_0x57f2('0x24')]=function(_0x1a13cc,_0x32cb43){var _0x522cca={},_0x5790ce={},_0x3a1ce6={'count':0x0,'rows':[]};var _0xa6d540=_[_0x57f2('0x25')](db[_0x57f2('0x26')][_0x57f2('0x27')],function(_0x568168){return{'name':_0x568168['fieldName'],'type':_0x568168[_0x57f2('0x28')][_0x57f2('0x29')]};});_0x5790ce[_0x57f2('0x2a')]=_[_0x57f2('0x25')](_0xa6d540,_0x57f2('0x23'));_0x5790ce[_0x57f2('0x2b')]=_[_0x57f2('0x2c')](_0x1a13cc['query']);_0x5790ce[_0x57f2('0x2d')]=_[_0x57f2('0x2e')](_0x5790ce['model'],_0x5790ce[_0x57f2('0x2b')]);_0x522cca[_0x57f2('0x2f')]=_[_0x57f2('0x2e')](_0x5790ce['model'],qs[_0x57f2('0x30')](_0x1a13cc[_0x57f2('0x2b')][_0x57f2('0x30')]));_0x522cca[_0x57f2('0x2f')]=_0x522cca[_0x57f2('0x2f')][_0x57f2('0x31')]?_0x522cca[_0x57f2('0x2f')]:_0x5790ce['model'];if(!_0x1a13cc[_0x57f2('0x2b')][_0x57f2('0x32')]('nolimit')){_0x522cca['limit']=qs[_0x57f2('0x19')](_0x1a13cc['query'][_0x57f2('0x19')]);_0x522cca[_0x57f2('0x1b')]=qs[_0x57f2('0x1b')](_0x1a13cc[_0x57f2('0x2b')][_0x57f2('0x1b')]);}_0x522cca['order']=qs['sort'](_0x1a13cc[_0x57f2('0x2b')]['sort']);_0x522cca[_0x57f2('0x33')]=qs[_0x57f2('0x2d')](_[_0x57f2('0x34')](_0x1a13cc['query'],_0x5790ce[_0x57f2('0x2d')]),_0xa6d540);if(_0x1a13cc[_0x57f2('0x2b')][_0x57f2('0x35')]){_0x522cca['where']=_[_0x57f2('0x36')](_0x522cca['where'],{'$or':_[_0x57f2('0x25')](_0xa6d540,function(_0x80a5b1){if(_0x80a5b1[_0x57f2('0x28')]!==_0x57f2('0x37')){var _0x375c86={};_0x375c86[_0x80a5b1[_0x57f2('0x23')]]={'$like':'%'+_0x1a13cc[_0x57f2('0x2b')][_0x57f2('0x35')]+'%'};return _0x375c86;}})});}_0x522cca=_[_0x57f2('0x36')]({},_0x522cca,_0x1a13cc['options']);var _0x452550={'where':_0x522cca[_0x57f2('0x33')]};return db['Interval'][_0x57f2('0x1c')](_0x452550)[_0x57f2('0x20')](function(_0x149dbe){_0x3a1ce6[_0x57f2('0x1c')]=_0x149dbe;if(_0x1a13cc[_0x57f2('0x2b')][_0x57f2('0x38')]){_0x522cca[_0x57f2('0x39')]=[{'all':!![]}];}return db[_0x57f2('0x26')][_0x57f2('0x3a')](_0x522cca);})[_0x57f2('0x20')](function(_0x454c0f){_0x3a1ce6['rows']=_0x454c0f;return _0x3a1ce6;})[_0x57f2('0x20')](respondWithFilteredResult(_0x32cb43,_0x522cca))[_0x57f2('0x3b')](handleError(_0x32cb43,null));};exports[_0x57f2('0x3c')]=function(_0xf1980,_0x4142a6){var _0x144dec={'raw':!![],'where':{'id':_0xf1980[_0x57f2('0x3d')]['id']}},_0x42fa19={};_0x42fa19[_0x57f2('0x2a')]=_['keys'](db[_0x57f2('0x26')][_0x57f2('0x27')]);_0x42fa19[_0x57f2('0x2b')]=_['keys'](_0xf1980[_0x57f2('0x2b')]);_0x42fa19[_0x57f2('0x2d')]=_[_0x57f2('0x2e')](_0x42fa19[_0x57f2('0x2a')],_0x42fa19['query']);_0x144dec[_0x57f2('0x2f')]=_[_0x57f2('0x2e')](_0x42fa19[_0x57f2('0x2a')],qs[_0x57f2('0x30')](_0xf1980[_0x57f2('0x2b')][_0x57f2('0x30')]));_0x144dec[_0x57f2('0x2f')]=_0x144dec[_0x57f2('0x2f')]['length']?_0x144dec[_0x57f2('0x2f')]:_0x42fa19[_0x57f2('0x2a')];if(_0xf1980[_0x57f2('0x2b')][_0x57f2('0x38')]){_0x144dec[_0x57f2('0x39')]=[{'all':!![]}];}_0x144dec=_[_0x57f2('0x36')]({},_0x144dec,_0xf1980['options']);return db[_0x57f2('0x26')][_0x57f2('0x3e')](_0x144dec)[_0x57f2('0x20')](handleEntityNotFound(_0x4142a6,null))[_0x57f2('0x20')](respondWithResult(_0x4142a6,null))['catch'](handleError(_0x4142a6,null));};exports[_0x57f2('0x3f')]=function(_0x4b0f8a,_0x4225e6){return db[_0x57f2('0x26')][_0x57f2('0x3f')](_0x4b0f8a[_0x57f2('0x40')],{})[_0x57f2('0x20')](function(_0x59e2e5){var _0x7eaa7d=_0x4b0f8a[_0x57f2('0x41')][_0x57f2('0x42')]({'plain':!![]});if(!_0x7eaa7d)throw new Error(_0x57f2('0x43'));if(_0x7eaa7d[_0x57f2('0x44')]===_0x57f2('0x41')){var _0x3b2b6f=_0x59e2e5[_0x57f2('0x42')]({'plain':!![]});var _0x581e3b=_0x57f2('0x21');return db[_0x57f2('0x45')]['find']({'where':{'name':_0x581e3b,'userProfileId':_0x7eaa7d[_0x57f2('0x46')]},'raw':!![]})[_0x57f2('0x20')](function(_0x10bed6){if(_0x10bed6&&_0x10bed6[_0x57f2('0x47')]===0x0){return db[_0x57f2('0x48')][_0x57f2('0x3f')]({'name':_0x3b2b6f[_0x57f2('0x23')],'resourceId':_0x3b2b6f['id'],'type':_0x10bed6[_0x57f2('0x23')],'sectionId':_0x10bed6['id']},{})['then'](function(){return _0x59e2e5;});}else{return _0x59e2e5;}})['catch'](function(_0x153317){logger['error'](_0x57f2('0x49'),_0x153317);throw _0x153317;});}return _0x59e2e5;})['then'](respondWithResult(_0x4225e6,0xc9))[_0x57f2('0x3b')](handleError(_0x4225e6,null));};exports[_0x57f2('0x4a')]=function(_0x49f129,_0x5c35d1){if(_0x49f129['body']['id']){delete _0x49f129[_0x57f2('0x40')]['id'];}return db['Interval'][_0x57f2('0x3e')]({'where':{'id':_0x49f129[_0x57f2('0x3d')]['id']}})[_0x57f2('0x20')](handleEntityNotFound(_0x5c35d1,null))[_0x57f2('0x20')](saveUpdates(_0x49f129[_0x57f2('0x40')],null))['then'](respondWithResult(_0x5c35d1,null))['catch'](handleError(_0x5c35d1,null));};exports['destroy']=function(_0x379dd8,_0x2b71dd){return db[_0x57f2('0x26')][_0x57f2('0x3e')]({'where':{'id':_0x379dd8[_0x57f2('0x3d')]['id']}})[_0x57f2('0x20')](handleEntityNotFound(_0x2b71dd,null))[_0x57f2('0x20')](removeEntity(_0x2b71dd,null))[_0x57f2('0x3b')](handleError(_0x2b71dd,null));};exports[_0x57f2('0x4b')]=function(_0x1ce547,_0xbddea1,_0x2312a3){if(_0x1ce547[_0x57f2('0x40')]['id']){delete _0x1ce547[_0x57f2('0x40')]['id'];}return db['Interval']['find']({'where':{'id':_0x1ce547['params']['id']}})[_0x57f2('0x20')](handleEntityNotFound(_0xbddea1,null))[_0x57f2('0x20')](function(_0x5392e8){if(_0x5392e8){_0x1ce547[_0x57f2('0x40')][_0x57f2('0x4c')]=_0x5392e8['id'];return db[_0x57f2('0x26')][_0x57f2('0x3f')](_0x1ce547[_0x57f2('0x40')]);}})[_0x57f2('0x20')](respondWithResult(_0xbddea1,null))[_0x57f2('0x3b')](handleError(_0xbddea1,null));};exports[_0x57f2('0x4d')]=function(_0x325d74,_0x18d0ac,_0x4363ae){var _0x143e08={};var _0x11881c={};var _0x2c53f6;var _0x517f95;return db[_0x57f2('0x26')][_0x57f2('0x4e')]({'where':{'id':_0x325d74[_0x57f2('0x3d')]['id']}})[_0x57f2('0x20')](handleEntityNotFound(_0x18d0ac,null))[_0x57f2('0x20')](function(_0x3c00a8){if(_0x3c00a8){_0x2c53f6=_0x3c00a8;_0x11881c[_0x57f2('0x2a')]=_[_0x57f2('0x2c')](db[_0x57f2('0x26')][_0x57f2('0x27')]);_0x11881c['query']=_['keys'](_0x325d74['query']);_0x11881c[_0x57f2('0x2d')]=_[_0x57f2('0x2e')](_0x11881c[_0x57f2('0x2a')],_0x11881c[_0x57f2('0x2b')]);_0x143e08['attributes']=_[_0x57f2('0x2e')](_0x11881c[_0x57f2('0x2a')],qs[_0x57f2('0x30')](_0x325d74[_0x57f2('0x2b')][_0x57f2('0x30')]));_0x143e08['attributes']=_0x143e08[_0x57f2('0x2f')][_0x57f2('0x31')]?_0x143e08[_0x57f2('0x2f')]:_0x11881c[_0x57f2('0x2a')];_0x143e08[_0x57f2('0x4f')]=qs[_0x57f2('0x50')](_0x325d74[_0x57f2('0x2b')][_0x57f2('0x50')]);_0x143e08[_0x57f2('0x33')]=qs[_0x57f2('0x2d')](_[_0x57f2('0x34')](_0x325d74['query'],_0x11881c[_0x57f2('0x2d')]));if(_0x325d74[_0x57f2('0x2b')][_0x57f2('0x35')]){_0x143e08[_0x57f2('0x33')]=_[_0x57f2('0x36')](_0x143e08[_0x57f2('0x33')],{'$or':_[_0x57f2('0x25')](_0x143e08[_0x57f2('0x2f')],function(_0x50867a){var _0x5e1deb={};_0x5e1deb[_0x50867a]={'$like':'%'+_0x325d74[_0x57f2('0x2b')]['filter']+'%'};return _0x5e1deb;})});}_0x143e08=_[_0x57f2('0x36')]({},_0x143e08,_0x325d74[_0x57f2('0x51')]);return _0x2c53f6[_0x57f2('0x4d')](_0x143e08);}})[_0x57f2('0x20')](function(_0x2bd258){if(_0x2bd258){_0x517f95=_0x2bd258['length'];if(!_0x325d74['query'][_0x57f2('0x32')](_0x57f2('0x52'))){_0x143e08['limit']=qs['limit'](_0x325d74['query'][_0x57f2('0x19')]);_0x143e08[_0x57f2('0x1b')]=qs[_0x57f2('0x1b')](_0x325d74[_0x57f2('0x2b')][_0x57f2('0x1b')]);}return _0x2c53f6[_0x57f2('0x4d')](_0x143e08);}})[_0x57f2('0x20')](function(_0x5897df){if(_0x5897df){return _0x5897df?{'count':_0x517f95,'rows':_0x5897df}:null;}})[_0x57f2('0x20')](respondWithResult(_0x18d0ac,null))[_0x57f2('0x3b')](handleError(_0x18d0ac,null));};exports[_0x57f2('0x53')]=function(_0x4ef3c8,_0x3ce6ce,_0x421994){return db[_0x57f2('0x26')]['findOne']({'where':{'id':_0x4ef3c8['params']['id']}})[_0x57f2('0x20')](handleEntityNotFound(_0x3ce6ce,null))['then'](function(_0x128fde){if(_0x128fde){return db[_0x57f2('0x54')][_0x57f2('0x55')](function(_0xbf6fa5){return db['Interval'][_0x57f2('0x56')]({'where':{'IntervalId':_0x4ef3c8[_0x57f2('0x3d')]['id']},'transaction':_0xbf6fa5})['then'](function(_0x4da5e4){var _0x58f904=_[_0x57f2('0x25')](_0x4ef3c8[_0x57f2('0x40')],function(_0x23f8fb){delete _0x23f8fb['id'];_0x23f8fb['IntervalId']=_0x4ef3c8[_0x57f2('0x3d')]['id'];return _0x23f8fb;});return db['Interval'][_0x57f2('0x57')](_0x58f904,{'transaction':_0xbf6fa5});});})[_0x57f2('0x20')](function(){return db[_0x57f2('0x26')][_0x57f2('0x3a')]({'where':{'IntervalId':_0x4ef3c8[_0x57f2('0x3d')]['id']}});});}})['then'](respondWithResult(_0x3ce6ce,null))[_0x57f2('0x3b')](handleError(_0x3ce6ce,null));}; \ No newline at end of file +var _0xeb16=['offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','get','UserProfileResource','sendStatus','name','index','Interval','rawAttributes','fieldName','type','key','model','map','keys','filters','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','find','autoAssociation','error','body','addInterval','getIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json'];(function(_0x189e85,_0x4eb513){var _0x5a702b=function(_0x2f2e98){while(--_0x2f2e98){_0x189e85['push'](_0x189e85['shift']());}};_0x5a702b(++_0x4eb513);}(_0xeb16,0x1ec));var _0x6eb1=function(_0x579572,_0x545a04){_0x579572=_0x579572-0x0;var _0x4142f7=_0xeb16[_0x579572];return _0x4142f7;};'use strict';var emlformat=require(_0x6eb1('0x0'));var rimraf=require(_0x6eb1('0x1'));var zipdir=require(_0x6eb1('0x2'));var jsonpatch=require(_0x6eb1('0x3'));var rp=require('request-promise');var moment=require(_0x6eb1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6eb1('0x5'));var path=require(_0x6eb1('0x6'));var sox=require('sox');var csv=require(_0x6eb1('0x7'));var ejs=require(_0x6eb1('0x8'));var fs=require('fs');var fs_extra=require(_0x6eb1('0x9'));var _=require('lodash');var squel=require(_0x6eb1('0xa'));var crypto=require('crypto');var jsforce=require(_0x6eb1('0xb'));var deskjs=require(_0x6eb1('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6eb1('0xd'));var Redis=require(_0x6eb1('0xe'));var authService=require(_0x6eb1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eb1('0x10'));var logger=require(_0x6eb1('0x11'))(_0x6eb1('0x12'));var utils=require(_0x6eb1('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6eb1('0x14'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x584540,_0x56a71c){_0x56a71c=_0x56a71c||0xcc;return function(_0x215169){if(_0x215169){return _0x584540['sendStatus'](_0x56a71c);}return _0x584540[_0x6eb1('0x15')](_0x56a71c)[_0x6eb1('0x16')]();};}function respondWithResult(_0x51bf97,_0x3d0879){_0x3d0879=_0x3d0879||0xc8;return function(_0x3605ca){if(_0x3605ca){return _0x51bf97[_0x6eb1('0x15')](_0x3d0879)[_0x6eb1('0x17')](_0x3605ca);}};}function respondWithFilteredResult(_0x553aa1,_0x2e8654){return function(_0x277992){if(_0x277992){var _0x31676a=typeof _0x2e8654[_0x6eb1('0x18')]===_0x6eb1('0x19')&&typeof _0x2e8654[_0x6eb1('0x1a')]===_0x6eb1('0x19');var _0x497f01=_0x277992[_0x6eb1('0x1b')];var _0x272587=_0x31676a?0x0:_0x2e8654[_0x6eb1('0x18')];var _0x9d4be2=_0x31676a?_0x277992[_0x6eb1('0x1b')]:_0x2e8654[_0x6eb1('0x18')]+_0x2e8654[_0x6eb1('0x1a')];var _0x28de37;if(_0x9d4be2>=_0x497f01){_0x9d4be2=_0x497f01;_0x28de37=0xc8;}else{_0x28de37=0xce;}_0x553aa1[_0x6eb1('0x15')](_0x28de37);return _0x553aa1[_0x6eb1('0x1c')](_0x6eb1('0x1d'),_0x272587+'-'+_0x9d4be2+'/'+_0x497f01)['json'](_0x277992);}return null;};}function patchUpdates(_0x48fa2b){return function(_0x2d2a3c){try{jsonpatch[_0x6eb1('0x1e')](_0x2d2a3c,_0x48fa2b,!![]);}catch(_0x1f4de2){return BPromise['reject'](_0x1f4de2);}return _0x2d2a3c['save']();};}function saveUpdates(_0x147ab3,_0x4eb1c0){return function(_0x47ba52){if(_0x47ba52){return _0x47ba52[_0x6eb1('0x1f')](_0x147ab3)['then'](function(_0x1f1a3b){return _0x1f1a3b;});}return null;};}function removeEntity(_0x30f231,_0x25cc27){return function(_0x5af704){if(_0x5af704){return _0x5af704[_0x6eb1('0x20')]()[_0x6eb1('0x21')](function(){var _0x517249=_0x5af704[_0x6eb1('0x22')]({'plain':!![]});var _0x3b9433='Intervals';return db[_0x6eb1('0x23')][_0x6eb1('0x20')]({'where':{'type':_0x3b9433,'resourceId':_0x517249['id']}})[_0x6eb1('0x21')](function(){return _0x5af704;});})[_0x6eb1('0x21')](function(){_0x30f231['status'](0xcc)[_0x6eb1('0x16')]();});}};}function handleEntityNotFound(_0x366860,_0x1f05f9){return function(_0x1debe7){if(!_0x1debe7){_0x366860[_0x6eb1('0x24')](0x194);}return _0x1debe7;};}function handleError(_0x4bff16,_0x11d1c5){_0x11d1c5=_0x11d1c5||0x1f4;return function(_0x9d2efa){logger['error'](_0x9d2efa['stack']);if(_0x9d2efa[_0x6eb1('0x25')]){delete _0x9d2efa['name'];}_0x4bff16[_0x6eb1('0x15')](_0x11d1c5)['send'](_0x9d2efa);};}exports[_0x6eb1('0x26')]=function(_0x11fe19,_0x2b4645){var _0x41002e={},_0x58cc7e={},_0x5c7e71={'count':0x0,'rows':[]};var _0x8772ea=_['map'](db[_0x6eb1('0x27')][_0x6eb1('0x28')],function(_0x10c668){return{'name':_0x10c668[_0x6eb1('0x29')],'type':_0x10c668[_0x6eb1('0x2a')][_0x6eb1('0x2b')]};});_0x58cc7e[_0x6eb1('0x2c')]=_[_0x6eb1('0x2d')](_0x8772ea,'name');_0x58cc7e['query']=_[_0x6eb1('0x2e')](_0x11fe19['query']);_0x58cc7e[_0x6eb1('0x2f')]=_['intersection'](_0x58cc7e['model'],_0x58cc7e['query']);_0x41002e[_0x6eb1('0x30')]=_[_0x6eb1('0x31')](_0x58cc7e[_0x6eb1('0x2c')],qs[_0x6eb1('0x32')](_0x11fe19['query']['fields']));_0x41002e[_0x6eb1('0x30')]=_0x41002e[_0x6eb1('0x30')]['length']?_0x41002e['attributes']:_0x58cc7e[_0x6eb1('0x2c')];if(!_0x11fe19[_0x6eb1('0x33')][_0x6eb1('0x34')](_0x6eb1('0x35'))){_0x41002e[_0x6eb1('0x1a')]=qs[_0x6eb1('0x1a')](_0x11fe19[_0x6eb1('0x33')][_0x6eb1('0x1a')]);_0x41002e[_0x6eb1('0x18')]=qs[_0x6eb1('0x18')](_0x11fe19[_0x6eb1('0x33')]['offset']);}_0x41002e[_0x6eb1('0x36')]=qs['sort'](_0x11fe19[_0x6eb1('0x33')][_0x6eb1('0x37')]);_0x41002e[_0x6eb1('0x38')]=qs['filters'](_[_0x6eb1('0x39')](_0x11fe19[_0x6eb1('0x33')],_0x58cc7e[_0x6eb1('0x2f')]),_0x8772ea);if(_0x11fe19[_0x6eb1('0x33')][_0x6eb1('0x3a')]){_0x41002e[_0x6eb1('0x38')]=_[_0x6eb1('0x3b')](_0x41002e[_0x6eb1('0x38')],{'$or':_[_0x6eb1('0x2d')](_0x8772ea,function(_0x521764){if(_0x521764['type']!==_0x6eb1('0x3c')){var _0x5274b3={};_0x5274b3[_0x521764[_0x6eb1('0x25')]]={'$like':'%'+_0x11fe19['query'][_0x6eb1('0x3a')]+'%'};return _0x5274b3;}})});}_0x41002e=_[_0x6eb1('0x3b')]({},_0x41002e,_0x11fe19[_0x6eb1('0x3d')]);var _0x389bfc={'where':_0x41002e[_0x6eb1('0x38')]};return db[_0x6eb1('0x27')]['count'](_0x389bfc)['then'](function(_0x5eaee5){_0x5c7e71[_0x6eb1('0x1b')]=_0x5eaee5;if(_0x11fe19['query'][_0x6eb1('0x3e')]){_0x41002e[_0x6eb1('0x3f')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x41002e);})[_0x6eb1('0x21')](function(_0x57bd79){_0x5c7e71[_0x6eb1('0x40')]=_0x57bd79;return _0x5c7e71;})[_0x6eb1('0x21')](respondWithFilteredResult(_0x2b4645,_0x41002e))[_0x6eb1('0x41')](handleError(_0x2b4645,null));};exports[_0x6eb1('0x42')]=function(_0x513bf4,_0xb022bd){var _0xe050d0={'raw':!![],'where':{'id':_0x513bf4[_0x6eb1('0x43')]['id']}},_0x13d3f4={};_0x13d3f4[_0x6eb1('0x2c')]=_[_0x6eb1('0x2e')](db['Interval'][_0x6eb1('0x28')]);_0x13d3f4[_0x6eb1('0x33')]=_[_0x6eb1('0x2e')](_0x513bf4[_0x6eb1('0x33')]);_0x13d3f4[_0x6eb1('0x2f')]=_[_0x6eb1('0x31')](_0x13d3f4['model'],_0x13d3f4[_0x6eb1('0x33')]);_0xe050d0[_0x6eb1('0x30')]=_[_0x6eb1('0x31')](_0x13d3f4[_0x6eb1('0x2c')],qs['fields'](_0x513bf4[_0x6eb1('0x33')][_0x6eb1('0x32')]));_0xe050d0[_0x6eb1('0x30')]=_0xe050d0[_0x6eb1('0x30')][_0x6eb1('0x44')]?_0xe050d0[_0x6eb1('0x30')]:_0x13d3f4['model'];if(_0x513bf4[_0x6eb1('0x33')]['includeAll']){_0xe050d0['include']=[{'all':!![]}];}_0xe050d0=_['merge']({},_0xe050d0,_0x513bf4[_0x6eb1('0x3d')]);return db[_0x6eb1('0x27')]['find'](_0xe050d0)[_0x6eb1('0x21')](handleEntityNotFound(_0xb022bd,null))['then'](respondWithResult(_0xb022bd,null))[_0x6eb1('0x41')](handleError(_0xb022bd,null));};exports['create']=function(_0xea71fb,_0xc1f95f){return db[_0x6eb1('0x27')][_0x6eb1('0x45')](_0xea71fb['body'],{})[_0x6eb1('0x21')](function(_0x15138c){var _0x20b585=_0xea71fb[_0x6eb1('0x46')][_0x6eb1('0x22')]({'plain':!![]});if(!_0x20b585)throw new Error(_0x6eb1('0x47'));if(_0x20b585[_0x6eb1('0x48')]===_0x6eb1('0x46')){var _0x286a16=_0x15138c['get']({'plain':!![]});var _0x750d2c=_0x6eb1('0x49');return db['UserProfileSection'][_0x6eb1('0x4a')]({'where':{'name':_0x750d2c,'userProfileId':_0x20b585['userProfileId']},'raw':!![]})[_0x6eb1('0x21')](function(_0x57af06){if(_0x57af06&&_0x57af06[_0x6eb1('0x4b')]===0x0){return db['UserProfileResource'][_0x6eb1('0x45')]({'name':_0x286a16[_0x6eb1('0x25')],'resourceId':_0x286a16['id'],'type':_0x57af06['name'],'sectionId':_0x57af06['id']},{})['then'](function(){return _0x15138c;});}else{return _0x15138c;}})[_0x6eb1('0x41')](function(_0x3fb795){logger[_0x6eb1('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fb795);throw _0x3fb795;});}return _0x15138c;})['then'](respondWithResult(_0xc1f95f,0xc9))[_0x6eb1('0x41')](handleError(_0xc1f95f,null));};exports[_0x6eb1('0x1f')]=function(_0x17ebb5,_0x26c654){if(_0x17ebb5[_0x6eb1('0x4d')]['id']){delete _0x17ebb5['body']['id'];}return db[_0x6eb1('0x27')][_0x6eb1('0x4a')]({'where':{'id':_0x17ebb5[_0x6eb1('0x43')]['id']}})[_0x6eb1('0x21')](handleEntityNotFound(_0x26c654,null))[_0x6eb1('0x21')](saveUpdates(_0x17ebb5['body'],null))[_0x6eb1('0x21')](respondWithResult(_0x26c654,null))[_0x6eb1('0x41')](handleError(_0x26c654,null));};exports[_0x6eb1('0x20')]=function(_0x14524e,_0x450eef){return db['Interval'][_0x6eb1('0x4a')]({'where':{'id':_0x14524e['params']['id']}})['then'](handleEntityNotFound(_0x450eef,null))[_0x6eb1('0x21')](removeEntity(_0x450eef,null))['catch'](handleError(_0x450eef,null));};exports[_0x6eb1('0x4e')]=function(_0x1e0c80,_0x2ac465,_0x5e8d4a){if(_0x1e0c80['body']['id']){delete _0x1e0c80['body']['id'];}return db['Interval']['find']({'where':{'id':_0x1e0c80[_0x6eb1('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ac465,null))[_0x6eb1('0x21')](function(_0x4460c3){if(_0x4460c3){_0x1e0c80[_0x6eb1('0x4d')]['IntervalId']=_0x4460c3['id'];return db[_0x6eb1('0x27')][_0x6eb1('0x45')](_0x1e0c80[_0x6eb1('0x4d')]);}})['then'](respondWithResult(_0x2ac465,null))['catch'](handleError(_0x2ac465,null));};exports[_0x6eb1('0x4f')]=function(_0x291e61,_0x24b128,_0x38f7be){var _0x2aabe={};var _0x32febe={};var _0x36a2ca;var _0x1d1ca8;return db[_0x6eb1('0x27')][_0x6eb1('0x50')]({'where':{'id':_0x291e61[_0x6eb1('0x43')]['id']}})['then'](handleEntityNotFound(_0x24b128,null))[_0x6eb1('0x21')](function(_0x472c28){if(_0x472c28){_0x36a2ca=_0x472c28;_0x32febe[_0x6eb1('0x2c')]=_[_0x6eb1('0x2e')](db[_0x6eb1('0x27')][_0x6eb1('0x28')]);_0x32febe[_0x6eb1('0x33')]=_[_0x6eb1('0x2e')](_0x291e61[_0x6eb1('0x33')]);_0x32febe[_0x6eb1('0x2f')]=_[_0x6eb1('0x31')](_0x32febe[_0x6eb1('0x2c')],_0x32febe[_0x6eb1('0x33')]);_0x2aabe[_0x6eb1('0x30')]=_[_0x6eb1('0x31')](_0x32febe[_0x6eb1('0x2c')],qs[_0x6eb1('0x32')](_0x291e61[_0x6eb1('0x33')]['fields']));_0x2aabe['attributes']=_0x2aabe[_0x6eb1('0x30')][_0x6eb1('0x44')]?_0x2aabe[_0x6eb1('0x30')]:_0x32febe[_0x6eb1('0x2c')];_0x2aabe[_0x6eb1('0x36')]=qs['sort'](_0x291e61[_0x6eb1('0x33')][_0x6eb1('0x37')]);_0x2aabe[_0x6eb1('0x38')]=qs['filters'](_['pick'](_0x291e61['query'],_0x32febe[_0x6eb1('0x2f')]));if(_0x291e61['query']['filter']){_0x2aabe[_0x6eb1('0x38')]=_[_0x6eb1('0x3b')](_0x2aabe[_0x6eb1('0x38')],{'$or':_[_0x6eb1('0x2d')](_0x2aabe[_0x6eb1('0x30')],function(_0x358ed2){var _0x1edd1e={};_0x1edd1e[_0x358ed2]={'$like':'%'+_0x291e61[_0x6eb1('0x33')][_0x6eb1('0x3a')]+'%'};return _0x1edd1e;})});}_0x2aabe=_[_0x6eb1('0x3b')]({},_0x2aabe,_0x291e61[_0x6eb1('0x3d')]);return _0x36a2ca[_0x6eb1('0x4f')](_0x2aabe);}})['then'](function(_0x81709a){if(_0x81709a){_0x1d1ca8=_0x81709a[_0x6eb1('0x44')];if(!_0x291e61[_0x6eb1('0x33')][_0x6eb1('0x34')]('nolimit')){_0x2aabe[_0x6eb1('0x1a')]=qs[_0x6eb1('0x1a')](_0x291e61[_0x6eb1('0x33')][_0x6eb1('0x1a')]);_0x2aabe[_0x6eb1('0x18')]=qs[_0x6eb1('0x18')](_0x291e61['query'][_0x6eb1('0x18')]);}return _0x36a2ca['getIntervals'](_0x2aabe);}})['then'](function(_0x30d8a8){if(_0x30d8a8){return _0x30d8a8?{'count':_0x1d1ca8,'rows':_0x30d8a8}:null;}})[_0x6eb1('0x21')](respondWithResult(_0x24b128,null))[_0x6eb1('0x41')](handleError(_0x24b128,null));};exports['addIntervals']=function(_0x4ad91,_0x46cc01,_0xd2bfb5){return db[_0x6eb1('0x27')][_0x6eb1('0x50')]({'where':{'id':_0x4ad91[_0x6eb1('0x43')]['id']}})[_0x6eb1('0x21')](handleEntityNotFound(_0x46cc01,null))[_0x6eb1('0x21')](function(_0x5e9c6a){if(_0x5e9c6a){return db[_0x6eb1('0x51')][_0x6eb1('0x52')](function(_0x1db2bf){return db[_0x6eb1('0x27')][_0x6eb1('0x20')]({'where':{'IntervalId':_0x4ad91[_0x6eb1('0x43')]['id']},'transaction':_0x1db2bf})[_0x6eb1('0x21')](function(_0x157412){var _0x38befa=_[_0x6eb1('0x2d')](_0x4ad91[_0x6eb1('0x4d')],function(_0x409f50){delete _0x409f50['id'];_0x409f50[_0x6eb1('0x53')]=_0x4ad91[_0x6eb1('0x43')]['id'];return _0x409f50;});return db['Interval'][_0x6eb1('0x54')](_0x38befa,{'transaction':_0x1db2bf});});})[_0x6eb1('0x21')](function(){return db['Interval'][_0x6eb1('0x55')]({'where':{'IntervalId':_0x4ad91[_0x6eb1('0x43')]['id']}});});}})[_0x6eb1('0x21')](respondWithResult(_0x46cc01,null))['catch'](handleError(_0x46cc01,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d34a64c..0049d50 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 _0x2d8c=['rimraf','../../config/environment','./interval.attributes','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2d8c,0x14b));var _0xc2d8=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x2d8c[_0x1602ef];return _0x5870ee;};'use strict';var _=require(_0xc2d8('0x0'));var util=require(_0xc2d8('0x1'));var logger=require(_0xc2d8('0x2'))(_0xc2d8('0x3'));var moment=require('moment');var BPromise=require(_0xc2d8('0x4'));var rp=require(_0xc2d8('0x5'));var fs=require('fs');var path=require(_0xc2d8('0x6'));var rimraf=require(_0xc2d8('0x7'));var config=require(_0xc2d8('0x8'));var attributes=require(_0xc2d8('0x9'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x18ddc5,_0x38275a){return _0x18ddc5['define'](_0xc2d8('0xa'),attributes,{'tableName':_0xc2d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x35cca2,_0x25cc42){extensions['rewrite'](_0x18ddc5,_0x35cca2);},'afterBulkCreate':function(_0x414aad,_0x5f062a,_0x12c09a){_0x12c09a();extensions[_0xc2d8('0xc')](_0x18ddc5,_0x414aad[0x0]);},'afterUpdate':function(_0xbc4901,_0xac5e6d){extensions[_0xc2d8('0xc')](_0x18ddc5,_0xbc4901);},'afterDestroy':function(_0x4be6cc,_0x41f8ca){extensions['rewrite'](_0x18ddc5,_0x4be6cc);}}});}; \ No newline at end of file +var _0x940a=['bluebird','path','rimraf','./interval.attributes','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','moment'];(function(_0x2d580b,_0x2b11f3){var _0x7c1374=function(_0x4c1a85){while(--_0x4c1a85){_0x2d580b['push'](_0x2d580b['shift']());}};_0x7c1374(++_0x2b11f3);}(_0x940a,0x1ea));var _0xa940=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0x940a[_0xce9195];return _0x530fe6;};'use strict';var _=require(_0xa940('0x0'));var util=require('util');var logger=require(_0xa940('0x1'))(_0xa940('0x2'));var moment=require(_0xa940('0x3'));var BPromise=require(_0xa940('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa940('0x5'));var rimraf=require(_0xa940('0x6'));var config=require('../../config/environment');var attributes=require(_0xa940('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0xa940('0x8')]=function(_0xa74c98,_0x2200b3){return _0xa74c98[_0xa940('0x9')](_0xa940('0xa'),attributes,{'tableName':_0xa940('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d787e,_0x560c41){extensions[_0xa940('0xc')](_0xa74c98,_0x5d787e);},'afterBulkCreate':function(_0x183baf,_0x4a0ac6,_0x3d917a){_0x3d917a();extensions[_0xa940('0xc')](_0xa74c98,_0x183baf[0x0]);},'afterUpdate':function(_0x33b952,_0x37d53c){extensions[_0xa940('0xc')](_0xa74c98,_0x33b952);},'afterDestroy':function(_0xc698ce,_0x580c2f){extensions[_0xa940('0xc')](_0xa74c98,_0xc698ce);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7b6d95a..dd62dda 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 75f1971..e1a817f 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x2cc8f4,_0x3c324e){var _0x229954=function(_0x412d30){while(--_0x412d30){_0x2cc8f4['push'](_0x2cc8f4['shift']());}};_0x229954(++_0x3c324e);}(_0xdb28,0x106));var _0x8db2=function(_0x556e08,_0x2a7963){_0x556e08=_0x556e08-0x0;var _0x5ed337=_0xdb28[_0x556e08];return _0x5ed337;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x272edf,_0x100161){var _0x2a6722=function(_0x7644a1){while(--_0x7644a1){_0x272edf['push'](_0x272edf['shift']());}};_0x2a6722(++_0x100161);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a5e46,_0x3ff1f3){_0x3a5e46=_0x3a5e46-0x0;var _0xa47b15=_0x2ef3[_0x3a5e46];return _0xa47b15;};'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 219ed49..5072666 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 _0x2177=['x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','body'];(function(_0x3e02b9,_0x150742){var _0x1dd63f=function(_0x4c88bd){while(--_0x4c88bd){_0x3e02b9['push'](_0x3e02b9['shift']());}};_0x1dd63f(++_0x150742);}(_0x2177,0x164));var _0x7217=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0x2177[_0x3be2e2];return _0x53b9c5;};'use strict';var BPromise=require(_0x7217('0x0'));var https=require(_0x7217('0x1'));var logger=require(_0x7217('0x2'))(_0x7217('0x3'));var USERNAME='support';var PASSWORD=_0x7217('0x4');function openIssue(_0x3aa923,_0x3adc53){var _0x1d23a8={'fields':{'project':{'key':_0x3aa923['key']||_0x7217('0x5')},'summary':(_0x3aa923['summary']||_0x7217('0x6'))+_0x7217('0x7')+_0x3aa923['ip'],'description':_0x3aa923[_0x7217('0x8')]||JSON[_0x7217('0x9')](_0x3aa923),'issuetype':{'name':_0x3aa923['issuetype']||'Bug'}}};_0x1d23a8['fields']['customfield_11500']=_0x3aa923[_0x7217('0xa')];_0x1d23a8[_0x7217('0xb')][_0x7217('0xc')]=_0x3aa923[_0x7217('0xd')];_0x1d23a8[_0x7217('0xb')][_0x7217('0xe')]=_0x3aa923[_0x7217('0xf')];_0x1d23a8['fields'][_0x7217('0x10')]=_0x3aa923[_0x7217('0x11')];_0x1d23a8['fields'][_0x7217('0x12')]=_0x3aa923[_0x7217('0x13')];_0x1d23a8[_0x7217('0xb')][_0x7217('0x14')]=_0x3aa923['ip'];var _0x1855d1={'host':_0x7217('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7217('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x7217('0x17'),'Authorization':_0x7217('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x7217('0x19')]('base64')}};var _0x598209=JSON['stringify'](_0x1d23a8);var _0xb8bc0f=https[_0x7217('0x1a')](_0x1855d1,function(_0x57d107){_0x57d107[_0x7217('0x1b')](_0x7217('0x1c'));var _0x2edaf8='';_0x57d107['on'](_0x7217('0x1d'),function(_0x5d66da){_0x2edaf8+=_0x5d66da;});_0x57d107['on']('end',function(){if(_0x3adc53){return _0x3adc53[_0x7217('0x1e')](_0x57d107[_0x7217('0x1f')])[_0x7217('0x20')](JSON[_0x7217('0x21')](_0x2edaf8));}});});_0xb8bc0f['on'](_0x7217('0x22'),function(_0x2ff949){if(_0x3adc53){return _0x3adc53[_0x7217('0x1e')](0x1f4)['json']({'errors':[{'message':_0x7217('0x23'),'type':_0x7217('0x24')}]});}});_0xb8bc0f[_0x7217('0x25')](_0x598209);_0xb8bc0f[_0x7217('0x26')]();}exports['openIssue']=openIssue;exports['send']=function(_0x578353,_0x16524){_0x578353[_0x7217('0x27')]['ip']=_0x578353['headers'][_0x7217('0x28')]||_0x578353[_0x7217('0x29')][_0x7217('0x2a')]||_0x578353['socket'][_0x7217('0x2a')]||_0x578353[_0x7217('0x29')][_0x7217('0x2b')][_0x7217('0x2a')];return openIssue(_0x578353['body'],_0x16524);}; \ No newline at end of file +var _0xc679=['base64','data','end','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','connection','remoteAddress','socket','body','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString'];(function(_0x49eaa0,_0x230ba7){var _0x28bbcd=function(_0x15203a){while(--_0x15203a){_0x49eaa0['push'](_0x49eaa0['shift']());}};_0x28bbcd(++_0x230ba7);}(_0xc679,0x85));var _0x9c67=function(_0x43fc58,_0x49f9cd){_0x43fc58=_0x43fc58-0x0;var _0x19c725=_0xc679[_0x43fc58];return _0x19c725;};'use strict';var BPromise=require('bluebird');var https=require(_0x9c67('0x0'));var logger=require(_0x9c67('0x1'))(_0x9c67('0x2'));var USERNAME=_0x9c67('0x3');var PASSWORD=_0x9c67('0x4');function openIssue(_0x980cc8,_0x52bce8){var _0x140292={'fields':{'project':{'key':_0x980cc8['key']||_0x9c67('0x5')},'summary':(_0x980cc8[_0x9c67('0x6')]||_0x9c67('0x7'))+_0x9c67('0x8')+_0x980cc8['ip'],'description':_0x980cc8[_0x9c67('0x9')]||JSON[_0x9c67('0xa')](_0x980cc8),'issuetype':{'name':_0x980cc8['issuetype']||_0x9c67('0xb')}}};_0x140292[_0x9c67('0xc')][_0x9c67('0xd')]=_0x980cc8[_0x9c67('0xe')];_0x140292[_0x9c67('0xc')]['customfield_11501']=_0x980cc8[_0x9c67('0xf')];_0x140292[_0x9c67('0xc')][_0x9c67('0x10')]=_0x980cc8[_0x9c67('0x11')];_0x140292['fields'][_0x9c67('0x12')]=_0x980cc8[_0x9c67('0x13')];_0x140292[_0x9c67('0xc')]['customfield_11504']=_0x980cc8[_0x9c67('0x14')];_0x140292[_0x9c67('0xc')][_0x9c67('0x15')]=_0x980cc8['ip'];var _0x256f75={'host':_0x9c67('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9c67('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x9c67('0x18'),'Authorization':_0x9c67('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x9c67('0x1a')](_0x9c67('0x1b'))}};var _0x2cce01=JSON[_0x9c67('0xa')](_0x140292);var _0x34dd4e=https['request'](_0x256f75,function(_0x55c306){_0x55c306['setEncoding']('utf8');var _0x2656d7='';_0x55c306['on'](_0x9c67('0x1c'),function(_0x28532a){_0x2656d7+=_0x28532a;});_0x55c306['on'](_0x9c67('0x1d'),function(){if(_0x52bce8){return _0x52bce8['status'](_0x55c306[_0x9c67('0x1e')])[_0x9c67('0x1f')](JSON['parse'](_0x2656d7));}});});_0x34dd4e['on']('error',function(_0xc31d00){if(_0x52bce8){return _0x52bce8['status'](0x1f4)[_0x9c67('0x1f')]({'errors':[{'message':_0x9c67('0x20'),'type':_0x9c67('0x21')}]});}});_0x34dd4e[_0x9c67('0x22')](_0x2cce01);_0x34dd4e[_0x9c67('0x1d')]();}exports[_0x9c67('0x23')]=openIssue;exports['send']=function(_0x417b72,_0x5647ce){_0x417b72['body']['ip']=_0x417b72['headers']['x-forwarded-for']||_0x417b72[_0x9c67('0x24')][_0x9c67('0x25')]||_0x417b72[_0x9c67('0x26')]['remoteAddress']||_0x417b72[_0x9c67('0x24')]['socket']['remoteAddress'];return openIssue(_0x417b72[_0x9c67('0x27')],_0x5647ce);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2d5996e..a00ea37 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 _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x45f4ba,_0x5498c8){var _0x44db14=function(_0x381dec){while(--_0x381dec){_0x45f4ba['push'](_0x45f4ba['shift']());}};_0x44db14(++_0x5498c8);}(_0xa74f,0x9a));var _0xfa74=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xa74f[_0x1064bc];return _0x5edc45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file +var _0xd64b=['../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','path','express','Router','fs-extra'];(function(_0x49b786,_0x408af0){var _0x5870bf=function(_0x1f7c10){while(--_0x1f7c10){_0x49b786['push'](_0x49b786['shift']());}};_0x5870bf(++_0x408af0);}(_0xd64b,0xc1));var _0xbd64=function(_0x2d1926,_0x3e9afe){_0x2d1926=_0x2d1926-0x0;var _0x4a52c7=_0xd64b[_0x2d1926];return _0x4a52c7;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var fs_extra=require(_0xbd64('0x4'));var auth=require(_0xbd64('0x5'));var interaction=require(_0xbd64('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x8')](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x8')](_0xbd64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbd64('0xd')]('/',auth[_0xbd64('0xa')](),controller[_0xbd64('0xe')]);router['put'](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xf')]);router[_0xbd64('0x10')]('/:id',auth[_0xbd64('0xa')](),controller['destroy']);module[_0xbd64('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 0a4ea24..984d276 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7a54,0x106));var _0x47a5=function(_0x57038a,_0x6ec148){_0x57038a=_0x57038a-0x0;var _0x1706e7=_0x7a54[_0x57038a];return _0x1706e7;};'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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x4fe86a,_0x3e1d1c){_0x4fe86a=_0x4fe86a-0x0;var _0x5d8003=_0x7a54[_0x4fe86a];return _0x5d8003;};'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 4bfbff9..98e40cc 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 _0x31c2=['then','destroy','error','name','send','index','map','JscriptyAnswerReport','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update'];(function(_0xa90718,_0x2fd952){var _0x56ed79=function(_0x41cff1){while(--_0x41cff1){_0xa90718['push'](_0xa90718['shift']());}};_0x56ed79(++_0x2fd952);}(_0x31c2,0x1e1));var _0x231c=function(_0x3e5033,_0x2aae93){_0x3e5033=_0x3e5033-0x0;var _0x5dcbe9=_0x31c2[_0x3e5033];return _0x5dcbe9;};'use strict';var emlformat=require(_0x231c('0x0'));var rimraf=require(_0x231c('0x1'));var zipdir=require(_0x231c('0x2'));var jsonpatch=require(_0x231c('0x3'));var rp=require(_0x231c('0x4'));var moment=require(_0x231c('0x5'));var BPromise=require(_0x231c('0x6'));var Mustache=require(_0x231c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x231c('0x8'));var csv=require(_0x231c('0x9'));var ejs=require(_0x231c('0xa'));var fs=require('fs');var fs_extra=require(_0x231c('0xb'));var _=require('lodash');var squel=require(_0x231c('0xc'));var crypto=require('crypto');var jsforce=require(_0x231c('0xd'));var deskjs=require(_0x231c('0xe'));var toCsv=require(_0x231c('0x9'));var querystring=require('querystring');var Papa=require(_0x231c('0xf'));var Redis=require(_0x231c('0x10'));var authService=require(_0x231c('0x11'));var qs=require(_0x231c('0x12'));var as=require(_0x231c('0x13'));var hardwareService=require(_0x231c('0x14'));var logger=require(_0x231c('0x15'))('api');var utils=require(_0x231c('0x16'));var config=require(_0x231c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x231c('0x18'))['db'];function respondWithStatusCode(_0x43c270,_0x871ed1){_0x871ed1=_0x871ed1||0xcc;return function(_0x1aa3fe){if(_0x1aa3fe){return _0x43c270[_0x231c('0x19')](_0x871ed1);}return _0x43c270[_0x231c('0x1a')](_0x871ed1)[_0x231c('0x1b')]();};}function respondWithResult(_0x3355f6,_0xc09de5){_0xc09de5=_0xc09de5||0xc8;return function(_0x311218){if(_0x311218){return _0x3355f6[_0x231c('0x1a')](_0xc09de5)[_0x231c('0x1c')](_0x311218);}};}function respondWithFilteredResult(_0xe37de8,_0x1f7764){return function(_0x12a6ad){if(_0x12a6ad){var _0x210f2e=typeof _0x1f7764[_0x231c('0x1d')]===_0x231c('0x1e')&&typeof _0x1f7764[_0x231c('0x1f')]===_0x231c('0x1e');var _0x51b8ca=_0x12a6ad[_0x231c('0x20')];var _0x341645=_0x210f2e?0x0:_0x1f7764[_0x231c('0x1d')];var _0xadea80=_0x210f2e?_0x12a6ad[_0x231c('0x20')]:_0x1f7764[_0x231c('0x1d')]+_0x1f7764[_0x231c('0x1f')];var _0x172d50;if(_0xadea80>=_0x51b8ca){_0xadea80=_0x51b8ca;_0x172d50=0xc8;}else{_0x172d50=0xce;}_0xe37de8[_0x231c('0x1a')](_0x172d50);return _0xe37de8[_0x231c('0x21')]('Content-Range',_0x341645+'-'+_0xadea80+'/'+_0x51b8ca)[_0x231c('0x1c')](_0x12a6ad);}return null;};}function patchUpdates(_0x5e8a53){return function(_0x872034){try{jsonpatch['apply'](_0x872034,_0x5e8a53,!![]);}catch(_0x42cca3){return BPromise[_0x231c('0x22')](_0x42cca3);}return _0x872034[_0x231c('0x23')]();};}function saveUpdates(_0x3267f9,_0x255671){return function(_0x309393){if(_0x309393){return _0x309393[_0x231c('0x24')](_0x3267f9)[_0x231c('0x25')](function(_0x54566f){return _0x54566f;});}return null;};}function removeEntity(_0x128112,_0x3336d8){return function(_0x4af49b){if(_0x4af49b){return _0x4af49b[_0x231c('0x26')]()[_0x231c('0x25')](function(){_0x128112['status'](0xcc)[_0x231c('0x1b')]();});}};}function handleEntityNotFound(_0x564939,_0x3ea0cd){return function(_0x454f70){if(!_0x454f70){_0x564939[_0x231c('0x19')](0x194);}return _0x454f70;};}function handleError(_0x2a673c,_0x449d74){_0x449d74=_0x449d74||0x1f4;return function(_0x131cfd){logger[_0x231c('0x27')](_0x131cfd['stack']);if(_0x131cfd[_0x231c('0x28')]){delete _0x131cfd[_0x231c('0x28')];}_0x2a673c['status'](_0x449d74)[_0x231c('0x29')](_0x131cfd);};}exports[_0x231c('0x2a')]=function(_0x45ced8,_0xeeddfc){var _0x271635={},_0x15a9bb={},_0x40f76e={'count':0x0,'rows':[]};var _0x4dfaa3=_[_0x231c('0x2b')](db[_0x231c('0x2c')]['rawAttributes'],function(_0x4be2e2){return{'name':_0x4be2e2['fieldName'],'type':_0x4be2e2[_0x231c('0x2d')]['key']};});_0x15a9bb[_0x231c('0x2e')]=_['map'](_0x4dfaa3,_0x231c('0x28'));_0x15a9bb[_0x231c('0x2f')]=_[_0x231c('0x30')](_0x45ced8[_0x231c('0x2f')]);_0x15a9bb['filters']=_[_0x231c('0x31')](_0x15a9bb[_0x231c('0x2e')],_0x15a9bb[_0x231c('0x2f')]);_0x271635[_0x231c('0x32')]=_[_0x231c('0x31')](_0x15a9bb[_0x231c('0x2e')],qs[_0x231c('0x33')](_0x45ced8[_0x231c('0x2f')]['fields']));_0x271635['attributes']=_0x271635[_0x231c('0x32')][_0x231c('0x34')]?_0x271635[_0x231c('0x32')]:_0x15a9bb[_0x231c('0x2e')];if(!_0x45ced8[_0x231c('0x2f')][_0x231c('0x35')]('nolimit')){_0x271635[_0x231c('0x1f')]=qs[_0x231c('0x1f')](_0x45ced8['query']['limit']);_0x271635[_0x231c('0x1d')]=qs['offset'](_0x45ced8[_0x231c('0x2f')]['offset']);}_0x271635[_0x231c('0x36')]=qs[_0x231c('0x37')](_0x45ced8['query'][_0x231c('0x37')]);_0x271635[_0x231c('0x38')]=qs[_0x231c('0x39')](_['pick'](_0x45ced8[_0x231c('0x2f')],_0x15a9bb[_0x231c('0x39')]),_0x4dfaa3);if(_0x45ced8[_0x231c('0x2f')][_0x231c('0x3a')]){_0x271635[_0x231c('0x38')]=_[_0x231c('0x3b')](_0x271635[_0x231c('0x38')],{'$or':_[_0x231c('0x2b')](_0x4dfaa3,function(_0x409b01){if(_0x409b01[_0x231c('0x2d')]!==_0x231c('0x3c')){var _0x2c8033={};_0x2c8033[_0x409b01[_0x231c('0x28')]]={'$like':'%'+_0x45ced8['query'][_0x231c('0x3a')]+'%'};return _0x2c8033;}})});}_0x271635=_[_0x231c('0x3b')]({},_0x271635,_0x45ced8[_0x231c('0x3d')]);var _0x2f763d={'where':_0x271635[_0x231c('0x38')]};return db['JscriptyAnswerReport'][_0x231c('0x20')](_0x2f763d)[_0x231c('0x25')](function(_0x229953){_0x40f76e['count']=_0x229953;if(_0x45ced8[_0x231c('0x2f')][_0x231c('0x3e')]){_0x271635[_0x231c('0x3f')]=[{'all':!![]}];}return db[_0x231c('0x2c')][_0x231c('0x40')](_0x271635);})[_0x231c('0x25')](function(_0x5d46eb){_0x40f76e[_0x231c('0x41')]=_0x5d46eb;return _0x40f76e;})[_0x231c('0x25')](respondWithFilteredResult(_0xeeddfc,_0x271635))[_0x231c('0x42')](handleError(_0xeeddfc,null));};exports[_0x231c('0x43')]=function(_0x518011,_0x33396b){var _0x523339={'raw':!![],'where':{'id':_0x518011['params']['id']}},_0x26bfd2={};_0x26bfd2[_0x231c('0x2e')]=_[_0x231c('0x30')](db[_0x231c('0x2c')][_0x231c('0x44')]);_0x26bfd2[_0x231c('0x2f')]=_[_0x231c('0x30')](_0x518011['query']);_0x26bfd2[_0x231c('0x39')]=_[_0x231c('0x31')](_0x26bfd2[_0x231c('0x2e')],_0x26bfd2['query']);_0x523339[_0x231c('0x32')]=_[_0x231c('0x31')](_0x26bfd2[_0x231c('0x2e')],qs[_0x231c('0x33')](_0x518011['query'][_0x231c('0x33')]));_0x523339['attributes']=_0x523339[_0x231c('0x32')][_0x231c('0x34')]?_0x523339[_0x231c('0x32')]:_0x26bfd2[_0x231c('0x2e')];if(_0x518011[_0x231c('0x2f')][_0x231c('0x3e')]){_0x523339[_0x231c('0x3f')]=[{'all':!![]}];}_0x523339=_[_0x231c('0x3b')]({},_0x523339,_0x518011[_0x231c('0x3d')]);return db[_0x231c('0x2c')][_0x231c('0x45')](_0x523339)[_0x231c('0x25')](handleEntityNotFound(_0x33396b,null))[_0x231c('0x25')](respondWithResult(_0x33396b,null))[_0x231c('0x42')](handleError(_0x33396b,null));};exports['create']=function(_0x18aaca,_0x293de2){return db[_0x231c('0x2c')][_0x231c('0x46')](_0x18aaca[_0x231c('0x47')],{})['then'](respondWithResult(_0x293de2,0xc9))['catch'](handleError(_0x293de2,null));};exports[_0x231c('0x24')]=function(_0x56a885,_0x419f63){if(_0x56a885[_0x231c('0x47')]['id']){delete _0x56a885[_0x231c('0x47')]['id'];}return db['JscriptyAnswerReport'][_0x231c('0x45')]({'where':{'id':_0x56a885['params']['id']}})[_0x231c('0x25')](handleEntityNotFound(_0x419f63,null))[_0x231c('0x25')](saveUpdates(_0x56a885['body'],null))[_0x231c('0x25')](respondWithResult(_0x419f63,null))[_0x231c('0x42')](handleError(_0x419f63,null));};exports[_0x231c('0x26')]=function(_0x5d2d20,_0x49baac){return db['JscriptyAnswerReport'][_0x231c('0x45')]({'where':{'id':_0x5d2d20[_0x231c('0x48')]['id']}})[_0x231c('0x25')](handleEntityNotFound(_0x49baac,null))['then'](removeEntity(_0x49baac,null))[_0x231c('0x42')](handleError(_0x49baac,null));};exports[_0x231c('0x49')]=function(_0x4fd60b,_0xf225d0){return db[_0x231c('0x2c')][_0x231c('0x49')]()[_0x231c('0x25')](respondWithResult(_0xf225d0,null))[_0x231c('0x42')](handleError(_0xf225d0,null));}; \ No newline at end of file +var _0x41ec=['merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','JscriptyAnswerReport','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x153f0a,_0x13ec50){var _0x38331f=function(_0xea0af6){while(--_0xea0af6){_0x153f0a['push'](_0x153f0a['shift']());}};_0x38331f(++_0x13ec50);}(_0x41ec,0x143));var _0xc41e=function(_0x245dc7,_0x241d42){_0x245dc7=_0x245dc7-0x0;var _0x555ba7=_0x41ec[_0x245dc7];return _0x555ba7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc41e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc41e('0x1'));var rp=require(_0xc41e('0x2'));var moment=require('moment');var BPromise=require(_0xc41e('0x3'));var Mustache=require(_0xc41e('0x4'));var util=require(_0xc41e('0x5'));var path=require(_0xc41e('0x6'));var sox=require(_0xc41e('0x7'));var csv=require(_0xc41e('0x8'));var ejs=require(_0xc41e('0x9'));var fs=require('fs');var fs_extra=require(_0xc41e('0xa'));var _=require(_0xc41e('0xb'));var squel=require(_0xc41e('0xc'));var crypto=require(_0xc41e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc41e('0xe'));var toCsv=require(_0xc41e('0x8'));var querystring=require(_0xc41e('0xf'));var Papa=require(_0xc41e('0x10'));var Redis=require(_0xc41e('0x11'));var authService=require(_0xc41e('0x12'));var qs=require(_0xc41e('0x13'));var as=require(_0xc41e('0x14'));var hardwareService=require(_0xc41e('0x15'));var logger=require(_0xc41e('0x16'))(_0xc41e('0x17'));var utils=require('../../config/utils');var config=require(_0xc41e('0x18'));var licenseUtil=require(_0xc41e('0x19'));var db=require(_0xc41e('0x1a'))['db'];function respondWithStatusCode(_0x3d7280,_0x11a117){_0x11a117=_0x11a117||0xcc;return function(_0x433ca9){if(_0x433ca9){return _0x3d7280[_0xc41e('0x1b')](_0x11a117);}return _0x3d7280[_0xc41e('0x1c')](_0x11a117)['end']();};}function respondWithResult(_0x3b3900,_0x6b614a){_0x6b614a=_0x6b614a||0xc8;return function(_0xcd58a0){if(_0xcd58a0){return _0x3b3900[_0xc41e('0x1c')](_0x6b614a)['json'](_0xcd58a0);}};}function respondWithFilteredResult(_0x5c705e,_0x4f960d){return function(_0x28eb53){if(_0x28eb53){var _0x4293a5=typeof _0x4f960d['offset']===_0xc41e('0x1d')&&typeof _0x4f960d[_0xc41e('0x1e')]==='undefined';var _0x4e7aa3=_0x28eb53[_0xc41e('0x1f')];var _0x5c0517=_0x4293a5?0x0:_0x4f960d[_0xc41e('0x20')];var _0x23c9b6=_0x4293a5?_0x28eb53['count']:_0x4f960d[_0xc41e('0x20')]+_0x4f960d[_0xc41e('0x1e')];var _0xee0f01;if(_0x23c9b6>=_0x4e7aa3){_0x23c9b6=_0x4e7aa3;_0xee0f01=0xc8;}else{_0xee0f01=0xce;}_0x5c705e[_0xc41e('0x1c')](_0xee0f01);return _0x5c705e[_0xc41e('0x21')](_0xc41e('0x22'),_0x5c0517+'-'+_0x23c9b6+'/'+_0x4e7aa3)[_0xc41e('0x23')](_0x28eb53);}return null;};}function patchUpdates(_0x57e0c4){return function(_0x239c25){try{jsonpatch[_0xc41e('0x24')](_0x239c25,_0x57e0c4,!![]);}catch(_0x3f26d5){return BPromise['reject'](_0x3f26d5);}return _0x239c25[_0xc41e('0x25')]();};}function saveUpdates(_0x408d27,_0x814a72){return function(_0x490cc3){if(_0x490cc3){return _0x490cc3[_0xc41e('0x26')](_0x408d27)[_0xc41e('0x27')](function(_0x602bd7){return _0x602bd7;});}return null;};}function removeEntity(_0x4adaad,_0x5a06dd){return function(_0x4c20b1){if(_0x4c20b1){return _0x4c20b1[_0xc41e('0x28')]()[_0xc41e('0x27')](function(){_0x4adaad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a3e0d,_0x1c33a6){return function(_0x1ad4c7){if(!_0x1ad4c7){_0x5a3e0d[_0xc41e('0x1b')](0x194);}return _0x1ad4c7;};}function handleError(_0x467672,_0x1c6a2a){_0x1c6a2a=_0x1c6a2a||0x1f4;return function(_0x580b9e){logger[_0xc41e('0x29')](_0x580b9e[_0xc41e('0x2a')]);if(_0x580b9e[_0xc41e('0x2b')]){delete _0x580b9e['name'];}_0x467672[_0xc41e('0x1c')](_0x1c6a2a)[_0xc41e('0x2c')](_0x580b9e);};}exports['index']=function(_0x25b319,_0x12536e){var _0x5c2c62={},_0xcb3a15={},_0x2fa98a={'count':0x0,'rows':[]};var _0x17246e=_[_0xc41e('0x2d')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x541ac4){return{'name':_0x541ac4[_0xc41e('0x2e')],'type':_0x541ac4[_0xc41e('0x2f')][_0xc41e('0x30')]};});_0xcb3a15[_0xc41e('0x31')]=_[_0xc41e('0x2d')](_0x17246e,_0xc41e('0x2b'));_0xcb3a15[_0xc41e('0x32')]=_['keys'](_0x25b319[_0xc41e('0x32')]);_0xcb3a15[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0xcb3a15['model'],_0xcb3a15[_0xc41e('0x32')]);_0x5c2c62['attributes']=_[_0xc41e('0x34')](_0xcb3a15[_0xc41e('0x31')],qs[_0xc41e('0x35')](_0x25b319[_0xc41e('0x32')]['fields']));_0x5c2c62['attributes']=_0x5c2c62[_0xc41e('0x36')][_0xc41e('0x37')]?_0x5c2c62[_0xc41e('0x36')]:_0xcb3a15[_0xc41e('0x31')];if(!_0x25b319[_0xc41e('0x32')][_0xc41e('0x38')]('nolimit')){_0x5c2c62[_0xc41e('0x1e')]=qs[_0xc41e('0x1e')](_0x25b319[_0xc41e('0x32')]['limit']);_0x5c2c62[_0xc41e('0x20')]=qs[_0xc41e('0x20')](_0x25b319['query'][_0xc41e('0x20')]);}_0x5c2c62[_0xc41e('0x39')]=qs[_0xc41e('0x3a')](_0x25b319[_0xc41e('0x32')][_0xc41e('0x3a')]);_0x5c2c62['where']=qs['filters'](_[_0xc41e('0x3b')](_0x25b319[_0xc41e('0x32')],_0xcb3a15[_0xc41e('0x33')]),_0x17246e);if(_0x25b319[_0xc41e('0x32')][_0xc41e('0x3c')]){_0x5c2c62[_0xc41e('0x3d')]=_[_0xc41e('0x3e')](_0x5c2c62[_0xc41e('0x3d')],{'$or':_[_0xc41e('0x2d')](_0x17246e,function(_0x4de59a){if(_0x4de59a['type']!==_0xc41e('0x3f')){var _0xfd6ff6={};_0xfd6ff6[_0x4de59a[_0xc41e('0x2b')]]={'$like':'%'+_0x25b319[_0xc41e('0x32')][_0xc41e('0x3c')]+'%'};return _0xfd6ff6;}})});}_0x5c2c62=_[_0xc41e('0x3e')]({},_0x5c2c62,_0x25b319[_0xc41e('0x40')]);var _0x150f30={'where':_0x5c2c62['where']};return db['JscriptyAnswerReport'][_0xc41e('0x1f')](_0x150f30)[_0xc41e('0x27')](function(_0x10cfed){_0x2fa98a['count']=_0x10cfed;if(_0x25b319['query'][_0xc41e('0x41')]){_0x5c2c62['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x5c2c62);})['then'](function(_0x3c30e2){_0x2fa98a[_0xc41e('0x42')]=_0x3c30e2;return _0x2fa98a;})[_0xc41e('0x27')](respondWithFilteredResult(_0x12536e,_0x5c2c62))[_0xc41e('0x43')](handleError(_0x12536e,null));};exports[_0xc41e('0x44')]=function(_0x206aa1,_0x4bb1f6){var _0x28d15d={'raw':!![],'where':{'id':_0x206aa1[_0xc41e('0x45')]['id']}},_0x1a3e67={};_0x1a3e67[_0xc41e('0x31')]=_[_0xc41e('0x46')](db[_0xc41e('0x47')]['rawAttributes']);_0x1a3e67[_0xc41e('0x32')]=_[_0xc41e('0x46')](_0x206aa1['query']);_0x1a3e67[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0x1a3e67['model'],_0x1a3e67[_0xc41e('0x32')]);_0x28d15d['attributes']=_[_0xc41e('0x34')](_0x1a3e67[_0xc41e('0x31')],qs[_0xc41e('0x35')](_0x206aa1['query'][_0xc41e('0x35')]));_0x28d15d[_0xc41e('0x36')]=_0x28d15d['attributes']['length']?_0x28d15d['attributes']:_0x1a3e67['model'];if(_0x206aa1[_0xc41e('0x32')]['includeAll']){_0x28d15d[_0xc41e('0x48')]=[{'all':!![]}];}_0x28d15d=_['merge']({},_0x28d15d,_0x206aa1['options']);return db[_0xc41e('0x47')]['find'](_0x28d15d)[_0xc41e('0x27')](handleEntityNotFound(_0x4bb1f6,null))[_0xc41e('0x27')](respondWithResult(_0x4bb1f6,null))[_0xc41e('0x43')](handleError(_0x4bb1f6,null));};exports[_0xc41e('0x49')]=function(_0x46aef6,_0x31b393){return db[_0xc41e('0x47')][_0xc41e('0x49')](_0x46aef6[_0xc41e('0x4a')],{})[_0xc41e('0x27')](respondWithResult(_0x31b393,0xc9))[_0xc41e('0x43')](handleError(_0x31b393,null));};exports['update']=function(_0x4b67d4,_0x1cdf49){if(_0x4b67d4[_0xc41e('0x4a')]['id']){delete _0x4b67d4[_0xc41e('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0xc41e('0x4b')]({'where':{'id':_0x4b67d4[_0xc41e('0x45')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x1cdf49,null))[_0xc41e('0x27')](saveUpdates(_0x4b67d4[_0xc41e('0x4a')],null))[_0xc41e('0x27')](respondWithResult(_0x1cdf49,null))[_0xc41e('0x43')](handleError(_0x1cdf49,null));};exports['destroy']=function(_0x3c867a,_0x317eba){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3c867a[_0xc41e('0x45')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x317eba,null))[_0xc41e('0x27')](removeEntity(_0x317eba,null))[_0xc41e('0x43')](handleError(_0x317eba,null));};exports[_0xc41e('0x4c')]=function(_0x53a799,_0x576831){return db[_0xc41e('0x47')]['describe']()[_0xc41e('0x27')](respondWithResult(_0x576831,null))['catch'](handleError(_0x576831,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 619eb37..6f24630 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 _0x96a4=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x49923f,_0x671404){var _0x560684=function(_0x5a152b){while(--_0x5a152b){_0x49923f['push'](_0x49923f['shift']());}};_0x560684(++_0x671404);}(_0x96a4,0x184));var _0x496a=function(_0x54ae6e,_0x60ad30){_0x54ae6e=_0x54ae6e-0x0;var _0x2d3c06=_0x96a4[_0x54ae6e];return _0x2d3c06;};'use strict';var _=require(_0x496a('0x0'));var util=require(_0x496a('0x1'));var logger=require(_0x496a('0x2'))(_0x496a('0x3'));var moment=require(_0x496a('0x4'));var BPromise=require(_0x496a('0x5'));var rp=require(_0x496a('0x6'));var fs=require('fs');var path=require(_0x496a('0x7'));var rimraf=require('rimraf');var config=require(_0x496a('0x8'));var attributes=require(_0x496a('0x9'));module['exports']=function(_0x15976a,_0x2ff466){return _0x15976a[_0x496a('0xa')](_0x496a('0xb'),attributes,{'tableName':_0x496a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3afb=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','request-promise','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x367e3b,_0x5d92ad){var _0x35568d=function(_0x116002){while(--_0x116002){_0x367e3b['push'](_0x367e3b['shift']());}};_0x35568d(++_0x5d92ad);}(_0x3afb,0x12e));var _0xb3af=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0x3afb[_0x5756c6];return _0x4b5806;};'use strict';var _=require(_0xb3af('0x0'));var util=require(_0xb3af('0x1'));var logger=require('../../config/logger')(_0xb3af('0x2'));var moment=require(_0xb3af('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3af('0x5'));var attributes=require(_0xb3af('0x6'));module[_0xb3af('0x7')]=function(_0x3e1d21,_0x2218e0){return _0x3e1d21['define'](_0xb3af('0x8'),attributes,{'tableName':_0xb3af('0x9'),'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 942768f..cfa3c44 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 _0x2b31=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2b31,0xd2));var _0x12b3=function(_0x1ff096,_0x4dd480){_0x1ff096=_0x1ff096-0x0;var _0x1850b7=_0x2b31[_0x1ff096];return _0x1850b7;};'use strict';var _=require('lodash');var util=require(_0x12b3('0x0'));var moment=require(_0x12b3('0x1'));var BPromise=require(_0x12b3('0x2'));var rs=require(_0x12b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x12b3('0x4'));var logger=require(_0x12b3('0x5'))(_0x12b3('0x6'));var config=require('../../config/environment');var jayson=require(_0x12b3('0x7'));var client=jayson[_0x12b3('0x8')][_0x12b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41a57b,_0x45cd0d,_0x4fa4ad){return new BPromise(function(_0x57c66f,_0x31d27c){return client[_0x12b3('0xa')](_0x41a57b,_0x4fa4ad)[_0x12b3('0xb')](function(_0x383c12){logger[_0x12b3('0xc')](_0x12b3('0xd'),_0x45cd0d,_0x12b3('0xe'));logger[_0x12b3('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x45cd0d,_0x12b3('0xe'),JSON[_0x12b3('0x10')](_0x383c12));if(_0x383c12[_0x12b3('0x11')]){if(_0x383c12['error'][_0x12b3('0x12')]===0x1f4){logger[_0x12b3('0x11')](_0x12b3('0xd'),_0x45cd0d,_0x383c12[_0x12b3('0x11')][_0x12b3('0x13')]);return _0x31d27c(_0x383c12[_0x12b3('0x11')][_0x12b3('0x13')]);}logger['error'](_0x12b3('0xd'),_0x45cd0d,_0x383c12[_0x12b3('0x11')][_0x12b3('0x13')]);return _0x57c66f(_0x383c12[_0x12b3('0x11')][_0x12b3('0x13')]);}else{logger[_0x12b3('0xc')](_0x12b3('0xd'),_0x45cd0d,_0x12b3('0xe'));_0x57c66f(_0x383c12['result'][_0x12b3('0x13')]);}})['catch'](function(_0x7f02a1){logger[_0x12b3('0x11')](_0x12b3('0xd'),_0x45cd0d,_0x7f02a1);_0x31d27c(_0x7f02a1);});});} \ No newline at end of file +var _0x5b34=['code','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2088af,_0x4a47b4){var _0x2469eb=function(_0x276239){while(--_0x276239){_0x2088af['push'](_0x2088af['shift']());}};_0x2469eb(++_0x4a47b4);}(_0x5b34,0x13a));var _0x45b3=function(_0x4c7ff3,_0x56437b){_0x4c7ff3=_0x4c7ff3-0x0;var _0x94061b=_0x5b34[_0x4c7ff3];return _0x94061b;};'use strict';var _=require('lodash');var util=require(_0x45b3('0x0'));var moment=require(_0x45b3('0x1'));var BPromise=require(_0x45b3('0x2'));var rs=require(_0x45b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45b3('0x4'))['db'];var utils=require(_0x45b3('0x5'));var logger=require('../../config/logger')(_0x45b3('0x6'));var config=require(_0x45b3('0x7'));var jayson=require(_0x45b3('0x8'));var client=jayson['client'][_0x45b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x77af39,_0x37bb98,_0x2c2d12){return new BPromise(function(_0xa70273,_0x53857a){return client[_0x45b3('0xa')](_0x77af39,_0x2c2d12)[_0x45b3('0xb')](function(_0x584654){logger[_0x45b3('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x37bb98,_0x45b3('0xd'));logger['debug'](_0x45b3('0xe'),_0x37bb98,'request\x20sent',JSON[_0x45b3('0xf')](_0x584654));if(_0x584654['error']){if(_0x584654['error'][_0x45b3('0x10')]===0x1f4){logger[_0x45b3('0x11')](_0x45b3('0x12'),_0x37bb98,_0x584654[_0x45b3('0x11')][_0x45b3('0x13')]);return _0x53857a(_0x584654[_0x45b3('0x11')]['message']);}logger[_0x45b3('0x11')](_0x45b3('0x12'),_0x37bb98,_0x584654[_0x45b3('0x11')]['message']);return _0xa70273(_0x584654['error']['message']);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x37bb98,_0x45b3('0xd'));_0xa70273(_0x584654[_0x45b3('0x14')][_0x45b3('0x13')]);}})[_0x45b3('0x15')](function(_0x92e3f3){logger[_0x45b3('0x11')](_0x45b3('0x12'),_0x37bb98,_0x92e3f3);_0x53857a(_0x92e3f3);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 009de1e..85a4a44 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 _0x93e4=['fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','destroy','exports','multer','util','path','express','Router'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x93e4,0x1c7));var _0x493e=function(_0x36e6e4,_0x1216a6){_0x36e6e4=_0x36e6e4-0x0;var _0x514205=_0x93e4[_0x36e6e4];return _0x514205;};'use strict';var multer=require(_0x493e('0x0'));var util=require(_0x493e('0x1'));var path=require(_0x493e('0x2'));var timeout=require('connect-timeout');var express=require(_0x493e('0x3'));var router=express[_0x493e('0x4')]();var fs_extra=require(_0x493e('0x5'));var auth=require(_0x493e('0x6'));var interaction=require(_0x493e('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0x493e('0x8')]('/',auth['isAuthenticated'](),controller[_0x493e('0x9')]);router[_0x493e('0x8')](_0x493e('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/sessions',auth[_0x493e('0xb')](),controller[_0x493e('0xc')]);router[_0x493e('0x8')]('/:id/answers',auth['isAuthenticated'](),controller[_0x493e('0xd')]);router[_0x493e('0x8')](_0x493e('0xe'),auth['isAuthenticated'](),timeout(_0x493e('0xf')),controller[_0x493e('0x10')]);router[_0x493e('0x11')]('/',auth[_0x493e('0xb')](),controller[_0x493e('0x12')]);router[_0x493e('0x11')](_0x493e('0x13'),auth[_0x493e('0xb')](),controller[_0x493e('0x14')]);router['put'](_0x493e('0xa'),auth[_0x493e('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x493e('0x15')]);module[_0x493e('0x16')]=router; \ No newline at end of file +var _0xb9f7=['isAuthenticated','index','get','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','post','create','/:id/clone','clone','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x293e99,_0x3c26cb){var _0x5a8cdc=function(_0xa3aa29){while(--_0xa3aa29){_0x293e99['push'](_0x293e99['shift']());}};_0x5a8cdc(++_0x3c26cb);}(_0xb9f7,0x171));var _0x7b9f=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xb9f7[_0x57add2];return _0x4e3670;};'use strict';var multer=require(_0x7b9f('0x0'));var util=require(_0x7b9f('0x1'));var path=require(_0x7b9f('0x2'));var timeout=require(_0x7b9f('0x3'));var express=require('express');var router=express[_0x7b9f('0x4')]();var fs_extra=require(_0x7b9f('0x5'));var auth=require(_0x7b9f('0x6'));var interaction=require(_0x7b9f('0x7'));var config=require(_0x7b9f('0x8'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x7b9f('0x9')](),controller[_0x7b9f('0xa')]);router[_0x7b9f('0xb')]('/:id',auth[_0x7b9f('0x9')](),controller[_0x7b9f('0xc')]);router[_0x7b9f('0xb')](_0x7b9f('0xd'),auth['isAuthenticated'](),controller[_0x7b9f('0xe')]);router[_0x7b9f('0xb')](_0x7b9f('0xf'),auth['isAuthenticated'](),controller[_0x7b9f('0x10')]);router[_0x7b9f('0xb')](_0x7b9f('0x11'),auth[_0x7b9f('0x9')](),timeout('30s'),controller['getSummary']);router[_0x7b9f('0x12')]('/',auth['isAuthenticated'](),controller[_0x7b9f('0x13')]);router[_0x7b9f('0x12')](_0x7b9f('0x14'),auth[_0x7b9f('0x9')](),controller[_0x7b9f('0x15')]);router[_0x7b9f('0x16')](_0x7b9f('0x17'),auth['isAuthenticated'](),controller[_0x7b9f('0x18')]);router['delete'](_0x7b9f('0x17'),auth[_0x7b9f('0x9')](),controller[_0x7b9f('0x19')]);module[_0x7b9f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1d8d7fa..67f3acc 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 _0x8828=['name','getDataValue','description','BOOLEAN','sequelize','util','STRING','TEXT','isObjectLike','setDataValue','stringify','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x48ebe8,_0x16e184){var _0xa95841=function(_0x1e31a5){while(--_0x1e31a5){_0x48ebe8['push'](_0x48ebe8['shift']());}};_0xa95841(++_0x16e184);}(_0x8828,0x1a8));var _0x8882=function(_0x5c10b5,_0x202e93){_0x5c10b5=_0x5c10b5-0x0;var _0x2f4001=_0x8828[_0x5c10b5];return _0x2f4001;};'use strict';var Sequelize=require(_0x8882('0x0'));var _=require('lodash');var util=require(_0x8882('0x1'));module['exports']={'name':{'type':Sequelize[_0x8882('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x8882('0x3')]('long'),'set':function(_0x3650b1){if(_[_0x8882('0x4')](_0x3650b1)){this[_0x8882('0x5')]('formData',JSON[_0x8882('0x6')](_0x3650b1));}else if(_['isString'](_0x3650b1)){this[_0x8882('0x5')](_0x8882('0x7'),_0x3650b1);}else{this[_0x8882('0x5')]('formData',util[_0x8882('0x8')](_0x8882('0x9'),this['getDataValue'](_0x8882('0xa'))||'',this[_0x8882('0xb')](_0x8882('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8882('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3e81=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','name','STRING','TEXT','long','formData','stringify','isString','setDataValue'];(function(_0x3dbe46,_0x3a08e6){var _0xa7c998=function(_0x2e0fb4){while(--_0x2e0fb4){_0x3dbe46['push'](_0x3dbe46['shift']());}};_0xa7c998(++_0x3a08e6);}(_0x3e81,0xe4));var _0x13e8=function(_0x395791,_0x38c864){_0x395791=_0x395791-0x0;var _0x217514=_0x3e81[_0x395791];return _0x217514;};'use strict';var Sequelize=require(_0x13e8('0x0'));var _=require(_0x13e8('0x1'));var util=require(_0x13e8('0x2'));module[_0x13e8('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x13e8('0x4')},'description':{'type':Sequelize[_0x13e8('0x5')]},'formData':{'type':Sequelize[_0x13e8('0x6')](_0x13e8('0x7')),'set':function(_0x13338b){if(_['isObjectLike'](_0x13338b)){this['setDataValue'](_0x13e8('0x8'),JSON[_0x13e8('0x9')](_0x13338b));}else if(_[_0x13e8('0xa')](_0x13338b)){this[_0x13e8('0xb')](_0x13e8('0x8'),_0x13338b);}else{this[_0x13e8('0xb')](_0x13e8('0x8'),util['format'](_0x13e8('0xc'),this[_0x13e8('0xd')]('name')||'',this[_0x13e8('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x13e8('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9db9262..fe2b617 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 _0x83d4=['-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','writeFileSync','format','setHeader','Content-disposition','text/csv','download','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','limit','undefined','offset','Content-Range','apply','reject','save','Projects','UserProfileResource','destroy','then','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','find','omit','createdAt','body','updatedAt','role','update','getSessions','findOne','order','JscriptySessionReport','rows','JscriptyAnswerReport','ProjectId','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','JscriptyQuestionReport'];(function(_0x45da5e,_0x2d316e){var _0x38f451=function(_0x270f2e){while(--_0x270f2e){_0x45da5e['push'](_0x45da5e['shift']());}};_0x38f451(++_0x2d316e);}(_0x83d4,0xf1));var _0x483d=function(_0x59aac4,_0x5744ed){_0x59aac4=_0x59aac4-0x0;var _0x580583=_0x83d4[_0x59aac4];return _0x580583;};'use strict';var emlformat=require(_0x483d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x483d('0x1'));var rp=require('request-promise');var moment=require(_0x483d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x483d('0x3'));var util=require(_0x483d('0x4'));var path=require(_0x483d('0x5'));var sox=require(_0x483d('0x6'));var csv=require(_0x483d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x483d('0x8'));var _=require(_0x483d('0x9'));var squel=require(_0x483d('0xa'));var crypto=require(_0x483d('0xb'));var jsforce=require(_0x483d('0xc'));var deskjs=require(_0x483d('0xd'));var toCsv=require(_0x483d('0x7'));var querystring=require(_0x483d('0xe'));var Papa=require(_0x483d('0xf'));var Redis=require('ioredis');var authService=require(_0x483d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x483d('0x11'));var hardwareService=require(_0x483d('0x12'));var logger=require('../../config/logger')(_0x483d('0x13'));var utils=require(_0x483d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fdc2b,_0x4b0859){_0x4b0859=_0x4b0859||0xcc;return function(_0x3aa564){if(_0x3aa564){return _0x1fdc2b[_0x483d('0x15')](_0x4b0859);}return _0x1fdc2b[_0x483d('0x16')](_0x4b0859)[_0x483d('0x17')]();};}function respondWithResult(_0x478904,_0x1d6412){_0x1d6412=_0x1d6412||0xc8;return function(_0x16535b){if(_0x16535b){return _0x478904[_0x483d('0x16')](_0x1d6412)[_0x483d('0x18')](_0x16535b);}};}function respondWithFilteredResult(_0x55e0b8,_0x1aed6d){return function(_0x659927){if(_0x659927){var _0x51d4e0=typeof _0x1aed6d['offset']==='undefined'&&typeof _0x1aed6d[_0x483d('0x19')]===_0x483d('0x1a');var _0x4306ab=_0x659927['count'];var _0x44e488=_0x51d4e0?0x0:_0x1aed6d[_0x483d('0x1b')];var _0x4071b2=_0x51d4e0?_0x659927['count']:_0x1aed6d['offset']+_0x1aed6d[_0x483d('0x19')];var _0x3de114;if(_0x4071b2>=_0x4306ab){_0x4071b2=_0x4306ab;_0x3de114=0xc8;}else{_0x3de114=0xce;}_0x55e0b8['status'](_0x3de114);return _0x55e0b8['set'](_0x483d('0x1c'),_0x44e488+'-'+_0x4071b2+'/'+_0x4306ab)[_0x483d('0x18')](_0x659927);}return null;};}function patchUpdates(_0x27c9b9){return function(_0x3cae2b){try{jsonpatch[_0x483d('0x1d')](_0x3cae2b,_0x27c9b9,!![]);}catch(_0x16f966){return BPromise[_0x483d('0x1e')](_0x16f966);}return _0x3cae2b[_0x483d('0x1f')]();};}function saveUpdates(_0x7c49c5,_0x57d772){return function(_0x5dc59b){if(_0x5dc59b){return _0x5dc59b['update'](_0x7c49c5)['then'](function(_0x475731){return _0x475731;});}return null;};}function removeEntity(_0x438189,_0x43b7b6){return function(_0x1e54f1){if(_0x1e54f1){return _0x1e54f1['destroy']()['then'](function(){var _0x40759e=_0x1e54f1['get']({'plain':!![]});var _0x1bf9dc=_0x483d('0x20');return db[_0x483d('0x21')][_0x483d('0x22')]({'where':{'type':_0x1bf9dc,'resourceId':_0x40759e['id']}})[_0x483d('0x23')](function(){return _0x1e54f1;});})[_0x483d('0x23')](function(){_0x438189['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8ed4,_0x446472){return function(_0x5f1841){if(!_0x5f1841){_0x1d8ed4[_0x483d('0x15')](0x194);}return _0x5f1841;};}function handleError(_0x355a6a,_0xcc060a){_0xcc060a=_0xcc060a||0x1f4;return function(_0x5310e7){logger[_0x483d('0x24')](_0x5310e7[_0x483d('0x25')]);if(_0x5310e7[_0x483d('0x26')]){delete _0x5310e7['name'];}_0x355a6a[_0x483d('0x16')](_0xcc060a)[_0x483d('0x27')](_0x5310e7);};}exports[_0x483d('0x28')]=function(_0x474a83,_0x56c225){var _0x5ac9ef={},_0x5a0c20={},_0x41ffb6={'count':0x0,'rows':[]};var _0x28dc10=_['map'](db[_0x483d('0x29')][_0x483d('0x2a')],function(_0x4ac798){return{'name':_0x4ac798[_0x483d('0x2b')],'type':_0x4ac798[_0x483d('0x2c')][_0x483d('0x2d')]};});_0x5a0c20['model']=_['map'](_0x28dc10,_0x483d('0x26'));_0x5a0c20[_0x483d('0x2e')]=_[_0x483d('0x2f')](_0x474a83[_0x483d('0x2e')]);_0x5a0c20[_0x483d('0x30')]=_[_0x483d('0x31')](_0x5a0c20[_0x483d('0x32')],_0x5a0c20[_0x483d('0x2e')]);_0x5ac9ef[_0x483d('0x33')]=_[_0x483d('0x31')](_0x5a0c20[_0x483d('0x32')],qs[_0x483d('0x34')](_0x474a83[_0x483d('0x2e')]['fields']));_0x5ac9ef[_0x483d('0x33')]=_0x5ac9ef[_0x483d('0x33')][_0x483d('0x35')]?_0x5ac9ef[_0x483d('0x33')]:_0x5a0c20[_0x483d('0x32')];if(!_0x474a83['query'][_0x483d('0x36')](_0x483d('0x37'))){_0x5ac9ef[_0x483d('0x19')]=qs[_0x483d('0x19')](_0x474a83[_0x483d('0x2e')]['limit']);_0x5ac9ef[_0x483d('0x1b')]=qs['offset'](_0x474a83['query'][_0x483d('0x1b')]);}_0x5ac9ef['order']=qs[_0x483d('0x38')](_0x474a83['query'][_0x483d('0x38')]);_0x5ac9ef[_0x483d('0x39')]=qs['filters'](_[_0x483d('0x3a')](_0x474a83['query'],_0x5a0c20[_0x483d('0x30')]),_0x28dc10);if(_0x474a83[_0x483d('0x2e')][_0x483d('0x3b')]){_0x5ac9ef['where']=_[_0x483d('0x3c')](_0x5ac9ef['where'],{'$or':_[_0x483d('0x3d')](_0x28dc10,function(_0x2acb8a){if(_0x2acb8a[_0x483d('0x2c')]!==_0x483d('0x3e')){var _0xfca91f={};_0xfca91f[_0x2acb8a[_0x483d('0x26')]]={'$like':'%'+_0x474a83[_0x483d('0x2e')][_0x483d('0x3b')]+'%'};return _0xfca91f;}})});}_0x5ac9ef=_[_0x483d('0x3c')]({},_0x5ac9ef,_0x474a83[_0x483d('0x3f')]);var _0x37023d={'where':_0x5ac9ef[_0x483d('0x39')]};return db[_0x483d('0x29')][_0x483d('0x40')](_0x37023d)['then'](function(_0x25b4f9){_0x41ffb6[_0x483d('0x40')]=_0x25b4f9;if(_0x474a83[_0x483d('0x2e')][_0x483d('0x41')]){_0x5ac9ef[_0x483d('0x42')]=[{'all':!![]}];}return db[_0x483d('0x29')][_0x483d('0x43')](_0x5ac9ef);})['then'](function(_0x270eab){_0x41ffb6['rows']=_0x270eab;return _0x41ffb6;})[_0x483d('0x23')](respondWithFilteredResult(_0x56c225,_0x5ac9ef))[_0x483d('0x44')](handleError(_0x56c225,null));};exports['show']=function(_0x12c7a9,_0x3b0b14){var _0x1cab25={'raw':![],'where':{'id':_0x12c7a9['params']['id']}},_0x17a7be={};_0x17a7be[_0x483d('0x32')]=_[_0x483d('0x2f')](db[_0x483d('0x29')][_0x483d('0x2a')]);_0x17a7be[_0x483d('0x2e')]=_[_0x483d('0x2f')](_0x12c7a9[_0x483d('0x2e')]);_0x17a7be[_0x483d('0x30')]=_['intersection'](_0x17a7be['model'],_0x17a7be[_0x483d('0x2e')]);_0x1cab25[_0x483d('0x33')]=_[_0x483d('0x31')](_0x17a7be[_0x483d('0x32')],qs[_0x483d('0x34')](_0x12c7a9['query'][_0x483d('0x34')]));_0x1cab25[_0x483d('0x33')]=_0x1cab25['attributes'][_0x483d('0x35')]?_0x1cab25[_0x483d('0x33')]:_0x17a7be[_0x483d('0x32')];if(_0x12c7a9[_0x483d('0x2e')][_0x483d('0x41')]){_0x1cab25[_0x483d('0x42')]=[{'all':!![]}];}_0x1cab25=_[_0x483d('0x3c')]({},_0x1cab25,_0x12c7a9[_0x483d('0x3f')]);return db[_0x483d('0x29')]['find'](_0x1cab25)[_0x483d('0x23')](handleEntityNotFound(_0x3b0b14,null))[_0x483d('0x23')](respondWithResult(_0x3b0b14,null))[_0x483d('0x44')](handleError(_0x3b0b14,null));};exports[_0x483d('0x45')]=function(_0xfb479a,_0x51bc09){return db[_0x483d('0x29')][_0x483d('0x45')](_0xfb479a['body'],{})[_0x483d('0x23')](function(_0x3215a4){var _0x497065=_0xfb479a['user'][_0x483d('0x46')]({'plain':!![]});if(!_0x497065)throw new Error(_0x483d('0x47'));if(_0x497065['role']===_0x483d('0x48')){var _0x2f8141=_0x3215a4[_0x483d('0x46')]({'plain':!![]});var _0x366ff8=_0x483d('0x20');return db[_0x483d('0x49')]['find']({'where':{'name':_0x366ff8,'userProfileId':_0x497065[_0x483d('0x4a')]},'raw':!![]})[_0x483d('0x23')](function(_0x558330){if(_0x558330&&_0x558330[_0x483d('0x4b')]===0x0){return db[_0x483d('0x21')]['create']({'name':_0x2f8141[_0x483d('0x26')],'resourceId':_0x2f8141['id'],'type':_0x558330[_0x483d('0x26')],'sectionId':_0x558330['id']},{})['then'](function(){return _0x3215a4;});}else{return _0x3215a4;}})[_0x483d('0x44')](function(_0x5897b2){logger[_0x483d('0x24')](_0x483d('0x4c'),_0x5897b2);throw _0x5897b2;});}return _0x3215a4;})['then'](respondWithResult(_0x51bc09,0xc9))[_0x483d('0x44')](handleError(_0x51bc09,null));};exports[_0x483d('0x4d')]=function(_0x1eb751,_0x404faf){var _0x4fbd75={'where':{'id':_0x1eb751[_0x483d('0x4e')]['id']}},_0x5da9b={};_0x5da9b[_0x483d('0x32')]=_[_0x483d('0x2f')](db['JscriptyProject'][_0x483d('0x2a')]);_0x4fbd75[_0x483d('0x33')]=_[_0x483d('0x31')](_0x5da9b[_0x483d('0x32')],qs[_0x483d('0x34')](_0x1eb751['query'][_0x483d('0x34')]));_0x4fbd75[_0x483d('0x33')]=_0x4fbd75['attributes'][_0x483d('0x35')]?_0x4fbd75[_0x483d('0x33')]:_0x5da9b[_0x483d('0x32')];if(_0x1eb751[_0x483d('0x2e')][_0x483d('0x41')]){_0x4fbd75[_0x483d('0x42')]=[{'all':!![]}];}_0x4fbd75=_[_0x483d('0x3c')]({},_0x4fbd75,_0x1eb751[_0x483d('0x3f')]);return db[_0x483d('0x29')][_0x483d('0x4f')](_0x4fbd75)['then'](handleEntityNotFound(_0x404faf,null))[_0x483d('0x23')](function(_0x17bb56){if(_0x17bb56){var _0x3b7537=_0x17bb56[_0x483d('0x46')]({'plain':!![]});_0x3b7537=qs[_0x483d('0x50')](_0x3b7537,['id',_0x483d('0x51'),'updatedAt']);_0x1eb751['body']=_[_0x483d('0x50')](_0x1eb751[_0x483d('0x52')],['id',_0x483d('0x51'),_0x483d('0x53')]);return db['JscriptyProject']['create'](_[_0x483d('0x3c')](_0x3b7537,_0x1eb751[_0x483d('0x52')]),{'include':_0x1eb751[_0x483d('0x2e')][_0x483d('0x41')]?[{'all':!![]}]:undefined})[_0x483d('0x23')](function(_0x558a47){var _0x12ac7a=_0x1eb751['user'][_0x483d('0x46')]({'plain':!![]});if(!_0x12ac7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ac7a[_0x483d('0x54')]==='user'){var _0x143c7f=_0x558a47[_0x483d('0x46')]({'plain':!![]});var _0x3a72c6=_0x483d('0x20');return db[_0x483d('0x49')][_0x483d('0x4f')]({'where':{'name':_0x3a72c6,'userProfileId':_0x12ac7a[_0x483d('0x4a')]},'raw':!![]})[_0x483d('0x23')](function(_0x3037b9){if(_0x3037b9&&_0x3037b9[_0x483d('0x4b')]===0x0){return db[_0x483d('0x21')][_0x483d('0x45')]({'name':_0x143c7f['name'],'resourceId':_0x143c7f['id'],'type':_0x3037b9['name'],'sectionId':_0x3037b9['id']},{})['then'](function(){return _0x558a47;});}else{return _0x558a47;}})[_0x483d('0x44')](function(_0x87103e){logger['error'](_0x483d('0x4c'),_0x87103e);throw _0x87103e;});}return _0x558a47;});}})[_0x483d('0x23')](respondWithResult(_0x404faf,0xc9))['catch'](handleError(_0x404faf,null));};exports[_0x483d('0x55')]=function(_0x4ce801,_0x2717f7){if(_0x4ce801['body']['id']){delete _0x4ce801[_0x483d('0x52')]['id'];}return db['JscriptyProject'][_0x483d('0x4f')]({'where':{'id':_0x4ce801['params']['id']}})[_0x483d('0x23')](handleEntityNotFound(_0x2717f7,null))[_0x483d('0x23')](saveUpdates(_0x4ce801[_0x483d('0x52')],null))[_0x483d('0x23')](respondWithResult(_0x2717f7,null))['catch'](handleError(_0x2717f7,null));};exports['destroy']=function(_0x3e1b5d,_0x3e5c26){return db['JscriptyProject'][_0x483d('0x4f')]({'where':{'id':_0x3e1b5d[_0x483d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e5c26,null))[_0x483d('0x23')](removeEntity(_0x3e5c26,null))[_0x483d('0x44')](handleError(_0x3e5c26,null));};exports[_0x483d('0x56')]=function(_0x34d6f2,_0x334844,_0x4ba29c){var _0x1b12a9={'raw':!![],'where':{}};var _0x307179={};var _0x434726={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x483d('0x57')]({'where':{'id':_0x34d6f2[_0x483d('0x4e')]['id']}})[_0x483d('0x23')](handleEntityNotFound(_0x334844,null))[_0x483d('0x23')](function(_0x3c9b1b){if(_0x3c9b1b){_0x307179['model']=_[_0x483d('0x2f')](db['JscriptySessionReport']['rawAttributes']);_0x307179[_0x483d('0x2e')]=_['keys'](_0x34d6f2[_0x483d('0x2e')]);_0x307179[_0x483d('0x30')]=_[_0x483d('0x31')](_0x307179['model'],_0x307179['query']);_0x1b12a9[_0x483d('0x33')]=_[_0x483d('0x31')](_0x307179[_0x483d('0x32')],qs[_0x483d('0x34')](_0x34d6f2[_0x483d('0x2e')][_0x483d('0x34')]));_0x1b12a9[_0x483d('0x33')]=_0x1b12a9[_0x483d('0x33')][_0x483d('0x35')]?_0x1b12a9[_0x483d('0x33')]:_0x307179[_0x483d('0x32')];if(!_0x34d6f2[_0x483d('0x2e')][_0x483d('0x36')](_0x483d('0x37'))){_0x1b12a9[_0x483d('0x19')]=qs[_0x483d('0x19')](_0x34d6f2[_0x483d('0x2e')]['limit']);_0x1b12a9['offset']=qs[_0x483d('0x1b')](_0x34d6f2[_0x483d('0x2e')]['offset']);}_0x1b12a9[_0x483d('0x58')]=qs[_0x483d('0x38')](_0x34d6f2[_0x483d('0x2e')][_0x483d('0x38')]);_0x1b12a9[_0x483d('0x39')]=qs['filters'](_[_0x483d('0x3a')](_0x34d6f2[_0x483d('0x2e')],_0x307179[_0x483d('0x30')]));_0x1b12a9[_0x483d('0x39')]['ProjectId']=_0x3c9b1b['id'];if(_0x34d6f2['query'][_0x483d('0x3b')]){_0x1b12a9[_0x483d('0x39')]=_[_0x483d('0x3c')](_0x1b12a9[_0x483d('0x39')],{'$or':_[_0x483d('0x3d')](_0x1b12a9[_0x483d('0x33')],function(_0x136689){var _0x15bc71={};_0x15bc71[_0x136689]={'$like':'%'+_0x34d6f2[_0x483d('0x2e')][_0x483d('0x3b')]+'%'};return _0x15bc71;})});}_0x1b12a9=_[_0x483d('0x3c')]({},_0x1b12a9,_0x34d6f2['options']);return db[_0x483d('0x59')]['count']({'where':_0x1b12a9[_0x483d('0x39')]})[_0x483d('0x23')](function(_0x1ba8ed){_0x434726[_0x483d('0x40')]=_0x1ba8ed;if(_0x34d6f2['query'][_0x483d('0x41')]){_0x1b12a9[_0x483d('0x42')]=[{'all':!![]}];}return db[_0x483d('0x59')][_0x483d('0x43')](_0x1b12a9);})[_0x483d('0x23')](function(_0x1758a6){_0x434726[_0x483d('0x5a')]=_0x1758a6;return _0x434726;});}})[_0x483d('0x23')](respondWithFilteredResult(_0x334844,_0x1b12a9))[_0x483d('0x44')](handleError(_0x334844,null));};exports['getAnswers']=function(_0x19189c,_0x1baa91,_0x3e4c0f){var _0x527fdf={'raw':!![],'where':{}};var _0x3983bf={};var _0x28a1fd={'count':0x0,'rows':[]};return db[_0x483d('0x29')][_0x483d('0x57')]({'where':{'id':_0x19189c[_0x483d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1baa91,null))['then'](function(_0x356790){if(_0x356790){_0x3983bf['model']=_[_0x483d('0x2f')](db[_0x483d('0x5b')][_0x483d('0x2a')]);_0x3983bf['query']=_[_0x483d('0x2f')](_0x19189c[_0x483d('0x2e')]);_0x3983bf[_0x483d('0x30')]=_[_0x483d('0x31')](_0x3983bf[_0x483d('0x32')],_0x3983bf[_0x483d('0x2e')]);_0x527fdf['attributes']=_['intersection'](_0x3983bf[_0x483d('0x32')],qs[_0x483d('0x34')](_0x19189c['query']['fields']));_0x527fdf[_0x483d('0x33')]=_0x527fdf[_0x483d('0x33')][_0x483d('0x35')]?_0x527fdf[_0x483d('0x33')]:_0x3983bf[_0x483d('0x32')];if(!_0x19189c[_0x483d('0x2e')]['hasOwnProperty'](_0x483d('0x37'))){_0x527fdf['limit']=qs['limit'](_0x19189c[_0x483d('0x2e')][_0x483d('0x19')]);_0x527fdf[_0x483d('0x1b')]=qs[_0x483d('0x1b')](_0x19189c['query']['offset']);}_0x527fdf[_0x483d('0x58')]=qs[_0x483d('0x38')](_0x19189c[_0x483d('0x2e')][_0x483d('0x38')]);_0x527fdf[_0x483d('0x39')]=qs[_0x483d('0x30')](_[_0x483d('0x3a')](_0x19189c['query'],_0x3983bf[_0x483d('0x30')]));_0x527fdf['where'][_0x483d('0x5c')]=_0x356790['id'];if(_0x19189c[_0x483d('0x2e')]['filter']){_0x527fdf[_0x483d('0x39')]=_['merge'](_0x527fdf[_0x483d('0x39')],{'$or':_[_0x483d('0x3d')](_0x527fdf['attributes'],function(_0x202d22){var _0x33e7f3={};_0x33e7f3[_0x202d22]={'$like':'%'+_0x19189c[_0x483d('0x2e')][_0x483d('0x3b')]+'%'};return _0x33e7f3;})});}_0x527fdf=_[_0x483d('0x3c')]({},_0x527fdf,_0x19189c[_0x483d('0x3f')]);return db['JscriptyAnswerReport'][_0x483d('0x40')]({'where':_0x527fdf[_0x483d('0x39')]})['then'](function(_0x2c9039){_0x28a1fd['count']=_0x2c9039;if(_0x19189c['query']['includeAll']){_0x527fdf[_0x483d('0x42')]=[{'all':!![]}];}return db[_0x483d('0x5b')][_0x483d('0x43')](_0x527fdf);})[_0x483d('0x23')](function(_0x2c6597){_0x28a1fd[_0x483d('0x5a')]=_0x2c6597;return _0x28a1fd;});}})[_0x483d('0x23')](respondWithFilteredResult(_0x1baa91,_0x527fdf))[_0x483d('0x44')](handleError(_0x1baa91,null));};function char(_0x3c1329){return'number'===typeof _0x3c1329?String[_0x483d('0x5d')][_0x483d('0x1d')](null,arguments):_0x3c1329;}function needsEncapsulation(_0x3dcc93){return!!_0x3dcc93&&(_0x3dcc93[_0x483d('0x5e')]()[_0x483d('0x5f')](char(0xd))>=0x0||_0x3dcc93[_0x483d('0x5e')]()[_0x483d('0x5f')](char(0xa))>=0x0||_0x3dcc93[_0x483d('0x5e')]()[_0x483d('0x5f')](char(0x2c))>=0x0||_0x3dcc93[_0x483d('0x5e')]()[_0x483d('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x26f8f5){var _0x4dff23=char(0x22),_0x878eea='\x5c'+char(0x22),_0x253cd3=_0x26f8f5[_0x483d('0x5e')]()[_0x483d('0x60')](new RegExp(_0x4dff23,'g'),_0x878eea);return _0x4dff23+_0x253cd3+_0x4dff23;}exports[_0x483d('0x61')]=function(_0x401f1f,_0x26bf39,_0x371e23){var _0x3a0ac9,_0x1cc529;var _0x4abdad={'where':{'ProjectId':_0x401f1f['params']['id']}};if(_0x401f1f[_0x483d('0x2e')]['startTime']){_0x4abdad[_0x483d('0x39')]['starttime']=JSON[_0x483d('0x62')](_0x401f1f['query'][_0x483d('0x63')]);}return db[_0x483d('0x59')]['findAll'](_0x4abdad)[_0x483d('0x23')](handleEntityNotFound(_0x26bf39,null))[_0x483d('0x23')](function(_0x5a47ab){if(_0x5a47ab){_0x3a0ac9=_0x5a47ab;return db[_0x483d('0x64')][_0x483d('0x43')]({'where':{'SessionId':{'$in':_[_0x483d('0x3d')](_0x3a0ac9,'id')},'ProjectId':_0x401f1f[_0x483d('0x4e')]['id']},'order':_0x483d('0x65')});}})[_0x483d('0x23')](handleEntityNotFound(_0x26bf39,null))['then'](function(_0x31915a){if(_0x31915a){_0x1cc529=_0x31915a;var _0x12ee30={};for(var _0x1f1dfb=0x0,_0x3879c1=_0x1cc529['length'];_0x1f1dfb<_0x3879c1;_0x1f1dfb++){if(!_0x12ee30['hasOwnProperty'](_0x1cc529[_0x1f1dfb][_0x483d('0x66')])){_0x12ee30[_0x1cc529[_0x1f1dfb][_0x483d('0x66')]]=needsEncapsulation(_0x1cc529[_0x1f1dfb][_0x483d('0x67')])?encapsulate(_0x1cc529[_0x1f1dfb][_0x483d('0x67')]):_0x1cc529[_0x1f1dfb][_0x483d('0x67')];}}var _0x468b7d=[],_0x369e4b={};for(var _0x18233d=0x0,_0x3d0fca=_0x3a0ac9['length'];_0x18233d<_0x3d0fca;_0x18233d++){_0x369e4b={'ProjectId':_0x401f1f[_0x483d('0x4e')]['id'],'SessionId':_0x3a0ac9[_0x18233d]['id'],'StartTime':moment(_0x3a0ac9[_0x18233d][_0x483d('0x68')])['format'](_0x483d('0x69'))};for(var _0x4ed5c9=0x0,_0x4add71=_0x1cc529[_0x483d('0x35')];_0x4ed5c9<_0x4add71;_0x4ed5c9++){if(_0x1cc529[_0x4ed5c9]['SessionId']==_0x3a0ac9[_0x18233d]['id']&&_0x12ee30[_0x483d('0x36')](_0x1cc529[_0x4ed5c9][_0x483d('0x66')])){_0x369e4b[_0x12ee30[_0x1cc529[_0x4ed5c9][_0x483d('0x66')]]]=_0x1cc529[_0x4ed5c9]['answer'];}}for(var _0x1e9ce3 in _0x12ee30){if(!_0x369e4b['hasOwnProperty'](_0x12ee30[_0x1e9ce3])){_0x369e4b[_0x12ee30[_0x1e9ce3]]=null;}}_0x468b7d[_0x483d('0x6a')](_0x369e4b);}return _0x468b7d;}})[_0x483d('0x23')](function(_0x536130){if(!_[_0x483d('0x6b')](_0x536130)){var _0x180eae=toCsv(_0x536130);var _0x49a36b=Date['now']();fs[_0x483d('0x6c')](util[_0x483d('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x401f1f[_0x483d('0x4e')]['id'],_0x49a36b),_0x180eae);_0x26bf39[_0x483d('0x6e')](_0x483d('0x6f'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x401f1f[_0x483d('0x4e')]['id'],_0x49a36b));_0x26bf39[_0x483d('0x6e')]('Content-type',_0x483d('0x70'));return _0x26bf39[_0x483d('0x71')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x401f1f[_0x483d('0x4e')]['id'],_0x49a36b));}else{return _0x26bf39[_0x483d('0x15')](0xcc);}})[_0x483d('0x44')](handleError(_0x26bf39,null));}; \ No newline at end of file +var _0x1458=['format','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','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','Projects','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','options','includeAll','include','findAll','catch','params','keys','JscriptyProject','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','user','userProfileId','getSessions','findOne','JscriptySessionReport','hasOwnProperty','nolimit','ProjectId','rows','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question'];(function(_0x502780,_0x13aad4){var _0x5b386a=function(_0x39a509){while(--_0x39a509){_0x502780['push'](_0x502780['shift']());}};_0x5b386a(++_0x13aad4);}(_0x1458,0x16c));var _0x8145=function(_0x1ae6a8,_0x488651){_0x1ae6a8=_0x1ae6a8-0x0;var _0x27699d=_0x1458[_0x1ae6a8];return _0x27699d;};'use strict';var emlformat=require(_0x8145('0x0'));var rimraf=require(_0x8145('0x1'));var zipdir=require(_0x8145('0x2'));var jsonpatch=require(_0x8145('0x3'));var rp=require(_0x8145('0x4'));var moment=require(_0x8145('0x5'));var BPromise=require(_0x8145('0x6'));var Mustache=require('mustache');var util=require(_0x8145('0x7'));var path=require(_0x8145('0x8'));var sox=require(_0x8145('0x9'));var csv=require(_0x8145('0xa'));var ejs=require(_0x8145('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8145('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8145('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8145('0xe'));var Papa=require(_0x8145('0xf'));var Redis=require('ioredis');var authService=require(_0x8145('0x10'));var qs=require(_0x8145('0x11'));var as=require(_0x8145('0x12'));var hardwareService=require(_0x8145('0x13'));var logger=require(_0x8145('0x14'))('api');var utils=require(_0x8145('0x15'));var config=require(_0x8145('0x16'));var licenseUtil=require(_0x8145('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bf4ae,_0x1ddbb1){_0x1ddbb1=_0x1ddbb1||0xcc;return function(_0x469c38){if(_0x469c38){return _0x4bf4ae[_0x8145('0x18')](_0x1ddbb1);}return _0x4bf4ae[_0x8145('0x19')](_0x1ddbb1)[_0x8145('0x1a')]();};}function respondWithResult(_0x2c94d7,_0xecb43){_0xecb43=_0xecb43||0xc8;return function(_0x507b92){if(_0x507b92){return _0x2c94d7[_0x8145('0x19')](_0xecb43)[_0x8145('0x1b')](_0x507b92);}};}function respondWithFilteredResult(_0x1a0c47,_0x194c1d){return function(_0x492d49){if(_0x492d49){var _0x58cd6d=typeof _0x194c1d[_0x8145('0x1c')]===_0x8145('0x1d')&&typeof _0x194c1d[_0x8145('0x1e')]===_0x8145('0x1d');var _0x4a33d5=_0x492d49[_0x8145('0x1f')];var _0x39ef7f=_0x58cd6d?0x0:_0x194c1d['offset'];var _0x3ff911=_0x58cd6d?_0x492d49[_0x8145('0x1f')]:_0x194c1d[_0x8145('0x1c')]+_0x194c1d[_0x8145('0x1e')];var _0x42c69e;if(_0x3ff911>=_0x4a33d5){_0x3ff911=_0x4a33d5;_0x42c69e=0xc8;}else{_0x42c69e=0xce;}_0x1a0c47['status'](_0x42c69e);return _0x1a0c47[_0x8145('0x20')](_0x8145('0x21'),_0x39ef7f+'-'+_0x3ff911+'/'+_0x4a33d5)[_0x8145('0x1b')](_0x492d49);}return null;};}function patchUpdates(_0x11707e){return function(_0x6674dc){try{jsonpatch[_0x8145('0x22')](_0x6674dc,_0x11707e,!![]);}catch(_0x4f05f9){return BPromise[_0x8145('0x23')](_0x4f05f9);}return _0x6674dc[_0x8145('0x24')]();};}function saveUpdates(_0xed1224,_0x47bbcd){return function(_0x1f702a){if(_0x1f702a){return _0x1f702a['update'](_0xed1224)['then'](function(_0xe26f97){return _0xe26f97;});}return null;};}function removeEntity(_0x2f140c,_0x325bf4){return function(_0x4d2e26){if(_0x4d2e26){return _0x4d2e26[_0x8145('0x25')]()[_0x8145('0x26')](function(){var _0x287861=_0x4d2e26['get']({'plain':!![]});var _0x5e4ff9=_0x8145('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x5e4ff9,'resourceId':_0x287861['id']}})['then'](function(){return _0x4d2e26;});})['then'](function(){_0x2f140c[_0x8145('0x19')](0xcc)[_0x8145('0x1a')]();});}};}function handleEntityNotFound(_0x39f128,_0x1bbd6b){return function(_0x225e6c){if(!_0x225e6c){_0x39f128[_0x8145('0x18')](0x194);}return _0x225e6c;};}function handleError(_0x3ad770,_0x5c2d32){_0x5c2d32=_0x5c2d32||0x1f4;return function(_0x471533){logger['error'](_0x471533['stack']);if(_0x471533[_0x8145('0x28')]){delete _0x471533[_0x8145('0x28')];}_0x3ad770[_0x8145('0x19')](_0x5c2d32)[_0x8145('0x29')](_0x471533);};}exports[_0x8145('0x2a')]=function(_0x3f1417,_0x590973){var _0x14596f={},_0x42efc2={},_0x54fef9={'count':0x0,'rows':[]};var _0x549dd1=_['map'](db['JscriptyProject'][_0x8145('0x2b')],function(_0x1aeb62){return{'name':_0x1aeb62[_0x8145('0x2c')],'type':_0x1aeb62[_0x8145('0x2d')]['key']};});_0x42efc2[_0x8145('0x2e')]=_[_0x8145('0x2f')](_0x549dd1,_0x8145('0x28'));_0x42efc2[_0x8145('0x30')]=_['keys'](_0x3f1417[_0x8145('0x30')]);_0x42efc2[_0x8145('0x31')]=_[_0x8145('0x32')](_0x42efc2[_0x8145('0x2e')],_0x42efc2[_0x8145('0x30')]);_0x14596f[_0x8145('0x33')]=_[_0x8145('0x32')](_0x42efc2[_0x8145('0x2e')],qs[_0x8145('0x34')](_0x3f1417[_0x8145('0x30')][_0x8145('0x34')]));_0x14596f[_0x8145('0x33')]=_0x14596f[_0x8145('0x33')][_0x8145('0x35')]?_0x14596f[_0x8145('0x33')]:_0x42efc2[_0x8145('0x2e')];if(!_0x3f1417[_0x8145('0x30')]['hasOwnProperty']('nolimit')){_0x14596f[_0x8145('0x1e')]=qs[_0x8145('0x1e')](_0x3f1417[_0x8145('0x30')]['limit']);_0x14596f[_0x8145('0x1c')]=qs[_0x8145('0x1c')](_0x3f1417[_0x8145('0x30')][_0x8145('0x1c')]);}_0x14596f[_0x8145('0x36')]=qs[_0x8145('0x37')](_0x3f1417[_0x8145('0x30')][_0x8145('0x37')]);_0x14596f[_0x8145('0x38')]=qs[_0x8145('0x31')](_[_0x8145('0x39')](_0x3f1417[_0x8145('0x30')],_0x42efc2[_0x8145('0x31')]),_0x549dd1);if(_0x3f1417[_0x8145('0x30')][_0x8145('0x3a')]){_0x14596f[_0x8145('0x38')]=_['merge'](_0x14596f[_0x8145('0x38')],{'$or':_[_0x8145('0x2f')](_0x549dd1,function(_0x1fc41e){if(_0x1fc41e[_0x8145('0x2d')]!=='VIRTUAL'){var _0x4dea8e={};_0x4dea8e[_0x1fc41e['name']]={'$like':'%'+_0x3f1417['query'][_0x8145('0x3a')]+'%'};return _0x4dea8e;}})});}_0x14596f=_['merge']({},_0x14596f,_0x3f1417[_0x8145('0x3b')]);var _0x11161e={'where':_0x14596f[_0x8145('0x38')]};return db['JscriptyProject'][_0x8145('0x1f')](_0x11161e)['then'](function(_0x184d0f){_0x54fef9[_0x8145('0x1f')]=_0x184d0f;if(_0x3f1417[_0x8145('0x30')][_0x8145('0x3c')]){_0x14596f[_0x8145('0x3d')]=[{'all':!![]}];}return db['JscriptyProject'][_0x8145('0x3e')](_0x14596f);})[_0x8145('0x26')](function(_0x356cde){_0x54fef9['rows']=_0x356cde;return _0x54fef9;})[_0x8145('0x26')](respondWithFilteredResult(_0x590973,_0x14596f))[_0x8145('0x3f')](handleError(_0x590973,null));};exports['show']=function(_0x5eebc9,_0xb54446){var _0x15b0f6={'raw':![],'where':{'id':_0x5eebc9[_0x8145('0x40')]['id']}},_0x3d8ae5={};_0x3d8ae5[_0x8145('0x2e')]=_[_0x8145('0x41')](db[_0x8145('0x42')][_0x8145('0x2b')]);_0x3d8ae5['query']=_[_0x8145('0x41')](_0x5eebc9[_0x8145('0x30')]);_0x3d8ae5[_0x8145('0x31')]=_[_0x8145('0x32')](_0x3d8ae5[_0x8145('0x2e')],_0x3d8ae5[_0x8145('0x30')]);_0x15b0f6[_0x8145('0x33')]=_['intersection'](_0x3d8ae5[_0x8145('0x2e')],qs['fields'](_0x5eebc9[_0x8145('0x30')][_0x8145('0x34')]));_0x15b0f6[_0x8145('0x33')]=_0x15b0f6[_0x8145('0x33')][_0x8145('0x35')]?_0x15b0f6[_0x8145('0x33')]:_0x3d8ae5['model'];if(_0x5eebc9[_0x8145('0x30')]['includeAll']){_0x15b0f6[_0x8145('0x3d')]=[{'all':!![]}];}_0x15b0f6=_['merge']({},_0x15b0f6,_0x5eebc9[_0x8145('0x3b')]);return db[_0x8145('0x42')]['find'](_0x15b0f6)['then'](handleEntityNotFound(_0xb54446,null))['then'](respondWithResult(_0xb54446,null))[_0x8145('0x3f')](handleError(_0xb54446,null));};exports['create']=function(_0x3e3344,_0x15a3fb){return db[_0x8145('0x42')][_0x8145('0x43')](_0x3e3344[_0x8145('0x44')],{})[_0x8145('0x26')](function(_0x3549a1){var _0x21c96a=_0x3e3344['user'][_0x8145('0x45')]({'plain':!![]});if(!_0x21c96a)throw new Error(_0x8145('0x46'));if(_0x21c96a[_0x8145('0x47')]==='user'){var _0x4df759=_0x3549a1[_0x8145('0x45')]({'plain':!![]});var _0x4e2061=_0x8145('0x27');return db[_0x8145('0x48')][_0x8145('0x49')]({'where':{'name':_0x4e2061,'userProfileId':_0x21c96a['userProfileId']},'raw':!![]})[_0x8145('0x26')](function(_0x1405a8){if(_0x1405a8&&_0x1405a8[_0x8145('0x4a')]===0x0){return db[_0x8145('0x4b')][_0x8145('0x43')]({'name':_0x4df759[_0x8145('0x28')],'resourceId':_0x4df759['id'],'type':_0x1405a8['name'],'sectionId':_0x1405a8['id']},{})[_0x8145('0x26')](function(){return _0x3549a1;});}else{return _0x3549a1;}})[_0x8145('0x3f')](function(_0x5628f0){logger[_0x8145('0x4c')](_0x8145('0x4d'),_0x5628f0);throw _0x5628f0;});}return _0x3549a1;})['then'](respondWithResult(_0x15a3fb,0xc9))[_0x8145('0x3f')](handleError(_0x15a3fb,null));};exports[_0x8145('0x4e')]=function(_0x33a285,_0x277879){var _0x374d64={'where':{'id':_0x33a285[_0x8145('0x40')]['id']}},_0x1b660f={};_0x1b660f['model']=_[_0x8145('0x41')](db[_0x8145('0x42')]['rawAttributes']);_0x374d64['attributes']=_[_0x8145('0x32')](_0x1b660f['model'],qs['fields'](_0x33a285[_0x8145('0x30')][_0x8145('0x34')]));_0x374d64[_0x8145('0x33')]=_0x374d64[_0x8145('0x33')][_0x8145('0x35')]?_0x374d64[_0x8145('0x33')]:_0x1b660f['model'];if(_0x33a285[_0x8145('0x30')][_0x8145('0x3c')]){_0x374d64[_0x8145('0x3d')]=[{'all':!![]}];}_0x374d64=_[_0x8145('0x4f')]({},_0x374d64,_0x33a285['options']);return db[_0x8145('0x42')][_0x8145('0x49')](_0x374d64)[_0x8145('0x26')](handleEntityNotFound(_0x277879,null))[_0x8145('0x26')](function(_0x13e895){if(_0x13e895){var _0x284dcf=_0x13e895['get']({'plain':!![]});_0x284dcf=qs[_0x8145('0x50')](_0x284dcf,['id',_0x8145('0x51'),'updatedAt']);_0x33a285[_0x8145('0x44')]=_[_0x8145('0x50')](_0x33a285[_0x8145('0x44')],['id',_0x8145('0x51'),'updatedAt']);return db[_0x8145('0x42')][_0x8145('0x43')](_[_0x8145('0x4f')](_0x284dcf,_0x33a285[_0x8145('0x44')]),{'include':_0x33a285[_0x8145('0x30')][_0x8145('0x3c')]?[{'all':!![]}]:undefined})[_0x8145('0x26')](function(_0x267e1c){var _0xd10706=_0x33a285[_0x8145('0x52')]['get']({'plain':!![]});if(!_0xd10706)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd10706[_0x8145('0x47')]===_0x8145('0x52')){var _0x3ed98e=_0x267e1c[_0x8145('0x45')]({'plain':!![]});var _0x53086c=_0x8145('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x53086c,'userProfileId':_0xd10706[_0x8145('0x53')]},'raw':!![]})[_0x8145('0x26')](function(_0xded69e){if(_0xded69e&&_0xded69e[_0x8145('0x4a')]===0x0){return db[_0x8145('0x4b')][_0x8145('0x43')]({'name':_0x3ed98e[_0x8145('0x28')],'resourceId':_0x3ed98e['id'],'type':_0xded69e['name'],'sectionId':_0xded69e['id']},{})['then'](function(){return _0x267e1c;});}else{return _0x267e1c;}})[_0x8145('0x3f')](function(_0x41abfc){logger[_0x8145('0x4c')](_0x8145('0x4d'),_0x41abfc);throw _0x41abfc;});}return _0x267e1c;});}})[_0x8145('0x26')](respondWithResult(_0x277879,0xc9))[_0x8145('0x3f')](handleError(_0x277879,null));};exports['update']=function(_0x1054e7,_0x522bae){if(_0x1054e7[_0x8145('0x44')]['id']){delete _0x1054e7[_0x8145('0x44')]['id'];}return db[_0x8145('0x42')]['find']({'where':{'id':_0x1054e7[_0x8145('0x40')]['id']}})[_0x8145('0x26')](handleEntityNotFound(_0x522bae,null))['then'](saveUpdates(_0x1054e7[_0x8145('0x44')],null))[_0x8145('0x26')](respondWithResult(_0x522bae,null))[_0x8145('0x3f')](handleError(_0x522bae,null));};exports[_0x8145('0x25')]=function(_0x58544c,_0x5c335e){return db[_0x8145('0x42')][_0x8145('0x49')]({'where':{'id':_0x58544c[_0x8145('0x40')]['id']}})[_0x8145('0x26')](handleEntityNotFound(_0x5c335e,null))[_0x8145('0x26')](removeEntity(_0x5c335e,null))['catch'](handleError(_0x5c335e,null));};exports[_0x8145('0x54')]=function(_0x3c8658,_0xe60231,_0x5b701e){var _0x5330f0={'raw':!![],'where':{}};var _0x24b765={};var _0x4c6064={'count':0x0,'rows':[]};return db[_0x8145('0x42')][_0x8145('0x55')]({'where':{'id':_0x3c8658[_0x8145('0x40')]['id']}})['then'](handleEntityNotFound(_0xe60231,null))['then'](function(_0x476e20){if(_0x476e20){_0x24b765[_0x8145('0x2e')]=_['keys'](db[_0x8145('0x56')][_0x8145('0x2b')]);_0x24b765['query']=_[_0x8145('0x41')](_0x3c8658['query']);_0x24b765['filters']=_[_0x8145('0x32')](_0x24b765['model'],_0x24b765[_0x8145('0x30')]);_0x5330f0['attributes']=_['intersection'](_0x24b765[_0x8145('0x2e')],qs[_0x8145('0x34')](_0x3c8658[_0x8145('0x30')][_0x8145('0x34')]));_0x5330f0[_0x8145('0x33')]=_0x5330f0['attributes'][_0x8145('0x35')]?_0x5330f0['attributes']:_0x24b765['model'];if(!_0x3c8658[_0x8145('0x30')][_0x8145('0x57')](_0x8145('0x58'))){_0x5330f0[_0x8145('0x1e')]=qs[_0x8145('0x1e')](_0x3c8658['query']['limit']);_0x5330f0[_0x8145('0x1c')]=qs[_0x8145('0x1c')](_0x3c8658[_0x8145('0x30')][_0x8145('0x1c')]);}_0x5330f0['order']=qs[_0x8145('0x37')](_0x3c8658[_0x8145('0x30')][_0x8145('0x37')]);_0x5330f0[_0x8145('0x38')]=qs[_0x8145('0x31')](_['pick'](_0x3c8658[_0x8145('0x30')],_0x24b765['filters']));_0x5330f0[_0x8145('0x38')][_0x8145('0x59')]=_0x476e20['id'];if(_0x3c8658['query']['filter']){_0x5330f0['where']=_[_0x8145('0x4f')](_0x5330f0[_0x8145('0x38')],{'$or':_['map'](_0x5330f0[_0x8145('0x33')],function(_0x34f565){var _0x46f5e3={};_0x46f5e3[_0x34f565]={'$like':'%'+_0x3c8658[_0x8145('0x30')][_0x8145('0x3a')]+'%'};return _0x46f5e3;})});}_0x5330f0=_[_0x8145('0x4f')]({},_0x5330f0,_0x3c8658[_0x8145('0x3b')]);return db[_0x8145('0x56')][_0x8145('0x1f')]({'where':_0x5330f0['where']})['then'](function(_0x2e40e2){_0x4c6064['count']=_0x2e40e2;if(_0x3c8658[_0x8145('0x30')][_0x8145('0x3c')]){_0x5330f0[_0x8145('0x3d')]=[{'all':!![]}];}return db[_0x8145('0x56')][_0x8145('0x3e')](_0x5330f0);})[_0x8145('0x26')](function(_0x5f4f92){_0x4c6064[_0x8145('0x5a')]=_0x5f4f92;return _0x4c6064;});}})['then'](respondWithFilteredResult(_0xe60231,_0x5330f0))[_0x8145('0x3f')](handleError(_0xe60231,null));};exports['getAnswers']=function(_0x5bb316,_0x4415d2,_0x4b02ec){var _0xa19f7d={'raw':!![],'where':{}};var _0x15fc92={};var _0x44b10e={'count':0x0,'rows':[]};return db[_0x8145('0x42')]['findOne']({'where':{'id':_0x5bb316[_0x8145('0x40')]['id']}})[_0x8145('0x26')](handleEntityNotFound(_0x4415d2,null))[_0x8145('0x26')](function(_0x24367f){if(_0x24367f){_0x15fc92['model']=_[_0x8145('0x41')](db[_0x8145('0x5b')][_0x8145('0x2b')]);_0x15fc92[_0x8145('0x30')]=_[_0x8145('0x41')](_0x5bb316[_0x8145('0x30')]);_0x15fc92[_0x8145('0x31')]=_['intersection'](_0x15fc92[_0x8145('0x2e')],_0x15fc92[_0x8145('0x30')]);_0xa19f7d[_0x8145('0x33')]=_[_0x8145('0x32')](_0x15fc92['model'],qs['fields'](_0x5bb316[_0x8145('0x30')][_0x8145('0x34')]));_0xa19f7d[_0x8145('0x33')]=_0xa19f7d[_0x8145('0x33')][_0x8145('0x35')]?_0xa19f7d[_0x8145('0x33')]:_0x15fc92['model'];if(!_0x5bb316[_0x8145('0x30')][_0x8145('0x57')](_0x8145('0x58'))){_0xa19f7d['limit']=qs[_0x8145('0x1e')](_0x5bb316[_0x8145('0x30')][_0x8145('0x1e')]);_0xa19f7d[_0x8145('0x1c')]=qs[_0x8145('0x1c')](_0x5bb316[_0x8145('0x30')]['offset']);}_0xa19f7d['order']=qs[_0x8145('0x37')](_0x5bb316['query']['sort']);_0xa19f7d[_0x8145('0x38')]=qs[_0x8145('0x31')](_[_0x8145('0x39')](_0x5bb316[_0x8145('0x30')],_0x15fc92[_0x8145('0x31')]));_0xa19f7d[_0x8145('0x38')][_0x8145('0x59')]=_0x24367f['id'];if(_0x5bb316[_0x8145('0x30')]['filter']){_0xa19f7d[_0x8145('0x38')]=_[_0x8145('0x4f')](_0xa19f7d[_0x8145('0x38')],{'$or':_[_0x8145('0x2f')](_0xa19f7d[_0x8145('0x33')],function(_0x5ed4ae){var _0x34cf57={};_0x34cf57[_0x5ed4ae]={'$like':'%'+_0x5bb316[_0x8145('0x30')][_0x8145('0x3a')]+'%'};return _0x34cf57;})});}_0xa19f7d=_[_0x8145('0x4f')]({},_0xa19f7d,_0x5bb316[_0x8145('0x3b')]);return db[_0x8145('0x5b')][_0x8145('0x1f')]({'where':_0xa19f7d[_0x8145('0x38')]})[_0x8145('0x26')](function(_0x499c7e){_0x44b10e[_0x8145('0x1f')]=_0x499c7e;if(_0x5bb316['query'][_0x8145('0x3c')]){_0xa19f7d['include']=[{'all':!![]}];}return db[_0x8145('0x5b')][_0x8145('0x3e')](_0xa19f7d);})[_0x8145('0x26')](function(_0x3d153c){_0x44b10e['rows']=_0x3d153c;return _0x44b10e;});}})[_0x8145('0x26')](respondWithFilteredResult(_0x4415d2,_0xa19f7d))[_0x8145('0x3f')](handleError(_0x4415d2,null));};function char(_0x50672a){return _0x8145('0x5c')===typeof _0x50672a?String[_0x8145('0x5d')][_0x8145('0x22')](null,arguments):_0x50672a;}function needsEncapsulation(_0x5040e2){return!!_0x5040e2&&(_0x5040e2[_0x8145('0x5e')]()[_0x8145('0x5f')](char(0xd))>=0x0||_0x5040e2[_0x8145('0x5e')]()[_0x8145('0x5f')](char(0xa))>=0x0||_0x5040e2[_0x8145('0x5e')]()[_0x8145('0x5f')](char(0x2c))>=0x0||_0x5040e2[_0x8145('0x5e')]()[_0x8145('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x3c9f9e){var _0x224351=char(0x22),_0x7a364b='\x5c'+char(0x22),_0x2bd5c7=_0x3c9f9e[_0x8145('0x5e')]()[_0x8145('0x60')](new RegExp(_0x224351,'g'),_0x7a364b);return _0x224351+_0x2bd5c7+_0x224351;}exports[_0x8145('0x61')]=function(_0x1bdd62,_0x3ead68,_0x2fb36b){var _0x341c0b,_0x531128;var _0x5088b7={'where':{'ProjectId':_0x1bdd62['params']['id']}};if(_0x1bdd62[_0x8145('0x30')][_0x8145('0x62')]){_0x5088b7[_0x8145('0x38')][_0x8145('0x63')]=JSON[_0x8145('0x64')](_0x1bdd62['query'][_0x8145('0x62')]);}return db[_0x8145('0x56')]['findAll'](_0x5088b7)['then'](handleEntityNotFound(_0x3ead68,null))[_0x8145('0x26')](function(_0x508f86){if(_0x508f86){_0x341c0b=_0x508f86;return db[_0x8145('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0x8145('0x2f')](_0x341c0b,'id')},'ProjectId':_0x1bdd62[_0x8145('0x40')]['id']},'order':'-createdAt'});}})[_0x8145('0x26')](handleEntityNotFound(_0x3ead68,null))[_0x8145('0x26')](function(_0x45d2c0){if(_0x45d2c0){_0x531128=_0x45d2c0;var _0x3d4e96={};for(var _0x5dd7f1=0x0,_0x12b532=_0x531128[_0x8145('0x35')];_0x5dd7f1<_0x12b532;_0x5dd7f1++){if(!_0x3d4e96['hasOwnProperty'](_0x531128[_0x5dd7f1][_0x8145('0x66')])){_0x3d4e96[_0x531128[_0x5dd7f1][_0x8145('0x66')]]=needsEncapsulation(_0x531128[_0x5dd7f1][_0x8145('0x67')])?encapsulate(_0x531128[_0x5dd7f1][_0x8145('0x67')]):_0x531128[_0x5dd7f1]['question'];}}var _0x112151=[],_0x475def={};for(var _0x38cdce=0x0,_0x4209f1=_0x341c0b['length'];_0x38cdce<_0x4209f1;_0x38cdce++){_0x475def={'ProjectId':_0x1bdd62[_0x8145('0x40')]['id'],'SessionId':_0x341c0b[_0x38cdce]['id'],'StartTime':moment(_0x341c0b[_0x38cdce]['starttime'])[_0x8145('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x346190=0x0,_0x1b77b8=_0x531128[_0x8145('0x35')];_0x346190<_0x1b77b8;_0x346190++){if(_0x531128[_0x346190][_0x8145('0x69')]==_0x341c0b[_0x38cdce]['id']&&_0x3d4e96[_0x8145('0x57')](_0x531128[_0x346190]['questionId'])){_0x475def[_0x3d4e96[_0x531128[_0x346190]['questionId']]]=_0x531128[_0x346190]['answer'];}}for(var _0x66aa35 in _0x3d4e96){if(!_0x475def[_0x8145('0x57')](_0x3d4e96[_0x66aa35])){_0x475def[_0x3d4e96[_0x66aa35]]=null;}}_0x112151[_0x8145('0x6a')](_0x475def);}return _0x112151;}})[_0x8145('0x26')](function(_0x32a4c4){if(!_[_0x8145('0x6b')](_0x32a4c4)){var _0xb5106b=toCsv(_0x32a4c4);var _0x68d839=Date[_0x8145('0x6c')]();fs[_0x8145('0x6d')](util['format'](_0x8145('0x6e'),_0x1bdd62[_0x8145('0x40')]['id'],_0x68d839),_0xb5106b);_0x3ead68[_0x8145('0x6f')]('Content-disposition',_0x8145('0x70')+util[_0x8145('0x68')](_0x8145('0x71'),_0x1bdd62[_0x8145('0x40')]['id'],_0x68d839));_0x3ead68[_0x8145('0x6f')](_0x8145('0x72'),_0x8145('0x73'));return _0x3ead68[_0x8145('0x74')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1bdd62[_0x8145('0x40')]['id'],_0x68d839));}else{return _0x3ead68[_0x8145('0x18')](0xcc);}})[_0x8145('0x3f')](handleError(_0x3ead68,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b0f8f81..5836470 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 _0x6f7b=['moment','bluebird','request-promise','path','../../config/environment','exports','define','jscripty_projects','util','../../config/logger','api'];(function(_0x450076,_0x10983b){var _0x2029cc=function(_0x4a5e76){while(--_0x4a5e76){_0x450076['push'](_0x450076['shift']());}};_0x2029cc(++_0x10983b);}(_0x6f7b,0x168));var _0xb6f7=function(_0x591566,_0x238a44){_0x591566=_0x591566-0x0;var _0x12ba1e=_0x6f7b[_0x591566];return _0x12ba1e;};'use strict';var _=require('lodash');var util=require(_0xb6f7('0x0'));var logger=require(_0xb6f7('0x1'))(_0xb6f7('0x2'));var moment=require(_0xb6f7('0x3'));var BPromise=require(_0xb6f7('0x4'));var rp=require(_0xb6f7('0x5'));var fs=require('fs');var path=require(_0xb6f7('0x6'));var rimraf=require('rimraf');var config=require(_0xb6f7('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xb6f7('0x8')]=function(_0x25cec3,_0x59b2d9){return _0x25cec3[_0xb6f7('0x9')]('JscriptyProject',attributes,{'tableName':_0xb6f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d4d=['../../config/logger','api','moment','bluebird','path','../../config/environment','./jscriptyProject.attributes','define','jscripty_projects','lodash','util'];(function(_0x9d9f9e,_0x52a029){var _0x48cb13=function(_0x177d55){while(--_0x177d55){_0x9d9f9e['push'](_0x9d9f9e['shift']());}};_0x48cb13(++_0x52a029);}(_0x0d4d,0x132));var _0xd0d4=function(_0x45b32f,_0x134ccf){_0x45b32f=_0x45b32f-0x0;var _0x3f8daf=_0x0d4d[_0x45b32f];return _0x3f8daf;};'use strict';var _=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var logger=require(_0xd0d4('0x2'))(_0xd0d4('0x3'));var moment=require(_0xd0d4('0x4'));var BPromise=require(_0xd0d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0d4('0x6'));var rimraf=require('rimraf');var config=require(_0xd0d4('0x7'));var attributes=require(_0xd0d4('0x8'));module['exports']=function(_0x34d93b,_0x3db5ab){return _0x34d93b[_0xd0d4('0x9')]('JscriptyProject',attributes,{'tableName':_0xd0d4('0xa'),'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 215767b..4f75571 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xbdb7[_0x284bc3];return _0x41ac81;};'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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x3bb39b,_0x429fc0){var _0x3d903a=function(_0x1b042e){while(--_0x1b042e){_0x3bb39b['push'](_0x3bb39b['shift']());}};_0x3d903a(++_0x429fc0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d5560af..3ebaf17 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 _0xaedc=['Router','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','destroy','exports','path','connect-timeout','express'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xaedc,0x151));var _0xcaed=function(_0x4b34c4,_0xc61ba4){_0x4b34c4=_0x4b34c4-0x0;var _0x418e46=_0xaedc[_0x4b34c4];return _0x418e46;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcaed('0x0'));var timeout=require(_0xcaed('0x1'));var express=require(_0xcaed('0x2'));var router=express[_0xcaed('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcaed('0x4'));var config=require('../../config/environment');var controller=require(_0xcaed('0x5'));router[_0xcaed('0x6')]('/',auth[_0xcaed('0x7')](),controller['index']);router[_0xcaed('0x6')](_0xcaed('0x8'),auth['isAuthenticated'](),controller[_0xcaed('0x9')]);router[_0xcaed('0x6')](_0xcaed('0xa'),auth[_0xcaed('0x7')](),controller[_0xcaed('0xb')]);router[_0xcaed('0xc')]('/',auth[_0xcaed('0x7')](),controller[_0xcaed('0xd')]);router['put']('/:id',auth[_0xcaed('0x7')](),controller[_0xcaed('0xe')]);router['delete']('/:id',auth[_0xcaed('0x7')](),controller[_0xcaed('0xf')]);module[_0xcaed('0x10')]=router; \ No newline at end of file +var _0xaa36=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x5680d9,_0x35e00a){var _0x35fcf4=function(_0x513f4d){while(--_0x513f4d){_0x5680d9['push'](_0x5680d9['shift']());}};_0x35fcf4(++_0x35e00a);}(_0xaa36,0xc1));var _0x6aa3=function(_0x220bf4,_0x53d51a){_0x220bf4=_0x220bf4-0x0;var _0x326c0a=_0xaa36[_0x220bf4];return _0x326c0a;};'use strict';var multer=require('multer');var util=require(_0x6aa3('0x0'));var path=require(_0x6aa3('0x1'));var timeout=require(_0x6aa3('0x2'));var express=require(_0x6aa3('0x3'));var router=express[_0x6aa3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6aa3('0x5'));var interaction=require(_0x6aa3('0x6'));var config=require(_0x6aa3('0x7'));var controller=require(_0x6aa3('0x8'));router['get']('/',auth[_0x6aa3('0x9')](),controller[_0x6aa3('0xa')]);router['get']('/describe',auth[_0x6aa3('0x9')](),controller[_0x6aa3('0xb')]);router[_0x6aa3('0xc')](_0x6aa3('0xd'),auth[_0x6aa3('0x9')](),controller[_0x6aa3('0xe')]);router[_0x6aa3('0xf')]('/',auth[_0x6aa3('0x9')](),controller[_0x6aa3('0x10')]);router[_0x6aa3('0x11')](_0x6aa3('0xd'),auth['isAuthenticated'](),controller[_0x6aa3('0x12')]);router[_0x6aa3('0x13')](_0x6aa3('0xd'),auth[_0x6aa3('0x9')](),controller[_0x6aa3('0x14')]);module[_0x6aa3('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a7465f5..6dd0f76 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x5ed478,_0x24b041){_0x5ed478=_0x5ed478-0x0;var _0xd59981=_0x7a54[_0x5ed478];return _0xd59981;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x19a1d3,_0x566f9f){_0x19a1d3=_0x19a1d3-0x0;var _0x48a6bf=_0x7a54[_0x19a1d3];return _0x48a6bf;};'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 132f6ef..3f746bf 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 _0xf82d=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','JscriptyQuestionReport','includeAll','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x3ca1fe,_0x3c3952){var _0x1694d8=function(_0x30a09c){while(--_0x30a09c){_0x3ca1fe['push'](_0x3ca1fe['shift']());}};_0x1694d8(++_0x3c3952);}(_0xf82d,0x18e));var _0xdf82=function(_0x33dfc6,_0x337005){_0x33dfc6=_0x33dfc6-0x0;var _0x5aa21a=_0xf82d[_0x33dfc6];return _0x5aa21a;};'use strict';var emlformat=require(_0xdf82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdf82('0x2'));var BPromise=require(_0xdf82('0x3'));var Mustache=require(_0xdf82('0x4'));var util=require(_0xdf82('0x5'));var path=require(_0xdf82('0x6'));var sox=require(_0xdf82('0x7'));var csv=require(_0xdf82('0x8'));var ejs=require(_0xdf82('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdf82('0xa'));var crypto=require(_0xdf82('0xb'));var jsforce=require(_0xdf82('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf82('0x8'));var querystring=require(_0xdf82('0xd'));var Papa=require('papaparse');var Redis=require(_0xdf82('0xe'));var authService=require(_0xdf82('0xf'));var qs=require(_0xdf82('0x10'));var as=require(_0xdf82('0x11'));var hardwareService=require(_0xdf82('0x12'));var logger=require(_0xdf82('0x13'))('api');var utils=require(_0xdf82('0x14'));var config=require(_0xdf82('0x15'));var licenseUtil=require(_0xdf82('0x16'));var db=require(_0xdf82('0x17'))['db'];function respondWithStatusCode(_0x23e1f2,_0x343c40){_0x343c40=_0x343c40||0xcc;return function(_0x659048){if(_0x659048){return _0x23e1f2['sendStatus'](_0x343c40);}return _0x23e1f2[_0xdf82('0x18')](_0x343c40)[_0xdf82('0x19')]();};}function respondWithResult(_0x45aeaa,_0x4787c0){_0x4787c0=_0x4787c0||0xc8;return function(_0x3ee2dc){if(_0x3ee2dc){return _0x45aeaa[_0xdf82('0x18')](_0x4787c0)[_0xdf82('0x1a')](_0x3ee2dc);}};}function respondWithFilteredResult(_0x5dca79,_0xc7201e){return function(_0x30b231){if(_0x30b231){var _0x486a67=typeof _0xc7201e[_0xdf82('0x1b')]===_0xdf82('0x1c')&&typeof _0xc7201e[_0xdf82('0x1d')]==='undefined';var _0x50599d=_0x30b231[_0xdf82('0x1e')];var _0x44df5a=_0x486a67?0x0:_0xc7201e[_0xdf82('0x1b')];var _0x5c848c=_0x486a67?_0x30b231[_0xdf82('0x1e')]:_0xc7201e[_0xdf82('0x1b')]+_0xc7201e[_0xdf82('0x1d')];var _0x3c00d1;if(_0x5c848c>=_0x50599d){_0x5c848c=_0x50599d;_0x3c00d1=0xc8;}else{_0x3c00d1=0xce;}_0x5dca79[_0xdf82('0x18')](_0x3c00d1);return _0x5dca79[_0xdf82('0x1f')](_0xdf82('0x20'),_0x44df5a+'-'+_0x5c848c+'/'+_0x50599d)[_0xdf82('0x1a')](_0x30b231);}return null;};}function patchUpdates(_0x3e3de3){return function(_0x3e04d9){try{jsonpatch[_0xdf82('0x21')](_0x3e04d9,_0x3e3de3,!![]);}catch(_0x23f3da){return BPromise['reject'](_0x23f3da);}return _0x3e04d9['save']();};}function saveUpdates(_0xae6ca5,_0x30bfcf){return function(_0x285a13){if(_0x285a13){return _0x285a13[_0xdf82('0x22')](_0xae6ca5)[_0xdf82('0x23')](function(_0x52e3f2){return _0x52e3f2;});}return null;};}function removeEntity(_0x1904fe,_0x2dfb8e){return function(_0x52cfb5){if(_0x52cfb5){return _0x52cfb5['destroy']()[_0xdf82('0x23')](function(){_0x1904fe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f576f,_0x1d594e){return function(_0x16271b){if(!_0x16271b){_0x5f576f[_0xdf82('0x24')](0x194);}return _0x16271b;};}function handleError(_0x9e195c,_0x5ea893){_0x5ea893=_0x5ea893||0x1f4;return function(_0x1e0eb6){logger[_0xdf82('0x25')](_0x1e0eb6[_0xdf82('0x26')]);if(_0x1e0eb6['name']){delete _0x1e0eb6[_0xdf82('0x27')];}_0x9e195c[_0xdf82('0x18')](_0x5ea893)[_0xdf82('0x28')](_0x1e0eb6);};}exports[_0xdf82('0x29')]=function(_0x6406be,_0x6c52a0){var _0xab4673={},_0x57851e={},_0x1bd04f={'count':0x0,'rows':[]};var _0x68ac40=_[_0xdf82('0x2a')](db['JscriptyQuestionReport'][_0xdf82('0x2b')],function(_0x244d69){return{'name':_0x244d69[_0xdf82('0x2c')],'type':_0x244d69[_0xdf82('0x2d')][_0xdf82('0x2e')]};});_0x57851e['model']=_[_0xdf82('0x2a')](_0x68ac40,_0xdf82('0x27'));_0x57851e[_0xdf82('0x2f')]=_[_0xdf82('0x30')](_0x6406be[_0xdf82('0x2f')]);_0x57851e[_0xdf82('0x31')]=_[_0xdf82('0x32')](_0x57851e[_0xdf82('0x33')],_0x57851e[_0xdf82('0x2f')]);_0xab4673[_0xdf82('0x34')]=_['intersection'](_0x57851e[_0xdf82('0x33')],qs[_0xdf82('0x35')](_0x6406be[_0xdf82('0x2f')][_0xdf82('0x35')]));_0xab4673[_0xdf82('0x34')]=_0xab4673[_0xdf82('0x34')][_0xdf82('0x36')]?_0xab4673[_0xdf82('0x34')]:_0x57851e[_0xdf82('0x33')];if(!_0x6406be[_0xdf82('0x2f')][_0xdf82('0x37')](_0xdf82('0x38'))){_0xab4673[_0xdf82('0x1d')]=qs['limit'](_0x6406be[_0xdf82('0x2f')][_0xdf82('0x1d')]);_0xab4673['offset']=qs[_0xdf82('0x1b')](_0x6406be[_0xdf82('0x2f')][_0xdf82('0x1b')]);}_0xab4673[_0xdf82('0x39')]=qs[_0xdf82('0x3a')](_0x6406be['query'][_0xdf82('0x3a')]);_0xab4673['where']=qs[_0xdf82('0x31')](_['pick'](_0x6406be[_0xdf82('0x2f')],_0x57851e['filters']),_0x68ac40);if(_0x6406be[_0xdf82('0x2f')]['filter']){_0xab4673[_0xdf82('0x3b')]=_[_0xdf82('0x3c')](_0xab4673[_0xdf82('0x3b')],{'$or':_[_0xdf82('0x2a')](_0x68ac40,function(_0x5719ae){if(_0x5719ae[_0xdf82('0x2d')]!==_0xdf82('0x3d')){var _0x5131fe={};_0x5131fe[_0x5719ae['name']]={'$like':'%'+_0x6406be[_0xdf82('0x2f')][_0xdf82('0x3e')]+'%'};return _0x5131fe;}})});}_0xab4673=_['merge']({},_0xab4673,_0x6406be[_0xdf82('0x3f')]);var _0x5ce12a={'where':_0xab4673[_0xdf82('0x3b')]};return db[_0xdf82('0x40')][_0xdf82('0x1e')](_0x5ce12a)[_0xdf82('0x23')](function(_0x11b44c){_0x1bd04f[_0xdf82('0x1e')]=_0x11b44c;if(_0x6406be[_0xdf82('0x2f')][_0xdf82('0x41')]){_0xab4673['include']=[{'all':!![]}];}return db[_0xdf82('0x40')][_0xdf82('0x42')](_0xab4673);})[_0xdf82('0x23')](function(_0x45d7da){_0x1bd04f[_0xdf82('0x43')]=_0x45d7da;return _0x1bd04f;})[_0xdf82('0x23')](respondWithFilteredResult(_0x6c52a0,_0xab4673))[_0xdf82('0x44')](handleError(_0x6c52a0,null));};exports[_0xdf82('0x45')]=function(_0x375c99,_0x355d2f){var _0x1b8e9c={'raw':!![],'where':{'id':_0x375c99['params']['id']}},_0x7767d5={};_0x7767d5[_0xdf82('0x33')]=_[_0xdf82('0x30')](db['JscriptyQuestionReport']['rawAttributes']);_0x7767d5[_0xdf82('0x2f')]=_[_0xdf82('0x30')](_0x375c99['query']);_0x7767d5['filters']=_['intersection'](_0x7767d5[_0xdf82('0x33')],_0x7767d5[_0xdf82('0x2f')]);_0x1b8e9c[_0xdf82('0x34')]=_['intersection'](_0x7767d5[_0xdf82('0x33')],qs[_0xdf82('0x35')](_0x375c99[_0xdf82('0x2f')][_0xdf82('0x35')]));_0x1b8e9c[_0xdf82('0x34')]=_0x1b8e9c[_0xdf82('0x34')][_0xdf82('0x36')]?_0x1b8e9c[_0xdf82('0x34')]:_0x7767d5['model'];if(_0x375c99[_0xdf82('0x2f')][_0xdf82('0x41')]){_0x1b8e9c['include']=[{'all':!![]}];}_0x1b8e9c=_[_0xdf82('0x3c')]({},_0x1b8e9c,_0x375c99[_0xdf82('0x3f')]);return db[_0xdf82('0x40')][_0xdf82('0x46')](_0x1b8e9c)[_0xdf82('0x23')](handleEntityNotFound(_0x355d2f,null))[_0xdf82('0x23')](respondWithResult(_0x355d2f,null))[_0xdf82('0x44')](handleError(_0x355d2f,null));};exports[_0xdf82('0x47')]=function(_0x478c2b,_0x6fac79){return db[_0xdf82('0x40')][_0xdf82('0x47')](_0x478c2b['body'],{})[_0xdf82('0x23')](respondWithResult(_0x6fac79,0xc9))[_0xdf82('0x44')](handleError(_0x6fac79,null));};exports[_0xdf82('0x22')]=function(_0x4c41fb,_0x1f4541){if(_0x4c41fb[_0xdf82('0x48')]['id']){delete _0x4c41fb[_0xdf82('0x48')]['id'];}return db[_0xdf82('0x40')]['find']({'where':{'id':_0x4c41fb[_0xdf82('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f4541,null))[_0xdf82('0x23')](saveUpdates(_0x4c41fb[_0xdf82('0x48')],null))[_0xdf82('0x23')](respondWithResult(_0x1f4541,null))[_0xdf82('0x44')](handleError(_0x1f4541,null));};exports['destroy']=function(_0x28c6f1,_0x36bf4c){return db[_0xdf82('0x40')]['find']({'where':{'id':_0x28c6f1['params']['id']}})[_0xdf82('0x23')](handleEntityNotFound(_0x36bf4c,null))[_0xdf82('0x23')](removeEntity(_0x36bf4c,null))[_0xdf82('0x44')](handleError(_0x36bf4c,null));};exports[_0xdf82('0x4a')]=function(_0x23472c,_0xf6ce9){return db[_0xdf82('0x40')][_0xdf82('0x4a')]()[_0xdf82('0x23')](respondWithResult(_0xf6ce9,null))[_0xdf82('0x44')](handleError(_0xf6ce9,null));}; \ No newline at end of file +var _0x8b6a=['find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','JscriptyQuestionReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes'];(function(_0x6a0d5d,_0x23c40e){var _0x18d995=function(_0x53fd07){while(--_0x53fd07){_0x6a0d5d['push'](_0x6a0d5d['shift']());}};_0x18d995(++_0x23c40e);}(_0x8b6a,0xde));var _0xa8b6=function(_0x4ac183,_0x5c355b){_0x4ac183=_0x4ac183-0x0;var _0x33dfc6=_0x8b6a[_0x4ac183];return _0x33dfc6;};'use strict';var emlformat=require(_0xa8b6('0x0'));var rimraf=require(_0xa8b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8b6('0x2'));var rp=require(_0xa8b6('0x3'));var moment=require(_0xa8b6('0x4'));var BPromise=require(_0xa8b6('0x5'));var Mustache=require(_0xa8b6('0x6'));var util=require(_0xa8b6('0x7'));var path=require(_0xa8b6('0x8'));var sox=require(_0xa8b6('0x9'));var csv=require(_0xa8b6('0xa'));var ejs=require(_0xa8b6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa8b6('0xc'));var crypto=require(_0xa8b6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa8b6('0xe'));var Redis=require(_0xa8b6('0xf'));var authService=require(_0xa8b6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8b6('0x11'));var hardwareService=require(_0xa8b6('0x12'));var logger=require(_0xa8b6('0x13'))('api');var utils=require(_0xa8b6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa8b6('0x15'));var db=require(_0xa8b6('0x16'))['db'];function respondWithStatusCode(_0x29e38e,_0xa6dfa7){_0xa6dfa7=_0xa6dfa7||0xcc;return function(_0x1ef486){if(_0x1ef486){return _0x29e38e[_0xa8b6('0x17')](_0xa6dfa7);}return _0x29e38e[_0xa8b6('0x18')](_0xa6dfa7)[_0xa8b6('0x19')]();};}function respondWithResult(_0x88d5e2,_0xdae389){_0xdae389=_0xdae389||0xc8;return function(_0x3f3035){if(_0x3f3035){return _0x88d5e2[_0xa8b6('0x18')](_0xdae389)[_0xa8b6('0x1a')](_0x3f3035);}};}function respondWithFilteredResult(_0x39c44b,_0x10c1d5){return function(_0x4e3c30){if(_0x4e3c30){var _0xf09b9f=typeof _0x10c1d5[_0xa8b6('0x1b')]==='undefined'&&typeof _0x10c1d5[_0xa8b6('0x1c')]===_0xa8b6('0x1d');var _0x357ecc=_0x4e3c30[_0xa8b6('0x1e')];var _0x428087=_0xf09b9f?0x0:_0x10c1d5[_0xa8b6('0x1b')];var _0x5b903c=_0xf09b9f?_0x4e3c30[_0xa8b6('0x1e')]:_0x10c1d5[_0xa8b6('0x1b')]+_0x10c1d5[_0xa8b6('0x1c')];var _0xf40d5e;if(_0x5b903c>=_0x357ecc){_0x5b903c=_0x357ecc;_0xf40d5e=0xc8;}else{_0xf40d5e=0xce;}_0x39c44b[_0xa8b6('0x18')](_0xf40d5e);return _0x39c44b[_0xa8b6('0x1f')](_0xa8b6('0x20'),_0x428087+'-'+_0x5b903c+'/'+_0x357ecc)[_0xa8b6('0x1a')](_0x4e3c30);}return null;};}function patchUpdates(_0x43a557){return function(_0x11b804){try{jsonpatch[_0xa8b6('0x21')](_0x11b804,_0x43a557,!![]);}catch(_0x31642c){return BPromise[_0xa8b6('0x22')](_0x31642c);}return _0x11b804['save']();};}function saveUpdates(_0x587e6a,_0x76c3fc){return function(_0x423dcd){if(_0x423dcd){return _0x423dcd['update'](_0x587e6a)[_0xa8b6('0x23')](function(_0x412f99){return _0x412f99;});}return null;};}function removeEntity(_0x12a0bf,_0x3e53a8){return function(_0x5100e7){if(_0x5100e7){return _0x5100e7[_0xa8b6('0x24')]()[_0xa8b6('0x23')](function(){_0x12a0bf[_0xa8b6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62ff45,_0x1a96a5){return function(_0x1f0831){if(!_0x1f0831){_0x62ff45[_0xa8b6('0x17')](0x194);}return _0x1f0831;};}function handleError(_0x5e0763,_0x54f90f){_0x54f90f=_0x54f90f||0x1f4;return function(_0x3b57e1){logger[_0xa8b6('0x25')](_0x3b57e1['stack']);if(_0x3b57e1[_0xa8b6('0x26')]){delete _0x3b57e1['name'];}_0x5e0763[_0xa8b6('0x18')](_0x54f90f)[_0xa8b6('0x27')](_0x3b57e1);};}exports['index']=function(_0x1af1e7,_0x1f8bb8){var _0xcee03c={},_0xdcb324={},_0x2117c0={'count':0x0,'rows':[]};var _0x3c7904=_[_0xa8b6('0x28')](db[_0xa8b6('0x29')]['rawAttributes'],function(_0x5878cc){return{'name':_0x5878cc[_0xa8b6('0x2a')],'type':_0x5878cc[_0xa8b6('0x2b')]['key']};});_0xdcb324[_0xa8b6('0x2c')]=_['map'](_0x3c7904,_0xa8b6('0x26'));_0xdcb324[_0xa8b6('0x2d')]=_[_0xa8b6('0x2e')](_0x1af1e7[_0xa8b6('0x2d')]);_0xdcb324[_0xa8b6('0x2f')]=_[_0xa8b6('0x30')](_0xdcb324['model'],_0xdcb324['query']);_0xcee03c[_0xa8b6('0x31')]=_['intersection'](_0xdcb324[_0xa8b6('0x2c')],qs[_0xa8b6('0x32')](_0x1af1e7[_0xa8b6('0x2d')][_0xa8b6('0x32')]));_0xcee03c['attributes']=_0xcee03c[_0xa8b6('0x31')][_0xa8b6('0x33')]?_0xcee03c[_0xa8b6('0x31')]:_0xdcb324[_0xa8b6('0x2c')];if(!_0x1af1e7[_0xa8b6('0x2d')][_0xa8b6('0x34')](_0xa8b6('0x35'))){_0xcee03c[_0xa8b6('0x1c')]=qs['limit'](_0x1af1e7[_0xa8b6('0x2d')]['limit']);_0xcee03c['offset']=qs[_0xa8b6('0x1b')](_0x1af1e7['query']['offset']);}_0xcee03c['order']=qs[_0xa8b6('0x36')](_0x1af1e7[_0xa8b6('0x2d')][_0xa8b6('0x36')]);_0xcee03c['where']=qs[_0xa8b6('0x2f')](_[_0xa8b6('0x37')](_0x1af1e7[_0xa8b6('0x2d')],_0xdcb324['filters']),_0x3c7904);if(_0x1af1e7[_0xa8b6('0x2d')][_0xa8b6('0x38')]){_0xcee03c[_0xa8b6('0x39')]=_[_0xa8b6('0x3a')](_0xcee03c['where'],{'$or':_[_0xa8b6('0x28')](_0x3c7904,function(_0x52b5ef){if(_0x52b5ef[_0xa8b6('0x2b')]!==_0xa8b6('0x3b')){var _0x444486={};_0x444486[_0x52b5ef[_0xa8b6('0x26')]]={'$like':'%'+_0x1af1e7[_0xa8b6('0x2d')]['filter']+'%'};return _0x444486;}})});}_0xcee03c=_['merge']({},_0xcee03c,_0x1af1e7[_0xa8b6('0x3c')]);var _0x14fca8={'where':_0xcee03c[_0xa8b6('0x39')]};return db[_0xa8b6('0x29')][_0xa8b6('0x1e')](_0x14fca8)[_0xa8b6('0x23')](function(_0x2ebe1d){_0x2117c0[_0xa8b6('0x1e')]=_0x2ebe1d;if(_0x1af1e7['query']['includeAll']){_0xcee03c['include']=[{'all':!![]}];}return db[_0xa8b6('0x29')][_0xa8b6('0x3d')](_0xcee03c);})[_0xa8b6('0x23')](function(_0x2b8bfd){_0x2117c0[_0xa8b6('0x3e')]=_0x2b8bfd;return _0x2117c0;})['then'](respondWithFilteredResult(_0x1f8bb8,_0xcee03c))['catch'](handleError(_0x1f8bb8,null));};exports[_0xa8b6('0x3f')]=function(_0x5ceb65,_0x445fb6){var _0x815d09={'raw':!![],'where':{'id':_0x5ceb65[_0xa8b6('0x40')]['id']}},_0x43b58c={};_0x43b58c['model']=_['keys'](db[_0xa8b6('0x29')][_0xa8b6('0x41')]);_0x43b58c[_0xa8b6('0x2d')]=_[_0xa8b6('0x2e')](_0x5ceb65[_0xa8b6('0x2d')]);_0x43b58c['filters']=_[_0xa8b6('0x30')](_0x43b58c[_0xa8b6('0x2c')],_0x43b58c[_0xa8b6('0x2d')]);_0x815d09[_0xa8b6('0x31')]=_[_0xa8b6('0x30')](_0x43b58c[_0xa8b6('0x2c')],qs[_0xa8b6('0x32')](_0x5ceb65[_0xa8b6('0x2d')][_0xa8b6('0x32')]));_0x815d09['attributes']=_0x815d09[_0xa8b6('0x31')][_0xa8b6('0x33')]?_0x815d09[_0xa8b6('0x31')]:_0x43b58c[_0xa8b6('0x2c')];if(_0x5ceb65[_0xa8b6('0x2d')]['includeAll']){_0x815d09['include']=[{'all':!![]}];}_0x815d09=_['merge']({},_0x815d09,_0x5ceb65[_0xa8b6('0x3c')]);return db['JscriptyQuestionReport'][_0xa8b6('0x42')](_0x815d09)[_0xa8b6('0x23')](handleEntityNotFound(_0x445fb6,null))[_0xa8b6('0x23')](respondWithResult(_0x445fb6,null))[_0xa8b6('0x43')](handleError(_0x445fb6,null));};exports[_0xa8b6('0x44')]=function(_0x550ae7,_0x4234d4){return db[_0xa8b6('0x29')][_0xa8b6('0x44')](_0x550ae7[_0xa8b6('0x45')],{})['then'](respondWithResult(_0x4234d4,0xc9))[_0xa8b6('0x43')](handleError(_0x4234d4,null));};exports[_0xa8b6('0x46')]=function(_0x5b7eed,_0x3c87b6){if(_0x5b7eed['body']['id']){delete _0x5b7eed[_0xa8b6('0x45')]['id'];}return db[_0xa8b6('0x29')][_0xa8b6('0x42')]({'where':{'id':_0x5b7eed[_0xa8b6('0x40')]['id']}})[_0xa8b6('0x23')](handleEntityNotFound(_0x3c87b6,null))[_0xa8b6('0x23')](saveUpdates(_0x5b7eed['body'],null))['then'](respondWithResult(_0x3c87b6,null))['catch'](handleError(_0x3c87b6,null));};exports[_0xa8b6('0x24')]=function(_0x28c266,_0x553070){return db[_0xa8b6('0x29')]['find']({'where':{'id':_0x28c266[_0xa8b6('0x40')]['id']}})['then'](handleEntityNotFound(_0x553070,null))[_0xa8b6('0x23')](removeEntity(_0x553070,null))['catch'](handleError(_0x553070,null));};exports[_0xa8b6('0x47')]=function(_0x2a7e1b,_0x3945eb){return db[_0xa8b6('0x29')][_0xa8b6('0x47')]()[_0xa8b6('0x23')](respondWithResult(_0x3945eb,null))['catch'](handleError(_0x3945eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b7e5cc3..a486e38 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 _0x9266=['request-promise','path','rimraf','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','../../config/logger','bluebird'];(function(_0x559921,_0x48ad89){var _0xf01d47=function(_0x532f60){while(--_0x532f60){_0x559921['push'](_0x559921['shift']());}};_0xf01d47(++_0x48ad89);}(_0x9266,0x1ed));var _0x6926=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x9266[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6926('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6926('0x1'));var rp=require(_0x6926('0x2'));var fs=require('fs');var path=require(_0x6926('0x3'));var rimraf=require(_0x6926('0x4'));var config=require(_0x6926('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x3432a6,_0x2b51cb){return _0x3432a6[_0x6926('0x6')](_0x6926('0x7'),attributes,{'tableName':_0x6926('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38d1=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x38d1,0x12d));var _0x138d=function(_0x5bf901,_0x5b4364){_0x5bf901=_0x5bf901-0x0;var _0x3ae6e2=_0x38d1[_0x5bf901];return _0x3ae6e2;};'use strict';var _=require(_0x138d('0x0'));var util=require(_0x138d('0x1'));var logger=require('../../config/logger')(_0x138d('0x2'));var moment=require(_0x138d('0x3'));var BPromise=require(_0x138d('0x4'));var rp=require(_0x138d('0x5'));var fs=require('fs');var path=require(_0x138d('0x6'));var rimraf=require(_0x138d('0x7'));var config=require(_0x138d('0x8'));var attributes=require(_0x138d('0x9'));module[_0x138d('0xa')]=function(_0x1edece,_0x1ac040){return _0x1edece[_0x138d('0xb')](_0x138d('0xc'),attributes,{'tableName':_0x138d('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 27007a5..5ec9013 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 _0x992b=['jayson/promise','client','http','request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x15d8f5,_0x2bbdd2){var _0x38734d=function(_0x2f2404){while(--_0x2f2404){_0x15d8f5['push'](_0x15d8f5['shift']());}};_0x38734d(++_0x2bbdd2);}(_0x992b,0x117));var _0xb992=function(_0x5dc556,_0x5c2c10){_0x5dc556=_0x5dc556-0x0;var _0x1ae9d6=_0x992b[_0x5dc556];return _0x1ae9d6;};'use strict';var _=require(_0xb992('0x0'));var util=require('util');var moment=require(_0xb992('0x1'));var BPromise=require(_0xb992('0x2'));var rs=require(_0xb992('0x3'));var fs=require('fs');var Redis=require(_0xb992('0x4'));var db=require(_0xb992('0x5'))['db'];var utils=require(_0xb992('0x6'));var logger=require(_0xb992('0x7'))(_0xb992('0x8'));var config=require('../../config/environment');var jayson=require(_0xb992('0x9'));var client=jayson[_0xb992('0xa')][_0xb992('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31506a,_0xd83f2f,_0x5e985b){return new BPromise(function(_0x44771a,_0x4a3cfd){return client[_0xb992('0xc')](_0x31506a,_0x5e985b)[_0xb992('0xd')](function(_0x526897){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0xd83f2f,_0xb992('0xe'));logger[_0xb992('0xf')](_0xb992('0x10'),_0xd83f2f,_0xb992('0xe'),JSON[_0xb992('0x11')](_0x526897));if(_0x526897[_0xb992('0x12')]){if(_0x526897[_0xb992('0x12')]['code']===0x1f4){logger[_0xb992('0x12')](_0xb992('0x13'),_0xd83f2f,_0x526897[_0xb992('0x12')][_0xb992('0x14')]);return _0x4a3cfd(_0x526897[_0xb992('0x12')][_0xb992('0x14')]);}logger['error'](_0xb992('0x13'),_0xd83f2f,_0x526897[_0xb992('0x12')][_0xb992('0x14')]);return _0x44771a(_0x526897['error']['message']);}else{logger[_0xb992('0x15')](_0xb992('0x13'),_0xd83f2f,_0xb992('0xe'));_0x44771a(_0x526897[_0xb992('0x16')][_0xb992('0x14')]);}})[_0xb992('0x17')](function(_0x57af6a){logger[_0xb992('0x12')](_0xb992('0x13'),_0xd83f2f,_0x57af6a);_0x4a3cfd(_0x57af6a);});});} \ No newline at end of file +var _0x8f9d=['../../config/utils','../../config/environment','jayson/promise','client','request','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x4007b5,_0x1b72ef){var _0x5e9f06=function(_0x1e7716){while(--_0x1e7716){_0x4007b5['push'](_0x4007b5['shift']());}};_0x5e9f06(++_0x1b72ef);}(_0x8f9d,0xf2));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd8f9('0x0'));var util=require(_0xd8f9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd8f9('0x2'));var fs=require('fs');var Redis=require(_0xd8f9('0x3'));var db=require(_0xd8f9('0x4'))['db'];var utils=require(_0xd8f9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd8f9('0x6'));var jayson=require(_0xd8f9('0x7'));var client=jayson[_0xd8f9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4355d7,_0x3e3b92,_0x16288d){return new BPromise(function(_0x3fb20c,_0x3c9d31){return client[_0xd8f9('0x9')](_0x4355d7,_0x16288d)['then'](function(_0x489796){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3e3b92,_0xd8f9('0xa'));logger['debug'](_0xd8f9('0xb'),_0x3e3b92,_0xd8f9('0xa'),JSON['stringify'](_0x489796));if(_0x489796[_0xd8f9('0xc')]){if(_0x489796['error'][_0xd8f9('0xd')]===0x1f4){logger[_0xd8f9('0xc')](_0xd8f9('0xe'),_0x3e3b92,_0x489796['error']['message']);return _0x3c9d31(_0x489796[_0xd8f9('0xc')][_0xd8f9('0xf')]);}logger[_0xd8f9('0xc')](_0xd8f9('0xe'),_0x3e3b92,_0x489796[_0xd8f9('0xc')][_0xd8f9('0xf')]);return _0x3fb20c(_0x489796[_0xd8f9('0xc')][_0xd8f9('0xf')]);}else{logger[_0xd8f9('0x10')](_0xd8f9('0xe'),_0x3e3b92,_0xd8f9('0xa'));_0x3fb20c(_0x489796[_0xd8f9('0x11')][_0xd8f9('0xf')]);}})[_0xd8f9('0x12')](function(_0x3fbfb4){logger[_0xd8f9('0xc')](_0xd8f9('0xe'),_0x3e3b92,_0x3fbfb4);_0x3c9d31(_0x3fbfb4);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4e83ae1..1fe9357 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 _0x2327=['exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','put','update','delete','destroy'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2327,0x1cf));var _0x7232=function(_0xadcfdc,_0x4bd341){_0xadcfdc=_0xadcfdc-0x0;var _0x119c5e=_0x2327[_0xadcfdc];return _0x119c5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7232('0x0'));var timeout=require(_0x7232('0x1'));var express=require(_0x7232('0x2'));var router=express['Router']();var fs_extra=require(_0x7232('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7232('0x4'));var config=require(_0x7232('0x5'));var controller=require(_0x7232('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7232('0x7')]);router[_0x7232('0x8')](_0x7232('0x9'),auth[_0x7232('0xa')](),controller[_0x7232('0xb')]);router[_0x7232('0x8')](_0x7232('0xc'),auth[_0x7232('0xa')](),controller[_0x7232('0xd')]);router[_0x7232('0x8')](_0x7232('0xe'),auth[_0x7232('0xa')](),controller[_0x7232('0xf')]);router[_0x7232('0x10')]('/',auth[_0x7232('0xa')](),controller['create']);router[_0x7232('0x11')](_0x7232('0xc'),auth[_0x7232('0xa')](),controller[_0x7232('0x12')]);router[_0x7232('0x13')]('/:id',auth[_0x7232('0xa')](),controller[_0x7232('0x14')]);module[_0x7232('0x15')]=router; \ No newline at end of file +var _0x0d67=['get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0xa7ee42,_0x43c8f8){var _0x18044a=function(_0x2c7f8a){while(--_0x2c7f8a){_0xa7ee42['push'](_0xa7ee42['shift']());}};_0x18044a(++_0x43c8f8);}(_0x0d67,0x64));var _0x70d6=function(_0x5ecae4,_0x5801b4){_0x5ecae4=_0x5ecae4-0x0;var _0x418b5e=_0x0d67[_0x5ecae4];return _0x418b5e;};'use strict';var multer=require('multer');var util=require(_0x70d6('0x0'));var path=require(_0x70d6('0x1'));var timeout=require(_0x70d6('0x2'));var express=require(_0x70d6('0x3'));var router=express[_0x70d6('0x4')]();var fs_extra=require(_0x70d6('0x5'));var auth=require(_0x70d6('0x6'));var interaction=require(_0x70d6('0x7'));var config=require(_0x70d6('0x8'));var controller=require(_0x70d6('0x9'));router[_0x70d6('0xa')]('/',auth[_0x70d6('0xb')](),controller['index']);router[_0x70d6('0xa')](_0x70d6('0xc'),auth[_0x70d6('0xb')](),controller[_0x70d6('0xd')]);router[_0x70d6('0xa')](_0x70d6('0xe'),auth[_0x70d6('0xb')](),controller[_0x70d6('0xf')]);router[_0x70d6('0xa')](_0x70d6('0x10'),auth[_0x70d6('0xb')](),controller['getQuestions']);router[_0x70d6('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x70d6('0x12')](_0x70d6('0xe'),auth[_0x70d6('0xb')](),controller[_0x70d6('0x13')]);router[_0x70d6('0x14')](_0x70d6('0xe'),auth[_0x70d6('0xb')](),controller[_0x70d6('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 68861f9..c160472 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 _0xe49a=['STRING','DATE','setDataValue','starttime','endtime'];(function(_0x3b81eb,_0x175f32){var _0x149491=function(_0x454753){while(--_0x454753){_0x3b81eb['push'](_0x3b81eb['shift']());}};_0x149491(++_0x175f32);}(_0xe49a,0x6f));var _0xae49=function(_0x28cb01,_0x39e649){_0x28cb01=_0x28cb01-0x0;var _0x1fe8c1=_0xe49a[_0x28cb01];return _0x1fe8c1;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xae49('0x0')],'set':function(_0x1e1862){this[_0xae49('0x1')](_0xae49('0x2'),_0x1e1862);this['setDataValue'](_0xae49('0x3'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xae49('0x0')]},'membername':{'type':Sequelize[_0xae49('0x4')]},'projectname':{'type':Sequelize[_0xae49('0x4')]},'queue':{'type':Sequelize[_0xae49('0x4')]},'uniqueid':{'type':Sequelize[_0xae49('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x57d5=['STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x57d5,0x192));var _0x557d=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x57d5[_0x2b9b7f];return _0x4ed19a;};'use strict';var moment=require(_0x557d('0x0'));var Sequelize=require(_0x557d('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x557d('0x2')],'set':function(_0x2332df){this[_0x557d('0x3')](_0x557d('0x4'),_0x2332df);this[_0x557d('0x3')](_0x557d('0x5'),moment()[_0x557d('0x6')](_0x557d('0x7')));}},'endtime':{'type':Sequelize[_0x557d('0x2')]},'membername':{'type':Sequelize[_0x557d('0x8')]},'projectname':{'type':Sequelize[_0x557d('0x8')]},'queue':{'type':Sequelize[_0x557d('0x8')]},'uniqueid':{'type':Sequelize[_0x557d('0x8')]},'calleridname':{'type':Sequelize[_0x557d('0x8')]},'calleridnum':{'type':Sequelize[_0x557d('0x8')]},'completed':{'type':Sequelize[_0x557d('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7f899fb..8925c7a 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 _0x2bac=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse'];(function(_0xb193f5,_0x25d2d0){var _0x401990=function(_0x58b385){while(--_0x58b385){_0xb193f5['push'](_0xb193f5['shift']());}};_0x401990(++_0x25d2d0);}(_0x2bac,0x84));var _0xc2ba=function(_0x53c56b,_0x343704){_0x53c56b=_0x53c56b-0x0;var _0x25a920=_0x2bac[_0x53c56b];return _0x25a920;};'use strict';var emlformat=require(_0xc2ba('0x0'));var rimraf=require(_0xc2ba('0x1'));var zipdir=require(_0xc2ba('0x2'));var jsonpatch=require(_0xc2ba('0x3'));var rp=require(_0xc2ba('0x4'));var moment=require('moment');var BPromise=require(_0xc2ba('0x5'));var Mustache=require(_0xc2ba('0x6'));var util=require(_0xc2ba('0x7'));var path=require(_0xc2ba('0x8'));var sox=require(_0xc2ba('0x9'));var csv=require(_0xc2ba('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2ba('0xb'));var _=require('lodash');var squel=require(_0xc2ba('0xc'));var crypto=require(_0xc2ba('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc2ba('0xe'));var toCsv=require(_0xc2ba('0xa'));var querystring=require('querystring');var Papa=require(_0xc2ba('0xf'));var Redis=require(_0xc2ba('0x10'));var authService=require(_0xc2ba('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2ba('0x12'));var logger=require(_0xc2ba('0x13'))('api');var utils=require(_0xc2ba('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc2ba('0x15'))['db'];function respondWithStatusCode(_0x58ab6f,_0x24dcd3){_0x24dcd3=_0x24dcd3||0xcc;return function(_0x4afee2){if(_0x4afee2){return _0x58ab6f[_0xc2ba('0x16')](_0x24dcd3);}return _0x58ab6f[_0xc2ba('0x17')](_0x24dcd3)[_0xc2ba('0x18')]();};}function respondWithResult(_0x883649,_0x57e6a2){_0x57e6a2=_0x57e6a2||0xc8;return function(_0x4ff839){if(_0x4ff839){return _0x883649[_0xc2ba('0x17')](_0x57e6a2)['json'](_0x4ff839);}};}function respondWithFilteredResult(_0x2c9878,_0x3a1f97){return function(_0x19b525){if(_0x19b525){var _0x1c327c=typeof _0x3a1f97[_0xc2ba('0x19')]===_0xc2ba('0x1a')&&typeof _0x3a1f97[_0xc2ba('0x1b')]==='undefined';var _0x302fdc=_0x19b525[_0xc2ba('0x1c')];var _0x3df14e=_0x1c327c?0x0:_0x3a1f97[_0xc2ba('0x19')];var _0x9efe14=_0x1c327c?_0x19b525[_0xc2ba('0x1c')]:_0x3a1f97[_0xc2ba('0x19')]+_0x3a1f97['limit'];var _0x442996;if(_0x9efe14>=_0x302fdc){_0x9efe14=_0x302fdc;_0x442996=0xc8;}else{_0x442996=0xce;}_0x2c9878[_0xc2ba('0x17')](_0x442996);return _0x2c9878[_0xc2ba('0x1d')](_0xc2ba('0x1e'),_0x3df14e+'-'+_0x9efe14+'/'+_0x302fdc)[_0xc2ba('0x1f')](_0x19b525);}return null;};}function patchUpdates(_0x443999){return function(_0x44fc70){try{jsonpatch[_0xc2ba('0x20')](_0x44fc70,_0x443999,!![]);}catch(_0x249e3f){return BPromise['reject'](_0x249e3f);}return _0x44fc70['save']();};}function saveUpdates(_0x5a4e36,_0x348716){return function(_0x5ec7b5){if(_0x5ec7b5){return _0x5ec7b5['update'](_0x5a4e36)[_0xc2ba('0x21')](function(_0x4bd56b){return _0x4bd56b;});}return null;};}function removeEntity(_0x55d13d,_0x13e6df){return function(_0x11d058){if(_0x11d058){return _0x11d058[_0xc2ba('0x22')]()[_0xc2ba('0x21')](function(){_0x55d13d[_0xc2ba('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x387d6a,_0x3d7789){return function(_0x2b5c2b){if(!_0x2b5c2b){_0x387d6a[_0xc2ba('0x16')](0x194);}return _0x2b5c2b;};}function handleError(_0xf13b5d,_0x56e2dc){_0x56e2dc=_0x56e2dc||0x1f4;return function(_0xfbaa9c){logger['error'](_0xfbaa9c[_0xc2ba('0x23')]);if(_0xfbaa9c[_0xc2ba('0x24')]){delete _0xfbaa9c[_0xc2ba('0x24')];}_0xf13b5d[_0xc2ba('0x17')](_0x56e2dc)[_0xc2ba('0x25')](_0xfbaa9c);};}exports[_0xc2ba('0x26')]=function(_0x3ddb27,_0x3be6d2){var _0x8e8c1b={},_0x29e3b1={},_0x2c691c={'count':0x0,'rows':[]};var _0x20470a=_[_0xc2ba('0x27')](db[_0xc2ba('0x28')][_0xc2ba('0x29')],function(_0x371f76){return{'name':_0x371f76[_0xc2ba('0x2a')],'type':_0x371f76['type']['key']};});_0x29e3b1[_0xc2ba('0x2b')]=_[_0xc2ba('0x27')](_0x20470a,'name');_0x29e3b1[_0xc2ba('0x2c')]=_['keys'](_0x3ddb27[_0xc2ba('0x2c')]);_0x29e3b1[_0xc2ba('0x2d')]=_['intersection'](_0x29e3b1[_0xc2ba('0x2b')],_0x29e3b1[_0xc2ba('0x2c')]);_0x8e8c1b['attributes']=_[_0xc2ba('0x2e')](_0x29e3b1['model'],qs[_0xc2ba('0x2f')](_0x3ddb27[_0xc2ba('0x2c')][_0xc2ba('0x2f')]));_0x8e8c1b[_0xc2ba('0x30')]=_0x8e8c1b[_0xc2ba('0x30')]['length']?_0x8e8c1b[_0xc2ba('0x30')]:_0x29e3b1[_0xc2ba('0x2b')];if(!_0x3ddb27[_0xc2ba('0x2c')]['hasOwnProperty'](_0xc2ba('0x31'))){_0x8e8c1b[_0xc2ba('0x1b')]=qs[_0xc2ba('0x1b')](_0x3ddb27[_0xc2ba('0x2c')]['limit']);_0x8e8c1b[_0xc2ba('0x19')]=qs['offset'](_0x3ddb27[_0xc2ba('0x2c')]['offset']);}_0x8e8c1b[_0xc2ba('0x32')]=qs['sort'](_0x3ddb27[_0xc2ba('0x2c')][_0xc2ba('0x33')]);_0x8e8c1b['where']=qs[_0xc2ba('0x2d')](_[_0xc2ba('0x34')](_0x3ddb27[_0xc2ba('0x2c')],_0x29e3b1[_0xc2ba('0x2d')]),_0x20470a);if(_0x3ddb27[_0xc2ba('0x2c')][_0xc2ba('0x35')]){_0x8e8c1b[_0xc2ba('0x36')]=_[_0xc2ba('0x37')](_0x8e8c1b['where'],{'$or':_['map'](_0x20470a,function(_0x36dfca){if(_0x36dfca['type']!==_0xc2ba('0x38')){var _0x5f4eec={};_0x5f4eec[_0x36dfca[_0xc2ba('0x24')]]={'$like':'%'+_0x3ddb27[_0xc2ba('0x2c')]['filter']+'%'};return _0x5f4eec;}})});}_0x8e8c1b=_[_0xc2ba('0x37')]({},_0x8e8c1b,_0x3ddb27[_0xc2ba('0x39')]);var _0x191fc2={'where':_0x8e8c1b[_0xc2ba('0x36')]};return db[_0xc2ba('0x28')]['count'](_0x191fc2)[_0xc2ba('0x21')](function(_0x3b6294){_0x2c691c[_0xc2ba('0x1c')]=_0x3b6294;if(_0x3ddb27[_0xc2ba('0x2c')][_0xc2ba('0x3a')]){_0x8e8c1b[_0xc2ba('0x3b')]=[{'all':!![]}];}return db[_0xc2ba('0x28')][_0xc2ba('0x3c')](_0x8e8c1b);})[_0xc2ba('0x21')](function(_0x6eb0bb){_0x2c691c[_0xc2ba('0x3d')]=_0x6eb0bb;return _0x2c691c;})[_0xc2ba('0x21')](respondWithFilteredResult(_0x3be6d2,_0x8e8c1b))['catch'](handleError(_0x3be6d2,null));};exports['show']=function(_0x3caeb1,_0x598fc7){var _0x14730a={'raw':!![],'where':{'id':_0x3caeb1[_0xc2ba('0x3e')]['id']}},_0x36a733={};_0x36a733[_0xc2ba('0x2b')]=_[_0xc2ba('0x3f')](db[_0xc2ba('0x28')]['rawAttributes']);_0x36a733[_0xc2ba('0x2c')]=_[_0xc2ba('0x3f')](_0x3caeb1[_0xc2ba('0x2c')]);_0x36a733['filters']=_[_0xc2ba('0x2e')](_0x36a733[_0xc2ba('0x2b')],_0x36a733[_0xc2ba('0x2c')]);_0x14730a[_0xc2ba('0x30')]=_[_0xc2ba('0x2e')](_0x36a733[_0xc2ba('0x2b')],qs['fields'](_0x3caeb1[_0xc2ba('0x2c')][_0xc2ba('0x2f')]));_0x14730a[_0xc2ba('0x30')]=_0x14730a[_0xc2ba('0x30')][_0xc2ba('0x40')]?_0x14730a['attributes']:_0x36a733['model'];if(_0x3caeb1['query'][_0xc2ba('0x3a')]){_0x14730a[_0xc2ba('0x3b')]=[{'all':!![]}];}_0x14730a=_[_0xc2ba('0x37')]({},_0x14730a,_0x3caeb1[_0xc2ba('0x39')]);return db[_0xc2ba('0x28')][_0xc2ba('0x41')](_0x14730a)[_0xc2ba('0x21')](handleEntityNotFound(_0x598fc7,null))[_0xc2ba('0x21')](respondWithResult(_0x598fc7,null))[_0xc2ba('0x42')](handleError(_0x598fc7,null));};exports[_0xc2ba('0x43')]=function(_0x4fc223,_0x461315){return db[_0xc2ba('0x28')][_0xc2ba('0x43')](_0x4fc223['body'],{})[_0xc2ba('0x21')](respondWithResult(_0x461315,0xc9))['catch'](handleError(_0x461315,null));};exports['update']=function(_0x43212a,_0x48062d){if(_0x43212a['body']['id']){delete _0x43212a['body']['id'];}return db[_0xc2ba('0x28')][_0xc2ba('0x41')]({'where':{'id':_0x43212a[_0xc2ba('0x3e')]['id']}})['then'](handleEntityNotFound(_0x48062d,null))[_0xc2ba('0x21')](saveUpdates(_0x43212a[_0xc2ba('0x44')],null))[_0xc2ba('0x21')](respondWithResult(_0x48062d,null))[_0xc2ba('0x42')](handleError(_0x48062d,null));};exports[_0xc2ba('0x22')]=function(_0x141b44,_0xcadcc0){return db[_0xc2ba('0x28')][_0xc2ba('0x41')]({'where':{'id':_0x141b44[_0xc2ba('0x3e')]['id']}})['then'](handleEntityNotFound(_0xcadcc0,null))['then'](removeEntity(_0xcadcc0,null))[_0xc2ba('0x42')](handleError(_0xcadcc0,null));};exports[_0xc2ba('0x45')]=function(_0x51820f,_0x5cab2e){return db['JscriptySessionReport']['describe']()[_0xc2ba('0x21')](respondWithResult(_0x5cab2e,null))[_0xc2ba('0x42')](handleError(_0x5cab2e,null));};exports[_0xc2ba('0x46')]=function(_0x4d74f2,_0x29a019,_0xc8911a){var _0x939e18={'raw':!![],'where':{}};var _0x47b4d3={};var _0x10b1fb={'count':0x0,'rows':[]};return db[_0xc2ba('0x28')][_0xc2ba('0x47')]({'where':{'id':_0x4d74f2['params']['id']}})[_0xc2ba('0x21')](handleEntityNotFound(_0x29a019,null))['then'](function(_0x160726){if(_0x160726){_0x47b4d3['model']=_[_0xc2ba('0x3f')](db[_0xc2ba('0x48')]['rawAttributes']);_0x47b4d3[_0xc2ba('0x2c')]=_[_0xc2ba('0x3f')](_0x4d74f2['query']);_0x47b4d3[_0xc2ba('0x2d')]=_[_0xc2ba('0x2e')](_0x47b4d3['model'],_0x47b4d3['query']);_0x939e18[_0xc2ba('0x30')]=_[_0xc2ba('0x2e')](_0x47b4d3[_0xc2ba('0x2b')],qs['fields'](_0x4d74f2[_0xc2ba('0x2c')][_0xc2ba('0x2f')]));_0x939e18['attributes']=_0x939e18[_0xc2ba('0x30')]['length']?_0x939e18[_0xc2ba('0x30')]:_0x47b4d3[_0xc2ba('0x2b')];if(!_0x4d74f2[_0xc2ba('0x2c')]['hasOwnProperty'](_0xc2ba('0x31'))){_0x939e18[_0xc2ba('0x1b')]=qs['limit'](_0x4d74f2[_0xc2ba('0x2c')][_0xc2ba('0x1b')]);_0x939e18['offset']=qs[_0xc2ba('0x19')](_0x4d74f2[_0xc2ba('0x2c')][_0xc2ba('0x19')]);}_0x939e18[_0xc2ba('0x32')]=qs[_0xc2ba('0x33')](_0x4d74f2[_0xc2ba('0x2c')]['sort']);_0x939e18[_0xc2ba('0x36')]=qs['filters'](_['pick'](_0x4d74f2['query'],_0x47b4d3[_0xc2ba('0x2d')]));_0x939e18[_0xc2ba('0x36')][_0xc2ba('0x49')]=_0x160726['id'];if(_0x4d74f2[_0xc2ba('0x2c')][_0xc2ba('0x35')]){_0x939e18[_0xc2ba('0x36')]=_['merge'](_0x939e18['where'],{'$or':_['map'](_0x939e18['attributes'],function(_0x5d4a22){var _0x402c85={};_0x402c85[_0x5d4a22]={'$like':'%'+_0x4d74f2[_0xc2ba('0x2c')]['filter']+'%'};return _0x402c85;})});}_0x939e18=_[_0xc2ba('0x37')]({},_0x939e18,_0x4d74f2[_0xc2ba('0x39')]);return db[_0xc2ba('0x48')]['count']({'where':_0x939e18[_0xc2ba('0x36')]})[_0xc2ba('0x21')](function(_0xfbf6cc){_0x10b1fb[_0xc2ba('0x1c')]=_0xfbf6cc;if(_0x4d74f2[_0xc2ba('0x2c')][_0xc2ba('0x3a')]){_0x939e18[_0xc2ba('0x3b')]=[{'all':!![]}];}return db[_0xc2ba('0x48')][_0xc2ba('0x3c')](_0x939e18);})[_0xc2ba('0x21')](function(_0x3b64f5){_0x10b1fb[_0xc2ba('0x3d')]=_0x3b64f5;return _0x10b1fb;});}})[_0xc2ba('0x21')](respondWithFilteredResult(_0x29a019,_0x939e18))['catch'](handleError(_0x29a019,null));}; \ No newline at end of file +var _0x76a6=['index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','JscriptySessionReport','includeAll','rows','catch','show','params','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','findAll','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x377de6,_0x4de4c6){var _0x4d5564=function(_0x3b43f6){while(--_0x3b43f6){_0x377de6['push'](_0x377de6['shift']());}};_0x4d5564(++_0x4de4c6);}(_0x76a6,0x153));var _0x676a=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0x76a6[_0x206338];return _0x2b87f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x676a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x676a('0x1'));var rp=require(_0x676a('0x2'));var moment=require(_0x676a('0x3'));var BPromise=require(_0x676a('0x4'));var Mustache=require(_0x676a('0x5'));var util=require('util');var path=require(_0x676a('0x6'));var sox=require(_0x676a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x676a('0x8'));var _=require(_0x676a('0x9'));var squel=require(_0x676a('0xa'));var crypto=require(_0x676a('0xb'));var jsforce=require(_0x676a('0xc'));var deskjs=require(_0x676a('0xd'));var toCsv=require(_0x676a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x676a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x676a('0x10'));var utils=require('../../config/utils');var config=require(_0x676a('0x11'));var licenseUtil=require(_0x676a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd25825,_0x3e09d0){_0x3e09d0=_0x3e09d0||0xcc;return function(_0x35ddce){if(_0x35ddce){return _0xd25825[_0x676a('0x13')](_0x3e09d0);}return _0xd25825[_0x676a('0x14')](_0x3e09d0)[_0x676a('0x15')]();};}function respondWithResult(_0x463c66,_0xac869b){_0xac869b=_0xac869b||0xc8;return function(_0x4722c1){if(_0x4722c1){return _0x463c66[_0x676a('0x14')](_0xac869b)[_0x676a('0x16')](_0x4722c1);}};}function respondWithFilteredResult(_0x4bf43d,_0x123ea4){return function(_0x2b9a4a){if(_0x2b9a4a){var _0x44a94a=typeof _0x123ea4[_0x676a('0x17')]===_0x676a('0x18')&&typeof _0x123ea4['limit']===_0x676a('0x18');var _0x5698ca=_0x2b9a4a[_0x676a('0x19')];var _0xf38f43=_0x44a94a?0x0:_0x123ea4[_0x676a('0x17')];var _0x2471d2=_0x44a94a?_0x2b9a4a[_0x676a('0x19')]:_0x123ea4['offset']+_0x123ea4[_0x676a('0x1a')];var _0x1cc4e5;if(_0x2471d2>=_0x5698ca){_0x2471d2=_0x5698ca;_0x1cc4e5=0xc8;}else{_0x1cc4e5=0xce;}_0x4bf43d[_0x676a('0x14')](_0x1cc4e5);return _0x4bf43d[_0x676a('0x1b')](_0x676a('0x1c'),_0xf38f43+'-'+_0x2471d2+'/'+_0x5698ca)[_0x676a('0x16')](_0x2b9a4a);}return null;};}function patchUpdates(_0x1bb9d6){return function(_0x22bf46){try{jsonpatch[_0x676a('0x1d')](_0x22bf46,_0x1bb9d6,!![]);}catch(_0x17e618){return BPromise[_0x676a('0x1e')](_0x17e618);}return _0x22bf46['save']();};}function saveUpdates(_0x402f9a,_0x286d49){return function(_0x1098e0){if(_0x1098e0){return _0x1098e0[_0x676a('0x1f')](_0x402f9a)[_0x676a('0x20')](function(_0x17a9ae){return _0x17a9ae;});}return null;};}function removeEntity(_0x15ef95,_0x44c888){return function(_0x464b70){if(_0x464b70){return _0x464b70[_0x676a('0x21')]()[_0x676a('0x20')](function(){_0x15ef95[_0x676a('0x14')](0xcc)[_0x676a('0x15')]();});}};}function handleEntityNotFound(_0x5e9ff3,_0x53cca4){return function(_0x13f657){if(!_0x13f657){_0x5e9ff3[_0x676a('0x13')](0x194);}return _0x13f657;};}function handleError(_0x5a12e8,_0x3b485d){_0x3b485d=_0x3b485d||0x1f4;return function(_0x1a68ef){logger['error'](_0x1a68ef[_0x676a('0x22')]);if(_0x1a68ef[_0x676a('0x23')]){delete _0x1a68ef[_0x676a('0x23')];}_0x5a12e8[_0x676a('0x14')](_0x3b485d)['send'](_0x1a68ef);};}exports[_0x676a('0x24')]=function(_0x37de03,_0xb2a0a5){var _0x5ba2e8={},_0x27cb6c={},_0x367242={'count':0x0,'rows':[]};var _0x6fb490=_[_0x676a('0x25')](db['JscriptySessionReport'][_0x676a('0x26')],function(_0x61fa7a){return{'name':_0x61fa7a[_0x676a('0x27')],'type':_0x61fa7a['type'][_0x676a('0x28')]};});_0x27cb6c[_0x676a('0x29')]=_[_0x676a('0x25')](_0x6fb490,_0x676a('0x23'));_0x27cb6c['query']=_[_0x676a('0x2a')](_0x37de03[_0x676a('0x2b')]);_0x27cb6c[_0x676a('0x2c')]=_[_0x676a('0x2d')](_0x27cb6c[_0x676a('0x29')],_0x27cb6c[_0x676a('0x2b')]);_0x5ba2e8[_0x676a('0x2e')]=_[_0x676a('0x2d')](_0x27cb6c['model'],qs[_0x676a('0x2f')](_0x37de03[_0x676a('0x2b')][_0x676a('0x2f')]));_0x5ba2e8[_0x676a('0x2e')]=_0x5ba2e8[_0x676a('0x2e')][_0x676a('0x30')]?_0x5ba2e8[_0x676a('0x2e')]:_0x27cb6c[_0x676a('0x29')];if(!_0x37de03[_0x676a('0x2b')]['hasOwnProperty'](_0x676a('0x31'))){_0x5ba2e8[_0x676a('0x1a')]=qs[_0x676a('0x1a')](_0x37de03['query'][_0x676a('0x1a')]);_0x5ba2e8[_0x676a('0x17')]=qs[_0x676a('0x17')](_0x37de03[_0x676a('0x2b')][_0x676a('0x17')]);}_0x5ba2e8[_0x676a('0x32')]=qs[_0x676a('0x33')](_0x37de03['query'][_0x676a('0x33')]);_0x5ba2e8[_0x676a('0x34')]=qs[_0x676a('0x2c')](_[_0x676a('0x35')](_0x37de03[_0x676a('0x2b')],_0x27cb6c['filters']),_0x6fb490);if(_0x37de03['query'][_0x676a('0x36')]){_0x5ba2e8[_0x676a('0x34')]=_[_0x676a('0x37')](_0x5ba2e8[_0x676a('0x34')],{'$or':_[_0x676a('0x25')](_0x6fb490,function(_0xd97329){if(_0xd97329[_0x676a('0x38')]!==_0x676a('0x39')){var _0xb08f80={};_0xb08f80[_0xd97329[_0x676a('0x23')]]={'$like':'%'+_0x37de03[_0x676a('0x2b')][_0x676a('0x36')]+'%'};return _0xb08f80;}})});}_0x5ba2e8=_[_0x676a('0x37')]({},_0x5ba2e8,_0x37de03[_0x676a('0x3a')]);var _0x22aec8={'where':_0x5ba2e8[_0x676a('0x34')]};return db[_0x676a('0x3b')]['count'](_0x22aec8)[_0x676a('0x20')](function(_0x53cae7){_0x367242['count']=_0x53cae7;if(_0x37de03[_0x676a('0x2b')][_0x676a('0x3c')]){_0x5ba2e8['include']=[{'all':!![]}];}return db[_0x676a('0x3b')]['findAll'](_0x5ba2e8);})[_0x676a('0x20')](function(_0x5281c6){_0x367242[_0x676a('0x3d')]=_0x5281c6;return _0x367242;})['then'](respondWithFilteredResult(_0xb2a0a5,_0x5ba2e8))[_0x676a('0x3e')](handleError(_0xb2a0a5,null));};exports[_0x676a('0x3f')]=function(_0x2af35c,_0x2b850a){var _0x35e7fe={'raw':!![],'where':{'id':_0x2af35c[_0x676a('0x40')]['id']}},_0x160980={};_0x160980[_0x676a('0x29')]=_[_0x676a('0x2a')](db[_0x676a('0x3b')][_0x676a('0x26')]);_0x160980['query']=_[_0x676a('0x2a')](_0x2af35c[_0x676a('0x2b')]);_0x160980['filters']=_[_0x676a('0x2d')](_0x160980[_0x676a('0x29')],_0x160980[_0x676a('0x2b')]);_0x35e7fe['attributes']=_['intersection'](_0x160980[_0x676a('0x29')],qs[_0x676a('0x2f')](_0x2af35c[_0x676a('0x2b')]['fields']));_0x35e7fe['attributes']=_0x35e7fe[_0x676a('0x2e')]['length']?_0x35e7fe['attributes']:_0x160980[_0x676a('0x29')];if(_0x2af35c[_0x676a('0x2b')][_0x676a('0x3c')]){_0x35e7fe[_0x676a('0x41')]=[{'all':!![]}];}_0x35e7fe=_[_0x676a('0x37')]({},_0x35e7fe,_0x2af35c[_0x676a('0x3a')]);return db[_0x676a('0x3b')][_0x676a('0x42')](_0x35e7fe)[_0x676a('0x20')](handleEntityNotFound(_0x2b850a,null))['then'](respondWithResult(_0x2b850a,null))[_0x676a('0x3e')](handleError(_0x2b850a,null));};exports[_0x676a('0x43')]=function(_0x34aff6,_0x1e660c){return db[_0x676a('0x3b')][_0x676a('0x43')](_0x34aff6[_0x676a('0x44')],{})['then'](respondWithResult(_0x1e660c,0xc9))[_0x676a('0x3e')](handleError(_0x1e660c,null));};exports[_0x676a('0x1f')]=function(_0x5bfbee,_0x44cbe4){if(_0x5bfbee[_0x676a('0x44')]['id']){delete _0x5bfbee[_0x676a('0x44')]['id'];}return db[_0x676a('0x3b')][_0x676a('0x42')]({'where':{'id':_0x5bfbee[_0x676a('0x40')]['id']}})[_0x676a('0x20')](handleEntityNotFound(_0x44cbe4,null))[_0x676a('0x20')](saveUpdates(_0x5bfbee[_0x676a('0x44')],null))[_0x676a('0x20')](respondWithResult(_0x44cbe4,null))[_0x676a('0x3e')](handleError(_0x44cbe4,null));};exports[_0x676a('0x21')]=function(_0x484c44,_0x48380e){return db['JscriptySessionReport'][_0x676a('0x42')]({'where':{'id':_0x484c44[_0x676a('0x40')]['id']}})[_0x676a('0x20')](handleEntityNotFound(_0x48380e,null))[_0x676a('0x20')](removeEntity(_0x48380e,null))[_0x676a('0x3e')](handleError(_0x48380e,null));};exports[_0x676a('0x45')]=function(_0x5dac39,_0x9e5f82){return db[_0x676a('0x3b')][_0x676a('0x45')]()['then'](respondWithResult(_0x9e5f82,null))[_0x676a('0x3e')](handleError(_0x9e5f82,null));};exports[_0x676a('0x46')]=function(_0x3571d0,_0x41e003,_0x41e401){var _0x87f3bb={'raw':!![],'where':{}};var _0x221eb6={};var _0x3b1d5d={'count':0x0,'rows':[]};return db[_0x676a('0x3b')][_0x676a('0x47')]({'where':{'id':_0x3571d0[_0x676a('0x40')]['id']}})[_0x676a('0x20')](handleEntityNotFound(_0x41e003,null))[_0x676a('0x20')](function(_0xc2e3ba){if(_0xc2e3ba){_0x221eb6[_0x676a('0x29')]=_[_0x676a('0x2a')](db[_0x676a('0x48')][_0x676a('0x26')]);_0x221eb6[_0x676a('0x2b')]=_[_0x676a('0x2a')](_0x3571d0[_0x676a('0x2b')]);_0x221eb6[_0x676a('0x2c')]=_[_0x676a('0x2d')](_0x221eb6[_0x676a('0x29')],_0x221eb6[_0x676a('0x2b')]);_0x87f3bb[_0x676a('0x2e')]=_[_0x676a('0x2d')](_0x221eb6[_0x676a('0x29')],qs['fields'](_0x3571d0[_0x676a('0x2b')]['fields']));_0x87f3bb[_0x676a('0x2e')]=_0x87f3bb['attributes']['length']?_0x87f3bb['attributes']:_0x221eb6[_0x676a('0x29')];if(!_0x3571d0[_0x676a('0x2b')]['hasOwnProperty']('nolimit')){_0x87f3bb[_0x676a('0x1a')]=qs[_0x676a('0x1a')](_0x3571d0[_0x676a('0x2b')][_0x676a('0x1a')]);_0x87f3bb[_0x676a('0x17')]=qs[_0x676a('0x17')](_0x3571d0[_0x676a('0x2b')][_0x676a('0x17')]);}_0x87f3bb['order']=qs[_0x676a('0x33')](_0x3571d0[_0x676a('0x2b')][_0x676a('0x33')]);_0x87f3bb[_0x676a('0x34')]=qs['filters'](_['pick'](_0x3571d0[_0x676a('0x2b')],_0x221eb6[_0x676a('0x2c')]));_0x87f3bb['where'][_0x676a('0x49')]=_0xc2e3ba['id'];if(_0x3571d0[_0x676a('0x2b')]['filter']){_0x87f3bb[_0x676a('0x34')]=_[_0x676a('0x37')](_0x87f3bb[_0x676a('0x34')],{'$or':_[_0x676a('0x25')](_0x87f3bb[_0x676a('0x2e')],function(_0x12de29){var _0x1c141e={};_0x1c141e[_0x12de29]={'$like':'%'+_0x3571d0[_0x676a('0x2b')][_0x676a('0x36')]+'%'};return _0x1c141e;})});}_0x87f3bb=_[_0x676a('0x37')]({},_0x87f3bb,_0x3571d0['options']);return db['JscriptyQuestionReport'][_0x676a('0x19')]({'where':_0x87f3bb[_0x676a('0x34')]})[_0x676a('0x20')](function(_0x16dad5){_0x3b1d5d['count']=_0x16dad5;if(_0x3571d0['query'][_0x676a('0x3c')]){_0x87f3bb[_0x676a('0x41')]=[{'all':!![]}];}return db[_0x676a('0x48')][_0x676a('0x4a')](_0x87f3bb);})['then'](function(_0x52ed58){_0x3b1d5d['rows']=_0x52ed58;return _0x3b1d5d;});}})[_0x676a('0x20')](respondWithFilteredResult(_0x41e003,_0x87f3bb))[_0x676a('0x3e')](handleError(_0x41e003,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0621418..9578e33 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 _0x4975=['./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf661be,_0x2aac0b){var _0x12abb7=function(_0x3ab6fd){while(--_0x3ab6fd){_0xf661be['push'](_0xf661be['shift']());}};_0x12abb7(++_0x2aac0b);}(_0x4975,0x86));var _0x5497=function(_0x424b08,_0x4c72a8){_0x424b08=_0x424b08-0x0;var _0x360924=_0x4975[_0x424b08];return _0x360924;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0ae=['api','bluebird','path','rimraf','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','../../config/logger'];(function(_0xad4a0b,_0x2f6b32){var _0x330092=function(_0x6649fc){while(--_0x6649fc){_0xad4a0b['push'](_0xad4a0b['shift']());}};_0x330092(++_0x2f6b32);}(_0xe0ae,0xa1));var _0xee0a=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0xe0ae[_0x146be0];return _0x1bcc25;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var moment=require('moment');var BPromise=require(_0xee0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee0a('0x3'));var rimraf=require(_0xee0a('0x4'));var config=require('../../config/environment');var attributes=require(_0xee0a('0x5'));module['exports']=function(_0x5bef07,_0x39a302){return _0x5bef07[_0xee0a('0x6')](_0xee0a('0x7'),attributes,{'tableName':_0xee0a('0x8'),'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 d485993..8177408 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 _0xa456=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x55a787,_0x1466a3){var _0x5d90a0=function(_0x5405fb){while(--_0x5405fb){_0x55a787['push'](_0x55a787['shift']());}};_0x5d90a0(++_0x1466a3);}(_0xa456,0x142));var _0x6a45=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xa456[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});} \ No newline at end of file +var _0x68b3=['rpc','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d790e,_0x2bc7b3){var _0x39f5be=function(_0x19a318){while(--_0x19a318){_0x3d790e['push'](_0x3d790e['shift']());}};_0x39f5be(++_0x2bc7b3);}(_0x68b3,0x1d8));var _0x368b=function(_0x10b07f,_0x133cf7){_0x10b07f=_0x10b07f-0x0;var _0x446291=_0x68b3[_0x10b07f];return _0x446291;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6ef41ce..0d9ee9c 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 _0x9aee=['../../components/auth/service','../../components/interaction/service','index','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x290b68,_0x1f82af){var _0x2f23af=function(_0x5efc22){while(--_0x5efc22){_0x290b68['push'](_0x290b68['shift']());}};_0x2f23af(++_0x1f82af);}(_0x9aee,0x71));var _0xe9ae=function(_0x10c2dd,_0x2b0aa5){_0x10c2dd=_0x10c2dd-0x0;var _0x5f166b=_0x9aee[_0x10c2dd];return _0x5f166b;};'use strict';var multer=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var path=require(_0xe9ae('0x2'));var timeout=require(_0xe9ae('0x3'));var express=require(_0xe9ae('0x4'));var router=express[_0xe9ae('0x5')]();var fs_extra=require(_0xe9ae('0x6'));var auth=require(_0xe9ae('0x7'));var interaction=require(_0xe9ae('0x8'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0xe9ae('0x9')]);router['put']('/:id',auth[_0xe9ae('0xa')](),controller['update']);module[_0xe9ae('0xb')]=router; \ No newline at end of file +var _0xf385=['../../components/auth/service','get','put','/:id','isAuthenticated','update','multer','connect-timeout','express','Router','fs-extra'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf385,0xab));var _0x5f38=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0xf385[_0x4c80d7];return _0x3c5095;};'use strict';var multer=require(_0x5f38('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f38('0x1'));var express=require(_0x5f38('0x2'));var router=express[_0x5f38('0x3')]();var fs_extra=require(_0x5f38('0x4'));var auth=require(_0x5f38('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0x5f38('0x6')]('/',controller['index']);router[_0x5f38('0x7')](_0x5f38('0x8'),auth[_0x5f38('0x9')](),controller[_0x5f38('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 36ff6bb..c8f9ad2 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 _0xd7c0=['INTEGER','sequelize','TEXT','STRING'];(function(_0x231bf2,_0x41bc52){var _0x3b99cf=function(_0x421814){while(--_0x421814){_0x231bf2['push'](_0x231bf2['shift']());}};_0x3b99cf(++_0x41bc52);}(_0xd7c0,0x85));var _0x0d7c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd7c0[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x0d7c('0x0'));module['exports']={'license':{'type':Sequelize[_0x0d7c('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x0d7c('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x0d7c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1692=['TEXT','STRING','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1692,0x132));var _0x2169=function(_0x278cd4,_0x23c694){_0x278cd4=_0x278cd4-0x0;var _0x1565a2=_0x1692[_0x278cd4];return _0x1565a2;};'use strict';var Sequelize=require(_0x2169('0x0'));module[_0x2169('0x1')]={'license':{'type':Sequelize[_0x2169('0x2')]},'data1':{'type':Sequelize[_0x2169('0x3')]},'data2':{'type':Sequelize[_0x2169('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index bb4e217..9a2c8b7 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 _0x326f=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','catch','body','License','find','checkLicense','key','demo','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'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x326f,0xd1));var _0xf326=function(_0x2e68b2,_0x8b111){_0x2e68b2=_0x2e68b2-0x0;var _0x1a9b81=_0x326f[_0x2e68b2];return _0x1a9b81;};'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'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x6a8e89,_0x1ae23a){var _0x2fa28e={'raw':!![],'where':{'id':0x1}},_0x5dbe63={};_0x5dbe63[_0xf326('0x28')]=_[_0xf326('0x29')](db['License'][_0xf326('0x2a')]);_0x5dbe63[_0xf326('0x2b')]=_[_0xf326('0x29')](_0x6a8e89[_0xf326('0x2b')]);_0x5dbe63[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5dbe63[_0xf326('0x28')],_0x5dbe63[_0xf326('0x2b')]);_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2d')](_0x5dbe63['model'],qs[_0xf326('0x2f')](_0x6a8e89[_0xf326('0x2b')][_0xf326('0x2f')]));_0x2fa28e['attributes']=_0x2fa28e[_0xf326('0x2e')][_0xf326('0x30')]?_0x2fa28e[_0xf326('0x2e')]:_0x5dbe63['model'];_0x2fa28e=_['merge']({},_0x2fa28e,_0x6a8e89[_0xf326('0x31')]);return utilLicense[_0xf326('0x32')](_0x2fa28e)[_0xf326('0x24')](respondWithResult(_0x1ae23a,null))[_0xf326('0x33')](handleError(_0x1ae23a,null));};exports[_0xf326('0x22')]=function(_0x2e8a64,_0x62585a){if(_0x2e8a64[_0xf326('0x34')]['id']){delete _0x2e8a64['body']['id'];}return db[_0xf326('0x35')][_0xf326('0x36')]({'where':{'id':_0x2e8a64['params']['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x62585a,null))['then'](function(_0xce1cbb){var _0x481b64=_0xce1cbb['get']({'plain':!![]});return utilLicense[_0xf326('0x37')](_0x481b64,_0x2e8a64['body'][_0xf326('0x38')]);})['then'](function(_0x310dbb){if(!_0x310dbb[_0xf326('0x39')]){return saveUpdates(_0x2e8a64[_0xf326('0x34')],null);}return _0x310dbb;})['then'](respondWithResult(_0x62585a,null))[_0xf326('0x33')](handleError(_0x62585a,null));}; \ No newline at end of file +var _0x2ef3=['length','options','then','catch','body','params','get','checkLicense','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x582fdd,_0x5a5e12){var _0x54adb6=function(_0x4321db){while(--_0x4321db){_0x582fdd['push'](_0x582fdd['shift']());}};_0x54adb6(++_0x5a5e12);}(_0x2ef3,0xba));var _0x32ef=function(_0x4dd563,_0x529855){_0x4dd563=_0x4dd563-0x0;var _0x3acd3a=_0x2ef3[_0x4dd563];return _0x3acd3a;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}var utilLicense=require('../../config/license/util');exports[_0x32ef('0x29')]=function(_0x2f5d06,_0x5a04cd){var _0x12de1a={'raw':!![],'where':{'id':0x1}},_0x3c569d={};_0x3c569d[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](db['License'][_0x32ef('0x2c')]);_0x3c569d[_0x32ef('0x2d')]=_[_0x32ef('0x2b')](_0x2f5d06[_0x32ef('0x2d')]);_0x3c569d[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x3c569d[_0x32ef('0x2a')],_0x3c569d['query']);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x3c569d[_0x32ef('0x2a')],qs[_0x32ef('0x31')](_0x2f5d06['query'][_0x32ef('0x31')]));_0x12de1a[_0x32ef('0x30')]=_0x12de1a[_0x32ef('0x30')][_0x32ef('0x32')]?_0x12de1a[_0x32ef('0x30')]:_0x3c569d['model'];_0x12de1a=_['merge']({},_0x12de1a,_0x2f5d06[_0x32ef('0x33')]);return utilLicense['getLicense'](_0x12de1a)[_0x32ef('0x34')](respondWithResult(_0x5a04cd,null))[_0x32ef('0x35')](handleError(_0x5a04cd,null));};exports[_0x32ef('0x24')]=function(_0x390670,_0x389583){if(_0x390670[_0x32ef('0x36')]['id']){delete _0x390670['body']['id'];}return db['License']['find']({'where':{'id':_0x390670[_0x32ef('0x37')]['id']}})[_0x32ef('0x34')](handleEntityNotFound(_0x389583,null))[_0x32ef('0x34')](function(_0x5f2443){var _0x4fb402=_0x5f2443[_0x32ef('0x38')]({'plain':!![]});return utilLicense[_0x32ef('0x39')](_0x4fb402,_0x390670[_0x32ef('0x36')]['key']);})['then'](function(_0xcbdec8){if(!_0xcbdec8[_0x32ef('0x3a')]){return saveUpdates(_0x390670[_0x32ef('0x36')],null);}return _0xcbdec8;})[_0x32ef('0x34')](respondWithResult(_0x389583,null))[_0x32ef('0x35')](handleError(_0x389583,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 585e3c2..6b3a491 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 _0xee2f=['path','../../config/environment','define','License','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x3c096c,_0x3de5ea){var _0x4df30b=function(_0x3302a4){while(--_0x3302a4){_0x3c096c['push'](_0x3c096c['shift']());}};_0x4df30b(++_0x3de5ea);}(_0xee2f,0x13f));var _0xfee2=function(_0x5742f9,_0x3cc215){_0x5742f9=_0x5742f9-0x0;var _0x5329cc=_0xee2f[_0x5742f9];return _0x5329cc;};'use strict';var _=require(_0xfee2('0x0'));var util=require('util');var logger=require(_0xfee2('0x1'))('api');var moment=require(_0xfee2('0x2'));var BPromise=require(_0xfee2('0x3'));var rp=require(_0xfee2('0x4'));var fs=require('fs');var path=require(_0xfee2('0x5'));var rimraf=require('rimraf');var config=require(_0xfee2('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0xbc9880,_0x2ccc55){return _0xbc9880[_0xfee2('0x7')](_0xfee2('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd68e=['../../config/environment','./license.attributes','exports','License','license','util','moment','bluebird','request-promise'];(function(_0x26e6dd,_0x2f2055){var _0x3e3bd8=function(_0x1e5164){while(--_0x1e5164){_0x26e6dd['push'](_0x26e6dd['shift']());}};_0x3e3bd8(++_0x2f2055);}(_0xd68e,0x19a));var _0xed68=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0xd68e[_0x1e399a];return _0x539897;};'use strict';var _=require('lodash');var util=require(_0xed68('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xed68('0x1'));var BPromise=require(_0xed68('0x2'));var rp=require(_0xed68('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xed68('0x4'));var attributes=require(_0xed68('0x5'));module[_0xed68('0x6')]=function(_0x292579,_0xc12d4e){return _0x292579['define'](_0xed68('0x7'),attributes,{'tableName':_0xed68('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 9c76b11..59dddd9 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 _0xa407=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa407,0xd0));var _0x7a40=function(_0x557045,_0x2541b4){_0x557045=_0x557045-0x0;var _0x330d2d=_0xa407[_0x557045];return _0x330d2d;};'use strict';var _=require(_0x7a40('0x0'));var util=require(_0x7a40('0x1'));var moment=require(_0x7a40('0x2'));var BPromise=require(_0x7a40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a40('0x5'));var logger=require(_0x7a40('0x6'))(_0x7a40('0x7'));var config=require(_0x7a40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a40('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5567cd,_0x1b6db7,_0x4e81f0){return new BPromise(function(_0xa04a42,_0x46819d){return client['request'](_0x5567cd,_0x4e81f0)[_0x7a40('0xa')](function(_0x2266f1){logger[_0x7a40('0xb')](_0x7a40('0xc'),_0x1b6db7,_0x7a40('0xd'));logger[_0x7a40('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x1b6db7,'request\x20sent',JSON[_0x7a40('0xf')](_0x2266f1));if(_0x2266f1[_0x7a40('0x10')]){if(_0x2266f1['error'][_0x7a40('0x11')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x1b6db7,_0x2266f1[_0x7a40('0x10')][_0x7a40('0x12')]);return _0x46819d(_0x2266f1[_0x7a40('0x10')][_0x7a40('0x12')]);}logger[_0x7a40('0x10')](_0x7a40('0xc'),_0x1b6db7,_0x2266f1[_0x7a40('0x10')][_0x7a40('0x12')]);return _0xa04a42(_0x2266f1[_0x7a40('0x10')][_0x7a40('0x12')]);}else{logger[_0x7a40('0xb')](_0x7a40('0xc'),_0x1b6db7,_0x7a40('0xd'));_0xa04a42(_0x2266f1['result'][_0x7a40('0x12')]);}})['catch'](function(_0x182abc){logger[_0x7a40('0x10')]('License,\x20%s,\x20%s',_0x1b6db7,_0x182abc);_0x46819d(_0x182abc);});});} \ No newline at end of file +var _0x81c5=['License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','License,\x20%s,\x20%s'];(function(_0x1e011c,_0xe55414){var _0x5dd674=function(_0x118b43){while(--_0x118b43){_0x1e011c['push'](_0x1e011c['shift']());}};_0x5dd674(++_0xe55414);}(_0x81c5,0x182));var _0x581c=function(_0x224ba5,_0x5a3d47){_0x224ba5=_0x224ba5-0x0;var _0xef0f58=_0x81c5[_0x224ba5];return _0xef0f58;};'use strict';var _=require(_0x581c('0x0'));var util=require(_0x581c('0x1'));var moment=require(_0x581c('0x2'));var BPromise=require(_0x581c('0x3'));var rs=require(_0x581c('0x4'));var fs=require('fs');var Redis=require(_0x581c('0x5'));var db=require(_0x581c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x581c('0x7'));var config=require('../../config/environment');var jayson=require(_0x581c('0x8'));var client=jayson[_0x581c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5ea8,_0x5dc69c,_0x27ea46){return new BPromise(function(_0x127a46,_0x2e1fc3){return client[_0x581c('0xa')](_0x3b5ea8,_0x27ea46)[_0x581c('0xb')](function(_0x2717a8){logger['info'](_0x581c('0xc'),_0x5dc69c,'request\x20sent');logger['debug'](_0x581c('0xd'),_0x5dc69c,_0x581c('0xe'),JSON[_0x581c('0xf')](_0x2717a8));if(_0x2717a8[_0x581c('0x10')]){if(_0x2717a8[_0x581c('0x10')]['code']===0x1f4){logger[_0x581c('0x10')](_0x581c('0xc'),_0x5dc69c,_0x2717a8['error'][_0x581c('0x11')]);return _0x2e1fc3(_0x2717a8[_0x581c('0x10')][_0x581c('0x11')]);}logger[_0x581c('0x10')](_0x581c('0xc'),_0x5dc69c,_0x2717a8[_0x581c('0x10')][_0x581c('0x11')]);return _0x127a46(_0x2717a8[_0x581c('0x10')][_0x581c('0x11')]);}else{logger[_0x581c('0x12')](_0x581c('0xc'),_0x5dc69c,_0x581c('0xe'));_0x127a46(_0x2717a8[_0x581c('0x13')][_0x581c('0x11')]);}})[_0x581c('0x14')](function(_0x7b23fd){logger['error']('License,\x20%s,\x20%s',_0x5dc69c,_0x7b23fd);_0x2e1fc3(_0x7b23fd);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 61085b4..3ab5ea9 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 _0x7420=['path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getMessages','/:id/verify','/:id/users','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','/:id/interactions','addInteraction','addApplications','/:id/send','send','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7420,0xfb));var _0x0742=function(_0x9f8429,_0x204641){_0x9f8429=_0x9f8429-0x0;var _0x27f18a=_0x7420[_0x9f8429];return _0x27f18a;};'use strict';var multer=require(_0x0742('0x0'));var util=require('util');var path=require(_0x0742('0x1'));var timeout=require(_0x0742('0x2'));var express=require(_0x0742('0x3'));var router=express[_0x0742('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0742('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x0742('0x6')]('/',auth[_0x0742('0x7')](),controller['index']);router[_0x0742('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x0742('0x8')]);router[_0x0742('0x6')](_0x0742('0x9'),auth[_0x0742('0x7')](),controller[_0x0742('0xa')]);router[_0x0742('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x0742('0x6')](_0x0742('0xb'),auth[_0x0742('0x7')](),controller[_0x0742('0xc')]);router['get']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0742('0xd')]);router[_0x0742('0x6')](_0x0742('0xe'),auth[_0x0742('0x7')](),controller[_0x0742('0xf')]);router['get']('/:id/interactions',auth[_0x0742('0x7')](),controller[_0x0742('0x10')]);router[_0x0742('0x6')](_0x0742('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0x0742('0x6')]('/:id/messages',auth[_0x0742('0x7')](),controller[_0x0742('0x12')]);router[_0x0742('0x6')](_0x0742('0x13'),auth[_0x0742('0x7')](),controller['verifySmtp']);router[_0x0742('0x6')](_0x0742('0x14'),auth[_0x0742('0x7')](),controller['getAgents']);router[_0x0742('0x15')]('/:id/dispositions',auth[_0x0742('0x7')](),controller[_0x0742('0x16')]);router[_0x0742('0x15')](_0x0742('0xb'),auth[_0x0742('0x7')](),controller[_0x0742('0x17')]);router[_0x0742('0x15')]('/',auth['isAuthenticated'](),controller[_0x0742('0x18')]);router[_0x0742('0x15')](_0x0742('0x19'),auth[_0x0742('0x7')](),controller[_0x0742('0x1a')]);router[_0x0742('0x15')](_0x0742('0xe'),auth[_0x0742('0x7')](),controller['addSmtp']);router[_0x0742('0x15')](_0x0742('0x1b'),auth[_0x0742('0x7')](),controller[_0x0742('0x1c')]);router[_0x0742('0x15')](_0x0742('0x11'),auth['isAuthenticated'](),controller[_0x0742('0x1d')]);router[_0x0742('0x15')](_0x0742('0x1e'),auth['isAuthenticated'](),controller[_0x0742('0x1f')]);router[_0x0742('0x15')](_0x0742('0x14'),auth[_0x0742('0x7')](),controller['addAgents']);router[_0x0742('0x20')](_0x0742('0x9'),auth[_0x0742('0x7')](),controller[_0x0742('0x21')]);router[_0x0742('0x22')](_0x0742('0x23'),auth['isAuthenticated'](),controller[_0x0742('0x24')]);router[_0x0742('0x22')](_0x0742('0xb'),auth[_0x0742('0x7')](),controller[_0x0742('0x25')]);router[_0x0742('0x22')](_0x0742('0x19'),auth[_0x0742('0x7')](),controller[_0x0742('0x26')]);router[_0x0742('0x22')]('/:id/out_servers',auth[_0x0742('0x7')](),controller[_0x0742('0x27')]);router[_0x0742('0x22')](_0x0742('0x9'),auth[_0x0742('0x7')](),controller[_0x0742('0x28')]);router[_0x0742('0x22')]('/:id/users',auth[_0x0742('0x7')](),controller[_0x0742('0x29')]);module['exports']=router; \ No newline at end of file +var _0xf9c4=['/:id','show','/:id/dispositions','getDispositions','getImap','/:id/interactions','/:id/applications','getApplications','verifySmtp','getAgents','addDisposition','post','/:id/canned_answers','addAnswer','create','/:id/in_servers','addImap','addInteraction','/:id/send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2549fa,_0x59681f){var _0x51331a=function(_0x4352e4){while(--_0x4352e4){_0x2549fa['push'](_0x2549fa['shift']());}};_0x51331a(++_0x59681f);}(_0xf9c4,0x162));var _0x4f9c=function(_0x5b68d0,_0x33bad5){_0x5b68d0=_0x5b68d0-0x0;var _0x1bf72a=_0xf9c4[_0x5b68d0];return _0x1bf72a;};'use strict';var multer=require(_0x4f9c('0x0'));var util=require(_0x4f9c('0x1'));var path=require(_0x4f9c('0x2'));var timeout=require(_0x4f9c('0x3'));var express=require(_0x4f9c('0x4'));var router=express['Router']();var fs_extra=require(_0x4f9c('0x5'));var auth=require(_0x4f9c('0x6'));var interaction=require(_0x4f9c('0x7'));var config=require('../../config/environment');var controller=require(_0x4f9c('0x8'));router[_0x4f9c('0x9')]('/',auth[_0x4f9c('0xa')](),controller[_0x4f9c('0xb')]);router['get'](_0x4f9c('0xc'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0xd')]);router[_0x4f9c('0x9')](_0x4f9c('0xe'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0xf')]);router['get'](_0x4f9c('0x10'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x11')]);router[_0x4f9c('0x9')]('/:id/canned_answers',auth[_0x4f9c('0xa')](),controller['getAnswers']);router[_0x4f9c('0x9')]('/:id/in_servers',auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x12')]);router['get']('/:id/out_servers',auth[_0x4f9c('0xa')](),controller['getSmtp']);router[_0x4f9c('0x9')](_0x4f9c('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x4f9c('0x14'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x15')]);router['get']('/:id/messages',auth[_0x4f9c('0xa')](),controller['getMessages']);router[_0x4f9c('0x9')]('/:id/verify',auth['isAuthenticated'](),controller[_0x4f9c('0x16')]);router[_0x4f9c('0x9')]('/:id/users',auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x17')]);router['post'](_0x4f9c('0x10'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x18')]);router[_0x4f9c('0x19')](_0x4f9c('0x1a'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x1b')]);router[_0x4f9c('0x19')]('/',auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x1c')]);router['post'](_0x4f9c('0x1d'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x1e')]);router['post']('/:id/out_servers',auth[_0x4f9c('0xa')](),controller['addSmtp']);router['post'](_0x4f9c('0x13'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x1f')]);router[_0x4f9c('0x19')](_0x4f9c('0x14'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x4f9c('0x20'),auth[_0x4f9c('0xa')](),controller['send']);router['post'](_0x4f9c('0x21'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x22')]);router[_0x4f9c('0x23')]('/:id',auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x24')]);router[_0x4f9c('0x25')]('/:id/dispositions',auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x26')]);router['delete'](_0x4f9c('0x1a'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x27')]);router[_0x4f9c('0x25')](_0x4f9c('0x1d'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x28')]);router[_0x4f9c('0x25')](_0x4f9c('0x29'),auth['isAuthenticated'](),controller[_0x4f9c('0x2a')]);router[_0x4f9c('0x25')]('/:id',auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x2b')]);router['delete'](_0x4f9c('0x21'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x2c')]);module[_0x4f9c('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 742594d..8626a92 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 _0xd847=['STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x2e3940,_0xde451f){var _0x4b5afc=function(_0x4dd340){while(--_0x4dd340){_0x2e3940['push'](_0x2e3940['shift']());}};_0x4b5afc(++_0xde451f);}(_0xd847,0x18a));var _0x7d84=function(_0x3485be,_0x5f3dd1){_0x3485be=_0x3485be-0x0;var _0x2ac6ae=_0xd847[_0x3485be];return _0x2ac6ae;};'use strict';var Sequelize=require(_0x7d84('0x0'));module[_0x7d84('0x1')]={'description':{'type':Sequelize[_0x7d84('0x2')]},'name':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7d84('0x4')]},'markAsUnread':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x7d84('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7d84('0x4')],'defaultValue':function(){return _0x7d84('0x6');}},'notificationSound':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7d84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7d84('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![],'comment':_0x7d84('0x8'),'set':function(_0x27aa7a){if(!_0x27aa7a)this[_0x7d84('0x9')](_0x7d84('0xa'),null);this[_0x7d84('0x9')](_0x7d84('0xb'),_0x27aa7a);}}}; \ No newline at end of file +var _0xff2a=['INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','BOOLEAN'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xff2a,0x93));var _0xaff2=function(_0x3cf5c7,_0x1eb319){_0x3cf5c7=_0x3cf5c7-0x0;var _0xf3d981=_0xff2a[_0x3cf5c7];return _0xf3d981;};'use strict';var Sequelize=require('sequelize');module[_0xaff2('0x0')]={'description':{'type':Sequelize[_0xaff2('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xaff2('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xaff2('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xaff2('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xaff2('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xaff2('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xaff2('0x3')](0x2)[_0xaff2('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xaff2('0x5')],'defaultValue':function(){return _0xaff2('0x6');}},'notificationSound':{'type':Sequelize[_0xaff2('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaff2('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaff2('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaff2('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaff2('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaff2('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaff2('0x3')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xaff2('0x7'),'set':function(_0x4447e1){if(!_0x4447e1)this[_0xaff2('0x8')](_0xaff2('0x9'),null);this[_0xaff2('0x8')]('mandatoryDisposition',_0x4447e1);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8c6eab7..4bdcbd2 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 _0xede3=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','params','fields','includeAll','find','body','describe','addDisposition','MailAccountId','getDispositions','findOne','removeDispositions','ids','create','getAnswers','CannedAnswer','order','removeAnswers','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','json','getApplications','MailMessage','$gte','format','inlineCss','true','split','CmList','List','Contacts','DESC','from','%s\x20<%s>','email','attachments','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xede3,0xc0));var _0x3ede=function(_0x130084,_0x5edce7){_0x130084=_0x130084-0x0;var _0x3f8362=_0xede3[_0x130084];return _0x3f8362;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ede('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ede('0x1'));var rp=require(_0x3ede('0x2'));var moment=require(_0x3ede('0x3'));var BPromise=require(_0x3ede('0x4'));var Mustache=require(_0x3ede('0x5'));var util=require(_0x3ede('0x6'));var path=require(_0x3ede('0x7'));var sox=require(_0x3ede('0x8'));var csv=require(_0x3ede('0x9'));var ejs=require(_0x3ede('0xa'));var fs=require('fs');var fs_extra=require(_0x3ede('0xb'));var _=require(_0x3ede('0xc'));var squel=require(_0x3ede('0xd'));var crypto=require(_0x3ede('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3ede('0xf'));var toCsv=require(_0x3ede('0x9'));var querystring=require(_0x3ede('0x10'));var Papa=require('papaparse');var htmlToText=require(_0x3ede('0x11'));var juice=require(_0x3ede('0x12'));var Redis=require(_0x3ede('0x13'));var authService=require(_0x3ede('0x14'));var qs=require(_0x3ede('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ede('0x16'));var logger=require(_0x3ede('0x17'))(_0x3ede('0x18'));var utils=require(_0x3ede('0x19'));var config=require(_0x3ede('0x1a'));var licenseUtil=require(_0x3ede('0x1b'));var db=require(_0x3ede('0x1c'))['db'];config[_0x3ede('0x1d')]=_[_0x3ede('0x1e')](config[_0x3ede('0x1d')],{'host':_0x3ede('0x1f'),'port':0x18eb});var socket=require(_0x3ede('0x20'))(new Redis(config[_0x3ede('0x1d')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x3ede('0x21'));var client=jayson['client'][_0x3ede('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x59c338,_0x54ae57,_0x18e11c,_0x3563f7){return new BPromise(function(_0xb774be,_0x57ac4f){var _0x3a55b7=_0x3563f7||client;return _0x3a55b7['request'](_0x59c338,_0x18e11c)['then'](function(_0x390421){logger[_0x3ede('0x23')](_0x3ede('0x24'),_0x54ae57,'request\x20sent');logger[_0x3ede('0x25')](_0x3ede('0x26'),_0x54ae57,_0x3ede('0x27'),JSON['stringify'](_0x390421));if(_0x390421['error']){if(_0x390421[_0x3ede('0x28')]['code']===0x1f4){logger[_0x3ede('0x28')]('MailAccount,\x20%s,\x20%s',_0x54ae57,_0x390421[_0x3ede('0x28')][_0x3ede('0x29')]);return _0x57ac4f(_0x390421[_0x3ede('0x28')][_0x3ede('0x29')]);}logger[_0x3ede('0x28')](_0x3ede('0x24'),_0x54ae57,_0x390421['error'][_0x3ede('0x29')]);return _0xb774be(_0x390421[_0x3ede('0x28')][_0x3ede('0x29')]);}else{logger[_0x3ede('0x23')](_0x3ede('0x24'),_0x54ae57,_0x3ede('0x27'));_0xb774be(_0x390421[_0x3ede('0x2a')][_0x3ede('0x29')]);}})[_0x3ede('0x2b')](function(_0x1224b5){logger['error']('MailAccount,\x20%s,\x20%s',_0x54ae57,_0x1224b5);_0x57ac4f(_0x1224b5);});});}function respondWithStatusCode(_0x3765fe,_0x40f4ad){_0x40f4ad=_0x40f4ad||0xcc;return function(_0x248e17){if(_0x248e17){return _0x3765fe[_0x3ede('0x2c')](_0x40f4ad);}return _0x3765fe[_0x3ede('0x2d')](_0x40f4ad)[_0x3ede('0x2e')]();};}function respondWithResult(_0x5299a0,_0x2ee27d){_0x2ee27d=_0x2ee27d||0xc8;return function(_0x296f74){if(_0x296f74){return _0x5299a0[_0x3ede('0x2d')](_0x2ee27d)['json'](_0x296f74);}};}function respondWithFilteredResult(_0x26f04e,_0x8daee8){return function(_0x449e94){if(_0x449e94){var _0x57cf8a=typeof _0x8daee8[_0x3ede('0x2f')]==='undefined'&&typeof _0x8daee8[_0x3ede('0x30')]===_0x3ede('0x31');var _0x5930f4=_0x449e94['count'];var _0x319fd4=_0x57cf8a?0x0:_0x8daee8[_0x3ede('0x2f')];var _0x3f8f6c=_0x57cf8a?_0x449e94[_0x3ede('0x32')]:_0x8daee8[_0x3ede('0x2f')]+_0x8daee8[_0x3ede('0x30')];var _0x41c790;if(_0x3f8f6c>=_0x5930f4){_0x3f8f6c=_0x5930f4;_0x41c790=0xc8;}else{_0x41c790=0xce;}_0x26f04e[_0x3ede('0x2d')](_0x41c790);return _0x26f04e[_0x3ede('0x33')](_0x3ede('0x34'),_0x319fd4+'-'+_0x3f8f6c+'/'+_0x5930f4)['json'](_0x449e94);}return null;};}function patchUpdates(_0x27bb8a){return function(_0x8a0ebc){try{jsonpatch['apply'](_0x8a0ebc,_0x27bb8a,!![]);}catch(_0x232b90){return BPromise[_0x3ede('0x35')](_0x232b90);}return _0x8a0ebc[_0x3ede('0x36')]();};}function saveUpdates(_0x4da83d,_0x166766){return function(_0x505c5e){if(_0x505c5e){return _0x505c5e[_0x3ede('0x37')](_0x4da83d)[_0x3ede('0x38')](function(_0x40696a){return _0x40696a;});}return null;};}function removeEntity(_0x558576,_0x518543){return function(_0x109f8a){if(_0x109f8a){return _0x109f8a[_0x3ede('0x39')]()[_0x3ede('0x38')](function(){var _0x36a636=_0x109f8a[_0x3ede('0x3a')]({'plain':!![]});var _0x5d8a03=_0x3ede('0x3b');return db[_0x3ede('0x3c')][_0x3ede('0x39')]({'where':{'type':_0x5d8a03,'resourceId':_0x36a636['id']}})[_0x3ede('0x38')](function(){return _0x109f8a;});})['then'](function(){_0x558576[_0x3ede('0x2d')](0xcc)[_0x3ede('0x2e')]();});}};}function handleEntityNotFound(_0x294379,_0x58b507){return function(_0x52e77b){if(!_0x52e77b){_0x294379[_0x3ede('0x2c')](0x194);}return _0x52e77b;};}function handleError(_0x142c3d,_0x1b3836){_0x1b3836=_0x1b3836||0x1f4;return function(_0x41e543){logger[_0x3ede('0x28')](_0x41e543[_0x3ede('0x3d')]);if(_0x41e543[_0x3ede('0x3e')]){delete _0x41e543['name'];}_0x142c3d[_0x3ede('0x2d')](_0x1b3836)[_0x3ede('0x3f')](_0x41e543);};}exports[_0x3ede('0x40')]=function(_0x5468f5,_0x588ea8){var _0x5f0b05={'include':[{'model':db[_0x3ede('0x41')],'as':_0x3ede('0x42')},{'model':db[_0x3ede('0x43')],'as':_0x3ede('0x44')},{'model':db[_0x3ede('0x45')],'as':_0x3ede('0x46')}]},_0x86cb4e={},_0xd7fe44={'count':0x0,'rows':[]};var _0x4538d0=_['map'](db[_0x3ede('0x47')][_0x3ede('0x48')],function(_0x112f80){return{'name':_0x112f80['fieldName'],'type':_0x112f80[_0x3ede('0x49')][_0x3ede('0x4a')]};});_0x86cb4e[_0x3ede('0x4b')]=_[_0x3ede('0x4c')](_0x4538d0,'name');_0x86cb4e['query']=_[_0x3ede('0x4d')](_0x5468f5[_0x3ede('0x4e')]);_0x86cb4e[_0x3ede('0x4f')]=_[_0x3ede('0x50')](_0x86cb4e['model'],_0x86cb4e[_0x3ede('0x4e')]);_0x5f0b05[_0x3ede('0x51')]=_['intersection'](_0x86cb4e['model'],qs['fields'](_0x5468f5[_0x3ede('0x4e')]['fields']));_0x5f0b05['attributes']=_0x5f0b05['attributes'][_0x3ede('0x52')]?_0x5f0b05[_0x3ede('0x51')]:_0x86cb4e[_0x3ede('0x4b')];if(!_0x5468f5[_0x3ede('0x4e')][_0x3ede('0x53')](_0x3ede('0x54'))){_0x5f0b05['limit']=qs[_0x3ede('0x30')](_0x5468f5['query']['limit']);_0x5f0b05[_0x3ede('0x2f')]=qs[_0x3ede('0x2f')](_0x5468f5[_0x3ede('0x4e')]['offset']);}_0x5f0b05['order']=qs[_0x3ede('0x55')](_0x5468f5[_0x3ede('0x4e')][_0x3ede('0x55')]);_0x5f0b05['where']=qs[_0x3ede('0x4f')](_[_0x3ede('0x56')](_0x5468f5[_0x3ede('0x4e')],_0x86cb4e[_0x3ede('0x4f')]),_0x4538d0);if(_0x5468f5[_0x3ede('0x4e')][_0x3ede('0x57')]){_0x5f0b05[_0x3ede('0x58')]=_['merge'](_0x5f0b05['where'],{'$or':_['map'](_0x4538d0,function(_0x5333e0){if(_0x5333e0['type']!==_0x3ede('0x59')){var _0x44ba2a={};_0x44ba2a[_0x5333e0[_0x3ede('0x3e')]]={'$like':'%'+_0x5468f5[_0x3ede('0x4e')][_0x3ede('0x57')]+'%'};return _0x44ba2a;}})});}_0x5f0b05=_[_0x3ede('0x5a')]({},_0x5f0b05,_0x5468f5[_0x3ede('0x5b')]);var _0x56a994={'where':_0x5f0b05['where']};return db[_0x3ede('0x47')][_0x3ede('0x32')](_0x56a994)[_0x3ede('0x38')](function(_0x351b08){_0xd7fe44[_0x3ede('0x32')]=_0x351b08;if(_0x5468f5[_0x3ede('0x4e')]['includeAll']){_0x5f0b05[_0x3ede('0x5c')]=[{'all':!![]}];}return db[_0x3ede('0x47')][_0x3ede('0x5d')](_0x5f0b05);})[_0x3ede('0x38')](function(_0x3c7ab9){_0xd7fe44[_0x3ede('0x5e')]=_0x3c7ab9;return _0xd7fe44;})[_0x3ede('0x38')](respondWithFilteredResult(_0x588ea8,_0x5f0b05))[_0x3ede('0x2b')](handleError(_0x588ea8,null));};exports['show']=function(_0x5ece5d,_0x573449){var _0x284680={'raw':![],'where':{'id':_0x5ece5d[_0x3ede('0x5f')]['id']},'include':[{'model':db[_0x3ede('0x41')],'as':'Imap'},{'model':db[_0x3ede('0x43')],'as':_0x3ede('0x44')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x6bdbee={};_0x6bdbee[_0x3ede('0x4b')]=_['keys'](db['MailAccount'][_0x3ede('0x48')]);_0x6bdbee[_0x3ede('0x4e')]=_[_0x3ede('0x4d')](_0x5ece5d['query']);_0x6bdbee[_0x3ede('0x4f')]=_['intersection'](_0x6bdbee['model'],_0x6bdbee[_0x3ede('0x4e')]);_0x284680[_0x3ede('0x51')]=_[_0x3ede('0x50')](_0x6bdbee['model'],qs['fields'](_0x5ece5d['query'][_0x3ede('0x60')]));_0x284680[_0x3ede('0x51')]=_0x284680[_0x3ede('0x51')]['length']?_0x284680['attributes']:_0x6bdbee['model'];if(_0x5ece5d[_0x3ede('0x4e')][_0x3ede('0x61')]){_0x284680[_0x3ede('0x5c')]=[{'all':!![]}];}_0x284680=_[_0x3ede('0x5a')]({},_0x284680,_0x5ece5d['options']);return db[_0x3ede('0x47')][_0x3ede('0x62')](_0x284680)[_0x3ede('0x38')](handleEntityNotFound(_0x573449,null))[_0x3ede('0x38')](respondWithResult(_0x573449,null))[_0x3ede('0x2b')](handleError(_0x573449,null));};exports['update']=function(_0x51711c,_0x52f78c){if(_0x51711c[_0x3ede('0x63')]['id']){delete _0x51711c['body']['id'];}return db['MailAccount'][_0x3ede('0x62')]({'where':{'id':_0x51711c[_0x3ede('0x5f')]['id']},'include':[{'model':db[_0x3ede('0x41')],'as':_0x3ede('0x42')},{'model':db[_0x3ede('0x43')],'as':_0x3ede('0x44')},{'model':db['Pause'],'as':_0x3ede('0x46')}]})[_0x3ede('0x38')](handleEntityNotFound(_0x52f78c,null))[_0x3ede('0x38')](saveUpdates(_0x51711c['body'],null))[_0x3ede('0x38')](function(_0x4b6e51){if(_0x4b6e51&&_0x51711c['body'][_0x3ede('0x42')]){return db[_0x3ede('0x41')][_0x3ede('0x37')](_0x51711c[_0x3ede('0x63')][_0x3ede('0x42')],{'where':{'MailAccountId':_0x4b6e51['id']}})['then'](function(){return _0x4b6e51;});}return _0x4b6e51;})[_0x3ede('0x38')](function(_0x165410){if(_0x165410&&_0x51711c[_0x3ede('0x63')]['Smtp']){return db['MailServerOut']['update'](_0x51711c[_0x3ede('0x63')][_0x3ede('0x44')],{'where':{'MailAccountId':_0x165410['id']}})['then'](function(){return _0x165410;});}return _0x165410;})[_0x3ede('0x38')](respondWithResult(_0x52f78c,null))[_0x3ede('0x2b')](handleError(_0x52f78c,null));};exports[_0x3ede('0x64')]=function(_0x48a2e7,_0x54eed5){return db[_0x3ede('0x47')][_0x3ede('0x64')]()[_0x3ede('0x38')](respondWithResult(_0x54eed5,null))[_0x3ede('0x2b')](handleError(_0x54eed5,null));};exports[_0x3ede('0x65')]=function(_0x358327,_0x28c19e,_0x1748d4){if(_0x358327[_0x3ede('0x63')]['id']){delete _0x358327[_0x3ede('0x63')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x358327[_0x3ede('0x5f')]['id']}})['then'](handleEntityNotFound(_0x28c19e,null))[_0x3ede('0x38')](function(_0x25755a){if(_0x25755a){_0x358327[_0x3ede('0x63')][_0x3ede('0x66')]=_0x25755a['id'];return db['Disposition']['create'](_0x358327[_0x3ede('0x63')]);}})[_0x3ede('0x38')](respondWithResult(_0x28c19e,null))['catch'](handleError(_0x28c19e,null));};exports[_0x3ede('0x67')]=function(_0x10f02,_0x46f7d5,_0x1f3711){var _0x59beb4={'raw':![],'where':{}};var _0x20689f={};var _0x483860={'count':0x0,'rows':[]};return db[_0x3ede('0x47')][_0x3ede('0x68')]({'where':{'id':_0x10f02['params']['id']}})['then'](handleEntityNotFound(_0x46f7d5,null))[_0x3ede('0x38')](function(_0x39205f){if(_0x39205f){_0x20689f[_0x3ede('0x4b')]=_[_0x3ede('0x4d')](db['Disposition'][_0x3ede('0x48')]);_0x20689f['query']=_['keys'](_0x10f02['query']);_0x20689f['filters']=_[_0x3ede('0x50')](_0x20689f[_0x3ede('0x4b')],_0x20689f[_0x3ede('0x4e')]);_0x59beb4[_0x3ede('0x51')]=_['intersection'](_0x20689f[_0x3ede('0x4b')],qs[_0x3ede('0x60')](_0x10f02[_0x3ede('0x4e')][_0x3ede('0x60')]));_0x59beb4[_0x3ede('0x51')]=_0x59beb4[_0x3ede('0x51')][_0x3ede('0x52')]?_0x59beb4[_0x3ede('0x51')]:_0x20689f[_0x3ede('0x4b')];if(!_0x10f02[_0x3ede('0x4e')][_0x3ede('0x53')](_0x3ede('0x54'))){_0x59beb4[_0x3ede('0x30')]=qs[_0x3ede('0x30')](_0x10f02['query']['limit']);_0x59beb4['offset']=qs['offset'](_0x10f02[_0x3ede('0x4e')]['offset']);}_0x59beb4['order']=qs[_0x3ede('0x55')](_0x10f02[_0x3ede('0x4e')][_0x3ede('0x55')]);_0x59beb4['where']=qs[_0x3ede('0x4f')](_[_0x3ede('0x56')](_0x10f02[_0x3ede('0x4e')],_0x20689f[_0x3ede('0x4f')]));_0x59beb4[_0x3ede('0x58')][_0x3ede('0x66')]=_0x39205f['id'];if(_0x10f02[_0x3ede('0x4e')]['filter']){_0x59beb4['where']=_[_0x3ede('0x5a')](_0x59beb4[_0x3ede('0x58')],{'$or':_[_0x3ede('0x4c')](_0x59beb4['attributes'],function(_0x2eba06){var _0xf1748c={};_0xf1748c[_0x2eba06]={'$like':'%'+_0x10f02[_0x3ede('0x4e')][_0x3ede('0x57')]+'%'};return _0xf1748c;})});}_0x59beb4=_['merge']({},_0x59beb4,_0x10f02[_0x3ede('0x5b')]);return db['Disposition']['count']({'where':_0x59beb4[_0x3ede('0x58')]})['then'](function(_0x1996d9){_0x483860[_0x3ede('0x32')]=_0x1996d9;if(_0x10f02['query'][_0x3ede('0x61')]){_0x59beb4[_0x3ede('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x3ede('0x5d')](_0x59beb4);})[_0x3ede('0x38')](function(_0x55b978){_0x483860[_0x3ede('0x5e')]=_0x55b978;return _0x483860;});}})['then'](respondWithFilteredResult(_0x46f7d5,_0x59beb4))['catch'](handleError(_0x46f7d5,null));};exports[_0x3ede('0x69')]=function(_0x1475d9,_0x7bf6e4,_0x3a66da){return db[_0x3ede('0x47')][_0x3ede('0x62')]({'where':{'id':_0x1475d9[_0x3ede('0x5f')]['id']}})['then'](handleEntityNotFound(_0x7bf6e4,null))['then'](function(_0x236d26){if(_0x236d26){return _0x236d26['removeDispositions'](_0x1475d9[_0x3ede('0x4e')][_0x3ede('0x6a')]);}})['then'](respondWithStatusCode(_0x7bf6e4,null))['catch'](handleError(_0x7bf6e4,null));};exports['addAnswer']=function(_0x22309d,_0x42110d,_0x158b95){if(_0x22309d[_0x3ede('0x63')]['id']){delete _0x22309d[_0x3ede('0x63')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x22309d[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x42110d,null))[_0x3ede('0x38')](function(_0x4b6fb2){if(_0x4b6fb2){_0x22309d[_0x3ede('0x63')][_0x3ede('0x66')]=_0x4b6fb2['id'];return db['CannedAnswer'][_0x3ede('0x6b')](_0x22309d[_0x3ede('0x63')]);}})[_0x3ede('0x38')](respondWithResult(_0x42110d,null))['catch'](handleError(_0x42110d,null));};exports[_0x3ede('0x6c')]=function(_0xa72aa4,_0x24d2b4,_0x4b831b){var _0x4b00e1={'raw':![],'where':{}};var _0x539ba9={};var _0x21954a={'count':0x0,'rows':[]};return db[_0x3ede('0x47')][_0x3ede('0x68')]({'where':{'id':_0xa72aa4[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x24d2b4,null))[_0x3ede('0x38')](function(_0x245fdc){if(_0x245fdc){_0x539ba9['model']=_[_0x3ede('0x4d')](db[_0x3ede('0x6d')][_0x3ede('0x48')]);_0x539ba9[_0x3ede('0x4e')]=_[_0x3ede('0x4d')](_0xa72aa4[_0x3ede('0x4e')]);_0x539ba9[_0x3ede('0x4f')]=_[_0x3ede('0x50')](_0x539ba9['model'],_0x539ba9[_0x3ede('0x4e')]);_0x4b00e1[_0x3ede('0x51')]=_[_0x3ede('0x50')](_0x539ba9[_0x3ede('0x4b')],qs[_0x3ede('0x60')](_0xa72aa4[_0x3ede('0x4e')][_0x3ede('0x60')]));_0x4b00e1[_0x3ede('0x51')]=_0x4b00e1[_0x3ede('0x51')][_0x3ede('0x52')]?_0x4b00e1['attributes']:_0x539ba9[_0x3ede('0x4b')];if(!_0xa72aa4[_0x3ede('0x4e')][_0x3ede('0x53')](_0x3ede('0x54'))){_0x4b00e1[_0x3ede('0x30')]=qs[_0x3ede('0x30')](_0xa72aa4[_0x3ede('0x4e')][_0x3ede('0x30')]);_0x4b00e1[_0x3ede('0x2f')]=qs[_0x3ede('0x2f')](_0xa72aa4[_0x3ede('0x4e')][_0x3ede('0x2f')]);}_0x4b00e1[_0x3ede('0x6e')]=qs[_0x3ede('0x55')](_0xa72aa4[_0x3ede('0x4e')][_0x3ede('0x55')]);_0x4b00e1[_0x3ede('0x58')]=qs[_0x3ede('0x4f')](_[_0x3ede('0x56')](_0xa72aa4[_0x3ede('0x4e')],_0x539ba9[_0x3ede('0x4f')]));_0x4b00e1[_0x3ede('0x58')][_0x3ede('0x66')]=_0x245fdc['id'];if(_0xa72aa4['query'][_0x3ede('0x57')]){_0x4b00e1[_0x3ede('0x58')]=_[_0x3ede('0x5a')](_0x4b00e1[_0x3ede('0x58')],{'$or':_[_0x3ede('0x4c')](_0x4b00e1[_0x3ede('0x51')],function(_0x2a0baf){var _0x2d31e8={};_0x2d31e8[_0x2a0baf]={'$like':'%'+_0xa72aa4[_0x3ede('0x4e')][_0x3ede('0x57')]+'%'};return _0x2d31e8;})});}_0x4b00e1=_[_0x3ede('0x5a')]({},_0x4b00e1,_0xa72aa4[_0x3ede('0x5b')]);return db[_0x3ede('0x6d')][_0x3ede('0x32')]({'where':_0x4b00e1[_0x3ede('0x58')]})[_0x3ede('0x38')](function(_0x43af1f){_0x21954a[_0x3ede('0x32')]=_0x43af1f;if(_0xa72aa4[_0x3ede('0x4e')][_0x3ede('0x61')]){_0x4b00e1[_0x3ede('0x5c')]=[{'all':!![]}];}return db[_0x3ede('0x6d')][_0x3ede('0x5d')](_0x4b00e1);})[_0x3ede('0x38')](function(_0x3feff2){_0x21954a['rows']=_0x3feff2;return _0x21954a;});}})[_0x3ede('0x38')](respondWithFilteredResult(_0x24d2b4,_0x4b00e1))['catch'](handleError(_0x24d2b4,null));};exports[_0x3ede('0x6f')]=function(_0x3adf74,_0x4e7267,_0xca2067){return db[_0x3ede('0x47')]['find']({'where':{'id':_0x3adf74['params']['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x4e7267,null))[_0x3ede('0x38')](function(_0x5cca08){if(_0x5cca08){return _0x5cca08[_0x3ede('0x6f')](_0x3adf74[_0x3ede('0x4e')][_0x3ede('0x6a')]);}})[_0x3ede('0x38')](respondWithStatusCode(_0x4e7267,null))[_0x3ede('0x2b')](handleError(_0x4e7267,null));};exports[_0x3ede('0x6b')]=function(_0xbe063b,_0x18e3c5){var _0x2d52d2={'name':_0xbe063b['body'][_0x3ede('0x3e')],'key':_0xbe063b[_0x3ede('0x63')][_0x3ede('0x4a')],'email':_0xbe063b[_0x3ede('0x63')]['email'],'ListId':_0xbe063b[_0x3ede('0x63')]['ListId'],'active':!_[_0x3ede('0x70')](_0xbe063b[_0x3ede('0x63')][_0x3ede('0x71')])?_0xbe063b[_0x3ede('0x63')][_0x3ede('0x71')]:!![],'description':_0xbe063b[_0x3ede('0x63')][_0x3ede('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x3ede('0x70')](_0xbe063b['body'][_0x3ede('0x73')])){if(_0xbe063b['body'][_0x3ede('0x74')]){_0x2d52d2[_0x3ede('0x42')][_0x3ede('0x75')]=_0x2d52d2[_0x3ede('0x44')]['user']=_0xbe063b[_0x3ede('0x63')][_0x3ede('0x76')];_0x2d52d2['Imap'][_0x3ede('0x77')]=_0x2d52d2['Smtp'][_0x3ede('0x78')]=_0xbe063b['body'][_0x3ede('0x79')];}else{_0x2d52d2[_0x3ede('0x42')][_0x3ede('0x7a')]=_0x2d52d2[_0x3ede('0x44')][_0x3ede('0x7a')]=![];}_0x2d52d2['Imap']['host']=_0xbe063b['body'][_0x3ede('0x42')][_0x3ede('0x7b')];_0x2d52d2[_0x3ede('0x42')][_0x3ede('0x7c')]=_0xbe063b[_0x3ede('0x63')][_0x3ede('0x42')][_0x3ede('0x7c')];_0x2d52d2[_0x3ede('0x44')][_0x3ede('0x7b')]=_0xbe063b[_0x3ede('0x63')][_0x3ede('0x44')][_0x3ede('0x7b')];_0x2d52d2[_0x3ede('0x44')][_0x3ede('0x7c')]=_0xbe063b['body'][_0x3ede('0x44')][_0x3ede('0x7c')];}else{_0x2d52d2[_0x3ede('0x42')][_0x3ede('0x7d')]=_0x2d52d2[_0x3ede('0x44')][_0x3ede('0x7d')]=_0xbe063b[_0x3ede('0x63')][_0x3ede('0x73')];_0x2d52d2[_0x3ede('0x42')][_0x3ede('0x75')]=_0x2d52d2['Smtp'][_0x3ede('0x75')]=_0xbe063b[_0x3ede('0x63')][_0x3ede('0x76')];_0x2d52d2[_0x3ede('0x42')][_0x3ede('0x77')]=_0x2d52d2['Smtp'][_0x3ede('0x78')]=_0xbe063b[_0x3ede('0x63')][_0x3ede('0x79')];}return db[_0x3ede('0x47')][_0x3ede('0x6b')](_0x2d52d2,{'include':[{'model':db[_0x3ede('0x43')],'as':_0x3ede('0x44')},{'model':db[_0x3ede('0x41')],'as':_0x3ede('0x42')}]})[_0x3ede('0x38')](function(_0x561175){var _0x579af7=_0xbe063b[_0x3ede('0x75')][_0x3ede('0x3a')]({'plain':!![]});if(!_0x579af7)throw new Error(_0x3ede('0x7e'));if(_0x579af7['role']===_0x3ede('0x75')){var _0xba0b4a=_0x561175[_0x3ede('0x3a')]({'plain':!![]});return db[_0x3ede('0x7f')]['find']({'where':{'name':_0x3ede('0x3b'),'userProfileId':_0x579af7[_0x3ede('0x80')]},'raw':!![]})['then'](function(_0x21b587){if(_0x21b587&&_0x21b587[_0x3ede('0x81')]===0x0){return db[_0x3ede('0x3c')][_0x3ede('0x6b')]({'name':_0xba0b4a[_0x3ede('0x3e')],'resourceId':_0xba0b4a['id'],'type':_0x21b587[_0x3ede('0x3e')],'sectionId':_0x21b587['id']},{})[_0x3ede('0x38')](function(){return _0x561175;});}else{return _0x561175;}})[_0x3ede('0x2b')](function(_0x52d505){logger[_0x3ede('0x28')](_0x3ede('0x82'),_0x52d505);throw _0x52d505;});}return _0x561175;})[_0x3ede('0x38')](respondWithResult(_0x18e3c5,0xc9))[_0x3ede('0x2b')](handleError(_0x18e3c5,null));};exports[_0x3ede('0x83')]=function(_0x3da3bb,_0x396b19,_0x43ef30){return db[_0x3ede('0x47')][_0x3ede('0x68')]({'where':{'id':_0x3da3bb[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x396b19,null))[_0x3ede('0x38')](function(_0x1c9f03){if(_0x1c9f03){return _0x1c9f03[_0x3ede('0x83')]();}return null;})['then'](respondWithResult(_0x396b19,null))[_0x3ede('0x2b')](handleError(_0x396b19,null));};exports[_0x3ede('0x84')]=function(_0x46e27c,_0x127028,_0x302ecf){if(_0x46e27c['body']['id']){delete _0x46e27c[_0x3ede('0x63')]['id'];}return db[_0x3ede('0x47')][_0x3ede('0x62')]({'where':{'id':_0x46e27c[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x127028,null))[_0x3ede('0x38')](function(_0x43f291){if(_0x43f291){_0x46e27c['body'][_0x3ede('0x66')]=_0x43f291['id'];return db[_0x3ede('0x41')][_0x3ede('0x6b')](_0x46e27c[_0x3ede('0x63')]);}})['then'](respondWithResult(_0x127028,null))[_0x3ede('0x2b')](handleError(_0x127028,null));};exports[_0x3ede('0x85')]=function(_0x24739a,_0x388fe1,_0x11b4cc){return db['MailAccount'][_0x3ede('0x68')]({'where':{'id':_0x24739a['params']['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x388fe1,null))[_0x3ede('0x38')](function(_0x36b9f6){if(_0x36b9f6){return _0x36b9f6['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x388fe1,null))['catch'](handleError(_0x388fe1,null));};exports[_0x3ede('0x86')]=function(_0x10b779,_0x22b7bc,_0x220d41){return db[_0x3ede('0x47')][_0x3ede('0x68')]({'where':{'id':_0x10b779['params']['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x22b7bc,null))['then'](function(_0x748a15){if(_0x748a15){return _0x748a15['getSmtp']();}return null;})[_0x3ede('0x38')](respondWithResult(_0x22b7bc,null))[_0x3ede('0x2b')](handleError(_0x22b7bc,null));};exports[_0x3ede('0x87')]=function(_0x254f5a,_0x1d716d,_0x55f013){if(_0x254f5a['body']['id']){delete _0x254f5a[_0x3ede('0x63')]['id'];}return db['MailAccount'][_0x3ede('0x62')]({'where':{'id':_0x254f5a[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x1d716d,null))[_0x3ede('0x38')](function(_0x2da3b9){if(_0x2da3b9){_0x254f5a['body'][_0x3ede('0x66')]=_0x2da3b9['id'];return db[_0x3ede('0x43')]['create'](_0x254f5a[_0x3ede('0x63')]);}})[_0x3ede('0x38')](respondWithResult(_0x1d716d,null))['catch'](handleError(_0x1d716d,null));};exports[_0x3ede('0x88')]=function(_0x2beea2,_0x36c993,_0x2cac72){return db[_0x3ede('0x47')][_0x3ede('0x68')]({'where':{'id':_0x2beea2[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x36c993,null))[_0x3ede('0x38')](function(_0x1e1463){if(_0x1e1463){return _0x1e1463[_0x3ede('0x89')](null);}return null;})[_0x3ede('0x38')](respondWithStatusCode(_0x36c993,null))[_0x3ede('0x2b')](handleError(_0x36c993,null));};exports[_0x3ede('0x8a')]=function(_0x363143,_0x521bba,_0x550871){return db[_0x3ede('0x8b')][_0x3ede('0x62')]({'where':{'id':_0x363143[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x521bba,null))[_0x3ede('0x38')](function(_0x708860){if(_0x708860){return _0x708860[_0x3ede('0x8a')](_0x363143[_0x3ede('0x63')][_0x3ede('0x6a')],_[_0x3ede('0x8c')](_0x363143['body'],['ids','id'])||{});}})[_0x3ede('0x38')](respondWithResult(_0x521bba,null))[_0x3ede('0x2b')](handleError(_0x521bba,null));};exports['getInteractions']=function(_0xb62917,_0x45a21d,_0x1f0d0a){var _0x269842={'raw':![],'where':{}};var _0x3f2764={};var _0x1f6108={'count':0x0,'rows':[]};return db['MailAccount'][_0x3ede('0x68')]({'where':{'id':_0xb62917[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x45a21d,null))[_0x3ede('0x38')](function(_0x40e221){if(_0x40e221){_0x3f2764['model']=_['keys'](db['MailInteraction'][_0x3ede('0x48')]);_0x3f2764[_0x3ede('0x4e')]=_[_0x3ede('0x4d')](_0xb62917[_0x3ede('0x4e')]);_0x3f2764['filters']=_[_0x3ede('0x50')](_0x3f2764[_0x3ede('0x4b')],_0x3f2764[_0x3ede('0x4e')]);_0x269842[_0x3ede('0x51')]=_[_0x3ede('0x50')](_0x3f2764[_0x3ede('0x4b')],qs[_0x3ede('0x60')](_0xb62917[_0x3ede('0x4e')][_0x3ede('0x60')]));_0x269842[_0x3ede('0x51')]=_0x269842[_0x3ede('0x51')]['length']?_0x269842[_0x3ede('0x51')]:_0x3f2764[_0x3ede('0x4b')];if(!_0xb62917[_0x3ede('0x4e')][_0x3ede('0x53')]('nolimit')){_0x269842[_0x3ede('0x30')]=qs['limit'](_0xb62917['query'][_0x3ede('0x30')]);_0x269842[_0x3ede('0x2f')]=qs['offset'](_0xb62917[_0x3ede('0x4e')][_0x3ede('0x2f')]);}_0x269842[_0x3ede('0x6e')]=qs[_0x3ede('0x55')](_0xb62917['query'][_0x3ede('0x55')]);_0x269842[_0x3ede('0x58')]=qs[_0x3ede('0x4f')](_[_0x3ede('0x56')](_0xb62917[_0x3ede('0x4e')],_0x3f2764[_0x3ede('0x4f')]));_0x269842[_0x3ede('0x58')]['MailAccountId']=_0x40e221['id'];if(_0xb62917['query'][_0x3ede('0x57')]){_0x269842[_0x3ede('0x58')]=_[_0x3ede('0x5a')](_0x269842[_0x3ede('0x58')],{'$or':_['map'](_0x269842[_0x3ede('0x51')],function(_0xaeef22){var _0x4eb5d8={};_0x4eb5d8[_0xaeef22]={'$like':'%'+_0xb62917['query'][_0x3ede('0x57')]+'%'};return _0x4eb5d8;})});}_0x269842=_[_0x3ede('0x5a')]({},_0x269842,_0xb62917[_0x3ede('0x5b')]);return db[_0x3ede('0x8b')]['count']({'where':_0x269842[_0x3ede('0x58')]})[_0x3ede('0x38')](function(_0x1d3df7){_0x1f6108[_0x3ede('0x32')]=_0x1d3df7;if(_0xb62917[_0x3ede('0x4e')][_0x3ede('0x61')]){_0x269842[_0x3ede('0x5c')]=[{'model':db[_0x3ede('0x8d')],'as':_0x3ede('0x8e'),'required':![]},{'model':db[_0x3ede('0x8f')],'as':_0x3ede('0x90'),'attributes':['name',_0x3ede('0x91'),_0x3ede('0x92')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x3ede('0x3e'),'color'],'where':_0xb62917['query'][_0x3ede('0x93')]?{'id':_0xb62917[_0x3ede('0x4e')][_0x3ede('0x93')]}:undefined,'required':_0xb62917[_0x3ede('0x4e')][_0x3ede('0x93')]?!![]:![]}];}return db[_0x3ede('0x8b')]['findAll'](_0x269842);})['then'](function(_0x101435){_0x1f6108[_0x3ede('0x5e')]=_0x101435;return _0x1f6108;});}})[_0x3ede('0x38')](respondWithFilteredResult(_0x45a21d,_0x269842))[_0x3ede('0x2b')](handleError(_0x45a21d,null));};exports[_0x3ede('0x94')]=function addApplications(_0x3702bb,_0x5be692){var _0x110d51=_0x3702bb[_0x3ede('0x5f')]['id'];var _0x37a86c=_0x3702bb[_0x3ede('0x63')];var _0x5733e8=0xc8;var _0x15e2f6=null;return db[_0x3ede('0x95')]['transaction']({'isolationLevel':db['sequelize'][_0x3ede('0x96')][_0x3ede('0x97')][_0x3ede('0x98')]},function(_0x1c816f){return db[_0x3ede('0x47')]['findOne']({'where':{'id':_0x110d51},'transaction':_0x1c816f})[_0x3ede('0x38')](function(_0x3ae143){if(_0x3ae143){return db[_0x3ede('0x99')][_0x3ede('0x39')]({'where':{'MailAccountId':_0x110d51},'transaction':_0x1c816f})['then'](function(){var _0xd937f3=_[_0x3ede('0x4c')](_0x37a86c,function(_0x102e0e){_0x102e0e[_0x3ede('0x66')]=_0x110d51;return _0x102e0e;});return db[_0x3ede('0x99')][_0x3ede('0x9a')](_0xd937f3,{'transaction':_0x1c816f});});}else{_0x5733e8=0x194;_0x15e2f6=[];}});})[_0x3ede('0x38')](function(){if(_0x5733e8!==0x194){return db[_0x3ede('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0x110d51},'order':_0x3ede('0x9b')})[_0x3ede('0x38')](function(_0x10a4e4){_0x15e2f6=_0x10a4e4;});}})['catch'](function(_0x4e5cb5){_0x5733e8=0x1f4;logger['error'](_0x4e5cb5[_0x3ede('0x3d')]);if(_0x4e5cb5[_0x3ede('0x3e')]){delete _0x4e5cb5['name'];}_0x15e2f6=_0x4e5cb5;})[_0x3ede('0x9c')](function(){if(_0x15e2f6===null){_0x5be692[_0x3ede('0x2c')](_0x5733e8);}else{if(_0x5733e8===0x1f4){_0x5be692[_0x3ede('0x2d')](_0x5733e8)[_0x3ede('0x3f')](_0x15e2f6);}else{_0x5be692[_0x3ede('0x2d')](_0x5733e8)[_0x3ede('0x9d')](_0x15e2f6);}}});};exports[_0x3ede('0x9e')]=function(_0x11400b,_0x4f285d,_0x324a94){var _0x1c133d={};var _0x568723={};var _0x24c741;var _0x26dd1a;return db['MailAccount'][_0x3ede('0x68')]({'where':{'id':_0x11400b[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x4f285d,null))[_0x3ede('0x38')](function(_0x282de6){if(_0x282de6){_0x24c741=_0x282de6;_0x568723[_0x3ede('0x4b')]=_['keys'](db[_0x3ede('0x99')][_0x3ede('0x48')]);_0x568723['query']=_[_0x3ede('0x4d')](_0x11400b[_0x3ede('0x4e')]);_0x568723['filters']=_[_0x3ede('0x50')](_0x568723[_0x3ede('0x4b')],_0x568723['query']);_0x1c133d[_0x3ede('0x51')]=_['intersection'](_0x568723[_0x3ede('0x4b')],qs[_0x3ede('0x60')](_0x11400b[_0x3ede('0x4e')]['fields']));_0x1c133d[_0x3ede('0x51')]=_0x1c133d[_0x3ede('0x51')]['length']?_0x1c133d[_0x3ede('0x51')]:_0x568723['model'];_0x1c133d[_0x3ede('0x6e')]=qs[_0x3ede('0x55')](_0x11400b['query'][_0x3ede('0x55')]);_0x1c133d['where']=qs[_0x3ede('0x4f')](_[_0x3ede('0x56')](_0x11400b['query'],_0x568723[_0x3ede('0x4f')]));if(_0x11400b[_0x3ede('0x4e')][_0x3ede('0x57')]){_0x1c133d['where']=_[_0x3ede('0x5a')](_0x1c133d['where'],{'$or':_[_0x3ede('0x4c')](_0x1c133d[_0x3ede('0x51')],function(_0x52292d){var _0x14c86={};_0x14c86[_0x52292d]={'$like':'%'+_0x11400b[_0x3ede('0x4e')][_0x3ede('0x57')]+'%'};return _0x14c86;})});}_0x1c133d=_['merge']({},_0x1c133d,_0x11400b[_0x3ede('0x5b')]);return _0x24c741['getApplications'](_0x1c133d);}})[_0x3ede('0x38')](function(_0x47bdf3){if(_0x47bdf3){_0x26dd1a=_0x47bdf3[_0x3ede('0x52')];if(!_0x11400b[_0x3ede('0x4e')][_0x3ede('0x53')](_0x3ede('0x54'))){_0x1c133d[_0x3ede('0x30')]=qs[_0x3ede('0x30')](_0x11400b[_0x3ede('0x4e')][_0x3ede('0x30')]);_0x1c133d[_0x3ede('0x2f')]=qs['offset'](_0x11400b[_0x3ede('0x4e')][_0x3ede('0x2f')]);}return _0x24c741[_0x3ede('0x9e')](_0x1c133d);}})[_0x3ede('0x38')](function(_0x3e3dd7){if(_0x3e3dd7){return _0x3e3dd7?{'count':_0x26dd1a,'rows':_0x3e3dd7}:null;}})[_0x3ede('0x38')](respondWithResult(_0x4f285d,null))[_0x3ede('0x2b')](handleError(_0x4f285d,null));};exports['getMessages']=function(_0x97f13b,_0x6f75c5,_0x5045ae){var _0x3770c0={'raw':!![],'where':{}};var _0x30fa84={};var _0x3b4055={'count':0x0,'rows':[]};return db[_0x3ede('0x47')]['findOne']({'where':{'id':_0x97f13b[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x6f75c5,null))[_0x3ede('0x38')](function(_0x5aab83){if(_0x5aab83){_0x30fa84['model']=_[_0x3ede('0x4d')](db[_0x3ede('0x9f')]['rawAttributes']);_0x30fa84[_0x3ede('0x4e')]=_['keys'](_0x97f13b[_0x3ede('0x4e')]);_0x30fa84[_0x3ede('0x4f')]=_[_0x3ede('0x50')](_0x30fa84['model'],_0x30fa84['query']);_0x3770c0[_0x3ede('0x51')]=_['intersection'](_0x30fa84[_0x3ede('0x4b')],qs[_0x3ede('0x60')](_0x97f13b[_0x3ede('0x4e')][_0x3ede('0x60')]));_0x3770c0[_0x3ede('0x51')]=_0x3770c0['attributes'][_0x3ede('0x52')]?_0x3770c0[_0x3ede('0x51')]:_0x30fa84[_0x3ede('0x4b')];if(!_0x97f13b[_0x3ede('0x4e')][_0x3ede('0x53')]('nolimit')){_0x3770c0[_0x3ede('0x30')]=qs[_0x3ede('0x30')](_0x97f13b[_0x3ede('0x4e')][_0x3ede('0x30')]);_0x3770c0[_0x3ede('0x2f')]=qs[_0x3ede('0x2f')](_0x97f13b[_0x3ede('0x4e')][_0x3ede('0x2f')]);}_0x3770c0[_0x3ede('0x6e')]=qs[_0x3ede('0x55')](_0x97f13b['query']['sort']);_0x3770c0['where']=qs[_0x3ede('0x4f')](_['pick'](_0x97f13b[_0x3ede('0x4e')],_0x30fa84[_0x3ede('0x4f')]));_0x3770c0['where'][_0x3ede('0x66')]=_0x5aab83['id'];if(_0x97f13b[_0x3ede('0x4e')][_0x3ede('0x57')]){_0x3770c0[_0x3ede('0x58')]=_['merge'](_0x3770c0[_0x3ede('0x58')],{'$or':_[_0x3ede('0x4c')](_0x3770c0[_0x3ede('0x51')],function(_0x46f7cd){var _0x1e88f2={};_0x1e88f2[_0x46f7cd]={'$like':'%'+_0x97f13b[_0x3ede('0x4e')]['filter']+'%'};return _0x1e88f2;})});}if(_0x97f13b[_0x3ede('0x4e')][_0x3ede('0xa0')]){var _0xd16ef6=_0x97f13b[_0x3ede('0x4e')]['$gte']['split'](',');var _0x5ece0a={};_0x5ece0a[_0xd16ef6[0x0]]={'$gte':moment(_0xd16ef6[0x1])[_0x3ede('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3770c0['where']=_[_0x3ede('0x5a')](_0x3770c0[_0x3ede('0x58')],_0x5ece0a);}_0x3770c0=_['merge']({},_0x3770c0,_0x97f13b[_0x3ede('0x5b')]);return db['MailMessage']['count']({'where':_0x3770c0[_0x3ede('0x58')]})['then'](function(_0x3bdeef){_0x3b4055[_0x3ede('0x32')]=_0x3bdeef;if(_0x97f13b[_0x3ede('0x4e')][_0x3ede('0x61')]){_0x3770c0[_0x3ede('0x5c')]=[{'all':!![]}];}return db[_0x3ede('0x9f')][_0x3ede('0x5d')](_0x3770c0);})[_0x3ede('0x38')](function(_0x15e5e8){if(_0x97f13b[_0x3ede('0x4e')][_0x3ede('0xa2')]===_0x3ede('0xa3')){for(var _0x7f92ef=0x0;_0x7f92ef<_0x15e5e8[_0x3ede('0x52')];_0x7f92ef++){_0x15e5e8[_0x7f92ef][_0x3ede('0x63')]=juice(_0x15e5e8[_0x7f92ef][_0x3ede('0x63')]);}}_0x3b4055[_0x3ede('0x5e')]=_0x15e5e8;return _0x3b4055;});}})['then'](respondWithFilteredResult(_0x6f75c5,_0x3770c0))[_0x3ede('0x2b')](handleError(_0x6f75c5,null));};exports[_0x3ede('0x3f')]=function(_0x2ae77b,_0x374cae,_0x2e0e0b){var _0x582e89,_0x579a52={},_0x5b8cf3;if(_0x2ae77b[_0x3ede('0x63')]['to']){_0x5b8cf3=_0x2ae77b['body']['to'][_0x3ede('0xa4')](',')[0x0];}return db[_0x3ede('0x47')][_0x3ede('0x62')]({'where':{'id':_0x2ae77b[_0x3ede('0x5f')]['id']},'include':[{'model':db[_0x3ede('0xa5')],'as':_0x3ede('0xa6'),'include':[{'model':db[_0x3ede('0x8d')],'as':_0x3ede('0xa7'),'where':{'email':_0x5b8cf3},'limit':0x1,'order':[['updatedAt',_0x3ede('0xa8')]]}]},{'model':db[_0x3ede('0x43')],'as':_0x3ede('0x44'),'raw':!![]}]})[_0x3ede('0x38')](handleEntityNotFound(_0x374cae,null))[_0x3ede('0x38')](function(_0x541e5d){if(_0x541e5d){_0x582e89=_0x541e5d;if(_0x541e5d[_0x3ede('0x44')]){if(_[_0x3ede('0x70')](_0x2ae77b[_0x3ede('0x63')]['from'])){_0x2ae77b[_0x3ede('0x63')][_0x3ede('0xa9')]=util[_0x3ede('0xa1')](_0x3ede('0xaa'),_0x541e5d[_0x3ede('0x3e')],_0x541e5d[_0x3ede('0xab')]||_0x541e5d[_0x3ede('0x44')]['user']);}if(_0x2ae77b['body'][_0x3ede('0xac')]&&_0x2ae77b[_0x3ede('0x63')][_0x3ede('0xac')]['length']){for(var _0x32f1e9=0x0;_0x32f1e9<_0x2ae77b['body'][_0x3ede('0xac')][_0x3ede('0x52')];_0x32f1e9+=0x1){_0x2ae77b['body']['attachments'][_0x32f1e9]={'filename':_0x2ae77b[_0x3ede('0x63')]['attachments'][_0x32f1e9][_0x3ede('0x3e')],'path':path['join'](config[_0x3ede('0xad')],'server/files/attachments',_0x2ae77b[_0x3ede('0x63')][_0x3ede('0xac')][_0x32f1e9][_0x3ede('0xae')])};}}var _0x505c9c={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x541e5d[_0x3ede('0x44')][_0x3ede('0x7d')])){if(_0x541e5d[_0x3ede('0x44')][_0x3ede('0x7a')]){_0x505c9c[_0x3ede('0xaf')]={'user':_0x541e5d[_0x3ede('0x44')]['user'],'pass':_0x541e5d[_0x3ede('0x44')]['pass']};}_0x505c9c['host']=_0x541e5d[_0x3ede('0x44')][_0x3ede('0x7b')];_0x505c9c[_0x3ede('0x7c')]=_0x541e5d[_0x3ede('0x44')][_0x3ede('0x7c')];_0x505c9c[_0x3ede('0xb0')]=_0x541e5d[_0x3ede('0x44')]['secure'];}else{_0x505c9c[_0x3ede('0x7d')]=_0x541e5d['Smtp'][_0x3ede('0x7d')];_0x505c9c[_0x3ede('0xaf')]={'user':_0x541e5d['Smtp'][_0x3ede('0x75')],'pass':_0x541e5d[_0x3ede('0x44')][_0x3ede('0x78')]};}return respondWithRpcPromise(_0x3ede('0xb1'),_0x3ede('0xb2'),{'account':_0x505c9c,'message':_0x2ae77b['body']});}else{throw new Error(_0x3ede('0xb3'));}}})[_0x3ede('0x38')](function(_0x38c696){if(_0x38c696){_0x579a52=_0x38c696;if(_0x582e89[_0x3ede('0xa6')]){if(_0x582e89[_0x3ede('0xa6')][_0x3ede('0xa7')]['length']){return _0x582e89[_0x3ede('0xa6')][_0x3ede('0xa7')][0x0];}else{return db[_0x3ede('0x8d')][_0x3ede('0x6b')](_['defaults'](_0x2ae77b[_0x3ede('0x63')],{'firstName':_0x2ae77b[_0x3ede('0x63')]['to'],'email':_0x2ae77b['body']['to'],'phone':_0x2ae77b[_0x3ede('0x63')]['to'],'ListId':_0x582e89[_0x3ede('0xb4')]}));}}else{throw new Error(_0x3ede('0xb3'));}}})[_0x3ede('0x38')](function(_0x2413f6){if(_0x2413f6){var _0x42d2b1={'UserId':_0x2ae77b['user']['id'],'ContactId':_0x2413f6['id'],'MailAccountId':_0x582e89['id'],'inReplyTo':_0x579a52[_0x3ede('0xb5')],'to':_0x2ae77b[_0x3ede('0x63')][_0x3ede('0xa9')],'cc':_0x2ae77b[_0x3ede('0x63')]['cc'],'subject':_0x2ae77b['body'][_0x3ede('0xb6')],'attach':_0x2ae77b[_0x3ede('0x63')][_0x3ede('0xb7')],'firstMsgDirection':_0x3ede('0xb8'),'lastMsgAt':moment()[_0x3ede('0xa1')](_0x3ede('0xb9')),'lastMsgDirection':'out','Messages':[_[_0x3ede('0x5a')](_0x2ae77b['body'],{'messageId':_0x579a52[_0x3ede('0xb5')],'sentAt':moment()[_0x3ede('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x582e89['id'],'UserId':_0x2ae77b['user']['id'],'ContactId':_0x2413f6['id']})]};if(_0x2ae77b[_0x3ede('0x63')][_0x3ede('0xba')]){_0x42d2b1=_[_0x3ede('0x5a')](_0x42d2b1,_0x2ae77b[_0x3ede('0x63')]['Interaction']);}return db[_0x3ede('0x8b')][_0x3ede('0x6b')](_0x42d2b1,{'include':[{'model':db['MailMessage'],'as':_0x3ede('0xbb')}]});}})['then'](respondWithResult(_0x374cae,null))[_0x3ede('0x2b')](handleError(_0x374cae,null));};exports[_0x3ede('0xbc')]=function(_0x20e853,_0x4158cd,_0x33fcfd){return db[_0x3ede('0x47')][_0x3ede('0x62')]({'where':{'id':_0x20e853[_0x3ede('0x5f')]['id']},'include':[{'model':db[_0x3ede('0x43')],'as':'Smtp','raw':!![]}]})[_0x3ede('0x38')](handleEntityNotFound(_0x4158cd,null))[_0x3ede('0x38')](function(_0x337c34){if(_0x337c34&&_0x337c34[_0x3ede('0x44')]){var _0x53678d={'id':_0x337c34['id'],'tls':{'rejectUnauthorized':![]}};if(_0x337c34['Smtp'][_0x3ede('0x7d')]){_0x53678d[_0x3ede('0x7d')]=_0x337c34[_0x3ede('0x44')][_0x3ede('0x7d')];}else{_0x53678d[_0x3ede('0x7b')]=_0x337c34[_0x3ede('0x44')][_0x3ede('0x7b')];_0x53678d[_0x3ede('0x7c')]=_0x337c34[_0x3ede('0x44')][_0x3ede('0x7c')];_0x53678d[_0x3ede('0xb0')]=_0x337c34[_0x3ede('0x44')][_0x3ede('0xb0')];}if(_0x337c34[_0x3ede('0x44')][_0x3ede('0x7a')]){_0x53678d[_0x3ede('0xaf')]={'user':_0x337c34['Smtp'][_0x3ede('0x75')],'pass':_0x337c34[_0x3ede('0x44')][_0x3ede('0x78')]};}return respondWithRpcPromise(_0x3ede('0xbd'),_0x3ede('0xbc'),{'account':_0x53678d});}})[_0x3ede('0x38')](respondWithResult(_0x4158cd,null))[_0x3ede('0x2b')](handleError(_0x4158cd,null));};exports[_0x3ede('0x39')]=function(_0x58f8ba,_0x4385d6){return db['MailAccount'][_0x3ede('0x62')]({'where':{'id':_0x58f8ba[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x4385d6,null))[_0x3ede('0x38')](function(_0x2e9df9){if(_0x2e9df9&&_0x2e9df9['service']){throw new db[(_0x3ede('0xbe'))][(_0x3ede('0xbf'))](_0x3ede('0xc0'));}return _0x2e9df9;})[_0x3ede('0x38')](removeEntity(_0x4385d6,null))['catch'](handleError(_0x4385d6,null));};exports['addAgents']=function(_0x3f0f26,_0x3c2d26,_0x396c70){return db[_0x3ede('0x47')]['find']({'where':{'id':_0x3f0f26['params']['id']}})['then'](handleEntityNotFound(_0x3c2d26,null))[_0x3ede('0x38')](function(_0x80094d){if(_0x80094d){return _0x80094d[_0x3ede('0xc1')](_0x3f0f26[_0x3ede('0x63')][_0x3ede('0x6a')],_[_0x3ede('0x8c')](_0x3f0f26[_0x3ede('0x63')],[_0x3ede('0x6a'),'id'])||{})['spread'](function(_0x387494){for(var _0x522233=0x0;_0x522233<_0x3f0f26[_0x3ede('0x63')][_0x3ede('0x6a')][_0x3ede('0x52')];_0x522233+=0x1){socket[_0x3ede('0xc2')](_0x3ede('0xc3'),{'UserId':Number(_0x3f0f26[_0x3ede('0x63')]['ids'][_0x522233]),'MailAccountId':Number(_0x3f0f26[_0x3ede('0x5f')]['id'])});}return _0x387494;});}})[_0x3ede('0x38')](respondWithResult(_0x3c2d26,null))[_0x3ede('0x2b')](handleError(_0x3c2d26,null));};exports[_0x3ede('0xc4')]=function(_0x19f2a9,_0x31e8b6,_0x10d3cd){return db[_0x3ede('0x47')]['find']({'where':{'id':_0x19f2a9[_0x3ede('0x5f')]['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x31e8b6,null))[_0x3ede('0x38')](function(_0x1f8324){if(_0x1f8324){return _0x1f8324[_0x3ede('0xc4')](_0x19f2a9['query']['ids'])['then'](function(){if(_[_0x3ede('0xc5')](_0x19f2a9[_0x3ede('0x4e')][_0x3ede('0x6a')])){for(var _0x2cdd62=0x0;_0x2cdd62<_0x19f2a9[_0x3ede('0x4e')][_0x3ede('0x6a')][_0x3ede('0x52')];_0x2cdd62+=0x1){socket['emit'](_0x3ede('0xc6'),{'UserId':Number(_0x19f2a9[_0x3ede('0x4e')]['ids'][_0x2cdd62]),'MailAccountId':Number(_0x19f2a9[_0x3ede('0x5f')]['id'])});}}else{socket[_0x3ede('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x19f2a9[_0x3ede('0x4e')][_0x3ede('0x6a')]),'MailAccountId':Number(_0x19f2a9[_0x3ede('0x5f')]['id'])});}});}})[_0x3ede('0x38')](respondWithStatusCode(_0x31e8b6,null))[_0x3ede('0x2b')](handleError(_0x31e8b6,null));};exports[_0x3ede('0xc7')]=function(_0x165bbb,_0x5ddafc,_0x555946){var _0x3d8748={};var _0x1847c0={};var _0x15b352;var _0x57e137;return db[_0x3ede('0x47')][_0x3ede('0x68')]({'where':{'id':_0x165bbb['params']['id']}})[_0x3ede('0x38')](handleEntityNotFound(_0x5ddafc,null))[_0x3ede('0x38')](function(_0x804010){if(_0x804010){_0x15b352=_0x804010;_0x1847c0[_0x3ede('0x4b')]=_['keys'](db[_0x3ede('0x8f')][_0x3ede('0x48')]);_0x1847c0[_0x3ede('0x4e')]=_[_0x3ede('0x4d')](_0x165bbb['query']);_0x1847c0[_0x3ede('0x4f')]=_[_0x3ede('0x50')](_0x1847c0['model'],_0x1847c0[_0x3ede('0x4e')]);_0x3d8748[_0x3ede('0x51')]=_[_0x3ede('0x50')](_0x1847c0['model'],qs[_0x3ede('0x60')](_0x165bbb[_0x3ede('0x4e')][_0x3ede('0x60')]));_0x3d8748['attributes']=_0x3d8748[_0x3ede('0x51')][_0x3ede('0x52')]?_0x3d8748['attributes']:_0x1847c0[_0x3ede('0x4b')];_0x3d8748[_0x3ede('0x6e')]=qs[_0x3ede('0x55')](_0x165bbb[_0x3ede('0x4e')][_0x3ede('0x55')]);_0x3d8748[_0x3ede('0x58')]=qs[_0x3ede('0x4f')](_[_0x3ede('0x56')](_0x165bbb[_0x3ede('0x4e')],_0x1847c0[_0x3ede('0x4f')]));if(_0x165bbb[_0x3ede('0x4e')]['filter']){_0x3d8748[_0x3ede('0x58')]=_[_0x3ede('0x5a')](_0x3d8748[_0x3ede('0x58')],{'$or':_[_0x3ede('0x4c')](_0x3d8748[_0x3ede('0x51')],function(_0x1c9256){var _0x45ec49={};_0x45ec49[_0x1c9256]={'$like':'%'+_0x165bbb[_0x3ede('0x4e')][_0x3ede('0x57')]+'%'};return _0x45ec49;})});}_0x3d8748=_[_0x3ede('0x5a')]({},_0x3d8748,_0x165bbb[_0x3ede('0x5b')]);return _0x15b352[_0x3ede('0xc7')](_0x3d8748);}})[_0x3ede('0x38')](function(_0x12bd77){if(_0x12bd77){_0x57e137=_0x12bd77[_0x3ede('0x52')];if(!_0x165bbb[_0x3ede('0x4e')]['hasOwnProperty'](_0x3ede('0x54'))){_0x3d8748[_0x3ede('0x30')]=qs[_0x3ede('0x30')](_0x165bbb[_0x3ede('0x4e')][_0x3ede('0x30')]);_0x3d8748[_0x3ede('0x2f')]=qs[_0x3ede('0x2f')](_0x165bbb[_0x3ede('0x4e')][_0x3ede('0x2f')]);}return _0x15b352[_0x3ede('0xc7')](_0x3d8748);}})[_0x3ede('0x38')](function(_0x2d98d7){if(_0x2d98d7){return _0x2d98d7?{'count':_0x57e137,'rows':_0x2d98d7}:null;}})[_0x3ede('0x38')](respondWithResult(_0x5ddafc,null))['catch'](handleError(_0x5ddafc,null));}; \ No newline at end of file +var _0x3c6c=['Imap','mandatoryDispositionPause','intersection','find','body','describe','addDisposition','MailAccountId','Disposition','create','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','pass','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','addSmtp','addInteraction','MailInteraction','omit','getInteractions','nolimit','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','send','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','removeAgents','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailAccount.socket','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','get','MailAccounts','UserProfileResource','destroy','name','index','MailServerIn','MailServerOut','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0xcd1b6,_0x558e97){var _0x52203f=function(_0x10c576){while(--_0x10c576){_0xcd1b6['push'](_0xcd1b6['shift']());}};_0x52203f(++_0x558e97);}(_0x3c6c,0x1f4));var _0xc3c6=function(_0x5fab11,_0x2285e4){_0x5fab11=_0x5fab11-0x0;var _0x48b21e=_0x3c6c[_0x5fab11];return _0x48b21e;};'use strict';var emlformat=require(_0xc3c6('0x0'));var rimraf=require(_0xc3c6('0x1'));var zipdir=require(_0xc3c6('0x2'));var jsonpatch=require(_0xc3c6('0x3'));var rp=require(_0xc3c6('0x4'));var moment=require(_0xc3c6('0x5'));var BPromise=require(_0xc3c6('0x6'));var Mustache=require(_0xc3c6('0x7'));var util=require(_0xc3c6('0x8'));var path=require(_0xc3c6('0x9'));var sox=require(_0xc3c6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3c6('0xb'));var squel=require(_0xc3c6('0xc'));var crypto=require(_0xc3c6('0xd'));var jsforce=require(_0xc3c6('0xe'));var deskjs=require(_0xc3c6('0xf'));var toCsv=require(_0xc3c6('0x10'));var querystring=require('querystring');var Papa=require(_0xc3c6('0x11'));var htmlToText=require(_0xc3c6('0x12'));var juice=require(_0xc3c6('0x13'));var Redis=require(_0xc3c6('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc3c6('0x15'));var as=require(_0xc3c6('0x16'));var hardwareService=require(_0xc3c6('0x17'));var logger=require(_0xc3c6('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xc3c6('0x19'));var licenseUtil=require(_0xc3c6('0x1a'));var db=require(_0xc3c6('0x1b'))['db'];config['redis']=_[_0xc3c6('0x1c')](config[_0xc3c6('0x1d')],{'host':_0xc3c6('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3c6('0x1d')]));require(_0xc3c6('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc3c6('0x20')][_0xc3c6('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x5ea85f,_0x27fdaf,_0x4c56da,_0x3dc1bd){return new BPromise(function(_0x141d37,_0x192a40){var _0x310d8b=_0x3dc1bd||client;return _0x310d8b[_0xc3c6('0x22')](_0x5ea85f,_0x4c56da)[_0xc3c6('0x23')](function(_0x3b0360){logger[_0xc3c6('0x24')](_0xc3c6('0x25'),_0x27fdaf,_0xc3c6('0x26'));logger[_0xc3c6('0x27')](_0xc3c6('0x28'),_0x27fdaf,_0xc3c6('0x26'),JSON[_0xc3c6('0x29')](_0x3b0360));if(_0x3b0360[_0xc3c6('0x2a')]){if(_0x3b0360[_0xc3c6('0x2a')]['code']===0x1f4){logger[_0xc3c6('0x2a')](_0xc3c6('0x25'),_0x27fdaf,_0x3b0360[_0xc3c6('0x2a')][_0xc3c6('0x2b')]);return _0x192a40(_0x3b0360[_0xc3c6('0x2a')]['message']);}logger[_0xc3c6('0x2a')](_0xc3c6('0x25'),_0x27fdaf,_0x3b0360[_0xc3c6('0x2a')]['message']);return _0x141d37(_0x3b0360[_0xc3c6('0x2a')][_0xc3c6('0x2b')]);}else{logger[_0xc3c6('0x24')](_0xc3c6('0x25'),_0x27fdaf,'request\x20sent');_0x141d37(_0x3b0360[_0xc3c6('0x2c')][_0xc3c6('0x2b')]);}})['catch'](function(_0x1693f4){logger[_0xc3c6('0x2a')](_0xc3c6('0x25'),_0x27fdaf,_0x1693f4);_0x192a40(_0x1693f4);});});}function respondWithStatusCode(_0x8fb5ad,_0x416648){_0x416648=_0x416648||0xcc;return function(_0xeffcec){if(_0xeffcec){return _0x8fb5ad[_0xc3c6('0x2d')](_0x416648);}return _0x8fb5ad['status'](_0x416648)[_0xc3c6('0x2e')]();};}function respondWithResult(_0x12d21b,_0x569a77){_0x569a77=_0x569a77||0xc8;return function(_0x1318c6){if(_0x1318c6){return _0x12d21b['status'](_0x569a77)[_0xc3c6('0x2f')](_0x1318c6);}};}function respondWithFilteredResult(_0x3b9b15,_0x3cf9d8){return function(_0x15c062){if(_0x15c062){var _0xceb94e=typeof _0x3cf9d8[_0xc3c6('0x30')]===_0xc3c6('0x31')&&typeof _0x3cf9d8[_0xc3c6('0x32')]===_0xc3c6('0x31');var _0x5ce3a9=_0x15c062[_0xc3c6('0x33')];var _0x45207e=_0xceb94e?0x0:_0x3cf9d8['offset'];var _0x2a4e62=_0xceb94e?_0x15c062[_0xc3c6('0x33')]:_0x3cf9d8[_0xc3c6('0x30')]+_0x3cf9d8[_0xc3c6('0x32')];var _0x326cfa;if(_0x2a4e62>=_0x5ce3a9){_0x2a4e62=_0x5ce3a9;_0x326cfa=0xc8;}else{_0x326cfa=0xce;}_0x3b9b15[_0xc3c6('0x34')](_0x326cfa);return _0x3b9b15[_0xc3c6('0x35')](_0xc3c6('0x36'),_0x45207e+'-'+_0x2a4e62+'/'+_0x5ce3a9)[_0xc3c6('0x2f')](_0x15c062);}return null;};}function patchUpdates(_0x3cb127){return function(_0x59e3fc){try{jsonpatch[_0xc3c6('0x37')](_0x59e3fc,_0x3cb127,!![]);}catch(_0x3cf076){return BPromise[_0xc3c6('0x38')](_0x3cf076);}return _0x59e3fc[_0xc3c6('0x39')]();};}function saveUpdates(_0x2a90dd,_0x46d85d){return function(_0x38eb40){if(_0x38eb40){return _0x38eb40[_0xc3c6('0x3a')](_0x2a90dd)[_0xc3c6('0x23')](function(_0x5cd6ef){return _0x5cd6ef;});}return null;};}function removeEntity(_0x1297da,_0xeed5){return function(_0x5aa002){if(_0x5aa002){return _0x5aa002['destroy']()[_0xc3c6('0x23')](function(){var _0x494b5c=_0x5aa002[_0xc3c6('0x3b')]({'plain':!![]});var _0x15df54=_0xc3c6('0x3c');return db[_0xc3c6('0x3d')][_0xc3c6('0x3e')]({'where':{'type':_0x15df54,'resourceId':_0x494b5c['id']}})[_0xc3c6('0x23')](function(){return _0x5aa002;});})[_0xc3c6('0x23')](function(){_0x1297da[_0xc3c6('0x34')](0xcc)[_0xc3c6('0x2e')]();});}};}function handleEntityNotFound(_0x904c99,_0x449f0f){return function(_0x162f42){if(!_0x162f42){_0x904c99[_0xc3c6('0x2d')](0x194);}return _0x162f42;};}function handleError(_0xb16999,_0x4a8670){_0x4a8670=_0x4a8670||0x1f4;return function(_0x25cf7b){logger[_0xc3c6('0x2a')](_0x25cf7b['stack']);if(_0x25cf7b[_0xc3c6('0x3f')]){delete _0x25cf7b[_0xc3c6('0x3f')];}_0xb16999['status'](_0x4a8670)['send'](_0x25cf7b);};}exports[_0xc3c6('0x40')]=function(_0x268fbd,_0x55b50a){var _0x34cdce={'include':[{'model':db[_0xc3c6('0x41')],'as':'Imap'},{'model':db[_0xc3c6('0x42')],'as':_0xc3c6('0x43')},{'model':db[_0xc3c6('0x44')],'as':'mandatoryDispositionPause'}]},_0x40fbe2={},_0x7d0b5e={'count':0x0,'rows':[]};var _0x3aa58e=_[_0xc3c6('0x45')](db[_0xc3c6('0x46')][_0xc3c6('0x47')],function(_0x276513){return{'name':_0x276513[_0xc3c6('0x48')],'type':_0x276513[_0xc3c6('0x49')]['key']};});_0x40fbe2[_0xc3c6('0x4a')]=_[_0xc3c6('0x45')](_0x3aa58e,_0xc3c6('0x3f'));_0x40fbe2[_0xc3c6('0x4b')]=_[_0xc3c6('0x4c')](_0x268fbd[_0xc3c6('0x4b')]);_0x40fbe2[_0xc3c6('0x4d')]=_['intersection'](_0x40fbe2[_0xc3c6('0x4a')],_0x40fbe2[_0xc3c6('0x4b')]);_0x34cdce[_0xc3c6('0x4e')]=_['intersection'](_0x40fbe2[_0xc3c6('0x4a')],qs[_0xc3c6('0x4f')](_0x268fbd[_0xc3c6('0x4b')]['fields']));_0x34cdce[_0xc3c6('0x4e')]=_0x34cdce['attributes'][_0xc3c6('0x50')]?_0x34cdce['attributes']:_0x40fbe2[_0xc3c6('0x4a')];if(!_0x268fbd['query'][_0xc3c6('0x51')]('nolimit')){_0x34cdce[_0xc3c6('0x32')]=qs[_0xc3c6('0x32')](_0x268fbd[_0xc3c6('0x4b')][_0xc3c6('0x32')]);_0x34cdce['offset']=qs[_0xc3c6('0x30')](_0x268fbd[_0xc3c6('0x4b')][_0xc3c6('0x30')]);}_0x34cdce[_0xc3c6('0x52')]=qs[_0xc3c6('0x53')](_0x268fbd[_0xc3c6('0x4b')][_0xc3c6('0x53')]);_0x34cdce['where']=qs[_0xc3c6('0x4d')](_[_0xc3c6('0x54')](_0x268fbd[_0xc3c6('0x4b')],_0x40fbe2[_0xc3c6('0x4d')]),_0x3aa58e);if(_0x268fbd[_0xc3c6('0x4b')][_0xc3c6('0x55')]){_0x34cdce[_0xc3c6('0x56')]=_[_0xc3c6('0x57')](_0x34cdce[_0xc3c6('0x56')],{'$or':_['map'](_0x3aa58e,function(_0x12b76a){if(_0x12b76a[_0xc3c6('0x49')]!==_0xc3c6('0x58')){var _0x2b4312={};_0x2b4312[_0x12b76a['name']]={'$like':'%'+_0x268fbd[_0xc3c6('0x4b')][_0xc3c6('0x55')]+'%'};return _0x2b4312;}})});}_0x34cdce=_[_0xc3c6('0x57')]({},_0x34cdce,_0x268fbd[_0xc3c6('0x59')]);var _0xf5b68c={'where':_0x34cdce[_0xc3c6('0x56')]};return db[_0xc3c6('0x46')][_0xc3c6('0x33')](_0xf5b68c)[_0xc3c6('0x23')](function(_0x25e5d6){_0x7d0b5e['count']=_0x25e5d6;if(_0x268fbd[_0xc3c6('0x4b')][_0xc3c6('0x5a')]){_0x34cdce[_0xc3c6('0x5b')]=[{'all':!![]}];}return db['MailAccount'][_0xc3c6('0x5c')](_0x34cdce);})[_0xc3c6('0x23')](function(_0x4e172a){_0x7d0b5e[_0xc3c6('0x5d')]=_0x4e172a;return _0x7d0b5e;})[_0xc3c6('0x23')](respondWithFilteredResult(_0x55b50a,_0x34cdce))[_0xc3c6('0x5e')](handleError(_0x55b50a,null));};exports[_0xc3c6('0x5f')]=function(_0xc777d2,_0x34ea90){var _0xa71250={'raw':![],'where':{'id':_0xc777d2[_0xc3c6('0x60')]['id']},'include':[{'model':db[_0xc3c6('0x41')],'as':_0xc3c6('0x61')},{'model':db['MailServerOut'],'as':_0xc3c6('0x43')},{'model':db[_0xc3c6('0x44')],'as':_0xc3c6('0x62')}]},_0xe9521b={};_0xe9521b[_0xc3c6('0x4a')]=_[_0xc3c6('0x4c')](db[_0xc3c6('0x46')][_0xc3c6('0x47')]);_0xe9521b[_0xc3c6('0x4b')]=_[_0xc3c6('0x4c')](_0xc777d2[_0xc3c6('0x4b')]);_0xe9521b[_0xc3c6('0x4d')]=_[_0xc3c6('0x63')](_0xe9521b[_0xc3c6('0x4a')],_0xe9521b[_0xc3c6('0x4b')]);_0xa71250[_0xc3c6('0x4e')]=_[_0xc3c6('0x63')](_0xe9521b['model'],qs['fields'](_0xc777d2[_0xc3c6('0x4b')]['fields']));_0xa71250[_0xc3c6('0x4e')]=_0xa71250[_0xc3c6('0x4e')][_0xc3c6('0x50')]?_0xa71250[_0xc3c6('0x4e')]:_0xe9521b[_0xc3c6('0x4a')];if(_0xc777d2[_0xc3c6('0x4b')]['includeAll']){_0xa71250[_0xc3c6('0x5b')]=[{'all':!![]}];}_0xa71250=_[_0xc3c6('0x57')]({},_0xa71250,_0xc777d2[_0xc3c6('0x59')]);return db['MailAccount'][_0xc3c6('0x64')](_0xa71250)[_0xc3c6('0x23')](handleEntityNotFound(_0x34ea90,null))['then'](respondWithResult(_0x34ea90,null))[_0xc3c6('0x5e')](handleError(_0x34ea90,null));};exports[_0xc3c6('0x3a')]=function(_0x56a112,_0x4ef4e9){if(_0x56a112['body']['id']){delete _0x56a112[_0xc3c6('0x65')]['id'];}return db['MailAccount'][_0xc3c6('0x64')]({'where':{'id':_0x56a112[_0xc3c6('0x60')]['id']},'include':[{'model':db[_0xc3c6('0x41')],'as':'Imap'},{'model':db[_0xc3c6('0x42')],'as':_0xc3c6('0x43')},{'model':db[_0xc3c6('0x44')],'as':_0xc3c6('0x62')}]})[_0xc3c6('0x23')](handleEntityNotFound(_0x4ef4e9,null))[_0xc3c6('0x23')](saveUpdates(_0x56a112[_0xc3c6('0x65')],null))[_0xc3c6('0x23')](function(_0x157b62){if(_0x157b62&&_0x56a112[_0xc3c6('0x65')]['Imap']){return db[_0xc3c6('0x41')]['update'](_0x56a112['body'][_0xc3c6('0x61')],{'where':{'MailAccountId':_0x157b62['id']}})[_0xc3c6('0x23')](function(){return _0x157b62;});}return _0x157b62;})['then'](function(_0x390650){if(_0x390650&&_0x56a112[_0xc3c6('0x65')][_0xc3c6('0x43')]){return db[_0xc3c6('0x42')][_0xc3c6('0x3a')](_0x56a112[_0xc3c6('0x65')][_0xc3c6('0x43')],{'where':{'MailAccountId':_0x390650['id']}})[_0xc3c6('0x23')](function(){return _0x390650;});}return _0x390650;})[_0xc3c6('0x23')](respondWithResult(_0x4ef4e9,null))[_0xc3c6('0x5e')](handleError(_0x4ef4e9,null));};exports[_0xc3c6('0x66')]=function(_0x5519ae,_0x1d2a70){return db['MailAccount'][_0xc3c6('0x66')]()[_0xc3c6('0x23')](respondWithResult(_0x1d2a70,null))[_0xc3c6('0x5e')](handleError(_0x1d2a70,null));};exports[_0xc3c6('0x67')]=function(_0x4eaa45,_0x2916e1,_0x48e6b9){if(_0x4eaa45[_0xc3c6('0x65')]['id']){delete _0x4eaa45[_0xc3c6('0x65')]['id'];}return db['MailAccount'][_0xc3c6('0x64')]({'where':{'id':_0x4eaa45[_0xc3c6('0x60')]['id']}})['then'](handleEntityNotFound(_0x2916e1,null))[_0xc3c6('0x23')](function(_0x3cf701){if(_0x3cf701){_0x4eaa45['body'][_0xc3c6('0x68')]=_0x3cf701['id'];return db[_0xc3c6('0x69')][_0xc3c6('0x6a')](_0x4eaa45[_0xc3c6('0x65')]);}})['then'](respondWithResult(_0x2916e1,null))[_0xc3c6('0x5e')](handleError(_0x2916e1,null));};exports['getDispositions']=function(_0x1ea9ba,_0x1b1990,_0x1046ad){var _0x1bdcfc={'raw':![],'where':{}};var _0x288e1f={};var _0x4214e0={'count':0x0,'rows':[]};return db['MailAccount'][_0xc3c6('0x6b')]({'where':{'id':_0x1ea9ba[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x1b1990,null))[_0xc3c6('0x23')](function(_0x5c8b5f){if(_0x5c8b5f){_0x288e1f[_0xc3c6('0x4a')]=_['keys'](db[_0xc3c6('0x69')]['rawAttributes']);_0x288e1f['query']=_['keys'](_0x1ea9ba['query']);_0x288e1f[_0xc3c6('0x4d')]=_['intersection'](_0x288e1f['model'],_0x288e1f[_0xc3c6('0x4b')]);_0x1bdcfc[_0xc3c6('0x4e')]=_[_0xc3c6('0x63')](_0x288e1f[_0xc3c6('0x4a')],qs[_0xc3c6('0x4f')](_0x1ea9ba['query']['fields']));_0x1bdcfc['attributes']=_0x1bdcfc[_0xc3c6('0x4e')][_0xc3c6('0x50')]?_0x1bdcfc['attributes']:_0x288e1f[_0xc3c6('0x4a')];if(!_0x1ea9ba[_0xc3c6('0x4b')]['hasOwnProperty']('nolimit')){_0x1bdcfc[_0xc3c6('0x32')]=qs[_0xc3c6('0x32')](_0x1ea9ba[_0xc3c6('0x4b')]['limit']);_0x1bdcfc[_0xc3c6('0x30')]=qs[_0xc3c6('0x30')](_0x1ea9ba[_0xc3c6('0x4b')]['offset']);}_0x1bdcfc['order']=qs[_0xc3c6('0x53')](_0x1ea9ba[_0xc3c6('0x4b')][_0xc3c6('0x53')]);_0x1bdcfc[_0xc3c6('0x56')]=qs[_0xc3c6('0x4d')](_[_0xc3c6('0x54')](_0x1ea9ba[_0xc3c6('0x4b')],_0x288e1f[_0xc3c6('0x4d')]));_0x1bdcfc['where'][_0xc3c6('0x68')]=_0x5c8b5f['id'];if(_0x1ea9ba['query'][_0xc3c6('0x55')]){_0x1bdcfc[_0xc3c6('0x56')]=_[_0xc3c6('0x57')](_0x1bdcfc['where'],{'$or':_['map'](_0x1bdcfc['attributes'],function(_0x1e14fd){var _0x43a06b={};_0x43a06b[_0x1e14fd]={'$like':'%'+_0x1ea9ba['query'][_0xc3c6('0x55')]+'%'};return _0x43a06b;})});}_0x1bdcfc=_['merge']({},_0x1bdcfc,_0x1ea9ba[_0xc3c6('0x59')]);return db[_0xc3c6('0x69')][_0xc3c6('0x33')]({'where':_0x1bdcfc[_0xc3c6('0x56')]})[_0xc3c6('0x23')](function(_0x34ea35){_0x4214e0[_0xc3c6('0x33')]=_0x34ea35;if(_0x1ea9ba[_0xc3c6('0x4b')][_0xc3c6('0x5a')]){_0x1bdcfc['include']=[{'all':!![]}];}return db[_0xc3c6('0x69')][_0xc3c6('0x5c')](_0x1bdcfc);})[_0xc3c6('0x23')](function(_0x2f7e70){_0x4214e0[_0xc3c6('0x5d')]=_0x2f7e70;return _0x4214e0;});}})[_0xc3c6('0x23')](respondWithFilteredResult(_0x1b1990,_0x1bdcfc))[_0xc3c6('0x5e')](handleError(_0x1b1990,null));};exports['removeDispositions']=function(_0xc14be7,_0xd2428f,_0x553f60){return db['MailAccount'][_0xc3c6('0x64')]({'where':{'id':_0xc14be7[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0xd2428f,null))[_0xc3c6('0x23')](function(_0x49094b){if(_0x49094b){return _0x49094b[_0xc3c6('0x6c')](_0xc14be7[_0xc3c6('0x4b')]['ids']);}})[_0xc3c6('0x23')](respondWithStatusCode(_0xd2428f,null))[_0xc3c6('0x5e')](handleError(_0xd2428f,null));};exports[_0xc3c6('0x6d')]=function(_0x4dd530,_0x578d4b,_0x380af1){if(_0x4dd530[_0xc3c6('0x65')]['id']){delete _0x4dd530[_0xc3c6('0x65')]['id'];}return db[_0xc3c6('0x46')]['find']({'where':{'id':_0x4dd530[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x578d4b,null))[_0xc3c6('0x23')](function(_0x4a1ff8){if(_0x4a1ff8){_0x4dd530[_0xc3c6('0x65')]['MailAccountId']=_0x4a1ff8['id'];return db[_0xc3c6('0x6e')][_0xc3c6('0x6a')](_0x4dd530[_0xc3c6('0x65')]);}})[_0xc3c6('0x23')](respondWithResult(_0x578d4b,null))['catch'](handleError(_0x578d4b,null));};exports['getAnswers']=function(_0x1f985f,_0x3b0e3b,_0x28028e){var _0x102440={'raw':![],'where':{}};var _0x53bed8={};var _0x1391cf={'count':0x0,'rows':[]};return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x1f985f[_0xc3c6('0x60')]['id']}})['then'](handleEntityNotFound(_0x3b0e3b,null))['then'](function(_0x310e43){if(_0x310e43){_0x53bed8[_0xc3c6('0x4a')]=_['keys'](db[_0xc3c6('0x6e')][_0xc3c6('0x47')]);_0x53bed8[_0xc3c6('0x4b')]=_['keys'](_0x1f985f[_0xc3c6('0x4b')]);_0x53bed8[_0xc3c6('0x4d')]=_['intersection'](_0x53bed8[_0xc3c6('0x4a')],_0x53bed8[_0xc3c6('0x4b')]);_0x102440[_0xc3c6('0x4e')]=_['intersection'](_0x53bed8[_0xc3c6('0x4a')],qs['fields'](_0x1f985f[_0xc3c6('0x4b')]['fields']));_0x102440[_0xc3c6('0x4e')]=_0x102440[_0xc3c6('0x4e')]['length']?_0x102440['attributes']:_0x53bed8['model'];if(!_0x1f985f['query'][_0xc3c6('0x51')]('nolimit')){_0x102440['limit']=qs[_0xc3c6('0x32')](_0x1f985f[_0xc3c6('0x4b')][_0xc3c6('0x32')]);_0x102440['offset']=qs[_0xc3c6('0x30')](_0x1f985f[_0xc3c6('0x4b')][_0xc3c6('0x30')]);}_0x102440[_0xc3c6('0x52')]=qs[_0xc3c6('0x53')](_0x1f985f['query'][_0xc3c6('0x53')]);_0x102440[_0xc3c6('0x56')]=qs[_0xc3c6('0x4d')](_['pick'](_0x1f985f[_0xc3c6('0x4b')],_0x53bed8['filters']));_0x102440[_0xc3c6('0x56')]['MailAccountId']=_0x310e43['id'];if(_0x1f985f[_0xc3c6('0x4b')][_0xc3c6('0x55')]){_0x102440[_0xc3c6('0x56')]=_[_0xc3c6('0x57')](_0x102440['where'],{'$or':_[_0xc3c6('0x45')](_0x102440['attributes'],function(_0x4c5a17){var _0xc09e36={};_0xc09e36[_0x4c5a17]={'$like':'%'+_0x1f985f[_0xc3c6('0x4b')][_0xc3c6('0x55')]+'%'};return _0xc09e36;})});}_0x102440=_[_0xc3c6('0x57')]({},_0x102440,_0x1f985f['options']);return db[_0xc3c6('0x6e')][_0xc3c6('0x33')]({'where':_0x102440[_0xc3c6('0x56')]})[_0xc3c6('0x23')](function(_0x4c960c){_0x1391cf[_0xc3c6('0x33')]=_0x4c960c;if(_0x1f985f['query'][_0xc3c6('0x5a')]){_0x102440[_0xc3c6('0x5b')]=[{'all':!![]}];}return db[_0xc3c6('0x6e')][_0xc3c6('0x5c')](_0x102440);})[_0xc3c6('0x23')](function(_0x1b2b59){_0x1391cf[_0xc3c6('0x5d')]=_0x1b2b59;return _0x1391cf;});}})[_0xc3c6('0x23')](respondWithFilteredResult(_0x3b0e3b,_0x102440))['catch'](handleError(_0x3b0e3b,null));};exports['removeAnswers']=function(_0x1d3312,_0x2a4aac,_0x233323){return db['MailAccount'][_0xc3c6('0x64')]({'where':{'id':_0x1d3312[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x2a4aac,null))[_0xc3c6('0x23')](function(_0x255f80){if(_0x255f80){return _0x255f80[_0xc3c6('0x6f')](_0x1d3312[_0xc3c6('0x4b')][_0xc3c6('0x70')]);}})['then'](respondWithStatusCode(_0x2a4aac,null))['catch'](handleError(_0x2a4aac,null));};exports['create']=function(_0x4d22c8,_0x29893d){var _0x44fc36={'name':_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x3f')],'key':_0x4d22c8['body']['key'],'email':_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x71')],'ListId':_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x72')],'active':!_[_0xc3c6('0x73')](_0x4d22c8['body'][_0xc3c6('0x74')])?_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x74')]:!![],'description':_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x75')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x76')])){if(_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x77')]){_0x44fc36['Imap']['user']=_0x44fc36[_0xc3c6('0x43')][_0xc3c6('0x78')]=_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x79')];_0x44fc36[_0xc3c6('0x61')]['password']=_0x44fc36['Smtp']['pass']=_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x7a')];}else{_0x44fc36[_0xc3c6('0x61')][_0xc3c6('0x7b')]=_0x44fc36[_0xc3c6('0x43')][_0xc3c6('0x7b')]=![];}_0x44fc36[_0xc3c6('0x61')][_0xc3c6('0x7c')]=_0x4d22c8[_0xc3c6('0x65')]['Imap']['host'];_0x44fc36[_0xc3c6('0x61')]['port']=_0x4d22c8[_0xc3c6('0x65')]['Imap'][_0xc3c6('0x7d')];_0x44fc36[_0xc3c6('0x43')][_0xc3c6('0x7c')]=_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x43')][_0xc3c6('0x7c')];_0x44fc36[_0xc3c6('0x43')][_0xc3c6('0x7d')]=_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x43')][_0xc3c6('0x7d')];}else{_0x44fc36['Imap'][_0xc3c6('0x7e')]=_0x44fc36['Smtp'][_0xc3c6('0x7e')]=_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x76')];_0x44fc36[_0xc3c6('0x61')][_0xc3c6('0x78')]=_0x44fc36[_0xc3c6('0x43')][_0xc3c6('0x78')]=_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x79')];_0x44fc36['Imap']['password']=_0x44fc36['Smtp'][_0xc3c6('0x7f')]=_0x4d22c8[_0xc3c6('0x65')][_0xc3c6('0x7a')];}return db[_0xc3c6('0x46')][_0xc3c6('0x6a')](_0x44fc36,{'include':[{'model':db[_0xc3c6('0x42')],'as':'Smtp'},{'model':db[_0xc3c6('0x41')],'as':_0xc3c6('0x61')}]})[_0xc3c6('0x23')](function(_0x3a0acc){var _0x37b5cc=_0x4d22c8['user'][_0xc3c6('0x3b')]({'plain':!![]});if(!_0x37b5cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37b5cc[_0xc3c6('0x80')]==='user'){var _0x4f581f=_0x3a0acc[_0xc3c6('0x3b')]({'plain':!![]});return db[_0xc3c6('0x81')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x37b5cc[_0xc3c6('0x82')]},'raw':!![]})[_0xc3c6('0x23')](function(_0x171042){if(_0x171042&&_0x171042[_0xc3c6('0x83')]===0x0){return db[_0xc3c6('0x3d')][_0xc3c6('0x6a')]({'name':_0x4f581f[_0xc3c6('0x3f')],'resourceId':_0x4f581f['id'],'type':_0x171042[_0xc3c6('0x3f')],'sectionId':_0x171042['id']},{})[_0xc3c6('0x23')](function(){return _0x3a0acc;});}else{return _0x3a0acc;}})[_0xc3c6('0x5e')](function(_0xc310b8){logger[_0xc3c6('0x2a')](_0xc3c6('0x84'),_0xc310b8);throw _0xc310b8;});}return _0x3a0acc;})[_0xc3c6('0x23')](respondWithResult(_0x29893d,0xc9))[_0xc3c6('0x5e')](handleError(_0x29893d,null));};exports[_0xc3c6('0x85')]=function(_0x3c2016,_0x120bcf,_0x3e94a3){return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x3c2016[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x120bcf,null))[_0xc3c6('0x23')](function(_0x3158c7){if(_0x3158c7){return _0x3158c7[_0xc3c6('0x85')]();}return null;})['then'](respondWithResult(_0x120bcf,null))[_0xc3c6('0x5e')](handleError(_0x120bcf,null));};exports[_0xc3c6('0x86')]=function(_0x52d1df,_0x103821,_0x366675){if(_0x52d1df[_0xc3c6('0x65')]['id']){delete _0x52d1df[_0xc3c6('0x65')]['id'];}return db[_0xc3c6('0x46')][_0xc3c6('0x64')]({'where':{'id':_0x52d1df['params']['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x103821,null))[_0xc3c6('0x23')](function(_0x42b4a5){if(_0x42b4a5){_0x52d1df[_0xc3c6('0x65')][_0xc3c6('0x68')]=_0x42b4a5['id'];return db[_0xc3c6('0x41')]['create'](_0x52d1df[_0xc3c6('0x65')]);}})[_0xc3c6('0x23')](respondWithResult(_0x103821,null))[_0xc3c6('0x5e')](handleError(_0x103821,null));};exports[_0xc3c6('0x87')]=function(_0x1ae111,_0x57b2d8,_0xe1e708){return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x1ae111[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x57b2d8,null))[_0xc3c6('0x23')](function(_0x3fa7dd){if(_0x3fa7dd){return _0x3fa7dd['setImap'](null);}return null;})[_0xc3c6('0x23')](respondWithStatusCode(_0x57b2d8,null))[_0xc3c6('0x5e')](handleError(_0x57b2d8,null));};exports['getSmtp']=function(_0x144357,_0x2e5df7,_0x23afba){return db['MailAccount']['findOne']({'where':{'id':_0x144357[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x2e5df7,null))[_0xc3c6('0x23')](function(_0x3728fe){if(_0x3728fe){return _0x3728fe['getSmtp']();}return null;})[_0xc3c6('0x23')](respondWithResult(_0x2e5df7,null))[_0xc3c6('0x5e')](handleError(_0x2e5df7,null));};exports[_0xc3c6('0x88')]=function(_0x217cf2,_0x4c96ba,_0xad7fbe){if(_0x217cf2['body']['id']){delete _0x217cf2[_0xc3c6('0x65')]['id'];}return db['MailAccount'][_0xc3c6('0x64')]({'where':{'id':_0x217cf2[_0xc3c6('0x60')]['id']}})['then'](handleEntityNotFound(_0x4c96ba,null))[_0xc3c6('0x23')](function(_0x376cd6){if(_0x376cd6){_0x217cf2[_0xc3c6('0x65')]['MailAccountId']=_0x376cd6['id'];return db[_0xc3c6('0x42')][_0xc3c6('0x6a')](_0x217cf2[_0xc3c6('0x65')]);}})[_0xc3c6('0x23')](respondWithResult(_0x4c96ba,null))[_0xc3c6('0x5e')](handleError(_0x4c96ba,null));};exports['removeSmtp']=function(_0x43d091,_0x401796,_0x6e9068){return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x43d091['params']['id']}})['then'](handleEntityNotFound(_0x401796,null))['then'](function(_0x1ad08f){if(_0x1ad08f){return _0x1ad08f['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x401796,null))[_0xc3c6('0x5e')](handleError(_0x401796,null));};exports[_0xc3c6('0x89')]=function(_0x16d021,_0x193972,_0x42f96f){return db[_0xc3c6('0x8a')]['find']({'where':{'id':_0x16d021[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x193972,null))[_0xc3c6('0x23')](function(_0x12f225){if(_0x12f225){return _0x12f225[_0xc3c6('0x89')](_0x16d021['body'][_0xc3c6('0x70')],_[_0xc3c6('0x8b')](_0x16d021[_0xc3c6('0x65')],['ids','id'])||{});}})[_0xc3c6('0x23')](respondWithResult(_0x193972,null))[_0xc3c6('0x5e')](handleError(_0x193972,null));};exports[_0xc3c6('0x8c')]=function(_0x349840,_0x228e37,_0xbbd6f1){var _0x97f1f8={'raw':![],'where':{}};var _0x30f41c={};var _0x1aa112={'count':0x0,'rows':[]};return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x349840['params']['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x228e37,null))[_0xc3c6('0x23')](function(_0x32200f){if(_0x32200f){_0x30f41c['model']=_[_0xc3c6('0x4c')](db[_0xc3c6('0x8a')][_0xc3c6('0x47')]);_0x30f41c[_0xc3c6('0x4b')]=_[_0xc3c6('0x4c')](_0x349840['query']);_0x30f41c[_0xc3c6('0x4d')]=_[_0xc3c6('0x63')](_0x30f41c['model'],_0x30f41c['query']);_0x97f1f8['attributes']=_[_0xc3c6('0x63')](_0x30f41c['model'],qs[_0xc3c6('0x4f')](_0x349840[_0xc3c6('0x4b')]['fields']));_0x97f1f8['attributes']=_0x97f1f8['attributes'][_0xc3c6('0x50')]?_0x97f1f8[_0xc3c6('0x4e')]:_0x30f41c[_0xc3c6('0x4a')];if(!_0x349840[_0xc3c6('0x4b')][_0xc3c6('0x51')](_0xc3c6('0x8d'))){_0x97f1f8[_0xc3c6('0x32')]=qs[_0xc3c6('0x32')](_0x349840[_0xc3c6('0x4b')]['limit']);_0x97f1f8['offset']=qs[_0xc3c6('0x30')](_0x349840[_0xc3c6('0x4b')][_0xc3c6('0x30')]);}_0x97f1f8[_0xc3c6('0x52')]=qs['sort'](_0x349840[_0xc3c6('0x4b')][_0xc3c6('0x53')]);_0x97f1f8[_0xc3c6('0x56')]=qs[_0xc3c6('0x4d')](_['pick'](_0x349840['query'],_0x30f41c[_0xc3c6('0x4d')]));_0x97f1f8['where'][_0xc3c6('0x68')]=_0x32200f['id'];if(_0x349840['query']['filter']){_0x97f1f8[_0xc3c6('0x56')]=_[_0xc3c6('0x57')](_0x97f1f8[_0xc3c6('0x56')],{'$or':_[_0xc3c6('0x45')](_0x97f1f8[_0xc3c6('0x4e')],function(_0x8c209b){var _0xc6ed82={};_0xc6ed82[_0x8c209b]={'$like':'%'+_0x349840[_0xc3c6('0x4b')][_0xc3c6('0x55')]+'%'};return _0xc6ed82;})});}_0x97f1f8=_[_0xc3c6('0x57')]({},_0x97f1f8,_0x349840[_0xc3c6('0x59')]);return db[_0xc3c6('0x8a')][_0xc3c6('0x33')]({'where':_0x97f1f8[_0xc3c6('0x56')]})['then'](function(_0x334257){_0x1aa112['count']=_0x334257;if(_0x349840[_0xc3c6('0x4b')]['includeAll']){_0x97f1f8[_0xc3c6('0x5b')]=[{'model':db[_0xc3c6('0x8e')],'as':_0xc3c6('0x8f'),'required':![]},{'model':db[_0xc3c6('0x90')],'as':'Owner','attributes':[_0xc3c6('0x3f'),'fullname',_0xc3c6('0x91')],'required':![]},{'model':db[_0xc3c6('0x92')],'as':_0xc3c6('0x93'),'attributes':['id',_0xc3c6('0x3f'),_0xc3c6('0x94')],'where':_0x349840[_0xc3c6('0x4b')][_0xc3c6('0x95')]?{'id':_0x349840['query'][_0xc3c6('0x95')]}:undefined,'required':_0x349840[_0xc3c6('0x4b')][_0xc3c6('0x95')]?!![]:![]}];}return db['MailInteraction'][_0xc3c6('0x5c')](_0x97f1f8);})[_0xc3c6('0x23')](function(_0xf59580){_0x1aa112[_0xc3c6('0x5d')]=_0xf59580;return _0x1aa112;});}})[_0xc3c6('0x23')](respondWithFilteredResult(_0x228e37,_0x97f1f8))[_0xc3c6('0x5e')](handleError(_0x228e37,null));};exports[_0xc3c6('0x96')]=function addApplications(_0x2543e3,_0x1e6f1e){var _0x1c9389=_0x2543e3[_0xc3c6('0x60')]['id'];var _0x42e39b=_0x2543e3['body'];var _0x1f84c8=0xc8;var _0x37b36c=null;return db[_0xc3c6('0x97')][_0xc3c6('0x98')]({'isolationLevel':db[_0xc3c6('0x97')][_0xc3c6('0x99')][_0xc3c6('0x9a')]['READ_COMMITTED']},function(_0x173729){return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x1c9389},'transaction':_0x173729})[_0xc3c6('0x23')](function(_0x5c8514){if(_0x5c8514){return db[_0xc3c6('0x9b')][_0xc3c6('0x3e')]({'where':{'MailAccountId':_0x1c9389},'transaction':_0x173729})[_0xc3c6('0x23')](function(){var _0x4cc179=_[_0xc3c6('0x45')](_0x42e39b,function(_0x126d46){_0x126d46[_0xc3c6('0x68')]=_0x1c9389;return _0x126d46;});return db[_0xc3c6('0x9b')][_0xc3c6('0x9c')](_0x4cc179,{'transaction':_0x173729});});}else{_0x1f84c8=0x194;_0x37b36c=[];}});})[_0xc3c6('0x23')](function(){if(_0x1f84c8!==0x194){return db[_0xc3c6('0x9b')][_0xc3c6('0x9d')]({'where':{'MailAccountId':_0x1c9389},'order':_0xc3c6('0x9e')})[_0xc3c6('0x23')](function(_0x5ab7e5){_0x37b36c=_0x5ab7e5;});}})['catch'](function(_0x43b419){_0x1f84c8=0x1f4;logger[_0xc3c6('0x2a')](_0x43b419[_0xc3c6('0x9f')]);if(_0x43b419['name']){delete _0x43b419[_0xc3c6('0x3f')];}_0x37b36c=_0x43b419;})[_0xc3c6('0xa0')](function(){if(_0x37b36c===null){_0x1e6f1e[_0xc3c6('0x2d')](_0x1f84c8);}else{if(_0x1f84c8===0x1f4){_0x1e6f1e['status'](_0x1f84c8)[_0xc3c6('0xa1')](_0x37b36c);}else{_0x1e6f1e[_0xc3c6('0x34')](_0x1f84c8)[_0xc3c6('0x2f')](_0x37b36c);}}});};exports[_0xc3c6('0xa2')]=function(_0x25277a,_0x58fbce,_0x515bf0){var _0x3fc25d={};var _0x2d30b6={};var _0x4c28b6;var _0x2c5d4c;return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x25277a[_0xc3c6('0x60')]['id']}})['then'](handleEntityNotFound(_0x58fbce,null))['then'](function(_0x11a50d){if(_0x11a50d){_0x4c28b6=_0x11a50d;_0x2d30b6[_0xc3c6('0x4a')]=_[_0xc3c6('0x4c')](db[_0xc3c6('0x9b')][_0xc3c6('0x47')]);_0x2d30b6[_0xc3c6('0x4b')]=_[_0xc3c6('0x4c')](_0x25277a[_0xc3c6('0x4b')]);_0x2d30b6['filters']=_[_0xc3c6('0x63')](_0x2d30b6[_0xc3c6('0x4a')],_0x2d30b6[_0xc3c6('0x4b')]);_0x3fc25d['attributes']=_[_0xc3c6('0x63')](_0x2d30b6[_0xc3c6('0x4a')],qs[_0xc3c6('0x4f')](_0x25277a[_0xc3c6('0x4b')]['fields']));_0x3fc25d['attributes']=_0x3fc25d[_0xc3c6('0x4e')][_0xc3c6('0x50')]?_0x3fc25d[_0xc3c6('0x4e')]:_0x2d30b6[_0xc3c6('0x4a')];_0x3fc25d[_0xc3c6('0x52')]=qs[_0xc3c6('0x53')](_0x25277a[_0xc3c6('0x4b')][_0xc3c6('0x53')]);_0x3fc25d[_0xc3c6('0x56')]=qs['filters'](_[_0xc3c6('0x54')](_0x25277a[_0xc3c6('0x4b')],_0x2d30b6[_0xc3c6('0x4d')]));if(_0x25277a[_0xc3c6('0x4b')][_0xc3c6('0x55')]){_0x3fc25d['where']=_[_0xc3c6('0x57')](_0x3fc25d[_0xc3c6('0x56')],{'$or':_[_0xc3c6('0x45')](_0x3fc25d[_0xc3c6('0x4e')],function(_0x2d2562){var _0x3344ce={};_0x3344ce[_0x2d2562]={'$like':'%'+_0x25277a[_0xc3c6('0x4b')][_0xc3c6('0x55')]+'%'};return _0x3344ce;})});}_0x3fc25d=_['merge']({},_0x3fc25d,_0x25277a['options']);return _0x4c28b6[_0xc3c6('0xa2')](_0x3fc25d);}})[_0xc3c6('0x23')](function(_0x3af398){if(_0x3af398){_0x2c5d4c=_0x3af398[_0xc3c6('0x50')];if(!_0x25277a[_0xc3c6('0x4b')][_0xc3c6('0x51')](_0xc3c6('0x8d'))){_0x3fc25d[_0xc3c6('0x32')]=qs[_0xc3c6('0x32')](_0x25277a[_0xc3c6('0x4b')][_0xc3c6('0x32')]);_0x3fc25d[_0xc3c6('0x30')]=qs[_0xc3c6('0x30')](_0x25277a['query'][_0xc3c6('0x30')]);}return _0x4c28b6[_0xc3c6('0xa2')](_0x3fc25d);}})[_0xc3c6('0x23')](function(_0x5a8612){if(_0x5a8612){return _0x5a8612?{'count':_0x2c5d4c,'rows':_0x5a8612}:null;}})[_0xc3c6('0x23')](respondWithResult(_0x58fbce,null))[_0xc3c6('0x5e')](handleError(_0x58fbce,null));};exports[_0xc3c6('0xa3')]=function(_0x45b78a,_0x1497db,_0x3108f9){var _0x35b80a={'raw':!![],'where':{}};var _0x156803={};var _0x39e2a9={'count':0x0,'rows':[]};return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x45b78a[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x1497db,null))[_0xc3c6('0x23')](function(_0x5ba863){if(_0x5ba863){_0x156803[_0xc3c6('0x4a')]=_[_0xc3c6('0x4c')](db[_0xc3c6('0xa4')][_0xc3c6('0x47')]);_0x156803[_0xc3c6('0x4b')]=_[_0xc3c6('0x4c')](_0x45b78a[_0xc3c6('0x4b')]);_0x156803[_0xc3c6('0x4d')]=_[_0xc3c6('0x63')](_0x156803[_0xc3c6('0x4a')],_0x156803[_0xc3c6('0x4b')]);_0x35b80a['attributes']=_[_0xc3c6('0x63')](_0x156803['model'],qs[_0xc3c6('0x4f')](_0x45b78a[_0xc3c6('0x4b')][_0xc3c6('0x4f')]));_0x35b80a[_0xc3c6('0x4e')]=_0x35b80a[_0xc3c6('0x4e')][_0xc3c6('0x50')]?_0x35b80a[_0xc3c6('0x4e')]:_0x156803['model'];if(!_0x45b78a['query']['hasOwnProperty'](_0xc3c6('0x8d'))){_0x35b80a['limit']=qs['limit'](_0x45b78a[_0xc3c6('0x4b')][_0xc3c6('0x32')]);_0x35b80a[_0xc3c6('0x30')]=qs['offset'](_0x45b78a[_0xc3c6('0x4b')][_0xc3c6('0x30')]);}_0x35b80a[_0xc3c6('0x52')]=qs[_0xc3c6('0x53')](_0x45b78a['query'][_0xc3c6('0x53')]);_0x35b80a[_0xc3c6('0x56')]=qs[_0xc3c6('0x4d')](_[_0xc3c6('0x54')](_0x45b78a['query'],_0x156803['filters']));_0x35b80a[_0xc3c6('0x56')]['MailAccountId']=_0x5ba863['id'];if(_0x45b78a[_0xc3c6('0x4b')][_0xc3c6('0x55')]){_0x35b80a['where']=_['merge'](_0x35b80a[_0xc3c6('0x56')],{'$or':_[_0xc3c6('0x45')](_0x35b80a[_0xc3c6('0x4e')],function(_0x2d8bcd){var _0x3ad383={};_0x3ad383[_0x2d8bcd]={'$like':'%'+_0x45b78a[_0xc3c6('0x4b')]['filter']+'%'};return _0x3ad383;})});}if(_0x45b78a[_0xc3c6('0x4b')][_0xc3c6('0xa5')]){var _0x3b263f=_0x45b78a['query']['$gte']['split'](',');var _0x4e9f19={};_0x4e9f19[_0x3b263f[0x0]]={'$gte':moment(_0x3b263f[0x1])['format'](_0xc3c6('0xa6'))};_0x35b80a[_0xc3c6('0x56')]=_[_0xc3c6('0x57')](_0x35b80a[_0xc3c6('0x56')],_0x4e9f19);}_0x35b80a=_[_0xc3c6('0x57')]({},_0x35b80a,_0x45b78a[_0xc3c6('0x59')]);return db[_0xc3c6('0xa4')][_0xc3c6('0x33')]({'where':_0x35b80a[_0xc3c6('0x56')]})[_0xc3c6('0x23')](function(_0x1e47bb){_0x39e2a9[_0xc3c6('0x33')]=_0x1e47bb;if(_0x45b78a['query'][_0xc3c6('0x5a')]){_0x35b80a[_0xc3c6('0x5b')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x35b80a);})[_0xc3c6('0x23')](function(_0x1a323a){if(_0x45b78a[_0xc3c6('0x4b')][_0xc3c6('0xa7')]==='true'){for(var _0x3e373d=0x0;_0x3e373d<_0x1a323a[_0xc3c6('0x50')];_0x3e373d++){_0x1a323a[_0x3e373d]['body']=juice(_0x1a323a[_0x3e373d][_0xc3c6('0x65')]);}}_0x39e2a9[_0xc3c6('0x5d')]=_0x1a323a;return _0x39e2a9;});}})['then'](respondWithFilteredResult(_0x1497db,_0x35b80a))['catch'](handleError(_0x1497db,null));};exports[_0xc3c6('0xa1')]=function(_0x47a22f,_0x4345ee,_0x2cda64){var _0xed2b38,_0x4257ee={},_0x431181;if(_0x47a22f[_0xc3c6('0x65')]['to']){_0x431181=_0x47a22f[_0xc3c6('0x65')]['to']['split'](',')[0x0];}return db[_0xc3c6('0x46')][_0xc3c6('0x64')]({'where':{'id':_0x47a22f[_0xc3c6('0x60')]['id']},'include':[{'model':db[_0xc3c6('0xa8')],'as':_0xc3c6('0xa9'),'include':[{'model':db['CmContact'],'as':_0xc3c6('0xaa'),'where':{'email':_0x431181},'limit':0x1,'order':[[_0xc3c6('0xab'),_0xc3c6('0xac')]]}]},{'model':db['MailServerOut'],'as':_0xc3c6('0x43'),'raw':!![]}]})[_0xc3c6('0x23')](handleEntityNotFound(_0x4345ee,null))['then'](function(_0x324400){if(_0x324400){_0xed2b38=_0x324400;if(_0x324400[_0xc3c6('0x43')]){if(_['isNil'](_0x47a22f[_0xc3c6('0x65')][_0xc3c6('0xad')])){_0x47a22f['body'][_0xc3c6('0xad')]=util[_0xc3c6('0xae')](_0xc3c6('0xaf'),_0x324400['name'],_0x324400[_0xc3c6('0x71')]||_0x324400[_0xc3c6('0x43')]['user']);}if(_0x47a22f[_0xc3c6('0x65')]['attachments']&&_0x47a22f[_0xc3c6('0x65')][_0xc3c6('0xb0')][_0xc3c6('0x50')]){for(var _0x4e592a=0x0;_0x4e592a<_0x47a22f[_0xc3c6('0x65')][_0xc3c6('0xb0')][_0xc3c6('0x50')];_0x4e592a+=0x1){_0x47a22f['body'][_0xc3c6('0xb0')][_0x4e592a]={'filename':_0x47a22f[_0xc3c6('0x65')][_0xc3c6('0xb0')][_0x4e592a][_0xc3c6('0x3f')],'path':path[_0xc3c6('0xb1')](config[_0xc3c6('0xb2')],'server/files/attachments',_0x47a22f[_0xc3c6('0x65')]['attachments'][_0x4e592a][_0xc3c6('0xb3')])};}}var _0x45d3a5={'tls':{'rejectUnauthorized':![]}};if(_[_0xc3c6('0x73')](_0x324400[_0xc3c6('0x43')][_0xc3c6('0x7e')])){if(_0x324400['Smtp']['authentication']){_0x45d3a5['auth']={'user':_0x324400['Smtp']['user'],'pass':_0x324400[_0xc3c6('0x43')][_0xc3c6('0x7f')]};}_0x45d3a5[_0xc3c6('0x7c')]=_0x324400[_0xc3c6('0x43')][_0xc3c6('0x7c')];_0x45d3a5[_0xc3c6('0x7d')]=_0x324400[_0xc3c6('0x43')][_0xc3c6('0x7d')];_0x45d3a5[_0xc3c6('0xb4')]=_0x324400[_0xc3c6('0x43')][_0xc3c6('0xb4')];}else{_0x45d3a5[_0xc3c6('0x7e')]=_0x324400['Smtp'][_0xc3c6('0x7e')];_0x45d3a5[_0xc3c6('0xb5')]={'user':_0x324400['Smtp'][_0xc3c6('0x78')],'pass':_0x324400['Smtp']['pass']};}return respondWithRpcPromise(_0xc3c6('0xb6'),_0xc3c6('0xb7'),{'account':_0x45d3a5,'message':_0x47a22f[_0xc3c6('0x65')]});}else{throw new Error(_0xc3c6('0xb8'));}}})[_0xc3c6('0x23')](function(_0x213ef0){if(_0x213ef0){_0x4257ee=_0x213ef0;if(_0xed2b38[_0xc3c6('0xa9')]){if(_0xed2b38[_0xc3c6('0xa9')][_0xc3c6('0xaa')][_0xc3c6('0x50')]){return _0xed2b38[_0xc3c6('0xa9')][_0xc3c6('0xaa')][0x0];}else{return db[_0xc3c6('0x8e')][_0xc3c6('0x6a')](_[_0xc3c6('0x1c')](_0x47a22f[_0xc3c6('0x65')],{'firstName':_0x47a22f[_0xc3c6('0x65')]['to'],'email':_0x47a22f[_0xc3c6('0x65')]['to'],'phone':_0x47a22f[_0xc3c6('0x65')]['to'],'ListId':_0xed2b38[_0xc3c6('0x72')]}));}}else{throw new Error(_0xc3c6('0xb8'));}}})[_0xc3c6('0x23')](function(_0x270cb2){if(_0x270cb2){var _0x423302={'UserId':_0x47a22f[_0xc3c6('0x78')]['id'],'ContactId':_0x270cb2['id'],'MailAccountId':_0xed2b38['id'],'inReplyTo':_0x4257ee[_0xc3c6('0xb9')],'to':_0x47a22f['body'][_0xc3c6('0xad')],'cc':_0x47a22f[_0xc3c6('0x65')]['cc'],'subject':_0x47a22f[_0xc3c6('0x65')]['subject'],'attach':_0x47a22f[_0xc3c6('0x65')][_0xc3c6('0xba')],'firstMsgDirection':_0xc3c6('0xbb'),'lastMsgAt':moment()[_0xc3c6('0xae')](_0xc3c6('0xa6')),'lastMsgDirection':_0xc3c6('0xbb'),'Messages':[_[_0xc3c6('0x57')](_0x47a22f[_0xc3c6('0x65')],{'messageId':_0x4257ee[_0xc3c6('0xb9')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xed2b38['id'],'UserId':_0x47a22f[_0xc3c6('0x78')]['id'],'ContactId':_0x270cb2['id']})]};if(_0x47a22f[_0xc3c6('0x65')][_0xc3c6('0xbc')]){_0x423302=_['merge'](_0x423302,_0x47a22f[_0xc3c6('0x65')]['Interaction']);}return db[_0xc3c6('0x8a')][_0xc3c6('0x6a')](_0x423302,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})['then'](respondWithResult(_0x4345ee,null))['catch'](handleError(_0x4345ee,null));};exports[_0xc3c6('0xbd')]=function(_0x5927f6,_0xba4d72,_0x338fad){return db[_0xc3c6('0x46')][_0xc3c6('0x64')]({'where':{'id':_0x5927f6[_0xc3c6('0x60')]['id']},'include':[{'model':db[_0xc3c6('0x42')],'as':_0xc3c6('0x43'),'raw':!![]}]})['then'](handleEntityNotFound(_0xba4d72,null))[_0xc3c6('0x23')](function(_0x6ec801){if(_0x6ec801&&_0x6ec801[_0xc3c6('0x43')]){var _0x5ebf87={'id':_0x6ec801['id'],'tls':{'rejectUnauthorized':![]}};if(_0x6ec801['Smtp'][_0xc3c6('0x7e')]){_0x5ebf87[_0xc3c6('0x7e')]=_0x6ec801[_0xc3c6('0x43')][_0xc3c6('0x7e')];}else{_0x5ebf87['host']=_0x6ec801[_0xc3c6('0x43')]['host'];_0x5ebf87[_0xc3c6('0x7d')]=_0x6ec801[_0xc3c6('0x43')][_0xc3c6('0x7d')];_0x5ebf87['secure']=_0x6ec801[_0xc3c6('0x43')][_0xc3c6('0xb4')];}if(_0x6ec801[_0xc3c6('0x43')][_0xc3c6('0x7b')]){_0x5ebf87[_0xc3c6('0xb5')]={'user':_0x6ec801[_0xc3c6('0x43')][_0xc3c6('0x78')],'pass':_0x6ec801['Smtp']['pass']};}return respondWithRpcPromise(_0xc3c6('0xbe'),_0xc3c6('0xbd'),{'account':_0x5ebf87});}})[_0xc3c6('0x23')](respondWithResult(_0xba4d72,null))['catch'](handleError(_0xba4d72,null));};exports[_0xc3c6('0x3e')]=function(_0x2cde2e,_0x21f1c4){return db[_0xc3c6('0x46')][_0xc3c6('0x64')]({'where':{'id':_0x2cde2e[_0xc3c6('0x60')]['id']}})['then'](handleEntityNotFound(_0x21f1c4,null))['then'](function(_0x25fbab){if(_0x25fbab&&_0x25fbab[_0xc3c6('0x7e')]){throw new db[(_0xc3c6('0xbf'))][(_0xc3c6('0xc0'))](_0xc3c6('0xc1'));}return _0x25fbab;})[_0xc3c6('0x23')](removeEntity(_0x21f1c4,null))['catch'](handleError(_0x21f1c4,null));};exports['addAgents']=function(_0x4f7f22,_0x3aae86,_0x56d23b){return db[_0xc3c6('0x46')][_0xc3c6('0x64')]({'where':{'id':_0x4f7f22[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x3aae86,null))[_0xc3c6('0x23')](function(_0x103c51){if(_0x103c51){return _0x103c51['addAgents'](_0x4f7f22[_0xc3c6('0x65')][_0xc3c6('0x70')],_[_0xc3c6('0x8b')](_0x4f7f22[_0xc3c6('0x65')],[_0xc3c6('0x70'),'id'])||{})[_0xc3c6('0xc2')](function(_0xcc62b3){for(var _0x4ee969=0x0;_0x4ee969<_0x4f7f22['body'][_0xc3c6('0x70')][_0xc3c6('0x50')];_0x4ee969+=0x1){socket[_0xc3c6('0xc3')]('userMailAccount:save',{'UserId':Number(_0x4f7f22[_0xc3c6('0x65')][_0xc3c6('0x70')][_0x4ee969]),'MailAccountId':Number(_0x4f7f22[_0xc3c6('0x60')]['id'])});}return _0xcc62b3;});}})['then'](respondWithResult(_0x3aae86,null))['catch'](handleError(_0x3aae86,null));};exports[_0xc3c6('0xc4')]=function(_0x4d4862,_0x21c41d,_0x182483){return db[_0xc3c6('0x46')][_0xc3c6('0x64')]({'where':{'id':_0x4d4862[_0xc3c6('0x60')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x21c41d,null))['then'](function(_0x1867ff){if(_0x1867ff){return _0x1867ff[_0xc3c6('0xc4')](_0x4d4862[_0xc3c6('0x4b')][_0xc3c6('0x70')])[_0xc3c6('0x23')](function(){if(_['isArray'](_0x4d4862['query']['ids'])){for(var _0x30fa9b=0x0;_0x30fa9b<_0x4d4862[_0xc3c6('0x4b')][_0xc3c6('0x70')][_0xc3c6('0x50')];_0x30fa9b+=0x1){socket[_0xc3c6('0xc3')](_0xc3c6('0xc5'),{'UserId':Number(_0x4d4862['query'][_0xc3c6('0x70')][_0x30fa9b]),'MailAccountId':Number(_0x4d4862[_0xc3c6('0x60')]['id'])});}}else{socket[_0xc3c6('0xc3')](_0xc3c6('0xc5'),{'UserId':Number(_0x4d4862[_0xc3c6('0x4b')][_0xc3c6('0x70')]),'MailAccountId':Number(_0x4d4862[_0xc3c6('0x60')]['id'])});}});}})[_0xc3c6('0x23')](respondWithStatusCode(_0x21c41d,null))[_0xc3c6('0x5e')](handleError(_0x21c41d,null));};exports[_0xc3c6('0xc6')]=function(_0x217d57,_0x533df0,_0x2a72c5){var _0x6aadfe={};var _0x503185={};var _0x223af1;var _0x4d7f98;return db[_0xc3c6('0x46')][_0xc3c6('0x6b')]({'where':{'id':_0x217d57['params']['id']}})['then'](handleEntityNotFound(_0x533df0,null))[_0xc3c6('0x23')](function(_0x1f0254){if(_0x1f0254){_0x223af1=_0x1f0254;_0x503185['model']=_[_0xc3c6('0x4c')](db[_0xc3c6('0x90')][_0xc3c6('0x47')]);_0x503185[_0xc3c6('0x4b')]=_[_0xc3c6('0x4c')](_0x217d57['query']);_0x503185[_0xc3c6('0x4d')]=_[_0xc3c6('0x63')](_0x503185[_0xc3c6('0x4a')],_0x503185[_0xc3c6('0x4b')]);_0x6aadfe[_0xc3c6('0x4e')]=_[_0xc3c6('0x63')](_0x503185[_0xc3c6('0x4a')],qs[_0xc3c6('0x4f')](_0x217d57['query']['fields']));_0x6aadfe[_0xc3c6('0x4e')]=_0x6aadfe['attributes'][_0xc3c6('0x50')]?_0x6aadfe[_0xc3c6('0x4e')]:_0x503185[_0xc3c6('0x4a')];_0x6aadfe[_0xc3c6('0x52')]=qs[_0xc3c6('0x53')](_0x217d57[_0xc3c6('0x4b')][_0xc3c6('0x53')]);_0x6aadfe['where']=qs[_0xc3c6('0x4d')](_[_0xc3c6('0x54')](_0x217d57[_0xc3c6('0x4b')],_0x503185['filters']));if(_0x217d57['query'][_0xc3c6('0x55')]){_0x6aadfe[_0xc3c6('0x56')]=_['merge'](_0x6aadfe[_0xc3c6('0x56')],{'$or':_[_0xc3c6('0x45')](_0x6aadfe['attributes'],function(_0x284a5b){var _0x245c9c={};_0x245c9c[_0x284a5b]={'$like':'%'+_0x217d57[_0xc3c6('0x4b')][_0xc3c6('0x55')]+'%'};return _0x245c9c;})});}_0x6aadfe=_[_0xc3c6('0x57')]({},_0x6aadfe,_0x217d57[_0xc3c6('0x59')]);return _0x223af1[_0xc3c6('0xc6')](_0x6aadfe);}})['then'](function(_0x17663d){if(_0x17663d){_0x4d7f98=_0x17663d[_0xc3c6('0x50')];if(!_0x217d57[_0xc3c6('0x4b')][_0xc3c6('0x51')](_0xc3c6('0x8d'))){_0x6aadfe[_0xc3c6('0x32')]=qs[_0xc3c6('0x32')](_0x217d57[_0xc3c6('0x4b')][_0xc3c6('0x32')]);_0x6aadfe['offset']=qs['offset'](_0x217d57['query'][_0xc3c6('0x30')]);}return _0x223af1[_0xc3c6('0xc6')](_0x6aadfe);}})[_0xc3c6('0x23')](function(_0x8a0905){if(_0x8a0905){return _0x8a0905?{'count':_0x4d7f98,'rows':_0x8a0905}:null;}})[_0xc3c6('0x23')](respondWithResult(_0x533df0,null))[_0xc3c6('0x5e')](handleError(_0x533df0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 41551df..273b358 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 _0x79a3=['emit','hasOwnProperty','events','MailAccount','setMaxListeners','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x79a3,0x80));var _0x379a=function(_0xd223ca,_0x55542e){_0xd223ca=_0xd223ca-0x0;var _0x6a7809=_0x79a3[_0xd223ca];return _0x6a7809;};'use strict';var EventEmitter=require(_0x379a('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x379a('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x379a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x379a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x484729){return function(_0x4c456f,_0x187d55,_0x24dda6){MailAccountEvents[_0x379a('0x4')](_0x484729+':'+_0x4c456f['id'],_0x4c456f);MailAccountEvents[_0x379a('0x4')](_0x484729,_0x4c456f);_0x24dda6(null);};}for(var e in events){if(events[_0x379a('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x4816=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4816,0xfe));var _0x6481=function(_0x22589f,_0x3f33b7){_0x22589f=_0x22589f-0x0;var _0x4b1e54=_0x4816[_0x22589f];return _0x4b1e54;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x6481('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6481('0x1')](0x0);var events={'afterCreate':_0x6481('0x2'),'afterUpdate':'update','afterDestroy':_0x6481('0x3')};function emitEvent(_0x4bd2a9){return function(_0x4d91e9,_0x34aab0,_0x22a7be){MailAccountEvents['emit'](_0x4bd2a9+':'+_0x4d91e9['id'],_0x4d91e9);MailAccountEvents['emit'](_0x4bd2a9,_0x4d91e9);_0x22a7be(null);};}for(var e in events){if(events[_0x6481('0x4')](e)){var event=events[e];MailAccount[_0x6481('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 89bb6fb..83cc0e8 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 _0xffc1=['util','../../config/logger','api','moment','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x2705f2,_0x32c04b){var _0x53b7c2=function(_0x3364e4){while(--_0x3364e4){_0x2705f2['push'](_0x2705f2['shift']());}};_0x53b7c2(++_0x32c04b);}(_0xffc1,0x1e4));var _0x1ffc=function(_0x351847,_0x50c848){_0x351847=_0x351847-0x0;var _0x176e65=_0xffc1[_0x351847];return _0x176e65;};'use strict';var _=require('lodash');var util=require(_0x1ffc('0x0'));var logger=require(_0x1ffc('0x1'))(_0x1ffc('0x2'));var moment=require(_0x1ffc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1ffc('0x4'));var config=require(_0x1ffc('0x5'));var attributes=require(_0x1ffc('0x6'));module[_0x1ffc('0x7')]=function(_0x2c3a1e,_0x53964e){return _0x2c3a1e[_0x1ffc('0x8')](_0x1ffc('0x9'),attributes,{'tableName':_0x1ffc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf24d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','../../config/logger'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xf24d,0x143));var _0xdf24=function(_0x26a44e,_0x18c43f){_0x26a44e=_0x26a44e-0x0;var _0x566fc4=_0xf24d[_0x26a44e];return _0x566fc4;};'use strict';var _=require(_0xdf24('0x0'));var util=require('util');var logger=require(_0xdf24('0x1'))('api');var moment=require(_0xdf24('0x2'));var BPromise=require(_0xdf24('0x3'));var rp=require(_0xdf24('0x4'));var fs=require('fs');var path=require(_0xdf24('0x5'));var rimraf=require(_0xdf24('0x6'));var config=require(_0xdf24('0x7'));var attributes=require(_0xdf24('0x8'));module[_0xdf24('0x9')]=function(_0x5e076e,_0x5bff20){return _0x5e076e[_0xdf24('0xa')](_0xdf24('0xb'),attributes,{'tableName':_0xdf24('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d52d272..6251555 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 _0xea99=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','Applications','MailServerOut','omit','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','attachments','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','MailAccount,\x20%s,\x20%s','info','catch','GetMailAccount','MailAccount','findAll','options','raw','include','model','attributes','map','then','find','ShowMailAccount','body','mail','difference','keys','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x1ef8b3,_0x298ce2){var _0x26a405=function(_0x5b259e){while(--_0x5b259e){_0x1ef8b3['push'](_0x1ef8b3['shift']());}};_0x26a405(++_0x298ce2);}(_0xea99,0x177));var _0x9ea9=function(_0x39f6a8,_0x47a635){_0x39f6a8=_0x39f6a8-0x0;var _0x26ed2c=_0xea99[_0x39f6a8];return _0x26ed2c;};'use strict';var _=require(_0x9ea9('0x0'));var util=require(_0x9ea9('0x1'));var moment=require(_0x9ea9('0x2'));var BPromise=require(_0x9ea9('0x3'));var rs=require(_0x9ea9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ea9('0x5'))['db'];var utils=require(_0x9ea9('0x6'));var logger=require(_0x9ea9('0x7'))(_0x9ea9('0x8'));var config=require(_0x9ea9('0x9'));var jayson=require(_0x9ea9('0xa'));var client=jayson[_0x9ea9('0xb')][_0x9ea9('0xc')]({'port':0x232c});config[_0x9ea9('0xd')]=_[_0x9ea9('0xe')](config[_0x9ea9('0xd')],{'host':_0x9ea9('0xf'),'port':0x18eb});var socket=require(_0x9ea9('0x10'))(new Redis(config[_0x9ea9('0xd')]));require(_0x9ea9('0x11'))[_0x9ea9('0x12')](socket);function respondWithRpcPromise(_0x31a022,_0x49d60d,_0x40482e){return new BPromise(function(_0x89100b,_0x499841){return client[_0x9ea9('0x13')](_0x31a022,_0x40482e)['then'](function(_0x21d836){logger['info']('MailAccount,\x20%s,\x20%s',_0x49d60d,_0x9ea9('0x14'));logger[_0x9ea9('0x15')](_0x9ea9('0x16'),_0x49d60d,_0x9ea9('0x14'),JSON[_0x9ea9('0x17')](_0x21d836));if(_0x21d836[_0x9ea9('0x18')]){if(_0x21d836[_0x9ea9('0x18')]['code']===0x1f4){logger[_0x9ea9('0x18')]('MailAccount,\x20%s,\x20%s',_0x49d60d,_0x21d836[_0x9ea9('0x18')][_0x9ea9('0x19')]);return _0x499841(_0x21d836[_0x9ea9('0x18')][_0x9ea9('0x19')]);}logger[_0x9ea9('0x18')](_0x9ea9('0x1a'),_0x49d60d,_0x21d836[_0x9ea9('0x18')][_0x9ea9('0x19')]);return _0x89100b(_0x21d836[_0x9ea9('0x18')][_0x9ea9('0x19')]);}else{logger[_0x9ea9('0x1b')](_0x9ea9('0x1a'),_0x49d60d,'request\x20sent');_0x89100b(_0x21d836['result'][_0x9ea9('0x19')]);}})[_0x9ea9('0x1c')](function(_0x4cc6f6){logger[_0x9ea9('0x18')](_0x9ea9('0x1a'),_0x49d60d,_0x4cc6f6);_0x499841(_0x4cc6f6);});});}exports[_0x9ea9('0x1d')]=function(_0x3a3128){var _0x41b734=this;return new Promise(function(_0x3b03c2,_0x50a8ec){return db[_0x9ea9('0x1e')][_0x9ea9('0x1f')]({'raw':_0x3a3128[_0x9ea9('0x20')]?_0x3a3128[_0x9ea9('0x20')][_0x9ea9('0x21')]===undefined?!![]:![]:!![],'where':_0x3a3128[_0x9ea9('0x20')]?_0x3a3128[_0x9ea9('0x20')]['where']||null:null,'attributes':_0x3a3128[_0x9ea9('0x20')]?_0x3a3128['options']['attributes']||null:null,'limit':_0x3a3128['options']?_0x3a3128[_0x9ea9('0x20')]['limit']||null:null,'include':_0x3a3128[_0x9ea9('0x20')]?_0x3a3128['options']['include']?_['map'](_0x3a3128[_0x9ea9('0x20')][_0x9ea9('0x22')],function(_0x30fd54){return{'model':db[_0x30fd54[_0x9ea9('0x23')]],'as':_0x30fd54['as'],'attributes':_0x30fd54[_0x9ea9('0x24')],'include':_0x30fd54[_0x9ea9('0x22')]?_['map'](_0x30fd54[_0x9ea9('0x22')],function(_0x3dccce){return{'model':db[_0x3dccce['model']],'as':_0x3dccce['as'],'attributes':_0x3dccce['attributes'],'include':_0x3dccce['include']?_[_0x9ea9('0x25')](_0x3dccce[_0x9ea9('0x22')],function(_0x4b1ad1){return{'model':db[_0x4b1ad1['model']],'as':_0x4b1ad1['as'],'attributes':_0x4b1ad1[_0x9ea9('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9ea9('0x26')](function(_0x398e25){logger[_0x9ea9('0x1b')](_0x9ea9('0x1d'),_0x3a3128);logger[_0x9ea9('0x15')](_0x9ea9('0x1d'),_0x3a3128,JSON['stringify'](_0x398e25));_0x3b03c2(_0x398e25);})[_0x9ea9('0x1c')](function(_0x2bd1d8){logger[_0x9ea9('0x18')]('GetMailAccount',_0x2bd1d8[_0x9ea9('0x19')],_0x3a3128);_0x50a8ec(_0x41b734[_0x9ea9('0x18')](0x1f4,_0x2bd1d8[_0x9ea9('0x19')]));});});};exports['ShowMailAccount']=function(_0x4bbd92){var _0x20b761=this;return new Promise(function(_0x115f97,_0x2f841e){return db[_0x9ea9('0x1e')][_0x9ea9('0x27')]({'raw':_0x4bbd92[_0x9ea9('0x20')]?_0x4bbd92[_0x9ea9('0x20')][_0x9ea9('0x21')]===undefined?!![]:![]:!![],'where':_0x4bbd92[_0x9ea9('0x20')]?_0x4bbd92[_0x9ea9('0x20')]['where']||null:null,'attributes':_0x4bbd92[_0x9ea9('0x20')]?_0x4bbd92[_0x9ea9('0x20')][_0x9ea9('0x24')]||null:null,'include':_0x4bbd92['options']?_0x4bbd92[_0x9ea9('0x20')][_0x9ea9('0x22')]?_[_0x9ea9('0x25')](_0x4bbd92[_0x9ea9('0x20')]['include'],function(_0x1aa7bb){return{'model':db[_0x1aa7bb[_0x9ea9('0x23')]],'as':_0x1aa7bb['as'],'attributes':_0x1aa7bb['attributes'],'include':_0x1aa7bb[_0x9ea9('0x22')]?_[_0x9ea9('0x25')](_0x1aa7bb[_0x9ea9('0x22')],function(_0x36168f){return{'model':db[_0x36168f[_0x9ea9('0x23')]],'as':_0x36168f['as'],'attributes':_0x36168f[_0x9ea9('0x24')],'include':_0x36168f[_0x9ea9('0x22')]?_['map'](_0x36168f[_0x9ea9('0x22')],function(_0x2525ce){return{'model':db[_0x2525ce[_0x9ea9('0x23')]],'as':_0x2525ce['as'],'attributes':_0x2525ce[_0x9ea9('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f8a3e){logger[_0x9ea9('0x1b')](_0x9ea9('0x28'),_0x4bbd92);logger[_0x9ea9('0x15')](_0x9ea9('0x28'),_0x4bbd92,JSON[_0x9ea9('0x17')](_0x2f8a3e));_0x115f97(_0x2f8a3e);})[_0x9ea9('0x1c')](function(_0x44ba40){logger[_0x9ea9('0x18')](_0x9ea9('0x28'),_0x44ba40[_0x9ea9('0x19')],_0x4bbd92);_0x2f841e(_0x20b761[_0x9ea9('0x18')](0x1f4,_0x44ba40[_0x9ea9('0x19')]));});});};exports['NotifyMailAccount']=function(_0x14f6af){var _0x1a08cb=this;return new Promise(function(_0x4ec835,_0x329400){var _0x5ae08a={'body':_0x14f6af[_0x9ea9('0x29')],'channel':_0x9ea9('0x2a')};var _0x2a8610=_[_0x9ea9('0x2b')](_[_0x9ea9('0x2c')](db['CmContact'][_0x9ea9('0x2d')]),['createdAt',_0x9ea9('0x2e'),_0x9ea9('0x2f'),_0x9ea9('0x30')]);var _0x58fe16=![];if(_0x14f6af[_0x9ea9('0x29')]['id']){delete _0x14f6af[_0x9ea9('0x29')]['id'];}if(_[_0x9ea9('0x31')](_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x32')])){return _0x329400(_0x1a08cb[_0x9ea9('0x18')](0x1f4,_0x9ea9('0x33')));}if(_[_0x9ea9('0x31')](_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x29')])||_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x29')]===''){return _0x329400(_0x1a08cb[_0x9ea9('0x18')](0x1f4,_0x9ea9('0x34')));}if(_[_0x9ea9('0x31')](_0x14f6af[_0x9ea9('0x29')]['mapKey'])){return _0x329400(_0x1a08cb[_0x9ea9('0x18')](0x1f4,_0x9ea9('0x35')+_0x2a8610));}if(!_[_0x9ea9('0x36')](_0x2a8610,_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x37')])){return _0x329400(_0x1a08cb[_0x9ea9('0x18')](0x1f4,_0x9ea9('0x38')+_0x2a8610));}var _0x4fd10a={};_0x4fd10a[_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x37')]]=_0x14f6af['body']['from'];return db[_0x9ea9('0x1e')][_0x9ea9('0x27')]({'where':{'id':_0x14f6af[_0x9ea9('0x39')]['id']},'include':[{'model':db[_0x9ea9('0x3a')],'as':_0x9ea9('0x3b'),'include':[{'model':db[_0x9ea9('0x3c')],'as':'Contacts','where':_0x4fd10a,'limit':0x1,'order':[[_0x9ea9('0x2e'),_0x9ea9('0x3d')]]}]},{'model':db[_0x9ea9('0x3e')],'as':_0x9ea9('0x3f')},{'model':db[_0x9ea9('0x40')],'as':'Smtp'}]})[_0x9ea9('0x26')](function(_0x448b60){if(_0x448b60&&_0x448b60[_0x9ea9('0x3b')]){var _0x1a3903=_0x448b60['get']({'plain':!![]});_0x5ae08a[_0x9ea9('0x39')]=_[_0x9ea9('0x41')](_0x1a3903,[_0x9ea9('0x3f'),'List']);_0x5ae08a[_0x9ea9('0x42')]=_0x1a3903[_0x9ea9('0x3f')];_0x5ae08a[_0x9ea9('0x43')]=_0x1a3903[_0x9ea9('0x3b')];_0x5ae08a[_0x9ea9('0x42')]=_[_0x9ea9('0x44')](_0x5ae08a[_0x9ea9('0x42')],[_0x9ea9('0x45')],['asc']);if(_0x5ae08a[_0x9ea9('0x39')]&&_0x5ae08a[_0x9ea9('0x39')][_0x9ea9('0x46')]){_0x5ae08a[_0x9ea9('0x42')][_0x9ea9('0x47')]({'id':0x0,'priority':_0x5ae08a['applications'][_0x9ea9('0x48')]+0x1,'app':_0x9ea9('0x49'),'appdata':_0x9ea9('0x46'),'interval':_0x9ea9('0x4a')});}if(_0x5ae08a[_0x9ea9('0x39')]['Applications']){delete _0x5ae08a[_0x9ea9('0x39')][_0x9ea9('0x3f')];}if(_0x5ae08a[_0x9ea9('0x39')]['List']){delete _0x5ae08a[_0x9ea9('0x39')][_0x9ea9('0x3b')];}if(_0x1a3903['List'][_0x9ea9('0x4b')][_0x9ea9('0x48')]){return _0x1a3903[_0x9ea9('0x3b')][_0x9ea9('0x4b')][0x0];}var _0x13988b=_[_0x9ea9('0xe')](_0x14f6af[_0x9ea9('0x29')],{'firstName':_0x14f6af['body'][_0x9ea9('0x32')],'ListId':_0x1a3903[_0x9ea9('0x30')]});_0x13988b[_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x37')]]=_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x32')];return db[_0x9ea9('0x3c')][_0x9ea9('0x4c')](_0x13988b);}else{throw new Error(_0x9ea9('0x4d'));}})[_0x9ea9('0x26')](function(_0x3c1dc4){_0x5ae08a[_0x9ea9('0x4e')]=_0x3c1dc4;if(_0x3c1dc4){if(!_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')]['messageId']){_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x4f')]=rs[_0x9ea9('0x50')]()+'\x20'+_0x14f6af['body'][_0x9ea9('0x19')][_0x9ea9('0x32')];}var _0x12258c={'ContactId':_0x3c1dc4['id'],'MailAccountId':_0x14f6af[_0x9ea9('0x39')]['id'],'inReplyTo':_0x14f6af[_0x9ea9('0x29')]['message'][_0x9ea9('0x4f')],'to':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x32')],'cc':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')]['cc'],'subject':_0x14f6af[_0x9ea9('0x29')]['message'][_0x9ea9('0x51')],'attach':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x52')],'lastMsgAt':moment()[_0x9ea9('0x53')](_0x9ea9('0x54')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x9ea9('0x27')]({'where':{'closed':![],'MailAccountId':_0x14f6af[_0x9ea9('0x39')]['id']},'include':[{'model':db[_0x9ea9('0x55')],'as':_0x9ea9('0x56'),'attributes':[_0x9ea9('0x4f')],'where':{'messageId':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x57')]}}]})[_0x9ea9('0x26')](function(_0x51a2fb){if(_0x51a2fb){return[_0x51a2fb,![]];}return db['MailInteraction']['create'](_0x12258c)[_0x9ea9('0x26')](function(_0x5f098b){return[_0x5f098b,!![]];});});}else{throw new Error(_0x9ea9('0x58'));}})[_0x9ea9('0x59')](function(_0xf399be,_0xca075c){if(_0xf399be){_0x58fe16=_0xca075c;if(!_0xca075c){return _0xf399be[_0x9ea9('0x5a')]({'inReplyTo':_0x14f6af['body'][_0x9ea9('0x19')][_0x9ea9('0x4f')],'to':_0x14f6af[_0x9ea9('0x29')]['message'][_0x9ea9('0x32')],'cc':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')]['cc'],'subject':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x51')],'attach':_0xf399be[_0x9ea9('0x52')]?_0xf399be[_0x9ea9('0x52')]:_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x52')],'substatus':null,'substatusAt':moment()[_0x9ea9('0x53')](_0x9ea9('0x54')),'lastMsgAt':moment()[_0x9ea9('0x53')](_0x9ea9('0x54')),'lastMsgDirection':'in'});}else{return _0xf399be;}}})['then'](function(_0x5e6b7f){_0x5ae08a[_0x9ea9('0x5b')]=_0x5e6b7f['get']({'plain':!![]});_0x5ae08a['interaction'][_0x9ea9('0x5c')]=_0x58fe16;return db[_0x9ea9('0x55')][_0x9ea9('0x4c')]({'body':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x29')],'MailAccountId':_0x14f6af[_0x9ea9('0x39')]['id'],'MailInteractionId':_0x5e6b7f['id'],'direction':'in','ContactId':_0x5ae08a['contact']['id'],'messageId':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x4f')],'from':_0x14f6af[_0x9ea9('0x29')]['message'][_0x9ea9('0x32')],'to':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')]['to'],'cc':_0x14f6af[_0x9ea9('0x29')]['message']['cc'],'subject':_0x14f6af['body'][_0x9ea9('0x19')][_0x9ea9('0x51')],'attach':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x52')],'Attachments':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x5d')],'originTo':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')]['originTo'],'originCc':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')]['originCc'],'bcc':_0x14f6af[_0x9ea9('0x29')]['message']['bcc'],'ChatWebsiteId':_0x14f6af[_0x9ea9('0x29')][_0x9ea9('0x19')][_0x9ea9('0x5e')]||null,'originChannel':_0x14f6af[_0x9ea9('0x29')]['message']['originChannel']||_0x9ea9('0x5f'),'ChatOfflineMessageId':_0x14f6af['body'][_0x9ea9('0x19')][_0x9ea9('0x60')]||null},{'include':[{'model':db[_0x9ea9('0x61')],'as':_0x9ea9('0x62')}]});})[_0x9ea9('0x26')](function(_0x1bee9d){_0x5ae08a[_0x9ea9('0x19')]=_0x1bee9d;if(_0x5ae08a['interaction'][_0x9ea9('0x63')]){return db[_0x9ea9('0x64')]['find']({'attributes':['id',_0x9ea9('0x65')],'where':{'id':_0x5ae08a['interaction']['UserId']}})[_0x9ea9('0x26')](function(_0x1291e2){if(_0x1291e2){_0x5ae08a[_0x9ea9('0x42')][_0x9ea9('0x66')]({'id':0x0,'priority':0x0,'app':_0x9ea9('0x67'),'appdata':_0x1291e2[_0x9ea9('0x65')]+','+(_0x5ae08a[_0x9ea9('0x39')][_0x9ea9('0x68')]||0xa),'interval':_0x9ea9('0x4a')});}return respondWithRpcPromise(_0x9ea9('0x69'),_0x9ea9('0x6a'),_0x5ae08a);});}return respondWithRpcPromise(_0x9ea9('0x69'),'startRouting',_0x5ae08a);})[_0x9ea9('0x26')](function(_0x328722){_0x4ec835(_0x328722);})[_0x9ea9('0x1c')](function(_0x34b3d1){_0x329400(_0x1a08cb[_0x9ea9('0x18')](0x1f4,_0x34b3d1[_0x9ea9('0x19')]));});});}; \ No newline at end of file +var _0x1f5a=['createdAt','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','find','account','CmList','DESC','MailApplication','Applications','get','omit','List','applications','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','Contacts','CmContact','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','interaction','attachments','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','startRouting','util','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetMailAccount','ShowMailAccount','then','catch','NotifyMailAccount','body','mail','difference','keys'];(function(_0x1f26a0,_0x3e90cc){var _0x41b1cd=function(_0x5c24b2){while(--_0x5c24b2){_0x1f26a0['push'](_0x1f26a0['shift']());}};_0x41b1cd(++_0x3e90cc);}(_0x1f5a,0xf8));var _0xa1f5=function(_0x553cc5,_0x3816a8){_0x553cc5=_0x553cc5-0x0;var _0x480191=_0x1f5a[_0x553cc5];return _0x480191;};'use strict';var _=require('lodash');var util=require(_0xa1f5('0x0'));var moment=require('moment');var BPromise=require(_0xa1f5('0x1'));var rs=require(_0xa1f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1f5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa1f5('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xa1f5('0x5')][_0xa1f5('0x6')]({'port':0x232c});config['redis']=_[_0xa1f5('0x7')](config['redis'],{'host':_0xa1f5('0x8'),'port':0x18eb});var socket=require(_0xa1f5('0x9'))(new Redis(config[_0xa1f5('0xa')]));require(_0xa1f5('0xb'))['register'](socket);function respondWithRpcPromise(_0x24a2c6,_0x11ab89,_0x2eca3d){return new BPromise(function(_0x11999e,_0x16fb79){return client['request'](_0x24a2c6,_0x2eca3d)['then'](function(_0x3a2fcd){logger[_0xa1f5('0xc')](_0xa1f5('0xd'),_0x11ab89,_0xa1f5('0xe'));logger[_0xa1f5('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x11ab89,_0xa1f5('0xe'),JSON[_0xa1f5('0x10')](_0x3a2fcd));if(_0x3a2fcd['error']){if(_0x3a2fcd[_0xa1f5('0x11')][_0xa1f5('0x12')]===0x1f4){logger['error'](_0xa1f5('0xd'),_0x11ab89,_0x3a2fcd[_0xa1f5('0x11')][_0xa1f5('0x13')]);return _0x16fb79(_0x3a2fcd['error'][_0xa1f5('0x13')]);}logger[_0xa1f5('0x11')](_0xa1f5('0xd'),_0x11ab89,_0x3a2fcd[_0xa1f5('0x11')]['message']);return _0x11999e(_0x3a2fcd['error']['message']);}else{logger['info'](_0xa1f5('0xd'),_0x11ab89,'request\x20sent');_0x11999e(_0x3a2fcd[_0xa1f5('0x14')][_0xa1f5('0x13')]);}})['catch'](function(_0x3e5da6){logger['error']('MailAccount,\x20%s,\x20%s',_0x11ab89,_0x3e5da6);_0x16fb79(_0x3e5da6);});});}exports['GetMailAccount']=function(_0x29ad7f){var _0x4d0493=this;return new Promise(function(_0x52fc8c,_0x1e7e2c){return db[_0xa1f5('0x15')][_0xa1f5('0x16')]({'raw':_0x29ad7f[_0xa1f5('0x17')]?_0x29ad7f['options'][_0xa1f5('0x18')]===undefined?!![]:![]:!![],'where':_0x29ad7f['options']?_0x29ad7f[_0xa1f5('0x17')][_0xa1f5('0x19')]||null:null,'attributes':_0x29ad7f[_0xa1f5('0x17')]?_0x29ad7f[_0xa1f5('0x17')][_0xa1f5('0x1a')]||null:null,'limit':_0x29ad7f['options']?_0x29ad7f[_0xa1f5('0x17')][_0xa1f5('0x1b')]||null:null,'include':_0x29ad7f[_0xa1f5('0x17')]?_0x29ad7f[_0xa1f5('0x17')][_0xa1f5('0x1c')]?_['map'](_0x29ad7f[_0xa1f5('0x17')][_0xa1f5('0x1c')],function(_0x4b906d){return{'model':db[_0x4b906d[_0xa1f5('0x1d')]],'as':_0x4b906d['as'],'attributes':_0x4b906d[_0xa1f5('0x1a')],'include':_0x4b906d[_0xa1f5('0x1c')]?_[_0xa1f5('0x1e')](_0x4b906d['include'],function(_0x3a9321){return{'model':db[_0x3a9321[_0xa1f5('0x1d')]],'as':_0x3a9321['as'],'attributes':_0x3a9321[_0xa1f5('0x1a')],'include':_0x3a9321[_0xa1f5('0x1c')]?_[_0xa1f5('0x1e')](_0x3a9321[_0xa1f5('0x1c')],function(_0x3b833f){return{'model':db[_0x3b833f[_0xa1f5('0x1d')]],'as':_0x3b833f['as'],'attributes':_0x3b833f[_0xa1f5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd39566){logger[_0xa1f5('0xc')](_0xa1f5('0x1f'),_0x29ad7f);logger[_0xa1f5('0xf')](_0xa1f5('0x1f'),_0x29ad7f,JSON['stringify'](_0xd39566));_0x52fc8c(_0xd39566);})['catch'](function(_0x4c29f8){logger[_0xa1f5('0x11')](_0xa1f5('0x1f'),_0x4c29f8[_0xa1f5('0x13')],_0x29ad7f);_0x1e7e2c(_0x4d0493[_0xa1f5('0x11')](0x1f4,_0x4c29f8[_0xa1f5('0x13')]));});});};exports[_0xa1f5('0x20')]=function(_0x5502d0){var _0x44e1b0=this;return new Promise(function(_0x15b4e6,_0x1b1f5e){return db[_0xa1f5('0x15')]['find']({'raw':_0x5502d0[_0xa1f5('0x17')]?_0x5502d0[_0xa1f5('0x17')][_0xa1f5('0x18')]===undefined?!![]:![]:!![],'where':_0x5502d0[_0xa1f5('0x17')]?_0x5502d0[_0xa1f5('0x17')][_0xa1f5('0x19')]||null:null,'attributes':_0x5502d0[_0xa1f5('0x17')]?_0x5502d0['options']['attributes']||null:null,'include':_0x5502d0[_0xa1f5('0x17')]?_0x5502d0[_0xa1f5('0x17')][_0xa1f5('0x1c')]?_[_0xa1f5('0x1e')](_0x5502d0[_0xa1f5('0x17')][_0xa1f5('0x1c')],function(_0x184b63){return{'model':db[_0x184b63[_0xa1f5('0x1d')]],'as':_0x184b63['as'],'attributes':_0x184b63[_0xa1f5('0x1a')],'include':_0x184b63[_0xa1f5('0x1c')]?_['map'](_0x184b63[_0xa1f5('0x1c')],function(_0x354f79){return{'model':db[_0x354f79['model']],'as':_0x354f79['as'],'attributes':_0x354f79[_0xa1f5('0x1a')],'include':_0x354f79[_0xa1f5('0x1c')]?_[_0xa1f5('0x1e')](_0x354f79['include'],function(_0x340ec3){return{'model':db[_0x340ec3[_0xa1f5('0x1d')]],'as':_0x340ec3['as'],'attributes':_0x340ec3[_0xa1f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1f5('0x21')](function(_0x3aea9c){logger[_0xa1f5('0xc')](_0xa1f5('0x20'),_0x5502d0);logger['debug'](_0xa1f5('0x20'),_0x5502d0,JSON[_0xa1f5('0x10')](_0x3aea9c));_0x15b4e6(_0x3aea9c);})[_0xa1f5('0x22')](function(_0x65b52){logger[_0xa1f5('0x11')]('ShowMailAccount',_0x65b52[_0xa1f5('0x13')],_0x5502d0);_0x1b1f5e(_0x44e1b0[_0xa1f5('0x11')](0x1f4,_0x65b52[_0xa1f5('0x13')]));});});};exports[_0xa1f5('0x23')]=function(_0x18d6f3){var _0x39c639=this;return new Promise(function(_0x52d020,_0x32a20a){var _0x278284={'body':_0x18d6f3[_0xa1f5('0x24')],'channel':_0xa1f5('0x25')};var _0x42e261=_[_0xa1f5('0x26')](_[_0xa1f5('0x27')](db['CmContact']['rawAttributes']),[_0xa1f5('0x28'),_0xa1f5('0x29'),'CompanyId',_0xa1f5('0x2a')]);var _0x1225fb=![];if(_0x18d6f3[_0xa1f5('0x24')]['id']){delete _0x18d6f3[_0xa1f5('0x24')]['id'];}if(_[_0xa1f5('0x2b')](_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x2c')])){return _0x32a20a(_0x39c639[_0xa1f5('0x11')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x24')])||_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x24')]===''){return _0x32a20a(_0x39c639[_0xa1f5('0x11')](0x1f4,_0xa1f5('0x2d')));}if(_[_0xa1f5('0x2b')](_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x2e')])){return _0x32a20a(_0x39c639['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x42e261));}if(!_[_0xa1f5('0x2f')](_0x42e261,_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x2e')])){return _0x32a20a(_0x39c639[_0xa1f5('0x11')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x42e261));}var _0x3e23a7={};_0x3e23a7[_0x18d6f3['body'][_0xa1f5('0x2e')]]=_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x2c')];return db[_0xa1f5('0x15')][_0xa1f5('0x30')]({'where':{'id':_0x18d6f3[_0xa1f5('0x31')]['id']},'include':[{'model':db[_0xa1f5('0x32')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3e23a7,'limit':0x1,'order':[[_0xa1f5('0x29'),_0xa1f5('0x33')]]}]},{'model':db[_0xa1f5('0x34')],'as':_0xa1f5('0x35')},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xa1f5('0x21')](function(_0x451526){if(_0x451526&&_0x451526['List']){var _0x310547=_0x451526[_0xa1f5('0x36')]({'plain':!![]});_0x278284[_0xa1f5('0x31')]=_[_0xa1f5('0x37')](_0x310547,['Applications',_0xa1f5('0x38')]);_0x278284[_0xa1f5('0x39')]=_0x310547[_0xa1f5('0x35')];_0x278284['list']=_0x310547['List'];_0x278284[_0xa1f5('0x39')]=_[_0xa1f5('0x3a')](_0x278284['applications'],[_0xa1f5('0x3b')],[_0xa1f5('0x3c')]);if(_0x278284[_0xa1f5('0x31')]&&_0x278284['account']['autoclose']){_0x278284[_0xa1f5('0x39')][_0xa1f5('0x3d')]({'id':0x0,'priority':_0x278284[_0xa1f5('0x39')][_0xa1f5('0x3e')]+0x1,'app':_0xa1f5('0x3f'),'appdata':_0xa1f5('0x40'),'interval':_0xa1f5('0x41')});}if(_0x278284[_0xa1f5('0x31')][_0xa1f5('0x35')]){delete _0x278284['account'][_0xa1f5('0x35')];}if(_0x278284[_0xa1f5('0x31')][_0xa1f5('0x38')]){delete _0x278284['account']['List'];}if(_0x310547[_0xa1f5('0x38')][_0xa1f5('0x42')][_0xa1f5('0x3e')]){return _0x310547[_0xa1f5('0x38')]['Contacts'][0x0];}var _0x3cf55a=_[_0xa1f5('0x7')](_0x18d6f3[_0xa1f5('0x24')],{'firstName':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x2c')],'ListId':_0x310547[_0xa1f5('0x2a')]});_0x3cf55a[_0x18d6f3['body'][_0xa1f5('0x2e')]]=_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x2c')];return db[_0xa1f5('0x43')][_0xa1f5('0x44')](_0x3cf55a);}else{throw new Error(_0xa1f5('0x45'));}})[_0xa1f5('0x21')](function(_0x4fb5f6){_0x278284[_0xa1f5('0x46')]=_0x4fb5f6;if(_0x4fb5f6){if(!_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')]['messageId']){_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x47')]=rs[_0xa1f5('0x48')]()+'\x20'+_0x18d6f3[_0xa1f5('0x24')]['message'][_0xa1f5('0x2c')];}var _0x142ca1={'ContactId':_0x4fb5f6['id'],'MailAccountId':_0x18d6f3[_0xa1f5('0x31')]['id'],'inReplyTo':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x47')],'to':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')]['from'],'cc':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')]['cc'],'subject':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x49')],'attach':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x4a')],'lastMsgAt':moment()[_0xa1f5('0x4b')](_0xa1f5('0x4c')),'lastMsgDirection':'in'};return db[_0xa1f5('0x4d')][_0xa1f5('0x30')]({'where':{'closed':![],'MailAccountId':_0x18d6f3['account']['id']},'include':[{'model':db[_0xa1f5('0x4e')],'as':_0xa1f5('0x4f'),'attributes':[_0xa1f5('0x47')],'where':{'messageId':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x50')]}}]})[_0xa1f5('0x21')](function(_0x2bae94){if(_0x2bae94){return[_0x2bae94,![]];}return db[_0xa1f5('0x4d')][_0xa1f5('0x44')](_0x142ca1)[_0xa1f5('0x21')](function(_0x552b70){return[_0x552b70,!![]];});});}else{throw new Error(_0xa1f5('0x51'));}})[_0xa1f5('0x52')](function(_0xa6b6a3,_0x1cfdf7){if(_0xa6b6a3){_0x1225fb=_0x1cfdf7;if(!_0x1cfdf7){return _0xa6b6a3['update']({'inReplyTo':_0x18d6f3['body'][_0xa1f5('0x13')][_0xa1f5('0x47')],'to':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x2c')],'cc':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')]['cc'],'subject':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x49')],'attach':_0xa6b6a3[_0xa1f5('0x4a')]?_0xa6b6a3[_0xa1f5('0x4a')]:_0x18d6f3['body'][_0xa1f5('0x13')][_0xa1f5('0x4a')],'substatus':null,'substatusAt':moment()[_0xa1f5('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0xa6b6a3;}}})[_0xa1f5('0x21')](function(_0x40fa91){_0x278284['interaction']=_0x40fa91[_0xa1f5('0x36')]({'plain':!![]});_0x278284[_0xa1f5('0x53')]['created']=_0x1225fb;return db[_0xa1f5('0x4e')]['create']({'body':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x24')],'MailAccountId':_0x18d6f3['account']['id'],'MailInteractionId':_0x40fa91['id'],'direction':'in','ContactId':_0x278284[_0xa1f5('0x46')]['id'],'messageId':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x47')],'from':_0x18d6f3['body'][_0xa1f5('0x13')][_0xa1f5('0x2c')],'to':_0x18d6f3[_0xa1f5('0x24')]['message']['to'],'cc':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')]['cc'],'subject':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x49')],'attach':_0x18d6f3['body']['message']['attach'],'Attachments':_0x18d6f3[_0xa1f5('0x24')]['message'][_0xa1f5('0x54')],'originTo':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')]['originTo'],'originCc':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x55')],'bcc':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')]['bcc'],'ChatWebsiteId':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x56')]||null,'originChannel':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x57')]||_0xa1f5('0x58'),'ChatOfflineMessageId':_0x18d6f3[_0xa1f5('0x24')][_0xa1f5('0x13')][_0xa1f5('0x59')]||null},{'include':[{'model':db['Attachment'],'as':_0xa1f5('0x5a')}]});})[_0xa1f5('0x21')](function(_0x10383c){_0x278284['message']=_0x10383c;if(_0x278284[_0xa1f5('0x53')][_0xa1f5('0x5b')]){return db['User'][_0xa1f5('0x30')]({'attributes':['id',_0xa1f5('0x5c')],'where':{'id':_0x278284[_0xa1f5('0x53')]['UserId']}})[_0xa1f5('0x21')](function(_0xf9e7c5){if(_0xf9e7c5){_0x278284[_0xa1f5('0x39')][_0xa1f5('0x5d')]({'id':0x0,'priority':0x0,'app':_0xa1f5('0x5e'),'appdata':_0xf9e7c5[_0xa1f5('0x5c')]+','+(_0x278284['account']['waitForTheAssignedAgent']||0xa),'interval':_0xa1f5('0x41')});}return respondWithRpcPromise('Start',_0xa1f5('0x5f'),_0x278284);});}return respondWithRpcPromise('Start',_0xa1f5('0x5f'),_0x278284);})[_0xa1f5('0x21')](function(_0x472434){_0x52d020(_0x472434);})[_0xa1f5('0x22')](function(_0x14d259){_0x32a20a(_0x39c639['error'](0x1f4,_0x14d259[_0xa1f5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1ecbaa1..e8ab5b9 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 _0xcdd6=['emit','removeListener','length','./mailAccount.events','save','update'];(function(_0x4a3d99,_0x4b8c4b){var _0x4c78c8=function(_0x5b18e4){while(--_0x5b18e4){_0x4a3d99['push'](_0x4a3d99['shift']());}};_0x4c78c8(++_0x4b8c4b);}(_0xcdd6,0x177));var _0x6cdd=function(_0x70c37,_0x16d0ae){_0x70c37=_0x70c37-0x0;var _0x90c3f7=_0xcdd6[_0x70c37];return _0x90c3f7;};'use strict';var MailAccountEvents=require(_0x6cdd('0x0'));var events=[_0x6cdd('0x1'),'remove',_0x6cdd('0x2')];function createListener(_0x48202e,_0x1dbb41){return function(_0x25c17c){_0x1dbb41[_0x6cdd('0x3')](_0x48202e,_0x25c17c);};}function removeListener(_0x548b5d,_0x4500de){return function(){MailAccountEvents[_0x6cdd('0x4')](_0x548b5d,_0x4500de);};}exports['register']=function(_0x3a1f86){for(var _0x350ad6=0x0,_0x350b6c=events[_0x6cdd('0x5')];_0x350ad6<_0x350b6c;_0x350ad6++){var _0x41ee4e=events[_0x350ad6];var _0x19426c=createListener('mailAccount:'+_0x41ee4e,_0x3a1f86);MailAccountEvents['on'](_0x41ee4e,_0x19426c);}}; \ No newline at end of file +var _0xa664=['update','removeListener','register','length','mailAccount:','save','remove'];(function(_0x155232,_0x834d44){var _0x2edc07=function(_0x483b2f){while(--_0x483b2f){_0x155232['push'](_0x155232['shift']());}};_0x2edc07(++_0x834d44);}(_0xa664,0x132));var _0x4a66=function(_0x59ef16,_0x39e718){_0x59ef16=_0x59ef16-0x0;var _0x39b70f=_0xa664[_0x59ef16];return _0x39b70f;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x4a66('0x0'),_0x4a66('0x1'),_0x4a66('0x2')];function createListener(_0x293039,_0x5b1cd9){return function(_0x2a4e18){_0x5b1cd9['emit'](_0x293039,_0x2a4e18);};}function removeListener(_0x49f17c,_0x12b396){return function(){MailAccountEvents[_0x4a66('0x3')](_0x49f17c,_0x12b396);};}exports[_0x4a66('0x4')]=function(_0x2661f8){for(var _0x3dd553=0x0,_0x3fe28c=events[_0x4a66('0x5')];_0x3dd553<_0x3fe28c;_0x3dd553++){var _0x521808=events[_0x3dd553];var _0x4484c5=createListener(_0x4a66('0x6')+_0x521808,_0x2661f8);MailAccountEvents['on'](_0x521808,_0x4484c5);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 4e87728..776bfdc 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 _0x079a=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x8c3c9e,_0x5669c0){var _0x3ab3ec=function(_0x49b629){while(--_0x49b629){_0x8c3c9e['push'](_0x8c3c9e['shift']());}};_0x3ab3ec(++_0x5669c0);}(_0x079a,0x16e));var _0xa079=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x079a[_0x4e676e];return _0x336a3c;};'use strict';var multer=require('multer');var util=require(_0xa079('0x0'));var path=require(_0xa079('0x1'));var timeout=require(_0xa079('0x2'));var express=require(_0xa079('0x3'));var router=express[_0xa079('0x4')]();var fs_extra=require(_0xa079('0x5'));var auth=require(_0xa079('0x6'));var interaction=require(_0xa079('0x7'));var config=require('../../config/environment');var controller=require(_0xa079('0x8'));router[_0xa079('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['put'](_0xa079('0xa'),auth[_0xa079('0xb')](),controller['update']);router[_0xa079('0xc')](_0xa079('0xa'),auth[_0xa079('0xb')](),controller[_0xa079('0xd')]);module['exports']=router; \ No newline at end of file +var _0x36d8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','multer'];(function(_0x2d45a0,_0x4c1f6b){var _0x216510=function(_0x12f092){while(--_0x12f092){_0x2d45a0['push'](_0x2d45a0['shift']());}};_0x216510(++_0x4c1f6b);}(_0x36d8,0x11f));var _0x836d=function(_0x376bf2,_0x5d64ed){_0x376bf2=_0x376bf2-0x0;var _0x39ee04=_0x36d8[_0x376bf2];return _0x39ee04;};'use strict';var multer=require(_0x836d('0x0'));var util=require('util');var path=require(_0x836d('0x1'));var timeout=require(_0x836d('0x2'));var express=require('express');var router=express[_0x836d('0x3')]();var fs_extra=require(_0x836d('0x4'));var auth=require(_0x836d('0x5'));var interaction=require(_0x836d('0x6'));var config=require(_0x836d('0x7'));var controller=require(_0x836d('0x8'));router[_0x836d('0x9')](_0x836d('0xa'),auth[_0x836d('0xb')](),controller[_0x836d('0xc')]);router[_0x836d('0xd')](_0x836d('0xa'),auth[_0x836d('0xb')](),controller[_0x836d('0xe')]);router[_0x836d('0xf')](_0x836d('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 5be62ba..094d995 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 _0xbfc8=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xbfc8,0x86));var _0x8bfc=function(_0x1f9f03,_0x4077ea){_0x1f9f03=_0x1f9f03-0x0;var _0x4855d8=_0xbfc8[_0x1f9f03];return _0x4855d8;};'use strict';var Sequelize=require(_0x8bfc('0x0'));module[_0x8bfc('0x1')]={'priority':{'type':Sequelize[_0x8bfc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8bfc('0x3')},'appdata':{'type':Sequelize[_0x8bfc('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8bfc('0x5')],'defaultValue':_0x8bfc('0x6')}}; \ No newline at end of file +var _0x37de=['sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0x37de,0x1ef));var _0xe37d=function(_0x34537f,_0x213a48){_0x34537f=_0x34537f-0x0;var _0x4bc478=_0x37de[_0x34537f];return _0x4bc478;};'use strict';var Sequelize=require(_0xe37d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe37d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe37d('0x2')],'allowNull':![],'defaultValue':_0xe37d('0x3')},'appdata':{'type':Sequelize[_0xe37d('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe37d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 243e9ed..281aed1 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x269358,_0x49a73e){var _0x585b7e=function(_0x136225){while(--_0x136225){_0x269358['push'](_0x269358['shift']());}};_0x585b7e(++_0x49a73e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0xcb91[_0x44fef1];return _0x3c3a04;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x3ae80,_0x44966e){var _0x4ef7ec=function(_0x5d3ac8){while(--_0x5d3ac8){_0x3ae80['push'](_0x3ae80['shift']());}};_0x4ef7ec(++_0x44966e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x72d46,_0x407a95){_0x72d46=_0x72d46-0x0;var _0x1a1bfd=_0xb43b[_0x72d46];return _0x1a1bfd;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1c9fa87..abdbbc1 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 _0xbdc7=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xbdc7,0x18f));var _0x7bdc=function(_0x30969e,_0x13e167){_0x30969e=_0x30969e-0x0;var _0x1ede28=_0xbdc7[_0x30969e];return _0x1ede28;};'use strict';var _=require(_0x7bdc('0x0'));var util=require(_0x7bdc('0x1'));var logger=require(_0x7bdc('0x2'))('api');var moment=require(_0x7bdc('0x3'));var BPromise=require(_0x7bdc('0x4'));var rp=require(_0x7bdc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bdc('0x6'));var config=require(_0x7bdc('0x7'));var attributes=require(_0x7bdc('0x8'));module[_0x7bdc('0x9')]=function(_0x2feb4f,_0x549d23){return _0x2feb4f[_0x7bdc('0xa')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bdc('0xb'),'collate':_0x7bdc('0xc')});}; \ No newline at end of file +var _0x99ef=['utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x2a2e1b,_0x533801){var _0xd4402b=function(_0x5eb43f){while(--_0x5eb43f){_0x2a2e1b['push'](_0x2a2e1b['shift']());}};_0xd4402b(++_0x533801);}(_0x99ef,0x1c9));var _0xf99e=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x99ef[_0x74892f];return _0x10ee61;};'use strict';var _=require(_0xf99e('0x0'));var util=require('util');var logger=require(_0xf99e('0x1'))(_0xf99e('0x2'));var moment=require(_0xf99e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf99e('0x4'));var fs=require('fs');var path=require(_0xf99e('0x5'));var rimraf=require(_0xf99e('0x6'));var config=require(_0xf99e('0x7'));var attributes=require(_0xf99e('0x8'));module[_0xf99e('0x9')]=function(_0x3c93a3,_0x468ac0){return _0x3c93a3[_0xf99e('0xa')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf99e('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 19f7e97..3702be1 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 _0xe3ed=['../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','attributes','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4da64f,_0x27d4de){var _0x23c0e6=function(_0x4d0f74){while(--_0x4d0f74){_0x4da64f['push'](_0x4da64f['shift']());}};_0x23c0e6(++_0x27d4de);}(_0xe3ed,0x1d5));var _0xde3e=function(_0x5dbfec,_0x2e5444){_0x5dbfec=_0x5dbfec-0x0;var _0xa8f1a6=_0xe3ed[_0x5dbfec];return _0xa8f1a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde3e('0x0'));var BPromise=require(_0xde3e('0x1'));var rs=require(_0xde3e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde3e('0x3'))['db'];var utils=require(_0xde3e('0x4'));var logger=require(_0xde3e('0x5'))(_0xde3e('0x6'));var config=require(_0xde3e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xde3e('0x8')][_0xde3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a2cc5,_0x5c9114,_0x2d956c){return new BPromise(function(_0x4f906b,_0x279509){return client[_0xde3e('0xa')](_0x3a2cc5,_0x2d956c)[_0xde3e('0xb')](function(_0x35f514){logger[_0xde3e('0xc')](_0xde3e('0xd'),_0x5c9114,_0xde3e('0xe'));logger[_0xde3e('0xf')](_0xde3e('0x10'),_0x5c9114,_0xde3e('0xe'),JSON[_0xde3e('0x11')](_0x35f514));if(_0x35f514['error']){if(_0x35f514[_0xde3e('0x12')][_0xde3e('0x13')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x5c9114,_0x35f514[_0xde3e('0x12')]['message']);return _0x279509(_0x35f514[_0xde3e('0x12')][_0xde3e('0x14')]);}logger[_0xde3e('0x12')]('MailApplication,\x20%s,\x20%s',_0x5c9114,_0x35f514[_0xde3e('0x12')]['message']);return _0x4f906b(_0x35f514[_0xde3e('0x12')][_0xde3e('0x14')]);}else{logger[_0xde3e('0xc')]('MailApplication,\x20%s,\x20%s',_0x5c9114,_0xde3e('0xe'));_0x4f906b(_0x35f514[_0xde3e('0x15')][_0xde3e('0x14')]);}})[_0xde3e('0x16')](function(_0x348661){logger[_0xde3e('0x12')]('MailApplication,\x20%s,\x20%s',_0x5c9114,_0x348661);_0x279509(_0x348661);});});}exports[_0xde3e('0x17')]=function(_0x5b2a72){var _0x940393=this;return new Promise(function(_0x5a92fa,_0x43ca72){return db['MailApplication'][_0xde3e('0x18')](_0x5b2a72[_0xde3e('0x19')],{'raw':_0x5b2a72[_0xde3e('0x1a')]?_0x5b2a72[_0xde3e('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2a72[_0xde3e('0x1a')]?_0x5b2a72[_0xde3e('0x1a')]['where']||null:null,'attributes':_0x5b2a72[_0xde3e('0x1a')]?_0x5b2a72[_0xde3e('0x1a')][_0xde3e('0x1b')]||null:null,'limit':_0x5b2a72['options']?_0x5b2a72['options']['limit']||null:null})[_0xde3e('0xb')](function(_0x3b67f1){logger[_0xde3e('0xc')](_0xde3e('0x17'),_0x5b2a72);logger[_0xde3e('0xf')]('UpdateMailApplication',_0x5b2a72,JSON[_0xde3e('0x11')](_0x3b67f1));_0x5a92fa(_0x3b67f1);})[_0xde3e('0x16')](function(_0x38d494){logger[_0xde3e('0x12')](_0xde3e('0x17'),_0x38d494['message'],_0x5b2a72);_0x43ca72(_0x940393[_0xde3e('0x12')](0x1f4,_0x38d494[_0xde3e('0x14')]));});});}; \ No newline at end of file +var _0xe43e=['where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','UpdateMailApplication','raw','options'];(function(_0x39df23,_0x587e5b){var _0x3f812d=function(_0x58300c){while(--_0x58300c){_0x39df23['push'](_0x39df23['shift']());}};_0x3f812d(++_0x587e5b);}(_0xe43e,0x18a));var _0xee43=function(_0x34f82a,_0x2458d6){_0x34f82a=_0x34f82a-0x0;var _0x1c9c1f=_0xe43e[_0x34f82a];return _0x1c9c1f;};'use strict';var _=require(_0xee43('0x0'));var util=require(_0xee43('0x1'));var moment=require(_0xee43('0x2'));var BPromise=require(_0xee43('0x3'));var rs=require(_0xee43('0x4'));var fs=require('fs');var Redis=require(_0xee43('0x5'));var db=require(_0xee43('0x6'))['db'];var utils=require(_0xee43('0x7'));var logger=require(_0xee43('0x8'))('rpc');var config=require(_0xee43('0x9'));var jayson=require(_0xee43('0xa'));var client=jayson[_0xee43('0xb')][_0xee43('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21ef52,_0x4c90ae,_0xd95b80){return new BPromise(function(_0x45ae30,_0x34f249){return client[_0xee43('0xd')](_0x21ef52,_0xd95b80)['then'](function(_0x4f6658){logger[_0xee43('0xe')](_0xee43('0xf'),_0x4c90ae,'request\x20sent');logger[_0xee43('0x10')](_0xee43('0x11'),_0x4c90ae,_0xee43('0x12'),JSON['stringify'](_0x4f6658));if(_0x4f6658['error']){if(_0x4f6658['error'][_0xee43('0x13')]===0x1f4){logger[_0xee43('0x14')](_0xee43('0xf'),_0x4c90ae,_0x4f6658[_0xee43('0x14')][_0xee43('0x15')]);return _0x34f249(_0x4f6658[_0xee43('0x14')]['message']);}logger['error'](_0xee43('0xf'),_0x4c90ae,_0x4f6658[_0xee43('0x14')][_0xee43('0x15')]);return _0x45ae30(_0x4f6658['error'][_0xee43('0x15')]);}else{logger[_0xee43('0xe')](_0xee43('0xf'),_0x4c90ae,_0xee43('0x12'));_0x45ae30(_0x4f6658[_0xee43('0x16')]['message']);}})['catch'](function(_0x20769d){logger['error'](_0xee43('0xf'),_0x4c90ae,_0x20769d);_0x34f249(_0x20769d);});});}exports[_0xee43('0x17')]=function(_0x1886bc){var _0xf2fd8d=this;return new Promise(function(_0x3e5550,_0x4801ee){return db['MailApplication']['update'](_0x1886bc['body'],{'raw':_0x1886bc['options']?_0x1886bc['options'][_0xee43('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1886bc[_0xee43('0x19')]?_0x1886bc['options'][_0xee43('0x1a')]||null:null,'attributes':_0x1886bc[_0xee43('0x19')]?_0x1886bc[_0xee43('0x19')]['attributes']||null:null,'limit':_0x1886bc[_0xee43('0x19')]?_0x1886bc[_0xee43('0x19')]['limit']||null:null})['then'](function(_0x2be112){logger['info'](_0xee43('0x17'),_0x1886bc);logger[_0xee43('0x10')](_0xee43('0x17'),_0x1886bc,JSON['stringify'](_0x2be112));_0x3e5550(_0x2be112);})[_0xee43('0x1b')](function(_0x421803){logger[_0xee43('0x14')](_0xee43('0x17'),_0x421803[_0xee43('0x15')],_0x1886bc);_0x4801ee(_0xf2fd8d[_0xee43('0x14')](0x1f4,_0x421803['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 009a5a9..b28035e 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 _0x711f=['show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','destroy','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x2106ce,_0x449daa){var _0x42c114=function(_0x1fc9bd){while(--_0x1fc9bd){_0x2106ce['push'](_0x2106ce['shift']());}};_0x42c114(++_0x449daa);}(_0x711f,0x145));var _0xf711=function(_0x597207,_0x3244c0){_0x597207=_0x597207-0x0;var _0x1b9743=_0x711f[_0x597207];return _0x1b9743;};'use strict';var express=require(_0xf711('0x0'));var router=express[_0xf711('0x1')]();var auth=require(_0xf711('0x2'));var interaction=require(_0xf711('0x3'));var controller=require(_0xf711('0x4'));router[_0xf711('0x5')]('/',auth['isAuthenticated'](),controller[_0xf711('0x6')]);router['get'](_0xf711('0x7'),auth['isAuthenticated'](),controller[_0xf711('0x8')]);router['get'](_0xf711('0x9'),auth[_0xf711('0xa')](),controller[_0xf711('0xb')]);router[_0xf711('0x5')](_0xf711('0xc'),auth[_0xf711('0xa')](),controller['getMessages']);router[_0xf711('0x5')](_0xf711('0xd'),auth[_0xf711('0xa')](),controller[_0xf711('0xe')]);router[_0xf711('0xf')]('/',auth[_0xf711('0xa')](),controller[_0xf711('0x10')]);router[_0xf711('0xf')](_0xf711('0xc'),auth[_0xf711('0xa')](),controller[_0xf711('0x11')]);router['post'](_0xf711('0x12'),auth['isAuthenticated'](),interaction[_0xf711('0x13')](_0xf711('0x14'),_0xf711('0x15')),controller[_0xf711('0x16')]);router[_0xf711('0x17')](_0xf711('0x9'),auth[_0xf711('0xa')](),interaction[_0xf711('0x13')]('mail',_0xf711('0x18')),controller[_0xf711('0x19')]);router[_0xf711('0x1a')](_0xf711('0x9'),auth[_0xf711('0xa')](),interaction['tracked'](_0xf711('0x14'),'mailinteraction:destroy'),controller[_0xf711('0x1b')]);router[_0xf711('0x1a')](_0xf711('0x12'),auth[_0xf711('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xa80f=['/describe','describe','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','/:id','mailinteraction:update','mailinteraction:destroy','delete','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x14cba5,_0x6ccd9c){var _0x4771d5=function(_0x3ff99b){while(--_0x3ff99b){_0x14cba5['push'](_0x14cba5['shift']());}};_0x4771d5(++_0x6ccd9c);}(_0xa80f,0xdf));var _0xfa80=function(_0x38dca6,_0x471cb7){_0x38dca6=_0x38dca6-0x0;var _0x29bcd7=_0xa80f[_0x38dca6];return _0x29bcd7;};'use strict';var express=require(_0xfa80('0x0'));var router=express[_0xfa80('0x1')]();var auth=require(_0xfa80('0x2'));var interaction=require(_0xfa80('0x3'));var controller=require(_0xfa80('0x4'));router[_0xfa80('0x5')]('/',auth[_0xfa80('0x6')](),controller['index']);router[_0xfa80('0x5')](_0xfa80('0x7'),auth[_0xfa80('0x6')](),controller[_0xfa80('0x8')]);router['get']('/:id',auth[_0xfa80('0x6')](),controller['show']);router['get'](_0xfa80('0x9'),auth['isAuthenticated'](),controller[_0xfa80('0xa')]);router[_0xfa80('0x5')]('/:id/download',auth[_0xfa80('0x6')](),controller['download']);router[_0xfa80('0xb')]('/',auth['isAuthenticated'](),controller[_0xfa80('0xc')]);router[_0xfa80('0xb')](_0xfa80('0x9'),auth[_0xfa80('0x6')](),controller[_0xfa80('0xd')]);router[_0xfa80('0xb')](_0xfa80('0xe'),auth[_0xfa80('0x6')](),interaction[_0xfa80('0xf')](_0xfa80('0x10'),_0xfa80('0x11')),controller[_0xfa80('0x12')]);router['put'](_0xfa80('0x13'),auth[_0xfa80('0x6')](),interaction[_0xfa80('0xf')](_0xfa80('0x10'),_0xfa80('0x14')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xfa80('0xf')](_0xfa80('0x10'),_0xfa80('0x15')),controller['destroy']);router[_0xfa80('0x16')](_0xfa80('0xe'),auth[_0xfa80('0x6')](),controller['removeTags']);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 ebeb363..1dd3006 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 _0x8a3d=['long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x19e442,_0x13836b){var _0x3669d4=function(_0x40d6bf){while(--_0x40d6bf){_0x19e442['push'](_0x19e442['shift']());}};_0x3669d4(++_0x13836b);}(_0x8a3d,0xd5));var _0xd8a3=function(_0x2ec278,_0x1dd484){_0x2ec278=_0x2ec278-0x0;var _0x59ba0e=_0x8a3d[_0x2ec278];return _0x59ba0e;};'use strict';var Sequelize=require(_0xd8a3('0x0'));var iconv=require(_0xd8a3('0x1'));module[_0xd8a3('0x2')]={'closed':{'type':Sequelize[_0xd8a3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8a3('0x4')]},'disposition':{'type':Sequelize[_0xd8a3('0x5')]},'secondDisposition':{'type':Sequelize[_0xd8a3('0x5')]},'thirdDisposition':{'type':Sequelize[_0xd8a3('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xd8a3('0x5')](0x1fe)},'to':{'type':Sequelize[_0xd8a3('0x5')]},'cc':{'type':Sequelize[_0xd8a3('0x6')](_0xd8a3('0x7'))},'subject':{'type':Sequelize[_0xd8a3('0x6')]()},'attach':{'type':Sequelize[_0xd8a3('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd8a3('0x4')]},'substatus':{'type':Sequelize[_0xd8a3('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xd8a3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd8a3('0x8')]('in',_0xd8a3('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd8a3('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd8a3('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd8a3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7f2d=['TEXT','long','ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING'];(function(_0x2fc5d4,_0x514199){var _0x3b273c=function(_0x46665a){while(--_0x46665a){_0x2fc5d4['push'](_0x2fc5d4['shift']());}};_0x3b273c(++_0x514199);}(_0x7f2d,0x1ea));var _0xd7f2=function(_0x337ca8,_0x2a7b60){_0x337ca8=_0x337ca8-0x0;var _0xd50979=_0x7f2d[_0x337ca8];return _0xd50979;};'use strict';var Sequelize=require(_0xd7f2('0x0'));var iconv=require(_0xd7f2('0x1'));module['exports']={'closed':{'type':Sequelize[_0xd7f2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd7f2('0x3')]},'disposition':{'type':Sequelize[_0xd7f2('0x4')]},'secondDisposition':{'type':Sequelize[_0xd7f2('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xd7f2('0x4')]},'cc':{'type':Sequelize[_0xd7f2('0x5')](_0xd7f2('0x6'))},'subject':{'type':Sequelize[_0xd7f2('0x5')]()},'attach':{'type':Sequelize[_0xd7f2('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd7f2('0x3')]},'substatus':{'type':Sequelize[_0xd7f2('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xd7f2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd7f2('0x7')]('in',_0xd7f2('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd7f2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd7f2('0x7')]('in',_0xd7f2('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 1f0bb4b..eee51f1 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 _0x1033=['name','send','Users','map','TagIds','split','forEach','Tags','push','MailMessage','findOne','out','-id','trimStart','plainBody','catch','index','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','text','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','isEmpty','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','enableEmailPreview','all','rows','show','params','MailInteraction','rawAttributes','includeAll','include','options','create','body','destroy','describe','addMessage','ids','getMessages','pick','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','get','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','build','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','sendStatus','offset','undefined','limit','count','status','set','update','then','end','stack'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x1033,0x1b3));var _0x3103=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x1033[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0x3103('0x0'));var rimraf=require(_0x3103('0x1'));var zipdir=require(_0x3103('0x2'));var moment=require(_0x3103('0x3'));var BPromise=require(_0x3103('0x4'));var util=require(_0x3103('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x3103('0x6'));var squel=require(_0x3103('0x7'));var juice=require(_0x3103('0x8'));var Redis=require(_0x3103('0x9'));var qs=require(_0x3103('0xa'));var as=require(_0x3103('0xb'));var logger=require(_0x3103('0xc'))(_0x3103('0xd'));var config=require('../../config/environment');var db=require(_0x3103('0xe'))['db'];var htmlEntities=require(_0x3103('0xf'));config['redis']=_[_0x3103('0x10')](config[_0x3103('0x11')],{'host':_0x3103('0x12'),'port':0x18eb});var socket=require(_0x3103('0x13'))(new Redis(config[_0x3103('0x11')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x30aeee,_0x1d1535){_0x1d1535=_0x1d1535||0xcc;return function(_0x3ce172){if(_0x3ce172){return _0x30aeee[_0x3103('0x14')](_0x1d1535);}return _0x30aeee['status'](_0x1d1535)['end']();};}function respondWithResult(_0x147e80,_0x2dba2f){_0x2dba2f=_0x2dba2f||0xc8;return function(_0x244410){if(_0x244410){return _0x147e80['status'](_0x2dba2f)['json'](_0x244410);}};}function respondWithFilteredResult(_0x2c9545,_0x5ec7b5){return function(_0x38c996){if(_0x38c996){var _0x356f7b=typeof _0x5ec7b5[_0x3103('0x15')]===_0x3103('0x16')&&typeof _0x5ec7b5[_0x3103('0x17')]===_0x3103('0x16');var _0x473833=_0x38c996[_0x3103('0x18')];var _0x423ec6=_0x356f7b?0x0:_0x5ec7b5[_0x3103('0x15')];var _0xbcb30c=_0x356f7b?_0x38c996[_0x3103('0x18')]:_0x5ec7b5[_0x3103('0x15')]+_0x5ec7b5[_0x3103('0x17')];var _0x2178f4;if(_0xbcb30c>=_0x473833){_0xbcb30c=_0x473833;_0x2178f4=0xc8;}else{_0x2178f4=0xce;}_0x2c9545[_0x3103('0x19')](_0x2178f4);return _0x2c9545[_0x3103('0x1a')]('Content-Range',_0x423ec6+'-'+_0xbcb30c+'/'+_0x473833)['json'](_0x38c996);}return null;};}function saveUpdates(_0x57cd44){return function(_0x494f4d){if(_0x494f4d){return _0x494f4d[_0x3103('0x1b')](_0x57cd44)[_0x3103('0x1c')](function(_0x179ce0){return _0x179ce0;});}return null;};}function removeEntity(_0x5efd97){return function(_0x2647fe){if(_0x2647fe){return _0x2647fe['destroy']()[_0x3103('0x1c')](function(){_0x5efd97[_0x3103('0x19')](0xcc)[_0x3103('0x1d')]();});}};}function handleEntityNotFound(_0x503619){return function(_0x32a827){if(!_0x32a827){_0x503619[_0x3103('0x14')](0x194);}return _0x32a827;};}function handleError(_0x528a76,_0x5e5dd0){_0x5e5dd0=_0x5e5dd0||0x1f4;return function(_0x4539ed){logger['error'](_0x4539ed[_0x3103('0x1e')]);if(_0x4539ed[_0x3103('0x1f')]){delete _0x4539ed[_0x3103('0x1f')];}_0x528a76[_0x3103('0x19')](_0x5e5dd0)[_0x3103('0x20')](_0x4539ed);};}function getInteractionUsers(_0x583f1f,_0xfd9027){return new BPromise(function(_0x24fff8,_0xc1190f){try{if(_0xfd9027[_0x583f1f['id']]){_0x583f1f[_0x3103('0x21')]=_[_0x3103('0x22')](_0xfd9027[_0x583f1f['id']],function(_0x5e7ff7){return{'id':_0x5e7ff7['id'],'fullname':_0x5e7ff7['fullname']};});}}catch(_0x510f31){_0xc1190f(_0x510f31);}_0x24fff8(_0x583f1f);});}function getInteractionTags(_0x5bc65e,_0x159a05){return new BPromise(function(_0x117454,_0x1c1571){try{if(_0x5bc65e[_0x3103('0x23')]){_0x5bc65e['Tags']=[];_0x5bc65e['TagIds'][_0x3103('0x24')](',')[_0x3103('0x25')](function(_0x2e3d53){_0x5bc65e[_0x3103('0x26')][_0x3103('0x27')](_0x159a05[_0x2e3d53]);});}delete _0x5bc65e[_0x3103('0x23')];}catch(_0x3ed153){_0x1c1571(_0x3ed153);}_0x117454(_0x5bc65e);});}function getLastMessageText(_0x21ce97){return new BPromise(function(_0xf28d9a,_0x41ea39){return db[_0x3103('0x28')][_0x3103('0x29')]({'where':{'$and':[{'MailInteractionId':_0x21ce97['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x3103('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x3103('0x2b'),'raw':!![]})[_0x3103('0x1c')](function(_0x39f21a){if(_0x39f21a&&_0x39f21a['plainBody']){_0x21ce97['lastMsgText']=_[_0x3103('0x2c')](_0x39f21a[_0x3103('0x2d')]);}_0xf28d9a(_0x21ce97);})[_0x3103('0x2e')](function(_0x58710d){_0x41ea39(_0x58710d);});});}function updateMailInteraction(_0x5f5ca2,_0x57b631,_0x29e63d,_0x4749c4){return new BPromise(function(_0x10941e,_0x3875a5){return getInteractionUsers(_0x5f5ca2,_0x29e63d)[_0x3103('0x1c')](function(_0x4df64f){return getInteractionTags(_0x4df64f,_0x57b631);})['then'](function(_0x594e4c){if(_0x4749c4){_0x10941e(getLastMessageText(_0x594e4c));}else{_0x10941e(_0x594e4c);}})[_0x3103('0x2e')](function(_0x4e0579){_0x3875a5(_0x4e0579);});});}exports[_0x3103('0x2f')]=function(_0x2edb65,_0x29723e){var _0x5066ea={},_0x148c2f={},_0x2f7be6={'count':0x0,'rows':[]};var _0x5c06ba=_[_0x3103('0x22')](db['MailInteraction']['rawAttributes'],function(_0x590ae5){return{'name':_0x590ae5[_0x3103('0x30')],'type':_0x590ae5[_0x3103('0x31')][_0x3103('0x32')]};});_0x148c2f[_0x3103('0x33')]=_[_0x3103('0x22')](_0x5c06ba,_0x3103('0x1f'));_0x148c2f['query']=_[_0x3103('0x34')](_0x2edb65[_0x3103('0x35')]);_0x148c2f[_0x3103('0x36')]=_[_0x3103('0x37')](_0x148c2f[_0x3103('0x33')],_0x148c2f[_0x3103('0x35')]);_0x5066ea[_0x3103('0x38')]=_['intersection'](_0x148c2f[_0x3103('0x33')],qs[_0x3103('0x39')](_0x2edb65['query'][_0x3103('0x39')]));_0x5066ea[_0x3103('0x38')]=_0x5066ea[_0x3103('0x38')][_0x3103('0x3a')]?_0x5066ea[_0x3103('0x38')]:_0x148c2f['model'];if(!_0x2edb65[_0x3103('0x35')]['hasOwnProperty'](_0x3103('0x3b'))){_0x5066ea[_0x3103('0x17')]=qs[_0x3103('0x17')](_0x2edb65[_0x3103('0x35')][_0x3103('0x17')]);_0x5066ea[_0x3103('0x15')]=qs[_0x3103('0x15')](_0x2edb65[_0x3103('0x35')][_0x3103('0x15')]);}_0x5066ea['order']=qs[_0x3103('0x3c')](_0x2edb65['query'][_0x3103('0x3c')]);_0x5066ea[_0x3103('0x3d')]=qs['filters'](_['pick'](_0x2edb65[_0x3103('0x35')],_0x148c2f[_0x3103('0x36')]),_0x5c06ba);var _0x3d6b9e=[];var _0x236475=squel[_0x3103('0x3e')]()[_0x3103('0x3f')]('id')[_0x3103('0x3f')](_0x3103('0x1f'))[_0x3103('0x3f')]('color')[_0x3103('0x40')](_0x3103('0x41'));var _0x56bfc5=squel['select']()['field'](_0x3103('0x42'))['field'](_0x3103('0x43'))[_0x3103('0x3f')](_0x3103('0x44'))[_0x3103('0x40')](_0x3103('0x45'),'ui')[_0x3103('0x46')](_0x3103('0x47'),'u',_0x3103('0x48'));var _0x34e68b=squel[_0x3103('0x3e')]()['from'](_0x3103('0x49'),'i')['left_join']('cm_contacts','c',_0x3103('0x4a'))[_0x3103('0x46')](_0x3103('0x47'),'o','o.id\x20=\x20i.UserId')[_0x3103('0x46')](_0x3103('0x4b'),'a',_0x3103('0x4c'))[_0x3103('0x46')](_0x3103('0x4d'),'me',_0x3103('0x4e'))['left_join'](_0x3103('0x4f'),'it',_0x3103('0x50'))[_0x3103('0x46')](_0x3103('0x41'),'t','t.id\x20=\x20it.TagId');var _0x3758a4=squel[_0x3103('0x51')]();var _0x30cd00=[];var _0x15ceb1=squel[_0x3103('0x51')]();var _0x41856c;if(_0x2edb65[_0x3103('0x35')][_0x3103('0x52')]){_0x41856c=as[_0x3103('0x53')](_0x2edb65[_0x3103('0x35')]['search']);var _0x4ee28c=_0x41856c[_0x3103('0x54')];for(var _0x39dbca=0x0;_0x39dbca<_0x41856c[_0x3103('0x55')]['length'];_0x39dbca++){var _0x3407f9=_0x41856c['conditions'][_0x39dbca];var _0x579752='i';var _0x3a7c2e=_[_0x3103('0x56')](_0x5c06ba,[_0x3103('0x1f'),_0x3407f9['field']]);if(!_0x3a7c2e){switch(_0x3407f9[_0x3103('0x3f')]){case _0x3103('0x57'):if(_0x3407f9[_0x3103('0x58')]==0x1){_0x34e68b[_0x3103('0x59')]('`'+_0x3407f9['field']+'`\x20=\x200');}else{_0x34e68b[_0x3103('0x59')]('`'+_0x3407f9[_0x3103('0x3f')]+_0x3103('0x5a'));}break;case _0x3103('0x5b'):if(_0x3407f9[_0x3103('0x5c')]===_0x3103('0x5d')){if(_0x3407f9[_0x3103('0x58')][_0x3103('0x24')]('\x20')[_0x3103('0x3a')]>0x1){_0x3758a4[_0x4ee28c](_0x3103('0x5e'),qs[_0x3103('0x5f')](_0x3407f9[_0x3103('0x58')]),null);}else{var _0x1461d9='%'+_0x3407f9[_0x3103('0x58')]+'%';_0x3758a4[_0x4ee28c](_0x3103('0x60'),_0x1461d9,_0x1461d9,_0x1461d9);}}else{_0x3a7c2e=_[_0x3103('0x56')](_0x5c06ba,[_0x3103('0x1f'),'ContactId']);_0x3407f9[_0x3103('0x3f')]=_0x3103('0x61');_0x59c62b=as[_0x3103('0x62')](_0x579752,_0x3a7c2e[_0x3103('0x31')],_0x3407f9);_0x3758a4[_0x4ee28c](_0x59c62b['text'],_0x59c62b[_0x3103('0x58')][_0x3103('0x63')],_0x59c62b[_0x3103('0x58')][_0x3103('0x1d')]);}break;case _0x3103('0x64'):var _0x1ca1f4=_0x3407f9[_0x3103('0x58')][_0x3103('0x24')](',')[_0x3103('0x22')](function(_0x1dfee7){return Number(_0x1dfee7);});_0x1ca1f4[_0x3103('0x25')](function(_0x3c2122){_0x15ceb1['or'](_0x3103('0x65'),'%,'+_0x3c2122+',%');});_0x30cd00=_['union'](_0x30cd00,_0x1ca1f4);break;case'User':if(_0x3407f9[_0x3103('0x5c')]==='$substring'){_0x3758a4[_0x4ee28c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3407f9['value']+'%',null);}else{_0x3a7c2e=_[_0x3103('0x56')](_0x5c06ba,[_0x3103('0x1f'),_0x3103('0x66')]);_0x3407f9[_0x3103('0x3f')]=_0x3103('0x66');_0x59c62b=as[_0x3103('0x62')](_0x579752,_0x3a7c2e[_0x3103('0x31')],_0x3407f9);_0x3758a4[_0x4ee28c](_0x59c62b[_0x3103('0x67')],_0x59c62b['value'][_0x3103('0x63')],_0x59c62b['value'][_0x3103('0x1d')]);}break;case'plainBody':_0x59c62b=as['buildExpression']('me',null,_0x3407f9);_0x3758a4[_0x4ee28c](_0x59c62b[_0x3103('0x67')],_0x59c62b['value'][_0x3103('0x63')],_0x59c62b[_0x3103('0x58')][_0x3103('0x1d')]);break;}}else{var _0x59c62b=as[_0x3103('0x62')](_0x579752,_0x3a7c2e[_0x3103('0x31')],_0x3407f9);_0x3758a4[_0x4ee28c](_0x59c62b[_0x3103('0x67')],_0x59c62b['value'][_0x3103('0x63')],_0x59c62b['value'][_0x3103('0x1d')]);}}}else{var _0x578817=_(_0x2edb65[_0x3103('0x35')])['keys']()[_0x3103('0x22')](function(_0x3fe04d){return _[_0x3103('0x68')](_0x5c06ba,[_0x3103('0x1f'),_0x3fe04d])?_0x3fe04d:undefined;})[_0x3103('0x69')]()[_0x3103('0x58')]();if(!_['isEmpty'](_0x578817)){_0x578817[_0x3103('0x25')](function(_0x22137e){if(_0x22137e===_0x3103('0x6a')){_0x34e68b['where'](_0x3103('0x6b'),[][_0x3103('0x6c')](_0x2edb65[_0x3103('0x35')][_0x22137e]));}else if(_0x22137e===_0x3103('0x6d')){var _0x7b05fe=JSON['parse'](_0x2edb65[_0x3103('0x35')][_0x22137e])[_0x3103('0x6e')];var _0x3a54a4=JSON[_0x3103('0x6f')](_0x2edb65[_0x3103('0x35')][_0x22137e])[_0x3103('0x70')];_0x34e68b['where'](_0x3103('0x71'),_0x7b05fe,_0x3a54a4);}else{if(_0x2edb65[_0x3103('0x35')][_0x22137e]===_0x3103('0x72')){_0x34e68b['where']('i.'+_0x22137e+_0x3103('0x73'));}else{_0x34e68b[_0x3103('0x3d')]('i.'+_0x22137e+_0x3103('0x74'),_0x2edb65[_0x3103('0x35')][_0x22137e]);}}});}if(_0x2edb65[_0x3103('0x35')][_0x3103('0x75')]){if(_0x2edb65['query'][_0x3103('0x75')]==0x1){_0x34e68b[_0x3103('0x59')](_0x3103('0x76'));}else{_0x34e68b['having'](_0x3103('0x77'));}}if(_0x2edb65[_0x3103('0x35')][_0x3103('0x78')]){_0x30cd00=_[_0x3103('0x79')](_0x2edb65[_0x3103('0x35')]['tag'])?_0x2edb65[_0x3103('0x35')][_0x3103('0x78')]:new Array(_0x2edb65['query']['tag']);_0x30cd00['forEach'](function(_0x238e5e){_0x15ceb1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x238e5e+',%');});}if(_0x2edb65[_0x3103('0x35')]['filter']){var _0x2805c0=_0x2edb65['query'][_0x3103('0x7a')][_0x3103('0x7b')]('\x5c','\x5c\x5c')[_0x3103('0x7b')](/'/g,'\x27\x27');if(qs[_0x3103('0x7c')](_0x2805c0)){_0x3758a4['or'](_0x3103('0x7d'),_0x2805c0+'%');}else if(qs[_0x3103('0x7e')](_0x2805c0)){_0x3758a4['or'](_0x3103('0x7f'),_0x2805c0+'%');}else{_0x3758a4['or'](_0x3103('0x80'),qs[_0x3103('0x5f')](_0x2805c0))['or'](_0x3103('0x81'),qs[_0x3103('0x5f')](_0x2805c0));}}}_0x34e68b[_0x3103('0x3d')](_0x3758a4);_0x34e68b[_0x3103('0x82')](_0x3103('0x83'));var _0xa8b9d4={'type':db[_0x3103('0x84')][_0x3103('0x85')]['SELECT'],'raw':!![]};var _0x1eb15c=_0x34e68b['clone']();_0x1eb15c[_0x3103('0x3f')](_0x3103('0x83'));_0x1eb15c[_0x3103('0x3f')](_0x3103('0x86'),_0x3103('0x57'));if(_0x5066ea[_0x3103('0x87')]){_0x5066ea[_0x3103('0x87')]['forEach'](function(_0x338252){var _0x3c62d0=_0x338252[0x0]===_0x3103('0x88')?_0x338252[0x0]:'i.'+_0x338252[0x0];_0x34e68b[_0x3103('0x87')](_0x3c62d0,_0x338252[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3103('0x89')](_0x30cd00)){_0x34e68b[_0x3103('0x59')](_0x15ceb1);_0x1eb15c[_0x3103('0x3d')]('t.id\x20IN\x20?',_0x30cd00);}BPromise[_0x3103('0x8a')]()[_0x3103('0x1c')](function(){if(!_0x41856c){if(_0x2edb65[_0x3103('0x35')]['MailAccountId'])return;_0x1eb15c[_0x3103('0x3d')](_0x3103('0x8b'));_0x34e68b[_0x3103('0x3d')](_0x3103('0x8b'));return;}if(_0x2edb65[_0x3103('0x8c')][_0x3103('0x8d')]!==_0x3103('0x8e'))return;return _0x2edb65['user'][_0x3103('0x8f')]({'attributes':['id'],'raw':!![]})[_0x3103('0x1c')](function(_0x32bb0f){if(_['isEmpty'](_0x32bb0f)){_0x1eb15c[_0x3103('0x3d')](_0x3103('0x90'));_0x34e68b[_0x3103('0x3d')](_0x3103('0x90'));}else{_0x1eb15c['where']('i.MailAccountId\x20IN\x20?',_[_0x3103('0x22')](_0x32bb0f,'id'));_0x34e68b[_0x3103('0x3d')](_0x3103('0x6b'),_[_0x3103('0x22')](_0x32bb0f,'id'));}});})[_0x3103('0x1c')](function(){if(_0x2edb65[_0x3103('0x8c')][_0x3103('0x8d')]===_0x3103('0x8e')&&!_0x41856c&&!_0x2edb65[_0x3103('0x35')]['MailAccountId'])return[];return db[_0x3103('0x91')][_0x3103('0x35')](_0x1eb15c[_0x3103('0x92')](),_0xa8b9d4);})[_0x3103('0x1c')](function(_0x154c47){_0x2f7be6[_0x3103('0x18')]=_0x154c47[_0x3103('0x3a')];if(_0x2f7be6[_0x3103('0x18')]===0x0)return[];return db[_0x3103('0x91')]['query'](_0x236475[_0x3103('0x92')](),_0xa8b9d4)['then'](function(_0xdaef76){_0x3d6b9e=_[_0x3103('0x93')](_0xdaef76,'id');_0xa8b9d4=_[_0x3103('0x94')](_0xa8b9d4,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2edb65['query'][_0x3103('0x39')]){_0x5066ea[_0x3103('0x38')]['forEach'](function(_0x469c40){_0x34e68b[_0x3103('0x3f')]('i.'+_0x469c40);});}else{_0x34e68b[_0x3103('0x3f')](_0x3103('0x86'),'unreadMessages');_0x34e68b[_0x3103('0x3f')](_0x3103('0x95'),_0x3103('0x96'));_0x34e68b[_0x3103('0x3f')](_0x3103('0x97'),_0x3103('0x98'));_0x34e68b[_0x3103('0x3f')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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',_0x3103('0x88'));_0x34e68b[_0x3103('0x3f')](_0x3103('0x83'));_0x34e68b['field'](_0x3103('0x99'));_0x34e68b['field'](_0x3103('0x9a'));_0x34e68b[_0x3103('0x3f')](_0x3103('0x9b'));_0x34e68b[_0x3103('0x3f')](_0x3103('0x9c'));_0x34e68b[_0x3103('0x3f')]('i.attach');_0x34e68b['field'](_0x3103('0x9d'));_0x34e68b[_0x3103('0x3f')](_0x3103('0x9e'));_0x34e68b[_0x3103('0x3f')](_0x3103('0x9f'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xa0'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xa1'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xa2'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xa3'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xa4'));_0x34e68b[_0x3103('0x3f')]('i.ContactId');_0x34e68b['field'](_0x3103('0xa5'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xa6'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xa7'),_0x3103('0xa8'));_0x34e68b['field']('c.lastName','Contact.lastName');_0x34e68b[_0x3103('0x3f')](_0x3103('0xa9'),_0x3103('0xaa'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xab'),_0x3103('0xac'));_0x34e68b['field'](_0x3103('0xad'),_0x3103('0xae'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xaf'),'Contact.fax');_0x34e68b[_0x3103('0x3f')](_0x3103('0xb0'),_0x3103('0xb1'));_0x34e68b[_0x3103('0x3f')](_0x3103('0xb2'),_0x3103('0xb3'));_0x34e68b[_0x3103('0x3f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3103('0x23'));}if(_0x5066ea[_0x3103('0x17')])_0x34e68b[_0x3103('0x17')](_0x5066ea[_0x3103('0x17')]);if(_0x5066ea[_0x3103('0x15')])_0x34e68b[_0x3103('0x15')](_0x5066ea[_0x3103('0x15')]);return db[_0x3103('0x91')]['query'](_0x34e68b[_0x3103('0x92')](),_0xa8b9d4);})[_0x3103('0x1c')](function(_0x4bead4){if(_0x4bead4[_0x3103('0x3a')]>0x0)_0x56bfc5[_0x3103('0x3d')](_0x3103('0xb4'),_[_0x3103('0x22')](_0x4bead4,'id'));return db['sequelize'][_0x3103('0x35')](_0x56bfc5[_0x3103('0x92')](),_0xa8b9d4)['then'](function(_0x1b484f){var _0x5325d4=_[_0x3103('0xb5')](_0x1b484f,'MailInteractionId');var _0xeb6cb9=[];return db['Setting'][_0x3103('0x29')]({'attributes':[_0x3103('0xb6')],'raw':!![]})[_0x3103('0x1c')](function(_0x4fbffe){var _0x20dc46=_0x4fbffe['enableEmailPreview'];_0x4bead4[_0x3103('0x25')](function(_0x1aea8c){_0xeb6cb9[_0x3103('0x27')](updateMailInteraction(_0x1aea8c,_0x3d6b9e,_0x5325d4,_0x20dc46));});return BPromise[_0x3103('0xb7')](_0xeb6cb9);});});});})[_0x3103('0x1c')](function(_0x2c3c76){_0x2f7be6[_0x3103('0xb8')]=_0x2c3c76;return _0x2f7be6;})[_0x3103('0x1c')](respondWithFilteredResult(_0x29723e,_0x5066ea))[_0x3103('0x2e')](handleError(_0x29723e,null));};exports[_0x3103('0xb9')]=function(_0x53e304,_0x5c548c){var _0xe8a6f4={'raw':![],'where':{'id':_0x53e304[_0x3103('0xba')]['id']}},_0x1c3a3e={};_0x1c3a3e[_0x3103('0x33')]=_[_0x3103('0x34')](db[_0x3103('0xbb')][_0x3103('0xbc')]);_0x1c3a3e[_0x3103('0x35')]=_[_0x3103('0x34')](_0x53e304['query']);_0x1c3a3e[_0x3103('0x36')]=_[_0x3103('0x37')](_0x1c3a3e['model'],_0x1c3a3e['query']);_0xe8a6f4[_0x3103('0x38')]=_[_0x3103('0x37')](_0x1c3a3e[_0x3103('0x33')],qs[_0x3103('0x39')](_0x53e304['query'][_0x3103('0x39')]));_0xe8a6f4['attributes']=_0xe8a6f4[_0x3103('0x38')][_0x3103('0x3a')]?_0xe8a6f4[_0x3103('0x38')]:_0x1c3a3e[_0x3103('0x33')];if(_0x53e304[_0x3103('0x35')][_0x3103('0xbd')]){_0xe8a6f4[_0x3103('0xbe')]=[{'all':!![]}];}_0xe8a6f4=_['merge']({},_0xe8a6f4,_0x53e304[_0x3103('0xbf')]);return db[_0x3103('0xbb')]['find'](_0xe8a6f4)[_0x3103('0x1c')](handleEntityNotFound(_0x5c548c,null))[_0x3103('0x1c')](respondWithResult(_0x5c548c,null))[_0x3103('0x2e')](handleError(_0x5c548c,null));};exports[_0x3103('0xc0')]=function(_0x404004,_0x211e15){return db[_0x3103('0xbb')][_0x3103('0xc0')](_0x404004[_0x3103('0xc1')],{})[_0x3103('0x1c')](respondWithResult(_0x211e15,0xc9))[_0x3103('0x2e')](handleError(_0x211e15,null));};exports[_0x3103('0x1b')]=function(_0x571fa8,_0x4a1276){if(_0x571fa8[_0x3103('0xc1')]['id']){delete _0x571fa8[_0x3103('0xc1')]['id'];}return db[_0x3103('0xbb')][_0x3103('0x56')]({'where':{'id':_0x571fa8[_0x3103('0xba')]['id']}})['then'](handleEntityNotFound(_0x4a1276,null))[_0x3103('0x1c')](saveUpdates(_0x571fa8['body'],null))[_0x3103('0x1c')](respondWithResult(_0x4a1276,null))[_0x3103('0x2e')](handleError(_0x4a1276,null));};exports[_0x3103('0xc2')]=function(_0x5095e0,_0x48c06e){return db[_0x3103('0xbb')]['find']({'where':{'id':_0x5095e0[_0x3103('0xba')]['id']}})[_0x3103('0x1c')](handleEntityNotFound(_0x48c06e,null))[_0x3103('0x1c')](removeEntity(_0x48c06e,null))[_0x3103('0x2e')](handleError(_0x48c06e,null));};exports[_0x3103('0xc3')]=function(_0xb8ad48,_0x5b87b2){return db[_0x3103('0xbb')][_0x3103('0xc3')]()[_0x3103('0x1c')](respondWithResult(_0x5b87b2,null))[_0x3103('0x2e')](handleError(_0x5b87b2,null));};exports[_0x3103('0xc4')]=function(_0x303c26,_0x538936){return db[_0x3103('0x28')][_0x3103('0x56')]({'where':{'id':_0x303c26[_0x3103('0xba')]['id']}})['then'](handleEntityNotFound(_0x538936,null))['then'](function(_0x2c6fdc){if(_0x2c6fdc){return _0x2c6fdc[_0x3103('0xc4')](_0x303c26[_0x3103('0xc1')][_0x3103('0xc5')],_['omit'](_0x303c26[_0x3103('0xc1')],[_0x3103('0xc5'),'id'])||{});}})[_0x3103('0x1c')](respondWithResult(_0x538936,null))[_0x3103('0x2e')](handleError(_0x538936,null));};exports[_0x3103('0xc6')]=function(_0x56bbd9,_0x1966dc){var _0x1bcd1e={'raw':![],'where':{}};var _0x26c2a2={};var _0x377b73={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x56bbd9['params']['id']}})[_0x3103('0x1c')](handleEntityNotFound(_0x1966dc,null))[_0x3103('0x1c')](function(_0xc0b57d){if(_0xc0b57d){_0x26c2a2[_0x3103('0x33')]=_['keys'](db[_0x3103('0x28')][_0x3103('0xbc')]);_0x26c2a2['query']=_[_0x3103('0x34')](_0x56bbd9['query']);_0x26c2a2[_0x3103('0x36')]=_[_0x3103('0x37')](_0x26c2a2['model'],_0x26c2a2[_0x3103('0x35')]);_0x1bcd1e[_0x3103('0x38')]=_[_0x3103('0x37')](_0x26c2a2[_0x3103('0x33')],qs[_0x3103('0x39')](_0x56bbd9[_0x3103('0x35')][_0x3103('0x39')]));_0x1bcd1e['attributes']=_0x1bcd1e['attributes']['length']?_0x1bcd1e[_0x3103('0x38')]:_0x26c2a2[_0x3103('0x33')];if(!_0x56bbd9[_0x3103('0x35')]['hasOwnProperty'](_0x3103('0x3b'))){_0x1bcd1e['limit']=qs[_0x3103('0x17')](_0x56bbd9['query']['limit']);_0x1bcd1e[_0x3103('0x15')]=qs['offset'](_0x56bbd9[_0x3103('0x35')]['offset']);}_0x1bcd1e[_0x3103('0x87')]=qs[_0x3103('0x3c')](_0x56bbd9[_0x3103('0x35')][_0x3103('0x3c')]);_0x1bcd1e[_0x3103('0x3d')]=qs[_0x3103('0x36')](_[_0x3103('0xc7')](_0x56bbd9[_0x3103('0x35')],_0x26c2a2[_0x3103('0x36')]));_0x1bcd1e[_0x3103('0x3d')][_0x3103('0xc8')]=_0xc0b57d['id'];if(_0x56bbd9[_0x3103('0x35')][_0x3103('0x7a')]){_0x1bcd1e['where']=_[_0x3103('0x94')](_0x1bcd1e[_0x3103('0x3d')],{'$or':_['map'](_0x1bcd1e[_0x3103('0x38')],function(_0x49c86b){var _0x3acd0b={};_0x3acd0b[_0x49c86b]={'$like':'%'+_0x56bbd9[_0x3103('0x35')][_0x3103('0x7a')]+'%'};return _0x3acd0b;})});}if(_0x56bbd9[_0x3103('0x35')]['$gte']){var _0x490b9c=_0x56bbd9[_0x3103('0x35')][_0x3103('0x6e')][_0x3103('0x24')](',');var _0x216117={};_0x216117[_0x490b9c[0x0]]={'$gte':moment(_0x490b9c[0x1])[_0x3103('0xc9')](_0x3103('0xca'))};_0x1bcd1e[_0x3103('0x3d')]=_[_0x3103('0x94')](_0x1bcd1e[_0x3103('0x3d')],_0x216117);}_0x1bcd1e=_[_0x3103('0x94')]({},_0x1bcd1e,_0x56bbd9['options']);return db[_0x3103('0x28')][_0x3103('0x18')]({'where':_0x1bcd1e[_0x3103('0x3d')]})[_0x3103('0x1c')](function(_0x426709){_0x377b73[_0x3103('0x18')]=_0x426709;if(_0x56bbd9[_0x3103('0x35')]['includeAll']){_0x1bcd1e[_0x3103('0xbe')]=[{'all':!![]}];}return db[_0x3103('0x28')][_0x3103('0xcb')](_0x1bcd1e);})[_0x3103('0x1c')](function(_0x5a5af4){if(_0x56bbd9[_0x3103('0x35')][_0x3103('0xcc')]==='true'){for(var _0x22ad58=0x0;_0x22ad58<_0x5a5af4['length'];_0x22ad58++){_0x5a5af4[_0x22ad58][_0x3103('0xc1')]=juice(_0x5a5af4[_0x22ad58]['body']);}}_0x377b73[_0x3103('0xb8')]=_0x5a5af4;return _0x377b73;});}})[_0x3103('0x1c')](respondWithFilteredResult(_0x1966dc,_0x1bcd1e))[_0x3103('0x2e')](handleError(_0x1966dc,null));};exports[_0x3103('0xcd')]=function(_0x41f9db,_0x3a3799){return db['MailInteraction'][_0x3103('0x56')]({'where':{'id':_0x41f9db[_0x3103('0xba')]['id']}})['then'](handleEntityNotFound(_0x3a3799,null))['then'](function(_0xe7a710){if(_0xe7a710){return _0xe7a710[_0x3103('0xce')](_0x41f9db[_0x3103('0xc1')]['ids'],_[_0x3103('0xcf')](_0x41f9db['body'],[_0x3103('0xc5'),'id'])||{})[_0x3103('0xd0')](function(){return db[_0x3103('0x64')]['findAll']({'attributes':['id',_0x3103('0x1f'),'color'],'where':{'id':_0x41f9db[_0x3103('0xc1')][_0x3103('0xc5')]}});})[_0x3103('0x1c')](function(_0x184d44){socket[_0x3103('0xd1')](_0x3103('0xd2'),{'id':Number(_0x41f9db[_0x3103('0xba')]['id']),'tags':_0x184d44||[]});return{'id':Number(_0x41f9db[_0x3103('0xba')]['id']),'tags':_0x184d44||[]};});}})[_0x3103('0x1c')](respondWithResult(_0x3a3799,null))[_0x3103('0x2e')](handleError(_0x3a3799,null));};exports[_0x3103('0xd3')]=function(_0x1e43e8,_0x41289d){return db[_0x3103('0xbb')]['find']({'where':{'id':_0x1e43e8[_0x3103('0xba')]['id']}})[_0x3103('0x1c')](handleEntityNotFound(_0x41289d,null))[_0x3103('0x1c')](function(_0x328425){if(_0x328425){return _0x328425['removeTags'](_0x1e43e8['query'][_0x3103('0xc5')]);}})[_0x3103('0x1c')](respondWithStatusCode(_0x41289d,null))[_0x3103('0x2e')](handleError(_0x41289d,null));};exports['download']=function(_0x26b9e9,_0x59fe9f){var _0x3f72d2=moment()['unix']()['toString']();var _0x5de279=path[_0x3103('0xd4')](config[_0x3103('0xd5')],_0x3103('0xd6'),_0x3103('0xd7'),_0x3103('0xd8'));var _0x115381=path[_0x3103('0xd4')](config[_0x3103('0xd5')],_0x3103('0xd6'),_0x3103('0xd7'),_0x3103('0xd9'));var _0x221870=path[_0x3103('0xd4')](_0x5de279,_0x3f72d2);var _0x81981c=util['format'](_0x3103('0xda'),_0x26b9e9[_0x3103('0xba')]['id'],_0x3f72d2);var _0x5497ef=path['join'](_0x5de279,_0x81981c);var _0x4ae77b=[];if(_0x26b9e9['query'][_0x3103('0xd9')]){_0x4ae77b[_0x3103('0x27')]({'model':db[_0x3103('0xdb')],'as':_0x3103('0xdc'),'raw':!![]});}var _0x440daa=[{'model':db[_0x3103('0x28')],'as':_0x3103('0xdd'),'attributes':['id','body',_0x3103('0x40'),'to','cc',_0x3103('0xde'),'subject',_0x3103('0x6d')],'where':{'secret':![]},'order':qs[_0x3103('0x3c')]('id'),'include':_0x4ae77b}];return db[_0x3103('0xbb')]['find']({'where':{'id':_0x26b9e9['params']['id']},'include':_0x440daa})['then'](handleEntityNotFound(_0x59fe9f,null))[_0x3103('0x1c')](function(_0x529e33){if(_0x529e33&&_0x529e33[_0x3103('0xdd')]){var _0x166c3b=_0x529e33[_0x3103('0xdf')]({'plain':!![]});fs['mkdirSync'](_0x221870);return BPromise[_0x3103('0xe0')](_0x166c3b['Messages'],function(_0x481b93,_0x39460e){var _0x50dab7={'from':_0x481b93[_0x3103('0x40')],'to':_0x481b93['to'],'subject':_0x481b93[_0x3103('0xe1')],'html':htmlEntities[_0x3103('0xe2')](_0x481b93[_0x3103('0xc1')]),'headers':{'Date':moment(_0x481b93[_0x3103('0x6d')])[_0x3103('0xc9')](_0x3103('0xe3'))},'attachments':[]};if(_0x481b93['cc']){_0x50dab7[_0x3103('0xe4')]['Cc']=_0x481b93['cc'];}if(_0x481b93['bcc']){_0x50dab7[_0x3103('0xe4')][_0x3103('0xe5')]=_0x481b93[_0x3103('0xde')];}return new BPromise(function(_0x2d21eb,_0x44c3be){if(_0x481b93[_0x3103('0xdc')]){for(var _0x59e76f=0x0;_0x59e76f<_0x481b93[_0x3103('0xdc')]['length'];_0x59e76f++){var _0x3d5714=_0x481b93[_0x3103('0xdc')][_0x59e76f];var _0x371fd6=path[_0x3103('0xd4')](_0x115381,_0x3d5714[_0x3103('0xe6')]);if(fs['existsSync'](_0x371fd6)){_0x50dab7['attachments']['push']({'name':_0x3d5714[_0x3103('0x1f')],'contentType':_0x3d5714[_0x3103('0x31')],'data':fs[_0x3103('0xe7')](_0x371fd6)});}}}emlformat[_0x3103('0xe8')](_0x50dab7,function(_0x432414,_0x331ebc){if(_0x432414)return _0x44c3be(_0x432414);fs['writeFileSync'](path[_0x3103('0xd4')](_0x221870,util[_0x3103('0xc9')]('message%d.eml',_0x39460e)),_0x331ebc);return _0x2d21eb(_0x331ebc);});});})[_0x3103('0x1c')](function(){return new BPromise(function(_0x13b29e,_0x40652f){zipdir(_0x221870,{'saveTo':_0x5497ef},function(_0x2f843e,_0x57b9a2){if(_0x2f843e)return _0x40652f(_0x2f843e);return _0x13b29e(_0x57b9a2);});})[_0x3103('0x1c')](function(){return new BPromise(function(_0x3d41e1,_0x593fe6){rimraf(_0x221870,function(_0xc45fa2){if(_0xc45fa2)_0x593fe6(_0xc45fa2);return _0x3d41e1();});});})[_0x3103('0x1c')](function(){return _0x59fe9f['download'](_0x5497ef,_0x81981c,function(_0x1bbc1f){if(!_0x1bbc1f)fs['unlinkSync'](_0x5497ef);});});});}else{return _0x59fe9f['sendStatus'](0xc8);}})[_0x3103('0x2e')](handleError(_0x59fe9f,null));}; \ No newline at end of file +var _0x266d=['mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','unreadMessages','value','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','type','some','compact','isEmpty','concat','parse','$gte','$lte','null','read','`unreadMessages`\x20=\x200','tag','filter','replace','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','findOne','enableEmailPreview','push','all','rows','show','params','includeAll','include','merge','options','create','body','describe','addMessage','ids','rawAttributes','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','omit','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','MailMessage','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId'];(function(_0x189b7a,_0x444bee){var _0x40c81d=function(_0x32e086){while(--_0x32e086){_0x189b7a['push'](_0x189b7a['shift']());}};_0x40c81d(++_0x444bee);}(_0x266d,0x9d));var _0xd266=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x266d[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xd266('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd266('0x1'));var moment=require(_0xd266('0x2'));var BPromise=require('bluebird');var util=require(_0xd266('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xd266('0x4'));var squel=require(_0xd266('0x5'));var juice=require('juice');var Redis=require(_0xd266('0x6'));var qs=require(_0xd266('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xd266('0x8'))(_0xd266('0x9'));var config=require(_0xd266('0xa'));var db=require(_0xd266('0xb'))['db'];var htmlEntities=require(_0xd266('0xc'));config[_0xd266('0xd')]=_[_0xd266('0xe')](config[_0xd266('0xd')],{'host':_0xd266('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd266('0xd')]));require(_0xd266('0x10'))[_0xd266('0x11')](socket);function respondWithStatusCode(_0x172729,_0x131162){_0x131162=_0x131162||0xcc;return function(_0x1c7300){if(_0x1c7300){return _0x172729[_0xd266('0x12')](_0x131162);}return _0x172729[_0xd266('0x13')](_0x131162)[_0xd266('0x14')]();};}function respondWithResult(_0x1910f6,_0x3596a0){_0x3596a0=_0x3596a0||0xc8;return function(_0x5e764b){if(_0x5e764b){return _0x1910f6[_0xd266('0x13')](_0x3596a0)['json'](_0x5e764b);}};}function respondWithFilteredResult(_0x2143f3,_0x2d33f1){return function(_0x482555){if(_0x482555){var _0x3de1ab=typeof _0x2d33f1['offset']===_0xd266('0x15')&&typeof _0x2d33f1[_0xd266('0x16')]===_0xd266('0x15');var _0x42e67d=_0x482555[_0xd266('0x17')];var _0x343e24=_0x3de1ab?0x0:_0x2d33f1[_0xd266('0x18')];var _0x1c9d91=_0x3de1ab?_0x482555[_0xd266('0x17')]:_0x2d33f1['offset']+_0x2d33f1[_0xd266('0x16')];var _0x2d4471;if(_0x1c9d91>=_0x42e67d){_0x1c9d91=_0x42e67d;_0x2d4471=0xc8;}else{_0x2d4471=0xce;}_0x2143f3[_0xd266('0x13')](_0x2d4471);return _0x2143f3[_0xd266('0x19')](_0xd266('0x1a'),_0x343e24+'-'+_0x1c9d91+'/'+_0x42e67d)['json'](_0x482555);}return null;};}function saveUpdates(_0x2bac14){return function(_0x135c83){if(_0x135c83){return _0x135c83[_0xd266('0x1b')](_0x2bac14)[_0xd266('0x1c')](function(_0x47f46f){return _0x47f46f;});}return null;};}function removeEntity(_0x459b65){return function(_0x57160e){if(_0x57160e){return _0x57160e[_0xd266('0x1d')]()[_0xd266('0x1c')](function(){_0x459b65['status'](0xcc)[_0xd266('0x14')]();});}};}function handleEntityNotFound(_0x46a23b){return function(_0x137e4b){if(!_0x137e4b){_0x46a23b[_0xd266('0x12')](0x194);}return _0x137e4b;};}function handleError(_0x51e397,_0x298e05){_0x298e05=_0x298e05||0x1f4;return function(_0x51ede9){logger[_0xd266('0x1e')](_0x51ede9[_0xd266('0x1f')]);if(_0x51ede9[_0xd266('0x20')]){delete _0x51ede9[_0xd266('0x20')];}_0x51e397[_0xd266('0x13')](_0x298e05)['send'](_0x51ede9);};}function getInteractionUsers(_0x168514,_0xbacf25){return new BPromise(function(_0x366b08,_0x1d709){try{if(_0xbacf25[_0x168514['id']]){_0x168514[_0xd266('0x21')]=_[_0xd266('0x22')](_0xbacf25[_0x168514['id']],function(_0x420d7e){return{'id':_0x420d7e['id'],'fullname':_0x420d7e[_0xd266('0x23')]};});}}catch(_0x4795cf){_0x1d709(_0x4795cf);}_0x366b08(_0x168514);});}function getInteractionTags(_0x2bb8a7,_0x489988){return new BPromise(function(_0x109aa7,_0x1fc4a3){try{if(_0x2bb8a7[_0xd266('0x24')]){_0x2bb8a7[_0xd266('0x25')]=[];_0x2bb8a7[_0xd266('0x24')][_0xd266('0x26')](',')[_0xd266('0x27')](function(_0x44bfc1){_0x2bb8a7[_0xd266('0x25')]['push'](_0x489988[_0x44bfc1]);});}delete _0x2bb8a7[_0xd266('0x24')];}catch(_0xfd6dc8){_0x1fc4a3(_0xfd6dc8);}_0x109aa7(_0x2bb8a7);});}function getLastMessageText(_0x8a5d51){return new BPromise(function(_0x360e9a,_0x5bf56e){return db[_0xd266('0x28')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x8a5d51['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xd266('0x29'),'raw':!![]})['then'](function(_0x249c9f){if(_0x249c9f&&_0x249c9f[_0xd266('0x2a')]){_0x8a5d51[_0xd266('0x2b')]=_[_0xd266('0x2c')](_0x249c9f[_0xd266('0x2a')]);}_0x360e9a(_0x8a5d51);})[_0xd266('0x2d')](function(_0x2be061){_0x5bf56e(_0x2be061);});});}function updateMailInteraction(_0x14c29d,_0x4f9be5,_0xd78572,_0x4b55fa){return new BPromise(function(_0x4fe861,_0xfbcdb5){return getInteractionUsers(_0x14c29d,_0xd78572)[_0xd266('0x1c')](function(_0x3552cb){return getInteractionTags(_0x3552cb,_0x4f9be5);})[_0xd266('0x1c')](function(_0x441e25){if(_0x4b55fa){_0x4fe861(getLastMessageText(_0x441e25));}else{_0x4fe861(_0x441e25);}})['catch'](function(_0x3ebcc9){_0xfbcdb5(_0x3ebcc9);});});}exports[_0xd266('0x2e')]=function(_0x5c3dbe,_0x58030b){var _0x3097a3={},_0x45c328={},_0x2983ff={'count':0x0,'rows':[]};var _0x524745=_[_0xd266('0x22')](db[_0xd266('0x2f')]['rawAttributes'],function(_0x152ca3){return{'name':_0x152ca3[_0xd266('0x30')],'type':_0x152ca3['type'][_0xd266('0x31')]};});_0x45c328['model']=_[_0xd266('0x22')](_0x524745,_0xd266('0x20'));_0x45c328[_0xd266('0x32')]=_[_0xd266('0x33')](_0x5c3dbe[_0xd266('0x32')]);_0x45c328['filters']=_[_0xd266('0x34')](_0x45c328[_0xd266('0x35')],_0x45c328[_0xd266('0x32')]);_0x3097a3[_0xd266('0x36')]=_['intersection'](_0x45c328['model'],qs[_0xd266('0x37')](_0x5c3dbe['query']['fields']));_0x3097a3[_0xd266('0x36')]=_0x3097a3[_0xd266('0x36')]['length']?_0x3097a3['attributes']:_0x45c328[_0xd266('0x35')];if(!_0x5c3dbe[_0xd266('0x32')][_0xd266('0x38')](_0xd266('0x39'))){_0x3097a3[_0xd266('0x16')]=qs[_0xd266('0x16')](_0x5c3dbe[_0xd266('0x32')][_0xd266('0x16')]);_0x3097a3[_0xd266('0x18')]=qs['offset'](_0x5c3dbe['query'][_0xd266('0x18')]);}_0x3097a3['order']=qs[_0xd266('0x3a')](_0x5c3dbe[_0xd266('0x32')][_0xd266('0x3a')]);_0x3097a3[_0xd266('0x3b')]=qs[_0xd266('0x3c')](_[_0xd266('0x3d')](_0x5c3dbe[_0xd266('0x32')],_0x45c328[_0xd266('0x3c')]),_0x524745);var _0x21a0a2=[];var _0x1d7193=squel[_0xd266('0x3e')]()[_0xd266('0x3f')]('id')['field'](_0xd266('0x20'))[_0xd266('0x3f')](_0xd266('0x40'))[_0xd266('0x41')](_0xd266('0x42'));var _0x305d23=squel[_0xd266('0x3e')]()[_0xd266('0x3f')](_0xd266('0x43'))[_0xd266('0x3f')](_0xd266('0x44'))[_0xd266('0x3f')]('ui.MailInteractionId')['from'](_0xd266('0x45'),'ui')[_0xd266('0x46')](_0xd266('0x47'),'u',_0xd266('0x48'));var _0x5759c9=squel[_0xd266('0x3e')]()[_0xd266('0x41')](_0xd266('0x49'),'i')[_0xd266('0x46')](_0xd266('0x4a'),'c',_0xd266('0x4b'))[_0xd266('0x46')](_0xd266('0x47'),'o',_0xd266('0x4c'))['left_join'](_0xd266('0x4d'),'a',_0xd266('0x4e'))[_0xd266('0x46')](_0xd266('0x4f'),'me','me.MailInteractionId\x20=\x20i.id')[_0xd266('0x46')](_0xd266('0x50'),'it',_0xd266('0x51'))[_0xd266('0x46')](_0xd266('0x42'),'t',_0xd266('0x52'));var _0x515988=squel[_0xd266('0x53')]();var _0x259f07=[];var _0x1fcc87=squel[_0xd266('0x53')]();var _0x4bcf00;if(_0x5c3dbe['query'][_0xd266('0x54')]){_0x4bcf00=as[_0xd266('0x55')](_0x5c3dbe['query'][_0xd266('0x54')]);var _0x8806d7=_0x4bcf00[_0xd266('0x56')];for(var _0x569f47=0x0;_0x569f47<_0x4bcf00[_0xd266('0x57')][_0xd266('0x58')];_0x569f47++){var _0x1d5165=_0x4bcf00[_0xd266('0x57')][_0x569f47];var _0x1f9c87='i';var _0x263f4d=_['find'](_0x524745,['name',_0x1d5165[_0xd266('0x3f')]]);if(!_0x263f4d){switch(_0x1d5165[_0xd266('0x3f')]){case _0xd266('0x59'):if(_0x1d5165[_0xd266('0x5a')]==0x1){_0x5759c9[_0xd266('0x5b')]('`'+_0x1d5165[_0xd266('0x3f')]+'`\x20=\x200');}else{_0x5759c9[_0xd266('0x5b')]('`'+_0x1d5165[_0xd266('0x3f')]+_0xd266('0x5c'));}break;case'Contact':if(_0x1d5165['operator']===_0xd266('0x5d')){if(_0x1d5165[_0xd266('0x5a')]['split']('\x20')[_0xd266('0x58')]>0x1){_0x515988[_0x8806d7](_0xd266('0x5e'),qs['getFullTextValue'](_0x1d5165[_0xd266('0x5a')]),null);}else{var _0x20ec7e='%'+_0x1d5165[_0xd266('0x5a')]+'%';_0x515988[_0x8806d7](_0xd266('0x5f'),_0x20ec7e,_0x20ec7e,_0x20ec7e);}}else{_0x263f4d=_['find'](_0x524745,[_0xd266('0x20'),'ContactId']);_0x1d5165[_0xd266('0x3f')]=_0xd266('0x60');_0x341a43=as[_0xd266('0x61')](_0x1f9c87,_0x263f4d['type'],_0x1d5165);_0x515988[_0x8806d7](_0x341a43[_0xd266('0x62')],_0x341a43['value'][_0xd266('0x63')],_0x341a43[_0xd266('0x5a')][_0xd266('0x14')]);}break;case _0xd266('0x64'):var _0x4e2b29=_0x1d5165[_0xd266('0x5a')][_0xd266('0x26')](',')['map'](function(_0x3fe84e){return Number(_0x3fe84e);});_0x4e2b29[_0xd266('0x27')](function(_0x3a93a6){_0x1fcc87['or'](_0xd266('0x65'),'%,'+_0x3a93a6+',%');});_0x259f07=_['union'](_0x259f07,_0x4e2b29);break;case _0xd266('0x66'):if(_0x1d5165['operator']===_0xd266('0x5d')){_0x515988[_0x8806d7](_0xd266('0x67'),'%'+_0x1d5165[_0xd266('0x5a')]+'%',null);}else{_0x263f4d=_[_0xd266('0x68')](_0x524745,['name','UserId']);_0x1d5165[_0xd266('0x3f')]='UserId';_0x341a43=as['buildExpression'](_0x1f9c87,_0x263f4d[_0xd266('0x69')],_0x1d5165);_0x515988[_0x8806d7](_0x341a43[_0xd266('0x62')],_0x341a43[_0xd266('0x5a')][_0xd266('0x63')],_0x341a43['value'][_0xd266('0x14')]);}break;case _0xd266('0x2a'):_0x341a43=as[_0xd266('0x61')]('me',null,_0x1d5165);_0x515988[_0x8806d7](_0x341a43[_0xd266('0x62')],_0x341a43[_0xd266('0x5a')][_0xd266('0x63')],_0x341a43[_0xd266('0x5a')][_0xd266('0x14')]);break;}}else{var _0x341a43=as[_0xd266('0x61')](_0x1f9c87,_0x263f4d[_0xd266('0x69')],_0x1d5165);_0x515988[_0x8806d7](_0x341a43[_0xd266('0x62')],_0x341a43[_0xd266('0x5a')][_0xd266('0x63')],_0x341a43[_0xd266('0x5a')][_0xd266('0x14')]);}}}else{var _0x4f5b73=_(_0x5c3dbe[_0xd266('0x32')])[_0xd266('0x33')]()['map'](function(_0x548ca9){return _[_0xd266('0x6a')](_0x524745,[_0xd266('0x20'),_0x548ca9])?_0x548ca9:undefined;})[_0xd266('0x6b')]()[_0xd266('0x5a')]();if(!_[_0xd266('0x6c')](_0x4f5b73)){_0x4f5b73[_0xd266('0x27')](function(_0x296fea){if(_0x296fea==='MailAccountId'){_0x5759c9['where']('i.MailAccountId\x20IN\x20?',[][_0xd266('0x6d')](_0x5c3dbe[_0xd266('0x32')][_0x296fea]));}else if(_0x296fea==='createdAt'){var _0x4b0205=JSON[_0xd266('0x6e')](_0x5c3dbe[_0xd266('0x32')][_0x296fea])[_0xd266('0x6f')];var _0x3edecc=JSON[_0xd266('0x6e')](_0x5c3dbe['query'][_0x296fea])[_0xd266('0x70')];_0x5759c9[_0xd266('0x3b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4b0205,_0x3edecc);}else{if(_0x5c3dbe['query'][_0x296fea]===_0xd266('0x71')){_0x5759c9[_0xd266('0x3b')]('i.'+_0x296fea+'\x20IS\x20NULL');}else{_0x5759c9[_0xd266('0x3b')]('i.'+_0x296fea+'\x20=\x20?',_0x5c3dbe['query'][_0x296fea]);}}});}if(_0x5c3dbe['query'][_0xd266('0x72')]){if(_0x5c3dbe[_0xd266('0x32')][_0xd266('0x72')]==0x1){_0x5759c9[_0xd266('0x5b')](_0xd266('0x73'));}else{_0x5759c9[_0xd266('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0x5c3dbe[_0xd266('0x32')][_0xd266('0x74')]){_0x259f07=_['isArray'](_0x5c3dbe[_0xd266('0x32')][_0xd266('0x74')])?_0x5c3dbe[_0xd266('0x32')][_0xd266('0x74')]:new Array(_0x5c3dbe[_0xd266('0x32')]['tag']);_0x259f07[_0xd266('0x27')](function(_0x30517a){_0x1fcc87['or'](_0xd266('0x65'),'%,'+_0x30517a+',%');});}if(_0x5c3dbe[_0xd266('0x32')][_0xd266('0x75')]){var _0x135184=_0x5c3dbe[_0xd266('0x32')]['filter'][_0xd266('0x76')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x135184)){_0x515988['or'](_0xd266('0x77'),_0x135184+'%');}else if(qs[_0xd266('0x78')](_0x135184)){_0x515988['or']('c.email\x20LIKE\x20?',_0x135184+'%');}else{_0x515988['or'](_0xd266('0x79'),qs[_0xd266('0x7a')](_0x135184))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd266('0x7a')](_0x135184));}}}_0x5759c9[_0xd266('0x3b')](_0x515988);_0x5759c9[_0xd266('0x7b')](_0xd266('0x7c'));var _0x4ba813={'type':db[_0xd266('0x7d')][_0xd266('0x7e')][_0xd266('0x7f')],'raw':!![]};var _0xf21b4d=_0x5759c9[_0xd266('0x80')]();_0xf21b4d[_0xd266('0x3f')](_0xd266('0x7c'));_0xf21b4d[_0xd266('0x3f')](_0xd266('0x81'),_0xd266('0x59'));if(_0x3097a3[_0xd266('0x82')]){_0x3097a3[_0xd266('0x82')][_0xd266('0x27')](function(_0x69132b){var _0x236048=_0x69132b[0x0]===_0xd266('0x83')?_0x69132b[0x0]:'i.'+_0x69132b[0x0];_0x5759c9[_0xd266('0x82')](_0x236048,_0x69132b[0x1]===_0xd266('0x84')?![]:!![]);});}if(!_[_0xd266('0x6c')](_0x259f07)){_0x5759c9[_0xd266('0x5b')](_0x1fcc87);_0xf21b4d['where']('t.id\x20IN\x20?',_0x259f07);}BPromise[_0xd266('0x85')]()[_0xd266('0x1c')](function(){if(!_0x4bcf00){if(_0x5c3dbe[_0xd266('0x32')][_0xd266('0x86')])return;_0xf21b4d[_0xd266('0x3b')](_0xd266('0x87'));_0x5759c9['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5c3dbe[_0xd266('0x88')]['role']!==_0xd266('0x89'))return;return _0x5c3dbe[_0xd266('0x88')][_0xd266('0x8a')]({'attributes':['id'],'raw':!![]})[_0xd266('0x1c')](function(_0x246b91){if(_[_0xd266('0x6c')](_0x246b91)){_0xf21b4d[_0xd266('0x3b')](_0xd266('0x8b'));_0x5759c9[_0xd266('0x3b')](_0xd266('0x8b'));}else{_0xf21b4d[_0xd266('0x3b')](_0xd266('0x8c'),_['map'](_0x246b91,'id'));_0x5759c9[_0xd266('0x3b')](_0xd266('0x8c'),_[_0xd266('0x22')](_0x246b91,'id'));}});})[_0xd266('0x1c')](function(){if(_0x5c3dbe[_0xd266('0x88')]['role']===_0xd266('0x89')&&!_0x4bcf00&&!_0x5c3dbe[_0xd266('0x32')]['MailAccountId'])return[];return db[_0xd266('0x8d')]['query'](_0xf21b4d[_0xd266('0x8e')](),_0x4ba813);})[_0xd266('0x1c')](function(_0x2eddd1){_0x2983ff[_0xd266('0x17')]=_0x2eddd1[_0xd266('0x58')];if(_0x2983ff['count']===0x0)return[];return db['sequelize']['query'](_0x1d7193[_0xd266('0x8e')](),_0x4ba813)[_0xd266('0x1c')](function(_0x213ab0){_0x21a0a2=_[_0xd266('0x8f')](_0x213ab0,'id');_0x4ba813=_['merge'](_0x4ba813,{'model':db[_0xd266('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c3dbe[_0xd266('0x32')][_0xd266('0x37')]){_0x3097a3[_0xd266('0x36')][_0xd266('0x27')](function(_0x2597f8){_0x5759c9[_0xd266('0x3f')]('i.'+_0x2597f8);});}else{_0x5759c9[_0xd266('0x3f')](_0xd266('0x81'),_0xd266('0x59'));_0x5759c9[_0xd266('0x3f')]('a.key',_0xd266('0x90'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x91'),_0xd266('0x92'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x93'),_0xd266('0x83'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x7c'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x94'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x95'));_0x5759c9['field'](_0xd266('0x96'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x97'));_0x5759c9[_0xd266('0x3f')]('i.attach');_0x5759c9[_0xd266('0x3f')](_0xd266('0x98'));_0x5759c9['field'](_0xd266('0x99'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x9a'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x9b'));_0x5759c9['field'](_0xd266('0x9c'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x9d'));_0x5759c9['field']('i.substatus');_0x5759c9[_0xd266('0x3f')](_0xd266('0x9e'));_0x5759c9[_0xd266('0x3f')](_0xd266('0x9f'));_0x5759c9[_0xd266('0x3f')](_0xd266('0xa0'));_0x5759c9['field'](_0xd266('0xa1'));_0x5759c9['field'](_0xd266('0xa2'),_0xd266('0xa3'));_0x5759c9[_0xd266('0x3f')](_0xd266('0xa4'),_0xd266('0xa5'));_0x5759c9[_0xd266('0x3f')](_0xd266('0xa6'),_0xd266('0xa7'));_0x5759c9['field'](_0xd266('0xa8'),_0xd266('0xa9'));_0x5759c9['field'](_0xd266('0xaa'),_0xd266('0xab'));_0x5759c9[_0xd266('0x3f')](_0xd266('0xac'),_0xd266('0xad'));_0x5759c9['field'](_0xd266('0xae'),_0xd266('0xaf'));_0x5759c9['field']('o.internal','Owner.internal');_0x5759c9['field'](_0xd266('0xb0'),_0xd266('0x24'));}if(_0x3097a3['limit'])_0x5759c9[_0xd266('0x16')](_0x3097a3[_0xd266('0x16')]);if(_0x3097a3[_0xd266('0x18')])_0x5759c9[_0xd266('0x18')](_0x3097a3[_0xd266('0x18')]);return db[_0xd266('0x8d')][_0xd266('0x32')](_0x5759c9['toString'](),_0x4ba813);})[_0xd266('0x1c')](function(_0x2d0917){if(_0x2d0917[_0xd266('0x58')]>0x0)_0x305d23['where']('ui.MailInteractionId\x20IN\x20?',_[_0xd266('0x22')](_0x2d0917,'id'));return db[_0xd266('0x8d')][_0xd266('0x32')](_0x305d23[_0xd266('0x8e')](),_0x4ba813)['then'](function(_0x39c8a4){var _0x4ddeeb=_[_0xd266('0xb1')](_0x39c8a4,'MailInteractionId');var _0x5361fe=[];return db[_0xd266('0xb2')][_0xd266('0xb3')]({'attributes':[_0xd266('0xb4')],'raw':!![]})[_0xd266('0x1c')](function(_0x58dd3f){var _0x568366=_0x58dd3f[_0xd266('0xb4')];_0x2d0917[_0xd266('0x27')](function(_0x28f218){_0x5361fe[_0xd266('0xb5')](updateMailInteraction(_0x28f218,_0x21a0a2,_0x4ddeeb,_0x568366));});return BPromise[_0xd266('0xb6')](_0x5361fe);});});});})[_0xd266('0x1c')](function(_0x5a90b6){_0x2983ff[_0xd266('0xb7')]=_0x5a90b6;return _0x2983ff;})[_0xd266('0x1c')](respondWithFilteredResult(_0x58030b,_0x3097a3))[_0xd266('0x2d')](handleError(_0x58030b,null));};exports[_0xd266('0xb8')]=function(_0x3df657,_0x5f1ccc){var _0x151122={'raw':![],'where':{'id':_0x3df657[_0xd266('0xb9')]['id']}},_0x1a0c11={};_0x1a0c11[_0xd266('0x35')]=_[_0xd266('0x33')](db[_0xd266('0x2f')]['rawAttributes']);_0x1a0c11[_0xd266('0x32')]=_['keys'](_0x3df657[_0xd266('0x32')]);_0x1a0c11['filters']=_[_0xd266('0x34')](_0x1a0c11[_0xd266('0x35')],_0x1a0c11[_0xd266('0x32')]);_0x151122['attributes']=_[_0xd266('0x34')](_0x1a0c11['model'],qs[_0xd266('0x37')](_0x3df657[_0xd266('0x32')][_0xd266('0x37')]));_0x151122[_0xd266('0x36')]=_0x151122[_0xd266('0x36')]['length']?_0x151122[_0xd266('0x36')]:_0x1a0c11[_0xd266('0x35')];if(_0x3df657[_0xd266('0x32')][_0xd266('0xba')]){_0x151122[_0xd266('0xbb')]=[{'all':!![]}];}_0x151122=_[_0xd266('0xbc')]({},_0x151122,_0x3df657[_0xd266('0xbd')]);return db['MailInteraction']['find'](_0x151122)[_0xd266('0x1c')](handleEntityNotFound(_0x5f1ccc,null))[_0xd266('0x1c')](respondWithResult(_0x5f1ccc,null))[_0xd266('0x2d')](handleError(_0x5f1ccc,null));};exports[_0xd266('0xbe')]=function(_0x2f5c53,_0x50d912){return db[_0xd266('0x2f')][_0xd266('0xbe')](_0x2f5c53[_0xd266('0xbf')],{})['then'](respondWithResult(_0x50d912,0xc9))[_0xd266('0x2d')](handleError(_0x50d912,null));};exports['update']=function(_0x2080fc,_0x34544c){if(_0x2080fc['body']['id']){delete _0x2080fc[_0xd266('0xbf')]['id'];}return db[_0xd266('0x2f')][_0xd266('0x68')]({'where':{'id':_0x2080fc[_0xd266('0xb9')]['id']}})[_0xd266('0x1c')](handleEntityNotFound(_0x34544c,null))[_0xd266('0x1c')](saveUpdates(_0x2080fc['body'],null))[_0xd266('0x1c')](respondWithResult(_0x34544c,null))[_0xd266('0x2d')](handleError(_0x34544c,null));};exports['destroy']=function(_0x44c7ca,_0x420d30){return db[_0xd266('0x2f')][_0xd266('0x68')]({'where':{'id':_0x44c7ca[_0xd266('0xb9')]['id']}})['then'](handleEntityNotFound(_0x420d30,null))[_0xd266('0x1c')](removeEntity(_0x420d30,null))[_0xd266('0x2d')](handleError(_0x420d30,null));};exports['describe']=function(_0x2d0720,_0x4871db){return db[_0xd266('0x2f')][_0xd266('0xc0')]()[_0xd266('0x1c')](respondWithResult(_0x4871db,null))[_0xd266('0x2d')](handleError(_0x4871db,null));};exports[_0xd266('0xc1')]=function(_0xc61d87,_0xac7da1){return db[_0xd266('0x28')]['find']({'where':{'id':_0xc61d87['params']['id']}})['then'](handleEntityNotFound(_0xac7da1,null))[_0xd266('0x1c')](function(_0x4f44fd){if(_0x4f44fd){return _0x4f44fd[_0xd266('0xc1')](_0xc61d87[_0xd266('0xbf')][_0xd266('0xc2')],_['omit'](_0xc61d87[_0xd266('0xbf')],[_0xd266('0xc2'),'id'])||{});}})[_0xd266('0x1c')](respondWithResult(_0xac7da1,null))[_0xd266('0x2d')](handleError(_0xac7da1,null));};exports['getMessages']=function(_0x4c198e,_0x499de7){var _0x1c0402={'raw':![],'where':{}};var _0x1d155e={};var _0x1f942b={'count':0x0,'rows':[]};return db[_0xd266('0x2f')]['findOne']({'where':{'id':_0x4c198e[_0xd266('0xb9')]['id']}})['then'](handleEntityNotFound(_0x499de7,null))[_0xd266('0x1c')](function(_0x3eae52){if(_0x3eae52){_0x1d155e[_0xd266('0x35')]=_['keys'](db[_0xd266('0x28')][_0xd266('0xc3')]);_0x1d155e[_0xd266('0x32')]=_[_0xd266('0x33')](_0x4c198e[_0xd266('0x32')]);_0x1d155e[_0xd266('0x3c')]=_['intersection'](_0x1d155e[_0xd266('0x35')],_0x1d155e['query']);_0x1c0402[_0xd266('0x36')]=_[_0xd266('0x34')](_0x1d155e[_0xd266('0x35')],qs['fields'](_0x4c198e[_0xd266('0x32')][_0xd266('0x37')]));_0x1c0402[_0xd266('0x36')]=_0x1c0402[_0xd266('0x36')][_0xd266('0x58')]?_0x1c0402[_0xd266('0x36')]:_0x1d155e[_0xd266('0x35')];if(!_0x4c198e['query'][_0xd266('0x38')](_0xd266('0x39'))){_0x1c0402[_0xd266('0x16')]=qs[_0xd266('0x16')](_0x4c198e[_0xd266('0x32')]['limit']);_0x1c0402[_0xd266('0x18')]=qs[_0xd266('0x18')](_0x4c198e[_0xd266('0x32')][_0xd266('0x18')]);}_0x1c0402[_0xd266('0x82')]=qs['sort'](_0x4c198e[_0xd266('0x32')][_0xd266('0x3a')]);_0x1c0402['where']=qs['filters'](_[_0xd266('0x3d')](_0x4c198e[_0xd266('0x32')],_0x1d155e[_0xd266('0x3c')]));_0x1c0402[_0xd266('0x3b')][_0xd266('0xc4')]=_0x3eae52['id'];if(_0x4c198e[_0xd266('0x32')]['filter']){_0x1c0402[_0xd266('0x3b')]=_['merge'](_0x1c0402[_0xd266('0x3b')],{'$or':_[_0xd266('0x22')](_0x1c0402[_0xd266('0x36')],function(_0x43c23b){var _0x5ddf77={};_0x5ddf77[_0x43c23b]={'$like':'%'+_0x4c198e[_0xd266('0x32')][_0xd266('0x75')]+'%'};return _0x5ddf77;})});}if(_0x4c198e[_0xd266('0x32')]['$gte']){var _0x182604=_0x4c198e['query']['$gte'][_0xd266('0x26')](',');var _0x18e0ef={};_0x18e0ef[_0x182604[0x0]]={'$gte':moment(_0x182604[0x1])[_0xd266('0xc5')](_0xd266('0xc6'))};_0x1c0402[_0xd266('0x3b')]=_[_0xd266('0xbc')](_0x1c0402['where'],_0x18e0ef);}_0x1c0402=_[_0xd266('0xbc')]({},_0x1c0402,_0x4c198e['options']);return db[_0xd266('0x28')][_0xd266('0x17')]({'where':_0x1c0402['where']})['then'](function(_0x5d83df){_0x1f942b['count']=_0x5d83df;if(_0x4c198e['query'][_0xd266('0xba')]){_0x1c0402[_0xd266('0xbb')]=[{'all':!![]}];}return db['MailMessage'][_0xd266('0xc7')](_0x1c0402);})[_0xd266('0x1c')](function(_0x2e98c4){if(_0x4c198e[_0xd266('0x32')][_0xd266('0xc8')]===_0xd266('0xc9')){for(var _0x5d7642=0x0;_0x5d7642<_0x2e98c4[_0xd266('0x58')];_0x5d7642++){_0x2e98c4[_0x5d7642][_0xd266('0xbf')]=juice(_0x2e98c4[_0x5d7642][_0xd266('0xbf')]);}}_0x1f942b['rows']=_0x2e98c4;return _0x1f942b;});}})['then'](respondWithFilteredResult(_0x499de7,_0x1c0402))[_0xd266('0x2d')](handleError(_0x499de7,null));};exports[_0xd266('0xca')]=function(_0x3c784e,_0xd22fc6){return db[_0xd266('0x2f')][_0xd266('0x68')]({'where':{'id':_0x3c784e['params']['id']}})['then'](handleEntityNotFound(_0xd22fc6,null))[_0xd266('0x1c')](function(_0x1da23e){if(_0x1da23e){return _0x1da23e[_0xd266('0xcb')](_0x3c784e['body'][_0xd266('0xc2')],_[_0xd266('0xcc')](_0x3c784e[_0xd266('0xbf')],[_0xd266('0xc2'),'id'])||{})['spread'](function(){return db[_0xd266('0x64')][_0xd266('0xc7')]({'attributes':['id',_0xd266('0x20'),_0xd266('0x40')],'where':{'id':_0x3c784e[_0xd266('0xbf')][_0xd266('0xc2')]}});})['then'](function(_0x44e726){socket[_0xd266('0xcd')](_0xd266('0xce'),{'id':Number(_0x3c784e[_0xd266('0xb9')]['id']),'tags':_0x44e726||[]});return{'id':Number(_0x3c784e[_0xd266('0xb9')]['id']),'tags':_0x44e726||[]};});}})[_0xd266('0x1c')](respondWithResult(_0xd22fc6,null))['catch'](handleError(_0xd22fc6,null));};exports[_0xd266('0xcf')]=function(_0x4fbfd9,_0x3b6002){return db[_0xd266('0x2f')][_0xd266('0x68')]({'where':{'id':_0x4fbfd9[_0xd266('0xb9')]['id']}})[_0xd266('0x1c')](handleEntityNotFound(_0x3b6002,null))[_0xd266('0x1c')](function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0xd266('0xcf')](_0x4fbfd9['query'][_0xd266('0xc2')]);}})[_0xd266('0x1c')](respondWithStatusCode(_0x3b6002,null))[_0xd266('0x2d')](handleError(_0x3b6002,null));};exports[_0xd266('0xd0')]=function(_0x422438,_0x420f6e){var _0x3271c0=moment()[_0xd266('0xd1')]()[_0xd266('0x8e')]();var _0x193114=path[_0xd266('0xd2')](config[_0xd266('0xd3')],_0xd266('0xd4'),_0xd266('0xd5'),_0xd266('0xd6'));var _0x370c1b=path[_0xd266('0xd2')](config[_0xd266('0xd3')],'server',_0xd266('0xd5'),_0xd266('0xd7'));var _0xfabd5a=path[_0xd266('0xd2')](_0x193114,_0x3271c0);var _0x534e99=util[_0xd266('0xc5')](_0xd266('0xd8'),_0x422438['params']['id'],_0x3271c0);var _0xb09462=path[_0xd266('0xd2')](_0x193114,_0x534e99);var _0x5c29e7=[];if(_0x422438[_0xd266('0x32')][_0xd266('0xd7')]){_0x5c29e7[_0xd266('0xb5')]({'model':db[_0xd266('0xd9')],'as':_0xd266('0xda'),'raw':!![]});}var _0x11cc33=[{'model':db[_0xd266('0x28')],'as':_0xd266('0xdb'),'attributes':['id',_0xd266('0xbf'),_0xd266('0x41'),'to','cc',_0xd266('0xdc'),_0xd266('0xdd'),_0xd266('0xde')],'where':{'secret':![]},'order':qs[_0xd266('0x3a')]('id'),'include':_0x5c29e7}];return db[_0xd266('0x2f')][_0xd266('0x68')]({'where':{'id':_0x422438[_0xd266('0xb9')]['id']},'include':_0x11cc33})[_0xd266('0x1c')](handleEntityNotFound(_0x420f6e,null))['then'](function(_0x56815f){if(_0x56815f&&_0x56815f['Messages']){var _0x40659d=_0x56815f[_0xd266('0xdf')]({'plain':!![]});fs[_0xd266('0xe0')](_0xfabd5a);return BPromise[_0xd266('0xe1')](_0x40659d[_0xd266('0xdb')],function(_0xd117fc,_0x59b209){var _0x21fc0d={'from':_0xd117fc[_0xd266('0x41')],'to':_0xd117fc['to'],'subject':_0xd117fc['subject'],'html':htmlEntities[_0xd266('0xe2')](_0xd117fc[_0xd266('0xbf')]),'headers':{'Date':moment(_0xd117fc[_0xd266('0xde')])[_0xd266('0xc5')](_0xd266('0xe3'))},'attachments':[]};if(_0xd117fc['cc']){_0x21fc0d['headers']['Cc']=_0xd117fc['cc'];}if(_0xd117fc[_0xd266('0xdc')]){_0x21fc0d[_0xd266('0xe4')][_0xd266('0xe5')]=_0xd117fc[_0xd266('0xdc')];}return new BPromise(function(_0x1a8aff,_0x306dcf){if(_0xd117fc[_0xd266('0xda')]){for(var _0x4537f9=0x0;_0x4537f9<_0xd117fc['Attachments'][_0xd266('0x58')];_0x4537f9++){var _0x3ca214=_0xd117fc[_0xd266('0xda')][_0x4537f9];var _0x27223b=path['join'](_0x370c1b,_0x3ca214['basename']);if(fs[_0xd266('0xe6')](_0x27223b)){_0x21fc0d[_0xd266('0xd7')]['push']({'name':_0x3ca214['name'],'contentType':_0x3ca214[_0xd266('0x69')],'data':fs[_0xd266('0xe7')](_0x27223b)});}}}emlformat['build'](_0x21fc0d,function(_0x5f574d,_0x598d6a){if(_0x5f574d)return _0x306dcf(_0x5f574d);fs['writeFileSync'](path[_0xd266('0xd2')](_0xfabd5a,util[_0xd266('0xc5')](_0xd266('0xe8'),_0x59b209)),_0x598d6a);return _0x1a8aff(_0x598d6a);});});})[_0xd266('0x1c')](function(){return new BPromise(function(_0x44f64a,_0x51ec4c){zipdir(_0xfabd5a,{'saveTo':_0xb09462},function(_0x3472e5,_0x2fdca1){if(_0x3472e5)return _0x51ec4c(_0x3472e5);return _0x44f64a(_0x2fdca1);});})[_0xd266('0x1c')](function(){return new BPromise(function(_0x1fcd29,_0x44840c){rimraf(_0xfabd5a,function(_0x43fb10){if(_0x43fb10)_0x44840c(_0x43fb10);return _0x1fcd29();});});})[_0xd266('0x1c')](function(){return _0x420f6e['download'](_0xb09462,_0x534e99,function(_0x5da712){if(!_0x5da712)fs[_0xd266('0xe9')](_0xb09462);});});});}else{return _0x420f6e['sendStatus'](0xc8);}})[_0xd266('0x2d')](handleError(_0x420f6e,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a1767c4..d06c016 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 _0xcc6e=['hook','exports','../../mysqldb','MailInteraction','setMaxListeners','save','update','remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x3d4672,_0x298336){var _0x544a88=function(_0x4b3f13){while(--_0x4b3f13){_0x3d4672['push'](_0x3d4672['shift']());}};_0x544a88(++_0x298336);}(_0xcc6e,0x1c4));var _0xecc6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc6e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xecc6('0x0'))['db'][_0xecc6('0x1')];var MailMessage=require(_0xecc6('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xecc6('0x2')](0x0);var events={'afterCreate':_0xecc6('0x3'),'afterUpdate':_0xecc6('0x4'),'afterDestroy':_0xecc6('0x5')};function emitEvent(_0x100979){return function(_0x2e222d,_0x582c64,_0x494704){_0x2e222d[_0xecc6('0x6')]({'attributes':['id'],'raw':!![]})[_0xecc6('0x7')](function(_0x8e18e8){_0x2e222d['setDataValue'](_0xecc6('0x8'),_0x8e18e8[_0xecc6('0x9')](function(_0x58521f){return{'id':_0x58521f['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2e222d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xecc6('0x7')](function(_0x532b46){_0x2e222d[_0xecc6('0xa')](_0xecc6('0xb'),_0x532b46[_0xecc6('0xc')]);MailInteractionEvents[_0xecc6('0xd')](_0x100979+':'+_0x2e222d['id'],_0x2e222d);MailInteractionEvents[_0xecc6('0xd')](_0x100979,_0x2e222d);_0x494704(null);})[_0xecc6('0xe')](_0x494704(null));};}for(var e in events){if(events[_0xecc6('0xf')](e)){var event=events[e];MailInteraction[_0xecc6('0x10')](e,emitEvent(event));}}module[_0xecc6('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xd67a=['hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll','unreadMessages','length'];(function(_0x433a8c,_0x45d79a){var _0x38fe59=function(_0x383efc){while(--_0x383efc){_0x433a8c['push'](_0x433a8c['shift']());}};_0x38fe59(++_0x45d79a);}(_0xd67a,0x122));var _0xad67=function(_0x3f7f58,_0x589467){_0x3f7f58=_0x3f7f58-0x0;var _0x33c17c=_0xd67a[_0x3f7f58];return _0x33c17c;};'use strict';var EventEmitter=require(_0xad67('0x0'));var MailInteraction=require(_0xad67('0x1'))['db'][_0xad67('0x2')];var MailMessage=require(_0xad67('0x1'))['db'][_0xad67('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xad67('0x4')](0x0);var events={'afterCreate':_0xad67('0x5'),'afterUpdate':_0xad67('0x6'),'afterDestroy':_0xad67('0x7')};function emitEvent(_0x2ab9e4){return function(_0x312c6c,_0x11f86a,_0x2d969d){_0x312c6c['getUsers']({'attributes':['id'],'raw':!![]})[_0xad67('0x8')](function(_0x1924d6){_0x312c6c[_0xad67('0x9')](_0xad67('0xa'),_0x1924d6['map'](function(_0x1f3708){return{'id':_0x1f3708['id']};}));return MailMessage[_0xad67('0xb')]({'where':{'MailInteractionId':_0x312c6c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xad67('0x8')](function(_0x4d5891){_0x312c6c['setDataValue'](_0xad67('0xc'),_0x4d5891[_0xad67('0xd')]);MailInteractionEvents['emit'](_0x2ab9e4+':'+_0x312c6c['id'],_0x312c6c);MailInteractionEvents['emit'](_0x2ab9e4,_0x312c6c);_0x2d969d(null);})['catch'](_0x2d969d(null));};}for(var e in events){if(events[_0xad67('0xe')](e)){var event=events[e];MailInteraction[_0xad67('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 0706ffb..bf189a1 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 _0x3924=['MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x50a19b,_0x80c4d0){var _0x19b42d=function(_0x15a23f){while(--_0x15a23f){_0x50a19b['push'](_0x50a19b['shift']());}};_0x19b42d(++_0x80c4d0);}(_0x3924,0x1ba));var _0x4392=function(_0xe926ec,_0x5c31ed){_0xe926ec=_0xe926ec-0x0;var _0x304bf2=_0x3924[_0xe926ec];return _0x304bf2;};'use strict';var _=require(_0x4392('0x0'));var util=require(_0x4392('0x1'));var logger=require(_0x4392('0x2'))('api');var moment=require(_0x4392('0x3'));var BPromise=require('bluebird');var rp=require(_0x4392('0x4'));var fs=require('fs');var path=require(_0x4392('0x5'));var rimraf=require('rimraf');var config=require(_0x4392('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x4392('0x7')]=function(_0x11eb36,_0x24ad85){return _0x11eb36['define'](_0x4392('0x8'),attributes,{'tableName':_0x4392('0x9'),'paranoid':![],'indexes':[{'name':_0x4392('0xa'),'fields':[_0x4392('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1c778b,_0x4537b1,_0x52343b){if(_0x1c778b[_0x4392('0xc')]){_0x1c778b['substatusAt']=moment()[_0x4392('0xd')](_0x4392('0xe'));}if(_0x1c778b[_0x4392('0xf')]){_0x1c778b[_0x4392('0x10')]=moment()[_0x4392('0xd')](_0x4392('0xe'));}_0x52343b(null,_0x4537b1);},'beforeUpdate':function(_0x7be5f1,_0x586f11,_0x52e952){if(_0x7be5f1[_0x4392('0x11')](_0x4392('0xc'))){_0x7be5f1['substatusAt']=_0x7be5f1[_0x4392('0xc')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x7be5f1['changed'](_0x4392('0xf'))){_0x7be5f1[_0x4392('0x10')]=moment()[_0x4392('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x7be5f1[_0x4392('0xc')]=null;_0x7be5f1['substatusAt']=null;}_0x52e952(null,_0x7be5f1);},'afterUpdate':function(_0x4e7850,_0x39e6fc,_0x5cf490){var _0x72bc2b=_0x11eb36[_0x4392('0x12')];var _0x1d3ba4=_0x4e7850[_0x4392('0x13')]({'plain':!![]});if(_0x1d3ba4[_0x4392('0xf')]){return _0x72bc2b['MailMessage'][_0x4392('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x1d3ba4['id']}})[_0x4392('0x15')](function(){_0x5cf490();})[_0x4392('0x16')](function(_0x140bc9){_0x5cf490(_0x140bc9);});}else{_0x5cf490();}}},'charset':_0x4392('0x17'),'collate':_0x4392('0x18')});}; \ No newline at end of file +var _0x0fe3=['path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','closed','format','YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','get','MailMessage','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x28688d,_0x190a6c){var _0x2c043e=function(_0x3f5c61){while(--_0x3f5c61){_0x28688d['push'](_0x28688d['shift']());}};_0x2c043e(++_0x190a6c);}(_0x0fe3,0xa1));var _0x30fe=function(_0x3cc33b,_0xbee94a){_0x3cc33b=_0x3cc33b-0x0;var _0x45a6f8=_0x0fe3[_0x3cc33b];return _0x45a6f8;};'use strict';var _=require(_0x30fe('0x0'));var util=require(_0x30fe('0x1'));var logger=require(_0x30fe('0x2'))(_0x30fe('0x3'));var moment=require(_0x30fe('0x4'));var BPromise=require(_0x30fe('0x5'));var rp=require(_0x30fe('0x6'));var fs=require('fs');var path=require(_0x30fe('0x7'));var rimraf=require(_0x30fe('0x8'));var config=require(_0x30fe('0x9'));var attributes=require(_0x30fe('0xa'));module[_0x30fe('0xb')]=function(_0x1bb5c4,_0x31dc6e){return _0x1bb5c4[_0x30fe('0xc')](_0x30fe('0xd'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x30fe('0xe'),'fields':[_0x30fe('0xf'),'to'],'type':_0x30fe('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2b2b4f,_0x1371bd,_0x41b37d){if(_0x2b2b4f[_0x30fe('0x11')]){_0x2b2b4f[_0x30fe('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2b2b4f[_0x30fe('0x13')]){_0x2b2b4f['closedAt']=moment()[_0x30fe('0x14')](_0x30fe('0x15'));}_0x41b37d(null,_0x1371bd);},'beforeUpdate':function(_0x32f5c8,_0x159a08,_0x59d4b1){if(_0x32f5c8[_0x30fe('0x16')](_0x30fe('0x11'))){_0x32f5c8[_0x30fe('0x12')]=_0x32f5c8[_0x30fe('0x11')]?moment()[_0x30fe('0x14')](_0x30fe('0x15')):null;}if(_0x32f5c8[_0x30fe('0x16')](_0x30fe('0x13'))){_0x32f5c8[_0x30fe('0x17')]=moment()[_0x30fe('0x14')](_0x30fe('0x15'));_0x32f5c8['substatus']=null;_0x32f5c8[_0x30fe('0x12')]=null;}_0x59d4b1(null,_0x32f5c8);},'afterUpdate':function(_0x3fd617,_0x3d3901,_0x32b148){var _0x31fd00=_0x1bb5c4['models'];var _0x319f7b=_0x3fd617[_0x30fe('0x18')]({'plain':!![]});if(_0x319f7b[_0x30fe('0x13')]){return _0x31fd00[_0x30fe('0x19')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x319f7b['id']}})['then'](function(){_0x32b148();})[_0x30fe('0x1a')](function(_0xeff131){_0x32b148(_0xeff131);});}else{_0x32b148();}}},'charset':'utf8mb4','collate':_0x30fe('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 2066f31..f63271c 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 _0x3ff6=['body','options','raw','attributes','limit','then','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update'];(function(_0x31f215,_0x3dba42){var _0x3a60a5=function(_0x4cdc77){while(--_0x4cdc77){_0x31f215['push'](_0x31f215['shift']());}};_0x3a60a5(++_0x3dba42);}(_0x3ff6,0x1a3));var _0x63ff=function(_0x5ad666,_0x32ea02){_0x5ad666=_0x5ad666-0x0;var _0x19934e=_0x3ff6[_0x5ad666];return _0x19934e;};'use strict';var _=require(_0x63ff('0x0'));var util=require(_0x63ff('0x1'));var moment=require(_0x63ff('0x2'));var BPromise=require(_0x63ff('0x3'));var rs=require(_0x63ff('0x4'));var fs=require('fs');var Redis=require(_0x63ff('0x5'));var db=require(_0x63ff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x63ff('0x7'))(_0x63ff('0x8'));var config=require(_0x63ff('0x9'));var jayson=require(_0x63ff('0xa'));var client=jayson[_0x63ff('0xb')]['http']({'port':0x232a});config[_0x63ff('0xc')]=_[_0x63ff('0xd')](config[_0x63ff('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x63ff('0xe'))(new Redis(config[_0x63ff('0xc')]));require(_0x63ff('0xf'))[_0x63ff('0x10')](socket);function respondWithRpcPromise(_0x387b03,_0xb631c7,_0x8794af){return new BPromise(function(_0xfd891e,_0x42d557){return client[_0x63ff('0x11')](_0x387b03,_0x8794af)['then'](function(_0xd441d6){logger[_0x63ff('0x12')](_0x63ff('0x13'),_0xb631c7,_0x63ff('0x14'));logger[_0x63ff('0x15')](_0x63ff('0x16'),_0xb631c7,_0x63ff('0x14'),JSON[_0x63ff('0x17')](_0xd441d6));if(_0xd441d6[_0x63ff('0x18')]){if(_0xd441d6[_0x63ff('0x18')][_0x63ff('0x19')]===0x1f4){logger[_0x63ff('0x18')](_0x63ff('0x13'),_0xb631c7,_0xd441d6['error'][_0x63ff('0x1a')]);return _0x42d557(_0xd441d6[_0x63ff('0x18')][_0x63ff('0x1a')]);}logger[_0x63ff('0x18')](_0x63ff('0x13'),_0xb631c7,_0xd441d6[_0x63ff('0x18')][_0x63ff('0x1a')]);return _0xfd891e(_0xd441d6['error']['message']);}else{logger[_0x63ff('0x12')](_0x63ff('0x13'),_0xb631c7,_0x63ff('0x14'));_0xfd891e(_0xd441d6['result'][_0x63ff('0x1a')]);}})[_0x63ff('0x1b')](function(_0x176e86){logger[_0x63ff('0x18')](_0x63ff('0x13'),_0xb631c7,_0x176e86);_0x42d557(_0x176e86);});});}exports[_0x63ff('0x1c')]=function(_0x29e361){var _0x46d1db=this;return new Promise(function(_0x5b5f91,_0x21aa64){return db[_0x63ff('0x1d')][_0x63ff('0x1e')](_0x29e361[_0x63ff('0x1f')],{'raw':_0x29e361[_0x63ff('0x20')]?_0x29e361[_0x63ff('0x20')][_0x63ff('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29e361[_0x63ff('0x20')]?_0x29e361[_0x63ff('0x20')]['where']||null:null,'attributes':_0x29e361[_0x63ff('0x20')]?_0x29e361[_0x63ff('0x20')][_0x63ff('0x22')]||null:null,'limit':_0x29e361['options']?_0x29e361[_0x63ff('0x20')][_0x63ff('0x23')]||null:null})[_0x63ff('0x24')](function(_0x10b080){logger[_0x63ff('0x12')](_0x63ff('0x1c'),_0x29e361);logger[_0x63ff('0x15')](_0x63ff('0x1c'),_0x29e361,JSON[_0x63ff('0x17')](_0x10b080));_0x5b5f91(_0x10b080);})[_0x63ff('0x1b')](function(_0xf1113b){logger[_0x63ff('0x18')]('UpdateMailInteraction',_0xf1113b[_0x63ff('0x1a')],_0x29e361);_0x21aa64(_0x46d1db[_0x63ff('0x18')](0x1f4,_0xf1113b[_0x63ff('0x1a')]));});});};exports[_0x63ff('0x25')]=function(_0xe627a9){return new Promise(function(_0x2c26fe,_0xe60793){return db[_0x63ff('0x1d')][_0x63ff('0x26')]({'where':_0xe627a9[_0x63ff('0x20')]?_0xe627a9[_0x63ff('0x20')][_0x63ff('0x27')]||null:null})[_0x63ff('0x24')](function(_0x2cb78a){if(_0x2cb78a){return _0x2cb78a[_0x63ff('0x28')](_0xe627a9['body'][_0x63ff('0x29')],_[_0x63ff('0x2a')](_0xe627a9[_0x63ff('0x1f')],[_0x63ff('0x29'),'id'])||{});}})[_0x63ff('0x2b')](function(_0x46876b){logger['info'](_0x63ff('0x2c'),_0xe627a9);logger[_0x63ff('0x15')]('AddTags',_0xe627a9,JSON[_0x63ff('0x17')](_0x46876b));_0x2c26fe(_0x46876b);})['catch'](function(_0x28d347){logger[_0x63ff('0x18')]('AddTags',_0x28d347[_0x63ff('0x1a')],_0xe627a9);_0xe60793(_this[_0x63ff('0x18')](0x1f4,_0x28d347[_0x63ff('0x1a')]));});});}; \ No newline at end of file +var _0x9797=['catch','UpdateMailInteraction','MailInteraction','update','raw','options','where','attributes','debug','stringify','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x4c1973,_0xfeab10){var _0x4d43e6=function(_0x126e45){while(--_0x126e45){_0x4c1973['push'](_0x4c1973['shift']());}};_0x4d43e6(++_0xfeab10);}(_0x9797,0x1c9));var _0x7979=function(_0x123d3d,_0x114ea5){_0x123d3d=_0x123d3d-0x0;var _0x5707bf=_0x9797[_0x123d3d];return _0x5707bf;};'use strict';var _=require(_0x7979('0x0'));var util=require(_0x7979('0x1'));var moment=require(_0x7979('0x2'));var BPromise=require('bluebird');var rs=require(_0x7979('0x3'));var fs=require('fs');var Redis=require(_0x7979('0x4'));var db=require(_0x7979('0x5'))['db'];var utils=require(_0x7979('0x6'));var logger=require(_0x7979('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7979('0x8'));var client=jayson[_0x7979('0x9')][_0x7979('0xa')]({'port':0x232a});config[_0x7979('0xb')]=_['defaults'](config[_0x7979('0xb')],{'host':_0x7979('0xc'),'port':0x18eb});var socket=require(_0x7979('0xd'))(new Redis(config[_0x7979('0xb')]));require(_0x7979('0xe'))['register'](socket);function respondWithRpcPromise(_0x564af3,_0x27474a,_0x22ca17){return new BPromise(function(_0x3be25f,_0x496b4d){return client['request'](_0x564af3,_0x22ca17)[_0x7979('0xf')](function(_0xd98f9f){logger[_0x7979('0x10')](_0x7979('0x11'),_0x27474a,_0x7979('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x27474a,_0x7979('0x12'),JSON['stringify'](_0xd98f9f));if(_0xd98f9f['error']){if(_0xd98f9f[_0x7979('0x13')][_0x7979('0x14')]===0x1f4){logger[_0x7979('0x13')]('MailInteraction,\x20%s,\x20%s',_0x27474a,_0xd98f9f[_0x7979('0x13')][_0x7979('0x15')]);return _0x496b4d(_0xd98f9f[_0x7979('0x13')][_0x7979('0x15')]);}logger['error'](_0x7979('0x11'),_0x27474a,_0xd98f9f[_0x7979('0x13')][_0x7979('0x15')]);return _0x3be25f(_0xd98f9f[_0x7979('0x13')][_0x7979('0x15')]);}else{logger[_0x7979('0x10')](_0x7979('0x11'),_0x27474a,_0x7979('0x12'));_0x3be25f(_0xd98f9f[_0x7979('0x16')][_0x7979('0x15')]);}})[_0x7979('0x17')](function(_0x469279){logger[_0x7979('0x13')](_0x7979('0x11'),_0x27474a,_0x469279);_0x496b4d(_0x469279);});});}exports[_0x7979('0x18')]=function(_0x2f3294){var _0x46f896=this;return new Promise(function(_0x47c34f,_0x39be8d){return db[_0x7979('0x19')][_0x7979('0x1a')](_0x2f3294['body'],{'raw':_0x2f3294['options']?_0x2f3294['options'][_0x7979('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f3294[_0x7979('0x1c')]?_0x2f3294[_0x7979('0x1c')][_0x7979('0x1d')]||null:null,'attributes':_0x2f3294[_0x7979('0x1c')]?_0x2f3294[_0x7979('0x1c')][_0x7979('0x1e')]||null:null,'limit':_0x2f3294[_0x7979('0x1c')]?_0x2f3294[_0x7979('0x1c')]['limit']||null:null})[_0x7979('0xf')](function(_0x5de476){logger[_0x7979('0x10')](_0x7979('0x18'),_0x2f3294);logger[_0x7979('0x1f')](_0x7979('0x18'),_0x2f3294,JSON[_0x7979('0x20')](_0x5de476));_0x47c34f(_0x5de476);})[_0x7979('0x17')](function(_0x10875e){logger[_0x7979('0x13')](_0x7979('0x18'),_0x10875e[_0x7979('0x15')],_0x2f3294);_0x39be8d(_0x46f896[_0x7979('0x13')](0x1f4,_0x10875e[_0x7979('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0x44ef63){return new Promise(function(_0x48a6c7,_0x43c73d){return db['MailInteraction'][_0x7979('0x21')]({'where':_0x44ef63[_0x7979('0x1c')]?_0x44ef63[_0x7979('0x1c')][_0x7979('0x1d')]||null:null})[_0x7979('0xf')](function(_0x582578){if(_0x582578){return _0x582578[_0x7979('0x22')](_0x44ef63[_0x7979('0x23')]['ids'],_[_0x7979('0x24')](_0x44ef63[_0x7979('0x23')],[_0x7979('0x25'),'id'])||{});}})[_0x7979('0x26')](function(_0x21944e){logger[_0x7979('0x10')](_0x7979('0x27'),_0x44ef63);logger[_0x7979('0x1f')](_0x7979('0x27'),_0x44ef63,JSON[_0x7979('0x20')](_0x21944e));_0x48a6c7(_0x21944e);})[_0x7979('0x17')](function(_0x1c7e7c){logger[_0x7979('0x13')](_0x7979('0x27'),_0x1c7e7c[_0x7979('0x15')],_0x44ef63);_0x43c73d(_this['error'](0x1f4,_0x1c7e7c[_0x7979('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 18ac4d9..ad90eb3 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 _0xff47=['removeListener','mailInteraction:','emit'];(function(_0x4805ca,_0xf06b76){var _0x2fc6a9=function(_0x301d41){while(--_0x301d41){_0x4805ca['push'](_0x4805ca['shift']());}};_0x2fc6a9(++_0xf06b76);}(_0xff47,0xa7));var _0x7ff4=function(_0x15fc07,_0x41cc0c){_0x15fc07=_0x15fc07-0x0;var _0x3d2c0f=_0xff47[_0x15fc07];return _0x3d2c0f;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save','remove','update'];function createListener(_0xc803f9,_0xbd9c6a){return function(_0x4c0046){_0xbd9c6a[_0x7ff4('0x0')](_0xc803f9,_0x4c0046);};}function removeListener(_0x193668,_0x54d396){return function(){MailInteractionEvents[_0x7ff4('0x1')](_0x193668,_0x54d396);};}exports['register']=function(_0x439020){for(var _0x4efec8=0x0,_0x5bb2b2=events['length'];_0x4efec8<_0x5bb2b2;_0x4efec8++){var _0xd8156d=events[_0x4efec8];var _0xac9d13=createListener(_0x7ff4('0x2')+_0xd8156d,_0x439020);MailInteractionEvents['on'](_0xd8156d,_0xac9d13);}}; \ No newline at end of file +var _0x5b3d=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0xeffb06,_0x1f1b06){var _0x49cb13=function(_0x45dd62){while(--_0x45dd62){_0xeffb06['push'](_0xeffb06['shift']());}};_0x49cb13(++_0x1f1b06);}(_0x5b3d,0x162));var _0xd5b3=function(_0x1cb9bd,_0x37af34){_0x1cb9bd=_0x1cb9bd-0x0;var _0x7065c7=_0x5b3d[_0x1cb9bd];return _0x7065c7;};'use strict';var MailInteractionEvents=require(_0xd5b3('0x0'));var events=[_0xd5b3('0x1'),_0xd5b3('0x2'),_0xd5b3('0x3')];function createListener(_0x13ffc8,_0xbcd59b){return function(_0x1caf97){_0xbcd59b[_0xd5b3('0x4')](_0x13ffc8,_0x1caf97);};}function removeListener(_0x5af296,_0x53cc60){return function(){MailInteractionEvents[_0xd5b3('0x5')](_0x5af296,_0x53cc60);};}exports['register']=function(_0x292436){for(var _0x1879b1=0x0,_0x15213e=events[_0xd5b3('0x6')];_0x1879b1<_0x15213e;_0x1879b1++){var _0x320cf4=events[_0x1879b1];var _0x70ec33=createListener(_0xd5b3('0x7')+_0x320cf4,_0x292436);MailInteractionEvents['on'](_0x320cf4,_0x70ec33);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c256f18..90e3429 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 _0x25a3=['put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','show','/:id/download','download','post','tracked','mail','create'];(function(_0x319605,_0x6bfb93){var _0x2aa342=function(_0x28b44d){while(--_0x28b44d){_0x319605['push'](_0x319605['shift']());}};_0x2aa342(++_0x6bfb93);}(_0x25a3,0x121));var _0x325a=function(_0x3e7687,_0x403224){_0x3e7687=_0x3e7687-0x0;var _0x378eee=_0x25a3[_0x3e7687];return _0x378eee;};'use strict';var multer=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var path=require(_0x325a('0x2'));var timeout=require('connect-timeout');var express=require(_0x325a('0x3'));var router=express['Router']();var fs_extra=require(_0x325a('0x4'));var auth=require(_0x325a('0x5'));var interaction=require(_0x325a('0x6'));var config=require('../../config/environment');var controller=require(_0x325a('0x7'));router[_0x325a('0x8')]('/',auth[_0x325a('0x9')](),controller['index']);router['get'](_0x325a('0xa'),auth[_0x325a('0x9')](),controller[_0x325a('0xb')]);router[_0x325a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x325a('0xc')]);router[_0x325a('0x8')](_0x325a('0xd'),auth[_0x325a('0x9')](),controller[_0x325a('0xe')]);router[_0x325a('0xf')]('/',auth['isAuthenticated'](),interaction[_0x325a('0x10')](_0x325a('0x11'),'mailmessage:create'),controller[_0x325a('0x12')]);router[_0x325a('0x13')](_0x325a('0x14'),auth[_0x325a('0x9')](),controller['update']);router['put'](_0x325a('0x15'),auth['isAuthenticated'](),controller[_0x325a('0x16')]);router[_0x325a('0x13')](_0x325a('0x17'),auth[_0x325a('0x9')](),controller[_0x325a('0x18')]);router[_0x325a('0x19')](_0x325a('0x14'),auth[_0x325a('0x9')](),controller[_0x325a('0x1a')]);module[_0x325a('0x1b')]=router; \ No newline at end of file +var _0x3c90=['reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','show','/:id/download','post','mail','mailmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject'];(function(_0x324882,_0x8c9034){var _0x4678be=function(_0x5701f7){while(--_0x5701f7){_0x324882['push'](_0x324882['shift']());}};_0x4678be(++_0x8c9034);}(_0x3c90,0xfd));var _0x03c9=function(_0x1ab187,_0x18e07a){_0x1ab187=_0x1ab187-0x0;var _0x587824=_0x3c90[_0x1ab187];return _0x587824;};'use strict';var multer=require('multer');var util=require(_0x03c9('0x0'));var path=require(_0x03c9('0x1'));var timeout=require(_0x03c9('0x2'));var express=require(_0x03c9('0x3'));var router=express[_0x03c9('0x4')]();var fs_extra=require(_0x03c9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x03c9('0x6'));var config=require('../../config/environment');var controller=require(_0x03c9('0x7'));router[_0x03c9('0x8')]('/',auth[_0x03c9('0x9')](),controller[_0x03c9('0xa')]);router[_0x03c9('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x03c9('0x9')](),controller[_0x03c9('0xb')]);router[_0x03c9('0x8')](_0x03c9('0xc'),auth[_0x03c9('0x9')](),controller['download']);router[_0x03c9('0xd')]('/',auth[_0x03c9('0x9')](),interaction['tracked'](_0x03c9('0xe'),_0x03c9('0xf')),controller['create']);router[_0x03c9('0x10')](_0x03c9('0x11'),auth['isAuthenticated'](),controller[_0x03c9('0x12')]);router[_0x03c9('0x10')](_0x03c9('0x13'),auth[_0x03c9('0x9')](),controller[_0x03c9('0x14')]);router[_0x03c9('0x10')](_0x03c9('0x15'),auth[_0x03c9('0x9')](),controller[_0x03c9('0x16')]);router['delete']('/:id',auth[_0x03c9('0x9')](),controller[_0x03c9('0x17')]);module[_0x03c9('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1cb3705..bf4eaba 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 _0x08e3=['out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM'];(function(_0x318f46,_0x3ed5a9){var _0x125f88=function(_0x388844){while(--_0x388844){_0x318f46['push'](_0x318f46['shift']());}};_0x125f88(++_0x3ed5a9);}(_0x08e3,0x165));var _0x308e=function(_0x25e2c2,_0x4b7e99){_0x25e2c2=_0x25e2c2-0x0;var _0x36254e=_0x08e3[_0x25e2c2];return _0x36254e;};'use strict';var Sequelize=require(_0x308e('0x0'));var _=require(_0x308e('0x1'));module[_0x308e('0x2')]={'body':{'type':Sequelize[_0x308e('0x3')](_0x308e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x308e('0x3')]('medium')},'read':{'type':Sequelize[_0x308e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x308e('0x6')]('in',_0x308e('0x7')),'defaultValue':_0x308e('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x308e('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x308e('0x3')](_0x308e('0x4'))},'cc':{'type':Sequelize[_0x308e('0x3')](_0x308e('0x4'))},'bcc':{'type':Sequelize[_0x308e('0x3')](_0x308e('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x308e('0x9')]},'attach':{'type':Sequelize[_0x308e('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x308e('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x308e('0x3')]('long')},'originCc':{'type':Sequelize[_0x308e('0x3')](_0x308e('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x308e('0xb'),_0x308e('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x429e=['out','STRING','long','DATE','Email','sequelize','lodash','TEXT','BOOLEAN','ENUM'];(function(_0x295572,_0x58a177){var _0x285bef=function(_0x3d284e){while(--_0x3d284e){_0x295572['push'](_0x295572['shift']());}};_0x285bef(++_0x58a177);}(_0x429e,0xeb));var _0xe429=function(_0x33588b,_0x1ceae0){_0x33588b=_0x33588b-0x0;var _0x62e8bd=_0x429e[_0x33588b];return _0x62e8bd;};'use strict';var Sequelize=require(_0xe429('0x0'));var _=require(_0xe429('0x1'));module['exports']={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe429('0x2')]('medium')},'read':{'type':Sequelize[_0xe429('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe429('0x4')]('in',_0xe429('0x5')),'defaultValue':_0xe429('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe429('0x6')](0x1fe)},'from':{'type':Sequelize[_0xe429('0x6')]},'to':{'type':Sequelize[_0xe429('0x2')](_0xe429('0x7'))},'cc':{'type':Sequelize['TEXT'](_0xe429('0x7'))},'bcc':{'type':Sequelize[_0xe429('0x2')]('long')},'subject':{'type':Sequelize[_0xe429('0x2')]},'sentAt':{'type':Sequelize[_0xe429('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe429('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe429('0x8')]},'originTo':{'type':Sequelize[_0xe429('0x2')](_0xe429('0x7'))},'originCc':{'type':Sequelize[_0xe429('0x2')](_0xe429('0x7'))},'originChannel':{'type':Sequelize[_0xe429('0x4')](_0xe429('0x9'),'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 32ece56..d932922 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 _0xb632=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','undefined','limit','count','offset','Content-Range','json','update','end','sendStatus','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','get','MailInteraction','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','manual','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','Sequelize','email','internal','interface','reject','rejectmessage','unix','toString','join','files','tmp','server','from','bcc','subject','Attachment','decode','headers','Bcc','Attachments','existsSync','push','writeFileSync','download','unlinkSync','eml-format','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info'];(function(_0x240860,_0x20c04d){var _0x40e288=function(_0x38a753){while(--_0x38a753){_0x240860['push'](_0x240860['shift']());}};_0x40e288(++_0x20c04d);}(_0xb632,0x13f));var _0x2b63=function(_0x5715f6,_0x5ce81e){_0x5715f6=_0x5715f6-0x0;var _0x5c8b8b=_0xb632[_0x5715f6];return _0x5c8b8b;};'use strict';var emlformat=require(_0x2b63('0x0'));var moment=require('moment');var BPromise=require(_0x2b63('0x1'));var util=require(_0x2b63('0x2'));var path=require(_0x2b63('0x3'));var fs=require('fs');var _=require(_0x2b63('0x4'));var Redis=require(_0x2b63('0x5'));var htmlToText=require(_0x2b63('0x6'));var qs=require(_0x2b63('0x7'));var logger=require('../../config/logger')(_0x2b63('0x8'));var interaction_log=require('../../config/logger')(_0x2b63('0x9'));var config=require(_0x2b63('0xa'));var db=require(_0x2b63('0xb'))['db'];config[_0x2b63('0xc')]=_[_0x2b63('0xd')](config['redis'],{'host':_0x2b63('0xe'),'port':0x18eb});var socket=require(_0x2b63('0xf'))(new Redis(config[_0x2b63('0xc')]));var htmlEntities=require(_0x2b63('0x10'));require(_0x2b63('0x11'))[_0x2b63('0x12')](socket);var jayson=require(_0x2b63('0x13'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x2b63('0x14')][_0x2b63('0x15')]({'port':0x232b});var client9002=jayson[_0x2b63('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x332d21,_0x33e3b7,_0x58bf95,_0x169c5c){return new BPromise(function(_0x1d6d2a,_0x25d904){var _0xb947ba=_0x169c5c||client;return _0xb947ba[_0x2b63('0x16')](_0x332d21,_0x58bf95)[_0x2b63('0x17')](function(_0x1af462){logger[_0x2b63('0x18')](_0x2b63('0x19'),_0x33e3b7,_0x2b63('0x1a'));logger[_0x2b63('0x1b')](_0x2b63('0x1c'),_0x33e3b7,_0x2b63('0x1a'),JSON[_0x2b63('0x1d')](_0x1af462));if(_0x1af462['error']){if(_0x1af462[_0x2b63('0x1e')]['code']===0x1f4){logger[_0x2b63('0x1e')](_0x2b63('0x19'),_0x33e3b7,_0x1af462['error']['message']);return _0x25d904(_0x1af462[_0x2b63('0x1e')][_0x2b63('0x1f')]);}logger[_0x2b63('0x1e')](_0x2b63('0x19'),_0x33e3b7,_0x1af462['error'][_0x2b63('0x1f')]);return _0x1d6d2a(_0x1af462[_0x2b63('0x1e')][_0x2b63('0x1f')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x33e3b7,'request\x20sent');_0x1d6d2a(_0x1af462[_0x2b63('0x20')][_0x2b63('0x1f')]);}})[_0x2b63('0x21')](function(_0x1c8c42){logger[_0x2b63('0x1e')](_0x2b63('0x19'),_0x33e3b7,_0x1c8c42);_0x25d904(_0x1c8c42);});});}function respondWithResult(_0x3370e3,_0x2432ee){_0x2432ee=_0x2432ee||0xc8;return function(_0x3398c5){if(_0x3398c5){return _0x3370e3[_0x2b63('0x22')](_0x2432ee)['json'](_0x3398c5);}};}function respondWithFilteredResult(_0x4fc8eb,_0xcbcaaa){return function(_0x32fa40){if(_0x32fa40){var _0x1de132=typeof _0xcbcaaa['offset']===_0x2b63('0x23')&&typeof _0xcbcaaa[_0x2b63('0x24')]===_0x2b63('0x23');var _0x48d41c=_0x32fa40[_0x2b63('0x25')];var _0x103cbc=_0x1de132?0x0:_0xcbcaaa[_0x2b63('0x26')];var _0x3f787a=_0x1de132?_0x32fa40[_0x2b63('0x25')]:_0xcbcaaa[_0x2b63('0x26')]+_0xcbcaaa['limit'];var _0x2297c4;if(_0x3f787a>=_0x48d41c){_0x3f787a=_0x48d41c;_0x2297c4=0xc8;}else{_0x2297c4=0xce;}_0x4fc8eb[_0x2b63('0x22')](_0x2297c4);return _0x4fc8eb['set'](_0x2b63('0x27'),_0x103cbc+'-'+_0x3f787a+'/'+_0x48d41c)[_0x2b63('0x28')](_0x32fa40);}return null;};}function saveUpdates(_0xcefffa){return function(_0x259dec){if(_0x259dec){return _0x259dec[_0x2b63('0x29')](_0xcefffa)[_0x2b63('0x17')](function(_0x3f7a0d){return _0x3f7a0d;});}return null;};}function removeEntity(_0x3990e3){return function(_0x3c9f25){if(_0x3c9f25){return _0x3c9f25['destroy']()[_0x2b63('0x17')](function(){_0x3990e3[_0x2b63('0x22')](0xcc)[_0x2b63('0x2a')]();});}};}function handleEntityNotFound(_0x43a3eb){return function(_0x4d5e14){if(!_0x4d5e14){_0x43a3eb[_0x2b63('0x2b')](0x194);}return _0x4d5e14;};}function handleError(_0xfa5cf9,_0x1f5315){_0x1f5315=_0x1f5315||0x1f4;return function(_0x316add){logger[_0x2b63('0x1e')](_0x316add['stack']);if(_0x316add[_0x2b63('0x2c')]){delete _0x316add[_0x2b63('0x2c')];}_0xfa5cf9[_0x2b63('0x22')](_0x1f5315)[_0x2b63('0x2d')](_0x316add);};}exports[_0x2b63('0x2e')]=function(_0x22ba2c,_0x1ac129){var _0x584bdf={},_0x3f6f1e={},_0x475465={'count':0x0,'rows':[]};var _0x150b8e=_['map'](db[_0x2b63('0x2f')][_0x2b63('0x30')],function(_0x2150ea){return{'name':_0x2150ea[_0x2b63('0x31')],'type':_0x2150ea[_0x2b63('0x32')][_0x2b63('0x33')]};});_0x3f6f1e[_0x2b63('0x34')]=_['map'](_0x150b8e,_0x2b63('0x2c'));_0x3f6f1e[_0x2b63('0x35')]=_[_0x2b63('0x36')](_0x22ba2c['query']);_0x3f6f1e[_0x2b63('0x37')]=_['intersection'](_0x3f6f1e[_0x2b63('0x34')],_0x3f6f1e['query']);_0x584bdf[_0x2b63('0x38')]=_[_0x2b63('0x39')](_0x3f6f1e['model'],qs['fields'](_0x22ba2c['query'][_0x2b63('0x3a')]));_0x584bdf[_0x2b63('0x38')]=_0x584bdf[_0x2b63('0x38')][_0x2b63('0x3b')]?_0x584bdf[_0x2b63('0x38')]:_0x3f6f1e[_0x2b63('0x34')];if(!_0x22ba2c[_0x2b63('0x35')][_0x2b63('0x3c')](_0x2b63('0x3d'))){_0x584bdf[_0x2b63('0x24')]=qs[_0x2b63('0x24')](_0x22ba2c['query'][_0x2b63('0x24')]);_0x584bdf[_0x2b63('0x26')]=qs[_0x2b63('0x26')](_0x22ba2c['query']['offset']);}_0x584bdf[_0x2b63('0x3e')]=qs['sort'](_0x22ba2c[_0x2b63('0x35')][_0x2b63('0x3f')]);_0x584bdf[_0x2b63('0x40')]=qs[_0x2b63('0x37')](_[_0x2b63('0x41')](_0x22ba2c[_0x2b63('0x35')],_0x3f6f1e['filters']),_0x150b8e);if(_0x22ba2c[_0x2b63('0x35')][_0x2b63('0x42')]){_0x584bdf[_0x2b63('0x40')]=_[_0x2b63('0x43')](_0x584bdf[_0x2b63('0x40')],{'$or':_['map'](_0x150b8e,function(_0x271f56){if(_0x271f56['type']!==_0x2b63('0x44')){var _0x37a915={};_0x37a915[_0x271f56[_0x2b63('0x2c')]]={'$like':'%'+_0x22ba2c['query']['filter']+'%'};return _0x37a915;}})});}_0x584bdf=_['merge']({},_0x584bdf,_0x22ba2c['options']);var _0x1672ca={'where':_0x584bdf[_0x2b63('0x40')]};return db['MailMessage']['count'](_0x1672ca)[_0x2b63('0x17')](function(_0x40d18c){_0x475465[_0x2b63('0x25')]=_0x40d18c;if(_0x22ba2c[_0x2b63('0x35')][_0x2b63('0x45')]){_0x584bdf[_0x2b63('0x46')]=[{'all':!![]}];}return db[_0x2b63('0x2f')][_0x2b63('0x47')](_0x584bdf);})[_0x2b63('0x17')](function(_0x30a598){_0x475465[_0x2b63('0x48')]=_0x30a598;return _0x475465;})[_0x2b63('0x17')](respondWithFilteredResult(_0x1ac129,_0x584bdf))['catch'](handleError(_0x1ac129,null));};exports[_0x2b63('0x49')]=function(_0x1be511,_0x944e6d){var _0x10d088={'raw':!![],'where':{'id':_0x1be511[_0x2b63('0x4a')]['id']}},_0x33e2aa={};_0x33e2aa[_0x2b63('0x34')]=_[_0x2b63('0x36')](db[_0x2b63('0x2f')][_0x2b63('0x30')]);_0x33e2aa[_0x2b63('0x35')]=_[_0x2b63('0x36')](_0x1be511['query']);_0x33e2aa[_0x2b63('0x37')]=_[_0x2b63('0x39')](_0x33e2aa[_0x2b63('0x34')],_0x33e2aa[_0x2b63('0x35')]);_0x10d088[_0x2b63('0x38')]=_['intersection'](_0x33e2aa[_0x2b63('0x34')],qs[_0x2b63('0x3a')](_0x1be511['query'][_0x2b63('0x3a')]));_0x10d088['attributes']=_0x10d088[_0x2b63('0x38')][_0x2b63('0x3b')]?_0x10d088[_0x2b63('0x38')]:_0x33e2aa['model'];if(_0x1be511['query'][_0x2b63('0x45')]){_0x10d088['include']=[{'all':!![]}];}_0x10d088=_['merge']({},_0x10d088,_0x1be511[_0x2b63('0x4b')]);return db['MailMessage'][_0x2b63('0x4c')](_0x10d088)['then'](handleEntityNotFound(_0x944e6d,null))[_0x2b63('0x17')](respondWithResult(_0x944e6d,null))[_0x2b63('0x21')](handleError(_0x944e6d,null));};exports[_0x2b63('0x29')]=function(_0x3696d2,_0x461db9){if(_0x3696d2['body']['id']){delete _0x3696d2[_0x2b63('0x4d')]['id'];}return db[_0x2b63('0x2f')]['find']({'where':{'id':_0x3696d2[_0x2b63('0x4a')]['id']}})[_0x2b63('0x17')](handleEntityNotFound(_0x461db9,null))[_0x2b63('0x17')](saveUpdates(_0x3696d2[_0x2b63('0x4d')],null))[_0x2b63('0x17')](respondWithResult(_0x461db9,null))[_0x2b63('0x21')](handleError(_0x461db9,null));};exports['destroy']=function(_0x42ab19,_0x1df41e){return db['MailMessage'][_0x2b63('0x4c')]({'where':{'id':_0x42ab19['params']['id']}})['then'](handleEntityNotFound(_0x1df41e,null))['then'](removeEntity(_0x1df41e,null))[_0x2b63('0x21')](handleError(_0x1df41e,null));};exports[_0x2b63('0x4e')]=function(_0x1f01df,_0x1eed4c){return db[_0x2b63('0x2f')][_0x2b63('0x4e')]()[_0x2b63('0x17')](respondWithResult(_0x1eed4c,null))['catch'](handleError(_0x1eed4c,null));};exports[_0x2b63('0x4f')]=function(_0x396b2e,_0x5a53f0){return db[_0x2b63('0x2f')][_0x2b63('0x4f')](_0x396b2e[_0x2b63('0x4d')])[_0x2b63('0x17')](function(_0xdc1dec){if(_0xdc1dec){if(_0xdc1dec[_0x2b63('0x50')]===_0x2b63('0x51')&&!_0xdc1dec[_0x2b63('0x52')]){var _0x54ac9e,_0x1c5295,_0x38e01e;if(_0x396b2e[_0x2b63('0x4d')]['to']){_0x1c5295=_0x396b2e[_0x2b63('0x4d')]['to'][_0x2b63('0x53')](',')[0x0];}return db[_0x2b63('0x54')][_0x2b63('0x55')]({'where':{'id':_0xdc1dec['MailAccountId']},'include':[{'model':db[_0x2b63('0x56')],'as':_0x2b63('0x57'),'include':[{'model':db[_0x2b63('0x58')],'as':_0x2b63('0x59'),'where':{'email':_0x1c5295},'limit':0x1,'order':[[_0x2b63('0x5a'),_0x2b63('0x5b')]]}]},{'model':db[_0x2b63('0x5c')],'as':_0x2b63('0x5d'),'raw':!![]}]})[_0x2b63('0x17')](function(_0x28ba8c){_0x54ac9e=_0x28ba8c;if(_0x54ac9e&&_0x54ac9e[_0x2b63('0x5d')]){var _0x55296e={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x5e')])){_0x55296e[_0x2b63('0x5f')]=_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x5f')];_0x55296e[_0x2b63('0x60')]=_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x60')];_0x55296e['secure']=_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x61')];if(_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x62')]){_0x55296e[_0x2b63('0x63')]={'user':_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x64')],'pass':_0x54ac9e['Smtp'][_0x2b63('0x65')]};}}else{_0x55296e[_0x2b63('0x5e')]=_0x54ac9e[_0x2b63('0x5d')]['service'];_0x55296e['auth']={'user':_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x64')],'pass':_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x65')]};_0x55296e[_0x2b63('0x61')]=_0x54ac9e[_0x2b63('0x5d')][_0x2b63('0x61')];}if(_0x396b2e['body'][_0x2b63('0x66')]&&_0x396b2e[_0x2b63('0x4d')][_0x2b63('0x66')][_0x2b63('0x3b')]){for(var _0x8c04d7=0x0;_0x8c04d7<_0x396b2e[_0x2b63('0x4d')][_0x2b63('0x66')][_0x2b63('0x3b')];_0x8c04d7+=0x1){_0x396b2e[_0x2b63('0x4d')]['attachments'][_0x8c04d7]={'filename':_0x396b2e['body']['attachments'][_0x8c04d7]['name'],'path':path['join'](config[_0x2b63('0x67')],_0x2b63('0x68'),_0x396b2e[_0x2b63('0x4d')][_0x2b63('0x66')][_0x8c04d7][_0x2b63('0x69')])};}}_0x38e01e={'account':_0x55296e,'message':_0x396b2e[_0x2b63('0x4d')]};return;}})[_0x2b63('0x17')](function(){if(_0x54ac9e['List']){if(_0x54ac9e[_0x2b63('0x57')]['Contacts'][_0x2b63('0x3b')]){return _0x54ac9e[_0x2b63('0x57')][_0x2b63('0x59')][0x0];}else{return db[_0x2b63('0x58')]['create'](_[_0x2b63('0xd')](_0x396b2e[_0x2b63('0x4d')],{'firstName':_0x396b2e[_0x2b63('0x4d')]['to'],'email':_0x396b2e['body']['to'],'phone':_0x396b2e['body']['to'],'ListId':_0x54ac9e[_0x2b63('0x6a')]}));}}else{throw new Error(_0x2b63('0x6b'));}})[_0x2b63('0x17')](function(){if(_0x38e01e){return respondWithRpcPromise(_0x2b63('0x6c'),_0x2b63('0x6d'),_0x38e01e,client9003)['then'](function(_0x2525e3){return _0xdc1dec[_0x2b63('0x29')]({'read':!![],'messageId':_0x2525e3[_0x2b63('0x6e')],'sentAt':moment()[_0x2b63('0x6f')](_0x2b63('0x70'))});})[_0x2b63('0x21')](function(_0x2a1507){logger[_0x2b63('0x1e')]('%s',JSON[_0x2b63('0x1d')](_0x2a1507));return _0xdc1dec;});}return _0xdc1dec;});}return _0xdc1dec;}})[_0x2b63('0x17')](respondWithResult(_0x5a53f0,0xc9))[_0x2b63('0x21')](handleError(_0x5a53f0,null));};exports['accept']=function(_0x2af7f3,_0x5a226b){var _0x1749da={'agent':{},'channel':_0x2b63('0x71')};if(_0x2af7f3['body']['id']){delete _0x2af7f3[_0x2b63('0x4d')]['id'];}_0x2af7f3[_0x2b63('0x4d')][_0x2b63('0x72')]=!![];_0x2af7f3['body'][_0x2b63('0x73')]=moment()[_0x2b63('0x6f')](_0x2b63('0x70'));_0x2af7f3[_0x2b63('0x4d')][_0x2b63('0x74')]=_0x2af7f3[_0x2b63('0x4d')][_0x2b63('0x74')]||_0x2af7f3[_0x2b63('0x64')]['id'];_0x1749da['agent']['id']=_0x2af7f3[_0x2b63('0x4d')]['UserId'];return db[_0x2b63('0x2f')][_0x2b63('0x4c')]({'where':{'id':_0x2af7f3[_0x2b63('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a226b,null))[_0x2b63('0x17')](saveUpdates(_0x2af7f3[_0x2b63('0x4d')],null))['then'](function(_0x3dc300){if(_0x3dc300){_0x1749da[_0x2b63('0x1f')]=_0x3dc300[_0x2b63('0x75')]({'plain':!![]});return db[_0x2b63('0x76')][_0x2b63('0x4c')]({'where':{'id':_0x3dc300['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5a226b,null))['then'](function(_0x5f2bae){if(_0x5f2bae){return _0x5f2bae[_0x2b63('0x29')]({'UserId':_0x2af7f3[_0x2b63('0x4d')][_0x2b63('0x74')],'read1stAt':_[_0x2b63('0x77')](_0x5f2bae[_0x2b63('0x78')])?moment()[_0x2b63('0x6f')](_0x2b63('0x70')):undefined});}return null;})['then'](function(_0x4e21b2){if(_0x4e21b2){_0x1749da[_0x2b63('0x79')]=_0x4e21b2[_0x2b63('0x75')]({'plain':!![]});interaction_log[_0x2b63('0x18')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2af7f3[_0x2b63('0x64')]['id'],_0x2af7f3['user'][_0x2b63('0x2c')],_0x2af7f3[_0x2b63('0x64')][_0x2b63('0x7a')],_0x1749da[_0x2b63('0x79')]['id'],_0x2af7f3[_0x2b63('0x4d')]?JSON[_0x2b63('0x1d')](_0x2af7f3[_0x2b63('0x4d')]):'null');return respondWithRpcPromise(_0x2b63('0x7b'),_0x2b63('0x7c'),_0x1749da);}return null;})['then'](function(_0x14c53f){var _0x25a845=_0x2b63('0x7d')+_0x14c53f[_0x2b63('0x1f')][_0x2b63('0x7e')];return db[_0x2b63('0x7f')][_0x2b63('0x35')](_0x25a845,{'type':db['Sequelize'][_0x2b63('0x80')][_0x2b63('0x81')],'raw':!![]})[_0x2b63('0x17')](function(_0x1c1ffb){return _0x1c1ffb;});})['then'](function(_0x1b38e9){if(_0x1b38e9){_0x1749da[_0x2b63('0x1f')][_0x2b63('0x82')]=_0x1b38e9[0x0];if(!_0x2af7f3[_0x2b63('0x4d')][_0x2b63('0x74')])return;return db[_0x2b63('0x83')][_0x2b63('0x4c')]({'where':{'id':_0x2af7f3[_0x2b63('0x4d')][_0x2b63('0x74')],'role':_0x2b63('0x84')},'attributes':['id',_0x2b63('0x2c'),_0x2b63('0x85'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x2e25b9){if(!_0x2e25b9)return null;_0x1749da[_0x2b63('0x1f')][_0x2b63('0x84')]=_0x2e25b9;return _0x1749da;})['then'](function(_0x1746ca){if(_0x1746ca){if(_0x2af7f3[_0x2b63('0x4d')][_0x2b63('0x86')]){_0x1749da[_0x2b63('0x1f')]['interface']=util[_0x2b63('0x6f')](_0x2b63('0x87'),_0x2af7f3[_0x2b63('0x64')]['name']);_0x1749da[_0x2b63('0x1f')][_0x2b63('0x88')]=_0x1749da[_0x2b63('0x88')];_0x1749da[_0x2b63('0x1f')][_0x2b63('0x89')]=_0x1749da[_0x2b63('0x88')];_0x1749da[_0x2b63('0x1f')][_0x2b63('0x8a')]=_0x2b63('0x8b');_0x1749da[_0x2b63('0x1f')]['body']=htmlToText[_0x2b63('0x8c')](_0x1749da[_0x2b63('0x1f')][_0x2b63('0x4d')]);return respondWithRpcPromise('EventManager',_0x2b63('0x8d'),{'event':_0x2b63('0x8e'),'message':_0x1749da[_0x2b63('0x1f')]},client9002)[_0x2b63('0x17')](function(){return _0x1749da;});}return _0x1749da;}return null;})[_0x2b63('0x17')](respondWithResult(_0x5a226b,null))[_0x2b63('0x21')](handleError(_0x5a226b,null));};exports['reject']=function(_0x1ff4c3,_0x4797ad){var _0x2a8faa={'agent':{},'channel':'mail'};if(_0x1ff4c3[_0x2b63('0x4d')]['id']){delete _0x1ff4c3[_0x2b63('0x4d')]['id'];}_0x1ff4c3[_0x2b63('0x4d')]['UserId']=_0x1ff4c3[_0x2b63('0x4d')][_0x2b63('0x74')]||_0x1ff4c3[_0x2b63('0x64')]['id'];_0x2a8faa[_0x2b63('0x84')]['id']=_0x1ff4c3['body'][_0x2b63('0x74')];return db[_0x2b63('0x2f')]['find']({'where':{'id':_0x1ff4c3[_0x2b63('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4797ad,null))[_0x2b63('0x17')](function(_0xb6d64){if(_0xb6d64){_0x2a8faa[_0x2b63('0x1f')]=_0xb6d64[_0x2b63('0x75')]({'plain':!![]});return db[_0x2b63('0x76')][_0x2b63('0x4c')]({'where':{'id':_0xb6d64[_0x2b63('0x8f')]}});}return null;})['then'](handleEntityNotFound(_0x4797ad,null))['then'](function(_0x3ecbf5){if(_0x3ecbf5){_0x2a8faa[_0x2b63('0x79')]=_0x3ecbf5[_0x2b63('0x75')]({'plain':!![]});interaction_log['info'](_0x2b63('0x90'),_0x1ff4c3['user']['id'],_0x1ff4c3[_0x2b63('0x64')][_0x2b63('0x2c')],_0x1ff4c3['user'][_0x2b63('0x7a')],_0x2a8faa[_0x2b63('0x79')]['id'],_0x1ff4c3['body']?JSON[_0x2b63('0x1d')](_0x1ff4c3[_0x2b63('0x4d')]):_0x2b63('0x91'));return respondWithRpcPromise(_0x2b63('0x92'),'rejectMessage',_0x2a8faa);}return null;})['then'](function(_0x1e6fc1){var _0x52d0dc=_0x2b63('0x7d')+_0x1e6fc1[_0x2b63('0x1f')][_0x2b63('0x7e')];return db[_0x2b63('0x7f')]['query'](_0x52d0dc,{'type':db[_0x2b63('0x93')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2b63('0x17')](function(_0x54b796){return _0x54b796;});})[_0x2b63('0x17')](function(_0x16e5f8){if(_0x16e5f8){_0x2a8faa[_0x2b63('0x1f')][_0x2b63('0x82')]=_0x16e5f8[0x0];if(!_0x1ff4c3[_0x2b63('0x4d')][_0x2b63('0x74')])return;return db[_0x2b63('0x83')]['find']({'where':{'id':_0x1ff4c3[_0x2b63('0x4d')][_0x2b63('0x74')],'role':_0x2b63('0x84')},'attributes':['id',_0x2b63('0x2c'),_0x2b63('0x85'),_0x2b63('0x94'),_0x2b63('0x95')],'raw':!![]});}return null;})['then'](function(_0x2ec5c8){if(!_0x2ec5c8)return null;_0x2a8faa[_0x2b63('0x1f')][_0x2b63('0x84')]=_0x2ec5c8;return _0x2a8faa;})[_0x2b63('0x17')](function(_0x3e6aae){if(_0x3e6aae){_0x3e6aae[_0x2b63('0x1f')][_0x2b63('0x96')]=util[_0x2b63('0x6f')]('SIP/%s',_0x1ff4c3[_0x2b63('0x64')][_0x2b63('0x2c')]);_0x3e6aae['message']['channel']=_0x2a8faa[_0x2b63('0x88')];_0x3e6aae[_0x2b63('0x1f')][_0x2b63('0x89')]=_0x2a8faa[_0x2b63('0x88')];_0x3e6aae[_0x2b63('0x1f')][_0x2b63('0x8a')]=_0x2b63('0x97');_0x3e6aae['message'][_0x2b63('0x4d')]=htmlToText[_0x2b63('0x8c')](_0x2a8faa[_0x2b63('0x1f')][_0x2b63('0x4d')]);respondWithRpcPromise('EventManager',_0x2b63('0x8d'),{'event':_0x2b63('0x98'),'message':_0x3e6aae[_0x2b63('0x1f')]},client9002);return _0x2a8faa;}return null;})[_0x2b63('0x17')](respondWithResult(_0x4797ad,null))['catch'](handleError(_0x4797ad,null));};exports['download']=function(_0x35199f,_0x5ceb6d){var _0x53e0bd=moment()[_0x2b63('0x99')]()[_0x2b63('0x9a')]();var _0x2a7491=path[_0x2b63('0x9b')](config[_0x2b63('0x67')],'server',_0x2b63('0x9c'),_0x2b63('0x9d'));var _0x36b0f9=path['join'](config[_0x2b63('0x67')],_0x2b63('0x9e'),_0x2b63('0x9c'),_0x2b63('0x66'));var _0x4f4b92=util['format']('message-%s.eml',_0x53e0bd);return db[_0x2b63('0x2f')][_0x2b63('0x4c')]({'where':{'id':_0x35199f['params']['id']},'attributes':['id',_0x2b63('0x4d'),_0x2b63('0x9f'),'to','cc',_0x2b63('0xa0'),_0x2b63('0xa1'),'createdAt'],'include':_0x35199f[_0x2b63('0x35')][_0x2b63('0x66')]?[{'model':db[_0x2b63('0xa2')],'as':'Attachments'}]:undefined})[_0x2b63('0x17')](handleEntityNotFound(_0x5ceb6d,null))[_0x2b63('0x17')](function(_0x2c9756){if(_0x2c9756){var _0x2e376d=_0x2c9756;var _0x1c9e24={'from':_0x2e376d['from'],'to':_0x2e376d['to'],'subject':_0x2e376d[_0x2b63('0xa1')],'html':htmlEntities[_0x2b63('0xa3')](_0x2e376d[_0x2b63('0x4d')]),'headers':{'Date':moment(_0x2e376d['createdAt'])[_0x2b63('0x6f')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2c9756['cc']){_0x1c9e24[_0x2b63('0xa4')]['Cc']=_0x2c9756['cc'];}if(_0x2c9756['bcc']){_0x1c9e24[_0x2b63('0xa4')][_0x2b63('0xa5')]=_0x2c9756['bcc'];}return new BPromise(function(_0x4b79c2,_0x1777b6){if(_0x2c9756['Attachments']){for(var _0x14649f=0x0;_0x14649f<_0x2c9756['Attachments']['length'];_0x14649f++){var _0x2d8198=_0x2c9756[_0x2b63('0xa6')][_0x14649f];var _0x426553=path[_0x2b63('0x9b')](_0x36b0f9,_0x2d8198[_0x2b63('0x69')]);if(fs[_0x2b63('0xa7')](_0x426553)){_0x1c9e24['attachments'][_0x2b63('0xa8')]({'name':_0x2d8198['name'],'contentType':_0x2d8198['type'],'data':fs['readFileSync'](_0x426553)});}}}emlformat['build'](_0x1c9e24,function(_0x20bf1c,_0x4891c7){if(_0x20bf1c)return _0x1777b6(_0x20bf1c);fs[_0x2b63('0xa9')](path[_0x2b63('0x9b')](_0x2a7491,_0x4f4b92),_0x4891c7);return _0x4b79c2(_0x4891c7);});});}})[_0x2b63('0x17')](function(_0xddc81a){if(_0xddc81a){return _0x5ceb6d[_0x2b63('0xaa')](path[_0x2b63('0x9b')](_0x2a7491,_0x4f4b92),_0x4f4b92,function(_0x14a9fb){if(!_0x14a9fb)fs[_0x2b63('0xab')](path[_0x2b63('0x9b')](_0x2a7491,_0x4f4b92));});}})['catch'](handleError(_0x5ceb6d,null));}; \ No newline at end of file +var _0x01f2=['interface','unix','toString','files','tmp','server','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','download','bluebird','path','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','offset','undefined','limit','count','Content-Range','json','destroy','end','sendStatus','index','MailMessage','rawAttributes','fieldName','type','map','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','update','params','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','MailServerOut','Smtp','isNil','host','port','secure','authentication','user','pass','service','auth','attachments','join','root','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','agent','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact'];(function(_0x8e74c4,_0x4c3b72){var _0x50e53f=function(_0x2a4eef){while(--_0x2a4eef){_0x8e74c4['push'](_0x8e74c4['shift']());}};_0x50e53f(++_0x4c3b72);}(_0x01f2,0xbb));var _0x201f=function(_0x538a9c,_0x9eafb9){_0x538a9c=_0x538a9c-0x0;var _0x2b067f=_0x01f2[_0x538a9c];return _0x2b067f;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x201f('0x0'));var util=require('util');var path=require(_0x201f('0x1'));var fs=require('fs');var _=require(_0x201f('0x2'));var Redis=require(_0x201f('0x3'));var htmlToText=require('html-to-text');var qs=require(_0x201f('0x4'));var logger=require('../../config/logger')(_0x201f('0x5'));var interaction_log=require(_0x201f('0x6'))(_0x201f('0x7'));var config=require(_0x201f('0x8'));var db=require(_0x201f('0x9'))['db'];config[_0x201f('0xa')]=_[_0x201f('0xb')](config['redis'],{'host':_0x201f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x201f('0xa')]));var htmlEntities=require(_0x201f('0xd'));require(_0x201f('0xe'))[_0x201f('0xf')](socket);var jayson=require(_0x201f('0x10'));var client=jayson[_0x201f('0x11')][_0x201f('0x12')]({'port':0x232c});var client9003=jayson[_0x201f('0x11')][_0x201f('0x12')]({'port':0x232b});var client9002=jayson['client'][_0x201f('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x2f58af,_0x1c0e85,_0x1689e1,_0x4b8b6a){return new BPromise(function(_0x1f817d,_0x22a6a0){var _0xb03f18=_0x4b8b6a||client;return _0xb03f18['request'](_0x2f58af,_0x1689e1)[_0x201f('0x13')](function(_0x591549){logger[_0x201f('0x14')](_0x201f('0x15'),_0x1c0e85,'request\x20sent');logger[_0x201f('0x16')](_0x201f('0x17'),_0x1c0e85,'request\x20sent',JSON[_0x201f('0x18')](_0x591549));if(_0x591549[_0x201f('0x19')]){if(_0x591549['error'][_0x201f('0x1a')]===0x1f4){logger[_0x201f('0x19')](_0x201f('0x15'),_0x1c0e85,_0x591549[_0x201f('0x19')][_0x201f('0x1b')]);return _0x22a6a0(_0x591549['error'][_0x201f('0x1b')]);}logger[_0x201f('0x19')]('MailMessage,\x20%s,\x20%s',_0x1c0e85,_0x591549[_0x201f('0x19')]['message']);return _0x1f817d(_0x591549[_0x201f('0x19')]['message']);}else{logger[_0x201f('0x14')](_0x201f('0x15'),_0x1c0e85,_0x201f('0x1c'));_0x1f817d(_0x591549[_0x201f('0x1d')][_0x201f('0x1b')]);}})[_0x201f('0x1e')](function(_0x4c4fce){logger[_0x201f('0x19')](_0x201f('0x15'),_0x1c0e85,_0x4c4fce);_0x22a6a0(_0x4c4fce);});});}function respondWithResult(_0x2c399e,_0x5f13fa){_0x5f13fa=_0x5f13fa||0xc8;return function(_0x2ebc65){if(_0x2ebc65){return _0x2c399e[_0x201f('0x1f')](_0x5f13fa)['json'](_0x2ebc65);}};}function respondWithFilteredResult(_0x24addf,_0x1e8601){return function(_0x5dffcd){if(_0x5dffcd){var _0x39494d=typeof _0x1e8601[_0x201f('0x20')]===_0x201f('0x21')&&typeof _0x1e8601[_0x201f('0x22')]===_0x201f('0x21');var _0x465de5=_0x5dffcd['count'];var _0x15ccb5=_0x39494d?0x0:_0x1e8601['offset'];var _0x2e4658=_0x39494d?_0x5dffcd[_0x201f('0x23')]:_0x1e8601['offset']+_0x1e8601[_0x201f('0x22')];var _0x5d231d;if(_0x2e4658>=_0x465de5){_0x2e4658=_0x465de5;_0x5d231d=0xc8;}else{_0x5d231d=0xce;}_0x24addf['status'](_0x5d231d);return _0x24addf['set'](_0x201f('0x24'),_0x15ccb5+'-'+_0x2e4658+'/'+_0x465de5)[_0x201f('0x25')](_0x5dffcd);}return null;};}function saveUpdates(_0x2102d9){return function(_0x37e16f){if(_0x37e16f){return _0x37e16f['update'](_0x2102d9)[_0x201f('0x13')](function(_0xa5fff5){return _0xa5fff5;});}return null;};}function removeEntity(_0x3ac823){return function(_0x57a00c){if(_0x57a00c){return _0x57a00c[_0x201f('0x26')]()[_0x201f('0x13')](function(){_0x3ac823[_0x201f('0x1f')](0xcc)[_0x201f('0x27')]();});}};}function handleEntityNotFound(_0x58f39a){return function(_0x1315c8){if(!_0x1315c8){_0x58f39a[_0x201f('0x28')](0x194);}return _0x1315c8;};}function handleError(_0x14c2e9,_0x3bda00){_0x3bda00=_0x3bda00||0x1f4;return function(_0x42abdb){logger[_0x201f('0x19')](_0x42abdb['stack']);if(_0x42abdb['name']){delete _0x42abdb['name'];}_0x14c2e9[_0x201f('0x1f')](_0x3bda00)['send'](_0x42abdb);};}exports[_0x201f('0x29')]=function(_0x4f411a,_0x4d3375){var _0x2db56c={},_0x2363c0={},_0x464436={'count':0x0,'rows':[]};var _0x10270e=_['map'](db[_0x201f('0x2a')][_0x201f('0x2b')],function(_0x49550f){return{'name':_0x49550f[_0x201f('0x2c')],'type':_0x49550f[_0x201f('0x2d')]['key']};});_0x2363c0['model']=_[_0x201f('0x2e')](_0x10270e,_0x201f('0x2f'));_0x2363c0[_0x201f('0x30')]=_[_0x201f('0x31')](_0x4f411a[_0x201f('0x30')]);_0x2363c0[_0x201f('0x32')]=_[_0x201f('0x33')](_0x2363c0[_0x201f('0x34')],_0x2363c0['query']);_0x2db56c['attributes']=_[_0x201f('0x33')](_0x2363c0[_0x201f('0x34')],qs[_0x201f('0x35')](_0x4f411a[_0x201f('0x30')]['fields']));_0x2db56c[_0x201f('0x36')]=_0x2db56c[_0x201f('0x36')][_0x201f('0x37')]?_0x2db56c[_0x201f('0x36')]:_0x2363c0[_0x201f('0x34')];if(!_0x4f411a[_0x201f('0x30')][_0x201f('0x38')](_0x201f('0x39'))){_0x2db56c[_0x201f('0x22')]=qs[_0x201f('0x22')](_0x4f411a[_0x201f('0x30')][_0x201f('0x22')]);_0x2db56c['offset']=qs[_0x201f('0x20')](_0x4f411a['query'][_0x201f('0x20')]);}_0x2db56c['order']=qs[_0x201f('0x3a')](_0x4f411a[_0x201f('0x30')][_0x201f('0x3a')]);_0x2db56c[_0x201f('0x3b')]=qs[_0x201f('0x32')](_[_0x201f('0x3c')](_0x4f411a[_0x201f('0x30')],_0x2363c0[_0x201f('0x32')]),_0x10270e);if(_0x4f411a[_0x201f('0x30')][_0x201f('0x3d')]){_0x2db56c[_0x201f('0x3b')]=_[_0x201f('0x3e')](_0x2db56c[_0x201f('0x3b')],{'$or':_[_0x201f('0x2e')](_0x10270e,function(_0x50ac8b){if(_0x50ac8b[_0x201f('0x2d')]!==_0x201f('0x3f')){var _0x47196c={};_0x47196c[_0x50ac8b[_0x201f('0x2f')]]={'$like':'%'+_0x4f411a[_0x201f('0x30')][_0x201f('0x3d')]+'%'};return _0x47196c;}})});}_0x2db56c=_[_0x201f('0x3e')]({},_0x2db56c,_0x4f411a[_0x201f('0x40')]);var _0x85e3e3={'where':_0x2db56c[_0x201f('0x3b')]};return db['MailMessage'][_0x201f('0x23')](_0x85e3e3)[_0x201f('0x13')](function(_0x19531b){_0x464436[_0x201f('0x23')]=_0x19531b;if(_0x4f411a['query']['includeAll']){_0x2db56c[_0x201f('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0x201f('0x42')](_0x2db56c);})[_0x201f('0x13')](function(_0x1c5f13){_0x464436[_0x201f('0x43')]=_0x1c5f13;return _0x464436;})[_0x201f('0x13')](respondWithFilteredResult(_0x4d3375,_0x2db56c))[_0x201f('0x1e')](handleError(_0x4d3375,null));};exports[_0x201f('0x44')]=function(_0x42109e,_0x3d69cb){var _0x3542cd={'raw':!![],'where':{'id':_0x42109e['params']['id']}},_0x516334={};_0x516334[_0x201f('0x34')]=_[_0x201f('0x31')](db['MailMessage'][_0x201f('0x2b')]);_0x516334['query']=_[_0x201f('0x31')](_0x42109e[_0x201f('0x30')]);_0x516334[_0x201f('0x32')]=_[_0x201f('0x33')](_0x516334[_0x201f('0x34')],_0x516334[_0x201f('0x30')]);_0x3542cd[_0x201f('0x36')]=_['intersection'](_0x516334['model'],qs['fields'](_0x42109e[_0x201f('0x30')][_0x201f('0x35')]));_0x3542cd[_0x201f('0x36')]=_0x3542cd['attributes']['length']?_0x3542cd['attributes']:_0x516334[_0x201f('0x34')];if(_0x42109e[_0x201f('0x30')][_0x201f('0x45')]){_0x3542cd[_0x201f('0x41')]=[{'all':!![]}];}_0x3542cd=_[_0x201f('0x3e')]({},_0x3542cd,_0x42109e[_0x201f('0x40')]);return db['MailMessage'][_0x201f('0x46')](_0x3542cd)[_0x201f('0x13')](handleEntityNotFound(_0x3d69cb,null))[_0x201f('0x13')](respondWithResult(_0x3d69cb,null))[_0x201f('0x1e')](handleError(_0x3d69cb,null));};exports[_0x201f('0x47')]=function(_0x495c28,_0x4c9a03){if(_0x495c28['body']['id']){delete _0x495c28['body']['id'];}return db[_0x201f('0x2a')][_0x201f('0x46')]({'where':{'id':_0x495c28[_0x201f('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c9a03,null))[_0x201f('0x13')](saveUpdates(_0x495c28[_0x201f('0x49')],null))[_0x201f('0x13')](respondWithResult(_0x4c9a03,null))[_0x201f('0x1e')](handleError(_0x4c9a03,null));};exports['destroy']=function(_0x17d422,_0x4330d0){return db[_0x201f('0x2a')]['find']({'where':{'id':_0x17d422['params']['id']}})['then'](handleEntityNotFound(_0x4330d0,null))[_0x201f('0x13')](removeEntity(_0x4330d0,null))[_0x201f('0x1e')](handleError(_0x4330d0,null));};exports[_0x201f('0x4a')]=function(_0x539aa8,_0x43be75){return db[_0x201f('0x2a')][_0x201f('0x4a')]()['then'](respondWithResult(_0x43be75,null))[_0x201f('0x1e')](handleError(_0x43be75,null));};exports[_0x201f('0x4b')]=function(_0x442173,_0x52eb75){return db['MailMessage'][_0x201f('0x4b')](_0x442173[_0x201f('0x49')])[_0x201f('0x13')](function(_0x3dec5e){if(_0x3dec5e){if(_0x3dec5e[_0x201f('0x4c')]===_0x201f('0x4d')&&!_0x3dec5e[_0x201f('0x4e')]){var _0x1bc0eb,_0x5e1cb4,_0x5a0323;if(_0x442173[_0x201f('0x49')]['to']){_0x5e1cb4=_0x442173['body']['to'][_0x201f('0x4f')](',')[0x0];}return db['MailAccount'][_0x201f('0x50')]({'where':{'id':_0x3dec5e[_0x201f('0x51')]},'include':[{'model':db[_0x201f('0x52')],'as':_0x201f('0x53'),'include':[{'model':db[_0x201f('0x54')],'as':'Contacts','where':{'email':_0x5e1cb4},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x201f('0x55')],'as':_0x201f('0x56'),'raw':!![]}]})[_0x201f('0x13')](function(_0x3dbd7e){_0x1bc0eb=_0x3dbd7e;if(_0x1bc0eb&&_0x1bc0eb[_0x201f('0x56')]){var _0x228687={'tls':{'rejectUnauthorized':![]}};if(_[_0x201f('0x57')](_0x1bc0eb[_0x201f('0x56')]['service'])){_0x228687['host']=_0x1bc0eb[_0x201f('0x56')][_0x201f('0x58')];_0x228687[_0x201f('0x59')]=_0x1bc0eb[_0x201f('0x56')][_0x201f('0x59')];_0x228687[_0x201f('0x5a')]=_0x1bc0eb[_0x201f('0x56')][_0x201f('0x5a')];if(_0x1bc0eb[_0x201f('0x56')][_0x201f('0x5b')]){_0x228687['auth']={'user':_0x1bc0eb['Smtp'][_0x201f('0x5c')],'pass':_0x1bc0eb[_0x201f('0x56')][_0x201f('0x5d')]};}}else{_0x228687[_0x201f('0x5e')]=_0x1bc0eb[_0x201f('0x56')][_0x201f('0x5e')];_0x228687[_0x201f('0x5f')]={'user':_0x1bc0eb[_0x201f('0x56')][_0x201f('0x5c')],'pass':_0x1bc0eb[_0x201f('0x56')][_0x201f('0x5d')]};_0x228687[_0x201f('0x5a')]=_0x1bc0eb[_0x201f('0x56')][_0x201f('0x5a')];}if(_0x442173['body'][_0x201f('0x60')]&&_0x442173['body'][_0x201f('0x60')][_0x201f('0x37')]){for(var _0x23c929=0x0;_0x23c929<_0x442173[_0x201f('0x49')][_0x201f('0x60')][_0x201f('0x37')];_0x23c929+=0x1){_0x442173[_0x201f('0x49')][_0x201f('0x60')][_0x23c929]={'filename':_0x442173[_0x201f('0x49')]['attachments'][_0x23c929]['name'],'path':path[_0x201f('0x61')](config[_0x201f('0x62')],'server/files/attachments',_0x442173[_0x201f('0x49')][_0x201f('0x60')][_0x23c929]['basename'])};}}_0x5a0323={'account':_0x228687,'message':_0x442173['body']};return;}})[_0x201f('0x13')](function(){if(_0x1bc0eb['List']){if(_0x1bc0eb[_0x201f('0x53')][_0x201f('0x63')][_0x201f('0x37')]){return _0x1bc0eb[_0x201f('0x53')][_0x201f('0x63')][0x0];}else{return db[_0x201f('0x54')]['create'](_['defaults'](_0x442173[_0x201f('0x49')],{'firstName':_0x442173[_0x201f('0x49')]['to'],'email':_0x442173[_0x201f('0x49')]['to'],'phone':_0x442173[_0x201f('0x49')]['to'],'ListId':_0x1bc0eb[_0x201f('0x64')]}));}}else{throw new Error(_0x201f('0x65'));}})['then'](function(){if(_0x5a0323){return respondWithRpcPromise(_0x201f('0x66'),_0x201f('0x67'),_0x5a0323,client9003)['then'](function(_0x1cb472){return _0x3dec5e[_0x201f('0x47')]({'read':!![],'messageId':_0x1cb472[_0x201f('0x68')],'sentAt':moment()[_0x201f('0x69')](_0x201f('0x6a'))});})['catch'](function(_0x3d80a5){logger[_0x201f('0x19')]('%s',JSON['stringify'](_0x3d80a5));return _0x3dec5e;});}return _0x3dec5e;});}return _0x3dec5e;}})[_0x201f('0x13')](respondWithResult(_0x52eb75,0xc9))[_0x201f('0x1e')](handleError(_0x52eb75,null));};exports[_0x201f('0x6b')]=function(_0x29d908,_0x20cb8c){var _0xbd91d2={'agent':{},'channel':_0x201f('0x6c')};if(_0x29d908[_0x201f('0x49')]['id']){delete _0x29d908['body']['id'];}_0x29d908[_0x201f('0x49')][_0x201f('0x6d')]=!![];_0x29d908[_0x201f('0x49')]['readAt']=moment()[_0x201f('0x69')](_0x201f('0x6a'));_0x29d908[_0x201f('0x49')][_0x201f('0x6e')]=_0x29d908[_0x201f('0x49')]['UserId']||_0x29d908[_0x201f('0x5c')]['id'];_0xbd91d2[_0x201f('0x6f')]['id']=_0x29d908['body'][_0x201f('0x6e')];return db['MailMessage'][_0x201f('0x46')]({'where':{'id':_0x29d908[_0x201f('0x48')]['id'],'UserId':null}})[_0x201f('0x13')](handleEntityNotFound(_0x20cb8c,null))[_0x201f('0x13')](saveUpdates(_0x29d908['body'],null))[_0x201f('0x13')](function(_0x16de12){if(_0x16de12){_0xbd91d2['message']=_0x16de12['get']({'plain':!![]});return db[_0x201f('0x70')][_0x201f('0x46')]({'where':{'id':_0x16de12[_0x201f('0x71')]}});}return null;})[_0x201f('0x13')](handleEntityNotFound(_0x20cb8c,null))['then'](function(_0x5d499c){if(_0x5d499c){return _0x5d499c[_0x201f('0x47')]({'UserId':_0x29d908[_0x201f('0x49')][_0x201f('0x6e')],'read1stAt':_['isNil'](_0x5d499c[_0x201f('0x72')])?moment()[_0x201f('0x69')](_0x201f('0x6a')):undefined});}return null;})[_0x201f('0x13')](function(_0x112823){if(_0x112823){_0xbd91d2[_0x201f('0x73')]=_0x112823['get']({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x29d908[_0x201f('0x5c')]['id'],_0x29d908[_0x201f('0x5c')][_0x201f('0x2f')],_0x29d908[_0x201f('0x5c')][_0x201f('0x74')],_0xbd91d2[_0x201f('0x73')]['id'],_0x29d908[_0x201f('0x49')]?JSON['stringify'](_0x29d908['body']):_0x201f('0x75'));return respondWithRpcPromise(_0x201f('0x76'),_0x201f('0x77'),_0xbd91d2);}return null;})['then'](function(_0xf68dd8){var _0x519131=_0x201f('0x78')+_0xf68dd8['message'][_0x201f('0x79')];return db[_0x201f('0x7a')][_0x201f('0x30')](_0x519131,{'type':db['Sequelize'][_0x201f('0x7b')][_0x201f('0x7c')],'raw':!![]})[_0x201f('0x13')](function(_0x11ee7c){return _0x11ee7c;});})[_0x201f('0x13')](function(_0x5c5c71){if(_0x5c5c71){_0xbd91d2['message']['contact']=_0x5c5c71[0x0];if(!_0x29d908[_0x201f('0x49')]['UserId'])return;return db[_0x201f('0x7d')][_0x201f('0x46')]({'where':{'id':_0x29d908[_0x201f('0x49')][_0x201f('0x6e')],'role':_0x201f('0x6f')},'attributes':['id',_0x201f('0x2f'),_0x201f('0x7e'),_0x201f('0x7f'),_0x201f('0x80')],'raw':!![]});}return null;})[_0x201f('0x13')](function(_0x46f2d1){if(!_0x46f2d1)return null;_0xbd91d2[_0x201f('0x1b')][_0x201f('0x6f')]=_0x46f2d1;return _0xbd91d2;})['then'](function(_0x5dfd4a){if(_0x5dfd4a){if(_0x29d908['body'][_0x201f('0x81')]){_0xbd91d2[_0x201f('0x1b')]['interface']=util[_0x201f('0x69')](_0x201f('0x82'),_0x29d908['user'][_0x201f('0x2f')]);_0xbd91d2[_0x201f('0x1b')][_0x201f('0x83')]=_0xbd91d2[_0x201f('0x83')];_0xbd91d2[_0x201f('0x1b')][_0x201f('0x84')]=_0xbd91d2['channel'];_0xbd91d2[_0x201f('0x1b')][_0x201f('0x85')]=_0x201f('0x6b');_0xbd91d2[_0x201f('0x1b')][_0x201f('0x49')]=htmlToText[_0x201f('0x86')](_0xbd91d2[_0x201f('0x1b')][_0x201f('0x49')]);return respondWithRpcPromise('EventManager',_0x201f('0x87'),{'event':_0x201f('0x88'),'message':_0xbd91d2['message']},client9002)[_0x201f('0x13')](function(){return _0xbd91d2;});}return _0xbd91d2;}return null;})[_0x201f('0x13')](respondWithResult(_0x20cb8c,null))[_0x201f('0x1e')](handleError(_0x20cb8c,null));};exports['reject']=function(_0x22e524,_0x1eb4e1){var _0x19a73f={'agent':{},'channel':_0x201f('0x6c')};if(_0x22e524[_0x201f('0x49')]['id']){delete _0x22e524['body']['id'];}_0x22e524[_0x201f('0x49')][_0x201f('0x6e')]=_0x22e524[_0x201f('0x49')]['UserId']||_0x22e524[_0x201f('0x5c')]['id'];_0x19a73f[_0x201f('0x6f')]['id']=_0x22e524['body'][_0x201f('0x6e')];return db[_0x201f('0x2a')][_0x201f('0x46')]({'where':{'id':_0x22e524['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1eb4e1,null))[_0x201f('0x13')](function(_0x89a940){if(_0x89a940){_0x19a73f[_0x201f('0x1b')]=_0x89a940[_0x201f('0x89')]({'plain':!![]});return db[_0x201f('0x70')][_0x201f('0x46')]({'where':{'id':_0x89a940[_0x201f('0x71')]}});}return null;})[_0x201f('0x13')](handleEntityNotFound(_0x1eb4e1,null))['then'](function(_0x512308){if(_0x512308){_0x19a73f[_0x201f('0x73')]=_0x512308[_0x201f('0x89')]({'plain':!![]});interaction_log['info'](_0x201f('0x8a'),_0x22e524['user']['id'],_0x22e524['user'][_0x201f('0x2f')],_0x22e524[_0x201f('0x5c')][_0x201f('0x74')],_0x19a73f['interaction']['id'],_0x22e524[_0x201f('0x49')]?JSON[_0x201f('0x18')](_0x22e524[_0x201f('0x49')]):'null');return respondWithRpcPromise(_0x201f('0x8b'),_0x201f('0x8c'),_0x19a73f);}return null;})[_0x201f('0x13')](function(_0x5cbdc1){var _0x4369a0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5cbdc1[_0x201f('0x1b')][_0x201f('0x79')];return db['sequelize']['query'](_0x4369a0,{'type':db[_0x201f('0x8d')][_0x201f('0x7b')][_0x201f('0x7c')],'raw':!![]})[_0x201f('0x13')](function(_0xf2b7e2){return _0xf2b7e2;});})[_0x201f('0x13')](function(_0x430541){if(_0x430541){_0x19a73f[_0x201f('0x1b')][_0x201f('0x8e')]=_0x430541[0x0];if(!_0x22e524[_0x201f('0x49')][_0x201f('0x6e')])return;return db[_0x201f('0x7d')][_0x201f('0x46')]({'where':{'id':_0x22e524['body'][_0x201f('0x6e')],'role':_0x201f('0x6f')},'attributes':['id',_0x201f('0x2f'),'fullname',_0x201f('0x7f'),_0x201f('0x80')],'raw':!![]});}return null;})['then'](function(_0x40e8c9){if(!_0x40e8c9)return null;_0x19a73f['message']['agent']=_0x40e8c9;return _0x19a73f;})[_0x201f('0x13')](function(_0x3610e0){if(_0x3610e0){_0x3610e0[_0x201f('0x1b')][_0x201f('0x8f')]=util[_0x201f('0x69')](_0x201f('0x82'),_0x22e524[_0x201f('0x5c')]['name']);_0x3610e0[_0x201f('0x1b')]['channel']=_0x19a73f[_0x201f('0x83')];_0x3610e0['message'][_0x201f('0x84')]=_0x19a73f[_0x201f('0x83')];_0x3610e0[_0x201f('0x1b')][_0x201f('0x85')]='reject';_0x3610e0[_0x201f('0x1b')]['body']=htmlToText[_0x201f('0x86')](_0x19a73f[_0x201f('0x1b')][_0x201f('0x49')]);respondWithRpcPromise(_0x201f('0x87'),'EventManager',{'event':'rejectmessage','message':_0x3610e0[_0x201f('0x1b')]},client9002);return _0x19a73f;}return null;})[_0x201f('0x13')](respondWithResult(_0x1eb4e1,null))[_0x201f('0x1e')](handleError(_0x1eb4e1,null));};exports['download']=function(_0x371162,_0x22e01d){var _0x296d52=moment()[_0x201f('0x90')]()[_0x201f('0x91')]();var _0x5e1a82=path[_0x201f('0x61')](config[_0x201f('0x62')],'server',_0x201f('0x92'),_0x201f('0x93'));var _0x571a3e=path[_0x201f('0x61')](config[_0x201f('0x62')],_0x201f('0x94'),'files',_0x201f('0x60'));var _0x6459e9=util[_0x201f('0x69')]('message-%s.eml',_0x296d52);return db[_0x201f('0x2a')][_0x201f('0x46')]({'where':{'id':_0x371162[_0x201f('0x48')]['id']},'attributes':['id',_0x201f('0x49'),_0x201f('0x95'),'to','cc',_0x201f('0x96'),_0x201f('0x97'),_0x201f('0x98')],'include':_0x371162[_0x201f('0x30')]['attachments']?[{'model':db[_0x201f('0x99')],'as':_0x201f('0x9a')}]:undefined})['then'](handleEntityNotFound(_0x22e01d,null))[_0x201f('0x13')](function(_0x16e64e){if(_0x16e64e){var _0x5e4b23=_0x16e64e;var _0xe3beb8={'from':_0x5e4b23[_0x201f('0x95')],'to':_0x5e4b23['to'],'subject':_0x5e4b23['subject'],'html':htmlEntities[_0x201f('0x9b')](_0x5e4b23[_0x201f('0x49')]),'headers':{'Date':moment(_0x5e4b23[_0x201f('0x98')])[_0x201f('0x69')](_0x201f('0x9c'))},'attachments':[]};if(_0x16e64e['cc']){_0xe3beb8[_0x201f('0x9d')]['Cc']=_0x16e64e['cc'];}if(_0x16e64e[_0x201f('0x96')]){_0xe3beb8[_0x201f('0x9d')][_0x201f('0x9e')]=_0x16e64e[_0x201f('0x96')];}return new BPromise(function(_0x9a026d,_0x5058c7){if(_0x16e64e[_0x201f('0x9a')]){for(var _0x249d77=0x0;_0x249d77<_0x16e64e['Attachments'][_0x201f('0x37')];_0x249d77++){var _0x349da7=_0x16e64e[_0x201f('0x9a')][_0x249d77];var _0x8847b5=path['join'](_0x571a3e,_0x349da7[_0x201f('0x9f')]);if(fs[_0x201f('0xa0')](_0x8847b5)){_0xe3beb8['attachments'][_0x201f('0xa1')]({'name':_0x349da7[_0x201f('0x2f')],'contentType':_0x349da7[_0x201f('0x2d')],'data':fs[_0x201f('0xa2')](_0x8847b5)});}}}emlformat[_0x201f('0xa3')](_0xe3beb8,function(_0x307544,_0x1fd04c){if(_0x307544)return _0x5058c7(_0x307544);fs['writeFileSync'](path[_0x201f('0x61')](_0x5e1a82,_0x6459e9),_0x1fd04c);return _0x9a026d(_0x1fd04c);});});}})[_0x201f('0x13')](function(_0x26f331){if(_0x26f331){return _0x22e01d[_0x201f('0xa4')](path[_0x201f('0x61')](_0x5e1a82,_0x6459e9),_0x6459e9,function(_0x2f7916){if(!_0x2f7916)fs['unlinkSync'](path['join'](_0x5e1a82,_0x6459e9));});}})[_0x201f('0x1e')](handleError(_0x22e01d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e4d3523..81666d8 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 _0xe250=['setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x2e0273,_0x4521ea){var _0x2d0afa=function(_0x3b0b9c){while(--_0x3b0b9c){_0x2e0273['push'](_0x2e0273['shift']());}};_0x2d0afa(++_0x4521ea);}(_0xe250,0x185));var _0x0e25=function(_0x4b0b0b,_0x4d06a0){_0x4b0b0b=_0x4b0b0b-0x0;var _0x17b6fb=_0xe250[_0x4b0b0b];return _0x17b6fb;};'use strict';var EventEmitter=require(_0x0e25('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0e25('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x316da8){return function(_0x3a2123,_0x2c8329,_0x5b4ee9){MailMessageEvents[_0x0e25('0x2')](_0x316da8+':'+_0x3a2123['id'],_0x3a2123);MailMessageEvents[_0x0e25('0x2')](_0x316da8,_0x3a2123);_0x5b4ee9(null);};}for(var e in events){if(events[_0x0e25('0x3')](e)){var event=events[e];MailMessage[_0x0e25('0x4')](e,emitEvent(event));}}module[_0x0e25('0x5')]=MailMessageEvents; \ No newline at end of file +var _0x306a=['setMaxListeners','remove','emit','hook','exports','events','MailMessage'];(function(_0x79483f,_0x417d01){var _0x2982d2=function(_0x12fbd0){while(--_0x12fbd0){_0x79483f['push'](_0x79483f['shift']());}};_0x2982d2(++_0x417d01);}(_0x306a,0x1b0));var _0xa306=function(_0x165189,_0x19a741){_0x165189=_0x165189-0x0;var _0x44826b=_0x306a[_0x165189];return _0x44826b;};'use strict';var EventEmitter=require(_0xa306('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xa306('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa306('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa306('0x3')};function emitEvent(_0x4f3bbf){return function(_0x588cbc,_0x2ea3a4,_0x1d7d3a){MailMessageEvents[_0xa306('0x4')](_0x4f3bbf+':'+_0x588cbc['id'],_0x588cbc);MailMessageEvents['emit'](_0x4f3bbf,_0x588cbc);_0x1d7d3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xa306('0x5')](e,emitEvent(event));}}module[_0xa306('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9c7367a..b3378a4 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 _0xc8e4=['body','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','plainBody','subject','FULLTEXT','fromString'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc8e4,0xd7));var _0x4c8e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc8e4[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x4c8e('0x0'));var util=require(_0x4c8e('0x1'));var logger=require('../../config/logger')(_0x4c8e('0x2'));var moment=require(_0x4c8e('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c8e('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x4c8e('0x5'));var config=require(_0x4c8e('0x6'));var attributes=require(_0x4c8e('0x7'));module[_0x4c8e('0x8')]=function(_0x18d7d1,_0x5d572f){return _0x18d7d1[_0x4c8e('0x9')](_0x4c8e('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x4c8e('0xb'),'fields':[_0x4c8e('0xb')]},{'name':'fti_mail_messages','fields':[_0x4c8e('0xc'),_0x4c8e('0xd')],'type':_0x4c8e('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5c678b,_0x276f22,_0x55f32b){if(_0x5c678b['body']){_0x5c678b[_0x4c8e('0xc')]=htmlToText[_0x4c8e('0xf')](_0x5c678b[_0x4c8e('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x55f32b(null,_0x276f22);},'afterCreate':function(_0x52ec5b,_0x432c5f,_0x8296d8){var _0x548721=_0x18d7d1[_0x4c8e('0x11')];var _0x49dbfd=_0x52ec5b['get']({'plain':!![]});if(_0x49dbfd[_0x4c8e('0x12')]['toLowerCase']()==='in'||_0x49dbfd[_0x4c8e('0x12')][_0x4c8e('0x13')]()==='out'&&!_0x49dbfd[_0x4c8e('0x14')]&&!_[_0x4c8e('0x15')](_0x49dbfd[_0x4c8e('0x16')])){_0x548721[_0x4c8e('0x17')][_0x4c8e('0x18')]({'where':{'id':_0x49dbfd[_0x4c8e('0x19')]}})[_0x4c8e('0x1a')](function(_0xaceeb4){if(_0xaceeb4){_0xaceeb4[_0x4c8e('0x1b')]({'lastMsgAt':_0x49dbfd[_0x4c8e('0x1c')],'lastMsgDirection':_0x49dbfd['direction']['toLowerCase']()});}})[_0x4c8e('0x1d')](function(_0x34b1f5){console[_0x4c8e('0x1e')](_0x34b1f5);});}_0x8296d8();}},'charset':_0x4c8e('0x1f'),'collate':_0x4c8e('0x20')});}; \ No newline at end of file +var _0x5b5f=['path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','messageId','fti_mail_messages','FULLTEXT','body','plainBody','models','get','direction','toLowerCase','out','secret','isNil','MailInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','html-to-text'];(function(_0x2c87be,_0x4c470){var _0x3ec927=function(_0x19f272){while(--_0x19f272){_0x2c87be['push'](_0x2c87be['shift']());}};_0x3ec927(++_0x4c470);}(_0x5b5f,0xcc));var _0xf5b5=function(_0x2b3087,_0x5bad3a){_0x2b3087=_0x2b3087-0x0;var _0x39bb6a=_0x5b5f[_0x2b3087];return _0x39bb6a;};'use strict';var _=require('lodash');var util=require(_0xf5b5('0x0'));var logger=require(_0xf5b5('0x1'))('api');var moment=require(_0xf5b5('0x2'));var BPromise=require(_0xf5b5('0x3'));var rp=require(_0xf5b5('0x4'));var htmlToText=require(_0xf5b5('0x5'));var fs=require('fs');var path=require(_0xf5b5('0x6'));var rimraf=require(_0xf5b5('0x7'));var config=require(_0xf5b5('0x8'));var attributes=require(_0xf5b5('0x9'));module[_0xf5b5('0xa')]=function(_0x564060,_0x228a44){return _0x564060[_0xf5b5('0xb')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xf5b5('0xc'),'fields':['messageId']},{'name':_0xf5b5('0xd'),'fields':['plainBody','subject'],'type':_0xf5b5('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x12883d,_0x34d21b,_0x3bc045){if(_0x12883d[_0xf5b5('0xf')]){_0x12883d[_0xf5b5('0x10')]=htmlToText['fromString'](_0x12883d[_0xf5b5('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3bc045(null,_0x34d21b);},'afterCreate':function(_0xdfc5cb,_0x45d1ed,_0x16a540){var _0x5b4b4a=_0x564060[_0xf5b5('0x11')];var _0x16f2c0=_0xdfc5cb[_0xf5b5('0x12')]({'plain':!![]});if(_0x16f2c0[_0xf5b5('0x13')][_0xf5b5('0x14')]()==='in'||_0x16f2c0['direction'][_0xf5b5('0x14')]()===_0xf5b5('0x15')&&!_0x16f2c0[_0xf5b5('0x16')]&&!_[_0xf5b5('0x17')](_0x16f2c0['UserId'])){_0x5b4b4a['MailInteraction']['findOne']({'where':{'id':_0x16f2c0[_0xf5b5('0x18')]}})['then'](function(_0x480977){if(_0x480977){_0x480977[_0xf5b5('0x19')]({'lastMsgAt':_0x16f2c0[_0xf5b5('0x1a')],'lastMsgDirection':_0x16f2c0['direction'][_0xf5b5('0x14')]()});}})[_0xf5b5('0x1b')](function(_0x5b72d3){console[_0xf5b5('0x1c')](_0x5b72d3);});}_0x16a540();}},'charset':'utf8mb4','collate':_0xf5b5('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 654dfab..421b934 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 _0x3266=['result','catch','CreateMailMessage','MailMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5bac50,_0x540d00){var _0x28afd5=function(_0x25b25d){while(--_0x25b25d){_0x5bac50['push'](_0x5bac50['shift']());}};_0x28afd5(++_0x540d00);}(_0x3266,0x6a));var _0x6326=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x3266[_0x3ba924];return _0x4cc1df;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require(_0x6326('0x6'))['db'];var utils=require(_0x6326('0x7'));var logger=require(_0x6326('0x8'))('rpc');var config=require(_0x6326('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6326('0xa')][_0x6326('0xb')]({'port':0x232a});config[_0x6326('0xc')]=_['defaults'](config[_0x6326('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6326('0xd'))(new Redis(config[_0x6326('0xc')]));require(_0x6326('0xe'))[_0x6326('0xf')](socket);function respondWithRpcPromise(_0x37a23d,_0x53c3e1,_0x1b45a7){return new BPromise(function(_0x464a36,_0x3590ab){return client[_0x6326('0x10')](_0x37a23d,_0x1b45a7)[_0x6326('0x11')](function(_0x3b056c){logger[_0x6326('0x12')](_0x6326('0x13'),_0x53c3e1,_0x6326('0x14'));logger[_0x6326('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x53c3e1,'request\x20sent',JSON[_0x6326('0x16')](_0x3b056c));if(_0x3b056c[_0x6326('0x17')]){if(_0x3b056c['error'][_0x6326('0x18')]===0x1f4){logger['error'](_0x6326('0x13'),_0x53c3e1,_0x3b056c[_0x6326('0x17')][_0x6326('0x19')]);return _0x3590ab(_0x3b056c[_0x6326('0x17')][_0x6326('0x19')]);}logger[_0x6326('0x17')]('MailMessage,\x20%s,\x20%s',_0x53c3e1,_0x3b056c[_0x6326('0x17')]['message']);return _0x464a36(_0x3b056c['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x53c3e1,'request\x20sent');_0x464a36(_0x3b056c[_0x6326('0x1a')][_0x6326('0x19')]);}})[_0x6326('0x1b')](function(_0x556c4e){logger['error'](_0x6326('0x13'),_0x53c3e1,_0x556c4e);_0x3590ab(_0x556c4e);});});}exports[_0x6326('0x1c')]=function(_0x272b5c){var _0x3db834=this;return new Promise(function(_0x3c08db,_0x25957a){return db[_0x6326('0x1d')]['create'](_0x272b5c[_0x6326('0x1e')],{'raw':_0x272b5c['options']?_0x272b5c[_0x6326('0x1f')][_0x6326('0x20')]===undefined?!![]:![]:!![]})[_0x6326('0x11')](function(_0x24fb78){logger[_0x6326('0x12')](_0x6326('0x1c'),_0x272b5c);logger[_0x6326('0x15')](_0x6326('0x1c'),_0x272b5c,JSON[_0x6326('0x16')](_0x24fb78));_0x3c08db(_0x24fb78);})[_0x6326('0x1b')](function(_0x34954b){logger['error'](_0x6326('0x1c'),_0x34954b[_0x6326('0x19')],_0x272b5c);_0x25957a(_0x3db834['error'](0x1f4,_0x34954b['message']));});});}; \ No newline at end of file +var _0xd7d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','debug','stringify','error','message','result','CreateMailMessage','MailMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1e534e,_0x40ddb2){_0x1e534e=_0x1e534e-0x0;var _0xcbb1df=_0xd7d1[_0x1e534e];return _0xcbb1df;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});config[_0x1d7d('0xd')]=_[_0x1d7d('0xe')](config[_0x1d7d('0xd')],{'host':_0x1d7d('0xf'),'port':0x18eb});var socket=require(_0x1d7d('0x10'))(new Redis(config[_0x1d7d('0xd')]));require(_0x1d7d('0x11'))[_0x1d7d('0x12')](socket);function respondWithRpcPromise(_0x1ad06f,_0x8b258b,_0x2765fe){return new BPromise(function(_0x547f7b,_0xe6b9eb){return client['request'](_0x1ad06f,_0x2765fe)[_0x1d7d('0x13')](function(_0x3a7add){logger[_0x1d7d('0x14')](_0x1d7d('0x15'),_0x8b258b,'request\x20sent');logger[_0x1d7d('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x8b258b,'request\x20sent',JSON[_0x1d7d('0x17')](_0x3a7add));if(_0x3a7add[_0x1d7d('0x18')]){if(_0x3a7add['error']['code']===0x1f4){logger[_0x1d7d('0x18')](_0x1d7d('0x15'),_0x8b258b,_0x3a7add[_0x1d7d('0x18')][_0x1d7d('0x19')]);return _0xe6b9eb(_0x3a7add[_0x1d7d('0x18')]['message']);}logger[_0x1d7d('0x18')](_0x1d7d('0x15'),_0x8b258b,_0x3a7add['error'][_0x1d7d('0x19')]);return _0x547f7b(_0x3a7add[_0x1d7d('0x18')][_0x1d7d('0x19')]);}else{logger[_0x1d7d('0x14')](_0x1d7d('0x15'),_0x8b258b,'request\x20sent');_0x547f7b(_0x3a7add[_0x1d7d('0x1a')][_0x1d7d('0x19')]);}})['catch'](function(_0x495212){logger[_0x1d7d('0x18')](_0x1d7d('0x15'),_0x8b258b,_0x495212);_0xe6b9eb(_0x495212);});});}exports[_0x1d7d('0x1b')]=function(_0x396802){var _0x2ae740=this;return new Promise(function(_0x275d3c,_0x54d401){return db[_0x1d7d('0x1c')][_0x1d7d('0x1d')](_0x396802[_0x1d7d('0x1e')],{'raw':_0x396802['options']?_0x396802[_0x1d7d('0x1f')][_0x1d7d('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x5950bd){logger[_0x1d7d('0x14')](_0x1d7d('0x1b'),_0x396802);logger[_0x1d7d('0x16')]('CreateMailMessage',_0x396802,JSON[_0x1d7d('0x17')](_0x5950bd));_0x275d3c(_0x5950bd);})[_0x1d7d('0x21')](function(_0x2d4c0c){logger[_0x1d7d('0x18')]('CreateMailMessage',_0x2d4c0c[_0x1d7d('0x19')],_0x396802);_0x54d401(_0x2ae740[_0x1d7d('0x18')](0x1f4,_0x2d4c0c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index bade19d..738e0e3 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 _0x67f0=['removeListener','register','length','mailMessage:','save','update'];(function(_0xe38b2e,_0x5a8712){var _0x57d0bc=function(_0x2d0d86){while(--_0x2d0d86){_0xe38b2e['push'](_0xe38b2e['shift']());}};_0x57d0bc(++_0x5a8712);}(_0x67f0,0x106));var _0x067f=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0x67f0[_0x511b76];return _0x5424ff;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x067f('0x0'),'remove',_0x067f('0x1')];function createListener(_0x4d2dd1,_0x14725d){return function(_0x50b024){_0x14725d['emit'](_0x4d2dd1,_0x50b024);};}function removeListener(_0x20d956,_0x29b1bb){return function(){MailMessageEvents[_0x067f('0x2')](_0x20d956,_0x29b1bb);};}exports[_0x067f('0x3')]=function(_0x150be5){for(var _0x5089a4=0x0,_0x2b3686=events[_0x067f('0x4')];_0x5089a4<_0x2b3686;_0x5089a4++){var _0x5a7482=events[_0x5089a4];var _0xb437bd=createListener(_0x067f('0x5')+_0x5a7482,_0x150be5);MailMessageEvents['on'](_0x5a7482,_0xb437bd);}}; \ No newline at end of file +var _0xf14b=['update','emit','register','length','./mailMessage.events','save','remove'];(function(_0x49cd84,_0x3cae27){var _0x3d4394=function(_0x157e20){while(--_0x157e20){_0x49cd84['push'](_0x49cd84['shift']());}};_0x3d4394(++_0x3cae27);}(_0xf14b,0xdd));var _0xbf14=function(_0x1bd8fd,_0x526cee){_0x1bd8fd=_0x1bd8fd-0x0;var _0x36f371=_0xf14b[_0x1bd8fd];return _0x36f371;};'use strict';var MailMessageEvents=require(_0xbf14('0x0'));var events=[_0xbf14('0x1'),_0xbf14('0x2'),_0xbf14('0x3')];function createListener(_0x421361,_0x245fe4){return function(_0x1f88a8){_0x245fe4[_0xbf14('0x4')](_0x421361,_0x1f88a8);};}function removeListener(_0x1c9f49,_0x3afb15){return function(){MailMessageEvents['removeListener'](_0x1c9f49,_0x3afb15);};}exports[_0xbf14('0x5')]=function(_0xb9333b){for(var _0x1b6462=0x0,_0x368cf0=events[_0xbf14('0x6')];_0x1b6462<_0x368cf0;_0x1b6462++){var _0x4364e7=events[_0x1b6462];var _0xf15519=createListener('mailMessage:'+_0x4364e7,_0xb9333b);MailMessageEvents['on'](_0x4364e7,_0xf15519);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d81680e..880045b 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 _0xc30b=['../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','create','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x20dba1,_0x726a24){var _0x47203d=function(_0x1cfb2d){while(--_0x1cfb2d){_0x20dba1['push'](_0x20dba1['shift']());}};_0x47203d(++_0x726a24);}(_0xc30b,0xa1));var _0xbc30=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc30b[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xbc30('0x0'));var util=require(_0xbc30('0x1'));var path=require(_0xbc30('0x2'));var timeout=require(_0xbc30('0x3'));var express=require('express');var router=express[_0xbc30('0x4')]();var fs_extra=require(_0xbc30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbc30('0x6'));var config=require(_0xbc30('0x7'));var controller=require(_0xbc30('0x8'));router[_0xbc30('0x9')]('/',auth[_0xbc30('0xa')](),controller[_0xbc30('0xb')]);router[_0xbc30('0x9')](_0xbc30('0xc'),auth[_0xbc30('0xa')](),controller['describe']);router['get'](_0xbc30('0xd'),auth[_0xbc30('0xa')](),controller['show']);router[_0xbc30('0x9')](_0xbc30('0xe'),auth[_0xbc30('0xa')](),controller[_0xbc30('0xf')]);router[_0xbc30('0x9')](_0xbc30('0x10'),auth[_0xbc30('0xa')](),controller['getTeams']);router[_0xbc30('0x9')](_0xbc30('0x11'),auth[_0xbc30('0xa')](),controller['getAgents']);router['post']('/',auth[_0xbc30('0xa')](),controller[_0xbc30('0x12')]);router[_0xbc30('0x13')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xbc30('0x13')]('/:id/users',auth[_0xbc30('0xa')](),controller[_0xbc30('0x14')]);router[_0xbc30('0x15')](_0xbc30('0xd'),auth[_0xbc30('0xa')](),controller[_0xbc30('0x16')]);router[_0xbc30('0x17')](_0xbc30('0xd'),auth[_0xbc30('0xa')](),controller[_0xbc30('0x18')]);router[_0xbc30('0x17')](_0xbc30('0x10'),auth[_0xbc30('0xa')](),controller[_0xbc30('0x19')]);router[_0xbc30('0x17')](_0xbc30('0x11'),auth[_0xbc30('0xa')](),controller[_0xbc30('0x1a')]);module[_0xbc30('0x1b')]=router; \ No newline at end of file +var _0xc9c5=['index','/describe','describe','/:id','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc9c5,0x87));var _0x5c9c=function(_0x2ac2de,_0x109a1e){_0x2ac2de=_0x2ac2de-0x0;var _0xf453a1=_0xc9c5[_0x2ac2de];return _0xf453a1;};'use strict';var multer=require(_0x5c9c('0x0'));var util=require(_0x5c9c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c9c('0x2'));var router=express[_0x5c9c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c9c('0x4'));var interaction=require(_0x5c9c('0x5'));var config=require(_0x5c9c('0x6'));var controller=require(_0x5c9c('0x7'));router[_0x5c9c('0x8')]('/',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xa')]);router[_0x5c9c('0x8')](_0x5c9c('0xb'),auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xc')]);router[_0x5c9c('0x8')](_0x5c9c('0xd'),auth[_0x5c9c('0x9')](),controller['show']);router[_0x5c9c('0x8')]('/:id/members',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xe')]);router[_0x5c9c('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5c9c('0xf')]);router[_0x5c9c('0x8')]('/:id/users',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0x10')]);router['post']('/',auth[_0x5c9c('0x9')](),controller['create']);router[_0x5c9c('0x11')](_0x5c9c('0x12'),auth['isAuthenticated'](),controller[_0x5c9c('0x13')]);router[_0x5c9c('0x11')](_0x5c9c('0x14'),auth[_0x5c9c('0x9')](),controller[_0x5c9c('0x15')]);router[_0x5c9c('0x16')]('/:id',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0x17')]);router[_0x5c9c('0x18')](_0x5c9c('0xd'),auth[_0x5c9c('0x9')](),controller[_0x5c9c('0x19')]);router[_0x5c9c('0x18')](_0x5c9c('0x12'),auth[_0x5c9c('0x9')](),controller[_0x5c9c('0x1a')]);router[_0x5c9c('0x18')](_0x5c9c('0x14'),auth['isAuthenticated'](),controller[_0x5c9c('0x1b')]);module[_0x5c9c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8ec5478..6c181d8 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 _0x6483=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x349cb6,_0x219840){var _0x36989a=function(_0xfdb1a9){while(--_0xfdb1a9){_0x349cb6['push'](_0x349cb6['shift']());}};_0x36989a(++_0x219840);}(_0x6483,0x8b));var _0x3648=function(_0x3428a4,_0x1633f8){_0x3428a4=_0x3428a4-0x0;var _0x38ad92=_0x6483[_0x3428a4];return _0x38ad92;};'use strict';var Sequelize=require('sequelize');module[_0x3648('0x0')]={'name':{'type':Sequelize[_0x3648('0x1')],'unique':_0x3648('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3648('0x1')]},'timeout':{'type':Sequelize[_0x3648('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3648('0x4'),_0x3648('0x5'),_0x3648('0x6'))}}; \ No newline at end of file +var _0xb030=['beepall','roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xb030,0x1b4));var _0x0b03=function(_0x3df3c6,_0x496e1a){_0x3df3c6=_0x3df3c6-0x0;var _0x254c43=_0xb030[_0x3df3c6];return _0x254c43;};'use strict';var Sequelize=require(_0x0b03('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b03('0x1')],'unique':_0x0b03('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0b03('0x1')]},'timeout':{'type':Sequelize[_0x0b03('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0b03('0x4'),_0x0b03('0x5'),_0x0b03('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 10a6c0b..5988b50 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 _0x8e44=['tq.TeamId','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','all','transaction','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','MailQueues','error','stack','name','map','MailQueue','rawAttributes','fieldName','keys','query','intersection','model','attributes','fields','length','nolimit','limit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserMailQueue','hasOwnProperty','order','MailQueueId','User','UserId','agent','mailPause','createdAt','rows','format','%s/%s','SIP','updatedAt','findOne','getTeams','Team','Agents','online','voicePause','interface','sequelize','addTeams','each','forEach','userMailQueue:save','removeTeams','ids','select','field'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x8e44,0x1ac));var _0x48e4=function(_0xadb8da,_0x33e25a){_0xadb8da=_0xadb8da-0x0;var _0x36cb1e=_0x8e44[_0xadb8da];return _0x36cb1e;};'use strict';var emlformat=require(_0x48e4('0x0'));var rimraf=require(_0x48e4('0x1'));var zipdir=require(_0x48e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48e4('0x3'));var BPromise=require(_0x48e4('0x4'));var Mustache=require(_0x48e4('0x5'));var util=require(_0x48e4('0x6'));var path=require('path');var sox=require(_0x48e4('0x7'));var csv=require(_0x48e4('0x8'));var ejs=require(_0x48e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x48e4('0xa'));var crypto=require(_0x48e4('0xb'));var jsforce=require(_0x48e4('0xc'));var deskjs=require(_0x48e4('0xd'));var toCsv=require(_0x48e4('0x8'));var querystring=require(_0x48e4('0xe'));var Papa=require(_0x48e4('0xf'));var Redis=require(_0x48e4('0x10'));var authService=require(_0x48e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x48e4('0x12'));var hardwareService=require(_0x48e4('0x13'));var logger=require(_0x48e4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x48e4('0x15'));var licenseUtil=require(_0x48e4('0x16'));var db=require(_0x48e4('0x17'))['db'];config[_0x48e4('0x18')]=_['defaults'](config[_0x48e4('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x48e4('0x19'))(new Redis(config[_0x48e4('0x18')]));require(_0x48e4('0x1a'))[_0x48e4('0x1b')](socket);function respondWithStatusCode(_0x12f7af,_0x39bd10){_0x39bd10=_0x39bd10||0xcc;return function(_0x1ede64){if(_0x1ede64){return _0x12f7af['sendStatus'](_0x39bd10);}return _0x12f7af[_0x48e4('0x1c')](_0x39bd10)[_0x48e4('0x1d')]();};}function respondWithResult(_0x5c8fe5,_0x171f89){_0x171f89=_0x171f89||0xc8;return function(_0x35a599){if(_0x35a599){return _0x5c8fe5['status'](_0x171f89)[_0x48e4('0x1e')](_0x35a599);}};}function respondWithFilteredResult(_0x627366,_0x12fc37){return function(_0x4ffc0d){if(_0x4ffc0d){var _0x231dcd=typeof _0x12fc37[_0x48e4('0x1f')]===_0x48e4('0x20')&&typeof _0x12fc37['limit']===_0x48e4('0x20');var _0x565916=_0x4ffc0d['count'];var _0x113ff4=_0x231dcd?0x0:_0x12fc37[_0x48e4('0x1f')];var _0x25ecba=_0x231dcd?_0x4ffc0d[_0x48e4('0x21')]:_0x12fc37[_0x48e4('0x1f')]+_0x12fc37['limit'];var _0x59eff5;if(_0x25ecba>=_0x565916){_0x25ecba=_0x565916;_0x59eff5=0xc8;}else{_0x59eff5=0xce;}_0x627366[_0x48e4('0x1c')](_0x59eff5);return _0x627366[_0x48e4('0x22')](_0x48e4('0x23'),_0x113ff4+'-'+_0x25ecba+'/'+_0x565916)[_0x48e4('0x1e')](_0x4ffc0d);}return null;};}function patchUpdates(_0x846128){return function(_0x377249){try{jsonpatch[_0x48e4('0x24')](_0x377249,_0x846128,!![]);}catch(_0x378573){return BPromise[_0x48e4('0x25')](_0x378573);}return _0x377249[_0x48e4('0x26')]();};}function saveUpdates(_0x1a80ed,_0x5cc3e6){return function(_0x160e3b){if(_0x160e3b){return _0x160e3b[_0x48e4('0x27')](_0x1a80ed)['then'](function(_0x2beac2){return _0x2beac2;});}return null;};}function removeEntity(_0x23b2ba,_0x4abfbc){return function(_0x9a1c6d){if(_0x9a1c6d){return _0x9a1c6d[_0x48e4('0x28')]()[_0x48e4('0x29')](function(){var _0xc113e3=_0x9a1c6d[_0x48e4('0x2a')]({'plain':!![]});var _0x11bc8a=_0x48e4('0x2b');return db['UserProfileResource'][_0x48e4('0x28')]({'where':{'type':_0x11bc8a,'resourceId':_0xc113e3['id']}})[_0x48e4('0x29')](function(){return _0x9a1c6d;});})['then'](function(){_0x23b2ba['status'](0xcc)[_0x48e4('0x1d')]();});}};}function handleEntityNotFound(_0x4b8f3c,_0x346765){return function(_0x214def){if(!_0x214def){_0x4b8f3c['sendStatus'](0x194);}return _0x214def;};}function handleError(_0x3012b3,_0x28c1){_0x28c1=_0x28c1||0x1f4;return function(_0x14b545){logger[_0x48e4('0x2c')](_0x14b545[_0x48e4('0x2d')]);if(_0x14b545['name']){delete _0x14b545[_0x48e4('0x2e')];}_0x3012b3['status'](_0x28c1)['send'](_0x14b545);};}exports['index']=function(_0x1ee7ef,_0x1450cb){var _0xf2f1cf={},_0x4725ab={},_0x2432ab={'count':0x0,'rows':[]};var _0x403b21=_[_0x48e4('0x2f')](db[_0x48e4('0x30')][_0x48e4('0x31')],function(_0x12af4d){return{'name':_0x12af4d[_0x48e4('0x32')],'type':_0x12af4d['type']['key']};});_0x4725ab['model']=_[_0x48e4('0x2f')](_0x403b21,_0x48e4('0x2e'));_0x4725ab['query']=_[_0x48e4('0x33')](_0x1ee7ef[_0x48e4('0x34')]);_0x4725ab['filters']=_[_0x48e4('0x35')](_0x4725ab[_0x48e4('0x36')],_0x4725ab[_0x48e4('0x34')]);_0xf2f1cf[_0x48e4('0x37')]=_['intersection'](_0x4725ab[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x1ee7ef['query']['fields']));_0xf2f1cf[_0x48e4('0x37')]=_0xf2f1cf[_0x48e4('0x37')][_0x48e4('0x39')]?_0xf2f1cf['attributes']:_0x4725ab[_0x48e4('0x36')];if(!_0x1ee7ef[_0x48e4('0x34')]['hasOwnProperty'](_0x48e4('0x3a'))){_0xf2f1cf[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x3b')]);_0xf2f1cf['offset']=qs[_0x48e4('0x1f')](_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x1f')]);}_0xf2f1cf['order']=qs[_0x48e4('0x3c')](_0x1ee7ef['query'][_0x48e4('0x3c')]);_0xf2f1cf[_0x48e4('0x3d')]=qs[_0x48e4('0x3e')](_[_0x48e4('0x3f')](_0x1ee7ef[_0x48e4('0x34')],_0x4725ab[_0x48e4('0x3e')]),_0x403b21);if(_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x40')]){_0xf2f1cf[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0xf2f1cf[_0x48e4('0x3d')],{'$or':_['map'](_0x403b21,function(_0x3cdafb){if(_0x3cdafb[_0x48e4('0x42')]!==_0x48e4('0x43')){var _0x1e54d9={};_0x1e54d9[_0x3cdafb[_0x48e4('0x2e')]]={'$like':'%'+_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x1e54d9;}})});}_0xf2f1cf=_['merge']({},_0xf2f1cf,_0x1ee7ef[_0x48e4('0x44')]);var _0x1e5317={'where':_0xf2f1cf[_0x48e4('0x3d')]};return db['MailQueue'][_0x48e4('0x21')](_0x1e5317)[_0x48e4('0x29')](function(_0x3cc197){_0x2432ab['count']=_0x3cc197;if(_0x1ee7ef['query'][_0x48e4('0x45')]){_0xf2f1cf[_0x48e4('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0x48e4('0x47')](_0xf2f1cf);})['then'](function(_0x4f1714){_0x2432ab['rows']=_0x4f1714;return _0x2432ab;})['then'](respondWithFilteredResult(_0x1450cb,_0xf2f1cf))[_0x48e4('0x48')](handleError(_0x1450cb,null));};exports[_0x48e4('0x49')]=function(_0x1c5456,_0x124cb1){var _0x4144fa={'raw':!![],'where':{'id':_0x1c5456['params']['id']}},_0x410b8e={};_0x410b8e[_0x48e4('0x36')]=_[_0x48e4('0x33')](db['MailQueue']['rawAttributes']);_0x410b8e[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0x1c5456[_0x48e4('0x34')]);_0x410b8e[_0x48e4('0x3e')]=_['intersection'](_0x410b8e[_0x48e4('0x36')],_0x410b8e[_0x48e4('0x34')]);_0x4144fa[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x410b8e[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x1c5456['query'][_0x48e4('0x38')]));_0x4144fa[_0x48e4('0x37')]=_0x4144fa[_0x48e4('0x37')][_0x48e4('0x39')]?_0x4144fa[_0x48e4('0x37')]:_0x410b8e[_0x48e4('0x36')];if(_0x1c5456[_0x48e4('0x34')][_0x48e4('0x45')]){_0x4144fa[_0x48e4('0x46')]=[{'all':!![]}];}_0x4144fa=_[_0x48e4('0x41')]({},_0x4144fa,_0x1c5456[_0x48e4('0x44')]);return db['MailQueue'][_0x48e4('0x4a')](_0x4144fa)['then'](handleEntityNotFound(_0x124cb1,null))['then'](respondWithResult(_0x124cb1,null))[_0x48e4('0x48')](handleError(_0x124cb1,null));};exports['create']=function(_0x98d025,_0x14511b){return db[_0x48e4('0x30')][_0x48e4('0x4b')](_0x98d025[_0x48e4('0x4c')],{})[_0x48e4('0x29')](function(_0x10eb0c){var _0x57c9e5=_0x98d025['user'][_0x48e4('0x2a')]({'plain':!![]});if(!_0x57c9e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57c9e5[_0x48e4('0x4d')]===_0x48e4('0x4e')){var _0x2bbf8f=_0x10eb0c['get']({'plain':!![]});var _0x14ed52=_0x48e4('0x2b');return db[_0x48e4('0x4f')]['find']({'where':{'name':_0x14ed52,'userProfileId':_0x57c9e5[_0x48e4('0x50')]},'raw':!![]})[_0x48e4('0x29')](function(_0x91b42d){if(_0x91b42d&&_0x91b42d[_0x48e4('0x51')]===0x0){return db[_0x48e4('0x52')]['create']({'name':_0x2bbf8f[_0x48e4('0x2e')],'resourceId':_0x2bbf8f['id'],'type':_0x91b42d[_0x48e4('0x2e')],'sectionId':_0x91b42d['id']},{})['then'](function(){return _0x10eb0c;});}else{return _0x10eb0c;}})[_0x48e4('0x48')](function(_0x43e3ba){logger[_0x48e4('0x2c')](_0x48e4('0x53'),_0x43e3ba);throw _0x43e3ba;});}return _0x10eb0c;})['then'](respondWithResult(_0x14511b,0xc9))['catch'](handleError(_0x14511b,null));};exports['update']=function(_0x55ab36,_0x2be063){if(_0x55ab36[_0x48e4('0x4c')]['id']){delete _0x55ab36[_0x48e4('0x4c')]['id'];}return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x55ab36[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2be063,null))[_0x48e4('0x29')](saveUpdates(_0x55ab36[_0x48e4('0x4c')],null))[_0x48e4('0x29')](respondWithResult(_0x2be063,null))[_0x48e4('0x48')](handleError(_0x2be063,null));};exports[_0x48e4('0x28')]=function(_0x180ae4,_0x4e07e9){return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x180ae4[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x4e07e9,null))[_0x48e4('0x29')](removeEntity(_0x4e07e9,null))[_0x48e4('0x48')](handleError(_0x4e07e9,null));};exports[_0x48e4('0x55')]=function(_0x450baf,_0x1f5e67){return db[_0x48e4('0x30')][_0x48e4('0x55')]()[_0x48e4('0x29')](respondWithResult(_0x1f5e67,null))['catch'](handleError(_0x1f5e67,null));};exports['getMembers']=function(_0xc114a,_0x1da690,_0x2b0be2){var _0x1a30eb={'raw':!![],'where':{}},_0x4147b4={},_0x599988;return db[_0x48e4('0x30')]['findOne']({'where':{'id':_0xc114a[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x1da690,null))[_0x48e4('0x29')](function(_0x573d41){if(_0x573d41){_0x599988=_0x573d41[_0x48e4('0x2a')]({'plain':!![]});_0x4147b4[_0x48e4('0x36')]=_[_0x48e4('0x33')](db[_0x48e4('0x56')][_0x48e4('0x31')]);_0x4147b4[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0xc114a['query']);_0x4147b4[_0x48e4('0x3e')]=_[_0x48e4('0x35')](_0x4147b4[_0x48e4('0x36')],_0x4147b4['query']);_0x1a30eb[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x4147b4['model'],qs['fields'](_0xc114a['query'][_0x48e4('0x38')]));_0x1a30eb[_0x48e4('0x37')]=_0x1a30eb['attributes'][_0x48e4('0x39')]?_0x1a30eb[_0x48e4('0x37')]:_0x4147b4[_0x48e4('0x36')];if(!_0xc114a[_0x48e4('0x34')][_0x48e4('0x57')](_0x48e4('0x3a'))){_0x1a30eb[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0xc114a[_0x48e4('0x34')][_0x48e4('0x3b')]);_0x1a30eb['offset']=qs['offset'](_0xc114a['query'][_0x48e4('0x1f')]);}_0x1a30eb[_0x48e4('0x58')]=qs['sort'](_0xc114a[_0x48e4('0x34')]['sort']);_0x1a30eb[_0x48e4('0x3d')]=qs[_0x48e4('0x3e')](_[_0x48e4('0x3f')](_0xc114a[_0x48e4('0x34')],_0x4147b4[_0x48e4('0x3e')]));_0x1a30eb[_0x48e4('0x3d')][_0x48e4('0x59')]=_0x573d41['id'];if(_0xc114a[_0x48e4('0x34')][_0x48e4('0x40')]){_0x1a30eb[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x1a30eb[_0x48e4('0x3d')],{'$or':_['map'](_0x1a30eb['attributes'],function(_0x3dc914){var _0x57555d={};_0x57555d[_0x3dc914]={'$like':'%'+_0xc114a[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x57555d;})});}_0x1a30eb=_['merge']({},_0x1a30eb,_0xc114a[_0x48e4('0x44')]);return db[_0x48e4('0x56')][_0x48e4('0x47')](_0x1a30eb);}})[_0x48e4('0x29')](function(_0x492ab0){if(_0x492ab0){return db[_0x48e4('0x5a')]['findAndCountAll']({'where':{'id':_[_0x48e4('0x2f')](_0x492ab0,_0x48e4('0x5b')),'role':_0x48e4('0x5c')},'attributes':['id',_0x48e4('0x2e'),_0x48e4('0x5d'),'updatedAt',_0x48e4('0x5e')]});}})['then'](function(_0x21be9c){if(_0x21be9c){return{'count':_0x21be9c[_0x48e4('0x21')],'rows':_[_0x48e4('0x2f')](_0x21be9c[_0x48e4('0x5f')],function(_0x1fe0f9){return{'membername':_0x1fe0f9['name'],'UserId':_0x1fe0f9['id'],'queue_name':_0x599988[_0x48e4('0x2e')],'MailQueueId':_0x599988['id'],'interface':util[_0x48e4('0x60')](_0x48e4('0x61'),_0x48e4('0x62'),_0x1fe0f9[_0x48e4('0x2e')]),'penalty':0x0,'paused':_0x1fe0f9[_0x48e4('0x5d')],'createdAt':_0x1fe0f9[_0x48e4('0x5e')],'updatedAt':_0x1fe0f9[_0x48e4('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x48e4('0x29')](respondWithFilteredResult(_0x1da690,_0x1a30eb))[_0x48e4('0x48')](handleError(_0x1da690,null));};exports['getTeams']=function(_0x4b7106,_0x2f71e8,_0x5d6d17){var _0x4bc126={};var _0x2fbb3e={};var _0x5bd779;var _0xb0dea2;return db['MailQueue'][_0x48e4('0x64')]({'where':{'id':_0x4b7106['params']['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2f71e8,null))[_0x48e4('0x29')](function(_0x7ef265){if(_0x7ef265){_0x5bd779=_0x7ef265;_0x2fbb3e['model']=_['keys'](db['Team'][_0x48e4('0x31')]);_0x2fbb3e['query']=_[_0x48e4('0x33')](_0x4b7106[_0x48e4('0x34')]);_0x2fbb3e[_0x48e4('0x3e')]=_['intersection'](_0x2fbb3e[_0x48e4('0x36')],_0x2fbb3e[_0x48e4('0x34')]);_0x4bc126[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x2fbb3e['model'],qs[_0x48e4('0x38')](_0x4b7106[_0x48e4('0x34')]['fields']));_0x4bc126['attributes']=_0x4bc126[_0x48e4('0x37')]['length']?_0x4bc126['attributes']:_0x2fbb3e[_0x48e4('0x36')];_0x4bc126[_0x48e4('0x58')]=qs[_0x48e4('0x3c')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x3c')]);_0x4bc126['where']=qs['filters'](_[_0x48e4('0x3f')](_0x4b7106[_0x48e4('0x34')],_0x2fbb3e[_0x48e4('0x3e')]));if(_0x4b7106[_0x48e4('0x34')][_0x48e4('0x40')]){_0x4bc126[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x4bc126['where'],{'$or':_[_0x48e4('0x2f')](_0x4bc126['attributes'],function(_0x4d2de2){var _0x2db92a={};_0x2db92a[_0x4d2de2]={'$like':'%'+_0x4b7106[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x2db92a;})});}_0x4bc126=_[_0x48e4('0x41')]({},_0x4bc126,_0x4b7106[_0x48e4('0x44')]);return _0x5bd779[_0x48e4('0x65')](_0x4bc126);}})[_0x48e4('0x29')](function(_0x4ffc74){if(_0x4ffc74){_0xb0dea2=_0x4ffc74[_0x48e4('0x39')];if(!_0x4b7106[_0x48e4('0x34')]['hasOwnProperty']('nolimit')){_0x4bc126[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x3b')]);_0x4bc126[_0x48e4('0x1f')]=qs[_0x48e4('0x1f')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x1f')]);}return _0x5bd779[_0x48e4('0x65')](_0x4bc126);}})[_0x48e4('0x29')](function(_0x7a1d9b){if(_0x7a1d9b){return _0x7a1d9b?{'count':_0xb0dea2,'rows':_0x7a1d9b}:null;}})[_0x48e4('0x29')](respondWithResult(_0x2f71e8,null))[_0x48e4('0x48')](handleError(_0x2f71e8,null));};exports['addTeams']=function(_0x5c3dfb,_0x3cef34,_0x1a9d62){var _0x18be38=_0x5c3dfb[_0x48e4('0x4c')]['ids'];return db[_0x48e4('0x66')][_0x48e4('0x47')]({'where':{'id':_0x18be38},'attributes':['id'],'include':[{'model':db[_0x48e4('0x5a')],'as':_0x48e4('0x67'),'attributes':['id',_0x48e4('0x2e'),_0x48e4('0x68'),_0x48e4('0x69'),_0x48e4('0x6a')],'raw':!![]}]})[_0x48e4('0x29')](function(_0x1c0e65){if(_0x1c0e65){var _0x26006a=_['flatMap'](_0x1c0e65,function(_0x37ed49){var _0xaafa73=_0x37ed49[_0x48e4('0x2a')]({'plain':!![]});return _0xaafa73[_0x48e4('0x67')];});return db[_0x48e4('0x30')]['find']({'where':{'id':_0x5c3dfb['params']['id']}})[_0x48e4('0x29')](function(_0x3d7192){return db[_0x48e4('0x6b')]['transaction'](function(_0x110f79){return _0x3d7192[_0x48e4('0x6c')](_0x18be38,{'transaction':_0x110f79})[_0x48e4('0x29')](function(){return BPromise[_0x48e4('0x6d')](_0x26006a,function(_0x35819c){return db[_0x48e4('0x56')]['findOrCreate']({'where':{'UserId':_0x35819c['id'],'MailQueueId':_0x5c3dfb[_0x48e4('0x54')]['id']},'transaction':_0x110f79});});})[_0x48e4('0x29')](function(){_0x26006a[_0x48e4('0x6e')](function(_0x235a36){socket['emit'](_0x48e4('0x6f'),{'UserId':_0x235a36['id'],'MailQueueId':_0x3d7192['id']});});});});});}})[_0x48e4('0x29')](respondWithStatusCode(_0x3cef34,null))[_0x48e4('0x48')](handleError(_0x3cef34,null));};exports[_0x48e4('0x70')]=function(_0x1cd791,_0x1e3c73,_0xb9c24d){return db[_0x48e4('0x66')][_0x48e4('0x47')]({'where':{'id':_0x1cd791[_0x48e4('0x34')][_0x48e4('0x71')]},'attributes':['id'],'include':[{'model':db[_0x48e4('0x5a')],'as':_0x48e4('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e3c73,null))[_0x48e4('0x29')](function(_0xe8ba4f){var _0x18b21a=_[_0x48e4('0x2f')](_0xe8ba4f,'id');var _0x2d9326=[];var _0x3108e1=[];var _0x28f23c=squel[_0x48e4('0x72')]();_0x28f23c[_0x48e4('0x73')](_0x48e4('0x74'))[_0x48e4('0x75')](_0x48e4('0x76'),'tq')[_0x48e4('0x77')](_0x48e4('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x1cd791['params']['id']);for(var _0x4bafc9=0x0;_0x4bafc9<_0xe8ba4f[_0x48e4('0x39')];_0x4bafc9+=0x1){let _0x486c6e=_0xe8ba4f[_0x4bafc9];for(var _0x40b3d8=0x0;_0x40b3d8<_0x486c6e[_0x48e4('0x67')][_0x48e4('0x39')];_0x40b3d8+=0x1){let _0x234372=_0x486c6e[_0x48e4('0x67')][_0x40b3d8];var _0x3de23a=_0x28f23c[_0x48e4('0x79')]();_0x3de23a[_0x48e4('0x3d')](_0x48e4('0x7a'),_0x234372['id']);_0x3108e1[_0x48e4('0x7b')](db['sequelize'][_0x48e4('0x34')](_0x3de23a['toString'](),{'type':db['sequelize']['QueryTypes'][_0x48e4('0x7c')]})['then'](function(_0x2065e2){if(_0x2065e2[_0x48e4('0x39')]===0x1){return _0x234372['id'];}else{var _0x37d1ca=_['every'](_[_0x48e4('0x2f')](_0x2065e2,_0x48e4('0x7d')),function(_0x25b7df){return _['includes'](_0x18b21a,_0x25b7df);});if(_0x37d1ca){return _0x234372['id'];}}}));}}return BPromise[_0x48e4('0x7e')](_0x3108e1)[_0x48e4('0x29')](function(_0x405a80){_0x2d9326=_(_0x2d9326)['union'](_0x405a80)['compact']()['value']();return db['MailQueue'][_0x48e4('0x4a')]({'where':{'id':_0x1cd791[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](function(_0x2b89b7){return db[_0x48e4('0x6b')][_0x48e4('0x7f')](function(_0x2aa04b){return _0x2b89b7['removeTeams'](_0x1cd791['query'][_0x48e4('0x71')],{'transaction':_0x2aa04b})[_0x48e4('0x29')](function(){if(!_['isEmpty'](_0x2d9326)){return _0x2b89b7[_0x48e4('0x80')](_0x2d9326,{'transaction':_0x2aa04b});}})[_0x48e4('0x29')](function(){_0x2d9326[_0x48e4('0x6e')](function(_0x4903c9){socket['emit'](_0x48e4('0x81'),{'UserId':_0x4903c9,'MailQueueId':_0x2b89b7['id']});});});});});});})[_0x48e4('0x29')](respondWithStatusCode(_0x1e3c73,null))[_0x48e4('0x48')](handleError(_0x1e3c73,null));};exports[_0x48e4('0x82')]=function(_0x49883b,_0x2fc6c3,_0x47774a){return db[_0x48e4('0x30')]['find']({'where':{'id':_0x49883b[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2fc6c3,null))[_0x48e4('0x29')](function(_0x13e465){if(_0x13e465){return _0x13e465[_0x48e4('0x82')](_0x49883b[_0x48e4('0x4c')][_0x48e4('0x71')],_[_0x48e4('0x83')](_0x49883b[_0x48e4('0x4c')],[_0x48e4('0x71'),'id'])||{})[_0x48e4('0x84')](function(_0x388835){for(var _0x5f0905=0x0;_0x5f0905<_0x49883b[_0x48e4('0x4c')][_0x48e4('0x71')][_0x48e4('0x39')];_0x5f0905+=0x1){socket[_0x48e4('0x85')](_0x48e4('0x6f'),{'UserId':Number(_0x49883b[_0x48e4('0x4c')]['ids'][_0x5f0905]),'MailQueueId':Number(_0x49883b[_0x48e4('0x54')]['id'])});}return _0x388835;});}})[_0x48e4('0x29')](respondWithResult(_0x2fc6c3,null))[_0x48e4('0x48')](handleError(_0x2fc6c3,null));};exports[_0x48e4('0x80')]=function(_0x4c8717,_0x133a0d,_0x237faf){return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x4c8717[_0x48e4('0x54')]['id']}})['then'](handleEntityNotFound(_0x133a0d,null))[_0x48e4('0x29')](function(_0x2b3e12){if(_0x2b3e12){return _0x2b3e12[_0x48e4('0x80')](_0x4c8717['query']['ids'])[_0x48e4('0x29')](function(){if(_[_0x48e4('0x86')](_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')])){for(var _0x190714=0x0;_0x190714<_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')][_0x48e4('0x39')];_0x190714+=0x1){socket[_0x48e4('0x85')]('userMailQueue:remove',{'UserId':Number(_0x4c8717[_0x48e4('0x34')]['ids'][_0x190714]),'MailQueueId':Number(_0x4c8717[_0x48e4('0x54')]['id'])});}}else{socket[_0x48e4('0x85')](_0x48e4('0x81'),{'UserId':Number(_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')]),'MailQueueId':Number(_0x4c8717['params']['id'])});}});}})[_0x48e4('0x29')](respondWithStatusCode(_0x133a0d,null))['catch'](handleError(_0x133a0d,null));};exports[_0x48e4('0x87')]=function(_0x17d045,_0x9d66b2,_0x14c8f6){var _0x51a43c={};var _0x26bd73={};var _0x3f966a;var _0x268ab6;return db['MailQueue'][_0x48e4('0x64')]({'where':{'id':_0x17d045[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x9d66b2,null))[_0x48e4('0x29')](function(_0x35af85){if(_0x35af85){_0x3f966a=_0x35af85;_0x26bd73['model']=_[_0x48e4('0x33')](db[_0x48e4('0x5a')][_0x48e4('0x31')]);_0x26bd73[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0x17d045['query']);_0x26bd73['filters']=_[_0x48e4('0x35')](_0x26bd73[_0x48e4('0x36')],_0x26bd73[_0x48e4('0x34')]);_0x51a43c[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x26bd73[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x17d045[_0x48e4('0x34')][_0x48e4('0x38')]));_0x51a43c['attributes']=_0x51a43c[_0x48e4('0x37')][_0x48e4('0x39')]?_0x51a43c[_0x48e4('0x37')]:_0x26bd73[_0x48e4('0x36')];_0x51a43c[_0x48e4('0x58')]=qs['sort'](_0x17d045[_0x48e4('0x34')][_0x48e4('0x3c')]);_0x51a43c[_0x48e4('0x3d')]=qs['filters'](_[_0x48e4('0x3f')](_0x17d045[_0x48e4('0x34')],_0x26bd73[_0x48e4('0x3e')]));if(_0x17d045[_0x48e4('0x34')][_0x48e4('0x40')]){_0x51a43c[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x51a43c[_0x48e4('0x3d')],{'$or':_['map'](_0x51a43c[_0x48e4('0x37')],function(_0x212b2e){var _0x311de3={};_0x311de3[_0x212b2e]={'$like':'%'+_0x17d045[_0x48e4('0x34')]['filter']+'%'};return _0x311de3;})});}_0x51a43c=_[_0x48e4('0x41')]({},_0x51a43c,_0x17d045[_0x48e4('0x44')]);return _0x3f966a[_0x48e4('0x87')](_0x51a43c);}})['then'](function(_0x437262){if(_0x437262){_0x268ab6=_0x437262['length'];if(!_0x17d045[_0x48e4('0x34')][_0x48e4('0x57')](_0x48e4('0x3a'))){_0x51a43c['limit']=qs[_0x48e4('0x3b')](_0x17d045[_0x48e4('0x34')]['limit']);_0x51a43c[_0x48e4('0x1f')]=qs[_0x48e4('0x1f')](_0x17d045[_0x48e4('0x34')][_0x48e4('0x1f')]);}return _0x3f966a[_0x48e4('0x87')](_0x51a43c);}})[_0x48e4('0x29')](function(_0x2ead71){if(_0x2ead71){return _0x2ead71?{'count':_0x268ab6,'rows':_0x2ead71}:null;}})[_0x48e4('0x29')](respondWithResult(_0x9d66b2,null))['catch'](handleError(_0x9d66b2,null));}; \ No newline at end of file +var _0x4c58=['update','then','destroy','MailQueues','UserProfileResource','error','stack','name','status','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','MailQueue','include','findAll','catch','rawAttributes','includeAll','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','transaction','ids','removeAgents','omit','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./mailQueue.socket','register','sendStatus','end','offset','undefined','limit','count','set','json','apply','reject','save'];(function(_0x131c60,_0x11d53c){var _0x3f7459=function(_0x523a70){while(--_0x523a70){_0x131c60['push'](_0x131c60['shift']());}};_0x3f7459(++_0x11d53c);}(_0x4c58,0xed));var _0x84c5=function(_0x2276dd,_0x2a5bdf){_0x2276dd=_0x2276dd-0x0;var _0x22a16b=_0x4c58[_0x2276dd];return _0x22a16b;};'use strict';var emlformat=require(_0x84c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84c5('0x1'));var jsonpatch=require(_0x84c5('0x2'));var rp=require(_0x84c5('0x3'));var moment=require(_0x84c5('0x4'));var BPromise=require(_0x84c5('0x5'));var Mustache=require(_0x84c5('0x6'));var util=require(_0x84c5('0x7'));var path=require('path');var sox=require(_0x84c5('0x8'));var csv=require(_0x84c5('0x9'));var ejs=require(_0x84c5('0xa'));var fs=require('fs');var fs_extra=require(_0x84c5('0xb'));var _=require(_0x84c5('0xc'));var squel=require(_0x84c5('0xd'));var crypto=require(_0x84c5('0xe'));var jsforce=require(_0x84c5('0xf'));var deskjs=require(_0x84c5('0x10'));var toCsv=require(_0x84c5('0x9'));var querystring=require(_0x84c5('0x11'));var Papa=require(_0x84c5('0x12'));var Redis=require(_0x84c5('0x13'));var authService=require(_0x84c5('0x14'));var qs=require(_0x84c5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84c5('0x16'));var logger=require(_0x84c5('0x17'))(_0x84c5('0x18'));var utils=require('../../config/utils');var config=require(_0x84c5('0x19'));var licenseUtil=require(_0x84c5('0x1a'));var db=require(_0x84c5('0x1b'))['db'];config['redis']=_['defaults'](config[_0x84c5('0x1c')],{'host':_0x84c5('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84c5('0x1c')]));require(_0x84c5('0x1e'))[_0x84c5('0x1f')](socket);function respondWithStatusCode(_0x12a093,_0x1df6d5){_0x1df6d5=_0x1df6d5||0xcc;return function(_0x3cc823){if(_0x3cc823){return _0x12a093[_0x84c5('0x20')](_0x1df6d5);}return _0x12a093['status'](_0x1df6d5)[_0x84c5('0x21')]();};}function respondWithResult(_0xc72976,_0x24232f){_0x24232f=_0x24232f||0xc8;return function(_0x2f1fb5){if(_0x2f1fb5){return _0xc72976['status'](_0x24232f)['json'](_0x2f1fb5);}};}function respondWithFilteredResult(_0x23e078,_0xb6b1be){return function(_0x4c1060){if(_0x4c1060){var _0x52a4e2=typeof _0xb6b1be[_0x84c5('0x22')]===_0x84c5('0x23')&&typeof _0xb6b1be[_0x84c5('0x24')]===_0x84c5('0x23');var _0x2fbc39=_0x4c1060[_0x84c5('0x25')];var _0x25412d=_0x52a4e2?0x0:_0xb6b1be[_0x84c5('0x22')];var _0x38c45e=_0x52a4e2?_0x4c1060[_0x84c5('0x25')]:_0xb6b1be['offset']+_0xb6b1be[_0x84c5('0x24')];var _0x1a87b5;if(_0x38c45e>=_0x2fbc39){_0x38c45e=_0x2fbc39;_0x1a87b5=0xc8;}else{_0x1a87b5=0xce;}_0x23e078['status'](_0x1a87b5);return _0x23e078[_0x84c5('0x26')]('Content-Range',_0x25412d+'-'+_0x38c45e+'/'+_0x2fbc39)[_0x84c5('0x27')](_0x4c1060);}return null;};}function patchUpdates(_0x4e4bbf){return function(_0x31fd9c){try{jsonpatch[_0x84c5('0x28')](_0x31fd9c,_0x4e4bbf,!![]);}catch(_0x888bce){return BPromise[_0x84c5('0x29')](_0x888bce);}return _0x31fd9c[_0x84c5('0x2a')]();};}function saveUpdates(_0x34f24d,_0x5944ef){return function(_0x40c01e){if(_0x40c01e){return _0x40c01e[_0x84c5('0x2b')](_0x34f24d)[_0x84c5('0x2c')](function(_0x39347f){return _0x39347f;});}return null;};}function removeEntity(_0x16161d,_0x272598){return function(_0x316344){if(_0x316344){return _0x316344[_0x84c5('0x2d')]()[_0x84c5('0x2c')](function(){var _0x159913=_0x316344['get']({'plain':!![]});var _0x4deb9c=_0x84c5('0x2e');return db[_0x84c5('0x2f')][_0x84c5('0x2d')]({'where':{'type':_0x4deb9c,'resourceId':_0x159913['id']}})['then'](function(){return _0x316344;});})['then'](function(){_0x16161d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x91aab,_0x413078){return function(_0xb9252b){if(!_0xb9252b){_0x91aab[_0x84c5('0x20')](0x194);}return _0xb9252b;};}function handleError(_0x9c8c38,_0x3b3211){_0x3b3211=_0x3b3211||0x1f4;return function(_0x41fe48){logger[_0x84c5('0x30')](_0x41fe48[_0x84c5('0x31')]);if(_0x41fe48[_0x84c5('0x32')]){delete _0x41fe48['name'];}_0x9c8c38[_0x84c5('0x33')](_0x3b3211)['send'](_0x41fe48);};}exports[_0x84c5('0x34')]=function(_0xa7d840,_0x22398d){var _0x275d4a={},_0x1083f0={},_0x2ecd6f={'count':0x0,'rows':[]};var _0x2aba8d=_[_0x84c5('0x35')](db['MailQueue']['rawAttributes'],function(_0x1331e9){return{'name':_0x1331e9['fieldName'],'type':_0x1331e9[_0x84c5('0x36')][_0x84c5('0x37')]};});_0x1083f0[_0x84c5('0x38')]=_[_0x84c5('0x35')](_0x2aba8d,_0x84c5('0x32'));_0x1083f0[_0x84c5('0x39')]=_[_0x84c5('0x3a')](_0xa7d840['query']);_0x1083f0['filters']=_[_0x84c5('0x3b')](_0x1083f0[_0x84c5('0x38')],_0x1083f0[_0x84c5('0x39')]);_0x275d4a[_0x84c5('0x3c')]=_[_0x84c5('0x3b')](_0x1083f0['model'],qs[_0x84c5('0x3d')](_0xa7d840[_0x84c5('0x39')][_0x84c5('0x3d')]));_0x275d4a['attributes']=_0x275d4a[_0x84c5('0x3c')][_0x84c5('0x3e')]?_0x275d4a[_0x84c5('0x3c')]:_0x1083f0['model'];if(!_0xa7d840['query'][_0x84c5('0x3f')](_0x84c5('0x40'))){_0x275d4a[_0x84c5('0x24')]=qs[_0x84c5('0x24')](_0xa7d840[_0x84c5('0x39')][_0x84c5('0x24')]);_0x275d4a['offset']=qs[_0x84c5('0x22')](_0xa7d840[_0x84c5('0x39')][_0x84c5('0x22')]);}_0x275d4a[_0x84c5('0x41')]=qs['sort'](_0xa7d840[_0x84c5('0x39')][_0x84c5('0x42')]);_0x275d4a[_0x84c5('0x43')]=qs[_0x84c5('0x44')](_[_0x84c5('0x45')](_0xa7d840['query'],_0x1083f0[_0x84c5('0x44')]),_0x2aba8d);if(_0xa7d840[_0x84c5('0x39')][_0x84c5('0x46')]){_0x275d4a['where']=_['merge'](_0x275d4a[_0x84c5('0x43')],{'$or':_[_0x84c5('0x35')](_0x2aba8d,function(_0x3237c1){if(_0x3237c1[_0x84c5('0x36')]!==_0x84c5('0x47')){var _0x40cad6={};_0x40cad6[_0x3237c1[_0x84c5('0x32')]]={'$like':'%'+_0xa7d840['query'][_0x84c5('0x46')]+'%'};return _0x40cad6;}})});}_0x275d4a=_[_0x84c5('0x48')]({},_0x275d4a,_0xa7d840[_0x84c5('0x49')]);var _0x137e03={'where':_0x275d4a[_0x84c5('0x43')]};return db[_0x84c5('0x4a')][_0x84c5('0x25')](_0x137e03)[_0x84c5('0x2c')](function(_0x493e1a){_0x2ecd6f[_0x84c5('0x25')]=_0x493e1a;if(_0xa7d840[_0x84c5('0x39')]['includeAll']){_0x275d4a[_0x84c5('0x4b')]=[{'all':!![]}];}return db[_0x84c5('0x4a')][_0x84c5('0x4c')](_0x275d4a);})[_0x84c5('0x2c')](function(_0x203b41){_0x2ecd6f['rows']=_0x203b41;return _0x2ecd6f;})[_0x84c5('0x2c')](respondWithFilteredResult(_0x22398d,_0x275d4a))[_0x84c5('0x4d')](handleError(_0x22398d,null));};exports['show']=function(_0x2bde21,_0x1f37d3){var _0x58e9f6={'raw':!![],'where':{'id':_0x2bde21['params']['id']}},_0x316405={};_0x316405['model']=_[_0x84c5('0x3a')](db[_0x84c5('0x4a')][_0x84c5('0x4e')]);_0x316405[_0x84c5('0x39')]=_['keys'](_0x2bde21[_0x84c5('0x39')]);_0x316405['filters']=_['intersection'](_0x316405[_0x84c5('0x38')],_0x316405['query']);_0x58e9f6[_0x84c5('0x3c')]=_[_0x84c5('0x3b')](_0x316405[_0x84c5('0x38')],qs['fields'](_0x2bde21[_0x84c5('0x39')][_0x84c5('0x3d')]));_0x58e9f6[_0x84c5('0x3c')]=_0x58e9f6[_0x84c5('0x3c')]['length']?_0x58e9f6[_0x84c5('0x3c')]:_0x316405[_0x84c5('0x38')];if(_0x2bde21[_0x84c5('0x39')][_0x84c5('0x4f')]){_0x58e9f6[_0x84c5('0x4b')]=[{'all':!![]}];}_0x58e9f6=_[_0x84c5('0x48')]({},_0x58e9f6,_0x2bde21['options']);return db[_0x84c5('0x4a')][_0x84c5('0x50')](_0x58e9f6)['then'](handleEntityNotFound(_0x1f37d3,null))['then'](respondWithResult(_0x1f37d3,null))[_0x84c5('0x4d')](handleError(_0x1f37d3,null));};exports[_0x84c5('0x51')]=function(_0xdb7d09,_0x3834c9){return db[_0x84c5('0x4a')][_0x84c5('0x51')](_0xdb7d09[_0x84c5('0x52')],{})[_0x84c5('0x2c')](function(_0x4773da){var _0x36a34b=_0xdb7d09[_0x84c5('0x53')][_0x84c5('0x54')]({'plain':!![]});if(!_0x36a34b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36a34b[_0x84c5('0x55')]==='user'){var _0x4137ad=_0x4773da[_0x84c5('0x54')]({'plain':!![]});var _0x17eb46='MailQueues';return db[_0x84c5('0x56')]['find']({'where':{'name':_0x17eb46,'userProfileId':_0x36a34b[_0x84c5('0x57')]},'raw':!![]})[_0x84c5('0x2c')](function(_0x4044cd){if(_0x4044cd&&_0x4044cd['autoAssociation']===0x0){return db[_0x84c5('0x2f')]['create']({'name':_0x4137ad['name'],'resourceId':_0x4137ad['id'],'type':_0x4044cd['name'],'sectionId':_0x4044cd['id']},{})[_0x84c5('0x2c')](function(){return _0x4773da;});}else{return _0x4773da;}})[_0x84c5('0x4d')](function(_0x2f897f){logger[_0x84c5('0x30')](_0x84c5('0x58'),_0x2f897f);throw _0x2f897f;});}return _0x4773da;})[_0x84c5('0x2c')](respondWithResult(_0x3834c9,0xc9))[_0x84c5('0x4d')](handleError(_0x3834c9,null));};exports[_0x84c5('0x2b')]=function(_0x5b3804,_0x1a59b1){if(_0x5b3804['body']['id']){delete _0x5b3804[_0x84c5('0x52')]['id'];}return db[_0x84c5('0x4a')][_0x84c5('0x50')]({'where':{'id':_0x5b3804[_0x84c5('0x59')]['id']}})[_0x84c5('0x2c')](handleEntityNotFound(_0x1a59b1,null))['then'](saveUpdates(_0x5b3804[_0x84c5('0x52')],null))[_0x84c5('0x2c')](respondWithResult(_0x1a59b1,null))[_0x84c5('0x4d')](handleError(_0x1a59b1,null));};exports[_0x84c5('0x2d')]=function(_0x27478d,_0x11d5f9){return db['MailQueue'][_0x84c5('0x50')]({'where':{'id':_0x27478d[_0x84c5('0x59')]['id']}})[_0x84c5('0x2c')](handleEntityNotFound(_0x11d5f9,null))[_0x84c5('0x2c')](removeEntity(_0x11d5f9,null))['catch'](handleError(_0x11d5f9,null));};exports[_0x84c5('0x5a')]=function(_0x4834c4,_0x45f23c){return db[_0x84c5('0x4a')][_0x84c5('0x5a')]()[_0x84c5('0x2c')](respondWithResult(_0x45f23c,null))['catch'](handleError(_0x45f23c,null));};exports[_0x84c5('0x5b')]=function(_0x428df3,_0x194e9d,_0x272576){var _0x4b2137={'raw':!![],'where':{}},_0x16cbb5={},_0x53798d;return db[_0x84c5('0x4a')][_0x84c5('0x5c')]({'where':{'id':_0x428df3[_0x84c5('0x59')]['id']}})[_0x84c5('0x2c')](handleEntityNotFound(_0x194e9d,null))[_0x84c5('0x2c')](function(_0x52d3b4){if(_0x52d3b4){_0x53798d=_0x52d3b4[_0x84c5('0x54')]({'plain':!![]});_0x16cbb5[_0x84c5('0x38')]=_[_0x84c5('0x3a')](db[_0x84c5('0x5d')]['rawAttributes']);_0x16cbb5[_0x84c5('0x39')]=_[_0x84c5('0x3a')](_0x428df3[_0x84c5('0x39')]);_0x16cbb5[_0x84c5('0x44')]=_[_0x84c5('0x3b')](_0x16cbb5[_0x84c5('0x38')],_0x16cbb5['query']);_0x4b2137['attributes']=_['intersection'](_0x16cbb5['model'],qs[_0x84c5('0x3d')](_0x428df3['query']['fields']));_0x4b2137['attributes']=_0x4b2137[_0x84c5('0x3c')][_0x84c5('0x3e')]?_0x4b2137[_0x84c5('0x3c')]:_0x16cbb5['model'];if(!_0x428df3[_0x84c5('0x39')]['hasOwnProperty'](_0x84c5('0x40'))){_0x4b2137['limit']=qs['limit'](_0x428df3[_0x84c5('0x39')][_0x84c5('0x24')]);_0x4b2137[_0x84c5('0x22')]=qs[_0x84c5('0x22')](_0x428df3[_0x84c5('0x39')][_0x84c5('0x22')]);}_0x4b2137['order']=qs[_0x84c5('0x42')](_0x428df3['query'][_0x84c5('0x42')]);_0x4b2137[_0x84c5('0x43')]=qs[_0x84c5('0x44')](_['pick'](_0x428df3['query'],_0x16cbb5[_0x84c5('0x44')]));_0x4b2137['where'][_0x84c5('0x5e')]=_0x52d3b4['id'];if(_0x428df3[_0x84c5('0x39')][_0x84c5('0x46')]){_0x4b2137[_0x84c5('0x43')]=_[_0x84c5('0x48')](_0x4b2137['where'],{'$or':_[_0x84c5('0x35')](_0x4b2137['attributes'],function(_0x1811cf){var _0x1ef1d3={};_0x1ef1d3[_0x1811cf]={'$like':'%'+_0x428df3[_0x84c5('0x39')][_0x84c5('0x46')]+'%'};return _0x1ef1d3;})});}_0x4b2137=_[_0x84c5('0x48')]({},_0x4b2137,_0x428df3[_0x84c5('0x49')]);return db['UserMailQueue'][_0x84c5('0x4c')](_0x4b2137);}})[_0x84c5('0x2c')](function(_0x46d13d){if(_0x46d13d){return db[_0x84c5('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x46d13d,_0x84c5('0x60')),'role':_0x84c5('0x61')},'attributes':['id',_0x84c5('0x32'),_0x84c5('0x62'),_0x84c5('0x63'),_0x84c5('0x64')]});}})['then'](function(_0x47d756){if(_0x47d756){return{'count':_0x47d756[_0x84c5('0x25')],'rows':_[_0x84c5('0x35')](_0x47d756['rows'],function(_0x5abb24){return{'membername':_0x5abb24['name'],'UserId':_0x5abb24['id'],'queue_name':_0x53798d[_0x84c5('0x32')],'MailQueueId':_0x53798d['id'],'interface':util[_0x84c5('0x65')](_0x84c5('0x66'),'SIP',_0x5abb24[_0x84c5('0x32')]),'penalty':0x0,'paused':_0x5abb24[_0x84c5('0x62')],'createdAt':_0x5abb24[_0x84c5('0x64')],'updatedAt':_0x5abb24[_0x84c5('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x84c5('0x2c')](respondWithFilteredResult(_0x194e9d,_0x4b2137))[_0x84c5('0x4d')](handleError(_0x194e9d,null));};exports[_0x84c5('0x67')]=function(_0x11dbbf,_0x3211fc,_0x256b4d){var _0x259d43={};var _0x45b533={};var _0x484750;var _0x279491;return db[_0x84c5('0x4a')][_0x84c5('0x5c')]({'where':{'id':_0x11dbbf[_0x84c5('0x59')]['id']}})[_0x84c5('0x2c')](handleEntityNotFound(_0x3211fc,null))['then'](function(_0x5ab4e8){if(_0x5ab4e8){_0x484750=_0x5ab4e8;_0x45b533[_0x84c5('0x38')]=_['keys'](db[_0x84c5('0x68')][_0x84c5('0x4e')]);_0x45b533[_0x84c5('0x39')]=_[_0x84c5('0x3a')](_0x11dbbf[_0x84c5('0x39')]);_0x45b533[_0x84c5('0x44')]=_[_0x84c5('0x3b')](_0x45b533[_0x84c5('0x38')],_0x45b533['query']);_0x259d43[_0x84c5('0x3c')]=_[_0x84c5('0x3b')](_0x45b533[_0x84c5('0x38')],qs[_0x84c5('0x3d')](_0x11dbbf[_0x84c5('0x39')]['fields']));_0x259d43[_0x84c5('0x3c')]=_0x259d43['attributes'][_0x84c5('0x3e')]?_0x259d43[_0x84c5('0x3c')]:_0x45b533[_0x84c5('0x38')];_0x259d43[_0x84c5('0x41')]=qs[_0x84c5('0x42')](_0x11dbbf[_0x84c5('0x39')][_0x84c5('0x42')]);_0x259d43[_0x84c5('0x43')]=qs[_0x84c5('0x44')](_[_0x84c5('0x45')](_0x11dbbf['query'],_0x45b533['filters']));if(_0x11dbbf[_0x84c5('0x39')]['filter']){_0x259d43[_0x84c5('0x43')]=_[_0x84c5('0x48')](_0x259d43[_0x84c5('0x43')],{'$or':_[_0x84c5('0x35')](_0x259d43[_0x84c5('0x3c')],function(_0x12c15d){var _0x155c68={};_0x155c68[_0x12c15d]={'$like':'%'+_0x11dbbf[_0x84c5('0x39')][_0x84c5('0x46')]+'%'};return _0x155c68;})});}_0x259d43=_[_0x84c5('0x48')]({},_0x259d43,_0x11dbbf[_0x84c5('0x49')]);return _0x484750['getTeams'](_0x259d43);}})[_0x84c5('0x2c')](function(_0x21dfce){if(_0x21dfce){_0x279491=_0x21dfce[_0x84c5('0x3e')];if(!_0x11dbbf['query'][_0x84c5('0x3f')]('nolimit')){_0x259d43[_0x84c5('0x24')]=qs[_0x84c5('0x24')](_0x11dbbf[_0x84c5('0x39')][_0x84c5('0x24')]);_0x259d43[_0x84c5('0x22')]=qs['offset'](_0x11dbbf[_0x84c5('0x39')][_0x84c5('0x22')]);}return _0x484750[_0x84c5('0x67')](_0x259d43);}})['then'](function(_0x829b64){if(_0x829b64){return _0x829b64?{'count':_0x279491,'rows':_0x829b64}:null;}})[_0x84c5('0x2c')](respondWithResult(_0x3211fc,null))['catch'](handleError(_0x3211fc,null));};exports[_0x84c5('0x69')]=function(_0xea4321,_0xc9d869,_0x5c8f50){var _0x4196e0=_0xea4321[_0x84c5('0x52')]['ids'];return db[_0x84c5('0x68')]['findAll']({'where':{'id':_0x4196e0},'attributes':['id'],'include':[{'model':db[_0x84c5('0x5f')],'as':_0x84c5('0x6a'),'attributes':['id',_0x84c5('0x32'),_0x84c5('0x6b'),_0x84c5('0x6c'),_0x84c5('0x6d')],'raw':!![]}]})['then'](function(_0x2b1e2b){if(_0x2b1e2b){var _0x139aa2=_[_0x84c5('0x6e')](_0x2b1e2b,function(_0xcf7298){var _0x214808=_0xcf7298[_0x84c5('0x54')]({'plain':!![]});return _0x214808['Agents'];});return db['MailQueue']['find']({'where':{'id':_0xea4321[_0x84c5('0x59')]['id']}})['then'](function(_0x177587){return db['sequelize']['transaction'](function(_0x1c4228){return _0x177587[_0x84c5('0x69')](_0x4196e0,{'transaction':_0x1c4228})['then'](function(){return BPromise['each'](_0x139aa2,function(_0x6ca285){return db[_0x84c5('0x5d')][_0x84c5('0x6f')]({'where':{'UserId':_0x6ca285['id'],'MailQueueId':_0xea4321[_0x84c5('0x59')]['id']},'transaction':_0x1c4228});});})[_0x84c5('0x2c')](function(){_0x139aa2[_0x84c5('0x70')](function(_0xfd7d9){socket[_0x84c5('0x71')](_0x84c5('0x72'),{'UserId':_0xfd7d9['id'],'MailQueueId':_0x177587['id']});});});});});}})['then'](respondWithStatusCode(_0xc9d869,null))[_0x84c5('0x4d')](handleError(_0xc9d869,null));};exports[_0x84c5('0x73')]=function(_0x1b17f1,_0xa77130,_0xd78873){return db[_0x84c5('0x68')][_0x84c5('0x4c')]({'where':{'id':_0x1b17f1['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x84c5('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa77130,null))[_0x84c5('0x2c')](function(_0x4f13a1){var _0x20a27c=_[_0x84c5('0x35')](_0x4f13a1,'id');var _0x5a63c7=[];var _0x927417=[];var _0x1e59db=squel['select']();_0x1e59db['field']('tq.TeamId')[_0x84c5('0x74')](_0x84c5('0x75'),'tq')['join'](_0x84c5('0x76'),'ut',_0x84c5('0x77'))[_0x84c5('0x43')](_0x84c5('0x78'),_0x1b17f1[_0x84c5('0x59')]['id']);for(var _0x3c8c6e=0x0;_0x3c8c6e<_0x4f13a1[_0x84c5('0x3e')];_0x3c8c6e+=0x1){let _0x29e9bd=_0x4f13a1[_0x3c8c6e];for(var _0x5bcb22=0x0;_0x5bcb22<_0x29e9bd['Agents'][_0x84c5('0x3e')];_0x5bcb22+=0x1){let _0x2ab1e4=_0x29e9bd[_0x84c5('0x6a')][_0x5bcb22];var _0x1ef50e=_0x1e59db[_0x84c5('0x79')]();_0x1ef50e[_0x84c5('0x43')](_0x84c5('0x7a'),_0x2ab1e4['id']);_0x927417[_0x84c5('0x7b')](db[_0x84c5('0x7c')]['query'](_0x1ef50e[_0x84c5('0x7d')](),{'type':db[_0x84c5('0x7c')]['QueryTypes'][_0x84c5('0x7e')]})['then'](function(_0x27efe0){if(_0x27efe0['length']===0x1){return _0x2ab1e4['id'];}else{var _0xcf94a0=_[_0x84c5('0x7f')](_[_0x84c5('0x35')](_0x27efe0,_0x84c5('0x80')),function(_0x234115){return _[_0x84c5('0x81')](_0x20a27c,_0x234115);});if(_0xcf94a0){return _0x2ab1e4['id'];}}}));}}return BPromise[_0x84c5('0x82')](_0x927417)[_0x84c5('0x2c')](function(_0x4f187c){_0x5a63c7=_(_0x5a63c7)[_0x84c5('0x83')](_0x4f187c)[_0x84c5('0x84')]()['value']();return db[_0x84c5('0x4a')][_0x84c5('0x50')]({'where':{'id':_0x1b17f1[_0x84c5('0x59')]['id']}})[_0x84c5('0x2c')](function(_0x136b1b){return db[_0x84c5('0x7c')][_0x84c5('0x85')](function(_0x1b80cf){return _0x136b1b['removeTeams'](_0x1b17f1[_0x84c5('0x39')][_0x84c5('0x86')],{'transaction':_0x1b80cf})['then'](function(){if(!_['isEmpty'](_0x5a63c7)){return _0x136b1b[_0x84c5('0x87')](_0x5a63c7,{'transaction':_0x1b80cf});}})[_0x84c5('0x2c')](function(){_0x5a63c7['forEach'](function(_0x2914fe){socket[_0x84c5('0x71')]('userMailQueue:remove',{'UserId':_0x2914fe,'MailQueueId':_0x136b1b['id']});});});});});});})['then'](respondWithStatusCode(_0xa77130,null))[_0x84c5('0x4d')](handleError(_0xa77130,null));};exports['addAgents']=function(_0x7baf7f,_0xf695b2,_0x514a18){return db[_0x84c5('0x4a')][_0x84c5('0x50')]({'where':{'id':_0x7baf7f[_0x84c5('0x59')]['id']}})[_0x84c5('0x2c')](handleEntityNotFound(_0xf695b2,null))[_0x84c5('0x2c')](function(_0x12cd11){if(_0x12cd11){return _0x12cd11['addAgents'](_0x7baf7f[_0x84c5('0x52')][_0x84c5('0x86')],_[_0x84c5('0x88')](_0x7baf7f[_0x84c5('0x52')],[_0x84c5('0x86'),'id'])||{})['spread'](function(_0x3d14e2){for(var _0x58a83b=0x0;_0x58a83b<_0x7baf7f[_0x84c5('0x52')][_0x84c5('0x86')][_0x84c5('0x3e')];_0x58a83b+=0x1){socket['emit'](_0x84c5('0x72'),{'UserId':Number(_0x7baf7f[_0x84c5('0x52')][_0x84c5('0x86')][_0x58a83b]),'MailQueueId':Number(_0x7baf7f[_0x84c5('0x59')]['id'])});}return _0x3d14e2;});}})['then'](respondWithResult(_0xf695b2,null))[_0x84c5('0x4d')](handleError(_0xf695b2,null));};exports[_0x84c5('0x87')]=function(_0x36195d,_0x29cd5d,_0x17a369){return db[_0x84c5('0x4a')][_0x84c5('0x50')]({'where':{'id':_0x36195d['params']['id']}})[_0x84c5('0x2c')](handleEntityNotFound(_0x29cd5d,null))[_0x84c5('0x2c')](function(_0x48d5ed){if(_0x48d5ed){return _0x48d5ed['removeAgents'](_0x36195d['query']['ids'])['then'](function(){if(_[_0x84c5('0x89')](_0x36195d[_0x84c5('0x39')][_0x84c5('0x86')])){for(var _0x128cca=0x0;_0x128cca<_0x36195d[_0x84c5('0x39')][_0x84c5('0x86')][_0x84c5('0x3e')];_0x128cca+=0x1){socket['emit'](_0x84c5('0x8a'),{'UserId':Number(_0x36195d[_0x84c5('0x39')][_0x84c5('0x86')][_0x128cca]),'MailQueueId':Number(_0x36195d[_0x84c5('0x59')]['id'])});}}else{socket[_0x84c5('0x71')](_0x84c5('0x8a'),{'UserId':Number(_0x36195d['query'][_0x84c5('0x86')]),'MailQueueId':Number(_0x36195d['params']['id'])});}});}})[_0x84c5('0x2c')](respondWithStatusCode(_0x29cd5d,null))['catch'](handleError(_0x29cd5d,null));};exports[_0x84c5('0x8b')]=function(_0xdea02,_0x3bfade,_0x2698af){var _0x125b8f={};var _0x16c932={};var _0x2d94c2;var _0x3fd345;return db['MailQueue'][_0x84c5('0x5c')]({'where':{'id':_0xdea02['params']['id']}})[_0x84c5('0x2c')](handleEntityNotFound(_0x3bfade,null))['then'](function(_0x3d6af1){if(_0x3d6af1){_0x2d94c2=_0x3d6af1;_0x16c932[_0x84c5('0x38')]=_[_0x84c5('0x3a')](db[_0x84c5('0x5f')][_0x84c5('0x4e')]);_0x16c932['query']=_[_0x84c5('0x3a')](_0xdea02[_0x84c5('0x39')]);_0x16c932[_0x84c5('0x44')]=_[_0x84c5('0x3b')](_0x16c932[_0x84c5('0x38')],_0x16c932['query']);_0x125b8f[_0x84c5('0x3c')]=_[_0x84c5('0x3b')](_0x16c932['model'],qs[_0x84c5('0x3d')](_0xdea02[_0x84c5('0x39')][_0x84c5('0x3d')]));_0x125b8f[_0x84c5('0x3c')]=_0x125b8f['attributes'][_0x84c5('0x3e')]?_0x125b8f[_0x84c5('0x3c')]:_0x16c932[_0x84c5('0x38')];_0x125b8f['order']=qs[_0x84c5('0x42')](_0xdea02['query'][_0x84c5('0x42')]);_0x125b8f[_0x84c5('0x43')]=qs[_0x84c5('0x44')](_[_0x84c5('0x45')](_0xdea02[_0x84c5('0x39')],_0x16c932[_0x84c5('0x44')]));if(_0xdea02['query'][_0x84c5('0x46')]){_0x125b8f['where']=_[_0x84c5('0x48')](_0x125b8f[_0x84c5('0x43')],{'$or':_[_0x84c5('0x35')](_0x125b8f[_0x84c5('0x3c')],function(_0x120c42){var _0x52e739={};_0x52e739[_0x120c42]={'$like':'%'+_0xdea02[_0x84c5('0x39')]['filter']+'%'};return _0x52e739;})});}_0x125b8f=_[_0x84c5('0x48')]({},_0x125b8f,_0xdea02[_0x84c5('0x49')]);return _0x2d94c2[_0x84c5('0x8b')](_0x125b8f);}})['then'](function(_0x3bfdf3){if(_0x3bfdf3){_0x3fd345=_0x3bfdf3['length'];if(!_0xdea02[_0x84c5('0x39')][_0x84c5('0x3f')](_0x84c5('0x40'))){_0x125b8f['limit']=qs[_0x84c5('0x24')](_0xdea02[_0x84c5('0x39')][_0x84c5('0x24')]);_0x125b8f[_0x84c5('0x22')]=qs[_0x84c5('0x22')](_0xdea02[_0x84c5('0x39')][_0x84c5('0x22')]);}return _0x2d94c2[_0x84c5('0x8b')](_0x125b8f);}})[_0x84c5('0x2c')](function(_0x10180e){if(_0x10180e){return _0x10180e?{'count':_0x3fd345,'rows':_0x10180e}:null;}})[_0x84c5('0x2c')](respondWithResult(_0x3bfade,null))['catch'](handleError(_0x3bfade,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 92a4cea..b81e03e 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 _0xf187=['hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','update','remove','emit'];(function(_0x17b5e7,_0x258568){var _0x592a56=function(_0x4c67d9){while(--_0x4c67d9){_0x17b5e7['push'](_0x17b5e7['shift']());}};_0x592a56(++_0x258568);}(_0xf187,0x1cf));var _0x7f18=function(_0x3f81db,_0x44c0b6){_0x3f81db=_0x3f81db-0x0;var _0x546d56=_0xf187[_0x3f81db];return _0x546d56;};'use strict';var EventEmitter=require(_0x7f18('0x0'));var MailQueue=require(_0x7f18('0x1'))['db'][_0x7f18('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7f18('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f18('0x4'),'afterDestroy':_0x7f18('0x5')};function emitEvent(_0x2d5900){return function(_0x438634,_0x29d9c3,_0x17a468){MailQueueEvents[_0x7f18('0x6')](_0x2d5900+':'+_0x438634['id'],_0x438634);MailQueueEvents[_0x7f18('0x6')](_0x2d5900,_0x438634);_0x17a468(null);};}for(var e in events){if(events[_0x7f18('0x7')](e)){var event=events[e];MailQueue[_0x7f18('0x8')](e,emitEvent(event));}}module[_0x7f18('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xee49=['remove','emit','hasOwnProperty','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x4af55d,_0x490df6){var _0x1661e1=function(_0x262d85){while(--_0x262d85){_0x4af55d['push'](_0x4af55d['shift']());}};_0x1661e1(++_0x490df6);}(_0xee49,0x19b));var _0x9ee4=function(_0x5db97a,_0xa8499d){_0x5db97a=_0x5db97a-0x0;var _0x4ca6a0=_0xee49[_0x5db97a];return _0x4ca6a0;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x9ee4('0x0'))['db'][_0x9ee4('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9ee4('0x2')](0x0);var events={'afterCreate':_0x9ee4('0x3'),'afterUpdate':_0x9ee4('0x4'),'afterDestroy':_0x9ee4('0x5')};function emitEvent(_0xe1b193){return function(_0x138d6b,_0x433c7e,_0x3d1223){MailQueueEvents[_0x9ee4('0x6')](_0xe1b193+':'+_0x138d6b['id'],_0x138d6b);MailQueueEvents[_0x9ee4('0x6')](_0xe1b193,_0x138d6b);_0x3d1223(null);};}for(var e in events){if(events[_0x9ee4('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5a678a4..62c7cb3 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 _0x7725=['./mailQueue.attributes','exports','define','MailQueue','mail_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7725,0x1c8));var _0x5772=function(_0x1fb4a0,_0x48a602){_0x1fb4a0=_0x1fb4a0-0x0;var _0x1094e7=_0x7725[_0x1fb4a0];return _0x1094e7;};'use strict';var _=require('lodash');var util=require(_0x5772('0x0'));var logger=require(_0x5772('0x1'))(_0x5772('0x2'));var moment=require(_0x5772('0x3'));var BPromise=require('bluebird');var rp=require(_0x5772('0x4'));var fs=require('fs');var path=require(_0x5772('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5772('0x6'));module[_0x5772('0x7')]=function(_0xbd77b1,_0x38394e){return _0xbd77b1[_0x5772('0x8')](_0x5772('0x9'),attributes,{'tableName':_0x5772('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e68=['../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x414a33,_0x5bf179){var _0x1922bd=function(_0xa5ca9c){while(--_0xa5ca9c){_0x414a33['push'](_0x414a33['shift']());}};_0x1922bd(++_0x5bf179);}(_0x5e68,0x1a7));var _0x85e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5e68[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85e6('0x0'))(_0x85e6('0x1'));var moment=require(_0x85e6('0x2'));var BPromise=require(_0x85e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85e6('0x4'));var rimraf=require(_0x85e6('0x5'));var config=require(_0x85e6('0x6'));var attributes=require(_0x85e6('0x7'));module['exports']=function(_0x411d1f,_0x1a3bf1){return _0x411d1f[_0x85e6('0x8')](_0x85e6('0x9'),attributes,{'tableName':_0x85e6('0xa'),'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 8bcfd54..2aab450 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 _0x38d0=['findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue'];(function(_0x4d646c,_0x3e6875){var _0x2e4fa7=function(_0x340056){while(--_0x340056){_0x4d646c['push'](_0x4d646c['shift']());}};_0x2e4fa7(++_0x3e6875);}(_0x38d0,0x123));var _0x038d=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x38d0[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require(_0x038d('0x0'));var moment=require(_0x038d('0x1'));var BPromise=require(_0x038d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x038d('0x3'));var db=require(_0x038d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x038d('0x5'));var config=require('../../config/environment');var jayson=require(_0x038d('0x6'));var client=jayson[_0x038d('0x7')]['http']({'port':0x232a});config[_0x038d('0x8')]=_[_0x038d('0x9')](config[_0x038d('0x8')],{'host':_0x038d('0xa'),'port':0x18eb});var socket=require(_0x038d('0xb'))(new Redis(config[_0x038d('0x8')]));require(_0x038d('0xc'))[_0x038d('0xd')](socket);function respondWithRpcPromise(_0x4689dc,_0xd38e5e,_0xf2147f){return new BPromise(function(_0x41ffe0,_0x56ba0e){return client[_0x038d('0xe')](_0x4689dc,_0xf2147f)[_0x038d('0xf')](function(_0xa2b719){logger['info'](_0x038d('0x10'),_0xd38e5e,_0x038d('0x11'));logger[_0x038d('0x12')](_0x038d('0x13'),_0xd38e5e,_0x038d('0x11'),JSON[_0x038d('0x14')](_0xa2b719));if(_0xa2b719[_0x038d('0x15')]){if(_0xa2b719[_0x038d('0x15')][_0x038d('0x16')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0xd38e5e,_0xa2b719['error'][_0x038d('0x17')]);return _0x56ba0e(_0xa2b719[_0x038d('0x15')]['message']);}logger['error']('MailQueue,\x20%s,\x20%s',_0xd38e5e,_0xa2b719['error'][_0x038d('0x17')]);return _0x41ffe0(_0xa2b719[_0x038d('0x15')][_0x038d('0x17')]);}else{logger[_0x038d('0x18')](_0x038d('0x10'),_0xd38e5e,_0x038d('0x11'));_0x41ffe0(_0xa2b719[_0x038d('0x19')][_0x038d('0x17')]);}})[_0x038d('0x1a')](function(_0x46a9c2){logger[_0x038d('0x15')](_0x038d('0x10'),_0xd38e5e,_0x46a9c2);_0x56ba0e(_0x46a9c2);});});}exports[_0x038d('0x1b')]=function(_0x34206d){var _0x5b590b=this;return new Promise(function(_0x5a1bc8,_0x42b6af){return db[_0x038d('0x1c')][_0x038d('0x1d')]({'raw':_0x34206d[_0x038d('0x1e')]?_0x34206d[_0x038d('0x1e')][_0x038d('0x1f')]===undefined?!![]:![]:!![],'where':_0x34206d[_0x038d('0x1e')]?_0x34206d['options'][_0x038d('0x20')]||null:null,'attributes':_0x34206d['options']?_0x34206d[_0x038d('0x1e')][_0x038d('0x21')]||null:null,'limit':_0x34206d['options']?_0x34206d[_0x038d('0x1e')][_0x038d('0x22')]||null:null,'include':_0x34206d[_0x038d('0x1e')]?_0x34206d[_0x038d('0x1e')][_0x038d('0x23')]?_['map'](_0x34206d[_0x038d('0x1e')][_0x038d('0x23')],function(_0x1dc3f3){return{'model':db[_0x1dc3f3['model']],'as':_0x1dc3f3['as'],'attributes':_0x1dc3f3['attributes'],'include':_0x1dc3f3['include']?_[_0x038d('0x24')](_0x1dc3f3[_0x038d('0x23')],function(_0x15babc){return{'model':db[_0x15babc[_0x038d('0x25')]],'as':_0x15babc['as'],'attributes':_0x15babc[_0x038d('0x21')],'include':_0x15babc[_0x038d('0x23')]?_[_0x038d('0x24')](_0x15babc['include'],function(_0x5044db){return{'model':db[_0x5044db[_0x038d('0x25')]],'as':_0x5044db['as'],'attributes':_0x5044db[_0x038d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x038d('0xf')](function(_0x56df41){logger[_0x038d('0x18')](_0x038d('0x1b'),_0x34206d);logger['debug']('GetMailQueue',_0x34206d,JSON[_0x038d('0x14')](_0x56df41));_0x5a1bc8(_0x56df41);})[_0x038d('0x1a')](function(_0x1af389){logger[_0x038d('0x15')]('GetMailQueue',_0x1af389[_0x038d('0x17')],_0x34206d);_0x42b6af(_0x5b590b['error'](0x1f4,_0x1af389[_0x038d('0x17')]));});});};exports[_0x038d('0x26')]=function(_0x53e114){var _0x217ab6=this;return new Promise(function(_0x412c6a,_0x22911b){return db['MailQueue'][_0x038d('0x27')]({'raw':_0x53e114[_0x038d('0x1e')]?_0x53e114['options'][_0x038d('0x1f')]===undefined?!![]:![]:!![],'where':_0x53e114[_0x038d('0x1e')]?_0x53e114[_0x038d('0x1e')]['where']||null:null,'attributes':_0x53e114[_0x038d('0x1e')]?_0x53e114[_0x038d('0x1e')][_0x038d('0x21')]||null:null,'include':_0x53e114[_0x038d('0x1e')]?_0x53e114['options'][_0x038d('0x23')]?_[_0x038d('0x24')](_0x53e114[_0x038d('0x1e')][_0x038d('0x23')],function(_0x27da2b){return{'model':db[_0x27da2b['model']],'as':_0x27da2b['as'],'attributes':_0x27da2b[_0x038d('0x21')],'include':_0x27da2b[_0x038d('0x23')]?_[_0x038d('0x24')](_0x27da2b[_0x038d('0x23')],function(_0x5e99fd){return{'model':db[_0x5e99fd[_0x038d('0x25')]],'as':_0x5e99fd['as'],'attributes':_0x5e99fd[_0x038d('0x21')],'include':_0x5e99fd[_0x038d('0x23')]?_[_0x038d('0x24')](_0x5e99fd['include'],function(_0x2cf043){return{'model':db[_0x2cf043[_0x038d('0x25')]],'as':_0x2cf043['as'],'attributes':_0x2cf043['attributes']};}):[]};}):[]};}):[]:[]})[_0x038d('0xf')](function(_0x572ac8){logger[_0x038d('0x18')](_0x038d('0x26'),_0x53e114);logger['debug']('ShowMailQueue',_0x53e114,JSON['stringify'](_0x572ac8));_0x412c6a(_0x572ac8);})[_0x038d('0x1a')](function(_0x16f4b2){logger[_0x038d('0x15')]('ShowMailQueue',_0x16f4b2['message'],_0x53e114);_0x22911b(_0x217ab6['error'](0x1f4,_0x16f4b2[_0x038d('0x17')]));});});}; \ No newline at end of file +var _0xa7af=['info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailQueue','options','raw','where','attributes','limit','include','map','model','then','stringify','ShowMailQueue','MailQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request'];(function(_0x25dbcb,_0x40eb18){var _0x329d76=function(_0x7c38ea){while(--_0x7c38ea){_0x25dbcb['push'](_0x25dbcb['shift']());}};_0x329d76(++_0x40eb18);}(_0xa7af,0x6a));var _0xfa7a=function(_0x4c6dbd,_0x4d7158){_0x4c6dbd=_0x4c6dbd-0x0;var _0x27c438=_0xa7af[_0x4c6dbd];return _0x27c438;};'use strict';var _=require(_0xfa7a('0x0'));var util=require(_0xfa7a('0x1'));var moment=require('moment');var BPromise=require(_0xfa7a('0x2'));var rs=require(_0xfa7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa7a('0x4'))['db'];var utils=require(_0xfa7a('0x5'));var logger=require(_0xfa7a('0x6'))('rpc');var config=require(_0xfa7a('0x7'));var jayson=require(_0xfa7a('0x8'));var client=jayson[_0xfa7a('0x9')][_0xfa7a('0xa')]({'port':0x232a});config[_0xfa7a('0xb')]=_['defaults'](config[_0xfa7a('0xb')],{'host':_0xfa7a('0xc'),'port':0x18eb});var socket=require(_0xfa7a('0xd'))(new Redis(config[_0xfa7a('0xb')]));require(_0xfa7a('0xe'))[_0xfa7a('0xf')](socket);function respondWithRpcPromise(_0x3bf862,_0x5f2671,_0x5abe45){return new BPromise(function(_0x264623,_0x5274a1){return client[_0xfa7a('0x10')](_0x3bf862,_0x5abe45)['then'](function(_0x23310a){logger[_0xfa7a('0x11')](_0xfa7a('0x12'),_0x5f2671,_0xfa7a('0x13'));logger[_0xfa7a('0x14')](_0xfa7a('0x15'),_0x5f2671,_0xfa7a('0x13'),JSON['stringify'](_0x23310a));if(_0x23310a[_0xfa7a('0x16')]){if(_0x23310a['error'][_0xfa7a('0x17')]===0x1f4){logger[_0xfa7a('0x16')](_0xfa7a('0x12'),_0x5f2671,_0x23310a[_0xfa7a('0x16')][_0xfa7a('0x18')]);return _0x5274a1(_0x23310a['error'][_0xfa7a('0x18')]);}logger[_0xfa7a('0x16')](_0xfa7a('0x12'),_0x5f2671,_0x23310a[_0xfa7a('0x16')][_0xfa7a('0x18')]);return _0x264623(_0x23310a[_0xfa7a('0x16')]['message']);}else{logger['info'](_0xfa7a('0x12'),_0x5f2671,'request\x20sent');_0x264623(_0x23310a[_0xfa7a('0x19')]['message']);}})[_0xfa7a('0x1a')](function(_0x5c63d7){logger[_0xfa7a('0x16')](_0xfa7a('0x12'),_0x5f2671,_0x5c63d7);_0x5274a1(_0x5c63d7);});});}exports[_0xfa7a('0x1b')]=function(_0x1bfe48){var _0x32cc62=this;return new Promise(function(_0x19e5ec,_0x80fda3){return db['MailQueue']['findAll']({'raw':_0x1bfe48['options']?_0x1bfe48[_0xfa7a('0x1c')][_0xfa7a('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bfe48[_0xfa7a('0x1c')]?_0x1bfe48[_0xfa7a('0x1c')][_0xfa7a('0x1e')]||null:null,'attributes':_0x1bfe48[_0xfa7a('0x1c')]?_0x1bfe48[_0xfa7a('0x1c')][_0xfa7a('0x1f')]||null:null,'limit':_0x1bfe48[_0xfa7a('0x1c')]?_0x1bfe48[_0xfa7a('0x1c')][_0xfa7a('0x20')]||null:null,'include':_0x1bfe48['options']?_0x1bfe48['options'][_0xfa7a('0x21')]?_[_0xfa7a('0x22')](_0x1bfe48[_0xfa7a('0x1c')]['include'],function(_0x5067e5){return{'model':db[_0x5067e5['model']],'as':_0x5067e5['as'],'attributes':_0x5067e5['attributes'],'include':_0x5067e5[_0xfa7a('0x21')]?_[_0xfa7a('0x22')](_0x5067e5[_0xfa7a('0x21')],function(_0x557358){return{'model':db[_0x557358[_0xfa7a('0x23')]],'as':_0x557358['as'],'attributes':_0x557358[_0xfa7a('0x1f')],'include':_0x557358[_0xfa7a('0x21')]?_[_0xfa7a('0x22')](_0x557358[_0xfa7a('0x21')],function(_0x2250e3){return{'model':db[_0x2250e3['model']],'as':_0x2250e3['as'],'attributes':_0x2250e3[_0xfa7a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfa7a('0x24')](function(_0x4a10f5){logger['info'](_0xfa7a('0x1b'),_0x1bfe48);logger[_0xfa7a('0x14')](_0xfa7a('0x1b'),_0x1bfe48,JSON[_0xfa7a('0x25')](_0x4a10f5));_0x19e5ec(_0x4a10f5);})[_0xfa7a('0x1a')](function(_0x5131cb){logger['error'](_0xfa7a('0x1b'),_0x5131cb[_0xfa7a('0x18')],_0x1bfe48);_0x80fda3(_0x32cc62['error'](0x1f4,_0x5131cb[_0xfa7a('0x18')]));});});};exports[_0xfa7a('0x26')]=function(_0x482b11){var _0x46461d=this;return new Promise(function(_0x1309d1,_0x480acc){return db[_0xfa7a('0x27')][_0xfa7a('0x28')]({'raw':_0x482b11[_0xfa7a('0x1c')]?_0x482b11[_0xfa7a('0x1c')][_0xfa7a('0x1d')]===undefined?!![]:![]:!![],'where':_0x482b11[_0xfa7a('0x1c')]?_0x482b11[_0xfa7a('0x1c')][_0xfa7a('0x1e')]||null:null,'attributes':_0x482b11[_0xfa7a('0x1c')]?_0x482b11[_0xfa7a('0x1c')][_0xfa7a('0x1f')]||null:null,'include':_0x482b11['options']?_0x482b11['options'][_0xfa7a('0x21')]?_[_0xfa7a('0x22')](_0x482b11[_0xfa7a('0x1c')][_0xfa7a('0x21')],function(_0x3ce08f){return{'model':db[_0x3ce08f[_0xfa7a('0x23')]],'as':_0x3ce08f['as'],'attributes':_0x3ce08f[_0xfa7a('0x1f')],'include':_0x3ce08f[_0xfa7a('0x21')]?_['map'](_0x3ce08f['include'],function(_0x97e10){return{'model':db[_0x97e10['model']],'as':_0x97e10['as'],'attributes':_0x97e10['attributes'],'include':_0x97e10[_0xfa7a('0x21')]?_[_0xfa7a('0x22')](_0x97e10[_0xfa7a('0x21')],function(_0x59f7d9){return{'model':db[_0x59f7d9['model']],'as':_0x59f7d9['as'],'attributes':_0x59f7d9[_0xfa7a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfa7a('0x24')](function(_0x234d99){logger[_0xfa7a('0x11')](_0xfa7a('0x26'),_0x482b11);logger['debug'](_0xfa7a('0x26'),_0x482b11,JSON['stringify'](_0x234d99));_0x1309d1(_0x234d99);})['catch'](function(_0x5d688a){logger[_0xfa7a('0x16')](_0xfa7a('0x26'),_0x5d688a['message'],_0x482b11);_0x480acc(_0x46461d['error'](0x1f4,_0x5d688a[_0xfa7a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 82e18db..89675c0 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 _0x2455=['register','./mailQueue.events','save','remove','update','removeListener'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x2455,0xd3));var _0x5245=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x2455[_0x1e7b16];return _0x37fadc;};'use strict';var MailQueueEvents=require(_0x5245('0x0'));var events=[_0x5245('0x1'),_0x5245('0x2'),_0x5245('0x3')];function createListener(_0x1f4446,_0x557700){return function(_0x5d7f64){_0x557700['emit'](_0x1f4446,_0x5d7f64);};}function removeListener(_0x3f1460,_0x1a162c){return function(){MailQueueEvents[_0x5245('0x4')](_0x3f1460,_0x1a162c);};}exports[_0x5245('0x5')]=function(_0x2f07d5){for(var _0x663a3=0x0,_0x5e2cde=events['length'];_0x663a3<_0x5e2cde;_0x663a3++){var _0x440eed=events[_0x663a3];var _0x313ef9=createListener('mailQueue:'+_0x440eed,_0x2f07d5);MailQueueEvents['on'](_0x440eed,_0x313ef9);}}; \ No newline at end of file +var _0xc16a=['remove','update','emit','length','./mailQueue.events','save'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0xc16a,0x160));var _0xac16=function(_0x1f98d1,_0x26c469){_0x1f98d1=_0x1f98d1-0x0;var _0x555836=_0xc16a[_0x1f98d1];return _0x555836;};'use strict';var MailQueueEvents=require(_0xac16('0x0'));var events=[_0xac16('0x1'),_0xac16('0x2'),_0xac16('0x3')];function createListener(_0x149aed,_0x52c95e){return function(_0x37b514){_0x52c95e[_0xac16('0x4')](_0x149aed,_0x37b514);};}function removeListener(_0x445c77,_0x51b348){return function(){MailQueueEvents['removeListener'](_0x445c77,_0x51b348);};}exports['register']=function(_0x2de644){for(var _0xb3b293=0x0,_0x56c57d=events[_0xac16('0x5')];_0xb3b293<_0x56c57d;_0xb3b293++){var _0x2778ec=events[_0xb3b293];var _0x14d622=createListener('mailQueue:'+_0x2778ec,_0x2de644);MailQueueEvents['on'](_0x2778ec,_0x14d622);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 37a3fdf..6db0976 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 _0x830c=['get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index'];(function(_0x2771fc,_0x1891bc){var _0xb4744b=function(_0x4b4022){while(--_0x4b4022){_0x2771fc['push'](_0x2771fc['shift']());}};_0xb4744b(++_0x1891bc);}(_0x830c,0xac));var _0xc830=function(_0x2c0ae6,_0x494965){_0x2c0ae6=_0x2c0ae6-0x0;var _0x9e4c33=_0x830c[_0x2c0ae6];return _0x9e4c33;};'use strict';var multer=require(_0xc830('0x0'));var util=require(_0xc830('0x1'));var path=require(_0xc830('0x2'));var timeout=require(_0xc830('0x3'));var express=require(_0xc830('0x4'));var router=express[_0xc830('0x5')]();var fs_extra=require(_0xc830('0x6'));var auth=require(_0xc830('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc830('0x8'));var controller=require(_0xc830('0x9'));router['get']('/',auth[_0xc830('0xa')](),controller[_0xc830('0xb')]);router[_0xc830('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xc830('0xd')]);router[_0xc830('0xc')](_0xc830('0xe'),auth[_0xc830('0xa')](),controller[_0xc830('0xf')]);router[_0xc830('0x10')]('/',auth[_0xc830('0xa')](),controller[_0xc830('0x11')]);router[_0xc830('0x12')](_0xc830('0xe'),auth[_0xc830('0xa')](),controller[_0xc830('0x13')]);router[_0xc830('0x14')](_0xc830('0xe'),auth['isAuthenticated'](),controller[_0xc830('0x15')]);module[_0xc830('0x16')]=router; \ No newline at end of file +var _0xed63=['/describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','./mailQueueReport.controller','isAuthenticated','index','get'];(function(_0x33958e,_0x85f033){var _0x17e8af=function(_0xc8931f){while(--_0xc8931f){_0x33958e['push'](_0x33958e['shift']());}};_0x17e8af(++_0x85f033);}(_0xed63,0xf8));var _0x3ed6=function(_0x12054c,_0x21d259){_0x12054c=_0x12054c-0x0;var _0x48f94e=_0xed63[_0x12054c];return _0x48f94e;};'use strict';var multer=require('multer');var util=require(_0x3ed6('0x0'));var path=require(_0x3ed6('0x1'));var timeout=require(_0x3ed6('0x2'));var express=require(_0x3ed6('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('../../config/environment');var controller=require(_0x3ed6('0x4'));router['get']('/',auth[_0x3ed6('0x5')](),controller[_0x3ed6('0x6')]);router[_0x3ed6('0x7')](_0x3ed6('0x8'),auth[_0x3ed6('0x5')](),controller['describe']);router[_0x3ed6('0x7')](_0x3ed6('0x9'),auth[_0x3ed6('0x5')](),controller[_0x3ed6('0xa')]);router['post']('/',auth[_0x3ed6('0x5')](),controller[_0x3ed6('0xb')]);router[_0x3ed6('0xc')]('/:id',auth[_0x3ed6('0x5')](),controller['update']);router[_0x3ed6('0xd')]('/:id',auth[_0x3ed6('0x5')](),controller[_0x3ed6('0xe')]);module[_0x3ed6('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c074994..fa51dac 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 _0xb410=['exports','DATE','STRING','moment','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb410,0x8f));var _0x0b41=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xb410[_0x1646fa];return _0x5a47a5;};'use strict';var moment=require(_0x0b41('0x0'));var Sequelize=require(_0x0b41('0x1'));module[_0x0b41('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0b41('0x3')]},'leaveAt':{'type':Sequelize[_0x0b41('0x3')]},'acceptAt':{'type':Sequelize[_0x0b41('0x3')]},'exitAt':{'type':Sequelize[_0x0b41('0x3')]},'reason':{'type':Sequelize[_0x0b41('0x4')]}}; \ No newline at end of file +var _0x5282=['DATE','moment','exports','STRING'];(function(_0x3d85b2,_0x546af8){var _0x482cc8=function(_0x4f7ca3){while(--_0x4f7ca3){_0x3d85b2['push'](_0x3d85b2['shift']());}};_0x482cc8(++_0x546af8);}(_0x5282,0x111));var _0x2528=function(_0x10a904,_0x2bf292){_0x10a904=_0x10a904-0x0;var _0x53815a=_0x5282[_0x10a904];return _0x53815a;};'use strict';var moment=require(_0x2528('0x0'));var Sequelize=require('sequelize');module[_0x2528('0x1')]={'uniqueid':{'type':Sequelize[_0x2528('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2528('0x2')]},'joinAt':{'type':Sequelize[_0x2528('0x3')]},'leaveAt':{'type':Sequelize[_0x2528('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2528('0x3')]},'reason':{'type':Sequelize[_0x2528('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f35a725..5b8ff8e 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 _0xcaf2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x1a522f,_0x172efe){var _0x2aa18c=function(_0x136bc5){while(--_0x136bc5){_0x1a522f['push'](_0x1a522f['shift']());}};_0x2aa18c(++_0x172efe);}(_0xcaf2,0x8a));var _0x2caf=function(_0x1c3281,_0x5c69a0){_0x1c3281=_0x1c3281-0x0;var _0x27588d=_0xcaf2[_0x1c3281];return _0x27588d;};'use strict';var emlformat=require(_0x2caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2caf('0x1'));var jsonpatch=require(_0x2caf('0x2'));var rp=require('request-promise');var moment=require(_0x2caf('0x3'));var BPromise=require(_0x2caf('0x4'));var Mustache=require('mustache');var util=require(_0x2caf('0x5'));var path=require('path');var sox=require(_0x2caf('0x6'));var csv=require(_0x2caf('0x7'));var ejs=require(_0x2caf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2caf('0x9'));var squel=require(_0x2caf('0xa'));var crypto=require(_0x2caf('0xb'));var jsforce=require(_0x2caf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2caf('0x7'));var querystring=require(_0x2caf('0xd'));var Papa=require(_0x2caf('0xe'));var Redis=require(_0x2caf('0xf'));var authService=require(_0x2caf('0x10'));var qs=require(_0x2caf('0x11'));var as=require(_0x2caf('0x12'));var hardwareService=require(_0x2caf('0x13'));var logger=require(_0x2caf('0x14'))('api');var utils=require(_0x2caf('0x15'));var config=require(_0x2caf('0x16'));var licenseUtil=require(_0x2caf('0x17'));var db=require(_0x2caf('0x18'))['db'];function respondWithStatusCode(_0x1dda08,_0x31c0e7){_0x31c0e7=_0x31c0e7||0xcc;return function(_0x252147){if(_0x252147){return _0x1dda08[_0x2caf('0x19')](_0x31c0e7);}return _0x1dda08['status'](_0x31c0e7)[_0x2caf('0x1a')]();};}function respondWithResult(_0xec8192,_0x502033){_0x502033=_0x502033||0xc8;return function(_0x4c47b8){if(_0x4c47b8){return _0xec8192['status'](_0x502033)[_0x2caf('0x1b')](_0x4c47b8);}};}function respondWithFilteredResult(_0x4da5ba,_0x388e05){return function(_0xa75896){if(_0xa75896){var _0x3b8b67=typeof _0x388e05[_0x2caf('0x1c')]==='undefined'&&typeof _0x388e05[_0x2caf('0x1d')]==='undefined';var _0x2d5b64=_0xa75896['count'];var _0x4a33fc=_0x3b8b67?0x0:_0x388e05[_0x2caf('0x1c')];var _0x58047b=_0x3b8b67?_0xa75896[_0x2caf('0x1e')]:_0x388e05[_0x2caf('0x1c')]+_0x388e05['limit'];var _0x12624b;if(_0x58047b>=_0x2d5b64){_0x58047b=_0x2d5b64;_0x12624b=0xc8;}else{_0x12624b=0xce;}_0x4da5ba[_0x2caf('0x1f')](_0x12624b);return _0x4da5ba[_0x2caf('0x20')](_0x2caf('0x21'),_0x4a33fc+'-'+_0x58047b+'/'+_0x2d5b64)[_0x2caf('0x1b')](_0xa75896);}return null;};}function patchUpdates(_0x595f2f){return function(_0xfa426f){try{jsonpatch[_0x2caf('0x22')](_0xfa426f,_0x595f2f,!![]);}catch(_0x2b4d16){return BPromise[_0x2caf('0x23')](_0x2b4d16);}return _0xfa426f[_0x2caf('0x24')]();};}function saveUpdates(_0x9d6bae,_0x4092ba){return function(_0x256cc4){if(_0x256cc4){return _0x256cc4[_0x2caf('0x25')](_0x9d6bae)[_0x2caf('0x26')](function(_0x6814bc){return _0x6814bc;});}return null;};}function removeEntity(_0x5231fc,_0x296305){return function(_0x14bfd2){if(_0x14bfd2){return _0x14bfd2[_0x2caf('0x27')]()[_0x2caf('0x26')](function(){_0x5231fc[_0x2caf('0x1f')](0xcc)[_0x2caf('0x1a')]();});}};}function handleEntityNotFound(_0x392196,_0x164da){return function(_0x2e0a75){if(!_0x2e0a75){_0x392196[_0x2caf('0x19')](0x194);}return _0x2e0a75;};}function handleError(_0x5ad211,_0x6a32ac){_0x6a32ac=_0x6a32ac||0x1f4;return function(_0x325eda){logger[_0x2caf('0x28')](_0x325eda[_0x2caf('0x29')]);if(_0x325eda[_0x2caf('0x2a')]){delete _0x325eda[_0x2caf('0x2a')];}_0x5ad211[_0x2caf('0x1f')](_0x6a32ac)[_0x2caf('0x2b')](_0x325eda);};}exports[_0x2caf('0x2c')]=function(_0x2304f1,_0x30da75){var _0x1f477={},_0x158d60={},_0x48b5f7={'count':0x0,'rows':[]};var _0xb944cc=_[_0x2caf('0x2d')](db[_0x2caf('0x2e')][_0x2caf('0x2f')],function(_0xa8523b){return{'name':_0xa8523b[_0x2caf('0x30')],'type':_0xa8523b[_0x2caf('0x31')]['key']};});_0x158d60[_0x2caf('0x32')]=_[_0x2caf('0x2d')](_0xb944cc,'name');_0x158d60[_0x2caf('0x33')]=_[_0x2caf('0x34')](_0x2304f1[_0x2caf('0x33')]);_0x158d60['filters']=_[_0x2caf('0x35')](_0x158d60['model'],_0x158d60['query']);_0x1f477[_0x2caf('0x36')]=_[_0x2caf('0x35')](_0x158d60[_0x2caf('0x32')],qs[_0x2caf('0x37')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1f477[_0x2caf('0x36')]=_0x1f477[_0x2caf('0x36')][_0x2caf('0x38')]?_0x1f477['attributes']:_0x158d60[_0x2caf('0x32')];if(!_0x2304f1[_0x2caf('0x33')][_0x2caf('0x39')](_0x2caf('0x3a'))){_0x1f477[_0x2caf('0x1d')]=qs[_0x2caf('0x1d')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x1d')]);_0x1f477[_0x2caf('0x1c')]=qs[_0x2caf('0x1c')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x1c')]);}_0x1f477['order']=qs['sort'](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3b')]);_0x1f477[_0x2caf('0x3c')]=qs[_0x2caf('0x3d')](_['pick'](_0x2304f1[_0x2caf('0x33')],_0x158d60[_0x2caf('0x3d')]),_0xb944cc);if(_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3e')]){_0x1f477[_0x2caf('0x3c')]=_[_0x2caf('0x3f')](_0x1f477[_0x2caf('0x3c')],{'$or':_[_0x2caf('0x2d')](_0xb944cc,function(_0x5c133c){if(_0x5c133c['type']!==_0x2caf('0x40')){var _0x863fca={};_0x863fca[_0x5c133c[_0x2caf('0x2a')]]={'$like':'%'+_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3e')]+'%'};return _0x863fca;}})});}_0x1f477=_[_0x2caf('0x3f')]({},_0x1f477,_0x2304f1[_0x2caf('0x41')]);var _0xf93228={'where':_0x1f477[_0x2caf('0x3c')]};return db[_0x2caf('0x2e')][_0x2caf('0x1e')](_0xf93228)['then'](function(_0x35ad7f){_0x48b5f7[_0x2caf('0x1e')]=_0x35ad7f;if(_0x2304f1[_0x2caf('0x33')]['includeAll']){_0x1f477[_0x2caf('0x42')]=[{'all':!![]}];}return db[_0x2caf('0x2e')][_0x2caf('0x43')](_0x1f477);})['then'](function(_0x40cb18){_0x48b5f7[_0x2caf('0x44')]=_0x40cb18;return _0x48b5f7;})['then'](respondWithFilteredResult(_0x30da75,_0x1f477))[_0x2caf('0x45')](handleError(_0x30da75,null));};exports[_0x2caf('0x46')]=function(_0x4e57b0,_0xe5fcbf){var _0x1348d8={'raw':!![],'where':{'id':_0x4e57b0[_0x2caf('0x47')]['id']}},_0x2e4126={};_0x2e4126[_0x2caf('0x32')]=_[_0x2caf('0x34')](db[_0x2caf('0x2e')][_0x2caf('0x2f')]);_0x2e4126['query']=_[_0x2caf('0x34')](_0x4e57b0['query']);_0x2e4126[_0x2caf('0x3d')]=_[_0x2caf('0x35')](_0x2e4126[_0x2caf('0x32')],_0x2e4126['query']);_0x1348d8['attributes']=_[_0x2caf('0x35')](_0x2e4126['model'],qs[_0x2caf('0x37')](_0x4e57b0[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1348d8[_0x2caf('0x36')]=_0x1348d8[_0x2caf('0x36')][_0x2caf('0x38')]?_0x1348d8[_0x2caf('0x36')]:_0x2e4126[_0x2caf('0x32')];if(_0x4e57b0[_0x2caf('0x33')][_0x2caf('0x48')]){_0x1348d8[_0x2caf('0x42')]=[{'all':!![]}];}_0x1348d8=_[_0x2caf('0x3f')]({},_0x1348d8,_0x4e57b0[_0x2caf('0x41')]);return db[_0x2caf('0x2e')][_0x2caf('0x49')](_0x1348d8)[_0x2caf('0x26')](handleEntityNotFound(_0xe5fcbf,null))[_0x2caf('0x26')](respondWithResult(_0xe5fcbf,null))[_0x2caf('0x45')](handleError(_0xe5fcbf,null));};exports[_0x2caf('0x4a')]=function(_0x3a598b,_0x136dc9){return db['MailQueueReport'][_0x2caf('0x4a')](_0x3a598b[_0x2caf('0x4b')],{})['then'](respondWithResult(_0x136dc9,0xc9))['catch'](handleError(_0x136dc9,null));};exports[_0x2caf('0x25')]=function(_0x6f0a2a,_0x5a822d){if(_0x6f0a2a[_0x2caf('0x4b')]['id']){delete _0x6f0a2a[_0x2caf('0x4b')]['id'];}return db[_0x2caf('0x2e')][_0x2caf('0x49')]({'where':{'id':_0x6f0a2a[_0x2caf('0x47')]['id']}})[_0x2caf('0x26')](handleEntityNotFound(_0x5a822d,null))[_0x2caf('0x26')](saveUpdates(_0x6f0a2a[_0x2caf('0x4b')],null))[_0x2caf('0x26')](respondWithResult(_0x5a822d,null))[_0x2caf('0x45')](handleError(_0x5a822d,null));};exports[_0x2caf('0x27')]=function(_0x2b318a,_0x41b7b2){return db['MailQueueReport'][_0x2caf('0x49')]({'where':{'id':_0x2b318a[_0x2caf('0x47')]['id']}})[_0x2caf('0x26')](handleEntityNotFound(_0x41b7b2,null))['then'](removeEntity(_0x41b7b2,null))[_0x2caf('0x45')](handleError(_0x41b7b2,null));};exports[_0x2caf('0x4c')]=function(_0x28d8bd,_0x20bf52){return db[_0x2caf('0x2e')][_0x2caf('0x4c')]()[_0x2caf('0x26')](respondWithResult(_0x20bf52,null))[_0x2caf('0x45')](handleError(_0x20bf52,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','MailQueueReport','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x6343,0x168));var _0x3634=function(_0x29fb30,_0x4c84bb){_0x29fb30=_0x29fb30-0x0;var _0x3d60fb=_0x6343[_0x29fb30];return _0x3d60fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['MailQueueReport'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':!![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['MailQueueReport'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 84f8b08..e61f4ee 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 _0xca65=['api','moment','bluebird','path','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0xe7bc08,_0xe404a9){var _0x4f0fce=function(_0x26b999){while(--_0x26b999){_0xe7bc08['push'](_0xe7bc08['shift']());}};_0x4f0fce(++_0xe404a9);}(_0xca65,0x1dd));var _0x5ca6=function(_0x544106,_0x449f0e){_0x544106=_0x544106-0x0;var _0x51ea19=_0xca65[_0x544106];return _0x51ea19;};'use strict';var _=require(_0x5ca6('0x0'));var util=require(_0x5ca6('0x1'));var logger=require(_0x5ca6('0x2'))(_0x5ca6('0x3'));var moment=require(_0x5ca6('0x4'));var BPromise=require(_0x5ca6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ca6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x5ca6('0x7')]=function(_0x4ae20c,_0x28b216){return _0x4ae20c[_0x5ca6('0x8')](_0x5ca6('0x9'),attributes,{'tableName':_0x5ca6('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5ca6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3376=['moment','request-promise','path','exports','MailQueueReport','uniqueid','lodash','util','api'];(function(_0x2ccc88,_0x131358){var _0x4a58fb=function(_0x2daa74){while(--_0x2daa74){_0x2ccc88['push'](_0x2ccc88['shift']());}};_0x4a58fb(++_0x131358);}(_0x3376,0xe7));var _0x6337=function(_0x3d015a,_0x3d6ecc){_0x3d015a=_0x3d015a-0x0;var _0x5d3829=_0x3376[_0x3d015a];return _0x5d3829;};'use strict';var _=require(_0x6337('0x0'));var util=require(_0x6337('0x1'));var logger=require('../../config/logger')(_0x6337('0x2'));var moment=require(_0x6337('0x3'));var BPromise=require('bluebird');var rp=require(_0x6337('0x4'));var fs=require('fs');var path=require(_0x6337('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x6337('0x6')]=function(_0x34eb0d,_0x32cef0){return _0x34eb0d['define'](_0x6337('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x6337('0x8'),'fields':[_0x6337('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e57a7d0..b384cbb 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x34b144,_0x19efcd){var _0x4b0ead=function(_0x4beb70){while(--_0x4beb70){_0x34b144['push'](_0x34b144['shift']());}};_0x4b0ead(++_0x19efcd);}(_0x5f2f,0x73));var _0xf5f2=function(_0xd14042,_0x2b5705){_0xd14042=_0xd14042-0x0;var _0x1c1112=_0x5f2f[_0xd14042];return _0x1c1112;};'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')]('MailQueueReport,\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?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ 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(_0x701566,_0x7de6cb){var _0x64b6c9=function(_0x7481f7){while(--_0x7481f7){_0x701566['push'](_0x701566['shift']());}};_0x64b6c9(++_0x7de6cb);}(_0x2ef3,0xba));var _0x32ef=function(_0x572a0a,_0x411356){_0x572a0a=_0x572a0a-0x0;var _0x3a3682=_0x2ef3[_0x572a0a];return _0x3a3682;};'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 1a0df80..828327d 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5e3139,_0x5bad26){var _0x3cdf31=function(_0x51647e){while(--_0x51647e){_0x5e3139['push'](_0x5e3139['shift']());}};_0x3cdf31(++_0x5bad26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xf4da64,_0x1d073e){var _0xb910f4=function(_0x50d1aa){while(--_0x50d1aa){_0xf4da64['push'](_0xf4da64['shift']());}};_0xb910f4(++_0x1d073e);}(_0x70e0,0x17b));var _0x070e=function(_0x5630e5,_0x22d4d1){_0x5630e5=_0x5630e5-0x0;var _0x1d3d8f=_0x70e0[_0x5630e5];return _0x1d3d8f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 9e31b88..15368a9 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 _0xa74f=['BOOLEAN','INBOX','STRING','INTEGER'];(function(_0x5a6d79,_0x4aec84){var _0x103fc0=function(_0x2f4c10){while(--_0x2f4c10){_0x5a6d79['push'](_0x5a6d79['shift']());}};_0x103fc0(++_0x4aec84);}(_0xa74f,0x9a));var _0xfa74=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0xa74f[_0x2867d8];return _0x3b8176;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xfa74('0x0')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xfa74('0x0')]},'password':{'type':Sequelize[_0xfa74('0x0')]},'port':{'type':Sequelize[_0xfa74('0x1')]},'tls':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xfa74('0x0')]}}; \ No newline at end of file +var _0xd404=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0xa57c50,_0x1c6754){var _0x2c55b4=function(_0x31122d){while(--_0x31122d){_0xa57c50['push'](_0xa57c50['shift']());}};_0x2c55b4(++_0x1c6754);}(_0xd404,0x15b));var _0x4d40=function(_0x52f0f2,_0x23e6e5){_0x52f0f2=_0x52f0f2-0x0;var _0x1d3112=_0xd404[_0x52f0f2];return _0x1d3112;};'use strict';var Sequelize=require(_0x4d40('0x0'));module[_0x4d40('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4d40('0x2')]},'authentication':{'type':Sequelize[_0x4d40('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4d40('0x2')]},'port':{'type':Sequelize[_0x4d40('0x4')]},'tls':{'type':Sequelize[_0x4d40('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4d40('0x2')],'defaultValue':_0x4d40('0x5')},'connTimeout':{'type':Sequelize[_0x4d40('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4d40('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4d40('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 96010bb..bb084fe 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 _0xff6a=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailServerIn','lodash'];(function(_0x4b81a2,_0x277d0e){var _0x25d4c4=function(_0x549ec2){while(--_0x549ec2){_0x4b81a2['push'](_0x4b81a2['shift']());}};_0x25d4c4(++_0x277d0e);}(_0xff6a,0xba));var _0xaff6=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xff6a[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xaff6('0x0'));var util=require(_0xaff6('0x1'));var logger=require(_0xaff6('0x2'))(_0xaff6('0x3'));var moment=require('moment');var BPromise=require(_0xaff6('0x4'));var rp=require(_0xaff6('0x5'));var fs=require('fs');var path=require(_0xaff6('0x6'));var rimraf=require(_0xaff6('0x7'));var config=require(_0xaff6('0x8'));var attributes=require('./mailServerIn.attributes');module[_0xaff6('0x9')]=function(_0x3b263c,_0x1edbeb){return _0x3b263c['define'](_0xaff6('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3296=['MailServerIn','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailServerIn.attributes','exports'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x3296,0xdd));var _0x6329=function(_0x5de713,_0x1c1ba1){_0x5de713=_0x5de713-0x0;var _0x1742a4=_0x3296[_0x5de713];return _0x1742a4;};'use strict';var _=require(_0x6329('0x0'));var util=require(_0x6329('0x1'));var logger=require(_0x6329('0x2'))(_0x6329('0x3'));var moment=require(_0x6329('0x4'));var BPromise=require(_0x6329('0x5'));var rp=require(_0x6329('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6329('0x7'));var config=require('../../config/environment');var attributes=require(_0x6329('0x8'));module[_0x6329('0x9')]=function(_0x4a2bed,_0x4ea955){return _0x4a2bed['define'](_0x6329('0xa'),attributes,{'tableName':'mail_servers_in','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 714e462..8e30c2d 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 _0x4c06=['client','http','request','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','info','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x59d6a4,_0x4e0691){var _0x5cf660=function(_0x3451c6){while(--_0x3451c6){_0x59d6a4['push'](_0x59d6a4['shift']());}};_0x5cf660(++_0x4e0691);}(_0x4c06,0x9a));var _0x64c0=function(_0x21e034,_0x59fc14){_0x21e034=_0x21e034-0x0;var _0x1faab3=_0x4c06[_0x21e034];return _0x1faab3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x64c0('0x0'));var rs=require(_0x64c0('0x1'));var fs=require('fs');var Redis=require(_0x64c0('0x2'));var db=require(_0x64c0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x64c0('0x4'))(_0x64c0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64c0('0x6')][_0x64c0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d8ba6,_0x47a21d,_0x311c86){return new BPromise(function(_0x36ec0d,_0x4a791b){return client[_0x64c0('0x8')](_0x2d8ba6,_0x311c86)[_0x64c0('0x9')](function(_0xa8a116){logger['info']('MailServerIn,\x20%s,\x20%s',_0x47a21d,_0x64c0('0xa'));logger[_0x64c0('0xb')](_0x64c0('0xc'),_0x47a21d,_0x64c0('0xa'),JSON[_0x64c0('0xd')](_0xa8a116));if(_0xa8a116[_0x64c0('0xe')]){if(_0xa8a116[_0x64c0('0xe')][_0x64c0('0xf')]===0x1f4){logger[_0x64c0('0xe')](_0x64c0('0x10'),_0x47a21d,_0xa8a116[_0x64c0('0xe')][_0x64c0('0x11')]);return _0x4a791b(_0xa8a116[_0x64c0('0xe')][_0x64c0('0x11')]);}logger[_0x64c0('0xe')](_0x64c0('0x10'),_0x47a21d,_0xa8a116['error'][_0x64c0('0x11')]);return _0x36ec0d(_0xa8a116[_0x64c0('0xe')][_0x64c0('0x11')]);}else{logger[_0x64c0('0x12')](_0x64c0('0x10'),_0x47a21d,'request\x20sent');_0x36ec0d(_0xa8a116[_0x64c0('0x13')][_0x64c0('0x11')]);}})[_0x64c0('0x14')](function(_0x23492c){logger[_0x64c0('0xe')](_0x64c0('0x10'),_0x47a21d,_0x23492c);_0x4a791b(_0x23492c);});});}exports['GetMailServerIn']=function(_0x47b0ab){var _0x2c62da=this;return new Promise(function(_0x2252e2,_0x421479){return db[_0x64c0('0x15')][_0x64c0('0x16')]({'raw':_0x47b0ab[_0x64c0('0x17')]?_0x47b0ab[_0x64c0('0x17')][_0x64c0('0x18')]===undefined?!![]:![]:!![],'where':_0x47b0ab[_0x64c0('0x17')]?_0x47b0ab[_0x64c0('0x17')][_0x64c0('0x19')]||null:null,'attributes':_0x47b0ab['options']?_0x47b0ab['options'][_0x64c0('0x1a')]||null:null,'limit':_0x47b0ab[_0x64c0('0x17')]?_0x47b0ab[_0x64c0('0x17')][_0x64c0('0x1b')]||null:null,'include':_0x47b0ab['options']?_0x47b0ab[_0x64c0('0x17')][_0x64c0('0x1c')]?_[_0x64c0('0x1d')](_0x47b0ab['options'][_0x64c0('0x1c')],function(_0x31317d){return{'model':db[_0x31317d['model']],'as':_0x31317d['as'],'attributes':_0x31317d[_0x64c0('0x1a')],'include':_0x31317d[_0x64c0('0x1c')]?_[_0x64c0('0x1d')](_0x31317d[_0x64c0('0x1c')],function(_0xcdb375){return{'model':db[_0xcdb375[_0x64c0('0x1e')]],'as':_0xcdb375['as'],'attributes':_0xcdb375['attributes'],'include':_0xcdb375[_0x64c0('0x1c')]?_[_0x64c0('0x1d')](_0xcdb375[_0x64c0('0x1c')],function(_0x523203){return{'model':db[_0x523203[_0x64c0('0x1e')]],'as':_0x523203['as'],'attributes':_0x523203[_0x64c0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1551fd){logger[_0x64c0('0x12')](_0x64c0('0x1f'),_0x47b0ab);logger['debug'](_0x64c0('0x1f'),_0x47b0ab,JSON['stringify'](_0x1551fd));_0x2252e2(_0x1551fd);})['catch'](function(_0x511659){logger[_0x64c0('0xe')](_0x64c0('0x1f'),_0x511659[_0x64c0('0x11')],_0x47b0ab);_0x421479(_0x2c62da['error'](0x1f4,_0x511659['message']));});});}; \ No newline at end of file +var _0x5d66=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','map','include','model','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5d66,0x109));var _0x65d6=function(_0x12fd6f,_0x44b627){_0x12fd6f=_0x12fd6f-0x0;var _0x2c4593=_0x5d66[_0x12fd6f];return _0x2c4593;};'use strict';var _=require(_0x65d6('0x0'));var util=require('util');var moment=require(_0x65d6('0x1'));var BPromise=require(_0x65d6('0x2'));var rs=require(_0x65d6('0x3'));var fs=require('fs');var Redis=require(_0x65d6('0x4'));var db=require(_0x65d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x65d6('0x6'))(_0x65d6('0x7'));var config=require(_0x65d6('0x8'));var jayson=require(_0x65d6('0x9'));var client=jayson[_0x65d6('0xa')][_0x65d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x441b2c,_0x1a53a9,_0x454e0d){return new BPromise(function(_0x227de3,_0x31651b){return client[_0x65d6('0xc')](_0x441b2c,_0x454e0d)[_0x65d6('0xd')](function(_0x34cbfa){logger[_0x65d6('0xe')]('MailServerIn,\x20%s,\x20%s',_0x1a53a9,'request\x20sent');logger[_0x65d6('0xf')](_0x65d6('0x10'),_0x1a53a9,_0x65d6('0x11'),JSON['stringify'](_0x34cbfa));if(_0x34cbfa[_0x65d6('0x12')]){if(_0x34cbfa['error'][_0x65d6('0x13')]===0x1f4){logger['error'](_0x65d6('0x14'),_0x1a53a9,_0x34cbfa[_0x65d6('0x12')][_0x65d6('0x15')]);return _0x31651b(_0x34cbfa[_0x65d6('0x12')][_0x65d6('0x15')]);}logger[_0x65d6('0x12')](_0x65d6('0x14'),_0x1a53a9,_0x34cbfa[_0x65d6('0x12')][_0x65d6('0x15')]);return _0x227de3(_0x34cbfa[_0x65d6('0x12')][_0x65d6('0x15')]);}else{logger[_0x65d6('0xe')](_0x65d6('0x14'),_0x1a53a9,_0x65d6('0x11'));_0x227de3(_0x34cbfa[_0x65d6('0x16')][_0x65d6('0x15')]);}})[_0x65d6('0x17')](function(_0x236656){logger[_0x65d6('0x12')](_0x65d6('0x14'),_0x1a53a9,_0x236656);_0x31651b(_0x236656);});});}exports[_0x65d6('0x18')]=function(_0x343540){var _0x1ced1c=this;return new Promise(function(_0x1e46e7,_0x2c9e17){return db[_0x65d6('0x19')]['findAll']({'raw':_0x343540[_0x65d6('0x1a')]?_0x343540[_0x65d6('0x1a')][_0x65d6('0x1b')]===undefined?!![]:![]:!![],'where':_0x343540['options']?_0x343540[_0x65d6('0x1a')][_0x65d6('0x1c')]||null:null,'attributes':_0x343540[_0x65d6('0x1a')]?_0x343540[_0x65d6('0x1a')][_0x65d6('0x1d')]||null:null,'limit':_0x343540[_0x65d6('0x1a')]?_0x343540[_0x65d6('0x1a')]['limit']||null:null,'include':_0x343540[_0x65d6('0x1a')]?_0x343540[_0x65d6('0x1a')]['include']?_[_0x65d6('0x1e')](_0x343540[_0x65d6('0x1a')][_0x65d6('0x1f')],function(_0xec4fd1){return{'model':db[_0xec4fd1[_0x65d6('0x20')]],'as':_0xec4fd1['as'],'attributes':_0xec4fd1[_0x65d6('0x1d')],'include':_0xec4fd1[_0x65d6('0x1f')]?_[_0x65d6('0x1e')](_0xec4fd1[_0x65d6('0x1f')],function(_0x37725d){return{'model':db[_0x37725d[_0x65d6('0x20')]],'as':_0x37725d['as'],'attributes':_0x37725d[_0x65d6('0x1d')],'include':_0x37725d[_0x65d6('0x1f')]?_['map'](_0x37725d['include'],function(_0x5409cd){return{'model':db[_0x5409cd['model']],'as':_0x5409cd['as'],'attributes':_0x5409cd[_0x65d6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3263fa){logger[_0x65d6('0xe')]('GetMailServerIn',_0x343540);logger['debug'](_0x65d6('0x18'),_0x343540,JSON[_0x65d6('0x21')](_0x3263fa));_0x1e46e7(_0x3263fa);})[_0x65d6('0x17')](function(_0x214633){logger['error']('GetMailServerIn',_0x214633['message'],_0x343540);_0x2c9e17(_0x1ced1c[_0x65d6('0x12')](0x1f4,_0x214633[_0x65d6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 00814d2..28c88a0 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(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x34ed5a,_0x588a98){_0x34ed5a=_0x34ed5a-0x0;var _0x3f7625=_0x7a54[_0x34ed5a];return _0x3f7625;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index d07022a..971944a 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 _0x4fbd=['BOOLEAN','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fbd,0x121));var _0xd4fb=function(_0x575d3f,_0x3f2b42){_0x575d3f=_0x575d3f-0x0;var _0x47dfec=_0x4fbd[_0x575d3f];return _0x47dfec;};'use strict';var Sequelize=require(_0xd4fb('0x0'));module[_0xd4fb('0x1')]={'description':{'type':Sequelize[_0xd4fb('0x2')]},'host':{'type':Sequelize[_0xd4fb('0x2')]},'user':{'type':Sequelize[_0xd4fb('0x2')]},'pass':{'type':Sequelize[_0xd4fb('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xd4fb('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd4fb('0x2')]},'authentication':{'type':Sequelize[_0xd4fb('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7c7a=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2a4620,_0x312797){var _0xdc1be6=function(_0xc205eb){while(--_0xc205eb){_0x2a4620['push'](_0x2a4620['shift']());}};_0xdc1be6(++_0x312797);}(_0x7c7a,0x1d4));var _0xa7c7=function(_0x24d7f4,_0x2e768e){_0x24d7f4=_0x24d7f4-0x0;var _0x12d77d=_0x7c7a[_0x24d7f4];return _0x12d77d;};'use strict';var Sequelize=require(_0xa7c7('0x0'));module[_0xa7c7('0x1')]={'description':{'type':Sequelize[_0xa7c7('0x2')]},'host':{'type':Sequelize[_0xa7c7('0x2')]},'user':{'type':Sequelize[_0xa7c7('0x2')]},'pass':{'type':Sequelize[_0xa7c7('0x2')]},'port':{'type':Sequelize[_0xa7c7('0x3')]},'secure':{'type':Sequelize[_0xa7c7('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xa7c7('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index b18f67d..7444538 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 _0x1470=['sort','where','filters','filter','merge','map','options','includeAll','include','MailServerOut','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','reject','save','update','then','sendStatus','error','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x57a4ee,_0x58b182){var _0x7cd7de=function(_0x3a06f1){while(--_0x3a06f1){_0x57a4ee['push'](_0x57a4ee['shift']());}};_0x7cd7de(++_0x58b182);}(_0x1470,0x98));var _0x0147=function(_0x5ec634,_0xa835b9){_0x5ec634=_0x5ec634-0x0;var _0x5b94a9=_0x1470[_0x5ec634];return _0x5b94a9;};'use strict';var emlformat=require(_0x0147('0x0'));var rimraf=require(_0x0147('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0147('0x2'));var rp=require('request-promise');var moment=require(_0x0147('0x3'));var BPromise=require(_0x0147('0x4'));var Mustache=require(_0x0147('0x5'));var util=require(_0x0147('0x6'));var path=require(_0x0147('0x7'));var sox=require(_0x0147('0x8'));var csv=require(_0x0147('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0147('0xa'));var _=require(_0x0147('0xb'));var squel=require(_0x0147('0xc'));var crypto=require(_0x0147('0xd'));var jsforce=require(_0x0147('0xe'));var deskjs=require(_0x0147('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0147('0x10'));var Papa=require('papaparse');var Redis=require(_0x0147('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0147('0x12'));var as=require(_0x0147('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0147('0x14'))(_0x0147('0x15'));var utils=require('../../config/utils');var config=require(_0x0147('0x16'));var licenseUtil=require(_0x0147('0x17'));var db=require(_0x0147('0x18'))['db'];function respondWithStatusCode(_0x29513f,_0x2e1b6f){_0x2e1b6f=_0x2e1b6f||0xcc;return function(_0x548117){if(_0x548117){return _0x29513f['sendStatus'](_0x2e1b6f);}return _0x29513f[_0x0147('0x19')](_0x2e1b6f)['end']();};}function respondWithResult(_0x39f395,_0x5b4920){_0x5b4920=_0x5b4920||0xc8;return function(_0x359210){if(_0x359210){return _0x39f395[_0x0147('0x19')](_0x5b4920)['json'](_0x359210);}};}function respondWithFilteredResult(_0x832c2b,_0x1c9fb7){return function(_0x2faa03){if(_0x2faa03){var _0x2adaae=typeof _0x1c9fb7['offset']===_0x0147('0x1a')&&typeof _0x1c9fb7[_0x0147('0x1b')]==='undefined';var _0x3f60e2=_0x2faa03[_0x0147('0x1c')];var _0x3c173a=_0x2adaae?0x0:_0x1c9fb7[_0x0147('0x1d')];var _0x323890=_0x2adaae?_0x2faa03[_0x0147('0x1c')]:_0x1c9fb7['offset']+_0x1c9fb7[_0x0147('0x1b')];var _0x32694;if(_0x323890>=_0x3f60e2){_0x323890=_0x3f60e2;_0x32694=0xc8;}else{_0x32694=0xce;}_0x832c2b[_0x0147('0x19')](_0x32694);return _0x832c2b[_0x0147('0x1e')]('Content-Range',_0x3c173a+'-'+_0x323890+'/'+_0x3f60e2)['json'](_0x2faa03);}return null;};}function patchUpdates(_0x1a330e){return function(_0x5df39e){try{jsonpatch['apply'](_0x5df39e,_0x1a330e,!![]);}catch(_0x24857a){return BPromise[_0x0147('0x1f')](_0x24857a);}return _0x5df39e[_0x0147('0x20')]();};}function saveUpdates(_0x372e23,_0xbf0361){return function(_0x2ece58){if(_0x2ece58){return _0x2ece58[_0x0147('0x21')](_0x372e23)['then'](function(_0x4e117d){return _0x4e117d;});}return null;};}function removeEntity(_0x4924f7,_0x4205a0){return function(_0x4f101b){if(_0x4f101b){return _0x4f101b['destroy']()[_0x0147('0x22')](function(){_0x4924f7[_0x0147('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd525f9,_0x1855c7){return function(_0x5b6701){if(!_0x5b6701){_0xd525f9[_0x0147('0x23')](0x194);}return _0x5b6701;};}function handleError(_0x112e1,_0x1b7ead){_0x1b7ead=_0x1b7ead||0x1f4;return function(_0x59a1e1){logger[_0x0147('0x24')](_0x59a1e1['stack']);if(_0x59a1e1['name']){delete _0x59a1e1['name'];}_0x112e1[_0x0147('0x19')](_0x1b7ead)['send'](_0x59a1e1);};}exports['index']=function(_0x55ceb6,_0x3ed1d1){var _0x55905a={},_0x296735={},_0x1fc878={'count':0x0,'rows':[]};var _0x143349=_['map'](db['MailServerOut']['rawAttributes'],function(_0xc1f634){return{'name':_0xc1f634['fieldName'],'type':_0xc1f634[_0x0147('0x25')][_0x0147('0x26')]};});_0x296735['model']=_['map'](_0x143349,'name');_0x296735[_0x0147('0x27')]=_[_0x0147('0x28')](_0x55ceb6[_0x0147('0x27')]);_0x296735['filters']=_['intersection'](_0x296735[_0x0147('0x29')],_0x296735[_0x0147('0x27')]);_0x55905a[_0x0147('0x2a')]=_[_0x0147('0x2b')](_0x296735[_0x0147('0x29')],qs['fields'](_0x55ceb6[_0x0147('0x27')][_0x0147('0x2c')]));_0x55905a['attributes']=_0x55905a[_0x0147('0x2a')][_0x0147('0x2d')]?_0x55905a[_0x0147('0x2a')]:_0x296735[_0x0147('0x29')];if(!_0x55ceb6[_0x0147('0x27')][_0x0147('0x2e')](_0x0147('0x2f'))){_0x55905a[_0x0147('0x1b')]=qs['limit'](_0x55ceb6[_0x0147('0x27')][_0x0147('0x1b')]);_0x55905a['offset']=qs[_0x0147('0x1d')](_0x55ceb6[_0x0147('0x27')][_0x0147('0x1d')]);}_0x55905a[_0x0147('0x30')]=qs['sort'](_0x55ceb6['query'][_0x0147('0x31')]);_0x55905a[_0x0147('0x32')]=qs[_0x0147('0x33')](_['pick'](_0x55ceb6[_0x0147('0x27')],_0x296735[_0x0147('0x33')]),_0x143349);if(_0x55ceb6['query'][_0x0147('0x34')]){_0x55905a[_0x0147('0x32')]=_[_0x0147('0x35')](_0x55905a[_0x0147('0x32')],{'$or':_[_0x0147('0x36')](_0x143349,function(_0x36a6e1){if(_0x36a6e1[_0x0147('0x25')]!=='VIRTUAL'){var _0x393afd={};_0x393afd[_0x36a6e1['name']]={'$like':'%'+_0x55ceb6[_0x0147('0x27')]['filter']+'%'};return _0x393afd;}})});}_0x55905a=_[_0x0147('0x35')]({},_0x55905a,_0x55ceb6[_0x0147('0x37')]);var _0x2f496e={'where':_0x55905a[_0x0147('0x32')]};return db['MailServerOut'][_0x0147('0x1c')](_0x2f496e)[_0x0147('0x22')](function(_0x41068b){_0x1fc878[_0x0147('0x1c')]=_0x41068b;if(_0x55ceb6['query'][_0x0147('0x38')]){_0x55905a[_0x0147('0x39')]=[{'all':!![]}];}return db[_0x0147('0x3a')]['findAll'](_0x55905a);})[_0x0147('0x22')](function(_0x3f90ed){_0x1fc878[_0x0147('0x3b')]=_0x3f90ed;return _0x1fc878;})[_0x0147('0x22')](respondWithFilteredResult(_0x3ed1d1,_0x55905a))[_0x0147('0x3c')](handleError(_0x3ed1d1,null));};exports[_0x0147('0x3d')]=function(_0x5aa6f1,_0x306f31){var _0x2acf5b={'raw':!![],'where':{'id':_0x5aa6f1[_0x0147('0x3e')]['id']}},_0x182dec={};_0x182dec[_0x0147('0x29')]=_[_0x0147('0x28')](db[_0x0147('0x3a')][_0x0147('0x3f')]);_0x182dec[_0x0147('0x27')]=_['keys'](_0x5aa6f1[_0x0147('0x27')]);_0x182dec[_0x0147('0x33')]=_[_0x0147('0x2b')](_0x182dec[_0x0147('0x29')],_0x182dec['query']);_0x2acf5b[_0x0147('0x2a')]=_[_0x0147('0x2b')](_0x182dec[_0x0147('0x29')],qs[_0x0147('0x2c')](_0x5aa6f1[_0x0147('0x27')][_0x0147('0x2c')]));_0x2acf5b[_0x0147('0x2a')]=_0x2acf5b['attributes'][_0x0147('0x2d')]?_0x2acf5b[_0x0147('0x2a')]:_0x182dec[_0x0147('0x29')];if(_0x5aa6f1[_0x0147('0x27')][_0x0147('0x38')]){_0x2acf5b['include']=[{'all':!![]}];}_0x2acf5b=_[_0x0147('0x35')]({},_0x2acf5b,_0x5aa6f1[_0x0147('0x37')]);return db['MailServerOut'][_0x0147('0x40')](_0x2acf5b)['then'](handleEntityNotFound(_0x306f31,null))['then'](respondWithResult(_0x306f31,null))['catch'](handleError(_0x306f31,null));};exports[_0x0147('0x41')]=function(_0x33d632,_0x30a64c){return db[_0x0147('0x3a')][_0x0147('0x41')](_0x33d632['body'],{})[_0x0147('0x22')](respondWithResult(_0x30a64c,0xc9))['catch'](handleError(_0x30a64c,null));};exports['update']=function(_0x83895e,_0x4c8da9){if(_0x83895e[_0x0147('0x42')]['id']){delete _0x83895e[_0x0147('0x42')]['id'];}return db[_0x0147('0x3a')][_0x0147('0x40')]({'where':{'id':_0x83895e[_0x0147('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4c8da9,null))[_0x0147('0x22')](saveUpdates(_0x83895e[_0x0147('0x42')],null))['then'](respondWithResult(_0x4c8da9,null))['catch'](handleError(_0x4c8da9,null));};exports['destroy']=function(_0x15b553,_0xef13f){return db[_0x0147('0x3a')]['find']({'where':{'id':_0x15b553['params']['id']}})[_0x0147('0x22')](handleEntityNotFound(_0xef13f,null))['then'](removeEntity(_0xef13f,null))[_0x0147('0x3c')](handleError(_0xef13f,null));}; \ No newline at end of file +var _0x0de8=['destroy','sendStatus','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','MailServerOut','includeAll','include','findAll','rows','catch','params','keys','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','count','limit','set','apply','reject','update','then'];(function(_0x5d1a71,_0x4b445d){var _0x53fa9a=function(_0x148508){while(--_0x148508){_0x5d1a71['push'](_0x5d1a71['shift']());}};_0x53fa9a(++_0x4b445d);}(_0x0de8,0x138));var _0x80de=function(_0x21fe98,_0x55db4c){_0x21fe98=_0x21fe98-0x0;var _0x19dde3=_0x0de8[_0x21fe98];return _0x19dde3;};'use strict';var emlformat=require(_0x80de('0x0'));var rimraf=require(_0x80de('0x1'));var zipdir=require(_0x80de('0x2'));var jsonpatch=require(_0x80de('0x3'));var rp=require(_0x80de('0x4'));var moment=require(_0x80de('0x5'));var BPromise=require(_0x80de('0x6'));var Mustache=require(_0x80de('0x7'));var util=require(_0x80de('0x8'));var path=require(_0x80de('0x9'));var sox=require(_0x80de('0xa'));var csv=require('to-csv');var ejs=require(_0x80de('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x80de('0xc'));var squel=require(_0x80de('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x80de('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x80de('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x80de('0x10'));var hardwareService=require(_0x80de('0x11'));var logger=require(_0x80de('0x12'))(_0x80de('0x13'));var utils=require(_0x80de('0x14'));var config=require(_0x80de('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c756c,_0xe9ba9){_0xe9ba9=_0xe9ba9||0xcc;return function(_0x53cbfd){if(_0x53cbfd){return _0x5c756c['sendStatus'](_0xe9ba9);}return _0x5c756c[_0x80de('0x16')](_0xe9ba9)['end']();};}function respondWithResult(_0x42f536,_0x4ea261){_0x4ea261=_0x4ea261||0xc8;return function(_0x396f4e){if(_0x396f4e){return _0x42f536[_0x80de('0x16')](_0x4ea261)[_0x80de('0x17')](_0x396f4e);}};}function respondWithFilteredResult(_0x34bf41,_0x2f779b){return function(_0x2c5c58){if(_0x2c5c58){var _0x504e01=typeof _0x2f779b[_0x80de('0x18')]===_0x80de('0x19')&&typeof _0x2f779b['limit']==='undefined';var _0x5f458f=_0x2c5c58['count'];var _0x4d8f2b=_0x504e01?0x0:_0x2f779b['offset'];var _0x1e8b17=_0x504e01?_0x2c5c58[_0x80de('0x1a')]:_0x2f779b[_0x80de('0x18')]+_0x2f779b[_0x80de('0x1b')];var _0x23f875;if(_0x1e8b17>=_0x5f458f){_0x1e8b17=_0x5f458f;_0x23f875=0xc8;}else{_0x23f875=0xce;}_0x34bf41[_0x80de('0x16')](_0x23f875);return _0x34bf41[_0x80de('0x1c')]('Content-Range',_0x4d8f2b+'-'+_0x1e8b17+'/'+_0x5f458f)[_0x80de('0x17')](_0x2c5c58);}return null;};}function patchUpdates(_0x2d37d6){return function(_0x1f7c55){try{jsonpatch[_0x80de('0x1d')](_0x1f7c55,_0x2d37d6,!![]);}catch(_0x30fc16){return BPromise[_0x80de('0x1e')](_0x30fc16);}return _0x1f7c55['save']();};}function saveUpdates(_0xfeef13,_0x39933a){return function(_0x3bcd8b){if(_0x3bcd8b){return _0x3bcd8b[_0x80de('0x1f')](_0xfeef13)[_0x80de('0x20')](function(_0x4ebe3b){return _0x4ebe3b;});}return null;};}function removeEntity(_0x55d548,_0x2683cb){return function(_0x331325){if(_0x331325){return _0x331325[_0x80de('0x21')]()[_0x80de('0x20')](function(){_0x55d548['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33b26a,_0x4f2f3b){return function(_0x52b89d){if(!_0x52b89d){_0x33b26a[_0x80de('0x22')](0x194);}return _0x52b89d;};}function handleError(_0x3b2f9c,_0x5aba11){_0x5aba11=_0x5aba11||0x1f4;return function(_0x55d7fa){logger['error'](_0x55d7fa['stack']);if(_0x55d7fa[_0x80de('0x23')]){delete _0x55d7fa[_0x80de('0x23')];}_0x3b2f9c[_0x80de('0x16')](_0x5aba11)[_0x80de('0x24')](_0x55d7fa);};}exports['index']=function(_0x286253,_0x16d77b){var _0x558e98={},_0x6ac2e5={},_0x17e136={'count':0x0,'rows':[]};var _0x359385=_['map'](db['MailServerOut'][_0x80de('0x25')],function(_0x1b07ad){return{'name':_0x1b07ad[_0x80de('0x26')],'type':_0x1b07ad[_0x80de('0x27')][_0x80de('0x28')]};});_0x6ac2e5[_0x80de('0x29')]=_[_0x80de('0x2a')](_0x359385,'name');_0x6ac2e5[_0x80de('0x2b')]=_['keys'](_0x286253['query']);_0x6ac2e5[_0x80de('0x2c')]=_[_0x80de('0x2d')](_0x6ac2e5['model'],_0x6ac2e5[_0x80de('0x2b')]);_0x558e98['attributes']=_['intersection'](_0x6ac2e5[_0x80de('0x29')],qs[_0x80de('0x2e')](_0x286253[_0x80de('0x2b')][_0x80de('0x2e')]));_0x558e98['attributes']=_0x558e98[_0x80de('0x2f')][_0x80de('0x30')]?_0x558e98[_0x80de('0x2f')]:_0x6ac2e5[_0x80de('0x29')];if(!_0x286253[_0x80de('0x2b')][_0x80de('0x31')](_0x80de('0x32'))){_0x558e98[_0x80de('0x1b')]=qs[_0x80de('0x1b')](_0x286253[_0x80de('0x2b')]['limit']);_0x558e98['offset']=qs[_0x80de('0x18')](_0x286253[_0x80de('0x2b')][_0x80de('0x18')]);}_0x558e98[_0x80de('0x33')]=qs['sort'](_0x286253['query'][_0x80de('0x34')]);_0x558e98[_0x80de('0x35')]=qs[_0x80de('0x2c')](_[_0x80de('0x36')](_0x286253[_0x80de('0x2b')],_0x6ac2e5[_0x80de('0x2c')]),_0x359385);if(_0x286253[_0x80de('0x2b')][_0x80de('0x37')]){_0x558e98['where']=_['merge'](_0x558e98['where'],{'$or':_[_0x80de('0x2a')](_0x359385,function(_0x56bbd4){if(_0x56bbd4['type']!=='VIRTUAL'){var _0x29e612={};_0x29e612[_0x56bbd4[_0x80de('0x23')]]={'$like':'%'+_0x286253['query'][_0x80de('0x37')]+'%'};return _0x29e612;}})});}_0x558e98=_[_0x80de('0x38')]({},_0x558e98,_0x286253['options']);var _0x3f9d70={'where':_0x558e98['where']};return db[_0x80de('0x39')][_0x80de('0x1a')](_0x3f9d70)[_0x80de('0x20')](function(_0x2f7089){_0x17e136[_0x80de('0x1a')]=_0x2f7089;if(_0x286253[_0x80de('0x2b')][_0x80de('0x3a')]){_0x558e98[_0x80de('0x3b')]=[{'all':!![]}];}return db[_0x80de('0x39')][_0x80de('0x3c')](_0x558e98);})[_0x80de('0x20')](function(_0x1eb9b9){_0x17e136[_0x80de('0x3d')]=_0x1eb9b9;return _0x17e136;})['then'](respondWithFilteredResult(_0x16d77b,_0x558e98))[_0x80de('0x3e')](handleError(_0x16d77b,null));};exports['show']=function(_0x334752,_0x2a89b6){var _0x45f9ab={'raw':!![],'where':{'id':_0x334752[_0x80de('0x3f')]['id']}},_0x4d3011={};_0x4d3011[_0x80de('0x29')]=_[_0x80de('0x40')](db[_0x80de('0x39')][_0x80de('0x25')]);_0x4d3011['query']=_['keys'](_0x334752['query']);_0x4d3011[_0x80de('0x2c')]=_['intersection'](_0x4d3011[_0x80de('0x29')],_0x4d3011[_0x80de('0x2b')]);_0x45f9ab[_0x80de('0x2f')]=_[_0x80de('0x2d')](_0x4d3011['model'],qs[_0x80de('0x2e')](_0x334752[_0x80de('0x2b')][_0x80de('0x2e')]));_0x45f9ab[_0x80de('0x2f')]=_0x45f9ab[_0x80de('0x2f')][_0x80de('0x30')]?_0x45f9ab[_0x80de('0x2f')]:_0x4d3011['model'];if(_0x334752[_0x80de('0x2b')]['includeAll']){_0x45f9ab[_0x80de('0x3b')]=[{'all':!![]}];}_0x45f9ab=_[_0x80de('0x38')]({},_0x45f9ab,_0x334752[_0x80de('0x41')]);return db[_0x80de('0x39')]['find'](_0x45f9ab)[_0x80de('0x20')](handleEntityNotFound(_0x2a89b6,null))['then'](respondWithResult(_0x2a89b6,null))[_0x80de('0x3e')](handleError(_0x2a89b6,null));};exports[_0x80de('0x42')]=function(_0x18c751,_0x1470b2){return db[_0x80de('0x39')][_0x80de('0x42')](_0x18c751[_0x80de('0x43')],{})[_0x80de('0x20')](respondWithResult(_0x1470b2,0xc9))[_0x80de('0x3e')](handleError(_0x1470b2,null));};exports[_0x80de('0x1f')]=function(_0x54996a,_0x4852aa){if(_0x54996a['body']['id']){delete _0x54996a[_0x80de('0x43')]['id'];}return db['MailServerOut'][_0x80de('0x44')]({'where':{'id':_0x54996a['params']['id']}})[_0x80de('0x20')](handleEntityNotFound(_0x4852aa,null))['then'](saveUpdates(_0x54996a[_0x80de('0x43')],null))[_0x80de('0x20')](respondWithResult(_0x4852aa,null))[_0x80de('0x3e')](handleError(_0x4852aa,null));};exports[_0x80de('0x21')]=function(_0x53da57,_0x3238a7){return db['MailServerOut']['find']({'where':{'id':_0x53da57[_0x80de('0x3f')]['id']}})[_0x80de('0x20')](handleEntityNotFound(_0x3238a7,null))[_0x80de('0x20')](removeEntity(_0x3238a7,null))['catch'](handleError(_0x3238a7,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 2a46831..b0e0f66 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 _0x969c=['MailServerOut','mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x5d28d,_0x509631){var _0x4d52a6=function(_0x5506a2){while(--_0x5506a2){_0x5d28d['push'](_0x5d28d['shift']());}};_0x4d52a6(++_0x509631);}(_0x969c,0x72));var _0xc969=function(_0x589d9a,_0x1b221c){_0x589d9a=_0x589d9a-0x0;var _0x28a34e=_0x969c[_0x589d9a];return _0x28a34e;};'use strict';var _=require('lodash');var util=require(_0xc969('0x0'));var logger=require(_0xc969('0x1'))(_0xc969('0x2'));var moment=require(_0xc969('0x3'));var BPromise=require(_0xc969('0x4'));var rp=require(_0xc969('0x5'));var fs=require('fs');var path=require(_0xc969('0x6'));var rimraf=require(_0xc969('0x7'));var config=require(_0xc969('0x8'));var attributes=require(_0xc969('0x9'));module[_0xc969('0xa')]=function(_0x3a9932,_0x1d0e2f){return _0x3a9932[_0xc969('0xb')](_0xc969('0xc'),attributes,{'tableName':_0xc969('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0207=['../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','moment','request-promise','rimraf'];(function(_0x3f9488,_0x1c3e1f){var _0x4813a1=function(_0x123383){while(--_0x123383){_0x3f9488['push'](_0x3f9488['shift']());}};_0x4813a1(++_0x1c3e1f);}(_0x0207,0xa5));var _0x7020=function(_0x396583,_0x1049e3){_0x396583=_0x396583-0x0;var _0x3af08e=_0x0207[_0x396583];return _0x3af08e;};'use strict';var _=require(_0x7020('0x0'));var util=require(_0x7020('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7020('0x2'));var BPromise=require('bluebird');var rp=require(_0x7020('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7020('0x4'));var config=require(_0x7020('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x7020('0x6')]=function(_0x4b2abe,_0xc4046){return _0x4b2abe[_0x7020('0x7')](_0x7020('0x8'),attributes,{'tableName':_0x7020('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 16f9229..03d37c9 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 _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(_0x1694f1,_0x1d8dac){var _0x5b73e1=function(_0x3218f1){while(--_0x3218f1){_0x1694f1['push'](_0x1694f1['shift']());}};_0x5b73e1(++_0x1d8dac);}(_0x1261,0x144));var _0x1126=function(_0x3e8930,_0x154364){_0x3e8930=_0x3e8930-0x0;var _0x15b38f=_0x1261[_0x3e8930];return _0x15b38f;};'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 +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0xcc586c,_0x4396f){var _0x201bcb=function(_0x3dcf3a){while(--_0x3dcf3a){_0xcc586c['push'](_0xcc586c['shift']());}};_0x201bcb(++_0x4396f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fe0dae0..abafb86 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 _0xdcd7=['post','create','put','update','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x9d90f,_0x4782a1){var _0x246e52=function(_0x154f26){while(--_0x154f26){_0x9d90f['push'](_0x9d90f['shift']());}};_0x246e52(++_0x4782a1);}(_0xdcd7,0x66));var _0x7dcd=function(_0x1113d9,_0x52cd99){_0x1113d9=_0x1113d9-0x0;var _0x4a5aa2=_0xdcd7[_0x1113d9];return _0x4a5aa2;};'use strict';var multer=require('multer');var util=require(_0x7dcd('0x0'));var path=require('path');var timeout=require(_0x7dcd('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7dcd('0x2'));var interaction=require(_0x7dcd('0x3'));var config=require(_0x7dcd('0x4'));var controller=require(_0x7dcd('0x5'));router[_0x7dcd('0x6')]('/',auth[_0x7dcd('0x7')](),controller[_0x7dcd('0x8')]);router[_0x7dcd('0x6')](_0x7dcd('0x9'),auth[_0x7dcd('0x7')](),controller['describe']);router[_0x7dcd('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7dcd('0xa')]('/',auth[_0x7dcd('0x7')](),controller[_0x7dcd('0xb')]);router[_0x7dcd('0xc')]('/:id',auth[_0x7dcd('0x7')](),controller[_0x7dcd('0xd')]);router[_0x7dcd('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7dcd('0xf')]=router; \ No newline at end of file +var _0x5418=['../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x38bd36,_0x447e84){var _0x237b83=function(_0x1f1ac1){while(--_0x1f1ac1){_0x38bd36['push'](_0x38bd36['shift']());}};_0x237b83(++_0x447e84);}(_0x5418,0x12c));var _0x8541=function(_0x31b631,_0xe1ea30){_0x31b631=_0x31b631-0x0;var _0x108249=_0x5418[_0x31b631];return _0x108249;};'use strict';var multer=require(_0x8541('0x0'));var util=require(_0x8541('0x1'));var path=require(_0x8541('0x2'));var timeout=require('connect-timeout');var express=require(_0x8541('0x3'));var router=express['Router']();var fs_extra=require(_0x8541('0x4'));var auth=require(_0x8541('0x5'));var interaction=require(_0x8541('0x6'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x8541('0x7')]('/',auth[_0x8541('0x8')](),controller['index']);router[_0x8541('0x7')](_0x8541('0x9'),auth[_0x8541('0x8')](),controller[_0x8541('0xa')]);router[_0x8541('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8541('0xb')]);router[_0x8541('0xc')]('/',auth[_0x8541('0x8')](),controller[_0x8541('0xd')]);router['put'](_0x8541('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x8541('0xf')](_0x8541('0xe'),auth['isAuthenticated'](),controller[_0x8541('0x10')]);module[_0x8541('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 986df50..4c5cd4c 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 _0x9bd9=['sequelize','exports','STRING','name'];(function(_0x3ad7e5,_0x36ece7){var _0x37bf2b=function(_0x165b96){while(--_0x165b96){_0x3ad7e5['push'](_0x3ad7e5['shift']());}};_0x37bf2b(++_0x36ece7);}(_0x9bd9,0x1a4));var _0x99bd=function(_0xae7883,_0xabf9c8){_0xae7883=_0xae7883-0x0;var _0xd55326=_0x9bd9[_0xae7883];return _0xd55326;};'use strict';var Sequelize=require(_0x99bd('0x0'));module[_0x99bd('0x1')]={'name':{'type':Sequelize[_0x99bd('0x2')],'unique':_0x99bd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x99bd('0x2')]}}; \ No newline at end of file +var _0xfb65=['exports','STRING'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xfb65,0x82));var _0x5fb6=function(_0x690346,_0x40dc57){_0x690346=_0x690346-0x0;var _0x5e4dab=_0xfb65[_0x690346];return _0x5e4dab;};'use strict';var Sequelize=require('sequelize');module[_0x5fb6('0x0')]={'name':{'type':Sequelize[_0x5fb6('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5fb6('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8cc7823..5f34a36 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 _0xa6f8=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','findAll','rows','catch','show','params','keys','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','apply','reject','save','destroy','then','error','name','send','map','MailSubstatus','rawAttributes','fieldName','model','query','filters','intersection'];(function(_0xb9d885,_0x39f6b1){var _0x3a8b31=function(_0x2532b6){while(--_0x2532b6){_0xb9d885['push'](_0xb9d885['shift']());}};_0x3a8b31(++_0x39f6b1);}(_0xa6f8,0x130));var _0x8a6f=function(_0x445b7e,_0x3ea85f){_0x445b7e=_0x445b7e-0x0;var _0x17d997=_0xa6f8[_0x445b7e];return _0x17d997;};'use strict';var emlformat=require(_0x8a6f('0x0'));var rimraf=require(_0x8a6f('0x1'));var zipdir=require(_0x8a6f('0x2'));var jsonpatch=require(_0x8a6f('0x3'));var rp=require(_0x8a6f('0x4'));var moment=require('moment');var BPromise=require(_0x8a6f('0x5'));var Mustache=require(_0x8a6f('0x6'));var util=require(_0x8a6f('0x7'));var path=require(_0x8a6f('0x8'));var sox=require('sox');var csv=require(_0x8a6f('0x9'));var ejs=require(_0x8a6f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a6f('0xb'));var squel=require(_0x8a6f('0xc'));var crypto=require('crypto');var jsforce=require(_0x8a6f('0xd'));var deskjs=require(_0x8a6f('0xe'));var toCsv=require(_0x8a6f('0x9'));var querystring=require('querystring');var Papa=require(_0x8a6f('0xf'));var Redis=require('ioredis');var authService=require(_0x8a6f('0x10'));var qs=require(_0x8a6f('0x11'));var as=require(_0x8a6f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8a6f('0x13'));var utils=require(_0x8a6f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8a6f('0x15'));var db=require(_0x8a6f('0x16'))['db'];function respondWithStatusCode(_0x340b37,_0x420da1){_0x420da1=_0x420da1||0xcc;return function(_0x288123){if(_0x288123){return _0x340b37[_0x8a6f('0x17')](_0x420da1);}return _0x340b37[_0x8a6f('0x18')](_0x420da1)['end']();};}function respondWithResult(_0x3df783,_0xce3fc8){_0xce3fc8=_0xce3fc8||0xc8;return function(_0x58eed7){if(_0x58eed7){return _0x3df783['status'](_0xce3fc8)[_0x8a6f('0x19')](_0x58eed7);}};}function respondWithFilteredResult(_0x5ec7c7,_0x69fe5b){return function(_0x118dd0){if(_0x118dd0){var _0x506f3e=typeof _0x69fe5b[_0x8a6f('0x1a')]==='undefined'&&typeof _0x69fe5b['limit']==='undefined';var _0x209a0b=_0x118dd0[_0x8a6f('0x1b')];var _0x4b2bb8=_0x506f3e?0x0:_0x69fe5b[_0x8a6f('0x1a')];var _0x28636a=_0x506f3e?_0x118dd0[_0x8a6f('0x1b')]:_0x69fe5b[_0x8a6f('0x1a')]+_0x69fe5b[_0x8a6f('0x1c')];var _0x3502a7;if(_0x28636a>=_0x209a0b){_0x28636a=_0x209a0b;_0x3502a7=0xc8;}else{_0x3502a7=0xce;}_0x5ec7c7[_0x8a6f('0x18')](_0x3502a7);return _0x5ec7c7[_0x8a6f('0x1d')]('Content-Range',_0x4b2bb8+'-'+_0x28636a+'/'+_0x209a0b)[_0x8a6f('0x19')](_0x118dd0);}return null;};}function patchUpdates(_0x215e91){return function(_0xf7a4f7){try{jsonpatch[_0x8a6f('0x1e')](_0xf7a4f7,_0x215e91,!![]);}catch(_0x309f04){return BPromise[_0x8a6f('0x1f')](_0x309f04);}return _0xf7a4f7[_0x8a6f('0x20')]();};}function saveUpdates(_0x192796,_0x1db056){return function(_0x4ac7d1){if(_0x4ac7d1){return _0x4ac7d1['update'](_0x192796)['then'](function(_0x353732){return _0x353732;});}return null;};}function removeEntity(_0x1050e5,_0x378b0c){return function(_0x2fba29){if(_0x2fba29){return _0x2fba29[_0x8a6f('0x21')]()[_0x8a6f('0x22')](function(){_0x1050e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa03b79,_0x19bd1c){return function(_0x1cdd1c){if(!_0x1cdd1c){_0xa03b79[_0x8a6f('0x17')](0x194);}return _0x1cdd1c;};}function handleError(_0x1443f1,_0x5d1660){_0x5d1660=_0x5d1660||0x1f4;return function(_0x429e32){logger[_0x8a6f('0x23')](_0x429e32['stack']);if(_0x429e32['name']){delete _0x429e32[_0x8a6f('0x24')];}_0x1443f1[_0x8a6f('0x18')](_0x5d1660)[_0x8a6f('0x25')](_0x429e32);};}exports['index']=function(_0x223272,_0x585858){var _0x2b9533={},_0x31cd95={},_0x265cb8={'count':0x0,'rows':[]};var _0x368ae0=_[_0x8a6f('0x26')](db[_0x8a6f('0x27')][_0x8a6f('0x28')],function(_0x3b9e28){return{'name':_0x3b9e28[_0x8a6f('0x29')],'type':_0x3b9e28['type']['key']};});_0x31cd95[_0x8a6f('0x2a')]=_[_0x8a6f('0x26')](_0x368ae0,'name');_0x31cd95[_0x8a6f('0x2b')]=_['keys'](_0x223272[_0x8a6f('0x2b')]);_0x31cd95[_0x8a6f('0x2c')]=_[_0x8a6f('0x2d')](_0x31cd95['model'],_0x31cd95[_0x8a6f('0x2b')]);_0x2b9533[_0x8a6f('0x2e')]=_[_0x8a6f('0x2d')](_0x31cd95[_0x8a6f('0x2a')],qs[_0x8a6f('0x2f')](_0x223272[_0x8a6f('0x2b')][_0x8a6f('0x2f')]));_0x2b9533[_0x8a6f('0x2e')]=_0x2b9533[_0x8a6f('0x2e')][_0x8a6f('0x30')]?_0x2b9533[_0x8a6f('0x2e')]:_0x31cd95[_0x8a6f('0x2a')];if(!_0x223272[_0x8a6f('0x2b')][_0x8a6f('0x31')](_0x8a6f('0x32'))){_0x2b9533[_0x8a6f('0x1c')]=qs[_0x8a6f('0x1c')](_0x223272[_0x8a6f('0x2b')]['limit']);_0x2b9533[_0x8a6f('0x1a')]=qs[_0x8a6f('0x1a')](_0x223272[_0x8a6f('0x2b')][_0x8a6f('0x1a')]);}_0x2b9533[_0x8a6f('0x33')]=qs[_0x8a6f('0x34')](_0x223272['query'][_0x8a6f('0x34')]);_0x2b9533[_0x8a6f('0x35')]=qs[_0x8a6f('0x2c')](_[_0x8a6f('0x36')](_0x223272[_0x8a6f('0x2b')],_0x31cd95[_0x8a6f('0x2c')]),_0x368ae0);if(_0x223272[_0x8a6f('0x2b')][_0x8a6f('0x37')]){_0x2b9533[_0x8a6f('0x35')]=_[_0x8a6f('0x38')](_0x2b9533[_0x8a6f('0x35')],{'$or':_['map'](_0x368ae0,function(_0x64efdc){if(_0x64efdc[_0x8a6f('0x39')]!=='VIRTUAL'){var _0x3674af={};_0x3674af[_0x64efdc[_0x8a6f('0x24')]]={'$like':'%'+_0x223272[_0x8a6f('0x2b')][_0x8a6f('0x37')]+'%'};return _0x3674af;}})});}_0x2b9533=_[_0x8a6f('0x38')]({},_0x2b9533,_0x223272['options']);var _0x42f646={'where':_0x2b9533[_0x8a6f('0x35')]};return db[_0x8a6f('0x27')][_0x8a6f('0x1b')](_0x42f646)[_0x8a6f('0x22')](function(_0x3414b1){_0x265cb8[_0x8a6f('0x1b')]=_0x3414b1;if(_0x223272[_0x8a6f('0x2b')]['includeAll']){_0x2b9533['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x8a6f('0x3a')](_0x2b9533);})[_0x8a6f('0x22')](function(_0x4e1b54){_0x265cb8[_0x8a6f('0x3b')]=_0x4e1b54;return _0x265cb8;})[_0x8a6f('0x22')](respondWithFilteredResult(_0x585858,_0x2b9533))[_0x8a6f('0x3c')](handleError(_0x585858,null));};exports[_0x8a6f('0x3d')]=function(_0x331339,_0x454987){var _0xb3dbd5={'raw':!![],'where':{'id':_0x331339[_0x8a6f('0x3e')]['id']}},_0x2a0686={};_0x2a0686[_0x8a6f('0x2a')]=_['keys'](db[_0x8a6f('0x27')][_0x8a6f('0x28')]);_0x2a0686[_0x8a6f('0x2b')]=_[_0x8a6f('0x3f')](_0x331339[_0x8a6f('0x2b')]);_0x2a0686[_0x8a6f('0x2c')]=_[_0x8a6f('0x2d')](_0x2a0686[_0x8a6f('0x2a')],_0x2a0686[_0x8a6f('0x2b')]);_0xb3dbd5[_0x8a6f('0x2e')]=_[_0x8a6f('0x2d')](_0x2a0686['model'],qs[_0x8a6f('0x2f')](_0x331339[_0x8a6f('0x2b')][_0x8a6f('0x2f')]));_0xb3dbd5[_0x8a6f('0x2e')]=_0xb3dbd5[_0x8a6f('0x2e')][_0x8a6f('0x30')]?_0xb3dbd5[_0x8a6f('0x2e')]:_0x2a0686[_0x8a6f('0x2a')];if(_0x331339[_0x8a6f('0x2b')]['includeAll']){_0xb3dbd5['include']=[{'all':!![]}];}_0xb3dbd5=_[_0x8a6f('0x38')]({},_0xb3dbd5,_0x331339[_0x8a6f('0x40')]);return db[_0x8a6f('0x27')][_0x8a6f('0x41')](_0xb3dbd5)[_0x8a6f('0x22')](handleEntityNotFound(_0x454987,null))['then'](respondWithResult(_0x454987,null))[_0x8a6f('0x3c')](handleError(_0x454987,null));};exports[_0x8a6f('0x42')]=function(_0x1582fd,_0xdcaedb){return db[_0x8a6f('0x27')][_0x8a6f('0x42')](_0x1582fd[_0x8a6f('0x43')],{})[_0x8a6f('0x22')](respondWithResult(_0xdcaedb,0xc9))['catch'](handleError(_0xdcaedb,null));};exports[_0x8a6f('0x44')]=function(_0x174c73,_0x423484){if(_0x174c73[_0x8a6f('0x43')]['id']){delete _0x174c73[_0x8a6f('0x43')]['id'];}return db[_0x8a6f('0x27')][_0x8a6f('0x41')]({'where':{'id':_0x174c73[_0x8a6f('0x3e')]['id']}})[_0x8a6f('0x22')](handleEntityNotFound(_0x423484,null))['then'](saveUpdates(_0x174c73['body'],null))[_0x8a6f('0x22')](respondWithResult(_0x423484,null))[_0x8a6f('0x3c')](handleError(_0x423484,null));};exports[_0x8a6f('0x21')]=function(_0x33a2c8,_0x4738d9){return db['MailSubstatus'][_0x8a6f('0x41')]({'where':{'id':_0x33a2c8[_0x8a6f('0x3e')]['id']}})[_0x8a6f('0x22')](handleEntityNotFound(_0x4738d9,null))[_0x8a6f('0x22')](removeEntity(_0x4738d9,null))[_0x8a6f('0x3c')](handleError(_0x4738d9,null));};exports[_0x8a6f('0x45')]=function(_0x555e29,_0x200c39){return db[_0x8a6f('0x27')]['describe']()[_0x8a6f('0x22')](respondWithResult(_0x200c39,null))[_0x8a6f('0x3c')](handleError(_0x200c39,null));}; \ No newline at end of file +var _0x4e5a=['moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','MailSubstatus','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','findAll','rows','catch','show','params','length','includeAll','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3fdaff,_0x133c74){var _0xa6bc4e=function(_0x2aa5f0){while(--_0x2aa5f0){_0x3fdaff['push'](_0x3fdaff['shift']());}};_0xa6bc4e(++_0x133c74);}(_0x4e5a,0x16e));var _0xa4e5=function(_0x44c844,_0x1e3d7d){_0x44c844=_0x44c844-0x0;var _0x1d51b7=_0x4e5a[_0x44c844];return _0x1d51b7;};'use strict';var emlformat=require(_0xa4e5('0x0'));var rimraf=require(_0xa4e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4e5('0x2'));var rp=require(_0xa4e5('0x3'));var moment=require(_0xa4e5('0x4'));var BPromise=require(_0xa4e5('0x5'));var Mustache=require('mustache');var util=require(_0xa4e5('0x6'));var path=require(_0xa4e5('0x7'));var sox=require(_0xa4e5('0x8'));var csv=require(_0xa4e5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4e5('0xa'));var _=require('lodash');var squel=require(_0xa4e5('0xb'));var crypto=require(_0xa4e5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa4e5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa4e5('0xe'));var Papa=require(_0xa4e5('0xf'));var Redis=require(_0xa4e5('0x10'));var authService=require(_0xa4e5('0x11'));var qs=require(_0xa4e5('0x12'));var as=require(_0xa4e5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa4e5('0x14'));var utils=require(_0xa4e5('0x15'));var config=require(_0xa4e5('0x16'));var licenseUtil=require(_0xa4e5('0x17'));var db=require(_0xa4e5('0x18'))['db'];function respondWithStatusCode(_0x1439c1,_0x4396ec){_0x4396ec=_0x4396ec||0xcc;return function(_0x201866){if(_0x201866){return _0x1439c1[_0xa4e5('0x19')](_0x4396ec);}return _0x1439c1[_0xa4e5('0x1a')](_0x4396ec)[_0xa4e5('0x1b')]();};}function respondWithResult(_0x322863,_0x3dc96e){_0x3dc96e=_0x3dc96e||0xc8;return function(_0x251c48){if(_0x251c48){return _0x322863['status'](_0x3dc96e)[_0xa4e5('0x1c')](_0x251c48);}};}function respondWithFilteredResult(_0x3d88ce,_0x28f1b5){return function(_0x1c091a){if(_0x1c091a){var _0x595eb9=typeof _0x28f1b5['offset']===_0xa4e5('0x1d')&&typeof _0x28f1b5[_0xa4e5('0x1e')]===_0xa4e5('0x1d');var _0x4eb65b=_0x1c091a[_0xa4e5('0x1f')];var _0x517f42=_0x595eb9?0x0:_0x28f1b5[_0xa4e5('0x20')];var _0x68091b=_0x595eb9?_0x1c091a[_0xa4e5('0x1f')]:_0x28f1b5[_0xa4e5('0x20')]+_0x28f1b5['limit'];var _0x11c797;if(_0x68091b>=_0x4eb65b){_0x68091b=_0x4eb65b;_0x11c797=0xc8;}else{_0x11c797=0xce;}_0x3d88ce[_0xa4e5('0x1a')](_0x11c797);return _0x3d88ce[_0xa4e5('0x21')](_0xa4e5('0x22'),_0x517f42+'-'+_0x68091b+'/'+_0x4eb65b)[_0xa4e5('0x1c')](_0x1c091a);}return null;};}function patchUpdates(_0x22c381){return function(_0x541ef5){try{jsonpatch[_0xa4e5('0x23')](_0x541ef5,_0x22c381,!![]);}catch(_0x1238d0){return BPromise['reject'](_0x1238d0);}return _0x541ef5[_0xa4e5('0x24')]();};}function saveUpdates(_0x371bf1,_0x2e9b77){return function(_0x12511c){if(_0x12511c){return _0x12511c[_0xa4e5('0x25')](_0x371bf1)[_0xa4e5('0x26')](function(_0x4ff47b){return _0x4ff47b;});}return null;};}function removeEntity(_0x1a359d,_0x2a2130){return function(_0x46280d){if(_0x46280d){return _0x46280d[_0xa4e5('0x27')]()[_0xa4e5('0x26')](function(){_0x1a359d['status'](0xcc)[_0xa4e5('0x1b')]();});}};}function handleEntityNotFound(_0x1631c7,_0x11a585){return function(_0x292b5d){if(!_0x292b5d){_0x1631c7['sendStatus'](0x194);}return _0x292b5d;};}function handleError(_0x51d9a4,_0xcb84df){_0xcb84df=_0xcb84df||0x1f4;return function(_0x5a526f){logger[_0xa4e5('0x28')](_0x5a526f['stack']);if(_0x5a526f[_0xa4e5('0x29')]){delete _0x5a526f['name'];}_0x51d9a4[_0xa4e5('0x1a')](_0xcb84df)[_0xa4e5('0x2a')](_0x5a526f);};}exports['index']=function(_0x11f87f,_0x18cefa){var _0x447c06={},_0x45c79e={},_0x316855={'count':0x0,'rows':[]};var _0x4676f7=_['map'](db[_0xa4e5('0x2b')][_0xa4e5('0x2c')],function(_0x7c7abc){return{'name':_0x7c7abc[_0xa4e5('0x2d')],'type':_0x7c7abc[_0xa4e5('0x2e')]['key']};});_0x45c79e[_0xa4e5('0x2f')]=_[_0xa4e5('0x30')](_0x4676f7,_0xa4e5('0x29'));_0x45c79e[_0xa4e5('0x31')]=_[_0xa4e5('0x32')](_0x11f87f['query']);_0x45c79e[_0xa4e5('0x33')]=_[_0xa4e5('0x34')](_0x45c79e[_0xa4e5('0x2f')],_0x45c79e['query']);_0x447c06[_0xa4e5('0x35')]=_[_0xa4e5('0x34')](_0x45c79e[_0xa4e5('0x2f')],qs[_0xa4e5('0x36')](_0x11f87f[_0xa4e5('0x31')]['fields']));_0x447c06['attributes']=_0x447c06[_0xa4e5('0x35')]['length']?_0x447c06[_0xa4e5('0x35')]:_0x45c79e['model'];if(!_0x11f87f[_0xa4e5('0x31')][_0xa4e5('0x37')](_0xa4e5('0x38'))){_0x447c06[_0xa4e5('0x1e')]=qs[_0xa4e5('0x1e')](_0x11f87f[_0xa4e5('0x31')]['limit']);_0x447c06['offset']=qs[_0xa4e5('0x20')](_0x11f87f['query']['offset']);}_0x447c06[_0xa4e5('0x39')]=qs['sort'](_0x11f87f['query'][_0xa4e5('0x3a')]);_0x447c06[_0xa4e5('0x3b')]=qs[_0xa4e5('0x33')](_['pick'](_0x11f87f[_0xa4e5('0x31')],_0x45c79e[_0xa4e5('0x33')]),_0x4676f7);if(_0x11f87f['query'][_0xa4e5('0x3c')]){_0x447c06['where']=_['merge'](_0x447c06[_0xa4e5('0x3b')],{'$or':_[_0xa4e5('0x30')](_0x4676f7,function(_0x4fe4a6){if(_0x4fe4a6[_0xa4e5('0x2e')]!==_0xa4e5('0x3d')){var _0x25bbf3={};_0x25bbf3[_0x4fe4a6[_0xa4e5('0x29')]]={'$like':'%'+_0x11f87f[_0xa4e5('0x31')]['filter']+'%'};return _0x25bbf3;}})});}_0x447c06=_['merge']({},_0x447c06,_0x11f87f['options']);var _0x40fbfd={'where':_0x447c06[_0xa4e5('0x3b')]};return db['MailSubstatus'][_0xa4e5('0x1f')](_0x40fbfd)[_0xa4e5('0x26')](function(_0x260d1b){_0x316855['count']=_0x260d1b;if(_0x11f87f['query']['includeAll']){_0x447c06['include']=[{'all':!![]}];}return db[_0xa4e5('0x2b')][_0xa4e5('0x3e')](_0x447c06);})['then'](function(_0x4330b4){_0x316855[_0xa4e5('0x3f')]=_0x4330b4;return _0x316855;})[_0xa4e5('0x26')](respondWithFilteredResult(_0x18cefa,_0x447c06))[_0xa4e5('0x40')](handleError(_0x18cefa,null));};exports[_0xa4e5('0x41')]=function(_0x4c8046,_0x3b4d6d){var _0x1c6b48={'raw':!![],'where':{'id':_0x4c8046[_0xa4e5('0x42')]['id']}},_0x1db917={};_0x1db917[_0xa4e5('0x2f')]=_['keys'](db[_0xa4e5('0x2b')][_0xa4e5('0x2c')]);_0x1db917[_0xa4e5('0x31')]=_[_0xa4e5('0x32')](_0x4c8046[_0xa4e5('0x31')]);_0x1db917['filters']=_[_0xa4e5('0x34')](_0x1db917['model'],_0x1db917[_0xa4e5('0x31')]);_0x1c6b48[_0xa4e5('0x35')]=_['intersection'](_0x1db917[_0xa4e5('0x2f')],qs[_0xa4e5('0x36')](_0x4c8046['query'][_0xa4e5('0x36')]));_0x1c6b48[_0xa4e5('0x35')]=_0x1c6b48[_0xa4e5('0x35')][_0xa4e5('0x43')]?_0x1c6b48[_0xa4e5('0x35')]:_0x1db917[_0xa4e5('0x2f')];if(_0x4c8046['query'][_0xa4e5('0x44')]){_0x1c6b48['include']=[{'all':!![]}];}_0x1c6b48=_[_0xa4e5('0x45')]({},_0x1c6b48,_0x4c8046[_0xa4e5('0x46')]);return db[_0xa4e5('0x2b')]['find'](_0x1c6b48)[_0xa4e5('0x26')](handleEntityNotFound(_0x3b4d6d,null))[_0xa4e5('0x26')](respondWithResult(_0x3b4d6d,null))['catch'](handleError(_0x3b4d6d,null));};exports[_0xa4e5('0x47')]=function(_0x1b620f,_0x396a18){return db[_0xa4e5('0x2b')][_0xa4e5('0x47')](_0x1b620f['body'],{})[_0xa4e5('0x26')](respondWithResult(_0x396a18,0xc9))[_0xa4e5('0x40')](handleError(_0x396a18,null));};exports[_0xa4e5('0x25')]=function(_0x3fe868,_0x43b1fb){if(_0x3fe868['body']['id']){delete _0x3fe868[_0xa4e5('0x48')]['id'];}return db[_0xa4e5('0x2b')][_0xa4e5('0x49')]({'where':{'id':_0x3fe868[_0xa4e5('0x42')]['id']}})[_0xa4e5('0x26')](handleEntityNotFound(_0x43b1fb,null))[_0xa4e5('0x26')](saveUpdates(_0x3fe868['body'],null))[_0xa4e5('0x26')](respondWithResult(_0x43b1fb,null))[_0xa4e5('0x40')](handleError(_0x43b1fb,null));};exports[_0xa4e5('0x27')]=function(_0x5d36d9,_0x28cf34){return db[_0xa4e5('0x2b')][_0xa4e5('0x49')]({'where':{'id':_0x5d36d9[_0xa4e5('0x42')]['id']}})['then'](handleEntityNotFound(_0x28cf34,null))[_0xa4e5('0x26')](removeEntity(_0x28cf34,null))['catch'](handleError(_0x28cf34,null));};exports['describe']=function(_0x563cfb,_0x3dd3cd){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x3dd3cd,null))['catch'](handleError(_0x3dd3cd,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 79ab560..1cedddf 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 _0x3150=['rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','util','../../config/logger','api','request-promise','path'];(function(_0x23eaee,_0x4a8ec4){var _0x4ff243=function(_0x98b49f){while(--_0x98b49f){_0x23eaee['push'](_0x23eaee['shift']());}};_0x4ff243(++_0x4a8ec4);}(_0x3150,0x95));var _0x0315=function(_0x4dce97,_0x1b9719){_0x4dce97=_0x4dce97-0x0;var _0x417143=_0x3150[_0x4dce97];return _0x417143;};'use strict';var _=require('lodash');var util=require(_0x0315('0x0'));var logger=require(_0x0315('0x1'))(_0x0315('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0315('0x3'));var fs=require('fs');var path=require(_0x0315('0x4'));var rimraf=require(_0x0315('0x5'));var config=require('../../config/environment');var attributes=require(_0x0315('0x6'));module[_0x0315('0x7')]=function(_0x323f90,_0x20d592){return _0x323f90[_0x0315('0x8')](_0x0315('0x9'),attributes,{'tableName':_0x0315('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a3f=['./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x272a3a,_0x3b96e5){var _0x13929d=function(_0x3dfff0){while(--_0x3dfff0){_0x272a3a['push'](_0x272a3a['shift']());}};_0x13929d(++_0x3b96e5);}(_0x2a3f,0x126));var _0xf2a3=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x2a3f[_0x41f2f5];return _0x3d49f1;};'use strict';var _=require(_0xf2a3('0x0'));var util=require('util');var logger=require(_0xf2a3('0x1'))(_0xf2a3('0x2'));var moment=require('moment');var BPromise=require(_0xf2a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2a3('0x4'));var rimraf=require(_0xf2a3('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2a3('0x6'));module[_0xf2a3('0x7')]=function(_0x7c2b69,_0x164c20){return _0x7c2b69['define'](_0xf2a3('0x8'),attributes,{'tableName':_0xf2a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 1c0a4a7..73be9ed 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 _0xf244=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x195e78,_0xf0c2ab){var _0x2048e8=function(_0x532d9f){while(--_0x532d9f){_0x195e78['push'](_0x195e78['shift']());}};_0x2048e8(++_0xf0c2ab);}(_0xf244,0x160));var _0x4f24=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xf244[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x4f24('0x0'));var util=require('util');var moment=require(_0x4f24('0x1'));var BPromise=require(_0x4f24('0x2'));var rs=require(_0x4f24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f24('0x4'))['db'];var utils=require(_0x4f24('0x5'));var logger=require(_0x4f24('0x6'))('rpc');var config=require(_0x4f24('0x7'));var jayson=require(_0x4f24('0x8'));var client=jayson[_0x4f24('0x9')][_0x4f24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37c113,_0x37fa5d,_0x4fcc95){return new BPromise(function(_0x53acfd,_0x5e5ea2){return client[_0x4f24('0xb')](_0x37c113,_0x4fcc95)['then'](function(_0x14fce2){logger[_0x4f24('0xc')](_0x4f24('0xd'),_0x37fa5d,_0x4f24('0xe'));logger[_0x4f24('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x37fa5d,_0x4f24('0xe'),JSON[_0x4f24('0x10')](_0x14fce2));if(_0x14fce2[_0x4f24('0x11')]){if(_0x14fce2[_0x4f24('0x11')][_0x4f24('0x12')]===0x1f4){logger[_0x4f24('0x11')](_0x4f24('0xd'),_0x37fa5d,_0x14fce2[_0x4f24('0x11')][_0x4f24('0x13')]);return _0x5e5ea2(_0x14fce2[_0x4f24('0x11')][_0x4f24('0x13')]);}logger[_0x4f24('0x11')](_0x4f24('0xd'),_0x37fa5d,_0x14fce2[_0x4f24('0x11')][_0x4f24('0x13')]);return _0x53acfd(_0x14fce2['error'][_0x4f24('0x13')]);}else{logger[_0x4f24('0xc')](_0x4f24('0xd'),_0x37fa5d,_0x4f24('0xe'));_0x53acfd(_0x14fce2['result'][_0x4f24('0x13')]);}})[_0x4f24('0x14')](function(_0x792f05){logger[_0x4f24('0x11')](_0x4f24('0xd'),_0x37fa5d,_0x792f05);_0x5e5ea2(_0x792f05);});});} \ No newline at end of file +var _0x248b=['util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailSubstatus,\x20%s,\x20%s','lodash'];(function(_0x59bec1,_0x274398){var _0x247115=function(_0x267293){while(--_0x267293){_0x59bec1['push'](_0x59bec1['shift']());}};_0x247115(++_0x274398);}(_0x248b,0x167));var _0xb248=function(_0x3111af,_0x49b275){_0x3111af=_0x3111af-0x0;var _0x4c1d29=_0x248b[_0x3111af];return _0x4c1d29;};'use strict';var _=require(_0xb248('0x0'));var util=require(_0xb248('0x1'));var moment=require(_0xb248('0x2'));var BPromise=require(_0xb248('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb248('0x4'));var db=require(_0xb248('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb248('0x6'));var config=require(_0xb248('0x7'));var jayson=require(_0xb248('0x8'));var client=jayson[_0xb248('0x9')][_0xb248('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3673,_0x22ff21,_0x3ad421){return new BPromise(function(_0xc5bcb1,_0x485068){return client['request'](_0x1d3673,_0x3ad421)['then'](function(_0x2f3ecf){logger[_0xb248('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x22ff21,_0xb248('0xc'));logger[_0xb248('0xd')](_0xb248('0xe'),_0x22ff21,_0xb248('0xc'),JSON[_0xb248('0xf')](_0x2f3ecf));if(_0x2f3ecf[_0xb248('0x10')]){if(_0x2f3ecf[_0xb248('0x10')][_0xb248('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x22ff21,_0x2f3ecf[_0xb248('0x10')]['message']);return _0x485068(_0x2f3ecf['error'][_0xb248('0x12')]);}logger['error'](_0xb248('0x13'),_0x22ff21,_0x2f3ecf['error'][_0xb248('0x12')]);return _0xc5bcb1(_0x2f3ecf['error'][_0xb248('0x12')]);}else{logger['info'](_0xb248('0x13'),_0x22ff21,_0xb248('0xc'));_0xc5bcb1(_0x2f3ecf['result'][_0xb248('0x12')]);}})['catch'](function(_0x29e1c1){logger[_0xb248('0x10')](_0xb248('0x13'),_0x22ff21,_0x29e1c1);_0x485068(_0x29e1c1);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d920320..7ea0849 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 _0x2a85=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1ddc59,_0x52382d){var _0xbbe677=function(_0x4518cb){while(--_0x4518cb){_0x1ddc59['push'](_0x1ddc59['shift']());}};_0xbbe677(++_0x52382d);}(_0x2a85,0xd9));var _0x52a8=function(_0x3454e3,_0x31905){_0x3454e3=_0x3454e3-0x0;var _0xb3979e=_0x2a85[_0x3454e3];return _0xb3979e;};'use strict';var multer=require('multer');var util=require(_0x52a8('0x0'));var path=require(_0x52a8('0x1'));var timeout=require(_0x52a8('0x2'));var express=require(_0x52a8('0x3'));var router=express[_0x52a8('0x4')]();var fs_extra=require(_0x52a8('0x5'));var auth=require(_0x52a8('0x6'));var interaction=require(_0x52a8('0x7'));var config=require(_0x52a8('0x8'));var controller=require('./mailTransferReport.controller');router[_0x52a8('0x9')]('/',auth['isAuthenticated'](),controller[_0x52a8('0xa')]);router[_0x52a8('0x9')](_0x52a8('0xb'),auth['isAuthenticated'](),controller[_0x52a8('0xc')]);router['get']('/:id',auth[_0x52a8('0xd')](),controller[_0x52a8('0xe')]);router[_0x52a8('0xf')]('/',auth[_0x52a8('0xd')](),controller[_0x52a8('0x10')]);router[_0x52a8('0x11')]('/:id',auth[_0x52a8('0xd')](),controller[_0x52a8('0x12')]);router[_0x52a8('0x13')]('/:id',auth[_0x52a8('0xd')](),controller[_0x52a8('0x14')]);module[_0x52a8('0x15')]=router; \ No newline at end of file +var _0xca89=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','destroy'];(function(_0x6b4ec6,_0x2ef0ee){var _0x27da70=function(_0x3b2d7b){while(--_0x3b2d7b){_0x6b4ec6['push'](_0x6b4ec6['shift']());}};_0x27da70(++_0x2ef0ee);}(_0xca89,0x1e5));var _0x9ca8=function(_0x1fe6e6,_0x51de82){_0x1fe6e6=_0x1fe6e6-0x0;var _0x8c5033=_0xca89[_0x1fe6e6];return _0x8c5033;};'use strict';var multer=require(_0x9ca8('0x0'));var util=require(_0x9ca8('0x1'));var path=require(_0x9ca8('0x2'));var timeout=require(_0x9ca8('0x3'));var express=require(_0x9ca8('0x4'));var router=express[_0x9ca8('0x5')]();var fs_extra=require(_0x9ca8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9ca8('0x7'));var config=require(_0x9ca8('0x8'));var controller=require(_0x9ca8('0x9'));router['get']('/',auth[_0x9ca8('0xa')](),controller[_0x9ca8('0xb')]);router[_0x9ca8('0xc')](_0x9ca8('0xd'),auth[_0x9ca8('0xa')](),controller[_0x9ca8('0xe')]);router['get'](_0x9ca8('0xf'),auth['isAuthenticated'](),controller[_0x9ca8('0x10')]);router[_0x9ca8('0x11')]('/',auth[_0x9ca8('0xa')](),controller[_0x9ca8('0x12')]);router['put']('/:id',auth[_0x9ca8('0xa')](),controller[_0x9ca8('0x13')]);router['delete'](_0x9ca8('0xf'),auth[_0x9ca8('0xa')](),controller[_0x9ca8('0x14')]);module[_0x9ca8('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6bfb297..513c766 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x54bd6e,_0x3eced4){var _0x5621ab=function(_0x3989e9){while(--_0x3989e9){_0x54bd6e['push'](_0x54bd6e['shift']());}};_0x5621ab(++_0x3eced4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x375325,_0x57a850){_0x375325=_0x375325-0x0;var _0x228f57=_0xcb91[_0x375325];return _0x228f57;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5b4a60,_0x358cbe){var _0x35aa6b=function(_0x54a073){while(--_0x54a073){_0x5b4a60['push'](_0x5b4a60['shift']());}};_0x35aa6b(++_0x358cbe);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xcb91[_0x47adb8];return _0x4689a8;};'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 92f9cfe..052a39c 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 _0x49a4=['undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','index','map','MailTransferReport','rawAttributes','key','name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','filter','where','type','VIRTUAL','options','includeAll','findAll','then','rows','catch','show','params','keys','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x9c607a,_0x1cb2c6){var _0x3b1311=function(_0x1b3fec){while(--_0x1b3fec){_0x9c607a['push'](_0x9c607a['shift']());}};_0x3b1311(++_0x1cb2c6);}(_0x49a4,0x10b));var _0x449a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x49a4[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x449a('0x0'));var rimraf=require(_0x449a('0x1'));var zipdir=require(_0x449a('0x2'));var jsonpatch=require(_0x449a('0x3'));var rp=require(_0x449a('0x4'));var moment=require(_0x449a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x449a('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x449a('0x7'));var fs=require('fs');var fs_extra=require(_0x449a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x449a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x449a('0xa'));var toCsv=require(_0x449a('0xb'));var querystring=require(_0x449a('0xc'));var Papa=require(_0x449a('0xd'));var Redis=require(_0x449a('0xe'));var authService=require(_0x449a('0xf'));var qs=require(_0x449a('0x10'));var as=require(_0x449a('0x11'));var hardwareService=require(_0x449a('0x12'));var logger=require(_0x449a('0x13'))(_0x449a('0x14'));var utils=require('../../config/utils');var config=require(_0x449a('0x15'));var licenseUtil=require(_0x449a('0x16'));var db=require(_0x449a('0x17'))['db'];function respondWithStatusCode(_0x3aa081,_0x153497){_0x153497=_0x153497||0xcc;return function(_0x11b240){if(_0x11b240){return _0x3aa081[_0x449a('0x18')](_0x153497);}return _0x3aa081[_0x449a('0x19')](_0x153497)[_0x449a('0x1a')]();};}function respondWithResult(_0x3bb35a,_0x2d6c02){_0x2d6c02=_0x2d6c02||0xc8;return function(_0x32aa11){if(_0x32aa11){return _0x3bb35a[_0x449a('0x19')](_0x2d6c02)[_0x449a('0x1b')](_0x32aa11);}};}function respondWithFilteredResult(_0x6941d9,_0x19df31){return function(_0x3eaa49){if(_0x3eaa49){var _0xf4ff62=typeof _0x19df31[_0x449a('0x1c')]===_0x449a('0x1d')&&typeof _0x19df31[_0x449a('0x1e')]===_0x449a('0x1d');var _0xaa0608=_0x3eaa49[_0x449a('0x1f')];var _0x2ef3f9=_0xf4ff62?0x0:_0x19df31[_0x449a('0x1c')];var _0x511ed0=_0xf4ff62?_0x3eaa49['count']:_0x19df31[_0x449a('0x1c')]+_0x19df31[_0x449a('0x1e')];var _0x359396;if(_0x511ed0>=_0xaa0608){_0x511ed0=_0xaa0608;_0x359396=0xc8;}else{_0x359396=0xce;}_0x6941d9[_0x449a('0x19')](_0x359396);return _0x6941d9[_0x449a('0x20')](_0x449a('0x21'),_0x2ef3f9+'-'+_0x511ed0+'/'+_0xaa0608)[_0x449a('0x1b')](_0x3eaa49);}return null;};}function patchUpdates(_0x31a7c5){return function(_0x5814d0){try{jsonpatch[_0x449a('0x22')](_0x5814d0,_0x31a7c5,!![]);}catch(_0x320ed0){return BPromise[_0x449a('0x23')](_0x320ed0);}return _0x5814d0[_0x449a('0x24')]();};}function saveUpdates(_0x2c8ee4,_0x30a8a6){return function(_0xa92b55){if(_0xa92b55){return _0xa92b55[_0x449a('0x25')](_0x2c8ee4)['then'](function(_0x5edaec){return _0x5edaec;});}return null;};}function removeEntity(_0xbe6427,_0x3a463f){return function(_0x1816b4){if(_0x1816b4){return _0x1816b4[_0x449a('0x26')]()['then'](function(){_0xbe6427['status'](0xcc)[_0x449a('0x1a')]();});}};}function handleEntityNotFound(_0x22c351,_0x2abd12){return function(_0x7ea7c){if(!_0x7ea7c){_0x22c351[_0x449a('0x18')](0x194);}return _0x7ea7c;};}function handleError(_0x687252,_0x105a75){_0x105a75=_0x105a75||0x1f4;return function(_0xa9aa42){logger[_0x449a('0x27')](_0xa9aa42[_0x449a('0x28')]);if(_0xa9aa42['name']){delete _0xa9aa42['name'];}_0x687252[_0x449a('0x19')](_0x105a75)['send'](_0xa9aa42);};}exports[_0x449a('0x29')]=function(_0xc33b67,_0x95e653){var _0x49a13d={},_0x46aafc={},_0x4ad300={'count':0x0,'rows':[]};var _0x262cad=_[_0x449a('0x2a')](db[_0x449a('0x2b')][_0x449a('0x2c')],function(_0x28568b){return{'name':_0x28568b['fieldName'],'type':_0x28568b['type'][_0x449a('0x2d')]};});_0x46aafc['model']=_[_0x449a('0x2a')](_0x262cad,_0x449a('0x2e'));_0x46aafc[_0x449a('0x2f')]=_['keys'](_0xc33b67['query']);_0x46aafc[_0x449a('0x30')]=_['intersection'](_0x46aafc[_0x449a('0x31')],_0x46aafc[_0x449a('0x2f')]);_0x49a13d[_0x449a('0x32')]=_[_0x449a('0x33')](_0x46aafc[_0x449a('0x31')],qs['fields'](_0xc33b67['query'][_0x449a('0x34')]));_0x49a13d[_0x449a('0x32')]=_0x49a13d[_0x449a('0x32')][_0x449a('0x35')]?_0x49a13d[_0x449a('0x32')]:_0x46aafc[_0x449a('0x31')];if(!_0xc33b67[_0x449a('0x2f')][_0x449a('0x36')]('nolimit')){_0x49a13d[_0x449a('0x1e')]=qs['limit'](_0xc33b67['query'][_0x449a('0x1e')]);_0x49a13d[_0x449a('0x1c')]=qs['offset'](_0xc33b67[_0x449a('0x2f')][_0x449a('0x1c')]);}_0x49a13d['order']=qs['sort'](_0xc33b67[_0x449a('0x2f')][_0x449a('0x37')]);_0x49a13d['where']=qs[_0x449a('0x30')](_['pick'](_0xc33b67['query'],_0x46aafc[_0x449a('0x30')]),_0x262cad);if(_0xc33b67[_0x449a('0x2f')][_0x449a('0x38')]){_0x49a13d['where']=_['merge'](_0x49a13d[_0x449a('0x39')],{'$or':_['map'](_0x262cad,function(_0x3b734f){if(_0x3b734f[_0x449a('0x3a')]!==_0x449a('0x3b')){var _0x1dbc6b={};_0x1dbc6b[_0x3b734f[_0x449a('0x2e')]]={'$like':'%'+_0xc33b67['query']['filter']+'%'};return _0x1dbc6b;}})});}_0x49a13d=_['merge']({},_0x49a13d,_0xc33b67[_0x449a('0x3c')]);var _0x135895={'where':_0x49a13d[_0x449a('0x39')]};return db[_0x449a('0x2b')][_0x449a('0x1f')](_0x135895)['then'](function(_0x315844){_0x4ad300['count']=_0x315844;if(_0xc33b67[_0x449a('0x2f')][_0x449a('0x3d')]){_0x49a13d['include']=[{'all':!![]}];}return db[_0x449a('0x2b')][_0x449a('0x3e')](_0x49a13d);})[_0x449a('0x3f')](function(_0x886b7b){_0x4ad300[_0x449a('0x40')]=_0x886b7b;return _0x4ad300;})['then'](respondWithFilteredResult(_0x95e653,_0x49a13d))[_0x449a('0x41')](handleError(_0x95e653,null));};exports[_0x449a('0x42')]=function(_0x675f69,_0x50cc6a){var _0x4b1642={'raw':!![],'where':{'id':_0x675f69[_0x449a('0x43')]['id']}},_0x37abfe={};_0x37abfe[_0x449a('0x31')]=_['keys'](db['MailTransferReport'][_0x449a('0x2c')]);_0x37abfe['query']=_[_0x449a('0x44')](_0x675f69[_0x449a('0x2f')]);_0x37abfe['filters']=_['intersection'](_0x37abfe[_0x449a('0x31')],_0x37abfe[_0x449a('0x2f')]);_0x4b1642['attributes']=_[_0x449a('0x33')](_0x37abfe[_0x449a('0x31')],qs['fields'](_0x675f69['query'][_0x449a('0x34')]));_0x4b1642[_0x449a('0x32')]=_0x4b1642[_0x449a('0x32')][_0x449a('0x35')]?_0x4b1642[_0x449a('0x32')]:_0x37abfe[_0x449a('0x31')];if(_0x675f69[_0x449a('0x2f')][_0x449a('0x3d')]){_0x4b1642['include']=[{'all':!![]}];}_0x4b1642=_[_0x449a('0x45')]({},_0x4b1642,_0x675f69['options']);return db['MailTransferReport'][_0x449a('0x46')](_0x4b1642)[_0x449a('0x3f')](handleEntityNotFound(_0x50cc6a,null))[_0x449a('0x3f')](respondWithResult(_0x50cc6a,null))['catch'](handleError(_0x50cc6a,null));};exports[_0x449a('0x47')]=function(_0x154ab2,_0x18da4f){return db[_0x449a('0x2b')][_0x449a('0x47')](_0x154ab2[_0x449a('0x48')],{})['then'](respondWithResult(_0x18da4f,0xc9))[_0x449a('0x41')](handleError(_0x18da4f,null));};exports[_0x449a('0x25')]=function(_0x27c4ce,_0x272541){if(_0x27c4ce['body']['id']){delete _0x27c4ce[_0x449a('0x48')]['id'];}return db[_0x449a('0x2b')][_0x449a('0x46')]({'where':{'id':_0x27c4ce[_0x449a('0x43')]['id']}})[_0x449a('0x3f')](handleEntityNotFound(_0x272541,null))['then'](saveUpdates(_0x27c4ce[_0x449a('0x48')],null))[_0x449a('0x3f')](respondWithResult(_0x272541,null))['catch'](handleError(_0x272541,null));};exports['destroy']=function(_0x10e225,_0x330c48){return db['MailTransferReport'][_0x449a('0x46')]({'where':{'id':_0x10e225[_0x449a('0x43')]['id']}})[_0x449a('0x3f')](handleEntityNotFound(_0x330c48,null))[_0x449a('0x3f')](removeEntity(_0x330c48,null))[_0x449a('0x41')](handleError(_0x330c48,null));};exports[_0x449a('0x49')]=function(_0x232789,_0x539490){return db['MailTransferReport'][_0x449a('0x49')]()[_0x449a('0x3f')](respondWithResult(_0x539490,null))[_0x449a('0x41')](handleError(_0x539490,null));}; \ No newline at end of file +var _0x424f=['bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','apply','save','update','then','stack','name','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','keys','length','include','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x13f8b5,_0x34e0e7){var _0x4be74f=function(_0x23e3af){while(--_0x23e3af){_0x13f8b5['push'](_0x13f8b5['shift']());}};_0x4be74f(++_0x34e0e7);}(_0x424f,0x112));var _0xf424=function(_0x4b54fe,_0x1f349c){_0x4b54fe=_0x4b54fe-0x0;var _0x34db85=_0x424f[_0x4b54fe];return _0x34db85;};'use strict';var emlformat=require(_0xf424('0x0'));var rimraf=require(_0xf424('0x1'));var zipdir=require(_0xf424('0x2'));var jsonpatch=require(_0xf424('0x3'));var rp=require(_0xf424('0x4'));var moment=require(_0xf424('0x5'));var BPromise=require(_0xf424('0x6'));var Mustache=require('mustache');var util=require(_0xf424('0x7'));var path=require(_0xf424('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf424('0x9'));var _=require(_0xf424('0xa'));var squel=require(_0xf424('0xb'));var crypto=require(_0xf424('0xc'));var jsforce=require(_0xf424('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf424('0xe'));var Papa=require('papaparse');var Redis=require(_0xf424('0xf'));var authService=require(_0xf424('0x10'));var qs=require(_0xf424('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf424('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf424('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf424('0x14'))['db'];function respondWithStatusCode(_0x3bec86,_0x10d14f){_0x10d14f=_0x10d14f||0xcc;return function(_0x106668){if(_0x106668){return _0x3bec86[_0xf424('0x15')](_0x10d14f);}return _0x3bec86['status'](_0x10d14f)[_0xf424('0x16')]();};}function respondWithResult(_0x2031e2,_0x59f734){_0x59f734=_0x59f734||0xc8;return function(_0x424605){if(_0x424605){return _0x2031e2['status'](_0x59f734)[_0xf424('0x17')](_0x424605);}};}function respondWithFilteredResult(_0x1b4592,_0x274004){return function(_0x5dd97f){if(_0x5dd97f){var _0x2e887d=typeof _0x274004['offset']===_0xf424('0x18')&&typeof _0x274004[_0xf424('0x19')]===_0xf424('0x18');var _0x207d5c=_0x5dd97f[_0xf424('0x1a')];var _0x5d004d=_0x2e887d?0x0:_0x274004['offset'];var _0x10a179=_0x2e887d?_0x5dd97f['count']:_0x274004[_0xf424('0x1b')]+_0x274004['limit'];var _0x254a34;if(_0x10a179>=_0x207d5c){_0x10a179=_0x207d5c;_0x254a34=0xc8;}else{_0x254a34=0xce;}_0x1b4592[_0xf424('0x1c')](_0x254a34);return _0x1b4592['set'](_0xf424('0x1d'),_0x5d004d+'-'+_0x10a179+'/'+_0x207d5c)[_0xf424('0x17')](_0x5dd97f);}return null;};}function patchUpdates(_0x3bc3c7){return function(_0x4c045e){try{jsonpatch[_0xf424('0x1e')](_0x4c045e,_0x3bc3c7,!![]);}catch(_0x32f5ef){return BPromise['reject'](_0x32f5ef);}return _0x4c045e[_0xf424('0x1f')]();};}function saveUpdates(_0x17d60e,_0x26423f){return function(_0x20824e){if(_0x20824e){return _0x20824e[_0xf424('0x20')](_0x17d60e)[_0xf424('0x21')](function(_0x1630ab){return _0x1630ab;});}return null;};}function removeEntity(_0x2fb58d,_0x553677){return function(_0x1b4011){if(_0x1b4011){return _0x1b4011['destroy']()[_0xf424('0x21')](function(){_0x2fb58d['status'](0xcc)[_0xf424('0x16')]();});}};}function handleEntityNotFound(_0x2675dc,_0x4dc0fe){return function(_0x247a56){if(!_0x247a56){_0x2675dc[_0xf424('0x15')](0x194);}return _0x247a56;};}function handleError(_0x5285a0,_0x383135){_0x383135=_0x383135||0x1f4;return function(_0x14f372){logger['error'](_0x14f372[_0xf424('0x22')]);if(_0x14f372[_0xf424('0x23')]){delete _0x14f372['name'];}_0x5285a0['status'](_0x383135)['send'](_0x14f372);};}exports['index']=function(_0x531299,_0x404c7f){var _0x283abe={},_0x3729cd={},_0xd158f0={'count':0x0,'rows':[]};var _0x4986a9=_[_0xf424('0x24')](db[_0xf424('0x25')][_0xf424('0x26')],function(_0x5bcedd){return{'name':_0x5bcedd[_0xf424('0x27')],'type':_0x5bcedd[_0xf424('0x28')][_0xf424('0x29')]};});_0x3729cd[_0xf424('0x2a')]=_[_0xf424('0x24')](_0x4986a9,_0xf424('0x23'));_0x3729cd[_0xf424('0x2b')]=_['keys'](_0x531299['query']);_0x3729cd['filters']=_['intersection'](_0x3729cd[_0xf424('0x2a')],_0x3729cd[_0xf424('0x2b')]);_0x283abe[_0xf424('0x2c')]=_[_0xf424('0x2d')](_0x3729cd['model'],qs['fields'](_0x531299[_0xf424('0x2b')][_0xf424('0x2e')]));_0x283abe['attributes']=_0x283abe[_0xf424('0x2c')]['length']?_0x283abe[_0xf424('0x2c')]:_0x3729cd[_0xf424('0x2a')];if(!_0x531299['query'][_0xf424('0x2f')](_0xf424('0x30'))){_0x283abe[_0xf424('0x19')]=qs[_0xf424('0x19')](_0x531299['query'][_0xf424('0x19')]);_0x283abe[_0xf424('0x1b')]=qs[_0xf424('0x1b')](_0x531299['query'][_0xf424('0x1b')]);}_0x283abe['order']=qs['sort'](_0x531299[_0xf424('0x2b')][_0xf424('0x31')]);_0x283abe[_0xf424('0x32')]=qs[_0xf424('0x33')](_[_0xf424('0x34')](_0x531299[_0xf424('0x2b')],_0x3729cd['filters']),_0x4986a9);if(_0x531299[_0xf424('0x2b')]['filter']){_0x283abe[_0xf424('0x32')]=_[_0xf424('0x35')](_0x283abe[_0xf424('0x32')],{'$or':_[_0xf424('0x24')](_0x4986a9,function(_0x5a1715){if(_0x5a1715[_0xf424('0x28')]!==_0xf424('0x36')){var _0x908544={};_0x908544[_0x5a1715['name']]={'$like':'%'+_0x531299[_0xf424('0x2b')][_0xf424('0x37')]+'%'};return _0x908544;}})});}_0x283abe=_[_0xf424('0x35')]({},_0x283abe,_0x531299['options']);var _0x46081b={'where':_0x283abe[_0xf424('0x32')]};return db[_0xf424('0x25')][_0xf424('0x1a')](_0x46081b)['then'](function(_0x152b65){_0xd158f0['count']=_0x152b65;if(_0x531299[_0xf424('0x2b')][_0xf424('0x38')]){_0x283abe['include']=[{'all':!![]}];}return db[_0xf424('0x25')][_0xf424('0x39')](_0x283abe);})[_0xf424('0x21')](function(_0x1dd8ee){_0xd158f0[_0xf424('0x3a')]=_0x1dd8ee;return _0xd158f0;})[_0xf424('0x21')](respondWithFilteredResult(_0x404c7f,_0x283abe))['catch'](handleError(_0x404c7f,null));};exports[_0xf424('0x3b')]=function(_0x4c82d7,_0x11c4fa){var _0x34663c={'raw':!![],'where':{'id':_0x4c82d7[_0xf424('0x3c')]['id']}},_0x4db094={};_0x4db094[_0xf424('0x2a')]=_[_0xf424('0x3d')](db[_0xf424('0x25')][_0xf424('0x26')]);_0x4db094[_0xf424('0x2b')]=_[_0xf424('0x3d')](_0x4c82d7[_0xf424('0x2b')]);_0x4db094['filters']=_[_0xf424('0x2d')](_0x4db094[_0xf424('0x2a')],_0x4db094[_0xf424('0x2b')]);_0x34663c[_0xf424('0x2c')]=_[_0xf424('0x2d')](_0x4db094[_0xf424('0x2a')],qs[_0xf424('0x2e')](_0x4c82d7[_0xf424('0x2b')][_0xf424('0x2e')]));_0x34663c[_0xf424('0x2c')]=_0x34663c['attributes'][_0xf424('0x3e')]?_0x34663c[_0xf424('0x2c')]:_0x4db094[_0xf424('0x2a')];if(_0x4c82d7['query']['includeAll']){_0x34663c[_0xf424('0x3f')]=[{'all':!![]}];}_0x34663c=_[_0xf424('0x35')]({},_0x34663c,_0x4c82d7[_0xf424('0x40')]);return db['MailTransferReport'][_0xf424('0x41')](_0x34663c)[_0xf424('0x21')](handleEntityNotFound(_0x11c4fa,null))[_0xf424('0x21')](respondWithResult(_0x11c4fa,null))[_0xf424('0x42')](handleError(_0x11c4fa,null));};exports[_0xf424('0x43')]=function(_0x1c61f7,_0x4c575d){return db[_0xf424('0x25')]['create'](_0x1c61f7[_0xf424('0x44')],{})[_0xf424('0x21')](respondWithResult(_0x4c575d,0xc9))[_0xf424('0x42')](handleError(_0x4c575d,null));};exports['update']=function(_0x364fe6,_0x5aaa16){if(_0x364fe6[_0xf424('0x44')]['id']){delete _0x364fe6['body']['id'];}return db[_0xf424('0x25')][_0xf424('0x41')]({'where':{'id':_0x364fe6[_0xf424('0x3c')]['id']}})[_0xf424('0x21')](handleEntityNotFound(_0x5aaa16,null))['then'](saveUpdates(_0x364fe6[_0xf424('0x44')],null))[_0xf424('0x21')](respondWithResult(_0x5aaa16,null))[_0xf424('0x42')](handleError(_0x5aaa16,null));};exports['destroy']=function(_0xe19363,_0x20fde2){return db['MailTransferReport']['find']({'where':{'id':_0xe19363[_0xf424('0x3c')]['id']}})[_0xf424('0x21')](handleEntityNotFound(_0x20fde2,null))[_0xf424('0x21')](removeEntity(_0x20fde2,null))[_0xf424('0x42')](handleError(_0x20fde2,null));};exports['describe']=function(_0x35539a,_0x51ef41){return db[_0xf424('0x25')][_0xf424('0x45')]()[_0xf424('0x21')](respondWithResult(_0x51ef41,null))['catch'](handleError(_0x51ef41,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 2e11910..251433a 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 _0xfbf0=['request-promise','rimraf','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbf0,0x141));var _0x0fbf=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xfbf0[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x0fbf('0x0'));var logger=require(_0x0fbf('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0fbf('0x2'));var rp=require(_0x0fbf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fbf('0x4'));var config=require('../../config/environment');var attributes=require(_0x0fbf('0x5'));module['exports']=function(_0xe258f6,_0x29c1cb){return _0xe258f6['define'](_0x0fbf('0x6'),attributes,{'tableName':_0x0fbf('0x7'),'paranoid':![],'indexes':[{'name':_0x0fbf('0x8'),'fields':[_0x0fbf('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa630=['moment','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x54e840,_0x2e5084){var _0x378f27=function(_0x55bb10){while(--_0x55bb10){_0x54e840['push'](_0x54e840['shift']());}};_0x378f27(++_0x2e5084);}(_0xa630,0xbe));var _0x0a63=function(_0x266e16,_0x4a5c51){_0x266e16=_0x266e16-0x0;var _0x5a8fba=_0xa630[_0x266e16];return _0x5a8fba;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));module[_0x0a63('0x7')]=function(_0x37b4c9,_0x4b7474){return _0x37b4c9[_0x0a63('0x8')](_0x0a63('0x9'),attributes,{'tableName':_0x0a63('0xa'),'paranoid':![],'indexes':[{'name':_0x0a63('0xb'),'fields':[_0x0a63('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a6aa64a..df022cf 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 _0xdf0c=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdf0c,0x86));var _0xcdf0=function(_0x3a4c3e,_0x34e3dc){_0x3a4c3e=_0x3a4c3e-0x0;var _0x43d178=_0xdf0c[_0x3a4c3e];return _0x43d178;};'use strict';var _=require(_0xcdf0('0x0'));var util=require('util');var moment=require(_0xcdf0('0x1'));var BPromise=require('bluebird');var rs=require(_0xcdf0('0x2'));var fs=require('fs');var Redis=require(_0xcdf0('0x3'));var db=require(_0xcdf0('0x4'))['db'];var utils=require(_0xcdf0('0x5'));var logger=require(_0xcdf0('0x6'))(_0xcdf0('0x7'));var config=require(_0xcdf0('0x8'));var jayson=require(_0xcdf0('0x9'));var client=jayson['client'][_0xcdf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x206b11,_0x2e59c1,_0x3a61bb){return new BPromise(function(_0x50232e,_0x34f79b){return client['request'](_0x206b11,_0x3a61bb)[_0xcdf0('0xb')](function(_0x53eb02){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x2e59c1,_0xcdf0('0xc'));logger['debug'](_0xcdf0('0xd'),_0x2e59c1,_0xcdf0('0xc'),JSON[_0xcdf0('0xe')](_0x53eb02));if(_0x53eb02[_0xcdf0('0xf')]){if(_0x53eb02[_0xcdf0('0xf')][_0xcdf0('0x10')]===0x1f4){logger['error'](_0xcdf0('0x11'),_0x2e59c1,_0x53eb02[_0xcdf0('0xf')]['message']);return _0x34f79b(_0x53eb02['error'][_0xcdf0('0x12')]);}logger['error'](_0xcdf0('0x11'),_0x2e59c1,_0x53eb02['error'][_0xcdf0('0x12')]);return _0x50232e(_0x53eb02[_0xcdf0('0xf')][_0xcdf0('0x12')]);}else{logger[_0xcdf0('0x13')](_0xcdf0('0x11'),_0x2e59c1,_0xcdf0('0xc'));_0x50232e(_0x53eb02[_0xcdf0('0x14')][_0xcdf0('0x12')]);}})[_0xcdf0('0x15')](function(_0x392859){logger[_0xcdf0('0xf')](_0xcdf0('0x11'),_0x2e59c1,_0x392859);_0x34f79b(_0x392859);});});} \ No newline at end of file +var _0x1901=['then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3d1c06,_0x30f2e0){var _0x10c6e6=function(_0x42ee29){while(--_0x42ee29){_0x3d1c06['push'](_0x3d1c06['shift']());}};_0x10c6e6(++_0x30f2e0);}(_0x1901,0x67));var _0x1190=function(_0x1c5f32,_0x1ac260){_0x1c5f32=_0x1c5f32-0x0;var _0x3bd1e8=_0x1901[_0x1c5f32];return _0x3bd1e8;};'use strict';var _=require(_0x1190('0x0'));var util=require(_0x1190('0x1'));var moment=require(_0x1190('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1190('0x3'));var db=require(_0x1190('0x4'))['db'];var utils=require(_0x1190('0x5'));var logger=require('../../config/logger')(_0x1190('0x6'));var config=require(_0x1190('0x7'));var jayson=require(_0x1190('0x8'));var client=jayson[_0x1190('0x9')][_0x1190('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11562a,_0x1e6d42,_0x2775e8){return new BPromise(function(_0x5438c4,_0x3294d4){return client[_0x1190('0xb')](_0x11562a,_0x2775e8)[_0x1190('0xc')](function(_0x48251f){logger[_0x1190('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x1e6d42,_0x1190('0xe'));logger[_0x1190('0xf')](_0x1190('0x10'),_0x1e6d42,'request\x20sent',JSON['stringify'](_0x48251f));if(_0x48251f[_0x1190('0x11')]){if(_0x48251f[_0x1190('0x11')][_0x1190('0x12')]===0x1f4){logger[_0x1190('0x11')](_0x1190('0x13'),_0x1e6d42,_0x48251f[_0x1190('0x11')][_0x1190('0x14')]);return _0x3294d4(_0x48251f[_0x1190('0x11')]['message']);}logger[_0x1190('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x1e6d42,_0x48251f['error'][_0x1190('0x14')]);return _0x5438c4(_0x48251f[_0x1190('0x11')][_0x1190('0x14')]);}else{logger[_0x1190('0xd')](_0x1190('0x13'),_0x1e6d42,_0x1190('0xe'));_0x5438c4(_0x48251f[_0x1190('0x15')]['message']);}})[_0x1190('0x16')](function(_0x4e36f2){logger[_0x1190('0x11')](_0x1190('0x13'),_0x1e6d42,_0x4e36f2);_0x3294d4(_0x4e36f2);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 80d2b7a..9bd1f5f 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 _0xdb13=['index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0xdb13,0x13a));var _0x3db1=function(_0x321c71,_0x34b784){_0x321c71=_0x321c71-0x0;var _0x167f3c=_0xdb13[_0x321c71];return _0x167f3c;};'use strict';var multer=require(_0x3db1('0x0'));var util=require(_0x3db1('0x1'));var path=require(_0x3db1('0x2'));var timeout=require(_0x3db1('0x3'));var express=require('express');var router=express[_0x3db1('0x4')]();var fs_extra=require(_0x3db1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3db1('0x6'));var config=require(_0x3db1('0x7'));var controller=require('./memberReport.controller');router[_0x3db1('0x8')]('/',auth['isAuthenticated'](),controller[_0x3db1('0x9')]);router[_0x3db1('0x8')](_0x3db1('0xa'),auth[_0x3db1('0xb')](),controller['describe']);router[_0x3db1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3db1('0xc')]);router[_0x3db1('0xd')]('/',auth[_0x3db1('0xb')](),controller[_0x3db1('0xe')]);router[_0x3db1('0xf')](_0x3db1('0x10'),auth['isAuthenticated'](),controller[_0x3db1('0x11')]);router[_0x3db1('0x12')](_0x3db1('0x10'),auth[_0x3db1('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb9c7=['index','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated'];(function(_0x497fdb,_0x2a847a){var _0x1a9cc9=function(_0x2bd750){while(--_0x2bd750){_0x497fdb['push'](_0x497fdb['shift']());}};_0x1a9cc9(++_0x2a847a);}(_0xb9c7,0x1bd));var _0x7b9c=function(_0x65aa6f,_0x2d2eca){_0x65aa6f=_0x65aa6f-0x0;var _0x3af945=_0xb9c7[_0x65aa6f];return _0x3af945;};'use strict';var multer=require(_0x7b9c('0x0'));var util=require('util');var path=require(_0x7b9c('0x1'));var timeout=require(_0x7b9c('0x2'));var express=require(_0x7b9c('0x3'));var router=express[_0x7b9c('0x4')]();var fs_extra=require(_0x7b9c('0x5'));var auth=require(_0x7b9c('0x6'));var interaction=require(_0x7b9c('0x7'));var config=require('../../config/environment');var controller=require(_0x7b9c('0x8'));router[_0x7b9c('0x9')]('/',auth[_0x7b9c('0xa')](),controller[_0x7b9c('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x7b9c('0xc'),auth['isAuthenticated'](),controller[_0x7b9c('0xd')]);router[_0x7b9c('0xe')]('/',auth[_0x7b9c('0xa')](),controller[_0x7b9c('0xf')]);router['put'](_0x7b9c('0xc'),auth[_0x7b9c('0xa')](),controller[_0x7b9c('0x10')]);router[_0x7b9c('0x11')](_0x7b9c('0xc'),auth[_0x7b9c('0xa')](),controller[_0x7b9c('0x12')]);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 5ff317e..0b35259 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 _0x1978=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x1978,0x174));var _0x8197=function(_0x58e99b,_0xaca037){_0x58e99b=_0x58e99b-0x0;var _0xf539bd=_0x1978[_0x58e99b];return _0xf539bd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8197('0x0'));module[_0x8197('0x1')]={'channel':{'type':Sequelize[_0x8197('0x2')]},'membername':{'type':Sequelize[_0x8197('0x2')]},'interface':{'type':Sequelize[_0x8197('0x2')]},'type':{'type':Sequelize[_0x8197('0x2')],'defaultValue':_0x8197('0x3'),'comment':_0x8197('0x4')},'duration':{'type':Sequelize[_0x8197('0x5')]},'enterAt':{'type':Sequelize[_0x8197('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x215d3c){var _0x1556ad=moment(_0x215d3c);var _0x117bf1=moment(this[_0x8197('0x7')](_0x8197('0x8')));var _0x1bc265=_0x1556ad[_0x8197('0x9')](_0x117bf1,_0x8197('0xa'));this[_0x8197('0xb')](_0x8197('0xc'),_0x215d3c);this[_0x8197('0xb')](_0x8197('0xd'),_0x1bc265||null);}},'data1':{'type':Sequelize[_0x8197('0x2')],'comment':_0x8197('0xe')},'data2':{'type':Sequelize[_0x8197('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x8197('0x2')],'comment':_0x8197('0xf')},'data4':{'type':Sequelize[_0x8197('0x2')],'comment':_0x8197('0x10')},'data5':{'type':Sequelize[_0x8197('0x2')],'comment':_0x8197('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8197('0x2')]}}; \ No newline at end of file +var _0x5620=['exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x5620,0xbf));var _0x0562=function(_0x456904,_0x4cb25c){_0x456904=_0x456904-0x0;var _0x4b0063=_0x5620[_0x456904];return _0x4b0063;};'use strict';var Sequelize=require(_0x0562('0x0'));var moment=require('moment');module[_0x0562('0x1')]={'channel':{'type':Sequelize[_0x0562('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x0562('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x0562('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0562('0x5')],'set':function(_0x39ab9a){var _0x4155b9=moment(_0x39ab9a);var _0x24b8d1=moment(this[_0x0562('0x6')](_0x0562('0x7')));var _0x5f47ba=_0x4155b9['diff'](_0x24b8d1,_0x0562('0x8'));this['setDataValue'](_0x0562('0x9'),_0x39ab9a);this[_0x0562('0xa')](_0x0562('0xb'),_0x5f47ba||null);}},'data1':{'type':Sequelize[_0x0562('0x2')],'comment':_0x0562('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x0562('0xd')},'data3':{'type':Sequelize[_0x0562('0x2')],'comment':_0x0562('0xe')},'data4':{'type':Sequelize[_0x0562('0x2')],'comment':_0x0562('0xf')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x0562('0x2')]},'internal':{'type':Sequelize[_0x0562('0x4')]},'uniqueid':{'type':Sequelize[_0x0562('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 11c987f..80e6184 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x3b9c71,_0x52bd2f){var _0x419087=function(_0x474819){while(--_0x474819){_0x3b9c71['push'](_0x3b9c71['shift']());}};_0x419087(++_0x52bd2f);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xedd9,0xfc));var _0x9edd=function(_0x12aebc,_0x5de7fe){_0x12aebc=_0x12aebc-0x0;var _0xe5a6ce=_0xedd9[_0x12aebc];return _0xe5a6ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1a8747a..b35522c 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 _0xdc1a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','interface','util'];(function(_0x277492,_0x199fd1){var _0x4b8c46=function(_0x19f8dd){while(--_0x19f8dd){_0x277492['push'](_0x277492['shift']());}};_0x4b8c46(++_0x199fd1);}(_0xdc1a,0x133));var _0xadc1=function(_0x3eee30,_0x58080c){_0x3eee30=_0x3eee30-0x0;var _0x3c96ad=_0xdc1a[_0x3eee30];return _0x3c96ad;};'use strict';var _=require('lodash');var util=require(_0xadc1('0x0'));var logger=require('../../config/logger')(_0xadc1('0x1'));var moment=require(_0xadc1('0x2'));var BPromise=require(_0xadc1('0x3'));var rp=require(_0xadc1('0x4'));var fs=require('fs');var path=require(_0xadc1('0x5'));var rimraf=require(_0xadc1('0x6'));var config=require(_0xadc1('0x7'));var attributes=require(_0xadc1('0x8'));module[_0xadc1('0x9')]=function(_0x14fd14,_0x379bce){return _0x14fd14[_0xadc1('0xa')]('MemberReport',attributes,{'tableName':_0xadc1('0xb'),'paranoid':![],'indexes':[{'name':_0xadc1('0xc'),'fields':['membername',_0xadc1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2175=['util','api','request-promise','path','rimraf','../../config/environment','exports','define','report_member','membername_interface','membername','lodash'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x2175,0xa7));var _0x5217=function(_0x489a7f,_0x39f566){_0x489a7f=_0x489a7f-0x0;var _0x13f220=_0x2175[_0x489a7f];return _0x13f220;};'use strict';var _=require(_0x5217('0x0'));var util=require(_0x5217('0x1'));var logger=require('../../config/logger')(_0x5217('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5217('0x3'));var fs=require('fs');var path=require(_0x5217('0x4'));var rimraf=require(_0x5217('0x5'));var config=require(_0x5217('0x6'));var attributes=require('./memberReport.attributes');module[_0x5217('0x7')]=function(_0x416d3b,_0x4b112f){return _0x416d3b[_0x5217('0x8')]('MemberReport',attributes,{'tableName':_0x5217('0x9'),'paranoid':![],'indexes':[{'name':_0x5217('0xa'),'fields':[_0x5217('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index bfecbe0..3307f80 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 _0x254a=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','MemberReport','findAll','options','where','attributes','include','map','model','then','GetMemberReport','CreateMemberReport','create','body','raw','UpdateMemberReport','limit'];(function(_0x1e685f,_0x1af97b){var _0x310cd0=function(_0x250836){while(--_0x250836){_0x1e685f['push'](_0x1e685f['shift']());}};_0x310cd0(++_0x1af97b);}(_0x254a,0x138));var _0xa254=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x254a[_0x163040];return _0x364667;};'use strict';var _=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var moment=require(_0xa254('0x2'));var BPromise=require('bluebird');var rs=require(_0xa254('0x3'));var fs=require('fs');var Redis=require(_0xa254('0x4'));var db=require(_0xa254('0x5'))['db'];var utils=require(_0xa254('0x6'));var logger=require('../../config/logger')(_0xa254('0x7'));var config=require('../../config/environment');var jayson=require(_0xa254('0x8'));var client=jayson[_0xa254('0x9')][_0xa254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597d72,_0x5951b2,_0xaeed42){return new BPromise(function(_0x352a44,_0x50c5a3){return client[_0xa254('0xb')](_0x597d72,_0xaeed42)['then'](function(_0x19d140){logger[_0xa254('0xc')]('MemberReport,\x20%s,\x20%s',_0x5951b2,'request\x20sent');logger[_0xa254('0xd')](_0xa254('0xe'),_0x5951b2,_0xa254('0xf'),JSON[_0xa254('0x10')](_0x19d140));if(_0x19d140[_0xa254('0x11')]){if(_0x19d140['error'][_0xa254('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x5951b2,_0x19d140[_0xa254('0x11')][_0xa254('0x13')]);return _0x50c5a3(_0x19d140['error'][_0xa254('0x13')]);}logger[_0xa254('0x11')](_0xa254('0x14'),_0x5951b2,_0x19d140[_0xa254('0x11')][_0xa254('0x13')]);return _0x352a44(_0x19d140['error'][_0xa254('0x13')]);}else{logger[_0xa254('0xc')](_0xa254('0x14'),_0x5951b2,_0xa254('0xf'));_0x352a44(_0x19d140[_0xa254('0x15')][_0xa254('0x13')]);}})[_0xa254('0x16')](function(_0x1f21ae){logger[_0xa254('0x11')]('MemberReport,\x20%s,\x20%s',_0x5951b2,_0x1f21ae);_0x50c5a3(_0x1f21ae);});});}exports['GetMemberReport']=function(_0x4a249f){var _0x34c9fe=this;return new Promise(function(_0x2dcf3a,_0x31ec79){return db[_0xa254('0x17')][_0xa254('0x18')]({'raw':_0x4a249f[_0xa254('0x19')]?_0x4a249f[_0xa254('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4a249f[_0xa254('0x19')]?_0x4a249f['options'][_0xa254('0x1a')]||null:null,'attributes':_0x4a249f[_0xa254('0x19')]?_0x4a249f['options'][_0xa254('0x1b')]||null:null,'limit':_0x4a249f[_0xa254('0x19')]?_0x4a249f['options']['limit']||null:null,'include':_0x4a249f[_0xa254('0x19')]?_0x4a249f[_0xa254('0x19')][_0xa254('0x1c')]?_['map'](_0x4a249f[_0xa254('0x19')][_0xa254('0x1c')],function(_0x446ba9){return{'model':db[_0x446ba9['model']],'as':_0x446ba9['as'],'attributes':_0x446ba9['attributes'],'include':_0x446ba9[_0xa254('0x1c')]?_[_0xa254('0x1d')](_0x446ba9[_0xa254('0x1c')],function(_0x413016){return{'model':db[_0x413016['model']],'as':_0x413016['as'],'attributes':_0x413016[_0xa254('0x1b')],'include':_0x413016[_0xa254('0x1c')]?_[_0xa254('0x1d')](_0x413016[_0xa254('0x1c')],function(_0x3e3041){return{'model':db[_0x3e3041[_0xa254('0x1e')]],'as':_0x3e3041['as'],'attributes':_0x3e3041[_0xa254('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa254('0x1f')](function(_0x336d55){logger['info'](_0xa254('0x20'),_0x4a249f);logger[_0xa254('0xd')](_0xa254('0x20'),_0x4a249f,JSON[_0xa254('0x10')](_0x336d55));_0x2dcf3a(_0x336d55);})[_0xa254('0x16')](function(_0x5c9e28){logger[_0xa254('0x11')](_0xa254('0x20'),_0x5c9e28[_0xa254('0x13')],_0x4a249f);_0x31ec79(_0x34c9fe[_0xa254('0x11')](0x1f4,_0x5c9e28['message']));});});};exports[_0xa254('0x21')]=function(_0x3c8f5a){var _0x22246b=this;return new Promise(function(_0x5a6369,_0x1dd29e){return db[_0xa254('0x17')][_0xa254('0x22')](_0x3c8f5a[_0xa254('0x23')],{'raw':_0x3c8f5a['options']?_0x3c8f5a[_0xa254('0x19')][_0xa254('0x24')]===undefined?!![]:![]:!![]})[_0xa254('0x1f')](function(_0x63f742){logger['info'](_0xa254('0x21'),_0x3c8f5a);logger[_0xa254('0xd')](_0xa254('0x21'),_0x3c8f5a,JSON['stringify'](_0x63f742));_0x5a6369(_0x63f742);})[_0xa254('0x16')](function(_0x1a53b7){logger[_0xa254('0x11')]('CreateMemberReport',_0x1a53b7[_0xa254('0x13')],_0x3c8f5a);_0x1dd29e(_0x22246b[_0xa254('0x11')](0x1f4,_0x1a53b7[_0xa254('0x13')]));});});};exports[_0xa254('0x25')]=function(_0xf54c59){var _0x667f32=this;return new Promise(function(_0x1f37df,_0x26bfd6){return db[_0xa254('0x17')]['update'](_0xf54c59['body'],{'raw':_0xf54c59[_0xa254('0x19')]?_0xf54c59[_0xa254('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf54c59[_0xa254('0x19')]?_0xf54c59['options']['where']||null:null,'attributes':_0xf54c59[_0xa254('0x19')]?_0xf54c59[_0xa254('0x19')][_0xa254('0x1b')]||null:null,'limit':_0xf54c59[_0xa254('0x19')]?_0xf54c59['options'][_0xa254('0x26')]||null:null})[_0xa254('0x1f')](function(_0x1c7982){logger[_0xa254('0xc')](_0xa254('0x25'),_0xf54c59);logger[_0xa254('0xd')](_0xa254('0x25'),_0xf54c59,JSON[_0xa254('0x10')](_0x1c7982));_0x1f37df(_0x1c7982);})[_0xa254('0x16')](function(_0x38f124){logger[_0xa254('0x11')](_0xa254('0x25'),_0x38f124[_0xa254('0x13')],_0xf54c59);_0x26bfd6(_0x667f32['error'](0x1f4,_0x38f124['message']));});});}; \ No newline at end of file +var _0xf1c6=['body','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','where','limit','include','map','model','attributes','then','debug','stringify','CreateMemberReport','create','raw','UpdateMemberReport'];(function(_0xdc3acc,_0x1da7c0){var _0x479901=function(_0x8a86b6){while(--_0x8a86b6){_0xdc3acc['push'](_0xdc3acc['shift']());}};_0x479901(++_0x1da7c0);}(_0xf1c6,0x145));var _0x6f1c=function(_0x32ef60,_0x2ca599){_0x32ef60=_0x32ef60-0x0;var _0x5cfaac=_0xf1c6[_0x32ef60];return _0x5cfaac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f1c('0x0'));var BPromise=require(_0x6f1c('0x1'));var rs=require(_0x6f1c('0x2'));var fs=require('fs');var Redis=require(_0x6f1c('0x3'));var db=require(_0x6f1c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6f1c('0x5'));var config=require('../../config/environment');var jayson=require(_0x6f1c('0x6'));var client=jayson[_0x6f1c('0x7')][_0x6f1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x537c4f,_0x1c1751,_0x564a8f){return new BPromise(function(_0x275f11,_0x2d8ce2){return client[_0x6f1c('0x9')](_0x537c4f,_0x564a8f)['then'](function(_0x2f5ff0){logger['info'](_0x6f1c('0xa'),_0x1c1751,_0x6f1c('0xb'));logger['debug'](_0x6f1c('0xc'),_0x1c1751,_0x6f1c('0xb'),JSON['stringify'](_0x2f5ff0));if(_0x2f5ff0['error']){if(_0x2f5ff0['error']['code']===0x1f4){logger[_0x6f1c('0xd')]('MemberReport,\x20%s,\x20%s',_0x1c1751,_0x2f5ff0['error']['message']);return _0x2d8ce2(_0x2f5ff0['error']['message']);}logger[_0x6f1c('0xd')](_0x6f1c('0xa'),_0x1c1751,_0x2f5ff0[_0x6f1c('0xd')]['message']);return _0x275f11(_0x2f5ff0[_0x6f1c('0xd')][_0x6f1c('0xe')]);}else{logger[_0x6f1c('0xf')]('MemberReport,\x20%s,\x20%s',_0x1c1751,_0x6f1c('0xb'));_0x275f11(_0x2f5ff0[_0x6f1c('0x10')]['message']);}})[_0x6f1c('0x11')](function(_0x11bc81){logger[_0x6f1c('0xd')](_0x6f1c('0xa'),_0x1c1751,_0x11bc81);_0x2d8ce2(_0x11bc81);});});}exports[_0x6f1c('0x12')]=function(_0x16d2bb){var _0x491151=this;return new Promise(function(_0x2f9949,_0x6035da){return db[_0x6f1c('0x13')][_0x6f1c('0x14')]({'raw':_0x16d2bb[_0x6f1c('0x15')]?_0x16d2bb[_0x6f1c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x16d2bb['options']?_0x16d2bb['options'][_0x6f1c('0x16')]||null:null,'attributes':_0x16d2bb['options']?_0x16d2bb[_0x6f1c('0x15')]['attributes']||null:null,'limit':_0x16d2bb[_0x6f1c('0x15')]?_0x16d2bb[_0x6f1c('0x15')][_0x6f1c('0x17')]||null:null,'include':_0x16d2bb[_0x6f1c('0x15')]?_0x16d2bb[_0x6f1c('0x15')][_0x6f1c('0x18')]?_[_0x6f1c('0x19')](_0x16d2bb[_0x6f1c('0x15')][_0x6f1c('0x18')],function(_0x18ff09){return{'model':db[_0x18ff09[_0x6f1c('0x1a')]],'as':_0x18ff09['as'],'attributes':_0x18ff09[_0x6f1c('0x1b')],'include':_0x18ff09[_0x6f1c('0x18')]?_[_0x6f1c('0x19')](_0x18ff09['include'],function(_0x2a3b6a){return{'model':db[_0x2a3b6a[_0x6f1c('0x1a')]],'as':_0x2a3b6a['as'],'attributes':_0x2a3b6a['attributes'],'include':_0x2a3b6a[_0x6f1c('0x18')]?_[_0x6f1c('0x19')](_0x2a3b6a['include'],function(_0x59931c){return{'model':db[_0x59931c['model']],'as':_0x59931c['as'],'attributes':_0x59931c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f1c('0x1c')](function(_0x1ac9f5){logger[_0x6f1c('0xf')](_0x6f1c('0x12'),_0x16d2bb);logger[_0x6f1c('0x1d')](_0x6f1c('0x12'),_0x16d2bb,JSON[_0x6f1c('0x1e')](_0x1ac9f5));_0x2f9949(_0x1ac9f5);})[_0x6f1c('0x11')](function(_0x32c722){logger[_0x6f1c('0xd')](_0x6f1c('0x12'),_0x32c722[_0x6f1c('0xe')],_0x16d2bb);_0x6035da(_0x491151['error'](0x1f4,_0x32c722['message']));});});};exports[_0x6f1c('0x1f')]=function(_0x4084af){var _0x383802=this;return new Promise(function(_0x26de6c,_0xad1bce){return db['MemberReport'][_0x6f1c('0x20')](_0x4084af['body'],{'raw':_0x4084af[_0x6f1c('0x15')]?_0x4084af['options'][_0x6f1c('0x21')]===undefined?!![]:![]:!![]})[_0x6f1c('0x1c')](function(_0x3c8585){logger[_0x6f1c('0xf')](_0x6f1c('0x1f'),_0x4084af);logger[_0x6f1c('0x1d')](_0x6f1c('0x1f'),_0x4084af,JSON[_0x6f1c('0x1e')](_0x3c8585));_0x26de6c(_0x3c8585);})[_0x6f1c('0x11')](function(_0x46e256){logger['error'](_0x6f1c('0x1f'),_0x46e256[_0x6f1c('0xe')],_0x4084af);_0xad1bce(_0x383802[_0x6f1c('0xd')](0x1f4,_0x46e256[_0x6f1c('0xe')]));});});};exports[_0x6f1c('0x22')]=function(_0x1609e3){var _0x454507=this;return new Promise(function(_0x326f85,_0x2a41ef){return db['MemberReport']['update'](_0x1609e3[_0x6f1c('0x23')],{'raw':_0x1609e3[_0x6f1c('0x15')]?_0x1609e3[_0x6f1c('0x15')][_0x6f1c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1609e3[_0x6f1c('0x15')]?_0x1609e3[_0x6f1c('0x15')][_0x6f1c('0x16')]||null:null,'attributes':_0x1609e3[_0x6f1c('0x15')]?_0x1609e3[_0x6f1c('0x15')][_0x6f1c('0x1b')]||null:null,'limit':_0x1609e3[_0x6f1c('0x15')]?_0x1609e3[_0x6f1c('0x15')][_0x6f1c('0x17')]||null:null})[_0x6f1c('0x1c')](function(_0x1731a4){logger[_0x6f1c('0xf')]('UpdateMemberReport',_0x1609e3);logger['debug'](_0x6f1c('0x22'),_0x1609e3,JSON[_0x6f1c('0x1e')](_0x1731a4));_0x326f85(_0x1731a4);})[_0x6f1c('0x11')](function(_0xa54c4){logger[_0x6f1c('0xd')](_0x6f1c('0x22'),_0xa54c4[_0x6f1c('0xe')],_0x1609e3);_0x2a41ef(_0x454507[_0x6f1c('0xd')](0x1f4,_0xa54c4[_0x6f1c('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4f1cf18..e34faf7 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 _0xdb60=['multer','util','path','connect-timeout','express','Router','../../config/environment','./migration.controller','get','index','exports'];(function(_0x7d1741,_0x34c5a0){var _0x27d25a=function(_0xc32bc3){while(--_0xc32bc3){_0x7d1741['push'](_0x7d1741['shift']());}};_0x27d25a(++_0x34c5a0);}(_0xdb60,0xfd));var _0x0db6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb60[_0x14add3];return _0x4a174f;};'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[_0x0db6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0db6('0x6'));var controller=require(_0x0db6('0x7'));router[_0x0db6('0x8')]('/',controller[_0x0db6('0x9')]);module[_0x0db6('0xa')]=router; \ No newline at end of file +var _0x1335=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','index','exports','multer','util','path','connect-timeout'];(function(_0x3d77b6,_0xb2d446){var _0x4afde3=function(_0x12cbf9){while(--_0x12cbf9){_0x3d77b6['push'](_0x3d77b6['shift']());}};_0x4afde3(++_0xb2d446);}(_0x1335,0x1c4));var _0x5133=function(_0xf5f890,_0x582e71){_0xf5f890=_0xf5f890-0x0;var _0x1cc372=_0x1335[_0xf5f890];return _0x1cc372;};'use strict';var multer=require(_0x5133('0x0'));var util=require(_0x5133('0x1'));var path=require(_0x5133('0x2'));var timeout=require(_0x5133('0x3'));var express=require(_0x5133('0x4'));var router=express[_0x5133('0x5')]();var fs_extra=require(_0x5133('0x6'));var auth=require(_0x5133('0x7'));var interaction=require(_0x5133('0x8'));var config=require('../../config/environment');var controller=require(_0x5133('0x9'));router['get']('/',controller[_0x5133('0xa')]);module[_0x5133('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 6a08c31..b1a3e2d 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 _0xe0a5=['exports','STRING'];(function(_0x84dd81,_0x4870cc){var _0x43792d=function(_0x26b7aa){while(--_0x26b7aa){_0x84dd81['push'](_0x84dd81['shift']());}};_0x43792d(++_0x4870cc);}(_0xe0a5,0x164));var _0x5e0a=function(_0x101076,_0x5c8f3f){_0x101076=_0x101076-0x0;var _0x2d873d=_0xe0a5[_0x101076];return _0x2d873d;};'use strict';var Sequelize=require('sequelize');module[_0x5e0a('0x0')]={'version':{'type':Sequelize[_0x5e0a('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xa4d2=['exports','STRING','version','sequelize'];(function(_0x2551b0,_0x409d49){var _0x2fef11=function(_0x3152e9){while(--_0x3152e9){_0x2551b0['push'](_0x2551b0['shift']());}};_0x2fef11(++_0x409d49);}(_0xa4d2,0x123));var _0x2a4d=function(_0x300dab,_0x3e50ba){_0x300dab=_0x300dab-0x0;var _0x3b96b8=_0xa4d2[_0x300dab];return _0x3b96b8;};'use strict';var Sequelize=require(_0x2a4d('0x0'));module[_0x2a4d('0x1')]={'version':{'type':Sequelize[_0x2a4d('0x2')],'unique':_0x2a4d('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 48cdf2d..b8e8ad5 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 _0x1a69=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x1a69,0x102));var _0x91a6=function(_0x1592af,_0x5ccc38){_0x1592af=_0x1592af-0x0;var _0x3d74da=_0x1a69[_0x1592af];return _0x3d74da;};'use strict';var emlformat=require(_0x91a6('0x0'));var rimraf=require(_0x91a6('0x1'));var zipdir=require(_0x91a6('0x2'));var jsonpatch=require(_0x91a6('0x3'));var rp=require('request-promise');var moment=require(_0x91a6('0x4'));var BPromise=require(_0x91a6('0x5'));var Mustache=require(_0x91a6('0x6'));var util=require('util');var path=require(_0x91a6('0x7'));var sox=require(_0x91a6('0x8'));var csv=require(_0x91a6('0x9'));var ejs=require(_0x91a6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91a6('0xb'));var squel=require(_0x91a6('0xc'));var crypto=require(_0x91a6('0xd'));var jsforce=require(_0x91a6('0xe'));var deskjs=require(_0x91a6('0xf'));var toCsv=require(_0x91a6('0x9'));var querystring=require(_0x91a6('0x10'));var Papa=require(_0x91a6('0x11'));var Redis=require(_0x91a6('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91a6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x91a6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x91a6('0x15'));var db=require(_0x91a6('0x16'))['db'];function respondWithStatusCode(_0x5b778a,_0xbe6fe3){_0xbe6fe3=_0xbe6fe3||0xcc;return function(_0x3dfa15){if(_0x3dfa15){return _0x5b778a[_0x91a6('0x17')](_0xbe6fe3);}return _0x5b778a[_0x91a6('0x18')](_0xbe6fe3)[_0x91a6('0x19')]();};}function respondWithResult(_0x31315a,_0x4a2627){_0x4a2627=_0x4a2627||0xc8;return function(_0x5a5a57){if(_0x5a5a57){return _0x31315a[_0x91a6('0x18')](_0x4a2627)['json'](_0x5a5a57);}};}function respondWithFilteredResult(_0x212964,_0x29c34d){return function(_0xff5722){if(_0xff5722){var _0x50e382=typeof _0x29c34d[_0x91a6('0x1a')]==='undefined'&&typeof _0x29c34d[_0x91a6('0x1b')]===_0x91a6('0x1c');var _0x38cf0a=_0xff5722[_0x91a6('0x1d')];var _0x14d029=_0x50e382?0x0:_0x29c34d[_0x91a6('0x1a')];var _0x4aa59b=_0x50e382?_0xff5722[_0x91a6('0x1d')]:_0x29c34d[_0x91a6('0x1a')]+_0x29c34d[_0x91a6('0x1b')];var _0x1560d3;if(_0x4aa59b>=_0x38cf0a){_0x4aa59b=_0x38cf0a;_0x1560d3=0xc8;}else{_0x1560d3=0xce;}_0x212964[_0x91a6('0x18')](_0x1560d3);return _0x212964[_0x91a6('0x1e')](_0x91a6('0x1f'),_0x14d029+'-'+_0x4aa59b+'/'+_0x38cf0a)['json'](_0xff5722);}return null;};}function patchUpdates(_0x543c5f){return function(_0x324816){try{jsonpatch[_0x91a6('0x20')](_0x324816,_0x543c5f,!![]);}catch(_0x30b2bf){return BPromise[_0x91a6('0x21')](_0x30b2bf);}return _0x324816['save']();};}function saveUpdates(_0x213cc3,_0x5e71f6){return function(_0x29e570){if(_0x29e570){return _0x29e570['update'](_0x213cc3)[_0x91a6('0x22')](function(_0x3377b6){return _0x3377b6;});}return null;};}function removeEntity(_0x1fa2de,_0x225e03){return function(_0x579d93){if(_0x579d93){return _0x579d93[_0x91a6('0x23')]()['then'](function(){_0x1fa2de[_0x91a6('0x18')](0xcc)[_0x91a6('0x19')]();});}};}function handleEntityNotFound(_0x3586b7,_0x12d1ac){return function(_0x4814f2){if(!_0x4814f2){_0x3586b7[_0x91a6('0x17')](0x194);}return _0x4814f2;};}function handleError(_0x46f702,_0x833441){_0x833441=_0x833441||0x1f4;return function(_0x4003ff){logger[_0x91a6('0x24')](_0x4003ff[_0x91a6('0x25')]);if(_0x4003ff[_0x91a6('0x26')]){delete _0x4003ff['name'];}_0x46f702[_0x91a6('0x18')](_0x833441)[_0x91a6('0x27')](_0x4003ff);};}exports['index']=function(_0x69dfdc,_0x19cf79){var _0x20b98d={},_0x3db6a7={},_0x36a1a8={'count':0x0,'rows':[]};var _0x12c416=_[_0x91a6('0x28')](db[_0x91a6('0x29')][_0x91a6('0x2a')],function(_0x3384de){return{'name':_0x3384de[_0x91a6('0x2b')],'type':_0x3384de[_0x91a6('0x2c')][_0x91a6('0x2d')]};});_0x3db6a7[_0x91a6('0x2e')]=_['map'](_0x12c416,_0x91a6('0x26'));_0x3db6a7[_0x91a6('0x2f')]=_[_0x91a6('0x30')](_0x69dfdc[_0x91a6('0x2f')]);_0x3db6a7[_0x91a6('0x31')]=_['intersection'](_0x3db6a7[_0x91a6('0x2e')],_0x3db6a7[_0x91a6('0x2f')]);_0x20b98d[_0x91a6('0x32')]=_[_0x91a6('0x33')](_0x3db6a7['model'],qs[_0x91a6('0x34')](_0x69dfdc[_0x91a6('0x2f')]['fields']));_0x20b98d[_0x91a6('0x32')]=_0x20b98d['attributes']['length']?_0x20b98d['attributes']:_0x3db6a7['model'];if(!_0x69dfdc[_0x91a6('0x2f')][_0x91a6('0x35')](_0x91a6('0x36'))){_0x20b98d[_0x91a6('0x1b')]=qs['limit'](_0x69dfdc[_0x91a6('0x2f')]['limit']);_0x20b98d[_0x91a6('0x1a')]=qs[_0x91a6('0x1a')](_0x69dfdc[_0x91a6('0x2f')][_0x91a6('0x1a')]);}_0x20b98d[_0x91a6('0x37')]=qs[_0x91a6('0x38')](_0x69dfdc[_0x91a6('0x2f')][_0x91a6('0x38')]);_0x20b98d[_0x91a6('0x39')]=qs['filters'](_[_0x91a6('0x3a')](_0x69dfdc['query'],_0x3db6a7[_0x91a6('0x31')]),_0x12c416);if(_0x69dfdc[_0x91a6('0x2f')][_0x91a6('0x3b')]){_0x20b98d['where']=_['merge'](_0x20b98d['where'],{'$or':_[_0x91a6('0x28')](_0x12c416,function(_0xbe9a0d){if(_0xbe9a0d['type']!==_0x91a6('0x3c')){var _0x4a5cb1={};_0x4a5cb1[_0xbe9a0d[_0x91a6('0x26')]]={'$like':'%'+_0x69dfdc['query']['filter']+'%'};return _0x4a5cb1;}})});}_0x20b98d=_[_0x91a6('0x3d')]({},_0x20b98d,_0x69dfdc[_0x91a6('0x3e')]);var _0x418947={'where':_0x20b98d[_0x91a6('0x39')]};return db[_0x91a6('0x29')][_0x91a6('0x1d')](_0x418947)['then'](function(_0x5f2c54){_0x36a1a8[_0x91a6('0x1d')]=_0x5f2c54;if(_0x69dfdc['query'][_0x91a6('0x3f')]){_0x20b98d[_0x91a6('0x40')]=[{'all':!![]}];}return db['Migration'][_0x91a6('0x41')](_0x20b98d);})[_0x91a6('0x22')](function(_0xd1898c){_0x36a1a8['rows']=_0xd1898c;return _0x36a1a8;})[_0x91a6('0x22')](respondWithFilteredResult(_0x19cf79,_0x20b98d))[_0x91a6('0x42')](handleError(_0x19cf79,null));}; \ No newline at end of file +var _0x036b=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','rawAttributes','fieldName','type','model','map','query','filters','attributes','fields','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','Migration','include','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x036b,0x145));var _0xb036=function(_0x2946ba,_0x3256a3){_0x2946ba=_0x2946ba-0x0;var _0x31458f=_0x036b[_0x2946ba];return _0x31458f;};'use strict';var emlformat=require(_0xb036('0x0'));var rimraf=require(_0xb036('0x1'));var zipdir=require(_0xb036('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb036('0x3'));var moment=require(_0xb036('0x4'));var BPromise=require(_0xb036('0x5'));var Mustache=require(_0xb036('0x6'));var util=require(_0xb036('0x7'));var path=require('path');var sox=require(_0xb036('0x8'));var csv=require(_0xb036('0x9'));var ejs=require(_0xb036('0xa'));var fs=require('fs');var fs_extra=require(_0xb036('0xb'));var _=require(_0xb036('0xc'));var squel=require(_0xb036('0xd'));var crypto=require('crypto');var jsforce=require(_0xb036('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb036('0x9'));var querystring=require(_0xb036('0xf'));var Papa=require(_0xb036('0x10'));var Redis=require(_0xb036('0x11'));var authService=require(_0xb036('0x12'));var qs=require(_0xb036('0x13'));var as=require(_0xb036('0x14'));var hardwareService=require(_0xb036('0x15'));var logger=require(_0xb036('0x16'))(_0xb036('0x17'));var utils=require(_0xb036('0x18'));var config=require(_0xb036('0x19'));var licenseUtil=require(_0xb036('0x1a'));var db=require(_0xb036('0x1b'))['db'];function respondWithStatusCode(_0x5c3c5c,_0x5325ce){_0x5325ce=_0x5325ce||0xcc;return function(_0x4db926){if(_0x4db926){return _0x5c3c5c[_0xb036('0x1c')](_0x5325ce);}return _0x5c3c5c[_0xb036('0x1d')](_0x5325ce)['end']();};}function respondWithResult(_0x216d5b,_0x162ced){_0x162ced=_0x162ced||0xc8;return function(_0x21bcc2){if(_0x21bcc2){return _0x216d5b[_0xb036('0x1d')](_0x162ced)['json'](_0x21bcc2);}};}function respondWithFilteredResult(_0x371f92,_0x43ba91){return function(_0x5c953b){if(_0x5c953b){var _0x4c6c42=typeof _0x43ba91[_0xb036('0x1e')]===_0xb036('0x1f')&&typeof _0x43ba91[_0xb036('0x20')]===_0xb036('0x1f');var _0x4ccdf1=_0x5c953b['count'];var _0x38e5c8=_0x4c6c42?0x0:_0x43ba91['offset'];var _0x992a54=_0x4c6c42?_0x5c953b[_0xb036('0x21')]:_0x43ba91[_0xb036('0x1e')]+_0x43ba91['limit'];var _0x5b710b;if(_0x992a54>=_0x4ccdf1){_0x992a54=_0x4ccdf1;_0x5b710b=0xc8;}else{_0x5b710b=0xce;}_0x371f92[_0xb036('0x1d')](_0x5b710b);return _0x371f92['set'](_0xb036('0x22'),_0x38e5c8+'-'+_0x992a54+'/'+_0x4ccdf1)['json'](_0x5c953b);}return null;};}function patchUpdates(_0x5207ad){return function(_0x2a94d3){try{jsonpatch[_0xb036('0x23')](_0x2a94d3,_0x5207ad,!![]);}catch(_0x5251ad){return BPromise[_0xb036('0x24')](_0x5251ad);}return _0x2a94d3[_0xb036('0x25')]();};}function saveUpdates(_0x142ff5,_0xe2bd24){return function(_0xba2c60){if(_0xba2c60){return _0xba2c60[_0xb036('0x26')](_0x142ff5)['then'](function(_0x31ef6d){return _0x31ef6d;});}return null;};}function removeEntity(_0x3e137b,_0x581e8b){return function(_0x22f150){if(_0x22f150){return _0x22f150[_0xb036('0x27')]()[_0xb036('0x28')](function(){_0x3e137b[_0xb036('0x1d')](0xcc)[_0xb036('0x29')]();});}};}function handleEntityNotFound(_0x1fc870,_0xf31e6b){return function(_0x3e418e){if(!_0x3e418e){_0x1fc870[_0xb036('0x1c')](0x194);}return _0x3e418e;};}function handleError(_0x1f0a08,_0x7ca66e){_0x7ca66e=_0x7ca66e||0x1f4;return function(_0x3fff5f){logger[_0xb036('0x2a')](_0x3fff5f['stack']);if(_0x3fff5f[_0xb036('0x2b')]){delete _0x3fff5f[_0xb036('0x2b')];}_0x1f0a08['status'](_0x7ca66e)[_0xb036('0x2c')](_0x3fff5f);};}exports['index']=function(_0x10e2af,_0x254dcb){var _0x57e02e={},_0x52ee5b={},_0x2346c6={'count':0x0,'rows':[]};var _0x47d465=_['map'](db['Migration'][_0xb036('0x2d')],function(_0x504b0d){return{'name':_0x504b0d[_0xb036('0x2e')],'type':_0x504b0d[_0xb036('0x2f')]['key']};});_0x52ee5b[_0xb036('0x30')]=_[_0xb036('0x31')](_0x47d465,_0xb036('0x2b'));_0x52ee5b[_0xb036('0x32')]=_['keys'](_0x10e2af[_0xb036('0x32')]);_0x52ee5b[_0xb036('0x33')]=_['intersection'](_0x52ee5b[_0xb036('0x30')],_0x52ee5b[_0xb036('0x32')]);_0x57e02e[_0xb036('0x34')]=_['intersection'](_0x52ee5b[_0xb036('0x30')],qs[_0xb036('0x35')](_0x10e2af['query'][_0xb036('0x35')]));_0x57e02e[_0xb036('0x34')]=_0x57e02e[_0xb036('0x34')]['length']?_0x57e02e['attributes']:_0x52ee5b[_0xb036('0x30')];if(!_0x10e2af[_0xb036('0x32')][_0xb036('0x36')]('nolimit')){_0x57e02e[_0xb036('0x20')]=qs[_0xb036('0x20')](_0x10e2af['query'][_0xb036('0x20')]);_0x57e02e[_0xb036('0x1e')]=qs[_0xb036('0x1e')](_0x10e2af[_0xb036('0x32')][_0xb036('0x1e')]);}_0x57e02e['order']=qs['sort'](_0x10e2af['query'][_0xb036('0x37')]);_0x57e02e['where']=qs[_0xb036('0x33')](_[_0xb036('0x38')](_0x10e2af[_0xb036('0x32')],_0x52ee5b[_0xb036('0x33')]),_0x47d465);if(_0x10e2af[_0xb036('0x32')]['filter']){_0x57e02e[_0xb036('0x39')]=_[_0xb036('0x3a')](_0x57e02e[_0xb036('0x39')],{'$or':_[_0xb036('0x31')](_0x47d465,function(_0x576676){if(_0x576676['type']!==_0xb036('0x3b')){var _0x1ade6e={};_0x1ade6e[_0x576676[_0xb036('0x2b')]]={'$like':'%'+_0x10e2af[_0xb036('0x32')][_0xb036('0x3c')]+'%'};return _0x1ade6e;}})});}_0x57e02e=_[_0xb036('0x3a')]({},_0x57e02e,_0x10e2af[_0xb036('0x3d')]);var _0x5fbba={'where':_0x57e02e[_0xb036('0x39')]};return db[_0xb036('0x3e')][_0xb036('0x21')](_0x5fbba)[_0xb036('0x28')](function(_0x408339){_0x2346c6[_0xb036('0x21')]=_0x408339;if(_0x10e2af[_0xb036('0x32')]['includeAll']){_0x57e02e[_0xb036('0x3f')]=[{'all':!![]}];}return db[_0xb036('0x3e')]['findAll'](_0x57e02e);})[_0xb036('0x28')](function(_0x54d1df){_0x2346c6[_0xb036('0x40')]=_0x54d1df;return _0x2346c6;})[_0xb036('0x28')](respondWithFilteredResult(_0x254dcb,_0x57e02e))[_0xb036('0x41')](handleError(_0x254dcb,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 34d58b7..bb1e5bf 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 _0x8312=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash','../../config/logger','moment'];(function(_0x312fbd,_0x214af4){var _0x2aaed0=function(_0x3c6d78){while(--_0x3c6d78){_0x312fbd['push'](_0x312fbd['shift']());}};_0x2aaed0(++_0x214af4);}(_0x8312,0x147));var _0x2831=function(_0x5080cd,_0x2cb340){_0x5080cd=_0x5080cd-0x0;var _0x514a82=_0x8312[_0x5080cd];return _0x514a82;};'use strict';var _=require(_0x2831('0x0'));var util=require('util');var logger=require(_0x2831('0x1'))('api');var moment=require(_0x2831('0x2'));var BPromise=require('bluebird');var rp=require(_0x2831('0x3'));var fs=require('fs');var path=require(_0x2831('0x4'));var rimraf=require(_0x2831('0x5'));var config=require(_0x2831('0x6'));var attributes=require(_0x2831('0x7'));module[_0x2831('0x8')]=function(_0xc3f629,_0x2ddf24){return _0xc3f629['define'](_0x2831('0x9'),attributes,{'tableName':_0x2831('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2339=['path','rimraf','../../config/environment','exports','define','migrations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xbf9e78,_0x540f52){var _0x2b5563=function(_0x269788){while(--_0x269788){_0xbf9e78['push'](_0xbf9e78['shift']());}};_0x2b5563(++_0x540f52);}(_0x2339,0x1da));var _0x9233=function(_0x12e286,_0xe7ba2a){_0x12e286=_0x12e286-0x0;var _0x47852e=_0x2339[_0x12e286];return _0x47852e;};'use strict';var _=require(_0x9233('0x0'));var util=require(_0x9233('0x1'));var logger=require(_0x9233('0x2'))(_0x9233('0x3'));var moment=require(_0x9233('0x4'));var BPromise=require('bluebird');var rp=require(_0x9233('0x5'));var fs=require('fs');var path=require(_0x9233('0x6'));var rimraf=require(_0x9233('0x7'));var config=require(_0x9233('0x8'));var attributes=require('./migration.attributes');module[_0x9233('0x9')]=function(_0x3e74d2,_0x18d123){return _0x3e74d2[_0x9233('0xa')]('Migration',attributes,{'tableName':_0x9233('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 3436113..853d3c8 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 _0x9c2c=['request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x21aa88,_0x41701c){var _0x57fc8a=function(_0x59b6db){while(--_0x59b6db){_0x21aa88['push'](_0x21aa88['shift']());}};_0x57fc8a(++_0x41701c);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9c2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9c2('0x3'));var logger=require(_0xc9c2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9c2('0x5'));var client=jayson['client'][_0xc9c2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x17b5e8,_0x711f3d,_0x18a815){return new BPromise(function(_0x270572,_0xd7fb27){return client[_0xc9c2('0x7')](_0x17b5e8,_0x18a815)[_0xc9c2('0x8')](function(_0x8614c4){logger['info'](_0xc9c2('0x9'),_0x711f3d,'request\x20sent');logger[_0xc9c2('0xa')](_0xc9c2('0xb'),_0x711f3d,_0xc9c2('0xc'),JSON[_0xc9c2('0xd')](_0x8614c4));if(_0x8614c4['error']){if(_0x8614c4['error'][_0xc9c2('0xe')]===0x1f4){logger[_0xc9c2('0xf')]('Migration,\x20%s,\x20%s',_0x711f3d,_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);return _0xd7fb27(_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);}logger[_0xc9c2('0xf')](_0xc9c2('0x9'),_0x711f3d,_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);return _0x270572(_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);}else{logger[_0xc9c2('0x11')](_0xc9c2('0x9'),_0x711f3d,'request\x20sent');_0x270572(_0x8614c4[_0xc9c2('0x12')][_0xc9c2('0x10')]);}})[_0xc9c2('0x13')](function(_0x240099){logger[_0xc9c2('0xf')]('Migration,\x20%s,\x20%s',_0x711f3d,_0x240099);_0xd7fb27(_0x240099);});});} \ No newline at end of file +var _0x9099=['../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2d7a4b,_0xa36b04){var _0x603707=function(_0x498947){while(--_0x498947){_0x2d7a4b['push'](_0x2d7a4b['shift']());}};_0x603707(++_0xa36b04);}(_0x9099,0x1ac));var _0x9909=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x9099[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x9909('0x0'));var util=require('util');var moment=require(_0x9909('0x1'));var BPromise=require(_0x9909('0x2'));var rs=require(_0x9909('0x3'));var fs=require('fs');var Redis=require(_0x9909('0x4'));var db=require(_0x9909('0x5'))['db'];var utils=require(_0x9909('0x6'));var logger=require(_0x9909('0x7'))(_0x9909('0x8'));var config=require(_0x9909('0x9'));var jayson=require(_0x9909('0xa'));var client=jayson[_0x9909('0xb')][_0x9909('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b7391,_0x3dc2dd,_0x54011f){return new BPromise(function(_0x6d755a,_0x5dcd39){return client['request'](_0x3b7391,_0x54011f)['then'](function(_0x5023b7){logger[_0x9909('0xd')]('Migration,\x20%s,\x20%s',_0x3dc2dd,_0x9909('0xe'));logger[_0x9909('0xf')](_0x9909('0x10'),_0x3dc2dd,'request\x20sent',JSON[_0x9909('0x11')](_0x5023b7));if(_0x5023b7['error']){if(_0x5023b7[_0x9909('0x12')][_0x9909('0x13')]===0x1f4){logger[_0x9909('0x12')](_0x9909('0x14'),_0x3dc2dd,_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);return _0x5dcd39(_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);}logger[_0x9909('0x12')](_0x9909('0x14'),_0x3dc2dd,_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);return _0x6d755a(_0x5023b7[_0x9909('0x12')]['message']);}else{logger[_0x9909('0xd')]('Migration,\x20%s,\x20%s',_0x3dc2dd,_0x9909('0xe'));_0x6d755a(_0x5023b7['result'][_0x9909('0x15')]);}})[_0x9909('0x16')](function(_0x245f0d){logger['error'](_0x9909('0x14'),_0x3dc2dd,_0x245f0d);_0x5dcd39(_0x245f0d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8a42b4d..0ae10bc 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 _0x781d=['/:id','show','post','create','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x54a5ba,_0x5e806e){var _0x49add8=function(_0x3c7c61){while(--_0x3c7c61){_0x54a5ba['push'](_0x54a5ba['shift']());}};_0x49add8(++_0x5e806e);}(_0x781d,0x14a));var _0xd781=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x781d[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0xe')]('/',auth['isAuthenticated'](),controller[_0xd781('0xf')]);router['put'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller['update']);router[_0xd781('0x10')](_0xd781('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd781('0x11')]=router; \ No newline at end of file +var _0xd0ee=['./network.controller','get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0xd0ee,0x19a));var _0xed0e=function(_0x371a20,_0x1feafa){_0x371a20=_0x371a20-0x0;var _0x2fd0f7=_0xd0ee[_0x371a20];return _0x2fd0f7;};'use strict';var multer=require('multer');var util=require(_0xed0e('0x0'));var path=require('path');var timeout=require(_0xed0e('0x1'));var express=require(_0xed0e('0x2'));var router=express['Router']();var fs_extra=require(_0xed0e('0x3'));var auth=require(_0xed0e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xed0e('0x5'));var controller=require(_0xed0e('0x6'));router[_0xed0e('0x7')]('/',auth[_0xed0e('0x8')](),controller['index']);router['get']('/:id',auth[_0xed0e('0x8')](),controller['show']);router[_0xed0e('0x9')]('/',auth[_0xed0e('0x8')](),controller['create']);router[_0xed0e('0xa')](_0xed0e('0xb'),auth['isAuthenticated'](),controller[_0xed0e('0xc')]);router[_0xed0e('0xd')](_0xed0e('0xb'),auth['isAuthenticated'](),controller[_0xed0e('0xe')]);module[_0xed0e('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 62c8ce2..e3d59b2 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 _0x6fc6=['STRING','exports','localnet','externip','stun'];(function(_0x4fb17e,_0x4e6045){var _0x3960ca=function(_0x3b5d18){while(--_0x3b5d18){_0x4fb17e['push'](_0x4fb17e['shift']());}};_0x3960ca(++_0x4e6045);}(_0x6fc6,0x17d));var _0x66fc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6fc6[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x66fc('0x0')]={'type':{'type':Sequelize['ENUM'](_0x66fc('0x1'),_0x66fc('0x2'),_0x66fc('0x3'),'turn')},'value':{'type':Sequelize[_0x66fc('0x4')]},'username':{'type':Sequelize[_0x66fc('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc3bc=['externip','STRING','exports','localnet'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc3bc,0x142));var _0xcc3b=function(_0x245dd2,_0x37a45d){_0x245dd2=_0x245dd2-0x0;var _0x5d2f32=_0xc3bc[_0x245dd2];return _0x5d2f32;};'use strict';var Sequelize=require('sequelize');module[_0xcc3b('0x0')]={'type':{'type':Sequelize['ENUM'](_0xcc3b('0x1'),_0xcc3b('0x2'),'stun','turn')},'value':{'type':Sequelize[_0xcc3b('0x3')]},'username':{'type':Sequelize[_0xcc3b('0x3')]},'password':{'type':Sequelize[_0xcc3b('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b253b70..7b08ee7 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 _0x530a=['readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','utf8','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','update','/etc/asterisk/turn_xcally.conf','STUN','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','http','request','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','options','find','create','body','toUpperCase'];(function(_0x58b301,_0x45e991){var _0x2171b3=function(_0x30b475){while(--_0x30b475){_0x58b301['push'](_0x58b301['shift']());}};_0x2171b3(++_0x45e991);}(_0x530a,0x81));var _0xa530=function(_0x43c346,_0x18bf31){_0x43c346=_0x43c346-0x0;var _0x360cbe=_0x530a[_0x43c346];return _0x360cbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa530('0x0'));var zipdir=require(_0xa530('0x1'));var jsonpatch=require(_0xa530('0x2'));var rp=require(_0xa530('0x3'));var moment=require(_0xa530('0x4'));var BPromise=require(_0xa530('0x5'));var Mustache=require('mustache');var util=require(_0xa530('0x6'));var path=require(_0xa530('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa530('0x8'));var fs=require('fs');var fs_extra=require(_0xa530('0x9'));var _=require('lodash');var squel=require(_0xa530('0xa'));var crypto=require(_0xa530('0xb'));var jsforce=require(_0xa530('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa530('0xd'));var querystring=require(_0xa530('0xe'));var Papa=require(_0xa530('0xf'));var Redis=require(_0xa530('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa530('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa530('0x12'));var logger=require(_0xa530('0x13'))(_0xa530('0x14'));var utils=require(_0xa530('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa530('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa530('0x17'));var client=jayson['client'][_0xa530('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1aa581,_0x553510,_0x5ef342,_0x459fbe){return new BPromise(function(_0xb11d4c,_0x31c88a){var _0x3c14c7=_0x459fbe||client;return _0x3c14c7[_0xa530('0x19')](_0x1aa581,_0x5ef342)['then'](function(_0x537ca2){logger['info'](_0xa530('0x1a'),_0x553510,'request\x20sent');logger[_0xa530('0x1b')](_0xa530('0x1c'),_0x553510,_0xa530('0x1d'),JSON[_0xa530('0x1e')](_0x537ca2));if(_0x537ca2[_0xa530('0x1f')]){if(_0x537ca2[_0xa530('0x1f')][_0xa530('0x20')]===0x1f4){logger[_0xa530('0x1f')]('Network,\x20%s,\x20%s',_0x553510,_0x537ca2[_0xa530('0x1f')]['message']);return _0x31c88a(_0x537ca2['error'][_0xa530('0x21')]);}logger['error']('Network,\x20%s,\x20%s',_0x553510,_0x537ca2['error'][_0xa530('0x21')]);return _0xb11d4c(_0x537ca2[_0xa530('0x1f')][_0xa530('0x21')]);}else{logger['info'](_0xa530('0x1a'),_0x553510,_0xa530('0x1d'));_0xb11d4c(_0x537ca2[_0xa530('0x22')]['message']);}})[_0xa530('0x23')](function(_0x3481a7){logger[_0xa530('0x1f')](_0xa530('0x1a'),_0x553510,_0x3481a7);_0x31c88a(_0x3481a7);});});}function respondWithStatusCode(_0x26138b,_0x393085){_0x393085=_0x393085||0xcc;return function(_0x22c04c){if(_0x22c04c){return _0x26138b[_0xa530('0x24')](_0x393085);}return _0x26138b[_0xa530('0x25')](_0x393085)[_0xa530('0x26')]();};}function respondWithResult(_0x460119,_0x558006){_0x558006=_0x558006||0xc8;return function(_0x127165){if(_0x127165){return _0x460119[_0xa530('0x25')](_0x558006)['json'](_0x127165);}};}function respondWithFilteredResult(_0x381964,_0x5c318d){return function(_0x13af52){if(_0x13af52){var _0x3fb2c6=typeof _0x5c318d[_0xa530('0x27')]===_0xa530('0x28')&&typeof _0x5c318d[_0xa530('0x29')]===_0xa530('0x28');var _0x409163=_0x13af52[_0xa530('0x2a')];var _0x10fb42=_0x3fb2c6?0x0:_0x5c318d[_0xa530('0x27')];var _0x56345e=_0x3fb2c6?_0x13af52[_0xa530('0x2a')]:_0x5c318d[_0xa530('0x27')]+_0x5c318d[_0xa530('0x29')];var _0x27c642;if(_0x56345e>=_0x409163){_0x56345e=_0x409163;_0x27c642=0xc8;}else{_0x27c642=0xce;}_0x381964[_0xa530('0x25')](_0x27c642);return _0x381964[_0xa530('0x2b')]('Content-Range',_0x10fb42+'-'+_0x56345e+'/'+_0x409163)[_0xa530('0x2c')](_0x13af52);}return null;};}function patchUpdates(_0x4725ed){return function(_0x5d4fad){try{jsonpatch[_0xa530('0x2d')](_0x5d4fad,_0x4725ed,!![]);}catch(_0xd86a0e){return BPromise[_0xa530('0x2e')](_0xd86a0e);}return _0x5d4fad[_0xa530('0x2f')]();};}function saveUpdates(_0x579e99,_0x4798a2){return function(_0x43d8cd){if(_0x43d8cd){return _0x43d8cd['update'](_0x579e99)['then'](function(_0x331d03){return _0x331d03;});}return null;};}function removeEntity(_0x9149fa,_0x48bc7b){return function(_0x2f03c5){if(_0x2f03c5){return _0x2f03c5[_0xa530('0x30')]()['then'](function(){_0x9149fa[_0xa530('0x25')](0xcc)[_0xa530('0x26')]();});}};}function handleEntityNotFound(_0x448ae4,_0x3c9035){return function(_0x1844b8){if(!_0x1844b8){_0x448ae4[_0xa530('0x24')](0x194);}return _0x1844b8;};}function handleError(_0x459c2b,_0x140517){_0x140517=_0x140517||0x1f4;return function(_0x2d5c71){logger[_0xa530('0x1f')](_0x2d5c71[_0xa530('0x31')]);if(_0x2d5c71[_0xa530('0x32')]){delete _0x2d5c71['name'];}_0x459c2b[_0xa530('0x25')](_0x140517)[_0xa530('0x33')](_0x2d5c71);};}exports[_0xa530('0x34')]=function(_0x5a9a1d,_0x33c396){var _0x2fba74={},_0xf18417={},_0x31b192={'count':0x0,'rows':[]};var _0x4dc965=_[_0xa530('0x35')](db[_0xa530('0x36')][_0xa530('0x37')],function(_0x2a3aa8){return{'name':_0x2a3aa8[_0xa530('0x38')],'type':_0x2a3aa8[_0xa530('0x39')]['key']};});_0xf18417[_0xa530('0x3a')]=_[_0xa530('0x35')](_0x4dc965,_0xa530('0x32'));_0xf18417[_0xa530('0x3b')]=_[_0xa530('0x3c')](_0x5a9a1d['query']);_0xf18417[_0xa530('0x3d')]=_[_0xa530('0x3e')](_0xf18417[_0xa530('0x3a')],_0xf18417['query']);_0x2fba74[_0xa530('0x3f')]=_[_0xa530('0x3e')](_0xf18417[_0xa530('0x3a')],qs[_0xa530('0x40')](_0x5a9a1d[_0xa530('0x3b')][_0xa530('0x40')]));_0x2fba74[_0xa530('0x3f')]=_0x2fba74[_0xa530('0x3f')][_0xa530('0x41')]?_0x2fba74[_0xa530('0x3f')]:_0xf18417[_0xa530('0x3a')];if(!_0x5a9a1d['query'][_0xa530('0x42')](_0xa530('0x43'))){_0x2fba74[_0xa530('0x29')]=qs[_0xa530('0x29')](_0x5a9a1d[_0xa530('0x3b')][_0xa530('0x29')]);_0x2fba74['offset']=qs[_0xa530('0x27')](_0x5a9a1d[_0xa530('0x3b')][_0xa530('0x27')]);}_0x2fba74[_0xa530('0x44')]=qs[_0xa530('0x45')](_0x5a9a1d[_0xa530('0x3b')][_0xa530('0x45')]);_0x2fba74[_0xa530('0x46')]=qs['filters'](_[_0xa530('0x47')](_0x5a9a1d[_0xa530('0x3b')],_0xf18417[_0xa530('0x3d')]),_0x4dc965);if(_0x5a9a1d['query']['filter']){_0x2fba74[_0xa530('0x46')]=_[_0xa530('0x48')](_0x2fba74[_0xa530('0x46')],{'$or':_['map'](_0x4dc965,function(_0x5b42d8){if(_0x5b42d8[_0xa530('0x39')]!==_0xa530('0x49')){var _0x3d66d0={};_0x3d66d0[_0x5b42d8[_0xa530('0x32')]]={'$like':'%'+_0x5a9a1d[_0xa530('0x3b')][_0xa530('0x4a')]+'%'};return _0x3d66d0;}})});}_0x2fba74=_['merge']({},_0x2fba74,_0x5a9a1d['options']);var _0x5009d4={'where':_0x2fba74[_0xa530('0x46')]};return db[_0xa530('0x36')][_0xa530('0x2a')](_0x5009d4)[_0xa530('0x4b')](function(_0x2c9eb2){_0x31b192[_0xa530('0x2a')]=_0x2c9eb2;if(_0x5a9a1d[_0xa530('0x3b')][_0xa530('0x4c')]){_0x2fba74[_0xa530('0x4d')]=[{'all':!![]}];}return db[_0xa530('0x36')][_0xa530('0x4e')](_0x2fba74);})[_0xa530('0x4b')](function(_0x39be9d){_0x31b192[_0xa530('0x4f')]=_0x39be9d;return _0x31b192;})['then'](respondWithFilteredResult(_0x33c396,_0x2fba74))[_0xa530('0x23')](handleError(_0x33c396,null));};exports[_0xa530('0x50')]=function(_0x235502,_0x140f2a){var _0x394468={'raw':!![],'where':{'id':_0x235502[_0xa530('0x51')]['id']}},_0x24d568={};_0x24d568[_0xa530('0x3a')]=_[_0xa530('0x3c')](db[_0xa530('0x36')]['rawAttributes']);_0x24d568[_0xa530('0x3b')]=_[_0xa530('0x3c')](_0x235502[_0xa530('0x3b')]);_0x24d568[_0xa530('0x3d')]=_[_0xa530('0x3e')](_0x24d568[_0xa530('0x3a')],_0x24d568[_0xa530('0x3b')]);_0x394468[_0xa530('0x3f')]=_[_0xa530('0x3e')](_0x24d568[_0xa530('0x3a')],qs[_0xa530('0x40')](_0x235502[_0xa530('0x3b')]['fields']));_0x394468[_0xa530('0x3f')]=_0x394468[_0xa530('0x3f')]['length']?_0x394468['attributes']:_0x24d568[_0xa530('0x3a')];if(_0x235502[_0xa530('0x3b')]['includeAll']){_0x394468['include']=[{'all':!![]}];}_0x394468=_[_0xa530('0x48')]({},_0x394468,_0x235502[_0xa530('0x52')]);return db['Network'][_0xa530('0x53')](_0x394468)[_0xa530('0x4b')](handleEntityNotFound(_0x140f2a,null))[_0xa530('0x4b')](respondWithResult(_0x140f2a,null))[_0xa530('0x23')](handleError(_0x140f2a,null));};exports['create']=function(_0x57ddc2,_0x2fd386,_0x31b4f5){var _0x2e8fc1;return db['sequelize']['transaction'](function(_0x2e84e0){return db['Network'][_0xa530('0x54')](_0x57ddc2[_0xa530('0x55')],{'raw':!![]})[_0xa530('0x4b')](function(_0x363945){_0x2e8fc1=_0x363945;return db[_0xa530('0x36')][_0xa530('0x4e')]({'where':{'type':_0x57ddc2['body'][_0xa530('0x39')]},'raw':!![]});})[_0xa530('0x4b')](function(_0x3e96d2){if(_0x2e8fc1[_0xa530('0x39')][_0xa530('0x56')]()=='STUN'){var _0x495781=fs[_0xa530('0x57')](path[_0xa530('0x58')](config[_0xa530('0x59')],_0xa530('0x5a')),'utf8');var _0x2f8414=ejs[_0xa530('0x5b')](_0x495781,{'networks':_0x3e96d2||[]});fs[_0xa530('0x5c')](_0xa530('0x5d'),_0x2f8414);return respondWithRpcPromise(_0xa530('0x5e'),_0xa530('0x54'),{'module':_0xa530('0x5f')});}else if(_0x2e8fc1[_0xa530('0x39')][_0xa530('0x56')]()==_0xa530('0x60')){var _0x272710=fs[_0xa530('0x57')](path[_0xa530('0x58')](config[_0xa530('0x59')],_0xa530('0x61')),'utf8');var _0x373e13=ejs[_0xa530('0x5b')](_0x272710,{'networks':_0x3e96d2||[]});fs[_0xa530('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x373e13);return respondWithRpcPromise('Reload','create',{'module':_0xa530('0x5f')});}else{var _0x485d4f=fs['readFileSync'](path[_0xa530('0x58')](config['root'],_0xa530('0x62')),_0xa530('0x63'));var _0x4a6981=ejs[_0xa530('0x5b')](_0x485d4f,{'networks':_0x3e96d2||[]});fs[_0xa530('0x5c')](util[_0xa530('0x64')](_0xa530('0x65'),_0x57ddc2['body']['type'][_0xa530('0x66')]()),_0x4a6981);return respondWithRpcPromise(_0xa530('0x5e'),_0xa530('0x54'),{'module':_0xa530('0x67')});}return null;})['then'](function(){return _0x2e8fc1;});})[_0xa530('0x4b')](respondWithResult(_0x2fd386,0xc9))[_0xa530('0x23')](handleError(_0x2fd386,null));};exports['update']=function(_0x8aae0a,_0x565620,_0xd954de){var _0x274cf7;return db['sequelize'][_0xa530('0x68')](function(_0x325835){return db[_0xa530('0x36')][_0xa530('0x53')]({'where':{'id':_0x8aae0a[_0xa530('0x51')]['id']}})[_0xa530('0x4b')](handleEntityNotFound(_0x565620,null))[_0xa530('0x4b')](saveUpdates(_0x8aae0a[_0xa530('0x55')],null))['then'](function(_0x4f1304){if(_0x4f1304){_0x274cf7=_0x4f1304;return db['Network'][_0xa530('0x4e')]({'where':{'type':_0x274cf7['type']},'raw':!![]});}return null;})[_0xa530('0x4b')](function(_0x3e1cc6){if(_0x274cf7['type'][_0xa530('0x56')]()=='STUN'){var _0x4e3110=fs[_0xa530('0x57')](path['join'](config[_0xa530('0x59')],_0xa530('0x5a')),'utf8');var _0x5ad7c3=ejs[_0xa530('0x5b')](_0x4e3110,{'networks':_0x3e1cc6||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x5ad7c3);return respondWithRpcPromise(_0xa530('0x5e'),_0xa530('0x69'),{'module':'res_stun_monitor.so'});}else if(_0x274cf7['type']['toUpperCase']()==_0xa530('0x60')){var _0x317320=fs[_0xa530('0x57')](path[_0xa530('0x58')](config[_0xa530('0x59')],_0xa530('0x61')),'utf8');var _0x523090=ejs[_0xa530('0x5b')](_0x317320,{'networks':_0x3e1cc6||[]});fs[_0xa530('0x5c')](_0xa530('0x6a'),_0x523090);return respondWithRpcPromise(_0xa530('0x5e'),'update',{'module':_0xa530('0x5f')});}else{var _0x4e3ac9=fs['readFileSync'](path[_0xa530('0x58')](config['root'],_0xa530('0x62')),_0xa530('0x63'));var _0xb6ea22=ejs[_0xa530('0x5b')](_0x4e3ac9,{'networks':_0x3e1cc6||[]});fs[_0xa530('0x5c')](util[_0xa530('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x8aae0a[_0xa530('0x55')][_0xa530('0x39')][_0xa530('0x66')]()),_0xb6ea22);return respondWithRpcPromise(_0xa530('0x5e'),'update',{'module':'chan_sip.so'});}return null;})[_0xa530('0x4b')](function(_0x20ac24){if(_0x20ac24){return _0x274cf7;}return null;});})['then'](respondWithResult(_0x565620,null))[_0xa530('0x23')](handleError(_0x565620,null));};exports['destroy']=function(_0xbd4fa6,_0x189060,_0x326374){var _0x51761b;return db[_0xa530('0x36')]['find']({'where':{'id':_0xbd4fa6[_0xa530('0x51')]['id']}})[_0xa530('0x4b')](function(_0x4068ae){_0x51761b=_0x4068ae;return _0x4068ae;})[_0xa530('0x4b')](handleEntityNotFound(_0x189060,null))['then'](removeEntity(_0x189060,null))['then'](function(){if(_0x51761b){return db[_0xa530('0x36')]['findAll']({'where':{'type':_0x51761b['type']},'raw':!![]});}})['then'](function(_0x3792f5){if(_0x51761b['type']['toUpperCase']()==_0xa530('0x6b')){var _0x404cbe=fs[_0xa530('0x57')](path['join'](config[_0xa530('0x59')],_0xa530('0x5a')),'utf8');var _0x374fe6=ejs[_0xa530('0x5b')](_0x404cbe,{'networks':_0x3792f5||[]});fs[_0xa530('0x5c')](_0xa530('0x5d'),_0x374fe6);return respondWithRpcPromise('Reload',_0xa530('0x30'),{'module':_0xa530('0x5f')});}else if(_0x51761b[_0xa530('0x39')][_0xa530('0x56')]()=='TURN'){var _0x414e9e=fs[_0xa530('0x57')](path[_0xa530('0x58')](config[_0xa530('0x59')],_0xa530('0x61')),_0xa530('0x63'));var _0x344b7a=ejs['render'](_0x414e9e,{'networks':_0x3792f5||[]});fs[_0xa530('0x5c')](_0xa530('0x6a'),_0x344b7a);return respondWithRpcPromise(_0xa530('0x5e'),_0xa530('0x30'),{'module':_0xa530('0x5f')});}else{var _0x55cc98=fs[_0xa530('0x57')](path[_0xa530('0x58')](config[_0xa530('0x59')],_0xa530('0x62')),_0xa530('0x63'));var _0x111f51=ejs[_0xa530('0x5b')](_0x55cc98,{'networks':_0x3792f5||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xbd4fa6['body']['type']['toLowerCase']()),_0x111f51);return respondWithRpcPromise(_0xa530('0x5e'),'destroy',{'module':_0xa530('0x67')});}return null;})['catch'](handleError(_0x189060,null));}; \ No newline at end of file +var _0x54ac=['create','transaction','body','toUpperCase','STUN','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','sequelize','update','server/files/templates/stun_multiple.ejs','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','destroy','sendStatus','stack','name','index','map','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','Network','findAll','rows','show','params','rawAttributes','length','find'];(function(_0x260495,_0x5ee470){var _0x19aa77=function(_0x5c34ae){while(--_0x5c34ae){_0x260495['push'](_0x260495['shift']());}};_0x19aa77(++_0x5ee470);}(_0x54ac,0x83));var _0xc54a=function(_0x2498b5,_0x514ddb){_0x2498b5=_0x2498b5-0x0;var _0x5c48d8=_0x54ac[_0x2498b5];return _0x5c48d8;};'use strict';var emlformat=require(_0xc54a('0x0'));var rimraf=require(_0xc54a('0x1'));var zipdir=require(_0xc54a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc54a('0x3'));var moment=require(_0xc54a('0x4'));var BPromise=require(_0xc54a('0x5'));var Mustache=require(_0xc54a('0x6'));var util=require(_0xc54a('0x7'));var path=require(_0xc54a('0x8'));var sox=require(_0xc54a('0x9'));var csv=require(_0xc54a('0xa'));var ejs=require(_0xc54a('0xb'));var fs=require('fs');var fs_extra=require(_0xc54a('0xc'));var _=require(_0xc54a('0xd'));var squel=require(_0xc54a('0xe'));var crypto=require(_0xc54a('0xf'));var jsforce=require(_0xc54a('0x10'));var deskjs=require(_0xc54a('0x11'));var toCsv=require(_0xc54a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc54a('0x12'));var authService=require(_0xc54a('0x13'));var qs=require(_0xc54a('0x14'));var as=require(_0xc54a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc54a('0x16'));var utils=require('../../config/utils');var config=require(_0xc54a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc54a('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xc54a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x55622a,_0x55ac08,_0x93208,_0x1605e6){return new BPromise(function(_0x4a7784,_0x54cfbf){var _0xdb77d5=_0x1605e6||client;return _0xdb77d5['request'](_0x55622a,_0x93208)[_0xc54a('0x1a')](function(_0x36f6cf){logger[_0xc54a('0x1b')](_0xc54a('0x1c'),_0x55ac08,_0xc54a('0x1d'));logger[_0xc54a('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x55ac08,_0xc54a('0x1d'),JSON[_0xc54a('0x1f')](_0x36f6cf));if(_0x36f6cf[_0xc54a('0x20')]){if(_0x36f6cf[_0xc54a('0x20')][_0xc54a('0x21')]===0x1f4){logger[_0xc54a('0x20')](_0xc54a('0x1c'),_0x55ac08,_0x36f6cf[_0xc54a('0x20')]['message']);return _0x54cfbf(_0x36f6cf[_0xc54a('0x20')][_0xc54a('0x22')]);}logger[_0xc54a('0x20')](_0xc54a('0x1c'),_0x55ac08,_0x36f6cf[_0xc54a('0x20')][_0xc54a('0x22')]);return _0x4a7784(_0x36f6cf['error'][_0xc54a('0x22')]);}else{logger['info'](_0xc54a('0x1c'),_0x55ac08,_0xc54a('0x1d'));_0x4a7784(_0x36f6cf[_0xc54a('0x23')][_0xc54a('0x22')]);}})[_0xc54a('0x24')](function(_0x40a1e0){logger[_0xc54a('0x20')](_0xc54a('0x1c'),_0x55ac08,_0x40a1e0);_0x54cfbf(_0x40a1e0);});});}function respondWithStatusCode(_0x5297af,_0x20ca65){_0x20ca65=_0x20ca65||0xcc;return function(_0x10a9f6){if(_0x10a9f6){return _0x5297af['sendStatus'](_0x20ca65);}return _0x5297af['status'](_0x20ca65)[_0xc54a('0x25')]();};}function respondWithResult(_0x5eee61,_0x48a49c){_0x48a49c=_0x48a49c||0xc8;return function(_0x53b8af){if(_0x53b8af){return _0x5eee61['status'](_0x48a49c)[_0xc54a('0x26')](_0x53b8af);}};}function respondWithFilteredResult(_0x343cac,_0x4dd8b1){return function(_0x4b1832){if(_0x4b1832){var _0x54fe58=typeof _0x4dd8b1['offset']===_0xc54a('0x27')&&typeof _0x4dd8b1[_0xc54a('0x28')]==='undefined';var _0x5ac838=_0x4b1832[_0xc54a('0x29')];var _0x3ba9e9=_0x54fe58?0x0:_0x4dd8b1['offset'];var _0x2b0728=_0x54fe58?_0x4b1832[_0xc54a('0x29')]:_0x4dd8b1[_0xc54a('0x2a')]+_0x4dd8b1['limit'];var _0x2edbc;if(_0x2b0728>=_0x5ac838){_0x2b0728=_0x5ac838;_0x2edbc=0xc8;}else{_0x2edbc=0xce;}_0x343cac[_0xc54a('0x2b')](_0x2edbc);return _0x343cac[_0xc54a('0x2c')](_0xc54a('0x2d'),_0x3ba9e9+'-'+_0x2b0728+'/'+_0x5ac838)[_0xc54a('0x26')](_0x4b1832);}return null;};}function patchUpdates(_0x175fbe){return function(_0x270ee9){try{jsonpatch['apply'](_0x270ee9,_0x175fbe,!![]);}catch(_0x4db2c5){return BPromise[_0xc54a('0x2e')](_0x4db2c5);}return _0x270ee9['save']();};}function saveUpdates(_0x443d01,_0x194eac){return function(_0x4e787c){if(_0x4e787c){return _0x4e787c['update'](_0x443d01)[_0xc54a('0x1a')](function(_0x54bf09){return _0x54bf09;});}return null;};}function removeEntity(_0x3006bd,_0x3552fc){return function(_0x3a421b){if(_0x3a421b){return _0x3a421b[_0xc54a('0x2f')]()[_0xc54a('0x1a')](function(){_0x3006bd[_0xc54a('0x2b')](0xcc)[_0xc54a('0x25')]();});}};}function handleEntityNotFound(_0xaf3006,_0x10426d){return function(_0x11d4e8){if(!_0x11d4e8){_0xaf3006[_0xc54a('0x30')](0x194);}return _0x11d4e8;};}function handleError(_0x771bed,_0x39c084){_0x39c084=_0x39c084||0x1f4;return function(_0x4b8a1d){logger[_0xc54a('0x20')](_0x4b8a1d[_0xc54a('0x31')]);if(_0x4b8a1d[_0xc54a('0x32')]){delete _0x4b8a1d[_0xc54a('0x32')];}_0x771bed[_0xc54a('0x2b')](_0x39c084)['send'](_0x4b8a1d);};}exports[_0xc54a('0x33')]=function(_0x49d3b5,_0x290fa4){var _0x1f5d2d={},_0x3d2369={},_0x19f0cc={'count':0x0,'rows':[]};var _0x485ed0=_[_0xc54a('0x34')](db['Network']['rawAttributes'],function(_0xf5ae8e){return{'name':_0xf5ae8e[_0xc54a('0x35')],'type':_0xf5ae8e[_0xc54a('0x36')][_0xc54a('0x37')]};});_0x3d2369[_0xc54a('0x38')]=_['map'](_0x485ed0,_0xc54a('0x32'));_0x3d2369['query']=_[_0xc54a('0x39')](_0x49d3b5['query']);_0x3d2369['filters']=_[_0xc54a('0x3a')](_0x3d2369[_0xc54a('0x38')],_0x3d2369[_0xc54a('0x3b')]);_0x1f5d2d[_0xc54a('0x3c')]=_['intersection'](_0x3d2369[_0xc54a('0x38')],qs[_0xc54a('0x3d')](_0x49d3b5[_0xc54a('0x3b')][_0xc54a('0x3d')]));_0x1f5d2d['attributes']=_0x1f5d2d[_0xc54a('0x3c')]['length']?_0x1f5d2d['attributes']:_0x3d2369['model'];if(!_0x49d3b5[_0xc54a('0x3b')][_0xc54a('0x3e')](_0xc54a('0x3f'))){_0x1f5d2d[_0xc54a('0x28')]=qs['limit'](_0x49d3b5[_0xc54a('0x3b')][_0xc54a('0x28')]);_0x1f5d2d[_0xc54a('0x2a')]=qs[_0xc54a('0x2a')](_0x49d3b5[_0xc54a('0x3b')]['offset']);}_0x1f5d2d[_0xc54a('0x40')]=qs[_0xc54a('0x41')](_0x49d3b5['query'][_0xc54a('0x41')]);_0x1f5d2d[_0xc54a('0x42')]=qs[_0xc54a('0x43')](_['pick'](_0x49d3b5['query'],_0x3d2369[_0xc54a('0x43')]),_0x485ed0);if(_0x49d3b5[_0xc54a('0x3b')][_0xc54a('0x44')]){_0x1f5d2d['where']=_[_0xc54a('0x45')](_0x1f5d2d[_0xc54a('0x42')],{'$or':_[_0xc54a('0x34')](_0x485ed0,function(_0x5c34c7){if(_0x5c34c7[_0xc54a('0x36')]!=='VIRTUAL'){var _0x434686={};_0x434686[_0x5c34c7['name']]={'$like':'%'+_0x49d3b5[_0xc54a('0x3b')]['filter']+'%'};return _0x434686;}})});}_0x1f5d2d=_[_0xc54a('0x45')]({},_0x1f5d2d,_0x49d3b5[_0xc54a('0x46')]);var _0xc6ad71={'where':_0x1f5d2d[_0xc54a('0x42')]};return db['Network']['count'](_0xc6ad71)[_0xc54a('0x1a')](function(_0x37cb43){_0x19f0cc[_0xc54a('0x29')]=_0x37cb43;if(_0x49d3b5[_0xc54a('0x3b')][_0xc54a('0x47')]){_0x1f5d2d[_0xc54a('0x48')]=[{'all':!![]}];}return db[_0xc54a('0x49')][_0xc54a('0x4a')](_0x1f5d2d);})[_0xc54a('0x1a')](function(_0x542431){_0x19f0cc[_0xc54a('0x4b')]=_0x542431;return _0x19f0cc;})['then'](respondWithFilteredResult(_0x290fa4,_0x1f5d2d))[_0xc54a('0x24')](handleError(_0x290fa4,null));};exports[_0xc54a('0x4c')]=function(_0x308138,_0x58d88c){var _0x546c3d={'raw':!![],'where':{'id':_0x308138[_0xc54a('0x4d')]['id']}},_0x40960b={};_0x40960b[_0xc54a('0x38')]=_[_0xc54a('0x39')](db['Network'][_0xc54a('0x4e')]);_0x40960b[_0xc54a('0x3b')]=_['keys'](_0x308138[_0xc54a('0x3b')]);_0x40960b['filters']=_[_0xc54a('0x3a')](_0x40960b['model'],_0x40960b['query']);_0x546c3d['attributes']=_['intersection'](_0x40960b[_0xc54a('0x38')],qs[_0xc54a('0x3d')](_0x308138[_0xc54a('0x3b')][_0xc54a('0x3d')]));_0x546c3d[_0xc54a('0x3c')]=_0x546c3d[_0xc54a('0x3c')][_0xc54a('0x4f')]?_0x546c3d[_0xc54a('0x3c')]:_0x40960b[_0xc54a('0x38')];if(_0x308138[_0xc54a('0x3b')]['includeAll']){_0x546c3d[_0xc54a('0x48')]=[{'all':!![]}];}_0x546c3d=_[_0xc54a('0x45')]({},_0x546c3d,_0x308138[_0xc54a('0x46')]);return db[_0xc54a('0x49')][_0xc54a('0x50')](_0x546c3d)[_0xc54a('0x1a')](handleEntityNotFound(_0x58d88c,null))['then'](respondWithResult(_0x58d88c,null))[_0xc54a('0x24')](handleError(_0x58d88c,null));};exports[_0xc54a('0x51')]=function(_0x4b1aae,_0x13d311,_0x26519b){var _0x2ba97b;return db['sequelize'][_0xc54a('0x52')](function(_0x52c84e){return db[_0xc54a('0x49')][_0xc54a('0x51')](_0x4b1aae[_0xc54a('0x53')],{'raw':!![]})['then'](function(_0x27e78f){_0x2ba97b=_0x27e78f;return db[_0xc54a('0x49')][_0xc54a('0x4a')]({'where':{'type':_0x4b1aae[_0xc54a('0x53')][_0xc54a('0x36')]},'raw':!![]});})['then'](function(_0x345d00){if(_0x2ba97b[_0xc54a('0x36')][_0xc54a('0x54')]()==_0xc54a('0x55')){var _0x49867b=fs['readFileSync'](path['join'](config[_0xc54a('0x56')],'server/files/templates/stun_multiple.ejs'),_0xc54a('0x57'));var _0x5a0a7d=ejs[_0xc54a('0x58')](_0x49867b,{'networks':_0x345d00||[]});fs[_0xc54a('0x59')](_0xc54a('0x5a'),_0x5a0a7d);return respondWithRpcPromise(_0xc54a('0x5b'),'create',{'module':_0xc54a('0x5c')});}else if(_0x2ba97b['type']['toUpperCase']()==_0xc54a('0x5d')){var _0x2a87ac=fs[_0xc54a('0x5e')](path[_0xc54a('0x5f')](config['root'],_0xc54a('0x60')),'utf8');var _0x4a5369=ejs[_0xc54a('0x58')](_0x2a87ac,{'networks':_0x345d00||[]});fs['writeFileSync'](_0xc54a('0x61'),_0x4a5369);return respondWithRpcPromise(_0xc54a('0x5b'),'create',{'module':_0xc54a('0x5c')});}else{var _0x503762=fs[_0xc54a('0x5e')](path[_0xc54a('0x5f')](config[_0xc54a('0x56')],_0xc54a('0x62')),_0xc54a('0x57'));var _0x5df1fe=ejs['render'](_0x503762,{'networks':_0x345d00||[]});fs[_0xc54a('0x59')](util[_0xc54a('0x63')](_0xc54a('0x64'),_0x4b1aae['body'][_0xc54a('0x36')][_0xc54a('0x65')]()),_0x5df1fe);return respondWithRpcPromise(_0xc54a('0x5b'),_0xc54a('0x51'),{'module':'chan_sip.so'});}return null;})[_0xc54a('0x1a')](function(){return _0x2ba97b;});})['then'](respondWithResult(_0x13d311,0xc9))[_0xc54a('0x24')](handleError(_0x13d311,null));};exports['update']=function(_0x44062e,_0x3d9a61,_0xe19248){var _0x4571cd;return db[_0xc54a('0x66')]['transaction'](function(_0x18bf5f){return db[_0xc54a('0x49')][_0xc54a('0x50')]({'where':{'id':_0x44062e['params']['id']}})['then'](handleEntityNotFound(_0x3d9a61,null))[_0xc54a('0x1a')](saveUpdates(_0x44062e[_0xc54a('0x53')],null))['then'](function(_0xfbadcf){if(_0xfbadcf){_0x4571cd=_0xfbadcf;return db['Network']['findAll']({'where':{'type':_0x4571cd['type']},'raw':!![]});}return null;})[_0xc54a('0x1a')](function(_0x8fec3e){if(_0x4571cd['type'][_0xc54a('0x54')]()=='STUN'){var _0x5146d8=fs['readFileSync'](path[_0xc54a('0x5f')](config[_0xc54a('0x56')],'server/files/templates/stun_multiple.ejs'),_0xc54a('0x57'));var _0x138f13=ejs[_0xc54a('0x58')](_0x5146d8,{'networks':_0x8fec3e||[]});fs['writeFileSync'](_0xc54a('0x5a'),_0x138f13);return respondWithRpcPromise(_0xc54a('0x5b'),_0xc54a('0x67'),{'module':_0xc54a('0x5c')});}else if(_0x4571cd[_0xc54a('0x36')][_0xc54a('0x54')]()==_0xc54a('0x5d')){var _0x3cd09b=fs['readFileSync'](path[_0xc54a('0x5f')](config['root'],_0xc54a('0x60')),'utf8');var _0x2f9993=ejs[_0xc54a('0x58')](_0x3cd09b,{'networks':_0x8fec3e||[]});fs['writeFileSync'](_0xc54a('0x61'),_0x2f9993);return respondWithRpcPromise(_0xc54a('0x5b'),_0xc54a('0x67'),{'module':'res_stun_monitor.so'});}else{var _0x1d504e=fs[_0xc54a('0x5e')](path[_0xc54a('0x5f')](config[_0xc54a('0x56')],_0xc54a('0x62')),'utf8');var _0x3fde31=ejs[_0xc54a('0x58')](_0x1d504e,{'networks':_0x8fec3e||[]});fs[_0xc54a('0x59')](util[_0xc54a('0x63')](_0xc54a('0x64'),_0x44062e[_0xc54a('0x53')][_0xc54a('0x36')][_0xc54a('0x65')]()),_0x3fde31);return respondWithRpcPromise(_0xc54a('0x5b'),_0xc54a('0x67'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55c688){if(_0x55c688){return _0x4571cd;}return null;});})[_0xc54a('0x1a')](respondWithResult(_0x3d9a61,null))['catch'](handleError(_0x3d9a61,null));};exports[_0xc54a('0x2f')]=function(_0x3d750d,_0x4371f5,_0x5f1f79){var _0x528503;return db[_0xc54a('0x49')]['find']({'where':{'id':_0x3d750d[_0xc54a('0x4d')]['id']}})['then'](function(_0x2c7dab){_0x528503=_0x2c7dab;return _0x2c7dab;})[_0xc54a('0x1a')](handleEntityNotFound(_0x4371f5,null))[_0xc54a('0x1a')](removeEntity(_0x4371f5,null))[_0xc54a('0x1a')](function(){if(_0x528503){return db['Network'][_0xc54a('0x4a')]({'where':{'type':_0x528503[_0xc54a('0x36')]},'raw':!![]});}})['then'](function(_0x506445){if(_0x528503[_0xc54a('0x36')][_0xc54a('0x54')]()==_0xc54a('0x55')){var _0x3e96c6=fs[_0xc54a('0x5e')](path[_0xc54a('0x5f')](config['root'],_0xc54a('0x68')),'utf8');var _0x1e1de3=ejs[_0xc54a('0x58')](_0x3e96c6,{'networks':_0x506445||[]});fs[_0xc54a('0x59')](_0xc54a('0x5a'),_0x1e1de3);return respondWithRpcPromise(_0xc54a('0x5b'),'destroy',{'module':_0xc54a('0x5c')});}else if(_0x528503[_0xc54a('0x36')][_0xc54a('0x54')]()==_0xc54a('0x5d')){var _0x32a492=fs[_0xc54a('0x5e')](path[_0xc54a('0x5f')](config[_0xc54a('0x56')],_0xc54a('0x60')),_0xc54a('0x57'));var _0x5176d7=ejs[_0xc54a('0x58')](_0x32a492,{'networks':_0x506445||[]});fs[_0xc54a('0x59')](_0xc54a('0x61'),_0x5176d7);return respondWithRpcPromise('Reload',_0xc54a('0x2f'),{'module':_0xc54a('0x5c')});}else{var _0x43cca3=fs[_0xc54a('0x5e')](path[_0xc54a('0x5f')](config[_0xc54a('0x56')],_0xc54a('0x62')),_0xc54a('0x57'));var _0x16769d=ejs[_0xc54a('0x58')](_0x43cca3,{'networks':_0x506445||[]});fs[_0xc54a('0x59')](util[_0xc54a('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x3d750d[_0xc54a('0x53')][_0xc54a('0x36')]['toLowerCase']()),_0x16769d);return respondWithRpcPromise(_0xc54a('0x5b'),_0xc54a('0x2f'),{'module':_0xc54a('0x69')});}return null;})[_0xc54a('0x24')](handleError(_0x4371f5,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 75c7e31..e542d99 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','moment','bluebird'];(function(_0x33a59e,_0x54050c){var _0x532d51=function(_0x8e8b23){while(--_0x8e8b23){_0x33a59e['push'](_0x33a59e['shift']());}};_0x532d51(++_0x54050c);}(_0xe706,0xa3));var _0x6e70=function(_0x136e11,_0x29bd0b){_0x136e11=_0x136e11-0x0;var _0x36d346=_0xe706[_0x136e11];return _0x36d346;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./network.attributes','Network','network'];(function(_0xe5a1b0,_0x3a5304){var _0x29584f=function(_0x221ff4){while(--_0x221ff4){_0xe5a1b0['push'](_0xe5a1b0['shift']());}};_0x29584f(++_0x3a5304);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x199162,_0xfd0011){_0x199162=_0x199162-0x0;var _0x12f276=_0x4fdb[_0x199162];return _0x12f276;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 4a748b5..720c21f 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(_0x4f0966,_0x578faa){var _0x1e517d=function(_0x20b704){while(--_0x20b704){_0x4f0966['push'](_0x4f0966['shift']());}};_0x1e517d(++_0x578faa);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3cf56b,_0x9da3fb){var _0xa2b2aa=function(_0x3a5da){while(--_0x3a5da){_0x3cf56b['push'](_0x3cf56b['shift']());}};_0xa2b2aa(++_0x9da3fb);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 566adc6..b176855 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 _0xd7dd=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer'];(function(_0xc35e79,_0x37df8f){var _0x2f2750=function(_0x33ab91){while(--_0x33ab91){_0xc35e79['push'](_0xc35e79['shift']());}};_0x2f2750(++_0x37df8f);}(_0xd7dd,0x1af));var _0xdd7d=function(_0x5e50e6,_0x5955e0){_0x5e50e6=_0x5e50e6-0x0;var _0x17e2e6=_0xd7dd[_0x5e50e6];return _0x17e2e6;};'use strict';var multer=require(_0xdd7d('0x0'));var util=require(_0xdd7d('0x1'));var path=require(_0xdd7d('0x2'));var timeout=require(_0xdd7d('0x3'));var express=require(_0xdd7d('0x4'));var router=express[_0xdd7d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd7d('0x6'));var config=require(_0xdd7d('0x7'));var controller=require(_0xdd7d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd7d('0x9')]);router[_0xdd7d('0xa')](_0xdd7d('0xb'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0xd')]);router['get'](_0xdd7d('0xe'),auth[_0xdd7d('0xc')](),controller['show']);router[_0xdd7d('0xa')](_0xdd7d('0xf'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x10')]);router[_0xdd7d('0xa')](_0xdd7d('0x11'),auth[_0xdd7d('0xc')](),controller['getAnswers']);router[_0xdd7d('0xa')](_0xdd7d('0x12'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xdd7d('0x13'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x14')]);router[_0xdd7d('0xa')](_0xdd7d('0x15'),auth[_0xdd7d('0xc')](),controller['getAgents']);router[_0xdd7d('0x16')]('/',auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x17')]);router[_0xdd7d('0x16')]('/:id/dispositions',auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x18')]);router[_0xdd7d('0x16')](_0xdd7d('0x11'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x19')]);router[_0xdd7d('0x16')](_0xdd7d('0x1a'),controller[_0xdd7d('0x1b')]);router[_0xdd7d('0x16')](_0xdd7d('0x12'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x1c')]);router[_0xdd7d('0x16')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xdd7d('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0xdd7d('0x1d')]);router['put'](_0xdd7d('0xe'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x1e')]);router['delete'](_0xdd7d('0xe'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x1f')]);router[_0xdd7d('0x20')](_0xdd7d('0xf'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x21')]);router['delete']('/:id/canned_answers',auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x22')]);router[_0xdd7d('0x20')](_0xdd7d('0x15'),auth[_0xdd7d('0xc')](),controller[_0xdd7d('0x23')]);module['exports']=router; \ No newline at end of file +var _0xb57e=['addAgents','/:id/send','send','put','/:id','update','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','addDisposition','post','/:id/notify','/:id/applications','addApplications'];(function(_0x576477,_0x57915e){var _0x1341f9=function(_0x29d164){while(--_0x29d164){_0x576477['push'](_0x576477['shift']());}};_0x1341f9(++_0x57915e);}(_0xb57e,0x7c));var _0xeb57=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xb57e[_0x685346];return _0x52e15b;};'use strict';var multer=require(_0xeb57('0x0'));var util=require('util');var path=require(_0xeb57('0x1'));var timeout=require(_0xeb57('0x2'));var express=require(_0xeb57('0x3'));var router=express['Router']();var fs_extra=require(_0xeb57('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeb57('0x5'));var config=require(_0xeb57('0x6'));var controller=require(_0xeb57('0x7'));router[_0xeb57('0x8')]('/',auth[_0xeb57('0x9')](),controller[_0xeb57('0xa')]);router['get'](_0xeb57('0xb'),auth['isAuthenticated'](),controller[_0xeb57('0xc')]);router[_0xeb57('0x8')]('/:id',auth[_0xeb57('0x9')](),controller['show']);router[_0xeb57('0x8')](_0xeb57('0xd'),auth['isAuthenticated'](),controller[_0xeb57('0xe')]);router[_0xeb57('0x8')](_0xeb57('0xf'),auth[_0xeb57('0x9')](),controller[_0xeb57('0x10')]);router[_0xeb57('0x8')]('/:id/applications',auth[_0xeb57('0x9')](),controller[_0xeb57('0x11')]);router[_0xeb57('0x8')](_0xeb57('0x12'),auth[_0xeb57('0x9')](),controller[_0xeb57('0x13')]);router[_0xeb57('0x8')](_0xeb57('0x14'),auth[_0xeb57('0x9')](),controller[_0xeb57('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb57('0x16')]);router['post'](_0xeb57('0xd'),auth[_0xeb57('0x9')](),controller[_0xeb57('0x17')]);router[_0xeb57('0x18')](_0xeb57('0xf'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xeb57('0x19'),controller['notify']);router['post'](_0xeb57('0x1a'),auth[_0xeb57('0x9')](),controller[_0xeb57('0x1b')]);router['post']('/:id/users',auth[_0xeb57('0x9')](),controller[_0xeb57('0x1c')]);router[_0xeb57('0x18')](_0xeb57('0x1d'),auth[_0xeb57('0x9')](),controller[_0xeb57('0x1e')]);router[_0xeb57('0x1f')](_0xeb57('0x20'),auth[_0xeb57('0x9')](),controller[_0xeb57('0x21')]);router[_0xeb57('0x22')](_0xeb57('0x20'),auth[_0xeb57('0x9')](),controller['destroy']);router['delete'](_0xeb57('0xd'),auth[_0xeb57('0x9')](),controller['removeDispositions']);router[_0xeb57('0x22')]('/:id/canned_answers',auth[_0xeb57('0x9')](),controller[_0xeb57('0x23')]);router[_0xeb57('0x22')](_0xeb57('0x14'),auth[_0xeb57('0x9')](),controller[_0xeb57('0x24')]);module[_0xeb57('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 e7c6768..81eba0f 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 _0x4173=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','STRING','name','generate','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4173,0x74));var _0x3417=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x4173[_0x2f57b2];return _0x5ace77;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x3417('0x0'));module['exports']={'name':{'type':Sequelize[_0x3417('0x1')],'unique':_0x3417('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3417('0x1')],'defaultValue':function(){return rs[_0x3417('0x3')]();}},'replyUri':{'type':Sequelize[_0x3417('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3417('0x4')],'defaultValue':function(){return _0x3417('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3417('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3417('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x3417('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3417('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3417('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3417('0x7')],'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[_0x3417('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2295a5){if(!_0x2295a5)this['setDataValue'](_0x3417('0x8'),null);this[_0x3417('0x9')](_0x3417('0xa'),_0x2295a5);}}}; \ No newline at end of file +var _0xe632=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x13b25c,_0x102fff){var _0x3b6328=function(_0x54e80a){while(--_0x54e80a){_0x13b25c['push'](_0x13b25c['shift']());}};_0x3b6328(++_0x102fff);}(_0xe632,0xc9));var _0x2e63=function(_0x468c5a,_0x5b96e4){_0x468c5a=_0x468c5a-0x0;var _0x25fe2b=_0xe632[_0x468c5a];return _0x25fe2b;};'use strict';var Sequelize=require(_0x2e63('0x0'));var rs=require(_0x2e63('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2e63('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2e63('0x3')]},'token':{'type':Sequelize[_0x2e63('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2e63('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2e63('0x4')],'defaultValue':function(){return _0x2e63('0x5');}},'notificationSound':{'type':Sequelize[_0x2e63('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2e63('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2e63('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2e63('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2e63('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2e63('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2e63('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2e63('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x2e63('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2e63('0x6')],'defaultValue':![],'comment':_0x2e63('0x9'),'set':function(_0x3af3c2){if(!_0x3af3c2)this[_0x2e63('0xa')](_0x2e63('0xb'),null);this[_0x2e63('0xa')](_0x2e63('0xc'),_0x3af3c2);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index dad51bf..892f359 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 _0x00cb=['AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','user','Messages','dataValues','push','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','OpenchannelAccounts','UserProfileResource','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','show','params','keys','length','includeAll','merge','create','get','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','list','applications','orderBy','priority','asc','from','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged','OpenchannelMessage'];(function(_0x2b9cf5,_0x2a7804){var _0xd0cf15=function(_0x92a896){while(--_0x92a896){_0x2b9cf5['push'](_0x2b9cf5['shift']());}};_0xd0cf15(++_0x2a7804);}(_0x00cb,0x198));var _0xb00c=function(_0x51cbe9,_0x5c9343){_0x51cbe9=_0x51cbe9-0x0;var _0x81fcd0=_0x00cb[_0x51cbe9];return _0x81fcd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb00c('0x0'));var zipdir=require(_0xb00c('0x1'));var jsonpatch=require(_0xb00c('0x2'));var rp=require(_0xb00c('0x3'));var moment=require(_0xb00c('0x4'));var BPromise=require(_0xb00c('0x5'));var Mustache=require(_0xb00c('0x6'));var util=require(_0xb00c('0x7'));var path=require('path');var sox=require(_0xb00c('0x8'));var csv=require(_0xb00c('0x9'));var ejs=require(_0xb00c('0xa'));var fs=require('fs');var fs_extra=require(_0xb00c('0xb'));var _=require(_0xb00c('0xc'));var squel=require(_0xb00c('0xd'));var crypto=require('crypto');var jsforce=require(_0xb00c('0xe'));var deskjs=require(_0xb00c('0xf'));var toCsv=require(_0xb00c('0x9'));var querystring=require(_0xb00c('0x10'));var Papa=require('papaparse');var Redis=require(_0xb00c('0x11'));var authService=require(_0xb00c('0x12'));var qs=require(_0xb00c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb00c('0x14'))(_0xb00c('0x15'));var utils=require('../../config/utils');var config=require(_0xb00c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb00c('0x17')]=_[_0xb00c('0x18')](config['redis'],{'host':_0xb00c('0x19'),'port':0x18eb});var socket=require(_0xb00c('0x1a'))(new Redis(config[_0xb00c('0x17')]));require('./openchannelAccount.socket')[_0xb00c('0x1b')](socket);var jayson=require(_0xb00c('0x1c'));var client=jayson[_0xb00c('0x1d')][_0xb00c('0x1e')]({'port':0x232c});var client9002=jayson[_0xb00c('0x1d')][_0xb00c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x9cabc2,_0x4bdf4d,_0x4b1271,_0x16063d){return new BPromise(function(_0x5e7b18,_0x214608){var _0x1063fa=_0x16063d||client;return _0x1063fa[_0xb00c('0x1f')](_0x9cabc2,_0x4b1271)[_0xb00c('0x20')](function(_0x1d8f6c){logger[_0xb00c('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x4bdf4d,_0xb00c('0x22'));logger[_0xb00c('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4bdf4d,_0xb00c('0x22'),JSON['stringify'](_0x1d8f6c));if(_0x1d8f6c[_0xb00c('0x24')]){if(_0x1d8f6c[_0xb00c('0x24')][_0xb00c('0x25')]===0x1f4){logger[_0xb00c('0x24')](_0xb00c('0x26'),_0x4bdf4d,_0x1d8f6c[_0xb00c('0x24')]['message']);return _0x214608(_0x1d8f6c[_0xb00c('0x24')][_0xb00c('0x27')]);}logger[_0xb00c('0x24')](_0xb00c('0x26'),_0x4bdf4d,_0x1d8f6c[_0xb00c('0x24')][_0xb00c('0x27')]);return _0x5e7b18(_0x1d8f6c[_0xb00c('0x24')][_0xb00c('0x27')]);}else{logger[_0xb00c('0x21')](_0xb00c('0x26'),_0x4bdf4d,'request\x20sent');_0x5e7b18(_0x1d8f6c[_0xb00c('0x28')][_0xb00c('0x27')]);}})[_0xb00c('0x29')](function(_0x500b25){logger[_0xb00c('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x4bdf4d,_0x500b25);_0x214608(_0x500b25);});});}function respondWithStatusCode(_0x4189a6,_0x485fb0){_0x485fb0=_0x485fb0||0xcc;return function(_0x4e78e4){if(_0x4e78e4){return _0x4189a6['sendStatus'](_0x485fb0);}return _0x4189a6[_0xb00c('0x2a')](_0x485fb0)[_0xb00c('0x2b')]();};}function respondWithResult(_0x498d8f,_0x2a25b3){_0x2a25b3=_0x2a25b3||0xc8;return function(_0x5e47a9){if(_0x5e47a9){return _0x498d8f['status'](_0x2a25b3)[_0xb00c('0x2c')](_0x5e47a9);}};}function respondWithFilteredResult(_0x599c3e,_0x219337){return function(_0x294692){if(_0x294692){var _0x48b595=typeof _0x219337[_0xb00c('0x2d')]===_0xb00c('0x2e')&&typeof _0x219337[_0xb00c('0x2f')]==='undefined';var _0x51850b=_0x294692[_0xb00c('0x30')];var _0x960a2a=_0x48b595?0x0:_0x219337[_0xb00c('0x2d')];var _0x279a60=_0x48b595?_0x294692['count']:_0x219337[_0xb00c('0x2d')]+_0x219337[_0xb00c('0x2f')];var _0x19b4da;if(_0x279a60>=_0x51850b){_0x279a60=_0x51850b;_0x19b4da=0xc8;}else{_0x19b4da=0xce;}_0x599c3e[_0xb00c('0x2a')](_0x19b4da);return _0x599c3e[_0xb00c('0x31')]('Content-Range',_0x960a2a+'-'+_0x279a60+'/'+_0x51850b)[_0xb00c('0x2c')](_0x294692);}return null;};}function patchUpdates(_0x363274){return function(_0x57c104){try{jsonpatch[_0xb00c('0x32')](_0x57c104,_0x363274,!![]);}catch(_0x3f0e2c){return BPromise['reject'](_0x3f0e2c);}return _0x57c104[_0xb00c('0x33')]();};}function saveUpdates(_0x429f4a,_0x2ebb17){return function(_0x30c0d8){if(_0x30c0d8){return _0x30c0d8[_0xb00c('0x34')](_0x429f4a)[_0xb00c('0x20')](function(_0x2a59ac){return _0x2a59ac;});}return null;};}function removeEntity(_0x26c7c7,_0x1d8fd0){return function(_0x2fdf98){if(_0x2fdf98){return _0x2fdf98[_0xb00c('0x35')]()[_0xb00c('0x20')](function(){var _0x3db58c=_0x2fdf98['get']({'plain':!![]});var _0x875fe=_0xb00c('0x36');return db[_0xb00c('0x37')]['destroy']({'where':{'type':_0x875fe,'resourceId':_0x3db58c['id']}})[_0xb00c('0x20')](function(){return _0x2fdf98;});})[_0xb00c('0x20')](function(){_0x26c7c7[_0xb00c('0x2a')](0xcc)[_0xb00c('0x2b')]();});}};}function handleEntityNotFound(_0x5b5949,_0x3dde8b){return function(_0x2302c5){if(!_0x2302c5){_0x5b5949[_0xb00c('0x38')](0x194);}return _0x2302c5;};}function handleError(_0x25f417,_0x20785a){_0x20785a=_0x20785a||0x1f4;return function(_0x57ef43){logger[_0xb00c('0x24')](_0x57ef43['stack']);if(_0x57ef43[_0xb00c('0x39')]){delete _0x57ef43['name'];}_0x25f417['status'](_0x20785a)[_0xb00c('0x3a')](_0x57ef43);};}exports[_0xb00c('0x3b')]=function(_0x2c79fc,_0x49dd27){var _0x5d4f55={'include':[{'model':db[_0xb00c('0x3c')],'as':_0xb00c('0x3d')}]},_0xbd5de1={},_0xbf03a1={'count':0x0,'rows':[]};var _0x7c69b7=_[_0xb00c('0x3e')](db[_0xb00c('0x3f')][_0xb00c('0x40')],function(_0x198e40){return{'name':_0x198e40[_0xb00c('0x41')],'type':_0x198e40[_0xb00c('0x42')][_0xb00c('0x43')]};});_0xbd5de1[_0xb00c('0x44')]=_[_0xb00c('0x3e')](_0x7c69b7,_0xb00c('0x39'));_0xbd5de1[_0xb00c('0x45')]=_['keys'](_0x2c79fc['query']);_0xbd5de1[_0xb00c('0x46')]=_[_0xb00c('0x47')](_0xbd5de1[_0xb00c('0x44')],_0xbd5de1[_0xb00c('0x45')]);_0x5d4f55['attributes']=_['intersection'](_0xbd5de1['model'],qs[_0xb00c('0x48')](_0x2c79fc['query'][_0xb00c('0x48')]));_0x5d4f55[_0xb00c('0x49')]=_0x5d4f55[_0xb00c('0x49')]['length']?_0x5d4f55[_0xb00c('0x49')]:_0xbd5de1[_0xb00c('0x44')];if(!_0x2c79fc[_0xb00c('0x45')][_0xb00c('0x4a')](_0xb00c('0x4b'))){_0x5d4f55[_0xb00c('0x2f')]=qs[_0xb00c('0x2f')](_0x2c79fc[_0xb00c('0x45')][_0xb00c('0x2f')]);_0x5d4f55[_0xb00c('0x2d')]=qs[_0xb00c('0x2d')](_0x2c79fc[_0xb00c('0x45')]['offset']);}_0x5d4f55[_0xb00c('0x4c')]=qs[_0xb00c('0x4d')](_0x2c79fc[_0xb00c('0x45')][_0xb00c('0x4d')]);_0x5d4f55['where']=qs['filters'](_[_0xb00c('0x4e')](_0x2c79fc['query'],_0xbd5de1[_0xb00c('0x46')]),_0x7c69b7);if(_0x2c79fc[_0xb00c('0x45')][_0xb00c('0x4f')]){_0x5d4f55[_0xb00c('0x50')]=_['merge'](_0x5d4f55['where'],{'$or':_[_0xb00c('0x3e')](_0x7c69b7,function(_0x114b56){if(_0x114b56[_0xb00c('0x42')]!==_0xb00c('0x51')){var _0x4040ca={};_0x4040ca[_0x114b56[_0xb00c('0x39')]]={'$like':'%'+_0x2c79fc['query']['filter']+'%'};return _0x4040ca;}})});}_0x5d4f55=_['merge']({},_0x5d4f55,_0x2c79fc[_0xb00c('0x52')]);var _0x1f7e19={'where':_0x5d4f55[_0xb00c('0x50')]};return db['OpenchannelAccount'][_0xb00c('0x30')](_0x1f7e19)[_0xb00c('0x20')](function(_0x50bf21){_0xbf03a1[_0xb00c('0x30')]=_0x50bf21;if(_0x2c79fc[_0xb00c('0x45')]['includeAll']){_0x5d4f55[_0xb00c('0x53')]=[{'all':!![]}];}return db[_0xb00c('0x3f')][_0xb00c('0x54')](_0x5d4f55);})[_0xb00c('0x20')](function(_0x1b4946){_0xbf03a1[_0xb00c('0x55')]=_0x1b4946;return _0xbf03a1;})[_0xb00c('0x20')](respondWithFilteredResult(_0x49dd27,_0x5d4f55))[_0xb00c('0x29')](handleError(_0x49dd27,null));};exports[_0xb00c('0x56')]=function(_0x222d12,_0x2f9adc){var _0x3ca1a0={'raw':![],'where':{'id':_0x222d12[_0xb00c('0x57')]['id']},'include':[{'model':db[_0xb00c('0x3c')],'as':_0xb00c('0x3d')}]},_0x531a9b={};_0x531a9b[_0xb00c('0x44')]=_[_0xb00c('0x58')](db[_0xb00c('0x3f')][_0xb00c('0x40')]);_0x531a9b[_0xb00c('0x45')]=_['keys'](_0x222d12[_0xb00c('0x45')]);_0x531a9b[_0xb00c('0x46')]=_[_0xb00c('0x47')](_0x531a9b['model'],_0x531a9b[_0xb00c('0x45')]);_0x3ca1a0[_0xb00c('0x49')]=_['intersection'](_0x531a9b[_0xb00c('0x44')],qs['fields'](_0x222d12[_0xb00c('0x45')][_0xb00c('0x48')]));_0x3ca1a0[_0xb00c('0x49')]=_0x3ca1a0['attributes'][_0xb00c('0x59')]?_0x3ca1a0[_0xb00c('0x49')]:_0x531a9b['model'];if(_0x222d12['query'][_0xb00c('0x5a')]){_0x3ca1a0[_0xb00c('0x53')]=[{'all':!![]}];}_0x3ca1a0=_[_0xb00c('0x5b')]({},_0x3ca1a0,_0x222d12['options']);return db[_0xb00c('0x3f')]['find'](_0x3ca1a0)[_0xb00c('0x20')](handleEntityNotFound(_0x2f9adc,null))['then'](respondWithResult(_0x2f9adc,null))[_0xb00c('0x29')](handleError(_0x2f9adc,null));};exports[_0xb00c('0x5c')]=function(_0x3defe0,_0x3443fd){return db[_0xb00c('0x3f')][_0xb00c('0x5c')](_0x3defe0['body'],{})[_0xb00c('0x20')](function(_0x28faed){var _0x5e3058=_0x3defe0['user'][_0xb00c('0x5d')]({'plain':!![]});if(!_0x5e3058)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e3058[_0xb00c('0x5e')]==='user'){var _0x3aa527=_0x28faed[_0xb00c('0x5d')]({'plain':!![]});var _0x4f3c8b=_0xb00c('0x36');return db['UserProfileSection'][_0xb00c('0x5f')]({'where':{'name':_0x4f3c8b,'userProfileId':_0x5e3058[_0xb00c('0x60')]},'raw':!![]})[_0xb00c('0x20')](function(_0x49f0be){if(_0x49f0be&&_0x49f0be[_0xb00c('0x61')]===0x0){return db['UserProfileResource'][_0xb00c('0x5c')]({'name':_0x3aa527[_0xb00c('0x39')],'resourceId':_0x3aa527['id'],'type':_0x49f0be[_0xb00c('0x39')],'sectionId':_0x49f0be['id']},{})['then'](function(){return _0x28faed;});}else{return _0x28faed;}})['catch'](function(_0x9b5c5e){logger['error'](_0xb00c('0x62'),_0x9b5c5e);throw _0x9b5c5e;});}return _0x28faed;})[_0xb00c('0x20')](respondWithResult(_0x3443fd,0xc9))[_0xb00c('0x29')](handleError(_0x3443fd,null));};exports['update']=function(_0x614f5a,_0x2534e1){if(_0x614f5a[_0xb00c('0x63')]['id']){delete _0x614f5a[_0xb00c('0x63')]['id'];}return db[_0xb00c('0x3f')][_0xb00c('0x5f')]({'where':{'id':_0x614f5a[_0xb00c('0x57')]['id']},'include':[{'model':db[_0xb00c('0x3c')],'as':_0xb00c('0x3d')}]})[_0xb00c('0x20')](handleEntityNotFound(_0x2534e1,null))[_0xb00c('0x20')](saveUpdates(_0x614f5a[_0xb00c('0x63')],null))[_0xb00c('0x20')](respondWithResult(_0x2534e1,null))['catch'](handleError(_0x2534e1,null));};exports[_0xb00c('0x35')]=function(_0x41bb81,_0x1d5469){return db['OpenchannelAccount'][_0xb00c('0x5f')]({'where':{'id':_0x41bb81['params']['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x1d5469,null))[_0xb00c('0x20')](removeEntity(_0x1d5469,null))[_0xb00c('0x29')](handleError(_0x1d5469,null));};exports[_0xb00c('0x64')]=function(_0x3fb7e3,_0x29d736){return db[_0xb00c('0x3f')][_0xb00c('0x64')]()['then'](respondWithResult(_0x29d736,null))[_0xb00c('0x29')](handleError(_0x29d736,null));};exports[_0xb00c('0x65')]=function(_0x2c8822,_0x5a0fd9,_0x167a27){if(_0x2c8822[_0xb00c('0x63')]['id']){delete _0x2c8822[_0xb00c('0x63')]['id'];}return db[_0xb00c('0x3f')][_0xb00c('0x5f')]({'where':{'id':_0x2c8822[_0xb00c('0x57')]['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x5a0fd9,null))[_0xb00c('0x20')](function(_0x59af97){if(_0x59af97){_0x2c8822['body']['OpenchannelAccountId']=_0x59af97['id'];return db[_0xb00c('0x66')][_0xb00c('0x5c')](_0x2c8822[_0xb00c('0x63')]);}})[_0xb00c('0x20')](respondWithResult(_0x5a0fd9,null))['catch'](handleError(_0x5a0fd9,null));};exports[_0xb00c('0x67')]=function(_0x2ed37f,_0x2930be,_0x2e3c94){var _0x30ffe1={'raw':![],'where':{}};var _0x532c5f={};var _0x43dcb7={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb00c('0x68')]({'where':{'id':_0x2ed37f[_0xb00c('0x57')]['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x2930be,null))[_0xb00c('0x20')](function(_0x5db5ce){if(_0x5db5ce){_0x532c5f[_0xb00c('0x44')]=_[_0xb00c('0x58')](db[_0xb00c('0x66')]['rawAttributes']);_0x532c5f['query']=_['keys'](_0x2ed37f[_0xb00c('0x45')]);_0x532c5f['filters']=_[_0xb00c('0x47')](_0x532c5f[_0xb00c('0x44')],_0x532c5f['query']);_0x30ffe1[_0xb00c('0x49')]=_[_0xb00c('0x47')](_0x532c5f['model'],qs[_0xb00c('0x48')](_0x2ed37f[_0xb00c('0x45')][_0xb00c('0x48')]));_0x30ffe1['attributes']=_0x30ffe1[_0xb00c('0x49')][_0xb00c('0x59')]?_0x30ffe1[_0xb00c('0x49')]:_0x532c5f['model'];if(!_0x2ed37f[_0xb00c('0x45')][_0xb00c('0x4a')](_0xb00c('0x4b'))){_0x30ffe1[_0xb00c('0x2f')]=qs[_0xb00c('0x2f')](_0x2ed37f[_0xb00c('0x45')][_0xb00c('0x2f')]);_0x30ffe1['offset']=qs['offset'](_0x2ed37f[_0xb00c('0x45')]['offset']);}_0x30ffe1[_0xb00c('0x4c')]=qs[_0xb00c('0x4d')](_0x2ed37f[_0xb00c('0x45')]['sort']);_0x30ffe1[_0xb00c('0x50')]=qs[_0xb00c('0x46')](_[_0xb00c('0x4e')](_0x2ed37f['query'],_0x532c5f['filters']));_0x30ffe1['where'][_0xb00c('0x69')]=_0x5db5ce['id'];if(_0x2ed37f[_0xb00c('0x45')][_0xb00c('0x4f')]){_0x30ffe1[_0xb00c('0x50')]=_[_0xb00c('0x5b')](_0x30ffe1['where'],{'$or':_[_0xb00c('0x3e')](_0x30ffe1['attributes'],function(_0x1f7269){var _0x573303={};_0x573303[_0x1f7269]={'$like':'%'+_0x2ed37f['query'][_0xb00c('0x4f')]+'%'};return _0x573303;})});}_0x30ffe1=_['merge']({},_0x30ffe1,_0x2ed37f[_0xb00c('0x52')]);return db[_0xb00c('0x66')][_0xb00c('0x30')]({'where':_0x30ffe1[_0xb00c('0x50')]})[_0xb00c('0x20')](function(_0x3df22f){_0x43dcb7[_0xb00c('0x30')]=_0x3df22f;if(_0x2ed37f[_0xb00c('0x45')][_0xb00c('0x5a')]){_0x30ffe1['include']=[{'all':!![]}];}return db['Disposition'][_0xb00c('0x54')](_0x30ffe1);})['then'](function(_0xf8d096){_0x43dcb7['rows']=_0xf8d096;return _0x43dcb7;});}})[_0xb00c('0x20')](respondWithFilteredResult(_0x2930be,_0x30ffe1))['catch'](handleError(_0x2930be,null));};exports['removeDispositions']=function(_0x7d990f,_0x465ddc,_0x1e656d){return db[_0xb00c('0x3f')][_0xb00c('0x5f')]({'where':{'id':_0x7d990f['params']['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x465ddc,null))[_0xb00c('0x20')](function(_0x36c936){if(_0x36c936){return _0x36c936['removeDispositions'](_0x7d990f[_0xb00c('0x45')][_0xb00c('0x6a')]);}})[_0xb00c('0x20')](respondWithStatusCode(_0x465ddc,null))[_0xb00c('0x29')](handleError(_0x465ddc,null));};exports[_0xb00c('0x6b')]=function(_0x2807b9,_0x170caf,_0x42fc2c){if(_0x2807b9['body']['id']){delete _0x2807b9['body']['id'];}return db[_0xb00c('0x3f')]['find']({'where':{'id':_0x2807b9['params']['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x170caf,null))[_0xb00c('0x20')](function(_0x4fda9b){if(_0x4fda9b){_0x2807b9['body'][_0xb00c('0x69')]=_0x4fda9b['id'];return db[_0xb00c('0x6c')][_0xb00c('0x5c')](_0x2807b9['body']);}})['then'](respondWithResult(_0x170caf,null))['catch'](handleError(_0x170caf,null));};exports[_0xb00c('0x6d')]=function(_0x1e18e8,_0x4e3512,_0x442619){var _0x45728d={'raw':![],'where':{}};var _0x5b7ca1={};var _0xb8950d={'count':0x0,'rows':[]};return db[_0xb00c('0x3f')][_0xb00c('0x68')]({'where':{'id':_0x1e18e8[_0xb00c('0x57')]['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x4e3512,null))[_0xb00c('0x20')](function(_0x15c066){if(_0x15c066){_0x5b7ca1[_0xb00c('0x44')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x5b7ca1[_0xb00c('0x45')]=_[_0xb00c('0x58')](_0x1e18e8['query']);_0x5b7ca1[_0xb00c('0x46')]=_['intersection'](_0x5b7ca1[_0xb00c('0x44')],_0x5b7ca1['query']);_0x45728d[_0xb00c('0x49')]=_[_0xb00c('0x47')](_0x5b7ca1['model'],qs[_0xb00c('0x48')](_0x1e18e8[_0xb00c('0x45')][_0xb00c('0x48')]));_0x45728d[_0xb00c('0x49')]=_0x45728d[_0xb00c('0x49')][_0xb00c('0x59')]?_0x45728d[_0xb00c('0x49')]:_0x5b7ca1[_0xb00c('0x44')];if(!_0x1e18e8['query']['hasOwnProperty'](_0xb00c('0x4b'))){_0x45728d[_0xb00c('0x2f')]=qs[_0xb00c('0x2f')](_0x1e18e8['query'][_0xb00c('0x2f')]);_0x45728d[_0xb00c('0x2d')]=qs[_0xb00c('0x2d')](_0x1e18e8[_0xb00c('0x45')]['offset']);}_0x45728d[_0xb00c('0x4c')]=qs[_0xb00c('0x4d')](_0x1e18e8[_0xb00c('0x45')][_0xb00c('0x4d')]);_0x45728d[_0xb00c('0x50')]=qs['filters'](_[_0xb00c('0x4e')](_0x1e18e8[_0xb00c('0x45')],_0x5b7ca1[_0xb00c('0x46')]));_0x45728d['where'][_0xb00c('0x69')]=_0x15c066['id'];if(_0x1e18e8[_0xb00c('0x45')]['filter']){_0x45728d[_0xb00c('0x50')]=_[_0xb00c('0x5b')](_0x45728d[_0xb00c('0x50')],{'$or':_['map'](_0x45728d['attributes'],function(_0x2ddaaa){var _0x32a02a={};_0x32a02a[_0x2ddaaa]={'$like':'%'+_0x1e18e8['query'][_0xb00c('0x4f')]+'%'};return _0x32a02a;})});}_0x45728d=_[_0xb00c('0x5b')]({},_0x45728d,_0x1e18e8[_0xb00c('0x52')]);return db['CannedAnswer'][_0xb00c('0x30')]({'where':_0x45728d[_0xb00c('0x50')]})[_0xb00c('0x20')](function(_0x523e92){_0xb8950d[_0xb00c('0x30')]=_0x523e92;if(_0x1e18e8[_0xb00c('0x45')][_0xb00c('0x5a')]){_0x45728d[_0xb00c('0x53')]=[{'all':!![]}];}return db[_0xb00c('0x6c')]['findAll'](_0x45728d);})[_0xb00c('0x20')](function(_0x471c63){_0xb8950d['rows']=_0x471c63;return _0xb8950d;});}})[_0xb00c('0x20')](respondWithFilteredResult(_0x4e3512,_0x45728d))[_0xb00c('0x29')](handleError(_0x4e3512,null));};exports[_0xb00c('0x6e')]=function(_0x31365d,_0x59a5fa,_0x3238e4){return db[_0xb00c('0x3f')][_0xb00c('0x5f')]({'where':{'id':_0x31365d[_0xb00c('0x57')]['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x59a5fa,null))[_0xb00c('0x20')](function(_0x2f5750){if(_0x2f5750){return _0x2f5750[_0xb00c('0x6e')](_0x31365d[_0xb00c('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x59a5fa,null))[_0xb00c('0x29')](handleError(_0x59a5fa,null));};exports[_0xb00c('0x6f')]=function(_0x38747f,_0x2666cb,_0x320336){var _0x5d09f9={'body':_0x38747f[_0xb00c('0x63')],'channel':_0xb00c('0x70')};var _0x56c2e3=[];var _0x151333=[];var _0x5dab26={};var _0x1ac7c6=![];return db[_0xb00c('0x71')][_0xb00c('0x64')]()[_0xb00c('0x20')](function(_0x385934){if(!_0x385934){throw new db['Sequelize'][(_0xb00c('0x72'))]('no\x20available\x20attributes');}_0x56c2e3=_[_0xb00c('0x73')](_[_0xb00c('0x58')](_0x385934),[_0xb00c('0x74'),_0xb00c('0x75')]);_0x151333=_[_0xb00c('0x73')](_[_0xb00c('0x58')](_0x385934),[_0xb00c('0x74'),_0xb00c('0x75'),_0xb00c('0x76'),_0xb00c('0x77')]);if(_0x38747f[_0xb00c('0x63')]['id']){delete _0x38747f[_0xb00c('0x63')]['id'];}if(_[_0xb00c('0x78')](_0x38747f[_0xb00c('0x63')]['from'])){throw new db[(_0xb00c('0x79'))][(_0xb00c('0x72'))]('from\x20is\x20mandatory');}if(_[_0xb00c('0x78')](_0x38747f[_0xb00c('0x63')][_0xb00c('0x63')])||_0x38747f[_0xb00c('0x63')][_0xb00c('0x63')]===''){throw new db[(_0xb00c('0x79'))][(_0xb00c('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb00c('0x78')](_0x38747f[_0xb00c('0x63')][_0xb00c('0x7a')])){throw new db[(_0xb00c('0x79'))][(_0xb00c('0x72'))](_0xb00c('0x7b')+_0x151333);}if(!_[_0xb00c('0x7c')](_0x151333,_0x38747f['body'][_0xb00c('0x7a')])){throw new db[(_0xb00c('0x79'))][(_0xb00c('0x72'))](_0xb00c('0x7d')+_0x151333);}_0x5dab26[_0x38747f['body'][_0xb00c('0x7a')]]=_0x38747f['body']['from'];})[_0xb00c('0x20')](function(){return db[_0xb00c('0x3f')][_0xb00c('0x5f')]({'where':{'id':_0x38747f[_0xb00c('0x57')]['id']},'include':[{'model':db[_0xb00c('0x7e')],'as':_0xb00c('0x7f'),'include':[{'model':db[_0xb00c('0x71')],'as':_0xb00c('0x80'),'where':_0x5dab26,'limit':0x1,'order':[[_0xb00c('0x75'),_0xb00c('0x81')]]}]},{'model':db['OpenchannelApplication'],'as':_0xb00c('0x82')}]});})[_0xb00c('0x20')](handleEntityNotFound(_0x2666cb,null))['then'](function(_0x31521a){if(_0x31521a&&_0x31521a[_0xb00c('0x7f')]){_0x5d09f9[_0xb00c('0x83')]=_0x31521a;_0x5d09f9['applications']=_0x31521a['Applications'];_0x5d09f9[_0xb00c('0x84')]=_0x31521a[_0xb00c('0x7f')];_0x5d09f9[_0xb00c('0x85')]=_[_0xb00c('0x86')](_0x5d09f9[_0xb00c('0x85')],[_0xb00c('0x87')],[_0xb00c('0x88')]);if(_0x5d09f9[_0xb00c('0x83')][_0xb00c('0x82')]){delete _0x5d09f9['account'][_0xb00c('0x82')];}if(_0x5d09f9[_0xb00c('0x83')][_0xb00c('0x7f')]&&_0x5d09f9['account'][_0xb00c('0x7f')]['Contacts']['length']){return _0x5d09f9[_0xb00c('0x83')][_0xb00c('0x7f')][_0xb00c('0x80')][0x0];}var _0x336f6e=_[_0xb00c('0x18')](_0x38747f[_0xb00c('0x63')],{'firstName':_0x38747f[_0xb00c('0x63')][_0xb00c('0x89')],'ListId':_0x31521a[_0xb00c('0x77')]});_0x336f6e[_0x38747f[_0xb00c('0x63')]['mapKey']]=_0x38747f[_0xb00c('0x63')][_0xb00c('0x89')];return db[_0xb00c('0x71')][_0xb00c('0x5c')](_0x336f6e,{'fields':_0x56c2e3,'raw':!![]});}})[_0xb00c('0x20')](handleEntityNotFound(_0x2666cb,null))[_0xb00c('0x20')](function(_0xb3f90c){_0x5d09f9[_0xb00c('0x8a')]=_0xb3f90c;if(_0xb3f90c){var _0x11780e={'ContactId':_0xb3f90c['id'],'OpenchannelAccountId':_0x38747f[_0xb00c('0x57')]['id'],'from':(_0xb3f90c[_0xb00c('0x8b')]||'')+'\x20'+(_0xb3f90c[_0xb00c('0x8c')]||'')};var _0xfe8141={'OpenchannelAccountId':_0x38747f[_0xb00c('0x57')]['id'],'closed':![]};if(_0x38747f['body']['threadId']){_0xfe8141[_0xb00c('0x8d')]=_0x38747f[_0xb00c('0x63')][_0xb00c('0x8d')];return db[_0xb00c('0x8e')]['find']({'where':_0xfe8141})[_0xb00c('0x20')](function(_0x3c456d){if(_0x3c456d){return[_0x3c456d,![]];}_0x11780e[_0xb00c('0x8d')]=_0x38747f[_0xb00c('0x63')][_0xb00c('0x8d')];_0x11780e['externalUrl']=_0x38747f['body'][_0xb00c('0x8f')];return db[_0xb00c('0x8e')][_0xb00c('0x5c')](_0x11780e)['then'](function(_0x254de8){return[_0x254de8,!![]];});});}else{_0xfe8141[_0xb00c('0x8d')]=null;}_0xfe8141[_0xb00c('0x90')]=_0xb3f90c['id'];return db['OpenchannelInteraction']['find']({'where':_0xfe8141})[_0xb00c('0x20')](function(_0x4cc790){if(_0x4cc790){return[_0x4cc790,![]];}return db[_0xb00c('0x8e')]['create'](_0x11780e)[_0xb00c('0x20')](function(_0x9acd4d){return[_0x9acd4d,!![]];});});}})[_0xb00c('0x91')](function(_0x58622a,_0x3b463c){if(_0x58622a){_0x1ac7c6=_0x3b463c;if(!_0x3b463c){var _0x25f69b={'from':(_0x5d09f9['contact'][_0xb00c('0x8b')]||'')+'\x20'+(_0x5d09f9[_0xb00c('0x8a')]['lastName']||'')};if(_0x38747f['body'][_0xb00c('0x8d')]&&_0x38747f[_0xb00c('0x63')]['messageId']&&_0x38747f[_0xb00c('0x63')]['threadId']!=_0x38747f[_0xb00c('0x63')][_0xb00c('0x92')]){_0x25f69b[_0xb00c('0x8d')]=_0x38747f['body'][_0xb00c('0x92')];}return _0x58622a[_0xb00c('0x34')](_0x25f69b);}else{return _0x58622a;}}})[_0xb00c('0x20')](function(_0x5bb14d){_0x5d09f9[_0xb00c('0x93')]=_0x5bb14d[_0xb00c('0x5d')]({'plain':!![]});_0x5d09f9['interaction'][_0xb00c('0x94')]=_0x1ac7c6;if(_0x5d09f9[_0xb00c('0x93')][_0xb00c('0x94')]){if(_0x5d09f9['account'][_0xb00c('0x95')]){_0x5d09f9[_0xb00c('0x85')]['push']({'id':0x0,'priority':_0x5d09f9[_0xb00c('0x85')][_0xb00c('0x59')]+0x1,'app':_0xb00c('0x96'),'appdata':_0xb00c('0x97'),'interval':'*,*,*,*'});}}return db[_0xb00c('0x98')][_0xb00c('0x5c')]({'body':_0x38747f[_0xb00c('0x63')][_0xb00c('0x63')],'OpenchannelAccountId':_0x38747f['params']['id'],'OpenchannelInteractionId':_0x5bb14d['id'],'direction':'in','ContactId':_0x5d09f9['contact']['id'],'AttachmentId':_0x38747f[_0xb00c('0x63')][_0xb00c('0x99')]});})[_0xb00c('0x20')](function(_0x1e0bfe){_0x5d09f9['message']=_0x1e0bfe;if(_0x5d09f9[_0xb00c('0x93')][_0xb00c('0x9a')]){return db[_0xb00c('0x9b')]['find']({'attributes':['id',_0xb00c('0x39')],'where':{'id':_0x5d09f9['interaction'][_0xb00c('0x9a')]}})[_0xb00c('0x20')](function(_0x4420d0){if(_0x4420d0){_0x5d09f9['applications'][_0xb00c('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4420d0[_0xb00c('0x39')]+','+(_0x5d09f9['account'][_0xb00c('0x9d')]||0xa),'interval':_0xb00c('0x9e')});_0x5d09f9['forcedOwnership']=![];}return respondWithRpcPromise(_0xb00c('0x9f'),_0xb00c('0xa0'),_0x5d09f9);});}return respondWithRpcPromise('Start',_0xb00c('0xa0'),_0x5d09f9);})['then'](function(_0x5c720f){respondWithRpcPromise('EventManager',_0xb00c('0xa1'),{'event':_0xb00c('0x6f'),'message':_0x5c720f},client9002);return _0x5c720f;})[_0xb00c('0x20')](respondWithResult(_0x2666cb,null))[_0xb00c('0x29')](handleError(_0x2666cb,null));};exports[_0xb00c('0xa2')]=function(_0x448f03,_0x1be509,_0x3b0a3c){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x448f03['params']['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x1be509,null))[_0xb00c('0x20')](function(_0x248af4){if(_0x248af4){return db[_0xb00c('0xa3')]['transaction'](function(_0x33d627){return db['OpenchannelApplication'][_0xb00c('0x35')]({'where':{'OpenchannelAccountId':_0x448f03[_0xb00c('0x57')]['id']},'transaction':_0x33d627})['then'](function(_0x59acc9){var _0x1685d7=_[_0xb00c('0x3e')](_0x448f03['body'],function(_0x594079){_0x594079[_0xb00c('0x69')]=_0x448f03[_0xb00c('0x57')]['id'];return _0x594079;});return db[_0xb00c('0xa4')][_0xb00c('0xa5')](_0x1685d7,{'transaction':_0x33d627});});})[_0xb00c('0x20')](function(){return db[_0xb00c('0xa4')][_0xb00c('0xa6')]({'where':{'OpenchannelAccountId':_0x448f03[_0xb00c('0x57')]['id']},'order':_0xb00c('0x87')});});}})[_0xb00c('0x20')](respondWithResult(_0x1be509,null))[_0xb00c('0x29')](handleError(_0x1be509,null));};exports[_0xb00c('0xa7')]=function(_0x38a7cf,_0xb33ba4,_0x5c4bb0){var _0x427854={};var _0x1170c8={};var _0x151e9d;var _0x267d56;return db[_0xb00c('0x3f')][_0xb00c('0x68')]({'where':{'id':_0x38a7cf[_0xb00c('0x57')]['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0xb33ba4,null))[_0xb00c('0x20')](function(_0x9e2bf2){if(_0x9e2bf2){_0x151e9d=_0x9e2bf2;_0x1170c8[_0xb00c('0x44')]=_[_0xb00c('0x58')](db[_0xb00c('0xa4')]['rawAttributes']);_0x1170c8[_0xb00c('0x45')]=_[_0xb00c('0x58')](_0x38a7cf[_0xb00c('0x45')]);_0x1170c8[_0xb00c('0x46')]=_[_0xb00c('0x47')](_0x1170c8[_0xb00c('0x44')],_0x1170c8[_0xb00c('0x45')]);_0x427854[_0xb00c('0x49')]=_[_0xb00c('0x47')](_0x1170c8[_0xb00c('0x44')],qs[_0xb00c('0x48')](_0x38a7cf['query'][_0xb00c('0x48')]));_0x427854[_0xb00c('0x49')]=_0x427854[_0xb00c('0x49')][_0xb00c('0x59')]?_0x427854[_0xb00c('0x49')]:_0x1170c8['model'];_0x427854[_0xb00c('0x4c')]=qs['sort'](_0x38a7cf[_0xb00c('0x45')][_0xb00c('0x4d')]);_0x427854[_0xb00c('0x50')]=qs['filters'](_['pick'](_0x38a7cf[_0xb00c('0x45')],_0x1170c8[_0xb00c('0x46')]));if(_0x38a7cf[_0xb00c('0x45')]['filter']){_0x427854[_0xb00c('0x50')]=_['merge'](_0x427854[_0xb00c('0x50')],{'$or':_[_0xb00c('0x3e')](_0x427854[_0xb00c('0x49')],function(_0x4f4270){var _0x3f909e={};_0x3f909e[_0x4f4270]={'$like':'%'+_0x38a7cf[_0xb00c('0x45')]['filter']+'%'};return _0x3f909e;})});}_0x427854=_[_0xb00c('0x5b')]({},_0x427854,_0x38a7cf[_0xb00c('0x52')]);return _0x151e9d['getApplications'](_0x427854);}})[_0xb00c('0x20')](function(_0x4fa459){if(_0x4fa459){_0x267d56=_0x4fa459[_0xb00c('0x59')];if(!_0x38a7cf['query'][_0xb00c('0x4a')](_0xb00c('0x4b'))){_0x427854[_0xb00c('0x2f')]=qs[_0xb00c('0x2f')](_0x38a7cf[_0xb00c('0x45')][_0xb00c('0x2f')]);_0x427854[_0xb00c('0x2d')]=qs['offset'](_0x38a7cf[_0xb00c('0x45')][_0xb00c('0x2d')]);}return _0x151e9d['getApplications'](_0x427854);}})['then'](function(_0x5ed0db){if(_0x5ed0db){return _0x5ed0db?{'count':_0x267d56,'rows':_0x5ed0db}:null;}})[_0xb00c('0x20')](respondWithResult(_0xb33ba4,null))[_0xb00c('0x29')](handleError(_0xb33ba4,null));};exports['getInteractions']=function(_0x119f1c,_0x252e03,_0x35008b){var _0x1288d9={'raw':![],'where':{}};var _0x55ce9c={};var _0xa73687={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb00c('0x68')]({'where':{'id':_0x119f1c[_0xb00c('0x57')]['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x252e03,null))[_0xb00c('0x20')](function(_0x165cd4){if(_0x165cd4){_0x55ce9c['model']=_[_0xb00c('0x58')](db[_0xb00c('0x8e')][_0xb00c('0x40')]);_0x55ce9c[_0xb00c('0x45')]=_[_0xb00c('0x58')](_0x119f1c['query']);_0x55ce9c['filters']=_[_0xb00c('0x47')](_0x55ce9c[_0xb00c('0x44')],_0x55ce9c[_0xb00c('0x45')]);_0x1288d9[_0xb00c('0x49')]=_['intersection'](_0x55ce9c[_0xb00c('0x44')],qs[_0xb00c('0x48')](_0x119f1c[_0xb00c('0x45')]['fields']));_0x1288d9['attributes']=_0x1288d9[_0xb00c('0x49')]['length']?_0x1288d9[_0xb00c('0x49')]:_0x55ce9c[_0xb00c('0x44')];if(!_0x119f1c[_0xb00c('0x45')][_0xb00c('0x4a')](_0xb00c('0x4b'))){_0x1288d9[_0xb00c('0x2f')]=qs[_0xb00c('0x2f')](_0x119f1c['query'][_0xb00c('0x2f')]);_0x1288d9[_0xb00c('0x2d')]=qs['offset'](_0x119f1c[_0xb00c('0x45')]['offset']);}_0x1288d9['order']=qs[_0xb00c('0x4d')](_0x119f1c['query'][_0xb00c('0x4d')]);_0x1288d9['where']=qs[_0xb00c('0x46')](_[_0xb00c('0x4e')](_0x119f1c[_0xb00c('0x45')],_0x55ce9c['filters']));_0x1288d9[_0xb00c('0x50')][_0xb00c('0x69')]=_0x165cd4['id'];if(_0x119f1c[_0xb00c('0x45')][_0xb00c('0x4f')]){_0x1288d9['where']=_[_0xb00c('0x5b')](_0x1288d9[_0xb00c('0x50')],{'$or':_[_0xb00c('0x3e')](_0x1288d9[_0xb00c('0x49')],function(_0x5131be){var _0x3c0a42={};_0x3c0a42[_0x5131be]={'$like':'%'+_0x119f1c[_0xb00c('0x45')]['filter']+'%'};return _0x3c0a42;})});}_0x1288d9=_[_0xb00c('0x5b')]({},_0x1288d9,_0x119f1c[_0xb00c('0x52')]);return db[_0xb00c('0x8e')][_0xb00c('0x30')]({'where':_0x1288d9[_0xb00c('0x50')]})[_0xb00c('0x20')](function(_0x9a6187){_0xa73687[_0xb00c('0x30')]=_0x9a6187;if(_0x119f1c[_0xb00c('0x45')][_0xb00c('0x5a')]){_0x1288d9['include']=[{'model':db[_0xb00c('0x71')],'as':_0xb00c('0xa8'),'required':![]},{'model':db[_0xb00c('0x9b')],'as':'Owner','attributes':[_0xb00c('0x39'),'fullname',_0xb00c('0xa9')],'required':![]},{'model':db[_0xb00c('0xaa')],'as':_0xb00c('0xab'),'attributes':['id',_0xb00c('0x39'),_0xb00c('0xac')],'where':_0x119f1c['query'][_0xb00c('0xad')]?{'id':_0x119f1c[_0xb00c('0x45')]['tag']}:undefined,'required':_0x119f1c[_0xb00c('0x45')]['tag']?!![]:![]}];}return db[_0xb00c('0x8e')][_0xb00c('0x54')](_0x1288d9);})[_0xb00c('0x20')](function(_0x5e7cdd){_0xa73687[_0xb00c('0x55')]=_0x5e7cdd;return _0xa73687;});}})[_0xb00c('0x20')](respondWithFilteredResult(_0x252e03,_0x1288d9))[_0xb00c('0x29')](handleError(_0x252e03,null));};exports[_0xb00c('0xae')]=function(_0xcbe802,_0x53c7a1,_0x8f1b7d){return db['OpenchannelAccount'][_0xb00c('0x5f')]({'where':{'id':_0xcbe802['params']['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x53c7a1,null))[_0xb00c('0x20')](function(_0x2d5dbc){if(_0x2d5dbc){return _0x2d5dbc[_0xb00c('0xae')](_0xcbe802[_0xb00c('0x63')][_0xb00c('0x6a')],_[_0xb00c('0xaf')](_0xcbe802[_0xb00c('0x63')],[_0xb00c('0x6a'),'id'])||{})[_0xb00c('0x91')](function(_0xc91152){for(var _0x4cef71=0x0;_0x4cef71<_0xcbe802['body'][_0xb00c('0x6a')]['length'];_0x4cef71+=0x1){socket[_0xb00c('0xb0')](_0xb00c('0xb1'),{'UserId':Number(_0xcbe802['body'][_0xb00c('0x6a')][_0x4cef71]),'OpenchannelAccountId':Number(_0xcbe802[_0xb00c('0x57')]['id'])});}return _0xc91152;});}})[_0xb00c('0x20')](respondWithResult(_0x53c7a1,null))['catch'](handleError(_0x53c7a1,null));};exports[_0xb00c('0xb2')]=function(_0x5474a7,_0x27b519,_0x5a198f){return db[_0xb00c('0x3f')][_0xb00c('0x5f')]({'where':{'id':_0x5474a7[_0xb00c('0x57')]['id']}})['then'](handleEntityNotFound(_0x27b519,null))[_0xb00c('0x20')](function(_0x491e40){if(_0x491e40){return _0x491e40['removeAgents'](_0x5474a7[_0xb00c('0x45')][_0xb00c('0x6a')])[_0xb00c('0x20')](function(){if(_[_0xb00c('0xb3')](_0x5474a7[_0xb00c('0x45')][_0xb00c('0x6a')])){for(var _0x2b893e=0x0;_0x2b893e<_0x5474a7[_0xb00c('0x45')]['ids'][_0xb00c('0x59')];_0x2b893e+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5474a7[_0xb00c('0x45')][_0xb00c('0x6a')][_0x2b893e]),'OpenchannelAccountId':Number(_0x5474a7[_0xb00c('0x57')]['id'])});}}else{socket[_0xb00c('0xb0')](_0xb00c('0xb4'),{'UserId':Number(_0x5474a7[_0xb00c('0x45')][_0xb00c('0x6a')]),'OpenchannelAccountId':Number(_0x5474a7[_0xb00c('0x57')]['id'])});}});}})[_0xb00c('0x20')](respondWithStatusCode(_0x27b519,null))[_0xb00c('0x29')](handleError(_0x27b519,null));};exports['getAgents']=function(_0x4383d2,_0x1a66f4,_0x4292d7){var _0x6e0a0c={};var _0x23b016={};var _0x484f05;var _0x110a0d;return db[_0xb00c('0x3f')][_0xb00c('0x68')]({'where':{'id':_0x4383d2[_0xb00c('0x57')]['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x1a66f4,null))[_0xb00c('0x20')](function(_0x41ff02){if(_0x41ff02){_0x484f05=_0x41ff02;_0x23b016[_0xb00c('0x44')]=_[_0xb00c('0x58')](db[_0xb00c('0x9b')][_0xb00c('0x40')]);_0x23b016[_0xb00c('0x45')]=_[_0xb00c('0x58')](_0x4383d2['query']);_0x23b016[_0xb00c('0x46')]=_[_0xb00c('0x47')](_0x23b016['model'],_0x23b016[_0xb00c('0x45')]);_0x6e0a0c[_0xb00c('0x49')]=_['intersection'](_0x23b016[_0xb00c('0x44')],qs[_0xb00c('0x48')](_0x4383d2[_0xb00c('0x45')][_0xb00c('0x48')]));_0x6e0a0c['attributes']=_0x6e0a0c[_0xb00c('0x49')][_0xb00c('0x59')]?_0x6e0a0c[_0xb00c('0x49')]:_0x23b016['model'];_0x6e0a0c['order']=qs[_0xb00c('0x4d')](_0x4383d2[_0xb00c('0x45')][_0xb00c('0x4d')]);_0x6e0a0c[_0xb00c('0x50')]=qs['filters'](_[_0xb00c('0x4e')](_0x4383d2[_0xb00c('0x45')],_0x23b016[_0xb00c('0x46')]));if(_0x4383d2[_0xb00c('0x45')][_0xb00c('0x4f')]){_0x6e0a0c[_0xb00c('0x50')]=_[_0xb00c('0x5b')](_0x6e0a0c[_0xb00c('0x50')],{'$or':_[_0xb00c('0x3e')](_0x6e0a0c[_0xb00c('0x49')],function(_0x51d38b){var _0x3b3255={};_0x3b3255[_0x51d38b]={'$like':'%'+_0x4383d2[_0xb00c('0x45')][_0xb00c('0x4f')]+'%'};return _0x3b3255;})});}_0x6e0a0c=_[_0xb00c('0x5b')]({},_0x6e0a0c,_0x4383d2[_0xb00c('0x52')]);return _0x484f05[_0xb00c('0xb5')](_0x6e0a0c);}})[_0xb00c('0x20')](function(_0x56ce08){if(_0x56ce08){_0x110a0d=_0x56ce08[_0xb00c('0x59')];if(!_0x4383d2[_0xb00c('0x45')][_0xb00c('0x4a')]('nolimit')){_0x6e0a0c['limit']=qs['limit'](_0x4383d2[_0xb00c('0x45')][_0xb00c('0x2f')]);_0x6e0a0c[_0xb00c('0x2d')]=qs[_0xb00c('0x2d')](_0x4383d2[_0xb00c('0x45')]['offset']);}return _0x484f05[_0xb00c('0xb5')](_0x6e0a0c);}})[_0xb00c('0x20')](function(_0x1398f9){if(_0x1398f9){return _0x1398f9?{'count':_0x110a0d,'rows':_0x1398f9}:null;}})[_0xb00c('0x20')](respondWithResult(_0x1a66f4,null))[_0xb00c('0x29')](handleError(_0x1a66f4,null));};exports[_0xb00c('0x3a')]=function(_0x312132,_0x2766c0,_0x2bd395){var _0x3e7483,_0x5b870e,_0x3537ff;if(_[_0xb00c('0x78')](_0x312132[_0xb00c('0x63')]['body'])||_0x312132[_0xb00c('0x63')][_0xb00c('0x63')]===''){throw new db[(_0xb00c('0x79'))][(_0xb00c('0x72'))](_0xb00c('0xb6'));}if(_['isNil'](_0x312132[_0xb00c('0x63')]['to'])){}_0x3e7483=_0x312132['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x312132[_0xb00c('0x57')]['id']}})[_0xb00c('0x20')](handleEntityNotFound(_0x2766c0,null))['then'](function(_0x157202){if(_0x157202){return db[_0xb00c('0x3f')][_0xb00c('0x5f')]({'where':{'id':_0x157202['id']},'include':[{'model':db[_0xb00c('0x7e')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb00c('0x80'),'where':{[_0x157202[_0xb00c('0x7a')]]:_0x3e7483},'limit':0x1,'order':[[_0xb00c('0x75'),_0xb00c('0x81')]]}]}]})[_0xb00c('0x20')](handleEntityNotFound(_0x2766c0,null))[_0xb00c('0x20')](function(_0x549141){if(_0x549141&&_0x549141['List']){_0x5b870e=_0x549141['get']({'plain':!![]});if(_0x5b870e[_0xb00c('0x7f')]&&_0x5b870e[_0xb00c('0x7f')][_0xb00c('0x80')][_0xb00c('0x59')]){return _0x5b870e['List'][_0xb00c('0x80')][0x0];}return db[_0xb00c('0x71')][_0xb00c('0x5c')](_[_0xb00c('0x18')](_0x312132[_0xb00c('0x63')],{'firstName':_0x3e7483,[_0x549141[_0xb00c('0x7a')]]:_0x3e7483,'phone':_0x3e7483,'ListId':_0x5b870e[_0xb00c('0x77')]}));}})['then'](handleEntityNotFound(_0x2766c0,null))[_0xb00c('0x20')](function(_0x1bbec4){if(_0x1bbec4){_0x3537ff=_0x1bbec4;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x3537ff['id'],'closed':![],'OpenchannelAccountId':_0x5b870e['id']}})[_0xb00c('0x20')](function(_0xa8ff83){if(_0xa8ff83){return[_0xa8ff83,![]];}return db[_0xb00c('0x8e')][_0xb00c('0x5c')]({'UserId':_0x312132['user']['id'],'ContactId':_0x3537ff['id'],'OpenchannelAccountId':_0x5b870e['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x312132[_0xb00c('0x63')],{'read':![],'body':_0x312132[_0xb00c('0x63')][_0xb00c('0x63')],'OpenchannelAccountId':_0x5b870e['id'],'UserId':_0x312132[_0xb00c('0xb7')]['id'],'ContactId':_0x3537ff['id']})]},{'include':[{'model':db[_0xb00c('0x98')],'as':_0xb00c('0xb8')}]})[_0xb00c('0x20')](function(_0x56fb79){return[_0x56fb79,!![]];});});}})[_0xb00c('0x91')](function(_0x382727,_0x2889be){if(_0x2889be){return _0x382727;}return db['OpenchannelMessage']['create'](_[_0xb00c('0x5b')](_0x312132[_0xb00c('0x63')],{'read':![],'body':_0x312132['body'][_0xb00c('0x63')],'OpenchannelAccountId':_0x5b870e['id'],'OpenchannelInteractionId':_0x382727['id'],'UserId':_0x312132[_0xb00c('0xb7')]['id'],'ContactId':_0x3537ff['id']}))['then'](function(_0x12b26c){_0x382727[_0xb00c('0xb9')]['Messages']=[];_0x382727['dataValues'][_0xb00c('0xb8')][_0xb00c('0xba')](_0x12b26c[_0xb00c('0xb9')]);return _0x382727;});});}})[_0xb00c('0x20')](respondWithResult(_0x2766c0,null))['catch'](handleError(_0x2766c0,null));}; \ No newline at end of file +var _0xa4de=['message','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','destroy','get','OpenchannelAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','OpenchannelAccount','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','sort','CannedAnswer','getAnswers','hasOwnProperty','pick','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','list','applications','orderBy','priority','asc','account','Applications','Contacts','defaults','contact','firstName','lastName','threadId','externalUrl','ContactId','spread','messageId','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','sequelize','transaction','OpenchannelApplication','getApplications','getInteractions','OpenchannelInteraction','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','userOpenchannelAccount:remove','getAgents','CmList','Messages','dataValues','push','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x27b248,_0x329dc1){var _0x2f1a15=function(_0x5fe9bd){while(--_0x5fe9bd){_0x27b248['push'](_0x27b248['shift']());}};_0x2f1a15(++_0x329dc1);}(_0xa4de,0x143));var _0xea4d=function(_0x5eaf10,_0x43a574){_0x5eaf10=_0x5eaf10-0x0;var _0x268036=_0xa4de[_0x5eaf10];return _0x268036;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea4d('0x0'));var zipdir=require(_0xea4d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea4d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea4d('0x3'));var path=require(_0xea4d('0x4'));var sox=require(_0xea4d('0x5'));var csv=require(_0xea4d('0x6'));var ejs=require(_0xea4d('0x7'));var fs=require('fs');var fs_extra=require(_0xea4d('0x8'));var _=require(_0xea4d('0x9'));var squel=require(_0xea4d('0xa'));var crypto=require('crypto');var jsforce=require(_0xea4d('0xb'));var deskjs=require(_0xea4d('0xc'));var toCsv=require(_0xea4d('0x6'));var querystring=require('querystring');var Papa=require(_0xea4d('0xd'));var Redis=require(_0xea4d('0xe'));var authService=require(_0xea4d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xea4d('0x10'));var hardwareService=require(_0xea4d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xea4d('0x12'));var config=require(_0xea4d('0x13'));var licenseUtil=require(_0xea4d('0x14'));var db=require(_0xea4d('0x15'))['db'];config[_0xea4d('0x16')]=_['defaults'](config['redis'],{'host':_0xea4d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea4d('0x16')]));require(_0xea4d('0x18'))[_0xea4d('0x19')](socket);var jayson=require(_0xea4d('0x1a'));var client=jayson['client'][_0xea4d('0x1b')]({'port':0x232c});var client9002=jayson[_0xea4d('0x1c')][_0xea4d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3e5bf5,_0x16a6a2,_0x1f2a3e,_0x274b8e){return new BPromise(function(_0x1756f9,_0xf06ce1){var _0x415070=_0x274b8e||client;return _0x415070[_0xea4d('0x1d')](_0x3e5bf5,_0x1f2a3e)[_0xea4d('0x1e')](function(_0x4c01f7){logger[_0xea4d('0x1f')](_0xea4d('0x20'),_0x16a6a2,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x16a6a2,_0xea4d('0x21'),JSON[_0xea4d('0x22')](_0x4c01f7));if(_0x4c01f7[_0xea4d('0x23')]){if(_0x4c01f7[_0xea4d('0x23')][_0xea4d('0x24')]===0x1f4){logger[_0xea4d('0x23')](_0xea4d('0x20'),_0x16a6a2,_0x4c01f7[_0xea4d('0x23')]['message']);return _0xf06ce1(_0x4c01f7['error'][_0xea4d('0x25')]);}logger[_0xea4d('0x23')](_0xea4d('0x20'),_0x16a6a2,_0x4c01f7[_0xea4d('0x23')][_0xea4d('0x25')]);return _0x1756f9(_0x4c01f7[_0xea4d('0x23')][_0xea4d('0x25')]);}else{logger[_0xea4d('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x16a6a2,_0xea4d('0x21'));_0x1756f9(_0x4c01f7[_0xea4d('0x26')][_0xea4d('0x25')]);}})[_0xea4d('0x27')](function(_0x35213c){logger[_0xea4d('0x23')](_0xea4d('0x20'),_0x16a6a2,_0x35213c);_0xf06ce1(_0x35213c);});});}function respondWithStatusCode(_0x555790,_0x2c3397){_0x2c3397=_0x2c3397||0xcc;return function(_0x211833){if(_0x211833){return _0x555790['sendStatus'](_0x2c3397);}return _0x555790['status'](_0x2c3397)[_0xea4d('0x28')]();};}function respondWithResult(_0x2df90b,_0x8d7391){_0x8d7391=_0x8d7391||0xc8;return function(_0x201399){if(_0x201399){return _0x2df90b['status'](_0x8d7391)[_0xea4d('0x29')](_0x201399);}};}function respondWithFilteredResult(_0x32915e,_0xb86793){return function(_0x547f4f){if(_0x547f4f){var _0x3effba=typeof _0xb86793[_0xea4d('0x2a')]===_0xea4d('0x2b')&&typeof _0xb86793[_0xea4d('0x2c')]===_0xea4d('0x2b');var _0x2c92d8=_0x547f4f[_0xea4d('0x2d')];var _0x5f5475=_0x3effba?0x0:_0xb86793[_0xea4d('0x2a')];var _0x39a99f=_0x3effba?_0x547f4f[_0xea4d('0x2d')]:_0xb86793[_0xea4d('0x2a')]+_0xb86793[_0xea4d('0x2c')];var _0x59282a;if(_0x39a99f>=_0x2c92d8){_0x39a99f=_0x2c92d8;_0x59282a=0xc8;}else{_0x59282a=0xce;}_0x32915e[_0xea4d('0x2e')](_0x59282a);return _0x32915e[_0xea4d('0x2f')](_0xea4d('0x30'),_0x5f5475+'-'+_0x39a99f+'/'+_0x2c92d8)['json'](_0x547f4f);}return null;};}function patchUpdates(_0x69e4c1){return function(_0x34f398){try{jsonpatch['apply'](_0x34f398,_0x69e4c1,!![]);}catch(_0x54752a){return BPromise[_0xea4d('0x31')](_0x54752a);}return _0x34f398[_0xea4d('0x32')]();};}function saveUpdates(_0x43940e,_0x4443f8){return function(_0xbf4fa5){if(_0xbf4fa5){return _0xbf4fa5['update'](_0x43940e)[_0xea4d('0x1e')](function(_0x316959){return _0x316959;});}return null;};}function removeEntity(_0x369586,_0x1e49bb){return function(_0x23d5fb){if(_0x23d5fb){return _0x23d5fb[_0xea4d('0x33')]()['then'](function(){var _0x52734d=_0x23d5fb[_0xea4d('0x34')]({'plain':!![]});var _0x4a0332=_0xea4d('0x35');return db['UserProfileResource'][_0xea4d('0x33')]({'where':{'type':_0x4a0332,'resourceId':_0x52734d['id']}})[_0xea4d('0x1e')](function(){return _0x23d5fb;});})[_0xea4d('0x1e')](function(){_0x369586[_0xea4d('0x2e')](0xcc)[_0xea4d('0x28')]();});}};}function handleEntityNotFound(_0x65dbfe,_0x5e8662){return function(_0x3ddc96){if(!_0x3ddc96){_0x65dbfe['sendStatus'](0x194);}return _0x3ddc96;};}function handleError(_0x5417e3,_0x485011){_0x485011=_0x485011||0x1f4;return function(_0x5af34b){logger[_0xea4d('0x23')](_0x5af34b[_0xea4d('0x36')]);if(_0x5af34b['name']){delete _0x5af34b[_0xea4d('0x37')];}_0x5417e3[_0xea4d('0x2e')](_0x485011)[_0xea4d('0x38')](_0x5af34b);};}exports[_0xea4d('0x39')]=function(_0x2d255d,_0x79dded){var _0x25553f={'include':[{'model':db[_0xea4d('0x3a')],'as':_0xea4d('0x3b')}]},_0x16126c={},_0x40faf7={'count':0x0,'rows':[]};var _0xde5e29=_[_0xea4d('0x3c')](db['OpenchannelAccount']['rawAttributes'],function(_0x408fb1){return{'name':_0x408fb1[_0xea4d('0x3d')],'type':_0x408fb1[_0xea4d('0x3e')][_0xea4d('0x3f')]};});_0x16126c[_0xea4d('0x40')]=_['map'](_0xde5e29,'name');_0x16126c['query']=_[_0xea4d('0x41')](_0x2d255d[_0xea4d('0x42')]);_0x16126c[_0xea4d('0x43')]=_[_0xea4d('0x44')](_0x16126c[_0xea4d('0x40')],_0x16126c[_0xea4d('0x42')]);_0x25553f['attributes']=_[_0xea4d('0x44')](_0x16126c[_0xea4d('0x40')],qs[_0xea4d('0x45')](_0x2d255d[_0xea4d('0x42')][_0xea4d('0x45')]));_0x25553f[_0xea4d('0x46')]=_0x25553f[_0xea4d('0x46')][_0xea4d('0x47')]?_0x25553f[_0xea4d('0x46')]:_0x16126c[_0xea4d('0x40')];if(!_0x2d255d[_0xea4d('0x42')]['hasOwnProperty'](_0xea4d('0x48'))){_0x25553f[_0xea4d('0x2c')]=qs[_0xea4d('0x2c')](_0x2d255d[_0xea4d('0x42')][_0xea4d('0x2c')]);_0x25553f[_0xea4d('0x2a')]=qs[_0xea4d('0x2a')](_0x2d255d['query'][_0xea4d('0x2a')]);}_0x25553f[_0xea4d('0x49')]=qs['sort'](_0x2d255d['query']['sort']);_0x25553f[_0xea4d('0x4a')]=qs[_0xea4d('0x43')](_['pick'](_0x2d255d['query'],_0x16126c[_0xea4d('0x43')]),_0xde5e29);if(_0x2d255d[_0xea4d('0x42')][_0xea4d('0x4b')]){_0x25553f['where']=_[_0xea4d('0x4c')](_0x25553f[_0xea4d('0x4a')],{'$or':_[_0xea4d('0x3c')](_0xde5e29,function(_0x17cff8){if(_0x17cff8['type']!==_0xea4d('0x4d')){var _0x37c989={};_0x37c989[_0x17cff8['name']]={'$like':'%'+_0x2d255d[_0xea4d('0x42')][_0xea4d('0x4b')]+'%'};return _0x37c989;}})});}_0x25553f=_[_0xea4d('0x4c')]({},_0x25553f,_0x2d255d[_0xea4d('0x4e')]);var _0x472eaf={'where':_0x25553f[_0xea4d('0x4a')]};return db['OpenchannelAccount']['count'](_0x472eaf)['then'](function(_0x5c5cb3){_0x40faf7[_0xea4d('0x2d')]=_0x5c5cb3;if(_0x2d255d['query'][_0xea4d('0x4f')]){_0x25553f[_0xea4d('0x50')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xea4d('0x51')](_0x25553f);})['then'](function(_0x3be600){_0x40faf7[_0xea4d('0x52')]=_0x3be600;return _0x40faf7;})[_0xea4d('0x1e')](respondWithFilteredResult(_0x79dded,_0x25553f))[_0xea4d('0x27')](handleError(_0x79dded,null));};exports[_0xea4d('0x53')]=function(_0x43391e,_0x2b9e32){var _0x280cee={'raw':![],'where':{'id':_0x43391e['params']['id']},'include':[{'model':db['Pause'],'as':_0xea4d('0x3b')}]},_0x14672e={};_0x14672e['model']=_[_0xea4d('0x41')](db['OpenchannelAccount'][_0xea4d('0x54')]);_0x14672e[_0xea4d('0x42')]=_['keys'](_0x43391e[_0xea4d('0x42')]);_0x14672e[_0xea4d('0x43')]=_[_0xea4d('0x44')](_0x14672e[_0xea4d('0x40')],_0x14672e[_0xea4d('0x42')]);_0x280cee['attributes']=_[_0xea4d('0x44')](_0x14672e[_0xea4d('0x40')],qs[_0xea4d('0x45')](_0x43391e['query'][_0xea4d('0x45')]));_0x280cee[_0xea4d('0x46')]=_0x280cee[_0xea4d('0x46')][_0xea4d('0x47')]?_0x280cee[_0xea4d('0x46')]:_0x14672e[_0xea4d('0x40')];if(_0x43391e[_0xea4d('0x42')][_0xea4d('0x4f')]){_0x280cee[_0xea4d('0x50')]=[{'all':!![]}];}_0x280cee=_[_0xea4d('0x4c')]({},_0x280cee,_0x43391e[_0xea4d('0x4e')]);return db[_0xea4d('0x55')][_0xea4d('0x56')](_0x280cee)['then'](handleEntityNotFound(_0x2b9e32,null))[_0xea4d('0x1e')](respondWithResult(_0x2b9e32,null))['catch'](handleError(_0x2b9e32,null));};exports[_0xea4d('0x57')]=function(_0x5b1261,_0x1a78bd){return db[_0xea4d('0x55')][_0xea4d('0x57')](_0x5b1261['body'],{})[_0xea4d('0x1e')](function(_0xb6a1a3){var _0x3f8e3b=_0x5b1261[_0xea4d('0x58')]['get']({'plain':!![]});if(!_0x3f8e3b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f8e3b[_0xea4d('0x59')]===_0xea4d('0x58')){var _0x4f5446=_0xb6a1a3['get']({'plain':!![]});var _0x11ef37=_0xea4d('0x35');return db['UserProfileSection'][_0xea4d('0x56')]({'where':{'name':_0x11ef37,'userProfileId':_0x3f8e3b[_0xea4d('0x5a')]},'raw':!![]})[_0xea4d('0x1e')](function(_0x12b7b7){if(_0x12b7b7&&_0x12b7b7[_0xea4d('0x5b')]===0x0){return db['UserProfileResource'][_0xea4d('0x57')]({'name':_0x4f5446['name'],'resourceId':_0x4f5446['id'],'type':_0x12b7b7[_0xea4d('0x37')],'sectionId':_0x12b7b7['id']},{})[_0xea4d('0x1e')](function(){return _0xb6a1a3;});}else{return _0xb6a1a3;}})['catch'](function(_0x50cc4f){logger[_0xea4d('0x23')](_0xea4d('0x5c'),_0x50cc4f);throw _0x50cc4f;});}return _0xb6a1a3;})[_0xea4d('0x1e')](respondWithResult(_0x1a78bd,0xc9))['catch'](handleError(_0x1a78bd,null));};exports[_0xea4d('0x5d')]=function(_0x94218b,_0x25ef3e){if(_0x94218b[_0xea4d('0x5e')]['id']){delete _0x94218b['body']['id'];}return db[_0xea4d('0x55')][_0xea4d('0x56')]({'where':{'id':_0x94218b[_0xea4d('0x5f')]['id']},'include':[{'model':db[_0xea4d('0x3a')],'as':'mandatoryDispositionPause'}]})[_0xea4d('0x1e')](handleEntityNotFound(_0x25ef3e,null))[_0xea4d('0x1e')](saveUpdates(_0x94218b[_0xea4d('0x5e')],null))['then'](respondWithResult(_0x25ef3e,null))[_0xea4d('0x27')](handleError(_0x25ef3e,null));};exports['destroy']=function(_0x4885fe,_0x3ad4e4){return db[_0xea4d('0x55')][_0xea4d('0x56')]({'where':{'id':_0x4885fe[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x3ad4e4,null))[_0xea4d('0x1e')](removeEntity(_0x3ad4e4,null))[_0xea4d('0x27')](handleError(_0x3ad4e4,null));};exports['describe']=function(_0x3dc0cd,_0x391559){return db[_0xea4d('0x55')][_0xea4d('0x60')]()[_0xea4d('0x1e')](respondWithResult(_0x391559,null))[_0xea4d('0x27')](handleError(_0x391559,null));};exports[_0xea4d('0x61')]=function(_0x2a1a42,_0x5af12b,_0x41aa98){if(_0x2a1a42[_0xea4d('0x5e')]['id']){delete _0x2a1a42['body']['id'];}return db[_0xea4d('0x55')]['find']({'where':{'id':_0x2a1a42[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x5af12b,null))['then'](function(_0x5a863f){if(_0x5a863f){_0x2a1a42[_0xea4d('0x5e')][_0xea4d('0x62')]=_0x5a863f['id'];return db[_0xea4d('0x63')]['create'](_0x2a1a42[_0xea4d('0x5e')]);}})[_0xea4d('0x1e')](respondWithResult(_0x5af12b,null))[_0xea4d('0x27')](handleError(_0x5af12b,null));};exports[_0xea4d('0x64')]=function(_0x243482,_0x109a70,_0x413a87){var _0x1348c5={'raw':![],'where':{}};var _0x1bdd18={};var _0x2a2eaa={'count':0x0,'rows':[]};return db[_0xea4d('0x55')][_0xea4d('0x65')]({'where':{'id':_0x243482[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x109a70,null))[_0xea4d('0x1e')](function(_0x5a4843){if(_0x5a4843){_0x1bdd18[_0xea4d('0x40')]=_[_0xea4d('0x41')](db[_0xea4d('0x63')][_0xea4d('0x54')]);_0x1bdd18[_0xea4d('0x42')]=_[_0xea4d('0x41')](_0x243482['query']);_0x1bdd18['filters']=_[_0xea4d('0x44')](_0x1bdd18[_0xea4d('0x40')],_0x1bdd18[_0xea4d('0x42')]);_0x1348c5['attributes']=_['intersection'](_0x1bdd18[_0xea4d('0x40')],qs[_0xea4d('0x45')](_0x243482['query'][_0xea4d('0x45')]));_0x1348c5[_0xea4d('0x46')]=_0x1348c5[_0xea4d('0x46')][_0xea4d('0x47')]?_0x1348c5[_0xea4d('0x46')]:_0x1bdd18[_0xea4d('0x40')];if(!_0x243482[_0xea4d('0x42')]['hasOwnProperty'](_0xea4d('0x48'))){_0x1348c5[_0xea4d('0x2c')]=qs[_0xea4d('0x2c')](_0x243482[_0xea4d('0x42')][_0xea4d('0x2c')]);_0x1348c5[_0xea4d('0x2a')]=qs['offset'](_0x243482[_0xea4d('0x42')][_0xea4d('0x2a')]);}_0x1348c5['order']=qs['sort'](_0x243482[_0xea4d('0x42')][_0xea4d('0x66')]);_0x1348c5[_0xea4d('0x4a')]=qs[_0xea4d('0x43')](_['pick'](_0x243482[_0xea4d('0x42')],_0x1bdd18[_0xea4d('0x43')]));_0x1348c5[_0xea4d('0x4a')][_0xea4d('0x62')]=_0x5a4843['id'];if(_0x243482['query'][_0xea4d('0x4b')]){_0x1348c5[_0xea4d('0x4a')]=_[_0xea4d('0x4c')](_0x1348c5[_0xea4d('0x4a')],{'$or':_[_0xea4d('0x3c')](_0x1348c5[_0xea4d('0x46')],function(_0x4c8e16){var _0x5208a1={};_0x5208a1[_0x4c8e16]={'$like':'%'+_0x243482[_0xea4d('0x42')][_0xea4d('0x4b')]+'%'};return _0x5208a1;})});}_0x1348c5=_[_0xea4d('0x4c')]({},_0x1348c5,_0x243482['options']);return db[_0xea4d('0x63')][_0xea4d('0x2d')]({'where':_0x1348c5[_0xea4d('0x4a')]})['then'](function(_0x2ea639){_0x2a2eaa[_0xea4d('0x2d')]=_0x2ea639;if(_0x243482['query'][_0xea4d('0x4f')]){_0x1348c5[_0xea4d('0x50')]=[{'all':!![]}];}return db[_0xea4d('0x63')][_0xea4d('0x51')](_0x1348c5);})[_0xea4d('0x1e')](function(_0x5e790a){_0x2a2eaa[_0xea4d('0x52')]=_0x5e790a;return _0x2a2eaa;});}})[_0xea4d('0x1e')](respondWithFilteredResult(_0x109a70,_0x1348c5))[_0xea4d('0x27')](handleError(_0x109a70,null));};exports['removeDispositions']=function(_0x281461,_0xcd2a98,_0x3bfaa2){return db[_0xea4d('0x55')][_0xea4d('0x56')]({'where':{'id':_0x281461['params']['id']}})['then'](handleEntityNotFound(_0xcd2a98,null))['then'](function(_0x37bf30){if(_0x37bf30){return _0x37bf30['removeDispositions'](_0x281461[_0xea4d('0x42')]['ids']);}})[_0xea4d('0x1e')](respondWithStatusCode(_0xcd2a98,null))['catch'](handleError(_0xcd2a98,null));};exports['addAnswer']=function(_0x1fe147,_0x188fa7,_0x234199){if(_0x1fe147['body']['id']){delete _0x1fe147[_0xea4d('0x5e')]['id'];}return db[_0xea4d('0x55')][_0xea4d('0x56')]({'where':{'id':_0x1fe147[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x188fa7,null))[_0xea4d('0x1e')](function(_0x23c202){if(_0x23c202){_0x1fe147[_0xea4d('0x5e')][_0xea4d('0x62')]=_0x23c202['id'];return db[_0xea4d('0x67')][_0xea4d('0x57')](_0x1fe147[_0xea4d('0x5e')]);}})['then'](respondWithResult(_0x188fa7,null))['catch'](handleError(_0x188fa7,null));};exports[_0xea4d('0x68')]=function(_0x3db3bc,_0x3c1363,_0x351791){var _0xeed37={'raw':![],'where':{}};var _0x275f1b={};var _0x1f6f00={'count':0x0,'rows':[]};return db[_0xea4d('0x55')]['findOne']({'where':{'id':_0x3db3bc[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x3c1363,null))['then'](function(_0x4c157e){if(_0x4c157e){_0x275f1b[_0xea4d('0x40')]=_[_0xea4d('0x41')](db[_0xea4d('0x67')]['rawAttributes']);_0x275f1b[_0xea4d('0x42')]=_['keys'](_0x3db3bc[_0xea4d('0x42')]);_0x275f1b[_0xea4d('0x43')]=_[_0xea4d('0x44')](_0x275f1b['model'],_0x275f1b['query']);_0xeed37[_0xea4d('0x46')]=_['intersection'](_0x275f1b['model'],qs['fields'](_0x3db3bc['query'][_0xea4d('0x45')]));_0xeed37[_0xea4d('0x46')]=_0xeed37[_0xea4d('0x46')][_0xea4d('0x47')]?_0xeed37['attributes']:_0x275f1b[_0xea4d('0x40')];if(!_0x3db3bc[_0xea4d('0x42')][_0xea4d('0x69')](_0xea4d('0x48'))){_0xeed37[_0xea4d('0x2c')]=qs[_0xea4d('0x2c')](_0x3db3bc[_0xea4d('0x42')][_0xea4d('0x2c')]);_0xeed37['offset']=qs[_0xea4d('0x2a')](_0x3db3bc['query']['offset']);}_0xeed37[_0xea4d('0x49')]=qs[_0xea4d('0x66')](_0x3db3bc[_0xea4d('0x42')][_0xea4d('0x66')]);_0xeed37[_0xea4d('0x4a')]=qs['filters'](_[_0xea4d('0x6a')](_0x3db3bc[_0xea4d('0x42')],_0x275f1b[_0xea4d('0x43')]));_0xeed37[_0xea4d('0x4a')]['OpenchannelAccountId']=_0x4c157e['id'];if(_0x3db3bc[_0xea4d('0x42')][_0xea4d('0x4b')]){_0xeed37[_0xea4d('0x4a')]=_['merge'](_0xeed37[_0xea4d('0x4a')],{'$or':_['map'](_0xeed37['attributes'],function(_0x3185c4){var _0x2ac385={};_0x2ac385[_0x3185c4]={'$like':'%'+_0x3db3bc[_0xea4d('0x42')][_0xea4d('0x4b')]+'%'};return _0x2ac385;})});}_0xeed37=_[_0xea4d('0x4c')]({},_0xeed37,_0x3db3bc[_0xea4d('0x4e')]);return db[_0xea4d('0x67')][_0xea4d('0x2d')]({'where':_0xeed37[_0xea4d('0x4a')]})[_0xea4d('0x1e')](function(_0x38863a){_0x1f6f00[_0xea4d('0x2d')]=_0x38863a;if(_0x3db3bc[_0xea4d('0x42')][_0xea4d('0x4f')]){_0xeed37['include']=[{'all':!![]}];}return db[_0xea4d('0x67')][_0xea4d('0x51')](_0xeed37);})[_0xea4d('0x1e')](function(_0x3f4bf5){_0x1f6f00[_0xea4d('0x52')]=_0x3f4bf5;return _0x1f6f00;});}})[_0xea4d('0x1e')](respondWithFilteredResult(_0x3c1363,_0xeed37))[_0xea4d('0x27')](handleError(_0x3c1363,null));};exports[_0xea4d('0x6b')]=function(_0x2ddd3a,_0x5aaeea,_0x3de26e){return db['OpenchannelAccount'][_0xea4d('0x56')]({'where':{'id':_0x2ddd3a[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x5aaeea,null))['then'](function(_0x75bcba){if(_0x75bcba){return _0x75bcba['removeAnswers'](_0x2ddd3a['query']['ids']);}})[_0xea4d('0x1e')](respondWithStatusCode(_0x5aaeea,null))[_0xea4d('0x27')](handleError(_0x5aaeea,null));};exports[_0xea4d('0x6c')]=function(_0xf532f,_0xe6f4a,_0x2af385){var _0x1796ac={'body':_0xf532f['body'],'channel':'openchannel'};var _0x5820b7=[];var _0x381019=[];var _0x251747={};var _0x2418d5=![];return db[_0xea4d('0x6d')]['describe']()[_0xea4d('0x1e')](function(_0x2fe7a9){if(!_0x2fe7a9){throw new db[(_0xea4d('0x6e'))]['ValidationError'](_0xea4d('0x6f'));}_0x5820b7=_['difference'](_[_0xea4d('0x41')](_0x2fe7a9),[_0xea4d('0x70'),_0xea4d('0x71')]);_0x381019=_['difference'](_[_0xea4d('0x41')](_0x2fe7a9),[_0xea4d('0x70'),'updatedAt',_0xea4d('0x72'),_0xea4d('0x73')]);if(_0xf532f[_0xea4d('0x5e')]['id']){delete _0xf532f[_0xea4d('0x5e')]['id'];}if(_['isNil'](_0xf532f[_0xea4d('0x5e')][_0xea4d('0x74')])){throw new db[(_0xea4d('0x6e'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xea4d('0x75')](_0xf532f[_0xea4d('0x5e')][_0xea4d('0x5e')])||_0xf532f[_0xea4d('0x5e')][_0xea4d('0x5e')]===''){throw new db['Sequelize'][(_0xea4d('0x76'))](_0xea4d('0x77'));}if(_[_0xea4d('0x75')](_0xf532f[_0xea4d('0x5e')][_0xea4d('0x78')])){throw new db[(_0xea4d('0x6e'))][(_0xea4d('0x76'))](_0xea4d('0x79')+_0x381019);}if(!_[_0xea4d('0x7a')](_0x381019,_0xf532f[_0xea4d('0x5e')]['mapKey'])){throw new db[(_0xea4d('0x6e'))][(_0xea4d('0x76'))](_0xea4d('0x7b')+_0x381019);}_0x251747[_0xf532f[_0xea4d('0x5e')][_0xea4d('0x78')]]=_0xf532f[_0xea4d('0x5e')][_0xea4d('0x74')];})['then'](function(){return db[_0xea4d('0x55')][_0xea4d('0x56')]({'where':{'id':_0xf532f[_0xea4d('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0xea4d('0x7c'),'include':[{'model':db[_0xea4d('0x6d')],'as':'Contacts','where':_0x251747,'limit':0x1,'order':[['updatedAt',_0xea4d('0x7d')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xea4d('0x1e')](handleEntityNotFound(_0xe6f4a,null))[_0xea4d('0x1e')](function(_0x382f75){if(_0x382f75&&_0x382f75['List']){_0x1796ac['account']=_0x382f75;_0x1796ac['applications']=_0x382f75['Applications'];_0x1796ac[_0xea4d('0x7e')]=_0x382f75[_0xea4d('0x7c')];_0x1796ac[_0xea4d('0x7f')]=_[_0xea4d('0x80')](_0x1796ac['applications'],[_0xea4d('0x81')],[_0xea4d('0x82')]);if(_0x1796ac[_0xea4d('0x83')]['Applications']){delete _0x1796ac[_0xea4d('0x83')][_0xea4d('0x84')];}if(_0x1796ac[_0xea4d('0x83')][_0xea4d('0x7c')]&&_0x1796ac[_0xea4d('0x83')][_0xea4d('0x7c')]['Contacts'][_0xea4d('0x47')]){return _0x1796ac[_0xea4d('0x83')]['List'][_0xea4d('0x85')][0x0];}var _0x14dba3=_[_0xea4d('0x86')](_0xf532f[_0xea4d('0x5e')],{'firstName':_0xf532f['body'][_0xea4d('0x74')],'ListId':_0x382f75[_0xea4d('0x73')]});_0x14dba3[_0xf532f[_0xea4d('0x5e')][_0xea4d('0x78')]]=_0xf532f[_0xea4d('0x5e')]['from'];return db['CmContact'][_0xea4d('0x57')](_0x14dba3,{'fields':_0x5820b7,'raw':!![]});}})[_0xea4d('0x1e')](handleEntityNotFound(_0xe6f4a,null))['then'](function(_0x2a3725){_0x1796ac[_0xea4d('0x87')]=_0x2a3725;if(_0x2a3725){var _0x31383c={'ContactId':_0x2a3725['id'],'OpenchannelAccountId':_0xf532f['params']['id'],'from':(_0x2a3725[_0xea4d('0x88')]||'')+'\x20'+(_0x2a3725[_0xea4d('0x89')]||'')};var _0x4752eb={'OpenchannelAccountId':_0xf532f[_0xea4d('0x5f')]['id'],'closed':![]};if(_0xf532f[_0xea4d('0x5e')][_0xea4d('0x8a')]){_0x4752eb[_0xea4d('0x8a')]=_0xf532f[_0xea4d('0x5e')]['threadId'];return db['OpenchannelInteraction'][_0xea4d('0x56')]({'where':_0x4752eb})[_0xea4d('0x1e')](function(_0x2e384c){if(_0x2e384c){return[_0x2e384c,![]];}_0x31383c[_0xea4d('0x8a')]=_0xf532f[_0xea4d('0x5e')][_0xea4d('0x8a')];_0x31383c['externalUrl']=_0xf532f[_0xea4d('0x5e')][_0xea4d('0x8b')];return db['OpenchannelInteraction'][_0xea4d('0x57')](_0x31383c)[_0xea4d('0x1e')](function(_0x2568cc){return[_0x2568cc,!![]];});});}else{_0x4752eb[_0xea4d('0x8a')]=null;}_0x4752eb[_0xea4d('0x8c')]=_0x2a3725['id'];return db['OpenchannelInteraction'][_0xea4d('0x56')]({'where':_0x4752eb})[_0xea4d('0x1e')](function(_0x49dbb1){if(_0x49dbb1){return[_0x49dbb1,![]];}return db['OpenchannelInteraction']['create'](_0x31383c)[_0xea4d('0x1e')](function(_0x4bb6c9){return[_0x4bb6c9,!![]];});});}})[_0xea4d('0x8d')](function(_0x5ef29b,_0xb5fdaf){if(_0x5ef29b){_0x2418d5=_0xb5fdaf;if(!_0xb5fdaf){var _0x1734f2={'from':(_0x1796ac['contact']['firstName']||'')+'\x20'+(_0x1796ac[_0xea4d('0x87')][_0xea4d('0x89')]||'')};if(_0xf532f[_0xea4d('0x5e')]['threadId']&&_0xf532f['body'][_0xea4d('0x8e')]&&_0xf532f[_0xea4d('0x5e')][_0xea4d('0x8a')]!=_0xf532f[_0xea4d('0x5e')][_0xea4d('0x8e')]){_0x1734f2[_0xea4d('0x8a')]=_0xf532f[_0xea4d('0x5e')][_0xea4d('0x8e')];}return _0x5ef29b[_0xea4d('0x5d')](_0x1734f2);}else{return _0x5ef29b;}}})[_0xea4d('0x1e')](function(_0x3a290b){_0x1796ac[_0xea4d('0x8f')]=_0x3a290b[_0xea4d('0x34')]({'plain':!![]});_0x1796ac[_0xea4d('0x8f')][_0xea4d('0x90')]=_0x2418d5;if(_0x1796ac[_0xea4d('0x8f')][_0xea4d('0x90')]){if(_0x1796ac[_0xea4d('0x83')]['autoclose']){_0x1796ac[_0xea4d('0x7f')]['push']({'id':0x0,'priority':_0x1796ac[_0xea4d('0x7f')][_0xea4d('0x47')]+0x1,'app':_0xea4d('0x91'),'appdata':_0xea4d('0x92'),'interval':_0xea4d('0x93')});}}return db[_0xea4d('0x94')][_0xea4d('0x57')]({'body':_0xf532f['body'][_0xea4d('0x5e')],'OpenchannelAccountId':_0xf532f[_0xea4d('0x5f')]['id'],'OpenchannelInteractionId':_0x3a290b['id'],'direction':'in','ContactId':_0x1796ac[_0xea4d('0x87')]['id'],'AttachmentId':_0xf532f[_0xea4d('0x5e')][_0xea4d('0x95')]});})[_0xea4d('0x1e')](function(_0x12b9c3){_0x1796ac[_0xea4d('0x25')]=_0x12b9c3;if(_0x1796ac['interaction'][_0xea4d('0x96')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x1796ac['interaction'][_0xea4d('0x96')]}})[_0xea4d('0x1e')](function(_0x38e9dd){if(_0x38e9dd){_0x1796ac[_0xea4d('0x7f')][_0xea4d('0x97')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x38e9dd[_0xea4d('0x37')]+','+(_0x1796ac[_0xea4d('0x83')][_0xea4d('0x98')]||0xa),'interval':_0xea4d('0x93')});_0x1796ac['forcedOwnership']=![];}return respondWithRpcPromise(_0xea4d('0x99'),_0xea4d('0x9a'),_0x1796ac);});}return respondWithRpcPromise('Start','startRouting',_0x1796ac);})[_0xea4d('0x1e')](function(_0x25d199){respondWithRpcPromise(_0xea4d('0x9b'),_0xea4d('0x9b'),{'event':_0xea4d('0x6c'),'message':_0x25d199},client9002);return _0x25d199;})['then'](respondWithResult(_0xe6f4a,null))[_0xea4d('0x27')](handleError(_0xe6f4a,null));};exports['addApplications']=function(_0x3de0e5,_0x1612ef,_0x33e886){return db[_0xea4d('0x55')][_0xea4d('0x65')]({'where':{'id':_0x3de0e5[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x1612ef,null))[_0xea4d('0x1e')](function(_0x241303){if(_0x241303){return db[_0xea4d('0x9c')][_0xea4d('0x9d')](function(_0x467021){return db['OpenchannelApplication'][_0xea4d('0x33')]({'where':{'OpenchannelAccountId':_0x3de0e5['params']['id']},'transaction':_0x467021})['then'](function(_0x131d68){var _0x2a60a8=_[_0xea4d('0x3c')](_0x3de0e5[_0xea4d('0x5e')],function(_0x46f40b){_0x46f40b[_0xea4d('0x62')]=_0x3de0e5[_0xea4d('0x5f')]['id'];return _0x46f40b;});return db[_0xea4d('0x9e')]['bulkCreate'](_0x2a60a8,{'transaction':_0x467021});});})[_0xea4d('0x1e')](function(){return db[_0xea4d('0x9e')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x3de0e5[_0xea4d('0x5f')]['id']},'order':'priority'});});}})[_0xea4d('0x1e')](respondWithResult(_0x1612ef,null))['catch'](handleError(_0x1612ef,null));};exports[_0xea4d('0x9f')]=function(_0x503562,_0x17fd0c,_0x383e6d){var _0x3af7d5={};var _0x42abcd={};var _0x2af1e1;var _0x2d3b7b;return db[_0xea4d('0x55')]['findOne']({'where':{'id':_0x503562[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x17fd0c,null))[_0xea4d('0x1e')](function(_0x1e68a4){if(_0x1e68a4){_0x2af1e1=_0x1e68a4;_0x42abcd[_0xea4d('0x40')]=_[_0xea4d('0x41')](db['OpenchannelApplication'][_0xea4d('0x54')]);_0x42abcd[_0xea4d('0x42')]=_['keys'](_0x503562[_0xea4d('0x42')]);_0x42abcd[_0xea4d('0x43')]=_[_0xea4d('0x44')](_0x42abcd[_0xea4d('0x40')],_0x42abcd[_0xea4d('0x42')]);_0x3af7d5['attributes']=_[_0xea4d('0x44')](_0x42abcd['model'],qs[_0xea4d('0x45')](_0x503562['query'][_0xea4d('0x45')]));_0x3af7d5[_0xea4d('0x46')]=_0x3af7d5[_0xea4d('0x46')]['length']?_0x3af7d5[_0xea4d('0x46')]:_0x42abcd[_0xea4d('0x40')];_0x3af7d5['order']=qs[_0xea4d('0x66')](_0x503562[_0xea4d('0x42')]['sort']);_0x3af7d5['where']=qs[_0xea4d('0x43')](_[_0xea4d('0x6a')](_0x503562[_0xea4d('0x42')],_0x42abcd[_0xea4d('0x43')]));if(_0x503562[_0xea4d('0x42')][_0xea4d('0x4b')]){_0x3af7d5[_0xea4d('0x4a')]=_[_0xea4d('0x4c')](_0x3af7d5['where'],{'$or':_[_0xea4d('0x3c')](_0x3af7d5[_0xea4d('0x46')],function(_0xe52be2){var _0x2c00d6={};_0x2c00d6[_0xe52be2]={'$like':'%'+_0x503562[_0xea4d('0x42')][_0xea4d('0x4b')]+'%'};return _0x2c00d6;})});}_0x3af7d5=_[_0xea4d('0x4c')]({},_0x3af7d5,_0x503562[_0xea4d('0x4e')]);return _0x2af1e1[_0xea4d('0x9f')](_0x3af7d5);}})[_0xea4d('0x1e')](function(_0x378164){if(_0x378164){_0x2d3b7b=_0x378164[_0xea4d('0x47')];if(!_0x503562['query'][_0xea4d('0x69')]('nolimit')){_0x3af7d5[_0xea4d('0x2c')]=qs['limit'](_0x503562[_0xea4d('0x42')]['limit']);_0x3af7d5[_0xea4d('0x2a')]=qs[_0xea4d('0x2a')](_0x503562['query'][_0xea4d('0x2a')]);}return _0x2af1e1[_0xea4d('0x9f')](_0x3af7d5);}})[_0xea4d('0x1e')](function(_0x29ddcc){if(_0x29ddcc){return _0x29ddcc?{'count':_0x2d3b7b,'rows':_0x29ddcc}:null;}})[_0xea4d('0x1e')](respondWithResult(_0x17fd0c,null))[_0xea4d('0x27')](handleError(_0x17fd0c,null));};exports[_0xea4d('0xa0')]=function(_0x2a10c1,_0x3a6b30,_0x4ec9cf){var _0x3d158b={'raw':![],'where':{}};var _0x4a4948={};var _0x147eb7={'count':0x0,'rows':[]};return db[_0xea4d('0x55')]['findOne']({'where':{'id':_0x2a10c1[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x3a6b30,null))[_0xea4d('0x1e')](function(_0x56d4b7){if(_0x56d4b7){_0x4a4948[_0xea4d('0x40')]=_[_0xea4d('0x41')](db[_0xea4d('0xa1')]['rawAttributes']);_0x4a4948[_0xea4d('0x42')]=_['keys'](_0x2a10c1[_0xea4d('0x42')]);_0x4a4948[_0xea4d('0x43')]=_[_0xea4d('0x44')](_0x4a4948[_0xea4d('0x40')],_0x4a4948['query']);_0x3d158b[_0xea4d('0x46')]=_[_0xea4d('0x44')](_0x4a4948['model'],qs[_0xea4d('0x45')](_0x2a10c1['query'][_0xea4d('0x45')]));_0x3d158b['attributes']=_0x3d158b[_0xea4d('0x46')]['length']?_0x3d158b[_0xea4d('0x46')]:_0x4a4948[_0xea4d('0x40')];if(!_0x2a10c1['query'][_0xea4d('0x69')](_0xea4d('0x48'))){_0x3d158b['limit']=qs[_0xea4d('0x2c')](_0x2a10c1['query'][_0xea4d('0x2c')]);_0x3d158b[_0xea4d('0x2a')]=qs['offset'](_0x2a10c1[_0xea4d('0x42')][_0xea4d('0x2a')]);}_0x3d158b[_0xea4d('0x49')]=qs[_0xea4d('0x66')](_0x2a10c1[_0xea4d('0x42')][_0xea4d('0x66')]);_0x3d158b[_0xea4d('0x4a')]=qs[_0xea4d('0x43')](_[_0xea4d('0x6a')](_0x2a10c1['query'],_0x4a4948['filters']));_0x3d158b[_0xea4d('0x4a')]['OpenchannelAccountId']=_0x56d4b7['id'];if(_0x2a10c1[_0xea4d('0x42')][_0xea4d('0x4b')]){_0x3d158b[_0xea4d('0x4a')]=_[_0xea4d('0x4c')](_0x3d158b[_0xea4d('0x4a')],{'$or':_[_0xea4d('0x3c')](_0x3d158b[_0xea4d('0x46')],function(_0x4ea238){var _0x1778e6={};_0x1778e6[_0x4ea238]={'$like':'%'+_0x2a10c1[_0xea4d('0x42')]['filter']+'%'};return _0x1778e6;})});}_0x3d158b=_[_0xea4d('0x4c')]({},_0x3d158b,_0x2a10c1[_0xea4d('0x4e')]);return db[_0xea4d('0xa1')]['count']({'where':_0x3d158b[_0xea4d('0x4a')]})[_0xea4d('0x1e')](function(_0x5fb3f8){_0x147eb7[_0xea4d('0x2d')]=_0x5fb3f8;if(_0x2a10c1[_0xea4d('0x42')][_0xea4d('0x4f')]){_0x3d158b['include']=[{'model':db[_0xea4d('0x6d')],'as':_0xea4d('0xa2'),'required':![]},{'model':db['User'],'as':_0xea4d('0xa3'),'attributes':[_0xea4d('0x37'),_0xea4d('0xa4'),_0xea4d('0xa5')],'required':![]},{'model':db[_0xea4d('0xa6')],'as':_0xea4d('0xa7'),'attributes':['id',_0xea4d('0x37'),'color'],'where':_0x2a10c1[_0xea4d('0x42')][_0xea4d('0xa8')]?{'id':_0x2a10c1[_0xea4d('0x42')][_0xea4d('0xa8')]}:undefined,'required':_0x2a10c1[_0xea4d('0x42')][_0xea4d('0xa8')]?!![]:![]}];}return db[_0xea4d('0xa1')][_0xea4d('0x51')](_0x3d158b);})['then'](function(_0x420b1b){_0x147eb7[_0xea4d('0x52')]=_0x420b1b;return _0x147eb7;});}})[_0xea4d('0x1e')](respondWithFilteredResult(_0x3a6b30,_0x3d158b))[_0xea4d('0x27')](handleError(_0x3a6b30,null));};exports[_0xea4d('0xa9')]=function(_0x59c859,_0x4fc99f,_0x95204e){return db[_0xea4d('0x55')][_0xea4d('0x56')]({'where':{'id':_0x59c859[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x4fc99f,null))[_0xea4d('0x1e')](function(_0x4df968){if(_0x4df968){return _0x4df968[_0xea4d('0xa9')](_0x59c859['body'][_0xea4d('0xaa')],_[_0xea4d('0xab')](_0x59c859[_0xea4d('0x5e')],[_0xea4d('0xaa'),'id'])||{})[_0xea4d('0x8d')](function(_0x1e02f3){for(var _0x5edff4=0x0;_0x5edff4<_0x59c859[_0xea4d('0x5e')]['ids']['length'];_0x5edff4+=0x1){socket[_0xea4d('0xac')](_0xea4d('0xad'),{'UserId':Number(_0x59c859[_0xea4d('0x5e')]['ids'][_0x5edff4]),'OpenchannelAccountId':Number(_0x59c859['params']['id'])});}return _0x1e02f3;});}})[_0xea4d('0x1e')](respondWithResult(_0x4fc99f,null))[_0xea4d('0x27')](handleError(_0x4fc99f,null));};exports['removeAgents']=function(_0x3aa276,_0x11b699,_0x5d911f){return db[_0xea4d('0x55')][_0xea4d('0x56')]({'where':{'id':_0x3aa276[_0xea4d('0x5f')]['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x11b699,null))[_0xea4d('0x1e')](function(_0x5bb111){if(_0x5bb111){return _0x5bb111['removeAgents'](_0x3aa276[_0xea4d('0x42')][_0xea4d('0xaa')])['then'](function(){if(_['isArray'](_0x3aa276[_0xea4d('0x42')][_0xea4d('0xaa')])){for(var _0x45f8f7=0x0;_0x45f8f7<_0x3aa276[_0xea4d('0x42')][_0xea4d('0xaa')][_0xea4d('0x47')];_0x45f8f7+=0x1){socket[_0xea4d('0xac')](_0xea4d('0xae'),{'UserId':Number(_0x3aa276[_0xea4d('0x42')][_0xea4d('0xaa')][_0x45f8f7]),'OpenchannelAccountId':Number(_0x3aa276[_0xea4d('0x5f')]['id'])});}}else{socket[_0xea4d('0xac')](_0xea4d('0xae'),{'UserId':Number(_0x3aa276[_0xea4d('0x42')][_0xea4d('0xaa')]),'OpenchannelAccountId':Number(_0x3aa276['params']['id'])});}});}})[_0xea4d('0x1e')](respondWithStatusCode(_0x11b699,null))[_0xea4d('0x27')](handleError(_0x11b699,null));};exports[_0xea4d('0xaf')]=function(_0x30c399,_0x40e3ae,_0x51b9ef){var _0x141123={};var _0x34c780={};var _0x47e7d4;var _0x2d77af;return db['OpenchannelAccount'][_0xea4d('0x65')]({'where':{'id':_0x30c399['params']['id']}})[_0xea4d('0x1e')](handleEntityNotFound(_0x40e3ae,null))[_0xea4d('0x1e')](function(_0x3e02d9){if(_0x3e02d9){_0x47e7d4=_0x3e02d9;_0x34c780[_0xea4d('0x40')]=_[_0xea4d('0x41')](db['User'][_0xea4d('0x54')]);_0x34c780[_0xea4d('0x42')]=_[_0xea4d('0x41')](_0x30c399[_0xea4d('0x42')]);_0x34c780[_0xea4d('0x43')]=_[_0xea4d('0x44')](_0x34c780['model'],_0x34c780[_0xea4d('0x42')]);_0x141123['attributes']=_[_0xea4d('0x44')](_0x34c780[_0xea4d('0x40')],qs['fields'](_0x30c399[_0xea4d('0x42')]['fields']));_0x141123[_0xea4d('0x46')]=_0x141123[_0xea4d('0x46')][_0xea4d('0x47')]?_0x141123[_0xea4d('0x46')]:_0x34c780[_0xea4d('0x40')];_0x141123[_0xea4d('0x49')]=qs[_0xea4d('0x66')](_0x30c399[_0xea4d('0x42')][_0xea4d('0x66')]);_0x141123[_0xea4d('0x4a')]=qs['filters'](_[_0xea4d('0x6a')](_0x30c399['query'],_0x34c780[_0xea4d('0x43')]));if(_0x30c399['query'][_0xea4d('0x4b')]){_0x141123[_0xea4d('0x4a')]=_[_0xea4d('0x4c')](_0x141123['where'],{'$or':_[_0xea4d('0x3c')](_0x141123[_0xea4d('0x46')],function(_0x15edb9){var _0x317ebc={};_0x317ebc[_0x15edb9]={'$like':'%'+_0x30c399[_0xea4d('0x42')]['filter']+'%'};return _0x317ebc;})});}_0x141123=_[_0xea4d('0x4c')]({},_0x141123,_0x30c399[_0xea4d('0x4e')]);return _0x47e7d4[_0xea4d('0xaf')](_0x141123);}})[_0xea4d('0x1e')](function(_0x198c89){if(_0x198c89){_0x2d77af=_0x198c89[_0xea4d('0x47')];if(!_0x30c399[_0xea4d('0x42')][_0xea4d('0x69')](_0xea4d('0x48'))){_0x141123[_0xea4d('0x2c')]=qs[_0xea4d('0x2c')](_0x30c399['query']['limit']);_0x141123[_0xea4d('0x2a')]=qs['offset'](_0x30c399[_0xea4d('0x42')]['offset']);}return _0x47e7d4[_0xea4d('0xaf')](_0x141123);}})[_0xea4d('0x1e')](function(_0xdac6ca){if(_0xdac6ca){return _0xdac6ca?{'count':_0x2d77af,'rows':_0xdac6ca}:null;}})['then'](respondWithResult(_0x40e3ae,null))['catch'](handleError(_0x40e3ae,null));};exports['send']=function(_0x33b43e,_0x2b9967,_0x16b69b){var _0x127aa0,_0x56f97b,_0x3aa11a;if(_['isNil'](_0x33b43e[_0xea4d('0x5e')]['body'])||_0x33b43e[_0xea4d('0x5e')][_0xea4d('0x5e')]===''){throw new db[(_0xea4d('0x6e'))][(_0xea4d('0x76'))](_0xea4d('0x77'));}if(_[_0xea4d('0x75')](_0x33b43e[_0xea4d('0x5e')]['to'])){}_0x127aa0=_0x33b43e[_0xea4d('0x5e')]['to'];return db['OpenchannelAccount'][_0xea4d('0x65')]({'where':{'id':_0x33b43e['params']['id']}})['then'](handleEntityNotFound(_0x2b9967,null))[_0xea4d('0x1e')](function(_0x59b6fe){if(_0x59b6fe){return db[_0xea4d('0x55')][_0xea4d('0x56')]({'where':{'id':_0x59b6fe['id']},'include':[{'model':db[_0xea4d('0xb0')],'as':_0xea4d('0x7c'),'include':[{'model':db[_0xea4d('0x6d')],'as':_0xea4d('0x85'),'where':{[_0x59b6fe[_0xea4d('0x78')]]:_0x127aa0},'limit':0x1,'order':[[_0xea4d('0x71'),_0xea4d('0x7d')]]}]}]})[_0xea4d('0x1e')](handleEntityNotFound(_0x2b9967,null))['then'](function(_0x1689ad){if(_0x1689ad&&_0x1689ad[_0xea4d('0x7c')]){_0x56f97b=_0x1689ad[_0xea4d('0x34')]({'plain':!![]});if(_0x56f97b['List']&&_0x56f97b['List'][_0xea4d('0x85')]['length']){return _0x56f97b[_0xea4d('0x7c')][_0xea4d('0x85')][0x0];}return db[_0xea4d('0x6d')]['create'](_[_0xea4d('0x86')](_0x33b43e[_0xea4d('0x5e')],{'firstName':_0x127aa0,[_0x1689ad[_0xea4d('0x78')]]:_0x127aa0,'phone':_0x127aa0,'ListId':_0x56f97b[_0xea4d('0x73')]}));}})['then'](handleEntityNotFound(_0x2b9967,null))['then'](function(_0x33a63b){if(_0x33a63b){_0x3aa11a=_0x33a63b;return db[_0xea4d('0xa1')][_0xea4d('0x56')]({'where':{'ContactId':_0x3aa11a['id'],'closed':![],'OpenchannelAccountId':_0x56f97b['id']}})[_0xea4d('0x1e')](function(_0x2d5f14){if(_0x2d5f14){return[_0x2d5f14,![]];}return db[_0xea4d('0xa1')][_0xea4d('0x57')]({'UserId':_0x33b43e[_0xea4d('0x58')]['id'],'ContactId':_0x3aa11a['id'],'OpenchannelAccountId':_0x56f97b['id'],'lastMsgDirection':'out','Messages':[_[_0xea4d('0x4c')](_0x33b43e[_0xea4d('0x5e')],{'read':![],'body':_0x33b43e[_0xea4d('0x5e')][_0xea4d('0x5e')],'OpenchannelAccountId':_0x56f97b['id'],'UserId':_0x33b43e[_0xea4d('0x58')]['id'],'ContactId':_0x3aa11a['id']})]},{'include':[{'model':db[_0xea4d('0x94')],'as':'Messages'}]})[_0xea4d('0x1e')](function(_0x1bf964){return[_0x1bf964,!![]];});});}})[_0xea4d('0x8d')](function(_0x6f6c27,_0xd74562){if(_0xd74562){return _0x6f6c27;}return db['OpenchannelMessage'][_0xea4d('0x57')](_['merge'](_0x33b43e['body'],{'read':![],'body':_0x33b43e[_0xea4d('0x5e')][_0xea4d('0x5e')],'OpenchannelAccountId':_0x56f97b['id'],'OpenchannelInteractionId':_0x6f6c27['id'],'UserId':_0x33b43e[_0xea4d('0x58')]['id'],'ContactId':_0x3aa11a['id']}))[_0xea4d('0x1e')](function(_0x2471bb){_0x6f6c27['dataValues'][_0xea4d('0xb1')]=[];_0x6f6c27[_0xea4d('0xb2')]['Messages'][_0xea4d('0xb3')](_0x2471bb['dataValues']);return _0x6f6c27;});});}})[_0xea4d('0x1e')](respondWithResult(_0x2b9967,null))['catch'](handleError(_0x2b9967,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 134f8d5..39eac3a 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 _0x2547=['hasOwnProperty','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x2bb398,_0xd7c0dc){var _0x4dfefc=function(_0x20b088){while(--_0x20b088){_0x2bb398['push'](_0x2bb398['shift']());}};_0x4dfefc(++_0xd7c0dc);}(_0x2547,0x1cd));var _0x7254=function(_0x522a2d,_0x45d6af){_0x522a2d=_0x522a2d-0x0;var _0x63200e=_0x2547[_0x522a2d];return _0x63200e;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7254('0x0'))['db'][_0x7254('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7254('0x2')](0x0);var events={'afterCreate':_0x7254('0x3'),'afterUpdate':_0x7254('0x4'),'afterDestroy':_0x7254('0x5')};function emitEvent(_0x9f3435){return function(_0x265ebf,_0x53a02f,_0x2ddeae){OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435+':'+_0x265ebf['id'],_0x265ebf);OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435,_0x265ebf);_0x2ddeae(null);};}for(var e in events){if(events[_0x7254('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x7254('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x5ab060,_0x23bb83){var _0x5ed2fd=function(_0x84f087){while(--_0x84f087){_0x5ab060['push'](_0x5ab060['shift']());}};_0x5ed2fd(++_0x23bb83);}(_0xac4a,0x13f));var _0xaac4=function(_0x54f031,_0x1fbb25){_0x54f031=_0x54f031-0x0;var _0x44f94e=_0xac4a[_0x54f031];return _0x44f94e;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('0x7')](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 e8d68e8..e36713d 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(_0x588fcf,_0x41ee41){var _0x49b8d6=function(_0x2bd2ba){while(--_0x2bd2ba){_0x588fcf['push'](_0x588fcf['shift']());}};_0x49b8d6(++_0x41ee41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x2e2ab0,_0x197fce){var _0x3bedec=function(_0x4495dc){while(--_0x4495dc){_0x2e2ab0['push'](_0x2e2ab0['shift']());}};_0x3bedec(++_0x197fce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 7207d1b..58328c9 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 _0xac4a=['../../config/logger','rpc','../../config/environment','client','redis','localhost','./openchannelAccount.socket','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3ea506,_0x6a7445){var _0x2963ff=function(_0xfd016e){while(--_0xfd016e){_0x3ea506['push'](_0x3ea506['shift']());}};_0x2963ff(++_0x6a7445);}(_0xac4a,0x13f));var _0xaac4=function(_0x4e3811,_0x168672){_0x4e3811=_0x4e3811-0x0;var _0x780416=_0xac4a[_0x4e3811];return _0x780416;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});config[_0xaac4('0xa')]=_['defaults'](config[_0xaac4('0xa')],{'host':_0xaac4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaac4('0xc'))['register'](socket);function respondWithRpcPromise(_0x452573,_0x59b992,_0x4f4c84){return new BPromise(function(_0xeb6b9a,_0x22cea4){return client[_0xaac4('0xd')](_0x452573,_0x4f4c84)[_0xaac4('0xe')](function(_0x3a983c){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x59b992,_0xaac4('0xf'));logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x59b992,'request\x20sent',JSON[_0xaac4('0x12')](_0x3a983c));if(_0x3a983c[_0xaac4('0x13')]){if(_0x3a983c['error'][_0xaac4('0x14')]===0x1f4){logger[_0xaac4('0x13')](_0xaac4('0x15'),_0x59b992,_0x3a983c[_0xaac4('0x13')][_0xaac4('0x16')]);return _0x22cea4(_0x3a983c[_0xaac4('0x13')][_0xaac4('0x16')]);}logger[_0xaac4('0x13')](_0xaac4('0x15'),_0x59b992,_0x3a983c[_0xaac4('0x13')][_0xaac4('0x16')]);return _0xeb6b9a(_0x3a983c[_0xaac4('0x13')][_0xaac4('0x16')]);}else{logger['info'](_0xaac4('0x15'),_0x59b992,'request\x20sent');_0xeb6b9a(_0x3a983c[_0xaac4('0x17')]['message']);}})[_0xaac4('0x18')](function(_0x27fe7b){logger[_0xaac4('0x13')](_0xaac4('0x15'),_0x59b992,_0x27fe7b);_0x22cea4(_0x27fe7b);});});} \ No newline at end of file +var _0xc29b=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x409822,_0x2da46f){var _0x405a0b=function(_0x554960){while(--_0x554960){_0x409822['push'](_0x409822['shift']());}};_0x405a0b(++_0x2da46f);}(_0xc29b,0x12d));var _0xbc29=function(_0x142086,_0x369c6d){_0x142086=_0x142086-0x0;var _0x5a0193=_0xc29b[_0x142086];return _0x5a0193;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});config[_0xbc29('0xc')]=_[_0xbc29('0xd')](config[_0xbc29('0xc')],{'host':_0xbc29('0xe'),'port':0x18eb});var socket=require(_0xbc29('0xf'))(new Redis(config[_0xbc29('0xc')]));require(_0xbc29('0x10'))[_0xbc29('0x11')](socket);function respondWithRpcPromise(_0x36d1e3,_0x13a581,_0x2f591c){return new BPromise(function(_0x35ece9,_0x2710ad){return client['request'](_0x36d1e3,_0x2f591c)[_0xbc29('0x12')](function(_0x888953){logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));logger[_0xbc29('0x16')](_0xbc29('0x17'),_0x13a581,'request\x20sent',JSON[_0xbc29('0x18')](_0x888953));if(_0x888953[_0xbc29('0x19')]){if(_0x888953[_0xbc29('0x19')]['code']===0x1f4){logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x2710ad(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x35ece9(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}else{logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));_0x35ece9(_0x888953['result'][_0xbc29('0x1a')]);}})[_0xbc29('0x1b')](function(_0x4eadbe){logger['error'](_0xbc29('0x14'),_0x13a581,_0x4eadbe);_0x2710ad(_0x4eadbe);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 84691c9..cfeea18 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 _0x6599=['register','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6599,0xb0));var _0x9659=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0x6599[_0x4fc80b];return _0x119dba;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x9659('0x0'),_0x9659('0x1'),_0x9659('0x2')];function createListener(_0x32e67a,_0x21a23e){return function(_0x4c8ba9){_0x21a23e[_0x9659('0x3')](_0x32e67a,_0x4c8ba9);};}function removeListener(_0x5e2a8e,_0x2f5d38){return function(){OpenchannelAccountEvents['removeListener'](_0x5e2a8e,_0x2f5d38);};}exports[_0x9659('0x4')]=function(_0xb08ede){for(var _0x159ac2=0x0,_0x478dfa=events['length'];_0x159ac2<_0x478dfa;_0x159ac2++){var _0xabdd12=events[_0x159ac2];var _0x14cb81=createListener('openchannelAccount:'+_0xabdd12,_0xb08ede);OpenchannelAccountEvents['on'](_0xabdd12,_0x14cb81);}}; \ No newline at end of file +var _0x0911=['remove','update','removeListener','register','length','./openchannelAccount.events','save'];(function(_0x3dd0b9,_0x1d6c92){var _0x4c0351=function(_0x2cf6a8){while(--_0x2cf6a8){_0x3dd0b9['push'](_0x3dd0b9['shift']());}};_0x4c0351(++_0x1d6c92);}(_0x0911,0x1a9));var _0x1091=function(_0x47f4c2,_0x134e7b){_0x47f4c2=_0x47f4c2-0x0;var _0x22c63e=_0x0911[_0x47f4c2];return _0x22c63e;};'use strict';var OpenchannelAccountEvents=require(_0x1091('0x0'));var events=[_0x1091('0x1'),_0x1091('0x2'),_0x1091('0x3')];function createListener(_0x2c7d8d,_0x5b1494){return function(_0x4312e5){_0x5b1494['emit'](_0x2c7d8d,_0x4312e5);};}function removeListener(_0x3a71a4,_0x58640b){return function(){OpenchannelAccountEvents[_0x1091('0x4')](_0x3a71a4,_0x58640b);};}exports[_0x1091('0x5')]=function(_0x3e3868){for(var _0x28747=0x0,_0x2ad19a=events[_0x1091('0x6')];_0x28747<_0x2ad19a;_0x28747++){var _0x7b3a7d=events[_0x28747];var _0x457631=createListener('openchannelAccount:'+_0x7b3a7d,_0x3e3868);OpenchannelAccountEvents['on'](_0x7b3a7d,_0x457631);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b54d624..ea33145 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 _0x1bcc=['destroy','exports','multer','util','path','express','fs-extra','./openchannelApplication.controller','get','isAuthenticated','index','show','post','put','/:id','delete'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1bcc,0x172));var _0xc1bc=function(_0x35d291,_0x1a131b){_0x35d291=_0x35d291-0x0;var _0x370b86=_0x1bcc[_0x35d291];return _0x370b86;};'use strict';var multer=require(_0xc1bc('0x0'));var util=require(_0xc1bc('0x1'));var path=require(_0xc1bc('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1bc('0x3'));var router=express['Router']();var fs_extra=require(_0xc1bc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc1bc('0x5'));router[_0xc1bc('0x6')]('/',auth[_0xc1bc('0x7')](),controller[_0xc1bc('0x8')]);router['get']('/:id',auth[_0xc1bc('0x7')](),controller[_0xc1bc('0x9')]);router[_0xc1bc('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc1bc('0xb')](_0xc1bc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc1bc('0xd')]('/:id',auth[_0xc1bc('0x7')](),controller[_0xc1bc('0xe')]);module[_0xc1bc('0xf')]=router; \ No newline at end of file +var _0x564a=['../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x4aa936,_0x5d92ac){var _0x497339=function(_0x4afa76){while(--_0x4afa76){_0x4aa936['push'](_0x4aa936['shift']());}};_0x497339(++_0x5d92ac);}(_0x564a,0xaf));var _0xa564=function(_0x39e2bf,_0x2e2643){_0x39e2bf=_0x39e2bf-0x0;var _0x3bc44c=_0x564a[_0x39e2bf];return _0x3bc44c;};'use strict';var multer=require('multer');var util=require(_0xa564('0x0'));var path=require(_0xa564('0x1'));var timeout=require('connect-timeout');var express=require(_0xa564('0x2'));var router=express[_0xa564('0x3')]();var fs_extra=require(_0xa564('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa564('0x5'));var config=require('../../config/environment');var controller=require(_0xa564('0x6'));router[_0xa564('0x7')]('/',auth[_0xa564('0x8')](),controller[_0xa564('0x9')]);router['get'](_0xa564('0xa'),auth[_0xa564('0x8')](),controller[_0xa564('0xb')]);router[_0xa564('0xc')]('/',auth[_0xa564('0x8')](),controller[_0xa564('0xd')]);router[_0xa564('0xe')]('/:id',auth[_0xa564('0x8')](),controller['update']);router[_0xa564('0xf')]('/:id',auth[_0xa564('0x8')](),controller[_0xa564('0x10')]);module[_0xa564('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7f93ac7..a482e94 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 _0x7bbf=['*,*,*,*','exports','INTEGER','STRING'];(function(_0x12e3f4,_0x43f737){var _0x59fb4e=function(_0x304f31){while(--_0x304f31){_0x12e3f4['push'](_0x12e3f4['shift']());}};_0x59fb4e(++_0x43f737);}(_0x7bbf,0x149));var _0xf7bb=function(_0x583763,_0x48cd5f){_0x583763=_0x583763-0x0;var _0x223155=_0x7bbf[_0x583763];return _0x223155;};'use strict';var Sequelize=require('sequelize');module[_0xf7bb('0x0')]={'priority':{'type':Sequelize[_0xf7bb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf7bb('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf7bb('0x2')]},'interval':{'type':Sequelize[_0xf7bb('0x2')],'defaultValue':_0xf7bb('0x3')}}; \ No newline at end of file +var _0x60f0=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x1b50fa,_0x4efb80){var _0x39940c=function(_0x5044af){while(--_0x5044af){_0x1b50fa['push'](_0x1b50fa['shift']());}};_0x39940c(++_0x4efb80);}(_0x60f0,0x1c6));var _0x060f=function(_0xf9daca,_0x4a2fbd){_0xf9daca=_0xf9daca-0x0;var _0x2472de=_0x60f0[_0xf9daca];return _0x2472de;};'use strict';var Sequelize=require(_0x060f('0x0'));module[_0x060f('0x1')]={'priority':{'type':Sequelize[_0x060f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x060f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x060f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x060f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index be0af41..bae298a 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 _0xe5be=['create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','index','map','OpenchannelApplication','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','include','rows','catch','show','rawAttributes','options','find'];(function(_0x553d11,_0x281ad3){var _0x4bfbd8=function(_0x3a4ff2){while(--_0x3a4ff2){_0x553d11['push'](_0x553d11['shift']());}};_0x4bfbd8(++_0x281ad3);}(_0xe5be,0x175));var _0xee5b=function(_0x711e2c,_0x1ca697){_0x711e2c=_0x711e2c-0x0;var _0x25b502=_0xe5be[_0x711e2c];return _0x25b502;};'use strict';var emlformat=require(_0xee5b('0x0'));var rimraf=require(_0xee5b('0x1'));var zipdir=require(_0xee5b('0x2'));var jsonpatch=require(_0xee5b('0x3'));var rp=require(_0xee5b('0x4'));var moment=require(_0xee5b('0x5'));var BPromise=require(_0xee5b('0x6'));var Mustache=require(_0xee5b('0x7'));var util=require(_0xee5b('0x8'));var path=require('path');var sox=require(_0xee5b('0x9'));var csv=require(_0xee5b('0xa'));var ejs=require(_0xee5b('0xb'));var fs=require('fs');var fs_extra=require(_0xee5b('0xc'));var _=require(_0xee5b('0xd'));var squel=require(_0xee5b('0xe'));var crypto=require(_0xee5b('0xf'));var jsforce=require(_0xee5b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xee5b('0xa'));var querystring=require('querystring');var Papa=require(_0xee5b('0x11'));var Redis=require(_0xee5b('0x12'));var authService=require(_0xee5b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xee5b('0x14'))('api');var utils=require(_0xee5b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xee5b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ba5f5,_0x4ac2d1){_0x4ac2d1=_0x4ac2d1||0xcc;return function(_0xd52b3c){if(_0xd52b3c){return _0x4ba5f5['sendStatus'](_0x4ac2d1);}return _0x4ba5f5[_0xee5b('0x17')](_0x4ac2d1)[_0xee5b('0x18')]();};}function respondWithResult(_0x557843,_0x538acb){_0x538acb=_0x538acb||0xc8;return function(_0x4099a8){if(_0x4099a8){return _0x557843[_0xee5b('0x17')](_0x538acb)[_0xee5b('0x19')](_0x4099a8);}};}function respondWithFilteredResult(_0x43ccf8,_0x2fefef){return function(_0x5b0a85){if(_0x5b0a85){var _0x2e46ea=typeof _0x2fefef['offset']===_0xee5b('0x1a')&&typeof _0x2fefef[_0xee5b('0x1b')]==='undefined';var _0x3aa7f7=_0x5b0a85[_0xee5b('0x1c')];var _0x55b370=_0x2e46ea?0x0:_0x2fefef[_0xee5b('0x1d')];var _0x24d10e=_0x2e46ea?_0x5b0a85[_0xee5b('0x1c')]:_0x2fefef[_0xee5b('0x1d')]+_0x2fefef[_0xee5b('0x1b')];var _0x16d7e7;if(_0x24d10e>=_0x3aa7f7){_0x24d10e=_0x3aa7f7;_0x16d7e7=0xc8;}else{_0x16d7e7=0xce;}_0x43ccf8[_0xee5b('0x17')](_0x16d7e7);return _0x43ccf8['set'](_0xee5b('0x1e'),_0x55b370+'-'+_0x24d10e+'/'+_0x3aa7f7)[_0xee5b('0x19')](_0x5b0a85);}return null;};}function patchUpdates(_0x5b5c2c){return function(_0x1c2bb8){try{jsonpatch[_0xee5b('0x1f')](_0x1c2bb8,_0x5b5c2c,!![]);}catch(_0x310def){return BPromise[_0xee5b('0x20')](_0x310def);}return _0x1c2bb8['save']();};}function saveUpdates(_0xd01b2c,_0x23bee3){return function(_0x4cc28a){if(_0x4cc28a){return _0x4cc28a[_0xee5b('0x21')](_0xd01b2c)['then'](function(_0x38cb0c){return _0x38cb0c;});}return null;};}function removeEntity(_0x37a607,_0x2e7736){return function(_0x424517){if(_0x424517){return _0x424517[_0xee5b('0x22')]()['then'](function(){_0x37a607['status'](0xcc)[_0xee5b('0x18')]();});}};}function handleEntityNotFound(_0x4c01dd,_0x4c09fb){return function(_0x4a7399){if(!_0x4a7399){_0x4c01dd[_0xee5b('0x23')](0x194);}return _0x4a7399;};}function handleError(_0xe52abb,_0x58b612){_0x58b612=_0x58b612||0x1f4;return function(_0x587267){logger[_0xee5b('0x24')](_0x587267[_0xee5b('0x25')]);if(_0x587267[_0xee5b('0x26')]){delete _0x587267[_0xee5b('0x26')];}_0xe52abb[_0xee5b('0x17')](_0x58b612)['send'](_0x587267);};}exports[_0xee5b('0x27')]=function(_0x5d3bb9,_0xb184d2){var _0x2aee25={},_0x2efea5={},_0x40b1f8={'count':0x0,'rows':[]};var _0x2cab3b=_[_0xee5b('0x28')](db[_0xee5b('0x29')]['rawAttributes'],function(_0x52e712){return{'name':_0x52e712[_0xee5b('0x2a')],'type':_0x52e712['type'][_0xee5b('0x2b')]};});_0x2efea5['model']=_[_0xee5b('0x28')](_0x2cab3b,_0xee5b('0x26'));_0x2efea5[_0xee5b('0x2c')]=_[_0xee5b('0x2d')](_0x5d3bb9[_0xee5b('0x2c')]);_0x2efea5[_0xee5b('0x2e')]=_[_0xee5b('0x2f')](_0x2efea5['model'],_0x2efea5['query']);_0x2aee25[_0xee5b('0x30')]=_[_0xee5b('0x2f')](_0x2efea5[_0xee5b('0x31')],qs[_0xee5b('0x32')](_0x5d3bb9[_0xee5b('0x2c')][_0xee5b('0x32')]));_0x2aee25[_0xee5b('0x30')]=_0x2aee25['attributes'][_0xee5b('0x33')]?_0x2aee25[_0xee5b('0x30')]:_0x2efea5[_0xee5b('0x31')];if(!_0x5d3bb9[_0xee5b('0x2c')][_0xee5b('0x34')](_0xee5b('0x35'))){_0x2aee25[_0xee5b('0x1b')]=qs['limit'](_0x5d3bb9[_0xee5b('0x2c')][_0xee5b('0x1b')]);_0x2aee25[_0xee5b('0x1d')]=qs[_0xee5b('0x1d')](_0x5d3bb9[_0xee5b('0x2c')][_0xee5b('0x1d')]);}_0x2aee25[_0xee5b('0x36')]=qs['sort'](_0x5d3bb9[_0xee5b('0x2c')][_0xee5b('0x37')]);_0x2aee25[_0xee5b('0x38')]=qs[_0xee5b('0x2e')](_[_0xee5b('0x39')](_0x5d3bb9['query'],_0x2efea5['filters']),_0x2cab3b);if(_0x5d3bb9[_0xee5b('0x2c')][_0xee5b('0x3a')]){_0x2aee25[_0xee5b('0x38')]=_[_0xee5b('0x3b')](_0x2aee25[_0xee5b('0x38')],{'$or':_['map'](_0x2cab3b,function(_0x25f915){if(_0x25f915[_0xee5b('0x3c')]!==_0xee5b('0x3d')){var _0x460f9b={};_0x460f9b[_0x25f915[_0xee5b('0x26')]]={'$like':'%'+_0x5d3bb9[_0xee5b('0x2c')][_0xee5b('0x3a')]+'%'};return _0x460f9b;}})});}_0x2aee25=_[_0xee5b('0x3b')]({},_0x2aee25,_0x5d3bb9['options']);var _0x3d81a1={'where':_0x2aee25[_0xee5b('0x38')]};return db['OpenchannelApplication'][_0xee5b('0x1c')](_0x3d81a1)[_0xee5b('0x3e')](function(_0x29cbb0){_0x40b1f8['count']=_0x29cbb0;if(_0x5d3bb9['query'][_0xee5b('0x3f')]){_0x2aee25[_0xee5b('0x40')]=[{'all':!![]}];}return db[_0xee5b('0x29')]['findAll'](_0x2aee25);})[_0xee5b('0x3e')](function(_0xc1d51a){_0x40b1f8[_0xee5b('0x41')]=_0xc1d51a;return _0x40b1f8;})[_0xee5b('0x3e')](respondWithFilteredResult(_0xb184d2,_0x2aee25))[_0xee5b('0x42')](handleError(_0xb184d2,null));};exports[_0xee5b('0x43')]=function(_0xf59ae7,_0x4ee59b){var _0x4a86ab={'raw':!![],'where':{'id':_0xf59ae7['params']['id']}},_0xaf5bdd={};_0xaf5bdd['model']=_[_0xee5b('0x2d')](db['OpenchannelApplication'][_0xee5b('0x44')]);_0xaf5bdd[_0xee5b('0x2c')]=_['keys'](_0xf59ae7[_0xee5b('0x2c')]);_0xaf5bdd[_0xee5b('0x2e')]=_['intersection'](_0xaf5bdd['model'],_0xaf5bdd[_0xee5b('0x2c')]);_0x4a86ab['attributes']=_[_0xee5b('0x2f')](_0xaf5bdd['model'],qs[_0xee5b('0x32')](_0xf59ae7[_0xee5b('0x2c')][_0xee5b('0x32')]));_0x4a86ab[_0xee5b('0x30')]=_0x4a86ab[_0xee5b('0x30')][_0xee5b('0x33')]?_0x4a86ab['attributes']:_0xaf5bdd['model'];if(_0xf59ae7[_0xee5b('0x2c')][_0xee5b('0x3f')]){_0x4a86ab[_0xee5b('0x40')]=[{'all':!![]}];}_0x4a86ab=_['merge']({},_0x4a86ab,_0xf59ae7[_0xee5b('0x45')]);return db[_0xee5b('0x29')][_0xee5b('0x46')](_0x4a86ab)[_0xee5b('0x3e')](handleEntityNotFound(_0x4ee59b,null))[_0xee5b('0x3e')](respondWithResult(_0x4ee59b,null))[_0xee5b('0x42')](handleError(_0x4ee59b,null));};exports[_0xee5b('0x47')]=function(_0x35200e,_0x10020d){return db[_0xee5b('0x29')][_0xee5b('0x47')](_0x35200e[_0xee5b('0x48')],{})['then'](respondWithResult(_0x10020d,0xc9))['catch'](handleError(_0x10020d,null));};exports[_0xee5b('0x21')]=function(_0x17c5c2,_0x2ad522){if(_0x17c5c2[_0xee5b('0x48')]['id']){delete _0x17c5c2[_0xee5b('0x48')]['id'];}return db['OpenchannelApplication'][_0xee5b('0x46')]({'where':{'id':_0x17c5c2[_0xee5b('0x49')]['id']}})[_0xee5b('0x3e')](handleEntityNotFound(_0x2ad522,null))[_0xee5b('0x3e')](saveUpdates(_0x17c5c2['body'],null))[_0xee5b('0x3e')](respondWithResult(_0x2ad522,null))[_0xee5b('0x42')](handleError(_0x2ad522,null));};exports['destroy']=function(_0x1d5e1a,_0x138d4f){return db[_0xee5b('0x29')][_0xee5b('0x46')]({'where':{'id':_0x1d5e1a[_0xee5b('0x49')]['id']}})['then'](handleEntityNotFound(_0x138d4f,null))[_0xee5b('0x3e')](removeEntity(_0x138d4f,null))[_0xee5b('0x42')](handleError(_0x138d4f,null));}; \ No newline at end of file +var _0x2fea=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','update','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','stack','name','send','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x52d82c,_0x2b885a){var _0x2ae485=function(_0x5f08ef){while(--_0x5f08ef){_0x52d82c['push'](_0x52d82c['shift']());}};_0x2ae485(++_0x2b885a);}(_0x2fea,0x1bc));var _0xa2fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2fea[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa2fe('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa2fe('0x1'));var BPromise=require(_0xa2fe('0x2'));var Mustache=require(_0xa2fe('0x3'));var util=require(_0xa2fe('0x4'));var path=require(_0xa2fe('0x5'));var sox=require(_0xa2fe('0x6'));var csv=require('to-csv');var ejs=require(_0xa2fe('0x7'));var fs=require('fs');var fs_extra=require(_0xa2fe('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa2fe('0x9'));var deskjs=require(_0xa2fe('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa2fe('0xb'));var Papa=require(_0xa2fe('0xc'));var Redis=require('ioredis');var authService=require(_0xa2fe('0xd'));var qs=require(_0xa2fe('0xe'));var as=require(_0xa2fe('0xf'));var hardwareService=require(_0xa2fe('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa2fe('0x11'));var licenseUtil=require(_0xa2fe('0x12'));var db=require(_0xa2fe('0x13'))['db'];function respondWithStatusCode(_0xa1f435,_0xdf353e){_0xdf353e=_0xdf353e||0xcc;return function(_0x124dbd){if(_0x124dbd){return _0xa1f435[_0xa2fe('0x14')](_0xdf353e);}return _0xa1f435[_0xa2fe('0x15')](_0xdf353e)[_0xa2fe('0x16')]();};}function respondWithResult(_0x1143f4,_0x225c45){_0x225c45=_0x225c45||0xc8;return function(_0x53eda3){if(_0x53eda3){return _0x1143f4[_0xa2fe('0x15')](_0x225c45)[_0xa2fe('0x17')](_0x53eda3);}};}function respondWithFilteredResult(_0x43c3aa,_0x424735){return function(_0x3afc32){if(_0x3afc32){var _0x35bd4f=typeof _0x424735[_0xa2fe('0x18')]===_0xa2fe('0x19')&&typeof _0x424735[_0xa2fe('0x1a')]===_0xa2fe('0x19');var _0x56bc63=_0x3afc32['count'];var _0x5abb93=_0x35bd4f?0x0:_0x424735[_0xa2fe('0x18')];var _0x3aa9bd=_0x35bd4f?_0x3afc32[_0xa2fe('0x1b')]:_0x424735[_0xa2fe('0x18')]+_0x424735[_0xa2fe('0x1a')];var _0x50aa06;if(_0x3aa9bd>=_0x56bc63){_0x3aa9bd=_0x56bc63;_0x50aa06=0xc8;}else{_0x50aa06=0xce;}_0x43c3aa[_0xa2fe('0x15')](_0x50aa06);return _0x43c3aa['set'](_0xa2fe('0x1c'),_0x5abb93+'-'+_0x3aa9bd+'/'+_0x56bc63)[_0xa2fe('0x17')](_0x3afc32);}return null;};}function patchUpdates(_0x23319e){return function(_0x1e8bf9){try{jsonpatch[_0xa2fe('0x1d')](_0x1e8bf9,_0x23319e,!![]);}catch(_0x524e86){return BPromise['reject'](_0x524e86);}return _0x1e8bf9[_0xa2fe('0x1e')]();};}function saveUpdates(_0x53d382,_0xde9739){return function(_0x96cff8){if(_0x96cff8){return _0x96cff8['update'](_0x53d382)[_0xa2fe('0x1f')](function(_0x5e01c2){return _0x5e01c2;});}return null;};}function removeEntity(_0x1486c2,_0x239c96){return function(_0x34a627){if(_0x34a627){return _0x34a627[_0xa2fe('0x20')]()[_0xa2fe('0x1f')](function(){_0x1486c2[_0xa2fe('0x15')](0xcc)[_0xa2fe('0x16')]();});}};}function handleEntityNotFound(_0x3e50b1,_0x1dafc2){return function(_0x3029fc){if(!_0x3029fc){_0x3e50b1[_0xa2fe('0x14')](0x194);}return _0x3029fc;};}function handleError(_0x3b28ff,_0x3f6882){_0x3f6882=_0x3f6882||0x1f4;return function(_0x1c7b55){logger['error'](_0x1c7b55[_0xa2fe('0x21')]);if(_0x1c7b55[_0xa2fe('0x22')]){delete _0x1c7b55[_0xa2fe('0x22')];}_0x3b28ff[_0xa2fe('0x15')](_0x3f6882)[_0xa2fe('0x23')](_0x1c7b55);};}exports['index']=function(_0x4b7c85,_0x49ef0a){var _0x485ba8={},_0x2dae0d={},_0x3345dd={'count':0x0,'rows':[]};var _0x2bb502=_[_0xa2fe('0x24')](db[_0xa2fe('0x25')]['rawAttributes'],function(_0x3d63e6){return{'name':_0x3d63e6[_0xa2fe('0x26')],'type':_0x3d63e6[_0xa2fe('0x27')][_0xa2fe('0x28')]};});_0x2dae0d[_0xa2fe('0x29')]=_[_0xa2fe('0x24')](_0x2bb502,'name');_0x2dae0d[_0xa2fe('0x2a')]=_[_0xa2fe('0x2b')](_0x4b7c85[_0xa2fe('0x2a')]);_0x2dae0d[_0xa2fe('0x2c')]=_[_0xa2fe('0x2d')](_0x2dae0d[_0xa2fe('0x29')],_0x2dae0d[_0xa2fe('0x2a')]);_0x485ba8[_0xa2fe('0x2e')]=_[_0xa2fe('0x2d')](_0x2dae0d[_0xa2fe('0x29')],qs[_0xa2fe('0x2f')](_0x4b7c85[_0xa2fe('0x2a')]['fields']));_0x485ba8[_0xa2fe('0x2e')]=_0x485ba8[_0xa2fe('0x2e')]['length']?_0x485ba8['attributes']:_0x2dae0d[_0xa2fe('0x29')];if(!_0x4b7c85[_0xa2fe('0x2a')][_0xa2fe('0x30')](_0xa2fe('0x31'))){_0x485ba8[_0xa2fe('0x1a')]=qs['limit'](_0x4b7c85[_0xa2fe('0x2a')][_0xa2fe('0x1a')]);_0x485ba8[_0xa2fe('0x18')]=qs[_0xa2fe('0x18')](_0x4b7c85[_0xa2fe('0x2a')]['offset']);}_0x485ba8[_0xa2fe('0x32')]=qs[_0xa2fe('0x33')](_0x4b7c85[_0xa2fe('0x2a')][_0xa2fe('0x33')]);_0x485ba8[_0xa2fe('0x34')]=qs[_0xa2fe('0x2c')](_[_0xa2fe('0x35')](_0x4b7c85[_0xa2fe('0x2a')],_0x2dae0d['filters']),_0x2bb502);if(_0x4b7c85[_0xa2fe('0x2a')][_0xa2fe('0x36')]){_0x485ba8[_0xa2fe('0x34')]=_['merge'](_0x485ba8[_0xa2fe('0x34')],{'$or':_[_0xa2fe('0x24')](_0x2bb502,function(_0x1460ac){if(_0x1460ac[_0xa2fe('0x27')]!==_0xa2fe('0x37')){var _0x53219b={};_0x53219b[_0x1460ac[_0xa2fe('0x22')]]={'$like':'%'+_0x4b7c85['query'][_0xa2fe('0x36')]+'%'};return _0x53219b;}})});}_0x485ba8=_[_0xa2fe('0x38')]({},_0x485ba8,_0x4b7c85[_0xa2fe('0x39')]);var _0x17aa35={'where':_0x485ba8[_0xa2fe('0x34')]};return db[_0xa2fe('0x25')][_0xa2fe('0x1b')](_0x17aa35)[_0xa2fe('0x1f')](function(_0x50d4b8){_0x3345dd[_0xa2fe('0x1b')]=_0x50d4b8;if(_0x4b7c85[_0xa2fe('0x2a')]['includeAll']){_0x485ba8[_0xa2fe('0x3a')]=[{'all':!![]}];}return db[_0xa2fe('0x25')]['findAll'](_0x485ba8);})[_0xa2fe('0x1f')](function(_0x376fe4){_0x3345dd[_0xa2fe('0x3b')]=_0x376fe4;return _0x3345dd;})[_0xa2fe('0x1f')](respondWithFilteredResult(_0x49ef0a,_0x485ba8))[_0xa2fe('0x3c')](handleError(_0x49ef0a,null));};exports[_0xa2fe('0x3d')]=function(_0x295cd6,_0x3139ef){var _0x22dfab={'raw':!![],'where':{'id':_0x295cd6[_0xa2fe('0x3e')]['id']}},_0x336602={};_0x336602[_0xa2fe('0x29')]=_[_0xa2fe('0x2b')](db[_0xa2fe('0x25')][_0xa2fe('0x3f')]);_0x336602['query']=_['keys'](_0x295cd6[_0xa2fe('0x2a')]);_0x336602[_0xa2fe('0x2c')]=_[_0xa2fe('0x2d')](_0x336602[_0xa2fe('0x29')],_0x336602['query']);_0x22dfab[_0xa2fe('0x2e')]=_[_0xa2fe('0x2d')](_0x336602[_0xa2fe('0x29')],qs[_0xa2fe('0x2f')](_0x295cd6[_0xa2fe('0x2a')]['fields']));_0x22dfab[_0xa2fe('0x2e')]=_0x22dfab[_0xa2fe('0x2e')][_0xa2fe('0x40')]?_0x22dfab[_0xa2fe('0x2e')]:_0x336602[_0xa2fe('0x29')];if(_0x295cd6[_0xa2fe('0x2a')][_0xa2fe('0x41')]){_0x22dfab[_0xa2fe('0x3a')]=[{'all':!![]}];}_0x22dfab=_['merge']({},_0x22dfab,_0x295cd6[_0xa2fe('0x39')]);return db[_0xa2fe('0x25')][_0xa2fe('0x42')](_0x22dfab)['then'](handleEntityNotFound(_0x3139ef,null))[_0xa2fe('0x1f')](respondWithResult(_0x3139ef,null))[_0xa2fe('0x3c')](handleError(_0x3139ef,null));};exports[_0xa2fe('0x43')]=function(_0x1d6df2,_0x220c3d){return db[_0xa2fe('0x25')]['create'](_0x1d6df2[_0xa2fe('0x44')],{})[_0xa2fe('0x1f')](respondWithResult(_0x220c3d,0xc9))[_0xa2fe('0x3c')](handleError(_0x220c3d,null));};exports[_0xa2fe('0x45')]=function(_0x638b51,_0x362a60){if(_0x638b51[_0xa2fe('0x44')]['id']){delete _0x638b51['body']['id'];}return db[_0xa2fe('0x25')][_0xa2fe('0x42')]({'where':{'id':_0x638b51['params']['id']}})[_0xa2fe('0x1f')](handleEntityNotFound(_0x362a60,null))['then'](saveUpdates(_0x638b51[_0xa2fe('0x44')],null))[_0xa2fe('0x1f')](respondWithResult(_0x362a60,null))['catch'](handleError(_0x362a60,null));};exports['destroy']=function(_0x55c757,_0x408935){return db[_0xa2fe('0x25')]['find']({'where':{'id':_0x55c757[_0xa2fe('0x3e')]['id']}})[_0xa2fe('0x1f')](handleEntityNotFound(_0x408935,null))['then'](removeEntity(_0x408935,null))['catch'](handleError(_0x408935,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3ed5830..5b2fc77 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 _0x3347=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x3347,0x8b));var _0x7334=function(_0x5860b9,_0x4bf239){_0x5860b9=_0x5860b9-0x0;var _0x275f07=_0x3347[_0x5860b9];return _0x275f07;};'use strict';var _=require(_0x7334('0x0'));var util=require(_0x7334('0x1'));var logger=require('../../config/logger')(_0x7334('0x2'));var moment=require('moment');var BPromise=require(_0x7334('0x3'));var rp=require(_0x7334('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7334('0x5'));var attributes=require(_0x7334('0x6'));module[_0x7334('0x7')]=function(_0x216a47,_0x3bbc15){return _0x216a47[_0x7334('0x8')](_0x7334('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7334('0xa'),'collate':_0x7334('0xb')});}; \ No newline at end of file +var _0x241d=['openchannel_applications','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication'];(function(_0x2a9477,_0x572e3c){var _0x399248=function(_0x351329){while(--_0x351329){_0x2a9477['push'](_0x2a9477['shift']());}};_0x399248(++_0x572e3c);}(_0x241d,0xd4));var _0xd241=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x241d[_0x34bc30];return _0x5706de;};'use strict';var _=require('lodash');var util=require(_0xd241('0x0'));var logger=require(_0xd241('0x1'))(_0xd241('0x2'));var moment=require(_0xd241('0x3'));var BPromise=require('bluebird');var rp=require(_0xd241('0x4'));var fs=require('fs');var path=require(_0xd241('0x5'));var rimraf=require(_0xd241('0x6'));var config=require(_0xd241('0x7'));var attributes=require(_0xd241('0x8'));module[_0xd241('0x9')]=function(_0x31f334,_0x49a631){return _0x31f334[_0xd241('0xa')](_0xd241('0xb'),attributes,{'tableName':_0xd241('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd241('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7d0bfe8..0606d44 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 _0xf9f8=['debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateOpenchannelApplication','update','body','options','raw','where','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x326030,_0x4df3f1){var _0x51daea=function(_0x5c6c05){while(--_0x5c6c05){_0x326030['push'](_0x326030['shift']());}};_0x51daea(++_0x4df3f1);}(_0xf9f8,0x124));var _0x8f9f=function(_0x332a02,_0x2fc843){_0x332a02=_0x332a02-0x0;var _0x206440=_0xf9f8[_0x332a02];return _0x206440;};'use strict';var _=require(_0x8f9f('0x0'));var util=require(_0x8f9f('0x1'));var moment=require(_0x8f9f('0x2'));var BPromise=require(_0x8f9f('0x3'));var rs=require(_0x8f9f('0x4'));var fs=require('fs');var Redis=require(_0x8f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f9f('0x6'));var logger=require(_0x8f9f('0x7'))(_0x8f9f('0x8'));var config=require(_0x8f9f('0x9'));var jayson=require(_0x8f9f('0xa'));var client=jayson[_0x8f9f('0xb')][_0x8f9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc7fedb,_0x3c934f,_0x3c62d5){return new BPromise(function(_0x33cada,_0x4df1da){return client[_0x8f9f('0xd')](_0xc7fedb,_0x3c62d5)[_0x8f9f('0xe')](function(_0x3b7fe4){logger[_0x8f9f('0xf')](_0x8f9f('0x10'),_0x3c934f,_0x8f9f('0x11'));logger[_0x8f9f('0x12')](_0x8f9f('0x13'),_0x3c934f,_0x8f9f('0x11'),JSON['stringify'](_0x3b7fe4));if(_0x3b7fe4[_0x8f9f('0x14')]){if(_0x3b7fe4[_0x8f9f('0x14')]['code']===0x1f4){logger[_0x8f9f('0x14')](_0x8f9f('0x10'),_0x3c934f,_0x3b7fe4['error'][_0x8f9f('0x15')]);return _0x4df1da(_0x3b7fe4[_0x8f9f('0x14')][_0x8f9f('0x15')]);}logger[_0x8f9f('0x14')](_0x8f9f('0x10'),_0x3c934f,_0x3b7fe4['error'][_0x8f9f('0x15')]);return _0x33cada(_0x3b7fe4[_0x8f9f('0x14')][_0x8f9f('0x15')]);}else{logger[_0x8f9f('0xf')](_0x8f9f('0x10'),_0x3c934f,'request\x20sent');_0x33cada(_0x3b7fe4['result'][_0x8f9f('0x15')]);}})[_0x8f9f('0x16')](function(_0xebbe24){logger[_0x8f9f('0x14')](_0x8f9f('0x10'),_0x3c934f,_0xebbe24);_0x4df1da(_0xebbe24);});});}exports[_0x8f9f('0x17')]=function(_0x80dad0){var _0x538372=this;return new Promise(function(_0x248807,_0xdb750f){return db['OpenchannelApplication'][_0x8f9f('0x18')](_0x80dad0[_0x8f9f('0x19')],{'raw':_0x80dad0[_0x8f9f('0x1a')]?_0x80dad0[_0x8f9f('0x1a')][_0x8f9f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x80dad0[_0x8f9f('0x1a')]?_0x80dad0[_0x8f9f('0x1a')][_0x8f9f('0x1c')]||null:null,'attributes':_0x80dad0[_0x8f9f('0x1a')]?_0x80dad0[_0x8f9f('0x1a')]['attributes']||null:null,'limit':_0x80dad0['options']?_0x80dad0[_0x8f9f('0x1a')][_0x8f9f('0x1d')]||null:null})[_0x8f9f('0xe')](function(_0x25f0d7){logger[_0x8f9f('0xf')](_0x8f9f('0x17'),_0x80dad0);logger[_0x8f9f('0x12')](_0x8f9f('0x17'),_0x80dad0,JSON[_0x8f9f('0x1e')](_0x25f0d7));_0x248807(_0x25f0d7);})[_0x8f9f('0x16')](function(_0xd849d){logger[_0x8f9f('0x14')](_0x8f9f('0x17'),_0xd849d['message'],_0x80dad0);_0xdb750f(_0x538372['error'](0x1f4,_0xd849d[_0x8f9f('0x15')]));});});}; \ No newline at end of file +var _0xd5d8=['request\x20sent','stringify','error','code','message','result','catch','OpenchannelApplication','update','options','where','attributes','UpdateOpenchannelApplication','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x21e38c,_0x3df0b0){var _0x36d5db=function(_0x45cf4d){while(--_0x45cf4d){_0x21e38c['push'](_0x21e38c['shift']());}};_0x36d5db(++_0x3df0b0);}(_0xd5d8,0x195));var _0x8d5d=function(_0x32dc06,_0x511eba){_0x32dc06=_0x32dc06-0x0;var _0x1c211c=_0xd5d8[_0x32dc06];return _0x1c211c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8d5d('0x0'));var rs=require(_0x8d5d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d5d('0x2'))['db'];var utils=require(_0x8d5d('0x3'));var logger=require(_0x8d5d('0x4'))(_0x8d5d('0x5'));var config=require(_0x8d5d('0x6'));var jayson=require(_0x8d5d('0x7'));var client=jayson[_0x8d5d('0x8')][_0x8d5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x546c94,_0x91f638,_0x5b8264){return new BPromise(function(_0x2c5c3e,_0x32ca8c){return client['request'](_0x546c94,_0x5b8264)[_0x8d5d('0xa')](function(_0x3282a6){logger[_0x8d5d('0xb')](_0x8d5d('0xc'),_0x91f638,'request\x20sent');logger[_0x8d5d('0xd')](_0x8d5d('0xe'),_0x91f638,_0x8d5d('0xf'),JSON[_0x8d5d('0x10')](_0x3282a6));if(_0x3282a6[_0x8d5d('0x11')]){if(_0x3282a6[_0x8d5d('0x11')][_0x8d5d('0x12')]===0x1f4){logger[_0x8d5d('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x91f638,_0x3282a6[_0x8d5d('0x11')][_0x8d5d('0x13')]);return _0x32ca8c(_0x3282a6[_0x8d5d('0x11')]['message']);}logger[_0x8d5d('0x11')](_0x8d5d('0xc'),_0x91f638,_0x3282a6[_0x8d5d('0x11')][_0x8d5d('0x13')]);return _0x2c5c3e(_0x3282a6[_0x8d5d('0x11')]['message']);}else{logger[_0x8d5d('0xb')](_0x8d5d('0xc'),_0x91f638,_0x8d5d('0xf'));_0x2c5c3e(_0x3282a6[_0x8d5d('0x14')]['message']);}})[_0x8d5d('0x15')](function(_0x148c7){logger['error'](_0x8d5d('0xc'),_0x91f638,_0x148c7);_0x32ca8c(_0x148c7);});});}exports['UpdateOpenchannelApplication']=function(_0x23db9e){var _0x1cde8b=this;return new Promise(function(_0x6fb9a1,_0x224b6c){return db[_0x8d5d('0x16')][_0x8d5d('0x17')](_0x23db9e['body'],{'raw':_0x23db9e[_0x8d5d('0x18')]?_0x23db9e[_0x8d5d('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23db9e[_0x8d5d('0x18')]?_0x23db9e[_0x8d5d('0x18')][_0x8d5d('0x19')]||null:null,'attributes':_0x23db9e[_0x8d5d('0x18')]?_0x23db9e['options'][_0x8d5d('0x1a')]||null:null,'limit':_0x23db9e['options']?_0x23db9e[_0x8d5d('0x18')]['limit']||null:null})[_0x8d5d('0xa')](function(_0x164123){logger[_0x8d5d('0xb')](_0x8d5d('0x1b'),_0x23db9e);logger['debug'](_0x8d5d('0x1b'),_0x23db9e,JSON[_0x8d5d('0x10')](_0x164123));_0x6fb9a1(_0x164123);})['catch'](function(_0x374461){logger[_0x8d5d('0x11')]('UpdateOpenchannelApplication',_0x374461[_0x8d5d('0x13')],_0x23db9e);_0x224b6c(_0x1cde8b[_0x8d5d('0x11')](0x1f4,_0x374461[_0x8d5d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index dfda9ee..4bed35c 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 _0xd8ed=['exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','addTags','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags'];(function(_0xe9d0d0,_0xf8a75a){var _0x1f08a3=function(_0x402862){while(--_0x402862){_0xe9d0d0['push'](_0xe9d0d0['shift']());}};_0x1f08a3(++_0xf8a75a);}(_0xd8ed,0x175));var _0xdd8e=function(_0x1c8e77,_0x58d143){_0x1c8e77=_0x1c8e77-0x0;var _0xb8ef7=_0xd8ed[_0x1c8e77];return _0xb8ef7;};'use strict';var multer=require(_0xdd8e('0x0'));var util=require(_0xdd8e('0x1'));var path=require('path');var timeout=require(_0xdd8e('0x2'));var express=require(_0xdd8e('0x3'));var router=express['Router']();var fs_extra=require(_0xdd8e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdd8e('0x5'));var controller=require(_0xdd8e('0x6'));router[_0xdd8e('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd8e('0x8')]);router[_0xdd8e('0x7')](_0xdd8e('0x9'),auth[_0xdd8e('0xa')](),controller[_0xdd8e('0xb')]);router[_0xdd8e('0x7')](_0xdd8e('0xc'),auth[_0xdd8e('0xa')](),controller[_0xdd8e('0xd')]);router['get']('/:id/messages',auth[_0xdd8e('0xa')](),controller[_0xdd8e('0xe')]);router[_0xdd8e('0x7')]('/:id/download',auth[_0xdd8e('0xa')](),controller[_0xdd8e('0xf')]);router[_0xdd8e('0x10')]('/',auth[_0xdd8e('0xa')](),controller[_0xdd8e('0x11')]);router[_0xdd8e('0x10')](_0xdd8e('0x12'),auth['isAuthenticated'](),controller[_0xdd8e('0x13')]);router['post'](_0xdd8e('0x14'),auth['isAuthenticated'](),interaction[_0xdd8e('0x15')]('openchannel','openchannelinteraction:addtags'),controller[_0xdd8e('0x16')]);router['put'](_0xdd8e('0xc'),auth[_0xdd8e('0xa')](),interaction[_0xdd8e('0x15')](_0xdd8e('0x17'),_0xdd8e('0x18')),controller[_0xdd8e('0x19')]);router[_0xdd8e('0x1a')](_0xdd8e('0xc'),auth[_0xdd8e('0xa')](),interaction[_0xdd8e('0x15')]('openchannel',_0xdd8e('0x1b')),controller[_0xdd8e('0x1c')]);router[_0xdd8e('0x1a')](_0xdd8e('0x14'),auth[_0xdd8e('0xa')](),controller[_0xdd8e('0x1d')]);module[_0xdd8e('0x1e')]=router; \ No newline at end of file +var _0x7aad=['openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put'];(function(_0x5411cb,_0x1cd69d){var _0x32727a=function(_0x22a762){while(--_0x22a762){_0x5411cb['push'](_0x5411cb['shift']());}};_0x32727a(++_0x1cd69d);}(_0x7aad,0xe6));var _0xd7aa=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x7aad[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xd7aa('0x0'));var util=require(_0xd7aa('0x1'));var path=require(_0xd7aa('0x2'));var timeout=require(_0xd7aa('0x3'));var express=require('express');var router=express[_0xd7aa('0x4')]();var fs_extra=require(_0xd7aa('0x5'));var auth=require(_0xd7aa('0x6'));var interaction=require(_0xd7aa('0x7'));var config=require('../../config/environment');var controller=require(_0xd7aa('0x8'));router[_0xd7aa('0x9')]('/',auth[_0xd7aa('0xa')](),controller[_0xd7aa('0xb')]);router[_0xd7aa('0x9')](_0xd7aa('0xc'),auth[_0xd7aa('0xa')](),controller['describe']);router[_0xd7aa('0x9')](_0xd7aa('0xd'),auth[_0xd7aa('0xa')](),controller[_0xd7aa('0xe')]);router['get'](_0xd7aa('0xf'),auth[_0xd7aa('0xa')](),controller['getMessages']);router[_0xd7aa('0x9')](_0xd7aa('0x10'),auth[_0xd7aa('0xa')](),controller['download']);router['post']('/',auth[_0xd7aa('0xa')](),controller[_0xd7aa('0x11')]);router[_0xd7aa('0x12')]('/:id/messages',auth[_0xd7aa('0xa')](),controller[_0xd7aa('0x13')]);router[_0xd7aa('0x12')](_0xd7aa('0x14'),auth['isAuthenticated'](),interaction[_0xd7aa('0x15')](_0xd7aa('0x16'),_0xd7aa('0x17')),controller[_0xd7aa('0x18')]);router[_0xd7aa('0x19')](_0xd7aa('0xd'),auth[_0xd7aa('0xa')](),interaction['tracked'](_0xd7aa('0x16'),_0xd7aa('0x1a')),controller[_0xd7aa('0x1b')]);router[_0xd7aa('0x1c')](_0xd7aa('0xd'),auth[_0xd7aa('0xa')](),interaction[_0xd7aa('0x15')](_0xd7aa('0x16'),_0xd7aa('0x1d')),controller[_0xd7aa('0x1e')]);router['delete'](_0xd7aa('0x14'),auth['isAuthenticated'](),controller[_0xd7aa('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index a133c8c..e26298e 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 _0xc978=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x1f9179,_0x598964){var _0x2974c9=function(_0x52443b){while(--_0x52443b){_0x1f9179['push'](_0x1f9179['shift']());}};_0x2974c9(++_0x598964);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8c97('0x0'));module[_0x8c97('0x1')]={'closed':{'type':Sequelize[_0x8c97('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8c97('0x3')]},'disposition':{'type':Sequelize[_0x8c97('0x4')]},'secondDisposition':{'type':Sequelize[_0x8c97('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8c97('0x4')]},'read1stAt':{'type':Sequelize[_0x8c97('0x3')]},'threadId':{'type':Sequelize[_0x8c97('0x4')]},'externalUrl':{'type':Sequelize[_0x8c97('0x4')]},'lastMsgAt':{'type':Sequelize[_0x8c97('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8c97('0x5')]('in',_0x8c97('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x8c97('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5977=['ENUM','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5977,0xeb));var _0x7597=function(_0xed12ef,_0x385546){_0xed12ef=_0xed12ef-0x0;var _0x494ffd=_0x5977[_0xed12ef];return _0x494ffd;};'use strict';var Sequelize=require(_0x7597('0x0'));module[_0x7597('0x1')]={'closed':{'type':Sequelize[_0x7597('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7597('0x3')]},'secondDisposition':{'type':Sequelize[_0x7597('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7597('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x7597('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x7597('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7597('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d1b9790..911e5a3 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 _0xa9fd=['SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','i.OpenchannelAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','i.*','c.firstName','Contact.firstName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','show','params','filters','include','create','update','describe','addMessage','OpenchannelMessage','ids','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','rows','addTags','setTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','Attachment','Messages','secret','OpenchannelAccount','get','Account','Owner','N.A.','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','System','Contact','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','Users','fullname','Tags','TagIds','split','forEach','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','select','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','start','keys','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','tag','filter','replace','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes'];(function(_0x5623da,_0x5e8067){var _0x1f413e=function(_0x26a487){while(--_0x26a487){_0x5623da['push'](_0x5623da['shift']());}};_0x1f413e(++_0x5e8067);}(_0xa9fd,0x64));var _0xda9f=function(_0x564036,_0x3facd1){_0x564036=_0x564036-0x0;var _0x599b23=_0xa9fd[_0x564036];return _0x599b23;};'use strict';var emlformat=require(_0xda9f('0x0'));var rimraf=require(_0xda9f('0x1'));var zipdir=require(_0xda9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda9f('0x3'));var moment=require(_0xda9f('0x4'));var BPromise=require(_0xda9f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xda9f('0x6'));var sox=require(_0xda9f('0x7'));var csv=require(_0xda9f('0x8'));var ejs=require(_0xda9f('0x9'));var fs=require('fs');var fs_extra=require(_0xda9f('0xa'));var _=require(_0xda9f('0xb'));var squel=require(_0xda9f('0xc'));var crypto=require(_0xda9f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xda9f('0xe'));var toCsv=require(_0xda9f('0x8'));var querystring=require(_0xda9f('0xf'));var Papa=require(_0xda9f('0x10'));var Redis=require(_0xda9f('0x11'));var authService=require(_0xda9f('0x12'));var qs=require(_0xda9f('0x13'));var as=require(_0xda9f('0x14'));var pdf=require(_0xda9f('0x15'));var hardwareService=require(_0xda9f('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xda9f('0x17'));var config=require(_0xda9f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xda9f('0x19'))['db'];config[_0xda9f('0x1a')]=_[_0xda9f('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xda9f('0x1c'))(new Redis(config['redis']));require(_0xda9f('0x1d'))[_0xda9f('0x1e')](socket);function respondWithStatusCode(_0x1c1482,_0x525994){_0x525994=_0x525994||0xcc;return function(_0x300e30){if(_0x300e30){return _0x1c1482[_0xda9f('0x1f')](_0x525994);}return _0x1c1482[_0xda9f('0x20')](_0x525994)[_0xda9f('0x21')]();};}function respondWithResult(_0x2c5bbb,_0x1d23b5){_0x1d23b5=_0x1d23b5||0xc8;return function(_0x1b0895){if(_0x1b0895){return _0x2c5bbb[_0xda9f('0x20')](_0x1d23b5)['json'](_0x1b0895);}};}function respondWithFilteredResult(_0x10bfd5,_0x7c4f5d){return function(_0x2e232b){if(_0x2e232b){var _0x84c96c=typeof _0x7c4f5d['offset']===_0xda9f('0x22')&&typeof _0x7c4f5d[_0xda9f('0x23')]==='undefined';var _0x5725cd=_0x2e232b[_0xda9f('0x24')];var _0x13e1a7=_0x84c96c?0x0:_0x7c4f5d['offset'];var _0x3f5bbf=_0x84c96c?_0x2e232b[_0xda9f('0x24')]:_0x7c4f5d[_0xda9f('0x25')]+_0x7c4f5d[_0xda9f('0x23')];var _0x31ee93;if(_0x3f5bbf>=_0x5725cd){_0x3f5bbf=_0x5725cd;_0x31ee93=0xc8;}else{_0x31ee93=0xce;}_0x10bfd5[_0xda9f('0x20')](_0x31ee93);return _0x10bfd5[_0xda9f('0x26')](_0xda9f('0x27'),_0x13e1a7+'-'+_0x3f5bbf+'/'+_0x5725cd)['json'](_0x2e232b);}return null;};}function patchUpdates(_0xa6958a){return function(_0xe6107e){try{jsonpatch[_0xda9f('0x28')](_0xe6107e,_0xa6958a,!![]);}catch(_0x11e511){return BPromise['reject'](_0x11e511);}return _0xe6107e[_0xda9f('0x29')]();};}function saveUpdates(_0x2a7f06,_0x51a978){return function(_0x3436ac){if(_0x3436ac){return _0x3436ac['update'](_0x2a7f06)[_0xda9f('0x2a')](function(_0x48997c){return _0x48997c;});}return null;};}function removeEntity(_0x4a545c,_0x2221e7){return function(_0x17a9bd){if(_0x17a9bd){return _0x17a9bd[_0xda9f('0x2b')]()[_0xda9f('0x2a')](function(){_0x4a545c[_0xda9f('0x20')](0xcc)[_0xda9f('0x21')]();});}};}function handleEntityNotFound(_0x388d08,_0x4e3d14){return function(_0x41001e){if(!_0x41001e){_0x388d08[_0xda9f('0x1f')](0x194);}return _0x41001e;};}function handleError(_0x1ad78e,_0xc13e5a){_0xc13e5a=_0xc13e5a||0x1f4;return function(_0x26f6b6){logger[_0xda9f('0x2c')](_0x26f6b6[_0xda9f('0x2d')]);if(_0x26f6b6[_0xda9f('0x2e')]){delete _0x26f6b6[_0xda9f('0x2e')];}_0x1ad78e[_0xda9f('0x20')](_0xc13e5a)['send'](_0x26f6b6);};}function getInteractionUsers(_0x30f787,_0x7d1956){return new BPromise(function(_0x3c0729,_0x243ebc){try{if(_0x7d1956[_0x30f787['id']]){_0x30f787[_0xda9f('0x2f')]=_['map'](_0x7d1956[_0x30f787['id']],function(_0x59d1be){return{'id':_0x59d1be['id'],'fullname':_0x59d1be[_0xda9f('0x30')]};});}}catch(_0x42041b){_0x243ebc(_0x42041b);}_0x3c0729(_0x30f787);});}function getInteractionTags(_0x554d4e,_0x10f6b0){return new BPromise(function(_0x3b93b8,_0x5dffc2){try{if(_0x554d4e['TagIds']){_0x554d4e[_0xda9f('0x31')]=[];_0x554d4e[_0xda9f('0x32')][_0xda9f('0x33')](',')[_0xda9f('0x34')](function(_0x5ed448){_0x554d4e['Tags']['push'](_0x10f6b0[_0x5ed448]);});}delete _0x554d4e['TagIds'];}catch(_0x3fbbf2){_0x5dffc2(_0x3fbbf2);}_0x3b93b8(_0x554d4e);});}function updateOpenchannelInteraction(_0x13d24a,_0x11d15f,_0x4f05f4){return new BPromise(function(_0x212a7c,_0xc48ee7){return getInteractionUsers(_0x13d24a,_0x4f05f4)[_0xda9f('0x2a')](function(_0x29af21){return getInteractionTags(_0x29af21,_0x11d15f);})[_0xda9f('0x2a')](function(_0xbc2680){_0x212a7c(_0xbc2680);})[_0xda9f('0x35')](function(_0x1be8cc){_0xc48ee7(_0x1be8cc);});});}exports[_0xda9f('0x36')]=function(_0x210e5a,_0x2b6c24){var _0x1427ff={},_0x4e4bca={},_0x262292={'count':0x0,'rows':[]};var _0x2ef269=_['map'](db[_0xda9f('0x37')][_0xda9f('0x38')],function(_0xdc6d2){return{'name':_0xdc6d2[_0xda9f('0x39')],'type':_0xdc6d2[_0xda9f('0x3a')][_0xda9f('0x3b')]};});_0x4e4bca[_0xda9f('0x3c')]=_[_0xda9f('0x3d')](_0x2ef269,_0xda9f('0x2e'));_0x4e4bca[_0xda9f('0x3e')]=_['keys'](_0x210e5a[_0xda9f('0x3e')]);_0x4e4bca['filters']=_['intersection'](_0x4e4bca[_0xda9f('0x3c')],_0x4e4bca['query']);_0x1427ff[_0xda9f('0x3f')]=_[_0xda9f('0x40')](_0x4e4bca[_0xda9f('0x3c')],qs[_0xda9f('0x41')](_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x41')]));_0x1427ff[_0xda9f('0x3f')]=_0x1427ff[_0xda9f('0x3f')][_0xda9f('0x42')]?_0x1427ff[_0xda9f('0x3f')]:_0x4e4bca[_0xda9f('0x3c')];if(!_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x43')](_0xda9f('0x44'))){_0x1427ff[_0xda9f('0x23')]=qs['limit'](_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x23')]);_0x1427ff[_0xda9f('0x25')]=qs[_0xda9f('0x25')](_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x25')]);}_0x1427ff[_0xda9f('0x45')]=qs[_0xda9f('0x46')](_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x46')]);_0x1427ff[_0xda9f('0x47')]=qs['filters'](_[_0xda9f('0x48')](_0x210e5a['query'],_0x4e4bca['filters']),_0x2ef269);var _0x14bb74=[];var _0x44b062=squel['select']()[_0xda9f('0x49')]('id')['field'](_0xda9f('0x2e'))[_0xda9f('0x49')](_0xda9f('0x4a'))[_0xda9f('0x4b')](_0xda9f('0x4c'));var _0x1ab99f=squel['select']()['field'](_0xda9f('0x4d'))[_0xda9f('0x49')](_0xda9f('0x4e'))[_0xda9f('0x49')](_0xda9f('0x4f'))['from'](_0xda9f('0x50'),'ui')['left_join'](_0xda9f('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x235a91=squel[_0xda9f('0x52')]()[_0xda9f('0x4b')](_0xda9f('0x53'),'i')[_0xda9f('0x54')](_0xda9f('0x55'),'c',_0xda9f('0x56'))[_0xda9f('0x54')]('users','o','o.id\x20=\x20i.UserId')[_0xda9f('0x54')](_0xda9f('0x57'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0xda9f('0x58'),'me',_0xda9f('0x59'))[_0xda9f('0x54')](_0xda9f('0x5a'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xda9f('0x54')]('tools_tags','t',_0xda9f('0x5b'));var _0x14adfc=squel[_0xda9f('0x5c')]();var _0x1f1899=[];var _0x564ab2=squel[_0xda9f('0x5c')]();var _0x452868;if(_0x210e5a[_0xda9f('0x3e')]['search']){_0x452868=as[_0xda9f('0x5d')](_0x210e5a[_0xda9f('0x3e')]['search']);var _0x2d60a3=_0x452868[_0xda9f('0x5e')];for(var _0x5ee7e4=0x0;_0x5ee7e4<_0x452868[_0xda9f('0x5f')][_0xda9f('0x42')];_0x5ee7e4++){var _0x3f1a31=_0x452868[_0xda9f('0x5f')][_0x5ee7e4];var _0x3c5716='i';var _0x276ce3=_[_0xda9f('0x60')](_0x2ef269,[_0xda9f('0x2e'),_0x3f1a31[_0xda9f('0x49')]]);if(!_0x276ce3){switch(_0x3f1a31[_0xda9f('0x49')]){case _0xda9f('0x61'):if(_0x3f1a31[_0xda9f('0x62')]==0x1){_0x235a91[_0xda9f('0x63')]('`'+_0x3f1a31[_0xda9f('0x49')]+_0xda9f('0x64'));}else{_0x235a91[_0xda9f('0x63')]('`'+_0x3f1a31[_0xda9f('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0x3f1a31[_0xda9f('0x65')]===_0xda9f('0x66')){if(_0x3f1a31[_0xda9f('0x62')][_0xda9f('0x33')]('\x20')[_0xda9f('0x42')]>0x1){_0x14adfc[_0x2d60a3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xda9f('0x67')](_0x3f1a31['value']),null);}else{var _0x5d999f='%'+_0x3f1a31[_0xda9f('0x62')]+'%';_0x14adfc[_0x2d60a3](_0xda9f('0x68'),_0x5d999f,_0x5d999f,_0x5d999f);}}else{_0x276ce3=_[_0xda9f('0x60')](_0x2ef269,[_0xda9f('0x2e'),_0xda9f('0x69')]);_0x3f1a31[_0xda9f('0x49')]='ContactId';_0x22a40a=as['buildExpression'](_0x3c5716,_0x276ce3[_0xda9f('0x3a')],_0x3f1a31);_0x14adfc[_0x2d60a3](_0x22a40a[_0xda9f('0x6a')],_0x22a40a['value']['start'],_0x22a40a['value'][_0xda9f('0x21')]);}break;case _0xda9f('0x6b'):var _0x4e3064=_0x3f1a31[_0xda9f('0x62')][_0xda9f('0x33')](',')[_0xda9f('0x3d')](function(_0x468c5b){return Number(_0x468c5b);});_0x4e3064['forEach'](function(_0x590fbe){_0x564ab2['or'](_0xda9f('0x6c'),'%,'+_0x590fbe+',%');});_0x1f1899=_[_0xda9f('0x6d')](_0x1f1899,_0x4e3064);break;case'User':if(_0x3f1a31['operator']===_0xda9f('0x66')){_0x14adfc[_0x2d60a3](_0xda9f('0x6e'),'%'+_0x3f1a31[_0xda9f('0x62')]+'%',null);}else{_0x276ce3=_[_0xda9f('0x60')](_0x2ef269,[_0xda9f('0x2e'),_0xda9f('0x6f')]);_0x3f1a31['field']=_0xda9f('0x6f');_0x22a40a=as[_0xda9f('0x70')](_0x3c5716,_0x276ce3[_0xda9f('0x3a')],_0x3f1a31);_0x14adfc[_0x2d60a3](_0x22a40a[_0xda9f('0x6a')],_0x22a40a['value']['start'],_0x22a40a[_0xda9f('0x62')][_0xda9f('0x21')]);}break;case _0xda9f('0x71'):_0x22a40a=as[_0xda9f('0x70')]('me',null,_0x3f1a31);_0x14adfc[_0x2d60a3](_0x22a40a[_0xda9f('0x6a')],_0x22a40a[_0xda9f('0x62')][_0xda9f('0x72')],_0x22a40a[_0xda9f('0x62')][_0xda9f('0x21')]);break;}}else{var _0x22a40a=as[_0xda9f('0x70')](_0x3c5716,_0x276ce3[_0xda9f('0x3a')],_0x3f1a31);_0x14adfc[_0x2d60a3](_0x22a40a[_0xda9f('0x6a')],_0x22a40a['value'][_0xda9f('0x72')],_0x22a40a[_0xda9f('0x62')][_0xda9f('0x21')]);}}}else{var _0x181dad=_(_0x210e5a[_0xda9f('0x3e')])[_0xda9f('0x73')]()[_0xda9f('0x3d')](function(_0x100286){return _[_0xda9f('0x74')](_0x2ef269,[_0xda9f('0x2e'),_0x100286])?_0x100286:undefined;})[_0xda9f('0x75')]()[_0xda9f('0x62')]();if(!_[_0xda9f('0x76')](_0x181dad)){_0x181dad['forEach'](function(_0x15f35a){if(_0x15f35a===_0xda9f('0x77')){_0x235a91['where'](_0xda9f('0x78'),[]['concat'](_0x210e5a['query'][_0x15f35a]));}else if(_0x15f35a===_0xda9f('0x79')){var _0x2082f0=JSON[_0xda9f('0x7a')](_0x210e5a[_0xda9f('0x3e')][_0x15f35a])[_0xda9f('0x7b')];var _0x2ae17b=JSON[_0xda9f('0x7a')](_0x210e5a[_0xda9f('0x3e')][_0x15f35a])['$lte'];_0x235a91[_0xda9f('0x47')](_0xda9f('0x7c'),_0x2082f0,_0x2ae17b);}else{if(_0x210e5a[_0xda9f('0x3e')][_0x15f35a]===_0xda9f('0x7d')){_0x235a91[_0xda9f('0x47')]('i.'+_0x15f35a+'\x20IS\x20NULL');}else{_0x235a91[_0xda9f('0x47')]('i.'+_0x15f35a+'\x20=\x20?',_0x210e5a[_0xda9f('0x3e')][_0x15f35a]);}}});}if(_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x7e')]){if(_0x210e5a[_0xda9f('0x3e')]['read']==0x1){_0x235a91[_0xda9f('0x63')](_0xda9f('0x7f'));}else{_0x235a91[_0xda9f('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x210e5a['query'][_0xda9f('0x80')]){_0x1f1899=_['isArray'](_0x210e5a['query'][_0xda9f('0x80')])?_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x80')]:new Array(_0x210e5a['query'][_0xda9f('0x80')]);_0x1f1899['forEach'](function(_0x1e7417){_0x564ab2['or'](_0xda9f('0x6c'),'%,'+_0x1e7417+',%');});}if(_0x210e5a[_0xda9f('0x3e')]['filter']){var _0x1b57cf=_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x81')][_0xda9f('0x82')]('\x5c','\x5c\x5c')[_0xda9f('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1b57cf)){_0x14adfc['or']('i.id\x20LIKE\x20?',_0x1b57cf+'%');}else{_0x14adfc['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1b57cf))['or'](_0xda9f('0x83'),_0x1b57cf+'%')['or'](_0xda9f('0x84'),_0x1b57cf+'%');}}}_0x235a91[_0xda9f('0x47')](_0x14adfc);_0x235a91[_0xda9f('0x85')](_0xda9f('0x86'));var _0x3969ce={'type':db[_0xda9f('0x87')][_0xda9f('0x88')][_0xda9f('0x89')],'raw':!![]};var _0x30c9c9=_0x235a91[_0xda9f('0x8a')]();_0x30c9c9['field'](_0xda9f('0x86'));_0x30c9c9[_0xda9f('0x49')](_0xda9f('0x8b'),'unreadMessages');if(_0x1427ff[_0xda9f('0x45')]){_0x1427ff[_0xda9f('0x45')][_0xda9f('0x34')](function(_0x4925c3){var _0x113a8e=_0x4925c3[0x0]===_0xda9f('0x8c')?_0x4925c3[0x0]:'i.'+_0x4925c3[0x0];_0x235a91[_0xda9f('0x45')](_0x113a8e,_0x4925c3[0x1]==='DESC'?![]:!![]);});}if(!_[_0xda9f('0x76')](_0x1f1899)){_0x235a91[_0xda9f('0x63')](_0x564ab2);_0x30c9c9[_0xda9f('0x47')](_0xda9f('0x8d'),_0x1f1899);}BPromise[_0xda9f('0x8e')]()[_0xda9f('0x2a')](function(){if(!_0x452868){if(_0x210e5a['query'][_0xda9f('0x77')])return;_0x30c9c9[_0xda9f('0x47')](_0xda9f('0x8f'));_0x235a91['where'](_0xda9f('0x8f'));return;}if(_0x210e5a['user'][_0xda9f('0x90')]!=='agent')return;return _0x210e5a[_0xda9f('0x91')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x4e5c10){if(_[_0xda9f('0x76')](_0x4e5c10)){_0x30c9c9[_0xda9f('0x47')](_0xda9f('0x92'));_0x235a91['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x30c9c9[_0xda9f('0x47')](_0xda9f('0x78'),_['map'](_0x4e5c10,'id'));_0x235a91['where'](_0xda9f('0x78'),_[_0xda9f('0x3d')](_0x4e5c10,'id'));}});})[_0xda9f('0x2a')](function(){if(_0x210e5a['user'][_0xda9f('0x90')]===_0xda9f('0x93')&&!_0x452868&&!_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x77')])return[];return db['sequelize'][_0xda9f('0x3e')](_0x30c9c9[_0xda9f('0x94')](),_0x3969ce);})[_0xda9f('0x2a')](function(_0x4c3453){_0x262292['count']=_0x4c3453[_0xda9f('0x42')];if(_0x262292[_0xda9f('0x24')]===0x0)return[];return db[_0xda9f('0x95')][_0xda9f('0x3e')](_0x44b062[_0xda9f('0x94')](),_0x3969ce)[_0xda9f('0x2a')](function(_0x2573b8){_0x14bb74=_[_0xda9f('0x96')](_0x2573b8,'id');_0x3969ce=_[_0xda9f('0x97')](_0x3969ce,{'model':db[_0xda9f('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x210e5a[_0xda9f('0x3e')][_0xda9f('0x41')]){_0x1427ff[_0xda9f('0x3f')][_0xda9f('0x34')](function(_0x452273){_0x235a91[_0xda9f('0x49')]('i.'+_0x452273);});}else{_0x235a91[_0xda9f('0x49')](_0xda9f('0x8b'),_0xda9f('0x61'));_0x235a91['field'](_0xda9f('0x98'),_0xda9f('0x99'));_0x235a91[_0xda9f('0x49')](_0xda9f('0x9a'),_0xda9f('0x9b'));_0x235a91[_0xda9f('0x49')](_0xda9f('0x9c'),'contactName');_0x235a91[_0xda9f('0x49')](_0xda9f('0x9d'));_0x235a91[_0xda9f('0x49')](_0xda9f('0x9e'),_0xda9f('0x9f'));_0x235a91['field']('c.lastName','Contact.lastName');_0x235a91[_0xda9f('0x49')]('c.email',_0xda9f('0xa0'));_0x235a91['field']('c.phone',_0xda9f('0xa1'));_0x235a91['field'](_0xda9f('0xa2'),_0xda9f('0xa3'));_0x235a91['field']('c.fax',_0xda9f('0xa4'));_0x235a91[_0xda9f('0x49')]('o.fullname',_0xda9f('0xa5'));_0x235a91[_0xda9f('0x49')]('o.internal',_0xda9f('0xa6'));_0x235a91[_0xda9f('0x49')](_0xda9f('0xa7'),_0xda9f('0x32'));}if(_0x1427ff['limit'])_0x235a91[_0xda9f('0x23')](_0x1427ff[_0xda9f('0x23')]);if(_0x1427ff[_0xda9f('0x25')])_0x235a91[_0xda9f('0x25')](_0x1427ff['offset']);return db[_0xda9f('0x95')]['query'](_0x235a91[_0xda9f('0x94')](),_0x3969ce);})[_0xda9f('0x2a')](function(_0x471ae0){if(_0x471ae0[_0xda9f('0x42')]>0x0)_0x1ab99f[_0xda9f('0x47')](_0xda9f('0xa8'),_[_0xda9f('0x3d')](_0x471ae0,'id'));return db['sequelize'][_0xda9f('0x3e')](_0x1ab99f[_0xda9f('0x94')](),_0x3969ce)[_0xda9f('0x2a')](function(_0x1a6bdf){var _0x7010ab=_[_0xda9f('0xa9')](_0x1a6bdf,_0xda9f('0xaa'));var _0x54234e=[];_0x471ae0[_0xda9f('0x34')](function(_0x1f4c51){_0x54234e[_0xda9f('0xab')](updateOpenchannelInteraction(_0x1f4c51,_0x14bb74,_0x7010ab));});return BPromise[_0xda9f('0xac')](_0x54234e);});});})[_0xda9f('0x2a')](function(_0x4684ec){_0x262292['rows']=_0x4684ec;return _0x262292;})[_0xda9f('0x2a')](respondWithFilteredResult(_0x2b6c24,_0x1427ff))['catch'](handleError(_0x2b6c24,null));};exports[_0xda9f('0xad')]=function(_0x41ccde,_0x59bd4c){var _0x1e1c5c={};if(_0x41ccde[_0xda9f('0x3e')][_0xda9f('0x3a')]&&_0x41ccde[_0xda9f('0x3e')]['type']===_0xda9f('0x4b')){_0x1e1c5c[_0xda9f('0x4b')]=_0x41ccde[_0xda9f('0xae')]['id'];}else{_0x1e1c5c['id']=_0x41ccde['params']['id'];}var _0x2a739a={'raw':![],'where':_0x1e1c5c},_0x462960={};_0x462960[_0xda9f('0x3c')]=_[_0xda9f('0x73')](db[_0xda9f('0x37')]['rawAttributes']);_0x462960[_0xda9f('0x3e')]=_[_0xda9f('0x73')](_0x41ccde[_0xda9f('0x3e')]);_0x462960[_0xda9f('0xaf')]=_['intersection'](_0x462960[_0xda9f('0x3c')],_0x462960[_0xda9f('0x3e')]);_0x2a739a[_0xda9f('0x3f')]=_[_0xda9f('0x40')](_0x462960[_0xda9f('0x3c')],qs[_0xda9f('0x41')](_0x41ccde[_0xda9f('0x3e')][_0xda9f('0x41')]));_0x2a739a[_0xda9f('0x3f')]=_0x2a739a[_0xda9f('0x3f')][_0xda9f('0x42')]?_0x2a739a[_0xda9f('0x3f')]:_0x462960[_0xda9f('0x3c')];if(_0x41ccde[_0xda9f('0x3e')]['includeAll']){_0x2a739a[_0xda9f('0xb0')]=[{'all':!![]}];}_0x2a739a=_[_0xda9f('0x97')]({},_0x2a739a,_0x41ccde['options']);return db['OpenchannelInteraction']['find'](_0x2a739a)[_0xda9f('0x2a')](handleEntityNotFound(_0x59bd4c,null))[_0xda9f('0x2a')](respondWithResult(_0x59bd4c,null))['catch'](handleError(_0x59bd4c,null));};exports[_0xda9f('0xb1')]=function(_0x5f482b,_0x4026fe){return db['OpenchannelInteraction'][_0xda9f('0xb1')](_0x5f482b[_0xda9f('0x71')],{})['then'](respondWithResult(_0x4026fe,0xc9))['catch'](handleError(_0x4026fe,null));};exports[_0xda9f('0xb2')]=function(_0x154b70,_0x3c6385){if(_0x154b70[_0xda9f('0x71')]['id']){delete _0x154b70[_0xda9f('0x71')]['id'];}return db['OpenchannelInteraction'][_0xda9f('0x60')]({'where':{'id':_0x154b70[_0xda9f('0xae')]['id']}})[_0xda9f('0x2a')](handleEntityNotFound(_0x3c6385,null))[_0xda9f('0x2a')](saveUpdates(_0x154b70[_0xda9f('0x71')],null))[_0xda9f('0x2a')](respondWithResult(_0x3c6385,null))[_0xda9f('0x35')](handleError(_0x3c6385,null));};exports['destroy']=function(_0xfdb593,_0x1d8df9){return db['OpenchannelInteraction'][_0xda9f('0x60')]({'where':{'id':_0xfdb593[_0xda9f('0xae')]['id']}})[_0xda9f('0x2a')](handleEntityNotFound(_0x1d8df9,null))['then'](removeEntity(_0x1d8df9,null))[_0xda9f('0x35')](handleError(_0x1d8df9,null));};exports[_0xda9f('0xb3')]=function(_0x3f72a5,_0x5384f5){return db[_0xda9f('0x37')]['describe']()[_0xda9f('0x2a')](respondWithResult(_0x5384f5,null))[_0xda9f('0x35')](handleError(_0x5384f5,null));};exports[_0xda9f('0xb4')]=function(_0x356eca,_0x251e6a,_0x3706c5){return db[_0xda9f('0xb5')][_0xda9f('0x60')]({'where':{'id':_0x356eca[_0xda9f('0xae')]['id']}})[_0xda9f('0x2a')](handleEntityNotFound(_0x251e6a,null))['then'](function(_0x11382a){if(_0x11382a){return _0x11382a[_0xda9f('0xb4')](_0x356eca[_0xda9f('0x71')][_0xda9f('0xb6')],_['omit'](_0x356eca[_0xda9f('0x71')],[_0xda9f('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x251e6a,null))[_0xda9f('0x35')](handleError(_0x251e6a,null));};exports['getMessages']=function(_0x43054f,_0xcacdad,_0x22b6ef){var _0x2b1528={'raw':![],'where':{}};var _0x1cf295={};var _0x123e62={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xda9f('0xb7')]({'where':{'id':_0x43054f['params']['id']}})[_0xda9f('0x2a')](handleEntityNotFound(_0xcacdad,null))['then'](function(_0x27d51d){if(_0x27d51d){_0x1cf295[_0xda9f('0x3c')]=_[_0xda9f('0x73')](db[_0xda9f('0xb5')][_0xda9f('0x38')]);_0x1cf295[_0xda9f('0x3e')]=_[_0xda9f('0x73')](_0x43054f[_0xda9f('0x3e')]);_0x1cf295[_0xda9f('0xaf')]=_[_0xda9f('0x40')](_0x1cf295[_0xda9f('0x3c')],_0x1cf295[_0xda9f('0x3e')]);_0x2b1528[_0xda9f('0x3f')]=_[_0xda9f('0x40')](_0x1cf295['model'],qs[_0xda9f('0x41')](_0x43054f['query'][_0xda9f('0x41')]));_0x2b1528[_0xda9f('0x3f')]=_0x2b1528[_0xda9f('0x3f')][_0xda9f('0x42')]?_0x2b1528[_0xda9f('0x3f')]:_0x1cf295[_0xda9f('0x3c')];if(!_0x43054f[_0xda9f('0x3e')]['hasOwnProperty'](_0xda9f('0x44'))){_0x2b1528[_0xda9f('0x23')]=qs[_0xda9f('0x23')](_0x43054f[_0xda9f('0x3e')]['limit']);_0x2b1528[_0xda9f('0x25')]=qs[_0xda9f('0x25')](_0x43054f[_0xda9f('0x3e')][_0xda9f('0x25')]);}_0x2b1528['order']=qs[_0xda9f('0x46')](_0x43054f['query'][_0xda9f('0x46')]);_0x2b1528[_0xda9f('0x47')]=qs['filters'](_[_0xda9f('0x48')](_0x43054f[_0xda9f('0x3e')],_0x1cf295['filters']));_0x2b1528[_0xda9f('0x47')][_0xda9f('0xaa')]=_0x27d51d['id'];if(_0x43054f[_0xda9f('0x3e')][_0xda9f('0x81')]){_0x2b1528[_0xda9f('0x47')]=_[_0xda9f('0x97')](_0x2b1528[_0xda9f('0x47')],{'$or':_[_0xda9f('0x3d')](_0x2b1528[_0xda9f('0x3f')],function(_0x50497f){var _0x3b4c4b={};_0x3b4c4b[_0x50497f]={'$like':'%'+_0x43054f['query'][_0xda9f('0x81')]+'%'};return _0x3b4c4b;})});}if(_0x43054f[_0xda9f('0x3e')][_0xda9f('0x7b')]){var _0x151f10=_0x43054f[_0xda9f('0x3e')][_0xda9f('0x7b')][_0xda9f('0x33')](',');var _0x18e397={};_0x18e397[_0x151f10[0x0]]={'$gte':moment(_0x151f10[0x1])[_0xda9f('0xb8')](_0xda9f('0xb9'))};_0x2b1528['where']=_['merge'](_0x2b1528[_0xda9f('0x47')],_0x18e397);}_0x2b1528=_[_0xda9f('0x97')]({},_0x2b1528,_0x43054f[_0xda9f('0xba')]);return db['OpenchannelMessage']['count']({'where':_0x2b1528[_0xda9f('0x47')]})[_0xda9f('0x2a')](function(_0x5d59e9){_0x123e62[_0xda9f('0x24')]=_0x5d59e9;if(_0x43054f['query'][_0xda9f('0xbb')]){_0x2b1528[_0xda9f('0xb0')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xda9f('0xbc')](_0x2b1528);})['then'](function(_0x14b38c){_0x123e62[_0xda9f('0xbd')]=_0x14b38c;return _0x123e62;});}})[_0xda9f('0x2a')](respondWithFilteredResult(_0xcacdad,_0x2b1528))[_0xda9f('0x35')](handleError(_0xcacdad,null));};exports[_0xda9f('0xbe')]=function(_0x543dca,_0x1005e8,_0x26d135){return db[_0xda9f('0x37')]['find']({'where':{'id':_0x543dca['params']['id']}})[_0xda9f('0x2a')](handleEntityNotFound(_0x1005e8,null))[_0xda9f('0x2a')](function(_0x410f98){if(_0x410f98){return _0x410f98[_0xda9f('0xbf')](_0x543dca[_0xda9f('0x71')]['ids'],_[_0xda9f('0xc0')](_0x543dca['body'],['ids','id'])||{})[_0xda9f('0xc1')](function(){return db[_0xda9f('0x6b')]['findAll']({'attributes':['id',_0xda9f('0x2e'),'color'],'where':{'id':_0x543dca[_0xda9f('0x71')][_0xda9f('0xb6')]}});})['then'](function(_0x294e41){socket[_0xda9f('0xc2')](_0xda9f('0xc3'),{'id':Number(_0x543dca['params']['id']),'tags':_0x294e41||[]});return{'id':Number(_0x543dca['params']['id']),'tags':_0x294e41||[]};});}})[_0xda9f('0x2a')](respondWithResult(_0x1005e8,null))['catch'](handleError(_0x1005e8,null));};exports[_0xda9f('0xc4')]=function(_0x2a92a7,_0x559367,_0x3dd763){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2a92a7[_0xda9f('0xae')]['id']}})[_0xda9f('0x2a')](handleEntityNotFound(_0x559367,null))['then'](function(_0x1bff14){if(_0x1bff14){return _0x1bff14[_0xda9f('0xc4')](_0x2a92a7[_0xda9f('0x3e')][_0xda9f('0xb6')]);}})[_0xda9f('0x2a')](respondWithStatusCode(_0x559367,null))[_0xda9f('0x35')](handleError(_0x559367,null));};exports['download']=function(_0x4ffdfe,_0x49b500){var _0x483b3c=moment()[_0xda9f('0xc5')]()[_0xda9f('0x94')]();var _0x170502=path[_0xda9f('0xc6')](config[_0xda9f('0xc7')],_0xda9f('0xc8'),'files',_0xda9f('0xc9'));var _0x2efd2a=path['join'](config['root'],_0xda9f('0xc8'),_0xda9f('0xca'),_0xda9f('0xcb'));var _0x2d8608=path[_0xda9f('0xc6')](_0x170502,_0x483b3c);var _0x16f639=util[_0xda9f('0xb8')](_0xda9f('0xcc'),_0x4ffdfe[_0xda9f('0xae')]['id'],_0x483b3c);var _0x54d483=path['join'](_0x170502,_0x16f639);var _0x26641e=[];_0x26641e[_0xda9f('0xab')]({'model':db[_0xda9f('0xcd')],'as':_0xda9f('0xcd'),'attributes':['id',_0xda9f('0x30')],'raw':!![]});_0x26641e[_0xda9f('0xab')]({'model':db[_0xda9f('0xce')],'as':'Contact','attributes':['id',_0xda9f('0xcf'),'lastName'],'raw':!![]});if(_0x4ffdfe['query'][_0xda9f('0xcb')]){_0x26641e[_0xda9f('0xab')]({'model':db['Attachment'],'as':_0xda9f('0xd0'),'raw':!![]});}var _0x52c805=[{'model':db[_0xda9f('0xb5')],'as':_0xda9f('0xd1'),'attributes':['id',_0xda9f('0x71'),_0xda9f('0x79'),'direction',_0xda9f('0xd2'),_0xda9f('0x7e')],'include':_0x26641e}];_0x52c805[_0xda9f('0xab')]({'model':db[_0xda9f('0xd3')],'as':'Account','attributes':['id','name']});_0x52c805['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xda9f('0x30')]});return db[_0xda9f('0x37')][_0xda9f('0x60')]({'where':{'id':_0x4ffdfe[_0xda9f('0xae')]['id']},'include':_0x52c805})[_0xda9f('0x2a')](handleEntityNotFound(_0x49b500,null))['then'](function(_0x6c454d){if(_0x6c454d){var _0xc80ecc=_0x6c454d[_0xda9f('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x2d8608);var _0x870f24={'channel':'Openchannel','account':_0xc80ecc[_0xda9f('0xd5')][_0xda9f('0x2e')],'agent':_0xc80ecc[_0xda9f('0xd6')]?_0xc80ecc['Owner'][_0xda9f('0x30')]:_0xda9f('0xd7'),'createdAt':moment(_0xc80ecc[_0xda9f('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xda9f('0x94')](),'closedAt':_0xc80ecc['closed']?moment(_0xc80ecc['closedAt'])[_0xda9f('0xb8')](_0xda9f('0xb9'))['toString']():'','disposition':_0xc80ecc[_0xda9f('0xd8')],'visibility':_0xc80ecc[_0xda9f('0xd9')]?_0xda9f('0xda'):_0xda9f('0xdb'),'messages':_(_0xc80ecc['Messages'])[_0xda9f('0x81')]({'secret':![]})['map'](function(_0x5dec54){if(_0x5dec54[_0xda9f('0xd0')]){var _0x1f3f0c=path[_0xda9f('0xc6')](_0x2efd2a,_0x5dec54[_0xda9f('0xd0')]['basename']);if(fs[_0xda9f('0xdc')](_0x1f3f0c)){fs[_0xda9f('0xdd')](_0x1f3f0c)[_0xda9f('0xde')](fs[_0xda9f('0xdf')](path[_0xda9f('0xc6')](_0x2d8608,_0x5dec54['Attachment'][_0xda9f('0xe0')])));}}return{'date':moment(_0x5dec54[_0xda9f('0x79')])[_0xda9f('0xb8')](_0xda9f('0xb9'))[_0xda9f('0x94')](),'sender':_0x5dec54[_0xda9f('0xe1')]===_0xda9f('0xe2')?_0x5dec54[_0xda9f('0xcd')]?_0x5dec54['User']['fullname']:_0xda9f('0xe3'):_0x5dec54['Contact']['firstName']+(_0x5dec54[_0xda9f('0xe4')][_0xda9f('0xe5')]?'\x20'+_0x5dec54[_0xda9f('0xe4')][_0xda9f('0xe5')]:''),'body':_0x5dec54[_0xda9f('0xd0')]?_0x5dec54[_0xda9f('0xd0')][_0xda9f('0xe0')]:_0x5dec54['body'],'direction':_0x5dec54[_0xda9f('0xe1')]===_0xda9f('0xe2')?'A':'C','secret':_0x5dec54['secret'],'read':_0x5dec54[_0xda9f('0x7e')],'attachment':_0x5dec54[_0xda9f('0xd0')]};})[_0xda9f('0x62')]()};return ejs[_0xda9f('0xe6')](path['join'](config[_0xda9f('0xc7')],_0xda9f('0xc8'),_0xda9f('0xe7'),_0xda9f('0xe8')),{'interaction':_0x870f24})['then'](function(_0x134425){var _0x442ba5=path[_0xda9f('0xc6')](_0x2d8608,_0xda9f('0xe9')+_0xc80ecc['id']+'-'+_0x483b3c+_0xda9f('0xea'));var _0x497c03={'path':_0x442ba5,'channel':_0xda9f('0xeb'),'interactionId':_0xc80ecc['id']};return pdf[_0xda9f('0xec')](_0x134425,_0x497c03);})['then'](function(){return new BPromise(function(_0x90bd32,_0x2848e1){zipdir(_0x2d8608,{'saveTo':_0x54d483},function(_0x5c6fd5,_0x19140d){if(_0x5c6fd5)return _0x2848e1(_0x5c6fd5);return _0x90bd32(_0x19140d);});})['then'](function(){return new BPromise(function(_0x2bf63f,_0x58a068){rimraf(_0x2d8608,function(_0x1ad866){if(_0x1ad866)_0x58a068(_0x1ad866);return _0x2bf63f();});});})['then'](function(){return _0x49b500['download'](_0x54d483,_0x16f639,function(_0x1898b0){if(_0x1898b0){console['log']('err',_0x1898b0);}else{fs['unlinkSync'](_0x54d483);}});});});}else{return _0x49b500[_0xda9f('0x1f')](0xc8);}})[_0xda9f('0x35')](handleError(_0x49b500,null));}; \ No newline at end of file +var _0xa15c=['createPdfFromHTML','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','fullname','TagIds','Tags','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','buildExpression','body','some','compact','forEach','i.OpenchannelAccountId\x20IN\x20?','parse','$gte','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','isEmpty','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','catch','show','params','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','tmp','server','attachments','transcript-%d-%s.zip','join','CmContact','firstName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','lastName','out','secret','views','downloadInteraction.ejs','.pdf'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0xa15c,0xf9));var _0xca15=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa15c[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xca15('0x0'));var jsonpatch=require(_0xca15('0x1'));var rp=require(_0xca15('0x2'));var moment=require(_0xca15('0x3'));var BPromise=require(_0xca15('0x4'));var Mustache=require(_0xca15('0x5'));var util=require(_0xca15('0x6'));var path=require('path');var sox=require(_0xca15('0x7'));var csv=require(_0xca15('0x8'));var ejs=require(_0xca15('0x9'));var fs=require('fs');var fs_extra=require(_0xca15('0xa'));var _=require(_0xca15('0xb'));var squel=require(_0xca15('0xc'));var crypto=require(_0xca15('0xd'));var jsforce=require(_0xca15('0xe'));var deskjs=require(_0xca15('0xf'));var toCsv=require('to-csv');var querystring=require(_0xca15('0x10'));var Papa=require(_0xca15('0x11'));var Redis=require('ioredis');var authService=require(_0xca15('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xca15('0x13'));var pdf=require(_0xca15('0x14'));var hardwareService=require(_0xca15('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xca15('0x16'));var config=require(_0xca15('0x17'));var licenseUtil=require(_0xca15('0x18'));var db=require(_0xca15('0x19'))['db'];config['redis']=_[_0xca15('0x1a')](config[_0xca15('0x1b')],{'host':_0xca15('0x1c'),'port':0x18eb});var socket=require(_0xca15('0x1d'))(new Redis(config[_0xca15('0x1b')]));require(_0xca15('0x1e'))['register'](socket);function respondWithStatusCode(_0x5a3c14,_0x5af38c){_0x5af38c=_0x5af38c||0xcc;return function(_0x58b0bd){if(_0x58b0bd){return _0x5a3c14[_0xca15('0x1f')](_0x5af38c);}return _0x5a3c14[_0xca15('0x20')](_0x5af38c)['end']();};}function respondWithResult(_0x5e4e95,_0x364d6f){_0x364d6f=_0x364d6f||0xc8;return function(_0x3a8b08){if(_0x3a8b08){return _0x5e4e95[_0xca15('0x20')](_0x364d6f)['json'](_0x3a8b08);}};}function respondWithFilteredResult(_0x3fc314,_0x5f4956){return function(_0x11caaa){if(_0x11caaa){var _0x152f0d=typeof _0x5f4956['offset']===_0xca15('0x21')&&typeof _0x5f4956[_0xca15('0x22')]===_0xca15('0x21');var _0x6e15cc=_0x11caaa[_0xca15('0x23')];var _0x11163c=_0x152f0d?0x0:_0x5f4956[_0xca15('0x24')];var _0x17e14a=_0x152f0d?_0x11caaa['count']:_0x5f4956[_0xca15('0x24')]+_0x5f4956[_0xca15('0x22')];var _0x4aacf8;if(_0x17e14a>=_0x6e15cc){_0x17e14a=_0x6e15cc;_0x4aacf8=0xc8;}else{_0x4aacf8=0xce;}_0x3fc314[_0xca15('0x20')](_0x4aacf8);return _0x3fc314[_0xca15('0x25')](_0xca15('0x26'),_0x11163c+'-'+_0x17e14a+'/'+_0x6e15cc)[_0xca15('0x27')](_0x11caaa);}return null;};}function patchUpdates(_0x1012c6){return function(_0x538a33){try{jsonpatch[_0xca15('0x28')](_0x538a33,_0x1012c6,!![]);}catch(_0x62c420){return BPromise[_0xca15('0x29')](_0x62c420);}return _0x538a33[_0xca15('0x2a')]();};}function saveUpdates(_0x1c80d4,_0x2d079e){return function(_0xa76f40){if(_0xa76f40){return _0xa76f40[_0xca15('0x2b')](_0x1c80d4)[_0xca15('0x2c')](function(_0x116783){return _0x116783;});}return null;};}function removeEntity(_0x13bcff,_0x467ade){return function(_0x42d067){if(_0x42d067){return _0x42d067[_0xca15('0x2d')]()[_0xca15('0x2c')](function(){_0x13bcff[_0xca15('0x20')](0xcc)[_0xca15('0x2e')]();});}};}function handleEntityNotFound(_0x3c32aa,_0x3d6683){return function(_0x57ceba){if(!_0x57ceba){_0x3c32aa['sendStatus'](0x194);}return _0x57ceba;};}function handleError(_0x3296e9,_0x3c207){_0x3c207=_0x3c207||0x1f4;return function(_0xc20e85){logger[_0xca15('0x2f')](_0xc20e85['stack']);if(_0xc20e85[_0xca15('0x30')]){delete _0xc20e85[_0xca15('0x30')];}_0x3296e9[_0xca15('0x20')](_0x3c207)[_0xca15('0x31')](_0xc20e85);};}function getInteractionUsers(_0x4078f9,_0x7e00d2){return new BPromise(function(_0x456f82,_0x26b6f4){try{if(_0x7e00d2[_0x4078f9['id']]){_0x4078f9['Users']=_['map'](_0x7e00d2[_0x4078f9['id']],function(_0x543086){return{'id':_0x543086['id'],'fullname':_0x543086[_0xca15('0x32')]};});}}catch(_0x128a67){_0x26b6f4(_0x128a67);}_0x456f82(_0x4078f9);});}function getInteractionTags(_0x45b7a2,_0x1dfcf1){return new BPromise(function(_0x44b898,_0x32e3d1){try{if(_0x45b7a2[_0xca15('0x33')]){_0x45b7a2[_0xca15('0x34')]=[];_0x45b7a2[_0xca15('0x33')]['split'](',')['forEach'](function(_0x2c8c00){_0x45b7a2[_0xca15('0x34')]['push'](_0x1dfcf1[_0x2c8c00]);});}delete _0x45b7a2['TagIds'];}catch(_0x3af509){_0x32e3d1(_0x3af509);}_0x44b898(_0x45b7a2);});}function updateOpenchannelInteraction(_0x565045,_0x29b078,_0x28be3f){return new BPromise(function(_0x3cfa17,_0x3e0b5b){return getInteractionUsers(_0x565045,_0x28be3f)[_0xca15('0x2c')](function(_0xda8292){return getInteractionTags(_0xda8292,_0x29b078);})[_0xca15('0x2c')](function(_0x4f1ec5){_0x3cfa17(_0x4f1ec5);})['catch'](function(_0x55f705){_0x3e0b5b(_0x55f705);});});}exports[_0xca15('0x35')]=function(_0x5adf48,_0x730cae){var _0x24fead={},_0x797c65={},_0x490262={'count':0x0,'rows':[]};var _0xe2f4ab=_[_0xca15('0x36')](db[_0xca15('0x37')][_0xca15('0x38')],function(_0x483c71){return{'name':_0x483c71[_0xca15('0x39')],'type':_0x483c71[_0xca15('0x3a')][_0xca15('0x3b')]};});_0x797c65['model']=_[_0xca15('0x36')](_0xe2f4ab,'name');_0x797c65[_0xca15('0x3c')]=_[_0xca15('0x3d')](_0x5adf48['query']);_0x797c65['filters']=_[_0xca15('0x3e')](_0x797c65['model'],_0x797c65['query']);_0x24fead['attributes']=_[_0xca15('0x3e')](_0x797c65[_0xca15('0x3f')],qs[_0xca15('0x40')](_0x5adf48[_0xca15('0x3c')][_0xca15('0x40')]));_0x24fead[_0xca15('0x41')]=_0x24fead[_0xca15('0x41')][_0xca15('0x42')]?_0x24fead['attributes']:_0x797c65[_0xca15('0x3f')];if(!_0x5adf48[_0xca15('0x3c')][_0xca15('0x43')](_0xca15('0x44'))){_0x24fead[_0xca15('0x22')]=qs[_0xca15('0x22')](_0x5adf48[_0xca15('0x3c')][_0xca15('0x22')]);_0x24fead[_0xca15('0x24')]=qs[_0xca15('0x24')](_0x5adf48['query']['offset']);}_0x24fead[_0xca15('0x45')]=qs[_0xca15('0x46')](_0x5adf48[_0xca15('0x3c')]['sort']);_0x24fead[_0xca15('0x47')]=qs[_0xca15('0x48')](_['pick'](_0x5adf48[_0xca15('0x3c')],_0x797c65[_0xca15('0x48')]),_0xe2f4ab);var _0x247507=[];var _0x25808e=squel[_0xca15('0x49')]()[_0xca15('0x4a')]('id')['field'](_0xca15('0x30'))[_0xca15('0x4a')](_0xca15('0x4b'))[_0xca15('0x4c')](_0xca15('0x4d'));var _0x4ee451=squel[_0xca15('0x49')]()['field'](_0xca15('0x4e'))[_0xca15('0x4a')](_0xca15('0x4f'))[_0xca15('0x4a')](_0xca15('0x50'))[_0xca15('0x4c')](_0xca15('0x51'),'ui')[_0xca15('0x52')](_0xca15('0x53'),'u',_0xca15('0x54'));var _0x2112ce=squel[_0xca15('0x49')]()[_0xca15('0x4c')](_0xca15('0x55'),'i')[_0xca15('0x52')](_0xca15('0x56'),'c',_0xca15('0x57'))[_0xca15('0x52')](_0xca15('0x53'),'o','o.id\x20=\x20i.UserId')[_0xca15('0x52')]('openchannel_accounts','a',_0xca15('0x58'))[_0xca15('0x52')](_0xca15('0x59'),'me',_0xca15('0x5a'))[_0xca15('0x52')](_0xca15('0x5b'),'it',_0xca15('0x5c'))['left_join'](_0xca15('0x4d'),'t',_0xca15('0x5d'));var _0x5b617d=squel[_0xca15('0x5e')]();var _0x164ccb=[];var _0x169608=squel['expr']();var _0x30d36c;if(_0x5adf48[_0xca15('0x3c')][_0xca15('0x5f')]){_0x30d36c=as[_0xca15('0x60')](_0x5adf48['query'][_0xca15('0x5f')]);var _0x3f6986=_0x30d36c[_0xca15('0x61')];for(var _0x25039a=0x0;_0x25039a<_0x30d36c['conditions']['length'];_0x25039a++){var _0x349026=_0x30d36c[_0xca15('0x62')][_0x25039a];var _0x4023c9='i';var _0x30af81=_[_0xca15('0x63')](_0xe2f4ab,['name',_0x349026[_0xca15('0x4a')]]);if(!_0x30af81){switch(_0x349026[_0xca15('0x4a')]){case _0xca15('0x64'):if(_0x349026[_0xca15('0x65')]==0x1){_0x2112ce[_0xca15('0x66')]('`'+_0x349026[_0xca15('0x4a')]+_0xca15('0x67'));}else{_0x2112ce[_0xca15('0x66')]('`'+_0x349026[_0xca15('0x4a')]+_0xca15('0x68'));}break;case _0xca15('0x69'):if(_0x349026['operator']===_0xca15('0x6a')){if(_0x349026[_0xca15('0x65')][_0xca15('0x6b')]('\x20')['length']>0x1){_0x5b617d[_0x3f6986](_0xca15('0x6c'),qs['getFullTextValue'](_0x349026[_0xca15('0x65')]),null);}else{var _0x48e035='%'+_0x349026[_0xca15('0x65')]+'%';_0x5b617d[_0x3f6986]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x48e035,_0x48e035,_0x48e035);}}else{_0x30af81=_[_0xca15('0x63')](_0xe2f4ab,[_0xca15('0x30'),'ContactId']);_0x349026[_0xca15('0x4a')]=_0xca15('0x6d');_0x2ae117=as['buildExpression'](_0x4023c9,_0x30af81[_0xca15('0x3a')],_0x349026);_0x5b617d[_0x3f6986](_0x2ae117[_0xca15('0x6e')],_0x2ae117[_0xca15('0x65')][_0xca15('0x6f')],_0x2ae117['value'][_0xca15('0x2e')]);}break;case _0xca15('0x70'):var _0x5afd59=_0x349026[_0xca15('0x65')][_0xca15('0x6b')](',')[_0xca15('0x36')](function(_0xc05985){return Number(_0xc05985);});_0x5afd59['forEach'](function(_0x248d3f){_0x169608['or'](_0xca15('0x71'),'%,'+_0x248d3f+',%');});_0x164ccb=_[_0xca15('0x72')](_0x164ccb,_0x5afd59);break;case _0xca15('0x73'):if(_0x349026[_0xca15('0x74')]==='$substring'){_0x5b617d[_0x3f6986]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x349026['value']+'%',null);}else{_0x30af81=_[_0xca15('0x63')](_0xe2f4ab,['name','UserId']);_0x349026[_0xca15('0x4a')]=_0xca15('0x75');_0x2ae117=as[_0xca15('0x76')](_0x4023c9,_0x30af81[_0xca15('0x3a')],_0x349026);_0x5b617d[_0x3f6986](_0x2ae117['text'],_0x2ae117[_0xca15('0x65')][_0xca15('0x6f')],_0x2ae117[_0xca15('0x65')][_0xca15('0x2e')]);}break;case _0xca15('0x77'):_0x2ae117=as[_0xca15('0x76')]('me',null,_0x349026);_0x5b617d[_0x3f6986](_0x2ae117[_0xca15('0x6e')],_0x2ae117[_0xca15('0x65')][_0xca15('0x6f')],_0x2ae117[_0xca15('0x65')]['end']);break;}}else{var _0x2ae117=as['buildExpression'](_0x4023c9,_0x30af81[_0xca15('0x3a')],_0x349026);_0x5b617d[_0x3f6986](_0x2ae117[_0xca15('0x6e')],_0x2ae117['value'][_0xca15('0x6f')],_0x2ae117[_0xca15('0x65')][_0xca15('0x2e')]);}}}else{var _0x65e12f=_(_0x5adf48[_0xca15('0x3c')])['keys']()[_0xca15('0x36')](function(_0x53e9f8){return _[_0xca15('0x78')](_0xe2f4ab,[_0xca15('0x30'),_0x53e9f8])?_0x53e9f8:undefined;})[_0xca15('0x79')]()[_0xca15('0x65')]();if(!_['isEmpty'](_0x65e12f)){_0x65e12f[_0xca15('0x7a')](function(_0x4f5d55){if(_0x4f5d55==='OpenchannelAccountId'){_0x2112ce[_0xca15('0x47')](_0xca15('0x7b'),[]['concat'](_0x5adf48[_0xca15('0x3c')][_0x4f5d55]));}else if(_0x4f5d55==='createdAt'){var _0x5c04e7=JSON[_0xca15('0x7c')](_0x5adf48[_0xca15('0x3c')][_0x4f5d55])[_0xca15('0x7d')];var _0x5c783a=JSON[_0xca15('0x7c')](_0x5adf48[_0xca15('0x3c')][_0x4f5d55])[_0xca15('0x7e')];_0x2112ce[_0xca15('0x47')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5c04e7,_0x5c783a);}else{if(_0x5adf48[_0xca15('0x3c')][_0x4f5d55]===_0xca15('0x7f')){_0x2112ce[_0xca15('0x47')]('i.'+_0x4f5d55+'\x20IS\x20NULL');}else{_0x2112ce['where']('i.'+_0x4f5d55+'\x20=\x20?',_0x5adf48[_0xca15('0x3c')][_0x4f5d55]);}}});}if(_0x5adf48['query'][_0xca15('0x80')]){if(_0x5adf48[_0xca15('0x3c')]['read']==0x1){_0x2112ce[_0xca15('0x66')](_0xca15('0x81'));}else{_0x2112ce[_0xca15('0x66')](_0xca15('0x82'));}}if(_0x5adf48['query'][_0xca15('0x83')]){_0x164ccb=_['isArray'](_0x5adf48[_0xca15('0x3c')]['tag'])?_0x5adf48[_0xca15('0x3c')][_0xca15('0x83')]:new Array(_0x5adf48[_0xca15('0x3c')][_0xca15('0x83')]);_0x164ccb[_0xca15('0x7a')](function(_0x1c32ea){_0x169608['or'](_0xca15('0x71'),'%,'+_0x1c32ea+',%');});}if(_0x5adf48['query']['filter']){var _0x57780b=_0x5adf48[_0xca15('0x3c')][_0xca15('0x84')]['replace']('\x5c','\x5c\x5c')[_0xca15('0x85')](/'/g,'\x27\x27');if(qs[_0xca15('0x86')](_0x57780b)){_0x5b617d['or'](_0xca15('0x87'),_0x57780b+'%');}else{_0x5b617d['or'](_0xca15('0x88'),qs[_0xca15('0x89')](_0x57780b))['or']('i.from\x20LIKE\x20?',_0x57780b+'%')['or'](_0xca15('0x8a'),_0x57780b+'%');}}}_0x2112ce[_0xca15('0x47')](_0x5b617d);_0x2112ce['group'](_0xca15('0x8b'));var _0x216459={'type':db[_0xca15('0x8c')][_0xca15('0x8d')][_0xca15('0x8e')],'raw':!![]};var _0x14ac00=_0x2112ce[_0xca15('0x8f')]();_0x14ac00[_0xca15('0x4a')]('i.id');_0x14ac00[_0xca15('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xca15('0x64'));if(_0x24fead[_0xca15('0x45')]){_0x24fead[_0xca15('0x45')][_0xca15('0x7a')](function(_0x2fb277){var _0x13e0a2=_0x2fb277[0x0]===_0xca15('0x90')?_0x2fb277[0x0]:'i.'+_0x2fb277[0x0];_0x2112ce[_0xca15('0x45')](_0x13e0a2,_0x2fb277[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x164ccb)){_0x2112ce[_0xca15('0x66')](_0x169608);_0x14ac00[_0xca15('0x47')]('t.id\x20IN\x20?',_0x164ccb);}BPromise[_0xca15('0x91')]()[_0xca15('0x2c')](function(){if(!_0x30d36c){if(_0x5adf48[_0xca15('0x3c')][_0xca15('0x92')])return;_0x14ac00[_0xca15('0x47')](_0xca15('0x93'));_0x2112ce[_0xca15('0x47')](_0xca15('0x93'));return;}if(_0x5adf48[_0xca15('0x94')][_0xca15('0x95')]!==_0xca15('0x96'))return;return _0x5adf48[_0xca15('0x94')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xca15('0x2c')](function(_0x4f83c1){if(_[_0xca15('0x97')](_0x4f83c1)){_0x14ac00['where'](_0xca15('0x98'));_0x2112ce[_0xca15('0x47')](_0xca15('0x98'));}else{_0x14ac00[_0xca15('0x47')](_0xca15('0x7b'),_[_0xca15('0x36')](_0x4f83c1,'id'));_0x2112ce[_0xca15('0x47')](_0xca15('0x7b'),_['map'](_0x4f83c1,'id'));}});})[_0xca15('0x2c')](function(){if(_0x5adf48[_0xca15('0x94')][_0xca15('0x95')]===_0xca15('0x96')&&!_0x30d36c&&!_0x5adf48[_0xca15('0x3c')]['OpenchannelAccountId'])return[];return db[_0xca15('0x99')][_0xca15('0x3c')](_0x14ac00['toString'](),_0x216459);})[_0xca15('0x2c')](function(_0x3ed884){_0x490262['count']=_0x3ed884[_0xca15('0x42')];if(_0x490262[_0xca15('0x23')]===0x0)return[];return db[_0xca15('0x99')][_0xca15('0x3c')](_0x25808e['toString'](),_0x216459)[_0xca15('0x2c')](function(_0xbe6d71){_0x247507=_['keyBy'](_0xbe6d71,'id');_0x216459=_[_0xca15('0x9a')](_0x216459,{'model':db[_0xca15('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5adf48[_0xca15('0x3c')][_0xca15('0x40')]){_0x24fead[_0xca15('0x41')][_0xca15('0x7a')](function(_0x47a182){_0x2112ce['field']('i.'+_0x47a182);});}else{_0x2112ce[_0xca15('0x4a')](_0xca15('0x9b'),_0xca15('0x64'));_0x2112ce[_0xca15('0x4a')](_0xca15('0x9c'),'Account.key');_0x2112ce[_0xca15('0x4a')](_0xca15('0x9d'),_0xca15('0x9e'));_0x2112ce[_0xca15('0x4a')](_0xca15('0x9f'),_0xca15('0x90'));_0x2112ce[_0xca15('0x4a')]('i.*');_0x2112ce[_0xca15('0x4a')](_0xca15('0xa0'),_0xca15('0xa1'));_0x2112ce[_0xca15('0x4a')](_0xca15('0xa2'),_0xca15('0xa3'));_0x2112ce[_0xca15('0x4a')](_0xca15('0xa4'),_0xca15('0xa5'));_0x2112ce[_0xca15('0x4a')](_0xca15('0xa6'),'Contact.phone');_0x2112ce[_0xca15('0x4a')]('c.mobile',_0xca15('0xa7'));_0x2112ce[_0xca15('0x4a')](_0xca15('0xa8'),_0xca15('0xa9'));_0x2112ce[_0xca15('0x4a')](_0xca15('0xaa'),'Owner.fullname');_0x2112ce['field'](_0xca15('0xab'),_0xca15('0xac'));_0x2112ce['field'](_0xca15('0xad'),'TagIds');}if(_0x24fead[_0xca15('0x22')])_0x2112ce[_0xca15('0x22')](_0x24fead[_0xca15('0x22')]);if(_0x24fead[_0xca15('0x24')])_0x2112ce[_0xca15('0x24')](_0x24fead[_0xca15('0x24')]);return db[_0xca15('0x99')]['query'](_0x2112ce[_0xca15('0xae')](),_0x216459);})['then'](function(_0x1f0bf1){if(_0x1f0bf1[_0xca15('0x42')]>0x0)_0x4ee451[_0xca15('0x47')](_0xca15('0xaf'),_['map'](_0x1f0bf1,'id'));return db[_0xca15('0x99')]['query'](_0x4ee451[_0xca15('0xae')](),_0x216459)['then'](function(_0x3aeb5d){var _0x1055c8=_[_0xca15('0xb0')](_0x3aeb5d,_0xca15('0xb1'));var _0x543347=[];_0x1f0bf1[_0xca15('0x7a')](function(_0xef973f){_0x543347[_0xca15('0xb2')](updateOpenchannelInteraction(_0xef973f,_0x247507,_0x1055c8));});return BPromise[_0xca15('0xb3')](_0x543347);});});})['then'](function(_0x51fd74){_0x490262[_0xca15('0xb4')]=_0x51fd74;return _0x490262;})[_0xca15('0x2c')](respondWithFilteredResult(_0x730cae,_0x24fead))[_0xca15('0xb5')](handleError(_0x730cae,null));};exports[_0xca15('0xb6')]=function(_0x7307ad,_0x1dc857){var _0x110b4e={};if(_0x7307ad[_0xca15('0x3c')][_0xca15('0x3a')]&&_0x7307ad[_0xca15('0x3c')]['type']===_0xca15('0x4c')){_0x110b4e[_0xca15('0x4c')]=_0x7307ad[_0xca15('0xb7')]['id'];}else{_0x110b4e['id']=_0x7307ad[_0xca15('0xb7')]['id'];}var _0x1f79e7={'raw':![],'where':_0x110b4e},_0x415654={};_0x415654[_0xca15('0x3f')]=_[_0xca15('0x3d')](db[_0xca15('0x37')]['rawAttributes']);_0x415654[_0xca15('0x3c')]=_[_0xca15('0x3d')](_0x7307ad[_0xca15('0x3c')]);_0x415654[_0xca15('0x48')]=_[_0xca15('0x3e')](_0x415654[_0xca15('0x3f')],_0x415654['query']);_0x1f79e7['attributes']=_[_0xca15('0x3e')](_0x415654['model'],qs[_0xca15('0x40')](_0x7307ad[_0xca15('0x3c')][_0xca15('0x40')]));_0x1f79e7[_0xca15('0x41')]=_0x1f79e7['attributes'][_0xca15('0x42')]?_0x1f79e7[_0xca15('0x41')]:_0x415654['model'];if(_0x7307ad['query'][_0xca15('0xb8')]){_0x1f79e7[_0xca15('0xb9')]=[{'all':!![]}];}_0x1f79e7=_[_0xca15('0x9a')]({},_0x1f79e7,_0x7307ad[_0xca15('0xba')]);return db['OpenchannelInteraction'][_0xca15('0x63')](_0x1f79e7)['then'](handleEntityNotFound(_0x1dc857,null))[_0xca15('0x2c')](respondWithResult(_0x1dc857,null))[_0xca15('0xb5')](handleError(_0x1dc857,null));};exports[_0xca15('0xbb')]=function(_0x2ce8b9,_0x119370){return db[_0xca15('0x37')][_0xca15('0xbb')](_0x2ce8b9[_0xca15('0x77')],{})[_0xca15('0x2c')](respondWithResult(_0x119370,0xc9))[_0xca15('0xb5')](handleError(_0x119370,null));};exports[_0xca15('0x2b')]=function(_0x766460,_0xf9a31a){if(_0x766460[_0xca15('0x77')]['id']){delete _0x766460[_0xca15('0x77')]['id'];}return db[_0xca15('0x37')]['find']({'where':{'id':_0x766460[_0xca15('0xb7')]['id']}})['then'](handleEntityNotFound(_0xf9a31a,null))[_0xca15('0x2c')](saveUpdates(_0x766460[_0xca15('0x77')],null))[_0xca15('0x2c')](respondWithResult(_0xf9a31a,null))[_0xca15('0xb5')](handleError(_0xf9a31a,null));};exports[_0xca15('0x2d')]=function(_0xe9c302,_0x3d4048){return db['OpenchannelInteraction'][_0xca15('0x63')]({'where':{'id':_0xe9c302[_0xca15('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3d4048,null))['then'](removeEntity(_0x3d4048,null))[_0xca15('0xb5')](handleError(_0x3d4048,null));};exports[_0xca15('0xbc')]=function(_0x32d864,_0x5841c3){return db[_0xca15('0x37')][_0xca15('0xbc')]()[_0xca15('0x2c')](respondWithResult(_0x5841c3,null))[_0xca15('0xb5')](handleError(_0x5841c3,null));};exports[_0xca15('0xbd')]=function(_0x5a6ac6,_0xf07f9b,_0x498e78){return db[_0xca15('0xbe')][_0xca15('0x63')]({'where':{'id':_0x5a6ac6[_0xca15('0xb7')]['id']}})[_0xca15('0x2c')](handleEntityNotFound(_0xf07f9b,null))[_0xca15('0x2c')](function(_0x56b110){if(_0x56b110){return _0x56b110[_0xca15('0xbd')](_0x5a6ac6[_0xca15('0x77')][_0xca15('0xbf')],_[_0xca15('0xc0')](_0x5a6ac6[_0xca15('0x77')],['ids','id'])||{});}})[_0xca15('0x2c')](respondWithResult(_0xf07f9b,null))[_0xca15('0xb5')](handleError(_0xf07f9b,null));};exports[_0xca15('0xc1')]=function(_0x174f2b,_0x4a6974,_0x39381e){var _0x37f262={'raw':![],'where':{}};var _0x238dfc={};var _0x431d97={'count':0x0,'rows':[]};return db[_0xca15('0x37')]['findOne']({'where':{'id':_0x174f2b[_0xca15('0xb7')]['id']}})['then'](handleEntityNotFound(_0x4a6974,null))[_0xca15('0x2c')](function(_0x489e59){if(_0x489e59){_0x238dfc[_0xca15('0x3f')]=_[_0xca15('0x3d')](db['OpenchannelMessage'][_0xca15('0x38')]);_0x238dfc[_0xca15('0x3c')]=_[_0xca15('0x3d')](_0x174f2b['query']);_0x238dfc[_0xca15('0x48')]=_[_0xca15('0x3e')](_0x238dfc['model'],_0x238dfc[_0xca15('0x3c')]);_0x37f262[_0xca15('0x41')]=_['intersection'](_0x238dfc[_0xca15('0x3f')],qs[_0xca15('0x40')](_0x174f2b['query'][_0xca15('0x40')]));_0x37f262[_0xca15('0x41')]=_0x37f262['attributes'][_0xca15('0x42')]?_0x37f262[_0xca15('0x41')]:_0x238dfc[_0xca15('0x3f')];if(!_0x174f2b[_0xca15('0x3c')][_0xca15('0x43')]('nolimit')){_0x37f262[_0xca15('0x22')]=qs[_0xca15('0x22')](_0x174f2b['query']['limit']);_0x37f262[_0xca15('0x24')]=qs[_0xca15('0x24')](_0x174f2b[_0xca15('0x3c')][_0xca15('0x24')]);}_0x37f262['order']=qs['sort'](_0x174f2b[_0xca15('0x3c')][_0xca15('0x46')]);_0x37f262[_0xca15('0x47')]=qs[_0xca15('0x48')](_[_0xca15('0xc2')](_0x174f2b[_0xca15('0x3c')],_0x238dfc[_0xca15('0x48')]));_0x37f262[_0xca15('0x47')]['OpenchannelInteractionId']=_0x489e59['id'];if(_0x174f2b[_0xca15('0x3c')][_0xca15('0x84')]){_0x37f262[_0xca15('0x47')]=_[_0xca15('0x9a')](_0x37f262[_0xca15('0x47')],{'$or':_[_0xca15('0x36')](_0x37f262[_0xca15('0x41')],function(_0x1e5d97){var _0x3dacc0={};_0x3dacc0[_0x1e5d97]={'$like':'%'+_0x174f2b[_0xca15('0x3c')][_0xca15('0x84')]+'%'};return _0x3dacc0;})});}if(_0x174f2b[_0xca15('0x3c')][_0xca15('0x7d')]){var _0x1467b5=_0x174f2b['query'][_0xca15('0x7d')][_0xca15('0x6b')](',');var _0x319a20={};_0x319a20[_0x1467b5[0x0]]={'$gte':moment(_0x1467b5[0x1])[_0xca15('0xc3')](_0xca15('0xc4'))};_0x37f262[_0xca15('0x47')]=_[_0xca15('0x9a')](_0x37f262[_0xca15('0x47')],_0x319a20);}_0x37f262=_['merge']({},_0x37f262,_0x174f2b[_0xca15('0xba')]);return db[_0xca15('0xbe')][_0xca15('0x23')]({'where':_0x37f262['where']})['then'](function(_0x346df8){_0x431d97[_0xca15('0x23')]=_0x346df8;if(_0x174f2b['query']['includeAll']){_0x37f262[_0xca15('0xb9')]=[{'all':!![]}];}return db[_0xca15('0xbe')][_0xca15('0xc5')](_0x37f262);})[_0xca15('0x2c')](function(_0x260840){_0x431d97['rows']=_0x260840;return _0x431d97;});}})[_0xca15('0x2c')](respondWithFilteredResult(_0x4a6974,_0x37f262))[_0xca15('0xb5')](handleError(_0x4a6974,null));};exports[_0xca15('0xc6')]=function(_0x534f39,_0x37053b,_0x37e311){return db[_0xca15('0x37')][_0xca15('0x63')]({'where':{'id':_0x534f39[_0xca15('0xb7')]['id']}})[_0xca15('0x2c')](handleEntityNotFound(_0x37053b,null))[_0xca15('0x2c')](function(_0x3cb9d2){if(_0x3cb9d2){return _0x3cb9d2['setTags'](_0x534f39[_0xca15('0x77')][_0xca15('0xbf')],_[_0xca15('0xc0')](_0x534f39[_0xca15('0x77')],[_0xca15('0xbf'),'id'])||{})[_0xca15('0xc7')](function(){return db[_0xca15('0x70')]['findAll']({'attributes':['id',_0xca15('0x30'),_0xca15('0x4b')],'where':{'id':_0x534f39[_0xca15('0x77')]['ids']}});})['then'](function(_0x2dcf7f){socket[_0xca15('0xc8')](_0xca15('0xc9'),{'id':Number(_0x534f39['params']['id']),'tags':_0x2dcf7f||[]});return{'id':Number(_0x534f39[_0xca15('0xb7')]['id']),'tags':_0x2dcf7f||[]};});}})[_0xca15('0x2c')](respondWithResult(_0x37053b,null))[_0xca15('0xb5')](handleError(_0x37053b,null));};exports[_0xca15('0xca')]=function(_0x103597,_0x30912f,_0x5c77a4){return db[_0xca15('0x37')][_0xca15('0x63')]({'where':{'id':_0x103597[_0xca15('0xb7')]['id']}})[_0xca15('0x2c')](handleEntityNotFound(_0x30912f,null))[_0xca15('0x2c')](function(_0x3aaa9d){if(_0x3aaa9d){return _0x3aaa9d['removeTags'](_0x103597['query']['ids']);}})[_0xca15('0x2c')](respondWithStatusCode(_0x30912f,null))[_0xca15('0xb5')](handleError(_0x30912f,null));};exports[_0xca15('0xcb')]=function(_0x484466,_0x14dc9b){var _0x401f49=moment()[_0xca15('0xcc')]()[_0xca15('0xae')]();var _0x3bbe5b=path['join'](config[_0xca15('0xcd')],'server','files',_0xca15('0xce'));var _0x7781ee=path['join'](config[_0xca15('0xcd')],_0xca15('0xcf'),'files',_0xca15('0xd0'));var _0x36261d=path['join'](_0x3bbe5b,_0x401f49);var _0x2d03ae=util[_0xca15('0xc3')](_0xca15('0xd1'),_0x484466['params']['id'],_0x401f49);var _0x445cb6=path[_0xca15('0xd2')](_0x3bbe5b,_0x2d03ae);var _0x43a2a7=[];_0x43a2a7[_0xca15('0xb2')]({'model':db['User'],'as':_0xca15('0x73'),'attributes':['id','fullname'],'raw':!![]});_0x43a2a7[_0xca15('0xb2')]({'model':db[_0xca15('0xd3')],'as':_0xca15('0x69'),'attributes':['id',_0xca15('0xd4'),'lastName'],'raw':!![]});if(_0x484466[_0xca15('0x3c')][_0xca15('0xd0')]){_0x43a2a7[_0xca15('0xb2')]({'model':db[_0xca15('0xd5')],'as':'Attachment','raw':!![]});}var _0x3d3306=[{'model':db[_0xca15('0xbe')],'as':_0xca15('0xd6'),'attributes':['id',_0xca15('0x77'),_0xca15('0xd7'),_0xca15('0xd8'),'secret',_0xca15('0x80')],'include':_0x43a2a7}];_0x3d3306[_0xca15('0xb2')]({'model':db[_0xca15('0xd9')],'as':_0xca15('0xda'),'attributes':['id','name']});_0x3d3306[_0xca15('0xb2')]({'model':db['User'],'as':_0xca15('0xdb'),'attributes':['id',_0xca15('0x32')]});return db['OpenchannelInteraction'][_0xca15('0x63')]({'where':{'id':_0x484466[_0xca15('0xb7')]['id']},'include':_0x3d3306})[_0xca15('0x2c')](handleEntityNotFound(_0x14dc9b,null))[_0xca15('0x2c')](function(_0x54a582){if(_0x54a582){var _0xb116=_0x54a582[_0xca15('0xdc')]({'plain':!![]});fs[_0xca15('0xdd')](_0x36261d);var _0x28df56={'channel':_0xca15('0xde'),'account':_0xb116[_0xca15('0xda')][_0xca15('0x30')],'agent':_0xb116[_0xca15('0xdb')]?_0xb116[_0xca15('0xdb')][_0xca15('0x32')]:'N.A.','createdAt':moment(_0xb116[_0xca15('0xd7')])[_0xca15('0xc3')](_0xca15('0xc4'))[_0xca15('0xae')](),'closedAt':_0xb116[_0xca15('0xdf')]?moment(_0xb116[_0xca15('0xe0')])['format'](_0xca15('0xc4'))[_0xca15('0xae')]():'','disposition':_0xb116[_0xca15('0xe1')],'visibility':_0xb116[_0xca15('0xe2')]?_0xca15('0xe3'):_0xca15('0xe4'),'messages':_(_0xb116[_0xca15('0xd6')])[_0xca15('0x84')]({'secret':![]})[_0xca15('0x36')](function(_0x31a664){if(_0x31a664[_0xca15('0xd5')]){var _0x1fd446=path[_0xca15('0xd2')](_0x7781ee,_0x31a664[_0xca15('0xd5')][_0xca15('0xe5')]);if(fs[_0xca15('0xe6')](_0x1fd446)){fs[_0xca15('0xe7')](_0x1fd446)[_0xca15('0xe8')](fs[_0xca15('0xe9')](path[_0xca15('0xd2')](_0x36261d,_0x31a664[_0xca15('0xd5')][_0xca15('0xe5')])));}}return{'date':moment(_0x31a664[_0xca15('0xd7')])[_0xca15('0xc3')](_0xca15('0xc4'))[_0xca15('0xae')](),'sender':_0x31a664[_0xca15('0xd8')]==='out'?_0x31a664[_0xca15('0x73')]?_0x31a664[_0xca15('0x73')][_0xca15('0x32')]:_0xca15('0xea'):_0x31a664['Contact'][_0xca15('0xd4')]+(_0x31a664[_0xca15('0x69')][_0xca15('0xeb')]?'\x20'+_0x31a664[_0xca15('0x69')]['lastName']:''),'body':_0x31a664[_0xca15('0xd5')]?_0x31a664[_0xca15('0xd5')][_0xca15('0xe5')]:_0x31a664[_0xca15('0x77')],'direction':_0x31a664[_0xca15('0xd8')]===_0xca15('0xec')?'A':'C','secret':_0x31a664[_0xca15('0xed')],'read':_0x31a664['read'],'attachment':_0x31a664['Attachment']};})[_0xca15('0x65')]()};return ejs['renderFile'](path[_0xca15('0xd2')](config[_0xca15('0xcd')],_0xca15('0xcf'),_0xca15('0xee'),_0xca15('0xef')),{'interaction':_0x28df56})['then'](function(_0x54f2bb){var _0x49076b=path[_0xca15('0xd2')](_0x36261d,'transcript-'+_0xb116['id']+'-'+_0x401f49+_0xca15('0xf0'));var _0x49cb98={'path':_0x49076b,'channel':_0xca15('0xde'),'interactionId':_0xb116['id']};return pdf[_0xca15('0xf1')](_0x54f2bb,_0x49cb98);})['then'](function(){return new BPromise(function(_0x551ef0,_0x538c94){zipdir(_0x36261d,{'saveTo':_0x445cb6},function(_0x37543e,_0x3bf784){if(_0x37543e)return _0x538c94(_0x37543e);return _0x551ef0(_0x3bf784);});})[_0xca15('0x2c')](function(){return new BPromise(function(_0xb20c7d,_0x3f7d96){rimraf(_0x36261d,function(_0x568940){if(_0x568940)_0x3f7d96(_0x568940);return _0xb20c7d();});});})[_0xca15('0x2c')](function(){return _0x14dc9b[_0xca15('0xcb')](_0x445cb6,_0x2d03ae,function(_0x5b90de){if(_0x5b90de){console[_0xca15('0xf2')](_0xca15('0xf3'),_0x5b90de);}else{fs[_0xca15('0xf4')](_0x445cb6);}});});});}else{return _0x14dc9b[_0xca15('0x1f')](0xc8);}})[_0xca15('0xb5')](handleError(_0x14dc9b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8964220..4a9af53 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 _0x651e=['setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction'];(function(_0x36199a,_0x4f756c){var _0x5b36f1=function(_0x29480d){while(--_0x29480d){_0x36199a['push'](_0x36199a['shift']());}};_0x5b36f1(++_0x4f756c);}(_0x651e,0x15d));var _0xe651=function(_0x384337,_0x1fdebf){_0x384337=_0x384337-0x0;var _0x2270a8=_0x651e[_0x384337];return _0x2270a8;};'use strict';var EventEmitter=require(_0xe651('0x0'));var OpenchannelInteraction=require(_0xe651('0x1'))['db'][_0xe651('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe651('0x3')](0x0);var events={'afterCreate':_0xe651('0x4'),'afterUpdate':_0xe651('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2bd51a){return function(_0x447883,_0x73557,_0x1dee10){_0x447883[_0xe651('0x6')]({'attributes':['id'],'raw':!![]})[_0xe651('0x7')](function(_0x4ea37f){_0x447883[_0xe651('0x8')](_0xe651('0x9'),_0x4ea37f['map'](function(_0x179d14){return{'id':_0x179d14['id']};}));return OpenchannelMessage[_0xe651('0xa')]({'where':{'OpenchannelInteractionId':_0x447883['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe651('0x7')](function(_0x52c279){_0x447883['setDataValue'](_0xe651('0xb'),_0x52c279['length']);OpenchannelInteractionEvents[_0xe651('0xc')](_0x2bd51a+':'+_0x447883['id'],_0x447883);OpenchannelInteractionEvents[_0xe651('0xc')](_0x2bd51a,_0x447883);_0x1dee10(null);})[_0xe651('0xd')](_0x1dee10(null));};}for(var e in events){if(events[_0xe651('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xe651('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc1d1=['update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xc1d1,0x189));var _0x1c1d=function(_0x451ebf,_0x251adb){_0x451ebf=_0x451ebf-0x0;var _0x591907=_0xc1d1[_0x451ebf];return _0x591907;};'use strict';var EventEmitter=require(_0x1c1d('0x0'));var OpenchannelInteraction=require(_0x1c1d('0x1'))['db'][_0x1c1d('0x2')];var OpenchannelMessage=require(_0x1c1d('0x1'))['db'][_0x1c1d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1c1d('0x4')](0x0);var events={'afterCreate':_0x1c1d('0x5'),'afterUpdate':_0x1c1d('0x6'),'afterDestroy':_0x1c1d('0x7')};function emitEvent(_0x484ce4){return function(_0x2bf833,_0x3288c3,_0x11b7d0){_0x2bf833[_0x1c1d('0x8')]({'attributes':['id'],'raw':!![]})[_0x1c1d('0x9')](function(_0x5d0f09){_0x2bf833[_0x1c1d('0xa')](_0x1c1d('0xb'),_0x5d0f09[_0x1c1d('0xc')](function(_0x3e3867){return{'id':_0x3e3867['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2bf833['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f9d0b){_0x2bf833[_0x1c1d('0xa')](_0x1c1d('0xd'),_0x3f9d0b['length']);OpenchannelInteractionEvents['emit'](_0x484ce4+':'+_0x2bf833['id'],_0x2bf833);OpenchannelInteractionEvents[_0x1c1d('0xe')](_0x484ce4,_0x2bf833);_0x11b7d0(null);})[_0x1c1d('0xf')](_0x11b7d0(null));};}for(var e in events){if(events[_0x1c1d('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x1c1d('0x11')](e,emitEvent(event));}}module[_0x1c1d('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c186f60..bdf59a8 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 _0x8168=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x568f24,_0x227193){var _0x45fb6c=function(_0x1259e2){while(--_0x1259e2){_0x568f24['push'](_0x568f24['shift']());}};_0x45fb6c(++_0x227193);}(_0x8168,0x8c));var _0x8816=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x8168[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0x8816('0x0'));var util=require(_0x8816('0x1'));var logger=require(_0x8816('0x2'))(_0x8816('0x3'));var moment=require(_0x8816('0x4'));var BPromise=require(_0x8816('0x5'));var rp=require(_0x8816('0x6'));var fs=require('fs');var path=require(_0x8816('0x7'));var rimraf=require(_0x8816('0x8'));var config=require(_0x8816('0x9'));var attributes=require('./openchannelInteraction.attributes');module[_0x8816('0xa')]=function(_0x3e0814,_0x33d3d0){return _0x3e0814[_0x8816('0xb')](_0x8816('0xc'),attributes,{'tableName':_0x8816('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8816('0xe'),'collate':_0x8816('0xf'),'hooks':{'beforeUpdate':function(_0xafafd8,_0x1cf509,_0x533cd2){if(_0xafafd8['changed']('closed')){_0xafafd8[_0x8816('0x10')]=moment()['format'](_0x8816('0x11'));}_0x533cd2(null,_0xafafd8);}}});}; \ No newline at end of file +var _0x3b3f=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b3f,0x1e0));var _0xf3b3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3b3f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf3b3('0x0'));var util=require(_0xf3b3('0x1'));var logger=require(_0xf3b3('0x2'))(_0xf3b3('0x3'));var moment=require(_0xf3b3('0x4'));var BPromise=require(_0xf3b3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3b3('0x6'));var rimraf=require(_0xf3b3('0x7'));var config=require(_0xf3b3('0x8'));var attributes=require(_0xf3b3('0x9'));module[_0xf3b3('0xa')]=function(_0x5a9ad3,_0x563c4d){return _0x5a9ad3[_0xf3b3('0xb')](_0xf3b3('0xc'),attributes,{'tableName':_0xf3b3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf3b3('0xe'),'collate':_0xf3b3('0xf'),'hooks':{'beforeUpdate':function(_0x56ce68,_0x23fcc3,_0x54af1f){if(_0x56ce68[_0xf3b3('0x10')]('closed')){_0x56ce68[_0xf3b3('0x11')]=moment()[_0xf3b3('0x12')](_0xf3b3('0x13'));}_0x54af1f(null,_0x56ce68);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 176f044..72f42b4 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 _0xc893=['result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','catch','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x123719,_0x21206e){var _0x15f7a1=function(_0x599350){while(--_0x599350){_0x123719['push'](_0x123719['shift']());}};_0x15f7a1(++_0x21206e);}(_0xc893,0x138));var _0x3c89=function(_0x843f68,_0x5ee20a){_0x843f68=_0x843f68-0x0;var _0x22ea58=_0xc893[_0x843f68];return _0x22ea58;};'use strict';var _=require(_0x3c89('0x0'));var util=require('util');var moment=require(_0x3c89('0x1'));var BPromise=require(_0x3c89('0x2'));var rs=require(_0x3c89('0x3'));var fs=require('fs');var Redis=require(_0x3c89('0x4'));var db=require(_0x3c89('0x5'))['db'];var utils=require(_0x3c89('0x6'));var logger=require('../../config/logger')(_0x3c89('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c89('0x8'));var client=jayson['client'][_0x3c89('0x9')]({'port':0x232a});config[_0x3c89('0xa')]=_['defaults'](config[_0x3c89('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c89('0xb'))(new Redis(config[_0x3c89('0xa')]));require(_0x3c89('0xc'))[_0x3c89('0xd')](socket);function respondWithRpcPromise(_0x188d91,_0x4e19f3,_0x508d75){return new BPromise(function(_0x5e4031,_0x53babe){return client[_0x3c89('0xe')](_0x188d91,_0x508d75)[_0x3c89('0xf')](function(_0x270cb3){logger[_0x3c89('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4e19f3,_0x3c89('0x11'));logger[_0x3c89('0x12')](_0x3c89('0x13'),_0x4e19f3,'request\x20sent',JSON['stringify'](_0x270cb3));if(_0x270cb3['error']){if(_0x270cb3[_0x3c89('0x14')][_0x3c89('0x15')]===0x1f4){logger[_0x3c89('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4e19f3,_0x270cb3[_0x3c89('0x14')]['message']);return _0x53babe(_0x270cb3['error'][_0x3c89('0x16')]);}logger['error'](_0x3c89('0x17'),_0x4e19f3,_0x270cb3[_0x3c89('0x14')][_0x3c89('0x16')]);return _0x5e4031(_0x270cb3['error'][_0x3c89('0x16')]);}else{logger['info'](_0x3c89('0x17'),_0x4e19f3,_0x3c89('0x11'));_0x5e4031(_0x270cb3[_0x3c89('0x18')][_0x3c89('0x16')]);}})['catch'](function(_0x5c2d44){logger[_0x3c89('0x14')](_0x3c89('0x17'),_0x4e19f3,_0x5c2d44);_0x53babe(_0x5c2d44);});});}exports[_0x3c89('0x19')]=function(_0x15b882){var _0x7d2925=this;return new Promise(function(_0x2221e9,_0xb66129){return db[_0x3c89('0x1a')][_0x3c89('0x1b')](_0x15b882[_0x3c89('0x1c')],{'raw':_0x15b882[_0x3c89('0x1d')]?_0x15b882[_0x3c89('0x1d')][_0x3c89('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15b882['options']?_0x15b882[_0x3c89('0x1d')][_0x3c89('0x1f')]||null:null,'attributes':_0x15b882['options']?_0x15b882[_0x3c89('0x1d')][_0x3c89('0x20')]||null:null,'limit':_0x15b882[_0x3c89('0x1d')]?_0x15b882[_0x3c89('0x1d')][_0x3c89('0x21')]||null:null})[_0x3c89('0xf')](function(_0x30ec62){logger[_0x3c89('0x10')](_0x3c89('0x19'),_0x15b882);logger[_0x3c89('0x12')](_0x3c89('0x19'),_0x15b882,JSON[_0x3c89('0x22')](_0x30ec62));_0x2221e9(_0x30ec62);})[_0x3c89('0x23')](function(_0x3c5d42){logger['error'](_0x3c89('0x19'),_0x3c5d42[_0x3c89('0x16')],_0x15b882);_0xb66129(_0x7d2925[_0x3c89('0x14')](0x1f4,_0x3c5d42['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4b73c3){return new Promise(function(_0x2a711f,_0x693842){return db[_0x3c89('0x1a')][_0x3c89('0x24')]({'where':_0x4b73c3[_0x3c89('0x1d')]?_0x4b73c3[_0x3c89('0x1d')][_0x3c89('0x1f')]||null:null})['then'](function(_0x490d6f){if(_0x490d6f){return _0x490d6f[_0x3c89('0x25')](_0x4b73c3[_0x3c89('0x1c')][_0x3c89('0x26')],_[_0x3c89('0x27')](_0x4b73c3['body'],[_0x3c89('0x26'),'id'])||{});}})[_0x3c89('0x28')](function(_0x5525ee){logger[_0x3c89('0x10')](_0x3c89('0x29'),_0x4b73c3);logger['debug']('AddTags',_0x4b73c3,JSON[_0x3c89('0x22')](_0x5525ee));_0x2a711f(_0x5525ee);})[_0x3c89('0x23')](function(_0xa78829){logger[_0x3c89('0x14')](_0x3c89('0x29'),_0xa78829['message'],_0x4b73c3);_0x693842(_this[_0x3c89('0x14')](0x1f4,_0xa78829[_0x3c89('0x16')]));});});}; \ No newline at end of file +var _0x9f9e=['where','addTags','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','limit','stringify','find'];(function(_0x101f97,_0x5bb72e){var _0x137bcb=function(_0x16aeae){while(--_0x16aeae){_0x101f97['push'](_0x101f97['shift']());}};_0x137bcb(++_0x5bb72e);}(_0x9f9e,0x187));var _0xe9f9=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x9f9e[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0xe9f9('0x0'));var util=require(_0xe9f9('0x1'));var moment=require(_0xe9f9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9f9('0x3'));var fs=require('fs');var Redis=require(_0xe9f9('0x4'));var db=require(_0xe9f9('0x5'))['db'];var utils=require(_0xe9f9('0x6'));var logger=require(_0xe9f9('0x7'))(_0xe9f9('0x8'));var config=require('../../config/environment');var jayson=require(_0xe9f9('0x9'));var client=jayson[_0xe9f9('0xa')][_0xe9f9('0xb')]({'port':0x232a});config[_0xe9f9('0xc')]=_[_0xe9f9('0xd')](config[_0xe9f9('0xc')],{'host':_0xe9f9('0xe'),'port':0x18eb});var socket=require(_0xe9f9('0xf'))(new Redis(config[_0xe9f9('0xc')]));require(_0xe9f9('0x10'))[_0xe9f9('0x11')](socket);function respondWithRpcPromise(_0x4a9bad,_0x1b923a,_0xf9c222){return new BPromise(function(_0x443053,_0x4b1775){return client[_0xe9f9('0x12')](_0x4a9bad,_0xf9c222)[_0xe9f9('0x13')](function(_0x5e6e1d){logger[_0xe9f9('0x14')](_0xe9f9('0x15'),_0x1b923a,_0xe9f9('0x16'));logger[_0xe9f9('0x17')](_0xe9f9('0x18'),_0x1b923a,_0xe9f9('0x16'),JSON['stringify'](_0x5e6e1d));if(_0x5e6e1d[_0xe9f9('0x19')]){if(_0x5e6e1d[_0xe9f9('0x19')][_0xe9f9('0x1a')]===0x1f4){logger[_0xe9f9('0x19')](_0xe9f9('0x15'),_0x1b923a,_0x5e6e1d[_0xe9f9('0x19')][_0xe9f9('0x1b')]);return _0x4b1775(_0x5e6e1d[_0xe9f9('0x19')]['message']);}logger[_0xe9f9('0x19')](_0xe9f9('0x15'),_0x1b923a,_0x5e6e1d[_0xe9f9('0x19')][_0xe9f9('0x1b')]);return _0x443053(_0x5e6e1d['error']['message']);}else{logger[_0xe9f9('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1b923a,_0xe9f9('0x16'));_0x443053(_0x5e6e1d[_0xe9f9('0x1c')][_0xe9f9('0x1b')]);}})[_0xe9f9('0x1d')](function(_0x36ba36){logger[_0xe9f9('0x19')](_0xe9f9('0x15'),_0x1b923a,_0x36ba36);_0x4b1775(_0x36ba36);});});}exports[_0xe9f9('0x1e')]=function(_0x48562b){var _0x7e37c2=this;return new Promise(function(_0x29c9b0,_0x5a7d69){return db[_0xe9f9('0x1f')][_0xe9f9('0x20')](_0x48562b[_0xe9f9('0x21')],{'raw':_0x48562b['options']?_0x48562b['options'][_0xe9f9('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48562b[_0xe9f9('0x23')]?_0x48562b[_0xe9f9('0x23')]['where']||null:null,'attributes':_0x48562b[_0xe9f9('0x23')]?_0x48562b['options']['attributes']||null:null,'limit':_0x48562b[_0xe9f9('0x23')]?_0x48562b[_0xe9f9('0x23')][_0xe9f9('0x24')]||null:null})[_0xe9f9('0x13')](function(_0x5c2d3b){logger[_0xe9f9('0x14')](_0xe9f9('0x1e'),_0x48562b);logger[_0xe9f9('0x17')](_0xe9f9('0x1e'),_0x48562b,JSON[_0xe9f9('0x25')](_0x5c2d3b));_0x29c9b0(_0x5c2d3b);})[_0xe9f9('0x1d')](function(_0x4c8435){logger[_0xe9f9('0x19')](_0xe9f9('0x1e'),_0x4c8435[_0xe9f9('0x1b')],_0x48562b);_0x5a7d69(_0x7e37c2[_0xe9f9('0x19')](0x1f4,_0x4c8435['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x2dc5b9){return new Promise(function(_0x216467,_0x218d35){return db[_0xe9f9('0x1f')][_0xe9f9('0x26')]({'where':_0x2dc5b9[_0xe9f9('0x23')]?_0x2dc5b9['options'][_0xe9f9('0x27')]||null:null})['then'](function(_0x2c3eba){if(_0x2c3eba){return _0x2c3eba[_0xe9f9('0x28')](_0x2dc5b9['body']['ids'],_['omit'](_0x2dc5b9[_0xe9f9('0x21')],['ids','id'])||{});}})[_0xe9f9('0x29')](function(_0x33b413){logger['info'](_0xe9f9('0x2a'),_0x2dc5b9);logger[_0xe9f9('0x17')]('AddTags',_0x2dc5b9,JSON[_0xe9f9('0x25')](_0x33b413));_0x216467(_0x33b413);})[_0xe9f9('0x1d')](function(_0x1a3dad){logger[_0xe9f9('0x19')](_0xe9f9('0x2a'),_0x1a3dad[_0xe9f9('0x1b')],_0x2dc5b9);_0x218d35(_this[_0xe9f9('0x19')](0x1f4,_0x1a3dad[_0xe9f9('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 0bcb2cf..902b317 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 _0x022e=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update'];(function(_0x3870fb,_0x5ab2aa){var _0x5c3058=function(_0xfe54ba){while(--_0xfe54ba){_0x3870fb['push'](_0x3870fb['shift']());}};_0x5c3058(++_0x5ab2aa);}(_0x022e,0x105));var _0xe022=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x022e[_0x2fc012];return _0x2891f9;};'use strict';var OpenchannelInteractionEvents=require(_0xe022('0x0'));var events=['save',_0xe022('0x1'),_0xe022('0x2')];function createListener(_0x56110a,_0xbdd3fb){return function(_0x1fe193){_0xbdd3fb[_0xe022('0x3')](_0x56110a,_0x1fe193);};}function removeListener(_0x20309f,_0x50ced6){return function(){OpenchannelInteractionEvents[_0xe022('0x4')](_0x20309f,_0x50ced6);};}exports[_0xe022('0x5')]=function(_0x118e29){for(var _0x5479d3=0x0,_0x48cae9=events[_0xe022('0x6')];_0x5479d3<_0x48cae9;_0x5479d3++){var _0x169f60=events[_0x5479d3];var _0x2f803f=createListener(_0xe022('0x7')+_0x169f60,_0x118e29);OpenchannelInteractionEvents['on'](_0x169f60,_0x2f803f);}}; \ No newline at end of file +var _0xaf52=['./openchannelInteraction.events','save','emit','removeListener','register'];(function(_0x5b3960,_0xfe48b9){var _0x44288b=function(_0x416930){while(--_0x416930){_0x5b3960['push'](_0x5b3960['shift']());}};_0x44288b(++_0xfe48b9);}(_0xaf52,0x1c2));var _0x2af5=function(_0x528032,_0x5af4a5){_0x528032=_0x528032-0x0;var _0x22f555=_0xaf52[_0x528032];return _0x22f555;};'use strict';var OpenchannelInteractionEvents=require(_0x2af5('0x0'));var events=[_0x2af5('0x1'),'remove','update'];function createListener(_0x1ce14e,_0x241be6){return function(_0x497d4c){_0x241be6[_0x2af5('0x2')](_0x1ce14e,_0x497d4c);};}function removeListener(_0x57e043,_0x8e0ed3){return function(){OpenchannelInteractionEvents[_0x2af5('0x3')](_0x57e043,_0x8e0ed3);};}exports[_0x2af5('0x4')]=function(_0x1d6601){for(var _0x45f21c=0x0,_0x38d558=events['length'];_0x45f21c<_0x38d558;_0x45f21c++){var _0x3f81c2=events[_0x45f21c];var _0x4cd6ec=createListener('openchannelInteraction:'+_0x3f81c2,_0x1d6601);OpenchannelInteractionEvents['on'](_0x3f81c2,_0x4cd6ec);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8ce22ce..cd203a7 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x20f3bc,_0x34c2fd){var _0x2e0502=function(_0x14dd1a){while(--_0x14dd1a){_0x20f3bc['push'](_0x20f3bc['shift']());}};_0x2e0502(++_0x34c2fd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0xcb91[_0x112e2a];return _0x4f8af9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x262f0d,_0x51e151){var _0x21dc30=function(_0x49857c){while(--_0x49857c){_0x262f0d['push'](_0x262f0d['shift']());}};_0x21dc30(++_0x51e151);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ce4e290..a58cfeb 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 _0xefe3=['BOOLEAN','ENUM','out','DATE','TEXT','sequelize'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3efe('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3efe('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3efe('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3efe('0x2')]('in',_0x3efe('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3efe('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3efe('0x5')]}}; \ No newline at end of file +var _0x3da6=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x155429,_0x136cce){var _0x116bff=function(_0x1bec9d){while(--_0x1bec9d){_0x155429['push'](_0x155429['shift']());}};_0x116bff(++_0x136cce);}(_0x3da6,0xc1));var _0x63da=function(_0x2bd440,_0xfb5a9d){_0x2bd440=_0x2bd440-0x0;var _0x58f325=_0x3da6[_0x2bd440];return _0x58f325;};'use strict';var Sequelize=require(_0x63da('0x0'));module[_0x63da('0x1')]={'body':{'type':Sequelize[_0x63da('0x2')](_0x63da('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x63da('0x5')]('in','out'),'defaultValue':_0x63da('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x63da('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x63da('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index de30cd6..f96497e 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 _0x8800=['../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','keys','includeAll','include','find','create','body','params','describe','../../config/logger','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','role','RejectMessage','rejectMessage','ContactId','QueryTypes','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2f61b9,_0x36e9ab){var _0x4b720d=function(_0x136191){while(--_0x136191){_0x2f61b9['push'](_0x2f61b9['shift']());}};_0x4b720d(++_0x36e9ab);}(_0x8800,0x182));var _0x0880=function(_0x17da09,_0xdbb77){_0x17da09=_0x17da09-0x0;var _0x5dc20d=_0x8800[_0x17da09];return _0x5dc20d;};'use strict';var emlformat=require(_0x0880('0x0'));var rimraf=require(_0x0880('0x1'));var zipdir=require(_0x0880('0x2'));var jsonpatch=require(_0x0880('0x3'));var rp=require(_0x0880('0x4'));var moment=require(_0x0880('0x5'));var BPromise=require(_0x0880('0x6'));var Mustache=require(_0x0880('0x7'));var util=require('util');var path=require(_0x0880('0x8'));var sox=require(_0x0880('0x9'));var csv=require(_0x0880('0xa'));var ejs=require(_0x0880('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0880('0xc'));var jsforce=require(_0x0880('0xd'));var deskjs=require(_0x0880('0xe'));var toCsv=require(_0x0880('0xa'));var querystring=require(_0x0880('0xf'));var Papa=require(_0x0880('0x10'));var Redis=require(_0x0880('0x11'));var authService=require(_0x0880('0x12'));var qs=require(_0x0880('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0880('0x14'));var utils=require(_0x0880('0x15'));var config=require(_0x0880('0x16'));var licenseUtil=require(_0x0880('0x17'));var db=require(_0x0880('0x18'))['db'];config['redis']=_[_0x0880('0x19')](config[_0x0880('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0880('0x1b'))(new Redis(config[_0x0880('0x1a')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x0880('0x1c'));var client=jayson['client'][_0x0880('0x1d')]({'port':0x232c});var client9002=jayson[_0x0880('0x1e')][_0x0880('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x31e267,_0x1c2491,_0x2a3731,_0x51020b){return new BPromise(function(_0x554e3a,_0x1d1703){var _0x16157e=_0x51020b||client;return _0x16157e[_0x0880('0x1f')](_0x31e267,_0x2a3731)[_0x0880('0x20')](function(_0x104d53){logger[_0x0880('0x21')](_0x0880('0x22'),_0x1c2491,_0x0880('0x23'));logger[_0x0880('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1c2491,'request\x20sent',JSON[_0x0880('0x25')](_0x104d53));if(_0x104d53['error']){if(_0x104d53['error'][_0x0880('0x26')]===0x1f4){logger[_0x0880('0x27')](_0x0880('0x22'),_0x1c2491,_0x104d53[_0x0880('0x27')][_0x0880('0x28')]);return _0x1d1703(_0x104d53[_0x0880('0x27')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1c2491,_0x104d53[_0x0880('0x27')][_0x0880('0x28')]);return _0x554e3a(_0x104d53[_0x0880('0x27')][_0x0880('0x28')]);}else{logger['info'](_0x0880('0x22'),_0x1c2491,_0x0880('0x23'));_0x554e3a(_0x104d53[_0x0880('0x29')][_0x0880('0x28')]);}})[_0x0880('0x2a')](function(_0x558cfe){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1c2491,_0x558cfe);_0x1d1703(_0x558cfe);});});}function respondWithStatusCode(_0x1c930f,_0x51d6a3){_0x51d6a3=_0x51d6a3||0xcc;return function(_0x305f6e){if(_0x305f6e){return _0x1c930f['sendStatus'](_0x51d6a3);}return _0x1c930f[_0x0880('0x2b')](_0x51d6a3)['end']();};}function respondWithResult(_0x2827e1,_0x14831a){_0x14831a=_0x14831a||0xc8;return function(_0x54d235){if(_0x54d235){return _0x2827e1['status'](_0x14831a)['json'](_0x54d235);}};}function respondWithFilteredResult(_0x490fcb,_0x45ad16){return function(_0x293036){if(_0x293036){var _0x374e34=typeof _0x45ad16[_0x0880('0x2c')]===_0x0880('0x2d')&&typeof _0x45ad16[_0x0880('0x2e')]===_0x0880('0x2d');var _0x360bfa=_0x293036[_0x0880('0x2f')];var _0x34bf9d=_0x374e34?0x0:_0x45ad16[_0x0880('0x2c')];var _0x2a0ccd=_0x374e34?_0x293036[_0x0880('0x2f')]:_0x45ad16['offset']+_0x45ad16[_0x0880('0x2e')];var _0x513a7f;if(_0x2a0ccd>=_0x360bfa){_0x2a0ccd=_0x360bfa;_0x513a7f=0xc8;}else{_0x513a7f=0xce;}_0x490fcb[_0x0880('0x2b')](_0x513a7f);return _0x490fcb[_0x0880('0x30')](_0x0880('0x31'),_0x34bf9d+'-'+_0x2a0ccd+'/'+_0x360bfa)[_0x0880('0x32')](_0x293036);}return null;};}function patchUpdates(_0x1e4291){return function(_0x3ca855){try{jsonpatch[_0x0880('0x33')](_0x3ca855,_0x1e4291,!![]);}catch(_0x50b581){return BPromise['reject'](_0x50b581);}return _0x3ca855[_0x0880('0x34')]();};}function saveUpdates(_0x1386a7,_0x24eb65){return function(_0x5a00e0){if(_0x5a00e0){return _0x5a00e0[_0x0880('0x35')](_0x1386a7)[_0x0880('0x20')](function(_0x1a5a22){return _0x1a5a22;});}return null;};}function removeEntity(_0x5680e9,_0x3c6e55){return function(_0x4c6466){if(_0x4c6466){return _0x4c6466[_0x0880('0x36')]()[_0x0880('0x20')](function(){_0x5680e9[_0x0880('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x518415,_0xd2fcc5){return function(_0xfdc89c){if(!_0xfdc89c){_0x518415[_0x0880('0x37')](0x194);}return _0xfdc89c;};}function handleError(_0x4dffbb,_0x168980){_0x168980=_0x168980||0x1f4;return function(_0x3fee02){logger[_0x0880('0x27')](_0x3fee02[_0x0880('0x38')]);if(_0x3fee02[_0x0880('0x39')]){delete _0x3fee02[_0x0880('0x39')];}_0x4dffbb[_0x0880('0x2b')](_0x168980)[_0x0880('0x3a')](_0x3fee02);};}exports[_0x0880('0x3b')]=function(_0x392269,_0x43798f){var _0x3c369c={},_0x17084e={},_0x138646={'count':0x0,'rows':[]};var _0xcb22bd=_['map'](db[_0x0880('0x3c')][_0x0880('0x3d')],function(_0x341095){return{'name':_0x341095[_0x0880('0x3e')],'type':_0x341095[_0x0880('0x3f')]['key']};});_0x17084e[_0x0880('0x40')]=_[_0x0880('0x41')](_0xcb22bd,_0x0880('0x39'));_0x17084e[_0x0880('0x42')]=_['keys'](_0x392269[_0x0880('0x42')]);_0x17084e[_0x0880('0x43')]=_[_0x0880('0x44')](_0x17084e[_0x0880('0x40')],_0x17084e['query']);_0x3c369c[_0x0880('0x45')]=_[_0x0880('0x44')](_0x17084e[_0x0880('0x40')],qs['fields'](_0x392269[_0x0880('0x42')][_0x0880('0x46')]));_0x3c369c[_0x0880('0x45')]=_0x3c369c[_0x0880('0x45')][_0x0880('0x47')]?_0x3c369c['attributes']:_0x17084e[_0x0880('0x40')];if(!_0x392269['query'][_0x0880('0x48')](_0x0880('0x49'))){_0x3c369c[_0x0880('0x2e')]=qs[_0x0880('0x2e')](_0x392269[_0x0880('0x42')][_0x0880('0x2e')]);_0x3c369c[_0x0880('0x2c')]=qs['offset'](_0x392269[_0x0880('0x42')]['offset']);}_0x3c369c['order']=qs[_0x0880('0x4a')](_0x392269['query'][_0x0880('0x4a')]);_0x3c369c[_0x0880('0x4b')]=qs[_0x0880('0x43')](_[_0x0880('0x4c')](_0x392269[_0x0880('0x42')],_0x17084e[_0x0880('0x43')]),_0xcb22bd);if(_0x392269[_0x0880('0x42')][_0x0880('0x4d')]){_0x3c369c[_0x0880('0x4b')]=_[_0x0880('0x4e')](_0x3c369c['where'],{'$or':_[_0x0880('0x41')](_0xcb22bd,function(_0x5ebc5f){if(_0x5ebc5f['type']!==_0x0880('0x4f')){var _0x26227b={};_0x26227b[_0x5ebc5f[_0x0880('0x39')]]={'$like':'%'+_0x392269['query'][_0x0880('0x4d')]+'%'};return _0x26227b;}})});}_0x3c369c=_[_0x0880('0x4e')]({},_0x3c369c,_0x392269[_0x0880('0x50')]);var _0x3cf2db={'where':_0x3c369c['where']};return db[_0x0880('0x3c')]['count'](_0x3cf2db)[_0x0880('0x20')](function(_0x4c62d6){_0x138646['count']=_0x4c62d6;if(_0x392269[_0x0880('0x42')]['includeAll']){_0x3c369c['include']=[{'all':!![]}];}return db[_0x0880('0x3c')][_0x0880('0x51')](_0x3c369c);})['then'](function(_0x39862f){_0x138646[_0x0880('0x52')]=_0x39862f;return _0x138646;})['then'](respondWithFilteredResult(_0x43798f,_0x3c369c))[_0x0880('0x2a')](handleError(_0x43798f,null));};exports[_0x0880('0x53')]=function(_0x2204f6,_0x23659b){var _0x568f61={'raw':!![],'where':{'id':_0x2204f6['params']['id']}},_0xc6ff9a={};_0xc6ff9a[_0x0880('0x40')]=_[_0x0880('0x54')](db['OpenchannelMessage'][_0x0880('0x3d')]);_0xc6ff9a['query']=_[_0x0880('0x54')](_0x2204f6[_0x0880('0x42')]);_0xc6ff9a[_0x0880('0x43')]=_[_0x0880('0x44')](_0xc6ff9a[_0x0880('0x40')],_0xc6ff9a[_0x0880('0x42')]);_0x568f61[_0x0880('0x45')]=_[_0x0880('0x44')](_0xc6ff9a[_0x0880('0x40')],qs['fields'](_0x2204f6[_0x0880('0x42')]['fields']));_0x568f61[_0x0880('0x45')]=_0x568f61[_0x0880('0x45')]['length']?_0x568f61['attributes']:_0xc6ff9a[_0x0880('0x40')];if(_0x2204f6[_0x0880('0x42')][_0x0880('0x55')]){_0x568f61[_0x0880('0x56')]=[{'all':!![]}];}_0x568f61=_[_0x0880('0x4e')]({},_0x568f61,_0x2204f6[_0x0880('0x50')]);return db[_0x0880('0x3c')][_0x0880('0x57')](_0x568f61)[_0x0880('0x20')](handleEntityNotFound(_0x23659b,null))[_0x0880('0x20')](respondWithResult(_0x23659b,null))[_0x0880('0x2a')](handleError(_0x23659b,null));};exports[_0x0880('0x58')]=function(_0x277e7f,_0x1b9e83){return db['OpenchannelMessage'][_0x0880('0x58')](_0x277e7f['body'],{})[_0x0880('0x20')](respondWithResult(_0x1b9e83,0xc9))[_0x0880('0x2a')](handleError(_0x1b9e83,null));};exports['update']=function(_0x44e268,_0x1c750a){if(_0x44e268[_0x0880('0x59')]['id']){delete _0x44e268[_0x0880('0x59')]['id'];}return db[_0x0880('0x3c')][_0x0880('0x57')]({'where':{'id':_0x44e268[_0x0880('0x5a')]['id']}})[_0x0880('0x20')](handleEntityNotFound(_0x1c750a,null))[_0x0880('0x20')](saveUpdates(_0x44e268['body'],null))[_0x0880('0x20')](respondWithResult(_0x1c750a,null))[_0x0880('0x2a')](handleError(_0x1c750a,null));};exports[_0x0880('0x36')]=function(_0x3b16d3,_0x361947){return db[_0x0880('0x3c')]['find']({'where':{'id':_0x3b16d3[_0x0880('0x5a')]['id']}})['then'](handleEntityNotFound(_0x361947,null))[_0x0880('0x20')](removeEntity(_0x361947,null))[_0x0880('0x2a')](handleError(_0x361947,null));};exports[_0x0880('0x5b')]=function(_0x516348,_0x4f1cc0){return db[_0x0880('0x3c')]['describe']()[_0x0880('0x20')](respondWithResult(_0x4f1cc0,null))[_0x0880('0x2a')](handleError(_0x4f1cc0,null));};var interaction_log=require(_0x0880('0x5c'))(_0x0880('0x5d'));exports[_0x0880('0x5e')]=function(_0x50ef5b,_0x273c9b,_0x543f77){var _0x296ecd={'agent':{},'channel':_0x0880('0x5f')};if(_0x50ef5b['body']['id']){delete _0x50ef5b[_0x0880('0x59')]['id'];}_0x50ef5b['body']['read']=!![];_0x50ef5b['body'][_0x0880('0x60')]=moment()[_0x0880('0x61')](_0x0880('0x62'));_0x50ef5b[_0x0880('0x59')][_0x0880('0x63')]=_0x50ef5b[_0x0880('0x59')][_0x0880('0x63')]||_0x50ef5b[_0x0880('0x64')]['id'];_0x296ecd[_0x0880('0x65')]['id']=_0x50ef5b[_0x0880('0x59')][_0x0880('0x63')];return db[_0x0880('0x3c')][_0x0880('0x57')]({'where':{'id':_0x50ef5b[_0x0880('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x273c9b,null))['then'](saveUpdates(_0x50ef5b[_0x0880('0x59')],null))[_0x0880('0x20')](function(_0x49fbf2){if(_0x49fbf2){_0x296ecd[_0x0880('0x28')]=_0x49fbf2[_0x0880('0x66')]({'plain':!![]});return db[_0x0880('0x67')][_0x0880('0x57')]({'where':{'id':_0x49fbf2[_0x0880('0x68')]}});}return null;})[_0x0880('0x20')](handleEntityNotFound(_0x273c9b,null))[_0x0880('0x20')](function(_0x48fbbd){if(_0x48fbbd){return _0x48fbbd['update']({'UserId':_0x50ef5b['body']['UserId'],'read1stAt':_['isNil'](_0x48fbbd[_0x0880('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0880('0x20')](function(_0x59e853){if(_0x59e853){_0x296ecd['interaction']=_0x59e853[_0x0880('0x66')]({'plain':!![]});interaction_log[_0x0880('0x21')](_0x0880('0x6a'),_0x50ef5b['user']['id'],_0x50ef5b[_0x0880('0x64')][_0x0880('0x39')],_0x50ef5b[_0x0880('0x64')]['role'],_0x296ecd[_0x0880('0x6b')]['id'],_0x50ef5b[_0x0880('0x59')]?JSON['stringify'](_0x50ef5b[_0x0880('0x59')]):_0x0880('0x6c'));return respondWithRpcPromise(_0x0880('0x6d'),_0x0880('0x6e'),_0x296ecd);}return null;})[_0x0880('0x20')](function(_0x415591){var _0x2559d2=_0x0880('0x6f')+_0x415591[_0x0880('0x28')]['ContactId'];return db[_0x0880('0x70')][_0x0880('0x42')](_0x2559d2,{'type':db[_0x0880('0x71')]['QueryTypes'][_0x0880('0x72')],'raw':!![]})[_0x0880('0x20')](function(_0x190c47){return _0x190c47;});})[_0x0880('0x20')](function(_0x4eaa3c){if(_0x4eaa3c){_0x296ecd[_0x0880('0x28')][_0x0880('0x73')]=_0x4eaa3c[0x0];if(!_0x50ef5b[_0x0880('0x59')][_0x0880('0x63')])return;return db[_0x0880('0x74')][_0x0880('0x57')]({'where':{'id':_0x50ef5b['body'][_0x0880('0x63')],'role':_0x0880('0x65')},'attributes':['id','name',_0x0880('0x75'),_0x0880('0x76'),_0x0880('0x77')],'raw':!![]});}return null;})[_0x0880('0x20')](function(_0x162653){if(!_0x162653)return null;_0x296ecd[_0x0880('0x28')]['agent']=_0x162653;return _0x296ecd;})[_0x0880('0x20')](function(_0x5ac54d){if(_0x5ac54d){if(_0x50ef5b['body'][_0x0880('0x78')]){_0x296ecd[_0x0880('0x28')][_0x0880('0x79')]=util[_0x0880('0x61')](_0x0880('0x7a'),_0x50ef5b[_0x0880('0x64')][_0x0880('0x39')]);_0x296ecd[_0x0880('0x28')][_0x0880('0x7b')]=_0x296ecd[_0x0880('0x7b')];_0x296ecd[_0x0880('0x28')][_0x0880('0x7c')]=_0x296ecd[_0x0880('0x7b')];_0x296ecd[_0x0880('0x28')][_0x0880('0x7d')]=_0x0880('0x5e');return respondWithRpcPromise(_0x0880('0x7e'),'EventManager',{'event':_0x0880('0x7f'),'message':_0x296ecd[_0x0880('0x28')]},client9002)[_0x0880('0x20')](function(){return _0x296ecd;});}return _0x296ecd;}return null;})['then'](respondWithResult(_0x273c9b,null))['catch'](handleError(_0x273c9b,null));};var interaction_log=require(_0x0880('0x5c'))('openchannel-interactions');exports[_0x0880('0x80')]=function(_0x3574b9,_0x3260f8,_0x39e2f){var _0xd6935d={'agent':{},'channel':'openchannel'};if(_0x3574b9[_0x0880('0x59')]['id']){delete _0x3574b9[_0x0880('0x59')]['id'];}_0x3574b9['body'][_0x0880('0x63')]=_0x3574b9[_0x0880('0x59')]['UserId']||_0x3574b9[_0x0880('0x64')]['id'];_0xd6935d[_0x0880('0x65')]['id']=_0x3574b9[_0x0880('0x59')][_0x0880('0x63')];return db[_0x0880('0x3c')][_0x0880('0x57')]({'where':{'id':_0x3574b9[_0x0880('0x5a')]['id'],'UserId':null}})[_0x0880('0x20')](handleEntityNotFound(_0x3260f8,null))[_0x0880('0x20')](function(_0x3e85ff){if(_0x3e85ff){_0xd6935d[_0x0880('0x28')]=_0x3e85ff[_0x0880('0x66')]({'plain':!![]});return db[_0x0880('0x67')][_0x0880('0x57')]({'where':{'id':_0x3e85ff['OpenchannelInteractionId']}});}return null;})[_0x0880('0x20')](handleEntityNotFound(_0x3260f8,null))['then'](function(_0x322d44){if(_0x322d44){_0xd6935d['interaction']=_0x322d44[_0x0880('0x66')]({'plain':!![]});interaction_log[_0x0880('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3574b9[_0x0880('0x64')]['id'],_0x3574b9[_0x0880('0x64')][_0x0880('0x39')],_0x3574b9[_0x0880('0x64')][_0x0880('0x81')],_0xd6935d[_0x0880('0x6b')]['id'],_0x3574b9[_0x0880('0x59')]?JSON['stringify'](_0x3574b9[_0x0880('0x59')]):_0x0880('0x6c'));return respondWithRpcPromise(_0x0880('0x82'),_0x0880('0x83'),_0xd6935d);}return null;})['then'](function(_0x5e8d93){var _0x71dafd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e8d93[_0x0880('0x28')][_0x0880('0x84')];return db[_0x0880('0x70')][_0x0880('0x42')](_0x71dafd,{'type':db[_0x0880('0x71')][_0x0880('0x85')][_0x0880('0x72')],'raw':!![]})[_0x0880('0x20')](function(_0x59f868){return _0x59f868;});})[_0x0880('0x20')](function(_0x3f5c16){if(_0x3f5c16){_0xd6935d[_0x0880('0x28')][_0x0880('0x73')]=_0x3f5c16[0x0];if(!_0x3574b9[_0x0880('0x59')][_0x0880('0x63')])return;return db[_0x0880('0x74')][_0x0880('0x57')]({'where':{'id':_0x3574b9[_0x0880('0x59')][_0x0880('0x63')],'role':_0x0880('0x65')},'attributes':['id','name',_0x0880('0x75'),_0x0880('0x76'),_0x0880('0x77')],'raw':!![]});}return null;})[_0x0880('0x20')](function(_0x157fee){if(!_0x157fee)return null;_0xd6935d[_0x0880('0x28')][_0x0880('0x65')]=_0x157fee;return _0xd6935d;})[_0x0880('0x20')](function(_0xeb2bd3){if(_0xeb2bd3){_0xeb2bd3[_0x0880('0x28')][_0x0880('0x79')]=util[_0x0880('0x61')]('SIP/%s',_0x3574b9[_0x0880('0x64')][_0x0880('0x39')]);_0xeb2bd3[_0x0880('0x28')][_0x0880('0x7b')]=_0xd6935d[_0x0880('0x7b')];_0xeb2bd3[_0x0880('0x28')][_0x0880('0x7c')]=_0xd6935d[_0x0880('0x7b')];_0xeb2bd3['message'][_0x0880('0x7d')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x0880('0x86'),'message':_0xeb2bd3['message']},client9002);return _0xd6935d;}return null;})[_0x0880('0x20')](respondWithResult(_0x3260f8,null))['catch'](handleError(_0x3260f8,null));}; \ No newline at end of file +var _0x1fb5=['../../config/logger','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','event','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','apply','save','destroy','sendStatus','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','update'];(function(_0x2d549b,_0x5d45fa){var _0x3a08dd=function(_0x3503c7){while(--_0x3503c7){_0x2d549b['push'](_0x2d549b['shift']());}};_0x3a08dd(++_0x5d45fa);}(_0x1fb5,0xae));var _0x51fb=function(_0x4c2df5,_0x81ef1b){_0x4c2df5=_0x4c2df5-0x0;var _0x31da86=_0x1fb5[_0x4c2df5];return _0x31da86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51fb('0x0'));var zipdir=require(_0x51fb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51fb('0x2'));var moment=require(_0x51fb('0x3'));var BPromise=require(_0x51fb('0x4'));var Mustache=require(_0x51fb('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x51fb('0x6'));var ejs=require(_0x51fb('0x7'));var fs=require('fs');var fs_extra=require(_0x51fb('0x8'));var _=require(_0x51fb('0x9'));var squel=require(_0x51fb('0xa'));var crypto=require(_0x51fb('0xb'));var jsforce=require(_0x51fb('0xc'));var deskjs=require(_0x51fb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x51fb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x51fb('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51fb('0x10'));var logger=require('../../config/logger')(_0x51fb('0x11'));var utils=require(_0x51fb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x51fb('0x13'));var db=require('../../mysqldb')['db'];config[_0x51fb('0x14')]=_['defaults'](config['redis'],{'host':_0x51fb('0x15'),'port':0x18eb});var socket=require(_0x51fb('0x16'))(new Redis(config['redis']));require(_0x51fb('0x17'))[_0x51fb('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x51fb('0x19')]({'port':0x232c});var client9002=jayson['client'][_0x51fb('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x258afe,_0x4c21f7,_0x490b88,_0x5ab455){return new BPromise(function(_0x30a37d,_0x5e7ab3){var _0x301d74=_0x5ab455||client;return _0x301d74[_0x51fb('0x1a')](_0x258afe,_0x490b88)[_0x51fb('0x1b')](function(_0x152895){logger['info'](_0x51fb('0x1c'),_0x4c21f7,_0x51fb('0x1d'));logger[_0x51fb('0x1e')](_0x51fb('0x1f'),_0x4c21f7,_0x51fb('0x1d'),JSON[_0x51fb('0x20')](_0x152895));if(_0x152895[_0x51fb('0x21')]){if(_0x152895[_0x51fb('0x21')][_0x51fb('0x22')]===0x1f4){logger[_0x51fb('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x4c21f7,_0x152895[_0x51fb('0x21')][_0x51fb('0x23')]);return _0x5e7ab3(_0x152895['error'][_0x51fb('0x23')]);}logger[_0x51fb('0x21')](_0x51fb('0x1c'),_0x4c21f7,_0x152895[_0x51fb('0x21')][_0x51fb('0x23')]);return _0x30a37d(_0x152895['error'][_0x51fb('0x23')]);}else{logger[_0x51fb('0x24')](_0x51fb('0x1c'),_0x4c21f7,_0x51fb('0x1d'));_0x30a37d(_0x152895[_0x51fb('0x25')]['message']);}})[_0x51fb('0x26')](function(_0x2632ad){logger[_0x51fb('0x21')](_0x51fb('0x1c'),_0x4c21f7,_0x2632ad);_0x5e7ab3(_0x2632ad);});});}function respondWithStatusCode(_0x5cfc69,_0x39e81c){_0x39e81c=_0x39e81c||0xcc;return function(_0x9b842c){if(_0x9b842c){return _0x5cfc69['sendStatus'](_0x39e81c);}return _0x5cfc69[_0x51fb('0x27')](_0x39e81c)[_0x51fb('0x28')]();};}function respondWithResult(_0x30b3d5,_0x1c697a){_0x1c697a=_0x1c697a||0xc8;return function(_0x1222da){if(_0x1222da){return _0x30b3d5[_0x51fb('0x27')](_0x1c697a)[_0x51fb('0x29')](_0x1222da);}};}function respondWithFilteredResult(_0xae3d08,_0x3012e5){return function(_0xbe31b6){if(_0xbe31b6){var _0x141cc0=typeof _0x3012e5[_0x51fb('0x2a')]===_0x51fb('0x2b')&&typeof _0x3012e5[_0x51fb('0x2c')]===_0x51fb('0x2b');var _0x5df567=_0xbe31b6[_0x51fb('0x2d')];var _0x294157=_0x141cc0?0x0:_0x3012e5[_0x51fb('0x2a')];var _0x7f987e=_0x141cc0?_0xbe31b6[_0x51fb('0x2d')]:_0x3012e5[_0x51fb('0x2a')]+_0x3012e5[_0x51fb('0x2c')];var _0x37466f;if(_0x7f987e>=_0x5df567){_0x7f987e=_0x5df567;_0x37466f=0xc8;}else{_0x37466f=0xce;}_0xae3d08[_0x51fb('0x27')](_0x37466f);return _0xae3d08[_0x51fb('0x2e')]('Content-Range',_0x294157+'-'+_0x7f987e+'/'+_0x5df567)[_0x51fb('0x29')](_0xbe31b6);}return null;};}function patchUpdates(_0x3793d1){return function(_0x480c1f){try{jsonpatch[_0x51fb('0x2f')](_0x480c1f,_0x3793d1,!![]);}catch(_0x371a63){return BPromise['reject'](_0x371a63);}return _0x480c1f[_0x51fb('0x30')]();};}function saveUpdates(_0x51f330,_0x4aecd6){return function(_0x532e0e){if(_0x532e0e){return _0x532e0e['update'](_0x51f330)[_0x51fb('0x1b')](function(_0x3c27bb){return _0x3c27bb;});}return null;};}function removeEntity(_0x2bd587,_0x21413d){return function(_0x3e1a0b){if(_0x3e1a0b){return _0x3e1a0b[_0x51fb('0x31')]()[_0x51fb('0x1b')](function(){_0x2bd587[_0x51fb('0x27')](0xcc)[_0x51fb('0x28')]();});}};}function handleEntityNotFound(_0x1114b3,_0x2c83bf){return function(_0x4eb7b5){if(!_0x4eb7b5){_0x1114b3[_0x51fb('0x32')](0x194);}return _0x4eb7b5;};}function handleError(_0x36c74f,_0x523024){_0x523024=_0x523024||0x1f4;return function(_0xcfd2c7){logger[_0x51fb('0x21')](_0xcfd2c7['stack']);if(_0xcfd2c7[_0x51fb('0x33')]){delete _0xcfd2c7[_0x51fb('0x33')];}_0x36c74f[_0x51fb('0x27')](_0x523024)[_0x51fb('0x34')](_0xcfd2c7);};}exports[_0x51fb('0x35')]=function(_0x21bee8,_0xee32fb){var _0x5055f3={},_0x521257={},_0x3118e7={'count':0x0,'rows':[]};var _0x26be2d=_[_0x51fb('0x36')](db['OpenchannelMessage']['rawAttributes'],function(_0x4852b3){return{'name':_0x4852b3['fieldName'],'type':_0x4852b3[_0x51fb('0x37')][_0x51fb('0x38')]};});_0x521257[_0x51fb('0x39')]=_[_0x51fb('0x36')](_0x26be2d,'name');_0x521257[_0x51fb('0x3a')]=_[_0x51fb('0x3b')](_0x21bee8[_0x51fb('0x3a')]);_0x521257[_0x51fb('0x3c')]=_['intersection'](_0x521257[_0x51fb('0x39')],_0x521257[_0x51fb('0x3a')]);_0x5055f3['attributes']=_[_0x51fb('0x3d')](_0x521257[_0x51fb('0x39')],qs[_0x51fb('0x3e')](_0x21bee8[_0x51fb('0x3a')]['fields']));_0x5055f3[_0x51fb('0x3f')]=_0x5055f3[_0x51fb('0x3f')][_0x51fb('0x40')]?_0x5055f3[_0x51fb('0x3f')]:_0x521257[_0x51fb('0x39')];if(!_0x21bee8[_0x51fb('0x3a')][_0x51fb('0x41')](_0x51fb('0x42'))){_0x5055f3[_0x51fb('0x2c')]=qs[_0x51fb('0x2c')](_0x21bee8[_0x51fb('0x3a')][_0x51fb('0x2c')]);_0x5055f3[_0x51fb('0x2a')]=qs[_0x51fb('0x2a')](_0x21bee8[_0x51fb('0x3a')][_0x51fb('0x2a')]);}_0x5055f3[_0x51fb('0x43')]=qs[_0x51fb('0x44')](_0x21bee8[_0x51fb('0x3a')][_0x51fb('0x44')]);_0x5055f3[_0x51fb('0x45')]=qs[_0x51fb('0x3c')](_['pick'](_0x21bee8[_0x51fb('0x3a')],_0x521257[_0x51fb('0x3c')]),_0x26be2d);if(_0x21bee8['query'][_0x51fb('0x46')]){_0x5055f3['where']=_[_0x51fb('0x47')](_0x5055f3[_0x51fb('0x45')],{'$or':_[_0x51fb('0x36')](_0x26be2d,function(_0x40d07c){if(_0x40d07c[_0x51fb('0x37')]!==_0x51fb('0x48')){var _0x58851f={};_0x58851f[_0x40d07c[_0x51fb('0x33')]]={'$like':'%'+_0x21bee8[_0x51fb('0x3a')][_0x51fb('0x46')]+'%'};return _0x58851f;}})});}_0x5055f3=_[_0x51fb('0x47')]({},_0x5055f3,_0x21bee8[_0x51fb('0x49')]);var _0x32f1e3={'where':_0x5055f3[_0x51fb('0x45')]};return db[_0x51fb('0x4a')][_0x51fb('0x2d')](_0x32f1e3)[_0x51fb('0x1b')](function(_0x7ff9ae){_0x3118e7[_0x51fb('0x2d')]=_0x7ff9ae;if(_0x21bee8[_0x51fb('0x3a')][_0x51fb('0x4b')]){_0x5055f3[_0x51fb('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x51fb('0x4d')](_0x5055f3);})[_0x51fb('0x1b')](function(_0x4a88be){_0x3118e7[_0x51fb('0x4e')]=_0x4a88be;return _0x3118e7;})[_0x51fb('0x1b')](respondWithFilteredResult(_0xee32fb,_0x5055f3))[_0x51fb('0x26')](handleError(_0xee32fb,null));};exports[_0x51fb('0x4f')]=function(_0x5392bf,_0x18a389){var _0x4ac948={'raw':!![],'where':{'id':_0x5392bf[_0x51fb('0x50')]['id']}},_0x4ef075={};_0x4ef075[_0x51fb('0x39')]=_['keys'](db[_0x51fb('0x4a')][_0x51fb('0x51')]);_0x4ef075['query']=_[_0x51fb('0x3b')](_0x5392bf[_0x51fb('0x3a')]);_0x4ef075[_0x51fb('0x3c')]=_[_0x51fb('0x3d')](_0x4ef075[_0x51fb('0x39')],_0x4ef075['query']);_0x4ac948[_0x51fb('0x3f')]=_['intersection'](_0x4ef075[_0x51fb('0x39')],qs[_0x51fb('0x3e')](_0x5392bf[_0x51fb('0x3a')][_0x51fb('0x3e')]));_0x4ac948['attributes']=_0x4ac948[_0x51fb('0x3f')][_0x51fb('0x40')]?_0x4ac948[_0x51fb('0x3f')]:_0x4ef075[_0x51fb('0x39')];if(_0x5392bf[_0x51fb('0x3a')][_0x51fb('0x4b')]){_0x4ac948['include']=[{'all':!![]}];}_0x4ac948=_[_0x51fb('0x47')]({},_0x4ac948,_0x5392bf[_0x51fb('0x49')]);return db[_0x51fb('0x4a')][_0x51fb('0x52')](_0x4ac948)['then'](handleEntityNotFound(_0x18a389,null))[_0x51fb('0x1b')](respondWithResult(_0x18a389,null))[_0x51fb('0x26')](handleError(_0x18a389,null));};exports['create']=function(_0x3c46dd,_0x4c7e64){return db[_0x51fb('0x4a')][_0x51fb('0x53')](_0x3c46dd[_0x51fb('0x54')],{})[_0x51fb('0x1b')](respondWithResult(_0x4c7e64,0xc9))[_0x51fb('0x26')](handleError(_0x4c7e64,null));};exports[_0x51fb('0x55')]=function(_0x2bcec4,_0x4143aa){if(_0x2bcec4[_0x51fb('0x54')]['id']){delete _0x2bcec4['body']['id'];}return db[_0x51fb('0x4a')][_0x51fb('0x52')]({'where':{'id':_0x2bcec4[_0x51fb('0x50')]['id']}})[_0x51fb('0x1b')](handleEntityNotFound(_0x4143aa,null))['then'](saveUpdates(_0x2bcec4[_0x51fb('0x54')],null))[_0x51fb('0x1b')](respondWithResult(_0x4143aa,null))[_0x51fb('0x26')](handleError(_0x4143aa,null));};exports[_0x51fb('0x31')]=function(_0x583d0f,_0x9437b6){return db[_0x51fb('0x4a')][_0x51fb('0x52')]({'where':{'id':_0x583d0f[_0x51fb('0x50')]['id']}})['then'](handleEntityNotFound(_0x9437b6,null))['then'](removeEntity(_0x9437b6,null))[_0x51fb('0x26')](handleError(_0x9437b6,null));};exports['describe']=function(_0x15d722,_0x25f296){return db[_0x51fb('0x4a')]['describe']()[_0x51fb('0x1b')](respondWithResult(_0x25f296,null))['catch'](handleError(_0x25f296,null));};var interaction_log=require(_0x51fb('0x56'))(_0x51fb('0x57'));exports[_0x51fb('0x58')]=function(_0x11efec,_0x346036,_0x337144){var _0x38f8af={'agent':{},'channel':'openchannel'};if(_0x11efec[_0x51fb('0x54')]['id']){delete _0x11efec[_0x51fb('0x54')]['id'];}_0x11efec[_0x51fb('0x54')][_0x51fb('0x59')]=!![];_0x11efec[_0x51fb('0x54')][_0x51fb('0x5a')]=moment()['format'](_0x51fb('0x5b'));_0x11efec[_0x51fb('0x54')][_0x51fb('0x5c')]=_0x11efec[_0x51fb('0x54')]['UserId']||_0x11efec[_0x51fb('0x5d')]['id'];_0x38f8af[_0x51fb('0x5e')]['id']=_0x11efec[_0x51fb('0x54')][_0x51fb('0x5c')];return db['OpenchannelMessage']['find']({'where':{'id':_0x11efec[_0x51fb('0x50')]['id'],'UserId':null}})[_0x51fb('0x1b')](handleEntityNotFound(_0x346036,null))[_0x51fb('0x1b')](saveUpdates(_0x11efec[_0x51fb('0x54')],null))[_0x51fb('0x1b')](function(_0x4d8d0b){if(_0x4d8d0b){_0x38f8af['message']=_0x4d8d0b[_0x51fb('0x5f')]({'plain':!![]});return db[_0x51fb('0x60')]['find']({'where':{'id':_0x4d8d0b[_0x51fb('0x61')]}});}return null;})[_0x51fb('0x1b')](handleEntityNotFound(_0x346036,null))[_0x51fb('0x1b')](function(_0x28637d){if(_0x28637d){return _0x28637d[_0x51fb('0x55')]({'UserId':_0x11efec['body'][_0x51fb('0x5c')],'read1stAt':_[_0x51fb('0x62')](_0x28637d[_0x51fb('0x63')])?moment()[_0x51fb('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x51fb('0x1b')](function(_0x4e7af6){if(_0x4e7af6){_0x38f8af[_0x51fb('0x65')]=_0x4e7af6[_0x51fb('0x5f')]({'plain':!![]});interaction_log[_0x51fb('0x24')](_0x51fb('0x66'),_0x11efec[_0x51fb('0x5d')]['id'],_0x11efec['user'][_0x51fb('0x33')],_0x11efec[_0x51fb('0x5d')][_0x51fb('0x67')],_0x38f8af[_0x51fb('0x65')]['id'],_0x11efec[_0x51fb('0x54')]?JSON[_0x51fb('0x20')](_0x11efec['body']):_0x51fb('0x68'));return respondWithRpcPromise(_0x51fb('0x69'),'acceptMessage',_0x38f8af);}return null;})[_0x51fb('0x1b')](function(_0x5321da){var _0x30167a=_0x51fb('0x6a')+_0x5321da[_0x51fb('0x23')][_0x51fb('0x6b')];return db[_0x51fb('0x6c')]['query'](_0x30167a,{'type':db[_0x51fb('0x6d')][_0x51fb('0x6e')]['SELECT'],'raw':!![]})[_0x51fb('0x1b')](function(_0x6947cd){return _0x6947cd;});})[_0x51fb('0x1b')](function(_0x29df02){if(_0x29df02){_0x38f8af[_0x51fb('0x23')]['contact']=_0x29df02[0x0];if(!_0x11efec['body']['UserId'])return;return db[_0x51fb('0x6f')][_0x51fb('0x52')]({'where':{'id':_0x11efec[_0x51fb('0x54')][_0x51fb('0x5c')],'role':_0x51fb('0x5e')},'attributes':['id',_0x51fb('0x33'),_0x51fb('0x70'),_0x51fb('0x71'),_0x51fb('0x72')],'raw':!![]});}return null;})[_0x51fb('0x1b')](function(_0x59b6b1){if(!_0x59b6b1)return null;_0x38f8af[_0x51fb('0x23')][_0x51fb('0x5e')]=_0x59b6b1;return _0x38f8af;})[_0x51fb('0x1b')](function(_0xc56478){if(_0xc56478){if(_0x11efec['body'][_0x51fb('0x73')]){_0x38f8af[_0x51fb('0x23')][_0x51fb('0x74')]=util['format'](_0x51fb('0x75'),_0x11efec['user'][_0x51fb('0x33')]);_0x38f8af['message'][_0x51fb('0x76')]=_0x38f8af[_0x51fb('0x76')];_0x38f8af['message'][_0x51fb('0x77')]=_0x38f8af[_0x51fb('0x76')];_0x38f8af['message']['event']='accept';return respondWithRpcPromise('EventManager',_0x51fb('0x78'),{'event':_0x51fb('0x79'),'message':_0x38f8af[_0x51fb('0x23')]},client9002)[_0x51fb('0x1b')](function(){return _0x38f8af;});}return _0x38f8af;}return null;})['then'](respondWithResult(_0x346036,null))[_0x51fb('0x26')](handleError(_0x346036,null));};var interaction_log=require(_0x51fb('0x56'))('openchannel-interactions');exports[_0x51fb('0x7a')]=function(_0x5a3730,_0x4a27ea,_0xd34a41){var _0x493c97={'agent':{},'channel':_0x51fb('0x7b')};if(_0x5a3730[_0x51fb('0x54')]['id']){delete _0x5a3730[_0x51fb('0x54')]['id'];}_0x5a3730['body'][_0x51fb('0x5c')]=_0x5a3730[_0x51fb('0x54')][_0x51fb('0x5c')]||_0x5a3730[_0x51fb('0x5d')]['id'];_0x493c97[_0x51fb('0x5e')]['id']=_0x5a3730[_0x51fb('0x54')][_0x51fb('0x5c')];return db['OpenchannelMessage'][_0x51fb('0x52')]({'where':{'id':_0x5a3730['params']['id'],'UserId':null}})[_0x51fb('0x1b')](handleEntityNotFound(_0x4a27ea,null))[_0x51fb('0x1b')](function(_0x12e070){if(_0x12e070){_0x493c97[_0x51fb('0x23')]=_0x12e070['get']({'plain':!![]});return db[_0x51fb('0x60')][_0x51fb('0x52')]({'where':{'id':_0x12e070[_0x51fb('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x4a27ea,null))[_0x51fb('0x1b')](function(_0x20c579){if(_0x20c579){_0x493c97[_0x51fb('0x65')]=_0x20c579[_0x51fb('0x5f')]({'plain':!![]});interaction_log[_0x51fb('0x24')](_0x51fb('0x7c'),_0x5a3730['user']['id'],_0x5a3730[_0x51fb('0x5d')][_0x51fb('0x33')],_0x5a3730[_0x51fb('0x5d')][_0x51fb('0x67')],_0x493c97[_0x51fb('0x65')]['id'],_0x5a3730[_0x51fb('0x54')]?JSON[_0x51fb('0x20')](_0x5a3730[_0x51fb('0x54')]):_0x51fb('0x68'));return respondWithRpcPromise(_0x51fb('0x7d'),_0x51fb('0x7e'),_0x493c97);}return null;})[_0x51fb('0x1b')](function(_0x31a9b5){var _0x4b60ec=_0x51fb('0x6a')+_0x31a9b5[_0x51fb('0x23')]['ContactId'];return db['sequelize'][_0x51fb('0x3a')](_0x4b60ec,{'type':db[_0x51fb('0x6d')][_0x51fb('0x6e')]['SELECT'],'raw':!![]})[_0x51fb('0x1b')](function(_0x27cce4){return _0x27cce4;});})[_0x51fb('0x1b')](function(_0x1e00c2){if(_0x1e00c2){_0x493c97['message'][_0x51fb('0x7f')]=_0x1e00c2[0x0];if(!_0x5a3730['body']['UserId'])return;return db[_0x51fb('0x6f')][_0x51fb('0x52')]({'where':{'id':_0x5a3730[_0x51fb('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0x51fb('0x33'),'fullname',_0x51fb('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5b9dca){if(!_0x5b9dca)return null;_0x493c97[_0x51fb('0x23')][_0x51fb('0x5e')]=_0x5b9dca;return _0x493c97;})[_0x51fb('0x1b')](function(_0x1fb65f){if(_0x1fb65f){_0x1fb65f[_0x51fb('0x23')][_0x51fb('0x74')]=util['format'](_0x51fb('0x75'),_0x5a3730[_0x51fb('0x5d')][_0x51fb('0x33')]);_0x1fb65f[_0x51fb('0x23')][_0x51fb('0x76')]=_0x493c97['channel'];_0x1fb65f['message'][_0x51fb('0x77')]=_0x493c97[_0x51fb('0x76')];_0x1fb65f[_0x51fb('0x23')][_0x51fb('0x80')]=_0x51fb('0x7a');respondWithRpcPromise(_0x51fb('0x78'),'EventManager',{'event':_0x51fb('0x81'),'message':_0x1fb65f[_0x51fb('0x23')]},client9002);return _0x493c97;}return null;})[_0x51fb('0x1b')](respondWithResult(_0x4a27ea,null))[_0x51fb('0x26')](handleError(_0x4a27ea,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c797352..2f60818 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 _0x1aed=['hook','exports','OpenchannelMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x24b5c9,_0x27f60a){var _0x3a92ef=function(_0x36fa45){while(--_0x36fa45){_0x24b5c9['push'](_0x24b5c9['shift']());}};_0x3a92ef(++_0x27f60a);}(_0x1aed,0x7a));var _0xd1ae=function(_0x23d731,_0x372f4c){_0x23d731=_0x23d731-0x0;var _0x14342b=_0x1aed[_0x23d731];return _0x14342b;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0xd1ae('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd1ae('0x1'),'afterUpdate':_0xd1ae('0x2'),'afterDestroy':_0xd1ae('0x3')};function emitEvent(_0x4c482c){return function(_0x3c70b0,_0x5c160a,_0x3b37d4){OpenchannelMessageEvents[_0xd1ae('0x4')](_0x4c482c+':'+_0x3c70b0['id'],_0x3c70b0);OpenchannelMessageEvents[_0xd1ae('0x4')](_0x4c482c,_0x3c70b0);_0x3b37d4(null);};}for(var e in events){if(events[_0xd1ae('0x5')](e)){var event=events[e];OpenchannelMessage[_0xd1ae('0x6')](e,emitEvent(event));}}module[_0xd1ae('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8b1a=['hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit'];(function(_0x259ee7,_0x43102b){var _0x205c02=function(_0x5a64e1){while(--_0x5a64e1){_0x259ee7['push'](_0x259ee7['shift']());}};_0x205c02(++_0x43102b);}(_0x8b1a,0x161));var _0xa8b1=function(_0x577fac,_0x1096b9){_0x577fac=_0x577fac-0x0;var _0x21404c=_0x8b1a[_0x577fac];return _0x21404c;};'use strict';var EventEmitter=require(_0xa8b1('0x0'));var OpenchannelMessage=require(_0xa8b1('0x1'))['db'][_0xa8b1('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa8b1('0x3')](0x0);var events={'afterCreate':_0xa8b1('0x4'),'afterUpdate':_0xa8b1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x357f48){return function(_0x30e770,_0x2be0b8,_0x43d3aa){OpenchannelMessageEvents[_0xa8b1('0x6')](_0x357f48+':'+_0x30e770['id'],_0x30e770);OpenchannelMessageEvents['emit'](_0x357f48,_0x30e770);_0x43d3aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xa8b1('0x7')](e,emitEvent(event));}}module[_0xa8b1('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index cb9953e..fca45d4 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 _0xefda=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','POST','method','GET','format','threadId','inspect','finally','utf8mb4','lodash','api','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xefda,0x96));var _0xaefd=function(_0x294dfc,_0x3a8147){_0x294dfc=_0x294dfc-0x0;var _0x18c7d2=_0xefda[_0x294dfc];return _0x18c7d2;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xaefd('0xc')],'type':_0xaefd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463ce7,_0x4d44ed,_0x48a255){var _0x54a3b1=_0x497258[_0xaefd('0xe')];var _0x16b36e=_0x463ce7[_0xaefd('0xf')]({'plain':!![]});if(_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()==='in'||_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]&&!_[_0xaefd('0x14')](_0x16b36e[_0xaefd('0x15')])){_0x54a3b1['OpenchannelInteraction'][_0xaefd('0x16')]({'where':{'id':_0x16b36e['OpenchannelInteractionId']}})[_0xaefd('0x17')](function(_0x1725af){if(_0x1725af){_0x1725af[_0xaefd('0x18')]({'lastMsgAt':_0x16b36e[_0xaefd('0x19')],'lastMsgDirection':_0x16b36e['direction'][_0xaefd('0x11')]()});}})[_0xaefd('0x1a')](function(_0x41f345){console[_0xaefd('0x1b')](_0x41f345);});}if(_0x16b36e[_0xaefd('0x10')]===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]){var _0x23d736;_0x54a3b1['CmContact'][_0xaefd('0x1c')]()[_0xaefd('0x17')](function(_0x9748f4){return _0x54a3b1[_0xaefd('0x1d')][_0xaefd('0x1e')]({'where':{'id':_0x16b36e[_0xaefd('0x1f')]},'include':[{'model':_0x54a3b1['OpenchannelInteraction'],'as':_0xaefd('0x20'),'where':{'id':_0x16b36e[_0xaefd('0x21')]},'limit':0x1,'include':[{'model':_0x54a3b1[_0xaefd('0x22')],'as':_0xaefd('0x23'),'attributes':_[_0xaefd('0x24')](_0x9748f4)}]}]});})[_0xaefd('0x17')](function(_0x5282ed){_0x23d736=_0x5282ed[_0xaefd('0xf')]({'plain':!![]});if(_0x23d736&&_0x23d736[_0xaefd('0x25')]){logger[_0xaefd('0x26')](_0xaefd('0x27'),_0xaefd('0x28'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x16b36e['id'],_0x23d736['replyUri']));if(_0x23d736[_0xaefd('0x20')]&&_0x23d736[_0xaefd('0x20')][_0xaefd('0x29')]){_0x16b36e['Interaction']=_[_0xaefd('0x2a')](_0x23d736['Interactions'][0x0],_0xaefd('0x23'));_0x16b36e[_0xaefd('0x23')]=_0x23d736[_0xaefd('0x20')][0x0]['Contact'];}var _0x4d44ed={'method':_0xaefd('0x2b'),'uri':encodeURI(_0x23d736[_0xaefd('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d44ed[_0xaefd('0x2c')]){case _0xaefd('0x2d'):_0x4d44ed['qs']=_0x16b36e;break;case'POST':_0x4d44ed[_0xaefd('0xc')]=_0x16b36e;break;}return rp(_0x4d44ed)['then'](function(_0x810bf){logger[_0xaefd('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x16b36e['id'],_0x23d736[_0xaefd('0x25')]));if(_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]&&_0x810bf['body'][_0xaefd('0x2f')]!=_0x16b36e['Interaction'][_0xaefd('0x2f')]){return _0x54a3b1['OpenchannelInteraction']['update']({'threadId':_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]},{'logging':!![],'where':{'id':_0x16b36e['Interaction']['id']}});}else{return;}})['then'](function(){return _0x463ce7['update']({'read':!![]});})[_0xaefd('0x1a')](function(_0x280eab){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x30')](_0x280eab,{'showHidden':![],'depth':null}));_0x48a255();});}else{_0x48a255();}})[_0xaefd('0x31')](function(){_0x48a255();});}else{_0x48a255();}}},'charset':_0xaefd('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5c3c=['Forwarding\x20message\x20%d\x20to\x20%s','omit','Contact','method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','Interactions','CmContact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format'];(function(_0x3d8c7a,_0x3497ab){var _0x58eb70=function(_0x3aff41){while(--_0x3aff41){_0x3d8c7a['push'](_0x3d8c7a['shift']());}};_0x58eb70(++_0x3497ab);}(_0x5c3c,0x132));var _0xc5c3=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x5c3c[_0x34bf97];return _0x292719;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var logger=require(_0xc5c3('0x2'))(_0xc5c3('0x3'));var moment=require('moment');var BPromise=require(_0xc5c3('0x4'));var rp=require(_0xc5c3('0x5'));var fs=require('fs');var path=require(_0xc5c3('0x6'));var rimraf=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var attributes=require(_0xc5c3('0x9'));module[_0xc5c3('0xa')]=function(_0x23a6b5,_0x28bdd9){return _0x23a6b5['define']('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xc5c3('0xb'),'fields':[_0xc5c3('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x110b89,_0x46e2c1,_0x52f3eb){var _0x14140f=_0x23a6b5[_0xc5c3('0xd')];var _0x4e329f=_0x110b89[_0xc5c3('0xe')]({'plain':!![]});if(_0x4e329f[_0xc5c3('0xf')][_0xc5c3('0x10')]()==='in'||_0x4e329f['direction'][_0xc5c3('0x10')]()===_0xc5c3('0x11')&&!_0x4e329f['secret']&&!_[_0xc5c3('0x12')](_0x4e329f[_0xc5c3('0x13')])){_0x14140f[_0xc5c3('0x14')]['findOne']({'where':{'id':_0x4e329f[_0xc5c3('0x15')]}})[_0xc5c3('0x16')](function(_0x1488ab){if(_0x1488ab){_0x1488ab[_0xc5c3('0x17')]({'lastMsgAt':_0x4e329f[_0xc5c3('0x18')],'lastMsgDirection':_0x4e329f['direction']['toLowerCase']()});}})[_0xc5c3('0x19')](function(_0x577e1a){console[_0xc5c3('0x1a')](_0x577e1a);});}if(_0x4e329f[_0xc5c3('0xf')]==='out'&&!_0x4e329f['secret']){var _0x467ba9;_0x14140f['CmContact'][_0xc5c3('0x1b')]()[_0xc5c3('0x16')](function(_0x2ff158){return _0x14140f[_0xc5c3('0x1c')][_0xc5c3('0x1d')]({'where':{'id':_0x4e329f['OpenchannelAccountId']},'include':[{'model':_0x14140f[_0xc5c3('0x14')],'as':_0xc5c3('0x1e'),'where':{'id':_0x4e329f[_0xc5c3('0x15')]},'limit':0x1,'include':[{'model':_0x14140f[_0xc5c3('0x1f')],'as':'Contact','attributes':_[_0xc5c3('0x20')](_0x2ff158)}]}]});})[_0xc5c3('0x16')](function(_0x3cc612){_0x467ba9=_0x3cc612[_0xc5c3('0xe')]({'plain':!![]});if(_0x467ba9&&_0x467ba9[_0xc5c3('0x21')]){logger['info'](_0xc5c3('0x22'),_0xc5c3('0x23'),util[_0xc5c3('0x24')](_0xc5c3('0x25'),_0x4e329f['id'],_0x467ba9[_0xc5c3('0x21')]));if(_0x467ba9[_0xc5c3('0x1e')]&&_0x467ba9[_0xc5c3('0x1e')]['length']){_0x4e329f['Interaction']=_[_0xc5c3('0x26')](_0x467ba9[_0xc5c3('0x1e')][0x0],'Contact');_0x4e329f['Contact']=_0x467ba9[_0xc5c3('0x1e')][0x0][_0xc5c3('0x27')];}var _0x46e2c1={'method':'POST','uri':encodeURI(_0x467ba9['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x46e2c1[_0xc5c3('0x28')]){case _0xc5c3('0x29'):_0x46e2c1['qs']=_0x4e329f;break;case _0xc5c3('0x2a'):_0x46e2c1[_0xc5c3('0xc')]=_0x4e329f;break;}return rp(_0x46e2c1)['then'](function(_0x21efd6){logger['info'](_0xc5c3('0x22'),'afterCreate',util[_0xc5c3('0x24')](_0xc5c3('0x2b'),_0x4e329f['id'],_0x467ba9[_0xc5c3('0x21')]));if(_0x21efd6[_0xc5c3('0xc')][_0xc5c3('0x2c')]&&_0x21efd6[_0xc5c3('0xc')][_0xc5c3('0x2c')]!=_0x4e329f['Interaction'][_0xc5c3('0x2c')]){return _0x14140f['OpenchannelInteraction'][_0xc5c3('0x17')]({'threadId':_0x21efd6[_0xc5c3('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x4e329f['Interaction']['id']}});}else{return;}})[_0xc5c3('0x16')](function(){return _0x110b89[_0xc5c3('0x17')]({'read':!![]});})[_0xc5c3('0x19')](function(_0x19e482){logger['error'](_0xc5c3('0x22'),_0xc5c3('0x23'),util[_0xc5c3('0x2d')](_0x19e482,{'showHidden':![],'depth':null}));_0x52f3eb();});}else{_0x52f3eb();}})[_0xc5c3('0x2e')](function(){_0x52f3eb();});}else{_0x52f3eb();}}},'charset':_0xc5c3('0x2f'),'collate':_0xc5c3('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 100773e..a5b97ed 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3cbee0,_0x352a0a){var _0x2ed094=function(_0x5697f7){while(--_0x5697f7){_0x3cbee0['push'](_0x3cbee0['shift']());}};_0x2ed094(++_0x352a0a);}(_0x1261,0x144));var _0x1126=function(_0xd056f7,_0xedbba9){_0xd056f7=_0xd056f7-0x0;var _0xbcb407=_0x1261[_0xd056f7];return _0xbcb407;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x2f7d4b,_0x35853d){var _0x3600ba=function(_0x5f040b){while(--_0x5f040b){_0x2f7d4b['push'](_0x2f7d4b['shift']());}};_0x3600ba(++_0x35853d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0x0b0e[_0x1a809b];return _0x5d90e6;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b0536d8..83386b6 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 _0x18d4=['./openchannelMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x4845c8,_0x443541){var _0x489291=function(_0x395b6f){while(--_0x395b6f){_0x4845c8['push'](_0x4845c8['shift']());}};_0x489291(++_0x443541);}(_0x18d4,0x1ab));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require(_0x418d('0x0'));var events=['save',_0x418d('0x1'),_0x418d('0x2')];function createListener(_0x372ffd,_0x429c3c){return function(_0x1fcd50){_0x429c3c[_0x418d('0x3')](_0x372ffd,_0x1fcd50);};}function removeListener(_0x4df9b4,_0x7e3eb9){return function(){OpenchannelMessageEvents[_0x418d('0x4')](_0x4df9b4,_0x7e3eb9);};}exports[_0x418d('0x5')]=function(_0x40e5fd){for(var _0x460023=0x0,_0x465afe=events[_0x418d('0x6')];_0x460023<_0x465afe;_0x460023++){var _0x193fd1=events[_0x460023];var _0x4ed380=createListener('openchannelMessage:'+_0x193fd1,_0x40e5fd);OpenchannelMessageEvents['on'](_0x193fd1,_0x4ed380);}}; \ No newline at end of file +var _0x82e3=['save','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x2dc696,_0x31de3f){var _0x207ef4=function(_0x2fb319){while(--_0x2fb319){_0x2dc696['push'](_0x2dc696['shift']());}};_0x207ef4(++_0x31de3f);}(_0x82e3,0x1aa));var _0x382e=function(_0x405d4a,_0x2b774e){_0x405d4a=_0x405d4a-0x0;var _0x33b57d=_0x82e3[_0x405d4a];return _0x33b57d;};'use strict';var OpenchannelMessageEvents=require(_0x382e('0x0'));var events=[_0x382e('0x1'),'remove',_0x382e('0x2')];function createListener(_0x561613,_0x33cf69){return function(_0x5d2c56){_0x33cf69[_0x382e('0x3')](_0x561613,_0x5d2c56);};}function removeListener(_0x406373,_0x4c6260){return function(){OpenchannelMessageEvents[_0x382e('0x4')](_0x406373,_0x4c6260);};}exports['register']=function(_0x5ea1b8){for(var _0x386210=0x0,_0x5bcdaa=events[_0x382e('0x5')];_0x386210<_0x5bcdaa;_0x386210++){var _0x249f15=events[_0x386210];var _0x59aad6=createListener(_0x382e('0x6')+_0x249f15,_0x5ea1b8);OpenchannelMessageEvents['on'](_0x249f15,_0x59aad6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 38871b8..efab799 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 _0xeec8=['put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','create','post','/:id/teams','addTeams','/:id/users'];(function(_0x26ddb3,_0x1e8676){var _0x227a81=function(_0x28de22){while(--_0x28de22){_0x26ddb3['push'](_0x26ddb3['shift']());}};_0x227a81(++_0x1e8676);}(_0xeec8,0x92));var _0x8eec=function(_0x3b17ac,_0x33c0f3){_0x3b17ac=_0x3b17ac-0x0;var _0x4e65ba=_0xeec8[_0x3b17ac];return _0x4e65ba;};'use strict';var multer=require('multer');var util=require(_0x8eec('0x0'));var path=require(_0x8eec('0x1'));var timeout=require(_0x8eec('0x2'));var express=require(_0x8eec('0x3'));var router=express['Router']();var fs_extra=require(_0x8eec('0x4'));var auth=require(_0x8eec('0x5'));var interaction=require(_0x8eec('0x6'));var config=require(_0x8eec('0x7'));var controller=require(_0x8eec('0x8'));router[_0x8eec('0x9')]('/',auth[_0x8eec('0xa')](),controller['index']);router['get']('/describe',auth[_0x8eec('0xa')](),controller[_0x8eec('0xb')]);router[_0x8eec('0x9')](_0x8eec('0xc'),auth[_0x8eec('0xa')](),controller[_0x8eec('0xd')]);router[_0x8eec('0x9')](_0x8eec('0xe'),auth[_0x8eec('0xa')](),controller[_0x8eec('0xf')]);router['get']('/:id/teams',auth[_0x8eec('0xa')](),controller[_0x8eec('0x10')]);router[_0x8eec('0x9')]('/:id/users',auth[_0x8eec('0xa')](),controller['getAgents']);router['post']('/',auth[_0x8eec('0xa')](),controller[_0x8eec('0x11')]);router[_0x8eec('0x12')](_0x8eec('0x13'),auth[_0x8eec('0xa')](),controller[_0x8eec('0x14')]);router[_0x8eec('0x12')](_0x8eec('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8eec('0x16')](_0x8eec('0xc'),auth['isAuthenticated'](),controller[_0x8eec('0x17')]);router[_0x8eec('0x18')](_0x8eec('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x8eec('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8eec('0x19')]);router[_0x8eec('0x18')](_0x8eec('0x15'),auth['isAuthenticated'](),controller[_0x8eec('0x1a')]);module[_0x8eec('0x1b')]=router; \ No newline at end of file +var _0xc31c=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x449ce6,_0x48a676){var _0x5e81e4=function(_0x59f6e5){while(--_0x59f6e5){_0x449ce6['push'](_0x449ce6['shift']());}};_0x5e81e4(++_0x48a676);}(_0xc31c,0x8f));var _0xcc31=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc31c[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xcc31('0x0'));var util=require(_0xcc31('0x1'));var path=require(_0xcc31('0x2'));var timeout=require(_0xcc31('0x3'));var express=require(_0xcc31('0x4'));var router=express[_0xcc31('0x5')]();var fs_extra=require(_0xcc31('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcc31('0x7'));var config=require(_0xcc31('0x8'));var controller=require(_0xcc31('0x9'));router['get']('/',auth[_0xcc31('0xa')](),controller[_0xcc31('0xb')]);router[_0xcc31('0xc')](_0xcc31('0xd'),auth['isAuthenticated'](),controller[_0xcc31('0xe')]);router[_0xcc31('0xc')](_0xcc31('0xf'),auth['isAuthenticated'](),controller[_0xcc31('0x10')]);router[_0xcc31('0xc')](_0xcc31('0x11'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xcc31('0x12'),auth['isAuthenticated'](),controller[_0xcc31('0x13')]);router[_0xcc31('0xc')](_0xcc31('0x14'),auth['isAuthenticated'](),controller[_0xcc31('0x15')]);router[_0xcc31('0x16')]('/',auth[_0xcc31('0xa')](),controller[_0xcc31('0x17')]);router[_0xcc31('0x16')](_0xcc31('0x12'),auth[_0xcc31('0xa')](),controller[_0xcc31('0x18')]);router[_0xcc31('0x16')](_0xcc31('0x14'),auth[_0xcc31('0xa')](),controller['addAgents']);router[_0xcc31('0x19')]('/:id',auth[_0xcc31('0xa')](),controller['update']);router[_0xcc31('0x1a')](_0xcc31('0xf'),auth[_0xcc31('0xa')](),controller[_0xcc31('0x1b')]);router[_0xcc31('0x1a')]('/:id/teams',auth[_0xcc31('0xa')](),controller[_0xcc31('0x1c')]);router[_0xcc31('0x1a')](_0xcc31('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xcc31('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4ee91d8..512733c 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 _0xa071=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4ecb59,_0x5e38ca){var _0x2c29d3=function(_0x4eaf8c){while(--_0x4eaf8c){_0x4ecb59['push'](_0x4ecb59['shift']());}};_0x2c29d3(++_0x5e38ca);}(_0xa071,0x15f));var _0x1a07=function(_0x525813,_0x704d1a){_0x525813=_0x525813-0x0;var _0x1683f7=_0xa071[_0x525813];return _0x1683f7;};'use strict';var Sequelize=require(_0x1a07('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1a07('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a07('0x2')]},'timeout':{'type':Sequelize[_0x1a07('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1a07('0x4')](_0x1a07('0x5'),_0x1a07('0x6'),_0x1a07('0x7'))}}; \ No newline at end of file +var _0xa95e=['STRING','rrmemory','beepall','sequelize'];(function(_0xf55075,_0x1e9bff){var _0x335ff5=function(_0x34fee6){while(--_0x34fee6){_0xf55075['push'](_0xf55075['shift']());}};_0x335ff5(++_0x1e9bff);}(_0xa95e,0x10b));var _0xea95=function(_0x33f37d,_0x4a83bd){_0x33f37d=_0x33f37d-0x0;var _0x84e270=_0xa95e[_0x33f37d];return _0x84e270;};'use strict';var Sequelize=require(_0xea95('0x0'));module['exports']={'name':{'type':Sequelize[_0xea95('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea95('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xea95('0x2'),_0xea95('0x3'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4849ebb..c0ee0db 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 _0xaaa6=['getTeams','order','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','ids','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','emit','isArray','getAgents','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','error','stack','name','send','index','OpenchannelQueue','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','findAll','catch','show','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaaa6,0x1d2));var _0x6aaa=function(_0x2dcc73,_0x1293d9){_0x2dcc73=_0x2dcc73-0x0;var _0x4ae10f=_0xaaa6[_0x2dcc73];return _0x4ae10f;};'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(_0x6aaa('0x0'));var moment=require(_0x6aaa('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6aaa('0x2'));var util=require(_0x6aaa('0x3'));var path=require(_0x6aaa('0x4'));var sox=require(_0x6aaa('0x5'));var csv=require(_0x6aaa('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6aaa('0x7'));var _=require(_0x6aaa('0x8'));var squel=require(_0x6aaa('0x9'));var crypto=require('crypto');var jsforce=require(_0x6aaa('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6aaa('0x6'));var querystring=require('querystring');var Papa=require(_0x6aaa('0xb'));var Redis=require(_0x6aaa('0xc'));var authService=require(_0x6aaa('0xd'));var qs=require(_0x6aaa('0xe'));var as=require(_0x6aaa('0xf'));var hardwareService=require(_0x6aaa('0x10'));var logger=require(_0x6aaa('0x11'))('api');var utils=require(_0x6aaa('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6aaa('0x13'));var db=require(_0x6aaa('0x14'))['db'];config['redis']=_['defaults'](config[_0x6aaa('0x15')],{'host':_0x6aaa('0x16'),'port':0x18eb});var socket=require(_0x6aaa('0x17'))(new Redis(config['redis']));require(_0x6aaa('0x18'))['register'](socket);function respondWithStatusCode(_0x27bc03,_0x4d6751){_0x4d6751=_0x4d6751||0xcc;return function(_0x64e28b){if(_0x64e28b){return _0x27bc03[_0x6aaa('0x19')](_0x4d6751);}return _0x27bc03[_0x6aaa('0x1a')](_0x4d6751)[_0x6aaa('0x1b')]();};}function respondWithResult(_0x32671d,_0x2495ca){_0x2495ca=_0x2495ca||0xc8;return function(_0x1245df){if(_0x1245df){return _0x32671d[_0x6aaa('0x1a')](_0x2495ca)[_0x6aaa('0x1c')](_0x1245df);}};}function respondWithFilteredResult(_0x533972,_0x340bf7){return function(_0x305154){if(_0x305154){var _0x300164=typeof _0x340bf7[_0x6aaa('0x1d')]===_0x6aaa('0x1e')&&typeof _0x340bf7['limit']===_0x6aaa('0x1e');var _0x5a20a1=_0x305154[_0x6aaa('0x1f')];var _0x5de4b3=_0x300164?0x0:_0x340bf7['offset'];var _0x17e70a=_0x300164?_0x305154[_0x6aaa('0x1f')]:_0x340bf7[_0x6aaa('0x1d')]+_0x340bf7[_0x6aaa('0x20')];var _0x53f84f;if(_0x17e70a>=_0x5a20a1){_0x17e70a=_0x5a20a1;_0x53f84f=0xc8;}else{_0x53f84f=0xce;}_0x533972['status'](_0x53f84f);return _0x533972[_0x6aaa('0x21')](_0x6aaa('0x22'),_0x5de4b3+'-'+_0x17e70a+'/'+_0x5a20a1)[_0x6aaa('0x1c')](_0x305154);}return null;};}function patchUpdates(_0x3a1abb){return function(_0x56dfe8){try{jsonpatch['apply'](_0x56dfe8,_0x3a1abb,!![]);}catch(_0x420979){return BPromise[_0x6aaa('0x23')](_0x420979);}return _0x56dfe8[_0x6aaa('0x24')]();};}function saveUpdates(_0x7c1a6b,_0x42f69b){return function(_0x133544){if(_0x133544){return _0x133544[_0x6aaa('0x25')](_0x7c1a6b)[_0x6aaa('0x26')](function(_0x54bb67){return _0x54bb67;});}return null;};}function removeEntity(_0xf20378,_0x260513){return function(_0x477b4a){if(_0x477b4a){return _0x477b4a[_0x6aaa('0x27')]()[_0x6aaa('0x26')](function(){var _0x4ea5bd=_0x477b4a[_0x6aaa('0x28')]({'plain':!![]});var _0x3fdcaa=_0x6aaa('0x29');return db['UserProfileResource'][_0x6aaa('0x27')]({'where':{'type':_0x3fdcaa,'resourceId':_0x4ea5bd['id']}})[_0x6aaa('0x26')](function(){return _0x477b4a;});})[_0x6aaa('0x26')](function(){_0xf20378[_0x6aaa('0x1a')](0xcc)[_0x6aaa('0x1b')]();});}};}function handleEntityNotFound(_0x54af23,_0x4f66fb){return function(_0x263ff4){if(!_0x263ff4){_0x54af23[_0x6aaa('0x19')](0x194);}return _0x263ff4;};}function handleError(_0x2ba0c2,_0x584dd7){_0x584dd7=_0x584dd7||0x1f4;return function(_0x4ec2cc){logger[_0x6aaa('0x2a')](_0x4ec2cc[_0x6aaa('0x2b')]);if(_0x4ec2cc[_0x6aaa('0x2c')]){delete _0x4ec2cc[_0x6aaa('0x2c')];}_0x2ba0c2[_0x6aaa('0x1a')](_0x584dd7)[_0x6aaa('0x2d')](_0x4ec2cc);};}exports[_0x6aaa('0x2e')]=function(_0x61b6ee,_0x2fc091){var _0x2b61be={},_0x3db588={},_0x1f6ace={'count':0x0,'rows':[]};var _0x25e89e=_['map'](db[_0x6aaa('0x2f')][_0x6aaa('0x30')],function(_0x158611){return{'name':_0x158611['fieldName'],'type':_0x158611[_0x6aaa('0x31')][_0x6aaa('0x32')]};});_0x3db588[_0x6aaa('0x33')]=_['map'](_0x25e89e,_0x6aaa('0x2c'));_0x3db588['query']=_[_0x6aaa('0x34')](_0x61b6ee[_0x6aaa('0x35')]);_0x3db588[_0x6aaa('0x36')]=_[_0x6aaa('0x37')](_0x3db588[_0x6aaa('0x33')],_0x3db588[_0x6aaa('0x35')]);_0x2b61be['attributes']=_[_0x6aaa('0x37')](_0x3db588[_0x6aaa('0x33')],qs[_0x6aaa('0x38')](_0x61b6ee['query']['fields']));_0x2b61be[_0x6aaa('0x39')]=_0x2b61be[_0x6aaa('0x39')][_0x6aaa('0x3a')]?_0x2b61be[_0x6aaa('0x39')]:_0x3db588[_0x6aaa('0x33')];if(!_0x61b6ee['query'][_0x6aaa('0x3b')](_0x6aaa('0x3c'))){_0x2b61be['limit']=qs[_0x6aaa('0x20')](_0x61b6ee[_0x6aaa('0x35')][_0x6aaa('0x20')]);_0x2b61be[_0x6aaa('0x1d')]=qs[_0x6aaa('0x1d')](_0x61b6ee['query']['offset']);}_0x2b61be['order']=qs[_0x6aaa('0x3d')](_0x61b6ee[_0x6aaa('0x35')][_0x6aaa('0x3d')]);_0x2b61be[_0x6aaa('0x3e')]=qs[_0x6aaa('0x36')](_[_0x6aaa('0x3f')](_0x61b6ee[_0x6aaa('0x35')],_0x3db588['filters']),_0x25e89e);if(_0x61b6ee['query'][_0x6aaa('0x40')]){_0x2b61be['where']=_[_0x6aaa('0x41')](_0x2b61be[_0x6aaa('0x3e')],{'$or':_[_0x6aaa('0x42')](_0x25e89e,function(_0x5bfe9d){if(_0x5bfe9d[_0x6aaa('0x31')]!==_0x6aaa('0x43')){var _0x480647={};_0x480647[_0x5bfe9d[_0x6aaa('0x2c')]]={'$like':'%'+_0x61b6ee[_0x6aaa('0x35')]['filter']+'%'};return _0x480647;}})});}_0x2b61be=_[_0x6aaa('0x41')]({},_0x2b61be,_0x61b6ee[_0x6aaa('0x44')]);var _0x17899e={'where':_0x2b61be[_0x6aaa('0x3e')]};return db[_0x6aaa('0x2f')]['count'](_0x17899e)[_0x6aaa('0x26')](function(_0x36f5bd){_0x1f6ace[_0x6aaa('0x1f')]=_0x36f5bd;if(_0x61b6ee[_0x6aaa('0x35')]['includeAll']){_0x2b61be['include']=[{'all':!![]}];}return db[_0x6aaa('0x2f')][_0x6aaa('0x45')](_0x2b61be);})['then'](function(_0x44fc02){_0x1f6ace['rows']=_0x44fc02;return _0x1f6ace;})[_0x6aaa('0x26')](respondWithFilteredResult(_0x2fc091,_0x2b61be))[_0x6aaa('0x46')](handleError(_0x2fc091,null));};exports[_0x6aaa('0x47')]=function(_0x305433,_0x25b4a5){var _0x5c5e15={'raw':!![],'where':{'id':_0x305433[_0x6aaa('0x48')]['id']}},_0x1405a0={};_0x1405a0['model']=_[_0x6aaa('0x34')](db[_0x6aaa('0x2f')][_0x6aaa('0x30')]);_0x1405a0[_0x6aaa('0x35')]=_[_0x6aaa('0x34')](_0x305433['query']);_0x1405a0[_0x6aaa('0x36')]=_[_0x6aaa('0x37')](_0x1405a0[_0x6aaa('0x33')],_0x1405a0['query']);_0x5c5e15[_0x6aaa('0x39')]=_[_0x6aaa('0x37')](_0x1405a0[_0x6aaa('0x33')],qs['fields'](_0x305433[_0x6aaa('0x35')][_0x6aaa('0x38')]));_0x5c5e15[_0x6aaa('0x39')]=_0x5c5e15['attributes'][_0x6aaa('0x3a')]?_0x5c5e15[_0x6aaa('0x39')]:_0x1405a0[_0x6aaa('0x33')];if(_0x305433['query'][_0x6aaa('0x49')]){_0x5c5e15[_0x6aaa('0x4a')]=[{'all':!![]}];}_0x5c5e15=_[_0x6aaa('0x41')]({},_0x5c5e15,_0x305433[_0x6aaa('0x44')]);return db[_0x6aaa('0x2f')][_0x6aaa('0x4b')](_0x5c5e15)[_0x6aaa('0x26')](handleEntityNotFound(_0x25b4a5,null))[_0x6aaa('0x26')](respondWithResult(_0x25b4a5,null))['catch'](handleError(_0x25b4a5,null));};exports[_0x6aaa('0x4c')]=function(_0x1502f7,_0x169c81){return db[_0x6aaa('0x2f')][_0x6aaa('0x4c')](_0x1502f7[_0x6aaa('0x4d')],{})['then'](function(_0x13f7b9){var _0x265250=_0x1502f7[_0x6aaa('0x4e')]['get']({'plain':!![]});if(!_0x265250)throw new Error(_0x6aaa('0x4f'));if(_0x265250[_0x6aaa('0x50')]==='user'){var _0x3a55bc=_0x13f7b9['get']({'plain':!![]});var _0x3138fa=_0x6aaa('0x29');return db['UserProfileSection'][_0x6aaa('0x4b')]({'where':{'name':_0x3138fa,'userProfileId':_0x265250[_0x6aaa('0x51')]},'raw':!![]})[_0x6aaa('0x26')](function(_0xf37a2d){if(_0xf37a2d&&_0xf37a2d[_0x6aaa('0x52')]===0x0){return db[_0x6aaa('0x53')]['create']({'name':_0x3a55bc[_0x6aaa('0x2c')],'resourceId':_0x3a55bc['id'],'type':_0xf37a2d[_0x6aaa('0x2c')],'sectionId':_0xf37a2d['id']},{})[_0x6aaa('0x26')](function(){return _0x13f7b9;});}else{return _0x13f7b9;}})[_0x6aaa('0x46')](function(_0x494c5e){logger['error'](_0x6aaa('0x54'),_0x494c5e);throw _0x494c5e;});}return _0x13f7b9;})[_0x6aaa('0x26')](respondWithResult(_0x169c81,0xc9))[_0x6aaa('0x46')](handleError(_0x169c81,null));};exports[_0x6aaa('0x25')]=function(_0xbfb583,_0x4820f0){if(_0xbfb583[_0x6aaa('0x4d')]['id']){delete _0xbfb583[_0x6aaa('0x4d')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0xbfb583[_0x6aaa('0x48')]['id']}})[_0x6aaa('0x26')](handleEntityNotFound(_0x4820f0,null))[_0x6aaa('0x26')](saveUpdates(_0xbfb583[_0x6aaa('0x4d')],null))[_0x6aaa('0x26')](respondWithResult(_0x4820f0,null))[_0x6aaa('0x46')](handleError(_0x4820f0,null));};exports[_0x6aaa('0x27')]=function(_0x21f86c,_0x331797){return db[_0x6aaa('0x2f')][_0x6aaa('0x4b')]({'where':{'id':_0x21f86c['params']['id']}})['then'](handleEntityNotFound(_0x331797,null))[_0x6aaa('0x26')](removeEntity(_0x331797,null))[_0x6aaa('0x46')](handleError(_0x331797,null));};exports[_0x6aaa('0x55')]=function(_0x346c5e,_0x3bbfe4){return db[_0x6aaa('0x2f')][_0x6aaa('0x55')]()['then'](respondWithResult(_0x3bbfe4,null))[_0x6aaa('0x46')](handleError(_0x3bbfe4,null));};exports[_0x6aaa('0x56')]=function(_0xeebd5,_0x1898f7,_0x62fec6){var _0xc766c9={'raw':!![],'where':{}},_0x42a93e={},_0x9f884b;return db[_0x6aaa('0x2f')][_0x6aaa('0x57')]({'where':{'id':_0xeebd5[_0x6aaa('0x48')]['id']}})['then'](handleEntityNotFound(_0x1898f7,null))[_0x6aaa('0x26')](function(_0x5b1c0c){if(_0x5b1c0c){_0x9f884b=_0x5b1c0c[_0x6aaa('0x28')]({'plain':!![]});_0x42a93e['model']=_[_0x6aaa('0x34')](db['UserOpenchannelQueue'][_0x6aaa('0x30')]);_0x42a93e[_0x6aaa('0x35')]=_['keys'](_0xeebd5[_0x6aaa('0x35')]);_0x42a93e['filters']=_[_0x6aaa('0x37')](_0x42a93e['model'],_0x42a93e['query']);_0xc766c9['attributes']=_['intersection'](_0x42a93e[_0x6aaa('0x33')],qs[_0x6aaa('0x38')](_0xeebd5[_0x6aaa('0x35')][_0x6aaa('0x38')]));_0xc766c9['attributes']=_0xc766c9[_0x6aaa('0x39')][_0x6aaa('0x3a')]?_0xc766c9[_0x6aaa('0x39')]:_0x42a93e['model'];if(!_0xeebd5[_0x6aaa('0x35')][_0x6aaa('0x3b')](_0x6aaa('0x3c'))){_0xc766c9[_0x6aaa('0x20')]=qs[_0x6aaa('0x20')](_0xeebd5['query'][_0x6aaa('0x20')]);_0xc766c9[_0x6aaa('0x1d')]=qs[_0x6aaa('0x1d')](_0xeebd5[_0x6aaa('0x35')][_0x6aaa('0x1d')]);}_0xc766c9['order']=qs['sort'](_0xeebd5[_0x6aaa('0x35')][_0x6aaa('0x3d')]);_0xc766c9['where']=qs[_0x6aaa('0x36')](_[_0x6aaa('0x3f')](_0xeebd5[_0x6aaa('0x35')],_0x42a93e['filters']));_0xc766c9[_0x6aaa('0x3e')]['OpenchannelQueueId']=_0x5b1c0c['id'];if(_0xeebd5[_0x6aaa('0x35')][_0x6aaa('0x40')]){_0xc766c9[_0x6aaa('0x3e')]=_[_0x6aaa('0x41')](_0xc766c9['where'],{'$or':_[_0x6aaa('0x42')](_0xc766c9['attributes'],function(_0x22b44b){var _0x44d7aa={};_0x44d7aa[_0x22b44b]={'$like':'%'+_0xeebd5[_0x6aaa('0x35')][_0x6aaa('0x40')]+'%'};return _0x44d7aa;})});}_0xc766c9=_[_0x6aaa('0x41')]({},_0xc766c9,_0xeebd5[_0x6aaa('0x44')]);return db[_0x6aaa('0x58')][_0x6aaa('0x45')](_0xc766c9);}})[_0x6aaa('0x26')](function(_0x2029b5){if(_0x2029b5){return db[_0x6aaa('0x59')][_0x6aaa('0x5a')]({'where':{'id':_[_0x6aaa('0x42')](_0x2029b5,_0x6aaa('0x5b')),'role':_0x6aaa('0x5c')},'attributes':['id',_0x6aaa('0x2c'),_0x6aaa('0x5d'),_0x6aaa('0x5e'),_0x6aaa('0x5f')]});}})['then'](function(_0xf2dd48){if(_0xf2dd48){return{'count':_0xf2dd48[_0x6aaa('0x1f')],'rows':_['map'](_0xf2dd48['rows'],function(_0x8e89bd){return{'membername':_0x8e89bd[_0x6aaa('0x2c')],'UserId':_0x8e89bd['id'],'queue_name':_0x9f884b['name'],'OpenchannelQueueId':_0x9f884b['id'],'interface':util['format'](_0x6aaa('0x60'),_0x6aaa('0x61'),_0x8e89bd[_0x6aaa('0x2c')]),'penalty':0x0,'paused':_0x8e89bd[_0x6aaa('0x5d')],'createdAt':_0x8e89bd['createdAt'],'updatedAt':_0x8e89bd[_0x6aaa('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1898f7,_0xc766c9))['catch'](handleError(_0x1898f7,null));};exports[_0x6aaa('0x62')]=function(_0x5a0705,_0x1427d3,_0x1cd7a7){var _0xb56142={};var _0x25b526={};var _0x183286;var _0x1f15c6;return db[_0x6aaa('0x2f')]['findOne']({'where':{'id':_0x5a0705[_0x6aaa('0x48')]['id']}})['then'](handleEntityNotFound(_0x1427d3,null))[_0x6aaa('0x26')](function(_0x5b7063){if(_0x5b7063){_0x183286=_0x5b7063;_0x25b526[_0x6aaa('0x33')]=_['keys'](db['Team'][_0x6aaa('0x30')]);_0x25b526[_0x6aaa('0x35')]=_[_0x6aaa('0x34')](_0x5a0705[_0x6aaa('0x35')]);_0x25b526[_0x6aaa('0x36')]=_[_0x6aaa('0x37')](_0x25b526[_0x6aaa('0x33')],_0x25b526[_0x6aaa('0x35')]);_0xb56142[_0x6aaa('0x39')]=_['intersection'](_0x25b526[_0x6aaa('0x33')],qs[_0x6aaa('0x38')](_0x5a0705['query'][_0x6aaa('0x38')]));_0xb56142[_0x6aaa('0x39')]=_0xb56142[_0x6aaa('0x39')][_0x6aaa('0x3a')]?_0xb56142[_0x6aaa('0x39')]:_0x25b526[_0x6aaa('0x33')];_0xb56142[_0x6aaa('0x63')]=qs[_0x6aaa('0x3d')](_0x5a0705['query'][_0x6aaa('0x3d')]);_0xb56142[_0x6aaa('0x3e')]=qs[_0x6aaa('0x36')](_['pick'](_0x5a0705[_0x6aaa('0x35')],_0x25b526[_0x6aaa('0x36')]));if(_0x5a0705[_0x6aaa('0x35')][_0x6aaa('0x40')]){_0xb56142[_0x6aaa('0x3e')]=_[_0x6aaa('0x41')](_0xb56142[_0x6aaa('0x3e')],{'$or':_[_0x6aaa('0x42')](_0xb56142[_0x6aaa('0x39')],function(_0x587499){var _0x53c952={};_0x53c952[_0x587499]={'$like':'%'+_0x5a0705[_0x6aaa('0x35')]['filter']+'%'};return _0x53c952;})});}_0xb56142=_['merge']({},_0xb56142,_0x5a0705['options']);return _0x183286[_0x6aaa('0x62')](_0xb56142);}})[_0x6aaa('0x26')](function(_0x58ea97){if(_0x58ea97){_0x1f15c6=_0x58ea97[_0x6aaa('0x3a')];if(!_0x5a0705[_0x6aaa('0x35')][_0x6aaa('0x3b')]('nolimit')){_0xb56142[_0x6aaa('0x20')]=qs['limit'](_0x5a0705[_0x6aaa('0x35')][_0x6aaa('0x20')]);_0xb56142[_0x6aaa('0x1d')]=qs[_0x6aaa('0x1d')](_0x5a0705[_0x6aaa('0x35')][_0x6aaa('0x1d')]);}return _0x183286[_0x6aaa('0x62')](_0xb56142);}})['then'](function(_0x276df9){if(_0x276df9){return _0x276df9?{'count':_0x1f15c6,'rows':_0x276df9}:null;}})[_0x6aaa('0x26')](respondWithResult(_0x1427d3,null))[_0x6aaa('0x46')](handleError(_0x1427d3,null));};exports[_0x6aaa('0x64')]=function(_0x5da396,_0x2b139e,_0x292a52){var _0x5c0cb5=_0x5da396[_0x6aaa('0x4d')]['ids'];return db[_0x6aaa('0x65')][_0x6aaa('0x45')]({'where':{'id':_0x5c0cb5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6aaa('0x66'),'attributes':['id',_0x6aaa('0x2c'),_0x6aaa('0x67'),_0x6aaa('0x68'),_0x6aaa('0x69')],'raw':!![]}]})[_0x6aaa('0x26')](function(_0x2bdc18){if(_0x2bdc18){var _0x451a51=_[_0x6aaa('0x6a')](_0x2bdc18,function(_0x2a65d2){var _0x3229ac=_0x2a65d2[_0x6aaa('0x28')]({'plain':!![]});return _0x3229ac['Agents'];});return db[_0x6aaa('0x2f')][_0x6aaa('0x4b')]({'where':{'id':_0x5da396[_0x6aaa('0x48')]['id']}})['then'](function(_0x33fce4){return db['sequelize'][_0x6aaa('0x6b')](function(_0x14c7d7){return _0x33fce4[_0x6aaa('0x64')](_0x5c0cb5,{'transaction':_0x14c7d7})[_0x6aaa('0x26')](function(){return BPromise[_0x6aaa('0x6c')](_0x451a51,function(_0x1dc235){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x1dc235['id'],'OpenchannelQueueId':_0x5da396[_0x6aaa('0x48')]['id']},'transaction':_0x14c7d7});});})['then'](function(){_0x451a51[_0x6aaa('0x6d')](function(_0x5c48b5){socket['emit'](_0x6aaa('0x6e'),{'UserId':_0x5c48b5['id'],'OpenchannelQueueId':_0x33fce4['id']});});});});});}})[_0x6aaa('0x26')](respondWithStatusCode(_0x2b139e,null))[_0x6aaa('0x46')](handleError(_0x2b139e,null));};exports[_0x6aaa('0x6f')]=function(_0x2a5f0e,_0x2936f7,_0x48b272){return db[_0x6aaa('0x65')][_0x6aaa('0x45')]({'where':{'id':_0x2a5f0e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x6aaa('0x59')],'as':_0x6aaa('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2936f7,null))[_0x6aaa('0x26')](function(_0x240b3a){var _0x3bd279=_[_0x6aaa('0x42')](_0x240b3a,'id');var _0x1d17e5=[];var _0x3b266f=[];var _0x586b72=squel[_0x6aaa('0x70')]();_0x586b72[_0x6aaa('0x71')](_0x6aaa('0x72'))[_0x6aaa('0x73')]('team_has_openchannel_queues','tq')[_0x6aaa('0x74')](_0x6aaa('0x75'),'ut',_0x6aaa('0x76'))['where'](_0x6aaa('0x77'),_0x2a5f0e['params']['id']);for(var _0x2cc3d6=0x0;_0x2cc3d6<_0x240b3a[_0x6aaa('0x3a')];_0x2cc3d6+=0x1){let _0x22687e=_0x240b3a[_0x2cc3d6];for(var _0x91d9f0=0x0;_0x91d9f0<_0x22687e[_0x6aaa('0x66')]['length'];_0x91d9f0+=0x1){let _0x1e8db3=_0x22687e[_0x6aaa('0x66')][_0x91d9f0];var _0x37e2e2=_0x586b72[_0x6aaa('0x78')]();_0x37e2e2[_0x6aaa('0x3e')](_0x6aaa('0x79'),_0x1e8db3['id']);_0x3b266f[_0x6aaa('0x7a')](db[_0x6aaa('0x7b')][_0x6aaa('0x35')](_0x37e2e2['toString'](),{'type':db[_0x6aaa('0x7b')][_0x6aaa('0x7c')][_0x6aaa('0x7d')]})[_0x6aaa('0x26')](function(_0x27b2bb){if(_0x27b2bb['length']===0x1){return _0x1e8db3['id'];}else{var _0x576348=_[_0x6aaa('0x7e')](_['map'](_0x27b2bb,_0x6aaa('0x7f')),function(_0x14501c){return _[_0x6aaa('0x80')](_0x3bd279,_0x14501c);});if(_0x576348){return _0x1e8db3['id'];}}}));}}return BPromise[_0x6aaa('0x81')](_0x3b266f)[_0x6aaa('0x26')](function(_0x57622b){_0x1d17e5=_(_0x1d17e5)[_0x6aaa('0x82')](_0x57622b)[_0x6aaa('0x83')]()[_0x6aaa('0x84')]();return db[_0x6aaa('0x2f')][_0x6aaa('0x4b')]({'where':{'id':_0x2a5f0e['params']['id']}})[_0x6aaa('0x26')](function(_0x180f5a){return db[_0x6aaa('0x7b')][_0x6aaa('0x6b')](function(_0x1df6c5){return _0x180f5a['removeTeams'](_0x2a5f0e[_0x6aaa('0x35')][_0x6aaa('0x85')],{'transaction':_0x1df6c5})[_0x6aaa('0x26')](function(){if(!_[_0x6aaa('0x86')](_0x1d17e5)){return _0x180f5a[_0x6aaa('0x87')](_0x1d17e5,{'transaction':_0x1df6c5});}})[_0x6aaa('0x26')](function(){_0x1d17e5[_0x6aaa('0x6d')](function(_0x4f4158){socket['emit'](_0x6aaa('0x88'),{'UserId':_0x4f4158,'OpenchannelQueueId':_0x180f5a['id']});});});});});});})['then'](respondWithStatusCode(_0x2936f7,null))[_0x6aaa('0x46')](handleError(_0x2936f7,null));};exports[_0x6aaa('0x89')]=function(_0x251626,_0x2bb7ea,_0x2556be){return db['OpenchannelQueue']['find']({'where':{'id':_0x251626[_0x6aaa('0x48')]['id']}})[_0x6aaa('0x26')](handleEntityNotFound(_0x2bb7ea,null))[_0x6aaa('0x26')](function(_0xe7adcd){if(_0xe7adcd){return _0xe7adcd['addAgents'](_0x251626[_0x6aaa('0x4d')][_0x6aaa('0x85')],_['omit'](_0x251626['body'],[_0x6aaa('0x85'),'id'])||{})['spread'](function(_0x33e9c5){for(var _0x5b5f54=0x0;_0x5b5f54<_0x251626[_0x6aaa('0x4d')][_0x6aaa('0x85')][_0x6aaa('0x3a')];_0x5b5f54+=0x1){socket[_0x6aaa('0x8a')]('userOpenchannelQueue:save',{'UserId':Number(_0x251626[_0x6aaa('0x4d')][_0x6aaa('0x85')][_0x5b5f54]),'OpenchannelQueueId':Number(_0x251626[_0x6aaa('0x48')]['id'])});}return _0x33e9c5;});}})['then'](respondWithResult(_0x2bb7ea,null))[_0x6aaa('0x46')](handleError(_0x2bb7ea,null));};exports[_0x6aaa('0x87')]=function(_0x18ed91,_0x22ab5f,_0x4be03f){return db[_0x6aaa('0x2f')][_0x6aaa('0x4b')]({'where':{'id':_0x18ed91[_0x6aaa('0x48')]['id']}})[_0x6aaa('0x26')](handleEntityNotFound(_0x22ab5f,null))[_0x6aaa('0x26')](function(_0x1ff0e9){if(_0x1ff0e9){return _0x1ff0e9[_0x6aaa('0x87')](_0x18ed91[_0x6aaa('0x35')][_0x6aaa('0x85')])['then'](function(){if(_[_0x6aaa('0x8b')](_0x18ed91[_0x6aaa('0x35')][_0x6aaa('0x85')])){for(var _0xc183ea=0x0;_0xc183ea<_0x18ed91[_0x6aaa('0x35')]['ids']['length'];_0xc183ea+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x18ed91[_0x6aaa('0x35')][_0x6aaa('0x85')][_0xc183ea]),'OpenchannelQueueId':Number(_0x18ed91['params']['id'])});}}else{socket[_0x6aaa('0x8a')](_0x6aaa('0x88'),{'UserId':Number(_0x18ed91[_0x6aaa('0x35')][_0x6aaa('0x85')]),'OpenchannelQueueId':Number(_0x18ed91['params']['id'])});}});}})[_0x6aaa('0x26')](respondWithStatusCode(_0x22ab5f,null))[_0x6aaa('0x46')](handleError(_0x22ab5f,null));};exports['getAgents']=function(_0x30911e,_0x1c39f8,_0x3727bd){var _0x505852={};var _0x13f04c={};var _0x3c4c43;var _0x5bf1cb;return db[_0x6aaa('0x2f')][_0x6aaa('0x57')]({'where':{'id':_0x30911e[_0x6aaa('0x48')]['id']}})[_0x6aaa('0x26')](handleEntityNotFound(_0x1c39f8,null))[_0x6aaa('0x26')](function(_0x2a7b9f){if(_0x2a7b9f){_0x3c4c43=_0x2a7b9f;_0x13f04c[_0x6aaa('0x33')]=_['keys'](db['User'][_0x6aaa('0x30')]);_0x13f04c[_0x6aaa('0x35')]=_[_0x6aaa('0x34')](_0x30911e['query']);_0x13f04c[_0x6aaa('0x36')]=_[_0x6aaa('0x37')](_0x13f04c[_0x6aaa('0x33')],_0x13f04c[_0x6aaa('0x35')]);_0x505852[_0x6aaa('0x39')]=_['intersection'](_0x13f04c[_0x6aaa('0x33')],qs[_0x6aaa('0x38')](_0x30911e[_0x6aaa('0x35')]['fields']));_0x505852[_0x6aaa('0x39')]=_0x505852[_0x6aaa('0x39')][_0x6aaa('0x3a')]?_0x505852[_0x6aaa('0x39')]:_0x13f04c[_0x6aaa('0x33')];_0x505852[_0x6aaa('0x63')]=qs[_0x6aaa('0x3d')](_0x30911e[_0x6aaa('0x35')][_0x6aaa('0x3d')]);_0x505852[_0x6aaa('0x3e')]=qs['filters'](_[_0x6aaa('0x3f')](_0x30911e[_0x6aaa('0x35')],_0x13f04c[_0x6aaa('0x36')]));if(_0x30911e[_0x6aaa('0x35')]['filter']){_0x505852[_0x6aaa('0x3e')]=_[_0x6aaa('0x41')](_0x505852[_0x6aaa('0x3e')],{'$or':_['map'](_0x505852[_0x6aaa('0x39')],function(_0xa90c85){var _0x288da3={};_0x288da3[_0xa90c85]={'$like':'%'+_0x30911e[_0x6aaa('0x35')][_0x6aaa('0x40')]+'%'};return _0x288da3;})});}_0x505852=_['merge']({},_0x505852,_0x30911e[_0x6aaa('0x44')]);return _0x3c4c43[_0x6aaa('0x8c')](_0x505852);}})[_0x6aaa('0x26')](function(_0x5397b5){if(_0x5397b5){_0x5bf1cb=_0x5397b5[_0x6aaa('0x3a')];if(!_0x30911e[_0x6aaa('0x35')][_0x6aaa('0x3b')](_0x6aaa('0x3c'))){_0x505852[_0x6aaa('0x20')]=qs['limit'](_0x30911e[_0x6aaa('0x35')][_0x6aaa('0x20')]);_0x505852[_0x6aaa('0x1d')]=qs[_0x6aaa('0x1d')](_0x30911e[_0x6aaa('0x35')]['offset']);}return _0x3c4c43[_0x6aaa('0x8c')](_0x505852);}})['then'](function(_0x481028){if(_0x481028){return _0x481028?{'count':_0x5bf1cb,'rows':_0x481028}:null;}})[_0x6aaa('0x26')](respondWithResult(_0x1c39f8,null))[_0x6aaa('0x46')](handleError(_0x1c39f8,null));}; \ No newline at end of file +var _0x3b8a=['addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','key','model','keys','filters','intersection','attributes','fields','hasOwnProperty','query','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','OpenchannelQueue','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','nolimit','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x3b8a,0x96));var _0xa3b8=function(_0x48e64c,_0x28b429){_0x48e64c=_0x48e64c-0x0;var _0xf2b75a=_0x3b8a[_0x48e64c];return _0xf2b75a;};'use strict';var emlformat=require(_0xa3b8('0x0'));var rimraf=require(_0xa3b8('0x1'));var zipdir=require(_0xa3b8('0x2'));var jsonpatch=require(_0xa3b8('0x3'));var rp=require(_0xa3b8('0x4'));var moment=require('moment');var BPromise=require(_0xa3b8('0x5'));var Mustache=require(_0xa3b8('0x6'));var util=require('util');var path=require(_0xa3b8('0x7'));var sox=require(_0xa3b8('0x8'));var csv=require('to-csv');var ejs=require(_0xa3b8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3b8('0xa'));var squel=require(_0xa3b8('0xb'));var crypto=require(_0xa3b8('0xc'));var jsforce=require(_0xa3b8('0xd'));var deskjs=require(_0xa3b8('0xe'));var toCsv=require(_0xa3b8('0xf'));var querystring=require('querystring');var Papa=require(_0xa3b8('0x10'));var Redis=require(_0xa3b8('0x11'));var authService=require(_0xa3b8('0x12'));var qs=require(_0xa3b8('0x13'));var as=require(_0xa3b8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3b8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa3b8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3b8('0x17'))['db'];config[_0xa3b8('0x18')]=_['defaults'](config[_0xa3b8('0x18')],{'host':_0xa3b8('0x19'),'port':0x18eb});var socket=require(_0xa3b8('0x1a'))(new Redis(config[_0xa3b8('0x18')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x3d3a12,_0x5cf26b){_0x5cf26b=_0x5cf26b||0xcc;return function(_0x26e1bb){if(_0x26e1bb){return _0x3d3a12[_0xa3b8('0x1b')](_0x5cf26b);}return _0x3d3a12[_0xa3b8('0x1c')](_0x5cf26b)[_0xa3b8('0x1d')]();};}function respondWithResult(_0x3dc47e,_0x9e410a){_0x9e410a=_0x9e410a||0xc8;return function(_0x4ce3de){if(_0x4ce3de){return _0x3dc47e[_0xa3b8('0x1c')](_0x9e410a)[_0xa3b8('0x1e')](_0x4ce3de);}};}function respondWithFilteredResult(_0xebdf9f,_0x10be80){return function(_0x12d419){if(_0x12d419){var _0x2ad1e0=typeof _0x10be80[_0xa3b8('0x1f')]===_0xa3b8('0x20')&&typeof _0x10be80[_0xa3b8('0x21')]===_0xa3b8('0x20');var _0x3b3e60=_0x12d419[_0xa3b8('0x22')];var _0x1deabe=_0x2ad1e0?0x0:_0x10be80[_0xa3b8('0x1f')];var _0xcc455e=_0x2ad1e0?_0x12d419['count']:_0x10be80['offset']+_0x10be80['limit'];var _0x144f3b;if(_0xcc455e>=_0x3b3e60){_0xcc455e=_0x3b3e60;_0x144f3b=0xc8;}else{_0x144f3b=0xce;}_0xebdf9f[_0xa3b8('0x1c')](_0x144f3b);return _0xebdf9f['set'](_0xa3b8('0x23'),_0x1deabe+'-'+_0xcc455e+'/'+_0x3b3e60)[_0xa3b8('0x1e')](_0x12d419);}return null;};}function patchUpdates(_0x2a68e2){return function(_0x488fd1){try{jsonpatch[_0xa3b8('0x24')](_0x488fd1,_0x2a68e2,!![]);}catch(_0x181607){return BPromise[_0xa3b8('0x25')](_0x181607);}return _0x488fd1[_0xa3b8('0x26')]();};}function saveUpdates(_0xf5c61,_0x13abdf){return function(_0x28b12a){if(_0x28b12a){return _0x28b12a[_0xa3b8('0x27')](_0xf5c61)[_0xa3b8('0x28')](function(_0xb5dbd2){return _0xb5dbd2;});}return null;};}function removeEntity(_0x1efc0a,_0x42a48d){return function(_0x27b970){if(_0x27b970){return _0x27b970[_0xa3b8('0x29')]()['then'](function(){var _0x3d61f8=_0x27b970['get']({'plain':!![]});var _0x1f50ff=_0xa3b8('0x2a');return db[_0xa3b8('0x2b')][_0xa3b8('0x29')]({'where':{'type':_0x1f50ff,'resourceId':_0x3d61f8['id']}})[_0xa3b8('0x28')](function(){return _0x27b970;});})[_0xa3b8('0x28')](function(){_0x1efc0a[_0xa3b8('0x1c')](0xcc)[_0xa3b8('0x1d')]();});}};}function handleEntityNotFound(_0x1cdb56,_0x25a4c1){return function(_0x57179f){if(!_0x57179f){_0x1cdb56[_0xa3b8('0x1b')](0x194);}return _0x57179f;};}function handleError(_0x7eb489,_0x192d47){_0x192d47=_0x192d47||0x1f4;return function(_0x222e02){logger[_0xa3b8('0x2c')](_0x222e02[_0xa3b8('0x2d')]);if(_0x222e02[_0xa3b8('0x2e')]){delete _0x222e02['name'];}_0x7eb489[_0xa3b8('0x1c')](_0x192d47)[_0xa3b8('0x2f')](_0x222e02);};}exports[_0xa3b8('0x30')]=function(_0x1166c7,_0x54249e){var _0x2ccee9={},_0x51e8d8={},_0x56070c={'count':0x0,'rows':[]};var _0x4d3c63=_[_0xa3b8('0x31')](db['OpenchannelQueue']['rawAttributes'],function(_0x55ebdc){return{'name':_0x55ebdc['fieldName'],'type':_0x55ebdc['type'][_0xa3b8('0x32')]};});_0x51e8d8[_0xa3b8('0x33')]=_['map'](_0x4d3c63,_0xa3b8('0x2e'));_0x51e8d8['query']=_[_0xa3b8('0x34')](_0x1166c7['query']);_0x51e8d8[_0xa3b8('0x35')]=_[_0xa3b8('0x36')](_0x51e8d8[_0xa3b8('0x33')],_0x51e8d8['query']);_0x2ccee9[_0xa3b8('0x37')]=_[_0xa3b8('0x36')](_0x51e8d8[_0xa3b8('0x33')],qs[_0xa3b8('0x38')](_0x1166c7['query'][_0xa3b8('0x38')]));_0x2ccee9[_0xa3b8('0x37')]=_0x2ccee9[_0xa3b8('0x37')]['length']?_0x2ccee9[_0xa3b8('0x37')]:_0x51e8d8[_0xa3b8('0x33')];if(!_0x1166c7['query'][_0xa3b8('0x39')]('nolimit')){_0x2ccee9['limit']=qs[_0xa3b8('0x21')](_0x1166c7[_0xa3b8('0x3a')][_0xa3b8('0x21')]);_0x2ccee9[_0xa3b8('0x1f')]=qs[_0xa3b8('0x1f')](_0x1166c7[_0xa3b8('0x3a')][_0xa3b8('0x1f')]);}_0x2ccee9[_0xa3b8('0x3b')]=qs[_0xa3b8('0x3c')](_0x1166c7[_0xa3b8('0x3a')][_0xa3b8('0x3c')]);_0x2ccee9[_0xa3b8('0x3d')]=qs[_0xa3b8('0x35')](_[_0xa3b8('0x3e')](_0x1166c7[_0xa3b8('0x3a')],_0x51e8d8[_0xa3b8('0x35')]),_0x4d3c63);if(_0x1166c7['query'][_0xa3b8('0x3f')]){_0x2ccee9[_0xa3b8('0x3d')]=_['merge'](_0x2ccee9[_0xa3b8('0x3d')],{'$or':_[_0xa3b8('0x31')](_0x4d3c63,function(_0x1ebb7a){if(_0x1ebb7a[_0xa3b8('0x40')]!==_0xa3b8('0x41')){var _0x3ea252={};_0x3ea252[_0x1ebb7a[_0xa3b8('0x2e')]]={'$like':'%'+_0x1166c7['query'][_0xa3b8('0x3f')]+'%'};return _0x3ea252;}})});}_0x2ccee9=_[_0xa3b8('0x42')]({},_0x2ccee9,_0x1166c7[_0xa3b8('0x43')]);var _0x31f4bc={'where':_0x2ccee9[_0xa3b8('0x3d')]};return db['OpenchannelQueue'][_0xa3b8('0x22')](_0x31f4bc)[_0xa3b8('0x28')](function(_0xbcc9b5){_0x56070c[_0xa3b8('0x22')]=_0xbcc9b5;if(_0x1166c7['query'][_0xa3b8('0x44')]){_0x2ccee9[_0xa3b8('0x45')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xa3b8('0x46')](_0x2ccee9);})[_0xa3b8('0x28')](function(_0x24b77b){_0x56070c[_0xa3b8('0x47')]=_0x24b77b;return _0x56070c;})[_0xa3b8('0x28')](respondWithFilteredResult(_0x54249e,_0x2ccee9))[_0xa3b8('0x48')](handleError(_0x54249e,null));};exports[_0xa3b8('0x49')]=function(_0x14d625,_0x315a54){var _0x1023df={'raw':!![],'where':{'id':_0x14d625[_0xa3b8('0x4a')]['id']}},_0x132037={};_0x132037[_0xa3b8('0x33')]=_['keys'](db[_0xa3b8('0x4b')]['rawAttributes']);_0x132037[_0xa3b8('0x3a')]=_['keys'](_0x14d625[_0xa3b8('0x3a')]);_0x132037[_0xa3b8('0x35')]=_[_0xa3b8('0x36')](_0x132037['model'],_0x132037[_0xa3b8('0x3a')]);_0x1023df[_0xa3b8('0x37')]=_[_0xa3b8('0x36')](_0x132037[_0xa3b8('0x33')],qs[_0xa3b8('0x38')](_0x14d625[_0xa3b8('0x3a')][_0xa3b8('0x38')]));_0x1023df[_0xa3b8('0x37')]=_0x1023df[_0xa3b8('0x37')][_0xa3b8('0x4c')]?_0x1023df[_0xa3b8('0x37')]:_0x132037[_0xa3b8('0x33')];if(_0x14d625[_0xa3b8('0x3a')][_0xa3b8('0x44')]){_0x1023df[_0xa3b8('0x45')]=[{'all':!![]}];}_0x1023df=_[_0xa3b8('0x42')]({},_0x1023df,_0x14d625[_0xa3b8('0x43')]);return db[_0xa3b8('0x4b')][_0xa3b8('0x4d')](_0x1023df)[_0xa3b8('0x28')](handleEntityNotFound(_0x315a54,null))[_0xa3b8('0x28')](respondWithResult(_0x315a54,null))['catch'](handleError(_0x315a54,null));};exports[_0xa3b8('0x4e')]=function(_0x22ef11,_0x2a8f3d){return db[_0xa3b8('0x4b')][_0xa3b8('0x4e')](_0x22ef11[_0xa3b8('0x4f')],{})[_0xa3b8('0x28')](function(_0x3814f6){var _0x1b2bfe=_0x22ef11[_0xa3b8('0x50')]['get']({'plain':!![]});if(!_0x1b2bfe)throw new Error(_0xa3b8('0x51'));if(_0x1b2bfe[_0xa3b8('0x52')]==='user'){var _0x21bba3=_0x3814f6[_0xa3b8('0x53')]({'plain':!![]});var _0x4092b9=_0xa3b8('0x2a');return db['UserProfileSection'][_0xa3b8('0x4d')]({'where':{'name':_0x4092b9,'userProfileId':_0x1b2bfe[_0xa3b8('0x54')]},'raw':!![]})[_0xa3b8('0x28')](function(_0x12ae9f){if(_0x12ae9f&&_0x12ae9f[_0xa3b8('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x21bba3[_0xa3b8('0x2e')],'resourceId':_0x21bba3['id'],'type':_0x12ae9f['name'],'sectionId':_0x12ae9f['id']},{})[_0xa3b8('0x28')](function(){return _0x3814f6;});}else{return _0x3814f6;}})[_0xa3b8('0x48')](function(_0x4423b1){logger[_0xa3b8('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4423b1);throw _0x4423b1;});}return _0x3814f6;})[_0xa3b8('0x28')](respondWithResult(_0x2a8f3d,0xc9))['catch'](handleError(_0x2a8f3d,null));};exports[_0xa3b8('0x27')]=function(_0x671177,_0x54da2d){if(_0x671177[_0xa3b8('0x4f')]['id']){delete _0x671177[_0xa3b8('0x4f')]['id'];}return db[_0xa3b8('0x4b')][_0xa3b8('0x4d')]({'where':{'id':_0x671177[_0xa3b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x54da2d,null))['then'](saveUpdates(_0x671177[_0xa3b8('0x4f')],null))['then'](respondWithResult(_0x54da2d,null))['catch'](handleError(_0x54da2d,null));};exports[_0xa3b8('0x29')]=function(_0x2ab720,_0x202fc4){return db['OpenchannelQueue'][_0xa3b8('0x4d')]({'where':{'id':_0x2ab720[_0xa3b8('0x4a')]['id']}})[_0xa3b8('0x28')](handleEntityNotFound(_0x202fc4,null))['then'](removeEntity(_0x202fc4,null))[_0xa3b8('0x48')](handleError(_0x202fc4,null));};exports[_0xa3b8('0x56')]=function(_0x5128fa,_0x5a1af1){return db['OpenchannelQueue'][_0xa3b8('0x56')]()[_0xa3b8('0x28')](respondWithResult(_0x5a1af1,null))[_0xa3b8('0x48')](handleError(_0x5a1af1,null));};exports[_0xa3b8('0x57')]=function(_0x30b6ea,_0x53fea0,_0xcfbab8){var _0x22aae8={'raw':!![],'where':{}},_0x4e55e8={},_0x216df3;return db['OpenchannelQueue'][_0xa3b8('0x58')]({'where':{'id':_0x30b6ea['params']['id']}})[_0xa3b8('0x28')](handleEntityNotFound(_0x53fea0,null))['then'](function(_0x24550f){if(_0x24550f){_0x216df3=_0x24550f[_0xa3b8('0x53')]({'plain':!![]});_0x4e55e8['model']=_['keys'](db[_0xa3b8('0x59')][_0xa3b8('0x5a')]);_0x4e55e8[_0xa3b8('0x3a')]=_[_0xa3b8('0x34')](_0x30b6ea['query']);_0x4e55e8[_0xa3b8('0x35')]=_['intersection'](_0x4e55e8[_0xa3b8('0x33')],_0x4e55e8['query']);_0x22aae8[_0xa3b8('0x37')]=_['intersection'](_0x4e55e8[_0xa3b8('0x33')],qs[_0xa3b8('0x38')](_0x30b6ea['query'][_0xa3b8('0x38')]));_0x22aae8[_0xa3b8('0x37')]=_0x22aae8[_0xa3b8('0x37')][_0xa3b8('0x4c')]?_0x22aae8[_0xa3b8('0x37')]:_0x4e55e8[_0xa3b8('0x33')];if(!_0x30b6ea[_0xa3b8('0x3a')][_0xa3b8('0x39')](_0xa3b8('0x5b'))){_0x22aae8[_0xa3b8('0x21')]=qs['limit'](_0x30b6ea[_0xa3b8('0x3a')][_0xa3b8('0x21')]);_0x22aae8[_0xa3b8('0x1f')]=qs[_0xa3b8('0x1f')](_0x30b6ea['query'][_0xa3b8('0x1f')]);}_0x22aae8[_0xa3b8('0x3b')]=qs[_0xa3b8('0x3c')](_0x30b6ea[_0xa3b8('0x3a')][_0xa3b8('0x3c')]);_0x22aae8[_0xa3b8('0x3d')]=qs[_0xa3b8('0x35')](_['pick'](_0x30b6ea['query'],_0x4e55e8[_0xa3b8('0x35')]));_0x22aae8[_0xa3b8('0x3d')][_0xa3b8('0x5c')]=_0x24550f['id'];if(_0x30b6ea['query'][_0xa3b8('0x3f')]){_0x22aae8[_0xa3b8('0x3d')]=_[_0xa3b8('0x42')](_0x22aae8[_0xa3b8('0x3d')],{'$or':_['map'](_0x22aae8[_0xa3b8('0x37')],function(_0x2b9811){var _0x51f2e7={};_0x51f2e7[_0x2b9811]={'$like':'%'+_0x30b6ea[_0xa3b8('0x3a')][_0xa3b8('0x3f')]+'%'};return _0x51f2e7;})});}_0x22aae8=_['merge']({},_0x22aae8,_0x30b6ea[_0xa3b8('0x43')]);return db[_0xa3b8('0x59')][_0xa3b8('0x46')](_0x22aae8);}})['then'](function(_0x36cc68){if(_0x36cc68){return db[_0xa3b8('0x5d')]['findAndCountAll']({'where':{'id':_[_0xa3b8('0x31')](_0x36cc68,_0xa3b8('0x5e')),'role':_0xa3b8('0x5f')},'attributes':['id',_0xa3b8('0x2e'),_0xa3b8('0x60'),_0xa3b8('0x61'),_0xa3b8('0x62')]});}})[_0xa3b8('0x28')](function(_0x3f4e0b){if(_0x3f4e0b){return{'count':_0x3f4e0b[_0xa3b8('0x22')],'rows':_[_0xa3b8('0x31')](_0x3f4e0b[_0xa3b8('0x47')],function(_0xbe53eb){return{'membername':_0xbe53eb[_0xa3b8('0x2e')],'UserId':_0xbe53eb['id'],'queue_name':_0x216df3[_0xa3b8('0x2e')],'OpenchannelQueueId':_0x216df3['id'],'interface':util[_0xa3b8('0x63')](_0xa3b8('0x64'),_0xa3b8('0x65'),_0xbe53eb[_0xa3b8('0x2e')]),'penalty':0x0,'paused':_0xbe53eb[_0xa3b8('0x60')],'createdAt':_0xbe53eb[_0xa3b8('0x62')],'updatedAt':_0xbe53eb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa3b8('0x28')](respondWithFilteredResult(_0x53fea0,_0x22aae8))[_0xa3b8('0x48')](handleError(_0x53fea0,null));};exports[_0xa3b8('0x66')]=function(_0x5135c2,_0x3fef40,_0x3f0005){var _0x5a54bc={};var _0x211f15={};var _0xdb9f7a;var _0x2ea537;return db[_0xa3b8('0x4b')][_0xa3b8('0x58')]({'where':{'id':_0x5135c2['params']['id']}})['then'](handleEntityNotFound(_0x3fef40,null))[_0xa3b8('0x28')](function(_0xdd397d){if(_0xdd397d){_0xdb9f7a=_0xdd397d;_0x211f15[_0xa3b8('0x33')]=_[_0xa3b8('0x34')](db[_0xa3b8('0x67')]['rawAttributes']);_0x211f15[_0xa3b8('0x3a')]=_[_0xa3b8('0x34')](_0x5135c2['query']);_0x211f15[_0xa3b8('0x35')]=_[_0xa3b8('0x36')](_0x211f15[_0xa3b8('0x33')],_0x211f15[_0xa3b8('0x3a')]);_0x5a54bc[_0xa3b8('0x37')]=_[_0xa3b8('0x36')](_0x211f15[_0xa3b8('0x33')],qs[_0xa3b8('0x38')](_0x5135c2['query'][_0xa3b8('0x38')]));_0x5a54bc['attributes']=_0x5a54bc[_0xa3b8('0x37')][_0xa3b8('0x4c')]?_0x5a54bc[_0xa3b8('0x37')]:_0x211f15[_0xa3b8('0x33')];_0x5a54bc[_0xa3b8('0x3b')]=qs[_0xa3b8('0x3c')](_0x5135c2[_0xa3b8('0x3a')][_0xa3b8('0x3c')]);_0x5a54bc[_0xa3b8('0x3d')]=qs[_0xa3b8('0x35')](_['pick'](_0x5135c2[_0xa3b8('0x3a')],_0x211f15[_0xa3b8('0x35')]));if(_0x5135c2[_0xa3b8('0x3a')][_0xa3b8('0x3f')]){_0x5a54bc[_0xa3b8('0x3d')]=_[_0xa3b8('0x42')](_0x5a54bc['where'],{'$or':_['map'](_0x5a54bc[_0xa3b8('0x37')],function(_0xf68ac2){var _0x4680d3={};_0x4680d3[_0xf68ac2]={'$like':'%'+_0x5135c2[_0xa3b8('0x3a')][_0xa3b8('0x3f')]+'%'};return _0x4680d3;})});}_0x5a54bc=_[_0xa3b8('0x42')]({},_0x5a54bc,_0x5135c2['options']);return _0xdb9f7a[_0xa3b8('0x66')](_0x5a54bc);}})['then'](function(_0x3ea4c7){if(_0x3ea4c7){_0x2ea537=_0x3ea4c7[_0xa3b8('0x4c')];if(!_0x5135c2[_0xa3b8('0x3a')]['hasOwnProperty'](_0xa3b8('0x5b'))){_0x5a54bc[_0xa3b8('0x21')]=qs[_0xa3b8('0x21')](_0x5135c2[_0xa3b8('0x3a')][_0xa3b8('0x21')]);_0x5a54bc[_0xa3b8('0x1f')]=qs[_0xa3b8('0x1f')](_0x5135c2[_0xa3b8('0x3a')][_0xa3b8('0x1f')]);}return _0xdb9f7a['getTeams'](_0x5a54bc);}})[_0xa3b8('0x28')](function(_0x134881){if(_0x134881){return _0x134881?{'count':_0x2ea537,'rows':_0x134881}:null;}})[_0xa3b8('0x28')](respondWithResult(_0x3fef40,null))['catch'](handleError(_0x3fef40,null));};exports['addTeams']=function(_0x190d5a,_0x4f1211,_0x1fe3a1){var _0x40ce36=_0x190d5a[_0xa3b8('0x4f')][_0xa3b8('0x68')];return db[_0xa3b8('0x67')]['findAll']({'where':{'id':_0x40ce36},'attributes':['id'],'include':[{'model':db[_0xa3b8('0x5d')],'as':_0xa3b8('0x69'),'attributes':['id',_0xa3b8('0x2e'),_0xa3b8('0x6a'),_0xa3b8('0x6b'),_0xa3b8('0x6c')],'raw':!![]}]})['then'](function(_0x5bbc16){if(_0x5bbc16){var _0x1b7bf9=_[_0xa3b8('0x6d')](_0x5bbc16,function(_0x5d58ec){var _0x57bbc7=_0x5d58ec[_0xa3b8('0x53')]({'plain':!![]});return _0x57bbc7[_0xa3b8('0x69')];});return db[_0xa3b8('0x4b')][_0xa3b8('0x4d')]({'where':{'id':_0x190d5a[_0xa3b8('0x4a')]['id']}})[_0xa3b8('0x28')](function(_0x18f44c){return db['sequelize'][_0xa3b8('0x6e')](function(_0x44f410){return _0x18f44c[_0xa3b8('0x6f')](_0x40ce36,{'transaction':_0x44f410})['then'](function(){return BPromise[_0xa3b8('0x70')](_0x1b7bf9,function(_0xafcca0){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0xafcca0['id'],'OpenchannelQueueId':_0x190d5a[_0xa3b8('0x4a')]['id']},'transaction':_0x44f410});});})[_0xa3b8('0x28')](function(){_0x1b7bf9['forEach'](function(_0x581a76){socket[_0xa3b8('0x71')]('userOpenchannelQueue:save',{'UserId':_0x581a76['id'],'OpenchannelQueueId':_0x18f44c['id']});});});});});}})['then'](respondWithStatusCode(_0x4f1211,null))[_0xa3b8('0x48')](handleError(_0x4f1211,null));};exports[_0xa3b8('0x72')]=function(_0x3804c6,_0x589d4e,_0x388e14){return db[_0xa3b8('0x67')][_0xa3b8('0x46')]({'where':{'id':_0x3804c6[_0xa3b8('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa3b8('0x69'),'attributes':['id'],'raw':!![]}]})[_0xa3b8('0x28')](handleEntityNotFound(_0x589d4e,null))[_0xa3b8('0x28')](function(_0x3fa4d7){var _0x3847a4=_['map'](_0x3fa4d7,'id');var _0x5195ec=[];var _0x8d5a51=[];var _0xebcdbf=squel[_0xa3b8('0x73')]();_0xebcdbf[_0xa3b8('0x74')](_0xa3b8('0x75'))[_0xa3b8('0x76')](_0xa3b8('0x77'),'tq')['join']('user_has_teams','ut',_0xa3b8('0x78'))['where'](_0xa3b8('0x79'),_0x3804c6[_0xa3b8('0x4a')]['id']);for(var _0x53cb8e=0x0;_0x53cb8e<_0x3fa4d7['length'];_0x53cb8e+=0x1){let _0x172c4d=_0x3fa4d7[_0x53cb8e];for(var _0x3b9819=0x0;_0x3b9819<_0x172c4d[_0xa3b8('0x69')]['length'];_0x3b9819+=0x1){let _0x4ee5ac=_0x172c4d[_0xa3b8('0x69')][_0x3b9819];var _0x4e2e06=_0xebcdbf[_0xa3b8('0x7a')]();_0x4e2e06['where'](_0xa3b8('0x7b'),_0x4ee5ac['id']);_0x8d5a51[_0xa3b8('0x7c')](db[_0xa3b8('0x7d')]['query'](_0x4e2e06[_0xa3b8('0x7e')](),{'type':db[_0xa3b8('0x7d')][_0xa3b8('0x7f')][_0xa3b8('0x80')]})[_0xa3b8('0x28')](function(_0x22bf55){if(_0x22bf55[_0xa3b8('0x4c')]===0x1){return _0x4ee5ac['id'];}else{var _0x332240=_[_0xa3b8('0x81')](_[_0xa3b8('0x31')](_0x22bf55,_0xa3b8('0x82')),function(_0x2782a9){return _[_0xa3b8('0x83')](_0x3847a4,_0x2782a9);});if(_0x332240){return _0x4ee5ac['id'];}}}));}}return BPromise[_0xa3b8('0x84')](_0x8d5a51)[_0xa3b8('0x28')](function(_0x1af5bb){_0x5195ec=_(_0x5195ec)[_0xa3b8('0x85')](_0x1af5bb)['compact']()[_0xa3b8('0x86')]();return db['OpenchannelQueue'][_0xa3b8('0x4d')]({'where':{'id':_0x3804c6[_0xa3b8('0x4a')]['id']}})[_0xa3b8('0x28')](function(_0x5a50bc){return db[_0xa3b8('0x7d')]['transaction'](function(_0x37432b){return _0x5a50bc['removeTeams'](_0x3804c6[_0xa3b8('0x3a')][_0xa3b8('0x68')],{'transaction':_0x37432b})[_0xa3b8('0x28')](function(){if(!_[_0xa3b8('0x87')](_0x5195ec)){return _0x5a50bc[_0xa3b8('0x88')](_0x5195ec,{'transaction':_0x37432b});}})['then'](function(){_0x5195ec['forEach'](function(_0x37fce9){socket[_0xa3b8('0x71')](_0xa3b8('0x89'),{'UserId':_0x37fce9,'OpenchannelQueueId':_0x5a50bc['id']});});});});});});})[_0xa3b8('0x28')](respondWithStatusCode(_0x589d4e,null))[_0xa3b8('0x48')](handleError(_0x589d4e,null));};exports['addAgents']=function(_0x1a8e07,_0x1910bd,_0x18c655){return db[_0xa3b8('0x4b')][_0xa3b8('0x4d')]({'where':{'id':_0x1a8e07[_0xa3b8('0x4a')]['id']}})[_0xa3b8('0x28')](handleEntityNotFound(_0x1910bd,null))[_0xa3b8('0x28')](function(_0x5b42af){if(_0x5b42af){return _0x5b42af[_0xa3b8('0x8a')](_0x1a8e07['body'][_0xa3b8('0x68')],_[_0xa3b8('0x8b')](_0x1a8e07['body'],[_0xa3b8('0x68'),'id'])||{})[_0xa3b8('0x8c')](function(_0x30d3a8){for(var _0x2f40c6=0x0;_0x2f40c6<_0x1a8e07[_0xa3b8('0x4f')]['ids'][_0xa3b8('0x4c')];_0x2f40c6+=0x1){socket[_0xa3b8('0x71')](_0xa3b8('0x8d'),{'UserId':Number(_0x1a8e07[_0xa3b8('0x4f')][_0xa3b8('0x68')][_0x2f40c6]),'OpenchannelQueueId':Number(_0x1a8e07['params']['id'])});}return _0x30d3a8;});}})[_0xa3b8('0x28')](respondWithResult(_0x1910bd,null))[_0xa3b8('0x48')](handleError(_0x1910bd,null));};exports[_0xa3b8('0x88')]=function(_0x48c925,_0x28079c,_0x30679b){return db['OpenchannelQueue']['find']({'where':{'id':_0x48c925[_0xa3b8('0x4a')]['id']}})[_0xa3b8('0x28')](handleEntityNotFound(_0x28079c,null))[_0xa3b8('0x28')](function(_0x35c6cd){if(_0x35c6cd){return _0x35c6cd[_0xa3b8('0x88')](_0x48c925['query'][_0xa3b8('0x68')])['then'](function(){if(_[_0xa3b8('0x8e')](_0x48c925[_0xa3b8('0x3a')][_0xa3b8('0x68')])){for(var _0x31d162=0x0;_0x31d162<_0x48c925[_0xa3b8('0x3a')][_0xa3b8('0x68')][_0xa3b8('0x4c')];_0x31d162+=0x1){socket[_0xa3b8('0x71')](_0xa3b8('0x89'),{'UserId':Number(_0x48c925['query'][_0xa3b8('0x68')][_0x31d162]),'OpenchannelQueueId':Number(_0x48c925[_0xa3b8('0x4a')]['id'])});}}else{socket[_0xa3b8('0x71')](_0xa3b8('0x89'),{'UserId':Number(_0x48c925[_0xa3b8('0x3a')][_0xa3b8('0x68')]),'OpenchannelQueueId':Number(_0x48c925[_0xa3b8('0x4a')]['id'])});}});}})[_0xa3b8('0x28')](respondWithStatusCode(_0x28079c,null))[_0xa3b8('0x48')](handleError(_0x28079c,null));};exports[_0xa3b8('0x8f')]=function(_0x142f09,_0x16aebd,_0x36f366){var _0x51119d={};var _0x11eb56={};var _0x453ecb;var _0x5dbe5d;return db[_0xa3b8('0x4b')][_0xa3b8('0x58')]({'where':{'id':_0x142f09['params']['id']}})[_0xa3b8('0x28')](handleEntityNotFound(_0x16aebd,null))[_0xa3b8('0x28')](function(_0x410506){if(_0x410506){_0x453ecb=_0x410506;_0x11eb56['model']=_['keys'](db['User']['rawAttributes']);_0x11eb56['query']=_[_0xa3b8('0x34')](_0x142f09[_0xa3b8('0x3a')]);_0x11eb56[_0xa3b8('0x35')]=_[_0xa3b8('0x36')](_0x11eb56[_0xa3b8('0x33')],_0x11eb56['query']);_0x51119d['attributes']=_[_0xa3b8('0x36')](_0x11eb56[_0xa3b8('0x33')],qs[_0xa3b8('0x38')](_0x142f09[_0xa3b8('0x3a')]['fields']));_0x51119d[_0xa3b8('0x37')]=_0x51119d[_0xa3b8('0x37')][_0xa3b8('0x4c')]?_0x51119d['attributes']:_0x11eb56['model'];_0x51119d[_0xa3b8('0x3b')]=qs[_0xa3b8('0x3c')](_0x142f09[_0xa3b8('0x3a')][_0xa3b8('0x3c')]);_0x51119d['where']=qs['filters'](_[_0xa3b8('0x3e')](_0x142f09['query'],_0x11eb56[_0xa3b8('0x35')]));if(_0x142f09[_0xa3b8('0x3a')][_0xa3b8('0x3f')]){_0x51119d[_0xa3b8('0x3d')]=_[_0xa3b8('0x42')](_0x51119d['where'],{'$or':_[_0xa3b8('0x31')](_0x51119d[_0xa3b8('0x37')],function(_0x18011b){var _0x41421f={};_0x41421f[_0x18011b]={'$like':'%'+_0x142f09['query']['filter']+'%'};return _0x41421f;})});}_0x51119d=_[_0xa3b8('0x42')]({},_0x51119d,_0x142f09[_0xa3b8('0x43')]);return _0x453ecb[_0xa3b8('0x8f')](_0x51119d);}})['then'](function(_0x217226){if(_0x217226){_0x5dbe5d=_0x217226[_0xa3b8('0x4c')];if(!_0x142f09[_0xa3b8('0x3a')][_0xa3b8('0x39')](_0xa3b8('0x5b'))){_0x51119d[_0xa3b8('0x21')]=qs[_0xa3b8('0x21')](_0x142f09[_0xa3b8('0x3a')]['limit']);_0x51119d[_0xa3b8('0x1f')]=qs[_0xa3b8('0x1f')](_0x142f09[_0xa3b8('0x3a')][_0xa3b8('0x1f')]);}return _0x453ecb[_0xa3b8('0x8f')](_0x51119d);}})[_0xa3b8('0x28')](function(_0x56a7c5){if(_0x56a7c5){return _0x56a7c5?{'count':_0x5dbe5d,'rows':_0x56a7c5}:null;}})[_0xa3b8('0x28')](respondWithResult(_0x16aebd,null))[_0xa3b8('0x48')](handleError(_0x16aebd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 01831bf..f58d274 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 _0xad03=['hook','exports','../../mysqldb','update','remove','emit'];(function(_0x771274,_0x21a321){var _0x571f84=function(_0x48b35b){while(--_0x48b35b){_0x771274['push'](_0x771274['shift']());}};_0x571f84(++_0x21a321);}(_0xad03,0x8c));var _0x3ad0=function(_0xc26cbd,_0x3b2974){_0xc26cbd=_0xc26cbd-0x0;var _0x3eb534=_0xad03[_0xc26cbd];return _0x3eb534;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x3ad0('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3ad0('0x1'),'afterDestroy':_0x3ad0('0x2')};function emitEvent(_0x2ee58c){return function(_0x2cef4d,_0x82a66b,_0x4f29c1){OpenchannelQueueEvents['emit'](_0x2ee58c+':'+_0x2cef4d['id'],_0x2cef4d);OpenchannelQueueEvents[_0x3ad0('0x3')](_0x2ee58c,_0x2cef4d);_0x4f29c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x3ad0('0x4')](e,emitEvent(event));}}module[_0x3ad0('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7b44=['exports','events','../../mysqldb','save','update','remove','emit','hook'];(function(_0x1ce2b2,_0x4ffd3f){var _0xd0e88f=function(_0x416c9e){while(--_0x416c9e){_0x1ce2b2['push'](_0x1ce2b2['shift']());}};_0xd0e88f(++_0x4ffd3f);}(_0x7b44,0x119));var _0x47b4=function(_0x20b64a,_0x2e6580){_0x20b64a=_0x20b64a-0x0;var _0x140ec4=_0x7b44[_0x20b64a];return _0x140ec4;};'use strict';var EventEmitter=require(_0x47b4('0x0'));var OpenchannelQueue=require(_0x47b4('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47b4('0x2'),'afterUpdate':_0x47b4('0x3'),'afterDestroy':_0x47b4('0x4')};function emitEvent(_0xbdc012){return function(_0x4f5b07,_0x3c1cc8,_0x97c595){OpenchannelQueueEvents[_0x47b4('0x5')](_0xbdc012+':'+_0x4f5b07['id'],_0x4f5b07);OpenchannelQueueEvents[_0x47b4('0x5')](_0xbdc012,_0x4f5b07);_0x97c595(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x47b4('0x6')](e,emitEvent(event));}}module[_0x47b4('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index dc490d2..a8daafd 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 _0x49d2=['bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x27bca8,_0x191f63){var _0x370163=function(_0x1329f8){while(--_0x1329f8){_0x27bca8['push'](_0x27bca8['shift']());}};_0x370163(++_0x191f63);}(_0x49d2,0x1ad));var _0x249d=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x49d2[_0x1663ae];return _0x30ffb8;};'use strict';var _=require(_0x249d('0x0'));var util=require(_0x249d('0x1'));var logger=require(_0x249d('0x2'))(_0x249d('0x3'));var moment=require(_0x249d('0x4'));var BPromise=require(_0x249d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x249d('0x6'));var rimraf=require(_0x249d('0x7'));var config=require(_0x249d('0x8'));var attributes=require(_0x249d('0x9'));module[_0x249d('0xa')]=function(_0x257e9d,_0x33e2cb){return _0x257e9d[_0x249d('0xb')](_0x249d('0xc'),attributes,{'tableName':_0x249d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1426=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x23bd90,_0x49a688){var _0x4166a5=function(_0x2c30b6){while(--_0x2c30b6){_0x23bd90['push'](_0x23bd90['shift']());}};_0x4166a5(++_0x49a688);}(_0x1426,0x132));var _0x6142=function(_0x1e1160,_0x48e99e){_0x1e1160=_0x1e1160-0x0;var _0x4bc3bb=_0x1426[_0x1e1160];return _0x4bc3bb;};'use strict';var _=require(_0x6142('0x0'));var util=require(_0x6142('0x1'));var logger=require(_0x6142('0x2'))('api');var moment=require(_0x6142('0x3'));var BPromise=require(_0x6142('0x4'));var rp=require(_0x6142('0x5'));var fs=require('fs');var path=require(_0x6142('0x6'));var rimraf=require(_0x6142('0x7'));var config=require(_0x6142('0x8'));var attributes=require(_0x6142('0x9'));module[_0x6142('0xa')]=function(_0x5641b0,_0x1468b7){return _0x5641b0[_0x6142('0xb')](_0x6142('0xc'),attributes,{'tableName':_0x6142('0xd'),'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 56f60ab..b4736e3 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 _0x76a6=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','attributes','limit','include','map','model','where','ShowOpenchannelQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2109a8,_0x3a7797){var _0x522094=function(_0x545aa1){while(--_0x545aa1){_0x2109a8['push'](_0x2109a8['shift']());}};_0x522094(++_0x3a7797);}(_0x76a6,0x6c));var _0x676a=function(_0x3042d5,_0x349534){_0x3042d5=_0x3042d5-0x0;var _0x1acfef=_0x76a6[_0x3042d5];return _0x1acfef;};'use strict';var _=require('lodash');var util=require(_0x676a('0x0'));var moment=require(_0x676a('0x1'));var BPromise=require(_0x676a('0x2'));var rs=require(_0x676a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x676a('0x4'))['db'];var utils=require(_0x676a('0x5'));var logger=require(_0x676a('0x6'))('rpc');var config=require(_0x676a('0x7'));var jayson=require(_0x676a('0x8'));var client=jayson[_0x676a('0x9')][_0x676a('0xa')]({'port':0x232a});config[_0x676a('0xb')]=_[_0x676a('0xc')](config['redis'],{'host':_0x676a('0xd'),'port':0x18eb});var socket=require(_0x676a('0xe'))(new Redis(config[_0x676a('0xb')]));require(_0x676a('0xf'))['register'](socket);function respondWithRpcPromise(_0x2e7879,_0x13bfd8,_0x1b6c52){return new BPromise(function(_0x13862d,_0x57d095){return client['request'](_0x2e7879,_0x1b6c52)[_0x676a('0x10')](function(_0x59ae4f){logger[_0x676a('0x11')](_0x676a('0x12'),_0x13bfd8,'request\x20sent');logger[_0x676a('0x13')](_0x676a('0x14'),_0x13bfd8,_0x676a('0x15'),JSON[_0x676a('0x16')](_0x59ae4f));if(_0x59ae4f['error']){if(_0x59ae4f[_0x676a('0x17')][_0x676a('0x18')]===0x1f4){logger['error'](_0x676a('0x12'),_0x13bfd8,_0x59ae4f[_0x676a('0x17')]['message']);return _0x57d095(_0x59ae4f[_0x676a('0x17')]['message']);}logger['error'](_0x676a('0x12'),_0x13bfd8,_0x59ae4f[_0x676a('0x17')]['message']);return _0x13862d(_0x59ae4f[_0x676a('0x17')][_0x676a('0x19')]);}else{logger[_0x676a('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x13bfd8,'request\x20sent');_0x13862d(_0x59ae4f[_0x676a('0x1a')][_0x676a('0x19')]);}})[_0x676a('0x1b')](function(_0x3edb9a){logger['error'](_0x676a('0x12'),_0x13bfd8,_0x3edb9a);_0x57d095(_0x3edb9a);});});}exports[_0x676a('0x1c')]=function(_0x511f39){var _0x2b4dfd=this;return new Promise(function(_0x371aeb,_0x2c3966){return db[_0x676a('0x1d')]['findAll']({'raw':_0x511f39[_0x676a('0x1e')]?_0x511f39[_0x676a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x511f39[_0x676a('0x1e')]?_0x511f39[_0x676a('0x1e')]['where']||null:null,'attributes':_0x511f39[_0x676a('0x1e')]?_0x511f39[_0x676a('0x1e')][_0x676a('0x1f')]||null:null,'limit':_0x511f39[_0x676a('0x1e')]?_0x511f39[_0x676a('0x1e')][_0x676a('0x20')]||null:null,'include':_0x511f39[_0x676a('0x1e')]?_0x511f39[_0x676a('0x1e')][_0x676a('0x21')]?_[_0x676a('0x22')](_0x511f39['options'][_0x676a('0x21')],function(_0x128823){return{'model':db[_0x128823[_0x676a('0x23')]],'as':_0x128823['as'],'attributes':_0x128823['attributes'],'include':_0x128823[_0x676a('0x21')]?_[_0x676a('0x22')](_0x128823[_0x676a('0x21')],function(_0x46a103){return{'model':db[_0x46a103[_0x676a('0x23')]],'as':_0x46a103['as'],'attributes':_0x46a103[_0x676a('0x1f')],'include':_0x46a103[_0x676a('0x21')]?_['map'](_0x46a103[_0x676a('0x21')],function(_0x469f0f){return{'model':db[_0x469f0f[_0x676a('0x23')]],'as':_0x469f0f['as'],'attributes':_0x469f0f['attributes']};}):[]};}):[]};}):[]:[]})[_0x676a('0x10')](function(_0x5c2d90){logger[_0x676a('0x11')](_0x676a('0x1c'),_0x511f39);logger['debug'](_0x676a('0x1c'),_0x511f39,JSON[_0x676a('0x16')](_0x5c2d90));_0x371aeb(_0x5c2d90);})[_0x676a('0x1b')](function(_0x2f8e48){logger['error']('GetOpenchannelQueue',_0x2f8e48[_0x676a('0x19')],_0x511f39);_0x2c3966(_0x2b4dfd[_0x676a('0x17')](0x1f4,_0x2f8e48[_0x676a('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x2913cb){var _0x3322bf=this;return new Promise(function(_0x676dd6,_0x1e0f2b){return db[_0x676a('0x1d')]['find']({'raw':_0x2913cb[_0x676a('0x1e')]?_0x2913cb[_0x676a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2913cb[_0x676a('0x1e')]?_0x2913cb[_0x676a('0x1e')][_0x676a('0x24')]||null:null,'attributes':_0x2913cb[_0x676a('0x1e')]?_0x2913cb[_0x676a('0x1e')][_0x676a('0x1f')]||null:null,'include':_0x2913cb[_0x676a('0x1e')]?_0x2913cb[_0x676a('0x1e')]['include']?_[_0x676a('0x22')](_0x2913cb[_0x676a('0x1e')][_0x676a('0x21')],function(_0x4fe3a1){return{'model':db[_0x4fe3a1[_0x676a('0x23')]],'as':_0x4fe3a1['as'],'attributes':_0x4fe3a1[_0x676a('0x1f')],'include':_0x4fe3a1['include']?_[_0x676a('0x22')](_0x4fe3a1[_0x676a('0x21')],function(_0x4837cc){return{'model':db[_0x4837cc['model']],'as':_0x4837cc['as'],'attributes':_0x4837cc[_0x676a('0x1f')],'include':_0x4837cc['include']?_[_0x676a('0x22')](_0x4837cc[_0x676a('0x21')],function(_0xeca17f){return{'model':db[_0xeca17f[_0x676a('0x23')]],'as':_0xeca17f['as'],'attributes':_0xeca17f[_0x676a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52ed7d){logger['info'](_0x676a('0x25'),_0x2913cb);logger[_0x676a('0x13')](_0x676a('0x25'),_0x2913cb,JSON[_0x676a('0x16')](_0x52ed7d));_0x676dd6(_0x52ed7d);})[_0x676a('0x1b')](function(_0x32f34a){logger[_0x676a('0x17')](_0x676a('0x25'),_0x32f34a['message'],_0x2913cb);_0x1e0f2b(_0x3322bf[_0x676a('0x17')](0x1f4,_0x32f34a[_0x676a('0x19')]));});});}; \ No newline at end of file +var _0xbd2d=['../../config/environment','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetOpenchannelQueue','options','raw','where','attributes','limit','map','include','model','ShowOpenchannelQueue','OpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x171dc5,_0x564366){var _0x4a56d0=function(_0x490a93){while(--_0x490a93){_0x171dc5['push'](_0x171dc5['shift']());}};_0x4a56d0(++_0x564366);}(_0xbd2d,0x1cc));var _0xdbd2=function(_0x42e803,_0x1a7cba){_0x42e803=_0x42e803-0x0;var _0x66506d=_0xbd2d[_0x42e803];return _0x66506d;};'use strict';var _=require(_0xdbd2('0x0'));var util=require(_0xdbd2('0x1'));var moment=require(_0xdbd2('0x2'));var BPromise=require(_0xdbd2('0x3'));var rs=require(_0xdbd2('0x4'));var fs=require('fs');var Redis=require(_0xdbd2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbd2('0x6'));var logger=require('../../config/logger')(_0xdbd2('0x7'));var config=require(_0xdbd2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdbd2('0x9')]['http']({'port':0x232a});config[_0xdbd2('0xa')]=_['defaults'](config[_0xdbd2('0xa')],{'host':_0xdbd2('0xb'),'port':0x18eb});var socket=require(_0xdbd2('0xc'))(new Redis(config['redis']));require(_0xdbd2('0xd'))[_0xdbd2('0xe')](socket);function respondWithRpcPromise(_0x30af9b,_0x50addb,_0x43928f){return new BPromise(function(_0x5b7d74,_0x39d08e){return client['request'](_0x30af9b,_0x43928f)[_0xdbd2('0xf')](function(_0x4089b3){logger[_0xdbd2('0x10')](_0xdbd2('0x11'),_0x50addb,'request\x20sent');logger[_0xdbd2('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x50addb,_0xdbd2('0x13'),JSON[_0xdbd2('0x14')](_0x4089b3));if(_0x4089b3[_0xdbd2('0x15')]){if(_0x4089b3[_0xdbd2('0x15')][_0xdbd2('0x16')]===0x1f4){logger[_0xdbd2('0x15')](_0xdbd2('0x11'),_0x50addb,_0x4089b3[_0xdbd2('0x15')][_0xdbd2('0x17')]);return _0x39d08e(_0x4089b3[_0xdbd2('0x15')]['message']);}logger[_0xdbd2('0x15')](_0xdbd2('0x11'),_0x50addb,_0x4089b3[_0xdbd2('0x15')]['message']);return _0x5b7d74(_0x4089b3[_0xdbd2('0x15')][_0xdbd2('0x17')]);}else{logger['info'](_0xdbd2('0x11'),_0x50addb,_0xdbd2('0x13'));_0x5b7d74(_0x4089b3['result'][_0xdbd2('0x17')]);}})[_0xdbd2('0x18')](function(_0x4cd7a5){logger['error'](_0xdbd2('0x11'),_0x50addb,_0x4cd7a5);_0x39d08e(_0x4cd7a5);});});}exports[_0xdbd2('0x19')]=function(_0x3b70fa){var _0xb1fb32=this;return new Promise(function(_0x2dfb9e,_0x5cdd54){return db['OpenchannelQueue']['findAll']({'raw':_0x3b70fa['options']?_0x3b70fa[_0xdbd2('0x1a')][_0xdbd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b70fa[_0xdbd2('0x1a')]?_0x3b70fa[_0xdbd2('0x1a')][_0xdbd2('0x1c')]||null:null,'attributes':_0x3b70fa[_0xdbd2('0x1a')]?_0x3b70fa[_0xdbd2('0x1a')][_0xdbd2('0x1d')]||null:null,'limit':_0x3b70fa[_0xdbd2('0x1a')]?_0x3b70fa[_0xdbd2('0x1a')][_0xdbd2('0x1e')]||null:null,'include':_0x3b70fa['options']?_0x3b70fa[_0xdbd2('0x1a')]['include']?_[_0xdbd2('0x1f')](_0x3b70fa[_0xdbd2('0x1a')][_0xdbd2('0x20')],function(_0x470aef){return{'model':db[_0x470aef[_0xdbd2('0x21')]],'as':_0x470aef['as'],'attributes':_0x470aef[_0xdbd2('0x1d')],'include':_0x470aef['include']?_[_0xdbd2('0x1f')](_0x470aef[_0xdbd2('0x20')],function(_0x441607){return{'model':db[_0x441607[_0xdbd2('0x21')]],'as':_0x441607['as'],'attributes':_0x441607['attributes'],'include':_0x441607['include']?_[_0xdbd2('0x1f')](_0x441607['include'],function(_0x4e00c8){return{'model':db[_0x4e00c8[_0xdbd2('0x21')]],'as':_0x4e00c8['as'],'attributes':_0x4e00c8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x50f31d){logger[_0xdbd2('0x10')](_0xdbd2('0x19'),_0x3b70fa);logger[_0xdbd2('0x12')](_0xdbd2('0x19'),_0x3b70fa,JSON[_0xdbd2('0x14')](_0x50f31d));_0x2dfb9e(_0x50f31d);})[_0xdbd2('0x18')](function(_0x5ae107){logger['error'](_0xdbd2('0x19'),_0x5ae107[_0xdbd2('0x17')],_0x3b70fa);_0x5cdd54(_0xb1fb32['error'](0x1f4,_0x5ae107['message']));});});};exports[_0xdbd2('0x22')]=function(_0x20f612){var _0x3ca138=this;return new Promise(function(_0x123669,_0x87f55f){return db[_0xdbd2('0x23')]['find']({'raw':_0x20f612[_0xdbd2('0x1a')]?_0x20f612[_0xdbd2('0x1a')][_0xdbd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20f612[_0xdbd2('0x1a')]?_0x20f612[_0xdbd2('0x1a')][_0xdbd2('0x1c')]||null:null,'attributes':_0x20f612[_0xdbd2('0x1a')]?_0x20f612[_0xdbd2('0x1a')][_0xdbd2('0x1d')]||null:null,'include':_0x20f612['options']?_0x20f612[_0xdbd2('0x1a')][_0xdbd2('0x20')]?_['map'](_0x20f612[_0xdbd2('0x1a')][_0xdbd2('0x20')],function(_0x17e8ea){return{'model':db[_0x17e8ea['model']],'as':_0x17e8ea['as'],'attributes':_0x17e8ea[_0xdbd2('0x1d')],'include':_0x17e8ea[_0xdbd2('0x20')]?_[_0xdbd2('0x1f')](_0x17e8ea[_0xdbd2('0x20')],function(_0x3cdd23){return{'model':db[_0x3cdd23[_0xdbd2('0x21')]],'as':_0x3cdd23['as'],'attributes':_0x3cdd23[_0xdbd2('0x1d')],'include':_0x3cdd23[_0xdbd2('0x20')]?_[_0xdbd2('0x1f')](_0x3cdd23['include'],function(_0x57004d){return{'model':db[_0x57004d['model']],'as':_0x57004d['as'],'attributes':_0x57004d[_0xdbd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdbd2('0xf')](function(_0x265eeb){logger[_0xdbd2('0x10')](_0xdbd2('0x22'),_0x20f612);logger[_0xdbd2('0x12')](_0xdbd2('0x22'),_0x20f612,JSON['stringify'](_0x265eeb));_0x123669(_0x265eeb);})['catch'](function(_0x4b9e9f){logger['error'](_0xdbd2('0x22'),_0x4b9e9f[_0xdbd2('0x17')],_0x20f612);_0x87f55f(_0x3ca138[_0xdbd2('0x15')](0x1f4,_0x4b9e9f[_0xdbd2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f43e76d..0886b0d 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 _0x8673=['openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener','length'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8673,0x8d));var _0x3867=function(_0x4c616f,_0x57329f){_0x4c616f=_0x4c616f-0x0;var _0x1af2d6=_0x8673[_0x4c616f];return _0x1af2d6;};'use strict';var OpenchannelQueueEvents=require(_0x3867('0x0'));var events=[_0x3867('0x1'),_0x3867('0x2'),'update'];function createListener(_0x50d995,_0x34e576){return function(_0x44d61c){_0x34e576[_0x3867('0x3')](_0x50d995,_0x44d61c);};}function removeListener(_0x54ee37,_0x15d37f){return function(){OpenchannelQueueEvents[_0x3867('0x4')](_0x54ee37,_0x15d37f);};}exports['register']=function(_0x23504e){for(var _0x33bed5=0x0,_0x7c389c=events[_0x3867('0x5')];_0x33bed5<_0x7c389c;_0x33bed5++){var _0x2b3dc1=events[_0x33bed5];var _0x1986ef=createListener(_0x3867('0x6')+_0x2b3dc1,_0x23504e);OpenchannelQueueEvents['on'](_0x2b3dc1,_0x1986ef);}}; \ No newline at end of file +var _0x71d5=['save','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x12e79b,_0xac13c0){var _0x12216e=function(_0x3fd53e){while(--_0x3fd53e){_0x12e79b['push'](_0x12e79b['shift']());}};_0x12216e(++_0xac13c0);}(_0x71d5,0x1c6));var _0x571d=function(_0x47d338,_0x23eabf){_0x47d338=_0x47d338-0x0;var _0x5d3f11=_0x71d5[_0x47d338];return _0x5d3f11;};'use strict';var OpenchannelQueueEvents=require(_0x571d('0x0'));var events=[_0x571d('0x1'),'remove',_0x571d('0x2')];function createListener(_0x415c10,_0x340857){return function(_0x5399ef){_0x340857[_0x571d('0x3')](_0x415c10,_0x5399ef);};}function removeListener(_0x495ff6,_0x452d7b){return function(){OpenchannelQueueEvents[_0x571d('0x4')](_0x495ff6,_0x452d7b);};}exports[_0x571d('0x5')]=function(_0x2e795b){for(var _0x2f03f1=0x0,_0x40ec62=events['length'];_0x2f03f1<_0x40ec62;_0x2f03f1++){var _0x2227d4=events[_0x2f03f1];var _0x2af76c=createListener(_0x571d('0x6')+_0x2227d4,_0x2e795b);OpenchannelQueueEvents['on'](_0x2227d4,_0x2af76c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 0335c4e..3e9716e 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 _0xa5c4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x32eccc,_0x19f818){var _0xea443e=function(_0x4a5d58){while(--_0x4a5d58){_0x32eccc['push'](_0x32eccc['shift']());}};_0xea443e(++_0x19f818);}(_0xa5c4,0x10d));var _0x4a5c=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xa5c4[_0x279d37];return _0x530173;};'use strict';var multer=require(_0x4a5c('0x0'));var util=require(_0x4a5c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4a5c('0x2'));var router=express[_0x4a5c('0x3')]();var fs_extra=require(_0x4a5c('0x4'));var auth=require(_0x4a5c('0x5'));var interaction=require(_0x4a5c('0x6'));var config=require(_0x4a5c('0x7'));var controller=require(_0x4a5c('0x8'));router[_0x4a5c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4a5c('0x9')](_0x4a5c('0xa'),auth[_0x4a5c('0xb')](),controller[_0x4a5c('0xc')]);router[_0x4a5c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4a5c('0xd')]);router[_0x4a5c('0xe')]('/',auth[_0x4a5c('0xb')](),controller['create']);router[_0x4a5c('0xf')](_0x4a5c('0x10'),auth[_0x4a5c('0xb')](),controller[_0x4a5c('0x11')]);router[_0x4a5c('0x12')](_0x4a5c('0x10'),auth[_0x4a5c('0xb')](),controller[_0x4a5c('0x13')]);module[_0x4a5c('0x14')]=router; \ No newline at end of file +var _0xd0f4=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xd0f4,0x13d));var _0x4d0f=function(_0x1ab5da,_0x28bcdf){_0x1ab5da=_0x1ab5da-0x0;var _0x1cb3f3=_0xd0f4[_0x1ab5da];return _0x1cb3f3;};'use strict';var multer=require(_0x4d0f('0x0'));var util=require(_0x4d0f('0x1'));var path=require(_0x4d0f('0x2'));var timeout=require(_0x4d0f('0x3'));var express=require(_0x4d0f('0x4'));var router=express[_0x4d0f('0x5')]();var fs_extra=require(_0x4d0f('0x6'));var auth=require(_0x4d0f('0x7'));var interaction=require(_0x4d0f('0x8'));var config=require(_0x4d0f('0x9'));var controller=require('./openchannelQueueReport.controller');router[_0x4d0f('0xa')]('/',auth[_0x4d0f('0xb')](),controller[_0x4d0f('0xc')]);router[_0x4d0f('0xa')](_0x4d0f('0xd'),auth[_0x4d0f('0xb')](),controller[_0x4d0f('0xe')]);router[_0x4d0f('0xa')](_0x4d0f('0xf'),auth[_0x4d0f('0xb')](),controller[_0x4d0f('0x10')]);router[_0x4d0f('0x11')]('/',auth[_0x4d0f('0xb')](),controller['create']);router[_0x4d0f('0x12')](_0x4d0f('0xf'),auth['isAuthenticated'](),controller[_0x4d0f('0x13')]);router['delete']('/:id',auth[_0x4d0f('0xb')](),controller[_0x4d0f('0x14')]);module[_0x4d0f('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 4c7b8ba..bc8eb16 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 _0x4939=['DATE','moment','sequelize','STRING'];(function(_0x286456,_0x161eb3){var _0x49ed4f=function(_0x4af62b){while(--_0x4af62b){_0x286456['push'](_0x286456['shift']());}};_0x49ed4f(++_0x161eb3);}(_0x4939,0x1a9));var _0x9493=function(_0x110232,_0x2e4cdf){_0x110232=_0x110232-0x0;var _0x12a071=_0x4939[_0x110232];return _0x12a071;};'use strict';var moment=require(_0x9493('0x0'));var Sequelize=require(_0x9493('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9493('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9493('0x3')]},'leaveAt':{'type':Sequelize[_0x9493('0x3')]},'acceptAt':{'type':Sequelize[_0x9493('0x3')]},'exitAt':{'type':Sequelize[_0x9493('0x3')]},'reason':{'type':Sequelize[_0x9493('0x2')]}}; \ No newline at end of file +var _0x8d20=['DATE','sequelize','exports','STRING'];(function(_0x85d353,_0x43a61f){var _0x428cbc=function(_0x9f9749){while(--_0x9f9749){_0x85d353['push'](_0x85d353['shift']());}};_0x428cbc(++_0x43a61f);}(_0x8d20,0x1c5));var _0x08d2=function(_0x1a1d02,_0x32a85e){_0x1a1d02=_0x1a1d02-0x0;var _0x2fcbfc=_0x8d20[_0x1a1d02];return _0x2fcbfc;};'use strict';var moment=require('moment');var Sequelize=require(_0x08d2('0x0'));module[_0x08d2('0x1')]={'uniqueid':{'type':Sequelize[_0x08d2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x08d2('0x2')]},'joinAt':{'type':Sequelize[_0x08d2('0x3')]},'leaveAt':{'type':Sequelize[_0x08d2('0x3')]},'acceptAt':{'type':Sequelize[_0x08d2('0x3')]},'exitAt':{'type':Sequelize[_0x08d2('0x3')]},'reason':{'type':Sequelize[_0x08d2('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 39a312f..fe9b60e 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 _0x45c2=['params','keys','catch','create','body','update','find','describe','rimraf','zip-dir','fast-json-patch','bluebird','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/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','apply','reject','save','then','destroy','stack','name','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show'];(function(_0x341b9d,_0x5ba046){var _0x448d4f=function(_0x401442){while(--_0x401442){_0x341b9d['push'](_0x341b9d['shift']());}};_0x448d4f(++_0x5ba046);}(_0x45c2,0xe0));var _0x245c=function(_0x4da749,_0x33272a){_0x4da749=_0x4da749-0x0;var _0x59afaf=_0x45c2[_0x4da749];return _0x59afaf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x245c('0x0'));var zipdir=require(_0x245c('0x1'));var jsonpatch=require(_0x245c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x245c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x245c('0x4'));var csv=require(_0x245c('0x5'));var ejs=require(_0x245c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x245c('0x7'));var squel=require(_0x245c('0x8'));var crypto=require(_0x245c('0x9'));var jsforce=require(_0x245c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x245c('0xb'));var Papa=require(_0x245c('0xc'));var Redis=require(_0x245c('0xd'));var authService=require(_0x245c('0xe'));var qs=require(_0x245c('0xf'));var as=require(_0x245c('0x10'));var hardwareService=require(_0x245c('0x11'));var logger=require(_0x245c('0x12'))(_0x245c('0x13'));var utils=require(_0x245c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x245c('0x15'));var db=require(_0x245c('0x16'))['db'];function respondWithStatusCode(_0x459f52,_0x3eaed4){_0x3eaed4=_0x3eaed4||0xcc;return function(_0x274509){if(_0x274509){return _0x459f52[_0x245c('0x17')](_0x3eaed4);}return _0x459f52[_0x245c('0x18')](_0x3eaed4)['end']();};}function respondWithResult(_0x4f5347,_0x4f3fcc){_0x4f3fcc=_0x4f3fcc||0xc8;return function(_0x151af4){if(_0x151af4){return _0x4f5347['status'](_0x4f3fcc)[_0x245c('0x19')](_0x151af4);}};}function respondWithFilteredResult(_0x2a8825,_0x5a3d37){return function(_0x1c6991){if(_0x1c6991){var _0x403ac1=typeof _0x5a3d37['offset']===_0x245c('0x1a')&&typeof _0x5a3d37['limit']==='undefined';var _0x210eca=_0x1c6991[_0x245c('0x1b')];var _0x5ae115=_0x403ac1?0x0:_0x5a3d37[_0x245c('0x1c')];var _0x33d170=_0x403ac1?_0x1c6991[_0x245c('0x1b')]:_0x5a3d37[_0x245c('0x1c')]+_0x5a3d37['limit'];var _0x53b820;if(_0x33d170>=_0x210eca){_0x33d170=_0x210eca;_0x53b820=0xc8;}else{_0x53b820=0xce;}_0x2a8825[_0x245c('0x18')](_0x53b820);return _0x2a8825['set']('Content-Range',_0x5ae115+'-'+_0x33d170+'/'+_0x210eca)[_0x245c('0x19')](_0x1c6991);}return null;};}function patchUpdates(_0x5b6a82){return function(_0xd04541){try{jsonpatch[_0x245c('0x1d')](_0xd04541,_0x5b6a82,!![]);}catch(_0x2439ea){return BPromise[_0x245c('0x1e')](_0x2439ea);}return _0xd04541[_0x245c('0x1f')]();};}function saveUpdates(_0x2b4c3d,_0x5df767){return function(_0x5c5de5){if(_0x5c5de5){return _0x5c5de5['update'](_0x2b4c3d)[_0x245c('0x20')](function(_0x2963e8){return _0x2963e8;});}return null;};}function removeEntity(_0x166a80,_0x5b6fb5){return function(_0x2658a0){if(_0x2658a0){return _0x2658a0[_0x245c('0x21')]()[_0x245c('0x20')](function(){_0x166a80[_0x245c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d4e04,_0x20139d){return function(_0x11612a){if(!_0x11612a){_0x1d4e04[_0x245c('0x17')](0x194);}return _0x11612a;};}function handleError(_0x2f8f74,_0x4b867b){_0x4b867b=_0x4b867b||0x1f4;return function(_0x1e31db){logger['error'](_0x1e31db[_0x245c('0x22')]);if(_0x1e31db['name']){delete _0x1e31db[_0x245c('0x23')];}_0x2f8f74[_0x245c('0x18')](_0x4b867b)['send'](_0x1e31db);};}exports[_0x245c('0x24')]=function(_0x4bb5bd,_0x2623a6){var _0x23decd={},_0x39832b={},_0x497e1f={'count':0x0,'rows':[]};var _0x47a184=_[_0x245c('0x25')](db[_0x245c('0x26')][_0x245c('0x27')],function(_0x4de381){return{'name':_0x4de381['fieldName'],'type':_0x4de381[_0x245c('0x28')][_0x245c('0x29')]};});_0x39832b[_0x245c('0x2a')]=_[_0x245c('0x25')](_0x47a184,_0x245c('0x23'));_0x39832b[_0x245c('0x2b')]=_['keys'](_0x4bb5bd[_0x245c('0x2b')]);_0x39832b[_0x245c('0x2c')]=_[_0x245c('0x2d')](_0x39832b['model'],_0x39832b[_0x245c('0x2b')]);_0x23decd[_0x245c('0x2e')]=_[_0x245c('0x2d')](_0x39832b[_0x245c('0x2a')],qs[_0x245c('0x2f')](_0x4bb5bd[_0x245c('0x2b')][_0x245c('0x2f')]));_0x23decd['attributes']=_0x23decd['attributes'][_0x245c('0x30')]?_0x23decd[_0x245c('0x2e')]:_0x39832b[_0x245c('0x2a')];if(!_0x4bb5bd[_0x245c('0x2b')][_0x245c('0x31')](_0x245c('0x32'))){_0x23decd['limit']=qs[_0x245c('0x33')](_0x4bb5bd[_0x245c('0x2b')][_0x245c('0x33')]);_0x23decd[_0x245c('0x1c')]=qs[_0x245c('0x1c')](_0x4bb5bd['query'][_0x245c('0x1c')]);}_0x23decd[_0x245c('0x34')]=qs[_0x245c('0x35')](_0x4bb5bd[_0x245c('0x2b')]['sort']);_0x23decd[_0x245c('0x36')]=qs[_0x245c('0x2c')](_[_0x245c('0x37')](_0x4bb5bd[_0x245c('0x2b')],_0x39832b[_0x245c('0x2c')]),_0x47a184);if(_0x4bb5bd[_0x245c('0x2b')][_0x245c('0x38')]){_0x23decd[_0x245c('0x36')]=_[_0x245c('0x39')](_0x23decd[_0x245c('0x36')],{'$or':_[_0x245c('0x25')](_0x47a184,function(_0x3b9b62){if(_0x3b9b62[_0x245c('0x28')]!=='VIRTUAL'){var _0x409788={};_0x409788[_0x3b9b62[_0x245c('0x23')]]={'$like':'%'+_0x4bb5bd[_0x245c('0x2b')][_0x245c('0x38')]+'%'};return _0x409788;}})});}_0x23decd=_[_0x245c('0x39')]({},_0x23decd,_0x4bb5bd[_0x245c('0x3a')]);var _0x2b4a6c={'where':_0x23decd['where']};return db[_0x245c('0x26')][_0x245c('0x1b')](_0x2b4a6c)[_0x245c('0x20')](function(_0x26e67f){_0x497e1f[_0x245c('0x1b')]=_0x26e67f;if(_0x4bb5bd[_0x245c('0x2b')][_0x245c('0x3b')]){_0x23decd[_0x245c('0x3c')]=[{'all':!![]}];}return db[_0x245c('0x26')][_0x245c('0x3d')](_0x23decd);})[_0x245c('0x20')](function(_0x865d5d){_0x497e1f[_0x245c('0x3e')]=_0x865d5d;return _0x497e1f;})[_0x245c('0x20')](respondWithFilteredResult(_0x2623a6,_0x23decd))['catch'](handleError(_0x2623a6,null));};exports[_0x245c('0x3f')]=function(_0x48afd4,_0x1b86b5){var _0x587af0={'raw':!![],'where':{'id':_0x48afd4[_0x245c('0x40')]['id']}},_0xbe3d5a={};_0xbe3d5a[_0x245c('0x2a')]=_[_0x245c('0x41')](db['OpenchannelQueueReport']['rawAttributes']);_0xbe3d5a[_0x245c('0x2b')]=_[_0x245c('0x41')](_0x48afd4['query']);_0xbe3d5a[_0x245c('0x2c')]=_['intersection'](_0xbe3d5a['model'],_0xbe3d5a[_0x245c('0x2b')]);_0x587af0['attributes']=_[_0x245c('0x2d')](_0xbe3d5a[_0x245c('0x2a')],qs['fields'](_0x48afd4[_0x245c('0x2b')][_0x245c('0x2f')]));_0x587af0[_0x245c('0x2e')]=_0x587af0[_0x245c('0x2e')][_0x245c('0x30')]?_0x587af0[_0x245c('0x2e')]:_0xbe3d5a[_0x245c('0x2a')];if(_0x48afd4[_0x245c('0x2b')]['includeAll']){_0x587af0[_0x245c('0x3c')]=[{'all':!![]}];}_0x587af0=_[_0x245c('0x39')]({},_0x587af0,_0x48afd4[_0x245c('0x3a')]);return db[_0x245c('0x26')]['find'](_0x587af0)[_0x245c('0x20')](handleEntityNotFound(_0x1b86b5,null))['then'](respondWithResult(_0x1b86b5,null))[_0x245c('0x42')](handleError(_0x1b86b5,null));};exports['create']=function(_0x1d561e,_0xaf080){return db[_0x245c('0x26')][_0x245c('0x43')](_0x1d561e[_0x245c('0x44')],{})[_0x245c('0x20')](respondWithResult(_0xaf080,0xc9))[_0x245c('0x42')](handleError(_0xaf080,null));};exports[_0x245c('0x45')]=function(_0x2c2806,_0x30430b){if(_0x2c2806['body']['id']){delete _0x2c2806['body']['id'];}return db[_0x245c('0x26')][_0x245c('0x46')]({'where':{'id':_0x2c2806[_0x245c('0x40')]['id']}})[_0x245c('0x20')](handleEntityNotFound(_0x30430b,null))[_0x245c('0x20')](saveUpdates(_0x2c2806[_0x245c('0x44')],null))['then'](respondWithResult(_0x30430b,null))['catch'](handleError(_0x30430b,null));};exports['destroy']=function(_0x479dda,_0x3e2207){return db[_0x245c('0x26')]['find']({'where':{'id':_0x479dda[_0x245c('0x40')]['id']}})[_0x245c('0x20')](handleEntityNotFound(_0x3e2207,null))[_0x245c('0x20')](removeEntity(_0x3e2207,null))[_0x245c('0x42')](handleError(_0x3e2207,null));};exports[_0x245c('0x47')]=function(_0xc274e3,_0xe0380c){return db[_0x245c('0x26')][_0x245c('0x47')]()[_0x245c('0x20')](respondWithResult(_0xe0380c,null))['catch'](handleError(_0xe0380c,null));}; \ No newline at end of file +var _0xd1b8=['sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','OpenchannelQueueReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','length','include','catch','create','body','params','destroy','find','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util'];(function(_0x27b8b0,_0x1bea20){var _0x35af84=function(_0x1975ac){while(--_0x1975ac){_0x27b8b0['push'](_0x27b8b0['shift']());}};_0x35af84(++_0x1bea20);}(_0xd1b8,0x1ac));var _0x8d1b=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0xd1b8[_0x2ecc65];return _0x103cc3;};'use strict';var emlformat=require(_0x8d1b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8d1b('0x1'));var rp=require(_0x8d1b('0x2'));var moment=require('moment');var BPromise=require(_0x8d1b('0x3'));var Mustache=require(_0x8d1b('0x4'));var util=require(_0x8d1b('0x5'));var path=require(_0x8d1b('0x6'));var sox=require(_0x8d1b('0x7'));var csv=require('to-csv');var ejs=require(_0x8d1b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d1b('0x9'));var squel=require('squel');var crypto=require(_0x8d1b('0xa'));var jsforce=require(_0x8d1b('0xb'));var deskjs=require(_0x8d1b('0xc'));var toCsv=require(_0x8d1b('0xd'));var querystring=require(_0x8d1b('0xe'));var Papa=require(_0x8d1b('0xf'));var Redis=require(_0x8d1b('0x10'));var authService=require(_0x8d1b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8d1b('0x12'));var hardwareService=require(_0x8d1b('0x13'));var logger=require(_0x8d1b('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8d1b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48fb4a,_0x3d0dfe){_0x3d0dfe=_0x3d0dfe||0xcc;return function(_0x541e9c){if(_0x541e9c){return _0x48fb4a[_0x8d1b('0x16')](_0x3d0dfe);}return _0x48fb4a[_0x8d1b('0x17')](_0x3d0dfe)['end']();};}function respondWithResult(_0x58d884,_0x6af17f){_0x6af17f=_0x6af17f||0xc8;return function(_0x351842){if(_0x351842){return _0x58d884[_0x8d1b('0x17')](_0x6af17f)['json'](_0x351842);}};}function respondWithFilteredResult(_0x2b19c5,_0x2724d8){return function(_0xc8db1d){if(_0xc8db1d){var _0x9db923=typeof _0x2724d8[_0x8d1b('0x18')]===_0x8d1b('0x19')&&typeof _0x2724d8[_0x8d1b('0x1a')]===_0x8d1b('0x19');var _0x2d9bff=_0xc8db1d[_0x8d1b('0x1b')];var _0xe68039=_0x9db923?0x0:_0x2724d8[_0x8d1b('0x18')];var _0x3d1867=_0x9db923?_0xc8db1d[_0x8d1b('0x1b')]:_0x2724d8[_0x8d1b('0x18')]+_0x2724d8[_0x8d1b('0x1a')];var _0x2dcccc;if(_0x3d1867>=_0x2d9bff){_0x3d1867=_0x2d9bff;_0x2dcccc=0xc8;}else{_0x2dcccc=0xce;}_0x2b19c5[_0x8d1b('0x17')](_0x2dcccc);return _0x2b19c5['set'](_0x8d1b('0x1c'),_0xe68039+'-'+_0x3d1867+'/'+_0x2d9bff)[_0x8d1b('0x1d')](_0xc8db1d);}return null;};}function patchUpdates(_0x57ea44){return function(_0x7c1dd9){try{jsonpatch[_0x8d1b('0x1e')](_0x7c1dd9,_0x57ea44,!![]);}catch(_0x257589){return BPromise[_0x8d1b('0x1f')](_0x257589);}return _0x7c1dd9[_0x8d1b('0x20')]();};}function saveUpdates(_0x317214,_0x1f6d79){return function(_0x138fb0){if(_0x138fb0){return _0x138fb0[_0x8d1b('0x21')](_0x317214)['then'](function(_0x240d1e){return _0x240d1e;});}return null;};}function removeEntity(_0x245f2b,_0x5a26e4){return function(_0x495840){if(_0x495840){return _0x495840['destroy']()[_0x8d1b('0x22')](function(){_0x245f2b[_0x8d1b('0x17')](0xcc)[_0x8d1b('0x23')]();});}};}function handleEntityNotFound(_0x14912e,_0x317280){return function(_0x51e63e){if(!_0x51e63e){_0x14912e[_0x8d1b('0x16')](0x194);}return _0x51e63e;};}function handleError(_0x53c0df,_0x5321ba){_0x5321ba=_0x5321ba||0x1f4;return function(_0x415752){logger[_0x8d1b('0x24')](_0x415752[_0x8d1b('0x25')]);if(_0x415752['name']){delete _0x415752[_0x8d1b('0x26')];}_0x53c0df[_0x8d1b('0x17')](_0x5321ba)[_0x8d1b('0x27')](_0x415752);};}exports['index']=function(_0x25a4e7,_0x3cf606){var _0x4e1780={},_0x4f4f0a={},_0x1b20d4={'count':0x0,'rows':[]};var _0x40ceca=_['map'](db[_0x8d1b('0x28')][_0x8d1b('0x29')],function(_0x330a19){return{'name':_0x330a19[_0x8d1b('0x2a')],'type':_0x330a19[_0x8d1b('0x2b')][_0x8d1b('0x2c')]};});_0x4f4f0a['model']=_[_0x8d1b('0x2d')](_0x40ceca,_0x8d1b('0x26'));_0x4f4f0a[_0x8d1b('0x2e')]=_[_0x8d1b('0x2f')](_0x25a4e7[_0x8d1b('0x2e')]);_0x4f4f0a['filters']=_[_0x8d1b('0x30')](_0x4f4f0a[_0x8d1b('0x31')],_0x4f4f0a['query']);_0x4e1780[_0x8d1b('0x32')]=_[_0x8d1b('0x30')](_0x4f4f0a[_0x8d1b('0x31')],qs['fields'](_0x25a4e7[_0x8d1b('0x2e')][_0x8d1b('0x33')]));_0x4e1780['attributes']=_0x4e1780[_0x8d1b('0x32')]['length']?_0x4e1780['attributes']:_0x4f4f0a[_0x8d1b('0x31')];if(!_0x25a4e7[_0x8d1b('0x2e')][_0x8d1b('0x34')](_0x8d1b('0x35'))){_0x4e1780['limit']=qs[_0x8d1b('0x1a')](_0x25a4e7[_0x8d1b('0x2e')][_0x8d1b('0x1a')]);_0x4e1780[_0x8d1b('0x18')]=qs['offset'](_0x25a4e7['query'][_0x8d1b('0x18')]);}_0x4e1780[_0x8d1b('0x36')]=qs[_0x8d1b('0x37')](_0x25a4e7[_0x8d1b('0x2e')]['sort']);_0x4e1780[_0x8d1b('0x38')]=qs[_0x8d1b('0x39')](_[_0x8d1b('0x3a')](_0x25a4e7[_0x8d1b('0x2e')],_0x4f4f0a['filters']),_0x40ceca);if(_0x25a4e7[_0x8d1b('0x2e')][_0x8d1b('0x3b')]){_0x4e1780[_0x8d1b('0x38')]=_[_0x8d1b('0x3c')](_0x4e1780[_0x8d1b('0x38')],{'$or':_['map'](_0x40ceca,function(_0x50bbe9){if(_0x50bbe9[_0x8d1b('0x2b')]!==_0x8d1b('0x3d')){var _0x510710={};_0x510710[_0x50bbe9[_0x8d1b('0x26')]]={'$like':'%'+_0x25a4e7['query'][_0x8d1b('0x3b')]+'%'};return _0x510710;}})});}_0x4e1780=_['merge']({},_0x4e1780,_0x25a4e7[_0x8d1b('0x3e')]);var _0x250612={'where':_0x4e1780[_0x8d1b('0x38')]};return db['OpenchannelQueueReport'][_0x8d1b('0x1b')](_0x250612)[_0x8d1b('0x22')](function(_0xdfd43c){_0x1b20d4[_0x8d1b('0x1b')]=_0xdfd43c;if(_0x25a4e7[_0x8d1b('0x2e')][_0x8d1b('0x3f')]){_0x4e1780['include']=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x4e1780);})[_0x8d1b('0x22')](function(_0x2fc87b){_0x1b20d4[_0x8d1b('0x40')]=_0x2fc87b;return _0x1b20d4;})[_0x8d1b('0x22')](respondWithFilteredResult(_0x3cf606,_0x4e1780))['catch'](handleError(_0x3cf606,null));};exports[_0x8d1b('0x41')]=function(_0x4945b4,_0x1f4936){var _0xc1d041={'raw':!![],'where':{'id':_0x4945b4['params']['id']}},_0x21a501={};_0x21a501[_0x8d1b('0x31')]=_[_0x8d1b('0x2f')](db[_0x8d1b('0x28')]['rawAttributes']);_0x21a501[_0x8d1b('0x2e')]=_[_0x8d1b('0x2f')](_0x4945b4['query']);_0x21a501[_0x8d1b('0x39')]=_['intersection'](_0x21a501[_0x8d1b('0x31')],_0x21a501[_0x8d1b('0x2e')]);_0xc1d041[_0x8d1b('0x32')]=_[_0x8d1b('0x30')](_0x21a501['model'],qs[_0x8d1b('0x33')](_0x4945b4[_0x8d1b('0x2e')][_0x8d1b('0x33')]));_0xc1d041[_0x8d1b('0x32')]=_0xc1d041[_0x8d1b('0x32')][_0x8d1b('0x42')]?_0xc1d041[_0x8d1b('0x32')]:_0x21a501[_0x8d1b('0x31')];if(_0x4945b4[_0x8d1b('0x2e')][_0x8d1b('0x3f')]){_0xc1d041[_0x8d1b('0x43')]=[{'all':!![]}];}_0xc1d041=_['merge']({},_0xc1d041,_0x4945b4[_0x8d1b('0x3e')]);return db[_0x8d1b('0x28')]['find'](_0xc1d041)[_0x8d1b('0x22')](handleEntityNotFound(_0x1f4936,null))[_0x8d1b('0x22')](respondWithResult(_0x1f4936,null))[_0x8d1b('0x44')](handleError(_0x1f4936,null));};exports[_0x8d1b('0x45')]=function(_0x489e73,_0x30656e){return db[_0x8d1b('0x28')][_0x8d1b('0x45')](_0x489e73['body'],{})[_0x8d1b('0x22')](respondWithResult(_0x30656e,0xc9))[_0x8d1b('0x44')](handleError(_0x30656e,null));};exports[_0x8d1b('0x21')]=function(_0x15a11b,_0x4ce5f4){if(_0x15a11b[_0x8d1b('0x46')]['id']){delete _0x15a11b[_0x8d1b('0x46')]['id'];}return db[_0x8d1b('0x28')]['find']({'where':{'id':_0x15a11b[_0x8d1b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ce5f4,null))[_0x8d1b('0x22')](saveUpdates(_0x15a11b[_0x8d1b('0x46')],null))[_0x8d1b('0x22')](respondWithResult(_0x4ce5f4,null))[_0x8d1b('0x44')](handleError(_0x4ce5f4,null));};exports[_0x8d1b('0x48')]=function(_0x3add4e,_0x3a7c86){return db[_0x8d1b('0x28')][_0x8d1b('0x49')]({'where':{'id':_0x3add4e[_0x8d1b('0x47')]['id']}})[_0x8d1b('0x22')](handleEntityNotFound(_0x3a7c86,null))[_0x8d1b('0x22')](removeEntity(_0x3a7c86,null))[_0x8d1b('0x44')](handleError(_0x3a7c86,null));};exports[_0x8d1b('0x4a')]=function(_0x2bdb5a,_0x568f29){return db[_0x8d1b('0x28')][_0x8d1b('0x4a')]()[_0x8d1b('0x22')](respondWithResult(_0x568f29,null))[_0x8d1b('0x44')](handleError(_0x568f29,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 87ba19e..fbb2db7 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x1ccfef,_0x48d09d){var _0x92e9=function(_0xf982ed){while(--_0xf982ed){_0x1ccfef['push'](_0x1ccfef['shift']());}};_0x92e9(++_0x48d09d);}(_0x5fc3,0xa8));var _0x35fc=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x5fc3[_0xf44d98];return _0x5ebb04;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x814b,0x1a2));var _0xb814=function(_0x4d770d,_0x5af4ce){_0x4d770d=_0x4d770d-0x0;var _0x11dc7a=_0x814b[_0x4d770d];return _0x11dc7a;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8d4607e..f2f97e2 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 _0xde9f=['client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueueReport','options','raw','CreateOpenchannelQueueReport','catch','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xde9f,0x118));var _0xfde9=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0xde9f[_0x4706a6];return _0x1bb705;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde9('0x1'));var rs=require(_0xfde9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde9('0x3'))['db'];var utils=require(_0xfde9('0x4'));var logger=require('../../config/logger')(_0xfde9('0x5'));var config=require(_0xfde9('0x6'));var jayson=require(_0xfde9('0x7'));var client=jayson[_0xfde9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3e01,_0x179ee0,_0x18a202){return new BPromise(function(_0x5569c2,_0x19a337){return client[_0xfde9('0x9')](_0x4c3e01,_0x18a202)[_0xfde9('0xa')](function(_0x3b775d){logger[_0xfde9('0xb')](_0xfde9('0xc'),_0x179ee0,_0xfde9('0xd'));logger[_0xfde9('0xe')](_0xfde9('0xf'),_0x179ee0,_0xfde9('0xd'),JSON[_0xfde9('0x10')](_0x3b775d));if(_0x3b775d[_0xfde9('0x11')]){if(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x12')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x19a337(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x5569c2(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}else{logger[_0xfde9('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x179ee0,_0xfde9('0xd'));_0x5569c2(_0x3b775d[_0xfde9('0x14')][_0xfde9('0x13')]);}})['catch'](function(_0x31b1c7){logger[_0xfde9('0x11')](_0xfde9('0xc'),_0x179ee0,_0x31b1c7);_0x19a337(_0x31b1c7);});});}exports['CreateOpenchannelQueueReport']=function(_0x4c9f24){var _0x5eb89e=this;return new Promise(function(_0x544f19,_0x166f1c){return db[_0xfde9('0x15')]['create'](_0x4c9f24['body'],{'raw':_0x4c9f24[_0xfde9('0x16')]?_0x4c9f24[_0xfde9('0x16')][_0xfde9('0x17')]===undefined?!![]:![]:!![]})[_0xfde9('0xa')](function(_0x162b07){logger[_0xfde9('0xb')](_0xfde9('0x18'),_0x4c9f24);logger[_0xfde9('0xe')](_0xfde9('0x18'),_0x4c9f24,JSON[_0xfde9('0x10')](_0x162b07));_0x544f19(_0x162b07);})[_0xfde9('0x19')](function(_0x28d189){logger['error'](_0xfde9('0x18'),_0x28d189['message'],_0x4c9f24);_0x166f1c(_0x5eb89e[_0xfde9('0x11')](0x1f4,_0x28d189[_0xfde9('0x13')]));});});};exports[_0xfde9('0x1a')]=function(_0x5d0a74){var _0x12e3e7=this;return new Promise(function(_0x10e809,_0x53733b){return db[_0xfde9('0x15')][_0xfde9('0x1b')](_0x5d0a74[_0xfde9('0x1c')],{'raw':_0x5d0a74[_0xfde9('0x16')]?_0x5d0a74[_0xfde9('0x16')][_0xfde9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d0a74[_0xfde9('0x16')]?_0x5d0a74[_0xfde9('0x16')][_0xfde9('0x1d')]||null:null,'attributes':_0x5d0a74[_0xfde9('0x16')]?_0x5d0a74[_0xfde9('0x16')][_0xfde9('0x1e')]||null:null,'limit':_0x5d0a74[_0xfde9('0x16')]?_0x5d0a74[_0xfde9('0x16')][_0xfde9('0x1f')]||null:null})[_0xfde9('0xa')](function(_0x4b7956){logger['info'](_0xfde9('0x1a'),_0x5d0a74);logger[_0xfde9('0xe')]('UpdateOpenchannelQueueReport',_0x5d0a74,JSON[_0xfde9('0x10')](_0x4b7956));_0x10e809(_0x4b7956);})[_0xfde9('0x19')](function(_0x1651e0){logger[_0xfde9('0x11')](_0xfde9('0x1a'),_0x1651e0['message'],_0x5d0a74);_0x53733b(_0x12e3e7[_0xfde9('0x11')](0x1f4,_0x1651e0[_0xfde9('0x13')]));});});}; \ No newline at end of file +var _0xd26f=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','update','body','attributes','limit','then','UpdateOpenchannelQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0xa716dc,_0x26207a){var _0xb33a04=function(_0x26a1df){while(--_0x26a1df){_0xa716dc['push'](_0xa716dc['shift']());}};_0xb33a04(++_0x26207a);}(_0xd26f,0x113));var _0xfd26=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xd26f[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});}exports[_0xfd26('0x16')]=function(_0xeb7aeb){var _0x210dd4=this;return new Promise(function(_0x36a275,_0x5b3e8b){return db[_0xfd26('0x17')]['create'](_0xeb7aeb['body'],{'raw':_0xeb7aeb['options']?_0xeb7aeb[_0xfd26('0x18')][_0xfd26('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x523cbe){logger[_0xfd26('0xc')](_0xfd26('0x16'),_0xeb7aeb);logger['debug'](_0xfd26('0x16'),_0xeb7aeb,JSON['stringify'](_0x523cbe));_0x36a275(_0x523cbe);})[_0xfd26('0x15')](function(_0x531bf7){logger[_0xfd26('0x12')]('CreateOpenchannelQueueReport',_0x531bf7[_0xfd26('0x13')],_0xeb7aeb);_0x5b3e8b(_0x210dd4[_0xfd26('0x12')](0x1f4,_0x531bf7['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1194c2){var _0x4bc02c=this;return new Promise(function(_0x1d62c5,_0xebbab7){return db[_0xfd26('0x17')][_0xfd26('0x1a')](_0x1194c2[_0xfd26('0x1b')],{'raw':_0x1194c2['options']?_0x1194c2[_0xfd26('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')]['where']||null:null,'attributes':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')][_0xfd26('0x1c')]||null:null,'limit':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')][_0xfd26('0x1d')]||null:null})[_0xfd26('0x1e')](function(_0x565c0){logger[_0xfd26('0xc')]('UpdateOpenchannelQueueReport',_0x1194c2);logger['debug']('UpdateOpenchannelQueueReport',_0x1194c2,JSON['stringify'](_0x565c0));_0x1d62c5(_0x565c0);})[_0xfd26('0x15')](function(_0x5d0101){logger[_0xfd26('0x12')](_0xfd26('0x1f'),_0x5d0101['message'],_0x1194c2);_0xebbab7(_0x4bc02c['error'](0x1f4,_0x5d0101[_0xfd26('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1a2d9a2..a20d931 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 _0xc597=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x1f2104,_0x3d1a56){var _0x590031=function(_0x16e37d){while(--_0x16e37d){_0x1f2104['push'](_0x1f2104['shift']());}};_0x590031(++_0x3d1a56);}(_0xc597,0xb6));var _0x7c59=function(_0x42fc3e,_0xdc5885){_0x42fc3e=_0x42fc3e-0x0;var _0x52e1fa=_0xc597[_0x42fc3e];return _0x52e1fa;};'use strict';var multer=require(_0x7c59('0x0'));var util=require(_0x7c59('0x1'));var path=require(_0x7c59('0x2'));var timeout=require(_0x7c59('0x3'));var express=require(_0x7c59('0x4'));var router=express['Router']();var fs_extra=require(_0x7c59('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c59('0x6'));var config=require(_0x7c59('0x7'));var controller=require(_0x7c59('0x8'));router[_0x7c59('0x9')]('/',auth[_0x7c59('0xa')](),controller[_0x7c59('0xb')]);router['get'](_0x7c59('0xc'),auth[_0x7c59('0xa')](),controller['describe']);router[_0x7c59('0x9')](_0x7c59('0xd'),auth[_0x7c59('0xa')](),controller[_0x7c59('0xe')]);router[_0x7c59('0xf')]('/',auth[_0x7c59('0xa')](),controller[_0x7c59('0x10')]);router[_0x7c59('0x11')](_0x7c59('0xd'),auth[_0x7c59('0xa')](),controller[_0x7c59('0x12')]);router[_0x7c59('0x13')](_0x7c59('0xd'),auth[_0x7c59('0xa')](),controller[_0x7c59('0x14')]);module[_0x7c59('0x15')]=router; \ No newline at end of file +var _0xf066=['show','isAuthenticated','create','update','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','describe','/:id'];(function(_0x10921d,_0x242a14){var _0x163ca1=function(_0x3429b2){while(--_0x3429b2){_0x10921d['push'](_0x10921d['shift']());}};_0x163ca1(++_0x242a14);}(_0xf066,0xd2));var _0x6f06=function(_0x501099,_0x223250){_0x501099=_0x501099-0x0;var _0x555ebf=_0xf066[_0x501099];return _0x555ebf;};'use strict';var multer=require(_0x6f06('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6f06('0x1'));var router=express[_0x6f06('0x2')]();var fs_extra=require(_0x6f06('0x3'));var auth=require(_0x6f06('0x4'));var interaction=require(_0x6f06('0x5'));var config=require(_0x6f06('0x6'));var controller=require(_0x6f06('0x7'));router[_0x6f06('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6f06('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6f06('0x9')]);router[_0x6f06('0x8')](_0x6f06('0xa'),auth['isAuthenticated'](),controller[_0x6f06('0xb')]);router['post']('/',auth[_0x6f06('0xc')](),controller[_0x6f06('0xd')]);router['put'](_0x6f06('0xa'),auth[_0x6f06('0xc')](),controller[_0x6f06('0xe')]);router['delete'](_0x6f06('0xa'),auth[_0x6f06('0xc')](),controller[_0x6f06('0xf')]);module[_0x6f06('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 2d8592a..9711281 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x2b7ba3,_0x3eb26a){var _0x2d189f=function(_0x29678e){while(--_0x29678e){_0x2b7ba3['push'](_0x2b7ba3['shift']());}};_0x2d189f(++_0x3eb26a);}(_0x54ef,0x112));var _0xf54e=function(_0x240eb4,_0x4e48fc){_0x240eb4=_0x240eb4-0x0;var _0xd30537=_0x54ef[_0x240eb4];return _0xd30537;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x687ddc,_0x2092fa){var _0x441991=function(_0x49c6a6){while(--_0x49c6a6){_0x687ddc['push'](_0x687ddc['shift']());}};_0x441991(++_0x2092fa);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4d75e8,_0x3e7f3b){_0x4d75e8=_0x4d75e8-0x0;var _0x45d873=_0x9bde[_0x4d75e8];return _0x45d873;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c94fddb..1b2d0cf 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 _0xb7f8=['filters','pick','filter','where','VIRTUAL','merge','then','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xb7f8,0x198));var _0x8b7f=function(_0x4b0173,_0x17fb98){_0x4b0173=_0x4b0173-0x0;var _0xd693a7=_0xb7f8[_0x4b0173];return _0xd693a7;};'use strict';var emlformat=require(_0x8b7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b7f('0x1'));var rp=require(_0x8b7f('0x2'));var moment=require('moment');var BPromise=require(_0x8b7f('0x3'));var Mustache=require(_0x8b7f('0x4'));var util=require('util');var path=require(_0x8b7f('0x5'));var sox=require('sox');var csv=require(_0x8b7f('0x6'));var ejs=require(_0x8b7f('0x7'));var fs=require('fs');var fs_extra=require(_0x8b7f('0x8'));var _=require(_0x8b7f('0x9'));var squel=require(_0x8b7f('0xa'));var crypto=require(_0x8b7f('0xb'));var jsforce=require(_0x8b7f('0xc'));var deskjs=require(_0x8b7f('0xd'));var toCsv=require(_0x8b7f('0x6'));var querystring=require(_0x8b7f('0xe'));var Papa=require(_0x8b7f('0xf'));var Redis=require(_0x8b7f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8b7f('0x11'));var as=require(_0x8b7f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b7f('0x13'))(_0x8b7f('0x14'));var utils=require(_0x8b7f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8b7f('0x16'));var db=require(_0x8b7f('0x17'))['db'];function respondWithStatusCode(_0x5b0ccd,_0x170dc5){_0x170dc5=_0x170dc5||0xcc;return function(_0x4dca4d){if(_0x4dca4d){return _0x5b0ccd[_0x8b7f('0x18')](_0x170dc5);}return _0x5b0ccd[_0x8b7f('0x19')](_0x170dc5)[_0x8b7f('0x1a')]();};}function respondWithResult(_0x52bf84,_0x568f04){_0x568f04=_0x568f04||0xc8;return function(_0x46d71e){if(_0x46d71e){return _0x52bf84['status'](_0x568f04)[_0x8b7f('0x1b')](_0x46d71e);}};}function respondWithFilteredResult(_0x29007e,_0x2d435e){return function(_0x1f7f5b){if(_0x1f7f5b){var _0x1271e3=typeof _0x2d435e[_0x8b7f('0x1c')]===_0x8b7f('0x1d')&&typeof _0x2d435e['limit']===_0x8b7f('0x1d');var _0x4ff95c=_0x1f7f5b[_0x8b7f('0x1e')];var _0x349a22=_0x1271e3?0x0:_0x2d435e[_0x8b7f('0x1c')];var _0x14d015=_0x1271e3?_0x1f7f5b['count']:_0x2d435e[_0x8b7f('0x1c')]+_0x2d435e['limit'];var _0x40dddd;if(_0x14d015>=_0x4ff95c){_0x14d015=_0x4ff95c;_0x40dddd=0xc8;}else{_0x40dddd=0xce;}_0x29007e[_0x8b7f('0x19')](_0x40dddd);return _0x29007e[_0x8b7f('0x1f')](_0x8b7f('0x20'),_0x349a22+'-'+_0x14d015+'/'+_0x4ff95c)[_0x8b7f('0x1b')](_0x1f7f5b);}return null;};}function patchUpdates(_0x5502dd){return function(_0x39027a){try{jsonpatch[_0x8b7f('0x21')](_0x39027a,_0x5502dd,!![]);}catch(_0x34d5e9){return BPromise[_0x8b7f('0x22')](_0x34d5e9);}return _0x39027a[_0x8b7f('0x23')]();};}function saveUpdates(_0xd1de8b,_0x17a216){return function(_0x3eb793){if(_0x3eb793){return _0x3eb793[_0x8b7f('0x24')](_0xd1de8b)['then'](function(_0x1412da){return _0x1412da;});}return null;};}function removeEntity(_0x135112,_0x4fe4af){return function(_0x8784ae){if(_0x8784ae){return _0x8784ae[_0x8b7f('0x25')]()['then'](function(){_0x135112[_0x8b7f('0x19')](0xcc)[_0x8b7f('0x1a')]();});}};}function handleEntityNotFound(_0x5b350e,_0x6067d9){return function(_0x4a6791){if(!_0x4a6791){_0x5b350e['sendStatus'](0x194);}return _0x4a6791;};}function handleError(_0x1a4b00,_0x3e1e73){_0x3e1e73=_0x3e1e73||0x1f4;return function(_0x150a90){logger[_0x8b7f('0x26')](_0x150a90[_0x8b7f('0x27')]);if(_0x150a90['name']){delete _0x150a90[_0x8b7f('0x28')];}_0x1a4b00[_0x8b7f('0x19')](_0x3e1e73)[_0x8b7f('0x29')](_0x150a90);};}exports[_0x8b7f('0x2a')]=function(_0x559777,_0x142abb){var _0x41d3bd={},_0x49643d={},_0x47c77b={'count':0x0,'rows':[]};var _0x56a32b=_[_0x8b7f('0x2b')](db[_0x8b7f('0x2c')]['rawAttributes'],function(_0x5e9e19){return{'name':_0x5e9e19[_0x8b7f('0x2d')],'type':_0x5e9e19[_0x8b7f('0x2e')][_0x8b7f('0x2f')]};});_0x49643d[_0x8b7f('0x30')]=_['map'](_0x56a32b,_0x8b7f('0x28'));_0x49643d[_0x8b7f('0x31')]=_[_0x8b7f('0x32')](_0x559777[_0x8b7f('0x31')]);_0x49643d['filters']=_[_0x8b7f('0x33')](_0x49643d[_0x8b7f('0x30')],_0x49643d[_0x8b7f('0x31')]);_0x41d3bd[_0x8b7f('0x34')]=_['intersection'](_0x49643d['model'],qs[_0x8b7f('0x35')](_0x559777['query'][_0x8b7f('0x35')]));_0x41d3bd[_0x8b7f('0x34')]=_0x41d3bd['attributes'][_0x8b7f('0x36')]?_0x41d3bd['attributes']:_0x49643d['model'];if(!_0x559777[_0x8b7f('0x31')][_0x8b7f('0x37')](_0x8b7f('0x38'))){_0x41d3bd[_0x8b7f('0x39')]=qs[_0x8b7f('0x39')](_0x559777[_0x8b7f('0x31')][_0x8b7f('0x39')]);_0x41d3bd[_0x8b7f('0x1c')]=qs['offset'](_0x559777[_0x8b7f('0x31')]['offset']);}_0x41d3bd[_0x8b7f('0x3a')]=qs[_0x8b7f('0x3b')](_0x559777[_0x8b7f('0x31')][_0x8b7f('0x3b')]);_0x41d3bd['where']=qs[_0x8b7f('0x3c')](_[_0x8b7f('0x3d')](_0x559777[_0x8b7f('0x31')],_0x49643d['filters']),_0x56a32b);if(_0x559777[_0x8b7f('0x31')][_0x8b7f('0x3e')]){_0x41d3bd[_0x8b7f('0x3f')]=_['merge'](_0x41d3bd[_0x8b7f('0x3f')],{'$or':_[_0x8b7f('0x2b')](_0x56a32b,function(_0x4e7396){if(_0x4e7396['type']!==_0x8b7f('0x40')){var _0x21beb0={};_0x21beb0[_0x4e7396[_0x8b7f('0x28')]]={'$like':'%'+_0x559777[_0x8b7f('0x31')][_0x8b7f('0x3e')]+'%'};return _0x21beb0;}})});}_0x41d3bd=_[_0x8b7f('0x41')]({},_0x41d3bd,_0x559777['options']);var _0xfd96b4={'where':_0x41d3bd['where']};return db[_0x8b7f('0x2c')][_0x8b7f('0x1e')](_0xfd96b4)[_0x8b7f('0x42')](function(_0x4b213a){_0x47c77b[_0x8b7f('0x1e')]=_0x4b213a;if(_0x559777[_0x8b7f('0x31')][_0x8b7f('0x43')]){_0x41d3bd['include']=[{'all':!![]}];}return db[_0x8b7f('0x2c')][_0x8b7f('0x44')](_0x41d3bd);})['then'](function(_0x19ea87){_0x47c77b['rows']=_0x19ea87;return _0x47c77b;})[_0x8b7f('0x42')](respondWithFilteredResult(_0x142abb,_0x41d3bd))[_0x8b7f('0x45')](handleError(_0x142abb,null));};exports[_0x8b7f('0x46')]=function(_0x398c19,_0x4bf959){var _0x52e504={'raw':!![],'where':{'id':_0x398c19[_0x8b7f('0x47')]['id']}},_0x2a90e7={};_0x2a90e7[_0x8b7f('0x30')]=_[_0x8b7f('0x32')](db['OpenchannelTransferReport']['rawAttributes']);_0x2a90e7[_0x8b7f('0x31')]=_['keys'](_0x398c19['query']);_0x2a90e7[_0x8b7f('0x3c')]=_['intersection'](_0x2a90e7['model'],_0x2a90e7[_0x8b7f('0x31')]);_0x52e504[_0x8b7f('0x34')]=_[_0x8b7f('0x33')](_0x2a90e7[_0x8b7f('0x30')],qs[_0x8b7f('0x35')](_0x398c19[_0x8b7f('0x31')]['fields']));_0x52e504[_0x8b7f('0x34')]=_0x52e504[_0x8b7f('0x34')][_0x8b7f('0x36')]?_0x52e504[_0x8b7f('0x34')]:_0x2a90e7['model'];if(_0x398c19[_0x8b7f('0x31')][_0x8b7f('0x43')]){_0x52e504[_0x8b7f('0x48')]=[{'all':!![]}];}_0x52e504=_[_0x8b7f('0x41')]({},_0x52e504,_0x398c19[_0x8b7f('0x49')]);return db[_0x8b7f('0x2c')][_0x8b7f('0x4a')](_0x52e504)[_0x8b7f('0x42')](handleEntityNotFound(_0x4bf959,null))['then'](respondWithResult(_0x4bf959,null))[_0x8b7f('0x45')](handleError(_0x4bf959,null));};exports[_0x8b7f('0x4b')]=function(_0x3768fa,_0x282702){return db[_0x8b7f('0x2c')][_0x8b7f('0x4b')](_0x3768fa[_0x8b7f('0x4c')],{})[_0x8b7f('0x42')](respondWithResult(_0x282702,0xc9))[_0x8b7f('0x45')](handleError(_0x282702,null));};exports['update']=function(_0x4db597,_0x59e540){if(_0x4db597[_0x8b7f('0x4c')]['id']){delete _0x4db597[_0x8b7f('0x4c')]['id'];}return db[_0x8b7f('0x2c')][_0x8b7f('0x4a')]({'where':{'id':_0x4db597[_0x8b7f('0x47')]['id']}})[_0x8b7f('0x42')](handleEntityNotFound(_0x59e540,null))[_0x8b7f('0x42')](saveUpdates(_0x4db597[_0x8b7f('0x4c')],null))['then'](respondWithResult(_0x59e540,null))['catch'](handleError(_0x59e540,null));};exports[_0x8b7f('0x25')]=function(_0x5edb26,_0x417a47){return db[_0x8b7f('0x2c')][_0x8b7f('0x4a')]({'where':{'id':_0x5edb26['params']['id']}})[_0x8b7f('0x42')](handleEntityNotFound(_0x417a47,null))['then'](removeEntity(_0x417a47,null))[_0x8b7f('0x45')](handleError(_0x417a47,null));};exports[_0x8b7f('0x4d')]=function(_0x430fc5,_0x33d050){return db[_0x8b7f('0x2c')]['describe']()[_0x8b7f('0x42')](respondWithResult(_0x33d050,null))['catch'](handleError(_0x33d050,null));}; \ No newline at end of file +var _0xc232=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x5c99f9,_0x5af9b5){var _0x395623=function(_0x28ba22){while(--_0x28ba22){_0x5c99f9['push'](_0x5c99f9['shift']());}};_0x395623(++_0x5af9b5);}(_0xc232,0xd8));var _0x2c23=function(_0x3e1587,_0xe1194e){_0x3e1587=_0x3e1587-0x0;var _0x1a1c1a=_0xc232[_0x3e1587];return _0x1a1c1a;};'use strict';var emlformat=require(_0x2c23('0x0'));var rimraf=require(_0x2c23('0x1'));var zipdir=require(_0x2c23('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c23('0x3'));var moment=require(_0x2c23('0x4'));var BPromise=require(_0x2c23('0x5'));var Mustache=require(_0x2c23('0x6'));var util=require(_0x2c23('0x7'));var path=require(_0x2c23('0x8'));var sox=require(_0x2c23('0x9'));var csv=require(_0x2c23('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c23('0xb'));var _=require(_0x2c23('0xc'));var squel=require(_0x2c23('0xd'));var crypto=require(_0x2c23('0xe'));var jsforce=require(_0x2c23('0xf'));var deskjs=require(_0x2c23('0x10'));var toCsv=require(_0x2c23('0xa'));var querystring=require(_0x2c23('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c23('0x12'));var qs=require(_0x2c23('0x13'));var as=require(_0x2c23('0x14'));var hardwareService=require(_0x2c23('0x15'));var logger=require(_0x2c23('0x16'))(_0x2c23('0x17'));var utils=require(_0x2c23('0x18'));var config=require(_0x2c23('0x19'));var licenseUtil=require(_0x2c23('0x1a'));var db=require(_0x2c23('0x1b'))['db'];function respondWithStatusCode(_0x4c94d2,_0x23b52a){_0x23b52a=_0x23b52a||0xcc;return function(_0x159e6f){if(_0x159e6f){return _0x4c94d2[_0x2c23('0x1c')](_0x23b52a);}return _0x4c94d2[_0x2c23('0x1d')](_0x23b52a)[_0x2c23('0x1e')]();};}function respondWithResult(_0x58c09d,_0xcc11fe){_0xcc11fe=_0xcc11fe||0xc8;return function(_0x106611){if(_0x106611){return _0x58c09d[_0x2c23('0x1d')](_0xcc11fe)[_0x2c23('0x1f')](_0x106611);}};}function respondWithFilteredResult(_0x479823,_0x254a92){return function(_0x35c521){if(_0x35c521){var _0x387db0=typeof _0x254a92[_0x2c23('0x20')]==='undefined'&&typeof _0x254a92[_0x2c23('0x21')]===_0x2c23('0x22');var _0xb73dc=_0x35c521[_0x2c23('0x23')];var _0x45c1a9=_0x387db0?0x0:_0x254a92[_0x2c23('0x20')];var _0x1c27cb=_0x387db0?_0x35c521[_0x2c23('0x23')]:_0x254a92[_0x2c23('0x20')]+_0x254a92[_0x2c23('0x21')];var _0x3678bd;if(_0x1c27cb>=_0xb73dc){_0x1c27cb=_0xb73dc;_0x3678bd=0xc8;}else{_0x3678bd=0xce;}_0x479823[_0x2c23('0x1d')](_0x3678bd);return _0x479823[_0x2c23('0x24')](_0x2c23('0x25'),_0x45c1a9+'-'+_0x1c27cb+'/'+_0xb73dc)['json'](_0x35c521);}return null;};}function patchUpdates(_0x4d8335){return function(_0x52bd58){try{jsonpatch['apply'](_0x52bd58,_0x4d8335,!![]);}catch(_0x163f11){return BPromise[_0x2c23('0x26')](_0x163f11);}return _0x52bd58[_0x2c23('0x27')]();};}function saveUpdates(_0x21e06a,_0x102b90){return function(_0xd48e08){if(_0xd48e08){return _0xd48e08[_0x2c23('0x28')](_0x21e06a)[_0x2c23('0x29')](function(_0x328f4c){return _0x328f4c;});}return null;};}function removeEntity(_0x4707fd,_0xdb2db){return function(_0x1a3b7e){if(_0x1a3b7e){return _0x1a3b7e[_0x2c23('0x2a')]()[_0x2c23('0x29')](function(){_0x4707fd[_0x2c23('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb0410,_0x21df28){return function(_0x4835e3){if(!_0x4835e3){_0xdb0410[_0x2c23('0x1c')](0x194);}return _0x4835e3;};}function handleError(_0x350ad8,_0x2f963c){_0x2f963c=_0x2f963c||0x1f4;return function(_0x1a6252){logger[_0x2c23('0x2b')](_0x1a6252[_0x2c23('0x2c')]);if(_0x1a6252[_0x2c23('0x2d')]){delete _0x1a6252[_0x2c23('0x2d')];}_0x350ad8[_0x2c23('0x1d')](_0x2f963c)[_0x2c23('0x2e')](_0x1a6252);};}exports['index']=function(_0x415c96,_0x26311c){var _0x3ce11a={},_0x3f09ad={},_0x460f1c={'count':0x0,'rows':[]};var _0x3bb544=_[_0x2c23('0x2f')](db[_0x2c23('0x30')]['rawAttributes'],function(_0x80a463){return{'name':_0x80a463[_0x2c23('0x31')],'type':_0x80a463[_0x2c23('0x32')][_0x2c23('0x33')]};});_0x3f09ad[_0x2c23('0x34')]=_[_0x2c23('0x2f')](_0x3bb544,_0x2c23('0x2d'));_0x3f09ad[_0x2c23('0x35')]=_['keys'](_0x415c96['query']);_0x3f09ad[_0x2c23('0x36')]=_[_0x2c23('0x37')](_0x3f09ad[_0x2c23('0x34')],_0x3f09ad[_0x2c23('0x35')]);_0x3ce11a[_0x2c23('0x38')]=_[_0x2c23('0x37')](_0x3f09ad[_0x2c23('0x34')],qs[_0x2c23('0x39')](_0x415c96[_0x2c23('0x35')][_0x2c23('0x39')]));_0x3ce11a[_0x2c23('0x38')]=_0x3ce11a[_0x2c23('0x38')]['length']?_0x3ce11a[_0x2c23('0x38')]:_0x3f09ad['model'];if(!_0x415c96[_0x2c23('0x35')][_0x2c23('0x3a')](_0x2c23('0x3b'))){_0x3ce11a[_0x2c23('0x21')]=qs[_0x2c23('0x21')](_0x415c96[_0x2c23('0x35')][_0x2c23('0x21')]);_0x3ce11a['offset']=qs['offset'](_0x415c96[_0x2c23('0x35')][_0x2c23('0x20')]);}_0x3ce11a['order']=qs[_0x2c23('0x3c')](_0x415c96[_0x2c23('0x35')][_0x2c23('0x3c')]);_0x3ce11a[_0x2c23('0x3d')]=qs[_0x2c23('0x36')](_['pick'](_0x415c96[_0x2c23('0x35')],_0x3f09ad['filters']),_0x3bb544);if(_0x415c96[_0x2c23('0x35')][_0x2c23('0x3e')]){_0x3ce11a[_0x2c23('0x3d')]=_[_0x2c23('0x3f')](_0x3ce11a[_0x2c23('0x3d')],{'$or':_[_0x2c23('0x2f')](_0x3bb544,function(_0x17031e){if(_0x17031e[_0x2c23('0x32')]!=='VIRTUAL'){var _0x2810a5={};_0x2810a5[_0x17031e[_0x2c23('0x2d')]]={'$like':'%'+_0x415c96['query'][_0x2c23('0x3e')]+'%'};return _0x2810a5;}})});}_0x3ce11a=_[_0x2c23('0x3f')]({},_0x3ce11a,_0x415c96[_0x2c23('0x40')]);var _0x3184c6={'where':_0x3ce11a['where']};return db[_0x2c23('0x30')][_0x2c23('0x23')](_0x3184c6)[_0x2c23('0x29')](function(_0x2a9d18){_0x460f1c[_0x2c23('0x23')]=_0x2a9d18;if(_0x415c96[_0x2c23('0x35')][_0x2c23('0x41')]){_0x3ce11a[_0x2c23('0x42')]=[{'all':!![]}];}return db[_0x2c23('0x30')][_0x2c23('0x43')](_0x3ce11a);})[_0x2c23('0x29')](function(_0x3ab562){_0x460f1c[_0x2c23('0x44')]=_0x3ab562;return _0x460f1c;})[_0x2c23('0x29')](respondWithFilteredResult(_0x26311c,_0x3ce11a))[_0x2c23('0x45')](handleError(_0x26311c,null));};exports[_0x2c23('0x46')]=function(_0x54b127,_0x123dc5){var _0x31cd5a={'raw':!![],'where':{'id':_0x54b127[_0x2c23('0x47')]['id']}},_0x41e6b4={};_0x41e6b4['model']=_['keys'](db[_0x2c23('0x30')][_0x2c23('0x48')]);_0x41e6b4[_0x2c23('0x35')]=_[_0x2c23('0x49')](_0x54b127[_0x2c23('0x35')]);_0x41e6b4[_0x2c23('0x36')]=_['intersection'](_0x41e6b4[_0x2c23('0x34')],_0x41e6b4['query']);_0x31cd5a['attributes']=_[_0x2c23('0x37')](_0x41e6b4[_0x2c23('0x34')],qs[_0x2c23('0x39')](_0x54b127['query'][_0x2c23('0x39')]));_0x31cd5a['attributes']=_0x31cd5a[_0x2c23('0x38')]['length']?_0x31cd5a[_0x2c23('0x38')]:_0x41e6b4['model'];if(_0x54b127[_0x2c23('0x35')][_0x2c23('0x41')]){_0x31cd5a['include']=[{'all':!![]}];}_0x31cd5a=_['merge']({},_0x31cd5a,_0x54b127['options']);return db[_0x2c23('0x30')]['find'](_0x31cd5a)[_0x2c23('0x29')](handleEntityNotFound(_0x123dc5,null))[_0x2c23('0x29')](respondWithResult(_0x123dc5,null))[_0x2c23('0x45')](handleError(_0x123dc5,null));};exports['create']=function(_0x5c0b4e,_0x1a36c4){return db[_0x2c23('0x30')][_0x2c23('0x4a')](_0x5c0b4e[_0x2c23('0x4b')],{})[_0x2c23('0x29')](respondWithResult(_0x1a36c4,0xc9))[_0x2c23('0x45')](handleError(_0x1a36c4,null));};exports[_0x2c23('0x28')]=function(_0x122a3a,_0x121ac7){if(_0x122a3a[_0x2c23('0x4b')]['id']){delete _0x122a3a['body']['id'];}return db['OpenchannelTransferReport'][_0x2c23('0x4c')]({'where':{'id':_0x122a3a[_0x2c23('0x47')]['id']}})[_0x2c23('0x29')](handleEntityNotFound(_0x121ac7,null))[_0x2c23('0x29')](saveUpdates(_0x122a3a[_0x2c23('0x4b')],null))[_0x2c23('0x29')](respondWithResult(_0x121ac7,null))[_0x2c23('0x45')](handleError(_0x121ac7,null));};exports['destroy']=function(_0x39b0d7,_0x1df4af){return db['OpenchannelTransferReport'][_0x2c23('0x4c')]({'where':{'id':_0x39b0d7['params']['id']}})[_0x2c23('0x29')](handleEntityNotFound(_0x1df4af,null))['then'](removeEntity(_0x1df4af,null))['catch'](handleError(_0x1df4af,null));};exports['describe']=function(_0xcb3125,_0x46ef37){return db[_0x2c23('0x30')]['describe']()[_0x2c23('0x29')](respondWithResult(_0x46ef37,null))[_0x2c23('0x45')](handleError(_0x46ef37,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index cdb4b12..7a5695d 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 _0x9601=['report_openchannel_transfer','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelTransferReport'];(function(_0x3d46cd,_0x12605c){var _0x412bac=function(_0x69ae8d){while(--_0x69ae8d){_0x3d46cd['push'](_0x3d46cd['shift']());}};_0x412bac(++_0x12605c);}(_0x9601,0x182));var _0x1960=function(_0x567bc3,_0x482a15){_0x567bc3=_0x567bc3-0x0;var _0x490ac7=_0x9601[_0x567bc3];return _0x490ac7;};'use strict';var _=require(_0x1960('0x0'));var util=require(_0x1960('0x1'));var logger=require(_0x1960('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1960('0x3'));var rp=require(_0x1960('0x4'));var fs=require('fs');var path=require(_0x1960('0x5'));var rimraf=require('rimraf');var config=require(_0x1960('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x1960('0x7')]=function(_0x4403c1,_0x3ac57d){return _0x4403c1[_0x1960('0x8')](_0x1960('0x9'),attributes,{'tableName':_0x1960('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1811=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x1811,0x83));var _0x1181=function(_0x4fbde2,_0x364951){_0x4fbde2=_0x4fbde2-0x0;var _0x2bce29=_0x1811[_0x4fbde2];return _0x2bce29;};'use strict';var _=require('lodash');var util=require(_0x1181('0x0'));var logger=require(_0x1181('0x1'))(_0x1181('0x2'));var moment=require('moment');var BPromise=require(_0x1181('0x3'));var rp=require(_0x1181('0x4'));var fs=require('fs');var path=require(_0x1181('0x5'));var rimraf=require(_0x1181('0x6'));var config=require(_0x1181('0x7'));var attributes=require(_0x1181('0x8'));module[_0x1181('0x9')]=function(_0x529bbd,_0x43d6ac){return _0x529bbd[_0x1181('0xa')](_0x1181('0xb'),attributes,{'tableName':_0x1181('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1181('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 74dd157..c10a0bb 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 _0x5d17=['request','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x17e3bc,_0x269208){var _0x13dffa=function(_0x2664fd){while(--_0x2664fd){_0x17e3bc['push'](_0x17e3bc['shift']());}};_0x13dffa(++_0x269208);}(_0x5d17,0x114));var _0x75d1=function(_0x3d14d1,_0x23aa69){_0x3d14d1=_0x3d14d1-0x0;var _0xc78d1f=_0x5d17[_0x3d14d1];return _0xc78d1f;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file +var _0x31c2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x31c2,0x1e1));var _0x231c=function(_0x5bef43,_0x4d434a){_0x5bef43=_0x5bef43-0x0;var _0x3417e1=_0x31c2[_0x5bef43];return _0x3417e1;};'use strict';var _=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var BPromise=require(_0x231c('0x3'));var rs=require(_0x231c('0x4'));var fs=require('fs');var Redis=require(_0x231c('0x5'));var db=require(_0x231c('0x6'))['db'];var utils=require(_0x231c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x231c('0x8'));var jayson=require(_0x231c('0x9'));var client=jayson[_0x231c('0xa')][_0x231c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48bfb2,_0x111bf9,_0x49ff9e){return new BPromise(function(_0x439df8,_0x38b3b9){return client[_0x231c('0xc')](_0x48bfb2,_0x49ff9e)['then'](function(_0x2524bf){logger[_0x231c('0xd')](_0x231c('0xe'),_0x111bf9,_0x231c('0xf'));logger[_0x231c('0x10')](_0x231c('0x11'),_0x111bf9,_0x231c('0xf'),JSON['stringify'](_0x2524bf));if(_0x2524bf[_0x231c('0x12')]){if(_0x2524bf[_0x231c('0x12')]['code']===0x1f4){logger[_0x231c('0x12')](_0x231c('0xe'),_0x111bf9,_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);return _0x38b3b9(_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);}logger[_0x231c('0x12')](_0x231c('0xe'),_0x111bf9,_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);return _0x439df8(_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);}else{logger[_0x231c('0xd')](_0x231c('0xe'),_0x111bf9,_0x231c('0xf'));_0x439df8(_0x2524bf[_0x231c('0x14')][_0x231c('0x13')]);}})[_0x231c('0x15')](function(_0x1852e5){logger[_0x231c('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x111bf9,_0x1852e5);_0x38b3b9(_0x1852e5);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b661657..d671244 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 _0x1d3d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x5f0a0d,_0x2daa8c){var _0x908ab2=function(_0x5ee69a){while(--_0x5ee69a){_0x5f0a0d['push'](_0x5f0a0d['shift']());}};_0x908ab2(++_0x2daa8c);}(_0x1d3d,0x13b));var _0xd1d3=function(_0x4f5755,_0x1af431){_0x4f5755=_0x4f5755-0x0;var _0x4c9746=_0x1d3d[_0x4f5755];return _0x4c9746;};'use strict';var multer=require(_0xd1d3('0x0'));var util=require(_0xd1d3('0x1'));var path=require(_0xd1d3('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1d3('0x3'));var router=express[_0xd1d3('0x4')]();var fs_extra=require(_0xd1d3('0x5'));var auth=require(_0xd1d3('0x6'));var interaction=require(_0xd1d3('0x7'));var config=require(_0xd1d3('0x8'));var controller=require(_0xd1d3('0x9'));router[_0xd1d3('0xa')]('/',auth['isAuthenticated'](),controller[_0xd1d3('0xb')]);router['get'](_0xd1d3('0xc'),auth[_0xd1d3('0xd')](),controller['show']);router[_0xd1d3('0xe')]('/',auth[_0xd1d3('0xd')](),controller[_0xd1d3('0xf')]);router[_0xd1d3('0x10')](_0xd1d3('0xc'),auth[_0xd1d3('0xd')](),controller[_0xd1d3('0x11')]);router[_0xd1d3('0x12')]('/:id',auth[_0xd1d3('0xd')](),controller[_0xd1d3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x136c=['destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x496a18,_0xbecb65){var _0x203f14=function(_0x5696c3){while(--_0x5696c3){_0x496a18['push'](_0x496a18['shift']());}};_0x203f14(++_0xbecb65);}(_0x136c,0x65));var _0xc136=function(_0x3d8d42,_0x29efab){_0x3d8d42=_0x3d8d42-0x0;var _0x1873cd=_0x136c[_0x3d8d42];return _0x1873cd;};'use strict';var multer=require('multer');var util=require(_0xc136('0x0'));var path=require(_0xc136('0x1'));var timeout=require('connect-timeout');var express=require(_0xc136('0x2'));var router=express[_0xc136('0x3')]();var fs_extra=require(_0xc136('0x4'));var auth=require(_0xc136('0x5'));var interaction=require(_0xc136('0x6'));var config=require(_0xc136('0x7'));var controller=require(_0xc136('0x8'));router[_0xc136('0x9')]('/',auth['isAuthenticated'](),controller[_0xc136('0xa')]);router[_0xc136('0x9')](_0xc136('0xb'),auth[_0xc136('0xc')](),controller[_0xc136('0xd')]);router[_0xc136('0xe')]('/',auth[_0xc136('0xc')](),controller[_0xc136('0xf')]);router[_0xc136('0x10')](_0xc136('0xb'),auth['isAuthenticated'](),controller[_0xc136('0x11')]);router[_0xc136('0x12')](_0xc136('0xb'),auth[_0xc136('0xc')](),controller[_0xc136('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 3a72cbf..d044465 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 _0x6569=['sequelize','exports','STRING','name'];(function(_0x261702,_0x1c58f5){var _0x51e1ea=function(_0x67788b){while(--_0x67788b){_0x261702['push'](_0x261702['shift']());}};_0x51e1ea(++_0x1c58f5);}(_0x6569,0x14c));var _0x9656=function(_0x2f7fd3,_0x5d0442){_0x2f7fd3=_0x2f7fd3-0x0;var _0xf95e9e=_0x6569[_0x2f7fd3];return _0xf95e9e;};'use strict';var Sequelize=require(_0x9656('0x0'));module[_0x9656('0x1')]={'name':{'type':Sequelize[_0x9656('0x2')],'unique':_0x9656('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9656('0x2')]}}; \ No newline at end of file +var _0x8fbb=['exports','STRING','name'];(function(_0x439f45,_0x542c73){var _0x6aa2e3=function(_0xc3474){while(--_0xc3474){_0x439f45['push'](_0x439f45['shift']());}};_0x6aa2e3(++_0x542c73);}(_0x8fbb,0x11d));var _0xb8fb=function(_0x57b38f,_0xc26f33){_0x57b38f=_0x57b38f-0x0;var _0x6aa12c=_0x8fbb[_0x57b38f];return _0x6aa12c;};'use strict';var Sequelize=require('sequelize');module[_0xb8fb('0x0')]={'name':{'type':Sequelize[_0xb8fb('0x1')],'unique':_0xb8fb('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c22def9..b4ef800 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 _0x7e7b=['error','name','send','map','Pause','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','find','destroy','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','sendStatus'];(function(_0x2abcab,_0x2a2d49){var _0x4f8352=function(_0xee2b4){while(--_0xee2b4){_0x2abcab['push'](_0x2abcab['shift']());}};_0x4f8352(++_0x2a2d49);}(_0x7e7b,0xd4));var _0xb7e7=function(_0x3164d5,_0x347d64){_0x3164d5=_0x3164d5-0x0;var _0x4e0d5c=_0x7e7b[_0x3164d5];return _0x4e0d5c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb7e7('0x0'));var jsonpatch=require(_0xb7e7('0x1'));var rp=require(_0xb7e7('0x2'));var moment=require(_0xb7e7('0x3'));var BPromise=require(_0xb7e7('0x4'));var Mustache=require(_0xb7e7('0x5'));var util=require(_0xb7e7('0x6'));var path=require(_0xb7e7('0x7'));var sox=require(_0xb7e7('0x8'));var csv=require(_0xb7e7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7e7('0xa'));var _=require(_0xb7e7('0xb'));var squel=require(_0xb7e7('0xc'));var crypto=require(_0xb7e7('0xd'));var jsforce=require(_0xb7e7('0xe'));var deskjs=require(_0xb7e7('0xf'));var toCsv=require(_0xb7e7('0x9'));var querystring=require(_0xb7e7('0x10'));var Papa=require(_0xb7e7('0x11'));var Redis=require(_0xb7e7('0x12'));var authService=require(_0xb7e7('0x13'));var qs=require(_0xb7e7('0x14'));var as=require(_0xb7e7('0x15'));var hardwareService=require(_0xb7e7('0x16'));var logger=require(_0xb7e7('0x17'))(_0xb7e7('0x18'));var utils=require(_0xb7e7('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb7e7('0x1a'));var db=require(_0xb7e7('0x1b'))['db'];function respondWithStatusCode(_0x55b8e6,_0x47891d){_0x47891d=_0x47891d||0xcc;return function(_0x6e9a5f){if(_0x6e9a5f){return _0x55b8e6['sendStatus'](_0x47891d);}return _0x55b8e6[_0xb7e7('0x1c')](_0x47891d)[_0xb7e7('0x1d')]();};}function respondWithResult(_0x5cae06,_0x1735be){_0x1735be=_0x1735be||0xc8;return function(_0x1fecb6){if(_0x1fecb6){return _0x5cae06['status'](_0x1735be)[_0xb7e7('0x1e')](_0x1fecb6);}};}function respondWithFilteredResult(_0x4ada53,_0x3059b6){return function(_0x2e0a8f){if(_0x2e0a8f){var _0x221f95=typeof _0x3059b6[_0xb7e7('0x1f')]===_0xb7e7('0x20')&&typeof _0x3059b6[_0xb7e7('0x21')]==='undefined';var _0x14a6d3=_0x2e0a8f[_0xb7e7('0x22')];var _0x23d683=_0x221f95?0x0:_0x3059b6['offset'];var _0x12980f=_0x221f95?_0x2e0a8f[_0xb7e7('0x22')]:_0x3059b6[_0xb7e7('0x1f')]+_0x3059b6[_0xb7e7('0x21')];var _0x5ac67f;if(_0x12980f>=_0x14a6d3){_0x12980f=_0x14a6d3;_0x5ac67f=0xc8;}else{_0x5ac67f=0xce;}_0x4ada53[_0xb7e7('0x1c')](_0x5ac67f);return _0x4ada53[_0xb7e7('0x23')](_0xb7e7('0x24'),_0x23d683+'-'+_0x12980f+'/'+_0x14a6d3)[_0xb7e7('0x1e')](_0x2e0a8f);}return null;};}function patchUpdates(_0x380cd0){return function(_0x27a32b){try{jsonpatch[_0xb7e7('0x25')](_0x27a32b,_0x380cd0,!![]);}catch(_0xe16103){return BPromise[_0xb7e7('0x26')](_0xe16103);}return _0x27a32b[_0xb7e7('0x27')]();};}function saveUpdates(_0xbca096,_0x3c490b){return function(_0x297d7a){if(_0x297d7a){return _0x297d7a[_0xb7e7('0x28')](_0xbca096)[_0xb7e7('0x29')](function(_0xc8c823){return _0xc8c823;});}return null;};}function removeEntity(_0x4b284d,_0x319647){return function(_0x2c621d){if(_0x2c621d){return _0x2c621d['destroy']()[_0xb7e7('0x29')](function(){var _0x3c6d98=_0x2c621d[_0xb7e7('0x2a')]({'plain':!![]});var _0x4a1769=_0xb7e7('0x2b');return db[_0xb7e7('0x2c')]['destroy']({'where':{'type':_0x4a1769,'resourceId':_0x3c6d98['id']}})[_0xb7e7('0x29')](function(){return _0x2c621d;});})[_0xb7e7('0x29')](function(){_0x4b284d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd9490a,_0x20e40f){return function(_0x38cb1c){if(!_0x38cb1c){_0xd9490a[_0xb7e7('0x2d')](0x194);}return _0x38cb1c;};}function handleError(_0x492e3b,_0x2d3421){_0x2d3421=_0x2d3421||0x1f4;return function(_0x57b4a0){logger[_0xb7e7('0x2e')](_0x57b4a0['stack']);if(_0x57b4a0['name']){delete _0x57b4a0[_0xb7e7('0x2f')];}_0x492e3b[_0xb7e7('0x1c')](_0x2d3421)[_0xb7e7('0x30')](_0x57b4a0);};}exports['index']=function(_0x159c16,_0x3da92a){var _0x250362={},_0x3ef988={},_0x16941d={'count':0x0,'rows':[]};var _0x472f64=_[_0xb7e7('0x31')](db[_0xb7e7('0x32')][_0xb7e7('0x33')],function(_0x2f54d7){return{'name':_0x2f54d7['fieldName'],'type':_0x2f54d7[_0xb7e7('0x34')][_0xb7e7('0x35')]};});_0x3ef988[_0xb7e7('0x36')]=_[_0xb7e7('0x31')](_0x472f64,'name');_0x3ef988[_0xb7e7('0x37')]=_['keys'](_0x159c16[_0xb7e7('0x37')]);_0x3ef988[_0xb7e7('0x38')]=_[_0xb7e7('0x39')](_0x3ef988[_0xb7e7('0x36')],_0x3ef988[_0xb7e7('0x37')]);_0x250362[_0xb7e7('0x3a')]=_[_0xb7e7('0x39')](_0x3ef988[_0xb7e7('0x36')],qs[_0xb7e7('0x3b')](_0x159c16[_0xb7e7('0x37')][_0xb7e7('0x3b')]));_0x250362[_0xb7e7('0x3a')]=_0x250362['attributes']['length']?_0x250362[_0xb7e7('0x3a')]:_0x3ef988[_0xb7e7('0x36')];if(!_0x159c16[_0xb7e7('0x37')][_0xb7e7('0x3c')](_0xb7e7('0x3d'))){_0x250362['limit']=qs[_0xb7e7('0x21')](_0x159c16[_0xb7e7('0x37')]['limit']);_0x250362[_0xb7e7('0x1f')]=qs['offset'](_0x159c16[_0xb7e7('0x37')][_0xb7e7('0x1f')]);}_0x250362[_0xb7e7('0x3e')]=qs[_0xb7e7('0x3f')](_0x159c16[_0xb7e7('0x37')]['sort']);_0x250362[_0xb7e7('0x40')]=qs[_0xb7e7('0x38')](_[_0xb7e7('0x41')](_0x159c16[_0xb7e7('0x37')],_0x3ef988[_0xb7e7('0x38')]),_0x472f64);if(_0x159c16[_0xb7e7('0x37')][_0xb7e7('0x42')]){_0x250362[_0xb7e7('0x40')]=_[_0xb7e7('0x43')](_0x250362['where'],{'$or':_[_0xb7e7('0x31')](_0x472f64,function(_0x1e8c9d){if(_0x1e8c9d[_0xb7e7('0x34')]!==_0xb7e7('0x44')){var _0x5f55da={};_0x5f55da[_0x1e8c9d['name']]={'$like':'%'+_0x159c16[_0xb7e7('0x37')]['filter']+'%'};return _0x5f55da;}})});}_0x250362=_[_0xb7e7('0x43')]({},_0x250362,_0x159c16[_0xb7e7('0x45')]);var _0x2a74d9={'where':_0x250362[_0xb7e7('0x40')]};return db[_0xb7e7('0x32')][_0xb7e7('0x22')](_0x2a74d9)[_0xb7e7('0x29')](function(_0x10b36b){_0x16941d[_0xb7e7('0x22')]=_0x10b36b;if(_0x159c16[_0xb7e7('0x37')][_0xb7e7('0x46')]){_0x250362[_0xb7e7('0x47')]=[{'all':!![]}];}return db[_0xb7e7('0x32')]['findAll'](_0x250362);})['then'](function(_0x35942e){_0x16941d[_0xb7e7('0x48')]=_0x35942e;return _0x16941d;})[_0xb7e7('0x29')](respondWithFilteredResult(_0x3da92a,_0x250362))[_0xb7e7('0x49')](handleError(_0x3da92a,null));};exports[_0xb7e7('0x4a')]=function(_0x427f01,_0x2f045b){var _0x1ed478={'raw':!![],'where':{'id':_0x427f01[_0xb7e7('0x4b')]['id']}},_0x25e082={};_0x25e082[_0xb7e7('0x36')]=_['keys'](db[_0xb7e7('0x32')][_0xb7e7('0x33')]);_0x25e082[_0xb7e7('0x37')]=_['keys'](_0x427f01[_0xb7e7('0x37')]);_0x25e082[_0xb7e7('0x38')]=_[_0xb7e7('0x39')](_0x25e082['model'],_0x25e082['query']);_0x1ed478[_0xb7e7('0x3a')]=_[_0xb7e7('0x39')](_0x25e082[_0xb7e7('0x36')],qs['fields'](_0x427f01['query'][_0xb7e7('0x3b')]));_0x1ed478[_0xb7e7('0x3a')]=_0x1ed478[_0xb7e7('0x3a')][_0xb7e7('0x4c')]?_0x1ed478['attributes']:_0x25e082[_0xb7e7('0x36')];if(_0x427f01[_0xb7e7('0x37')][_0xb7e7('0x46')]){_0x1ed478['include']=[{'all':!![]}];}_0x1ed478=_[_0xb7e7('0x43')]({},_0x1ed478,_0x427f01[_0xb7e7('0x45')]);return db[_0xb7e7('0x32')]['find'](_0x1ed478)['then'](handleEntityNotFound(_0x2f045b,null))[_0xb7e7('0x29')](respondWithResult(_0x2f045b,null))[_0xb7e7('0x49')](handleError(_0x2f045b,null));};exports[_0xb7e7('0x4d')]=function(_0x5713b3,_0x492701){return db[_0xb7e7('0x32')][_0xb7e7('0x4d')](_0x5713b3[_0xb7e7('0x4e')],{})[_0xb7e7('0x29')](function(_0x3388d8){var _0x2386cf=_0x5713b3[_0xb7e7('0x4f')][_0xb7e7('0x2a')]({'plain':!![]});if(!_0x2386cf)throw new Error(_0xb7e7('0x50'));if(_0x2386cf['role']===_0xb7e7('0x4f')){var _0x108b99=_0x3388d8['get']({'plain':!![]});var _0xa8186e=_0xb7e7('0x2b');return db[_0xb7e7('0x51')]['find']({'where':{'name':_0xa8186e,'userProfileId':_0x2386cf[_0xb7e7('0x52')]},'raw':!![]})[_0xb7e7('0x29')](function(_0x3011b0){if(_0x3011b0&&_0x3011b0[_0xb7e7('0x53')]===0x0){return db['UserProfileResource'][_0xb7e7('0x4d')]({'name':_0x108b99['name'],'resourceId':_0x108b99['id'],'type':_0x3011b0[_0xb7e7('0x2f')],'sectionId':_0x3011b0['id']},{})[_0xb7e7('0x29')](function(){return _0x3388d8;});}else{return _0x3388d8;}})[_0xb7e7('0x49')](function(_0x3a9042){logger[_0xb7e7('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a9042);throw _0x3a9042;});}return _0x3388d8;})[_0xb7e7('0x29')](respondWithResult(_0x492701,0xc9))[_0xb7e7('0x49')](handleError(_0x492701,null));};exports[_0xb7e7('0x28')]=function(_0x22d746,_0x4f6581){if(_0x22d746['body']['id']){delete _0x22d746[_0xb7e7('0x4e')]['id'];}return db['Pause'][_0xb7e7('0x54')]({'where':{'id':_0x22d746[_0xb7e7('0x4b')]['id']}})[_0xb7e7('0x29')](handleEntityNotFound(_0x4f6581,null))[_0xb7e7('0x29')](saveUpdates(_0x22d746[_0xb7e7('0x4e')],null))['then'](respondWithResult(_0x4f6581,null))[_0xb7e7('0x49')](handleError(_0x4f6581,null));};exports[_0xb7e7('0x55')]=function(_0x4fea1e,_0x3d49e2){return db[_0xb7e7('0x32')][_0xb7e7('0x54')]({'where':{'id':_0x4fea1e['params']['id']}})[_0xb7e7('0x29')](handleEntityNotFound(_0x3d49e2,null))[_0xb7e7('0x29')](removeEntity(_0x3d49e2,null))[_0xb7e7('0x49')](handleError(_0x3d49e2,null));}; \ No newline at end of file +var _0x1af2=['params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','error','send','index','Pause','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','include','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x102654,_0x347919){var _0x2200e3=function(_0x592a93){while(--_0x592a93){_0x102654['push'](_0x102654['shift']());}};_0x2200e3(++_0x347919);}(_0x1af2,0x1f3));var _0x21af=function(_0x27e2c8,_0x5f40a0){_0x27e2c8=_0x27e2c8-0x0;var _0x5454d4=_0x1af2[_0x27e2c8];return _0x5454d4;};'use strict';var emlformat=require(_0x21af('0x0'));var rimraf=require(_0x21af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21af('0x2'));var rp=require(_0x21af('0x3'));var moment=require(_0x21af('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x21af('0x5'));var util=require(_0x21af('0x6'));var path=require(_0x21af('0x7'));var sox=require(_0x21af('0x8'));var csv=require(_0x21af('0x9'));var ejs=require(_0x21af('0xa'));var fs=require('fs');var fs_extra=require(_0x21af('0xb'));var _=require(_0x21af('0xc'));var squel=require(_0x21af('0xd'));var crypto=require('crypto');var jsforce=require(_0x21af('0xe'));var deskjs=require(_0x21af('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21af('0x10'));var Redis=require(_0x21af('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x21af('0x12'));var as=require(_0x21af('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21af('0x14'))(_0x21af('0x15'));var utils=require('../../config/utils');var config=require(_0x21af('0x16'));var licenseUtil=require(_0x21af('0x17'));var db=require(_0x21af('0x18'))['db'];function respondWithStatusCode(_0x4aa8c6,_0x11b649){_0x11b649=_0x11b649||0xcc;return function(_0x35b79e){if(_0x35b79e){return _0x4aa8c6[_0x21af('0x19')](_0x11b649);}return _0x4aa8c6['status'](_0x11b649)[_0x21af('0x1a')]();};}function respondWithResult(_0x405fdf,_0x23b832){_0x23b832=_0x23b832||0xc8;return function(_0x4ebabf){if(_0x4ebabf){return _0x405fdf[_0x21af('0x1b')](_0x23b832)[_0x21af('0x1c')](_0x4ebabf);}};}function respondWithFilteredResult(_0x37c22c,_0x1c8b58){return function(_0x3092f8){if(_0x3092f8){var _0x10448b=typeof _0x1c8b58[_0x21af('0x1d')]===_0x21af('0x1e')&&typeof _0x1c8b58[_0x21af('0x1f')]===_0x21af('0x1e');var _0x3e096d=_0x3092f8[_0x21af('0x20')];var _0x5aea2e=_0x10448b?0x0:_0x1c8b58[_0x21af('0x1d')];var _0x3ac386=_0x10448b?_0x3092f8['count']:_0x1c8b58['offset']+_0x1c8b58['limit'];var _0x599762;if(_0x3ac386>=_0x3e096d){_0x3ac386=_0x3e096d;_0x599762=0xc8;}else{_0x599762=0xce;}_0x37c22c[_0x21af('0x1b')](_0x599762);return _0x37c22c[_0x21af('0x21')](_0x21af('0x22'),_0x5aea2e+'-'+_0x3ac386+'/'+_0x3e096d)[_0x21af('0x1c')](_0x3092f8);}return null;};}function patchUpdates(_0x2ff918){return function(_0xcc2704){try{jsonpatch[_0x21af('0x23')](_0xcc2704,_0x2ff918,!![]);}catch(_0x3db7cd){return BPromise[_0x21af('0x24')](_0x3db7cd);}return _0xcc2704[_0x21af('0x25')]();};}function saveUpdates(_0x2f92ea,_0x527940){return function(_0x351765){if(_0x351765){return _0x351765[_0x21af('0x26')](_0x2f92ea)[_0x21af('0x27')](function(_0x8fde81){return _0x8fde81;});}return null;};}function removeEntity(_0x38480d,_0x15298c){return function(_0x107ee2){if(_0x107ee2){return _0x107ee2[_0x21af('0x28')]()[_0x21af('0x27')](function(){var _0xf429bc=_0x107ee2['get']({'plain':!![]});var _0x2058ae=_0x21af('0x29');return db[_0x21af('0x2a')][_0x21af('0x28')]({'where':{'type':_0x2058ae,'resourceId':_0xf429bc['id']}})['then'](function(){return _0x107ee2;});})[_0x21af('0x27')](function(){_0x38480d[_0x21af('0x1b')](0xcc)[_0x21af('0x1a')]();});}};}function handleEntityNotFound(_0x59c28e,_0x494293){return function(_0x37bf77){if(!_0x37bf77){_0x59c28e['sendStatus'](0x194);}return _0x37bf77;};}function handleError(_0x5e32d5,_0x19d685){_0x19d685=_0x19d685||0x1f4;return function(_0x2966d5){logger[_0x21af('0x2b')](_0x2966d5['stack']);if(_0x2966d5['name']){delete _0x2966d5['name'];}_0x5e32d5[_0x21af('0x1b')](_0x19d685)[_0x21af('0x2c')](_0x2966d5);};}exports[_0x21af('0x2d')]=function(_0x212036,_0x55628d){var _0x198bf4={},_0x24861f={},_0x44dbf2={'count':0x0,'rows':[]};var _0xd597b4=_['map'](db[_0x21af('0x2e')][_0x21af('0x2f')],function(_0x1e1ad9){return{'name':_0x1e1ad9['fieldName'],'type':_0x1e1ad9[_0x21af('0x30')][_0x21af('0x31')]};});_0x24861f[_0x21af('0x32')]=_[_0x21af('0x33')](_0xd597b4,_0x21af('0x34'));_0x24861f[_0x21af('0x35')]=_[_0x21af('0x36')](_0x212036['query']);_0x24861f[_0x21af('0x37')]=_[_0x21af('0x38')](_0x24861f[_0x21af('0x32')],_0x24861f['query']);_0x198bf4[_0x21af('0x39')]=_[_0x21af('0x38')](_0x24861f[_0x21af('0x32')],qs['fields'](_0x212036[_0x21af('0x35')][_0x21af('0x3a')]));_0x198bf4[_0x21af('0x39')]=_0x198bf4[_0x21af('0x39')][_0x21af('0x3b')]?_0x198bf4[_0x21af('0x39')]:_0x24861f[_0x21af('0x32')];if(!_0x212036[_0x21af('0x35')][_0x21af('0x3c')](_0x21af('0x3d'))){_0x198bf4[_0x21af('0x1f')]=qs[_0x21af('0x1f')](_0x212036['query'][_0x21af('0x1f')]);_0x198bf4[_0x21af('0x1d')]=qs[_0x21af('0x1d')](_0x212036['query'][_0x21af('0x1d')]);}_0x198bf4[_0x21af('0x3e')]=qs[_0x21af('0x3f')](_0x212036[_0x21af('0x35')][_0x21af('0x3f')]);_0x198bf4[_0x21af('0x40')]=qs[_0x21af('0x37')](_[_0x21af('0x41')](_0x212036['query'],_0x24861f[_0x21af('0x37')]),_0xd597b4);if(_0x212036[_0x21af('0x35')][_0x21af('0x42')]){_0x198bf4[_0x21af('0x40')]=_[_0x21af('0x43')](_0x198bf4['where'],{'$or':_[_0x21af('0x33')](_0xd597b4,function(_0xce9a92){if(_0xce9a92[_0x21af('0x30')]!=='VIRTUAL'){var _0x561e12={};_0x561e12[_0xce9a92[_0x21af('0x34')]]={'$like':'%'+_0x212036['query'][_0x21af('0x42')]+'%'};return _0x561e12;}})});}_0x198bf4=_[_0x21af('0x43')]({},_0x198bf4,_0x212036[_0x21af('0x44')]);var _0x2d9eb={'where':_0x198bf4[_0x21af('0x40')]};return db[_0x21af('0x2e')][_0x21af('0x20')](_0x2d9eb)[_0x21af('0x27')](function(_0xc627f0){_0x44dbf2[_0x21af('0x20')]=_0xc627f0;if(_0x212036[_0x21af('0x35')][_0x21af('0x45')]){_0x198bf4['include']=[{'all':!![]}];}return db[_0x21af('0x2e')]['findAll'](_0x198bf4);})[_0x21af('0x27')](function(_0x5a037c){_0x44dbf2['rows']=_0x5a037c;return _0x44dbf2;})[_0x21af('0x27')](respondWithFilteredResult(_0x55628d,_0x198bf4))[_0x21af('0x46')](handleError(_0x55628d,null));};exports['show']=function(_0x4e196c,_0x3b5b06){var _0x538270={'raw':!![],'where':{'id':_0x4e196c['params']['id']}},_0x12b859={};_0x12b859[_0x21af('0x32')]=_[_0x21af('0x36')](db[_0x21af('0x2e')][_0x21af('0x2f')]);_0x12b859[_0x21af('0x35')]=_[_0x21af('0x36')](_0x4e196c['query']);_0x12b859['filters']=_[_0x21af('0x38')](_0x12b859[_0x21af('0x32')],_0x12b859[_0x21af('0x35')]);_0x538270[_0x21af('0x39')]=_[_0x21af('0x38')](_0x12b859[_0x21af('0x32')],qs[_0x21af('0x3a')](_0x4e196c[_0x21af('0x35')]['fields']));_0x538270[_0x21af('0x39')]=_0x538270[_0x21af('0x39')][_0x21af('0x3b')]?_0x538270[_0x21af('0x39')]:_0x12b859[_0x21af('0x32')];if(_0x4e196c[_0x21af('0x35')][_0x21af('0x45')]){_0x538270[_0x21af('0x47')]=[{'all':!![]}];}_0x538270=_[_0x21af('0x43')]({},_0x538270,_0x4e196c[_0x21af('0x44')]);return db[_0x21af('0x2e')][_0x21af('0x48')](_0x538270)['then'](handleEntityNotFound(_0x3b5b06,null))[_0x21af('0x27')](respondWithResult(_0x3b5b06,null))['catch'](handleError(_0x3b5b06,null));};exports['create']=function(_0x466fee,_0x2f17ef){return db[_0x21af('0x2e')]['create'](_0x466fee[_0x21af('0x49')],{})[_0x21af('0x27')](function(_0x383ff3){var _0x48901d=_0x466fee[_0x21af('0x4a')][_0x21af('0x4b')]({'plain':!![]});if(!_0x48901d)throw new Error(_0x21af('0x4c'));if(_0x48901d[_0x21af('0x4d')]===_0x21af('0x4a')){var _0x518b1f=_0x383ff3[_0x21af('0x4b')]({'plain':!![]});var _0x182284=_0x21af('0x29');return db['UserProfileSection'][_0x21af('0x48')]({'where':{'name':_0x182284,'userProfileId':_0x48901d[_0x21af('0x4e')]},'raw':!![]})[_0x21af('0x27')](function(_0x40de5d){if(_0x40de5d&&_0x40de5d[_0x21af('0x4f')]===0x0){return db[_0x21af('0x2a')][_0x21af('0x50')]({'name':_0x518b1f[_0x21af('0x34')],'resourceId':_0x518b1f['id'],'type':_0x40de5d['name'],'sectionId':_0x40de5d['id']},{})[_0x21af('0x27')](function(){return _0x383ff3;});}else{return _0x383ff3;}})[_0x21af('0x46')](function(_0x361a75){logger[_0x21af('0x2b')](_0x21af('0x51'),_0x361a75);throw _0x361a75;});}return _0x383ff3;})[_0x21af('0x27')](respondWithResult(_0x2f17ef,0xc9))[_0x21af('0x46')](handleError(_0x2f17ef,null));};exports['update']=function(_0x228dba,_0xa318bc){if(_0x228dba[_0x21af('0x49')]['id']){delete _0x228dba[_0x21af('0x49')]['id'];}return db[_0x21af('0x2e')][_0x21af('0x48')]({'where':{'id':_0x228dba[_0x21af('0x52')]['id']}})[_0x21af('0x27')](handleEntityNotFound(_0xa318bc,null))[_0x21af('0x27')](saveUpdates(_0x228dba[_0x21af('0x49')],null))[_0x21af('0x27')](respondWithResult(_0xa318bc,null))['catch'](handleError(_0xa318bc,null));};exports['destroy']=function(_0x483308,_0x8f5584){return db[_0x21af('0x2e')][_0x21af('0x48')]({'where':{'id':_0x483308[_0x21af('0x52')]['id']}})[_0x21af('0x27')](handleEntityNotFound(_0x8f5584,null))[_0x21af('0x27')](removeEntity(_0x8f5584,null))[_0x21af('0x46')](handleError(_0x8f5584,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2137e55..f8909af 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 _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x702ee,_0x355c47){var _0x367bb0=function(_0x46766a){while(--_0x46766a){_0x702ee['push'](_0x702ee['shift']());}};_0x367bb0(++_0x355c47);}(_0x1cb9,0x14e));var _0x91cb=function(_0x573899,_0x34997c){_0x573899=_0x573899-0x0;var _0x2891e7=_0x1cb9[_0x573899];return _0x2891e7;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x523cdf,_0x495050){var _0x3586f2=function(_0x44ee04){while(--_0x44ee04){_0x523cdf['push'](_0x523cdf['shift']());}};_0x3586f2(++_0x495050);}(_0x8ef6,0xf2));var _0x68ef=function(_0x28b418,_0x5b6e08){_0x28b418=_0x28b418-0x0;var _0x47b036=_0x8ef6[_0x28b418];return _0x47b036;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 b68521b..4e35e48 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(_0x5c2d99,_0x2f4366){var _0x291d64=function(_0x3a362d){while(--_0x3a362d){_0x5c2d99['push'](_0x5c2d99['shift']());}};_0x291d64(++_0x2f4366);}(_0xb10b,0x12a));var _0xbb10=function(_0x5244bc,_0xbeed11){_0x5244bc=_0x5244bc-0x0;var _0x3ae51c=_0xb10b[_0x5244bc];return _0x3ae51c;};'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(_0x4074bb,_0x2f03ee){var _0x24c6b2=function(_0x1a0ee5){while(--_0x1a0ee5){_0x4074bb['push'](_0x4074bb['shift']());}};_0x24c6b2(++_0x2f03ee);}(_0x7a54,0x106));var _0x47a5=function(_0x4ad1b5,_0x3d7abd){_0x4ad1b5=_0x4ad1b5-0x0;var _0x56e765=_0x7a54[_0x4ad1b5];return _0x56e765;};'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 e8db4f5..f7080f0 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 _0xac31=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','single','file','upload','put','update','delete','exports','multer','util'];(function(_0x4b5de2,_0x3a68af){var _0x55e5d0=function(_0x4098fb){while(--_0x4098fb){_0x4b5de2['push'](_0x4b5de2['shift']());}};_0x55e5d0(++_0x3a68af);}(_0xac31,0xca));var _0x1ac3=function(_0x284355,_0x1ad8d0){_0x284355=_0x284355-0x0;var _0x4933ed=_0xac31[_0x284355];return _0x4933ed;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./plugin.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0xb')](_0x1ac3('0x10'),auth['isAuthenticated'](),controller[_0x1ac3('0x11')]);var upload=multer({'storage':multer[_0x1ac3('0x12')]({'destination':function(_0x3e835b,_0x24f0d2,_0x2a8dc7){_0x2a8dc7(null,path[_0x1ac3('0x13')](config['root'],_0x1ac3('0x14')));},'filename':function(_0x376814,_0x2eeabf,_0x2338b9){_0x2eeabf['originalname']=_0x2eeabf[_0x1ac3('0x15')][_0x1ac3('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2338b9(null,util[_0x1ac3('0x17')](_0x1ac3('0x18'),path['basename'](_0x2eeabf[_0x1ac3('0x15')],path[_0x1ac3('0x19')](_0x2eeabf['originalname'])),Date[_0x1ac3('0x1a')](),path[_0x1ac3('0x19')](_0x2eeabf[_0x1ac3('0x15')])));}})});router['post']('/',upload[_0x1ac3('0x1b')](_0x1ac3('0x1c')),controller[_0x1ac3('0x1d')]);router['post'](_0x1ac3('0xc'),controller['webhookPost']);router[_0x1ac3('0x1e')](_0x1ac3('0xe'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x1f')]);router[_0x1ac3('0x20')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x20')]);module[_0x1ac3('0x21')]=router; \ No newline at end of file +var _0x0bde=['originalname','replace','format','%s-%s%s','basename','extname','post','single','file','upload','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','server/files/plugins'];(function(_0x5ed135,_0x399a49){var _0x2df1bc=function(_0xa2470){while(--_0xa2470){_0x5ed135['push'](_0x5ed135['shift']());}};_0x2df1bc(++_0x399a49);}(_0x0bde,0xe7));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xe0bd('0x0'));var path=require('path');var timeout=require(_0xe0bd('0x1'));var express=require(_0xe0bd('0x2'));var router=express[_0xe0bd('0x3')]();var fs_extra=require(_0xe0bd('0x4'));var auth=require(_0xe0bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe0bd('0x6'));var controller=require(_0xe0bd('0x7'));router[_0xe0bd('0x8')]('/',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xa')]);router[_0xe0bd('0x8')](_0xe0bd('0xb'),controller['webhookGet']);router[_0xe0bd('0x8')](_0xe0bd('0xc'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xd')]);router[_0xe0bd('0x8')](_0xe0bd('0xe'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x595dac,_0x47f96d,_0x44ffa9){_0x44ffa9(null,path['join'](config['root'],_0xe0bd('0x10')));},'filename':function(_0x415093,_0x54d40e,_0xc492b4){_0x54d40e['originalname']=_0x54d40e[_0xe0bd('0x11')][_0xe0bd('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xc492b4(null,util[_0xe0bd('0x13')](_0xe0bd('0x14'),path[_0xe0bd('0x15')](_0x54d40e[_0xe0bd('0x11')],path[_0xe0bd('0x16')](_0x54d40e[_0xe0bd('0x11')])),Date['now'](),path['extname'](_0x54d40e['originalname'])));}})});router[_0xe0bd('0x17')]('/',upload[_0xe0bd('0x18')](_0xe0bd('0x19')),controller[_0xe0bd('0x1a')]);router[_0xe0bd('0x17')]('/webhook',controller['webhookPost']);router[_0xe0bd('0x1b')]('/:id',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0x1c')]);router[_0xe0bd('0x1d')](_0xe0bd('0xc'),auth['isAuthenticated'](),controller[_0xe0bd('0x1d')]);module[_0xe0bd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index bad3004..7e5ee33 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 _0xef04=['STRING','sequelize','exports','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0xef04,0x16d));var _0x4ef0=function(_0x2a6291,_0x4a0fdf){_0x2a6291=_0x2a6291-0x0;var _0x2b4977=_0xef04[_0x2a6291];return _0x2b4977;};'use strict';var Sequelize=require(_0x4ef0('0x0'));module[_0x4ef0('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4ef0('0x2')]('html',_0x4ef0('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x4ef0('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x4ef0('0x5')},'active':{'type':Sequelize[_0x4ef0('0x6')],'defaultValue':0x0,'comment':_0x4ef0('0x7')},'sidebar':{'type':Sequelize[_0x4ef0('0x2')](_0x4ef0('0x8'),_0x4ef0('0x9'),_0x4ef0('0xa'),_0x4ef0('0xb')),'defaultValue':_0x4ef0('0xa'),'comment':_0x4ef0('0xc')},'icon':{'type':Sequelize[_0x4ef0('0xd')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4ef0('0xd')]},'scriptPath':{'type':Sequelize[_0x4ef0('0xd')]}}; \ No newline at end of file +var _0x1e55=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM'];(function(_0x3ec1a0,_0x2df235){var _0x12279e=function(_0x173fa4){while(--_0x173fa4){_0x3ec1a0['push'](_0x3ec1a0['shift']());}};_0x12279e(++_0x2df235);}(_0x1e55,0xce));var _0x51e5=function(_0x2f6f50,_0x33095e){_0x2f6f50=_0x2f6f50-0x0;var _0x225200=_0x1e55[_0x2f6f50];return _0x225200;};'use strict';var Sequelize=require(_0x51e5('0x0'));module[_0x51e5('0x1')]={'name':{'type':Sequelize[_0x51e5('0x2')]},'type':{'type':Sequelize[_0x51e5('0x3')](_0x51e5('0x4'),_0x51e5('0x5'))},'description':{'type':Sequelize[_0x51e5('0x6')]},'version':{'type':Sequelize[_0x51e5('0x6')]},'path':{'type':Sequelize[_0x51e5('0x2')],'comment':_0x51e5('0x7')},'active':{'type':Sequelize[_0x51e5('0x8')],'defaultValue':0x0,'comment':_0x51e5('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0x51e5('0xa'),_0x51e5('0xb'),_0x51e5('0xc'),_0x51e5('0xd')),'defaultValue':_0x51e5('0xc'),'comment':_0x51e5('0xe')},'icon':{'type':Sequelize[_0x51e5('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x51e5('0x2')]},'scriptName':{'type':Sequelize[_0x51e5('0x2')]},'scriptPath':{'type':Sequelize[_0x51e5('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index cad648f..71f3716 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 _0xe67e=['include','find','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','lstatSync','Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','Plugins','UserProfileResource','sendStatus','error','name','send','index','Plugin','rawAttributes','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','findAll','catch','show','params','fields','length','includeAll'];(function(_0x387edc,_0xcf96c2){var _0x343fec=function(_0x3bf289){while(--_0x3bf289){_0x387edc['push'](_0x387edc['shift']());}};_0x343fec(++_0xcf96c2);}(_0xe67e,0x10e));var _0xee67=function(_0x8b2bd4,_0x215f85){_0x8b2bd4=_0x8b2bd4-0x0;var _0xa74112=_0xe67e[_0x8b2bd4];return _0xa74112;};'use strict';var emlformat=require(_0xee67('0x0'));var rimraf=require(_0xee67('0x1'));var zipdir=require(_0xee67('0x2'));var jsonpatch=require(_0xee67('0x3'));var rp=require('request-promise');var moment=require(_0xee67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee67('0x5'));var util=require(_0xee67('0x6'));var path=require(_0xee67('0x7'));var sox=require(_0xee67('0x8'));var csv=require(_0xee67('0x9'));var ejs=require(_0xee67('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee67('0xb'));var squel=require(_0xee67('0xc'));var crypto=require(_0xee67('0xd'));var jsforce=require(_0xee67('0xe'));var deskjs=require(_0xee67('0xf'));var toCsv=require(_0xee67('0x9'));var querystring=require(_0xee67('0x10'));var Papa=require(_0xee67('0x11'));var extract=require(_0xee67('0x12'));var rimraf=require(_0xee67('0x1'));var archiver=require(_0xee67('0x13'));var Redis=require('ioredis');var authService=require(_0xee67('0x14'));var qs=require(_0xee67('0x15'));var as=require(_0xee67('0x16'));var hardwareService=require(_0xee67('0x17'));var logger=require(_0xee67('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xee67('0x19'));var licenseUtil=require(_0xee67('0x1a'));var db=require(_0xee67('0x1b'))['db'];config['redis']=_[_0xee67('0x1c')](config[_0xee67('0x1d')],{'host':_0xee67('0x1e'),'port':0x18eb});var socket=require(_0xee67('0x1f'))(new Redis(config['redis']));require('./plugin.socket')[_0xee67('0x20')](socket);function respondWithStatusCode(_0x2d8fd4,_0x1a5fd8){_0x1a5fd8=_0x1a5fd8||0xcc;return function(_0x72f7fc){if(_0x72f7fc){return _0x2d8fd4['sendStatus'](_0x1a5fd8);}return _0x2d8fd4[_0xee67('0x21')](_0x1a5fd8)[_0xee67('0x22')]();};}function respondWithResult(_0xe5125b,_0x95621b){_0x95621b=_0x95621b||0xc8;return function(_0x261c81){if(_0x261c81){return _0xe5125b[_0xee67('0x21')](_0x95621b)[_0xee67('0x23')](_0x261c81);}};}function respondWithFilteredResult(_0x46d410,_0x467d0a){return function(_0x1555b4){if(_0x1555b4){var _0x3821a9=typeof _0x467d0a[_0xee67('0x24')]==='undefined'&&typeof _0x467d0a['limit']===_0xee67('0x25');var _0x2908d6=_0x1555b4[_0xee67('0x26')];var _0x2c4834=_0x3821a9?0x0:_0x467d0a[_0xee67('0x24')];var _0xb05491=_0x3821a9?_0x1555b4[_0xee67('0x26')]:_0x467d0a['offset']+_0x467d0a[_0xee67('0x27')];var _0x15d487;if(_0xb05491>=_0x2908d6){_0xb05491=_0x2908d6;_0x15d487=0xc8;}else{_0x15d487=0xce;}_0x46d410['status'](_0x15d487);return _0x46d410[_0xee67('0x28')](_0xee67('0x29'),_0x2c4834+'-'+_0xb05491+'/'+_0x2908d6)['json'](_0x1555b4);}return null;};}function patchUpdates(_0x2f31ff){return function(_0x5add6c){try{jsonpatch[_0xee67('0x2a')](_0x5add6c,_0x2f31ff,!![]);}catch(_0xd0d89d){return BPromise[_0xee67('0x2b')](_0xd0d89d);}return _0x5add6c[_0xee67('0x2c')]();};}function saveUpdates(_0x39b501,_0x387674){return function(_0x5a0b9c){if(_0x5a0b9c){return _0x5a0b9c['update'](_0x39b501)[_0xee67('0x2d')](function(_0x49da1a){return _0x49da1a;});}return null;};}function removeEntity(_0x554f8c,_0x343411){return function(_0x14a625){if(_0x14a625){return _0x14a625[_0xee67('0x2e')]()[_0xee67('0x2d')](function(){var _0x38588a=_0x14a625['get']({'plain':!![]});var _0x50ea24=_0xee67('0x2f');return db[_0xee67('0x30')][_0xee67('0x2e')]({'where':{'type':_0x50ea24,'resourceId':_0x38588a['id']}})[_0xee67('0x2d')](function(){return _0x14a625;});})['then'](function(){_0x554f8c[_0xee67('0x21')](0xcc)[_0xee67('0x22')]();});}};}function handleEntityNotFound(_0x3f9981,_0x41fd98){return function(_0x37796b){if(!_0x37796b){_0x3f9981[_0xee67('0x31')](0x194);}return _0x37796b;};}function handleError(_0x5bd408,_0x1a9cfe){_0x1a9cfe=_0x1a9cfe||0x1f4;return function(_0x3340d0){logger[_0xee67('0x32')](_0x3340d0['stack']);if(_0x3340d0[_0xee67('0x33')]){delete _0x3340d0[_0xee67('0x33')];}_0x5bd408[_0xee67('0x21')](_0x1a9cfe)[_0xee67('0x34')](_0x3340d0);};}exports[_0xee67('0x35')]=function(_0x4c2511,_0xde1b89){var _0x3bcad8={},_0x411a07={},_0x150c61={'count':0x0,'rows':[]};var _0x44f317=_['map'](db[_0xee67('0x36')][_0xee67('0x37')],function(_0x508aaf){return{'name':_0x508aaf['fieldName'],'type':_0x508aaf['type']['key']};});_0x411a07[_0xee67('0x38')]=_['map'](_0x44f317,'name');_0x411a07[_0xee67('0x39')]=_[_0xee67('0x3a')](_0x4c2511[_0xee67('0x39')]);_0x411a07[_0xee67('0x3b')]=_[_0xee67('0x3c')](_0x411a07[_0xee67('0x38')],_0x411a07[_0xee67('0x39')]);_0x3bcad8[_0xee67('0x3d')]=_[_0xee67('0x3c')](_0x411a07[_0xee67('0x38')],qs['fields'](_0x4c2511[_0xee67('0x39')]['fields']));_0x3bcad8[_0xee67('0x3d')]=_0x3bcad8[_0xee67('0x3d')]['length']?_0x3bcad8[_0xee67('0x3d')]:_0x411a07[_0xee67('0x38')];if(!_0x4c2511[_0xee67('0x39')]['hasOwnProperty'](_0xee67('0x3e'))){_0x3bcad8[_0xee67('0x27')]=qs['limit'](_0x4c2511[_0xee67('0x39')][_0xee67('0x27')]);_0x3bcad8[_0xee67('0x24')]=qs[_0xee67('0x24')](_0x4c2511[_0xee67('0x39')][_0xee67('0x24')]);}_0x3bcad8[_0xee67('0x3f')]=qs[_0xee67('0x40')](_0x4c2511['query']['sort']);_0x3bcad8[_0xee67('0x41')]=qs['filters'](_[_0xee67('0x42')](_0x4c2511[_0xee67('0x39')],_0x411a07[_0xee67('0x3b')]),_0x44f317);if(_0x4c2511['query'][_0xee67('0x43')]){_0x3bcad8[_0xee67('0x41')]=_[_0xee67('0x44')](_0x3bcad8[_0xee67('0x41')],{'$or':_[_0xee67('0x45')](_0x44f317,function(_0x3e9911){if(_0x3e9911[_0xee67('0x46')]!==_0xee67('0x47')){var _0x55e932={};_0x55e932[_0x3e9911[_0xee67('0x33')]]={'$like':'%'+_0x4c2511[_0xee67('0x39')][_0xee67('0x43')]+'%'};return _0x55e932;}})});}_0x3bcad8=_[_0xee67('0x44')]({},_0x3bcad8,_0x4c2511[_0xee67('0x48')]);var _0x125d4e={'where':_0x3bcad8['where']};return db[_0xee67('0x36')][_0xee67('0x26')](_0x125d4e)[_0xee67('0x2d')](function(_0x2962a5){_0x150c61[_0xee67('0x26')]=_0x2962a5;if(_0x4c2511['query']['includeAll']){_0x3bcad8['include']=[{'all':!![]}];}return db[_0xee67('0x36')][_0xee67('0x49')](_0x3bcad8);})[_0xee67('0x2d')](function(_0x578a10){_0x150c61['rows']=_0x578a10;return _0x150c61;})[_0xee67('0x2d')](respondWithFilteredResult(_0xde1b89,_0x3bcad8))[_0xee67('0x4a')](handleError(_0xde1b89,null));};exports[_0xee67('0x4b')]=function(_0x5965df,_0x1e0768){var _0xd8495b={'raw':!![],'where':{'id':_0x5965df[_0xee67('0x4c')]['id']}},_0x3f5310={};_0x3f5310[_0xee67('0x38')]=_['keys'](db[_0xee67('0x36')][_0xee67('0x37')]);_0x3f5310['query']=_[_0xee67('0x3a')](_0x5965df[_0xee67('0x39')]);_0x3f5310[_0xee67('0x3b')]=_[_0xee67('0x3c')](_0x3f5310[_0xee67('0x38')],_0x3f5310[_0xee67('0x39')]);_0xd8495b[_0xee67('0x3d')]=_['intersection'](_0x3f5310[_0xee67('0x38')],qs[_0xee67('0x4d')](_0x5965df[_0xee67('0x39')][_0xee67('0x4d')]));_0xd8495b[_0xee67('0x3d')]=_0xd8495b[_0xee67('0x3d')][_0xee67('0x4e')]?_0xd8495b[_0xee67('0x3d')]:_0x3f5310[_0xee67('0x38')];if(_0x5965df[_0xee67('0x39')][_0xee67('0x4f')]){_0xd8495b[_0xee67('0x50')]=[{'all':!![]}];}_0xd8495b=_[_0xee67('0x44')]({},_0xd8495b,_0x5965df[_0xee67('0x48')]);return db[_0xee67('0x36')][_0xee67('0x51')](_0xd8495b)[_0xee67('0x2d')](handleEntityNotFound(_0x1e0768,null))[_0xee67('0x2d')](respondWithResult(_0x1e0768,null))[_0xee67('0x4a')](handleError(_0x1e0768,null));};exports[_0xee67('0x52')]=function(_0x153ab3,_0x523d01,_0x3c8511){return db[_0xee67('0x36')][_0xee67('0x51')]({'where':{'id':_0x153ab3[_0xee67('0x4c')]['id']},'attributes':[_0xee67('0x33'),'path'],'raw':!![]})[_0xee67('0x2d')](handleEntityNotFound(_0x523d01,null))['then'](function(_0x1d6c30){if(_0x1d6c30){var _0x1af0de=path[_0xee67('0x53')](config[_0xee67('0x54')],_0xee67('0x55'),util[_0xee67('0x56')]('%s.zip',path[_0xee67('0x57')](_0x1d6c30[_0xee67('0x7')])));var _0x2238f5=fs[_0xee67('0x58')](_0x1af0de);var _0x1a0271=archiver(_0xee67('0x59'),{'zlib':{'level':0x9}});_0x1a0271['on'](_0xee67('0x5a'),function(_0x43286c){if(_0x43286c[_0xee67('0x5b')]===_0xee67('0x5c')){logger[_0xee67('0x32')](_0x43286c);}else{throw new db['Sequelize'][(_0xee67('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1a0271['on'](_0xee67('0x32'),function(_0x7bbb5f){throw new db[(_0xee67('0x5e'))]['Error'](_0xee67('0x5f'));});_0x1a0271[_0xee67('0x60')](_0x2238f5);_0x1a0271[_0xee67('0x61')](_0xee67('0x62'),{'cwd':path['join'](config[_0xee67('0x54')],_0xee67('0x55'),path[_0xee67('0x63')](_0x1d6c30[_0xee67('0x7')])),'ignore':[path[_0xee67('0x53')](path['basename'](_0x1d6c30[_0xee67('0x7')]),_0xee67('0x64')),path[_0xee67('0x53')](path[_0xee67('0x57')](_0x1d6c30[_0xee67('0x7')]),_0xee67('0x65'))],'nodir':!![]})['finalize']();_0x2238f5['on'](_0xee67('0x66'),function(){if(!fs[_0xee67('0x67')](_0x1af0de)){throw new db[(_0xee67('0x5e'))]['Error'](_0xee67('0x68'));}return _0x523d01['download'](_0x1af0de,util['format']('%s.zip',path['basename'](_0x1d6c30[_0xee67('0x7')])),function(_0x451553){if(_0x451553){throw new db['Sequelize'][(_0xee67('0x5d'))](_0xee67('0x69'));}fs[_0xee67('0x6a')](_0x1af0de);logger[_0xee67('0x6b')](_0xee67('0x6c'));logger['info'](_0xee67('0x6d'));});});}return null;})[_0xee67('0x4a')](handleError(_0x523d01,null));};exports[_0xee67('0x6e')]=function(_0x50fcbe,_0x4ef0d8,_0x42f89f){var _0x5407be=path['basename'](_0x50fcbe[_0xee67('0x6f')][_0xee67('0x70')],path[_0xee67('0x71')](_0x50fcbe[_0xee67('0x6f')][_0xee67('0x70')]));var _0x41300b=path['join'](config[_0xee67('0x54')],'server/files/plugins',_0x50fcbe[_0xee67('0x6f')][_0xee67('0x70')]);var _0x29e906=path[_0xee67('0x53')](config[_0xee67('0x54')],'server/files/plugins',_0x5407be);logger[_0xee67('0x6b')](_0xee67('0x72'),_0x41300b);logger[_0xee67('0x6b')]('Plugin\x20upload\x20destination:\x20%s',_0x29e906);try{fs[_0xee67('0x73')](_0x41300b,parseInt(_0xee67('0x74'),0x8));extract(_0x41300b,{'dir':_0x29e906},function(_0x34eda9){if(_0x34eda9){logger[_0xee67('0x32')](_0x34eda9);handleError(_0x34eda9,!![]);};var _0x273f4a=fs['readdirSync'](_0x29e906);if(_0x273f4a[_0xee67('0x4e')]>0x1){removeReferences(_0x41300b,_0x29e906);logger[_0xee67('0x32')]('Invalid\x20plugin\x20structure');return _0x42f89f(new Error('Invalid\x20plugin\x20structure'));}var _0x231ed9=fs[_0xee67('0x75')](path[_0xee67('0x53')](_0x29e906,_0x273f4a[0x0]));if(_0x231ed9['isFile']()){removeReferences(_0x41300b,_0x29e906);logger['error'](_0xee67('0x76'));return _0x42f89f(new Error(_0xee67('0x76')));}if(_0x231ed9[_0xee67('0x77')]()){var _0x32ef3c=fs[_0xee67('0x78')](path['join'](_0x29e906,_0x273f4a[0x0]));if(_0x32ef3c['length']===0x0){removeReferences(_0x41300b,_0x29e906);logger[_0xee67('0x32')](_0xee67('0x76'));return _0x42f89f(new Error('Invalid\x20plugin\x20structure'));}var _0x3f2dc8=_0x32ef3c[_0xee67('0x79')](function(_0x50cfca){return _0x50cfca===_0xee67('0x7a');});if(!_0x3f2dc8){return _0x42f89f(new Error(_0xee67('0x7b')));}var _0x5080ad=fs[_0xee67('0x7c')](path['join'](_0x29e906,_0x273f4a[0x0],_0xee67('0x7a')));var _0x54231=JSON['parse'](_0x5080ad);if(_0xee67('0x25')==typeof _0x54231[_0xee67('0x33')]){return _0x42f89f(new Error(_0xee67('0x7d')));}if(_0xee67('0x25')==typeof _0x54231['type']){return _0x42f89f(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x54231[_0xee67('0x7e')]){return _0x42f89f(new Error(_0xee67('0x7f')));}if(_0xee67('0x25')==typeof _0x54231[_0xee67('0x80')]){return _0x42f89f(new Error(_0xee67('0x81')));}if(_0x54231[_0xee67('0x46')]===_0xee67('0x82')){if('undefined'==typeof _0x54231[_0xee67('0x80')][_0xee67('0x83')]){return _0x42f89f(new Error(_0xee67('0x84')));}if(_0xee67('0x25')==typeof _0x54231[_0xee67('0x80')][_0xee67('0x83')][_0xee67('0x85')]&&_0xee67('0x25')==typeof _0x54231[_0xee67('0x80')][_0xee67('0x83')][_0xee67('0x86')]){return _0x42f89f(new Error(_0xee67('0x87')));}}else if(_0x54231['type']===_0xee67('0x88')){if(_0xee67('0x25')==typeof _0x54231[_0xee67('0x80')][_0xee67('0x89')]){return _0x42f89f(new Error(_0xee67('0x8a')));}if('undefined'==typeof _0x54231[_0xee67('0x80')][_0xee67('0x8b')]){return _0x42f89f(new Error(_0xee67('0x8c')));}}else{return _0x42f89f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x203e06=_0x54231[_0xee67('0x33')];var _0x458cee=_0x54231[_0xee67('0x8d')];var _0x4d308d=_0x54231[_0xee67('0x46')];var _0x2c8ec9=_0x54231[_0xee67('0x8e')]?_0x54231[_0xee67('0x8e')]:_0xee67('0x8f');var _0x456b98=_0x54231[_0xee67('0x90')]?_0x54231[_0xee67('0x90')]:'icon-apps';var _0x144a22='';var _0x35e4e0='';var _0x3c3e41='';var _0x373264='';var _0xf564e7=_0x54231[_0xee67('0x7e')];if(_0x4d308d===_0xee67('0x82')){if('undefined'!=typeof _0x54231[_0xee67('0x80')][_0xee67('0x83')]['admin']){var _0x5cb250=_0x54231[_0xee67('0x80')]['views'][_0xee67('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5cb250)){_0x144a22=path[_0xee67('0x53')](_0xee67('0x91'),_0x5407be,_0x273f4a[0x0],_0x5cb250);}else{_0x144a22=_0x5cb250;}}else{logger[_0xee67('0x6b')](_0xee67('0x92'));}if('undefined'!=typeof _0x54231[_0xee67('0x80')][_0xee67('0x83')][_0xee67('0x86')]){var _0x1dc316=_0x54231[_0xee67('0x80')][_0xee67('0x83')][_0xee67('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xee67('0x93')](_0x1dc316)){_0x35e4e0=path[_0xee67('0x53')]('plugins',_0x5407be,_0x273f4a[0x0],_0x1dc316);}else{_0x35e4e0=_0x1dc316;}}else{logger[_0xee67('0x6b')](_0xee67('0x94'));}}else if(_0x4d308d===_0xee67('0x88')){_0x3c3e41=_0x54231[_0xee67('0x80')][_0xee67('0x89')];_0x373264=_0x54231['parameters']['scriptPath'];if(_0xee67('0x25')!=typeof _0x54231['parameters'][_0xee67('0x83')]){if('undefined'!=typeof _0x54231[_0xee67('0x80')][_0xee67('0x83')][_0xee67('0x85')]){var _0x5cb250=_0x54231[_0xee67('0x80')][_0xee67('0x83')][_0xee67('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xee67('0x93')](_0x5cb250)){_0x144a22=path[_0xee67('0x53')](_0xee67('0x91'),_0x5407be,_0x273f4a[0x0],_0x5cb250);}else{_0x144a22=_0x5cb250;}}if(_0xee67('0x25')!=typeof _0x54231[_0xee67('0x80')][_0xee67('0x83')]['agent']){var _0x1dc316=_0x54231['parameters'][_0xee67('0x83')][_0xee67('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1dc316)){_0x35e4e0=path[_0xee67('0x53')](_0xee67('0x91'),_0x5407be,_0x273f4a[0x0],_0x1dc316);}else{_0x35e4e0=_0x1dc316;}}}}var _0x4642a3={'name':_0x203e06,'description':_0x458cee,'path':path[_0xee67('0x53')](_0x5407be,_0x273f4a[0x0]),'type':_0x4d308d,'sidebar':_0x2c8ec9,'icon':_0x456b98,'adminUrl':_0x144a22,'agentUrl':_0x35e4e0,'scriptName':_0x3c3e41,'scriptPath':_0x373264,'version':_0xf564e7};removeReferences(_0x41300b,null);return db[_0xee67('0x36')][_0xee67('0x95')](_0x4642a3)[_0xee67('0x2d')](function(_0x466c07){var _0x373b3c={'role':_0x50fcbe[_0xee67('0x96')][_0xee67('0x97')],'userProfileId':_0x50fcbe['body'][_0xee67('0x98')]};if(!_0x373b3c)throw new Error(_0xee67('0x99'));if(_0x373b3c[_0xee67('0x97')]===_0xee67('0x9a')){var _0x3fd82e=_0x466c07['get']({'plain':!![]});return db[_0xee67('0x9b')][_0xee67('0x51')]({'where':{'name':_0xee67('0x2f'),'userProfileId':_0x373b3c[_0xee67('0x98')]},'raw':!![]})[_0xee67('0x2d')](function(_0x35e306){if(_0x35e306&&_0x35e306[_0xee67('0x9c')]===0x0){return db[_0xee67('0x30')]['create']({'name':_0x3fd82e['name'],'resourceId':_0x3fd82e['id'],'type':_0x35e306['name'],'sectionId':_0x35e306['id']},{})[_0xee67('0x2d')](function(){return _0x466c07;});}else{return _0x466c07;}})[_0xee67('0x4a')](function(_0x4f77c1){logger[_0xee67('0x32')](_0xee67('0x9d'),_0x4f77c1);throw _0x4f77c1;});}return _0x466c07;})[_0xee67('0x2d')](respondWithResult(_0x4ef0d8,null))[_0xee67('0x4a')](handleError(_0x4ef0d8,null));}});}catch(_0x3981e4){_0x4ef0d8[_0xee67('0x21')](0x1f4)[_0xee67('0x34')](_0x3981e4);}};function removeReferences(_0xd02535,_0x308b00){try{if(_0xd02535){fs['unlinkSync'](_0xd02535);logger[_0xee67('0x6b')](_0xee67('0x9e'));}if(_0x308b00){rimraf(_0x308b00,function(){});logger[_0xee67('0x6b')](_0xee67('0x9f'));}}catch(_0x1d6970){logger[_0xee67('0x32')](_0x1d6970);}}exports[_0xee67('0xa0')]=function(_0x21ccdb,_0x580a4f,_0x2e448d){return db[_0xee67('0x36')][_0xee67('0x51')]({'where':{'id':_0x21ccdb[_0xee67('0x4c')]['id']}})[_0xee67('0x2d')](handleEntityNotFound(_0x580a4f,null))['then'](saveUpdates(_0x21ccdb[_0xee67('0x96')],null))['then'](respondWithResult(_0x580a4f,null))[_0xee67('0x4a')](handleError(_0x580a4f,null));};exports['delete']=function(_0x31dd46,_0x308b4c,_0x584611){return db[_0xee67('0x36')]['find']({'where':{'id':_0x31dd46[_0xee67('0x4c')]['id']}})[_0xee67('0x2d')](function(_0x1bc5d3){if(_0x1bc5d3){return _0x1bc5d3[_0xee67('0x2e')]();}})[_0xee67('0x2d')](function(_0xa0502b){rimraf(path[_0xee67('0x53')](config[_0xee67('0x54')],_0xee67('0x55'),path[_0xee67('0x63')](_0xa0502b['path'])),function(){});return _0xa0502b;})['then'](handleEntityNotFound(_0x308b4c,null))[_0xee67('0x2d')](respondWithStatusCode(_0x308b4c,null))['catch'](handleError(_0x308b4c,null));};exports[_0xee67('0xa1')]=function(_0x1e3fe7,_0x2dc604,_0x4576e1){return BPromise[_0xee67('0xa2')]()['then'](function(){if(!_0x1e3fe7[_0xee67('0x39')]['path']){throw new Error(_0xee67('0xa3'));}if(!_0x1e3fe7['query'][_0xee67('0xa4')]){throw new Error(_0xee67('0xa5'));}var _0x98d8ea=_0x1e3fe7[_0xee67('0x39')][_0xee67('0xa6')]?_0x1e3fe7['query'][_0xee67('0xa6')]+':'+_0x1e3fe7[_0xee67('0x39')][_0xee67('0xa4')]:_0xee67('0xa7')+_0x1e3fe7[_0xee67('0x39')][_0xee67('0xa4')];var _0x21bf1b=_0x1e3fe7['query'][_0xee67('0x23')]?_0x1e3fe7['query'][_0xee67('0x23')]:!![];var _0x5de14f=_0x1e3fe7[_0xee67('0x39')][_0xee67('0xa8')]?_0x1e3fe7[_0xee67('0x39')][_0xee67('0xa8')]:null;var _0x5b1ab5={'method':_0x1e3fe7['method'],'uri':util[_0xee67('0x56')](_0xee67('0xa9'),_0x98d8ea,_0x1e3fe7[_0xee67('0x39')][_0xee67('0x7')]),'json':_0x21bf1b,'resolveWithFullResponse':!![],'encoding':_0x5de14f,'qs':_0x1e3fe7[_0xee67('0x39')]};if(_0x1e3fe7[_0xee67('0xaa')]){_0x5b1ab5[_0xee67('0xaa')]=_0x1e3fe7[_0xee67('0xaa')];if(_0x5b1ab5[_0xee67('0xaa')]['content-length']){delete _0x5b1ab5[_0xee67('0xaa')][_0xee67('0xab')];}}if(_0x5b1ab5['headers'][_0xee67('0xac')]){delete _0x5b1ab5['headers'][_0xee67('0xac')];}return rp(_0x5b1ab5);})[_0xee67('0x2d')](function(_0x364e32){if(_0x364e32){_0x2dc604[_0xee67('0x28')](_0x364e32[_0xee67('0xaa')]);logger[_0xee67('0x6b')](_0x364e32[_0xee67('0x96')]);if(_[_0xee67('0xad')](_0x1e3fe7[_0xee67('0x39')]['path'],_0xee67('0x52'))&&_0x364e32[_0xee67('0xae')]==0x1f4){return _0x2dc604[_0xee67('0x31')](_0x364e32[_0xee67('0xae')]);}else{return _0x2dc604[_0xee67('0x21')](_0x364e32['statusCode'])[_0xee67('0x34')](_0x364e32['body']);}}else{return _0x2dc604[_0xee67('0x31')](0xc8);}})[_0xee67('0x4a')](handleError(_0x2dc604,null));};exports['webhookPost']=function(_0x2e5d5b,_0x29c881,_0x92f927){return BPromise[_0xee67('0xa2')]()[_0xee67('0x2d')](function(){if(!_0x2e5d5b[_0xee67('0x39')][_0xee67('0x7')]){throw new Error(_0xee67('0xa3'));}if(!_0x2e5d5b[_0xee67('0x39')][_0xee67('0xa4')]){throw new Error(_0xee67('0xa5'));}var _0x244cbd=_0x2e5d5b[_0xee67('0x39')][_0xee67('0xa6')]?_0x2e5d5b[_0xee67('0x39')][_0xee67('0xa6')]+':'+_0x2e5d5b[_0xee67('0x39')][_0xee67('0xa4')]:_0xee67('0xa7')+_0x2e5d5b['query'][_0xee67('0xa4')];var _0xd9c9d8=_0x2e5d5b[_0xee67('0x39')][_0xee67('0x23')]?_0x2e5d5b[_0xee67('0x39')][_0xee67('0x23')]:!![];var _0x1df193=_0x2e5d5b[_0xee67('0x39')][_0xee67('0xa8')]?_0x2e5d5b[_0xee67('0x39')][_0xee67('0xa8')]:null;var _0x34b175={'method':_0x2e5d5b['method'],'uri':util[_0xee67('0x56')](_0xee67('0xa9'),_0x244cbd,_0x2e5d5b[_0xee67('0x39')][_0xee67('0x7')]),'json':_0xd9c9d8,'resolveWithFullResponse':!![],'encoding':_0x1df193,'body':_0x2e5d5b[_0xee67('0x96')]};if(_0x2e5d5b[_0xee67('0xaa')]){_0x34b175[_0xee67('0xaa')]=_0x2e5d5b[_0xee67('0xaa')];if(_0x34b175['headers'][_0xee67('0xab')]){delete _0x34b175[_0xee67('0xaa')][_0xee67('0xab')];}}if(_0x34b175[_0xee67('0xaa')][_0xee67('0xac')]){delete _0x34b175[_0xee67('0xaa')][_0xee67('0xac')];}return rp(_0x34b175);})['then'](function(_0x3e2406){if(_0x3e2406){_0x29c881['set'](_0x3e2406['headers']);logger[_0xee67('0x6b')](_0x3e2406[_0xee67('0x96')]);return _0x29c881[_0xee67('0x21')](_0x3e2406['statusCode'])[_0xee67('0x34')](_0x3e2406[_0xee67('0x96')]);}else{return _0x29c881[_0xee67('0x31')](0xc8);}})[_0xee67('0x4a')](handleError(_0x29c881,null));}; \ No newline at end of file +var _0x44ed=['join','root','server/files/plugins','format','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','basename','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','update','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','status','end','json','limit','undefined','count','set','save','then','get','Plugins','UserProfileResource','destroy','sendStatus','error','stack','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','offset','order','sort','filters','pick','filter','where','merge','type','name','options','includeAll','include','rows','catch','show','params','find'];(function(_0x5b6092,_0x5563bd){var _0x3de6aa=function(_0x22732d){while(--_0x22732d){_0x5b6092['push'](_0x5b6092['shift']());}};_0x3de6aa(++_0x5563bd);}(_0x44ed,0x1ac));var _0xd44e=function(_0x305b86,_0x475f5a){_0x305b86=_0x305b86-0x0;var _0x2b0c9e=_0x44ed[_0x305b86];return _0x2b0c9e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd44e('0x0'));var jsonpatch=require(_0xd44e('0x1'));var rp=require(_0xd44e('0x2'));var moment=require(_0xd44e('0x3'));var BPromise=require(_0xd44e('0x4'));var Mustache=require(_0xd44e('0x5'));var util=require('util');var path=require(_0xd44e('0x6'));var sox=require(_0xd44e('0x7'));var csv=require(_0xd44e('0x8'));var ejs=require(_0xd44e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd44e('0xa'));var squel=require(_0xd44e('0xb'));var crypto=require(_0xd44e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd44e('0xd'));var toCsv=require(_0xd44e('0x8'));var querystring=require(_0xd44e('0xe'));var Papa=require(_0xd44e('0xf'));var extract=require(_0xd44e('0x10'));var rimraf=require(_0xd44e('0x11'));var archiver=require(_0xd44e('0x12'));var Redis=require(_0xd44e('0x13'));var authService=require(_0xd44e('0x14'));var qs=require(_0xd44e('0x15'));var as=require(_0xd44e('0x16'));var hardwareService=require(_0xd44e('0x17'));var logger=require('../../config/logger')(_0xd44e('0x18'));var utils=require(_0xd44e('0x19'));var config=require(_0xd44e('0x1a'));var licenseUtil=require(_0xd44e('0x1b'));var db=require(_0xd44e('0x1c'))['db'];config[_0xd44e('0x1d')]=_['defaults'](config[_0xd44e('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xd44e('0x1e'))(new Redis(config[_0xd44e('0x1d')]));require(_0xd44e('0x1f'))['register'](socket);function respondWithStatusCode(_0x415848,_0x469040){_0x469040=_0x469040||0xcc;return function(_0x55bfd2){if(_0x55bfd2){return _0x415848['sendStatus'](_0x469040);}return _0x415848[_0xd44e('0x20')](_0x469040)[_0xd44e('0x21')]();};}function respondWithResult(_0x26dcb3,_0x1290c1){_0x1290c1=_0x1290c1||0xc8;return function(_0x88afca){if(_0x88afca){return _0x26dcb3['status'](_0x1290c1)[_0xd44e('0x22')](_0x88afca);}};}function respondWithFilteredResult(_0xb0d84b,_0x4ec147){return function(_0xd59e14){if(_0xd59e14){var _0x1753d9=typeof _0x4ec147['offset']==='undefined'&&typeof _0x4ec147[_0xd44e('0x23')]===_0xd44e('0x24');var _0x1c0a29=_0xd59e14['count'];var _0x270bba=_0x1753d9?0x0:_0x4ec147['offset'];var _0x27a1c5=_0x1753d9?_0xd59e14[_0xd44e('0x25')]:_0x4ec147['offset']+_0x4ec147[_0xd44e('0x23')];var _0x17d19e;if(_0x27a1c5>=_0x1c0a29){_0x27a1c5=_0x1c0a29;_0x17d19e=0xc8;}else{_0x17d19e=0xce;}_0xb0d84b['status'](_0x17d19e);return _0xb0d84b[_0xd44e('0x26')]('Content-Range',_0x270bba+'-'+_0x27a1c5+'/'+_0x1c0a29)[_0xd44e('0x22')](_0xd59e14);}return null;};}function patchUpdates(_0x4651ce){return function(_0x5bec23){try{jsonpatch['apply'](_0x5bec23,_0x4651ce,!![]);}catch(_0x29bbd1){return BPromise['reject'](_0x29bbd1);}return _0x5bec23[_0xd44e('0x27')]();};}function saveUpdates(_0x5d6bc6,_0x2056b1){return function(_0x5c6473){if(_0x5c6473){return _0x5c6473['update'](_0x5d6bc6)['then'](function(_0x38562c){return _0x38562c;});}return null;};}function removeEntity(_0x56126b,_0x2f546d){return function(_0x5d2a2d){if(_0x5d2a2d){return _0x5d2a2d['destroy']()[_0xd44e('0x28')](function(){var _0x4782c2=_0x5d2a2d[_0xd44e('0x29')]({'plain':!![]});var _0x38566a=_0xd44e('0x2a');return db[_0xd44e('0x2b')][_0xd44e('0x2c')]({'where':{'type':_0x38566a,'resourceId':_0x4782c2['id']}})['then'](function(){return _0x5d2a2d;});})[_0xd44e('0x28')](function(){_0x56126b[_0xd44e('0x20')](0xcc)[_0xd44e('0x21')]();});}};}function handleEntityNotFound(_0x211fc0,_0x3e7452){return function(_0xeec7c6){if(!_0xeec7c6){_0x211fc0[_0xd44e('0x2d')](0x194);}return _0xeec7c6;};}function handleError(_0x74fa6f,_0x4a92be){_0x4a92be=_0x4a92be||0x1f4;return function(_0x18ff51){logger[_0xd44e('0x2e')](_0x18ff51[_0xd44e('0x2f')]);if(_0x18ff51['name']){delete _0x18ff51['name'];}_0x74fa6f['status'](_0x4a92be)['send'](_0x18ff51);};}exports[_0xd44e('0x30')]=function(_0x563272,_0x48898e){var _0x1e7c25={},_0x17dfa8={},_0x5b1133={'count':0x0,'rows':[]};var _0x44eb0d=_[_0xd44e('0x31')](db[_0xd44e('0x32')][_0xd44e('0x33')],function(_0x1a2c54){return{'name':_0x1a2c54[_0xd44e('0x34')],'type':_0x1a2c54['type'][_0xd44e('0x35')]};});_0x17dfa8[_0xd44e('0x36')]=_['map'](_0x44eb0d,'name');_0x17dfa8[_0xd44e('0x37')]=_[_0xd44e('0x38')](_0x563272[_0xd44e('0x37')]);_0x17dfa8['filters']=_[_0xd44e('0x39')](_0x17dfa8[_0xd44e('0x36')],_0x17dfa8[_0xd44e('0x37')]);_0x1e7c25[_0xd44e('0x3a')]=_[_0xd44e('0x39')](_0x17dfa8['model'],qs[_0xd44e('0x3b')](_0x563272[_0xd44e('0x37')][_0xd44e('0x3b')]));_0x1e7c25[_0xd44e('0x3a')]=_0x1e7c25[_0xd44e('0x3a')][_0xd44e('0x3c')]?_0x1e7c25[_0xd44e('0x3a')]:_0x17dfa8[_0xd44e('0x36')];if(!_0x563272[_0xd44e('0x37')]['hasOwnProperty']('nolimit')){_0x1e7c25[_0xd44e('0x23')]=qs['limit'](_0x563272[_0xd44e('0x37')]['limit']);_0x1e7c25['offset']=qs['offset'](_0x563272[_0xd44e('0x37')][_0xd44e('0x3d')]);}_0x1e7c25[_0xd44e('0x3e')]=qs[_0xd44e('0x3f')](_0x563272['query']['sort']);_0x1e7c25['where']=qs[_0xd44e('0x40')](_[_0xd44e('0x41')](_0x563272['query'],_0x17dfa8[_0xd44e('0x40')]),_0x44eb0d);if(_0x563272[_0xd44e('0x37')][_0xd44e('0x42')]){_0x1e7c25[_0xd44e('0x43')]=_[_0xd44e('0x44')](_0x1e7c25[_0xd44e('0x43')],{'$or':_[_0xd44e('0x31')](_0x44eb0d,function(_0x2195ec){if(_0x2195ec[_0xd44e('0x45')]!=='VIRTUAL'){var _0x5afa20={};_0x5afa20[_0x2195ec[_0xd44e('0x46')]]={'$like':'%'+_0x563272[_0xd44e('0x37')][_0xd44e('0x42')]+'%'};return _0x5afa20;}})});}_0x1e7c25=_['merge']({},_0x1e7c25,_0x563272[_0xd44e('0x47')]);var _0x31ecd8={'where':_0x1e7c25['where']};return db[_0xd44e('0x32')][_0xd44e('0x25')](_0x31ecd8)[_0xd44e('0x28')](function(_0x5311db){_0x5b1133[_0xd44e('0x25')]=_0x5311db;if(_0x563272[_0xd44e('0x37')][_0xd44e('0x48')]){_0x1e7c25[_0xd44e('0x49')]=[{'all':!![]}];}return db[_0xd44e('0x32')]['findAll'](_0x1e7c25);})['then'](function(_0xd2cf6){_0x5b1133[_0xd44e('0x4a')]=_0xd2cf6;return _0x5b1133;})['then'](respondWithFilteredResult(_0x48898e,_0x1e7c25))[_0xd44e('0x4b')](handleError(_0x48898e,null));};exports[_0xd44e('0x4c')]=function(_0x5a68dc,_0x5ebf31){var _0x59a59f={'raw':!![],'where':{'id':_0x5a68dc[_0xd44e('0x4d')]['id']}},_0x56ba69={};_0x56ba69[_0xd44e('0x36')]=_[_0xd44e('0x38')](db[_0xd44e('0x32')][_0xd44e('0x33')]);_0x56ba69[_0xd44e('0x37')]=_[_0xd44e('0x38')](_0x5a68dc[_0xd44e('0x37')]);_0x56ba69['filters']=_[_0xd44e('0x39')](_0x56ba69[_0xd44e('0x36')],_0x56ba69[_0xd44e('0x37')]);_0x59a59f['attributes']=_[_0xd44e('0x39')](_0x56ba69[_0xd44e('0x36')],qs[_0xd44e('0x3b')](_0x5a68dc[_0xd44e('0x37')][_0xd44e('0x3b')]));_0x59a59f['attributes']=_0x59a59f['attributes'][_0xd44e('0x3c')]?_0x59a59f['attributes']:_0x56ba69[_0xd44e('0x36')];if(_0x5a68dc[_0xd44e('0x37')]['includeAll']){_0x59a59f[_0xd44e('0x49')]=[{'all':!![]}];}_0x59a59f=_['merge']({},_0x59a59f,_0x5a68dc['options']);return db[_0xd44e('0x32')][_0xd44e('0x4e')](_0x59a59f)['then'](handleEntityNotFound(_0x5ebf31,null))[_0xd44e('0x28')](respondWithResult(_0x5ebf31,null))[_0xd44e('0x4b')](handleError(_0x5ebf31,null));};exports['download']=function(_0x59351e,_0x31b5e8,_0x30a968){return db['Plugin']['find']({'where':{'id':_0x59351e[_0xd44e('0x4d')]['id']},'attributes':[_0xd44e('0x46'),_0xd44e('0x6')],'raw':!![]})[_0xd44e('0x28')](handleEntityNotFound(_0x31b5e8,null))[_0xd44e('0x28')](function(_0x1098c1){if(_0x1098c1){var _0x46ca7e=path[_0xd44e('0x4f')](config[_0xd44e('0x50')],_0xd44e('0x51'),util[_0xd44e('0x52')]('%s.zip',path['basename'](_0x1098c1['path'])));var _0x308e22=fs[_0xd44e('0x53')](_0x46ca7e);var _0x1353f6=archiver(_0xd44e('0x54'),{'zlib':{'level':0x9}});_0x1353f6['on'](_0xd44e('0x55'),function(_0x4c70c8){if(_0x4c70c8[_0xd44e('0x56')]===_0xd44e('0x57')){logger[_0xd44e('0x2e')](_0x4c70c8);}else{throw new db[(_0xd44e('0x58'))][(_0xd44e('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1353f6['on'](_0xd44e('0x2e'),function(_0xb54e7b){throw new db['Sequelize']['Error'](_0xd44e('0x5a'));});_0x1353f6[_0xd44e('0x5b')](_0x308e22);_0x1353f6['glob'](_0xd44e('0x5c'),{'cwd':path[_0xd44e('0x4f')](config['root'],'server/files/plugins',path['dirname'](_0x1098c1[_0xd44e('0x6')])),'ignore':[path['join'](path[_0xd44e('0x5d')](_0x1098c1[_0xd44e('0x6')]),'node_modules/**/*'),path['join'](path[_0xd44e('0x5d')](_0x1098c1[_0xd44e('0x6')]),_0xd44e('0x5e'))],'nodir':!![]})['finalize']();_0x308e22['on'](_0xd44e('0x5f'),function(){if(!fs[_0xd44e('0x60')](_0x46ca7e)){throw new db[(_0xd44e('0x58'))][(_0xd44e('0x59'))](_0xd44e('0x61'));}return _0x31b5e8[_0xd44e('0x62')](_0x46ca7e,util[_0xd44e('0x52')]('%s.zip',path[_0xd44e('0x5d')](_0x1098c1['path'])),function(_0x114c77){if(_0x114c77){throw new db['Sequelize'][(_0xd44e('0x59'))](_0xd44e('0x63'));}fs[_0xd44e('0x64')](_0x46ca7e);logger[_0xd44e('0x65')](_0xd44e('0x66'));logger[_0xd44e('0x65')](_0xd44e('0x67'));});});}return null;})['catch'](handleError(_0x31b5e8,null));};exports['upload']=function(_0xd0948f,_0x2ae8ee,_0x4fbb1a){var _0xcbcb3d=path['basename'](_0xd0948f[_0xd44e('0x68')][_0xd44e('0x69')],path['extname'](_0xd0948f[_0xd44e('0x68')][_0xd44e('0x69')]));var _0x5c2cdd=path['join'](config[_0xd44e('0x50')],_0xd44e('0x51'),_0xd0948f[_0xd44e('0x68')]['filename']);var _0x5958a9=path[_0xd44e('0x4f')](config[_0xd44e('0x50')],_0xd44e('0x51'),_0xcbcb3d);logger[_0xd44e('0x65')](_0xd44e('0x6a'),_0x5c2cdd);logger[_0xd44e('0x65')](_0xd44e('0x6b'),_0x5958a9);try{fs[_0xd44e('0x6c')](_0x5c2cdd,parseInt(_0xd44e('0x6d'),0x8));extract(_0x5c2cdd,{'dir':_0x5958a9},function(_0x555d12){if(_0x555d12){logger[_0xd44e('0x2e')](_0x555d12);handleError(_0x555d12,!![]);};var _0x2fc3f0=fs['readdirSync'](_0x5958a9);if(_0x2fc3f0[_0xd44e('0x3c')]>0x1){removeReferences(_0x5c2cdd,_0x5958a9);logger['error'](_0xd44e('0x6e'));return _0x4fbb1a(new Error('Invalid\x20plugin\x20structure'));}var _0x41b5bb=fs[_0xd44e('0x6f')](path[_0xd44e('0x4f')](_0x5958a9,_0x2fc3f0[0x0]));if(_0x41b5bb[_0xd44e('0x70')]()){removeReferences(_0x5c2cdd,_0x5958a9);logger[_0xd44e('0x2e')]('Invalid\x20plugin\x20structure');return _0x4fbb1a(new Error(_0xd44e('0x6e')));}if(_0x41b5bb[_0xd44e('0x71')]()){var _0x4a405c=fs['readdirSync'](path[_0xd44e('0x4f')](_0x5958a9,_0x2fc3f0[0x0]));if(_0x4a405c[_0xd44e('0x3c')]===0x0){removeReferences(_0x5c2cdd,_0x5958a9);logger['error'](_0xd44e('0x6e'));return _0x4fbb1a(new Error(_0xd44e('0x6e')));}var _0x2a2df6=_0x4a405c[_0xd44e('0x72')](function(_0x160058){return _0x160058===_0xd44e('0x73');});if(!_0x2a2df6){return _0x4fbb1a(new Error('Plugin\x20manifest\x20missing'));}var _0x6b023=fs[_0xd44e('0x74')](path[_0xd44e('0x4f')](_0x5958a9,_0x2fc3f0[0x0],_0xd44e('0x73')));var _0x51f487=JSON['parse'](_0x6b023);if(_0xd44e('0x24')==typeof _0x51f487[_0xd44e('0x46')]){return _0x4fbb1a(new Error(_0xd44e('0x75')));}if('undefined'==typeof _0x51f487[_0xd44e('0x45')]){return _0x4fbb1a(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xd44e('0x24')==typeof _0x51f487[_0xd44e('0x76')]){return _0x4fbb1a(new Error(_0xd44e('0x77')));}if(_0xd44e('0x24')==typeof _0x51f487[_0xd44e('0x78')]){return _0x4fbb1a(new Error(_0xd44e('0x79')));}if(_0x51f487[_0xd44e('0x45')]===_0xd44e('0x7a')){if(_0xd44e('0x24')==typeof _0x51f487[_0xd44e('0x78')][_0xd44e('0x7b')]){return _0x4fbb1a(new Error(_0xd44e('0x7c')));}if(_0xd44e('0x24')==typeof _0x51f487[_0xd44e('0x78')][_0xd44e('0x7b')][_0xd44e('0x7d')]&&_0xd44e('0x24')==typeof _0x51f487['parameters']['views'][_0xd44e('0x7e')]){return _0x4fbb1a(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x51f487['type']===_0xd44e('0x7f')){if('undefined'==typeof _0x51f487['parameters'][_0xd44e('0x80')]){return _0x4fbb1a(new Error(_0xd44e('0x81')));}if(_0xd44e('0x24')==typeof _0x51f487[_0xd44e('0x78')][_0xd44e('0x82')]){return _0x4fbb1a(new Error(_0xd44e('0x83')));}}else{return _0x4fbb1a(new Error(_0xd44e('0x84')));}var _0x557f79=_0x51f487[_0xd44e('0x46')];var _0x2d5db9=_0x51f487[_0xd44e('0x85')];var _0x5ee4e3=_0x51f487[_0xd44e('0x45')];var _0x25990d=_0x51f487['sidebar']?_0x51f487[_0xd44e('0x86')]:_0xd44e('0x87');var _0x5cc7f1=_0x51f487['icon']?_0x51f487[_0xd44e('0x88')]:_0xd44e('0x89');var _0xc2e44f='';var _0x51117c='';var _0x32214f='';var _0x6f158e='';var _0x5bde0b=_0x51f487[_0xd44e('0x76')];if(_0x5ee4e3===_0xd44e('0x7a')){if(_0xd44e('0x24')!=typeof _0x51f487[_0xd44e('0x78')][_0xd44e('0x7b')][_0xd44e('0x7d')]){var _0xc645de=_0x51f487[_0xd44e('0x78')][_0xd44e('0x7b')][_0xd44e('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xd44e('0x8a')](_0xc645de)){_0xc2e44f=path[_0xd44e('0x4f')](_0xd44e('0x8b'),_0xcbcb3d,_0x2fc3f0[0x0],_0xc645de);}else{_0xc2e44f=_0xc645de;}}else{logger[_0xd44e('0x65')](_0xd44e('0x8c'));}if('undefined'!=typeof _0x51f487[_0xd44e('0x78')]['views'][_0xd44e('0x7e')]){var _0x1dbdd6=_0x51f487[_0xd44e('0x78')]['views'][_0xd44e('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xd44e('0x8a')](_0x1dbdd6)){_0x51117c=path['join'](_0xd44e('0x8b'),_0xcbcb3d,_0x2fc3f0[0x0],_0x1dbdd6);}else{_0x51117c=_0x1dbdd6;}}else{logger[_0xd44e('0x65')](_0xd44e('0x8d'));}}else if(_0x5ee4e3===_0xd44e('0x7f')){_0x32214f=_0x51f487[_0xd44e('0x78')][_0xd44e('0x80')];_0x6f158e=_0x51f487[_0xd44e('0x78')][_0xd44e('0x82')];if(_0xd44e('0x24')!=typeof _0x51f487[_0xd44e('0x78')]['views']){if(_0xd44e('0x24')!=typeof _0x51f487[_0xd44e('0x78')][_0xd44e('0x7b')][_0xd44e('0x7d')]){var _0xc645de=_0x51f487[_0xd44e('0x78')][_0xd44e('0x7b')][_0xd44e('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xd44e('0x8a')](_0xc645de)){_0xc2e44f=path['join']('plugins',_0xcbcb3d,_0x2fc3f0[0x0],_0xc645de);}else{_0xc2e44f=_0xc645de;}}if('undefined'!=typeof _0x51f487[_0xd44e('0x78')][_0xd44e('0x7b')]['agent']){var _0x1dbdd6=_0x51f487[_0xd44e('0x78')][_0xd44e('0x7b')][_0xd44e('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xd44e('0x8a')](_0x1dbdd6)){_0x51117c=path[_0xd44e('0x4f')](_0xd44e('0x8b'),_0xcbcb3d,_0x2fc3f0[0x0],_0x1dbdd6);}else{_0x51117c=_0x1dbdd6;}}}}var _0x7cbefa={'name':_0x557f79,'description':_0x2d5db9,'path':path[_0xd44e('0x4f')](_0xcbcb3d,_0x2fc3f0[0x0]),'type':_0x5ee4e3,'sidebar':_0x25990d,'icon':_0x5cc7f1,'adminUrl':_0xc2e44f,'agentUrl':_0x51117c,'scriptName':_0x32214f,'scriptPath':_0x6f158e,'version':_0x5bde0b};removeReferences(_0x5c2cdd,null);return db['Plugin']['create'](_0x7cbefa)[_0xd44e('0x28')](function(_0x15796a){var _0x41114d={'role':_0xd0948f[_0xd44e('0x8e')][_0xd44e('0x8f')],'userProfileId':_0xd0948f[_0xd44e('0x8e')][_0xd44e('0x90')]};if(!_0x41114d)throw new Error(_0xd44e('0x91'));if(_0x41114d['role']===_0xd44e('0x92')){var _0x11f642=_0x15796a['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xd44e('0x2a'),'userProfileId':_0x41114d[_0xd44e('0x90')]},'raw':!![]})[_0xd44e('0x28')](function(_0x3fde57){if(_0x3fde57&&_0x3fde57[_0xd44e('0x93')]===0x0){return db['UserProfileResource']['create']({'name':_0x11f642[_0xd44e('0x46')],'resourceId':_0x11f642['id'],'type':_0x3fde57['name'],'sectionId':_0x3fde57['id']},{})[_0xd44e('0x28')](function(){return _0x15796a;});}else{return _0x15796a;}})[_0xd44e('0x4b')](function(_0x3248d1){logger['error'](_0xd44e('0x94'),_0x3248d1);throw _0x3248d1;});}return _0x15796a;})[_0xd44e('0x28')](respondWithResult(_0x2ae8ee,null))[_0xd44e('0x4b')](handleError(_0x2ae8ee,null));}});}catch(_0x105410){_0x2ae8ee['status'](0x1f4)[_0xd44e('0x95')](_0x105410);}};function removeReferences(_0x37edbb,_0x10cc71){try{if(_0x37edbb){fs[_0xd44e('0x64')](_0x37edbb);logger[_0xd44e('0x65')]('Zip\x20archive\x20removed');}if(_0x10cc71){rimraf(_0x10cc71,function(){});logger[_0xd44e('0x65')](_0xd44e('0x96'));}}catch(_0x1c98b4){logger[_0xd44e('0x2e')](_0x1c98b4);}}exports[_0xd44e('0x97')]=function(_0x485aab,_0x10d7fb,_0x8a0659){return db[_0xd44e('0x32')]['find']({'where':{'id':_0x485aab[_0xd44e('0x4d')]['id']}})[_0xd44e('0x28')](handleEntityNotFound(_0x10d7fb,null))[_0xd44e('0x28')](saveUpdates(_0x485aab['body'],null))[_0xd44e('0x28')](respondWithResult(_0x10d7fb,null))[_0xd44e('0x4b')](handleError(_0x10d7fb,null));};exports['delete']=function(_0x2f43ee,_0x4c00e5,_0x5397ef){return db['Plugin'][_0xd44e('0x4e')]({'where':{'id':_0x2f43ee[_0xd44e('0x4d')]['id']}})[_0xd44e('0x28')](function(_0x26a554){if(_0x26a554){return _0x26a554[_0xd44e('0x2c')]();}})[_0xd44e('0x28')](function(_0x591564){rimraf(path['join'](config['root'],_0xd44e('0x51'),path[_0xd44e('0x98')](_0x591564[_0xd44e('0x6')])),function(){});return _0x591564;})[_0xd44e('0x28')](handleEntityNotFound(_0x4c00e5,null))[_0xd44e('0x28')](respondWithStatusCode(_0x4c00e5,null))['catch'](handleError(_0x4c00e5,null));};exports[_0xd44e('0x99')]=function(_0x392ef6,_0x3b20d6,_0x522859){return BPromise[_0xd44e('0x9a')]()[_0xd44e('0x28')](function(){if(!_0x392ef6[_0xd44e('0x37')][_0xd44e('0x6')]){throw new Error(_0xd44e('0x9b'));}if(!_0x392ef6['query'][_0xd44e('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x501729=_0x392ef6['query'][_0xd44e('0x9d')]?_0x392ef6['query'][_0xd44e('0x9d')]+':'+_0x392ef6[_0xd44e('0x37')][_0xd44e('0x9c')]:_0xd44e('0x9e')+_0x392ef6[_0xd44e('0x37')][_0xd44e('0x9c')];var _0x41fe9c=_0x392ef6['query'][_0xd44e('0x22')]?_0x392ef6[_0xd44e('0x37')][_0xd44e('0x22')]:!![];var _0x2101ca=_0x392ef6[_0xd44e('0x37')][_0xd44e('0x9f')]?_0x392ef6[_0xd44e('0x37')][_0xd44e('0x9f')]:null;var _0x3705d4={'method':_0x392ef6[_0xd44e('0xa0')],'uri':util[_0xd44e('0x52')]('%s%s',_0x501729,_0x392ef6['query']['path']),'json':_0x41fe9c,'resolveWithFullResponse':!![],'encoding':_0x2101ca,'qs':_0x392ef6[_0xd44e('0x37')]};if(_0x392ef6[_0xd44e('0xa1')]){_0x3705d4[_0xd44e('0xa1')]=_0x392ef6[_0xd44e('0xa1')];if(_0x3705d4['headers'][_0xd44e('0xa2')]){delete _0x3705d4['headers'][_0xd44e('0xa2')];}}if(_0x3705d4['headers'][_0xd44e('0xa3')]){delete _0x3705d4[_0xd44e('0xa1')][_0xd44e('0xa3')];}return rp(_0x3705d4);})[_0xd44e('0x28')](function(_0x2371ef){if(_0x2371ef){_0x3b20d6[_0xd44e('0x26')](_0x2371ef[_0xd44e('0xa1')]);logger['info'](_0x2371ef[_0xd44e('0x8e')]);if(_[_0xd44e('0xa4')](_0x392ef6[_0xd44e('0x37')][_0xd44e('0x6')],'download')&&_0x2371ef['statusCode']==0x1f4){return _0x3b20d6['sendStatus'](_0x2371ef['statusCode']);}else{return _0x3b20d6[_0xd44e('0x20')](_0x2371ef['statusCode'])[_0xd44e('0x95')](_0x2371ef['body']);}}else{return _0x3b20d6[_0xd44e('0x2d')](0xc8);}})[_0xd44e('0x4b')](handleError(_0x3b20d6,null));};exports[_0xd44e('0xa5')]=function(_0x43d7c1,_0x3e9a9e,_0x28dff3){return BPromise[_0xd44e('0x9a')]()[_0xd44e('0x28')](function(){if(!_0x43d7c1[_0xd44e('0x37')]['path']){throw new Error(_0xd44e('0x9b'));}if(!_0x43d7c1['query']['port']){throw new Error(_0xd44e('0xa6'));}var _0x2266e0=_0x43d7c1[_0xd44e('0x37')][_0xd44e('0x9d')]?_0x43d7c1[_0xd44e('0x37')][_0xd44e('0x9d')]+':'+_0x43d7c1['query']['port']:_0xd44e('0x9e')+_0x43d7c1[_0xd44e('0x37')]['port'];var _0x18e425=_0x43d7c1['query']['json']?_0x43d7c1[_0xd44e('0x37')]['json']:!![];var _0x39ee29=_0x43d7c1[_0xd44e('0x37')]['encoding']?_0x43d7c1[_0xd44e('0x37')][_0xd44e('0x9f')]:null;var _0x2b442a={'method':_0x43d7c1[_0xd44e('0xa0')],'uri':util['format'](_0xd44e('0xa7'),_0x2266e0,_0x43d7c1['query'][_0xd44e('0x6')]),'json':_0x18e425,'resolveWithFullResponse':!![],'encoding':_0x39ee29,'body':_0x43d7c1[_0xd44e('0x8e')]};if(_0x43d7c1[_0xd44e('0xa1')]){_0x2b442a['headers']=_0x43d7c1[_0xd44e('0xa1')];if(_0x2b442a[_0xd44e('0xa1')][_0xd44e('0xa2')]){delete _0x2b442a[_0xd44e('0xa1')]['content-length'];}}if(_0x2b442a[_0xd44e('0xa1')][_0xd44e('0xa3')]){delete _0x2b442a[_0xd44e('0xa1')][_0xd44e('0xa3')];}return rp(_0x2b442a);})[_0xd44e('0x28')](function(_0x8f4a37){if(_0x8f4a37){_0x3e9a9e[_0xd44e('0x26')](_0x8f4a37[_0xd44e('0xa1')]);logger[_0xd44e('0x65')](_0x8f4a37[_0xd44e('0x8e')]);return _0x3e9a9e[_0xd44e('0x20')](_0x8f4a37[_0xd44e('0xa8')])[_0xd44e('0x95')](_0x8f4a37[_0xd44e('0x8e')]);}else{return _0x3e9a9e[_0xd44e('0x2d')](0xc8);}})[_0xd44e('0x4b')](handleError(_0x3e9a9e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 9a5792b..d56f0ce 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 _0xb7ae=['events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x1cbc68,_0x321c42){var _0x4e8d71=function(_0x1f9389){while(--_0x1f9389){_0x1cbc68['push'](_0x1cbc68['shift']());}};_0x4e8d71(++_0x321c42);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x4baa58,_0x745a92){_0x4baa58=_0x4baa58-0x0;var _0x3d2b2f=_0xb7ae[_0x4baa58];return _0x3d2b2f;};'use strict';var EventEmitter=require(_0xeb7a('0x0'));var Plugin=require(_0xeb7a('0x1'))['db'][_0xeb7a('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xeb7a('0x3')](0x0);var events={'afterCreate':_0xeb7a('0x4'),'afterUpdate':'update','afterDestroy':_0xeb7a('0x5')};function emitEvent(_0x242a47){return function(_0x44ce73,_0x51e0af,_0x277b5d){PluginEvents[_0xeb7a('0x6')](_0x242a47+':'+_0x44ce73['id'],_0x44ce73);PluginEvents[_0xeb7a('0x6')](_0x242a47,_0x44ce73);_0x277b5d(null);};}for(var e in events){if(events[_0xeb7a('0x7')](e)){var event=events[e];Plugin[_0xeb7a('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x04f9=['Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x292c3e,_0x12b861){var _0x1a87c6=function(_0x1f4d8c){while(--_0x1f4d8c){_0x292c3e['push'](_0x292c3e['shift']());}};_0x1a87c6(++_0x12b861);}(_0x04f9,0xb3));var _0x904f=function(_0x184d15,_0x42fd81){_0x184d15=_0x184d15-0x0;var _0x19dfa7=_0x04f9[_0x184d15];return _0x19dfa7;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x904f('0x0'))['db'][_0x904f('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x904f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x904f('0x3'),'afterDestroy':_0x904f('0x4')};function emitEvent(_0x123003){return function(_0x8cc251,_0x243fb2,_0x43a7b4){PluginEvents['emit'](_0x123003+':'+_0x8cc251['id'],_0x8cc251);PluginEvents[_0x904f('0x5')](_0x123003,_0x8cc251);_0x43a7b4(null);};}for(var e in events){if(events[_0x904f('0x6')](e)){var event=events[e];Plugin[_0x904f('0x7')](e,emitEvent(event));}}module[_0x904f('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index cfa85e0..36f5b6c 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 _0x4016=['../../config/logger','request-promise','rimraf','../../config/environment','Plugin','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4016,0x131));var _0x6401=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4016[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x6401('0x0'));var logger=require(_0x6401('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6401('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6401('0x3'));var config=require(_0x6401('0x4'));var attributes=require('./plugin.attributes');module['exports']=function(_0x3e2c0b,_0x34c7f2){return _0x3e2c0b['define'](_0x6401('0x5'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd535=['request-promise','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','moment'];(function(_0x4d5bb6,_0x2e502f){var _0x4d3317=function(_0x1b2210){while(--_0x1b2210){_0x4d5bb6['push'](_0x4d5bb6['shift']());}};_0x4d3317(++_0x2e502f);}(_0xd535,0xe3));var _0x5d53=function(_0x3c9c91,_0x44a2cf){_0x3c9c91=_0x3c9c91-0x0;var _0x3f04b1=_0xd535[_0x3c9c91];return _0x3f04b1;};'use strict';var _=require(_0x5d53('0x0'));var util=require(_0x5d53('0x1'));var logger=require(_0x5d53('0x2'))('api');var moment=require(_0x5d53('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d53('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d53('0x5'));var config=require(_0x5d53('0x6'));var attributes=require(_0x5d53('0x7'));module['exports']=function(_0x345fea,_0x2f37bd){return _0x345fea[_0x5d53('0x8')](_0x5d53('0x9'),attributes,{'tableName':_0x5d53('0xa'),'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 4b26ccc..fead4c9 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 _0x7d01=['result','catch','CreatePlugin','Plugin','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2d9094,_0x340ad4){var _0x9fe76e=function(_0x1f906f){while(--_0x1f906f){_0x2d9094['push'](_0x2d9094['shift']());}};_0x9fe76e(++_0x340ad4);}(_0x7d01,0x97));var _0x17d0=function(_0x3dc77c,_0x5c766c){_0x3dc77c=_0x3dc77c-0x0;var _0x141af2=_0x7d01[_0x3dc77c];return _0x141af2;};'use strict';var _=require(_0x17d0('0x0'));var util=require('util');var moment=require(_0x17d0('0x1'));var BPromise=require(_0x17d0('0x2'));var rs=require(_0x17d0('0x3'));var fs=require('fs');var Redis=require(_0x17d0('0x4'));var db=require(_0x17d0('0x5'))['db'];var utils=require(_0x17d0('0x6'));var logger=require(_0x17d0('0x7'))(_0x17d0('0x8'));var config=require(_0x17d0('0x9'));var jayson=require(_0x17d0('0xa'));var client=jayson[_0x17d0('0xb')][_0x17d0('0xc')]({'port':0x232a});config['redis']=_[_0x17d0('0xd')](config[_0x17d0('0xe')],{'host':_0x17d0('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x17d0('0xe')]));require(_0x17d0('0x10'))[_0x17d0('0x11')](socket);function respondWithRpcPromise(_0x1df1c4,_0x233703,_0x48de5b){return new BPromise(function(_0x496d34,_0x9e658d){return client[_0x17d0('0x12')](_0x1df1c4,_0x48de5b)[_0x17d0('0x13')](function(_0xc050c8){logger[_0x17d0('0x14')](_0x17d0('0x15'),_0x233703,_0x17d0('0x16'));logger[_0x17d0('0x17')](_0x17d0('0x18'),_0x233703,_0x17d0('0x16'),JSON[_0x17d0('0x19')](_0xc050c8));if(_0xc050c8[_0x17d0('0x1a')]){if(_0xc050c8[_0x17d0('0x1a')][_0x17d0('0x1b')]===0x1f4){logger['error'](_0x17d0('0x15'),_0x233703,_0xc050c8[_0x17d0('0x1a')][_0x17d0('0x1c')]);return _0x9e658d(_0xc050c8[_0x17d0('0x1a')]['message']);}logger['error']('Plugin,\x20%s,\x20%s',_0x233703,_0xc050c8[_0x17d0('0x1a')][_0x17d0('0x1c')]);return _0x496d34(_0xc050c8[_0x17d0('0x1a')]['message']);}else{logger['info'](_0x17d0('0x15'),_0x233703,_0x17d0('0x16'));_0x496d34(_0xc050c8[_0x17d0('0x1d')][_0x17d0('0x1c')]);}})[_0x17d0('0x1e')](function(_0xb2dba){logger[_0x17d0('0x1a')](_0x17d0('0x15'),_0x233703,_0xb2dba);_0x9e658d(_0xb2dba);});});}exports[_0x17d0('0x1f')]=function(_0xff4436){var _0x432ffe=this;return new Promise(function(_0x89b614,_0x2667af){return db[_0x17d0('0x20')][_0x17d0('0x21')](_0xff4436['body'],{'raw':_0xff4436[_0x17d0('0x22')]?_0xff4436['options'][_0x17d0('0x23')]===undefined?!![]:![]:!![]})[_0x17d0('0x13')](function(_0x52daf0){logger[_0x17d0('0x14')](_0x17d0('0x1f'),_0xff4436);logger[_0x17d0('0x17')](_0x17d0('0x1f'),_0xff4436,JSON[_0x17d0('0x19')](_0x52daf0));_0x89b614(_0x52daf0);})[_0x17d0('0x1e')](function(_0x41dc3d){logger[_0x17d0('0x1a')](_0x17d0('0x1f'),_0x41dc3d[_0x17d0('0x1c')],_0xff4436);_0x2667af(_0x432ffe[_0x17d0('0x1a')](0x1f4,_0x41dc3d[_0x17d0('0x1c')]));});});}; \ No newline at end of file +var _0xddb5=['message','result','catch','CreatePlugin','create','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','redis','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x74962,_0x283a33){var _0x274859=function(_0x284568){while(--_0x284568){_0x74962['push'](_0x74962['shift']());}};_0x274859(++_0x283a33);}(_0xddb5,0x120));var _0x5ddb=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xddb5[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x5ddb('0x0'));var moment=require(_0x5ddb('0x1'));var BPromise=require(_0x5ddb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ddb('0x3'));var db=require(_0x5ddb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ddb('0x5'))(_0x5ddb('0x6'));var config=require(_0x5ddb('0x7'));var jayson=require(_0x5ddb('0x8'));var client=jayson['client'][_0x5ddb('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5ddb('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ddb('0xb')]));require('./plugin.socket')[_0x5ddb('0xc')](socket);function respondWithRpcPromise(_0x38dac6,_0x228779,_0x5bd52f){return new BPromise(function(_0x769671,_0x491d02){return client['request'](_0x38dac6,_0x5bd52f)[_0x5ddb('0xd')](function(_0x112adb){logger[_0x5ddb('0xe')](_0x5ddb('0xf'),_0x228779,_0x5ddb('0x10'));logger[_0x5ddb('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x228779,_0x5ddb('0x10'),JSON[_0x5ddb('0x12')](_0x112adb));if(_0x112adb[_0x5ddb('0x13')]){if(_0x112adb[_0x5ddb('0x13')]['code']===0x1f4){logger[_0x5ddb('0x13')](_0x5ddb('0xf'),_0x228779,_0x112adb[_0x5ddb('0x13')][_0x5ddb('0x14')]);return _0x491d02(_0x112adb['error'][_0x5ddb('0x14')]);}logger['error'](_0x5ddb('0xf'),_0x228779,_0x112adb[_0x5ddb('0x13')]['message']);return _0x769671(_0x112adb[_0x5ddb('0x13')][_0x5ddb('0x14')]);}else{logger['info'](_0x5ddb('0xf'),_0x228779,_0x5ddb('0x10'));_0x769671(_0x112adb[_0x5ddb('0x15')][_0x5ddb('0x14')]);}})[_0x5ddb('0x16')](function(_0x2d5887){logger[_0x5ddb('0x13')](_0x5ddb('0xf'),_0x228779,_0x2d5887);_0x491d02(_0x2d5887);});});}exports[_0x5ddb('0x17')]=function(_0x118e24){var _0x4d46ea=this;return new Promise(function(_0x430ec9,_0x271b6d){return db['Plugin'][_0x5ddb('0x18')](_0x118e24[_0x5ddb('0x19')],{'raw':_0x118e24[_0x5ddb('0x1a')]?_0x118e24[_0x5ddb('0x1a')][_0x5ddb('0x1b')]===undefined?!![]:![]:!![]})[_0x5ddb('0xd')](function(_0x57218a){logger[_0x5ddb('0xe')]('CreatePlugin',_0x118e24);logger[_0x5ddb('0x11')](_0x5ddb('0x17'),_0x118e24,JSON[_0x5ddb('0x12')](_0x57218a));_0x430ec9(_0x57218a);})[_0x5ddb('0x16')](function(_0x2a52bf){logger[_0x5ddb('0x13')](_0x5ddb('0x17'),_0x2a52bf[_0x5ddb('0x14')],_0x118e24);_0x271b6d(_0x4d46ea['error'](0x1f4,_0x2a52bf['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 03df3cb..c95cf2e 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 _0x432c=['length','plugin:','save','update','emit'];(function(_0x138208,_0x140722){var _0x4f93b5=function(_0x1df020){while(--_0x1df020){_0x138208['push'](_0x138208['shift']());}};_0x4f93b5(++_0x140722);}(_0x432c,0x1e2));var _0xc432=function(_0x48e20a,_0x46960b){_0x48e20a=_0x48e20a-0x0;var _0x21c32a=_0x432c[_0x48e20a];return _0x21c32a;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xc432('0x0'),'remove',_0xc432('0x1')];function createListener(_0x4f86eb,_0x5ede22){return function(_0x3ff0bb){_0x5ede22[_0xc432('0x2')](_0x4f86eb,_0x3ff0bb);};}function removeListener(_0x1762c6,_0x1c6d23){return function(){PluginEvents['removeListener'](_0x1762c6,_0x1c6d23);};}exports['register']=function(_0x5327a5){for(var _0x269cd1=0x0,_0x2643da=events[_0xc432('0x3')];_0x269cd1<_0x2643da;_0x269cd1++){var _0x3c7022=events[_0x269cd1];var _0x22fe09=createListener(_0xc432('0x4')+_0x3c7022,_0x5327a5);PluginEvents['on'](_0x3c7022,_0x22fe09);}}; \ No newline at end of file +var _0xd083=['plugin:','./plugin.events','save','remove','emit','register','length'];(function(_0x34d003,_0x8e4fa7){var _0x134880=function(_0x4386be){while(--_0x4386be){_0x34d003['push'](_0x34d003['shift']());}};_0x134880(++_0x8e4fa7);}(_0xd083,0xa9));var _0x3d08=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xd083[_0x456bd2];return _0x2218c1;};'use strict';var PluginEvents=require(_0x3d08('0x0'));var events=[_0x3d08('0x1'),_0x3d08('0x2'),'update'];function createListener(_0x64099,_0x3eb555){return function(_0xff5dd9){_0x3eb555[_0x3d08('0x3')](_0x64099,_0xff5dd9);};}function removeListener(_0x1cb506,_0x1f0eed){return function(){PluginEvents['removeListener'](_0x1cb506,_0x1f0eed);};}exports[_0x3d08('0x4')]=function(_0x5e22a0){for(var _0x275f73=0x0,_0x1a9e2d=events[_0x3d08('0x5')];_0x275f73<_0x1a9e2d;_0x275f73++){var _0x129b0a=events[_0x275f73];var _0x3a0d29=createListener(_0x3d08('0x6')+_0x129b0a,_0x5e22a0);PluginEvents['on'](_0x129b0a,_0x3a0d29);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e58aa5f..c15f7bc 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(_0x4c68d4,_0x3ae3d4){var _0xe9fb5d=function(_0x3a93de){while(--_0x3a93de){_0x4c68d4['push'](_0x4c68d4['shift']());}};_0xe9fb5d(++_0x3ae3d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x41a385,_0x5fa102){var _0x1e12d7=function(_0x1bcb55){while(--_0x1bcb55){_0x41a385['push'](_0x41a385['shift']());}};_0x1e12d7(++_0x5fa102);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 d5ccff8..d7749dc 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 _0x1d2d=['reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','list','then'];(function(_0x2cafc6,_0x3a1547){var _0x2e66ea=function(_0x4e5f6f){while(--_0x4e5f6f){_0x2cafc6['push'](_0x2cafc6['shift']());}};_0x2e66ea(++_0x3a1547);}(_0x1d2d,0xf0));var _0xd1d2=function(_0xff239f,_0xd05796){_0xff239f=_0xff239f-0x0;var _0x3f407d=_0x1d2d[_0xff239f];return _0x3f407d;};'use strict';var _=require(_0xd1d2('0x0'));var pm2=require(_0xd1d2('0x1'));var logger=require(_0xd1d2('0x2'))(_0xd1d2('0x3'));var path=require(_0xd1d2('0x4'));var exec=require('child_process')[_0xd1d2('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5d3fac,_0x3caa72){return function(_0x2bfabc){if(!_0x2bfabc){_0x5d3fac[_0xd1d2('0x6')](0x194);;}return _0x2bfabc;};}function respondWithResult(_0x269613,_0x2f930d){_0x2f930d=_0x2f930d||0xc8;return function(_0x353dbd){if(_0x353dbd){return _0x269613['status'](_0x2f930d)[_0xd1d2('0x7')](_0x353dbd);}return null;};}function handleError(_0x21bc28,_0x35735f){_0x35735f=_0x35735f||0x1f4;return function(_0x37ff2a){logger[_0xd1d2('0x8')](_0x37ff2a[_0xd1d2('0x9')]);if(_0x37ff2a[_0xd1d2('0xa')]){delete _0x37ff2a[_0xd1d2('0xa')];}_0x21bc28[_0xd1d2('0xb')](_0x35735f)[_0xd1d2('0xc')](_0x37ff2a);};}function execChildProcess(){return new BPromise(function(_0x900ec,_0x227d7f){exec(_0xd1d2('0xd'),function(_0x5b21f4,_0x41fcb5,_0x1f49ed){logger[_0xd1d2('0xe')](_0x41fcb5);logger[_0xd1d2('0xe')](_0x1f49ed);if(_0x5b21f4){logger[_0xd1d2('0x8')](_0x5b21f4);return _0x227d7f(_0x5b21f4);}return _0x900ec(_0x41fcb5);});});}exports[_0xd1d2('0xf')]=function(_0x2df8a5,_0x31dc84){return pm2[_0xd1d2('0x10')]()[_0xd1d2('0x11')](function(_0x4cf702){if(_0x4cf702){var _0x2e7fec=_[_0xd1d2('0x12')](_0x4cf702,function(_0x3476f8){return _0x3476f8['name']===_0xd1d2('0x13')||_0x3476f8[_0xd1d2('0xa')]===_0xd1d2('0x14');});return{'rows':_0x2e7fec,'count':_0x2e7fec[_0xd1d2('0x15')]};}return null;})[_0xd1d2('0x11')](respondWithResult(_0x31dc84,null))[_0xd1d2('0x16')](handleError(_0x31dc84,null));};exports[_0xd1d2('0x17')]=function(_0x57f2f9,_0x539d5a){return pm2[_0xd1d2('0x18')](_0x57f2f9['params']['id'])[_0xd1d2('0x11')](respondWithResult(_0x539d5a,null))[_0xd1d2('0x11')](handleEntityNotFound(_0x539d5a,null))[_0xd1d2('0x16')](handleError(_0x539d5a,null));};exports[_0xd1d2('0x19')]=function(_0x4ab386,_0x4f1201){if(_0x4ab386[_0xd1d2('0x1a')]['name']&&_0x4ab386['body'][_0xd1d2('0x1b')]){var _0x27e26b=path[_0xd1d2('0x1c')](__dirname,_0xd1d2('0x1d'),_0x4ab386['body'][_0xd1d2('0x1b')]);var _0xbb4d27=process[_0xd1d2('0x1e')]();process['chdir'](path['dirname'](_0x27e26b));return execChildProcess()[_0xd1d2('0x11')](function(_0x3a1078){process[_0xd1d2('0x1f')](_0xbb4d27);return pm2[_0xd1d2('0x20')]({'name':_0x4ab386[_0xd1d2('0x1a')][_0xd1d2('0xa')],'script':_0x27e26b});})[_0xd1d2('0x11')](function(_0x5df4af){pm2[_0xd1d2('0x21')]();return _0x5df4af[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x4f1201,0xc9))[_0xd1d2('0x16')](handleError(_0x4f1201,null));}else{return _0x4f1201[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x22')});}};exports[_0xd1d2('0x23')]=function(_0x34faf7,_0xe6ef3c){if(_0x34faf7[_0xd1d2('0x1a')]['id']){delete _0x34faf7[_0xd1d2('0x1a')]['id'];}var _0x4e1bc2={'online':'restart','stopped':_0xd1d2('0x24')};if(_0x4e1bc2[_0xd1d2('0x25')](_0x34faf7[_0xd1d2('0x1a')][_0xd1d2('0xb')])){return pm2[_0x4e1bc2[_0x34faf7[_0xd1d2('0x1a')]['status']]](_0x34faf7[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](respondWithResult(_0xe6ef3c,0xc8))[_0xd1d2('0x16')](handleError(_0xe6ef3c,null));}else{return _0xe6ef3c['status'](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x27')});}};exports[_0xd1d2('0x28')]=function(_0x56557d,_0x419db7){if(_0x56557d[_0xd1d2('0x1a')]['id']){delete _0x56557d[_0xd1d2('0x1a')]['id'];}if(_0x56557d[_0xd1d2('0x26')]['id']){return pm2[_0xd1d2('0x29')](_0x56557d[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](function(_0x322f50){pm2[_0xd1d2('0x21')]();return _0x322f50[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x419db7,null))[_0xd1d2('0x16')](handleError(_0x419db7,null));}else{return _0x419db7[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x2a')});}}; \ No newline at end of file +var _0x6c76=['status','npm\x20install','info','error','index','list','then','reject','motion2','length','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','send','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','sendStatus','stack','name'];(function(_0x5727fc,_0x101501){var _0x5c3859=function(_0x6883ac){while(--_0x6883ac){_0x5727fc['push'](_0x5727fc['shift']());}};_0x5c3859(++_0x101501);}(_0x6c76,0x184));var _0x66c7=function(_0xaad33,_0x34a032){_0xaad33=_0xaad33-0x0;var _0x4847f3=_0x6c76[_0xaad33];return _0x4847f3;};'use strict';var _=require(_0x66c7('0x0'));var pm2=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var path=require(_0x66c7('0x3'));var exec=require(_0x66c7('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2f6db7,_0x2b7cf3){return function(_0x49d437){if(!_0x49d437){_0x2f6db7[_0x66c7('0x5')](0x194);;}return _0x49d437;};}function respondWithResult(_0x45b0a5,_0x52f71b){_0x52f71b=_0x52f71b||0xc8;return function(_0x23408c){if(_0x23408c){return _0x45b0a5['status'](_0x52f71b)['json'](_0x23408c);}return null;};}function handleError(_0x208d06,_0x2b0065){_0x2b0065=_0x2b0065||0x1f4;return function(_0x24349f){logger['error'](_0x24349f[_0x66c7('0x6')]);if(_0x24349f[_0x66c7('0x7')]){delete _0x24349f[_0x66c7('0x7')];}_0x208d06[_0x66c7('0x8')](_0x2b0065)['send'](_0x24349f);};}function execChildProcess(){return new BPromise(function(_0x464085,_0x45db57){exec(_0x66c7('0x9'),function(_0x187e00,_0x21fb64,_0x406e41){logger[_0x66c7('0xa')](_0x21fb64);logger['info'](_0x406e41);if(_0x187e00){logger[_0x66c7('0xb')](_0x187e00);return _0x45db57(_0x187e00);}return _0x464085(_0x21fb64);});});}exports[_0x66c7('0xc')]=function(_0x35cbc2,_0xea3f56){return pm2[_0x66c7('0xd')]()[_0x66c7('0xe')](function(_0x618bd7){if(_0x618bd7){var _0xf3b04=_[_0x66c7('0xf')](_0x618bd7,function(_0x5d44e1){return _0x5d44e1[_0x66c7('0x7')]==='express'||_0x5d44e1[_0x66c7('0x7')]===_0x66c7('0x10');});return{'rows':_0xf3b04,'count':_0xf3b04[_0x66c7('0x11')]};}return null;})[_0x66c7('0xe')](respondWithResult(_0xea3f56,null))[_0x66c7('0x12')](handleError(_0xea3f56,null));};exports['show']=function(_0x5cf913,_0x53fb36){return pm2['describe'](_0x5cf913[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x53fb36,null))['then'](handleEntityNotFound(_0x53fb36,null))['catch'](handleError(_0x53fb36,null));};exports[_0x66c7('0x14')]=function(_0x9b65cf,_0x4756f7){if(_0x9b65cf[_0x66c7('0x15')]['name']&&_0x9b65cf['body'][_0x66c7('0x16')]){var _0x237177=path[_0x66c7('0x17')](__dirname,_0x66c7('0x18'),_0x9b65cf[_0x66c7('0x15')][_0x66c7('0x16')]);var _0x4804cf=process[_0x66c7('0x19')]();process[_0x66c7('0x1a')](path['dirname'](_0x237177));return execChildProcess()[_0x66c7('0xe')](function(_0x8b96b1){process[_0x66c7('0x1a')](_0x4804cf);return pm2[_0x66c7('0x1b')]({'name':_0x9b65cf['body'][_0x66c7('0x7')],'script':_0x237177});})[_0x66c7('0xe')](function(_0x5b28e6){pm2[_0x66c7('0x1c')]();return _0x5b28e6[0x0];})[_0x66c7('0xe')](respondWithResult(_0x4756f7,0xc9))[_0x66c7('0x12')](handleError(_0x4756f7,null));}else{return _0x4756f7[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x4e514a,_0x2dd131){if(_0x4e514a[_0x66c7('0x15')]['id']){delete _0x4e514a['body']['id'];}var _0x9afd50={'online':_0x66c7('0x1e'),'stopped':_0x66c7('0x1f')};if(_0x9afd50[_0x66c7('0x20')](_0x4e514a[_0x66c7('0x15')][_0x66c7('0x8')])){return pm2[_0x9afd50[_0x4e514a['body'][_0x66c7('0x8')]]](_0x4e514a[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x2dd131,0xc8))[_0x66c7('0x12')](handleError(_0x2dd131,null));}else{return _0x2dd131[_0x66c7('0x8')](0x1f4)['send']({'message':_0x66c7('0x21')});}};exports['destroy']=function(_0xfbd97,_0x543fbf){if(_0xfbd97[_0x66c7('0x15')]['id']){delete _0xfbd97[_0x66c7('0x15')]['id'];}if(_0xfbd97[_0x66c7('0x13')]['id']){return pm2[_0x66c7('0x22')](_0xfbd97[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](function(_0x559ab9){pm2['dump']();return _0x559ab9[0x0];})[_0x66c7('0xe')](respondWithResult(_0x543fbf,null))[_0x66c7('0x12')](handleError(_0x543fbf,null));}else{return _0x543fbf[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':_0x66c7('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index d7b58c4..8f05b08 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 _0x97ce=['getQueues','express','Router','../../components/auth/service','./realtime.controller','/queues'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x97ce,0x151));var _0xe97c=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x97ce[_0xfa634c];return _0x73e478;};'use strict';var express=require(_0xe97c('0x0'));var router=express[_0xe97c('0x1')]();var auth=require(_0xe97c('0x2'));var controller=require(_0xe97c('0x3'));router['get'](_0xe97c('0x4'),auth['isAuthenticated'](),controller[_0xe97c('0x5')]);module['exports']=router; \ No newline at end of file +var _0xf970=['exports','express','../../components/auth/service','./realtime.controller','get','/queues','isAuthenticated','getQueues'];(function(_0x556cd0,_0x3a2d89){var _0x5a3238=function(_0x27513e){while(--_0x27513e){_0x556cd0['push'](_0x556cd0['shift']());}};_0x5a3238(++_0x3a2d89);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x0f97('0x0'));var router=express['Router']();var auth=require(_0x0f97('0x1'));var controller=require(_0x0f97('0x2'));router[_0x0f97('0x3')](_0x0f97('0x4'),auth[_0x0f97('0x5')](),controller[_0x0f97('0x6')]);module[_0x0f97('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 d512272..4a59b65 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 _0x49f5=['VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','outbound','pTalking','originated','message','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAvgTalktime','map','agents','find','filter','queue','busy','internal','toString','talking','getMembers','length','UserId','accountcode','online','voiceStatus','loggedInDb','User','Pause','findAll','QueueId','push','getQueues','mail','chat','sms','openchannel','fax','whatsapp','query','includes','channel','toLowerCase','Invalid\x20channel','Queue','rawAttributes','fieldName','type','key','getOptions','user','role','userProfileId','QueueCampaigns','getResources','findAndCountAll','rows','all','util','api','../../mysqldb','client','http','offset','limit','undefined','count','status','Content-Range','json','error','stack','name','request','Agents','then','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues'];(function(_0x20988b,_0x1a6eae){var _0x372b96=function(_0x2fbb71){while(--_0x2fbb71){_0x20988b['push'](_0x20988b['shift']());}};_0x372b96(++_0x1a6eae);}(_0x49f5,0xff));var _0x549f=function(_0x1c3f44,_0x3b9db4){_0x1c3f44=_0x1c3f44-0x0;var _0x1bc285=_0x49f5[_0x1c3f44];return _0x1bc285;};'use strict';var util=require(_0x549f('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x549f('0x1'));var db=require(_0x549f('0x2'))['db'];var amiClient=jayson[_0x549f('0x3')][_0x549f('0x4')]({'port':0x232a});var routingClient=jayson[_0x549f('0x3')][_0x549f('0x4')]({'port':0x232c});function respondWithFilteredResult(_0x23da0c,_0x1546e2){return function(_0x3eefbb){if(_0x3eefbb){var _0x4d118c=typeof _0x1546e2[_0x549f('0x5')]==='undefined'&&typeof _0x1546e2[_0x549f('0x6')]===_0x549f('0x7');var _0x3d96c4=_0x3eefbb[_0x549f('0x8')];var _0x8d8b96=_0x4d118c?0x0:_0x1546e2['offset'];var _0x3e6d68=_0x4d118c?_0x3eefbb[_0x549f('0x8')]:_0x1546e2[_0x549f('0x5')]+_0x1546e2['limit'];var _0x59795b;if(_0x3e6d68>=_0x3d96c4){_0x3e6d68=_0x3d96c4;_0x59795b=0xc8;}else{_0x59795b=0xce;}_0x23da0c[_0x549f('0x9')](_0x59795b);return _0x23da0c['set'](_0x549f('0xa'),_0x8d8b96+'-'+_0x3e6d68+'/'+_0x3d96c4)[_0x549f('0xb')](_0x3eefbb);}return null;};}function handleError(_0x31120e,_0x4f5915){_0x4f5915=_0x4f5915||0x1f4;return function(_0x5f41c5){logger[_0x549f('0xc')](_0x5f41c5[_0x549f('0xd')]);if(_0x5f41c5[_0x549f('0xe')]){delete _0x5f41c5[_0x549f('0xe')];}_0x31120e[_0x549f('0x9')](_0x4f5915)['send'](_0x5f41c5);};}function getRealtimeAgents(){return new Promise(function(_0x55b758,_0x12bb91){return amiClient[_0x549f('0xf')](_0x549f('0x10'),{})[_0x549f('0x11')](function(_0x313c1d){if(_0x313c1d[_0x549f('0xc')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x166b4b=_0x313c1d[_0x549f('0x12')];return routingClient[_0x549f('0xf')](_0x549f('0x10'),{})[_0x549f('0x11')](function(_0x1e00aa){if(_0x1e00aa[_0x549f('0xc')])throw new Error(_0x549f('0x13'));var _0x1ed06c=_0x1e00aa[_0x549f('0x12')];return _0x55b758(_[_0x549f('0x14')]({},_0x166b4b,_0x1ed06c));});})[_0x549f('0x15')](function(_0x2ae355){_0x12bb91(_0x2ae355);});});}function getRealtimeQueues(_0x34ac90,_0x2e6fae){return new Promise(function(_0x55d318,_0x2eff81){var _0x5300ed=_0x2e6fae===_0x549f('0x16')?amiClient:routingClient;return _0x5300ed[_0x549f('0xf')](_[_0x549f('0x17')](_0x2e6fae)+_0x549f('0x18'),_0x34ac90)[_0x549f('0x11')](function(_0x26ab05){if(_0x26ab05['error'])throw new Error(util[_0x549f('0x19')](_0x549f('0x1a'),_0x2e6fae));return _0x55d318(_0x26ab05['result']);})['catch'](function(_0x47c42b){_0x2eff81(_0x47c42b);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x438eab,_0x1c6d6f){return amiClient[_0x549f('0xf')](_0x549f('0x1b'),{})[_0x549f('0x11')](function(_0x5c345b){if(_0x5c345b['error'])throw new Error(_0x549f('0x1c'));return _0x438eab(_0x5c345b['result']);})[_0x549f('0x15')](function(_0x51feed){_0x1c6d6f(_0x51feed);});});}function initializeQueues(_0xcbba39,_0x23dce9,_0x59a05a,_0x409a20){var _0x5a6810=[_0x549f('0x1d'),_0x549f('0x1e'),_0x549f('0x1f'),'talking',_0x549f('0x20')];if(_0x59a05a===_0x549f('0x16')&&_0x409a20===_0x549f('0x21')){_0x5a6810['push'](_0x549f('0x22'),_0x549f('0x23'),_0x549f('0x24'),'dialActive',_0x549f('0x25'),'Trunk','startPredictive',_0x549f('0x26'),_0x549f('0x27'),_0x549f('0x28'),_0x549f('0x29'),_0x549f('0x2a'),_0x549f('0x2b'),'dialPredictiveIntervalMaxThreshold',_0x549f('0x2c'),_0x549f('0x2d'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x549f('0x2e'));}return _0xcbba39[_0x549f('0x2f')](function(_0x115357){var _0x279b2f=_0x115357['get']({'plain':!![]});_0x279b2f[_0x549f('0x30')]=[];_0x279b2f['paused']=0x0;_0x279b2f['loggedInDb']=0x0;_0x279b2f[_0x549f('0x1d')]=0x0;_0x279b2f[_0x549f('0x1e')]=0x0;_0x279b2f['waiting']=0x0;if(_0x59a05a===_0x549f('0x16')){_0x279b2f['talking']=0x0;_0x279b2f['busy']=0x0;if(_0x409a20===_0x549f('0x21')){_0x279b2f[_0x549f('0x22')]=0x0;_0x279b2f[_0x549f('0x23')]=0x0;}}var _0x19b8e8=_[_0x549f('0x31')](_0x23dce9,['id',_0x279b2f['id']]);if(_0x19b8e8)_[_0x549f('0x14')](_0x279b2f,_['pick'](_0x19b8e8,_0x5a6810));return _0x279b2f;});}function updateAgentVoiceStatus(_0x494780,_0x2a5729,_0x1446a2){var _0x1ea9a2=_[_0x549f('0x32')](_0x1446a2,[_0x549f('0x33'),_0x2a5729['name']]);if(_0x1ea9a2['length']===0x0)return _0x494780[_0x549f('0x34')]=!![];if(_['some'](_0x1ea9a2,['connectedlinenum',_0x494780[_0x549f('0x35')][_0x549f('0x36')]()]))return _0x494780['talking']=!![];if(!_0x494780[_0x549f('0x37')])return _0x494780[_0x549f('0x34')]=!![];}function getVoiceQueueAgents(_0xd72332,_0x4b7d34,_0x39d48,_0xfdb386){var _0x4cf95c=_[_0x549f('0x31')](_0x4b7d34,['id',_0xd72332['id']]);if(!_0x4cf95c)return _0xd72332;return _0x4cf95c[_0x549f('0x38')]({'raw':!![]})[_0x549f('0x11')](function(_0xdb76a9){for(var _0xd73dc8=0x0;_0xd73dc8<_0xdb76a9[_0x549f('0x39')];_0xd73dc8++){var _0x3ed694=_['find'](_0x39d48,['id',_0xdb76a9[_0xd73dc8][_0x549f('0x3a')]]);if(!_0x3ed694){_0x3ed694={'id':_0xdb76a9[_0xd73dc8][_0x549f('0x3a')],'name':_0xdb76a9[_0xd73dc8][_0x549f('0x3a')],'accountcode':'','online':![]};}var _0x5dfc9e={'id':_0x3ed694['id'],'name':_0x3ed694[_0x549f('0xe')],'internal':_0x3ed694[_0x549f('0x3b')],'online':Boolean(_0x3ed694[_0x549f('0x3c')]),'paused':Boolean(_0xdb76a9[_0xd73dc8][_0x549f('0x20')])};if(_0x3ed694[_0x549f('0x3d')]===_0x549f('0x37'))updateAgentVoiceStatus(_0x5dfc9e,_0xd72332,_0xfdb386);if(_0x5dfc9e['online'])_0xd72332[_0x549f('0x3e')]++;if(_0x5dfc9e[_0x549f('0x34')])_0xd72332['busy']++;if(_0x5dfc9e[_0x549f('0x20')]&&!_0x5dfc9e[_0x549f('0x34')]&&!_0x5dfc9e[_0x549f('0x37')])_0xd72332[_0x549f('0x20')]++;_0xd72332['agents']['push'](_0x5dfc9e);}return _0xd72332;});}function getQueueAgents(_0x232d60,_0xec6fa0,_0x28a1c2){var _0x55dd55=_0x549f('0x3f')+_[_0x549f('0x17')](_0x28a1c2)+'Queue';var _0x226d0f=_0x28a1c2+_0x549f('0x40');return db[_0x55dd55][_0x549f('0x41')]({'where':{[_[_0x549f('0x17')](_0x28a1c2)+_0x549f('0x42')]:_0x232d60['id']},'raw':!![]})['then'](function(_0x1d2769){for(var _0x31bdb8=0x0;_0x31bdb8<_0x1d2769[_0x549f('0x39')];_0x31bdb8++){var _0x381fa3=_[_0x549f('0x31')](_0xec6fa0,['id',_0x1d2769[_0x31bdb8]['UserId']]);if(!_0x381fa3){_0x381fa3={'id':_0x1d2769[_0x31bdb8][_0x549f('0x3a')],'name':_0x1d2769[_0x31bdb8][_0x549f('0x3a')],'online':![],['pauseField']:![]};}var _0x3eb052={'id':_0x381fa3['id'],'name':_0x381fa3[_0x549f('0xe')],'online':Boolean(_0x381fa3['online']),'paused':Boolean(_0x381fa3[_0x226d0f])};if(_0x3eb052[_0x549f('0x3c')])_0x232d60['loggedInDb']++;_0x232d60['agents'][_0x549f('0x43')](_0x3eb052);}return _0x232d60;});}exports[_0x549f('0x44')]=function(_0x33a256,_0x149de2){var _0x2b5eb6=[_0x549f('0x45'),_0x549f('0x46'),_0x549f('0x47'),_0x549f('0x48'),_0x549f('0x49'),_0x549f('0x4a'),'voice'];var _0x42e7f4={'count':0x0,'rows':[]},_0x2880ae={},_0x27815f,_0x3912fa,_0x3800ae,_0x27f125,_0xf98b8c;Promise['resolve']()[_0x549f('0x11')](function(){if(_0x33a256[_0x549f('0x4b')]['channel']){if(!_[_0x549f('0x4c')](_0x2b5eb6,_0x33a256['query'][_0x549f('0x4d')][_0x549f('0x4e')]()))throw new Error(_0x549f('0x4f'));_0x27815f=_0x33a256[_0x549f('0x4b')][_0x549f('0x4d')][_0x549f('0x4e')]();}var _0x17e287=_[_0x549f('0x17')](_0x27815f)+_0x549f('0x50');var _0x43fb54=_[_0x549f('0x2f')](db[_0x17e287][_0x549f('0x51')],function(_0x50c64d){return{'name':_0x50c64d[_0x549f('0x52')],'type':_0x50c64d[_0x549f('0x53')][_0x549f('0x54')]};});_0x2880ae=qs[_0x549f('0x55')](_0x43fb54,_0x33a256);if(_0x33a256[_0x549f('0x56')][_0x549f('0x57')]===_0x549f('0x56')){var _0x526329={'params':{'id':_0x33a256[_0x549f('0x56')][_0x549f('0x58')]},'query':{'section':_0x27815f===_0x549f('0x16')&&_0x33a256[_0x549f('0x4b')][_0x549f('0x53')]==='outbound'?_0x549f('0x59'):_[_0x549f('0x17')](_0x27815f)+_0x549f('0x18'),'type':_0x33a256[_0x549f('0x4b')][_0x549f('0x53')],'nolimit':!![],'sort':_0x549f('0xe'),'filter':_0x33a256[_0x549f('0x4b')][_0x549f('0x32')]}};return db['UserProfile'][_0x549f('0x5a')](_0x526329);}return db[_0x17e287][_0x549f('0x5b')](_0x2880ae);})[_0x549f('0x11')](function(_0x274a08){_0x42e7f4[_0x549f('0x8')]=_0x274a08[_0x549f('0x8')];_0x3912fa=_0x274a08[_0x549f('0x5c')];return getRealtimeQueues(_0x33a256,_0x27815f);})[_0x549f('0x11')](function(_0xb354c){_0x27f125=_0xb354c['rows'];return getRealtimeAgents();})[_0x549f('0x11')](function(_0xd31ef7){_0x3800ae=_0xd31ef7[_0x549f('0x5c')];if(_0x27815f!=_0x549f('0x16'))return;return getRealtimeVoiceQueueChannels();})[_0x549f('0x11')](function(_0x2b52d9){_0xf98b8c=_0x2b52d9?_0x2b52d9['rows']:[];return initializeQueues(_0x3912fa,_0x27f125,_0x27815f,_0x33a256[_0x549f('0x4b')][_0x549f('0x53')]);})[_0x549f('0x11')](function(_0x219ace){var _0x5957d7=_0x219ace[_0x549f('0x2f')](function(_0x5aef46){if(_0x27815f===_0x549f('0x16'))return getVoiceQueueAgents(_0x5aef46,_0x3912fa,_0x3800ae,_0xf98b8c);else return getQueueAgents(_0x5aef46,_0x3800ae,_0x27815f);});return Promise[_0x549f('0x5d')](_0x5957d7);})[_0x549f('0x11')](function(_0x26b683){_0x42e7f4[_0x549f('0x5c')]=_0x26b683;return _0x42e7f4;})[_0x549f('0x11')](respondWithFilteredResult(_0x149de2,_0x2880ae))[_0x549f('0x15')](handleError(_0x149de2,null));}; \ No newline at end of file +var _0x1295=['Queue','findAll','QueueId','online','mail','chat','sms','openchannel','fax','channel','includes','toLowerCase','Invalid\x20channel','query','rawAttributes','fieldName','type','key','user','userProfileId','QueueCampaigns','UserProfile','rows','util','lodash','../../config/logger','api','../../mysqldb','client','http','offset','limit','undefined','count','status','set','error','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','voice','startCase','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','outbound','push','pTalking','originated','message','dialMethod','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','paused','loggedInDb','talking','find','pick','filter','queue','length','busy','some','connectedlinenum','internal','toString','UserId','accountcode','User'];(function(_0x2ae00e,_0x232e88){var _0x1fc16f=function(_0x26f0cf){while(--_0x26f0cf){_0x2ae00e['push'](_0x2ae00e['shift']());}};_0x1fc16f(++_0x232e88);}(_0x1295,0x1ed));var _0x5129=function(_0x4d26c4,_0x3583da){_0x4d26c4=_0x4d26c4-0x0;var _0x541834=_0x1295[_0x4d26c4];return _0x541834;};'use strict';var util=require(_0x5129('0x0'));var _=require(_0x5129('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x5129('0x2'))(_0x5129('0x3'));var db=require(_0x5129('0x4'))['db'];var amiClient=jayson[_0x5129('0x5')][_0x5129('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0x5129('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x226428,_0x2c04bb){return function(_0x4be677){if(_0x4be677){var _0x1160bc=typeof _0x2c04bb[_0x5129('0x7')]==='undefined'&&typeof _0x2c04bb[_0x5129('0x8')]===_0x5129('0x9');var _0x36c3f3=_0x4be677['count'];var _0xe7cb11=_0x1160bc?0x0:_0x2c04bb['offset'];var _0x151113=_0x1160bc?_0x4be677[_0x5129('0xa')]:_0x2c04bb[_0x5129('0x7')]+_0x2c04bb[_0x5129('0x8')];var _0x2242c0;if(_0x151113>=_0x36c3f3){_0x151113=_0x36c3f3;_0x2242c0=0xc8;}else{_0x2242c0=0xce;}_0x226428[_0x5129('0xb')](_0x2242c0);return _0x226428[_0x5129('0xc')]('Content-Range',_0xe7cb11+'-'+_0x151113+'/'+_0x36c3f3)['json'](_0x4be677);}return null;};}function handleError(_0x5f7239,_0x357ddf){_0x357ddf=_0x357ddf||0x1f4;return function(_0x5ddafb){logger[_0x5129('0xd')](_0x5ddafb['stack']);if(_0x5ddafb['name']){delete _0x5ddafb[_0x5129('0xe')];}_0x5f7239[_0x5129('0xb')](_0x357ddf)[_0x5129('0xf')](_0x5ddafb);};}function getRealtimeAgents(){return new Promise(function(_0x18cf3a,_0x472d71){return amiClient[_0x5129('0x10')](_0x5129('0x11'),{})[_0x5129('0x12')](function(_0x276ccd){if(_0x276ccd[_0x5129('0xd')])throw new Error(_0x5129('0x13'));var _0x42cde4=_0x276ccd[_0x5129('0x14')];return routingClient['request']('Agents',{})[_0x5129('0x12')](function(_0x24f905){if(_0x24f905[_0x5129('0xd')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x1adf0b=_0x24f905[_0x5129('0x14')];return _0x18cf3a(_[_0x5129('0x15')]({},_0x42cde4,_0x1adf0b));});})[_0x5129('0x16')](function(_0x12c318){_0x472d71(_0x12c318);});});}function getRealtimeQueues(_0x50b43f,_0x5bd071){return new Promise(function(_0x55e221,_0x2a87c6){var _0x1db0bb=_0x5bd071===_0x5129('0x17')?amiClient:routingClient;return _0x1db0bb[_0x5129('0x10')](_[_0x5129('0x18')](_0x5bd071)+'Queues',_0x50b43f)[_0x5129('0x12')](function(_0x2b9ff3){if(_0x2b9ff3[_0x5129('0xd')])throw new Error(util[_0x5129('0x19')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x5bd071));return _0x55e221(_0x2b9ff3[_0x5129('0x14')]);})[_0x5129('0x16')](function(_0x332581){_0x2a87c6(_0x332581);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x39f755,_0x486a00){return amiClient[_0x5129('0x10')](_0x5129('0x1a'),{})[_0x5129('0x12')](function(_0x222d6c){if(_0x222d6c[_0x5129('0xd')])throw new Error(_0x5129('0x1b'));return _0x39f755(_0x222d6c['result']);})[_0x5129('0x16')](function(_0x16fc81){_0x486a00(_0x16fc81);});});}function initializeQueues(_0x46ad03,_0x5c5c3d,_0x15b048,_0x186c21){var _0x42dff8=[_0x5129('0x1c'),_0x5129('0x1d'),_0x5129('0x1e'),'talking','paused'];if(_0x15b048===_0x5129('0x17')&&_0x186c21===_0x5129('0x1f')){_0x42dff8[_0x5129('0x20')](_0x5129('0x21'),_0x5129('0x22'),_0x5129('0x23'),'dialActive',_0x5129('0x24'),_0x5129('0x25'),'startPredictive',_0x5129('0x26'),'erlangCalls',_0x5129('0x27'),_0x5129('0x28'),_0x5129('0x29'),_0x5129('0x2a'),_0x5129('0x2b'),_0x5129('0x2c'),_0x5129('0x2d'),_0x5129('0x2e'),_0x5129('0x2f'),_0x5129('0x30'),_0x5129('0x31'),_0x5129('0x32'),_0x5129('0x33'));}return _0x46ad03[_0x5129('0x34')](function(_0x15c202){var _0x1a6b45=_0x15c202[_0x5129('0x35')]({'plain':!![]});_0x1a6b45[_0x5129('0x36')]=[];_0x1a6b45[_0x5129('0x37')]=0x0;_0x1a6b45[_0x5129('0x38')]=0x0;_0x1a6b45[_0x5129('0x1c')]=0x0;_0x1a6b45['available']=0x0;_0x1a6b45[_0x5129('0x1e')]=0x0;if(_0x15b048===_0x5129('0x17')){_0x1a6b45[_0x5129('0x39')]=0x0;_0x1a6b45['busy']=0x0;if(_0x186c21===_0x5129('0x1f')){_0x1a6b45[_0x5129('0x21')]=0x0;_0x1a6b45[_0x5129('0x22')]=0x0;}}var _0x38e20a=_[_0x5129('0x3a')](_0x5c5c3d,['id',_0x1a6b45['id']]);if(_0x38e20a)_['merge'](_0x1a6b45,_[_0x5129('0x3b')](_0x38e20a,_0x42dff8));return _0x1a6b45;});}function updateAgentVoiceStatus(_0x47fc74,_0x51ac8b,_0x364b1b){var _0x989f1d=_[_0x5129('0x3c')](_0x364b1b,[_0x5129('0x3d'),_0x51ac8b[_0x5129('0xe')]]);if(_0x989f1d[_0x5129('0x3e')]===0x0)return _0x47fc74[_0x5129('0x3f')]=!![];if(_[_0x5129('0x40')](_0x989f1d,[_0x5129('0x41'),_0x47fc74[_0x5129('0x42')][_0x5129('0x43')]()]))return _0x47fc74[_0x5129('0x39')]=!![];if(!_0x47fc74['talking'])return _0x47fc74[_0x5129('0x3f')]=!![];}function getVoiceQueueAgents(_0x14dd0b,_0x1258d5,_0xe77c61,_0xa135af){var _0x37a984=_[_0x5129('0x3a')](_0x1258d5,['id',_0x14dd0b['id']]);if(!_0x37a984)return _0x14dd0b;return _0x37a984['getMembers']({'raw':!![]})[_0x5129('0x12')](function(_0x3e7870){for(var _0x103101=0x0;_0x103101<_0x3e7870[_0x5129('0x3e')];_0x103101++){var _0x1dfbf0=_[_0x5129('0x3a')](_0xe77c61,['id',_0x3e7870[_0x103101][_0x5129('0x44')]]);if(!_0x1dfbf0){_0x1dfbf0={'id':_0x3e7870[_0x103101][_0x5129('0x44')],'name':_0x3e7870[_0x103101][_0x5129('0x44')],'accountcode':'','online':![]};}var _0x17f00f={'id':_0x1dfbf0['id'],'name':_0x1dfbf0[_0x5129('0xe')],'internal':_0x1dfbf0[_0x5129('0x45')],'online':Boolean(_0x1dfbf0['online']),'paused':Boolean(_0x3e7870[_0x103101][_0x5129('0x37')])};if(_0x1dfbf0['voiceStatus']===_0x5129('0x39'))updateAgentVoiceStatus(_0x17f00f,_0x14dd0b,_0xa135af);if(_0x17f00f['online'])_0x14dd0b[_0x5129('0x38')]++;if(_0x17f00f['busy'])_0x14dd0b['busy']++;if(_0x17f00f[_0x5129('0x37')]&&!_0x17f00f['busy']&&!_0x17f00f[_0x5129('0x39')])_0x14dd0b[_0x5129('0x37')]++;_0x14dd0b[_0x5129('0x36')][_0x5129('0x20')](_0x17f00f);}return _0x14dd0b;});}function getQueueAgents(_0x223451,_0x4a29a0,_0x583207){var _0x382b85=_0x5129('0x46')+_[_0x5129('0x18')](_0x583207)+_0x5129('0x47');var _0x5ac64b=_0x583207+'Pause';return db[_0x382b85][_0x5129('0x48')]({'where':{[_[_0x5129('0x18')](_0x583207)+_0x5129('0x49')]:_0x223451['id']},'raw':!![]})[_0x5129('0x12')](function(_0x484f8d){for(var _0x4b2fee=0x0;_0x4b2fee<_0x484f8d['length'];_0x4b2fee++){var _0x4121de=_['find'](_0x4a29a0,['id',_0x484f8d[_0x4b2fee][_0x5129('0x44')]]);if(!_0x4121de){_0x4121de={'id':_0x484f8d[_0x4b2fee][_0x5129('0x44')],'name':_0x484f8d[_0x4b2fee][_0x5129('0x44')],'online':![],['pauseField']:![]};}var _0x3b30da={'id':_0x4121de['id'],'name':_0x4121de[_0x5129('0xe')],'online':Boolean(_0x4121de[_0x5129('0x4a')]),'paused':Boolean(_0x4121de[_0x5ac64b])};if(_0x3b30da['online'])_0x223451[_0x5129('0x38')]++;_0x223451['agents'][_0x5129('0x20')](_0x3b30da);}return _0x223451;});}exports['getQueues']=function(_0x2ba632,_0x26883f){var _0x5b0183=[_0x5129('0x4b'),_0x5129('0x4c'),_0x5129('0x4d'),_0x5129('0x4e'),_0x5129('0x4f'),'whatsapp',_0x5129('0x17')];var _0x463934={'count':0x0,'rows':[]},_0x1b47f7={},_0x12356b,_0x4d8a38,_0x4bd6d9,_0x123cc7,_0x34153f;Promise['resolve']()[_0x5129('0x12')](function(){if(_0x2ba632['query'][_0x5129('0x50')]){if(!_[_0x5129('0x51')](_0x5b0183,_0x2ba632['query']['channel'][_0x5129('0x52')]()))throw new Error(_0x5129('0x53'));_0x12356b=_0x2ba632[_0x5129('0x54')][_0x5129('0x50')]['toLowerCase']();}var _0x578e5f=_[_0x5129('0x18')](_0x12356b)+'Queue';var _0x1e6e03=_[_0x5129('0x34')](db[_0x578e5f][_0x5129('0x55')],function(_0x8b90a9){return{'name':_0x8b90a9[_0x5129('0x56')],'type':_0x8b90a9[_0x5129('0x57')][_0x5129('0x58')]};});_0x1b47f7=qs['getOptions'](_0x1e6e03,_0x2ba632);if(_0x2ba632[_0x5129('0x59')]['role']===_0x5129('0x59')){var _0x50986c={'params':{'id':_0x2ba632[_0x5129('0x59')][_0x5129('0x5a')]},'query':{'section':_0x12356b==='voice'&&_0x2ba632[_0x5129('0x54')][_0x5129('0x57')]===_0x5129('0x1f')?_0x5129('0x5b'):_['startCase'](_0x12356b)+'Queues','type':_0x2ba632[_0x5129('0x54')]['type'],'nolimit':!![],'sort':_0x5129('0xe'),'filter':_0x2ba632[_0x5129('0x54')]['filter']}};return db[_0x5129('0x5c')]['getResources'](_0x50986c);}return db[_0x578e5f]['findAndCountAll'](_0x1b47f7);})[_0x5129('0x12')](function(_0xf869c5){_0x463934[_0x5129('0xa')]=_0xf869c5['count'];_0x4d8a38=_0xf869c5[_0x5129('0x5d')];return getRealtimeQueues(_0x2ba632,_0x12356b);})['then'](function(_0x44707e){_0x123cc7=_0x44707e[_0x5129('0x5d')];return getRealtimeAgents();})[_0x5129('0x12')](function(_0x4dfa14){_0x4bd6d9=_0x4dfa14[_0x5129('0x5d')];if(_0x12356b!=_0x5129('0x17'))return;return getRealtimeVoiceQueueChannels();})[_0x5129('0x12')](function(_0x2d2bab){_0x34153f=_0x2d2bab?_0x2d2bab['rows']:[];return initializeQueues(_0x4d8a38,_0x123cc7,_0x12356b,_0x2ba632[_0x5129('0x54')][_0x5129('0x57')]);})[_0x5129('0x12')](function(_0x5364cd){var _0x490c96=_0x5364cd['map'](function(_0x278018){if(_0x12356b===_0x5129('0x17'))return getVoiceQueueAgents(_0x278018,_0x4d8a38,_0x4bd6d9,_0x34153f);else return getQueueAgents(_0x278018,_0x4bd6d9,_0x12356b);});return Promise['all'](_0x490c96);})[_0x5129('0x12')](function(_0x266076){_0x463934[_0x5129('0x5d')]=_0x266076;return _0x463934;})['then'](respondWithFilteredResult(_0x26883f,_0x1b47f7))[_0x5129('0x16')](handleError(_0x26883f,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d903f6b..b860b9c 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(_0x405296,_0x359325){var _0x5a33c1=function(_0x52f6b6){while(--_0x52f6b6){_0x405296['push'](_0x405296['shift']());}};_0x5a33c1(++_0x359325);}(_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(_0x48717c,_0x28c558){var _0x24ecab=function(_0x4d037a){while(--_0x4d037a){_0x48717c['push'](_0x48717c['shift']());}};_0x24ecab(++_0x28c558);}(_0x70e0,0x17b));var _0x070e=function(_0x266ca8,_0x50230d){_0x266ca8=_0x266ca8-0x0;var _0x552bf8=_0x70e0[_0x266ca8];return _0x552bf8;};'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 4c4d452..148f477 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 _0x7dfd=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x172c33,_0x4f53c7){var _0x356267=function(_0x41b68b){while(--_0x41b68b){_0x172c33['push'](_0x172c33['shift']());}};_0x356267(++_0x4f53c7);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'state':{'type':Sequelize[_0xd7df('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd7df('0x3')]},'scheduledat':{'type':Sequelize[_0xd7df('0x4')]},'uniqueid':{'type':Sequelize[_0xd7df('0x3')]},'starttime':{'type':Sequelize[_0xd7df('0x4')]},'responsetime':{'type':Sequelize[_0xd7df('0x4')]},'ringtime':{'type':Sequelize[_0xd7df('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd7df('0x3')]},'campaigntype':{'type':Sequelize[_0xd7df('0x3')]},'membername':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0xcf98=['DATE','exports','INTEGER','STRING'];(function(_0x5b1078,_0x16c786){var _0x28bc87=function(_0x45707f){while(--_0x45707f){_0x5b1078['push'](_0x5b1078['shift']());}};_0x28bc87(++_0x16c786);}(_0xcf98,0x8d));var _0x8cf9=function(_0x3ba158,_0x3bc5dd){_0x3ba158=_0x3ba158-0x0;var _0x13f546=_0xcf98[_0x3ba158];return _0x13f546;};'use strict';var Sequelize=require('sequelize');module[_0x8cf9('0x0')]={'state':{'type':Sequelize[_0x8cf9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8cf9('0x2')]},'scheduledat':{'type':Sequelize[_0x8cf9('0x3')]},'uniqueid':{'type':Sequelize[_0x8cf9('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8cf9('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8cf9('0x2')]},'campaigntype':{'type':Sequelize[_0x8cf9('0x2')]},'membername':{'type':Sequelize[_0x8cf9('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6ea06fe..0e9b0ac 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 _0xac33=['../../config/logger','api','moment','bluebird','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x576196,_0x4f442d){var _0x354252=function(_0x372e1f){while(--_0x372e1f){_0x576196['push'](_0x576196['shift']());}};_0x354252(++_0x4f442d);}(_0xac33,0x153));var _0x3ac3=function(_0x5d2ccd,_0x4a1d96){_0x5d2ccd=_0x5d2ccd-0x0;var _0x4ce5f3=_0xac33[_0x5d2ccd];return _0x4ce5f3;};'use strict';var _=require(_0x3ac3('0x0'));var util=require(_0x3ac3('0x1'));var logger=require(_0x3ac3('0x2'))(_0x3ac3('0x3'));var moment=require(_0x3ac3('0x4'));var BPromise=require(_0x3ac3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3ac3('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ac3('0x7'));module['exports']=function(_0x32d745,_0x25b8ef){return _0x32d745[_0x3ac3('0x8')](_0x3ac3('0x9'),attributes,{'tableName':_0x3ac3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc06b=['rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3592c6,_0x4ab3b9){var _0x29396b=function(_0x16653d){while(--_0x16653d){_0x3592c6['push'](_0x3592c6['shift']());}};_0x29396b(++_0x4ab3b9);}(_0xc06b,0x1cd));var _0xbc06=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xc06b[_0x4709c8];return _0x478cdd;};'use strict';var _=require(_0xbc06('0x0'));var util=require('util');var logger=require(_0xbc06('0x1'))(_0xbc06('0x2'));var moment=require(_0xbc06('0x3'));var BPromise=require(_0xbc06('0x4'));var rp=require(_0xbc06('0x5'));var fs=require('fs');var path=require(_0xbc06('0x6'));var rimraf=require(_0xbc06('0x7'));var config=require(_0xbc06('0x8'));var attributes=require(_0xbc06('0x9'));module['exports']=function(_0x2d4b3f,_0x31afe3){return _0x2d4b3f['define'](_0xbc06('0xa'),attributes,{'tableName':_0xbc06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 7744120..0b8e07d 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 _0x9c69=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','then','stringify','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9c69,0x149));var _0x99c6=function(_0x1522db,_0x7efece){_0x1522db=_0x1522db-0x0;var _0x165585=_0x9c69[_0x1522db];return _0x165585;};'use strict';var _=require(_0x99c6('0x0'));var util=require(_0x99c6('0x1'));var moment=require(_0x99c6('0x2'));var BPromise=require(_0x99c6('0x3'));var rs=require(_0x99c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x99c6('0x5'));var logger=require(_0x99c6('0x6'))(_0x99c6('0x7'));var config=require(_0x99c6('0x8'));var jayson=require(_0x99c6('0x9'));var client=jayson[_0x99c6('0xa')][_0x99c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b3afc,_0x6f2834,_0xe3607d){return new BPromise(function(_0x5af6d5,_0x3987e2){return client[_0x99c6('0xc')](_0x1b3afc,_0xe3607d)['then'](function(_0x5a10be){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x6f2834,_0x99c6('0xd'));logger[_0x99c6('0xe')](_0x99c6('0xf'),_0x6f2834,'request\x20sent',JSON['stringify'](_0x5a10be));if(_0x5a10be[_0x99c6('0x10')]){if(_0x5a10be[_0x99c6('0x10')][_0x99c6('0x11')]===0x1f4){logger[_0x99c6('0x10')](_0x99c6('0x12'),_0x6f2834,_0x5a10be[_0x99c6('0x10')][_0x99c6('0x13')]);return _0x3987e2(_0x5a10be[_0x99c6('0x10')][_0x99c6('0x13')]);}logger[_0x99c6('0x10')](_0x99c6('0x12'),_0x6f2834,_0x5a10be[_0x99c6('0x10')]['message']);return _0x5af6d5(_0x5a10be[_0x99c6('0x10')]['message']);}else{logger[_0x99c6('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x6f2834,_0x99c6('0xd'));_0x5af6d5(_0x5a10be['result'][_0x99c6('0x13')]);}})[_0x99c6('0x15')](function(_0x415b2a){logger['error'](_0x99c6('0x12'),_0x6f2834,_0x415b2a);_0x3987e2(_0x415b2a);});});}exports[_0x99c6('0x16')]=function(_0x434a71){var _0x1176e3=this;return new Promise(function(_0x25b615,_0x4ad714){return db[_0x99c6('0x17')][_0x99c6('0x18')](_0x434a71[_0x99c6('0x19')],{'raw':_0x434a71[_0x99c6('0x1a')]?_0x434a71['options'][_0x99c6('0x1b')]===undefined?!![]:![]:!![]})[_0x99c6('0x1c')](function(_0xd894e4){logger[_0x99c6('0x14')](_0x99c6('0x16'),_0x434a71);logger[_0x99c6('0xe')]('CreateReportAgentPreview',_0x434a71,JSON[_0x99c6('0x1d')](_0xd894e4));_0x25b615(_0xd894e4);})[_0x99c6('0x15')](function(_0x3f405e){logger[_0x99c6('0x10')]('CreateReportAgentPreview',_0x3f405e['message'],_0x434a71);_0x4ad714(_0x1176e3[_0x99c6('0x10')](0x1f4,_0x3f405e[_0x99c6('0x13')]));});});}; \ No newline at end of file +var _0x5af7=['then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x57d628,_0xda6747){var _0x2f8486=function(_0x5f2cba){while(--_0x5f2cba){_0x57d628['push'](_0x57d628['shift']());}};_0x2f8486(++_0xda6747);}(_0x5af7,0xf2));var _0x75af=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x5af7[_0x4a3898];return _0x25ceb0;};'use strict';var _=require('lodash');var util=require(_0x75af('0x0'));var moment=require(_0x75af('0x1'));var BPromise=require(_0x75af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75af('0x3'));var db=require(_0x75af('0x4'))['db'];var utils=require(_0x75af('0x5'));var logger=require(_0x75af('0x6'))('rpc');var config=require(_0x75af('0x7'));var jayson=require(_0x75af('0x8'));var client=jayson['client'][_0x75af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e58bb,_0x142f70,_0x3fedb3){return new BPromise(function(_0x54d22e,_0x3e3db2){return client['request'](_0x1e58bb,_0x3fedb3)[_0x75af('0xa')](function(_0x42ff93){logger['info'](_0x75af('0xb'),_0x142f70,'request\x20sent');logger[_0x75af('0xc')](_0x75af('0xd'),_0x142f70,_0x75af('0xe'),JSON[_0x75af('0xf')](_0x42ff93));if(_0x42ff93[_0x75af('0x10')]){if(_0x42ff93[_0x75af('0x10')][_0x75af('0x11')]===0x1f4){logger[_0x75af('0x10')](_0x75af('0xb'),_0x142f70,_0x42ff93[_0x75af('0x10')]['message']);return _0x3e3db2(_0x42ff93['error'][_0x75af('0x12')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x142f70,_0x42ff93[_0x75af('0x10')][_0x75af('0x12')]);return _0x54d22e(_0x42ff93[_0x75af('0x10')][_0x75af('0x12')]);}else{logger[_0x75af('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x142f70,_0x75af('0xe'));_0x54d22e(_0x42ff93[_0x75af('0x14')][_0x75af('0x12')]);}})['catch'](function(_0x13c7bd){logger[_0x75af('0x10')](_0x75af('0xb'),_0x142f70,_0x13c7bd);_0x3e3db2(_0x13c7bd);});});}exports[_0x75af('0x15')]=function(_0xb2a4b0){var _0x3487d2=this;return new Promise(function(_0x2e02ff,_0x16df21){return db[_0x75af('0x16')][_0x75af('0x17')](_0xb2a4b0[_0x75af('0x18')],{'raw':_0xb2a4b0[_0x75af('0x19')]?_0xb2a4b0['options'][_0x75af('0x1a')]===undefined?!![]:![]:!![]})[_0x75af('0xa')](function(_0x4fca30){logger['info'](_0x75af('0x15'),_0xb2a4b0);logger[_0x75af('0xc')]('CreateReportAgentPreview',_0xb2a4b0,JSON['stringify'](_0x4fca30));_0x2e02ff(_0x4fca30);})[_0x75af('0x1b')](function(_0xc87fce){logger[_0x75af('0x10')]('CreateReportAgentPreview',_0xc87fce[_0x75af('0x12')],_0xb2a4b0);_0x16df21(_0x3487d2[_0x75af('0x10')](0x1f4,_0xc87fce[_0x75af('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 092a1ed..0ee905b 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 _0xe9a5=['/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xe9a5,0xc1));var _0x5e9a=function(_0x15fa16,_0x5ae78c){_0x15fa16=_0x15fa16-0x0;var _0x5b4429=_0xe9a5[_0x15fa16];return _0x5b4429;};'use strict';var multer=require(_0x5e9a('0x0'));var util=require(_0x5e9a('0x1'));var path=require('path');var express=require(_0x5e9a('0x2'));var router=express['Router']();var auth=require(_0x5e9a('0x3'));var controller=require(_0x5e9a('0x4'));router[_0x5e9a('0x5')](_0x5e9a('0x6'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x8')]);router[_0x5e9a('0x5')](_0x5e9a('0x9'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x5e9a('0x7')](),controller[_0x5e9a('0xb')]);router[_0x5e9a('0x5')](_0x5e9a('0xc'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0xd')]);router[_0x5e9a('0x5')](_0x5e9a('0xe'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0xf')]);router[_0x5e9a('0x5')](_0x5e9a('0x10'),auth['isAuthenticated'](),controller[_0x5e9a('0x11')]);router['get'](_0x5e9a('0x12'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x13')]);router['get'](_0x5e9a('0x14'),auth[_0x5e9a('0x7')](),controller['openchannelQueues']);router['get'](_0x5e9a('0x15'),auth['isAuthenticated'](),controller[_0x5e9a('0x16')]);router[_0x5e9a('0x5')](_0x5e9a('0x17'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x18')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0x5e9a('0x19')]);router[_0x5e9a('0x5')](_0x5e9a('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x5e9a('0x1b'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x1c')]);router[_0x5e9a('0x5')](_0x5e9a('0x1d'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x1e')]);router[_0x5e9a('0x5')](_0x5e9a('0x1f'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x20')]);router[_0x5e9a('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5e9a('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x5e9a('0x5')]('/voice/queues/:id',auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x21')]);router[_0x5e9a('0x22')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x5e9a('0x23')]);router[_0x5e9a('0x5')]('/outbound',auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x24')]);router[_0x5e9a('0x5')](_0x5e9a('0x25'),auth['isAuthenticated'](),controller[_0x5e9a('0x26')]);router[_0x5e9a('0x5')](_0x5e9a('0x27'),auth[_0x5e9a('0x7')](),controller['agents']);router[_0x5e9a('0x22')](_0x5e9a('0x28'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x29')]);router[_0x5e9a('0x5')](_0x5e9a('0x2a'),auth['isAuthenticated'](),controller[_0x5e9a('0x2b')]);router[_0x5e9a('0x5')](_0x5e9a('0x2c'),auth['isAuthenticated'](),controller[_0x5e9a('0x2d')]);router[_0x5e9a('0x5')](_0x5e9a('0x2e'),auth['isAuthenticated'](),controller[_0x5e9a('0x2f')]);router['get'](_0x5e9a('0x30'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x31')]);router[_0x5e9a('0x5')](_0x5e9a('0x32'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x33')]);router['get'](_0x5e9a('0x34'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x35')]);router[_0x5e9a('0x5')](_0x5e9a('0x36'),auth['isAuthenticated'](),controller[_0x5e9a('0x37')]);router['get'](_0x5e9a('0x38'),auth[_0x5e9a('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x5e9a('0x39'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x3a')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x5e9a('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x5e9a('0x5')]('/fax/queues/waitinginteractions',auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x3b')]);router['post'](_0x5e9a('0x3c'),auth['isAuthenticated'](),controller['queueNotify'](_0x5e9a('0x3d')));router['get']('/mail/queues/:id',auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x3e')]);router['post'](_0x5e9a('0x3f'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x40')](_0x5e9a('0x41')));router['get'](_0x5e9a('0x42'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x43')]);router[_0x5e9a('0x44')](_0x5e9a('0x45'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x40')](_0x5e9a('0x46')));router[_0x5e9a('0x5')](_0x5e9a('0x47'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x48')]);router['post']('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router[_0x5e9a('0x5')](_0x5e9a('0x49'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x4a')]);router['post'](_0x5e9a('0x4b'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x40')](_0x5e9a('0x4c')));router[_0x5e9a('0x44')](_0x5e9a('0x4d'),auth[_0x5e9a('0x7')](),controller['queueNotify'](_0x5e9a('0x4e')));router[_0x5e9a('0x5')]('/sms/queues/:id',auth[_0x5e9a('0x7')](),controller['showSmsQueues']);router[_0x5e9a('0x5')](_0x5e9a('0x4f'),auth[_0x5e9a('0x7')](),controller[_0x5e9a('0x50')]);router['post'](_0x5e9a('0x51'),auth[_0x5e9a('0x7')](),controller['agentNotify']);module[_0x5e9a('0x52')]=router; \ No newline at end of file +var _0x4bc3=['mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','path','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','outbound','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify'];(function(_0x310ad1,_0x2d5bde){var _0x15374b=function(_0x5e09bf){while(--_0x5e09bf){_0x310ad1['push'](_0x310ad1['shift']());}};_0x15374b(++_0x2d5bde);}(_0x4bc3,0xfe));var _0x34bc=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x4bc3[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0x34bc('0x0'));var util=require('util');var path=require(_0x34bc('0x1'));var express=require(_0x34bc('0x2'));var router=express[_0x34bc('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x34bc('0x4'));router['get'](_0x34bc('0x5'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x7')]);router[_0x34bc('0x8')](_0x34bc('0x9'),auth[_0x34bc('0x6')](),controller[_0x34bc('0xa')]);router[_0x34bc('0x8')](_0x34bc('0xb'),auth[_0x34bc('0x6')](),controller[_0x34bc('0xc')]);router[_0x34bc('0x8')](_0x34bc('0xd'),auth[_0x34bc('0x6')](),controller['voiceQueues']);router[_0x34bc('0x8')](_0x34bc('0xe'),auth[_0x34bc('0x6')](),controller[_0x34bc('0xf')]);router['get'](_0x34bc('0x10'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x11')]);router[_0x34bc('0x8')](_0x34bc('0x12'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x13')]);router[_0x34bc('0x8')](_0x34bc('0x14'),auth['isAuthenticated'](),controller[_0x34bc('0x15')]);router[_0x34bc('0x8')](_0x34bc('0x16'),auth[_0x34bc('0x6')](),controller['smsQueues']);router[_0x34bc('0x8')](_0x34bc('0x17'),auth[_0x34bc('0x6')](),controller['whatsappQueues']);router[_0x34bc('0x8')](_0x34bc('0x18'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x19')]);router[_0x34bc('0x8')](_0x34bc('0x1a'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x1b')]);router[_0x34bc('0x8')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x34bc('0x1c')]);router[_0x34bc('0x8')]('/voice/queues/channels/:uniqueid',auth[_0x34bc('0x6')](),controller[_0x34bc('0x1d')]);router[_0x34bc('0x8')](_0x34bc('0x1e'),auth[_0x34bc('0x6')](),controller['voiceQueuesChannelHangup']);router['get'](_0x34bc('0x1f'),auth[_0x34bc('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x34bc('0x8')](_0x34bc('0x20'),auth[_0x34bc('0x6')](),controller['showVoiceQueues']);router['put'](_0x34bc('0x20'),auth[_0x34bc('0x6')](),controller['updateVoiceQueue']);router[_0x34bc('0x8')]('/outbound',auth[_0x34bc('0x6')](),controller[_0x34bc('0x21')]);router[_0x34bc('0x8')]('/outbound/channels',auth[_0x34bc('0x6')](),controller[_0x34bc('0x22')]);router[_0x34bc('0x8')]('/agents',auth[_0x34bc('0x6')](),controller[_0x34bc('0x23')]);router[_0x34bc('0x24')](_0x34bc('0x25'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x26')]);router[_0x34bc('0x8')](_0x34bc('0x27'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x28')]);router[_0x34bc('0x8')](_0x34bc('0x29'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x2a')]);router[_0x34bc('0x8')](_0x34bc('0x2b'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x2c')]);router[_0x34bc('0x8')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x34bc('0x2d')]);router[_0x34bc('0x8')]('/chat/queues/waitinginteractions',auth[_0x34bc('0x6')](),controller[_0x34bc('0x2e')]);router[_0x34bc('0x8')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x34bc('0x2f')]);router[_0x34bc('0x8')](_0x34bc('0x30'),auth['isAuthenticated'](),controller[_0x34bc('0x31')]);router[_0x34bc('0x8')]('/openchannel/queues/:id/waitinginteractions',auth[_0x34bc('0x6')](),controller[_0x34bc('0x32')]);router[_0x34bc('0x8')](_0x34bc('0x33'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x34bc('0x6')](),controller[_0x34bc('0x34')]);router[_0x34bc('0x8')](_0x34bc('0x35'),auth['isAuthenticated'](),controller[_0x34bc('0x36')]);router[_0x34bc('0x37')](_0x34bc('0x38'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x39')](_0x34bc('0x3a')));router[_0x34bc('0x8')](_0x34bc('0x3b'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x3c')]);router[_0x34bc('0x37')](_0x34bc('0x3d'),auth[_0x34bc('0x6')](),controller['queueNotify'](_0x34bc('0x3e')));router[_0x34bc('0x8')](_0x34bc('0x3f'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x40')]);router[_0x34bc('0x37')](_0x34bc('0x41'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x39')]('fax'));router[_0x34bc('0x8')]('/fax/queues/:id',auth[_0x34bc('0x6')](),controller['showFaxQueues']);router['post'](_0x34bc('0x42'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x39')](_0x34bc('0x43')));router[_0x34bc('0x8')](_0x34bc('0x44'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x45')]);router['post'](_0x34bc('0x46'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x39')](_0x34bc('0x47')));router[_0x34bc('0x37')](_0x34bc('0x48'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x39')]('whatsapp'));router[_0x34bc('0x8')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x34bc('0x49')]);router[_0x34bc('0x8')](_0x34bc('0x4a'),auth[_0x34bc('0x6')](),controller[_0x34bc('0x4b')]);router['post']('/agents/:id/notify',auth[_0x34bc('0x6')](),controller[_0x34bc('0x4c')]);module[_0x34bc('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 75a4cd1..960fd7d 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 _0xf2ca=['voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','INTERACTION','length','findOrCreate','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','Message','TransferReport','create','Start','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4491ef,_0x5153d9){_0x4491ef=_0x4491ef-0x0;var _0x3c72dc=_0xf2ca[_0x4491ef];return _0x3c72dc;};'use strict';var BPromise=require(_0xaf2c('0x0'));var moment=require(_0xaf2c('0x1'));var _=require(_0xaf2c('0x2'));var util=require('util');var db=require(_0xaf2c('0x3'))['db'];var logger=require(_0xaf2c('0x4'))(_0xaf2c('0x5'));var jayson=require(_0xaf2c('0x6'));var amiClient=jayson[_0xaf2c('0x7')][_0xaf2c('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xaf2c('0x8')]({'port':0x232b});var routingClient=jayson[_0xaf2c('0x7')][_0xaf2c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){var _0x2a011d=_0x37fedd?_0x37fedd:amiClient;return _0x2a011d['request'](_0x1f9531,_0x58351f)[_0xaf2c('0x9')](function(_0x4a0064){if(_0x4a0064[_0xaf2c('0xa')]){if(_0x4a0064[_0xaf2c('0xa')][_0xaf2c('0xb')]===0x1f4){return _0x4a7397(_0x4a0064[_0xaf2c('0xa')]['message']);}return _0x3c0421(_0x4a0064['error'][_0xaf2c('0xc')]);}else{_0x3c0421(_0x4a0064[_0xaf2c('0xd')]);}})[_0xaf2c('0xe')](function(_0xd56a5d){_0x4a7397(_0xd56a5d);});});}function respondWithResult(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xc8;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0xf')](_0x59a59b)[_0xaf2c('0x10')](_0x590126);}return _0x285dac[_0xaf2c('0x11')](0x194);};}function handleError(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0x1f4;return function(_0x152c73){logger[_0xaf2c('0xa')](_0x152c73[_0xaf2c('0x12')]);if(_0x152c73[_0xaf2c('0x13')]){delete _0x152c73[_0xaf2c('0x13')];}_0x18a8a5[_0xaf2c('0xf')](_0x293ca6)[_0xaf2c('0x14')](_0x152c73);};}function findById(_0x26bf7b){return function(_0x3432e4){if(!_[_0xaf2c('0x15')](_0x26bf7b)&&!_['isNil'](_0x3432e4)&&!_[_0xaf2c('0x15')](_0x3432e4['rows'])){return _[_0xaf2c('0x16')](_0x3432e4[_0xaf2c('0x17')],function(_0x1d544a){return _0x1d544a['id']==_0x26bf7b;});}return null;};}exports['voiceChannels']=function(_0x28ae7b,_0x297bcd){return respondWithRpcPromise(_0xaf2c('0x18'),_0x28ae7b[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x297bcd,null))[_0xaf2c('0xe')](handleError(_0x297bcd,null));};exports['voiceChannelMixMonitor']=function(_0x35e712,_0x164bcb){return respondWithRpcPromise(_0xaf2c('0x1a'),_[_0xaf2c('0x1b')](_0x35e712[_0xaf2c('0x19')],_0x35e712['params']))[_0xaf2c('0x9')](respondWithResult(_0x164bcb,null))[_0xaf2c('0xe')](handleError(_0x164bcb,null));};exports[_0xaf2c('0x1c')]=function(_0x4be6ed,_0x59b113){return respondWithRpcPromise(_0xaf2c('0x1d'),_[_0xaf2c('0x1b')](_0x4be6ed[_0xaf2c('0x19')],_0x4be6ed[_0xaf2c('0x1e')]))['then'](respondWithResult(_0x59b113,null))[_0xaf2c('0xe')](handleError(_0x59b113,null));};exports[_0xaf2c('0x1f')]=function(_0x3a0145,_0x3c1ae6){return respondWithRpcPromise(_0xaf2c('0x20'),_0x3a0145[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x3c1ae6,null))['catch'](handleError(_0x3c1ae6,null));};exports[_0xaf2c('0x21')]=function(_0x2051be,_0x36f37c){return respondWithRpcPromise(_0xaf2c('0x20'),_0x2051be['query'])[_0xaf2c('0x9')](findById(_0x2051be['params']['id']))[_0xaf2c('0x9')](respondWithResult(_0x36f37c,null))[_0xaf2c('0xe')](handleError(_0x36f37c,null));};exports[_0xaf2c('0x22')]=function(_0x5d685a,_0x2747bb){return respondWithRpcPromise(_0xaf2c('0x23'),_[_0xaf2c('0x1b')](_0x5d685a['body'],_0x5d685a[_0xaf2c('0x1e')]))[_0xaf2c('0x9')](respondWithResult(_0x2747bb,null))[_0xaf2c('0xe')](handleError(_0x2747bb,null));};exports[_0xaf2c('0x24')]=function(_0x59d858,_0x3da072){return respondWithRpcPromise(_0xaf2c('0x25'),_[_0xaf2c('0x1b')](_0x59d858['query'],_0x59d858['params']))[_0xaf2c('0x9')](respondWithResult(_0x3da072,null))['catch'](handleError(_0x3da072,null));};exports[_0xaf2c('0x26')]=function(_0x5e7247,_0x337cea){return respondWithRpcPromise(_0xaf2c('0x27'),_0x5e7247['query'])[_0xaf2c('0x9')](respondWithResult(_0x337cea,null))[_0xaf2c('0xe')](handleError(_0x337cea,null));};exports['voiceQueuesChannel']=function(_0x13ced2,_0xbec302){return respondWithRpcPromise(_0xaf2c('0x28'),_[_0xaf2c('0x1b')](_0x13ced2[_0xaf2c('0x19')],_0x13ced2[_0xaf2c('0x1e')]))['then'](respondWithResult(_0xbec302,null))[_0xaf2c('0xe')](handleError(_0xbec302,null));};exports['voiceQueuesChannelHangup']=function(_0x321f7c,_0x514bff){return respondWithRpcPromise(_0xaf2c('0x29'),_['merge'](_0x321f7c[_0xaf2c('0x19')],_0x321f7c['params']))[_0xaf2c('0x9')](respondWithResult(_0x514bff,null))['catch'](handleError(_0x514bff,null));};exports[_0xaf2c('0x2a')]=function(_0x356402,_0x1a6929){return respondWithRpcPromise(_0xaf2c('0x2b'),_[_0xaf2c('0x1b')](_0x356402['query'],_0x356402['params']))[_0xaf2c('0x9')](respondWithResult(_0x1a6929,null))[_0xaf2c('0xe')](handleError(_0x1a6929,null));};exports[_0xaf2c('0x2c')]=function(_0xa44813,_0x4eeecf){return respondWithRpcPromise(_0xaf2c('0x2d'),_0xa44813['query'])[_0xaf2c('0x9')](respondWithResult(_0x4eeecf,null))[_0xaf2c('0xe')](handleError(_0x4eeecf,null));};exports['outboundChannels']=function(_0x36081a,_0x24668d){return respondWithRpcPromise(_0xaf2c('0x2e'),_0x36081a[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x24668d,null))[_0xaf2c('0xe')](handleError(_0x24668d,null));};exports[_0xaf2c('0x2f')]=function(_0x310d3b,_0x296ca8){var _0x106eb9;return respondWithRpcPromise(_0xaf2c('0x30'),_0x310d3b[_0xaf2c('0x19')])[_0xaf2c('0x9')](function(_0x4b524d){_0x106eb9=_0x4b524d;return respondWithRpcPromise('Agents',_0x310d3b['query'],routingClient);})[_0xaf2c('0x9')](function(_0x3cb075){return _[_0xaf2c('0x1b')]({},_0x3cb075,_0x106eb9);})[_0xaf2c('0x9')](respondWithResult(_0x296ca8,null))[_0xaf2c('0xe')](handleError(_0x296ca8,null));};exports[_0xaf2c('0x31')]=function(_0x51c441,_0x1d58bd){if(_0x51c441[_0xaf2c('0x32')]&&_0x51c441[_0xaf2c('0x32')]['interaction']&&_0x51c441['user']&&_0x51c441[_0xaf2c('0x33')]['name']){for(var _0x181787 in _0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')]){if(_0x51c441[_0xaf2c('0x32')]['interaction'][_0xaf2c('0x35')](_0x181787)){db['MemberReport'][_0xaf2c('0x36')]({'where':{'channel':_0x181787,'membername':_0x51c441[_0xaf2c('0x33')]['name'],'type':_0xaf2c('0x37'),'exitAt':null,'uniqueid':_0x51c441['body'][_0xaf2c('0x34')][_0x181787]&&_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0xaf2c('0x38')]?{'$notIn':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787]}:{'$ne':null}}})[_0xaf2c('0x9')](function(_0x16b469){var _0x922b9=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x18e62b=0x0,_0x4d0977=_0x16b469['length'];_0x18e62b<_0x4d0977;_0x18e62b+=0x1){_0x16b469[_0x18e62b]['updateAttributes']({'exitAt':_0x922b9});}});for(var _0x11a90a=0x0;_0x11a90a<_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0xaf2c('0x38')];_0x11a90a+=0x1){db['MemberReport'][_0xaf2c('0x39')]({'where':{'channel':_0x181787,'membername':_0x51c441['user'][_0xaf2c('0x13')],'type':'INTERACTION','uniqueid':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0x11a90a],'exitAt':null},'defaults':{'channel':_0x181787,'membername':_0x51c441[_0xaf2c('0x33')][_0xaf2c('0x13')],'interface':_[_0xaf2c('0x15')](_0x51c441['user'][_0xaf2c('0x3a')])?util[_0xaf2c('0x3b')]('SIP/%s',_0x51c441['user'][_0xaf2c('0x13')]):_0x51c441['user'][_0xaf2c('0x3a')],'type':_0xaf2c('0x37'),'enterAt':moment()[_0xaf2c('0x3b')](_0xaf2c('0x3c')),'role':_0xaf2c('0x3d'),'internal':_0x51c441[_0xaf2c('0x33')][_0xaf2c('0x3e')],'uniqueid':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0x11a90a]}});}}}}return respondWithRpcPromise(_0xaf2c('0x3f'),{'id':_0x51c441[_0xaf2c('0x1e')]['id'],'capacity':_0x51c441['body'][_0xaf2c('0x40')]},routingClient)[_0xaf2c('0x9')](respondWithResult(_0x1d58bd,null))['catch'](handleError(_0x1d58bd,null));};exports['telephones']=function(_0x56d7ce,_0x7ddca0){return respondWithRpcPromise(_0xaf2c('0x41'),_0x56d7ce['query'])[_0xaf2c('0x9')](respondWithResult(_0x7ddca0,null))[_0xaf2c('0xe')](handleError(_0x7ddca0,null));};exports[_0xaf2c('0x42')]=function(_0x3085e5,_0x265748){return respondWithRpcPromise(_0xaf2c('0x43'),_0x3085e5[_0xaf2c('0x19')])['then'](respondWithResult(_0x265748,null))[_0xaf2c('0xe')](handleError(_0x265748,null));};exports[_0xaf2c('0x44')]=function(_0x5771e5,_0x245797){return respondWithRpcPromise(_0xaf2c('0x45'),_0x5771e5[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x245797,null))[_0xaf2c('0xe')](handleError(_0x245797,null));};exports[_0xaf2c('0x46')]=function(_0x332340,_0x15a335){return respondWithRpcPromise(_0xaf2c('0x47'),_0x332340[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x15a335,null))[_0xaf2c('0xe')](handleError(_0x15a335,null));};exports[_0xaf2c('0x48')]=function(_0x2356a0,_0x297a22){return respondWithRpcPromise(_0xaf2c('0x47'),_0x2356a0[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x2356a0[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x297a22,null))['catch'](handleError(_0x297a22,null));};exports[_0xaf2c('0x49')]=function(_0x3ac79c,_0xfe5928){return respondWithRpcPromise('MailQueues',_0x3ac79c[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0xfe5928,null))[_0xaf2c('0xe')](handleError(_0xfe5928,null));};exports[_0xaf2c('0x4a')]=function(_0xb3ad9,_0x45918b){return respondWithRpcPromise(_0xaf2c('0x4b'),_0xb3ad9[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0xb3ad9[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x45918b,null))['catch'](handleError(_0x45918b,null));};exports[_0xaf2c('0x4c')]=function(_0x400dcd,_0x262937){return respondWithRpcPromise(_0xaf2c('0x4d'),_0x400dcd[_0xaf2c('0x19')],mailClient)['then'](respondWithResult(_0x262937,null))[_0xaf2c('0xe')](handleError(_0x262937,null));};exports[_0xaf2c('0x4e')]=function(_0x506000,_0x33aa67){return respondWithRpcPromise(_0xaf2c('0x4f'),_0x506000['query'],routingClient)['then'](respondWithResult(_0x33aa67,null))[_0xaf2c('0xe')](handleError(_0x33aa67,null));};exports[_0xaf2c('0x50')]=function(_0xc83d19,_0x39c5d2){return respondWithRpcPromise('OpenchannelQueues',_0xc83d19[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0xc83d19['params']['id']))[_0xaf2c('0x9')](respondWithResult(_0x39c5d2,null))['catch'](handleError(_0x39c5d2,null));};exports[_0xaf2c('0x51')]=function(_0xe6a251,_0x16e9f4){return respondWithRpcPromise(_0xaf2c('0x52'),_0xe6a251[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x16e9f4,null))[_0xaf2c('0xe')](handleError(_0x16e9f4,null));};exports[_0xaf2c('0x53')]=function(_0x1520ec,_0xc27601){return respondWithRpcPromise('SmsQueues',_0x1520ec[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x1520ec[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0xc27601,null))[_0xaf2c('0xe')](handleError(_0xc27601,null));};exports['whatsappQueues']=function(_0xbfb776,_0x28b09f){return respondWithRpcPromise(_0xaf2c('0x54'),_0xbfb776[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x28b09f,null))['catch'](handleError(_0x28b09f,null));};exports['showWhatsappQueues']=function(_0x1166c9,_0x1ead61){return respondWithRpcPromise('WhatsappQueues',_0x1166c9[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x1166c9[_0xaf2c('0x1e')]['id']))['then'](respondWithResult(_0x1ead61,null))[_0xaf2c('0xe')](handleError(_0x1ead61,null));};exports[_0xaf2c('0x55')]=function(_0x18dcde,_0x2aae3a){return respondWithRpcPromise('FaxQueues',_0x18dcde[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x2aae3a,null))[_0xaf2c('0xe')](handleError(_0x2aae3a,null));};exports[_0xaf2c('0x56')]=function(_0x20c120,_0x1ecf97){return respondWithRpcPromise(_0xaf2c('0x57'),_0x20c120[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x20c120[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x1ecf97,null))['catch'](handleError(_0x1ecf97,null));};exports[_0xaf2c('0x58')]=function(_0x5d965c,_0x1a0795){return respondWithRpcPromise(_0xaf2c('0x59'),_0x5d965c['query'])[_0xaf2c('0x9')](respondWithResult(_0x1a0795,null))['catch'](handleError(_0x1a0795,null));};exports['chatQueuesWaitingInteractions']=function(_0x316333,_0x1d73ef){return respondWithRpcPromise(_0xaf2c('0x5a'),_0x316333['query'],routingClient)['then'](respondWithResult(_0x1d73ef,null))['catch'](handleError(_0x1d73ef,null));};exports[_0xaf2c('0x5b')]=function(_0x3e972c,_0x517f8d){return respondWithRpcPromise(_0xaf2c('0x5c'),_0x3e972c[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x517f8d,null))[_0xaf2c('0xe')](handleError(_0x517f8d,null));};exports[_0xaf2c('0x5d')]=function(_0x44303c,_0x4be47b){return respondWithRpcPromise(_0xaf2c('0x5e'),_0x44303c[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x4be47b,null))['catch'](handleError(_0x4be47b,null));};exports[_0xaf2c('0x5f')]=function(_0x3c53ff,_0x37ee02){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3c53ff[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](function(_0x433f9e){if(_0x3c53ff[_0xaf2c('0x19')]['type']!==undefined){var _0x286a40=_(_0x433f9e[_0xaf2c('0x17')])[_0xaf2c('0x60')]([_0x3c53ff['query']['type'],_0x3c53ff[_0xaf2c('0x1e')]['id']])[_0xaf2c('0x61')]('queue_id')[_0xaf2c('0x62')]()[_0xaf2c('0x63')]();return _0x433f9e['rows'][_0xaf2c('0x60')](function(_0x31cf3e){return _0x286a40[_0xaf2c('0x64')](_0x31cf3e[_0xaf2c('0x65')])>-0x1;});}else{return _0x433f9e[_0xaf2c('0x17')]['filter'](function(_0x5831c9){return _0x5831c9[_0xaf2c('0x65')]===parseInt(_0x3c53ff[_0xaf2c('0x1e')]['id']);});}})[_0xaf2c('0x9')](respondWithResult(_0x37ee02,null))['catch'](handleError(_0x37ee02,null));};exports[_0xaf2c('0x66')]=function(_0x467a36,_0x3d8471){return respondWithRpcPromise(_0xaf2c('0x67'),_0x467a36[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0x3d8471,null))[_0xaf2c('0xe')](handleError(_0x3d8471,null));};exports[_0xaf2c('0x68')]=function(_0x154f69,_0x1ef61f){return respondWithRpcPromise(_0xaf2c('0x69'),_0x154f69[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0x1ef61f,null))[_0xaf2c('0xe')](handleError(_0x1ef61f,null));};exports[_0xaf2c('0x6a')]=function(_0x483774,_0x5beb89){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x483774[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x5beb89,null))[_0xaf2c('0xe')](handleError(_0x5beb89,null));};exports[_0xaf2c('0x6b')]=function(_0x499bbe){return function(_0x19fbd5,_0x2d7ca5){var _0x2b57d2,_0x430567;var _0x4ddf95=_[_0xaf2c('0x6c')](_0x499bbe);var _0x23aeac=_0x499bbe===_0xaf2c('0x6d')?_0xaf2c('0x6e'):_0xaf2c('0x6f');return db[_0x4ddf95+'Queue'][_0xaf2c('0x70')]({'raw':!![],'where':{'id':_0x19fbd5[_0xaf2c('0x1e')]['id']}})['then'](function(_0x516193){if(_[_0xaf2c('0x15')](_0x516193)){throw new Error(_0x4ddf95+_0xaf2c('0x71'));}_0x2b57d2=_0x516193;return db[_0x4ddf95+'Message'][_0xaf2c('0x70')]({'where':{'id':_0x19fbd5[_0xaf2c('0x32')][_0xaf2c('0x72')]},'include':[{'model':db[_0x4ddf95+_0xaf2c('0x73')],'as':_0xaf2c('0x73')},{'model':db[_0x4ddf95+_0x23aeac],'as':_0xaf2c('0x6f')}]});})[_0xaf2c('0x9')](function(_0x43c174){if(_['isNil'](_0x43c174)){throw new Error(_0x4ddf95+_0xaf2c('0x74'));}_0x430567=_0x43c174;return _0x43c174['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xaf2c('0x9')](function(){var _0x7724cc={'uniqueid':_0x499bbe+'.'+_0x430567['id']+'.'+_0x430567['Interaction']['id'],'FromUserId':_0x19fbd5['user']['id'],'type':_0xaf2c('0x75')};_0x7724cc[_0x4ddf95+_0xaf2c('0x76')]=_0x430567['id'];_0x7724cc[_0x4ddf95+_0xaf2c('0x77')]=_0x430567['Interaction']['id'];_0x7724cc[_0xaf2c('0x78')+_0x4ddf95+_0x23aeac+'Id']=_0x430567[_0xaf2c('0x6f')]['id'];_0x7724cc['To'+_0x4ddf95+_0xaf2c('0x79')]=_0x2b57d2['id'];return db[_0x4ddf95+'TransferReport']['create'](_0x7724cc);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x499bbe,'interaction':_0x430567[_0xaf2c('0x73')],'message':_0x430567,'account':_0x430567[_0xaf2c('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf2c('0x75'),'appdata':_0x2b57d2[_0xaf2c('0x13')]+','+(_0x430567[_0xaf2c('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0xaf2c('0x7a')}]},routingClient);})[_0xaf2c('0x9')](respondWithResult(_0x2d7ca5,null))['catch'](handleError(_0x2d7ca5,null));};};exports[_0xaf2c('0x7b')]=function(_0x4a3a61,_0x31f1d3){var _0x25d49c,_0x1e403a;if(_[_0xaf2c('0x15')](_0x4a3a61[_0xaf2c('0x32')][_0xaf2c('0x7c')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x47b971=_0x4a3a61[_0xaf2c('0x32')][_0xaf2c('0x7c')];var _0x1bc548=_[_0xaf2c('0x6c')](_0x47b971);var _0x118e78=_0x47b971===_0xaf2c('0x6d')?'Website':'Account';return db[_0xaf2c('0x7d')]['findOne']({'raw':!![],'where':{'id':_0x4a3a61[_0xaf2c('0x1e')]['id'],'role':'agent'}})[_0xaf2c('0x9')](function(_0x639b4b){if(_['isNil'](_0x639b4b)){throw new Error(_0xaf2c('0x7e'));}_0x25d49c=_0x639b4b;return db[_0x1bc548+_0xaf2c('0x7f')][_0xaf2c('0x70')]({'where':{'id':_0x4a3a61['body'][_0xaf2c('0x72')]},'include':[{'model':db[_0x1bc548+_0xaf2c('0x73')],'as':_0xaf2c('0x73')},{'model':db[_0x1bc548+_0x118e78],'as':_0xaf2c('0x6f')}]});})[_0xaf2c('0x9')](function(_0xb311e1){if(_['isNil'](_0xb311e1)){throw new Error(_0x1bc548+'\x20Message\x20not\x20found');}_0x1e403a=_0xb311e1;return _0xb311e1['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2db412={'uniqueid':_0x47b971+'.'+_0x1e403a['id']+'.'+_0x1e403a['Interaction']['id'],'FromUserId':_0x4a3a61[_0xaf2c('0x33')]['id'],'type':'queue','ToUserId':_0x25d49c['id']};_0x2db412[_0x1bc548+'MessageId']=_0x1e403a['id'];_0x2db412[_0x1bc548+_0xaf2c('0x77')]=_0x1e403a[_0xaf2c('0x73')]['id'];_0x2db412['From'+_0x1bc548+_0x118e78+'Id']=_0x1e403a[_0xaf2c('0x6f')]['id'];return db[_0x1bc548+_0xaf2c('0x80')][_0xaf2c('0x81')](_0x2db412);})[_0xaf2c('0x9')](function(){return respondWithRpcPromise(_0xaf2c('0x82'),{'channel':_0x47b971,'interaction':_0x1e403a[_0xaf2c('0x73')],'message':_0x1e403a,'account':_0x1e403a[_0xaf2c('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf2c('0x3d'),'appdata':_0x25d49c[_0xaf2c('0x13')]+','+(_0x1e403a[_0xaf2c('0x6f')]['agentTransferTimeout']||0x12c),'interval':_0xaf2c('0x7a')}]},routingClient);})['then'](respondWithResult(_0x31f1d3,null))[_0xaf2c('0xe')](handleError(_0x31f1d3,null));}; \ No newline at end of file +var _0xe14b=['MessageId','InteractionId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','Website','User','agent','Agent\x20not\x20found','Message','update','From','bluebird','moment','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','internal','AgentCapacity','capacity','telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found'];(function(_0x4a43ad,_0x3194cf){var _0x9adf9e=function(_0x4b4ccf){while(--_0x4b4ccf){_0x4a43ad['push'](_0x4a43ad['shift']());}};_0x9adf9e(++_0x3194cf);}(_0xe14b,0x93));var _0xbe14=function(_0x4248ee,_0x1a3b4a){_0x4248ee=_0x4248ee-0x0;var _0x5c1c8f=_0xe14b[_0x4248ee];return _0x5c1c8f;};'use strict';var BPromise=require(_0xbe14('0x0'));var moment=require(_0xbe14('0x1'));var _=require('lodash');var util=require('util');var db=require(_0xbe14('0x2'))['db'];var logger=require(_0xbe14('0x3'))('api');var jayson=require(_0xbe14('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232b});var routingClient=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){var _0x496063=_0x196fca?_0x196fca:amiClient;return _0x496063[_0xbe14('0x7')](_0x1d9ade,_0x39387e)[_0xbe14('0x8')](function(_0xd68cd7){if(_0xd68cd7[_0xbe14('0x9')]){if(_0xd68cd7['error']['code']===0x1f4){return _0x50f909(_0xd68cd7[_0xbe14('0x9')][_0xbe14('0xa')]);}return _0x566ae7(_0xd68cd7['error'][_0xbe14('0xa')]);}else{_0x566ae7(_0xd68cd7[_0xbe14('0xb')]);}})[_0xbe14('0xc')](function(_0x3d38c2){_0x50f909(_0x3d38c2);});});}function respondWithResult(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xc8;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0xd')](_0x3b898d)[_0xbe14('0xe')](_0x23a730);}return _0x27792f[_0xbe14('0xf')](0x194);};}function handleError(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0x1f4;return function(_0x813399){logger['error'](_0x813399['stack']);if(_0x813399[_0xbe14('0x10')]){delete _0x813399[_0xbe14('0x10')];}_0x1e4826[_0xbe14('0xd')](_0x33fd54)[_0xbe14('0x11')](_0x813399);};}function findById(_0x4e8f34){return function(_0x21c789){if(!_[_0xbe14('0x12')](_0x4e8f34)&&!_[_0xbe14('0x12')](_0x21c789)&&!_[_0xbe14('0x12')](_0x21c789[_0xbe14('0x13')])){return _[_0xbe14('0x14')](_0x21c789[_0xbe14('0x13')],function(_0x5ea1f8){return _0x5ea1f8['id']==_0x4e8f34;});}return null;};}exports[_0xbe14('0x15')]=function(_0x456ca8,_0x329588){return respondWithRpcPromise(_0xbe14('0x16'),_0x456ca8[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x329588,null))['catch'](handleError(_0x329588,null));};exports[_0xbe14('0x18')]=function(_0x4a1bbd,_0x417c8d){return respondWithRpcPromise(_0xbe14('0x19'),_[_0xbe14('0x1a')](_0x4a1bbd['query'],_0x4a1bbd[_0xbe14('0x1b')]))['then'](respondWithResult(_0x417c8d,null))[_0xbe14('0xc')](handleError(_0x417c8d,null));};exports['voiceChannelStopMixMonitor']=function(_0x32e8eb,_0x4a25fa){return respondWithRpcPromise(_0xbe14('0x1c'),_[_0xbe14('0x1a')](_0x32e8eb['query'],_0x32e8eb[_0xbe14('0x1b')]))['then'](respondWithResult(_0x4a25fa,null))[_0xbe14('0xc')](handleError(_0x4a25fa,null));};exports['voiceQueues']=function(_0x36a21e,_0x5fa043){return respondWithRpcPromise(_0xbe14('0x1d'),_0x36a21e[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x5fa043,null))[_0xbe14('0xc')](handleError(_0x5fa043,null));};exports['showVoiceQueues']=function(_0x1822e0,_0x1ba46a){return respondWithRpcPromise(_0xbe14('0x1d'),_0x1822e0[_0xbe14('0x17')])['then'](findById(_0x1822e0[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x1ba46a,null))['catch'](handleError(_0x1ba46a,null));};exports[_0xbe14('0x1e')]=function(_0x3b3e84,_0x1c7cc7){return respondWithRpcPromise(_0xbe14('0x1f'),_[_0xbe14('0x1a')](_0x3b3e84[_0xbe14('0x20')],_0x3b3e84[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x1c7cc7,null))[_0xbe14('0xc')](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x21')]=function(_0x40538f,_0x3bf43c){return respondWithRpcPromise(_0xbe14('0x22'),_[_0xbe14('0x1a')](_0x40538f[_0xbe14('0x17')],_0x40538f[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x3bf43c,null))[_0xbe14('0xc')](handleError(_0x3bf43c,null));};exports[_0xbe14('0x23')]=function(_0x14e7c4,_0x581e86){return respondWithRpcPromise(_0xbe14('0x24'),_0x14e7c4['query'])['then'](respondWithResult(_0x581e86,null))[_0xbe14('0xc')](handleError(_0x581e86,null));};exports['voiceQueuesChannel']=function(_0x243524,_0x345b0){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x243524['query'],_0x243524[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x345b0,null))['catch'](handleError(_0x345b0,null));};exports[_0xbe14('0x25')]=function(_0x1faf3e,_0x452635){return respondWithRpcPromise(_0xbe14('0x26'),_[_0xbe14('0x1a')](_0x1faf3e['query'],_0x1faf3e['params']))[_0xbe14('0x8')](respondWithResult(_0x452635,null))['catch'](handleError(_0x452635,null));};exports['voiceQueuesChannelRedirect']=function(_0x5c5e9f,_0x163ef7){return respondWithRpcPromise(_0xbe14('0x27'),_[_0xbe14('0x1a')](_0x5c5e9f[_0xbe14('0x17')],_0x5c5e9f[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x163ef7,null))[_0xbe14('0xc')](handleError(_0x163ef7,null));};exports[_0xbe14('0x28')]=function(_0x2d9c12,_0x2dfd5a){return respondWithRpcPromise(_0xbe14('0x29'),_0x2d9c12[_0xbe14('0x17')])['then'](respondWithResult(_0x2dfd5a,null))['catch'](handleError(_0x2dfd5a,null));};exports[_0xbe14('0x2a')]=function(_0x2951e1,_0x13bfcf){return respondWithRpcPromise('OutboundChannels',_0x2951e1[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x13bfcf,null))[_0xbe14('0xc')](handleError(_0x13bfcf,null));};exports[_0xbe14('0x2b')]=function(_0x3bd454,_0x25ee1f){var _0x19fa30;return respondWithRpcPromise(_0xbe14('0x2c'),_0x3bd454[_0xbe14('0x17')])['then'](function(_0xe51424){_0x19fa30=_0xe51424;return respondWithRpcPromise(_0xbe14('0x2c'),_0x3bd454[_0xbe14('0x17')],routingClient);})[_0xbe14('0x8')](function(_0x3287b9){return _[_0xbe14('0x1a')]({},_0x3287b9,_0x19fa30);})['then'](respondWithResult(_0x25ee1f,null))[_0xbe14('0xc')](handleError(_0x25ee1f,null));};exports[_0xbe14('0x2d')]=function(_0x1220c9,_0x36263c){if(_0x1220c9['body']&&_0x1220c9['body'][_0xbe14('0x2e')]&&_0x1220c9[_0xbe14('0x2f')]&&_0x1220c9[_0xbe14('0x2f')]['name']){for(var _0x5d5318 in _0x1220c9[_0xbe14('0x20')]['interaction']){if(_0x1220c9['body'][_0xbe14('0x2e')][_0xbe14('0x30')](_0x5d5318)){db[_0xbe14('0x31')]['findAll']({'where':{'channel':_0x5d5318,'membername':_0x1220c9['user']['name'],'type':_0xbe14('0x32'),'exitAt':null,'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318]&&_0x1220c9['body'][_0xbe14('0x2e')][_0x5d5318][_0xbe14('0x33')]?{'$notIn':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318]}:{'$ne':null}}})['then'](function(_0x4a1a4b){var _0x3e2fd3=moment()[_0xbe14('0x34')](_0xbe14('0x35'));for(var _0xb2b285=0x0,_0x2550dc=_0x4a1a4b['length'];_0xb2b285<_0x2550dc;_0xb2b285+=0x1){_0x4a1a4b[_0xb2b285]['updateAttributes']({'exitAt':_0x3e2fd3});}});for(var _0x46af81=0x0;_0x46af81<_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0xbe14('0x33')];_0x46af81+=0x1){db['MemberReport'][_0xbe14('0x36')]({'where':{'channel':_0x5d5318,'membername':_0x1220c9[_0xbe14('0x2f')]['name'],'type':_0xbe14('0x32'),'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0x46af81],'exitAt':null},'defaults':{'channel':_0x5d5318,'membername':_0x1220c9[_0xbe14('0x2f')]['name'],'interface':_['isNil'](_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x37')])?util['format']('SIP/%s',_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x10')]):_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x37')],'type':_0xbe14('0x32'),'enterAt':moment()[_0xbe14('0x34')](_0xbe14('0x35')),'role':'agent','internal':_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x38')],'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0x46af81]}});}}}}return respondWithRpcPromise(_0xbe14('0x39'),{'id':_0x1220c9['params']['id'],'capacity':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x3a')]},routingClient)[_0xbe14('0x8')](respondWithResult(_0x36263c,null))[_0xbe14('0xc')](handleError(_0x36263c,null));};exports[_0xbe14('0x3b')]=function(_0x2dbeb1,_0x505829){return respondWithRpcPromise('Telephones',_0x2dbeb1[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x505829,null))[_0xbe14('0xc')](handleError(_0x505829,null));};exports['trunks']=function(_0x497b00,_0x44fe0d){return respondWithRpcPromise(_0xbe14('0x3c'),_0x497b00['query'])[_0xbe14('0x8')](respondWithResult(_0x44fe0d,null))[_0xbe14('0xc')](handleError(_0x44fe0d,null));};exports['campaigns']=function(_0x28f995,_0x4a40d2){return respondWithRpcPromise(_0xbe14('0x3d'),_0x28f995[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x4a40d2,null))['catch'](handleError(_0x4a40d2,null));};exports[_0xbe14('0x3e')]=function(_0x404212,_0x5dc78a){return respondWithRpcPromise(_0xbe14('0x3f'),_0x404212[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x5dc78a,null))[_0xbe14('0xc')](handleError(_0x5dc78a,null));};exports[_0xbe14('0x40')]=function(_0x4f06a3,_0x42a346){return respondWithRpcPromise(_0xbe14('0x3f'),_0x4f06a3[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x4f06a3[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x42a346,null))[_0xbe14('0xc')](handleError(_0x42a346,null));};exports['mailQueues']=function(_0x72c875,_0x1b47a4){return respondWithRpcPromise(_0xbe14('0x41'),_0x72c875[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1b47a4,null))[_0xbe14('0xc')](handleError(_0x1b47a4,null));};exports[_0xbe14('0x42')]=function(_0x32df3c,_0x285b6e){return respondWithRpcPromise(_0xbe14('0x41'),_0x32df3c[_0xbe14('0x17')],routingClient)['then'](findById(_0x32df3c['params']['id']))['then'](respondWithResult(_0x285b6e,null))[_0xbe14('0xc')](handleError(_0x285b6e,null));};exports[_0xbe14('0x43')]=function(_0x2f4e52,_0xf79b21){return respondWithRpcPromise(_0xbe14('0x44'),_0x2f4e52[_0xbe14('0x17')],mailClient)[_0xbe14('0x8')](respondWithResult(_0xf79b21,null))[_0xbe14('0xc')](handleError(_0xf79b21,null));};exports[_0xbe14('0x45')]=function(_0x451b0b,_0x603816){return respondWithRpcPromise(_0xbe14('0x46'),_0x451b0b[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x603816,null))[_0xbe14('0xc')](handleError(_0x603816,null));};exports[_0xbe14('0x47')]=function(_0x179077,_0x2225d9){return respondWithRpcPromise(_0xbe14('0x46'),_0x179077[_0xbe14('0x17')],routingClient)['then'](findById(_0x179077[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x2225d9,null))[_0xbe14('0xc')](handleError(_0x2225d9,null));};exports[_0xbe14('0x48')]=function(_0x3ee6b7,_0x222944){return respondWithRpcPromise(_0xbe14('0x49'),_0x3ee6b7[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x222944,null))[_0xbe14('0xc')](handleError(_0x222944,null));};exports['showSmsQueues']=function(_0x18be56,_0x442ec4){return respondWithRpcPromise(_0xbe14('0x49'),_0x18be56[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x18be56['params']['id']))[_0xbe14('0x8')](respondWithResult(_0x442ec4,null))[_0xbe14('0xc')](handleError(_0x442ec4,null));};exports[_0xbe14('0x4a')]=function(_0xd4e1c7,_0x46ac9c){return respondWithRpcPromise('WhatsappQueues',_0xd4e1c7[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x46ac9c,null))[_0xbe14('0xc')](handleError(_0x46ac9c,null));};exports[_0xbe14('0x4b')]=function(_0xaebce8,_0x289c4d){return respondWithRpcPromise(_0xbe14('0x4c'),_0xaebce8[_0xbe14('0x17')],routingClient)['then'](findById(_0xaebce8[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x289c4d,null))[_0xbe14('0xc')](handleError(_0x289c4d,null));};exports[_0xbe14('0x4d')]=function(_0x5982b7,_0xa4b2a3){return respondWithRpcPromise(_0xbe14('0x4e'),_0x5982b7['query'],routingClient)['then'](respondWithResult(_0xa4b2a3,null))[_0xbe14('0xc')](handleError(_0xa4b2a3,null));};exports[_0xbe14('0x4f')]=function(_0x2d2643,_0x2510a0){return respondWithRpcPromise(_0xbe14('0x4e'),_0x2d2643[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x2d2643[_0xbe14('0x1b')]['id']))['then'](respondWithResult(_0x2510a0,null))['catch'](handleError(_0x2510a0,null));};exports[_0xbe14('0x50')]=function(_0x1c18b6,_0x29aa52){return respondWithRpcPromise('FaxAccounts',_0x1c18b6[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x29aa52,null))[_0xbe14('0xc')](handleError(_0x29aa52,null));};exports[_0xbe14('0x51')]=function(_0x468e9f,_0x1ef09b){return respondWithRpcPromise(_0xbe14('0x52'),_0x468e9f['query'],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1ef09b,null))[_0xbe14('0xc')](handleError(_0x1ef09b,null));};exports[_0xbe14('0x53')]=function(_0x3afc5a,_0x469555){return respondWithRpcPromise(_0xbe14('0x54'),_0x3afc5a[_0xbe14('0x17')],routingClient)['then'](respondWithResult(_0x469555,null))[_0xbe14('0xc')](handleError(_0x469555,null));};exports[_0xbe14('0x55')]=function(_0x3cd17e,_0x1c0932){return respondWithRpcPromise(_0xbe14('0x56'),_0x3cd17e[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1c0932,null))[_0xbe14('0xc')](handleError(_0x1c0932,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x1e5ce1,_0x401968){return respondWithRpcPromise(_0xbe14('0x56'),_0x1e5ce1[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](function(_0x17576b){if(_0x1e5ce1['query'][_0xbe14('0x57')]!==undefined){var _0x175213=_(_0x17576b[_0xbe14('0x13')])[_0xbe14('0x58')]([_0x1e5ce1['query'][_0xbe14('0x57')],_0x1e5ce1[_0xbe14('0x1b')]['id']])[_0xbe14('0x59')](_0xbe14('0x5a'))[_0xbe14('0x5b')]()[_0xbe14('0x5c')]();return _0x17576b[_0xbe14('0x13')]['filter'](function(_0x70ed08){return _0x175213['indexOf'](_0x70ed08[_0xbe14('0x5a')])>-0x1;});}else{return _0x17576b['rows'][_0xbe14('0x58')](function(_0x21837c){return _0x21837c[_0xbe14('0x5a')]===parseInt(_0x1e5ce1['params']['id']);});}})[_0xbe14('0x8')](respondWithResult(_0x401968,null))[_0xbe14('0xc')](handleError(_0x401968,null));};exports[_0xbe14('0x5d')]=function(_0x546f22,_0x41a896){return respondWithRpcPromise(_0xbe14('0x5e'),_0x546f22[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x41a896,null))['catch'](handleError(_0x41a896,null));};exports[_0xbe14('0x5f')]=function(_0x39bc54,_0x34f90b){return respondWithRpcPromise(_0xbe14('0x60'),_0x39bc54[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x34f90b,null))[_0xbe14('0xc')](handleError(_0x34f90b,null));};exports['faxQueuesWaitingInteractions']=function(_0x2ff94c,_0x123f4f){return respondWithRpcPromise(_0xbe14('0x61'),_0x2ff94c['query'],routingClient)[_0xbe14('0x8')](respondWithResult(_0x123f4f,null))[_0xbe14('0xc')](handleError(_0x123f4f,null));};exports[_0xbe14('0x62')]=function(_0x5bc52b){return function(_0xa53262,_0x1205d1){var _0x47d7bb,_0x2be969;var _0x49990b=_[_0xbe14('0x63')](_0x5bc52b);var _0x337073=_0x5bc52b==='chat'?'Website':_0xbe14('0x64');return db[_0x49990b+_0xbe14('0x65')][_0xbe14('0x66')]({'raw':!![],'where':{'id':_0xa53262['params']['id']}})[_0xbe14('0x8')](function(_0x30c03b){if(_[_0xbe14('0x12')](_0x30c03b)){throw new Error(_0x49990b+_0xbe14('0x67'));}_0x47d7bb=_0x30c03b;return db[_0x49990b+'Message']['findOne']({'where':{'id':_0xa53262[_0xbe14('0x20')][_0xbe14('0x68')]},'include':[{'model':db[_0x49990b+_0xbe14('0x69')],'as':_0xbe14('0x69')},{'model':db[_0x49990b+_0x337073],'as':_0xbe14('0x64')}]});})[_0xbe14('0x8')](function(_0x139aab){if(_['isNil'](_0x139aab)){throw new Error(_0x49990b+_0xbe14('0x6a'));}_0x2be969=_0x139aab;return _0x139aab['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xbe14('0x8')](function(){var _0x3a01bb={'uniqueid':_0x5bc52b+'.'+_0x2be969['id']+'.'+_0x2be969[_0xbe14('0x69')]['id'],'FromUserId':_0xa53262[_0xbe14('0x2f')]['id'],'type':'queue'};_0x3a01bb[_0x49990b+_0xbe14('0x6b')]=_0x2be969['id'];_0x3a01bb[_0x49990b+_0xbe14('0x6c')]=_0x2be969[_0xbe14('0x69')]['id'];_0x3a01bb['From'+_0x49990b+_0x337073+'Id']=_0x2be969[_0xbe14('0x64')]['id'];_0x3a01bb['To'+_0x49990b+_0xbe14('0x6d')]=_0x47d7bb['id'];return db[_0x49990b+_0xbe14('0x6e')][_0xbe14('0x6f')](_0x3a01bb);})[_0xbe14('0x8')](function(){return respondWithRpcPromise(_0xbe14('0x70'),{'channel':_0x5bc52b,'interaction':_0x2be969[_0xbe14('0x69')],'message':_0x2be969,'account':_0x2be969[_0xbe14('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbe14('0x71'),'appdata':_0x47d7bb[_0xbe14('0x10')]+','+(_0x2be969[_0xbe14('0x64')][_0xbe14('0x72')]||0x12c),'interval':_0xbe14('0x73')}]},routingClient);})[_0xbe14('0x8')](respondWithResult(_0x1205d1,null))[_0xbe14('0xc')](handleError(_0x1205d1,null));};};exports[_0xbe14('0x74')]=function(_0x1de70d,_0x30be9e){var _0x1679bd,_0x2ca6e6;if(_['isNil'](_0x1de70d[_0xbe14('0x20')]['channel'])){throw new Error(_0xbe14('0x75'));}var _0x1b8733=_0x1de70d[_0xbe14('0x20')][_0xbe14('0x76')];var _0x1d7b08=_['capitalize'](_0x1b8733);var _0x5868d7=_0x1b8733===_0xbe14('0x77')?_0xbe14('0x78'):_0xbe14('0x64');return db[_0xbe14('0x79')]['findOne']({'raw':!![],'where':{'id':_0x1de70d[_0xbe14('0x1b')]['id'],'role':_0xbe14('0x7a')}})['then'](function(_0x186225){if(_[_0xbe14('0x12')](_0x186225)){throw new Error(_0xbe14('0x7b'));}_0x1679bd=_0x186225;return db[_0x1d7b08+_0xbe14('0x7c')]['findOne']({'where':{'id':_0x1de70d[_0xbe14('0x20')]['messageId']},'include':[{'model':db[_0x1d7b08+'Interaction'],'as':_0xbe14('0x69')},{'model':db[_0x1d7b08+_0x5868d7],'as':_0xbe14('0x64')}]});})[_0xbe14('0x8')](function(_0x3d890b){if(_[_0xbe14('0x12')](_0x3d890b)){throw new Error(_0x1d7b08+'\x20Message\x20not\x20found');}_0x2ca6e6=_0x3d890b;return _0x3d890b[_0xbe14('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbe14('0x8')](function(){var _0x5dc793={'uniqueid':_0x1b8733+'.'+_0x2ca6e6['id']+'.'+_0x2ca6e6['Interaction']['id'],'FromUserId':_0x1de70d[_0xbe14('0x2f')]['id'],'type':_0xbe14('0x71'),'ToUserId':_0x1679bd['id']};_0x5dc793[_0x1d7b08+'MessageId']=_0x2ca6e6['id'];_0x5dc793[_0x1d7b08+_0xbe14('0x6c')]=_0x2ca6e6['Interaction']['id'];_0x5dc793[_0xbe14('0x7e')+_0x1d7b08+_0x5868d7+'Id']=_0x2ca6e6['Account']['id'];return db[_0x1d7b08+_0xbe14('0x6e')]['create'](_0x5dc793);})[_0xbe14('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1b8733,'interaction':_0x2ca6e6[_0xbe14('0x69')],'message':_0x2ca6e6,'account':_0x2ca6e6[_0xbe14('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1679bd['name']+','+(_0x2ca6e6[_0xbe14('0x64')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xbe14('0x8')](respondWithResult(_0x30be9e,null))[_0xbe14('0xc')](handleError(_0x30be9e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 366a809..a9e26f9 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 _0x2c79=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','post'];(function(_0x3e5e9f,_0x5fef20){var _0x25bf34=function(_0x6997e4){while(--_0x6997e4){_0x3e5e9f['push'](_0x3e5e9f['shift']());}};_0x25bf34(++_0x5fef20);}(_0x2c79,0x193));var _0x92c7=function(_0xba0cd7,_0x47f013){_0xba0cd7=_0xba0cd7-0x0;var _0x63e84e=_0x2c79[_0xba0cd7];return _0x63e84e;};'use strict';var multer=require(_0x92c7('0x0'));var util=require(_0x92c7('0x1'));var path=require(_0x92c7('0x2'));var timeout=require(_0x92c7('0x3'));var express=require(_0x92c7('0x4'));var router=express[_0x92c7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x92c7('0x6'));var interaction=require(_0x92c7('0x7'));var config=require('../../config/environment');var controller=require('./schedule.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x92c7('0x8')]('/:id',auth[_0x92c7('0x9')](),controller['show']);router[_0x92c7('0x8')]('/:id/run',auth[_0x92c7('0x9')](),controller['run']);router[_0x92c7('0xa')]('/',auth[_0x92c7('0x9')](),controller[_0x92c7('0xb')]);router[_0x92c7('0xc')](_0x92c7('0xd'),auth[_0x92c7('0x9')](),controller[_0x92c7('0xe')]);router[_0x92c7('0xf')](_0x92c7('0xd'),auth[_0x92c7('0x9')](),controller[_0x92c7('0x10')]);module[_0x92c7('0x11')]=router; \ No newline at end of file +var _0x6652=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/run','run','post','create','delete','multer','util','path','connect-timeout'];(function(_0x38c676,_0x5524d4){var _0x1853c4=function(_0x7ea8f8){while(--_0x7ea8f8){_0x38c676['push'](_0x38c676['shift']());}};_0x1853c4(++_0x5524d4);}(_0x6652,0xfb));var _0x2665=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x6652[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x2665('0x0'));var util=require(_0x2665('0x1'));var path=require(_0x2665('0x2'));var timeout=require(_0x2665('0x3'));var express=require(_0x2665('0x4'));var router=express[_0x2665('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2665('0x6'));var interaction=require(_0x2665('0x7'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x2665('0x8')]('/',auth[_0x2665('0x9')](),controller[_0x2665('0xa')]);router['get'](_0x2665('0xb'),auth[_0x2665('0x9')](),controller['show']);router['get'](_0x2665('0xc'),auth[_0x2665('0x9')](),controller[_0x2665('0xd')]);router[_0x2665('0xe')]('/',auth[_0x2665('0x9')](),controller[_0x2665('0xf')]);router['put'](_0x2665('0xb'),auth[_0x2665('0x9')](),controller['update']);router[_0x2665('0x10')](_0x2665('0xb'),auth[_0x2665('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 2a0b0f3..c4110dd 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 _0xa1d5=['years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1d5,0x134));var _0x5a1d=function(_0x5079c6,_0x4936eb){_0x5079c6=_0x5079c6-0x0;var _0xd6a3bf=_0xa1d5[_0x5079c6];return _0xd6a3bf;};'use strict';var Sequelize=require(_0x5a1d('0x0'));module[_0x5a1d('0x1')]={'name':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5a1d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5a1d('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x5a1d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5a1d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5a1d('0x6')](_0x5a1d('0x7'),_0x5a1d('0x8'),_0x5a1d('0x9'),_0x5a1d('0xa'),_0x5a1d('0xb'),_0x5a1d('0xc'),_0x5a1d('0xd')),'allowNull':![],'defaultValue':_0x5a1d('0xb')},'output':{'type':Sequelize[_0x5a1d('0x6')](_0x5a1d('0xe'),_0x5a1d('0xf'),_0x5a1d('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x5a1d('0x11'),_0x5a1d('0x12')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x5a1d('0x13')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5a1d('0x14')]},'bcc':{'type':Sequelize[_0x5a1d('0x14')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7a76=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','days','hours','ENUM','csv','pdf','xlsx','custom','default','sequelize'];(function(_0x5c80b7,_0x5c6250){var _0x4a20a7=function(_0x22dd64){while(--_0x22dd64){_0x5c80b7['push'](_0x5c80b7['shift']());}};_0x4a20a7(++_0x5c6250);}(_0x7a76,0x1df));var _0x67a7=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x7a76[_0x2bddf9];return _0x3f3ae9;};'use strict';var Sequelize=require(_0x67a7('0x0'));module['exports']={'name':{'type':Sequelize[_0x67a7('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x67a7('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x67a7('0x1')],'allowNull':![],'defaultValue':_0x67a7('0x3')},'startAt':{'type':Sequelize[_0x67a7('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x67a7('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x67a7('0x5'),_0x67a7('0x6'),_0x67a7('0x7'),'weeks',_0x67a7('0x8'),_0x67a7('0x9'),'minutes'),'allowNull':![],'defaultValue':_0x67a7('0x8')},'output':{'type':Sequelize[_0x67a7('0xa')](_0x67a7('0xb'),_0x67a7('0xc'),_0x67a7('0xd')),'allowNull':![],'defaultValue':_0x67a7('0xb')},'type':{'type':Sequelize[_0x67a7('0xa')](_0x67a7('0xe'),_0x67a7('0xf')),'allowNull':![],'defaultValue':_0x67a7('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x67a7('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 99a99b5..a240100 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 _0x328e=['count','includeAll','include','show','params','length','find','catch','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','apply','reject','save','update','then','destroy','get','Scheduler','error','stack','name','send','Schedule','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','merge','where','VIRTUAL','filter'];(function(_0x4c7dfb,_0x3b143c){var _0x36eb41=function(_0x4cc329){while(--_0x4cc329){_0x4c7dfb['push'](_0x4c7dfb['shift']());}};_0x36eb41(++_0x3b143c);}(_0x328e,0xf7));var _0xe328=function(_0x2f6aca,_0x28e665){_0x2f6aca=_0x2f6aca-0x0;var _0x494560=_0x328e[_0x2f6aca];return _0x494560;};'use strict';var emlformat=require(_0xe328('0x0'));var rimraf=require(_0xe328('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe328('0x2'));var rp=require(_0xe328('0x3'));var moment=require(_0xe328('0x4'));var BPromise=require(_0xe328('0x5'));var Mustache=require(_0xe328('0x6'));var util=require(_0xe328('0x7'));var path=require('path');var sox=require(_0xe328('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe328('0x9'));var squel=require(_0xe328('0xa'));var crypto=require(_0xe328('0xb'));var jsforce=require(_0xe328('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe328('0xd'));var querystring=require(_0xe328('0xe'));var Papa=require(_0xe328('0xf'));var Redis=require(_0xe328('0x10'));var authService=require(_0xe328('0x11'));var qs=require(_0xe328('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe328('0x13'));var logger=require(_0xe328('0x14'))(_0xe328('0x15'));var utils=require(_0xe328('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe328('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4601cf,_0xafd418){_0xafd418=_0xafd418||0xcc;return function(_0x24f680){if(_0x24f680){return _0x4601cf[_0xe328('0x18')](_0xafd418);}return _0x4601cf[_0xe328('0x19')](_0xafd418)[_0xe328('0x1a')]();};}function respondWithResult(_0x1d7a89,_0x4ac8a1){_0x4ac8a1=_0x4ac8a1||0xc8;return function(_0x263db0){if(_0x263db0){return _0x1d7a89['status'](_0x4ac8a1)[_0xe328('0x1b')](_0x263db0);}};}function respondWithFilteredResult(_0x33fee4,_0x57cdee){return function(_0x2b6c52){if(_0x2b6c52){var _0x6987b8=typeof _0x57cdee['offset']===_0xe328('0x1c')&&typeof _0x57cdee[_0xe328('0x1d')]==='undefined';var _0x3f4743=_0x2b6c52['count'];var _0x1f8d2d=_0x6987b8?0x0:_0x57cdee[_0xe328('0x1e')];var _0x33d499=_0x6987b8?_0x2b6c52['count']:_0x57cdee[_0xe328('0x1e')]+_0x57cdee[_0xe328('0x1d')];var _0x416cf4;if(_0x33d499>=_0x3f4743){_0x33d499=_0x3f4743;_0x416cf4=0xc8;}else{_0x416cf4=0xce;}_0x33fee4['status'](_0x416cf4);return _0x33fee4['set']('Content-Range',_0x1f8d2d+'-'+_0x33d499+'/'+_0x3f4743)[_0xe328('0x1b')](_0x2b6c52);}return null;};}function patchUpdates(_0x3dd5e9){return function(_0x4bc665){try{jsonpatch[_0xe328('0x1f')](_0x4bc665,_0x3dd5e9,!![]);}catch(_0x46f718){return BPromise[_0xe328('0x20')](_0x46f718);}return _0x4bc665[_0xe328('0x21')]();};}function saveUpdates(_0x4b9d40,_0x17672e){return function(_0x51e301){if(_0x51e301){return _0x51e301[_0xe328('0x22')](_0x4b9d40)[_0xe328('0x23')](function(_0x180cf0){return _0x180cf0;});}return null;};}function removeEntity(_0x3fc1f2,_0x57a9ef){return function(_0x103de2){if(_0x103de2){return _0x103de2[_0xe328('0x24')]()[_0xe328('0x23')](function(){var _0x181eca=_0x103de2[_0xe328('0x25')]({'plain':!![]});var _0x3f020c=_0xe328('0x26');return db['UserProfileResource'][_0xe328('0x24')]({'where':{'type':_0x3f020c,'resourceId':_0x181eca['id']}})['then'](function(){return _0x103de2;});})[_0xe328('0x23')](function(){_0x3fc1f2[_0xe328('0x19')](0xcc)[_0xe328('0x1a')]();});}};}function handleEntityNotFound(_0x22e745,_0x4db67f){return function(_0x4fdc7c){if(!_0x4fdc7c){_0x22e745[_0xe328('0x18')](0x194);}return _0x4fdc7c;};}function handleError(_0x219ca0,_0x2fe91b){_0x2fe91b=_0x2fe91b||0x1f4;return function(_0x7c4613){logger[_0xe328('0x27')](_0x7c4613[_0xe328('0x28')]);if(_0x7c4613[_0xe328('0x29')]){delete _0x7c4613[_0xe328('0x29')];}_0x219ca0[_0xe328('0x19')](_0x2fe91b)[_0xe328('0x2a')](_0x7c4613);};}exports['index']=function(_0x3c0319,_0x4723d9){var _0x567368={},_0x40f454={},_0x55b8fe={'count':0x0,'rows':[]};var _0x36c669=_['map'](db[_0xe328('0x2b')][_0xe328('0x2c')],function(_0x13d7e9){return{'name':_0x13d7e9['fieldName'],'type':_0x13d7e9[_0xe328('0x2d')]['key']};});_0x40f454[_0xe328('0x2e')]=_[_0xe328('0x2f')](_0x36c669,_0xe328('0x29'));_0x40f454['query']=_[_0xe328('0x30')](_0x3c0319[_0xe328('0x31')]);_0x40f454[_0xe328('0x32')]=_[_0xe328('0x33')](_0x40f454['model'],_0x40f454[_0xe328('0x31')]);_0x567368[_0xe328('0x34')]=_['intersection'](_0x40f454[_0xe328('0x2e')],qs[_0xe328('0x35')](_0x3c0319[_0xe328('0x31')][_0xe328('0x35')]));_0x567368[_0xe328('0x34')]=_0x567368[_0xe328('0x34')]['length']?_0x567368[_0xe328('0x34')]:_0x40f454['model'];if(!_0x3c0319[_0xe328('0x31')][_0xe328('0x36')]('nolimit')){_0x567368[_0xe328('0x1d')]=qs[_0xe328('0x1d')](_0x3c0319['query'][_0xe328('0x1d')]);_0x567368[_0xe328('0x1e')]=qs['offset'](_0x3c0319[_0xe328('0x31')]['offset']);}_0x567368['order']=qs['sort'](_0x3c0319[_0xe328('0x31')][_0xe328('0x37')]);_0x567368['where']=qs['filters'](_[_0xe328('0x38')](_0x3c0319[_0xe328('0x31')],_0x40f454[_0xe328('0x32')]),_0x36c669);if(_0x3c0319[_0xe328('0x31')]['filter']){_0x567368['where']=_[_0xe328('0x39')](_0x567368[_0xe328('0x3a')],{'$or':_['map'](_0x36c669,function(_0x14886d){if(_0x14886d[_0xe328('0x2d')]!==_0xe328('0x3b')){var _0x34efc0={};_0x34efc0[_0x14886d[_0xe328('0x29')]]={'$like':'%'+_0x3c0319[_0xe328('0x31')][_0xe328('0x3c')]+'%'};return _0x34efc0;}})});}_0x567368=_[_0xe328('0x39')]({},_0x567368,_0x3c0319['options']);var _0x4f6323={'where':_0x567368[_0xe328('0x3a')]};return db[_0xe328('0x2b')]['count'](_0x4f6323)[_0xe328('0x23')](function(_0x33fc49){_0x55b8fe[_0xe328('0x3d')]=_0x33fc49;if(_0x3c0319['query'][_0xe328('0x3e')]){_0x567368[_0xe328('0x3f')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x567368);})[_0xe328('0x23')](function(_0x48a5eb){_0x55b8fe['rows']=_0x48a5eb;return _0x55b8fe;})[_0xe328('0x23')](respondWithFilteredResult(_0x4723d9,_0x567368))['catch'](handleError(_0x4723d9,null));};exports[_0xe328('0x40')]=function(_0x313e61,_0x4eb13d){var _0x5cb26e={'raw':![],'where':{'id':_0x313e61[_0xe328('0x41')]['id']}},_0x321418={};_0x321418['model']=_[_0xe328('0x30')](db[_0xe328('0x2b')]['rawAttributes']);_0x321418[_0xe328('0x31')]=_['keys'](_0x313e61[_0xe328('0x31')]);_0x321418[_0xe328('0x32')]=_[_0xe328('0x33')](_0x321418[_0xe328('0x2e')],_0x321418[_0xe328('0x31')]);_0x5cb26e[_0xe328('0x34')]=_[_0xe328('0x33')](_0x321418[_0xe328('0x2e')],qs[_0xe328('0x35')](_0x313e61[_0xe328('0x31')][_0xe328('0x35')]));_0x5cb26e[_0xe328('0x34')]=_0x5cb26e[_0xe328('0x34')][_0xe328('0x42')]?_0x5cb26e[_0xe328('0x34')]:_0x321418[_0xe328('0x2e')];if(_0x313e61[_0xe328('0x31')]['includeAll']){_0x5cb26e[_0xe328('0x3f')]=[{'all':!![]}];}_0x5cb26e=_[_0xe328('0x39')]({},_0x5cb26e,_0x313e61['options']);return db[_0xe328('0x2b')][_0xe328('0x43')](_0x5cb26e)[_0xe328('0x23')](handleEntityNotFound(_0x4eb13d,null))['then'](respondWithResult(_0x4eb13d,null))[_0xe328('0x44')](handleError(_0x4eb13d,null));};exports[_0xe328('0x45')]=function(_0x18c149,_0x534246){return db[_0xe328('0x2b')][_0xe328('0x45')](_0x18c149[_0xe328('0x46')],{})[_0xe328('0x23')](function(_0x4f2cbd){var _0xbc1bc3=_0x18c149[_0xe328('0x47')]['get']({'plain':!![]});if(!_0xbc1bc3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbc1bc3[_0xe328('0x48')]===_0xe328('0x47')){var _0x33075a=_0x4f2cbd[_0xe328('0x25')]({'plain':!![]});var _0x29462d=_0xe328('0x26');return db[_0xe328('0x49')][_0xe328('0x43')]({'where':{'name':_0x29462d,'userProfileId':_0xbc1bc3[_0xe328('0x4a')]},'raw':!![]})[_0xe328('0x23')](function(_0x2f4a30){if(_0x2f4a30&&_0x2f4a30['autoAssociation']===0x0){return db[_0xe328('0x4b')][_0xe328('0x45')]({'name':_0x33075a[_0xe328('0x29')],'resourceId':_0x33075a['id'],'type':_0x2f4a30[_0xe328('0x29')],'sectionId':_0x2f4a30['id']},{})[_0xe328('0x23')](function(){return _0x4f2cbd;});}else{return _0x4f2cbd;}})[_0xe328('0x44')](function(_0x399727){logger[_0xe328('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x399727);throw _0x399727;});}return _0x4f2cbd;})[_0xe328('0x23')](respondWithResult(_0x534246,0xc9))[_0xe328('0x44')](handleError(_0x534246,null));};exports[_0xe328('0x22')]=function(_0x10a36d,_0x3b970c){if(_0x10a36d['body']['id']){delete _0x10a36d[_0xe328('0x46')]['id'];}return db[_0xe328('0x2b')][_0xe328('0x43')]({'where':{'id':_0x10a36d[_0xe328('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b970c,null))[_0xe328('0x23')](saveUpdates(_0x10a36d[_0xe328('0x46')],null))[_0xe328('0x23')](respondWithResult(_0x3b970c,null))[_0xe328('0x44')](handleError(_0x3b970c,null));};exports[_0xe328('0x24')]=function(_0x48722f,_0x1fb933){return db[_0xe328('0x2b')][_0xe328('0x43')]({'where':{'id':_0x48722f[_0xe328('0x41')]['id']}})['then'](handleEntityNotFound(_0x1fb933,null))[_0xe328('0x23')](removeEntity(_0x1fb933,null))['catch'](handleError(_0x1fb933,null));};exports['run']=function(_0x690eac,_0x42738a,_0x2ab0ff){var _0x4ed855=require(_0xe328('0x4c'));return db[_0xe328('0x2b')][_0xe328('0x43')]({'where':{'id':_0x690eac[_0xe328('0x41')]['id']},'raw':!![]})[_0xe328('0x23')](handleEntityNotFound(_0x42738a,null))[_0xe328('0x23')](function(){_0x4ed855['run'](_0x690eac[_0xe328('0x41')]['id']);})['then'](respondWithStatusCode(_0x42738a,null))[_0xe328('0x44')](handleError(_0x42738a,null));}; \ No newline at end of file +var _0x1a9d=['stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','pick','filter','where','merge','includeAll','include','findAll','params','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error'];(function(_0x42be6d,_0x52fdd6){var _0x164ca8=function(_0x820098){while(--_0x820098){_0x42be6d['push'](_0x42be6d['shift']());}};_0x164ca8(++_0x52fdd6);}(_0x1a9d,0x11f));var _0xd1a9=function(_0xcad34d,_0x1b63bd){_0xcad34d=_0xcad34d-0x0;var _0x4360f9=_0x1a9d[_0xcad34d];return _0x4360f9;};'use strict';var emlformat=require(_0xd1a9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd1a9('0x1'));var rp=require(_0xd1a9('0x2'));var moment=require(_0xd1a9('0x3'));var BPromise=require(_0xd1a9('0x4'));var Mustache=require(_0xd1a9('0x5'));var util=require(_0xd1a9('0x6'));var path=require(_0xd1a9('0x7'));var sox=require(_0xd1a9('0x8'));var csv=require(_0xd1a9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1a9('0xa'));var squel=require(_0xd1a9('0xb'));var crypto=require(_0xd1a9('0xc'));var jsforce=require(_0xd1a9('0xd'));var deskjs=require(_0xd1a9('0xe'));var toCsv=require(_0xd1a9('0x9'));var querystring=require(_0xd1a9('0xf'));var Papa=require(_0xd1a9('0x10'));var Redis=require('ioredis');var authService=require(_0xd1a9('0x11'));var qs=require(_0xd1a9('0x12'));var as=require(_0xd1a9('0x13'));var hardwareService=require(_0xd1a9('0x14'));var logger=require(_0xd1a9('0x15'))(_0xd1a9('0x16'));var utils=require(_0xd1a9('0x17'));var config=require(_0xd1a9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1a9('0x19'))['db'];function respondWithStatusCode(_0x24e11d,_0x3e2ec4){_0x3e2ec4=_0x3e2ec4||0xcc;return function(_0x1efd07){if(_0x1efd07){return _0x24e11d[_0xd1a9('0x1a')](_0x3e2ec4);}return _0x24e11d[_0xd1a9('0x1b')](_0x3e2ec4)[_0xd1a9('0x1c')]();};}function respondWithResult(_0x13ddd9,_0x3a6cad){_0x3a6cad=_0x3a6cad||0xc8;return function(_0x459709){if(_0x459709){return _0x13ddd9[_0xd1a9('0x1b')](_0x3a6cad)[_0xd1a9('0x1d')](_0x459709);}};}function respondWithFilteredResult(_0x47c848,_0x51b166){return function(_0x3c0a1d){if(_0x3c0a1d){var _0x58ebce=typeof _0x51b166['offset']==='undefined'&&typeof _0x51b166[_0xd1a9('0x1e')]===_0xd1a9('0x1f');var _0x280e97=_0x3c0a1d[_0xd1a9('0x20')];var _0x1b23b0=_0x58ebce?0x0:_0x51b166['offset'];var _0x34a9af=_0x58ebce?_0x3c0a1d[_0xd1a9('0x20')]:_0x51b166[_0xd1a9('0x21')]+_0x51b166[_0xd1a9('0x1e')];var _0x22be76;if(_0x34a9af>=_0x280e97){_0x34a9af=_0x280e97;_0x22be76=0xc8;}else{_0x22be76=0xce;}_0x47c848['status'](_0x22be76);return _0x47c848[_0xd1a9('0x22')](_0xd1a9('0x23'),_0x1b23b0+'-'+_0x34a9af+'/'+_0x280e97)[_0xd1a9('0x1d')](_0x3c0a1d);}return null;};}function patchUpdates(_0x9e1031){return function(_0x16cbfe){try{jsonpatch[_0xd1a9('0x24')](_0x16cbfe,_0x9e1031,!![]);}catch(_0x2e7a39){return BPromise[_0xd1a9('0x25')](_0x2e7a39);}return _0x16cbfe['save']();};}function saveUpdates(_0x192a89,_0x44e0e7){return function(_0x5cb955){if(_0x5cb955){return _0x5cb955[_0xd1a9('0x26')](_0x192a89)[_0xd1a9('0x27')](function(_0x4e6e8e){return _0x4e6e8e;});}return null;};}function removeEntity(_0x2131ee,_0xc53c7d){return function(_0x4f6e9f){if(_0x4f6e9f){return _0x4f6e9f[_0xd1a9('0x28')]()[_0xd1a9('0x27')](function(){var _0x39de86=_0x4f6e9f[_0xd1a9('0x29')]({'plain':!![]});var _0x1740a6=_0xd1a9('0x2a');return db[_0xd1a9('0x2b')]['destroy']({'where':{'type':_0x1740a6,'resourceId':_0x39de86['id']}})[_0xd1a9('0x27')](function(){return _0x4f6e9f;});})[_0xd1a9('0x27')](function(){_0x2131ee[_0xd1a9('0x1b')](0xcc)[_0xd1a9('0x1c')]();});}};}function handleEntityNotFound(_0x46543d,_0x44cc0b){return function(_0x2ee1b7){if(!_0x2ee1b7){_0x46543d[_0xd1a9('0x1a')](0x194);}return _0x2ee1b7;};}function handleError(_0xf59161,_0x340c09){_0x340c09=_0x340c09||0x1f4;return function(_0x132f4e){logger[_0xd1a9('0x2c')](_0x132f4e[_0xd1a9('0x2d')]);if(_0x132f4e[_0xd1a9('0x2e')]){delete _0x132f4e[_0xd1a9('0x2e')];}_0xf59161['status'](_0x340c09)[_0xd1a9('0x2f')](_0x132f4e);};}exports[_0xd1a9('0x30')]=function(_0x14a6fc,_0x50a357){var _0x2821db={},_0x5ba025={},_0x258374={'count':0x0,'rows':[]};var _0x3133e5=_[_0xd1a9('0x31')](db[_0xd1a9('0x32')][_0xd1a9('0x33')],function(_0x43ef8d){return{'name':_0x43ef8d[_0xd1a9('0x34')],'type':_0x43ef8d[_0xd1a9('0x35')][_0xd1a9('0x36')]};});_0x5ba025[_0xd1a9('0x37')]=_[_0xd1a9('0x31')](_0x3133e5,_0xd1a9('0x2e'));_0x5ba025[_0xd1a9('0x38')]=_[_0xd1a9('0x39')](_0x14a6fc[_0xd1a9('0x38')]);_0x5ba025[_0xd1a9('0x3a')]=_[_0xd1a9('0x3b')](_0x5ba025[_0xd1a9('0x37')],_0x5ba025[_0xd1a9('0x38')]);_0x2821db['attributes']=_['intersection'](_0x5ba025[_0xd1a9('0x37')],qs[_0xd1a9('0x3c')](_0x14a6fc[_0xd1a9('0x38')]['fields']));_0x2821db[_0xd1a9('0x3d')]=_0x2821db[_0xd1a9('0x3d')][_0xd1a9('0x3e')]?_0x2821db['attributes']:_0x5ba025[_0xd1a9('0x37')];if(!_0x14a6fc[_0xd1a9('0x38')]['hasOwnProperty']('nolimit')){_0x2821db[_0xd1a9('0x1e')]=qs['limit'](_0x14a6fc[_0xd1a9('0x38')]['limit']);_0x2821db['offset']=qs[_0xd1a9('0x21')](_0x14a6fc[_0xd1a9('0x38')][_0xd1a9('0x21')]);}_0x2821db['order']=qs['sort'](_0x14a6fc[_0xd1a9('0x38')]['sort']);_0x2821db['where']=qs[_0xd1a9('0x3a')](_[_0xd1a9('0x3f')](_0x14a6fc[_0xd1a9('0x38')],_0x5ba025['filters']),_0x3133e5);if(_0x14a6fc[_0xd1a9('0x38')][_0xd1a9('0x40')]){_0x2821db[_0xd1a9('0x41')]=_[_0xd1a9('0x42')](_0x2821db[_0xd1a9('0x41')],{'$or':_[_0xd1a9('0x31')](_0x3133e5,function(_0x4129eb){if(_0x4129eb[_0xd1a9('0x35')]!=='VIRTUAL'){var _0x186c70={};_0x186c70[_0x4129eb[_0xd1a9('0x2e')]]={'$like':'%'+_0x14a6fc[_0xd1a9('0x38')][_0xd1a9('0x40')]+'%'};return _0x186c70;}})});}_0x2821db=_['merge']({},_0x2821db,_0x14a6fc['options']);var _0x94d21c={'where':_0x2821db[_0xd1a9('0x41')]};return db[_0xd1a9('0x32')][_0xd1a9('0x20')](_0x94d21c)[_0xd1a9('0x27')](function(_0x4c4518){_0x258374[_0xd1a9('0x20')]=_0x4c4518;if(_0x14a6fc[_0xd1a9('0x38')][_0xd1a9('0x43')]){_0x2821db[_0xd1a9('0x44')]=[{'all':!![]}];}return db['Schedule'][_0xd1a9('0x45')](_0x2821db);})[_0xd1a9('0x27')](function(_0x3993f5){_0x258374['rows']=_0x3993f5;return _0x258374;})[_0xd1a9('0x27')](respondWithFilteredResult(_0x50a357,_0x2821db))['catch'](handleError(_0x50a357,null));};exports['show']=function(_0x4faf85,_0x551ca1){var _0x1f4e9f={'raw':![],'where':{'id':_0x4faf85[_0xd1a9('0x46')]['id']}},_0x42a01a={};_0x42a01a['model']=_[_0xd1a9('0x39')](db['Schedule'][_0xd1a9('0x33')]);_0x42a01a[_0xd1a9('0x38')]=_[_0xd1a9('0x39')](_0x4faf85[_0xd1a9('0x38')]);_0x42a01a[_0xd1a9('0x3a')]=_[_0xd1a9('0x3b')](_0x42a01a[_0xd1a9('0x37')],_0x42a01a['query']);_0x1f4e9f[_0xd1a9('0x3d')]=_[_0xd1a9('0x3b')](_0x42a01a[_0xd1a9('0x37')],qs[_0xd1a9('0x3c')](_0x4faf85[_0xd1a9('0x38')][_0xd1a9('0x3c')]));_0x1f4e9f[_0xd1a9('0x3d')]=_0x1f4e9f[_0xd1a9('0x3d')][_0xd1a9('0x3e')]?_0x1f4e9f['attributes']:_0x42a01a[_0xd1a9('0x37')];if(_0x4faf85[_0xd1a9('0x38')][_0xd1a9('0x43')]){_0x1f4e9f['include']=[{'all':!![]}];}_0x1f4e9f=_['merge']({},_0x1f4e9f,_0x4faf85[_0xd1a9('0x47')]);return db['Schedule'][_0xd1a9('0x48')](_0x1f4e9f)[_0xd1a9('0x27')](handleEntityNotFound(_0x551ca1,null))[_0xd1a9('0x27')](respondWithResult(_0x551ca1,null))[_0xd1a9('0x49')](handleError(_0x551ca1,null));};exports['create']=function(_0x31e1d1,_0x1b9214){return db[_0xd1a9('0x32')][_0xd1a9('0x4a')](_0x31e1d1['body'],{})['then'](function(_0xbf09d9){var _0xd29efd=_0x31e1d1['user'][_0xd1a9('0x29')]({'plain':!![]});if(!_0xd29efd)throw new Error(_0xd1a9('0x4b'));if(_0xd29efd[_0xd1a9('0x4c')]===_0xd1a9('0x4d')){var _0x1ed620=_0xbf09d9[_0xd1a9('0x29')]({'plain':!![]});var _0x1ea78a=_0xd1a9('0x2a');return db[_0xd1a9('0x4e')]['find']({'where':{'name':_0x1ea78a,'userProfileId':_0xd29efd[_0xd1a9('0x4f')]},'raw':!![]})[_0xd1a9('0x27')](function(_0x5f43be){if(_0x5f43be&&_0x5f43be['autoAssociation']===0x0){return db['UserProfileResource'][_0xd1a9('0x4a')]({'name':_0x1ed620[_0xd1a9('0x2e')],'resourceId':_0x1ed620['id'],'type':_0x5f43be[_0xd1a9('0x2e')],'sectionId':_0x5f43be['id']},{})['then'](function(){return _0xbf09d9;});}else{return _0xbf09d9;}})['catch'](function(_0x41ad4c){logger[_0xd1a9('0x2c')](_0xd1a9('0x50'),_0x41ad4c);throw _0x41ad4c;});}return _0xbf09d9;})[_0xd1a9('0x27')](respondWithResult(_0x1b9214,0xc9))[_0xd1a9('0x49')](handleError(_0x1b9214,null));};exports[_0xd1a9('0x26')]=function(_0x55acaf,_0x559c3a){if(_0x55acaf['body']['id']){delete _0x55acaf['body']['id'];}return db['Schedule'][_0xd1a9('0x48')]({'where':{'id':_0x55acaf['params']['id']}})[_0xd1a9('0x27')](handleEntityNotFound(_0x559c3a,null))[_0xd1a9('0x27')](saveUpdates(_0x55acaf['body'],null))[_0xd1a9('0x27')](respondWithResult(_0x559c3a,null))[_0xd1a9('0x49')](handleError(_0x559c3a,null));};exports[_0xd1a9('0x28')]=function(_0x44eec2,_0x48913e){return db[_0xd1a9('0x32')][_0xd1a9('0x48')]({'where':{'id':_0x44eec2[_0xd1a9('0x46')]['id']}})[_0xd1a9('0x27')](handleEntityNotFound(_0x48913e,null))[_0xd1a9('0x27')](removeEntity(_0x48913e,null))[_0xd1a9('0x49')](handleError(_0x48913e,null));};exports['run']=function(_0x1bf266,_0x647d52,_0x4dec65){var _0x256664=require(_0xd1a9('0x51'));return db[_0xd1a9('0x32')][_0xd1a9('0x48')]({'where':{'id':_0x1bf266[_0xd1a9('0x46')]['id']},'raw':!![]})[_0xd1a9('0x27')](handleEntityNotFound(_0x647d52,null))[_0xd1a9('0x27')](function(){_0x256664[_0xd1a9('0x52')](_0x1bf266[_0xd1a9('0x46')]['id']);})[_0xd1a9('0x27')](respondWithStatusCode(_0x647d52,null))['catch'](handleError(_0x647d52,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 17da35c..9e02c35 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 _0x4121=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x2f1a6e,_0x3082cb){var _0x5865e5=function(_0x459f1a){while(--_0x459f1a){_0x2f1a6e['push'](_0x2f1a6e['shift']());}};_0x5865e5(++_0x3082cb);}(_0x4121,0x14c));var _0x1412=function(_0x4435f2,_0x9895a9){_0x4435f2=_0x4435f2-0x0;var _0x4dd591=_0x4121[_0x4435f2];return _0x4dd591;};'use strict';var _=require(_0x1412('0x0'));var util=require('util');var logger=require(_0x1412('0x1'))(_0x1412('0x2'));var moment=require(_0x1412('0x3'));var BPromise=require(_0x1412('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1412('0x5'));var rimraf=require(_0x1412('0x6'));var config=require(_0x1412('0x7'));var attributes=require(_0x1412('0x8'));module[_0x1412('0x9')]=function(_0x473452,_0x37e9bd){return _0x473452[_0x1412('0xa')](_0x1412('0xb'),attributes,{'tableName':_0x1412('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x493a=['define','tools_schedules','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x1c75bc,_0x474bac){var _0x30578b=function(_0xc94d85){while(--_0xc94d85){_0x1c75bc['push'](_0x1c75bc['shift']());}};_0x30578b(++_0x474bac);}(_0x493a,0x1ca));var _0xa493=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x493a[_0x51b661];return _0x5d1971;};'use strict';var _=require(_0xa493('0x0'));var util=require('util');var logger=require(_0xa493('0x1'))(_0xa493('0x2'));var moment=require(_0xa493('0x3'));var BPromise=require(_0xa493('0x4'));var rp=require(_0xa493('0x5'));var fs=require('fs');var path=require(_0xa493('0x6'));var rimraf=require(_0xa493('0x7'));var config=require(_0xa493('0x8'));var attributes=require(_0xa493('0x9'));module['exports']=function(_0x113147,_0x2d4b85){return _0x113147[_0xa493('0xa')]('Schedule',attributes,{'tableName':_0xa493('0xb'),'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 15a066f..7d028ad 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 _0xfeb2=['../../mysqldb','../../config/environment','jayson/promise','client','request','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','info','request\x20sent','result','util','moment','bluebird','randomstring'];(function(_0x5d0547,_0x166ae8){var _0xef47ef=function(_0x12c3ff){while(--_0x12c3ff){_0x5d0547['push'](_0x5d0547['shift']());}};_0xef47ef(++_0x166ae8);}(_0xfeb2,0x7a));var _0x2feb=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xfeb2[_0x14a0a0];return _0x56b651;};'use strict';var _=require('lodash');var util=require(_0x2feb('0x0'));var moment=require(_0x2feb('0x1'));var BPromise=require(_0x2feb('0x2'));var rs=require(_0x2feb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2feb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2feb('0x5'));var jayson=require(_0x2feb('0x6'));var client=jayson[_0x2feb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x358732,_0x5846e6,_0x2cd276){return new BPromise(function(_0x192c14,_0x1bc7e4){return client[_0x2feb('0x8')](_0x358732,_0x2cd276)['then'](function(_0x108deb){logger['info']('Schedule,\x20%s,\x20%s',_0x5846e6,'request\x20sent');logger[_0x2feb('0x9')](_0x2feb('0xa'),_0x5846e6,'request\x20sent',JSON[_0x2feb('0xb')](_0x108deb));if(_0x108deb['error']){if(_0x108deb[_0x2feb('0xc')]['code']===0x1f4){logger[_0x2feb('0xc')](_0x2feb('0xd'),_0x5846e6,_0x108deb[_0x2feb('0xc')]['message']);return _0x1bc7e4(_0x108deb[_0x2feb('0xc')][_0x2feb('0xe')]);}logger[_0x2feb('0xc')](_0x2feb('0xd'),_0x5846e6,_0x108deb[_0x2feb('0xc')][_0x2feb('0xe')]);return _0x192c14(_0x108deb['error']['message']);}else{logger[_0x2feb('0xf')](_0x2feb('0xd'),_0x5846e6,_0x2feb('0x10'));_0x192c14(_0x108deb[_0x2feb('0x11')][_0x2feb('0xe')]);}})['catch'](function(_0x580c07){logger[_0x2feb('0xc')](_0x2feb('0xd'),_0x5846e6,_0x580c07);_0x1bc7e4(_0x580c07);});});} \ No newline at end of file +var _0xd53b=['bluebird','randomstring','ioredis','rpc','../../config/environment','client','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment'];(function(_0x476b6a,_0x1581c8){var _0x526570=function(_0x8459c7){while(--_0x8459c7){_0x476b6a['push'](_0x476b6a['shift']());}};_0x526570(++_0x1581c8);}(_0xd53b,0x11d));var _0xbd53=function(_0x2d062b,_0x7d1243){_0x2d062b=_0x2d062b-0x0;var _0x288391=_0xd53b[_0x2d062b];return _0x288391;};'use strict';var _=require(_0xbd53('0x0'));var util=require(_0xbd53('0x1'));var moment=require(_0xbd53('0x2'));var BPromise=require(_0xbd53('0x3'));var rs=require(_0xbd53('0x4'));var fs=require('fs');var Redis=require(_0xbd53('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbd53('0x6'));var config=require(_0xbd53('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbd53('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5809d0,_0x3573e7,_0x5e0f2b){return new BPromise(function(_0x25feee,_0x24b8e5){return client['request'](_0x5809d0,_0x5e0f2b)['then'](function(_0x41f384){logger['info'](_0xbd53('0x9'),_0x3573e7,_0xbd53('0xa'));logger[_0xbd53('0xb')](_0xbd53('0xc'),_0x3573e7,'request\x20sent',JSON[_0xbd53('0xd')](_0x41f384));if(_0x41f384[_0xbd53('0xe')]){if(_0x41f384['error']['code']===0x1f4){logger[_0xbd53('0xe')](_0xbd53('0x9'),_0x3573e7,_0x41f384[_0xbd53('0xe')]['message']);return _0x24b8e5(_0x41f384['error']['message']);}logger['error'](_0xbd53('0x9'),_0x3573e7,_0x41f384[_0xbd53('0xe')][_0xbd53('0xf')]);return _0x25feee(_0x41f384[_0xbd53('0xe')][_0xbd53('0xf')]);}else{logger[_0xbd53('0x10')](_0xbd53('0x9'),_0x3573e7,_0xbd53('0xa'));_0x25feee(_0x41f384['result']['message']);}})[_0xbd53('0x11')](function(_0x35a8b2){logger['error'](_0xbd53('0x9'),_0x3573e7,_0x35a8b2);_0x24b8e5(_0x35a8b2);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f2df8c3..906e7de 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 _0x0f4e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x2ef7be,_0x10529d){var _0x2f5c6b=function(_0x1570d2){while(--_0x1570d2){_0x2ef7be['push'](_0x2ef7be['shift']());}};_0x2f5c6b(++_0x10529d);}(_0x0f4e,0x166));var _0xe0f4=function(_0x45030e,_0x32b6b8){_0x45030e=_0x45030e-0x0;var _0x4df3be=_0x0f4e[_0x45030e];return _0x4df3be;};'use strict';var multer=require(_0xe0f4('0x0'));var util=require('util');var path=require(_0xe0f4('0x1'));var timeout=require(_0xe0f4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe0f4('0x3'));var interaction=require(_0xe0f4('0x4'));var config=require(_0xe0f4('0x5'));var controller=require('./screenRecording.controller');router[_0xe0f4('0x6')]('/',auth[_0xe0f4('0x7')](),controller[_0xe0f4('0x8')]);router[_0xe0f4('0x6')]('/describe',auth[_0xe0f4('0x7')](),controller[_0xe0f4('0x9')]);router[_0xe0f4('0x6')](_0xe0f4('0xa'),auth['isAuthenticated'](),controller[_0xe0f4('0xb')]);router[_0xe0f4('0x6')](_0xe0f4('0xc'),auth[_0xe0f4('0x7')](),controller[_0xe0f4('0xd')]);router[_0xe0f4('0xe')]('/',auth[_0xe0f4('0x7')](),controller['create']);router[_0xe0f4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe0f4('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe0f4('0x11')]);module[_0xe0f4('0x12')]=router; \ No newline at end of file +var _0xd624=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','multer','util','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd624,0x129));var _0x4d62=function(_0xf219a5,_0x2331d4){_0xf219a5=_0xf219a5-0x0;var _0x10eab7=_0xd624[_0xf219a5];return _0x10eab7;};'use strict';var multer=require(_0x4d62('0x0'));var util=require(_0x4d62('0x1'));var path=require(_0x4d62('0x2'));var timeout=require(_0x4d62('0x3'));var express=require(_0x4d62('0x4'));var router=express['Router']();var fs_extra=require(_0x4d62('0x5'));var auth=require(_0x4d62('0x6'));var interaction=require(_0x4d62('0x7'));var config=require(_0x4d62('0x8'));var controller=require('./screenRecording.controller');router[_0x4d62('0x9')]('/',auth[_0x4d62('0xa')](),controller[_0x4d62('0xb')]);router[_0x4d62('0x9')](_0x4d62('0xc'),auth[_0x4d62('0xa')](),controller[_0x4d62('0xd')]);router['get'](_0x4d62('0xe'),auth[_0x4d62('0xa')](),controller['show']);router[_0x4d62('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x4d62('0xa')](),controller[_0x4d62('0xf')]);router[_0x4d62('0x10')](_0x4d62('0xe'),auth['isAuthenticated'](),controller[_0x4d62('0x11')]);router[_0x4d62('0x12')](_0x4d62('0xe'),auth['isAuthenticated'](),controller[_0x4d62('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c1d8bbb..55ee8af 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 _0x6629=['subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','DATE','toString','createdAt','updatedAt','sequelize','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','INTEGER','setDataValue','startedAt'];(function(_0x313011,_0x8f2334){var _0x5eaffc=function(_0x5da719){while(--_0x5da719){_0x313011['push'](_0x313011['shift']());}};_0x5eaffc(++_0x8f2334);}(_0x6629,0x1c2));var _0x9662=function(_0x2f67f2,_0x21fe22){_0x2f67f2=_0x2f67f2-0x0;var _0x139360=_0x6629[_0x2f67f2];return _0x139360;};'use strict';var Sequelize=require(_0x9662('0x0'));var moment=require('moment');var path=require('path');var config=require(_0x9662('0x1'));module[_0x9662('0x2')]={'format':{'type':Sequelize[_0x9662('0x3')],'get':function(){return this[_0x9662('0x4')]('value')?path[_0x9662('0x5')](this[_0x9662('0x4')](_0x9662('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9662('0x7')]},'value':{'type':Sequelize[_0x9662('0x7')],'set':function(_0x457681){var _0x5ec533=_0x457681[_0x9662('0x8')](/\\/g,'/');this['setDataValue'](_0x9662('0x6'),_0x5ec533);}},'rating':{'type':Sequelize[_0x9662('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9662('0x9')],'set':function(_0x11ae91){this[_0x9662('0xa')](_0x9662('0xb'),moment()[_0x9662('0xc')](_0x11ae91,'ms'));this[_0x9662('0xa')](_0x9662('0xd'),moment());this[_0x9662('0xa')](_0x9662('0xe'),_0x11ae91);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9662('0x4')]('startedAt'))[_0x9662('0xf')](_0x9662('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x9662('0x11')],'get':function(){return moment(this[_0x9662('0x4')](_0x9662('0xd')))['format']('MM-DD-YYYY\x20HH:mm')[_0x9662('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9662('0x4')](_0x9662('0x13')))[_0x9662('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9662('0x4')](_0x9662('0x14')))['format'](_0x9662('0x10'))[_0x9662('0x12')]();}}}; \ No newline at end of file +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(_0x5b45da,_0x52bb87){var _0x2327f7=function(_0x35c430){while(--_0x35c430){_0x5b45da['push'](_0x5b45da['shift']());}};_0x2327f7(++_0x52bb87);}(_0xf8f2,0xc2));var _0x2f8f=function(_0xee3505,_0x2379c0){_0xee3505=_0xee3505-0x0;var _0x370ade=_0xf8f2[_0xee3505];return _0x370ade;};'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 diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f245f5e..69f49ec 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 _0xed1f=['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/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x2345b1,_0x2a350a){var _0x450145=function(_0x53569e){while(--_0x53569e){_0x2345b1['push'](_0x2345b1['shift']());}};_0x450145(++_0x2a350a);}(_0xed1f,0x6a));var _0xfed1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xed1f[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file +var _0x5075=['send','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','end','error','name','index','map','ScreenRecording','rawAttributes','fieldName','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message'];(function(_0x421a58,_0x118878){var _0x3793a8=function(_0x11a907){while(--_0x11a907){_0x421a58['push'](_0x421a58['shift']());}};_0x3793a8(++_0x118878);}(_0x5075,0x73));var _0x5507=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x5075[_0x414f67];return _0x338537;};'use strict';var emlformat=require(_0x5507('0x0'));var rimraf=require(_0x5507('0x1'));var zipdir=require(_0x5507('0x2'));var jsonpatch=require(_0x5507('0x3'));var rp=require(_0x5507('0x4'));var moment=require(_0x5507('0x5'));var BPromise=require(_0x5507('0x6'));var Mustache=require('mustache');var util=require(_0x5507('0x7'));var path=require(_0x5507('0x8'));var sox=require(_0x5507('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5507('0xa'));var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5507('0x17'))['db'];function respondWithStatusCode(_0x2a2ea0,_0x32c872){_0x32c872=_0x32c872||0xcc;return function(_0x267f27){if(_0x267f27){return _0x2a2ea0[_0x5507('0x18')](_0x32c872);}return _0x2a2ea0[_0x5507('0x19')](_0x32c872)['end']();};}function respondWithResult(_0x9cc3f9,_0x2b7c43){_0x2b7c43=_0x2b7c43||0xc8;return function(_0xc828e5){if(_0xc828e5){return _0x9cc3f9[_0x5507('0x19')](_0x2b7c43)['json'](_0xc828e5);}};}function respondWithFilteredResult(_0x49e400,_0x10d7b9){return function(_0x2dfd06){if(_0x2dfd06){var _0x1ab167=typeof _0x10d7b9[_0x5507('0x1a')]===_0x5507('0x1b')&&typeof _0x10d7b9[_0x5507('0x1c')]===_0x5507('0x1b');var _0x3d1619=_0x2dfd06[_0x5507('0x1d')];var _0x233b6a=_0x1ab167?0x0:_0x10d7b9[_0x5507('0x1a')];var _0x3822dd=_0x1ab167?_0x2dfd06['count']:_0x10d7b9[_0x5507('0x1a')]+_0x10d7b9[_0x5507('0x1c')];var _0x4054c6;if(_0x3822dd>=_0x3d1619){_0x3822dd=_0x3d1619;_0x4054c6=0xc8;}else{_0x4054c6=0xce;}_0x49e400[_0x5507('0x19')](_0x4054c6);return _0x49e400['set'](_0x5507('0x1e'),_0x233b6a+'-'+_0x3822dd+'/'+_0x3d1619)[_0x5507('0x1f')](_0x2dfd06);}return null;};}function patchUpdates(_0x1a54b0){return function(_0x3ca1f7){try{jsonpatch[_0x5507('0x20')](_0x3ca1f7,_0x1a54b0,!![]);}catch(_0x1be8b1){return BPromise['reject'](_0x1be8b1);}return _0x3ca1f7[_0x5507('0x21')]();};}function saveUpdates(_0x105535,_0x1f6325){return function(_0xa3e2cf){if(_0xa3e2cf){return _0xa3e2cf[_0x5507('0x22')](_0x105535)[_0x5507('0x23')](function(_0x1fcc8d){return _0x1fcc8d;});}return null;};}function removeEntity(_0x10f149,_0x398911){return function(_0xa47641){if(_0xa47641){return _0xa47641[_0x5507('0x24')]()[_0x5507('0x23')](function(){_0x10f149[_0x5507('0x19')](0xcc)[_0x5507('0x25')]();});}};}function handleEntityNotFound(_0x1a2203,_0x4915ed){return function(_0x4e8906){if(!_0x4e8906){_0x1a2203['sendStatus'](0x194);}return _0x4e8906;};}function handleError(_0x26335e,_0x4ea271){_0x4ea271=_0x4ea271||0x1f4;return function(_0xa66a01){logger[_0x5507('0x26')](_0xa66a01['stack']);if(_0xa66a01['name']){delete _0xa66a01[_0x5507('0x27')];}_0x26335e[_0x5507('0x19')](_0x4ea271)['send'](_0xa66a01);};}exports[_0x5507('0x28')]=function(_0x24574b,_0x85d383){var _0x38f4d9={},_0x1e5ce6={},_0x14fdea={'count':0x0,'rows':[]};var _0x55e889=_[_0x5507('0x29')](db[_0x5507('0x2a')][_0x5507('0x2b')],function(_0x38f0f5){return{'name':_0x38f0f5[_0x5507('0x2c')],'type':_0x38f0f5['type']['key']};});_0x1e5ce6[_0x5507('0x2d')]=_[_0x5507('0x2e')](_[_0x5507('0x29')](_0x55e889,_0x5507('0x27')),['format']);_0x1e5ce6[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x24574b[_0x5507('0x2f')]);_0x1e5ce6[_0x5507('0x31')]=_[_0x5507('0x32')](_0x1e5ce6[_0x5507('0x2d')],_0x1e5ce6[_0x5507('0x2f')]);_0x38f4d9[_0x5507('0x33')]=_['intersection'](_0x1e5ce6[_0x5507('0x2d')],qs[_0x5507('0x34')](_0x24574b[_0x5507('0x2f')]['fields']));_0x38f4d9['attributes']=_0x38f4d9[_0x5507('0x33')][_0x5507('0x35')]?_0x38f4d9[_0x5507('0x33')]:_0x1e5ce6[_0x5507('0x2d')];if(!_0x24574b[_0x5507('0x2f')]['hasOwnProperty']('nolimit')){_0x38f4d9[_0x5507('0x1c')]=qs[_0x5507('0x1c')](_0x24574b[_0x5507('0x2f')][_0x5507('0x1c')]);_0x38f4d9['offset']=qs['offset'](_0x24574b[_0x5507('0x2f')]['offset']);}_0x38f4d9[_0x5507('0x36')]=qs[_0x5507('0x37')](_0x24574b[_0x5507('0x2f')][_0x5507('0x37')]);_0x38f4d9[_0x5507('0x38')]=qs[_0x5507('0x31')](_[_0x5507('0x39')](_0x24574b[_0x5507('0x2f')],_0x1e5ce6[_0x5507('0x31')]),_0x55e889);if(_0x24574b[_0x5507('0x2f')]['filter']){_0x38f4d9['where']=_['merge'](_0x38f4d9['where'],{'$or':_[_0x5507('0x29')](_0x55e889,function(_0x2cf512){if(_0x2cf512[_0x5507('0x3a')]!==_0x5507('0x3b')){var _0x2b32a5={};_0x2b32a5[_0x2cf512[_0x5507('0x27')]]={'$like':'%'+_0x24574b[_0x5507('0x2f')][_0x5507('0x3c')]+'%'};return _0x2b32a5;}})});}_0x38f4d9=_[_0x5507('0x3d')]({},_0x38f4d9,_0x24574b[_0x5507('0x3e')]);var _0x3ec0ed={'where':_0x38f4d9[_0x5507('0x38')]};return db[_0x5507('0x2a')][_0x5507('0x1d')](_0x3ec0ed)['then'](function(_0x53b3f3){_0x14fdea['count']=_0x53b3f3;if(_0x24574b[_0x5507('0x2f')][_0x5507('0x3f')]){_0x38f4d9[_0x5507('0x40')]=[{'all':!![]}];}return db[_0x5507('0x2a')][_0x5507('0x41')](_0x38f4d9);})[_0x5507('0x23')](function(_0x340c4c){_0x14fdea[_0x5507('0x42')]=_0x340c4c;return _0x14fdea;})[_0x5507('0x23')](respondWithFilteredResult(_0x85d383,_0x38f4d9))[_0x5507('0x43')](handleError(_0x85d383,null));};exports[_0x5507('0x44')]=function(_0x192a00,_0x24d7b5){var _0x25496b={'raw':![],'where':{'id':_0x192a00[_0x5507('0x45')]['id']}},_0x1b3006={};_0x1b3006[_0x5507('0x2d')]=_[_0x5507('0x30')](db[_0x5507('0x2a')]['rawAttributes']);_0x1b3006[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x192a00['query']);_0x1b3006['filters']=_[_0x5507('0x32')](_0x1b3006[_0x5507('0x2d')],_0x1b3006[_0x5507('0x2f')]);_0x25496b[_0x5507('0x33')]=_[_0x5507('0x32')](_0x1b3006['model'],qs[_0x5507('0x34')](_0x192a00[_0x5507('0x2f')][_0x5507('0x34')]));_0x25496b['attributes']=_0x25496b[_0x5507('0x33')][_0x5507('0x35')]?_0x25496b[_0x5507('0x33')]:_0x1b3006[_0x5507('0x2d')];if(_0x192a00[_0x5507('0x2f')]['includeAll']){_0x25496b[_0x5507('0x40')]=[{'all':!![]}];}_0x25496b=_['merge']({},_0x25496b,_0x192a00[_0x5507('0x3e')]);return db[_0x5507('0x2a')][_0x5507('0x46')](_0x25496b)[_0x5507('0x23')](handleEntityNotFound(_0x24d7b5,null))[_0x5507('0x23')](respondWithResult(_0x24d7b5,null))[_0x5507('0x43')](handleError(_0x24d7b5,null));};exports[_0x5507('0x47')]=function(_0x3452e4,_0x549cf0){return db[_0x5507('0x2a')][_0x5507('0x47')](_0x3452e4['body'],{})['then'](respondWithResult(_0x549cf0,0xc9))['catch'](handleError(_0x549cf0,null));};exports[_0x5507('0x22')]=function(_0x5961fd,_0x403d03){if(_0x5961fd['body']['id']){delete _0x5961fd[_0x5507('0x48')]['id'];}delete _0x5961fd['body']['duration'];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x49')];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x4a')];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x4b')];return db['ScreenRecording'][_0x5507('0x46')]({'where':{'id':_0x5961fd[_0x5507('0x45')]['id']}})[_0x5507('0x23')](handleEntityNotFound(_0x403d03,null))['then'](saveUpdates(_0x5961fd[_0x5507('0x48')],null))[_0x5507('0x23')](respondWithResult(_0x403d03,null))[_0x5507('0x43')](handleError(_0x403d03,null));};exports[_0x5507('0x4c')]=function(_0x300c9f,_0x3af70f){return db[_0x5507('0x2a')][_0x5507('0x4c')]()[_0x5507('0x23')](respondWithResult(_0x3af70f,null))[_0x5507('0x43')](handleError(_0x3af70f,null));};exports[_0x5507('0x4d')]=function(_0x49a2f8,_0x570928,_0x1992fa){var _0x5d7753=require(_0x5507('0x4e'));var _0x1b34c8=![];var _0xce851d={};if(_0x49a2f8[_0x5507('0x2f')][_0x5507('0x3a')]&&_0x49a2f8[_0x5507('0x2f')][_0x5507('0x3a')]===_0x5507('0x4f')){_0xce851d[_0x5507('0x4f')]=_0x49a2f8[_0x5507('0x45')]['id'];}else{_0xce851d['id']=_0x49a2f8[_0x5507('0x45')]['id'];}return db[_0x5507('0x2a')][_0x5507('0x46')]({'where':_0xce851d,'attributes':['id',_0x5507('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x570928,null))[_0x5507('0x23')](function(_0x56e0cd){if(_0x56e0cd){var _0x5af5f5=path[_0x5507('0x50')](config[_0x5507('0x51')],_0x5507('0x52'),_0x56e0cd[_0x5507('0x4b')]);var _0x52b9f2=util[_0x5507('0x53')](_0x5507('0x54'),_0x5af5f5);if(fs[_0x5507('0x55')](_0x52b9f2)){_0x1b34c8=!![];return _0x5d7753[_0x5507('0x56')](_0x52b9f2,_0x5af5f5,config[_0x5507('0x57')][_0x5507('0x58')])['then'](function(){return _0x56e0cd;});}return _0x56e0cd;}})[_0x5507('0x23')](function(_0x46e589){if(_0x46e589){var _0x3a2f9f=path['join'](config['root'],_0x5507('0x52'),_0x46e589['value']);if(!fs[_0x5507('0x55')](_0x3a2f9f)){throw new db[(_0x5507('0x59'))]['ValidationError'](_0x5507('0x5a'));}if(_0x46e589[_0x5507('0x5b')]){return _0x570928[_0x5507('0x4d')](_0x3a2f9f,_0x46e589[_0x5507('0x5b')]+path[_0x5507('0x5c')](_0x3a2f9f),function(){if(_0x1b34c8){fs[_0x5507('0x5d')](_0x3a2f9f);}});}else{return _0x570928[_0x5507('0x4d')](_0x3a2f9f,function(_0x2928f2){if(_0x1b34c8){fs[_0x5507('0x5d')](_0x3a2f9f);}});}}})[_0x5507('0x43')](function(_0x1453f1){if(_0x1453f1[_0x5507('0x5e')]==='ScreenRecording\x20not\x20found'){_0x570928[_0x5507('0x19')](0x194)[_0x5507('0x5f')](_0x5507('0x60'));}else{return handleError(_0x570928,null);}});};exports[_0x5507('0x24')]=function(_0x3c4422,_0x5183ae){return db[_0x5507('0x2a')]['find']({'where':{'id':_0x3c4422[_0x5507('0x45')]['id']}})[_0x5507('0x23')](function(_0x241733){if(_['isNil'](_0x241733)){throw new ReferenceError(_0x5507('0x61'));}return _0x241733;})[_0x5507('0x23')](function(_0x2a9672){var _0x56632b=path[_0x5507('0x50')](config['root'],_0x5507('0x52'),_0x2a9672['value']);logger['info'](_0x5507('0x62'),_0x56632b);if(!_[_0x5507('0x63')](_0x2a9672[_0x5507('0x4b')])&&fs[_0x5507('0x55')](_0x56632b)){logger[_0x5507('0x64')](_0x5507('0x65')+_0x56632b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x56632b);}_0x56632b=_0x56632b+_0x5507('0x66');if(!_[_0x5507('0x63')](_0x2a9672[_0x5507('0x4b')])&&fs[_0x5507('0x55')](_0x56632b)){logger['info'](_0x5507('0x65')+_0x56632b+_0x5507('0x67'));fs[_0x5507('0x68')](_0x56632b);}return _0x2a9672;})[_0x5507('0x23')](function(_0x296cf5){if(!_0x296cf5)throw new InternalError();return _0x296cf5[_0x5507('0x24')]();})[_0x5507('0x23')](function(){_0x5183ae['status'](0xcc)[_0x5507('0x25')]();})[_0x5507('0x43')](handleError(_0x5183ae,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 15c58f7..21360ed 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 _0x4c91=['./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x43bc6b,_0x2b577c){var _0x114255=function(_0x2310e2){while(--_0x2310e2){_0x43bc6b['push'](_0x43bc6b['shift']());}};_0x114255(++_0x2b577c);}(_0x4c91,0xb9));var _0x14c9=function(_0x3ca7f2,_0x4acd63){_0x3ca7f2=_0x3ca7f2-0x0;var _0x260451=_0x4c91[_0x3ca7f2];return _0x260451;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14c9('0x0'))(_0x14c9('0x1'));var moment=require(_0x14c9('0x2'));var BPromise=require(_0x14c9('0x3'));var rp=require(_0x14c9('0x4'));var fs=require('fs');var path=require(_0x14c9('0x5'));var rimraf=require('rimraf');var config=require(_0x14c9('0x6'));var attributes=require(_0x14c9('0x7'));module[_0x14c9('0x8')]=function(_0x55946a,_0x374f05){return _0x55946a['define'](_0x14c9('0x9'),attributes,{'tableName':_0x14c9('0xa'),'paranoid':![],'indexes':[{'name':_0x14c9('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7687=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x179d21,_0x365700){var _0x5e352a=function(_0xeb664e){while(--_0xeb664e){_0x179d21['push'](_0x179d21['shift']());}};_0x5e352a(++_0x365700);}(_0x7687,0x1e8));var _0x7768=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7687[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x7768('0x0'));var util=require(_0x7768('0x1'));var logger=require(_0x7768('0x2'))(_0x7768('0x3'));var moment=require(_0x7768('0x4'));var BPromise=require(_0x7768('0x5'));var rp=require(_0x7768('0x6'));var fs=require('fs');var path=require(_0x7768('0x7'));var rimraf=require(_0x7768('0x8'));var config=require(_0x7768('0x9'));var attributes=require(_0x7768('0xa'));module[_0x7768('0xb')]=function(_0x1698e5,_0x490d52){return _0x1698e5[_0x7768('0xc')](_0x7768('0xd'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x7768('0xe'),'fields':[_0x7768('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 0f03d79..864fa24 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 _0xf3d3=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','info','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','util'];(function(_0xcdf6cd,_0x419419){var _0x58baa8=function(_0x1000f2){while(--_0x1000f2){_0xcdf6cd['push'](_0xcdf6cd['shift']());}};_0x58baa8(++_0x419419);}(_0xf3d3,0x18e));var _0x3f3d=function(_0x25b300,_0x5ea2bb){_0x25b300=_0x25b300-0x0;var _0x3c4e8a=_0xf3d3[_0x25b300];return _0x3c4e8a;};'use strict';var _=require('lodash');var util=require(_0x3f3d('0x0'));var moment=require(_0x3f3d('0x1'));var BPromise=require(_0x3f3d('0x2'));var rs=require(_0x3f3d('0x3'));var fs=require('fs');var Redis=require(_0x3f3d('0x4'));var db=require(_0x3f3d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f3d('0x6'));var config=require(_0x3f3d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f3d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3646d6,_0x187be6,_0xcf9e4){return new BPromise(function(_0xfca1e5,_0x417631){return client['request'](_0x3646d6,_0xcf9e4)[_0x3f3d('0x9')](function(_0x507cc6){logger[_0x3f3d('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x187be6,'request\x20sent');logger[_0x3f3d('0xb')](_0x3f3d('0xc'),_0x187be6,_0x3f3d('0xd'),JSON[_0x3f3d('0xe')](_0x507cc6));if(_0x507cc6[_0x3f3d('0xf')]){if(_0x507cc6['error'][_0x3f3d('0x10')]===0x1f4){logger[_0x3f3d('0xf')](_0x3f3d('0x11'),_0x187be6,_0x507cc6['error']['message']);return _0x417631(_0x507cc6[_0x3f3d('0xf')][_0x3f3d('0x12')]);}logger[_0x3f3d('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x187be6,_0x507cc6[_0x3f3d('0xf')]['message']);return _0xfca1e5(_0x507cc6['error'][_0x3f3d('0x12')]);}else{logger[_0x3f3d('0xa')](_0x3f3d('0x11'),_0x187be6,'request\x20sent');_0xfca1e5(_0x507cc6[_0x3f3d('0x13')][_0x3f3d('0x12')]);}})[_0x3f3d('0x14')](function(_0x1359f1){logger[_0x3f3d('0xf')](_0x3f3d('0x11'),_0x187be6,_0x1359f1);_0x417631(_0x1359f1);});});} \ No newline at end of file +var _0xe198=['request\x20sent','debug','stringify','error','code','message','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s'];(function(_0x4c39f5,_0x109684){var _0x1db24f=function(_0x44879b){while(--_0x44879b){_0x4c39f5['push'](_0x4c39f5['shift']());}};_0x1db24f(++_0x109684);}(_0xe198,0x11e));var _0x8e19=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe198[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8e19('0x0'));var BPromise=require('bluebird');var rs=require(_0x8e19('0x1'));var fs=require('fs');var Redis=require(_0x8e19('0x2'));var db=require(_0x8e19('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e19('0x4'))(_0x8e19('0x5'));var config=require(_0x8e19('0x6'));var jayson=require(_0x8e19('0x7'));var client=jayson[_0x8e19('0x8')][_0x8e19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x975ab1,_0x74d364,_0x13bb51){return new BPromise(function(_0x162b5e,_0x291805){return client[_0x8e19('0xa')](_0x975ab1,_0x13bb51)[_0x8e19('0xb')](function(_0x39c6a5){logger[_0x8e19('0xc')](_0x8e19('0xd'),_0x74d364,_0x8e19('0xe'));logger[_0x8e19('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x74d364,_0x8e19('0xe'),JSON[_0x8e19('0x10')](_0x39c6a5));if(_0x39c6a5[_0x8e19('0x11')]){if(_0x39c6a5[_0x8e19('0x11')][_0x8e19('0x12')]===0x1f4){logger[_0x8e19('0x11')](_0x8e19('0xd'),_0x74d364,_0x39c6a5[_0x8e19('0x11')][_0x8e19('0x13')]);return _0x291805(_0x39c6a5[_0x8e19('0x11')][_0x8e19('0x13')]);}logger[_0x8e19('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x74d364,_0x39c6a5['error'][_0x8e19('0x13')]);return _0x162b5e(_0x39c6a5[_0x8e19('0x11')][_0x8e19('0x13')]);}else{logger[_0x8e19('0xc')](_0x8e19('0xd'),_0x74d364,_0x8e19('0xe'));_0x162b5e(_0x39c6a5['result'][_0x8e19('0x13')]);}})['catch'](function(_0x333239){logger['error'](_0x8e19('0xd'),_0x74d364,_0x333239);_0x291805(_0x333239);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4418758..12cd5f8 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 _0x8d85=['get','/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','join','server/files/images/logos/','logo','post','single','file','addLogo','diskStorage','logologin','extname','root','format','%s%s','preferred','/:id/favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller'];(function(_0x262cef,_0x4fdc28){var _0x1ad394=function(_0x3f8a2a){while(--_0x3f8a2a){_0x262cef['push'](_0x262cef['shift']());}};_0x1ad394(++_0x4fdc28);}(_0x8d85,0x17c));var _0x58d8=function(_0x5aa83f,_0xfc2bb){_0x5aa83f=_0x5aa83f-0x0;var _0x356e9e=_0x8d85[_0x5aa83f];return _0x356e9e;};'use strict';var multer=require(_0x58d8('0x0'));var util=require(_0x58d8('0x1'));var path=require(_0x58d8('0x2'));var timeout=require(_0x58d8('0x3'));var express=require(_0x58d8('0x4'));var router=express[_0x58d8('0x5')]();var fs_extra=require(_0x58d8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x58d8('0x7'));var config=require(_0x58d8('0x8'));var controller=require(_0x58d8('0x9'));router[_0x58d8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x58d8('0xa')](_0x58d8('0xb'),controller['getDate']);router[_0x58d8('0xa')](_0x58d8('0xc'),controller[_0x58d8('0xd')]);router[_0x58d8('0xa')](_0x58d8('0xe'),controller['getLogo']);router[_0x58d8('0xa')](_0x58d8('0xf'),controller[_0x58d8('0x10')]);router[_0x58d8('0xa')](_0x58d8('0x11'),controller[_0x58d8('0x12')]);router[_0x58d8('0xa')](_0x58d8('0x13'),controller[_0x58d8('0x14')]);router[_0x58d8('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5568f6,_0x546010,_0x5654af){_0x5654af(null,path[_0x58d8('0x15')](config['root'],_0x58d8('0x16')));},'filename':function(_0x4c9056,_0x532d9e,_0x4d428d){_0x4d428d(null,util['format']('%s%s',_0x58d8('0x17'),path['extname'](_0x532d9e['originalname'])));}})});router[_0x58d8('0x18')]('/:id/logo',upload[_0x58d8('0x19')](_0x58d8('0x1a')),controller[_0x58d8('0x1b')]);var upload=multer({'storage':multer[_0x58d8('0x1c')]({'destination':function(_0x474725,_0x349d52,_0x5d122a){_0x5d122a(null,path[_0x58d8('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0x218671,_0x226c65,_0x340225){_0x340225(null,util['format']('%s%s',_0x58d8('0x1d'),path[_0x58d8('0x1e')](_0x226c65['originalname'])));}})});router[_0x58d8('0x18')](_0x58d8('0xf'),upload[_0x58d8('0x19')](_0x58d8('0x1a')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x58d8('0x1c')]({'destination':function(_0x1af0d3,_0x251f26,_0x4fa182){_0x4fa182(null,path[_0x58d8('0x15')](config[_0x58d8('0x1f')],_0x58d8('0x16')));},'filename':function(_0xbf0b3,_0x1c972e,_0x35e3ff){_0x35e3ff(null,util[_0x58d8('0x20')](_0x58d8('0x21'),_0x58d8('0x22'),path['extname'](_0x1c972e['originalname'])));}})});router['post']('/:id/preferred',upload[_0x58d8('0x19')](_0x58d8('0x1a')),controller['addPreferred']);var upload=multer({'storage':multer[_0x58d8('0x1c')]({'destination':function(_0x52c4e2,_0x2c8e85,_0x5243ec){_0x5243ec(null,path[_0x58d8('0x15')](config[_0x58d8('0x1f')],'server/files/images/logos/'));},'filename':function(_0xc3a99e,_0x595993,_0x265231){_0x265231(null,util[_0x58d8('0x20')](_0x58d8('0x21'),'favicon',path[_0x58d8('0x1e')](_0x595993['originalname'])));}})});router[_0x58d8('0x18')](_0x58d8('0x23'),upload['single'](_0x58d8('0x1a')),controller['addFavicon']);router[_0x58d8('0x24')](_0x58d8('0xc'),auth['isAuthenticated'](),controller[_0x58d8('0x25')]);module[_0x58d8('0x26')]=router; \ No newline at end of file +var _0x5b38=['server/files/images/logos/','format','%s%s','extname','originalname','single','file','logologin','preferred','post','addPreferred','put','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','diskStorage','join','root'];(function(_0x23f43c,_0x4606b6){var _0x4bc94e=function(_0x4c1bba){while(--_0x4c1bba){_0x23f43c['push'](_0x23f43c['shift']());}};_0x4bc94e(++_0x4606b6);}(_0x5b38,0x1c6));var _0x85b3=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5b38[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x85b3('0x0'));var util=require(_0x85b3('0x1'));var path=require(_0x85b3('0x2'));var timeout=require(_0x85b3('0x3'));var express=require(_0x85b3('0x4'));var router=express[_0x85b3('0x5')]();var fs_extra=require(_0x85b3('0x6'));var auth=require(_0x85b3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x85b3('0x8'));var controller=require(_0x85b3('0x9'));router[_0x85b3('0xa')]('/',auth['isAuthenticated'](),controller[_0x85b3('0xb')]);router[_0x85b3('0xa')](_0x85b3('0xc'),controller[_0x85b3('0xd')]);router[_0x85b3('0xa')](_0x85b3('0xe'),controller[_0x85b3('0xf')]);router[_0x85b3('0xa')](_0x85b3('0x10'),controller['getLogo']);router['get'](_0x85b3('0x11'),controller[_0x85b3('0x12')]);router[_0x85b3('0xa')](_0x85b3('0x13'),controller[_0x85b3('0x14')]);router[_0x85b3('0xa')](_0x85b3('0x15'),controller['getPreferred']);router[_0x85b3('0xa')](_0x85b3('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0x85b3('0x17')]({'destination':function(_0x1a3ab9,_0x44c4c6,_0x11da11){_0x11da11(null,path[_0x85b3('0x18')](config[_0x85b3('0x19')],_0x85b3('0x1a')));},'filename':function(_0x2233b5,_0x18c11e,_0x3ece1b){_0x3ece1b(null,util[_0x85b3('0x1b')](_0x85b3('0x1c'),'logo',path[_0x85b3('0x1d')](_0x18c11e[_0x85b3('0x1e')])));}})});router['post'](_0x85b3('0x10'),upload[_0x85b3('0x1f')](_0x85b3('0x20')),controller['addLogo']);var upload=multer({'storage':multer[_0x85b3('0x17')]({'destination':function(_0x169aa8,_0x11ce07,_0x54561d){_0x54561d(null,path[_0x85b3('0x18')](config['root'],_0x85b3('0x1a')));},'filename':function(_0xa6a778,_0x4ce172,_0x1de852){_0x1de852(null,util[_0x85b3('0x1b')](_0x85b3('0x1c'),_0x85b3('0x21'),path['extname'](_0x4ce172['originalname'])));}})});router['post'](_0x85b3('0x11'),upload[_0x85b3('0x1f')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x85b3('0x17')]({'destination':function(_0xb18155,_0x2cf154,_0x1f63c1){_0x1f63c1(null,path[_0x85b3('0x18')](config[_0x85b3('0x19')],'server/files/images/logos/'));},'filename':function(_0x466902,_0x19dacc,_0x5e308a){_0x5e308a(null,util[_0x85b3('0x1b')](_0x85b3('0x1c'),_0x85b3('0x22'),path[_0x85b3('0x1d')](_0x19dacc[_0x85b3('0x1e')])));}})});router[_0x85b3('0x23')]('/:id/preferred',upload[_0x85b3('0x1f')](_0x85b3('0x20')),controller[_0x85b3('0x24')]);var upload=multer({'storage':multer[_0x85b3('0x17')]({'destination':function(_0x206333,_0x3560ce,_0x211152){_0x211152(null,path['join'](config[_0x85b3('0x19')],_0x85b3('0x1a')));},'filename':function(_0x69c936,_0x59b57d,_0x51b023){_0x51b023(null,util[_0x85b3('0x1b')](_0x85b3('0x1c'),'favicon',path[_0x85b3('0x1d')](_0x59b57d['originalname'])));}})});router[_0x85b3('0x23')](_0x85b3('0x16'),upload['single']('file'),controller['addFavicon']);router[_0x85b3('0x25')]('/:id',auth[_0x85b3('0x26')](),controller[_0x85b3('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c992b0b..43fcd8f 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 _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xadb5,0xad));var _0x5adb=function(_0x28acab,_0x42ea5e){_0x28acab=_0x28acab-0x0;var _0x4cbc58=_0xadb5[_0x28acab];return _0x4cbc58;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'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 19cc10a..768cc1f 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 _0xcef4=['addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Setting','includeAll','findAll','rows','show','include','find','body','params','filename','addLogoLogin','file','loginLogo','getLogo','server/files/images/logos','logo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','default_loginLogo.svg','custom','gdpr','securePassword'];(function(_0x3dde86,_0x2ecfc4){var _0x672191=function(_0x227d29){while(--_0x227d29){_0x3dde86['push'](_0x3dde86['shift']());}};_0x672191(++_0x2ecfc4);}(_0xcef4,0x1e9));var _0x4cef=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xcef4[_0x4cc492];return _0x1f36b9;};'use strict';var emlformat=require(_0x4cef('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4cef('0x1'));var BPromise=require(_0x4cef('0x2'));var Mustache=require(_0x4cef('0x3'));var util=require(_0x4cef('0x4'));var path=require(_0x4cef('0x5'));var sox=require(_0x4cef('0x6'));var csv=require(_0x4cef('0x7'));var ejs=require(_0x4cef('0x8'));var fs=require('fs');var fs_extra=require(_0x4cef('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4cef('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4cef('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4cef('0xc'));var authService=require(_0x4cef('0xd'));var qs=require(_0x4cef('0xe'));var as=require(_0x4cef('0xf'));var hardwareService=require(_0x4cef('0x10'));var logger=require(_0x4cef('0x11'))(_0x4cef('0x12'));var utils=require(_0x4cef('0x13'));var config=require(_0x4cef('0x14'));var licenseUtil=require(_0x4cef('0x15'));var db=require(_0x4cef('0x16'))['db'];var jayson=require(_0x4cef('0x17'));var client=jayson['client'][_0x4cef('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x43f6ad,_0x29a46c,_0x5a890e,_0xef597f){return new BPromise(function(_0x2585d9,_0x1f6493){var _0x5ddfc6=_0xef597f||client;return _0x5ddfc6['request'](_0x43f6ad,_0x5a890e)[_0x4cef('0x19')](function(_0x169964){logger['info'](_0x4cef('0x1a'),_0x29a46c,_0x4cef('0x1b'));logger[_0x4cef('0x1c')](_0x4cef('0x1d'),_0x29a46c,_0x4cef('0x1b'),JSON[_0x4cef('0x1e')](_0x169964));if(_0x169964[_0x4cef('0x1f')]){if(_0x169964[_0x4cef('0x1f')]['code']===0x1f4){logger[_0x4cef('0x1f')]('Setting,\x20%s,\x20%s',_0x29a46c,_0x169964[_0x4cef('0x1f')]['message']);return _0x1f6493(_0x169964[_0x4cef('0x1f')]['message']);}logger[_0x4cef('0x1f')]('Setting,\x20%s,\x20%s',_0x29a46c,_0x169964[_0x4cef('0x1f')][_0x4cef('0x20')]);return _0x2585d9(_0x169964['error'][_0x4cef('0x20')]);}else{logger[_0x4cef('0x21')](_0x4cef('0x1a'),_0x29a46c,_0x4cef('0x1b'));_0x2585d9(_0x169964[_0x4cef('0x22')][_0x4cef('0x20')]);}})[_0x4cef('0x23')](function(_0x464030){logger['error'](_0x4cef('0x1a'),_0x29a46c,_0x464030);_0x1f6493(_0x464030);});});}function respondWithStatusCode(_0x29d751,_0x11a380){_0x11a380=_0x11a380||0xcc;return function(_0x39c27b){if(_0x39c27b){return _0x29d751[_0x4cef('0x24')](_0x11a380);}return _0x29d751[_0x4cef('0x25')](_0x11a380)[_0x4cef('0x26')]();};}function respondWithResult(_0x2eafbc,_0x224b17){_0x224b17=_0x224b17||0xc8;return function(_0x394c3f){if(_0x394c3f){return _0x2eafbc[_0x4cef('0x25')](_0x224b17)['json'](_0x394c3f);}};}function respondWithFilteredResult(_0x34c744,_0x56ae8f){return function(_0x1b6252){if(_0x1b6252){var _0x252b8c=typeof _0x56ae8f[_0x4cef('0x27')]===_0x4cef('0x28')&&typeof _0x56ae8f[_0x4cef('0x29')]===_0x4cef('0x28');var _0x3d5763=_0x1b6252[_0x4cef('0x2a')];var _0x53e41d=_0x252b8c?0x0:_0x56ae8f[_0x4cef('0x27')];var _0x2936ae=_0x252b8c?_0x1b6252[_0x4cef('0x2a')]:_0x56ae8f[_0x4cef('0x27')]+_0x56ae8f[_0x4cef('0x29')];var _0x32f7f0;if(_0x2936ae>=_0x3d5763){_0x2936ae=_0x3d5763;_0x32f7f0=0xc8;}else{_0x32f7f0=0xce;}_0x34c744['status'](_0x32f7f0);return _0x34c744[_0x4cef('0x2b')](_0x4cef('0x2c'),_0x53e41d+'-'+_0x2936ae+'/'+_0x3d5763)[_0x4cef('0x2d')](_0x1b6252);}return null;};}function patchUpdates(_0x35744a){return function(_0x44a9d3){try{jsonpatch['apply'](_0x44a9d3,_0x35744a,!![]);}catch(_0x537fd6){return BPromise[_0x4cef('0x2e')](_0x537fd6);}return _0x44a9d3[_0x4cef('0x2f')]();};}function saveUpdates(_0x28598c,_0x28a9ba){return function(_0x3e6386){if(_0x3e6386){return _0x3e6386[_0x4cef('0x30')](_0x28598c)['then'](function(_0xa52b12){return _0xa52b12;});}return null;};}function removeEntity(_0x6f110,_0x48bd6b){return function(_0x447f35){if(_0x447f35){return _0x447f35['destroy']()['then'](function(){_0x6f110[_0x4cef('0x25')](0xcc)[_0x4cef('0x26')]();});}};}function handleEntityNotFound(_0x2c4555,_0x31e354){return function(_0x46f97f){if(!_0x46f97f){_0x2c4555[_0x4cef('0x24')](0x194);}return _0x46f97f;};}function handleError(_0x58f90e,_0x32f044){_0x32f044=_0x32f044||0x1f4;return function(_0x6bd509){logger[_0x4cef('0x1f')](_0x6bd509['stack']);if(_0x6bd509[_0x4cef('0x31')]){delete _0x6bd509['name'];}_0x58f90e[_0x4cef('0x25')](_0x32f044)[_0x4cef('0x32')](_0x6bd509);};}exports[_0x4cef('0x33')]=function(_0x97d968,_0x1c7751){var _0x38872c={},_0x15ffa2={},_0x5238d9={'count':0x0,'rows':[]};var _0x13133e=_[_0x4cef('0x34')](db['Setting'][_0x4cef('0x35')],function(_0x14ff4c){return{'name':_0x14ff4c['fieldName'],'type':_0x14ff4c[_0x4cef('0x36')][_0x4cef('0x37')]};});_0x15ffa2['model']=_[_0x4cef('0x34')](_0x13133e,'name');_0x15ffa2[_0x4cef('0x38')]=_[_0x4cef('0x39')](_0x97d968[_0x4cef('0x38')]);_0x15ffa2[_0x4cef('0x3a')]=_[_0x4cef('0x3b')](_0x15ffa2[_0x4cef('0x3c')],_0x15ffa2[_0x4cef('0x38')]);_0x38872c[_0x4cef('0x3d')]=_[_0x4cef('0x3b')](_0x15ffa2[_0x4cef('0x3c')],qs[_0x4cef('0x3e')](_0x97d968['query']['fields']));_0x38872c[_0x4cef('0x3d')]=_0x38872c[_0x4cef('0x3d')][_0x4cef('0x3f')]?_0x38872c[_0x4cef('0x3d')]:_0x15ffa2[_0x4cef('0x3c')];if(!_0x97d968[_0x4cef('0x38')]['hasOwnProperty'](_0x4cef('0x40'))){_0x38872c[_0x4cef('0x29')]=qs[_0x4cef('0x29')](_0x97d968[_0x4cef('0x38')]['limit']);_0x38872c[_0x4cef('0x27')]=qs['offset'](_0x97d968[_0x4cef('0x38')][_0x4cef('0x27')]);}_0x38872c[_0x4cef('0x41')]=qs[_0x4cef('0x42')](_0x97d968['query'][_0x4cef('0x42')]);_0x38872c[_0x4cef('0x43')]=qs[_0x4cef('0x3a')](_[_0x4cef('0x44')](_0x97d968[_0x4cef('0x38')],_0x15ffa2[_0x4cef('0x3a')]),_0x13133e);if(_0x97d968[_0x4cef('0x38')][_0x4cef('0x45')]){_0x38872c['where']=_['merge'](_0x38872c['where'],{'$or':_[_0x4cef('0x34')](_0x13133e,function(_0x239e7e){if(_0x239e7e[_0x4cef('0x36')]!==_0x4cef('0x46')){var _0x18e2d4={};_0x18e2d4[_0x239e7e[_0x4cef('0x31')]]={'$like':'%'+_0x97d968[_0x4cef('0x38')][_0x4cef('0x45')]+'%'};return _0x18e2d4;}})});}_0x38872c=_[_0x4cef('0x47')]({},_0x38872c,_0x97d968[_0x4cef('0x48')]);var _0x1dfdb6={'where':_0x38872c[_0x4cef('0x43')]};return db[_0x4cef('0x49')][_0x4cef('0x2a')](_0x1dfdb6)['then'](function(_0x241d6e){_0x5238d9[_0x4cef('0x2a')]=_0x241d6e;if(_0x97d968[_0x4cef('0x38')][_0x4cef('0x4a')]){_0x38872c['include']=[{'all':!![]}];}return db[_0x4cef('0x49')][_0x4cef('0x4b')](_0x38872c);})['then'](function(_0x72a7c2){_0x5238d9[_0x4cef('0x4c')]=_0x72a7c2;return _0x5238d9;})[_0x4cef('0x19')](respondWithFilteredResult(_0x1c7751,_0x38872c))[_0x4cef('0x23')](handleError(_0x1c7751,null));};exports[_0x4cef('0x4d')]=function(_0x2c4421,_0x202818){var _0x2be42a={'raw':![],'where':{'id':_0x2c4421['params']['id']}},_0x3eb368={};_0x3eb368['model']=_[_0x4cef('0x39')](db[_0x4cef('0x49')]['rawAttributes']);_0x3eb368[_0x4cef('0x38')]=_[_0x4cef('0x39')](_0x2c4421[_0x4cef('0x38')]);_0x3eb368[_0x4cef('0x3a')]=_[_0x4cef('0x3b')](_0x3eb368[_0x4cef('0x3c')],_0x3eb368['query']);_0x2be42a[_0x4cef('0x3d')]=_['intersection'](_0x3eb368[_0x4cef('0x3c')],qs[_0x4cef('0x3e')](_0x2c4421[_0x4cef('0x38')]['fields']));_0x2be42a[_0x4cef('0x3d')]=_0x2be42a[_0x4cef('0x3d')][_0x4cef('0x3f')]?_0x2be42a[_0x4cef('0x3d')]:_0x3eb368['model'];if(_0x2c4421['query'][_0x4cef('0x4a')]){_0x2be42a[_0x4cef('0x4e')]=[{'all':!![]}];}_0x2be42a=_[_0x4cef('0x47')]({},_0x2be42a,_0x2c4421[_0x4cef('0x48')]);return db[_0x4cef('0x49')][_0x4cef('0x4f')](_0x2be42a)[_0x4cef('0x19')](handleEntityNotFound(_0x202818,null))['then'](respondWithResult(_0x202818,null))['catch'](handleError(_0x202818,null));};exports[_0x4cef('0x30')]=function(_0x148610,_0x207097){if(_0x148610[_0x4cef('0x50')]['id']){delete _0x148610[_0x4cef('0x50')]['id'];}return db[_0x4cef('0x49')][_0x4cef('0x4f')]({'where':{'id':_0x148610[_0x4cef('0x51')]['id']}})['then'](handleEntityNotFound(_0x207097,null))['then'](saveUpdates(_0x148610[_0x4cef('0x50')],null))[_0x4cef('0x19')](respondWithResult(_0x207097,null))[_0x4cef('0x23')](handleError(_0x207097,null));};exports['addLogo']=function(_0x20c6ff,_0x7d41a2,_0x1f358f){if(_0x20c6ff['file']&&_0x20c6ff['file'][_0x4cef('0x52')]){_0x20c6ff[_0x4cef('0x50')]['logo']=_0x20c6ff['file'][_0x4cef('0x52')];}return db[_0x4cef('0x49')][_0x4cef('0x4f')]({'where':{'id':_0x20c6ff[_0x4cef('0x51')]['id']}})[_0x4cef('0x19')](handleEntityNotFound(_0x7d41a2,null))[_0x4cef('0x19')](saveUpdates(_0x20c6ff[_0x4cef('0x50')],null))[_0x4cef('0x19')](respondWithResult(_0x7d41a2,null))['catch'](handleError(_0x7d41a2,null));};exports[_0x4cef('0x53')]=function(_0x3e6eaa,_0xb1f175,_0x3dbe6a){if(_0x3e6eaa[_0x4cef('0x54')]&&_0x3e6eaa[_0x4cef('0x54')][_0x4cef('0x52')]){_0x3e6eaa[_0x4cef('0x50')][_0x4cef('0x55')]=_0x3e6eaa[_0x4cef('0x54')][_0x4cef('0x52')];}return db[_0x4cef('0x49')][_0x4cef('0x4f')]({'where':{'id':_0x3e6eaa['params']['id']}})[_0x4cef('0x19')](handleEntityNotFound(_0xb1f175,null))[_0x4cef('0x19')](saveUpdates(_0x3e6eaa[_0x4cef('0x50')],null))['then'](respondWithResult(_0xb1f175,null))[_0x4cef('0x23')](handleError(_0xb1f175,null));};var utilLicense=require(_0x4cef('0x15'));exports[_0x4cef('0x56')]=function(_0x1bfa3d,_0x33ef57,_0x55fd0f){var _0x44f472=_0x4cef('0x57');var _0x71a70b={'custom':![]};return utilLicense['getLicense']()[_0x4cef('0x19')](function(_0x314171){if(_0x314171){_0x71a70b=_0x314171;}return db['Setting']['find']({'where':{'id':_0x1bfa3d[_0x4cef('0x51')]['id']},'attributes':[_0x4cef('0x58'),_0x4cef('0x55'),'preferred',_0x4cef('0x59'),_0x4cef('0x5a'),_0x4cef('0x5b'),_0x4cef('0x5c'),_0x4cef('0x5d')],'raw':!![]});})[_0x4cef('0x19')](handleEntityNotFound(_0x33ef57,null))[_0x4cef('0x19')](function(_0x305442){if(_0x305442){var _0x47df85=_0x305442[_0x4cef('0x58')]&&fs[_0x4cef('0x5e')](path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x44f472,_[_0x4cef('0x61')](_0x305442[_0x4cef('0x58')])))?path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x44f472,_[_0x4cef('0x61')](_0x305442[_0x4cef('0x58')])):path['join'](config[_0x4cef('0x60')],_0x44f472,_[_0x4cef('0x61')]('default_logo.svg'));var _0x345642=_0x4cef('0x62')+_[_0x4cef('0x63')](_0x4cef('0x58'));if(_0x305442[_0x345642]||!_0x71a70b['custom']){_0x47df85=path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x44f472,_['toLower'](_0x4cef('0x64')));}if(!fs[_0x4cef('0x5e')](_0x47df85)){throw new db[(_0x4cef('0x65'))][(_0x4cef('0x66'))](_[_0x4cef('0x63')](_0x4cef('0x58'))+_0x4cef('0x67'));}return _0x33ef57[_0x4cef('0x68')](_0x47df85);}})[_0x4cef('0x23')](handleError(_0x33ef57,null));};var utilLicense=require(_0x4cef('0x15'));exports[_0x4cef('0x69')]=function(_0x29cd15,_0x53857,_0x15c7f2){var _0x8fd727=_0x4cef('0x57');var _0x50d28f={'custom':![]};return utilLicense['getLicense']()[_0x4cef('0x19')](function(_0x54f758){if(_0x54f758){_0x50d28f=_0x54f758;}return db['Setting'][_0x4cef('0x4f')]({'where':{'id':_0x29cd15[_0x4cef('0x51')]['id']},'attributes':['logo',_0x4cef('0x55'),_0x4cef('0x6a'),_0x4cef('0x59'),_0x4cef('0x5a'),_0x4cef('0x5b'),'defaultPreferred',_0x4cef('0x5d')],'raw':!![]});})[_0x4cef('0x19')](handleEntityNotFound(_0x53857,null))[_0x4cef('0x19')](function(_0x18a97a){if(_0x18a97a){var _0x470410=_0x18a97a[_0x4cef('0x55')]&&fs[_0x4cef('0x5e')](path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x8fd727,_[_0x4cef('0x61')](_0x18a97a[_0x4cef('0x55')])))?path[_0x4cef('0x5f')](config['root'],_0x8fd727,_[_0x4cef('0x61')](_0x18a97a[_0x4cef('0x55')])):path[_0x4cef('0x5f')](config['root'],_0x8fd727,_[_0x4cef('0x61')](_0x4cef('0x6b')));var _0x2bab05='default'+_[_0x4cef('0x63')](_0x4cef('0x55'));if(_0x18a97a[_0x2bab05]||!_0x50d28f[_0x4cef('0x6c')]){_0x470410=path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x8fd727,_[_0x4cef('0x61')](_0x4cef('0x6b')));}if(!fs[_0x4cef('0x5e')](_0x470410)){throw new db[(_0x4cef('0x65'))]['ValidationError'](_[_0x4cef('0x63')](_0x4cef('0x55'))+_0x4cef('0x67'));}return _0x53857['download'](_0x470410);}})[_0x4cef('0x23')](handleError(_0x53857,null));};exports[_0x4cef('0x6d')]=function(_0x1b6c2e,_0x542540){return db[_0x4cef('0x49')][_0x4cef('0x4f')]({'where':{'id':_0x1b6c2e[_0x4cef('0x51')]['id']},'attributes':[_0x4cef('0x6e')]})[_0x4cef('0x19')](respondWithResult(_0x542540,null))[_0x4cef('0x23')](handleError(_0x542540,null));};exports[_0x4cef('0x6f')]=function(_0x143032,_0x35c45b,_0x5ce89e){if(_0x143032[_0x4cef('0x54')]&&_0x143032[_0x4cef('0x54')][_0x4cef('0x52')]){_0x143032[_0x4cef('0x50')]['preferred']=_0x143032[_0x4cef('0x54')][_0x4cef('0x52')];}return db['Setting']['find']({'where':{'id':_0x143032[_0x4cef('0x51')]['id']}})['then'](handleEntityNotFound(_0x35c45b,null))[_0x4cef('0x19')](saveUpdates(_0x143032[_0x4cef('0x50')],null))['then'](respondWithResult(_0x35c45b,null))['catch'](handleError(_0x35c45b,null));};var utilLicense=require(_0x4cef('0x15'));exports[_0x4cef('0x70')]=function(_0x215771,_0x2416fc,_0x10888f){var _0x21752b=_0x4cef('0x57');var _0x2ab6ea={'custom':![]};return utilLicense[_0x4cef('0x71')]()[_0x4cef('0x19')](function(_0x1bf28e){if(_0x1bf28e){_0x2ab6ea=_0x1bf28e;}return db[_0x4cef('0x49')][_0x4cef('0x4f')]({'where':{'id':_0x215771[_0x4cef('0x51')]['id']},'attributes':[_0x4cef('0x58'),_0x4cef('0x55'),_0x4cef('0x6a'),_0x4cef('0x59'),'defaultLogo',_0x4cef('0x5b'),_0x4cef('0x5c'),_0x4cef('0x5d')],'raw':!![]});})[_0x4cef('0x19')](handleEntityNotFound(_0x2416fc,null))[_0x4cef('0x19')](function(_0x4a1f30){if(_0x4a1f30){var _0x5df48b=_0x4a1f30[_0x4cef('0x6a')]&&fs[_0x4cef('0x5e')](path[_0x4cef('0x5f')](config['root'],_0x21752b,_[_0x4cef('0x61')](_0x4a1f30[_0x4cef('0x6a')])))?path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x21752b,_[_0x4cef('0x61')](_0x4a1f30['preferred'])):path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x21752b,_['toLower'](_0x4cef('0x72')));var _0x134cd8='default'+_[_0x4cef('0x63')](_0x4cef('0x6a'));if(_0x4a1f30[_0x134cd8]||!_0x2ab6ea[_0x4cef('0x6c')]||!_0x2ab6ea[_0x4cef('0x6a')]){_0x5df48b=path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x21752b,_['toLower'](_0x4cef('0x72')));}if(!fs[_0x4cef('0x5e')](_0x5df48b)){throw new db[(_0x4cef('0x65'))][(_0x4cef('0x66'))](_[_0x4cef('0x63')]('preferred')+'\x20not\x20found');}return _0x2416fc[_0x4cef('0x68')](_0x5df48b);}})['catch'](handleError(_0x2416fc,null));};exports[_0x4cef('0x73')]=function(_0x1f80b5,_0x27dc22,_0x24ab32){if(_0x1f80b5[_0x4cef('0x54')]&&_0x1f80b5[_0x4cef('0x54')][_0x4cef('0x52')]){_0x1f80b5[_0x4cef('0x50')][_0x4cef('0x59')]=_0x1f80b5['file']['filename'];}return db[_0x4cef('0x49')][_0x4cef('0x4f')]({'where':{'id':_0x1f80b5['params']['id']}})[_0x4cef('0x19')](handleEntityNotFound(_0x27dc22,null))[_0x4cef('0x19')](saveUpdates(_0x1f80b5[_0x4cef('0x50')],null))['then'](respondWithResult(_0x27dc22,null))[_0x4cef('0x23')](handleError(_0x27dc22,null));};var utilLicense=require('../../config/license/util');exports[_0x4cef('0x74')]=function(_0x570fed,_0x44a658,_0x122512){var _0x4f35e3=_0x4cef('0x57');var _0x45b008={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2db7e9){if(_0x2db7e9){_0x45b008=_0x2db7e9;}return db[_0x4cef('0x49')][_0x4cef('0x4f')]({'where':{'id':_0x570fed[_0x4cef('0x51')]['id']},'attributes':[_0x4cef('0x58'),'loginLogo','preferred',_0x4cef('0x59'),_0x4cef('0x5a'),_0x4cef('0x5b'),_0x4cef('0x5c'),_0x4cef('0x5d')],'raw':!![]});})[_0x4cef('0x19')](handleEntityNotFound(_0x44a658,null))[_0x4cef('0x19')](function(_0x1f2d90){if(_0x1f2d90){var _0x988409=_0x1f2d90[_0x4cef('0x59')]&&fs[_0x4cef('0x5e')](path['join'](config['root'],_0x4f35e3,_[_0x4cef('0x61')](_0x1f2d90[_0x4cef('0x59')])))?path[_0x4cef('0x5f')](config['root'],_0x4f35e3,_[_0x4cef('0x61')](_0x1f2d90[_0x4cef('0x59')])):path[_0x4cef('0x5f')](config[_0x4cef('0x60')],_0x4f35e3,_[_0x4cef('0x61')]('default_favicon.ico'));var _0x5e336f=_0x4cef('0x62')+_['upperFirst'](_0x4cef('0x59'));if(_0x1f2d90[_0x5e336f]||!_0x45b008[_0x4cef('0x6c')]){_0x988409=path['join'](config[_0x4cef('0x60')],_0x4f35e3,_[_0x4cef('0x61')]('default_favicon.ico'));}if(!fs[_0x4cef('0x5e')](_0x988409)){throw new db[(_0x4cef('0x65'))][(_0x4cef('0x66'))](_[_0x4cef('0x63')](_0x4cef('0x59'))+'\x20not\x20found');}return _0x44a658[_0x4cef('0x68')](_0x988409);}})[_0x4cef('0x23')](handleError(_0x44a658,null));};exports['getDate']=function(_0x21562f,_0x367c1d){var _0x237ae3={'offset':moment()[_0x4cef('0x75')]()};_0x237ae3['now']=moment()[_0x4cef('0x75')](_0x237ae3['offset'])[_0x4cef('0x76')](_0x4cef('0x77'));return _0x367c1d[_0x4cef('0x25')](0xc8)[_0x4cef('0x32')](_0x237ae3);}; \ No newline at end of file +var _0x1f38=['stringify','error','code','message','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','body','addLogo','file','filename','logo','params','../../config/license/util','getLogo','getLicense','loginLogo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','ValidationError','download','preferred','default_loginLogo.svg','default','Sequelize','\x20not\x20found','server/files/images/logos','default_preferred.png','addFavicon','getFavicon','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x30ad8f,_0x400f82){var _0x3a70a1=function(_0x40f04e){while(--_0x40f04e){_0x30ad8f['push'](_0x30ad8f['shift']());}};_0x3a70a1(++_0x400f82);}(_0x1f38,0xd7));var _0x81f3=function(_0x5b4303,_0x225e71){_0x5b4303=_0x5b4303-0x0;var _0x1aacba=_0x1f38[_0x5b4303];return _0x1aacba;};'use strict';var emlformat=require(_0x81f3('0x0'));var rimraf=require(_0x81f3('0x1'));var zipdir=require(_0x81f3('0x2'));var jsonpatch=require(_0x81f3('0x3'));var rp=require(_0x81f3('0x4'));var moment=require(_0x81f3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x81f3('0x6'));var util=require(_0x81f3('0x7'));var path=require(_0x81f3('0x8'));var sox=require(_0x81f3('0x9'));var csv=require(_0x81f3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81f3('0xb'));var _=require(_0x81f3('0xc'));var squel=require(_0x81f3('0xd'));var crypto=require(_0x81f3('0xe'));var jsforce=require(_0x81f3('0xf'));var deskjs=require(_0x81f3('0x10'));var toCsv=require(_0x81f3('0xa'));var querystring=require(_0x81f3('0x11'));var Papa=require(_0x81f3('0x12'));var Redis=require(_0x81f3('0x13'));var authService=require(_0x81f3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x81f3('0x15'));var hardwareService=require(_0x81f3('0x16'));var logger=require(_0x81f3('0x17'))(_0x81f3('0x18'));var utils=require(_0x81f3('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81f3('0x1a'))['db'];var jayson=require(_0x81f3('0x1b'));var client=jayson[_0x81f3('0x1c')][_0x81f3('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xf71e9a,_0x232c74,_0x4ffea5,_0x169119){return new BPromise(function(_0x79b7b,_0x469b84){var _0x5ad9e8=_0x169119||client;return _0x5ad9e8[_0x81f3('0x1e')](_0xf71e9a,_0x4ffea5)[_0x81f3('0x1f')](function(_0x3f177b){logger[_0x81f3('0x20')](_0x81f3('0x21'),_0x232c74,_0x81f3('0x22'));logger[_0x81f3('0x23')](_0x81f3('0x24'),_0x232c74,_0x81f3('0x22'),JSON[_0x81f3('0x25')](_0x3f177b));if(_0x3f177b[_0x81f3('0x26')]){if(_0x3f177b['error'][_0x81f3('0x27')]===0x1f4){logger[_0x81f3('0x26')](_0x81f3('0x21'),_0x232c74,_0x3f177b[_0x81f3('0x26')][_0x81f3('0x28')]);return _0x469b84(_0x3f177b['error'][_0x81f3('0x28')]);}logger[_0x81f3('0x26')]('Setting,\x20%s,\x20%s',_0x232c74,_0x3f177b[_0x81f3('0x26')]['message']);return _0x79b7b(_0x3f177b[_0x81f3('0x26')][_0x81f3('0x28')]);}else{logger[_0x81f3('0x20')]('Setting,\x20%s,\x20%s',_0x232c74,'request\x20sent');_0x79b7b(_0x3f177b[_0x81f3('0x29')][_0x81f3('0x28')]);}})['catch'](function(_0x25d4b4){logger[_0x81f3('0x26')]('Setting,\x20%s,\x20%s',_0x232c74,_0x25d4b4);_0x469b84(_0x25d4b4);});});}function respondWithStatusCode(_0x3f22a4,_0x1ced46){_0x1ced46=_0x1ced46||0xcc;return function(_0x1acee8){if(_0x1acee8){return _0x3f22a4[_0x81f3('0x2a')](_0x1ced46);}return _0x3f22a4[_0x81f3('0x2b')](_0x1ced46)[_0x81f3('0x2c')]();};}function respondWithResult(_0x13778a,_0x521c6d){_0x521c6d=_0x521c6d||0xc8;return function(_0x1c7302){if(_0x1c7302){return _0x13778a['status'](_0x521c6d)['json'](_0x1c7302);}};}function respondWithFilteredResult(_0x33c276,_0x76e8d){return function(_0x5a94a0){if(_0x5a94a0){var _0x60a157=typeof _0x76e8d['offset']===_0x81f3('0x2d')&&typeof _0x76e8d[_0x81f3('0x2e')]==='undefined';var _0x278a43=_0x5a94a0[_0x81f3('0x2f')];var _0x46025a=_0x60a157?0x0:_0x76e8d[_0x81f3('0x30')];var _0x37ed34=_0x60a157?_0x5a94a0[_0x81f3('0x2f')]:_0x76e8d[_0x81f3('0x30')]+_0x76e8d['limit'];var _0x30bfd1;if(_0x37ed34>=_0x278a43){_0x37ed34=_0x278a43;_0x30bfd1=0xc8;}else{_0x30bfd1=0xce;}_0x33c276[_0x81f3('0x2b')](_0x30bfd1);return _0x33c276[_0x81f3('0x31')](_0x81f3('0x32'),_0x46025a+'-'+_0x37ed34+'/'+_0x278a43)[_0x81f3('0x33')](_0x5a94a0);}return null;};}function patchUpdates(_0x46838d){return function(_0x504e2b){try{jsonpatch[_0x81f3('0x34')](_0x504e2b,_0x46838d,!![]);}catch(_0x5430ef){return BPromise['reject'](_0x5430ef);}return _0x504e2b[_0x81f3('0x35')]();};}function saveUpdates(_0x490098,_0x3b88ec){return function(_0x26a6a0){if(_0x26a6a0){return _0x26a6a0[_0x81f3('0x36')](_0x490098)[_0x81f3('0x1f')](function(_0x1db657){return _0x1db657;});}return null;};}function removeEntity(_0x106cbb,_0x356f38){return function(_0x3a0800){if(_0x3a0800){return _0x3a0800[_0x81f3('0x37')]()[_0x81f3('0x1f')](function(){_0x106cbb[_0x81f3('0x2b')](0xcc)[_0x81f3('0x2c')]();});}};}function handleEntityNotFound(_0x19f49c,_0x46cf96){return function(_0x5e40d0){if(!_0x5e40d0){_0x19f49c[_0x81f3('0x2a')](0x194);}return _0x5e40d0;};}function handleError(_0x35ab8a,_0x59fe5c){_0x59fe5c=_0x59fe5c||0x1f4;return function(_0x5be9dd){logger[_0x81f3('0x26')](_0x5be9dd[_0x81f3('0x38')]);if(_0x5be9dd[_0x81f3('0x39')]){delete _0x5be9dd['name'];}_0x35ab8a[_0x81f3('0x2b')](_0x59fe5c)[_0x81f3('0x3a')](_0x5be9dd);};}exports[_0x81f3('0x3b')]=function(_0xc58b66,_0x458ba3){var _0x4c12b7={},_0x14ac62={},_0x593231={'count':0x0,'rows':[]};var _0xbfbb93=_[_0x81f3('0x3c')](db[_0x81f3('0x3d')][_0x81f3('0x3e')],function(_0x5e61f5){return{'name':_0x5e61f5['fieldName'],'type':_0x5e61f5[_0x81f3('0x3f')]['key']};});_0x14ac62['model']=_[_0x81f3('0x3c')](_0xbfbb93,_0x81f3('0x39'));_0x14ac62[_0x81f3('0x40')]=_[_0x81f3('0x41')](_0xc58b66[_0x81f3('0x40')]);_0x14ac62['filters']=_[_0x81f3('0x42')](_0x14ac62['model'],_0x14ac62['query']);_0x4c12b7[_0x81f3('0x43')]=_[_0x81f3('0x42')](_0x14ac62[_0x81f3('0x44')],qs['fields'](_0xc58b66[_0x81f3('0x40')][_0x81f3('0x45')]));_0x4c12b7[_0x81f3('0x43')]=_0x4c12b7[_0x81f3('0x43')][_0x81f3('0x46')]?_0x4c12b7[_0x81f3('0x43')]:_0x14ac62[_0x81f3('0x44')];if(!_0xc58b66[_0x81f3('0x40')][_0x81f3('0x47')](_0x81f3('0x48'))){_0x4c12b7[_0x81f3('0x2e')]=qs[_0x81f3('0x2e')](_0xc58b66['query'][_0x81f3('0x2e')]);_0x4c12b7[_0x81f3('0x30')]=qs[_0x81f3('0x30')](_0xc58b66[_0x81f3('0x40')][_0x81f3('0x30')]);}_0x4c12b7[_0x81f3('0x49')]=qs[_0x81f3('0x4a')](_0xc58b66['query'][_0x81f3('0x4a')]);_0x4c12b7[_0x81f3('0x4b')]=qs[_0x81f3('0x4c')](_[_0x81f3('0x4d')](_0xc58b66[_0x81f3('0x40')],_0x14ac62[_0x81f3('0x4c')]),_0xbfbb93);if(_0xc58b66[_0x81f3('0x40')][_0x81f3('0x4e')]){_0x4c12b7[_0x81f3('0x4b')]=_[_0x81f3('0x4f')](_0x4c12b7[_0x81f3('0x4b')],{'$or':_[_0x81f3('0x3c')](_0xbfbb93,function(_0x3512c4){if(_0x3512c4['type']!==_0x81f3('0x50')){var _0x1d4863={};_0x1d4863[_0x3512c4[_0x81f3('0x39')]]={'$like':'%'+_0xc58b66[_0x81f3('0x40')][_0x81f3('0x4e')]+'%'};return _0x1d4863;}})});}_0x4c12b7=_[_0x81f3('0x4f')]({},_0x4c12b7,_0xc58b66[_0x81f3('0x51')]);var _0x5e1a60={'where':_0x4c12b7[_0x81f3('0x4b')]};return db[_0x81f3('0x3d')]['count'](_0x5e1a60)[_0x81f3('0x1f')](function(_0x223df6){_0x593231[_0x81f3('0x2f')]=_0x223df6;if(_0xc58b66['query'][_0x81f3('0x52')]){_0x4c12b7[_0x81f3('0x53')]=[{'all':!![]}];}return db[_0x81f3('0x3d')][_0x81f3('0x54')](_0x4c12b7);})[_0x81f3('0x1f')](function(_0x53944a){_0x593231[_0x81f3('0x55')]=_0x53944a;return _0x593231;})['then'](respondWithFilteredResult(_0x458ba3,_0x4c12b7))['catch'](handleError(_0x458ba3,null));};exports['show']=function(_0x43609b,_0x318f67){var _0x53caf9={'raw':![],'where':{'id':_0x43609b['params']['id']}},_0x2cd316={};_0x2cd316[_0x81f3('0x44')]=_['keys'](db[_0x81f3('0x3d')]['rawAttributes']);_0x2cd316[_0x81f3('0x40')]=_[_0x81f3('0x41')](_0x43609b[_0x81f3('0x40')]);_0x2cd316['filters']=_[_0x81f3('0x42')](_0x2cd316[_0x81f3('0x44')],_0x2cd316['query']);_0x53caf9[_0x81f3('0x43')]=_[_0x81f3('0x42')](_0x2cd316['model'],qs[_0x81f3('0x45')](_0x43609b[_0x81f3('0x40')][_0x81f3('0x45')]));_0x53caf9[_0x81f3('0x43')]=_0x53caf9[_0x81f3('0x43')][_0x81f3('0x46')]?_0x53caf9[_0x81f3('0x43')]:_0x2cd316['model'];if(_0x43609b['query'][_0x81f3('0x52')]){_0x53caf9[_0x81f3('0x53')]=[{'all':!![]}];}_0x53caf9=_[_0x81f3('0x4f')]({},_0x53caf9,_0x43609b[_0x81f3('0x51')]);return db[_0x81f3('0x3d')][_0x81f3('0x56')](_0x53caf9)[_0x81f3('0x1f')](handleEntityNotFound(_0x318f67,null))[_0x81f3('0x1f')](respondWithResult(_0x318f67,null))[_0x81f3('0x57')](handleError(_0x318f67,null));};exports[_0x81f3('0x36')]=function(_0x501551,_0x576534){if(_0x501551[_0x81f3('0x58')]['id']){delete _0x501551[_0x81f3('0x58')]['id'];}return db[_0x81f3('0x3d')][_0x81f3('0x56')]({'where':{'id':_0x501551['params']['id']}})[_0x81f3('0x1f')](handleEntityNotFound(_0x576534,null))[_0x81f3('0x1f')](saveUpdates(_0x501551[_0x81f3('0x58')],null))[_0x81f3('0x1f')](respondWithResult(_0x576534,null))[_0x81f3('0x57')](handleError(_0x576534,null));};exports[_0x81f3('0x59')]=function(_0x54414d,_0x312fa8,_0x17a37d){if(_0x54414d[_0x81f3('0x5a')]&&_0x54414d['file'][_0x81f3('0x5b')]){_0x54414d[_0x81f3('0x58')][_0x81f3('0x5c')]=_0x54414d[_0x81f3('0x5a')][_0x81f3('0x5b')];}return db['Setting'][_0x81f3('0x56')]({'where':{'id':_0x54414d[_0x81f3('0x5d')]['id']}})['then'](handleEntityNotFound(_0x312fa8,null))['then'](saveUpdates(_0x54414d['body'],null))[_0x81f3('0x1f')](respondWithResult(_0x312fa8,null))[_0x81f3('0x57')](handleError(_0x312fa8,null));};exports['addLogoLogin']=function(_0x5c4376,_0x5cff41,_0x59d5f1){if(_0x5c4376['file']&&_0x5c4376[_0x81f3('0x5a')][_0x81f3('0x5b')]){_0x5c4376[_0x81f3('0x58')]['loginLogo']=_0x5c4376[_0x81f3('0x5a')][_0x81f3('0x5b')];}return db[_0x81f3('0x3d')][_0x81f3('0x56')]({'where':{'id':_0x5c4376['params']['id']}})[_0x81f3('0x1f')](handleEntityNotFound(_0x5cff41,null))[_0x81f3('0x1f')](saveUpdates(_0x5c4376['body'],null))['then'](respondWithResult(_0x5cff41,null))[_0x81f3('0x57')](handleError(_0x5cff41,null));};var utilLicense=require(_0x81f3('0x5e'));exports[_0x81f3('0x5f')]=function(_0x437662,_0x5c49e6,_0x4d54da){var _0x58025d='server/files/images/logos';var _0x208876={'custom':![]};return utilLicense[_0x81f3('0x60')]()[_0x81f3('0x1f')](function(_0xf0a0d5){if(_0xf0a0d5){_0x208876=_0xf0a0d5;}return db[_0x81f3('0x3d')][_0x81f3('0x56')]({'where':{'id':_0x437662[_0x81f3('0x5d')]['id']},'attributes':[_0x81f3('0x5c'),_0x81f3('0x61'),'preferred',_0x81f3('0x62'),_0x81f3('0x63'),_0x81f3('0x64'),_0x81f3('0x65'),_0x81f3('0x66')],'raw':!![]});})[_0x81f3('0x1f')](handleEntityNotFound(_0x5c49e6,null))[_0x81f3('0x1f')](function(_0x4d8212){if(_0x4d8212){var _0x1b495f=_0x4d8212[_0x81f3('0x5c')]&&fs[_0x81f3('0x67')](path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x58025d,_[_0x81f3('0x6a')](_0x4d8212[_0x81f3('0x5c')])))?path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x58025d,_[_0x81f3('0x6a')](_0x4d8212[_0x81f3('0x5c')])):path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x58025d,_[_0x81f3('0x6a')](_0x81f3('0x6b')));var _0x2fca3d='default'+_[_0x81f3('0x6c')](_0x81f3('0x5c'));if(_0x4d8212[_0x2fca3d]||!_0x208876[_0x81f3('0x6d')]){_0x1b495f=path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x58025d,_[_0x81f3('0x6a')](_0x81f3('0x6b')));}if(!fs['existsSync'](_0x1b495f)){throw new db['Sequelize'][(_0x81f3('0x6e'))](_[_0x81f3('0x6c')]('logo')+'\x20not\x20found');}return _0x5c49e6[_0x81f3('0x6f')](_0x1b495f);}})['catch'](handleError(_0x5c49e6,null));};var utilLicense=require(_0x81f3('0x5e'));exports['getLogoLogin']=function(_0x4bc34b,_0x5c2d59,_0x4c25f7){var _0x46969e='server/files/images/logos';var _0x48d47f={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1e7d46){if(_0x1e7d46){_0x48d47f=_0x1e7d46;}return db[_0x81f3('0x3d')][_0x81f3('0x56')]({'where':{'id':_0x4bc34b[_0x81f3('0x5d')]['id']},'attributes':['logo',_0x81f3('0x61'),_0x81f3('0x70'),_0x81f3('0x62'),'defaultLogo',_0x81f3('0x64'),_0x81f3('0x65'),'defaultFavicon'],'raw':!![]});})[_0x81f3('0x1f')](handleEntityNotFound(_0x5c2d59,null))[_0x81f3('0x1f')](function(_0x491b7f){if(_0x491b7f){var _0x527f98=_0x491b7f[_0x81f3('0x61')]&&fs[_0x81f3('0x67')](path[_0x81f3('0x68')](config['root'],_0x46969e,_[_0x81f3('0x6a')](_0x491b7f[_0x81f3('0x61')])))?path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x46969e,_[_0x81f3('0x6a')](_0x491b7f[_0x81f3('0x61')])):path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x46969e,_[_0x81f3('0x6a')](_0x81f3('0x71')));var _0x3bc8d4=_0x81f3('0x72')+_[_0x81f3('0x6c')](_0x81f3('0x61'));if(_0x491b7f[_0x3bc8d4]||!_0x48d47f[_0x81f3('0x6d')]){_0x527f98=path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x46969e,_[_0x81f3('0x6a')](_0x81f3('0x71')));}if(!fs[_0x81f3('0x67')](_0x527f98)){throw new db[(_0x81f3('0x73'))][(_0x81f3('0x6e'))](_[_0x81f3('0x6c')](_0x81f3('0x61'))+_0x81f3('0x74'));}return _0x5c2d59[_0x81f3('0x6f')](_0x527f98);}})[_0x81f3('0x57')](handleError(_0x5c2d59,null));};exports['gdpr']=function(_0x16cd62,_0x35682a){return db['Setting'][_0x81f3('0x56')]({'where':{'id':_0x16cd62[_0x81f3('0x5d')]['id']},'attributes':['securePassword']})[_0x81f3('0x1f')](respondWithResult(_0x35682a,null))[_0x81f3('0x57')](handleError(_0x35682a,null));};exports['addPreferred']=function(_0x2d4d4e,_0x48743b,_0x171dd6){if(_0x2d4d4e['file']&&_0x2d4d4e['file'][_0x81f3('0x5b')]){_0x2d4d4e[_0x81f3('0x58')]['preferred']=_0x2d4d4e['file']['filename'];}return db[_0x81f3('0x3d')]['find']({'where':{'id':_0x2d4d4e[_0x81f3('0x5d')]['id']}})[_0x81f3('0x1f')](handleEntityNotFound(_0x48743b,null))[_0x81f3('0x1f')](saveUpdates(_0x2d4d4e[_0x81f3('0x58')],null))[_0x81f3('0x1f')](respondWithResult(_0x48743b,null))[_0x81f3('0x57')](handleError(_0x48743b,null));};var utilLicense=require(_0x81f3('0x5e'));exports['getPreferred']=function(_0x2397fd,_0x5b0fc5,_0x294c8c){var _0x1b8aef=_0x81f3('0x75');var _0x253eeb={'custom':![]};return utilLicense[_0x81f3('0x60')]()[_0x81f3('0x1f')](function(_0x5a4e97){if(_0x5a4e97){_0x253eeb=_0x5a4e97;}return db['Setting'][_0x81f3('0x56')]({'where':{'id':_0x2397fd[_0x81f3('0x5d')]['id']},'attributes':['logo',_0x81f3('0x61'),_0x81f3('0x70'),_0x81f3('0x62'),_0x81f3('0x63'),'defaultLoginLogo',_0x81f3('0x65'),_0x81f3('0x66')],'raw':!![]});})[_0x81f3('0x1f')](handleEntityNotFound(_0x5b0fc5,null))[_0x81f3('0x1f')](function(_0x25ef10){if(_0x25ef10){var _0xd5afd=_0x25ef10[_0x81f3('0x70')]&&fs['existsSync'](path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x1b8aef,_[_0x81f3('0x6a')](_0x25ef10['preferred'])))?path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x1b8aef,_[_0x81f3('0x6a')](_0x25ef10['preferred'])):path[_0x81f3('0x68')](config['root'],_0x1b8aef,_[_0x81f3('0x6a')](_0x81f3('0x76')));var _0x265293=_0x81f3('0x72')+_[_0x81f3('0x6c')](_0x81f3('0x70'));if(_0x25ef10[_0x265293]||!_0x253eeb[_0x81f3('0x6d')]||!_0x253eeb[_0x81f3('0x70')]){_0xd5afd=path['join'](config['root'],_0x1b8aef,_[_0x81f3('0x6a')]('default_preferred.png'));}if(!fs[_0x81f3('0x67')](_0xd5afd)){throw new db[(_0x81f3('0x73'))][(_0x81f3('0x6e'))](_['upperFirst'](_0x81f3('0x70'))+_0x81f3('0x74'));}return _0x5b0fc5['download'](_0xd5afd);}})[_0x81f3('0x57')](handleError(_0x5b0fc5,null));};exports[_0x81f3('0x77')]=function(_0x38abd9,_0x55f6a9,_0x30906b){if(_0x38abd9['file']&&_0x38abd9[_0x81f3('0x5a')][_0x81f3('0x5b')]){_0x38abd9[_0x81f3('0x58')]['favicon']=_0x38abd9[_0x81f3('0x5a')][_0x81f3('0x5b')];}return db[_0x81f3('0x3d')]['find']({'where':{'id':_0x38abd9['params']['id']}})[_0x81f3('0x1f')](handleEntityNotFound(_0x55f6a9,null))[_0x81f3('0x1f')](saveUpdates(_0x38abd9[_0x81f3('0x58')],null))[_0x81f3('0x1f')](respondWithResult(_0x55f6a9,null))[_0x81f3('0x57')](handleError(_0x55f6a9,null));};var utilLicense=require(_0x81f3('0x5e'));exports[_0x81f3('0x78')]=function(_0x424d38,_0x47bc0a,_0x428cd2){var _0x29ea4c=_0x81f3('0x75');var _0x4a18c5={'custom':![]};return utilLicense[_0x81f3('0x60')]()['then'](function(_0x5a2de2){if(_0x5a2de2){_0x4a18c5=_0x5a2de2;}return db['Setting'][_0x81f3('0x56')]({'where':{'id':_0x424d38[_0x81f3('0x5d')]['id']},'attributes':[_0x81f3('0x5c'),_0x81f3('0x61'),'preferred',_0x81f3('0x62'),_0x81f3('0x63'),_0x81f3('0x64'),_0x81f3('0x65'),_0x81f3('0x66')],'raw':!![]});})[_0x81f3('0x1f')](handleEntityNotFound(_0x47bc0a,null))[_0x81f3('0x1f')](function(_0x5a69d9){if(_0x5a69d9){var _0x7869b4=_0x5a69d9[_0x81f3('0x62')]&&fs[_0x81f3('0x67')](path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x29ea4c,_[_0x81f3('0x6a')](_0x5a69d9['favicon'])))?path[_0x81f3('0x68')](config[_0x81f3('0x69')],_0x29ea4c,_[_0x81f3('0x6a')](_0x5a69d9[_0x81f3('0x62')])):path[_0x81f3('0x68')](config['root'],_0x29ea4c,_[_0x81f3('0x6a')]('default_favicon.ico'));var _0x23140b='default'+_['upperFirst'](_0x81f3('0x62'));if(_0x5a69d9[_0x23140b]||!_0x4a18c5[_0x81f3('0x6d')]){_0x7869b4=path['join'](config[_0x81f3('0x69')],_0x29ea4c,_[_0x81f3('0x6a')]('default_favicon.ico'));}if(!fs['existsSync'](_0x7869b4)){throw new db['Sequelize'][(_0x81f3('0x6e'))](_[_0x81f3('0x6c')]('favicon')+'\x20not\x20found');}return _0x47bc0a[_0x81f3('0x6f')](_0x7869b4);}})['catch'](handleError(_0x47bc0a,null));};exports[_0x81f3('0x79')]=function(_0x559f06,_0x40de66){var _0x3ea657={'offset':moment()['utcOffset']()};_0x3ea657[_0x81f3('0x7a')]=moment()[_0x81f3('0x7b')](_0x3ea657[_0x81f3('0x30')])[_0x81f3('0x7c')](_0x81f3('0x7d'));return _0x40de66[_0x81f3('0x2b')](0xc8)[_0x81f3('0x3a')](_0x3ea657);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index be019cb..3348e23 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x5ebc51,_0x19d7a9){var _0x5b203e=function(_0x46c9ab){while(--_0x46c9ab){_0x5ebc51['push'](_0x5ebc51['shift']());}};_0x5b203e(++_0x19d7a9);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b43e1,_0x321e9e){_0x5b43e1=_0x5b43e1-0x0;var _0x477523=_0xedd9[_0x5b43e1];return _0x477523;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f67176e..509f728 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 _0xdce3=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','Setting','find','options','raw','where','attributes','include','map','model','ShowSetting','debug','lodash'];(function(_0xdc4c23,_0x47aae1){var _0x3ce8a2=function(_0x5ab5d7){while(--_0x5ab5d7){_0xdc4c23['push'](_0xdc4c23['shift']());}};_0x3ce8a2(++_0x47aae1);}(_0xdce3,0x1a3));var _0x3dce=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdce3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3dce('0x0'));var util=require(_0x3dce('0x1'));var moment=require(_0x3dce('0x2'));var BPromise=require(_0x3dce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dce('0x4'));var db=require(_0x3dce('0x5'))['db'];var utils=require(_0x3dce('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3dce('0x7'));var jayson=require(_0x3dce('0x8'));var client=jayson['client'][_0x3dce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2344ca,_0x20a23a,_0x29b1fb){return new BPromise(function(_0x22b234,_0x2ca70d){return client[_0x3dce('0xa')](_0x2344ca,_0x29b1fb)[_0x3dce('0xb')](function(_0x3de835){logger[_0x3dce('0xc')](_0x3dce('0xd'),_0x20a23a,'request\x20sent');logger['debug'](_0x3dce('0xe'),_0x20a23a,_0x3dce('0xf'),JSON['stringify'](_0x3de835));if(_0x3de835['error']){if(_0x3de835[_0x3dce('0x10')]['code']===0x1f4){logger[_0x3dce('0x10')]('Setting,\x20%s,\x20%s',_0x20a23a,_0x3de835[_0x3dce('0x10')][_0x3dce('0x11')]);return _0x2ca70d(_0x3de835[_0x3dce('0x10')][_0x3dce('0x11')]);}logger[_0x3dce('0x10')]('Setting,\x20%s,\x20%s',_0x20a23a,_0x3de835['error'][_0x3dce('0x11')]);return _0x22b234(_0x3de835[_0x3dce('0x10')][_0x3dce('0x11')]);}else{logger['info'](_0x3dce('0xd'),_0x20a23a,'request\x20sent');_0x22b234(_0x3de835[_0x3dce('0x12')][_0x3dce('0x11')]);}})['catch'](function(_0x109c09){logger[_0x3dce('0x10')](_0x3dce('0xd'),_0x20a23a,_0x109c09);_0x2ca70d(_0x109c09);});});}exports['ShowSetting']=function(_0x2e22bf){var _0x57457e=this;return new Promise(function(_0x46edd0,_0x211c3d){return db[_0x3dce('0x13')][_0x3dce('0x14')]({'raw':_0x2e22bf['options']?_0x2e22bf[_0x3dce('0x15')][_0x3dce('0x16')]===undefined?!![]:![]:!![],'where':_0x2e22bf[_0x3dce('0x15')]?_0x2e22bf['options'][_0x3dce('0x17')]||null:null,'attributes':_0x2e22bf['options']?_0x2e22bf[_0x3dce('0x15')][_0x3dce('0x18')]||null:null,'include':_0x2e22bf['options']?_0x2e22bf[_0x3dce('0x15')][_0x3dce('0x19')]?_[_0x3dce('0x1a')](_0x2e22bf[_0x3dce('0x15')][_0x3dce('0x19')],function(_0x1cd189){return{'model':db[_0x1cd189[_0x3dce('0x1b')]],'as':_0x1cd189['as'],'attributes':_0x1cd189[_0x3dce('0x18')],'include':_0x1cd189[_0x3dce('0x19')]?_[_0x3dce('0x1a')](_0x1cd189['include'],function(_0x4a0a3b){return{'model':db[_0x4a0a3b[_0x3dce('0x1b')]],'as':_0x4a0a3b['as'],'attributes':_0x4a0a3b[_0x3dce('0x18')],'include':_0x4a0a3b['include']?_[_0x3dce('0x1a')](_0x4a0a3b['include'],function(_0x2f7e34){return{'model':db[_0x2f7e34['model']],'as':_0x2f7e34['as'],'attributes':_0x2f7e34['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dce('0xb')](function(_0x3691f8){logger[_0x3dce('0xc')](_0x3dce('0x1c'),_0x2e22bf);logger[_0x3dce('0x1d')](_0x3dce('0x1c'),_0x2e22bf,JSON['stringify'](_0x3691f8));_0x46edd0(_0x3691f8);})['catch'](function(_0x5d5d8d){logger['error'](_0x3dce('0x1c'),_0x5d5d8d[_0x3dce('0x11')],_0x2e22bf);_0x211c3d(_0x57457e[_0x3dce('0x10')](0x1f4,_0x5d5d8d[_0x3dce('0x11')]));});});}; \ No newline at end of file +var _0x6e54=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','catch','ShowSetting','find','options','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x4a687d,_0x2f96e6){var _0x18a3a4=function(_0x276d2a){while(--_0x276d2a){_0x4a687d['push'](_0x4a687d['shift']());}};_0x18a3a4(++_0x2f96e6);}(_0x6e54,0xad));var _0x46e5=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0x6e54[_0x471448];return _0x38190b;};'use strict';var _=require(_0x46e5('0x0'));var util=require(_0x46e5('0x1'));var moment=require(_0x46e5('0x2'));var BPromise=require(_0x46e5('0x3'));var rs=require(_0x46e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x46e5('0x5'));var logger=require(_0x46e5('0x6'))(_0x46e5('0x7'));var config=require(_0x46e5('0x8'));var jayson=require(_0x46e5('0x9'));var client=jayson[_0x46e5('0xa')][_0x46e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d8df2,_0x4cf260,_0x489a2f){return new BPromise(function(_0x187fad,_0x136725){return client[_0x46e5('0xc')](_0x1d8df2,_0x489a2f)[_0x46e5('0xd')](function(_0x16d839){logger[_0x46e5('0xe')]('Setting,\x20%s,\x20%s',_0x4cf260,_0x46e5('0xf'));logger[_0x46e5('0x10')](_0x46e5('0x11'),_0x4cf260,_0x46e5('0xf'),JSON[_0x46e5('0x12')](_0x16d839));if(_0x16d839[_0x46e5('0x13')]){if(_0x16d839[_0x46e5('0x13')]['code']===0x1f4){logger[_0x46e5('0x13')]('Setting,\x20%s,\x20%s',_0x4cf260,_0x16d839[_0x46e5('0x13')][_0x46e5('0x14')]);return _0x136725(_0x16d839[_0x46e5('0x13')][_0x46e5('0x14')]);}logger[_0x46e5('0x13')](_0x46e5('0x15'),_0x4cf260,_0x16d839[_0x46e5('0x13')][_0x46e5('0x14')]);return _0x187fad(_0x16d839[_0x46e5('0x13')][_0x46e5('0x14')]);}else{logger[_0x46e5('0xe')]('Setting,\x20%s,\x20%s',_0x4cf260,_0x46e5('0xf'));_0x187fad(_0x16d839['result'][_0x46e5('0x14')]);}})[_0x46e5('0x16')](function(_0x44fff7){logger[_0x46e5('0x13')](_0x46e5('0x15'),_0x4cf260,_0x44fff7);_0x136725(_0x44fff7);});});}exports[_0x46e5('0x17')]=function(_0x458581){var _0x14ef82=this;return new Promise(function(_0x1ae920,_0x5eb1eb){return db['Setting'][_0x46e5('0x18')]({'raw':_0x458581['options']?_0x458581[_0x46e5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x458581[_0x46e5('0x19')]?_0x458581[_0x46e5('0x19')]['where']||null:null,'attributes':_0x458581[_0x46e5('0x19')]?_0x458581[_0x46e5('0x19')][_0x46e5('0x1a')]||null:null,'include':_0x458581[_0x46e5('0x19')]?_0x458581[_0x46e5('0x19')][_0x46e5('0x1b')]?_[_0x46e5('0x1c')](_0x458581[_0x46e5('0x19')][_0x46e5('0x1b')],function(_0x5639bf){return{'model':db[_0x5639bf['model']],'as':_0x5639bf['as'],'attributes':_0x5639bf[_0x46e5('0x1a')],'include':_0x5639bf[_0x46e5('0x1b')]?_[_0x46e5('0x1c')](_0x5639bf[_0x46e5('0x1b')],function(_0x478c39){return{'model':db[_0x478c39[_0x46e5('0x1d')]],'as':_0x478c39['as'],'attributes':_0x478c39['attributes'],'include':_0x478c39[_0x46e5('0x1b')]?_['map'](_0x478c39[_0x46e5('0x1b')],function(_0x142765){return{'model':db[_0x142765['model']],'as':_0x142765['as'],'attributes':_0x142765[_0x46e5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x46e5('0xd')](function(_0x76fd28){logger[_0x46e5('0xe')]('ShowSetting',_0x458581);logger[_0x46e5('0x10')](_0x46e5('0x17'),_0x458581,JSON[_0x46e5('0x12')](_0x76fd28));_0x1ae920(_0x76fd28);})[_0x46e5('0x16')](function(_0x4b3f43){logger['error'](_0x46e5('0x17'),_0x4b3f43[_0x46e5('0x14')],_0x458581);_0x5eb1eb(_0x14ef82[_0x46e5('0x13')](0x1f4,_0x4b3f43[_0x46e5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 34da741..c919720 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 _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x326c47,_0x8dca2){var _0x564786=function(_0x276e63){while(--_0x276e63){_0x326c47['push'](_0x326c47['shift']());}};_0x564786(++_0x8dca2);}(_0xe14b,0x93));var _0xbe14=function(_0x5b1c3a,_0x3129eb){_0x5b1c3a=_0x5b1c3a-0x0;var _0x15ca3e=_0xe14b[_0x5b1c3a];return _0x15ca3e;};'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['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file +var _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x28467d,_0x2ac2bf){var _0x22cbbd=function(_0x3288ec){while(--_0x3288ec){_0x28467d['push'](_0x28467d['shift']());}};_0x22cbbd(++_0x2ac2bf);}(_0x5fab,0x177));var _0xb5fa=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0x5fab[_0xd2e2ab];return _0x1703a2;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 918021b..5da9aba 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 _0xaf04=['plivo','bandwidth','csc','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend'];(function(_0x5c9b4f,_0xe0c471){var _0x6d1197=function(_0x57b75d){while(--_0x57b75d){_0x5c9b4f['push'](_0x5c9b4f['shift']());}};_0x6d1197(++_0xe0c471);}(_0xaf04,0xbe));var _0x4af0=function(_0x1f7535,_0x5aef3f){_0x1f7535=_0x1f7535-0x0;var _0x3222f0=_0xaf04[_0x1f7535];return _0x3222f0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4af0('0x0'));module[_0x4af0('0x1')]={'name':{'type':Sequelize[_0x4af0('0x2')],'unique':_0x4af0('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4af0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4af0('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x4af0('0x2')],'defaultValue':function(){return rs[_0x4af0('0x4')]();}},'phone':{'type':Sequelize[_0x4af0('0x2')]},'type':{'type':Sequelize[_0x4af0('0x5')](_0x4af0('0x6'),_0x4af0('0x7'),_0x4af0('0x8'),_0x4af0('0x9'),_0x4af0('0xa'),'clickatell',_0x4af0('0xb'),_0x4af0('0xc'),'infobip',_0x4af0('0xd'))},'accountSid':{'type':Sequelize[_0x4af0('0x2')]},'authId':{'type':Sequelize[_0x4af0('0x2')]},'authToken':{'type':Sequelize[_0x4af0('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x4af0('0x2')]},'password':{'type':Sequelize[_0x4af0('0x2')]},'apiKey':{'type':Sequelize[_0x4af0('0x2')]},'applicationId':{'type':Sequelize[_0x4af0('0x2')]},'accountId':{'type':Sequelize[_0x4af0('0x2')]},'senderString':{'type':Sequelize[_0x4af0('0x2')]},'deliveryReport':{'type':Sequelize[_0x4af0('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x4af0('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4af0('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4af0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4af0('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4af0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4af0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4af0('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4af0('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x4af0('0xe')],'defaultValue':![],'comment':_0x4af0('0x12'),'set':function(_0x3c9706){if(!_0x3c9706)this[_0x4af0('0x13')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x3c9706);}}}; \ No newline at end of file +var _0x3006=['clicksend','plivo','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','connectel'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3006,0x1f2));var _0x6300=function(_0x1b742a,_0x29b2f2){_0x1b742a=_0x1b742a-0x0;var _0x54d366=_0x3006[_0x1b742a];return _0x54d366;};'use strict';var Sequelize=require(_0x6300('0x0'));var rs=require(_0x6300('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6300('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6300('0x2')],'defaultValue':function(){return rs[_0x6300('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6300('0x4')](_0x6300('0x5'),_0x6300('0x6'),_0x6300('0x7'),_0x6300('0x8'),_0x6300('0x9'),'clickatell',_0x6300('0xa'),_0x6300('0xb'),_0x6300('0xc'),_0x6300('0xd'))},'accountSid':{'type':Sequelize[_0x6300('0x2')]},'authId':{'type':Sequelize[_0x6300('0x2')]},'authToken':{'type':Sequelize[_0x6300('0x2')]},'smsMethod':{'type':Sequelize[_0x6300('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6300('0x2')]},'password':{'type':Sequelize[_0x6300('0x2')]},'apiKey':{'type':Sequelize[_0x6300('0x2')]},'applicationId':{'type':Sequelize[_0x6300('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x6300('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x6300('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6300('0xe')],'defaultValue':function(){return _0x6300('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6300('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6300('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6300('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6300('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6300('0x11')],'comment':_0x6300('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6300('0x10')],'defaultValue':![],'comment':_0x6300('0x13'),'set':function(_0x263701){if(!_0x263701)this[_0x6300('0x14')](_0x6300('0x15'),null);this[_0x6300('0x14')]('mandatoryDisposition',_0x263701);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b83e790..5dc66f3 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 _0x92c9=['Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','redif','DELIVERED','error_code','clickatell','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','SmsAccount,\x20%s,\x20%s','message','info','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','Pause','mandatoryDispositionPause','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','text','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','CmContact','contact','SmsInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','agent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','addApplications','sequelize','transaction','bulkCreate','priority','getApplications','getInteractions','User','Owner','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','dataValues'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x92c9,0x1e3));var _0x992c=function(_0x2bcfeb,_0x550ad7){_0x2bcfeb=_0x2bcfeb-0x0;var _0x16d934=_0x92c9[_0x2bcfeb];return _0x16d934;};'use strict';var emlformat=require(_0x992c('0x0'));var rimraf=require(_0x992c('0x1'));var zipdir=require(_0x992c('0x2'));var jsonpatch=require(_0x992c('0x3'));var rp=require(_0x992c('0x4'));var moment=require(_0x992c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x992c('0x6'));var util=require(_0x992c('0x7'));var path=require(_0x992c('0x8'));var sox=require(_0x992c('0x9'));var csv=require(_0x992c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x992c('0xb'));var _=require(_0x992c('0xc'));var squel=require(_0x992c('0xd'));var crypto=require(_0x992c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x992c('0xf'));var toCsv=require(_0x992c('0xa'));var querystring=require(_0x992c('0x10'));var Papa=require(_0x992c('0x11'));var Redis=require(_0x992c('0x12'));var authService=require(_0x992c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x992c('0x14'));var hardwareService=require(_0x992c('0x15'));var logger=require(_0x992c('0x16'))(_0x992c('0x17'));var utils=require(_0x992c('0x18'));var config=require(_0x992c('0x19'));var licenseUtil=require(_0x992c('0x1a'));var db=require('../../mysqldb')['db'];config[_0x992c('0x1b')]=_[_0x992c('0x1c')](config['redis'],{'host':_0x992c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x992c('0x1b')]));require('./smsAccount.socket')[_0x992c('0x1e')](socket);var jayson=require(_0x992c('0x1f'));var client=jayson[_0x992c('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x11d212,_0x5b9117,_0x6115e2,_0x91309a){return new BPromise(function(_0x411621,_0x1e4988){var _0x5198d5=_0x91309a||client;return _0x5198d5[_0x992c('0x21')](_0x11d212,_0x6115e2)[_0x992c('0x22')](function(_0x3c4fb8){logger['info']('SmsAccount,\x20%s,\x20%s',_0x5b9117,_0x992c('0x23'));logger[_0x992c('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b9117,_0x992c('0x23'),JSON[_0x992c('0x25')](_0x3c4fb8));if(_0x3c4fb8[_0x992c('0x26')]){if(_0x3c4fb8[_0x992c('0x26')]['code']===0x1f4){logger[_0x992c('0x26')](_0x992c('0x27'),_0x5b9117,_0x3c4fb8[_0x992c('0x26')]['message']);return _0x1e4988(_0x3c4fb8[_0x992c('0x26')][_0x992c('0x28')]);}logger[_0x992c('0x26')](_0x992c('0x27'),_0x5b9117,_0x3c4fb8['error'][_0x992c('0x28')]);return _0x411621(_0x3c4fb8[_0x992c('0x26')]['message']);}else{logger[_0x992c('0x29')](_0x992c('0x27'),_0x5b9117,_0x992c('0x23'));_0x411621(_0x3c4fb8[_0x992c('0x2a')][_0x992c('0x28')]);}})[_0x992c('0x2b')](function(_0x5eec2c){logger[_0x992c('0x26')](_0x992c('0x27'),_0x5b9117,_0x5eec2c);_0x1e4988(_0x5eec2c);});});}function respondWithStatusCode(_0x980ccd,_0x1d5aa5){_0x1d5aa5=_0x1d5aa5||0xcc;return function(_0x296c4d){if(_0x296c4d){return _0x980ccd['sendStatus'](_0x1d5aa5);}return _0x980ccd[_0x992c('0x2c')](_0x1d5aa5)[_0x992c('0x2d')]();};}function respondWithResult(_0x38b46a,_0x1ed9b2){_0x1ed9b2=_0x1ed9b2||0xc8;return function(_0x2a4ab4){if(_0x2a4ab4){return _0x38b46a[_0x992c('0x2c')](_0x1ed9b2)[_0x992c('0x2e')](_0x2a4ab4);}};}function respondWithFilteredResult(_0x2d168e,_0x6aeb6b){return function(_0x1b0436){if(_0x1b0436){var _0x483950=typeof _0x6aeb6b['offset']===_0x992c('0x2f')&&typeof _0x6aeb6b['limit']===_0x992c('0x2f');var _0x24d600=_0x1b0436[_0x992c('0x30')];var _0x54552b=_0x483950?0x0:_0x6aeb6b[_0x992c('0x31')];var _0x331d8d=_0x483950?_0x1b0436[_0x992c('0x30')]:_0x6aeb6b[_0x992c('0x31')]+_0x6aeb6b[_0x992c('0x32')];var _0x5cd7f0;if(_0x331d8d>=_0x24d600){_0x331d8d=_0x24d600;_0x5cd7f0=0xc8;}else{_0x5cd7f0=0xce;}_0x2d168e[_0x992c('0x2c')](_0x5cd7f0);return _0x2d168e[_0x992c('0x33')](_0x992c('0x34'),_0x54552b+'-'+_0x331d8d+'/'+_0x24d600)['json'](_0x1b0436);}return null;};}function patchUpdates(_0x5eef6c){return function(_0x52ae9a){try{jsonpatch[_0x992c('0x35')](_0x52ae9a,_0x5eef6c,!![]);}catch(_0x2fe365){return BPromise['reject'](_0x2fe365);}return _0x52ae9a[_0x992c('0x36')]();};}function saveUpdates(_0xc5fb8,_0x5ec5b5){return function(_0xce01b5){if(_0xce01b5){return _0xce01b5[_0x992c('0x37')](_0xc5fb8)[_0x992c('0x22')](function(_0x3807f1){return _0x3807f1;});}return null;};}function removeEntity(_0x1405d6,_0x2bd097){return function(_0x47b087){if(_0x47b087){return _0x47b087[_0x992c('0x38')]()[_0x992c('0x22')](function(){var _0x59d6a1=_0x47b087['get']({'plain':!![]});var _0x59e13c=_0x992c('0x39');return db[_0x992c('0x3a')][_0x992c('0x38')]({'where':{'type':_0x59e13c,'resourceId':_0x59d6a1['id']}})[_0x992c('0x22')](function(){return _0x47b087;});})[_0x992c('0x22')](function(){_0x1405d6[_0x992c('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d196d,_0x44dc86){return function(_0x4976db){if(!_0x4976db){_0x3d196d['sendStatus'](0x194);}return _0x4976db;};}function handleError(_0xa94b9,_0x1290b4){_0x1290b4=_0x1290b4||0x1f4;return function(_0x567d6a){logger[_0x992c('0x26')](_0x567d6a[_0x992c('0x3b')]);if(_0x567d6a[_0x992c('0x3c')]){delete _0x567d6a['name'];}_0xa94b9[_0x992c('0x2c')](_0x1290b4)[_0x992c('0x3d')](_0x567d6a);};}exports[_0x992c('0x3e')]=function(_0x450448,_0x3049d6){var _0x499a02={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x48cd33={},_0x35d1ce={'count':0x0,'rows':[]};var _0x2e49a=_[_0x992c('0x3f')](db[_0x992c('0x40')][_0x992c('0x41')],function(_0x5a5d70){return{'name':_0x5a5d70[_0x992c('0x42')],'type':_0x5a5d70[_0x992c('0x43')][_0x992c('0x44')]};});_0x48cd33[_0x992c('0x45')]=_['map'](_0x2e49a,_0x992c('0x3c'));_0x48cd33['query']=_[_0x992c('0x46')](_0x450448['query']);_0x48cd33['filters']=_[_0x992c('0x47')](_0x48cd33[_0x992c('0x45')],_0x48cd33[_0x992c('0x48')]);_0x499a02[_0x992c('0x49')]=_[_0x992c('0x47')](_0x48cd33[_0x992c('0x45')],qs['fields'](_0x450448['query'][_0x992c('0x4a')]));_0x499a02['attributes']=_0x499a02['attributes'][_0x992c('0x4b')]?_0x499a02['attributes']:_0x48cd33['model'];if(!_0x450448[_0x992c('0x48')]['hasOwnProperty'](_0x992c('0x4c'))){_0x499a02[_0x992c('0x32')]=qs['limit'](_0x450448[_0x992c('0x48')]['limit']);_0x499a02[_0x992c('0x31')]=qs[_0x992c('0x31')](_0x450448['query']['offset']);}_0x499a02[_0x992c('0x4d')]=qs[_0x992c('0x4e')](_0x450448[_0x992c('0x48')][_0x992c('0x4e')]);_0x499a02[_0x992c('0x4f')]=qs['filters'](_[_0x992c('0x50')](_0x450448['query'],_0x48cd33[_0x992c('0x51')]),_0x2e49a);if(_0x450448[_0x992c('0x48')][_0x992c('0x52')]){_0x499a02[_0x992c('0x4f')]=_[_0x992c('0x53')](_0x499a02[_0x992c('0x4f')],{'$or':_[_0x992c('0x3f')](_0x2e49a,function(_0x849d9c){if(_0x849d9c[_0x992c('0x43')]!==_0x992c('0x54')){var _0x4c93e2={};_0x4c93e2[_0x849d9c['name']]={'$like':'%'+_0x450448['query']['filter']+'%'};return _0x4c93e2;}})});}_0x499a02=_[_0x992c('0x53')]({},_0x499a02,_0x450448['options']);var _0x1c1519={'where':_0x499a02[_0x992c('0x4f')]};return db[_0x992c('0x40')]['count'](_0x1c1519)[_0x992c('0x22')](function(_0x45ee5b){_0x35d1ce[_0x992c('0x30')]=_0x45ee5b;if(_0x450448[_0x992c('0x48')][_0x992c('0x55')]){_0x499a02[_0x992c('0x56')]=[{'all':!![]}];}return db[_0x992c('0x40')][_0x992c('0x57')](_0x499a02);})[_0x992c('0x22')](function(_0x4baca6){_0x35d1ce[_0x992c('0x58')]=_0x4baca6;return _0x35d1ce;})[_0x992c('0x22')](respondWithFilteredResult(_0x3049d6,_0x499a02))[_0x992c('0x2b')](handleError(_0x3049d6,null));};exports['show']=function(_0x108bb4,_0x3d290e){var _0x498744={'raw':![],'where':{'id':_0x108bb4['params']['id']},'include':[{'model':db[_0x992c('0x59')],'as':_0x992c('0x5a')}]},_0xed3e58={};_0xed3e58[_0x992c('0x45')]=_[_0x992c('0x46')](db[_0x992c('0x40')]['rawAttributes']);_0xed3e58[_0x992c('0x48')]=_[_0x992c('0x46')](_0x108bb4[_0x992c('0x48')]);_0xed3e58[_0x992c('0x51')]=_[_0x992c('0x47')](_0xed3e58['model'],_0xed3e58[_0x992c('0x48')]);_0x498744[_0x992c('0x49')]=_['intersection'](_0xed3e58[_0x992c('0x45')],qs[_0x992c('0x4a')](_0x108bb4[_0x992c('0x48')][_0x992c('0x4a')]));_0x498744[_0x992c('0x49')]=_0x498744[_0x992c('0x49')][_0x992c('0x4b')]?_0x498744[_0x992c('0x49')]:_0xed3e58[_0x992c('0x45')];if(_0x108bb4[_0x992c('0x48')][_0x992c('0x55')]){_0x498744[_0x992c('0x56')]=[{'all':!![]}];}_0x498744=_[_0x992c('0x53')]({},_0x498744,_0x108bb4[_0x992c('0x5b')]);return db[_0x992c('0x40')][_0x992c('0x5c')](_0x498744)['then'](handleEntityNotFound(_0x3d290e,null))[_0x992c('0x22')](respondWithResult(_0x3d290e,null))['catch'](handleError(_0x3d290e,null));};exports[_0x992c('0x5d')]=function(_0x48eb6d,_0x1d67fb){return db[_0x992c('0x40')][_0x992c('0x5d')](_0x48eb6d[_0x992c('0x5e')],{})[_0x992c('0x22')](function(_0x4d12cb){var _0x5f3101=_0x48eb6d[_0x992c('0x5f')][_0x992c('0x60')]({'plain':!![]});if(!_0x5f3101)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f3101['role']===_0x992c('0x5f')){var _0x46f14c=_0x4d12cb[_0x992c('0x60')]({'plain':!![]});var _0x25a50c=_0x992c('0x39');return db[_0x992c('0x61')][_0x992c('0x5c')]({'where':{'name':_0x25a50c,'userProfileId':_0x5f3101[_0x992c('0x62')]},'raw':!![]})['then'](function(_0x2c7262){if(_0x2c7262&&_0x2c7262[_0x992c('0x63')]===0x0){return db[_0x992c('0x3a')][_0x992c('0x5d')]({'name':_0x46f14c[_0x992c('0x3c')],'resourceId':_0x46f14c['id'],'type':_0x2c7262[_0x992c('0x3c')],'sectionId':_0x2c7262['id']},{})[_0x992c('0x22')](function(){return _0x4d12cb;});}else{return _0x4d12cb;}})['catch'](function(_0x4baea6){logger['error'](_0x992c('0x64'),_0x4baea6);throw _0x4baea6;});}return _0x4d12cb;})[_0x992c('0x22')](respondWithResult(_0x1d67fb,0xc9))[_0x992c('0x2b')](handleError(_0x1d67fb,null));};exports[_0x992c('0x37')]=function(_0x53c6e3,_0xe69579){if(_0x53c6e3[_0x992c('0x5e')]['id']){delete _0x53c6e3[_0x992c('0x5e')]['id'];}return db[_0x992c('0x40')][_0x992c('0x5c')]({'where':{'id':_0x53c6e3[_0x992c('0x65')]['id']},'include':[{'model':db[_0x992c('0x59')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xe69579,null))['then'](saveUpdates(_0x53c6e3[_0x992c('0x5e')],null))[_0x992c('0x22')](respondWithResult(_0xe69579,null))['catch'](handleError(_0xe69579,null));};exports['destroy']=function(_0x1a95b6,_0x507ce4){return db[_0x992c('0x40')][_0x992c('0x5c')]({'where':{'id':_0x1a95b6[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x507ce4,null))[_0x992c('0x22')](removeEntity(_0x507ce4,null))[_0x992c('0x2b')](handleError(_0x507ce4,null));};exports[_0x992c('0x66')]=function(_0x4cea5d,_0x4c01f6){return db[_0x992c('0x40')]['describe']()['then'](respondWithResult(_0x4c01f6,null))[_0x992c('0x2b')](handleError(_0x4c01f6,null));};exports[_0x992c('0x67')]=function(_0x53491a,_0x4c1e9b,_0x224fd7){if(_0x53491a[_0x992c('0x5e')]['id']){delete _0x53491a['body']['id'];}return db[_0x992c('0x40')][_0x992c('0x5c')]({'where':{'id':_0x53491a[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x4c1e9b,null))['then'](function(_0x883ed2){if(_0x883ed2){_0x53491a[_0x992c('0x5e')][_0x992c('0x68')]=_0x883ed2['id'];return db['Disposition']['create'](_0x53491a[_0x992c('0x5e')]);}})[_0x992c('0x22')](respondWithResult(_0x4c1e9b,null))['catch'](handleError(_0x4c1e9b,null));};exports[_0x992c('0x69')]=function(_0x339e1f,_0x46ba13,_0x209585){var _0x4ea464={'raw':![],'where':{}};var _0x36c129={};var _0x211273={'count':0x0,'rows':[]};return db[_0x992c('0x40')][_0x992c('0x6a')]({'where':{'id':_0x339e1f[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x46ba13,null))['then'](function(_0x126ee9){if(_0x126ee9){_0x36c129['model']=_[_0x992c('0x46')](db[_0x992c('0x6b')][_0x992c('0x41')]);_0x36c129[_0x992c('0x48')]=_[_0x992c('0x46')](_0x339e1f[_0x992c('0x48')]);_0x36c129[_0x992c('0x51')]=_[_0x992c('0x47')](_0x36c129['model'],_0x36c129[_0x992c('0x48')]);_0x4ea464[_0x992c('0x49')]=_['intersection'](_0x36c129[_0x992c('0x45')],qs[_0x992c('0x4a')](_0x339e1f[_0x992c('0x48')][_0x992c('0x4a')]));_0x4ea464[_0x992c('0x49')]=_0x4ea464[_0x992c('0x49')][_0x992c('0x4b')]?_0x4ea464[_0x992c('0x49')]:_0x36c129[_0x992c('0x45')];if(!_0x339e1f[_0x992c('0x48')][_0x992c('0x6c')](_0x992c('0x4c'))){_0x4ea464['limit']=qs['limit'](_0x339e1f[_0x992c('0x48')][_0x992c('0x32')]);_0x4ea464[_0x992c('0x31')]=qs[_0x992c('0x31')](_0x339e1f['query'][_0x992c('0x31')]);}_0x4ea464['order']=qs[_0x992c('0x4e')](_0x339e1f[_0x992c('0x48')]['sort']);_0x4ea464[_0x992c('0x4f')]=qs[_0x992c('0x51')](_[_0x992c('0x50')](_0x339e1f[_0x992c('0x48')],_0x36c129[_0x992c('0x51')]));_0x4ea464[_0x992c('0x4f')][_0x992c('0x68')]=_0x126ee9['id'];if(_0x339e1f[_0x992c('0x48')][_0x992c('0x52')]){_0x4ea464['where']=_[_0x992c('0x53')](_0x4ea464[_0x992c('0x4f')],{'$or':_[_0x992c('0x3f')](_0x4ea464['attributes'],function(_0x583439){var _0x56ed5c={};_0x56ed5c[_0x583439]={'$like':'%'+_0x339e1f[_0x992c('0x48')][_0x992c('0x52')]+'%'};return _0x56ed5c;})});}_0x4ea464=_[_0x992c('0x53')]({},_0x4ea464,_0x339e1f[_0x992c('0x5b')]);return db[_0x992c('0x6b')]['count']({'where':_0x4ea464[_0x992c('0x4f')]})[_0x992c('0x22')](function(_0xac042a){_0x211273[_0x992c('0x30')]=_0xac042a;if(_0x339e1f['query']['includeAll']){_0x4ea464[_0x992c('0x56')]=[{'all':!![]}];}return db[_0x992c('0x6b')]['findAll'](_0x4ea464);})[_0x992c('0x22')](function(_0x67037a){_0x211273[_0x992c('0x58')]=_0x67037a;return _0x211273;});}})[_0x992c('0x22')](respondWithFilteredResult(_0x46ba13,_0x4ea464))['catch'](handleError(_0x46ba13,null));};exports[_0x992c('0x6d')]=function(_0x2476dd,_0x552cbd,_0x17d330){return db[_0x992c('0x40')][_0x992c('0x5c')]({'where':{'id':_0x2476dd[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x552cbd,null))[_0x992c('0x22')](function(_0x752d0c){if(_0x752d0c){return _0x752d0c[_0x992c('0x6d')](_0x2476dd[_0x992c('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x552cbd,null))[_0x992c('0x2b')](handleError(_0x552cbd,null));};exports[_0x992c('0x6e')]=function(_0x5ecb68,_0x174c57,_0xeb85b){if(_0x5ecb68[_0x992c('0x5e')]['id']){delete _0x5ecb68[_0x992c('0x5e')]['id'];}return db['SmsAccount'][_0x992c('0x5c')]({'where':{'id':_0x5ecb68[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x174c57,null))['then'](function(_0x5a903b){if(_0x5a903b){_0x5ecb68[_0x992c('0x5e')][_0x992c('0x68')]=_0x5a903b['id'];return db[_0x992c('0x6f')]['create'](_0x5ecb68[_0x992c('0x5e')]);}})[_0x992c('0x22')](respondWithResult(_0x174c57,null))[_0x992c('0x2b')](handleError(_0x174c57,null));};exports[_0x992c('0x70')]=function(_0x534247,_0x15bb1c,_0x423a33){var _0x3e0f52={'raw':![],'where':{}};var _0x419bcd={};var _0x57b268={'count':0x0,'rows':[]};return db[_0x992c('0x40')][_0x992c('0x6a')]({'where':{'id':_0x534247[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x15bb1c,null))['then'](function(_0xf2f84d){if(_0xf2f84d){_0x419bcd[_0x992c('0x45')]=_[_0x992c('0x46')](db[_0x992c('0x6f')][_0x992c('0x41')]);_0x419bcd[_0x992c('0x48')]=_[_0x992c('0x46')](_0x534247[_0x992c('0x48')]);_0x419bcd[_0x992c('0x51')]=_[_0x992c('0x47')](_0x419bcd[_0x992c('0x45')],_0x419bcd[_0x992c('0x48')]);_0x3e0f52[_0x992c('0x49')]=_['intersection'](_0x419bcd[_0x992c('0x45')],qs[_0x992c('0x4a')](_0x534247[_0x992c('0x48')][_0x992c('0x4a')]));_0x3e0f52[_0x992c('0x49')]=_0x3e0f52[_0x992c('0x49')][_0x992c('0x4b')]?_0x3e0f52[_0x992c('0x49')]:_0x419bcd[_0x992c('0x45')];if(!_0x534247[_0x992c('0x48')]['hasOwnProperty']('nolimit')){_0x3e0f52['limit']=qs[_0x992c('0x32')](_0x534247[_0x992c('0x48')][_0x992c('0x32')]);_0x3e0f52['offset']=qs[_0x992c('0x31')](_0x534247['query'][_0x992c('0x31')]);}_0x3e0f52[_0x992c('0x4d')]=qs['sort'](_0x534247[_0x992c('0x48')]['sort']);_0x3e0f52[_0x992c('0x4f')]=qs[_0x992c('0x51')](_[_0x992c('0x50')](_0x534247[_0x992c('0x48')],_0x419bcd['filters']));_0x3e0f52[_0x992c('0x4f')][_0x992c('0x68')]=_0xf2f84d['id'];if(_0x534247[_0x992c('0x48')][_0x992c('0x52')]){_0x3e0f52[_0x992c('0x4f')]=_[_0x992c('0x53')](_0x3e0f52[_0x992c('0x4f')],{'$or':_[_0x992c('0x3f')](_0x3e0f52[_0x992c('0x49')],function(_0x32419c){var _0x3d0253={};_0x3d0253[_0x32419c]={'$like':'%'+_0x534247[_0x992c('0x48')][_0x992c('0x52')]+'%'};return _0x3d0253;})});}_0x3e0f52=_[_0x992c('0x53')]({},_0x3e0f52,_0x534247[_0x992c('0x5b')]);return db[_0x992c('0x6f')][_0x992c('0x30')]({'where':_0x3e0f52[_0x992c('0x4f')]})[_0x992c('0x22')](function(_0x2625a4){_0x57b268['count']=_0x2625a4;if(_0x534247[_0x992c('0x48')][_0x992c('0x55')]){_0x3e0f52[_0x992c('0x56')]=[{'all':!![]}];}return db[_0x992c('0x6f')][_0x992c('0x57')](_0x3e0f52);})[_0x992c('0x22')](function(_0xb52d25){_0x57b268[_0x992c('0x58')]=_0xb52d25;return _0x57b268;});}})['then'](respondWithFilteredResult(_0x15bb1c,_0x3e0f52))[_0x992c('0x2b')](handleError(_0x15bb1c,null));};exports[_0x992c('0x71')]=function(_0x344efe,_0x2896d9,_0x2f2fab){return db[_0x992c('0x40')][_0x992c('0x5c')]({'where':{'id':_0x344efe['params']['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x2896d9,null))['then'](function(_0x11df7b){if(_0x11df7b){return _0x11df7b[_0x992c('0x71')](_0x344efe[_0x992c('0x48')][_0x992c('0x72')]);}})['then'](respondWithStatusCode(_0x2896d9,null))[_0x992c('0x2b')](handleError(_0x2896d9,null));};exports[_0x992c('0x73')]=function(_0x29dc2f,_0x138843,_0x21f96b){var _0x5f1b63={'channel':_0x992c('0x74')};var _0x10c928=[];var _0x375016=[];var _0x5544d8={};return db['SmsAccount'][_0x992c('0x5c')]({'where':{'id':_0x29dc2f[_0x992c('0x65')]['id']},'include':[{'model':db[_0x992c('0x75')],'as':_0x992c('0x76')}]})[_0x992c('0x22')](handleEntityNotFound(_0x138843,null))[_0x992c('0x22')](function(_0x12a5d0){_0x5f1b63[_0x992c('0x77')]=_0x12a5d0;_0x5f1b63[_0x992c('0x78')]=_[_0x992c('0x79')](_0x12a5d0[_0x992c('0x76')],['priority'],[_0x992c('0x7a')]);if(_0x5f1b63[_0x992c('0x77')][_0x992c('0x76')]){delete _0x5f1b63[_0x992c('0x77')]['Applications'];}return db['CmContact'][_0x992c('0x66')]();})[_0x992c('0x22')](function(_0xb93f83){if(!_0xb93f83){throw new db[(_0x992c('0x7b'))][(_0x992c('0x7c'))](_0x992c('0x7d'));}_0x10c928=_['difference'](_[_0x992c('0x46')](_0xb93f83),['createdAt','updatedAt']);_0x375016=_[_0x992c('0x7e')](_[_0x992c('0x46')](_0xb93f83),['createdAt',_0x992c('0x7f'),_0x992c('0x80'),_0x992c('0x81')]);_0x5f1b63[_0x992c('0x5e')]={'mapKey':_0x992c('0x82')};if(_0x5f1b63[_0x992c('0x77')][_0x992c('0x43')]){switch(_0x5f1b63['account']['type']){case'twilio':_0x5f1b63['body'][_0x992c('0x83')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x84')];_0x5f1b63[_0x992c('0x5e')][_0x992c('0x5e')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x85')];_0x5f1b63[_0x992c('0x5e')][_0x992c('0x86')]=_0x29dc2f['body']['MessageSid'];break;case'skebby':_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')]='+'+_0x29dc2f['body']['sender'];_0x5f1b63['body'][_0x992c('0x5e')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x87')];break;case _0x992c('0x88'):_0x5f1b63[_0x992c('0x5e')]['from']=_0x29dc2f['body'][_0x992c('0x83')];_0x5f1b63[_0x992c('0x5e')][_0x992c('0x5e')]=_0x29dc2f[_0x992c('0x5e')]['message'];break;case'clicksend':_0x5f1b63[_0x992c('0x5e')]['from']=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x83')];_0x5f1b63[_0x992c('0x5e')]['body']=_0x29dc2f[_0x992c('0x5e')]['body'];_0x5f1b63[_0x992c('0x5e')][_0x992c('0x86')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x89')];break;case _0x992c('0x8a'):_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x84')];_0x5f1b63[_0x992c('0x5e')][_0x992c('0x5e')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x8b')];_0x5f1b63[_0x992c('0x5e')]['messageId']=_0x29dc2f['body'][_0x992c('0x8c')];break;case _0x992c('0x8d'):_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')]='+'+_0x29dc2f[_0x992c('0x5e')][_0x992c('0x8e')][0x0][_0x992c('0x83')];_0x5f1b63['body']['body']=_0x29dc2f[_0x992c('0x5e')]['results'][0x0][_0x992c('0x87')];_0x5f1b63['body'][_0x992c('0x86')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x8e')][0x0]['messageId'];break;case _0x992c('0x8f'):_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x90')];_0x5f1b63[_0x992c('0x5e')]['body']=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x91')][_0x992c('0x28')];break;case'clickatell':_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x92')];_0x5f1b63['body'][_0x992c('0x5e')]=_0x29dc2f['body'][_0x992c('0x87')];_0x5f1b63['body'][_0x992c('0x86')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x93')];break;case _0x992c('0x94'):_0x5f1b63['body']['messageId']=_0x29dc2f[_0x992c('0x5e')][0x0][_0x992c('0x28')]['id'];_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')]=_0x29dc2f[_0x992c('0x5e')][0x0][_0x992c('0x28')][_0x992c('0x83')];_0x5f1b63[_0x992c('0x5e')]['body']=_0x29dc2f['body'][0x0][_0x992c('0x28')][_0x992c('0x87')];break;case _0x992c('0x95'):_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')]=_0x29dc2f[_0x992c('0x5e')][_0x992c('0x83')];_0x5f1b63[_0x992c('0x5e')][_0x992c('0x5e')]=_0x29dc2f['body']['message'];_0x5f1b63[_0x992c('0x5e')][_0x992c('0x86')]=_0x29dc2f[_0x992c('0x5e')]['refid'];break;}}if(_0x5f1b63['body']['id']){delete _0x5f1b63[_0x992c('0x5e')]['id'];}if(_[_0x992c('0x96')](_0x5f1b63['body']['from'])){throw new db['Sequelize'][(_0x992c('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x992c('0x96')](_0x5f1b63[_0x992c('0x5e')]['body'])||_0x5f1b63['body']['body']===''){throw new db['Sequelize'][(_0x992c('0x7c'))](_0x992c('0x97'));}if(_['isNil'](_0x5f1b63[_0x992c('0x5e')]['mapKey'])){throw new db[(_0x992c('0x7b'))][(_0x992c('0x7c'))](_0x992c('0x98')+_0x375016);}if(!_[_0x992c('0x99')](_0x375016,_0x5f1b63[_0x992c('0x5e')][_0x992c('0x9a')])){throw new db['Sequelize'][(_0x992c('0x7c'))](_0x992c('0x9b')+_0x375016);}_0x5544d8[_0x5f1b63[_0x992c('0x5e')][_0x992c('0x9a')]]=_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')];return db[_0x992c('0x9c')][_0x992c('0x5c')]({'where':{'id':_0x5f1b63['account']['ListId']},'include':[{'model':db['CmContact'],'as':_0x992c('0x9d'),'where':_0x5544d8,'limit':0x1,'order':[[_0x992c('0x7f'),_0x992c('0x9e')]]}]});})['then'](handleEntityNotFound(_0x138843,null))[_0x992c('0x22')](function(_0x43fbac){if(_0x43fbac){_0x5f1b63[_0x992c('0x9f')]=_[_0x992c('0xa0')](_0x43fbac,['Contacts']);if(_0x43fbac[_0x992c('0x9d')]['length']){return _0x43fbac['Contacts'][0x0];}var _0x1abc34=_[_0x992c('0x1c')](_0x5f1b63[_0x992c('0x5e')],{'firstName':_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')],'ListId':_0x43fbac['id']});_0x1abc34[_0x5f1b63['body'][_0x992c('0x9a')]]=_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')];return db[_0x992c('0xa1')][_0x992c('0x5d')](_0x1abc34,{'fields':_0x10c928,'raw':!![]});}})[_0x992c('0x22')](handleEntityNotFound(_0x138843,null))[_0x992c('0x22')](function(_0x34874d){if(_0x34874d){_0x5f1b63[_0x992c('0xa2')]=_0x34874d;var _0xbab8f5={'ContactId':_0x34874d['id'],'phone':_0x5f1b63['body']['from'],'SmsAccountId':_0x29dc2f[_0x992c('0x65')]['id']};var _0x2743c6={'ContactId':_0x34874d['id'],'SmsAccountId':_0x29dc2f[_0x992c('0x65')]['id'],'closed':![]};return db[_0x992c('0xa3')][_0x992c('0x5c')]({'where':_0x2743c6})[_0x992c('0x22')](function(_0x58a318){if(_0x58a318){return[_0x58a318,![]];}return db[_0x992c('0xa3')][_0x992c('0x5d')](_0xbab8f5)[_0x992c('0x22')](function(_0x2642f4){return[_0x2642f4,!![]];});});}})[_0x992c('0xa4')](function(_0xa00873,_0x3b1795){_0x5f1b63['interaction']=_0xa00873['get']({'plain':!![]});_0x5f1b63[_0x992c('0xa5')]['created']=![];if(_0x3b1795){if(_0x5f1b63[_0x992c('0x77')][_0x992c('0xa6')]){_0x5f1b63['applications'][_0x992c('0xa7')]({'id':0x0,'priority':_0x5f1b63[_0x992c('0x78')]['length']+0x1,'app':_0x992c('0xa8'),'appdata':'unmanaged','interval':_0x992c('0xa9')});}_0x5f1b63[_0x992c('0xa5')][_0x992c('0xaa')]=!![];}return db[_0x992c('0xab')][_0x992c('0x5d')]({'phone':_0x5f1b63[_0x992c('0x5e')][_0x992c('0x83')],'messageId':_0x5f1b63[_0x992c('0x5e')][_0x992c('0x86')],'body':_0x5f1b63[_0x992c('0x5e')][_0x992c('0x5e')],'SmsAccountId':_0x29dc2f[_0x992c('0x65')]['id'],'SmsInteractionId':_0xa00873['id'],'direction':'in','ContactId':_0xa00873[_0x992c('0xac')],'AttachmentId':_0x5f1b63[_0x992c('0x5e')][_0x992c('0xad')]});})['then'](function(_0x48d5cf){_0x5f1b63['message']=_0x48d5cf;if(_0x5f1b63['interaction']['UserId']){return db['User'][_0x992c('0x5c')]({'attributes':['id',_0x992c('0x3c')],'where':{'id':_0x5f1b63[_0x992c('0xa5')][_0x992c('0xae')]}})[_0x992c('0x22')](function(_0x237ec7){if(_0x237ec7){_0x5f1b63[_0x992c('0x78')]['unshift']({'id':0x0,'priority':0x0,'app':_0x992c('0xaf'),'appdata':_0x237ec7[_0x992c('0x3c')]+','+(_0x5f1b63['account']['waitForTheAssignedAgent']||0xa),'interval':_0x992c('0xa9')});}return respondWithRpcPromise(_0x992c('0xb0'),_0x992c('0xb1'),_0x5f1b63);});}return respondWithRpcPromise('Start',_0x992c('0xb1'),_0x5f1b63);})[_0x992c('0x22')](function(_0x2440fb){if(_0x2440fb){var _0xb7183e=0xc8;var _0x2c6372=_0x992c('0xb2');logger[_0x992c('0x29')](_0x992c('0xb3'),_0x2c6372,_0xb7183e,_0x992c('0xb4'));logger[_0x992c('0x24')](_0x992c('0xb5'),_0x2c6372,_0xb7183e,_0x992c('0xb4'),JSON['stringify'](_0x2440fb));if(_0x5f1b63[_0x992c('0x77')]['type']===_0x992c('0xb6')){return _0x138843[_0x992c('0x2c')](_0xb7183e)[_0x992c('0x33')](_0x992c('0xb7'),'text/xml')['send']('\x0a');}else{return _0x138843[_0x992c('0x2c')](_0xb7183e)['json'](_0x2440fb);}}})[_0x992c('0x2b')](handleError(_0x138843,null));};exports[_0x992c('0xb8')]=function(_0x783618,_0x2e76f8,_0x3fa5d0){return db[_0x992c('0x40')][_0x992c('0x6a')]({'where':{'id':_0x783618[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x2e76f8,null))[_0x992c('0x22')](function(_0x149664){if(_0x149664){return db[_0x992c('0xb9')][_0x992c('0xba')](function(_0x4a3893){return db[_0x992c('0x75')][_0x992c('0x38')]({'where':{'SmsAccountId':_0x783618[_0x992c('0x65')]['id']},'transaction':_0x4a3893})[_0x992c('0x22')](function(_0x136099){var _0x22b575=_[_0x992c('0x3f')](_0x783618['body'],function(_0x557d6a){_0x557d6a[_0x992c('0x68')]=_0x783618[_0x992c('0x65')]['id'];return _0x557d6a;});return db[_0x992c('0x75')][_0x992c('0xbb')](_0x22b575,{'transaction':_0x4a3893});});})['then'](function(){return db[_0x992c('0x75')]['findAndCountAll']({'where':{'SmsAccountId':_0x783618[_0x992c('0x65')]['id']},'order':_0x992c('0xbc')});});}})[_0x992c('0x22')](respondWithResult(_0x2e76f8,null))[_0x992c('0x2b')](handleError(_0x2e76f8,null));};exports[_0x992c('0xbd')]=function(_0x4d1059,_0x95c4a,_0x1598f6){var _0x4e8890={};var _0x3c050f={};var _0x37913c;var _0x39efbb;return db[_0x992c('0x40')][_0x992c('0x6a')]({'where':{'id':_0x4d1059['params']['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x95c4a,null))['then'](function(_0x55a30e){if(_0x55a30e){_0x37913c=_0x55a30e;_0x3c050f[_0x992c('0x45')]=_[_0x992c('0x46')](db[_0x992c('0x75')]['rawAttributes']);_0x3c050f[_0x992c('0x48')]=_[_0x992c('0x46')](_0x4d1059[_0x992c('0x48')]);_0x3c050f[_0x992c('0x51')]=_[_0x992c('0x47')](_0x3c050f[_0x992c('0x45')],_0x3c050f[_0x992c('0x48')]);_0x4e8890['attributes']=_[_0x992c('0x47')](_0x3c050f[_0x992c('0x45')],qs[_0x992c('0x4a')](_0x4d1059[_0x992c('0x48')][_0x992c('0x4a')]));_0x4e8890['attributes']=_0x4e8890['attributes']['length']?_0x4e8890[_0x992c('0x49')]:_0x3c050f[_0x992c('0x45')];_0x4e8890[_0x992c('0x4d')]=qs[_0x992c('0x4e')](_0x4d1059[_0x992c('0x48')]['sort']);_0x4e8890['where']=qs[_0x992c('0x51')](_['pick'](_0x4d1059['query'],_0x3c050f[_0x992c('0x51')]));if(_0x4d1059['query'][_0x992c('0x52')]){_0x4e8890[_0x992c('0x4f')]=_[_0x992c('0x53')](_0x4e8890[_0x992c('0x4f')],{'$or':_[_0x992c('0x3f')](_0x4e8890['attributes'],function(_0x160b08){var _0x5a6ef7={};_0x5a6ef7[_0x160b08]={'$like':'%'+_0x4d1059[_0x992c('0x48')]['filter']+'%'};return _0x5a6ef7;})});}_0x4e8890=_[_0x992c('0x53')]({},_0x4e8890,_0x4d1059['options']);return _0x37913c[_0x992c('0xbd')](_0x4e8890);}})[_0x992c('0x22')](function(_0x1c39e5){if(_0x1c39e5){_0x39efbb=_0x1c39e5[_0x992c('0x4b')];if(!_0x4d1059['query'][_0x992c('0x6c')]('nolimit')){_0x4e8890['limit']=qs[_0x992c('0x32')](_0x4d1059[_0x992c('0x48')]['limit']);_0x4e8890[_0x992c('0x31')]=qs[_0x992c('0x31')](_0x4d1059[_0x992c('0x48')][_0x992c('0x31')]);}return _0x37913c[_0x992c('0xbd')](_0x4e8890);}})[_0x992c('0x22')](function(_0xeddd2d){if(_0xeddd2d){return _0xeddd2d?{'count':_0x39efbb,'rows':_0xeddd2d}:null;}})[_0x992c('0x22')](respondWithResult(_0x95c4a,null))[_0x992c('0x2b')](handleError(_0x95c4a,null));};exports[_0x992c('0xbe')]=function(_0x594531,_0xc9d96c,_0x39783a){var _0x16517b={'raw':![],'where':{}};var _0x3cf722={};var _0x1561b9={'count':0x0,'rows':[]};return db['SmsAccount'][_0x992c('0x6a')]({'where':{'id':_0x594531['params']['id']}})[_0x992c('0x22')](handleEntityNotFound(_0xc9d96c,null))[_0x992c('0x22')](function(_0x54e3c2){if(_0x54e3c2){_0x3cf722[_0x992c('0x45')]=_['keys'](db['SmsInteraction'][_0x992c('0x41')]);_0x3cf722[_0x992c('0x48')]=_['keys'](_0x594531[_0x992c('0x48')]);_0x3cf722[_0x992c('0x51')]=_['intersection'](_0x3cf722[_0x992c('0x45')],_0x3cf722['query']);_0x16517b[_0x992c('0x49')]=_[_0x992c('0x47')](_0x3cf722[_0x992c('0x45')],qs[_0x992c('0x4a')](_0x594531[_0x992c('0x48')]['fields']));_0x16517b[_0x992c('0x49')]=_0x16517b[_0x992c('0x49')]['length']?_0x16517b[_0x992c('0x49')]:_0x3cf722[_0x992c('0x45')];if(!_0x594531['query'][_0x992c('0x6c')](_0x992c('0x4c'))){_0x16517b[_0x992c('0x32')]=qs[_0x992c('0x32')](_0x594531[_0x992c('0x48')][_0x992c('0x32')]);_0x16517b[_0x992c('0x31')]=qs[_0x992c('0x31')](_0x594531[_0x992c('0x48')][_0x992c('0x31')]);}_0x16517b[_0x992c('0x4d')]=qs[_0x992c('0x4e')](_0x594531[_0x992c('0x48')][_0x992c('0x4e')]);_0x16517b[_0x992c('0x4f')]=qs[_0x992c('0x51')](_[_0x992c('0x50')](_0x594531[_0x992c('0x48')],_0x3cf722[_0x992c('0x51')]));_0x16517b[_0x992c('0x4f')][_0x992c('0x68')]=_0x54e3c2['id'];if(_0x594531['query']['filter']){_0x16517b[_0x992c('0x4f')]=_[_0x992c('0x53')](_0x16517b['where'],{'$or':_[_0x992c('0x3f')](_0x16517b['attributes'],function(_0x1e7236){var _0x4f3eff={};_0x4f3eff[_0x1e7236]={'$like':'%'+_0x594531['query']['filter']+'%'};return _0x4f3eff;})});}_0x16517b=_['merge']({},_0x16517b,_0x594531[_0x992c('0x5b')]);return db[_0x992c('0xa3')][_0x992c('0x30')]({'where':_0x16517b['where']})[_0x992c('0x22')](function(_0x7ea419){_0x1561b9[_0x992c('0x30')]=_0x7ea419;if(_0x594531[_0x992c('0x48')][_0x992c('0x55')]){_0x16517b[_0x992c('0x56')]=[{'model':db[_0x992c('0xa1')],'as':'Contact','required':![]},{'model':db[_0x992c('0xbf')],'as':_0x992c('0xc0'),'attributes':[_0x992c('0x3c'),'fullname',_0x992c('0xc1')],'required':![]},{'model':db[_0x992c('0xc2')],'as':'Tags','attributes':['id','name',_0x992c('0xc3')],'where':_0x594531['query']['tag']?{'id':_0x594531['query'][_0x992c('0xc4')]}:undefined,'required':_0x594531[_0x992c('0x48')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x992c('0x57')](_0x16517b);})[_0x992c('0x22')](function(_0x4701df){_0x1561b9[_0x992c('0x58')]=_0x4701df;return _0x1561b9;});}})[_0x992c('0x22')](respondWithFilteredResult(_0xc9d96c,_0x16517b))['catch'](handleError(_0xc9d96c,null));};exports[_0x992c('0x3d')]=function(_0x458317,_0x357615,_0x3f6bb4){var _0x2bf9fe,_0x291771,_0x255902;if(_[_0x992c('0x96')](_0x458317[_0x992c('0x5e')]['body'])||_0x458317['body'][_0x992c('0x5e')]===''){throw new db[(_0x992c('0x7b'))][(_0x992c('0x7c'))](_0x992c('0x97'));}if(_[_0x992c('0x96')](_0x458317[_0x992c('0x5e')]['to'])){throw new db[(_0x992c('0x7b'))][(_0x992c('0x7c'))](_0x992c('0xc5'));}_0x2bf9fe=_0x458317['body']['to'];return db[_0x992c('0x40')][_0x992c('0x5c')]({'where':{'id':_0x458317[_0x992c('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x992c('0xc6'),'include':[{'model':db[_0x992c('0xa1')],'as':'Contacts','where':{'mobile':_0x2bf9fe},'limit':0x1,'order':[[_0x992c('0x7f'),_0x992c('0x9e')]]}]}]})[_0x992c('0x22')](handleEntityNotFound(_0x357615,null))[_0x992c('0x22')](function(_0x1d3751){if(_0x1d3751&&_0x1d3751[_0x992c('0xc6')]){_0x291771=_0x1d3751[_0x992c('0x60')]({'plain':!![]});if(_0x291771[_0x992c('0xc6')]&&_0x291771[_0x992c('0xc6')]['Contacts'][_0x992c('0x4b')]){return _0x291771[_0x992c('0xc6')][_0x992c('0x9d')][0x0];}return db[_0x992c('0xa1')]['create'](_['defaults'](_0x458317['body'],{'firstName':_0x2bf9fe,'mobile':_0x2bf9fe,'phone':_0x2bf9fe,'ListId':_0x291771['ListId']}));}})['then'](handleEntityNotFound(_0x357615,null))['then'](function(_0x3b27b4){if(_0x3b27b4){_0x255902=_0x3b27b4;return db['SmsInteraction'][_0x992c('0x5c')]({'where':{'ContactId':_0x255902['id'],'closed':![],'SmsAccountId':_0x291771['id']}})[_0x992c('0x22')](function(_0x178635){if(_0x178635){return[_0x178635,![]];}return db[_0x992c('0xa3')][_0x992c('0x5d')]({'UserId':_0x458317['user']['id'],'ContactId':_0x255902['id'],'SmsAccountId':_0x291771['id'],'phone':_0x2bf9fe,'firstMsgDirection':_0x992c('0xc7'),'Messages':[_[_0x992c('0x53')](_0x458317['body'],{'read':![],'body':_0x458317[_0x992c('0x5e')]['body'],'phone':_0x2bf9fe,'SmsAccountId':_0x291771['id'],'UserId':_0x458317[_0x992c('0x5f')]['id'],'ContactId':_0x255902['id']})]},{'include':[{'model':db[_0x992c('0xab')],'as':'Messages'}]})[_0x992c('0x22')](function(_0x4876c3){return[_0x4876c3,!![]];});});}})[_0x992c('0xa4')](function(_0x3052b3,_0x2badf5){if(_0x2badf5){return _0x3052b3;}return db[_0x992c('0xab')][_0x992c('0x5d')](_['merge'](_0x458317['body'],{'read':![],'body':_0x458317[_0x992c('0x5e')][_0x992c('0x5e')],'phone':_0x2bf9fe,'SmsAccountId':_0x291771['id'],'SmsInteractionId':_0x3052b3['id'],'UserId':_0x458317[_0x992c('0x5f')]['id'],'ContactId':_0x255902['id']}))['then'](function(_0x1ed421){_0x3052b3[_0x992c('0xc8')][_0x992c('0xc9')]=[];_0x3052b3['dataValues'][_0x992c('0xc9')][_0x992c('0xa7')](_0x1ed421[_0x992c('0xc8')]);return _0x3052b3;});})[_0x992c('0x22')](respondWithResult(_0x357615,null))[_0x992c('0x2b')](handleError(_0x357615,null));};exports[_0x992c('0x2c')]=function(_0x70bde0,_0x16d596,_0x43015d){if(_0x70bde0[_0x992c('0x5e')]['id']){delete _0x70bde0[_0x992c('0x5e')]['id'];}var _0x415568,_0x3e007e,_0x441caf;return db[_0x992c('0x40')]['find']({'where':{'id':_0x70bde0[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x16d596,null))[_0x992c('0x22')](function(_0x567fb3){if(_0x567fb3){_0x441caf=_0x567fb3;logger[_0x992c('0x24')](_0x992c('0xb3'),_0x992c('0x2c'),_0x992c('0xca'),_0x567fb3[_0x992c('0x43')],util[_0x992c('0xcb')](_0x70bde0[_0x992c('0x5e')],{'showHidden':![],'depth':null}));switch(_0x567fb3[_0x992c('0x43')]){case _0x992c('0xcc'):if(_0x70bde0[_0x992c('0x5e')][_0x992c('0xcd')]&&_0x70bde0[_0x992c('0x5e')][_0x992c('0x2c')]){_0x3e007e=_0x70bde0[_0x992c('0x5e')][_0x992c('0x2c')];return db[_0x992c('0xab')][_0x992c('0x5c')]({'where':{'messageId':_0x70bde0[_0x992c('0x5e')][_0x992c('0xcd')]}});}break;case'connectel':if(_0x70bde0[_0x992c('0x5e')][_0x992c('0xce')]&&_0x70bde0['body']['statusInt']){_0x3e007e=_0x70bde0[_0x992c('0x5e')][_0x992c('0xcf')];return db[_0x992c('0xab')]['find']({'where':{'messageId':_0x70bde0[_0x992c('0x5e')][_0x992c('0xce')]}});}break;case _0x992c('0xd0'):if(_0x70bde0[_0x992c('0x5e')][_0x992c('0x89')]&&_0x70bde0[_0x992c('0x5e')]['status_code']){_0x3e007e=_0x70bde0[_0x992c('0x5e')][_0x992c('0xd1')];return db[_0x992c('0xab')][_0x992c('0x5c')]({'where':{'messageId':_0x70bde0[_0x992c('0x5e')][_0x992c('0x89')]}});}break;case _0x992c('0x8d'):var _0x39a741=_0x70bde0[_0x992c('0x5e')][_0x992c('0x8e')][0x0];if(_0x39a741['messageId']&&_0x39a741[_0x992c('0x2c')][_0x992c('0xd2')]==='DELIVERED'){_0x3e007e=_0x39a741[_0x992c('0x2c')]['groupName'];return db[_0x992c('0xab')][_0x992c('0x5c')]({'where':{'messageId':_0x39a741[_0x992c('0x86')]}});}break;case'clickatell':if(_0x70bde0[_0x992c('0x5e')][_0x992c('0x86')]&&_0x70bde0[_0x992c('0x5e')][_0x992c('0x2c')]){_0x3e007e=_0x70bde0[_0x992c('0x5e')][_0x992c('0x2c')];return db[_0x992c('0xab')][_0x992c('0x5c')]({'where':{'messageId':_0x70bde0['body'][_0x992c('0x86')]}});}break;case _0x992c('0x94'):if(_0x70bde0[_0x992c('0x5e')][0x0]['message']['id']){_0x3e007e=_0x70bde0[_0x992c('0x5e')][0x0][_0x992c('0x43')];return db[_0x992c('0xab')][_0x992c('0x5c')]({'where':{'messageId':_0x70bde0[_0x992c('0x5e')][0x0][_0x992c('0x28')]['id']}});}break;case'intelepeer':if(_0x70bde0['body']['redif']&&_0x70bde0[_0x992c('0x5e')][_0x992c('0x2c')]){_0x3e007e=_0x70bde0[_0x992c('0x5e')][_0x992c('0x2c')];return db['SmsMessage'][_0x992c('0x5c')]({'where':{'messageId':_0x70bde0['body'][_0x992c('0xd3')]}});}break;}}})[_0x992c('0x22')](handleEntityNotFound(_0x16d596,null))['then'](function(_0x1bab9e){if(_0x1bab9e){_0x415568=_0x1bab9e;switch(_0x441caf[_0x992c('0x43')]){case _0x992c('0xcc'):if(_0x3e007e===_0x992c('0xd4')){return _0x415568[_0x992c('0x37')]({'read':!![]});}else{logger['error'](_0x992c('0xb3'),_0x992c('0x2c'),_0x992c('0xcc'),util['inspect'](_0x70bde0[_0x992c('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3e007e==='1'){return _0x415568[_0x992c('0x37')]({'read':!![]});}else{logger[_0x992c('0x26')](_0x992c('0xb3'),'status','skebby',util[_0x992c('0xcb')](_0x70bde0[_0x992c('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x70bde0[_0x992c('0x5e')][_0x992c('0xd5')]&&_0x3e007e>=0xc8&&_0x3e007e<=0xce){return _0x415568[_0x992c('0x37')]({'read':!![]});}else{logger[_0x992c('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x992c('0x2c'),_0x992c('0xd0'),util[_0x992c('0xcb')](_0x70bde0[_0x992c('0x5e')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x58ec01=_0x70bde0[_0x992c('0x5e')][_0x992c('0x8e')][0x0];if(_0x58ec01[_0x992c('0x2c')][_0x992c('0xd2')]==='DELIVERED'){return _0x415568['update']({'read':!![]});}else{logger[_0x992c('0x26')](_0x992c('0xb3'),_0x992c('0x2c'),_0x992c('0x8d'),util[_0x992c('0xcb')](_0x70bde0['body'],{'showHidden':![],'depth':null}));}break;case _0x992c('0xd6'):if(_0x3e007e=='DELIVERED_TO_GATEWAY'||_0x3e007e==_0x992c('0xd7')){return _0x415568[_0x992c('0x37')]({'read':!![]});}else{logger['error'](_0x992c('0xb3'),'status','clickatell',util[_0x992c('0xcb')](_0x70bde0[_0x992c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x992c('0x94'):if(_0x3e007e==_0x992c('0xd8')){return _0x415568['update']({'read':!![]});}else{logger[_0x992c('0x26')](_0x992c('0xb3'),_0x992c('0x2c'),_0x992c('0x94'),util[_0x992c('0xcb')](_0x70bde0[_0x992c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x992c('0x95'):if(_0x3e007e==='DELIVRD'||_0x3e007e===_0x992c('0xd9')){return _0x415568[_0x992c('0x37')]({'read':!![]});}else{logger[_0x992c('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x992c('0x2c'),'intelepeer',util['inspect'](_0x70bde0[_0x992c('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x415568;}})[_0x992c('0x22')](respondWithResult(_0x16d596,null))[_0x992c('0x2b')](handleError(_0x16d596,null));};exports[_0x992c('0xda')]=function(_0x41e1ad,_0x540e89,_0x45edf7){var _0x3dbce7,_0x262daf,_0x381c4d;return db['SmsAccount']['find']({'where':{'id':_0x41e1ad[_0x992c('0x65')]['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x540e89,null))[_0x992c('0x22')](function(_0x24edee){if(_0x24edee){_0x381c4d=_0x24edee;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x992c('0x2c'),'received\x20delivery\x20report\x20from',_0x24edee[_0x992c('0x43')],util[_0x992c('0xcb')](_0x41e1ad[_0x992c('0x48')],{'showHidden':![],'depth':null}));switch(_0x24edee['type']){case _0x992c('0x8f'):if(_0x41e1ad[_0x992c('0x48')]['message-id']&&_0x41e1ad['query'][_0x992c('0xdb')]){_0x262daf=_0x41e1ad[_0x992c('0x48')][_0x992c('0xdb')];return db[_0x992c('0xab')][_0x992c('0x5c')]({'where':{'messageId':_0x41e1ad[_0x992c('0x48')][_0x992c('0xdc')]}});}break;}}})[_0x992c('0x22')](handleEntityNotFound(_0x540e89,null))[_0x992c('0x22')](function(_0x5c5ec7){if(_0x5c5ec7){_0x3dbce7=_0x5c5ec7;switch(_0x381c4d[_0x992c('0x43')]){case _0x992c('0x8f'):if(_0x262daf==='2'||_0x262daf==='6'){return _0x3dbce7[_0x992c('0x37')]({'read':!![]});}else{logger[_0x992c('0x26')](_0x992c('0xb3'),_0x992c('0x2c'),_0x992c('0x8f'),util['inspect'](_0x41e1ad[_0x992c('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x3dbce7;}})[_0x992c('0x22')](respondWithResult(_0x540e89,null))['catch'](handleError(_0x540e89,null));};exports[_0x992c('0xdd')]=function(_0x2077de,_0x68e14,_0xe54a21){return db[_0x992c('0x40')][_0x992c('0x5c')]({'where':{'id':_0x2077de[_0x992c('0x65')]['id']}})['then'](handleEntityNotFound(_0x68e14,null))[_0x992c('0x22')](function(_0xcfa3dc){if(_0xcfa3dc){return _0xcfa3dc[_0x992c('0xdd')](_0x2077de[_0x992c('0x5e')][_0x992c('0x72')],_['omit'](_0x2077de[_0x992c('0x5e')],[_0x992c('0x72'),'id'])||{})[_0x992c('0xa4')](function(_0x47a268){for(var _0x22371d=0x0;_0x22371d<_0x2077de[_0x992c('0x5e')][_0x992c('0x72')]['length'];_0x22371d+=0x1){socket[_0x992c('0xde')](_0x992c('0xdf'),{'UserId':Number(_0x2077de[_0x992c('0x5e')][_0x992c('0x72')][_0x22371d]),'SmsAccountId':Number(_0x2077de['params']['id'])});}return _0x47a268;});}})[_0x992c('0x22')](respondWithResult(_0x68e14,null))[_0x992c('0x2b')](handleError(_0x68e14,null));};exports[_0x992c('0xe0')]=function(_0x3bf173,_0x300a8f,_0x3b4da5){return db[_0x992c('0x40')][_0x992c('0x5c')]({'where':{'id':_0x3bf173['params']['id']}})['then'](handleEntityNotFound(_0x300a8f,null))[_0x992c('0x22')](function(_0x41ae49){if(_0x41ae49){return _0x41ae49['removeAgents'](_0x3bf173[_0x992c('0x48')][_0x992c('0x72')])[_0x992c('0x22')](function(){if(_[_0x992c('0xe1')](_0x3bf173[_0x992c('0x48')][_0x992c('0x72')])){for(var _0x348ea1=0x0;_0x348ea1<_0x3bf173[_0x992c('0x48')]['ids'][_0x992c('0x4b')];_0x348ea1+=0x1){socket[_0x992c('0xde')]('userSmsAccount:remove',{'UserId':Number(_0x3bf173[_0x992c('0x48')]['ids'][_0x348ea1]),'SmsAccountId':Number(_0x3bf173[_0x992c('0x65')]['id'])});}}else{socket[_0x992c('0xde')](_0x992c('0xe2'),{'UserId':Number(_0x3bf173[_0x992c('0x48')][_0x992c('0x72')]),'SmsAccountId':Number(_0x3bf173[_0x992c('0x65')]['id'])});}});}})[_0x992c('0x22')](respondWithStatusCode(_0x300a8f,null))[_0x992c('0x2b')](handleError(_0x300a8f,null));};exports[_0x992c('0xe3')]=function(_0xfdbc75,_0x29bab9,_0x349a1d){var _0x31c14d={};var _0x13f4ad={};var _0x29cb6c;var _0x4bbc82;return db[_0x992c('0x40')][_0x992c('0x6a')]({'where':{'id':_0xfdbc75['params']['id']}})[_0x992c('0x22')](handleEntityNotFound(_0x29bab9,null))['then'](function(_0x3d7388){if(_0x3d7388){_0x29cb6c=_0x3d7388;_0x13f4ad[_0x992c('0x45')]=_['keys'](db[_0x992c('0xbf')][_0x992c('0x41')]);_0x13f4ad[_0x992c('0x48')]=_[_0x992c('0x46')](_0xfdbc75[_0x992c('0x48')]);_0x13f4ad['filters']=_['intersection'](_0x13f4ad['model'],_0x13f4ad['query']);_0x31c14d['attributes']=_[_0x992c('0x47')](_0x13f4ad[_0x992c('0x45')],qs['fields'](_0xfdbc75[_0x992c('0x48')][_0x992c('0x4a')]));_0x31c14d[_0x992c('0x49')]=_0x31c14d['attributes']['length']?_0x31c14d['attributes']:_0x13f4ad[_0x992c('0x45')];_0x31c14d[_0x992c('0x4d')]=qs[_0x992c('0x4e')](_0xfdbc75['query'][_0x992c('0x4e')]);_0x31c14d[_0x992c('0x4f')]=qs[_0x992c('0x51')](_[_0x992c('0x50')](_0xfdbc75[_0x992c('0x48')],_0x13f4ad[_0x992c('0x51')]));if(_0xfdbc75['query']['filter']){_0x31c14d[_0x992c('0x4f')]=_[_0x992c('0x53')](_0x31c14d[_0x992c('0x4f')],{'$or':_[_0x992c('0x3f')](_0x31c14d[_0x992c('0x49')],function(_0x4ebba7){var _0x1bace7={};_0x1bace7[_0x4ebba7]={'$like':'%'+_0xfdbc75[_0x992c('0x48')][_0x992c('0x52')]+'%'};return _0x1bace7;})});}_0x31c14d=_[_0x992c('0x53')]({},_0x31c14d,_0xfdbc75['options']);return _0x29cb6c[_0x992c('0xe3')](_0x31c14d);}})[_0x992c('0x22')](function(_0x2ff67d){if(_0x2ff67d){_0x4bbc82=_0x2ff67d[_0x992c('0x4b')];if(!_0xfdbc75[_0x992c('0x48')][_0x992c('0x6c')]('nolimit')){_0x31c14d[_0x992c('0x32')]=qs[_0x992c('0x32')](_0xfdbc75[_0x992c('0x48')][_0x992c('0x32')]);_0x31c14d[_0x992c('0x31')]=qs[_0x992c('0x31')](_0xfdbc75[_0x992c('0x48')][_0x992c('0x31')]);}return _0x29cb6c[_0x992c('0xe3')](_0x31c14d);}})[_0x992c('0x22')](function(_0x44e815){if(_0x44e815){return _0x44e815?{'count':_0x4bbc82,'rows':_0x44e815}:null;}})[_0x992c('0x22')](respondWithResult(_0x29bab9,null))[_0x992c('0x2b')](handleError(_0x29bab9,null));}; \ No newline at end of file +var _0xac4f=['redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','get','SmsAccounts','stack','name','send','index','Pause','map','SmsAccount','fieldName','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','params','rawAttributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','addDisposition','getDispositions','Disposition','nolimit','SmsAccountId','rows','removeDispositions','ids','addAnswer','findOne','CannedAnswer','length','pick','findAll','removeAnswers','sms','SmsApplication','account','Applications','priority','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','messageId','MessageSid','skebby','sender','text','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','SmsInteraction','spread','interaction','created','applications','unmanaged','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','receiveMessage','info','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','message_id','groupName','DELIVERED','redif','update','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x51256f,_0x376a8b){var _0x35d5e1=function(_0x124170){while(--_0x124170){_0x51256f['push'](_0x51256f['shift']());}};_0x35d5e1(++_0x376a8b);}(_0xac4f,0xc5));var _0xfac4=function(_0x5842c3,_0x56bd74){_0x5842c3=_0x5842c3-0x0;var _0x44bf8c=_0xac4f[_0x5842c3];return _0x44bf8c;};'use strict';var emlformat=require(_0xfac4('0x0'));var rimraf=require(_0xfac4('0x1'));var zipdir=require(_0xfac4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfac4('0x3'));var moment=require('moment');var BPromise=require(_0xfac4('0x4'));var Mustache=require('mustache');var util=require(_0xfac4('0x5'));var path=require(_0xfac4('0x6'));var sox=require(_0xfac4('0x7'));var csv=require(_0xfac4('0x8'));var ejs=require(_0xfac4('0x9'));var fs=require('fs');var fs_extra=require(_0xfac4('0xa'));var _=require('lodash');var squel=require(_0xfac4('0xb'));var crypto=require('crypto');var jsforce=require(_0xfac4('0xc'));var deskjs=require(_0xfac4('0xd'));var toCsv=require(_0xfac4('0x8'));var querystring=require('querystring');var Papa=require(_0xfac4('0xe'));var Redis=require(_0xfac4('0xf'));var authService=require(_0xfac4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfac4('0x11'));var hardwareService=require(_0xfac4('0x12'));var logger=require(_0xfac4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfac4('0x14'));var licenseUtil=require(_0xfac4('0x15'));var db=require('../../mysqldb')['db'];config[_0xfac4('0x16')]=_['defaults'](config[_0xfac4('0x16')],{'host':_0xfac4('0x17'),'port':0x18eb});var socket=require(_0xfac4('0x18'))(new Redis(config[_0xfac4('0x16')]));require(_0xfac4('0x19'))[_0xfac4('0x1a')](socket);var jayson=require(_0xfac4('0x1b'));var client=jayson['client'][_0xfac4('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x43fdfd,_0x54b3c9,_0x4faf45,_0x39d6eb){return new BPromise(function(_0x297c8e,_0x1e3120){var _0x34291c=_0x39d6eb||client;return _0x34291c['request'](_0x43fdfd,_0x4faf45)[_0xfac4('0x1d')](function(_0x1ce020){logger['info']('SmsAccount,\x20%s,\x20%s',_0x54b3c9,_0xfac4('0x1e'));logger[_0xfac4('0x1f')](_0xfac4('0x20'),_0x54b3c9,_0xfac4('0x1e'),JSON['stringify'](_0x1ce020));if(_0x1ce020[_0xfac4('0x21')]){if(_0x1ce020[_0xfac4('0x21')][_0xfac4('0x22')]===0x1f4){logger[_0xfac4('0x21')]('SmsAccount,\x20%s,\x20%s',_0x54b3c9,_0x1ce020[_0xfac4('0x21')]['message']);return _0x1e3120(_0x1ce020[_0xfac4('0x21')][_0xfac4('0x23')]);}logger[_0xfac4('0x21')]('SmsAccount,\x20%s,\x20%s',_0x54b3c9,_0x1ce020[_0xfac4('0x21')][_0xfac4('0x23')]);return _0x297c8e(_0x1ce020[_0xfac4('0x21')][_0xfac4('0x23')]);}else{logger['info'](_0xfac4('0x24'),_0x54b3c9,'request\x20sent');_0x297c8e(_0x1ce020['result']['message']);}})['catch'](function(_0x2bc3b5){logger['error'](_0xfac4('0x24'),_0x54b3c9,_0x2bc3b5);_0x1e3120(_0x2bc3b5);});});}function respondWithStatusCode(_0x2991d3,_0x45d9ae){_0x45d9ae=_0x45d9ae||0xcc;return function(_0x19ed99){if(_0x19ed99){return _0x2991d3['sendStatus'](_0x45d9ae);}return _0x2991d3['status'](_0x45d9ae)[_0xfac4('0x25')]();};}function respondWithResult(_0x33696d,_0x2924ef){_0x2924ef=_0x2924ef||0xc8;return function(_0x340f2a){if(_0x340f2a){return _0x33696d[_0xfac4('0x26')](_0x2924ef)[_0xfac4('0x27')](_0x340f2a);}};}function respondWithFilteredResult(_0x23286b,_0x4f7bf7){return function(_0x4aed4b){if(_0x4aed4b){var _0x4701ae=typeof _0x4f7bf7['offset']===_0xfac4('0x28')&&typeof _0x4f7bf7[_0xfac4('0x29')]===_0xfac4('0x28');var _0x40dbab=_0x4aed4b[_0xfac4('0x2a')];var _0x4bddc3=_0x4701ae?0x0:_0x4f7bf7['offset'];var _0x483bc6=_0x4701ae?_0x4aed4b[_0xfac4('0x2a')]:_0x4f7bf7[_0xfac4('0x2b')]+_0x4f7bf7['limit'];var _0x486db9;if(_0x483bc6>=_0x40dbab){_0x483bc6=_0x40dbab;_0x486db9=0xc8;}else{_0x486db9=0xce;}_0x23286b[_0xfac4('0x26')](_0x486db9);return _0x23286b[_0xfac4('0x2c')](_0xfac4('0x2d'),_0x4bddc3+'-'+_0x483bc6+'/'+_0x40dbab)[_0xfac4('0x27')](_0x4aed4b);}return null;};}function patchUpdates(_0x31ae27){return function(_0x1e2631){try{jsonpatch[_0xfac4('0x2e')](_0x1e2631,_0x31ae27,!![]);}catch(_0x43cf2a){return BPromise[_0xfac4('0x2f')](_0x43cf2a);}return _0x1e2631[_0xfac4('0x30')]();};}function saveUpdates(_0x5d5b96,_0x3322fc){return function(_0x170a08){if(_0x170a08){return _0x170a08['update'](_0x5d5b96)[_0xfac4('0x1d')](function(_0x524718){return _0x524718;});}return null;};}function removeEntity(_0x255401,_0x476068){return function(_0x48d959){if(_0x48d959){return _0x48d959[_0xfac4('0x31')]()['then'](function(){var _0x583c1d=_0x48d959[_0xfac4('0x32')]({'plain':!![]});var _0x27ac05=_0xfac4('0x33');return db['UserProfileResource'][_0xfac4('0x31')]({'where':{'type':_0x27ac05,'resourceId':_0x583c1d['id']}})['then'](function(){return _0x48d959;});})['then'](function(){_0x255401[_0xfac4('0x26')](0xcc)[_0xfac4('0x25')]();});}};}function handleEntityNotFound(_0x445249,_0x37544c){return function(_0x492c2a){if(!_0x492c2a){_0x445249['sendStatus'](0x194);}return _0x492c2a;};}function handleError(_0x433b7b,_0x2ea958){_0x2ea958=_0x2ea958||0x1f4;return function(_0x3c064c){logger[_0xfac4('0x21')](_0x3c064c[_0xfac4('0x34')]);if(_0x3c064c[_0xfac4('0x35')]){delete _0x3c064c[_0xfac4('0x35')];}_0x433b7b['status'](_0x2ea958)[_0xfac4('0x36')](_0x3c064c);};}exports[_0xfac4('0x37')]=function(_0x46d94a,_0x218083){var _0x2c33ea={'include':[{'model':db[_0xfac4('0x38')],'as':'mandatoryDispositionPause'}]},_0x198499={},_0x3ab887={'count':0x0,'rows':[]};var _0x3e7334=_[_0xfac4('0x39')](db[_0xfac4('0x3a')]['rawAttributes'],function(_0x16463f){return{'name':_0x16463f[_0xfac4('0x3b')],'type':_0x16463f['type'][_0xfac4('0x3c')]};});_0x198499[_0xfac4('0x3d')]=_['map'](_0x3e7334,_0xfac4('0x35'));_0x198499['query']=_[_0xfac4('0x3e')](_0x46d94a[_0xfac4('0x3f')]);_0x198499['filters']=_['intersection'](_0x198499['model'],_0x198499['query']);_0x2c33ea[_0xfac4('0x40')]=_[_0xfac4('0x41')](_0x198499[_0xfac4('0x3d')],qs[_0xfac4('0x42')](_0x46d94a['query']['fields']));_0x2c33ea['attributes']=_0x2c33ea[_0xfac4('0x40')]['length']?_0x2c33ea['attributes']:_0x198499[_0xfac4('0x3d')];if(!_0x46d94a[_0xfac4('0x3f')][_0xfac4('0x43')]('nolimit')){_0x2c33ea[_0xfac4('0x29')]=qs[_0xfac4('0x29')](_0x46d94a[_0xfac4('0x3f')][_0xfac4('0x29')]);_0x2c33ea[_0xfac4('0x2b')]=qs['offset'](_0x46d94a['query'][_0xfac4('0x2b')]);}_0x2c33ea[_0xfac4('0x44')]=qs[_0xfac4('0x45')](_0x46d94a[_0xfac4('0x3f')]['sort']);_0x2c33ea[_0xfac4('0x46')]=qs[_0xfac4('0x47')](_['pick'](_0x46d94a[_0xfac4('0x3f')],_0x198499['filters']),_0x3e7334);if(_0x46d94a[_0xfac4('0x3f')][_0xfac4('0x48')]){_0x2c33ea[_0xfac4('0x46')]=_['merge'](_0x2c33ea[_0xfac4('0x46')],{'$or':_[_0xfac4('0x39')](_0x3e7334,function(_0x751f42){if(_0x751f42[_0xfac4('0x49')]!==_0xfac4('0x4a')){var _0x4cf421={};_0x4cf421[_0x751f42[_0xfac4('0x35')]]={'$like':'%'+_0x46d94a[_0xfac4('0x3f')][_0xfac4('0x48')]+'%'};return _0x4cf421;}})});}_0x2c33ea=_[_0xfac4('0x4b')]({},_0x2c33ea,_0x46d94a[_0xfac4('0x4c')]);var _0x2a8736={'where':_0x2c33ea['where']};return db[_0xfac4('0x3a')][_0xfac4('0x2a')](_0x2a8736)[_0xfac4('0x1d')](function(_0x4f3a25){_0x3ab887[_0xfac4('0x2a')]=_0x4f3a25;if(_0x46d94a[_0xfac4('0x3f')][_0xfac4('0x4d')]){_0x2c33ea[_0xfac4('0x4e')]=[{'all':!![]}];}return db[_0xfac4('0x3a')]['findAll'](_0x2c33ea);})[_0xfac4('0x1d')](function(_0x45ab2f){_0x3ab887['rows']=_0x45ab2f;return _0x3ab887;})[_0xfac4('0x1d')](respondWithFilteredResult(_0x218083,_0x2c33ea))['catch'](handleError(_0x218083,null));};exports['show']=function(_0x101ca6,_0x11da9d){var _0x25952a={'raw':![],'where':{'id':_0x101ca6[_0xfac4('0x4f')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x25c7af={};_0x25c7af[_0xfac4('0x3d')]=_['keys'](db['SmsAccount'][_0xfac4('0x50')]);_0x25c7af[_0xfac4('0x3f')]=_[_0xfac4('0x3e')](_0x101ca6['query']);_0x25c7af['filters']=_[_0xfac4('0x41')](_0x25c7af['model'],_0x25c7af['query']);_0x25952a[_0xfac4('0x40')]=_[_0xfac4('0x41')](_0x25c7af[_0xfac4('0x3d')],qs[_0xfac4('0x42')](_0x101ca6[_0xfac4('0x3f')][_0xfac4('0x42')]));_0x25952a[_0xfac4('0x40')]=_0x25952a[_0xfac4('0x40')]['length']?_0x25952a[_0xfac4('0x40')]:_0x25c7af[_0xfac4('0x3d')];if(_0x101ca6[_0xfac4('0x3f')][_0xfac4('0x4d')]){_0x25952a[_0xfac4('0x4e')]=[{'all':!![]}];}_0x25952a=_[_0xfac4('0x4b')]({},_0x25952a,_0x101ca6[_0xfac4('0x4c')]);return db['SmsAccount'][_0xfac4('0x51')](_0x25952a)[_0xfac4('0x1d')](handleEntityNotFound(_0x11da9d,null))[_0xfac4('0x1d')](respondWithResult(_0x11da9d,null))[_0xfac4('0x52')](handleError(_0x11da9d,null));};exports['create']=function(_0x5d7180,_0x4d330b){return db[_0xfac4('0x3a')][_0xfac4('0x53')](_0x5d7180['body'],{})['then'](function(_0x4b4bc6){var _0x5a4db7=_0x5d7180['user'][_0xfac4('0x32')]({'plain':!![]});if(!_0x5a4db7)throw new Error(_0xfac4('0x54'));if(_0x5a4db7[_0xfac4('0x55')]===_0xfac4('0x56')){var _0x3c26db=_0x4b4bc6[_0xfac4('0x32')]({'plain':!![]});var _0x26d265=_0xfac4('0x33');return db[_0xfac4('0x57')][_0xfac4('0x51')]({'where':{'name':_0x26d265,'userProfileId':_0x5a4db7[_0xfac4('0x58')]},'raw':!![]})[_0xfac4('0x1d')](function(_0x4ff22d){if(_0x4ff22d&&_0x4ff22d['autoAssociation']===0x0){return db['UserProfileResource'][_0xfac4('0x53')]({'name':_0x3c26db['name'],'resourceId':_0x3c26db['id'],'type':_0x4ff22d[_0xfac4('0x35')],'sectionId':_0x4ff22d['id']},{})[_0xfac4('0x1d')](function(){return _0x4b4bc6;});}else{return _0x4b4bc6;}})[_0xfac4('0x52')](function(_0x516167){logger[_0xfac4('0x21')](_0xfac4('0x59'),_0x516167);throw _0x516167;});}return _0x4b4bc6;})[_0xfac4('0x1d')](respondWithResult(_0x4d330b,0xc9))[_0xfac4('0x52')](handleError(_0x4d330b,null));};exports['update']=function(_0x5ca950,_0x34de14){if(_0x5ca950[_0xfac4('0x5a')]['id']){delete _0x5ca950['body']['id'];}return db['SmsAccount'][_0xfac4('0x51')]({'where':{'id':_0x5ca950[_0xfac4('0x4f')]['id']},'include':[{'model':db['Pause'],'as':_0xfac4('0x5b')}]})['then'](handleEntityNotFound(_0x34de14,null))[_0xfac4('0x1d')](saveUpdates(_0x5ca950['body'],null))['then'](respondWithResult(_0x34de14,null))[_0xfac4('0x52')](handleError(_0x34de14,null));};exports['destroy']=function(_0x26f329,_0x42659e){return db[_0xfac4('0x3a')]['find']({'where':{'id':_0x26f329['params']['id']}})['then'](handleEntityNotFound(_0x42659e,null))[_0xfac4('0x1d')](removeEntity(_0x42659e,null))[_0xfac4('0x52')](handleError(_0x42659e,null));};exports[_0xfac4('0x5c')]=function(_0x59db6a,_0x8981f2){return db[_0xfac4('0x3a')][_0xfac4('0x5c')]()['then'](respondWithResult(_0x8981f2,null))[_0xfac4('0x52')](handleError(_0x8981f2,null));};exports[_0xfac4('0x5d')]=function(_0xd0cf1b,_0x3cdc48,_0x3df44d){if(_0xd0cf1b[_0xfac4('0x5a')]['id']){delete _0xd0cf1b[_0xfac4('0x5a')]['id'];}return db[_0xfac4('0x3a')][_0xfac4('0x51')]({'where':{'id':_0xd0cf1b[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x3cdc48,null))[_0xfac4('0x1d')](function(_0x3bce8a){if(_0x3bce8a){_0xd0cf1b[_0xfac4('0x5a')]['SmsAccountId']=_0x3bce8a['id'];return db['Disposition'][_0xfac4('0x53')](_0xd0cf1b[_0xfac4('0x5a')]);}})[_0xfac4('0x1d')](respondWithResult(_0x3cdc48,null))[_0xfac4('0x52')](handleError(_0x3cdc48,null));};exports[_0xfac4('0x5e')]=function(_0x264083,_0x232ea8,_0x2c60a2){var _0x231eac={'raw':![],'where':{}};var _0x3997d0={};var _0x5fa409={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x264083[_0xfac4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x232ea8,null))['then'](function(_0xfa4668){if(_0xfa4668){_0x3997d0[_0xfac4('0x3d')]=_[_0xfac4('0x3e')](db[_0xfac4('0x5f')][_0xfac4('0x50')]);_0x3997d0['query']=_[_0xfac4('0x3e')](_0x264083[_0xfac4('0x3f')]);_0x3997d0[_0xfac4('0x47')]=_[_0xfac4('0x41')](_0x3997d0[_0xfac4('0x3d')],_0x3997d0[_0xfac4('0x3f')]);_0x231eac[_0xfac4('0x40')]=_[_0xfac4('0x41')](_0x3997d0[_0xfac4('0x3d')],qs[_0xfac4('0x42')](_0x264083[_0xfac4('0x3f')][_0xfac4('0x42')]));_0x231eac[_0xfac4('0x40')]=_0x231eac[_0xfac4('0x40')]['length']?_0x231eac['attributes']:_0x3997d0[_0xfac4('0x3d')];if(!_0x264083['query'][_0xfac4('0x43')](_0xfac4('0x60'))){_0x231eac[_0xfac4('0x29')]=qs['limit'](_0x264083[_0xfac4('0x3f')][_0xfac4('0x29')]);_0x231eac[_0xfac4('0x2b')]=qs[_0xfac4('0x2b')](_0x264083[_0xfac4('0x3f')]['offset']);}_0x231eac[_0xfac4('0x44')]=qs['sort'](_0x264083[_0xfac4('0x3f')][_0xfac4('0x45')]);_0x231eac[_0xfac4('0x46')]=qs[_0xfac4('0x47')](_['pick'](_0x264083[_0xfac4('0x3f')],_0x3997d0['filters']));_0x231eac[_0xfac4('0x46')][_0xfac4('0x61')]=_0xfa4668['id'];if(_0x264083[_0xfac4('0x3f')][_0xfac4('0x48')]){_0x231eac[_0xfac4('0x46')]=_[_0xfac4('0x4b')](_0x231eac[_0xfac4('0x46')],{'$or':_['map'](_0x231eac[_0xfac4('0x40')],function(_0x2cba4a){var _0xf241ae={};_0xf241ae[_0x2cba4a]={'$like':'%'+_0x264083[_0xfac4('0x3f')][_0xfac4('0x48')]+'%'};return _0xf241ae;})});}_0x231eac=_[_0xfac4('0x4b')]({},_0x231eac,_0x264083[_0xfac4('0x4c')]);return db['Disposition']['count']({'where':_0x231eac['where']})[_0xfac4('0x1d')](function(_0x1f5c80){_0x5fa409[_0xfac4('0x2a')]=_0x1f5c80;if(_0x264083[_0xfac4('0x3f')][_0xfac4('0x4d')]){_0x231eac[_0xfac4('0x4e')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x231eac);})['then'](function(_0x2ff42e){_0x5fa409[_0xfac4('0x62')]=_0x2ff42e;return _0x5fa409;});}})[_0xfac4('0x1d')](respondWithFilteredResult(_0x232ea8,_0x231eac))['catch'](handleError(_0x232ea8,null));};exports['removeDispositions']=function(_0x5c082d,_0x4b37db,_0x1ade3e){return db[_0xfac4('0x3a')][_0xfac4('0x51')]({'where':{'id':_0x5c082d[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x4b37db,null))['then'](function(_0x357ba8){if(_0x357ba8){return _0x357ba8[_0xfac4('0x63')](_0x5c082d[_0xfac4('0x3f')][_0xfac4('0x64')]);}})[_0xfac4('0x1d')](respondWithStatusCode(_0x4b37db,null))[_0xfac4('0x52')](handleError(_0x4b37db,null));};exports[_0xfac4('0x65')]=function(_0x24903c,_0x17b300,_0x34b2ae){if(_0x24903c[_0xfac4('0x5a')]['id']){delete _0x24903c[_0xfac4('0x5a')]['id'];}return db[_0xfac4('0x3a')][_0xfac4('0x51')]({'where':{'id':_0x24903c[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x17b300,null))[_0xfac4('0x1d')](function(_0x1f16b5){if(_0x1f16b5){_0x24903c['body']['SmsAccountId']=_0x1f16b5['id'];return db['CannedAnswer'][_0xfac4('0x53')](_0x24903c[_0xfac4('0x5a')]);}})[_0xfac4('0x1d')](respondWithResult(_0x17b300,null))['catch'](handleError(_0x17b300,null));};exports['getAnswers']=function(_0x28731c,_0x38e8b4,_0x1a454a){var _0x765643={'raw':![],'where':{}};var _0x5a893d={};var _0x24eb42={'count':0x0,'rows':[]};return db[_0xfac4('0x3a')][_0xfac4('0x66')]({'where':{'id':_0x28731c[_0xfac4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x38e8b4,null))[_0xfac4('0x1d')](function(_0x4e1608){if(_0x4e1608){_0x5a893d[_0xfac4('0x3d')]=_[_0xfac4('0x3e')](db[_0xfac4('0x67')][_0xfac4('0x50')]);_0x5a893d[_0xfac4('0x3f')]=_[_0xfac4('0x3e')](_0x28731c['query']);_0x5a893d['filters']=_[_0xfac4('0x41')](_0x5a893d[_0xfac4('0x3d')],_0x5a893d['query']);_0x765643[_0xfac4('0x40')]=_[_0xfac4('0x41')](_0x5a893d[_0xfac4('0x3d')],qs[_0xfac4('0x42')](_0x28731c[_0xfac4('0x3f')][_0xfac4('0x42')]));_0x765643[_0xfac4('0x40')]=_0x765643['attributes'][_0xfac4('0x68')]?_0x765643[_0xfac4('0x40')]:_0x5a893d[_0xfac4('0x3d')];if(!_0x28731c['query'][_0xfac4('0x43')](_0xfac4('0x60'))){_0x765643['limit']=qs[_0xfac4('0x29')](_0x28731c[_0xfac4('0x3f')][_0xfac4('0x29')]);_0x765643[_0xfac4('0x2b')]=qs[_0xfac4('0x2b')](_0x28731c[_0xfac4('0x3f')][_0xfac4('0x2b')]);}_0x765643[_0xfac4('0x44')]=qs[_0xfac4('0x45')](_0x28731c[_0xfac4('0x3f')][_0xfac4('0x45')]);_0x765643['where']=qs[_0xfac4('0x47')](_[_0xfac4('0x69')](_0x28731c[_0xfac4('0x3f')],_0x5a893d[_0xfac4('0x47')]));_0x765643[_0xfac4('0x46')][_0xfac4('0x61')]=_0x4e1608['id'];if(_0x28731c[_0xfac4('0x3f')][_0xfac4('0x48')]){_0x765643[_0xfac4('0x46')]=_[_0xfac4('0x4b')](_0x765643[_0xfac4('0x46')],{'$or':_[_0xfac4('0x39')](_0x765643[_0xfac4('0x40')],function(_0x1642b7){var _0x447033={};_0x447033[_0x1642b7]={'$like':'%'+_0x28731c[_0xfac4('0x3f')]['filter']+'%'};return _0x447033;})});}_0x765643=_[_0xfac4('0x4b')]({},_0x765643,_0x28731c[_0xfac4('0x4c')]);return db['CannedAnswer'][_0xfac4('0x2a')]({'where':_0x765643['where']})[_0xfac4('0x1d')](function(_0x1d80d9){_0x24eb42['count']=_0x1d80d9;if(_0x28731c[_0xfac4('0x3f')][_0xfac4('0x4d')]){_0x765643[_0xfac4('0x4e')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfac4('0x6a')](_0x765643);})['then'](function(_0x19cd4d){_0x24eb42[_0xfac4('0x62')]=_0x19cd4d;return _0x24eb42;});}})[_0xfac4('0x1d')](respondWithFilteredResult(_0x38e8b4,_0x765643))[_0xfac4('0x52')](handleError(_0x38e8b4,null));};exports[_0xfac4('0x6b')]=function(_0x1c1249,_0x20d5f4,_0x5f2132){return db[_0xfac4('0x3a')][_0xfac4('0x51')]({'where':{'id':_0x1c1249[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x20d5f4,null))[_0xfac4('0x1d')](function(_0x475fc3){if(_0x475fc3){return _0x475fc3[_0xfac4('0x6b')](_0x1c1249[_0xfac4('0x3f')]['ids']);}})[_0xfac4('0x1d')](respondWithStatusCode(_0x20d5f4,null))['catch'](handleError(_0x20d5f4,null));};exports['notify']=function(_0x5bbcc7,_0x3e1628,_0x172c89){var _0x5a279a={'channel':_0xfac4('0x6c')};var _0xe58333=[];var _0x382640=[];var _0xf8bd94={};return db[_0xfac4('0x3a')][_0xfac4('0x51')]({'where':{'id':_0x5bbcc7[_0xfac4('0x4f')]['id']},'include':[{'model':db[_0xfac4('0x6d')],'as':'Applications'}]})[_0xfac4('0x1d')](handleEntityNotFound(_0x3e1628,null))[_0xfac4('0x1d')](function(_0x43f27d){_0x5a279a[_0xfac4('0x6e')]=_0x43f27d;_0x5a279a['applications']=_['orderBy'](_0x43f27d[_0xfac4('0x6f')],[_0xfac4('0x70')],['asc']);if(_0x5a279a['account'][_0xfac4('0x6f')]){delete _0x5a279a['account'][_0xfac4('0x6f')];}return db[_0xfac4('0x71')][_0xfac4('0x5c')]();})[_0xfac4('0x1d')](function(_0x723560){if(!_0x723560){throw new db[(_0xfac4('0x72'))][(_0xfac4('0x73'))]('no\x20available\x20attributes');}_0xe58333=_[_0xfac4('0x74')](_['keys'](_0x723560),[_0xfac4('0x75'),_0xfac4('0x76')]);_0x382640=_[_0xfac4('0x74')](_[_0xfac4('0x3e')](_0x723560),[_0xfac4('0x75'),_0xfac4('0x76'),_0xfac4('0x77'),_0xfac4('0x78')]);_0x5a279a[_0xfac4('0x5a')]={'mapKey':_0xfac4('0x79')};if(_0x5a279a[_0xfac4('0x6e')][_0xfac4('0x49')]){switch(_0x5a279a['account'][_0xfac4('0x49')]){case _0xfac4('0x7a'):_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')]=_0x5bbcc7['body']['From'];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7[_0xfac4('0x5a')]['Body'];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7c')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x7d')];break;case _0xfac4('0x7e'):_0x5a279a[_0xfac4('0x5a')]['from']='+'+_0x5bbcc7['body'][_0xfac4('0x7f')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x80')];break;case'connectel':_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')]=_0x5bbcc7['body']['from'];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7[_0xfac4('0x5a')]['message'];break;case'clicksend':_0x5a279a[_0xfac4('0x5a')]['from']=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x7b')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x5a')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7c')]=_0x5bbcc7['body']['message_id'];break;case'plivo':_0x5a279a['body'][_0xfac4('0x7b')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x81')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x82')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7c')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x83')];break;case _0xfac4('0x84'):_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')]='+'+_0x5bbcc7[_0xfac4('0x5a')]['results'][0x0]['from'];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x85')][0x0][_0xfac4('0x80')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7c')]=_0x5bbcc7['body'][_0xfac4('0x85')][0x0][_0xfac4('0x7c')];break;case _0xfac4('0x86'):_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x87')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7['body'][_0xfac4('0x88')][_0xfac4('0x23')];break;case _0xfac4('0x89'):_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x8a')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7['body'][_0xfac4('0x80')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7c')]=_0x5bbcc7['body']['replyMessageId'];break;case _0xfac4('0x8b'):_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7c')]=_0x5bbcc7[_0xfac4('0x5a')][0x0][_0xfac4('0x23')]['id'];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')]=_0x5bbcc7[_0xfac4('0x5a')][0x0][_0xfac4('0x23')][_0xfac4('0x7b')];_0x5a279a[_0xfac4('0x5a')]['body']=_0x5bbcc7['body'][0x0][_0xfac4('0x23')][_0xfac4('0x80')];break;case _0xfac4('0x8c'):_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x7b')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x23')];_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7c')]=_0x5bbcc7[_0xfac4('0x5a')][_0xfac4('0x8d')];break;}}if(_0x5a279a[_0xfac4('0x5a')]['id']){delete _0x5a279a['body']['id'];}if(_['isNil'](_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')])){throw new db[(_0xfac4('0x72'))]['ValidationError'](_0xfac4('0x8e'));}if(_['isNil'](_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x5a')])||_0x5a279a[_0xfac4('0x5a')]['body']===''){throw new db[(_0xfac4('0x72'))][(_0xfac4('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfac4('0x8f')](_0x5a279a['body']['mapKey'])){throw new db[(_0xfac4('0x72'))][(_0xfac4('0x73'))](_0xfac4('0x90')+_0x382640);}if(!_['includes'](_0x382640,_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x91')])){throw new db['Sequelize'][(_0xfac4('0x73'))](_0xfac4('0x92')+_0x382640);}_0xf8bd94[_0x5a279a['body'][_0xfac4('0x91')]]=_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')];return db[_0xfac4('0x93')]['find']({'where':{'id':_0x5a279a[_0xfac4('0x6e')]['ListId']},'include':[{'model':db[_0xfac4('0x71')],'as':_0xfac4('0x94'),'where':_0xf8bd94,'limit':0x1,'order':[[_0xfac4('0x76'),_0xfac4('0x95')]]}]});})[_0xfac4('0x1d')](handleEntityNotFound(_0x3e1628,null))['then'](function(_0x41667c){if(_0x41667c){_0x5a279a[_0xfac4('0x96')]=_[_0xfac4('0x97')](_0x41667c,[_0xfac4('0x94')]);if(_0x41667c['Contacts']['length']){return _0x41667c[_0xfac4('0x94')][0x0];}var _0x3ca137=_[_0xfac4('0x98')](_0x5a279a['body'],{'firstName':_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')],'ListId':_0x41667c['id']});_0x3ca137[_0x5a279a[_0xfac4('0x5a')]['mapKey']]=_0x5a279a['body'][_0xfac4('0x7b')];return db['CmContact'][_0xfac4('0x53')](_0x3ca137,{'fields':_0xe58333,'raw':!![]});}})['then'](handleEntityNotFound(_0x3e1628,null))[_0xfac4('0x1d')](function(_0x3054f6){if(_0x3054f6){_0x5a279a['contact']=_0x3054f6;var _0x4f3355={'ContactId':_0x3054f6['id'],'phone':_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7b')],'SmsAccountId':_0x5bbcc7[_0xfac4('0x4f')]['id']};var _0x59e5ae={'ContactId':_0x3054f6['id'],'SmsAccountId':_0x5bbcc7['params']['id'],'closed':![]};return db[_0xfac4('0x99')][_0xfac4('0x51')]({'where':_0x59e5ae})[_0xfac4('0x1d')](function(_0x1d56ef){if(_0x1d56ef){return[_0x1d56ef,![]];}return db[_0xfac4('0x99')][_0xfac4('0x53')](_0x4f3355)[_0xfac4('0x1d')](function(_0x439336){return[_0x439336,!![]];});});}})[_0xfac4('0x9a')](function(_0x4f6af9,_0x199192){_0x5a279a[_0xfac4('0x9b')]=_0x4f6af9[_0xfac4('0x32')]({'plain':!![]});_0x5a279a[_0xfac4('0x9b')][_0xfac4('0x9c')]=![];if(_0x199192){if(_0x5a279a[_0xfac4('0x6e')]['autoclose']){_0x5a279a[_0xfac4('0x9d')]['push']({'id':0x0,'priority':_0x5a279a[_0xfac4('0x9d')][_0xfac4('0x68')]+0x1,'app':'close','appdata':_0xfac4('0x9e'),'interval':'*,*,*,*'});}_0x5a279a[_0xfac4('0x9b')][_0xfac4('0x9c')]=!![];}return db['SmsMessage'][_0xfac4('0x53')]({'phone':_0x5a279a[_0xfac4('0x5a')]['from'],'messageId':_0x5a279a[_0xfac4('0x5a')][_0xfac4('0x7c')],'body':_0x5a279a['body'][_0xfac4('0x5a')],'SmsAccountId':_0x5bbcc7[_0xfac4('0x4f')]['id'],'SmsInteractionId':_0x4f6af9['id'],'direction':'in','ContactId':_0x4f6af9[_0xfac4('0x9f')],'AttachmentId':_0x5a279a[_0xfac4('0x5a')][_0xfac4('0xa0')]});})[_0xfac4('0x1d')](function(_0x2bad42){_0x5a279a['message']=_0x2bad42;if(_0x5a279a[_0xfac4('0x9b')][_0xfac4('0xa1')]){return db[_0xfac4('0xa2')][_0xfac4('0x51')]({'attributes':['id',_0xfac4('0x35')],'where':{'id':_0x5a279a['interaction']['UserId']}})[_0xfac4('0x1d')](function(_0x1342be){if(_0x1342be){_0x5a279a[_0xfac4('0x9d')]['unshift']({'id':0x0,'priority':0x0,'app':_0xfac4('0xa3'),'appdata':_0x1342be['name']+','+(_0x5a279a['account'][_0xfac4('0xa4')]||0xa),'interval':_0xfac4('0xa5')});}return respondWithRpcPromise(_0xfac4('0xa6'),'startRouting',_0x5a279a);});}return respondWithRpcPromise(_0xfac4('0xa6'),'startRouting',_0x5a279a);})[_0xfac4('0x1d')](function(_0xa023af){if(_0xa023af){var _0x505e50=0xc8;var _0xdb1d20=_0xfac4('0xa7');logger[_0xfac4('0xa8')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdb1d20,_0x505e50,_0xfac4('0xa9'));logger[_0xfac4('0x1f')](_0xfac4('0xaa'),_0xdb1d20,_0x505e50,'entity\x20found',JSON[_0xfac4('0xab')](_0xa023af));if(_0x5a279a[_0xfac4('0x6e')][_0xfac4('0x49')]===_0xfac4('0x7a')){return _0x3e1628['status'](_0x505e50)[_0xfac4('0x2c')](_0xfac4('0xac'),_0xfac4('0xad'))[_0xfac4('0x36')](_0xfac4('0xae'));}else{return _0x3e1628['status'](_0x505e50)['json'](_0xa023af);}}})[_0xfac4('0x52')](handleError(_0x3e1628,null));};exports[_0xfac4('0xaf')]=function(_0x2c7b49,_0x29d505,_0x233384){return db[_0xfac4('0x3a')][_0xfac4('0x66')]({'where':{'id':_0x2c7b49[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x29d505,null))[_0xfac4('0x1d')](function(_0x139bb0){if(_0x139bb0){return db[_0xfac4('0xb0')][_0xfac4('0xb1')](function(_0x1be151){return db['SmsApplication'][_0xfac4('0x31')]({'where':{'SmsAccountId':_0x2c7b49[_0xfac4('0x4f')]['id']},'transaction':_0x1be151})[_0xfac4('0x1d')](function(_0x26aa0d){var _0x3ee838=_['map'](_0x2c7b49['body'],function(_0x3ae820){_0x3ae820[_0xfac4('0x61')]=_0x2c7b49[_0xfac4('0x4f')]['id'];return _0x3ae820;});return db['SmsApplication'][_0xfac4('0xb2')](_0x3ee838,{'transaction':_0x1be151});});})[_0xfac4('0x1d')](function(){return db[_0xfac4('0x6d')][_0xfac4('0xb3')]({'where':{'SmsAccountId':_0x2c7b49[_0xfac4('0x4f')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x29d505,null))[_0xfac4('0x52')](handleError(_0x29d505,null));};exports[_0xfac4('0xb4')]=function(_0x180c83,_0x5ed148,_0x216103){var _0x49ae9a={};var _0x1a0f7c={};var _0x20378a;var _0x94577d;return db['SmsAccount']['findOne']({'where':{'id':_0x180c83[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x5ed148,null))[_0xfac4('0x1d')](function(_0x59fcba){if(_0x59fcba){_0x20378a=_0x59fcba;_0x1a0f7c['model']=_[_0xfac4('0x3e')](db[_0xfac4('0x6d')]['rawAttributes']);_0x1a0f7c[_0xfac4('0x3f')]=_[_0xfac4('0x3e')](_0x180c83[_0xfac4('0x3f')]);_0x1a0f7c[_0xfac4('0x47')]=_['intersection'](_0x1a0f7c[_0xfac4('0x3d')],_0x1a0f7c[_0xfac4('0x3f')]);_0x49ae9a[_0xfac4('0x40')]=_['intersection'](_0x1a0f7c[_0xfac4('0x3d')],qs['fields'](_0x180c83[_0xfac4('0x3f')]['fields']));_0x49ae9a['attributes']=_0x49ae9a[_0xfac4('0x40')][_0xfac4('0x68')]?_0x49ae9a['attributes']:_0x1a0f7c[_0xfac4('0x3d')];_0x49ae9a[_0xfac4('0x44')]=qs[_0xfac4('0x45')](_0x180c83[_0xfac4('0x3f')]['sort']);_0x49ae9a['where']=qs[_0xfac4('0x47')](_[_0xfac4('0x69')](_0x180c83[_0xfac4('0x3f')],_0x1a0f7c['filters']));if(_0x180c83[_0xfac4('0x3f')]['filter']){_0x49ae9a[_0xfac4('0x46')]=_[_0xfac4('0x4b')](_0x49ae9a[_0xfac4('0x46')],{'$or':_[_0xfac4('0x39')](_0x49ae9a['attributes'],function(_0x21537b){var _0x1c2aaa={};_0x1c2aaa[_0x21537b]={'$like':'%'+_0x180c83['query']['filter']+'%'};return _0x1c2aaa;})});}_0x49ae9a=_[_0xfac4('0x4b')]({},_0x49ae9a,_0x180c83['options']);return _0x20378a[_0xfac4('0xb4')](_0x49ae9a);}})[_0xfac4('0x1d')](function(_0x434b30){if(_0x434b30){_0x94577d=_0x434b30[_0xfac4('0x68')];if(!_0x180c83['query'][_0xfac4('0x43')](_0xfac4('0x60'))){_0x49ae9a[_0xfac4('0x29')]=qs['limit'](_0x180c83[_0xfac4('0x3f')][_0xfac4('0x29')]);_0x49ae9a[_0xfac4('0x2b')]=qs[_0xfac4('0x2b')](_0x180c83[_0xfac4('0x3f')][_0xfac4('0x2b')]);}return _0x20378a['getApplications'](_0x49ae9a);}})[_0xfac4('0x1d')](function(_0xfaeb3){if(_0xfaeb3){return _0xfaeb3?{'count':_0x94577d,'rows':_0xfaeb3}:null;}})[_0xfac4('0x1d')](respondWithResult(_0x5ed148,null))[_0xfac4('0x52')](handleError(_0x5ed148,null));};exports['getInteractions']=function(_0x573397,_0x1b5161,_0x400f68){var _0x8c2fbe={'raw':![],'where':{}};var _0xea2eb7={};var _0x71040d={'count':0x0,'rows':[]};return db[_0xfac4('0x3a')][_0xfac4('0x66')]({'where':{'id':_0x573397[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x1b5161,null))[_0xfac4('0x1d')](function(_0xab10b6){if(_0xab10b6){_0xea2eb7[_0xfac4('0x3d')]=_[_0xfac4('0x3e')](db['SmsInteraction'][_0xfac4('0x50')]);_0xea2eb7[_0xfac4('0x3f')]=_['keys'](_0x573397['query']);_0xea2eb7['filters']=_['intersection'](_0xea2eb7[_0xfac4('0x3d')],_0xea2eb7[_0xfac4('0x3f')]);_0x8c2fbe[_0xfac4('0x40')]=_[_0xfac4('0x41')](_0xea2eb7[_0xfac4('0x3d')],qs[_0xfac4('0x42')](_0x573397[_0xfac4('0x3f')][_0xfac4('0x42')]));_0x8c2fbe[_0xfac4('0x40')]=_0x8c2fbe[_0xfac4('0x40')][_0xfac4('0x68')]?_0x8c2fbe[_0xfac4('0x40')]:_0xea2eb7['model'];if(!_0x573397['query'][_0xfac4('0x43')](_0xfac4('0x60'))){_0x8c2fbe[_0xfac4('0x29')]=qs[_0xfac4('0x29')](_0x573397[_0xfac4('0x3f')][_0xfac4('0x29')]);_0x8c2fbe['offset']=qs[_0xfac4('0x2b')](_0x573397['query'][_0xfac4('0x2b')]);}_0x8c2fbe[_0xfac4('0x44')]=qs[_0xfac4('0x45')](_0x573397[_0xfac4('0x3f')][_0xfac4('0x45')]);_0x8c2fbe[_0xfac4('0x46')]=qs[_0xfac4('0x47')](_['pick'](_0x573397[_0xfac4('0x3f')],_0xea2eb7[_0xfac4('0x47')]));_0x8c2fbe[_0xfac4('0x46')][_0xfac4('0x61')]=_0xab10b6['id'];if(_0x573397['query']['filter']){_0x8c2fbe[_0xfac4('0x46')]=_['merge'](_0x8c2fbe[_0xfac4('0x46')],{'$or':_['map'](_0x8c2fbe[_0xfac4('0x40')],function(_0x16d9cc){var _0x40f380={};_0x40f380[_0x16d9cc]={'$like':'%'+_0x573397[_0xfac4('0x3f')][_0xfac4('0x48')]+'%'};return _0x40f380;})});}_0x8c2fbe=_[_0xfac4('0x4b')]({},_0x8c2fbe,_0x573397['options']);return db[_0xfac4('0x99')]['count']({'where':_0x8c2fbe[_0xfac4('0x46')]})['then'](function(_0x4c6eef){_0x71040d['count']=_0x4c6eef;if(_0x573397[_0xfac4('0x3f')]['includeAll']){_0x8c2fbe[_0xfac4('0x4e')]=[{'model':db[_0xfac4('0x71')],'as':_0xfac4('0xb5'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xfac4('0x35'),_0xfac4('0xb6'),_0xfac4('0xb7')],'required':![]},{'model':db[_0xfac4('0xb8')],'as':_0xfac4('0xb9'),'attributes':['id','name',_0xfac4('0xba')],'where':_0x573397[_0xfac4('0x3f')][_0xfac4('0xbb')]?{'id':_0x573397[_0xfac4('0x3f')][_0xfac4('0xbb')]}:undefined,'required':_0x573397['query']['tag']?!![]:![]}];}return db[_0xfac4('0x99')][_0xfac4('0x6a')](_0x8c2fbe);})[_0xfac4('0x1d')](function(_0x2824ba){_0x71040d[_0xfac4('0x62')]=_0x2824ba;return _0x71040d;});}})[_0xfac4('0x1d')](respondWithFilteredResult(_0x1b5161,_0x8c2fbe))[_0xfac4('0x52')](handleError(_0x1b5161,null));};exports['send']=function(_0x657edd,_0x23168d,_0x33b873){var _0x102f3e,_0x5eb16e,_0x1418ad;if(_[_0xfac4('0x8f')](_0x657edd['body']['body'])||_0x657edd['body'][_0xfac4('0x5a')]===''){throw new db['Sequelize'][(_0xfac4('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfac4('0x8f')](_0x657edd[_0xfac4('0x5a')]['to'])){throw new db['Sequelize'][(_0xfac4('0x73'))](_0xfac4('0xbc'));}_0x102f3e=_0x657edd[_0xfac4('0x5a')]['to'];return db[_0xfac4('0x3a')]['find']({'where':{'id':_0x657edd[_0xfac4('0x4f')]['id']},'include':[{'model':db['CmList'],'as':_0xfac4('0xbd'),'include':[{'model':db[_0xfac4('0x71')],'as':'Contacts','where':{'mobile':_0x102f3e},'limit':0x1,'order':[[_0xfac4('0x76'),_0xfac4('0x95')]]}]}]})[_0xfac4('0x1d')](handleEntityNotFound(_0x23168d,null))[_0xfac4('0x1d')](function(_0x552b14){if(_0x552b14&&_0x552b14[_0xfac4('0xbd')]){_0x5eb16e=_0x552b14['get']({'plain':!![]});if(_0x5eb16e[_0xfac4('0xbd')]&&_0x5eb16e['List'][_0xfac4('0x94')][_0xfac4('0x68')]){return _0x5eb16e['List'][_0xfac4('0x94')][0x0];}return db['CmContact']['create'](_['defaults'](_0x657edd['body'],{'firstName':_0x102f3e,'mobile':_0x102f3e,'phone':_0x102f3e,'ListId':_0x5eb16e[_0xfac4('0x78')]}));}})[_0xfac4('0x1d')](handleEntityNotFound(_0x23168d,null))[_0xfac4('0x1d')](function(_0x333ca8){if(_0x333ca8){_0x1418ad=_0x333ca8;return db['SmsInteraction'][_0xfac4('0x51')]({'where':{'ContactId':_0x1418ad['id'],'closed':![],'SmsAccountId':_0x5eb16e['id']}})[_0xfac4('0x1d')](function(_0x540ae4){if(_0x540ae4){return[_0x540ae4,![]];}return db[_0xfac4('0x99')]['create']({'UserId':_0x657edd[_0xfac4('0x56')]['id'],'ContactId':_0x1418ad['id'],'SmsAccountId':_0x5eb16e['id'],'phone':_0x102f3e,'firstMsgDirection':'out','Messages':[_[_0xfac4('0x4b')](_0x657edd[_0xfac4('0x5a')],{'read':![],'body':_0x657edd[_0xfac4('0x5a')]['body'],'phone':_0x102f3e,'SmsAccountId':_0x5eb16e['id'],'UserId':_0x657edd['user']['id'],'ContactId':_0x1418ad['id']})]},{'include':[{'model':db[_0xfac4('0xbe')],'as':_0xfac4('0xbf')}]})['then'](function(_0xc1800c){return[_0xc1800c,!![]];});});}})['spread'](function(_0x35d98c,_0x5ae25c){if(_0x5ae25c){return _0x35d98c;}return db['SmsMessage'][_0xfac4('0x53')](_[_0xfac4('0x4b')](_0x657edd['body'],{'read':![],'body':_0x657edd[_0xfac4('0x5a')]['body'],'phone':_0x102f3e,'SmsAccountId':_0x5eb16e['id'],'SmsInteractionId':_0x35d98c['id'],'UserId':_0x657edd['user']['id'],'ContactId':_0x1418ad['id']}))[_0xfac4('0x1d')](function(_0x480518){_0x35d98c['dataValues'][_0xfac4('0xbf')]=[];_0x35d98c[_0xfac4('0xc0')][_0xfac4('0xbf')][_0xfac4('0xc1')](_0x480518[_0xfac4('0xc0')]);return _0x35d98c;});})[_0xfac4('0x1d')](respondWithResult(_0x23168d,null))['catch'](handleError(_0x23168d,null));};exports[_0xfac4('0x26')]=function(_0x126dae,_0x5dedfd,_0x2531a5){if(_0x126dae[_0xfac4('0x5a')]['id']){delete _0x126dae[_0xfac4('0x5a')]['id'];}var _0x1664ab,_0x239d46,_0x454f81;return db['SmsAccount']['find']({'where':{'id':_0x126dae[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x5dedfd,null))[_0xfac4('0x1d')](function(_0x1e0559){if(_0x1e0559){_0x454f81=_0x1e0559;logger[_0xfac4('0x1f')](_0xfac4('0x20'),_0xfac4('0x26'),_0xfac4('0xc2'),_0x1e0559[_0xfac4('0x49')],util[_0xfac4('0xc3')](_0x126dae[_0xfac4('0x5a')],{'showHidden':![],'depth':null}));switch(_0x1e0559[_0xfac4('0x49')]){case _0xfac4('0x7e'):if(_0x126dae[_0xfac4('0x5a')][_0xfac4('0xc4')]&&_0x126dae['body'][_0xfac4('0x26')]){_0x239d46=_0x126dae[_0xfac4('0x5a')][_0xfac4('0x26')];return db[_0xfac4('0xbe')][_0xfac4('0x51')]({'where':{'messageId':_0x126dae[_0xfac4('0x5a')][_0xfac4('0xc4')]}});}break;case _0xfac4('0xc5'):if(_0x126dae[_0xfac4('0x5a')][_0xfac4('0xc6')]&&_0x126dae[_0xfac4('0x5a')][_0xfac4('0xc7')]){_0x239d46=_0x126dae[_0xfac4('0x5a')]['statusInt'];return db[_0xfac4('0xbe')][_0xfac4('0x51')]({'where':{'messageId':_0x126dae['body'][_0xfac4('0xc6')]}});}break;case _0xfac4('0xc8'):if(_0x126dae[_0xfac4('0x5a')][_0xfac4('0xc9')]&&_0x126dae[_0xfac4('0x5a')]['status_code']){_0x239d46=_0x126dae[_0xfac4('0x5a')]['status_code'];return db[_0xfac4('0xbe')]['find']({'where':{'messageId':_0x126dae[_0xfac4('0x5a')][_0xfac4('0xc9')]}});}break;case'infobip':var _0x278791=_0x126dae['body'][_0xfac4('0x85')][0x0];if(_0x278791[_0xfac4('0x7c')]&&_0x278791[_0xfac4('0x26')][_0xfac4('0xca')]===_0xfac4('0xcb')){_0x239d46=_0x278791['status'][_0xfac4('0xca')];return db[_0xfac4('0xbe')]['find']({'where':{'messageId':_0x278791[_0xfac4('0x7c')]}});}break;case _0xfac4('0x89'):if(_0x126dae[_0xfac4('0x5a')]['messageId']&&_0x126dae[_0xfac4('0x5a')][_0xfac4('0x26')]){_0x239d46=_0x126dae['body'][_0xfac4('0x26')];return db[_0xfac4('0xbe')]['find']({'where':{'messageId':_0x126dae[_0xfac4('0x5a')]['messageId']}});}break;case'bandwidth':if(_0x126dae['body'][0x0]['message']['id']){_0x239d46=_0x126dae[_0xfac4('0x5a')][0x0][_0xfac4('0x49')];return db[_0xfac4('0xbe')][_0xfac4('0x51')]({'where':{'messageId':_0x126dae[_0xfac4('0x5a')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x126dae[_0xfac4('0x5a')][_0xfac4('0xcc')]&&_0x126dae[_0xfac4('0x5a')][_0xfac4('0x26')]){_0x239d46=_0x126dae[_0xfac4('0x5a')][_0xfac4('0x26')];return db['SmsMessage'][_0xfac4('0x51')]({'where':{'messageId':_0x126dae[_0xfac4('0x5a')][_0xfac4('0xcc')]}});}break;}}})[_0xfac4('0x1d')](handleEntityNotFound(_0x5dedfd,null))['then'](function(_0x5f15e1){if(_0x5f15e1){_0x1664ab=_0x5f15e1;switch(_0x454f81[_0xfac4('0x49')]){case _0xfac4('0x7e'):if(_0x239d46===_0xfac4('0xcb')){return _0x1664ab[_0xfac4('0xcd')]({'read':!![]});}else{logger[_0xfac4('0x21')](_0xfac4('0x20'),_0xfac4('0x26'),_0xfac4('0x7e'),util[_0xfac4('0xc3')](_0x126dae['body'],{'showHidden':![],'depth':null}));}break;case _0xfac4('0xc5'):if(_0x239d46==='1'){return _0x1664ab[_0xfac4('0xcd')]({'read':!![]});}else{logger[_0xfac4('0x21')](_0xfac4('0x20'),_0xfac4('0x26'),_0xfac4('0x7e'),util[_0xfac4('0xc3')](_0x126dae[_0xfac4('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xfac4('0xc8'):if(!_0x126dae[_0xfac4('0x5a')][_0xfac4('0xce')]&&_0x239d46>=0xc8&&_0x239d46<=0xce){return _0x1664ab['update']({'read':!![]});}else{logger[_0xfac4('0x21')](_0xfac4('0x20'),'status',_0xfac4('0xc8'),util['inspect'](_0x126dae[_0xfac4('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xfac4('0x84'):var _0x44d5bb=_0x126dae[_0xfac4('0x5a')]['results'][0x0];if(_0x44d5bb[_0xfac4('0x26')][_0xfac4('0xca')]===_0xfac4('0xcb')){return _0x1664ab[_0xfac4('0xcd')]({'read':!![]});}else{logger['error'](_0xfac4('0x20'),_0xfac4('0x26'),_0xfac4('0x84'),util[_0xfac4('0xc3')](_0x126dae[_0xfac4('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xfac4('0x89'):if(_0x239d46==_0xfac4('0xcf')||_0x239d46==_0xfac4('0xd0')){return _0x1664ab[_0xfac4('0xcd')]({'read':!![]});}else{logger[_0xfac4('0x21')](_0xfac4('0x20'),_0xfac4('0x26'),_0xfac4('0x89'),util[_0xfac4('0xc3')](_0x126dae[_0xfac4('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xfac4('0x8b'):if(_0x239d46=='message-delivered'){return _0x1664ab[_0xfac4('0xcd')]({'read':!![]});}else{logger[_0xfac4('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfac4('0x26'),_0xfac4('0x8b'),util[_0xfac4('0xc3')](_0x126dae['body'],{'showHidden':![],'depth':null}));}break;case _0xfac4('0x8c'):if(_0x239d46===_0xfac4('0xd1')||_0x239d46===_0xfac4('0xd2')){return _0x1664ab[_0xfac4('0xcd')]({'read':!![]});}else{logger[_0xfac4('0x21')](_0xfac4('0x20'),_0xfac4('0x26'),_0xfac4('0x8c'),util[_0xfac4('0xc3')](_0x126dae[_0xfac4('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x1664ab;}})['then'](respondWithResult(_0x5dedfd,null))[_0xfac4('0x52')](handleError(_0x5dedfd,null));};exports[_0xfac4('0xd3')]=function(_0x850ff3,_0x1d6f42,_0x505107){var _0x16db97,_0xa9a85f,_0x2ea88f;return db[_0xfac4('0x3a')][_0xfac4('0x51')]({'where':{'id':_0x850ff3[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x1d6f42,null))[_0xfac4('0x1d')](function(_0x3af87c){if(_0x3af87c){_0x2ea88f=_0x3af87c;logger[_0xfac4('0x1f')](_0xfac4('0x20'),_0xfac4('0x26'),_0xfac4('0xc2'),_0x3af87c['type'],util[_0xfac4('0xc3')](_0x850ff3['query'],{'showHidden':![],'depth':null}));switch(_0x3af87c['type']){case _0xfac4('0x86'):if(_0x850ff3[_0xfac4('0x3f')][_0xfac4('0xd4')]&&_0x850ff3[_0xfac4('0x3f')][_0xfac4('0xd5')]){_0xa9a85f=_0x850ff3[_0xfac4('0x3f')][_0xfac4('0xd5')];return db[_0xfac4('0xbe')]['find']({'where':{'messageId':_0x850ff3[_0xfac4('0x3f')][_0xfac4('0xd4')]}});}break;}}})[_0xfac4('0x1d')](handleEntityNotFound(_0x1d6f42,null))[_0xfac4('0x1d')](function(_0x16c78b){if(_0x16c78b){_0x16db97=_0x16c78b;switch(_0x2ea88f[_0xfac4('0x49')]){case _0xfac4('0x86'):if(_0xa9a85f==='2'||_0xa9a85f==='6'){return _0x16db97[_0xfac4('0xcd')]({'read':!![]});}else{logger['error'](_0xfac4('0x20'),_0xfac4('0x26'),_0xfac4('0x86'),util[_0xfac4('0xc3')](_0x850ff3[_0xfac4('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x16db97;}})[_0xfac4('0x1d')](respondWithResult(_0x1d6f42,null))[_0xfac4('0x52')](handleError(_0x1d6f42,null));};exports['addAgents']=function(_0x440f30,_0x375c25,_0x653354){return db['SmsAccount'][_0xfac4('0x51')]({'where':{'id':_0x440f30[_0xfac4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x375c25,null))[_0xfac4('0x1d')](function(_0x388449){if(_0x388449){return _0x388449['addAgents'](_0x440f30[_0xfac4('0x5a')][_0xfac4('0x64')],_[_0xfac4('0x97')](_0x440f30['body'],[_0xfac4('0x64'),'id'])||{})['spread'](function(_0x22a12a){for(var _0x2cfd36=0x0;_0x2cfd36<_0x440f30['body'][_0xfac4('0x64')][_0xfac4('0x68')];_0x2cfd36+=0x1){socket[_0xfac4('0xd6')](_0xfac4('0xd7'),{'UserId':Number(_0x440f30[_0xfac4('0x5a')][_0xfac4('0x64')][_0x2cfd36]),'SmsAccountId':Number(_0x440f30[_0xfac4('0x4f')]['id'])});}return _0x22a12a;});}})[_0xfac4('0x1d')](respondWithResult(_0x375c25,null))[_0xfac4('0x52')](handleError(_0x375c25,null));};exports['removeAgents']=function(_0xe87ffd,_0x590da9,_0x310539){return db[_0xfac4('0x3a')][_0xfac4('0x51')]({'where':{'id':_0xe87ffd[_0xfac4('0x4f')]['id']}})[_0xfac4('0x1d')](handleEntityNotFound(_0x590da9,null))[_0xfac4('0x1d')](function(_0x20cf1d){if(_0x20cf1d){return _0x20cf1d['removeAgents'](_0xe87ffd[_0xfac4('0x3f')][_0xfac4('0x64')])[_0xfac4('0x1d')](function(){if(_[_0xfac4('0xd8')](_0xe87ffd[_0xfac4('0x3f')][_0xfac4('0x64')])){for(var _0x2c72bd=0x0;_0x2c72bd<_0xe87ffd[_0xfac4('0x3f')][_0xfac4('0x64')][_0xfac4('0x68')];_0x2c72bd+=0x1){socket[_0xfac4('0xd6')](_0xfac4('0xd9'),{'UserId':Number(_0xe87ffd[_0xfac4('0x3f')][_0xfac4('0x64')][_0x2c72bd]),'SmsAccountId':Number(_0xe87ffd[_0xfac4('0x4f')]['id'])});}}else{socket[_0xfac4('0xd6')](_0xfac4('0xd9'),{'UserId':Number(_0xe87ffd[_0xfac4('0x3f')][_0xfac4('0x64')]),'SmsAccountId':Number(_0xe87ffd[_0xfac4('0x4f')]['id'])});}});}})[_0xfac4('0x1d')](respondWithStatusCode(_0x590da9,null))[_0xfac4('0x52')](handleError(_0x590da9,null));};exports['getAgents']=function(_0x3bdf75,_0x176278,_0x2bd4bf){var _0x3d211f={};var _0x26cffb={};var _0xe0bd53;var _0x2a850d;return db[_0xfac4('0x3a')][_0xfac4('0x66')]({'where':{'id':_0x3bdf75[_0xfac4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x176278,null))['then'](function(_0x37e83e){if(_0x37e83e){_0xe0bd53=_0x37e83e;_0x26cffb[_0xfac4('0x3d')]=_[_0xfac4('0x3e')](db[_0xfac4('0xa2')][_0xfac4('0x50')]);_0x26cffb[_0xfac4('0x3f')]=_[_0xfac4('0x3e')](_0x3bdf75[_0xfac4('0x3f')]);_0x26cffb[_0xfac4('0x47')]=_['intersection'](_0x26cffb[_0xfac4('0x3d')],_0x26cffb[_0xfac4('0x3f')]);_0x3d211f[_0xfac4('0x40')]=_[_0xfac4('0x41')](_0x26cffb[_0xfac4('0x3d')],qs[_0xfac4('0x42')](_0x3bdf75[_0xfac4('0x3f')][_0xfac4('0x42')]));_0x3d211f[_0xfac4('0x40')]=_0x3d211f['attributes'][_0xfac4('0x68')]?_0x3d211f[_0xfac4('0x40')]:_0x26cffb['model'];_0x3d211f[_0xfac4('0x44')]=qs[_0xfac4('0x45')](_0x3bdf75['query'][_0xfac4('0x45')]);_0x3d211f[_0xfac4('0x46')]=qs[_0xfac4('0x47')](_['pick'](_0x3bdf75[_0xfac4('0x3f')],_0x26cffb[_0xfac4('0x47')]));if(_0x3bdf75[_0xfac4('0x3f')][_0xfac4('0x48')]){_0x3d211f['where']=_['merge'](_0x3d211f[_0xfac4('0x46')],{'$or':_['map'](_0x3d211f[_0xfac4('0x40')],function(_0x23b703){var _0x1e78ed={};_0x1e78ed[_0x23b703]={'$like':'%'+_0x3bdf75[_0xfac4('0x3f')][_0xfac4('0x48')]+'%'};return _0x1e78ed;})});}_0x3d211f=_['merge']({},_0x3d211f,_0x3bdf75[_0xfac4('0x4c')]);return _0xe0bd53[_0xfac4('0xda')](_0x3d211f);}})[_0xfac4('0x1d')](function(_0x4dad90){if(_0x4dad90){_0x2a850d=_0x4dad90[_0xfac4('0x68')];if(!_0x3bdf75[_0xfac4('0x3f')][_0xfac4('0x43')](_0xfac4('0x60'))){_0x3d211f[_0xfac4('0x29')]=qs[_0xfac4('0x29')](_0x3bdf75[_0xfac4('0x3f')][_0xfac4('0x29')]);_0x3d211f['offset']=qs[_0xfac4('0x2b')](_0x3bdf75[_0xfac4('0x3f')]['offset']);}return _0xe0bd53['getAgents'](_0x3d211f);}})[_0xfac4('0x1d')](function(_0x2b9cf0){if(_0x2b9cf0){return _0x2b9cf0?{'count':_0x2a850d,'rows':_0x2b9cf0}:null;}})[_0xfac4('0x1d')](respondWithResult(_0x176278,null))[_0xfac4('0x52')](handleError(_0x176278,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 41e4796..218be34 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 _0x1fe8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','remove'];(function(_0x1f2c93,_0x5bfe8a){var _0x46542c=function(_0x179725){while(--_0x179725){_0x1f2c93['push'](_0x1f2c93['shift']());}};_0x46542c(++_0x5bfe8a);}(_0x1fe8,0xdc));var _0x81fe=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1fe8[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0x81fe('0x0'));var SmsAccount=require(_0x81fe('0x1'))['db'][_0x81fe('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x81fe('0x3')};function emitEvent(_0x526479){return function(_0x5efa21,_0x2034ec,_0x3c335a){SmsAccountEvents['emit'](_0x526479+':'+_0x5efa21['id'],_0x5efa21);SmsAccountEvents[_0x81fe('0x4')](_0x526479,_0x5efa21);_0x3c335a(null);};}for(var e in events){if(events[_0x81fe('0x5')](e)){var event=events[e];SmsAccount[_0x81fe('0x6')](e,emitEvent(event));}}module[_0x81fe('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x831e=['exports','../../mysqldb','SmsAccount','save','remove','emit','hasOwnProperty','hook'];(function(_0x56e2ed,_0x1c4781){var _0x5237b2=function(_0x587150){while(--_0x587150){_0x56e2ed['push'](_0x56e2ed['shift']());}};_0x5237b2(++_0x1c4781);}(_0x831e,0x169));var _0xe831=function(_0x4a8db4,_0x134b3e){_0x4a8db4=_0x4a8db4-0x0;var _0xaf5b15=_0x831e[_0x4a8db4];return _0xaf5b15;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xe831('0x0'))['db'][_0xe831('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe831('0x2'),'afterUpdate':'update','afterDestroy':_0xe831('0x3')};function emitEvent(_0x5e306f){return function(_0x3c402e,_0x59e7af,_0x11e1f1){SmsAccountEvents[_0xe831('0x4')](_0x5e306f+':'+_0x3c402e['id'],_0x3c402e);SmsAccountEvents[_0xe831('0x4')](_0x5e306f,_0x3c402e);_0x11e1f1(null);};}for(var e in events){if(events[_0xe831('0x5')](e)){var event=events[e];SmsAccount[_0xe831('0x6')](e,emitEvent(event));}}module[_0xe831('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 4bb74ce..276ee78 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 _0xd376=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd376,0x158));var _0x6d37=function(_0x5222d9,_0x12496d){_0x5222d9=_0x5222d9-0x0;var _0x16b0d5=_0xd376[_0x5222d9];return _0x16b0d5;};'use strict';var _=require(_0x6d37('0x0'));var util=require(_0x6d37('0x1'));var logger=require(_0x6d37('0x2'))(_0x6d37('0x3'));var moment=require('moment');var BPromise=require(_0x6d37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d37('0x5'));var rimraf=require(_0x6d37('0x6'));var config=require(_0x6d37('0x7'));var attributes=require(_0x6d37('0x8'));module[_0x6d37('0x9')]=function(_0xcf672a,_0x54f16d){return _0xcf672a[_0x6d37('0xa')](_0x6d37('0xb'),attributes,{'tableName':_0x6d37('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa857=['./smsAccount.attributes','exports','SmsAccount','lodash','util','api','moment','request-promise'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xa857,0x1bb));var _0x7a85=function(_0x59bd9f,_0xb3896a){_0x59bd9f=_0x59bd9f-0x0;var _0x26f3ec=_0xa857[_0x59bd9f];return _0x26f3ec;};'use strict';var _=require(_0x7a85('0x0'));var util=require(_0x7a85('0x1'));var logger=require('../../config/logger')(_0x7a85('0x2'));var moment=require(_0x7a85('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a85('0x5'));module[_0x7a85('0x6')]=function(_0x4cba2a,_0x2b52b9){return _0x4cba2a['define'](_0x7a85('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 845cbae..2302742 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 _0x72bd=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','model','map','lodash','bluebird'];(function(_0x1e11ce,_0x3072ea){var _0x97ee32=function(_0x956072){while(--_0x956072){_0x1e11ce['push'](_0x1e11ce['shift']());}};_0x97ee32(++_0x3072ea);}(_0x72bd,0xd6));var _0xd72b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x72bd[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xd72b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd72b('0x1'));var rs=require(_0xd72b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd72b('0x3'))['db'];var utils=require(_0xd72b('0x4'));var logger=require('../../config/logger')(_0xd72b('0x5'));var config=require(_0xd72b('0x6'));var jayson=require(_0xd72b('0x7'));var client=jayson[_0xd72b('0x8')][_0xd72b('0x9')]({'port':0x232a});config[_0xd72b('0xa')]=_['defaults'](config[_0xd72b('0xa')],{'host':_0xd72b('0xb'),'port':0x18eb});var socket=require(_0xd72b('0xc'))(new Redis(config[_0xd72b('0xa')]));require(_0xd72b('0xd'))['register'](socket);function respondWithRpcPromise(_0x556345,_0x12b97b,_0x522cab){return new BPromise(function(_0x150e0a,_0x591a4d){return client[_0xd72b('0xe')](_0x556345,_0x522cab)[_0xd72b('0xf')](function(_0x4b4e92){logger['info'](_0xd72b('0x10'),_0x12b97b,_0xd72b('0x11'));logger[_0xd72b('0x12')](_0xd72b('0x13'),_0x12b97b,_0xd72b('0x11'),JSON[_0xd72b('0x14')](_0x4b4e92));if(_0x4b4e92['error']){if(_0x4b4e92[_0xd72b('0x15')][_0xd72b('0x16')]===0x1f4){logger[_0xd72b('0x15')](_0xd72b('0x10'),_0x12b97b,_0x4b4e92['error']['message']);return _0x591a4d(_0x4b4e92['error'][_0xd72b('0x17')]);}logger['error'](_0xd72b('0x10'),_0x12b97b,_0x4b4e92[_0xd72b('0x15')]['message']);return _0x150e0a(_0x4b4e92[_0xd72b('0x15')]['message']);}else{logger[_0xd72b('0x18')](_0xd72b('0x10'),_0x12b97b,_0xd72b('0x11'));_0x150e0a(_0x4b4e92[_0xd72b('0x19')][_0xd72b('0x17')]);}})[_0xd72b('0x1a')](function(_0x3c14f4){logger[_0xd72b('0x15')]('SmsAccount,\x20%s,\x20%s',_0x12b97b,_0x3c14f4);_0x591a4d(_0x3c14f4);});});}exports[_0xd72b('0x1b')]=function(_0x67c24c){var _0x16fe28=this;return new Promise(function(_0xfe165d,_0x20cb49){return db[_0xd72b('0x1c')][_0xd72b('0x1d')]({'raw':_0x67c24c[_0xd72b('0x1e')]?_0x67c24c[_0xd72b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x67c24c['options']?_0x67c24c[_0xd72b('0x1e')][_0xd72b('0x1f')]||null:null,'attributes':_0x67c24c[_0xd72b('0x1e')]?_0x67c24c[_0xd72b('0x1e')][_0xd72b('0x20')]||null:null,'include':_0x67c24c[_0xd72b('0x1e')]?_0x67c24c[_0xd72b('0x1e')][_0xd72b('0x21')]?_['map'](_0x67c24c[_0xd72b('0x1e')][_0xd72b('0x21')],function(_0x3855b5){return{'model':db[_0x3855b5[_0xd72b('0x22')]],'as':_0x3855b5['as'],'attributes':_0x3855b5[_0xd72b('0x20')],'include':_0x3855b5[_0xd72b('0x21')]?_[_0xd72b('0x23')](_0x3855b5['include'],function(_0x233be2){return{'model':db[_0x233be2[_0xd72b('0x22')]],'as':_0x233be2['as'],'attributes':_0x233be2[_0xd72b('0x20')],'include':_0x233be2[_0xd72b('0x21')]?_[_0xd72b('0x23')](_0x233be2[_0xd72b('0x21')],function(_0x14cc71){return{'model':db[_0x14cc71[_0xd72b('0x22')]],'as':_0x14cc71['as'],'attributes':_0x14cc71[_0xd72b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51b2bf){logger[_0xd72b('0x18')](_0xd72b('0x1b'),_0x67c24c);logger[_0xd72b('0x12')](_0xd72b('0x1b'),_0x67c24c,JSON[_0xd72b('0x14')](_0x51b2bf));_0xfe165d(_0x51b2bf);})[_0xd72b('0x1a')](function(_0x1ccfdc){logger[_0xd72b('0x15')](_0xd72b('0x1b'),_0x1ccfdc[_0xd72b('0x17')],_0x67c24c);_0x20cb49(_0x16fe28[_0xd72b('0x15')](0x1f4,_0x1ccfdc[_0xd72b('0x17')]));});});}; \ No newline at end of file +var _0x93f3=['include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x93f3,0x123));var _0x393f=function(_0x393c99,_0x24258e){_0x393c99=_0x393c99-0x0;var _0x4b5778=_0x93f3[_0x393c99];return _0x4b5778;};'use strict';var _=require(_0x393f('0x0'));var util=require(_0x393f('0x1'));var moment=require(_0x393f('0x2'));var BPromise=require('bluebird');var rs=require(_0x393f('0x3'));var fs=require('fs');var Redis=require(_0x393f('0x4'));var db=require(_0x393f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x393f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x393f('0x7')][_0x393f('0x8')]({'port':0x232a});config[_0x393f('0x9')]=_[_0x393f('0xa')](config[_0x393f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x393f('0xb'))(new Redis(config[_0x393f('0x9')]));require(_0x393f('0xc'))[_0x393f('0xd')](socket);function respondWithRpcPromise(_0x25a6e8,_0x2d7716,_0x4a2171){return new BPromise(function(_0x21960d,_0x53a519){return client[_0x393f('0xe')](_0x25a6e8,_0x4a2171)[_0x393f('0xf')](function(_0x591b4b){logger[_0x393f('0x10')](_0x393f('0x11'),_0x2d7716,_0x393f('0x12'));logger[_0x393f('0x13')](_0x393f('0x14'),_0x2d7716,_0x393f('0x12'),JSON[_0x393f('0x15')](_0x591b4b));if(_0x591b4b[_0x393f('0x16')]){if(_0x591b4b[_0x393f('0x16')][_0x393f('0x17')]===0x1f4){logger['error'](_0x393f('0x11'),_0x2d7716,_0x591b4b[_0x393f('0x16')][_0x393f('0x18')]);return _0x53a519(_0x591b4b[_0x393f('0x16')][_0x393f('0x18')]);}logger[_0x393f('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2d7716,_0x591b4b['error'][_0x393f('0x18')]);return _0x21960d(_0x591b4b[_0x393f('0x16')][_0x393f('0x18')]);}else{logger[_0x393f('0x10')](_0x393f('0x11'),_0x2d7716,_0x393f('0x12'));_0x21960d(_0x591b4b['result'][_0x393f('0x18')]);}})[_0x393f('0x19')](function(_0x686e57){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2d7716,_0x686e57);_0x53a519(_0x686e57);});});}exports[_0x393f('0x1a')]=function(_0x4491e5){var _0x48e081=this;return new Promise(function(_0x147e9b,_0x1a6511){return db[_0x393f('0x1b')][_0x393f('0x1c')]({'raw':_0x4491e5[_0x393f('0x1d')]?_0x4491e5[_0x393f('0x1d')][_0x393f('0x1e')]===undefined?!![]:![]:!![],'where':_0x4491e5['options']?_0x4491e5[_0x393f('0x1d')][_0x393f('0x1f')]||null:null,'attributes':_0x4491e5['options']?_0x4491e5[_0x393f('0x1d')][_0x393f('0x20')]||null:null,'include':_0x4491e5['options']?_0x4491e5[_0x393f('0x1d')][_0x393f('0x21')]?_[_0x393f('0x22')](_0x4491e5[_0x393f('0x1d')][_0x393f('0x21')],function(_0x5ae3be){return{'model':db[_0x5ae3be['model']],'as':_0x5ae3be['as'],'attributes':_0x5ae3be[_0x393f('0x20')],'include':_0x5ae3be[_0x393f('0x21')]?_['map'](_0x5ae3be[_0x393f('0x21')],function(_0x1544a6){return{'model':db[_0x1544a6[_0x393f('0x23')]],'as':_0x1544a6['as'],'attributes':_0x1544a6[_0x393f('0x20')],'include':_0x1544a6['include']?_[_0x393f('0x22')](_0x1544a6[_0x393f('0x21')],function(_0x124176){return{'model':db[_0x124176[_0x393f('0x23')]],'as':_0x124176['as'],'attributes':_0x124176[_0x393f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x393f('0xf')](function(_0x263344){logger[_0x393f('0x10')](_0x393f('0x1a'),_0x4491e5);logger[_0x393f('0x13')](_0x393f('0x1a'),_0x4491e5,JSON[_0x393f('0x15')](_0x263344));_0x147e9b(_0x263344);})[_0x393f('0x19')](function(_0x159756){logger[_0x393f('0x16')](_0x393f('0x1a'),_0x159756[_0x393f('0x18')],_0x4491e5);_0x1a6511(_0x48e081['error'](0x1f4,_0x159756[_0x393f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f5d7437..9d9e372 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 835c0b9..c9dd7d8 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x288dd6,_0x9b1304){var _0x25e2d1=function(_0x1b47fe){while(--_0x1b47fe){_0x288dd6['push'](_0x288dd6['shift']());}};_0x25e2d1(++_0x9b1304);}(_0xedd9,0xfc));var _0x9edd=function(_0x53aadd,_0x47a51a){_0x53aadd=_0x53aadd-0x0;var _0x5227d5=_0xedd9[_0x53aadd];return _0x5227d5;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _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(_0x285547,_0x1f1211){var _0x5ab672=function(_0x1cbef5){while(--_0x1cbef5){_0x285547['push'](_0x285547['shift']());}};_0x5ab672(++_0x1f1211);}(_0x008c,0x188));var _0xc008=function(_0x34bab7,_0xedfc66){_0x34bab7=_0x34bab7-0x0;var _0x8319f7=_0x008c[_0x34bab7];return _0x8319f7;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f5c35f7..9c9cf9e 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 _0xd1ba=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1c143c,_0x289468){var _0x3600d2=function(_0x1ba853){while(--_0x1ba853){_0x1c143c['push'](_0x1c143c['shift']());}};_0x3600d2(++_0x289468);}(_0xd1ba,0xd5));var _0xad1b=function(_0xd3ccc8,_0x1c4bd3){_0xd3ccc8=_0xd3ccc8-0x0;var _0xcba0c1=_0xd1ba[_0xd3ccc8];return _0xcba0c1;};'use strict';var Sequelize=require(_0xad1b('0x0'));module[_0xad1b('0x1')]={'priority':{'type':Sequelize[_0xad1b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xad1b('0x3')],'allowNull':![],'defaultValue':_0xad1b('0x4')},'appdata':{'type':Sequelize[_0xad1b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xad1b('0x3')],'defaultValue':_0xad1b('0x6')}}; \ No newline at end of file +var _0xbbbb=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5278f9,_0x3a03af){var _0x36c30d=function(_0x4985fc){while(--_0x4985fc){_0x5278f9['push'](_0x5278f9['shift']());}};_0x36c30d(++_0x3a03af);}(_0xbbbb,0x154));var _0xbbbb=function(_0x5e6c25,_0x4ecd3c){_0x5e6c25=_0x5e6c25-0x0;var _0x2a5a38=_0xbbbb[_0x5e6c25];return _0x2a5a38;};'use strict';var Sequelize=require('sequelize');module[_0xbbbb('0x0')]={'priority':{'type':Sequelize[_0xbbbb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbbbb('0x2')],'allowNull':![],'defaultValue':_0xbbbb('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbbbb('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbbbb('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 9fe4680..bb2bce3 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 _0xef3b=['filter','includeAll','include','show','params','length','options','find','catch','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','name','send','index','map','SmsApplication','fieldName','type','key','keys','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL'];(function(_0x534ee3,_0x1274e3){var _0x16883a=function(_0x10a35a){while(--_0x10a35a){_0x534ee3['push'](_0x534ee3['shift']());}};_0x16883a(++_0x1274e3);}(_0xef3b,0x117));var _0xbef3=function(_0x48c54a,_0x1ff66e){_0x48c54a=_0x48c54a-0x0;var _0x51ae6b=_0xef3b[_0x48c54a];return _0x51ae6b;};'use strict';var emlformat=require(_0xbef3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbef3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbef3('0x2'));var moment=require('moment');var BPromise=require(_0xbef3('0x3'));var Mustache=require(_0xbef3('0x4'));var util=require(_0xbef3('0x5'));var path=require(_0xbef3('0x6'));var sox=require('sox');var csv=require(_0xbef3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbef3('0x8'));var _=require(_0xbef3('0x9'));var squel=require('squel');var crypto=require(_0xbef3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbef3('0xb'));var toCsv=require(_0xbef3('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbef3('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbef3('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbef3('0xe'))('api');var utils=require(_0xbef3('0xf'));var config=require(_0xbef3('0x10'));var licenseUtil=require(_0xbef3('0x11'));var db=require(_0xbef3('0x12'))['db'];function respondWithStatusCode(_0x29f750,_0x449368){_0x449368=_0x449368||0xcc;return function(_0x5658b6){if(_0x5658b6){return _0x29f750[_0xbef3('0x13')](_0x449368);}return _0x29f750[_0xbef3('0x14')](_0x449368)[_0xbef3('0x15')]();};}function respondWithResult(_0x4ac7f6,_0x1ac871){_0x1ac871=_0x1ac871||0xc8;return function(_0x33a48b){if(_0x33a48b){return _0x4ac7f6[_0xbef3('0x14')](_0x1ac871)['json'](_0x33a48b);}};}function respondWithFilteredResult(_0xaf7f9f,_0x576f28){return function(_0x553a89){if(_0x553a89){var _0x390897=typeof _0x576f28['offset']===_0xbef3('0x16')&&typeof _0x576f28[_0xbef3('0x17')]==='undefined';var _0x187b9d=_0x553a89['count'];var _0x2b5281=_0x390897?0x0:_0x576f28[_0xbef3('0x18')];var _0x4b9c4c=_0x390897?_0x553a89[_0xbef3('0x19')]:_0x576f28[_0xbef3('0x18')]+_0x576f28[_0xbef3('0x17')];var _0xcf7d0f;if(_0x4b9c4c>=_0x187b9d){_0x4b9c4c=_0x187b9d;_0xcf7d0f=0xc8;}else{_0xcf7d0f=0xce;}_0xaf7f9f['status'](_0xcf7d0f);return _0xaf7f9f[_0xbef3('0x1a')]('Content-Range',_0x2b5281+'-'+_0x4b9c4c+'/'+_0x187b9d)['json'](_0x553a89);}return null;};}function patchUpdates(_0x371ac3){return function(_0x220454){try{jsonpatch[_0xbef3('0x1b')](_0x220454,_0x371ac3,!![]);}catch(_0x277423){return BPromise[_0xbef3('0x1c')](_0x277423);}return _0x220454[_0xbef3('0x1d')]();};}function saveUpdates(_0x4c29de,_0x5305ef){return function(_0xcb6e2c){if(_0xcb6e2c){return _0xcb6e2c[_0xbef3('0x1e')](_0x4c29de)[_0xbef3('0x1f')](function(_0x4a3c47){return _0x4a3c47;});}return null;};}function removeEntity(_0x5e646b,_0x48974e){return function(_0xb3c724){if(_0xb3c724){return _0xb3c724[_0xbef3('0x20')]()['then'](function(){_0x5e646b[_0xbef3('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x492081,_0x5c3045){return function(_0x271b89){if(!_0x271b89){_0x492081['sendStatus'](0x194);}return _0x271b89;};}function handleError(_0x116386,_0x2d5b1b){_0x2d5b1b=_0x2d5b1b||0x1f4;return function(_0x186c79){logger['error'](_0x186c79['stack']);if(_0x186c79[_0xbef3('0x21')]){delete _0x186c79['name'];}_0x116386['status'](_0x2d5b1b)[_0xbef3('0x22')](_0x186c79);};}exports[_0xbef3('0x23')]=function(_0x48cb58,_0x4e0da5){var _0xa34430={},_0x25a442={},_0xdbbb45={'count':0x0,'rows':[]};var _0x3fc5b3=_[_0xbef3('0x24')](db[_0xbef3('0x25')]['rawAttributes'],function(_0x1d9c8c){return{'name':_0x1d9c8c[_0xbef3('0x26')],'type':_0x1d9c8c[_0xbef3('0x27')][_0xbef3('0x28')]};});_0x25a442['model']=_[_0xbef3('0x24')](_0x3fc5b3,_0xbef3('0x21'));_0x25a442['query']=_[_0xbef3('0x29')](_0x48cb58[_0xbef3('0x2a')]);_0x25a442['filters']=_['intersection'](_0x25a442[_0xbef3('0x2b')],_0x25a442[_0xbef3('0x2a')]);_0xa34430['attributes']=_[_0xbef3('0x2c')](_0x25a442[_0xbef3('0x2b')],qs[_0xbef3('0x2d')](_0x48cb58[_0xbef3('0x2a')][_0xbef3('0x2d')]));_0xa34430['attributes']=_0xa34430[_0xbef3('0x2e')]['length']?_0xa34430['attributes']:_0x25a442[_0xbef3('0x2b')];if(!_0x48cb58[_0xbef3('0x2a')][_0xbef3('0x2f')](_0xbef3('0x30'))){_0xa34430['limit']=qs['limit'](_0x48cb58[_0xbef3('0x2a')][_0xbef3('0x17')]);_0xa34430[_0xbef3('0x18')]=qs[_0xbef3('0x18')](_0x48cb58['query'][_0xbef3('0x18')]);}_0xa34430[_0xbef3('0x31')]=qs[_0xbef3('0x32')](_0x48cb58[_0xbef3('0x2a')][_0xbef3('0x32')]);_0xa34430[_0xbef3('0x33')]=qs[_0xbef3('0x34')](_[_0xbef3('0x35')](_0x48cb58[_0xbef3('0x2a')],_0x25a442[_0xbef3('0x34')]),_0x3fc5b3);if(_0x48cb58[_0xbef3('0x2a')]['filter']){_0xa34430[_0xbef3('0x33')]=_[_0xbef3('0x36')](_0xa34430[_0xbef3('0x33')],{'$or':_[_0xbef3('0x24')](_0x3fc5b3,function(_0x1730b6){if(_0x1730b6[_0xbef3('0x27')]!==_0xbef3('0x37')){var _0x4a3ebc={};_0x4a3ebc[_0x1730b6[_0xbef3('0x21')]]={'$like':'%'+_0x48cb58[_0xbef3('0x2a')][_0xbef3('0x38')]+'%'};return _0x4a3ebc;}})});}_0xa34430=_[_0xbef3('0x36')]({},_0xa34430,_0x48cb58['options']);var _0x28c7c6={'where':_0xa34430[_0xbef3('0x33')]};return db[_0xbef3('0x25')][_0xbef3('0x19')](_0x28c7c6)[_0xbef3('0x1f')](function(_0x2836c5){_0xdbbb45[_0xbef3('0x19')]=_0x2836c5;if(_0x48cb58['query'][_0xbef3('0x39')]){_0xa34430[_0xbef3('0x3a')]=[{'all':!![]}];}return db[_0xbef3('0x25')]['findAll'](_0xa34430);})[_0xbef3('0x1f')](function(_0x2c0078){_0xdbbb45['rows']=_0x2c0078;return _0xdbbb45;})[_0xbef3('0x1f')](respondWithFilteredResult(_0x4e0da5,_0xa34430))['catch'](handleError(_0x4e0da5,null));};exports[_0xbef3('0x3b')]=function(_0x2533ec,_0x19a0da){var _0x309b7b={'raw':!![],'where':{'id':_0x2533ec[_0xbef3('0x3c')]['id']}},_0x5be711={};_0x5be711[_0xbef3('0x2b')]=_[_0xbef3('0x29')](db[_0xbef3('0x25')]['rawAttributes']);_0x5be711[_0xbef3('0x2a')]=_[_0xbef3('0x29')](_0x2533ec[_0xbef3('0x2a')]);_0x5be711[_0xbef3('0x34')]=_[_0xbef3('0x2c')](_0x5be711[_0xbef3('0x2b')],_0x5be711[_0xbef3('0x2a')]);_0x309b7b[_0xbef3('0x2e')]=_[_0xbef3('0x2c')](_0x5be711[_0xbef3('0x2b')],qs[_0xbef3('0x2d')](_0x2533ec['query'][_0xbef3('0x2d')]));_0x309b7b[_0xbef3('0x2e')]=_0x309b7b[_0xbef3('0x2e')][_0xbef3('0x3d')]?_0x309b7b[_0xbef3('0x2e')]:_0x5be711[_0xbef3('0x2b')];if(_0x2533ec[_0xbef3('0x2a')][_0xbef3('0x39')]){_0x309b7b[_0xbef3('0x3a')]=[{'all':!![]}];}_0x309b7b=_[_0xbef3('0x36')]({},_0x309b7b,_0x2533ec[_0xbef3('0x3e')]);return db['SmsApplication'][_0xbef3('0x3f')](_0x309b7b)['then'](handleEntityNotFound(_0x19a0da,null))[_0xbef3('0x1f')](respondWithResult(_0x19a0da,null))[_0xbef3('0x40')](handleError(_0x19a0da,null));};exports['create']=function(_0x19b439,_0x173fd4){return db['SmsApplication'][_0xbef3('0x41')](_0x19b439['body'],{})[_0xbef3('0x1f')](respondWithResult(_0x173fd4,0xc9))['catch'](handleError(_0x173fd4,null));};exports[_0xbef3('0x1e')]=function(_0x1b5601,_0x29b90c){if(_0x1b5601[_0xbef3('0x42')]['id']){delete _0x1b5601[_0xbef3('0x42')]['id'];}return db[_0xbef3('0x25')][_0xbef3('0x3f')]({'where':{'id':_0x1b5601['params']['id']}})[_0xbef3('0x1f')](handleEntityNotFound(_0x29b90c,null))[_0xbef3('0x1f')](saveUpdates(_0x1b5601[_0xbef3('0x42')],null))['then'](respondWithResult(_0x29b90c,null))[_0xbef3('0x40')](handleError(_0x29b90c,null));};exports[_0xbef3('0x20')]=function(_0x3a6039,_0x1f322c){return db[_0xbef3('0x25')][_0xbef3('0x3f')]({'where':{'id':_0x3a6039['params']['id']}})[_0xbef3('0x1f')](handleEntityNotFound(_0x1f322c,null))[_0xbef3('0x1f')](removeEntity(_0x1f322c,null))['catch'](handleError(_0x1f322c,null));}; \ No newline at end of file +var _0xc452=['apply','save','update','destroy','then','status','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','count','include','SmsApplication','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','fs-extra','lodash','jsforce','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','end','json','offset','undefined','limit','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc452,0x155));var _0x2c45=function(_0x3bc56d,_0x34890e){_0x3bc56d=_0x3bc56d-0x0;var _0x3e20a0=_0xc452[_0x3bc56d];return _0x3e20a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c45('0x0'));var zipdir=require(_0x2c45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c45('0x2'));var moment=require(_0x2c45('0x3'));var BPromise=require(_0x2c45('0x4'));var Mustache=require('mustache');var util=require(_0x2c45('0x5'));var path=require(_0x2c45('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c45('0x7'));var _=require(_0x2c45('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c45('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2c45('0xa'));var querystring=require(_0x2c45('0xb'));var Papa=require(_0x2c45('0xc'));var Redis=require(_0x2c45('0xd'));var authService=require(_0x2c45('0xe'));var qs=require(_0x2c45('0xf'));var as=require(_0x2c45('0x10'));var hardwareService=require(_0x2c45('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2c45('0x12'));var config=require(_0x2c45('0x13'));var licenseUtil=require(_0x2c45('0x14'));var db=require(_0x2c45('0x15'))['db'];function respondWithStatusCode(_0x17d972,_0x184fba){_0x184fba=_0x184fba||0xcc;return function(_0x2107bb){if(_0x2107bb){return _0x17d972['sendStatus'](_0x184fba);}return _0x17d972['status'](_0x184fba)[_0x2c45('0x16')]();};}function respondWithResult(_0x57d4ad,_0x2089ee){_0x2089ee=_0x2089ee||0xc8;return function(_0x548158){if(_0x548158){return _0x57d4ad['status'](_0x2089ee)[_0x2c45('0x17')](_0x548158);}};}function respondWithFilteredResult(_0x34b428,_0x559d16){return function(_0x1c9086){if(_0x1c9086){var _0x45c771=typeof _0x559d16[_0x2c45('0x18')]===_0x2c45('0x19')&&typeof _0x559d16[_0x2c45('0x1a')]===_0x2c45('0x19');var _0x3dc0ce=_0x1c9086['count'];var _0x44a29d=_0x45c771?0x0:_0x559d16[_0x2c45('0x18')];var _0x24b754=_0x45c771?_0x1c9086['count']:_0x559d16['offset']+_0x559d16[_0x2c45('0x1a')];var _0x38096b;if(_0x24b754>=_0x3dc0ce){_0x24b754=_0x3dc0ce;_0x38096b=0xc8;}else{_0x38096b=0xce;}_0x34b428['status'](_0x38096b);return _0x34b428[_0x2c45('0x1b')](_0x2c45('0x1c'),_0x44a29d+'-'+_0x24b754+'/'+_0x3dc0ce)['json'](_0x1c9086);}return null;};}function patchUpdates(_0x4c4096){return function(_0x55cc3d){try{jsonpatch[_0x2c45('0x1d')](_0x55cc3d,_0x4c4096,!![]);}catch(_0x37752f){return BPromise['reject'](_0x37752f);}return _0x55cc3d[_0x2c45('0x1e')]();};}function saveUpdates(_0x38415d,_0x118519){return function(_0x2eec11){if(_0x2eec11){return _0x2eec11[_0x2c45('0x1f')](_0x38415d)['then'](function(_0x2d5c29){return _0x2d5c29;});}return null;};}function removeEntity(_0xfd372d,_0xa12bf1){return function(_0x23aa03){if(_0x23aa03){return _0x23aa03[_0x2c45('0x20')]()[_0x2c45('0x21')](function(){_0xfd372d[_0x2c45('0x22')](0xcc)[_0x2c45('0x16')]();});}};}function handleEntityNotFound(_0x2f179a,_0x491fe1){return function(_0x44222a){if(!_0x44222a){_0x2f179a[_0x2c45('0x23')](0x194);}return _0x44222a;};}function handleError(_0xa6aa7b,_0x43220c){_0x43220c=_0x43220c||0x1f4;return function(_0x411ad4){logger[_0x2c45('0x24')](_0x411ad4[_0x2c45('0x25')]);if(_0x411ad4[_0x2c45('0x26')]){delete _0x411ad4[_0x2c45('0x26')];}_0xa6aa7b['status'](_0x43220c)[_0x2c45('0x27')](_0x411ad4);};}exports[_0x2c45('0x28')]=function(_0x42a0ba,_0x29f5d2){var _0x55e07a={},_0x2dfce9={},_0x1c71f0={'count':0x0,'rows':[]};var _0x4b2488=_[_0x2c45('0x29')](db['SmsApplication']['rawAttributes'],function(_0x1eab9c){return{'name':_0x1eab9c[_0x2c45('0x2a')],'type':_0x1eab9c['type'][_0x2c45('0x2b')]};});_0x2dfce9[_0x2c45('0x2c')]=_[_0x2c45('0x29')](_0x4b2488,_0x2c45('0x26'));_0x2dfce9[_0x2c45('0x2d')]=_[_0x2c45('0x2e')](_0x42a0ba[_0x2c45('0x2d')]);_0x2dfce9[_0x2c45('0x2f')]=_[_0x2c45('0x30')](_0x2dfce9[_0x2c45('0x2c')],_0x2dfce9[_0x2c45('0x2d')]);_0x55e07a[_0x2c45('0x31')]=_[_0x2c45('0x30')](_0x2dfce9[_0x2c45('0x2c')],qs[_0x2c45('0x32')](_0x42a0ba[_0x2c45('0x2d')][_0x2c45('0x32')]));_0x55e07a[_0x2c45('0x31')]=_0x55e07a[_0x2c45('0x31')]['length']?_0x55e07a[_0x2c45('0x31')]:_0x2dfce9[_0x2c45('0x2c')];if(!_0x42a0ba['query'][_0x2c45('0x33')](_0x2c45('0x34'))){_0x55e07a[_0x2c45('0x1a')]=qs['limit'](_0x42a0ba[_0x2c45('0x2d')][_0x2c45('0x1a')]);_0x55e07a[_0x2c45('0x18')]=qs[_0x2c45('0x18')](_0x42a0ba[_0x2c45('0x2d')][_0x2c45('0x18')]);}_0x55e07a[_0x2c45('0x35')]=qs[_0x2c45('0x36')](_0x42a0ba[_0x2c45('0x2d')][_0x2c45('0x36')]);_0x55e07a[_0x2c45('0x37')]=qs[_0x2c45('0x2f')](_[_0x2c45('0x38')](_0x42a0ba[_0x2c45('0x2d')],_0x2dfce9[_0x2c45('0x2f')]),_0x4b2488);if(_0x42a0ba[_0x2c45('0x2d')][_0x2c45('0x39')]){_0x55e07a[_0x2c45('0x37')]=_[_0x2c45('0x3a')](_0x55e07a[_0x2c45('0x37')],{'$or':_[_0x2c45('0x29')](_0x4b2488,function(_0x49708a){if(_0x49708a[_0x2c45('0x3b')]!=='VIRTUAL'){var _0x2346f4={};_0x2346f4[_0x49708a['name']]={'$like':'%'+_0x42a0ba['query'][_0x2c45('0x39')]+'%'};return _0x2346f4;}})});}_0x55e07a=_['merge']({},_0x55e07a,_0x42a0ba['options']);var _0x1334a3={'where':_0x55e07a[_0x2c45('0x37')]};return db['SmsApplication'][_0x2c45('0x3c')](_0x1334a3)[_0x2c45('0x21')](function(_0x1f7687){_0x1c71f0[_0x2c45('0x3c')]=_0x1f7687;if(_0x42a0ba['query']['includeAll']){_0x55e07a[_0x2c45('0x3d')]=[{'all':!![]}];}return db[_0x2c45('0x3e')][_0x2c45('0x3f')](_0x55e07a);})['then'](function(_0x2c7ce8){_0x1c71f0[_0x2c45('0x40')]=_0x2c7ce8;return _0x1c71f0;})[_0x2c45('0x21')](respondWithFilteredResult(_0x29f5d2,_0x55e07a))[_0x2c45('0x41')](handleError(_0x29f5d2,null));};exports[_0x2c45('0x42')]=function(_0x1b8ecb,_0x1e7deb){var _0x333933={'raw':!![],'where':{'id':_0x1b8ecb[_0x2c45('0x43')]['id']}},_0x28463d={};_0x28463d[_0x2c45('0x2c')]=_['keys'](db[_0x2c45('0x3e')][_0x2c45('0x44')]);_0x28463d['query']=_[_0x2c45('0x2e')](_0x1b8ecb[_0x2c45('0x2d')]);_0x28463d[_0x2c45('0x2f')]=_['intersection'](_0x28463d['model'],_0x28463d['query']);_0x333933[_0x2c45('0x31')]=_[_0x2c45('0x30')](_0x28463d[_0x2c45('0x2c')],qs['fields'](_0x1b8ecb[_0x2c45('0x2d')][_0x2c45('0x32')]));_0x333933[_0x2c45('0x31')]=_0x333933[_0x2c45('0x31')]['length']?_0x333933['attributes']:_0x28463d[_0x2c45('0x2c')];if(_0x1b8ecb[_0x2c45('0x2d')][_0x2c45('0x45')]){_0x333933[_0x2c45('0x3d')]=[{'all':!![]}];}_0x333933=_['merge']({},_0x333933,_0x1b8ecb[_0x2c45('0x46')]);return db[_0x2c45('0x3e')][_0x2c45('0x47')](_0x333933)[_0x2c45('0x21')](handleEntityNotFound(_0x1e7deb,null))[_0x2c45('0x21')](respondWithResult(_0x1e7deb,null))[_0x2c45('0x41')](handleError(_0x1e7deb,null));};exports[_0x2c45('0x48')]=function(_0x21909c,_0x276027){return db[_0x2c45('0x3e')][_0x2c45('0x48')](_0x21909c['body'],{})['then'](respondWithResult(_0x276027,0xc9))[_0x2c45('0x41')](handleError(_0x276027,null));};exports[_0x2c45('0x1f')]=function(_0x7edb13,_0x42651d){if(_0x7edb13['body']['id']){delete _0x7edb13[_0x2c45('0x49')]['id'];}return db['SmsApplication'][_0x2c45('0x47')]({'where':{'id':_0x7edb13[_0x2c45('0x43')]['id']}})[_0x2c45('0x21')](handleEntityNotFound(_0x42651d,null))[_0x2c45('0x21')](saveUpdates(_0x7edb13['body'],null))['then'](respondWithResult(_0x42651d,null))[_0x2c45('0x41')](handleError(_0x42651d,null));};exports[_0x2c45('0x20')]=function(_0x103b9b,_0x5137d0){return db[_0x2c45('0x3e')]['find']({'where':{'id':_0x103b9b[_0x2c45('0x43')]['id']}})['then'](handleEntityNotFound(_0x5137d0,null))[_0x2c45('0x21')](removeEntity(_0x5137d0,null))[_0x2c45('0x41')](handleError(_0x5137d0,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 584d845..7a09139 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 _0xe8fa=['./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x486c23,_0x4f12a0){var _0x54421a=function(_0x580faa){while(--_0x580faa){_0x486c23['push'](_0x486c23['shift']());}};_0x54421a(++_0x4f12a0);}(_0xe8fa,0x15a));var _0xae8f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xe8fa[_0x500419];return _0x241c1a;};'use strict';var _=require(_0xae8f('0x0'));var util=require('util');var logger=require(_0xae8f('0x1'))('api');var moment=require(_0xae8f('0x2'));var BPromise=require(_0xae8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae8f('0x4'));var rimraf=require('rimraf');var config=require(_0xae8f('0x5'));var attributes=require(_0xae8f('0x6'));module['exports']=function(_0x5a1d00,_0x565028){return _0x5a1d00[_0xae8f('0x7')](_0xae8f('0x8'),attributes,{'tableName':_0xae8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xae8f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x514e=['define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x581220,_0x39fe06){var _0x6578cd=function(_0x13b514){while(--_0x13b514){_0x581220['push'](_0x581220['shift']());}};_0x6578cd(++_0x39fe06);}(_0x514e,0x146));var _0xe514=function(_0x3d5244,_0x4a98bc){_0x3d5244=_0x3d5244-0x0;var _0x47f052=_0x514e[_0x3d5244];return _0x47f052;};'use strict';var _=require(_0xe514('0x0'));var util=require(_0xe514('0x1'));var logger=require(_0xe514('0x2'))(_0xe514('0x3'));var moment=require('moment');var BPromise=require(_0xe514('0x4'));var rp=require(_0xe514('0x5'));var fs=require('fs');var path=require(_0xe514('0x6'));var rimraf=require(_0xe514('0x7'));var config=require(_0xe514('0x8'));var attributes=require(_0xe514('0x9'));module['exports']=function(_0x46a1d2,_0x12fda1){return _0x46a1d2[_0xe514('0xa')](_0xe514('0xb'),attributes,{'tableName':_0xe514('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe514('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index a245e7e..06de4fd 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 _0x7c71=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x24e02e,_0x523ed9){var _0xe5e064=function(_0x40212b){while(--_0x40212b){_0x24e02e['push'](_0x24e02e['shift']());}};_0xe5e064(++_0x523ed9);}(_0x7c71,0x177));var _0x17c7=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x7c71[_0x4687df];return _0x32eaef;};'use strict';var _=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));var moment=require(_0x17c7('0x2'));var BPromise=require(_0x17c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17c7('0x4'));var db=require(_0x17c7('0x5'))['db'];var utils=require(_0x17c7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x17c7('0x7'));var jayson=require(_0x17c7('0x8'));var client=jayson[_0x17c7('0x9')][_0x17c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c061b,_0xf284a2,_0x1ff4ec){return new BPromise(function(_0x50feb0,_0x13fdad){return client[_0x17c7('0xb')](_0x3c061b,_0x1ff4ec)[_0x17c7('0xc')](function(_0xdb3575){logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));logger[_0x17c7('0x10')](_0x17c7('0x11'),_0xf284a2,_0x17c7('0xf'),JSON['stringify'](_0xdb3575));if(_0xdb3575['error']){if(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x13')]===0x1f4){logger['error'](_0x17c7('0xe'),_0xf284a2,_0xdb3575[_0x17c7('0x12')]['message']);return _0x13fdad(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0xf284a2,_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);return _0x50feb0(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}else{logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));_0x50feb0(_0xdb3575[_0x17c7('0x15')][_0x17c7('0x14')]);}})[_0x17c7('0x16')](function(_0x296f9c){logger[_0x17c7('0x12')]('SmsApplication,\x20%s,\x20%s',_0xf284a2,_0x296f9c);_0x13fdad(_0x296f9c);});});} \ No newline at end of file +var _0xc599=['rpc','../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4544cd,_0x3da8a3){var _0x477de0=function(_0xb16f66){while(--_0xb16f66){_0x4544cd['push'](_0x4544cd['shift']());}};_0x477de0(++_0x3da8a3);}(_0xc599,0x1b2));var _0x9c59=function(_0x5c50f7,_0x312a25){_0x5c50f7=_0x5c50f7-0x0;var _0x41aa2d=_0xc599[_0x5c50f7];return _0x41aa2d;};'use strict';var _=require('lodash');var util=require(_0x9c59('0x0'));var moment=require('moment');var BPromise=require(_0x9c59('0x1'));var rs=require(_0x9c59('0x2'));var fs=require('fs');var Redis=require(_0x9c59('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c59('0x4'));var logger=require(_0x9c59('0x5'))(_0x9c59('0x6'));var config=require(_0x9c59('0x7'));var jayson=require(_0x9c59('0x8'));var client=jayson[_0x9c59('0x9')][_0x9c59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a92a1,_0x5eb661,_0x23169c){return new BPromise(function(_0x5ae4ab,_0x1220ad){return client['request'](_0x4a92a1,_0x23169c)[_0x9c59('0xb')](function(_0x458903){logger[_0x9c59('0xc')](_0x9c59('0xd'),_0x5eb661,'request\x20sent');logger['debug'](_0x9c59('0xe'),_0x5eb661,'request\x20sent',JSON[_0x9c59('0xf')](_0x458903));if(_0x458903['error']){if(_0x458903[_0x9c59('0x10')]['code']===0x1f4){logger[_0x9c59('0x10')](_0x9c59('0xd'),_0x5eb661,_0x458903[_0x9c59('0x10')]['message']);return _0x1220ad(_0x458903['error']['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x5eb661,_0x458903[_0x9c59('0x10')][_0x9c59('0x11')]);return _0x5ae4ab(_0x458903[_0x9c59('0x10')][_0x9c59('0x11')]);}else{logger['info'](_0x9c59('0xd'),_0x5eb661,_0x9c59('0x12'));_0x5ae4ab(_0x458903[_0x9c59('0x13')]['message']);}})['catch'](function(_0x4d6ca7){logger[_0x9c59('0x10')](_0x9c59('0xd'),_0x5eb661,_0x4d6ca7);_0x1220ad(_0x4d6ca7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3058bb9..2815ecc 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 _0x0972=['tracked','sms','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x14604a,_0x341081){var _0x22661d=function(_0x27900a){while(--_0x27900a){_0x14604a['push'](_0x14604a['shift']());}};_0x22661d(++_0x341081);}(_0x0972,0x64));var _0x2097=function(_0x241af1,_0xf80087){_0x241af1=_0x241af1-0x0;var _0x5bdfee=_0x0972[_0x241af1];return _0x5bdfee;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var fs_extra=require(_0x2097('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var controller=require(_0x2097('0x6'));router[_0x2097('0x7')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0x7')]('/describe',auth[_0x2097('0x8')](),controller[_0x2097('0xa')]);router[_0x2097('0x7')](_0x2097('0xb'),auth[_0x2097('0x8')](),controller['show']);router[_0x2097('0x7')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0xd')]);router[_0x2097('0x7')](_0x2097('0xe'),auth[_0x2097('0x8')](),controller[_0x2097('0xf')]);router[_0x2097('0x10')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x11')]);router[_0x2097('0x10')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0x12')]);router[_0x2097('0x10')](_0x2097('0x13'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')](_0x2097('0x15'),'smsinteraction:addtags'),controller[_0x2097('0x16')]);router[_0x2097('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x2097('0x15'),'smsinteraction:update'),controller[_0x2097('0x18')]);router[_0x2097('0x19')](_0x2097('0xb'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')]('sms',_0x2097('0x1a')),controller[_0x2097('0x1b')]);router[_0x2097('0x19')](_0x2097('0x13'),auth[_0x2097('0x8')](),controller[_0x2097('0x1c')]);module[_0x2097('0x1d')]=router; \ No newline at end of file +var _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a329d,_0x55e6c6){var _0x1aaf90=function(_0x555bdc){while(--_0x555bdc){_0x3a329d['push'](_0x3a329d['shift']());}};_0x1aaf90(++_0x55e6c6);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 42257d1..cf9b9df 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 _0xe35c=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x3df41c,_0x2c4f5c){var _0x56cc7b=function(_0xcba7af){while(--_0xcba7af){_0x3df41c['push'](_0x3df41c['shift']());}};_0x56cc7b(++_0x2c4f5c);}(_0xe35c,0x146));var _0xce35=function(_0x33e6be,_0x4207eb){_0x33e6be=_0x33e6be-0x0;var _0x4e2008=_0xe35c[_0x33e6be];return _0x4e2008;};'use strict';var Sequelize=require(_0xce35('0x0'));var moment=require(_0xce35('0x1'));module[_0xce35('0x2')]={'closed':{'type':Sequelize[_0xce35('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce35('0x4')]},'disposition':{'type':Sequelize[_0xce35('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xce35('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xce35('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xce35('0x6')]('in',_0xce35('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xce35('0x6')]('in',_0xce35('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xce35('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf4d9=['BOOLEAN','DATE','STRING','out','ENUM','sequelize','exports'];(function(_0x4c8057,_0x4c381c){var _0x4c3928=function(_0x54bdbd){while(--_0x54bdbd){_0x4c8057['push'](_0x4c8057['shift']());}};_0x4c3928(++_0x4c381c);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x4007a0,_0x5e2a52){_0x4007a0=_0x4007a0-0x0;var _0x16801a=_0xf4d9[_0x4007a0];return _0x16801a;};'use strict';var Sequelize=require(_0x9f4d('0x0'));var moment=require('moment');module[_0x9f4d('0x1')]={'closed':{'type':Sequelize[_0x9f4d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9f4d('0x3')]},'disposition':{'type':Sequelize[_0x9f4d('0x4')]},'secondDisposition':{'type':Sequelize[_0x9f4d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9f4d('0x4')]},'phone':{'type':Sequelize[_0x9f4d('0x4')]},'read1stAt':{'type':Sequelize[_0x9f4d('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9f4d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9f4d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9f4d('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9f4d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 915a9e2..c29785f 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 _0xf014=['o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','SmsMessage','ids','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','color','emit','smsInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','N.A.','closed','disposition','direction','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','fullname','TagIds','Tags','split','forEach','push','catch','index','map','SmsInteraction','rawAttributes','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','end','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax'];(function(_0x288e1e,_0x4ca6aa){var _0x2819c9=function(_0x726034){while(--_0x726034){_0x288e1e['push'](_0x288e1e['shift']());}};_0x2819c9(++_0x4ca6aa);}(_0xf014,0x126));var _0x4f01=function(_0x911aa,_0x5cb8b5){_0x911aa=_0x911aa-0x0;var _0x327202=_0xf014[_0x911aa];return _0x327202;};'use strict';var emlformat=require(_0x4f01('0x0'));var rimraf=require(_0x4f01('0x1'));var zipdir=require(_0x4f01('0x2'));var jsonpatch=require(_0x4f01('0x3'));var rp=require(_0x4f01('0x4'));var moment=require(_0x4f01('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f01('0x6'));var util=require(_0x4f01('0x7'));var path=require(_0x4f01('0x8'));var sox=require(_0x4f01('0x9'));var csv=require(_0x4f01('0xa'));var ejs=require(_0x4f01('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f01('0xc'));var squel=require(_0x4f01('0xd'));var crypto=require('crypto');var jsforce=require(_0x4f01('0xe'));var deskjs=require(_0x4f01('0xf'));var toCsv=require(_0x4f01('0xa'));var querystring=require('querystring');var Papa=require(_0x4f01('0x10'));var Redis=require(_0x4f01('0x11'));var authService=require(_0x4f01('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4f01('0x13'));var pdf=require(_0x4f01('0x14'));var hardwareService=require(_0x4f01('0x15'));var logger=require(_0x4f01('0x16'))(_0x4f01('0x17'));var utils=require(_0x4f01('0x18'));var config=require(_0x4f01('0x19'));var licenseUtil=require(_0x4f01('0x1a'));var db=require(_0x4f01('0x1b'))['db'];config['redis']=_['defaults'](config[_0x4f01('0x1c')],{'host':_0x4f01('0x1d'),'port':0x18eb});var socket=require(_0x4f01('0x1e'))(new Redis(config[_0x4f01('0x1c')]));require(_0x4f01('0x1f'))['register'](socket);function respondWithStatusCode(_0x4938d5,_0xd3e64){_0xd3e64=_0xd3e64||0xcc;return function(_0x51c73c){if(_0x51c73c){return _0x4938d5[_0x4f01('0x20')](_0xd3e64);}return _0x4938d5[_0x4f01('0x21')](_0xd3e64)['end']();};}function respondWithResult(_0x3f536a,_0x39e07f){_0x39e07f=_0x39e07f||0xc8;return function(_0x422f4e){if(_0x422f4e){return _0x3f536a[_0x4f01('0x21')](_0x39e07f)[_0x4f01('0x22')](_0x422f4e);}};}function respondWithFilteredResult(_0x527504,_0x2b5a9a){return function(_0x425548){if(_0x425548){var _0x411c0d=typeof _0x2b5a9a['offset']==='undefined'&&typeof _0x2b5a9a[_0x4f01('0x23')]==='undefined';var _0x55b97a=_0x425548[_0x4f01('0x24')];var _0x2cae64=_0x411c0d?0x0:_0x2b5a9a[_0x4f01('0x25')];var _0x17df0f=_0x411c0d?_0x425548[_0x4f01('0x24')]:_0x2b5a9a['offset']+_0x2b5a9a[_0x4f01('0x23')];var _0x440e59;if(_0x17df0f>=_0x55b97a){_0x17df0f=_0x55b97a;_0x440e59=0xc8;}else{_0x440e59=0xce;}_0x527504[_0x4f01('0x21')](_0x440e59);return _0x527504[_0x4f01('0x26')](_0x4f01('0x27'),_0x2cae64+'-'+_0x17df0f+'/'+_0x55b97a)[_0x4f01('0x22')](_0x425548);}return null;};}function patchUpdates(_0x4c2df8){return function(_0x76db1b){try{jsonpatch['apply'](_0x76db1b,_0x4c2df8,!![]);}catch(_0x2911dc){return BPromise[_0x4f01('0x28')](_0x2911dc);}return _0x76db1b[_0x4f01('0x29')]();};}function saveUpdates(_0x359696,_0x54ced2){return function(_0x4c98aa){if(_0x4c98aa){return _0x4c98aa[_0x4f01('0x2a')](_0x359696)[_0x4f01('0x2b')](function(_0x410560){return _0x410560;});}return null;};}function removeEntity(_0x2250af,_0x528ba2){return function(_0x247bea){if(_0x247bea){return _0x247bea[_0x4f01('0x2c')]()['then'](function(){_0x2250af[_0x4f01('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x328e5d,_0x297a1c){return function(_0x3f7ec2){if(!_0x3f7ec2){_0x328e5d[_0x4f01('0x20')](0x194);}return _0x3f7ec2;};}function handleError(_0x2cafcf,_0x186b1d){_0x186b1d=_0x186b1d||0x1f4;return function(_0x79055){logger['error'](_0x79055[_0x4f01('0x2d')]);if(_0x79055[_0x4f01('0x2e')]){delete _0x79055['name'];}_0x2cafcf['status'](_0x186b1d)['send'](_0x79055);};}function getInteractionUsers(_0x6e846d,_0x5bf6ba){return new BPromise(function(_0x5596e6,_0x57d1e7){try{if(_0x5bf6ba[_0x6e846d['id']]){_0x6e846d['Users']=_['map'](_0x5bf6ba[_0x6e846d['id']],function(_0x59e4ca){return{'id':_0x59e4ca['id'],'fullname':_0x59e4ca[_0x4f01('0x2f')]};});}}catch(_0x109bfe){_0x57d1e7(_0x109bfe);}_0x5596e6(_0x6e846d);});}function getInteractionTags(_0x435b1e,_0xca505c){return new BPromise(function(_0x4c9d9b,_0x473f23){try{if(_0x435b1e[_0x4f01('0x30')]){_0x435b1e[_0x4f01('0x31')]=[];_0x435b1e[_0x4f01('0x30')][_0x4f01('0x32')](',')[_0x4f01('0x33')](function(_0x423725){_0x435b1e[_0x4f01('0x31')][_0x4f01('0x34')](_0xca505c[_0x423725]);});}delete _0x435b1e[_0x4f01('0x30')];}catch(_0x4c10c0){_0x473f23(_0x4c10c0);}_0x4c9d9b(_0x435b1e);});}function updateSmsInteraction(_0x28e375,_0x1d2fc8,_0x191bc9){return new BPromise(function(_0x118dd0,_0x256434){return getInteractionUsers(_0x28e375,_0x191bc9)[_0x4f01('0x2b')](function(_0x53a251){return getInteractionTags(_0x53a251,_0x1d2fc8);})[_0x4f01('0x2b')](function(_0x16ad23){_0x118dd0(_0x16ad23);})[_0x4f01('0x35')](function(_0x398cbf){_0x256434(_0x398cbf);});});}exports[_0x4f01('0x36')]=function(_0x564915,_0x46e829){var _0x33c119={},_0x57c336={},_0x316f0f={'count':0x0,'rows':[]};var _0x44a239=_[_0x4f01('0x37')](db[_0x4f01('0x38')][_0x4f01('0x39')],function(_0x27c986){return{'name':_0x27c986['fieldName'],'type':_0x27c986['type'][_0x4f01('0x3a')]};});_0x57c336['model']=_[_0x4f01('0x37')](_0x44a239,'name');_0x57c336[_0x4f01('0x3b')]=_[_0x4f01('0x3c')](_0x564915[_0x4f01('0x3b')]);_0x57c336[_0x4f01('0x3d')]=_['intersection'](_0x57c336[_0x4f01('0x3e')],_0x57c336[_0x4f01('0x3b')]);_0x33c119['attributes']=_[_0x4f01('0x3f')](_0x57c336[_0x4f01('0x3e')],qs[_0x4f01('0x40')](_0x564915[_0x4f01('0x3b')][_0x4f01('0x40')]));_0x33c119['attributes']=_0x33c119[_0x4f01('0x41')][_0x4f01('0x42')]?_0x33c119[_0x4f01('0x41')]:_0x57c336[_0x4f01('0x3e')];if(!_0x564915[_0x4f01('0x3b')][_0x4f01('0x43')](_0x4f01('0x44'))){_0x33c119[_0x4f01('0x23')]=qs[_0x4f01('0x23')](_0x564915[_0x4f01('0x3b')][_0x4f01('0x23')]);_0x33c119[_0x4f01('0x25')]=qs[_0x4f01('0x25')](_0x564915[_0x4f01('0x3b')]['offset']);}_0x33c119['order']=qs[_0x4f01('0x45')](_0x564915[_0x4f01('0x3b')][_0x4f01('0x45')]);_0x33c119[_0x4f01('0x46')]=qs['filters'](_[_0x4f01('0x47')](_0x564915[_0x4f01('0x3b')],_0x57c336['filters']),_0x44a239);var _0x558a44=[];var _0x1a488c=squel['select']()[_0x4f01('0x48')]('id')[_0x4f01('0x48')](_0x4f01('0x2e'))['field']('color')[_0x4f01('0x49')](_0x4f01('0x4a'));var _0x52dd55=squel[_0x4f01('0x4b')]()[_0x4f01('0x48')](_0x4f01('0x4c'))[_0x4f01('0x48')](_0x4f01('0x4d'))[_0x4f01('0x48')]('ui.SmsInteractionId')[_0x4f01('0x49')](_0x4f01('0x4e'),'ui')[_0x4f01('0x4f')](_0x4f01('0x50'),'u',_0x4f01('0x51'));var _0x39b114=squel['select']()['from'](_0x4f01('0x52'),'i')['left_join'](_0x4f01('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4f01('0x4f')](_0x4f01('0x50'),'o',_0x4f01('0x54'))[_0x4f01('0x4f')]('sms_accounts','a',_0x4f01('0x55'))[_0x4f01('0x4f')](_0x4f01('0x56'),'me','me.SmsInteractionId\x20=\x20i.id')['left_join'](_0x4f01('0x57'),'it',_0x4f01('0x58'))['left_join']('tools_tags','t',_0x4f01('0x59'));var _0x3eabef=squel[_0x4f01('0x5a')]();var _0x5c90b7=[];var _0x3a70d4=squel[_0x4f01('0x5a')]();var _0x199fb7;if(_0x564915[_0x4f01('0x3b')][_0x4f01('0x5b')]){_0x199fb7=as[_0x4f01('0x5c')](_0x564915['query'][_0x4f01('0x5b')]);var _0x449db6=_0x199fb7[_0x4f01('0x5d')];for(var _0x57ddb0=0x0;_0x57ddb0<_0x199fb7['conditions'][_0x4f01('0x42')];_0x57ddb0++){var _0x2849bf=_0x199fb7[_0x4f01('0x5e')][_0x57ddb0];var _0x7e0e34='i';var _0xeced21=_[_0x4f01('0x5f')](_0x44a239,[_0x4f01('0x2e'),_0x2849bf[_0x4f01('0x48')]]);if(!_0xeced21){switch(_0x2849bf['field']){case _0x4f01('0x60'):if(_0x2849bf[_0x4f01('0x61')]==0x1){_0x39b114[_0x4f01('0x62')]('`'+_0x2849bf['field']+_0x4f01('0x63'));}else{_0x39b114[_0x4f01('0x62')]('`'+_0x2849bf[_0x4f01('0x48')]+_0x4f01('0x64'));}break;case _0x4f01('0x65'):if(_0x2849bf[_0x4f01('0x66')]===_0x4f01('0x67')){if(_0x2849bf[_0x4f01('0x61')][_0x4f01('0x32')]('\x20')[_0x4f01('0x42')]>0x1){_0x3eabef[_0x449db6](_0x4f01('0x68'),qs[_0x4f01('0x69')](_0x2849bf['value']),null);}else{var _0x506238='%'+_0x2849bf['value']+'%';_0x3eabef[_0x449db6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x506238,_0x506238,_0x506238);}}else{_0xeced21=_[_0x4f01('0x5f')](_0x44a239,[_0x4f01('0x2e'),_0x4f01('0x6a')]);_0x2849bf['field']='ContactId';_0x3deef6=as['buildExpression'](_0x7e0e34,_0xeced21[_0x4f01('0x6b')],_0x2849bf);_0x3eabef[_0x449db6](_0x3deef6[_0x4f01('0x6c')],_0x3deef6[_0x4f01('0x61')][_0x4f01('0x6d')],_0x3deef6[_0x4f01('0x61')]['end']);}break;case'Tag':var _0x2a9d97=_0x2849bf[_0x4f01('0x61')][_0x4f01('0x32')](',')[_0x4f01('0x37')](function(_0x260ae8){return Number(_0x260ae8);});_0x2a9d97['forEach'](function(_0x556b74){_0x3a70d4['or'](_0x4f01('0x6e'),'%,'+_0x556b74+',%');});_0x5c90b7=_[_0x4f01('0x6f')](_0x5c90b7,_0x2a9d97);break;case _0x4f01('0x70'):if(_0x2849bf[_0x4f01('0x66')]===_0x4f01('0x67')){_0x3eabef[_0x449db6](_0x4f01('0x71'),'%'+_0x2849bf['value']+'%',null);}else{_0xeced21=_[_0x4f01('0x5f')](_0x44a239,[_0x4f01('0x2e'),_0x4f01('0x72')]);_0x2849bf['field']='UserId';_0x3deef6=as[_0x4f01('0x73')](_0x7e0e34,_0xeced21[_0x4f01('0x6b')],_0x2849bf);_0x3eabef[_0x449db6](_0x3deef6['text'],_0x3deef6[_0x4f01('0x61')][_0x4f01('0x6d')],_0x3deef6[_0x4f01('0x61')][_0x4f01('0x74')]);}break;case'body':_0x3deef6=as[_0x4f01('0x73')]('me',null,_0x2849bf);_0x3eabef[_0x449db6](_0x3deef6[_0x4f01('0x6c')],_0x3deef6[_0x4f01('0x61')][_0x4f01('0x6d')],_0x3deef6[_0x4f01('0x61')][_0x4f01('0x74')]);break;}}else{var _0x3deef6=as['buildExpression'](_0x7e0e34,_0xeced21[_0x4f01('0x6b')],_0x2849bf);_0x3eabef[_0x449db6](_0x3deef6['text'],_0x3deef6[_0x4f01('0x61')][_0x4f01('0x6d')],_0x3deef6[_0x4f01('0x61')][_0x4f01('0x74')]);}}}else{var _0x69606e=_(_0x564915[_0x4f01('0x3b')])[_0x4f01('0x3c')]()[_0x4f01('0x37')](function(_0x1d2fd6){return _['some'](_0x44a239,[_0x4f01('0x2e'),_0x1d2fd6])?_0x1d2fd6:undefined;})['compact']()['value']();if(!_[_0x4f01('0x75')](_0x69606e)){_0x69606e[_0x4f01('0x33')](function(_0x2186f2){if(_0x2186f2==='SmsAccountId'){_0x39b114[_0x4f01('0x46')](_0x4f01('0x76'),[][_0x4f01('0x77')](_0x564915['query'][_0x2186f2]));}else if(_0x2186f2===_0x4f01('0x78')){var _0x109e39=JSON[_0x4f01('0x79')](_0x564915[_0x4f01('0x3b')][_0x2186f2])[_0x4f01('0x7a')];var _0x345b2d=JSON[_0x4f01('0x79')](_0x564915[_0x4f01('0x3b')][_0x2186f2])[_0x4f01('0x7b')];_0x39b114[_0x4f01('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x109e39,_0x345b2d);}else{if(_0x564915['query'][_0x2186f2]===_0x4f01('0x7c')){_0x39b114[_0x4f01('0x46')]('i.'+_0x2186f2+'\x20IS\x20NULL');}else{_0x39b114[_0x4f01('0x46')]('i.'+_0x2186f2+'\x20=\x20?',_0x564915['query'][_0x2186f2]);}}});}if(_0x564915[_0x4f01('0x3b')][_0x4f01('0x7d')]){if(_0x564915[_0x4f01('0x3b')][_0x4f01('0x7d')]==0x1){_0x39b114[_0x4f01('0x62')](_0x4f01('0x7e'));}else{_0x39b114[_0x4f01('0x62')](_0x4f01('0x7f'));}}if(_0x564915[_0x4f01('0x3b')]['tag']){_0x5c90b7=_[_0x4f01('0x80')](_0x564915[_0x4f01('0x3b')][_0x4f01('0x81')])?_0x564915[_0x4f01('0x3b')]['tag']:new Array(_0x564915[_0x4f01('0x3b')][_0x4f01('0x81')]);_0x5c90b7[_0x4f01('0x33')](function(_0x536598){_0x3a70d4['or'](_0x4f01('0x6e'),'%,'+_0x536598+',%');});}if(_0x564915['query'][_0x4f01('0x82')]){var _0x561a9e=_0x564915[_0x4f01('0x3b')]['filter'][_0x4f01('0x83')]('\x5c','\x5c\x5c')[_0x4f01('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x561a9e)){_0x3eabef['or'](_0x4f01('0x84'),_0x561a9e+'%')['or'](_0x4f01('0x85'),_0x561a9e+'%');}else{_0x3eabef['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4f01('0x69')](_0x561a9e))['or'](_0x4f01('0x86'),_0x561a9e+'%');}}}_0x39b114[_0x4f01('0x46')](_0x3eabef);_0x39b114[_0x4f01('0x87')](_0x4f01('0x88'));var _0x43999a={'type':db[_0x4f01('0x89')][_0x4f01('0x8a')]['SELECT'],'raw':!![]};var _0x13ad87=_0x39b114['clone']();_0x13ad87[_0x4f01('0x48')](_0x4f01('0x88'));_0x13ad87['field'](_0x4f01('0x8b'),_0x4f01('0x60'));if(_0x33c119['order']){_0x33c119[_0x4f01('0x8c')][_0x4f01('0x33')](function(_0x3fe9fa){var _0x34c510=_0x3fe9fa[0x0]===_0x4f01('0x8d')?_0x3fe9fa[0x0]:'i.'+_0x3fe9fa[0x0];_0x39b114[_0x4f01('0x8c')](_0x34c510,_0x3fe9fa[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x5c90b7)){_0x39b114[_0x4f01('0x62')](_0x3a70d4);_0x13ad87[_0x4f01('0x46')](_0x4f01('0x8e'),_0x5c90b7);}BPromise[_0x4f01('0x8f')]()['then'](function(){if(!_0x199fb7){if(_0x564915[_0x4f01('0x3b')][_0x4f01('0x90')])return;_0x13ad87[_0x4f01('0x46')](_0x4f01('0x91'));_0x39b114[_0x4f01('0x46')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x564915['user'][_0x4f01('0x92')]!==_0x4f01('0x93'))return;return _0x564915[_0x4f01('0x94')][_0x4f01('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x372e7f){if(_[_0x4f01('0x75')](_0x372e7f)){_0x13ad87[_0x4f01('0x46')](_0x4f01('0x96'));_0x39b114['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x13ad87[_0x4f01('0x46')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x372e7f,'id'));_0x39b114[_0x4f01('0x46')]('i.SmsAccountId\x20IN\x20?',_[_0x4f01('0x37')](_0x372e7f,'id'));}});})['then'](function(){if(_0x564915['user'][_0x4f01('0x92')]===_0x4f01('0x93')&&!_0x199fb7&&!_0x564915['query'][_0x4f01('0x90')])return[];return db['sequelize'][_0x4f01('0x3b')](_0x13ad87['toString'](),_0x43999a);})[_0x4f01('0x2b')](function(_0x5e1bb2){_0x316f0f[_0x4f01('0x24')]=_0x5e1bb2[_0x4f01('0x42')];if(_0x316f0f[_0x4f01('0x24')]===0x0)return[];return db[_0x4f01('0x97')][_0x4f01('0x3b')](_0x1a488c[_0x4f01('0x98')](),_0x43999a)[_0x4f01('0x2b')](function(_0x55e393){_0x558a44=_[_0x4f01('0x99')](_0x55e393,'id');_0x43999a=_[_0x4f01('0x9a')](_0x43999a,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x564915[_0x4f01('0x3b')][_0x4f01('0x40')]){_0x33c119['attributes'][_0x4f01('0x33')](function(_0x391e09){_0x39b114[_0x4f01('0x48')]('i.'+_0x391e09);});}else{_0x39b114[_0x4f01('0x48')](_0x4f01('0x8b'),_0x4f01('0x60'));_0x39b114[_0x4f01('0x48')](_0x4f01('0x9b'),_0x4f01('0x9c'));_0x39b114[_0x4f01('0x48')](_0x4f01('0x9d'),'Account.mandatoryDisposition');_0x39b114[_0x4f01('0x48')]('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','contactName');_0x39b114[_0x4f01('0x48')](_0x4f01('0x9e'));_0x39b114[_0x4f01('0x48')](_0x4f01('0x9f'),_0x4f01('0xa0'));_0x39b114[_0x4f01('0x48')]('c.lastName',_0x4f01('0xa1'));_0x39b114[_0x4f01('0x48')]('c.email',_0x4f01('0xa2'));_0x39b114[_0x4f01('0x48')](_0x4f01('0xa3'),'Contact.phone');_0x39b114['field'](_0x4f01('0xa4'),_0x4f01('0xa5'));_0x39b114['field'](_0x4f01('0xa6'),_0x4f01('0xa7'));_0x39b114[_0x4f01('0x48')](_0x4f01('0xa8'),_0x4f01('0xa9'));_0x39b114[_0x4f01('0x48')](_0x4f01('0xaa'),_0x4f01('0xab'));_0x39b114['field'](_0x4f01('0xac'),_0x4f01('0x30'));}if(_0x33c119[_0x4f01('0x23')])_0x39b114['limit'](_0x33c119['limit']);if(_0x33c119[_0x4f01('0x25')])_0x39b114['offset'](_0x33c119[_0x4f01('0x25')]);return db['sequelize'][_0x4f01('0x3b')](_0x39b114[_0x4f01('0x98')](),_0x43999a);})[_0x4f01('0x2b')](function(_0x194fda){if(_0x194fda[_0x4f01('0x42')]>0x0)_0x52dd55[_0x4f01('0x46')](_0x4f01('0xad'),_[_0x4f01('0x37')](_0x194fda,'id'));return db['sequelize']['query'](_0x52dd55['toString'](),_0x43999a)[_0x4f01('0x2b')](function(_0x332b2c){var _0x417b77=_[_0x4f01('0xae')](_0x332b2c,_0x4f01('0xaf'));var _0x18cc7f=[];_0x194fda[_0x4f01('0x33')](function(_0x332aff){_0x18cc7f[_0x4f01('0x34')](updateSmsInteraction(_0x332aff,_0x558a44,_0x417b77));});return BPromise[_0x4f01('0xb0')](_0x18cc7f);});});})[_0x4f01('0x2b')](function(_0x524da1){_0x316f0f[_0x4f01('0xb1')]=_0x524da1;return _0x316f0f;})[_0x4f01('0x2b')](respondWithFilteredResult(_0x46e829,_0x33c119))[_0x4f01('0x35')](handleError(_0x46e829,null));};exports[_0x4f01('0xb2')]=function(_0x102db5,_0x4781bf){var _0x42e0d8={'raw':![],'where':{'id':_0x102db5[_0x4f01('0xb3')]['id']}},_0x34ea5c={};_0x34ea5c[_0x4f01('0x3e')]=_['keys'](db[_0x4f01('0x38')][_0x4f01('0x39')]);_0x34ea5c[_0x4f01('0x3b')]=_[_0x4f01('0x3c')](_0x102db5['query']);_0x34ea5c['filters']=_[_0x4f01('0x3f')](_0x34ea5c[_0x4f01('0x3e')],_0x34ea5c['query']);_0x42e0d8[_0x4f01('0x41')]=_[_0x4f01('0x3f')](_0x34ea5c[_0x4f01('0x3e')],qs['fields'](_0x102db5[_0x4f01('0x3b')][_0x4f01('0x40')]));_0x42e0d8[_0x4f01('0x41')]=_0x42e0d8['attributes'][_0x4f01('0x42')]?_0x42e0d8[_0x4f01('0x41')]:_0x34ea5c['model'];if(_0x102db5[_0x4f01('0x3b')][_0x4f01('0xb4')]){_0x42e0d8[_0x4f01('0xb5')]=[{'all':!![]}];}_0x42e0d8=_[_0x4f01('0x9a')]({},_0x42e0d8,_0x102db5[_0x4f01('0xb6')]);return db['SmsInteraction'][_0x4f01('0x5f')](_0x42e0d8)[_0x4f01('0x2b')](handleEntityNotFound(_0x4781bf,null))[_0x4f01('0x2b')](respondWithResult(_0x4781bf,null))[_0x4f01('0x35')](handleError(_0x4781bf,null));};exports[_0x4f01('0xb7')]=function(_0x44752f,_0x4b8eca){return db[_0x4f01('0x38')][_0x4f01('0xb7')](_0x44752f[_0x4f01('0xb8')],{})['then'](respondWithResult(_0x4b8eca,0xc9))[_0x4f01('0x35')](handleError(_0x4b8eca,null));};exports[_0x4f01('0x2a')]=function(_0x5eac02,_0x4b7df0){if(_0x5eac02['body']['id']){delete _0x5eac02['body']['id'];}return db[_0x4f01('0x38')]['find']({'where':{'id':_0x5eac02['params']['id']}})[_0x4f01('0x2b')](handleEntityNotFound(_0x4b7df0,null))[_0x4f01('0x2b')](saveUpdates(_0x5eac02[_0x4f01('0xb8')],null))['then'](respondWithResult(_0x4b7df0,null))[_0x4f01('0x35')](handleError(_0x4b7df0,null));};exports['destroy']=function(_0x4d172e,_0x4b3aec){return db['SmsInteraction'][_0x4f01('0x5f')]({'where':{'id':_0x4d172e[_0x4f01('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4b3aec,null))['then'](removeEntity(_0x4b3aec,null))[_0x4f01('0x35')](handleError(_0x4b3aec,null));};exports['describe']=function(_0x54893f,_0x4bc36a){return db[_0x4f01('0x38')][_0x4f01('0xb9')]()[_0x4f01('0x2b')](respondWithResult(_0x4bc36a,null))['catch'](handleError(_0x4bc36a,null));};exports[_0x4f01('0xba')]=function(_0x42766d,_0x508481,_0x1aa87b){return db[_0x4f01('0xbb')][_0x4f01('0x5f')]({'where':{'id':_0x42766d[_0x4f01('0xb3')]['id']}})[_0x4f01('0x2b')](handleEntityNotFound(_0x508481,null))[_0x4f01('0x2b')](function(_0x9fc94d){if(_0x9fc94d){return _0x9fc94d[_0x4f01('0xba')](_0x42766d[_0x4f01('0xb8')][_0x4f01('0xbc')],_['omit'](_0x42766d[_0x4f01('0xb8')],[_0x4f01('0xbc'),'id'])||{});}})[_0x4f01('0x2b')](respondWithResult(_0x508481,null))['catch'](handleError(_0x508481,null));};exports['getMessages']=function(_0x23ff1f,_0x251b23,_0x4f5de7){var _0x5ed57a={'raw':![],'where':{}};var _0x3d3196={};var _0x122177={'count':0x0,'rows':[]};return db[_0x4f01('0x38')][_0x4f01('0xbd')]({'where':{'id':_0x23ff1f[_0x4f01('0xb3')]['id']}})['then'](handleEntityNotFound(_0x251b23,null))[_0x4f01('0x2b')](function(_0x2e9b1a){if(_0x2e9b1a){_0x3d3196[_0x4f01('0x3e')]=_[_0x4f01('0x3c')](db[_0x4f01('0xbb')]['rawAttributes']);_0x3d3196[_0x4f01('0x3b')]=_[_0x4f01('0x3c')](_0x23ff1f[_0x4f01('0x3b')]);_0x3d3196[_0x4f01('0x3d')]=_[_0x4f01('0x3f')](_0x3d3196['model'],_0x3d3196[_0x4f01('0x3b')]);_0x5ed57a[_0x4f01('0x41')]=_[_0x4f01('0x3f')](_0x3d3196[_0x4f01('0x3e')],qs[_0x4f01('0x40')](_0x23ff1f[_0x4f01('0x3b')][_0x4f01('0x40')]));_0x5ed57a['attributes']=_0x5ed57a[_0x4f01('0x41')]['length']?_0x5ed57a['attributes']:_0x3d3196[_0x4f01('0x3e')];if(!_0x23ff1f[_0x4f01('0x3b')][_0x4f01('0x43')](_0x4f01('0x44'))){_0x5ed57a[_0x4f01('0x23')]=qs[_0x4f01('0x23')](_0x23ff1f[_0x4f01('0x3b')][_0x4f01('0x23')]);_0x5ed57a[_0x4f01('0x25')]=qs['offset'](_0x23ff1f[_0x4f01('0x3b')][_0x4f01('0x25')]);}_0x5ed57a[_0x4f01('0x8c')]=qs['sort'](_0x23ff1f[_0x4f01('0x3b')][_0x4f01('0x45')]);_0x5ed57a[_0x4f01('0x46')]=qs[_0x4f01('0x3d')](_['pick'](_0x23ff1f[_0x4f01('0x3b')],_0x3d3196[_0x4f01('0x3d')]));_0x5ed57a['where'][_0x4f01('0xaf')]=_0x2e9b1a['id'];if(_0x23ff1f[_0x4f01('0x3b')]['filter']){_0x5ed57a[_0x4f01('0x46')]=_['merge'](_0x5ed57a[_0x4f01('0x46')],{'$or':_[_0x4f01('0x37')](_0x5ed57a[_0x4f01('0x41')],function(_0x25f90a){var _0x28edbd={};_0x28edbd[_0x25f90a]={'$like':'%'+_0x23ff1f['query'][_0x4f01('0x82')]+'%'};return _0x28edbd;})});}if(_0x23ff1f[_0x4f01('0x3b')][_0x4f01('0x7a')]){var _0x28de35=_0x23ff1f[_0x4f01('0x3b')][_0x4f01('0x7a')][_0x4f01('0x32')](',');var _0x48a4b7={};_0x48a4b7[_0x28de35[0x0]]={'$gte':moment(_0x28de35[0x1])[_0x4f01('0xbe')](_0x4f01('0xbf'))};_0x5ed57a[_0x4f01('0x46')]=_[_0x4f01('0x9a')](_0x5ed57a[_0x4f01('0x46')],_0x48a4b7);}_0x5ed57a=_[_0x4f01('0x9a')]({},_0x5ed57a,_0x23ff1f[_0x4f01('0xb6')]);return db[_0x4f01('0xbb')]['count']({'where':_0x5ed57a[_0x4f01('0x46')]})[_0x4f01('0x2b')](function(_0x431e97){_0x122177[_0x4f01('0x24')]=_0x431e97;if(_0x23ff1f[_0x4f01('0x3b')][_0x4f01('0xb4')]){_0x5ed57a[_0x4f01('0xb5')]=[{'all':!![]}];}return db[_0x4f01('0xbb')][_0x4f01('0xc0')](_0x5ed57a);})[_0x4f01('0x2b')](function(_0x178396){_0x122177[_0x4f01('0xb1')]=_0x178396;return _0x122177;});}})['then'](respondWithFilteredResult(_0x251b23,_0x5ed57a))[_0x4f01('0x35')](handleError(_0x251b23,null));};exports['addTags']=function(_0x218851,_0x21e132,_0x35a4b7){return db[_0x4f01('0x38')]['find']({'where':{'id':_0x218851[_0x4f01('0xb3')]['id']}})[_0x4f01('0x2b')](handleEntityNotFound(_0x21e132,null))[_0x4f01('0x2b')](function(_0x293d02){if(_0x293d02){return _0x293d02[_0x4f01('0xc1')](_0x218851[_0x4f01('0xb8')]['ids'],_[_0x4f01('0xc2')](_0x218851[_0x4f01('0xb8')],[_0x4f01('0xbc'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x4f01('0xc3')],'where':{'id':_0x218851[_0x4f01('0xb8')][_0x4f01('0xbc')]}});})[_0x4f01('0x2b')](function(_0x1565f2){socket[_0x4f01('0xc4')](_0x4f01('0xc5'),{'id':Number(_0x218851[_0x4f01('0xb3')]['id']),'tags':_0x1565f2||[]});return{'id':Number(_0x218851[_0x4f01('0xb3')]['id']),'tags':_0x1565f2||[]};});}})['then'](respondWithResult(_0x21e132,null))[_0x4f01('0x35')](handleError(_0x21e132,null));};exports[_0x4f01('0xc6')]=function(_0x1e86d6,_0x238273,_0x25a63b){return db['SmsInteraction']['find']({'where':{'id':_0x1e86d6[_0x4f01('0xb3')]['id']}})[_0x4f01('0x2b')](handleEntityNotFound(_0x238273,null))['then'](function(_0xea0e65){if(_0xea0e65){return _0xea0e65[_0x4f01('0xc6')](_0x1e86d6['query']['ids']);}})[_0x4f01('0x2b')](respondWithStatusCode(_0x238273,null))[_0x4f01('0x35')](handleError(_0x238273,null));};exports[_0x4f01('0xc7')]=function(_0x5e7db2,_0x31933a){var _0xc0a098=moment()[_0x4f01('0xc8')]()['toString']();var _0xaaf926=path['join'](config[_0x4f01('0xc9')],_0x4f01('0xca'),'files',_0x4f01('0xcb'));var _0x3142cb=path[_0x4f01('0xcc')](config[_0x4f01('0xc9')],_0x4f01('0xca'),_0x4f01('0xcd'),_0x4f01('0xce'));var _0x5f8ef=path['join'](_0xaaf926,_0xc0a098);var _0x2a50a9=util[_0x4f01('0xbe')](_0x4f01('0xcf'),_0x5e7db2['params']['id'],_0xc0a098);var _0x4c7d9f=path[_0x4f01('0xcc')](_0xaaf926,_0x2a50a9);var _0x37b774=[];_0x37b774[_0x4f01('0x34')]({'model':db[_0x4f01('0x70')],'as':_0x4f01('0x70'),'attributes':['id','fullname'],'raw':!![]});_0x37b774[_0x4f01('0x34')]({'model':db[_0x4f01('0xd0')],'as':_0x4f01('0x65'),'attributes':['id',_0x4f01('0xd1'),'lastName'],'raw':!![]});var _0x2e8f7c=[{'model':db['SmsMessage'],'as':_0x4f01('0xd2'),'attributes':['id',_0x4f01('0xb8'),_0x4f01('0x78'),'direction',_0x4f01('0xd3'),_0x4f01('0x7d')],'include':_0x37b774}];_0x2e8f7c[_0x4f01('0x34')]({'model':db[_0x4f01('0xd4')],'as':_0x4f01('0xd5'),'attributes':['id',_0x4f01('0x2e')]});_0x2e8f7c[_0x4f01('0x34')]({'model':db[_0x4f01('0x70')],'as':_0x4f01('0xd6'),'attributes':['id',_0x4f01('0x2f')]});return db[_0x4f01('0x38')]['find']({'where':{'id':_0x5e7db2[_0x4f01('0xb3')]['id']},'include':_0x2e8f7c})['then'](handleEntityNotFound(_0x31933a,null))['then'](function(_0x211282){if(_0x211282){var _0x2b410c=_0x211282[_0x4f01('0xd7')]({'plain':!![]});fs[_0x4f01('0xd8')](_0x5f8ef);var _0x197f12={'channel':'Sms','account':_0x2b410c['Account'][_0x4f01('0x2e')],'agent':_0x2b410c[_0x4f01('0xd6')]?_0x2b410c['Owner']['fullname']:_0x4f01('0xd9'),'createdAt':moment(_0x2b410c['createdAt'])[_0x4f01('0xbe')](_0x4f01('0xbf'))['toString'](),'closedAt':_0x2b410c[_0x4f01('0xda')]?moment(_0x2b410c['closedAt'])[_0x4f01('0xbe')](_0x4f01('0xbf'))['toString']():'','disposition':_0x2b410c[_0x4f01('0xdb')],'messages':_(_0x2b410c[_0x4f01('0xd2')])[_0x4f01('0x82')]({'secret':![]})['map'](function(_0x453c45){return{'date':moment(_0x453c45[_0x4f01('0x78')])[_0x4f01('0xbe')](_0x4f01('0xbf'))[_0x4f01('0x98')](),'sender':_0x453c45[_0x4f01('0xdc')]==='out'?_0x453c45['User']?_0x453c45[_0x4f01('0x70')][_0x4f01('0x2f')]:_0x4f01('0xdd'):_0x453c45['Contact']['firstName']+(_0x453c45[_0x4f01('0x65')][_0x4f01('0xde')]?'\x20'+_0x453c45['Contact'][_0x4f01('0xde')]:''),'body':_0x453c45[_0x4f01('0xb8')],'direction':_0x453c45['direction']==='out'?'A':'C','secret':_0x453c45[_0x4f01('0xd3')],'read':_0x453c45[_0x4f01('0x7d')]};})[_0x4f01('0x61')]()};return ejs[_0x4f01('0xdf')](path[_0x4f01('0xcc')](config[_0x4f01('0xc9')],_0x4f01('0xca'),_0x4f01('0xe0'),_0x4f01('0xe1')),{'interaction':_0x197f12})[_0x4f01('0x2b')](function(_0x258877){var _0xc2350f=path['join'](_0x5f8ef,_0x4f01('0xe2')+_0x2b410c['id']+'-'+_0xc0a098+_0x4f01('0xe3'));var _0x36bea3={'path':_0xc2350f,'channel':_0x4f01('0xe4'),'interactionId':_0x2b410c['id']};return pdf[_0x4f01('0xe5')](_0x258877,_0x36bea3);})[_0x4f01('0x2b')](function(){return new BPromise(function(_0x5efff5,_0x96dc14){zipdir(_0x5f8ef,{'saveTo':_0x4c7d9f},function(_0x2fd45d,_0x254ec6){if(_0x2fd45d)return _0x96dc14(_0x2fd45d);return _0x5efff5(_0x254ec6);});})[_0x4f01('0x2b')](function(){return new BPromise(function(_0x34c10b,_0x3315f0){rimraf(_0x5f8ef,function(_0x42f85b){if(_0x42f85b)_0x3315f0(_0x42f85b);return _0x34c10b();});});})['then'](function(){return _0x31933a[_0x4f01('0xc7')](_0x4c7d9f,_0x2a50a9,function(_0x42c19d){if(_0x42c19d){console['log'](_0x4f01('0xe6'),_0x42c19d);}else{fs['unlinkSync'](_0x4c7d9f);}});});});}else{return _0x31933a[_0x4f01('0x20')](0xc8);}})['catch'](handleError(_0x31933a,null));}; \ No newline at end of file +var _0x6424=['N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','nolimit','order','sort','where','pick','filters','field','color','from','tools_tags','select','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','parseSearch','search','length','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','includeAll','include','options','create','update','body','params','describe','SmsMessage','addMessage','ids','getMessages','findOne','hasOwnProperty','format','findAll','addTags','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','Account','Owner','mkdirSync','Sms'];(function(_0x19ef43,_0x54b99d){var _0x346117=function(_0x3d9ad0){while(--_0x3d9ad0){_0x19ef43['push'](_0x19ef43['shift']());}};_0x346117(++_0x54b99d);}(_0x6424,0x100));var _0x4642=function(_0x107013,_0x1b8303){_0x107013=_0x107013-0x0;var _0x592050=_0x6424[_0x107013];return _0x592050;};'use strict';var emlformat=require(_0x4642('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4642('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4642('0x2'));var moment=require(_0x4642('0x3'));var BPromise=require(_0x4642('0x4'));var Mustache=require(_0x4642('0x5'));var util=require(_0x4642('0x6'));var path=require(_0x4642('0x7'));var sox=require(_0x4642('0x8'));var csv=require(_0x4642('0x9'));var ejs=require(_0x4642('0xa'));var fs=require('fs');var fs_extra=require(_0x4642('0xb'));var _=require('lodash');var squel=require(_0x4642('0xc'));var crypto=require(_0x4642('0xd'));var jsforce=require(_0x4642('0xe'));var deskjs=require(_0x4642('0xf'));var toCsv=require(_0x4642('0x9'));var querystring=require(_0x4642('0x10'));var Papa=require(_0x4642('0x11'));var Redis=require(_0x4642('0x12'));var authService=require(_0x4642('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x4642('0x14'));var hardwareService=require(_0x4642('0x15'));var logger=require(_0x4642('0x16'))(_0x4642('0x17'));var utils=require(_0x4642('0x18'));var config=require(_0x4642('0x19'));var licenseUtil=require(_0x4642('0x1a'));var db=require(_0x4642('0x1b'))['db'];config[_0x4642('0x1c')]=_[_0x4642('0x1d')](config[_0x4642('0x1c')],{'host':_0x4642('0x1e'),'port':0x18eb});var socket=require(_0x4642('0x1f'))(new Redis(config[_0x4642('0x1c')]));require('./smsInteraction.socket')[_0x4642('0x20')](socket);function respondWithStatusCode(_0x40096e,_0x3a4eaa){_0x3a4eaa=_0x3a4eaa||0xcc;return function(_0x5022a3){if(_0x5022a3){return _0x40096e[_0x4642('0x21')](_0x3a4eaa);}return _0x40096e[_0x4642('0x22')](_0x3a4eaa)[_0x4642('0x23')]();};}function respondWithResult(_0x3c6df4,_0x3cd4bd){_0x3cd4bd=_0x3cd4bd||0xc8;return function(_0x5a0c18){if(_0x5a0c18){return _0x3c6df4[_0x4642('0x22')](_0x3cd4bd)[_0x4642('0x24')](_0x5a0c18);}};}function respondWithFilteredResult(_0x5cc566,_0xae4588){return function(_0x1b73f5){if(_0x1b73f5){var _0x19f8ad=typeof _0xae4588[_0x4642('0x25')]===_0x4642('0x26')&&typeof _0xae4588[_0x4642('0x27')]===_0x4642('0x26');var _0x508903=_0x1b73f5[_0x4642('0x28')];var _0x4bb93d=_0x19f8ad?0x0:_0xae4588['offset'];var _0x1432bb=_0x19f8ad?_0x1b73f5[_0x4642('0x28')]:_0xae4588['offset']+_0xae4588[_0x4642('0x27')];var _0x49fc26;if(_0x1432bb>=_0x508903){_0x1432bb=_0x508903;_0x49fc26=0xc8;}else{_0x49fc26=0xce;}_0x5cc566['status'](_0x49fc26);return _0x5cc566[_0x4642('0x29')](_0x4642('0x2a'),_0x4bb93d+'-'+_0x1432bb+'/'+_0x508903)[_0x4642('0x24')](_0x1b73f5);}return null;};}function patchUpdates(_0x1967df){return function(_0x100546){try{jsonpatch[_0x4642('0x2b')](_0x100546,_0x1967df,!![]);}catch(_0xe9df15){return BPromise['reject'](_0xe9df15);}return _0x100546[_0x4642('0x2c')]();};}function saveUpdates(_0x125f48,_0x5bbfed){return function(_0x125641){if(_0x125641){return _0x125641['update'](_0x125f48)['then'](function(_0x4f5c01){return _0x4f5c01;});}return null;};}function removeEntity(_0xfaeaed,_0x5901d2){return function(_0x291c81){if(_0x291c81){return _0x291c81[_0x4642('0x2d')]()[_0x4642('0x2e')](function(){_0xfaeaed['status'](0xcc)[_0x4642('0x23')]();});}};}function handleEntityNotFound(_0x116553,_0x394299){return function(_0x138c43){if(!_0x138c43){_0x116553[_0x4642('0x21')](0x194);}return _0x138c43;};}function handleError(_0x3045c6,_0x264af4){_0x264af4=_0x264af4||0x1f4;return function(_0x2dd570){logger['error'](_0x2dd570[_0x4642('0x2f')]);if(_0x2dd570['name']){delete _0x2dd570[_0x4642('0x30')];}_0x3045c6[_0x4642('0x22')](_0x264af4)[_0x4642('0x31')](_0x2dd570);};}function getInteractionUsers(_0x1bde02,_0x450bd2){return new BPromise(function(_0x19d515,_0x411005){try{if(_0x450bd2[_0x1bde02['id']]){_0x1bde02[_0x4642('0x32')]=_[_0x4642('0x33')](_0x450bd2[_0x1bde02['id']],function(_0x2a3409){return{'id':_0x2a3409['id'],'fullname':_0x2a3409[_0x4642('0x34')]};});}}catch(_0x133160){_0x411005(_0x133160);}_0x19d515(_0x1bde02);});}function getInteractionTags(_0x5707e8,_0x3ae8d){return new BPromise(function(_0x58389f,_0x3893d5){try{if(_0x5707e8[_0x4642('0x35')]){_0x5707e8[_0x4642('0x36')]=[];_0x5707e8['TagIds'][_0x4642('0x37')](',')[_0x4642('0x38')](function(_0x4a42dd){_0x5707e8[_0x4642('0x36')]['push'](_0x3ae8d[_0x4a42dd]);});}delete _0x5707e8[_0x4642('0x35')];}catch(_0x3a6b8c){_0x3893d5(_0x3a6b8c);}_0x58389f(_0x5707e8);});}function updateSmsInteraction(_0x7fd097,_0x483be0,_0x468a7b){return new BPromise(function(_0x354769,_0x44f3ba){return getInteractionUsers(_0x7fd097,_0x468a7b)[_0x4642('0x2e')](function(_0x510216){return getInteractionTags(_0x510216,_0x483be0);})[_0x4642('0x2e')](function(_0x4f1c8f){_0x354769(_0x4f1c8f);})[_0x4642('0x39')](function(_0x834ae1){_0x44f3ba(_0x834ae1);});});}exports[_0x4642('0x3a')]=function(_0x1547c9,_0x2e9dbf){var _0x58680e={},_0x3e6a9f={},_0x565de4={'count':0x0,'rows':[]};var _0x1aa955=_[_0x4642('0x33')](db[_0x4642('0x3b')][_0x4642('0x3c')],function(_0xa9e135){return{'name':_0xa9e135[_0x4642('0x3d')],'type':_0xa9e135[_0x4642('0x3e')][_0x4642('0x3f')]};});_0x3e6a9f[_0x4642('0x40')]=_[_0x4642('0x33')](_0x1aa955,_0x4642('0x30'));_0x3e6a9f['query']=_[_0x4642('0x41')](_0x1547c9[_0x4642('0x42')]);_0x3e6a9f['filters']=_[_0x4642('0x43')](_0x3e6a9f[_0x4642('0x40')],_0x3e6a9f[_0x4642('0x42')]);_0x58680e['attributes']=_[_0x4642('0x43')](_0x3e6a9f['model'],qs['fields'](_0x1547c9[_0x4642('0x42')]['fields']));_0x58680e[_0x4642('0x44')]=_0x58680e[_0x4642('0x44')]['length']?_0x58680e[_0x4642('0x44')]:_0x3e6a9f[_0x4642('0x40')];if(!_0x1547c9['query']['hasOwnProperty'](_0x4642('0x45'))){_0x58680e['limit']=qs['limit'](_0x1547c9[_0x4642('0x42')][_0x4642('0x27')]);_0x58680e[_0x4642('0x25')]=qs['offset'](_0x1547c9['query'][_0x4642('0x25')]);}_0x58680e[_0x4642('0x46')]=qs[_0x4642('0x47')](_0x1547c9[_0x4642('0x42')][_0x4642('0x47')]);_0x58680e[_0x4642('0x48')]=qs['filters'](_[_0x4642('0x49')](_0x1547c9[_0x4642('0x42')],_0x3e6a9f[_0x4642('0x4a')]),_0x1aa955);var _0x57da64=[];var _0x2ca199=squel['select']()['field']('id')[_0x4642('0x4b')](_0x4642('0x30'))['field'](_0x4642('0x4c'))[_0x4642('0x4d')](_0x4642('0x4e'));var _0x2ecc55=squel[_0x4642('0x4f')]()[_0x4642('0x4b')](_0x4642('0x50'))[_0x4642('0x4b')]('u.fullname')[_0x4642('0x4b')](_0x4642('0x51'))[_0x4642('0x4d')](_0x4642('0x52'),'ui')[_0x4642('0x53')](_0x4642('0x54'),'u',_0x4642('0x55'));var _0x422283=squel[_0x4642('0x4f')]()[_0x4642('0x4d')](_0x4642('0x56'),'i')[_0x4642('0x53')](_0x4642('0x57'),'c',_0x4642('0x58'))[_0x4642('0x53')](_0x4642('0x54'),'o',_0x4642('0x59'))[_0x4642('0x53')](_0x4642('0x5a'),'a',_0x4642('0x5b'))[_0x4642('0x53')](_0x4642('0x5c'),'me',_0x4642('0x5d'))[_0x4642('0x53')](_0x4642('0x5e'),'it',_0x4642('0x5f'))[_0x4642('0x53')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x346b17=squel[_0x4642('0x60')]();var _0x5d5b84=[];var _0x201406=squel[_0x4642('0x60')]();var _0x49b3f3;if(_0x1547c9[_0x4642('0x42')]['search']){_0x49b3f3=as[_0x4642('0x61')](_0x1547c9[_0x4642('0x42')][_0x4642('0x62')]);var _0x5705ef=_0x49b3f3['sqlOperator'];for(var _0x4bf8d6=0x0;_0x4bf8d6<_0x49b3f3['conditions'][_0x4642('0x63')];_0x4bf8d6++){var _0x7e8c84=_0x49b3f3[_0x4642('0x64')][_0x4bf8d6];var _0x1f0bc3='i';var _0x288a56=_[_0x4642('0x65')](_0x1aa955,['name',_0x7e8c84['field']]);if(!_0x288a56){switch(_0x7e8c84[_0x4642('0x4b')]){case _0x4642('0x66'):if(_0x7e8c84[_0x4642('0x67')]==0x1){_0x422283['having']('`'+_0x7e8c84[_0x4642('0x4b')]+_0x4642('0x68'));}else{_0x422283['having']('`'+_0x7e8c84['field']+_0x4642('0x69'));}break;case _0x4642('0x6a'):if(_0x7e8c84['operator']===_0x4642('0x6b')){if(_0x7e8c84[_0x4642('0x67')][_0x4642('0x37')]('\x20')[_0x4642('0x63')]>0x1){_0x346b17[_0x5705ef](_0x4642('0x6c'),qs[_0x4642('0x6d')](_0x7e8c84[_0x4642('0x67')]),null);}else{var _0x44ee70='%'+_0x7e8c84['value']+'%';_0x346b17[_0x5705ef](_0x4642('0x6e'),_0x44ee70,_0x44ee70,_0x44ee70);}}else{_0x288a56=_[_0x4642('0x65')](_0x1aa955,[_0x4642('0x30'),_0x4642('0x6f')]);_0x7e8c84[_0x4642('0x4b')]=_0x4642('0x6f');_0x2d775f=as[_0x4642('0x70')](_0x1f0bc3,_0x288a56[_0x4642('0x3e')],_0x7e8c84);_0x346b17[_0x5705ef](_0x2d775f['text'],_0x2d775f[_0x4642('0x67')][_0x4642('0x71')],_0x2d775f[_0x4642('0x67')][_0x4642('0x23')]);}break;case _0x4642('0x72'):var _0x122701=_0x7e8c84['value'][_0x4642('0x37')](',')['map'](function(_0x3af61a){return Number(_0x3af61a);});_0x122701[_0x4642('0x38')](function(_0x2cc8b8){_0x201406['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2cc8b8+',%');});_0x5d5b84=_[_0x4642('0x73')](_0x5d5b84,_0x122701);break;case _0x4642('0x74'):if(_0x7e8c84[_0x4642('0x75')]==='$substring'){_0x346b17[_0x5705ef](_0x4642('0x76'),'%'+_0x7e8c84[_0x4642('0x67')]+'%',null);}else{_0x288a56=_[_0x4642('0x65')](_0x1aa955,[_0x4642('0x30'),_0x4642('0x77')]);_0x7e8c84[_0x4642('0x4b')]='UserId';_0x2d775f=as[_0x4642('0x70')](_0x1f0bc3,_0x288a56[_0x4642('0x3e')],_0x7e8c84);_0x346b17[_0x5705ef](_0x2d775f[_0x4642('0x78')],_0x2d775f[_0x4642('0x67')][_0x4642('0x71')],_0x2d775f['value'][_0x4642('0x23')]);}break;case'body':_0x2d775f=as[_0x4642('0x70')]('me',null,_0x7e8c84);_0x346b17[_0x5705ef](_0x2d775f[_0x4642('0x78')],_0x2d775f[_0x4642('0x67')][_0x4642('0x71')],_0x2d775f[_0x4642('0x67')]['end']);break;}}else{var _0x2d775f=as['buildExpression'](_0x1f0bc3,_0x288a56[_0x4642('0x3e')],_0x7e8c84);_0x346b17[_0x5705ef](_0x2d775f['text'],_0x2d775f['value']['start'],_0x2d775f[_0x4642('0x67')]['end']);}}}else{var _0x494295=_(_0x1547c9[_0x4642('0x42')])[_0x4642('0x41')]()[_0x4642('0x33')](function(_0x2e5681){return _['some'](_0x1aa955,['name',_0x2e5681])?_0x2e5681:undefined;})['compact']()[_0x4642('0x67')]();if(!_[_0x4642('0x79')](_0x494295)){_0x494295['forEach'](function(_0x3a3d2b){if(_0x3a3d2b===_0x4642('0x7a')){_0x422283[_0x4642('0x48')](_0x4642('0x7b'),[][_0x4642('0x7c')](_0x1547c9[_0x4642('0x42')][_0x3a3d2b]));}else if(_0x3a3d2b===_0x4642('0x7d')){var _0x2c42ac=JSON['parse'](_0x1547c9[_0x4642('0x42')][_0x3a3d2b])[_0x4642('0x7e')];var _0x385156=JSON[_0x4642('0x7f')](_0x1547c9['query'][_0x3a3d2b])[_0x4642('0x80')];_0x422283[_0x4642('0x48')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2c42ac,_0x385156);}else{if(_0x1547c9[_0x4642('0x42')][_0x3a3d2b]===_0x4642('0x81')){_0x422283[_0x4642('0x48')]('i.'+_0x3a3d2b+_0x4642('0x82'));}else{_0x422283['where']('i.'+_0x3a3d2b+_0x4642('0x83'),_0x1547c9[_0x4642('0x42')][_0x3a3d2b]);}}});}if(_0x1547c9[_0x4642('0x42')][_0x4642('0x84')]){if(_0x1547c9[_0x4642('0x42')]['read']==0x1){_0x422283[_0x4642('0x85')](_0x4642('0x86'));}else{_0x422283['having'](_0x4642('0x87'));}}if(_0x1547c9['query'][_0x4642('0x88')]){_0x5d5b84=_[_0x4642('0x89')](_0x1547c9[_0x4642('0x42')]['tag'])?_0x1547c9[_0x4642('0x42')]['tag']:new Array(_0x1547c9[_0x4642('0x42')][_0x4642('0x88')]);_0x5d5b84[_0x4642('0x38')](function(_0x479470){_0x201406['or'](_0x4642('0x8a'),'%,'+_0x479470+',%');});}if(_0x1547c9[_0x4642('0x42')][_0x4642('0x8b')]){var _0x391219=_0x1547c9[_0x4642('0x42')][_0x4642('0x8b')][_0x4642('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x4642('0x8d')](_0x391219)){_0x346b17['or'](_0x4642('0x8e'),_0x391219+'%')['or'](_0x4642('0x8f'),_0x391219+'%');}else{_0x346b17['or'](_0x4642('0x90'),qs[_0x4642('0x6d')](_0x391219))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x391219+'%');}}}_0x422283[_0x4642('0x48')](_0x346b17);_0x422283[_0x4642('0x91')](_0x4642('0x92'));var _0x9d99a9={'type':db[_0x4642('0x93')][_0x4642('0x94')][_0x4642('0x95')],'raw':!![]};var _0x405152=_0x422283['clone']();_0x405152[_0x4642('0x4b')](_0x4642('0x92'));_0x405152['field'](_0x4642('0x96'),'unreadMessages');if(_0x58680e['order']){_0x58680e[_0x4642('0x46')][_0x4642('0x38')](function(_0x36d9bb){var _0x2c0716=_0x36d9bb[0x0]===_0x4642('0x97')?_0x36d9bb[0x0]:'i.'+_0x36d9bb[0x0];_0x422283['order'](_0x2c0716,_0x36d9bb[0x1]===_0x4642('0x98')?![]:!![]);});}if(!_[_0x4642('0x79')](_0x5d5b84)){_0x422283[_0x4642('0x85')](_0x201406);_0x405152[_0x4642('0x48')]('t.id\x20IN\x20?',_0x5d5b84);}BPromise[_0x4642('0x99')]()[_0x4642('0x2e')](function(){if(!_0x49b3f3){if(_0x1547c9[_0x4642('0x42')][_0x4642('0x7a')])return;_0x405152[_0x4642('0x48')](_0x4642('0x9a'));_0x422283[_0x4642('0x48')](_0x4642('0x9a'));return;}if(_0x1547c9[_0x4642('0x9b')][_0x4642('0x9c')]!=='agent')return;return _0x1547c9[_0x4642('0x9b')][_0x4642('0x9d')]({'attributes':['id'],'raw':!![]})[_0x4642('0x2e')](function(_0x744f92){if(_[_0x4642('0x79')](_0x744f92)){_0x405152[_0x4642('0x48')](_0x4642('0x9e'));_0x422283[_0x4642('0x48')](_0x4642('0x9e'));}else{_0x405152[_0x4642('0x48')](_0x4642('0x7b'),_[_0x4642('0x33')](_0x744f92,'id'));_0x422283[_0x4642('0x48')](_0x4642('0x7b'),_[_0x4642('0x33')](_0x744f92,'id'));}});})[_0x4642('0x2e')](function(){if(_0x1547c9[_0x4642('0x9b')][_0x4642('0x9c')]===_0x4642('0x9f')&&!_0x49b3f3&&!_0x1547c9['query'][_0x4642('0x7a')])return[];return db[_0x4642('0xa0')][_0x4642('0x42')](_0x405152[_0x4642('0xa1')](),_0x9d99a9);})[_0x4642('0x2e')](function(_0x457646){_0x565de4['count']=_0x457646['length'];if(_0x565de4[_0x4642('0x28')]===0x0)return[];return db['sequelize'][_0x4642('0x42')](_0x2ca199[_0x4642('0xa1')](),_0x9d99a9)[_0x4642('0x2e')](function(_0x3b083a){_0x57da64=_[_0x4642('0xa2')](_0x3b083a,'id');_0x9d99a9=_[_0x4642('0xa3')](_0x9d99a9,{'model':db[_0x4642('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1547c9[_0x4642('0x42')][_0x4642('0xa4')]){_0x58680e[_0x4642('0x44')][_0x4642('0x38')](function(_0x2ee0c7){_0x422283[_0x4642('0x4b')]('i.'+_0x2ee0c7);});}else{_0x422283[_0x4642('0x4b')](_0x4642('0x96'),'unreadMessages');_0x422283[_0x4642('0x4b')](_0x4642('0xa5'),_0x4642('0xa6'));_0x422283[_0x4642('0x4b')](_0x4642('0xa7'),_0x4642('0xa8'));_0x422283[_0x4642('0x4b')](_0x4642('0xa9'),_0x4642('0x97'));_0x422283['field']('i.*');_0x422283[_0x4642('0x4b')]('c.firstName',_0x4642('0xaa'));_0x422283['field'](_0x4642('0xab'),_0x4642('0xac'));_0x422283[_0x4642('0x4b')](_0x4642('0xad'),_0x4642('0xae'));_0x422283[_0x4642('0x4b')](_0x4642('0xaf'),_0x4642('0xb0'));_0x422283[_0x4642('0x4b')](_0x4642('0xb1'),'Contact.mobile');_0x422283[_0x4642('0x4b')](_0x4642('0xb2'),_0x4642('0xb3'));_0x422283[_0x4642('0x4b')](_0x4642('0xb4'),_0x4642('0xb5'));_0x422283[_0x4642('0x4b')](_0x4642('0xb6'),_0x4642('0xb7'));_0x422283[_0x4642('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4642('0x35'));}if(_0x58680e[_0x4642('0x27')])_0x422283[_0x4642('0x27')](_0x58680e[_0x4642('0x27')]);if(_0x58680e[_0x4642('0x25')])_0x422283[_0x4642('0x25')](_0x58680e['offset']);return db[_0x4642('0xa0')][_0x4642('0x42')](_0x422283[_0x4642('0xa1')](),_0x9d99a9);})['then'](function(_0x53c80f){if(_0x53c80f[_0x4642('0x63')]>0x0)_0x2ecc55[_0x4642('0x48')](_0x4642('0xb8'),_[_0x4642('0x33')](_0x53c80f,'id'));return db['sequelize']['query'](_0x2ecc55['toString'](),_0x9d99a9)[_0x4642('0x2e')](function(_0x5a0809){var _0x2d503c=_[_0x4642('0xb9')](_0x5a0809,_0x4642('0xba'));var _0x4d92b5=[];_0x53c80f[_0x4642('0x38')](function(_0x30c25b){_0x4d92b5[_0x4642('0xbb')](updateSmsInteraction(_0x30c25b,_0x57da64,_0x2d503c));});return BPromise[_0x4642('0xbc')](_0x4d92b5);});});})[_0x4642('0x2e')](function(_0x1728b4){_0x565de4[_0x4642('0xbd')]=_0x1728b4;return _0x565de4;})[_0x4642('0x2e')](respondWithFilteredResult(_0x2e9dbf,_0x58680e))[_0x4642('0x39')](handleError(_0x2e9dbf,null));};exports['show']=function(_0xbc4e75,_0x1ec5af){var _0x11d502={'raw':![],'where':{'id':_0xbc4e75['params']['id']}},_0x50276b={};_0x50276b[_0x4642('0x40')]=_[_0x4642('0x41')](db[_0x4642('0x3b')][_0x4642('0x3c')]);_0x50276b[_0x4642('0x42')]=_[_0x4642('0x41')](_0xbc4e75[_0x4642('0x42')]);_0x50276b['filters']=_[_0x4642('0x43')](_0x50276b['model'],_0x50276b['query']);_0x11d502[_0x4642('0x44')]=_['intersection'](_0x50276b['model'],qs['fields'](_0xbc4e75[_0x4642('0x42')][_0x4642('0xa4')]));_0x11d502['attributes']=_0x11d502['attributes'][_0x4642('0x63')]?_0x11d502['attributes']:_0x50276b[_0x4642('0x40')];if(_0xbc4e75[_0x4642('0x42')][_0x4642('0xbe')]){_0x11d502[_0x4642('0xbf')]=[{'all':!![]}];}_0x11d502=_[_0x4642('0xa3')]({},_0x11d502,_0xbc4e75[_0x4642('0xc0')]);return db[_0x4642('0x3b')][_0x4642('0x65')](_0x11d502)[_0x4642('0x2e')](handleEntityNotFound(_0x1ec5af,null))[_0x4642('0x2e')](respondWithResult(_0x1ec5af,null))['catch'](handleError(_0x1ec5af,null));};exports['create']=function(_0x5a6d93,_0xd7aa15){return db[_0x4642('0x3b')][_0x4642('0xc1')](_0x5a6d93['body'],{})[_0x4642('0x2e')](respondWithResult(_0xd7aa15,0xc9))['catch'](handleError(_0xd7aa15,null));};exports[_0x4642('0xc2')]=function(_0xd980b2,_0x195d17){if(_0xd980b2[_0x4642('0xc3')]['id']){delete _0xd980b2[_0x4642('0xc3')]['id'];}return db[_0x4642('0x3b')][_0x4642('0x65')]({'where':{'id':_0xd980b2[_0x4642('0xc4')]['id']}})[_0x4642('0x2e')](handleEntityNotFound(_0x195d17,null))['then'](saveUpdates(_0xd980b2[_0x4642('0xc3')],null))[_0x4642('0x2e')](respondWithResult(_0x195d17,null))[_0x4642('0x39')](handleError(_0x195d17,null));};exports[_0x4642('0x2d')]=function(_0x4008df,_0x23cf62){return db[_0x4642('0x3b')][_0x4642('0x65')]({'where':{'id':_0x4008df[_0x4642('0xc4')]['id']}})['then'](handleEntityNotFound(_0x23cf62,null))['then'](removeEntity(_0x23cf62,null))[_0x4642('0x39')](handleError(_0x23cf62,null));};exports[_0x4642('0xc5')]=function(_0x9bf5e3,_0x5b85ba){return db[_0x4642('0x3b')][_0x4642('0xc5')]()[_0x4642('0x2e')](respondWithResult(_0x5b85ba,null))['catch'](handleError(_0x5b85ba,null));};exports['addMessage']=function(_0x5445a9,_0x7aed3d,_0x13b6d3){return db[_0x4642('0xc6')]['find']({'where':{'id':_0x5445a9[_0x4642('0xc4')]['id']}})[_0x4642('0x2e')](handleEntityNotFound(_0x7aed3d,null))[_0x4642('0x2e')](function(_0x1a718e){if(_0x1a718e){return _0x1a718e[_0x4642('0xc7')](_0x5445a9[_0x4642('0xc3')][_0x4642('0xc8')],_['omit'](_0x5445a9[_0x4642('0xc3')],[_0x4642('0xc8'),'id'])||{});}})[_0x4642('0x2e')](respondWithResult(_0x7aed3d,null))[_0x4642('0x39')](handleError(_0x7aed3d,null));};exports[_0x4642('0xc9')]=function(_0x5221e2,_0x549a58,_0x17a2ab){var _0x58e35f={'raw':![],'where':{}};var _0x513d28={};var _0x12e6e3={'count':0x0,'rows':[]};return db[_0x4642('0x3b')][_0x4642('0xca')]({'where':{'id':_0x5221e2[_0x4642('0xc4')]['id']}})[_0x4642('0x2e')](handleEntityNotFound(_0x549a58,null))[_0x4642('0x2e')](function(_0xa14513){if(_0xa14513){_0x513d28[_0x4642('0x40')]=_[_0x4642('0x41')](db['SmsMessage'][_0x4642('0x3c')]);_0x513d28[_0x4642('0x42')]=_[_0x4642('0x41')](_0x5221e2[_0x4642('0x42')]);_0x513d28['filters']=_[_0x4642('0x43')](_0x513d28[_0x4642('0x40')],_0x513d28[_0x4642('0x42')]);_0x58e35f[_0x4642('0x44')]=_[_0x4642('0x43')](_0x513d28[_0x4642('0x40')],qs[_0x4642('0xa4')](_0x5221e2[_0x4642('0x42')][_0x4642('0xa4')]));_0x58e35f[_0x4642('0x44')]=_0x58e35f[_0x4642('0x44')][_0x4642('0x63')]?_0x58e35f[_0x4642('0x44')]:_0x513d28[_0x4642('0x40')];if(!_0x5221e2[_0x4642('0x42')][_0x4642('0xcb')](_0x4642('0x45'))){_0x58e35f['limit']=qs['limit'](_0x5221e2[_0x4642('0x42')][_0x4642('0x27')]);_0x58e35f[_0x4642('0x25')]=qs[_0x4642('0x25')](_0x5221e2[_0x4642('0x42')][_0x4642('0x25')]);}_0x58e35f[_0x4642('0x46')]=qs['sort'](_0x5221e2[_0x4642('0x42')][_0x4642('0x47')]);_0x58e35f[_0x4642('0x48')]=qs['filters'](_[_0x4642('0x49')](_0x5221e2[_0x4642('0x42')],_0x513d28[_0x4642('0x4a')]));_0x58e35f[_0x4642('0x48')]['SmsInteractionId']=_0xa14513['id'];if(_0x5221e2[_0x4642('0x42')][_0x4642('0x8b')]){_0x58e35f[_0x4642('0x48')]=_['merge'](_0x58e35f['where'],{'$or':_[_0x4642('0x33')](_0x58e35f[_0x4642('0x44')],function(_0x4e1ffb){var _0x26b5a3={};_0x26b5a3[_0x4e1ffb]={'$like':'%'+_0x5221e2[_0x4642('0x42')][_0x4642('0x8b')]+'%'};return _0x26b5a3;})});}if(_0x5221e2[_0x4642('0x42')][_0x4642('0x7e')]){var _0x1b197e=_0x5221e2[_0x4642('0x42')][_0x4642('0x7e')]['split'](',');var _0x5cf835={};_0x5cf835[_0x1b197e[0x0]]={'$gte':moment(_0x1b197e[0x1])[_0x4642('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x58e35f[_0x4642('0x48')]=_['merge'](_0x58e35f[_0x4642('0x48')],_0x5cf835);}_0x58e35f=_['merge']({},_0x58e35f,_0x5221e2[_0x4642('0xc0')]);return db[_0x4642('0xc6')]['count']({'where':_0x58e35f['where']})[_0x4642('0x2e')](function(_0x5b1520){_0x12e6e3['count']=_0x5b1520;if(_0x5221e2[_0x4642('0x42')][_0x4642('0xbe')]){_0x58e35f[_0x4642('0xbf')]=[{'all':!![]}];}return db[_0x4642('0xc6')][_0x4642('0xcd')](_0x58e35f);})['then'](function(_0x2368cb){_0x12e6e3[_0x4642('0xbd')]=_0x2368cb;return _0x12e6e3;});}})[_0x4642('0x2e')](respondWithFilteredResult(_0x549a58,_0x58e35f))[_0x4642('0x39')](handleError(_0x549a58,null));};exports[_0x4642('0xce')]=function(_0x3919e8,_0x86eb65,_0x6a8e05){return db[_0x4642('0x3b')][_0x4642('0x65')]({'where':{'id':_0x3919e8[_0x4642('0xc4')]['id']}})[_0x4642('0x2e')](handleEntityNotFound(_0x86eb65,null))[_0x4642('0x2e')](function(_0x9612db){if(_0x9612db){return _0x9612db[_0x4642('0xcf')](_0x3919e8['body'][_0x4642('0xc8')],_[_0x4642('0xd0')](_0x3919e8[_0x4642('0xc3')],['ids','id'])||{})[_0x4642('0xd1')](function(){return db[_0x4642('0x72')][_0x4642('0xcd')]({'attributes':['id','name','color'],'where':{'id':_0x3919e8[_0x4642('0xc3')]['ids']}});})[_0x4642('0x2e')](function(_0x415673){socket[_0x4642('0xd2')](_0x4642('0xd3'),{'id':Number(_0x3919e8[_0x4642('0xc4')]['id']),'tags':_0x415673||[]});return{'id':Number(_0x3919e8[_0x4642('0xc4')]['id']),'tags':_0x415673||[]};});}})[_0x4642('0x2e')](respondWithResult(_0x86eb65,null))[_0x4642('0x39')](handleError(_0x86eb65,null));};exports[_0x4642('0xd4')]=function(_0xddc56a,_0x1f1701,_0x4533c3){return db[_0x4642('0x3b')][_0x4642('0x65')]({'where':{'id':_0xddc56a['params']['id']}})[_0x4642('0x2e')](handleEntityNotFound(_0x1f1701,null))[_0x4642('0x2e')](function(_0x2e5123){if(_0x2e5123){return _0x2e5123[_0x4642('0xd4')](_0xddc56a['query'][_0x4642('0xc8')]);}})[_0x4642('0x2e')](respondWithStatusCode(_0x1f1701,null))[_0x4642('0x39')](handleError(_0x1f1701,null));};exports[_0x4642('0xd5')]=function(_0x5f449d,_0x4e59ac){var _0x45c46a=moment()[_0x4642('0xd6')]()[_0x4642('0xa1')]();var _0x34f538=path[_0x4642('0xd7')](config[_0x4642('0xd8')],_0x4642('0xd9'),_0x4642('0xda'),_0x4642('0xdb'));var _0x5b5dde=path[_0x4642('0xd7')](config['root'],_0x4642('0xd9'),_0x4642('0xda'),_0x4642('0xdc'));var _0x1bdd09=path[_0x4642('0xd7')](_0x34f538,_0x45c46a);var _0x9ac750=util[_0x4642('0xcc')](_0x4642('0xdd'),_0x5f449d[_0x4642('0xc4')]['id'],_0x45c46a);var _0x10b152=path['join'](_0x34f538,_0x9ac750);var _0x234028=[];_0x234028[_0x4642('0xbb')]({'model':db[_0x4642('0x74')],'as':_0x4642('0x74'),'attributes':['id',_0x4642('0x34')],'raw':!![]});_0x234028[_0x4642('0xbb')]({'model':db[_0x4642('0xde')],'as':_0x4642('0x6a'),'attributes':['id',_0x4642('0xdf'),_0x4642('0xe0')],'raw':!![]});var _0x284d00=[{'model':db['SmsMessage'],'as':_0x4642('0xe1'),'attributes':['id',_0x4642('0xc3'),'createdAt',_0x4642('0xe2'),_0x4642('0xe3'),'read'],'include':_0x234028}];_0x284d00[_0x4642('0xbb')]({'model':db['SmsAccount'],'as':_0x4642('0xe4'),'attributes':['id',_0x4642('0x30')]});_0x284d00['push']({'model':db[_0x4642('0x74')],'as':_0x4642('0xe5'),'attributes':['id',_0x4642('0x34')]});return db[_0x4642('0x3b')][_0x4642('0x65')]({'where':{'id':_0x5f449d[_0x4642('0xc4')]['id']},'include':_0x284d00})[_0x4642('0x2e')](handleEntityNotFound(_0x4e59ac,null))[_0x4642('0x2e')](function(_0x9a5cee){if(_0x9a5cee){var _0x59e6c4=_0x9a5cee['get']({'plain':!![]});fs[_0x4642('0xe6')](_0x1bdd09);var _0x1ce42e={'channel':_0x4642('0xe7'),'account':_0x59e6c4[_0x4642('0xe4')][_0x4642('0x30')],'agent':_0x59e6c4[_0x4642('0xe5')]?_0x59e6c4[_0x4642('0xe5')][_0x4642('0x34')]:_0x4642('0xe8'),'createdAt':moment(_0x59e6c4[_0x4642('0x7d')])['format'](_0x4642('0xe9'))[_0x4642('0xa1')](),'closedAt':_0x59e6c4['closed']?moment(_0x59e6c4[_0x4642('0xea')])[_0x4642('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4642('0xa1')]():'','disposition':_0x59e6c4[_0x4642('0xeb')],'messages':_(_0x59e6c4[_0x4642('0xe1')])[_0x4642('0x8b')]({'secret':![]})[_0x4642('0x33')](function(_0x3c492d){return{'date':moment(_0x3c492d[_0x4642('0x7d')])[_0x4642('0xcc')](_0x4642('0xe9'))['toString'](),'sender':_0x3c492d[_0x4642('0xe2')]===_0x4642('0xec')?_0x3c492d[_0x4642('0x74')]?_0x3c492d['User'][_0x4642('0x34')]:_0x4642('0xed'):_0x3c492d[_0x4642('0x6a')][_0x4642('0xdf')]+(_0x3c492d[_0x4642('0x6a')][_0x4642('0xe0')]?'\x20'+_0x3c492d[_0x4642('0x6a')][_0x4642('0xe0')]:''),'body':_0x3c492d[_0x4642('0xc3')],'direction':_0x3c492d['direction']===_0x4642('0xec')?'A':'C','secret':_0x3c492d[_0x4642('0xe3')],'read':_0x3c492d[_0x4642('0x84')]};})[_0x4642('0x67')]()};return ejs[_0x4642('0xee')](path['join'](config[_0x4642('0xd8')],'server',_0x4642('0xef'),'downloadInteraction.ejs'),{'interaction':_0x1ce42e})['then'](function(_0x3f01f3){var _0x47f5b2=path['join'](_0x1bdd09,_0x4642('0xf0')+_0x59e6c4['id']+'-'+_0x45c46a+_0x4642('0xf1'));var _0x3d4770={'path':_0x47f5b2,'channel':_0x4642('0xe7'),'interactionId':_0x59e6c4['id']};return pdf[_0x4642('0xf2')](_0x3f01f3,_0x3d4770);})[_0x4642('0x2e')](function(){return new BPromise(function(_0xa20aae,_0x5ee7f4){zipdir(_0x1bdd09,{'saveTo':_0x10b152},function(_0x6993b5,_0x5dd7c8){if(_0x6993b5)return _0x5ee7f4(_0x6993b5);return _0xa20aae(_0x5dd7c8);});})[_0x4642('0x2e')](function(){return new BPromise(function(_0x1dc701,_0x455805){rimraf(_0x1bdd09,function(_0x2275ac){if(_0x2275ac)_0x455805(_0x2275ac);return _0x1dc701();});});})[_0x4642('0x2e')](function(){return _0x4e59ac[_0x4642('0xd5')](_0x10b152,_0x9ac750,function(_0x55e213){if(_0x55e213){console['log']('err',_0x55e213);}else{fs[_0x4642('0xf3')](_0x10b152);}});});});}else{return _0x4e59ac[_0x4642('0x21')](0xc8);}})[_0x4642('0x39')](handleError(_0x4e59ac,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 108bf41..31040e5 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 _0x1a37=['events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','unreadMessages','length','emit','catch'];(function(_0x162e8e,_0x1e7b12){var _0x4a9718=function(_0x2f5d58){while(--_0x2f5d58){_0x162e8e['push'](_0x162e8e['shift']());}};_0x4a9718(++_0x1e7b12);}(_0x1a37,0xb4));var _0x71a3=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x1a37[_0x485b5a];return _0xd2b34d;};'use strict';var EventEmitter=require(_0x71a3('0x0'));var SmsInteraction=require(_0x71a3('0x1'))['db'][_0x71a3('0x2')];var SmsMessage=require(_0x71a3('0x1'))['db'][_0x71a3('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x71a3('0x4')](0x0);var events={'afterCreate':_0x71a3('0x5'),'afterUpdate':_0x71a3('0x6'),'afterDestroy':_0x71a3('0x7')};function emitEvent(_0x100181){return function(_0x4af5b4,_0x11e8a8,_0x4f6b7a){_0x4af5b4[_0x71a3('0x8')]({'attributes':['id'],'raw':!![]})[_0x71a3('0x9')](function(_0x231ea7){_0x4af5b4[_0x71a3('0xa')]('Users',_0x231ea7['map'](function(_0x56c351){return{'id':_0x56c351['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4af5b4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x71a3('0x9')](function(_0x18320a){_0x4af5b4[_0x71a3('0xa')](_0x71a3('0xb'),_0x18320a[_0x71a3('0xc')]);SmsInteractionEvents[_0x71a3('0xd')](_0x100181+':'+_0x4af5b4['id'],_0x4af5b4);SmsInteractionEvents[_0x71a3('0xd')](_0x100181,_0x4af5b4);_0x4f6b7a(null);})[_0x71a3('0xe')](_0x4f6b7a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xaebd=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events'];(function(_0x2c49d9,_0x365e13){var _0x4c6457=function(_0x578d1a){while(--_0x578d1a){_0x2c49d9['push'](_0x2c49d9['shift']());}};_0x4c6457(++_0x365e13);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x5ef054,_0x4d976c){_0x5ef054=_0x5ef054-0x0;var _0x1077d5=_0xaebd[_0x5ef054];return _0x1077d5;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xdaeb('0x1')];var SmsMessage=require(_0xdaeb('0x2'))['db'][_0xdaeb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xdaeb('0x4')](0x0);var events={'afterCreate':_0xdaeb('0x5'),'afterUpdate':'update','afterDestroy':_0xdaeb('0x6')};function emitEvent(_0x1c617a){return function(_0x1a99be,_0x1141fe,_0xee94f9){_0x1a99be['getUsers']({'attributes':['id'],'raw':!![]})[_0xdaeb('0x7')](function(_0x3f7ba1){_0x1a99be['setDataValue']('Users',_0x3f7ba1[_0xdaeb('0x8')](function(_0x11b164){return{'id':_0x11b164['id']};}));return SmsMessage[_0xdaeb('0x9')]({'where':{'SmsInteractionId':_0x1a99be['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xbb4b72){_0x1a99be['setDataValue'](_0xdaeb('0xa'),_0xbb4b72['length']);SmsInteractionEvents[_0xdaeb('0xb')](_0x1c617a+':'+_0x1a99be['id'],_0x1a99be);SmsInteractionEvents['emit'](_0x1c617a,_0x1a99be);_0xee94f9(null);})[_0xdaeb('0xc')](_0xee94f9(null));};}for(var e in events){if(events[_0xdaeb('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a2b3358..20bd7c5 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 _0x108a=['define','SmsInteraction','sms_interactions','closed','closedAt','util','api','moment','rimraf','./smsInteraction.attributes'];(function(_0x4d31da,_0x4dbd2f){var _0x50dab3=function(_0x578959){while(--_0x578959){_0x4d31da['push'](_0x4d31da['shift']());}};_0x50dab3(++_0x4dbd2f);}(_0x108a,0x1e5));var _0xa108=function(_0x10c697,_0x40285d){_0x10c697=_0x10c697-0x0;var _0x3f938c=_0x108a[_0x10c697];return _0x3f938c;};'use strict';var _=require('lodash');var util=require(_0xa108('0x0'));var logger=require('../../config/logger')(_0xa108('0x1'));var moment=require(_0xa108('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa108('0x3'));var config=require('../../config/environment');var attributes=require(_0xa108('0x4'));module['exports']=function(_0x5680d0,_0x226d95){return _0x5680d0[_0xa108('0x5')](_0xa108('0x6'),attributes,{'tableName':_0xa108('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x223ccb,_0x562550,_0x5067b5){if(_0x223ccb['changed'](_0xa108('0x8'))){_0x223ccb[_0xa108('0x9')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5067b5(null,_0x223ccb);}}});}; \ No newline at end of file +var _0xbbaf=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xbbaf,0xa4));var _0xfbba=function(_0x3f042c,_0x3d2cfe){_0x3f042c=_0x3f042c-0x0;var _0x280d2e=_0xbbaf[_0x3f042c];return _0x280d2e;};'use strict';var _=require(_0xfbba('0x0'));var util=require(_0xfbba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfbba('0x2'));var BPromise=require(_0xfbba('0x3'));var rp=require(_0xfbba('0x4'));var fs=require('fs');var path=require(_0xfbba('0x5'));var rimraf=require(_0xfbba('0x6'));var config=require(_0xfbba('0x7'));var attributes=require(_0xfbba('0x8'));module[_0xfbba('0x9')]=function(_0x428683,_0x2de7eb){return _0x428683[_0xfbba('0xa')]('SmsInteraction',attributes,{'tableName':_0xfbba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ec877,_0x575275,_0x4fbe5d){if(_0x4ec877['changed'](_0xfbba('0xc'))){_0x4ec877[_0xfbba('0xd')]=moment()[_0xfbba('0xe')](_0xfbba('0xf'));}_0x4fbe5d(null,_0x4ec877);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 13a1a3c..81e26d4 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 _0x2cfc=['options','raw','where','limit','stringify','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body'];(function(_0x9fcdc8,_0x5839d4){var _0x1c047b=function(_0x31f87d){while(--_0x31f87d){_0x9fcdc8['push'](_0x9fcdc8['shift']());}};_0x1c047b(++_0x5839d4);}(_0x2cfc,0x1ce));var _0xc2cf=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2cfc[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0xc2cf('0x0'));var moment=require(_0xc2cf('0x1'));var BPromise=require(_0xc2cf('0x2'));var rs=require(_0xc2cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2cf('0x4'))['db'];var utils=require(_0xc2cf('0x5'));var logger=require('../../config/logger')(_0xc2cf('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2cf('0x7')][_0xc2cf('0x8')]({'port':0x232a});config[_0xc2cf('0x9')]=_[_0xc2cf('0xa')](config[_0xc2cf('0x9')],{'host':_0xc2cf('0xb'),'port':0x18eb});var socket=require(_0xc2cf('0xc'))(new Redis(config[_0xc2cf('0x9')]));require(_0xc2cf('0xd'))[_0xc2cf('0xe')](socket);function respondWithRpcPromise(_0x80e23c,_0x182335,_0xae9c39){return new BPromise(function(_0x4524f7,_0x3325fa){return client[_0xc2cf('0xf')](_0x80e23c,_0xae9c39)[_0xc2cf('0x10')](function(_0x884644){logger[_0xc2cf('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x182335,_0xc2cf('0x12'));logger[_0xc2cf('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x182335,_0xc2cf('0x12'),JSON['stringify'](_0x884644));if(_0x884644[_0xc2cf('0x14')]){if(_0x884644[_0xc2cf('0x14')][_0xc2cf('0x15')]===0x1f4){logger[_0xc2cf('0x14')](_0xc2cf('0x16'),_0x182335,_0x884644['error'][_0xc2cf('0x17')]);return _0x3325fa(_0x884644[_0xc2cf('0x14')][_0xc2cf('0x17')]);}logger[_0xc2cf('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x182335,_0x884644[_0xc2cf('0x14')][_0xc2cf('0x17')]);return _0x4524f7(_0x884644[_0xc2cf('0x14')][_0xc2cf('0x17')]);}else{logger['info'](_0xc2cf('0x16'),_0x182335,_0xc2cf('0x12'));_0x4524f7(_0x884644[_0xc2cf('0x18')][_0xc2cf('0x17')]);}})[_0xc2cf('0x19')](function(_0x36d895){logger[_0xc2cf('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x182335,_0x36d895);_0x3325fa(_0x36d895);});});}exports[_0xc2cf('0x1a')]=function(_0x5e3e6e){var _0x37dcd9=this;return new Promise(function(_0x2abfb6,_0x17060a){return db[_0xc2cf('0x1b')][_0xc2cf('0x1c')](_0x5e3e6e[_0xc2cf('0x1d')],{'raw':_0x5e3e6e[_0xc2cf('0x1e')]?_0x5e3e6e[_0xc2cf('0x1e')][_0xc2cf('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3e6e['options']?_0x5e3e6e[_0xc2cf('0x1e')][_0xc2cf('0x20')]||null:null,'attributes':_0x5e3e6e[_0xc2cf('0x1e')]?_0x5e3e6e['options']['attributes']||null:null,'limit':_0x5e3e6e[_0xc2cf('0x1e')]?_0x5e3e6e[_0xc2cf('0x1e')][_0xc2cf('0x21')]||null:null})[_0xc2cf('0x10')](function(_0x4779b3){logger[_0xc2cf('0x11')](_0xc2cf('0x1a'),_0x5e3e6e);logger[_0xc2cf('0x13')](_0xc2cf('0x1a'),_0x5e3e6e,JSON[_0xc2cf('0x22')](_0x4779b3));_0x2abfb6(_0x4779b3);})[_0xc2cf('0x19')](function(_0x1e51a7){logger[_0xc2cf('0x14')](_0xc2cf('0x1a'),_0x1e51a7[_0xc2cf('0x17')],_0x5e3e6e);_0x17060a(_0x37dcd9['error'](0x1f4,_0x1e51a7[_0xc2cf('0x17')]));});});};exports[_0xc2cf('0x23')]=function(_0x321163){return new Promise(function(_0x591db2,_0xc3f5b){return db[_0xc2cf('0x1b')][_0xc2cf('0x24')]({'where':_0x321163[_0xc2cf('0x1e')]?_0x321163[_0xc2cf('0x1e')]['where']||null:null})[_0xc2cf('0x10')](function(_0x30f87b){if(_0x30f87b){return _0x30f87b[_0xc2cf('0x25')](_0x321163['body'][_0xc2cf('0x26')],_['omit'](_0x321163[_0xc2cf('0x1d')],[_0xc2cf('0x26'),'id'])||{});}})[_0xc2cf('0x27')](function(_0x305393){logger[_0xc2cf('0x11')]('AddTags',_0x321163);logger[_0xc2cf('0x13')](_0xc2cf('0x28'),_0x321163,JSON[_0xc2cf('0x22')](_0x305393));_0x591db2(_0x305393);})[_0xc2cf('0x19')](function(_0x2532b4){logger['error']('AddTags',_0x2532b4[_0xc2cf('0x17')],_0x321163);_0xc3f5b(_this[_0xc2cf('0x14')](0x1f4,_0x2532b4[_0xc2cf('0x17')]));});});}; \ No newline at end of file +var _0x5148=['spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','limit','debug','AddTagsToSmsInteraction','find','where','ids','omit'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0x5148,0x113));var _0x8514=function(_0x432af8,_0x477b3d){_0x432af8=_0x432af8-0x0;var _0x228f4f=_0x5148[_0x432af8];return _0x228f4f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8514('0x0'));var BPromise=require(_0x8514('0x1'));var rs=require(_0x8514('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8514('0x3'))['db'];var utils=require(_0x8514('0x4'));var logger=require('../../config/logger')(_0x8514('0x5'));var config=require(_0x8514('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8514('0x7')][_0x8514('0x8')]({'port':0x232a});config[_0x8514('0x9')]=_[_0x8514('0xa')](config[_0x8514('0x9')],{'host':_0x8514('0xb'),'port':0x18eb});var socket=require(_0x8514('0xc'))(new Redis(config[_0x8514('0x9')]));require('./smsInteraction.socket')[_0x8514('0xd')](socket);function respondWithRpcPromise(_0x2c0f98,_0x31135c,_0x3f87dd){return new BPromise(function(_0x1f7c48,_0x48d2bf){return client[_0x8514('0xe')](_0x2c0f98,_0x3f87dd)[_0x8514('0xf')](function(_0x44659a){logger[_0x8514('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x31135c,_0x8514('0x11'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x31135c,_0x8514('0x11'),JSON[_0x8514('0x12')](_0x44659a));if(_0x44659a[_0x8514('0x13')]){if(_0x44659a['error'][_0x8514('0x14')]===0x1f4){logger[_0x8514('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x31135c,_0x44659a[_0x8514('0x13')][_0x8514('0x15')]);return _0x48d2bf(_0x44659a[_0x8514('0x13')][_0x8514('0x15')]);}logger[_0x8514('0x13')](_0x8514('0x16'),_0x31135c,_0x44659a[_0x8514('0x13')][_0x8514('0x15')]);return _0x1f7c48(_0x44659a[_0x8514('0x13')][_0x8514('0x15')]);}else{logger[_0x8514('0x10')](_0x8514('0x16'),_0x31135c,_0x8514('0x11'));_0x1f7c48(_0x44659a[_0x8514('0x17')][_0x8514('0x15')]);}})[_0x8514('0x18')](function(_0x2b5f58){logger[_0x8514('0x13')](_0x8514('0x16'),_0x31135c,_0x2b5f58);_0x48d2bf(_0x2b5f58);});});}exports[_0x8514('0x19')]=function(_0x35079f){var _0x4e1db0=this;return new Promise(function(_0x369d2d,_0x4477a5){return db[_0x8514('0x1a')][_0x8514('0x1b')](_0x35079f[_0x8514('0x1c')],{'raw':_0x35079f['options']?_0x35079f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35079f[_0x8514('0x1d')]?_0x35079f[_0x8514('0x1d')]['where']||null:null,'attributes':_0x35079f[_0x8514('0x1d')]?_0x35079f[_0x8514('0x1d')]['attributes']||null:null,'limit':_0x35079f[_0x8514('0x1d')]?_0x35079f[_0x8514('0x1d')][_0x8514('0x1e')]||null:null})[_0x8514('0xf')](function(_0x4b7fb1){logger['info'](_0x8514('0x19'),_0x35079f);logger[_0x8514('0x1f')]('UpdateSmsInteraction',_0x35079f,JSON['stringify'](_0x4b7fb1));_0x369d2d(_0x4b7fb1);})['catch'](function(_0x158bfd){logger['error'](_0x8514('0x19'),_0x158bfd[_0x8514('0x15')],_0x35079f);_0x4477a5(_0x4e1db0[_0x8514('0x13')](0x1f4,_0x158bfd[_0x8514('0x15')]));});});};exports[_0x8514('0x20')]=function(_0x28513d){return new Promise(function(_0x39a52d,_0x231dde){return db['SmsInteraction'][_0x8514('0x21')]({'where':_0x28513d[_0x8514('0x1d')]?_0x28513d[_0x8514('0x1d')][_0x8514('0x22')]||null:null})[_0x8514('0xf')](function(_0x458daf){if(_0x458daf){return _0x458daf['addTags'](_0x28513d[_0x8514('0x1c')][_0x8514('0x23')],_[_0x8514('0x24')](_0x28513d['body'],[_0x8514('0x23'),'id'])||{});}})[_0x8514('0x25')](function(_0x1db6df){logger[_0x8514('0x10')](_0x8514('0x26'),_0x28513d);logger[_0x8514('0x1f')](_0x8514('0x26'),_0x28513d,JSON[_0x8514('0x12')](_0x1db6df));_0x39a52d(_0x1db6df);})[_0x8514('0x18')](function(_0x5565e4){logger[_0x8514('0x13')]('AddTags',_0x5565e4[_0x8514('0x15')],_0x28513d);_0x231dde(_this['error'](0x1f4,_0x5565e4[_0x8514('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b19b0ed..69b61d1 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 _0x3618=['save','remove','emit','removeListener','register'];(function(_0x2cb844,_0x455421){var _0x34c258=function(_0x903c28){while(--_0x903c28){_0x2cb844['push'](_0x2cb844['shift']());}};_0x34c258(++_0x455421);}(_0x3618,0x1c2));var _0x8361=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x3618[_0x618414];return _0x21c19a;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x8361('0x0'),_0x8361('0x1'),'update'];function createListener(_0x57cc1d,_0x40b4ae){return function(_0x12ec91){_0x40b4ae[_0x8361('0x2')](_0x57cc1d,_0x12ec91);};}function removeListener(_0x28e32f,_0x1fe54a){return function(){SmsInteractionEvents[_0x8361('0x3')](_0x28e32f,_0x1fe54a);};}exports[_0x8361('0x4')]=function(_0x5d6e45){for(var _0x2847d8=0x0,_0x531d00=events['length'];_0x2847d8<_0x531d00;_0x2847d8++){var _0x172adf=events[_0x2847d8];var _0x4a34b1=createListener('smsInteraction:'+_0x172adf,_0x5d6e45);SmsInteractionEvents['on'](_0x172adf,_0x4a34b1);}}; \ No newline at end of file +var _0x57ae=['removeListener','length','smsInteraction:','save','remove','update','emit'];(function(_0x3951a6,_0x1ef76e){var _0x27daf8=function(_0x5457bd){while(--_0x5457bd){_0x3951a6['push'](_0x3951a6['shift']());}};_0x27daf8(++_0x1ef76e);}(_0x57ae,0x10d));var _0xe57a=function(_0x5ede09,_0x118079){_0x5ede09=_0x5ede09-0x0;var _0x272d3c=_0x57ae[_0x5ede09];return _0x272d3c;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xe57a('0x0'),_0xe57a('0x1'),_0xe57a('0x2')];function createListener(_0x1c87e8,_0x2942a4){return function(_0x496bfe){_0x2942a4[_0xe57a('0x3')](_0x1c87e8,_0x496bfe);};}function removeListener(_0xe93fa3,_0x19b588){return function(){SmsInteractionEvents[_0xe57a('0x4')](_0xe93fa3,_0x19b588);};}exports['register']=function(_0x548934){for(var _0x5466ee=0x0,_0x5683f0=events[_0xe57a('0x5')];_0x5466ee<_0x5683f0;_0x5466ee++){var _0x4e3d94=events[_0x5466ee];var _0x8f7963=createListener(_0xe57a('0x6')+_0x4e3d94,_0x548934);SmsInteractionEvents['on'](_0x4e3d94,_0x8f7963);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d443e3f..baa0417 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 _0x5dbd=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','tracked','sms','smsmessage:create','create','post','put','update','/:id/accept','accept','reject','delete'];(function(_0x541a1b,_0x2fe1f9){var _0x57940f=function(_0x2587aa){while(--_0x2587aa){_0x541a1b['push'](_0x541a1b['shift']());}};_0x57940f(++_0x2fe1f9);}(_0x5dbd,0x9d));var _0xd5db=function(_0x5343d0,_0x1136f9){_0x5343d0=_0x5343d0-0x0;var _0x943cd=_0x5dbd[_0x5343d0];return _0x943cd;};'use strict';var multer=require(_0xd5db('0x0'));var util=require(_0xd5db('0x1'));var path=require('path');var timeout=require(_0xd5db('0x2'));var express=require(_0xd5db('0x3'));var router=express[_0xd5db('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd5db('0x5'));var interaction=require(_0xd5db('0x6'));var config=require(_0xd5db('0x7'));var controller=require(_0xd5db('0x8'));router[_0xd5db('0x9')]('/',auth[_0xd5db('0xa')](),controller[_0xd5db('0xb')]);router[_0xd5db('0x9')]('/describe',auth[_0xd5db('0xa')](),controller[_0xd5db('0xc')]);router[_0xd5db('0x9')](_0xd5db('0xd'),auth[_0xd5db('0xa')](),controller['show']);router['post']('/',auth[_0xd5db('0xa')](),interaction[_0xd5db('0xe')](_0xd5db('0xf'),_0xd5db('0x10')),controller[_0xd5db('0x11')]);router[_0xd5db('0x12')]('/:id/status',controller['status']);router[_0xd5db('0x13')]('/:id',auth[_0xd5db('0xa')](),controller[_0xd5db('0x14')]);router[_0xd5db('0x13')](_0xd5db('0x15'),auth[_0xd5db('0xa')](),controller[_0xd5db('0x16')]);router[_0xd5db('0x13')]('/:id/reject',auth[_0xd5db('0xa')](),controller[_0xd5db('0x17')]);router[_0xd5db('0x18')]('/:id',auth[_0xd5db('0xa')](),controller['destroy']);module[_0xd5db('0x19')]=router; \ No newline at end of file +var _0x47a1=['show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/reject','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x47a1,0x179));var _0x147a=function(_0x2ecdfa,_0x244181){_0x2ecdfa=_0x2ecdfa-0x0;var _0x445618=_0x47a1[_0x2ecdfa];return _0x445618;};'use strict';var multer=require('multer');var util=require(_0x147a('0x0'));var path=require(_0x147a('0x1'));var timeout=require('connect-timeout');var express=require(_0x147a('0x2'));var router=express['Router']();var fs_extra=require(_0x147a('0x3'));var auth=require(_0x147a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x147a('0x5'));var controller=require(_0x147a('0x6'));router[_0x147a('0x7')]('/',auth[_0x147a('0x8')](),controller[_0x147a('0x9')]);router['get'](_0x147a('0xa'),auth[_0x147a('0x8')](),controller[_0x147a('0xb')]);router['get'](_0x147a('0xc'),auth[_0x147a('0x8')](),controller[_0x147a('0xd')]);router[_0x147a('0xe')]('/',auth[_0x147a('0x8')](),interaction[_0x147a('0xf')](_0x147a('0x10'),_0x147a('0x11')),controller[_0x147a('0x12')]);router[_0x147a('0xe')](_0x147a('0x13'),controller[_0x147a('0x14')]);router[_0x147a('0x15')](_0x147a('0xc'),auth[_0x147a('0x8')](),controller[_0x147a('0x16')]);router[_0x147a('0x15')]('/:id/accept',auth[_0x147a('0x8')](),controller['accept']);router[_0x147a('0x15')](_0x147a('0x17'),auth[_0x147a('0x8')](),controller['reject']);router[_0x147a('0x18')](_0x147a('0xc'),auth[_0x147a('0x8')](),controller['destroy']);module[_0x147a('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 59b735e..c17c39d 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 _0x5c85=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x254fe4,_0x62a6cf){var _0x1bb85c=function(_0x75afa6){while(--_0x75afa6){_0x254fe4['push'](_0x254fe4['shift']());}};_0x1bb85c(++_0x62a6cf);}(_0x5c85,0xc1));var _0x55c8=function(_0x179b79,_0x3380cc){_0x179b79=_0x179b79-0x0;var _0x1851f5=_0x5c85[_0x179b79];return _0x1851f5;};'use strict';var Sequelize=require(_0x55c8('0x0'));module[_0x55c8('0x1')]={'body':{'type':Sequelize[_0x55c8('0x2')](_0x55c8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x55c8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x55c8('0x5')]('in',_0x55c8('0x6')),'defaultValue':_0x55c8('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x55c8('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x55c8('0x2')]}}; \ No newline at end of file +var _0x9fce=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x9fce,0x99));var _0xe9fc=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x9fce[_0x3c51d4];return _0x53c45f;};'use strict';var Sequelize=require(_0xe9fc('0x0'));module[_0xe9fc('0x1')]={'body':{'type':Sequelize[_0xe9fc('0x2')](_0xe9fc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe9fc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe9fc('0x5')]('in',_0xe9fc('0x6')),'defaultValue':_0xe9fc('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe9fc('0x7')](0xbe)},'phone':{'type':Sequelize[_0xe9fc('0x7')]},'readAt':{'type':Sequelize[_0xe9fc('0x8')]},'secret':{'type':Sequelize[_0xe9fc('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe9fc('0x7')]},'providerResponse':{'type':Sequelize[_0xe9fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1552d14..6ca22c9 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 _0x9df6=['sort','where','filters','pick','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','update','describe','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','get','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','inspect','groupName','DELIVERED','infobip','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','index','map','SmsMessage','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x51557b,_0x521c80){var _0x83171=function(_0x17bd85){while(--_0x17bd85){_0x51557b['push'](_0x51557b['shift']());}};_0x83171(++_0x521c80);}(_0x9df6,0xe2));var _0x69df=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x9df6[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69df('0x0'));var zipdir=require(_0x69df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x69df('0x2'));var moment=require(_0x69df('0x3'));var BPromise=require(_0x69df('0x4'));var Mustache=require(_0x69df('0x5'));var util=require('util');var path=require(_0x69df('0x6'));var sox=require(_0x69df('0x7'));var csv=require(_0x69df('0x8'));var ejs=require(_0x69df('0x9'));var fs=require('fs');var fs_extra=require(_0x69df('0xa'));var _=require('lodash');var squel=require(_0x69df('0xb'));var crypto=require(_0x69df('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x69df('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x69df('0xe'));var hardwareService=require(_0x69df('0xf'));var logger=require(_0x69df('0x10'))(_0x69df('0x11'));var utils=require(_0x69df('0x12'));var config=require(_0x69df('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x69df('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x69df('0x15'))(new Redis(config[_0x69df('0x16')]));require('./smsMessage.socket')[_0x69df('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x69df('0x18')][_0x69df('0x19')]({'port':0x232c});var client9002=jayson['client'][_0x69df('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3fa4c5,_0x547ba2,_0x4f6cc3,_0x4aaa26){return new BPromise(function(_0x4b43f6,_0x4b303f){var _0x77663c=_0x4aaa26||client;return _0x77663c[_0x69df('0x1a')](_0x3fa4c5,_0x4f6cc3)['then'](function(_0x19a6fb){logger[_0x69df('0x1b')](_0x69df('0x1c'),_0x547ba2,_0x69df('0x1d'));logger[_0x69df('0x1e')](_0x69df('0x1f'),_0x547ba2,_0x69df('0x1d'),JSON['stringify'](_0x19a6fb));if(_0x19a6fb[_0x69df('0x20')]){if(_0x19a6fb['error'][_0x69df('0x21')]===0x1f4){logger['error'](_0x69df('0x1c'),_0x547ba2,_0x19a6fb[_0x69df('0x20')][_0x69df('0x22')]);return _0x4b303f(_0x19a6fb[_0x69df('0x20')][_0x69df('0x22')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x547ba2,_0x19a6fb[_0x69df('0x20')][_0x69df('0x22')]);return _0x4b43f6(_0x19a6fb[_0x69df('0x20')][_0x69df('0x22')]);}else{logger[_0x69df('0x1b')](_0x69df('0x1c'),_0x547ba2,_0x69df('0x1d'));_0x4b43f6(_0x19a6fb[_0x69df('0x23')]['message']);}})['catch'](function(_0xa8ad8a){logger[_0x69df('0x20')](_0x69df('0x1c'),_0x547ba2,_0xa8ad8a);_0x4b303f(_0xa8ad8a);});});}function respondWithStatusCode(_0x2761d5,_0x1d9e59){_0x1d9e59=_0x1d9e59||0xcc;return function(_0x5aef46){if(_0x5aef46){return _0x2761d5['sendStatus'](_0x1d9e59);}return _0x2761d5['status'](_0x1d9e59)[_0x69df('0x24')]();};}function respondWithResult(_0x5d57e1,_0x5a1c25){_0x5a1c25=_0x5a1c25||0xc8;return function(_0xee37b3){if(_0xee37b3){return _0x5d57e1[_0x69df('0x25')](_0x5a1c25)[_0x69df('0x26')](_0xee37b3);}};}function respondWithFilteredResult(_0x158543,_0x2b6454){return function(_0x29dcda){if(_0x29dcda){var _0x5d77af=typeof _0x2b6454[_0x69df('0x27')]===_0x69df('0x28')&&typeof _0x2b6454[_0x69df('0x29')]===_0x69df('0x28');var _0x1eccc5=_0x29dcda[_0x69df('0x2a')];var _0x455f88=_0x5d77af?0x0:_0x2b6454[_0x69df('0x27')];var _0x61dbe6=_0x5d77af?_0x29dcda[_0x69df('0x2a')]:_0x2b6454['offset']+_0x2b6454[_0x69df('0x29')];var _0x32c845;if(_0x61dbe6>=_0x1eccc5){_0x61dbe6=_0x1eccc5;_0x32c845=0xc8;}else{_0x32c845=0xce;}_0x158543[_0x69df('0x25')](_0x32c845);return _0x158543[_0x69df('0x2b')](_0x69df('0x2c'),_0x455f88+'-'+_0x61dbe6+'/'+_0x1eccc5)[_0x69df('0x26')](_0x29dcda);}return null;};}function patchUpdates(_0x221812){return function(_0x2ccf7e){try{jsonpatch[_0x69df('0x2d')](_0x2ccf7e,_0x221812,!![]);}catch(_0x128443){return BPromise[_0x69df('0x2e')](_0x128443);}return _0x2ccf7e[_0x69df('0x2f')]();};}function saveUpdates(_0x8ebb8,_0x4a666f){return function(_0x52792e){if(_0x52792e){return _0x52792e['update'](_0x8ebb8)['then'](function(_0xb8bea2){return _0xb8bea2;});}return null;};}function removeEntity(_0x4a0200,_0x1dd11f){return function(_0x2936c0){if(_0x2936c0){return _0x2936c0[_0x69df('0x30')]()[_0x69df('0x31')](function(){_0x4a0200['status'](0xcc)[_0x69df('0x24')]();});}};}function handleEntityNotFound(_0x2a2e7f,_0x5c4164){return function(_0x52f6e2){if(!_0x52f6e2){_0x2a2e7f[_0x69df('0x32')](0x194);}return _0x52f6e2;};}function handleError(_0x477e56,_0x1e08f9){_0x1e08f9=_0x1e08f9||0x1f4;return function(_0x416dd4){logger['error'](_0x416dd4[_0x69df('0x33')]);if(_0x416dd4[_0x69df('0x34')]){delete _0x416dd4['name'];}_0x477e56[_0x69df('0x25')](_0x1e08f9)['send'](_0x416dd4);};}exports[_0x69df('0x35')]=function(_0x2f5a2a,_0x44cbe9){var _0x184de0={},_0x49ecc8={},_0x46972a={'count':0x0,'rows':[]};var _0x24c5a2=_[_0x69df('0x36')](db[_0x69df('0x37')]['rawAttributes'],function(_0x1f9932){return{'name':_0x1f9932[_0x69df('0x38')],'type':_0x1f9932['type'][_0x69df('0x39')]};});_0x49ecc8[_0x69df('0x3a')]=_[_0x69df('0x36')](_0x24c5a2,'name');_0x49ecc8[_0x69df('0x3b')]=_[_0x69df('0x3c')](_0x2f5a2a[_0x69df('0x3b')]);_0x49ecc8['filters']=_[_0x69df('0x3d')](_0x49ecc8[_0x69df('0x3a')],_0x49ecc8[_0x69df('0x3b')]);_0x184de0['attributes']=_['intersection'](_0x49ecc8[_0x69df('0x3a')],qs[_0x69df('0x3e')](_0x2f5a2a[_0x69df('0x3b')][_0x69df('0x3e')]));_0x184de0['attributes']=_0x184de0[_0x69df('0x3f')]['length']?_0x184de0[_0x69df('0x3f')]:_0x49ecc8[_0x69df('0x3a')];if(!_0x2f5a2a[_0x69df('0x3b')][_0x69df('0x40')](_0x69df('0x41'))){_0x184de0['limit']=qs['limit'](_0x2f5a2a[_0x69df('0x3b')]['limit']);_0x184de0[_0x69df('0x27')]=qs['offset'](_0x2f5a2a[_0x69df('0x3b')][_0x69df('0x27')]);}_0x184de0['order']=qs[_0x69df('0x42')](_0x2f5a2a[_0x69df('0x3b')][_0x69df('0x42')]);_0x184de0[_0x69df('0x43')]=qs[_0x69df('0x44')](_[_0x69df('0x45')](_0x2f5a2a['query'],_0x49ecc8[_0x69df('0x44')]),_0x24c5a2);if(_0x2f5a2a[_0x69df('0x3b')]['filter']){_0x184de0[_0x69df('0x43')]=_[_0x69df('0x46')](_0x184de0[_0x69df('0x43')],{'$or':_[_0x69df('0x36')](_0x24c5a2,function(_0x44165f){if(_0x44165f[_0x69df('0x47')]!==_0x69df('0x48')){var _0x553394={};_0x553394[_0x44165f[_0x69df('0x34')]]={'$like':'%'+_0x2f5a2a[_0x69df('0x3b')]['filter']+'%'};return _0x553394;}})});}_0x184de0=_['merge']({},_0x184de0,_0x2f5a2a[_0x69df('0x49')]);var _0x1db044={'where':_0x184de0[_0x69df('0x43')]};return db['SmsMessage'][_0x69df('0x2a')](_0x1db044)[_0x69df('0x31')](function(_0x1331ec){_0x46972a[_0x69df('0x2a')]=_0x1331ec;if(_0x2f5a2a[_0x69df('0x3b')]['includeAll']){_0x184de0[_0x69df('0x4a')]=[{'all':!![]}];}return db[_0x69df('0x37')][_0x69df('0x4b')](_0x184de0);})['then'](function(_0x25cb6f){_0x46972a[_0x69df('0x4c')]=_0x25cb6f;return _0x46972a;})[_0x69df('0x31')](respondWithFilteredResult(_0x44cbe9,_0x184de0))[_0x69df('0x4d')](handleError(_0x44cbe9,null));};exports[_0x69df('0x4e')]=function(_0x33d978,_0x33942a){var _0x4cb457={'raw':!![],'where':{'id':_0x33d978[_0x69df('0x4f')]['id']}},_0xf92ff7={};_0xf92ff7[_0x69df('0x3a')]=_[_0x69df('0x3c')](db[_0x69df('0x37')][_0x69df('0x50')]);_0xf92ff7['query']=_[_0x69df('0x3c')](_0x33d978['query']);_0xf92ff7['filters']=_[_0x69df('0x3d')](_0xf92ff7[_0x69df('0x3a')],_0xf92ff7[_0x69df('0x3b')]);_0x4cb457[_0x69df('0x3f')]=_[_0x69df('0x3d')](_0xf92ff7['model'],qs[_0x69df('0x3e')](_0x33d978[_0x69df('0x3b')][_0x69df('0x3e')]));_0x4cb457[_0x69df('0x3f')]=_0x4cb457[_0x69df('0x3f')][_0x69df('0x51')]?_0x4cb457[_0x69df('0x3f')]:_0xf92ff7['model'];if(_0x33d978[_0x69df('0x3b')][_0x69df('0x52')]){_0x4cb457['include']=[{'all':!![]}];}_0x4cb457=_[_0x69df('0x46')]({},_0x4cb457,_0x33d978[_0x69df('0x49')]);return db['SmsMessage'][_0x69df('0x53')](_0x4cb457)[_0x69df('0x31')](handleEntityNotFound(_0x33942a,null))[_0x69df('0x31')](respondWithResult(_0x33942a,null))['catch'](handleError(_0x33942a,null));};exports[_0x69df('0x54')]=function(_0x82b89d,_0x27f7c2){return db[_0x69df('0x37')][_0x69df('0x54')](_0x82b89d[_0x69df('0x55')],{})[_0x69df('0x31')](respondWithResult(_0x27f7c2,0xc9))['catch'](handleError(_0x27f7c2,null));};exports[_0x69df('0x56')]=function(_0x4217a6,_0x76cbdd){if(_0x4217a6[_0x69df('0x55')]['id']){delete _0x4217a6[_0x69df('0x55')]['id'];}return db[_0x69df('0x37')][_0x69df('0x53')]({'where':{'id':_0x4217a6[_0x69df('0x4f')]['id']}})[_0x69df('0x31')](handleEntityNotFound(_0x76cbdd,null))[_0x69df('0x31')](saveUpdates(_0x4217a6[_0x69df('0x55')],null))[_0x69df('0x31')](respondWithResult(_0x76cbdd,null))[_0x69df('0x4d')](handleError(_0x76cbdd,null));};exports[_0x69df('0x30')]=function(_0x5a8a07,_0x4cec1f){return db[_0x69df('0x37')]['find']({'where':{'id':_0x5a8a07[_0x69df('0x4f')]['id']}})[_0x69df('0x31')](handleEntityNotFound(_0x4cec1f,null))['then'](removeEntity(_0x4cec1f,null))[_0x69df('0x4d')](handleError(_0x4cec1f,null));};exports[_0x69df('0x57')]=function(_0x5f4f3c,_0x55e614){return db['SmsMessage']['describe']()['then'](respondWithResult(_0x55e614,null))[_0x69df('0x4d')](handleError(_0x55e614,null));};var interaction_log=require(_0x69df('0x10'))(_0x69df('0x58'));exports[_0x69df('0x59')]=function(_0x195c1e,_0x28fe38,_0x25c620){var _0x20f93b={'agent':{},'channel':_0x69df('0x5a')};if(_0x195c1e[_0x69df('0x55')]['id']){delete _0x195c1e[_0x69df('0x55')]['id'];}_0x195c1e[_0x69df('0x55')]['read']=!![];_0x195c1e['body'][_0x69df('0x5b')]=moment()['format'](_0x69df('0x5c'));_0x195c1e[_0x69df('0x55')][_0x69df('0x5d')]=_0x195c1e[_0x69df('0x55')][_0x69df('0x5d')]||_0x195c1e[_0x69df('0x5e')]['id'];_0x20f93b[_0x69df('0x5f')]['id']=_0x195c1e['body'][_0x69df('0x5d')];return db[_0x69df('0x37')][_0x69df('0x53')]({'where':{'id':_0x195c1e[_0x69df('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28fe38,null))[_0x69df('0x31')](saveUpdates(_0x195c1e[_0x69df('0x55')],null))[_0x69df('0x31')](function(_0x440548){if(_0x440548){_0x20f93b[_0x69df('0x22')]=_0x440548['get']({'plain':!![]});return db[_0x69df('0x60')][_0x69df('0x53')]({'where':{'id':_0x440548[_0x69df('0x61')]}});}return null;})[_0x69df('0x31')](handleEntityNotFound(_0x28fe38,null))['then'](function(_0x1ec320){if(_0x1ec320){return _0x1ec320['update']({'UserId':_0x195c1e[_0x69df('0x55')][_0x69df('0x5d')],'read1stAt':_[_0x69df('0x62')](_0x1ec320[_0x69df('0x63')])?moment()[_0x69df('0x64')](_0x69df('0x5c')):undefined});}return null;})[_0x69df('0x31')](function(_0x5abfcf){if(_0x5abfcf){_0x20f93b[_0x69df('0x65')]=_0x5abfcf['get']({'plain':!![]});interaction_log[_0x69df('0x1b')](_0x69df('0x66'),_0x195c1e[_0x69df('0x5e')]['id'],_0x195c1e[_0x69df('0x5e')][_0x69df('0x34')],_0x195c1e['user'][_0x69df('0x67')],_0x20f93b[_0x69df('0x65')]['id'],_0x195c1e[_0x69df('0x55')]?JSON[_0x69df('0x68')](_0x195c1e['body']):_0x69df('0x69'));return respondWithRpcPromise(_0x69df('0x6a'),'acceptMessage',_0x20f93b);}return null;})[_0x69df('0x31')](function(_0x9e08f9){var _0x221a52='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x9e08f9['message'][_0x69df('0x6b')];return db[_0x69df('0x6c')][_0x69df('0x3b')](_0x221a52,{'type':db[_0x69df('0x6d')][_0x69df('0x6e')][_0x69df('0x6f')],'raw':!![]})[_0x69df('0x31')](function(_0x381777){return _0x381777;});})[_0x69df('0x31')](function(_0x2cd700){if(_0x2cd700){_0x20f93b[_0x69df('0x22')][_0x69df('0x70')]=_0x2cd700[0x0];if(!_0x195c1e[_0x69df('0x55')]['UserId'])return;return db[_0x69df('0x71')][_0x69df('0x53')]({'where':{'id':_0x195c1e[_0x69df('0x55')]['UserId'],'role':_0x69df('0x5f')},'attributes':['id',_0x69df('0x34'),_0x69df('0x72'),_0x69df('0x73'),_0x69df('0x74')],'raw':!![]});}return null;})['then'](function(_0x40aac0){if(!_0x40aac0)return null;_0x20f93b[_0x69df('0x22')]['agent']=_0x40aac0;return _0x20f93b;})[_0x69df('0x31')](function(_0x477b24){if(_0x477b24){if(_0x195c1e[_0x69df('0x55')][_0x69df('0x75')]){_0x20f93b[_0x69df('0x22')][_0x69df('0x76')]=util['format'](_0x69df('0x77'),_0x195c1e[_0x69df('0x5e')]['name']);_0x20f93b[_0x69df('0x22')][_0x69df('0x78')]=_0x20f93b['channel'];_0x20f93b[_0x69df('0x22')][_0x69df('0x79')]=_0x20f93b[_0x69df('0x78')];_0x20f93b[_0x69df('0x22')][_0x69df('0x7a')]='accept';return respondWithRpcPromise(_0x69df('0x7b'),_0x69df('0x7b'),{'event':'acceptmessage','message':_0x20f93b[_0x69df('0x22')]},client9002)[_0x69df('0x31')](function(){return _0x20f93b;});}return _0x20f93b;}return null;})[_0x69df('0x31')](respondWithResult(_0x28fe38,null))['catch'](handleError(_0x28fe38,null));};var interaction_log=require(_0x69df('0x10'))(_0x69df('0x58'));exports[_0x69df('0x2e')]=function(_0x46e747,_0x30d52f,_0x381266){var _0x58aa35={'agent':{},'channel':'sms'};if(_0x46e747[_0x69df('0x55')]['id']){delete _0x46e747['body']['id'];}_0x46e747[_0x69df('0x55')]['UserId']=_0x46e747['body'][_0x69df('0x5d')]||_0x46e747[_0x69df('0x5e')]['id'];_0x58aa35[_0x69df('0x5f')]['id']=_0x46e747['body'][_0x69df('0x5d')];return db['SmsMessage']['find']({'where':{'id':_0x46e747['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30d52f,null))[_0x69df('0x31')](function(_0x57ce02){if(_0x57ce02){_0x58aa35[_0x69df('0x22')]=_0x57ce02[_0x69df('0x7c')]({'plain':!![]});return db[_0x69df('0x60')][_0x69df('0x53')]({'where':{'id':_0x57ce02[_0x69df('0x61')]}});}return null;})[_0x69df('0x31')](handleEntityNotFound(_0x30d52f,null))[_0x69df('0x31')](function(_0x1d28b4){if(_0x1d28b4){_0x58aa35['interaction']=_0x1d28b4[_0x69df('0x7c')]({'plain':!![]});interaction_log[_0x69df('0x1b')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46e747['user']['id'],_0x46e747['user'][_0x69df('0x34')],_0x46e747[_0x69df('0x5e')][_0x69df('0x67')],_0x58aa35[_0x69df('0x65')]['id'],_0x46e747[_0x69df('0x55')]?JSON[_0x69df('0x68')](_0x46e747[_0x69df('0x55')]):_0x69df('0x69'));return respondWithRpcPromise(_0x69df('0x7d'),'rejectMessage',_0x58aa35);}return null;})[_0x69df('0x31')](function(_0x17d95e){var _0x256364=_0x69df('0x7e')+_0x17d95e[_0x69df('0x22')][_0x69df('0x6b')];return db[_0x69df('0x6c')]['query'](_0x256364,{'type':db['Sequelize'][_0x69df('0x6e')][_0x69df('0x6f')],'raw':!![]})[_0x69df('0x31')](function(_0x4adf38){return _0x4adf38;});})['then'](function(_0x273fe6){if(_0x273fe6){_0x58aa35[_0x69df('0x22')][_0x69df('0x70')]=_0x273fe6[0x0];if(!_0x46e747[_0x69df('0x55')][_0x69df('0x5d')])return;return db[_0x69df('0x71')][_0x69df('0x53')]({'where':{'id':_0x46e747['body'][_0x69df('0x5d')],'role':_0x69df('0x5f')},'attributes':['id',_0x69df('0x34'),_0x69df('0x72'),_0x69df('0x73'),_0x69df('0x74')],'raw':!![]});}return null;})[_0x69df('0x31')](function(_0x303520){if(!_0x303520)return null;_0x58aa35[_0x69df('0x22')][_0x69df('0x5f')]=_0x303520;return _0x58aa35;})[_0x69df('0x31')](function(_0x4a6c2c){if(_0x4a6c2c){_0x4a6c2c['message']['interface']=util[_0x69df('0x64')](_0x69df('0x77'),_0x46e747[_0x69df('0x5e')][_0x69df('0x34')]);_0x4a6c2c[_0x69df('0x22')][_0x69df('0x78')]=_0x58aa35['channel'];_0x4a6c2c['message'][_0x69df('0x79')]=_0x58aa35[_0x69df('0x78')];_0x4a6c2c[_0x69df('0x22')][_0x69df('0x7a')]=_0x69df('0x2e');respondWithRpcPromise(_0x69df('0x7b'),_0x69df('0x7b'),{'event':_0x69df('0x7f'),'message':_0x4a6c2c[_0x69df('0x22')]},client9002);return _0x58aa35;}return null;})[_0x69df('0x31')](respondWithResult(_0x30d52f,null))['catch'](handleError(_0x30d52f,null));};exports[_0x69df('0x25')]=function(_0xc78b7e,_0x35b0cc,_0xf57cbd){if(_0xc78b7e[_0x69df('0x55')]['id']){delete _0xc78b7e[_0x69df('0x55')]['id'];}var _0x1a1960;return db[_0x69df('0x37')][_0x69df('0x53')]({'where':{'id':_0xc78b7e[_0x69df('0x4f')]['id']}})[_0x69df('0x31')](handleEntityNotFound(_0x35b0cc,null))[_0x69df('0x31')](function(_0x451ffd){if(_0x451ffd){_0x1a1960=_0x451ffd;return db[_0x69df('0x80')][_0x69df('0x53')]({'where':{'id':_0x451ffd[_0x69df('0x81')]}});}})[_0x69df('0x31')](handleEntityNotFound(_0x35b0cc,null))['then'](function(_0x556a09){if(_0x556a09){logger['debug'](_0x69df('0x1f'),_0x69df('0x25'),_0x69df('0x82'),_0x556a09['type'],util['inspect'](_0xc78b7e[_0x69df('0x55')],{'showHidden':![],'depth':null}));switch(_0x556a09[_0x69df('0x47')]){case _0x69df('0x83'):if(_0xc78b7e['body'][_0x69df('0x84')]&&_0xc78b7e[_0x69df('0x55')][_0x69df('0x84')]===_0x1a1960['messageId']){return _0x1a1960[_0x69df('0x56')]({'read':!![]});}else{logger[_0x69df('0x20')](_0x69df('0x85'),_0x69df('0x25'),_0x69df('0x83'),util['inspect'](_0xc78b7e[_0x69df('0x55')],{'showHidden':![],'depth':null}));}break;case _0x69df('0x86'):if(_0xc78b7e[_0x69df('0x55')]['MessageUUID']&&_0xc78b7e['body'][_0x69df('0x87')]===_0x1a1960[_0x69df('0x88')]&&_[_0x69df('0x89')]([_0x69df('0x8a'),_0x69df('0x8b')],_0xc78b7e[_0x69df('0x55')][_0x69df('0x8c')])>=0x0){return _0x1a1960[_0x69df('0x56')]({'read':!![]});}else{logger[_0x69df('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x69df('0x25'),_0x69df('0x8d'),util[_0x69df('0x8e')](_0xc78b7e[_0x69df('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4c639d=_0xc78b7e['body']['results'][0x0];if(_0x4c639d[_0x69df('0x25')][_0x69df('0x8f')]===_0x69df('0x90')){return _0x1a1960['update']({'read':!![]});}else{logger[_0x69df('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x69df('0x25'),_0x69df('0x91'),util['inspect'](_0xc78b7e[_0x69df('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x1a1960;}})[_0x69df('0x31')](respondWithResult(_0x35b0cc,null))['catch'](handleError(_0x35b0cc,null));}; \ No newline at end of file +var _0xf954=['socket.io-emitter','./smsMessage.socket','register','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','create','body','find','params','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','sms-interactions','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x5b6382,_0x4b2ad1){var _0x4995d8=function(_0x3d7e1e){while(--_0x3d7e1e){_0x5b6382['push'](_0x5b6382['shift']());}};_0x4995d8(++_0x4b2ad1);}(_0xf954,0x10e));var _0x4f95=function(_0x45cf7c,_0x5090d5){_0x45cf7c=_0x45cf7c-0x0;var _0x1444b3=_0xf954[_0x45cf7c];return _0x1444b3;};'use strict';var emlformat=require(_0x4f95('0x0'));var rimraf=require(_0x4f95('0x1'));var zipdir=require(_0x4f95('0x2'));var jsonpatch=require(_0x4f95('0x3'));var rp=require(_0x4f95('0x4'));var moment=require(_0x4f95('0x5'));var BPromise=require(_0x4f95('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4f95('0x7'));var sox=require(_0x4f95('0x8'));var csv=require(_0x4f95('0x9'));var ejs=require(_0x4f95('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f95('0xb'));var squel=require(_0x4f95('0xc'));var crypto=require(_0x4f95('0xd'));var jsforce=require(_0x4f95('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4f95('0xf'));var Papa=require(_0x4f95('0x10'));var Redis=require(_0x4f95('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f95('0x12'));var logger=require(_0x4f95('0x13'))(_0x4f95('0x14'));var utils=require(_0x4f95('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4f95('0x16'));var db=require(_0x4f95('0x17'))['db'];config[_0x4f95('0x18')]=_[_0x4f95('0x19')](config[_0x4f95('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f95('0x1a'))(new Redis(config[_0x4f95('0x18')]));require(_0x4f95('0x1b'))[_0x4f95('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4f95('0x1d')][_0x4f95('0x1e')]({'port':0x232c});var client9002=jayson[_0x4f95('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd3673,_0x451dc2,_0x1d9bd1,_0x12d95e){return new BPromise(function(_0x3ea415,_0x197ad5){var _0x2aa444=_0x12d95e||client;return _0x2aa444[_0x4f95('0x1f')](_0xfd3673,_0x1d9bd1)[_0x4f95('0x20')](function(_0x3a3508){logger['info'](_0x4f95('0x21'),_0x451dc2,_0x4f95('0x22'));logger[_0x4f95('0x23')](_0x4f95('0x24'),_0x451dc2,_0x4f95('0x22'),JSON[_0x4f95('0x25')](_0x3a3508));if(_0x3a3508[_0x4f95('0x26')]){if(_0x3a3508[_0x4f95('0x26')][_0x4f95('0x27')]===0x1f4){logger['error'](_0x4f95('0x21'),_0x451dc2,_0x3a3508[_0x4f95('0x26')][_0x4f95('0x28')]);return _0x197ad5(_0x3a3508[_0x4f95('0x26')][_0x4f95('0x28')]);}logger[_0x4f95('0x26')](_0x4f95('0x21'),_0x451dc2,_0x3a3508[_0x4f95('0x26')][_0x4f95('0x28')]);return _0x3ea415(_0x3a3508[_0x4f95('0x26')][_0x4f95('0x28')]);}else{logger[_0x4f95('0x29')](_0x4f95('0x21'),_0x451dc2,'request\x20sent');_0x3ea415(_0x3a3508[_0x4f95('0x2a')][_0x4f95('0x28')]);}})[_0x4f95('0x2b')](function(_0x34a4de){logger[_0x4f95('0x26')](_0x4f95('0x21'),_0x451dc2,_0x34a4de);_0x197ad5(_0x34a4de);});});}function respondWithStatusCode(_0x303f65,_0x49677d){_0x49677d=_0x49677d||0xcc;return function(_0x2154c4){if(_0x2154c4){return _0x303f65['sendStatus'](_0x49677d);}return _0x303f65[_0x4f95('0x2c')](_0x49677d)[_0x4f95('0x2d')]();};}function respondWithResult(_0x224a0a,_0x1079fd){_0x1079fd=_0x1079fd||0xc8;return function(_0x449aa1){if(_0x449aa1){return _0x224a0a['status'](_0x1079fd)[_0x4f95('0x2e')](_0x449aa1);}};}function respondWithFilteredResult(_0x2dc278,_0x1cdd1b){return function(_0x6ff6c4){if(_0x6ff6c4){var _0x1ae268=typeof _0x1cdd1b[_0x4f95('0x2f')]===_0x4f95('0x30')&&typeof _0x1cdd1b[_0x4f95('0x31')]==='undefined';var _0x5d9c7a=_0x6ff6c4['count'];var _0x4cb67d=_0x1ae268?0x0:_0x1cdd1b['offset'];var _0x40d115=_0x1ae268?_0x6ff6c4[_0x4f95('0x32')]:_0x1cdd1b[_0x4f95('0x2f')]+_0x1cdd1b[_0x4f95('0x31')];var _0x3d6ca4;if(_0x40d115>=_0x5d9c7a){_0x40d115=_0x5d9c7a;_0x3d6ca4=0xc8;}else{_0x3d6ca4=0xce;}_0x2dc278[_0x4f95('0x2c')](_0x3d6ca4);return _0x2dc278[_0x4f95('0x33')](_0x4f95('0x34'),_0x4cb67d+'-'+_0x40d115+'/'+_0x5d9c7a)['json'](_0x6ff6c4);}return null;};}function patchUpdates(_0x30dd91){return function(_0x234dc5){try{jsonpatch[_0x4f95('0x35')](_0x234dc5,_0x30dd91,!![]);}catch(_0x4fbb4c){return BPromise[_0x4f95('0x36')](_0x4fbb4c);}return _0x234dc5[_0x4f95('0x37')]();};}function saveUpdates(_0x4c055a,_0x2b04e7){return function(_0x592129){if(_0x592129){return _0x592129[_0x4f95('0x38')](_0x4c055a)[_0x4f95('0x20')](function(_0x2038e0){return _0x2038e0;});}return null;};}function removeEntity(_0xede25,_0x3c8be4){return function(_0xd27454){if(_0xd27454){return _0xd27454[_0x4f95('0x39')]()[_0x4f95('0x20')](function(){_0xede25[_0x4f95('0x2c')](0xcc)[_0x4f95('0x2d')]();});}};}function handleEntityNotFound(_0x34afc9,_0x5511e7){return function(_0x60973f){if(!_0x60973f){_0x34afc9['sendStatus'](0x194);}return _0x60973f;};}function handleError(_0x5df581,_0x199de5){_0x199de5=_0x199de5||0x1f4;return function(_0x1dff41){logger[_0x4f95('0x26')](_0x1dff41[_0x4f95('0x3a')]);if(_0x1dff41[_0x4f95('0x3b')]){delete _0x1dff41['name'];}_0x5df581['status'](_0x199de5)[_0x4f95('0x3c')](_0x1dff41);};}exports[_0x4f95('0x3d')]=function(_0x3768ee,_0x2cc8df){var _0x2435b1={},_0x22f2a6={},_0x51f5e4={'count':0x0,'rows':[]};var _0xcc4bf2=_[_0x4f95('0x3e')](db[_0x4f95('0x3f')][_0x4f95('0x40')],function(_0x203b19){return{'name':_0x203b19[_0x4f95('0x41')],'type':_0x203b19[_0x4f95('0x42')]['key']};});_0x22f2a6['model']=_['map'](_0xcc4bf2,'name');_0x22f2a6[_0x4f95('0x43')]=_[_0x4f95('0x44')](_0x3768ee['query']);_0x22f2a6['filters']=_['intersection'](_0x22f2a6[_0x4f95('0x45')],_0x22f2a6[_0x4f95('0x43')]);_0x2435b1[_0x4f95('0x46')]=_[_0x4f95('0x47')](_0x22f2a6[_0x4f95('0x45')],qs['fields'](_0x3768ee[_0x4f95('0x43')][_0x4f95('0x48')]));_0x2435b1[_0x4f95('0x46')]=_0x2435b1[_0x4f95('0x46')][_0x4f95('0x49')]?_0x2435b1[_0x4f95('0x46')]:_0x22f2a6[_0x4f95('0x45')];if(!_0x3768ee[_0x4f95('0x43')][_0x4f95('0x4a')]('nolimit')){_0x2435b1[_0x4f95('0x31')]=qs[_0x4f95('0x31')](_0x3768ee[_0x4f95('0x43')][_0x4f95('0x31')]);_0x2435b1[_0x4f95('0x2f')]=qs['offset'](_0x3768ee['query']['offset']);}_0x2435b1[_0x4f95('0x4b')]=qs[_0x4f95('0x4c')](_0x3768ee[_0x4f95('0x43')]['sort']);_0x2435b1['where']=qs[_0x4f95('0x4d')](_[_0x4f95('0x4e')](_0x3768ee[_0x4f95('0x43')],_0x22f2a6['filters']),_0xcc4bf2);if(_0x3768ee[_0x4f95('0x43')][_0x4f95('0x4f')]){_0x2435b1['where']=_['merge'](_0x2435b1[_0x4f95('0x50')],{'$or':_[_0x4f95('0x3e')](_0xcc4bf2,function(_0x17bb9a){if(_0x17bb9a[_0x4f95('0x42')]!==_0x4f95('0x51')){var _0x43715a={};_0x43715a[_0x17bb9a[_0x4f95('0x3b')]]={'$like':'%'+_0x3768ee[_0x4f95('0x43')][_0x4f95('0x4f')]+'%'};return _0x43715a;}})});}_0x2435b1=_[_0x4f95('0x52')]({},_0x2435b1,_0x3768ee[_0x4f95('0x53')]);var _0x59689a={'where':_0x2435b1[_0x4f95('0x50')]};return db[_0x4f95('0x3f')][_0x4f95('0x32')](_0x59689a)[_0x4f95('0x20')](function(_0x570c81){_0x51f5e4[_0x4f95('0x32')]=_0x570c81;if(_0x3768ee[_0x4f95('0x43')][_0x4f95('0x54')]){_0x2435b1[_0x4f95('0x55')]=[{'all':!![]}];}return db[_0x4f95('0x3f')][_0x4f95('0x56')](_0x2435b1);})['then'](function(_0x14ed18){_0x51f5e4[_0x4f95('0x57')]=_0x14ed18;return _0x51f5e4;})[_0x4f95('0x20')](respondWithFilteredResult(_0x2cc8df,_0x2435b1))[_0x4f95('0x2b')](handleError(_0x2cc8df,null));};exports[_0x4f95('0x58')]=function(_0x3c57ab,_0x3ea1bf){var _0x59a820={'raw':!![],'where':{'id':_0x3c57ab['params']['id']}},_0x107c7a={};_0x107c7a[_0x4f95('0x45')]=_[_0x4f95('0x44')](db[_0x4f95('0x3f')]['rawAttributes']);_0x107c7a['query']=_[_0x4f95('0x44')](_0x3c57ab['query']);_0x107c7a[_0x4f95('0x4d')]=_[_0x4f95('0x47')](_0x107c7a[_0x4f95('0x45')],_0x107c7a[_0x4f95('0x43')]);_0x59a820[_0x4f95('0x46')]=_['intersection'](_0x107c7a[_0x4f95('0x45')],qs['fields'](_0x3c57ab[_0x4f95('0x43')][_0x4f95('0x48')]));_0x59a820[_0x4f95('0x46')]=_0x59a820[_0x4f95('0x46')][_0x4f95('0x49')]?_0x59a820[_0x4f95('0x46')]:_0x107c7a[_0x4f95('0x45')];if(_0x3c57ab[_0x4f95('0x43')][_0x4f95('0x54')]){_0x59a820[_0x4f95('0x55')]=[{'all':!![]}];}_0x59a820=_[_0x4f95('0x52')]({},_0x59a820,_0x3c57ab[_0x4f95('0x53')]);return db[_0x4f95('0x3f')]['find'](_0x59a820)[_0x4f95('0x20')](handleEntityNotFound(_0x3ea1bf,null))[_0x4f95('0x20')](respondWithResult(_0x3ea1bf,null))[_0x4f95('0x2b')](handleError(_0x3ea1bf,null));};exports[_0x4f95('0x59')]=function(_0x454c5c,_0x107f09){return db[_0x4f95('0x3f')][_0x4f95('0x59')](_0x454c5c[_0x4f95('0x5a')],{})[_0x4f95('0x20')](respondWithResult(_0x107f09,0xc9))[_0x4f95('0x2b')](handleError(_0x107f09,null));};exports[_0x4f95('0x38')]=function(_0x3e425e,_0x55c450){if(_0x3e425e[_0x4f95('0x5a')]['id']){delete _0x3e425e['body']['id'];}return db[_0x4f95('0x3f')][_0x4f95('0x5b')]({'where':{'id':_0x3e425e[_0x4f95('0x5c')]['id']}})[_0x4f95('0x20')](handleEntityNotFound(_0x55c450,null))[_0x4f95('0x20')](saveUpdates(_0x3e425e[_0x4f95('0x5a')],null))[_0x4f95('0x20')](respondWithResult(_0x55c450,null))[_0x4f95('0x2b')](handleError(_0x55c450,null));};exports[_0x4f95('0x39')]=function(_0x39f973,_0x55fff3){return db[_0x4f95('0x3f')][_0x4f95('0x5b')]({'where':{'id':_0x39f973[_0x4f95('0x5c')]['id']}})[_0x4f95('0x20')](handleEntityNotFound(_0x55fff3,null))[_0x4f95('0x20')](removeEntity(_0x55fff3,null))['catch'](handleError(_0x55fff3,null));};exports['describe']=function(_0x4527de,_0x1c1611){return db[_0x4f95('0x3f')]['describe']()[_0x4f95('0x20')](respondWithResult(_0x1c1611,null))[_0x4f95('0x2b')](handleError(_0x1c1611,null));};var interaction_log=require(_0x4f95('0x13'))('sms-interactions');exports['accept']=function(_0x52c8ec,_0x1e1cf9,_0x3767cb){var _0x180178={'agent':{},'channel':_0x4f95('0x5d')};if(_0x52c8ec[_0x4f95('0x5a')]['id']){delete _0x52c8ec[_0x4f95('0x5a')]['id'];}_0x52c8ec[_0x4f95('0x5a')][_0x4f95('0x5e')]=!![];_0x52c8ec[_0x4f95('0x5a')][_0x4f95('0x5f')]=moment()[_0x4f95('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x52c8ec['body'][_0x4f95('0x61')]=_0x52c8ec[_0x4f95('0x5a')]['UserId']||_0x52c8ec[_0x4f95('0x62')]['id'];_0x180178[_0x4f95('0x63')]['id']=_0x52c8ec[_0x4f95('0x5a')][_0x4f95('0x61')];return db[_0x4f95('0x3f')]['find']({'where':{'id':_0x52c8ec[_0x4f95('0x5c')]['id'],'UserId':null}})[_0x4f95('0x20')](handleEntityNotFound(_0x1e1cf9,null))[_0x4f95('0x20')](saveUpdates(_0x52c8ec[_0x4f95('0x5a')],null))['then'](function(_0x53f0df){if(_0x53f0df){_0x180178[_0x4f95('0x28')]=_0x53f0df[_0x4f95('0x64')]({'plain':!![]});return db[_0x4f95('0x65')][_0x4f95('0x5b')]({'where':{'id':_0x53f0df[_0x4f95('0x66')]}});}return null;})[_0x4f95('0x20')](handleEntityNotFound(_0x1e1cf9,null))[_0x4f95('0x20')](function(_0x30caad){if(_0x30caad){return _0x30caad['update']({'UserId':_0x52c8ec[_0x4f95('0x5a')][_0x4f95('0x61')],'read1stAt':_[_0x4f95('0x67')](_0x30caad[_0x4f95('0x68')])?moment()[_0x4f95('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x51541b){if(_0x51541b){_0x180178['interaction']=_0x51541b['get']({'plain':!![]});interaction_log[_0x4f95('0x29')](_0x4f95('0x69'),_0x52c8ec['user']['id'],_0x52c8ec['user'][_0x4f95('0x3b')],_0x52c8ec['user']['role'],_0x180178['interaction']['id'],_0x52c8ec['body']?JSON[_0x4f95('0x25')](_0x52c8ec[_0x4f95('0x5a')]):'null');return respondWithRpcPromise(_0x4f95('0x6a'),'acceptMessage',_0x180178);}return null;})[_0x4f95('0x20')](function(_0x2a97d8){var _0x3e0e1d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2a97d8[_0x4f95('0x28')][_0x4f95('0x6b')];return db[_0x4f95('0x6c')][_0x4f95('0x43')](_0x3e0e1d,{'type':db[_0x4f95('0x6d')][_0x4f95('0x6e')][_0x4f95('0x6f')],'raw':!![]})['then'](function(_0x55a73e){return _0x55a73e;});})['then'](function(_0x36c4e8){if(_0x36c4e8){_0x180178[_0x4f95('0x28')][_0x4f95('0x70')]=_0x36c4e8[0x0];if(!_0x52c8ec[_0x4f95('0x5a')]['UserId'])return;return db[_0x4f95('0x71')][_0x4f95('0x5b')]({'where':{'id':_0x52c8ec[_0x4f95('0x5a')][_0x4f95('0x61')],'role':_0x4f95('0x63')},'attributes':['id',_0x4f95('0x3b'),'fullname','email',_0x4f95('0x72')],'raw':!![]});}return null;})[_0x4f95('0x20')](function(_0xe451af){if(!_0xe451af)return null;_0x180178[_0x4f95('0x28')][_0x4f95('0x63')]=_0xe451af;return _0x180178;})[_0x4f95('0x20')](function(_0x4ef6ee){if(_0x4ef6ee){if(_0x52c8ec[_0x4f95('0x5a')][_0x4f95('0x73')]){_0x180178['message'][_0x4f95('0x74')]=util[_0x4f95('0x60')](_0x4f95('0x75'),_0x52c8ec[_0x4f95('0x62')][_0x4f95('0x3b')]);_0x180178[_0x4f95('0x28')][_0x4f95('0x76')]=_0x180178[_0x4f95('0x76')];_0x180178[_0x4f95('0x28')]['motionChannel']=_0x180178['channel'];_0x180178['message'][_0x4f95('0x77')]=_0x4f95('0x78');return respondWithRpcPromise('EventManager',_0x4f95('0x79'),{'event':_0x4f95('0x7a'),'message':_0x180178[_0x4f95('0x28')]},client9002)[_0x4f95('0x20')](function(){return _0x180178;});}return _0x180178;}return null;})[_0x4f95('0x20')](respondWithResult(_0x1e1cf9,null))[_0x4f95('0x2b')](handleError(_0x1e1cf9,null));};var interaction_log=require(_0x4f95('0x13'))(_0x4f95('0x7b'));exports[_0x4f95('0x36')]=function(_0x203e81,_0x2b2323,_0x2f936a){var _0x1cf4a3={'agent':{},'channel':'sms'};if(_0x203e81[_0x4f95('0x5a')]['id']){delete _0x203e81[_0x4f95('0x5a')]['id'];}_0x203e81['body'][_0x4f95('0x61')]=_0x203e81['body'][_0x4f95('0x61')]||_0x203e81[_0x4f95('0x62')]['id'];_0x1cf4a3[_0x4f95('0x63')]['id']=_0x203e81[_0x4f95('0x5a')]['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x203e81[_0x4f95('0x5c')]['id'],'UserId':null}})[_0x4f95('0x20')](handleEntityNotFound(_0x2b2323,null))[_0x4f95('0x20')](function(_0x41d646){if(_0x41d646){_0x1cf4a3[_0x4f95('0x28')]=_0x41d646[_0x4f95('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x4f95('0x5b')]({'where':{'id':_0x41d646[_0x4f95('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2b2323,null))[_0x4f95('0x20')](function(_0x522d5b){if(_0x522d5b){_0x1cf4a3[_0x4f95('0x7c')]=_0x522d5b[_0x4f95('0x64')]({'plain':!![]});interaction_log[_0x4f95('0x29')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x203e81['user']['id'],_0x203e81['user'][_0x4f95('0x3b')],_0x203e81[_0x4f95('0x62')]['role'],_0x1cf4a3['interaction']['id'],_0x203e81[_0x4f95('0x5a')]?JSON['stringify'](_0x203e81['body']):_0x4f95('0x7d'));return respondWithRpcPromise(_0x4f95('0x7e'),_0x4f95('0x7f'),_0x1cf4a3);}return null;})[_0x4f95('0x20')](function(_0x24050e){var _0x198b25=_0x4f95('0x80')+_0x24050e[_0x4f95('0x28')][_0x4f95('0x6b')];return db[_0x4f95('0x6c')]['query'](_0x198b25,{'type':db['Sequelize']['QueryTypes'][_0x4f95('0x6f')],'raw':!![]})['then'](function(_0xb1e0c){return _0xb1e0c;});})[_0x4f95('0x20')](function(_0x4ef439){if(_0x4ef439){_0x1cf4a3[_0x4f95('0x28')]['contact']=_0x4ef439[0x0];if(!_0x203e81[_0x4f95('0x5a')][_0x4f95('0x61')])return;return db[_0x4f95('0x71')][_0x4f95('0x5b')]({'where':{'id':_0x203e81[_0x4f95('0x5a')][_0x4f95('0x61')],'role':_0x4f95('0x63')},'attributes':['id',_0x4f95('0x3b'),'fullname',_0x4f95('0x81'),_0x4f95('0x72')],'raw':!![]});}return null;})[_0x4f95('0x20')](function(_0x49c93d){if(!_0x49c93d)return null;_0x1cf4a3[_0x4f95('0x28')]['agent']=_0x49c93d;return _0x1cf4a3;})['then'](function(_0x181015){if(_0x181015){_0x181015['message'][_0x4f95('0x74')]=util['format'](_0x4f95('0x75'),_0x203e81[_0x4f95('0x62')][_0x4f95('0x3b')]);_0x181015[_0x4f95('0x28')][_0x4f95('0x76')]=_0x1cf4a3[_0x4f95('0x76')];_0x181015[_0x4f95('0x28')][_0x4f95('0x82')]=_0x1cf4a3[_0x4f95('0x76')];_0x181015[_0x4f95('0x28')][_0x4f95('0x77')]='reject';respondWithRpcPromise(_0x4f95('0x79'),_0x4f95('0x79'),{'event':_0x4f95('0x83'),'message':_0x181015[_0x4f95('0x28')]},client9002);return _0x1cf4a3;}return null;})[_0x4f95('0x20')](respondWithResult(_0x2b2323,null))[_0x4f95('0x2b')](handleError(_0x2b2323,null));};exports[_0x4f95('0x2c')]=function(_0x47002,_0x18dd5c,_0x33d859){if(_0x47002['body']['id']){delete _0x47002[_0x4f95('0x5a')]['id'];}var _0x51b492;return db[_0x4f95('0x3f')]['find']({'where':{'id':_0x47002['params']['id']}})[_0x4f95('0x20')](handleEntityNotFound(_0x18dd5c,null))[_0x4f95('0x20')](function(_0x5ed915){if(_0x5ed915){_0x51b492=_0x5ed915;return db[_0x4f95('0x84')][_0x4f95('0x5b')]({'where':{'id':_0x5ed915[_0x4f95('0x85')]}});}})[_0x4f95('0x20')](handleEntityNotFound(_0x18dd5c,null))[_0x4f95('0x20')](function(_0x13d36e){if(_0x13d36e){logger[_0x4f95('0x23')](_0x4f95('0x24'),_0x4f95('0x2c'),_0x4f95('0x86'),_0x13d36e[_0x4f95('0x42')],util[_0x4f95('0x87')](_0x47002[_0x4f95('0x5a')],{'showHidden':![],'depth':null}));switch(_0x13d36e['type']){case _0x4f95('0x88'):if(_0x47002['body'][_0x4f95('0x89')]&&_0x47002[_0x4f95('0x5a')]['MessageSid']===_0x51b492['messageId']){return _0x51b492[_0x4f95('0x38')]({'read':!![]});}else{logger['error'](_0x4f95('0x8a'),_0x4f95('0x2c'),_0x4f95('0x88'),util[_0x4f95('0x87')](_0x47002['body'],{'showHidden':![],'depth':null}));}break;case _0x4f95('0x8b'):if(_0x47002['body'][_0x4f95('0x8c')]&&_0x47002[_0x4f95('0x5a')]['MessageUUID']===_0x51b492[_0x4f95('0x8d')]&&_['indexOf'](['sent','delivered'],_0x47002[_0x4f95('0x5a')][_0x4f95('0x8e')])>=0x0){return _0x51b492[_0x4f95('0x38')]({'read':!![]});}else{logger[_0x4f95('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4f95('0x2c'),_0x4f95('0x8f'),util[_0x4f95('0x87')](_0x47002[_0x4f95('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x4f95('0x90'):var _0x587d64=_0x47002[_0x4f95('0x5a')][_0x4f95('0x91')][0x0];if(_0x587d64[_0x4f95('0x2c')][_0x4f95('0x92')]===_0x4f95('0x93')){return _0x51b492[_0x4f95('0x38')]({'read':!![]});}else{logger[_0x4f95('0x26')](_0x4f95('0x8a'),'status',_0x4f95('0x90'),util['inspect'](_0x47002['body'],{'showHidden':![],'depth':null}));}break;}return _0x51b492;}})[_0x4f95('0x20')](respondWithResult(_0x18dd5c,null))[_0x4f95('0x2b')](handleError(_0x18dd5c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 2c7d3ab..efae5d4 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 _0xcadf=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x8fb7a4,_0x607700){var _0x1fdca2=function(_0x300754){while(--_0x300754){_0x8fb7a4['push'](_0x8fb7a4['shift']());}};_0x1fdca2(++_0x607700);}(_0xcadf,0xf9));var _0xfcad=function(_0x3eb7a3,_0x543d67){_0x3eb7a3=_0x3eb7a3-0x0;var _0xfd4e54=_0xcadf[_0x3eb7a3];return _0xfd4e54;};'use strict';var EventEmitter=require(_0xfcad('0x0'));var SmsMessage=require(_0xfcad('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfcad('0x2')](0x0);var events={'afterCreate':_0xfcad('0x3'),'afterUpdate':_0xfcad('0x4'),'afterDestroy':_0xfcad('0x5')};function emitEvent(_0x2c0847){return function(_0x4d723b,_0x542d64,_0x4b7554){SmsMessageEvents[_0xfcad('0x6')](_0x2c0847+':'+_0x4d723b['id'],_0x4d723b);SmsMessageEvents[_0xfcad('0x6')](_0x2c0847,_0x4d723b);_0x4b7554(null);};}for(var e in events){if(events[_0xfcad('0x7')](e)){var event=events[e];SmsMessage[_0xfcad('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xf269=['SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3d3b8b,_0x46213a){var _0x52d410=function(_0x18ce5c){while(--_0x18ce5c){_0x3d3b8b['push'](_0x3d3b8b['shift']());}};_0x52d410(++_0x46213a);}(_0xf269,0x178));var _0x9f26=function(_0x457759,_0x4fb33a){_0x457759=_0x457759-0x0;var _0xc50bc9=_0xf269[_0x457759];return _0xc50bc9;};'use strict';var EventEmitter=require(_0x9f26('0x0'));var SmsMessage=require(_0x9f26('0x1'))['db'][_0x9f26('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9f26('0x3')](0x0);var events={'afterCreate':_0x9f26('0x4'),'afterUpdate':_0x9f26('0x5'),'afterDestroy':'remove'};function emitEvent(_0x17e656){return function(_0x41a785,_0x5726e5,_0x3ccf43){SmsMessageEvents[_0x9f26('0x6')](_0x17e656+':'+_0x41a785['id'],_0x41a785);SmsMessageEvents[_0x9f26('0x6')](_0x17e656,_0x41a785);_0x3ccf43(null);};}for(var e in events){if(events[_0x9f26('0x7')](e)){var event=events[e];SmsMessage[_0x9f26('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ff3e0a4..aedd3cb 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 _0xb458=['&password=','password','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','sender','text','timestamp','keys','sort','length','createHash','digest','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','username','smsMethod','login?username='];(function(_0x446049,_0x12640b){var _0x1fc0ed=function(_0x1535a1){while(--_0x1535a1){_0x446049['push'](_0x446049['shift']());}};_0x1fc0ed(++_0x12640b);}(_0xb458,0xca));var _0x8b45=function(_0x1e06d8,_0x11916d){_0x1e06d8=_0x1e06d8-0x0;var _0x224eb1=_0xb458[_0x1e06d8];return _0x224eb1;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))(_0x8b45('0x3'));var moment=require('moment');var BPromise=require(_0x8b45('0x4'));var rp=require(_0x8b45('0x5'));var fs=require('fs');var path=require(_0x8b45('0x6'));var rimraf=require(_0x8b45('0x7'));var config=require(_0x8b45('0x8'));var attributes=require(_0x8b45('0x9'));module[_0x8b45('0xa')]=function(_0x35680c,_0x2a5b3c){return _0x35680c[_0x8b45('0xb')](_0x8b45('0xc'),attributes,{'tableName':_0x8b45('0xd'),'paranoid':![],'indexes':[{'name':_0x8b45('0xe'),'fields':['messageId']},{'name':_0x8b45('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c067b,_0x40b585,_0x2a7c83){var _0x59ecdf=_0x35680c[_0x8b45('0x10')];var _0x58b28c=_0x3c067b[_0x8b45('0x11')]({'plain':!![]});if(_0x58b28c[_0x8b45('0x12')][_0x8b45('0x13')]()==='in'||_0x58b28c[_0x8b45('0x12')][_0x8b45('0x13')]()==='out'&&!_0x58b28c['secret']&&!_[_0x8b45('0x14')](_0x58b28c[_0x8b45('0x15')])){_0x59ecdf[_0x8b45('0x16')][_0x8b45('0x17')]({'where':{'id':_0x58b28c[_0x8b45('0x18')]}})[_0x8b45('0x19')](function(_0x1bd228){if(_0x1bd228){_0x1bd228[_0x8b45('0x1a')]({'lastMsgAt':_0x58b28c[_0x8b45('0x1b')],'lastMsgDirection':_0x58b28c[_0x8b45('0x12')][_0x8b45('0x13')]()});}})[_0x8b45('0x1c')](function(_0x29180d){console[_0x8b45('0x1d')](_0x29180d);});}if(_0x58b28c[_0x8b45('0x12')]==='out'&&!_0x58b28c['secret']){var _0x777072;_0x59ecdf[_0x8b45('0x1e')][_0x8b45('0x1f')]({'where':{'id':_0x58b28c[_0x8b45('0x20')]},'raw':!![]})[_0x8b45('0x19')](function(_0x4cf9e5){_0x777072=_0x4cf9e5;if(_0x777072&&_0x777072[_0x8b45('0x21')]){switch(_0x777072['type']){case _0x8b45('0x22'):var _0x4bb625=require(_0x8b45('0x22'));if(_0x777072[_0x8b45('0x23')]&&_0x777072[_0x8b45('0x24')]&&_0x777072['phone']){var _0xc924dd=new _0x4bb625(_0x777072[_0x8b45('0x23')],_0x777072['authToken']);_0xc924dd[_0x8b45('0x25')][_0x8b45('0x26')]({'body':_0x58b28c[_0x8b45('0x27')],'to':_0x58b28c['phone'],'from':_0x777072[_0x8b45('0x28')],'statusCallback':_0x777072[_0x8b45('0x29')]+_0x8b45('0x2a')+_0x58b28c['id']+'/status?token='+_0x777072[_0x8b45('0x2b')]})['then'](function(_0x5cd08a){if(_0x5cd08a[_0x8b45('0x2c')]){return _0x3c067b[_0x8b45('0x1a')]({'messageId':_0x5cd08a[_0x8b45('0x2c')]});}})[_0x8b45('0x1c')](function(_0x40510c){logger['error'](_0x8b45('0x2d'),_0x8b45('0x2e'),'twilio',util['inspect'](_0x40510c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8b45('0x2d'),_0x8b45('0x2e'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x531ae2='https://api.skebby.it/API/v1.0/REST/';if(_0x777072[_0x8b45('0x2f')]&&_0x777072['password']){var _0x28d540={'recipient':[_0x58b28c[_0x8b45('0x28')]],'message':_0x58b28c[_0x8b45('0x27')],'message_type':_0x777072[_0x8b45('0x30')]};if(_0x777072['smsMethod']&&_0x777072[_0x8b45('0x30')]!=='SI'){_0x28d540['sender']=_0x777072['phone'];}var _0x43a231={'url':_0x531ae2+_0x8b45('0x31')+_0x777072[_0x8b45('0x2f')]+_0x8b45('0x32')+_0x777072[_0x8b45('0x33')],'method':_0x8b45('0x34')};rp(_0x43a231)[_0x8b45('0x19')](function(_0x5ea14f){var _0x46ec18=_0x5ea14f[_0x8b45('0x35')](';');var _0x2e9a82={'user_key':_0x46ec18[0x0],'session_key':_0x46ec18[0x1]};_0x43a231={'url':_0x531ae2+_0x8b45('0x36'),'method':_0x8b45('0x37'),'headers':{'user_key':_0x2e9a82[_0x8b45('0x38')],'Session_key':_0x2e9a82[_0x8b45('0x39')]},'json':!![],'body':_0x28d540};return rp(_0x43a231);})[_0x8b45('0x19')](function(_0x4e4205){if(_0x4e4205[_0x8b45('0x3a')]>=0x1){var _0x1f6df6={'messageId':_0x4e4205['internal_order_id']};if(_0x777072[_0x8b45('0x30')]!=='GP'||!_0x777072[_0x8b45('0x3b')]){_0x1f6df6[_0x8b45('0x3c')]=!![];}return _0x3c067b['update'](_0x1f6df6);}else{return logger[_0x8b45('0x1d')](_0x8b45('0x2d'),'afterCreate',_0x8b45('0x3d'),util['inspect'](_0x4e4205,{'showHidden':![],'depth':null}));}})[_0x8b45('0x1c')](function(_0x5407c6){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8b45('0x2e'),_0x8b45('0x3d'),util[_0x8b45('0x3e')](_0x5407c6,{'showHidden':![],'depth':null}));});}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),'skebby',_0x8b45('0x3f'));}break;case _0x8b45('0x40'):if(_0x777072['authToken']){var _0x16ff19={'recipient':_0x58b28c[_0x8b45('0x28')],'message':_0x58b28c[_0x8b45('0x27')],'sender':_0x777072[_0x8b45('0x41')]||_0x777072[_0x8b45('0x28')],'authorization':_0x777072[_0x8b45('0x24')]};var _0x40b585={'method':'POST','uri':_0x8b45('0x42'),'body':_0x16ff19,'json':!![]};rp(_0x40b585)['then'](function(_0x3abe4f){var _0x292efd={'messageId':_0x3abe4f['requestid']};if(!_0x777072[_0x8b45('0x3b')]){_0x292efd[_0x8b45('0x3c')]=!![];}return _0x3c067b['update'](_0x292efd);})[_0x8b45('0x1c')](function(_0x49fdeb){logger[_0x8b45('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8b45('0x2e'),_0x8b45('0x40'),util[_0x8b45('0x3e')](_0x49fdeb,{'showHidden':![],'depth':null}));});}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x40'),_0x8b45('0x43'));}break;case _0x8b45('0x44'):if(_0x777072[_0x8b45('0x2f')]&&_0x777072[_0x8b45('0x33')]){var _0x16ff19={'messages':[{'source':_0x8b45('0x45'),'to':_0x58b28c[_0x8b45('0x28')],'body':_0x58b28c['body'],'from':_0x777072[_0x8b45('0x41')]||_0x777072[_0x8b45('0x28')]}]};var _0x2b4976=util[_0x8b45('0x46')](_0x8b45('0x47'),_0x777072[_0x8b45('0x2f')],_0x777072[_0x8b45('0x33')]);var _0x40b585={'method':_0x8b45('0x37'),'uri':_0x8b45('0x48'),'body':_0x16ff19,'headers':{'Authorization':util['format'](_0x8b45('0x49'),new Buffer(_0x2b4976)[_0x8b45('0x4a')](_0x8b45('0x4b')))},'json':!![]};rp(_0x40b585)[_0x8b45('0x19')](function(_0x4d5390){if(_0x4d5390[_0x8b45('0x4c')]>=0xc8&&_0x4d5390[_0x8b45('0x4c')]<=0xce){if(_0x4d5390[_0x8b45('0x4d')]&&_0x4d5390[_0x8b45('0x4d')][_0x8b45('0x4e')]>0x0){var _0x18cc74=_[_0x8b45('0x4f')](_0x4d5390[_0x8b45('0x4d')]['messages']);var _0x3a42a3={'messageId':_0x18cc74[_0x8b45('0x50')]};if(!_0x777072[_0x8b45('0x3b')]){_0x3a42a3[_0x8b45('0x3c')]=!![];}return _0x3c067b[_0x8b45('0x1a')](_0x3a42a3);}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),'clickSend',util[_0x8b45('0x3e')](_0x4d5390,{'showHidden':![],'depth':null}));}}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),'clickSend',util['inspect'](_0x4d5390,{'showHidden':![],'depth':null}));}})[_0x8b45('0x1c')](function(_0x36ba0f){logger[_0x8b45('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8b45('0x2e'),_0x8b45('0x51'),util[_0x8b45('0x3e')](_0x36ba0f,{'showHidden':![],'depth':null}));});}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8b45('0x52'):if(_0x777072[_0x8b45('0x53')]&&_0x777072[_0x8b45('0x24')]){var _0x16ff19={'dst':_0x58b28c[_0x8b45('0x28')],'text':_0x58b28c[_0x8b45('0x27')],'src':_0x777072[_0x8b45('0x41')]||_0x777072[_0x8b45('0x28')],'url':_0x777072[_0x8b45('0x29')]+_0x8b45('0x2a')+_0x58b28c['id']+_0x8b45('0x54')+_0x777072[_0x8b45('0x2b')]};var _0x2b4976=util[_0x8b45('0x46')](_0x8b45('0x47'),_0x777072['authId'],_0x777072[_0x8b45('0x24')]);var _0x40b585={'method':_0x8b45('0x37'),'uri':util['format'](_0x8b45('0x55'),_0x777072[_0x8b45('0x53')]),'body':_0x16ff19,'headers':{'Authorization':util[_0x8b45('0x46')](_0x8b45('0x49'),new Buffer(_0x2b4976)[_0x8b45('0x4a')](_0x8b45('0x4b')))},'json':!![]};rp(_0x40b585)['then'](function(_0x21f441){var _0x47ecf8={'messageId':_0x21f441['message_uuid'][0x0]};return _0x3c067b[_0x8b45('0x1a')](_0x47ecf8);})[_0x8b45('0x1c')](function(_0x35ef77){logger[_0x8b45('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8b45('0x2e'),'plivo',util[_0x8b45('0x3e')](_0x35ef77,{'showHidden':![],'depth':null}));});}else{logger[_0x8b45('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8b45('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x777072[_0x8b45('0x2f')]&&_0x777072[_0x8b45('0x33')]){if(_0x777072[_0x8b45('0x56')]){var _0x56b10e={'method':_0x8b45('0x37'),'uri':_0x777072['baseUrl']+_0x8b45('0x57'),'body':{'username':_0x777072[_0x8b45('0x2f')],'password':_0x777072[_0x8b45('0x33')]},'json':!![]};return rp(_0x56b10e)[_0x8b45('0x19')](function(_0x5dfaf2){var _0x36363c={'method':'POST','uri':_0x777072[_0x8b45('0x56')]+_0x8b45('0x58'),'body':{'messages':[{'from':_0x777072[_0x8b45('0x28')],'destinations':[{'to':_0x58b28c[_0x8b45('0x28')]}],'text':_0x58b28c[_0x8b45('0x27')],'notifyUrl':_0x777072[_0x8b45('0x29')]+_0x8b45('0x2a')+_0x58b28c['id']+_0x8b45('0x54')+_0x777072[_0x8b45('0x2b')],'notifyContentType':_0x8b45('0x59'),'callbackData':_0x777072[_0x8b45('0x28')]+';'+_0x58b28c[_0x8b45('0x27')]}]},'headers':{'Authorization':_0x8b45('0x5a')+_0x5dfaf2[_0x8b45('0x2b')]},'json':!![]};return rp(_0x36363c)['then'](function(_0x56d703){if(_0x56d703['messages']){var _0x4d5af8={'messageId':_0x56d703[_0x8b45('0x25')][0x0]['messageId']};if(!_0x777072[_0x8b45('0x3b')]){_0x4d5af8[_0x8b45('0x3c')]=!![];}return _0x3c067b[_0x8b45('0x1a')](_0x4d5af8);}else{return logger['error'](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x5b'),util[_0x8b45('0x3e')](_0x56d703,{'showHidden':![],'depth':null}));}});})[_0x8b45('0x1c')](function(_0xccfe63){return logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),'infobip',util[_0x8b45('0x3e')](_0xccfe63,{'showHidden':![],'depth':null}));});}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x5b'),_0x8b45('0x5c'));}}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x5b'),_0x8b45('0x3f'));}break;case _0x8b45('0x5d'):var _0x53f941=require(_0x8b45('0x5e'));if(_0x777072['apiKey']){var _0x59d466={};_0x59d466['login']=_0x777072[_0x8b45('0x2f')];_0x59d466[_0x8b45('0x28')]=_0x58b28c[_0x8b45('0x28')];_0x59d466[_0x8b45('0x5f')]=_0x777072['phone'];_0x59d466[_0x8b45('0x60')]=_0x58b28c[_0x8b45('0x27')];_0x59d466[_0x8b45('0x61')]=+new Date();var _0x5307d4='';var _0x2bee3c='';var _0x5411a3=Object[_0x8b45('0x62')](_0x59d466);_0x5411a3[_0x8b45('0x63')]();for(var _0x57618a=0x0;_0x57618a<_0x5411a3[_0x8b45('0x64')];_0x57618a++){if(_0x5307d4!=''){_0x5307d4+='&';}_0x5307d4+=_0x5411a3[_0x57618a]+'='+encodeURIComponent(_0x59d466[_0x5411a3[_0x57618a]]);_0x2bee3c+=_0x59d466[_0x5411a3[_0x57618a]];}_0x2bee3c+=_0x777072['apiKey'];_0x2bee3c=_0x53f941[_0x8b45('0x65')]('md5')['update'](_0x2bee3c)[_0x8b45('0x66')]('hex');if(_0x5307d4!==''){_0x5307d4+='&';}_0x5307d4+=_0x8b45('0x67')+_0x2bee3c;var _0x43a231={'method':_0x8b45('0x34'),'uri':_0x777072[_0x8b45('0x56')]+'/external/get/send.php?'+_0x5307d4,'json':!![]};return rp(_0x43a231)['then'](function(_0x52bea8){var _0x386f34=Object[_0x8b45('0x62')](_0x52bea8);if(_0x52bea8[_0x386f34[0x0]]['error']&&parseInt(_0x52bea8[_0x386f34[0x0]]['error'])===0x0){var _0x2fbe9c={'messageId':_0x52bea8[_0x386f34[0x0]][_0x8b45('0x68')]};if(!_0x777072[_0x8b45('0x3b')]){_0x2fbe9c['read']=!![];}return _0x3c067b[_0x8b45('0x1a')](_0x2fbe9c);}else{return logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),'csc',util[_0x8b45('0x3e')](_0x52bea8[_0x8b45('0x1d')],{'showHidden':![],'depth':null}));}})[_0x8b45('0x1c')](function(_0x45d917){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8b45('0x2e'),_0x8b45('0x5d'),util[_0x8b45('0x3e')](_0x45d917,{'showHidden':![],'depth':null}));});}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x5d'),_0x8b45('0x69'));}break;case _0x8b45('0x6a'):if(_0x777072[_0x8b45('0x6b')]){var _0x170d30={'method':_0x8b45('0x37'),'uri':_0x8b45('0x6c'),'headers':{'Authorization':_0x777072[_0x8b45('0x6b')]},'body':{'content':_0x58b28c[_0x8b45('0x27')],'to':[_0x58b28c['phone']],'from':_0x777072['phone'],'binary':![],'clientMessageId':_0x8b45('0x6d'),'charset':_0x8b45('0x6e')},'json':!![]};rp(_0x170d30)[_0x8b45('0x19')](function(_0x1451c9){if(!_0x1451c9[_0x8b45('0x1d')]){var _0x262b65={'messageId':_0x1451c9[_0x8b45('0x25')][0x0][_0x8b45('0x6f')]};if(!_0x777072[_0x8b45('0x3b')]){_0x262b65[_0x8b45('0x3c')]=!![];}return _0x3c067b[_0x8b45('0x1a')](_0x262b65);}else{return logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x6a'),util[_0x8b45('0x3e')](_0x1451c9[_0x8b45('0x1d')],{'showHidden':![],'depth':null}));}})[_0x8b45('0x1c')](function(_0x19a313){return logger[_0x8b45('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8b45('0x2e'),_0x8b45('0x6a'),util[_0x8b45('0x3e')](_0x19a313,{'showHidden':![],'depth':null}));});}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x6a'),_0x8b45('0x69'));}break;case _0x8b45('0x70'):if(_0x777072['username']&&_0x777072[_0x8b45('0x33')]){var _0x2b4976=util[_0x8b45('0x46')](_0x8b45('0x47'),_0x777072['username'],_0x777072[_0x8b45('0x33')]);var _0x40b585={'method':_0x8b45('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x777072[_0x8b45('0x71')]+_0x8b45('0x72'),'body':{'to':[_0x58b28c[_0x8b45('0x28')]],'text':_0x58b28c[_0x8b45('0x27')],'from':_0x777072['phone'],'applicationId':_0x777072[_0x8b45('0x73')]},'headers':{'Authorization':util[_0x8b45('0x46')](_0x8b45('0x49'),new Buffer(_0x2b4976)[_0x8b45('0x4a')]('base64'))},'json':!![]};rp(_0x40b585)['then'](function(_0x1d4e14){if(_0x1d4e14['id']){var _0x3aa212={'messageId':_0x1d4e14['id']};return _0x3c067b['update'](_0x3aa212);}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x70'),util[_0x8b45('0x3e')](_0x1d4e14,{'showHidden':![],'depth':null}));}})[_0x8b45('0x1c')](function(_0xee9cc5){logger[_0x8b45('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x8b45('0x3e')](_0xee9cc5,{'showHidden':![],'depth':null}));});}else{logger[_0x8b45('0x1d')](_0x8b45('0x2d'),'afterCreate',_0x8b45('0x70'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8b45('0x74'):if(_0x777072[_0x8b45('0x6b')]){var _0x38694b={};var _0x43a231={'method':_0x8b45('0x37'),'uri':_0x8b45('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x777072[_0x8b45('0x6b')],'Content-Type':_0x8b45('0x59')},'body':{'from':_0x777072[_0x8b45('0x28')],'to':_0x58b28c[_0x8b45('0x28')],'text':_0x58b28c['body']},'json':!![]};return rp(_0x43a231)[_0x8b45('0x19')](function(_0x18e3b3){if(_0x18e3b3[_0x8b45('0x76')]==0xca){_0x38694b[_0x8b45('0x77')]=_0x18e3b3;var _0x3a95a6={'method':_0x8b45('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x8b45('0x78')+_0x777072[_0x8b45('0x6b')],'Content-Type':'application/json'},'body':{'refid':_0x38694b[_0x8b45('0x77')]['refid']},'json':!![]};return rp(_0x3a95a6)[_0x8b45('0x19')](function(_0x41f86a){_0x38694b[_0x8b45('0x79')]=_0x41f86a;var _0x328da3={'messageId':_0x38694b[_0x8b45('0x77')]['refid'],'read':!![]};return _0x3c067b[_0x8b45('0x1a')](_0x328da3);});}else{return logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x74'),util[_0x8b45('0x3e')](_0x18e3b3,{'showHidden':![],'depth':null}));}})[_0x8b45('0x1c')](function(_0x5d1b02){return logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x74'),util[_0x8b45('0x3e')](_0x5d1b02,{'showHidden':![],'depth':null}));});}else{return logger[_0x8b45('0x1d')](_0x8b45('0x2d'),_0x8b45('0x2e'),_0x8b45('0x74'),_0x8b45('0x7a'));}break;}}})[_0x8b45('0x7b')](function(){_0x2a7c83();});}else{_0x2a7c83();}}},'charset':_0x8b45('0x7c'),'collate':_0x8b45('0x7d')});}; \ No newline at end of file +var _0xffe1=['applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','Bearer\x20','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','type','twilio','accountSid','authToken','phone','create','/api/sms/messages/','/status?token=','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','accountId'];(function(_0x1fd447,_0x4918b4){var _0x1b9f1a=function(_0x2405bc){while(--_0x2405bc){_0x1fd447['push'](_0x1fd447['shift']());}};_0x1b9f1a(++_0x4918b4);}(_0xffe1,0x175));var _0x1ffe=function(_0x155766,_0x35cd86){_0x155766=_0x155766-0x0;var _0x2be586=_0xffe1[_0x155766];return _0x2be586;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1ffe('0x2'));var BPromise=require(_0x1ffe('0x3'));var rp=require(_0x1ffe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ffe('0x5'));var config=require(_0x1ffe('0x6'));var attributes=require(_0x1ffe('0x7'));module['exports']=function(_0x219223,_0x22d421){return _0x219223[_0x1ffe('0x8')](_0x1ffe('0x9'),attributes,{'tableName':_0x1ffe('0xa'),'paranoid':![],'indexes':[{'name':_0x1ffe('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x1ffe('0xc')],'type':_0x1ffe('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4774a8,_0x1cc54d,_0x558992){var _0x415a78=_0x219223[_0x1ffe('0xe')];var _0x42904e=_0x4774a8[_0x1ffe('0xf')]({'plain':!![]});if(_0x42904e[_0x1ffe('0x10')][_0x1ffe('0x11')]()==='in'||_0x42904e[_0x1ffe('0x10')][_0x1ffe('0x11')]()==='out'&&!_0x42904e[_0x1ffe('0x12')]&&!_[_0x1ffe('0x13')](_0x42904e['UserId'])){_0x415a78[_0x1ffe('0x14')][_0x1ffe('0x15')]({'where':{'id':_0x42904e[_0x1ffe('0x16')]}})[_0x1ffe('0x17')](function(_0x1a5cb0){if(_0x1a5cb0){_0x1a5cb0['update']({'lastMsgAt':_0x42904e[_0x1ffe('0x18')],'lastMsgDirection':_0x42904e[_0x1ffe('0x10')][_0x1ffe('0x11')]()});}})['catch'](function(_0x20293f){console['error'](_0x20293f);});}if(_0x42904e[_0x1ffe('0x10')]==='out'&&!_0x42904e[_0x1ffe('0x12')]){var _0x3c0584;_0x415a78['SmsAccount']['find']({'where':{'id':_0x42904e['SmsAccountId']},'raw':!![]})[_0x1ffe('0x17')](function(_0x21950f){_0x3c0584=_0x21950f;if(_0x3c0584&&_0x3c0584[_0x1ffe('0x19')]){switch(_0x3c0584[_0x1ffe('0x19')]){case _0x1ffe('0x1a'):var _0x73c91e=require(_0x1ffe('0x1a'));if(_0x3c0584[_0x1ffe('0x1b')]&&_0x3c0584[_0x1ffe('0x1c')]&&_0x3c0584[_0x1ffe('0x1d')]){var _0x63b49b=new _0x73c91e(_0x3c0584[_0x1ffe('0x1b')],_0x3c0584['authToken']);_0x63b49b['messages'][_0x1ffe('0x1e')]({'body':_0x42904e[_0x1ffe('0xc')],'to':_0x42904e[_0x1ffe('0x1d')],'from':_0x3c0584['phone'],'statusCallback':_0x3c0584['remote']+_0x1ffe('0x1f')+_0x42904e['id']+_0x1ffe('0x20')+_0x3c0584[_0x1ffe('0x21')]})['then'](function(_0x2f7bcc){if(_0x2f7bcc[_0x1ffe('0x22')]){return _0x4774a8[_0x1ffe('0x23')]({'messageId':_0x2f7bcc[_0x1ffe('0x22')]});}})[_0x1ffe('0x24')](function(_0x33e82d){logger['error'](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x1a'),util[_0x1ffe('0x27')](_0x33e82d,{'showHidden':![],'depth':null}));});}else{logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x2550e5='https://api.skebby.it/API/v1.0/REST/';if(_0x3c0584[_0x1ffe('0x29')]&&_0x3c0584[_0x1ffe('0x2a')]){var _0x3ef042={'recipient':[_0x42904e['phone']],'message':_0x42904e[_0x1ffe('0xc')],'message_type':_0x3c0584[_0x1ffe('0x2b')]};if(_0x3c0584[_0x1ffe('0x2b')]&&_0x3c0584[_0x1ffe('0x2b')]!=='SI'){_0x3ef042[_0x1ffe('0x2c')]=_0x3c0584['phone'];}var _0x40984a={'url':_0x2550e5+_0x1ffe('0x2d')+_0x3c0584[_0x1ffe('0x29')]+_0x1ffe('0x2e')+_0x3c0584[_0x1ffe('0x2a')],'method':_0x1ffe('0x2f')};rp(_0x40984a)['then'](function(_0x179590){var _0x59b8e1=_0x179590[_0x1ffe('0x30')](';');var _0x460464={'user_key':_0x59b8e1[0x0],'session_key':_0x59b8e1[0x1]};_0x40984a={'url':_0x2550e5+_0x1ffe('0x31'),'method':_0x1ffe('0x32'),'headers':{'user_key':_0x460464[_0x1ffe('0x33')],'Session_key':_0x460464['session_key']},'json':!![],'body':_0x3ef042};return rp(_0x40984a);})['then'](function(_0xbbe09a){if(_0xbbe09a['total_sent']>=0x1){var _0x2d9be4={'messageId':_0xbbe09a['internal_order_id']};if(_0x3c0584[_0x1ffe('0x2b')]!=='GP'||!_0x3c0584[_0x1ffe('0x34')]){_0x2d9be4[_0x1ffe('0x35')]=!![];}return _0x4774a8[_0x1ffe('0x23')](_0x2d9be4);}else{return logger[_0x1ffe('0x28')](_0x1ffe('0x25'),'afterCreate',_0x1ffe('0x36'),util[_0x1ffe('0x27')](_0xbbe09a,{'showHidden':![],'depth':null}));}})[_0x1ffe('0x24')](function(_0x57201b){return logger['error'](_0x1ffe('0x25'),_0x1ffe('0x26'),'skebby',util[_0x1ffe('0x27')](_0x57201b,{'showHidden':![],'depth':null}));});}else{logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x36'),_0x1ffe('0x37'));}break;case _0x1ffe('0x38'):if(_0x3c0584['authToken']){var _0x344683={'recipient':_0x42904e[_0x1ffe('0x1d')],'message':_0x42904e['body'],'sender':_0x3c0584['senderString']||_0x3c0584['phone'],'authorization':_0x3c0584[_0x1ffe('0x1c')]};var _0x1cc54d={'method':_0x1ffe('0x32'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x344683,'json':!![]};rp(_0x1cc54d)[_0x1ffe('0x17')](function(_0x208936){var _0x2cc58e={'messageId':_0x208936[_0x1ffe('0x39')]};if(!_0x3c0584[_0x1ffe('0x34')]){_0x2cc58e['read']=!![];}return _0x4774a8[_0x1ffe('0x23')](_0x2cc58e);})[_0x1ffe('0x24')](function(_0x459bac){logger[_0x1ffe('0x28')](_0x1ffe('0x25'),'afterCreate',_0x1ffe('0x38'),util[_0x1ffe('0x27')](_0x459bac,{'showHidden':![],'depth':null}));});}else{logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x38'),_0x1ffe('0x3a'));}break;case _0x1ffe('0x3b'):if(_0x3c0584[_0x1ffe('0x29')]&&_0x3c0584[_0x1ffe('0x2a')]){var _0x344683={'messages':[{'source':_0x1ffe('0x3c'),'to':_0x42904e['phone'],'body':_0x42904e[_0x1ffe('0xc')],'from':_0x3c0584[_0x1ffe('0x3d')]||_0x3c0584[_0x1ffe('0x1d')]}]};var _0x55967a=util[_0x1ffe('0x3e')](_0x1ffe('0x3f'),_0x3c0584['username'],_0x3c0584['password']);var _0x1cc54d={'method':_0x1ffe('0x32'),'uri':_0x1ffe('0x40'),'body':_0x344683,'headers':{'Authorization':util[_0x1ffe('0x3e')](_0x1ffe('0x41'),new Buffer(_0x55967a)[_0x1ffe('0x42')](_0x1ffe('0x43')))},'json':!![]};rp(_0x1cc54d)['then'](function(_0x3168bd){if(_0x3168bd[_0x1ffe('0x44')]>=0xc8&&_0x3168bd[_0x1ffe('0x44')]<=0xce){if(_0x3168bd[_0x1ffe('0x45')]&&_0x3168bd[_0x1ffe('0x45')][_0x1ffe('0x46')]>0x0){var _0x4f98d6=_[_0x1ffe('0x47')](_0x3168bd[_0x1ffe('0x45')][_0x1ffe('0x48')]);var _0x2ffd14={'messageId':_0x4f98d6['message_id']};if(!_0x3c0584[_0x1ffe('0x34')]){_0x2ffd14['read']=!![];}return _0x4774a8['update'](_0x2ffd14);}else{logger['error'](_0x1ffe('0x25'),'afterCreate',_0x1ffe('0x49'),util[_0x1ffe('0x27')](_0x3168bd,{'showHidden':![],'depth':null}));}}else{logger[_0x1ffe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ffe('0x26'),'clickSend',util[_0x1ffe('0x27')](_0x3168bd,{'showHidden':![],'depth':null}));}})[_0x1ffe('0x24')](function(_0x1426a1){logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x49'),util[_0x1ffe('0x27')](_0x1426a1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1ffe('0x25'),'afterCreate',_0x1ffe('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1ffe('0x4a'):if(_0x3c0584['authId']&&_0x3c0584[_0x1ffe('0x1c')]){var _0x344683={'dst':_0x42904e[_0x1ffe('0x1d')],'text':_0x42904e[_0x1ffe('0xc')],'src':_0x3c0584['senderString']||_0x3c0584['phone'],'url':_0x3c0584['remote']+_0x1ffe('0x1f')+_0x42904e['id']+_0x1ffe('0x20')+_0x3c0584[_0x1ffe('0x21')]};var _0x55967a=util['format'](_0x1ffe('0x3f'),_0x3c0584[_0x1ffe('0x4b')],_0x3c0584[_0x1ffe('0x1c')]);var _0x1cc54d={'method':'POST','uri':util[_0x1ffe('0x3e')](_0x1ffe('0x4c'),_0x3c0584['authId']),'body':_0x344683,'headers':{'Authorization':util[_0x1ffe('0x3e')](_0x1ffe('0x41'),new Buffer(_0x55967a)[_0x1ffe('0x42')](_0x1ffe('0x43')))},'json':!![]};rp(_0x1cc54d)[_0x1ffe('0x17')](function(_0x395dda){var _0x2381b5={'messageId':_0x395dda[_0x1ffe('0x4d')][0x0]};return _0x4774a8[_0x1ffe('0x23')](_0x2381b5);})[_0x1ffe('0x24')](function(_0x556391){logger[_0x1ffe('0x28')](_0x1ffe('0x25'),'afterCreate',_0x1ffe('0x4a'),util[_0x1ffe('0x27')](_0x556391,{'showHidden':![],'depth':null}));});}else{logger[_0x1ffe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ffe('0x26'),_0x1ffe('0x4a'),_0x1ffe('0x4e'));}break;case _0x1ffe('0x4f'):if(_0x3c0584[_0x1ffe('0x29')]&&_0x3c0584['password']){if(_0x3c0584[_0x1ffe('0x50')]){var _0x5dc7e0={'method':_0x1ffe('0x32'),'uri':_0x3c0584[_0x1ffe('0x50')]+_0x1ffe('0x51'),'body':{'username':_0x3c0584[_0x1ffe('0x29')],'password':_0x3c0584[_0x1ffe('0x2a')]},'json':!![]};return rp(_0x5dc7e0)[_0x1ffe('0x17')](function(_0x10147a){var _0xa7c499={'method':'POST','uri':_0x3c0584['baseUrl']+_0x1ffe('0x52'),'body':{'messages':[{'from':_0x3c0584[_0x1ffe('0x1d')],'destinations':[{'to':_0x42904e[_0x1ffe('0x1d')]}],'text':_0x42904e[_0x1ffe('0xc')],'notifyUrl':_0x3c0584['remote']+_0x1ffe('0x1f')+_0x42904e['id']+_0x1ffe('0x20')+_0x3c0584[_0x1ffe('0x21')],'notifyContentType':'application/json','callbackData':_0x3c0584[_0x1ffe('0x1d')]+';'+_0x42904e[_0x1ffe('0xc')]}]},'headers':{'Authorization':_0x1ffe('0x53')+_0x10147a[_0x1ffe('0x21')]},'json':!![]};return rp(_0xa7c499)[_0x1ffe('0x17')](function(_0x64b0cb){if(_0x64b0cb[_0x1ffe('0x48')]){var _0x34d460={'messageId':_0x64b0cb['messages'][0x0][_0x1ffe('0xb')]};if(!_0x3c0584[_0x1ffe('0x34')]){_0x34d460[_0x1ffe('0x35')]=!![];}return _0x4774a8[_0x1ffe('0x23')](_0x34d460);}else{return logger['error'](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x4f'),util[_0x1ffe('0x27')](_0x64b0cb,{'showHidden':![],'depth':null}));}});})[_0x1ffe('0x24')](function(_0x46c5b4){return logger[_0x1ffe('0x28')](_0x1ffe('0x25'),'afterCreate','infobip',util[_0x1ffe('0x27')](_0x46c5b4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x4f'),_0x1ffe('0x54'));}}else{logger['error'](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x5024ab=require(_0x1ffe('0x55'));if(_0x3c0584['apiKey']){var _0x15151f={};_0x15151f[_0x1ffe('0x56')]=_0x3c0584[_0x1ffe('0x29')];_0x15151f[_0x1ffe('0x1d')]=_0x42904e[_0x1ffe('0x1d')];_0x15151f[_0x1ffe('0x2c')]=_0x3c0584[_0x1ffe('0x1d')];_0x15151f[_0x1ffe('0x57')]=_0x42904e[_0x1ffe('0xc')];_0x15151f[_0x1ffe('0x58')]=+new Date();var _0x22fd49='';var _0x37d373='';var _0x35f833=Object[_0x1ffe('0x59')](_0x15151f);_0x35f833[_0x1ffe('0x5a')]();for(var _0x31b0a1=0x0;_0x31b0a1<_0x35f833[_0x1ffe('0x5b')];_0x31b0a1++){if(_0x22fd49!=''){_0x22fd49+='&';}_0x22fd49+=_0x35f833[_0x31b0a1]+'='+encodeURIComponent(_0x15151f[_0x35f833[_0x31b0a1]]);_0x37d373+=_0x15151f[_0x35f833[_0x31b0a1]];}_0x37d373+=_0x3c0584[_0x1ffe('0x5c')];_0x37d373=_0x5024ab[_0x1ffe('0x5d')](_0x1ffe('0x5e'))[_0x1ffe('0x23')](_0x37d373)[_0x1ffe('0x5f')]('hex');if(_0x22fd49!==''){_0x22fd49+='&';}_0x22fd49+=_0x1ffe('0x60')+_0x37d373;var _0x40984a={'method':'GET','uri':_0x3c0584[_0x1ffe('0x50')]+_0x1ffe('0x61')+_0x22fd49,'json':!![]};return rp(_0x40984a)['then'](function(_0x5b1b8a){var _0x56f466=Object[_0x1ffe('0x59')](_0x5b1b8a);if(_0x5b1b8a[_0x56f466[0x0]][_0x1ffe('0x28')]&&parseInt(_0x5b1b8a[_0x56f466[0x0]][_0x1ffe('0x28')])===0x0){var _0xa90c01={'messageId':_0x5b1b8a[_0x56f466[0x0]][_0x1ffe('0x62')]};if(!_0x3c0584[_0x1ffe('0x34')]){_0xa90c01[_0x1ffe('0x35')]=!![];}return _0x4774a8['update'](_0xa90c01);}else{return logger['error'](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x63'),util[_0x1ffe('0x27')](_0x5b1b8a[_0x1ffe('0x28')],{'showHidden':![],'depth':null}));}})[_0x1ffe('0x24')](function(_0x4c4c67){return logger['error'](_0x1ffe('0x25'),'afterCreate',_0x1ffe('0x63'),util[_0x1ffe('0x27')](_0x4c4c67,{'showHidden':![],'depth':null}));});}else{logger[_0x1ffe('0x28')](_0x1ffe('0x25'),'afterCreate',_0x1ffe('0x63'),_0x1ffe('0x64'));}break;case _0x1ffe('0x65'):if(_0x3c0584[_0x1ffe('0x5c')]){var _0x38d78c={'method':_0x1ffe('0x32'),'uri':_0x1ffe('0x66'),'headers':{'Authorization':_0x3c0584[_0x1ffe('0x5c')]},'body':{'content':_0x42904e['body'],'to':[_0x42904e[_0x1ffe('0x1d')]],'from':_0x3c0584['phone'],'binary':![],'clientMessageId':_0x1ffe('0x67'),'charset':_0x1ffe('0x68')},'json':!![]};rp(_0x38d78c)[_0x1ffe('0x17')](function(_0x5158b9){if(!_0x5158b9[_0x1ffe('0x28')]){var _0x1e1d4c={'messageId':_0x5158b9['messages'][0x0]['apiMessageId']};if(!_0x3c0584[_0x1ffe('0x34')]){_0x1e1d4c['read']=!![];}return _0x4774a8[_0x1ffe('0x23')](_0x1e1d4c);}else{return logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),'clickatell',util[_0x1ffe('0x27')](_0x5158b9['error'],{'showHidden':![],'depth':null}));}})[_0x1ffe('0x24')](function(_0x339531){return logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),'clickatell',util[_0x1ffe('0x27')](_0x339531,{'showHidden':![],'depth':null}));});}else{logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x65'),_0x1ffe('0x64'));}break;case _0x1ffe('0x69'):if(_0x3c0584[_0x1ffe('0x29')]&&_0x3c0584[_0x1ffe('0x2a')]){var _0x55967a=util[_0x1ffe('0x3e')](_0x1ffe('0x3f'),_0x3c0584['username'],_0x3c0584[_0x1ffe('0x2a')]);var _0x1cc54d={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3c0584[_0x1ffe('0x6a')]+'/messages','body':{'to':[_0x42904e[_0x1ffe('0x1d')]],'text':_0x42904e[_0x1ffe('0xc')],'from':_0x3c0584['phone'],'applicationId':_0x3c0584[_0x1ffe('0x6b')]},'headers':{'Authorization':util['format'](_0x1ffe('0x41'),new Buffer(_0x55967a)[_0x1ffe('0x42')]('base64'))},'json':!![]};rp(_0x1cc54d)[_0x1ffe('0x17')](function(_0xe46c21){if(_0xe46c21['id']){var _0x37070c={'messageId':_0xe46c21['id']};return _0x4774a8[_0x1ffe('0x23')](_0x37070c);}else{logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x69'),util[_0x1ffe('0x27')](_0xe46c21,{'showHidden':![],'depth':null}));}})[_0x1ffe('0x24')](function(_0xc0d1d1){logger[_0x1ffe('0x28')](_0x1ffe('0x25'),'afterCreate',_0x1ffe('0x69'),util[_0x1ffe('0x27')](_0xc0d1d1,{'showHidden':![],'depth':null}));});}else{logger[_0x1ffe('0x28')](_0x1ffe('0x25'),_0x1ffe('0x26'),_0x1ffe('0x69'),_0x1ffe('0x37'));}break;case _0x1ffe('0x6c'):if(_0x3c0584['apiKey']){var _0x1636cc={};var _0x40984a={'method':_0x1ffe('0x32'),'uri':_0x1ffe('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x3c0584[_0x1ffe('0x5c')],'Content-Type':_0x1ffe('0x6e')},'body':{'from':_0x3c0584[_0x1ffe('0x1d')],'to':_0x42904e[_0x1ffe('0x1d')],'text':_0x42904e['body']},'json':!![]};return rp(_0x40984a)[_0x1ffe('0x17')](function(_0x327b6e){if(_0x327b6e[_0x1ffe('0x6f')]==0xca){_0x1636cc[_0x1ffe('0x70')]=_0x327b6e;var _0x4359e3={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x1ffe('0x71')+_0x3c0584['apiKey'],'Content-Type':_0x1ffe('0x6e')},'body':{'refid':_0x1636cc[_0x1ffe('0x70')][_0x1ffe('0x72')]},'json':!![]};return rp(_0x4359e3)['then'](function(_0x4fc131){_0x1636cc[_0x1ffe('0x73')]=_0x4fc131;var _0x2c912d={'messageId':_0x1636cc[_0x1ffe('0x70')][_0x1ffe('0x72')],'read':!![]};return _0x4774a8['update'](_0x2c912d);});}else{return logger[_0x1ffe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ffe('0x26'),_0x1ffe('0x6c'),util[_0x1ffe('0x27')](_0x327b6e,{'showHidden':![],'depth':null}));}})[_0x1ffe('0x24')](function(_0x17791e){return logger['error'](_0x1ffe('0x25'),_0x1ffe('0x26'),'intelepeer',util[_0x1ffe('0x27')](_0x17791e,{'showHidden':![],'depth':null}));});}else{return logger[_0x1ffe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1ffe('0x6c'),_0x1ffe('0x74'));}break;}}})[_0x1ffe('0x75')](function(){_0x558992();});}else{_0x558992();}}},'charset':_0x1ffe('0x76'),'collate':_0x1ffe('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 462f4b4..2cb564e 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 _0x46b1=['defaults','localhost','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','body','options','raw','then','CreateSmsMessage','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5382ff,_0x4946a9){var _0x4e749a=function(_0x4062a2){while(--_0x4062a2){_0x5382ff['push'](_0x5382ff['shift']());}};_0x4e749a(++_0x4946a9);}(_0x46b1,0x197));var _0x146b=function(_0x4ccf7f,_0x161ffd){_0x4ccf7f=_0x4ccf7f-0x0;var _0x1953f0=_0x46b1[_0x4ccf7f];return _0x1953f0;};'use strict';var _=require(_0x146b('0x0'));var util=require(_0x146b('0x1'));var moment=require('moment');var BPromise=require(_0x146b('0x2'));var rs=require(_0x146b('0x3'));var fs=require('fs');var Redis=require(_0x146b('0x4'));var db=require(_0x146b('0x5'))['db'];var utils=require(_0x146b('0x6'));var logger=require('../../config/logger')(_0x146b('0x7'));var config=require(_0x146b('0x8'));var jayson=require(_0x146b('0x9'));var client=jayson[_0x146b('0xa')][_0x146b('0xb')]({'port':0x232a});config[_0x146b('0xc')]=_[_0x146b('0xd')](config[_0x146b('0xc')],{'host':_0x146b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x146b('0xc')]));require(_0x146b('0xf'))[_0x146b('0x10')](socket);function respondWithRpcPromise(_0x1a03d1,_0xe5cbbf,_0x18286d){return new BPromise(function(_0x2eaad2,_0xf63b2a){return client[_0x146b('0x11')](_0x1a03d1,_0x18286d)['then'](function(_0xe15fa3){logger[_0x146b('0x12')](_0x146b('0x13'),_0xe5cbbf,_0x146b('0x14'));logger[_0x146b('0x15')](_0x146b('0x16'),_0xe5cbbf,_0x146b('0x14'),JSON[_0x146b('0x17')](_0xe15fa3));if(_0xe15fa3[_0x146b('0x18')]){if(_0xe15fa3['error'][_0x146b('0x19')]===0x1f4){logger[_0x146b('0x18')](_0x146b('0x13'),_0xe5cbbf,_0xe15fa3[_0x146b('0x18')]['message']);return _0xf63b2a(_0xe15fa3[_0x146b('0x18')][_0x146b('0x1a')]);}logger[_0x146b('0x18')](_0x146b('0x13'),_0xe5cbbf,_0xe15fa3[_0x146b('0x18')]['message']);return _0x2eaad2(_0xe15fa3[_0x146b('0x18')][_0x146b('0x1a')]);}else{logger[_0x146b('0x12')](_0x146b('0x13'),_0xe5cbbf,'request\x20sent');_0x2eaad2(_0xe15fa3[_0x146b('0x1b')][_0x146b('0x1a')]);}})['catch'](function(_0x3c2acc){logger[_0x146b('0x18')]('SmsMessage,\x20%s,\x20%s',_0xe5cbbf,_0x3c2acc);_0xf63b2a(_0x3c2acc);});});}exports['CreateSmsMessage']=function(_0x414218){var _0x2b6e37=this;return new Promise(function(_0x38f6bd,_0x4f3644){return db['SmsMessage'][_0x146b('0x1c')](_0x414218[_0x146b('0x1d')],{'raw':_0x414218[_0x146b('0x1e')]?_0x414218[_0x146b('0x1e')][_0x146b('0x1f')]===undefined?!![]:![]:!![]})[_0x146b('0x20')](function(_0x36f4e2){logger[_0x146b('0x12')](_0x146b('0x21'),_0x414218);logger[_0x146b('0x15')]('CreateSmsMessage',_0x414218,JSON[_0x146b('0x17')](_0x36f4e2));_0x38f6bd(_0x36f4e2);})[_0x146b('0x22')](function(_0x38efda){logger[_0x146b('0x18')]('CreateSmsMessage',_0x38efda[_0x146b('0x1a')],_0x414218);_0x4f3644(_0x2b6e37[_0x146b('0x18')](0x1f4,_0x38efda[_0x146b('0x1a')]));});});}; \ No newline at end of file +var _0xb522=['code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','options','raw','info','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','then','debug','request\x20sent','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb522,0x12b));var _0x2b52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb522[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2b52('0x0'));var util=require(_0x2b52('0x1'));var moment=require(_0x2b52('0x2'));var BPromise=require(_0x2b52('0x3'));var rs=require(_0x2b52('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b52('0x5'))['db'];var utils=require(_0x2b52('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b52('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2b52('0x8')][_0x2b52('0x9')]({'port':0x232a});config[_0x2b52('0xa')]=_[_0x2b52('0xb')](config[_0x2b52('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b52('0xc'))(new Redis(config['redis']));require(_0x2b52('0xd'))[_0x2b52('0xe')](socket);function respondWithRpcPromise(_0x2471f1,_0x560cae,_0x319500){return new BPromise(function(_0x33700b,_0x3f30ad){return client[_0x2b52('0xf')](_0x2471f1,_0x319500)[_0x2b52('0x10')](function(_0x4cee7b){logger['info']('SmsMessage,\x20%s,\x20%s',_0x560cae,'request\x20sent');logger[_0x2b52('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x560cae,_0x2b52('0x12'),JSON[_0x2b52('0x13')](_0x4cee7b));if(_0x4cee7b[_0x2b52('0x14')]){if(_0x4cee7b[_0x2b52('0x14')][_0x2b52('0x15')]===0x1f4){logger[_0x2b52('0x14')](_0x2b52('0x16'),_0x560cae,_0x4cee7b[_0x2b52('0x14')][_0x2b52('0x17')]);return _0x3f30ad(_0x4cee7b['error'][_0x2b52('0x17')]);}logger[_0x2b52('0x14')](_0x2b52('0x16'),_0x560cae,_0x4cee7b[_0x2b52('0x14')]['message']);return _0x33700b(_0x4cee7b[_0x2b52('0x14')][_0x2b52('0x17')]);}else{logger['info'](_0x2b52('0x16'),_0x560cae,_0x2b52('0x12'));_0x33700b(_0x4cee7b[_0x2b52('0x18')][_0x2b52('0x17')]);}})[_0x2b52('0x19')](function(_0x9a9d1d){logger['error'](_0x2b52('0x16'),_0x560cae,_0x9a9d1d);_0x3f30ad(_0x9a9d1d);});});}exports['CreateSmsMessage']=function(_0x45deae){var _0x3d104f=this;return new Promise(function(_0x419adc,_0x19c2a4){return db[_0x2b52('0x1a')][_0x2b52('0x1b')](_0x45deae['body'],{'raw':_0x45deae[_0x2b52('0x1c')]?_0x45deae[_0x2b52('0x1c')][_0x2b52('0x1d')]===undefined?!![]:![]:!![]})[_0x2b52('0x10')](function(_0xf92151){logger[_0x2b52('0x1e')]('CreateSmsMessage',_0x45deae);logger[_0x2b52('0x11')](_0x2b52('0x1f'),_0x45deae,JSON['stringify'](_0xf92151));_0x419adc(_0xf92151);})[_0x2b52('0x19')](function(_0x5a89dc){logger[_0x2b52('0x14')](_0x2b52('0x1f'),_0x5a89dc['message'],_0x45deae);_0x19c2a4(_0x3d104f[_0x2b52('0x14')](0x1f4,_0x5a89dc[_0x2b52('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 33329b0..932fbc5 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 _0x1a10=['save','remove','update','emit','removeListener','register'];(function(_0x2c1a16,_0x2e0cb4){var _0x51c0cf=function(_0x41e796){while(--_0x41e796){_0x2c1a16['push'](_0x2c1a16['shift']());}};_0x51c0cf(++_0x2e0cb4);}(_0x1a10,0xea));var _0x01a1=function(_0x1e71c1,_0x28f627){_0x1e71c1=_0x1e71c1-0x0;var _0x17df40=_0x1a10[_0x1e71c1];return _0x17df40;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x01a1('0x0'),_0x01a1('0x1'),_0x01a1('0x2')];function createListener(_0x33ac58,_0x321fde){return function(_0x238257){_0x321fde[_0x01a1('0x3')](_0x33ac58,_0x238257);};}function removeListener(_0x515c5f,_0x11d469){return function(){SmsMessageEvents[_0x01a1('0x4')](_0x515c5f,_0x11d469);};}exports[_0x01a1('0x5')]=function(_0x51fc57){for(var _0x162269=0x0,_0x4e6b1b=events['length'];_0x162269<_0x4e6b1b;_0x162269++){var _0x30edf6=events[_0x162269];var _0x47f317=createListener('smsMessage:'+_0x30edf6,_0x51fc57);SmsMessageEvents['on'](_0x30edf6,_0x47f317);}}; \ No newline at end of file +var _0x8ac2=['length','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x4bb487,_0x54684e){var _0x1b63bf=function(_0x7fbe3d){while(--_0x7fbe3d){_0x4bb487['push'](_0x4bb487['shift']());}};_0x1b63bf(++_0x54684e);}(_0x8ac2,0xb6));var _0x28ac=function(_0x50d877,_0x3a441e){_0x50d877=_0x50d877-0x0;var _0x79c905=_0x8ac2[_0x50d877];return _0x79c905;};'use strict';var SmsMessageEvents=require(_0x28ac('0x0'));var events=[_0x28ac('0x1'),_0x28ac('0x2'),_0x28ac('0x3')];function createListener(_0x33b15b,_0x35ce7f){return function(_0x228194){_0x35ce7f[_0x28ac('0x4')](_0x33b15b,_0x228194);};}function removeListener(_0x348b33,_0x29670d){return function(){SmsMessageEvents[_0x28ac('0x5')](_0x348b33,_0x29670d);};}exports[_0x28ac('0x6')]=function(_0x188103){for(var _0x19dc43=0x0,_0xe131ae=events[_0x28ac('0x7')];_0x19dc43<_0xe131ae;_0x19dc43++){var _0x191d1b=events[_0x19dc43];var _0xb45c80=createListener(_0x28ac('0x8')+_0x191d1b,_0x188103);SmsMessageEvents['on'](_0x191d1b,_0xb45c80);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d536c60..593db3e 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 _0xf1dd=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members'];(function(_0xdac027,_0x5d75de){var _0x1e5e64=function(_0x2f4727){while(--_0x2f4727){_0xdac027['push'](_0xdac027['shift']());}};_0x1e5e64(++_0x5d75de);}(_0xf1dd,0x106));var _0xdf1d=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0xf1dd[_0x440917];return _0x5e906b;};'use strict';var multer=require(_0xdf1d('0x0'));var util=require(_0xdf1d('0x1'));var path=require(_0xdf1d('0x2'));var timeout=require(_0xdf1d('0x3'));var express=require(_0xdf1d('0x4'));var router=express[_0xdf1d('0x5')]();var fs_extra=require(_0xdf1d('0x6'));var auth=require(_0xdf1d('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdf1d('0x8'));router[_0xdf1d('0x9')]('/',auth['isAuthenticated'](),controller[_0xdf1d('0xa')]);router[_0xdf1d('0x9')](_0xdf1d('0xb'),auth[_0xdf1d('0xc')](),controller[_0xdf1d('0xd')]);router['get'](_0xdf1d('0xe'),auth[_0xdf1d('0xc')](),controller[_0xdf1d('0xf')]);router[_0xdf1d('0x9')](_0xdf1d('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0xdf1d('0x9')](_0xdf1d('0x11'),auth['isAuthenticated'](),controller[_0xdf1d('0x12')]);router['get'](_0xdf1d('0x13'),auth[_0xdf1d('0xc')](),controller[_0xdf1d('0x14')]);router[_0xdf1d('0x15')]('/',auth['isAuthenticated'](),controller[_0xdf1d('0x16')]);router[_0xdf1d('0x15')]('/:id/teams',auth[_0xdf1d('0xc')](),controller[_0xdf1d('0x17')]);router[_0xdf1d('0x15')](_0xdf1d('0x13'),auth[_0xdf1d('0xc')](),controller[_0xdf1d('0x18')]);router[_0xdf1d('0x19')](_0xdf1d('0xe'),auth[_0xdf1d('0xc')](),controller[_0xdf1d('0x1a')]);router[_0xdf1d('0x1b')]('/:id',auth[_0xdf1d('0xc')](),controller[_0xdf1d('0x1c')]);router[_0xdf1d('0x1b')](_0xdf1d('0x11'),auth[_0xdf1d('0xc')](),controller['removeTeams']);router[_0xdf1d('0x1b')](_0xdf1d('0x13'),auth['isAuthenticated'](),controller[_0xdf1d('0x1d')]);module[_0xdf1d('0x1e')]=router; \ No newline at end of file +var _0x7a88=['isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','/:id/users','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get'];(function(_0x1e1077,_0x29aabe){var _0x5393bf=function(_0x4f9fe2){while(--_0x4f9fe2){_0x1e1077['push'](_0x1e1077['shift']());}};_0x5393bf(++_0x29aabe);}(_0x7a88,0xb4));var _0x87a8=function(_0x21b1e0,_0x59d6e4){_0x21b1e0=_0x21b1e0-0x0;var _0x18e44c=_0x7a88[_0x21b1e0];return _0x18e44c;};'use strict';var multer=require(_0x87a8('0x0'));var util=require(_0x87a8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x87a8('0x2')]();var fs_extra=require(_0x87a8('0x3'));var auth=require(_0x87a8('0x4'));var interaction=require(_0x87a8('0x5'));var config=require(_0x87a8('0x6'));var controller=require(_0x87a8('0x7'));router[_0x87a8('0x8')]('/',auth[_0x87a8('0x9')](),controller[_0x87a8('0xa')]);router['get']('/describe',auth[_0x87a8('0x9')](),controller[_0x87a8('0xb')]);router[_0x87a8('0x8')](_0x87a8('0xc'),auth[_0x87a8('0x9')](),controller[_0x87a8('0xd')]);router[_0x87a8('0x8')](_0x87a8('0xe'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x87a8('0xf'),auth[_0x87a8('0x9')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x87a8('0x10')]);router[_0x87a8('0x11')]('/',auth[_0x87a8('0x9')](),controller[_0x87a8('0x12')]);router[_0x87a8('0x11')](_0x87a8('0xf'),auth[_0x87a8('0x9')](),controller[_0x87a8('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x87a8('0x14')](_0x87a8('0xc'),auth['isAuthenticated'](),controller[_0x87a8('0x15')]);router['delete'](_0x87a8('0xc'),auth[_0x87a8('0x9')](),controller[_0x87a8('0x16')]);router[_0x87a8('0x17')](_0x87a8('0xf'),auth[_0x87a8('0x9')](),controller[_0x87a8('0x18')]);router[_0x87a8('0x17')](_0x87a8('0x19'),auth[_0x87a8('0x9')](),controller['removeAgents']);module[_0x87a8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 878ef85..4c03835 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 _0x9cd2=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x5be566,_0x4d62e0){var _0x3840db=function(_0x276319){while(--_0x276319){_0x5be566['push'](_0x5be566['shift']());}};_0x3840db(++_0x4d62e0);}(_0x9cd2,0x1b9));var _0x29cd=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x9cd2[_0x28611e];return _0x530f69;};'use strict';var Sequelize=require(_0x29cd('0x0'));module[_0x29cd('0x1')]={'name':{'type':Sequelize[_0x29cd('0x2')],'unique':_0x29cd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x29cd('0x2')]},'timeout':{'type':Sequelize[_0x29cd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x29cd('0x5')]('rrmemory',_0x29cd('0x6'),_0x29cd('0x7'))}}; \ No newline at end of file +var _0xe2cc=['sequelize','exports','name','STRING','ENUM','rrmemory','beepall'];(function(_0x9c8db5,_0xdd9453){var _0x9ba19d=function(_0x162f97){while(--_0x162f97){_0x9c8db5['push'](_0x9c8db5['shift']());}};_0x9ba19d(++_0xdd9453);}(_0xe2cc,0x1a4));var _0xce2c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xe2cc[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0xce2c('0x0'));module[_0xce2c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xce2c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xce2c('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xce2c('0x4')](_0xce2c('0x5'),_0xce2c('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e6e472d..d00eac5 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 _0x7d44=['findOne','length','SmsQueueId','UserSmsQueue','findAndCountAll','UserId','agent','smsPause','createdAt','format','%s/%s','updatedAt','Team','nolimit','ids','User','online','flatMap','Agents','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','all','union','compact','value','removeTeams','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','get','SmsQueues','UserProfileResource','sendStatus','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','options','includeAll','findAll','rows','catch','show','params','keys','intersection','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'];(function(_0x4adf22,_0x31697b){var _0x7c45ca=function(_0x5218f4){while(--_0x5218f4){_0x4adf22['push'](_0x4adf22['shift']());}};_0x7c45ca(++_0x31697b);}(_0x7d44,0xbc));var _0x47d4=function(_0x1fbf5b,_0x9989eb){_0x1fbf5b=_0x1fbf5b-0x0;var _0x5a01de=_0x7d44[_0x1fbf5b];return _0x5a01de;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x47d4('0x0'));var jsonpatch=require(_0x47d4('0x1'));var rp=require(_0x47d4('0x2'));var moment=require(_0x47d4('0x3'));var BPromise=require(_0x47d4('0x4'));var Mustache=require(_0x47d4('0x5'));var util=require(_0x47d4('0x6'));var path=require(_0x47d4('0x7'));var sox=require(_0x47d4('0x8'));var csv=require(_0x47d4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47d4('0xa'));var _=require(_0x47d4('0xb'));var squel=require(_0x47d4('0xc'));var crypto=require(_0x47d4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x47d4('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47d4('0xf'));var authService=require(_0x47d4('0x10'));var qs=require(_0x47d4('0x11'));var as=require(_0x47d4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47d4('0x13'))(_0x47d4('0x14'));var utils=require('../../config/utils');var config=require(_0x47d4('0x15'));var licenseUtil=require(_0x47d4('0x16'));var db=require(_0x47d4('0x17'))['db'];config['redis']=_[_0x47d4('0x18')](config[_0x47d4('0x19')],{'host':_0x47d4('0x1a'),'port':0x18eb});var socket=require(_0x47d4('0x1b'))(new Redis(config[_0x47d4('0x19')]));require('./smsQueue.socket')[_0x47d4('0x1c')](socket);function respondWithStatusCode(_0x3e90c7,_0x3aba50){_0x3aba50=_0x3aba50||0xcc;return function(_0x1324d8){if(_0x1324d8){return _0x3e90c7['sendStatus'](_0x3aba50);}return _0x3e90c7[_0x47d4('0x1d')](_0x3aba50)[_0x47d4('0x1e')]();};}function respondWithResult(_0x32499b,_0x2864e5){_0x2864e5=_0x2864e5||0xc8;return function(_0x468e73){if(_0x468e73){return _0x32499b[_0x47d4('0x1d')](_0x2864e5)[_0x47d4('0x1f')](_0x468e73);}};}function respondWithFilteredResult(_0x2130c1,_0x22a825){return function(_0x48dad0){if(_0x48dad0){var _0xe25bb=typeof _0x22a825[_0x47d4('0x20')]===_0x47d4('0x21')&&typeof _0x22a825['limit']===_0x47d4('0x21');var _0x76847b=_0x48dad0[_0x47d4('0x22')];var _0x11c538=_0xe25bb?0x0:_0x22a825['offset'];var _0x395ceb=_0xe25bb?_0x48dad0[_0x47d4('0x22')]:_0x22a825['offset']+_0x22a825[_0x47d4('0x23')];var _0x3dee29;if(_0x395ceb>=_0x76847b){_0x395ceb=_0x76847b;_0x3dee29=0xc8;}else{_0x3dee29=0xce;}_0x2130c1[_0x47d4('0x1d')](_0x3dee29);return _0x2130c1[_0x47d4('0x24')]('Content-Range',_0x11c538+'-'+_0x395ceb+'/'+_0x76847b)['json'](_0x48dad0);}return null;};}function patchUpdates(_0x16558a){return function(_0xe70ad6){try{jsonpatch[_0x47d4('0x25')](_0xe70ad6,_0x16558a,!![]);}catch(_0x5bfd8d){return BPromise[_0x47d4('0x26')](_0x5bfd8d);}return _0xe70ad6[_0x47d4('0x27')]();};}function saveUpdates(_0x54a5a3,_0x487686){return function(_0x4f027a){if(_0x4f027a){return _0x4f027a[_0x47d4('0x28')](_0x54a5a3)['then'](function(_0x14b0bd){return _0x14b0bd;});}return null;};}function removeEntity(_0x313762,_0x4e4639){return function(_0x1f4a39){if(_0x1f4a39){return _0x1f4a39[_0x47d4('0x29')]()[_0x47d4('0x2a')](function(){var _0x526e67=_0x1f4a39[_0x47d4('0x2b')]({'plain':!![]});var _0x393381=_0x47d4('0x2c');return db[_0x47d4('0x2d')][_0x47d4('0x29')]({'where':{'type':_0x393381,'resourceId':_0x526e67['id']}})[_0x47d4('0x2a')](function(){return _0x1f4a39;});})[_0x47d4('0x2a')](function(){_0x313762[_0x47d4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c369f,_0x16133c){return function(_0x3b57f4){if(!_0x3b57f4){_0x3c369f[_0x47d4('0x2e')](0x194);}return _0x3b57f4;};}function handleError(_0x2ae4b0,_0x3684d6){_0x3684d6=_0x3684d6||0x1f4;return function(_0x185eb7){logger['error'](_0x185eb7[_0x47d4('0x2f')]);if(_0x185eb7[_0x47d4('0x30')]){delete _0x185eb7[_0x47d4('0x30')];}_0x2ae4b0[_0x47d4('0x1d')](_0x3684d6)[_0x47d4('0x31')](_0x185eb7);};}exports[_0x47d4('0x32')]=function(_0x5cc539,_0xfea161){var _0x454892={},_0x1c6612={},_0x53b4c7={'count':0x0,'rows':[]};var _0x5727ad=_[_0x47d4('0x33')](db[_0x47d4('0x34')][_0x47d4('0x35')],function(_0x576dfa){return{'name':_0x576dfa[_0x47d4('0x36')],'type':_0x576dfa[_0x47d4('0x37')][_0x47d4('0x38')]};});_0x1c6612[_0x47d4('0x39')]=_[_0x47d4('0x33')](_0x5727ad,'name');_0x1c6612[_0x47d4('0x3a')]=_['keys'](_0x5cc539[_0x47d4('0x3a')]);_0x1c6612[_0x47d4('0x3b')]=_['intersection'](_0x1c6612['model'],_0x1c6612[_0x47d4('0x3a')]);_0x454892[_0x47d4('0x3c')]=_['intersection'](_0x1c6612[_0x47d4('0x39')],qs[_0x47d4('0x3d')](_0x5cc539['query']['fields']));_0x454892['attributes']=_0x454892['attributes']['length']?_0x454892[_0x47d4('0x3c')]:_0x1c6612[_0x47d4('0x39')];if(!_0x5cc539[_0x47d4('0x3a')][_0x47d4('0x3e')]('nolimit')){_0x454892[_0x47d4('0x23')]=qs[_0x47d4('0x23')](_0x5cc539[_0x47d4('0x3a')][_0x47d4('0x23')]);_0x454892[_0x47d4('0x20')]=qs[_0x47d4('0x20')](_0x5cc539['query']['offset']);}_0x454892[_0x47d4('0x3f')]=qs[_0x47d4('0x40')](_0x5cc539['query'][_0x47d4('0x40')]);_0x454892['where']=qs[_0x47d4('0x3b')](_[_0x47d4('0x41')](_0x5cc539['query'],_0x1c6612[_0x47d4('0x3b')]),_0x5727ad);if(_0x5cc539[_0x47d4('0x3a')][_0x47d4('0x42')]){_0x454892['where']=_[_0x47d4('0x43')](_0x454892[_0x47d4('0x44')],{'$or':_[_0x47d4('0x33')](_0x5727ad,function(_0x2ac65d){if(_0x2ac65d[_0x47d4('0x37')]!=='VIRTUAL'){var _0x38272f={};_0x38272f[_0x2ac65d[_0x47d4('0x30')]]={'$like':'%'+_0x5cc539[_0x47d4('0x3a')][_0x47d4('0x42')]+'%'};return _0x38272f;}})});}_0x454892=_['merge']({},_0x454892,_0x5cc539[_0x47d4('0x45')]);var _0x275b47={'where':_0x454892[_0x47d4('0x44')]};return db[_0x47d4('0x34')]['count'](_0x275b47)[_0x47d4('0x2a')](function(_0x152a1a){_0x53b4c7[_0x47d4('0x22')]=_0x152a1a;if(_0x5cc539[_0x47d4('0x3a')][_0x47d4('0x46')]){_0x454892['include']=[{'all':!![]}];}return db[_0x47d4('0x34')][_0x47d4('0x47')](_0x454892);})[_0x47d4('0x2a')](function(_0x4dad0c){_0x53b4c7[_0x47d4('0x48')]=_0x4dad0c;return _0x53b4c7;})[_0x47d4('0x2a')](respondWithFilteredResult(_0xfea161,_0x454892))[_0x47d4('0x49')](handleError(_0xfea161,null));};exports[_0x47d4('0x4a')]=function(_0x1fe791,_0x4e5bdd){var _0x200c65={'raw':!![],'where':{'id':_0x1fe791[_0x47d4('0x4b')]['id']}},_0x13d925={};_0x13d925[_0x47d4('0x39')]=_[_0x47d4('0x4c')](db['SmsQueue'][_0x47d4('0x35')]);_0x13d925[_0x47d4('0x3a')]=_[_0x47d4('0x4c')](_0x1fe791[_0x47d4('0x3a')]);_0x13d925[_0x47d4('0x3b')]=_[_0x47d4('0x4d')](_0x13d925['model'],_0x13d925[_0x47d4('0x3a')]);_0x200c65[_0x47d4('0x3c')]=_[_0x47d4('0x4d')](_0x13d925[_0x47d4('0x39')],qs[_0x47d4('0x3d')](_0x1fe791[_0x47d4('0x3a')][_0x47d4('0x3d')]));_0x200c65[_0x47d4('0x3c')]=_0x200c65['attributes']['length']?_0x200c65[_0x47d4('0x3c')]:_0x13d925[_0x47d4('0x39')];if(_0x1fe791['query'][_0x47d4('0x46')]){_0x200c65['include']=[{'all':!![]}];}_0x200c65=_[_0x47d4('0x43')]({},_0x200c65,_0x1fe791[_0x47d4('0x45')]);return db[_0x47d4('0x34')][_0x47d4('0x4e')](_0x200c65)[_0x47d4('0x2a')](handleEntityNotFound(_0x4e5bdd,null))['then'](respondWithResult(_0x4e5bdd,null))['catch'](handleError(_0x4e5bdd,null));};exports[_0x47d4('0x4f')]=function(_0x2b958a,_0x5262df){return db['SmsQueue'][_0x47d4('0x4f')](_0x2b958a[_0x47d4('0x50')],{})[_0x47d4('0x2a')](function(_0x4d20c3){var _0x35931f=_0x2b958a[_0x47d4('0x51')]['get']({'plain':!![]});if(!_0x35931f)throw new Error(_0x47d4('0x52'));if(_0x35931f[_0x47d4('0x53')]==='user'){var _0x53db13=_0x4d20c3[_0x47d4('0x2b')]({'plain':!![]});var _0x5610bb='SmsQueues';return db[_0x47d4('0x54')][_0x47d4('0x4e')]({'where':{'name':_0x5610bb,'userProfileId':_0x35931f[_0x47d4('0x55')]},'raw':!![]})[_0x47d4('0x2a')](function(_0x7e98cf){if(_0x7e98cf&&_0x7e98cf[_0x47d4('0x56')]===0x0){return db[_0x47d4('0x2d')]['create']({'name':_0x53db13[_0x47d4('0x30')],'resourceId':_0x53db13['id'],'type':_0x7e98cf[_0x47d4('0x30')],'sectionId':_0x7e98cf['id']},{})[_0x47d4('0x2a')](function(){return _0x4d20c3;});}else{return _0x4d20c3;}})[_0x47d4('0x49')](function(_0x4959e5){logger['error'](_0x47d4('0x57'),_0x4959e5);throw _0x4959e5;});}return _0x4d20c3;})['then'](respondWithResult(_0x5262df,0xc9))['catch'](handleError(_0x5262df,null));};exports[_0x47d4('0x28')]=function(_0x272e17,_0x2edd6b){if(_0x272e17[_0x47d4('0x50')]['id']){delete _0x272e17[_0x47d4('0x50')]['id'];}return db['SmsQueue'][_0x47d4('0x4e')]({'where':{'id':_0x272e17[_0x47d4('0x4b')]['id']}})[_0x47d4('0x2a')](handleEntityNotFound(_0x2edd6b,null))[_0x47d4('0x2a')](saveUpdates(_0x272e17[_0x47d4('0x50')],null))[_0x47d4('0x2a')](respondWithResult(_0x2edd6b,null))[_0x47d4('0x49')](handleError(_0x2edd6b,null));};exports[_0x47d4('0x29')]=function(_0x202e6a,_0x4dda29){return db[_0x47d4('0x34')][_0x47d4('0x4e')]({'where':{'id':_0x202e6a['params']['id']}})[_0x47d4('0x2a')](handleEntityNotFound(_0x4dda29,null))[_0x47d4('0x2a')](removeEntity(_0x4dda29,null))['catch'](handleError(_0x4dda29,null));};exports['describe']=function(_0x3a3401,_0x2edd1a){return db['SmsQueue'][_0x47d4('0x58')]()[_0x47d4('0x2a')](respondWithResult(_0x2edd1a,null))[_0x47d4('0x49')](handleError(_0x2edd1a,null));};exports[_0x47d4('0x59')]=function(_0x116a4d,_0x4b55cf,_0x3f9d32){var _0x137993={'raw':!![],'where':{}},_0x3f964b={},_0x6deefb;return db['SmsQueue'][_0x47d4('0x5a')]({'where':{'id':_0x116a4d['params']['id']}})[_0x47d4('0x2a')](handleEntityNotFound(_0x4b55cf,null))['then'](function(_0x324e53){if(_0x324e53){_0x6deefb=_0x324e53[_0x47d4('0x2b')]({'plain':!![]});_0x3f964b[_0x47d4('0x39')]=_[_0x47d4('0x4c')](db['UserSmsQueue'][_0x47d4('0x35')]);_0x3f964b['query']=_['keys'](_0x116a4d[_0x47d4('0x3a')]);_0x3f964b[_0x47d4('0x3b')]=_['intersection'](_0x3f964b[_0x47d4('0x39')],_0x3f964b[_0x47d4('0x3a')]);_0x137993[_0x47d4('0x3c')]=_[_0x47d4('0x4d')](_0x3f964b[_0x47d4('0x39')],qs[_0x47d4('0x3d')](_0x116a4d['query'][_0x47d4('0x3d')]));_0x137993['attributes']=_0x137993['attributes'][_0x47d4('0x5b')]?_0x137993['attributes']:_0x3f964b[_0x47d4('0x39')];if(!_0x116a4d[_0x47d4('0x3a')]['hasOwnProperty']('nolimit')){_0x137993[_0x47d4('0x23')]=qs[_0x47d4('0x23')](_0x116a4d['query']['limit']);_0x137993[_0x47d4('0x20')]=qs[_0x47d4('0x20')](_0x116a4d['query'][_0x47d4('0x20')]);}_0x137993[_0x47d4('0x3f')]=qs[_0x47d4('0x40')](_0x116a4d[_0x47d4('0x3a')][_0x47d4('0x40')]);_0x137993[_0x47d4('0x44')]=qs['filters'](_['pick'](_0x116a4d['query'],_0x3f964b[_0x47d4('0x3b')]));_0x137993[_0x47d4('0x44')][_0x47d4('0x5c')]=_0x324e53['id'];if(_0x116a4d[_0x47d4('0x3a')][_0x47d4('0x42')]){_0x137993['where']=_[_0x47d4('0x43')](_0x137993[_0x47d4('0x44')],{'$or':_[_0x47d4('0x33')](_0x137993['attributes'],function(_0x3375c7){var _0x5ee5c7={};_0x5ee5c7[_0x3375c7]={'$like':'%'+_0x116a4d[_0x47d4('0x3a')][_0x47d4('0x42')]+'%'};return _0x5ee5c7;})});}_0x137993=_[_0x47d4('0x43')]({},_0x137993,_0x116a4d[_0x47d4('0x45')]);return db[_0x47d4('0x5d')]['findAll'](_0x137993);}})[_0x47d4('0x2a')](function(_0x151d48){if(_0x151d48){return db['User'][_0x47d4('0x5e')]({'where':{'id':_[_0x47d4('0x33')](_0x151d48,_0x47d4('0x5f')),'role':_0x47d4('0x60')},'attributes':['id',_0x47d4('0x30'),_0x47d4('0x61'),'updatedAt',_0x47d4('0x62')]});}})[_0x47d4('0x2a')](function(_0x207b21){if(_0x207b21){return{'count':_0x207b21[_0x47d4('0x22')],'rows':_[_0x47d4('0x33')](_0x207b21[_0x47d4('0x48')],function(_0x14fa10){return{'membername':_0x14fa10[_0x47d4('0x30')],'UserId':_0x14fa10['id'],'queue_name':_0x6deefb['name'],'SmsQueueId':_0x6deefb['id'],'interface':util[_0x47d4('0x63')](_0x47d4('0x64'),'SIP',_0x14fa10[_0x47d4('0x30')]),'penalty':0x0,'paused':_0x14fa10[_0x47d4('0x61')],'createdAt':_0x14fa10[_0x47d4('0x62')],'updatedAt':_0x14fa10[_0x47d4('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x47d4('0x2a')](respondWithFilteredResult(_0x4b55cf,_0x137993))[_0x47d4('0x49')](handleError(_0x4b55cf,null));};exports['getTeams']=function(_0xfcf378,_0x1ef7c4,_0x7ba693){var _0x197bae={};var _0x13521a={};var _0x47ed1c;var _0x4794bb;return db['SmsQueue'][_0x47d4('0x5a')]({'where':{'id':_0xfcf378[_0x47d4('0x4b')]['id']}})[_0x47d4('0x2a')](handleEntityNotFound(_0x1ef7c4,null))[_0x47d4('0x2a')](function(_0x17385b){if(_0x17385b){_0x47ed1c=_0x17385b;_0x13521a[_0x47d4('0x39')]=_[_0x47d4('0x4c')](db[_0x47d4('0x66')][_0x47d4('0x35')]);_0x13521a[_0x47d4('0x3a')]=_[_0x47d4('0x4c')](_0xfcf378[_0x47d4('0x3a')]);_0x13521a['filters']=_[_0x47d4('0x4d')](_0x13521a[_0x47d4('0x39')],_0x13521a[_0x47d4('0x3a')]);_0x197bae[_0x47d4('0x3c')]=_[_0x47d4('0x4d')](_0x13521a['model'],qs[_0x47d4('0x3d')](_0xfcf378['query'][_0x47d4('0x3d')]));_0x197bae[_0x47d4('0x3c')]=_0x197bae[_0x47d4('0x3c')][_0x47d4('0x5b')]?_0x197bae[_0x47d4('0x3c')]:_0x13521a['model'];_0x197bae[_0x47d4('0x3f')]=qs[_0x47d4('0x40')](_0xfcf378['query'][_0x47d4('0x40')]);_0x197bae['where']=qs['filters'](_[_0x47d4('0x41')](_0xfcf378[_0x47d4('0x3a')],_0x13521a[_0x47d4('0x3b')]));if(_0xfcf378[_0x47d4('0x3a')][_0x47d4('0x42')]){_0x197bae['where']=_[_0x47d4('0x43')](_0x197bae['where'],{'$or':_[_0x47d4('0x33')](_0x197bae[_0x47d4('0x3c')],function(_0x30105e){var _0x55b512={};_0x55b512[_0x30105e]={'$like':'%'+_0xfcf378[_0x47d4('0x3a')]['filter']+'%'};return _0x55b512;})});}_0x197bae=_[_0x47d4('0x43')]({},_0x197bae,_0xfcf378[_0x47d4('0x45')]);return _0x47ed1c['getTeams'](_0x197bae);}})[_0x47d4('0x2a')](function(_0x220a88){if(_0x220a88){_0x4794bb=_0x220a88[_0x47d4('0x5b')];if(!_0xfcf378[_0x47d4('0x3a')][_0x47d4('0x3e')](_0x47d4('0x67'))){_0x197bae[_0x47d4('0x23')]=qs[_0x47d4('0x23')](_0xfcf378[_0x47d4('0x3a')][_0x47d4('0x23')]);_0x197bae[_0x47d4('0x20')]=qs[_0x47d4('0x20')](_0xfcf378[_0x47d4('0x3a')][_0x47d4('0x20')]);}return _0x47ed1c['getTeams'](_0x197bae);}})['then'](function(_0x1b3e2e){if(_0x1b3e2e){return _0x1b3e2e?{'count':_0x4794bb,'rows':_0x1b3e2e}:null;}})[_0x47d4('0x2a')](respondWithResult(_0x1ef7c4,null))[_0x47d4('0x49')](handleError(_0x1ef7c4,null));};exports['addTeams']=function(_0x3c40e4,_0xf0d25e,_0x1a1936){var _0x47393c=_0x3c40e4[_0x47d4('0x50')][_0x47d4('0x68')];return db[_0x47d4('0x66')]['findAll']({'where':{'id':_0x47393c},'attributes':['id'],'include':[{'model':db[_0x47d4('0x69')],'as':'Agents','attributes':['id',_0x47d4('0x30'),_0x47d4('0x6a'),'voicePause','interface'],'raw':!![]}]})[_0x47d4('0x2a')](function(_0x14b4b1){if(_0x14b4b1){var _0x16a33c=_[_0x47d4('0x6b')](_0x14b4b1,function(_0x5f3957){var _0x5da2e9=_0x5f3957[_0x47d4('0x2b')]({'plain':!![]});return _0x5da2e9[_0x47d4('0x6c')];});return db['SmsQueue']['find']({'where':{'id':_0x3c40e4[_0x47d4('0x4b')]['id']}})[_0x47d4('0x2a')](function(_0x77e10f){return db[_0x47d4('0x6d')][_0x47d4('0x6e')](function(_0x5681b4){return _0x77e10f[_0x47d4('0x6f')](_0x47393c,{'transaction':_0x5681b4})['then'](function(){return BPromise['each'](_0x16a33c,function(_0xd98c31){return db[_0x47d4('0x5d')]['findOrCreate']({'where':{'UserId':_0xd98c31['id'],'SmsQueueId':_0x3c40e4[_0x47d4('0x4b')]['id']},'transaction':_0x5681b4});});})[_0x47d4('0x2a')](function(){_0x16a33c[_0x47d4('0x70')](function(_0x3a6707){socket[_0x47d4('0x71')](_0x47d4('0x72'),{'UserId':_0x3a6707['id'],'SmsQueueId':_0x77e10f['id']});});});});});}})[_0x47d4('0x2a')](respondWithStatusCode(_0xf0d25e,null))[_0x47d4('0x49')](handleError(_0xf0d25e,null));};exports['removeTeams']=function(_0x2a6036,_0x7bf814,_0xc4ad8a){return db[_0x47d4('0x66')]['findAll']({'where':{'id':_0x2a6036[_0x47d4('0x3a')][_0x47d4('0x68')]},'attributes':['id'],'include':[{'model':db[_0x47d4('0x69')],'as':_0x47d4('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x47d4('0x2a')](handleEntityNotFound(_0x7bf814,null))[_0x47d4('0x2a')](function(_0x2377a6){var _0x4346b2=_['map'](_0x2377a6,'id');var _0x2f38c2=[];var _0x3f9c74=[];var _0x4a21d4=squel[_0x47d4('0x73')]();_0x4a21d4[_0x47d4('0x74')](_0x47d4('0x75'))[_0x47d4('0x76')]('team_has_sms_queues','tq')[_0x47d4('0x77')](_0x47d4('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x47d4('0x44')](_0x47d4('0x79'),_0x2a6036[_0x47d4('0x4b')]['id']);for(var _0x2b456c=0x0;_0x2b456c<_0x2377a6[_0x47d4('0x5b')];_0x2b456c+=0x1){let _0x554915=_0x2377a6[_0x2b456c];for(var _0x142fbf=0x0;_0x142fbf<_0x554915[_0x47d4('0x6c')][_0x47d4('0x5b')];_0x142fbf+=0x1){let _0x5c1abd=_0x554915[_0x47d4('0x6c')][_0x142fbf];var _0x486464=_0x4a21d4[_0x47d4('0x7a')]();_0x486464[_0x47d4('0x44')](_0x47d4('0x7b'),_0x5c1abd['id']);_0x3f9c74[_0x47d4('0x7c')](db[_0x47d4('0x6d')][_0x47d4('0x3a')](_0x486464['toString'](),{'type':db[_0x47d4('0x6d')]['QueryTypes'][_0x47d4('0x7d')]})[_0x47d4('0x2a')](function(_0x529120){if(_0x529120[_0x47d4('0x5b')]===0x1){return _0x5c1abd['id'];}else{var _0x491a96=_[_0x47d4('0x7e')](_[_0x47d4('0x33')](_0x529120,'TeamId'),function(_0x377313){return _['includes'](_0x4346b2,_0x377313);});if(_0x491a96){return _0x5c1abd['id'];}}}));}}return BPromise[_0x47d4('0x7f')](_0x3f9c74)[_0x47d4('0x2a')](function(_0x5c2ac9){_0x2f38c2=_(_0x2f38c2)[_0x47d4('0x80')](_0x5c2ac9)[_0x47d4('0x81')]()[_0x47d4('0x82')]();return db['SmsQueue'][_0x47d4('0x4e')]({'where':{'id':_0x2a6036['params']['id']}})[_0x47d4('0x2a')](function(_0x447ba5){return db[_0x47d4('0x6d')]['transaction'](function(_0x279c38){return _0x447ba5[_0x47d4('0x83')](_0x2a6036[_0x47d4('0x3a')][_0x47d4('0x68')],{'transaction':_0x279c38})[_0x47d4('0x2a')](function(){if(!_['isEmpty'](_0x2f38c2)){return _0x447ba5[_0x47d4('0x84')](_0x2f38c2,{'transaction':_0x279c38});}})['then'](function(){_0x2f38c2[_0x47d4('0x70')](function(_0x29f8a7){socket['emit'](_0x47d4('0x85'),{'UserId':_0x29f8a7,'SmsQueueId':_0x447ba5['id']});});});});});});})[_0x47d4('0x2a')](respondWithStatusCode(_0x7bf814,null))[_0x47d4('0x49')](handleError(_0x7bf814,null));};exports[_0x47d4('0x86')]=function(_0xa8d10f,_0xe91279,_0x312c0e){return db['SmsQueue'][_0x47d4('0x4e')]({'where':{'id':_0xa8d10f['params']['id']}})[_0x47d4('0x2a')](handleEntityNotFound(_0xe91279,null))[_0x47d4('0x2a')](function(_0x3dcfb8){if(_0x3dcfb8){return _0x3dcfb8[_0x47d4('0x86')](_0xa8d10f['body']['ids'],_[_0x47d4('0x87')](_0xa8d10f[_0x47d4('0x50')],[_0x47d4('0x68'),'id'])||{})[_0x47d4('0x88')](function(_0x2fe2be){for(var _0x481b04=0x0;_0x481b04<_0xa8d10f[_0x47d4('0x50')][_0x47d4('0x68')][_0x47d4('0x5b')];_0x481b04+=0x1){socket[_0x47d4('0x71')](_0x47d4('0x72'),{'UserId':Number(_0xa8d10f[_0x47d4('0x50')][_0x47d4('0x68')][_0x481b04]),'SmsQueueId':Number(_0xa8d10f[_0x47d4('0x4b')]['id'])});}return _0x2fe2be;});}})[_0x47d4('0x2a')](respondWithResult(_0xe91279,null))['catch'](handleError(_0xe91279,null));};exports[_0x47d4('0x84')]=function(_0x3b0089,_0x19163f,_0x379a45){return db[_0x47d4('0x34')]['find']({'where':{'id':_0x3b0089[_0x47d4('0x4b')]['id']}})[_0x47d4('0x2a')](handleEntityNotFound(_0x19163f,null))[_0x47d4('0x2a')](function(_0x1c97fe){if(_0x1c97fe){return _0x1c97fe[_0x47d4('0x84')](_0x3b0089['query']['ids'])[_0x47d4('0x2a')](function(){if(_[_0x47d4('0x89')](_0x3b0089['query'][_0x47d4('0x68')])){for(var _0x57074e=0x0;_0x57074e<_0x3b0089[_0x47d4('0x3a')][_0x47d4('0x68')][_0x47d4('0x5b')];_0x57074e+=0x1){socket[_0x47d4('0x71')](_0x47d4('0x85'),{'UserId':Number(_0x3b0089['query'][_0x47d4('0x68')][_0x57074e]),'SmsQueueId':Number(_0x3b0089[_0x47d4('0x4b')]['id'])});}}else{socket['emit'](_0x47d4('0x85'),{'UserId':Number(_0x3b0089[_0x47d4('0x3a')][_0x47d4('0x68')]),'SmsQueueId':Number(_0x3b0089['params']['id'])});}});}})[_0x47d4('0x2a')](respondWithStatusCode(_0x19163f,null))['catch'](handleError(_0x19163f,null));};exports['getAgents']=function(_0x1981c3,_0x2b61e1,_0x3fafa3){var _0x2cc5af={};var _0x1ddda6={};var _0x114992;var _0x33d507;return db['SmsQueue'][_0x47d4('0x5a')]({'where':{'id':_0x1981c3[_0x47d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b61e1,null))[_0x47d4('0x2a')](function(_0x5b3a8d){if(_0x5b3a8d){_0x114992=_0x5b3a8d;_0x1ddda6[_0x47d4('0x39')]=_['keys'](db[_0x47d4('0x69')][_0x47d4('0x35')]);_0x1ddda6[_0x47d4('0x3a')]=_['keys'](_0x1981c3[_0x47d4('0x3a')]);_0x1ddda6['filters']=_[_0x47d4('0x4d')](_0x1ddda6[_0x47d4('0x39')],_0x1ddda6[_0x47d4('0x3a')]);_0x2cc5af['attributes']=_[_0x47d4('0x4d')](_0x1ddda6[_0x47d4('0x39')],qs[_0x47d4('0x3d')](_0x1981c3['query'][_0x47d4('0x3d')]));_0x2cc5af[_0x47d4('0x3c')]=_0x2cc5af[_0x47d4('0x3c')][_0x47d4('0x5b')]?_0x2cc5af['attributes']:_0x1ddda6['model'];_0x2cc5af[_0x47d4('0x3f')]=qs[_0x47d4('0x40')](_0x1981c3[_0x47d4('0x3a')]['sort']);_0x2cc5af[_0x47d4('0x44')]=qs['filters'](_[_0x47d4('0x41')](_0x1981c3[_0x47d4('0x3a')],_0x1ddda6[_0x47d4('0x3b')]));if(_0x1981c3[_0x47d4('0x3a')][_0x47d4('0x42')]){_0x2cc5af[_0x47d4('0x44')]=_['merge'](_0x2cc5af[_0x47d4('0x44')],{'$or':_[_0x47d4('0x33')](_0x2cc5af[_0x47d4('0x3c')],function(_0x13f7f8){var _0x1f5662={};_0x1f5662[_0x13f7f8]={'$like':'%'+_0x1981c3['query'][_0x47d4('0x42')]+'%'};return _0x1f5662;})});}_0x2cc5af=_[_0x47d4('0x43')]({},_0x2cc5af,_0x1981c3['options']);return _0x114992[_0x47d4('0x8a')](_0x2cc5af);}})['then'](function(_0x3bcf38){if(_0x3bcf38){_0x33d507=_0x3bcf38[_0x47d4('0x5b')];if(!_0x1981c3[_0x47d4('0x3a')]['hasOwnProperty'](_0x47d4('0x67'))){_0x2cc5af[_0x47d4('0x23')]=qs[_0x47d4('0x23')](_0x1981c3['query']['limit']);_0x2cc5af['offset']=qs[_0x47d4('0x20')](_0x1981c3['query'][_0x47d4('0x20')]);}return _0x114992[_0x47d4('0x8a')](_0x2cc5af);}})['then'](function(_0x9bec58){if(_0x9bec58){return _0x9bec58?{'count':_0x33d507,'rows':_0x9bec58}:null;}})[_0x47d4('0x2a')](respondWithResult(_0x2b61e1,null))[_0x47d4('0x49')](handleError(_0x2b61e1,null));}; \ No newline at end of file +var _0x88b5=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','role','autoAssociation','error','describe','getMembers','findOne','UserSmsQueue','order','pick','SmsQueueId','findAndCountAll','UserId','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','SELECT','every','all','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','spread','isArray','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','get','UserProfileResource','then','sendStatus','stack','name','send','SmsQueue','type','key','model','map','query','keys','filters','intersection'];(function(_0x2063ba,_0x342f8a){var _0x2b09e6=function(_0x422517){while(--_0x422517){_0x2063ba['push'](_0x2063ba['shift']());}};_0x2b09e6(++_0x342f8a);}(_0x88b5,0x167));var _0x588b=function(_0x4cb75a,_0x3afc17){_0x4cb75a=_0x4cb75a-0x0;var _0x19b2e6=_0x88b5[_0x4cb75a];return _0x19b2e6;};'use strict';var emlformat=require(_0x588b('0x0'));var rimraf=require(_0x588b('0x1'));var zipdir=require(_0x588b('0x2'));var jsonpatch=require(_0x588b('0x3'));var rp=require(_0x588b('0x4'));var moment=require(_0x588b('0x5'));var BPromise=require(_0x588b('0x6'));var Mustache=require(_0x588b('0x7'));var util=require(_0x588b('0x8'));var path=require(_0x588b('0x9'));var sox=require(_0x588b('0xa'));var csv=require(_0x588b('0xb'));var ejs=require(_0x588b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x588b('0xd'));var squel=require(_0x588b('0xe'));var crypto=require(_0x588b('0xf'));var jsforce=require(_0x588b('0x10'));var deskjs=require(_0x588b('0x11'));var toCsv=require(_0x588b('0xb'));var querystring=require(_0x588b('0x12'));var Papa=require('papaparse');var Redis=require(_0x588b('0x13'));var authService=require(_0x588b('0x14'));var qs=require(_0x588b('0x15'));var as=require(_0x588b('0x16'));var hardwareService=require(_0x588b('0x17'));var logger=require('../../config/logger')(_0x588b('0x18'));var utils=require(_0x588b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x588b('0x1a'));var db=require(_0x588b('0x1b'))['db'];config[_0x588b('0x1c')]=_[_0x588b('0x1d')](config[_0x588b('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x588b('0x1e'))(new Redis(config[_0x588b('0x1c')]));require(_0x588b('0x1f'))[_0x588b('0x20')](socket);function respondWithStatusCode(_0x150952,_0x521d37){_0x521d37=_0x521d37||0xcc;return function(_0x37faa6){if(_0x37faa6){return _0x150952['sendStatus'](_0x521d37);}return _0x150952[_0x588b('0x21')](_0x521d37)[_0x588b('0x22')]();};}function respondWithResult(_0x2b8ec6,_0x432f1c){_0x432f1c=_0x432f1c||0xc8;return function(_0x14d8ea){if(_0x14d8ea){return _0x2b8ec6['status'](_0x432f1c)[_0x588b('0x23')](_0x14d8ea);}};}function respondWithFilteredResult(_0x9b4e36,_0x278cfb){return function(_0x429b9b){if(_0x429b9b){var _0x20cd17=typeof _0x278cfb[_0x588b('0x24')]==='undefined'&&typeof _0x278cfb['limit']===_0x588b('0x25');var _0x30c002=_0x429b9b[_0x588b('0x26')];var _0x5f387c=_0x20cd17?0x0:_0x278cfb[_0x588b('0x24')];var _0xc0ede9=_0x20cd17?_0x429b9b[_0x588b('0x26')]:_0x278cfb[_0x588b('0x24')]+_0x278cfb[_0x588b('0x27')];var _0x474649;if(_0xc0ede9>=_0x30c002){_0xc0ede9=_0x30c002;_0x474649=0xc8;}else{_0x474649=0xce;}_0x9b4e36[_0x588b('0x21')](_0x474649);return _0x9b4e36[_0x588b('0x28')](_0x588b('0x29'),_0x5f387c+'-'+_0xc0ede9+'/'+_0x30c002)[_0x588b('0x23')](_0x429b9b);}return null;};}function patchUpdates(_0xd65f0e){return function(_0x5685e8){try{jsonpatch[_0x588b('0x2a')](_0x5685e8,_0xd65f0e,!![]);}catch(_0x4eff4e){return BPromise['reject'](_0x4eff4e);}return _0x5685e8['save']();};}function saveUpdates(_0x2e05b3,_0x22b8ec){return function(_0x378a0d){if(_0x378a0d){return _0x378a0d[_0x588b('0x2b')](_0x2e05b3)['then'](function(_0x2723e1){return _0x2723e1;});}return null;};}function removeEntity(_0x595504,_0xcd8e7d){return function(_0x408465){if(_0x408465){return _0x408465[_0x588b('0x2c')]()['then'](function(){var _0x230996=_0x408465[_0x588b('0x2d')]({'plain':!![]});var _0x91cea6='SmsQueues';return db[_0x588b('0x2e')][_0x588b('0x2c')]({'where':{'type':_0x91cea6,'resourceId':_0x230996['id']}})[_0x588b('0x2f')](function(){return _0x408465;});})[_0x588b('0x2f')](function(){_0x595504[_0x588b('0x21')](0xcc)[_0x588b('0x22')]();});}};}function handleEntityNotFound(_0x12bed7,_0x4506c7){return function(_0x35bee6){if(!_0x35bee6){_0x12bed7[_0x588b('0x30')](0x194);}return _0x35bee6;};}function handleError(_0x58543d,_0xd90032){_0xd90032=_0xd90032||0x1f4;return function(_0x5b1b08){logger['error'](_0x5b1b08[_0x588b('0x31')]);if(_0x5b1b08[_0x588b('0x32')]){delete _0x5b1b08[_0x588b('0x32')];}_0x58543d[_0x588b('0x21')](_0xd90032)[_0x588b('0x33')](_0x5b1b08);};}exports['index']=function(_0x4ff34e,_0x5e71a1){var _0x2e5411={},_0x4e50fd={},_0x39ad34={'count':0x0,'rows':[]};var _0x4197e7=_['map'](db[_0x588b('0x34')]['rawAttributes'],function(_0x599292){return{'name':_0x599292['fieldName'],'type':_0x599292[_0x588b('0x35')][_0x588b('0x36')]};});_0x4e50fd[_0x588b('0x37')]=_[_0x588b('0x38')](_0x4197e7,'name');_0x4e50fd[_0x588b('0x39')]=_[_0x588b('0x3a')](_0x4ff34e[_0x588b('0x39')]);_0x4e50fd[_0x588b('0x3b')]=_[_0x588b('0x3c')](_0x4e50fd[_0x588b('0x37')],_0x4e50fd[_0x588b('0x39')]);_0x2e5411[_0x588b('0x3d')]=_['intersection'](_0x4e50fd['model'],qs[_0x588b('0x3e')](_0x4ff34e[_0x588b('0x39')][_0x588b('0x3e')]));_0x2e5411[_0x588b('0x3d')]=_0x2e5411[_0x588b('0x3d')][_0x588b('0x3f')]?_0x2e5411[_0x588b('0x3d')]:_0x4e50fd[_0x588b('0x37')];if(!_0x4ff34e[_0x588b('0x39')][_0x588b('0x40')](_0x588b('0x41'))){_0x2e5411[_0x588b('0x27')]=qs[_0x588b('0x27')](_0x4ff34e[_0x588b('0x39')]['limit']);_0x2e5411[_0x588b('0x24')]=qs[_0x588b('0x24')](_0x4ff34e[_0x588b('0x39')]['offset']);}_0x2e5411['order']=qs[_0x588b('0x42')](_0x4ff34e[_0x588b('0x39')]['sort']);_0x2e5411[_0x588b('0x43')]=qs[_0x588b('0x3b')](_['pick'](_0x4ff34e[_0x588b('0x39')],_0x4e50fd[_0x588b('0x3b')]),_0x4197e7);if(_0x4ff34e['query'][_0x588b('0x44')]){_0x2e5411[_0x588b('0x43')]=_[_0x588b('0x45')](_0x2e5411[_0x588b('0x43')],{'$or':_[_0x588b('0x38')](_0x4197e7,function(_0x547583){if(_0x547583['type']!==_0x588b('0x46')){var _0x423cc1={};_0x423cc1[_0x547583['name']]={'$like':'%'+_0x4ff34e[_0x588b('0x39')][_0x588b('0x44')]+'%'};return _0x423cc1;}})});}_0x2e5411=_[_0x588b('0x45')]({},_0x2e5411,_0x4ff34e[_0x588b('0x47')]);var _0x253c81={'where':_0x2e5411[_0x588b('0x43')]};return db[_0x588b('0x34')]['count'](_0x253c81)[_0x588b('0x2f')](function(_0x42d852){_0x39ad34[_0x588b('0x26')]=_0x42d852;if(_0x4ff34e[_0x588b('0x39')]['includeAll']){_0x2e5411[_0x588b('0x48')]=[{'all':!![]}];}return db[_0x588b('0x34')][_0x588b('0x49')](_0x2e5411);})[_0x588b('0x2f')](function(_0x4e7119){_0x39ad34[_0x588b('0x4a')]=_0x4e7119;return _0x39ad34;})[_0x588b('0x2f')](respondWithFilteredResult(_0x5e71a1,_0x2e5411))[_0x588b('0x4b')](handleError(_0x5e71a1,null));};exports[_0x588b('0x4c')]=function(_0x5c455f,_0x46cb1b){var _0x55814f={'raw':!![],'where':{'id':_0x5c455f[_0x588b('0x4d')]['id']}},_0x568ba4={};_0x568ba4[_0x588b('0x37')]=_[_0x588b('0x3a')](db[_0x588b('0x34')][_0x588b('0x4e')]);_0x568ba4['query']=_['keys'](_0x5c455f[_0x588b('0x39')]);_0x568ba4[_0x588b('0x3b')]=_[_0x588b('0x3c')](_0x568ba4[_0x588b('0x37')],_0x568ba4['query']);_0x55814f[_0x588b('0x3d')]=_[_0x588b('0x3c')](_0x568ba4['model'],qs['fields'](_0x5c455f[_0x588b('0x39')][_0x588b('0x3e')]));_0x55814f[_0x588b('0x3d')]=_0x55814f['attributes'][_0x588b('0x3f')]?_0x55814f[_0x588b('0x3d')]:_0x568ba4[_0x588b('0x37')];if(_0x5c455f[_0x588b('0x39')][_0x588b('0x4f')]){_0x55814f['include']=[{'all':!![]}];}_0x55814f=_[_0x588b('0x45')]({},_0x55814f,_0x5c455f['options']);return db['SmsQueue'][_0x588b('0x50')](_0x55814f)['then'](handleEntityNotFound(_0x46cb1b,null))['then'](respondWithResult(_0x46cb1b,null))[_0x588b('0x4b')](handleError(_0x46cb1b,null));};exports[_0x588b('0x51')]=function(_0x1bc33d,_0x360f58){return db[_0x588b('0x34')][_0x588b('0x51')](_0x1bc33d[_0x588b('0x52')],{})[_0x588b('0x2f')](function(_0x2e1e47){var _0x524efe=_0x1bc33d[_0x588b('0x53')][_0x588b('0x2d')]({'plain':!![]});if(!_0x524efe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x524efe[_0x588b('0x54')]==='user'){var _0x208bec=_0x2e1e47[_0x588b('0x2d')]({'plain':!![]});var _0x4d7269='SmsQueues';return db['UserProfileSection'][_0x588b('0x50')]({'where':{'name':_0x4d7269,'userProfileId':_0x524efe['userProfileId']},'raw':!![]})[_0x588b('0x2f')](function(_0x3003cd){if(_0x3003cd&&_0x3003cd[_0x588b('0x55')]===0x0){return db[_0x588b('0x2e')][_0x588b('0x51')]({'name':_0x208bec[_0x588b('0x32')],'resourceId':_0x208bec['id'],'type':_0x3003cd['name'],'sectionId':_0x3003cd['id']},{})[_0x588b('0x2f')](function(){return _0x2e1e47;});}else{return _0x2e1e47;}})[_0x588b('0x4b')](function(_0x1fa3bb){logger[_0x588b('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fa3bb);throw _0x1fa3bb;});}return _0x2e1e47;})['then'](respondWithResult(_0x360f58,0xc9))[_0x588b('0x4b')](handleError(_0x360f58,null));};exports['update']=function(_0x4f5484,_0x392bd5){if(_0x4f5484[_0x588b('0x52')]['id']){delete _0x4f5484[_0x588b('0x52')]['id'];}return db[_0x588b('0x34')][_0x588b('0x50')]({'where':{'id':_0x4f5484['params']['id']}})[_0x588b('0x2f')](handleEntityNotFound(_0x392bd5,null))[_0x588b('0x2f')](saveUpdates(_0x4f5484[_0x588b('0x52')],null))[_0x588b('0x2f')](respondWithResult(_0x392bd5,null))[_0x588b('0x4b')](handleError(_0x392bd5,null));};exports['destroy']=function(_0x48b7ce,_0x54d5dc){return db[_0x588b('0x34')][_0x588b('0x50')]({'where':{'id':_0x48b7ce[_0x588b('0x4d')]['id']}})[_0x588b('0x2f')](handleEntityNotFound(_0x54d5dc,null))['then'](removeEntity(_0x54d5dc,null))['catch'](handleError(_0x54d5dc,null));};exports[_0x588b('0x57')]=function(_0x284d80,_0x5461ca){return db[_0x588b('0x34')][_0x588b('0x57')]()[_0x588b('0x2f')](respondWithResult(_0x5461ca,null))['catch'](handleError(_0x5461ca,null));};exports[_0x588b('0x58')]=function(_0xfbf247,_0x1ed924,_0x17732f){var _0x8fe64e={'raw':!![],'where':{}},_0x419d5a={},_0x4178de;return db[_0x588b('0x34')][_0x588b('0x59')]({'where':{'id':_0xfbf247[_0x588b('0x4d')]['id']}})[_0x588b('0x2f')](handleEntityNotFound(_0x1ed924,null))[_0x588b('0x2f')](function(_0x3a2716){if(_0x3a2716){_0x4178de=_0x3a2716[_0x588b('0x2d')]({'plain':!![]});_0x419d5a['model']=_[_0x588b('0x3a')](db[_0x588b('0x5a')]['rawAttributes']);_0x419d5a[_0x588b('0x39')]=_['keys'](_0xfbf247[_0x588b('0x39')]);_0x419d5a[_0x588b('0x3b')]=_[_0x588b('0x3c')](_0x419d5a['model'],_0x419d5a[_0x588b('0x39')]);_0x8fe64e[_0x588b('0x3d')]=_[_0x588b('0x3c')](_0x419d5a[_0x588b('0x37')],qs[_0x588b('0x3e')](_0xfbf247[_0x588b('0x39')]['fields']));_0x8fe64e[_0x588b('0x3d')]=_0x8fe64e[_0x588b('0x3d')][_0x588b('0x3f')]?_0x8fe64e[_0x588b('0x3d')]:_0x419d5a['model'];if(!_0xfbf247['query'][_0x588b('0x40')](_0x588b('0x41'))){_0x8fe64e[_0x588b('0x27')]=qs[_0x588b('0x27')](_0xfbf247[_0x588b('0x39')][_0x588b('0x27')]);_0x8fe64e[_0x588b('0x24')]=qs['offset'](_0xfbf247[_0x588b('0x39')][_0x588b('0x24')]);}_0x8fe64e[_0x588b('0x5b')]=qs['sort'](_0xfbf247[_0x588b('0x39')][_0x588b('0x42')]);_0x8fe64e[_0x588b('0x43')]=qs[_0x588b('0x3b')](_[_0x588b('0x5c')](_0xfbf247[_0x588b('0x39')],_0x419d5a[_0x588b('0x3b')]));_0x8fe64e[_0x588b('0x43')][_0x588b('0x5d')]=_0x3a2716['id'];if(_0xfbf247['query'][_0x588b('0x44')]){_0x8fe64e[_0x588b('0x43')]=_[_0x588b('0x45')](_0x8fe64e[_0x588b('0x43')],{'$or':_[_0x588b('0x38')](_0x8fe64e[_0x588b('0x3d')],function(_0x29e10f){var _0xe2cd45={};_0xe2cd45[_0x29e10f]={'$like':'%'+_0xfbf247[_0x588b('0x39')][_0x588b('0x44')]+'%'};return _0xe2cd45;})});}_0x8fe64e=_[_0x588b('0x45')]({},_0x8fe64e,_0xfbf247[_0x588b('0x47')]);return db[_0x588b('0x5a')][_0x588b('0x49')](_0x8fe64e);}})[_0x588b('0x2f')](function(_0x46c6d0){if(_0x46c6d0){return db['User'][_0x588b('0x5e')]({'where':{'id':_[_0x588b('0x38')](_0x46c6d0,_0x588b('0x5f')),'role':_0x588b('0x60')},'attributes':['id','name',_0x588b('0x61'),'updatedAt',_0x588b('0x62')]});}})[_0x588b('0x2f')](function(_0x1cbfe9){if(_0x1cbfe9){return{'count':_0x1cbfe9[_0x588b('0x26')],'rows':_[_0x588b('0x38')](_0x1cbfe9['rows'],function(_0x497485){return{'membername':_0x497485[_0x588b('0x32')],'UserId':_0x497485['id'],'queue_name':_0x4178de[_0x588b('0x32')],'SmsQueueId':_0x4178de['id'],'interface':util[_0x588b('0x63')](_0x588b('0x64'),_0x588b('0x65'),_0x497485[_0x588b('0x32')]),'penalty':0x0,'paused':_0x497485[_0x588b('0x61')],'createdAt':_0x497485['createdAt'],'updatedAt':_0x497485[_0x588b('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ed924,_0x8fe64e))['catch'](handleError(_0x1ed924,null));};exports[_0x588b('0x67')]=function(_0xf6671b,_0x16c2a1,_0xb9cb4){var _0x2f04ef={};var _0x3710b9={};var _0x192cee;var _0x28d684;return db[_0x588b('0x34')][_0x588b('0x59')]({'where':{'id':_0xf6671b[_0x588b('0x4d')]['id']}})[_0x588b('0x2f')](handleEntityNotFound(_0x16c2a1,null))[_0x588b('0x2f')](function(_0x4a279f){if(_0x4a279f){_0x192cee=_0x4a279f;_0x3710b9['model']=_[_0x588b('0x3a')](db[_0x588b('0x68')][_0x588b('0x4e')]);_0x3710b9[_0x588b('0x39')]=_[_0x588b('0x3a')](_0xf6671b[_0x588b('0x39')]);_0x3710b9[_0x588b('0x3b')]=_['intersection'](_0x3710b9[_0x588b('0x37')],_0x3710b9['query']);_0x2f04ef['attributes']=_['intersection'](_0x3710b9[_0x588b('0x37')],qs[_0x588b('0x3e')](_0xf6671b['query'][_0x588b('0x3e')]));_0x2f04ef[_0x588b('0x3d')]=_0x2f04ef[_0x588b('0x3d')][_0x588b('0x3f')]?_0x2f04ef['attributes']:_0x3710b9[_0x588b('0x37')];_0x2f04ef['order']=qs[_0x588b('0x42')](_0xf6671b[_0x588b('0x39')][_0x588b('0x42')]);_0x2f04ef['where']=qs[_0x588b('0x3b')](_[_0x588b('0x5c')](_0xf6671b[_0x588b('0x39')],_0x3710b9[_0x588b('0x3b')]));if(_0xf6671b[_0x588b('0x39')][_0x588b('0x44')]){_0x2f04ef[_0x588b('0x43')]=_[_0x588b('0x45')](_0x2f04ef['where'],{'$or':_[_0x588b('0x38')](_0x2f04ef['attributes'],function(_0x45b8d9){var _0x22e93c={};_0x22e93c[_0x45b8d9]={'$like':'%'+_0xf6671b[_0x588b('0x39')]['filter']+'%'};return _0x22e93c;})});}_0x2f04ef=_[_0x588b('0x45')]({},_0x2f04ef,_0xf6671b[_0x588b('0x47')]);return _0x192cee[_0x588b('0x67')](_0x2f04ef);}})['then'](function(_0x4b07a0){if(_0x4b07a0){_0x28d684=_0x4b07a0[_0x588b('0x3f')];if(!_0xf6671b[_0x588b('0x39')]['hasOwnProperty']('nolimit')){_0x2f04ef[_0x588b('0x27')]=qs[_0x588b('0x27')](_0xf6671b[_0x588b('0x39')][_0x588b('0x27')]);_0x2f04ef[_0x588b('0x24')]=qs[_0x588b('0x24')](_0xf6671b[_0x588b('0x39')][_0x588b('0x24')]);}return _0x192cee[_0x588b('0x67')](_0x2f04ef);}})[_0x588b('0x2f')](function(_0x4212c4){if(_0x4212c4){return _0x4212c4?{'count':_0x28d684,'rows':_0x4212c4}:null;}})['then'](respondWithResult(_0x16c2a1,null))[_0x588b('0x4b')](handleError(_0x16c2a1,null));};exports[_0x588b('0x69')]=function(_0x141717,_0x464837,_0x1bf7fb){var _0x717cf9=_0x141717[_0x588b('0x52')][_0x588b('0x6a')];return db['Team'][_0x588b('0x49')]({'where':{'id':_0x717cf9},'attributes':['id'],'include':[{'model':db[_0x588b('0x6b')],'as':_0x588b('0x6c'),'attributes':['id',_0x588b('0x32'),_0x588b('0x6d'),_0x588b('0x6e'),_0x588b('0x6f')],'raw':!![]}]})[_0x588b('0x2f')](function(_0xf2e293){if(_0xf2e293){var _0x210619=_[_0x588b('0x70')](_0xf2e293,function(_0x40a2b4){var _0x3b3af2=_0x40a2b4[_0x588b('0x2d')]({'plain':!![]});return _0x3b3af2[_0x588b('0x6c')];});return db['SmsQueue'][_0x588b('0x50')]({'where':{'id':_0x141717[_0x588b('0x4d')]['id']}})[_0x588b('0x2f')](function(_0x527bba){return db[_0x588b('0x71')][_0x588b('0x72')](function(_0x309417){return _0x527bba['addTeams'](_0x717cf9,{'transaction':_0x309417})[_0x588b('0x2f')](function(){return BPromise['each'](_0x210619,function(_0xf4893d){return db[_0x588b('0x5a')][_0x588b('0x73')]({'where':{'UserId':_0xf4893d['id'],'SmsQueueId':_0x141717['params']['id']},'transaction':_0x309417});});})[_0x588b('0x2f')](function(){_0x210619['forEach'](function(_0x5329be){socket[_0x588b('0x74')](_0x588b('0x75'),{'UserId':_0x5329be['id'],'SmsQueueId':_0x527bba['id']});});});});});}})['then'](respondWithStatusCode(_0x464837,null))['catch'](handleError(_0x464837,null));};exports[_0x588b('0x76')]=function(_0x57d1d9,_0x3032fd,_0x532533){return db['Team']['findAll']({'where':{'id':_0x57d1d9[_0x588b('0x39')][_0x588b('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x588b('0x6b')],'as':_0x588b('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x588b('0x2f')](handleEntityNotFound(_0x3032fd,null))[_0x588b('0x2f')](function(_0x13eacf){var _0x38ce99=_['map'](_0x13eacf,'id');var _0x4d6482=[];var _0x394d91=[];var _0x552efe=squel['select']();_0x552efe[_0x588b('0x77')](_0x588b('0x78'))[_0x588b('0x79')](_0x588b('0x7a'),'tq')[_0x588b('0x7b')](_0x588b('0x7c'),'ut',_0x588b('0x7d'))[_0x588b('0x43')](_0x588b('0x7e'),_0x57d1d9[_0x588b('0x4d')]['id']);for(var _0x5cf3f5=0x0;_0x5cf3f5<_0x13eacf[_0x588b('0x3f')];_0x5cf3f5+=0x1){let _0x3aa30e=_0x13eacf[_0x5cf3f5];for(var _0x263997=0x0;_0x263997<_0x3aa30e[_0x588b('0x6c')][_0x588b('0x3f')];_0x263997+=0x1){let _0x5d6126=_0x3aa30e[_0x588b('0x6c')][_0x263997];var _0x53e7f1=_0x552efe['clone']();_0x53e7f1[_0x588b('0x43')]('ut.UserId\x20=\x20?',_0x5d6126['id']);_0x394d91[_0x588b('0x7f')](db['sequelize']['query'](_0x53e7f1['toString'](),{'type':db[_0x588b('0x71')]['QueryTypes'][_0x588b('0x80')]})[_0x588b('0x2f')](function(_0x51aa11){if(_0x51aa11['length']===0x1){return _0x5d6126['id'];}else{var _0x279835=_[_0x588b('0x81')](_[_0x588b('0x38')](_0x51aa11,'TeamId'),function(_0xdb465f){return _['includes'](_0x38ce99,_0xdb465f);});if(_0x279835){return _0x5d6126['id'];}}}));}}return BPromise[_0x588b('0x82')](_0x394d91)[_0x588b('0x2f')](function(_0x222193){_0x4d6482=_(_0x4d6482)['union'](_0x222193)['compact']()[_0x588b('0x83')]();return db[_0x588b('0x34')][_0x588b('0x50')]({'where':{'id':_0x57d1d9[_0x588b('0x4d')]['id']}})['then'](function(_0x36db75){return db['sequelize']['transaction'](function(_0x303664){return _0x36db75[_0x588b('0x76')](_0x57d1d9['query'][_0x588b('0x6a')],{'transaction':_0x303664})[_0x588b('0x2f')](function(){if(!_[_0x588b('0x84')](_0x4d6482)){return _0x36db75[_0x588b('0x85')](_0x4d6482,{'transaction':_0x303664});}})['then'](function(){_0x4d6482[_0x588b('0x86')](function(_0x5bb1f5){socket[_0x588b('0x74')](_0x588b('0x87'),{'UserId':_0x5bb1f5,'SmsQueueId':_0x36db75['id']});});});});});});})['then'](respondWithStatusCode(_0x3032fd,null))[_0x588b('0x4b')](handleError(_0x3032fd,null));};exports[_0x588b('0x88')]=function(_0x468ef7,_0x1ae7ce,_0x4082d0){return db['SmsQueue'][_0x588b('0x50')]({'where':{'id':_0x468ef7['params']['id']}})['then'](handleEntityNotFound(_0x1ae7ce,null))['then'](function(_0x226f0a){if(_0x226f0a){return _0x226f0a[_0x588b('0x88')](_0x468ef7['body']['ids'],_['omit'](_0x468ef7[_0x588b('0x52')],[_0x588b('0x6a'),'id'])||{})[_0x588b('0x89')](function(_0x236b02){for(var _0x5d0738=0x0;_0x5d0738<_0x468ef7[_0x588b('0x52')][_0x588b('0x6a')]['length'];_0x5d0738+=0x1){socket[_0x588b('0x74')](_0x588b('0x75'),{'UserId':Number(_0x468ef7[_0x588b('0x52')][_0x588b('0x6a')][_0x5d0738]),'SmsQueueId':Number(_0x468ef7[_0x588b('0x4d')]['id'])});}return _0x236b02;});}})[_0x588b('0x2f')](respondWithResult(_0x1ae7ce,null))['catch'](handleError(_0x1ae7ce,null));};exports['removeAgents']=function(_0x34b1f9,_0x230a44,_0x10f84b){return db[_0x588b('0x34')][_0x588b('0x50')]({'where':{'id':_0x34b1f9[_0x588b('0x4d')]['id']}})[_0x588b('0x2f')](handleEntityNotFound(_0x230a44,null))[_0x588b('0x2f')](function(_0x3a9915){if(_0x3a9915){return _0x3a9915[_0x588b('0x85')](_0x34b1f9['query'][_0x588b('0x6a')])[_0x588b('0x2f')](function(){if(_[_0x588b('0x8a')](_0x34b1f9['query'][_0x588b('0x6a')])){for(var _0xe987aa=0x0;_0xe987aa<_0x34b1f9[_0x588b('0x39')][_0x588b('0x6a')][_0x588b('0x3f')];_0xe987aa+=0x1){socket[_0x588b('0x74')](_0x588b('0x87'),{'UserId':Number(_0x34b1f9[_0x588b('0x39')]['ids'][_0xe987aa]),'SmsQueueId':Number(_0x34b1f9[_0x588b('0x4d')]['id'])});}}else{socket[_0x588b('0x74')]('userSmsQueue:remove',{'UserId':Number(_0x34b1f9[_0x588b('0x39')][_0x588b('0x6a')]),'SmsQueueId':Number(_0x34b1f9['params']['id'])});}});}})[_0x588b('0x2f')](respondWithStatusCode(_0x230a44,null))[_0x588b('0x4b')](handleError(_0x230a44,null));};exports[_0x588b('0x8b')]=function(_0x267056,_0x472daa,_0x78268b){var _0x29f8fe={};var _0x14c4d7={};var _0xc531a5;var _0x4678fd;return db[_0x588b('0x34')][_0x588b('0x59')]({'where':{'id':_0x267056['params']['id']}})['then'](handleEntityNotFound(_0x472daa,null))[_0x588b('0x2f')](function(_0x4d9534){if(_0x4d9534){_0xc531a5=_0x4d9534;_0x14c4d7[_0x588b('0x37')]=_[_0x588b('0x3a')](db[_0x588b('0x6b')]['rawAttributes']);_0x14c4d7[_0x588b('0x39')]=_[_0x588b('0x3a')](_0x267056[_0x588b('0x39')]);_0x14c4d7[_0x588b('0x3b')]=_[_0x588b('0x3c')](_0x14c4d7[_0x588b('0x37')],_0x14c4d7['query']);_0x29f8fe['attributes']=_[_0x588b('0x3c')](_0x14c4d7['model'],qs[_0x588b('0x3e')](_0x267056[_0x588b('0x39')][_0x588b('0x3e')]));_0x29f8fe['attributes']=_0x29f8fe['attributes'][_0x588b('0x3f')]?_0x29f8fe['attributes']:_0x14c4d7[_0x588b('0x37')];_0x29f8fe[_0x588b('0x5b')]=qs[_0x588b('0x42')](_0x267056[_0x588b('0x39')][_0x588b('0x42')]);_0x29f8fe[_0x588b('0x43')]=qs[_0x588b('0x3b')](_[_0x588b('0x5c')](_0x267056['query'],_0x14c4d7[_0x588b('0x3b')]));if(_0x267056[_0x588b('0x39')][_0x588b('0x44')]){_0x29f8fe[_0x588b('0x43')]=_['merge'](_0x29f8fe[_0x588b('0x43')],{'$or':_[_0x588b('0x38')](_0x29f8fe[_0x588b('0x3d')],function(_0xf87ffd){var _0x4657a4={};_0x4657a4[_0xf87ffd]={'$like':'%'+_0x267056[_0x588b('0x39')]['filter']+'%'};return _0x4657a4;})});}_0x29f8fe=_['merge']({},_0x29f8fe,_0x267056[_0x588b('0x47')]);return _0xc531a5[_0x588b('0x8b')](_0x29f8fe);}})[_0x588b('0x2f')](function(_0x512b35){if(_0x512b35){_0x4678fd=_0x512b35[_0x588b('0x3f')];if(!_0x267056['query'][_0x588b('0x40')]('nolimit')){_0x29f8fe[_0x588b('0x27')]=qs[_0x588b('0x27')](_0x267056[_0x588b('0x39')][_0x588b('0x27')]);_0x29f8fe['offset']=qs[_0x588b('0x24')](_0x267056['query'][_0x588b('0x24')]);}return _0xc531a5[_0x588b('0x8b')](_0x29f8fe);}})['then'](function(_0x3279da){if(_0x3279da){return _0x3279da?{'count':_0x4678fd,'rows':_0x3279da}:null;}})['then'](respondWithResult(_0x472daa,null))[_0x588b('0x4b')](handleError(_0x472daa,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index eae3523..6083dfa 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 _0xd63e=['remove','emit','hook','exports','events','../../mysqldb','SmsQueue','save','update'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xd63e,0xaf));var _0xed63=function(_0x550dd8,_0x1068f5){_0x550dd8=_0x550dd8-0x0;var _0x303d68=_0xd63e[_0x550dd8];return _0x303d68;};'use strict';var EventEmitter=require(_0xed63('0x0'));var SmsQueue=require(_0xed63('0x1'))['db'][_0xed63('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed63('0x3'),'afterUpdate':_0xed63('0x4'),'afterDestroy':_0xed63('0x5')};function emitEvent(_0x1f7b3d){return function(_0x4a93aa,_0x3d693e,_0x2f39ef){SmsQueueEvents['emit'](_0x1f7b3d+':'+_0x4a93aa['id'],_0x4a93aa);SmsQueueEvents[_0xed63('0x6')](_0x1f7b3d,_0x4a93aa);_0x2f39ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xed63('0x7')](e,emitEvent(event));}}module[_0xed63('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x987e=['exports','events','../../mysqldb','SmsQueue','save','update','remove','emit','hook'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x987e,0x7f));var _0xe987=function(_0x5a18a1,_0x36eb89){_0x5a18a1=_0x5a18a1-0x0;var _0x47d8b3=_0x987e[_0x5a18a1];return _0x47d8b3;};'use strict';var EventEmitter=require(_0xe987('0x0'));var SmsQueue=require(_0xe987('0x1'))['db'][_0xe987('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe987('0x3'),'afterUpdate':_0xe987('0x4'),'afterDestroy':_0xe987('0x5')};function emitEvent(_0x2202ae){return function(_0x2d1d87,_0x12d64c,_0x246b3a){SmsQueueEvents['emit'](_0x2202ae+':'+_0x2d1d87['id'],_0x2d1d87);SmsQueueEvents[_0xe987('0x6')](_0x2202ae,_0x2d1d87);_0x246b3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xe987('0x7')](e,emitEvent(event));}}module[_0xe987('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index f2566f9..a05eb41 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 _0x915e=['request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2048dd,_0x75156d){var _0x12104e=function(_0x33283b){while(--_0x33283b){_0x2048dd['push'](_0x2048dd['shift']());}};_0x12104e(++_0x75156d);}(_0x915e,0xf7));var _0xe915=function(_0x1e56a6,_0x18e5ba){_0x1e56a6=_0x1e56a6-0x0;var _0x267871=_0x915e[_0x1e56a6];return _0x267871;};'use strict';var _=require(_0xe915('0x0'));var util=require('util');var logger=require(_0xe915('0x1'))(_0xe915('0x2'));var moment=require(_0xe915('0x3'));var BPromise=require(_0xe915('0x4'));var rp=require(_0xe915('0x5'));var fs=require('fs');var path=require(_0xe915('0x6'));var rimraf=require(_0xe915('0x7'));var config=require(_0xe915('0x8'));var attributes=require(_0xe915('0x9'));module[_0xe915('0xa')]=function(_0xc19027,_0x33953b){return _0xc19027[_0xe915('0xb')](_0xe915('0xc'),attributes,{'tableName':_0xe915('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e8c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','SmsQueue'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0x0e8c,0x1e0));var _0xc0e8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0e8c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xc0e8('0x0'));var logger=require(_0xc0e8('0x1'))(_0xc0e8('0x2'));var moment=require(_0xc0e8('0x3'));var BPromise=require(_0xc0e8('0x4'));var rp=require(_0xc0e8('0x5'));var fs=require('fs');var path=require(_0xc0e8('0x6'));var rimraf=require(_0xc0e8('0x7'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0xdacdea,_0x3d726e){return _0xdacdea[_0xc0e8('0x8')](_0xc0e8('0x9'),attributes,{'tableName':'sms_queues','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 611ac74..afa4846 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 _0x1f26=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','request\x20sent','catch','options','raw','where','attributes','limit','include','model','map','debug','GetSmsQueue','ShowSmsQueue','find'];(function(_0x321363,_0x243048){var _0x246525=function(_0x5b4488){while(--_0x5b4488){_0x321363['push'](_0x321363['shift']());}};_0x246525(++_0x243048);}(_0x1f26,0x197));var _0x61f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x61f2('0x0'));var util=require(_0x61f2('0x1'));var moment=require(_0x61f2('0x2'));var BPromise=require(_0x61f2('0x3'));var rs=require(_0x61f2('0x4'));var fs=require('fs');var Redis=require(_0x61f2('0x5'));var db=require(_0x61f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x61f2('0x7'))(_0x61f2('0x8'));var config=require(_0x61f2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x61f2('0xa')]['http']({'port':0x232a});config[_0x61f2('0xb')]=_['defaults'](config['redis'],{'host':_0x61f2('0xc'),'port':0x18eb});var socket=require(_0x61f2('0xd'))(new Redis(config[_0x61f2('0xb')]));require(_0x61f2('0xe'))[_0x61f2('0xf')](socket);function respondWithRpcPromise(_0x22a6f4,_0x249895,_0x3dc52b){return new BPromise(function(_0x1c59e5,_0x213e36){return client[_0x61f2('0x10')](_0x22a6f4,_0x3dc52b)['then'](function(_0x1458d5){logger[_0x61f2('0x11')]('SmsQueue,\x20%s,\x20%s',_0x249895,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x249895,'request\x20sent',JSON[_0x61f2('0x12')](_0x1458d5));if(_0x1458d5[_0x61f2('0x13')]){if(_0x1458d5['error'][_0x61f2('0x14')]===0x1f4){logger['error'](_0x61f2('0x15'),_0x249895,_0x1458d5[_0x61f2('0x13')][_0x61f2('0x16')]);return _0x213e36(_0x1458d5['error'][_0x61f2('0x16')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x249895,_0x1458d5['error']['message']);return _0x1c59e5(_0x1458d5[_0x61f2('0x13')][_0x61f2('0x16')]);}else{logger[_0x61f2('0x11')]('SmsQueue,\x20%s,\x20%s',_0x249895,_0x61f2('0x17'));_0x1c59e5(_0x1458d5['result'][_0x61f2('0x16')]);}})[_0x61f2('0x18')](function(_0x8dd6ce){logger[_0x61f2('0x13')](_0x61f2('0x15'),_0x249895,_0x8dd6ce);_0x213e36(_0x8dd6ce);});});}exports['GetSmsQueue']=function(_0x5a85e7){var _0x234a47=this;return new Promise(function(_0x141438,_0x56c6a8){return db['SmsQueue']['findAll']({'raw':_0x5a85e7['options']?_0x5a85e7[_0x61f2('0x19')][_0x61f2('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a85e7['options']?_0x5a85e7[_0x61f2('0x19')][_0x61f2('0x1b')]||null:null,'attributes':_0x5a85e7['options']?_0x5a85e7[_0x61f2('0x19')][_0x61f2('0x1c')]||null:null,'limit':_0x5a85e7[_0x61f2('0x19')]?_0x5a85e7[_0x61f2('0x19')][_0x61f2('0x1d')]||null:null,'include':_0x5a85e7[_0x61f2('0x19')]?_0x5a85e7[_0x61f2('0x19')][_0x61f2('0x1e')]?_['map'](_0x5a85e7[_0x61f2('0x19')][_0x61f2('0x1e')],function(_0x12d2ea){return{'model':db[_0x12d2ea[_0x61f2('0x1f')]],'as':_0x12d2ea['as'],'attributes':_0x12d2ea['attributes'],'include':_0x12d2ea[_0x61f2('0x1e')]?_[_0x61f2('0x20')](_0x12d2ea[_0x61f2('0x1e')],function(_0x4eab50){return{'model':db[_0x4eab50['model']],'as':_0x4eab50['as'],'attributes':_0x4eab50[_0x61f2('0x1c')],'include':_0x4eab50['include']?_['map'](_0x4eab50[_0x61f2('0x1e')],function(_0x394a07){return{'model':db[_0x394a07[_0x61f2('0x1f')]],'as':_0x394a07['as'],'attributes':_0x394a07[_0x61f2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32a64b){logger['info']('GetSmsQueue',_0x5a85e7);logger[_0x61f2('0x21')](_0x61f2('0x22'),_0x5a85e7,JSON[_0x61f2('0x12')](_0x32a64b));_0x141438(_0x32a64b);})[_0x61f2('0x18')](function(_0x23b345){logger[_0x61f2('0x13')]('GetSmsQueue',_0x23b345[_0x61f2('0x16')],_0x5a85e7);_0x56c6a8(_0x234a47['error'](0x1f4,_0x23b345['message']));});});};exports[_0x61f2('0x23')]=function(_0x1dcd25){var _0x7ab2b7=this;return new Promise(function(_0x2002ed,_0xa55270){return db['SmsQueue'][_0x61f2('0x24')]({'raw':_0x1dcd25[_0x61f2('0x19')]?_0x1dcd25[_0x61f2('0x19')][_0x61f2('0x1a')]===undefined?!![]:![]:!![],'where':_0x1dcd25[_0x61f2('0x19')]?_0x1dcd25[_0x61f2('0x19')]['where']||null:null,'attributes':_0x1dcd25['options']?_0x1dcd25[_0x61f2('0x19')][_0x61f2('0x1c')]||null:null,'include':_0x1dcd25[_0x61f2('0x19')]?_0x1dcd25[_0x61f2('0x19')][_0x61f2('0x1e')]?_[_0x61f2('0x20')](_0x1dcd25['options']['include'],function(_0x1fdf6b){return{'model':db[_0x1fdf6b[_0x61f2('0x1f')]],'as':_0x1fdf6b['as'],'attributes':_0x1fdf6b[_0x61f2('0x1c')],'include':_0x1fdf6b[_0x61f2('0x1e')]?_[_0x61f2('0x20')](_0x1fdf6b[_0x61f2('0x1e')],function(_0x1450d0){return{'model':db[_0x1450d0[_0x61f2('0x1f')]],'as':_0x1450d0['as'],'attributes':_0x1450d0[_0x61f2('0x1c')],'include':_0x1450d0[_0x61f2('0x1e')]?_[_0x61f2('0x20')](_0x1450d0[_0x61f2('0x1e')],function(_0x13f088){return{'model':db[_0x13f088['model']],'as':_0x13f088['as'],'attributes':_0x13f088['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a125c){logger['info'](_0x61f2('0x23'),_0x1dcd25);logger[_0x61f2('0x21')](_0x61f2('0x23'),_0x1dcd25,JSON[_0x61f2('0x12')](_0x1a125c));_0x2002ed(_0x1a125c);})[_0x61f2('0x18')](function(_0x2f562f){logger['error'](_0x61f2('0x23'),_0x2f562f[_0x61f2('0x16')],_0x1dcd25);_0xa55270(_0x7ab2b7[_0x61f2('0x13')](0x1f4,_0x2f562f['message']));});});}; \ No newline at end of file +var _0x7a38=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue'];(function(_0x2652e4,_0x166734){var _0x7a92e8=function(_0x12fbce){while(--_0x12fbce){_0x2652e4['push'](_0x2652e4['shift']());}};_0x7a92e8(++_0x166734);}(_0x7a38,0x1c3));var _0x87a3=function(_0x38c2fb,_0x23937d){_0x38c2fb=_0x38c2fb-0x0;var _0x410d23=_0x7a38[_0x38c2fb];return _0x410d23;};'use strict';var _=require(_0x87a3('0x0'));var util=require(_0x87a3('0x1'));var moment=require(_0x87a3('0x2'));var BPromise=require(_0x87a3('0x3'));var rs=require(_0x87a3('0x4'));var fs=require('fs');var Redis=require(_0x87a3('0x5'));var db=require(_0x87a3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x87a3('0x7'));var config=require(_0x87a3('0x8'));var jayson=require(_0x87a3('0x9'));var client=jayson[_0x87a3('0xa')][_0x87a3('0xb')]({'port':0x232a});config[_0x87a3('0xc')]=_[_0x87a3('0xd')](config[_0x87a3('0xc')],{'host':_0x87a3('0xe'),'port':0x18eb});var socket=require(_0x87a3('0xf'))(new Redis(config[_0x87a3('0xc')]));require(_0x87a3('0x10'))[_0x87a3('0x11')](socket);function respondWithRpcPromise(_0x485042,_0x133e59,_0x3b9d33){return new BPromise(function(_0x418c31,_0x1a2dec){return client['request'](_0x485042,_0x3b9d33)[_0x87a3('0x12')](function(_0x1f10b4){logger[_0x87a3('0x13')](_0x87a3('0x14'),_0x133e59,_0x87a3('0x15'));logger[_0x87a3('0x16')](_0x87a3('0x17'),_0x133e59,_0x87a3('0x15'),JSON[_0x87a3('0x18')](_0x1f10b4));if(_0x1f10b4[_0x87a3('0x19')]){if(_0x1f10b4[_0x87a3('0x19')]['code']===0x1f4){logger['error'](_0x87a3('0x14'),_0x133e59,_0x1f10b4['error'][_0x87a3('0x1a')]);return _0x1a2dec(_0x1f10b4[_0x87a3('0x19')]['message']);}logger['error'](_0x87a3('0x14'),_0x133e59,_0x1f10b4[_0x87a3('0x19')][_0x87a3('0x1a')]);return _0x418c31(_0x1f10b4[_0x87a3('0x19')][_0x87a3('0x1a')]);}else{logger[_0x87a3('0x13')]('SmsQueue,\x20%s,\x20%s',_0x133e59,_0x87a3('0x15'));_0x418c31(_0x1f10b4[_0x87a3('0x1b')][_0x87a3('0x1a')]);}})[_0x87a3('0x1c')](function(_0x4c897f){logger[_0x87a3('0x19')](_0x87a3('0x14'),_0x133e59,_0x4c897f);_0x1a2dec(_0x4c897f);});});}exports[_0x87a3('0x1d')]=function(_0x3f5d13){var _0x12b962=this;return new Promise(function(_0x4461c9,_0x27df1c){return db[_0x87a3('0x1e')][_0x87a3('0x1f')]({'raw':_0x3f5d13[_0x87a3('0x20')]?_0x3f5d13['options'][_0x87a3('0x21')]===undefined?!![]:![]:!![],'where':_0x3f5d13[_0x87a3('0x20')]?_0x3f5d13[_0x87a3('0x20')][_0x87a3('0x22')]||null:null,'attributes':_0x3f5d13[_0x87a3('0x20')]?_0x3f5d13[_0x87a3('0x20')][_0x87a3('0x23')]||null:null,'limit':_0x3f5d13[_0x87a3('0x20')]?_0x3f5d13[_0x87a3('0x20')][_0x87a3('0x24')]||null:null,'include':_0x3f5d13['options']?_0x3f5d13[_0x87a3('0x20')][_0x87a3('0x25')]?_[_0x87a3('0x26')](_0x3f5d13[_0x87a3('0x20')][_0x87a3('0x25')],function(_0x25662a){return{'model':db[_0x25662a['model']],'as':_0x25662a['as'],'attributes':_0x25662a['attributes'],'include':_0x25662a['include']?_[_0x87a3('0x26')](_0x25662a[_0x87a3('0x25')],function(_0x5e59f6){return{'model':db[_0x5e59f6[_0x87a3('0x27')]],'as':_0x5e59f6['as'],'attributes':_0x5e59f6[_0x87a3('0x23')],'include':_0x5e59f6[_0x87a3('0x25')]?_['map'](_0x5e59f6[_0x87a3('0x25')],function(_0x1aaa43){return{'model':db[_0x1aaa43[_0x87a3('0x27')]],'as':_0x1aaa43['as'],'attributes':_0x1aaa43['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a2496){logger[_0x87a3('0x13')]('GetSmsQueue',_0x3f5d13);logger[_0x87a3('0x16')](_0x87a3('0x1d'),_0x3f5d13,JSON['stringify'](_0x5a2496));_0x4461c9(_0x5a2496);})[_0x87a3('0x1c')](function(_0x1a39bb){logger[_0x87a3('0x19')](_0x87a3('0x1d'),_0x1a39bb['message'],_0x3f5d13);_0x27df1c(_0x12b962[_0x87a3('0x19')](0x1f4,_0x1a39bb[_0x87a3('0x1a')]));});});};exports[_0x87a3('0x28')]=function(_0x40ff9f){var _0x298e67=this;return new Promise(function(_0x28e0f9,_0x5df125){return db[_0x87a3('0x1e')]['find']({'raw':_0x40ff9f[_0x87a3('0x20')]?_0x40ff9f[_0x87a3('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x40ff9f[_0x87a3('0x20')]?_0x40ff9f['options']['where']||null:null,'attributes':_0x40ff9f['options']?_0x40ff9f[_0x87a3('0x20')][_0x87a3('0x23')]||null:null,'include':_0x40ff9f['options']?_0x40ff9f['options'][_0x87a3('0x25')]?_[_0x87a3('0x26')](_0x40ff9f['options'][_0x87a3('0x25')],function(_0x4063b0){return{'model':db[_0x4063b0[_0x87a3('0x27')]],'as':_0x4063b0['as'],'attributes':_0x4063b0[_0x87a3('0x23')],'include':_0x4063b0[_0x87a3('0x25')]?_[_0x87a3('0x26')](_0x4063b0[_0x87a3('0x25')],function(_0x39a5d9){return{'model':db[_0x39a5d9[_0x87a3('0x27')]],'as':_0x39a5d9['as'],'attributes':_0x39a5d9[_0x87a3('0x23')],'include':_0x39a5d9[_0x87a3('0x25')]?_['map'](_0x39a5d9['include'],function(_0x563870){return{'model':db[_0x563870[_0x87a3('0x27')]],'as':_0x563870['as'],'attributes':_0x563870[_0x87a3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x87a3('0x12')](function(_0x13d828){logger[_0x87a3('0x13')](_0x87a3('0x28'),_0x40ff9f);logger['debug'](_0x87a3('0x28'),_0x40ff9f,JSON['stringify'](_0x13d828));_0x28e0f9(_0x13d828);})[_0x87a3('0x1c')](function(_0x403c27){logger['error']('ShowSmsQueue',_0x403c27[_0x87a3('0x1a')],_0x40ff9f);_0x5df125(_0x298e67[_0x87a3('0x19')](0x1f4,_0x403c27[_0x87a3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a788c8c..8e66990 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 _0x6058=['remove','update','removeListener','length','smsQueue:','save'];(function(_0x2f3168,_0x230e61){var _0x3be24b=function(_0x1c91b2){while(--_0x1c91b2){_0x2f3168['push'](_0x2f3168['shift']());}};_0x3be24b(++_0x230e61);}(_0x6058,0x1af));var _0x8605=function(_0xec1289,_0x4fa82b){_0xec1289=_0xec1289-0x0;var _0x3e223c=_0x6058[_0xec1289];return _0x3e223c;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x8605('0x0'),_0x8605('0x1'),_0x8605('0x2')];function createListener(_0x5e9f19,_0x5741e5){return function(_0x4a94a7){_0x5741e5['emit'](_0x5e9f19,_0x4a94a7);};}function removeListener(_0x9c0599,_0x3fd3be){return function(){SmsQueueEvents[_0x8605('0x3')](_0x9c0599,_0x3fd3be);};}exports['register']=function(_0x432e64){for(var _0x105f91=0x0,_0x56c989=events[_0x8605('0x4')];_0x105f91<_0x56c989;_0x105f91++){var _0x3a2675=events[_0x105f91];var _0x5283d0=createListener(_0x8605('0x5')+_0x3a2675,_0x432e64);SmsQueueEvents['on'](_0x3a2675,_0x5283d0);}}; \ No newline at end of file +var _0x53f9=['remove','update','emit','removeListener','register','smsQueue:','save'];(function(_0x2d3836,_0x5b8daa){var _0x1e2361=function(_0xe452c5){while(--_0xe452c5){_0x2d3836['push'](_0x2d3836['shift']());}};_0x1e2361(++_0x5b8daa);}(_0x53f9,0x18e));var _0x953f=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x53f9[_0x2235bf];return _0x4c3a64;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x953f('0x0'),_0x953f('0x1'),_0x953f('0x2')];function createListener(_0x44e9ac,_0x4c814c){return function(_0x13fa98){_0x4c814c[_0x953f('0x3')](_0x44e9ac,_0x13fa98);};}function removeListener(_0xa57ee6,_0x3dd6b6){return function(){SmsQueueEvents[_0x953f('0x4')](_0xa57ee6,_0x3dd6b6);};}exports[_0x953f('0x5')]=function(_0x56af2f){for(var _0x40c9b4=0x0,_0x573cc0=events['length'];_0x40c9b4<_0x573cc0;_0x40c9b4++){var _0x2c9df2=events[_0x40c9b4];var _0x2e8838=createListener(_0x953f('0x6')+_0x2c9df2,_0x56af2f);SmsQueueEvents['on'](_0x2c9df2,_0x2e8838);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 487c68f..7d87e17 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 _0x302c=['show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x302c,0x15c));var _0xc302=function(_0x3bf251,_0x17b789){_0x3bf251=_0x3bf251-0x0;var _0x28328b=_0x302c[_0x3bf251];return _0x28328b;};'use strict';var multer=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var path=require(_0xc302('0x2'));var timeout=require(_0xc302('0x3'));var express=require(_0xc302('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc302('0x5'));var interaction=require(_0xc302('0x6'));var config=require(_0xc302('0x7'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xc302('0x8')](),controller['index']);router[_0xc302('0x9')](_0xc302('0xa'),auth[_0xc302('0x8')](),controller[_0xc302('0xb')]);router[_0xc302('0x9')](_0xc302('0xc'),auth['isAuthenticated'](),controller[_0xc302('0xd')]);router[_0xc302('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc302('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc302('0x10')](_0xc302('0xc'),auth[_0xc302('0x8')](),controller[_0xc302('0x11')]);module[_0xc302('0x12')]=router; \ No newline at end of file +var _0xf228=['create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show','post'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0xf228,0x1a9));var _0x8f22=function(_0x6533fc,_0x3a166c){_0x6533fc=_0x6533fc-0x0;var _0x41241d=_0xf228[_0x6533fc];return _0x41241d;};'use strict';var multer=require(_0x8f22('0x0'));var util=require(_0x8f22('0x1'));var path=require('path');var timeout=require(_0x8f22('0x2'));var express=require(_0x8f22('0x3'));var router=express[_0x8f22('0x4')]();var fs_extra=require(_0x8f22('0x5'));var auth=require(_0x8f22('0x6'));var interaction=require(_0x8f22('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x8f22('0x8')]('/',auth['isAuthenticated'](),controller[_0x8f22('0x9')]);router[_0x8f22('0x8')]('/describe',auth[_0x8f22('0xa')](),controller[_0x8f22('0xb')]);router['get'](_0x8f22('0xc'),auth[_0x8f22('0xa')](),controller[_0x8f22('0xd')]);router[_0x8f22('0xe')]('/',auth[_0x8f22('0xa')](),controller[_0x8f22('0xf')]);router[_0x8f22('0x10')](_0x8f22('0xc'),auth['isAuthenticated'](),controller[_0x8f22('0x11')]);router[_0x8f22('0x12')](_0x8f22('0xc'),auth['isAuthenticated'](),controller[_0x8f22('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 8361ee2..e8d30bd 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 _0xeeb8=['sequelize','exports','STRING','DATE'];(function(_0x1c2c56,_0x334d1f){var _0x270d98=function(_0x11d9f2){while(--_0x11d9f2){_0x1c2c56['push'](_0x1c2c56['shift']());}};_0x270d98(++_0x334d1f);}(_0xeeb8,0x168));var _0x8eeb=function(_0x41029c,_0x2c04bb){_0x41029c=_0x41029c-0x0;var _0x280385=_0xeeb8[_0x41029c];return _0x280385;};'use strict';var moment=require('moment');var Sequelize=require(_0x8eeb('0x0'));module[_0x8eeb('0x1')]={'uniqueid':{'type':Sequelize[_0x8eeb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8eeb('0x2')]},'joinAt':{'type':Sequelize[_0x8eeb('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8eeb('0x3')]},'exitAt':{'type':Sequelize[_0x8eeb('0x3')]},'reason':{'type':Sequelize[_0x8eeb('0x2')]}}; \ No newline at end of file +var _0x3a06=['STRING','DATE','exports'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3a06,0x71));var _0x63a0=function(_0x2a8674,_0x313563){_0x2a8674=_0x2a8674-0x0;var _0x35aaff=_0x3a06[_0x2a8674];return _0x35aaff;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x63a0('0x0')]={'uniqueid':{'type':Sequelize[_0x63a0('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x63a0('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x63a0('0x2')]},'exitAt':{'type':Sequelize[_0x63a0('0x2')]},'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 712042f..655fb72 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 _0x4590=['rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','SmsQueueReport'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x4590,0xfc));var _0x0459=function(_0x4beaca,_0x92d420){_0x4beaca=_0x4beaca-0x0;var _0x2febe4=_0x4590[_0x4beaca];return _0x2febe4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0459('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0459('0x1'));var rp=require(_0x0459('0x2'));var moment=require(_0x0459('0x3'));var BPromise=require(_0x0459('0x4'));var Mustache=require('mustache');var util=require(_0x0459('0x5'));var path=require(_0x0459('0x6'));var sox=require(_0x0459('0x7'));var csv=require(_0x0459('0x8'));var ejs=require(_0x0459('0x9'));var fs=require('fs');var fs_extra=require(_0x0459('0xa'));var _=require(_0x0459('0xb'));var squel=require(_0x0459('0xc'));var crypto=require(_0x0459('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0459('0xe'));var toCsv=require(_0x0459('0x8'));var querystring=require(_0x0459('0xf'));var Papa=require(_0x0459('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0459('0x11'));var hardwareService=require(_0x0459('0x12'));var logger=require(_0x0459('0x13'))(_0x0459('0x14'));var utils=require(_0x0459('0x15'));var config=require(_0x0459('0x16'));var licenseUtil=require(_0x0459('0x17'));var db=require(_0x0459('0x18'))['db'];function respondWithStatusCode(_0x4a21ad,_0x5db9b9){_0x5db9b9=_0x5db9b9||0xcc;return function(_0x2dfdd2){if(_0x2dfdd2){return _0x4a21ad['sendStatus'](_0x5db9b9);}return _0x4a21ad[_0x0459('0x19')](_0x5db9b9)['end']();};}function respondWithResult(_0x3fe886,_0x35fb92){_0x35fb92=_0x35fb92||0xc8;return function(_0x343d7a){if(_0x343d7a){return _0x3fe886[_0x0459('0x19')](_0x35fb92)[_0x0459('0x1a')](_0x343d7a);}};}function respondWithFilteredResult(_0x442201,_0x60750b){return function(_0x49f1d2){if(_0x49f1d2){var _0x1d2c98=typeof _0x60750b['offset']===_0x0459('0x1b')&&typeof _0x60750b[_0x0459('0x1c')]===_0x0459('0x1b');var _0x5018f0=_0x49f1d2[_0x0459('0x1d')];var _0x5b590f=_0x1d2c98?0x0:_0x60750b[_0x0459('0x1e')];var _0x53eb93=_0x1d2c98?_0x49f1d2[_0x0459('0x1d')]:_0x60750b[_0x0459('0x1e')]+_0x60750b[_0x0459('0x1c')];var _0x22ba4d;if(_0x53eb93>=_0x5018f0){_0x53eb93=_0x5018f0;_0x22ba4d=0xc8;}else{_0x22ba4d=0xce;}_0x442201[_0x0459('0x19')](_0x22ba4d);return _0x442201['set'](_0x0459('0x1f'),_0x5b590f+'-'+_0x53eb93+'/'+_0x5018f0)[_0x0459('0x1a')](_0x49f1d2);}return null;};}function patchUpdates(_0x1ad4d2){return function(_0x44dd4a){try{jsonpatch[_0x0459('0x20')](_0x44dd4a,_0x1ad4d2,!![]);}catch(_0x5a0516){return BPromise[_0x0459('0x21')](_0x5a0516);}return _0x44dd4a[_0x0459('0x22')]();};}function saveUpdates(_0x2e4c0f,_0x71a14){return function(_0x21a743){if(_0x21a743){return _0x21a743[_0x0459('0x23')](_0x2e4c0f)[_0x0459('0x24')](function(_0x4fd521){return _0x4fd521;});}return null;};}function removeEntity(_0x485ba9,_0x4464c8){return function(_0x3a4954){if(_0x3a4954){return _0x3a4954[_0x0459('0x25')]()['then'](function(){_0x485ba9[_0x0459('0x19')](0xcc)[_0x0459('0x26')]();});}};}function handleEntityNotFound(_0x4f345e,_0x130abf){return function(_0x411135){if(!_0x411135){_0x4f345e['sendStatus'](0x194);}return _0x411135;};}function handleError(_0x1e5276,_0x155c5e){_0x155c5e=_0x155c5e||0x1f4;return function(_0x30a182){logger[_0x0459('0x27')](_0x30a182[_0x0459('0x28')]);if(_0x30a182[_0x0459('0x29')]){delete _0x30a182[_0x0459('0x29')];}_0x1e5276[_0x0459('0x19')](_0x155c5e)['send'](_0x30a182);};}exports[_0x0459('0x2a')]=function(_0x58c58a,_0x54dc0e){var _0x1f612b={},_0x5af183={},_0x39c706={'count':0x0,'rows':[]};var _0x303e02=_['map'](db[_0x0459('0x2b')][_0x0459('0x2c')],function(_0x340850){return{'name':_0x340850[_0x0459('0x2d')],'type':_0x340850[_0x0459('0x2e')][_0x0459('0x2f')]};});_0x5af183['model']=_[_0x0459('0x30')](_0x303e02,_0x0459('0x29'));_0x5af183[_0x0459('0x31')]=_[_0x0459('0x32')](_0x58c58a[_0x0459('0x31')]);_0x5af183[_0x0459('0x33')]=_[_0x0459('0x34')](_0x5af183[_0x0459('0x35')],_0x5af183[_0x0459('0x31')]);_0x1f612b['attributes']=_[_0x0459('0x34')](_0x5af183[_0x0459('0x35')],qs[_0x0459('0x36')](_0x58c58a[_0x0459('0x31')][_0x0459('0x36')]));_0x1f612b[_0x0459('0x37')]=_0x1f612b[_0x0459('0x37')]['length']?_0x1f612b[_0x0459('0x37')]:_0x5af183[_0x0459('0x35')];if(!_0x58c58a['query']['hasOwnProperty']('nolimit')){_0x1f612b[_0x0459('0x1c')]=qs['limit'](_0x58c58a['query'][_0x0459('0x1c')]);_0x1f612b['offset']=qs[_0x0459('0x1e')](_0x58c58a[_0x0459('0x31')][_0x0459('0x1e')]);}_0x1f612b[_0x0459('0x38')]=qs[_0x0459('0x39')](_0x58c58a[_0x0459('0x31')][_0x0459('0x39')]);_0x1f612b[_0x0459('0x3a')]=qs[_0x0459('0x33')](_['pick'](_0x58c58a[_0x0459('0x31')],_0x5af183[_0x0459('0x33')]),_0x303e02);if(_0x58c58a[_0x0459('0x31')][_0x0459('0x3b')]){_0x1f612b['where']=_[_0x0459('0x3c')](_0x1f612b['where'],{'$or':_[_0x0459('0x30')](_0x303e02,function(_0x1bf2a4){if(_0x1bf2a4[_0x0459('0x2e')]!==_0x0459('0x3d')){var _0x332838={};_0x332838[_0x1bf2a4[_0x0459('0x29')]]={'$like':'%'+_0x58c58a[_0x0459('0x31')]['filter']+'%'};return _0x332838;}})});}_0x1f612b=_[_0x0459('0x3c')]({},_0x1f612b,_0x58c58a['options']);var _0x383690={'where':_0x1f612b['where']};return db[_0x0459('0x2b')]['count'](_0x383690)['then'](function(_0x1d066d){_0x39c706['count']=_0x1d066d;if(_0x58c58a[_0x0459('0x31')][_0x0459('0x3e')]){_0x1f612b[_0x0459('0x3f')]=[{'all':!![]}];}return db[_0x0459('0x2b')][_0x0459('0x40')](_0x1f612b);})[_0x0459('0x24')](function(_0x7e4ac6){_0x39c706[_0x0459('0x41')]=_0x7e4ac6;return _0x39c706;})[_0x0459('0x24')](respondWithFilteredResult(_0x54dc0e,_0x1f612b))[_0x0459('0x42')](handleError(_0x54dc0e,null));};exports['show']=function(_0x27d7fc,_0x3ae9ce){var _0xdb4f99={'raw':!![],'where':{'id':_0x27d7fc[_0x0459('0x43')]['id']}},_0x566e03={};_0x566e03[_0x0459('0x35')]=_[_0x0459('0x32')](db[_0x0459('0x2b')][_0x0459('0x2c')]);_0x566e03[_0x0459('0x31')]=_['keys'](_0x27d7fc[_0x0459('0x31')]);_0x566e03[_0x0459('0x33')]=_['intersection'](_0x566e03['model'],_0x566e03[_0x0459('0x31')]);_0xdb4f99[_0x0459('0x37')]=_['intersection'](_0x566e03[_0x0459('0x35')],qs[_0x0459('0x36')](_0x27d7fc[_0x0459('0x31')][_0x0459('0x36')]));_0xdb4f99[_0x0459('0x37')]=_0xdb4f99[_0x0459('0x37')][_0x0459('0x44')]?_0xdb4f99[_0x0459('0x37')]:_0x566e03[_0x0459('0x35')];if(_0x27d7fc['query'][_0x0459('0x3e')]){_0xdb4f99['include']=[{'all':!![]}];}_0xdb4f99=_[_0x0459('0x3c')]({},_0xdb4f99,_0x27d7fc[_0x0459('0x45')]);return db['SmsQueueReport'][_0x0459('0x46')](_0xdb4f99)[_0x0459('0x24')](handleEntityNotFound(_0x3ae9ce,null))[_0x0459('0x24')](respondWithResult(_0x3ae9ce,null))[_0x0459('0x42')](handleError(_0x3ae9ce,null));};exports['create']=function(_0x56e1e4,_0xaff992){return db[_0x0459('0x2b')][_0x0459('0x47')](_0x56e1e4[_0x0459('0x48')],{})[_0x0459('0x24')](respondWithResult(_0xaff992,0xc9))[_0x0459('0x42')](handleError(_0xaff992,null));};exports[_0x0459('0x23')]=function(_0x4a4986,_0x1122e0){if(_0x4a4986[_0x0459('0x48')]['id']){delete _0x4a4986[_0x0459('0x48')]['id'];}return db[_0x0459('0x2b')]['find']({'where':{'id':_0x4a4986[_0x0459('0x43')]['id']}})['then'](handleEntityNotFound(_0x1122e0,null))[_0x0459('0x24')](saveUpdates(_0x4a4986[_0x0459('0x48')],null))[_0x0459('0x24')](respondWithResult(_0x1122e0,null))[_0x0459('0x42')](handleError(_0x1122e0,null));};exports[_0x0459('0x25')]=function(_0x12421d,_0x4006cf){return db[_0x0459('0x2b')][_0x0459('0x46')]({'where':{'id':_0x12421d[_0x0459('0x43')]['id']}})[_0x0459('0x24')](handleEntityNotFound(_0x4006cf,null))[_0x0459('0x24')](removeEntity(_0x4006cf,null))[_0x0459('0x42')](handleError(_0x4006cf,null));};exports[_0x0459('0x49')]=function(_0x321827,_0x3cb0bb){return db[_0x0459('0x2b')][_0x0459('0x49')]()[_0x0459('0x24')](respondWithResult(_0x3cb0bb,null))[_0x0459('0x42')](handleError(_0x3cb0bb,null));}; \ No newline at end of file +var _0xa8ab=['desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','SmsQueueReport','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','body','update','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x21a9cf,_0x51f954){var _0x5d4ba7=function(_0x18d186){while(--_0x18d186){_0x21a9cf['push'](_0x21a9cf['shift']());}};_0x5d4ba7(++_0x51f954);}(_0xa8ab,0x1a3));var _0xba8a=function(_0xe2da76,_0x3f0a96){_0xe2da76=_0xe2da76-0x0;var _0x5d603f=_0xa8ab[_0xe2da76];return _0x5d603f;};'use strict';var emlformat=require(_0xba8a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba8a('0x1'));var rp=require(_0xba8a('0x2'));var moment=require(_0xba8a('0x3'));var BPromise=require(_0xba8a('0x4'));var Mustache=require('mustache');var util=require(_0xba8a('0x5'));var path=require(_0xba8a('0x6'));var sox=require(_0xba8a('0x7'));var csv=require(_0xba8a('0x8'));var ejs=require(_0xba8a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba8a('0xa'));var squel=require(_0xba8a('0xb'));var crypto=require('crypto');var jsforce=require(_0xba8a('0xc'));var deskjs=require(_0xba8a('0xd'));var toCsv=require(_0xba8a('0x8'));var querystring=require(_0xba8a('0xe'));var Papa=require(_0xba8a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba8a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba8a('0x11'));var logger=require(_0xba8a('0x12'))(_0xba8a('0x13'));var utils=require(_0xba8a('0x14'));var config=require(_0xba8a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xba8a('0x16'))['db'];function respondWithStatusCode(_0x5d7fee,_0x986806){_0x986806=_0x986806||0xcc;return function(_0x3209f9){if(_0x3209f9){return _0x5d7fee['sendStatus'](_0x986806);}return _0x5d7fee[_0xba8a('0x17')](_0x986806)[_0xba8a('0x18')]();};}function respondWithResult(_0x5e8e9b,_0x82fb86){_0x82fb86=_0x82fb86||0xc8;return function(_0x353228){if(_0x353228){return _0x5e8e9b[_0xba8a('0x17')](_0x82fb86)[_0xba8a('0x19')](_0x353228);}};}function respondWithFilteredResult(_0x238571,_0x37068d){return function(_0x1085ad){if(_0x1085ad){var _0x8cf62d=typeof _0x37068d[_0xba8a('0x1a')]===_0xba8a('0x1b')&&typeof _0x37068d['limit']===_0xba8a('0x1b');var _0xedf5e8=_0x1085ad[_0xba8a('0x1c')];var _0x218639=_0x8cf62d?0x0:_0x37068d['offset'];var _0x50d9f1=_0x8cf62d?_0x1085ad[_0xba8a('0x1c')]:_0x37068d['offset']+_0x37068d[_0xba8a('0x1d')];var _0x815eb8;if(_0x50d9f1>=_0xedf5e8){_0x50d9f1=_0xedf5e8;_0x815eb8=0xc8;}else{_0x815eb8=0xce;}_0x238571['status'](_0x815eb8);return _0x238571[_0xba8a('0x1e')](_0xba8a('0x1f'),_0x218639+'-'+_0x50d9f1+'/'+_0xedf5e8)[_0xba8a('0x19')](_0x1085ad);}return null;};}function patchUpdates(_0x198606){return function(_0x2572de){try{jsonpatch[_0xba8a('0x20')](_0x2572de,_0x198606,!![]);}catch(_0x3b10fb){return BPromise['reject'](_0x3b10fb);}return _0x2572de[_0xba8a('0x21')]();};}function saveUpdates(_0x141e7b,_0x1684c9){return function(_0x27c1f5){if(_0x27c1f5){return _0x27c1f5['update'](_0x141e7b)[_0xba8a('0x22')](function(_0x4e2f8a){return _0x4e2f8a;});}return null;};}function removeEntity(_0x3b7e57,_0xdf29b5){return function(_0xfcc8){if(_0xfcc8){return _0xfcc8[_0xba8a('0x23')]()[_0xba8a('0x22')](function(){_0x3b7e57[_0xba8a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b304f,_0x54c7bd){return function(_0xff63d1){if(!_0xff63d1){_0x2b304f[_0xba8a('0x24')](0x194);}return _0xff63d1;};}function handleError(_0x288991,_0x39813c){_0x39813c=_0x39813c||0x1f4;return function(_0x1abc4a){logger[_0xba8a('0x25')](_0x1abc4a[_0xba8a('0x26')]);if(_0x1abc4a[_0xba8a('0x27')]){delete _0x1abc4a[_0xba8a('0x27')];}_0x288991['status'](_0x39813c)['send'](_0x1abc4a);};}exports['index']=function(_0x58c282,_0x3197dd){var _0x31c1b2={},_0x5b2c2b={},_0x112f13={'count':0x0,'rows':[]};var _0x3bfbf0=_[_0xba8a('0x28')](db['SmsQueueReport'][_0xba8a('0x29')],function(_0x59471a){return{'name':_0x59471a[_0xba8a('0x2a')],'type':_0x59471a['type'][_0xba8a('0x2b')]};});_0x5b2c2b['model']=_[_0xba8a('0x28')](_0x3bfbf0,_0xba8a('0x27'));_0x5b2c2b[_0xba8a('0x2c')]=_[_0xba8a('0x2d')](_0x58c282[_0xba8a('0x2c')]);_0x5b2c2b[_0xba8a('0x2e')]=_['intersection'](_0x5b2c2b[_0xba8a('0x2f')],_0x5b2c2b[_0xba8a('0x2c')]);_0x31c1b2[_0xba8a('0x30')]=_['intersection'](_0x5b2c2b[_0xba8a('0x2f')],qs[_0xba8a('0x31')](_0x58c282[_0xba8a('0x2c')]['fields']));_0x31c1b2[_0xba8a('0x30')]=_0x31c1b2['attributes'][_0xba8a('0x32')]?_0x31c1b2['attributes']:_0x5b2c2b[_0xba8a('0x2f')];if(!_0x58c282['query']['hasOwnProperty'](_0xba8a('0x33'))){_0x31c1b2[_0xba8a('0x1d')]=qs[_0xba8a('0x1d')](_0x58c282[_0xba8a('0x2c')][_0xba8a('0x1d')]);_0x31c1b2[_0xba8a('0x1a')]=qs[_0xba8a('0x1a')](_0x58c282[_0xba8a('0x2c')][_0xba8a('0x1a')]);}_0x31c1b2['order']=qs[_0xba8a('0x34')](_0x58c282[_0xba8a('0x2c')][_0xba8a('0x34')]);_0x31c1b2[_0xba8a('0x35')]=qs[_0xba8a('0x2e')](_[_0xba8a('0x36')](_0x58c282[_0xba8a('0x2c')],_0x5b2c2b['filters']),_0x3bfbf0);if(_0x58c282[_0xba8a('0x2c')]['filter']){_0x31c1b2[_0xba8a('0x35')]=_[_0xba8a('0x37')](_0x31c1b2[_0xba8a('0x35')],{'$or':_[_0xba8a('0x28')](_0x3bfbf0,function(_0x5d0a95){if(_0x5d0a95[_0xba8a('0x38')]!==_0xba8a('0x39')){var _0x268925={};_0x268925[_0x5d0a95[_0xba8a('0x27')]]={'$like':'%'+_0x58c282[_0xba8a('0x2c')]['filter']+'%'};return _0x268925;}})});}_0x31c1b2=_[_0xba8a('0x37')]({},_0x31c1b2,_0x58c282['options']);var _0x219ce5={'where':_0x31c1b2['where']};return db[_0xba8a('0x3a')][_0xba8a('0x1c')](_0x219ce5)[_0xba8a('0x22')](function(_0x4bfc6b){_0x112f13['count']=_0x4bfc6b;if(_0x58c282[_0xba8a('0x2c')]['includeAll']){_0x31c1b2[_0xba8a('0x3b')]=[{'all':!![]}];}return db[_0xba8a('0x3a')][_0xba8a('0x3c')](_0x31c1b2);})[_0xba8a('0x22')](function(_0x56f1ce){_0x112f13[_0xba8a('0x3d')]=_0x56f1ce;return _0x112f13;})['then'](respondWithFilteredResult(_0x3197dd,_0x31c1b2))[_0xba8a('0x3e')](handleError(_0x3197dd,null));};exports[_0xba8a('0x3f')]=function(_0x3fbb4a,_0x3c84c0){var _0x3a4068={'raw':!![],'where':{'id':_0x3fbb4a[_0xba8a('0x40')]['id']}},_0x2e409f={};_0x2e409f[_0xba8a('0x2f')]=_[_0xba8a('0x2d')](db[_0xba8a('0x3a')][_0xba8a('0x29')]);_0x2e409f['query']=_[_0xba8a('0x2d')](_0x3fbb4a['query']);_0x2e409f[_0xba8a('0x2e')]=_[_0xba8a('0x41')](_0x2e409f[_0xba8a('0x2f')],_0x2e409f[_0xba8a('0x2c')]);_0x3a4068[_0xba8a('0x30')]=_[_0xba8a('0x41')](_0x2e409f[_0xba8a('0x2f')],qs[_0xba8a('0x31')](_0x3fbb4a[_0xba8a('0x2c')][_0xba8a('0x31')]));_0x3a4068[_0xba8a('0x30')]=_0x3a4068['attributes']['length']?_0x3a4068[_0xba8a('0x30')]:_0x2e409f[_0xba8a('0x2f')];if(_0x3fbb4a['query'][_0xba8a('0x42')]){_0x3a4068['include']=[{'all':!![]}];}_0x3a4068=_[_0xba8a('0x37')]({},_0x3a4068,_0x3fbb4a[_0xba8a('0x43')]);return db[_0xba8a('0x3a')][_0xba8a('0x44')](_0x3a4068)[_0xba8a('0x22')](handleEntityNotFound(_0x3c84c0,null))['then'](respondWithResult(_0x3c84c0,null))[_0xba8a('0x3e')](handleError(_0x3c84c0,null));};exports['create']=function(_0x21d73a,_0x47682f){return db['SmsQueueReport']['create'](_0x21d73a[_0xba8a('0x45')],{})[_0xba8a('0x22')](respondWithResult(_0x47682f,0xc9))['catch'](handleError(_0x47682f,null));};exports[_0xba8a('0x46')]=function(_0x5a5a69,_0x1aff3e){if(_0x5a5a69[_0xba8a('0x45')]['id']){delete _0x5a5a69[_0xba8a('0x45')]['id'];}return db[_0xba8a('0x3a')][_0xba8a('0x44')]({'where':{'id':_0x5a5a69[_0xba8a('0x40')]['id']}})[_0xba8a('0x22')](handleEntityNotFound(_0x1aff3e,null))[_0xba8a('0x22')](saveUpdates(_0x5a5a69['body'],null))[_0xba8a('0x22')](respondWithResult(_0x1aff3e,null))['catch'](handleError(_0x1aff3e,null));};exports[_0xba8a('0x23')]=function(_0x48c576,_0x238877){return db[_0xba8a('0x3a')][_0xba8a('0x44')]({'where':{'id':_0x48c576[_0xba8a('0x40')]['id']}})[_0xba8a('0x22')](handleEntityNotFound(_0x238877,null))[_0xba8a('0x22')](removeEntity(_0x238877,null))[_0xba8a('0x3e')](handleError(_0x238877,null));};exports[_0xba8a('0x47')]=function(_0x2068db,_0x527e4e){return db[_0xba8a('0x3a')][_0xba8a('0x47')]()[_0xba8a('0x22')](respondWithResult(_0x527e4e,null))[_0xba8a('0x3e')](handleError(_0x527e4e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 40a120d..54653a6 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x366fa0,_0x4e78ab){var _0x3f1962=function(_0x23f884){while(--_0x23f884){_0x366fa0['push'](_0x366fa0['shift']());}};_0x3f1962(++_0x4e78ab);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xcb91[_0x367361];return _0x195d2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x3dd06d,_0x9e863c){var _0x3a22df=function(_0x37f47d){while(--_0x37f47d){_0x3dd06d['push'](_0x3dd06d['shift']());}};_0x3a22df(++_0x9e863c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 2a6fb12..4d11690 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 _0x2cff=['update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport'];(function(_0x18032f,_0x4f4e45){var _0xb0b2b8=function(_0x563262){while(--_0x563262){_0x18032f['push'](_0x18032f['shift']());}};_0xb0b2b8(++_0x4f4e45);}(_0x2cff,0xd0));var _0xf2cf=function(_0x59f3b0,_0x182830){_0x59f3b0=_0x59f3b0-0x0;var _0x4f5d1c=_0x2cff[_0x59f3b0];return _0x4f5d1c;};'use strict';var _=require(_0xf2cf('0x0'));var util=require(_0xf2cf('0x1'));var moment=require(_0xf2cf('0x2'));var BPromise=require(_0xf2cf('0x3'));var rs=require(_0xf2cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf2cf('0x5'));var logger=require(_0xf2cf('0x6'))(_0xf2cf('0x7'));var config=require(_0xf2cf('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf2cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ddb27,_0x46dd07,_0x4c32bd){return new BPromise(function(_0x2c5d6f,_0x1051d6){return client[_0xf2cf('0xa')](_0x3ddb27,_0x4c32bd)[_0xf2cf('0xb')](function(_0x3e0681){logger[_0xf2cf('0xc')](_0xf2cf('0xd'),_0x46dd07,_0xf2cf('0xe'));logger[_0xf2cf('0xf')](_0xf2cf('0x10'),_0x46dd07,_0xf2cf('0xe'),JSON[_0xf2cf('0x11')](_0x3e0681));if(_0x3e0681[_0xf2cf('0x12')]){if(_0x3e0681['error'][_0xf2cf('0x13')]===0x1f4){logger[_0xf2cf('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x46dd07,_0x3e0681['error'][_0xf2cf('0x14')]);return _0x1051d6(_0x3e0681[_0xf2cf('0x12')]['message']);}logger[_0xf2cf('0x12')](_0xf2cf('0xd'),_0x46dd07,_0x3e0681[_0xf2cf('0x12')]['message']);return _0x2c5d6f(_0x3e0681[_0xf2cf('0x12')][_0xf2cf('0x14')]);}else{logger[_0xf2cf('0xc')](_0xf2cf('0xd'),_0x46dd07,_0xf2cf('0xe'));_0x2c5d6f(_0x3e0681[_0xf2cf('0x15')]['message']);}})[_0xf2cf('0x16')](function(_0x1d88c0){logger[_0xf2cf('0x12')](_0xf2cf('0xd'),_0x46dd07,_0x1d88c0);_0x1051d6(_0x1d88c0);});});}exports['CreateSmsQueueReport']=function(_0x53e96c){var _0x5009e4=this;return new Promise(function(_0x2dfc5a,_0x1bf2a5){return db[_0xf2cf('0x17')][_0xf2cf('0x18')](_0x53e96c[_0xf2cf('0x19')],{'raw':_0x53e96c[_0xf2cf('0x1a')]?_0x53e96c[_0xf2cf('0x1a')][_0xf2cf('0x1b')]===undefined?!![]:![]:!![]})[_0xf2cf('0xb')](function(_0x154cb1){logger['info']('CreateSmsQueueReport',_0x53e96c);logger[_0xf2cf('0xf')]('CreateSmsQueueReport',_0x53e96c,JSON[_0xf2cf('0x11')](_0x154cb1));_0x2dfc5a(_0x154cb1);})[_0xf2cf('0x16')](function(_0x27121b){logger[_0xf2cf('0x12')](_0xf2cf('0x1c'),_0x27121b[_0xf2cf('0x14')],_0x53e96c);_0x1bf2a5(_0x5009e4[_0xf2cf('0x12')](0x1f4,_0x27121b[_0xf2cf('0x14')]));});});};exports[_0xf2cf('0x1d')]=function(_0x5f089b){var _0x2a8ddb=this;return new Promise(function(_0x3a2cd8,_0x553015){return db[_0xf2cf('0x17')][_0xf2cf('0x1e')](_0x5f089b['body'],{'raw':_0x5f089b['options']?_0x5f089b['options'][_0xf2cf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f089b[_0xf2cf('0x1a')]?_0x5f089b[_0xf2cf('0x1a')][_0xf2cf('0x1f')]||null:null,'attributes':_0x5f089b[_0xf2cf('0x1a')]?_0x5f089b[_0xf2cf('0x1a')][_0xf2cf('0x20')]||null:null,'limit':_0x5f089b[_0xf2cf('0x1a')]?_0x5f089b['options'][_0xf2cf('0x21')]||null:null})[_0xf2cf('0xb')](function(_0x339098){logger[_0xf2cf('0xc')](_0xf2cf('0x1d'),_0x5f089b);logger[_0xf2cf('0xf')](_0xf2cf('0x1d'),_0x5f089b,JSON['stringify'](_0x339098));_0x3a2cd8(_0x339098);})[_0xf2cf('0x16')](function(_0xa2a0c9){logger[_0xf2cf('0x12')]('UpdateSmsQueueReport',_0xa2a0c9[_0xf2cf('0x14')],_0x5f089b);_0x553015(_0x2a8ddb['error'](0x1f4,_0xa2a0c9[_0xf2cf('0x14')]));});});}; \ No newline at end of file +var _0x04e1=['debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport'];(function(_0x355002,_0x2a9fb6){var _0x3e9b7c=function(_0x566d55){while(--_0x566d55){_0x355002['push'](_0x355002['shift']());}};_0x3e9b7c(++_0x2a9fb6);}(_0x04e1,0x1cf));var _0x104e=function(_0x1ed9e1,_0x2e8361){_0x1ed9e1=_0x1ed9e1-0x0;var _0x5e04f7=_0x04e1[_0x1ed9e1];return _0x5e04f7;};'use strict';var _=require('lodash');var util=require(_0x104e('0x0'));var moment=require(_0x104e('0x1'));var BPromise=require(_0x104e('0x2'));var rs=require(_0x104e('0x3'));var fs=require('fs');var Redis=require(_0x104e('0x4'));var db=require(_0x104e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x104e('0x6'))('rpc');var config=require(_0x104e('0x7'));var jayson=require(_0x104e('0x8'));var client=jayson[_0x104e('0x9')][_0x104e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a5f2e,_0x1f7fe8,_0x17ca38){return new BPromise(function(_0x927d88,_0xf115cd){return client[_0x104e('0xb')](_0x3a5f2e,_0x17ca38)[_0x104e('0xc')](function(_0x378c88){logger[_0x104e('0xd')](_0x104e('0xe'),_0x1f7fe8,_0x104e('0xf'));logger['debug'](_0x104e('0x10'),_0x1f7fe8,_0x104e('0xf'),JSON[_0x104e('0x11')](_0x378c88));if(_0x378c88[_0x104e('0x12')]){if(_0x378c88[_0x104e('0x12')]['code']===0x1f4){logger[_0x104e('0x12')](_0x104e('0xe'),_0x1f7fe8,_0x378c88['error'][_0x104e('0x13')]);return _0xf115cd(_0x378c88[_0x104e('0x12')]['message']);}logger[_0x104e('0x12')](_0x104e('0xe'),_0x1f7fe8,_0x378c88[_0x104e('0x12')][_0x104e('0x13')]);return _0x927d88(_0x378c88[_0x104e('0x12')][_0x104e('0x13')]);}else{logger['info'](_0x104e('0xe'),_0x1f7fe8,_0x104e('0xf'));_0x927d88(_0x378c88[_0x104e('0x14')]['message']);}})[_0x104e('0x15')](function(_0x1aab6c){logger['error'](_0x104e('0xe'),_0x1f7fe8,_0x1aab6c);_0xf115cd(_0x1aab6c);});});}exports[_0x104e('0x16')]=function(_0x20065b){var _0x537344=this;return new Promise(function(_0x5cecd8,_0x313e92){return db[_0x104e('0x17')]['create'](_0x20065b[_0x104e('0x18')],{'raw':_0x20065b[_0x104e('0x19')]?_0x20065b[_0x104e('0x19')][_0x104e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x414061){logger[_0x104e('0xd')]('CreateSmsQueueReport',_0x20065b);logger['debug'](_0x104e('0x16'),_0x20065b,JSON[_0x104e('0x11')](_0x414061));_0x5cecd8(_0x414061);})[_0x104e('0x15')](function(_0x3a2369){logger[_0x104e('0x12')](_0x104e('0x16'),_0x3a2369['message'],_0x20065b);_0x313e92(_0x537344[_0x104e('0x12')](0x1f4,_0x3a2369[_0x104e('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x2dc512){var _0x3bc289=this;return new Promise(function(_0x57fcb7,_0x2aedef){return db[_0x104e('0x17')][_0x104e('0x1b')](_0x2dc512[_0x104e('0x18')],{'raw':_0x2dc512[_0x104e('0x19')]?_0x2dc512[_0x104e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dc512[_0x104e('0x19')]?_0x2dc512['options'][_0x104e('0x1c')]||null:null,'attributes':_0x2dc512['options']?_0x2dc512['options'][_0x104e('0x1d')]||null:null,'limit':_0x2dc512[_0x104e('0x19')]?_0x2dc512[_0x104e('0x19')][_0x104e('0x1e')]||null:null})['then'](function(_0x4eb7a8){logger[_0x104e('0xd')](_0x104e('0x1f'),_0x2dc512);logger[_0x104e('0x20')]('UpdateSmsQueueReport',_0x2dc512,JSON[_0x104e('0x11')](_0x4eb7a8));_0x57fcb7(_0x4eb7a8);})[_0x104e('0x15')](function(_0x39cfee){logger[_0x104e('0x12')](_0x104e('0x1f'),_0x39cfee[_0x104e('0x13')],_0x2dc512);_0x2aedef(_0x3bc289[_0x104e('0x12')](0x1f4,_0x39cfee['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9d044fc..de45234 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 _0xdd0c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','util','path','connect-timeout','Router'];(function(_0x5e94f2,_0x17404c){var _0x3c96b1=function(_0x346116){while(--_0x346116){_0x5e94f2['push'](_0x5e94f2['shift']());}};_0x3c96b1(++_0x17404c);}(_0xdd0c,0x165));var _0xcdd0=function(_0x5770f6,_0x5503fd){_0x5770f6=_0x5770f6-0x0;var _0x53352b=_0xdd0c[_0x5770f6];return _0x53352b;};'use strict';var multer=require('multer');var util=require(_0xcdd0('0x0'));var path=require(_0xcdd0('0x1'));var timeout=require(_0xcdd0('0x2'));var express=require('express');var router=express[_0xcdd0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcdd0('0x4'));var interaction=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var controller=require(_0xcdd0('0x7'));router[_0xcdd0('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdd0('0x9')]);router[_0xcdd0('0x8')](_0xcdd0('0xa'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xc')]);router['get'](_0xcdd0('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcdd0('0xe')]('/',auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xf')]);router[_0xcdd0('0x10')](_0xcdd0('0xd'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0x11')]);router[_0xcdd0('0x12')](_0xcdd0('0xd'),auth[_0xcdd0('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6b8f=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0xfecbad,_0x5915f8){var _0x5e1806=function(_0x2a46ec){while(--_0x2a46ec){_0xfecbad['push'](_0xfecbad['shift']());}};_0x5e1806(++_0x5915f8);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x39b27f,_0x4afae9){_0x39b27f=_0x39b27f-0x0;var _0x3889c2=_0x6b8f[_0x39b27f];return _0x3889c2;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')](_0xf6b8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 0dc9d9d..7b2160d 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x451742,_0x304ecc){_0x451742=_0x451742-0x0;var _0x420788=_0x9bde[_0x451742];return _0x420788;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x186b9b,_0xd61a0c){var _0x3f9d65=function(_0x547988){while(--_0x547988){_0x186b9b['push'](_0x186b9b['shift']());}};_0x3f9d65(++_0xd61a0c);}(_0xf4eb,0xec));var _0xbf4e=function(_0xc03953,_0x4de6a3){_0xc03953=_0xc03953-0x0;var _0x3f275d=_0xf4eb[_0xc03953];return _0x3f275d;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 17a69a6..780c19e 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 _0x2d39=['then','end','sendStatus','error','stack','send','index','SmsTransferReport','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','reject'];(function(_0x1cd712,_0x18dca5){var _0x5dcf75=function(_0x24b55){while(--_0x24b55){_0x1cd712['push'](_0x1cd712['shift']());}};_0x5dcf75(++_0x18dca5);}(_0x2d39,0x101));var _0x92d3=function(_0x2adfcb,_0x4c49fa){_0x2adfcb=_0x2adfcb-0x0;var _0x5bcbf6=_0x2d39[_0x2adfcb];return _0x5bcbf6;};'use strict';var emlformat=require(_0x92d3('0x0'));var rimraf=require(_0x92d3('0x1'));var zipdir=require(_0x92d3('0x2'));var jsonpatch=require(_0x92d3('0x3'));var rp=require('request-promise');var moment=require(_0x92d3('0x4'));var BPromise=require(_0x92d3('0x5'));var Mustache=require('mustache');var util=require(_0x92d3('0x6'));var path=require('path');var sox=require(_0x92d3('0x7'));var csv=require(_0x92d3('0x8'));var ejs=require(_0x92d3('0x9'));var fs=require('fs');var fs_extra=require(_0x92d3('0xa'));var _=require(_0x92d3('0xb'));var squel=require(_0x92d3('0xc'));var crypto=require(_0x92d3('0xd'));var jsforce=require(_0x92d3('0xe'));var deskjs=require(_0x92d3('0xf'));var toCsv=require(_0x92d3('0x8'));var querystring=require(_0x92d3('0x10'));var Papa=require(_0x92d3('0x11'));var Redis=require(_0x92d3('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x92d3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92d3('0x14'))('api');var utils=require(_0x92d3('0x15'));var config=require(_0x92d3('0x16'));var licenseUtil=require(_0x92d3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53ee5f,_0x2152bc){_0x2152bc=_0x2152bc||0xcc;return function(_0x16bd67){if(_0x16bd67){return _0x53ee5f['sendStatus'](_0x2152bc);}return _0x53ee5f[_0x92d3('0x18')](_0x2152bc)['end']();};}function respondWithResult(_0x3a175b,_0x3d1ab6){_0x3d1ab6=_0x3d1ab6||0xc8;return function(_0x461f47){if(_0x461f47){return _0x3a175b[_0x92d3('0x18')](_0x3d1ab6)[_0x92d3('0x19')](_0x461f47);}};}function respondWithFilteredResult(_0x5c8db3,_0x54c280){return function(_0x370b8e){if(_0x370b8e){var _0x41c541=typeof _0x54c280[_0x92d3('0x1a')]===_0x92d3('0x1b')&&typeof _0x54c280[_0x92d3('0x1c')]==='undefined';var _0x43383e=_0x370b8e['count'];var _0x1ee244=_0x41c541?0x0:_0x54c280[_0x92d3('0x1a')];var _0x36dd1e=_0x41c541?_0x370b8e['count']:_0x54c280[_0x92d3('0x1a')]+_0x54c280[_0x92d3('0x1c')];var _0x1bc31a;if(_0x36dd1e>=_0x43383e){_0x36dd1e=_0x43383e;_0x1bc31a=0xc8;}else{_0x1bc31a=0xce;}_0x5c8db3[_0x92d3('0x18')](_0x1bc31a);return _0x5c8db3[_0x92d3('0x1d')]('Content-Range',_0x1ee244+'-'+_0x36dd1e+'/'+_0x43383e)[_0x92d3('0x19')](_0x370b8e);}return null;};}function patchUpdates(_0x4becb3){return function(_0x49d384){try{jsonpatch['apply'](_0x49d384,_0x4becb3,!![]);}catch(_0xf4770c){return BPromise[_0x92d3('0x1e')](_0xf4770c);}return _0x49d384['save']();};}function saveUpdates(_0x1461c1,_0x51e992){return function(_0x48959c){if(_0x48959c){return _0x48959c['update'](_0x1461c1)[_0x92d3('0x1f')](function(_0x1565ec){return _0x1565ec;});}return null;};}function removeEntity(_0x3819a6,_0x5139c7){return function(_0x21eb57){if(_0x21eb57){return _0x21eb57['destroy']()[_0x92d3('0x1f')](function(){_0x3819a6[_0x92d3('0x18')](0xcc)[_0x92d3('0x20')]();});}};}function handleEntityNotFound(_0x2481bf,_0x3ec980){return function(_0xa8cf74){if(!_0xa8cf74){_0x2481bf[_0x92d3('0x21')](0x194);}return _0xa8cf74;};}function handleError(_0x4177e0,_0x41baa8){_0x41baa8=_0x41baa8||0x1f4;return function(_0x4952aa){logger[_0x92d3('0x22')](_0x4952aa[_0x92d3('0x23')]);if(_0x4952aa['name']){delete _0x4952aa['name'];}_0x4177e0['status'](_0x41baa8)[_0x92d3('0x24')](_0x4952aa);};}exports[_0x92d3('0x25')]=function(_0x80ea06,_0x432d3f){var _0xb492f1={},_0x53f476={},_0x2e90ba={'count':0x0,'rows':[]};var _0x1edc5d=_['map'](db[_0x92d3('0x26')]['rawAttributes'],function(_0x2e7b0c){return{'name':_0x2e7b0c['fieldName'],'type':_0x2e7b0c['type'][_0x92d3('0x27')]};});_0x53f476[_0x92d3('0x28')]=_['map'](_0x1edc5d,_0x92d3('0x29'));_0x53f476[_0x92d3('0x2a')]=_[_0x92d3('0x2b')](_0x80ea06[_0x92d3('0x2a')]);_0x53f476['filters']=_['intersection'](_0x53f476[_0x92d3('0x28')],_0x53f476['query']);_0xb492f1[_0x92d3('0x2c')]=_[_0x92d3('0x2d')](_0x53f476[_0x92d3('0x28')],qs['fields'](_0x80ea06['query'][_0x92d3('0x2e')]));_0xb492f1[_0x92d3('0x2c')]=_0xb492f1['attributes'][_0x92d3('0x2f')]?_0xb492f1[_0x92d3('0x2c')]:_0x53f476[_0x92d3('0x28')];if(!_0x80ea06[_0x92d3('0x2a')][_0x92d3('0x30')]('nolimit')){_0xb492f1[_0x92d3('0x1c')]=qs[_0x92d3('0x1c')](_0x80ea06[_0x92d3('0x2a')][_0x92d3('0x1c')]);_0xb492f1['offset']=qs[_0x92d3('0x1a')](_0x80ea06[_0x92d3('0x2a')][_0x92d3('0x1a')]);}_0xb492f1[_0x92d3('0x31')]=qs[_0x92d3('0x32')](_0x80ea06[_0x92d3('0x2a')]['sort']);_0xb492f1[_0x92d3('0x33')]=qs['filters'](_[_0x92d3('0x34')](_0x80ea06[_0x92d3('0x2a')],_0x53f476['filters']),_0x1edc5d);if(_0x80ea06[_0x92d3('0x2a')][_0x92d3('0x35')]){_0xb492f1[_0x92d3('0x33')]=_['merge'](_0xb492f1['where'],{'$or':_[_0x92d3('0x36')](_0x1edc5d,function(_0x148923){if(_0x148923[_0x92d3('0x37')]!==_0x92d3('0x38')){var _0xe162c3={};_0xe162c3[_0x148923[_0x92d3('0x29')]]={'$like':'%'+_0x80ea06['query'][_0x92d3('0x35')]+'%'};return _0xe162c3;}})});}_0xb492f1=_[_0x92d3('0x39')]({},_0xb492f1,_0x80ea06[_0x92d3('0x3a')]);var _0x348cd8={'where':_0xb492f1[_0x92d3('0x33')]};return db[_0x92d3('0x26')][_0x92d3('0x3b')](_0x348cd8)[_0x92d3('0x1f')](function(_0x3b1b4c){_0x2e90ba[_0x92d3('0x3b')]=_0x3b1b4c;if(_0x80ea06[_0x92d3('0x2a')][_0x92d3('0x3c')]){_0xb492f1[_0x92d3('0x3d')]=[{'all':!![]}];}return db[_0x92d3('0x26')][_0x92d3('0x3e')](_0xb492f1);})[_0x92d3('0x1f')](function(_0x434882){_0x2e90ba[_0x92d3('0x3f')]=_0x434882;return _0x2e90ba;})[_0x92d3('0x1f')](respondWithFilteredResult(_0x432d3f,_0xb492f1))[_0x92d3('0x40')](handleError(_0x432d3f,null));};exports[_0x92d3('0x41')]=function(_0x382b63,_0x1c141c){var _0x3a9f2f={'raw':!![],'where':{'id':_0x382b63['params']['id']}},_0x131d75={};_0x131d75[_0x92d3('0x28')]=_[_0x92d3('0x2b')](db['SmsTransferReport']['rawAttributes']);_0x131d75[_0x92d3('0x2a')]=_[_0x92d3('0x2b')](_0x382b63[_0x92d3('0x2a')]);_0x131d75['filters']=_[_0x92d3('0x2d')](_0x131d75['model'],_0x131d75['query']);_0x3a9f2f[_0x92d3('0x2c')]=_[_0x92d3('0x2d')](_0x131d75[_0x92d3('0x28')],qs[_0x92d3('0x2e')](_0x382b63['query'][_0x92d3('0x2e')]));_0x3a9f2f['attributes']=_0x3a9f2f['attributes']['length']?_0x3a9f2f[_0x92d3('0x2c')]:_0x131d75[_0x92d3('0x28')];if(_0x382b63[_0x92d3('0x2a')][_0x92d3('0x3c')]){_0x3a9f2f[_0x92d3('0x3d')]=[{'all':!![]}];}_0x3a9f2f=_[_0x92d3('0x39')]({},_0x3a9f2f,_0x382b63[_0x92d3('0x3a')]);return db[_0x92d3('0x26')][_0x92d3('0x42')](_0x3a9f2f)[_0x92d3('0x1f')](handleEntityNotFound(_0x1c141c,null))[_0x92d3('0x1f')](respondWithResult(_0x1c141c,null))['catch'](handleError(_0x1c141c,null));};exports['create']=function(_0x1802b9,_0x66f831){return db[_0x92d3('0x26')][_0x92d3('0x43')](_0x1802b9[_0x92d3('0x44')],{})['then'](respondWithResult(_0x66f831,0xc9))[_0x92d3('0x40')](handleError(_0x66f831,null));};exports['update']=function(_0x2668e4,_0x49cda9){if(_0x2668e4[_0x92d3('0x44')]['id']){delete _0x2668e4['body']['id'];}return db[_0x92d3('0x26')][_0x92d3('0x42')]({'where':{'id':_0x2668e4[_0x92d3('0x45')]['id']}})['then'](handleEntityNotFound(_0x49cda9,null))['then'](saveUpdates(_0x2668e4[_0x92d3('0x44')],null))[_0x92d3('0x1f')](respondWithResult(_0x49cda9,null))['catch'](handleError(_0x49cda9,null));};exports[_0x92d3('0x46')]=function(_0x4f1ebe,_0x4b37de){return db[_0x92d3('0x26')][_0x92d3('0x42')]({'where':{'id':_0x4f1ebe[_0x92d3('0x45')]['id']}})[_0x92d3('0x1f')](handleEntityNotFound(_0x4b37de,null))[_0x92d3('0x1f')](removeEntity(_0x4b37de,null))[_0x92d3('0x40')](handleError(_0x4b37de,null));};exports[_0x92d3('0x47')]=function(_0x2c562c,_0x355ff0){return db[_0x92d3('0x26')]['describe']()[_0x92d3('0x1f')](respondWithResult(_0x355ff0,null))[_0x92d3('0x40')](handleError(_0x355ff0,null));}; \ No newline at end of file +var _0xbb4b=['create','body','params','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','rawAttributes','find'];(function(_0x4de184,_0x4d6f6a){var _0x18b63b=function(_0x331708){while(--_0x331708){_0x4de184['push'](_0x4de184['shift']());}};_0x18b63b(++_0x4d6f6a);}(_0xbb4b,0x1b4));var _0xbbb4=function(_0x582b72,_0x439510){_0x582b72=_0x582b72-0x0;var _0x197b03=_0xbb4b[_0x582b72];return _0x197b03;};'use strict';var emlformat=require(_0xbbb4('0x0'));var rimraf=require(_0xbbb4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbbb4('0x2'));var moment=require(_0xbbb4('0x3'));var BPromise=require(_0xbbb4('0x4'));var Mustache=require('mustache');var util=require(_0xbbb4('0x5'));var path=require(_0xbbb4('0x6'));var sox=require(_0xbbb4('0x7'));var csv=require(_0xbbb4('0x8'));var ejs=require(_0xbbb4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbbb4('0xa'));var crypto=require(_0xbbb4('0xb'));var jsforce=require(_0xbbb4('0xc'));var deskjs=require(_0xbbb4('0xd'));var toCsv=require(_0xbbb4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbbb4('0xe'));var as=require(_0xbbb4('0xf'));var hardwareService=require(_0xbbb4('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbbb4('0x11'));var config=require(_0xbbb4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbb4('0x13'))['db'];function respondWithStatusCode(_0x5b2d3c,_0x269653){_0x269653=_0x269653||0xcc;return function(_0x3ba519){if(_0x3ba519){return _0x5b2d3c[_0xbbb4('0x14')](_0x269653);}return _0x5b2d3c['status'](_0x269653)['end']();};}function respondWithResult(_0x404079,_0x13b7ea){_0x13b7ea=_0x13b7ea||0xc8;return function(_0x35fb35){if(_0x35fb35){return _0x404079['status'](_0x13b7ea)[_0xbbb4('0x15')](_0x35fb35);}};}function respondWithFilteredResult(_0x4948a6,_0x22c46a){return function(_0x206ca9){if(_0x206ca9){var _0x51a05a=typeof _0x22c46a[_0xbbb4('0x16')]===_0xbbb4('0x17')&&typeof _0x22c46a[_0xbbb4('0x18')]===_0xbbb4('0x17');var _0x54ae71=_0x206ca9[_0xbbb4('0x19')];var _0x284ead=_0x51a05a?0x0:_0x22c46a['offset'];var _0xf608f8=_0x51a05a?_0x206ca9['count']:_0x22c46a[_0xbbb4('0x16')]+_0x22c46a[_0xbbb4('0x18')];var _0x4cdf49;if(_0xf608f8>=_0x54ae71){_0xf608f8=_0x54ae71;_0x4cdf49=0xc8;}else{_0x4cdf49=0xce;}_0x4948a6[_0xbbb4('0x1a')](_0x4cdf49);return _0x4948a6[_0xbbb4('0x1b')](_0xbbb4('0x1c'),_0x284ead+'-'+_0xf608f8+'/'+_0x54ae71)[_0xbbb4('0x15')](_0x206ca9);}return null;};}function patchUpdates(_0x18e898){return function(_0x312acd){try{jsonpatch[_0xbbb4('0x1d')](_0x312acd,_0x18e898,!![]);}catch(_0x58f45b){return BPromise[_0xbbb4('0x1e')](_0x58f45b);}return _0x312acd['save']();};}function saveUpdates(_0x403053,_0x1bcc21){return function(_0x55597b){if(_0x55597b){return _0x55597b[_0xbbb4('0x1f')](_0x403053)[_0xbbb4('0x20')](function(_0x274bf2){return _0x274bf2;});}return null;};}function removeEntity(_0x3ff097,_0x250649){return function(_0x5554ba){if(_0x5554ba){return _0x5554ba[_0xbbb4('0x21')]()[_0xbbb4('0x20')](function(){_0x3ff097[_0xbbb4('0x1a')](0xcc)[_0xbbb4('0x22')]();});}};}function handleEntityNotFound(_0x255e1f,_0x1e39c8){return function(_0x38eafe){if(!_0x38eafe){_0x255e1f[_0xbbb4('0x14')](0x194);}return _0x38eafe;};}function handleError(_0x7f88c7,_0xc8f157){_0xc8f157=_0xc8f157||0x1f4;return function(_0x326cd4){logger[_0xbbb4('0x23')](_0x326cd4[_0xbbb4('0x24')]);if(_0x326cd4[_0xbbb4('0x25')]){delete _0x326cd4[_0xbbb4('0x25')];}_0x7f88c7['status'](_0xc8f157)['send'](_0x326cd4);};}exports[_0xbbb4('0x26')]=function(_0x21e629,_0x3cf3c1){var _0x1bda74={},_0x4a4557={},_0x136773={'count':0x0,'rows':[]};var _0x5c00b4=_[_0xbbb4('0x27')](db[_0xbbb4('0x28')]['rawAttributes'],function(_0x5765d5){return{'name':_0x5765d5[_0xbbb4('0x29')],'type':_0x5765d5[_0xbbb4('0x2a')][_0xbbb4('0x2b')]};});_0x4a4557[_0xbbb4('0x2c')]=_[_0xbbb4('0x27')](_0x5c00b4,'name');_0x4a4557[_0xbbb4('0x2d')]=_[_0xbbb4('0x2e')](_0x21e629[_0xbbb4('0x2d')]);_0x4a4557[_0xbbb4('0x2f')]=_[_0xbbb4('0x30')](_0x4a4557[_0xbbb4('0x2c')],_0x4a4557[_0xbbb4('0x2d')]);_0x1bda74[_0xbbb4('0x31')]=_['intersection'](_0x4a4557[_0xbbb4('0x2c')],qs[_0xbbb4('0x32')](_0x21e629[_0xbbb4('0x2d')][_0xbbb4('0x32')]));_0x1bda74[_0xbbb4('0x31')]=_0x1bda74[_0xbbb4('0x31')][_0xbbb4('0x33')]?_0x1bda74[_0xbbb4('0x31')]:_0x4a4557[_0xbbb4('0x2c')];if(!_0x21e629[_0xbbb4('0x2d')]['hasOwnProperty'](_0xbbb4('0x34'))){_0x1bda74['limit']=qs[_0xbbb4('0x18')](_0x21e629[_0xbbb4('0x2d')][_0xbbb4('0x18')]);_0x1bda74['offset']=qs[_0xbbb4('0x16')](_0x21e629[_0xbbb4('0x2d')][_0xbbb4('0x16')]);}_0x1bda74[_0xbbb4('0x35')]=qs[_0xbbb4('0x36')](_0x21e629[_0xbbb4('0x2d')][_0xbbb4('0x36')]);_0x1bda74[_0xbbb4('0x37')]=qs[_0xbbb4('0x2f')](_[_0xbbb4('0x38')](_0x21e629['query'],_0x4a4557['filters']),_0x5c00b4);if(_0x21e629['query'][_0xbbb4('0x39')]){_0x1bda74[_0xbbb4('0x37')]=_['merge'](_0x1bda74[_0xbbb4('0x37')],{'$or':_[_0xbbb4('0x27')](_0x5c00b4,function(_0xee8adb){if(_0xee8adb[_0xbbb4('0x2a')]!==_0xbbb4('0x3a')){var _0x42da0e={};_0x42da0e[_0xee8adb[_0xbbb4('0x25')]]={'$like':'%'+_0x21e629[_0xbbb4('0x2d')][_0xbbb4('0x39')]+'%'};return _0x42da0e;}})});}_0x1bda74=_[_0xbbb4('0x3b')]({},_0x1bda74,_0x21e629[_0xbbb4('0x3c')]);var _0x1991a3={'where':_0x1bda74[_0xbbb4('0x37')]};return db[_0xbbb4('0x28')][_0xbbb4('0x19')](_0x1991a3)['then'](function(_0x2976af){_0x136773[_0xbbb4('0x19')]=_0x2976af;if(_0x21e629[_0xbbb4('0x2d')][_0xbbb4('0x3d')]){_0x1bda74[_0xbbb4('0x3e')]=[{'all':!![]}];}return db[_0xbbb4('0x28')]['findAll'](_0x1bda74);})[_0xbbb4('0x20')](function(_0x2ed13b){_0x136773[_0xbbb4('0x3f')]=_0x2ed13b;return _0x136773;})[_0xbbb4('0x20')](respondWithFilteredResult(_0x3cf3c1,_0x1bda74))[_0xbbb4('0x40')](handleError(_0x3cf3c1,null));};exports[_0xbbb4('0x41')]=function(_0x5e3173,_0x7c8fce){var _0x958654={'raw':!![],'where':{'id':_0x5e3173['params']['id']}},_0x8b002c={};_0x8b002c[_0xbbb4('0x2c')]=_['keys'](db[_0xbbb4('0x28')][_0xbbb4('0x42')]);_0x8b002c[_0xbbb4('0x2d')]=_['keys'](_0x5e3173['query']);_0x8b002c[_0xbbb4('0x2f')]=_[_0xbbb4('0x30')](_0x8b002c[_0xbbb4('0x2c')],_0x8b002c['query']);_0x958654[_0xbbb4('0x31')]=_['intersection'](_0x8b002c[_0xbbb4('0x2c')],qs[_0xbbb4('0x32')](_0x5e3173['query'][_0xbbb4('0x32')]));_0x958654['attributes']=_0x958654[_0xbbb4('0x31')]['length']?_0x958654[_0xbbb4('0x31')]:_0x8b002c[_0xbbb4('0x2c')];if(_0x5e3173['query'][_0xbbb4('0x3d')]){_0x958654[_0xbbb4('0x3e')]=[{'all':!![]}];}_0x958654=_[_0xbbb4('0x3b')]({},_0x958654,_0x5e3173[_0xbbb4('0x3c')]);return db[_0xbbb4('0x28')][_0xbbb4('0x43')](_0x958654)[_0xbbb4('0x20')](handleEntityNotFound(_0x7c8fce,null))['then'](respondWithResult(_0x7c8fce,null))[_0xbbb4('0x40')](handleError(_0x7c8fce,null));};exports['create']=function(_0xc901f1,_0x36b276){return db[_0xbbb4('0x28')][_0xbbb4('0x44')](_0xc901f1['body'],{})[_0xbbb4('0x20')](respondWithResult(_0x36b276,0xc9))[_0xbbb4('0x40')](handleError(_0x36b276,null));};exports[_0xbbb4('0x1f')]=function(_0x26419,_0x1604f6){if(_0x26419['body']['id']){delete _0x26419[_0xbbb4('0x45')]['id'];}return db[_0xbbb4('0x28')][_0xbbb4('0x43')]({'where':{'id':_0x26419['params']['id']}})[_0xbbb4('0x20')](handleEntityNotFound(_0x1604f6,null))[_0xbbb4('0x20')](saveUpdates(_0x26419[_0xbbb4('0x45')],null))[_0xbbb4('0x20')](respondWithResult(_0x1604f6,null))[_0xbbb4('0x40')](handleError(_0x1604f6,null));};exports[_0xbbb4('0x21')]=function(_0x3d6568,_0x3589e9){return db[_0xbbb4('0x28')][_0xbbb4('0x43')]({'where':{'id':_0x3d6568[_0xbbb4('0x46')]['id']}})['then'](handleEntityNotFound(_0x3589e9,null))[_0xbbb4('0x20')](removeEntity(_0x3589e9,null))['catch'](handleError(_0x3589e9,null));};exports[_0xbbb4('0x47')]=function(_0xc32610,_0x309ce2){return db[_0xbbb4('0x28')][_0xbbb4('0x47')]()[_0xbbb4('0x20')](respondWithResult(_0x309ce2,null))[_0xbbb4('0x40')](handleError(_0x309ce2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0c74c11..8d781f5 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 _0x8e18=['SmsTransferReport','uniqueid','util','api','moment','bluebird','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x51071f,_0x42046b){var _0x18ea86=function(_0x233224){while(--_0x233224){_0x51071f['push'](_0x51071f['shift']());}};_0x18ea86(++_0x42046b);}(_0x8e18,0x1ba));var _0x88e1=function(_0x2f8f49,_0x51c123){_0x2f8f49=_0x2f8f49-0x0;var _0x5c900e=_0x8e18[_0x2f8f49];return _0x5c900e;};'use strict';var _=require('lodash');var util=require(_0x88e1('0x0'));var logger=require('../../config/logger')(_0x88e1('0x1'));var moment=require(_0x88e1('0x2'));var BPromise=require(_0x88e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x88e1('0x4'));var config=require(_0x88e1('0x5'));var attributes=require(_0x88e1('0x6'));module[_0x88e1('0x7')]=function(_0xf4e5e6,_0x146671){return _0xf4e5e6[_0x88e1('0x8')](_0x88e1('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x88e1('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x02ac=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0x02ac,0x1ed));var _0xc02a=function(_0xdc1d6f,_0x49aa02){_0xdc1d6f=_0xdc1d6f-0x0;var _0x451029=_0x02ac[_0xdc1d6f];return _0x451029;};'use strict';var _=require(_0xc02a('0x0'));var util=require('util');var logger=require(_0xc02a('0x1'))(_0xc02a('0x2'));var moment=require(_0xc02a('0x3'));var BPromise=require(_0xc02a('0x4'));var rp=require(_0xc02a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc02a('0x6'));var config=require(_0xc02a('0x7'));var attributes=require(_0xc02a('0x8'));module['exports']=function(_0x16ac2d,_0x7dc966){return _0x16ac2d[_0xc02a('0x9')](_0xc02a('0xa'),attributes,{'tableName':_0xc02a('0xb'),'paranoid':![],'indexes':[{'name':_0xc02a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ee9a356..3c37bee 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 _0x6fc4=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x332109,_0x474add){_0x332109=_0x332109-0x0;var _0x7a6ab2=_0x6fc4[_0x332109];return _0x7a6ab2;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x46fc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46fc('0x3'))(_0x46fc('0x4'));var config=require(_0x46fc('0x5'));var jayson=require(_0x46fc('0x6'));var client=jayson[_0x46fc('0x7')][_0x46fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c4f75,_0x3951e9,_0x5ca981){return new BPromise(function(_0x4a7762,_0x149bf8){return client[_0x46fc('0x9')](_0x3c4f75,_0x5ca981)[_0x46fc('0xa')](function(_0x4594c1){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3951e9,_0x46fc('0xb'));logger[_0x46fc('0xc')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3951e9,_0x46fc('0xb'),JSON['stringify'](_0x4594c1));if(_0x4594c1[_0x46fc('0xd')]){if(_0x4594c1[_0x46fc('0xd')][_0x46fc('0xe')]===0x1f4){logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);return _0x149bf8(_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);}logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);return _0x4a7762(_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);}else{logger[_0x46fc('0x11')](_0x46fc('0xf'),_0x3951e9,_0x46fc('0xb'));_0x4a7762(_0x4594c1['result'][_0x46fc('0x10')]);}})[_0x46fc('0x12')](function(_0x1df938){logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x1df938);_0x149bf8(_0x1df938);});});} \ No newline at end of file +var _0x7b83=['../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsTransferReport,\x20%s,\x20%s','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0x7b83,0xa1));var _0x37b8=function(_0x1cb931,_0x41493d){_0x1cb931=_0x1cb931-0x0;var _0x1ef86b=_0x7b83[_0x1cb931];return _0x1ef86b;};'use strict';var _=require(_0x37b8('0x0'));var util=require(_0x37b8('0x1'));var moment=require(_0x37b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37b8('0x3'));var db=require(_0x37b8('0x4'))['db'];var utils=require(_0x37b8('0x5'));var logger=require('../../config/logger')(_0x37b8('0x6'));var config=require(_0x37b8('0x7'));var jayson=require(_0x37b8('0x8'));var client=jayson[_0x37b8('0x9')][_0x37b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x220cd2,_0x5eb540,_0x45e094){return new BPromise(function(_0xc3ab5b,_0x50f729){return client[_0x37b8('0xb')](_0x220cd2,_0x45e094)['then'](function(_0x548dfd){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x5eb540,_0x37b8('0xc'));logger[_0x37b8('0xd')](_0x37b8('0xe'),_0x5eb540,_0x37b8('0xc'),JSON[_0x37b8('0xf')](_0x548dfd));if(_0x548dfd['error']){if(_0x548dfd[_0x37b8('0x10')]['code']===0x1f4){logger[_0x37b8('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5eb540,_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);return _0x50f729(_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);}logger[_0x37b8('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5eb540,_0x548dfd['error'][_0x37b8('0x11')]);return _0xc3ab5b(_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x5eb540,_0x37b8('0xc'));_0xc3ab5b(_0x548dfd[_0x37b8('0x12')][_0x37b8('0x11')]);}})[_0x37b8('0x13')](function(_0x290068){logger[_0x37b8('0x10')](_0x37b8('0x14'),_0x5eb540,_0x290068);_0x50f729(_0x290068);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 935c60b..41a79d1 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 _0x30cf=['./sound.controller','get','isAuthenticated','/:id','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa0f6ae,_0x1ff850){var _0x265be6=function(_0x453a82){while(--_0x453a82){_0xa0f6ae['push'](_0xa0f6ae['shift']());}};_0x265be6(++_0x1ff850);}(_0x30cf,0xc3));var _0xf30c=function(_0x577ed7,_0x32d991){_0x577ed7=_0x577ed7-0x0;var _0x22cffd=_0x30cf[_0x577ed7];return _0x22cffd;};'use strict';var multer=require(_0xf30c('0x0'));var util=require(_0xf30c('0x1'));var path=require(_0xf30c('0x2'));var timeout=require(_0xf30c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf30c('0x4'));var auth=require(_0xf30c('0x5'));var interaction=require(_0xf30c('0x6'));var config=require(_0xf30c('0x7'));var controller=require(_0xf30c('0x8'));router[_0xf30c('0x9')]('/',auth[_0xf30c('0xa')](),controller['index']);router[_0xf30c('0x9')](_0xf30c('0xb'),auth[_0xf30c('0xa')](),controller['show']);router['get'](_0xf30c('0xc'),auth[_0xf30c('0xa')](),controller[_0xf30c('0xd')]);var upload=multer({'storage':multer[_0xf30c('0xe')]({'destination':function(_0x547929,_0x6c9d90,_0x335b6b){_0x335b6b(null,path['join'](config[_0xf30c('0xf')],_0xf30c('0x10')));},'filename':function(_0x24e8e1,_0x2c662d,_0x2e1175){_0x2c662d[_0xf30c('0x11')]=_0x2c662d[_0xf30c('0x11')][_0xf30c('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2e1175(null,util[_0xf30c('0x13')](_0xf30c('0x14'),path['basename'](_0x2c662d['originalname'],path[_0xf30c('0x15')](_0x2c662d[_0xf30c('0x11')])),Date[_0xf30c('0x16')](),path[_0xf30c('0x15')](_0x2c662d[_0xf30c('0x11')])));}})});router[_0xf30c('0x17')]('/',upload['single']('file'),controller[_0xf30c('0x18')]);router[_0xf30c('0x19')]('/:id',auth[_0xf30c('0xa')](),controller[_0xf30c('0x1a')]);router[_0xf30c('0x1b')]('/:id',auth[_0xf30c('0xa')](),controller[_0xf30c('0x1b')]);module[_0xf30c('0x1c')]=router; \ No newline at end of file +var _0xe4a6=['delete','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/download','download','diskStorage','join','root','originalname','basename','now','post','single','file','create','put','update'];(function(_0x31ec1f,_0x5a5559){var _0x37463f=function(_0x4ba49a){while(--_0x4ba49a){_0x31ec1f['push'](_0x31ec1f['shift']());}};_0x37463f(++_0x5a5559);}(_0xe4a6,0x1a2));var _0x6e4a=function(_0x364390,_0x46b408){_0x364390=_0x364390-0x0;var _0x3cf60d=_0xe4a6[_0x364390];return _0x3cf60d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6e4a('0x0'));var router=express[_0x6e4a('0x1')]();var fs_extra=require(_0x6e4a('0x2'));var auth=require(_0x6e4a('0x3'));var interaction=require(_0x6e4a('0x4'));var config=require(_0x6e4a('0x5'));var controller=require('./sound.controller');router['get']('/',auth[_0x6e4a('0x6')](),controller[_0x6e4a('0x7')]);router[_0x6e4a('0x8')](_0x6e4a('0x9'),auth[_0x6e4a('0x6')](),controller['show']);router['get'](_0x6e4a('0xa'),auth['isAuthenticated'](),controller[_0x6e4a('0xb')]);var upload=multer({'storage':multer[_0x6e4a('0xc')]({'destination':function(_0x42a987,_0x14279c,_0x41d227){_0x41d227(null,path[_0x6e4a('0xd')](config[_0x6e4a('0xe')],'server/files/sounds/original/'));},'filename':function(_0x54ab66,_0x32244f,_0x1da249){_0x32244f[_0x6e4a('0xf')]=_0x32244f[_0x6e4a('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1da249(null,util['format']('%s-%s%s',path[_0x6e4a('0x10')](_0x32244f[_0x6e4a('0xf')],path['extname'](_0x32244f['originalname'])),Date[_0x6e4a('0x11')](),path['extname'](_0x32244f[_0x6e4a('0xf')])));}})});router[_0x6e4a('0x12')]('/',upload[_0x6e4a('0x13')](_0x6e4a('0x14')),controller[_0x6e4a('0x15')]);router[_0x6e4a('0x16')](_0x6e4a('0x9'),auth[_0x6e4a('0x6')](),controller[_0x6e4a('0x17')]);router[_0x6e4a('0x18')](_0x6e4a('0x9'),auth[_0x6e4a('0x6')](),controller[_0x6e4a('0x18')]);module[_0x6e4a('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index d4ac076..5730521 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 _0x6e11=['STRING','name','FLOAT','BIGINT','INTEGER','exports'];(function(_0x1d3f21,_0x5acda8){var _0x4388d0=function(_0x163726){while(--_0x163726){_0x1d3f21['push'](_0x1d3f21['shift']());}};_0x4388d0(++_0x5acda8);}(_0x6e11,0xb9));var _0x16e1=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x6e11[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require('sequelize');module[_0x16e1('0x0')]={'name':{'type':Sequelize[_0x16e1('0x1')],'unique':_0x16e1('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x16e1('0x1')]},'display_name':{'type':Sequelize[_0x16e1('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x16e1('0x1')]},'original_duration':{'type':Sequelize[_0x16e1('0x3')]},'original_sampleCount':{'type':Sequelize[_0x16e1('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x16e1('0x4')]},'original_sampleRate':{'type':Sequelize[_0x16e1('0x5')]},'converted_format':{'type':Sequelize[_0x16e1('0x1')]},'converted_duration':{'type':Sequelize[_0x16e1('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x16e1('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x16e1('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x16e1('0x5')]}}; \ No newline at end of file +var _0x47cf=['BIGINT','INTEGER','FLOAT','exports','STRING'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x47cf,0x189));var _0xf47c=function(_0x3d7a33,_0x1b5b41){_0x3d7a33=_0x3d7a33-0x0;var _0x167339=_0x47cf[_0x3d7a33];return _0x167339;};'use strict';var Sequelize=require('sequelize');module[_0xf47c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xf47c('0x1')]},'display_name':{'type':Sequelize[_0xf47c('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xf47c('0x1')]},'original_format':{'type':Sequelize[_0xf47c('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xf47c('0x2')]},'original_channelCount':{'type':Sequelize[_0xf47c('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xf47c('0x3')]},'converted_format':{'type':Sequelize[_0xf47c('0x1')]},'converted_duration':{'type':Sequelize[_0xf47c('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xf47c('0x2')]},'converted_sampleRate':{'type':Sequelize[_0xf47c('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 4de2559..3824e36 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 _0x25b3=['download','converted_format','existsSync','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_bitRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find'];(function(_0x78875f,_0xfd486d){var _0x149cb1=function(_0x6d2e15){while(--_0x6d2e15){_0x78875f['push'](_0x78875f['shift']());}};_0x149cb1(++_0xfd486d);}(_0x25b3,0x13c));var _0x325b=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0x25b3[_0x5cca9f];return _0x55edda;};'use strict';var emlformat=require(_0x325b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x325b('0x1'));var jsonpatch=require(_0x325b('0x2'));var rp=require(_0x325b('0x3'));var moment=require(_0x325b('0x4'));var BPromise=require(_0x325b('0x5'));var Mustache=require(_0x325b('0x6'));var util=require(_0x325b('0x7'));var path=require(_0x325b('0x8'));var sox=require(_0x325b('0x9'));var csv=require('to-csv');var ejs=require(_0x325b('0xa'));var fs=require('fs');var fs_extra=require(_0x325b('0xb'));var _=require(_0x325b('0xc'));var squel=require(_0x325b('0xd'));var crypto=require(_0x325b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x325b('0xf'));var toCsv=require(_0x325b('0x10'));var querystring=require(_0x325b('0x11'));var Papa=require(_0x325b('0x12'));var Redis=require(_0x325b('0x13'));var authService=require(_0x325b('0x14'));var qs=require(_0x325b('0x15'));var as=require(_0x325b('0x16'));var hardwareService=require(_0x325b('0x17'));var logger=require(_0x325b('0x18'))(_0x325b('0x19'));var utils=require(_0x325b('0x1a'));var config=require(_0x325b('0x1b'));var licenseUtil=require(_0x325b('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ab1af,_0x475296){_0x475296=_0x475296||0xcc;return function(_0x2c03d4){if(_0x2c03d4){return _0x3ab1af['sendStatus'](_0x475296);}return _0x3ab1af[_0x325b('0x1d')](_0x475296)[_0x325b('0x1e')]();};}function respondWithResult(_0x40a9eb,_0x299e4e){_0x299e4e=_0x299e4e||0xc8;return function(_0x5b0a2f){if(_0x5b0a2f){return _0x40a9eb[_0x325b('0x1d')](_0x299e4e)[_0x325b('0x1f')](_0x5b0a2f);}};}function respondWithFilteredResult(_0x339779,_0x44052a){return function(_0x413563){if(_0x413563){var _0x1fb45f=typeof _0x44052a['offset']===_0x325b('0x20')&&typeof _0x44052a[_0x325b('0x21')]===_0x325b('0x20');var _0x7a7c95=_0x413563[_0x325b('0x22')];var _0x82cc1=_0x1fb45f?0x0:_0x44052a['offset'];var _0x34a881=_0x1fb45f?_0x413563['count']:_0x44052a[_0x325b('0x23')]+_0x44052a['limit'];var _0x3505af;if(_0x34a881>=_0x7a7c95){_0x34a881=_0x7a7c95;_0x3505af=0xc8;}else{_0x3505af=0xce;}_0x339779[_0x325b('0x1d')](_0x3505af);return _0x339779[_0x325b('0x24')](_0x325b('0x25'),_0x82cc1+'-'+_0x34a881+'/'+_0x7a7c95)[_0x325b('0x1f')](_0x413563);}return null;};}function patchUpdates(_0x449126){return function(_0x96167e){try{jsonpatch[_0x325b('0x26')](_0x96167e,_0x449126,!![]);}catch(_0x4d254b){return BPromise[_0x325b('0x27')](_0x4d254b);}return _0x96167e[_0x325b('0x28')]();};}function saveUpdates(_0x71101,_0x9ac50e){return function(_0x561c7e){if(_0x561c7e){return _0x561c7e[_0x325b('0x29')](_0x71101)[_0x325b('0x2a')](function(_0x5d8ce){return _0x5d8ce;});}return null;};}function removeEntity(_0x5e715c,_0x5d4777){return function(_0x56dbbe){if(_0x56dbbe){return _0x56dbbe[_0x325b('0x2b')]()[_0x325b('0x2a')](function(){var _0x292872=_0x56dbbe[_0x325b('0x2c')]({'plain':!![]});var _0x40134a='Sounds';return db[_0x325b('0x2d')]['destroy']({'where':{'type':_0x40134a,'resourceId':_0x292872['id']}})['then'](function(){return _0x56dbbe;});})[_0x325b('0x2a')](function(){_0x5e715c['status'](0xcc)[_0x325b('0x1e')]();});}};}function handleEntityNotFound(_0x15a81f,_0x404fb2){return function(_0x5ae8f7){if(!_0x5ae8f7){_0x15a81f[_0x325b('0x2e')](0x194);}return _0x5ae8f7;};}function handleError(_0x22a50a,_0x446e75){_0x446e75=_0x446e75||0x1f4;return function(_0xe4b3ec){logger[_0x325b('0x2f')](_0xe4b3ec[_0x325b('0x30')]);if(_0xe4b3ec[_0x325b('0x31')]){delete _0xe4b3ec['name'];}_0x22a50a[_0x325b('0x1d')](_0x446e75)[_0x325b('0x32')](_0xe4b3ec);};}exports[_0x325b('0x33')]=function(_0xa5fbb4,_0x4af1c9){var _0x1091be={},_0x62e834={},_0x163398={'count':0x0,'rows':[]};var _0x3b3472=_[_0x325b('0x34')](db[_0x325b('0x35')][_0x325b('0x36')],function(_0x710e6b){return{'name':_0x710e6b[_0x325b('0x37')],'type':_0x710e6b['type'][_0x325b('0x38')]};});_0x62e834[_0x325b('0x39')]=_[_0x325b('0x34')](_0x3b3472,_0x325b('0x31'));_0x62e834[_0x325b('0x3a')]=_['keys'](_0xa5fbb4['query']);_0x62e834[_0x325b('0x3b')]=_[_0x325b('0x3c')](_0x62e834[_0x325b('0x39')],_0x62e834[_0x325b('0x3a')]);_0x1091be['attributes']=_[_0x325b('0x3c')](_0x62e834[_0x325b('0x39')],qs[_0x325b('0x3d')](_0xa5fbb4[_0x325b('0x3a')][_0x325b('0x3d')]));_0x1091be[_0x325b('0x3e')]=_0x1091be[_0x325b('0x3e')]['length']?_0x1091be[_0x325b('0x3e')]:_0x62e834[_0x325b('0x39')];if(!_0xa5fbb4[_0x325b('0x3a')]['hasOwnProperty'](_0x325b('0x3f'))){_0x1091be[_0x325b('0x21')]=qs[_0x325b('0x21')](_0xa5fbb4['query']['limit']);_0x1091be[_0x325b('0x23')]=qs[_0x325b('0x23')](_0xa5fbb4['query'][_0x325b('0x23')]);}_0x1091be[_0x325b('0x40')]=qs[_0x325b('0x41')](_0xa5fbb4['query'][_0x325b('0x41')]);_0x1091be[_0x325b('0x42')]=qs['filters'](_[_0x325b('0x43')](_0xa5fbb4[_0x325b('0x3a')],_0x62e834[_0x325b('0x3b')]),_0x3b3472);if(_0xa5fbb4[_0x325b('0x3a')]['filter']){_0x1091be[_0x325b('0x42')]=_[_0x325b('0x44')](_0x1091be[_0x325b('0x42')],{'$or':_[_0x325b('0x34')](_0x3b3472,function(_0x538289){if(_0x538289['type']!==_0x325b('0x45')){var _0x3c6790={};_0x3c6790[_0x538289[_0x325b('0x31')]]={'$like':'%'+_0xa5fbb4['query'][_0x325b('0x46')]+'%'};return _0x3c6790;}})});}_0x1091be=_[_0x325b('0x44')]({},_0x1091be,_0xa5fbb4[_0x325b('0x47')]);var _0x242ba0={'where':_0x1091be['where']};return db[_0x325b('0x35')]['count'](_0x242ba0)[_0x325b('0x2a')](function(_0x1b0baa){_0x163398['count']=_0x1b0baa;if(_0xa5fbb4[_0x325b('0x3a')][_0x325b('0x48')]){_0x1091be[_0x325b('0x49')]=[{'all':!![]}];}return db[_0x325b('0x35')]['findAll'](_0x1091be);})[_0x325b('0x2a')](function(_0x36628d){_0x163398[_0x325b('0x4a')]=_0x36628d;return _0x163398;})[_0x325b('0x2a')](respondWithFilteredResult(_0x4af1c9,_0x1091be))[_0x325b('0x4b')](handleError(_0x4af1c9,null));};exports[_0x325b('0x4c')]=function(_0x1c09b0,_0x112538){var _0xf27051={'raw':!![],'where':{'id':_0x1c09b0[_0x325b('0x4d')]['id']}},_0x434e7f={};_0x434e7f[_0x325b('0x39')]=_[_0x325b('0x4e')](db['Sound'][_0x325b('0x36')]);_0x434e7f[_0x325b('0x3a')]=_[_0x325b('0x4e')](_0x1c09b0[_0x325b('0x3a')]);_0x434e7f[_0x325b('0x3b')]=_[_0x325b('0x3c')](_0x434e7f['model'],_0x434e7f[_0x325b('0x3a')]);_0xf27051[_0x325b('0x3e')]=_['intersection'](_0x434e7f[_0x325b('0x39')],qs[_0x325b('0x3d')](_0x1c09b0[_0x325b('0x3a')][_0x325b('0x3d')]));_0xf27051[_0x325b('0x3e')]=_0xf27051['attributes']['length']?_0xf27051[_0x325b('0x3e')]:_0x434e7f[_0x325b('0x39')];if(_0x1c09b0[_0x325b('0x3a')][_0x325b('0x48')]){_0xf27051[_0x325b('0x49')]=[{'all':!![]}];}_0xf27051=_[_0x325b('0x44')]({},_0xf27051,_0x1c09b0[_0x325b('0x47')]);return db[_0x325b('0x35')][_0x325b('0x4f')](_0xf27051)['then'](handleEntityNotFound(_0x112538,null))[_0x325b('0x2a')](respondWithResult(_0x112538,null))[_0x325b('0x4b')](handleError(_0x112538,null));};exports[_0x325b('0x50')]=function(_0x17f65e,_0x4b116b,_0x4d59b2){return db[_0x325b('0x35')]['find']({'where':{'id':_0x17f65e[_0x325b('0x4d')]['id']},'attributes':[_0x325b('0x31'),'save_name',_0x325b('0x51')],'raw':!![]})[_0x325b('0x2a')](handleEntityNotFound(_0x4b116b,null))[_0x325b('0x2a')](function(_0x12f662){if(_0x12f662){if(!fs[_0x325b('0x52')](path['join'](config[_0x325b('0x53')],_0x325b('0x54'),_0x12f662[_0x325b('0x55')]+'.'+_0x12f662[_0x325b('0x51')]))){throw new db[(_0x325b('0x56'))][(_0x325b('0x57'))](_0x325b('0x58'));}return _0x4b116b[_0x325b('0x50')](path[_0x325b('0x59')](config[_0x325b('0x53')],_0x325b('0x54'),util[_0x325b('0x5a')](_0x325b('0x5b'),_0x12f662['save_name'],_0x12f662['converted_format'])),util['format'](_0x325b('0x5b'),_0x12f662[_0x325b('0x31')],_0x12f662[_0x325b('0x51')]));}return null;})['catch'](handleError(_0x4b116b,null));};exports['create']=function(_0x5d11d9,_0x2f76fa,_0x57c059){var _0x4d2413={'name':path['basename'](_0x5d11d9[_0x325b('0x5c')][_0x325b('0x5d')],path[_0x325b('0x5e')](_0x5d11d9[_0x325b('0x5c')][_0x325b('0x5d')])),'save_name':path[_0x325b('0x5f')](_0x5d11d9['file'][_0x325b('0x60')],path['extname'](_0x5d11d9[_0x325b('0x5c')][_0x325b('0x60')])),'original_format':path[_0x325b('0x5e')](_0x5d11d9[_0x325b('0x5c')][_0x325b('0x5d')])[_0x325b('0x61')](0x1),'converted_format':_0x325b('0x62')};var _0x37e399=path[_0x325b('0x59')](config[_0x325b('0x53')],_0x325b('0x63'),_0x5d11d9[_0x325b('0x5c')][_0x325b('0x60')]);var _0x47c04e=path[_0x325b('0x59')](config[_0x325b('0x53')],_0x325b('0x54'),util['format'](_0x325b('0x5b'),path[_0x325b('0x5f')](_0x5d11d9['file']['filename'],path['extname'](_0x5d11d9['file'][_0x325b('0x60')])),_0x4d2413['converted_format']));logger[_0x325b('0x64')](_0x325b('0x65'),_0x37e399);logger[_0x325b('0x64')](_0x325b('0x66'),_0x47c04e);try{fs[_0x325b('0x67')](_0x37e399,parseInt(_0x325b('0x68'),0x8));var _0x1b6c41=sox['transcode'](_0x37e399,_0x47c04e,{'sampleRate':0x1f40,'format':_0x325b('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b6c41['on']('error',function(_0x1ab54){fs[_0x325b('0x69')](_0x37e399);_0x2f76fa[_0x325b('0x1d')](0x1f4)[_0x325b('0x32')](_0x1ab54);});_0x1b6c41['on'](_0x325b('0x6a'),function(_0x2d0369){_0x4d2413[_0x325b('0x6b')]=isNaN(_0x2d0369[_0x325b('0x6c')])?null:_0x2d0369[_0x325b('0x6c')]*0x3e8;_0x4d2413[_0x325b('0x6d')]=isNaN(_0x2d0369[_0x325b('0x6e')])?null:_0x2d0369['sampleCount'];_0x4d2413[_0x325b('0x6f')]=isNaN(_0x2d0369['channelCount'])?null:_0x2d0369[_0x325b('0x70')];_0x4d2413[_0x325b('0x71')]=isNaN(_0x2d0369[_0x325b('0x72')])?null:_0x2d0369[_0x325b('0x72')];_0x4d2413['original_sampleRate']=isNaN(_0x2d0369[_0x325b('0x73')])?null:_0x2d0369[_0x325b('0x73')];});_0x1b6c41['on'](_0x325b('0x74'),function(_0x97d2c0){_0x4d2413[_0x325b('0x75')]=isNaN(_0x97d2c0[_0x325b('0x6c')])?null:_0x97d2c0[_0x325b('0x6c')]*0x3e8;_0x4d2413['converted_sampleCount']=isNaN(_0x97d2c0['sampleCount'])?null:_0x97d2c0[_0x325b('0x6e')];_0x4d2413['converted_channelCount']=isNaN(_0x97d2c0[_0x325b('0x70')])?null:_0x97d2c0[_0x325b('0x70')];_0x4d2413[_0x325b('0x76')]=isNaN(_0x97d2c0['bitRate'])?null:_0x97d2c0[_0x325b('0x72')];_0x4d2413['converted_sampleRate']=isNaN(_0x97d2c0['sampleRate'])?null:_0x97d2c0[_0x325b('0x73')];});_0x1b6c41['on'](_0x325b('0x1e'),function(){fs['chmodSync'](_0x47c04e,parseInt(_0x325b('0x68'),0x8));return db[_0x325b('0x35')][_0x325b('0x77')](_0x4d2413)[_0x325b('0x2a')](function(_0xc9764){var _0x53dde5={'role':_0x5d11d9[_0x325b('0x78')][_0x325b('0x79')],'userProfileId':_0x5d11d9[_0x325b('0x78')][_0x325b('0x7a')]};if(!_0x53dde5)throw new Error(_0x325b('0x7b'));if(_0x53dde5['role']===_0x325b('0x7c')){var _0x32207c=_0xc9764[_0x325b('0x2c')]({'plain':!![]});return db[_0x325b('0x7d')][_0x325b('0x4f')]({'where':{'name':_0x325b('0x7e'),'userProfileId':_0x53dde5['userProfileId']},'raw':!![]})[_0x325b('0x2a')](function(_0x402fe4){if(_0x402fe4&&_0x402fe4[_0x325b('0x7f')]===0x0){return db[_0x325b('0x2d')][_0x325b('0x77')]({'name':_0x32207c['name'],'resourceId':_0x32207c['id'],'type':_0x402fe4[_0x325b('0x31')],'sectionId':_0x402fe4['id']},{})[_0x325b('0x2a')](function(){return _0xc9764;});}else{return _0xc9764;}})[_0x325b('0x4b')](function(_0x1d6ab7){logger['error'](_0x325b('0x80'),_0x1d6ab7);throw _0x1d6ab7;});}return _0xc9764;})[_0x325b('0x2a')](respondWithResult(_0x2f76fa,null))[_0x325b('0x4b')](handleError(_0x2f76fa,null));});_0x1b6c41['start']();}catch(_0x136673){_0x2f76fa[_0x325b('0x1d')](0x1f4)['send'](_0x136673);}};exports[_0x325b('0x29')]=function(_0x72b542,_0x56066d,_0x17e4e9){return db['Sound']['find']({'where':{'id':_0x72b542['params']['id']}})['then'](handleEntityNotFound(_0x56066d,null))[_0x325b('0x2a')](saveUpdates(_[_0x325b('0x43')](_0x72b542['body'],[_0x325b('0x31'),_0x325b('0x81')]),null))['then'](respondWithResult(_0x56066d,null))[_0x325b('0x4b')](handleError(_0x56066d,null));};exports[_0x325b('0x82')]=function(_0x3572aa,_0x158088,_0x523337){return db[_0x325b('0x35')][_0x325b('0x4f')]({'where':{'id':_0x3572aa['params']['id']}})[_0x325b('0x2a')](function(_0xeae54a){if(_0xeae54a){return _0xeae54a['destroy']();}})[_0x325b('0x2a')](function(_0x2e763b){var _0x313b25=path[_0x325b('0x59')](config['root'],_0x325b('0x63'),util[_0x325b('0x5a')](_0x325b('0x5b'),_0x2e763b[_0x325b('0x55')],_0x2e763b[_0x325b('0x83')]));var _0xe697f4=path[_0x325b('0x59')](config[_0x325b('0x53')],_0x325b('0x54'),util[_0x325b('0x5a')](_0x325b('0x5b'),_0x2e763b[_0x325b('0x55')],_0x2e763b[_0x325b('0x51')]));fs[_0x325b('0x69')](_0x313b25);fs[_0x325b('0x69')](_0xe697f4);return _0x2e763b;})[_0x325b('0x2a')](function(_0x5e6a4a){if(_0x5e6a4a){return _0x158088[_0x325b('0x1d')](0xcc)[_0x325b('0x1e')]();}})[_0x325b('0x2a')](handleEntityNotFound(_0x158088,null))[_0x325b('0x4b')](handleError(_0x158088,null));}; \ No newline at end of file +var _0xdaad=['transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','description','delete','original_format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','Sounds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','find','download','params','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','originalname','extname','file','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777'];(function(_0x84055f,_0x52c771){var _0x45fb92=function(_0x22420a){while(--_0x22420a){_0x84055f['push'](_0x84055f['shift']());}};_0x45fb92(++_0x52c771);}(_0xdaad,0x9c));var _0xddaa=function(_0x252927,_0x3f8cab){_0x252927=_0x252927-0x0;var _0x358956=_0xdaad[_0x252927];return _0x358956;};'use strict';var emlformat=require(_0xddaa('0x0'));var rimraf=require(_0xddaa('0x1'));var zipdir=require(_0xddaa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddaa('0x3'));var moment=require(_0xddaa('0x4'));var BPromise=require(_0xddaa('0x5'));var Mustache=require(_0xddaa('0x6'));var util=require('util');var path=require(_0xddaa('0x7'));var sox=require(_0xddaa('0x8'));var csv=require(_0xddaa('0x9'));var ejs=require(_0xddaa('0xa'));var fs=require('fs');var fs_extra=require(_0xddaa('0xb'));var _=require(_0xddaa('0xc'));var squel=require(_0xddaa('0xd'));var crypto=require('crypto');var jsforce=require(_0xddaa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xddaa('0x9'));var querystring=require(_0xddaa('0xf'));var Papa=require(_0xddaa('0x10'));var Redis=require(_0xddaa('0x11'));var authService=require(_0xddaa('0x12'));var qs=require(_0xddaa('0x13'));var as=require(_0xddaa('0x14'));var hardwareService=require(_0xddaa('0x15'));var logger=require(_0xddaa('0x16'))(_0xddaa('0x17'));var utils=require(_0xddaa('0x18'));var config=require(_0xddaa('0x19'));var licenseUtil=require(_0xddaa('0x1a'));var db=require(_0xddaa('0x1b'))['db'];function respondWithStatusCode(_0x3e2a93,_0x48a70a){_0x48a70a=_0x48a70a||0xcc;return function(_0x388830){if(_0x388830){return _0x3e2a93['sendStatus'](_0x48a70a);}return _0x3e2a93['status'](_0x48a70a)['end']();};}function respondWithResult(_0x482163,_0x34ba51){_0x34ba51=_0x34ba51||0xc8;return function(_0x5159ed){if(_0x5159ed){return _0x482163[_0xddaa('0x1c')](_0x34ba51)['json'](_0x5159ed);}};}function respondWithFilteredResult(_0x212d80,_0x438e6d){return function(_0x10ae18){if(_0x10ae18){var _0x2c512f=typeof _0x438e6d[_0xddaa('0x1d')]===_0xddaa('0x1e')&&typeof _0x438e6d[_0xddaa('0x1f')]===_0xddaa('0x1e');var _0x32082c=_0x10ae18[_0xddaa('0x20')];var _0x534f71=_0x2c512f?0x0:_0x438e6d[_0xddaa('0x1d')];var _0x3ab8e2=_0x2c512f?_0x10ae18[_0xddaa('0x20')]:_0x438e6d['offset']+_0x438e6d[_0xddaa('0x1f')];var _0x167f7a;if(_0x3ab8e2>=_0x32082c){_0x3ab8e2=_0x32082c;_0x167f7a=0xc8;}else{_0x167f7a=0xce;}_0x212d80[_0xddaa('0x1c')](_0x167f7a);return _0x212d80['set'](_0xddaa('0x21'),_0x534f71+'-'+_0x3ab8e2+'/'+_0x32082c)['json'](_0x10ae18);}return null;};}function patchUpdates(_0x164371){return function(_0x490c9b){try{jsonpatch['apply'](_0x490c9b,_0x164371,!![]);}catch(_0x390ee5){return BPromise[_0xddaa('0x22')](_0x390ee5);}return _0x490c9b[_0xddaa('0x23')]();};}function saveUpdates(_0x5a63df,_0x4f4699){return function(_0x47c6be){if(_0x47c6be){return _0x47c6be['update'](_0x5a63df)[_0xddaa('0x24')](function(_0x3e02b1){return _0x3e02b1;});}return null;};}function removeEntity(_0x2d5f78,_0x5ea44f){return function(_0x19283d){if(_0x19283d){return _0x19283d[_0xddaa('0x25')]()[_0xddaa('0x24')](function(){var _0x2db8b9=_0x19283d['get']({'plain':!![]});var _0x57ef07=_0xddaa('0x26');return db[_0xddaa('0x27')][_0xddaa('0x25')]({'where':{'type':_0x57ef07,'resourceId':_0x2db8b9['id']}})[_0xddaa('0x24')](function(){return _0x19283d;});})[_0xddaa('0x24')](function(){_0x2d5f78['status'](0xcc)[_0xddaa('0x28')]();});}};}function handleEntityNotFound(_0x59807c,_0xc7e7ec){return function(_0x724d4c){if(!_0x724d4c){_0x59807c[_0xddaa('0x29')](0x194);}return _0x724d4c;};}function handleError(_0x36202d,_0x4955e0){_0x4955e0=_0x4955e0||0x1f4;return function(_0x1d4149){logger[_0xddaa('0x2a')](_0x1d4149[_0xddaa('0x2b')]);if(_0x1d4149[_0xddaa('0x2c')]){delete _0x1d4149['name'];}_0x36202d[_0xddaa('0x1c')](_0x4955e0)[_0xddaa('0x2d')](_0x1d4149);};}exports[_0xddaa('0x2e')]=function(_0x488058,_0x470e48){var _0x2e6c47={},_0xfe472a={},_0x54cb37={'count':0x0,'rows':[]};var _0xa6f21=_[_0xddaa('0x2f')](db[_0xddaa('0x30')][_0xddaa('0x31')],function(_0x307a3c){return{'name':_0x307a3c['fieldName'],'type':_0x307a3c['type'][_0xddaa('0x32')]};});_0xfe472a[_0xddaa('0x33')]=_['map'](_0xa6f21,_0xddaa('0x2c'));_0xfe472a['query']=_[_0xddaa('0x34')](_0x488058[_0xddaa('0x35')]);_0xfe472a[_0xddaa('0x36')]=_['intersection'](_0xfe472a[_0xddaa('0x33')],_0xfe472a['query']);_0x2e6c47[_0xddaa('0x37')]=_[_0xddaa('0x38')](_0xfe472a[_0xddaa('0x33')],qs[_0xddaa('0x39')](_0x488058[_0xddaa('0x35')]['fields']));_0x2e6c47['attributes']=_0x2e6c47[_0xddaa('0x37')][_0xddaa('0x3a')]?_0x2e6c47[_0xddaa('0x37')]:_0xfe472a['model'];if(!_0x488058[_0xddaa('0x35')]['hasOwnProperty'](_0xddaa('0x3b'))){_0x2e6c47[_0xddaa('0x1f')]=qs[_0xddaa('0x1f')](_0x488058[_0xddaa('0x35')][_0xddaa('0x1f')]);_0x2e6c47[_0xddaa('0x1d')]=qs[_0xddaa('0x1d')](_0x488058[_0xddaa('0x35')][_0xddaa('0x1d')]);}_0x2e6c47[_0xddaa('0x3c')]=qs[_0xddaa('0x3d')](_0x488058[_0xddaa('0x35')][_0xddaa('0x3d')]);_0x2e6c47[_0xddaa('0x3e')]=qs[_0xddaa('0x36')](_['pick'](_0x488058[_0xddaa('0x35')],_0xfe472a[_0xddaa('0x36')]),_0xa6f21);if(_0x488058[_0xddaa('0x35')][_0xddaa('0x3f')]){_0x2e6c47['where']=_[_0xddaa('0x40')](_0x2e6c47['where'],{'$or':_[_0xddaa('0x2f')](_0xa6f21,function(_0x345e39){if(_0x345e39[_0xddaa('0x41')]!==_0xddaa('0x42')){var _0x52643c={};_0x52643c[_0x345e39['name']]={'$like':'%'+_0x488058['query'][_0xddaa('0x3f')]+'%'};return _0x52643c;}})});}_0x2e6c47=_['merge']({},_0x2e6c47,_0x488058[_0xddaa('0x43')]);var _0x2eeb47={'where':_0x2e6c47['where']};return db[_0xddaa('0x30')][_0xddaa('0x20')](_0x2eeb47)[_0xddaa('0x24')](function(_0x17cf53){_0x54cb37['count']=_0x17cf53;if(_0x488058[_0xddaa('0x35')][_0xddaa('0x44')]){_0x2e6c47[_0xddaa('0x45')]=[{'all':!![]}];}return db[_0xddaa('0x30')][_0xddaa('0x46')](_0x2e6c47);})[_0xddaa('0x24')](function(_0x49e8d5){_0x54cb37['rows']=_0x49e8d5;return _0x54cb37;})[_0xddaa('0x24')](respondWithFilteredResult(_0x470e48,_0x2e6c47))[_0xddaa('0x47')](handleError(_0x470e48,null));};exports['show']=function(_0x2d827b,_0x5c3fe0){var _0x47dbe1={'raw':!![],'where':{'id':_0x2d827b['params']['id']}},_0x5ac572={};_0x5ac572[_0xddaa('0x33')]=_['keys'](db[_0xddaa('0x30')]['rawAttributes']);_0x5ac572[_0xddaa('0x35')]=_[_0xddaa('0x34')](_0x2d827b[_0xddaa('0x35')]);_0x5ac572[_0xddaa('0x36')]=_['intersection'](_0x5ac572['model'],_0x5ac572[_0xddaa('0x35')]);_0x47dbe1['attributes']=_[_0xddaa('0x38')](_0x5ac572['model'],qs[_0xddaa('0x39')](_0x2d827b[_0xddaa('0x35')][_0xddaa('0x39')]));_0x47dbe1[_0xddaa('0x37')]=_0x47dbe1[_0xddaa('0x37')]['length']?_0x47dbe1[_0xddaa('0x37')]:_0x5ac572['model'];if(_0x2d827b[_0xddaa('0x35')]['includeAll']){_0x47dbe1[_0xddaa('0x45')]=[{'all':!![]}];}_0x47dbe1=_[_0xddaa('0x40')]({},_0x47dbe1,_0x2d827b[_0xddaa('0x43')]);return db[_0xddaa('0x30')][_0xddaa('0x48')](_0x47dbe1)['then'](handleEntityNotFound(_0x5c3fe0,null))[_0xddaa('0x24')](respondWithResult(_0x5c3fe0,null))[_0xddaa('0x47')](handleError(_0x5c3fe0,null));};exports[_0xddaa('0x49')]=function(_0x22b88c,_0x430534,_0x1ccde6){return db[_0xddaa('0x30')][_0xddaa('0x48')]({'where':{'id':_0x22b88c[_0xddaa('0x4a')]['id']},'attributes':['name','save_name',_0xddaa('0x4b')],'raw':!![]})[_0xddaa('0x24')](handleEntityNotFound(_0x430534,null))[_0xddaa('0x24')](function(_0x383230){if(_0x383230){if(!fs[_0xddaa('0x4c')](path[_0xddaa('0x4d')](config[_0xddaa('0x4e')],_0xddaa('0x4f'),_0x383230[_0xddaa('0x50')]+'.'+_0x383230[_0xddaa('0x4b')]))){throw new db[(_0xddaa('0x51'))][(_0xddaa('0x52'))](_0xddaa('0x53'));}return _0x430534[_0xddaa('0x49')](path['join'](config['root'],'server/files/sounds/converted',util[_0xddaa('0x54')](_0xddaa('0x55'),_0x383230[_0xddaa('0x50')],_0x383230[_0xddaa('0x4b')])),util['format'](_0xddaa('0x55'),_0x383230[_0xddaa('0x2c')],_0x383230[_0xddaa('0x4b')]));}return null;})[_0xddaa('0x47')](handleError(_0x430534,null));};exports[_0xddaa('0x56')]=function(_0x57f8fb,_0x4d247c,_0x3067cf){var _0x1e8781={'name':path[_0xddaa('0x57')](_0x57f8fb['file'][_0xddaa('0x58')],path[_0xddaa('0x59')](_0x57f8fb[_0xddaa('0x5a')][_0xddaa('0x58')])),'save_name':path[_0xddaa('0x57')](_0x57f8fb['file'][_0xddaa('0x5b')],path[_0xddaa('0x59')](_0x57f8fb[_0xddaa('0x5a')][_0xddaa('0x5b')])),'original_format':path['extname'](_0x57f8fb[_0xddaa('0x5a')]['originalname'])['substring'](0x1),'converted_format':_0xddaa('0x5c')};var _0x435605=path[_0xddaa('0x4d')](config[_0xddaa('0x4e')],_0xddaa('0x5d'),_0x57f8fb['file'][_0xddaa('0x5b')]);var _0x340ff5=path['join'](config[_0xddaa('0x4e')],_0xddaa('0x4f'),util[_0xddaa('0x54')]('%s.%s',path['basename'](_0x57f8fb['file'][_0xddaa('0x5b')],path[_0xddaa('0x59')](_0x57f8fb[_0xddaa('0x5a')][_0xddaa('0x5b')])),_0x1e8781[_0xddaa('0x4b')]));logger[_0xddaa('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x435605);logger[_0xddaa('0x5e')](_0xddaa('0x5f'),_0x340ff5);try{fs[_0xddaa('0x60')](_0x435605,parseInt(_0xddaa('0x61'),0x8));var _0x52ccad=sox[_0xddaa('0x62')](_0x435605,_0x340ff5,{'sampleRate':0x1f40,'format':_0xddaa('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x52ccad['on'](_0xddaa('0x2a'),function(_0x524844){fs[_0xddaa('0x63')](_0x435605);_0x4d247c[_0xddaa('0x1c')](0x1f4)[_0xddaa('0x2d')](_0x524844);});_0x52ccad['on'](_0xddaa('0x64'),function(_0x383337){_0x1e8781['original_duration']=isNaN(_0x383337[_0xddaa('0x65')])?null:_0x383337['duration']*0x3e8;_0x1e8781['original_sampleCount']=isNaN(_0x383337[_0xddaa('0x66')])?null:_0x383337['sampleCount'];_0x1e8781[_0xddaa('0x67')]=isNaN(_0x383337[_0xddaa('0x68')])?null:_0x383337[_0xddaa('0x68')];_0x1e8781[_0xddaa('0x69')]=isNaN(_0x383337[_0xddaa('0x6a')])?null:_0x383337[_0xddaa('0x6a')];_0x1e8781[_0xddaa('0x6b')]=isNaN(_0x383337[_0xddaa('0x6c')])?null:_0x383337[_0xddaa('0x6c')];});_0x52ccad['on'](_0xddaa('0x6d'),function(_0x519b3d){_0x1e8781[_0xddaa('0x6e')]=isNaN(_0x519b3d[_0xddaa('0x65')])?null:_0x519b3d[_0xddaa('0x65')]*0x3e8;_0x1e8781['converted_sampleCount']=isNaN(_0x519b3d[_0xddaa('0x66')])?null:_0x519b3d['sampleCount'];_0x1e8781[_0xddaa('0x6f')]=isNaN(_0x519b3d[_0xddaa('0x68')])?null:_0x519b3d[_0xddaa('0x68')];_0x1e8781[_0xddaa('0x70')]=isNaN(_0x519b3d[_0xddaa('0x6a')])?null:_0x519b3d[_0xddaa('0x6a')];_0x1e8781[_0xddaa('0x71')]=isNaN(_0x519b3d['sampleRate'])?null:_0x519b3d[_0xddaa('0x6c')];});_0x52ccad['on'](_0xddaa('0x28'),function(){fs[_0xddaa('0x60')](_0x340ff5,parseInt(_0xddaa('0x61'),0x8));return db[_0xddaa('0x30')]['create'](_0x1e8781)[_0xddaa('0x24')](function(_0x2d56de){var _0x49532b={'role':_0x57f8fb[_0xddaa('0x72')][_0xddaa('0x73')],'userProfileId':_0x57f8fb[_0xddaa('0x72')][_0xddaa('0x74')]};if(!_0x49532b)throw new Error(_0xddaa('0x75'));if(_0x49532b[_0xddaa('0x73')]===_0xddaa('0x76')){var _0xe5cbe=_0x2d56de[_0xddaa('0x77')]({'plain':!![]});return db['UserProfileSection'][_0xddaa('0x48')]({'where':{'name':_0xddaa('0x26'),'userProfileId':_0x49532b[_0xddaa('0x74')]},'raw':!![]})[_0xddaa('0x24')](function(_0xc2c826){if(_0xc2c826&&_0xc2c826['autoAssociation']===0x0){return db[_0xddaa('0x27')][_0xddaa('0x56')]({'name':_0xe5cbe[_0xddaa('0x2c')],'resourceId':_0xe5cbe['id'],'type':_0xc2c826[_0xddaa('0x2c')],'sectionId':_0xc2c826['id']},{})['then'](function(){return _0x2d56de;});}else{return _0x2d56de;}})[_0xddaa('0x47')](function(_0x2bde18){logger[_0xddaa('0x2a')](_0xddaa('0x78'),_0x2bde18);throw _0x2bde18;});}return _0x2d56de;})[_0xddaa('0x24')](respondWithResult(_0x4d247c,null))[_0xddaa('0x47')](handleError(_0x4d247c,null));});_0x52ccad[_0xddaa('0x79')]();}catch(_0x5540eb){_0x4d247c[_0xddaa('0x1c')](0x1f4)[_0xddaa('0x2d')](_0x5540eb);}};exports[_0xddaa('0x7a')]=function(_0x2f9569,_0x10f10f,_0xcb28db){return db[_0xddaa('0x30')][_0xddaa('0x48')]({'where':{'id':_0x2f9569['params']['id']}})[_0xddaa('0x24')](handleEntityNotFound(_0x10f10f,null))['then'](saveUpdates(_[_0xddaa('0x7b')](_0x2f9569['body'],['name',_0xddaa('0x7c')]),null))[_0xddaa('0x24')](respondWithResult(_0x10f10f,null))[_0xddaa('0x47')](handleError(_0x10f10f,null));};exports[_0xddaa('0x7d')]=function(_0x54f710,_0x1a2924,_0xf7b740){return db[_0xddaa('0x30')][_0xddaa('0x48')]({'where':{'id':_0x54f710[_0xddaa('0x4a')]['id']}})[_0xddaa('0x24')](function(_0x56c6e2){if(_0x56c6e2){return _0x56c6e2[_0xddaa('0x25')]();}})[_0xddaa('0x24')](function(_0x2ed81e){var _0x30df75=path[_0xddaa('0x4d')](config[_0xddaa('0x4e')],_0xddaa('0x5d'),util[_0xddaa('0x54')](_0xddaa('0x55'),_0x2ed81e[_0xddaa('0x50')],_0x2ed81e[_0xddaa('0x7e')]));var _0x1cf0c9=path[_0xddaa('0x4d')](config['root'],'server/files/sounds/converted',util[_0xddaa('0x54')](_0xddaa('0x55'),_0x2ed81e[_0xddaa('0x50')],_0x2ed81e['converted_format']));fs[_0xddaa('0x63')](_0x30df75);fs[_0xddaa('0x63')](_0x1cf0c9);return _0x2ed81e;})[_0xddaa('0x24')](function(_0x135d7e){if(_0x135d7e){return _0x1a2924[_0xddaa('0x1c')](0xcc)[_0xddaa('0x28')]();}})['then'](handleEntityNotFound(_0x1a2924,null))[_0xddaa('0x47')](handleError(_0x1a2924,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 2e368d5..ce89661 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 _0xfb9b=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Sound','util','api','moment'];(function(_0x439252,_0x96f7e2){var _0x4df331=function(_0x357a0a){while(--_0x357a0a){_0x439252['push'](_0x439252['shift']());}};_0x4df331(++_0x96f7e2);}(_0xfb9b,0x75));var _0xbfb9=function(_0x1fe202,_0x7f004c){_0x1fe202=_0x1fe202-0x0;var _0x4b8768=_0xfb9b[_0x1fe202];return _0x4b8768;};'use strict';var _=require('lodash');var util=require(_0xbfb9('0x0'));var logger=require('../../config/logger')(_0xbfb9('0x1'));var moment=require(_0xbfb9('0x2'));var BPromise=require(_0xbfb9('0x3'));var rp=require(_0xbfb9('0x4'));var fs=require('fs');var path=require(_0xbfb9('0x5'));var rimraf=require(_0xbfb9('0x6'));var config=require(_0xbfb9('0x7'));var attributes=require('./sound.attributes');module[_0xbfb9('0x8')]=function(_0x1ed30a,_0x199b9d){return _0x1ed30a['define'](_0xbfb9('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e3f=['request-promise','./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger','moment','bluebird'];(function(_0x384bb9,_0x447607){var _0x649cf2=function(_0x556a6d){while(--_0x556a6d){_0x384bb9['push'](_0x384bb9['shift']());}};_0x649cf2(++_0x447607);}(_0x4e3f,0xaf));var _0xf4e3=function(_0x513980,_0xdb33f1){_0x513980=_0x513980-0x0;var _0x5cbcfe=_0x4e3f[_0x513980];return _0x5cbcfe;};'use strict';var _=require(_0xf4e3('0x0'));var util=require(_0xf4e3('0x1'));var logger=require(_0xf4e3('0x2'))('api');var moment=require(_0xf4e3('0x3'));var BPromise=require(_0xf4e3('0x4'));var rp=require(_0xf4e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf4e3('0x6'));module[_0xf4e3('0x7')]=function(_0x42c549,_0x3c0c27){return _0x42c549[_0xf4e3('0x8')]('Sound',attributes,{'tableName':_0xf4e3('0x9'),'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 9c5bd35..c5085d7 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 _0xee0a=['Sound,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','Sound','find','options','raw','where','attributes','include','model','map','then','ShowSound','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4fd09d,_0x2b1f3f){var _0x239cd4=function(_0x172987){while(--_0x172987){_0x4fd09d['push'](_0x4fd09d['shift']());}};_0x239cd4(++_0x2b1f3f);}(_0xee0a,0xbf));var _0xaee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee0a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaee0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaee0('0x1'));var rs=require(_0xaee0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaee0('0x3'))['db'];var utils=require(_0xaee0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xaee0('0x5'));var jayson=require(_0xaee0('0x6'));var client=jayson['client'][_0xaee0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x504a77,_0x56c48c,_0x1c895f){return new BPromise(function(_0x46d178,_0x15715a){return client[_0xaee0('0x8')](_0x504a77,_0x1c895f)['then'](function(_0x356a58){logger['info'](_0xaee0('0x9'),_0x56c48c,_0xaee0('0xa'));logger[_0xaee0('0xb')](_0xaee0('0xc'),_0x56c48c,_0xaee0('0xa'),JSON['stringify'](_0x356a58));if(_0x356a58[_0xaee0('0xd')]){if(_0x356a58[_0xaee0('0xd')]['code']===0x1f4){logger[_0xaee0('0xd')](_0xaee0('0x9'),_0x56c48c,_0x356a58[_0xaee0('0xd')]['message']);return _0x15715a(_0x356a58['error'][_0xaee0('0xe')]);}logger[_0xaee0('0xd')](_0xaee0('0x9'),_0x56c48c,_0x356a58['error'][_0xaee0('0xe')]);return _0x46d178(_0x356a58[_0xaee0('0xd')]['message']);}else{logger[_0xaee0('0xf')]('Sound,\x20%s,\x20%s',_0x56c48c,_0xaee0('0xa'));_0x46d178(_0x356a58[_0xaee0('0x10')][_0xaee0('0xe')]);}})[_0xaee0('0x11')](function(_0x5c98ec){logger[_0xaee0('0xd')](_0xaee0('0x9'),_0x56c48c,_0x5c98ec);_0x15715a(_0x5c98ec);});});}exports['ShowSound']=function(_0x4f8f11){var _0x4ef96f=this;return new Promise(function(_0x4fdd50,_0x4adf99){return db[_0xaee0('0x12')][_0xaee0('0x13')]({'raw':_0x4f8f11[_0xaee0('0x14')]?_0x4f8f11['options'][_0xaee0('0x15')]===undefined?!![]:![]:!![],'where':_0x4f8f11[_0xaee0('0x14')]?_0x4f8f11['options'][_0xaee0('0x16')]||null:null,'attributes':_0x4f8f11[_0xaee0('0x14')]?_0x4f8f11[_0xaee0('0x14')][_0xaee0('0x17')]||null:null,'include':_0x4f8f11['options']?_0x4f8f11[_0xaee0('0x14')][_0xaee0('0x18')]?_['map'](_0x4f8f11['options'][_0xaee0('0x18')],function(_0x34b758){return{'model':db[_0x34b758['model']],'as':_0x34b758['as'],'attributes':_0x34b758['attributes'],'include':_0x34b758[_0xaee0('0x18')]?_['map'](_0x34b758[_0xaee0('0x18')],function(_0x52a21e){return{'model':db[_0x52a21e[_0xaee0('0x19')]],'as':_0x52a21e['as'],'attributes':_0x52a21e[_0xaee0('0x17')],'include':_0x52a21e[_0xaee0('0x18')]?_[_0xaee0('0x1a')](_0x52a21e[_0xaee0('0x18')],function(_0x2f74c8){return{'model':db[_0x2f74c8[_0xaee0('0x19')]],'as':_0x2f74c8['as'],'attributes':_0x2f74c8[_0xaee0('0x17')]};}):[]};}):[]};}):[]:[]})[_0xaee0('0x1b')](function(_0x4497cb){logger['info']('ShowSound',_0x4f8f11);logger[_0xaee0('0xb')](_0xaee0('0x1c'),_0x4f8f11,JSON['stringify'](_0x4497cb));_0x4fdd50(_0x4497cb);})[_0xaee0('0x11')](function(_0x40c906){logger[_0xaee0('0xd')]('ShowSound',_0x40c906[_0xaee0('0xe')],_0x4f8f11);_0x4adf99(_0x4ef96f[_0xaee0('0xd')](0x1f4,_0x40c906[_0xaee0('0xe')]));});});}; \ No newline at end of file +var _0xe50a=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','find','options','where','map','include','attributes','model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0xe50a,0x130));var _0xae50=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xe50a[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xae50('0x0'));var util=require(_0xae50('0x1'));var moment=require('moment');var BPromise=require(_0xae50('0x2'));var rs=require(_0xae50('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae50('0x4'))['db'];var utils=require(_0xae50('0x5'));var logger=require(_0xae50('0x6'))(_0xae50('0x7'));var config=require(_0xae50('0x8'));var jayson=require(_0xae50('0x9'));var client=jayson['client'][_0xae50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f5cb8,_0x5517e9,_0x4f1c5b){return new BPromise(function(_0x44b254,_0x4453cd){return client[_0xae50('0xb')](_0x1f5cb8,_0x4f1c5b)[_0xae50('0xc')](function(_0x224269){logger[_0xae50('0xd')]('Sound,\x20%s,\x20%s',_0x5517e9,_0xae50('0xe'));logger[_0xae50('0xf')](_0xae50('0x10'),_0x5517e9,'request\x20sent',JSON['stringify'](_0x224269));if(_0x224269[_0xae50('0x11')]){if(_0x224269[_0xae50('0x11')][_0xae50('0x12')]===0x1f4){logger['error'](_0xae50('0x13'),_0x5517e9,_0x224269['error'][_0xae50('0x14')]);return _0x4453cd(_0x224269[_0xae50('0x11')][_0xae50('0x14')]);}logger['error'](_0xae50('0x13'),_0x5517e9,_0x224269[_0xae50('0x11')]['message']);return _0x44b254(_0x224269[_0xae50('0x11')][_0xae50('0x14')]);}else{logger[_0xae50('0xd')]('Sound,\x20%s,\x20%s',_0x5517e9,_0xae50('0xe'));_0x44b254(_0x224269[_0xae50('0x15')][_0xae50('0x14')]);}})[_0xae50('0x16')](function(_0x57767d){logger['error']('Sound,\x20%s,\x20%s',_0x5517e9,_0x57767d);_0x4453cd(_0x57767d);});});}exports[_0xae50('0x17')]=function(_0x4e7964){var _0xc7b762=this;return new Promise(function(_0x390d29,_0x33d998){return db['Sound'][_0xae50('0x18')]({'raw':_0x4e7964['options']?_0x4e7964[_0xae50('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4e7964[_0xae50('0x19')]?_0x4e7964[_0xae50('0x19')][_0xae50('0x1a')]||null:null,'attributes':_0x4e7964[_0xae50('0x19')]?_0x4e7964['options']['attributes']||null:null,'include':_0x4e7964[_0xae50('0x19')]?_0x4e7964['options']['include']?_[_0xae50('0x1b')](_0x4e7964[_0xae50('0x19')][_0xae50('0x1c')],function(_0x34e4ec){return{'model':db[_0x34e4ec['model']],'as':_0x34e4ec['as'],'attributes':_0x34e4ec[_0xae50('0x1d')],'include':_0x34e4ec[_0xae50('0x1c')]?_[_0xae50('0x1b')](_0x34e4ec[_0xae50('0x1c')],function(_0x4179b3){return{'model':db[_0x4179b3[_0xae50('0x1e')]],'as':_0x4179b3['as'],'attributes':_0x4179b3[_0xae50('0x1d')],'include':_0x4179b3['include']?_[_0xae50('0x1b')](_0x4179b3[_0xae50('0x1c')],function(_0x24337e){return{'model':db[_0x24337e[_0xae50('0x1e')]],'as':_0x24337e['as'],'attributes':_0x24337e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x680b40){logger[_0xae50('0xd')](_0xae50('0x17'),_0x4e7964);logger[_0xae50('0xf')](_0xae50('0x17'),_0x4e7964,JSON['stringify'](_0x680b40));_0x390d29(_0x680b40);})['catch'](function(_0x33c9a9){logger[_0xae50('0x11')]('ShowSound',_0x33c9a9[_0xae50('0x14')],_0x4e7964);_0x33d998(_0xc7b762[_0xae50('0x11')](0x1f4,_0x33c9a9[_0xae50('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index daa9c1f..7790054 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5622b2,_0x5dc268){var _0x2c441b=function(_0x3a3f73){while(--_0x3a3f73){_0x5622b2['push'](_0x5622b2['shift']());}};_0x2c441b(++_0x5dc268);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x0b0e[_0x3b4b1d];return _0x488c36;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3eb24f,_0x59863f){var _0x57ffa9=function(_0x4d63c5){while(--_0x4d63c5){_0x3eb24f['push'](_0x3eb24f['shift']());}};_0x57ffa9(++_0x59863f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e2f39,_0x52276d){_0x3e2f39=_0x3e2f39-0x0;var _0x1f915c=_0xb10b[_0x3e2f39];return _0x1f915c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6a69bff..3ff0cc3 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 _0xc28e=['ENUM','out','sequelize','STRING','TEXT','medium'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xc28e,0x68));var _0xec28=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0xc28e[_0x3a7634];return _0x23bbe9;};'use strict';var Sequelize=require(_0xec28('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xec28('0x1')]},'body':{'type':Sequelize[_0xec28('0x2')](_0xec28('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xec28('0x4')]('in',_0xec28('0x5')),'defaultValue':_0xec28('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xec28('0x2')]}}; \ No newline at end of file +var _0x5b9d=['TEXT','medium','ENUM','out','STRING'];(function(_0x1b074d,_0x24f3a5){var _0x2c7573=function(_0x41e127){while(--_0x41e127){_0x1b074d['push'](_0x1b074d['shift']());}};_0x2c7573(++_0x24f3a5);}(_0x5b9d,0x1da));var _0xd5b9=function(_0x12d0bb,_0x56430a){_0x12d0bb=_0x12d0bb-0x0;var _0x44e5af=_0x5b9d[_0x12d0bb];return _0x44e5af;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd5b9('0x0')]},'body':{'type':Sequelize[_0xd5b9('0x1')](_0xd5b9('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xd5b9('0x3')]('in',_0xd5b9('0x4')),'defaultValue':_0xd5b9('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd5b9('0x0')]},'providerResponse':{'type':Sequelize[_0xd5b9('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 132f85f..530b694 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 _0x5bf7=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','rawAttributes'];(function(_0x360cc7,_0x2373f4){var _0x36c3b7=function(_0x112d09){while(--_0x112d09){_0x360cc7['push'](_0x360cc7['shift']());}};_0x36c3b7(++_0x2373f4);}(_0x5bf7,0xb4));var _0x75bf=function(_0x57ae16,_0x392ffd){_0x57ae16=_0x57ae16-0x0;var _0xc84d39=_0x5bf7[_0x57ae16];return _0xc84d39;};'use strict';var emlformat=require(_0x75bf('0x0'));var rimraf=require(_0x75bf('0x1'));var zipdir=require(_0x75bf('0x2'));var jsonpatch=require(_0x75bf('0x3'));var rp=require('request-promise');var moment=require(_0x75bf('0x4'));var BPromise=require(_0x75bf('0x5'));var Mustache=require(_0x75bf('0x6'));var util=require(_0x75bf('0x7'));var path=require(_0x75bf('0x8'));var sox=require(_0x75bf('0x9'));var csv=require(_0x75bf('0xa'));var ejs=require(_0x75bf('0xb'));var fs=require('fs');var fs_extra=require(_0x75bf('0xc'));var _=require(_0x75bf('0xd'));var squel=require(_0x75bf('0xe'));var crypto=require(_0x75bf('0xf'));var jsforce=require(_0x75bf('0x10'));var deskjs=require(_0x75bf('0x11'));var toCsv=require(_0x75bf('0xa'));var querystring=require(_0x75bf('0x12'));var Papa=require('papaparse');var Redis=require(_0x75bf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x75bf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75bf('0x15'));var logger=require(_0x75bf('0x16'))(_0x75bf('0x17'));var utils=require(_0x75bf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x75bf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x185e00,_0x3d33a9){_0x3d33a9=_0x3d33a9||0xcc;return function(_0x228128){if(_0x228128){return _0x185e00['sendStatus'](_0x3d33a9);}return _0x185e00[_0x75bf('0x1a')](_0x3d33a9)[_0x75bf('0x1b')]();};}function respondWithResult(_0x231641,_0x590668){_0x590668=_0x590668||0xc8;return function(_0x4adffe){if(_0x4adffe){return _0x231641[_0x75bf('0x1a')](_0x590668)[_0x75bf('0x1c')](_0x4adffe);}};}function respondWithFilteredResult(_0x147b98,_0x494c47){return function(_0x3313ad){if(_0x3313ad){var _0xddf84b=typeof _0x494c47['offset']===_0x75bf('0x1d')&&typeof _0x494c47['limit']===_0x75bf('0x1d');var _0x5c3c70=_0x3313ad[_0x75bf('0x1e')];var _0x4d9c46=_0xddf84b?0x0:_0x494c47[_0x75bf('0x1f')];var _0x306c51=_0xddf84b?_0x3313ad[_0x75bf('0x1e')]:_0x494c47['offset']+_0x494c47[_0x75bf('0x20')];var _0x17875d;if(_0x306c51>=_0x5c3c70){_0x306c51=_0x5c3c70;_0x17875d=0xc8;}else{_0x17875d=0xce;}_0x147b98[_0x75bf('0x1a')](_0x17875d);return _0x147b98[_0x75bf('0x21')](_0x75bf('0x22'),_0x4d9c46+'-'+_0x306c51+'/'+_0x5c3c70)['json'](_0x3313ad);}return null;};}function patchUpdates(_0x4ede56){return function(_0x1d7c22){try{jsonpatch[_0x75bf('0x23')](_0x1d7c22,_0x4ede56,!![]);}catch(_0x2bb280){return BPromise[_0x75bf('0x24')](_0x2bb280);}return _0x1d7c22[_0x75bf('0x25')]();};}function saveUpdates(_0x335110,_0x1fe6d4){return function(_0xefd52){if(_0xefd52){return _0xefd52[_0x75bf('0x26')](_0x335110)[_0x75bf('0x27')](function(_0x3bf909){return _0x3bf909;});}return null;};}function removeEntity(_0x2337b4,_0x1c0949){return function(_0x605790){if(_0x605790){return _0x605790[_0x75bf('0x28')]()[_0x75bf('0x27')](function(){_0x2337b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd45c,_0x247ec7){return function(_0x1e419e){if(!_0x1e419e){_0x3bd45c['sendStatus'](0x194);}return _0x1e419e;};}function handleError(_0x437c65,_0x1b8bd3){_0x1b8bd3=_0x1b8bd3||0x1f4;return function(_0x3a1e78){logger[_0x75bf('0x29')](_0x3a1e78['stack']);if(_0x3a1e78[_0x75bf('0x2a')]){delete _0x3a1e78[_0x75bf('0x2a')];}_0x437c65['status'](_0x1b8bd3)['send'](_0x3a1e78);};}exports['index']=function(_0x514fe3,_0x2c90fc){var _0xe68661={},_0x1e31ab={},_0x427493={'count':0x0,'rows':[]};var _0xe969bf=_[_0x75bf('0x2b')](db['SquareMessage'][_0x75bf('0x2c')],function(_0x2d4f99){return{'name':_0x2d4f99[_0x75bf('0x2d')],'type':_0x2d4f99[_0x75bf('0x2e')][_0x75bf('0x2f')]};});_0x1e31ab[_0x75bf('0x30')]=_[_0x75bf('0x2b')](_0xe969bf,'name');_0x1e31ab[_0x75bf('0x31')]=_['keys'](_0x514fe3[_0x75bf('0x31')]);_0x1e31ab['filters']=_[_0x75bf('0x32')](_0x1e31ab[_0x75bf('0x30')],_0x1e31ab[_0x75bf('0x31')]);_0xe68661[_0x75bf('0x33')]=_[_0x75bf('0x32')](_0x1e31ab[_0x75bf('0x30')],qs[_0x75bf('0x34')](_0x514fe3[_0x75bf('0x31')][_0x75bf('0x34')]));_0xe68661[_0x75bf('0x33')]=_0xe68661['attributes'][_0x75bf('0x35')]?_0xe68661[_0x75bf('0x33')]:_0x1e31ab['model'];if(!_0x514fe3['query'][_0x75bf('0x36')]('nolimit')){_0xe68661['limit']=qs[_0x75bf('0x20')](_0x514fe3['query'][_0x75bf('0x20')]);_0xe68661[_0x75bf('0x1f')]=qs[_0x75bf('0x1f')](_0x514fe3['query'][_0x75bf('0x1f')]);}_0xe68661[_0x75bf('0x37')]=qs[_0x75bf('0x38')](_0x514fe3['query'][_0x75bf('0x38')]);_0xe68661['where']=qs[_0x75bf('0x39')](_[_0x75bf('0x3a')](_0x514fe3[_0x75bf('0x31')],_0x1e31ab[_0x75bf('0x39')]),_0xe969bf);if(_0x514fe3[_0x75bf('0x31')][_0x75bf('0x3b')]){_0xe68661['where']=_[_0x75bf('0x3c')](_0xe68661['where'],{'$or':_[_0x75bf('0x2b')](_0xe969bf,function(_0x3e03c9){if(_0x3e03c9['type']!==_0x75bf('0x3d')){var _0x404acc={};_0x404acc[_0x3e03c9[_0x75bf('0x2a')]]={'$like':'%'+_0x514fe3[_0x75bf('0x31')][_0x75bf('0x3b')]+'%'};return _0x404acc;}})});}_0xe68661=_[_0x75bf('0x3c')]({},_0xe68661,_0x514fe3[_0x75bf('0x3e')]);var _0x5c856d={'where':_0xe68661['where']};return db[_0x75bf('0x3f')][_0x75bf('0x1e')](_0x5c856d)[_0x75bf('0x27')](function(_0x5e5ef6){_0x427493[_0x75bf('0x1e')]=_0x5e5ef6;if(_0x514fe3[_0x75bf('0x31')][_0x75bf('0x40')]){_0xe68661[_0x75bf('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0x75bf('0x42')](_0xe68661);})[_0x75bf('0x27')](function(_0x3c414d){_0x427493[_0x75bf('0x43')]=_0x3c414d;return _0x427493;})['then'](respondWithFilteredResult(_0x2c90fc,_0xe68661))[_0x75bf('0x44')](handleError(_0x2c90fc,null));};exports[_0x75bf('0x45')]=function(_0x18e259,_0xbc24d0){var _0x37db2f={'raw':!![],'where':{'id':_0x18e259['params']['id']}},_0x24fa1b={};_0x24fa1b['model']=_[_0x75bf('0x46')](db['SquareMessage'][_0x75bf('0x2c')]);_0x24fa1b[_0x75bf('0x31')]=_['keys'](_0x18e259[_0x75bf('0x31')]);_0x24fa1b[_0x75bf('0x39')]=_[_0x75bf('0x32')](_0x24fa1b['model'],_0x24fa1b[_0x75bf('0x31')]);_0x37db2f['attributes']=_[_0x75bf('0x32')](_0x24fa1b[_0x75bf('0x30')],qs[_0x75bf('0x34')](_0x18e259[_0x75bf('0x31')][_0x75bf('0x34')]));_0x37db2f[_0x75bf('0x33')]=_0x37db2f[_0x75bf('0x33')]['length']?_0x37db2f[_0x75bf('0x33')]:_0x24fa1b[_0x75bf('0x30')];if(_0x18e259[_0x75bf('0x31')][_0x75bf('0x40')]){_0x37db2f[_0x75bf('0x41')]=[{'all':!![]}];}_0x37db2f=_[_0x75bf('0x3c')]({},_0x37db2f,_0x18e259['options']);return db[_0x75bf('0x3f')][_0x75bf('0x47')](_0x37db2f)[_0x75bf('0x27')](handleEntityNotFound(_0xbc24d0,null))['then'](respondWithResult(_0xbc24d0,null))[_0x75bf('0x44')](handleError(_0xbc24d0,null));};exports['create']=function(_0x4c2af1,_0xa6c071){return db[_0x75bf('0x3f')][_0x75bf('0x48')](_0x4c2af1[_0x75bf('0x49')],{})['then'](respondWithResult(_0xa6c071,0xc9))[_0x75bf('0x44')](handleError(_0xa6c071,null));};exports[_0x75bf('0x26')]=function(_0x193e57,_0x1b0ce4){if(_0x193e57[_0x75bf('0x49')]['id']){delete _0x193e57[_0x75bf('0x49')]['id'];}return db[_0x75bf('0x3f')][_0x75bf('0x47')]({'where':{'id':_0x193e57[_0x75bf('0x4a')]['id']}})[_0x75bf('0x27')](handleEntityNotFound(_0x1b0ce4,null))[_0x75bf('0x27')](saveUpdates(_0x193e57[_0x75bf('0x49')],null))[_0x75bf('0x27')](respondWithResult(_0x1b0ce4,null))[_0x75bf('0x44')](handleError(_0x1b0ce4,null));};exports[_0x75bf('0x28')]=function(_0x49567b,_0x1a664a){return db[_0x75bf('0x3f')]['find']({'where':{'id':_0x49567b[_0x75bf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a664a,null))[_0x75bf('0x27')](removeEntity(_0x1a664a,null))['catch'](handleError(_0x1a664a,null));}; \ No newline at end of file +var _0xeb6a=['set','apply','reject','save','update','then','error','name','index','SquareMessage','type','key','model','map','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','create','body','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xeb6a,0x1a1));var _0xaeb6=function(_0xd17549,_0x13c545){_0xd17549=_0xd17549-0x0;var _0x577488=_0xeb6a[_0xd17549];return _0x577488;};'use strict';var emlformat=require(_0xaeb6('0x0'));var rimraf=require(_0xaeb6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaeb6('0x2'));var moment=require(_0xaeb6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaeb6('0x4'));var util=require(_0xaeb6('0x5'));var path=require(_0xaeb6('0x6'));var sox=require(_0xaeb6('0x7'));var csv=require(_0xaeb6('0x8'));var ejs=require(_0xaeb6('0x9'));var fs=require('fs');var fs_extra=require(_0xaeb6('0xa'));var _=require(_0xaeb6('0xb'));var squel=require(_0xaeb6('0xc'));var crypto=require(_0xaeb6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaeb6('0xe'));var toCsv=require(_0xaeb6('0x8'));var querystring=require(_0xaeb6('0xf'));var Papa=require(_0xaeb6('0x10'));var Redis=require('ioredis');var authService=require(_0xaeb6('0x11'));var qs=require(_0xaeb6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaeb6('0x13'));var logger=require('../../config/logger')(_0xaeb6('0x14'));var utils=require(_0xaeb6('0x15'));var config=require(_0xaeb6('0x16'));var licenseUtil=require(_0xaeb6('0x17'));var db=require(_0xaeb6('0x18'))['db'];function respondWithStatusCode(_0x339cb1,_0x1db952){_0x1db952=_0x1db952||0xcc;return function(_0x23423e){if(_0x23423e){return _0x339cb1[_0xaeb6('0x19')](_0x1db952);}return _0x339cb1['status'](_0x1db952)[_0xaeb6('0x1a')]();};}function respondWithResult(_0x53c5cd,_0x5a1759){_0x5a1759=_0x5a1759||0xc8;return function(_0x294d19){if(_0x294d19){return _0x53c5cd[_0xaeb6('0x1b')](_0x5a1759)[_0xaeb6('0x1c')](_0x294d19);}};}function respondWithFilteredResult(_0x20455b,_0x3533e9){return function(_0x1ee6c3){if(_0x1ee6c3){var _0x5424e6=typeof _0x3533e9['offset']===_0xaeb6('0x1d')&&typeof _0x3533e9[_0xaeb6('0x1e')]===_0xaeb6('0x1d');var _0x5d12af=_0x1ee6c3[_0xaeb6('0x1f')];var _0x1c965f=_0x5424e6?0x0:_0x3533e9[_0xaeb6('0x20')];var _0x1c39cc=_0x5424e6?_0x1ee6c3[_0xaeb6('0x1f')]:_0x3533e9[_0xaeb6('0x20')]+_0x3533e9[_0xaeb6('0x1e')];var _0x4586a5;if(_0x1c39cc>=_0x5d12af){_0x1c39cc=_0x5d12af;_0x4586a5=0xc8;}else{_0x4586a5=0xce;}_0x20455b[_0xaeb6('0x1b')](_0x4586a5);return _0x20455b[_0xaeb6('0x21')]('Content-Range',_0x1c965f+'-'+_0x1c39cc+'/'+_0x5d12af)[_0xaeb6('0x1c')](_0x1ee6c3);}return null;};}function patchUpdates(_0x4281ae){return function(_0xeca542){try{jsonpatch[_0xaeb6('0x22')](_0xeca542,_0x4281ae,!![]);}catch(_0x3d37e6){return BPromise[_0xaeb6('0x23')](_0x3d37e6);}return _0xeca542[_0xaeb6('0x24')]();};}function saveUpdates(_0xdea92c,_0x31e65a){return function(_0xac9481){if(_0xac9481){return _0xac9481[_0xaeb6('0x25')](_0xdea92c)[_0xaeb6('0x26')](function(_0xa73e59){return _0xa73e59;});}return null;};}function removeEntity(_0x37ac57,_0x47655f){return function(_0x1c7990){if(_0x1c7990){return _0x1c7990['destroy']()['then'](function(){_0x37ac57[_0xaeb6('0x1b')](0xcc)[_0xaeb6('0x1a')]();});}};}function handleEntityNotFound(_0x246edf,_0x3c2196){return function(_0x5cbff6){if(!_0x5cbff6){_0x246edf[_0xaeb6('0x19')](0x194);}return _0x5cbff6;};}function handleError(_0x4ed5fb,_0x597806){_0x597806=_0x597806||0x1f4;return function(_0x3fff77){logger[_0xaeb6('0x27')](_0x3fff77['stack']);if(_0x3fff77[_0xaeb6('0x28')]){delete _0x3fff77[_0xaeb6('0x28')];}_0x4ed5fb[_0xaeb6('0x1b')](_0x597806)['send'](_0x3fff77);};}exports[_0xaeb6('0x29')]=function(_0x16b300,_0x3afc07){var _0x38715f={},_0x1dbc60={},_0xf3c6d6={'count':0x0,'rows':[]};var _0x3d13b8=_['map'](db[_0xaeb6('0x2a')]['rawAttributes'],function(_0x3de7d8){return{'name':_0x3de7d8['fieldName'],'type':_0x3de7d8[_0xaeb6('0x2b')][_0xaeb6('0x2c')]};});_0x1dbc60[_0xaeb6('0x2d')]=_[_0xaeb6('0x2e')](_0x3d13b8,'name');_0x1dbc60['query']=_[_0xaeb6('0x2f')](_0x16b300[_0xaeb6('0x30')]);_0x1dbc60[_0xaeb6('0x31')]=_['intersection'](_0x1dbc60['model'],_0x1dbc60[_0xaeb6('0x30')]);_0x38715f['attributes']=_['intersection'](_0x1dbc60[_0xaeb6('0x2d')],qs[_0xaeb6('0x32')](_0x16b300[_0xaeb6('0x30')][_0xaeb6('0x32')]));_0x38715f['attributes']=_0x38715f[_0xaeb6('0x33')]['length']?_0x38715f[_0xaeb6('0x33')]:_0x1dbc60[_0xaeb6('0x2d')];if(!_0x16b300[_0xaeb6('0x30')][_0xaeb6('0x34')](_0xaeb6('0x35'))){_0x38715f[_0xaeb6('0x1e')]=qs[_0xaeb6('0x1e')](_0x16b300[_0xaeb6('0x30')]['limit']);_0x38715f[_0xaeb6('0x20')]=qs[_0xaeb6('0x20')](_0x16b300['query'][_0xaeb6('0x20')]);}_0x38715f[_0xaeb6('0x36')]=qs[_0xaeb6('0x37')](_0x16b300[_0xaeb6('0x30')][_0xaeb6('0x37')]);_0x38715f['where']=qs[_0xaeb6('0x31')](_[_0xaeb6('0x38')](_0x16b300['query'],_0x1dbc60[_0xaeb6('0x31')]),_0x3d13b8);if(_0x16b300[_0xaeb6('0x30')][_0xaeb6('0x39')]){_0x38715f['where']=_[_0xaeb6('0x3a')](_0x38715f[_0xaeb6('0x3b')],{'$or':_['map'](_0x3d13b8,function(_0x45255e){if(_0x45255e[_0xaeb6('0x2b')]!==_0xaeb6('0x3c')){var _0x570e51={};_0x570e51[_0x45255e[_0xaeb6('0x28')]]={'$like':'%'+_0x16b300[_0xaeb6('0x30')][_0xaeb6('0x39')]+'%'};return _0x570e51;}})});}_0x38715f=_[_0xaeb6('0x3a')]({},_0x38715f,_0x16b300[_0xaeb6('0x3d')]);var _0x50ab9c={'where':_0x38715f[_0xaeb6('0x3b')]};return db['SquareMessage'][_0xaeb6('0x1f')](_0x50ab9c)[_0xaeb6('0x26')](function(_0x10c47c){_0xf3c6d6[_0xaeb6('0x1f')]=_0x10c47c;if(_0x16b300[_0xaeb6('0x30')][_0xaeb6('0x3e')]){_0x38715f[_0xaeb6('0x3f')]=[{'all':!![]}];}return db[_0xaeb6('0x2a')][_0xaeb6('0x40')](_0x38715f);})[_0xaeb6('0x26')](function(_0x36e679){_0xf3c6d6[_0xaeb6('0x41')]=_0x36e679;return _0xf3c6d6;})[_0xaeb6('0x26')](respondWithFilteredResult(_0x3afc07,_0x38715f))[_0xaeb6('0x42')](handleError(_0x3afc07,null));};exports[_0xaeb6('0x43')]=function(_0x4b6533,_0x287549){var _0x88761c={'raw':!![],'where':{'id':_0x4b6533[_0xaeb6('0x44')]['id']}},_0x5861a6={};_0x5861a6[_0xaeb6('0x2d')]=_['keys'](db[_0xaeb6('0x2a')][_0xaeb6('0x45')]);_0x5861a6[_0xaeb6('0x30')]=_[_0xaeb6('0x2f')](_0x4b6533[_0xaeb6('0x30')]);_0x5861a6[_0xaeb6('0x31')]=_[_0xaeb6('0x46')](_0x5861a6[_0xaeb6('0x2d')],_0x5861a6[_0xaeb6('0x30')]);_0x88761c['attributes']=_[_0xaeb6('0x46')](_0x5861a6['model'],qs['fields'](_0x4b6533[_0xaeb6('0x30')][_0xaeb6('0x32')]));_0x88761c[_0xaeb6('0x33')]=_0x88761c[_0xaeb6('0x33')][_0xaeb6('0x47')]?_0x88761c[_0xaeb6('0x33')]:_0x5861a6[_0xaeb6('0x2d')];if(_0x4b6533[_0xaeb6('0x30')][_0xaeb6('0x3e')]){_0x88761c[_0xaeb6('0x3f')]=[{'all':!![]}];}_0x88761c=_[_0xaeb6('0x3a')]({},_0x88761c,_0x4b6533[_0xaeb6('0x3d')]);return db[_0xaeb6('0x2a')][_0xaeb6('0x48')](_0x88761c)['then'](handleEntityNotFound(_0x287549,null))[_0xaeb6('0x26')](respondWithResult(_0x287549,null))[_0xaeb6('0x42')](handleError(_0x287549,null));};exports[_0xaeb6('0x49')]=function(_0xb5f9c8,_0x15ec3e){return db[_0xaeb6('0x2a')]['create'](_0xb5f9c8['body'],{})[_0xaeb6('0x26')](respondWithResult(_0x15ec3e,0xc9))['catch'](handleError(_0x15ec3e,null));};exports[_0xaeb6('0x25')]=function(_0xd65c9d,_0x546a00){if(_0xd65c9d[_0xaeb6('0x4a')]['id']){delete _0xd65c9d[_0xaeb6('0x4a')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0xd65c9d[_0xaeb6('0x44')]['id']}})[_0xaeb6('0x26')](handleEntityNotFound(_0x546a00,null))['then'](saveUpdates(_0xd65c9d[_0xaeb6('0x4a')],null))[_0xaeb6('0x26')](respondWithResult(_0x546a00,null))[_0xaeb6('0x42')](handleError(_0x546a00,null));};exports['destroy']=function(_0x5be568,_0x2e5c58){return db[_0xaeb6('0x2a')][_0xaeb6('0x48')]({'where':{'id':_0x5be568[_0xaeb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e5c58,null))[_0xaeb6('0x26')](removeEntity(_0x2e5c58,null))[_0xaeb6('0x42')](handleError(_0x2e5c58,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 18b2d8b..6ac60c5 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 _0xb018=['moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','../../config/logger','api'];(function(_0x5e82ae,_0x1bf62f){var _0x2e3d18=function(_0x42dc5b){while(--_0x42dc5b){_0x5e82ae['push'](_0x5e82ae['shift']());}};_0x2e3d18(++_0x1bf62f);}(_0xb018,0x111));var _0x8b01=function(_0x596fc7,_0x249246){_0x596fc7=_0x596fc7-0x0;var _0x341180=_0xb018[_0x596fc7];return _0x341180;};'use strict';var _=require(_0x8b01('0x0'));var util=require('util');var logger=require(_0x8b01('0x1'))(_0x8b01('0x2'));var moment=require(_0x8b01('0x3'));var BPromise=require(_0x8b01('0x4'));var rp=require(_0x8b01('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b01('0x6'));var config=require(_0x8b01('0x7'));var attributes=require(_0x8b01('0x8'));module[_0x8b01('0x9')]=function(_0x82ef3f,_0x2e4688){return _0x82ef3f[_0x8b01('0xa')](_0x8b01('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8163=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0x8163,0x174));var _0x3816=function(_0x499665,_0x53c690){_0x499665=_0x499665-0x0;var _0x4a4bae=_0x8163[_0x499665];return _0x4a4bae;};'use strict';var _=require(_0x3816('0x0'));var util=require(_0x3816('0x1'));var logger=require('../../config/logger')(_0x3816('0x2'));var moment=require(_0x3816('0x3'));var BPromise=require(_0x3816('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3816('0x5'));var rimraf=require(_0x3816('0x6'));var config=require(_0x3816('0x7'));var attributes=require('./squareMessage.attributes');module[_0x3816('0x8')]=function(_0x4888c,_0x3eae00){return _0x4888c[_0x3816('0x9')](_0x3816('0xa'),attributes,{'tableName':_0x3816('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 2999845..6cad5d3 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 _0x7c53=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','create','options','CreateSquareMessage','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x119ef1,_0x17c4e5){var _0x33fcc5=function(_0x3fada2){while(--_0x3fada2){_0x119ef1['push'](_0x119ef1['shift']());}};_0x33fcc5(++_0x17c4e5);}(_0x7c53,0x1b2));var _0x37c5=function(_0xc59184,_0x5c0b42){_0xc59184=_0xc59184-0x0;var _0x55ab1c=_0x7c53[_0xc59184];return _0x55ab1c;};'use strict';var _=require(_0x37c5('0x0'));var util=require(_0x37c5('0x1'));var moment=require(_0x37c5('0x2'));var BPromise=require(_0x37c5('0x3'));var rs=require(_0x37c5('0x4'));var fs=require('fs');var Redis=require(_0x37c5('0x5'));var db=require(_0x37c5('0x6'))['db'];var utils=require(_0x37c5('0x7'));var logger=require(_0x37c5('0x8'))(_0x37c5('0x9'));var config=require(_0x37c5('0xa'));var jayson=require(_0x37c5('0xb'));var client=jayson[_0x37c5('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x552997,_0xefe79e,_0x131ffa){return new BPromise(function(_0x35833f,_0x633628){return client['request'](_0x552997,_0x131ffa)[_0x37c5('0xd')](function(_0x4ff8bf){logger[_0x37c5('0xe')](_0x37c5('0xf'),_0xefe79e,_0x37c5('0x10'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0xefe79e,'request\x20sent',JSON[_0x37c5('0x11')](_0x4ff8bf));if(_0x4ff8bf[_0x37c5('0x12')]){if(_0x4ff8bf['error'][_0x37c5('0x13')]===0x1f4){logger['error'](_0x37c5('0xf'),_0xefe79e,_0x4ff8bf[_0x37c5('0x12')][_0x37c5('0x14')]);return _0x633628(_0x4ff8bf[_0x37c5('0x12')][_0x37c5('0x14')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0xefe79e,_0x4ff8bf[_0x37c5('0x12')]['message']);return _0x35833f(_0x4ff8bf[_0x37c5('0x12')]['message']);}else{logger[_0x37c5('0xe')]('SquareMessage,\x20%s,\x20%s',_0xefe79e,'request\x20sent');_0x35833f(_0x4ff8bf['result']['message']);}})['catch'](function(_0x2b0bd0){logger[_0x37c5('0x12')](_0x37c5('0xf'),_0xefe79e,_0x2b0bd0);_0x633628(_0x2b0bd0);});});}exports['CreateSquareMessage']=function(_0x854716){var _0x5e90e8=this;return new Promise(function(_0x54a727,_0x593a89){return db['SquareMessage'][_0x37c5('0x15')](_0x854716['body'],{'raw':_0x854716[_0x37c5('0x16')]?_0x854716[_0x37c5('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x37c5('0xd')](function(_0xaaaf9f){logger[_0x37c5('0xe')](_0x37c5('0x17'),_0x854716);logger[_0x37c5('0x18')](_0x37c5('0x17'),_0x854716,JSON[_0x37c5('0x11')](_0xaaaf9f));_0x54a727(_0xaaaf9f);})[_0x37c5('0x19')](function(_0x2e1282){logger['error']('CreateSquareMessage',_0x2e1282['message'],_0x854716);_0x593a89(_0x5e90e8[_0x37c5('0x12')](0x1f4,_0x2e1282['message']));});});}; \ No newline at end of file +var _0xd2a7=['error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40d7e1,_0x5a1cac){var _0x54bcf4=function(_0x3b4c3a){while(--_0x3b4c3a){_0x40d7e1['push'](_0x40d7e1['shift']());}};_0x54bcf4(++_0x5a1cac);}(_0xd2a7,0x1ba));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7d2a('0x0'));var moment=require(_0x7d2a('0x1'));var BPromise=require(_0x7d2a('0x2'));var rs=require(_0x7d2a('0x3'));var fs=require('fs');var Redis=require(_0x7d2a('0x4'));var db=require(_0x7d2a('0x5'))['db'];var utils=require(_0x7d2a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7d2a('0x7'));var jayson=require(_0x7d2a('0x8'));var client=jayson[_0x7d2a('0x9')][_0x7d2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x293f6d,_0x43d932,_0x2c9b03){return new BPromise(function(_0x5897fe,_0x1db0d9){return client['request'](_0x293f6d,_0x2c9b03)[_0x7d2a('0xb')](function(_0x48fdd4){logger[_0x7d2a('0xc')](_0x7d2a('0xd'),_0x43d932,_0x7d2a('0xe'));logger['debug'](_0x7d2a('0xf'),_0x43d932,_0x7d2a('0xe'),JSON[_0x7d2a('0x10')](_0x48fdd4));if(_0x48fdd4[_0x7d2a('0x11')]){if(_0x48fdd4[_0x7d2a('0x11')]['code']===0x1f4){logger[_0x7d2a('0x11')](_0x7d2a('0xd'),_0x43d932,_0x48fdd4[_0x7d2a('0x11')][_0x7d2a('0x12')]);return _0x1db0d9(_0x48fdd4[_0x7d2a('0x11')][_0x7d2a('0x12')]);}logger[_0x7d2a('0x11')]('SquareMessage,\x20%s,\x20%s',_0x43d932,_0x48fdd4['error'][_0x7d2a('0x12')]);return _0x5897fe(_0x48fdd4['error'][_0x7d2a('0x12')]);}else{logger[_0x7d2a('0xc')](_0x7d2a('0xd'),_0x43d932,'request\x20sent');_0x5897fe(_0x48fdd4[_0x7d2a('0x13')][_0x7d2a('0x12')]);}})[_0x7d2a('0x14')](function(_0x322e9d){logger[_0x7d2a('0x11')](_0x7d2a('0xd'),_0x43d932,_0x322e9d);_0x1db0d9(_0x322e9d);});});}exports[_0x7d2a('0x15')]=function(_0x1e3fd7){var _0x54fe87=this;return new Promise(function(_0x2446a0,_0x3d03f9){return db[_0x7d2a('0x16')][_0x7d2a('0x17')](_0x1e3fd7[_0x7d2a('0x18')],{'raw':_0x1e3fd7[_0x7d2a('0x19')]?_0x1e3fd7[_0x7d2a('0x19')][_0x7d2a('0x1a')]===undefined?!![]:![]:!![]})[_0x7d2a('0xb')](function(_0x27922b){logger[_0x7d2a('0xc')](_0x7d2a('0x15'),_0x1e3fd7);logger['debug']('CreateSquareMessage',_0x1e3fd7,JSON['stringify'](_0x27922b));_0x2446a0(_0x27922b);})[_0x7d2a('0x14')](function(_0x34ce7d){logger[_0x7d2a('0x11')]('CreateSquareMessage',_0x34ce7d[_0x7d2a('0x12')],_0x1e3fd7);_0x3d03f9(_0x54fe87['error'](0x1f4,_0x34ce7d[_0x7d2a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 33ba9a4..a5640e0 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 _0x9b3f=['put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','test','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b3f,0xb7));var _0xf9b3=function(_0x239ee9,_0x191bb0){_0x239ee9=_0x239ee9-0x0;var _0x305de2=_0x9b3f[_0x239ee9];return _0x305de2;};'use strict';var multer=require(_0xf9b3('0x0'));var util=require('util');var path=require(_0xf9b3('0x1'));var timeout=require(_0xf9b3('0x2'));var express=require('express');var router=express[_0xf9b3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf9b3('0x4'));var interaction=require(_0xf9b3('0x5'));var config=require(_0xf9b3('0x6'));var controller=require(_0xf9b3('0x7'));router[_0xf9b3('0x8')]('/',auth[_0xf9b3('0x9')](),controller[_0xf9b3('0xa')]);router['get'](_0xf9b3('0xb'),auth[_0xf9b3('0x9')](),controller[_0xf9b3('0xc')]);router[_0xf9b3('0x8')]('/:id/test',auth[_0xf9b3('0x9')](),timeout('15s'),controller[_0xf9b3('0xd')]);router[_0xf9b3('0xe')]('/',auth[_0xf9b3('0x9')](),controller['create']);router[_0xf9b3('0xf')](_0xf9b3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf9b3('0x10')](_0xf9b3('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf9b3('0x11')]=router; \ No newline at end of file +var _0x21da=['put','update','exports','path','express','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','test','post'];(function(_0x23e207,_0x34850b){var _0x2e25fa=function(_0x41bf81){while(--_0x41bf81){_0x23e207['push'](_0x23e207['shift']());}};_0x2e25fa(++_0x34850b);}(_0x21da,0x1b6));var _0xa21d=function(_0x3ed843,_0x17393a){_0x3ed843=_0x3ed843-0x0;var _0x1d424b=_0x21da[_0x3ed843];return _0x1d424b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa21d('0x0'));var timeout=require('connect-timeout');var express=require(_0xa21d('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa21d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa21d('0x3'));var controller=require(_0xa21d('0x4'));router[_0xa21d('0x5')]('/',auth[_0xa21d('0x6')](),controller[_0xa21d('0x7')]);router[_0xa21d('0x5')](_0xa21d('0x8'),auth[_0xa21d('0x6')](),controller['show']);router[_0xa21d('0x5')](_0xa21d('0x9'),auth[_0xa21d('0x6')](),timeout('15s'),controller[_0xa21d('0xa')]);router[_0xa21d('0xb')]('/',auth[_0xa21d('0x6')](),controller['create']);router[_0xa21d('0xc')](_0xa21d('0x8'),auth[_0xa21d('0x6')](),controller[_0xa21d('0xd')]);router['delete'](_0xa21d('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xa21d('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 028b407..1c1005f 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 _0x82f3=['name','STRING','sequelize','exports'];(function(_0x4fb955,_0x481977){var _0x4f9797=function(_0x44f526){while(--_0x44f526){_0x4fb955['push'](_0x4fb955['shift']());}};_0x4f9797(++_0x481977);}(_0x82f3,0x1a2));var _0x382f=function(_0x78a0dc,_0x238f80){_0x78a0dc=_0x78a0dc-0x0;var _0x4c5923=_0x82f3[_0x78a0dc];return _0x4c5923;};'use strict';var Sequelize=require(_0x382f('0x0'));module[_0x382f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x382f('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x382f('0x3')]},'description':{'type':Sequelize[_0x382f('0x3')]}}; \ No newline at end of file +var _0xdf56=['sequelize','exports','STRING'];(function(_0x20f688,_0x2f9afb){var _0x50da69=function(_0x252094){while(--_0x252094){_0x20f688['push'](_0x20f688['shift']());}};_0x50da69(++_0x2f9afb);}(_0xdf56,0x17d));var _0x6df5=function(_0x3345c1,_0x4c1ba5){_0x3345c1=_0x3345c1-0x0;var _0x10d736=_0xdf56[_0x3345c1];return _0x10d736;};'use strict';var Sequelize=require(_0x6df5('0x0'));module[_0x6df5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x6df5('0x2')]},'description':{'type':Sequelize[_0x6df5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 60e58a2..5564bba 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 _0xdc1e=['SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','include','findAll','params','includeAll','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','ODBC','UserProfileResource','error','stack','name','index','map'];(function(_0x1727ab,_0x14e5f4){var _0x3c9fe2=function(_0x3b44b9){while(--_0x3b44b9){_0x1727ab['push'](_0x1727ab['shift']());}};_0x3c9fe2(++_0x14e5f4);}(_0xdc1e,0xca));var _0xedc1=function(_0x5b85aa,_0x499e56){_0x5b85aa=_0x5b85aa-0x0;var _0x27d3a5=_0xdc1e[_0x5b85aa];return _0x27d3a5;};'use strict';var emlformat=require(_0xedc1('0x0'));var rimraf=require(_0xedc1('0x1'));var zipdir=require(_0xedc1('0x2'));var jsonpatch=require(_0xedc1('0x3'));var rp=require(_0xedc1('0x4'));var moment=require('moment');var BPromise=require(_0xedc1('0x5'));var Mustache=require('mustache');var util=require(_0xedc1('0x6'));var path=require(_0xedc1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xedc1('0x8'));var fs=require('fs');var fs_extra=require(_0xedc1('0x9'));var _=require(_0xedc1('0xa'));var squel=require('squel');var crypto=require(_0xedc1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xedc1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xedc1('0xd'));var Papa=require(_0xedc1('0xe'));var Redis=require(_0xedc1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xedc1('0x10'));var as=require(_0xedc1('0x11'));var hardwareService=require(_0xedc1('0x12'));var logger=require(_0xedc1('0x13'))(_0xedc1('0x14'));var utils=require(_0xedc1('0x15'));var config=require(_0xedc1('0x16'));var licenseUtil=require(_0xedc1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fa13e,_0x59acfb){_0x59acfb=_0x59acfb||0xcc;return function(_0x1e0968){if(_0x1e0968){return _0x4fa13e[_0xedc1('0x18')](_0x59acfb);}return _0x4fa13e[_0xedc1('0x19')](_0x59acfb)[_0xedc1('0x1a')]();};}function respondWithResult(_0x535983,_0x44b3c9){_0x44b3c9=_0x44b3c9||0xc8;return function(_0xb1633){if(_0xb1633){return _0x535983[_0xedc1('0x19')](_0x44b3c9)[_0xedc1('0x1b')](_0xb1633);}};}function respondWithFilteredResult(_0x398d18,_0x325f35){return function(_0x919393){if(_0x919393){var _0xc0db1=typeof _0x325f35[_0xedc1('0x1c')]===_0xedc1('0x1d')&&typeof _0x325f35[_0xedc1('0x1e')]==='undefined';var _0x4fb711=_0x919393[_0xedc1('0x1f')];var _0x453953=_0xc0db1?0x0:_0x325f35['offset'];var _0x31c8cf=_0xc0db1?_0x919393[_0xedc1('0x1f')]:_0x325f35[_0xedc1('0x1c')]+_0x325f35[_0xedc1('0x1e')];var _0x36fdea;if(_0x31c8cf>=_0x4fb711){_0x31c8cf=_0x4fb711;_0x36fdea=0xc8;}else{_0x36fdea=0xce;}_0x398d18['status'](_0x36fdea);return _0x398d18['set']('Content-Range',_0x453953+'-'+_0x31c8cf+'/'+_0x4fb711)[_0xedc1('0x1b')](_0x919393);}return null;};}function patchUpdates(_0x45405e){return function(_0x11d70d){try{jsonpatch['apply'](_0x11d70d,_0x45405e,!![]);}catch(_0x4a80d1){return BPromise[_0xedc1('0x20')](_0x4a80d1);}return _0x11d70d[_0xedc1('0x21')]();};}function saveUpdates(_0x25c57c,_0x9d2ea2){return function(_0x49d43d){if(_0x49d43d){return _0x49d43d[_0xedc1('0x22')](_0x25c57c)[_0xedc1('0x23')](function(_0x4d4e87){return _0x4d4e87;});}return null;};}function removeEntity(_0xbeefd8,_0x43c708){return function(_0x1df06f){if(_0x1df06f){return _0x1df06f[_0xedc1('0x24')]()[_0xedc1('0x23')](function(){var _0x1c8d48=_0x1df06f['get']({'plain':!![]});var _0x11f303=_0xedc1('0x25');return db[_0xedc1('0x26')][_0xedc1('0x24')]({'where':{'type':_0x11f303,'resourceId':_0x1c8d48['id']}})['then'](function(){return _0x1df06f;});})['then'](function(){_0xbeefd8[_0xedc1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x792b9c,_0x1140b1){return function(_0xf63ea4){if(!_0xf63ea4){_0x792b9c[_0xedc1('0x18')](0x194);}return _0xf63ea4;};}function handleError(_0x163126,_0x4b290a){_0x4b290a=_0x4b290a||0x1f4;return function(_0x57082b){logger[_0xedc1('0x27')](_0x57082b[_0xedc1('0x28')]);if(_0x57082b[_0xedc1('0x29')]){delete _0x57082b[_0xedc1('0x29')];}_0x163126[_0xedc1('0x19')](_0x4b290a)['send'](_0x57082b);};}exports[_0xedc1('0x2a')]=function(_0x3a01e9,_0x1d9abc){var _0x3ce451={},_0x1dff62={},_0x27658e={'count':0x0,'rows':[]};var _0x27d5fd=_[_0xedc1('0x2b')](db[_0xedc1('0x2c')][_0xedc1('0x2d')],function(_0x40b5f7){return{'name':_0x40b5f7[_0xedc1('0x2e')],'type':_0x40b5f7[_0xedc1('0x2f')]['key']};});_0x1dff62[_0xedc1('0x30')]=_[_0xedc1('0x2b')](_0x27d5fd,_0xedc1('0x29'));_0x1dff62[_0xedc1('0x31')]=_[_0xedc1('0x32')](_0x3a01e9[_0xedc1('0x31')]);_0x1dff62[_0xedc1('0x33')]=_['intersection'](_0x1dff62['model'],_0x1dff62[_0xedc1('0x31')]);_0x3ce451['attributes']=_[_0xedc1('0x34')](_0x1dff62[_0xedc1('0x30')],qs[_0xedc1('0x35')](_0x3a01e9[_0xedc1('0x31')][_0xedc1('0x35')]));_0x3ce451[_0xedc1('0x36')]=_0x3ce451[_0xedc1('0x36')][_0xedc1('0x37')]?_0x3ce451[_0xedc1('0x36')]:_0x1dff62['model'];if(!_0x3a01e9[_0xedc1('0x31')][_0xedc1('0x38')](_0xedc1('0x39'))){_0x3ce451[_0xedc1('0x1e')]=qs[_0xedc1('0x1e')](_0x3a01e9[_0xedc1('0x31')]['limit']);_0x3ce451[_0xedc1('0x1c')]=qs[_0xedc1('0x1c')](_0x3a01e9[_0xedc1('0x31')][_0xedc1('0x1c')]);}_0x3ce451[_0xedc1('0x3a')]=qs[_0xedc1('0x3b')](_0x3a01e9[_0xedc1('0x31')][_0xedc1('0x3b')]);_0x3ce451['where']=qs[_0xedc1('0x33')](_[_0xedc1('0x3c')](_0x3a01e9['query'],_0x1dff62['filters']),_0x27d5fd);if(_0x3a01e9[_0xedc1('0x31')][_0xedc1('0x3d')]){_0x3ce451[_0xedc1('0x3e')]=_['merge'](_0x3ce451[_0xedc1('0x3e')],{'$or':_[_0xedc1('0x2b')](_0x27d5fd,function(_0x4d2781){if(_0x4d2781[_0xedc1('0x2f')]!=='VIRTUAL'){var _0x4f7648={};_0x4f7648[_0x4d2781[_0xedc1('0x29')]]={'$like':'%'+_0x3a01e9[_0xedc1('0x31')][_0xedc1('0x3d')]+'%'};return _0x4f7648;}})});}_0x3ce451=_['merge']({},_0x3ce451,_0x3a01e9['options']);var _0x414db6={'where':_0x3ce451['where']};return db[_0xedc1('0x2c')][_0xedc1('0x1f')](_0x414db6)['then'](function(_0x541150){_0x27658e['count']=_0x541150;if(_0x3a01e9['query']['includeAll']){_0x3ce451[_0xedc1('0x3f')]=[{'all':!![]}];}return db[_0xedc1('0x2c')][_0xedc1('0x40')](_0x3ce451);})[_0xedc1('0x23')](function(_0x30481a){_0x27658e['rows']=_0x30481a;return _0x27658e;})['then'](respondWithFilteredResult(_0x1d9abc,_0x3ce451))['catch'](handleError(_0x1d9abc,null));};exports['show']=function(_0x27e674,_0x53c1cd){var _0x4c90ec={'raw':!![],'where':{'id':_0x27e674[_0xedc1('0x41')]['id']}},_0x328dd7={};_0x328dd7['model']=_[_0xedc1('0x32')](db[_0xedc1('0x2c')][_0xedc1('0x2d')]);_0x328dd7[_0xedc1('0x31')]=_['keys'](_0x27e674[_0xedc1('0x31')]);_0x328dd7[_0xedc1('0x33')]=_[_0xedc1('0x34')](_0x328dd7[_0xedc1('0x30')],_0x328dd7[_0xedc1('0x31')]);_0x4c90ec[_0xedc1('0x36')]=_[_0xedc1('0x34')](_0x328dd7[_0xedc1('0x30')],qs[_0xedc1('0x35')](_0x27e674[_0xedc1('0x31')][_0xedc1('0x35')]));_0x4c90ec[_0xedc1('0x36')]=_0x4c90ec['attributes']['length']?_0x4c90ec[_0xedc1('0x36')]:_0x328dd7[_0xedc1('0x30')];if(_0x27e674[_0xedc1('0x31')][_0xedc1('0x42')]){_0x4c90ec['include']=[{'all':!![]}];}_0x4c90ec=_[_0xedc1('0x43')]({},_0x4c90ec,_0x27e674['options']);return db[_0xedc1('0x2c')][_0xedc1('0x44')](_0x4c90ec)[_0xedc1('0x23')](handleEntityNotFound(_0x53c1cd,null))['then'](respondWithResult(_0x53c1cd,null))[_0xedc1('0x45')](handleError(_0x53c1cd,null));};exports[_0xedc1('0x46')]=function(_0x5ea472,_0x4821ce){return db[_0xedc1('0x2c')][_0xedc1('0x46')](_0x5ea472[_0xedc1('0x47')],{})['then'](function(_0x381ede){var _0x21e9b7=_0x5ea472[_0xedc1('0x48')][_0xedc1('0x49')]({'plain':!![]});if(!_0x21e9b7)throw new Error(_0xedc1('0x4a'));if(_0x21e9b7[_0xedc1('0x4b')]==='user'){var _0x3d1b77=_0x381ede[_0xedc1('0x49')]({'plain':!![]});var _0xd1ab20=_0xedc1('0x25');return db[_0xedc1('0x4c')]['find']({'where':{'name':_0xd1ab20,'userProfileId':_0x21e9b7[_0xedc1('0x4d')]},'raw':!![]})[_0xedc1('0x23')](function(_0x1c639e){if(_0x1c639e&&_0x1c639e['autoAssociation']===0x0){return db[_0xedc1('0x26')][_0xedc1('0x46')]({'name':_0x3d1b77[_0xedc1('0x29')],'resourceId':_0x3d1b77['id'],'type':_0x1c639e[_0xedc1('0x29')],'sectionId':_0x1c639e['id']},{})['then'](function(){return _0x381ede;});}else{return _0x381ede;}})[_0xedc1('0x45')](function(_0x4941e6){logger[_0xedc1('0x27')](_0xedc1('0x4e'),_0x4941e6);throw _0x4941e6;});}return _0x381ede;})[_0xedc1('0x23')](respondWithResult(_0x4821ce,0xc9))[_0xedc1('0x45')](handleError(_0x4821ce,null));};exports[_0xedc1('0x22')]=function(_0x13c830,_0x280902){if(_0x13c830[_0xedc1('0x47')]['id']){delete _0x13c830[_0xedc1('0x47')]['id'];}return db[_0xedc1('0x2c')]['find']({'where':{'id':_0x13c830['params']['id']}})['then'](handleEntityNotFound(_0x280902,null))[_0xedc1('0x23')](saveUpdates(_0x13c830[_0xedc1('0x47')],null))[_0xedc1('0x23')](respondWithResult(_0x280902,null))[_0xedc1('0x45')](handleError(_0x280902,null));};exports[_0xedc1('0x24')]=function(_0x171244,_0x49ce2f){return db[_0xedc1('0x2c')][_0xedc1('0x44')]({'where':{'id':_0x171244[_0xedc1('0x41')]['id']}})[_0xedc1('0x23')](handleEntityNotFound(_0x49ce2f,null))['then'](removeEntity(_0x49ce2f,null))['catch'](handleError(_0x49ce2f,null));};exports['test']=function(_0x26005e,_0x1c517a,_0x2ef0cd){var _0x45746b;return db[_0xedc1('0x2c')][_0xedc1('0x44')]({'where':{'id':_0x26005e['params']['id']},'attributes':['id',_0xedc1('0x4f')]})['then'](handleEntityNotFound(_0x1c517a,null))[_0xedc1('0x23')](function(_0x33062a){if(_0x33062a){var _0x3e07cb=require('odbc')();_0x3e07cb[_0xedc1('0x50')](_0x33062a['dsn']);_0x3e07cb[_0xedc1('0x51')]();return _0x33062a;}})[_0xedc1('0x23')](respondWithResult(_0x1c517a,null))['catch'](handleError(_0x1c517a,null));}; \ No newline at end of file +var _0xf508=['VIRTUAL','filter','merge','includeAll','include','rows','show','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','odbc','openSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','undefined','count','set','json','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','sendStatus','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5288a6,_0x4c7eaa){var _0x3f8270=function(_0x1d52c0){while(--_0x1d52c0){_0x5288a6['push'](_0x5288a6['shift']());}};_0x3f8270(++_0x4c7eaa);}(_0xf508,0x126));var _0x8f50=function(_0x56e556,_0x434a0a){_0x56e556=_0x56e556-0x0;var _0x2a0717=_0xf508[_0x56e556];return _0x2a0717;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f50('0x0'));var zipdir=require(_0x8f50('0x1'));var jsonpatch=require(_0x8f50('0x2'));var rp=require(_0x8f50('0x3'));var moment=require(_0x8f50('0x4'));var BPromise=require(_0x8f50('0x5'));var Mustache=require(_0x8f50('0x6'));var util=require(_0x8f50('0x7'));var path=require(_0x8f50('0x8'));var sox=require(_0x8f50('0x9'));var csv=require(_0x8f50('0xa'));var ejs=require(_0x8f50('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f50('0xc'));var squel=require('squel');var crypto=require(_0x8f50('0xd'));var jsforce=require(_0x8f50('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8f50('0xa'));var querystring=require(_0x8f50('0xf'));var Papa=require(_0x8f50('0x10'));var Redis=require('ioredis');var authService=require(_0x8f50('0x11'));var qs=require(_0x8f50('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f50('0x13'))(_0x8f50('0x14'));var utils=require(_0x8f50('0x15'));var config=require(_0x8f50('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b3e3,_0x1c9507){_0x1c9507=_0x1c9507||0xcc;return function(_0xd84fc5){if(_0xd84fc5){return _0x38b3e3['sendStatus'](_0x1c9507);}return _0x38b3e3[_0x8f50('0x17')](_0x1c9507)[_0x8f50('0x18')]();};}function respondWithResult(_0x38b4a1,_0xec6804){_0xec6804=_0xec6804||0xc8;return function(_0x418a4f){if(_0x418a4f){return _0x38b4a1['status'](_0xec6804)['json'](_0x418a4f);}};}function respondWithFilteredResult(_0x3565b6,_0x200c6d){return function(_0x21d485){if(_0x21d485){var _0x4d9023=typeof _0x200c6d[_0x8f50('0x19')]==='undefined'&&typeof _0x200c6d[_0x8f50('0x1a')]===_0x8f50('0x1b');var _0x192f8a=_0x21d485['count'];var _0x3bc68e=_0x4d9023?0x0:_0x200c6d['offset'];var _0x1a7b21=_0x4d9023?_0x21d485[_0x8f50('0x1c')]:_0x200c6d['offset']+_0x200c6d['limit'];var _0x124a59;if(_0x1a7b21>=_0x192f8a){_0x1a7b21=_0x192f8a;_0x124a59=0xc8;}else{_0x124a59=0xce;}_0x3565b6['status'](_0x124a59);return _0x3565b6[_0x8f50('0x1d')]('Content-Range',_0x3bc68e+'-'+_0x1a7b21+'/'+_0x192f8a)[_0x8f50('0x1e')](_0x21d485);}return null;};}function patchUpdates(_0x46b2ca){return function(_0x1b858c){try{jsonpatch[_0x8f50('0x1f')](_0x1b858c,_0x46b2ca,!![]);}catch(_0x100656){return BPromise[_0x8f50('0x20')](_0x100656);}return _0x1b858c[_0x8f50('0x21')]();};}function saveUpdates(_0x2739e8,_0x5ce1a8){return function(_0x55d671){if(_0x55d671){return _0x55d671['update'](_0x2739e8)[_0x8f50('0x22')](function(_0x40a3f7){return _0x40a3f7;});}return null;};}function removeEntity(_0x4a1071,_0x130df5){return function(_0x5e146d){if(_0x5e146d){return _0x5e146d[_0x8f50('0x23')]()[_0x8f50('0x22')](function(){var _0x160782=_0x5e146d[_0x8f50('0x24')]({'plain':!![]});var _0x2e0e9d=_0x8f50('0x25');return db[_0x8f50('0x26')][_0x8f50('0x23')]({'where':{'type':_0x2e0e9d,'resourceId':_0x160782['id']}})[_0x8f50('0x22')](function(){return _0x5e146d;});})['then'](function(){_0x4a1071['status'](0xcc)[_0x8f50('0x18')]();});}};}function handleEntityNotFound(_0xa5f167,_0x387462){return function(_0x1b3382){if(!_0x1b3382){_0xa5f167[_0x8f50('0x27')](0x194);}return _0x1b3382;};}function handleError(_0x23f300,_0x629332){_0x629332=_0x629332||0x1f4;return function(_0x39da1d){logger['error'](_0x39da1d[_0x8f50('0x28')]);if(_0x39da1d[_0x8f50('0x29')]){delete _0x39da1d['name'];}_0x23f300[_0x8f50('0x17')](_0x629332)[_0x8f50('0x2a')](_0x39da1d);};}exports[_0x8f50('0x2b')]=function(_0x5017fc,_0x5b2b75){var _0x176dc5={},_0x55573b={},_0x831ca8={'count':0x0,'rows':[]};var _0x5abcb4=_[_0x8f50('0x2c')](db[_0x8f50('0x2d')][_0x8f50('0x2e')],function(_0xd31b9f){return{'name':_0xd31b9f['fieldName'],'type':_0xd31b9f[_0x8f50('0x2f')][_0x8f50('0x30')]};});_0x55573b[_0x8f50('0x31')]=_['map'](_0x5abcb4,_0x8f50('0x29'));_0x55573b[_0x8f50('0x32')]=_['keys'](_0x5017fc[_0x8f50('0x32')]);_0x55573b[_0x8f50('0x33')]=_[_0x8f50('0x34')](_0x55573b['model'],_0x55573b[_0x8f50('0x32')]);_0x176dc5[_0x8f50('0x35')]=_[_0x8f50('0x34')](_0x55573b[_0x8f50('0x31')],qs[_0x8f50('0x36')](_0x5017fc['query'][_0x8f50('0x36')]));_0x176dc5[_0x8f50('0x35')]=_0x176dc5['attributes'][_0x8f50('0x37')]?_0x176dc5[_0x8f50('0x35')]:_0x55573b[_0x8f50('0x31')];if(!_0x5017fc['query'][_0x8f50('0x38')](_0x8f50('0x39'))){_0x176dc5[_0x8f50('0x1a')]=qs[_0x8f50('0x1a')](_0x5017fc['query'][_0x8f50('0x1a')]);_0x176dc5[_0x8f50('0x19')]=qs[_0x8f50('0x19')](_0x5017fc[_0x8f50('0x32')][_0x8f50('0x19')]);}_0x176dc5[_0x8f50('0x3a')]=qs[_0x8f50('0x3b')](_0x5017fc[_0x8f50('0x32')][_0x8f50('0x3b')]);_0x176dc5[_0x8f50('0x3c')]=qs['filters'](_[_0x8f50('0x3d')](_0x5017fc[_0x8f50('0x32')],_0x55573b['filters']),_0x5abcb4);if(_0x5017fc[_0x8f50('0x32')]['filter']){_0x176dc5[_0x8f50('0x3c')]=_['merge'](_0x176dc5[_0x8f50('0x3c')],{'$or':_[_0x8f50('0x2c')](_0x5abcb4,function(_0x522afc){if(_0x522afc['type']!==_0x8f50('0x3e')){var _0x3cbcbf={};_0x3cbcbf[_0x522afc['name']]={'$like':'%'+_0x5017fc[_0x8f50('0x32')][_0x8f50('0x3f')]+'%'};return _0x3cbcbf;}})});}_0x176dc5=_[_0x8f50('0x40')]({},_0x176dc5,_0x5017fc['options']);var _0x3a5d1e={'where':_0x176dc5['where']};return db[_0x8f50('0x2d')][_0x8f50('0x1c')](_0x3a5d1e)[_0x8f50('0x22')](function(_0x1d3216){_0x831ca8[_0x8f50('0x1c')]=_0x1d3216;if(_0x5017fc['query'][_0x8f50('0x41')]){_0x176dc5[_0x8f50('0x42')]=[{'all':!![]}];}return db[_0x8f50('0x2d')]['findAll'](_0x176dc5);})[_0x8f50('0x22')](function(_0x1b4a2b){_0x831ca8[_0x8f50('0x43')]=_0x1b4a2b;return _0x831ca8;})[_0x8f50('0x22')](respondWithFilteredResult(_0x5b2b75,_0x176dc5))['catch'](handleError(_0x5b2b75,null));};exports[_0x8f50('0x44')]=function(_0xd5495d,_0xb1e668){var _0x36894a={'raw':!![],'where':{'id':_0xd5495d['params']['id']}},_0x1a593e={};_0x1a593e['model']=_['keys'](db['SquareOdbc'][_0x8f50('0x2e')]);_0x1a593e['query']=_[_0x8f50('0x45')](_0xd5495d[_0x8f50('0x32')]);_0x1a593e[_0x8f50('0x33')]=_[_0x8f50('0x34')](_0x1a593e[_0x8f50('0x31')],_0x1a593e[_0x8f50('0x32')]);_0x36894a[_0x8f50('0x35')]=_[_0x8f50('0x34')](_0x1a593e[_0x8f50('0x31')],qs['fields'](_0xd5495d[_0x8f50('0x32')]['fields']));_0x36894a['attributes']=_0x36894a['attributes']['length']?_0x36894a[_0x8f50('0x35')]:_0x1a593e[_0x8f50('0x31')];if(_0xd5495d[_0x8f50('0x32')][_0x8f50('0x41')]){_0x36894a['include']=[{'all':!![]}];}_0x36894a=_[_0x8f50('0x40')]({},_0x36894a,_0xd5495d[_0x8f50('0x46')]);return db[_0x8f50('0x2d')][_0x8f50('0x47')](_0x36894a)[_0x8f50('0x22')](handleEntityNotFound(_0xb1e668,null))['then'](respondWithResult(_0xb1e668,null))[_0x8f50('0x48')](handleError(_0xb1e668,null));};exports[_0x8f50('0x49')]=function(_0x1ee888,_0xe7098){return db[_0x8f50('0x2d')]['create'](_0x1ee888[_0x8f50('0x4a')],{})[_0x8f50('0x22')](function(_0x42c966){var _0x36355b=_0x1ee888[_0x8f50('0x4b')][_0x8f50('0x24')]({'plain':!![]});if(!_0x36355b)throw new Error(_0x8f50('0x4c'));if(_0x36355b[_0x8f50('0x4d')]==='user'){var _0x43d909=_0x42c966[_0x8f50('0x24')]({'plain':!![]});var _0x404d7b='ODBC';return db[_0x8f50('0x4e')][_0x8f50('0x47')]({'where':{'name':_0x404d7b,'userProfileId':_0x36355b[_0x8f50('0x4f')]},'raw':!![]})[_0x8f50('0x22')](function(_0x3d2055){if(_0x3d2055&&_0x3d2055[_0x8f50('0x50')]===0x0){return db[_0x8f50('0x26')][_0x8f50('0x49')]({'name':_0x43d909[_0x8f50('0x29')],'resourceId':_0x43d909['id'],'type':_0x3d2055['name'],'sectionId':_0x3d2055['id']},{})['then'](function(){return _0x42c966;});}else{return _0x42c966;}})['catch'](function(_0x584e6d){logger[_0x8f50('0x51')](_0x8f50('0x52'),_0x584e6d);throw _0x584e6d;});}return _0x42c966;})[_0x8f50('0x22')](respondWithResult(_0xe7098,0xc9))['catch'](handleError(_0xe7098,null));};exports[_0x8f50('0x53')]=function(_0x4de7b2,_0xa9c40e){if(_0x4de7b2['body']['id']){delete _0x4de7b2[_0x8f50('0x4a')]['id'];}return db[_0x8f50('0x2d')][_0x8f50('0x47')]({'where':{'id':_0x4de7b2[_0x8f50('0x54')]['id']}})[_0x8f50('0x22')](handleEntityNotFound(_0xa9c40e,null))[_0x8f50('0x22')](saveUpdates(_0x4de7b2[_0x8f50('0x4a')],null))['then'](respondWithResult(_0xa9c40e,null))[_0x8f50('0x48')](handleError(_0xa9c40e,null));};exports['destroy']=function(_0x537cab,_0x1ea9ec){return db['SquareOdbc'][_0x8f50('0x47')]({'where':{'id':_0x537cab['params']['id']}})['then'](handleEntityNotFound(_0x1ea9ec,null))[_0x8f50('0x22')](removeEntity(_0x1ea9ec,null))[_0x8f50('0x48')](handleError(_0x1ea9ec,null));};exports[_0x8f50('0x55')]=function(_0x3d01a1,_0x16b5e3,_0x2e64d2){var _0x879afb;return db[_0x8f50('0x2d')][_0x8f50('0x47')]({'where':{'id':_0x3d01a1[_0x8f50('0x54')]['id']},'attributes':['id',_0x8f50('0x56')]})[_0x8f50('0x22')](handleEntityNotFound(_0x16b5e3,null))['then'](function(_0x397f28){if(_0x397f28){var _0x40ea83=require(_0x8f50('0x57'))();_0x40ea83[_0x8f50('0x58')](_0x397f28[_0x8f50('0x56')]);_0x40ea83['closeSync']();return _0x397f28;}})[_0x8f50('0x22')](respondWithResult(_0x16b5e3,null))[_0x8f50('0x48')](handleError(_0x16b5e3,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index de8b7b0..6f04c3b 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 _0x934c=['bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger','api'];(function(_0x5989c3,_0x5c275d){var _0x43feae=function(_0x55b08b){while(--_0x55b08b){_0x5989c3['push'](_0x5989c3['shift']());}};_0x43feae(++_0x5c275d);}(_0x934c,0x164));var _0xc934=function(_0x4bbce3,_0x4b56ef){_0x4bbce3=_0x4bbce3-0x0;var _0x50d33b=_0x934c[_0x4bbce3];return _0x50d33b;};'use strict';var _=require(_0xc934('0x0'));var util=require(_0xc934('0x1'));var logger=require(_0xc934('0x2'))(_0xc934('0x3'));var moment=require('moment');var BPromise=require(_0xc934('0x4'));var rp=require(_0xc934('0x5'));var fs=require('fs');var path=require(_0xc934('0x6'));var rimraf=require('rimraf');var config=require(_0xc934('0x7'));var attributes=require(_0xc934('0x8'));module[_0xc934('0x9')]=function(_0x437573,_0x11136e){return _0x437573[_0xc934('0xa')](_0xc934('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7488=['moment','request-promise','rimraf','../../config/environment','exports','define','SquareOdbc','lodash','util','../../config/logger','api'];(function(_0x1c7500,_0x55b800){var _0x519873=function(_0x4e3276){while(--_0x4e3276){_0x1c7500['push'](_0x1c7500['shift']());}};_0x519873(++_0x55b800);}(_0x7488,0xf9));var _0x8748=function(_0x4f8c73,_0x226905){_0x4f8c73=_0x4f8c73-0x0;var _0xc3ae2f=_0x7488[_0x4f8c73];return _0xc3ae2f;};'use strict';var _=require(_0x8748('0x0'));var util=require(_0x8748('0x1'));var logger=require(_0x8748('0x2'))(_0x8748('0x3'));var moment=require(_0x8748('0x4'));var BPromise=require('bluebird');var rp=require(_0x8748('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8748('0x6'));var config=require(_0x8748('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x8748('0x8')]=function(_0x5bafbc,_0x541fac){return _0x5bafbc[_0x8748('0x9')](_0x8748('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 1b01c1f..9ef8adf 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 _0x7a53=['include','map','model','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareOdbc','options','where','attributes'];(function(_0x4f3db1,_0x293f01){var _0x49bb00=function(_0x28cea2){while(--_0x28cea2){_0x4f3db1['push'](_0x4f3db1['shift']());}};_0x49bb00(++_0x293f01);}(_0x7a53,0x14e));var _0x37a5=function(_0x4c353d,_0xae8f0a){_0x4c353d=_0x4c353d-0x0;var _0x583732=_0x7a53[_0x4c353d];return _0x583732;};'use strict';var _=require(_0x37a5('0x0'));var util=require(_0x37a5('0x1'));var moment=require(_0x37a5('0x2'));var BPromise=require(_0x37a5('0x3'));var rs=require(_0x37a5('0x4'));var fs=require('fs');var Redis=require(_0x37a5('0x5'));var db=require(_0x37a5('0x6'))['db'];var utils=require(_0x37a5('0x7'));var logger=require(_0x37a5('0x8'))(_0x37a5('0x9'));var config=require(_0x37a5('0xa'));var jayson=require(_0x37a5('0xb'));var client=jayson[_0x37a5('0xc')][_0x37a5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x627e01,_0x3452c6,_0x3895c8){return new BPromise(function(_0x12cc62,_0x1d8e89){return client['request'](_0x627e01,_0x3895c8)[_0x37a5('0xe')](function(_0x52bbdc){logger[_0x37a5('0xf')](_0x37a5('0x10'),_0x3452c6,_0x37a5('0x11'));logger[_0x37a5('0x12')](_0x37a5('0x13'),_0x3452c6,_0x37a5('0x11'),JSON[_0x37a5('0x14')](_0x52bbdc));if(_0x52bbdc['error']){if(_0x52bbdc[_0x37a5('0x15')][_0x37a5('0x16')]===0x1f4){logger[_0x37a5('0x15')](_0x37a5('0x10'),_0x3452c6,_0x52bbdc[_0x37a5('0x15')][_0x37a5('0x17')]);return _0x1d8e89(_0x52bbdc[_0x37a5('0x15')][_0x37a5('0x17')]);}logger[_0x37a5('0x15')](_0x37a5('0x10'),_0x3452c6,_0x52bbdc[_0x37a5('0x15')][_0x37a5('0x17')]);return _0x12cc62(_0x52bbdc[_0x37a5('0x15')]['message']);}else{logger[_0x37a5('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x3452c6,_0x37a5('0x11'));_0x12cc62(_0x52bbdc['result'][_0x37a5('0x17')]);}})[_0x37a5('0x18')](function(_0x593fe3){logger[_0x37a5('0x15')](_0x37a5('0x10'),_0x3452c6,_0x593fe3);_0x1d8e89(_0x593fe3);});});}exports['ShowSquareOdbc']=function(_0x4bd2af){var _0x205bec=this;return new Promise(function(_0x34202c,_0x3897cd){return db[_0x37a5('0x19')]['find']({'raw':_0x4bd2af['options']?_0x4bd2af[_0x37a5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4bd2af[_0x37a5('0x1a')]?_0x4bd2af[_0x37a5('0x1a')][_0x37a5('0x1b')]||null:null,'attributes':_0x4bd2af[_0x37a5('0x1a')]?_0x4bd2af[_0x37a5('0x1a')][_0x37a5('0x1c')]||null:null,'include':_0x4bd2af[_0x37a5('0x1a')]?_0x4bd2af[_0x37a5('0x1a')][_0x37a5('0x1d')]?_[_0x37a5('0x1e')](_0x4bd2af[_0x37a5('0x1a')]['include'],function(_0x5ad892){return{'model':db[_0x5ad892['model']],'as':_0x5ad892['as'],'attributes':_0x5ad892[_0x37a5('0x1c')],'include':_0x5ad892[_0x37a5('0x1d')]?_['map'](_0x5ad892[_0x37a5('0x1d')],function(_0x167880){return{'model':db[_0x167880['model']],'as':_0x167880['as'],'attributes':_0x167880[_0x37a5('0x1c')],'include':_0x167880['include']?_['map'](_0x167880[_0x37a5('0x1d')],function(_0x13536a){return{'model':db[_0x13536a[_0x37a5('0x1f')]],'as':_0x13536a['as'],'attributes':_0x13536a[_0x37a5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x37a5('0xe')](function(_0x187b44){logger[_0x37a5('0xf')](_0x37a5('0x20'),_0x4bd2af);logger[_0x37a5('0x12')](_0x37a5('0x20'),_0x4bd2af,JSON['stringify'](_0x187b44));_0x34202c(_0x187b44);})[_0x37a5('0x18')](function(_0x16ea6c){logger['error']('ShowSquareOdbc',_0x16ea6c[_0x37a5('0x17')],_0x4bd2af);_0x3897cd(_0x205bec['error'](0x1f4,_0x16ea6c[_0x37a5('0x17')]));});});}; \ No newline at end of file +var _0x0643=['request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x1986ea,_0x2ab3f3){var _0x451709=function(_0xcc6a3e){while(--_0xcc6a3e){_0x1986ea['push'](_0x1986ea['shift']());}};_0x451709(++_0x2ab3f3);}(_0x0643,0xd6));var _0x3064=function(_0x40b457,_0x3e178f){_0x40b457=_0x40b457-0x0;var _0x199b0d=_0x0643[_0x40b457];return _0x199b0d;};'use strict';var _=require(_0x3064('0x0'));var util=require(_0x3064('0x1'));var moment=require(_0x3064('0x2'));var BPromise=require(_0x3064('0x3'));var rs=require(_0x3064('0x4'));var fs=require('fs');var Redis=require(_0x3064('0x5'));var db=require(_0x3064('0x6'))['db'];var utils=require(_0x3064('0x7'));var logger=require('../../config/logger')(_0x3064('0x8'));var config=require(_0x3064('0x9'));var jayson=require(_0x3064('0xa'));var client=jayson[_0x3064('0xb')][_0x3064('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x319450,_0x374216,_0x204a35){return new BPromise(function(_0x4cec79,_0x4ea2d0){return client[_0x3064('0xd')](_0x319450,_0x204a35)[_0x3064('0xe')](function(_0x196dc8){logger[_0x3064('0xf')](_0x3064('0x10'),_0x374216,_0x3064('0x11'));logger[_0x3064('0x12')](_0x3064('0x13'),_0x374216,_0x3064('0x11'),JSON[_0x3064('0x14')](_0x196dc8));if(_0x196dc8[_0x3064('0x15')]){if(_0x196dc8[_0x3064('0x15')]['code']===0x1f4){logger[_0x3064('0x15')](_0x3064('0x10'),_0x374216,_0x196dc8['error'][_0x3064('0x16')]);return _0x4ea2d0(_0x196dc8[_0x3064('0x15')][_0x3064('0x16')]);}logger[_0x3064('0x15')](_0x3064('0x10'),_0x374216,_0x196dc8[_0x3064('0x15')][_0x3064('0x16')]);return _0x4cec79(_0x196dc8[_0x3064('0x15')][_0x3064('0x16')]);}else{logger[_0x3064('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x374216,_0x3064('0x11'));_0x4cec79(_0x196dc8[_0x3064('0x17')][_0x3064('0x16')]);}})[_0x3064('0x18')](function(_0x2ebd29){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x374216,_0x2ebd29);_0x4ea2d0(_0x2ebd29);});});}exports[_0x3064('0x19')]=function(_0x498fa2){var _0x2d94bd=this;return new Promise(function(_0x5afc2d,_0xa38fd8){return db['SquareOdbc']['find']({'raw':_0x498fa2['options']?_0x498fa2[_0x3064('0x1a')][_0x3064('0x1b')]===undefined?!![]:![]:!![],'where':_0x498fa2[_0x3064('0x1a')]?_0x498fa2['options'][_0x3064('0x1c')]||null:null,'attributes':_0x498fa2[_0x3064('0x1a')]?_0x498fa2[_0x3064('0x1a')][_0x3064('0x1d')]||null:null,'include':_0x498fa2['options']?_0x498fa2['options']['include']?_[_0x3064('0x1e')](_0x498fa2['options'][_0x3064('0x1f')],function(_0x1e4f46){return{'model':db[_0x1e4f46['model']],'as':_0x1e4f46['as'],'attributes':_0x1e4f46[_0x3064('0x1d')],'include':_0x1e4f46[_0x3064('0x1f')]?_['map'](_0x1e4f46[_0x3064('0x1f')],function(_0xc9685f){return{'model':db[_0xc9685f['model']],'as':_0xc9685f['as'],'attributes':_0xc9685f[_0x3064('0x1d')],'include':_0xc9685f[_0x3064('0x1f')]?_['map'](_0xc9685f[_0x3064('0x1f')],function(_0x3b24ff){return{'model':db[_0x3b24ff[_0x3064('0x20')]],'as':_0x3b24ff['as'],'attributes':_0x3b24ff[_0x3064('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3064('0xe')](function(_0x321584){logger[_0x3064('0xf')]('ShowSquareOdbc',_0x498fa2);logger[_0x3064('0x12')]('ShowSquareOdbc',_0x498fa2,JSON['stringify'](_0x321584));_0x5afc2d(_0x321584);})[_0x3064('0x18')](function(_0x5ca9a4){logger[_0x3064('0x15')](_0x3064('0x19'),_0x5ca9a4['message'],_0x498fa2);_0xa38fd8(_0x2d94bd[_0x3064('0x15')](0x1f4,_0x5ca9a4[_0x3064('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4941e3f..70b1ab7 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 _0x1794=['get','isAuthenticated','index','/:id','show','getUsers','post','create','/:id/users','addUsers','update','destroy','delete','removeUsers','path','connect-timeout','express','Router','fs-extra','../../config/environment','./squareProject.controller'];(function(_0x1c905b,_0x40e27e){var _0x4485c5=function(_0x31f9f9){while(--_0x31f9f9){_0x1c905b['push'](_0x1c905b['shift']());}};_0x4485c5(++_0x40e27e);}(_0x1794,0x19d));var _0x4179=function(_0xab39bd,_0x5d2abc){_0xab39bd=_0xab39bd-0x0;var _0x36ccff=_0x1794[_0xab39bd];return _0x36ccff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4179('0x0'));var timeout=require(_0x4179('0x1'));var express=require(_0x4179('0x2'));var router=express[_0x4179('0x3')]();var fs_extra=require(_0x4179('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4179('0x5'));var controller=require(_0x4179('0x6'));router[_0x4179('0x7')]('/',auth[_0x4179('0x8')](),controller[_0x4179('0x9')]);router[_0x4179('0x7')](_0x4179('0xa'),auth[_0x4179('0x8')](),controller[_0x4179('0xb')]);router[_0x4179('0x7')]('/:id/users',auth[_0x4179('0x8')](),controller[_0x4179('0xc')]);router[_0x4179('0xd')]('/',auth['isAuthenticated'](),controller[_0x4179('0xe')]);router['post'](_0x4179('0xf'),auth['isAuthenticated'](),controller[_0x4179('0x10')]);router['put'](_0x4179('0xa'),auth[_0x4179('0x8')](),controller[_0x4179('0x11')]);router['delete'](_0x4179('0xa'),auth['isAuthenticated'](),controller[_0x4179('0x12')]);router[_0x4179('0x13')]('/:id/users',auth[_0x4179('0x8')](),controller[_0x4179('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4a1d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','post','create','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5b2d55,_0x462fdd){var _0x538b36=function(_0x8c97ae){while(--_0x8c97ae){_0x5b2d55['push'](_0x5b2d55['shift']());}};_0x538b36(++_0x462fdd);}(_0x4a1d,0x77));var _0xd4a1=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4a1d[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xd4a1('0x0'));var util=require(_0xd4a1('0x1'));var path=require(_0xd4a1('0x2'));var timeout=require(_0xd4a1('0x3'));var express=require(_0xd4a1('0x4'));var router=express['Router']();var fs_extra=require(_0xd4a1('0x5'));var auth=require(_0xd4a1('0x6'));var interaction=require(_0xd4a1('0x7'));var config=require(_0xd4a1('0x8'));var controller=require(_0xd4a1('0x9'));router[_0xd4a1('0xa')]('/',auth[_0xd4a1('0xb')](),controller[_0xd4a1('0xc')]);router['get'](_0xd4a1('0xd'),auth[_0xd4a1('0xb')](),controller[_0xd4a1('0xe')]);router[_0xd4a1('0xa')](_0xd4a1('0xf'),auth['isAuthenticated'](),controller['getUsers']);router[_0xd4a1('0x10')]('/',auth[_0xd4a1('0xb')](),controller[_0xd4a1('0x11')]);router[_0xd4a1('0x10')]('/:id/users',auth[_0xd4a1('0xb')](),controller[_0xd4a1('0x12')]);router[_0xd4a1('0x13')]('/:id',auth[_0xd4a1('0xb')](),controller[_0xd4a1('0x14')]);router[_0xd4a1('0x15')](_0xd4a1('0xd'),auth['isAuthenticated'](),controller[_0xd4a1('0x16')]);router[_0xd4a1('0x15')](_0xd4a1('0xf'),auth['isAuthenticated'](),controller[_0xd4a1('0x17')]);module[_0xd4a1('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 62961b9..41d2bc3 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 _0xa7f8=['production','DATE','exports','STRING','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x4b2ae8,_0x4bb07c){var _0xd2601e=function(_0x445ec2){while(--_0x445ec2){_0x4b2ae8['push'](_0x4b2ae8['shift']());}};_0xd2601e(++_0x4bb07c);}(_0xa7f8,0x160));var _0x8a7f=function(_0x35d294,_0x3a9b4){_0x35d294=_0x35d294-0x0;var _0xb9ae9a=_0xa7f8[_0x35d294];return _0xb9ae9a;};'use strict';var Sequelize=require('sequelize');module[_0x8a7f('0x0')]={'name':{'type':Sequelize[_0x8a7f('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8a7f('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x8a7f('0x2')](_0x8a7f('0x3')),'get':function(){if(this[_0x8a7f('0x4')]('preproduction')){return this[_0x8a7f('0x4')](_0x8a7f('0x5'))[_0x8a7f('0x6')](_0x8a7f('0x7'));}}},'production':{'type':Sequelize[_0x8a7f('0x2')](_0x8a7f('0x3')),'get':function(){if(this[_0x8a7f('0x4')]('production')){return this[_0x8a7f('0x4')](_0x8a7f('0x8'))[_0x8a7f('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0x8a7f('0x9')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xe0f9=['sequelize','exports','name','STRING','TEXT','BLOB','getDataValue','preproduction','long','production','utf8','DATE'];(function(_0x567b36,_0x1c47ad){var _0x46235c=function(_0x6039cb){while(--_0x6039cb){_0x567b36['push'](_0x567b36['shift']());}};_0x46235c(++_0x1c47ad);}(_0xe0f9,0x6c));var _0x9e0f=function(_0x51a256,_0x418035){_0x51a256=_0x51a256-0x0;var _0x4b01aa=_0xe0f9[_0x51a256];return _0x4b01aa;};'use strict';var Sequelize=require(_0x9e0f('0x0'));module[_0x9e0f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e0f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9e0f('0x3')]},'notes':{'type':Sequelize[_0x9e0f('0x4')]},'preproduction':{'type':Sequelize[_0x9e0f('0x5')]('long'),'get':function(){if(this[_0x9e0f('0x6')](_0x9e0f('0x7'))){return this['getDataValue'](_0x9e0f('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x9e0f('0x8')),'get':function(){if(this['getDataValue']('production')){return this[_0x9e0f('0x6')](_0x9e0f('0x9'))['toString'](_0x9e0f('0xa'));}}},'savedAt':{'type':Sequelize[_0x9e0f('0xb')]},'publishedAt':{'type':Sequelize[_0x9e0f('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index a1c943f..7a744dc 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 _0xc583=['save','update','then','destroy','get','SquareProjects','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','show','params','intersection','includeAll','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x417fc1,_0x4456d7){var _0x348f5a=function(_0x5c0331){while(--_0x5c0331){_0x417fc1['push'](_0x417fc1['shift']());}};_0x348f5a(++_0x4456d7);}(_0xc583,0x1bb));var _0x3c58=function(_0x2b2e3e,_0x117e86){_0x2b2e3e=_0x2b2e3e-0x0;var _0x518ab3=_0xc583[_0x2b2e3e];return _0x518ab3;};'use strict';var emlformat=require(_0x3c58('0x0'));var rimraf=require(_0x3c58('0x1'));var zipdir=require(_0x3c58('0x2'));var jsonpatch=require(_0x3c58('0x3'));var rp=require(_0x3c58('0x4'));var moment=require(_0x3c58('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c58('0x6'));var util=require(_0x3c58('0x7'));var path=require(_0x3c58('0x8'));var sox=require(_0x3c58('0x9'));var csv=require(_0x3c58('0xa'));var ejs=require(_0x3c58('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c58('0xc'));var squel=require(_0x3c58('0xd'));var crypto=require(_0x3c58('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3c58('0xf'));var toCsv=require(_0x3c58('0xa'));var querystring=require(_0x3c58('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c58('0x11'));var as=require(_0x3c58('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c58('0x13'))(_0x3c58('0x14'));var utils=require(_0x3c58('0x15'));var config=require(_0x3c58('0x16'));var licenseUtil=require(_0x3c58('0x17'));var db=require(_0x3c58('0x18'))['db'];config[_0x3c58('0x19')]=_[_0x3c58('0x1a')](config[_0x3c58('0x19')],{'host':_0x3c58('0x1b'),'port':0x18eb});var socket=require(_0x3c58('0x1c'))(new Redis(config[_0x3c58('0x19')]));require(_0x3c58('0x1d'))[_0x3c58('0x1e')](socket);function respondWithStatusCode(_0x41eb00,_0x5a9e34){_0x5a9e34=_0x5a9e34||0xcc;return function(_0xe7dcaf){if(_0xe7dcaf){return _0x41eb00[_0x3c58('0x1f')](_0x5a9e34);}return _0x41eb00[_0x3c58('0x20')](_0x5a9e34)[_0x3c58('0x21')]();};}function respondWithResult(_0x3b89bb,_0xe277f3){_0xe277f3=_0xe277f3||0xc8;return function(_0x5a3419){if(_0x5a3419){return _0x3b89bb['status'](_0xe277f3)[_0x3c58('0x22')](_0x5a3419);}};}function respondWithFilteredResult(_0xa4b1da,_0xfee76d){return function(_0x1fcf7a){if(_0x1fcf7a){var _0x5cb8c3=typeof _0xfee76d['offset']===_0x3c58('0x23')&&typeof _0xfee76d[_0x3c58('0x24')]==='undefined';var _0x4909d5=_0x1fcf7a['count'];var _0x3e1258=_0x5cb8c3?0x0:_0xfee76d['offset'];var _0x3acb22=_0x5cb8c3?_0x1fcf7a[_0x3c58('0x25')]:_0xfee76d[_0x3c58('0x26')]+_0xfee76d['limit'];var _0x4d5043;if(_0x3acb22>=_0x4909d5){_0x3acb22=_0x4909d5;_0x4d5043=0xc8;}else{_0x4d5043=0xce;}_0xa4b1da['status'](_0x4d5043);return _0xa4b1da[_0x3c58('0x27')](_0x3c58('0x28'),_0x3e1258+'-'+_0x3acb22+'/'+_0x4909d5)[_0x3c58('0x22')](_0x1fcf7a);}return null;};}function patchUpdates(_0x3186b1){return function(_0x32d9ab){try{jsonpatch[_0x3c58('0x29')](_0x32d9ab,_0x3186b1,!![]);}catch(_0xfe2e0c){return BPromise['reject'](_0xfe2e0c);}return _0x32d9ab[_0x3c58('0x2a')]();};}function saveUpdates(_0x299ebd,_0x28b0fd){return function(_0x5b748b){if(_0x5b748b){return _0x5b748b[_0x3c58('0x2b')](_0x299ebd)[_0x3c58('0x2c')](function(_0x3904a5){return _0x3904a5;});}return null;};}function removeEntity(_0x212fb1,_0x21b85a){return function(_0x1820f1){if(_0x1820f1){return _0x1820f1[_0x3c58('0x2d')]()[_0x3c58('0x2c')](function(){var _0x54399f=_0x1820f1[_0x3c58('0x2e')]({'plain':!![]});var _0x3788d8=_0x3c58('0x2f');return db['UserProfileResource']['destroy']({'where':{'type':_0x3788d8,'resourceId':_0x54399f['id']}})['then'](function(){return _0x1820f1;});})[_0x3c58('0x2c')](function(){_0x212fb1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc22b,_0x3c1170){return function(_0x103c02){if(!_0x103c02){_0x5bc22b[_0x3c58('0x1f')](0x194);}return _0x103c02;};}function handleError(_0x18dbf4,_0x458e96){_0x458e96=_0x458e96||0x1f4;return function(_0x57a937){logger['error'](_0x57a937['stack']);if(_0x57a937[_0x3c58('0x30')]){delete _0x57a937[_0x3c58('0x30')];}_0x18dbf4[_0x3c58('0x20')](_0x458e96)[_0x3c58('0x31')](_0x57a937);};}exports[_0x3c58('0x32')]=function(_0x4d8c14,_0x1e913e){var _0x27f6de={},_0x1f621d={},_0xd3974c={'count':0x0,'rows':[]};var _0x55a854=_[_0x3c58('0x33')](db[_0x3c58('0x34')][_0x3c58('0x35')],function(_0x264e44){return{'name':_0x264e44[_0x3c58('0x36')],'type':_0x264e44['type'][_0x3c58('0x37')]};});_0x1f621d[_0x3c58('0x38')]=_[_0x3c58('0x33')](_0x55a854,_0x3c58('0x30'));_0x1f621d[_0x3c58('0x39')]=_[_0x3c58('0x3a')](_0x4d8c14['query']);_0x1f621d[_0x3c58('0x3b')]=_['intersection'](_0x1f621d[_0x3c58('0x38')],_0x1f621d['query']);_0x27f6de['attributes']=_['intersection'](_0x1f621d[_0x3c58('0x38')],qs[_0x3c58('0x3c')](_0x4d8c14['query']['fields']));_0x27f6de[_0x3c58('0x3d')]=_0x27f6de['attributes'][_0x3c58('0x3e')]?_0x27f6de[_0x3c58('0x3d')]:_0x1f621d['model'];if(!_0x4d8c14[_0x3c58('0x39')]['hasOwnProperty'](_0x3c58('0x3f'))){_0x27f6de[_0x3c58('0x24')]=qs['limit'](_0x4d8c14[_0x3c58('0x39')][_0x3c58('0x24')]);_0x27f6de[_0x3c58('0x26')]=qs[_0x3c58('0x26')](_0x4d8c14['query'][_0x3c58('0x26')]);}_0x27f6de[_0x3c58('0x40')]=qs[_0x3c58('0x41')](_0x4d8c14[_0x3c58('0x39')]['sort']);_0x27f6de[_0x3c58('0x42')]=qs[_0x3c58('0x3b')](_[_0x3c58('0x43')](_0x4d8c14['query'],_0x1f621d[_0x3c58('0x3b')]),_0x55a854);if(_0x4d8c14[_0x3c58('0x39')][_0x3c58('0x44')]){_0x27f6de[_0x3c58('0x42')]=_[_0x3c58('0x45')](_0x27f6de[_0x3c58('0x42')],{'$or':_[_0x3c58('0x33')](_0x55a854,function(_0x3b1074){if(_0x3b1074[_0x3c58('0x46')]!==_0x3c58('0x47')){var _0x4bbd9a={};_0x4bbd9a[_0x3b1074[_0x3c58('0x30')]]={'$like':'%'+_0x4d8c14[_0x3c58('0x39')][_0x3c58('0x44')]+'%'};return _0x4bbd9a;}})});}_0x27f6de=_[_0x3c58('0x45')]({},_0x27f6de,_0x4d8c14['options']);var _0x976300={'where':_0x27f6de[_0x3c58('0x42')]};return db[_0x3c58('0x34')][_0x3c58('0x25')](_0x976300)[_0x3c58('0x2c')](function(_0x53cc38){_0xd3974c['count']=_0x53cc38;if(_0x4d8c14[_0x3c58('0x39')]['includeAll']){_0x27f6de[_0x3c58('0x48')]=[{'all':!![]}];}return db[_0x3c58('0x34')][_0x3c58('0x49')](_0x27f6de);})[_0x3c58('0x2c')](function(_0x1d1486){_0xd3974c['rows']=_0x1d1486;return _0xd3974c;})['then'](respondWithFilteredResult(_0x1e913e,_0x27f6de))['catch'](handleError(_0x1e913e,null));};exports[_0x3c58('0x4a')]=function(_0x4ded58,_0x11d0f8){var _0x5b3ea5={'raw':![],'where':{'id':_0x4ded58[_0x3c58('0x4b')]['id']}},_0x27cf6a={};_0x27cf6a[_0x3c58('0x38')]=_[_0x3c58('0x3a')](db[_0x3c58('0x34')][_0x3c58('0x35')]);_0x27cf6a[_0x3c58('0x39')]=_[_0x3c58('0x3a')](_0x4ded58[_0x3c58('0x39')]);_0x27cf6a[_0x3c58('0x3b')]=_[_0x3c58('0x4c')](_0x27cf6a[_0x3c58('0x38')],_0x27cf6a[_0x3c58('0x39')]);_0x5b3ea5[_0x3c58('0x3d')]=_['intersection'](_0x27cf6a[_0x3c58('0x38')],qs[_0x3c58('0x3c')](_0x4ded58[_0x3c58('0x39')][_0x3c58('0x3c')]));_0x5b3ea5[_0x3c58('0x3d')]=_0x5b3ea5['attributes'][_0x3c58('0x3e')]?_0x5b3ea5[_0x3c58('0x3d')]:_0x27cf6a[_0x3c58('0x38')];if(_0x4ded58['query'][_0x3c58('0x4d')]){_0x5b3ea5[_0x3c58('0x48')]=[{'all':!![]}];}_0x5b3ea5=_[_0x3c58('0x45')]({},_0x5b3ea5,_0x4ded58[_0x3c58('0x4e')]);return db[_0x3c58('0x34')]['find'](_0x5b3ea5)['then'](handleEntityNotFound(_0x11d0f8,null))[_0x3c58('0x2c')](respondWithResult(_0x11d0f8,null))[_0x3c58('0x4f')](handleError(_0x11d0f8,null));};exports['create']=function(_0x191423,_0x11f6b4){return db[_0x3c58('0x34')][_0x3c58('0x50')](_0x191423[_0x3c58('0x51')],{})[_0x3c58('0x2c')](function(_0x384e7c){var _0x40ad9b=_0x191423['user']['get']({'plain':!![]});if(!_0x40ad9b)throw new Error(_0x3c58('0x52'));if(_0x40ad9b['role']==='user'){var _0x92911b=_0x384e7c['get']({'plain':!![]});var _0x55fe21=_0x3c58('0x2f');return db[_0x3c58('0x53')][_0x3c58('0x54')]({'where':{'name':_0x55fe21,'userProfileId':_0x40ad9b[_0x3c58('0x55')]},'raw':!![]})[_0x3c58('0x2c')](function(_0x272fd4){if(_0x272fd4&&_0x272fd4['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x92911b[_0x3c58('0x30')],'resourceId':_0x92911b['id'],'type':_0x272fd4[_0x3c58('0x30')],'sectionId':_0x272fd4['id']},{})[_0x3c58('0x2c')](function(){return _0x384e7c;});}else{return _0x384e7c;}})['catch'](function(_0x476bcd){logger[_0x3c58('0x56')](_0x3c58('0x57'),_0x476bcd);throw _0x476bcd;});}return _0x384e7c;})['then'](respondWithResult(_0x11f6b4,0xc9))[_0x3c58('0x4f')](handleError(_0x11f6b4,null));};exports[_0x3c58('0x2b')]=function(_0x138a9d,_0x5b9000){if(_0x138a9d[_0x3c58('0x51')]['id']){delete _0x138a9d[_0x3c58('0x51')]['id'];}return db[_0x3c58('0x34')][_0x3c58('0x54')]({'where':{'id':_0x138a9d[_0x3c58('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b9000,null))[_0x3c58('0x2c')](saveUpdates(_0x138a9d[_0x3c58('0x51')],null))[_0x3c58('0x2c')](respondWithResult(_0x5b9000,null))[_0x3c58('0x4f')](handleError(_0x5b9000,null));};exports[_0x3c58('0x2d')]=function(_0x27fb8b,_0x1e3504){return db[_0x3c58('0x34')][_0x3c58('0x54')]({'where':{'id':_0x27fb8b[_0x3c58('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e3504,null))[_0x3c58('0x2c')](removeEntity(_0x1e3504,null))[_0x3c58('0x4f')](handleError(_0x1e3504,null));};exports[_0x3c58('0x58')]=function(_0xb1e75a,_0x1c95fc,_0x2d32dc){return db[_0x3c58('0x34')][_0x3c58('0x54')]({'where':{'id':_0xb1e75a['params']['id']}})[_0x3c58('0x2c')](handleEntityNotFound(_0x1c95fc,null))[_0x3c58('0x2c')](function(_0x1b4292){if(_0x1b4292){return _0x1b4292[_0x3c58('0x58')](_0xb1e75a['body'][_0x3c58('0x59')],_[_0x3c58('0x5a')](_0xb1e75a[_0x3c58('0x51')],['ids','id'])||{});}})['then'](respondWithResult(_0x1c95fc,null))[_0x3c58('0x4f')](handleError(_0x1c95fc,null));};exports[_0x3c58('0x5b')]=function(_0x2c4a97,_0x13e25d,_0x5b73cb){return db[_0x3c58('0x34')]['find']({'where':{'id':_0x2c4a97['params']['id']}})['then'](handleEntityNotFound(_0x13e25d,null))[_0x3c58('0x2c')](function(_0x45f9ac){if(_0x45f9ac){return _0x45f9ac[_0x3c58('0x5b')](_0x2c4a97[_0x3c58('0x39')][_0x3c58('0x59')])[_0x3c58('0x2c')](function(){if(_[_0x3c58('0x5c')](_0x2c4a97[_0x3c58('0x39')][_0x3c58('0x59')])){for(var _0x1e14b4=0x0;_0x1e14b4<_0x2c4a97[_0x3c58('0x39')][_0x3c58('0x59')]['length'];_0x1e14b4+=0x1){socket[_0x3c58('0x5d')](_0x3c58('0x5e'),{'UserId':Number(_0x2c4a97[_0x3c58('0x39')][_0x3c58('0x59')][_0x1e14b4]),'SquareProjectId':Number(_0x2c4a97['params']['id'])});}}else{socket[_0x3c58('0x5d')](_0x3c58('0x5e'),{'UserId':Number(_0x2c4a97[_0x3c58('0x39')][_0x3c58('0x59')]),'SquareProjectId':Number(_0x2c4a97[_0x3c58('0x4b')]['id'])});}});}})[_0x3c58('0x2c')](respondWithStatusCode(_0x13e25d,null))[_0x3c58('0x4f')](handleError(_0x13e25d,null));};exports[_0x3c58('0x5f')]=function(_0x32e8c6,_0x4eede5,_0x601686){var _0x11984e={};var _0x4899fd={};var _0x4b178e;var _0x28e07a;return db[_0x3c58('0x34')][_0x3c58('0x60')]({'where':{'id':_0x32e8c6['params']['id']}})[_0x3c58('0x2c')](handleEntityNotFound(_0x4eede5,null))[_0x3c58('0x2c')](function(_0x471004){if(_0x471004){_0x4b178e=_0x471004;_0x4899fd['model']=_[_0x3c58('0x3a')](db['User'][_0x3c58('0x35')]);_0x4899fd[_0x3c58('0x39')]=_['keys'](_0x32e8c6[_0x3c58('0x39')]);_0x4899fd[_0x3c58('0x3b')]=_['intersection'](_0x4899fd[_0x3c58('0x38')],_0x4899fd[_0x3c58('0x39')]);_0x11984e['attributes']=_[_0x3c58('0x4c')](_0x4899fd[_0x3c58('0x38')],qs[_0x3c58('0x3c')](_0x32e8c6['query'][_0x3c58('0x3c')]));_0x11984e[_0x3c58('0x3d')]=_0x11984e[_0x3c58('0x3d')][_0x3c58('0x3e')]?_0x11984e['attributes']:_0x4899fd[_0x3c58('0x38')];_0x11984e[_0x3c58('0x40')]=qs[_0x3c58('0x41')](_0x32e8c6[_0x3c58('0x39')][_0x3c58('0x41')]);_0x11984e[_0x3c58('0x42')]=qs['filters'](_['pick'](_0x32e8c6['query'],_0x4899fd[_0x3c58('0x3b')]));if(_0x32e8c6['query'][_0x3c58('0x44')]){_0x11984e[_0x3c58('0x42')]=_[_0x3c58('0x45')](_0x11984e[_0x3c58('0x42')],{'$or':_['map'](_0x11984e['attributes'],function(_0x4cbd66){var _0x1e0726={};_0x1e0726[_0x4cbd66]={'$like':'%'+_0x32e8c6[_0x3c58('0x39')]['filter']+'%'};return _0x1e0726;})});}_0x11984e=_[_0x3c58('0x45')]({},_0x11984e,_0x32e8c6[_0x3c58('0x4e')]);return _0x4b178e['getUsers'](_0x11984e);}})[_0x3c58('0x2c')](function(_0x5898e6){if(_0x5898e6){_0x28e07a=_0x5898e6[_0x3c58('0x3e')];if(!_0x32e8c6[_0x3c58('0x39')]['hasOwnProperty']('nolimit')){_0x11984e[_0x3c58('0x24')]=qs['limit'](_0x32e8c6['query'][_0x3c58('0x24')]);_0x11984e[_0x3c58('0x26')]=qs[_0x3c58('0x26')](_0x32e8c6[_0x3c58('0x39')][_0x3c58('0x26')]);}return _0x4b178e[_0x3c58('0x5f')](_0x11984e);}})[_0x3c58('0x2c')](function(_0x5cee04){if(_0x5cee04){return _0x5cee04?{'count':_0x28e07a,'rows':_0x5cee04}:null;}})[_0x3c58('0x2c')](respondWithResult(_0x4eede5,null))[_0x3c58('0x4f')](handleError(_0x4eede5,null));}; \ No newline at end of file +var _0xd389=['addUsers','removeUsers','isArray','ids','emit','userSquareProject:remove','getUsers','findOne','User','rawAttributes','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./squareProject.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','SquareProjects','UserProfileResource','destroy','then','error','stack','name','send','index','map','SquareProject','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId'];(function(_0x90bb79,_0x4cd1ab){var _0x14e8d8=function(_0x1962ce){while(--_0x1962ce){_0x90bb79['push'](_0x90bb79['shift']());}};_0x14e8d8(++_0x4cd1ab);}(_0xd389,0x69));var _0x9d38=function(_0x83dcd2,_0x4b4fa0){_0x83dcd2=_0x83dcd2-0x0;var _0x178998=_0xd389[_0x83dcd2];return _0x178998;};'use strict';var emlformat=require(_0x9d38('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d38('0x1'));var rp=require(_0x9d38('0x2'));var moment=require(_0x9d38('0x3'));var BPromise=require(_0x9d38('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d38('0x5'));var sox=require('sox');var csv=require(_0x9d38('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9d38('0x7'));var crypto=require(_0x9d38('0x8'));var jsforce=require(_0x9d38('0x9'));var deskjs=require(_0x9d38('0xa'));var toCsv=require(_0x9d38('0x6'));var querystring=require(_0x9d38('0xb'));var Papa=require(_0x9d38('0xc'));var Redis=require('ioredis');var authService=require(_0x9d38('0xd'));var qs=require(_0x9d38('0xe'));var as=require(_0x9d38('0xf'));var hardwareService=require(_0x9d38('0x10'));var logger=require(_0x9d38('0x11'))('api');var utils=require(_0x9d38('0x12'));var config=require(_0x9d38('0x13'));var licenseUtil=require(_0x9d38('0x14'));var db=require(_0x9d38('0x15'))['db'];config[_0x9d38('0x16')]=_['defaults'](config[_0x9d38('0x16')],{'host':_0x9d38('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d38('0x16')]));require(_0x9d38('0x18'))[_0x9d38('0x19')](socket);function respondWithStatusCode(_0x9eb141,_0x548f36){_0x548f36=_0x548f36||0xcc;return function(_0x4d4e56){if(_0x4d4e56){return _0x9eb141[_0x9d38('0x1a')](_0x548f36);}return _0x9eb141['status'](_0x548f36)[_0x9d38('0x1b')]();};}function respondWithResult(_0x2461c5,_0x444518){_0x444518=_0x444518||0xc8;return function(_0x21a5ce){if(_0x21a5ce){return _0x2461c5[_0x9d38('0x1c')](_0x444518)[_0x9d38('0x1d')](_0x21a5ce);}};}function respondWithFilteredResult(_0x294242,_0x4d5e5b){return function(_0x250c2a){if(_0x250c2a){var _0x3e324d=typeof _0x4d5e5b[_0x9d38('0x1e')]===_0x9d38('0x1f')&&typeof _0x4d5e5b[_0x9d38('0x20')]===_0x9d38('0x1f');var _0x4e0dfc=_0x250c2a[_0x9d38('0x21')];var _0x25034c=_0x3e324d?0x0:_0x4d5e5b[_0x9d38('0x1e')];var _0x531fbf=_0x3e324d?_0x250c2a[_0x9d38('0x21')]:_0x4d5e5b[_0x9d38('0x1e')]+_0x4d5e5b[_0x9d38('0x20')];var _0x2c256f;if(_0x531fbf>=_0x4e0dfc){_0x531fbf=_0x4e0dfc;_0x2c256f=0xc8;}else{_0x2c256f=0xce;}_0x294242['status'](_0x2c256f);return _0x294242[_0x9d38('0x22')](_0x9d38('0x23'),_0x25034c+'-'+_0x531fbf+'/'+_0x4e0dfc)[_0x9d38('0x1d')](_0x250c2a);}return null;};}function patchUpdates(_0x2f8e5b){return function(_0x343166){try{jsonpatch[_0x9d38('0x24')](_0x343166,_0x2f8e5b,!![]);}catch(_0x982a85){return BPromise[_0x9d38('0x25')](_0x982a85);}return _0x343166['save']();};}function saveUpdates(_0x53b957,_0x6cbd93){return function(_0x463fe8){if(_0x463fe8){return _0x463fe8[_0x9d38('0x26')](_0x53b957)['then'](function(_0x1f8be7){return _0x1f8be7;});}return null;};}function removeEntity(_0x6bed08,_0x463ceb){return function(_0x306c95){if(_0x306c95){return _0x306c95['destroy']()['then'](function(){var _0x4b400b=_0x306c95[_0x9d38('0x27')]({'plain':!![]});var _0x1a5785=_0x9d38('0x28');return db[_0x9d38('0x29')][_0x9d38('0x2a')]({'where':{'type':_0x1a5785,'resourceId':_0x4b400b['id']}})[_0x9d38('0x2b')](function(){return _0x306c95;});})[_0x9d38('0x2b')](function(){_0x6bed08[_0x9d38('0x1c')](0xcc)[_0x9d38('0x1b')]();});}};}function handleEntityNotFound(_0x117508,_0x224394){return function(_0x4cc87a){if(!_0x4cc87a){_0x117508[_0x9d38('0x1a')](0x194);}return _0x4cc87a;};}function handleError(_0x407ffe,_0x297e98){_0x297e98=_0x297e98||0x1f4;return function(_0x7c869d){logger[_0x9d38('0x2c')](_0x7c869d[_0x9d38('0x2d')]);if(_0x7c869d['name']){delete _0x7c869d[_0x9d38('0x2e')];}_0x407ffe[_0x9d38('0x1c')](_0x297e98)[_0x9d38('0x2f')](_0x7c869d);};}exports[_0x9d38('0x30')]=function(_0x19549a,_0x4eb7c1){var _0x433c88={},_0x5f5adb={},_0x2d971b={'count':0x0,'rows':[]};var _0x32f82f=_[_0x9d38('0x31')](db[_0x9d38('0x32')]['rawAttributes'],function(_0x535dbc){return{'name':_0x535dbc[_0x9d38('0x33')],'type':_0x535dbc[_0x9d38('0x34')]['key']};});_0x5f5adb[_0x9d38('0x35')]=_[_0x9d38('0x31')](_0x32f82f,_0x9d38('0x2e'));_0x5f5adb[_0x9d38('0x36')]=_[_0x9d38('0x37')](_0x19549a[_0x9d38('0x36')]);_0x5f5adb[_0x9d38('0x38')]=_[_0x9d38('0x39')](_0x5f5adb['model'],_0x5f5adb[_0x9d38('0x36')]);_0x433c88[_0x9d38('0x3a')]=_[_0x9d38('0x39')](_0x5f5adb['model'],qs[_0x9d38('0x3b')](_0x19549a['query'][_0x9d38('0x3b')]));_0x433c88[_0x9d38('0x3a')]=_0x433c88['attributes']['length']?_0x433c88[_0x9d38('0x3a')]:_0x5f5adb[_0x9d38('0x35')];if(!_0x19549a[_0x9d38('0x36')][_0x9d38('0x3c')](_0x9d38('0x3d'))){_0x433c88[_0x9d38('0x20')]=qs['limit'](_0x19549a[_0x9d38('0x36')][_0x9d38('0x20')]);_0x433c88[_0x9d38('0x1e')]=qs['offset'](_0x19549a[_0x9d38('0x36')][_0x9d38('0x1e')]);}_0x433c88[_0x9d38('0x3e')]=qs[_0x9d38('0x3f')](_0x19549a['query'][_0x9d38('0x3f')]);_0x433c88[_0x9d38('0x40')]=qs['filters'](_[_0x9d38('0x41')](_0x19549a[_0x9d38('0x36')],_0x5f5adb[_0x9d38('0x38')]),_0x32f82f);if(_0x19549a[_0x9d38('0x36')][_0x9d38('0x42')]){_0x433c88[_0x9d38('0x40')]=_[_0x9d38('0x43')](_0x433c88[_0x9d38('0x40')],{'$or':_[_0x9d38('0x31')](_0x32f82f,function(_0x4f17cd){if(_0x4f17cd['type']!==_0x9d38('0x44')){var _0x4c13c1={};_0x4c13c1[_0x4f17cd[_0x9d38('0x2e')]]={'$like':'%'+_0x19549a[_0x9d38('0x36')][_0x9d38('0x42')]+'%'};return _0x4c13c1;}})});}_0x433c88=_['merge']({},_0x433c88,_0x19549a[_0x9d38('0x45')]);var _0x5ef92e={'where':_0x433c88[_0x9d38('0x40')]};return db['SquareProject'][_0x9d38('0x21')](_0x5ef92e)[_0x9d38('0x2b')](function(_0x1ee7cb){_0x2d971b[_0x9d38('0x21')]=_0x1ee7cb;if(_0x19549a[_0x9d38('0x36')][_0x9d38('0x46')]){_0x433c88[_0x9d38('0x47')]=[{'all':!![]}];}return db[_0x9d38('0x32')][_0x9d38('0x48')](_0x433c88);})[_0x9d38('0x2b')](function(_0x5e24b2){_0x2d971b[_0x9d38('0x49')]=_0x5e24b2;return _0x2d971b;})['then'](respondWithFilteredResult(_0x4eb7c1,_0x433c88))['catch'](handleError(_0x4eb7c1,null));};exports[_0x9d38('0x4a')]=function(_0x2ad7a6,_0x311d4d){var _0x75c40d={'raw':![],'where':{'id':_0x2ad7a6[_0x9d38('0x4b')]['id']}},_0x286c98={};_0x286c98['model']=_[_0x9d38('0x37')](db[_0x9d38('0x32')]['rawAttributes']);_0x286c98[_0x9d38('0x36')]=_[_0x9d38('0x37')](_0x2ad7a6[_0x9d38('0x36')]);_0x286c98[_0x9d38('0x38')]=_[_0x9d38('0x39')](_0x286c98[_0x9d38('0x35')],_0x286c98[_0x9d38('0x36')]);_0x75c40d[_0x9d38('0x3a')]=_[_0x9d38('0x39')](_0x286c98[_0x9d38('0x35')],qs[_0x9d38('0x3b')](_0x2ad7a6[_0x9d38('0x36')][_0x9d38('0x3b')]));_0x75c40d[_0x9d38('0x3a')]=_0x75c40d[_0x9d38('0x3a')][_0x9d38('0x4c')]?_0x75c40d[_0x9d38('0x3a')]:_0x286c98[_0x9d38('0x35')];if(_0x2ad7a6[_0x9d38('0x36')]['includeAll']){_0x75c40d['include']=[{'all':!![]}];}_0x75c40d=_[_0x9d38('0x43')]({},_0x75c40d,_0x2ad7a6[_0x9d38('0x45')]);return db[_0x9d38('0x32')][_0x9d38('0x4d')](_0x75c40d)['then'](handleEntityNotFound(_0x311d4d,null))[_0x9d38('0x2b')](respondWithResult(_0x311d4d,null))[_0x9d38('0x4e')](handleError(_0x311d4d,null));};exports[_0x9d38('0x4f')]=function(_0x1124c6,_0x2e578b){return db[_0x9d38('0x32')][_0x9d38('0x4f')](_0x1124c6[_0x9d38('0x50')],{})[_0x9d38('0x2b')](function(_0x2ee568){var _0x5e2f73=_0x1124c6['user'][_0x9d38('0x27')]({'plain':!![]});if(!_0x5e2f73)throw new Error(_0x9d38('0x51'));if(_0x5e2f73['role']===_0x9d38('0x52')){var _0x1de3ac=_0x2ee568[_0x9d38('0x27')]({'plain':!![]});var _0x5e1abc=_0x9d38('0x28');return db[_0x9d38('0x53')][_0x9d38('0x4d')]({'where':{'name':_0x5e1abc,'userProfileId':_0x5e2f73[_0x9d38('0x54')]},'raw':!![]})[_0x9d38('0x2b')](function(_0x4d39f6){if(_0x4d39f6&&_0x4d39f6['autoAssociation']===0x0){return db[_0x9d38('0x29')][_0x9d38('0x4f')]({'name':_0x1de3ac['name'],'resourceId':_0x1de3ac['id'],'type':_0x4d39f6['name'],'sectionId':_0x4d39f6['id']},{})['then'](function(){return _0x2ee568;});}else{return _0x2ee568;}})['catch'](function(_0x3300e6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3300e6);throw _0x3300e6;});}return _0x2ee568;})[_0x9d38('0x2b')](respondWithResult(_0x2e578b,0xc9))[_0x9d38('0x4e')](handleError(_0x2e578b,null));};exports[_0x9d38('0x26')]=function(_0x14c617,_0x4a8cf5){if(_0x14c617[_0x9d38('0x50')]['id']){delete _0x14c617[_0x9d38('0x50')]['id'];}return db[_0x9d38('0x32')][_0x9d38('0x4d')]({'where':{'id':_0x14c617['params']['id']}})['then'](handleEntityNotFound(_0x4a8cf5,null))[_0x9d38('0x2b')](saveUpdates(_0x14c617[_0x9d38('0x50')],null))[_0x9d38('0x2b')](respondWithResult(_0x4a8cf5,null))['catch'](handleError(_0x4a8cf5,null));};exports[_0x9d38('0x2a')]=function(_0x557a20,_0x7389f3){return db[_0x9d38('0x32')][_0x9d38('0x4d')]({'where':{'id':_0x557a20[_0x9d38('0x4b')]['id']}})[_0x9d38('0x2b')](handleEntityNotFound(_0x7389f3,null))[_0x9d38('0x2b')](removeEntity(_0x7389f3,null))[_0x9d38('0x4e')](handleError(_0x7389f3,null));};exports[_0x9d38('0x55')]=function(_0x5c30dc,_0x2528bb,_0x1cf8d5){return db[_0x9d38('0x32')][_0x9d38('0x4d')]({'where':{'id':_0x5c30dc[_0x9d38('0x4b')]['id']}})[_0x9d38('0x2b')](handleEntityNotFound(_0x2528bb,null))[_0x9d38('0x2b')](function(_0x39eb26){if(_0x39eb26){return _0x39eb26[_0x9d38('0x55')](_0x5c30dc[_0x9d38('0x50')]['ids'],_['omit'](_0x5c30dc[_0x9d38('0x50')],['ids','id'])||{});}})['then'](respondWithResult(_0x2528bb,null))[_0x9d38('0x4e')](handleError(_0x2528bb,null));};exports[_0x9d38('0x56')]=function(_0x1dea42,_0x361c54,_0x56f8dc){return db['SquareProject'][_0x9d38('0x4d')]({'where':{'id':_0x1dea42[_0x9d38('0x4b')]['id']}})[_0x9d38('0x2b')](handleEntityNotFound(_0x361c54,null))[_0x9d38('0x2b')](function(_0x4aabff){if(_0x4aabff){return _0x4aabff[_0x9d38('0x56')](_0x1dea42[_0x9d38('0x36')]['ids'])[_0x9d38('0x2b')](function(){if(_[_0x9d38('0x57')](_0x1dea42[_0x9d38('0x36')][_0x9d38('0x58')])){for(var _0x3f6d9e=0x0;_0x3f6d9e<_0x1dea42['query'][_0x9d38('0x58')][_0x9d38('0x4c')];_0x3f6d9e+=0x1){socket[_0x9d38('0x59')](_0x9d38('0x5a'),{'UserId':Number(_0x1dea42[_0x9d38('0x36')]['ids'][_0x3f6d9e]),'SquareProjectId':Number(_0x1dea42[_0x9d38('0x4b')]['id'])});}}else{socket[_0x9d38('0x59')](_0x9d38('0x5a'),{'UserId':Number(_0x1dea42[_0x9d38('0x36')][_0x9d38('0x58')]),'SquareProjectId':Number(_0x1dea42[_0x9d38('0x4b')]['id'])});}});}})[_0x9d38('0x2b')](respondWithStatusCode(_0x361c54,null))[_0x9d38('0x4e')](handleError(_0x361c54,null));};exports[_0x9d38('0x5b')]=function(_0x26a76d,_0x49780a,_0x54d72a){var _0x5f3bfe={};var _0x1850b3={};var _0x383350;var _0x4ff10e;return db[_0x9d38('0x32')][_0x9d38('0x5c')]({'where':{'id':_0x26a76d[_0x9d38('0x4b')]['id']}})[_0x9d38('0x2b')](handleEntityNotFound(_0x49780a,null))['then'](function(_0x11a09f){if(_0x11a09f){_0x383350=_0x11a09f;_0x1850b3[_0x9d38('0x35')]=_[_0x9d38('0x37')](db[_0x9d38('0x5d')][_0x9d38('0x5e')]);_0x1850b3['query']=_[_0x9d38('0x37')](_0x26a76d['query']);_0x1850b3['filters']=_[_0x9d38('0x39')](_0x1850b3['model'],_0x1850b3[_0x9d38('0x36')]);_0x5f3bfe['attributes']=_[_0x9d38('0x39')](_0x1850b3['model'],qs[_0x9d38('0x3b')](_0x26a76d[_0x9d38('0x36')][_0x9d38('0x3b')]));_0x5f3bfe[_0x9d38('0x3a')]=_0x5f3bfe[_0x9d38('0x3a')][_0x9d38('0x4c')]?_0x5f3bfe[_0x9d38('0x3a')]:_0x1850b3[_0x9d38('0x35')];_0x5f3bfe[_0x9d38('0x3e')]=qs[_0x9d38('0x3f')](_0x26a76d['query'][_0x9d38('0x3f')]);_0x5f3bfe['where']=qs['filters'](_['pick'](_0x26a76d[_0x9d38('0x36')],_0x1850b3['filters']));if(_0x26a76d[_0x9d38('0x36')]['filter']){_0x5f3bfe[_0x9d38('0x40')]=_[_0x9d38('0x43')](_0x5f3bfe[_0x9d38('0x40')],{'$or':_[_0x9d38('0x31')](_0x5f3bfe[_0x9d38('0x3a')],function(_0x41fc8d){var _0x2c6964={};_0x2c6964[_0x41fc8d]={'$like':'%'+_0x26a76d[_0x9d38('0x36')]['filter']+'%'};return _0x2c6964;})});}_0x5f3bfe=_[_0x9d38('0x43')]({},_0x5f3bfe,_0x26a76d[_0x9d38('0x45')]);return _0x383350['getUsers'](_0x5f3bfe);}})[_0x9d38('0x2b')](function(_0x4020c7){if(_0x4020c7){_0x4ff10e=_0x4020c7[_0x9d38('0x4c')];if(!_0x26a76d[_0x9d38('0x36')][_0x9d38('0x3c')]('nolimit')){_0x5f3bfe[_0x9d38('0x20')]=qs[_0x9d38('0x20')](_0x26a76d[_0x9d38('0x36')][_0x9d38('0x20')]);_0x5f3bfe[_0x9d38('0x1e')]=qs['offset'](_0x26a76d[_0x9d38('0x36')][_0x9d38('0x1e')]);}return _0x383350[_0x9d38('0x5b')](_0x5f3bfe);}})[_0x9d38('0x2b')](function(_0x4eeb82){if(_0x4eeb82){return _0x4eeb82?{'count':_0x4ff10e,'rows':_0x4eeb82}:null;}})[_0x9d38('0x2b')](respondWithResult(_0x49780a,null))['catch'](handleError(_0x49780a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9b8c56b..a9f8e64 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 _0xc499=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','save'];(function(_0x408bcd,_0x3f1310){var _0x5d1150=function(_0xbacdea){while(--_0xbacdea){_0x408bcd['push'](_0x408bcd['shift']());}};_0x5d1150(++_0x3f1310);}(_0xc499,0x145));var _0x9c49=function(_0x3f5f08,_0x1ccd7f){_0x3f5f08=_0x3f5f08-0x0;var _0x566dd9=_0xc499[_0x3f5f08];return _0x566dd9;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x9c49('0x0'))['db'][_0x9c49('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c49('0x2'),'afterUpdate':'update','afterDestroy':_0x9c49('0x3')};function emitEvent(_0x4d5ff6){return function(_0x15c5ea,_0x2d410a,_0x540a62){SquareProjectEvents[_0x9c49('0x4')](_0x4d5ff6+':'+_0x15c5ea['id'],_0x15c5ea);SquareProjectEvents[_0x9c49('0x4')](_0x4d5ff6,_0x15c5ea);_0x540a62(null);};}for(var e in events){if(events[_0x9c49('0x5')](e)){var event=events[e];SquareProject[_0x9c49('0x6')](e,emitEvent(event));}}module[_0x9c49('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xdd5a=['hasOwnProperty','hook','events','../../mysqldb','SquareProject','setMaxListeners','remove'];(function(_0x5e0147,_0x2faf8a){var _0x292679=function(_0x1dd860){while(--_0x1dd860){_0x5e0147['push'](_0x5e0147['shift']());}};_0x292679(++_0x2faf8a);}(_0xdd5a,0x16e));var _0xadd5=function(_0x3858d5,_0x306814){_0x3858d5=_0x3858d5-0x0;var _0x443d04=_0xdd5a[_0x3858d5];return _0x443d04;};'use strict';var EventEmitter=require(_0xadd5('0x0'));var SquareProject=require(_0xadd5('0x1'))['db'][_0xadd5('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xadd5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xadd5('0x4')};function emitEvent(_0x1cdb95){return function(_0x359615,_0x2056b0,_0x547b61){SquareProjectEvents['emit'](_0x1cdb95+':'+_0x359615['id'],_0x359615);SquareProjectEvents['emit'](_0x1cdb95,_0x359615);_0x547b61(null);};}for(var e in events){if(events[_0xadd5('0x5')](e)){var event=events[e];SquareProject[_0xadd5('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6feb6f7..dd7d74d 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 _0x0005=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','util','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','square_projects','changed','preproduction'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0005,0x1a8));var _0x5000=function(_0x2547d4,_0x27c2fb){_0x2547d4=_0x2547d4-0x0;var _0x24e7a4=_0x0005[_0x2547d4];return _0x24e7a4;};'use strict';var _=require('lodash');var util=require(_0x5000('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5000('0x1'));var fs=require('fs');var path=require(_0x5000('0x2'));var rimraf=require(_0x5000('0x3'));var config=require(_0x5000('0x4'));var attributes=require(_0x5000('0x5'));module[_0x5000('0x6')]=function(_0x127ce3,_0x4a9473){return _0x127ce3['define']('SquareProject',attributes,{'tableName':_0x5000('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28ffcc,_0x33a821,_0x228688){if(_0x28ffcc[_0x5000('0x8')](_0x5000('0x9'))){_0x28ffcc[_0x5000('0xa')]=moment()[_0x5000('0xb')](_0x5000('0xc'));}if(_0x28ffcc['changed']('production')){_0x28ffcc[_0x5000('0xd')]=moment()[_0x5000('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x228688(null,_0x28ffcc);}}});}; \ No newline at end of file +var _0xb13a=['api','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x56cd48,_0x1f71e6){var _0x41933f=function(_0x5d351f){while(--_0x5d351f){_0x56cd48['push'](_0x56cd48['shift']());}};_0x41933f(++_0x1f71e6);}(_0xb13a,0x1d2));var _0xab13=function(_0x5eb427,_0x26b6ad){_0x5eb427=_0x5eb427-0x0;var _0x1481d8=_0xb13a[_0x5eb427];return _0x1481d8;};'use strict';var _=require('lodash');var util=require(_0xab13('0x0'));var logger=require(_0xab13('0x1'))(_0xab13('0x2'));var moment=require('moment');var BPromise=require(_0xab13('0x3'));var rp=require(_0xab13('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab13('0x5'));var config=require(_0xab13('0x6'));var attributes=require(_0xab13('0x7'));module['exports']=function(_0x1f509e,_0x34c8cc){return _0x1f509e[_0xab13('0x8')](_0xab13('0x9'),attributes,{'tableName':_0xab13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x498a24,_0xa064c1,_0x20f839){if(_0x498a24[_0xab13('0xb')](_0xab13('0xc'))){_0x498a24[_0xab13('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x498a24[_0xab13('0xb')](_0xab13('0xe'))){_0x498a24[_0xab13('0xf')]=moment()[_0xab13('0x10')](_0xab13('0x11'));}_0x20f839(null,_0x498a24);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f82e2bd..990848f 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 _0x17d3=['info','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','map','include','model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./squareProject.socket','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3565ae,_0x42ce0e){var _0x1f6ef9=function(_0x27ffd8){while(--_0x27ffd8){_0x3565ae['push'](_0x3565ae['shift']());}};_0x1f6ef9(++_0x42ce0e);}(_0x17d3,0x1e1));var _0x317d=function(_0x5ad81d,_0x290d77){_0x5ad81d=_0x5ad81d-0x0;var _0x2204a1=_0x17d3[_0x5ad81d];return _0x2204a1;};'use strict';var _=require(_0x317d('0x0'));var util=require('util');var moment=require(_0x317d('0x1'));var BPromise=require(_0x317d('0x2'));var rs=require(_0x317d('0x3'));var fs=require('fs');var Redis=require(_0x317d('0x4'));var db=require(_0x317d('0x5'))['db'];var utils=require(_0x317d('0x6'));var logger=require('../../config/logger')(_0x317d('0x7'));var config=require(_0x317d('0x8'));var jayson=require(_0x317d('0x9'));var client=jayson[_0x317d('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x317d('0xb')],{'host':_0x317d('0xc'),'port':0x18eb});var socket=require(_0x317d('0xd'))(new Redis(config[_0x317d('0xb')]));require(_0x317d('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f2a26,_0x44f2f3,_0x5dd823){return new BPromise(function(_0x3496b6,_0x2b8602){return client['request'](_0x3f2a26,_0x5dd823)['then'](function(_0x353104){logger['info'](_0x317d('0xf'),_0x44f2f3,_0x317d('0x10'));logger[_0x317d('0x11')](_0x317d('0x12'),_0x44f2f3,'request\x20sent',JSON[_0x317d('0x13')](_0x353104));if(_0x353104[_0x317d('0x14')]){if(_0x353104[_0x317d('0x14')][_0x317d('0x15')]===0x1f4){logger[_0x317d('0x14')]('SquareProject,\x20%s,\x20%s',_0x44f2f3,_0x353104[_0x317d('0x14')]['message']);return _0x2b8602(_0x353104[_0x317d('0x14')][_0x317d('0x16')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x44f2f3,_0x353104[_0x317d('0x14')][_0x317d('0x16')]);return _0x3496b6(_0x353104[_0x317d('0x14')][_0x317d('0x16')]);}else{logger[_0x317d('0x17')](_0x317d('0xf'),_0x44f2f3,_0x317d('0x10'));_0x3496b6(_0x353104[_0x317d('0x18')][_0x317d('0x16')]);}})[_0x317d('0x19')](function(_0x3d9f12){logger[_0x317d('0x14')](_0x317d('0xf'),_0x44f2f3,_0x3d9f12);_0x2b8602(_0x3d9f12);});});}exports[_0x317d('0x1a')]=function(_0x50e3b5){var _0x3aa796=this;return new Promise(function(_0x466bc8,_0x4427de){return db[_0x317d('0x1b')][_0x317d('0x1c')]({'raw':_0x50e3b5['options']?_0x50e3b5[_0x317d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x50e3b5[_0x317d('0x1d')]?_0x50e3b5['options'][_0x317d('0x1e')]||null:null,'attributes':_0x50e3b5[_0x317d('0x1d')]?_0x50e3b5[_0x317d('0x1d')][_0x317d('0x1f')]||null:null,'include':_0x50e3b5[_0x317d('0x1d')]?_0x50e3b5[_0x317d('0x1d')]['include']?_[_0x317d('0x20')](_0x50e3b5['options'][_0x317d('0x21')],function(_0x31b1fe){return{'model':db[_0x31b1fe[_0x317d('0x22')]],'as':_0x31b1fe['as'],'attributes':_0x31b1fe[_0x317d('0x1f')],'include':_0x31b1fe[_0x317d('0x21')]?_[_0x317d('0x20')](_0x31b1fe[_0x317d('0x21')],function(_0x4cd838){return{'model':db[_0x4cd838[_0x317d('0x22')]],'as':_0x4cd838['as'],'attributes':_0x4cd838[_0x317d('0x1f')],'include':_0x4cd838[_0x317d('0x21')]?_[_0x317d('0x20')](_0x4cd838['include'],function(_0x583101){return{'model':db[_0x583101[_0x317d('0x22')]],'as':_0x583101['as'],'attributes':_0x583101[_0x317d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x317d('0x23')](function(_0x4231f3){logger['info']('ShowSquareProject',_0x50e3b5);logger[_0x317d('0x11')]('ShowSquareProject',_0x50e3b5,JSON['stringify'](_0x4231f3));_0x466bc8(_0x4231f3);})[_0x317d('0x19')](function(_0x1c3a00){logger[_0x317d('0x14')](_0x317d('0x1a'),_0x1c3a00['message'],_0x50e3b5);_0x4427de(_0x3aa796[_0x317d('0x14')](0x1f4,_0x1c3a00['message']));});});}; \ No newline at end of file +var _0xf6c3=['then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareProject','find','options','raw','where','include','model','attributes','ShowSquareProject','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./squareProject.socket','register','request'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xf6c3,0xb1));var _0x3f6c=function(_0x32e4a5,_0x116842){_0x32e4a5=_0x32e4a5-0x0;var _0x1d3951=_0xf6c3[_0x32e4a5];return _0x1d3951;};'use strict';var _=require(_0x3f6c('0x0'));var util=require(_0x3f6c('0x1'));var moment=require('moment');var BPromise=require(_0x3f6c('0x2'));var rs=require(_0x3f6c('0x3'));var fs=require('fs');var Redis=require(_0x3f6c('0x4'));var db=require(_0x3f6c('0x5'))['db'];var utils=require(_0x3f6c('0x6'));var logger=require(_0x3f6c('0x7'))(_0x3f6c('0x8'));var config=require(_0x3f6c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f6c('0xa')][_0x3f6c('0xb')]({'port':0x232a});config[_0x3f6c('0xc')]=_['defaults'](config[_0x3f6c('0xc')],{'host':_0x3f6c('0xd'),'port':0x18eb});var socket=require(_0x3f6c('0xe'))(new Redis(config['redis']));require(_0x3f6c('0xf'))[_0x3f6c('0x10')](socket);function respondWithRpcPromise(_0x4da74f,_0x2124f6,_0x490efb){return new BPromise(function(_0x2efbaf,_0x1ec250){return client[_0x3f6c('0x11')](_0x4da74f,_0x490efb)[_0x3f6c('0x12')](function(_0x1be340){logger[_0x3f6c('0x13')](_0x3f6c('0x14'),_0x2124f6,_0x3f6c('0x15'));logger[_0x3f6c('0x16')](_0x3f6c('0x17'),_0x2124f6,'request\x20sent',JSON['stringify'](_0x1be340));if(_0x1be340['error']){if(_0x1be340[_0x3f6c('0x18')][_0x3f6c('0x19')]===0x1f4){logger['error'](_0x3f6c('0x14'),_0x2124f6,_0x1be340[_0x3f6c('0x18')]['message']);return _0x1ec250(_0x1be340[_0x3f6c('0x18')]['message']);}logger[_0x3f6c('0x18')](_0x3f6c('0x14'),_0x2124f6,_0x1be340['error']['message']);return _0x2efbaf(_0x1be340[_0x3f6c('0x18')][_0x3f6c('0x1a')]);}else{logger[_0x3f6c('0x13')](_0x3f6c('0x14'),_0x2124f6,'request\x20sent');_0x2efbaf(_0x1be340[_0x3f6c('0x1b')][_0x3f6c('0x1a')]);}})[_0x3f6c('0x1c')](function(_0x2d65f1){logger[_0x3f6c('0x18')]('SquareProject,\x20%s,\x20%s',_0x2124f6,_0x2d65f1);_0x1ec250(_0x2d65f1);});});}exports['ShowSquareProject']=function(_0x4fc2be){var _0x2492b0=this;return new Promise(function(_0x5e9094,_0x3941e0){return db[_0x3f6c('0x1d')][_0x3f6c('0x1e')]({'raw':_0x4fc2be[_0x3f6c('0x1f')]?_0x4fc2be[_0x3f6c('0x1f')][_0x3f6c('0x20')]===undefined?!![]:![]:!![],'where':_0x4fc2be[_0x3f6c('0x1f')]?_0x4fc2be[_0x3f6c('0x1f')][_0x3f6c('0x21')]||null:null,'attributes':_0x4fc2be['options']?_0x4fc2be[_0x3f6c('0x1f')]['attributes']||null:null,'include':_0x4fc2be[_0x3f6c('0x1f')]?_0x4fc2be[_0x3f6c('0x1f')][_0x3f6c('0x22')]?_['map'](_0x4fc2be[_0x3f6c('0x1f')][_0x3f6c('0x22')],function(_0x16fd03){return{'model':db[_0x16fd03[_0x3f6c('0x23')]],'as':_0x16fd03['as'],'attributes':_0x16fd03[_0x3f6c('0x24')],'include':_0x16fd03['include']?_['map'](_0x16fd03[_0x3f6c('0x22')],function(_0x367454){return{'model':db[_0x367454['model']],'as':_0x367454['as'],'attributes':_0x367454['attributes'],'include':_0x367454[_0x3f6c('0x22')]?_['map'](_0x367454[_0x3f6c('0x22')],function(_0x56d8a7){return{'model':db[_0x56d8a7[_0x3f6c('0x23')]],'as':_0x56d8a7['as'],'attributes':_0x56d8a7[_0x3f6c('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3f6c('0x12')](function(_0x566e60){logger['info'](_0x3f6c('0x25'),_0x4fc2be);logger[_0x3f6c('0x16')]('ShowSquareProject',_0x4fc2be,JSON[_0x3f6c('0x26')](_0x566e60));_0x5e9094(_0x566e60);})[_0x3f6c('0x1c')](function(_0x4b78b0){logger['error'](_0x3f6c('0x25'),_0x4b78b0[_0x3f6c('0x1a')],_0x4fc2be);_0x3941e0(_0x2492b0['error'](0x1f4,_0x4b78b0['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d175ec5..c8b1600 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 _0xccea=['update','register','length','./squareProject.events','save','remove'];(function(_0x101561,_0x5c12ce){var _0x5d519d=function(_0x189416){while(--_0x189416){_0x101561['push'](_0x101561['shift']());}};_0x5d519d(++_0x5c12ce);}(_0xccea,0x6f));var _0xacce=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xccea[_0x502c7d];return _0x30b7ed;};'use strict';var SquareProjectEvents=require(_0xacce('0x0'));var events=[_0xacce('0x1'),_0xacce('0x2'),_0xacce('0x3')];function createListener(_0x1b2614,_0x1b3c6f){return function(_0x1097e4){_0x1b3c6f['emit'](_0x1b2614,_0x1097e4);};}function removeListener(_0x2851a3,_0x2a3b01){return function(){SquareProjectEvents['removeListener'](_0x2851a3,_0x2a3b01);};}exports[_0xacce('0x4')]=function(_0x3980f5){for(var _0x345dbe=0x0,_0x11aa43=events[_0xacce('0x5')];_0x345dbe<_0x11aa43;_0x345dbe++){var _0x1dade1=events[_0x345dbe];var _0x2a9755=createListener('squareProject:'+_0x1dade1,_0x3980f5);SquareProjectEvents['on'](_0x1dade1,_0x2a9755);}}; \ No newline at end of file +var _0x7fdb=['remove','emit','removeListener','register','squareProject:','save'];(function(_0x3bc1fc,_0x3ab1dc){var _0x31dc2f=function(_0xaafb6f){while(--_0xaafb6f){_0x3bc1fc['push'](_0x3bc1fc['shift']());}};_0x31dc2f(++_0x3ab1dc);}(_0x7fdb,0x1a3));var _0xb7fd=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x7fdb[_0x5cc8b9];return _0x58892e;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xb7fd('0x0'),_0xb7fd('0x1'),'update'];function createListener(_0x3c87e9,_0xba6a62){return function(_0x3ced74){_0xba6a62[_0xb7fd('0x2')](_0x3c87e9,_0x3ced74);};}function removeListener(_0x4ebd53,_0x3bf86f){return function(){SquareProjectEvents[_0xb7fd('0x3')](_0x4ebd53,_0x3bf86f);};}exports[_0xb7fd('0x4')]=function(_0x439808){for(var _0x3eba46=0x0,_0x156120=events['length'];_0x3eba46<_0x156120;_0x3eba46++){var _0x1e4cc0=events[_0x3eba46];var _0x395b07=createListener(_0xb7fd('0x5')+_0x1e4cc0,_0x439808);SquareProjectEvents['on'](_0x1e4cc0,_0x395b07);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index fd9879d..e05b35f 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x28136a,_0x39a40c){var _0x29485b=function(_0x302a6a){while(--_0x302a6a){_0x28136a['push'](_0x28136a['shift']());}};_0x29485b(++_0x39a40c);}(_0x53ec,0x192));var _0xc53e=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0x53ec[_0x19efbc];return _0x205c5e;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x326f,0xd1));var _0xf326=function(_0x32ed2e,_0x1696f3){_0x32ed2e=_0x32ed2e-0x0;var _0xc1a4d3=_0x326f[_0x32ed2e];return _0xc1a4d3;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('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 c84adb6..e202d65 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 _0x3e74=['getDataValue','savePath','substring','sequelize','STRING'];(function(_0x2b92cd,_0x4b855b){var _0x37975a=function(_0x1cc198){while(--_0x1cc198){_0x2b92cd['push'](_0x2b92cd['shift']());}};_0x37975a(++_0x4b855b);}(_0x3e74,0x175));var _0x43e7=function(_0x2b452e,_0x12872a){_0x2b452e=_0x2b452e-0x0;var _0x49dc35=_0x3e74[_0x2b452e];return _0x49dc35;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'callerid':{'type':Sequelize[_0x43e7('0x1')]},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x43e7('0x1')]},'projectName':{'type':Sequelize[_0x43e7('0x1')]},'saveName':{'type':Sequelize[_0x43e7('0x1')]},'filename':{'type':Sequelize[_0x43e7('0x1')]},'savePath':{'type':Sequelize[_0x43e7('0x1')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x45a0d1='';var _0x3491d6=this[_0x43e7('0x2')](_0x43e7('0x3'));if(_0x3491d6){_0x45a0d1=_0x3491d6[_0x43e7('0x4')](_0x3491d6['lastIndexOf']('.'));}return _0x45a0d1;}}}; \ No newline at end of file +var _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x315da6,_0xfeae10){var _0x33e90f=function(_0x45271c){while(--_0x45271c){_0x315da6['push'](_0x315da6['shift']());}};_0x33e90f(++_0xfeae10);}(_0x6f47,0xc7));var _0x76f4=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6f47[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1942a43..c592b23 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 _0x09f6=['json','offset','undefined','limit','count','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','intersection','find','catch','create','update','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status'];(function(_0x47b31a,_0x37596f){var _0x212178=function(_0x37c8ce){while(--_0x37c8ce){_0x47b31a['push'](_0x47b31a['shift']());}};_0x212178(++_0x37596f);}(_0x09f6,0xaa));var _0x609f=function(_0x57112d,_0x9ea573){_0x57112d=_0x57112d-0x0;var _0x3c32b9=_0x09f6[_0x57112d];return _0x3c32b9;};'use strict';var emlformat=require(_0x609f('0x0'));var rimraf=require(_0x609f('0x1'));var zipdir=require(_0x609f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x609f('0x3'));var moment=require(_0x609f('0x4'));var BPromise=require(_0x609f('0x5'));var Mustache=require('mustache');var util=require(_0x609f('0x6'));var path=require(_0x609f('0x7'));var sox=require(_0x609f('0x8'));var csv=require(_0x609f('0x9'));var ejs=require(_0x609f('0xa'));var fs=require('fs');var fs_extra=require(_0x609f('0xb'));var _=require(_0x609f('0xc'));var squel=require(_0x609f('0xd'));var crypto=require(_0x609f('0xe'));var jsforce=require(_0x609f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x609f('0x9'));var querystring=require(_0x609f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x609f('0x11'));var as=require(_0x609f('0x12'));var hardwareService=require(_0x609f('0x13'));var logger=require('../../config/logger')(_0x609f('0x14'));var utils=require('../../config/utils');var config=require(_0x609f('0x15'));var licenseUtil=require(_0x609f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x287a55,_0x2b1a33){_0x2b1a33=_0x2b1a33||0xcc;return function(_0x3d254f){if(_0x3d254f){return _0x287a55['sendStatus'](_0x2b1a33);}return _0x287a55['status'](_0x2b1a33)['end']();};}function respondWithResult(_0xb50715,_0xf0353){_0xf0353=_0xf0353||0xc8;return function(_0x13e70a){if(_0x13e70a){return _0xb50715[_0x609f('0x17')](_0xf0353)[_0x609f('0x18')](_0x13e70a);}};}function respondWithFilteredResult(_0x169482,_0x5cd6d5){return function(_0x233d01){if(_0x233d01){var _0x47f4e5=typeof _0x5cd6d5[_0x609f('0x19')]===_0x609f('0x1a')&&typeof _0x5cd6d5[_0x609f('0x1b')]===_0x609f('0x1a');var _0x23d1c1=_0x233d01[_0x609f('0x1c')];var _0x2a7b1e=_0x47f4e5?0x0:_0x5cd6d5[_0x609f('0x19')];var _0xebfc0=_0x47f4e5?_0x233d01[_0x609f('0x1c')]:_0x5cd6d5['offset']+_0x5cd6d5[_0x609f('0x1b')];var _0x35a77a;if(_0xebfc0>=_0x23d1c1){_0xebfc0=_0x23d1c1;_0x35a77a=0xc8;}else{_0x35a77a=0xce;}_0x169482[_0x609f('0x17')](_0x35a77a);return _0x169482['set']('Content-Range',_0x2a7b1e+'-'+_0xebfc0+'/'+_0x23d1c1)['json'](_0x233d01);}return null;};}function patchUpdates(_0xd17fa7){return function(_0x3012d7){try{jsonpatch[_0x609f('0x1d')](_0x3012d7,_0xd17fa7,!![]);}catch(_0x29373b){return BPromise[_0x609f('0x1e')](_0x29373b);}return _0x3012d7[_0x609f('0x1f')]();};}function saveUpdates(_0x1758cb,_0x3d762d){return function(_0x24f081){if(_0x24f081){return _0x24f081['update'](_0x1758cb)[_0x609f('0x20')](function(_0x53cc69){return _0x53cc69;});}return null;};}function removeEntity(_0x63f200,_0x19811c){return function(_0x514100){if(_0x514100){return _0x514100[_0x609f('0x21')]()[_0x609f('0x20')](function(){_0x63f200[_0x609f('0x17')](0xcc)[_0x609f('0x22')]();});}};}function handleEntityNotFound(_0x5c9e3a,_0x75792f){return function(_0x23edc0){if(!_0x23edc0){_0x5c9e3a['sendStatus'](0x194);}return _0x23edc0;};}function handleError(_0x3025a5,_0x2c5be1){_0x2c5be1=_0x2c5be1||0x1f4;return function(_0x2d10e3){logger[_0x609f('0x23')](_0x2d10e3[_0x609f('0x24')]);if(_0x2d10e3[_0x609f('0x25')]){delete _0x2d10e3[_0x609f('0x25')];}_0x3025a5[_0x609f('0x17')](_0x2c5be1)[_0x609f('0x26')](_0x2d10e3);};}exports[_0x609f('0x27')]=function(_0x8a2470,_0x2866af){var _0x586ef6={},_0x410d44={},_0x281203={'count':0x0,'rows':[]};var _0x21a3cc=_[_0x609f('0x28')](db[_0x609f('0x29')][_0x609f('0x2a')],function(_0x21fa5b){return{'name':_0x21fa5b[_0x609f('0x2b')],'type':_0x21fa5b['type'][_0x609f('0x2c')]};});_0x410d44[_0x609f('0x2d')]=_['map'](_0x21a3cc,'name');_0x410d44[_0x609f('0x2e')]=_[_0x609f('0x2f')](_0x8a2470[_0x609f('0x2e')]);_0x410d44['filters']=_['intersection'](_0x410d44[_0x609f('0x2d')],_0x410d44[_0x609f('0x2e')]);_0x586ef6[_0x609f('0x30')]=_['intersection'](_0x410d44[_0x609f('0x2d')],qs[_0x609f('0x31')](_0x8a2470[_0x609f('0x2e')][_0x609f('0x31')]));_0x586ef6['attributes']=_0x586ef6['attributes'][_0x609f('0x32')]?_0x586ef6[_0x609f('0x30')]:_0x410d44[_0x609f('0x2d')];if(!_0x8a2470[_0x609f('0x2e')][_0x609f('0x33')](_0x609f('0x34'))){_0x586ef6[_0x609f('0x1b')]=qs[_0x609f('0x1b')](_0x8a2470[_0x609f('0x2e')]['limit']);_0x586ef6[_0x609f('0x19')]=qs[_0x609f('0x19')](_0x8a2470['query'][_0x609f('0x19')]);}_0x586ef6[_0x609f('0x35')]=qs[_0x609f('0x36')](_0x8a2470['query']['sort']);_0x586ef6[_0x609f('0x37')]=qs[_0x609f('0x38')](_[_0x609f('0x39')](_0x8a2470['query'],_0x410d44[_0x609f('0x38')]),_0x21a3cc);if(_0x8a2470[_0x609f('0x2e')][_0x609f('0x3a')]){_0x586ef6[_0x609f('0x37')]=_['merge'](_0x586ef6[_0x609f('0x37')],{'$or':_[_0x609f('0x28')](_0x21a3cc,function(_0x5c6d91){if(_0x5c6d91[_0x609f('0x3b')]!==_0x609f('0x3c')){var _0x7575d={};_0x7575d[_0x5c6d91['name']]={'$like':'%'+_0x8a2470[_0x609f('0x2e')][_0x609f('0x3a')]+'%'};return _0x7575d;}})});}_0x586ef6=_[_0x609f('0x3d')]({},_0x586ef6,_0x8a2470[_0x609f('0x3e')]);var _0x4dc4e5={'where':_0x586ef6[_0x609f('0x37')]};return db[_0x609f('0x29')][_0x609f('0x1c')](_0x4dc4e5)[_0x609f('0x20')](function(_0xbf5e84){_0x281203[_0x609f('0x1c')]=_0xbf5e84;if(_0x8a2470[_0x609f('0x2e')][_0x609f('0x3f')]){_0x586ef6[_0x609f('0x40')]=[{'all':!![]}];}return db[_0x609f('0x29')][_0x609f('0x41')](_0x586ef6);})[_0x609f('0x20')](function(_0x2a588e){_0x281203['rows']=_0x2a588e;return _0x281203;})[_0x609f('0x20')](respondWithFilteredResult(_0x2866af,_0x586ef6))['catch'](handleError(_0x2866af,null));};exports[_0x609f('0x42')]=function(_0x14d8ab,_0x34a246){var _0x2e554f={'raw':!![],'where':{'id':_0x14d8ab[_0x609f('0x43')]['id']}},_0x14cfe5={};_0x14cfe5[_0x609f('0x2d')]=_['keys'](db[_0x609f('0x29')][_0x609f('0x2a')]);_0x14cfe5[_0x609f('0x2e')]=_['keys'](_0x14d8ab[_0x609f('0x2e')]);_0x14cfe5[_0x609f('0x38')]=_[_0x609f('0x44')](_0x14cfe5[_0x609f('0x2d')],_0x14cfe5[_0x609f('0x2e')]);_0x2e554f[_0x609f('0x30')]=_['intersection'](_0x14cfe5[_0x609f('0x2d')],qs[_0x609f('0x31')](_0x14d8ab[_0x609f('0x2e')][_0x609f('0x31')]));_0x2e554f[_0x609f('0x30')]=_0x2e554f['attributes'][_0x609f('0x32')]?_0x2e554f[_0x609f('0x30')]:_0x14cfe5[_0x609f('0x2d')];if(_0x14d8ab['query'][_0x609f('0x3f')]){_0x2e554f[_0x609f('0x40')]=[{'all':!![]}];}_0x2e554f=_[_0x609f('0x3d')]({},_0x2e554f,_0x14d8ab[_0x609f('0x3e')]);return db[_0x609f('0x29')][_0x609f('0x45')](_0x2e554f)['then'](handleEntityNotFound(_0x34a246,null))[_0x609f('0x20')](respondWithResult(_0x34a246,null))[_0x609f('0x46')](handleError(_0x34a246,null));};exports[_0x609f('0x47')]=function(_0x20836b,_0xceae0d){return db['SquareRecording'][_0x609f('0x47')](_0x20836b['body'],{})[_0x609f('0x20')](respondWithResult(_0xceae0d,0xc9))[_0x609f('0x46')](handleError(_0xceae0d,null));};exports[_0x609f('0x48')]=function(_0x56296c,_0x2043bb){if(_0x56296c[_0x609f('0x49')]['id']){delete _0x56296c[_0x609f('0x49')]['id'];}return db[_0x609f('0x29')]['find']({'where':{'id':_0x56296c[_0x609f('0x43')]['id']}})[_0x609f('0x20')](handleEntityNotFound(_0x2043bb,null))['then'](saveUpdates(_0x56296c[_0x609f('0x49')],null))[_0x609f('0x20')](respondWithResult(_0x2043bb,null))[_0x609f('0x46')](handleError(_0x2043bb,null));};exports[_0x609f('0x4a')]=function(_0xd55935,_0x2bc73b,_0x3839b2){var _0x3863ec=require(_0x609f('0x4b'));var _0x36eb2f=![];var _0x29d8e0={};if(_0xd55935[_0x609f('0x2e')]['type']&&_0xd55935['query'][_0x609f('0x3b')]===_0x609f('0x4c')){_0x29d8e0['uniqueid']=_0xd55935[_0x609f('0x43')]['id'];}else{_0x29d8e0['id']=_0xd55935[_0x609f('0x43')]['id'];}return db['SquareRecording'][_0x609f('0x45')]({'where':_0x29d8e0,'attributes':['id',_0x609f('0x4d'),'filename'],'raw':!![]})[_0x609f('0x20')](handleEntityNotFound(_0x2bc73b,null))[_0x609f('0x20')](function(_0x1e1f6a){if(_0x1e1f6a){var _0x12d860=_0x1e1f6a['savePath'];var _0x1665d1=util[_0x609f('0x4e')](_0x609f('0x4f'),_0x12d860);if(fs[_0x609f('0x50')](_0x1665d1)){_0x36eb2f=!![];return _0x3863ec['decryptFile'](_0x1665d1,_0x12d860,config[_0x609f('0x51')][_0x609f('0x52')])[_0x609f('0x20')](function(){return _0x1e1f6a;});}return _0x1e1f6a;}})[_0x609f('0x20')](function(_0x45614a){if(_0x45614a){var _0x174427=_0x45614a[_0x609f('0x4d')];if(!fs[_0x609f('0x50')](_0x174427)){throw new db[(_0x609f('0x53'))][(_0x609f('0x54'))](_0x609f('0x55'));}if(_0x45614a[_0x609f('0x56')]){return _0x2bc73b['download'](_0x174427,_0x45614a[_0x609f('0x56')]+path[_0x609f('0x57')](_0x174427),function(){if(_0x36eb2f){fs['unlink'](_0x174427);}});}else{return _0x2bc73b['download'](_0x174427,function(_0x585353){if(_0x36eb2f){fs[_0x609f('0x58')](_0x174427);}});}}})[_0x609f('0x46')](function(_0x5f0e91){if(_0x5f0e91['message']===_0x609f('0x55')){_0x2bc73b[_0x609f('0x17')](0x194)[_0x609f('0x26')](_0x609f('0x59'));}else{return handleError(_0x2bc73b,null);}});};exports[_0x609f('0x21')]=function(_0x8a7cf8,_0x5d8b0e){return db['SquareRecording']['find']({'where':{'id':_0x8a7cf8[_0x609f('0x43')]['id']}})['then'](function(_0x413bba){if(_[_0x609f('0x5a')](_0x413bba)){throw new ReferenceError(_0x609f('0x5b'));}return _0x413bba;})[_0x609f('0x20')](function(_0x58a6f9){var _0x1e92df=_0x58a6f9[_0x609f('0x4d')];logger['info'](_0x609f('0x5c'),_0x1e92df);if(!_[_0x609f('0x5a')](_0x58a6f9[_0x609f('0x4d')])&&fs[_0x609f('0x50')](_0x1e92df)){logger[_0x609f('0x5d')](_0x609f('0x5e')+_0x1e92df+_0x609f('0x5f'));fs[_0x609f('0x60')](_0x1e92df);}_0x1e92df=_0x1e92df+'.cypher';if(!_['isNil'](_0x58a6f9[_0x609f('0x4d')])&&fs['existsSync'](_0x1e92df)){logger[_0x609f('0x5d')](_0x609f('0x5e')+_0x1e92df+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1e92df);}return _0x58a6f9;})[_0x609f('0x20')](function(_0x1adf12){if(!_0x1adf12)throw new InternalError();return _0x1adf12['destroy']();})[_0x609f('0x20')](function(){_0x5d8b0e['status'](0xcc)[_0x609f('0x22')]();})[_0x609f('0x46')](handleError(_0x5d8b0e,null));}; \ No newline at end of file +var _0xebdf=['sort','filters','pick','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','../../components/encryptor','uniqueid','savePath','filename','format','secrets','existsSync','ValidationError','SquareRecording\x20not\x20found','download','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x16c365,_0x264519){var _0x1be48a=function(_0x3c8274){while(--_0x3c8274){_0x16c365['push'](_0x16c365['shift']());}};_0x1be48a(++_0x264519);}(_0xebdf,0x1a7));var _0xfebd=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xebdf[_0x29e3b6];return _0x55d4b0;};'use strict';var emlformat=require(_0xfebd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfebd('0x1'));var jsonpatch=require(_0xfebd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfebd('0x3'));var Mustache=require(_0xfebd('0x4'));var util=require(_0xfebd('0x5'));var path=require('path');var sox=require(_0xfebd('0x6'));var csv=require('to-csv');var ejs=require(_0xfebd('0x7'));var fs=require('fs');var fs_extra=require(_0xfebd('0x8'));var _=require(_0xfebd('0x9'));var squel=require(_0xfebd('0xa'));var crypto=require(_0xfebd('0xb'));var jsforce=require(_0xfebd('0xc'));var deskjs=require(_0xfebd('0xd'));var toCsv=require(_0xfebd('0xe'));var querystring=require(_0xfebd('0xf'));var Papa=require(_0xfebd('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfebd('0x11'));var as=require(_0xfebd('0x12'));var hardwareService=require(_0xfebd('0x13'));var logger=require('../../config/logger')(_0xfebd('0x14'));var utils=require(_0xfebd('0x15'));var config=require(_0xfebd('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x458297,_0x2cb2a3){_0x2cb2a3=_0x2cb2a3||0xcc;return function(_0x1f9a3c){if(_0x1f9a3c){return _0x458297[_0xfebd('0x17')](_0x2cb2a3);}return _0x458297[_0xfebd('0x18')](_0x2cb2a3)[_0xfebd('0x19')]();};}function respondWithResult(_0x43508a,_0x25aef0){_0x25aef0=_0x25aef0||0xc8;return function(_0x8392f5){if(_0x8392f5){return _0x43508a[_0xfebd('0x18')](_0x25aef0)['json'](_0x8392f5);}};}function respondWithFilteredResult(_0xb8abbd,_0x59c38c){return function(_0x1b23dd){if(_0x1b23dd){var _0x2823ba=typeof _0x59c38c['offset']==='undefined'&&typeof _0x59c38c[_0xfebd('0x1a')]===_0xfebd('0x1b');var _0x42710a=_0x1b23dd[_0xfebd('0x1c')];var _0x1f87ad=_0x2823ba?0x0:_0x59c38c[_0xfebd('0x1d')];var _0x492e9f=_0x2823ba?_0x1b23dd[_0xfebd('0x1c')]:_0x59c38c[_0xfebd('0x1d')]+_0x59c38c['limit'];var _0x573e9f;if(_0x492e9f>=_0x42710a){_0x492e9f=_0x42710a;_0x573e9f=0xc8;}else{_0x573e9f=0xce;}_0xb8abbd[_0xfebd('0x18')](_0x573e9f);return _0xb8abbd[_0xfebd('0x1e')](_0xfebd('0x1f'),_0x1f87ad+'-'+_0x492e9f+'/'+_0x42710a)[_0xfebd('0x20')](_0x1b23dd);}return null;};}function patchUpdates(_0x558632){return function(_0xf937d3){try{jsonpatch[_0xfebd('0x21')](_0xf937d3,_0x558632,!![]);}catch(_0x295718){return BPromise[_0xfebd('0x22')](_0x295718);}return _0xf937d3[_0xfebd('0x23')]();};}function saveUpdates(_0x188114,_0x168855){return function(_0x2c4828){if(_0x2c4828){return _0x2c4828[_0xfebd('0x24')](_0x188114)[_0xfebd('0x25')](function(_0xf03630){return _0xf03630;});}return null;};}function removeEntity(_0x45aac8,_0x501597){return function(_0x1d37ee){if(_0x1d37ee){return _0x1d37ee['destroy']()[_0xfebd('0x25')](function(){_0x45aac8[_0xfebd('0x18')](0xcc)[_0xfebd('0x19')]();});}};}function handleEntityNotFound(_0x395cfb,_0x1f5906){return function(_0x8a45b7){if(!_0x8a45b7){_0x395cfb[_0xfebd('0x17')](0x194);}return _0x8a45b7;};}function handleError(_0x2d3969,_0x54edc7){_0x54edc7=_0x54edc7||0x1f4;return function(_0x3ac671){logger[_0xfebd('0x26')](_0x3ac671[_0xfebd('0x27')]);if(_0x3ac671[_0xfebd('0x28')]){delete _0x3ac671[_0xfebd('0x28')];}_0x2d3969[_0xfebd('0x18')](_0x54edc7)[_0xfebd('0x29')](_0x3ac671);};}exports[_0xfebd('0x2a')]=function(_0x66b088,_0x2196e2){var _0x3429e5={},_0x3ba8d4={},_0x3392ce={'count':0x0,'rows':[]};var _0x4be6c8=_[_0xfebd('0x2b')](db[_0xfebd('0x2c')][_0xfebd('0x2d')],function(_0x18fe29){return{'name':_0x18fe29['fieldName'],'type':_0x18fe29[_0xfebd('0x2e')][_0xfebd('0x2f')]};});_0x3ba8d4[_0xfebd('0x30')]=_['map'](_0x4be6c8,_0xfebd('0x28'));_0x3ba8d4[_0xfebd('0x31')]=_['keys'](_0x66b088['query']);_0x3ba8d4['filters']=_['intersection'](_0x3ba8d4['model'],_0x3ba8d4['query']);_0x3429e5['attributes']=_[_0xfebd('0x32')](_0x3ba8d4[_0xfebd('0x30')],qs['fields'](_0x66b088[_0xfebd('0x31')][_0xfebd('0x33')]));_0x3429e5[_0xfebd('0x34')]=_0x3429e5[_0xfebd('0x34')][_0xfebd('0x35')]?_0x3429e5[_0xfebd('0x34')]:_0x3ba8d4[_0xfebd('0x30')];if(!_0x66b088[_0xfebd('0x31')][_0xfebd('0x36')](_0xfebd('0x37'))){_0x3429e5[_0xfebd('0x1a')]=qs[_0xfebd('0x1a')](_0x66b088[_0xfebd('0x31')]['limit']);_0x3429e5[_0xfebd('0x1d')]=qs[_0xfebd('0x1d')](_0x66b088['query'][_0xfebd('0x1d')]);}_0x3429e5[_0xfebd('0x38')]=qs['sort'](_0x66b088['query'][_0xfebd('0x39')]);_0x3429e5['where']=qs[_0xfebd('0x3a')](_[_0xfebd('0x3b')](_0x66b088['query'],_0x3ba8d4[_0xfebd('0x3a')]),_0x4be6c8);if(_0x66b088[_0xfebd('0x31')]['filter']){_0x3429e5[_0xfebd('0x3c')]=_[_0xfebd('0x3d')](_0x3429e5[_0xfebd('0x3c')],{'$or':_['map'](_0x4be6c8,function(_0x4a3d84){if(_0x4a3d84[_0xfebd('0x2e')]!==_0xfebd('0x3e')){var _0x4b6efc={};_0x4b6efc[_0x4a3d84[_0xfebd('0x28')]]={'$like':'%'+_0x66b088[_0xfebd('0x31')]['filter']+'%'};return _0x4b6efc;}})});}_0x3429e5=_[_0xfebd('0x3d')]({},_0x3429e5,_0x66b088['options']);var _0x2103d3={'where':_0x3429e5['where']};return db[_0xfebd('0x2c')][_0xfebd('0x1c')](_0x2103d3)[_0xfebd('0x25')](function(_0x198f6e){_0x3392ce[_0xfebd('0x1c')]=_0x198f6e;if(_0x66b088[_0xfebd('0x31')][_0xfebd('0x3f')]){_0x3429e5[_0xfebd('0x40')]=[{'all':!![]}];}return db['SquareRecording'][_0xfebd('0x41')](_0x3429e5);})[_0xfebd('0x25')](function(_0x4a5b16){_0x3392ce[_0xfebd('0x42')]=_0x4a5b16;return _0x3392ce;})['then'](respondWithFilteredResult(_0x2196e2,_0x3429e5))[_0xfebd('0x43')](handleError(_0x2196e2,null));};exports[_0xfebd('0x44')]=function(_0x4e12fc,_0x2abbdb){var _0x4b7a64={'raw':!![],'where':{'id':_0x4e12fc[_0xfebd('0x45')]['id']}},_0x2db222={};_0x2db222['model']=_[_0xfebd('0x46')](db[_0xfebd('0x2c')][_0xfebd('0x2d')]);_0x2db222[_0xfebd('0x31')]=_[_0xfebd('0x46')](_0x4e12fc[_0xfebd('0x31')]);_0x2db222[_0xfebd('0x3a')]=_[_0xfebd('0x32')](_0x2db222[_0xfebd('0x30')],_0x2db222[_0xfebd('0x31')]);_0x4b7a64[_0xfebd('0x34')]=_['intersection'](_0x2db222[_0xfebd('0x30')],qs['fields'](_0x4e12fc[_0xfebd('0x31')]['fields']));_0x4b7a64[_0xfebd('0x34')]=_0x4b7a64['attributes'][_0xfebd('0x35')]?_0x4b7a64[_0xfebd('0x34')]:_0x2db222[_0xfebd('0x30')];if(_0x4e12fc[_0xfebd('0x31')]['includeAll']){_0x4b7a64[_0xfebd('0x40')]=[{'all':!![]}];}_0x4b7a64=_[_0xfebd('0x3d')]({},_0x4b7a64,_0x4e12fc[_0xfebd('0x47')]);return db[_0xfebd('0x2c')]['find'](_0x4b7a64)[_0xfebd('0x25')](handleEntityNotFound(_0x2abbdb,null))['then'](respondWithResult(_0x2abbdb,null))[_0xfebd('0x43')](handleError(_0x2abbdb,null));};exports[_0xfebd('0x48')]=function(_0x281cce,_0x285f76){return db['SquareRecording'][_0xfebd('0x48')](_0x281cce['body'],{})[_0xfebd('0x25')](respondWithResult(_0x285f76,0xc9))[_0xfebd('0x43')](handleError(_0x285f76,null));};exports['update']=function(_0x5b90f1,_0x36fd6b){if(_0x5b90f1[_0xfebd('0x49')]['id']){delete _0x5b90f1[_0xfebd('0x49')]['id'];}return db[_0xfebd('0x2c')][_0xfebd('0x4a')]({'where':{'id':_0x5b90f1['params']['id']}})[_0xfebd('0x25')](handleEntityNotFound(_0x36fd6b,null))['then'](saveUpdates(_0x5b90f1[_0xfebd('0x49')],null))[_0xfebd('0x25')](respondWithResult(_0x36fd6b,null))[_0xfebd('0x43')](handleError(_0x36fd6b,null));};exports['download']=function(_0x1d8e4d,_0x519138,_0x4de12d){var _0x263eb1=require(_0xfebd('0x4b'));var _0x353f58=![];var _0x548ab1={};if(_0x1d8e4d[_0xfebd('0x31')]['type']&&_0x1d8e4d['query']['type']==='uniqueid'){_0x548ab1[_0xfebd('0x4c')]=_0x1d8e4d[_0xfebd('0x45')]['id'];}else{_0x548ab1['id']=_0x1d8e4d['params']['id'];}return db[_0xfebd('0x2c')][_0xfebd('0x4a')]({'where':_0x548ab1,'attributes':['id',_0xfebd('0x4d'),_0xfebd('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x519138,null))[_0xfebd('0x25')](function(_0x19ce1c){if(_0x19ce1c){var _0x4007a1=_0x19ce1c['savePath'];var _0x311304=util[_0xfebd('0x4f')]('%s.cypher',_0x4007a1);if(fs['existsSync'](_0x311304)){_0x353f58=!![];return _0x263eb1['decryptFile'](_0x311304,_0x4007a1,config[_0xfebd('0x50')]['recording'])[_0xfebd('0x25')](function(){return _0x19ce1c;});}return _0x19ce1c;}})['then'](function(_0x59200){if(_0x59200){var _0x16b1b2=_0x59200[_0xfebd('0x4d')];if(!fs[_0xfebd('0x51')](_0x16b1b2)){throw new db['Sequelize'][(_0xfebd('0x52'))](_0xfebd('0x53'));}if(_0x59200[_0xfebd('0x4e')]){return _0x519138[_0xfebd('0x54')](_0x16b1b2,_0x59200[_0xfebd('0x4e')]+path['extname'](_0x16b1b2),function(){if(_0x353f58){fs[_0xfebd('0x55')](_0x16b1b2);}});}else{return _0x519138[_0xfebd('0x54')](_0x16b1b2,function(_0x1b46bd){if(_0x353f58){fs['unlink'](_0x16b1b2);}});}}})[_0xfebd('0x43')](function(_0x3e95b6){if(_0x3e95b6[_0xfebd('0x56')]===_0xfebd('0x53')){_0x519138[_0xfebd('0x18')](0x194)[_0xfebd('0x29')](_0xfebd('0x57'));}else{return handleError(_0x519138,null);}});};exports[_0xfebd('0x58')]=function(_0xfc81a6,_0x25620e){return db[_0xfebd('0x2c')][_0xfebd('0x4a')]({'where':{'id':_0xfc81a6[_0xfebd('0x45')]['id']}})[_0xfebd('0x25')](function(_0x3835d7){if(_['isNil'](_0x3835d7)){throw new ReferenceError(_0xfebd('0x59'));}return _0x3835d7;})[_0xfebd('0x25')](function(_0x49f4d3){var _0x37c5e7=_0x49f4d3['savePath'];logger[_0xfebd('0x5a')](_0xfebd('0x5b'),_0x37c5e7);if(!_[_0xfebd('0x5c')](_0x49f4d3[_0xfebd('0x4d')])&&fs[_0xfebd('0x51')](_0x37c5e7)){logger['info']('File:\x20\x22'+_0x37c5e7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfebd('0x5d')](_0x37c5e7);}_0x37c5e7=_0x37c5e7+'.cypher';if(!_[_0xfebd('0x5c')](_0x49f4d3['savePath'])&&fs[_0xfebd('0x51')](_0x37c5e7)){logger[_0xfebd('0x5a')](_0xfebd('0x5e')+_0x37c5e7+_0xfebd('0x5f'));fs[_0xfebd('0x5d')](_0x37c5e7);}return _0x49f4d3;})[_0xfebd('0x25')](function(_0x2d27fc){if(!_0x2d27fc)throw new InternalError();return _0x2d27fc[_0xfebd('0x58')]();})[_0xfebd('0x25')](function(){_0x25620e['status'](0xcc)[_0xfebd('0x19')]();})['catch'](handleError(_0x25620e,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 067e332..f699f8a 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 _0x8b0e=['path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x199ee1,_0x2335e2){var _0x49aa05=function(_0x3c2353){while(--_0x3c2353){_0x199ee1['push'](_0x199ee1['shift']());}};_0x49aa05(++_0x2335e2);}(_0x8b0e,0x166));var _0xe8b0=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x8b0e[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var logger=require(_0xe8b0('0x2'))(_0xe8b0('0x3'));var moment=require(_0xe8b0('0x4'));var BPromise=require(_0xe8b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8b0('0x6'));var rimraf=require('rimraf');var config=require(_0xe8b0('0x7'));var attributes=require(_0xe8b0('0x8'));module[_0xe8b0('0x9')]=function(_0x3cb6bc,_0x1da757){return _0x3cb6bc[_0xe8b0('0xa')](_0xe8b0('0xb'),attributes,{'tableName':_0xe8b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe714=['path','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','../../config/logger','api','moment','bluebird'];(function(_0x20d089,_0x508784){var _0x327c54=function(_0x192e10){while(--_0x192e10){_0x20d089['push'](_0x20d089['shift']());}};_0x327c54(++_0x508784);}(_0xe714,0xe2));var _0x4e71=function(_0x521aad,_0xda3810){_0x521aad=_0x521aad-0x0;var _0x34a93a=_0xe714[_0x521aad];return _0x34a93a;};'use strict';var _=require(_0x4e71('0x0'));var util=require('util');var logger=require(_0x4e71('0x1'))(_0x4e71('0x2'));var moment=require(_0x4e71('0x3'));var BPromise=require(_0x4e71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e71('0x5'));var rimraf=require('rimraf');var config=require(_0x4e71('0x6'));var attributes=require(_0x4e71('0x7'));module[_0x4e71('0x8')]=function(_0x204a19,_0xfe1559){return _0x204a19[_0x4e71('0x9')]('SquareRecording',attributes,{'tableName':_0x4e71('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 ade9281..2c2ade8 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 _0xeac7=['rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateSquareRecording','SquareRecording','options','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xeac7,0x1f2));var _0x7eac=function(_0x49991d,_0x4bd20a){_0x49991d=_0x49991d-0x0;var _0x4a697f=_0xeac7[_0x49991d];return _0x4a697f;};'use strict';var _=require(_0x7eac('0x0'));var util=require('util');var moment=require(_0x7eac('0x1'));var BPromise=require(_0x7eac('0x2'));var rs=require(_0x7eac('0x3'));var fs=require('fs');var Redis=require(_0x7eac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7eac('0x5'));var logger=require('../../config/logger')(_0x7eac('0x6'));var config=require(_0x7eac('0x7'));var jayson=require(_0x7eac('0x8'));var client=jayson[_0x7eac('0x9')][_0x7eac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30776d,_0x235264,_0x23fcd1){return new BPromise(function(_0xd322ee,_0x4ee239){return client[_0x7eac('0xb')](_0x30776d,_0x23fcd1)['then'](function(_0x3eec1b){logger[_0x7eac('0xc')](_0x7eac('0xd'),_0x235264,_0x7eac('0xe'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x235264,'request\x20sent',JSON[_0x7eac('0xf')](_0x3eec1b));if(_0x3eec1b[_0x7eac('0x10')]){if(_0x3eec1b[_0x7eac('0x10')]['code']===0x1f4){logger[_0x7eac('0x10')](_0x7eac('0xd'),_0x235264,_0x3eec1b[_0x7eac('0x10')][_0x7eac('0x11')]);return _0x4ee239(_0x3eec1b[_0x7eac('0x10')][_0x7eac('0x11')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x235264,_0x3eec1b[_0x7eac('0x10')]['message']);return _0xd322ee(_0x3eec1b[_0x7eac('0x10')][_0x7eac('0x11')]);}else{logger[_0x7eac('0xc')](_0x7eac('0xd'),_0x235264,'request\x20sent');_0xd322ee(_0x3eec1b['result'][_0x7eac('0x11')]);}})[_0x7eac('0x12')](function(_0x2b07a9){logger[_0x7eac('0x10')]('SquareRecording,\x20%s,\x20%s',_0x235264,_0x2b07a9);_0x4ee239(_0x2b07a9);});});}exports[_0x7eac('0x13')]=function(_0x27e8c5){var _0x6d243c=this;return new Promise(function(_0x45b4a0,_0x3da49b){return db[_0x7eac('0x14')]['create'](_0x27e8c5['body'],{'raw':_0x27e8c5[_0x7eac('0x15')]?_0x27e8c5[_0x7eac('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x7eac('0x16')](function(_0x5d90a9){logger[_0x7eac('0xc')](_0x7eac('0x13'),_0x27e8c5);logger[_0x7eac('0x17')]('CreateSquareRecording',_0x27e8c5,JSON[_0x7eac('0xf')](_0x5d90a9));_0x45b4a0(_0x5d90a9);})['catch'](function(_0x56fe17){logger[_0x7eac('0x10')](_0x7eac('0x13'),_0x56fe17[_0x7eac('0x11')],_0x27e8c5);_0x3da49b(_0x6d243c[_0x7eac('0x10')](0x1f4,_0x56fe17[_0x7eac('0x11')]));});});}; \ No newline at end of file +var _0xf4b1=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0xf4b1,0x7c));var _0x1f4b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf4b1[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x1f4b('0x0'));var util=require(_0x1f4b('0x1'));var moment=require('moment');var BPromise=require(_0x1f4b('0x2'));var rs=require(_0x1f4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f4b('0x4'))['db'];var utils=require(_0x1f4b('0x5'));var logger=require('../../config/logger')(_0x1f4b('0x6'));var config=require(_0x1f4b('0x7'));var jayson=require(_0x1f4b('0x8'));var client=jayson[_0x1f4b('0x9')][_0x1f4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a1c1f,_0x19a270,_0x181764){return new BPromise(function(_0x424672,_0xeb3a08){return client[_0x1f4b('0xb')](_0x3a1c1f,_0x181764)['then'](function(_0x18160b){logger[_0x1f4b('0xc')](_0x1f4b('0xd'),_0x19a270,_0x1f4b('0xe'));logger[_0x1f4b('0xf')](_0x1f4b('0x10'),_0x19a270,_0x1f4b('0xe'),JSON[_0x1f4b('0x11')](_0x18160b));if(_0x18160b[_0x1f4b('0x12')]){if(_0x18160b[_0x1f4b('0x12')][_0x1f4b('0x13')]===0x1f4){logger[_0x1f4b('0x12')]('SquareRecording,\x20%s,\x20%s',_0x19a270,_0x18160b[_0x1f4b('0x12')]['message']);return _0xeb3a08(_0x18160b[_0x1f4b('0x12')][_0x1f4b('0x14')]);}logger[_0x1f4b('0x12')](_0x1f4b('0xd'),_0x19a270,_0x18160b[_0x1f4b('0x12')][_0x1f4b('0x14')]);return _0x424672(_0x18160b[_0x1f4b('0x12')][_0x1f4b('0x14')]);}else{logger[_0x1f4b('0xc')](_0x1f4b('0xd'),_0x19a270,_0x1f4b('0xe'));_0x424672(_0x18160b[_0x1f4b('0x15')][_0x1f4b('0x14')]);}})[_0x1f4b('0x16')](function(_0x3effa0){logger['error'](_0x1f4b('0xd'),_0x19a270,_0x3effa0);_0xeb3a08(_0x3effa0);});});}exports[_0x1f4b('0x17')]=function(_0x2d01a3){var _0x1ccbcc=this;return new Promise(function(_0x1e0072,_0x331046){return db[_0x1f4b('0x18')][_0x1f4b('0x19')](_0x2d01a3['body'],{'raw':_0x2d01a3['options']?_0x2d01a3[_0x1f4b('0x1a')][_0x1f4b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x561f76){logger[_0x1f4b('0xc')](_0x1f4b('0x17'),_0x2d01a3);logger[_0x1f4b('0xf')](_0x1f4b('0x17'),_0x2d01a3,JSON[_0x1f4b('0x11')](_0x561f76));_0x1e0072(_0x561f76);})[_0x1f4b('0x16')](function(_0x3e2ee5){logger[_0x1f4b('0x12')](_0x1f4b('0x17'),_0x3e2ee5[_0x1f4b('0x14')],_0x2d01a3);_0x331046(_0x1ccbcc[_0x1f4b('0x12')](0x1f4,_0x3e2ee5[_0x1f4b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 85b6893..da5e7bf 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x42b12e,_0x30a62a){var _0x4f872c=function(_0x323653){while(--_0x323653){_0x42b12e['push'](_0x42b12e['shift']());}};_0x4f872c(++_0x30a62a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0xc81b4d,_0x2f055d){var _0x4f2e11=function(_0x2809d1){while(--_0x2809d1){_0xc81b4d['push'](_0xc81b4d['shift']());}};_0x4f2e11(++_0x2f055d);}(_0xe706,0xa3));var _0x6e70=function(_0x49ed67,_0x290989){_0x49ed67=_0x49ed67-0x0;var _0x1523d5=_0xe706[_0x49ed67];return _0x1523d5;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4af0b21..6214335 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 _0x6b09=['DATE','sequelize','exports','STRING'];(function(_0x145b2c,_0xb78d0c){var _0x3a01b9=function(_0x37d91c){while(--_0x37d91c){_0x145b2c['push'](_0x145b2c['shift']());}};_0x3a01b9(++_0xb78d0c);}(_0x6b09,0x17d));var _0x96b0=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0x6b09[_0x113e32];return _0x4ff939;};'use strict';var Sequelize=require(_0x96b0('0x0'));module[_0x96b0('0x1')]={'network':{'type':Sequelize[_0x96b0('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x96b0('0x2')]},'channel':{'type':Sequelize[_0x96b0('0x2')]},'language':{'type':Sequelize[_0x96b0('0x2')]},'type':{'type':Sequelize[_0x96b0('0x2')]},'uniqueid':{'type':Sequelize[_0x96b0('0x2')]},'version':{'type':Sequelize[_0x96b0('0x2')]},'callerid':{'type':Sequelize[_0x96b0('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x96b0('0x2')]},'callingani2':{'type':Sequelize[_0x96b0('0x2')]},'callington':{'type':Sequelize[_0x96b0('0x2')]},'callingtns':{'type':Sequelize[_0x96b0('0x2')]},'dnid':{'type':Sequelize[_0x96b0('0x2')]},'rdnis':{'type':Sequelize[_0x96b0('0x2')]},'context':{'type':Sequelize[_0x96b0('0x2')]},'extension':{'type':Sequelize[_0x96b0('0x2')]},'priority':{'type':Sequelize[_0x96b0('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x96b0('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x96b0('0x3')]},'leaveAt':{'type':Sequelize[_0x96b0('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x662a=['DATE','STRING'];(function(_0x5281d9,_0x4f8ce8){var _0x43fc19=function(_0x5adb21){while(--_0x5adb21){_0x5281d9['push'](_0x5281d9['shift']());}};_0x43fc19(++_0x4f8ce8);}(_0x662a,0x1cf));var _0xa662=function(_0x3ea197,_0x4bd963){_0x3ea197=_0x3ea197-0x0;var _0x34d79c=_0x662a[_0x3ea197];return _0x34d79c;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa662('0x0')]},'channel':{'type':Sequelize[_0xa662('0x0')]},'language':{'type':Sequelize[_0xa662('0x0')]},'type':{'type':Sequelize[_0xa662('0x0')]},'uniqueid':{'type':Sequelize[_0xa662('0x0')]},'version':{'type':Sequelize[_0xa662('0x0')]},'callerid':{'type':Sequelize[_0xa662('0x0')]},'calleridname':{'type':Sequelize[_0xa662('0x0')]},'callingpres':{'type':Sequelize[_0xa662('0x0')]},'callingani2':{'type':Sequelize[_0xa662('0x0')]},'callington':{'type':Sequelize[_0xa662('0x0')]},'callingtns':{'type':Sequelize[_0xa662('0x0')]},'dnid':{'type':Sequelize[_0xa662('0x0')]},'rdnis':{'type':Sequelize[_0xa662('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa662('0x0')]},'enhanced':{'type':Sequelize[_0xa662('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xa662('0x0')]},'project_name':{'type':Sequelize[_0xa662('0x0')]},'joinAt':{'type':Sequelize[_0xa662('0x1')]},'leaveAt':{'type':Sequelize[_0xa662('0x1')]},'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 669dce4..4cb4be0 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 _0x9f30=['offset','set','reject','save','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','intersection','includeAll','options','create','body','update','find','params','describe','eml-format','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0xaf33a2,_0x3038e1){var _0x37d5a3=function(_0x52263c){while(--_0x52263c){_0xaf33a2['push'](_0xaf33a2['shift']());}};_0x37d5a3(++_0x3038e1);}(_0x9f30,0x76));var _0x09f3=function(_0x2783d9,_0x218555){_0x2783d9=_0x2783d9-0x0;var _0x405d9c=_0x9f30[_0x2783d9];return _0x405d9c;};'use strict';var emlformat=require(_0x09f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x09f3('0x2'));var util=require(_0x09f3('0x3'));var path=require('path');var sox=require(_0x09f3('0x4'));var csv=require(_0x09f3('0x5'));var ejs=require(_0x09f3('0x6'));var fs=require('fs');var fs_extra=require(_0x09f3('0x7'));var _=require(_0x09f3('0x8'));var squel=require(_0x09f3('0x9'));var crypto=require(_0x09f3('0xa'));var jsforce=require(_0x09f3('0xb'));var deskjs=require(_0x09f3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x09f3('0xd'));var qs=require(_0x09f3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09f3('0xf'));var logger=require(_0x09f3('0x10'))('api');var utils=require(_0x09f3('0x11'));var config=require(_0x09f3('0x12'));var licenseUtil=require(_0x09f3('0x13'));var db=require(_0x09f3('0x14'))['db'];function respondWithStatusCode(_0x16fabe,_0x2eb2a0){_0x2eb2a0=_0x2eb2a0||0xcc;return function(_0x104e9c){if(_0x104e9c){return _0x16fabe[_0x09f3('0x15')](_0x2eb2a0);}return _0x16fabe['status'](_0x2eb2a0)[_0x09f3('0x16')]();};}function respondWithResult(_0xb7b2c3,_0x2d5865){_0x2d5865=_0x2d5865||0xc8;return function(_0x4b03ea){if(_0x4b03ea){return _0xb7b2c3[_0x09f3('0x17')](_0x2d5865)[_0x09f3('0x18')](_0x4b03ea);}};}function respondWithFilteredResult(_0x18487f,_0x26a9fd){return function(_0x2342af){if(_0x2342af){var _0x292ddf=typeof _0x26a9fd['offset']===_0x09f3('0x19')&&typeof _0x26a9fd[_0x09f3('0x1a')]===_0x09f3('0x19');var _0x3552ff=_0x2342af[_0x09f3('0x1b')];var _0x434cd2=_0x292ddf?0x0:_0x26a9fd[_0x09f3('0x1c')];var _0x59c144=_0x292ddf?_0x2342af[_0x09f3('0x1b')]:_0x26a9fd['offset']+_0x26a9fd[_0x09f3('0x1a')];var _0x30fa3a;if(_0x59c144>=_0x3552ff){_0x59c144=_0x3552ff;_0x30fa3a=0xc8;}else{_0x30fa3a=0xce;}_0x18487f['status'](_0x30fa3a);return _0x18487f[_0x09f3('0x1d')]('Content-Range',_0x434cd2+'-'+_0x59c144+'/'+_0x3552ff)[_0x09f3('0x18')](_0x2342af);}return null;};}function patchUpdates(_0x1b541b){return function(_0x41f424){try{jsonpatch['apply'](_0x41f424,_0x1b541b,!![]);}catch(_0x3159f8){return BPromise[_0x09f3('0x1e')](_0x3159f8);}return _0x41f424[_0x09f3('0x1f')]();};}function saveUpdates(_0x53c9f3,_0x9884af){return function(_0xb2b8b9){if(_0xb2b8b9){return _0xb2b8b9['update'](_0x53c9f3)[_0x09f3('0x20')](function(_0x2811af){return _0x2811af;});}return null;};}function removeEntity(_0x5bdc21,_0x5a6063){return function(_0x302f33){if(_0x302f33){return _0x302f33[_0x09f3('0x21')]()['then'](function(){_0x5bdc21['status'](0xcc)[_0x09f3('0x16')]();});}};}function handleEntityNotFound(_0x4087f2,_0x3d6e56){return function(_0x2523ce){if(!_0x2523ce){_0x4087f2[_0x09f3('0x15')](0x194);}return _0x2523ce;};}function handleError(_0x248d1d,_0x3bbcaf){_0x3bbcaf=_0x3bbcaf||0x1f4;return function(_0xdf6673){logger[_0x09f3('0x22')](_0xdf6673[_0x09f3('0x23')]);if(_0xdf6673[_0x09f3('0x24')]){delete _0xdf6673['name'];}_0x248d1d[_0x09f3('0x17')](_0x3bbcaf)[_0x09f3('0x25')](_0xdf6673);};}exports[_0x09f3('0x26')]=function(_0xfb32b9,_0x5b8e0d){var _0x135a21={},_0x21bd91={},_0x1bc200={'count':0x0,'rows':[]};var _0x13cd09=_[_0x09f3('0x27')](db[_0x09f3('0x28')][_0x09f3('0x29')],function(_0x48b709){return{'name':_0x48b709['fieldName'],'type':_0x48b709['type'][_0x09f3('0x2a')]};});_0x21bd91[_0x09f3('0x2b')]=_[_0x09f3('0x27')](_0x13cd09,_0x09f3('0x24'));_0x21bd91['query']=_[_0x09f3('0x2c')](_0xfb32b9[_0x09f3('0x2d')]);_0x21bd91[_0x09f3('0x2e')]=_['intersection'](_0x21bd91['model'],_0x21bd91['query']);_0x135a21[_0x09f3('0x2f')]=_['intersection'](_0x21bd91[_0x09f3('0x2b')],qs[_0x09f3('0x30')](_0xfb32b9[_0x09f3('0x2d')][_0x09f3('0x30')]));_0x135a21[_0x09f3('0x2f')]=_0x135a21[_0x09f3('0x2f')][_0x09f3('0x31')]?_0x135a21[_0x09f3('0x2f')]:_0x21bd91[_0x09f3('0x2b')];if(!_0xfb32b9[_0x09f3('0x2d')][_0x09f3('0x32')](_0x09f3('0x33'))){_0x135a21['limit']=qs[_0x09f3('0x1a')](_0xfb32b9[_0x09f3('0x2d')][_0x09f3('0x1a')]);_0x135a21['offset']=qs[_0x09f3('0x1c')](_0xfb32b9[_0x09f3('0x2d')][_0x09f3('0x1c')]);}_0x135a21[_0x09f3('0x34')]=qs[_0x09f3('0x35')](_0xfb32b9[_0x09f3('0x2d')][_0x09f3('0x35')]);_0x135a21[_0x09f3('0x36')]=qs[_0x09f3('0x2e')](_[_0x09f3('0x37')](_0xfb32b9[_0x09f3('0x2d')],_0x21bd91[_0x09f3('0x2e')]),_0x13cd09);if(_0xfb32b9[_0x09f3('0x2d')][_0x09f3('0x38')]){_0x135a21['where']=_[_0x09f3('0x39')](_0x135a21[_0x09f3('0x36')],{'$or':_[_0x09f3('0x27')](_0x13cd09,function(_0x107a58){if(_0x107a58[_0x09f3('0x3a')]!=='VIRTUAL'){var _0x42bc48={};_0x42bc48[_0x107a58[_0x09f3('0x24')]]={'$like':'%'+_0xfb32b9[_0x09f3('0x2d')][_0x09f3('0x38')]+'%'};return _0x42bc48;}})});}_0x135a21=_[_0x09f3('0x39')]({},_0x135a21,_0xfb32b9['options']);var _0xc4f478={'where':_0x135a21[_0x09f3('0x36')]};return db[_0x09f3('0x28')][_0x09f3('0x1b')](_0xc4f478)[_0x09f3('0x20')](function(_0x16d71d){_0x1bc200['count']=_0x16d71d;if(_0xfb32b9[_0x09f3('0x2d')]['includeAll']){_0x135a21[_0x09f3('0x3b')]=[{'all':!![]}];}return db['SquareReport'][_0x09f3('0x3c')](_0x135a21);})[_0x09f3('0x20')](function(_0x1b94a7){_0x1bc200[_0x09f3('0x3d')]=_0x1b94a7;return _0x1bc200;})['then'](respondWithFilteredResult(_0x5b8e0d,_0x135a21))[_0x09f3('0x3e')](handleError(_0x5b8e0d,null));};exports[_0x09f3('0x3f')]=function(_0x58693e,_0x2fd0ce){var _0x2b8713={'raw':!![],'where':{'id':_0x58693e['params']['id']}},_0x1efc41={};_0x1efc41[_0x09f3('0x2b')]=_['keys'](db[_0x09f3('0x28')][_0x09f3('0x29')]);_0x1efc41[_0x09f3('0x2d')]=_[_0x09f3('0x2c')](_0x58693e[_0x09f3('0x2d')]);_0x1efc41[_0x09f3('0x2e')]=_['intersection'](_0x1efc41[_0x09f3('0x2b')],_0x1efc41['query']);_0x2b8713[_0x09f3('0x2f')]=_[_0x09f3('0x40')](_0x1efc41[_0x09f3('0x2b')],qs[_0x09f3('0x30')](_0x58693e[_0x09f3('0x2d')][_0x09f3('0x30')]));_0x2b8713[_0x09f3('0x2f')]=_0x2b8713['attributes']['length']?_0x2b8713['attributes']:_0x1efc41[_0x09f3('0x2b')];if(_0x58693e[_0x09f3('0x2d')][_0x09f3('0x41')]){_0x2b8713[_0x09f3('0x3b')]=[{'all':!![]}];}_0x2b8713=_[_0x09f3('0x39')]({},_0x2b8713,_0x58693e[_0x09f3('0x42')]);return db[_0x09f3('0x28')]['find'](_0x2b8713)['then'](handleEntityNotFound(_0x2fd0ce,null))['then'](respondWithResult(_0x2fd0ce,null))[_0x09f3('0x3e')](handleError(_0x2fd0ce,null));};exports['create']=function(_0x26c69b,_0x483598){return db[_0x09f3('0x28')][_0x09f3('0x43')](_0x26c69b[_0x09f3('0x44')],{})[_0x09f3('0x20')](respondWithResult(_0x483598,0xc9))[_0x09f3('0x3e')](handleError(_0x483598,null));};exports[_0x09f3('0x45')]=function(_0x6dd30e,_0x53edfc){if(_0x6dd30e[_0x09f3('0x44')]['id']){delete _0x6dd30e['body']['id'];}return db[_0x09f3('0x28')][_0x09f3('0x46')]({'where':{'id':_0x6dd30e[_0x09f3('0x47')]['id']}})['then'](handleEntityNotFound(_0x53edfc,null))['then'](saveUpdates(_0x6dd30e['body'],null))['then'](respondWithResult(_0x53edfc,null))['catch'](handleError(_0x53edfc,null));};exports[_0x09f3('0x21')]=function(_0x1e51e0,_0x3f613d){return db[_0x09f3('0x28')][_0x09f3('0x46')]({'where':{'id':_0x1e51e0[_0x09f3('0x47')]['id']}})[_0x09f3('0x20')](handleEntityNotFound(_0x3f613d,null))[_0x09f3('0x20')](removeEntity(_0x3f613d,null))[_0x09f3('0x3e')](handleError(_0x3f613d,null));};exports[_0x09f3('0x48')]=function(_0x3c94f7,_0x32e6c7){return db[_0x09f3('0x28')][_0x09f3('0x48')]()[_0x09f3('0x20')](respondWithResult(_0x32e6c7,null))[_0x09f3('0x3e')](handleError(_0x32e6c7,null));}; \ No newline at end of file +var _0x7910=['rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','keys','length','find','body','update','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','sendStatus','name','send','map','SquareReport'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x7910,0xf6));var _0x0791=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0x7910[_0x1f5887];return _0x21774b;};'use strict';var emlformat=require(_0x0791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0791('0x1'));var jsonpatch=require(_0x0791('0x2'));var rp=require(_0x0791('0x3'));var moment=require(_0x0791('0x4'));var BPromise=require(_0x0791('0x5'));var Mustache=require(_0x0791('0x6'));var util=require(_0x0791('0x7'));var path=require(_0x0791('0x8'));var sox=require('sox');var csv=require(_0x0791('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0791('0xa'));var _=require(_0x0791('0xb'));var squel=require(_0x0791('0xc'));var crypto=require(_0x0791('0xd'));var jsforce=require(_0x0791('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0791('0x9'));var querystring=require(_0x0791('0xf'));var Papa=require(_0x0791('0x10'));var Redis=require('ioredis');var authService=require(_0x0791('0x11'));var qs=require(_0x0791('0x12'));var as=require(_0x0791('0x13'));var hardwareService=require(_0x0791('0x14'));var logger=require(_0x0791('0x15'))(_0x0791('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0791('0x17'));var db=require(_0x0791('0x18'))['db'];function respondWithStatusCode(_0x177b12,_0x325cb9){_0x325cb9=_0x325cb9||0xcc;return function(_0x567ff8){if(_0x567ff8){return _0x177b12['sendStatus'](_0x325cb9);}return _0x177b12[_0x0791('0x19')](_0x325cb9)[_0x0791('0x1a')]();};}function respondWithResult(_0x2c7fde,_0x5db597){_0x5db597=_0x5db597||0xc8;return function(_0xa4cd1d){if(_0xa4cd1d){return _0x2c7fde[_0x0791('0x19')](_0x5db597)[_0x0791('0x1b')](_0xa4cd1d);}};}function respondWithFilteredResult(_0x54167e,_0x462f9c){return function(_0x495f66){if(_0x495f66){var _0x1e4f1c=typeof _0x462f9c[_0x0791('0x1c')]===_0x0791('0x1d')&&typeof _0x462f9c[_0x0791('0x1e')]==='undefined';var _0x24d82b=_0x495f66[_0x0791('0x1f')];var _0x37d76b=_0x1e4f1c?0x0:_0x462f9c[_0x0791('0x1c')];var _0x1f867b=_0x1e4f1c?_0x495f66[_0x0791('0x1f')]:_0x462f9c[_0x0791('0x1c')]+_0x462f9c[_0x0791('0x1e')];var _0x52647c;if(_0x1f867b>=_0x24d82b){_0x1f867b=_0x24d82b;_0x52647c=0xc8;}else{_0x52647c=0xce;}_0x54167e[_0x0791('0x19')](_0x52647c);return _0x54167e[_0x0791('0x20')](_0x0791('0x21'),_0x37d76b+'-'+_0x1f867b+'/'+_0x24d82b)['json'](_0x495f66);}return null;};}function patchUpdates(_0x4383de){return function(_0x14d60b){try{jsonpatch[_0x0791('0x22')](_0x14d60b,_0x4383de,!![]);}catch(_0x3a4a3d){return BPromise['reject'](_0x3a4a3d);}return _0x14d60b['save']();};}function saveUpdates(_0x2d75b7,_0x329972){return function(_0x5f445a){if(_0x5f445a){return _0x5f445a['update'](_0x2d75b7)[_0x0791('0x23')](function(_0x25d0de){return _0x25d0de;});}return null;};}function removeEntity(_0x342dc6,_0x5310f2){return function(_0x3175f8){if(_0x3175f8){return _0x3175f8[_0x0791('0x24')]()[_0x0791('0x23')](function(){_0x342dc6['status'](0xcc)[_0x0791('0x1a')]();});}};}function handleEntityNotFound(_0x10676f,_0xbbcc8e){return function(_0x47f71c){if(!_0x47f71c){_0x10676f[_0x0791('0x25')](0x194);}return _0x47f71c;};}function handleError(_0x26a6cd,_0x35865f){_0x35865f=_0x35865f||0x1f4;return function(_0x508866){logger['error'](_0x508866['stack']);if(_0x508866[_0x0791('0x26')]){delete _0x508866[_0x0791('0x26')];}_0x26a6cd['status'](_0x35865f)[_0x0791('0x27')](_0x508866);};}exports['index']=function(_0x32c868,_0x574804){var _0x500173={},_0x4dba33={},_0x572e1b={'count':0x0,'rows':[]};var _0x4c38ea=_[_0x0791('0x28')](db[_0x0791('0x29')][_0x0791('0x2a')],function(_0x3d1aed){return{'name':_0x3d1aed[_0x0791('0x2b')],'type':_0x3d1aed[_0x0791('0x2c')][_0x0791('0x2d')]};});_0x4dba33['model']=_[_0x0791('0x28')](_0x4c38ea,'name');_0x4dba33['query']=_['keys'](_0x32c868[_0x0791('0x2e')]);_0x4dba33[_0x0791('0x2f')]=_[_0x0791('0x30')](_0x4dba33[_0x0791('0x31')],_0x4dba33[_0x0791('0x2e')]);_0x500173['attributes']=_['intersection'](_0x4dba33[_0x0791('0x31')],qs['fields'](_0x32c868[_0x0791('0x2e')][_0x0791('0x32')]));_0x500173[_0x0791('0x33')]=_0x500173['attributes']['length']?_0x500173[_0x0791('0x33')]:_0x4dba33[_0x0791('0x31')];if(!_0x32c868[_0x0791('0x2e')]['hasOwnProperty'](_0x0791('0x34'))){_0x500173[_0x0791('0x1e')]=qs['limit'](_0x32c868[_0x0791('0x2e')]['limit']);_0x500173['offset']=qs[_0x0791('0x1c')](_0x32c868['query'][_0x0791('0x1c')]);}_0x500173['order']=qs[_0x0791('0x35')](_0x32c868[_0x0791('0x2e')]['sort']);_0x500173['where']=qs['filters'](_[_0x0791('0x36')](_0x32c868['query'],_0x4dba33[_0x0791('0x2f')]),_0x4c38ea);if(_0x32c868[_0x0791('0x2e')][_0x0791('0x37')]){_0x500173['where']=_[_0x0791('0x38')](_0x500173[_0x0791('0x39')],{'$or':_[_0x0791('0x28')](_0x4c38ea,function(_0x32296f){if(_0x32296f['type']!==_0x0791('0x3a')){var _0x4e827a={};_0x4e827a[_0x32296f[_0x0791('0x26')]]={'$like':'%'+_0x32c868[_0x0791('0x2e')]['filter']+'%'};return _0x4e827a;}})});}_0x500173=_['merge']({},_0x500173,_0x32c868[_0x0791('0x3b')]);var _0x3a5a1e={'where':_0x500173[_0x0791('0x39')]};return db['SquareReport'][_0x0791('0x1f')](_0x3a5a1e)[_0x0791('0x23')](function(_0x47668e){_0x572e1b['count']=_0x47668e;if(_0x32c868[_0x0791('0x2e')]['includeAll']){_0x500173[_0x0791('0x3c')]=[{'all':!![]}];}return db['SquareReport'][_0x0791('0x3d')](_0x500173);})[_0x0791('0x23')](function(_0x2eaf50){_0x572e1b[_0x0791('0x3e')]=_0x2eaf50;return _0x572e1b;})['then'](respondWithFilteredResult(_0x574804,_0x500173))[_0x0791('0x3f')](handleError(_0x574804,null));};exports[_0x0791('0x40')]=function(_0x5eee86,_0x265a02){var _0x1a21b0={'raw':!![],'where':{'id':_0x5eee86['params']['id']}},_0x144cc8={};_0x144cc8[_0x0791('0x31')]=_[_0x0791('0x41')](db[_0x0791('0x29')]['rawAttributes']);_0x144cc8[_0x0791('0x2e')]=_[_0x0791('0x41')](_0x5eee86[_0x0791('0x2e')]);_0x144cc8[_0x0791('0x2f')]=_[_0x0791('0x30')](_0x144cc8[_0x0791('0x31')],_0x144cc8[_0x0791('0x2e')]);_0x1a21b0[_0x0791('0x33')]=_['intersection'](_0x144cc8['model'],qs['fields'](_0x5eee86[_0x0791('0x2e')]['fields']));_0x1a21b0[_0x0791('0x33')]=_0x1a21b0[_0x0791('0x33')][_0x0791('0x42')]?_0x1a21b0[_0x0791('0x33')]:_0x144cc8[_0x0791('0x31')];if(_0x5eee86[_0x0791('0x2e')]['includeAll']){_0x1a21b0[_0x0791('0x3c')]=[{'all':!![]}];}_0x1a21b0=_[_0x0791('0x38')]({},_0x1a21b0,_0x5eee86['options']);return db[_0x0791('0x29')][_0x0791('0x43')](_0x1a21b0)['then'](handleEntityNotFound(_0x265a02,null))[_0x0791('0x23')](respondWithResult(_0x265a02,null))[_0x0791('0x3f')](handleError(_0x265a02,null));};exports['create']=function(_0x143ae3,_0x1b306d){return db[_0x0791('0x29')]['create'](_0x143ae3[_0x0791('0x44')],{})[_0x0791('0x23')](respondWithResult(_0x1b306d,0xc9))['catch'](handleError(_0x1b306d,null));};exports[_0x0791('0x45')]=function(_0x548de7,_0x4eb8af){if(_0x548de7[_0x0791('0x44')]['id']){delete _0x548de7[_0x0791('0x44')]['id'];}return db[_0x0791('0x29')][_0x0791('0x43')]({'where':{'id':_0x548de7[_0x0791('0x46')]['id']}})[_0x0791('0x23')](handleEntityNotFound(_0x4eb8af,null))[_0x0791('0x23')](saveUpdates(_0x548de7['body'],null))[_0x0791('0x23')](respondWithResult(_0x4eb8af,null))[_0x0791('0x3f')](handleError(_0x4eb8af,null));};exports['destroy']=function(_0x583fa3,_0x29fefe){return db['SquareReport']['find']({'where':{'id':_0x583fa3['params']['id']}})[_0x0791('0x23')](handleEntityNotFound(_0x29fefe,null))['then'](removeEntity(_0x29fefe,null))[_0x0791('0x3f')](handleError(_0x29fefe,null));};exports['describe']=function(_0x17b70f,_0x474e7c){return db['SquareReport'][_0x0791('0x47')]()['then'](respondWithResult(_0x474e7c,null))['catch'](handleError(_0x474e7c,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 5ec7ab1..8e9d444 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 _0x0bce=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid'];(function(_0x4110fa,_0x2695bd){var _0x31343f=function(_0x214afe){while(--_0x214afe){_0x4110fa['push'](_0x4110fa['shift']());}};_0x31343f(++_0x2695bd);}(_0x0bce,0x12b));var _0xe0bc=function(_0x5252b8,_0x56e845){_0x5252b8=_0x5252b8-0x0;var _0x14bb8e=_0x0bce[_0x5252b8];return _0x14bb8e;};'use strict';var _=require(_0xe0bc('0x0'));var util=require(_0xe0bc('0x1'));var logger=require('../../config/logger')(_0xe0bc('0x2'));var moment=require('moment');var BPromise=require(_0xe0bc('0x3'));var rp=require(_0xe0bc('0x4'));var fs=require('fs');var path=require(_0xe0bc('0x5'));var rimraf=require('rimraf');var config=require(_0xe0bc('0x6'));var attributes=require(_0xe0bc('0x7'));module[_0xe0bc('0x8')]=function(_0x43c4d2,_0x13cb55){return _0x43c4d2[_0xe0bc('0x9')]('SquareReport',attributes,{'tableName':_0xe0bc('0xa'),'paranoid':![],'indexes':[{'name':_0xe0bc('0xb'),'fields':[_0xe0bc('0xc'),'project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1fb3=['bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x3723c7,_0x54fede){var _0x414b4d=function(_0x336404){while(--_0x336404){_0x3723c7['push'](_0x3723c7['shift']());}};_0x414b4d(++_0x54fede);}(_0x1fb3,0xed));var _0x31fb=function(_0x5d9449,_0x5382b7){_0x5d9449=_0x5d9449-0x0;var _0x583cf7=_0x1fb3[_0x5d9449];return _0x583cf7;};'use strict';var _=require(_0x31fb('0x0'));var util=require(_0x31fb('0x1'));var logger=require(_0x31fb('0x2'))('api');var moment=require('moment');var BPromise=require(_0x31fb('0x3'));var rp=require(_0x31fb('0x4'));var fs=require('fs');var path=require(_0x31fb('0x5'));var rimraf=require('rimraf');var config=require(_0x31fb('0x6'));var attributes=require(_0x31fb('0x7'));module[_0x31fb('0x8')]=function(_0x1aca8a,_0x51d07c){return _0x1aca8a['define'](_0x31fb('0x9'),attributes,{'tableName':_0x31fb('0xa'),'paranoid':![],'indexes':[{'name':_0x31fb('0xb'),'fields':[_0x31fb('0xc'),_0x31fb('0xd')]},{'name':_0x31fb('0xe'),'fields':[_0x31fb('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 27e5afc..40818eb 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 _0xde3c=['result','catch','CreateSquareReport','SquareReport','create','body','options','info','UpdateSquareReport','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x59fd89,_0x3a3b28){var _0x3f1704=function(_0x3973d0){while(--_0x3973d0){_0x59fd89['push'](_0x59fd89['shift']());}};_0x3f1704(++_0x3a3b28);}(_0xde3c,0x1e9));var _0xcde3=function(_0x5cb108,_0x4e2a77){_0x5cb108=_0x5cb108-0x0;var _0x1d9ea1=_0xde3c[_0x5cb108];return _0x1d9ea1;};'use strict';var _=require('lodash');var util=require(_0xcde3('0x0'));var moment=require(_0xcde3('0x1'));var BPromise=require(_0xcde3('0x2'));var rs=require(_0xcde3('0x3'));var fs=require('fs');var Redis=require(_0xcde3('0x4'));var db=require(_0xcde3('0x5'))['db'];var utils=require(_0xcde3('0x6'));var logger=require(_0xcde3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcde3('0x8'));var client=jayson[_0xcde3('0x9')][_0xcde3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cbe76,_0x380ab5,_0x165f4b){return new BPromise(function(_0x28ad5b,_0x481761){return client[_0xcde3('0xb')](_0x2cbe76,_0x165f4b)[_0xcde3('0xc')](function(_0x21a4ac){logger['info'](_0xcde3('0xd'),_0x380ab5,_0xcde3('0xe'));logger[_0xcde3('0xf')](_0xcde3('0x10'),_0x380ab5,_0xcde3('0xe'),JSON[_0xcde3('0x11')](_0x21a4ac));if(_0x21a4ac['error']){if(_0x21a4ac[_0xcde3('0x12')][_0xcde3('0x13')]===0x1f4){logger[_0xcde3('0x12')](_0xcde3('0xd'),_0x380ab5,_0x21a4ac[_0xcde3('0x12')]['message']);return _0x481761(_0x21a4ac[_0xcde3('0x12')][_0xcde3('0x14')]);}logger[_0xcde3('0x12')](_0xcde3('0xd'),_0x380ab5,_0x21a4ac[_0xcde3('0x12')][_0xcde3('0x14')]);return _0x28ad5b(_0x21a4ac[_0xcde3('0x12')][_0xcde3('0x14')]);}else{logger['info'](_0xcde3('0xd'),_0x380ab5,_0xcde3('0xe'));_0x28ad5b(_0x21a4ac[_0xcde3('0x15')]['message']);}})[_0xcde3('0x16')](function(_0x56f368){logger[_0xcde3('0x12')](_0xcde3('0xd'),_0x380ab5,_0x56f368);_0x481761(_0x56f368);});});}exports[_0xcde3('0x17')]=function(_0x127904){var _0x1fcfa9=this;return new Promise(function(_0x40b3c4,_0x5e2fb0){return db[_0xcde3('0x18')][_0xcde3('0x19')](_0x127904[_0xcde3('0x1a')],{'raw':_0x127904[_0xcde3('0x1b')]?_0x127904[_0xcde3('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xcde3('0xc')](function(_0x1da08f){logger[_0xcde3('0x1c')](_0xcde3('0x17'),_0x127904);logger[_0xcde3('0xf')](_0xcde3('0x17'),_0x127904,JSON[_0xcde3('0x11')](_0x1da08f));_0x40b3c4(_0x1da08f);})[_0xcde3('0x16')](function(_0x10619f){logger['error'](_0xcde3('0x17'),_0x10619f[_0xcde3('0x14')],_0x127904);_0x5e2fb0(_0x1fcfa9['error'](0x1f4,_0x10619f[_0xcde3('0x14')]));});});};exports[_0xcde3('0x1d')]=function(_0x2b5ea9){var _0x1dba2c=this;return new Promise(function(_0x59ca28,_0x1597e3){return db[_0xcde3('0x18')]['update'](_0x2b5ea9['body'],{'raw':_0x2b5ea9[_0xcde3('0x1b')]?_0x2b5ea9[_0xcde3('0x1b')][_0xcde3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5ea9[_0xcde3('0x1b')]?_0x2b5ea9[_0xcde3('0x1b')][_0xcde3('0x1f')]||null:null,'attributes':_0x2b5ea9[_0xcde3('0x1b')]?_0x2b5ea9[_0xcde3('0x1b')][_0xcde3('0x20')]||null:null,'limit':_0x2b5ea9[_0xcde3('0x1b')]?_0x2b5ea9[_0xcde3('0x1b')][_0xcde3('0x21')]||null:null})[_0xcde3('0xc')](function(_0x26d2ba){logger[_0xcde3('0x1c')](_0xcde3('0x1d'),_0x2b5ea9);logger[_0xcde3('0xf')](_0xcde3('0x1d'),_0x2b5ea9,JSON[_0xcde3('0x11')](_0x26d2ba));_0x59ca28(_0x26d2ba);})[_0xcde3('0x16')](function(_0x43f5dd){logger[_0xcde3('0x12')]('UpdateSquareReport',_0x43f5dd['message'],_0x2b5ea9);_0x1597e3(_0x1dba2c['error'](0x1f4,_0x43f5dd['message']));});});}; \ No newline at end of file +var _0x4fb6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SquareReport','create','options','raw','then','CreateSquareReport','debug','UpdateSquareReport','update','body','where','lodash','util','moment','ioredis'];(function(_0x3cb9e7,_0x4fc68a){var _0x22092d=function(_0x4358ff){while(--_0x4358ff){_0x3cb9e7['push'](_0x3cb9e7['shift']());}};_0x22092d(++_0x4fc68a);}(_0x4fb6,0x1cd));var _0x64fb=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x4fb6[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require(_0x64fb('0x0'));var util=require(_0x64fb('0x1'));var moment=require(_0x64fb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64fb('0x3'));var db=require(_0x64fb('0x4'))['db'];var utils=require(_0x64fb('0x5'));var logger=require(_0x64fb('0x6'))(_0x64fb('0x7'));var config=require(_0x64fb('0x8'));var jayson=require(_0x64fb('0x9'));var client=jayson[_0x64fb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ed690,_0xb6b49d,_0x541275){return new BPromise(function(_0x12a680,_0x5797b8){return client[_0x64fb('0xb')](_0x3ed690,_0x541275)['then'](function(_0x4155f8){logger[_0x64fb('0xc')](_0x64fb('0xd'),_0xb6b49d,_0x64fb('0xe'));logger['debug'](_0x64fb('0xf'),_0xb6b49d,_0x64fb('0xe'),JSON[_0x64fb('0x10')](_0x4155f8));if(_0x4155f8['error']){if(_0x4155f8['error']['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0xb6b49d,_0x4155f8[_0x64fb('0x11')][_0x64fb('0x12')]);return _0x5797b8(_0x4155f8[_0x64fb('0x11')]['message']);}logger[_0x64fb('0x11')](_0x64fb('0xd'),_0xb6b49d,_0x4155f8[_0x64fb('0x11')][_0x64fb('0x12')]);return _0x12a680(_0x4155f8['error'][_0x64fb('0x12')]);}else{logger['info'](_0x64fb('0xd'),_0xb6b49d,_0x64fb('0xe'));_0x12a680(_0x4155f8['result']['message']);}})[_0x64fb('0x13')](function(_0x1625b2){logger['error']('SquareReport,\x20%s,\x20%s',_0xb6b49d,_0x1625b2);_0x5797b8(_0x1625b2);});});}exports['CreateSquareReport']=function(_0x220cfb){var _0x54b2d7=this;return new Promise(function(_0x55beec,_0x15e5da){return db[_0x64fb('0x14')][_0x64fb('0x15')](_0x220cfb['body'],{'raw':_0x220cfb[_0x64fb('0x16')]?_0x220cfb[_0x64fb('0x16')][_0x64fb('0x17')]===undefined?!![]:![]:!![]})[_0x64fb('0x18')](function(_0x5904a1){logger[_0x64fb('0xc')](_0x64fb('0x19'),_0x220cfb);logger[_0x64fb('0x1a')](_0x64fb('0x19'),_0x220cfb,JSON[_0x64fb('0x10')](_0x5904a1));_0x55beec(_0x5904a1);})[_0x64fb('0x13')](function(_0x18c77b){logger[_0x64fb('0x11')](_0x64fb('0x19'),_0x18c77b['message'],_0x220cfb);_0x15e5da(_0x54b2d7['error'](0x1f4,_0x18c77b[_0x64fb('0x12')]));});});};exports[_0x64fb('0x1b')]=function(_0xd802bf){var _0x6dc02d=this;return new Promise(function(_0x243eb5,_0x2ce4a1){return db[_0x64fb('0x14')][_0x64fb('0x1c')](_0xd802bf[_0x64fb('0x1d')],{'raw':_0xd802bf[_0x64fb('0x16')]?_0xd802bf[_0x64fb('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd802bf[_0x64fb('0x16')]?_0xd802bf[_0x64fb('0x16')][_0x64fb('0x1e')]||null:null,'attributes':_0xd802bf[_0x64fb('0x16')]?_0xd802bf[_0x64fb('0x16')]['attributes']||null:null,'limit':_0xd802bf[_0x64fb('0x16')]?_0xd802bf['options']['limit']||null:null})[_0x64fb('0x18')](function(_0xbbd0ed){logger[_0x64fb('0xc')](_0x64fb('0x1b'),_0xd802bf);logger[_0x64fb('0x1a')](_0x64fb('0x1b'),_0xd802bf,JSON[_0x64fb('0x10')](_0xbbd0ed));_0x243eb5(_0xbbd0ed);})[_0x64fb('0x13')](function(_0x1a51df){logger[_0x64fb('0x11')](_0x64fb('0x1b'),_0x1a51df[_0x64fb('0x12')],_0xd802bf);_0x2ce4a1(_0x6dc02d[_0x64fb('0x11')](0x1f4,_0x1a51df[_0x64fb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 905e76c..2de7496 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 _0xcfcc=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','post','create','put','/:id','delete','destroy','exports'];(function(_0x252547,_0x3b877e){var _0x4703d5=function(_0x3760b6){while(--_0x3760b6){_0x252547['push'](_0x252547['shift']());}};_0x4703d5(++_0x3b877e);}(_0xcfcc,0x64));var _0xccfc=function(_0x4c8a05,_0x43fdda){_0x4c8a05=_0x4c8a05-0x0;var _0x2819d7=_0xcfcc[_0x4c8a05];return _0x2819d7;};'use strict';var multer=require(_0xccfc('0x0'));var util=require('util');var path=require(_0xccfc('0x1'));var timeout=require(_0xccfc('0x2'));var express=require(_0xccfc('0x3'));var router=express[_0xccfc('0x4')]();var fs_extra=require(_0xccfc('0x5'));var auth=require(_0xccfc('0x6'));var interaction=require(_0xccfc('0x7'));var config=require(_0xccfc('0x8'));var controller=require('./squareReportDetail.controller');router[_0xccfc('0x9')]('/',auth[_0xccfc('0xa')](),controller[_0xccfc('0xb')]);router[_0xccfc('0x9')]('/describe',auth[_0xccfc('0xa')](),controller[_0xccfc('0xc')]);router['get']('/:id',auth[_0xccfc('0xa')](),controller['show']);router[_0xccfc('0xd')]('/',auth['isAuthenticated'](),controller[_0xccfc('0xe')]);router[_0xccfc('0xf')](_0xccfc('0x10'),auth[_0xccfc('0xa')](),controller['update']);router[_0xccfc('0x11')](_0xccfc('0x10'),auth[_0xccfc('0xa')](),controller[_0xccfc('0x12')]);module[_0xccfc('0x13')]=router; \ No newline at end of file +var _0xfcef=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x50f895,_0x5e61ec){var _0x4211af=function(_0x41ecb1){while(--_0x41ecb1){_0x50f895['push'](_0x50f895['shift']());}};_0x4211af(++_0x5e61ec);}(_0xfcef,0x1f2));var _0xffce=function(_0x299f6b,_0x583d53){_0x299f6b=_0x299f6b-0x0;var _0xb816aa=_0xfcef[_0x299f6b];return _0xb816aa;};'use strict';var multer=require(_0xffce('0x0'));var util=require(_0xffce('0x1'));var path=require(_0xffce('0x2'));var timeout=require(_0xffce('0x3'));var express=require(_0xffce('0x4'));var router=express[_0xffce('0x5')]();var fs_extra=require(_0xffce('0x6'));var auth=require(_0xffce('0x7'));var interaction=require(_0xffce('0x8'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xffce('0x9')]('/',auth[_0xffce('0xa')](),controller[_0xffce('0xb')]);router['get']('/describe',auth[_0xffce('0xa')](),controller[_0xffce('0xc')]);router[_0xffce('0x9')](_0xffce('0xd'),auth[_0xffce('0xa')](),controller['show']);router['post']('/',auth[_0xffce('0xa')](),controller['create']);router[_0xffce('0xe')]('/:id',auth[_0xffce('0xa')](),controller[_0xffce('0xf')]);router[_0xffce('0x10')](_0xffce('0xd'),auth[_0xffce('0xa')](),controller['destroy']);module[_0xffce('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 25cbaee..ae15ada 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 _0x50b0=['exports','STRING','TEXT'];(function(_0x9ed129,_0x4a3d9c){var _0x100eb6=function(_0x356fcc){while(--_0x356fcc){_0x9ed129['push'](_0x9ed129['shift']());}};_0x100eb6(++_0x4a3d9c);}(_0x50b0,0xcf));var _0x050b=function(_0x3c770d,_0x1e7a95){_0x3c770d=_0x3c770d-0x0;var _0x2cf94a=_0x50b0[_0x3c770d];return _0x2cf94a;};'use strict';var Sequelize=require('sequelize');module[_0x050b('0x0')]={'uniqueid':{'type':Sequelize[_0x050b('0x1')]},'node':{'type':Sequelize[_0x050b('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x050b('0x2')]},'project_name':{'type':Sequelize[_0x050b('0x1')]},'callerid':{'type':Sequelize[_0x050b('0x1')]}}; \ No newline at end of file +var _0x8b4f=['exports','STRING','TEXT'];(function(_0x53a5e2,_0x4d0f98){var _0x1eb46e=function(_0x13cc65){while(--_0x13cc65){_0x53a5e2['push'](_0x53a5e2['shift']());}};_0x1eb46e(++_0x4d0f98);}(_0x8b4f,0x108));var _0xf8b4=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x8b4f[_0x2e655a];return _0x26f13b;};'use strict';var Sequelize=require('sequelize');module[_0xf8b4('0x0')]={'uniqueid':{'type':Sequelize[_0xf8b4('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xf8b4('0x1')]},'data':{'type':Sequelize[_0xf8b4('0x2')]},'project_name':{'type':Sequelize[_0xf8b4('0x1')]},'callerid':{'type':Sequelize[_0xf8b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b871301..78e4419 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 _0x3ccd=['find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','keys','length','options'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3ccd,0x12a));var _0xd3cc=function(_0x513942,_0x4f28e8){_0x513942=_0x513942-0x0;var _0x305fe0=_0x3ccd[_0x513942];return _0x305fe0;};'use strict';var emlformat=require(_0xd3cc('0x0'));var rimraf=require(_0xd3cc('0x1'));var zipdir=require(_0xd3cc('0x2'));var jsonpatch=require(_0xd3cc('0x3'));var rp=require(_0xd3cc('0x4'));var moment=require(_0xd3cc('0x5'));var BPromise=require(_0xd3cc('0x6'));var Mustache=require(_0xd3cc('0x7'));var util=require(_0xd3cc('0x8'));var path=require(_0xd3cc('0x9'));var sox=require('sox');var csv=require(_0xd3cc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3cc('0xb'));var _=require(_0xd3cc('0xc'));var squel=require('squel');var crypto=require(_0xd3cc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd3cc('0xe'));var authService=require(_0xd3cc('0xf'));var qs=require(_0xd3cc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3cc('0x11'))(_0xd3cc('0x12'));var utils=require(_0xd3cc('0x13'));var config=require(_0xd3cc('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd3cc('0x15'))['db'];function respondWithStatusCode(_0x3c201a,_0x57ec7a){_0x57ec7a=_0x57ec7a||0xcc;return function(_0x9d8817){if(_0x9d8817){return _0x3c201a[_0xd3cc('0x16')](_0x57ec7a);}return _0x3c201a[_0xd3cc('0x17')](_0x57ec7a)['end']();};}function respondWithResult(_0x5ee3da,_0x45269c){_0x45269c=_0x45269c||0xc8;return function(_0x136bf4){if(_0x136bf4){return _0x5ee3da[_0xd3cc('0x17')](_0x45269c)[_0xd3cc('0x18')](_0x136bf4);}};}function respondWithFilteredResult(_0x5cc7b,_0x9467c6){return function(_0x3059c0){if(_0x3059c0){var _0x344b34=typeof _0x9467c6['offset']==='undefined'&&typeof _0x9467c6[_0xd3cc('0x19')]===_0xd3cc('0x1a');var _0x3d8ecc=_0x3059c0['count'];var _0x316827=_0x344b34?0x0:_0x9467c6['offset'];var _0x2b0f30=_0x344b34?_0x3059c0['count']:_0x9467c6['offset']+_0x9467c6[_0xd3cc('0x19')];var _0x36f510;if(_0x2b0f30>=_0x3d8ecc){_0x2b0f30=_0x3d8ecc;_0x36f510=0xc8;}else{_0x36f510=0xce;}_0x5cc7b[_0xd3cc('0x17')](_0x36f510);return _0x5cc7b['set'](_0xd3cc('0x1b'),_0x316827+'-'+_0x2b0f30+'/'+_0x3d8ecc)[_0xd3cc('0x18')](_0x3059c0);}return null;};}function patchUpdates(_0x31246f){return function(_0x1bdd78){try{jsonpatch[_0xd3cc('0x1c')](_0x1bdd78,_0x31246f,!![]);}catch(_0x395ba5){return BPromise['reject'](_0x395ba5);}return _0x1bdd78[_0xd3cc('0x1d')]();};}function saveUpdates(_0x5930e1,_0x5261dd){return function(_0x15c61d){if(_0x15c61d){return _0x15c61d['update'](_0x5930e1)[_0xd3cc('0x1e')](function(_0x5311c2){return _0x5311c2;});}return null;};}function removeEntity(_0x125b6b,_0x42e7c5){return function(_0x2c8559){if(_0x2c8559){return _0x2c8559[_0xd3cc('0x1f')]()[_0xd3cc('0x1e')](function(){_0x125b6b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x179849,_0x38605c){return function(_0x142407){if(!_0x142407){_0x179849['sendStatus'](0x194);}return _0x142407;};}function handleError(_0x2e4539,_0x1ca6a3){_0x1ca6a3=_0x1ca6a3||0x1f4;return function(_0x4d976d){logger[_0xd3cc('0x20')](_0x4d976d[_0xd3cc('0x21')]);if(_0x4d976d[_0xd3cc('0x22')]){delete _0x4d976d[_0xd3cc('0x22')];}_0x2e4539[_0xd3cc('0x17')](_0x1ca6a3)[_0xd3cc('0x23')](_0x4d976d);};}exports[_0xd3cc('0x24')]=function(_0x621bab,_0x3e2f6c){var _0x38037e={},_0xf7a1e8={},_0x2be69c={'count':0x0,'rows':[]};var _0x259f08=_[_0xd3cc('0x25')](db[_0xd3cc('0x26')][_0xd3cc('0x27')],function(_0x4eed37){return{'name':_0x4eed37[_0xd3cc('0x28')],'type':_0x4eed37[_0xd3cc('0x29')]['key']};});_0xf7a1e8[_0xd3cc('0x2a')]=_[_0xd3cc('0x25')](_0x259f08,_0xd3cc('0x22'));_0xf7a1e8[_0xd3cc('0x2b')]=_['keys'](_0x621bab['query']);_0xf7a1e8[_0xd3cc('0x2c')]=_[_0xd3cc('0x2d')](_0xf7a1e8[_0xd3cc('0x2a')],_0xf7a1e8[_0xd3cc('0x2b')]);_0x38037e[_0xd3cc('0x2e')]=_[_0xd3cc('0x2d')](_0xf7a1e8[_0xd3cc('0x2a')],qs[_0xd3cc('0x2f')](_0x621bab[_0xd3cc('0x2b')][_0xd3cc('0x2f')]));_0x38037e[_0xd3cc('0x2e')]=_0x38037e['attributes']['length']?_0x38037e[_0xd3cc('0x2e')]:_0xf7a1e8[_0xd3cc('0x2a')];if(!_0x621bab[_0xd3cc('0x2b')][_0xd3cc('0x30')](_0xd3cc('0x31'))){_0x38037e['limit']=qs[_0xd3cc('0x19')](_0x621bab['query'][_0xd3cc('0x19')]);_0x38037e['offset']=qs[_0xd3cc('0x32')](_0x621bab[_0xd3cc('0x2b')][_0xd3cc('0x32')]);}_0x38037e[_0xd3cc('0x33')]=qs[_0xd3cc('0x34')](_0x621bab[_0xd3cc('0x2b')]['sort']);_0x38037e[_0xd3cc('0x35')]=qs['filters'](_[_0xd3cc('0x36')](_0x621bab[_0xd3cc('0x2b')],_0xf7a1e8[_0xd3cc('0x2c')]),_0x259f08);if(_0x621bab[_0xd3cc('0x2b')][_0xd3cc('0x37')]){_0x38037e[_0xd3cc('0x35')]=_['merge'](_0x38037e[_0xd3cc('0x35')],{'$or':_[_0xd3cc('0x25')](_0x259f08,function(_0x29de2f){if(_0x29de2f[_0xd3cc('0x29')]!==_0xd3cc('0x38')){var _0x57ff68={};_0x57ff68[_0x29de2f[_0xd3cc('0x22')]]={'$like':'%'+_0x621bab[_0xd3cc('0x2b')]['filter']+'%'};return _0x57ff68;}})});}_0x38037e=_[_0xd3cc('0x39')]({},_0x38037e,_0x621bab['options']);var _0xd27179={'where':_0x38037e['where']};return db[_0xd3cc('0x26')]['count'](_0xd27179)[_0xd3cc('0x1e')](function(_0x1b04fa){_0x2be69c[_0xd3cc('0x3a')]=_0x1b04fa;if(_0x621bab[_0xd3cc('0x2b')][_0xd3cc('0x3b')]){_0x38037e[_0xd3cc('0x3c')]=[{'all':!![]}];}return db[_0xd3cc('0x26')][_0xd3cc('0x3d')](_0x38037e);})[_0xd3cc('0x1e')](function(_0x4c2d55){_0x2be69c[_0xd3cc('0x3e')]=_0x4c2d55;return _0x2be69c;})[_0xd3cc('0x1e')](respondWithFilteredResult(_0x3e2f6c,_0x38037e))[_0xd3cc('0x3f')](handleError(_0x3e2f6c,null));};exports['show']=function(_0x586c14,_0x46f72c){var _0x1c7cea={'raw':!![],'where':{'id':_0x586c14['params']['id']}},_0x4cdac4={};_0x4cdac4[_0xd3cc('0x2a')]=_[_0xd3cc('0x40')](db['SquareDetailsReport'][_0xd3cc('0x27')]);_0x4cdac4[_0xd3cc('0x2b')]=_['keys'](_0x586c14['query']);_0x4cdac4[_0xd3cc('0x2c')]=_['intersection'](_0x4cdac4['model'],_0x4cdac4['query']);_0x1c7cea[_0xd3cc('0x2e')]=_[_0xd3cc('0x2d')](_0x4cdac4[_0xd3cc('0x2a')],qs[_0xd3cc('0x2f')](_0x586c14[_0xd3cc('0x2b')][_0xd3cc('0x2f')]));_0x1c7cea[_0xd3cc('0x2e')]=_0x1c7cea[_0xd3cc('0x2e')][_0xd3cc('0x41')]?_0x1c7cea[_0xd3cc('0x2e')]:_0x4cdac4[_0xd3cc('0x2a')];if(_0x586c14[_0xd3cc('0x2b')][_0xd3cc('0x3b')]){_0x1c7cea[_0xd3cc('0x3c')]=[{'all':!![]}];}_0x1c7cea=_[_0xd3cc('0x39')]({},_0x1c7cea,_0x586c14[_0xd3cc('0x42')]);return db[_0xd3cc('0x26')][_0xd3cc('0x43')](_0x1c7cea)[_0xd3cc('0x1e')](handleEntityNotFound(_0x46f72c,null))['then'](respondWithResult(_0x46f72c,null))['catch'](handleError(_0x46f72c,null));};exports['create']=function(_0x3b7828,_0x384802){return db[_0xd3cc('0x26')][_0xd3cc('0x44')](_0x3b7828['body'],{})[_0xd3cc('0x1e')](respondWithResult(_0x384802,0xc9))[_0xd3cc('0x3f')](handleError(_0x384802,null));};exports[_0xd3cc('0x45')]=function(_0x2eea63,_0x45e013){if(_0x2eea63[_0xd3cc('0x46')]['id']){delete _0x2eea63[_0xd3cc('0x46')]['id'];}return db[_0xd3cc('0x26')][_0xd3cc('0x43')]({'where':{'id':_0x2eea63[_0xd3cc('0x47')]['id']}})[_0xd3cc('0x1e')](handleEntityNotFound(_0x45e013,null))['then'](saveUpdates(_0x2eea63[_0xd3cc('0x46')],null))[_0xd3cc('0x1e')](respondWithResult(_0x45e013,null))[_0xd3cc('0x3f')](handleError(_0x45e013,null));};exports[_0xd3cc('0x1f')]=function(_0x2ca6ab,_0x1878d0){return db[_0xd3cc('0x26')][_0xd3cc('0x43')]({'where':{'id':_0x2ca6ab[_0xd3cc('0x47')]['id']}})[_0xd3cc('0x1e')](handleEntityNotFound(_0x1878d0,null))[_0xd3cc('0x1e')](removeEntity(_0x1878d0,null))[_0xd3cc('0x3f')](handleError(_0x1878d0,null));};exports[_0xd3cc('0x48')]=function(_0x4421b2,_0x26c447){return db[_0xd3cc('0x26')][_0xd3cc('0x48')]()[_0xd3cc('0x1e')](respondWithResult(_0x26c447,null))['catch'](handleError(_0x26c447,null));}; \ No newline at end of file +var _0x204a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','filters','pick','filter','merge','where','VIRTUAL','options','SquareDetailsReport','includeAll','include','rows','show','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x27ffa8,_0x3629bd){var _0x4542f7=function(_0x248668){while(--_0x248668){_0x27ffa8['push'](_0x27ffa8['shift']());}};_0x4542f7(++_0x3629bd);}(_0x204a,0x7f));var _0xa204=function(_0x39ebe2,_0x483b07){_0x39ebe2=_0x39ebe2-0x0;var _0x128a7c=_0x204a[_0x39ebe2];return _0x128a7c;};'use strict';var emlformat=require(_0xa204('0x0'));var rimraf=require(_0xa204('0x1'));var zipdir=require(_0xa204('0x2'));var jsonpatch=require(_0xa204('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa204('0x4'));var Mustache=require(_0xa204('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa204('0x6'));var ejs=require(_0xa204('0x7'));var fs=require('fs');var fs_extra=require(_0xa204('0x8'));var _=require(_0xa204('0x9'));var squel=require(_0xa204('0xa'));var crypto=require('crypto');var jsforce=require(_0xa204('0xb'));var deskjs=require(_0xa204('0xc'));var toCsv=require(_0xa204('0x6'));var querystring=require(_0xa204('0xd'));var Papa=require(_0xa204('0xe'));var Redis=require(_0xa204('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa204('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa204('0x11'))(_0xa204('0x12'));var utils=require('../../config/utils');var config=require(_0xa204('0x13'));var licenseUtil=require(_0xa204('0x14'));var db=require(_0xa204('0x15'))['db'];function respondWithStatusCode(_0x12d278,_0x4844ce){_0x4844ce=_0x4844ce||0xcc;return function(_0x1ebac0){if(_0x1ebac0){return _0x12d278[_0xa204('0x16')](_0x4844ce);}return _0x12d278[_0xa204('0x17')](_0x4844ce)[_0xa204('0x18')]();};}function respondWithResult(_0x58d4b0,_0x5a8514){_0x5a8514=_0x5a8514||0xc8;return function(_0x1e8c44){if(_0x1e8c44){return _0x58d4b0[_0xa204('0x17')](_0x5a8514)[_0xa204('0x19')](_0x1e8c44);}};}function respondWithFilteredResult(_0x2c0a4e,_0x2918f5){return function(_0x1b8a2f){if(_0x1b8a2f){var _0x133367=typeof _0x2918f5[_0xa204('0x1a')]==='undefined'&&typeof _0x2918f5['limit']===_0xa204('0x1b');var _0x208c46=_0x1b8a2f[_0xa204('0x1c')];var _0x5a2798=_0x133367?0x0:_0x2918f5[_0xa204('0x1a')];var _0x182ca6=_0x133367?_0x1b8a2f[_0xa204('0x1c')]:_0x2918f5['offset']+_0x2918f5['limit'];var _0x4ef5af;if(_0x182ca6>=_0x208c46){_0x182ca6=_0x208c46;_0x4ef5af=0xc8;}else{_0x4ef5af=0xce;}_0x2c0a4e[_0xa204('0x17')](_0x4ef5af);return _0x2c0a4e[_0xa204('0x1d')](_0xa204('0x1e'),_0x5a2798+'-'+_0x182ca6+'/'+_0x208c46)[_0xa204('0x19')](_0x1b8a2f);}return null;};}function patchUpdates(_0x42fabb){return function(_0x31c95c){try{jsonpatch[_0xa204('0x1f')](_0x31c95c,_0x42fabb,!![]);}catch(_0x3fa0f3){return BPromise[_0xa204('0x20')](_0x3fa0f3);}return _0x31c95c[_0xa204('0x21')]();};}function saveUpdates(_0x3b78c3,_0x167d03){return function(_0x24cfb5){if(_0x24cfb5){return _0x24cfb5[_0xa204('0x22')](_0x3b78c3)[_0xa204('0x23')](function(_0x55a29d){return _0x55a29d;});}return null;};}function removeEntity(_0x3d415c,_0x3cad06){return function(_0x47f9c3){if(_0x47f9c3){return _0x47f9c3[_0xa204('0x24')]()['then'](function(){_0x3d415c[_0xa204('0x17')](0xcc)[_0xa204('0x18')]();});}};}function handleEntityNotFound(_0x5eb479,_0x273cc6){return function(_0xccdc69){if(!_0xccdc69){_0x5eb479['sendStatus'](0x194);}return _0xccdc69;};}function handleError(_0x562ca0,_0x10adc9){_0x10adc9=_0x10adc9||0x1f4;return function(_0x46ae08){logger['error'](_0x46ae08[_0xa204('0x25')]);if(_0x46ae08[_0xa204('0x26')]){delete _0x46ae08[_0xa204('0x26')];}_0x562ca0[_0xa204('0x17')](_0x10adc9)[_0xa204('0x27')](_0x46ae08);};}exports[_0xa204('0x28')]=function(_0x10e76e,_0x3ba08b){var _0x21fc62={},_0x10b408={},_0x15ea9d={'count':0x0,'rows':[]};var _0x2fc9df=_[_0xa204('0x29')](db['SquareDetailsReport']['rawAttributes'],function(_0x5817ba){return{'name':_0x5817ba['fieldName'],'type':_0x5817ba[_0xa204('0x2a')][_0xa204('0x2b')]};});_0x10b408[_0xa204('0x2c')]=_['map'](_0x2fc9df,_0xa204('0x26'));_0x10b408[_0xa204('0x2d')]=_[_0xa204('0x2e')](_0x10e76e[_0xa204('0x2d')]);_0x10b408['filters']=_[_0xa204('0x2f')](_0x10b408[_0xa204('0x2c')],_0x10b408[_0xa204('0x2d')]);_0x21fc62[_0xa204('0x30')]=_[_0xa204('0x2f')](_0x10b408[_0xa204('0x2c')],qs[_0xa204('0x31')](_0x10e76e[_0xa204('0x2d')][_0xa204('0x31')]));_0x21fc62[_0xa204('0x30')]=_0x21fc62['attributes'][_0xa204('0x32')]?_0x21fc62['attributes']:_0x10b408[_0xa204('0x2c')];if(!_0x10e76e[_0xa204('0x2d')][_0xa204('0x33')]('nolimit')){_0x21fc62['limit']=qs['limit'](_0x10e76e[_0xa204('0x2d')][_0xa204('0x34')]);_0x21fc62[_0xa204('0x1a')]=qs[_0xa204('0x1a')](_0x10e76e[_0xa204('0x2d')]['offset']);}_0x21fc62['order']=qs['sort'](_0x10e76e['query'][_0xa204('0x35')]);_0x21fc62['where']=qs[_0xa204('0x36')](_[_0xa204('0x37')](_0x10e76e[_0xa204('0x2d')],_0x10b408[_0xa204('0x36')]),_0x2fc9df);if(_0x10e76e[_0xa204('0x2d')][_0xa204('0x38')]){_0x21fc62['where']=_[_0xa204('0x39')](_0x21fc62[_0xa204('0x3a')],{'$or':_['map'](_0x2fc9df,function(_0x12e17f){if(_0x12e17f[_0xa204('0x2a')]!==_0xa204('0x3b')){var _0x5735fe={};_0x5735fe[_0x12e17f[_0xa204('0x26')]]={'$like':'%'+_0x10e76e[_0xa204('0x2d')]['filter']+'%'};return _0x5735fe;}})});}_0x21fc62=_['merge']({},_0x21fc62,_0x10e76e[_0xa204('0x3c')]);var _0x20ecbb={'where':_0x21fc62[_0xa204('0x3a')]};return db[_0xa204('0x3d')][_0xa204('0x1c')](_0x20ecbb)[_0xa204('0x23')](function(_0x39a878){_0x15ea9d[_0xa204('0x1c')]=_0x39a878;if(_0x10e76e[_0xa204('0x2d')][_0xa204('0x3e')]){_0x21fc62[_0xa204('0x3f')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x21fc62);})['then'](function(_0x3e2c57){_0x15ea9d[_0xa204('0x40')]=_0x3e2c57;return _0x15ea9d;})[_0xa204('0x23')](respondWithFilteredResult(_0x3ba08b,_0x21fc62))['catch'](handleError(_0x3ba08b,null));};exports[_0xa204('0x41')]=function(_0x330ccf,_0xff128b){var _0x2febf5={'raw':!![],'where':{'id':_0x330ccf['params']['id']}},_0x1bcc78={};_0x1bcc78[_0xa204('0x2c')]=_[_0xa204('0x2e')](db[_0xa204('0x3d')][_0xa204('0x42')]);_0x1bcc78[_0xa204('0x2d')]=_[_0xa204('0x2e')](_0x330ccf[_0xa204('0x2d')]);_0x1bcc78[_0xa204('0x36')]=_['intersection'](_0x1bcc78[_0xa204('0x2c')],_0x1bcc78[_0xa204('0x2d')]);_0x2febf5[_0xa204('0x30')]=_['intersection'](_0x1bcc78[_0xa204('0x2c')],qs['fields'](_0x330ccf['query']['fields']));_0x2febf5[_0xa204('0x30')]=_0x2febf5['attributes'][_0xa204('0x32')]?_0x2febf5[_0xa204('0x30')]:_0x1bcc78[_0xa204('0x2c')];if(_0x330ccf[_0xa204('0x2d')]['includeAll']){_0x2febf5[_0xa204('0x3f')]=[{'all':!![]}];}_0x2febf5=_['merge']({},_0x2febf5,_0x330ccf['options']);return db['SquareDetailsReport'][_0xa204('0x43')](_0x2febf5)[_0xa204('0x23')](handleEntityNotFound(_0xff128b,null))['then'](respondWithResult(_0xff128b,null))[_0xa204('0x44')](handleError(_0xff128b,null));};exports[_0xa204('0x45')]=function(_0x4ea0ee,_0x50ec69){return db[_0xa204('0x3d')]['create'](_0x4ea0ee[_0xa204('0x46')],{})[_0xa204('0x23')](respondWithResult(_0x50ec69,0xc9))[_0xa204('0x44')](handleError(_0x50ec69,null));};exports[_0xa204('0x22')]=function(_0x318956,_0x7d5d5a){if(_0x318956[_0xa204('0x46')]['id']){delete _0x318956[_0xa204('0x46')]['id'];}return db[_0xa204('0x3d')]['find']({'where':{'id':_0x318956['params']['id']}})[_0xa204('0x23')](handleEntityNotFound(_0x7d5d5a,null))[_0xa204('0x23')](saveUpdates(_0x318956[_0xa204('0x46')],null))[_0xa204('0x23')](respondWithResult(_0x7d5d5a,null))[_0xa204('0x44')](handleError(_0x7d5d5a,null));};exports[_0xa204('0x24')]=function(_0x2b4171,_0x46261f){return db['SquareDetailsReport'][_0xa204('0x43')]({'where':{'id':_0x2b4171[_0xa204('0x47')]['id']}})['then'](handleEntityNotFound(_0x46261f,null))['then'](removeEntity(_0x46261f,null))['catch'](handleError(_0x46261f,null));};exports[_0xa204('0x48')]=function(_0x2115c5,_0x24237b){return db[_0xa204('0x3d')][_0xa204('0x48')]()[_0xa204('0x23')](respondWithResult(_0x24237b,null))[_0xa204('0x44')](handleError(_0x24237b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 410b535..7329c5e 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 _0x1062=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','lodash','../../config/logger','api'];(function(_0x59c002,_0xa51beb){var _0x11eaed=function(_0x35f969){while(--_0x35f969){_0x59c002['push'](_0x59c002['shift']());}};_0x11eaed(++_0xa51beb);}(_0x1062,0x1e1));var _0x2106=function(_0x2a3030,_0x26b040){_0x2a3030=_0x2a3030-0x0;var _0xc8145a=_0x1062[_0x2a3030];return _0xc8145a;};'use strict';var _=require(_0x2106('0x0'));var util=require('util');var logger=require(_0x2106('0x1'))(_0x2106('0x2'));var moment=require(_0x2106('0x3'));var BPromise=require(_0x2106('0x4'));var rp=require(_0x2106('0x5'));var fs=require('fs');var path=require(_0x2106('0x6'));var rimraf=require(_0x2106('0x7'));var config=require(_0x2106('0x8'));var attributes=require(_0x2106('0x9'));module[_0x2106('0xa')]=function(_0x836207,_0x49e0c7){return _0x836207['define']('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca61=['define','report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4458b0,_0x5c4d10){var _0xa3feb4=function(_0x585e8a){while(--_0x585e8a){_0x4458b0['push'](_0x4458b0['shift']());}};_0xa3feb4(++_0x5c4d10);}(_0xca61,0x1be));var _0x1ca6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xca61[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1ca6('0x0'));var logger=require(_0x1ca6('0x1'))(_0x1ca6('0x2'));var moment=require(_0x1ca6('0x3'));var BPromise=require(_0x1ca6('0x4'));var rp=require(_0x1ca6('0x5'));var fs=require('fs');var path=require(_0x1ca6('0x6'));var rimraf=require(_0x1ca6('0x7'));var config=require(_0x1ca6('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x1ca6('0x9')]=function(_0x4ce98a,_0x1e91ef){return _0x4ce98a[_0x1ca6('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x1ca6('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 b6c55f1..d0d1c97 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 _0x94d2=['stringify','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x94d2,0x1cd));var _0x294d=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x94d2[_0x1ee351];return _0x245aaf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x294d('0x0'));var BPromise=require(_0x294d('0x1'));var rs=require(_0x294d('0x2'));var fs=require('fs');var Redis=require(_0x294d('0x3'));var db=require(_0x294d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x294d('0x5'));var config=require(_0x294d('0x6'));var jayson=require(_0x294d('0x7'));var client=jayson[_0x294d('0x8')][_0x294d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e023f,_0x5c3d7c,_0x2cf111){return new BPromise(function(_0x6653fc,_0x1cd249){return client[_0x294d('0xa')](_0x5e023f,_0x2cf111)[_0x294d('0xb')](function(_0x49923f){logger[_0x294d('0xc')](_0x294d('0xd'),_0x5c3d7c,'request\x20sent');logger[_0x294d('0xe')](_0x294d('0xf'),_0x5c3d7c,'request\x20sent',JSON['stringify'](_0x49923f));if(_0x49923f[_0x294d('0x10')]){if(_0x49923f[_0x294d('0x10')][_0x294d('0x11')]===0x1f4){logger['error'](_0x294d('0xd'),_0x5c3d7c,_0x49923f[_0x294d('0x10')][_0x294d('0x12')]);return _0x1cd249(_0x49923f[_0x294d('0x10')]['message']);}logger[_0x294d('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c3d7c,_0x49923f['error'][_0x294d('0x12')]);return _0x6653fc(_0x49923f[_0x294d('0x10')][_0x294d('0x12')]);}else{logger[_0x294d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c3d7c,_0x294d('0x13'));_0x6653fc(_0x49923f['result']['message']);}})['catch'](function(_0x4f2436){logger[_0x294d('0x10')](_0x294d('0xd'),_0x5c3d7c,_0x4f2436);_0x1cd249(_0x4f2436);});});}exports[_0x294d('0x14')]=function(_0x46d9c5){var _0x17156c=this;return new Promise(function(_0x26563e,_0x199a1a){return db[_0x294d('0x15')]['create'](_0x46d9c5[_0x294d('0x16')],{'raw':_0x46d9c5[_0x294d('0x17')]?_0x46d9c5['options'][_0x294d('0x18')]===undefined?!![]:![]:!![]})[_0x294d('0xb')](function(_0x429da3){logger[_0x294d('0xc')](_0x294d('0x14'),_0x46d9c5);logger[_0x294d('0xe')](_0x294d('0x14'),_0x46d9c5,JSON[_0x294d('0x19')](_0x429da3));_0x26563e(_0x429da3);})[_0x294d('0x1a')](function(_0x11df11){logger[_0x294d('0x10')](_0x294d('0x14'),_0x11df11[_0x294d('0x12')],_0x46d9c5);_0x199a1a(_0x17156c[_0x294d('0x10')](0x1f4,_0x11df11[_0x294d('0x12')]));});});}; \ No newline at end of file +var _0xef0f=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xef0f,0x168));var _0xfef0=function(_0x1fc03a,_0x3c1936){_0x1fc03a=_0x1fc03a-0x0;var _0x528c01=_0xef0f[_0x1fc03a];return _0x528c01;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')](_0x581459['body'],{'raw':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1c')]===undefined?!![]:![]:!![]})[_0xfef0('0xc')](function(_0x28dee1){logger['info'](_0xfef0('0x18'),_0x581459);logger['debug'](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x28dee1));_0x1642cd(_0x28dee1);})['catch'](function(_0x4897af){logger['error'](_0xfef0('0x18'),_0x4897af['message'],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x4897af[_0xfef0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index de2bb66..6db12d0 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 _0x1ca2=['index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x1ca2,0x126));var _0x21ca=function(_0x381d3c,_0x4bc7d0){_0x381d3c=_0x381d3c-0x0;var _0x12542e=_0x1ca2[_0x381d3c];return _0x12542e;};'use strict';var express=require(_0x21ca('0x0'));var router=express[_0x21ca('0x1')]();var auth=require(_0x21ca('0x2'));var controller=require(_0x21ca('0x3'));router[_0x21ca('0x4')]('/',auth[_0x21ca('0x5')](),controller[_0x21ca('0x6')]);router[_0x21ca('0x4')](_0x21ca('0x7'),auth[_0x21ca('0x5')](),controller[_0x21ca('0x8')]);module[_0x21ca('0x9')]=router; \ No newline at end of file +var _0x7776=['Router','../../components/auth/service','./system.controller','isAuthenticated','index','get','killProcess','express'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x7776,0xff));var _0x6777=function(_0x1b356f,_0x3663d8){_0x1b356f=_0x1b356f-0x0;var _0x1fdb50=_0x7776[_0x1b356f];return _0x1fdb50;};'use strict';var express=require(_0x6777('0x0'));var router=express[_0x6777('0x1')]();var auth=require(_0x6777('0x2'));var controller=require(_0x6777('0x3'));router['get']('/',auth[_0x6777('0x4')](),controller[_0x6777('0x5')]);router[_0x6777('0x6')]('/process/:pid/kill',auth[_0x6777('0x4')](),controller[_0x6777('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 264b380..f1b80cf 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 _0x160f=['length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','inspect','name','send','index','getAllData','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split'];(function(_0x16e633,_0x23a7ec){var _0x512883=function(_0x1cf922){while(--_0x1cf922){_0x16e633['push'](_0x16e633['shift']());}};_0x512883(++_0x23a7ec);}(_0x160f,0x161));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0xf160('0x0'));var exec=require(_0xf160('0x1'))[_0xf160('0x2')];var logger=require(_0xf160('0x3'))(_0xf160('0x4'));var util=require(_0xf160('0x5'));var BPromise=require(_0xf160('0x6'));var _=require(_0xf160('0x7'));function handleError(_0x5eab5f,_0x3f7f76,_0x2a7299){_0x3f7f76=_0x3f7f76||0x1f4;return function(_0x54778c){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2a7299,_0x3f7f76,util[_0xf160('0x8')](_0x54778c,{'showHidden':![],'depth':null}));delete _0x54778c[_0xf160('0x9')];_0x5eab5f['status'](_0x3f7f76)[_0xf160('0xa')](_0x54778c);};}exports[_0xf160('0xb')]=function(_0x51ec93,_0x342885){return info[_0xf160('0xc')]()[_0xf160('0xd')](function(_0x5e26b2){return _0x342885[_0xf160('0xe')](0xc8)[_0xf160('0xf')](_0x5e26b2);})[_0xf160('0x10')](function(_0x27eda6){return _0x342885[_0xf160('0xe')](0x1f4)[_0xf160('0xf')](_0x27eda6);});};exports[_0xf160('0x11')]=function(_0x3e621b,_0x50fb56){var _0x534dfe=[_0xf160('0x12')];return new BPromise(function(_0x1d302c,_0x12f3da){return exec(util[_0xf160('0x13')](_0xf160('0x14'),_0x3e621b[_0xf160('0x15')][_0xf160('0x16')]),function(_0xd26b52,_0x2e28c8,_0x10c3f0){if(_0xd26b52){return _0x12f3da(_0xd26b52);}return _0x1d302c(_0x2e28c8);});})[_0xf160('0xd')](function(_0x3f4ffb){var _0x5b0e49=![];var _0x37751f=_0x3f4ffb[_0xf160('0x17')](/\n/);for(var _0x27f91b=0x0,_0x12e13f=_0x534dfe[_0xf160('0x18')];_0x27f91b<_0x12e13f,_0x5b0e49===![];_0x27f91b+=0x1){if(_0x3f4ffb[_0xf160('0x19')](_0x534dfe[_0x27f91b])>=0x0){_0x5b0e49=!![];}}if(!_0x5b0e49){throw new Error(util[_0xf160('0x13')](_0xf160('0x1a'),_0x3e621b['params'][_0xf160('0x16')]));}process[_0xf160('0x1b')](_0x3e621b[_0xf160('0x15')][_0xf160('0x16')],'SIGINT');return _0x50fb56[_0xf160('0xe')](0xc8)[_0xf160('0xf')]({'message':util[_0xf160('0x13')](_0xf160('0x1c'),_0x3e621b[_0xf160('0x15')][_0xf160('0x16')])});})[_0xf160('0x10')](handleError(_0x50fb56,null,_0xf160('0x11')));}; \ No newline at end of file +var _0x8f56=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','bluebird','lodash','inspect','name','status','send','index','getAllData','then','catch','json','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill'];(function(_0x174583,_0x468485){var _0x14e46f=function(_0x227127){while(--_0x227127){_0x174583['push'](_0x174583['shift']());}};_0x14e46f(++_0x468485);}(_0x8f56,0x1e2));var _0x68f5=function(_0x5f12b0,_0x5a84fa){_0x5f12b0=_0x5f12b0-0x0;var _0x36d5ca=_0x8f56[_0x5f12b0];return _0x36d5ca;};'use strict';var info=require(_0x68f5('0x0'));var exec=require('child_process')[_0x68f5('0x1')];var logger=require('../../config/logger')(_0x68f5('0x2'));var util=require('util');var BPromise=require(_0x68f5('0x3'));var _=require(_0x68f5('0x4'));function handleError(_0x152cfb,_0x1ee5a7,_0x4c22a0){_0x1ee5a7=_0x1ee5a7||0x1f4;return function(_0x3d1ad3){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4c22a0,_0x1ee5a7,util[_0x68f5('0x5')](_0x3d1ad3,{'showHidden':![],'depth':null}));delete _0x3d1ad3[_0x68f5('0x6')];_0x152cfb[_0x68f5('0x7')](_0x1ee5a7)[_0x68f5('0x8')](_0x3d1ad3);};}exports[_0x68f5('0x9')]=function(_0x290f88,_0x48a90b){return info[_0x68f5('0xa')]()[_0x68f5('0xb')](function(_0x237dc0){return _0x48a90b[_0x68f5('0x7')](0xc8)['json'](_0x237dc0);})[_0x68f5('0xc')](function(_0x5f59ba){return _0x48a90b[_0x68f5('0x7')](0x1f4)[_0x68f5('0xd')](_0x5f59ba);});};exports[_0x68f5('0xe')]=function(_0x4910c3,_0x174162){var _0x289483=['components/import/cm'];return new BPromise(function(_0x3865b4,_0x3a73c3){return exec(util['format'](_0x68f5('0xf'),_0x4910c3[_0x68f5('0x10')][_0x68f5('0x11')]),function(_0x292fd4,_0x2af341,_0x327ee9){if(_0x292fd4){return _0x3a73c3(_0x292fd4);}return _0x3865b4(_0x2af341);});})[_0x68f5('0xb')](function(_0x10af60){var _0x2111a6=![];var _0xa02923=_0x10af60['split'](/\n/);for(var _0x4c4917=0x0,_0x17c10b=_0x289483[_0x68f5('0x12')];_0x4c4917<_0x17c10b,_0x2111a6===![];_0x4c4917+=0x1){if(_0x10af60[_0x68f5('0x13')](_0x289483[_0x4c4917])>=0x0){_0x2111a6=!![];}}if(!_0x2111a6){throw new Error(util['format'](_0x68f5('0x14'),_0x4910c3['params'][_0x68f5('0x11')]));}process[_0x68f5('0x15')](_0x4910c3[_0x68f5('0x10')][_0x68f5('0x11')],_0x68f5('0x16'));return _0x174162[_0x68f5('0x7')](0xc8)[_0x68f5('0xd')]({'message':util['format'](_0x68f5('0x17'),_0x4910c3[_0x68f5('0x10')]['pid'])});})[_0x68f5('0xc')](handleError(_0x174162,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b52d16c..3c4946e 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 _0x2e91=['util','connect-timeout','express','Router','./tag.controller','get','index','isAuthenticated','create','put','/:id','delete','destroy','exports','multer'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2e91,0x158));var _0x12e9=function(_0x5485e7,_0x1b7d68){_0x5485e7=_0x5485e7-0x0;var _0x59fae4=_0x2e91[_0x5485e7];return _0x59fae4;};'use strict';var multer=require(_0x12e9('0x0'));var util=require(_0x12e9('0x1'));var path=require('path');var timeout=require(_0x12e9('0x2'));var express=require(_0x12e9('0x3'));var router=express[_0x12e9('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(_0x12e9('0x5'));router[_0x12e9('0x6')]('/',auth['isAuthenticated'](),controller[_0x12e9('0x7')]);router[_0x12e9('0x6')]('/:id',auth[_0x12e9('0x8')](),controller['show']);router['post']('/',auth[_0x12e9('0x8')](),controller[_0x12e9('0x9')]);router[_0x12e9('0xa')](_0x12e9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x12e9('0xc')](_0x12e9('0xb'),auth['isAuthenticated'](),controller[_0x12e9('0xd')]);module[_0x12e9('0xe')]=router; \ No newline at end of file +var _0x123d=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports'];(function(_0x154fb3,_0x38875f){var _0x575fa8=function(_0x268337){while(--_0x268337){_0x154fb3['push'](_0x154fb3['shift']());}};_0x575fa8(++_0x38875f);}(_0x123d,0x187));var _0xd123=function(_0x3ee809,_0x44f094){_0x3ee809=_0x3ee809-0x0;var _0x4e5019=_0x123d[_0x3ee809];return _0x4e5019;};'use strict';var multer=require(_0xd123('0x0'));var util=require('util');var path=require(_0xd123('0x1'));var timeout=require('connect-timeout');var express=require(_0xd123('0x2'));var router=express[_0xd123('0x3')]();var fs_extra=require(_0xd123('0x4'));var auth=require(_0xd123('0x5'));var interaction=require(_0xd123('0x6'));var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth[_0xd123('0x7')](),controller[_0xd123('0x8')]);router[_0xd123('0x9')](_0xd123('0xa'),auth[_0xd123('0x7')](),controller[_0xd123('0xb')]);router[_0xd123('0xc')]('/',auth[_0xd123('0x7')](),controller[_0xd123('0xd')]);router['put'](_0xd123('0xa'),auth[_0xd123('0x7')](),controller['update']);router[_0xd123('0xe')](_0xd123('0xa'),auth[_0xd123('0x7')](),controller[_0xd123('0xf')]);module[_0xd123('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 30ac4d9..1e531b3 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 _0x20d6=['sequelize','exports','STRING','name','#0091EA'];(function(_0x211463,_0x179602){var _0x30e39e=function(_0x57e7d6){while(--_0x57e7d6){_0x211463['push'](_0x211463['shift']());}};_0x30e39e(++_0x179602);}(_0x20d6,0x1b8));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x620d('0x0'));module[_0x620d('0x1')]={'name':{'type':Sequelize[_0x620d('0x2')],'unique':_0x620d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x620d('0x4')},'description':{'type':Sequelize[_0x620d('0x2')]}}; \ No newline at end of file +var _0x4ffe=['STRING','#0091EA','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4ffe,0x172));var _0xe4ff=function(_0x3b37d0,_0x5e3d41){_0x3b37d0=_0x3b37d0-0x0;var _0x4987b6=_0x4ffe[_0x3b37d0];return _0x4987b6;};'use strict';var Sequelize=require(_0xe4ff('0x0'));module[_0xe4ff('0x1')]={'name':{'type':Sequelize[_0xe4ff('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe4ff('0x2')],'defaultValue':_0xe4ff('0x3')},'description':{'type':Sequelize[_0xe4ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index c038845..87efbd8 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 _0x6f0d=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','show','params','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys'];(function(_0x3e984c,_0x3d3581){var _0x29caa9=function(_0x376b4f){while(--_0x376b4f){_0x3e984c['push'](_0x3e984c['shift']());}};_0x29caa9(++_0x3d3581);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x175f09,_0x22a40f){_0x175f09=_0x175f09-0x0;var _0x58e394=_0x6f0d[_0x175f09];return _0x58e394;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];function respondWithStatusCode(_0x306aad,_0x45973d){_0x45973d=_0x45973d||0xcc;return function(_0x109655){if(_0x109655){return _0x306aad[_0xd6f0('0x19')](_0x45973d);}return _0x306aad[_0xd6f0('0x1a')](_0x45973d)[_0xd6f0('0x1b')]();};}function respondWithResult(_0x246dad,_0x4ab979){_0x4ab979=_0x4ab979||0xc8;return function(_0x2b3f32){if(_0x2b3f32){return _0x246dad[_0xd6f0('0x1a')](_0x4ab979)['json'](_0x2b3f32);}};}function respondWithFilteredResult(_0x419b7e,_0x593abe){return function(_0x3f4851){if(_0x3f4851){var _0x154e3e=typeof _0x593abe[_0xd6f0('0x1c')]===_0xd6f0('0x1d')&&typeof _0x593abe[_0xd6f0('0x1e')]===_0xd6f0('0x1d');var _0x25da0c=_0x3f4851[_0xd6f0('0x1f')];var _0x2e71bd=_0x154e3e?0x0:_0x593abe[_0xd6f0('0x1c')];var _0x23ab6c=_0x154e3e?_0x3f4851[_0xd6f0('0x1f')]:_0x593abe[_0xd6f0('0x1c')]+_0x593abe[_0xd6f0('0x1e')];var _0x1f43d7;if(_0x23ab6c>=_0x25da0c){_0x23ab6c=_0x25da0c;_0x1f43d7=0xc8;}else{_0x1f43d7=0xce;}_0x419b7e[_0xd6f0('0x1a')](_0x1f43d7);return _0x419b7e['set']('Content-Range',_0x2e71bd+'-'+_0x23ab6c+'/'+_0x25da0c)[_0xd6f0('0x20')](_0x3f4851);}return null;};}function patchUpdates(_0x264104){return function(_0x1158dc){try{jsonpatch['apply'](_0x1158dc,_0x264104,!![]);}catch(_0x67afa7){return BPromise[_0xd6f0('0x21')](_0x67afa7);}return _0x1158dc['save']();};}function saveUpdates(_0x86dde0,_0x515687){return function(_0x1ee584){if(_0x1ee584){return _0x1ee584[_0xd6f0('0x22')](_0x86dde0)['then'](function(_0xb9e820){return _0xb9e820;});}return null;};}function removeEntity(_0x45e99c,_0x5ea2dd){return function(_0x3dbdc3){if(_0x3dbdc3){return _0x3dbdc3[_0xd6f0('0x23')]()[_0xd6f0('0x24')](function(){var _0x5b1a62=_0x3dbdc3[_0xd6f0('0x25')]({'plain':!![]});var _0x3dc166='Tags';return db[_0xd6f0('0x26')]['destroy']({'where':{'type':_0x3dc166,'resourceId':_0x5b1a62['id']}})[_0xd6f0('0x24')](function(){return _0x3dbdc3;});})[_0xd6f0('0x24')](function(){_0x45e99c[_0xd6f0('0x1a')](0xcc)[_0xd6f0('0x1b')]();});}};}function handleEntityNotFound(_0x4101bd,_0x715aab){return function(_0x12d6ec){if(!_0x12d6ec){_0x4101bd[_0xd6f0('0x19')](0x194);}return _0x12d6ec;};}function handleError(_0x48975d,_0x1ea941){_0x1ea941=_0x1ea941||0x1f4;return function(_0x1982d3){logger['error'](_0x1982d3[_0xd6f0('0x27')]);if(_0x1982d3[_0xd6f0('0x28')]){delete _0x1982d3[_0xd6f0('0x28')];}_0x48975d[_0xd6f0('0x1a')](_0x1ea941)[_0xd6f0('0x29')](_0x1982d3);};}exports[_0xd6f0('0x2a')]=function(_0x351fda,_0x3151f8){var _0x465cf9={},_0x43f72f={},_0x1dff9b={'count':0x0,'rows':[]};var _0x3e913a=_[_0xd6f0('0x2b')](db[_0xd6f0('0x2c')][_0xd6f0('0x2d')],function(_0x2d7c90){return{'name':_0x2d7c90[_0xd6f0('0x2e')],'type':_0x2d7c90[_0xd6f0('0x2f')][_0xd6f0('0x30')]};});_0x43f72f[_0xd6f0('0x31')]=_[_0xd6f0('0x2b')](_0x3e913a,_0xd6f0('0x28'));_0x43f72f['query']=_[_0xd6f0('0x32')](_0x351fda['query']);_0x43f72f['filters']=_[_0xd6f0('0x33')](_0x43f72f[_0xd6f0('0x31')],_0x43f72f[_0xd6f0('0x34')]);_0x465cf9[_0xd6f0('0x35')]=_[_0xd6f0('0x33')](_0x43f72f['model'],qs[_0xd6f0('0x36')](_0x351fda['query'][_0xd6f0('0x36')]));_0x465cf9[_0xd6f0('0x35')]=_0x465cf9[_0xd6f0('0x35')][_0xd6f0('0x37')]?_0x465cf9[_0xd6f0('0x35')]:_0x43f72f['model'];if(!_0x351fda['query'][_0xd6f0('0x38')](_0xd6f0('0x39'))){_0x465cf9['limit']=qs[_0xd6f0('0x1e')](_0x351fda['query'][_0xd6f0('0x1e')]);_0x465cf9[_0xd6f0('0x1c')]=qs[_0xd6f0('0x1c')](_0x351fda[_0xd6f0('0x34')][_0xd6f0('0x1c')]);}_0x465cf9[_0xd6f0('0x3a')]=qs[_0xd6f0('0x3b')](_0x351fda['query']['sort']);_0x465cf9[_0xd6f0('0x3c')]=qs[_0xd6f0('0x3d')](_[_0xd6f0('0x3e')](_0x351fda['query'],_0x43f72f['filters']),_0x3e913a);if(_0x351fda[_0xd6f0('0x34')][_0xd6f0('0x3f')]){_0x465cf9[_0xd6f0('0x3c')]=_[_0xd6f0('0x40')](_0x465cf9[_0xd6f0('0x3c')],{'$or':_[_0xd6f0('0x2b')](_0x3e913a,function(_0x2e9043){if(_0x2e9043[_0xd6f0('0x2f')]!=='VIRTUAL'){var _0x1af620={};_0x1af620[_0x2e9043[_0xd6f0('0x28')]]={'$like':'%'+_0x351fda[_0xd6f0('0x34')][_0xd6f0('0x3f')]+'%'};return _0x1af620;}})});}_0x465cf9=_['merge']({},_0x465cf9,_0x351fda[_0xd6f0('0x41')]);var _0x94ec6d={'where':_0x465cf9[_0xd6f0('0x3c')]};return db[_0xd6f0('0x2c')][_0xd6f0('0x1f')](_0x94ec6d)['then'](function(_0x332809){_0x1dff9b[_0xd6f0('0x1f')]=_0x332809;if(_0x351fda[_0xd6f0('0x34')]['includeAll']){_0x465cf9[_0xd6f0('0x42')]=[{'all':!![]}];}return db[_0xd6f0('0x2c')]['findAll'](_0x465cf9);})['then'](function(_0x9cffd4){_0x1dff9b[_0xd6f0('0x43')]=_0x9cffd4;return _0x1dff9b;})[_0xd6f0('0x24')](respondWithFilteredResult(_0x3151f8,_0x465cf9))['catch'](handleError(_0x3151f8,null));};exports[_0xd6f0('0x44')]=function(_0x2d32f0,_0x57c2b6){var _0x362509={'raw':!![],'where':{'id':_0x2d32f0[_0xd6f0('0x45')]['id']}},_0x3080eb={};_0x3080eb[_0xd6f0('0x31')]=_['keys'](db[_0xd6f0('0x2c')][_0xd6f0('0x2d')]);_0x3080eb[_0xd6f0('0x34')]=_[_0xd6f0('0x32')](_0x2d32f0[_0xd6f0('0x34')]);_0x3080eb[_0xd6f0('0x3d')]=_[_0xd6f0('0x33')](_0x3080eb[_0xd6f0('0x31')],_0x3080eb['query']);_0x362509[_0xd6f0('0x35')]=_[_0xd6f0('0x33')](_0x3080eb['model'],qs[_0xd6f0('0x36')](_0x2d32f0[_0xd6f0('0x34')][_0xd6f0('0x36')]));_0x362509[_0xd6f0('0x35')]=_0x362509['attributes'][_0xd6f0('0x37')]?_0x362509[_0xd6f0('0x35')]:_0x3080eb['model'];if(_0x2d32f0['query'][_0xd6f0('0x46')]){_0x362509['include']=[{'all':!![]}];}_0x362509=_[_0xd6f0('0x40')]({},_0x362509,_0x2d32f0[_0xd6f0('0x41')]);return db[_0xd6f0('0x2c')]['find'](_0x362509)[_0xd6f0('0x24')](handleEntityNotFound(_0x57c2b6,null))[_0xd6f0('0x24')](respondWithResult(_0x57c2b6,null))[_0xd6f0('0x47')](handleError(_0x57c2b6,null));};exports[_0xd6f0('0x48')]=function(_0xc4147e,_0x4c42ce){return db[_0xd6f0('0x2c')]['create'](_0xc4147e[_0xd6f0('0x49')],{})[_0xd6f0('0x24')](function(_0x2eb338){var _0x1dc320=_0xc4147e['user']['get']({'plain':!![]});if(!_0x1dc320)throw new Error(_0xd6f0('0x4a'));if(_0x1dc320[_0xd6f0('0x4b')]==='user'){var _0xa68b18=_0x2eb338['get']({'plain':!![]});var _0xb5fc29=_0xd6f0('0x4c');return db[_0xd6f0('0x4d')][_0xd6f0('0x4e')]({'where':{'name':_0xb5fc29,'userProfileId':_0x1dc320[_0xd6f0('0x4f')]},'raw':!![]})['then'](function(_0x232757){if(_0x232757&&_0x232757[_0xd6f0('0x50')]===0x0){return db[_0xd6f0('0x26')][_0xd6f0('0x48')]({'name':_0xa68b18[_0xd6f0('0x28')],'resourceId':_0xa68b18['id'],'type':_0x232757[_0xd6f0('0x28')],'sectionId':_0x232757['id']},{})[_0xd6f0('0x24')](function(){return _0x2eb338;});}else{return _0x2eb338;}})[_0xd6f0('0x47')](function(_0x5eb262){logger[_0xd6f0('0x51')](_0xd6f0('0x52'),_0x5eb262);throw _0x5eb262;});}return _0x2eb338;})[_0xd6f0('0x24')](respondWithResult(_0x4c42ce,0xc9))[_0xd6f0('0x47')](handleError(_0x4c42ce,null));};exports[_0xd6f0('0x22')]=function(_0x3c8861,_0x43563d){if(_0x3c8861[_0xd6f0('0x49')]['id']){delete _0x3c8861[_0xd6f0('0x49')]['id'];}return db['Tag'][_0xd6f0('0x4e')]({'where':{'id':_0x3c8861['params']['id']}})['then'](handleEntityNotFound(_0x43563d,null))[_0xd6f0('0x24')](saveUpdates(_0x3c8861['body'],null))['then'](respondWithResult(_0x43563d,null))[_0xd6f0('0x47')](handleError(_0x43563d,null));};exports[_0xd6f0('0x23')]=function(_0x8c6f9c,_0x47a159){return db[_0xd6f0('0x2c')][_0xd6f0('0x4e')]({'where':{'id':_0x8c6f9c[_0xd6f0('0x45')]['id']}})['then'](handleEntityNotFound(_0x47a159,null))[_0xd6f0('0x24')](removeEntity(_0x47a159,null))[_0xd6f0('0x47')](handleError(_0x47a159,null));}; \ No newline at end of file +var _0x54ef=['pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','map','Tag','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters'];(function(_0x28ab1a,_0x41638e){var _0x2db742=function(_0x5f5d8f){while(--_0x5f5d8f){_0x28ab1a['push'](_0x28ab1a['shift']());}};_0x2db742(++_0x41638e);}(_0x54ef,0x112));var _0xf54e=function(_0x51c147,_0x5df871){_0x51c147=_0x51c147-0x0;var _0xdd7e37=_0x54ef[_0x51c147];return _0xdd7e37;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){var _0x474b61=_0x264a8f[_0xf54e('0x28')]({'plain':!![]});var _0x160160=_0xf54e('0x29');return db[_0xf54e('0x2a')][_0xf54e('0x27')]({'where':{'type':_0x160160,'resourceId':_0x474b61['id']}})[_0xf54e('0x26')](function(){return _0x264a8f;});})[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x5390b8,_0xb3706e){return function(_0x4cbf7c){if(!_0x4cbf7c){_0x5390b8[_0xf54e('0x19')](0x194);}return _0x4cbf7c;};}function handleError(_0x5e63f4,_0x15b888){_0x15b888=_0x15b888||0x1f4;return function(_0x269f47){logger[_0xf54e('0x2b')](_0x269f47[_0xf54e('0x2c')]);if(_0x269f47[_0xf54e('0x2d')]){delete _0x269f47[_0xf54e('0x2d')];}_0x5e63f4[_0xf54e('0x1a')](_0x15b888)['send'](_0x269f47);};}exports['index']=function(_0x2f96b1,_0x258d29){var _0x2ec92e={},_0x16d00f={},_0xb2d4c4={'count':0x0,'rows':[]};var _0x133cd7=_[_0xf54e('0x2e')](db[_0xf54e('0x2f')][_0xf54e('0x30')],function(_0x12edc3){return{'name':_0x12edc3['fieldName'],'type':_0x12edc3['type'][_0xf54e('0x31')]};});_0x16d00f[_0xf54e('0x32')]=_['map'](_0x133cd7,_0xf54e('0x2d'));_0x16d00f[_0xf54e('0x33')]=_[_0xf54e('0x34')](_0x2f96b1[_0xf54e('0x33')]);_0x16d00f['filters']=_['intersection'](_0x16d00f['model'],_0x16d00f[_0xf54e('0x33')]);_0x2ec92e[_0xf54e('0x35')]=_[_0xf54e('0x36')](_0x16d00f[_0xf54e('0x32')],qs[_0xf54e('0x37')](_0x2f96b1[_0xf54e('0x33')]['fields']));_0x2ec92e['attributes']=_0x2ec92e['attributes'][_0xf54e('0x38')]?_0x2ec92e[_0xf54e('0x35')]:_0x16d00f['model'];if(!_0x2f96b1['query'][_0xf54e('0x39')](_0xf54e('0x3a'))){_0x2ec92e[_0xf54e('0x1d')]=qs['limit'](_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x1d')]);_0x2ec92e['offset']=qs[_0xf54e('0x20')](_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x20')]);}_0x2ec92e[_0xf54e('0x3b')]=qs[_0xf54e('0x3c')](_0x2f96b1[_0xf54e('0x33')]['sort']);_0x2ec92e['where']=qs[_0xf54e('0x3d')](_[_0xf54e('0x3e')](_0x2f96b1[_0xf54e('0x33')],_0x16d00f['filters']),_0x133cd7);if(_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x3f')]){_0x2ec92e[_0xf54e('0x40')]=_[_0xf54e('0x41')](_0x2ec92e[_0xf54e('0x40')],{'$or':_[_0xf54e('0x2e')](_0x133cd7,function(_0x17c7ec){if(_0x17c7ec[_0xf54e('0x42')]!==_0xf54e('0x43')){var _0x2087b3={};_0x2087b3[_0x17c7ec[_0xf54e('0x2d')]]={'$like':'%'+_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x3f')]+'%'};return _0x2087b3;}})});}_0x2ec92e=_[_0xf54e('0x41')]({},_0x2ec92e,_0x2f96b1[_0xf54e('0x44')]);var _0x5085c1={'where':_0x2ec92e['where']};return db['Tag'][_0xf54e('0x1f')](_0x5085c1)[_0xf54e('0x26')](function(_0x5398b2){_0xb2d4c4[_0xf54e('0x1f')]=_0x5398b2;if(_0x2f96b1[_0xf54e('0x33')][_0xf54e('0x45')]){_0x2ec92e['include']=[{'all':!![]}];}return db[_0xf54e('0x2f')][_0xf54e('0x46')](_0x2ec92e);})[_0xf54e('0x26')](function(_0x794be7){_0xb2d4c4[_0xf54e('0x47')]=_0x794be7;return _0xb2d4c4;})[_0xf54e('0x26')](respondWithFilteredResult(_0x258d29,_0x2ec92e))[_0xf54e('0x48')](handleError(_0x258d29,null));};exports[_0xf54e('0x49')]=function(_0x5b4ea1,_0x47bedd){var _0x11c736={'raw':!![],'where':{'id':_0x5b4ea1[_0xf54e('0x4a')]['id']}},_0x3447fd={};_0x3447fd[_0xf54e('0x32')]=_[_0xf54e('0x34')](db[_0xf54e('0x2f')]['rawAttributes']);_0x3447fd[_0xf54e('0x33')]=_['keys'](_0x5b4ea1[_0xf54e('0x33')]);_0x3447fd['filters']=_[_0xf54e('0x36')](_0x3447fd[_0xf54e('0x32')],_0x3447fd[_0xf54e('0x33')]);_0x11c736['attributes']=_[_0xf54e('0x36')](_0x3447fd[_0xf54e('0x32')],qs[_0xf54e('0x37')](_0x5b4ea1[_0xf54e('0x33')][_0xf54e('0x37')]));_0x11c736['attributes']=_0x11c736[_0xf54e('0x35')][_0xf54e('0x38')]?_0x11c736[_0xf54e('0x35')]:_0x3447fd[_0xf54e('0x32')];if(_0x5b4ea1['query'][_0xf54e('0x45')]){_0x11c736[_0xf54e('0x4b')]=[{'all':!![]}];}_0x11c736=_['merge']({},_0x11c736,_0x5b4ea1[_0xf54e('0x44')]);return db[_0xf54e('0x2f')][_0xf54e('0x4c')](_0x11c736)[_0xf54e('0x26')](handleEntityNotFound(_0x47bedd,null))['then'](respondWithResult(_0x47bedd,null))[_0xf54e('0x48')](handleError(_0x47bedd,null));};exports[_0xf54e('0x4d')]=function(_0x2527f6,_0xb4654f){return db[_0xf54e('0x2f')][_0xf54e('0x4d')](_0x2527f6[_0xf54e('0x4e')],{})[_0xf54e('0x26')](function(_0x15bfef){var _0x21f2f8=_0x2527f6[_0xf54e('0x4f')][_0xf54e('0x28')]({'plain':!![]});if(!_0x21f2f8)throw new Error(_0xf54e('0x50'));if(_0x21f2f8[_0xf54e('0x51')]===_0xf54e('0x4f')){var _0xa6c305=_0x15bfef[_0xf54e('0x28')]({'plain':!![]});var _0xe9338b=_0xf54e('0x29');return db[_0xf54e('0x52')]['find']({'where':{'name':_0xe9338b,'userProfileId':_0x21f2f8['userProfileId']},'raw':!![]})[_0xf54e('0x26')](function(_0x1106bb){if(_0x1106bb&&_0x1106bb[_0xf54e('0x53')]===0x0){return db[_0xf54e('0x2a')][_0xf54e('0x4d')]({'name':_0xa6c305[_0xf54e('0x2d')],'resourceId':_0xa6c305['id'],'type':_0x1106bb[_0xf54e('0x2d')],'sectionId':_0x1106bb['id']},{})[_0xf54e('0x26')](function(){return _0x15bfef;});}else{return _0x15bfef;}})[_0xf54e('0x48')](function(_0xdf63c4){logger[_0xf54e('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdf63c4);throw _0xdf63c4;});}return _0x15bfef;})[_0xf54e('0x26')](respondWithResult(_0xb4654f,0xc9))[_0xf54e('0x48')](handleError(_0xb4654f,null));};exports[_0xf54e('0x25')]=function(_0x37e4f8,_0x1b8f16){if(_0x37e4f8[_0xf54e('0x4e')]['id']){delete _0x37e4f8[_0xf54e('0x4e')]['id'];}return db['Tag'][_0xf54e('0x4c')]({'where':{'id':_0x37e4f8[_0xf54e('0x4a')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0x1b8f16,null))['then'](saveUpdates(_0x37e4f8[_0xf54e('0x4e')],null))['then'](respondWithResult(_0x1b8f16,null))[_0xf54e('0x48')](handleError(_0x1b8f16,null));};exports[_0xf54e('0x27')]=function(_0x3e2fd1,_0x5b882f){return db[_0xf54e('0x2f')][_0xf54e('0x4c')]({'where':{'id':_0x3e2fd1[_0xf54e('0x4a')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0x5b882f,null))[_0xf54e('0x26')](removeEntity(_0x5b882f,null))[_0xf54e('0x48')](handleError(_0x5b882f,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 29a7694..ac9e9fc 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 _0x8dfc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x1d068c,_0x38c755){var _0x17e1e6=function(_0x15d6d2){while(--_0x15d6d2){_0x1d068c['push'](_0x1d068c['shift']());}};_0x17e1e6(++_0x38c755);}(_0x8dfc,0xdf));var _0xc8df=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0x8dfc[_0x217ff6];return _0x417c93;};'use strict';var _=require(_0xc8df('0x0'));var util=require(_0xc8df('0x1'));var logger=require(_0xc8df('0x2'))(_0xc8df('0x3'));var moment=require(_0xc8df('0x4'));var BPromise=require(_0xc8df('0x5'));var rp=require(_0xc8df('0x6'));var fs=require('fs');var path=require(_0xc8df('0x7'));var rimraf=require(_0xc8df('0x8'));var config=require('../../config/environment');var attributes=require(_0xc8df('0x9'));module[_0xc8df('0xa')]=function(_0x510ed2,_0x16ed3e){return _0x510ed2[_0xc8df('0xb')](_0xc8df('0xc'),attributes,{'tableName':_0xc8df('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb33=['rimraf','../../config/environment','exports','define','Tag','tools_tags','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x17e686,_0xbeb954){var _0x4e4d47=function(_0x432479){while(--_0x432479){_0x17e686['push'](_0x17e686['shift']());}};_0x4e4d47(++_0xbeb954);}(_0xcb33,0xae));var _0x3cb3=function(_0x19d8b6,_0x49563a){_0x19d8b6=_0x19d8b6-0x0;var _0x405aef=_0xcb33[_0x19d8b6];return _0x405aef;};'use strict';var _=require(_0x3cb3('0x0'));var util=require(_0x3cb3('0x1'));var logger=require(_0x3cb3('0x2'))('api');var moment=require(_0x3cb3('0x3'));var BPromise=require('bluebird');var rp=require(_0x3cb3('0x4'));var fs=require('fs');var path=require(_0x3cb3('0x5'));var rimraf=require(_0x3cb3('0x6'));var config=require(_0x3cb3('0x7'));var attributes=require('./tag.attributes');module[_0x3cb3('0x8')]=function(_0x149e76,_0x1379f4){return _0x149e76[_0x3cb3('0x9')](_0x3cb3('0xa'),attributes,{'tableName':_0x3cb3('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 46d1919..4a7ffc0 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 _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0xb4e6[_0x20e7e3];return _0x14b9de;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file +var _0x37f8=['catch','util','moment','bluebird','randomstring','../../mysqldb','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x37f8,0xd2));var _0x837f=function(_0x34ee2b,_0xc30d08){_0x34ee2b=_0x34ee2b-0x0;var _0x514217=_0x37f8[_0x34ee2b];return _0x514217;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var moment=require(_0x837f('0x1'));var BPromise=require(_0x837f('0x2'));var rs=require(_0x837f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x837f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x837f('0x5')][_0x837f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x224ad2,_0x40270f,_0x4111cb){return new BPromise(function(_0x25bbcb,_0x12c732){return client[_0x837f('0x7')](_0x224ad2,_0x4111cb)[_0x837f('0x8')](function(_0x2f1dc7){logger[_0x837f('0x9')](_0x837f('0xa'),_0x40270f,_0x837f('0xb'));logger[_0x837f('0xc')](_0x837f('0xd'),_0x40270f,'request\x20sent',JSON[_0x837f('0xe')](_0x2f1dc7));if(_0x2f1dc7[_0x837f('0xf')]){if(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x10')]===0x1f4){logger[_0x837f('0xf')]('Tag,\x20%s,\x20%s',_0x40270f,_0x2f1dc7['error'][_0x837f('0x11')]);return _0x12c732(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x11')]);}logger[_0x837f('0xf')](_0x837f('0xa'),_0x40270f,_0x2f1dc7['error'][_0x837f('0x11')]);return _0x25bbcb(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x11')]);}else{logger[_0x837f('0x9')](_0x837f('0xa'),_0x40270f,_0x837f('0xb'));_0x25bbcb(_0x2f1dc7['result'][_0x837f('0x11')]);}})[_0x837f('0x12')](function(_0x47bbe7){logger[_0x837f('0xf')](_0x837f('0xa'),_0x40270f,_0x47bbe7);_0x12c732(_0x47bbe7);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b594a19..280ffbd 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 911cdfc..7a3e3ff 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 _0xb10b=['name','sequelize','STRING'];(function(_0xaa352d,_0x4b7de4){var _0x525a08=function(_0x513536){while(--_0x513536){_0xaa352d['push'](_0xaa352d['shift']());}};_0x525a08(++_0x4b7de4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c6484,_0x4fe72c){_0x2c6484=_0x2c6484-0x0;var _0x3b9d94=_0xb10b[_0x2c6484];return _0x3b9d94;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0xd79c88,_0xda32a9){var _0x4afb2a=function(_0x50ddca){while(--_0x50ddca){_0xd79c88['push'](_0xd79c88['shift']());}};_0x4afb2a(++_0xda32a9);}(_0xb10b,0x12a));var _0xbb10=function(_0x458eef,_0x551783){_0x458eef=_0x458eef-0x0;var _0x2fb384=_0xb10b[_0x458eef];return _0x2fb384;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2a913a4..847f0e1 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 _0x48d5=['through','TeamVoiceQueue','penalty','User','emit','QueueId','online','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','all','upsert','addAgents','spread','removeAgents','Whatsapp','Queue:remove','getAgents','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','undefined','count','offset','Content-Range','json','apply','save','error','stack','name','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','then','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','removeQueues','remove','isArray','ids','Voice','Chat','Mail','Sms','Fax','Openchannel','transaction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x48d5,0x14c));var _0x548d=function(_0x3396cd,_0x4047f0){_0x3396cd=_0x3396cd-0x0;var _0x2d6b4a=_0x48d5[_0x3396cd];return _0x2d6b4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x548d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x548d('0x1'));var moment=require(_0x548d('0x2'));var BPromise=require(_0x548d('0x3'));var Mustache=require('mustache');var util=require(_0x548d('0x4'));var path=require(_0x548d('0x5'));var sox=require('sox');var csv=require(_0x548d('0x6'));var ejs=require(_0x548d('0x7'));var fs=require('fs');var fs_extra=require(_0x548d('0x8'));var _=require(_0x548d('0x9'));var squel=require('squel');var crypto=require(_0x548d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x548d('0xb'));var Papa=require(_0x548d('0xc'));var Redis=require(_0x548d('0xd'));var authService=require(_0x548d('0xe'));var qs=require(_0x548d('0xf'));var as=require(_0x548d('0x10'));var hardwareService=require(_0x548d('0x11'));var logger=require(_0x548d('0x12'))(_0x548d('0x13'));var utils=require(_0x548d('0x14'));var config=require(_0x548d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x548d('0x16'))['db'];config[_0x548d('0x17')]=_[_0x548d('0x18')](config[_0x548d('0x17')],{'host':_0x548d('0x19'),'port':0x18eb});var socket=require(_0x548d('0x1a'))(new Redis(config['redis']));require(_0x548d('0x1b'))[_0x548d('0x1c')](socket);function respondWithStatusCode(_0x5d7e9c,_0x2efcd2){_0x2efcd2=_0x2efcd2||0xcc;return function(_0x502fd8){if(_0x502fd8){return _0x5d7e9c[_0x548d('0x1d')](_0x2efcd2);}return _0x5d7e9c[_0x548d('0x1e')](_0x2efcd2)[_0x548d('0x1f')]();};}function respondWithResult(_0x430ef4,_0x41af6b){_0x41af6b=_0x41af6b||0xc8;return function(_0x2c0d17){if(_0x2c0d17){return _0x430ef4[_0x548d('0x1e')](_0x41af6b)['json'](_0x2c0d17);}};}function respondWithFilteredResult(_0x5eec0e,_0x80a996){return function(_0x190cdd){if(_0x190cdd){var _0x2711ea=typeof _0x80a996['offset']===_0x548d('0x20')&&typeof _0x80a996['limit']===_0x548d('0x20');var _0x29d5bf=_0x190cdd[_0x548d('0x21')];var _0x40b07c=_0x2711ea?0x0:_0x80a996[_0x548d('0x22')];var _0x46216c=_0x2711ea?_0x190cdd['count']:_0x80a996[_0x548d('0x22')]+_0x80a996['limit'];var _0x2a4e37;if(_0x46216c>=_0x29d5bf){_0x46216c=_0x29d5bf;_0x2a4e37=0xc8;}else{_0x2a4e37=0xce;}_0x5eec0e['status'](_0x2a4e37);return _0x5eec0e['set'](_0x548d('0x23'),_0x40b07c+'-'+_0x46216c+'/'+_0x29d5bf)[_0x548d('0x24')](_0x190cdd);}return null;};}function patchUpdates(_0x314d7b){return function(_0x4ab53f){try{jsonpatch[_0x548d('0x25')](_0x4ab53f,_0x314d7b,!![]);}catch(_0x2a3122){return BPromise['reject'](_0x2a3122);}return _0x4ab53f[_0x548d('0x26')]();};}function saveUpdates(_0x114cde,_0x2a5f91){return function(_0x22a67b){if(_0x22a67b){return _0x22a67b['update'](_0x114cde)['then'](function(_0x4f1ae5){return _0x4f1ae5;});}return null;};}function handleEntityNotFound(_0x2c9130,_0xadcd5b){return function(_0x5f524a){if(!_0x5f524a){_0x2c9130['sendStatus'](0x194);}return _0x5f524a;};}function handleError(_0x8bb745,_0x552e7c){_0x552e7c=_0x552e7c||0x1f4;return function(_0x355495){logger[_0x548d('0x27')](_0x355495[_0x548d('0x28')]);if(_0x355495[_0x548d('0x29')]){delete _0x355495[_0x548d('0x29')];}_0x8bb745[_0x548d('0x1e')](_0x552e7c)['send'](_0x355495);};}exports[_0x548d('0x2a')]=function(_0x2f6b93,_0xfe85b8){var _0x2c6e66={},_0x2c48d5={},_0x1d28d8={'count':0x0,'rows':[]};var _0x3b1039=_[_0x548d('0x2b')](db[_0x548d('0x2c')][_0x548d('0x2d')],function(_0x4db872){return{'name':_0x4db872[_0x548d('0x2e')],'type':_0x4db872[_0x548d('0x2f')][_0x548d('0x30')]};});_0x2c48d5[_0x548d('0x31')]=_['map'](_0x3b1039,_0x548d('0x29'));_0x2c48d5[_0x548d('0x32')]=_[_0x548d('0x33')](_0x2f6b93['query']);_0x2c48d5[_0x548d('0x34')]=_[_0x548d('0x35')](_0x2c48d5['model'],_0x2c48d5[_0x548d('0x32')]);_0x2c6e66[_0x548d('0x36')]=_['intersection'](_0x2c48d5[_0x548d('0x31')],qs[_0x548d('0x37')](_0x2f6b93[_0x548d('0x32')][_0x548d('0x37')]));_0x2c6e66[_0x548d('0x36')]=_0x2c6e66['attributes'][_0x548d('0x38')]?_0x2c6e66[_0x548d('0x36')]:_0x2c48d5[_0x548d('0x31')];if(!_0x2f6b93['query'][_0x548d('0x39')](_0x548d('0x3a'))){_0x2c6e66[_0x548d('0x3b')]=qs['limit'](_0x2f6b93['query'][_0x548d('0x3b')]);_0x2c6e66[_0x548d('0x22')]=qs[_0x548d('0x22')](_0x2f6b93[_0x548d('0x32')][_0x548d('0x22')]);}_0x2c6e66[_0x548d('0x3c')]=qs[_0x548d('0x3d')](_0x2f6b93[_0x548d('0x32')][_0x548d('0x3d')]);_0x2c6e66[_0x548d('0x3e')]=qs[_0x548d('0x34')](_[_0x548d('0x3f')](_0x2f6b93[_0x548d('0x32')],_0x2c48d5['filters']),_0x3b1039);if(_0x2f6b93['query'][_0x548d('0x40')]){_0x2c6e66[_0x548d('0x3e')]=_['merge'](_0x2c6e66['where'],{'$or':_['map'](_0x3b1039,function(_0x5c58f7){if(_0x5c58f7[_0x548d('0x2f')]!==_0x548d('0x41')){var _0x1bd87e={};_0x1bd87e[_0x5c58f7[_0x548d('0x29')]]={'$like':'%'+_0x2f6b93['query'][_0x548d('0x40')]+'%'};return _0x1bd87e;}})});}_0x2c6e66=_[_0x548d('0x42')]({},_0x2c6e66,_0x2f6b93[_0x548d('0x43')]);var _0x995984={'where':_0x2c6e66[_0x548d('0x3e')]};return db[_0x548d('0x2c')][_0x548d('0x21')](_0x995984)['then'](function(_0x405205){_0x1d28d8[_0x548d('0x21')]=_0x405205;if(_0x2f6b93[_0x548d('0x32')][_0x548d('0x44')]){_0x2c6e66['include']=[{'all':!![]}];}return db[_0x548d('0x2c')][_0x548d('0x45')](_0x2c6e66);})[_0x548d('0x46')](function(_0x485317){_0x1d28d8['rows']=_0x485317;return _0x1d28d8;})[_0x548d('0x46')](respondWithFilteredResult(_0xfe85b8,_0x2c6e66))[_0x548d('0x47')](handleError(_0xfe85b8,null));};exports[_0x548d('0x48')]=function(_0x3e7799,_0xed07ee){var _0x1aa8c0={'raw':![],'where':{'id':_0x3e7799['params']['id']}},_0xa23f0a={};_0xa23f0a[_0x548d('0x31')]=_[_0x548d('0x33')](db[_0x548d('0x2c')][_0x548d('0x2d')]);_0xa23f0a[_0x548d('0x32')]=_[_0x548d('0x33')](_0x3e7799[_0x548d('0x32')]);_0xa23f0a[_0x548d('0x34')]=_['intersection'](_0xa23f0a['model'],_0xa23f0a[_0x548d('0x32')]);_0x1aa8c0['attributes']=_[_0x548d('0x35')](_0xa23f0a[_0x548d('0x31')],qs['fields'](_0x3e7799['query'][_0x548d('0x37')]));_0x1aa8c0['attributes']=_0x1aa8c0['attributes']['length']?_0x1aa8c0[_0x548d('0x36')]:_0xa23f0a[_0x548d('0x31')];if(_0x3e7799[_0x548d('0x32')]['includeAll']){_0x1aa8c0[_0x548d('0x49')]=[{'all':!![]}];}_0x1aa8c0=_[_0x548d('0x42')]({},_0x1aa8c0,_0x3e7799[_0x548d('0x43')]);return db[_0x548d('0x2c')][_0x548d('0x4a')](_0x1aa8c0)[_0x548d('0x46')](handleEntityNotFound(_0xed07ee,null))['then'](respondWithResult(_0xed07ee,null))['catch'](handleError(_0xed07ee,null));};exports['create']=function(_0x4a6559,_0xffe593){return db[_0x548d('0x2c')][_0x548d('0x4b')](_0x4a6559[_0x548d('0x4c')],{})['then'](function(_0x8a464e){var _0xa223c7=_0x4a6559[_0x548d('0x4d')]['get']({'plain':!![]});if(!_0xa223c7)throw new Error(_0x548d('0x4e'));if(_0xa223c7['role']===_0x548d('0x4d')){var _0x5a6e82=_0x8a464e[_0x548d('0x4f')]({'plain':!![]});var _0x13778a=_0x548d('0x50');return db[_0x548d('0x51')][_0x548d('0x4a')]({'where':{'name':_0x13778a,'userProfileId':_0xa223c7[_0x548d('0x52')]},'raw':!![]})['then'](function(_0x105b24){if(_0x105b24&&_0x105b24[_0x548d('0x53')]===0x0){return db[_0x548d('0x54')][_0x548d('0x4b')]({'name':_0x5a6e82['name'],'resourceId':_0x5a6e82['id'],'type':_0x105b24['name'],'sectionId':_0x105b24['id']},{})['then'](function(){return _0x8a464e;});}else{return _0x8a464e;}})[_0x548d('0x47')](function(_0x39c832){logger['error'](_0x548d('0x55'),_0x39c832);throw _0x39c832;});}return _0x8a464e;})[_0x548d('0x46')](respondWithResult(_0xffe593,0xc9))['catch'](handleError(_0xffe593,null));};exports[_0x548d('0x56')]=function(_0x593fe7,_0x25ca9f){if(_0x593fe7[_0x548d('0x4c')]['id']){delete _0x593fe7['body']['id'];}return db[_0x548d('0x2c')][_0x548d('0x4a')]({'where':{'id':_0x593fe7[_0x548d('0x57')]['id']}})[_0x548d('0x46')](handleEntityNotFound(_0x25ca9f,null))[_0x548d('0x46')](saveUpdates(_0x593fe7[_0x548d('0x4c')],null))[_0x548d('0x46')](respondWithResult(_0x25ca9f,null))['catch'](handleError(_0x25ca9f,null));};exports[_0x548d('0x58')]=function(_0x49e623,_0x524f73){var _0x62b76c=_0x49e623[_0x548d('0x57')]['id'];var _0x2c4973=[];return db['sequelize']['transaction'](function(_0xa65c27){var _0x2d9270=_0x548d('0x59')+_0x62b76c;return db['sequelize'][_0x548d('0x32')](_0x2d9270,{'type':db[_0x548d('0x5a')][_0x548d('0x5b')][_0x548d('0x5c')],'raw':!![],'transaction':_0xa65c27})[_0x548d('0x46')](function(_0x360ec9){_0x2c4973=_[_0x548d('0x2b')](_0x360ec9,function(_0x1d2523){return Number(_0x1d2523[_0x548d('0x5d')]);});})[_0x548d('0x46')](function(){var _0x481e4c='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x62b76c;return db['sequelize'][_0x548d('0x32')](_0x481e4c,{'type':db[_0x548d('0x5a')][_0x548d('0x5b')][_0x548d('0x5c')],'raw':!![],'transaction':_0xa65c27});})[_0x548d('0x46')](function(_0x33423c){var _0x594071=_[_0x548d('0x2b')](_0x33423c,function(_0x414f04){return Number(_0x414f04[_0x548d('0x5e')]);});return db[_0x548d('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x2c4973},'VoiceQueueId':{'$in':_0x594071}},'transaction':_0xa65c27});})[_0x548d('0x46')](function(){var _0x54d8e3=_0x548d('0x60')+_0x62b76c;return db[_0x548d('0x61')][_0x548d('0x32')](_0x54d8e3,{'type':db[_0x548d('0x5a')][_0x548d('0x5b')]['SELECT'],'raw':!![],'transaction':_0xa65c27});})[_0x548d('0x46')](function(_0x55cc5d){var _0x3d3812=_['map'](_0x55cc5d,function(_0x2086ac){return Number(_0x2086ac[_0x548d('0x62')]);});return db[_0x548d('0x63')][_0x548d('0x58')]({'where':{'UserId':{'$in':_0x2c4973},'MailQueueId':{'$in':_0x3d3812}},'transaction':_0xa65c27});})[_0x548d('0x46')](function(){var _0x269b82=_0x548d('0x64')+_0x62b76c;return db[_0x548d('0x61')][_0x548d('0x32')](_0x269b82,{'type':db[_0x548d('0x5a')][_0x548d('0x5b')][_0x548d('0x5c')],'raw':!![],'transaction':_0xa65c27});})['then'](function(_0x5dc6f9){var _0x1d60ba=_[_0x548d('0x2b')](_0x5dc6f9,function(_0x24a64c){return Number(_0x24a64c[_0x548d('0x65')]);});return db[_0x548d('0x66')][_0x548d('0x58')]({'where':{'UserId':{'$in':_0x2c4973},'SmsQueueId':{'$in':_0x1d60ba}},'transaction':_0xa65c27});})[_0x548d('0x46')](function(){var _0x28bed3=_0x548d('0x67')+_0x62b76c;return db[_0x548d('0x61')][_0x548d('0x32')](_0x28bed3,{'type':db[_0x548d('0x5a')][_0x548d('0x5b')][_0x548d('0x5c')],'raw':!![],'transaction':_0xa65c27});})[_0x548d('0x46')](function(_0x12bbd5){var _0x37dc4c=_[_0x548d('0x2b')](_0x12bbd5,function(_0x58648a){return Number(_0x58648a[_0x548d('0x68')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x2c4973},'ChatQueueId':{'$in':_0x37dc4c}},'transaction':_0xa65c27});})[_0x548d('0x46')](function(){var _0x1ae416='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x62b76c;return db[_0x548d('0x61')][_0x548d('0x32')](_0x1ae416,{'type':db[_0x548d('0x5a')][_0x548d('0x5b')][_0x548d('0x5c')],'raw':!![],'transaction':_0xa65c27});})[_0x548d('0x46')](function(_0x5abc46){var _0x581349=_['map'](_0x5abc46,function(_0x77fe20){return Number(_0x77fe20[_0x548d('0x69')]);});return db[_0x548d('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x2c4973},'FaxQueueId':{'$in':_0x581349}},'transaction':_0xa65c27});})[_0x548d('0x46')](function(){var _0x5d06ae='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x62b76c;return db[_0x548d('0x61')][_0x548d('0x32')](_0x5d06ae,{'type':db[_0x548d('0x5a')][_0x548d('0x5b')][_0x548d('0x5c')],'raw':!![],'transaction':_0xa65c27});})[_0x548d('0x46')](function(_0x241d5b){var _0x2048a6=_['map'](_0x241d5b,function(_0x187cb0){return Number(_0x187cb0[_0x548d('0x6b')]);});return db['UserOpenchannelQueue'][_0x548d('0x58')]({'where':{'UserId':{'$in':_0x2c4973},'OpenchannelQueueId':{'$in':_0x2048a6}},'transaction':_0xa65c27});})[_0x548d('0x46')](function(){var _0x4b10e3=_0x548d('0x6c')+_0x62b76c;return db[_0x548d('0x61')][_0x548d('0x32')](_0x4b10e3,{'type':db[_0x548d('0x5a')][_0x548d('0x5b')][_0x548d('0x5c')],'raw':!![],'transaction':_0xa65c27});})[_0x548d('0x46')](function(_0x2379a9){var _0x383f34=_[_0x548d('0x2b')](_0x2379a9,function(_0x3b3b2a){return Number(_0x3b3b2a[_0x548d('0x6d')]);});return db[_0x548d('0x6e')][_0x548d('0x58')]({'where':{'UserId':{'$in':_0x2c4973},'WhatsappQueueId':{'$in':_0x383f34}},'transaction':_0xa65c27});})[_0x548d('0x46')](function(){return db[_0x548d('0x6f')][_0x548d('0x4a')]({'where':{'TeamId':_0x62b76c}});})[_0x548d('0x46')](function(_0x7670a1){if(_0x7670a1===null){return;}return db[_0x548d('0x70')]['destroy']({'where':{'UserId':{'$in':_0x2c4973},'VoicePrefixId':_0x7670a1[_0x548d('0x71')]},'transaction':_0xa65c27});})[_0x548d('0x46')](function(){return db[_0x548d('0x2c')][_0x548d('0x58')]({'where':{'id':_0x62b76c},'cascade':!![],'transaction':_0xa65c27});})['then'](function(_0x471619){if(_0x471619===0x0){_0x524f73[_0x548d('0x1d')](0x194);}else{return db[_0x548d('0x54')][_0x548d('0x58')]({'where':{'type':_0x548d('0x50'),'resourceId':_0x62b76c},'cascade':!![],'transaction':_0xa65c27})[_0x548d('0x46')](function(){_0x524f73[_0x548d('0x1e')](0xcc)['end']();});}})[_0x548d('0x47')](function(_0x43b8e4){_0x524f73[_0x548d('0x1e')](0x1f4)[_0x548d('0x72')](_0x43b8e4);});});};exports['getQueues']=function(_0x483d4a,_0xafc9ed,_0x1a4db1){return db['Team']['findOne']({'where':{'id':_0x483d4a[_0x548d('0x57')]['id']}})['then'](handleEntityNotFound(_0xafc9ed,null))[_0x548d('0x46')](function(_0x14e420){if(!_0x483d4a['query'][_0x548d('0x73')]||!utils[_0x548d('0x74')](_0x483d4a[_0x548d('0x32')][_0x548d('0x73')])){throw new db[(_0x548d('0x5a'))][(_0x548d('0x75'))](_0x548d('0x76'));}var _0x1dfbd5={};var _0x194221={};_0x194221[_0x548d('0x31')]=_['keys'](db[_[_0x548d('0x77')](_0x483d4a['query'][_0x548d('0x73')][_0x548d('0x78')]())+_0x548d('0x79')][_0x548d('0x2d')]);_0x194221[_0x548d('0x32')]=_[_0x548d('0x33')](_0x483d4a[_0x548d('0x32')]);_0x194221[_0x548d('0x34')]=_['intersection'](_0x194221[_0x548d('0x31')],_0x194221[_0x548d('0x32')]);_0x1dfbd5['attributes']=_[_0x548d('0x35')](_0x194221[_0x548d('0x31')],qs[_0x548d('0x37')](_0x483d4a[_0x548d('0x32')][_0x548d('0x37')]));_0x1dfbd5[_0x548d('0x36')]=_0x1dfbd5[_0x548d('0x36')][_0x548d('0x38')]?_0x1dfbd5[_0x548d('0x36')]:_0x194221['model'];_0x1dfbd5[_0x548d('0x3b')]=qs[_0x548d('0x3b')](_0x483d4a[_0x548d('0x32')][_0x548d('0x3b')]);_0x1dfbd5[_0x548d('0x22')]=qs[_0x548d('0x22')](_0x483d4a[_0x548d('0x32')][_0x548d('0x22')]);_0x1dfbd5[_0x548d('0x3c')]=qs[_0x548d('0x3d')](_0x483d4a[_0x548d('0x32')]['sort']);_0x1dfbd5['where']=qs['filters'](_['pick'](_0x483d4a['query'],_0x194221[_0x548d('0x34')]));_0x1dfbd5=_['merge']({},_0x1dfbd5,_0x483d4a[_0x548d('0x43')]);return _0x14e420[_0x548d('0x4f')+_[_0x548d('0x77')](_0x483d4a['query'][_0x548d('0x73')][_0x548d('0x78')]())+_0x548d('0x7a')](_0x1dfbd5);})[_0x548d('0x46')](respondWithResult(_0xafc9ed,null))[_0x548d('0x47')](handleError(_0xafc9ed,null));};exports[_0x548d('0x7b')]=function(_0x190eec,_0x3784ec,_0x5e84ed){return db['Team'][_0x548d('0x7c')]({'where':{'id':_0x190eec[_0x548d('0x57')]['id']}})[_0x548d('0x46')](function(_0x14a537){if(_0x14a537){if(!_0x190eec['body'][_0x548d('0x73')]||!utils['isValidChannel'](_0x190eec[_0x548d('0x4c')]['channel'])){throw new db[(_0x548d('0x5a'))][(_0x548d('0x75'))](_0x548d('0x76'));}return _0x14a537['add'+_['capitalize'](_0x190eec[_0x548d('0x4c')][_0x548d('0x73')][_0x548d('0x78')]())+_0x548d('0x7a')](_0x190eec[_0x548d('0x4c')]['ids']);}return null;})[_0x548d('0x46')](handleEntityNotFound(_0x3784ec,null))[_0x548d('0x46')](respondWithStatusCode(_0x3784ec,null))[_0x548d('0x47')](handleError(_0x3784ec,null));};exports[_0x548d('0x7d')]=function(_0x539d7a,_0x236354,_0x52d9bc){return db[_0x548d('0x2c')][_0x548d('0x7c')]({'where':{'id':_0x539d7a[_0x548d('0x57')]['id']}})['then'](function(_0x3f918c){if(_0x3f918c){if(!_0x539d7a[_0x548d('0x32')][_0x548d('0x73')]||!utils[_0x548d('0x74')](_0x539d7a[_0x548d('0x32')]['channel'])){throw new db[(_0x548d('0x5a'))][(_0x548d('0x75'))](_0x548d('0x76'));}return _0x3f918c[_0x548d('0x7e')+_[_0x548d('0x77')](_0x539d7a[_0x548d('0x32')][_0x548d('0x73')]['toLowerCase']())+_0x548d('0x7a')](_0x539d7a[_0x548d('0x32')]['ids']);}return null;})[_0x548d('0x46')](handleEntityNotFound(_0x236354,null))[_0x548d('0x46')](respondWithStatusCode(_0x236354,null))[_0x548d('0x47')](handleError(_0x236354,null));};exports['addAgents']=function(_0x33d371,_0xb8d478){var _0x46c13f=_[_0x548d('0x7f')](_0x33d371[_0x548d('0x4c')][_0x548d('0x80')])?_0x33d371[_0x548d('0x4c')][_0x548d('0x80')]:[_0x33d371['body'][_0x548d('0x80')]];var _0x166f90=_0x33d371[_0x548d('0x57')]['id'];return db[_0x548d('0x2c')]['find']({'where':{'id':_0x166f90}})[_0x548d('0x46')](handleEntityNotFound(_0xb8d478,null))[_0x548d('0x46')](function(_0x367daf){if(_0x367daf){var _0x508b4b=[_0x548d('0x81'),_0x548d('0x82'),_0x548d('0x83'),_0x548d('0x84'),_0x548d('0x85'),_0x548d('0x86'),'Whatsapp'];return db[_0x548d('0x61')][_0x548d('0x87')](function(_0xa8ed8d){var _0xaa7d89=_[_0x548d('0x2b')](_0x508b4b,function(_0x1b9eed){var _0x3685a3={'attributes':['id',_0x548d('0x29')]};if(_0x1b9eed==='Voice'){_0x3685a3[_0x548d('0x88')]={'attributes':['penalty']};}return _0x367daf[_0x548d('0x4f')+_0x1b9eed+_0x548d('0x7a')](_0x3685a3)['then'](function(_0x2a6105){var _0x46092b=_[_0x548d('0x2b')](_0x2a6105,function(_0x24c6e1){var _0x429ea0=_[_0x548d('0x2b')](_0x46c13f,function(_0x5a96e7){var _0x2a20d7={'where':{'UserId':_0x5a96e7,[_0x1b9eed+'QueueId']:_0x24c6e1['id']},'transaction':_0xa8ed8d};if(_0x1b9eed==='Voice'){_0x2a20d7[_0x548d('0x18')]={'penalty':_0x24c6e1[_0x548d('0x89')][_0x548d('0x8a')]};}return db[_0x548d('0x8b')+_0x1b9eed+'Queue']['findOrCreate'](_0x2a20d7)[_0x548d('0x46')](function(){socket[_0x548d('0x8c')](_0x548d('0x4d')+_0x1b9eed+'Queue:save',{'UserId':_0x5a96e7,[_0x1b9eed+_0x548d('0x8d')]:_0x24c6e1['id']});if(_0x1b9eed!=='Voice'){return;}return db['User'][_0x548d('0x45')]({'where':{'id':_0x46c13f,'online':0x1},'attributes':['id',_0x548d('0x29'),_0x548d('0x8e'),_0x548d('0x8f'),_0x548d('0x90')],'raw':!![]})[_0x548d('0x46')](function(_0x51bf56){var _0x16db97=_[_0x548d('0x2b')](_0x51bf56,function(_0x459ae4){return db[_0x548d('0x91')]['upsert']({'membername':_0x459ae4[_0x548d('0x29')],'UserId':_0x459ae4['id'],'queue_name':_0x24c6e1['name'],'VoiceQueueId':_0x24c6e1['id'],'interface':_['isNil'](_0x459ae4[_0x548d('0x90')])?util[_0x548d('0x92')](_0x548d('0x93'),_0x459ae4[_0x548d('0x29')]):_0x459ae4[_0x548d('0x90')],'paused':_0x459ae4[_0x548d('0x8f')]||![],'penalty':_0x24c6e1[_0x548d('0x89')][_0x548d('0x8a')]},{'transaction':_0xa8ed8d});});return Promise['all'](_0x16db97);});});});return Promise['all'](_0x429ea0);});return Promise[_0x548d('0x94')](_0x46092b);})['then'](function(){return db[_0x548d('0x6f')][_0x548d('0x7c')]({'where':{'teamId':_0x166f90}})['then'](function(_0xd40274){if(_0xd40274){var _0x4c7aad=_[_0x548d('0x2b')](_0x46c13f,function(_0x13ddd7){db[_0x548d('0x70')][_0x548d('0x95')]({'UserId':_0x13ddd7,'VoicePrefixId':_0xd40274[_0x548d('0x71')]});});return Promise[_0x548d('0x94')](_0x4c7aad);}});});});return Promise[_0x548d('0x94')](_0xaa7d89)['then'](function(){return _0x367daf[_0x548d('0x96')](_0x46c13f,{'transaction':_0xa8ed8d})[_0x548d('0x97')](function(_0x5cea76){return _0x5cea76;});});});}})[_0x548d('0x46')](respondWithResult(_0xb8d478,null))['catch'](handleError(_0xb8d478,null));};exports[_0x548d('0x98')]=function(_0x389085,_0x28d24f){var _0x2a0325=_['isArray'](_0x389085[_0x548d('0x32')]['ids'])?_0x389085[_0x548d('0x32')][_0x548d('0x80')]:[_0x389085[_0x548d('0x32')][_0x548d('0x80')]];var _0xb6acc1=_0x389085[_0x548d('0x57')]['id'];return db[_0x548d('0x2c')]['find']({'where':{'id':_0xb6acc1}})['then'](handleEntityNotFound(_0x28d24f,null))[_0x548d('0x46')](function(_0x5116a5){if(_0x5116a5){var _0x21ef12=[_0x548d('0x81'),_0x548d('0x82'),_0x548d('0x83'),'Sms',_0x548d('0x85'),_0x548d('0x86'),_0x548d('0x99')];return db[_0x548d('0x61')][_0x548d('0x87')](function(_0x2e1102){var _0x4346c9=_[_0x548d('0x2b')](_0x21ef12,function(_0x144f68){var _0x752be={'attributes':['id',_0x548d('0x29')]};return _0x5116a5['get'+_0x144f68+_0x548d('0x7a')](_0x752be)[_0x548d('0x46')](function(_0x4e0266){var _0x1f89c3=_[_0x548d('0x2b')](_0x4e0266,function(_0x1a152){return _0x1a152[_0x548d('0x98')](_0x2a0325,{'transaction':_0x2e1102})[_0x548d('0x46')](function(){var _0x516a4a=_['map'](_0x2a0325,function(_0x219c6e){socket[_0x548d('0x8c')](_0x548d('0x4d')+_0x144f68+_0x548d('0x9a'),{'UserId':Number(_0x219c6e),[_0x144f68+_0x548d('0x8d')]:_0x1a152['id']});if(_0x144f68!=='Voice'){return;}return db[_0x548d('0x91')][_0x548d('0x58')]({'where':{'VoiceQueueId':_0x1a152['id'],'UserId':_0x219c6e},'transaction':_0x2e1102});});return Promise[_0x548d('0x94')](_0x516a4a);});});return Promise[_0x548d('0x94')](_0x1f89c3);});});return Promise['all'](_0x4346c9)[_0x548d('0x46')](function(){return _0x5116a5[_0x548d('0x98')](_0x2a0325,{'transaction':_0x2e1102});})['then'](function(){return db[_0x548d('0x6f')][_0x548d('0x7c')]({'where':{'teamId':_0xb6acc1}})[_0x548d('0x46')](function(_0x2ec8ae){if(_0x2ec8ae){var _0x424f1f=_['map'](_0x2a0325,function(_0x3ce79f){db['UserVoicePrefix'][_0x548d('0x58')]({'where':{'UserId':_0x3ce79f,'VoicePrefixId':_0x2ec8ae['VoicePrefixId']}});});return Promise[_0x548d('0x94')](_0x424f1f);}});});});}})[_0x548d('0x46')](respondWithStatusCode(_0x28d24f,null))[_0x548d('0x47')](handleError(_0x28d24f,null));};exports[_0x548d('0x9b')]=function(_0x322a7b,_0x7b040b,_0x4f7428){var _0x269ea8={};var _0x2b921c={};var _0x6e8c5f;var _0x469546;return db['Team']['findOne']({'where':{'id':_0x322a7b[_0x548d('0x57')]['id']}})[_0x548d('0x46')](handleEntityNotFound(_0x7b040b,null))[_0x548d('0x46')](function(_0x392f9f){if(_0x392f9f){_0x6e8c5f=_0x392f9f;_0x2b921c[_0x548d('0x31')]=_[_0x548d('0x33')](db[_0x548d('0x8b')][_0x548d('0x2d')]);_0x2b921c[_0x548d('0x32')]=_[_0x548d('0x33')](_0x322a7b[_0x548d('0x32')]);_0x2b921c[_0x548d('0x34')]=_['intersection'](_0x2b921c[_0x548d('0x31')],_0x2b921c[_0x548d('0x32')]);_0x269ea8[_0x548d('0x36')]=_[_0x548d('0x35')](_0x2b921c[_0x548d('0x31')],qs[_0x548d('0x37')](_0x322a7b[_0x548d('0x32')][_0x548d('0x37')]));_0x269ea8[_0x548d('0x36')]=_0x269ea8['attributes'][_0x548d('0x38')]?_0x269ea8[_0x548d('0x36')]:_0x2b921c[_0x548d('0x31')];_0x269ea8[_0x548d('0x3c')]=qs['sort'](_0x322a7b[_0x548d('0x32')][_0x548d('0x3d')]);_0x269ea8[_0x548d('0x3e')]=qs[_0x548d('0x34')](_[_0x548d('0x3f')](_0x322a7b[_0x548d('0x32')],_0x2b921c['filters']));if(_0x322a7b[_0x548d('0x32')][_0x548d('0x40')]){_0x269ea8['where']=_[_0x548d('0x42')](_0x269ea8[_0x548d('0x3e')],{'$or':_['map'](_0x269ea8['attributes'],function(_0x5d56e5){var _0xa3fa9a={};_0xa3fa9a[_0x5d56e5]={'$like':'%'+_0x322a7b['query']['filter']+'%'};return _0xa3fa9a;})});}_0x269ea8=_['merge']({},_0x269ea8,_0x322a7b[_0x548d('0x43')]);return _0x6e8c5f[_0x548d('0x9b')](_0x269ea8);}})[_0x548d('0x46')](function(_0x3cb6f7){if(_0x3cb6f7){_0x469546=_0x3cb6f7[_0x548d('0x38')];if(!_0x322a7b['query'][_0x548d('0x39')](_0x548d('0x3a'))){_0x269ea8[_0x548d('0x3b')]=qs[_0x548d('0x3b')](_0x322a7b[_0x548d('0x32')][_0x548d('0x3b')]);_0x269ea8[_0x548d('0x22')]=qs[_0x548d('0x22')](_0x322a7b[_0x548d('0x32')][_0x548d('0x22')]);}return _0x6e8c5f['getAgents'](_0x269ea8);}})[_0x548d('0x46')](function(_0x2951f0){if(_0x2951f0){return _0x2951f0?{'count':_0x469546,'rows':_0x2951f0}:null;}})[_0x548d('0x46')](respondWithResult(_0x7b040b,null))[_0x548d('0x47')](handleError(_0x7b040b,null));}; \ No newline at end of file +var _0xc7fb=['findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','removeQueues','remove','isArray','ids','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','format','SIP/%s','all','spread','Sms','removeAgents','Queue:remove','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','fields','length','create','user','get','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','destroy','sequelize','transaction','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','MailQueueId','UserMailQueue','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams'];(function(_0x48a983,_0x2a3b8a){var _0x110c1c=function(_0x3b2438){while(--_0x3b2438){_0x48a983['push'](_0x48a983['shift']());}};_0x110c1c(++_0x2a3b8a);}(_0xc7fb,0xc6));var _0xbc7f=function(_0x2aa2be,_0x10723a){_0x2aa2be=_0x2aa2be-0x0;var _0x1feb74=_0xc7fb[_0x2aa2be];return _0x1feb74;};'use strict';var emlformat=require(_0xbc7f('0x0'));var rimraf=require(_0xbc7f('0x1'));var zipdir=require(_0xbc7f('0x2'));var jsonpatch=require(_0xbc7f('0x3'));var rp=require(_0xbc7f('0x4'));var moment=require(_0xbc7f('0x5'));var BPromise=require(_0xbc7f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbc7f('0x7'));var sox=require(_0xbc7f('0x8'));var csv=require(_0xbc7f('0x9'));var ejs=require(_0xbc7f('0xa'));var fs=require('fs');var fs_extra=require(_0xbc7f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbc7f('0xc'));var jsforce=require(_0xbc7f('0xd'));var deskjs=require(_0xbc7f('0xe'));var toCsv=require(_0xbc7f('0x9'));var querystring=require(_0xbc7f('0xf'));var Papa=require(_0xbc7f('0x10'));var Redis=require(_0xbc7f('0x11'));var authService=require(_0xbc7f('0x12'));var qs=require(_0xbc7f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc7f('0x14'));var logger=require(_0xbc7f('0x15'))(_0xbc7f('0x16'));var utils=require('../../config/utils');var config=require(_0xbc7f('0x17'));var licenseUtil=require(_0xbc7f('0x18'));var db=require(_0xbc7f('0x19'))['db'];config['redis']=_[_0xbc7f('0x1a')](config[_0xbc7f('0x1b')],{'host':_0xbc7f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc7f('0x1b')]));require(_0xbc7f('0x1d'))[_0xbc7f('0x1e')](socket);function respondWithStatusCode(_0x5909e2,_0x68a5a6){_0x68a5a6=_0x68a5a6||0xcc;return function(_0xb1d411){if(_0xb1d411){return _0x5909e2[_0xbc7f('0x1f')](_0x68a5a6);}return _0x5909e2[_0xbc7f('0x20')](_0x68a5a6)[_0xbc7f('0x21')]();};}function respondWithResult(_0x2059ed,_0x1032a1){_0x1032a1=_0x1032a1||0xc8;return function(_0x63cb65){if(_0x63cb65){return _0x2059ed[_0xbc7f('0x20')](_0x1032a1)[_0xbc7f('0x22')](_0x63cb65);}};}function respondWithFilteredResult(_0x21f43b,_0x1e01ba){return function(_0x4fbf37){if(_0x4fbf37){var _0x3cb7c4=typeof _0x1e01ba[_0xbc7f('0x23')]===_0xbc7f('0x24')&&typeof _0x1e01ba[_0xbc7f('0x25')]===_0xbc7f('0x24');var _0x546548=_0x4fbf37[_0xbc7f('0x26')];var _0x39e8a1=_0x3cb7c4?0x0:_0x1e01ba[_0xbc7f('0x23')];var _0x1b1567=_0x3cb7c4?_0x4fbf37[_0xbc7f('0x26')]:_0x1e01ba[_0xbc7f('0x23')]+_0x1e01ba[_0xbc7f('0x25')];var _0x3e8a09;if(_0x1b1567>=_0x546548){_0x1b1567=_0x546548;_0x3e8a09=0xc8;}else{_0x3e8a09=0xce;}_0x21f43b[_0xbc7f('0x20')](_0x3e8a09);return _0x21f43b['set'](_0xbc7f('0x27'),_0x39e8a1+'-'+_0x1b1567+'/'+_0x546548)[_0xbc7f('0x22')](_0x4fbf37);}return null;};}function patchUpdates(_0x5e3cab){return function(_0x128ad8){try{jsonpatch['apply'](_0x128ad8,_0x5e3cab,!![]);}catch(_0x5809a2){return BPromise[_0xbc7f('0x28')](_0x5809a2);}return _0x128ad8[_0xbc7f('0x29')]();};}function saveUpdates(_0xc58e6,_0x1e7960){return function(_0x161d1b){if(_0x161d1b){return _0x161d1b['update'](_0xc58e6)[_0xbc7f('0x2a')](function(_0x4e39dd){return _0x4e39dd;});}return null;};}function handleEntityNotFound(_0x484406,_0x586739){return function(_0x4187a2){if(!_0x4187a2){_0x484406[_0xbc7f('0x1f')](0x194);}return _0x4187a2;};}function handleError(_0x1d4b38,_0x162482){_0x162482=_0x162482||0x1f4;return function(_0x326ab8){logger[_0xbc7f('0x2b')](_0x326ab8[_0xbc7f('0x2c')]);if(_0x326ab8[_0xbc7f('0x2d')]){delete _0x326ab8[_0xbc7f('0x2d')];}_0x1d4b38[_0xbc7f('0x20')](_0x162482)[_0xbc7f('0x2e')](_0x326ab8);};}exports[_0xbc7f('0x2f')]=function(_0x5af674,_0x54ee75){var _0x3a6ade={},_0xda885b={},_0x44ff57={'count':0x0,'rows':[]};var _0x437655=_[_0xbc7f('0x30')](db[_0xbc7f('0x31')][_0xbc7f('0x32')],function(_0xb4a1db){return{'name':_0xb4a1db[_0xbc7f('0x33')],'type':_0xb4a1db[_0xbc7f('0x34')][_0xbc7f('0x35')]};});_0xda885b[_0xbc7f('0x36')]=_[_0xbc7f('0x30')](_0x437655,_0xbc7f('0x2d'));_0xda885b[_0xbc7f('0x37')]=_['keys'](_0x5af674['query']);_0xda885b[_0xbc7f('0x38')]=_[_0xbc7f('0x39')](_0xda885b[_0xbc7f('0x36')],_0xda885b[_0xbc7f('0x37')]);_0x3a6ade[_0xbc7f('0x3a')]=_[_0xbc7f('0x39')](_0xda885b[_0xbc7f('0x36')],qs['fields'](_0x5af674['query']['fields']));_0x3a6ade['attributes']=_0x3a6ade['attributes']['length']?_0x3a6ade[_0xbc7f('0x3a')]:_0xda885b[_0xbc7f('0x36')];if(!_0x5af674[_0xbc7f('0x37')]['hasOwnProperty']('nolimit')){_0x3a6ade[_0xbc7f('0x25')]=qs[_0xbc7f('0x25')](_0x5af674['query'][_0xbc7f('0x25')]);_0x3a6ade[_0xbc7f('0x23')]=qs['offset'](_0x5af674[_0xbc7f('0x37')]['offset']);}_0x3a6ade[_0xbc7f('0x3b')]=qs[_0xbc7f('0x3c')](_0x5af674[_0xbc7f('0x37')][_0xbc7f('0x3c')]);_0x3a6ade[_0xbc7f('0x3d')]=qs['filters'](_[_0xbc7f('0x3e')](_0x5af674['query'],_0xda885b[_0xbc7f('0x38')]),_0x437655);if(_0x5af674[_0xbc7f('0x37')][_0xbc7f('0x3f')]){_0x3a6ade[_0xbc7f('0x3d')]=_[_0xbc7f('0x40')](_0x3a6ade[_0xbc7f('0x3d')],{'$or':_[_0xbc7f('0x30')](_0x437655,function(_0x4f229e){if(_0x4f229e['type']!==_0xbc7f('0x41')){var _0x4c8545={};_0x4c8545[_0x4f229e['name']]={'$like':'%'+_0x5af674[_0xbc7f('0x37')][_0xbc7f('0x3f')]+'%'};return _0x4c8545;}})});}_0x3a6ade=_[_0xbc7f('0x40')]({},_0x3a6ade,_0x5af674[_0xbc7f('0x42')]);var _0x3b99a9={'where':_0x3a6ade[_0xbc7f('0x3d')]};return db['Team'][_0xbc7f('0x26')](_0x3b99a9)[_0xbc7f('0x2a')](function(_0x3e2d78){_0x44ff57[_0xbc7f('0x26')]=_0x3e2d78;if(_0x5af674[_0xbc7f('0x37')][_0xbc7f('0x43')]){_0x3a6ade[_0xbc7f('0x44')]=[{'all':!![]}];}return db[_0xbc7f('0x31')][_0xbc7f('0x45')](_0x3a6ade);})[_0xbc7f('0x2a')](function(_0x7c7ad9){_0x44ff57[_0xbc7f('0x46')]=_0x7c7ad9;return _0x44ff57;})[_0xbc7f('0x2a')](respondWithFilteredResult(_0x54ee75,_0x3a6ade))[_0xbc7f('0x47')](handleError(_0x54ee75,null));};exports[_0xbc7f('0x48')]=function(_0x17c325,_0x24cc49){var _0x4d2f05={'raw':![],'where':{'id':_0x17c325['params']['id']}},_0x294f32={};_0x294f32[_0xbc7f('0x36')]=_[_0xbc7f('0x49')](db[_0xbc7f('0x31')][_0xbc7f('0x32')]);_0x294f32['query']=_[_0xbc7f('0x49')](_0x17c325[_0xbc7f('0x37')]);_0x294f32[_0xbc7f('0x38')]=_[_0xbc7f('0x39')](_0x294f32[_0xbc7f('0x36')],_0x294f32[_0xbc7f('0x37')]);_0x4d2f05[_0xbc7f('0x3a')]=_[_0xbc7f('0x39')](_0x294f32[_0xbc7f('0x36')],qs[_0xbc7f('0x4a')](_0x17c325['query'][_0xbc7f('0x4a')]));_0x4d2f05[_0xbc7f('0x3a')]=_0x4d2f05[_0xbc7f('0x3a')][_0xbc7f('0x4b')]?_0x4d2f05[_0xbc7f('0x3a')]:_0x294f32['model'];if(_0x17c325[_0xbc7f('0x37')][_0xbc7f('0x43')]){_0x4d2f05[_0xbc7f('0x44')]=[{'all':!![]}];}_0x4d2f05=_[_0xbc7f('0x40')]({},_0x4d2f05,_0x17c325['options']);return db[_0xbc7f('0x31')]['find'](_0x4d2f05)[_0xbc7f('0x2a')](handleEntityNotFound(_0x24cc49,null))[_0xbc7f('0x2a')](respondWithResult(_0x24cc49,null))[_0xbc7f('0x47')](handleError(_0x24cc49,null));};exports[_0xbc7f('0x4c')]=function(_0x4cbca3,_0x3db620){return db[_0xbc7f('0x31')][_0xbc7f('0x4c')](_0x4cbca3['body'],{})[_0xbc7f('0x2a')](function(_0x5501ea){var _0x1e0b3f=_0x4cbca3[_0xbc7f('0x4d')][_0xbc7f('0x4e')]({'plain':!![]});if(!_0x1e0b3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e0b3f[_0xbc7f('0x4f')]===_0xbc7f('0x4d')){var _0x127bf1=_0x5501ea[_0xbc7f('0x4e')]({'plain':!![]});var _0x15b69f='Teams';return db['UserProfileSection'][_0xbc7f('0x50')]({'where':{'name':_0x15b69f,'userProfileId':_0x1e0b3f[_0xbc7f('0x51')]},'raw':!![]})['then'](function(_0x82033a){if(_0x82033a&&_0x82033a[_0xbc7f('0x52')]===0x0){return db[_0xbc7f('0x53')][_0xbc7f('0x4c')]({'name':_0x127bf1['name'],'resourceId':_0x127bf1['id'],'type':_0x82033a['name'],'sectionId':_0x82033a['id']},{})['then'](function(){return _0x5501ea;});}else{return _0x5501ea;}})[_0xbc7f('0x47')](function(_0x4b222a){logger['error'](_0xbc7f('0x54'),_0x4b222a);throw _0x4b222a;});}return _0x5501ea;})[_0xbc7f('0x2a')](respondWithResult(_0x3db620,0xc9))['catch'](handleError(_0x3db620,null));};exports[_0xbc7f('0x55')]=function(_0x15365f,_0x39c748){if(_0x15365f[_0xbc7f('0x56')]['id']){delete _0x15365f[_0xbc7f('0x56')]['id'];}return db['Team'][_0xbc7f('0x50')]({'where':{'id':_0x15365f[_0xbc7f('0x57')]['id']}})[_0xbc7f('0x2a')](handleEntityNotFound(_0x39c748,null))['then'](saveUpdates(_0x15365f[_0xbc7f('0x56')],null))['then'](respondWithResult(_0x39c748,null))[_0xbc7f('0x47')](handleError(_0x39c748,null));};exports[_0xbc7f('0x58')]=function(_0x2868e6,_0x4cdd98){var _0x549ba9=_0x2868e6[_0xbc7f('0x57')]['id'];var _0x4d5695=[];return db[_0xbc7f('0x59')][_0xbc7f('0x5a')](function(_0x1e87fd){var _0x10be57='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x549ba9;return db['sequelize'][_0xbc7f('0x37')](_0x10be57,{'type':db['Sequelize'][_0xbc7f('0x5b')][_0xbc7f('0x5c')],'raw':!![],'transaction':_0x1e87fd})['then'](function(_0xf426b7){_0x4d5695=_['map'](_0xf426b7,function(_0x213719){return Number(_0x213719[_0xbc7f('0x5d')]);});})['then'](function(){var _0x591c84=_0xbc7f('0x5e')+_0x549ba9;return db['sequelize'][_0xbc7f('0x37')](_0x591c84,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(_0x349f32){var _0x5275fd=_[_0xbc7f('0x30')](_0x349f32,function(_0x5561b2){return Number(_0x5561b2[_0xbc7f('0x5f')]);});return db[_0xbc7f('0x60')][_0xbc7f('0x58')]({'where':{'UserId':{'$in':_0x4d5695},'VoiceQueueId':{'$in':_0x5275fd}},'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(){var _0x56690a=_0xbc7f('0x61')+_0x549ba9;return db[_0xbc7f('0x59')]['query'](_0x56690a,{'type':db[_0xbc7f('0x62')][_0xbc7f('0x5b')][_0xbc7f('0x5c')],'raw':!![],'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(_0x117858){var _0x3d634f=_[_0xbc7f('0x30')](_0x117858,function(_0x2357a9){return Number(_0x2357a9[_0xbc7f('0x63')]);});return db[_0xbc7f('0x64')][_0xbc7f('0x58')]({'where':{'UserId':{'$in':_0x4d5695},'MailQueueId':{'$in':_0x3d634f}},'transaction':_0x1e87fd});})['then'](function(){var _0x3aa9bf='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x549ba9;return db[_0xbc7f('0x59')][_0xbc7f('0x37')](_0x3aa9bf,{'type':db['Sequelize'][_0xbc7f('0x5b')][_0xbc7f('0x5c')],'raw':!![],'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(_0x5d2ee2){var _0x58f45f=_[_0xbc7f('0x30')](_0x5d2ee2,function(_0xc05748){return Number(_0xc05748[_0xbc7f('0x65')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x4d5695},'SmsQueueId':{'$in':_0x58f45f}},'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(){var _0x11efd6=_0xbc7f('0x66')+_0x549ba9;return db['sequelize'][_0xbc7f('0x37')](_0x11efd6,{'type':db[_0xbc7f('0x62')][_0xbc7f('0x5b')][_0xbc7f('0x5c')],'raw':!![],'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(_0x22ae98){var _0x50f8c9=_['map'](_0x22ae98,function(_0x2ac5af){return Number(_0x2ac5af['ChatQueueId']);});return db['UserChatQueue'][_0xbc7f('0x58')]({'where':{'UserId':{'$in':_0x4d5695},'ChatQueueId':{'$in':_0x50f8c9}},'transaction':_0x1e87fd});})['then'](function(){var _0x527c4d=_0xbc7f('0x67')+_0x549ba9;return db[_0xbc7f('0x59')][_0xbc7f('0x37')](_0x527c4d,{'type':db[_0xbc7f('0x62')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1e87fd});})['then'](function(_0x5ed16e){var _0x54ee67=_['map'](_0x5ed16e,function(_0xbcd7e){return Number(_0xbcd7e[_0xbc7f('0x68')]);});return db[_0xbc7f('0x69')][_0xbc7f('0x58')]({'where':{'UserId':{'$in':_0x4d5695},'FaxQueueId':{'$in':_0x54ee67}},'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(){var _0x569d6d=_0xbc7f('0x6a')+_0x549ba9;return db['sequelize'][_0xbc7f('0x37')](_0x569d6d,{'type':db[_0xbc7f('0x62')]['QueryTypes'][_0xbc7f('0x5c')],'raw':!![],'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(_0x328882){var _0x4e4121=_[_0xbc7f('0x30')](_0x328882,function(_0x2b0f54){return Number(_0x2b0f54[_0xbc7f('0x6b')]);});return db[_0xbc7f('0x6c')][_0xbc7f('0x58')]({'where':{'UserId':{'$in':_0x4d5695},'OpenchannelQueueId':{'$in':_0x4e4121}},'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(){var _0x4d6f7d=_0xbc7f('0x6d')+_0x549ba9;return db[_0xbc7f('0x59')][_0xbc7f('0x37')](_0x4d6f7d,{'type':db['Sequelize']['QueryTypes'][_0xbc7f('0x5c')],'raw':!![],'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(_0x4951a9){var _0x376000=_['map'](_0x4951a9,function(_0x6d326b){return Number(_0x6d326b[_0xbc7f('0x6e')]);});return db[_0xbc7f('0x6f')][_0xbc7f('0x58')]({'where':{'UserId':{'$in':_0x4d5695},'WhatsappQueueId':{'$in':_0x376000}},'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(){return db[_0xbc7f('0x70')]['find']({'where':{'TeamId':_0x549ba9}});})[_0xbc7f('0x2a')](function(_0x370715){if(_0x370715===null){return;}return db[_0xbc7f('0x71')][_0xbc7f('0x58')]({'where':{'UserId':{'$in':_0x4d5695},'VoicePrefixId':_0x370715[_0xbc7f('0x72')]},'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(){return db['Team'][_0xbc7f('0x58')]({'where':{'id':_0x549ba9},'cascade':!![],'transaction':_0x1e87fd});})[_0xbc7f('0x2a')](function(_0x13cd2f){if(_0x13cd2f===0x0){_0x4cdd98[_0xbc7f('0x1f')](0x194);}else{return db[_0xbc7f('0x53')][_0xbc7f('0x58')]({'where':{'type':_0xbc7f('0x73'),'resourceId':_0x549ba9},'cascade':!![],'transaction':_0x1e87fd})[_0xbc7f('0x2a')](function(){_0x4cdd98[_0xbc7f('0x20')](0xcc)['end']();});}})['catch'](function(_0x29bbe5){_0x4cdd98[_0xbc7f('0x20')](0x1f4)[_0xbc7f('0x2e')](_0x29bbe5);});});};exports['getQueues']=function(_0x31a0af,_0x14c668,_0x24820d){return db[_0xbc7f('0x31')][_0xbc7f('0x74')]({'where':{'id':_0x31a0af[_0xbc7f('0x57')]['id']}})[_0xbc7f('0x2a')](handleEntityNotFound(_0x14c668,null))[_0xbc7f('0x2a')](function(_0x380c76){if(!_0x31a0af[_0xbc7f('0x37')][_0xbc7f('0x75')]||!utils[_0xbc7f('0x76')](_0x31a0af['query'][_0xbc7f('0x75')])){throw new db[(_0xbc7f('0x62'))][(_0xbc7f('0x77'))](_0xbc7f('0x78'));}var _0x4dd37f={};var _0x4a0452={};_0x4a0452['model']=_['keys'](db[_[_0xbc7f('0x79')](_0x31a0af[_0xbc7f('0x37')][_0xbc7f('0x75')][_0xbc7f('0x7a')]())+'Queue'][_0xbc7f('0x32')]);_0x4a0452[_0xbc7f('0x37')]=_[_0xbc7f('0x49')](_0x31a0af['query']);_0x4a0452[_0xbc7f('0x38')]=_[_0xbc7f('0x39')](_0x4a0452[_0xbc7f('0x36')],_0x4a0452[_0xbc7f('0x37')]);_0x4dd37f[_0xbc7f('0x3a')]=_['intersection'](_0x4a0452[_0xbc7f('0x36')],qs[_0xbc7f('0x4a')](_0x31a0af['query']['fields']));_0x4dd37f[_0xbc7f('0x3a')]=_0x4dd37f['attributes']['length']?_0x4dd37f['attributes']:_0x4a0452['model'];_0x4dd37f[_0xbc7f('0x25')]=qs[_0xbc7f('0x25')](_0x31a0af['query'][_0xbc7f('0x25')]);_0x4dd37f[_0xbc7f('0x23')]=qs[_0xbc7f('0x23')](_0x31a0af['query'][_0xbc7f('0x23')]);_0x4dd37f['order']=qs['sort'](_0x31a0af[_0xbc7f('0x37')][_0xbc7f('0x3c')]);_0x4dd37f[_0xbc7f('0x3d')]=qs[_0xbc7f('0x38')](_[_0xbc7f('0x3e')](_0x31a0af[_0xbc7f('0x37')],_0x4a0452[_0xbc7f('0x38')]));_0x4dd37f=_[_0xbc7f('0x40')]({},_0x4dd37f,_0x31a0af[_0xbc7f('0x42')]);return _0x380c76[_0xbc7f('0x4e')+_[_0xbc7f('0x79')](_0x31a0af[_0xbc7f('0x37')][_0xbc7f('0x75')]['toLowerCase']())+_0xbc7f('0x7b')](_0x4dd37f);})[_0xbc7f('0x2a')](respondWithResult(_0x14c668,null))[_0xbc7f('0x47')](handleError(_0x14c668,null));};exports[_0xbc7f('0x7c')]=function(_0x422e37,_0x4193fe,_0xa9009d){return db[_0xbc7f('0x31')]['findOne']({'where':{'id':_0x422e37[_0xbc7f('0x57')]['id']}})[_0xbc7f('0x2a')](function(_0x30cdd8){if(_0x30cdd8){if(!_0x422e37[_0xbc7f('0x56')][_0xbc7f('0x75')]||!utils[_0xbc7f('0x76')](_0x422e37['body'][_0xbc7f('0x75')])){throw new db[(_0xbc7f('0x62'))][(_0xbc7f('0x77'))]('Unknown\x20channel');}return _0x30cdd8['add'+_[_0xbc7f('0x79')](_0x422e37[_0xbc7f('0x56')][_0xbc7f('0x75')][_0xbc7f('0x7a')]())+_0xbc7f('0x7b')](_0x422e37[_0xbc7f('0x56')]['ids']);}return null;})[_0xbc7f('0x2a')](handleEntityNotFound(_0x4193fe,null))[_0xbc7f('0x2a')](respondWithStatusCode(_0x4193fe,null))[_0xbc7f('0x47')](handleError(_0x4193fe,null));};exports[_0xbc7f('0x7d')]=function(_0x46de9f,_0x1a239f,_0x462d1b){return db['Team'][_0xbc7f('0x74')]({'where':{'id':_0x46de9f[_0xbc7f('0x57')]['id']}})[_0xbc7f('0x2a')](function(_0x510d16){if(_0x510d16){if(!_0x46de9f['query'][_0xbc7f('0x75')]||!utils[_0xbc7f('0x76')](_0x46de9f['query'][_0xbc7f('0x75')])){throw new db['Sequelize'][(_0xbc7f('0x77'))](_0xbc7f('0x78'));}return _0x510d16[_0xbc7f('0x7e')+_[_0xbc7f('0x79')](_0x46de9f[_0xbc7f('0x37')][_0xbc7f('0x75')][_0xbc7f('0x7a')]())+'Queues'](_0x46de9f[_0xbc7f('0x37')]['ids']);}return null;})[_0xbc7f('0x2a')](handleEntityNotFound(_0x1a239f,null))['then'](respondWithStatusCode(_0x1a239f,null))[_0xbc7f('0x47')](handleError(_0x1a239f,null));};exports['addAgents']=function(_0x49fedd,_0x387568){var _0xddd7d9=_[_0xbc7f('0x7f')](_0x49fedd['body']['ids'])?_0x49fedd[_0xbc7f('0x56')][_0xbc7f('0x80')]:[_0x49fedd[_0xbc7f('0x56')][_0xbc7f('0x80')]];var _0x173598=_0x49fedd[_0xbc7f('0x57')]['id'];return db[_0xbc7f('0x31')][_0xbc7f('0x50')]({'where':{'id':_0x173598}})[_0xbc7f('0x2a')](handleEntityNotFound(_0x387568,null))['then'](function(_0x487fd2){if(_0x487fd2){var _0x11a47c=[_0xbc7f('0x81'),_0xbc7f('0x82'),_0xbc7f('0x83'),'Sms',_0xbc7f('0x84'),_0xbc7f('0x85'),_0xbc7f('0x86')];return db['sequelize'][_0xbc7f('0x5a')](function(_0x1575d7){var _0x223535=_['map'](_0x11a47c,function(_0x5a215c){var _0x523081={'attributes':['id',_0xbc7f('0x2d')]};if(_0x5a215c===_0xbc7f('0x81')){_0x523081[_0xbc7f('0x87')]={'attributes':['penalty']};}return _0x487fd2[_0xbc7f('0x4e')+_0x5a215c+'Queues'](_0x523081)[_0xbc7f('0x2a')](function(_0x4bdba6){var _0xdf10d=_['map'](_0x4bdba6,function(_0x20caf3){var _0x4c3102=_[_0xbc7f('0x30')](_0xddd7d9,function(_0x37440a){var _0x4a4465={'where':{'UserId':_0x37440a,[_0x5a215c+_0xbc7f('0x88')]:_0x20caf3['id']},'transaction':_0x1575d7};if(_0x5a215c==='Voice'){_0x4a4465[_0xbc7f('0x1a')]={'penalty':_0x20caf3[_0xbc7f('0x89')][_0xbc7f('0x8a')]};}return db[_0xbc7f('0x8b')+_0x5a215c+_0xbc7f('0x8c')][_0xbc7f('0x8d')](_0x4a4465)[_0xbc7f('0x2a')](function(){socket[_0xbc7f('0x8e')](_0xbc7f('0x4d')+_0x5a215c+_0xbc7f('0x8f'),{'UserId':_0x37440a,[_0x5a215c+_0xbc7f('0x88')]:_0x20caf3['id']});if(_0x5a215c!==_0xbc7f('0x81')){return;}return db[_0xbc7f('0x8b')][_0xbc7f('0x45')]({'where':{'id':_0xddd7d9,'online':0x1},'attributes':['id',_0xbc7f('0x2d'),_0xbc7f('0x90'),_0xbc7f('0x91'),'interface'],'raw':!![]})[_0xbc7f('0x2a')](function(_0x2ca358){var _0x35a3cb=_[_0xbc7f('0x30')](_0x2ca358,function(_0x4ad4d1){return db[_0xbc7f('0x92')]['upsert']({'membername':_0x4ad4d1[_0xbc7f('0x2d')],'UserId':_0x4ad4d1['id'],'queue_name':_0x20caf3['name'],'VoiceQueueId':_0x20caf3['id'],'interface':_['isNil'](_0x4ad4d1['interface'])?util[_0xbc7f('0x93')](_0xbc7f('0x94'),_0x4ad4d1[_0xbc7f('0x2d')]):_0x4ad4d1['interface'],'paused':_0x4ad4d1[_0xbc7f('0x91')]||![],'penalty':_0x20caf3[_0xbc7f('0x89')][_0xbc7f('0x8a')]},{'transaction':_0x1575d7});});return Promise[_0xbc7f('0x95')](_0x35a3cb);});});});return Promise[_0xbc7f('0x95')](_0x4c3102);});return Promise[_0xbc7f('0x95')](_0xdf10d);})[_0xbc7f('0x2a')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x173598}})[_0xbc7f('0x2a')](function(_0x17987c){if(_0x17987c){var _0x4cc39e=_[_0xbc7f('0x30')](_0xddd7d9,function(_0x136698){db[_0xbc7f('0x71')]['upsert']({'UserId':_0x136698,'VoicePrefixId':_0x17987c['VoicePrefixId']});});return Promise[_0xbc7f('0x95')](_0x4cc39e);}});});});return Promise[_0xbc7f('0x95')](_0x223535)[_0xbc7f('0x2a')](function(){return _0x487fd2['addAgents'](_0xddd7d9,{'transaction':_0x1575d7})[_0xbc7f('0x96')](function(_0x289ac6){return _0x289ac6;});});});}})[_0xbc7f('0x2a')](respondWithResult(_0x387568,null))[_0xbc7f('0x47')](handleError(_0x387568,null));};exports['removeAgents']=function(_0x45654c,_0x5287cd){var _0xe289d8=_[_0xbc7f('0x7f')](_0x45654c[_0xbc7f('0x37')][_0xbc7f('0x80')])?_0x45654c[_0xbc7f('0x37')]['ids']:[_0x45654c['query'][_0xbc7f('0x80')]];var _0x2cd75d=_0x45654c[_0xbc7f('0x57')]['id'];return db[_0xbc7f('0x31')][_0xbc7f('0x50')]({'where':{'id':_0x2cd75d}})[_0xbc7f('0x2a')](handleEntityNotFound(_0x5287cd,null))['then'](function(_0x17b9ef){if(_0x17b9ef){var _0xe3bb90=['Voice',_0xbc7f('0x82'),_0xbc7f('0x83'),_0xbc7f('0x97'),'Fax',_0xbc7f('0x85'),_0xbc7f('0x86')];return db[_0xbc7f('0x59')][_0xbc7f('0x5a')](function(_0x5c4c26){var _0x352af2=_['map'](_0xe3bb90,function(_0x1f3592){var _0x562f5a={'attributes':['id',_0xbc7f('0x2d')]};return _0x17b9ef[_0xbc7f('0x4e')+_0x1f3592+'Queues'](_0x562f5a)[_0xbc7f('0x2a')](function(_0x106619){var _0x23403d=_['map'](_0x106619,function(_0x8da08b){return _0x8da08b[_0xbc7f('0x98')](_0xe289d8,{'transaction':_0x5c4c26})[_0xbc7f('0x2a')](function(){var _0x8b266e=_['map'](_0xe289d8,function(_0x32de60){socket[_0xbc7f('0x8e')]('user'+_0x1f3592+_0xbc7f('0x99'),{'UserId':Number(_0x32de60),[_0x1f3592+_0xbc7f('0x88')]:_0x8da08b['id']});if(_0x1f3592!==_0xbc7f('0x81')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x8da08b['id'],'UserId':_0x32de60},'transaction':_0x5c4c26});});return Promise[_0xbc7f('0x95')](_0x8b266e);});});return Promise[_0xbc7f('0x95')](_0x23403d);});});return Promise[_0xbc7f('0x95')](_0x352af2)[_0xbc7f('0x2a')](function(){return _0x17b9ef[_0xbc7f('0x98')](_0xe289d8,{'transaction':_0x5c4c26});})[_0xbc7f('0x2a')](function(){return db[_0xbc7f('0x70')][_0xbc7f('0x74')]({'where':{'teamId':_0x2cd75d}})[_0xbc7f('0x2a')](function(_0x41b59a){if(_0x41b59a){var _0x1ed0b9=_[_0xbc7f('0x30')](_0xe289d8,function(_0x581ead){db[_0xbc7f('0x71')][_0xbc7f('0x58')]({'where':{'UserId':_0x581ead,'VoicePrefixId':_0x41b59a[_0xbc7f('0x72')]}});});return Promise[_0xbc7f('0x95')](_0x1ed0b9);}});});});}})[_0xbc7f('0x2a')](respondWithStatusCode(_0x5287cd,null))[_0xbc7f('0x47')](handleError(_0x5287cd,null));};exports[_0xbc7f('0x9a')]=function(_0x5ed270,_0x46edd4,_0x2aa259){var _0x39f496={};var _0x228ee3={};var _0x503764;var _0x30e4a1;return db[_0xbc7f('0x31')][_0xbc7f('0x74')]({'where':{'id':_0x5ed270['params']['id']}})[_0xbc7f('0x2a')](handleEntityNotFound(_0x46edd4,null))[_0xbc7f('0x2a')](function(_0x5b2f9d){if(_0x5b2f9d){_0x503764=_0x5b2f9d;_0x228ee3[_0xbc7f('0x36')]=_['keys'](db[_0xbc7f('0x8b')]['rawAttributes']);_0x228ee3[_0xbc7f('0x37')]=_['keys'](_0x5ed270['query']);_0x228ee3[_0xbc7f('0x38')]=_['intersection'](_0x228ee3['model'],_0x228ee3[_0xbc7f('0x37')]);_0x39f496['attributes']=_[_0xbc7f('0x39')](_0x228ee3[_0xbc7f('0x36')],qs[_0xbc7f('0x4a')](_0x5ed270[_0xbc7f('0x37')]['fields']));_0x39f496['attributes']=_0x39f496['attributes'][_0xbc7f('0x4b')]?_0x39f496[_0xbc7f('0x3a')]:_0x228ee3[_0xbc7f('0x36')];_0x39f496[_0xbc7f('0x3b')]=qs[_0xbc7f('0x3c')](_0x5ed270[_0xbc7f('0x37')][_0xbc7f('0x3c')]);_0x39f496[_0xbc7f('0x3d')]=qs[_0xbc7f('0x38')](_[_0xbc7f('0x3e')](_0x5ed270[_0xbc7f('0x37')],_0x228ee3[_0xbc7f('0x38')]));if(_0x5ed270[_0xbc7f('0x37')]['filter']){_0x39f496[_0xbc7f('0x3d')]=_['merge'](_0x39f496[_0xbc7f('0x3d')],{'$or':_[_0xbc7f('0x30')](_0x39f496[_0xbc7f('0x3a')],function(_0x142994){var _0x2d9b8a={};_0x2d9b8a[_0x142994]={'$like':'%'+_0x5ed270[_0xbc7f('0x37')][_0xbc7f('0x3f')]+'%'};return _0x2d9b8a;})});}_0x39f496=_[_0xbc7f('0x40')]({},_0x39f496,_0x5ed270['options']);return _0x503764['getAgents'](_0x39f496);}})[_0xbc7f('0x2a')](function(_0x5d4d9e){if(_0x5d4d9e){_0x30e4a1=_0x5d4d9e['length'];if(!_0x5ed270[_0xbc7f('0x37')][_0xbc7f('0x9b')](_0xbc7f('0x9c'))){_0x39f496[_0xbc7f('0x25')]=qs['limit'](_0x5ed270[_0xbc7f('0x37')][_0xbc7f('0x25')]);_0x39f496[_0xbc7f('0x23')]=qs[_0xbc7f('0x23')](_0x5ed270[_0xbc7f('0x37')]['offset']);}return _0x503764[_0xbc7f('0x9a')](_0x39f496);}})[_0xbc7f('0x2a')](function(_0x2ebf2c){if(_0x2ebf2c){return _0x2ebf2c?{'count':_0x30e4a1,'rows':_0x2ebf2c}:null;}})[_0xbc7f('0x2a')](respondWithResult(_0x46edd4,null))[_0xbc7f('0x47')](handleError(_0x46edd4,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d134eaf..fe4fc04 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 _0x00c3=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x00c3,0x179));var _0x300c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x00c3[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require('events');var Team=require(_0x300c('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x300c('0x1')](0x0);var events={'afterCreate':_0x300c('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x44127a){return function(_0x576192,_0x276cee,_0x39815b){TeamEvents[_0x300c('0x3')](_0x44127a+':'+_0x576192['id'],_0x576192);TeamEvents[_0x300c('0x3')](_0x44127a,_0x576192);_0x39815b(null);};}for(var e in events){if(events[_0x300c('0x4')](e)){var event=events[e];Team[_0x300c('0x5')](e,emitEvent(event));}}module[_0x300c('0x6')]=TeamEvents; \ No newline at end of file +var _0x26f5=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x368bd1,_0x1d6fae){var _0x3b01cb=function(_0x37db57){while(--_0x37db57){_0x368bd1['push'](_0x368bd1['shift']());}};_0x3b01cb(++_0x1d6fae);}(_0x26f5,0x1d9));var _0x526f=function(_0x51846c,_0x1eaa3d){_0x51846c=_0x51846c-0x0;var _0x4a83c5=_0x26f5[_0x51846c];return _0x4a83c5;};'use strict';var EventEmitter=require(_0x526f('0x0'));var Team=require(_0x526f('0x1'))['db'][_0x526f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x526f('0x3')](0x0);var events={'afterCreate':_0x526f('0x4'),'afterUpdate':_0x526f('0x5'),'afterDestroy':_0x526f('0x6')};function emitEvent(_0x448aa7){return function(_0x331c3e,_0x3ecd21,_0x142178){TeamEvents['emit'](_0x448aa7+':'+_0x331c3e['id'],_0x331c3e);TeamEvents[_0x526f('0x7')](_0x448aa7,_0x331c3e);_0x142178(null);};}for(var e in events){if(events[_0x526f('0x8')](e)){var event=events[e];Team[_0x526f('0x9')](e,emitEvent(event));}}module[_0x526f('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index fd7f3e3..face168 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 _0x0876=['path','rimraf','../../config/environment','./team.attributes','exports','teams','util','api','bluebird'];(function(_0x3dbb16,_0x881a4a){var _0x47afd9=function(_0x1db85e){while(--_0x1db85e){_0x3dbb16['push'](_0x3dbb16['shift']());}};_0x47afd9(++_0x881a4a);}(_0x0876,0x138));var _0x6087=function(_0x2377a9,_0x3a5104){_0x2377a9=_0x2377a9-0x0;var _0x4208d0=_0x0876[_0x2377a9];return _0x4208d0;};'use strict';var _=require('lodash');var util=require(_0x6087('0x0'));var logger=require('../../config/logger')(_0x6087('0x1'));var moment=require('moment');var BPromise=require(_0x6087('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6087('0x3'));var rimraf=require(_0x6087('0x4'));var config=require(_0x6087('0x5'));var attributes=require(_0x6087('0x6'));module[_0x6087('0x7')]=function(_0x59f98e,_0x5a3bc5){return _0x59f98e['define']('Team',attributes,{'tableName':_0x6087('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ff8=['rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x15ddd3,_0x559d1f){var _0x20c568=function(_0x368ee6){while(--_0x368ee6){_0x15ddd3['push'](_0x15ddd3['shift']());}};_0x20c568(++_0x559d1f);}(_0x1ff8,0x7f));var _0x81ff=function(_0x3a5b97,_0x2da2ae){_0x3a5b97=_0x3a5b97-0x0;var _0x302862=_0x1ff8[_0x3a5b97];return _0x302862;};'use strict';var _=require(_0x81ff('0x0'));var util=require(_0x81ff('0x1'));var logger=require(_0x81ff('0x2'))(_0x81ff('0x3'));var moment=require(_0x81ff('0x4'));var BPromise=require(_0x81ff('0x5'));var rp=require(_0x81ff('0x6'));var fs=require('fs');var path=require(_0x81ff('0x7'));var rimraf=require(_0x81ff('0x8'));var config=require(_0x81ff('0x9'));var attributes=require(_0x81ff('0xa'));module[_0x81ff('0xb')]=function(_0x4b4702,_0x46560a){return _0x4b4702[_0x81ff('0xc')](_0x81ff('0xd'),attributes,{'tableName':_0x81ff('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 1d83ed0..89e8bdb 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 _0x9b94=['error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2c2c61,_0xb1256d){var _0x424ee6=function(_0x5dff2a){while(--_0x5dff2a){_0x2c2c61['push'](_0x2c2c61['shift']());}};_0x424ee6(++_0xb1256d);}(_0x9b94,0xef));var _0x49b9=function(_0x2ffa95,_0x4c6cc5){_0x2ffa95=_0x2ffa95-0x0;var _0x26ef3b=_0x9b94[_0x2ffa95];return _0x26ef3b;};'use strict';var _=require(_0x49b9('0x0'));var util=require('util');var moment=require(_0x49b9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49b9('0x2'));var db=require(_0x49b9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x49b9('0x4'))(_0x49b9('0x5'));var config=require('../../config/environment');var jayson=require(_0x49b9('0x6'));var client=jayson[_0x49b9('0x7')][_0x49b9('0x8')]({'port':0x232a});config['redis']=_[_0x49b9('0x9')](config['redis'],{'host':_0x49b9('0xa'),'port':0x18eb});var socket=require(_0x49b9('0xb'))(new Redis(config[_0x49b9('0xc')]));require('./team.socket')[_0x49b9('0xd')](socket);function respondWithRpcPromise(_0x15c3dd,_0x5bdbe0,_0x51047e){return new BPromise(function(_0x1f9617,_0x1aa18c){return client[_0x49b9('0xe')](_0x15c3dd,_0x51047e)[_0x49b9('0xf')](function(_0x1dbc14){logger[_0x49b9('0x10')](_0x49b9('0x11'),_0x5bdbe0,_0x49b9('0x12'));logger[_0x49b9('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x5bdbe0,_0x49b9('0x12'),JSON[_0x49b9('0x14')](_0x1dbc14));if(_0x1dbc14[_0x49b9('0x15')]){if(_0x1dbc14[_0x49b9('0x15')][_0x49b9('0x16')]===0x1f4){logger[_0x49b9('0x15')]('Team,\x20%s,\x20%s',_0x5bdbe0,_0x1dbc14[_0x49b9('0x15')]['message']);return _0x1aa18c(_0x1dbc14[_0x49b9('0x15')][_0x49b9('0x17')]);}logger[_0x49b9('0x15')]('Team,\x20%s,\x20%s',_0x5bdbe0,_0x1dbc14[_0x49b9('0x15')][_0x49b9('0x17')]);return _0x1f9617(_0x1dbc14['error']['message']);}else{logger[_0x49b9('0x10')](_0x49b9('0x11'),_0x5bdbe0,_0x49b9('0x12'));_0x1f9617(_0x1dbc14[_0x49b9('0x18')][_0x49b9('0x17')]);}})[_0x49b9('0x19')](function(_0x555a19){logger[_0x49b9('0x15')](_0x49b9('0x11'),_0x5bdbe0,_0x555a19);_0x1aa18c(_0x555a19);});});} \ No newline at end of file +var _0x1949=['debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x6955bf,_0x3ad999){var _0x3114f8=function(_0x4c6b3d){while(--_0x4c6b3d){_0x6955bf['push'](_0x6955bf['shift']());}};_0x3114f8(++_0x3ad999);}(_0x1949,0xd5));var _0x9194=function(_0x2bcd20,_0x5a0a8c){_0x2bcd20=_0x2bcd20-0x0;var _0x22f810=_0x1949[_0x2bcd20];return _0x22f810;};'use strict';var _=require(_0x9194('0x0'));var util=require(_0x9194('0x1'));var moment=require(_0x9194('0x2'));var BPromise=require(_0x9194('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9194('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9194('0x5'));var config=require(_0x9194('0x6'));var jayson=require(_0x9194('0x7'));var client=jayson[_0x9194('0x8')]['http']({'port':0x232a});config[_0x9194('0x9')]=_[_0x9194('0xa')](config[_0x9194('0x9')],{'host':_0x9194('0xb'),'port':0x18eb});var socket=require(_0x9194('0xc'))(new Redis(config[_0x9194('0x9')]));require('./team.socket')[_0x9194('0xd')](socket);function respondWithRpcPromise(_0x51d7da,_0x1ebb35,_0x291fa1){return new BPromise(function(_0x3ac717,_0x3377b3){return client['request'](_0x51d7da,_0x291fa1)['then'](function(_0xf0e0a8){logger[_0x9194('0xe')](_0x9194('0xf'),_0x1ebb35,_0x9194('0x10'));logger[_0x9194('0x11')](_0x9194('0x12'),_0x1ebb35,_0x9194('0x10'),JSON[_0x9194('0x13')](_0xf0e0a8));if(_0xf0e0a8[_0x9194('0x14')]){if(_0xf0e0a8['error'][_0x9194('0x15')]===0x1f4){logger['error'](_0x9194('0xf'),_0x1ebb35,_0xf0e0a8[_0x9194('0x14')][_0x9194('0x16')]);return _0x3377b3(_0xf0e0a8[_0x9194('0x14')][_0x9194('0x16')]);}logger[_0x9194('0x14')](_0x9194('0xf'),_0x1ebb35,_0xf0e0a8['error']['message']);return _0x3ac717(_0xf0e0a8[_0x9194('0x14')][_0x9194('0x16')]);}else{logger[_0x9194('0xe')](_0x9194('0xf'),_0x1ebb35,_0x9194('0x10'));_0x3ac717(_0xf0e0a8['result'][_0x9194('0x16')]);}})['catch'](function(_0x2917c2){logger[_0x9194('0x14')]('Team,\x20%s,\x20%s',_0x1ebb35,_0x2917c2);_0x3377b3(_0x2917c2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8e6e4f7..d9221fa 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 _0x7162=['team:','save','remove','update'];(function(_0x1e6e01,_0x532a61){var _0x2c6ab5=function(_0x289d6c){while(--_0x289d6c){_0x1e6e01['push'](_0x1e6e01['shift']());}};_0x2c6ab5(++_0x532a61);}(_0x7162,0x11d));var _0x2716=function(_0x252884,_0x117ddf){_0x252884=_0x252884-0x0;var _0x4de0e6=_0x7162[_0x252884];return _0x4de0e6;};'use strict';var TeamEvents=require('./team.events');var events=[_0x2716('0x0'),_0x2716('0x1'),_0x2716('0x2')];function createListener(_0x129304,_0x40a52e){return function(_0x51db46){_0x40a52e['emit'](_0x129304,_0x51db46);};}function removeListener(_0x3f3e8e,_0x59ddf6){return function(){TeamEvents['removeListener'](_0x3f3e8e,_0x59ddf6);};}exports['register']=function(_0x8894fc){for(var _0x103f72=0x0,_0x3e1484=events['length'];_0x103f72<_0x3e1484;_0x103f72++){var _0x4b099e=events[_0x103f72];var _0x4ea33d=createListener(_0x2716('0x3')+_0x4b099e,_0x8894fc);TeamEvents['on'](_0x4b099e,_0x4ea33d);}}; \ No newline at end of file +var _0xbf3f=['team:','./team.events','emit','removeListener','register','length'];(function(_0x5346f8,_0x17287e){var _0x2a66e9=function(_0x59477a){while(--_0x59477a){_0x5346f8['push'](_0x5346f8['shift']());}};_0x2a66e9(++_0x17287e);}(_0xbf3f,0x10f));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0xfbf3('0x0'));var events=['save','remove','update'];function createListener(_0x5a4e2c,_0x4a5854){return function(_0x3f0335){_0x4a5854[_0xfbf3('0x1')](_0x5a4e2c,_0x3f0335);};}function removeListener(_0x181cbe,_0x5bc16d){return function(){TeamEvents[_0xfbf3('0x2')](_0x181cbe,_0x5bc16d);};}exports[_0xfbf3('0x3')]=function(_0x117730){for(var _0x1584e2=0x0,_0x218007=events[_0xfbf3('0x4')];_0x1584e2<_0x218007;_0x1584e2++){var _0x7bf395=events[_0x1584e2];var _0x58460f=createListener(_0xfbf3('0x5')+_0x7bf395,_0x117730);TeamEvents['on'](_0x7bf395,_0x58460f);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index b8ab74b..e3a238b 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 _0x8653=['INTEGER'];(function(_0x2965a4,_0xd649be){var _0x5e327d=function(_0x29c48a){while(--_0x29c48a){_0x2965a4['push'](_0x2965a4['shift']());}};_0x5e327d(++_0xd649be);}(_0x8653,0x17a));var _0x3865=function(_0x50fa0b,_0xe16273){_0x50fa0b=_0x50fa0b-0x0;var _0x3e055e=_0x8653[_0x50fa0b];return _0x3e055e;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x3865('0x0')]}}; \ No newline at end of file +var _0xee5b=['sequelize','INTEGER'];(function(_0x28014e,_0x4e5a91){var _0x162e4c=function(_0x74b2a8){while(--_0x74b2a8){_0x28014e['push'](_0x28014e['shift']());}};_0x162e4c(++_0x4e5a91);}(_0xee5b,0x1f4));var _0xbee5=function(_0x51f0a6,_0x1dfc98){_0x51f0a6=_0x51f0a6-0x0;var _0x19ab4a=_0xee5b[_0x51f0a6];return _0x19ab4a;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xbee5('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xbee5('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 798fd3a..e2c193a 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 _0xb627=['../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x2352c3,_0x5e85de){var _0x52e5a9=function(_0x1d0f41){while(--_0x1d0f41){_0x2352c3['push'](_0x2352c3['shift']());}};_0x52e5a9(++_0x5e85de);}(_0xb627,0x144));var _0x7b62=function(_0x34b8be,_0x316d9e){_0x34b8be=_0x34b8be-0x0;var _0x4ddf82=_0xb627[_0x34b8be];return _0x4ddf82;};'use strict';var _=require(_0x7b62('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7b62('0x1'));var moment=require('moment');var BPromise=require(_0x7b62('0x2'));var rp=require(_0x7b62('0x3'));var fs=require('fs');var path=require(_0x7b62('0x4'));var rimraf=require(_0x7b62('0x5'));var config=require(_0x7b62('0x6'));var attributes=require(_0x7b62('0x7'));module[_0x7b62('0x8')]=function(_0x4ad3e8,_0x71aec9){return _0x4ad3e8['define'](_0x7b62('0x9'),attributes,{'tableName':_0x7b62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30d6=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','bluebird','request-promise','path','./teamVoicePrefix.attributes','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x30d6,0x1b0));var _0x630d=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x30d6[_0x673722];return _0x21249c;};'use strict';var _=require(_0x630d('0x0'));var util=require(_0x630d('0x1'));var logger=require('../../config/logger')(_0x630d('0x2'));var moment=require('moment');var BPromise=require(_0x630d('0x3'));var rp=require(_0x630d('0x4'));var fs=require('fs');var path=require(_0x630d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x630d('0x6'));module[_0x630d('0x7')]=function(_0x83b614,_0x5217c8){return _0x83b614[_0x630d('0x8')](_0x630d('0x9'),attributes,{'tableName':_0x630d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2cd71d6..1b9156a 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41f33d,_0x69df03){var _0x24b43e=function(_0x529f25){while(--_0x529f25){_0x41f33d['push'](_0x41f33d['shift']());}};_0x24b43e(++_0x69df03);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f9ef7f4..daa9b64 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 _0xddd3=['INTEGER','sequelize','exports'];(function(_0x24d312,_0x46ab29){var _0x2e7760=function(_0x46d239){while(--_0x46d239){_0x24d312['push'](_0x24d312['shift']());}};_0x2e7760(++_0x46ab29);}(_0xddd3,0x1b1));var _0x3ddd=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xddd3[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x3ddd('0x0'));module[_0x3ddd('0x1')]={'penalty':{'type':Sequelize[_0x3ddd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5797=['exports'];(function(_0x603220,_0x3428a9){var _0x135f2e=function(_0x5afbb8){while(--_0x5afbb8){_0x603220['push'](_0x603220['shift']());}};_0x135f2e(++_0x3428a9);}(_0x5797,0xc4));var _0x7579=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5797[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x7579('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index d4d7f2f..bd8d856 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 _0x1061=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','lodash','moment','bluebird'];(function(_0x444672,_0x4894c2){var _0x4ba0fc=function(_0x2a89d9){while(--_0x2a89d9){_0x444672['push'](_0x444672['shift']());}};_0x4ba0fc(++_0x4894c2);}(_0x1061,0x1b5));var _0x1106=function(_0x2bb9e4,_0x108733){_0x2bb9e4=_0x2bb9e4-0x0;var _0x2122cf=_0x1061[_0x2bb9e4];return _0x2122cf;};'use strict';var _=require(_0x1106('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1106('0x1'));var BPromise=require(_0x1106('0x2'));var rp=require(_0x1106('0x3'));var fs=require('fs');var path=require(_0x1106('0x4'));var rimraf=require(_0x1106('0x5'));var config=require(_0x1106('0x6'));var attributes=require(_0x1106('0x7'));module[_0x1106('0x8')]=function(_0x5120c6,_0x1f098a){return _0x5120c6[_0x1106('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fda=['lodash','api','moment','bluebird','request-promise','path','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x3e52d5,_0x128785){var _0x4146ea=function(_0x7354b4){while(--_0x7354b4){_0x3e52d5['push'](_0x3e52d5['shift']());}};_0x4146ea(++_0x128785);}(_0x2fda,0x186));var _0xa2fd=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x2fda[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xa2fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2fd('0x1'));var moment=require(_0xa2fd('0x2'));var BPromise=require(_0xa2fd('0x3'));var rp=require(_0xa2fd('0x4'));var fs=require('fs');var path=require(_0xa2fd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0xa2fd('0x6')]=function(_0x1bab5a,_0x4c6b0b){return _0x1bab5a[_0xa2fd('0x7')](_0xa2fd('0x8'),attributes,{'tableName':_0xa2fd('0x9'),'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 6b462b3..8514498 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 _0x9734=['../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x51708f,_0x511834){var _0x5c60a3=function(_0x29fbec){while(--_0x29fbec){_0x51708f['push'](_0x51708f['shift']());}};_0x5c60a3(++_0x511834);}(_0x9734,0xe0));var _0x4973=function(_0x4d1c45,_0x6ff874){_0x4d1c45=_0x4d1c45-0x0;var _0x44775c=_0x9734[_0x4d1c45];return _0x44775c;};'use strict';var _=require('lodash');var util=require(_0x4973('0x0'));var moment=require('moment');var BPromise=require(_0x4973('0x1'));var rs=require(_0x4973('0x2'));var fs=require('fs');var Redis=require(_0x4973('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4973('0x4'));var logger=require(_0x4973('0x5'))(_0x4973('0x6'));var config=require(_0x4973('0x7'));var jayson=require(_0x4973('0x8'));var client=jayson[_0x4973('0x9')][_0x4973('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe3309f,_0x1a6a3f,_0x15e1d2){return new BPromise(function(_0x2664f7,_0xf9beeb){return client[_0x4973('0xb')](_0xe3309f,_0x15e1d2)[_0x4973('0xc')](function(_0x4b9be7){logger[_0x4973('0xd')](_0x4973('0xe'),_0x1a6a3f,_0x4973('0xf'));logger[_0x4973('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1a6a3f,_0x4973('0xf'),JSON[_0x4973('0x11')](_0x4b9be7));if(_0x4b9be7[_0x4973('0x12')]){if(_0x4b9be7['error'][_0x4973('0x13')]===0x1f4){logger['error'](_0x4973('0xe'),_0x1a6a3f,_0x4b9be7[_0x4973('0x12')][_0x4973('0x14')]);return _0xf9beeb(_0x4b9be7[_0x4973('0x12')][_0x4973('0x14')]);}logger[_0x4973('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1a6a3f,_0x4b9be7[_0x4973('0x12')][_0x4973('0x14')]);return _0x2664f7(_0x4b9be7['error'][_0x4973('0x14')]);}else{logger[_0x4973('0xd')](_0x4973('0xe'),_0x1a6a3f,_0x4973('0xf'));_0x2664f7(_0x4b9be7['result']['message']);}})['catch'](function(_0x3f9c55){logger[_0x4973('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1a6a3f,_0x3f9c55);_0xf9beeb(_0x3f9c55);});});} \ No newline at end of file +var _0x073c=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5bbad0,_0x59de36){var _0x5ed7da=function(_0x124755){while(--_0x124755){_0x5bbad0['push'](_0x5bbad0['shift']());}};_0x5ed7da(++_0x59de36);}(_0x073c,0x118));var _0xc073=function(_0x13ac24,_0x1cc1e6){_0x13ac24=_0x13ac24-0x0;var _0x2cf9b3=_0x073c[_0x13ac24];return _0x2cf9b3;};'use strict';var _=require('lodash');var util=require(_0xc073('0x0'));var moment=require(_0xc073('0x1'));var BPromise=require(_0xc073('0x2'));var rs=require(_0xc073('0x3'));var fs=require('fs');var Redis=require(_0xc073('0x4'));var db=require(_0xc073('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc073('0x6'))('rpc');var config=require(_0xc073('0x7'));var jayson=require(_0xc073('0x8'));var client=jayson[_0xc073('0x9')][_0xc073('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4557f2,_0x5029ce,_0x49f6dc){return new BPromise(function(_0x1be710,_0x56ad85){return client[_0xc073('0xb')](_0x4557f2,_0x49f6dc)[_0xc073('0xc')](function(_0x50a2dc){logger[_0xc073('0xd')](_0xc073('0xe'),_0x5029ce,_0xc073('0xf'));logger[_0xc073('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5029ce,_0xc073('0xf'),JSON[_0xc073('0x11')](_0x50a2dc));if(_0x50a2dc[_0xc073('0x12')]){if(_0x50a2dc[_0xc073('0x12')][_0xc073('0x13')]===0x1f4){logger[_0xc073('0x12')](_0xc073('0xe'),_0x5029ce,_0x50a2dc['error'][_0xc073('0x14')]);return _0x56ad85(_0x50a2dc[_0xc073('0x12')][_0xc073('0x14')]);}logger[_0xc073('0x12')](_0xc073('0xe'),_0x5029ce,_0x50a2dc[_0xc073('0x12')][_0xc073('0x14')]);return _0x1be710(_0x50a2dc[_0xc073('0x12')][_0xc073('0x14')]);}else{logger[_0xc073('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5029ce,'request\x20sent');_0x1be710(_0x50a2dc['result'][_0xc073('0x14')]);}})[_0xc073('0x15')](function(_0x294033){logger['error'](_0xc073('0xe'),_0x5029ce,_0x294033);_0x56ad85(_0x294033);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 1ef21ef..8d0c408 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 _0x69d4=['../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x48522b,_0x28d112){var _0x511408=function(_0x103887){while(--_0x103887){_0x48522b['push'](_0x48522b['shift']());}};_0x511408(++_0x28d112);}(_0x69d4,0x83));var _0x469d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x69d4[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var path=require('path');var timeout=require(_0x469d('0x2'));var express=require(_0x469d('0x3'));var router=express[_0x469d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x469d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x469d('0x6'));var controller=require(_0x469d('0x7'));router[_0x469d('0x8')]('/',auth[_0x469d('0x9')](),controller[_0x469d('0xa')]);router[_0x469d('0x8')]('/:id',auth[_0x469d('0x9')](),controller['show']);router[_0x469d('0xb')]('/',auth[_0x469d('0x9')](),controller[_0x469d('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x469d('0xd')]);router[_0x469d('0xe')]('/:id',auth[_0x469d('0x9')](),controller[_0x469d('0xf')]);module[_0x469d('0x10')]=router; \ No newline at end of file +var _0x8f1a=['express','Router','fs-extra','../../components/auth/service','./template.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x4fa1d9,_0x38cdb6){var _0x55ad71=function(_0x21071e){while(--_0x21071e){_0x4fa1d9['push'](_0x4fa1d9['shift']());}};_0x55ad71(++_0x38cdb6);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x566da6,_0x5edcf1){_0x566da6=_0x566da6-0x0;var _0x3d81e4=_0x8f1a[_0x566da6];return _0x3d81e4;};'use strict';var multer=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var path=require(_0xa8f1('0x2'));var timeout=require(_0xa8f1('0x3'));var express=require(_0xa8f1('0x4'));var router=express[_0xa8f1('0x5')]();var fs_extra=require(_0xa8f1('0x6'));var auth=require(_0xa8f1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8f1('0x8'));router['get']('/',auth[_0xa8f1('0x9')](),controller[_0xa8f1('0xa')]);router['get'](_0xa8f1('0xb'),auth[_0xa8f1('0x9')](),controller[_0xa8f1('0xc')]);router[_0xa8f1('0xd')]('/',auth[_0xa8f1('0x9')](),controller[_0xa8f1('0xe')]);router[_0xa8f1('0xf')](_0xa8f1('0xb'),auth['isAuthenticated'](),controller[_0xa8f1('0x10')]);router[_0xa8f1('0x11')]('/:id',auth[_0xa8f1('0x9')](),controller['destroy']);module[_0xa8f1('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 420d3ce..1bfd73d 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 _0xa1d9=['exports','STRING','TEXT'];(function(_0x45b2b7,_0x44122f){var _0x25c49b=function(_0xc1b134){while(--_0xc1b134){_0x45b2b7['push'](_0x45b2b7['shift']());}};_0x25c49b(++_0x44122f);}(_0xa1d9,0x123));var _0x9a1d=function(_0x527584,_0x327fa8){_0x527584=_0x527584-0x0;var _0x54510f=_0xa1d9[_0x527584];return _0x54510f;};'use strict';var Sequelize=require('sequelize');module[_0x9a1d('0x0')]={'name':{'type':Sequelize[_0x9a1d('0x1')]},'description':{'type':Sequelize[_0x9a1d('0x1')]},'html':{'type':Sequelize[_0x9a1d('0x2')]}}; \ No newline at end of file +var _0xeaf4=['exports','STRING','TEXT'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0xeaf4,0xe7));var _0x4eaf=function(_0x199db7,_0x233a37){_0x199db7=_0x199db7-0x0;var _0x315189=_0xeaf4[_0x199db7];return _0x315189;};'use strict';var Sequelize=require('sequelize');module[_0x4eaf('0x0')]={'name':{'type':Sequelize[_0x4eaf('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x4eaf('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6175f0e..493f797 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 _0xb1ce=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','update','then','UserProfileResource','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Template','show','find','catch','create','body','get','role','user','Templates','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2ad3fd,_0x24c202){var _0x30fe82=function(_0x4937f0){while(--_0x4937f0){_0x2ad3fd['push'](_0x2ad3fd['shift']());}};_0x30fe82(++_0x24c202);}(_0xb1ce,0xd9));var _0xeb1c=function(_0x366ce9,_0x457a54){_0x366ce9=_0x366ce9-0x0;var _0x56a9a6=_0xb1ce[_0x366ce9];return _0x56a9a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb1c('0x0'));var zipdir=require(_0xeb1c('0x1'));var jsonpatch=require(_0xeb1c('0x2'));var rp=require(_0xeb1c('0x3'));var moment=require(_0xeb1c('0x4'));var BPromise=require(_0xeb1c('0x5'));var Mustache=require(_0xeb1c('0x6'));var util=require(_0xeb1c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeb1c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb1c('0x9'));var _=require(_0xeb1c('0xa'));var squel=require(_0xeb1c('0xb'));var crypto=require(_0xeb1c('0xc'));var jsforce=require(_0xeb1c('0xd'));var deskjs=require(_0xeb1c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeb1c('0xf'));var Papa=require(_0xeb1c('0x10'));var Redis=require(_0xeb1c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeb1c('0x12'));var as=require(_0xeb1c('0x13'));var hardwareService=require(_0xeb1c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xeb1c('0x15'));var config=require(_0xeb1c('0x16'));var licenseUtil=require(_0xeb1c('0x17'));var db=require(_0xeb1c('0x18'))['db'];function respondWithStatusCode(_0x1b4b50,_0x2cb7da){_0x2cb7da=_0x2cb7da||0xcc;return function(_0x416ef8){if(_0x416ef8){return _0x1b4b50[_0xeb1c('0x19')](_0x2cb7da);}return _0x1b4b50['status'](_0x2cb7da)[_0xeb1c('0x1a')]();};}function respondWithResult(_0xfc8690,_0x3bb450){_0x3bb450=_0x3bb450||0xc8;return function(_0x343cf3){if(_0x343cf3){return _0xfc8690[_0xeb1c('0x1b')](_0x3bb450)[_0xeb1c('0x1c')](_0x343cf3);}};}function respondWithFilteredResult(_0x29dbdd,_0x5de10e){return function(_0x2e8e2f){if(_0x2e8e2f){var _0x5a5cc4=typeof _0x5de10e[_0xeb1c('0x1d')]===_0xeb1c('0x1e')&&typeof _0x5de10e[_0xeb1c('0x1f')]===_0xeb1c('0x1e');var _0x291878=_0x2e8e2f[_0xeb1c('0x20')];var _0x463899=_0x5a5cc4?0x0:_0x5de10e[_0xeb1c('0x1d')];var _0x509ad8=_0x5a5cc4?_0x2e8e2f[_0xeb1c('0x20')]:_0x5de10e['offset']+_0x5de10e['limit'];var _0x294154;if(_0x509ad8>=_0x291878){_0x509ad8=_0x291878;_0x294154=0xc8;}else{_0x294154=0xce;}_0x29dbdd['status'](_0x294154);return _0x29dbdd[_0xeb1c('0x21')]('Content-Range',_0x463899+'-'+_0x509ad8+'/'+_0x291878)[_0xeb1c('0x1c')](_0x2e8e2f);}return null;};}function patchUpdates(_0x3226c2){return function(_0x51862b){try{jsonpatch[_0xeb1c('0x22')](_0x51862b,_0x3226c2,!![]);}catch(_0x5ef876){return BPromise['reject'](_0x5ef876);}return _0x51862b['save']();};}function saveUpdates(_0x5a3431,_0x18afe2){return function(_0x1c9871){if(_0x1c9871){return _0x1c9871[_0xeb1c('0x23')](_0x5a3431)[_0xeb1c('0x24')](function(_0xb762ff){return _0xb762ff;});}return null;};}function removeEntity(_0x124e78,_0x592a84){return function(_0x186ac5){if(_0x186ac5){return _0x186ac5['destroy']()[_0xeb1c('0x24')](function(){var _0x2b5090=_0x186ac5['get']({'plain':!![]});var _0x5fc0f2='Templates';return db[_0xeb1c('0x25')][_0xeb1c('0x26')]({'where':{'type':_0x5fc0f2,'resourceId':_0x2b5090['id']}})[_0xeb1c('0x24')](function(){return _0x186ac5;});})['then'](function(){_0x124e78[_0xeb1c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305dd2,_0x3939d6){return function(_0x1facd6){if(!_0x1facd6){_0x305dd2[_0xeb1c('0x19')](0x194);}return _0x1facd6;};}function handleError(_0x18317f,_0x468f00){_0x468f00=_0x468f00||0x1f4;return function(_0x3f2385){logger[_0xeb1c('0x27')](_0x3f2385['stack']);if(_0x3f2385['name']){delete _0x3f2385[_0xeb1c('0x28')];}_0x18317f[_0xeb1c('0x1b')](_0x468f00)[_0xeb1c('0x29')](_0x3f2385);};}exports[_0xeb1c('0x2a')]=function(_0x3a24a2,_0x3da0e3){var _0x4c196f={},_0x359fff={},_0x322516={'count':0x0,'rows':[]};var _0x2aa2a1=_['map'](db['Template'][_0xeb1c('0x2b')],function(_0x8df004){return{'name':_0x8df004[_0xeb1c('0x2c')],'type':_0x8df004[_0xeb1c('0x2d')][_0xeb1c('0x2e')]};});_0x359fff[_0xeb1c('0x2f')]=_[_0xeb1c('0x30')](_0x2aa2a1,_0xeb1c('0x28'));_0x359fff[_0xeb1c('0x31')]=_['keys'](_0x3a24a2[_0xeb1c('0x31')]);_0x359fff[_0xeb1c('0x32')]=_[_0xeb1c('0x33')](_0x359fff[_0xeb1c('0x2f')],_0x359fff[_0xeb1c('0x31')]);_0x4c196f[_0xeb1c('0x34')]=_[_0xeb1c('0x33')](_0x359fff['model'],qs[_0xeb1c('0x35')](_0x3a24a2['query'][_0xeb1c('0x35')]));_0x4c196f['attributes']=_0x4c196f[_0xeb1c('0x34')][_0xeb1c('0x36')]?_0x4c196f[_0xeb1c('0x34')]:_0x359fff[_0xeb1c('0x2f')];if(!_0x3a24a2[_0xeb1c('0x31')][_0xeb1c('0x37')](_0xeb1c('0x38'))){_0x4c196f[_0xeb1c('0x1f')]=qs[_0xeb1c('0x1f')](_0x3a24a2['query']['limit']);_0x4c196f[_0xeb1c('0x1d')]=qs[_0xeb1c('0x1d')](_0x3a24a2[_0xeb1c('0x31')][_0xeb1c('0x1d')]);}_0x4c196f['order']=qs[_0xeb1c('0x39')](_0x3a24a2[_0xeb1c('0x31')][_0xeb1c('0x39')]);_0x4c196f[_0xeb1c('0x3a')]=qs[_0xeb1c('0x32')](_[_0xeb1c('0x3b')](_0x3a24a2[_0xeb1c('0x31')],_0x359fff[_0xeb1c('0x32')]),_0x2aa2a1);if(_0x3a24a2['query'][_0xeb1c('0x3c')]){_0x4c196f[_0xeb1c('0x3a')]=_[_0xeb1c('0x3d')](_0x4c196f[_0xeb1c('0x3a')],{'$or':_['map'](_0x2aa2a1,function(_0x248373){if(_0x248373[_0xeb1c('0x2d')]!==_0xeb1c('0x3e')){var _0x4cff1d={};_0x4cff1d[_0x248373[_0xeb1c('0x28')]]={'$like':'%'+_0x3a24a2[_0xeb1c('0x31')]['filter']+'%'};return _0x4cff1d;}})});}_0x4c196f=_[_0xeb1c('0x3d')]({},_0x4c196f,_0x3a24a2[_0xeb1c('0x3f')]);var _0xa7e743={'where':_0x4c196f[_0xeb1c('0x3a')]};return db['Template'][_0xeb1c('0x20')](_0xa7e743)[_0xeb1c('0x24')](function(_0x197c44){_0x322516['count']=_0x197c44;if(_0x3a24a2[_0xeb1c('0x31')][_0xeb1c('0x40')]){_0x4c196f[_0xeb1c('0x41')]=[{'all':!![]}];}return db[_0xeb1c('0x42')]['findAll'](_0x4c196f);})[_0xeb1c('0x24')](function(_0x521907){_0x322516['rows']=_0x521907;return _0x322516;})[_0xeb1c('0x24')](respondWithFilteredResult(_0x3da0e3,_0x4c196f))['catch'](handleError(_0x3da0e3,null));};exports[_0xeb1c('0x43')]=function(_0x555d3d,_0x19f302){var _0x5a294b={'raw':!![],'where':{'id':_0x555d3d['params']['id']}},_0x5d19c4={};_0x5d19c4[_0xeb1c('0x2f')]=_['keys'](db[_0xeb1c('0x42')][_0xeb1c('0x2b')]);_0x5d19c4[_0xeb1c('0x31')]=_['keys'](_0x555d3d[_0xeb1c('0x31')]);_0x5d19c4['filters']=_[_0xeb1c('0x33')](_0x5d19c4[_0xeb1c('0x2f')],_0x5d19c4['query']);_0x5a294b['attributes']=_[_0xeb1c('0x33')](_0x5d19c4['model'],qs[_0xeb1c('0x35')](_0x555d3d[_0xeb1c('0x31')]['fields']));_0x5a294b[_0xeb1c('0x34')]=_0x5a294b[_0xeb1c('0x34')][_0xeb1c('0x36')]?_0x5a294b['attributes']:_0x5d19c4[_0xeb1c('0x2f')];if(_0x555d3d[_0xeb1c('0x31')][_0xeb1c('0x40')]){_0x5a294b[_0xeb1c('0x41')]=[{'all':!![]}];}_0x5a294b=_[_0xeb1c('0x3d')]({},_0x5a294b,_0x555d3d[_0xeb1c('0x3f')]);return db[_0xeb1c('0x42')][_0xeb1c('0x44')](_0x5a294b)[_0xeb1c('0x24')](handleEntityNotFound(_0x19f302,null))[_0xeb1c('0x24')](respondWithResult(_0x19f302,null))[_0xeb1c('0x45')](handleError(_0x19f302,null));};exports[_0xeb1c('0x46')]=function(_0x330cb5,_0x434ca9){return db['Template'][_0xeb1c('0x46')](_0x330cb5[_0xeb1c('0x47')],{})[_0xeb1c('0x24')](function(_0x525d90){var _0x552aec=_0x330cb5['user'][_0xeb1c('0x48')]({'plain':!![]});if(!_0x552aec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x552aec[_0xeb1c('0x49')]===_0xeb1c('0x4a')){var _0x22b8f6=_0x525d90[_0xeb1c('0x48')]({'plain':!![]});var _0x2f0674=_0xeb1c('0x4b');return db['UserProfileSection'][_0xeb1c('0x44')]({'where':{'name':_0x2f0674,'userProfileId':_0x552aec[_0xeb1c('0x4c')]},'raw':!![]})[_0xeb1c('0x24')](function(_0x1ccf61){if(_0x1ccf61&&_0x1ccf61[_0xeb1c('0x4d')]===0x0){return db[_0xeb1c('0x25')][_0xeb1c('0x46')]({'name':_0x22b8f6[_0xeb1c('0x28')],'resourceId':_0x22b8f6['id'],'type':_0x1ccf61[_0xeb1c('0x28')],'sectionId':_0x1ccf61['id']},{})[_0xeb1c('0x24')](function(){return _0x525d90;});}else{return _0x525d90;}})[_0xeb1c('0x45')](function(_0x2ff029){logger['error'](_0xeb1c('0x4e'),_0x2ff029);throw _0x2ff029;});}return _0x525d90;})[_0xeb1c('0x24')](respondWithResult(_0x434ca9,0xc9))[_0xeb1c('0x45')](handleError(_0x434ca9,null));};exports[_0xeb1c('0x23')]=function(_0x2adf32,_0x36fb27){if(_0x2adf32[_0xeb1c('0x47')]['id']){delete _0x2adf32[_0xeb1c('0x47')]['id'];}return db[_0xeb1c('0x42')][_0xeb1c('0x44')]({'where':{'id':_0x2adf32['params']['id']}})[_0xeb1c('0x24')](handleEntityNotFound(_0x36fb27,null))[_0xeb1c('0x24')](saveUpdates(_0x2adf32[_0xeb1c('0x47')],null))[_0xeb1c('0x24')](respondWithResult(_0x36fb27,null))['catch'](handleError(_0x36fb27,null));};exports[_0xeb1c('0x26')]=function(_0x111bfe,_0x1f0b23){return db[_0xeb1c('0x42')][_0xeb1c('0x44')]({'where':{'id':_0x111bfe['params']['id']}})[_0xeb1c('0x24')](handleEntityNotFound(_0x1f0b23,null))[_0xeb1c('0x24')](removeEntity(_0x1f0b23,null))['catch'](handleError(_0x1f0b23,null));}; \ No newline at end of file +var _0x9186=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','params','include','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x5e028a,_0x2629d2){var _0x2a6f1c=function(_0x1a9de5){while(--_0x1a9de5){_0x5e028a['push'](_0x5e028a['shift']());}};_0x2a6f1c(++_0x2629d2);}(_0x9186,0xa0));var _0x6918=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x9186[_0x1db251];return _0x56685a;};'use strict';var emlformat=require(_0x6918('0x0'));var rimraf=require(_0x6918('0x1'));var zipdir=require(_0x6918('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6918('0x3'));var moment=require(_0x6918('0x4'));var BPromise=require(_0x6918('0x5'));var Mustache=require(_0x6918('0x6'));var util=require(_0x6918('0x7'));var path=require(_0x6918('0x8'));var sox=require(_0x6918('0x9'));var csv=require(_0x6918('0xa'));var ejs=require(_0x6918('0xb'));var fs=require('fs');var fs_extra=require(_0x6918('0xc'));var _=require(_0x6918('0xd'));var squel=require(_0x6918('0xe'));var crypto=require(_0x6918('0xf'));var jsforce=require(_0x6918('0x10'));var deskjs=require(_0x6918('0x11'));var toCsv=require('to-csv');var querystring=require(_0x6918('0x12'));var Papa=require('papaparse');var Redis=require(_0x6918('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6918('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6918('0x15'));var utils=require(_0x6918('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6918('0x17'));var db=require(_0x6918('0x18'))['db'];function respondWithStatusCode(_0x1c7207,_0x201cac){_0x201cac=_0x201cac||0xcc;return function(_0x326457){if(_0x326457){return _0x1c7207['sendStatus'](_0x201cac);}return _0x1c7207[_0x6918('0x19')](_0x201cac)[_0x6918('0x1a')]();};}function respondWithResult(_0x53ac64,_0x34f846){_0x34f846=_0x34f846||0xc8;return function(_0x12fbd6){if(_0x12fbd6){return _0x53ac64[_0x6918('0x19')](_0x34f846)[_0x6918('0x1b')](_0x12fbd6);}};}function respondWithFilteredResult(_0x2cf7f6,_0x583408){return function(_0x335af6){if(_0x335af6){var _0x29d801=typeof _0x583408[_0x6918('0x1c')]===_0x6918('0x1d')&&typeof _0x583408[_0x6918('0x1e')]===_0x6918('0x1d');var _0x5d90d2=_0x335af6['count'];var _0x456526=_0x29d801?0x0:_0x583408[_0x6918('0x1c')];var _0x51f315=_0x29d801?_0x335af6[_0x6918('0x1f')]:_0x583408[_0x6918('0x1c')]+_0x583408[_0x6918('0x1e')];var _0x41d7a8;if(_0x51f315>=_0x5d90d2){_0x51f315=_0x5d90d2;_0x41d7a8=0xc8;}else{_0x41d7a8=0xce;}_0x2cf7f6[_0x6918('0x19')](_0x41d7a8);return _0x2cf7f6[_0x6918('0x20')](_0x6918('0x21'),_0x456526+'-'+_0x51f315+'/'+_0x5d90d2)[_0x6918('0x1b')](_0x335af6);}return null;};}function patchUpdates(_0x4d4da3){return function(_0x2b321e){try{jsonpatch[_0x6918('0x22')](_0x2b321e,_0x4d4da3,!![]);}catch(_0x52c781){return BPromise[_0x6918('0x23')](_0x52c781);}return _0x2b321e[_0x6918('0x24')]();};}function saveUpdates(_0x386fac,_0x1b1c5e){return function(_0x4ce06f){if(_0x4ce06f){return _0x4ce06f[_0x6918('0x25')](_0x386fac)['then'](function(_0xc02936){return _0xc02936;});}return null;};}function removeEntity(_0x5ed9fa,_0x24e7da){return function(_0x38a4e7){if(_0x38a4e7){return _0x38a4e7['destroy']()[_0x6918('0x26')](function(){var _0x25e022=_0x38a4e7[_0x6918('0x27')]({'plain':!![]});var _0x5162c0=_0x6918('0x28');return db[_0x6918('0x29')]['destroy']({'where':{'type':_0x5162c0,'resourceId':_0x25e022['id']}})[_0x6918('0x26')](function(){return _0x38a4e7;});})['then'](function(){_0x5ed9fa[_0x6918('0x19')](0xcc)[_0x6918('0x1a')]();});}};}function handleEntityNotFound(_0x38ed49,_0x29ee92){return function(_0x504687){if(!_0x504687){_0x38ed49[_0x6918('0x2a')](0x194);}return _0x504687;};}function handleError(_0x198202,_0x5aa0a9){_0x5aa0a9=_0x5aa0a9||0x1f4;return function(_0x2028d7){logger[_0x6918('0x2b')](_0x2028d7[_0x6918('0x2c')]);if(_0x2028d7[_0x6918('0x2d')]){delete _0x2028d7[_0x6918('0x2d')];}_0x198202[_0x6918('0x19')](_0x5aa0a9)[_0x6918('0x2e')](_0x2028d7);};}exports[_0x6918('0x2f')]=function(_0x3e2088,_0x1af359){var _0x3e8c1e={},_0x519cf9={},_0x538a2e={'count':0x0,'rows':[]};var _0xf41277=_[_0x6918('0x30')](db[_0x6918('0x31')][_0x6918('0x32')],function(_0x479c64){return{'name':_0x479c64[_0x6918('0x33')],'type':_0x479c64['type']['key']};});_0x519cf9[_0x6918('0x34')]=_[_0x6918('0x30')](_0xf41277,'name');_0x519cf9['query']=_[_0x6918('0x35')](_0x3e2088[_0x6918('0x36')]);_0x519cf9[_0x6918('0x37')]=_['intersection'](_0x519cf9[_0x6918('0x34')],_0x519cf9[_0x6918('0x36')]);_0x3e8c1e[_0x6918('0x38')]=_[_0x6918('0x39')](_0x519cf9[_0x6918('0x34')],qs[_0x6918('0x3a')](_0x3e2088[_0x6918('0x36')][_0x6918('0x3a')]));_0x3e8c1e[_0x6918('0x38')]=_0x3e8c1e[_0x6918('0x38')][_0x6918('0x3b')]?_0x3e8c1e[_0x6918('0x38')]:_0x519cf9[_0x6918('0x34')];if(!_0x3e2088[_0x6918('0x36')][_0x6918('0x3c')](_0x6918('0x3d'))){_0x3e8c1e[_0x6918('0x1e')]=qs['limit'](_0x3e2088[_0x6918('0x36')][_0x6918('0x1e')]);_0x3e8c1e['offset']=qs[_0x6918('0x1c')](_0x3e2088[_0x6918('0x36')]['offset']);}_0x3e8c1e[_0x6918('0x3e')]=qs['sort'](_0x3e2088['query'][_0x6918('0x3f')]);_0x3e8c1e[_0x6918('0x40')]=qs[_0x6918('0x37')](_[_0x6918('0x41')](_0x3e2088[_0x6918('0x36')],_0x519cf9[_0x6918('0x37')]),_0xf41277);if(_0x3e2088[_0x6918('0x36')][_0x6918('0x42')]){_0x3e8c1e[_0x6918('0x40')]=_['merge'](_0x3e8c1e[_0x6918('0x40')],{'$or':_[_0x6918('0x30')](_0xf41277,function(_0x3fd91d){if(_0x3fd91d[_0x6918('0x43')]!==_0x6918('0x44')){var _0x4bf916={};_0x4bf916[_0x3fd91d[_0x6918('0x2d')]]={'$like':'%'+_0x3e2088[_0x6918('0x36')]['filter']+'%'};return _0x4bf916;}})});}_0x3e8c1e=_[_0x6918('0x45')]({},_0x3e8c1e,_0x3e2088[_0x6918('0x46')]);var _0x20d789={'where':_0x3e8c1e['where']};return db[_0x6918('0x31')][_0x6918('0x1f')](_0x20d789)[_0x6918('0x26')](function(_0x4a1db7){_0x538a2e[_0x6918('0x1f')]=_0x4a1db7;if(_0x3e2088[_0x6918('0x36')][_0x6918('0x47')]){_0x3e8c1e['include']=[{'all':!![]}];}return db[_0x6918('0x31')][_0x6918('0x48')](_0x3e8c1e);})[_0x6918('0x26')](function(_0x50cc42){_0x538a2e[_0x6918('0x49')]=_0x50cc42;return _0x538a2e;})[_0x6918('0x26')](respondWithFilteredResult(_0x1af359,_0x3e8c1e))['catch'](handleError(_0x1af359,null));};exports['show']=function(_0x160a04,_0x2d61df){var _0x377003={'raw':!![],'where':{'id':_0x160a04[_0x6918('0x4a')]['id']}},_0x54cdf1={};_0x54cdf1[_0x6918('0x34')]=_[_0x6918('0x35')](db['Template'][_0x6918('0x32')]);_0x54cdf1[_0x6918('0x36')]=_[_0x6918('0x35')](_0x160a04[_0x6918('0x36')]);_0x54cdf1[_0x6918('0x37')]=_[_0x6918('0x39')](_0x54cdf1[_0x6918('0x34')],_0x54cdf1[_0x6918('0x36')]);_0x377003[_0x6918('0x38')]=_[_0x6918('0x39')](_0x54cdf1['model'],qs[_0x6918('0x3a')](_0x160a04['query'][_0x6918('0x3a')]));_0x377003[_0x6918('0x38')]=_0x377003['attributes']['length']?_0x377003[_0x6918('0x38')]:_0x54cdf1[_0x6918('0x34')];if(_0x160a04[_0x6918('0x36')][_0x6918('0x47')]){_0x377003[_0x6918('0x4b')]=[{'all':!![]}];}_0x377003=_[_0x6918('0x45')]({},_0x377003,_0x160a04[_0x6918('0x46')]);return db[_0x6918('0x31')][_0x6918('0x4c')](_0x377003)['then'](handleEntityNotFound(_0x2d61df,null))[_0x6918('0x26')](respondWithResult(_0x2d61df,null))[_0x6918('0x4d')](handleError(_0x2d61df,null));};exports[_0x6918('0x4e')]=function(_0xa62da1,_0x5827e6){return db[_0x6918('0x31')][_0x6918('0x4e')](_0xa62da1[_0x6918('0x4f')],{})[_0x6918('0x26')](function(_0x50e005){var _0x1092cb=_0xa62da1[_0x6918('0x50')][_0x6918('0x27')]({'plain':!![]});if(!_0x1092cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1092cb[_0x6918('0x51')]===_0x6918('0x50')){var _0x596ede=_0x50e005[_0x6918('0x27')]({'plain':!![]});var _0xfb1f2f=_0x6918('0x28');return db['UserProfileSection']['find']({'where':{'name':_0xfb1f2f,'userProfileId':_0x1092cb[_0x6918('0x52')]},'raw':!![]})[_0x6918('0x26')](function(_0x3ed3a6){if(_0x3ed3a6&&_0x3ed3a6[_0x6918('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x596ede[_0x6918('0x2d')],'resourceId':_0x596ede['id'],'type':_0x3ed3a6['name'],'sectionId':_0x3ed3a6['id']},{})[_0x6918('0x26')](function(){return _0x50e005;});}else{return _0x50e005;}})[_0x6918('0x4d')](function(_0x541ae0){logger[_0x6918('0x2b')](_0x6918('0x54'),_0x541ae0);throw _0x541ae0;});}return _0x50e005;})[_0x6918('0x26')](respondWithResult(_0x5827e6,0xc9))['catch'](handleError(_0x5827e6,null));};exports[_0x6918('0x25')]=function(_0x3536ec,_0x54c390){if(_0x3536ec['body']['id']){delete _0x3536ec[_0x6918('0x4f')]['id'];}return db['Template'][_0x6918('0x4c')]({'where':{'id':_0x3536ec[_0x6918('0x4a')]['id']}})[_0x6918('0x26')](handleEntityNotFound(_0x54c390,null))[_0x6918('0x26')](saveUpdates(_0x3536ec['body'],null))[_0x6918('0x26')](respondWithResult(_0x54c390,null))[_0x6918('0x4d')](handleError(_0x54c390,null));};exports['destroy']=function(_0x12d28a,_0x5b8b99){return db['Template'][_0x6918('0x4c')]({'where':{'id':_0x12d28a[_0x6918('0x4a')]['id']}})[_0x6918('0x26')](handleEntityNotFound(_0x5b8b99,null))[_0x6918('0x26')](removeEntity(_0x5b8b99,null))[_0x6918('0x4d')](handleError(_0x5b8b99,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8ffa173..9adeaf7 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 _0x5623=['Template','lodash','util','api','moment','request-promise','../../config/environment','./template.attributes','exports','define'];(function(_0x288e13,_0x47dd3a){var _0x225e86=function(_0x390e7d){while(--_0x390e7d){_0x288e13['push'](_0x288e13['shift']());}};_0x225e86(++_0x47dd3a);}(_0x5623,0x15f));var _0x3562=function(_0x2b012e,_0x47d700){_0x2b012e=_0x2b012e-0x0;var _0x55f1f0=_0x5623[_0x2b012e];return _0x55f1f0;};'use strict';var _=require(_0x3562('0x0'));var util=require(_0x3562('0x1'));var logger=require('../../config/logger')(_0x3562('0x2'));var moment=require(_0x3562('0x3'));var BPromise=require('bluebird');var rp=require(_0x3562('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3562('0x5'));var attributes=require(_0x3562('0x6'));module[_0x3562('0x7')]=function(_0x2c947e,_0x39358e){return _0x2c947e[_0x3562('0x8')](_0x3562('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x467d=['api','moment','bluebird','request-promise','./template.attributes','exports','tools_templates','lodash','util','../../config/logger'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0x467d,0xcf));var _0xd467=function(_0x30c2fa,_0x19ca64){_0x30c2fa=_0x30c2fa-0x0;var _0x53c8d1=_0x467d[_0x30c2fa];return _0x53c8d1;};'use strict';var _=require(_0xd467('0x0'));var util=require(_0xd467('0x1'));var logger=require(_0xd467('0x2'))(_0xd467('0x3'));var moment=require(_0xd467('0x4'));var BPromise=require(_0xd467('0x5'));var rp=require(_0xd467('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd467('0x7'));module[_0xd467('0x8')]=function(_0x4360d9,_0x29660f){return _0x4360d9['define']('Template',attributes,{'tableName':_0xd467('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 d33fb97..12549cf 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 _0x7749=['then','GetTemplate','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','Template','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x2cc05b,_0x10af47){var _0x1a1dd3=function(_0x4face3){while(--_0x4face3){_0x2cc05b['push'](_0x2cc05b['shift']());}};_0x1a1dd3(++_0x10af47);}(_0x7749,0x183));var _0x9774=function(_0x2aaac2,_0x313a75){_0x2aaac2=_0x2aaac2-0x0;var _0x5e0a23=_0x7749[_0x2aaac2];return _0x5e0a23;};'use strict';var _=require(_0x9774('0x0'));var util=require(_0x9774('0x1'));var moment=require('moment');var BPromise=require(_0x9774('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9774('0x3'));var logger=require(_0x9774('0x4'))(_0x9774('0x5'));var config=require(_0x9774('0x6'));var jayson=require(_0x9774('0x7'));var client=jayson[_0x9774('0x8')][_0x9774('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xedcf8b,_0x28bdc9,_0x58e114){return new BPromise(function(_0x5ba4b4,_0x3a76c3){return client['request'](_0xedcf8b,_0x58e114)['then'](function(_0x599795){logger[_0x9774('0xa')](_0x9774('0xb'),_0x28bdc9,'request\x20sent');logger[_0x9774('0xc')](_0x9774('0xd'),_0x28bdc9,_0x9774('0xe'),JSON[_0x9774('0xf')](_0x599795));if(_0x599795[_0x9774('0x10')]){if(_0x599795['error']['code']===0x1f4){logger[_0x9774('0x10')]('Template,\x20%s,\x20%s',_0x28bdc9,_0x599795[_0x9774('0x10')][_0x9774('0x11')]);return _0x3a76c3(_0x599795[_0x9774('0x10')]['message']);}logger[_0x9774('0x10')]('Template,\x20%s,\x20%s',_0x28bdc9,_0x599795[_0x9774('0x10')][_0x9774('0x11')]);return _0x5ba4b4(_0x599795[_0x9774('0x10')][_0x9774('0x11')]);}else{logger['info'](_0x9774('0xb'),_0x28bdc9,_0x9774('0xe'));_0x5ba4b4(_0x599795[_0x9774('0x12')][_0x9774('0x11')]);}})['catch'](function(_0x29dcbf){logger[_0x9774('0x10')](_0x9774('0xb'),_0x28bdc9,_0x29dcbf);_0x3a76c3(_0x29dcbf);});});}exports['GetTemplate']=function(_0x12a2ff){var _0x3a801d=this;return new Promise(function(_0x3960cd,_0x166f8e){return db[_0x9774('0x13')][_0x9774('0x14')]({'raw':_0x12a2ff[_0x9774('0x15')]?_0x12a2ff['options'][_0x9774('0x16')]===undefined?!![]:![]:!![],'where':_0x12a2ff['options']?_0x12a2ff[_0x9774('0x15')][_0x9774('0x17')]||null:null,'attributes':_0x12a2ff['options']?_0x12a2ff[_0x9774('0x15')][_0x9774('0x18')]||null:null,'limit':_0x12a2ff['options']?_0x12a2ff['options'][_0x9774('0x19')]||null:null,'include':_0x12a2ff[_0x9774('0x15')]?_0x12a2ff['options'][_0x9774('0x1a')]?_[_0x9774('0x1b')](_0x12a2ff[_0x9774('0x15')]['include'],function(_0x1ffb57){return{'model':db[_0x1ffb57[_0x9774('0x1c')]],'as':_0x1ffb57['as'],'attributes':_0x1ffb57[_0x9774('0x18')],'include':_0x1ffb57['include']?_['map'](_0x1ffb57[_0x9774('0x1a')],function(_0x5a3cdc){return{'model':db[_0x5a3cdc[_0x9774('0x1c')]],'as':_0x5a3cdc['as'],'attributes':_0x5a3cdc[_0x9774('0x18')],'include':_0x5a3cdc[_0x9774('0x1a')]?_['map'](_0x5a3cdc[_0x9774('0x1a')],function(_0x220305){return{'model':db[_0x220305['model']],'as':_0x220305['as'],'attributes':_0x220305[_0x9774('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9774('0x1d')](function(_0x1d1d6d){logger[_0x9774('0xa')](_0x9774('0x1e'),_0x12a2ff);logger[_0x9774('0xc')](_0x9774('0x1e'),_0x12a2ff,JSON[_0x9774('0xf')](_0x1d1d6d));_0x3960cd(_0x1d1d6d);})[_0x9774('0x1f')](function(_0x4b86c9){logger['error'](_0x9774('0x1e'),_0x4b86c9[_0x9774('0x11')],_0x12a2ff);_0x166f8e(_0x3a801d[_0x9774('0x10')](0x1f4,_0x4b86c9['message']));});});}; \ No newline at end of file +var _0x128c=['debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','then','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent'];(function(_0x1f8e67,_0x274515){var _0x3b79a0=function(_0x7107f8){while(--_0x7107f8){_0x1f8e67['push'](_0x1f8e67['shift']());}};_0x3b79a0(++_0x274515);}(_0x128c,0x168));var _0xc128=function(_0x1843f7,_0x263aea){_0x1843f7=_0x1843f7-0x0;var _0x3834bd=_0x128c[_0x1843f7];return _0x3834bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc128('0x0'));var BPromise=require('bluebird');var rs=require(_0xc128('0x1'));var fs=require('fs');var Redis=require(_0xc128('0x2'));var db=require(_0xc128('0x3'))['db'];var utils=require(_0xc128('0x4'));var logger=require(_0xc128('0x5'))('rpc');var config=require(_0xc128('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc128('0x7')][_0xc128('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdb97df,_0x12365d,_0x2524f0){return new BPromise(function(_0x2c9989,_0x527492){return client[_0xc128('0x9')](_0xdb97df,_0x2524f0)['then'](function(_0xa8ef5e){logger[_0xc128('0xa')]('Template,\x20%s,\x20%s',_0x12365d,_0xc128('0xb'));logger[_0xc128('0xc')](_0xc128('0xd'),_0x12365d,_0xc128('0xb'),JSON[_0xc128('0xe')](_0xa8ef5e));if(_0xa8ef5e['error']){if(_0xa8ef5e[_0xc128('0xf')][_0xc128('0x10')]===0x1f4){logger[_0xc128('0xf')](_0xc128('0x11'),_0x12365d,_0xa8ef5e[_0xc128('0xf')][_0xc128('0x12')]);return _0x527492(_0xa8ef5e[_0xc128('0xf')][_0xc128('0x12')]);}logger[_0xc128('0xf')]('Template,\x20%s,\x20%s',_0x12365d,_0xa8ef5e[_0xc128('0xf')][_0xc128('0x12')]);return _0x2c9989(_0xa8ef5e[_0xc128('0xf')]['message']);}else{logger[_0xc128('0xa')](_0xc128('0x11'),_0x12365d,_0xc128('0xb'));_0x2c9989(_0xa8ef5e[_0xc128('0x13')][_0xc128('0x12')]);}})[_0xc128('0x14')](function(_0x401ca2){logger[_0xc128('0xf')]('Template,\x20%s,\x20%s',_0x12365d,_0x401ca2);_0x527492(_0x401ca2);});});}exports[_0xc128('0x15')]=function(_0x2bcca8){var _0x5d03e1=this;return new Promise(function(_0x8fd14,_0x5abc28){return db['Template'][_0xc128('0x16')]({'raw':_0x2bcca8[_0xc128('0x17')]?_0x2bcca8[_0xc128('0x17')][_0xc128('0x18')]===undefined?!![]:![]:!![],'where':_0x2bcca8[_0xc128('0x17')]?_0x2bcca8[_0xc128('0x17')][_0xc128('0x19')]||null:null,'attributes':_0x2bcca8[_0xc128('0x17')]?_0x2bcca8[_0xc128('0x17')][_0xc128('0x1a')]||null:null,'limit':_0x2bcca8[_0xc128('0x17')]?_0x2bcca8['options'][_0xc128('0x1b')]||null:null,'include':_0x2bcca8[_0xc128('0x17')]?_0x2bcca8[_0xc128('0x17')][_0xc128('0x1c')]?_[_0xc128('0x1d')](_0x2bcca8[_0xc128('0x17')][_0xc128('0x1c')],function(_0x26c2a4){return{'model':db[_0x26c2a4['model']],'as':_0x26c2a4['as'],'attributes':_0x26c2a4['attributes'],'include':_0x26c2a4['include']?_[_0xc128('0x1d')](_0x26c2a4[_0xc128('0x1c')],function(_0x19aea5){return{'model':db[_0x19aea5['model']],'as':_0x19aea5['as'],'attributes':_0x19aea5[_0xc128('0x1a')],'include':_0x19aea5[_0xc128('0x1c')]?_['map'](_0x19aea5[_0xc128('0x1c')],function(_0x53dbe8){return{'model':db[_0x53dbe8['model']],'as':_0x53dbe8['as'],'attributes':_0x53dbe8[_0xc128('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc128('0x1e')](function(_0x2217a8){logger['info'](_0xc128('0x15'),_0x2bcca8);logger[_0xc128('0xc')]('GetTemplate',_0x2bcca8,JSON[_0xc128('0xe')](_0x2217a8));_0x8fd14(_0x2217a8);})[_0xc128('0x14')](function(_0x446acc){logger[_0xc128('0xf')](_0xc128('0x15'),_0x446acc[_0xc128('0x12')],_0x2bcca8);_0x5abc28(_0x5d03e1[_0xc128('0xf')](0x1f4,_0x446acc[_0xc128('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index d58c5f5..b8708ed 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 _0xebc0=['isAuthenticated','show','getAllConditions','get','/:id/any_conditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xebc0,0xe5));var _0x0ebc=function(_0x49d848,_0x450be6){_0x49d848=_0x49d848-0x0;var _0x5349e4=_0xebc0[_0x49d848];return _0x5349e4;};'use strict';var multer=require(_0x0ebc('0x0'));var util=require(_0x0ebc('0x1'));var path=require(_0x0ebc('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ebc('0x3'));var router=express[_0x0ebc('0x4')]();var fs_extra=require(_0x0ebc('0x5'));var auth=require(_0x0ebc('0x6'));var interaction=require(_0x0ebc('0x7'));var config=require(_0x0ebc('0x8'));var controller=require(_0x0ebc('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0ebc('0xa')]);router['get']('/:id',auth[_0x0ebc('0xb')](),controller[_0x0ebc('0xc')]);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x0ebc('0xd')]);router[_0x0ebc('0xe')](_0x0ebc('0xf'),auth[_0x0ebc('0xb')](),controller['getAnyConditions']);router[_0x0ebc('0xe')](_0x0ebc('0x10'),auth[_0x0ebc('0xb')](),controller[_0x0ebc('0x11')]);router[_0x0ebc('0x12')]('/',auth[_0x0ebc('0xb')](),controller[_0x0ebc('0x13')]);router[_0x0ebc('0x12')](_0x0ebc('0x14'),auth[_0x0ebc('0xb')](),controller[_0x0ebc('0x15')]);router[_0x0ebc('0x12')]('/:id/any_conditions',auth[_0x0ebc('0xb')](),controller[_0x0ebc('0x16')]);router[_0x0ebc('0x12')](_0x0ebc('0x10'),auth[_0x0ebc('0xb')](),controller[_0x0ebc('0x17')]);router[_0x0ebc('0x18')](_0x0ebc('0x19'),auth[_0x0ebc('0xb')](),controller[_0x0ebc('0x1a')]);router[_0x0ebc('0x1b')](_0x0ebc('0x19'),auth['isAuthenticated'](),controller[_0x0ebc('0x1c')]);module[_0x0ebc('0x1d')]=router; \ No newline at end of file +var _0x1477=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id/all_conditions','/:id/any_conditions','getActions','create','addAllCondition','post','/:id/actions','addAction','put','/:id'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1477,0x122));var _0x7147=function(_0x559b2d,_0x23c7b2){_0x559b2d=_0x559b2d-0x0;var _0x2c4553=_0x1477[_0x559b2d];return _0x2c4553;};'use strict';var multer=require(_0x7147('0x0'));var util=require(_0x7147('0x1'));var path=require(_0x7147('0x2'));var timeout=require(_0x7147('0x3'));var express=require(_0x7147('0x4'));var router=express['Router']();var fs_extra=require(_0x7147('0x5'));var auth=require(_0x7147('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7147('0x7'));var controller=require(_0x7147('0x8'));router[_0x7147('0x9')]('/',auth[_0x7147('0xa')](),controller[_0x7147('0xb')]);router[_0x7147('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x7147('0xc'),auth[_0x7147('0xa')](),controller['getAllConditions']);router[_0x7147('0x9')](_0x7147('0xd'),auth[_0x7147('0xa')](),controller['getAnyConditions']);router[_0x7147('0x9')]('/:id/actions',auth['isAuthenticated'](),controller[_0x7147('0xe')]);router['post']('/',auth[_0x7147('0xa')](),controller[_0x7147('0xf')]);router['post']('/:id/all_conditions',auth[_0x7147('0xa')](),controller[_0x7147('0x10')]);router[_0x7147('0x11')](_0x7147('0xd'),auth[_0x7147('0xa')](),controller['addAnyCondition']);router[_0x7147('0x11')](_0x7147('0x12'),auth[_0x7147('0xa')](),controller[_0x7147('0x13')]);router[_0x7147('0x14')](_0x7147('0x15'),auth[_0x7147('0xa')](),controller['update']);router[_0x7147('0x16')](_0x7147('0x15'),auth[_0x7147('0xa')](),controller['destroy']);module[_0x7147('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 69cefb0..3831c8d 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 _0x4569=['BOOLEAN','sequelize','exports','STRING'];(function(_0x30fb21,_0x5bd7eb){var _0x3a7aab=function(_0x1a45ee){while(--_0x1a45ee){_0x30fb21['push'](_0x30fb21['shift']());}};_0x3a7aab(++_0x5bd7eb);}(_0x4569,0xed));var _0x9456=function(_0x182277,_0x3f1d29){_0x182277=_0x182277-0x0;var _0x283c7b=_0x4569[_0x182277];return _0x283c7b;};'use strict';var Sequelize=require(_0x9456('0x0'));module[_0x9456('0x1')]={'name':{'type':Sequelize[_0x9456('0x2')]},'channel':{'type':Sequelize[_0x9456('0x2')]},'description':{'type':Sequelize[_0x9456('0x2')]},'status':{'type':Sequelize[_0x9456('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc340=['STRING','exports'];(function(_0x47f545,_0x162485){var _0x370fe3=function(_0x45c9e3){while(--_0x45c9e3){_0x47f545['push'](_0x47f545['shift']());}};_0x370fe3(++_0x162485);}(_0xc340,0x9b));var _0x0c34=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc340[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x0c34('0x0')]={'name':{'type':Sequelize[_0x0c34('0x1')]},'channel':{'type':Sequelize[_0x0c34('0x1')]},'description':{'type':Sequelize[_0x0c34('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 52f0a0c..6bf78a6 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 _0xa1c4=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','addAction','Action','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Trigger','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation'];(function(_0x5d4490,_0x4a96e7){var _0x3bb882=function(_0x143f32){while(--_0x143f32){_0x5d4490['push'](_0x5d4490['shift']());}};_0x3bb882(++_0x4a96e7);}(_0xa1c4,0x1f2));var _0x4a1c=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0xa1c4[_0x50bf5a];return _0x4ddc1d;};'use strict';var emlformat=require(_0x4a1c('0x0'));var rimraf=require(_0x4a1c('0x1'));var zipdir=require(_0x4a1c('0x2'));var jsonpatch=require(_0x4a1c('0x3'));var rp=require('request-promise');var moment=require(_0x4a1c('0x4'));var BPromise=require(_0x4a1c('0x5'));var Mustache=require(_0x4a1c('0x6'));var util=require('util');var path=require(_0x4a1c('0x7'));var sox=require(_0x4a1c('0x8'));var csv=require('to-csv');var ejs=require(_0x4a1c('0x9'));var fs=require('fs');var fs_extra=require(_0x4a1c('0xa'));var _=require(_0x4a1c('0xb'));var squel=require(_0x4a1c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4a1c('0xd'));var toCsv=require(_0x4a1c('0xe'));var querystring=require(_0x4a1c('0xf'));var Papa=require(_0x4a1c('0x10'));var Redis=require(_0x4a1c('0x11'));var authService=require(_0x4a1c('0x12'));var qs=require(_0x4a1c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a1c('0x14'));var logger=require(_0x4a1c('0x15'))(_0x4a1c('0x16'));var utils=require(_0x4a1c('0x17'));var config=require(_0x4a1c('0x18'));var licenseUtil=require(_0x4a1c('0x19'));var db=require(_0x4a1c('0x1a'))['db'];function respondWithStatusCode(_0x19e537,_0x33ad2a){_0x33ad2a=_0x33ad2a||0xcc;return function(_0x2e772d){if(_0x2e772d){return _0x19e537[_0x4a1c('0x1b')](_0x33ad2a);}return _0x19e537[_0x4a1c('0x1c')](_0x33ad2a)[_0x4a1c('0x1d')]();};}function respondWithResult(_0x285643,_0x3f94d7){_0x3f94d7=_0x3f94d7||0xc8;return function(_0x1ae076){if(_0x1ae076){return _0x285643[_0x4a1c('0x1c')](_0x3f94d7)[_0x4a1c('0x1e')](_0x1ae076);}};}function respondWithFilteredResult(_0x482c8e,_0x3358f0){return function(_0x1baf17){if(_0x1baf17){var _0x528d8b=typeof _0x3358f0['offset']===_0x4a1c('0x1f')&&typeof _0x3358f0[_0x4a1c('0x20')]===_0x4a1c('0x1f');var _0xbede00=_0x1baf17[_0x4a1c('0x21')];var _0x5ccf91=_0x528d8b?0x0:_0x3358f0[_0x4a1c('0x22')];var _0x547efe=_0x528d8b?_0x1baf17['count']:_0x3358f0[_0x4a1c('0x22')]+_0x3358f0[_0x4a1c('0x20')];var _0x1590ab;if(_0x547efe>=_0xbede00){_0x547efe=_0xbede00;_0x1590ab=0xc8;}else{_0x1590ab=0xce;}_0x482c8e[_0x4a1c('0x1c')](_0x1590ab);return _0x482c8e[_0x4a1c('0x23')](_0x4a1c('0x24'),_0x5ccf91+'-'+_0x547efe+'/'+_0xbede00)[_0x4a1c('0x1e')](_0x1baf17);}return null;};}function patchUpdates(_0x9aad64){return function(_0x3a5fe9){try{jsonpatch['apply'](_0x3a5fe9,_0x9aad64,!![]);}catch(_0x55e558){return BPromise[_0x4a1c('0x25')](_0x55e558);}return _0x3a5fe9[_0x4a1c('0x26')]();};}function saveUpdates(_0x158c99,_0x34c02d){return function(_0x464803){if(_0x464803){return _0x464803[_0x4a1c('0x27')](_0x158c99)[_0x4a1c('0x28')](function(_0x4d43fc){return _0x4d43fc;});}return null;};}function removeEntity(_0xa8b543,_0x44ed5c){return function(_0x560282){if(_0x560282){return _0x560282[_0x4a1c('0x29')]()[_0x4a1c('0x28')](function(){var _0x2ac582=_0x560282[_0x4a1c('0x2a')]({'plain':!![]});var _0x56138b='Triggers';return db[_0x4a1c('0x2b')][_0x4a1c('0x29')]({'where':{'type':_0x56138b,'resourceId':_0x2ac582['id']}})[_0x4a1c('0x28')](function(){return _0x560282;});})['then'](function(){_0xa8b543['status'](0xcc)[_0x4a1c('0x1d')]();});}};}function handleEntityNotFound(_0x16878a,_0x17d015){return function(_0x8e5fe0){if(!_0x8e5fe0){_0x16878a[_0x4a1c('0x1b')](0x194);}return _0x8e5fe0;};}function handleError(_0x19c199,_0x2c83a6){_0x2c83a6=_0x2c83a6||0x1f4;return function(_0x1f11bb){logger[_0x4a1c('0x2c')](_0x1f11bb['stack']);if(_0x1f11bb[_0x4a1c('0x2d')]){delete _0x1f11bb[_0x4a1c('0x2d')];}_0x19c199[_0x4a1c('0x1c')](_0x2c83a6)[_0x4a1c('0x2e')](_0x1f11bb);};}exports[_0x4a1c('0x2f')]=function(_0x231bc7,_0x1299dc){var _0x47abf4={},_0x466c0d={},_0x101b7a={'count':0x0,'rows':[]};var _0x47bd96=_[_0x4a1c('0x30')](db[_0x4a1c('0x31')]['rawAttributes'],function(_0x53a541){return{'name':_0x53a541[_0x4a1c('0x32')],'type':_0x53a541[_0x4a1c('0x33')][_0x4a1c('0x34')]};});_0x466c0d[_0x4a1c('0x35')]=_[_0x4a1c('0x30')](_0x47bd96,_0x4a1c('0x2d'));_0x466c0d[_0x4a1c('0x36')]=_[_0x4a1c('0x37')](_0x231bc7[_0x4a1c('0x36')]);_0x466c0d['filters']=_[_0x4a1c('0x38')](_0x466c0d['model'],_0x466c0d[_0x4a1c('0x36')]);_0x47abf4[_0x4a1c('0x39')]=_[_0x4a1c('0x38')](_0x466c0d[_0x4a1c('0x35')],qs['fields'](_0x231bc7[_0x4a1c('0x36')]['fields']));_0x47abf4[_0x4a1c('0x39')]=_0x47abf4['attributes'][_0x4a1c('0x3a')]?_0x47abf4[_0x4a1c('0x39')]:_0x466c0d['model'];if(!_0x231bc7[_0x4a1c('0x36')]['hasOwnProperty'](_0x4a1c('0x3b'))){_0x47abf4[_0x4a1c('0x20')]=qs[_0x4a1c('0x20')](_0x231bc7['query'][_0x4a1c('0x20')]);_0x47abf4[_0x4a1c('0x22')]=qs[_0x4a1c('0x22')](_0x231bc7['query'][_0x4a1c('0x22')]);}_0x47abf4[_0x4a1c('0x3c')]=qs[_0x4a1c('0x3d')](_0x231bc7[_0x4a1c('0x36')][_0x4a1c('0x3d')]);_0x47abf4['where']=qs[_0x4a1c('0x3e')](_[_0x4a1c('0x3f')](_0x231bc7[_0x4a1c('0x36')],_0x466c0d[_0x4a1c('0x3e')]),_0x47bd96);if(_0x231bc7[_0x4a1c('0x36')][_0x4a1c('0x40')]){_0x47abf4[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x47abf4['where'],{'$or':_[_0x4a1c('0x30')](_0x47bd96,function(_0x2f36a8){if(_0x2f36a8[_0x4a1c('0x33')]!==_0x4a1c('0x43')){var _0x3b3264={};_0x3b3264[_0x2f36a8[_0x4a1c('0x2d')]]={'$like':'%'+_0x231bc7[_0x4a1c('0x36')][_0x4a1c('0x40')]+'%'};return _0x3b3264;}})});}_0x47abf4=_[_0x4a1c('0x42')]({},_0x47abf4,_0x231bc7[_0x4a1c('0x44')]);var _0x34392f={'where':_0x47abf4['where']};return db['Trigger']['count'](_0x34392f)['then'](function(_0x1ef6a6){_0x101b7a[_0x4a1c('0x21')]=_0x1ef6a6;if(_0x231bc7[_0x4a1c('0x36')][_0x4a1c('0x45')]){_0x47abf4[_0x4a1c('0x46')]=[{'all':!![]}];}return db[_0x4a1c('0x31')]['findAll'](_0x47abf4);})['then'](function(_0x4a37a5){_0x101b7a[_0x4a1c('0x47')]=_0x4a37a5;return _0x101b7a;})[_0x4a1c('0x28')](respondWithFilteredResult(_0x1299dc,_0x47abf4))[_0x4a1c('0x48')](handleError(_0x1299dc,null));};exports[_0x4a1c('0x49')]=function(_0x2635bb,_0x2641e1){var _0x1d917b={'raw':![],'where':{'id':_0x2635bb[_0x4a1c('0x4a')]['id']}},_0x34d8bc={};_0x34d8bc['model']=_[_0x4a1c('0x37')](db[_0x4a1c('0x31')][_0x4a1c('0x4b')]);_0x34d8bc['query']=_['keys'](_0x2635bb[_0x4a1c('0x36')]);_0x34d8bc[_0x4a1c('0x3e')]=_['intersection'](_0x34d8bc[_0x4a1c('0x35')],_0x34d8bc[_0x4a1c('0x36')]);_0x1d917b[_0x4a1c('0x39')]=_[_0x4a1c('0x38')](_0x34d8bc[_0x4a1c('0x35')],qs[_0x4a1c('0x4c')](_0x2635bb[_0x4a1c('0x36')][_0x4a1c('0x4c')]));_0x1d917b[_0x4a1c('0x39')]=_0x1d917b[_0x4a1c('0x39')][_0x4a1c('0x3a')]?_0x1d917b[_0x4a1c('0x39')]:_0x34d8bc[_0x4a1c('0x35')];if(_0x2635bb[_0x4a1c('0x36')][_0x4a1c('0x45')]){_0x1d917b[_0x4a1c('0x46')]=[{'all':!![]}];}_0x1d917b=_[_0x4a1c('0x42')]({},_0x1d917b,_0x2635bb['options']);return db[_0x4a1c('0x31')]['find'](_0x1d917b)['then'](handleEntityNotFound(_0x2641e1,null))[_0x4a1c('0x28')](respondWithResult(_0x2641e1,null))[_0x4a1c('0x48')](handleError(_0x2641e1,null));};exports[_0x4a1c('0x4d')]=function(_0x4273d9,_0x172770){return db[_0x4a1c('0x31')][_0x4a1c('0x4d')](_0x4273d9['body'],{})[_0x4a1c('0x28')](function(_0x5ca419){var _0x3620aa=_0x4273d9[_0x4a1c('0x4e')][_0x4a1c('0x2a')]({'plain':!![]});if(!_0x3620aa)throw new Error(_0x4a1c('0x4f'));if(_0x3620aa[_0x4a1c('0x50')]===_0x4a1c('0x4e')){var _0x297898=_0x5ca419[_0x4a1c('0x2a')]({'plain':!![]});var _0x3bddef='Triggers';return db['UserProfileSection'][_0x4a1c('0x51')]({'where':{'name':_0x3bddef,'userProfileId':_0x3620aa[_0x4a1c('0x52')]},'raw':!![]})['then'](function(_0x5b07d6){if(_0x5b07d6&&_0x5b07d6[_0x4a1c('0x53')]===0x0){return db[_0x4a1c('0x2b')][_0x4a1c('0x4d')]({'name':_0x297898['name'],'resourceId':_0x297898['id'],'type':_0x5b07d6[_0x4a1c('0x2d')],'sectionId':_0x5b07d6['id']},{})[_0x4a1c('0x28')](function(){return _0x5ca419;});}else{return _0x5ca419;}})[_0x4a1c('0x48')](function(_0x1223eb){logger['error'](_0x4a1c('0x54'),_0x1223eb);throw _0x1223eb;});}return _0x5ca419;})[_0x4a1c('0x28')](respondWithResult(_0x172770,0xc9))[_0x4a1c('0x48')](handleError(_0x172770,null));};exports['update']=function(_0x2b58f1,_0x3443de){if(_0x2b58f1['body']['id']){delete _0x2b58f1[_0x4a1c('0x55')]['id'];}return db['Trigger'][_0x4a1c('0x51')]({'where':{'id':_0x2b58f1['params']['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x3443de,null))[_0x4a1c('0x28')](saveUpdates(_0x2b58f1[_0x4a1c('0x55')],null))[_0x4a1c('0x28')](respondWithResult(_0x3443de,null))[_0x4a1c('0x48')](handleError(_0x3443de,null));};exports[_0x4a1c('0x29')]=function(_0x14d5dc,_0x54d05c){return db[_0x4a1c('0x31')][_0x4a1c('0x51')]({'where':{'id':_0x14d5dc[_0x4a1c('0x4a')]['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x54d05c,null))[_0x4a1c('0x28')](removeEntity(_0x54d05c,null))[_0x4a1c('0x48')](handleError(_0x54d05c,null));};exports[_0x4a1c('0x56')]=function(_0x5dd279,_0x2405e8,_0x32ab10){if(_0x5dd279[_0x4a1c('0x55')]['id']){delete _0x5dd279[_0x4a1c('0x55')]['id'];}return db['Trigger'][_0x4a1c('0x51')]({'where':{'id':_0x5dd279[_0x4a1c('0x4a')]['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x2405e8,null))[_0x4a1c('0x28')](function(_0x462983){if(_0x462983){_0x5dd279['body'][_0x4a1c('0x57')]=_0x462983['id'];return db[_0x4a1c('0x58')][_0x4a1c('0x4d')](_0x5dd279['body']);}})[_0x4a1c('0x28')](respondWithResult(_0x2405e8,null))[_0x4a1c('0x48')](handleError(_0x2405e8,null));};exports['addAnyCondition']=function(_0x1315df,_0x446b35,_0x13e058){if(_0x1315df[_0x4a1c('0x55')]['id']){delete _0x1315df['body']['id'];}return db[_0x4a1c('0x31')][_0x4a1c('0x51')]({'where':{'id':_0x1315df[_0x4a1c('0x4a')]['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x446b35,null))[_0x4a1c('0x28')](function(_0x108642){if(_0x108642){_0x1315df[_0x4a1c('0x55')][_0x4a1c('0x59')]=_0x108642['id'];return db[_0x4a1c('0x58')][_0x4a1c('0x4d')](_0x1315df[_0x4a1c('0x55')]);}})['then'](respondWithResult(_0x446b35,null))['catch'](handleError(_0x446b35,null));};exports['getAllConditions']=function(_0xdfc5ae,_0x1c7181,_0x5dacb4){var _0x210cf5={};var _0x13cb2c={};var _0x3253d9;var _0x35e7a5;return db['Trigger'][_0x4a1c('0x5a')]({'where':{'id':_0xdfc5ae[_0x4a1c('0x4a')]['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x1c7181,null))[_0x4a1c('0x28')](function(_0x2b7147){if(_0x2b7147){_0x3253d9=_0x2b7147;_0x13cb2c[_0x4a1c('0x35')]=_[_0x4a1c('0x37')](db['Condition'][_0x4a1c('0x4b')]);_0x13cb2c['query']=_[_0x4a1c('0x37')](_0xdfc5ae[_0x4a1c('0x36')]);_0x13cb2c[_0x4a1c('0x3e')]=_[_0x4a1c('0x38')](_0x13cb2c[_0x4a1c('0x35')],_0x13cb2c[_0x4a1c('0x36')]);_0x210cf5[_0x4a1c('0x39')]=_[_0x4a1c('0x38')](_0x13cb2c[_0x4a1c('0x35')],qs[_0x4a1c('0x4c')](_0xdfc5ae[_0x4a1c('0x36')][_0x4a1c('0x4c')]));_0x210cf5[_0x4a1c('0x39')]=_0x210cf5[_0x4a1c('0x39')][_0x4a1c('0x3a')]?_0x210cf5[_0x4a1c('0x39')]:_0x13cb2c['model'];_0x210cf5['order']=qs[_0x4a1c('0x3d')](_0xdfc5ae[_0x4a1c('0x36')]['sort']);_0x210cf5['where']=qs['filters'](_[_0x4a1c('0x3f')](_0xdfc5ae['query'],_0x13cb2c[_0x4a1c('0x3e')]));if(_0xdfc5ae[_0x4a1c('0x36')][_0x4a1c('0x40')]){_0x210cf5[_0x4a1c('0x41')]=_['merge'](_0x210cf5[_0x4a1c('0x41')],{'$or':_['map'](_0x210cf5['attributes'],function(_0x373088){var _0x44fa00={};_0x44fa00[_0x373088]={'$like':'%'+_0xdfc5ae[_0x4a1c('0x36')][_0x4a1c('0x40')]+'%'};return _0x44fa00;})});}_0x210cf5=_[_0x4a1c('0x42')]({},_0x210cf5,_0xdfc5ae[_0x4a1c('0x44')]);return _0x3253d9[_0x4a1c('0x5b')](_0x210cf5);}})[_0x4a1c('0x28')](function(_0x269bcc){if(_0x269bcc){_0x35e7a5=_0x269bcc[_0x4a1c('0x3a')];if(!_0xdfc5ae[_0x4a1c('0x36')]['hasOwnProperty']('nolimit')){_0x210cf5[_0x4a1c('0x20')]=qs['limit'](_0xdfc5ae[_0x4a1c('0x36')][_0x4a1c('0x20')]);_0x210cf5[_0x4a1c('0x22')]=qs[_0x4a1c('0x22')](_0xdfc5ae[_0x4a1c('0x36')]['offset']);}return _0x3253d9[_0x4a1c('0x5b')](_0x210cf5);}})[_0x4a1c('0x28')](function(_0x26835c){if(_0x26835c){return _0x26835c?{'count':_0x35e7a5,'rows':_0x26835c}:null;}})[_0x4a1c('0x28')](respondWithResult(_0x1c7181,null))[_0x4a1c('0x48')](handleError(_0x1c7181,null));};exports[_0x4a1c('0x5c')]=function(_0x4efb0b,_0x220f84,_0x42b218){var _0x522695={};var _0x22ffd0={};var _0x5e1550;var _0x54d4e0;return db[_0x4a1c('0x31')][_0x4a1c('0x5a')]({'where':{'id':_0x4efb0b['params']['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x220f84,null))[_0x4a1c('0x28')](function(_0x276c06){if(_0x276c06){_0x5e1550=_0x276c06;_0x22ffd0[_0x4a1c('0x35')]=_[_0x4a1c('0x37')](db[_0x4a1c('0x58')][_0x4a1c('0x4b')]);_0x22ffd0[_0x4a1c('0x36')]=_['keys'](_0x4efb0b[_0x4a1c('0x36')]);_0x22ffd0[_0x4a1c('0x3e')]=_[_0x4a1c('0x38')](_0x22ffd0[_0x4a1c('0x35')],_0x22ffd0['query']);_0x522695[_0x4a1c('0x39')]=_[_0x4a1c('0x38')](_0x22ffd0[_0x4a1c('0x35')],qs[_0x4a1c('0x4c')](_0x4efb0b[_0x4a1c('0x36')][_0x4a1c('0x4c')]));_0x522695[_0x4a1c('0x39')]=_0x522695['attributes']['length']?_0x522695[_0x4a1c('0x39')]:_0x22ffd0[_0x4a1c('0x35')];_0x522695[_0x4a1c('0x3c')]=qs[_0x4a1c('0x3d')](_0x4efb0b[_0x4a1c('0x36')][_0x4a1c('0x3d')]);_0x522695[_0x4a1c('0x41')]=qs[_0x4a1c('0x3e')](_[_0x4a1c('0x3f')](_0x4efb0b['query'],_0x22ffd0['filters']));if(_0x4efb0b[_0x4a1c('0x36')][_0x4a1c('0x40')]){_0x522695[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x522695[_0x4a1c('0x41')],{'$or':_[_0x4a1c('0x30')](_0x522695[_0x4a1c('0x39')],function(_0xf07095){var _0x3cd749={};_0x3cd749[_0xf07095]={'$like':'%'+_0x4efb0b[_0x4a1c('0x36')][_0x4a1c('0x40')]+'%'};return _0x3cd749;})});}_0x522695=_['merge']({},_0x522695,_0x4efb0b[_0x4a1c('0x44')]);return _0x5e1550[_0x4a1c('0x5c')](_0x522695);}})[_0x4a1c('0x28')](function(_0x267f84){if(_0x267f84){_0x54d4e0=_0x267f84[_0x4a1c('0x3a')];if(!_0x4efb0b[_0x4a1c('0x36')]['hasOwnProperty'](_0x4a1c('0x3b'))){_0x522695[_0x4a1c('0x20')]=qs[_0x4a1c('0x20')](_0x4efb0b[_0x4a1c('0x36')][_0x4a1c('0x20')]);_0x522695['offset']=qs[_0x4a1c('0x22')](_0x4efb0b['query']['offset']);}return _0x5e1550['getAnyConditions'](_0x522695);}})[_0x4a1c('0x28')](function(_0x22ec1d){if(_0x22ec1d){return _0x22ec1d?{'count':_0x54d4e0,'rows':_0x22ec1d}:null;}})[_0x4a1c('0x28')](respondWithResult(_0x220f84,null))[_0x4a1c('0x48')](handleError(_0x220f84,null));};exports[_0x4a1c('0x5d')]=function(_0x2b3dc7,_0x5c056e,_0x5b97f9){if(_0x2b3dc7[_0x4a1c('0x55')]['id']){delete _0x2b3dc7[_0x4a1c('0x55')]['id'];}return db[_0x4a1c('0x31')]['find']({'where':{'id':_0x2b3dc7[_0x4a1c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c056e,null))[_0x4a1c('0x28')](function(_0x45f468){if(_0x45f468){_0x2b3dc7[_0x4a1c('0x55')]['TriggerId']=_0x45f468['id'];return db[_0x4a1c('0x5e')]['create'](_0x2b3dc7[_0x4a1c('0x55')]);}})['then'](respondWithResult(_0x5c056e,null))['catch'](handleError(_0x5c056e,null));};exports[_0x4a1c('0x5f')]=function(_0x26aa78,_0x525534,_0x35fbc4){var _0x4cc510={};var _0x3a6cf9={};var _0x57c9b9;var _0x59c470;return db['Trigger']['findOne']({'where':{'id':_0x26aa78['params']['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x525534,null))['then'](function(_0x19384d){if(_0x19384d){_0x57c9b9=_0x19384d;_0x3a6cf9[_0x4a1c('0x35')]=_[_0x4a1c('0x37')](db[_0x4a1c('0x5e')][_0x4a1c('0x4b')]);_0x3a6cf9[_0x4a1c('0x36')]=_[_0x4a1c('0x37')](_0x26aa78[_0x4a1c('0x36')]);_0x3a6cf9[_0x4a1c('0x3e')]=_[_0x4a1c('0x38')](_0x3a6cf9[_0x4a1c('0x35')],_0x3a6cf9['query']);_0x4cc510[_0x4a1c('0x39')]=_[_0x4a1c('0x38')](_0x3a6cf9['model'],qs[_0x4a1c('0x4c')](_0x26aa78['query']['fields']));_0x4cc510[_0x4a1c('0x39')]=_0x4cc510[_0x4a1c('0x39')][_0x4a1c('0x3a')]?_0x4cc510[_0x4a1c('0x39')]:_0x3a6cf9[_0x4a1c('0x35')];_0x4cc510['order']=qs[_0x4a1c('0x3d')](_0x26aa78[_0x4a1c('0x36')][_0x4a1c('0x3d')]);_0x4cc510[_0x4a1c('0x41')]=qs[_0x4a1c('0x3e')](_[_0x4a1c('0x3f')](_0x26aa78['query'],_0x3a6cf9[_0x4a1c('0x3e')]));if(_0x26aa78['query'][_0x4a1c('0x40')]){_0x4cc510[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x4cc510[_0x4a1c('0x41')],{'$or':_['map'](_0x4cc510[_0x4a1c('0x39')],function(_0x14f9fa){var _0x224b23={};_0x224b23[_0x14f9fa]={'$like':'%'+_0x26aa78['query'][_0x4a1c('0x40')]+'%'};return _0x224b23;})});}_0x4cc510=_[_0x4a1c('0x42')]({},_0x4cc510,_0x26aa78['options']);return _0x57c9b9[_0x4a1c('0x5f')](_0x4cc510);}})[_0x4a1c('0x28')](function(_0x196df5){if(_0x196df5){_0x59c470=_0x196df5[_0x4a1c('0x3a')];if(!_0x26aa78[_0x4a1c('0x36')][_0x4a1c('0x60')](_0x4a1c('0x3b'))){_0x4cc510[_0x4a1c('0x20')]=qs[_0x4a1c('0x20')](_0x26aa78['query'][_0x4a1c('0x20')]);_0x4cc510['offset']=qs[_0x4a1c('0x22')](_0x26aa78['query'][_0x4a1c('0x22')]);}return _0x57c9b9['getActions'](_0x4cc510);}})['then'](function(_0x4327d4){if(_0x4327d4){return _0x4327d4?{'count':_0x59c470,'rows':_0x4327d4}:null;}})[_0x4a1c('0x28')](respondWithResult(_0x525534,null))[_0x4a1c('0x48')](handleError(_0x525534,null));}; \ No newline at end of file +var _0x0f16=['type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','length','pick','getAnyConditions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x0f16,0xdf));var _0x60f1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0f16[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x60f1('0x0'));var rimraf=require(_0x60f1('0x1'));var zipdir=require(_0x60f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60f1('0x3'));var moment=require(_0x60f1('0x4'));var BPromise=require(_0x60f1('0x5'));var Mustache=require(_0x60f1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x60f1('0x7'));var csv=require(_0x60f1('0x8'));var ejs=require(_0x60f1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60f1('0xa'));var squel=require(_0x60f1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x60f1('0xc'));var Papa=require('papaparse');var Redis=require(_0x60f1('0xd'));var authService=require(_0x60f1('0xe'));var qs=require(_0x60f1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60f1('0x10'));var logger=require('../../config/logger')(_0x60f1('0x11'));var utils=require(_0x60f1('0x12'));var config=require(_0x60f1('0x13'));var licenseUtil=require(_0x60f1('0x14'));var db=require(_0x60f1('0x15'))['db'];function respondWithStatusCode(_0x24470d,_0x9e9aca){_0x9e9aca=_0x9e9aca||0xcc;return function(_0x5b6db3){if(_0x5b6db3){return _0x24470d[_0x60f1('0x16')](_0x9e9aca);}return _0x24470d[_0x60f1('0x17')](_0x9e9aca)[_0x60f1('0x18')]();};}function respondWithResult(_0x16b561,_0x3783a1){_0x3783a1=_0x3783a1||0xc8;return function(_0x2fa019){if(_0x2fa019){return _0x16b561['status'](_0x3783a1)['json'](_0x2fa019);}};}function respondWithFilteredResult(_0x41e7d4,_0x1954f5){return function(_0x16ca89){if(_0x16ca89){var _0x2f7685=typeof _0x1954f5[_0x60f1('0x19')]===_0x60f1('0x1a')&&typeof _0x1954f5[_0x60f1('0x1b')]===_0x60f1('0x1a');var _0x54f4cd=_0x16ca89[_0x60f1('0x1c')];var _0x5341d4=_0x2f7685?0x0:_0x1954f5[_0x60f1('0x19')];var _0x52d8ec=_0x2f7685?_0x16ca89[_0x60f1('0x1c')]:_0x1954f5['offset']+_0x1954f5['limit'];var _0x5b02bc;if(_0x52d8ec>=_0x54f4cd){_0x52d8ec=_0x54f4cd;_0x5b02bc=0xc8;}else{_0x5b02bc=0xce;}_0x41e7d4[_0x60f1('0x17')](_0x5b02bc);return _0x41e7d4[_0x60f1('0x1d')](_0x60f1('0x1e'),_0x5341d4+'-'+_0x52d8ec+'/'+_0x54f4cd)[_0x60f1('0x1f')](_0x16ca89);}return null;};}function patchUpdates(_0x2b029f){return function(_0x5ddead){try{jsonpatch[_0x60f1('0x20')](_0x5ddead,_0x2b029f,!![]);}catch(_0x8be0de){return BPromise[_0x60f1('0x21')](_0x8be0de);}return _0x5ddead[_0x60f1('0x22')]();};}function saveUpdates(_0x3c1799,_0x559cfc){return function(_0x22547e){if(_0x22547e){return _0x22547e[_0x60f1('0x23')](_0x3c1799)[_0x60f1('0x24')](function(_0x528ea3){return _0x528ea3;});}return null;};}function removeEntity(_0x572f4b,_0x43425d){return function(_0x5bf326){if(_0x5bf326){return _0x5bf326[_0x60f1('0x25')]()[_0x60f1('0x24')](function(){var _0x5258de=_0x5bf326[_0x60f1('0x26')]({'plain':!![]});var _0x46eb6d=_0x60f1('0x27');return db[_0x60f1('0x28')]['destroy']({'where':{'type':_0x46eb6d,'resourceId':_0x5258de['id']}})['then'](function(){return _0x5bf326;});})['then'](function(){_0x572f4b[_0x60f1('0x17')](0xcc)[_0x60f1('0x18')]();});}};}function handleEntityNotFound(_0x4eff21,_0x48d6c4){return function(_0x328cde){if(!_0x328cde){_0x4eff21[_0x60f1('0x16')](0x194);}return _0x328cde;};}function handleError(_0x53ca5d,_0x2f3f33){_0x2f3f33=_0x2f3f33||0x1f4;return function(_0x20e7d9){logger[_0x60f1('0x29')](_0x20e7d9[_0x60f1('0x2a')]);if(_0x20e7d9['name']){delete _0x20e7d9[_0x60f1('0x2b')];}_0x53ca5d[_0x60f1('0x17')](_0x2f3f33)[_0x60f1('0x2c')](_0x20e7d9);};}exports[_0x60f1('0x2d')]=function(_0x2aad8d,_0x455b0a){var _0x505869={},_0x2b43b3={},_0x27e175={'count':0x0,'rows':[]};var _0x72de46=_[_0x60f1('0x2e')](db[_0x60f1('0x2f')][_0x60f1('0x30')],function(_0x44e303){return{'name':_0x44e303[_0x60f1('0x31')],'type':_0x44e303[_0x60f1('0x32')][_0x60f1('0x33')]};});_0x2b43b3[_0x60f1('0x34')]=_[_0x60f1('0x2e')](_0x72de46,_0x60f1('0x2b'));_0x2b43b3[_0x60f1('0x35')]=_['keys'](_0x2aad8d[_0x60f1('0x35')]);_0x2b43b3['filters']=_[_0x60f1('0x36')](_0x2b43b3[_0x60f1('0x34')],_0x2b43b3['query']);_0x505869[_0x60f1('0x37')]=_[_0x60f1('0x36')](_0x2b43b3[_0x60f1('0x34')],qs[_0x60f1('0x38')](_0x2aad8d[_0x60f1('0x35')]['fields']));_0x505869[_0x60f1('0x37')]=_0x505869[_0x60f1('0x37')]['length']?_0x505869[_0x60f1('0x37')]:_0x2b43b3['model'];if(!_0x2aad8d[_0x60f1('0x35')][_0x60f1('0x39')](_0x60f1('0x3a'))){_0x505869[_0x60f1('0x1b')]=qs['limit'](_0x2aad8d[_0x60f1('0x35')]['limit']);_0x505869[_0x60f1('0x19')]=qs[_0x60f1('0x19')](_0x2aad8d[_0x60f1('0x35')][_0x60f1('0x19')]);}_0x505869[_0x60f1('0x3b')]=qs[_0x60f1('0x3c')](_0x2aad8d[_0x60f1('0x35')]['sort']);_0x505869['where']=qs[_0x60f1('0x3d')](_['pick'](_0x2aad8d['query'],_0x2b43b3['filters']),_0x72de46);if(_0x2aad8d['query'][_0x60f1('0x3e')]){_0x505869[_0x60f1('0x3f')]=_['merge'](_0x505869[_0x60f1('0x3f')],{'$or':_[_0x60f1('0x2e')](_0x72de46,function(_0x294825){if(_0x294825[_0x60f1('0x32')]!==_0x60f1('0x40')){var _0x4ea906={};_0x4ea906[_0x294825['name']]={'$like':'%'+_0x2aad8d[_0x60f1('0x35')][_0x60f1('0x3e')]+'%'};return _0x4ea906;}})});}_0x505869=_[_0x60f1('0x41')]({},_0x505869,_0x2aad8d[_0x60f1('0x42')]);var _0x470d09={'where':_0x505869[_0x60f1('0x3f')]};return db[_0x60f1('0x2f')][_0x60f1('0x1c')](_0x470d09)[_0x60f1('0x24')](function(_0x644019){_0x27e175[_0x60f1('0x1c')]=_0x644019;if(_0x2aad8d[_0x60f1('0x35')][_0x60f1('0x43')]){_0x505869[_0x60f1('0x44')]=[{'all':!![]}];}return db[_0x60f1('0x2f')][_0x60f1('0x45')](_0x505869);})[_0x60f1('0x24')](function(_0x526ca9){_0x27e175['rows']=_0x526ca9;return _0x27e175;})[_0x60f1('0x24')](respondWithFilteredResult(_0x455b0a,_0x505869))[_0x60f1('0x46')](handleError(_0x455b0a,null));};exports[_0x60f1('0x47')]=function(_0x483142,_0x216982){var _0x5827e7={'raw':![],'where':{'id':_0x483142[_0x60f1('0x48')]['id']}},_0x1022fd={};_0x1022fd[_0x60f1('0x34')]=_[_0x60f1('0x49')](db['Trigger']['rawAttributes']);_0x1022fd['query']=_['keys'](_0x483142[_0x60f1('0x35')]);_0x1022fd[_0x60f1('0x3d')]=_['intersection'](_0x1022fd['model'],_0x1022fd[_0x60f1('0x35')]);_0x5827e7['attributes']=_['intersection'](_0x1022fd[_0x60f1('0x34')],qs[_0x60f1('0x38')](_0x483142['query']['fields']));_0x5827e7[_0x60f1('0x37')]=_0x5827e7[_0x60f1('0x37')]['length']?_0x5827e7[_0x60f1('0x37')]:_0x1022fd[_0x60f1('0x34')];if(_0x483142[_0x60f1('0x35')]['includeAll']){_0x5827e7['include']=[{'all':!![]}];}_0x5827e7=_[_0x60f1('0x41')]({},_0x5827e7,_0x483142[_0x60f1('0x42')]);return db[_0x60f1('0x2f')][_0x60f1('0x4a')](_0x5827e7)[_0x60f1('0x24')](handleEntityNotFound(_0x216982,null))[_0x60f1('0x24')](respondWithResult(_0x216982,null))[_0x60f1('0x46')](handleError(_0x216982,null));};exports[_0x60f1('0x4b')]=function(_0x454f74,_0x216382){return db[_0x60f1('0x2f')][_0x60f1('0x4b')](_0x454f74['body'],{})[_0x60f1('0x24')](function(_0x58b6ec){var _0x475d8=_0x454f74[_0x60f1('0x4c')][_0x60f1('0x26')]({'plain':!![]});if(!_0x475d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x475d8['role']===_0x60f1('0x4c')){var _0x255022=_0x58b6ec['get']({'plain':!![]});var _0x45b4f7=_0x60f1('0x27');return db[_0x60f1('0x4d')]['find']({'where':{'name':_0x45b4f7,'userProfileId':_0x475d8[_0x60f1('0x4e')]},'raw':!![]})[_0x60f1('0x24')](function(_0x34b028){if(_0x34b028&&_0x34b028[_0x60f1('0x4f')]===0x0){return db[_0x60f1('0x28')][_0x60f1('0x4b')]({'name':_0x255022[_0x60f1('0x2b')],'resourceId':_0x255022['id'],'type':_0x34b028[_0x60f1('0x2b')],'sectionId':_0x34b028['id']},{})[_0x60f1('0x24')](function(){return _0x58b6ec;});}else{return _0x58b6ec;}})['catch'](function(_0x5f1ab9){logger[_0x60f1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f1ab9);throw _0x5f1ab9;});}return _0x58b6ec;})[_0x60f1('0x24')](respondWithResult(_0x216382,0xc9))[_0x60f1('0x46')](handleError(_0x216382,null));};exports[_0x60f1('0x23')]=function(_0x364ccf,_0x2030df){if(_0x364ccf[_0x60f1('0x50')]['id']){delete _0x364ccf[_0x60f1('0x50')]['id'];}return db[_0x60f1('0x2f')][_0x60f1('0x4a')]({'where':{'id':_0x364ccf[_0x60f1('0x48')]['id']}})[_0x60f1('0x24')](handleEntityNotFound(_0x2030df,null))[_0x60f1('0x24')](saveUpdates(_0x364ccf['body'],null))[_0x60f1('0x24')](respondWithResult(_0x2030df,null))[_0x60f1('0x46')](handleError(_0x2030df,null));};exports['destroy']=function(_0x348b70,_0x5e5629){return db['Trigger'][_0x60f1('0x4a')]({'where':{'id':_0x348b70['params']['id']}})[_0x60f1('0x24')](handleEntityNotFound(_0x5e5629,null))['then'](removeEntity(_0x5e5629,null))[_0x60f1('0x46')](handleError(_0x5e5629,null));};exports[_0x60f1('0x51')]=function(_0x6bbddb,_0x4b5841,_0x18291e){if(_0x6bbddb[_0x60f1('0x50')]['id']){delete _0x6bbddb['body']['id'];}return db[_0x60f1('0x2f')][_0x60f1('0x4a')]({'where':{'id':_0x6bbddb[_0x60f1('0x48')]['id']}})[_0x60f1('0x24')](handleEntityNotFound(_0x4b5841,null))[_0x60f1('0x24')](function(_0x1305c5){if(_0x1305c5){_0x6bbddb[_0x60f1('0x50')]['TriggerAllId']=_0x1305c5['id'];return db[_0x60f1('0x52')]['create'](_0x6bbddb[_0x60f1('0x50')]);}})[_0x60f1('0x24')](respondWithResult(_0x4b5841,null))[_0x60f1('0x46')](handleError(_0x4b5841,null));};exports[_0x60f1('0x53')]=function(_0x335b09,_0xe5174c,_0x797348){if(_0x335b09['body']['id']){delete _0x335b09[_0x60f1('0x50')]['id'];}return db['Trigger'][_0x60f1('0x4a')]({'where':{'id':_0x335b09[_0x60f1('0x48')]['id']}})['then'](handleEntityNotFound(_0xe5174c,null))[_0x60f1('0x24')](function(_0x232838){if(_0x232838){_0x335b09[_0x60f1('0x50')]['TriggerAnyId']=_0x232838['id'];return db['Condition'][_0x60f1('0x4b')](_0x335b09[_0x60f1('0x50')]);}})['then'](respondWithResult(_0xe5174c,null))[_0x60f1('0x46')](handleError(_0xe5174c,null));};exports[_0x60f1('0x54')]=function(_0x3d1382,_0x1f56ce,_0x1d767f){var _0x59ef8b={};var _0x55e9a9={};var _0x36321d;var _0x51c418;return db[_0x60f1('0x2f')][_0x60f1('0x55')]({'where':{'id':_0x3d1382[_0x60f1('0x48')]['id']}})[_0x60f1('0x24')](handleEntityNotFound(_0x1f56ce,null))[_0x60f1('0x24')](function(_0x5e582c){if(_0x5e582c){_0x36321d=_0x5e582c;_0x55e9a9['model']=_[_0x60f1('0x49')](db[_0x60f1('0x52')]['rawAttributes']);_0x55e9a9[_0x60f1('0x35')]=_['keys'](_0x3d1382[_0x60f1('0x35')]);_0x55e9a9[_0x60f1('0x3d')]=_['intersection'](_0x55e9a9[_0x60f1('0x34')],_0x55e9a9[_0x60f1('0x35')]);_0x59ef8b[_0x60f1('0x37')]=_[_0x60f1('0x36')](_0x55e9a9[_0x60f1('0x34')],qs[_0x60f1('0x38')](_0x3d1382[_0x60f1('0x35')][_0x60f1('0x38')]));_0x59ef8b[_0x60f1('0x37')]=_0x59ef8b[_0x60f1('0x37')][_0x60f1('0x56')]?_0x59ef8b['attributes']:_0x55e9a9[_0x60f1('0x34')];_0x59ef8b['order']=qs[_0x60f1('0x3c')](_0x3d1382[_0x60f1('0x35')]['sort']);_0x59ef8b['where']=qs['filters'](_[_0x60f1('0x57')](_0x3d1382[_0x60f1('0x35')],_0x55e9a9['filters']));if(_0x3d1382['query'][_0x60f1('0x3e')]){_0x59ef8b[_0x60f1('0x3f')]=_[_0x60f1('0x41')](_0x59ef8b[_0x60f1('0x3f')],{'$or':_['map'](_0x59ef8b[_0x60f1('0x37')],function(_0x2de8a8){var _0x3d1fc2={};_0x3d1fc2[_0x2de8a8]={'$like':'%'+_0x3d1382['query'][_0x60f1('0x3e')]+'%'};return _0x3d1fc2;})});}_0x59ef8b=_[_0x60f1('0x41')]({},_0x59ef8b,_0x3d1382[_0x60f1('0x42')]);return _0x36321d[_0x60f1('0x54')](_0x59ef8b);}})[_0x60f1('0x24')](function(_0x400471){if(_0x400471){_0x51c418=_0x400471['length'];if(!_0x3d1382['query'][_0x60f1('0x39')](_0x60f1('0x3a'))){_0x59ef8b[_0x60f1('0x1b')]=qs['limit'](_0x3d1382[_0x60f1('0x35')][_0x60f1('0x1b')]);_0x59ef8b['offset']=qs[_0x60f1('0x19')](_0x3d1382['query']['offset']);}return _0x36321d[_0x60f1('0x54')](_0x59ef8b);}})[_0x60f1('0x24')](function(_0x23d258){if(_0x23d258){return _0x23d258?{'count':_0x51c418,'rows':_0x23d258}:null;}})[_0x60f1('0x24')](respondWithResult(_0x1f56ce,null))[_0x60f1('0x46')](handleError(_0x1f56ce,null));};exports[_0x60f1('0x58')]=function(_0x4ca1cb,_0x4c89d8,_0x15bb4f){var _0x2894f5={};var _0x4cb4e4={};var _0x2f148f;var _0x2fd90d;return db['Trigger']['findOne']({'where':{'id':_0x4ca1cb[_0x60f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c89d8,null))[_0x60f1('0x24')](function(_0x4f9755){if(_0x4f9755){_0x2f148f=_0x4f9755;_0x4cb4e4['model']=_[_0x60f1('0x49')](db[_0x60f1('0x52')]['rawAttributes']);_0x4cb4e4[_0x60f1('0x35')]=_[_0x60f1('0x49')](_0x4ca1cb[_0x60f1('0x35')]);_0x4cb4e4[_0x60f1('0x3d')]=_[_0x60f1('0x36')](_0x4cb4e4[_0x60f1('0x34')],_0x4cb4e4['query']);_0x2894f5[_0x60f1('0x37')]=_[_0x60f1('0x36')](_0x4cb4e4[_0x60f1('0x34')],qs[_0x60f1('0x38')](_0x4ca1cb[_0x60f1('0x35')][_0x60f1('0x38')]));_0x2894f5['attributes']=_0x2894f5[_0x60f1('0x37')][_0x60f1('0x56')]?_0x2894f5['attributes']:_0x4cb4e4['model'];_0x2894f5[_0x60f1('0x3b')]=qs[_0x60f1('0x3c')](_0x4ca1cb[_0x60f1('0x35')][_0x60f1('0x3c')]);_0x2894f5[_0x60f1('0x3f')]=qs[_0x60f1('0x3d')](_[_0x60f1('0x57')](_0x4ca1cb[_0x60f1('0x35')],_0x4cb4e4[_0x60f1('0x3d')]));if(_0x4ca1cb['query'][_0x60f1('0x3e')]){_0x2894f5[_0x60f1('0x3f')]=_['merge'](_0x2894f5['where'],{'$or':_['map'](_0x2894f5[_0x60f1('0x37')],function(_0x289596){var _0x11ac6b={};_0x11ac6b[_0x289596]={'$like':'%'+_0x4ca1cb[_0x60f1('0x35')]['filter']+'%'};return _0x11ac6b;})});}_0x2894f5=_[_0x60f1('0x41')]({},_0x2894f5,_0x4ca1cb[_0x60f1('0x42')]);return _0x2f148f[_0x60f1('0x58')](_0x2894f5);}})[_0x60f1('0x24')](function(_0xc976c8){if(_0xc976c8){_0x2fd90d=_0xc976c8[_0x60f1('0x56')];if(!_0x4ca1cb['query'][_0x60f1('0x39')](_0x60f1('0x3a'))){_0x2894f5[_0x60f1('0x1b')]=qs[_0x60f1('0x1b')](_0x4ca1cb['query'][_0x60f1('0x1b')]);_0x2894f5[_0x60f1('0x19')]=qs[_0x60f1('0x19')](_0x4ca1cb[_0x60f1('0x35')][_0x60f1('0x19')]);}return _0x2f148f[_0x60f1('0x58')](_0x2894f5);}})[_0x60f1('0x24')](function(_0x499b44){if(_0x499b44){return _0x499b44?{'count':_0x2fd90d,'rows':_0x499b44}:null;}})[_0x60f1('0x24')](respondWithResult(_0x4c89d8,null))[_0x60f1('0x46')](handleError(_0x4c89d8,null));};exports['addAction']=function(_0x3f661f,_0x27b526,_0x39da99){if(_0x3f661f[_0x60f1('0x50')]['id']){delete _0x3f661f[_0x60f1('0x50')]['id'];}return db[_0x60f1('0x2f')][_0x60f1('0x4a')]({'where':{'id':_0x3f661f[_0x60f1('0x48')]['id']}})[_0x60f1('0x24')](handleEntityNotFound(_0x27b526,null))['then'](function(_0x1f4dd8){if(_0x1f4dd8){_0x3f661f[_0x60f1('0x50')]['TriggerId']=_0x1f4dd8['id'];return db[_0x60f1('0x59')][_0x60f1('0x4b')](_0x3f661f[_0x60f1('0x50')]);}})['then'](respondWithResult(_0x27b526,null))[_0x60f1('0x46')](handleError(_0x27b526,null));};exports[_0x60f1('0x5a')]=function(_0x4af323,_0x25b94f,_0x534fd9){var _0x101f85={};var _0xcf20fa={};var _0x8fa7ee;var _0x1be7ff;return db[_0x60f1('0x2f')][_0x60f1('0x55')]({'where':{'id':_0x4af323[_0x60f1('0x48')]['id']}})[_0x60f1('0x24')](handleEntityNotFound(_0x25b94f,null))[_0x60f1('0x24')](function(_0xf6ad1){if(_0xf6ad1){_0x8fa7ee=_0xf6ad1;_0xcf20fa['model']=_[_0x60f1('0x49')](db['Action'][_0x60f1('0x30')]);_0xcf20fa[_0x60f1('0x35')]=_[_0x60f1('0x49')](_0x4af323['query']);_0xcf20fa['filters']=_['intersection'](_0xcf20fa[_0x60f1('0x34')],_0xcf20fa[_0x60f1('0x35')]);_0x101f85[_0x60f1('0x37')]=_[_0x60f1('0x36')](_0xcf20fa[_0x60f1('0x34')],qs['fields'](_0x4af323[_0x60f1('0x35')][_0x60f1('0x38')]));_0x101f85[_0x60f1('0x37')]=_0x101f85[_0x60f1('0x37')][_0x60f1('0x56')]?_0x101f85[_0x60f1('0x37')]:_0xcf20fa[_0x60f1('0x34')];_0x101f85['order']=qs[_0x60f1('0x3c')](_0x4af323[_0x60f1('0x35')][_0x60f1('0x3c')]);_0x101f85[_0x60f1('0x3f')]=qs[_0x60f1('0x3d')](_[_0x60f1('0x57')](_0x4af323[_0x60f1('0x35')],_0xcf20fa[_0x60f1('0x3d')]));if(_0x4af323['query'][_0x60f1('0x3e')]){_0x101f85['where']=_['merge'](_0x101f85[_0x60f1('0x3f')],{'$or':_['map'](_0x101f85[_0x60f1('0x37')],function(_0x4540c6){var _0x2e7cbd={};_0x2e7cbd[_0x4540c6]={'$like':'%'+_0x4af323[_0x60f1('0x35')][_0x60f1('0x3e')]+'%'};return _0x2e7cbd;})});}_0x101f85=_['merge']({},_0x101f85,_0x4af323['options']);return _0x8fa7ee['getActions'](_0x101f85);}})[_0x60f1('0x24')](function(_0x27e92d){if(_0x27e92d){_0x1be7ff=_0x27e92d[_0x60f1('0x56')];if(!_0x4af323[_0x60f1('0x35')][_0x60f1('0x39')](_0x60f1('0x3a'))){_0x101f85[_0x60f1('0x1b')]=qs[_0x60f1('0x1b')](_0x4af323[_0x60f1('0x35')][_0x60f1('0x1b')]);_0x101f85['offset']=qs[_0x60f1('0x19')](_0x4af323[_0x60f1('0x35')][_0x60f1('0x19')]);}return _0x8fa7ee[_0x60f1('0x5a')](_0x101f85);}})['then'](function(_0x185914){if(_0x185914){return _0x185914?{'count':_0x1be7ff,'rows':_0x185914}:null;}})[_0x60f1('0x24')](respondWithResult(_0x25b94f,null))[_0x60f1('0x46')](handleError(_0x25b94f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e5e19d9..c95395b 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 _0xeea0=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x9feeed,_0x1f4296){var _0x4b7c4f=function(_0xf99d90){while(--_0xf99d90){_0x9feeed['push'](_0x9feeed['shift']());}};_0x4b7c4f(++_0x1f4296);}(_0xeea0,0x91));var _0x0eea=function(_0x6ba59b,_0x17b0c8){_0x6ba59b=_0x6ba59b-0x0;var _0x26c24a=_0xeea0[_0x6ba59b];return _0x26c24a;};'use strict';var _=require(_0x0eea('0x0'));var util=require(_0x0eea('0x1'));var logger=require(_0x0eea('0x2'))(_0x0eea('0x3'));var moment=require(_0x0eea('0x4'));var BPromise=require('bluebird');var rp=require(_0x0eea('0x5'));var fs=require('fs');var path=require(_0x0eea('0x6'));var rimraf=require(_0x0eea('0x7'));var config=require(_0x0eea('0x8'));var attributes=require(_0x0eea('0x9'));module[_0x0eea('0xa')]=function(_0x2520ce,_0x47d7c8){return _0x2520ce[_0x0eea('0xb')](_0x0eea('0xc'),attributes,{'tableName':_0x0eea('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd5=['Trigger','tools_triggers','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./trigger.attributes'];(function(_0x5d9386,_0x4a7953){var _0x304b77=function(_0x358b7d){while(--_0x358b7d){_0x5d9386['push'](_0x5d9386['shift']());}};_0x304b77(++_0x4a7953);}(_0xecd5,0x110));var _0x5ecd=function(_0x3e7dcd,_0x11364b){_0x3e7dcd=_0x3e7dcd-0x0;var _0x20e998=_0xecd5[_0x3e7dcd];return _0x20e998;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var logger=require(_0x5ecd('0x1'))(_0x5ecd('0x2'));var moment=require('moment');var BPromise=require(_0x5ecd('0x3'));var rp=require(_0x5ecd('0x4'));var fs=require('fs');var path=require(_0x5ecd('0x5'));var rimraf=require(_0x5ecd('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ecd('0x7'));module['exports']=function(_0x1ddbad,_0x492eba){return _0x1ddbad['define'](_0x5ecd('0x8'),attributes,{'tableName':_0x5ecd('0x9'),'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 7032205..910c6d2 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 _0xcc6c=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger','options','raw','limit','include','map','model','attributes','GetTrigger','ShowTrigger','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xcc6c,0x7f));var _0xccc6=function(_0x49458c,_0x18eeb9){_0x49458c=_0x49458c-0x0;var _0x1e2a36=_0xcc6c[_0x49458c];return _0x1e2a36;};'use strict';var _=require('lodash');var util=require(_0xccc6('0x0'));var moment=require(_0xccc6('0x1'));var BPromise=require(_0xccc6('0x2'));var rs=require(_0xccc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccc6('0x4'))['db'];var utils=require(_0xccc6('0x5'));var logger=require(_0xccc6('0x6'))(_0xccc6('0x7'));var config=require(_0xccc6('0x8'));var jayson=require(_0xccc6('0x9'));var client=jayson[_0xccc6('0xa')][_0xccc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb897,_0x1bfc91,_0x1fbc76){return new BPromise(function(_0x5bd29d,_0x258845){return client[_0xccc6('0xc')](_0x3bb897,_0x1fbc76)[_0xccc6('0xd')](function(_0x42803d){logger[_0xccc6('0xe')](_0xccc6('0xf'),_0x1bfc91,_0xccc6('0x10'));logger[_0xccc6('0x11')](_0xccc6('0x12'),_0x1bfc91,_0xccc6('0x10'),JSON[_0xccc6('0x13')](_0x42803d));if(_0x42803d[_0xccc6('0x14')]){if(_0x42803d['error'][_0xccc6('0x15')]===0x1f4){logger[_0xccc6('0x14')]('Trigger,\x20%s,\x20%s',_0x1bfc91,_0x42803d[_0xccc6('0x14')][_0xccc6('0x16')]);return _0x258845(_0x42803d[_0xccc6('0x14')]['message']);}logger[_0xccc6('0x14')](_0xccc6('0xf'),_0x1bfc91,_0x42803d[_0xccc6('0x14')][_0xccc6('0x16')]);return _0x5bd29d(_0x42803d['error'][_0xccc6('0x16')]);}else{logger[_0xccc6('0xe')](_0xccc6('0xf'),_0x1bfc91,_0xccc6('0x10'));_0x5bd29d(_0x42803d[_0xccc6('0x17')][_0xccc6('0x16')]);}})[_0xccc6('0x18')](function(_0x414d36){logger[_0xccc6('0x14')](_0xccc6('0xf'),_0x1bfc91,_0x414d36);_0x258845(_0x414d36);});});}exports['GetTrigger']=function(_0x5502cb){var _0x8f9596=this;return new Promise(function(_0x2c53f0,_0x5b067e){return db[_0xccc6('0x19')]['findAll']({'raw':_0x5502cb['options']?_0x5502cb[_0xccc6('0x1a')][_0xccc6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5502cb[_0xccc6('0x1a')]?_0x5502cb[_0xccc6('0x1a')]['where']||null:null,'attributes':_0x5502cb[_0xccc6('0x1a')]?_0x5502cb[_0xccc6('0x1a')]['attributes']||null:null,'limit':_0x5502cb[_0xccc6('0x1a')]?_0x5502cb[_0xccc6('0x1a')][_0xccc6('0x1c')]||null:null,'include':_0x5502cb[_0xccc6('0x1a')]?_0x5502cb[_0xccc6('0x1a')][_0xccc6('0x1d')]?_[_0xccc6('0x1e')](_0x5502cb[_0xccc6('0x1a')][_0xccc6('0x1d')],function(_0x4fb187){return{'model':db[_0x4fb187[_0xccc6('0x1f')]],'as':_0x4fb187['as'],'attributes':_0x4fb187[_0xccc6('0x20')],'include':_0x4fb187[_0xccc6('0x1d')]?_['map'](_0x4fb187[_0xccc6('0x1d')],function(_0x47ceb2){return{'model':db[_0x47ceb2[_0xccc6('0x1f')]],'as':_0x47ceb2['as'],'attributes':_0x47ceb2[_0xccc6('0x20')],'include':_0x47ceb2[_0xccc6('0x1d')]?_['map'](_0x47ceb2[_0xccc6('0x1d')],function(_0x267b56){return{'model':db[_0x267b56['model']],'as':_0x267b56['as'],'attributes':_0x267b56[_0xccc6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xccc6('0xd')](function(_0x22df16){logger[_0xccc6('0xe')](_0xccc6('0x21'),_0x5502cb);logger['debug'](_0xccc6('0x21'),_0x5502cb,JSON[_0xccc6('0x13')](_0x22df16));_0x2c53f0(_0x22df16);})[_0xccc6('0x18')](function(_0x1e2f51){logger[_0xccc6('0x14')](_0xccc6('0x21'),_0x1e2f51[_0xccc6('0x16')],_0x5502cb);_0x5b067e(_0x8f9596[_0xccc6('0x14')](0x1f4,_0x1e2f51[_0xccc6('0x16')]));});});};exports[_0xccc6('0x22')]=function(_0x4e0a3a){var _0x1f6d6c=this;return new Promise(function(_0x31dfbe,_0x62dd38){return db[_0xccc6('0x19')][_0xccc6('0x23')]({'raw':_0x4e0a3a[_0xccc6('0x1a')]?_0x4e0a3a[_0xccc6('0x1a')][_0xccc6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e0a3a['options']?_0x4e0a3a[_0xccc6('0x1a')]['where']||null:null,'attributes':_0x4e0a3a[_0xccc6('0x1a')]?_0x4e0a3a['options']['attributes']||null:null,'include':_0x4e0a3a[_0xccc6('0x1a')]?_0x4e0a3a['options'][_0xccc6('0x1d')]?_[_0xccc6('0x1e')](_0x4e0a3a['options'][_0xccc6('0x1d')],function(_0x55fa68){return{'model':db[_0x55fa68[_0xccc6('0x1f')]],'as':_0x55fa68['as'],'attributes':_0x55fa68['attributes'],'include':_0x55fa68[_0xccc6('0x1d')]?_['map'](_0x55fa68[_0xccc6('0x1d')],function(_0x55fc6d){return{'model':db[_0x55fc6d[_0xccc6('0x1f')]],'as':_0x55fc6d['as'],'attributes':_0x55fc6d[_0xccc6('0x20')],'include':_0x55fc6d[_0xccc6('0x1d')]?_[_0xccc6('0x1e')](_0x55fc6d[_0xccc6('0x1d')],function(_0x33658f){return{'model':db[_0x33658f[_0xccc6('0x1f')]],'as':_0x33658f['as'],'attributes':_0x33658f[_0xccc6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xccc6('0xd')](function(_0x151f67){logger[_0xccc6('0xe')](_0xccc6('0x22'),_0x4e0a3a);logger[_0xccc6('0x11')](_0xccc6('0x22'),_0x4e0a3a,JSON['stringify'](_0x151f67));_0x31dfbe(_0x151f67);})[_0xccc6('0x18')](function(_0x3e2433){logger[_0xccc6('0x14')](_0xccc6('0x22'),_0x3e2433[_0xccc6('0x16')],_0x4e0a3a);_0x62dd38(_0x1f6d6c[_0xccc6('0x14')](0x1f4,_0x3e2433['message']));});});}; \ No newline at end of file +var _0x78f6=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','Trigger,\x20%s,\x20%s','message','catch','Trigger','findAll','options','raw','where','attributes','include','map','model','GetTrigger','ShowTrigger','find','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x78f6,0x81));var _0x678f=function(_0x2f5fd3,_0x11f948){_0x2f5fd3=_0x2f5fd3-0x0;var _0x40b2c8=_0x78f6[_0x2f5fd3];return _0x40b2c8;};'use strict';var _=require(_0x678f('0x0'));var util=require(_0x678f('0x1'));var moment=require('moment');var BPromise=require(_0x678f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x678f('0x3'));var db=require(_0x678f('0x4'))['db'];var utils=require(_0x678f('0x5'));var logger=require(_0x678f('0x6'))(_0x678f('0x7'));var config=require(_0x678f('0x8'));var jayson=require(_0x678f('0x9'));var client=jayson[_0x678f('0xa')][_0x678f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43c6d0,_0x3646e4,_0x3c9ac4){return new BPromise(function(_0x147315,_0x601326){return client['request'](_0x43c6d0,_0x3c9ac4)[_0x678f('0xc')](function(_0x3c9ea5){logger[_0x678f('0xd')]('Trigger,\x20%s,\x20%s',_0x3646e4,_0x678f('0xe'));logger[_0x678f('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x3646e4,_0x678f('0xe'),JSON['stringify'](_0x3c9ea5));if(_0x3c9ea5[_0x678f('0x10')]){if(_0x3c9ea5['error'][_0x678f('0x11')]===0x1f4){logger[_0x678f('0x10')](_0x678f('0x12'),_0x3646e4,_0x3c9ea5[_0x678f('0x10')][_0x678f('0x13')]);return _0x601326(_0x3c9ea5[_0x678f('0x10')]['message']);}logger[_0x678f('0x10')]('Trigger,\x20%s,\x20%s',_0x3646e4,_0x3c9ea5[_0x678f('0x10')][_0x678f('0x13')]);return _0x147315(_0x3c9ea5['error'][_0x678f('0x13')]);}else{logger[_0x678f('0xd')]('Trigger,\x20%s,\x20%s',_0x3646e4,'request\x20sent');_0x147315(_0x3c9ea5['result'][_0x678f('0x13')]);}})[_0x678f('0x14')](function(_0x44f332){logger['error'](_0x678f('0x12'),_0x3646e4,_0x44f332);_0x601326(_0x44f332);});});}exports['GetTrigger']=function(_0x225374){var _0x4daafa=this;return new Promise(function(_0x730825,_0x358a66){return db[_0x678f('0x15')][_0x678f('0x16')]({'raw':_0x225374[_0x678f('0x17')]?_0x225374[_0x678f('0x17')][_0x678f('0x18')]===undefined?!![]:![]:!![],'where':_0x225374[_0x678f('0x17')]?_0x225374['options'][_0x678f('0x19')]||null:null,'attributes':_0x225374['options']?_0x225374[_0x678f('0x17')][_0x678f('0x1a')]||null:null,'limit':_0x225374[_0x678f('0x17')]?_0x225374[_0x678f('0x17')]['limit']||null:null,'include':_0x225374[_0x678f('0x17')]?_0x225374[_0x678f('0x17')][_0x678f('0x1b')]?_[_0x678f('0x1c')](_0x225374[_0x678f('0x17')][_0x678f('0x1b')],function(_0x2b0ec1){return{'model':db[_0x2b0ec1[_0x678f('0x1d')]],'as':_0x2b0ec1['as'],'attributes':_0x2b0ec1[_0x678f('0x1a')],'include':_0x2b0ec1[_0x678f('0x1b')]?_[_0x678f('0x1c')](_0x2b0ec1['include'],function(_0x4c4467){return{'model':db[_0x4c4467[_0x678f('0x1d')]],'as':_0x4c4467['as'],'attributes':_0x4c4467[_0x678f('0x1a')],'include':_0x4c4467[_0x678f('0x1b')]?_[_0x678f('0x1c')](_0x4c4467[_0x678f('0x1b')],function(_0x3cc914){return{'model':db[_0x3cc914[_0x678f('0x1d')]],'as':_0x3cc914['as'],'attributes':_0x3cc914[_0x678f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x678f('0xc')](function(_0x1c14ca){logger['info'](_0x678f('0x1e'),_0x225374);logger[_0x678f('0xf')](_0x678f('0x1e'),_0x225374,JSON['stringify'](_0x1c14ca));_0x730825(_0x1c14ca);})['catch'](function(_0x131618){logger[_0x678f('0x10')](_0x678f('0x1e'),_0x131618['message'],_0x225374);_0x358a66(_0x4daafa[_0x678f('0x10')](0x1f4,_0x131618[_0x678f('0x13')]));});});};exports[_0x678f('0x1f')]=function(_0x2b845b){var _0x134bc3=this;return new Promise(function(_0x20ff3e,_0x38b20d){return db[_0x678f('0x15')][_0x678f('0x20')]({'raw':_0x2b845b[_0x678f('0x17')]?_0x2b845b[_0x678f('0x17')][_0x678f('0x18')]===undefined?!![]:![]:!![],'where':_0x2b845b['options']?_0x2b845b[_0x678f('0x17')]['where']||null:null,'attributes':_0x2b845b[_0x678f('0x17')]?_0x2b845b[_0x678f('0x17')][_0x678f('0x1a')]||null:null,'include':_0x2b845b[_0x678f('0x17')]?_0x2b845b[_0x678f('0x17')][_0x678f('0x1b')]?_[_0x678f('0x1c')](_0x2b845b[_0x678f('0x17')][_0x678f('0x1b')],function(_0x4968b9){return{'model':db[_0x4968b9['model']],'as':_0x4968b9['as'],'attributes':_0x4968b9[_0x678f('0x1a')],'include':_0x4968b9[_0x678f('0x1b')]?_[_0x678f('0x1c')](_0x4968b9[_0x678f('0x1b')],function(_0xb32eab){return{'model':db[_0xb32eab[_0x678f('0x1d')]],'as':_0xb32eab['as'],'attributes':_0xb32eab[_0x678f('0x1a')],'include':_0xb32eab[_0x678f('0x1b')]?_[_0x678f('0x1c')](_0xb32eab[_0x678f('0x1b')],function(_0x23baab){return{'model':db[_0x23baab[_0x678f('0x1d')]],'as':_0x23baab['as'],'attributes':_0x23baab[_0x678f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5822bb){logger[_0x678f('0xd')](_0x678f('0x1f'),_0x2b845b);logger[_0x678f('0xf')](_0x678f('0x1f'),_0x2b845b,JSON[_0x678f('0x21')](_0x5822bb));_0x20ff3e(_0x5822bb);})[_0x678f('0x14')](function(_0x27f85c){logger[_0x678f('0x10')](_0x678f('0x1f'),_0x27f85c['message'],_0x2b845b);_0x38b20d(_0x134bc3[_0x678f('0x10')](0x1f4,_0x27f85c[_0x678f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 86458d1..466cec9 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 _0xfd4f=['/:id','show','post','/:id/clone','isAuthenticated','clone','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfd4f,0x9e));var _0xffd4=function(_0x36d0d3,_0x2cff00){_0x36d0d3=_0x36d0d3-0x0;var _0x334f68=_0xfd4f[_0x36d0d3];return _0x334f68;};'use strict';var multer=require(_0xffd4('0x0'));var util=require('util');var path=require(_0xffd4('0x1'));var timeout=require(_0xffd4('0x2'));var express=require(_0xffd4('0x3'));var router=express[_0xffd4('0x4')]();var fs_extra=require(_0xffd4('0x5'));var auth=require(_0xffd4('0x6'));var interaction=require(_0xffd4('0x7'));var config=require(_0xffd4('0x8'));var controller=require('./trunk.controller');router[_0xffd4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xffd4('0x9')](_0xffd4('0xa'),auth['isAuthenticated'](),controller[_0xffd4('0xb')]);router[_0xffd4('0xc')](_0xffd4('0xd'),auth[_0xffd4('0xe')](),controller[_0xffd4('0xf')]);router[_0xffd4('0xc')]('/',auth[_0xffd4('0xe')](),controller['create']);router[_0xffd4('0x10')](_0xffd4('0xa'),auth[_0xffd4('0xe')](),controller[_0xffd4('0x11')]);router[_0xffd4('0x12')](_0xffd4('0xa'),auth[_0xffd4('0xe')](),controller[_0xffd4('0x13')]);module[_0xffd4('0x14')]=router; \ No newline at end of file +var _0x409d=['clone','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0x1d8a5d,_0x59a110){var _0x54d59f=function(_0x54ce10){while(--_0x54ce10){_0x1d8a5d['push'](_0x1d8a5d['shift']());}};_0x54d59f(++_0x59a110);}(_0x409d,0xa0));var _0xd409=function(_0x2adb1b,_0x13221a){_0x2adb1b=_0x2adb1b-0x0;var _0x578cd2=_0x409d[_0x2adb1b];return _0x578cd2;};'use strict';var multer=require(_0xd409('0x0'));var util=require(_0xd409('0x1'));var path=require(_0xd409('0x2'));var timeout=require(_0xd409('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd409('0x4'));var auth=require(_0xd409('0x5'));var interaction=require(_0xd409('0x6'));var config=require(_0xd409('0x7'));var controller=require(_0xd409('0x8'));router[_0xd409('0x9')]('/',auth[_0xd409('0xa')](),controller[_0xd409('0xb')]);router[_0xd409('0x9')](_0xd409('0xc'),auth[_0xd409('0xa')](),controller[_0xd409('0xd')]);router[_0xd409('0xe')](_0xd409('0xf'),auth[_0xd409('0xa')](),controller[_0xd409('0x10')]);router[_0xd409('0xe')]('/',auth['isAuthenticated'](),controller[_0xd409('0x11')]);router[_0xd409('0x12')](_0xd409('0xc'),auth[_0xd409('0xa')](),controller[_0xd409('0x13')]);router[_0xd409('0x14')](_0xd409('0xc'),auth[_0xd409('0xa')](),controller['destroy']);module[_0xd409('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2375bb8..29327e3 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 _0x3833=['refuse','originate','uas','pai','fingerprint','certificate','passive','actpass','update,nonat','sequelize','exports','STRING','name','friend','user','peer','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','accept'];(function(_0x2285ee,_0x2c3c72){var _0x515e52=function(_0x381b4c){while(--_0x381b4c){_0x2285ee['push'](_0x2285ee['shift']());}};_0x515e52(++_0x2c3c72);}(_0x3833,0xfe));var _0x3383=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3833[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x3383('0x0'));module[_0x3383('0x1')]={'name':{'type':Sequelize[_0x3383('0x2')],'allowNull':![],'unique':_0x3383('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x3383('0x4'),_0x3383('0x5'),_0x3383('0x6')),'allowNull':![],'defaultValue':_0x3383('0x4')},'context':{'type':Sequelize[_0x3383('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3383('0x7')]('ALLOWED_NOT_SCREENED',_0x3383('0x8'),_0x3383('0x9'),_0x3383('0xa'),_0x3383('0xb'),_0x3383('0xc'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x3383('0x2')]},'permit':{'type':Sequelize[_0x3383('0x2')]},'secret':{'type':Sequelize[_0x3383('0x2')]},'md5secret':{'type':Sequelize[_0x3383('0x2')]},'remotesecret':{'type':Sequelize[_0x3383('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x5185fc){this[_0x3383('0xd')](_0x3383('0xe'),_0x5185fc?_0x5185fc[_0x3383('0xf')](','):null);},'get':function(){return this[_0x3383('0x10')](_0x3383('0xe'))?this[_0x3383('0x10')](_0x3383('0xe'))[_0x3383('0x11')](','):null;},'comment':_0x3383('0x12')},'dtmfmode':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x13'),'info',_0x3383('0x14'),_0x3383('0x15'),_0x3383('0x16')),'defaultValue':_0x3383('0x13')},'directmedia':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no',_0x3383('0x18'),_0x3383('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3383('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x3383('0x2')]},'nat':{'type':Sequelize[_0x3383('0x2')],'defaultValue':_0x3383('0x1a'),'set':function(_0x460c5c){this[_0x3383('0xd')](_0x3383('0x1b'),_0x460c5c?_0x460c5c[_0x3383('0xf')](','):null);},'get':function(){return this[_0x3383('0x10')](_0x3383('0x1b'))?this[_0x3383('0x10')](_0x3383('0x1b'))['split'](','):null;},'comment':_0x3383('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x3383('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3383('0x2')]},'language':{'type':Sequelize[_0x3383('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3383('0x2')],'defaultValue':_0x3383('0x1d')},'allow':{'type':Sequelize[_0x3383('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x20bfcc){this[_0x3383('0xd')](_0x3383('0x1e'),_0x20bfcc?_0x20bfcc[_0x3383('0xf')](';'):_0x3383('0x1f'));},'get':function(){return this[_0x3383('0x10')](_0x3383('0x1e'))?this[_0x3383('0x10')]('allow')[_0x3383('0x11')](';'):null;},'comment':_0x3383('0x20')},'autoframing':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no')},'insecure':{'type':Sequelize[_0x3383('0x2')],'defaultValue':_0x3383('0x21'),'set':function(_0x1ccbdd){this['setDataValue']('insecure',_0x1ccbdd?_0x1ccbdd[_0x3383('0xf')](','):null);},'get':function(){return this[_0x3383('0x10')](_0x3383('0x22'))?this[_0x3383('0x10')](_0x3383('0x22'))['split'](','):null;},'comment':_0x3383('0x23')},'trustrpid':{'type':Sequelize[_0x3383('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3383('0x7')]('yes','no',_0x3383('0x24'))},'promiscredir':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3383('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x3383('0x25')},'amaflags':{'type':Sequelize[_0x3383('0x2')]},'callcounter':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no'),'defaultValue':_0x3383('0x17')},'busylevel':{'type':Sequelize[_0x3383('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x3383('0x7')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x3383('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3383('0x7')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x3383('0x2')]},'template':{'type':Sequelize[_0x3383('0x2')]},'videosupport':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3383('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no')},'mailbox':{'type':Sequelize[_0x3383('0x2')]},'session_timers':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x27'),_0x3383('0x28'),_0x3383('0x29'))},'session_expires':{'type':Sequelize[_0x3383('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x3383('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x3383('0x2a')),'defaultValue':_0x3383('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x3383('0x2')]},'regexten':{'type':Sequelize[_0x3383('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x3383('0x2')]},'port':{'type':Sequelize[_0x3383('0x26')](0x5)},'qualify':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no'),'defaultValue':_0x3383('0x17')},'keepalive':{'type':Sequelize[_0x3383('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x3383('0x2')]},'defaultuser':{'type':Sequelize[_0x3383('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3383('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x3383('0x17'),'no',_0x3383('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3383('0x2')]},'callbackextension':{'type':Sequelize[_0x3383('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x3383('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x3383('0x2')]},'maxforwards':{'type':Sequelize[_0x3383('0x26')](0xb)},'encryption':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no')},'force_avp':{'type':Sequelize[_0x3383('0x7')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x3383('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no',_0x3383('0x2c'),_0x3383('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x3383('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3383('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3383('0x2')]},'dtlscipher':{'type':Sequelize[_0x3383('0x2')]},'dtlscafile':{'type':Sequelize[_0x3383('0x2')]},'dtlscapath':{'type':Sequelize[_0x3383('0x2')]},'dtlssetup':{'type':Sequelize[_0x3383('0x7')]('active',_0x3383('0x2e'),_0x3383('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3383('0x2')]},'usereqphone':{'type':Sequelize[_0x3383('0x7')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3383('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x3383('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x3383('0x7')]('yes','no')},'vmexten':{'type':Sequelize[_0x3383('0x2')]},'mohinterpret':{'type':Sequelize[_0x3383('0x2')]},'mohsuggest':{'type':Sequelize[_0x3383('0x2')]},'parkinglot':{'type':Sequelize[_0x3383('0x2')]},'description':{'type':Sequelize[_0x3383('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x3383('0x7')](_0x3383('0x17'),'no',_0x3383('0x18'),_0x3383('0x19'),_0x3383('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x3383('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x2561=['force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','originate','INTEGER','uac','uas','pai','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','exports','STRING','name','ENUM','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','update','outgoing'];(function(_0x40e357,_0x369b6f){var _0x1014d3=function(_0x16d6df){while(--_0x16d6df){_0x40e357['push'](_0x40e357['shift']());}};_0x1014d3(++_0x369b6f);}(_0x2561,0x1e2));var _0x1256=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2561[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x1256('0x0')]={'name':{'type':Sequelize[_0x1256('0x1')],'allowNull':![],'unique':_0x1256('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1256('0x3')]('friend',_0x1256('0x4'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1256('0x1')],'allowNull':![],'defaultValue':_0x1256('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x1256('0x6'),'ALLOWED_PASSED_SCREEN',_0x1256('0x7'),_0x1256('0x8'),_0x1256('0x9'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x1256('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x1256('0x1')],'defaultValue':_0x1256('0xa'),'set':function(_0x79c24b){this[_0x1256('0xb')](_0x1256('0xc'),_0x79c24b?_0x79c24b['join'](','):null);},'get':function(){return this[_0x1256('0xd')](_0x1256('0xc'))?this[_0x1256('0xd')](_0x1256('0xc'))[_0x1256('0xe')](','):null;},'comment':_0x1256('0xf')},'dtmfmode':{'type':Sequelize[_0x1256('0x3')]('rfc2833',_0x1256('0x10'),_0x1256('0x11'),_0x1256('0x12'),_0x1256('0x13')),'defaultValue':_0x1256('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x1256('0x15'),'no','nonat',_0x1256('0x16'),_0x1256('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1256('0x1')]},'directmediadeny':{'type':Sequelize[_0x1256('0x1')]},'nat':{'type':Sequelize[_0x1256('0x1')],'defaultValue':_0x1256('0x18'),'set':function(_0x1a139d){this[_0x1256('0xb')]('nat',_0x1a139d?_0x1a139d[_0x1256('0x19')](','):null);},'get':function(){return this[_0x1256('0xd')](_0x1256('0x1a'))?this[_0x1256('0xd')](_0x1256('0x1a'))['split'](','):null;},'comment':_0x1256('0x1b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1256('0x1')]},'pickupgroup':{'type':Sequelize[_0x1256('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x1256('0x1')]},'language':{'type':Sequelize[_0x1256('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1256('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1256('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x1256('0x1')],'allowNull':![],'defaultValue':_0x1256('0x1c'),'set':function(_0x1ea1e4){this[_0x1256('0xb')](_0x1256('0x1d'),_0x1ea1e4?_0x1ea1e4[_0x1256('0x19')](';'):_0x1256('0x1c'));},'get':function(){return this['getDataValue'](_0x1256('0x1d'))?this[_0x1256('0xd')]('allow')[_0x1256('0xe')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1256('0x15'),'no')},'insecure':{'type':Sequelize[_0x1256('0x1')],'defaultValue':_0x1256('0x1e'),'set':function(_0x31fa0f){this[_0x1256('0xb')](_0x1256('0x1f'),_0x31fa0f?_0x31fa0f[_0x1256('0x19')](','):null);},'get':function(){return this[_0x1256('0xd')](_0x1256('0x1f'))?this[_0x1256('0xd')](_0x1256('0x1f'))[_0x1256('0xe')](','):null;},'comment':_0x1256('0x20')},'trustrpid':{'type':Sequelize[_0x1256('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x1256('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1256('0x15'),'no','never')},'promiscredir':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1256('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1256('0x1')]},'callcounter':{'type':Sequelize[_0x1256('0x3')]('yes','no'),'defaultValue':_0x1256('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1256('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x1256('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1256('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x1256('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x1256('0x3')]('yes','no',_0x1256('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1256('0x15'),'no')},'mailbox':{'type':Sequelize[_0x1256('0x1')]},'session_timers':{'type':Sequelize[_0x1256('0x3')]('accept','refuse',_0x1256('0x22'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x1256('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x24'),_0x1256('0x25')),'defaultValue':_0x1256('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0x1256('0x1')]},'regexten':{'type':Sequelize[_0x1256('0x1')]},'fromdomain':{'type':Sequelize[_0x1256('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1256('0x23')](0x5)},'qualify':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no'),'defaultValue':_0x1256('0x15')},'keepalive':{'type':Sequelize[_0x1256('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x1256('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x1256('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1256('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x1256('0x3')]('yes','no',_0x1256('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1256('0x1')]},'callbackextension':{'type':Sequelize[_0x1256('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x1256('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1256('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x1256('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x1256('0x1')]},'maxforwards':{'type':Sequelize[_0x1256('0x23')](0xb)},'encryption':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no')},'force_avp':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x1256('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no',_0x1256('0x27'),_0x1256('0x28'))},'dtlsrekey':{'type':Sequelize[_0x1256('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1256('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x1256('0x1')]},'dtlssetup':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x29'),_0x1256('0x2a'),_0x1256('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x1256('0x1')]},'call_limit':{'type':Sequelize[_0x1256('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1256('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1256('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x1256('0x1')]},'description':{'type':Sequelize[_0x1256('0x1')]},'host':{'type':Sequelize[_0x1256('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x1256('0x3')](_0x1256('0x15'),'no',_0x1256('0x2c'),'update',_0x1256('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x1256('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1256('0x1')],'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 2d1482b..6204eff 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x320596,_0x57dd75){var _0x1dbde8=function(_0x1b7e2a){while(--_0x1b7e2a){_0x320596['push'](_0x320596['shift']());}};_0x1dbde8(++_0x57dd75);}(_0xe14d,0x1ee));var _0xde14=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe14d[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file +var _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0x4b84[_0x3b16e1];return _0x311d1b;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 46fe50e..84c3046 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 _0x65a9=['rimraf','./trunk.attributes','exports','Trunk','tools_trunks','api','moment','bluebird','request-promise','path'];(function(_0x3a4221,_0x459e63){var _0x54fd91=function(_0x5eb418){while(--_0x5eb418){_0x3a4221['push'](_0x3a4221['shift']());}};_0x54fd91(++_0x459e63);}(_0x65a9,0x109));var _0x965a=function(_0x52007e,_0x332a29){_0x52007e=_0x52007e-0x0;var _0x2de4bc=_0x65a9[_0x52007e];return _0x2de4bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x965a('0x0'));var moment=require(_0x965a('0x1'));var BPromise=require(_0x965a('0x2'));var rp=require(_0x965a('0x3'));var fs=require('fs');var path=require(_0x965a('0x4'));var rimraf=require(_0x965a('0x5'));var config=require('../../config/environment');var attributes=require(_0x965a('0x6'));module[_0x965a('0x7')]=function(_0x27d24d,_0x5c2e8d){return _0x27d24d['define'](_0x965a('0x8'),attributes,{'tableName':_0x965a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1ae=['../../config/logger','api','moment','bluebird','path','rimraf','exports','define','Trunk','util'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0xe1ae,0x95));var _0xee1a=function(_0xf5fbb7,_0xdb7f69){_0xf5fbb7=_0xf5fbb7-0x0;var _0x330d55=_0xe1ae[_0xf5fbb7];return _0x330d55;};'use strict';var _=require('lodash');var util=require(_0xee1a('0x0'));var logger=require(_0xee1a('0x1'))(_0xee1a('0x2'));var moment=require(_0xee1a('0x3'));var BPromise=require(_0xee1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee1a('0x5'));var rimraf=require(_0xee1a('0x6'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xee1a('0x7')]=function(_0x3042c9,_0x1f9348){return _0x3042c9[_0xee1a('0x8')](_0xee1a('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index df8b8f1..ede193f 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 _0xf3f7=['map','model','attributes','then','stringify','find','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include'];(function(_0x12aa27,_0x35adbd){var _0x447f68=function(_0x5142c1){while(--_0x5142c1){_0x12aa27['push'](_0x12aa27['shift']());}};_0x447f68(++_0x35adbd);}(_0xf3f7,0x1c3));var _0x7f3f=function(_0x2802e0,_0x183281){_0x2802e0=_0x2802e0-0x0;var _0x25f0fc=_0xf3f7[_0x2802e0];return _0x25f0fc;};'use strict';var _=require(_0x7f3f('0x0'));var util=require(_0x7f3f('0x1'));var moment=require(_0x7f3f('0x2'));var BPromise=require(_0x7f3f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f3f('0x4'));var db=require(_0x7f3f('0x5'))['db'];var utils=require(_0x7f3f('0x6'));var logger=require(_0x7f3f('0x7'))(_0x7f3f('0x8'));var config=require('../../config/environment');var jayson=require(_0x7f3f('0x9'));var client=jayson[_0x7f3f('0xa')][_0x7f3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c86a4,_0x295a59,_0x5937c7){return new BPromise(function(_0xdaf72,_0xe8ba91){return client[_0x7f3f('0xc')](_0x1c86a4,_0x5937c7)['then'](function(_0x490054){logger[_0x7f3f('0xd')](_0x7f3f('0xe'),_0x295a59,_0x7f3f('0xf'));logger[_0x7f3f('0x10')](_0x7f3f('0x11'),_0x295a59,_0x7f3f('0xf'),JSON['stringify'](_0x490054));if(_0x490054[_0x7f3f('0x12')]){if(_0x490054[_0x7f3f('0x12')][_0x7f3f('0x13')]===0x1f4){logger[_0x7f3f('0x12')]('Trunk,\x20%s,\x20%s',_0x295a59,_0x490054[_0x7f3f('0x12')][_0x7f3f('0x14')]);return _0xe8ba91(_0x490054[_0x7f3f('0x12')]['message']);}logger[_0x7f3f('0x12')](_0x7f3f('0xe'),_0x295a59,_0x490054[_0x7f3f('0x12')][_0x7f3f('0x14')]);return _0xdaf72(_0x490054[_0x7f3f('0x12')][_0x7f3f('0x14')]);}else{logger[_0x7f3f('0xd')](_0x7f3f('0xe'),_0x295a59,_0x7f3f('0xf'));_0xdaf72(_0x490054['result']['message']);}})[_0x7f3f('0x15')](function(_0x4d802f){logger[_0x7f3f('0x12')](_0x7f3f('0xe'),_0x295a59,_0x4d802f);_0xe8ba91(_0x4d802f);});});}exports[_0x7f3f('0x16')]=function(_0x10b3eb){var _0x5ab821=this;return new Promise(function(_0x1500da,_0x349ed3){return db[_0x7f3f('0x17')][_0x7f3f('0x18')]({'raw':_0x10b3eb[_0x7f3f('0x19')]?_0x10b3eb[_0x7f3f('0x19')][_0x7f3f('0x1a')]===undefined?!![]:![]:!![],'where':_0x10b3eb[_0x7f3f('0x19')]?_0x10b3eb[_0x7f3f('0x19')][_0x7f3f('0x1b')]||null:null,'attributes':_0x10b3eb['options']?_0x10b3eb[_0x7f3f('0x19')]['attributes']||null:null,'limit':_0x10b3eb[_0x7f3f('0x19')]?_0x10b3eb[_0x7f3f('0x19')][_0x7f3f('0x1c')]||null:null,'include':_0x10b3eb[_0x7f3f('0x19')]?_0x10b3eb['options'][_0x7f3f('0x1d')]?_[_0x7f3f('0x1e')](_0x10b3eb[_0x7f3f('0x19')][_0x7f3f('0x1d')],function(_0x741115){return{'model':db[_0x741115[_0x7f3f('0x1f')]],'as':_0x741115['as'],'attributes':_0x741115[_0x7f3f('0x20')],'include':_0x741115[_0x7f3f('0x1d')]?_[_0x7f3f('0x1e')](_0x741115[_0x7f3f('0x1d')],function(_0x37d5de){return{'model':db[_0x37d5de[_0x7f3f('0x1f')]],'as':_0x37d5de['as'],'attributes':_0x37d5de[_0x7f3f('0x20')],'include':_0x37d5de[_0x7f3f('0x1d')]?_[_0x7f3f('0x1e')](_0x37d5de[_0x7f3f('0x1d')],function(_0x15c97d){return{'model':db[_0x15c97d[_0x7f3f('0x1f')]],'as':_0x15c97d['as'],'attributes':_0x15c97d[_0x7f3f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7f3f('0x21')](function(_0x4e2fbd){logger[_0x7f3f('0xd')](_0x7f3f('0x16'),_0x10b3eb);logger[_0x7f3f('0x10')](_0x7f3f('0x16'),_0x10b3eb,JSON[_0x7f3f('0x22')](_0x4e2fbd));_0x1500da(_0x4e2fbd);})[_0x7f3f('0x15')](function(_0x4fd1ad){logger[_0x7f3f('0x12')](_0x7f3f('0x16'),_0x4fd1ad['message'],_0x10b3eb);_0x349ed3(_0x5ab821[_0x7f3f('0x12')](0x1f4,_0x4fd1ad[_0x7f3f('0x14')]));});});};exports['ShowTrunk']=function(_0x35c21f){var _0xe23455=this;return new Promise(function(_0x3634d6,_0x1546ff){return db['Trunk'][_0x7f3f('0x23')]({'raw':_0x35c21f[_0x7f3f('0x19')]?_0x35c21f[_0x7f3f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x35c21f[_0x7f3f('0x19')]?_0x35c21f[_0x7f3f('0x19')]['where']||null:null,'attributes':_0x35c21f[_0x7f3f('0x19')]?_0x35c21f[_0x7f3f('0x19')][_0x7f3f('0x20')]||null:null,'include':_0x35c21f['options']?_0x35c21f[_0x7f3f('0x19')]['include']?_[_0x7f3f('0x1e')](_0x35c21f['options'][_0x7f3f('0x1d')],function(_0x43220c){return{'model':db[_0x43220c['model']],'as':_0x43220c['as'],'attributes':_0x43220c[_0x7f3f('0x20')],'include':_0x43220c[_0x7f3f('0x1d')]?_['map'](_0x43220c[_0x7f3f('0x1d')],function(_0x15d101){return{'model':db[_0x15d101[_0x7f3f('0x1f')]],'as':_0x15d101['as'],'attributes':_0x15d101[_0x7f3f('0x20')],'include':_0x15d101[_0x7f3f('0x1d')]?_['map'](_0x15d101[_0x7f3f('0x1d')],function(_0x1da001){return{'model':db[_0x1da001[_0x7f3f('0x1f')]],'as':_0x1da001['as'],'attributes':_0x1da001[_0x7f3f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x127b83){logger[_0x7f3f('0xd')](_0x7f3f('0x24'),_0x35c21f);logger[_0x7f3f('0x10')](_0x7f3f('0x24'),_0x35c21f,JSON[_0x7f3f('0x22')](_0x127b83));_0x3634d6(_0x127b83);})['catch'](function(_0x76c46f){logger[_0x7f3f('0x12')](_0x7f3f('0x24'),_0x76c46f[_0x7f3f('0x14')],_0x35c21f);_0x1546ff(_0xe23455['error'](0x1f4,_0x76c46f['message']));});});}; \ No newline at end of file +var _0xfc93=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Trunk','findAll','options','attributes','include','map','model','GetTrunk','find','raw','where','catch','ShowTrunk','lodash','moment','bluebird'];(function(_0x4ba54b,_0x46f4de){var _0x364bfe=function(_0xe601b3){while(--_0xe601b3){_0x4ba54b['push'](_0x4ba54b['shift']());}};_0x364bfe(++_0x46f4de);}(_0xfc93,0x66));var _0x3fc9=function(_0x360671,_0x170219){_0x360671=_0x360671-0x0;var _0x5e13b0=_0xfc93[_0x360671];return _0x5e13b0;};'use strict';var _=require(_0x3fc9('0x0'));var util=require('util');var moment=require(_0x3fc9('0x1'));var BPromise=require(_0x3fc9('0x2'));var rs=require(_0x3fc9('0x3'));var fs=require('fs');var Redis=require(_0x3fc9('0x4'));var db=require(_0x3fc9('0x5'))['db'];var utils=require(_0x3fc9('0x6'));var logger=require(_0x3fc9('0x7'))('rpc');var config=require(_0x3fc9('0x8'));var jayson=require(_0x3fc9('0x9'));var client=jayson[_0x3fc9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34dbae,_0xa2f6a2,_0x343cbf){return new BPromise(function(_0x27b728,_0x58a852){return client['request'](_0x34dbae,_0x343cbf)[_0x3fc9('0xb')](function(_0x4b9e0b){logger[_0x3fc9('0xc')](_0x3fc9('0xd'),_0xa2f6a2,_0x3fc9('0xe'));logger[_0x3fc9('0xf')](_0x3fc9('0x10'),_0xa2f6a2,_0x3fc9('0xe'),JSON[_0x3fc9('0x11')](_0x4b9e0b));if(_0x4b9e0b[_0x3fc9('0x12')]){if(_0x4b9e0b[_0x3fc9('0x12')][_0x3fc9('0x13')]===0x1f4){logger[_0x3fc9('0x12')](_0x3fc9('0xd'),_0xa2f6a2,_0x4b9e0b[_0x3fc9('0x12')][_0x3fc9('0x14')]);return _0x58a852(_0x4b9e0b['error']['message']);}logger[_0x3fc9('0x12')](_0x3fc9('0xd'),_0xa2f6a2,_0x4b9e0b[_0x3fc9('0x12')][_0x3fc9('0x14')]);return _0x27b728(_0x4b9e0b['error'][_0x3fc9('0x14')]);}else{logger['info'](_0x3fc9('0xd'),_0xa2f6a2,_0x3fc9('0xe'));_0x27b728(_0x4b9e0b[_0x3fc9('0x15')][_0x3fc9('0x14')]);}})['catch'](function(_0x2a5bcb){logger[_0x3fc9('0x12')](_0x3fc9('0xd'),_0xa2f6a2,_0x2a5bcb);_0x58a852(_0x2a5bcb);});});}exports['GetTrunk']=function(_0x52f389){var _0x4c4731=this;return new Promise(function(_0x1cf955,_0x5c8cbe){return db[_0x3fc9('0x16')][_0x3fc9('0x17')]({'raw':_0x52f389[_0x3fc9('0x18')]?_0x52f389[_0x3fc9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x52f389[_0x3fc9('0x18')]?_0x52f389[_0x3fc9('0x18')]['where']||null:null,'attributes':_0x52f389[_0x3fc9('0x18')]?_0x52f389[_0x3fc9('0x18')][_0x3fc9('0x19')]||null:null,'limit':_0x52f389['options']?_0x52f389[_0x3fc9('0x18')]['limit']||null:null,'include':_0x52f389[_0x3fc9('0x18')]?_0x52f389[_0x3fc9('0x18')][_0x3fc9('0x1a')]?_[_0x3fc9('0x1b')](_0x52f389[_0x3fc9('0x18')][_0x3fc9('0x1a')],function(_0x4f7086){return{'model':db[_0x4f7086[_0x3fc9('0x1c')]],'as':_0x4f7086['as'],'attributes':_0x4f7086['attributes'],'include':_0x4f7086[_0x3fc9('0x1a')]?_[_0x3fc9('0x1b')](_0x4f7086[_0x3fc9('0x1a')],function(_0x559fea){return{'model':db[_0x559fea['model']],'as':_0x559fea['as'],'attributes':_0x559fea[_0x3fc9('0x19')],'include':_0x559fea[_0x3fc9('0x1a')]?_[_0x3fc9('0x1b')](_0x559fea[_0x3fc9('0x1a')],function(_0x56a523){return{'model':db[_0x56a523['model']],'as':_0x56a523['as'],'attributes':_0x56a523[_0x3fc9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3fc9('0xb')](function(_0x10acc1){logger[_0x3fc9('0xc')](_0x3fc9('0x1d'),_0x52f389);logger[_0x3fc9('0xf')](_0x3fc9('0x1d'),_0x52f389,JSON[_0x3fc9('0x11')](_0x10acc1));_0x1cf955(_0x10acc1);})['catch'](function(_0x4322be){logger[_0x3fc9('0x12')](_0x3fc9('0x1d'),_0x4322be[_0x3fc9('0x14')],_0x52f389);_0x5c8cbe(_0x4c4731[_0x3fc9('0x12')](0x1f4,_0x4322be[_0x3fc9('0x14')]));});});};exports['ShowTrunk']=function(_0x365d43){var _0x538891=this;return new Promise(function(_0x26c7cc,_0x325218){return db[_0x3fc9('0x16')][_0x3fc9('0x1e')]({'raw':_0x365d43[_0x3fc9('0x18')]?_0x365d43['options'][_0x3fc9('0x1f')]===undefined?!![]:![]:!![],'where':_0x365d43[_0x3fc9('0x18')]?_0x365d43[_0x3fc9('0x18')][_0x3fc9('0x20')]||null:null,'attributes':_0x365d43[_0x3fc9('0x18')]?_0x365d43[_0x3fc9('0x18')][_0x3fc9('0x19')]||null:null,'include':_0x365d43[_0x3fc9('0x18')]?_0x365d43[_0x3fc9('0x18')][_0x3fc9('0x1a')]?_[_0x3fc9('0x1b')](_0x365d43[_0x3fc9('0x18')][_0x3fc9('0x1a')],function(_0x15709a){return{'model':db[_0x15709a['model']],'as':_0x15709a['as'],'attributes':_0x15709a['attributes'],'include':_0x15709a[_0x3fc9('0x1a')]?_[_0x3fc9('0x1b')](_0x15709a[_0x3fc9('0x1a')],function(_0x59297e){return{'model':db[_0x59297e[_0x3fc9('0x1c')]],'as':_0x59297e['as'],'attributes':_0x59297e[_0x3fc9('0x19')],'include':_0x59297e[_0x3fc9('0x1a')]?_[_0x3fc9('0x1b')](_0x59297e['include'],function(_0xdb80ad){return{'model':db[_0xdb80ad[_0x3fc9('0x1c')]],'as':_0xdb80ad['as'],'attributes':_0xdb80ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x3fc9('0xb')](function(_0x2fe676){logger[_0x3fc9('0xc')]('ShowTrunk',_0x365d43);logger[_0x3fc9('0xf')]('ShowTrunk',_0x365d43,JSON[_0x3fc9('0x11')](_0x2fe676));_0x26c7cc(_0x2fe676);})[_0x3fc9('0x21')](function(_0x3e2083){logger[_0x3fc9('0x12')](_0x3fc9('0x22'),_0x3e2083[_0x3fc9('0x14')],_0x365d43);_0x325218(_0x538891[_0x3fc9('0x12')](0x1f4,_0x3e2083['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 67721c5..add8dc8 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 _0x0df5=['pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','/:id/api_key','createApiKey','put','/:id','update','/:id/password','changePassword','removeQueues','delete','/:id/teams','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getApiKey','post','addContacts','create','/:id/queues','diskStorage','join','server/files/images/','format','%s-%s','now','single','addAvatar','login','/:id/logout','logout'];(function(_0xff5773,_0x4d060c){var _0x4884d1=function(_0xacc614){while(--_0xacc614){_0xff5773['push'](_0xff5773['shift']());}};_0x4884d1(++_0x4d060c);}(_0x0df5,0x1ec));var _0x50df=function(_0x515175,_0x5821bd){_0x515175=_0x515175-0x0;var _0x11afed=_0x0df5[_0x515175];return _0x11afed;};'use strict';var multer=require(_0x50df('0x0'));var util=require(_0x50df('0x1'));var path=require('path');var timeout=require(_0x50df('0x2'));var express=require(_0x50df('0x3'));var router=express[_0x50df('0x4')]();var fs_extra=require(_0x50df('0x5'));var auth=require(_0x50df('0x6'));var interaction=require(_0x50df('0x7'));var config=require(_0x50df('0x8'));var controller=require(_0x50df('0x9'));router[_0x50df('0xa')]('/',auth['isAuthenticated'](),controller[_0x50df('0xb')]);router[_0x50df('0xa')](_0x50df('0xc'),auth[_0x50df('0xd')](),controller[_0x50df('0xe')]);router[_0x50df('0xa')](_0x50df('0xf'),auth[_0x50df('0xd')](),controller['whoami']);router[_0x50df('0xa')]('/presence',auth['isAuthenticated'](),controller['getPresence']);router['get']('/:id',auth[_0x50df('0xd')](),controller['show']);router[_0x50df('0xa')](_0x50df('0x10'),controller[_0x50df('0x11')]);router['get'](_0x50df('0x12'),auth[_0x50df('0xd')](),controller[_0x50df('0x13')]);router[_0x50df('0xa')](_0x50df('0x14'),auth['isAuthenticated'](),controller[_0x50df('0x15')]);router['get']('/:id/queues',auth[_0x50df('0xd')](),controller[_0x50df('0x16')]);router[_0x50df('0xa')]('/:id/queues_rt',auth[_0x50df('0xd')](),controller[_0x50df('0x17')]);router[_0x50df('0xa')]('/:id/groups',auth[_0x50df('0xd')](),controller[_0x50df('0x18')]);router['get']('/:id/recordings',auth[_0x50df('0xd')](),controller[_0x50df('0x19')]);router[_0x50df('0xa')](_0x50df('0x1a'),auth[_0x50df('0xd')](),controller[_0x50df('0x1b')]);router[_0x50df('0xa')](_0x50df('0x1c'),auth[_0x50df('0xd')](),controller['getChatInteractions']);router[_0x50df('0xa')](_0x50df('0x1d'),auth[_0x50df('0xd')](),controller['getOpenchannelInteractions']);router[_0x50df('0xa')](_0x50df('0x1e'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x50df('0xa')]('/:id/sms/interactions',auth[_0x50df('0xd')](),controller['getSmsInteractions']);router[_0x50df('0xa')](_0x50df('0x1f'),auth[_0x50df('0xd')](),controller[_0x50df('0x20')]);router[_0x50df('0xa')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x50df('0x21')]);router[_0x50df('0xa')]('/:id/teams',auth[_0x50df('0xd')](),controller[_0x50df('0x22')]);router[_0x50df('0xa')](_0x50df('0x23'),auth[_0x50df('0xd')](),controller[_0x50df('0x24')]);router['get'](_0x50df('0x25'),auth[_0x50df('0xd')](),controller[_0x50df('0x26')]);router[_0x50df('0xa')](_0x50df('0x27'),auth['isAuthenticated'](),controller[_0x50df('0x28')]);router[_0x50df('0xa')](_0x50df('0x29'),auth[_0x50df('0xd')](),controller[_0x50df('0x2a')]);router[_0x50df('0xa')]('/:id/mail_accounts',auth[_0x50df('0xd')](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth[_0x50df('0xd')](),controller[_0x50df('0x2b')]);router[_0x50df('0xa')](_0x50df('0x2c'),auth[_0x50df('0xd')](),controller[_0x50df('0x2d')]);router[_0x50df('0xa')](_0x50df('0x2e'),auth[_0x50df('0xd')](),controller['getChatWebsites']);router[_0x50df('0xa')](_0x50df('0x2f'),auth[_0x50df('0xd')](),controller[_0x50df('0x30')]);router[_0x50df('0xa')](_0x50df('0x31'),auth['isAuthenticated'](),controller[_0x50df('0x32')]);router['get'](_0x50df('0x33'),auth[_0x50df('0xd')](),controller['getScheduledCalls']);router[_0x50df('0xa')]('/:id/api_key',auth[_0x50df('0xd')](),controller[_0x50df('0x34')]);router[_0x50df('0x35')](_0x50df('0x14'),auth[_0x50df('0xd')](),controller[_0x50df('0x36')]);router[_0x50df('0x35')]('/',auth['isAuthenticated'](),controller[_0x50df('0x37')]);router[_0x50df('0x35')]('/create_many',auth[_0x50df('0xd')](),controller['bulkCreate']);router['post'](_0x50df('0x38'),auth[_0x50df('0xd')](),controller['addQueues']);var upload=multer({'storage':multer[_0x50df('0x39')]({'destination':function(_0x10b11c,_0x1c043a,_0x37bb4b){_0x37bb4b(null,path[_0x50df('0x3a')](config['root'],_0x50df('0x3b')));},'filename':function(_0x21d503,_0x636998,_0x36ba3c){_0x36ba3c(null,util[_0x50df('0x3c')](_0x50df('0x3d'),Date[_0x50df('0x3e')](),_0x636998['originalname']));}})});router[_0x50df('0x35')]('/:id/avatar',upload[_0x50df('0x3f')]('file'),controller[_0x50df('0x40')]);router[_0x50df('0x35')]('/:id/login',auth[_0x50df('0xd')](),controller[_0x50df('0x41')]);router[_0x50df('0x35')](_0x50df('0x42'),auth[_0x50df('0xd')](),controller[_0x50df('0x43')]);router[_0x50df('0x35')]('/:id/pause',auth[_0x50df('0xd')](),controller[_0x50df('0x44')]);router[_0x50df('0x35')](_0x50df('0x45'),auth['isAuthenticated'](),controller['unpause']);router['post']('/:id/teams',auth[_0x50df('0xd')](),controller[_0x50df('0x46')]);router['post'](_0x50df('0x47'),auth[_0x50df('0xd')](),controller['addChatInteractions']);router[_0x50df('0x35')](_0x50df('0x48'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0x50df('0x49'),auth['isAuthenticated'](),controller[_0x50df('0x4a')]);router[_0x50df('0x35')](_0x50df('0x4b'),auth[_0x50df('0xd')](),controller[_0x50df('0x4c')]);router[_0x50df('0x35')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x50df('0x4d')]);router['post'](_0x50df('0x4e'),auth[_0x50df('0xd')](),controller['addWhatsappInteractions']);router[_0x50df('0x35')](_0x50df('0x29'),auth[_0x50df('0xd')](),controller[_0x50df('0x4f')]);router[_0x50df('0x35')]('/:id/mail_accounts',auth[_0x50df('0xd')](),controller[_0x50df('0x50')]);router[_0x50df('0x35')]('/:id/openchannel_accounts',auth[_0x50df('0xd')](),controller[_0x50df('0x51')]);router[_0x50df('0x35')](_0x50df('0x2c'),auth['isAuthenticated'](),controller[_0x50df('0x52')]);router[_0x50df('0x35')](_0x50df('0x2e'),auth[_0x50df('0xd')](),controller['addChatWebsites']);router[_0x50df('0x35')](_0x50df('0x2f'),auth[_0x50df('0xd')](),controller[_0x50df('0x53')]);router[_0x50df('0x35')]('/:id/square_projects',auth[_0x50df('0xd')](),controller['addSquareProjects']);router['post'](_0x50df('0x54'),auth[_0x50df('0xd')](),controller[_0x50df('0x55')]);router[_0x50df('0x56')](_0x50df('0x57'),auth['isAuthenticated'](),controller[_0x50df('0x58')]);router[_0x50df('0x56')](_0x50df('0x59'),auth[_0x50df('0xd')](),controller[_0x50df('0x5a')]);router['delete'](_0x50df('0x38'),auth[_0x50df('0xd')](),controller[_0x50df('0x5b')]);router[_0x50df('0x5c')](_0x50df('0x5d'),auth[_0x50df('0xd')](),controller[_0x50df('0x5e')]);router['delete']('/:id',auth[_0x50df('0xd')](),controller[_0x50df('0x5f')]);router[_0x50df('0x5c')](_0x50df('0x47'),auth[_0x50df('0xd')](),controller[_0x50df('0x60')]);router[_0x50df('0x5c')](_0x50df('0x48'),auth[_0x50df('0xd')](),controller[_0x50df('0x61')]);router['delete'](_0x50df('0x49'),auth[_0x50df('0xd')](),controller[_0x50df('0x62')]);router['delete']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x50df('0x63')]);router[_0x50df('0x5c')](_0x50df('0x64'),auth[_0x50df('0xd')](),controller[_0x50df('0x65')]);router[_0x50df('0x5c')](_0x50df('0x4e'),auth[_0x50df('0xd')](),controller[_0x50df('0x66')]);router[_0x50df('0x5c')](_0x50df('0x29'),auth[_0x50df('0xd')](),controller[_0x50df('0x67')]);router[_0x50df('0x5c')](_0x50df('0x68'),auth[_0x50df('0xd')](),controller['removeMailAccounts']);router['delete'](_0x50df('0x69'),auth[_0x50df('0xd')](),controller[_0x50df('0x6a')]);router['delete'](_0x50df('0x2c'),auth['isAuthenticated'](),controller[_0x50df('0x6b')]);router['delete']('/:id/chat_websites',auth[_0x50df('0xd')](),controller[_0x50df('0x6c')]);router[_0x50df('0x5c')](_0x50df('0x2f'),auth[_0x50df('0xd')](),controller['removeWhatsappAccounts']);router['delete'](_0x50df('0x31'),auth[_0x50df('0xd')](),controller[_0x50df('0x6d')]);router[_0x50df('0x5c')](_0x50df('0x54'),auth['isAuthenticated'](),controller[_0x50df('0x6e')]);module[_0x50df('0x6f')]=router; \ No newline at end of file +var _0x7f96=['removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','/describe','describe','/whoami','whoami','get','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','bulkCreate','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','/:id/login','login','/:id/pause','pause','/:id/unpause','unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','createApiKey','update','/:id/password','changePassword','delete','removeQueues'];(function(_0x59bf34,_0x9dbfe){var _0x3a323b=function(_0x15e823){while(--_0x15e823){_0x59bf34['push'](_0x59bf34['shift']());}};_0x3a323b(++_0x9dbfe);}(_0x7f96,0xf4));var _0x67f9=function(_0x3ceaa6,_0x3b9978){_0x3ceaa6=_0x3ceaa6-0x0;var _0x199c68=_0x7f96[_0x3ceaa6];return _0x199c68;};'use strict';var multer=require(_0x67f9('0x0'));var util=require(_0x67f9('0x1'));var path=require(_0x67f9('0x2'));var timeout=require(_0x67f9('0x3'));var express=require(_0x67f9('0x4'));var router=express[_0x67f9('0x5')]();var fs_extra=require(_0x67f9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x67f9('0x7'));var config=require(_0x67f9('0x8'));var controller=require(_0x67f9('0x9'));router['get']('/',auth[_0x67f9('0xa')](),controller[_0x67f9('0xb')]);router['get'](_0x67f9('0xc'),auth[_0x67f9('0xa')](),controller[_0x67f9('0xd')]);router['get'](_0x67f9('0xe'),auth[_0x67f9('0xa')](),controller[_0x67f9('0xf')]);router[_0x67f9('0x10')](_0x67f9('0x11'),auth[_0x67f9('0xa')](),controller['getPresence']);router[_0x67f9('0x10')](_0x67f9('0x12'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x13')]);router[_0x67f9('0x10')](_0x67f9('0x14'),controller[_0x67f9('0x15')]);router[_0x67f9('0x10')](_0x67f9('0x16'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x17')]);router['get'](_0x67f9('0x18'),auth[_0x67f9('0xa')](),controller['getContacts']);router['get'](_0x67f9('0x19'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x1a')]);router[_0x67f9('0x10')](_0x67f9('0x1b'),auth[_0x67f9('0xa')](),controller['getVoiceQueuesRt']);router[_0x67f9('0x10')](_0x67f9('0x1c'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x1d')]);router[_0x67f9('0x10')]('/:id/recordings',auth[_0x67f9('0xa')](),controller[_0x67f9('0x1e')]);router[_0x67f9('0x10')](_0x67f9('0x1f'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x20')]);router[_0x67f9('0x10')](_0x67f9('0x21'),auth['isAuthenticated'](),controller[_0x67f9('0x22')]);router[_0x67f9('0x10')](_0x67f9('0x23'),auth[_0x67f9('0xa')](),controller['getOpenchannelInteractions']);router[_0x67f9('0x10')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x67f9('0x24')]);router[_0x67f9('0x10')]('/:id/sms/interactions',auth[_0x67f9('0xa')](),controller[_0x67f9('0x25')]);router['get']('/:id/fax/interactions',auth[_0x67f9('0xa')](),controller['getFaxInteractions']);router['get'](_0x67f9('0x26'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x27')]);router[_0x67f9('0x10')](_0x67f9('0x28'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x29')]);router[_0x67f9('0x10')](_0x67f9('0x2a'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x2b')]);router[_0x67f9('0x10')](_0x67f9('0x2c'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x2d')]);router[_0x67f9('0x10')](_0x67f9('0x2e'),auth[_0x67f9('0xa')](),controller['getVoicePrefixes']);router[_0x67f9('0x10')]('/:id/fax_accounts',auth[_0x67f9('0xa')](),controller[_0x67f9('0x2f')]);router[_0x67f9('0x10')](_0x67f9('0x30'),auth['isAuthenticated'](),controller[_0x67f9('0x31')]);router[_0x67f9('0x10')](_0x67f9('0x32'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x33')]);router[_0x67f9('0x10')]('/:id/sms_accounts',auth[_0x67f9('0xa')](),controller[_0x67f9('0x34')]);router[_0x67f9('0x10')](_0x67f9('0x35'),auth['isAuthenticated'](),controller[_0x67f9('0x36')]);router[_0x67f9('0x10')](_0x67f9('0x37'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x38')]);router[_0x67f9('0x10')](_0x67f9('0x39'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x3a')]);router[_0x67f9('0x10')](_0x67f9('0x3b'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x3c')]);router[_0x67f9('0x10')](_0x67f9('0x3d'),auth['isAuthenticated'](),controller[_0x67f9('0x3e')]);router['post'](_0x67f9('0x18'),auth['isAuthenticated'](),controller['addContacts']);router[_0x67f9('0x3f')]('/',auth['isAuthenticated'](),controller[_0x67f9('0x40')]);router['post']('/create_many',auth[_0x67f9('0xa')](),controller[_0x67f9('0x41')]);router[_0x67f9('0x3f')](_0x67f9('0x19'),auth[_0x67f9('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x67f9('0x42')]({'destination':function(_0x266ac7,_0x3dad98,_0x56961b){_0x56961b(null,path[_0x67f9('0x43')](config[_0x67f9('0x44')],_0x67f9('0x45')));},'filename':function(_0x3e9cde,_0x22736c,_0x48c176){_0x48c176(null,util['format'](_0x67f9('0x46'),Date[_0x67f9('0x47')](),_0x22736c[_0x67f9('0x48')]));}})});router[_0x67f9('0x3f')](_0x67f9('0x14'),upload['single']('file'),controller['addAvatar']);router['post'](_0x67f9('0x49'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x4a')]);router['post']('/:id/logout',auth[_0x67f9('0xa')](),controller['logout']);router[_0x67f9('0x3f')](_0x67f9('0x4b'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x4c')]);router[_0x67f9('0x3f')](_0x67f9('0x4d'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x4e')]);router[_0x67f9('0x3f')](_0x67f9('0x28'),auth[_0x67f9('0xa')](),controller['addTeams']);router[_0x67f9('0x3f')]('/:id/chat_interactions',auth[_0x67f9('0xa')](),controller[_0x67f9('0x4f')]);router['post'](_0x67f9('0x50'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x51')]);router['post'](_0x67f9('0x52'),auth['isAuthenticated'](),controller[_0x67f9('0x53')]);router[_0x67f9('0x3f')]('/:id/sms_interactions',auth[_0x67f9('0xa')](),controller[_0x67f9('0x54')]);router[_0x67f9('0x3f')]('/:id/openchannel_interactions',auth[_0x67f9('0xa')](),controller[_0x67f9('0x55')]);router['post'](_0x67f9('0x56'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x57')]);router[_0x67f9('0x3f')]('/:id/fax_accounts',auth[_0x67f9('0xa')](),controller[_0x67f9('0x58')]);router[_0x67f9('0x3f')](_0x67f9('0x30'),auth['isAuthenticated'](),controller[_0x67f9('0x59')]);router[_0x67f9('0x3f')](_0x67f9('0x32'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x5a')]);router[_0x67f9('0x3f')](_0x67f9('0x5b'),auth[_0x67f9('0xa')](),controller['addSmsAccounts']);router['post'](_0x67f9('0x35'),auth[_0x67f9('0xa')](),controller['addChatWebsites']);router[_0x67f9('0x3f')](_0x67f9('0x37'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x67f9('0x3f')](_0x67f9('0x39'),auth[_0x67f9('0xa')](),controller['addSquareProjects']);router[_0x67f9('0x3f')](_0x67f9('0x3d'),auth['isAuthenticated'](),controller[_0x67f9('0x5c')]);router['put'](_0x67f9('0x12'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x5d')]);router['put'](_0x67f9('0x5e'),auth['isAuthenticated'](),controller[_0x67f9('0x5f')]);router[_0x67f9('0x60')](_0x67f9('0x19'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x61')]);router[_0x67f9('0x60')](_0x67f9('0x28'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x62')]);router['delete'](_0x67f9('0x12'),auth['isAuthenticated'](),controller[_0x67f9('0x63')]);router[_0x67f9('0x60')](_0x67f9('0x64'),auth['isAuthenticated'](),controller[_0x67f9('0x65')]);router['delete']('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x67f9('0x66')]);router[_0x67f9('0x60')](_0x67f9('0x52'),auth['isAuthenticated'](),controller[_0x67f9('0x67')]);router[_0x67f9('0x60')](_0x67f9('0x68'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x69')]);router[_0x67f9('0x60')](_0x67f9('0x6a'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x6b')]);router[_0x67f9('0x60')]('/:id/whatsapp_interactions',auth[_0x67f9('0xa')](),controller['removeWhatsappInteractions']);router[_0x67f9('0x60')]('/:id/fax_accounts',auth[_0x67f9('0xa')](),controller[_0x67f9('0x6c')]);router[_0x67f9('0x60')](_0x67f9('0x30'),auth[_0x67f9('0xa')](),controller['removeMailAccounts']);router['delete'](_0x67f9('0x32'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x6d')]);router['delete'](_0x67f9('0x5b'),auth[_0x67f9('0xa')](),controller['removeSmsAccounts']);router[_0x67f9('0x60')](_0x67f9('0x35'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x6e')]);router['delete'](_0x67f9('0x37'),auth[_0x67f9('0xa')](),controller[_0x67f9('0x6f')]);router[_0x67f9('0x60')]('/:id/square_projects',auth[_0x67f9('0xa')](),controller['removeSquareProjects']);router[_0x67f9('0x60')]('/:id/api_key',auth[_0x67f9('0xa')](),controller[_0x67f9('0x70')]);module[_0x67f9('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6626203..c3d1180 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 _0x36f3=['rfc2833','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','yes','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','wss','encryption','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','force_avp','icesupport','dtlsenable','/etc/pki/tls/private/motion.key','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','user','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','inband'];(function(_0xa2765a,_0xf2376c){var _0x55ca0a=function(_0x366fd0){while(--_0x366fd0){_0xa2765a['push'](_0xa2765a['shift']());}};_0x55ca0a(++_0xf2376c);}(_0x36f3,0xe6));var _0x336f=function(_0x2d17ec,_0x54eb4d){_0x2d17ec=_0x2d17ec-0x0;var _0x162002=_0x36f3[_0x2d17ec];return _0x162002;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x336f('0x0'));var util=require(_0x336f('0x1'));var _=require(_0x336f('0x2'));module[_0x336f('0x3')]={'name':{'type':Sequelize[_0x336f('0x4')],'allowNull':![],'unique':_0x336f('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xd7d95a){this[_0x336f('0x6')](_0x336f('0x5'),_0xd7d95a);this['setDataValue'](_0x336f('0x7'),_0xd7d95a);},'comment':_0x336f('0x8')},'fullname':{'type':Sequelize[_0x336f('0x4')],'allowNull':![],'set':function(_0x4ef72f){this['setDataValue'](_0x336f('0x9'),_0x4ef72f);this[_0x336f('0x6')](_0x336f('0xa'),util[_0x336f('0xb')](_0x336f('0xc'),_0x4ef72f,this[_0x336f('0xd')](_0x336f('0xe'))));}},'alias':{'type':Sequelize[_0x336f('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x336f('0xf'),'validate':{'isEmail':!![]},'set':function(_0x3dff4a){if(_0x3dff4a){this[_0x336f('0x6')](_0x336f('0xf'),_0x3dff4a['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x336f('0x10'),'user',_0x336f('0x11'),_0x336f('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x336f('0x4')],'defaultValue':_0x336f('0x13')},'internal':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':![],'unique':_0x336f('0xe'),'set':function(_0x12c5e0){this[_0x336f('0x6')](_0x336f('0xe'),_0x12c5e0);this['setDataValue'](_0x336f('0x15'),_0x12c5e0);this[_0x336f('0x6')](_0x336f('0xa'),util[_0x336f('0xb')]('\x22%s\x22\x20<%s>',this[_0x336f('0xd')](_0x336f('0x9')),_0x12c5e0));}},'salt':{'type':Sequelize[_0x336f('0x4')]},'phone':{'type':Sequelize[_0x336f('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x336f('0x4')]},'zipcode':{'type':Sequelize[_0x336f('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x336f('0x4')]},'country':{'type':Sequelize[_0x336f('0x4')]},'online':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x336f('0x17')},'lastPauseAt':{'type':Sequelize[_0x336f('0x18')]},'chatCapacity':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x336f('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x336f('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x336f('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x336f('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x336f('0x19'),_0x336f('0x1a'),_0x336f('0x1b')),'allowNull':!![],'defaultValue':_0x336f('0x19')},'context':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![],'defaultValue':_0x336f('0x1c')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x336f('0x1d'),_0x336f('0x1e'),_0x336f('0x1f'),_0x336f('0x20'),_0x336f('0x21'),_0x336f('0x22'),_0x336f('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x336f('0x24'),'set':function(_0x35d46e){this['setDataValue'](_0x336f('0x25'),_0x35d46e?_0x35d46e[_0x336f('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x336f('0x25'))?this[_0x336f('0xd')](_0x336f('0x25'))[_0x336f('0x27')](','):null;},'comment':_0x336f('0x28')},'dtmfmode':{'type':Sequelize[_0x336f('0x29')]('rfc2833','info','shortinfo',_0x336f('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0x336f('0x2b')},'directmedia':{'type':Sequelize[_0x336f('0x29')]('yes','no',_0x336f('0x2c'),_0x336f('0x2d'),_0x336f('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x336f('0x29')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x5eaa7a){this['setDataValue'](_0x336f('0x2f'),_0x5eaa7a?_0x5eaa7a[_0x336f('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x336f('0x2f'))?this['getDataValue']('nat')[_0x336f('0x27')](','):null;},'comment':_0x336f('0x30')},'callgroup':{'type':Sequelize[_0x336f('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x336f('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x336f('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x336f('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x442dae){this['setDataValue'](_0x336f('0x31'),_0x442dae?_0x442dae[_0x336f('0x26')](';'):_0x336f('0x32'));},'get':function(){return this[_0x336f('0xd')](_0x336f('0x31'))?this[_0x336f('0xd')](_0x336f('0x31'))[_0x336f('0x27')](';'):null;},'comment':_0x336f('0x33')},'autoframing':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![],'set':function(_0x1ad4de){this['setDataValue'](_0x336f('0x35'),_0x1ad4de?_0x1ad4de[_0x336f('0x26')](','):null);},'get':function(){return this[_0x336f('0xd')]('insecure')?this[_0x336f('0xd')](_0x336f('0x35'))[_0x336f('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x336f('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no',_0x336f('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x336f('0x29')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![],'defaultValue':_0x336f('0x37')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x336f('0x29')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x336f('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x39'),_0x336f('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x3b'),_0x336f('0x3c')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![],'defaultValue':_0x336f('0x34')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x336f('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no',_0x336f('0x3d'),_0x336f('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x3f'),_0x336f('0x40'),_0x336f('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x336f('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x336f('0x34'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x336f('0x34'),'no',_0x336f('0x2c'),_0x336f('0x2d'),_0x336f('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x336f('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x336f('0x18')]},'passwordResetAt':{'type':Sequelize[_0x336f('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0,'set':function(_0x522003){this['setDataValue'](_0x336f('0x43'),_0x522003);var _0x398e52=this[_0x336f('0x44')]({'plain':!![]});switch(_0x522003){case 0x0:case 0x1:var _0x4a0e7a=_0x398e52[_0x336f('0x25')]?_[_0x336f('0x45')](_0x398e52[_0x336f('0x25')])?_0x398e52['transport']['join']():_0x398e52[_0x336f('0x25')]:_0x336f('0x24');if(_0x4a0e7a===_0x336f('0x46')){_0x4a0e7a=_0x336f('0x24');}this[_0x336f('0x6')]('transport',_0x4a0e7a);this[_0x336f('0x6')](_0x336f('0x47'),'no');this[_0x336f('0x6')]('avpf',null);this[_0x336f('0x6')]('force_avp',null);this[_0x336f('0x6')]('icesupport',null);this['setDataValue']('dtlsenable',null);this[_0x336f('0x6')]('dtlsverify',null);this[_0x336f('0x6')](_0x336f('0x48'),null);this[_0x336f('0x6')](_0x336f('0x49'),null);this[_0x336f('0x6')](_0x336f('0x4a'),null);this['setDataValue'](_0x336f('0x4b'),'no');break;case 0x2:this['setDataValue']('transport',_0x336f('0x46'));this[_0x336f('0x6')]('encryption','yes');this[_0x336f('0x6')](_0x336f('0x4c'),_0x336f('0x34'));this[_0x336f('0x6')](_0x336f('0x4d'),_0x336f('0x34'));this[_0x336f('0x6')](_0x336f('0x4e'),_0x336f('0x34'));this[_0x336f('0x6')](_0x336f('0x4f'),_0x336f('0x34'));this['setDataValue']('dtlsverify','no');this['setDataValue'](_0x336f('0x48'),_0x336f('0x41'));this[_0x336f('0x6')]('dtlscertfile',_0x398e52[_0x336f('0x49')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x336f('0x4a'),_0x398e52[_0x336f('0x4a')]||_0x336f('0x50'));this['setDataValue'](_0x336f('0x4b'),_0x336f('0x34'));break;default:}}},'permissions':{'type':Sequelize[_0x336f('0x51')],'set':function(_0x53fd7c){this[_0x336f('0x6')](_0x336f('0x52'),_0x53fd7c?_0x53fd7c[_0x336f('0x26')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0x336f('0x53')](this[_0x336f('0xd')](_0x336f('0x52'))[_0x336f('0x27')](','),function(_0x39c8e3){return parseInt(_0x39c8e3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x336f('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x336f('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x336f('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x336f('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x336f('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x336f('0x29')](_0x336f('0x34'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x336f('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x336f('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x336f('0xd')](_0x336f('0x54'))?this[_0x336f('0xd')](_0x336f('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x336f('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x336f('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x349491){if(typeof _0x349491==='string'){var _0xf5257f=_0x349491==='1'?!![]:_0x349491==='0'?![]:_0x349491===_0x336f('0x55')?!![]:_0x349491==='false'?![]:![];this[_0x336f('0x6')](_0x336f('0x56'),_0xf5257f);}else{this['setDataValue'](_0x336f('0x56'),_0x349491);}}},'blocked':{'type':Sequelize[_0x336f('0x16')],'defaultValue':![],'set':function(_0x40aed1){this[_0x336f('0x6')](_0x336f('0x57'),_0x40aed1);if(_0x40aed1===!![]){this[_0x336f('0x6')](_0x336f('0x58'),moment());this[_0x336f('0x6')](_0x336f('0x59'),0x0);}else{this[_0x336f('0x6')](_0x336f('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x336f('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x336f('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x336f('0x14')](0x5)[_0x336f('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x336f('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x336f('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x336f('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc051=['setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','accountcode','callerid','DATE','BOOLEAN','dynamic','ENUM','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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','accept','refuse','uac','uas','fingerprint','certificate','active','passive','update,nonat','showWebBar','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','exports','STRING','name'];(function(_0xad99cb,_0x56d27f){var _0x5ebb7a=function(_0x146b04){while(--_0x146b04){_0xad99cb['push'](_0xad99cb['shift']());}};_0x5ebb7a(++_0x56d27f);}(_0xc051,0xb5));var _0x1c05=function(_0x10fcf0,_0x2aa3a2){_0x10fcf0=_0x10fcf0-0x0;var _0x562433=_0xc051[_0x10fcf0];return _0x562433;};'use strict';var Sequelize=require(_0x1c05('0x0'));var moment=require(_0x1c05('0x1'));var util=require('util');var _=require('lodash');module[_0x1c05('0x2')]={'name':{'type':Sequelize[_0x1c05('0x3')],'allowNull':![],'unique':_0x1c05('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xd5f638){this['setDataValue'](_0x1c05('0x4'),_0xd5f638);this[_0x1c05('0x5')](_0x1c05('0x6'),_0xd5f638);},'comment':_0x1c05('0x7')},'fullname':{'type':Sequelize[_0x1c05('0x3')],'allowNull':![],'set':function(_0x28a978){this[_0x1c05('0x5')](_0x1c05('0x8'),_0x28a978);this[_0x1c05('0x5')]('callerid',util[_0x1c05('0x9')](_0x1c05('0xa'),_0x28a978,this[_0x1c05('0xb')](_0x1c05('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1c05('0x3')],'allowNull':![],'unique':_0x1c05('0xd'),'validate':{'isEmail':!![]},'set':function(_0x4241a4){if(_0x4241a4){this[_0x1c05('0x5')]('email',_0x4241a4[_0x1c05('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x1c05('0xf'),_0x1c05('0x10'),_0x1c05('0x11'),_0x1c05('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x1c05('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1c05('0x3')],'defaultValue':_0x1c05('0x13')},'internal':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':![],'unique':_0x1c05('0xc'),'set':function(_0x2ba5a2){this[_0x1c05('0x5')](_0x1c05('0xc'),_0x2ba5a2);this['setDataValue'](_0x1c05('0x15'),_0x2ba5a2);this[_0x1c05('0x5')](_0x1c05('0x16'),util['format'](_0x1c05('0xa'),this['getDataValue'](_0x1c05('0x8')),_0x2ba5a2));}},'salt':{'type':Sequelize[_0x1c05('0x3')]},'phone':{'type':Sequelize[_0x1c05('0x3')]},'mobile':{'type':Sequelize[_0x1c05('0x3')]},'address':{'type':Sequelize[_0x1c05('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x1c05('0x3')]},'city':{'type':Sequelize[_0x1c05('0x3')]},'country':{'type':Sequelize[_0x1c05('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1c05('0x17')]},'voicePause':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1c05('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1c05('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1c05('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1c05('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1c05('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1c05('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1c05('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![],'defaultValue':_0x1c05('0x19')},'ipaddr':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x1c05('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x1b'),'user','peer'),'allowNull':!![],'defaultValue':_0x1c05('0x1b')},'context':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![],'defaultValue':_0x1c05('0x1c')},'callingpres':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x1d'),_0x1c05('0x1e'),_0x1c05('0x1f'),_0x1c05('0x20'),_0x1c05('0x21'),_0x1c05('0x22'),_0x1c05('0x23'),_0x1c05('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1c05('0x25'),'set':function(_0x19323d){this[_0x1c05('0x5')](_0x1c05('0x26'),_0x19323d?_0x19323d['join'](','):null);},'get':function(){return this[_0x1c05('0xb')]('transport')?this[_0x1c05('0xb')]('transport')[_0x1c05('0x27')](','):null;},'comment':_0x1c05('0x28')},'dtmfmode':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x29'),_0x1c05('0x2a'),_0x1c05('0x2b'),_0x1c05('0x2c'),_0x1c05('0x2d')),'allowNull':!![],'defaultValue':_0x1c05('0x29')},'directmedia':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no',_0x1c05('0x2f'),_0x1c05('0x30'),_0x1c05('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1c05('0x32'),'set':function(_0x1da52a){this['setDataValue']('nat',_0x1da52a?_0x1da52a[_0x1c05('0x33')](','):null);},'get':function(){return this[_0x1c05('0xb')](_0x1c05('0x34'))?this['getDataValue'](_0x1c05('0x34'))[_0x1c05('0x27')](','):null;},'comment':_0x1c05('0x35')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1c05('0x3')]},'pickupgroup':{'type':Sequelize[_0x1c05('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1c05('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x1c05('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x583062){this[_0x1c05('0x5')](_0x1c05('0x36'),_0x583062?_0x583062[_0x1c05('0x33')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1c05('0xb')](_0x1c05('0x36'))?this[_0x1c05('0xb')](_0x1c05('0x36'))[_0x1c05('0x27')](';'):null;},'comment':_0x1c05('0x37')},'autoframing':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3531ec){this[_0x1c05('0x5')]('insecure',_0x3531ec?_0x3531ec[_0x1c05('0x33')](','):null);},'get':function(){return this[_0x1c05('0xb')]('insecure')?this[_0x1c05('0xb')](_0x1c05('0x38'))[_0x1c05('0x27')](','):null;},'comment':_0x1c05('0x39')},'trustrpid':{'type':Sequelize['ENUM'](_0x1c05('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no',_0x1c05('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x1c05('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x1c05('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x1c05('0x2e')},'busylevel':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x1c05('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no',_0x1c05('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x3c'),_0x1c05('0x3d'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x3e'),_0x1c05('0x3f')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x1c05('0x2e')},'keepalive':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1c05('0x1a')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1c05('0x1a')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x1c05('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no',_0x1c05('0x40'),_0x1c05('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x1c05('0x42'),_0x1c05('0x43'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1c05('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1c05('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1c05('0x1a')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1c05('0x1a')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1c05('0x1a')](_0x1c05('0x2e'),'no',_0x1c05('0x2f'),'update',_0x1c05('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1c05('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1c05('0x17')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x1c05('0x14')],'defaultValue':0x0,'set':function(_0x3e9064){this[_0x1c05('0x5')](_0x1c05('0x45'),_0x3e9064);var _0x2a3fbf=this['get']({'plain':!![]});switch(_0x3e9064){case 0x0:case 0x1:var _0x3bbfa0=_0x2a3fbf[_0x1c05('0x26')]?_[_0x1c05('0x46')](_0x2a3fbf['transport'])?_0x2a3fbf['transport'][_0x1c05('0x33')]():_0x2a3fbf[_0x1c05('0x26')]:'udp';if(_0x3bbfa0===_0x1c05('0x47')){_0x3bbfa0='udp';}this[_0x1c05('0x5')](_0x1c05('0x26'),_0x3bbfa0);this[_0x1c05('0x5')](_0x1c05('0x48'),'no');this[_0x1c05('0x5')](_0x1c05('0x49'),null);this['setDataValue']('force_avp',null);this[_0x1c05('0x5')](_0x1c05('0x4a'),null);this['setDataValue'](_0x1c05('0x4b'),null);this['setDataValue']('dtlsverify',null);this[_0x1c05('0x5')]('dtlssetup',null);this[_0x1c05('0x5')](_0x1c05('0x4c'),null);this['setDataValue'](_0x1c05('0x4d'),null);this[_0x1c05('0x5')](_0x1c05('0x4e'),'no');break;case 0x2:this[_0x1c05('0x5')]('transport','wss');this['setDataValue'](_0x1c05('0x48'),'yes');this[_0x1c05('0x5')](_0x1c05('0x49'),_0x1c05('0x2e'));this[_0x1c05('0x5')](_0x1c05('0x4f'),_0x1c05('0x2e'));this[_0x1c05('0x5')]('icesupport',_0x1c05('0x2e'));this['setDataValue'](_0x1c05('0x4b'),_0x1c05('0x2e'));this[_0x1c05('0x5')]('dtlsverify','no');this[_0x1c05('0x5')](_0x1c05('0x50'),'actpass');this[_0x1c05('0x5')](_0x1c05('0x4c'),_0x2a3fbf[_0x1c05('0x4c')]||_0x1c05('0x51'));this['setDataValue'](_0x1c05('0x4d'),_0x2a3fbf['dtlsprivatekey']||_0x1c05('0x52'));this['setDataValue'](_0x1c05('0x4e'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x1c05('0x53')],'set':function(_0x52c15d){this['setDataValue'](_0x1c05('0x54'),_0x52c15d?_0x52c15d['join'](','):[]);},'get':function(){return this[_0x1c05('0xb')](_0x1c05('0x54'))?_[_0x1c05('0x55')](this['getDataValue'](_0x1c05('0x54'))['split'](','),function(_0x599efc){return parseInt(_0x599efc,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1c05('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x1c05('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1c05('0x56')],'get':function(){return this['getDataValue'](_0x1c05('0x57'))?this[_0x1c05('0xb')](_0x1c05('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1c05('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1c05('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![],'set':function(_0x3be429){if(typeof _0x3be429==='string'){var _0x4e8185=_0x3be429==='1'?!![]:_0x3be429==='0'?![]:_0x3be429==='true'?!![]:_0x3be429===_0x1c05('0x58')?![]:![];this[_0x1c05('0x5')](_0x1c05('0x59'),_0x4e8185);}else{this['setDataValue'](_0x1c05('0x59'),_0x3be429);}}},'blocked':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![],'set':function(_0x485397){this[_0x1c05('0x5')](_0x1c05('0x5a'),_0x485397);if(_0x485397===!![]){this['setDataValue']('blockedAt',moment());this['setDataValue'](_0x1c05('0x5b'),0x0);}else{this[_0x1c05('0x5')](_0x1c05('0x5c'),null);}}},'blockedAt':{'type':Sequelize[_0x1c05('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1c05('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1c05('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1c05('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ec4427f..3161530 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 _0x2ef3=['OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','phone','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','device','LOGININPAUSE','concat','isMiddleware','resolve','pause','QueuePause','PAUSE','updateAttributes','getChannels','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','pauseType','lastPauseAt','unpause','manual','%s%s','Pause','getTeams','Team','addTeams','setDataValue','getChatQueues','Chat','Mail','getSmsQueues','Sms','Whatsapp','Fax','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getMailQueues','getWhatsappQueues','getOpenchannelQueues','Voice','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','user_has_chat_interactions:save','removeChatInteractions','isArray','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','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','CmHopper','firstName','lastName','Contact','VoiceQueue','getApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','lower','col','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','idle','unavailable','voiceStatus','busy','slice','toUpperCase','QueryTypes','select','field','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','toString','moment','bluebird','util','path','lodash','squel','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','request','info','debug','request\x20sent','stringify','error','message','User,\x20%s,\x20%s','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','set','update','then','destroy','get','role','admin','user','agent','Telephones','filter','ignore','map','value','find','name','UserProfileResource','send','index','rawAttributes','type','key','includes','password','salt','getOptions','where','query','includeAll','include','attributes','push','User','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','openchannel','all','show','params','differenceBy','keys','filters','intersection','model','fields','merge','options','true','whatsapp','body','addContacts','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','SELECT','from','VoiceMail','email','permissions','102','103','104','106','108','109','100','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','create','bulkCreate','some','each','telephone','isEmpty','autoAssociation','compact','oldPassword','newPassword','ValidationError','authenticate','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','penalty','spread','ids','QueueId','emit','voice','SIP/%s','upsert','Unknown\x20channel','remove','Queue:remove','UserVoiceQueueRt','userpic','filename','root','server/files/images/logos/default_profile.png','download','existsSync','join','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','findOne','order','pick','hasOwnProperty','CmList','List','Tag','Tags','color','nolimit','Queue','Unknown\x20role','Queues','getVoiceQueuesRt','sort','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions'];(function(_0x33ad1f,_0xfc2fc8){var _0x26ef22=function(_0x58f97c){while(--_0x58f97c){_0x33ad1f['push'](_0x33ad1f['shift']());}};_0x26ef22(++_0xfc2fc8);}(_0x2ef3,0xba));var _0x32ef=function(_0x40a9f9,_0x55c206){_0x40a9f9=_0x40a9f9-0x0;var _0x19aede=_0x2ef3[_0x40a9f9];return _0x19aede;};'use strict';var moment=require(_0x32ef('0x0'));var BPromise=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var path=require(_0x32ef('0x3'));var fs=require('fs');var _=require(_0x32ef('0x4'));var squel=require(_0x32ef('0x5'));var jayson=require('jayson/promise');var Redis=require(_0x32ef('0x6'));var authService=require(_0x32ef('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x32ef('0x8'))(_0x32ef('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0xa'));var db=require(_0x32ef('0xb'))['db'];var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xd')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);config[_0x32ef('0xd')]=_[_0x32ef('0x10')](config[_0x32ef('0xd')],{'host':_0x32ef('0x11'),'port':0x18eb});var client=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x401d0b,_0x33281d,_0x45bfd5,_0x1499c2){return new BPromise(function(_0x5af651,_0x193714){var _0x5afcc2=_0x1499c2||client;return _0x5afcc2[_0x32ef('0x12')](_0x401d0b,_0x45bfd5)['then'](function(_0x3e98df){logger[_0x32ef('0x13')]('User,\x20%s,\x20%s',_0x33281d,'request\x20sent');logger[_0x32ef('0x14')]('User,\x20%s,\x20%s,\x20%s',_0x33281d,_0x32ef('0x15'),JSON[_0x32ef('0x16')](_0x3e98df));if(_0x3e98df[_0x32ef('0x17')]){if(_0x3e98df[_0x32ef('0x17')]['code']===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x33281d,_0x3e98df[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x193714(_0x3e98df[_0x32ef('0x17')]['message']);}logger['error'](_0x32ef('0x19'),_0x33281d,_0x3e98df[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5af651(_0x3e98df['error'][_0x32ef('0x18')]);}else{logger[_0x32ef('0x13')]('User,\x20%s,\x20%s',_0x33281d,_0x32ef('0x15'));_0x5af651(_0x3e98df[_0x32ef('0x1a')][_0x32ef('0x18')]);}})[_0x32ef('0x1b')](function(_0x445cda){logger[_0x32ef('0x17')]('User,\x20%s,\x20%s',_0x33281d,_0x445cda);_0x193714(_0x445cda);});});}function respondWithStatusCode(_0x3c5b78,_0x5cc3ef){_0x5cc3ef=_0x5cc3ef||0xcc;return function(_0x309866){if(_0x309866){return _0x3c5b78[_0x32ef('0x1c')](_0x5cc3ef);}return _0x3c5b78['status'](_0x5cc3ef)[_0x32ef('0x1d')]();};}function respondWithResult(_0x97780,_0x5e8898){_0x5e8898=_0x5e8898||0xc8;return function(_0x55f7f2){if(_0x55f7f2){return _0x97780['status'](_0x5e8898)[_0x32ef('0x1e')](_0x55f7f2);}};}function respondWithFilteredResult(_0xb30fab,_0x225feb){return function(_0x478bef){if(_0x478bef){var _0x59585f=typeof _0x225feb[_0x32ef('0x1f')]==='undefined'&&typeof _0x225feb['limit']===_0x32ef('0x20');var _0x14d4b3=_0x478bef[_0x32ef('0x21')];var _0x1dbe98=_0x59585f?0x0:_0x225feb[_0x32ef('0x1f')];var _0x234175=_0x59585f?_0x478bef[_0x32ef('0x21')]:_0x225feb[_0x32ef('0x1f')]+_0x225feb[_0x32ef('0x22')];var _0x2f52d7;if(_0x234175>=_0x14d4b3){_0x234175=_0x14d4b3;_0x2f52d7=0xc8;}else{_0x2f52d7=0xce;}_0xb30fab[_0x32ef('0x23')](_0x2f52d7);return _0xb30fab[_0x32ef('0x24')]('Content-Range',_0x1dbe98+'-'+_0x234175+'/'+_0x14d4b3)[_0x32ef('0x1e')](_0x478bef);}return null;};}function saveUpdates(_0x2f5d06){return function(_0x5a04cd){if(_0x5a04cd){return _0x5a04cd[_0x32ef('0x25')](_0x2f5d06)[_0x32ef('0x26')](function(_0x30b250){return _0x30b250;});}return null;};}function removeEntity(_0x26e207){return function(_0x50a95b){if(_0x50a95b){return _0x50a95b[_0x32ef('0x27')]()[_0x32ef('0x26')](function(){var _0x31dbc3=_0x50a95b[_0x32ef('0x28')]({'plain':!![]});if(_0x31dbc3[_0x32ef('0x29')]===_0x32ef('0x2a'))return;var _0x1a122d=[{'name':'Users','value':_0x32ef('0x2b'),'ignore':!![]},{'name':'Agents','value':_0x32ef('0x2c'),'ignore':![]},{'name':_0x32ef('0x2d'),'value':'telephone','ignore':![]}];var _0xcc2efb=_(_0x1a122d)[_0x32ef('0x2e')](_0x32ef('0x2f'))[_0x32ef('0x30')](_0x32ef('0x31'))['value']();if(_['includes'](_0xcc2efb,_0x31dbc3[_0x32ef('0x29')])){return;}var _0x5dadf7=_[_0x32ef('0x32')](_0x1a122d,[_0x32ef('0x31'),_0x31dbc3[_0x32ef('0x29')]])[_0x32ef('0x33')];return db[_0x32ef('0x34')][_0x32ef('0x27')]({'where':{'type':_0x5dadf7,'resourceId':_0x31dbc3['id']}})['then'](function(){return _0x50a95b;});})['then'](function(){_0x26e207['status'](0xcc)[_0x32ef('0x1d')]();});}};}function handleEntityNotFound(_0x3c4651){return function(_0x136b02){if(!_0x136b02){_0x3c4651['sendStatus'](0x194);}return _0x136b02;};}function handleError(_0x4fb402,_0x1c3633){_0x1c3633=_0x1c3633||0x1f4;return function(_0x2bd8a9){logger[_0x32ef('0x17')](_0x2bd8a9['stack']);if(_0x2bd8a9['name']){delete _0x2bd8a9[_0x32ef('0x33')];}_0x4fb402[_0x32ef('0x23')](_0x1c3633)[_0x32ef('0x35')](_0x2bd8a9);};}exports[_0x32ef('0x36')]=function(_0x3a7c49,_0x211c79){var _0x3223d5={},_0x21da90={'count':0x0,'rows':[]};var _0x7f2319=_(db['User'][_0x32ef('0x37')])[_0x32ef('0x30')](function(_0x14b54f){return{'name':_0x14b54f['fieldName'],'type':_0x14b54f[_0x32ef('0x38')][_0x32ef('0x39')]};})[_0x32ef('0x2e')](function(_0x393a89){return!_[_0x32ef('0x3a')]([_0x32ef('0x3b'),_0x32ef('0x3c')],_0x393a89[_0x32ef('0x33')]);})[_0x32ef('0x31')]();_0x3223d5=qs[_0x32ef('0x3d')](_0x7f2319,_0x3a7c49);var _0xb4db74={'where':_0x3223d5[_0x32ef('0x3e')]};return db['User'][_0x32ef('0x21')](_0xb4db74)[_0x32ef('0x26')](function(_0x26a40f){_0x21da90[_0x32ef('0x21')]=_0x26a40f;if(_0x3a7c49[_0x32ef('0x3f')][_0x32ef('0x40')]){_0x3223d5[_0x32ef('0x41')]=[{'all':!![]}];}if(!_['includes'](_0x3223d5['attributes'],'id')){_0x3223d5[_0x32ef('0x42')][_0x32ef('0x43')]('id');}return db[_0x32ef('0x44')][_0x32ef('0x45')](_0x3223d5);})['then'](function(_0x2901a1){_0x21da90[_0x32ef('0x46')]=_0x2901a1;if(_0x3a7c49['query'][_0x32ef('0x47')]==='true'){var _0xcb3c08=[];for(var _0x100ec7=0x0;_0x100ec7<_0x21da90[_0x32ef('0x46')][_0x32ef('0x48')];_0x100ec7++){_0xcb3c08[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x49'),_0x21da90[_0x32ef('0x46')][_0x100ec7][_0x32ef('0x4a')]));_0xcb3c08[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x4b'),_0x21da90['rows'][_0x100ec7][_0x32ef('0x4a')]));_0xcb3c08['push'](get_open_tabs(_0x32ef('0x4c'),_0x21da90[_0x32ef('0x46')][_0x100ec7][_0x32ef('0x4a')]));_0xcb3c08['push'](get_open_tabs(_0x32ef('0x4d'),_0x21da90[_0x32ef('0x46')][_0x100ec7][_0x32ef('0x4a')]));_0xcb3c08[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x4e'),_0x21da90[_0x32ef('0x46')][_0x100ec7][_0x32ef('0x4a')]));_0xcb3c08['push'](get_open_tabs('whatsapp',_0x21da90[_0x32ef('0x46')][_0x100ec7][_0x32ef('0x4a')]));}return BPromise[_0x32ef('0x4f')](_0xcb3c08)[_0x32ef('0x26')](function(_0x209361){return _0x21da90;});}else{return _0x21da90;}})[_0x32ef('0x26')](respondWithFilteredResult(_0x211c79,_0x3223d5))[_0x32ef('0x1b')](handleError(_0x211c79,null));};exports[_0x32ef('0x50')]=function(_0xc10e7,_0x1ebedf){var _0x35a294={'raw':![],'where':{'id':_0xc10e7[_0x32ef('0x51')]['id']}},_0x30ad49={};_0x30ad49['model']=_[_0x32ef('0x52')](_[_0x32ef('0x53')](db[_0x32ef('0x44')][_0x32ef('0x37')]),[_0x32ef('0x3b'),_0x32ef('0x3c')]);_0x30ad49[_0x32ef('0x3f')]=_[_0x32ef('0x53')](_0xc10e7[_0x32ef('0x3f')]);_0x30ad49[_0x32ef('0x54')]=_[_0x32ef('0x55')](_0x30ad49[_0x32ef('0x56')],_0x30ad49[_0x32ef('0x3f')]);_0x35a294[_0x32ef('0x42')]=_[_0x32ef('0x55')](_0x30ad49[_0x32ef('0x56')],qs[_0x32ef('0x57')](_0xc10e7[_0x32ef('0x3f')]['fields']));_0x35a294['attributes']=_0x35a294[_0x32ef('0x42')][_0x32ef('0x48')]?_0x35a294[_0x32ef('0x42')]:_0x30ad49[_0x32ef('0x56')];if(_0xc10e7[_0x32ef('0x3f')][_0x32ef('0x40')]){_0x35a294[_0x32ef('0x41')]=[{'all':!![]}];}_0x35a294=_[_0x32ef('0x58')]({},_0x35a294,_0xc10e7[_0x32ef('0x59')]);if(!_[_0x32ef('0x3a')](_0x35a294[_0x32ef('0x42')],'id')){_0x35a294['attributes'][_0x32ef('0x43')]('id');}return db[_0x32ef('0x44')][_0x32ef('0x32')](_0x35a294)[_0x32ef('0x26')](handleEntityNotFound(_0x1ebedf,null))[_0x32ef('0x26')](function(_0x387cf0){var _0x52c588=[];values=_0x387cf0;if(_0xc10e7[_0x32ef('0x3f')][_0x32ef('0x47')]===_0x32ef('0x5a')){_0x52c588['push'](get_open_tabs(_0x32ef('0x49'),_0x387cf0['dataValues']));_0x52c588[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x4b'),_0x387cf0['dataValues']));_0x52c588[_0x32ef('0x43')](get_open_tabs('openchannel',_0x387cf0[_0x32ef('0x4a')]));_0x52c588[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x5b'),_0x387cf0[_0x32ef('0x4a')]));_0x52c588[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x4c'),_0x387cf0[_0x32ef('0x4a')]));_0x52c588['push'](get_open_tabs('mail',_0x387cf0[_0x32ef('0x4a')]));return BPromise['all'](_0x52c588);}else{return values;}})['then'](function(_0xb519e9){return values;})[_0x32ef('0x26')](respondWithResult(_0x1ebedf,null))[_0x32ef('0x1b')](handleError(_0x1ebedf,null));};exports[_0x32ef('0x25')]=function(_0x2468e6,_0x356704){if(_0x2468e6[_0x32ef('0x5c')]['id']){delete _0x2468e6[_0x32ef('0x5c')]['id'];}delete _0x2468e6[_0x32ef('0x5c')][_0x32ef('0x29')];return db['User']['find']({'where':{'id':_0x2468e6[_0x32ef('0x51')]['id']}})[_0x32ef('0x26')](handleEntityNotFound(_0x356704,null))['then'](saveUpdates(_0x2468e6[_0x32ef('0x5c')],null))[_0x32ef('0x26')](respondWithResult(_0x356704,null))[_0x32ef('0x1b')](handleError(_0x356704,null));};exports['describe']=function(_0x2ac877,_0x3c31d0){return db[_0x32ef('0x44')]['describe']()['then'](respondWithResult(_0x3c31d0,null))[_0x32ef('0x1b')](handleError(_0x3c31d0,null));};exports['addContacts']=function(_0x17f447,_0x5bb114){return db['User'][_0x32ef('0x32')]({'where':{'id':_0x17f447[_0x32ef('0x51')]['id']}})[_0x32ef('0x26')](handleEntityNotFound(_0x5bb114,null))['then'](function(_0x9c89a2){if(_0x9c89a2){return _0x9c89a2[_0x32ef('0x5d')](_0x17f447[_0x32ef('0x5c')]['ids'],_[_0x32ef('0x5e')](_0x17f447[_0x32ef('0x5c')],['ids','id'])||{});}})['then'](respondWithResult(_0x5bb114,null))[_0x32ef('0x1b')](handleError(_0x5bb114,null));};function validateUser(_0x3a6697){return new BPromise(function(_0x2518a0,_0x339625){if(_0x3a6697[_0x32ef('0x5f')])return _0x2518a0(_0x3a6697);return db[_0x32ef('0x60')]['findById'](0x1)[_0x32ef('0x26')](function(_0x63b65){if(_0x63b65[_0x32ef('0x61')])authService[_0x32ef('0x62')](_0x3a6697[_0x32ef('0x3b')]);db[_0x32ef('0x44')][_0x32ef('0x63')](_0x32ef('0x5f'))[_0x32ef('0x26')](function(_0x4fa4df){if(_[_0x32ef('0x64')](_0x4fa4df)){_0x3a6697[_0x32ef('0x5f')]=_0x63b65[_0x32ef('0x65')]||0x1;return;}if(_[_0x32ef('0x64')](_0x63b65[_0x32ef('0x65')])||_0x63b65['min_internal']===_0x4fa4df){_0x3a6697['internal']=_0x4fa4df+0x1;return;}if(_0x63b65[_0x32ef('0x65')]>_0x4fa4df){_0x3a6697[_0x32ef('0x5f')]=_0x63b65[_0x32ef('0x65')];return;}return db[_0x32ef('0x66')][_0x32ef('0x3f')]('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[_0x32ef('0x66')]['QueryTypes'][_0x32ef('0x67')]})[_0x32ef('0x26')](function(_0x48b6f4){if(_0x48b6f4&&_0x48b6f4['length']){for(var _0x2c9f7a=0x0,_0x1538d0=_0x48b6f4[_0x32ef('0x48')];_0x2c9f7a<_0x1538d0&&_['isNil'](_0x3a6697['internal']);_0x2c9f7a++){if(_0x63b65[_0x32ef('0x65')]<=_0x48b6f4[_0x2c9f7a][_0x32ef('0x68')]){_0x3a6697[_0x32ef('0x5f')]=_0x48b6f4[_0x2c9f7a][_0x32ef('0x68')];}else if(_0x63b65['min_internal']>_0x48b6f4[_0x2c9f7a][_0x32ef('0x68')]&&_0x63b65[_0x32ef('0x65')]<=_0x48b6f4[_0x2c9f7a]['to']){_0x3a6697[_0x32ef('0x5f')]=_0x63b65[_0x32ef('0x65')];}}}if(_[_0x32ef('0x64')](_0x3a6697[_0x32ef('0x5f')])){_0x3a6697[_0x32ef('0x5f')]=_0x4fa4df+0x1;}return _0x2518a0(_0x3a6697);});});})[_0x32ef('0x1b')](function(_0x3cdfe6){_0x339625(_0x3cdfe6);});});}function updateUser(_0x1d0448){return new BPromise(function(_0x132d9f,_0x3978cb){try{if(_0x1d0448['voicemail']){_0x1d0448['mailbox']=_0x1d0448[_0x32ef('0x5f')];_0x1d0448[_0x32ef('0x69')]={'mailbox':_0x1d0448['internal'],'password':_0x1d0448[_0x32ef('0x3b')],'fullname':_0x1d0448['fullname'],'email':_0x1d0448[_0x32ef('0x6a')]};}if(_0x1d0448[_0x32ef('0x29')]===_0x32ef('0x2c')){if(!_0x1d0448['permissions'])_0x1d0448[_0x32ef('0x6b')]=['101',_0x32ef('0x6c'),_0x32ef('0x6d'),'113','110',_0x32ef('0x6e'),'105',_0x32ef('0x6f'),'107',_0x32ef('0x70'),_0x32ef('0x71'),_0x32ef('0x72'),'111','114','115'];}_0x132d9f(_0x1d0448);}catch(_0x574fb3){_0x3978cb(_0x574fb3);}});}exports['create']=function(_0x267364,_0x13a374){if(_0x267364[_0x32ef('0x2b')][_0x32ef('0x29')]===_0x32ef('0x2c'))throw new Error(_0x32ef('0x73'));if(_0x267364['body'][_0x32ef('0x29')]==='user'&&_0x267364['user'][_0x32ef('0x29')]!=='admin'){throw new Error(_0x32ef('0x74'));}if(_0x267364[_0x32ef('0x5c')]['role']===_0x32ef('0x2a')&&_0x267364[_0x32ef('0x2b')][_0x32ef('0x29')]!==_0x32ef('0x2a')){throw new Error(_0x32ef('0x75'));}return licenseUtil[_0x32ef('0x76')]([_0x267364['body']])['then'](function(){return validateUser(_0x267364[_0x32ef('0x5c')]);})['then'](function(_0x41bbe1){return updateUser(_0x41bbe1)[_0x32ef('0x26')](function(_0x114d8e){if(_0x114d8e[_0x32ef('0x29')]===_0x32ef('0x2a')){_0x114d8e[_0x32ef('0x77')]=_0x267364['user'][_0x32ef('0x77')];delete _0x114d8e[_0x32ef('0x78')];}return _0x114d8e;});})[_0x32ef('0x26')](function(_0x2aeb11){return db[_0x32ef('0x44')]['create'](_0x2aeb11,{'include':[{'model':db['VoiceMail'],'as':_0x32ef('0x69')}]});})[_0x32ef('0x26')](function(_0x54d7ea){if(_0x267364[_0x32ef('0x5c')][_0x32ef('0x29')]===_0x32ef('0x2b'))return _0x54d7ea;if(_0x267364[_0x32ef('0x2b')][_0x32ef('0x29')]!==_0x32ef('0x2b'))return _0x54d7ea;return db[_0x32ef('0x79')][_0x32ef('0x32')]({'where':{'name':_0x54d7ea[_0x32ef('0x29')]==='agent'?_0x32ef('0x7a'):_0x32ef('0x2d'),'userProfileId':_0x267364['user'][_0x32ef('0x78')]},'raw':!![]})['then'](function(_0x18f96c){if(!_0x18f96c||_0x18f96c['autoAssociation']!=0x0)return _0x54d7ea;return db[_0x32ef('0x34')][_0x32ef('0x7b')]({'name':_0x54d7ea[_0x32ef('0x33')],'resourceId':_0x54d7ea['id'],'type':_0x18f96c[_0x32ef('0x33')],'sectionId':_0x18f96c['id']},{})['then'](function(){return _0x54d7ea;});})[_0x32ef('0x1b')](function(_0x31cff1){logger[_0x32ef('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31cff1);throw _0x31cff1;});})['then'](respondWithResult(_0x13a374,0xc9))['catch'](handleError(_0x13a374,null));};exports[_0x32ef('0x7c')]=function(_0x12f5ef,_0x1ec12d){var _0x34fd2b=_0x12f5ef[_0x32ef('0x5c')];var _0x5a1696=[];if(_0x12f5ef[_0x32ef('0x2b')]['role']===_0x32ef('0x2c'))throw new Error(_0x32ef('0x73'));if(_[_0x32ef('0x7d')](_0x34fd2b,['role',_0x32ef('0x2b')])&&_0x12f5ef[_0x32ef('0x2b')][_0x32ef('0x29')]!==_0x32ef('0x2a')){throw new Error(_0x32ef('0x74'));}if(_['some'](_0x34fd2b,[_0x32ef('0x29'),'admin'])&&_0x12f5ef[_0x32ef('0x2b')][_0x32ef('0x29')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x32ef('0x76')](_0x34fd2b)[_0x32ef('0x26')](function(){return validateUser(_0x34fd2b[0x0]);})[_0x32ef('0x26')](function(){for(var _0x3b9896=0x1;_0x3b9896<_0x34fd2b['length'];_0x3b9896++){var _0x356fd4=_0x34fd2b[_0x3b9896-0x1]['internal'];if(!_0x34fd2b[_0x3b9896]['internal'])_0x34fd2b[_0x3b9896][_0x32ef('0x5f')]=_0x356fd4+0x1;_0x5a1696['push'](validateUser(_0x34fd2b[_0x3b9896]));}return BPromise[_0x32ef('0x4f')](_0x5a1696);})[_0x32ef('0x26')](function(){_0x5a1696=[];for(var _0x20a92b=0x0;_0x20a92b<_0x34fd2b['length'];_0x20a92b++){_0x5a1696['push'](updateUser(_0x34fd2b[_0x20a92b]));}return BPromise[_0x32ef('0x4f')](_0x5a1696);})[_0x32ef('0x26')](function(){return BPromise[_0x32ef('0x7e')](_0x34fd2b,function(_0x3741f8){return db[_0x32ef('0x44')][_0x32ef('0x7b')](_0x3741f8,{'include':[{'model':db[_0x32ef('0x69')],'as':'VoiceMail'}]})[_0x32ef('0x26')](function(_0x8f0436){_0x3741f8['id']=_0x8f0436['id'];return _0x3741f8;});});})[_0x32ef('0x26')](function(_0x143ced){if(_0x12f5ef['body']['role']===_0x32ef('0x2b'))return _0x143ced;if(_0x12f5ef['user'][_0x32ef('0x29')]!==_0x32ef('0x2b'))return _0x143ced;var _0x50f13b=_['some'](_0x143ced,function(_0x5f2637){return _0x5f2637[_0x32ef('0x29')]===_0x32ef('0x2c')||_0x5f2637[_0x32ef('0x29')]===_0x32ef('0x7f');});if(!_0x50f13b)return _0x143ced;return db['UserProfileSection'][_0x32ef('0x45')]({'where':{'name':{'$or':[_0x32ef('0x7a'),_0x32ef('0x2d')]},'userProfileId':_0x12f5ef['user'][_0x32ef('0x78')]},'raw':!![]})['then'](function(_0x1b0063){if(_[_0x32ef('0x80')](_0x1b0063)||!_['some'](_0x1b0063,['autoAssociation',0x0]))return _0x143ced;_0x5a1696=[];var _0x2d6a9a=_(_0x1b0063)[_0x32ef('0x30')](function(_0x435538){if(_0x435538[_0x32ef('0x81')]===0x1)return;return _0x435538[_0x32ef('0x33')]===_0x32ef('0x7a')?_0x32ef('0x2c'):_0x32ef('0x7f');})[_0x32ef('0x82')]()['value']();for(var _0x10594a=0x0;_0x10594a<_0x143ced['length'];_0x10594a++){if(!_[_0x32ef('0x3a')](_0x2d6a9a,_0x143ced[_0x10594a][_0x32ef('0x29')]))return;var _0x1d9d57=_0x143ced[_0x10594a][_0x32ef('0x29')]===_0x32ef('0x2c')?'Agents':_0x32ef('0x2d');_0x5a1696[_0x32ef('0x43')](db[_0x32ef('0x34')][_0x32ef('0x7b')]({'name':_0x143ced[_0x10594a][_0x32ef('0x33')],'resourceId':_0x143ced[_0x10594a]['id'],'type':_0x1d9d57,'sectionId':_[_0x32ef('0x32')](_0x1b0063,[_0x32ef('0x33'),_0x1d9d57])['id']},{}));}return BPromise[_0x32ef('0x4f')](_0x5a1696);});})[_0x32ef('0x26')](respondWithResult(_0x1ec12d,0xc9))['catch'](handleError(_0x1ec12d,null));};exports['changePassword']=function(_0x4fb09e,_0x2e01fa){if(_0x4fb09e[_0x32ef('0x5c')]['id']){delete _0x4fb09e['body']['id'];}return db[_0x32ef('0x44')]['find']({'where':{'id':_0x4fb09e[_0x32ef('0x51')]['id']}})['then'](function(_0x519eda){if(!_0x519eda)return null;if(_0x519eda['id']===_0x4fb09e[_0x32ef('0x2b')]['id']){if(!_0x4fb09e[_0x32ef('0x5c')][_0x32ef('0x83')]||!_0x4fb09e[_0x32ef('0x5c')][_0x32ef('0x84')]){throw new db['Sequelize'][(_0x32ef('0x85'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x519eda[_0x32ef('0x86')](_0x4fb09e['body']['oldPassword'])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x4fb09e[_0x32ef('0x5c')][_0x32ef('0x83')]===_0x4fb09e['body'][_0x32ef('0x84')]){throw new db[(_0x32ef('0x87'))][(_0x32ef('0x85'))](_0x32ef('0x88'));}}else if(_0x4fb09e[_0x32ef('0x2b')][_0x32ef('0x29')]==='admin'){if(!_0x4fb09e[_0x32ef('0x5c')]['newPassword']){throw new db[(_0x32ef('0x87'))][(_0x32ef('0x85'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4fb09e[_0x32ef('0x2b')]['role']===_0x32ef('0x2b')){if(!_0x4fb09e[_0x32ef('0x5c')][_0x32ef('0x84')]){throw new db[(_0x32ef('0x87'))]['ValidationError'](_0x32ef('0x89'));}if(_0x519eda[_0x32ef('0x29')]!==_0x32ef('0x2c')){throw new db[(_0x32ef('0x87'))]['ValidationError'](_0x32ef('0x73'));}}else{throw new db['Sequelize'][(_0x32ef('0x85'))](_0x32ef('0x73'));}return _0x519eda;})[_0x32ef('0x26')](handleEntityNotFound(_0x2e01fa,null))[_0x32ef('0x26')](function(_0x1cbb24){return db[_0x32ef('0x60')]['findOne']({'attributes':['id',_0x32ef('0x61'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x32ef('0x26')](function(_0x1e5237){if(_0x1e5237[_0x32ef('0x61')])authService[_0x32ef('0x62')](_0x4fb09e['body'][_0x32ef('0x84')]);if(!_0x1e5237[_0x32ef('0x8a')]||!_0x1cbb24[_0x32ef('0x8b')])return _0x1cbb24;authService[_0x32ef('0x8c')](_0x4fb09e['body']['newPassword'],_0x1cbb24['previousPasswords'],_0x1e5237[_0x32ef('0x8d')]);return _0x1cbb24;})[_0x32ef('0x26')](saveUpdates({'password':_0x4fb09e[_0x32ef('0x5c')][_0x32ef('0x84')],'passwordResetAt':_0x4fb09e[_0x32ef('0x2b')]['id']==_0x4fb09e[_0x32ef('0x51')]['id']?moment():null,'previousPasswords':authService[_0x32ef('0x8e')](_0x4fb09e[_0x32ef('0x5c')][_0x32ef('0x84')],_0x1cbb24[_0x32ef('0x8b')])},null));})[_0x32ef('0x26')](respondWithResult(_0x2e01fa,null))['catch'](handleError(_0x2e01fa,null));};exports[_0x32ef('0x8f')]=function(_0x7c2649,_0x42d79b){var _0x349e03=_0x7c2649[_0x32ef('0x5c')][_0x32ef('0x90')];return db['User'][_0x32ef('0x32')]({'where':{'id':_0x7c2649[_0x32ef('0x51')]['id']},'attributes':['id',_0x32ef('0x33'),_0x32ef('0x29'),_0x32ef('0x91'),_0x32ef('0x92'),_0x32ef('0x93'),_0x32ef('0x94')]})[_0x32ef('0x26')](handleEntityNotFound(_0x42d79b,null))[_0x32ef('0x26')](function(_0x439146){if(_0x439146){if(!utils[_0x32ef('0x95')](_0x349e03)){throw new db[(_0x32ef('0x87'))][(_0x32ef('0x85'))]('Unknown\x20channel');}return _0x439146[_0x32ef('0x96')+_[_0x32ef('0x97')](_0x349e03[_0x32ef('0x98')]())+'Queues'](_0x7c2649[_0x32ef('0x5c')]['ids'],{'penalty':_0x7c2649[_0x32ef('0x5c')][_0x32ef('0x99')]||0x0})[_0x32ef('0x9a')](function(_0x5c2733){for(var _0x27aff9=0x0;_0x27aff9<_0x7c2649['body'][_0x32ef('0x9b')][_0x32ef('0x48')];_0x27aff9+=0x1){var _0x5b753c={'UserId':Number(_0x7c2649[_0x32ef('0x51')]['id'])};_0x5b753c[_[_0x32ef('0x97')](_0x349e03[_0x32ef('0x98')]())+_0x32ef('0x9c')]=Number(_0x7c2649[_0x32ef('0x5c')][_0x32ef('0x9b')][_0x27aff9]);socket[_0x32ef('0x9d')]('user'+_['capitalize'](_0x349e03[_0x32ef('0x98')]())+'Queue:save',_0x5b753c);}return _0x5c2733;})[_0x32ef('0x26')](function(){if(_0x349e03===_0x32ef('0x9e')){return db['VoiceQueue'][_0x32ef('0x45')]({'where':{'id':_0x7c2649[_0x32ef('0x5c')]['ids']||[]},'raw':!![],'attributes':['id',_0x32ef('0x33')]});}})[_0x32ef('0x26')](function(_0x3f09c9){var _0xa5f787=_0x439146[_0x32ef('0x28')]({'plain':!![]});var _0x599b18=[];if(_0x349e03===_0x32ef('0x9e')&&_0xa5f787[_0x32ef('0x29')]==='agent'&&_0xa5f787[_0x32ef('0x91')]){for(var _0xe7df49=0x0;_0xe7df49<_0x3f09c9[_0x32ef('0x48')];_0xe7df49+=0x1){_0x599b18[_0x32ef('0x43')]({'membername':_0xa5f787[_0x32ef('0x33')],'UserId':_0xa5f787['id'],'queue_name':_0x3f09c9[_0xe7df49]['name'],'VoiceQueueId':_0x3f09c9[_0xe7df49]['id'],'interface':_[_0x32ef('0x64')](_0xa5f787[_0x32ef('0x94')])?util['format'](_0x32ef('0x9f'),_0xa5f787[_0x32ef('0x33')]):_0xa5f787[_0x32ef('0x94')],'paused':_0xa5f787[_0x32ef('0x93')]||![],'penalty':_0x7c2649[_0x32ef('0x5c')][_0x32ef('0x99')]||0x0});}return BPromise[_0x32ef('0x7e')](_0x599b18,function(_0x482c46){return db['UserVoiceQueueRt'][_0x32ef('0xa0')](_0x482c46);});}return _0x439146;});}})[_0x32ef('0x26')](respondWithStatusCode(_0x42d79b,null))[_0x32ef('0x1b')](handleError(_0x42d79b,null));};exports['removeQueues']=function(_0x10c38e,_0x32fe54){var _0x49fef2;return db[_0x32ef('0x44')][_0x32ef('0x32')]({'where':{'id':_0x10c38e['params']['id']},'attributes':['id','name',_0x32ef('0x29')]})[_0x32ef('0x26')](handleEntityNotFound(_0x32fe54,null))[_0x32ef('0x26')](function(_0x5a86f6){if(_0x5a86f6){_0x49fef2=_0x5a86f6;if(!_0x10c38e['query']['channel']||!utils[_0x32ef('0x95')](_0x10c38e[_0x32ef('0x3f')][_0x32ef('0x90')])){throw new db['Sequelize'][(_0x32ef('0x85'))](_0x32ef('0xa1'));}return _0x5a86f6[_0x32ef('0xa2')+_['capitalize'](_0x10c38e[_0x32ef('0x3f')][_0x32ef('0x90')]['toLowerCase']())+'Queues'](_0x10c38e[_0x32ef('0x3f')]['ids']);}})[_0x32ef('0x26')](function(_0x286ce3){if(_['isArray'](_0x10c38e['query'][_0x32ef('0x9b')])){for(var _0x4bb644=0x0;_0x4bb644<_0x10c38e[_0x32ef('0x3f')][_0x32ef('0x9b')][_0x32ef('0x48')];_0x4bb644+=0x1){var _0x28d85a={'UserId':Number(_0x10c38e[_0x32ef('0x51')]['id'])};_0x28d85a[_[_0x32ef('0x97')](_0x10c38e[_0x32ef('0x3f')][_0x32ef('0x90')][_0x32ef('0x98')]())+_0x32ef('0x9c')]=Number(_0x10c38e['query']['ids'][_0x4bb644]);socket[_0x32ef('0x9d')](_0x32ef('0x2b')+_[_0x32ef('0x97')](_0x10c38e[_0x32ef('0x3f')][_0x32ef('0x90')][_0x32ef('0x98')]())+_0x32ef('0xa3'),_0x28d85a);}}else{var _0x28d85a={'UserId':Number(_0x10c38e[_0x32ef('0x51')]['id'])};_0x28d85a[_[_0x32ef('0x97')](_0x10c38e['query'][_0x32ef('0x90')][_0x32ef('0x98')]())+_0x32ef('0x9c')]=Number(_0x10c38e[_0x32ef('0x3f')][_0x32ef('0x9b')]);socket[_0x32ef('0x9d')](_0x32ef('0x2b')+_[_0x32ef('0x97')](_0x10c38e[_0x32ef('0x3f')][_0x32ef('0x90')][_0x32ef('0x98')]())+_0x32ef('0xa3'),_0x28d85a);}return _0x286ce3;})[_0x32ef('0x26')](function(){if(_0x10c38e['query'][_0x32ef('0x90')]===_0x32ef('0x9e')){return db[_0x32ef('0xa4')][_0x32ef('0x27')]({'where':{'UserId':_0x10c38e[_0x32ef('0x51')]['id'],'VoiceQueueId':_0x10c38e[_0x32ef('0x3f')][_0x32ef('0x9b')]},'individualHooks':!![]})[_0x32ef('0x26')](function(){return _0x49fef2;});}return _0x49fef2;})[_0x32ef('0x26')](respondWithStatusCode(_0x32fe54,null))[_0x32ef('0x1b')](handleError(_0x32fe54,null));};exports['addAvatar']=function(_0x1d7329,_0x85c779){_0x1d7329[_0x32ef('0x5c')][_0x32ef('0xa5')]=_0x1d7329['file'][_0x32ef('0xa6')];return db[_0x32ef('0x44')]['find']({'where':{'id':_0x1d7329['params']['id']}})['then'](handleEntityNotFound(_0x85c779,null))[_0x32ef('0x26')](saveUpdates(_0x1d7329[_0x32ef('0x5c')],null))[_0x32ef('0x26')](respondWithResult(_0x85c779,null))[_0x32ef('0x1b')](handleError(_0x85c779,null));};exports['getAvatar']=function(_0x5f2996,_0x1fc685){var _0x4f9e0a=path['join'](config[_0x32ef('0xa7')],_0x32ef('0xa8'));return db[_0x32ef('0x44')]['find']({'where':{'id':_0x5f2996['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x32ef('0x26')](handleEntityNotFound(_0x1fc685,null))[_0x32ef('0x26')](function(_0x419764){if(_0x419764){if(_[_0x32ef('0x64')](_0x419764[_0x32ef('0xa5')])){return _0x1fc685[_0x32ef('0xa9')](_0x4f9e0a);}else{if(!fs[_0x32ef('0xaa')](path[_0x32ef('0xab')](config[_0x32ef('0xa7')],'server/files/images/',_0x419764['userpic']))){return _0x1fc685['download'](_0x4f9e0a);}return _0x1fc685[_0x32ef('0xa9')](path[_0x32ef('0xab')](config['root'],'server/files/images/',_0x419764[_0x32ef('0xa5')]));}}})['catch'](handleError(_0x1fc685,null));};exports[_0x32ef('0xac')]=function(_0x40e8d7,_0x7f710){return db[_0x32ef('0x44')]['find']({'where':{'id':_0x40e8d7[_0x32ef('0x51')]['id']},'attributes':['id']})[_0x32ef('0x26')](handleEntityNotFound(_0x7f710,null))[_0x32ef('0x26')](function(_0x2e710c){var _0x5f290e=[];values=_0x2e710c[_0x32ef('0x4a')];_0x5f290e[_0x32ef('0x43')](get_open_tabs('chat',_0x2e710c['dataValues']));_0x5f290e[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x4b'),_0x2e710c[_0x32ef('0x4a')]));_0x5f290e[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x4e'),_0x2e710c[_0x32ef('0x4a')]));_0x5f290e[_0x32ef('0x43')](get_open_tabs('whatsapp',_0x2e710c[_0x32ef('0x4a')]));_0x5f290e[_0x32ef('0x43')](get_open_tabs(_0x32ef('0x4c'),_0x2e710c[_0x32ef('0x4a')]));_0x5f290e['push'](get_open_tabs('mail',_0x2e710c[_0x32ef('0x4a')]));return BPromise['all'](_0x5f290e);})[_0x32ef('0x26')](function(_0x62f5c6){var _0x323880=[];if(_0x62f5c6){for(var _0x451621=0x0;_0x451621=_0x2dbd22){_0x568870=_0x2dbd22;_0x28a350=0xc8;}else{_0x28a350=0xce;}_0x444237[_0xb5fa('0x20')](_0x28a350);return _0x444237[_0xb5fa('0x26')](_0xb5fa('0x27'),_0x6a455c+'-'+_0x568870+'/'+_0x2dbd22)[_0xb5fa('0x21')](_0x224ec8);}return null;};}function saveUpdates(_0x3506a4){return function(_0x358549){if(_0x358549){return _0x358549[_0xb5fa('0x28')](_0x3506a4)[_0xb5fa('0x13')](function(_0x2a5690){return _0x2a5690;});}return null;};}function removeEntity(_0x142bfa){return function(_0x259d21){if(_0x259d21){return _0x259d21[_0xb5fa('0x29')]()[_0xb5fa('0x13')](function(){var _0xed02e=_0x259d21[_0xb5fa('0x2a')]({'plain':!![]});if(_0xed02e[_0xb5fa('0x2b')]===_0xb5fa('0x2c'))return;var _0x21fc7e=[{'name':_0xb5fa('0x2d'),'value':_0xb5fa('0x2e'),'ignore':!![]},{'name':_0xb5fa('0x2f'),'value':_0xb5fa('0x30'),'ignore':![]},{'name':_0xb5fa('0x31'),'value':'telephone','ignore':![]}];var _0x2cc6cb=_(_0x21fc7e)['filter']('ignore')['map'](_0xb5fa('0x32'))['value']();if(_[_0xb5fa('0x33')](_0x2cc6cb,_0xed02e['role'])){return;}var _0x5518b1=_[_0xb5fa('0x34')](_0x21fc7e,[_0xb5fa('0x32'),_0xed02e['role']])['name'];return db[_0xb5fa('0x35')][_0xb5fa('0x29')]({'where':{'type':_0x5518b1,'resourceId':_0xed02e['id']}})[_0xb5fa('0x13')](function(){return _0x259d21;});})['then'](function(){_0x142bfa[_0xb5fa('0x20')](0xcc)[_0xb5fa('0x1f')]();});}};}function handleEntityNotFound(_0x4a7137){return function(_0x18398f){if(!_0x18398f){_0x4a7137[_0xb5fa('0x1e')](0x194);}return _0x18398f;};}function handleError(_0x204d6b,_0x5580f0){_0x5580f0=_0x5580f0||0x1f4;return function(_0x4652cd){logger[_0xb5fa('0x19')](_0x4652cd[_0xb5fa('0x36')]);if(_0x4652cd['name']){delete _0x4652cd[_0xb5fa('0x37')];}_0x204d6b[_0xb5fa('0x20')](_0x5580f0)[_0xb5fa('0x38')](_0x4652cd);};}exports[_0xb5fa('0x39')]=function(_0x5e7770,_0x4bba91){var _0x4901ad={},_0x49e786={'count':0x0,'rows':[]};var _0x5989e1=_(db['User'][_0xb5fa('0x3a')])['map'](function(_0x43de71){return{'name':_0x43de71[_0xb5fa('0x3b')],'type':_0x43de71[_0xb5fa('0x3c')][_0xb5fa('0x3d')]};})[_0xb5fa('0x3e')](function(_0x269d21){return!_['includes'](['password','salt'],_0x269d21[_0xb5fa('0x37')]);})['value']();_0x4901ad=qs[_0xb5fa('0x3f')](_0x5989e1,_0x5e7770);var _0x5addd5={'where':_0x4901ad['where']};return db[_0xb5fa('0x40')][_0xb5fa('0x25')](_0x5addd5)[_0xb5fa('0x13')](function(_0x36c345){_0x49e786[_0xb5fa('0x25')]=_0x36c345;if(_0x5e7770[_0xb5fa('0x41')][_0xb5fa('0x42')]){_0x4901ad[_0xb5fa('0x43')]=[{'all':!![]}];}if(!_[_0xb5fa('0x33')](_0x4901ad[_0xb5fa('0x44')],'id')){_0x4901ad['attributes'][_0xb5fa('0x45')]('id');}return db['User'][_0xb5fa('0x46')](_0x4901ad);})[_0xb5fa('0x13')](function(_0x2c7c5f){_0x49e786[_0xb5fa('0x47')]=_0x2c7c5f;if(_0x5e7770[_0xb5fa('0x41')][_0xb5fa('0x48')]===_0xb5fa('0x49')){var _0x10c381=[];for(var _0x4da448=0x0;_0x4da448<_0x49e786[_0xb5fa('0x47')][_0xb5fa('0x4a')];_0x4da448++){_0x10c381['push'](get_open_tabs(_0xb5fa('0x4b'),_0x49e786['rows'][_0x4da448][_0xb5fa('0x4c')]));_0x10c381[_0xb5fa('0x45')](get_open_tabs('sms',_0x49e786['rows'][_0x4da448][_0xb5fa('0x4c')]));_0x10c381[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x4d'),_0x49e786[_0xb5fa('0x47')][_0x4da448][_0xb5fa('0x4c')]));_0x10c381[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x4e'),_0x49e786[_0xb5fa('0x47')][_0x4da448]['dataValues']));_0x10c381[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x4f'),_0x49e786['rows'][_0x4da448][_0xb5fa('0x4c')]));_0x10c381[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x50'),_0x49e786[_0xb5fa('0x47')][_0x4da448][_0xb5fa('0x4c')]));}return BPromise[_0xb5fa('0x51')](_0x10c381)[_0xb5fa('0x13')](function(_0x33eb2c){return _0x49e786;});}else{return _0x49e786;}})[_0xb5fa('0x13')](respondWithFilteredResult(_0x4bba91,_0x4901ad))[_0xb5fa('0x1d')](handleError(_0x4bba91,null));};exports[_0xb5fa('0x52')]=function(_0x2bafe4,_0x6ae261){var _0x23be4c={'raw':![],'where':{'id':_0x2bafe4[_0xb5fa('0x53')]['id']}},_0x42a359={};_0x42a359['model']=_['differenceBy'](_[_0xb5fa('0x54')](db['User'][_0xb5fa('0x3a')]),[_0xb5fa('0x55'),'salt']);_0x42a359[_0xb5fa('0x41')]=_[_0xb5fa('0x54')](_0x2bafe4[_0xb5fa('0x41')]);_0x42a359[_0xb5fa('0x56')]=_[_0xb5fa('0x57')](_0x42a359[_0xb5fa('0x58')],_0x42a359['query']);_0x23be4c[_0xb5fa('0x44')]=_['intersection'](_0x42a359[_0xb5fa('0x58')],qs[_0xb5fa('0x59')](_0x2bafe4[_0xb5fa('0x41')]['fields']));_0x23be4c[_0xb5fa('0x44')]=_0x23be4c[_0xb5fa('0x44')]['length']?_0x23be4c['attributes']:_0x42a359[_0xb5fa('0x58')];if(_0x2bafe4[_0xb5fa('0x41')][_0xb5fa('0x42')]){_0x23be4c[_0xb5fa('0x43')]=[{'all':!![]}];}_0x23be4c=_[_0xb5fa('0x5a')]({},_0x23be4c,_0x2bafe4[_0xb5fa('0x5b')]);if(!_[_0xb5fa('0x33')](_0x23be4c[_0xb5fa('0x44')],'id')){_0x23be4c[_0xb5fa('0x44')][_0xb5fa('0x45')]('id');}return db[_0xb5fa('0x40')][_0xb5fa('0x34')](_0x23be4c)[_0xb5fa('0x13')](handleEntityNotFound(_0x6ae261,null))[_0xb5fa('0x13')](function(_0x23f235){var _0x42c34f=[];values=_0x23f235;if(_0x2bafe4[_0xb5fa('0x41')][_0xb5fa('0x48')]==='true'){_0x42c34f[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x4b'),_0x23f235[_0xb5fa('0x4c')]));_0x42c34f[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x5c'),_0x23f235[_0xb5fa('0x4c')]));_0x42c34f[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x4f'),_0x23f235[_0xb5fa('0x4c')]));_0x42c34f[_0xb5fa('0x45')](get_open_tabs('whatsapp',_0x23f235['dataValues']));_0x42c34f[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x4d'),_0x23f235[_0xb5fa('0x4c')]));_0x42c34f['push'](get_open_tabs(_0xb5fa('0x4e'),_0x23f235[_0xb5fa('0x4c')]));return BPromise[_0xb5fa('0x51')](_0x42c34f);}else{return values;}})[_0xb5fa('0x13')](function(_0x31ab22){return values;})[_0xb5fa('0x13')](respondWithResult(_0x6ae261,null))[_0xb5fa('0x1d')](handleError(_0x6ae261,null));};exports['update']=function(_0x7bcd09,_0x4611f3){if(_0x7bcd09['body']['id']){delete _0x7bcd09[_0xb5fa('0x5d')]['id'];}delete _0x7bcd09[_0xb5fa('0x5d')]['role'];return db[_0xb5fa('0x40')][_0xb5fa('0x34')]({'where':{'id':_0x7bcd09[_0xb5fa('0x53')]['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x4611f3,null))[_0xb5fa('0x13')](saveUpdates(_0x7bcd09[_0xb5fa('0x5d')],null))[_0xb5fa('0x13')](respondWithResult(_0x4611f3,null))[_0xb5fa('0x1d')](handleError(_0x4611f3,null));};exports[_0xb5fa('0x5e')]=function(_0x1c24e3,_0xfb88cc){return db[_0xb5fa('0x40')][_0xb5fa('0x5e')]()[_0xb5fa('0x13')](respondWithResult(_0xfb88cc,null))[_0xb5fa('0x1d')](handleError(_0xfb88cc,null));};exports[_0xb5fa('0x5f')]=function(_0x41cce9,_0x23fb01){return db[_0xb5fa('0x40')][_0xb5fa('0x34')]({'where':{'id':_0x41cce9[_0xb5fa('0x53')]['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x23fb01,null))['then'](function(_0x41fd9c){if(_0x41fd9c){return _0x41fd9c[_0xb5fa('0x5f')](_0x41cce9[_0xb5fa('0x5d')]['ids'],_[_0xb5fa('0x60')](_0x41cce9[_0xb5fa('0x5d')],['ids','id'])||{});}})[_0xb5fa('0x13')](respondWithResult(_0x23fb01,null))[_0xb5fa('0x1d')](handleError(_0x23fb01,null));};function validateUser(_0x5c25f6){return new BPromise(function(_0x571bb9,_0x5c93a0){if(_0x5c25f6[_0xb5fa('0x61')])return _0x571bb9(_0x5c25f6);return db[_0xb5fa('0x62')][_0xb5fa('0x63')](0x1)['then'](function(_0x597206){if(_0x597206[_0xb5fa('0x64')])authService[_0xb5fa('0x65')](_0x5c25f6[_0xb5fa('0x55')]);db['User']['max']('internal')[_0xb5fa('0x13')](function(_0x28a5f1){if(_[_0xb5fa('0x66')](_0x28a5f1)){_0x5c25f6['internal']=_0x597206[_0xb5fa('0x67')]||0x1;return;}if(_[_0xb5fa('0x66')](_0x597206[_0xb5fa('0x67')])||_0x597206[_0xb5fa('0x67')]===_0x28a5f1){_0x5c25f6[_0xb5fa('0x61')]=_0x28a5f1+0x1;return;}if(_0x597206[_0xb5fa('0x67')]>_0x28a5f1){_0x5c25f6[_0xb5fa('0x61')]=_0x597206[_0xb5fa('0x67')];return;}return db[_0xb5fa('0x68')][_0xb5fa('0x41')](_0xb5fa('0x69'),{'type':db[_0xb5fa('0x68')][_0xb5fa('0x6a')][_0xb5fa('0x6b')]})[_0xb5fa('0x13')](function(_0x5eeaa1){if(_0x5eeaa1&&_0x5eeaa1[_0xb5fa('0x4a')]){for(var _0x5a6f74=0x0,_0x47193c=_0x5eeaa1[_0xb5fa('0x4a')];_0x5a6f74<_0x47193c&&_[_0xb5fa('0x66')](_0x5c25f6[_0xb5fa('0x61')]);_0x5a6f74++){if(_0x597206[_0xb5fa('0x67')]<=_0x5eeaa1[_0x5a6f74]['from']){_0x5c25f6[_0xb5fa('0x61')]=_0x5eeaa1[_0x5a6f74]['from'];}else if(_0x597206[_0xb5fa('0x67')]>_0x5eeaa1[_0x5a6f74][_0xb5fa('0x6c')]&&_0x597206[_0xb5fa('0x67')]<=_0x5eeaa1[_0x5a6f74]['to']){_0x5c25f6[_0xb5fa('0x61')]=_0x597206['min_internal'];}}}if(_['isNil'](_0x5c25f6['internal'])){_0x5c25f6[_0xb5fa('0x61')]=_0x28a5f1+0x1;}return _0x571bb9(_0x5c25f6);});});})[_0xb5fa('0x1d')](function(_0x421dff){_0x5c93a0(_0x421dff);});});}function updateUser(_0x32e329){return new BPromise(function(_0x14bba6,_0x2f867e){try{if(_0x32e329['voicemail']){_0x32e329[_0xb5fa('0x6d')]=_0x32e329['internal'];_0x32e329['VoiceMail']={'mailbox':_0x32e329[_0xb5fa('0x61')],'password':_0x32e329['password'],'fullname':_0x32e329['fullname'],'email':_0x32e329['email']};}if(_0x32e329[_0xb5fa('0x2b')]==='agent'){if(!_0x32e329[_0xb5fa('0x6e')])_0x32e329[_0xb5fa('0x6e')]=[_0xb5fa('0x6f'),'102','103',_0xb5fa('0x70'),_0xb5fa('0x71'),'104',_0xb5fa('0x72'),_0xb5fa('0x73'),_0xb5fa('0x74'),_0xb5fa('0x75'),'109',_0xb5fa('0x76'),_0xb5fa('0x77'),_0xb5fa('0x78'),_0xb5fa('0x79')];}_0x14bba6(_0x32e329);}catch(_0x1c0f49){_0x2f867e(_0x1c0f49);}});}exports[_0xb5fa('0x7a')]=function(_0x33da84,_0x56f88c){if(_0x33da84[_0xb5fa('0x2e')]['role']===_0xb5fa('0x30'))throw new Error(_0xb5fa('0x7b'));if(_0x33da84['body'][_0xb5fa('0x2b')]===_0xb5fa('0x2e')&&_0x33da84[_0xb5fa('0x2e')][_0xb5fa('0x2b')]!==_0xb5fa('0x2c')){throw new Error(_0xb5fa('0x7c'));}if(_0x33da84[_0xb5fa('0x5d')][_0xb5fa('0x2b')]==='admin'&&_0x33da84[_0xb5fa('0x2e')][_0xb5fa('0x2b')]!==_0xb5fa('0x2c')){throw new Error(_0xb5fa('0x7d'));}return licenseUtil['checkUserLimits']([_0x33da84['body']])['then'](function(){return validateUser(_0x33da84['body']);})[_0xb5fa('0x13')](function(_0x1e607b){return updateUser(_0x1e607b)[_0xb5fa('0x13')](function(_0x188e66){if(_0x188e66['role']==='admin'){_0x188e66[_0xb5fa('0x7e')]=_0x33da84['user'][_0xb5fa('0x7e')];delete _0x188e66[_0xb5fa('0x7f')];}return _0x188e66;});})[_0xb5fa('0x13')](function(_0xfbd3ee){return db['User'][_0xb5fa('0x7a')](_0xfbd3ee,{'include':[{'model':db['VoiceMail'],'as':_0xb5fa('0x80')}]});})[_0xb5fa('0x13')](function(_0x524b10){if(_0x33da84['body'][_0xb5fa('0x2b')]===_0xb5fa('0x2e'))return _0x524b10;if(_0x33da84[_0xb5fa('0x2e')][_0xb5fa('0x2b')]!==_0xb5fa('0x2e'))return _0x524b10;return db[_0xb5fa('0x81')][_0xb5fa('0x34')]({'where':{'name':_0x524b10[_0xb5fa('0x2b')]===_0xb5fa('0x30')?_0xb5fa('0x2f'):_0xb5fa('0x31'),'userProfileId':_0x33da84[_0xb5fa('0x2e')][_0xb5fa('0x7f')]},'raw':!![]})['then'](function(_0x4b2818){if(!_0x4b2818||_0x4b2818[_0xb5fa('0x82')]!=0x0)return _0x524b10;return db['UserProfileResource'][_0xb5fa('0x7a')]({'name':_0x524b10[_0xb5fa('0x37')],'resourceId':_0x524b10['id'],'type':_0x4b2818['name'],'sectionId':_0x4b2818['id']},{})[_0xb5fa('0x13')](function(){return _0x524b10;});})[_0xb5fa('0x1d')](function(_0x4c2414){logger[_0xb5fa('0x19')](_0xb5fa('0x83'),_0x4c2414);throw _0x4c2414;});})['then'](respondWithResult(_0x56f88c,0xc9))[_0xb5fa('0x1d')](handleError(_0x56f88c,null));};exports[_0xb5fa('0x84')]=function(_0x367593,_0x5a358d){var _0x55c1c0=_0x367593[_0xb5fa('0x5d')];var _0x1a24a2=[];if(_0x367593[_0xb5fa('0x2e')][_0xb5fa('0x2b')]===_0xb5fa('0x30'))throw new Error(_0xb5fa('0x7b'));if(_[_0xb5fa('0x85')](_0x55c1c0,[_0xb5fa('0x2b'),_0xb5fa('0x2e')])&&_0x367593[_0xb5fa('0x2e')]['role']!=='admin'){throw new Error(_0xb5fa('0x7c'));}if(_[_0xb5fa('0x85')](_0x55c1c0,[_0xb5fa('0x2b'),_0xb5fa('0x2c')])&&_0x367593['user'][_0xb5fa('0x2b')]!==_0xb5fa('0x2c')){throw new Error(_0xb5fa('0x86'));}return licenseUtil['checkUserLimits'](_0x55c1c0)[_0xb5fa('0x13')](function(){return validateUser(_0x55c1c0[0x0]);})[_0xb5fa('0x13')](function(){for(var _0x109dd9=0x1;_0x109dd9<_0x55c1c0[_0xb5fa('0x4a')];_0x109dd9++){var _0x5ba2e7=_0x55c1c0[_0x109dd9-0x1][_0xb5fa('0x61')];if(!_0x55c1c0[_0x109dd9][_0xb5fa('0x61')])_0x55c1c0[_0x109dd9][_0xb5fa('0x61')]=_0x5ba2e7+0x1;_0x1a24a2[_0xb5fa('0x45')](validateUser(_0x55c1c0[_0x109dd9]));}return BPromise[_0xb5fa('0x51')](_0x1a24a2);})[_0xb5fa('0x13')](function(){_0x1a24a2=[];for(var _0x36014a=0x0;_0x36014a<_0x55c1c0[_0xb5fa('0x4a')];_0x36014a++){_0x1a24a2[_0xb5fa('0x45')](updateUser(_0x55c1c0[_0x36014a]));}return BPromise[_0xb5fa('0x51')](_0x1a24a2);})[_0xb5fa('0x13')](function(){return BPromise[_0xb5fa('0x87')](_0x55c1c0,function(_0x26d371){return db[_0xb5fa('0x40')][_0xb5fa('0x7a')](_0x26d371,{'include':[{'model':db['VoiceMail'],'as':_0xb5fa('0x80')}]})[_0xb5fa('0x13')](function(_0x2930bd){_0x26d371['id']=_0x2930bd['id'];return _0x26d371;});});})[_0xb5fa('0x13')](function(_0x464292){if(_0x367593[_0xb5fa('0x5d')][_0xb5fa('0x2b')]===_0xb5fa('0x2e'))return _0x464292;if(_0x367593['user']['role']!==_0xb5fa('0x2e'))return _0x464292;var _0x5b55a5=_['some'](_0x464292,function(_0x3b24fb){return _0x3b24fb[_0xb5fa('0x2b')]===_0xb5fa('0x30')||_0x3b24fb['role']===_0xb5fa('0x88');});if(!_0x5b55a5)return _0x464292;return db[_0xb5fa('0x81')][_0xb5fa('0x46')]({'where':{'name':{'$or':['Agents',_0xb5fa('0x31')]},'userProfileId':_0x367593[_0xb5fa('0x2e')]['userProfileId']},'raw':!![]})[_0xb5fa('0x13')](function(_0x3217b0){if(_[_0xb5fa('0x89')](_0x3217b0)||!_[_0xb5fa('0x85')](_0x3217b0,[_0xb5fa('0x82'),0x0]))return _0x464292;_0x1a24a2=[];var _0x40f10f=_(_0x3217b0)[_0xb5fa('0x8a')](function(_0x5266e7){if(_0x5266e7[_0xb5fa('0x82')]===0x1)return;return _0x5266e7[_0xb5fa('0x37')]===_0xb5fa('0x2f')?_0xb5fa('0x30'):'telephone';})['compact']()[_0xb5fa('0x32')]();for(var _0x21fa37=0x0;_0x21fa37<_0x464292[_0xb5fa('0x4a')];_0x21fa37++){if(!_[_0xb5fa('0x33')](_0x40f10f,_0x464292[_0x21fa37]['role']))return;var _0x4ee36b=_0x464292[_0x21fa37]['role']==='agent'?_0xb5fa('0x2f'):_0xb5fa('0x31');_0x1a24a2[_0xb5fa('0x45')](db[_0xb5fa('0x35')][_0xb5fa('0x7a')]({'name':_0x464292[_0x21fa37][_0xb5fa('0x37')],'resourceId':_0x464292[_0x21fa37]['id'],'type':_0x4ee36b,'sectionId':_[_0xb5fa('0x34')](_0x3217b0,[_0xb5fa('0x37'),_0x4ee36b])['id']},{}));}return BPromise[_0xb5fa('0x51')](_0x1a24a2);});})[_0xb5fa('0x13')](respondWithResult(_0x5a358d,0xc9))[_0xb5fa('0x1d')](handleError(_0x5a358d,null));};exports['changePassword']=function(_0x427d61,_0x2a6f66){if(_0x427d61['body']['id']){delete _0x427d61[_0xb5fa('0x5d')]['id'];}return db[_0xb5fa('0x40')]['find']({'where':{'id':_0x427d61[_0xb5fa('0x53')]['id']}})[_0xb5fa('0x13')](function(_0x902ba9){if(!_0x902ba9)return null;if(_0x902ba9['id']===_0x427d61[_0xb5fa('0x2e')]['id']){if(!_0x427d61[_0xb5fa('0x5d')][_0xb5fa('0x8b')]||!_0x427d61[_0xb5fa('0x5d')][_0xb5fa('0x8c')]){throw new db[(_0xb5fa('0x8d'))]['ValidationError'](_0xb5fa('0x8e'));}if(!_0x902ba9[_0xb5fa('0x8f')](_0x427d61[_0xb5fa('0x5d')][_0xb5fa('0x8b')])){throw new db[(_0xb5fa('0x8d'))][(_0xb5fa('0x90'))](_0xb5fa('0x91'));}if(_0x427d61[_0xb5fa('0x5d')]['oldPassword']===_0x427d61[_0xb5fa('0x5d')]['newPassword']){throw new db[(_0xb5fa('0x8d'))][(_0xb5fa('0x90'))](_0xb5fa('0x92'));}}else if(_0x427d61[_0xb5fa('0x2e')][_0xb5fa('0x2b')]===_0xb5fa('0x2c')){if(!_0x427d61[_0xb5fa('0x5d')][_0xb5fa('0x8c')]){throw new db[(_0xb5fa('0x8d'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x427d61[_0xb5fa('0x2e')][_0xb5fa('0x2b')]===_0xb5fa('0x2e')){if(!_0x427d61[_0xb5fa('0x5d')]['newPassword']){throw new db[(_0xb5fa('0x8d'))]['ValidationError'](_0xb5fa('0x93'));}if(_0x902ba9[_0xb5fa('0x2b')]!=='agent'){throw new db[(_0xb5fa('0x8d'))]['ValidationError'](_0xb5fa('0x7b'));}}else{throw new db['Sequelize'][(_0xb5fa('0x90'))](_0xb5fa('0x7b'));}return _0x902ba9;})[_0xb5fa('0x13')](handleEntityNotFound(_0x2a6f66,null))[_0xb5fa('0x13')](function(_0x70e28d){return db[_0xb5fa('0x62')][_0xb5fa('0x94')]({'attributes':['id',_0xb5fa('0x64'),_0xb5fa('0x95'),_0xb5fa('0x96')]})[_0xb5fa('0x13')](function(_0x4f5aed){if(_0x4f5aed[_0xb5fa('0x64')])authService[_0xb5fa('0x65')](_0x427d61[_0xb5fa('0x5d')]['newPassword']);if(!_0x4f5aed[_0xb5fa('0x95')]||!_0x70e28d[_0xb5fa('0x97')])return _0x70e28d;authService[_0xb5fa('0x98')](_0x427d61[_0xb5fa('0x5d')][_0xb5fa('0x8c')],_0x70e28d[_0xb5fa('0x97')],_0x4f5aed[_0xb5fa('0x96')]);return _0x70e28d;})[_0xb5fa('0x13')](saveUpdates({'password':_0x427d61['body'][_0xb5fa('0x8c')],'passwordResetAt':_0x427d61['user']['id']==_0x427d61[_0xb5fa('0x53')]['id']?moment():null,'previousPasswords':authService[_0xb5fa('0x99')](_0x427d61[_0xb5fa('0x5d')][_0xb5fa('0x8c')],_0x70e28d[_0xb5fa('0x97')])},null));})[_0xb5fa('0x13')](respondWithResult(_0x2a6f66,null))[_0xb5fa('0x1d')](handleError(_0x2a6f66,null));};exports[_0xb5fa('0x9a')]=function(_0x190810,_0x25d7d4){var _0x1feb1d=_0x190810[_0xb5fa('0x5d')][_0xb5fa('0x9b')];return db[_0xb5fa('0x40')][_0xb5fa('0x34')]({'where':{'id':_0x190810[_0xb5fa('0x53')]['id']},'attributes':['id',_0xb5fa('0x37'),'role',_0xb5fa('0x9c'),_0xb5fa('0x9d'),'voicePause',_0xb5fa('0x9e')]})[_0xb5fa('0x13')](handleEntityNotFound(_0x25d7d4,null))['then'](function(_0x4fefa0){if(_0x4fefa0){if(!utils['isValidChannel'](_0x1feb1d)){throw new db[(_0xb5fa('0x8d'))][(_0xb5fa('0x90'))](_0xb5fa('0x9f'));}return _0x4fefa0[_0xb5fa('0xa0')+_[_0xb5fa('0xa1')](_0x1feb1d[_0xb5fa('0xa2')]())+_0xb5fa('0xa3')](_0x190810['body']['ids'],{'penalty':_0x190810['body'][_0xb5fa('0xa4')]||0x0})['spread'](function(_0x4d1ba6){for(var _0x2c7076=0x0;_0x2c7076<_0x190810['body'][_0xb5fa('0xa5')][_0xb5fa('0x4a')];_0x2c7076+=0x1){var _0x267737={'UserId':Number(_0x190810[_0xb5fa('0x53')]['id'])};_0x267737[_[_0xb5fa('0xa1')](_0x1feb1d['toLowerCase']())+_0xb5fa('0xa6')]=Number(_0x190810[_0xb5fa('0x5d')][_0xb5fa('0xa5')][_0x2c7076]);socket[_0xb5fa('0xa7')](_0xb5fa('0x2e')+_['capitalize'](_0x1feb1d[_0xb5fa('0xa2')]())+_0xb5fa('0xa8'),_0x267737);}return _0x4d1ba6;})[_0xb5fa('0x13')](function(){if(_0x1feb1d===_0xb5fa('0xa9')){return db[_0xb5fa('0xaa')][_0xb5fa('0x46')]({'where':{'id':_0x190810['body'][_0xb5fa('0xa5')]||[]},'raw':!![],'attributes':['id',_0xb5fa('0x37')]});}})[_0xb5fa('0x13')](function(_0xc6d275){var _0x32c191=_0x4fefa0[_0xb5fa('0x2a')]({'plain':!![]});var _0x210976=[];if(_0x1feb1d===_0xb5fa('0xa9')&&_0x32c191[_0xb5fa('0x2b')]===_0xb5fa('0x30')&&_0x32c191[_0xb5fa('0x9c')]){for(var _0x1e770d=0x0;_0x1e770d<_0xc6d275[_0xb5fa('0x4a')];_0x1e770d+=0x1){_0x210976[_0xb5fa('0x45')]({'membername':_0x32c191[_0xb5fa('0x37')],'UserId':_0x32c191['id'],'queue_name':_0xc6d275[_0x1e770d][_0xb5fa('0x37')],'VoiceQueueId':_0xc6d275[_0x1e770d]['id'],'interface':_[_0xb5fa('0x66')](_0x32c191[_0xb5fa('0x9e')])?util[_0xb5fa('0xab')](_0xb5fa('0xac'),_0x32c191[_0xb5fa('0x37')]):_0x32c191[_0xb5fa('0x9e')],'paused':_0x32c191['voicePause']||![],'penalty':_0x190810['body'][_0xb5fa('0xa4')]||0x0});}return BPromise[_0xb5fa('0x87')](_0x210976,function(_0x43bc62){return db[_0xb5fa('0xad')][_0xb5fa('0xae')](_0x43bc62);});}return _0x4fefa0;});}})[_0xb5fa('0x13')](respondWithStatusCode(_0x25d7d4,null))['catch'](handleError(_0x25d7d4,null));};exports['removeQueues']=function(_0x52e1e2,_0x44f198){var _0x9a691f;return db['User'][_0xb5fa('0x34')]({'where':{'id':_0x52e1e2[_0xb5fa('0x53')]['id']},'attributes':['id','name',_0xb5fa('0x2b')]})[_0xb5fa('0x13')](handleEntityNotFound(_0x44f198,null))[_0xb5fa('0x13')](function(_0x3fd4de){if(_0x3fd4de){_0x9a691f=_0x3fd4de;if(!_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0x9b')]||!utils[_0xb5fa('0xaf')](_0x52e1e2[_0xb5fa('0x41')]['channel'])){throw new db[(_0xb5fa('0x8d'))]['ValidationError'](_0xb5fa('0x9f'));}return _0x3fd4de[_0xb5fa('0xb0')+_[_0xb5fa('0xa1')](_0x52e1e2[_0xb5fa('0x41')]['channel'][_0xb5fa('0xa2')]())+_0xb5fa('0xa3')](_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0xa5')]);}})['then'](function(_0xa1b25a){if(_[_0xb5fa('0xb1')](_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0xa5')])){for(var _0x16221f=0x0;_0x16221f<_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0xa5')]['length'];_0x16221f+=0x1){var _0x81e1b2={'UserId':Number(_0x52e1e2['params']['id'])};_0x81e1b2[_[_0xb5fa('0xa1')](_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0x9b')][_0xb5fa('0xa2')]())+_0xb5fa('0xa6')]=Number(_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0xa5')][_0x16221f]);socket['emit']('user'+_[_0xb5fa('0xa1')](_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0x9b')][_0xb5fa('0xa2')]())+_0xb5fa('0xb2'),_0x81e1b2);}}else{var _0x81e1b2={'UserId':Number(_0x52e1e2[_0xb5fa('0x53')]['id'])};_0x81e1b2[_[_0xb5fa('0xa1')](_0x52e1e2['query'][_0xb5fa('0x9b')][_0xb5fa('0xa2')]())+_0xb5fa('0xa6')]=Number(_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0xa5')]);socket[_0xb5fa('0xa7')](_0xb5fa('0x2e')+_[_0xb5fa('0xa1')](_0x52e1e2[_0xb5fa('0x41')]['channel'][_0xb5fa('0xa2')]())+'Queue:remove',_0x81e1b2);}return _0xa1b25a;})[_0xb5fa('0x13')](function(){if(_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0x9b')]===_0xb5fa('0xa9')){return db[_0xb5fa('0xad')][_0xb5fa('0x29')]({'where':{'UserId':_0x52e1e2['params']['id'],'VoiceQueueId':_0x52e1e2[_0xb5fa('0x41')][_0xb5fa('0xa5')]},'individualHooks':!![]})[_0xb5fa('0x13')](function(){return _0x9a691f;});}return _0x9a691f;})[_0xb5fa('0x13')](respondWithStatusCode(_0x44f198,null))[_0xb5fa('0x1d')](handleError(_0x44f198,null));};exports[_0xb5fa('0xb3')]=function(_0x4444da,_0x55ec26){_0x4444da['body'][_0xb5fa('0xb4')]=_0x4444da[_0xb5fa('0xb5')][_0xb5fa('0xb6')];return db[_0xb5fa('0x40')][_0xb5fa('0x34')]({'where':{'id':_0x4444da[_0xb5fa('0x53')]['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x55ec26,null))[_0xb5fa('0x13')](saveUpdates(_0x4444da[_0xb5fa('0x5d')],null))[_0xb5fa('0x13')](respondWithResult(_0x55ec26,null))['catch'](handleError(_0x55ec26,null));};exports[_0xb5fa('0xb7')]=function(_0x2dec50,_0x1b29c3){var _0x280ff2=path[_0xb5fa('0xb8')](config[_0xb5fa('0xb9')],_0xb5fa('0xba'));return db[_0xb5fa('0x40')][_0xb5fa('0x34')]({'where':{'id':_0x2dec50[_0xb5fa('0x53')]['id']},'attributes':['id',_0xb5fa('0xb4')],'raw':!![]})[_0xb5fa('0x13')](handleEntityNotFound(_0x1b29c3,null))[_0xb5fa('0x13')](function(_0x17bff3){if(_0x17bff3){if(_['isNil'](_0x17bff3['userpic'])){return _0x1b29c3[_0xb5fa('0xbb')](_0x280ff2);}else{if(!fs[_0xb5fa('0xbc')](path['join'](config[_0xb5fa('0xb9')],_0xb5fa('0xbd'),_0x17bff3[_0xb5fa('0xb4')]))){return _0x1b29c3['download'](_0x280ff2);}return _0x1b29c3[_0xb5fa('0xbb')](path[_0xb5fa('0xb8')](config[_0xb5fa('0xb9')],_0xb5fa('0xbd'),_0x17bff3[_0xb5fa('0xb4')]));}}})[_0xb5fa('0x1d')](handleError(_0x1b29c3,null));};exports[_0xb5fa('0xbe')]=function(_0x3c3590,_0x53a7be){return db[_0xb5fa('0x40')][_0xb5fa('0x34')]({'where':{'id':_0x3c3590['params']['id']},'attributes':['id']})[_0xb5fa('0x13')](handleEntityNotFound(_0x53a7be,null))[_0xb5fa('0x13')](function(_0x567ad1){var _0x1a38c2=[];values=_0x567ad1[_0xb5fa('0x4c')];_0x1a38c2[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x4b'),_0x567ad1[_0xb5fa('0x4c')]));_0x1a38c2[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x5c'),_0x567ad1[_0xb5fa('0x4c')]));_0x1a38c2['push'](get_open_tabs(_0xb5fa('0x4f'),_0x567ad1[_0xb5fa('0x4c')]));_0x1a38c2[_0xb5fa('0x45')](get_open_tabs(_0xb5fa('0x50'),_0x567ad1[_0xb5fa('0x4c')]));_0x1a38c2['push'](get_open_tabs(_0xb5fa('0x4d'),_0x567ad1[_0xb5fa('0x4c')]));_0x1a38c2[_0xb5fa('0x45')](get_open_tabs('mail',_0x567ad1[_0xb5fa('0x4c')]));return BPromise[_0xb5fa('0x51')](_0x1a38c2);})[_0xb5fa('0x13')](function(_0x539254){var _0x1cd1d8=[];if(_0x539254){for(var _0x3ae31a=0x0;_0x3ae31a=_0x9516f4['agents']){throw new Error(_0x97b6('0x59'));}})['then'](function(){if(_0x2baf69){return db[_0x97b6('0x43')][_0x97b6('0x4f')]({'where':{'membername':_0x2baf69[_0x97b6('0x2c')]},'individualHooks':!![]});}})[_0x97b6('0x12')](function(){if(_0x2baf69){return _0x2baf69['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x251e79){if(_0x2baf69){if(_0x251e79){var _0x5b9fd3=[];_0x3b9309=_0x251e79;if(_0x3b9309[_0x97b6('0x32')]){for(var _0x58a36e=0x0;_0x58a36e<_0x3b9309[_0x97b6('0x32')];_0x58a36e++){_0x5b9fd3[_0x97b6('0x4c')](db[_0x97b6('0x43')][_0x97b6('0x5a')]({'membername':_0x2baf69['name'],'UserId':_0x2baf69['id'],'queue_name':_0x3b9309[_0x58a36e][_0x97b6('0x2c')],'VoiceQueueId':_0x3b9309[_0x58a36e]['id'],'interface':_0x4ce876,'paused':_0x2baf69[_0x97b6('0x53')]||![],'penalty':_0x3b9309[_0x58a36e][_0x97b6('0x5b')]||0x0}));}return BPromise[_0x97b6('0x4d')](_0x5b9fd3);}}}})[_0x97b6('0x12')](function(){if(_0x2baf69){return db[_0x97b6('0x30')][_0x97b6('0x1f')]({'where':{'membername':_0x2baf69[_0x97b6('0x2c')],'exitAt':null}});}})['then'](function(_0x43066e){if(_0x2baf69){if(_0x43066e&&_0x43066e['length']){var _0xd67fcc=[];_0x43066e[_0x97b6('0x36')](function(_0x134722){_0xd67fcc['push'](_0x134722['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x97b6('0x4d')](_0xd67fcc);}}})['then'](function(_0x3fffe6){if(_0x2baf69){var _0x1dbb5d=[];var _0x185ddc=[];var _0x41d180=utils[_0x97b6('0x35')]();var _0x2f0892={'membername':_0x2baf69['name'],'interface':_0x4ce876,'enterAt':moment()[_0x97b6('0x33')](_0x97b6('0x34')),'role':_0x2baf69[_0x97b6('0x2d')],'internal':_0x2baf69[_0x97b6('0x2e')]};_0x41d180[_0x97b6('0x36')](function(_0x51c57e){_0x1dbb5d[_0x97b6('0x4c')](_[_0x97b6('0x5c')]({'channel':_0x51c57e,'type':'LOGIN','data1':'callysquare','data2':_0x4ce876},_0x2f0892));if(_0x2baf69[_0x97b6('0x53')]){_0x185ddc[_0x97b6('0x4c')](_[_0x97b6('0x5c')]({'channel':_0x51c57e,'type':'PAUSE','data1':_0x97b6('0x5d')},_0x2f0892));}});return db['MemberReport'][_0x97b6('0x5e')](_0x1dbb5d[_0x97b6('0x5f')](_0x185ddc),{'individualHooks':!![]});}})[_0x97b6('0x12')](function(){if(_0x2baf69){return _0x2baf69['update']({'online':!![],'lastLoginAt':moment()[_0x97b6('0x33')](_0x97b6('0x34')),'voicePause':_0x2baf69['loginInPause']||![],'mailPause':_0x2baf69[_0x97b6('0x53')]||![],'chatPause':_0x2baf69['loginInPause']||![],'faxPause':_0x2baf69[_0x97b6('0x53')]||![],'smsPause':_0x2baf69['loginInPause']||![],'openchannelPause':_0x2baf69[_0x97b6('0x53')]||![],'pauseType':_0x2baf69[_0x97b6('0x53')]?_0x97b6('0x5d'):null,'lastPauseAt':moment()['format'](_0x97b6('0x34')),'interface':_0x4ce876});}})[_0x97b6('0x12')](function(_0x54c039){_0x39452e(_0x54c039);})[_0x97b6('0x1c')](function(_0x3b9d79){_0x5b17f8(_0x352f35[_0x97b6('0x17')](0x1f4,_0x3b9d79[_0x97b6('0x19')]));});});}; \ No newline at end of file +var _0x9bb6=['voice','UserVoiceQueueRt','mail','fax','sms','openchannel','whatsapp','system','set','%s%s','all','LogoutUser','destroy','push','findOne','role','mobile','phone','count','agent','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','loginInPause','LOGININPAUSE','concat','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','error','code','message','result','GetUser','User','findAll','raw','options','where','attributes','limit','include','model','map','debug','stringify','ShowUser','find','catch','internal','interface','update','MemberReport','name','format','length','updateAttributes','getChannels','forEach','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','type','DEFAULT\x20PAUSE','body','uniqueid','bulkCreate','channel','Unknown\x20channel'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x9bb6,0x197));var _0x69bb=function(_0x454713,_0x3436dc){_0x454713=_0x454713-0x0;var _0x2509fe=_0x9bb6[_0x454713];return _0x2509fe;};'use strict';var _=require(_0x69bb('0x0'));var util=require(_0x69bb('0x1'));var moment=require(_0x69bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x69bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69bb('0x4'))['db'];var utils=require(_0x69bb('0x5'));var logger=require(_0x69bb('0x6'))(_0x69bb('0x7'));var config=require(_0x69bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x69bb('0x9')][_0x69bb('0xa')]({'port':0x232a});config['redis']=_[_0x69bb('0xb')](config[_0x69bb('0xc')],{'host':_0x69bb('0xd'),'port':0x18eb});var socket=require(_0x69bb('0xe'))(new Redis(config[_0x69bb('0xc')]));require(_0x69bb('0xf'))[_0x69bb('0x10')](socket);function respondWithRpcPromise(_0xb07509,_0x42c6ea,_0x17397b){return new BPromise(function(_0x2675c8,_0x518e82){return client[_0x69bb('0x11')](_0xb07509,_0x17397b)[_0x69bb('0x12')](function(_0x48f986){logger[_0x69bb('0x13')](_0x69bb('0x14'),_0x42c6ea,'request\x20sent');logger['debug'](_0x69bb('0x15'),_0x42c6ea,'request\x20sent',JSON['stringify'](_0x48f986));if(_0x48f986[_0x69bb('0x16')]){if(_0x48f986[_0x69bb('0x16')][_0x69bb('0x17')]===0x1f4){logger['error'](_0x69bb('0x14'),_0x42c6ea,_0x48f986['error']['message']);return _0x518e82(_0x48f986['error'][_0x69bb('0x18')]);}logger[_0x69bb('0x16')](_0x69bb('0x14'),_0x42c6ea,_0x48f986[_0x69bb('0x16')][_0x69bb('0x18')]);return _0x2675c8(_0x48f986['error'][_0x69bb('0x18')]);}else{logger[_0x69bb('0x13')]('User,\x20%s,\x20%s',_0x42c6ea,'request\x20sent');_0x2675c8(_0x48f986[_0x69bb('0x19')]['message']);}})['catch'](function(_0xa3792e){logger[_0x69bb('0x16')](_0x69bb('0x14'),_0x42c6ea,_0xa3792e);_0x518e82(_0xa3792e);});});}exports[_0x69bb('0x1a')]=function(_0x405210){var _0x3739a0=this;return new Promise(function(_0x5465cb,_0x1578a4){return db[_0x69bb('0x1b')][_0x69bb('0x1c')]({'raw':_0x405210['options']?_0x405210['options'][_0x69bb('0x1d')]===undefined?!![]:![]:!![],'where':_0x405210[_0x69bb('0x1e')]?_0x405210[_0x69bb('0x1e')][_0x69bb('0x1f')]||null:null,'attributes':_0x405210[_0x69bb('0x1e')]?_0x405210[_0x69bb('0x1e')][_0x69bb('0x20')]||null:null,'limit':_0x405210[_0x69bb('0x1e')]?_0x405210['options'][_0x69bb('0x21')]||null:null,'include':_0x405210[_0x69bb('0x1e')]?_0x405210[_0x69bb('0x1e')][_0x69bb('0x22')]?_['map'](_0x405210[_0x69bb('0x1e')]['include'],function(_0x1aeb40){return{'model':db[_0x1aeb40[_0x69bb('0x23')]],'as':_0x1aeb40['as'],'attributes':_0x1aeb40[_0x69bb('0x20')],'include':_0x1aeb40[_0x69bb('0x22')]?_[_0x69bb('0x24')](_0x1aeb40[_0x69bb('0x22')],function(_0x4eff7a){return{'model':db[_0x4eff7a[_0x69bb('0x23')]],'as':_0x4eff7a['as'],'attributes':_0x4eff7a[_0x69bb('0x20')],'include':_0x4eff7a[_0x69bb('0x22')]?_[_0x69bb('0x24')](_0x4eff7a[_0x69bb('0x22')],function(_0x565118){return{'model':db[_0x565118[_0x69bb('0x23')]],'as':_0x565118['as'],'attributes':_0x565118[_0x69bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x69bb('0x12')](function(_0x6388fb){logger[_0x69bb('0x13')]('GetUser',_0x405210);logger[_0x69bb('0x25')]('GetUser',_0x405210,JSON[_0x69bb('0x26')](_0x6388fb));_0x5465cb(_0x6388fb);})['catch'](function(_0x33311b){logger[_0x69bb('0x16')](_0x69bb('0x1a'),_0x33311b[_0x69bb('0x18')],_0x405210);_0x1578a4(_0x3739a0[_0x69bb('0x16')](0x1f4,_0x33311b[_0x69bb('0x18')]));});});};exports[_0x69bb('0x27')]=function(_0x1a4e55){var _0x2a065a=this;return new Promise(function(_0x4f900c,_0x3d1774){return db[_0x69bb('0x1b')][_0x69bb('0x28')]({'raw':_0x1a4e55['options']?_0x1a4e55[_0x69bb('0x1e')][_0x69bb('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a4e55[_0x69bb('0x1e')]?_0x1a4e55[_0x69bb('0x1e')]['where']||null:null,'attributes':_0x1a4e55['options']?_0x1a4e55[_0x69bb('0x1e')][_0x69bb('0x20')]||null:null,'include':_0x1a4e55[_0x69bb('0x1e')]?_0x1a4e55[_0x69bb('0x1e')][_0x69bb('0x22')]?_[_0x69bb('0x24')](_0x1a4e55['options']['include'],function(_0x4fedd0){return{'model':db[_0x4fedd0[_0x69bb('0x23')]],'as':_0x4fedd0['as'],'attributes':_0x4fedd0[_0x69bb('0x20')],'include':_0x4fedd0[_0x69bb('0x22')]?_[_0x69bb('0x24')](_0x4fedd0[_0x69bb('0x22')],function(_0x296361){return{'model':db[_0x296361[_0x69bb('0x23')]],'as':_0x296361['as'],'attributes':_0x296361[_0x69bb('0x20')],'include':_0x296361['include']?_['map'](_0x296361[_0x69bb('0x22')],function(_0x577e65){return{'model':db[_0x577e65[_0x69bb('0x23')]],'as':_0x577e65['as'],'attributes':_0x577e65[_0x69bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x69bb('0x12')](function(_0x5b7ff8){logger[_0x69bb('0x13')]('ShowUser',_0x1a4e55);logger[_0x69bb('0x25')](_0x69bb('0x27'),_0x1a4e55,JSON[_0x69bb('0x26')](_0x5b7ff8));_0x4f900c(_0x5b7ff8);})[_0x69bb('0x29')](function(_0x1a2f4e){logger['error']('ShowUser',_0x1a2f4e[_0x69bb('0x18')],_0x1a4e55);_0x3d1774(_0x2a065a[_0x69bb('0x16')](0x1f4,_0x1a2f4e[_0x69bb('0x18')]));});});};exports['PauseUser']=function(_0x18b839){var _0x4dbefc=this;return new Promise(function(_0x473f42,_0x38423a){var _0x1f29a3;return db[_0x69bb('0x1b')][_0x69bb('0x28')]({'where':_0x18b839[_0x69bb('0x1e')][_0x69bb('0x1f')]||{},'attributes':['id','name','role',_0x69bb('0x2a'),_0x69bb('0x2b')]})['then'](function(_0x4e384a){if(_0x4e384a){_0x1f29a3=_0x4e384a;return db['UserVoiceQueueRt'][_0x69bb('0x2c')]({'paused':0x1},{'where':{'UserId':_0x1f29a3['id']},'individualHooks':!![]});}})[_0x69bb('0x12')](function(){if(_0x1f29a3){return db[_0x69bb('0x2d')][_0x69bb('0x1c')]({'where':{'membername':_0x1f29a3[_0x69bb('0x2e')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x5a51c3){if(_0x1f29a3){if(_0x5a51c3&&_0x5a51c3['length']){var _0x5bc118=moment()[_0x69bb('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x188081=0x0,_0x69afe3=_0x5a51c3[_0x69bb('0x30')];_0x188081<_0x69afe3;_0x188081++){_0x5a51c3[_0x188081][_0x69bb('0x31')]({'exitAt':_0x5bc118});}}}})[_0x69bb('0x12')](function(){if(_0x1f29a3){var _0x3f87b2=[];var _0x1701d9=utils[_0x69bb('0x32')]();_0x1701d9[_0x69bb('0x33')](function(_0x52f160){_0x3f87b2['push']({'channel':_0x52f160,'membername':_0x1f29a3['name'],'interface':_[_0x69bb('0x34')](_0x1f29a3[_0x69bb('0x2b')])?util[_0x69bb('0x2f')](_0x69bb('0x35'),_0x1f29a3[_0x69bb('0x2e')]):_0x1f29a3[_0x69bb('0x2b')],'type':_0x69bb('0x36'),'enterAt':moment()['format'](_0x69bb('0x37')),'data1':_0x18b839['body'][_0x69bb('0x38')]||_0x69bb('0x39'),'role':_0x1f29a3['role'],'internal':_0x1f29a3['internal'],'uniqueid':_0x18b839[_0x69bb('0x3a')][_0x69bb('0x3b')]||null});});return db[_0x69bb('0x2d')][_0x69bb('0x3c')](_0x3f87b2,{'individualHooks':!![]});}})[_0x69bb('0x12')](function(){if(_0x1f29a3){return _0x1f29a3[_0x69bb('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x18b839['body'][_0x69bb('0x38')]||_0x69bb('0x39'),'lastPauseAt':moment()['format'](_0x69bb('0x37'))});}})[_0x69bb('0x12')](function(_0xf2d2ee){_0x473f42(_0xf2d2ee);})['catch'](function(_0x1e4687){_0x38423a(_0x4dbefc[_0x69bb('0x16')](0x1f4,_0x1e4687['message']));});});};exports['UnpauseUser']=function(_0x502608){var _0x16eed2=this;return new Promise(function(_0x2b1930,_0x5bffb6){var _0xf6e3d6;return db[_0x69bb('0x1b')]['findOne']({'where':_0x502608[_0x69bb('0x1e')][_0x69bb('0x1f')]||{},'attributes':['id',_0x69bb('0x2e')]})[_0x69bb('0x12')](function(_0x2a00c2){if(_0x2a00c2){_0xf6e3d6=_0x2a00c2;if(_0x502608[_0x69bb('0x3a')]['channel']&&!utils['isValidChannel'](_0x502608[_0x69bb('0x3a')][_0x69bb('0x3d')])){throw new Error(_0x69bb('0x3e'));}switch(_0x502608[_0x69bb('0x3a')][_0x69bb('0x3d')]){case _0x69bb('0x3f'):return db[_0x69bb('0x40')][_0x69bb('0x2c')]({'paused':0x0},{'where':{'UserId':_0xf6e3d6['id']}})[_0x69bb('0x12')](function(){return db['MemberReport'][_0x69bb('0x28')]({'where':{'channel':_0x502608['body'][_0x69bb('0x3d')],'membername':_0xf6e3d6[_0x69bb('0x2e')],'type':_0x69bb('0x36'),'exitAt':null}});})[_0x69bb('0x12')](function(_0x23ae01){if(_0x23ae01){return _0x23ae01[_0x69bb('0x2c')]({'exitAt':moment()[_0x69bb('0x2f')](_0x69bb('0x37')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x69bb('0x12')](function(){return _0xf6e3d6['update']({'voicePause':![]});});case _0x69bb('0x41'):case'chat':case _0x69bb('0x42'):case _0x69bb('0x43'):case _0x69bb('0x44'):case _0x69bb('0x45'):return db[_0x69bb('0x2d')][_0x69bb('0x28')]({'where':{'channel':_0x502608['body']['channel'],'membername':_0xf6e3d6['name'],'type':'PAUSE','exitAt':null}})[_0x69bb('0x12')](function(_0x46998c){return _0x46998c[_0x69bb('0x2c')]({'exitAt':moment()[_0x69bb('0x2f')](_0x69bb('0x37')),'data2':_0x69bb('0x46')},{'individualHooks':!![]});})[_0x69bb('0x12')](function(){var _0x2ed872={};_[_0x69bb('0x47')](_0x2ed872,util[_0x69bb('0x2f')](_0x69bb('0x48'),_0x502608['body'][_0x69bb('0x3d')],'Pause'),![]);return _0xf6e3d6[_0x69bb('0x2c')](_0x2ed872);});default:return db[_0x69bb('0x40')]['update']({'paused':0x0},{'where':{'UserId':_0xf6e3d6['id']}})['then'](function(){return db[_0x69bb('0x2d')][_0x69bb('0x1c')]({'where':{'membername':_0xf6e3d6[_0x69bb('0x2e')],'type':_0x69bb('0x36'),'exitAt':null}});})[_0x69bb('0x12')](function(_0x33f9a2){var _0x37f7ce=[];_0x33f9a2[_0x69bb('0x33')](function(_0x565c34){_0x37f7ce['push'](_0x565c34[_0x69bb('0x2c')]({'exitAt':moment()['format'](_0x69bb('0x37')),'data2':_0x69bb('0x46')}));});return BPromise[_0x69bb('0x49')](_0x37f7ce);})[_0x69bb('0x12')](function(){return _0xf6e3d6['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x69bb('0x12')](function(_0x305eba){_0x2b1930(_0x305eba);})['catch'](function(_0x4172be){_0x5bffb6(_0x16eed2[_0x69bb('0x16')](0x1f4,_0x4172be[_0x69bb('0x18')]));});});};exports[_0x69bb('0x4a')]=function(_0x55038a){var _0x4d4843=this;return new Promise(function(_0x75a716,_0x188965){var _0x5069a3;return db[_0x69bb('0x1b')]['findOne']({'where':_0x55038a[_0x69bb('0x1e')][_0x69bb('0x1f')]||{},'attributes':['id',_0x69bb('0x2e')]})[_0x69bb('0x12')](function(_0x4966df){if(_0x4966df){_0x5069a3=_0x4966df;return db[_0x69bb('0x40')][_0x69bb('0x4b')]({'where':{'membername':_0x5069a3['name']},'individualHooks':!![]});}})[_0x69bb('0x12')](function(){if(_0x5069a3){return db[_0x69bb('0x2d')][_0x69bb('0x1c')]({'where':{'membername':_0x5069a3['name'],'exitAt':null}});}})[_0x69bb('0x12')](function(_0x208b1b){if(_0x5069a3){if(_0x208b1b&&_0x208b1b[_0x69bb('0x30')]){var _0xe72ba3=[];_0x208b1b['forEach'](function(_0x26effd){_0xe72ba3[_0x69bb('0x4c')](_0x26effd[_0x69bb('0x2c')]({'exitAt':moment()[_0x69bb('0x2f')](_0x69bb('0x37'))}));});return BPromise[_0x69bb('0x49')](_0xe72ba3);}}})[_0x69bb('0x12')](function(){if(_0x5069a3){return _0x5069a3[_0x69bb('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x69bb('0x12')](function(_0x1ba910){_0x75a716(_0x1ba910);})[_0x69bb('0x29')](function(_0x2a4c86){_0x188965(_0x4d4843[_0x69bb('0x16')](0x1f4,_0x2a4c86[_0x69bb('0x18')]));});});};exports['LoginUser']=function(_0x159541){var _0x3dc947=this;return new Promise(function(_0x5de2f0,_0x35622d){var _0x1b6c41;var _0x5ea1f8;var _0xefb010;var _0x248bce;return db[_0x69bb('0x1b')][_0x69bb('0x4d')]({'where':_0x159541[_0x69bb('0x1e')][_0x69bb('0x1f')]||{},'attributes':['id',_0x69bb('0x2e'),_0x69bb('0x4e'),_0x69bb('0x4f'),_0x69bb('0x50'),_0x69bb('0x2a'),'loginInPause','interface']})[_0x69bb('0x12')](function(_0x1173b3){if(_0x1173b3){_0x1b6c41=_0x1173b3;_0x248bce=_0x159541[_0x69bb('0x3a')]['interface']?_0x159541[_0x69bb('0x3a')][_0x69bb('0x2b')]:util[_0x69bb('0x2f')]('SIP/%s',_0x1b6c41['name']);return db[_0x69bb('0x1b')][_0x69bb('0x51')]({'where':{'role':_0x69bb('0x52'),'online':!![],'id':{'$ne':_0x1b6c41['id']}}});}})['then'](function(_0x1b4ff4){if(_0x1b4ff4){_0xefb010=_0x1b4ff4;return require('../../config/license/util')['getLicense']();}})[_0x69bb('0x12')](function(_0x4cc7cf){if(_0x4cc7cf&&_0x4cc7cf[_0x69bb('0x53')]&&_0xefb010>=_0x4cc7cf['agents']){throw new Error(_0x69bb('0x54'));}})[_0x69bb('0x12')](function(){if(_0x1b6c41){return db[_0x69bb('0x40')][_0x69bb('0x4b')]({'where':{'membername':_0x1b6c41[_0x69bb('0x2e')]},'individualHooks':!![]});}})[_0x69bb('0x12')](function(){if(_0x1b6c41){return _0x1b6c41[_0x69bb('0x55')]({'raw':!![]});}})['then'](function(_0x7bb214){if(_0x1b6c41){if(_0x7bb214){var _0x24a3e6=[];_0x5ea1f8=_0x7bb214;if(_0x5ea1f8[_0x69bb('0x30')]){for(var _0x347810=0x0;_0x347810<_0x5ea1f8[_0x69bb('0x30')];_0x347810++){_0x24a3e6['push'](db[_0x69bb('0x40')][_0x69bb('0x56')]({'membername':_0x1b6c41[_0x69bb('0x2e')],'UserId':_0x1b6c41['id'],'queue_name':_0x5ea1f8[_0x347810][_0x69bb('0x2e')],'VoiceQueueId':_0x5ea1f8[_0x347810]['id'],'interface':_0x248bce,'paused':_0x1b6c41['loginInPause']||![],'penalty':_0x5ea1f8[_0x347810][_0x69bb('0x57')]||0x0}));}return BPromise[_0x69bb('0x49')](_0x24a3e6);}}}})[_0x69bb('0x12')](function(){if(_0x1b6c41){return db['MemberReport'][_0x69bb('0x1c')]({'where':{'membername':_0x1b6c41[_0x69bb('0x2e')],'exitAt':null}});}})[_0x69bb('0x12')](function(_0x21b512){if(_0x1b6c41){if(_0x21b512&&_0x21b512[_0x69bb('0x30')]){var _0x9c001e=[];_0x21b512['forEach'](function(_0x15cd7f){_0x9c001e[_0x69bb('0x4c')](_0x15cd7f['update']({'exitAt':moment()[_0x69bb('0x2f')](_0x69bb('0x37'))}));});return BPromise['all'](_0x9c001e);}}})[_0x69bb('0x12')](function(_0x4e0d3f){if(_0x1b6c41){var _0x497e47=[];var _0x5c1348=[];var _0x29f368=utils['getChannels']();var _0x4f6074={'membername':_0x1b6c41[_0x69bb('0x2e')],'interface':_0x248bce,'enterAt':moment()[_0x69bb('0x2f')](_0x69bb('0x37')),'role':_0x1b6c41['role'],'internal':_0x1b6c41[_0x69bb('0x2a')]};_0x29f368[_0x69bb('0x33')](function(_0x240839){_0x497e47[_0x69bb('0x4c')](_[_0x69bb('0x58')]({'channel':_0x240839,'type':_0x69bb('0x59'),'data1':_0x69bb('0x5a'),'data2':_0x248bce},_0x4f6074));if(_0x1b6c41[_0x69bb('0x5b')]){_0x5c1348[_0x69bb('0x4c')](_['merge']({'channel':_0x240839,'type':_0x69bb('0x36'),'data1':_0x69bb('0x5c')},_0x4f6074));}});return db[_0x69bb('0x2d')][_0x69bb('0x3c')](_0x497e47[_0x69bb('0x5d')](_0x5c1348),{'individualHooks':!![]});}})[_0x69bb('0x12')](function(){if(_0x1b6c41){return _0x1b6c41[_0x69bb('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x69bb('0x2f')](_0x69bb('0x37')),'voicePause':_0x1b6c41[_0x69bb('0x5b')]||![],'mailPause':_0x1b6c41[_0x69bb('0x5b')]||![],'chatPause':_0x1b6c41[_0x69bb('0x5b')]||![],'faxPause':_0x1b6c41[_0x69bb('0x5b')]||![],'smsPause':_0x1b6c41[_0x69bb('0x5b')]||![],'openchannelPause':_0x1b6c41[_0x69bb('0x5b')]||![],'pauseType':_0x1b6c41[_0x69bb('0x5b')]?_0x69bb('0x5c'):null,'lastPauseAt':moment()[_0x69bb('0x2f')](_0x69bb('0x37')),'interface':_0x248bce});}})[_0x69bb('0x12')](function(_0x470e42){_0x5de2f0(_0x470e42);})[_0x69bb('0x29')](function(_0x34ddc7){_0x35622d(_0x3dc947[_0x69bb('0x16')](0x1f4,_0x34ddc7[_0x69bb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 69c88fc..67b24f2 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 _0x4616=['./user.events','save','update','removeListener','register','length','user:'];(function(_0xe1b2a8,_0x38f786){var _0x554804=function(_0x412030){while(--_0x412030){_0xe1b2a8['push'](_0xe1b2a8['shift']());}};_0x554804(++_0x38f786);}(_0x4616,0xd9));var _0x6461=function(_0x16b00d,_0x530d31){_0x16b00d=_0x16b00d-0x0;var _0x2fd052=_0x4616[_0x16b00d];return _0x2fd052;};'use strict';var UserEvents=require(_0x6461('0x0'));var events=[_0x6461('0x1'),'remove',_0x6461('0x2')];function createListener(_0x3328ac,_0x38eb52){return function(_0x1ae6dc){_0x38eb52['emit'](_0x3328ac,_0x1ae6dc);};}function removeListener(_0x38b123,_0x3f666){return function(){UserEvents[_0x6461('0x3')](_0x38b123,_0x3f666);};}exports[_0x6461('0x4')]=function(_0x5db152){for(var _0x4944b1=0x0,_0x37c616=events[_0x6461('0x5')];_0x4944b1<_0x37c616;_0x4944b1++){var _0x5cea5f=events[_0x4944b1];var _0x460291=createListener(_0x6461('0x6')+_0x5cea5f,_0x5db152);UserEvents['on'](_0x5cea5f,_0x460291);}}; \ No newline at end of file +var _0xeafb=['emit','removeListener','register','length','./user.events','save','remove','update'];(function(_0x535619,_0x19109a){var _0x4a9a79=function(_0x5b0023){while(--_0x5b0023){_0x535619['push'](_0x535619['shift']());}};_0x4a9a79(++_0x19109a);}(_0xeafb,0xd4));var _0xbeaf=function(_0x373059,_0x17b09c){_0x373059=_0x373059-0x0;var _0x368f67=_0xeafb[_0x373059];return _0x368f67;};'use strict';var UserEvents=require(_0xbeaf('0x0'));var events=[_0xbeaf('0x1'),_0xbeaf('0x2'),_0xbeaf('0x3')];function createListener(_0x44fbcb,_0x4119c5){return function(_0x2be4c7){_0x4119c5[_0xbeaf('0x4')](_0x44fbcb,_0x2be4c7);};}function removeListener(_0x3c0e97,_0x5b33c2){return function(){UserEvents[_0xbeaf('0x5')](_0x3c0e97,_0x5b33c2);};}exports[_0xbeaf('0x6')]=function(_0x2a7911){for(var _0x25b464=0x0,_0x52f81a=events[_0xbeaf('0x7')];_0x25b464<_0x52f81a;_0x25b464++){var _0x3b99c9=events[_0x25b464];var _0x34f405=createListener('user:'+_0x3b99c9,_0x2a7911);UserEvents['on'](_0x3b99c9,_0x34f405);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f0eddb3..b266449 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4b839e,_0x53eba0){var _0x2d7370=function(_0xda3d0d){while(--_0xda3d0d){_0x4b839e['push'](_0x4b839e['shift']());}};_0x2d7370(++_0x53eba0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xcb91[_0x34d275];return _0x1379cc;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index bccbe63..736bc7f 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 _0x9891=['INTEGER'];(function(_0x3ed9ed,_0x5841b0){var _0x4e9106=function(_0x20949b){while(--_0x20949b){_0x3ed9ed['push'](_0x3ed9ed['shift']());}};_0x4e9106(++_0x5841b0);}(_0x9891,0x1ee));var _0x1989=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x9891[_0x44b3bd];return _0x1efc4a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x1989('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbb9d=['exports','INTEGER','sequelize'];(function(_0x4d3681,_0x136f19){var _0x22c7ac=function(_0x3c6120){while(--_0x3c6120){_0x4d3681['push'](_0x4d3681['shift']());}};_0x22c7ac(++_0x136f19);}(_0xbb9d,0x1d3));var _0xdbb9=function(_0x17d86e,_0x45e284){_0x17d86e=_0x17d86e-0x0;var _0x75bea0=_0xbb9d[_0x17d86e];return _0x75bea0;};'use strict';var Sequelize=require(_0xdbb9('0x0'));module[_0xdbb9('0x1')]={'penalty':{'type':Sequelize[_0xdbb9('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 09ca41f..337fcce 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 _0xb00c=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xb00c,0xe4));var _0xcb00=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0xb00c[_0x54d52];return _0x968345;};'use strict';var _=require(_0xcb00('0x0'));var util=require(_0xcb00('0x1'));var logger=require(_0xcb00('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcb00('0x3'));var rp=require(_0xcb00('0x4'));var fs=require('fs');var path=require(_0xcb00('0x5'));var rimraf=require(_0xcb00('0x6'));var config=require(_0xcb00('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xcb00('0x8')]=function(_0x430cc7,_0x3c7da5){return _0x430cc7[_0xcb00('0x9')](_0xcb00('0xa'),attributes,{'tableName':_0xcb00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde8d=['UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xde8d,0x1de));var _0xdde8=function(_0x31ba0f,_0x521571){_0x31ba0f=_0x31ba0f-0x0;var _0xe991a0=_0xde8d[_0x31ba0f];return _0xe991a0;};'use strict';var _=require(_0xdde8('0x0'));var util=require(_0xdde8('0x1'));var logger=require('../../config/logger')(_0xdde8('0x2'));var moment=require(_0xdde8('0x3'));var BPromise=require(_0xdde8('0x4'));var rp=require(_0xdde8('0x5'));var fs=require('fs');var path=require(_0xdde8('0x6'));var rimraf=require(_0xdde8('0x7'));var config=require(_0xdde8('0x8'));var attributes=require(_0xdde8('0x9'));module[_0xdde8('0xa')]=function(_0x39cad0,_0x3980a6){return _0x39cad0[_0xdde8('0xb')](_0xdde8('0xc'),attributes,{'tableName':_0xdde8('0xd'),'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 0288c98..8f2af27 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 _0xe7bf=['client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0xe7bf,0x85));var _0xfe7b=function(_0x428319,_0x4e3729){_0x428319=_0x428319-0x0;var _0x836f81=_0xe7bf[_0x428319];return _0x836f81;};'use strict';var _=require(_0xfe7b('0x0'));var util=require(_0xfe7b('0x1'));var moment=require(_0xfe7b('0x2'));var BPromise=require(_0xfe7b('0x3'));var rs=require(_0xfe7b('0x4'));var fs=require('fs');var Redis=require(_0xfe7b('0x5'));var db=require(_0xfe7b('0x6'))['db'];var utils=require(_0xfe7b('0x7'));var logger=require(_0xfe7b('0x8'))(_0xfe7b('0x9'));var config=require(_0xfe7b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfe7b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd28d10,_0x4e9079,_0xc1e0dd){return new BPromise(function(_0x27310b,_0x59305c){return client[_0xfe7b('0xc')](_0xd28d10,_0xc1e0dd)[_0xfe7b('0xd')](function(_0xe55cfa){logger[_0xfe7b('0xe')](_0xfe7b('0xf'),_0x4e9079,_0xfe7b('0x10'));logger['debug'](_0xfe7b('0x11'),_0x4e9079,_0xfe7b('0x10'),JSON[_0xfe7b('0x12')](_0xe55cfa));if(_0xe55cfa[_0xfe7b('0x13')]){if(_0xe55cfa['error'][_0xfe7b('0x14')]===0x1f4){logger[_0xfe7b('0x13')](_0xfe7b('0xf'),_0x4e9079,_0xe55cfa[_0xfe7b('0x13')]['message']);return _0x59305c(_0xe55cfa[_0xfe7b('0x13')][_0xfe7b('0x15')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x4e9079,_0xe55cfa['error'][_0xfe7b('0x15')]);return _0x27310b(_0xe55cfa[_0xfe7b('0x13')][_0xfe7b('0x15')]);}else{logger[_0xfe7b('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x4e9079,_0xfe7b('0x10'));_0x27310b(_0xe55cfa[_0xfe7b('0x16')]['message']);}})[_0xfe7b('0x17')](function(_0x51501f){logger[_0xfe7b('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x4e9079,_0x51501f);_0x59305c(_0x51501f);});});} \ No newline at end of file +var _0x9c61=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x9c61,0x16f));var _0x19c6=function(_0x1ebc56,_0x27e0ab){_0x1ebc56=_0x1ebc56-0x0;var _0x205431=_0x9c61[_0x1ebc56];return _0x205431;};'use strict';var _=require(_0x19c6('0x0'));var util=require('util');var moment=require(_0x19c6('0x1'));var BPromise=require(_0x19c6('0x2'));var rs=require(_0x19c6('0x3'));var fs=require('fs');var Redis=require(_0x19c6('0x4'));var db=require(_0x19c6('0x5'))['db'];var utils=require(_0x19c6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x19c6('0x7'));var jayson=require(_0x19c6('0x8'));var client=jayson[_0x19c6('0x9')][_0x19c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38599d,_0x371daf,_0x14c9ce){return new BPromise(function(_0x539fa8,_0x431194){return client[_0x19c6('0xb')](_0x38599d,_0x14c9ce)[_0x19c6('0xc')](function(_0x508425){logger[_0x19c6('0xd')](_0x19c6('0xe'),_0x371daf,_0x19c6('0xf'));logger['debug'](_0x19c6('0x10'),_0x371daf,_0x19c6('0xf'),JSON[_0x19c6('0x11')](_0x508425));if(_0x508425[_0x19c6('0x12')]){if(_0x508425[_0x19c6('0x12')][_0x19c6('0x13')]===0x1f4){logger[_0x19c6('0x12')](_0x19c6('0xe'),_0x371daf,_0x508425['error'][_0x19c6('0x14')]);return _0x431194(_0x508425[_0x19c6('0x12')]['message']);}logger[_0x19c6('0x12')](_0x19c6('0xe'),_0x371daf,_0x508425[_0x19c6('0x12')][_0x19c6('0x14')]);return _0x539fa8(_0x508425[_0x19c6('0x12')][_0x19c6('0x14')]);}else{logger[_0x19c6('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x371daf,'request\x20sent');_0x539fa8(_0x508425[_0x19c6('0x15')][_0x19c6('0x14')]);}})[_0x19c6('0x16')](function(_0x59f78d){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x371daf,_0x59f78d);_0x431194(_0x59f78d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c81cb7a..33da627 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_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(_0x4edd73,_0x31c9f4){var _0x60a855=function(_0x183bce){while(--_0x183bce){_0x4edd73['push'](_0x4edd73['shift']());}};_0x60a855(++_0x31c9f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6387d23..7089b0d 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 _0x27b8=['exports','INTEGER','STRING'];(function(_0x10a35d,_0x1da81e){var _0x3ef6a0=function(_0x2cb5b1){while(--_0x2cb5b1){_0x10a35d['push'](_0x10a35d['shift']());}};_0x3ef6a0(++_0x1da81e);}(_0x27b8,0x66));var _0x827b=function(_0x1b4b01,_0x48df9b){_0x1b4b01=_0x1b4b01-0x0;var _0x4caaed=_0x27b8[_0x1b4b01];return _0x4caaed;};'use strict';var Sequelize=require('sequelize');module[_0x827b('0x0')]={'penalty':{'type':Sequelize[_0x827b('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x827b('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x827b('0x2')]}}; \ No newline at end of file +var _0x3cb4=['sequelize','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3cb4,0xc6));var _0x43cb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3cb4[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x43cb('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x43cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4643819..749ce87 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 _0xf85e=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0xf85e,0x198));var _0xef85=function(_0x4edce3,_0x2dc278){_0x4edce3=_0x4edce3-0x0;var _0x899ee8=_0xf85e[_0x4edce3];return _0x899ee8;};'use strict';var _=require(_0xef85('0x0'));var util=require('util');var logger=require(_0xef85('0x1'))(_0xef85('0x2'));var moment=require(_0xef85('0x3'));var BPromise=require('bluebird');var rp=require(_0xef85('0x4'));var fs=require('fs');var path=require(_0xef85('0x5'));var rimraf=require(_0xef85('0x6'));var config=require(_0xef85('0x7'));var attributes=require(_0xef85('0x8'));module[_0xef85('0x9')]=function(_0x584931,_0x1b50ee){return _0x584931[_0xef85('0xa')]('UserFaxQueue',attributes,{'tableName':_0xef85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5434=['lodash','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','user_has_fax_queues'];(function(_0x64daf7,_0x3ce579){var _0x11d8d8=function(_0x3d986b){while(--_0x3d986b){_0x64daf7['push'](_0x64daf7['shift']());}};_0x11d8d8(++_0x3ce579);}(_0x5434,0xb4));var _0x4543=function(_0x5409cf,_0x2f8477){_0x5409cf=_0x5409cf-0x0;var _0x270d90=_0x5434[_0x5409cf];return _0x270d90;};'use strict';var _=require(_0x4543('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4543('0x1'));var rp=require(_0x4543('0x2'));var fs=require('fs');var path=require(_0x4543('0x3'));var rimraf=require(_0x4543('0x4'));var config=require(_0x4543('0x5'));var attributes=require(_0x4543('0x6'));module['exports']=function(_0x293abc,_0x4a492c){return _0x293abc[_0x4543('0x7')]('UserFaxQueue',attributes,{'tableName':_0x4543('0x8'),'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 43204c9..351f6fb 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 _0xbd7f=['../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x362437,_0x16a9ef){var _0x2d3579=function(_0x4f04a0){while(--_0x4f04a0){_0x362437['push'](_0x362437['shift']());}};_0x2d3579(++_0x16a9ef);}(_0xbd7f,0x11f));var _0xfbd7=function(_0x9bd908,_0x3f5e34){_0x9bd908=_0x9bd908-0x0;var _0x41c07e=_0xbd7f[_0x9bd908];return _0x41c07e;};'use strict';var _=require(_0xfbd7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfbd7('0x1'));var fs=require('fs');var Redis=require(_0xfbd7('0x2'));var db=require(_0xfbd7('0x3'))['db'];var utils=require(_0xfbd7('0x4'));var logger=require(_0xfbd7('0x5'))(_0xfbd7('0x6'));var config=require(_0xfbd7('0x7'));var jayson=require(_0xfbd7('0x8'));var client=jayson[_0xfbd7('0x9')][_0xfbd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd93b16,_0x42aaba,_0xc0595f){return new BPromise(function(_0x509206,_0x18e9a1){return client['request'](_0xd93b16,_0xc0595f)[_0xfbd7('0xb')](function(_0x126748){logger['info'](_0xfbd7('0xc'),_0x42aaba,_0xfbd7('0xd'));logger['debug'](_0xfbd7('0xe'),_0x42aaba,'request\x20sent',JSON['stringify'](_0x126748));if(_0x126748['error']){if(_0x126748[_0xfbd7('0xf')][_0xfbd7('0x10')]===0x1f4){logger[_0xfbd7('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x42aaba,_0x126748[_0xfbd7('0xf')][_0xfbd7('0x11')]);return _0x18e9a1(_0x126748[_0xfbd7('0xf')][_0xfbd7('0x11')]);}logger[_0xfbd7('0xf')](_0xfbd7('0xc'),_0x42aaba,_0x126748[_0xfbd7('0xf')][_0xfbd7('0x11')]);return _0x509206(_0x126748[_0xfbd7('0xf')]['message']);}else{logger[_0xfbd7('0x12')](_0xfbd7('0xc'),_0x42aaba,_0xfbd7('0xd'));_0x509206(_0x126748[_0xfbd7('0x13')][_0xfbd7('0x11')]);}})[_0xfbd7('0x14')](function(_0x2b8822){logger[_0xfbd7('0xf')](_0xfbd7('0xc'),_0x42aaba,_0x2b8822);_0x18e9a1(_0x2b8822);});});} \ No newline at end of file +var _0x1b3a=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x319784,_0x47e6d4){var _0x1917da=function(_0x2cb921){while(--_0x2cb921){_0x319784['push'](_0x319784['shift']());}};_0x1917da(++_0x47e6d4);}(_0x1b3a,0x119));var _0xa1b3=function(_0x1fe461,_0xefd92a){_0x1fe461=_0x1fe461-0x0;var _0x4d9b8f=_0x1b3a[_0x1fe461];return _0x4d9b8f;};'use strict';var _=require(_0xa1b3('0x0'));var util=require('util');var moment=require(_0xa1b3('0x1'));var BPromise=require(_0xa1b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1b3('0x3'));var db=require(_0xa1b3('0x4'))['db'];var utils=require(_0xa1b3('0x5'));var logger=require(_0xa1b3('0x6'))(_0xa1b3('0x7'));var config=require(_0xa1b3('0x8'));var jayson=require(_0xa1b3('0x9'));var client=jayson[_0xa1b3('0xa')][_0xa1b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x263bf6,_0x2a97a6,_0x3a3a18){return new BPromise(function(_0x49fa39,_0xf10cd5){return client[_0xa1b3('0xc')](_0x263bf6,_0x3a3a18)[_0xa1b3('0xd')](function(_0x39e088){logger[_0xa1b3('0xe')](_0xa1b3('0xf'),_0x2a97a6,_0xa1b3('0x10'));logger[_0xa1b3('0x11')](_0xa1b3('0x12'),_0x2a97a6,'request\x20sent',JSON['stringify'](_0x39e088));if(_0x39e088[_0xa1b3('0x13')]){if(_0x39e088['error'][_0xa1b3('0x14')]===0x1f4){logger['error'](_0xa1b3('0xf'),_0x2a97a6,_0x39e088[_0xa1b3('0x13')][_0xa1b3('0x15')]);return _0xf10cd5(_0x39e088[_0xa1b3('0x13')][_0xa1b3('0x15')]);}logger[_0xa1b3('0x13')](_0xa1b3('0xf'),_0x2a97a6,_0x39e088[_0xa1b3('0x13')][_0xa1b3('0x15')]);return _0x49fa39(_0x39e088[_0xa1b3('0x13')]['message']);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2a97a6,_0xa1b3('0x10'));_0x49fa39(_0x39e088[_0xa1b3('0x16')][_0xa1b3('0x15')]);}})[_0xa1b3('0x17')](function(_0x22a8e5){logger[_0xa1b3('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2a97a6,_0x22a8e5);_0xf10cd5(_0x22a8e5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d1b837a..1fba9da 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2eedc7,_0x2f7d83){var _0x413025=function(_0x407f48){while(--_0x407f48){_0x2eedc7['push'](_0x2eedc7['shift']());}};_0x413025(++_0x2f7d83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3b92db,_0x4ef472){var _0x2d5cec=function(_0x354f4){while(--_0x354f4){_0x3b92db['push'](_0x3b92db['shift']());}};_0x2d5cec(++_0x4ef472);}(_0x70e0,0x17b));var _0x070e=function(_0x2fbe6c,_0x354ead){_0x2fbe6c=_0x2fbe6c-0x0;var _0x1d739e=_0x70e0[_0x2fbe6c];return _0x1d739e;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index f7ee059..f750ce7 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 _0x183d=['exports','INTEGER'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x183d,0x92));var _0xd183=function(_0x9f1398,_0x2c5082){_0x9f1398=_0x9f1398-0x0;var _0x4477ce=_0x183d[_0x9f1398];return _0x4477ce;};'use strict';var Sequelize=require('sequelize');module[_0xd183('0x0')]={'penalty':{'type':Sequelize[_0xd183('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd20e=['sequelize'];(function(_0x53de44,_0x2d11a3){var _0x512468=function(_0x772498){while(--_0x772498){_0x53de44['push'](_0x53de44['shift']());}};_0x512468(++_0x2d11a3);}(_0xd20e,0x198));var _0xed20=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xd20e[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0xed20('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 5666051..28d7049 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 _0xcc20=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger'];(function(_0x1f3d15,_0x5176a8){var _0x48617b=function(_0x5e2eb8){while(--_0x5e2eb8){_0x1f3d15['push'](_0x1f3d15['shift']());}};_0x48617b(++_0x5176a8);}(_0xcc20,0x1ec));var _0x0cc2=function(_0x22ca96,_0x417faf){_0x22ca96=_0x22ca96-0x0;var _0x1da01b=_0xcc20[_0x22ca96];return _0x1da01b;};'use strict';var _=require(_0x0cc2('0x0'));var util=require('util');var logger=require(_0x0cc2('0x1'))(_0x0cc2('0x2'));var moment=require(_0x0cc2('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cc2('0x4'));var fs=require('fs');var path=require(_0x0cc2('0x5'));var rimraf=require(_0x0cc2('0x6'));var config=require(_0x0cc2('0x7'));var attributes=require(_0x0cc2('0x8'));module[_0x0cc2('0x9')]=function(_0x292774,_0x407913){return _0x292774[_0x0cc2('0xa')](_0x0cc2('0xb'),attributes,{'tableName':_0x0cc2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabf8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabf8,0x1ab));var _0x8abf=function(_0x464629,_0x5ce87e){_0x464629=_0x464629-0x0;var _0x1d454f=_0xabf8[_0x464629];return _0x1d454f;};'use strict';var _=require(_0x8abf('0x0'));var util=require(_0x8abf('0x1'));var logger=require(_0x8abf('0x2'))(_0x8abf('0x3'));var moment=require(_0x8abf('0x4'));var BPromise=require(_0x8abf('0x5'));var rp=require(_0x8abf('0x6'));var fs=require('fs');var path=require(_0x8abf('0x7'));var rimraf=require(_0x8abf('0x8'));var config=require(_0x8abf('0x9'));var attributes=require(_0x8abf('0xa'));module['exports']=function(_0x7f7633,_0x59456d){return _0x7f7633['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index c3ee3da..a81fdff 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 _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(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2966cc,_0x5ebc46){_0x2966cc=_0x2966cc-0x0;var _0x45c33f=_0x1cb9[_0x2966cc];return _0x45c33f;};'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 +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x34b9de,_0xc48f61){var _0x24ca90=function(_0x4afd1e){while(--_0x4afd1e){_0x34b9de['push'](_0x34b9de['shift']());}};_0x24ca90(++_0xc48f61);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index bcb2381..669de8a 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 _0x1fee=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','Router'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x1fee,0x71));var _0xe1fe=function(_0x4cf232,_0x531d2f){_0x4cf232=_0x4cf232-0x0;var _0x5d11f6=_0x1fee[_0x4cf232];return _0x5d11f6;};'use strict';var multer=require(_0xe1fe('0x0'));var util=require('util');var path=require(_0xe1fe('0x1'));var timeout=require(_0xe1fe('0x2'));var express=require('express');var router=express[_0xe1fe('0x3')]();var fs_extra=require(_0xe1fe('0x4'));var auth=require(_0xe1fe('0x5'));var interaction=require(_0xe1fe('0x6'));var config=require(_0xe1fe('0x7'));var controller=require(_0xe1fe('0x8'));router[_0xe1fe('0x9')]('/',auth[_0xe1fe('0xa')](),controller[_0xe1fe('0xb')]);module[_0xe1fe('0xc')]=router; \ No newline at end of file +var _0x3721=['./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50b881,_0x33ba68){var _0x4ad702=function(_0x57f7ea){while(--_0x57f7ea){_0x50b881['push'](_0x50b881['shift']());}};_0x4ad702(++_0x33ba68);}(_0x3721,0x116));var _0x1372=function(_0x3276ed,_0x2ff885){_0x3276ed=_0x3276ed-0x0;var _0x47815c=_0x3721[_0x3276ed];return _0x47815c;};'use strict';var multer=require(_0x1372('0x0'));var util=require('util');var path=require(_0x1372('0x1'));var timeout=require(_0x1372('0x2'));var express=require('express');var router=express[_0x1372('0x3')]();var fs_extra=require(_0x1372('0x4'));var auth=require(_0x1372('0x5'));var interaction=require(_0x1372('0x6'));var config=require(_0x1372('0x7'));var controller=require(_0x1372('0x8'));router[_0x1372('0x9')]('/',auth[_0x1372('0xa')](),controller[_0x1372('0xb')]);module[_0x1372('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e1235d7..d9b677c 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 _0x6e9b=['exports','TEXT','STRING','BOOLEAN'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x6e9b,0x6c));var _0xb6e9=function(_0x5108fb,_0x53b8d2){_0x5108fb=_0x5108fb-0x0;var _0x35fee7=_0x6e9b[_0x5108fb];return _0x35fee7;};'use strict';var Sequelize=require('sequelize');module[_0xb6e9('0x0')]={'body':{'type':Sequelize[_0xb6e9('0x1')]},'senderName':{'type':Sequelize[_0xb6e9('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xb6e9('0x2')]},'beep':{'type':Sequelize[_0xb6e9('0x3')]}}; \ No newline at end of file +var _0x814f=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x4e7af4,_0x758572){var _0x2548f1=function(_0xa849c){while(--_0xa849c){_0x4e7af4['push'](_0x4e7af4['shift']());}};_0x2548f1(++_0x758572);}(_0x814f,0x156));var _0xf814=function(_0x197425,_0x5392df){_0x197425=_0x197425-0x0;var _0x5a2bc2=_0x814f[_0x197425];return _0x5a2bc2;};'use strict';var Sequelize=require(_0xf814('0x0'));module[_0xf814('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xf814('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf814('0x3')]},'beep':{'type':Sequelize[_0xf814('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 160472d..0a00df3 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 _0x2f31=['voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','forEach','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','union','ids','replace','queue','Queue','push','map','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','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','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./userNotification.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','send','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x2f31,0xde));var _0x12f3=function(_0x287f9a,_0x4f3c46){_0x287f9a=_0x287f9a-0x0;var _0x153a77=_0x2f31[_0x287f9a];return _0x153a77;};'use strict';var emlformat=require(_0x12f3('0x0'));var rimraf=require(_0x12f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12f3('0x2'));var rp=require('request-promise');var moment=require(_0x12f3('0x3'));var BPromise=require(_0x12f3('0x4'));var Mustache=require(_0x12f3('0x5'));var util=require(_0x12f3('0x6'));var path=require(_0x12f3('0x7'));var sox=require('sox');var csv=require(_0x12f3('0x8'));var ejs=require(_0x12f3('0x9'));var fs=require('fs');var fs_extra=require(_0x12f3('0xa'));var _=require(_0x12f3('0xb'));var squel=require(_0x12f3('0xc'));var crypto=require(_0x12f3('0xd'));var jsforce=require(_0x12f3('0xe'));var deskjs=require(_0x12f3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x12f3('0x10'));var Redis=require(_0x12f3('0x11'));var authService=require(_0x12f3('0x12'));var qs=require(_0x12f3('0x13'));var as=require(_0x12f3('0x14'));var hardwareService=require(_0x12f3('0x15'));var logger=require(_0x12f3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x12f3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x12f3('0x18'))['db'];config['redis']=_[_0x12f3('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x12f3('0x1a'))(new Redis(config['redis']));require(_0x12f3('0x1b'))['register'](socket);function respondWithStatusCode(_0x44dd98,_0x161831){_0x161831=_0x161831||0xcc;return function(_0x17f584){if(_0x17f584){return _0x44dd98[_0x12f3('0x1c')](_0x161831);}return _0x44dd98['status'](_0x161831)[_0x12f3('0x1d')]();};}function respondWithResult(_0x420f4c,_0x2c8ef8){_0x2c8ef8=_0x2c8ef8||0xc8;return function(_0xfd1a72){if(_0xfd1a72){return _0x420f4c[_0x12f3('0x1e')](_0x2c8ef8)[_0x12f3('0x1f')](_0xfd1a72);}};}function respondWithFilteredResult(_0x4f957a,_0x46bbbb){return function(_0x79aecb){if(_0x79aecb){var _0x5a46ee=typeof _0x46bbbb[_0x12f3('0x20')]===_0x12f3('0x21')&&typeof _0x46bbbb[_0x12f3('0x22')]===_0x12f3('0x21');var _0x5dc413=_0x79aecb[_0x12f3('0x23')];var _0x2495c8=_0x5a46ee?0x0:_0x46bbbb[_0x12f3('0x20')];var _0xfcd49c=_0x5a46ee?_0x79aecb[_0x12f3('0x23')]:_0x46bbbb[_0x12f3('0x20')]+_0x46bbbb['limit'];var _0x3a1b82;if(_0xfcd49c>=_0x5dc413){_0xfcd49c=_0x5dc413;_0x3a1b82=0xc8;}else{_0x3a1b82=0xce;}_0x4f957a[_0x12f3('0x1e')](_0x3a1b82);return _0x4f957a[_0x12f3('0x24')](_0x12f3('0x25'),_0x2495c8+'-'+_0xfcd49c+'/'+_0x5dc413)['json'](_0x79aecb);}return null;};}function patchUpdates(_0x3c0a76){return function(_0x1e15af){try{jsonpatch['apply'](_0x1e15af,_0x3c0a76,!![]);}catch(_0x5dac67){return BPromise[_0x12f3('0x26')](_0x5dac67);}return _0x1e15af['save']();};}function saveUpdates(_0x515e2a,_0x590500){return function(_0x1aca76){if(_0x1aca76){return _0x1aca76[_0x12f3('0x27')](_0x515e2a)['then'](function(_0x15f999){return _0x15f999;});}return null;};}function removeEntity(_0x1ddcb2,_0xa4a2c8){return function(_0x3cde20){if(_0x3cde20){return _0x3cde20[_0x12f3('0x28')]()[_0x12f3('0x29')](function(){_0x1ddcb2[_0x12f3('0x1e')](0xcc)[_0x12f3('0x1d')]();});}};}function handleEntityNotFound(_0x287493,_0x1309c1){return function(_0x209695){if(!_0x209695){_0x287493[_0x12f3('0x1c')](0x194);}return _0x209695;};}function handleError(_0x4c1145,_0x7f9825){_0x7f9825=_0x7f9825||0x1f4;return function(_0x33dfcc){logger['error'](_0x33dfcc['stack']);if(_0x33dfcc['name']){delete _0x33dfcc['name'];}_0x4c1145[_0x12f3('0x1e')](_0x7f9825)[_0x12f3('0x2a')](_0x33dfcc);};}exports['sendUserNotification']=function(_0x1372d8,_0x55aa64,_0x8101e5){if(!_0x1372d8['body'][_0x12f3('0x2b')](_0x12f3('0x2c'))&&!_0x1372d8[_0x12f3('0x2d')]['hasOwnProperty'](_0x12f3('0x2e'))){throw new db[(_0x12f3('0x2f'))][(_0x12f3('0x30'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1372d8[_0x12f3('0x2d')][_0x12f3('0x2b')](_0x12f3('0x2e'))&&!_0x1372d8['body'][_0x12f3('0x2b')](_0x12f3('0x31'))){throw new db[(_0x12f3('0x2f'))][(_0x12f3('0x30'))](_0x12f3('0x32'));}if(!_0x1372d8[_0x12f3('0x2d')]['hasOwnProperty'](_0x12f3('0x33'))){throw new db[(_0x12f3('0x2f'))][(_0x12f3('0x30'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x59a86a=JSON[_0x12f3('0x34')](_0x1372d8[_0x12f3('0x2d')][_0x12f3('0x33')]);}catch(_0xa8401f){logger[_0x12f3('0x35')](_0xa8401f);throw new db[(_0x12f3('0x2f'))][(_0x12f3('0x30'))](_0x12f3('0x36'));}var _0x2439fd=[_0x12f3('0x37'),_0x12f3('0x38'),_0x12f3('0x39'),_0x12f3('0x3a'),_0x12f3('0x3b'),_0x12f3('0x3c'),'whatsappqueue',_0x12f3('0x3d'),_0x12f3('0x3e')];if(_[_0x12f3('0x3f')](_0x59a86a,function(_0x27bdba){return!_[_0x12f3('0x40')](_0x2439fd,_0x27bdba[_0x12f3('0x41')][_0x12f3('0x42')]());})){throw new db[(_0x12f3('0x2f'))][(_0x12f3('0x30'))](_0x12f3('0x43'));}}}var _0x247559={};_0x247559['senderName']=_0x1372d8[_0x12f3('0x2d')][_0x12f3('0x2b')](_0x12f3('0x44'))?_0x1372d8[_0x12f3('0x2d')][_0x12f3('0x44')]:_0x1372d8['user'][_0x12f3('0x45')];_0x247559['recipientsDescription']=_['isEmpty'](_0x1372d8['body'][_0x12f3('0x46')])?null:_0x1372d8[_0x12f3('0x2d')]['recipientsDescription'];_0x247559['beep']=_0x1372d8['body'][_0x12f3('0x47')]||![];_0x247559[_0x12f3('0x48')]=_0x1372d8[_0x12f3('0x3e')]['id'];return getContent(_0x1372d8[_0x12f3('0x2d')])['then'](function(_0x51c47c){_0x247559['body']=_0x51c47c;return getRecipients(_0x59a86a);})[_0x12f3('0x29')](function(_0x1df365){_0x247559[_0x12f3('0x49')]=_[_0x12f3('0x4a')](_0x1df365)[_0x12f3('0x4b')](',');return db['sequelize'][_0x12f3('0x4c')](function(_0x22f982){return db[_0x12f3('0x4d')]['create'](_0x247559,{'raw':!![],'transaction':_0x22f982})[_0x12f3('0x29')](function(_0x46162d){var _0x5587fc={'sender':_0x247559['senderName'],'description':_0x247559['recipientsDescription'],'content':_0x247559['body'],'beep':_0x247559[_0x12f3('0x47')]};_0x1df365[_0x12f3('0x4e')](function(_0x1c65dd){_0x5587fc['recipient']=_0x1c65dd;socket[_0x12f3('0x4f')](_0x12f3('0x50'),_0x5587fc);});return _0x46162d;});});})[_0x12f3('0x29')](respondWithResult(_0x55aa64,0xc9))[_0x12f3('0x51')](handleError(_0x55aa64,null));};function getContent(_0x431930){return new BPromise(function(_0xdea714,_0x11a374){if(_0x431930[_0x12f3('0x2c')]){_0xdea714(_0x431930[_0x12f3('0x2c')]);return;}return db[_0x12f3('0x52')][_0x12f3('0x53')]({'attributes':[_0x12f3('0x54')],'where':{'id':_0x431930[_0x12f3('0x2e')]},'raw':!![]})[_0x12f3('0x29')](function(_0xc4874d){if(!_0xc4874d)throw new db[(_0x12f3('0x2f'))][(_0x12f3('0x30'))](_0x12f3('0x55'));var _0x15c67f=Mustache[_0x12f3('0x56')](_0xc4874d[_0x12f3('0x54')],_0x431930['view']);_0xdea714(_0x15c67f);})[_0x12f3('0x51')](function(_0x2b0632){_0x11a374(_0x2b0632);});});}function getRecipients(_0xdf37a9){return new BPromise(function(_0x241732,_0x28d4a9){var _0x43efa4=[];var _0x191832=[];_0xdf37a9[_0x12f3('0x4e')](function(_0x17e5e6){var _0x344ade=_['startCase'](_0x17e5e6[_0x12f3('0x41')][_0x12f3('0x42')]());if(_0x344ade==='User'){_0x43efa4=_[_0x12f3('0x57')](_0x43efa4,_0x17e5e6[_0x12f3('0x58')]);}else{if(_[_0x12f3('0x40')](_0x344ade,'queue'))_0x344ade=_0x344ade[_0x12f3('0x59')](_0x12f3('0x5a'),_0x12f3('0x5b'));_0x17e5e6['ids'][_0x12f3('0x4e')](function(_0x24a402){_0x191832[_0x12f3('0x5c')](getAgents(_0x344ade,_0x24a402));});}});return BPromise['all'](_0x191832)['then'](function(_0x355656){_0x43efa4=_[_0x12f3('0x57')](_0x43efa4,_['flatten'](_0x355656));_0x241732(_0x43efa4);})[_0x12f3('0x51')](function(_0x393051){_0x28d4a9(_0x393051);});});}function getAgents(_0x40f42c,_0x1322f8){return new BPromise(function(_0x2e101b,_0x52a1e1){return db[_0x40f42c][_0x12f3('0x53')]({'where':{'id':_0x1322f8}})[_0x12f3('0x29')](function(_0x5ba887){return _0x5ba887['getAgents']({'attributes':['id'],'raw':!![]})[_0x12f3('0x29')](function(_0x34694d){var _0x531761=_[_0x12f3('0x5d')](_0x34694d,'id');_0x2e101b(_0x531761);});})[_0x12f3('0x51')](function(_0x40e52f){_0x52a1e1(_0x40e52f);});});} \ No newline at end of file +var _0x21bc=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','transaction','create','forEach','recipient','userNotification:send','catch','Template','findOne','html','render','model','toLowerCase','User','union','ids','includes','queue','replace','Queue','push','flatten','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x21bc,0x110));var _0xc21b=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x21bc[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc21b('0x0'));var zipdir=require(_0xc21b('0x1'));var jsonpatch=require(_0xc21b('0x2'));var rp=require(_0xc21b('0x3'));var moment=require(_0xc21b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc21b('0x5'));var util=require(_0xc21b('0x6'));var path=require(_0xc21b('0x7'));var sox=require(_0xc21b('0x8'));var csv=require(_0xc21b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc21b('0xa'));var _=require(_0xc21b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc21b('0xc'));var deskjs=require(_0xc21b('0xd'));var toCsv=require(_0xc21b('0x9'));var querystring=require(_0xc21b('0xe'));var Papa=require(_0xc21b('0xf'));var Redis=require(_0xc21b('0x10'));var authService=require(_0xc21b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc21b('0x12'));var hardwareService=require(_0xc21b('0x13'));var logger=require(_0xc21b('0x14'))('api');var utils=require(_0xc21b('0x15'));var config=require(_0xc21b('0x16'));var licenseUtil=require(_0xc21b('0x17'));var db=require(_0xc21b('0x18'))['db'];config[_0xc21b('0x19')]=_[_0xc21b('0x1a')](config[_0xc21b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xc21b('0x1b'))(new Redis(config[_0xc21b('0x19')]));require(_0xc21b('0x1c'))['register'](socket);function respondWithStatusCode(_0x56acce,_0x30d373){_0x30d373=_0x30d373||0xcc;return function(_0x115ef7){if(_0x115ef7){return _0x56acce['sendStatus'](_0x30d373);}return _0x56acce[_0xc21b('0x1d')](_0x30d373)[_0xc21b('0x1e')]();};}function respondWithResult(_0x5487ba,_0x143c67){_0x143c67=_0x143c67||0xc8;return function(_0x5df1cc){if(_0x5df1cc){return _0x5487ba[_0xc21b('0x1d')](_0x143c67)[_0xc21b('0x1f')](_0x5df1cc);}};}function respondWithFilteredResult(_0x278d6f,_0x588caa){return function(_0x491e48){if(_0x491e48){var _0x455d52=typeof _0x588caa[_0xc21b('0x20')]===_0xc21b('0x21')&&typeof _0x588caa[_0xc21b('0x22')]==='undefined';var _0x351d04=_0x491e48[_0xc21b('0x23')];var _0x3e5654=_0x455d52?0x0:_0x588caa[_0xc21b('0x20')];var _0x17bae4=_0x455d52?_0x491e48[_0xc21b('0x23')]:_0x588caa[_0xc21b('0x20')]+_0x588caa[_0xc21b('0x22')];var _0x3c7055;if(_0x17bae4>=_0x351d04){_0x17bae4=_0x351d04;_0x3c7055=0xc8;}else{_0x3c7055=0xce;}_0x278d6f[_0xc21b('0x1d')](_0x3c7055);return _0x278d6f[_0xc21b('0x24')](_0xc21b('0x25'),_0x3e5654+'-'+_0x17bae4+'/'+_0x351d04)[_0xc21b('0x1f')](_0x491e48);}return null;};}function patchUpdates(_0x2f7c84){return function(_0x55b8eb){try{jsonpatch[_0xc21b('0x26')](_0x55b8eb,_0x2f7c84,!![]);}catch(_0x49c7af){return BPromise[_0xc21b('0x27')](_0x49c7af);}return _0x55b8eb['save']();};}function saveUpdates(_0x12e564,_0x5b10f7){return function(_0x1291e1){if(_0x1291e1){return _0x1291e1[_0xc21b('0x28')](_0x12e564)[_0xc21b('0x29')](function(_0x3475a0){return _0x3475a0;});}return null;};}function removeEntity(_0x4c1182,_0x2f9e0d){return function(_0x2b25b9){if(_0x2b25b9){return _0x2b25b9[_0xc21b('0x2a')]()['then'](function(){_0x4c1182[_0xc21b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb071,_0x2e09ec){return function(_0x54c5c0){if(!_0x54c5c0){_0x5eb071[_0xc21b('0x2b')](0x194);}return _0x54c5c0;};}function handleError(_0x138a1f,_0x3e8505){_0x3e8505=_0x3e8505||0x1f4;return function(_0x29e54a){logger[_0xc21b('0x2c')](_0x29e54a['stack']);if(_0x29e54a['name']){delete _0x29e54a[_0xc21b('0x2d')];}_0x138a1f[_0xc21b('0x1d')](_0x3e8505)[_0xc21b('0x2e')](_0x29e54a);};}exports[_0xc21b('0x2f')]=function(_0x38dba0,_0x1a4873,_0x433b28){if(!_0x38dba0[_0xc21b('0x30')][_0xc21b('0x31')](_0xc21b('0x32'))&&!_0x38dba0[_0xc21b('0x30')][_0xc21b('0x31')](_0xc21b('0x33'))){throw new db['Sequelize'][(_0xc21b('0x34'))](_0xc21b('0x35'));}else{if(_0x38dba0[_0xc21b('0x30')][_0xc21b('0x31')]('TemplateId')&&!_0x38dba0[_0xc21b('0x30')][_0xc21b('0x31')](_0xc21b('0x36'))){throw new db['Sequelize'][(_0xc21b('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x38dba0['body'][_0xc21b('0x31')](_0xc21b('0x37'))){throw new db[(_0xc21b('0x38'))][(_0xc21b('0x34'))](_0xc21b('0x39'));}else{try{var _0x533d70=JSON['parse'](_0x38dba0['body']['recipients']);}catch(_0x4ad65c){logger['error'](_0x4ad65c);throw new db[(_0xc21b('0x38'))][(_0xc21b('0x34'))](_0xc21b('0x3a'));}var _0x21ddb0=['chatqueue','faxqueue',_0xc21b('0x3b'),'openchannelqueue',_0xc21b('0x3c'),_0xc21b('0x3d'),_0xc21b('0x3e'),_0xc21b('0x3f'),_0xc21b('0x40')];if(_[_0xc21b('0x41')](_0x533d70,function(_0x235843){return!_['includes'](_0x21ddb0,_0x235843['model']['toLowerCase']());})){throw new db[(_0xc21b('0x38'))]['ValidationError'](_0xc21b('0x42'));}}}var _0x3d2b57={};_0x3d2b57[_0xc21b('0x43')]=_0x38dba0[_0xc21b('0x30')]['hasOwnProperty'](_0xc21b('0x43'))?_0x38dba0[_0xc21b('0x30')][_0xc21b('0x43')]:_0x38dba0['user'][_0xc21b('0x44')];_0x3d2b57[_0xc21b('0x45')]=_[_0xc21b('0x46')](_0x38dba0[_0xc21b('0x30')][_0xc21b('0x45')])?null:_0x38dba0[_0xc21b('0x30')]['recipientsDescription'];_0x3d2b57[_0xc21b('0x47')]=_0x38dba0[_0xc21b('0x30')][_0xc21b('0x47')]||![];_0x3d2b57['SenderId']=_0x38dba0[_0xc21b('0x40')]['id'];return getContent(_0x38dba0['body'])[_0xc21b('0x29')](function(_0x32d004){_0x3d2b57['body']=_0x32d004;return getRecipients(_0x533d70);})[_0xc21b('0x29')](function(_0x502223){_0x3d2b57[_0xc21b('0x48')]=_[_0xc21b('0x49')](_0x502223)['join'](',');return db['sequelize'][_0xc21b('0x4a')](function(_0x30e13d){return db['UserNotification'][_0xc21b('0x4b')](_0x3d2b57,{'raw':!![],'transaction':_0x30e13d})[_0xc21b('0x29')](function(_0x294904){var _0x43b2f1={'sender':_0x3d2b57[_0xc21b('0x43')],'description':_0x3d2b57[_0xc21b('0x45')],'content':_0x3d2b57['body'],'beep':_0x3d2b57[_0xc21b('0x47')]};_0x502223[_0xc21b('0x4c')](function(_0x33404e){_0x43b2f1[_0xc21b('0x4d')]=_0x33404e;socket['emit'](_0xc21b('0x4e'),_0x43b2f1);});return _0x294904;});});})[_0xc21b('0x29')](respondWithResult(_0x1a4873,0xc9))[_0xc21b('0x4f')](handleError(_0x1a4873,null));};function getContent(_0x1a253f){return new BPromise(function(_0x17555a,_0x4d70f6){if(_0x1a253f[_0xc21b('0x32')]){_0x17555a(_0x1a253f[_0xc21b('0x32')]);return;}return db[_0xc21b('0x50')][_0xc21b('0x51')]({'attributes':[_0xc21b('0x52')],'where':{'id':_0x1a253f['TemplateId']},'raw':!![]})[_0xc21b('0x29')](function(_0x496b9b){if(!_0x496b9b)throw new db['Sequelize'][(_0xc21b('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xe7bd89=Mustache[_0xc21b('0x53')](_0x496b9b[_0xc21b('0x52')],_0x1a253f[_0xc21b('0x36')]);_0x17555a(_0xe7bd89);})[_0xc21b('0x4f')](function(_0x378606){_0x4d70f6(_0x378606);});});}function getRecipients(_0x5a2e22){return new BPromise(function(_0x4654d8,_0x4d1281){var _0x583bcc=[];var _0x541250=[];_0x5a2e22[_0xc21b('0x4c')](function(_0x132585){var _0x21e951=_['startCase'](_0x132585[_0xc21b('0x54')][_0xc21b('0x55')]());if(_0x21e951===_0xc21b('0x56')){_0x583bcc=_[_0xc21b('0x57')](_0x583bcc,_0x132585[_0xc21b('0x58')]);}else{if(_[_0xc21b('0x59')](_0x21e951,_0xc21b('0x5a')))_0x21e951=_0x21e951[_0xc21b('0x5b')](_0xc21b('0x5a'),_0xc21b('0x5c'));_0x132585['ids']['forEach'](function(_0x21bd98){_0x541250[_0xc21b('0x5d')](getAgents(_0x21e951,_0x21bd98));});}});return BPromise['all'](_0x541250)[_0xc21b('0x29')](function(_0x5c0612){_0x583bcc=_[_0xc21b('0x57')](_0x583bcc,_[_0xc21b('0x5e')](_0x5c0612));_0x4654d8(_0x583bcc);})[_0xc21b('0x4f')](function(_0x3b258b){_0x4d1281(_0x3b258b);});});}function getAgents(_0x34b379,_0x41a3bc){return new BPromise(function(_0x3853a7,_0x122c4a){return db[_0x34b379][_0xc21b('0x51')]({'where':{'id':_0x41a3bc}})['then'](function(_0x4f90de){return _0x4f90de['getAgents']({'attributes':['id'],'raw':!![]})[_0xc21b('0x29')](function(_0x5c465e){var _0x151baf=_[_0xc21b('0x5f')](_0x5c465e,'id');_0x3853a7(_0x151baf);});})[_0xc21b('0x4f')](function(_0x38b584){_0x122c4a(_0x38b584);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 19828e6..5f88b63 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 _0xee95=['emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove'];(function(_0x1ac053,_0x39267a){var _0x2d209a=function(_0x5106d2){while(--_0x5106d2){_0x1ac053['push'](_0x1ac053['shift']());}};_0x2d209a(++_0x39267a);}(_0xee95,0x85));var _0x5ee9=function(_0x339ed8,_0x5c0f01){_0x339ed8=_0x339ed8-0x0;var _0x4282f8=_0xee95[_0x339ed8];return _0x4282f8;};'use strict';var EventEmitter=require(_0x5ee9('0x0'));var UserNotification=require(_0x5ee9('0x1'))['db'][_0x5ee9('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5ee9('0x3')](0x0);var events={'afterCreate':_0x5ee9('0x4'),'afterUpdate':_0x5ee9('0x5'),'afterDestroy':_0x5ee9('0x6')};function emitEvent(_0x5c60ae){return function(_0x34b536,_0x573bd2,_0x2af0fb){UserNotificationEvents[_0x5ee9('0x7')](_0x5c60ae+':'+_0x34b536['id'],_0x34b536);UserNotificationEvents['emit'](_0x5c60ae,_0x34b536);_0x2af0fb(null);};}for(var e in events){if(events[_0x5ee9('0x8')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x5ee9('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x6aa6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x30527d,_0x1a8f0a){var _0x276c50=function(_0x1f786a){while(--_0x1f786a){_0x30527d['push'](_0x30527d['shift']());}};_0x276c50(++_0x1a8f0a);}(_0x6aa6,0xdc));var _0x66aa=function(_0x3f4729,_0x392c33){_0x3f4729=_0x3f4729-0x0;var _0x4ffbbf=_0x6aa6[_0x3f4729];return _0x4ffbbf;};'use strict';var EventEmitter=require(_0x66aa('0x0'));var UserNotification=require(_0x66aa('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x66aa('0x2')](0x0);var events={'afterCreate':_0x66aa('0x3'),'afterUpdate':'update','afterDestroy':_0x66aa('0x4')};function emitEvent(_0x5b3429){return function(_0xd72208,_0x5c6a0a,_0xf0df15){UserNotificationEvents[_0x66aa('0x5')](_0x5b3429+':'+_0xd72208['id'],_0xd72208);UserNotificationEvents[_0x66aa('0x5')](_0x5b3429,_0xd72208);_0xf0df15(null);};}for(var e in events){if(events[_0x66aa('0x6')](e)){var event=events[e];UserNotification[_0x66aa('0x7')](e,emitEvent(event));}}module[_0x66aa('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 13a8b64..90ca587 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 _0xe601=['./userNotification.attributes','exports','define','UserNotification','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4cc1d0,_0x4b3c7d){var _0x1eafd6=function(_0xe23e4e){while(--_0xe23e4e){_0x4cc1d0['push'](_0x4cc1d0['shift']());}};_0x1eafd6(++_0x4b3c7d);}(_0xe601,0x139));var _0x1e60=function(_0x3584da,_0x41b9d6){_0x3584da=_0x3584da-0x0;var _0x29ed2e=_0xe601[_0x3584da];return _0x29ed2e;};'use strict';var _=require(_0x1e60('0x0'));var util=require(_0x1e60('0x1'));var logger=require(_0x1e60('0x2'))('api');var moment=require(_0x1e60('0x3'));var BPromise=require(_0x1e60('0x4'));var rp=require(_0x1e60('0x5'));var fs=require('fs');var path=require(_0x1e60('0x6'));var rimraf=require(_0x1e60('0x7'));var config=require(_0x1e60('0x8'));var attributes=require(_0x1e60('0x9'));module[_0x1e60('0xa')]=function(_0x31ed3f,_0x5515df){return _0x31ed3f[_0x1e60('0xb')](_0x1e60('0xc'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1e60('0xd')});}; \ No newline at end of file +var _0xb717=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb717,0x12a));var _0x7b71=function(_0x5c1e8e,_0x465630){_0x5c1e8e=_0x5c1e8e-0x0;var _0x4fe669=_0xb717[_0x5c1e8e];return _0x4fe669;};'use strict';var _=require(_0x7b71('0x0'));var util=require(_0x7b71('0x1'));var logger=require(_0x7b71('0x2'))(_0x7b71('0x3'));var moment=require('moment');var BPromise=require(_0x7b71('0x4'));var rp=require(_0x7b71('0x5'));var fs=require('fs');var path=require(_0x7b71('0x6'));var rimraf=require('rimraf');var config=require(_0x7b71('0x7'));var attributes=require('./userNotification.attributes');module[_0x7b71('0x8')]=function(_0x6ac26d,_0x50776f){return _0x6ac26d[_0x7b71('0x9')](_0x7b71('0xa'),attributes,{'tableName':_0x7b71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b71('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 05873c9..cf403f8 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 _0x9f83=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9f83,0xc5));var _0x39f8=function(_0x1f4afb,_0x4309a3){_0x1f4afb=_0x1f4afb-0x0;var _0x24ca1c=_0x9f83[_0x1f4afb];return _0x24ca1c;};'use strict';var _=require(_0x39f8('0x0'));var util=require(_0x39f8('0x1'));var moment=require(_0x39f8('0x2'));var BPromise=require(_0x39f8('0x3'));var rs=require(_0x39f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x39f8('0x5'))(_0x39f8('0x6'));var config=require(_0x39f8('0x7'));var jayson=require(_0x39f8('0x8'));var client=jayson['client'][_0x39f8('0x9')]({'port':0x232a});config[_0x39f8('0xa')]=_[_0x39f8('0xb')](config[_0x39f8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x39f8('0xc'))(new Redis(config[_0x39f8('0xa')]));require(_0x39f8('0xd'))[_0x39f8('0xe')](socket);function respondWithRpcPromise(_0x484f77,_0x177a45,_0x56ebe0){return new BPromise(function(_0x32f0ab,_0x490c34){return client[_0x39f8('0xf')](_0x484f77,_0x56ebe0)['then'](function(_0x1efb0c){logger[_0x39f8('0x10')](_0x39f8('0x11'),_0x177a45,_0x39f8('0x12'));logger['debug'](_0x39f8('0x13'),_0x177a45,_0x39f8('0x12'),JSON[_0x39f8('0x14')](_0x1efb0c));if(_0x1efb0c[_0x39f8('0x15')]){if(_0x1efb0c[_0x39f8('0x15')]['code']===0x1f4){logger[_0x39f8('0x15')](_0x39f8('0x11'),_0x177a45,_0x1efb0c[_0x39f8('0x15')]['message']);return _0x490c34(_0x1efb0c[_0x39f8('0x15')]['message']);}logger[_0x39f8('0x15')](_0x39f8('0x11'),_0x177a45,_0x1efb0c[_0x39f8('0x15')][_0x39f8('0x16')]);return _0x32f0ab(_0x1efb0c[_0x39f8('0x15')][_0x39f8('0x16')]);}else{logger[_0x39f8('0x10')]('UserNotification,\x20%s,\x20%s',_0x177a45,_0x39f8('0x12'));_0x32f0ab(_0x1efb0c[_0x39f8('0x17')]['message']);}})['catch'](function(_0x34126b){logger[_0x39f8('0x15')](_0x39f8('0x11'),_0x177a45,_0x34126b);_0x490c34(_0x34126b);});});} \ No newline at end of file +var _0xf922=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x31c133,_0x3075f7){var _0x596121=function(_0xcb270e){while(--_0xcb270e){_0x31c133['push'](_0x31c133['shift']());}};_0x596121(++_0x3075f7);}(_0xf922,0x1cc));var _0x2f92=function(_0x13fe79,_0x2669f3){_0x13fe79=_0x13fe79-0x0;var _0x28ef67=_0xf922[_0x13fe79];return _0x28ef67;};'use strict';var _=require(_0x2f92('0x0'));var util=require('util');var moment=require(_0x2f92('0x1'));var BPromise=require('bluebird');var rs=require(_0x2f92('0x2'));var fs=require('fs');var Redis=require(_0x2f92('0x3'));var db=require(_0x2f92('0x4'))['db'];var utils=require(_0x2f92('0x5'));var logger=require(_0x2f92('0x6'))(_0x2f92('0x7'));var config=require(_0x2f92('0x8'));var jayson=require(_0x2f92('0x9'));var client=jayson[_0x2f92('0xa')]['http']({'port':0x232a});config[_0x2f92('0xb')]=_[_0x2f92('0xc')](config[_0x2f92('0xb')],{'host':_0x2f92('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f92('0xb')]));require(_0x2f92('0xe'))[_0x2f92('0xf')](socket);function respondWithRpcPromise(_0x325c9f,_0xc2c1e4,_0x56a10d){return new BPromise(function(_0x10ed3a,_0x3e9759){return client[_0x2f92('0x10')](_0x325c9f,_0x56a10d)[_0x2f92('0x11')](function(_0x46f6fe){logger[_0x2f92('0x12')]('UserNotification,\x20%s,\x20%s',_0xc2c1e4,_0x2f92('0x13'));logger[_0x2f92('0x14')](_0x2f92('0x15'),_0xc2c1e4,'request\x20sent',JSON[_0x2f92('0x16')](_0x46f6fe));if(_0x46f6fe[_0x2f92('0x17')]){if(_0x46f6fe[_0x2f92('0x17')][_0x2f92('0x18')]===0x1f4){logger[_0x2f92('0x17')](_0x2f92('0x19'),_0xc2c1e4,_0x46f6fe[_0x2f92('0x17')][_0x2f92('0x1a')]);return _0x3e9759(_0x46f6fe[_0x2f92('0x17')][_0x2f92('0x1a')]);}logger[_0x2f92('0x17')]('UserNotification,\x20%s,\x20%s',_0xc2c1e4,_0x46f6fe['error'][_0x2f92('0x1a')]);return _0x10ed3a(_0x46f6fe[_0x2f92('0x17')]['message']);}else{logger[_0x2f92('0x12')]('UserNotification,\x20%s,\x20%s',_0xc2c1e4,'request\x20sent');_0x10ed3a(_0x46f6fe[_0x2f92('0x1b')][_0x2f92('0x1a')]);}})[_0x2f92('0x1c')](function(_0x536d40){logger[_0x2f92('0x17')](_0x2f92('0x19'),_0xc2c1e4,_0x536d40);_0x3e9759(_0x536d40);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5bb6f75..45a1b91 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 _0xf2aa=['removeListener','register','length','./userNotification.events','remove','emit'];(function(_0x2f324a,_0x14194d){var _0x28c150=function(_0x55ebeb){while(--_0x55ebeb){_0x2f324a['push'](_0x2f324a['shift']());}};_0x28c150(++_0x14194d);}(_0xf2aa,0x129));var _0xaf2a=function(_0x11f238,_0x418d9f){_0x11f238=_0x11f238-0x0;var _0x201974=_0xf2aa[_0x11f238];return _0x201974;};'use strict';var UserNotificationEvents=require(_0xaf2a('0x0'));var events=['save',_0xaf2a('0x1'),'update'];function createListener(_0x1a44b6,_0x7c5f75){return function(_0x2b40e5){_0x7c5f75[_0xaf2a('0x2')](_0x1a44b6,_0x2b40e5);};}function removeListener(_0x4dcbae,_0xbdba54){return function(){UserNotificationEvents[_0xaf2a('0x3')](_0x4dcbae,_0xbdba54);};}exports[_0xaf2a('0x4')]=function(_0x129eca){for(var _0xc8bf4d=0x0,_0x46eb54=events[_0xaf2a('0x5')];_0xc8bf4d<_0x46eb54;_0xc8bf4d++){var _0x246359=events[_0xc8bf4d];var _0x2dc814=createListener('userNotification:'+_0x246359,_0x129eca);UserNotificationEvents['on'](_0x246359,_0x2dc814);}}; \ No newline at end of file +var _0x62b2=['emit','removeListener','userNotification:','./userNotification.events','remove'];(function(_0x1576e6,_0x4fbe0f){var _0x2c1b1e=function(_0x2b05ba){while(--_0x2b05ba){_0x1576e6['push'](_0x1576e6['shift']());}};_0x2c1b1e(++_0x4fbe0f);}(_0x62b2,0xcb));var _0x262b=function(_0x1aeed9,_0x55c3d0){_0x1aeed9=_0x1aeed9-0x0;var _0x2da5eb=_0x62b2[_0x1aeed9];return _0x2da5eb;};'use strict';var UserNotificationEvents=require(_0x262b('0x0'));var events=['save',_0x262b('0x1'),'update'];function createListener(_0x1ab3aa,_0x58a915){return function(_0x38b162){_0x58a915[_0x262b('0x2')](_0x1ab3aa,_0x38b162);};}function removeListener(_0x52928b,_0x36f1fb){return function(){UserNotificationEvents[_0x262b('0x3')](_0x52928b,_0x36f1fb);};}exports['register']=function(_0x4bc2cd){for(var _0x19336d=0x0,_0x401f42=events['length'];_0x19336d<_0x401f42;_0x19336d++){var _0x581310=events[_0x19336d];var _0x2ed921=createListener(_0x262b('0x4')+_0x581310,_0x4bc2cd);UserNotificationEvents['on'](_0x581310,_0x2ed921);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index edecf25..05256fd 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(_0x2caad7,_0x561a1d){var _0x3ee358=function(_0x228108){while(--_0x228108){_0x2caad7['push'](_0x2caad7['shift']());}};_0x3ee358(++_0x561a1d);}(_0x70e0,0x17b));var _0x070e=function(_0x1f0a4f,_0x30d4ce){_0x1f0a4f=_0x1f0a4f-0x0;var _0x103df1=_0x70e0[_0x1f0a4f];return _0x103df1;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xd869a,_0x2b7172){var _0xa3f46b=function(_0x1866d0){while(--_0x1866d0){_0xd869a['push'](_0xd869a['shift']());}};_0xa3f46b(++_0x2b7172);}(_0xe706,0xa3));var _0x6e70=function(_0x21cf80,_0x1fb0a1){_0x21cf80=_0x21cf80-0x0;var _0x5c6bed=_0xe706[_0x21cf80];return _0x5c6bed;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 40acfdc..b782e27 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 _0x1f89=['exports','INTEGER','sequelize'];(function(_0x5bd669,_0x553211){var _0x5afe19=function(_0x594bb9){while(--_0x594bb9){_0x5bd669['push'](_0x5bd669['shift']());}};_0x5afe19(++_0x553211);}(_0x1f89,0x14c));var _0x91f8=function(_0x4f3955,_0x1c517f){_0x4f3955=_0x4f3955-0x0;var _0x42f963=_0x1f89[_0x4f3955];return _0x42f963;};'use strict';var Sequelize=require(_0x91f8('0x0'));module[_0x91f8('0x1')]={'penalty':{'type':Sequelize[_0x91f8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf97d=['INTEGER','sequelize','exports'];(function(_0xfab345,_0x43fc6e){var _0x1a60fd=function(_0x10d788){while(--_0x10d788){_0xfab345['push'](_0xfab345['shift']());}};_0x1a60fd(++_0x43fc6e);}(_0xf97d,0x199));var _0xdf97=function(_0x160148,_0x5c0639){_0x160148=_0x160148-0x0;var _0x5d4a2c=_0xf97d[_0x160148];return _0x5d4a2c;};'use strict';var Sequelize=require(_0xdf97('0x0'));module[_0xdf97('0x1')]={'penalty':{'type':Sequelize[_0xdf97('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 97126ac..6adbf38 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 _0x5e1f=['bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x4f7b1b,_0x4be8ee){var _0x23c370=function(_0x596af6){while(--_0x596af6){_0x4f7b1b['push'](_0x4f7b1b['shift']());}};_0x23c370(++_0x4be8ee);}(_0x5e1f,0x1b5));var _0xf5e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e1f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5e1('0x0'));var util=require(_0xf5e1('0x1'));var logger=require(_0xf5e1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf5e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf5e1('0x4'));var config=require(_0xf5e1('0x5'));var attributes=require(_0xf5e1('0x6'));module['exports']=function(_0x568474,_0xf762f4){return _0x568474[_0xf5e1('0x7')](_0xf5e1('0x8'),attributes,{'tableName':_0xf5e1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8856=['user_has_openchannel_queues','api','moment','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x468ed9,_0x21de15){var _0x529c7c=function(_0x53c2d9){while(--_0x53c2d9){_0x468ed9['push'](_0x468ed9['shift']());}};_0x529c7c(++_0x21de15);}(_0x8856,0x1b9));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6885('0x0'));var moment=require(_0x6885('0x1'));var BPromise=require('bluebird');var rp=require(_0x6885('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6885('0x3'));var config=require(_0x6885('0x4'));var attributes=require(_0x6885('0x5'));module[_0x6885('0x6')]=function(_0xf83535,_0x4b99a5){return _0xf83535[_0x6885('0x7')](_0x6885('0x8'),attributes,{'tableName':_0x6885('0x9'),'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 b7a49ac..f690fd8 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 _0xfedc=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xfedc,0x6d));var _0xcfed=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0xfedc[_0x2d8f6c];return _0x3a00f6;};'use strict';var _=require(_0xcfed('0x0'));var util=require(_0xcfed('0x1'));var moment=require(_0xcfed('0x2'));var BPromise=require(_0xcfed('0x3'));var rs=require(_0xcfed('0x4'));var fs=require('fs');var Redis=require(_0xcfed('0x5'));var db=require(_0xcfed('0x6'))['db'];var utils=require(_0xcfed('0x7'));var logger=require(_0xcfed('0x8'))(_0xcfed('0x9'));var config=require('../../config/environment');var jayson=require(_0xcfed('0xa'));var client=jayson['client'][_0xcfed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x80e558,_0x7b21ef,_0x39660b){return new BPromise(function(_0x3b1af1,_0x17f64a){return client[_0xcfed('0xc')](_0x80e558,_0x39660b)[_0xcfed('0xd')](function(_0x19faa8){logger[_0xcfed('0xe')](_0xcfed('0xf'),_0x7b21ef,'request\x20sent');logger[_0xcfed('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x7b21ef,_0xcfed('0x11'),JSON[_0xcfed('0x12')](_0x19faa8));if(_0x19faa8[_0xcfed('0x13')]){if(_0x19faa8[_0xcfed('0x13')][_0xcfed('0x14')]===0x1f4){logger[_0xcfed('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x7b21ef,_0x19faa8['error'][_0xcfed('0x15')]);return _0x17f64a(_0x19faa8['error']['message']);}logger[_0xcfed('0x13')](_0xcfed('0xf'),_0x7b21ef,_0x19faa8['error'][_0xcfed('0x15')]);return _0x3b1af1(_0x19faa8[_0xcfed('0x13')][_0xcfed('0x15')]);}else{logger[_0xcfed('0xe')](_0xcfed('0xf'),_0x7b21ef,_0xcfed('0x11'));_0x3b1af1(_0x19faa8[_0xcfed('0x16')][_0xcfed('0x15')]);}})['catch'](function(_0x57d53e){logger[_0xcfed('0x13')](_0xcfed('0xf'),_0x7b21ef,_0x57d53e);_0x17f64a(_0x57d53e);});});} \ No newline at end of file +var _0x360d=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x360d,0xe2));var _0xd360=function(_0x175290,_0x42e572){_0x175290=_0x175290-0x0;var _0x52bd78=_0x360d[_0x175290];return _0x52bd78;};'use strict';var _=require(_0xd360('0x0'));var util=require('util');var moment=require(_0xd360('0x1'));var BPromise=require(_0xd360('0x2'));var rs=require(_0xd360('0x3'));var fs=require('fs');var Redis=require(_0xd360('0x4'));var db=require(_0xd360('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd360('0x6'))(_0xd360('0x7'));var config=require(_0xd360('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd360('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18e3fd,_0x2639b8,_0x5f276e){return new BPromise(function(_0x2942ef,_0x29d2b0){return client[_0xd360('0xa')](_0x18e3fd,_0x5f276e)[_0xd360('0xb')](function(_0x4632b1){logger[_0xd360('0xc')](_0xd360('0xd'),_0x2639b8,_0xd360('0xe'));logger[_0xd360('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2639b8,'request\x20sent',JSON[_0xd360('0x10')](_0x4632b1));if(_0x4632b1['error']){if(_0x4632b1[_0xd360('0x11')][_0xd360('0x12')]===0x1f4){logger[_0xd360('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2639b8,_0x4632b1['error'][_0xd360('0x13')]);return _0x29d2b0(_0x4632b1[_0xd360('0x11')][_0xd360('0x13')]);}logger['error'](_0xd360('0xd'),_0x2639b8,_0x4632b1[_0xd360('0x11')][_0xd360('0x13')]);return _0x2942ef(_0x4632b1[_0xd360('0x11')][_0xd360('0x13')]);}else{logger[_0xd360('0xc')](_0xd360('0xd'),_0x2639b8,_0xd360('0xe'));_0x2942ef(_0x4632b1[_0xd360('0x14')][_0xd360('0x13')]);}})[_0xd360('0x15')](function(_0x4aac38){logger[_0xd360('0x11')](_0xd360('0xd'),_0x2639b8,_0x4aac38);_0x29d2b0(_0x4aac38);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index c98d592..60616b9 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 _0xfc9d=['/:id/resources','put','/:id','delete','destroy','removeSections','exports','multer','util','express','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','show','getSections','getResources','post','create','/:id/clone','/:id/sections','addSections'];(function(_0x1b48f6,_0x3ced4f){var _0x3c6b2a=function(_0x33d9de){while(--_0x33d9de){_0x1b48f6['push'](_0x1b48f6['shift']());}};_0x3c6b2a(++_0x3ced4f);}(_0xfc9d,0xdf));var _0xdfc9=function(_0x550637,_0x2f172a){_0x550637=_0x550637-0x0;var _0x24fea3=_0xfc9d[_0x550637];return _0x24fea3;};'use strict';var multer=require(_0xdfc9('0x0'));var util=require(_0xdfc9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfc9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdfc9('0x3'));var config=require(_0xdfc9('0x4'));var controller=require(_0xdfc9('0x5'));router[_0xdfc9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdfc9('0x6')]('/describe',auth[_0xdfc9('0x7')](),controller[_0xdfc9('0x8')]);router[_0xdfc9('0x6')]('/:id',auth[_0xdfc9('0x7')](),controller[_0xdfc9('0x9')]);router[_0xdfc9('0x6')]('/:id/sections',auth[_0xdfc9('0x7')](),controller[_0xdfc9('0xa')]);router[_0xdfc9('0x6')]('/:id/resources',auth[_0xdfc9('0x7')](),controller[_0xdfc9('0xb')]);router[_0xdfc9('0xc')]('/',auth[_0xdfc9('0x7')](),controller[_0xdfc9('0xd')]);router[_0xdfc9('0xc')](_0xdfc9('0xe'),auth['isAuthenticated'](),controller['clone']);router[_0xdfc9('0xc')](_0xdfc9('0xf'),auth[_0xdfc9('0x7')](),controller[_0xdfc9('0x10')]);router[_0xdfc9('0xc')](_0xdfc9('0x11'),auth['isAuthenticated'](),controller['addResources']);router[_0xdfc9('0x12')](_0xdfc9('0x13'),auth[_0xdfc9('0x7')](),controller['update']);router[_0xdfc9('0x14')](_0xdfc9('0x13'),auth[_0xdfc9('0x7')](),controller[_0xdfc9('0x15')]);router[_0xdfc9('0x14')](_0xdfc9('0xf'),auth['isAuthenticated'](),controller[_0xdfc9('0x16')]);router[_0xdfc9('0x14')](_0xdfc9('0x11'),auth[_0xdfc9('0x7')](),controller['removeResources']);module[_0xdfc9('0x17')]=router; \ No newline at end of file +var _0x7dca=['/:id/clone','clone','/:id/sections','addSections','addResources','put','/:id','update','destroy','delete','removeSections','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','getSections','/:id/resources','getResources','post','create'];(function(_0x4328a1,_0x33006a){var _0x8d1590=function(_0x5a1ba4){while(--_0x5a1ba4){_0x4328a1['push'](_0x4328a1['shift']());}};_0x8d1590(++_0x33006a);}(_0x7dca,0x191));var _0xa7dc=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x7dca[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0xa7dc('0x0'));var util=require(_0xa7dc('0x1'));var path=require('path');var timeout=require(_0xa7dc('0x2'));var express=require(_0xa7dc('0x3'));var router=express[_0xa7dc('0x4')]();var fs_extra=require(_0xa7dc('0x5'));var auth=require(_0xa7dc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa7dc('0x7'));router[_0xa7dc('0x8')]('/',auth[_0xa7dc('0x9')](),controller[_0xa7dc('0xa')]);router['get'](_0xa7dc('0xb'),auth['isAuthenticated'](),controller[_0xa7dc('0xc')]);router[_0xa7dc('0x8')]('/:id',auth[_0xa7dc('0x9')](),controller[_0xa7dc('0xd')]);router['get']('/:id/sections',auth[_0xa7dc('0x9')](),controller[_0xa7dc('0xe')]);router[_0xa7dc('0x8')](_0xa7dc('0xf'),auth[_0xa7dc('0x9')](),controller[_0xa7dc('0x10')]);router[_0xa7dc('0x11')]('/',auth[_0xa7dc('0x9')](),controller[_0xa7dc('0x12')]);router['post'](_0xa7dc('0x13'),auth[_0xa7dc('0x9')](),controller[_0xa7dc('0x14')]);router[_0xa7dc('0x11')](_0xa7dc('0x15'),auth[_0xa7dc('0x9')](),controller[_0xa7dc('0x16')]);router[_0xa7dc('0x11')](_0xa7dc('0xf'),auth[_0xa7dc('0x9')](),controller[_0xa7dc('0x17')]);router[_0xa7dc('0x18')](_0xa7dc('0x19'),auth['isAuthenticated'](),controller[_0xa7dc('0x1a')]);router['delete'](_0xa7dc('0x19'),auth['isAuthenticated'](),controller[_0xa7dc('0x1b')]);router[_0xa7dc('0x1c')]('/:id/sections',auth[_0xa7dc('0x9')](),controller[_0xa7dc('0x1d')]);router[_0xa7dc('0x1c')](_0xa7dc('0xf'),auth[_0xa7dc('0x9')](),controller['removeResources']);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 1c14cc3..017944e 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 _0xc57e=['exports','STRING','setDataValue','crudPermissions','getDataValue','split','BOOLEAN'];(function(_0x41d9d4,_0x197ba2){var _0x5d1a26=function(_0x59b015){while(--_0x59b015){_0x41d9d4['push'](_0x41d9d4['shift']());}};_0x5d1a26(++_0x197ba2);}(_0xc57e,0x16c));var _0xec57=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc57e[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xec57('0x0')]={'name':{'type':Sequelize[_0xec57('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1b71e9){this[_0xec57('0x2')](_0xec57('0x3'),_0x1b71e9?_0x1b71e9['join'](''):[]);},'get':function(){return this[_0xec57('0x4')]('crudPermissions')?this[_0xec57('0x4')](_0xec57('0x3'))[_0xec57('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xec57('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xec57('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xec57('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xec57('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xec57('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xec57('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xec57('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xec57('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x462b=['setDataValue','join','crudPermissions','getDataValue','split','BOOLEAN','sequelize','STRING','name'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x462b,0xf0));var _0xb462=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x462b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb462('0x0'));module['exports']={'name':{'type':Sequelize[_0xb462('0x1')],'allowNull':![],'unique':_0xb462('0x2')},'crudPermissions':{'type':Sequelize[_0xb462('0x1')],'set':function(_0x5955aa){this[_0xb462('0x3')]('crudPermissions',_0x5955aa?_0x5955aa[_0xb462('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xb462('0x5'))?this[_0xb462('0x6')](_0xb462('0x5'))[_0xb462('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb462('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb462('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb462('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb462('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb462('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb462('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb462('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb462('0x8')],'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 2cb73af..e9b5148 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 _0x20d8=['update','describe','removeSections','ids','getSections','enabled','includes','subsections','push','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfile','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','clone','get','omit','createdAt','crudPermissions','body','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection'];(function(_0xe0da73,_0x29c19d){var _0x1352d9=function(_0x2b986b){while(--_0x2b986b){_0xe0da73['push'](_0xe0da73['shift']());}};_0x1352d9(++_0x29c19d);}(_0x20d8,0xee));var _0x820d=function(_0x10786c,_0x4a64c8){_0x10786c=_0x10786c-0x0;var _0x48c23f=_0x20d8[_0x10786c];return _0x48c23f;};'use strict';var emlformat=require(_0x820d('0x0'));var rimraf=require(_0x820d('0x1'));var zipdir=require(_0x820d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x820d('0x3'));var BPromise=require(_0x820d('0x4'));var Mustache=require(_0x820d('0x5'));var util=require(_0x820d('0x6'));var path=require(_0x820d('0x7'));var sox=require('sox');var csv=require(_0x820d('0x8'));var ejs=require(_0x820d('0x9'));var fs=require('fs');var fs_extra=require(_0x820d('0xa'));var _=require('lodash');var squel=require(_0x820d('0xb'));var crypto=require(_0x820d('0xc'));var jsforce=require(_0x820d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x820d('0x8'));var querystring=require('querystring');var Papa=require(_0x820d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x820d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x820d('0x10'));var logger=require(_0x820d('0x11'))(_0x820d('0x12'));var utils=require('../../config/utils');var config=require(_0x820d('0x13'));var licenseUtil=require(_0x820d('0x14'));var db=require('../../mysqldb')['db'];config[_0x820d('0x15')]=_['defaults'](config[_0x820d('0x15')],{'host':_0x820d('0x16'),'port':0x18eb});var socket=require(_0x820d('0x17'))(new Redis(config[_0x820d('0x15')]));require(_0x820d('0x18'))[_0x820d('0x19')](socket);function respondWithStatusCode(_0x56b600,_0x528ccc){_0x528ccc=_0x528ccc||0xcc;return function(_0x1d7264){if(_0x1d7264){return _0x56b600['sendStatus'](_0x528ccc);}return _0x56b600[_0x820d('0x1a')](_0x528ccc)[_0x820d('0x1b')]();};}function respondWithResult(_0x455bfb,_0x5b5c83){_0x5b5c83=_0x5b5c83||0xc8;return function(_0x41549b){if(_0x41549b){return _0x455bfb[_0x820d('0x1a')](_0x5b5c83)[_0x820d('0x1c')](_0x41549b);}};}function respondWithFilteredResult(_0x1c0455,_0x4126fd){return function(_0x43d424){if(_0x43d424){var _0x1d65bb=typeof _0x4126fd[_0x820d('0x1d')]===_0x820d('0x1e')&&typeof _0x4126fd[_0x820d('0x1f')]===_0x820d('0x1e');var _0x29d8b5=_0x43d424[_0x820d('0x20')];var _0x35520c=_0x1d65bb?0x0:_0x4126fd[_0x820d('0x1d')];var _0x27d50d=_0x1d65bb?_0x43d424[_0x820d('0x20')]:_0x4126fd[_0x820d('0x1d')]+_0x4126fd[_0x820d('0x1f')];var _0x53dec9;if(_0x27d50d>=_0x29d8b5){_0x27d50d=_0x29d8b5;_0x53dec9=0xc8;}else{_0x53dec9=0xce;}_0x1c0455[_0x820d('0x1a')](_0x53dec9);return _0x1c0455[_0x820d('0x21')]('Content-Range',_0x35520c+'-'+_0x27d50d+'/'+_0x29d8b5)[_0x820d('0x1c')](_0x43d424);}return null;};}function patchUpdates(_0x2de355){return function(_0x118aec){try{jsonpatch[_0x820d('0x22')](_0x118aec,_0x2de355,!![]);}catch(_0x237856){return BPromise[_0x820d('0x23')](_0x237856);}return _0x118aec[_0x820d('0x24')]();};}function saveUpdates(_0x2beae7,_0x4650d0){return function(_0xc01843){if(_0xc01843){return _0xc01843['update'](_0x2beae7)[_0x820d('0x25')](function(_0x54c975){return _0x54c975;});}return null;};}function removeEntity(_0xa3bce,_0x16fbf0){return function(_0xa9fc92){if(_0xa9fc92){return _0xa9fc92[_0x820d('0x26')]()[_0x820d('0x25')](function(){_0xa3bce[_0x820d('0x1a')](0xcc)[_0x820d('0x1b')]();});}};}function handleEntityNotFound(_0x582010,_0x1b078a){return function(_0x284dae){if(!_0x284dae){_0x582010[_0x820d('0x27')](0x194);}return _0x284dae;};}function handleError(_0x537823,_0x42c235){_0x42c235=_0x42c235||0x1f4;return function(_0x5a0697){logger[_0x820d('0x28')](_0x5a0697[_0x820d('0x29')]);if(_0x5a0697[_0x820d('0x2a')]){delete _0x5a0697['name'];}_0x537823['status'](_0x42c235)[_0x820d('0x2b')](_0x5a0697);};}exports[_0x820d('0x2c')]=function(_0x4fab38,_0x5167d0){var _0x30ff53={},_0x215872={},_0x4cc5da={'count':0x0,'rows':[]};var _0x170fee=_[_0x820d('0x2d')](db[_0x820d('0x2e')]['rawAttributes'],function(_0x1e4b7f){return{'name':_0x1e4b7f['fieldName'],'type':_0x1e4b7f['type']['key']};});_0x215872[_0x820d('0x2f')]=_[_0x820d('0x2d')](_0x170fee,_0x820d('0x2a'));_0x215872['query']=_[_0x820d('0x30')](_0x4fab38[_0x820d('0x31')]);_0x215872['filters']=_[_0x820d('0x32')](_0x215872['model'],_0x215872[_0x820d('0x31')]);_0x30ff53[_0x820d('0x33')]=_[_0x820d('0x32')](_0x215872['model'],qs[_0x820d('0x34')](_0x4fab38['query'][_0x820d('0x34')]));_0x30ff53[_0x820d('0x33')]=_0x30ff53[_0x820d('0x33')][_0x820d('0x35')]?_0x30ff53[_0x820d('0x33')]:_0x215872['model'];if(!_0x4fab38[_0x820d('0x31')]['hasOwnProperty'](_0x820d('0x36'))){_0x30ff53[_0x820d('0x1f')]=qs['limit'](_0x4fab38[_0x820d('0x31')]['limit']);_0x30ff53[_0x820d('0x1d')]=qs['offset'](_0x4fab38['query'][_0x820d('0x1d')]);}_0x30ff53[_0x820d('0x37')]=qs[_0x820d('0x38')](_0x4fab38[_0x820d('0x31')]['sort']);_0x30ff53[_0x820d('0x39')]=qs[_0x820d('0x3a')](_['pick'](_0x4fab38['query'],_0x215872[_0x820d('0x3a')]),_0x170fee);if(_0x4fab38[_0x820d('0x31')][_0x820d('0x3b')]){_0x30ff53[_0x820d('0x39')]=_[_0x820d('0x3c')](_0x30ff53[_0x820d('0x39')],{'$or':_[_0x820d('0x2d')](_0x170fee,function(_0x51aa6c){if(_0x51aa6c['type']!==_0x820d('0x3d')){var _0xa3adab={};_0xa3adab[_0x51aa6c[_0x820d('0x2a')]]={'$like':'%'+_0x4fab38[_0x820d('0x31')]['filter']+'%'};return _0xa3adab;}})});}_0x30ff53=_[_0x820d('0x3c')]({},_0x30ff53,_0x4fab38[_0x820d('0x3e')]);var _0x2b2cba={'where':_0x30ff53[_0x820d('0x39')]};return db[_0x820d('0x2e')][_0x820d('0x20')](_0x2b2cba)['then'](function(_0xc01378){_0x4cc5da['count']=_0xc01378;if(_0x4fab38[_0x820d('0x31')]['includeAll']){_0x30ff53[_0x820d('0x3f')]=[{'all':!![]}];}return db[_0x820d('0x2e')][_0x820d('0x40')](_0x30ff53);})['then'](function(_0x14fc29){_0x4cc5da[_0x820d('0x41')]=_0x14fc29;return _0x4cc5da;})['then'](respondWithFilteredResult(_0x5167d0,_0x30ff53))['catch'](handleError(_0x5167d0,null));};exports[_0x820d('0x42')]=function(_0x4f8756,_0x22974e){var _0x28ba53={'raw':![],'where':{'id':_0x4f8756[_0x820d('0x43')]['id']}},_0x55d820={};_0x55d820[_0x820d('0x2f')]=_[_0x820d('0x30')](db[_0x820d('0x2e')][_0x820d('0x44')]);_0x55d820[_0x820d('0x31')]=_['keys'](_0x4f8756[_0x820d('0x31')]);_0x55d820[_0x820d('0x3a')]=_[_0x820d('0x32')](_0x55d820['model'],_0x55d820[_0x820d('0x31')]);_0x28ba53[_0x820d('0x33')]=_[_0x820d('0x32')](_0x55d820['model'],qs[_0x820d('0x34')](_0x4f8756[_0x820d('0x31')][_0x820d('0x34')]));_0x28ba53[_0x820d('0x33')]=_0x28ba53[_0x820d('0x33')]['length']?_0x28ba53[_0x820d('0x33')]:_0x55d820[_0x820d('0x2f')];if(_0x4f8756[_0x820d('0x31')][_0x820d('0x45')]){_0x28ba53[_0x820d('0x3f')]=[{'all':!![]}];}_0x28ba53=_[_0x820d('0x3c')]({},_0x28ba53,_0x4f8756['options']);return db[_0x820d('0x2e')][_0x820d('0x46')](_0x28ba53)[_0x820d('0x25')](handleEntityNotFound(_0x22974e,null))[_0x820d('0x25')](respondWithResult(_0x22974e,null))[_0x820d('0x47')](handleError(_0x22974e,null));};exports[_0x820d('0x48')]=function(_0x5005a8,_0x27b340){return db[_0x820d('0x2e')][_0x820d('0x48')](_0x5005a8['body'],{})['then'](respondWithResult(_0x27b340,0xc9))[_0x820d('0x47')](handleError(_0x27b340,null));};exports[_0x820d('0x49')]=function(_0x28d25a,_0x2f7a4d){var _0x5eb9c2={'where':{'id':_0x28d25a[_0x820d('0x43')]['id']}},_0x11a1f4={};_0x11a1f4[_0x820d('0x2f')]=_[_0x820d('0x30')](db[_0x820d('0x2e')][_0x820d('0x44')]);_0x5eb9c2['attributes']=_[_0x820d('0x32')](_0x11a1f4[_0x820d('0x2f')],qs[_0x820d('0x34')](_0x28d25a['query'][_0x820d('0x34')]));_0x5eb9c2[_0x820d('0x33')]=_0x5eb9c2['attributes']['length']?_0x5eb9c2['attributes']:_0x11a1f4[_0x820d('0x2f')];if(_0x28d25a[_0x820d('0x31')][_0x820d('0x45')]){_0x5eb9c2[_0x820d('0x3f')]=[{'all':!![]}];}_0x5eb9c2=_['merge']({},_0x5eb9c2,_0x28d25a['options']);return db[_0x820d('0x2e')][_0x820d('0x46')](_0x5eb9c2)[_0x820d('0x25')](handleEntityNotFound(_0x2f7a4d,null))[_0x820d('0x25')](function(_0x371514){if(_0x371514){var _0x5f1d41=_0x371514[_0x820d('0x4a')]({'plain':!![]});_0x5f1d41=qs[_0x820d('0x4b')](_0x5f1d41,['id',_0x820d('0x4c'),'updatedAt',_0x820d('0x4d')]);_0x28d25a['body']=_[_0x820d('0x4b')](_0x28d25a[_0x820d('0x4e')],['id',_0x820d('0x4c'),_0x820d('0x4f')]);return db[_0x820d('0x50')][_0x820d('0x51')](function(_0xac26c6){return db[_0x820d('0x2e')]['create'](_[_0x820d('0x3c')](_0x5f1d41,_0x28d25a['body']),{'include':_0x28d25a[_0x820d('0x31')][_0x820d('0x45')]?[{'all':!![]}]:undefined,'transaction':_0xac26c6})['then'](function(_0x2470d9){var _0x93ec68=_0x2470d9[_0x820d('0x4a')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x28d25a[_0x820d('0x43')]['id']},'raw':!![]})[_0x820d('0x25')](function(_0x2d763b){if(_0x2d763b){return BPromise[_0x820d('0x52')](_0x2d763b,function(_0x4beacc){return new BPromise(function(_0xca554f,_0x1e3001){if(_0x4beacc[_0x820d('0x53')]===null||_0x4beacc['autoAssociation']===0x1)_0xca554f(null);return db[_0x820d('0x54')][_0x820d('0x40')]({'where':{'sectionId':_0x4beacc['id']},'raw':!![]})[_0x820d('0x25')](function(_0x474435){var _0x526008=_['map'](_0x474435,function(_0x27727a){return qs[_0x820d('0x4b')](_0x27727a,['id',_0x820d('0x4c'),_0x820d('0x4f'),_0x820d('0x55')]);});_0xca554f(_0x526008);})[_0x820d('0x47')](function(_0x57ec56){_0x1e3001(_0x57ec56);});})[_0x820d('0x25')](function(_0x32a2e7){var _0x17ec56=qs[_0x820d('0x4b')](_0x4beacc,['id',_0x820d('0x4c'),_0x820d('0x4f')]);_0x17ec56[_0x820d('0x56')]=_0x93ec68['id'];if(_0x32a2e7)_0x17ec56[_0x820d('0x57')]=_0x32a2e7;return _0x17ec56;})[_0x820d('0x25')](function(_0x3fa09b){return db[_0x820d('0x58')][_0x820d('0x48')](_0x3fa09b,{'include':[{'model':db[_0x820d('0x54')],'as':_0x820d('0x57')}],'raw':!![],'transaction':_0xac26c6});});})[_0x820d('0x25')](function(){return _0x93ec68;});}});});});}})['then'](respondWithResult(_0x2f7a4d,0xc9))[_0x820d('0x47')](handleError(_0x2f7a4d,null));};exports[_0x820d('0x59')]=function(_0x44fbec,_0x15128a){if(_0x44fbec[_0x820d('0x4e')]['id']){delete _0x44fbec[_0x820d('0x4e')]['id'];}return db[_0x820d('0x2e')][_0x820d('0x46')]({'where':{'id':_0x44fbec[_0x820d('0x43')]['id']}})[_0x820d('0x25')](handleEntityNotFound(_0x15128a,null))[_0x820d('0x25')](saveUpdates(_0x44fbec[_0x820d('0x4e')],null))['then'](respondWithResult(_0x15128a,null))[_0x820d('0x47')](handleError(_0x15128a,null));};exports[_0x820d('0x26')]=function(_0x3512ca,_0x17f68d){return db['UserProfile'][_0x820d('0x46')]({'where':{'id':_0x3512ca[_0x820d('0x43')]['id']}})['then'](handleEntityNotFound(_0x17f68d,null))[_0x820d('0x25')](removeEntity(_0x17f68d,null))['catch'](handleError(_0x17f68d,null));};exports[_0x820d('0x5a')]=function(_0x23c8f6,_0x35ca09){return db[_0x820d('0x2e')][_0x820d('0x5a')]()[_0x820d('0x25')](respondWithResult(_0x35ca09,null))['catch'](handleError(_0x35ca09,null));};exports['addSections']=function(_0x22214f,_0x47e645){var _0x2d54be=_0x22214f[_0x820d('0x4e')];return db[_0x820d('0x2e')]['find']({'where':{'id':_0x22214f[_0x820d('0x43')]['id']}})[_0x820d('0x25')](handleEntityNotFound(_0x47e645,null))[_0x820d('0x25')](function(_0x123ccb){if(_0x123ccb){return db[_0x820d('0x50')][_0x820d('0x51')](function(_0x138f4c){return db[_0x820d('0x58')][_0x820d('0x26')]({'where':{'userProfileId':_0x22214f['params']['id'],'sectionId':_[_0x820d('0x2d')](_0x2d54be,function(_0x2e9f66){return _0x2e9f66['sectionId'];})},'transaction':_0x138f4c})['then'](function(){var _0x26a22d=_[_0x820d('0x2d')](_0x2d54be,function(_0x43939f){_0x43939f[_0x820d('0x56')]=_0x22214f[_0x820d('0x43')]['id'];return _0x43939f;});var _0x510d05=[];return BPromise[_0x820d('0x52')](_0x26a22d,function(_0x120f4c){return db[_0x820d('0x58')]['create'](_0x120f4c,{'include':[{'model':db[_0x820d('0x54')],'as':_0x820d('0x57')}],'raw':!![],'transaction':_0x138f4c})[_0x820d('0x25')](function(_0x37bec6){_0x510d05['push'](_0x37bec6[_0x820d('0x4a')]({'plain':!![]}));});})[_0x820d('0x25')](function(){return _0x510d05;});});});}})[_0x820d('0x25')](function(_0x5cf5c1){return _0x5cf5c1;})[_0x820d('0x25')](respondWithResult(_0x47e645,null))[_0x820d('0x47')](handleError(_0x47e645,null));};exports[_0x820d('0x5b')]=function(_0x414f42,_0x2c4e40){var _0x3c0f60;return db['UserProfile'][_0x820d('0x46')]({'where':{'id':_0x414f42[_0x820d('0x43')]['id']},'attributes':['id',_0x820d('0x2a')]})[_0x820d('0x25')](handleEntityNotFound(_0x2c4e40,null))[_0x820d('0x25')](function(_0x2886d9){if(_0x2886d9){_0x3c0f60=_0x2886d9;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x414f42['params']['id'],'sectionId':_0x414f42[_0x820d('0x31')][_0x820d('0x5c')]}});}})['then'](function(){return _0x3c0f60;})[_0x820d('0x25')](respondWithStatusCode(_0x2c4e40,null))[_0x820d('0x47')](handleError(_0x2c4e40,null));};exports[_0x820d('0x5d')]=function(_0x14e788,_0x407bfa){var _0x5703fb=[];var _0x14f16f=[];return db[_0x820d('0x58')]['findAll']({'where':{'userProfileId':_0x14e788[_0x820d('0x43')]['id']},'raw':!![]})[_0x820d('0x25')](function(_0x4c94e4){_0x5703fb=_[_0x820d('0x3b')](_0x4c94e4,function(_0xaf89bb){return _0xaf89bb[_0x820d('0x5e')]===0x1||_[_0x820d('0x5f')]([0x3eb,0x709],_0xaf89bb[_0x820d('0x55')]);});if(!_['isEmpty'](_0x5703fb)){return _['map'](_0x5703fb,function(_0x2b466c){return _0x2b466c[_0x820d('0x55')];});}else{return;}})[_0x820d('0x25')](function(_0x115d62){if(_0x115d62)_0x14f16f=_0x115d62;if(_[_0x820d('0x5f')](_0x14f16f,0x64)){var _0x563ef4=_[_0x820d('0x46')](_0x5703fb,{'sectionId':0x64});return hasDefaultDashboard(_0x563ef4)[_0x820d('0x25')](function(_0x2ca405){return _['map'](_0x5703fb,function(_0x101a1f){if(_0x101a1f[_0x820d('0x55')]===0x64){_0x101a1f[_0x820d('0x60')]=_0x2ca405;}return _0x101a1f;});});}else{return;}})['then'](function(_0x3b5203){if(_0x3b5203)_0x5703fb=_0x3b5203;if(_['includes'](_0x14f16f,0x3eb)){var _0x4907a7=_[_0x820d('0x46')](_0x5703fb,{'sectionId':0x3eb});return getCustomDashboards(_0x4907a7)[_0x820d('0x25')](function(_0x110187){return _[_0x820d('0x2d')](_0x5703fb,function(_0x7d3883){if(_0x4907a7[_0x820d('0x5e')]){if(_0x7d3883['sectionId']===0x3eb){_0x7d3883[_0x820d('0x60')]=_0x110187;}}else{if(_0x7d3883['sectionId']===0x64){_0x7d3883[_0x820d('0x60')]=_0x110187;}}return _0x7d3883;});});}else{return;}})['then'](function(_0x592083){if(_0x592083)_0x5703fb=_0x592083;if(_[_0x820d('0x5f')](_0x14f16f,0x709)){var _0x33e3b2=_[_0x820d('0x46')](_0x5703fb,{'sectionId':0x709});return getPlugins(_0x33e3b2)[_0x820d('0x25')](function(_0x34179a){if(_0x33e3b2[_0x820d('0x5e')]){return _[_0x820d('0x2d')](_0x5703fb,function(_0x217f29){if(_0x217f29[_0x820d('0x55')]===0x709){_0x217f29[_0x820d('0x60')]=_0x34179a;}return _0x217f29;});}else{var _0x497c35={'sectionId':0x76c,'enabled':0x1,'subsections':_0x34179a};var _0x23f6c9=_[_0x820d('0x2d')](_0x5703fb);_0x23f6c9[_0x820d('0x61')](_0x497c35);return _0x23f6c9;}});}else{return;}})[_0x820d('0x25')](function(_0xe0d31a){if(_0xe0d31a)_0x5703fb=_0xe0d31a;return _[_0x820d('0x3b')](_0x5703fb,[_0x820d('0x5e'),0x1]);})[_0x820d('0x25')](respondWithResult(_0x407bfa,null))[_0x820d('0x47')](handleError(_0x407bfa,null));};function hasDefaultDashboard(_0x39dca5){var _0x1c2694=[0x65];return new BPromise(function(_0x4bd3ff,_0x1f93da){try{if(_0x39dca5[_0x820d('0x53')]){_0x4bd3ff(_0x1c2694);}else{return db[_0x820d('0x54')]['findOne']({'where':{'sectionId':_0x39dca5['id']},'raw':!![]})['then'](function(_0x2074b6){_0x2074b6?_0x4bd3ff(_0x1c2694):_0x4bd3ff();});}}catch(_0x659a19){_0x1f93da(_0x659a19);}});}function getCustomDashboards(_0x11895f){var _0x238bb2=[];return new BPromise(function(_0x4e5865,_0x3417e4){try{if(_0x11895f[_0x820d('0x53')]){return db['Dashboard'][_0x820d('0x40')]({'raw':!![]})[_0x820d('0x25')](function(_0x469fa5){_0x469fa5[_0x820d('0x62')](function(_0x38f8e9){_0x238bb2[_0x820d('0x61')](_0x38f8e9['id']+0x1869f);});_0x4e5865(_0x238bb2);});}else{return db[_0x820d('0x54')][_0x820d('0x40')]({'where':{'sectionId':_0x11895f['id']},'raw':!![]})[_0x820d('0x25')](function(_0x761e12){_0x761e12[_0x820d('0x62')](function(_0x5a7537){_0x238bb2[_0x820d('0x61')](_0x5a7537[_0x820d('0x63')]+0x1869f);});_0x4e5865(_0x238bb2);});}}catch(_0x594d13){_0x3417e4(_0x594d13);}});}function getPlugins(_0x55d333){var _0x2a4c89=[];return new BPromise(function(_0x4ba933,_0x43c028){try{if(_0x55d333[_0x820d('0x53')]){return db[_0x820d('0x64')][_0x820d('0x40')]({'raw':!![]})[_0x820d('0x25')](function(_0x251b07){_0x251b07[_0x820d('0x62')](function(_0x37d4e6){_0x2a4c89['push'](_0x37d4e6['id']+0x15b38);});_0x4ba933(_0x2a4c89);});}else{return db[_0x820d('0x54')][_0x820d('0x40')]({'where':{'sectionId':_0x55d333['id']},'raw':!![]})[_0x820d('0x25')](function(_0x51330f){_0x51330f[_0x820d('0x62')](function(_0x5cb71a){_0x2a4c89[_0x820d('0x61')](_0x5cb71a[_0x820d('0x63')]+0x15b38);});_0x4ba933(_0x2a4c89);});}}catch(_0x44f6a3){_0x43c028(_0x44f6a3);}});}exports[_0x820d('0x65')]=function(_0x331a89,_0x8b8443){return db[_0x820d('0x2e')][_0x820d('0x46')]({'where':{'id':_0x331a89['params']['id']}})[_0x820d('0x25')](handleEntityNotFound(_0x8b8443,null))[_0x820d('0x25')](function(_0x50dd11){if(_0x50dd11){return db[_0x820d('0x50')]['transaction'](function(_0xe270a9){return db[_0x820d('0x58')]['findAll']({'where':{'userProfileId':_0x331a89[_0x820d('0x43')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x20e4d4){if(_0x20e4d4){return db[_0x820d('0x58')][_0x820d('0x26')]({'where':{'userProfileId':_0x331a89[_0x820d('0x43')]['id'],'id':_[_0x820d('0x2d')](_0x20e4d4,function(_0x4cf48e){return _0x4cf48e['id'];})},'transaction':_0xe270a9});}})[_0x820d('0x25')](function(_0x15cafe){var _0x5608eb=_[_0x820d('0x2d')](_0x331a89[_0x820d('0x4e')],function(_0x1d5d2d){_0x1d5d2d[_0x820d('0x56')]=_0x331a89[_0x820d('0x43')]['id'];return _0x1d5d2d;});return db[_0x820d('0x58')]['bulkCreate'](_0x5608eb,{'raw':!![],'transaction':_0xe270a9});})['then'](function(_0x422cd8){var _0x5cf942=_[_0x820d('0x3b')](_[_0x820d('0x2d')](_0x422cd8,function(_0x3c0f72){return _0x3c0f72[_0x820d('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x5cf942){return db[_0x820d('0x58')]['findAll']({'where':{'userProfileId':_0x331a89[_0x820d('0x43')]['id'],'sectionId':_[_0x820d('0x2d')](_0x5cf942,function(_0x103e00){return _0x103e00['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x820d('0x25')](function(_0x18dbac){var _0x39c5dd=_[_0x820d('0x2d')](_0x331a89[_0x820d('0x4e')],function(_0xcfde3c){_0xcfde3c[_0x820d('0x56')]=_0x331a89['params']['id'];return _0xcfde3c;});return db['UserProfileResource'][_0x820d('0x66')](_0x39c5dd,{'raw':!![],'transaction':_0xe270a9});});}})[_0x820d('0x47')](handleError(_0x8b8443,null));});}})[_0x820d('0x25')](function(_0x2bb8cb){var _0x14b291=_[_0x820d('0x2d')](_0x2bb8cb,function(_0x1cd54a){return _0x1cd54a['get']({'plain':!![]});});})[_0x820d('0x25')](respondWithResult(_0x8b8443,null))['catch'](handleError(_0x8b8443,null));};exports[_0x820d('0x67')]=function(_0x24229e,_0x50f77f,_0x1eb962){return db['UserProfile'][_0x820d('0x46')]({'where':{'id':_0x24229e[_0x820d('0x43')]['id']}})[_0x820d('0x25')](handleEntityNotFound(_0x50f77f,null))[_0x820d('0x25')](function(_0x577b8d){if(_0x577b8d){return _0x577b8d['removeResources'](_0x24229e[_0x820d('0x31')][_0x820d('0x5c')]);}})[_0x820d('0x25')](respondWithStatusCode(_0x50f77f,null))[_0x820d('0x47')](handleError(_0x50f77f,null));};exports[_0x820d('0x68')]=function(_0x214913,_0x2c67ba){var _0x30171a={};if(!_0x214913[_0x820d('0x31')][_0x820d('0x69')])throw new Error(_0x820d('0x6a'));if(!_0x214913['query'][_0x820d('0x6b')](_0x820d('0x36'))){_0x30171a[_0x820d('0x1f')]=qs['limit'](_0x214913[_0x820d('0x31')]['limit']);_0x30171a[_0x820d('0x1d')]=qs[_0x820d('0x1d')](_0x214913[_0x820d('0x31')][_0x820d('0x1d')]);}return db[_0x820d('0x2e')]['find']({'where':{'id':_0x214913[_0x820d('0x43')]['id']}})[_0x820d('0x25')](function(_0xf8efea){if(!_0xf8efea)throw new Error(_0x820d('0x6c')+_0x214913[_0x820d('0x43')]['id']);return db[_0x820d('0x2e')][_0x820d('0x68')](_0x214913);})[_0x820d('0x25')](respondWithFilteredResult(_0x2c67ba,_0x30171a))[_0x820d('0x47')](handleError(_0x2c67ba,null));}; \ No newline at end of file +var _0xc23d=['findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfile','includeAll','rows','catch','show','params','rawAttributes','find','create','body','clone','include','get','omit','updatedAt','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','destroy','describe','addSections','transaction','ids','includes','isEmpty','subsections','enabled','push'];(function(_0x193263,_0x346558){var _0xaabaf4=function(_0x36a838){while(--_0x36a838){_0x193263['push'](_0x193263['shift']());}};_0xaabaf4(++_0x346558);}(_0xc23d,0x7f));var _0xdc23=function(_0x1b964a,_0x40fdc2){_0x1b964a=_0x1b964a-0x0;var _0x2559fa=_0xc23d[_0x1b964a];return _0x2559fa;};'use strict';var emlformat=require(_0xdc23('0x0'));var rimraf=require(_0xdc23('0x1'));var zipdir=require(_0xdc23('0x2'));var jsonpatch=require(_0xdc23('0x3'));var rp=require(_0xdc23('0x4'));var moment=require(_0xdc23('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc23('0x6'));var util=require(_0xdc23('0x7'));var path=require(_0xdc23('0x8'));var sox=require(_0xdc23('0x9'));var csv=require(_0xdc23('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc23('0xb'));var squel=require('squel');var crypto=require(_0xdc23('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdc23('0xd'));var toCsv=require(_0xdc23('0xa'));var querystring=require(_0xdc23('0xe'));var Papa=require(_0xdc23('0xf'));var Redis=require(_0xdc23('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdc23('0x11'));var as=require(_0xdc23('0x12'));var hardwareService=require(_0xdc23('0x13'));var logger=require(_0xdc23('0x14'))(_0xdc23('0x15'));var utils=require(_0xdc23('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdc23('0x17'));var db=require(_0xdc23('0x18'))['db'];config[_0xdc23('0x19')]=_[_0xdc23('0x1a')](config['redis'],{'host':_0xdc23('0x1b'),'port':0x18eb});var socket=require(_0xdc23('0x1c'))(new Redis(config[_0xdc23('0x19')]));require(_0xdc23('0x1d'))[_0xdc23('0x1e')](socket);function respondWithStatusCode(_0xc0f0a2,_0x4908de){_0x4908de=_0x4908de||0xcc;return function(_0x134037){if(_0x134037){return _0xc0f0a2['sendStatus'](_0x4908de);}return _0xc0f0a2[_0xdc23('0x1f')](_0x4908de)[_0xdc23('0x20')]();};}function respondWithResult(_0x2ba40a,_0x5b99f5){_0x5b99f5=_0x5b99f5||0xc8;return function(_0x26573a){if(_0x26573a){return _0x2ba40a[_0xdc23('0x1f')](_0x5b99f5)[_0xdc23('0x21')](_0x26573a);}};}function respondWithFilteredResult(_0x436e4a,_0x4eaad7){return function(_0x258f61){if(_0x258f61){var _0x4472b3=typeof _0x4eaad7[_0xdc23('0x22')]==='undefined'&&typeof _0x4eaad7['limit']===_0xdc23('0x23');var _0x21bd43=_0x258f61[_0xdc23('0x24')];var _0x21ec4a=_0x4472b3?0x0:_0x4eaad7[_0xdc23('0x22')];var _0x3c7d4c=_0x4472b3?_0x258f61[_0xdc23('0x24')]:_0x4eaad7['offset']+_0x4eaad7[_0xdc23('0x25')];var _0x535926;if(_0x3c7d4c>=_0x21bd43){_0x3c7d4c=_0x21bd43;_0x535926=0xc8;}else{_0x535926=0xce;}_0x436e4a[_0xdc23('0x1f')](_0x535926);return _0x436e4a[_0xdc23('0x26')](_0xdc23('0x27'),_0x21ec4a+'-'+_0x3c7d4c+'/'+_0x21bd43)[_0xdc23('0x21')](_0x258f61);}return null;};}function patchUpdates(_0x42c77e){return function(_0x5f02cb){try{jsonpatch['apply'](_0x5f02cb,_0x42c77e,!![]);}catch(_0x4e8054){return BPromise[_0xdc23('0x28')](_0x4e8054);}return _0x5f02cb[_0xdc23('0x29')]();};}function saveUpdates(_0x276fb4,_0x163700){return function(_0xa5abb3){if(_0xa5abb3){return _0xa5abb3[_0xdc23('0x2a')](_0x276fb4)[_0xdc23('0x2b')](function(_0x26e4ed){return _0x26e4ed;});}return null;};}function removeEntity(_0x168411,_0x210237){return function(_0x4696bb){if(_0x4696bb){return _0x4696bb['destroy']()[_0xdc23('0x2b')](function(){_0x168411['status'](0xcc)[_0xdc23('0x20')]();});}};}function handleEntityNotFound(_0x2545b4,_0x37871){return function(_0x3c0647){if(!_0x3c0647){_0x2545b4[_0xdc23('0x2c')](0x194);}return _0x3c0647;};}function handleError(_0xb932ff,_0x2fe0a4){_0x2fe0a4=_0x2fe0a4||0x1f4;return function(_0x553f03){logger[_0xdc23('0x2d')](_0x553f03[_0xdc23('0x2e')]);if(_0x553f03['name']){delete _0x553f03[_0xdc23('0x2f')];}_0xb932ff[_0xdc23('0x1f')](_0x2fe0a4)[_0xdc23('0x30')](_0x553f03);};}exports[_0xdc23('0x31')]=function(_0xafd0e1,_0x2337f3){var _0x43e483={},_0x40becf={},_0xc20b91={'count':0x0,'rows':[]};var _0x501c9a=_[_0xdc23('0x32')](db['UserProfile']['rawAttributes'],function(_0x1c13b8){return{'name':_0x1c13b8[_0xdc23('0x33')],'type':_0x1c13b8[_0xdc23('0x34')]['key']};});_0x40becf[_0xdc23('0x35')]=_[_0xdc23('0x32')](_0x501c9a,'name');_0x40becf[_0xdc23('0x36')]=_[_0xdc23('0x37')](_0xafd0e1[_0xdc23('0x36')]);_0x40becf[_0xdc23('0x38')]=_['intersection'](_0x40becf[_0xdc23('0x35')],_0x40becf[_0xdc23('0x36')]);_0x43e483['attributes']=_[_0xdc23('0x39')](_0x40becf[_0xdc23('0x35')],qs[_0xdc23('0x3a')](_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x3a')]));_0x43e483[_0xdc23('0x3b')]=_0x43e483[_0xdc23('0x3b')][_0xdc23('0x3c')]?_0x43e483[_0xdc23('0x3b')]:_0x40becf[_0xdc23('0x35')];if(!_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x3d')]('nolimit')){_0x43e483[_0xdc23('0x25')]=qs['limit'](_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x25')]);_0x43e483[_0xdc23('0x22')]=qs[_0xdc23('0x22')](_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x22')]);}_0x43e483[_0xdc23('0x3e')]=qs[_0xdc23('0x3f')](_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x3f')]);_0x43e483[_0xdc23('0x40')]=qs['filters'](_[_0xdc23('0x41')](_0xafd0e1[_0xdc23('0x36')],_0x40becf[_0xdc23('0x38')]),_0x501c9a);if(_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x42')]){_0x43e483[_0xdc23('0x40')]=_[_0xdc23('0x43')](_0x43e483['where'],{'$or':_[_0xdc23('0x32')](_0x501c9a,function(_0x213062){if(_0x213062[_0xdc23('0x34')]!==_0xdc23('0x44')){var _0x36d4ef={};_0x36d4ef[_0x213062[_0xdc23('0x2f')]]={'$like':'%'+_0xafd0e1[_0xdc23('0x36')]['filter']+'%'};return _0x36d4ef;}})});}_0x43e483=_['merge']({},_0x43e483,_0xafd0e1[_0xdc23('0x45')]);var _0x46d2e3={'where':_0x43e483['where']};return db[_0xdc23('0x46')][_0xdc23('0x24')](_0x46d2e3)[_0xdc23('0x2b')](function(_0x366e77){_0xc20b91['count']=_0x366e77;if(_0xafd0e1[_0xdc23('0x36')][_0xdc23('0x47')]){_0x43e483['include']=[{'all':!![]}];}return db[_0xdc23('0x46')]['findAll'](_0x43e483);})[_0xdc23('0x2b')](function(_0x597373){_0xc20b91[_0xdc23('0x48')]=_0x597373;return _0xc20b91;})[_0xdc23('0x2b')](respondWithFilteredResult(_0x2337f3,_0x43e483))[_0xdc23('0x49')](handleError(_0x2337f3,null));};exports[_0xdc23('0x4a')]=function(_0x20a49c,_0x218e67){var _0x352152={'raw':![],'where':{'id':_0x20a49c[_0xdc23('0x4b')]['id']}},_0x4cf525={};_0x4cf525['model']=_[_0xdc23('0x37')](db[_0xdc23('0x46')][_0xdc23('0x4c')]);_0x4cf525[_0xdc23('0x36')]=_[_0xdc23('0x37')](_0x20a49c[_0xdc23('0x36')]);_0x4cf525[_0xdc23('0x38')]=_['intersection'](_0x4cf525['model'],_0x4cf525[_0xdc23('0x36')]);_0x352152[_0xdc23('0x3b')]=_[_0xdc23('0x39')](_0x4cf525['model'],qs[_0xdc23('0x3a')](_0x20a49c[_0xdc23('0x36')][_0xdc23('0x3a')]));_0x352152[_0xdc23('0x3b')]=_0x352152[_0xdc23('0x3b')][_0xdc23('0x3c')]?_0x352152['attributes']:_0x4cf525[_0xdc23('0x35')];if(_0x20a49c['query'][_0xdc23('0x47')]){_0x352152['include']=[{'all':!![]}];}_0x352152=_[_0xdc23('0x43')]({},_0x352152,_0x20a49c[_0xdc23('0x45')]);return db[_0xdc23('0x46')][_0xdc23('0x4d')](_0x352152)[_0xdc23('0x2b')](handleEntityNotFound(_0x218e67,null))[_0xdc23('0x2b')](respondWithResult(_0x218e67,null))[_0xdc23('0x49')](handleError(_0x218e67,null));};exports[_0xdc23('0x4e')]=function(_0x46aff9,_0x3f81f0){return db[_0xdc23('0x46')]['create'](_0x46aff9[_0xdc23('0x4f')],{})['then'](respondWithResult(_0x3f81f0,0xc9))[_0xdc23('0x49')](handleError(_0x3f81f0,null));};exports[_0xdc23('0x50')]=function(_0x48eab5,_0x27f9e4){var _0x13354f={'where':{'id':_0x48eab5[_0xdc23('0x4b')]['id']}},_0x4325c7={};_0x4325c7['model']=_[_0xdc23('0x37')](db['UserProfile'][_0xdc23('0x4c')]);_0x13354f[_0xdc23('0x3b')]=_[_0xdc23('0x39')](_0x4325c7[_0xdc23('0x35')],qs[_0xdc23('0x3a')](_0x48eab5[_0xdc23('0x36')][_0xdc23('0x3a')]));_0x13354f[_0xdc23('0x3b')]=_0x13354f[_0xdc23('0x3b')][_0xdc23('0x3c')]?_0x13354f['attributes']:_0x4325c7['model'];if(_0x48eab5['query'][_0xdc23('0x47')]){_0x13354f[_0xdc23('0x51')]=[{'all':!![]}];}_0x13354f=_[_0xdc23('0x43')]({},_0x13354f,_0x48eab5['options']);return db['UserProfile'][_0xdc23('0x4d')](_0x13354f)[_0xdc23('0x2b')](handleEntityNotFound(_0x27f9e4,null))[_0xdc23('0x2b')](function(_0x248f66){if(_0x248f66){var _0x2589d5=_0x248f66[_0xdc23('0x52')]({'plain':!![]});_0x2589d5=qs[_0xdc23('0x53')](_0x2589d5,['id','createdAt',_0xdc23('0x54'),'crudPermissions']);_0x48eab5[_0xdc23('0x4f')]=_[_0xdc23('0x53')](_0x48eab5[_0xdc23('0x4f')],['id',_0xdc23('0x55'),'updatedAt']);return db[_0xdc23('0x56')]['transaction'](function(_0x1adefd){return db['UserProfile'][_0xdc23('0x4e')](_[_0xdc23('0x43')](_0x2589d5,_0x48eab5['body']),{'include':_0x48eab5[_0xdc23('0x36')][_0xdc23('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x1adefd})[_0xdc23('0x2b')](function(_0x2d2fdf){var _0x5b7fb3=_0x2d2fdf[_0xdc23('0x52')]({'plain':!![]});return db[_0xdc23('0x57')][_0xdc23('0x58')]({'where':{'userProfileId':_0x48eab5[_0xdc23('0x4b')]['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x42cde4){if(_0x42cde4){return BPromise[_0xdc23('0x59')](_0x42cde4,function(_0x6e8494){return new BPromise(function(_0x3b6c2e,_0x45998d){if(_0x6e8494[_0xdc23('0x5a')]===null||_0x6e8494[_0xdc23('0x5a')]===0x1)_0x3b6c2e(null);return db[_0xdc23('0x5b')][_0xdc23('0x58')]({'where':{'sectionId':_0x6e8494['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x276647){var _0xfc9f53=_[_0xdc23('0x32')](_0x276647,function(_0x5dfb7b){return qs[_0xdc23('0x53')](_0x5dfb7b,['id',_0xdc23('0x55'),_0xdc23('0x54'),_0xdc23('0x5c')]);});_0x3b6c2e(_0xfc9f53);})[_0xdc23('0x49')](function(_0x561fc1){_0x45998d(_0x561fc1);});})[_0xdc23('0x2b')](function(_0x357e36){var _0xcd03b3=qs[_0xdc23('0x53')](_0x6e8494,['id',_0xdc23('0x55'),_0xdc23('0x54')]);_0xcd03b3[_0xdc23('0x5d')]=_0x5b7fb3['id'];if(_0x357e36)_0xcd03b3[_0xdc23('0x5e')]=_0x357e36;return _0xcd03b3;})['then'](function(_0x352a65){return db[_0xdc23('0x57')][_0xdc23('0x4e')](_0x352a65,{'include':[{'model':db[_0xdc23('0x5b')],'as':_0xdc23('0x5e')}],'raw':!![],'transaction':_0x1adefd});});})[_0xdc23('0x2b')](function(){return _0x5b7fb3;});}});});});}})[_0xdc23('0x2b')](respondWithResult(_0x27f9e4,0xc9))['catch'](handleError(_0x27f9e4,null));};exports[_0xdc23('0x2a')]=function(_0x43e081,_0x4cc5c4){if(_0x43e081[_0xdc23('0x4f')]['id']){delete _0x43e081[_0xdc23('0x4f')]['id'];}return db[_0xdc23('0x46')][_0xdc23('0x4d')]({'where':{'id':_0x43e081[_0xdc23('0x4b')]['id']}})[_0xdc23('0x2b')](handleEntityNotFound(_0x4cc5c4,null))[_0xdc23('0x2b')](saveUpdates(_0x43e081[_0xdc23('0x4f')],null))[_0xdc23('0x2b')](respondWithResult(_0x4cc5c4,null))['catch'](handleError(_0x4cc5c4,null));};exports[_0xdc23('0x5f')]=function(_0x2c3ddf,_0x2fe1fc){return db[_0xdc23('0x46')][_0xdc23('0x4d')]({'where':{'id':_0x2c3ddf[_0xdc23('0x4b')]['id']}})[_0xdc23('0x2b')](handleEntityNotFound(_0x2fe1fc,null))['then'](removeEntity(_0x2fe1fc,null))[_0xdc23('0x49')](handleError(_0x2fe1fc,null));};exports[_0xdc23('0x60')]=function(_0x55435a,_0x3b5ae1){return db[_0xdc23('0x46')][_0xdc23('0x60')]()['then'](respondWithResult(_0x3b5ae1,null))['catch'](handleError(_0x3b5ae1,null));};exports[_0xdc23('0x61')]=function(_0x94091f,_0xaf561e){var _0x59765b=_0x94091f['body'];return db['UserProfile'][_0xdc23('0x4d')]({'where':{'id':_0x94091f['params']['id']}})[_0xdc23('0x2b')](handleEntityNotFound(_0xaf561e,null))['then'](function(_0x35984d){if(_0x35984d){return db['sequelize'][_0xdc23('0x62')](function(_0x3dfe60){return db[_0xdc23('0x57')][_0xdc23('0x5f')]({'where':{'userProfileId':_0x94091f[_0xdc23('0x4b')]['id'],'sectionId':_[_0xdc23('0x32')](_0x59765b,function(_0x2c5219){return _0x2c5219['sectionId'];})},'transaction':_0x3dfe60})[_0xdc23('0x2b')](function(){var _0x569a27=_[_0xdc23('0x32')](_0x59765b,function(_0x38c3df){_0x38c3df['userProfileId']=_0x94091f[_0xdc23('0x4b')]['id'];return _0x38c3df;});var _0x35a088=[];return BPromise[_0xdc23('0x59')](_0x569a27,function(_0x518b72){return db[_0xdc23('0x57')][_0xdc23('0x4e')](_0x518b72,{'include':[{'model':db[_0xdc23('0x5b')],'as':_0xdc23('0x5e')}],'raw':!![],'transaction':_0x3dfe60})[_0xdc23('0x2b')](function(_0x447852){_0x35a088['push'](_0x447852[_0xdc23('0x52')]({'plain':!![]}));});})['then'](function(){return _0x35a088;});});});}})['then'](function(_0x115645){return _0x115645;})['then'](respondWithResult(_0xaf561e,null))[_0xdc23('0x49')](handleError(_0xaf561e,null));};exports['removeSections']=function(_0x1f6290,_0x21f2b2){var _0x2f171c;return db['UserProfile'][_0xdc23('0x4d')]({'where':{'id':_0x1f6290[_0xdc23('0x4b')]['id']},'attributes':['id',_0xdc23('0x2f')]})[_0xdc23('0x2b')](handleEntityNotFound(_0x21f2b2,null))['then'](function(_0x42cd80){if(_0x42cd80){_0x2f171c=_0x42cd80;return db[_0xdc23('0x57')]['destroy']({'where':{'userProfileId':_0x1f6290[_0xdc23('0x4b')]['id'],'sectionId':_0x1f6290[_0xdc23('0x36')][_0xdc23('0x63')]}});}})[_0xdc23('0x2b')](function(){return _0x2f171c;})['then'](respondWithStatusCode(_0x21f2b2,null))[_0xdc23('0x49')](handleError(_0x21f2b2,null));};exports['getSections']=function(_0x259351,_0x2e8d1a){var _0x598f79=[];var _0x35666c=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x259351[_0xdc23('0x4b')]['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x23d471){_0x598f79=_['filter'](_0x23d471,function(_0x4d52c3){return _0x4d52c3['enabled']===0x1||_[_0xdc23('0x64')]([0x3eb,0x709],_0x4d52c3['sectionId']);});if(!_[_0xdc23('0x65')](_0x598f79)){return _[_0xdc23('0x32')](_0x598f79,function(_0x4dddc7){return _0x4dddc7[_0xdc23('0x5c')];});}else{return;}})['then'](function(_0x9c0ea7){if(_0x9c0ea7)_0x35666c=_0x9c0ea7;if(_[_0xdc23('0x64')](_0x35666c,0x64)){var _0x43fbb6=_[_0xdc23('0x4d')](_0x598f79,{'sectionId':0x64});return hasDefaultDashboard(_0x43fbb6)['then'](function(_0x42efb3){return _['map'](_0x598f79,function(_0x36f4ba){if(_0x36f4ba[_0xdc23('0x5c')]===0x64){_0x36f4ba[_0xdc23('0x66')]=_0x42efb3;}return _0x36f4ba;});});}else{return;}})[_0xdc23('0x2b')](function(_0x4b235a){if(_0x4b235a)_0x598f79=_0x4b235a;if(_[_0xdc23('0x64')](_0x35666c,0x3eb)){var _0x1f10e7=_[_0xdc23('0x4d')](_0x598f79,{'sectionId':0x3eb});return getCustomDashboards(_0x1f10e7)[_0xdc23('0x2b')](function(_0x853e90){return _[_0xdc23('0x32')](_0x598f79,function(_0x3b4397){if(_0x1f10e7[_0xdc23('0x67')]){if(_0x3b4397[_0xdc23('0x5c')]===0x3eb){_0x3b4397[_0xdc23('0x66')]=_0x853e90;}}else{if(_0x3b4397[_0xdc23('0x5c')]===0x64){_0x3b4397[_0xdc23('0x66')]=_0x853e90;}}return _0x3b4397;});});}else{return;}})[_0xdc23('0x2b')](function(_0x4cff40){if(_0x4cff40)_0x598f79=_0x4cff40;if(_[_0xdc23('0x64')](_0x35666c,0x709)){var _0x536a34=_[_0xdc23('0x4d')](_0x598f79,{'sectionId':0x709});return getPlugins(_0x536a34)[_0xdc23('0x2b')](function(_0x1c4866){if(_0x536a34[_0xdc23('0x67')]){return _[_0xdc23('0x32')](_0x598f79,function(_0xb9f0a7){if(_0xb9f0a7[_0xdc23('0x5c')]===0x709){_0xb9f0a7[_0xdc23('0x66')]=_0x1c4866;}return _0xb9f0a7;});}else{var _0xccc938={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1c4866};var _0x1e9df3=_[_0xdc23('0x32')](_0x598f79);_0x1e9df3[_0xdc23('0x68')](_0xccc938);return _0x1e9df3;}});}else{return;}})[_0xdc23('0x2b')](function(_0x43bf95){if(_0x43bf95)_0x598f79=_0x43bf95;return _[_0xdc23('0x42')](_0x598f79,[_0xdc23('0x67'),0x1]);})[_0xdc23('0x2b')](respondWithResult(_0x2e8d1a,null))[_0xdc23('0x49')](handleError(_0x2e8d1a,null));};function hasDefaultDashboard(_0x3fac1d){var _0x573a93=[0x65];return new BPromise(function(_0x5e6ca3,_0x57d785){try{if(_0x3fac1d[_0xdc23('0x5a')]){_0x5e6ca3(_0x573a93);}else{return db['UserProfileResource'][_0xdc23('0x69')]({'where':{'sectionId':_0x3fac1d['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x247dac){_0x247dac?_0x5e6ca3(_0x573a93):_0x5e6ca3();});}}catch(_0x54b2e1){_0x57d785(_0x54b2e1);}});}function getCustomDashboards(_0x1ca3da){var _0x4961c3=[];return new BPromise(function(_0x12e35e,_0x218a9c){try{if(_0x1ca3da[_0xdc23('0x5a')]){return db[_0xdc23('0x6a')]['findAll']({'raw':!![]})[_0xdc23('0x2b')](function(_0x4a45a9){_0x4a45a9[_0xdc23('0x6b')](function(_0x2349f2){_0x4961c3[_0xdc23('0x68')](_0x2349f2['id']+0x1869f);});_0x12e35e(_0x4961c3);});}else{return db[_0xdc23('0x5b')][_0xdc23('0x58')]({'where':{'sectionId':_0x1ca3da['id']},'raw':!![]})['then'](function(_0x3b796b){_0x3b796b[_0xdc23('0x6b')](function(_0x3c62b9){_0x4961c3[_0xdc23('0x68')](_0x3c62b9[_0xdc23('0x6c')]+0x1869f);});_0x12e35e(_0x4961c3);});}}catch(_0x2cd80d){_0x218a9c(_0x2cd80d);}});}function getPlugins(_0x221588){var _0x313dab=[];return new BPromise(function(_0x197fc2,_0x1fcb6e){try{if(_0x221588[_0xdc23('0x5a')]){return db['Plugin'][_0xdc23('0x58')]({'raw':!![]})['then'](function(_0x4ab16f){_0x4ab16f[_0xdc23('0x6b')](function(_0xa0a893){_0x313dab[_0xdc23('0x68')](_0xa0a893['id']+0x15b38);});_0x197fc2(_0x313dab);});}else{return db[_0xdc23('0x5b')][_0xdc23('0x58')]({'where':{'sectionId':_0x221588['id']},'raw':!![]})[_0xdc23('0x2b')](function(_0x5dcb90){_0x5dcb90[_0xdc23('0x6b')](function(_0x3941be){_0x313dab[_0xdc23('0x68')](_0x3941be[_0xdc23('0x6c')]+0x15b38);});_0x197fc2(_0x313dab);});}}catch(_0x4e3615){_0x1fcb6e(_0x4e3615);}});}exports[_0xdc23('0x6d')]=function(_0x335aba,_0x326f4e){return db[_0xdc23('0x46')]['find']({'where':{'id':_0x335aba[_0xdc23('0x4b')]['id']}})['then'](handleEntityNotFound(_0x326f4e,null))[_0xdc23('0x2b')](function(_0x3c1d68){if(_0x3c1d68){return db[_0xdc23('0x56')][_0xdc23('0x62')](function(_0x5d8f79){return db[_0xdc23('0x57')][_0xdc23('0x58')]({'where':{'userProfileId':_0x335aba[_0xdc23('0x4b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x59e71f){if(_0x59e71f){return db['UserProfileSection'][_0xdc23('0x5f')]({'where':{'userProfileId':_0x335aba[_0xdc23('0x4b')]['id'],'id':_[_0xdc23('0x32')](_0x59e71f,function(_0x832f6b){return _0x832f6b['id'];})},'transaction':_0x5d8f79});}})[_0xdc23('0x2b')](function(_0x32e27c){var _0x380cb0=_[_0xdc23('0x32')](_0x335aba[_0xdc23('0x4f')],function(_0x352df6){_0x352df6[_0xdc23('0x5d')]=_0x335aba[_0xdc23('0x4b')]['id'];return _0x352df6;});return db[_0xdc23('0x57')][_0xdc23('0x6e')](_0x380cb0,{'raw':!![],'transaction':_0x5d8f79});})[_0xdc23('0x2b')](function(_0xf84e04){var _0x3700d6=_[_0xdc23('0x42')](_[_0xdc23('0x32')](_0xf84e04,function(_0x2ed997){return _0x2ed997[_0xdc23('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x3700d6){return db[_0xdc23('0x57')][_0xdc23('0x58')]({'where':{'userProfileId':_0x335aba['params']['id'],'sectionId':_[_0xdc23('0x32')](_0x3700d6,function(_0x3d10b5){return _0x3d10b5['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xdc23('0x2b')](function(_0x4acb83){var _0x3a1bf1=_[_0xdc23('0x32')](_0x335aba[_0xdc23('0x4f')],function(_0x25226a){_0x25226a[_0xdc23('0x5d')]=_0x335aba['params']['id'];return _0x25226a;});return db[_0xdc23('0x5b')][_0xdc23('0x6e')](_0x3a1bf1,{'raw':!![],'transaction':_0x5d8f79});});}})[_0xdc23('0x49')](handleError(_0x326f4e,null));});}})[_0xdc23('0x2b')](function(_0x2c1f65){var _0x23ea54=_[_0xdc23('0x32')](_0x2c1f65,function(_0x21f453){return _0x21f453[_0xdc23('0x52')]({'plain':!![]});});})['then'](respondWithResult(_0x326f4e,null))['catch'](handleError(_0x326f4e,null));};exports[_0xdc23('0x6f')]=function(_0x3917f3,_0x11b347,_0x462038){return db[_0xdc23('0x46')][_0xdc23('0x4d')]({'where':{'id':_0x3917f3[_0xdc23('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11b347,null))[_0xdc23('0x2b')](function(_0x56f142){if(_0x56f142){return _0x56f142[_0xdc23('0x6f')](_0x3917f3[_0xdc23('0x36')][_0xdc23('0x63')]);}})[_0xdc23('0x2b')](respondWithStatusCode(_0x11b347,null))[_0xdc23('0x49')](handleError(_0x11b347,null));};exports[_0xdc23('0x70')]=function(_0x54f54f,_0x4f250c){var _0x443938={};if(!_0x54f54f['query']['section'])throw new Error(_0xdc23('0x71'));if(!_0x54f54f[_0xdc23('0x36')][_0xdc23('0x3d')](_0xdc23('0x72'))){_0x443938[_0xdc23('0x25')]=qs[_0xdc23('0x25')](_0x54f54f['query']['limit']);_0x443938[_0xdc23('0x22')]=qs[_0xdc23('0x22')](_0x54f54f[_0xdc23('0x36')]['offset']);}return db[_0xdc23('0x46')][_0xdc23('0x4d')]({'where':{'id':_0x54f54f[_0xdc23('0x4b')]['id']}})[_0xdc23('0x2b')](function(_0x5d2342){if(!_0x5d2342)throw new Error(_0xdc23('0x73')+_0x54f54f[_0xdc23('0x4b')]['id']);return db[_0xdc23('0x46')][_0xdc23('0x70')](_0x54f54f);})[_0xdc23('0x2b')](respondWithFilteredResult(_0x4f250c,_0x443938))[_0xdc23('0x49')](handleError(_0x4f250c,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 74e69ef..5016905 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 _0x7524=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7524,0xce));var _0x4752=function(_0x1d4504,_0x2982e6){_0x1d4504=_0x1d4504-0x0;var _0x3f5ba9=_0x7524[_0x1d4504];return _0x3f5ba9;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x4752('0x0'))['db'][_0x4752('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4752('0x2'),'afterUpdate':_0x4752('0x3'),'afterDestroy':'remove'};function emitEvent(_0x599e2b){return function(_0x3eae1a,_0x4d5e05,_0x3884b9){UserProfileEvents[_0x4752('0x4')](_0x599e2b+':'+_0x3eae1a['id'],_0x3eae1a);UserProfileEvents[_0x4752('0x4')](_0x599e2b,_0x3eae1a);_0x3884b9(null);};}for(var e in events){if(events[_0x4752('0x5')](e)){var event=events[e];UserProfile[_0x4752('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xdeb3=['remove','emit','hook','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x475529,_0x8fb3cd){var _0x47e30d=function(_0x38e60e){while(--_0x38e60e){_0x475529['push'](_0x475529['shift']());}};_0x47e30d(++_0x8fb3cd);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x3deb('0x0'))['db'][_0x3deb('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3deb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3deb('0x3')};function emitEvent(_0x2e9b78){return function(_0x365134,_0x3114e7,_0x23bc12){UserProfileEvents['emit'](_0x2e9b78+':'+_0x365134['id'],_0x365134);UserProfileEvents[_0x3deb('0x4')](_0x2e9b78,_0x365134);_0x23bc12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x3deb('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a8fdb1d..41be778 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 _0x11e5=['contexts','VoiceRecording','Agents','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','Pause','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','variables','plugins','Plugin','extractedreports','Reports','reportId','slice','QueryTypes','SELECT','select','ui.createdAt','ui.UserId\x20=\x20?','query','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','length','UserProfileSection','params','all','ignore','isEmpty','union','find','push','rawAttributes','keys','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','filters','where','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','rows','count','Tag','Tags','color','ThroughTags','tag','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','squel','models','filter','value','findAll','then','associatedResources','map','catch','field','model','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','contacts','CmContact','Lists','lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension'];(function(_0x4be0b7,_0x3939a0){var _0x38cd8b=function(_0x28961f){while(--_0x28961f){_0x4be0b7['push'](_0x4be0b7['shift']());}};_0x38cd8b(++_0x3939a0);}(_0x11e5,0x8b));var _0x511e=function(_0x38d5b2,_0xe77bf4){_0x38d5b2=_0x38d5b2-0x0;var _0x5b4ba8=_0x11e5[_0x38d5b2];return _0x5b4ba8;};'use strict';var _=require(_0x511e('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x511e('0x1'));var squel=require(_0x511e('0x2'));module['exports']=function(_0x2947e4){var _0x30fb24=_0x2947e4[_0x511e('0x3')];function _0x5cab33(_0x249e4d,_0x4fbd4f){return new Promise(function(_0x5923a7,_0x342539){if(!_0x4fbd4f)return _0x5923a7(null);var _0x323f8c=_0x4fbd4f[_0x511e('0x4')]?{[_0x4fbd4f['filter']['field']]:_0x4fbd4f[_0x511e('0x4')][_0x511e('0x5')]}:undefined;return _0x30fb24[_0x249e4d][_0x511e('0x6')]({'where':_0x323f8c,'raw':!![]})[_0x511e('0x7')](function(_0x4449c4){_0x4fbd4f[_0x511e('0x8')]=_[_0x511e('0x9')](_0x4449c4,'id');_0x5923a7(_0x4fbd4f);})[_0x511e('0xa')](function(_0x2f547a){_0x342539(_0x2f547a);});});}function _0x1c6def(_0x464085,_0x57f4f5){return new Promise(function(_0x7e50db,_0x5dd510){var _0x4d041f=_0x464085[_0x511e('0x4')]?{[_0x464085[_0x511e('0x4')][_0x511e('0xb')]]:_0x464085[_0x511e('0x4')][_0x511e('0x5')]}:undefined;return _0x30fb24[_0x464085[_0x511e('0xc')]]['findAll']({'where':_0x4d041f,'raw':!![]})[_0x511e('0x7')](function(_0x33fd64){_0x57f4f5['associatedResources']=_[_0x511e('0x9')](_0x33fd64,function(_0x43a329){return _0x43a329['name'];});_0x7e50db(_0x57f4f5);})[_0x511e('0xa')](function(_0x162c91){_0x5dd510(_0x162c91);});});}function _0x3b990b(_0x17fd4a,_0x5b6cd6,_0x3e0415){if(!_0x5b6cd6)return Promise[_0x511e('0xd')](null);return new Promise(function(_0x2e66b6,_0x577616){return _0x30fb24[_0x511e('0xe')]['findAll']({'where':{'sectionId':_0x5b6cd6['id']},'raw':!![]})[_0x511e('0x7')](function(_0x492c9f){if(_0x17fd4a['field']&&_0x17fd4a[_0x511e('0xb')]!=='id'){_0x5b6cd6['associatedResources']=_[_0x511e('0x9')](_0x492c9f,function(_0x325278){return _0x325278[_0x17fd4a[_0x511e('0xb')]];});}else{if(_0x3e0415===_0x511e('0xf')){_0x5b6cd6[_0x511e('0x8')]=_[_0x511e('0x9')](_0x492c9f,function(_0x3723ff){return{'id':_0x3723ff[_0x511e('0x10')],'type':_0x3723ff['type']};});}else{_0x5b6cd6[_0x511e('0x8')]=_[_0x511e('0x9')](_0x492c9f,function(_0x2ebf30){return _0x2ebf30[_0x511e('0x10')];});}}_0x2e66b6(_0x5b6cd6);})[_0x511e('0xa')](function(_0x18807b){_0x577616(_0x18807b);});});}function _0x886b6(_0x2f28fc,_0x211b90){var _0x26618d={'parentSections':[]};switch(_0x2f28fc['toLowerCase']()){case'squareprojects':_0x26618d[_0x511e('0x11')]='SquareProject';break;case _0x511e('0x12'):_0x26618d['childModel']=_0x511e('0x13');break;case _0x511e('0x14'):_0x26618d[_0x511e('0x11')]=_0x511e('0x15');_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x17'),'field':_0x511e('0x18'),'foreignKey':_0x511e('0x19')}];break;case _0x511e('0x1a'):_0x26618d[_0x511e('0x11')]='JscriptyProject';break;case _0x511e('0x1b'):_0x26618d[_0x511e('0x11')]=_0x511e('0x1c');_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0x511e('0x1e'):_0x26618d['childModel']='CmList';break;case _0x511e('0x1f'):_0x26618d[_0x511e('0x11')]=_0x511e('0x20');break;case _0x511e('0x21'):_0x26618d[_0x511e('0x11')]='CmCustomField';break;case _0x511e('0x22'):_0x26618d[_0x511e('0x11')]=_0x511e('0x23');break;case _0x511e('0x24'):_0x26618d[_0x511e('0x11')]='ChatWebsite';break;case _0x511e('0x25'):_0x26618d[_0x511e('0x11')]=_0x511e('0x26');break;case _0x511e('0x27'):_0x26618d[_0x511e('0x11')]=_0x511e('0x28');break;case _0x511e('0x29'):case _0x511e('0x2a'):case'outboundroutes':_0x26618d[_0x511e('0x11')]=_0x511e('0x2b');break;case _0x511e('0x2c'):_0x26618d[_0x511e('0x11')]='VoiceContext';break;case'voicemails':_0x26618d[_0x511e('0x11')]='VoiceMail';break;case'voicerecordings':_0x26618d[_0x511e('0x11')]=_0x511e('0x2d');_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x2e'),'field':_0x511e('0x18'),'foreignKey':'membername','model':_0x511e('0x2f'),'filter':{'field':_0x511e('0x30'),'value':[_0x511e('0x31')]}},{'name':'Telephones','field':_0x511e('0x18'),'foreignKey':_0x511e('0x32'),'model':_0x511e('0x2f'),'filter':{'field':'role','value':[_0x511e('0x33')]}},{'name':_0x511e('0x34'),'field':'name','foreignKey':_0x511e('0x35'),'model':_0x511e('0x36'),'filter':{'field':_0x511e('0x37'),'value':[_0x511e('0x38')]}},{'name':_0x511e('0x39'),'field':_0x511e('0x18'),'foreignKey':_0x511e('0x35'),'model':_0x511e('0x36'),'filter':{'field':_0x511e('0x37'),'value':[_0x511e('0x3a')]}}];break;case _0x511e('0x3b'):_0x26618d['childModel']=_0x511e('0x3c');break;case'chanspies':_0x26618d['childModel']=_0x511e('0x3d');break;case'voiceprefixes':_0x26618d['childModel']=_0x511e('0x3e');break;case _0x511e('0x3f'):_0x26618d[_0x511e('0x11')]=_0x511e('0x40');break;case _0x511e('0x41'):_0x26618d[_0x511e('0x11')]=_0x511e('0x42');break;case _0x511e('0x43'):_0x26618d[_0x511e('0x11')]=_0x511e('0x44');break;case _0x511e('0x45'):_0x26618d[_0x511e('0x11')]=_0x511e('0x46');break;case _0x511e('0x47'):_0x26618d['childModel']='OpenchannelQueue';break;case _0x511e('0x48'):_0x26618d[_0x511e('0x11')]=_0x511e('0x49');break;case _0x511e('0x4a'):_0x26618d[_0x511e('0x11')]='SmsQueue';break;case _0x511e('0x4b'):_0x26618d[_0x511e('0x11')]=_0x511e('0x4c');break;case'whatsappqueues':_0x26618d['childModel']='WhatsappQueue';break;case _0x511e('0x4d'):_0x26618d[_0x511e('0x11')]=_0x511e('0x4e');break;case'teams':_0x26618d['childModel']='Team';break;case _0x511e('0x4f'):case _0x511e('0x50'):_0x26618d[_0x511e('0x11')]=_0x511e('0x36');if(_0x211b90){_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x34')},{'name':_0x511e('0x39')}];}break;case _0x511e('0x51'):case _0x511e('0x52'):case _0x511e('0x53'):_0x26618d[_0x511e('0x11')]=_0x511e('0x2f');if(_0x211b90){_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x54'),'filter':{'field':_0x511e('0x30'),'value':[_0x511e('0x55'),_0x511e('0x56')]},'ignore':!![]},{'name':_0x511e('0x2e')},{'name':_0x511e('0x57')}];}break;case _0x511e('0x58'):_0x26618d[_0x511e('0x11')]=_0x511e('0x59');break;case _0x511e('0x5a'):_0x26618d[_0x511e('0x11')]=_0x511e('0x5b');break;case _0x511e('0x5c'):_0x26618d[_0x511e('0x11')]=_0x511e('0x5d');break;case _0x511e('0x5e'):_0x26618d[_0x511e('0x11')]=_0x511e('0x5f');break;case'deskaccounts':_0x26618d[_0x511e('0x11')]='DeskAccount';break;case _0x511e('0x60'):_0x26618d[_0x511e('0x11')]=_0x511e('0x61');break;case'vtigeraccounts':_0x26618d[_0x511e('0x11')]=_0x511e('0x2f');break;case _0x511e('0x62'):_0x26618d['childModel']=_0x511e('0x63');break;case _0x511e('0x64'):_0x26618d['childModel']=_0x511e('0x65');break;case _0x511e('0x66'):_0x26618d[_0x511e('0x11')]=_0x511e('0x67');break;case'intervals':_0x26618d[_0x511e('0x11')]='Interval';break;case _0x511e('0x68'):_0x26618d[_0x511e('0x11')]=_0x511e('0x69');break;case'scheduler':_0x26618d[_0x511e('0x11')]='Schedule';break;case _0x511e('0x6a'):_0x26618d[_0x511e('0x11')]=_0x511e('0x6b');break;case _0x511e('0x6c'):_0x26618d[_0x511e('0x11')]='Tag';break;case _0x511e('0x6d'):_0x26618d[_0x511e('0x11')]=_0x511e('0x6e');break;case _0x511e('0x6f'):_0x26618d[_0x511e('0x11')]=_0x511e('0x70');break;case _0x511e('0x71'):_0x26618d[_0x511e('0x11')]='Trunk';break;case _0x511e('0x72'):_0x26618d[_0x511e('0x11')]='Variable';break;case _0x511e('0x73'):_0x26618d[_0x511e('0x11')]=_0x511e('0x74');break;case _0x511e('0x75'):_0x26618d[_0x511e('0x11')]=_0x511e('0xf');_0x26618d['parentSections']=[{'name':_0x511e('0x76'),'field':'id','foreignKey':_0x511e('0x77')}];break;case'metrics':_0x26618d[_0x511e('0x11')]='AnalyticMetric';break;}return _0x26618d;}function _0x22d48b(_0x4773f4,_0x59075b){var _0x58f1e4=_0x4773f4['charAt'](0x0)['toUpperCase']()+_0x4773f4[_0x511e('0x78')](0x1);var _0x49ddf0={'type':_0x30fb24['Sequelize'][_0x511e('0x79')][_0x511e('0x7a')],'raw':!![]};return new Promise(function(_0x4cbf27,_0x1f1afe){var _0x5a4581=squel[_0x511e('0x7b')]()['field']('ui.'+_0x58f1e4+'InteractionId','id')[_0x511e('0xb')](_0x511e('0x7c'))['from']('user_has_'+_0x4773f4+'_interactions','ui')['where'](_0x511e('0x7d'),_0x59075b['id']);return _0x30fb24['sequelize'][_0x511e('0x7e')](_0x5a4581['toString'](),_0x49ddf0)[_0x511e('0x7')](function(_0x14c2df){_0x59075b[_0x58f1e4+_0x511e('0x7f')]=_0x14c2df;_0x4cbf27(_0x14c2df);})[_0x511e('0xa')](function(_0x479cfb){_0x1f1afe(_0x479cfb);});});}return _0x2947e4[_0x511e('0x80')](_0x511e('0x81'),attributes,{'tableName':_0x511e('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2b493f){var _0x318a31={'raw':![],'where':{}};var _0x584c81={};var _0x4eaec0={'count':0x0,'rows':[]};var _0x45a7b2=_0x2b493f[_0x511e('0x7e')][_0x511e('0x83')];var _0x537df4=_0x2b493f[_0x511e('0x7e')][_0x511e('0x84')]||![];var _0x1f962a=_0x886b6(_0x45a7b2,_0x537df4);if(!_0x1f962a[_0x511e('0x11')])throw new Error(_0x511e('0x85')+_0x45a7b2+'\x27');var _0x135ecb=[{'name':_0x45a7b2}];if(!_['isEmpty'](_0x1f962a['parentSections']))_0x135ecb=_0x1f962a['parentSections'];var _0x86f362=[];for(var _0x5525ed=0x0;_0x5525ed<_0x135ecb[_0x511e('0x86')];_0x5525ed++){_0x86f362['push'](_0x30fb24[_0x511e('0x87')]['find']({'where':{'userProfileId':_0x2b493f[_0x511e('0x88')]['id'],'name':_0x135ecb[_0x5525ed][_0x511e('0x18')]},'raw':!![]}));}return Promise[_0x511e('0x89')](_0x86f362)[_0x511e('0x7')](function(_0x9afcc4){var _0x52f3d9=_[_0x511e('0x4')](_0x9afcc4,function(_0x5d1433){return _0x5d1433?_0x5d1433:undefined;});var _0x435b2a=_[_0x511e('0x4')](_0x135ecb,[_0x511e('0x8a'),!![]]);var _0x515644=_[_0x511e('0x8b')](_0x52f3d9)&&_[_0x511e('0x8b')](_0x435b2a)?null:_[_0x511e('0x8c')](_0x435b2a,_0x52f3d9);if(!_0x515644)return null;var _0x15f360=[];for(var _0x50b93d=0x0;_0x50b93d<_0x515644['length'];_0x50b93d++){var _0x2fe9de=_[_0x511e('0x8d')](_0x135ecb,function(_0x5b1ba8){return _0x515644[_0x50b93d]?_0x5b1ba8[_0x511e('0x18')]===_0x515644[_0x50b93d]['name']:null;});if(_0x2fe9de){if(_0x515644[_0x50b93d][_0x511e('0x8a')]){_0x15f360[_0x511e('0x8e')](_0x5cab33(_0x1f962a['childModel'],_0x515644[_0x50b93d]));}else{if(!_0x515644[_0x50b93d]['autoAssociation']){_0x15f360[_0x511e('0x8e')](_0x3b990b(_0x2fe9de,_0x515644[_0x50b93d],_0x1f962a[_0x511e('0x11')]));}else{if(_0x2fe9de[_0x511e('0xc')]){_0x15f360['push'](_0x1c6def(_0x2fe9de,_0x515644[_0x50b93d]));}}}}}return Promise[_0x511e('0x89')](_0x15f360);})[_0x511e('0x7')](function(_0x28dede){var _0x3de67f=_0x28dede;var _0x13b95a=null;if(_0x3de67f){_0x13b95a=_0x3de67f[_0x511e('0x86')]===0x1?_0x3de67f[0x0]:null;}if(!_0x13b95a&&!_0x3de67f)return _0x4eaec0;var _0x3df2d1=_0x30fb24[_0x1f962a['childModel']][_0x511e('0x8f')];_0x584c81[_0x511e('0xc')]=_['keys'](_0x3df2d1);_0x584c81['query']=_[_0x511e('0x90')](_0x2b493f[_0x511e('0x7e')]);_0x584c81['filters']=_[_0x511e('0x91')](_0x584c81['model'],_0x584c81[_0x511e('0x7e')]);_0x318a31['attributes']=_['intersection'](_0x584c81[_0x511e('0xc')],qs[_0x511e('0x92')](_0x2b493f[_0x511e('0x7e')][_0x511e('0x92')]));_0x318a31[_0x511e('0x93')]=_0x318a31['attributes']['length']?_0x318a31[_0x511e('0x93')]:_0x584c81[_0x511e('0xc')];if(!_0x2b493f[_0x511e('0x7e')]['hasOwnProperty'](_0x511e('0x94'))){_0x318a31[_0x511e('0x95')]=qs['limit'](_0x2b493f['query'][_0x511e('0x95')]);_0x318a31[_0x511e('0x96')]=qs[_0x511e('0x96')](_0x2b493f[_0x511e('0x7e')][_0x511e('0x96')]);}_0x318a31[_0x511e('0x97')]=qs['sort'](_0x2b493f[_0x511e('0x7e')][_0x511e('0x98')]);_0x318a31['where']=qs['filters'](_[_0x511e('0x99')](_0x2b493f['query'],_0x584c81[_0x511e('0x9a')]));if(_0x2b493f['query']['filter']){_0x318a31[_0x511e('0x9b')]=_[_0x511e('0x9c')](_0x318a31[_0x511e('0x9b')],{'$or':_[_0x511e('0x9')](_0x3df2d1,function(_0x3b497b){if(_0x3b497b[_0x511e('0x37')][_0x511e('0x9d')]!==_0x511e('0x9e')){var _0x325df2={};_0x325df2[_0x3b497b[_0x511e('0xb')]]={'$like':'%'+_0x2b493f[_0x511e('0x7e')][_0x511e('0x4')]+'%'};return _0x325df2;}})});}var _0x3b4712=[];var _0x2f35cc=null;var _0x34325f={};if(_0x13b95a){_0x2f35cc=_[_0x511e('0x8d')](_0x135ecb,['name',_0x13b95a[_0x511e('0x18')]]);if(_0x2f35cc[_0x511e('0xb')]){_0x34325f={};if(_0x1f962a[_0x511e('0x11')]===_0x511e('0xf')){_0x34325f[_0x2f35cc[_0x511e('0x9f')]]=_[_0x511e('0x9')](_0x13b95a[_0x511e('0x8')],'id');}else{_0x34325f[_0x2f35cc[_0x511e('0x9f')]]=_0x13b95a[_0x511e('0x8')];}_0x3b4712[_0x511e('0x8e')](_0x34325f);}else{_0x318a31[_0x511e('0x9b')]['id']=_0x13b95a['associatedResources'];}}else{for(var _0x200470=0x0;_0x200470<_0x3de67f[_0x511e('0x86')];_0x200470++){_0x2f35cc=_[_0x511e('0x8d')](_0x135ecb,[_0x511e('0x18'),_0x3de67f[_0x200470]['name']]);if(_0x2f35cc[_0x511e('0xb')]){_0x34325f={};_0x34325f[_0x2f35cc[_0x511e('0x9f')]]=_0x3de67f[_0x200470][_0x511e('0x8')];_0x3b4712[_0x511e('0x8e')](_0x34325f);}else{if(!_0x318a31[_0x511e('0x9b')]['id'])_0x318a31[_0x511e('0x9b')]['id']=[];_0x3de67f[_0x200470][_0x511e('0x8')][_0x511e('0xa0')](function(_0x25e8cb){_0x318a31[_0x511e('0x9b')]['id']['push'](_0x25e8cb);});}}}if(!_[_0x511e('0x8b')](_0x3b4712)){_0x318a31[_0x511e('0x9b')]=_[_0x511e('0x9c')](_0x318a31[_0x511e('0x9b')],{'$and':{'$or':_0x3b4712}});}_0x318a31=_[_0x511e('0x9c')]({},_0x318a31,_0x2b493f[_0x511e('0xa1')]);if(_0x13b95a&&!_0x13b95a[_0x511e('0xa2')]&&_0x1f962a['childModel']==='AnalyticExtractedReport'){if(_0x2b493f[_0x511e('0x7e')][_0x511e('0xa3')]){_0x318a31[_0x511e('0xa4')]=[{'all':!![]}];}return _0x30fb24[_0x1f962a[_0x511e('0x11')]][_0x511e('0x6')](_0x318a31)[_0x511e('0x7')](function(_0x122d49){var _0x9e256b=[];_0x122d49[_0x511e('0xa0')](function(_0x1d39bb){var _0x55e8cc;switch(_0x1d39bb[_0x511e('0xa5')]){case _0x511e('0xa6'):_0x55e8cc=_[_0x511e('0x8d')](_0x13b95a[_0x511e('0x8')],function(_0x3d7e04){return _0x3d7e04['id']===_0x1d39bb['reportId']&&_0x3d7e04['type']===_0x511e('0xa7');});break;case _0x511e('0xa8'):_0x55e8cc=_[_0x511e('0x8d')](_0x13b95a[_0x511e('0x8')],function(_0x53f348){return _0x53f348['id']===_0x1d39bb[_0x511e('0x77')]&&_0x53f348[_0x511e('0x37')]==='CustomReports';});break;}if(_0x55e8cc)_0x9e256b[_0x511e('0x8e')](_0x1d39bb);});_0x4eaec0['count']=_0x9e256b[_0x511e('0x86')];_0x4eaec0[_0x511e('0xa9')]=_0x9e256b;return _0x4eaec0;});}else{return _0x30fb24[_0x1f962a[_0x511e('0x11')]][_0x511e('0xaa')]({'where':_0x318a31[_0x511e('0x9b')]})[_0x511e('0x7')](function(_0x9b2e83){_0x4eaec0[_0x511e('0xaa')]=_0x9b2e83;if(_0x2b493f[_0x511e('0x7e')][_0x511e('0xa3')]){if(_0x1f962a[_0x511e('0x11')]===_0x511e('0x1c')){_0x318a31[_0x511e('0xa4')]=[{'model':_0x30fb24[_0x511e('0xab')],'as':_0x511e('0xac'),'attributes':['id',_0x511e('0x18'),_0x511e('0xad')],'required':_0x2b493f[_0x511e('0x7e')]['tag']?!![]:![]},{'model':_0x30fb24[_0x511e('0xab')],'as':_0x511e('0xae'),'attributes':['id',_0x511e('0x18'),_0x511e('0xad')],'through':_0x2b493f[_0x511e('0x7e')]['tag']?{'attributes':[],'where':{'TagId':_0x2b493f[_0x511e('0x7e')][_0x511e('0xaf')]||undefined}}:{},'required':_0x2b493f[_0x511e('0x7e')]['tag']?!![]:![]}];}else{_0x318a31[_0x511e('0xa4')]=[{'all':!![]}];}}return _0x30fb24[_0x1f962a[_0x511e('0x11')]][_0x511e('0x6')](_0x318a31);})[_0x511e('0x7')](function(_0x513c38){_0x4eaec0['rows']=_0x513c38;if(_0x45a7b2==='Agents'&&_0x2b493f[_0x511e('0x7e')][_0x511e('0xb0')]==='true'){var _0x137568=[];for(var _0x49e3c7=0x0;_0x49e3c7<_0x4eaec0[_0x511e('0xa9')]['length'];_0x49e3c7++){_0x137568[_0x511e('0x8e')](_0x22d48b(_0x511e('0xb1'),_0x4eaec0['rows'][_0x49e3c7][_0x511e('0xb2')]));_0x137568[_0x511e('0x8e')](_0x22d48b(_0x511e('0xb3'),_0x4eaec0[_0x511e('0xa9')][_0x49e3c7][_0x511e('0xb2')]));_0x137568['push'](_0x22d48b('fax',_0x4eaec0['rows'][_0x49e3c7]['dataValues']));_0x137568['push'](_0x22d48b(_0x511e('0xb4'),_0x4eaec0[_0x511e('0xa9')][_0x49e3c7][_0x511e('0xb2')]));_0x137568['push'](_0x22d48b(_0x511e('0xb5'),_0x4eaec0[_0x511e('0xa9')][_0x49e3c7][_0x511e('0xb2')]));_0x137568[_0x511e('0x8e')](_0x22d48b(_0x511e('0xb6'),_0x4eaec0[_0x511e('0xa9')][_0x49e3c7][_0x511e('0xb2')]));}return Promise['all'](_0x137568)[_0x511e('0x7')](function(){return _0x4eaec0;});}return _0x4eaec0;});}});}}});}; \ No newline at end of file +var _0x3f8a=['extractedreports','Reports','reportId','metrics','AnalyticMetric','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','VIRTUAL','foreignKey','forEach','merge','options','includeAll','default','DefaultReports','custom','CustomReports','count','include','Tag','color','tag','ThroughTags','rows','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','User','membername','role','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','QueueCampaigns','users','agents','Users','admin','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','variables','Variable','Plugin'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x43dece,_0xd66879){_0x43dece=_0x43dece-0x0;var _0x1290ba=_0x3f8a[_0x43dece];return _0x1290ba;};'use strict';var _=require(_0xa3f8('0x0'));var attributes=require(_0xa3f8('0x1'));var qs=require(_0xa3f8('0x2'));var squel=require(_0xa3f8('0x3'));module['exports']=function(_0x467a6c){var _0x143375=_0x467a6c[_0xa3f8('0x4')];function _0x15b6aa(_0x2553fd,_0x2847b4){return new Promise(function(_0x39d2e4,_0x471464){if(!_0x2847b4)return _0x39d2e4(null);var _0x1f160a=_0x2847b4[_0xa3f8('0x5')]?{[_0x2847b4[_0xa3f8('0x5')][_0xa3f8('0x6')]]:_0x2847b4[_0xa3f8('0x5')][_0xa3f8('0x7')]}:undefined;return _0x143375[_0x2553fd][_0xa3f8('0x8')]({'where':_0x1f160a,'raw':!![]})[_0xa3f8('0x9')](function(_0xcdb0d4){_0x2847b4['associatedResources']=_[_0xa3f8('0xa')](_0xcdb0d4,'id');_0x39d2e4(_0x2847b4);})[_0xa3f8('0xb')](function(_0x3c1833){_0x471464(_0x3c1833);});});}function _0x22dcda(_0x53cf1f,_0x206b69){return new Promise(function(_0x26f0a0,_0x414bd7){var _0x24f421=_0x53cf1f[_0xa3f8('0x5')]?{[_0x53cf1f[_0xa3f8('0x5')][_0xa3f8('0x6')]]:_0x53cf1f[_0xa3f8('0x5')][_0xa3f8('0x7')]}:undefined;return _0x143375[_0x53cf1f[_0xa3f8('0xc')]][_0xa3f8('0x8')]({'where':_0x24f421,'raw':!![]})[_0xa3f8('0x9')](function(_0x5b2c33){_0x206b69[_0xa3f8('0xd')]=_[_0xa3f8('0xa')](_0x5b2c33,function(_0x45014f){return _0x45014f[_0xa3f8('0xe')];});_0x26f0a0(_0x206b69);})['catch'](function(_0x39c450){_0x414bd7(_0x39c450);});});}function _0x33b98e(_0x46a8d9,_0x8cd130,_0x45ef64){if(!_0x8cd130)return Promise[_0xa3f8('0xf')](null);return new Promise(function(_0x2f0659,_0x3e2e1c){return _0x143375[_0xa3f8('0x10')][_0xa3f8('0x8')]({'where':{'sectionId':_0x8cd130['id']},'raw':!![]})['then'](function(_0x3ad8cd){if(_0x46a8d9['field']&&_0x46a8d9[_0xa3f8('0x6')]!=='id'){_0x8cd130[_0xa3f8('0xd')]=_[_0xa3f8('0xa')](_0x3ad8cd,function(_0x46042d){return _0x46042d[_0x46a8d9['field']];});}else{if(_0x45ef64===_0xa3f8('0x11')){_0x8cd130['associatedResources']=_[_0xa3f8('0xa')](_0x3ad8cd,function(_0x58336d){return{'id':_0x58336d[_0xa3f8('0x12')],'type':_0x58336d[_0xa3f8('0x13')]};});}else{_0x8cd130[_0xa3f8('0xd')]=_[_0xa3f8('0xa')](_0x3ad8cd,function(_0x3a6a57){return _0x3a6a57[_0xa3f8('0x12')];});}}_0x2f0659(_0x8cd130);})[_0xa3f8('0xb')](function(_0x490717){_0x3e2e1c(_0x490717);});});}function _0xae76ec(_0x4d0e72,_0x3ce57b){var _0xa5a697={'parentSections':[]};switch(_0x4d0e72[_0xa3f8('0x14')]()){case _0xa3f8('0x15'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x17');break;case _0xa3f8('0x18'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x19');break;case _0xa3f8('0x1a'):_0xa5a697['childModel']=_0xa3f8('0x1b');_0xa5a697[_0xa3f8('0x1c')]=[{'name':_0xa3f8('0x1d'),'field':'name','foreignKey':_0xa3f8('0x1e')}];break;case'projects':_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x1f');break;case _0xa3f8('0x20'):_0xa5a697['childModel']=_0xa3f8('0x21');_0xa5a697['parentSections']=[{'name':_0xa3f8('0x22'),'field':'id','foreignKey':_0xa3f8('0x23')}];break;case _0xa3f8('0x24'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x25');break;case _0xa3f8('0x26'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x27');break;case _0xa3f8('0x28'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x29');break;case'chatqueues':_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x2a');break;case _0xa3f8('0x2b'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x2c');break;case'faxqueues':_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x2d');break;case'faxaccounts':_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x2e');break;case'inboundroutes':case _0xa3f8('0x2f'):case'outboundroutes':_0xa5a697['childModel']=_0xa3f8('0x30');break;case _0xa3f8('0x31'):_0xa5a697['childModel']=_0xa3f8('0x32');break;case'voicemails':_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x33');break;case _0xa3f8('0x34'):_0xa5a697[_0xa3f8('0x16')]='VoiceRecording';_0xa5a697[_0xa3f8('0x1c')]=[{'name':'Agents','field':_0xa3f8('0xe'),'foreignKey':'membername','model':_0xa3f8('0x35'),'filter':{'field':'role','value':['agent']}},{'name':'Telephones','field':_0xa3f8('0xe'),'foreignKey':_0xa3f8('0x36'),'model':_0xa3f8('0x35'),'filter':{'field':_0xa3f8('0x37'),'value':['telephone']}},{'name':_0xa3f8('0x38'),'field':_0xa3f8('0xe'),'foreignKey':_0xa3f8('0x39'),'model':_0xa3f8('0x3a'),'filter':{'field':_0xa3f8('0x13'),'value':[_0xa3f8('0x3b')]}},{'name':'QueueCampaigns','field':_0xa3f8('0xe'),'foreignKey':_0xa3f8('0x39'),'model':_0xa3f8('0x3a'),'filter':{'field':'type','value':[_0xa3f8('0x3c')]}}];break;case _0xa3f8('0x3d'):_0xa5a697['childModel']=_0xa3f8('0x3e');break;case'chanspies':_0xa5a697[_0xa3f8('0x16')]='VoiceChanSpy';break;case _0xa3f8('0x3f'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x40');break;case _0xa3f8('0x41'):_0xa5a697[_0xa3f8('0x16')]='Campaign';break;case _0xa3f8('0x42'):_0xa5a697[_0xa3f8('0x16')]='MailQueue';break;case _0xa3f8('0x43'):_0xa5a697['childModel']=_0xa3f8('0x44');break;case _0xa3f8('0x45'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x46');break;case _0xa3f8('0x47'):_0xa5a697['childModel']=_0xa3f8('0x48');break;case _0xa3f8('0x49'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x4a');break;case _0xa3f8('0x4b'):_0xa5a697['childModel']=_0xa3f8('0x4c');break;case _0xa3f8('0x4d'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x4e');break;case _0xa3f8('0x4f'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x50');break;case _0xa3f8('0x51'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x52');break;case _0xa3f8('0x53'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x54');break;case'voicequeues':case'queuecampaigns':_0xa5a697['childModel']=_0xa3f8('0x3a');if(_0x3ce57b){_0xa5a697[_0xa3f8('0x1c')]=[{'name':_0xa3f8('0x38')},{'name':_0xa3f8('0x55')}];}break;case _0xa3f8('0x56'):case _0xa3f8('0x57'):case'telephones':_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x35');if(_0x3ce57b){_0xa5a697[_0xa3f8('0x1c')]=[{'name':_0xa3f8('0x58'),'filter':{'field':'role','value':[_0xa3f8('0x59'),_0xa3f8('0x5a')]},'ignore':!![]},{'name':_0xa3f8('0x5b')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0xa5a697['childModel']=_0xa3f8('0x5c');break;case _0xa3f8('0x5d'):_0xa5a697['childModel']=_0xa3f8('0x5e');break;case _0xa3f8('0x5f'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x60');break;case _0xa3f8('0x61'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x62');break;case _0xa3f8('0x63'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x64');break;case _0xa3f8('0x65'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x66');break;case _0xa3f8('0x67'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x35');break;case _0xa3f8('0x68'):_0xa5a697['childModel']='CannedAnswer';break;case _0xa3f8('0x69'):_0xa5a697[_0xa3f8('0x16')]='Disposition';break;case _0xa3f8('0x6a'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x6b');break;case _0xa3f8('0x6c'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x6d');break;case _0xa3f8('0x6e'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x6f');break;case _0xa3f8('0x70'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x71');break;case _0xa3f8('0x72'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x73');break;case _0xa3f8('0x74'):_0xa5a697['childModel']='Tag';break;case _0xa3f8('0x75'):_0xa5a697['childModel']=_0xa3f8('0x76');break;case _0xa3f8('0x77'):_0xa5a697[_0xa3f8('0x16')]='Trigger';break;case _0xa3f8('0x78'):_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x79');break;case _0xa3f8('0x7a'):_0xa5a697['childModel']=_0xa3f8('0x7b');break;case'plugins':_0xa5a697[_0xa3f8('0x16')]=_0xa3f8('0x7c');break;case _0xa3f8('0x7d'):_0xa5a697['childModel']='AnalyticExtractedReport';_0xa5a697[_0xa3f8('0x1c')]=[{'name':_0xa3f8('0x7e'),'field':'id','foreignKey':_0xa3f8('0x7f')}];break;case _0xa3f8('0x80'):_0xa5a697['childModel']=_0xa3f8('0x81');break;}return _0xa5a697;}function _0x3478e8(_0x38dba4,_0x270ffc){var _0xc60091=_0x38dba4['charAt'](0x0)['toUpperCase']()+_0x38dba4[_0xa3f8('0x82')](0x1);var _0x102107={'type':_0x143375[_0xa3f8('0x83')][_0xa3f8('0x84')][_0xa3f8('0x85')],'raw':!![]};return new Promise(function(_0x2b0af7,_0xb17e21){var _0x5a7393=squel['select']()['field'](_0xa3f8('0x86')+_0xc60091+_0xa3f8('0x87'),'id')[_0xa3f8('0x6')](_0xa3f8('0x88'))[_0xa3f8('0x89')](_0xa3f8('0x8a')+_0x38dba4+_0xa3f8('0x8b'),'ui')[_0xa3f8('0x8c')]('ui.UserId\x20=\x20?',_0x270ffc['id']);return _0x143375[_0xa3f8('0x8d')][_0xa3f8('0x8e')](_0x5a7393[_0xa3f8('0x8f')](),_0x102107)[_0xa3f8('0x9')](function(_0x27c5aa){_0x270ffc[_0xc60091+_0xa3f8('0x90')]=_0x27c5aa;_0x2b0af7(_0x27c5aa);})[_0xa3f8('0xb')](function(_0x4d0404){_0xb17e21(_0x4d0404);});});}return _0x467a6c[_0xa3f8('0x91')](_0xa3f8('0x92'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x23614c){var _0x331629={'raw':![],'where':{}};var _0x44d566={};var _0x2bf252={'count':0x0,'rows':[]};var _0x11f5f7=_0x23614c[_0xa3f8('0x8e')][_0xa3f8('0x93')];var _0x4a2f72=_0x23614c['query'][_0xa3f8('0x94')]||![];var _0x5a61f1=_0xae76ec(_0x11f5f7,_0x4a2f72);if(!_0x5a61f1[_0xa3f8('0x16')])throw new Error(_0xa3f8('0x95')+_0x11f5f7+'\x27');var _0x3ff369=[{'name':_0x11f5f7}];if(!_[_0xa3f8('0x96')](_0x5a61f1[_0xa3f8('0x1c')]))_0x3ff369=_0x5a61f1[_0xa3f8('0x1c')];var _0xeca2dc=[];for(var _0x14508d=0x0;_0x14508d<_0x3ff369[_0xa3f8('0x97')];_0x14508d++){_0xeca2dc[_0xa3f8('0x98')](_0x143375[_0xa3f8('0x99')][_0xa3f8('0x9a')]({'where':{'userProfileId':_0x23614c[_0xa3f8('0x9b')]['id'],'name':_0x3ff369[_0x14508d]['name']},'raw':!![]}));}return Promise[_0xa3f8('0x9c')](_0xeca2dc)[_0xa3f8('0x9')](function(_0x42e827){var _0x1688ca=_[_0xa3f8('0x5')](_0x42e827,function(_0x3420ec){return _0x3420ec?_0x3420ec:undefined;});var _0x4b6169=_[_0xa3f8('0x5')](_0x3ff369,[_0xa3f8('0x9d'),!![]]);var _0x1f01c1=_[_0xa3f8('0x96')](_0x1688ca)&&_[_0xa3f8('0x96')](_0x4b6169)?null:_[_0xa3f8('0x9e')](_0x4b6169,_0x1688ca);if(!_0x1f01c1)return null;var _0x3d45ae=[];for(var _0x3a2362=0x0;_0x3a2362<_0x1f01c1[_0xa3f8('0x97')];_0x3a2362++){var _0x33fef6=_[_0xa3f8('0x9a')](_0x3ff369,function(_0x5d4fe5){return _0x1f01c1[_0x3a2362]?_0x5d4fe5[_0xa3f8('0xe')]===_0x1f01c1[_0x3a2362][_0xa3f8('0xe')]:null;});if(_0x33fef6){if(_0x1f01c1[_0x3a2362]['ignore']){_0x3d45ae['push'](_0x15b6aa(_0x5a61f1[_0xa3f8('0x16')],_0x1f01c1[_0x3a2362]));}else{if(!_0x1f01c1[_0x3a2362][_0xa3f8('0x9f')]){_0x3d45ae[_0xa3f8('0x98')](_0x33b98e(_0x33fef6,_0x1f01c1[_0x3a2362],_0x5a61f1[_0xa3f8('0x16')]));}else{if(_0x33fef6[_0xa3f8('0xc')]){_0x3d45ae[_0xa3f8('0x98')](_0x22dcda(_0x33fef6,_0x1f01c1[_0x3a2362]));}}}}}return Promise[_0xa3f8('0x9c')](_0x3d45ae);})[_0xa3f8('0x9')](function(_0x4f5f62){var _0xf76898=_0x4f5f62;var _0x3c30d0=null;if(_0xf76898){_0x3c30d0=_0xf76898[_0xa3f8('0x97')]===0x1?_0xf76898[0x0]:null;}if(!_0x3c30d0&&!_0xf76898)return _0x2bf252;var _0x52f3ae=_0x143375[_0x5a61f1[_0xa3f8('0x16')]][_0xa3f8('0xa0')];_0x44d566['model']=_[_0xa3f8('0xa1')](_0x52f3ae);_0x44d566[_0xa3f8('0x8e')]=_[_0xa3f8('0xa1')](_0x23614c[_0xa3f8('0x8e')]);_0x44d566[_0xa3f8('0xa2')]=_[_0xa3f8('0xa3')](_0x44d566[_0xa3f8('0xc')],_0x44d566[_0xa3f8('0x8e')]);_0x331629[_0xa3f8('0xa4')]=_['intersection'](_0x44d566[_0xa3f8('0xc')],qs['fields'](_0x23614c[_0xa3f8('0x8e')]['fields']));_0x331629[_0xa3f8('0xa4')]=_0x331629[_0xa3f8('0xa4')][_0xa3f8('0x97')]?_0x331629[_0xa3f8('0xa4')]:_0x44d566[_0xa3f8('0xc')];if(!_0x23614c['query'][_0xa3f8('0xa5')](_0xa3f8('0xa6'))){_0x331629['limit']=qs[_0xa3f8('0xa7')](_0x23614c[_0xa3f8('0x8e')][_0xa3f8('0xa7')]);_0x331629[_0xa3f8('0xa8')]=qs[_0xa3f8('0xa8')](_0x23614c[_0xa3f8('0x8e')]['offset']);}_0x331629[_0xa3f8('0xa9')]=qs[_0xa3f8('0xaa')](_0x23614c[_0xa3f8('0x8e')]['sort']);_0x331629[_0xa3f8('0x8c')]=qs['filters'](_[_0xa3f8('0xab')](_0x23614c['query'],_0x44d566['filters']));if(_0x23614c[_0xa3f8('0x8e')]['filter']){_0x331629[_0xa3f8('0x8c')]=_['merge'](_0x331629[_0xa3f8('0x8c')],{'$or':_[_0xa3f8('0xa')](_0x52f3ae,function(_0x279131){if(_0x279131[_0xa3f8('0x13')]['key']!==_0xa3f8('0xac')){var _0x35db48={};_0x35db48[_0x279131['field']]={'$like':'%'+_0x23614c[_0xa3f8('0x8e')][_0xa3f8('0x5')]+'%'};return _0x35db48;}})});}var _0x3715ea=[];var _0x345089=null;var _0x25d8c1={};if(_0x3c30d0){_0x345089=_[_0xa3f8('0x9a')](_0x3ff369,[_0xa3f8('0xe'),_0x3c30d0[_0xa3f8('0xe')]]);if(_0x345089[_0xa3f8('0x6')]){_0x25d8c1={};if(_0x5a61f1[_0xa3f8('0x16')]==='AnalyticExtractedReport'){_0x25d8c1[_0x345089[_0xa3f8('0xad')]]=_[_0xa3f8('0xa')](_0x3c30d0[_0xa3f8('0xd')],'id');}else{_0x25d8c1[_0x345089[_0xa3f8('0xad')]]=_0x3c30d0[_0xa3f8('0xd')];}_0x3715ea[_0xa3f8('0x98')](_0x25d8c1);}else{_0x331629[_0xa3f8('0x8c')]['id']=_0x3c30d0[_0xa3f8('0xd')];}}else{for(var _0x32f937=0x0;_0x32f937<_0xf76898['length'];_0x32f937++){_0x345089=_[_0xa3f8('0x9a')](_0x3ff369,[_0xa3f8('0xe'),_0xf76898[_0x32f937][_0xa3f8('0xe')]]);if(_0x345089[_0xa3f8('0x6')]){_0x25d8c1={};_0x25d8c1[_0x345089[_0xa3f8('0xad')]]=_0xf76898[_0x32f937][_0xa3f8('0xd')];_0x3715ea['push'](_0x25d8c1);}else{if(!_0x331629[_0xa3f8('0x8c')]['id'])_0x331629[_0xa3f8('0x8c')]['id']=[];_0xf76898[_0x32f937][_0xa3f8('0xd')][_0xa3f8('0xae')](function(_0x4c47e6){_0x331629[_0xa3f8('0x8c')]['id'][_0xa3f8('0x98')](_0x4c47e6);});}}}if(!_[_0xa3f8('0x96')](_0x3715ea)){_0x331629[_0xa3f8('0x8c')]=_[_0xa3f8('0xaf')](_0x331629[_0xa3f8('0x8c')],{'$and':{'$or':_0x3715ea}});}_0x331629=_[_0xa3f8('0xaf')]({},_0x331629,_0x23614c[_0xa3f8('0xb0')]);if(_0x3c30d0&&!_0x3c30d0[_0xa3f8('0x9f')]&&_0x5a61f1[_0xa3f8('0x16')]===_0xa3f8('0x11')){if(_0x23614c['query'][_0xa3f8('0xb1')]){_0x331629['include']=[{'all':!![]}];}return _0x143375[_0x5a61f1[_0xa3f8('0x16')]][_0xa3f8('0x8')](_0x331629)[_0xa3f8('0x9')](function(_0x6a1e95){var _0x5b0ed5=[];_0x6a1e95[_0xa3f8('0xae')](function(_0x3d9702){var _0x365688;switch(_0x3d9702['reportType']){case _0xa3f8('0xb2'):_0x365688=_['find'](_0x3c30d0[_0xa3f8('0xd')],function(_0x52fcc3){return _0x52fcc3['id']===_0x3d9702[_0xa3f8('0x7f')]&&_0x52fcc3['type']===_0xa3f8('0xb3');});break;case _0xa3f8('0xb4'):_0x365688=_[_0xa3f8('0x9a')](_0x3c30d0[_0xa3f8('0xd')],function(_0x4f333f){return _0x4f333f['id']===_0x3d9702[_0xa3f8('0x7f')]&&_0x4f333f[_0xa3f8('0x13')]===_0xa3f8('0xb5');});break;}if(_0x365688)_0x5b0ed5[_0xa3f8('0x98')](_0x3d9702);});_0x2bf252[_0xa3f8('0xb6')]=_0x5b0ed5[_0xa3f8('0x97')];_0x2bf252['rows']=_0x5b0ed5;return _0x2bf252;});}else{return _0x143375[_0x5a61f1[_0xa3f8('0x16')]][_0xa3f8('0xb6')]({'where':_0x331629[_0xa3f8('0x8c')]})[_0xa3f8('0x9')](function(_0x477b0a){_0x2bf252['count']=_0x477b0a;if(_0x23614c[_0xa3f8('0x8e')][_0xa3f8('0xb1')]){if(_0x5a61f1['childModel']===_0xa3f8('0x21')){_0x331629[_0xa3f8('0xb7')]=[{'model':_0x143375[_0xa3f8('0xb8')],'as':'Tags','attributes':['id',_0xa3f8('0xe'),_0xa3f8('0xb9')],'required':_0x23614c[_0xa3f8('0x8e')][_0xa3f8('0xba')]?!![]:![]},{'model':_0x143375[_0xa3f8('0xb8')],'as':_0xa3f8('0xbb'),'attributes':['id',_0xa3f8('0xe'),'color'],'through':_0x23614c[_0xa3f8('0x8e')][_0xa3f8('0xba')]?{'attributes':[],'where':{'TagId':_0x23614c['query'][_0xa3f8('0xba')]||undefined}}:{},'required':_0x23614c[_0xa3f8('0x8e')][_0xa3f8('0xba')]?!![]:![]}];}else{_0x331629[_0xa3f8('0xb7')]=[{'all':!![]}];}}return _0x143375[_0x5a61f1[_0xa3f8('0x16')]][_0xa3f8('0x8')](_0x331629);})[_0xa3f8('0x9')](function(_0x525a21){_0x2bf252[_0xa3f8('0xbc')]=_0x525a21;if(_0x11f5f7===_0xa3f8('0x5b')&&_0x23614c[_0xa3f8('0x8e')][_0xa3f8('0xbd')]===_0xa3f8('0xbe')){var _0x1673ac=[];for(var _0xb1dca4=0x0;_0xb1dca4<_0x2bf252['rows'][_0xa3f8('0x97')];_0xb1dca4++){_0x1673ac[_0xa3f8('0x98')](_0x3478e8(_0xa3f8('0xbf'),_0x2bf252[_0xa3f8('0xbc')][_0xb1dca4]['dataValues']));_0x1673ac['push'](_0x3478e8(_0xa3f8('0xc0'),_0x2bf252['rows'][_0xb1dca4][_0xa3f8('0xc1')]));_0x1673ac[_0xa3f8('0x98')](_0x3478e8(_0xa3f8('0xc2'),_0x2bf252['rows'][_0xb1dca4]['dataValues']));_0x1673ac[_0xa3f8('0x98')](_0x3478e8(_0xa3f8('0xc3'),_0x2bf252[_0xa3f8('0xbc')][_0xb1dca4][_0xa3f8('0xc1')]));_0x1673ac['push'](_0x3478e8(_0xa3f8('0xc4'),_0x2bf252['rows'][_0xb1dca4][_0xa3f8('0xc1')]));_0x1673ac[_0xa3f8('0x98')](_0x3478e8(_0xa3f8('0xc5'),_0x2bf252['rows'][_0xb1dca4]['dataValues']));}return Promise['all'](_0x1673ac)[_0xa3f8('0x9')](function(){return _0x2bf252;});}return _0x2bf252;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index c3a9f43..635f515 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 _0x5bc1=['register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x58ac34,_0x5b5bfb){var _0x3921ab=function(_0x172dd5){while(--_0x172dd5){_0x58ac34['push'](_0x58ac34['shift']());}};_0x3921ab(++_0x5b5bfb);}(_0x5bc1,0xb5));var _0x15bc=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0x5bc1[_0xf4129c];return _0x426611;};'use strict';var _=require('lodash');var util=require(_0x15bc('0x0'));var moment=require(_0x15bc('0x1'));var BPromise=require(_0x15bc('0x2'));var rs=require(_0x15bc('0x3'));var fs=require('fs');var Redis=require(_0x15bc('0x4'));var db=require(_0x15bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x15bc('0x6'));var config=require(_0x15bc('0x7'));var jayson=require(_0x15bc('0x8'));var client=jayson['client'][_0x15bc('0x9')]({'port':0x232a});config['redis']=_[_0x15bc('0xa')](config[_0x15bc('0xb')],{'host':_0x15bc('0xc'),'port':0x18eb});var socket=require(_0x15bc('0xd'))(new Redis(config[_0x15bc('0xb')]));require(_0x15bc('0xe'))[_0x15bc('0xf')](socket);function respondWithRpcPromise(_0x735271,_0x140fe5,_0x37302c){return new BPromise(function(_0x4c0eca,_0x18b502){return client[_0x15bc('0x10')](_0x735271,_0x37302c)[_0x15bc('0x11')](function(_0x4c24a7){logger[_0x15bc('0x12')](_0x15bc('0x13'),_0x140fe5,_0x15bc('0x14'));logger[_0x15bc('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x140fe5,_0x15bc('0x14'),JSON[_0x15bc('0x16')](_0x4c24a7));if(_0x4c24a7[_0x15bc('0x17')]){if(_0x4c24a7[_0x15bc('0x17')][_0x15bc('0x18')]===0x1f4){logger[_0x15bc('0x17')](_0x15bc('0x13'),_0x140fe5,_0x4c24a7[_0x15bc('0x17')][_0x15bc('0x19')]);return _0x18b502(_0x4c24a7[_0x15bc('0x17')][_0x15bc('0x19')]);}logger[_0x15bc('0x17')](_0x15bc('0x13'),_0x140fe5,_0x4c24a7[_0x15bc('0x17')]['message']);return _0x4c0eca(_0x4c24a7[_0x15bc('0x17')][_0x15bc('0x19')]);}else{logger[_0x15bc('0x12')](_0x15bc('0x13'),_0x140fe5,_0x15bc('0x14'));_0x4c0eca(_0x4c24a7[_0x15bc('0x1a')][_0x15bc('0x19')]);}})[_0x15bc('0x1b')](function(_0x2cab32){logger[_0x15bc('0x17')](_0x15bc('0x13'),_0x140fe5,_0x2cab32);_0x18b502(_0x2cab32);});});} \ No newline at end of file +var _0x2a07=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x1bd2a6,_0x45f0fc){var _0x525206=function(_0x3ae097){while(--_0x3ae097){_0x1bd2a6['push'](_0x1bd2a6['shift']());}};_0x525206(++_0x45f0fc);}(_0x2a07,0x74));var _0x72a0=function(_0xe12735,_0x1c7687){_0xe12735=_0xe12735-0x0;var _0xe06435=_0x2a07[_0xe12735];return _0xe06435;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});config[_0x72a0('0xd')]=_[_0x72a0('0xe')](config[_0x72a0('0xd')],{'host':_0x72a0('0xf'),'port':0x18eb});var socket=require(_0x72a0('0x10'))(new Redis(config[_0x72a0('0xd')]));require(_0x72a0('0x11'))[_0x72a0('0x12')](socket);function respondWithRpcPromise(_0x5c1d1e,_0x169dc2,_0x1109f7){return new BPromise(function(_0x54abf6,_0x46fb8a){return client[_0x72a0('0x13')](_0x5c1d1e,_0x1109f7)[_0x72a0('0x14')](function(_0x44d7cf){logger[_0x72a0('0x15')]('UserProfile,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));logger[_0x72a0('0x17')](_0x72a0('0x18'),_0x169dc2,_0x72a0('0x16'),JSON[_0x72a0('0x19')](_0x44d7cf));if(_0x44d7cf[_0x72a0('0x1a')]){if(_0x44d7cf[_0x72a0('0x1a')]['code']===0x1f4){logger['error'](_0x72a0('0x1b'),_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x46fb8a(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}logger[_0x72a0('0x1a')]('UserProfile,\x20%s,\x20%s',_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x54abf6(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}else{logger[_0x72a0('0x15')]('UserProfile,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));_0x54abf6(_0x44d7cf[_0x72a0('0x1d')][_0x72a0('0x1c')]);}})['catch'](function(_0x144bfc){logger[_0x72a0('0x1a')](_0x72a0('0x1b'),_0x169dc2,_0x144bfc);_0x46fb8a(_0x144bfc);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e7902d2..db00f83 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 _0xd2da=['update','emit','register','length','userProfile:','./userProfile.events','save','remove'];(function(_0x573051,_0x5e5fb7){var _0x29f583=function(_0x4afb64){while(--_0x4afb64){_0x573051['push'](_0x573051['shift']());}};_0x29f583(++_0x5e5fb7);}(_0xd2da,0x15d));var _0xad2d=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xd2da[_0x28669c];return _0x4a3af6;};'use strict';var UserProfileEvents=require(_0xad2d('0x0'));var events=[_0xad2d('0x1'),_0xad2d('0x2'),_0xad2d('0x3')];function createListener(_0x597de0,_0x12bf3a){return function(_0x561c8b){_0x12bf3a[_0xad2d('0x4')](_0x597de0,_0x561c8b);};}function removeListener(_0xe9f205,_0xad77f1){return function(){UserProfileEvents['removeListener'](_0xe9f205,_0xad77f1);};}exports[_0xad2d('0x5')]=function(_0x16323d){for(var _0x205211=0x0,_0x10b492=events[_0xad2d('0x6')];_0x205211<_0x10b492;_0x205211++){var _0x156c96=events[_0x205211];var _0x2f747f=createListener(_0xad2d('0x7')+_0x156c96,_0x16323d);UserProfileEvents['on'](_0x156c96,_0x2f747f);}}; \ No newline at end of file +var _0x7c64=['register','userProfile:','./userProfile.events','emit','removeListener'];(function(_0x476a7e,_0x237ca5){var _0x1335d6=function(_0x455c9c){while(--_0x455c9c){_0x476a7e['push'](_0x476a7e['shift']());}};_0x1335d6(++_0x237ca5);}(_0x7c64,0xbb));var _0x47c6=function(_0x293213,_0x58c3b9){_0x293213=_0x293213-0x0;var _0x53a910=_0x7c64[_0x293213];return _0x53a910;};'use strict';var UserProfileEvents=require(_0x47c6('0x0'));var events=['save','remove','update'];function createListener(_0x2203cd,_0x5e2c2e){return function(_0x456547){_0x5e2c2e[_0x47c6('0x1')](_0x2203cd,_0x456547);};}function removeListener(_0xd26a96,_0xa3c46f){return function(){UserProfileEvents[_0x47c6('0x2')](_0xd26a96,_0xa3c46f);};}exports[_0x47c6('0x3')]=function(_0xc5dca4){for(var _0x1d8772=0x0,_0x505fd3=events['length'];_0x1d8772<_0x505fd3;_0x1d8772++){var _0x2b28f5=events[_0x1d8772];var _0x3357a3=createListener(_0x47c6('0x4')+_0x2b28f5,_0xc5dca4);UserProfileEvents['on'](_0x2b28f5,_0x3357a3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 89cd34f..164c302 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 _0x8404=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','destroy','multer'];(function(_0x10cb21,_0x4e0060){var _0xf8837f=function(_0x46bb79){while(--_0x46bb79){_0x10cb21['push'](_0x10cb21['shift']());}};_0xf8837f(++_0x4e0060);}(_0x8404,0x17b));var _0x4840=function(_0x30a6af,_0x45d571){_0x30a6af=_0x30a6af-0x0;var _0x5d6d36=_0x8404[_0x30a6af];return _0x5d6d36;};'use strict';var multer=require(_0x4840('0x0'));var util=require(_0x4840('0x1'));var path=require(_0x4840('0x2'));var timeout=require(_0x4840('0x3'));var express=require(_0x4840('0x4'));var router=express[_0x4840('0x5')]();var fs_extra=require(_0x4840('0x6'));var auth=require(_0x4840('0x7'));var interaction=require(_0x4840('0x8'));var config=require(_0x4840('0x9'));var controller=require(_0x4840('0xa'));router[_0x4840('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4840('0xb')](_0x4840('0xc'),auth[_0x4840('0xd')](),controller[_0x4840('0xe')]);router[_0x4840('0xb')](_0x4840('0xf'),auth[_0x4840('0xd')](),controller[_0x4840('0x10')]);router[_0x4840('0x11')]('/',auth[_0x4840('0xd')](),controller['create']);router[_0x4840('0x12')](_0x4840('0xf'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4840('0xd')](),controller[_0x4840('0x13')]);module['exports']=router; \ No newline at end of file +var _0x51d9=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x49e4c5,_0x1bdc1e){var _0x2a4ceb=function(_0x1091cd){while(--_0x1091cd){_0x49e4c5['push'](_0x49e4c5['shift']());}};_0x2a4ceb(++_0x1bdc1e);}(_0x51d9,0x11c));var _0x951d=function(_0x2ae80a,_0x5deb6e){_0x2ae80a=_0x2ae80a-0x0;var _0x1fb292=_0x51d9[_0x2ae80a];return _0x1fb292;};'use strict';var multer=require('multer');var util=require(_0x951d('0x0'));var path=require(_0x951d('0x1'));var timeout=require(_0x951d('0x2'));var express=require(_0x951d('0x3'));var router=express[_0x951d('0x4')]();var fs_extra=require(_0x951d('0x5'));var auth=require(_0x951d('0x6'));var interaction=require(_0x951d('0x7'));var config=require(_0x951d('0x8'));var controller=require(_0x951d('0x9'));router[_0x951d('0xa')]('/',auth[_0x951d('0xb')](),controller[_0x951d('0xc')]);router[_0x951d('0xa')](_0x951d('0xd'),auth[_0x951d('0xb')](),controller[_0x951d('0xe')]);router[_0x951d('0xa')](_0x951d('0xf'),auth[_0x951d('0xb')](),controller[_0x951d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x951d('0x11')]);router[_0x951d('0x12')]('/:id',auth[_0x951d('0xb')](),controller[_0x951d('0x13')]);router[_0x951d('0x14')](_0x951d('0xf'),auth[_0x951d('0xb')](),controller[_0x951d('0x15')]);module[_0x951d('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1910de1..d2307b0 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 _0x6d69=['STRING','sequelize','exports'];(function(_0x3ce408,_0x5c8428){var _0x31fe4c=function(_0x1bd9d0){while(--_0x1bd9d0){_0x3ce408['push'](_0x3ce408['shift']());}};_0x31fe4c(++_0x5c8428);}(_0x6d69,0x1c6));var _0x96d6=function(_0x496745,_0x369756){_0x496745=_0x496745-0x0;var _0x393a03=_0x6d69[_0x496745];return _0x393a03;};'use strict';var Sequelize=require(_0x96d6('0x0'));module[_0x96d6('0x1')]={'name':{'type':Sequelize[_0x96d6('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x96d6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2b67=['STRING','sequelize','exports','INTEGER'];(function(_0x391067,_0x5f0232){var _0x286420=function(_0x4642ef){while(--_0x4642ef){_0x391067['push'](_0x391067['shift']());}};_0x286420(++_0x5f0232);}(_0x2b67,0x10d));var _0x72b6=function(_0x59cf41,_0x5e463b){_0x59cf41=_0x59cf41-0x0;var _0x1d22d0=_0x2b67[_0x59cf41];return _0x1d22d0;};'use strict';var Sequelize=require(_0x72b6('0x0'));module[_0x72b6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x72b6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x72b6('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1e4756c..26a47c6 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 _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','UserProfileResource','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1623,0xab));var _0x3162=function(_0x18e759,_0x39a9ca){_0x18e759=_0x18e759-0x0;var _0xf243b6=_0x1623[_0x18e759];return _0xf243b6;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['UserProfileResource'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['UserProfileResource'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file +var _0x4c60=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','UserProfileResource','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x38de16,_0x2acea8){var _0x594a90=function(_0x2b80c0){while(--_0x2b80c0){_0x38de16['push'](_0x38de16['shift']());}};_0x594a90(++_0x2acea8);}(_0x4c60,0xc1));var _0x04c6=function(_0x4c056f,_0x2fc5ac){_0x4c056f=_0x4c056f-0x0;var _0x9b399f=_0x4c60[_0x4c056f];return _0x9b399f;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['UserProfileResource'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['UserProfileResource'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['UserProfileResource'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['UserProfileResource'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));};exports[_0x04c6('0x46')]=function(_0x1b8fa4,_0x160f91){return db[_0x04c6('0x27')][_0x04c6('0x46')]()[_0x04c6('0x1f')](respondWithResult(_0x160f91,null))[_0x04c6('0x3e')](handleError(_0x160f91,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1dfee3b..6965eaa 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 _0x954c=['path','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','compositeIndex','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x954c,0x132));var _0xc954=function(_0x45828d,_0x50aa1e){_0x45828d=_0x45828d-0x0;var _0x323bb4=_0x954c[_0x45828d];return _0x323bb4;};'use strict';var _=require(_0xc954('0x0'));var util=require(_0xc954('0x1'));var logger=require(_0xc954('0x2'))(_0xc954('0x3'));var moment=require('moment');var BPromise=require(_0xc954('0x4'));var rp=require(_0xc954('0x5'));var fs=require('fs');var path=require(_0xc954('0x6'));var rimraf=require('rimraf');var config=require(_0xc954('0x7'));var attributes=require(_0xc954('0x8'));module[_0xc954('0x9')]=function(_0x3cf6a5,_0x308404){return _0x3cf6a5['define'](_0xc954('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xc954('0xb'),'fields':['resourceId',_0xc954('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3780=['define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x43fff7,_0x191f03){var _0x129e97=function(_0x340bab){while(--_0x340bab){_0x43fff7['push'](_0x43fff7['shift']());}};_0x129e97(++_0x191f03);}(_0x3780,0x1b8));var _0x0378=function(_0x49d511,_0x38e1a5){_0x49d511=_0x49d511-0x0;var _0x36001b=_0x3780[_0x49d511];return _0x36001b;};'use strict';var _=require(_0x0378('0x0'));var util=require(_0x0378('0x1'));var logger=require(_0x0378('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0378('0x3'));var rp=require(_0x0378('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0378('0x5'));var attributes=require(_0x0378('0x6'));module[_0x0378('0x7')]=function(_0x204d9c,_0x29afa6){return _0x204d9c[_0x0378('0x8')](_0x0378('0x9'),attributes,{'tableName':_0x0378('0xa'),'paranoid':![],'indexes':[{'name':_0x0378('0xb'),'fields':[_0x0378('0xc'),_0x0378('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c349ffa..44eeddc 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 _0x7e5f=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x7e5f,0x80));var _0xf7e5=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x7e5f[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0xf7e5('0x0'));var util=require(_0xf7e5('0x1'));var moment=require('moment');var BPromise=require(_0xf7e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf7e5('0x3'));var logger=require(_0xf7e5('0x4'))(_0xf7e5('0x5'));var config=require(_0xf7e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf7e5('0x7')][_0xf7e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x561911,_0x178b07,_0x3609b0){return new BPromise(function(_0x3a597e,_0x90e42f){return client['request'](_0x561911,_0x3609b0)['then'](function(_0x7dd28e){logger[_0xf7e5('0x9')](_0xf7e5('0xa'),_0x178b07,_0xf7e5('0xb'));logger[_0xf7e5('0xc')](_0xf7e5('0xd'),_0x178b07,_0xf7e5('0xb'),JSON[_0xf7e5('0xe')](_0x7dd28e));if(_0x7dd28e['error']){if(_0x7dd28e['error'][_0xf7e5('0xf')]===0x1f4){logger[_0xf7e5('0x10')](_0xf7e5('0xa'),_0x178b07,_0x7dd28e[_0xf7e5('0x10')][_0xf7e5('0x11')]);return _0x90e42f(_0x7dd28e['error']['message']);}logger['error'](_0xf7e5('0xa'),_0x178b07,_0x7dd28e['error'][_0xf7e5('0x11')]);return _0x3a597e(_0x7dd28e['error'][_0xf7e5('0x11')]);}else{logger[_0xf7e5('0x9')](_0xf7e5('0xa'),_0x178b07,_0xf7e5('0xb'));_0x3a597e(_0x7dd28e[_0xf7e5('0x12')][_0xf7e5('0x11')]);}})[_0xf7e5('0x13')](function(_0xfa91fc){logger[_0xf7e5('0x10')](_0xf7e5('0xa'),_0x178b07,_0xfa91fc);_0x90e42f(_0xfa91fc);});});} \ No newline at end of file +var _0x0589=['client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x0589,0xe9));var _0x9058=function(_0x1f1d29,_0x1ac639){_0x1f1d29=_0x1f1d29-0x0;var _0x172ec7=_0x0589[_0x1f1d29];return _0x172ec7;};'use strict';var _=require(_0x9058('0x0'));var util=require(_0x9058('0x1'));var moment=require('moment');var BPromise=require(_0x9058('0x2'));var rs=require(_0x9058('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9058('0x4'))('rpc');var config=require(_0x9058('0x5'));var jayson=require(_0x9058('0x6'));var client=jayson[_0x9058('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302eaa,_0x3fe960,_0xac20ed){return new BPromise(function(_0xa80de,_0x70aa86){return client[_0x9058('0x8')](_0x302eaa,_0xac20ed)[_0x9058('0x9')](function(_0x2c4acf){logger[_0x9058('0xa')](_0x9058('0xb'),_0x3fe960,_0x9058('0xc'));logger[_0x9058('0xd')](_0x9058('0xe'),_0x3fe960,'request\x20sent',JSON[_0x9058('0xf')](_0x2c4acf));if(_0x2c4acf[_0x9058('0x10')]){if(_0x2c4acf[_0x9058('0x10')]['code']===0x1f4){logger[_0x9058('0x10')](_0x9058('0xb'),_0x3fe960,_0x2c4acf[_0x9058('0x10')][_0x9058('0x11')]);return _0x70aa86(_0x2c4acf[_0x9058('0x10')]['message']);}logger[_0x9058('0x10')](_0x9058('0xb'),_0x3fe960,_0x2c4acf[_0x9058('0x10')][_0x9058('0x11')]);return _0xa80de(_0x2c4acf[_0x9058('0x10')]['message']);}else{logger[_0x9058('0xa')](_0x9058('0xb'),_0x3fe960,_0x9058('0xc'));_0xa80de(_0x2c4acf[_0x9058('0x12')][_0x9058('0x11')]);}})[_0x9058('0x13')](function(_0x243489){logger[_0x9058('0x10')](_0x9058('0xb'),_0x3fe960,_0x243489);_0x70aa86(_0x243489);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index bd162ef..b41ad94 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 _0xa323=['Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x492938,_0x259656){var _0x216b83=function(_0x1aa306){while(--_0x1aa306){_0x492938['push'](_0x492938['shift']());}};_0x216b83(++_0x259656);}(_0xa323,0x178));var _0x3a32=function(_0x26c311,_0x26a54c){_0x26c311=_0x26c311-0x0;var _0x75f1b7=_0xa323[_0x26c311];return _0x75f1b7;};'use strict';var multer=require('multer');var util=require(_0x3a32('0x0'));var path=require(_0x3a32('0x1'));var timeout=require(_0x3a32('0x2'));var express=require(_0x3a32('0x3'));var router=express[_0x3a32('0x4')]();var fs_extra=require(_0x3a32('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3a32('0x6'));var config=require(_0x3a32('0x7'));var controller=require(_0x3a32('0x8'));router[_0x3a32('0x9')]('/',auth[_0x3a32('0xa')](),controller['index']);router[_0x3a32('0x9')](_0x3a32('0xb'),auth[_0x3a32('0xa')](),controller[_0x3a32('0xc')]);router[_0x3a32('0x9')](_0x3a32('0xd'),auth[_0x3a32('0xa')](),controller['show']);router[_0x3a32('0xe')]('/',auth[_0x3a32('0xa')](),controller[_0x3a32('0xf')]);router[_0x3a32('0x10')](_0x3a32('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3a32('0x11')](_0x3a32('0xd'),auth[_0x3a32('0xa')](),controller[_0x3a32('0x12')]);module[_0x3a32('0x13')]=router; \ No newline at end of file +var _0x0d78=['index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x0d78,0x1ae));var _0x80d7=function(_0x279702,_0x12e9b5){_0x279702=_0x279702-0x0;var _0x34f62e=_0x0d78[_0x279702];return _0x34f62e;};'use strict';var multer=require(_0x80d7('0x0'));var util=require(_0x80d7('0x1'));var path=require(_0x80d7('0x2'));var timeout=require(_0x80d7('0x3'));var express=require(_0x80d7('0x4'));var router=express['Router']();var fs_extra=require(_0x80d7('0x5'));var auth=require(_0x80d7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x80d7('0x7'));var controller=require(_0x80d7('0x8'));router[_0x80d7('0x9')]('/',auth[_0x80d7('0xa')](),controller[_0x80d7('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x80d7('0xc')]);router[_0x80d7('0x9')](_0x80d7('0xd'),auth['isAuthenticated'](),controller[_0x80d7('0xe')]);router[_0x80d7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x80d7('0x10')](_0x80d7('0xd'),auth[_0x80d7('0xa')](),controller[_0x80d7('0x11')]);router[_0x80d7('0x12')](_0x80d7('0xd'),auth[_0x80d7('0xa')](),controller[_0x80d7('0x13')]);module[_0x80d7('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 9748ba0..cc3e433 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 _0xe2cf=['crudPermissions','join','getDataValue','exports','STRING','BOOLEAN'];(function(_0x35cb18,_0x278908){var _0x33183c=function(_0x32d5c8){while(--_0x32d5c8){_0x35cb18['push'](_0x35cb18['shift']());}};_0x33183c(++_0x278908);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x46d326,_0x358e38){_0x46d326=_0x46d326-0x0;var _0x5d50fa=_0xe2cf[_0x46d326];return _0x5d50fa;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xfe2c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xfe2c('0x1')],'set':function(_0x11b6b8){this['setDataValue'](_0xfe2c('0x3'),_0x11b6b8?_0x11b6b8[_0xfe2c('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xfe2c('0x5')](_0xfe2c('0x3'))['split'](''):[];}}}; \ No newline at end of file +var _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x23a99d,_0xaddad1){var _0xb77fd6=function(_0x52e33b){while(--_0x52e33b){_0x23a99d['push'](_0x23a99d['shift']());}};_0xb77fd6(++_0xaddad1);}(_0xb9a7,0x112));var _0x7b9a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb9a7[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f55bea8..0f13547 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 _0xe900=['reject','update','destroy','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xe900,0x1eb));var _0x0e90=function(_0x1d86e0,_0x20afb7){_0x1d86e0=_0x1d86e0-0x0;var _0x2a4dfc=_0xe900[_0x1d86e0];return _0x2a4dfc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e90('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e90('0x1'));var moment=require(_0x0e90('0x2'));var BPromise=require(_0x0e90('0x3'));var Mustache=require(_0x0e90('0x4'));var util=require(_0x0e90('0x5'));var path=require(_0x0e90('0x6'));var sox=require('sox');var csv=require(_0x0e90('0x7'));var ejs=require(_0x0e90('0x8'));var fs=require('fs');var fs_extra=require(_0x0e90('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0e90('0xa'));var jsforce=require(_0x0e90('0xb'));var deskjs=require(_0x0e90('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0e90('0xd'));var Redis=require(_0x0e90('0xe'));var authService=require(_0x0e90('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0e90('0x10'));var hardwareService=require(_0x0e90('0x11'));var logger=require(_0x0e90('0x12'))(_0x0e90('0x13'));var utils=require(_0x0e90('0x14'));var config=require(_0x0e90('0x15'));var licenseUtil=require(_0x0e90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b675e,_0xbdd73b){_0xbdd73b=_0xbdd73b||0xcc;return function(_0x46c186){if(_0x46c186){return _0x5b675e[_0x0e90('0x17')](_0xbdd73b);}return _0x5b675e[_0x0e90('0x18')](_0xbdd73b)[_0x0e90('0x19')]();};}function respondWithResult(_0xdf67d9,_0x4c5c65){_0x4c5c65=_0x4c5c65||0xc8;return function(_0x1a3e70){if(_0x1a3e70){return _0xdf67d9['status'](_0x4c5c65)['json'](_0x1a3e70);}};}function respondWithFilteredResult(_0x53328d,_0x25f751){return function(_0x44aac1){if(_0x44aac1){var _0x49ef80=typeof _0x25f751[_0x0e90('0x1a')]===_0x0e90('0x1b')&&typeof _0x25f751[_0x0e90('0x1c')]===_0x0e90('0x1b');var _0x212831=_0x44aac1[_0x0e90('0x1d')];var _0x200b2c=_0x49ef80?0x0:_0x25f751[_0x0e90('0x1a')];var _0x20928f=_0x49ef80?_0x44aac1[_0x0e90('0x1d')]:_0x25f751['offset']+_0x25f751[_0x0e90('0x1c')];var _0x149291;if(_0x20928f>=_0x212831){_0x20928f=_0x212831;_0x149291=0xc8;}else{_0x149291=0xce;}_0x53328d['status'](_0x149291);return _0x53328d[_0x0e90('0x1e')](_0x0e90('0x1f'),_0x200b2c+'-'+_0x20928f+'/'+_0x212831)[_0x0e90('0x20')](_0x44aac1);}return null;};}function patchUpdates(_0x16589b){return function(_0x1afe89){try{jsonpatch[_0x0e90('0x21')](_0x1afe89,_0x16589b,!![]);}catch(_0x461cad){return BPromise[_0x0e90('0x22')](_0x461cad);}return _0x1afe89['save']();};}function saveUpdates(_0x301979,_0x26c1b3){return function(_0x291692){if(_0x291692){return _0x291692[_0x0e90('0x23')](_0x301979)['then'](function(_0x13a983){return _0x13a983;});}return null;};}function removeEntity(_0x8d12f,_0x39eeeb){return function(_0x1c4196){if(_0x1c4196){return _0x1c4196[_0x0e90('0x24')]()[_0x0e90('0x25')](function(){_0x8d12f['status'](0xcc)[_0x0e90('0x19')]();});}};}function handleEntityNotFound(_0x1530d9,_0x7cf0a9){return function(_0x2f432b){if(!_0x2f432b){_0x1530d9[_0x0e90('0x17')](0x194);}return _0x2f432b;};}function handleError(_0x3382c7,_0x204a00){_0x204a00=_0x204a00||0x1f4;return function(_0x375179){logger[_0x0e90('0x26')](_0x375179[_0x0e90('0x27')]);if(_0x375179[_0x0e90('0x28')]){delete _0x375179[_0x0e90('0x28')];}_0x3382c7[_0x0e90('0x18')](_0x204a00)[_0x0e90('0x29')](_0x375179);};}exports[_0x0e90('0x2a')]=function(_0x34a718,_0x48f107){var _0x378241={},_0x530ed6={},_0x4069f9={'count':0x0,'rows':[]};var _0x205541=_[_0x0e90('0x2b')](db[_0x0e90('0x2c')][_0x0e90('0x2d')],function(_0x12f190){return{'name':_0x12f190['fieldName'],'type':_0x12f190[_0x0e90('0x2e')][_0x0e90('0x2f')]};});_0x530ed6['model']=_['map'](_0x205541,_0x0e90('0x28'));_0x530ed6[_0x0e90('0x30')]=_[_0x0e90('0x31')](_0x34a718['query']);_0x530ed6[_0x0e90('0x32')]=_[_0x0e90('0x33')](_0x530ed6[_0x0e90('0x34')],_0x530ed6[_0x0e90('0x30')]);_0x378241[_0x0e90('0x35')]=_[_0x0e90('0x33')](_0x530ed6[_0x0e90('0x34')],qs[_0x0e90('0x36')](_0x34a718['query']['fields']));_0x378241['attributes']=_0x378241[_0x0e90('0x35')][_0x0e90('0x37')]?_0x378241[_0x0e90('0x35')]:_0x530ed6[_0x0e90('0x34')];if(!_0x34a718[_0x0e90('0x30')]['hasOwnProperty'](_0x0e90('0x38'))){_0x378241[_0x0e90('0x1c')]=qs[_0x0e90('0x1c')](_0x34a718[_0x0e90('0x30')][_0x0e90('0x1c')]);_0x378241[_0x0e90('0x1a')]=qs[_0x0e90('0x1a')](_0x34a718[_0x0e90('0x30')]['offset']);}_0x378241['order']=qs[_0x0e90('0x39')](_0x34a718[_0x0e90('0x30')][_0x0e90('0x39')]);_0x378241[_0x0e90('0x3a')]=qs[_0x0e90('0x32')](_[_0x0e90('0x3b')](_0x34a718['query'],_0x530ed6[_0x0e90('0x32')]),_0x205541);if(_0x34a718[_0x0e90('0x30')][_0x0e90('0x3c')]){_0x378241[_0x0e90('0x3a')]=_[_0x0e90('0x3d')](_0x378241[_0x0e90('0x3a')],{'$or':_[_0x0e90('0x2b')](_0x205541,function(_0xc4f2aa){if(_0xc4f2aa['type']!==_0x0e90('0x3e')){var _0x51a68d={};_0x51a68d[_0xc4f2aa[_0x0e90('0x28')]]={'$like':'%'+_0x34a718['query'][_0x0e90('0x3c')]+'%'};return _0x51a68d;}})});}_0x378241=_['merge']({},_0x378241,_0x34a718[_0x0e90('0x3f')]);var _0x5693ea={'where':_0x378241[_0x0e90('0x3a')]};return db[_0x0e90('0x2c')][_0x0e90('0x1d')](_0x5693ea)[_0x0e90('0x25')](function(_0x446272){_0x4069f9['count']=_0x446272;if(_0x34a718['query'][_0x0e90('0x40')]){_0x378241[_0x0e90('0x41')]=[{'all':!![]}];}return db[_0x0e90('0x2c')][_0x0e90('0x42')](_0x378241);})[_0x0e90('0x25')](function(_0x1ba461){_0x4069f9[_0x0e90('0x43')]=_0x1ba461;return _0x4069f9;})[_0x0e90('0x25')](respondWithFilteredResult(_0x48f107,_0x378241))[_0x0e90('0x44')](handleError(_0x48f107,null));};exports[_0x0e90('0x45')]=function(_0x17b21c,_0x5a9fb5){var _0x4a31a2={'raw':![],'where':{'id':_0x17b21c[_0x0e90('0x46')]['id']}},_0x1c0d37={};_0x1c0d37['model']=_[_0x0e90('0x31')](db[_0x0e90('0x2c')]['rawAttributes']);_0x1c0d37['query']=_['keys'](_0x17b21c[_0x0e90('0x30')]);_0x1c0d37[_0x0e90('0x32')]=_[_0x0e90('0x33')](_0x1c0d37['model'],_0x1c0d37[_0x0e90('0x30')]);_0x4a31a2[_0x0e90('0x35')]=_[_0x0e90('0x33')](_0x1c0d37[_0x0e90('0x34')],qs[_0x0e90('0x36')](_0x17b21c[_0x0e90('0x30')]['fields']));_0x4a31a2[_0x0e90('0x35')]=_0x4a31a2[_0x0e90('0x35')][_0x0e90('0x37')]?_0x4a31a2['attributes']:_0x1c0d37[_0x0e90('0x34')];if(_0x17b21c['query'][_0x0e90('0x40')]){_0x4a31a2[_0x0e90('0x41')]=[{'all':!![]}];}_0x4a31a2=_[_0x0e90('0x3d')]({},_0x4a31a2,_0x17b21c[_0x0e90('0x3f')]);return db['UserProfileSection'][_0x0e90('0x47')](_0x4a31a2)[_0x0e90('0x25')](handleEntityNotFound(_0x5a9fb5,null))['then'](respondWithResult(_0x5a9fb5,null))['catch'](handleError(_0x5a9fb5,null));};exports[_0x0e90('0x48')]=function(_0x12eed4,_0x23aff3){return db[_0x0e90('0x2c')][_0x0e90('0x48')](_0x12eed4[_0x0e90('0x49')],{})['then'](respondWithResult(_0x23aff3,0xc9))[_0x0e90('0x44')](handleError(_0x23aff3,null));};exports[_0x0e90('0x23')]=function(_0x41e4c1,_0x373d2f){if(_0x41e4c1[_0x0e90('0x49')]['id']){delete _0x41e4c1['body']['id'];}return db['UserProfileSection'][_0x0e90('0x47')]({'where':{'id':_0x41e4c1[_0x0e90('0x46')]['id']}})[_0x0e90('0x25')](handleEntityNotFound(_0x373d2f,null))['then'](saveUpdates(_0x41e4c1[_0x0e90('0x49')],null))[_0x0e90('0x25')](respondWithResult(_0x373d2f,null))[_0x0e90('0x44')](handleError(_0x373d2f,null));};exports[_0x0e90('0x24')]=function(_0x1a4ae5,_0x499b2d){return db[_0x0e90('0x2c')][_0x0e90('0x47')]({'where':{'id':_0x1a4ae5[_0x0e90('0x46')]['id']}})[_0x0e90('0x25')](handleEntityNotFound(_0x499b2d,null))[_0x0e90('0x25')](removeEntity(_0x499b2d,null))['catch'](handleError(_0x499b2d,null));};exports[_0x0e90('0x4a')]=function(_0x26e821,_0x484d11){return db[_0x0e90('0x2c')]['describe']()[_0x0e90('0x25')](respondWithResult(_0x484d11,null))[_0x0e90('0x44')](handleError(_0x484d11,null));}; \ No newline at end of file +var _0x8c85=['model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','filter','options','UserProfileSection','include','findAll','rows','show','params','rawAttributes','intersection','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','error','stack','index','map','fieldName','type','key'];(function(_0x2dc70d,_0x26e805){var _0x3b9ecc=function(_0x52f7ef){while(--_0x52f7ef){_0x2dc70d['push'](_0x2dc70d['shift']());}};_0x3b9ecc(++_0x26e805);}(_0x8c85,0x1e4));var _0x58c8=function(_0x59dc04,_0x95f226){_0x59dc04=_0x59dc04-0x0;var _0x1b8ccc=_0x8c85[_0x59dc04];return _0x1b8ccc;};'use strict';var emlformat=require(_0x58c8('0x0'));var rimraf=require(_0x58c8('0x1'));var zipdir=require(_0x58c8('0x2'));var jsonpatch=require(_0x58c8('0x3'));var rp=require(_0x58c8('0x4'));var moment=require('moment');var BPromise=require(_0x58c8('0x5'));var Mustache=require(_0x58c8('0x6'));var util=require(_0x58c8('0x7'));var path=require(_0x58c8('0x8'));var sox=require('sox');var csv=require(_0x58c8('0x9'));var ejs=require(_0x58c8('0xa'));var fs=require('fs');var fs_extra=require(_0x58c8('0xb'));var _=require(_0x58c8('0xc'));var squel=require(_0x58c8('0xd'));var crypto=require(_0x58c8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x58c8('0xf'));var toCsv=require(_0x58c8('0x9'));var querystring=require('querystring');var Papa=require(_0x58c8('0x10'));var Redis=require(_0x58c8('0x11'));var authService=require(_0x58c8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x58c8('0x13'));var hardwareService=require(_0x58c8('0x14'));var logger=require(_0x58c8('0x15'))(_0x58c8('0x16'));var utils=require(_0x58c8('0x17'));var config=require(_0x58c8('0x18'));var licenseUtil=require(_0x58c8('0x19'));var db=require(_0x58c8('0x1a'))['db'];function respondWithStatusCode(_0x2f6b2e,_0x4d5a8d){_0x4d5a8d=_0x4d5a8d||0xcc;return function(_0xd706b2){if(_0xd706b2){return _0x2f6b2e[_0x58c8('0x1b')](_0x4d5a8d);}return _0x2f6b2e['status'](_0x4d5a8d)[_0x58c8('0x1c')]();};}function respondWithResult(_0x1282b6,_0x1eec97){_0x1eec97=_0x1eec97||0xc8;return function(_0x41e117){if(_0x41e117){return _0x1282b6['status'](_0x1eec97)['json'](_0x41e117);}};}function respondWithFilteredResult(_0x2c8b50,_0x5860f4){return function(_0x30b22d){if(_0x30b22d){var _0x2f5f4d=typeof _0x5860f4[_0x58c8('0x1d')]===_0x58c8('0x1e')&&typeof _0x5860f4[_0x58c8('0x1f')]==='undefined';var _0x1a0fb6=_0x30b22d[_0x58c8('0x20')];var _0x3c3218=_0x2f5f4d?0x0:_0x5860f4[_0x58c8('0x1d')];var _0x34b2c8=_0x2f5f4d?_0x30b22d[_0x58c8('0x20')]:_0x5860f4[_0x58c8('0x1d')]+_0x5860f4[_0x58c8('0x1f')];var _0x23a1b2;if(_0x34b2c8>=_0x1a0fb6){_0x34b2c8=_0x1a0fb6;_0x23a1b2=0xc8;}else{_0x23a1b2=0xce;}_0x2c8b50[_0x58c8('0x21')](_0x23a1b2);return _0x2c8b50[_0x58c8('0x22')](_0x58c8('0x23'),_0x3c3218+'-'+_0x34b2c8+'/'+_0x1a0fb6)[_0x58c8('0x24')](_0x30b22d);}return null;};}function patchUpdates(_0x2bbbeb){return function(_0x10afa7){try{jsonpatch[_0x58c8('0x25')](_0x10afa7,_0x2bbbeb,!![]);}catch(_0x2b0cd1){return BPromise['reject'](_0x2b0cd1);}return _0x10afa7[_0x58c8('0x26')]();};}function saveUpdates(_0xee8992,_0x2ed202){return function(_0x3aa4c1){if(_0x3aa4c1){return _0x3aa4c1[_0x58c8('0x27')](_0xee8992)['then'](function(_0x18afc8){return _0x18afc8;});}return null;};}function removeEntity(_0x1061ee,_0x28e4fb){return function(_0x287df1){if(_0x287df1){return _0x287df1['destroy']()[_0x58c8('0x28')](function(){_0x1061ee[_0x58c8('0x21')](0xcc)[_0x58c8('0x1c')]();});}};}function handleEntityNotFound(_0x2eceac,_0x1deb18){return function(_0x678980){if(!_0x678980){_0x2eceac[_0x58c8('0x1b')](0x194);}return _0x678980;};}function handleError(_0x377dcc,_0x135cf4){_0x135cf4=_0x135cf4||0x1f4;return function(_0x499995){logger[_0x58c8('0x29')](_0x499995[_0x58c8('0x2a')]);if(_0x499995['name']){delete _0x499995['name'];}_0x377dcc['status'](_0x135cf4)['send'](_0x499995);};}exports[_0x58c8('0x2b')]=function(_0x3f53d1,_0x1bf197){var _0x15c602={},_0x5a0f17={},_0x3d2bdf={'count':0x0,'rows':[]};var _0x44734e=_[_0x58c8('0x2c')](db['UserProfileSection']['rawAttributes'],function(_0x4dbe0c){return{'name':_0x4dbe0c[_0x58c8('0x2d')],'type':_0x4dbe0c[_0x58c8('0x2e')][_0x58c8('0x2f')]};});_0x5a0f17[_0x58c8('0x30')]=_[_0x58c8('0x2c')](_0x44734e,_0x58c8('0x31'));_0x5a0f17[_0x58c8('0x32')]=_[_0x58c8('0x33')](_0x3f53d1['query']);_0x5a0f17[_0x58c8('0x34')]=_['intersection'](_0x5a0f17[_0x58c8('0x30')],_0x5a0f17[_0x58c8('0x32')]);_0x15c602[_0x58c8('0x35')]=_['intersection'](_0x5a0f17[_0x58c8('0x30')],qs[_0x58c8('0x36')](_0x3f53d1[_0x58c8('0x32')][_0x58c8('0x36')]));_0x15c602[_0x58c8('0x35')]=_0x15c602[_0x58c8('0x35')][_0x58c8('0x37')]?_0x15c602[_0x58c8('0x35')]:_0x5a0f17[_0x58c8('0x30')];if(!_0x3f53d1[_0x58c8('0x32')][_0x58c8('0x38')](_0x58c8('0x39'))){_0x15c602[_0x58c8('0x1f')]=qs[_0x58c8('0x1f')](_0x3f53d1[_0x58c8('0x32')][_0x58c8('0x1f')]);_0x15c602[_0x58c8('0x1d')]=qs[_0x58c8('0x1d')](_0x3f53d1[_0x58c8('0x32')][_0x58c8('0x1d')]);}_0x15c602[_0x58c8('0x3a')]=qs['sort'](_0x3f53d1['query']['sort']);_0x15c602['where']=qs[_0x58c8('0x34')](_['pick'](_0x3f53d1['query'],_0x5a0f17[_0x58c8('0x34')]),_0x44734e);if(_0x3f53d1['query']['filter']){_0x15c602[_0x58c8('0x3b')]=_[_0x58c8('0x3c')](_0x15c602[_0x58c8('0x3b')],{'$or':_['map'](_0x44734e,function(_0x82699c){if(_0x82699c[_0x58c8('0x2e')]!=='VIRTUAL'){var _0x5ac2ab={};_0x5ac2ab[_0x82699c[_0x58c8('0x31')]]={'$like':'%'+_0x3f53d1['query'][_0x58c8('0x3d')]+'%'};return _0x5ac2ab;}})});}_0x15c602=_[_0x58c8('0x3c')]({},_0x15c602,_0x3f53d1[_0x58c8('0x3e')]);var _0x32b759={'where':_0x15c602[_0x58c8('0x3b')]};return db[_0x58c8('0x3f')]['count'](_0x32b759)[_0x58c8('0x28')](function(_0x2c029d){_0x3d2bdf['count']=_0x2c029d;if(_0x3f53d1[_0x58c8('0x32')]['includeAll']){_0x15c602[_0x58c8('0x40')]=[{'all':!![]}];}return db[_0x58c8('0x3f')][_0x58c8('0x41')](_0x15c602);})[_0x58c8('0x28')](function(_0x13aec2){_0x3d2bdf[_0x58c8('0x42')]=_0x13aec2;return _0x3d2bdf;})[_0x58c8('0x28')](respondWithFilteredResult(_0x1bf197,_0x15c602))['catch'](handleError(_0x1bf197,null));};exports[_0x58c8('0x43')]=function(_0x1a40a9,_0x146b66){var _0x291156={'raw':![],'where':{'id':_0x1a40a9[_0x58c8('0x44')]['id']}},_0x171ad1={};_0x171ad1[_0x58c8('0x30')]=_['keys'](db[_0x58c8('0x3f')][_0x58c8('0x45')]);_0x171ad1[_0x58c8('0x32')]=_[_0x58c8('0x33')](_0x1a40a9[_0x58c8('0x32')]);_0x171ad1[_0x58c8('0x34')]=_[_0x58c8('0x46')](_0x171ad1[_0x58c8('0x30')],_0x171ad1['query']);_0x291156[_0x58c8('0x35')]=_[_0x58c8('0x46')](_0x171ad1[_0x58c8('0x30')],qs[_0x58c8('0x36')](_0x1a40a9[_0x58c8('0x32')]['fields']));_0x291156[_0x58c8('0x35')]=_0x291156['attributes']['length']?_0x291156[_0x58c8('0x35')]:_0x171ad1[_0x58c8('0x30')];if(_0x1a40a9[_0x58c8('0x32')]['includeAll']){_0x291156[_0x58c8('0x40')]=[{'all':!![]}];}_0x291156=_[_0x58c8('0x3c')]({},_0x291156,_0x1a40a9[_0x58c8('0x3e')]);return db[_0x58c8('0x3f')][_0x58c8('0x47')](_0x291156)[_0x58c8('0x28')](handleEntityNotFound(_0x146b66,null))[_0x58c8('0x28')](respondWithResult(_0x146b66,null))[_0x58c8('0x48')](handleError(_0x146b66,null));};exports['create']=function(_0x593d8a,_0x49f9bd){return db[_0x58c8('0x3f')][_0x58c8('0x49')](_0x593d8a['body'],{})['then'](respondWithResult(_0x49f9bd,0xc9))['catch'](handleError(_0x49f9bd,null));};exports[_0x58c8('0x27')]=function(_0x4b54f2,_0x57eea6){if(_0x4b54f2['body']['id']){delete _0x4b54f2[_0x58c8('0x4a')]['id'];}return db[_0x58c8('0x3f')][_0x58c8('0x47')]({'where':{'id':_0x4b54f2[_0x58c8('0x44')]['id']}})[_0x58c8('0x28')](handleEntityNotFound(_0x57eea6,null))['then'](saveUpdates(_0x4b54f2[_0x58c8('0x4a')],null))[_0x58c8('0x28')](respondWithResult(_0x57eea6,null))[_0x58c8('0x48')](handleError(_0x57eea6,null));};exports['destroy']=function(_0x225fef,_0x459ce0){return db[_0x58c8('0x3f')]['find']({'where':{'id':_0x225fef[_0x58c8('0x44')]['id']}})['then'](handleEntityNotFound(_0x459ce0,null))['then'](removeEntity(_0x459ce0,null))[_0x58c8('0x48')](handleError(_0x459ce0,null));};exports[_0x58c8('0x4b')]=function(_0x8eb508,_0x1ebac8){return db[_0x58c8('0x3f')]['describe']()[_0x58c8('0x28')](respondWithResult(_0x1ebac8,null))['catch'](handleError(_0x1ebac8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 3f83ac0..7c0c765 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 _0x103f=['UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userProfileSection.attributes','exports'];(function(_0xac0176,_0x5b695a){var _0x51ddc6=function(_0xcb867b){while(--_0xcb867b){_0xac0176['push'](_0xac0176['shift']());}};_0x51ddc6(++_0x5b695a);}(_0x103f,0x10e));var _0xf103=function(_0x41df7b,_0x5b4dcf){_0x41df7b=_0x41df7b-0x0;var _0x4affd8=_0x103f[_0x41df7b];return _0x4affd8;};'use strict';var _=require(_0xf103('0x0'));var util=require(_0xf103('0x1'));var logger=require(_0xf103('0x2'))(_0xf103('0x3'));var moment=require(_0xf103('0x4'));var BPromise=require(_0xf103('0x5'));var rp=require(_0xf103('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf103('0x7'));var config=require('../../config/environment');var attributes=require(_0xf103('0x8'));module[_0xf103('0x9')]=function(_0x1f84a3,_0x45492d){return _0x1f84a3['define'](_0xf103('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xf103('0xb'),'fields':[_0xf103('0xc'),_0xf103('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3853=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','sectionId','lodash'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x3853,0x1af));var _0x3385=function(_0x58c3b2,_0x445a89){_0x58c3b2=_0x58c3b2-0x0;var _0x4b2146=_0x3853[_0x58c3b2];return _0x4b2146;};'use strict';var _=require(_0x3385('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3385('0x1'));var moment=require(_0x3385('0x2'));var BPromise=require(_0x3385('0x3'));var rp=require(_0x3385('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3385('0x5'));var config=require(_0x3385('0x6'));var attributes=require(_0x3385('0x7'));module[_0x3385('0x8')]=function(_0x41fd2a,_0x5d4d3a){return _0x41fd2a['define'](_0x3385('0x9'),attributes,{'tableName':_0x3385('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x3385('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d52d37b..1c4ab69 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 _0xcb57=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch'];(function(_0x186740,_0x1ca03a){var _0xb37f50=function(_0x10dc4d){while(--_0x10dc4d){_0x186740['push'](_0x186740['shift']());}};_0xb37f50(++_0x1ca03a);}(_0xcb57,0x8a));var _0x7cb5=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xcb57[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x7cb5('0x0'));var util=require(_0x7cb5('0x1'));var moment=require('moment');var BPromise=require(_0x7cb5('0x2'));var rs=require(_0x7cb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cb5('0x4'))['db'];var utils=require(_0x7cb5('0x5'));var logger=require(_0x7cb5('0x6'))(_0x7cb5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7cb5('0x8')][_0x7cb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cad77,_0x5aa339,_0x4df25c){return new BPromise(function(_0x22b6a5,_0x37c35f){return client[_0x7cb5('0xa')](_0x3cad77,_0x4df25c)[_0x7cb5('0xb')](function(_0x3b4dfc){logger[_0x7cb5('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x5aa339,'request\x20sent');logger[_0x7cb5('0xd')](_0x7cb5('0xe'),_0x5aa339,_0x7cb5('0xf'),JSON[_0x7cb5('0x10')](_0x3b4dfc));if(_0x3b4dfc['error']){if(_0x3b4dfc[_0x7cb5('0x11')][_0x7cb5('0x12')]===0x1f4){logger[_0x7cb5('0x11')](_0x7cb5('0x13'),_0x5aa339,_0x3b4dfc[_0x7cb5('0x11')][_0x7cb5('0x14')]);return _0x37c35f(_0x3b4dfc[_0x7cb5('0x11')][_0x7cb5('0x14')]);}logger[_0x7cb5('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x5aa339,_0x3b4dfc[_0x7cb5('0x11')][_0x7cb5('0x14')]);return _0x22b6a5(_0x3b4dfc['error']['message']);}else{logger[_0x7cb5('0xc')](_0x7cb5('0x13'),_0x5aa339,'request\x20sent');_0x22b6a5(_0x3b4dfc[_0x7cb5('0x15')][_0x7cb5('0x14')]);}})[_0x7cb5('0x16')](function(_0x53b337){logger['error'](_0x7cb5('0x13'),_0x5aa339,_0x53b337);_0x37c35f(_0x53b337);});});} \ No newline at end of file +var _0x5844=['code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','UserProfileSection,\x20%s,\x20%s','debug','stringify','error'];(function(_0x2bb9a0,_0x575816){var _0x7d59e=function(_0x3e4eeb){while(--_0x3e4eeb){_0x2bb9a0['push'](_0x2bb9a0['shift']());}};_0x7d59e(++_0x575816);}(_0x5844,0x10d));var _0x4584=function(_0x54ee04,_0x3aa9d6){_0x54ee04=_0x54ee04-0x0;var _0x564f3f=_0x5844[_0x54ee04];return _0x564f3f;};'use strict';var _=require(_0x4584('0x0'));var util=require(_0x4584('0x1'));var moment=require(_0x4584('0x2'));var BPromise=require(_0x4584('0x3'));var rs=require(_0x4584('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4584('0x5'))['db'];var utils=require(_0x4584('0x6'));var logger=require(_0x4584('0x7'))(_0x4584('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4584('0x9')][_0x4584('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x63747f,_0xee6aeb,_0x3ee4c8){return new BPromise(function(_0xdcbc2d,_0x24b6e7){return client[_0x4584('0xb')](_0x63747f,_0x3ee4c8)['then'](function(_0x244815){logger[_0x4584('0xc')](_0x4584('0xd'),_0xee6aeb,'request\x20sent');logger[_0x4584('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0xee6aeb,'request\x20sent',JSON[_0x4584('0xf')](_0x244815));if(_0x244815[_0x4584('0x10')]){if(_0x244815['error'][_0x4584('0x11')]===0x1f4){logger[_0x4584('0x10')](_0x4584('0xd'),_0xee6aeb,_0x244815[_0x4584('0x10')][_0x4584('0x12')]);return _0x24b6e7(_0x244815[_0x4584('0x10')][_0x4584('0x12')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0xee6aeb,_0x244815[_0x4584('0x10')][_0x4584('0x12')]);return _0xdcbc2d(_0x244815[_0x4584('0x10')][_0x4584('0x12')]);}else{logger[_0x4584('0xc')](_0x4584('0xd'),_0xee6aeb,_0x4584('0x13'));_0xdcbc2d(_0x244815[_0x4584('0x14')][_0x4584('0x12')]);}})[_0x4584('0x15')](function(_0x425bc0){logger[_0x4584('0x10')](_0x4584('0xd'),_0xee6aeb,_0x425bc0);_0x24b6e7(_0x425bc0);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9e931dc..a0b10be 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x468e71,_0x171468){var _0x2c9045=function(_0x3607c1){while(--_0x3607c1){_0x468e71['push'](_0x468e71['shift']());}};_0x2c9045(++_0x171468);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'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(_0x1ec047,_0x548f93){var _0x121dcc=function(_0xd22ced){while(--_0xd22ced){_0x1ec047['push'](_0x1ec047['shift']());}};_0x121dcc(++_0x548f93);}(_0xe706,0xa3));var _0x6e70=function(_0x946779,_0x31cd75){_0x946779=_0x946779-0x0;var _0x40292f=_0xe706[_0x946779];return _0x40292f;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8ab80c8..3658d91 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 _0xc0b5=['sequelize','exports'];(function(_0x4fa87d,_0xc9c294){var _0x22279f=function(_0x37f582){while(--_0x37f582){_0x4fa87d['push'](_0x4fa87d['shift']());}};_0x22279f(++_0xc9c294);}(_0xc0b5,0xdc));var _0x5c0b=function(_0x221a91,_0x36c80e){_0x221a91=_0x221a91-0x0;var _0x3d286b=_0xc0b5[_0x221a91];return _0x3d286b;};'use strict';var Sequelize=require(_0x5c0b('0x0'));module[_0x5c0b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4ce6=['exports','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ce6,0x1eb));var _0x64ce=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0x4ce6[_0x47df54];return _0x261b87;};'use strict';var Sequelize=require(_0x64ce('0x0'));module[_0x64ce('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 11683fb..5311b59 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 _0x199c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x199c,0x1d8));var _0xc199=function(_0x35e398,_0x2e3b5b){_0x35e398=_0x35e398-0x0;var _0x17ac67=_0x199c[_0x35e398];return _0x17ac67;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc199('0x0'))(_0xc199('0x1'));var moment=require(_0xc199('0x2'));var BPromise=require(_0xc199('0x3'));var rp=require(_0xc199('0x4'));var fs=require('fs');var path=require(_0xc199('0x5'));var rimraf=require(_0xc199('0x6'));var config=require(_0xc199('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xc199('0x8')]=function(_0x2ff172,_0x499721){return _0x2ff172['define'](_0xc199('0x9'),attributes,{'tableName':_0xc199('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x29984f,_0x3e9a07){var _0x420a97=function(_0x9667b6){while(--_0x9667b6){_0x29984f['push'](_0x29984f['shift']());}};_0x420a97(++_0x3e9a07);}(_0x323f,0x1ee));var _0xf323=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x323f[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index c73cdd3..90d488e 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 _0x1697=['code','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xeaa57e,_0x2f5072){var _0x5dd286=function(_0x3a4f5b){while(--_0x3a4f5b){_0xeaa57e['push'](_0xeaa57e['shift']());}};_0x5dd286(++_0x2f5072);}(_0x1697,0x194));var _0x7169=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x1697[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x7169('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7169('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7169('0x2'))['db'];var utils=require(_0x7169('0x3'));var logger=require(_0x7169('0x4'))(_0x7169('0x5'));var config=require(_0x7169('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7169('0x7')][_0x7169('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38def6,_0x280d16,_0xe1aed5){return new BPromise(function(_0x334a13,_0x24376c){return client['request'](_0x38def6,_0xe1aed5)[_0x7169('0x9')](function(_0x12ca67){logger[_0x7169('0xa')](_0x7169('0xb'),_0x280d16,_0x7169('0xc'));logger['debug'](_0x7169('0xd'),_0x280d16,_0x7169('0xc'),JSON[_0x7169('0xe')](_0x12ca67));if(_0x12ca67[_0x7169('0xf')]){if(_0x12ca67['error'][_0x7169('0x10')]===0x1f4){logger[_0x7169('0xf')](_0x7169('0xb'),_0x280d16,_0x12ca67['error'][_0x7169('0x11')]);return _0x24376c(_0x12ca67[_0x7169('0xf')][_0x7169('0x11')]);}logger[_0x7169('0xf')](_0x7169('0xb'),_0x280d16,_0x12ca67['error']['message']);return _0x334a13(_0x12ca67[_0x7169('0xf')][_0x7169('0x11')]);}else{logger[_0x7169('0xa')](_0x7169('0xb'),_0x280d16,_0x7169('0xc'));_0x334a13(_0x12ca67[_0x7169('0x12')][_0x7169('0x11')]);}})[_0x7169('0x13')](function(_0x2ccab0){logger[_0x7169('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x280d16,_0x2ccab0);_0x24376c(_0x2ccab0);});});} \ No newline at end of file +var _0x0294=['../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','stringify','error','message','UserSmsQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4899bd,_0x378bb2){var _0x104a79=function(_0x17ec29){while(--_0x17ec29){_0x4899bd['push'](_0x4899bd['shift']());}};_0x104a79(++_0x378bb2);}(_0x0294,0x1b0));var _0x4029=function(_0x6141bf,_0x10c035){_0x6141bf=_0x6141bf-0x0;var _0x4c8cd7=_0x0294[_0x6141bf];return _0x4c8cd7;};'use strict';var _=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var moment=require(_0x4029('0x2'));var BPromise=require(_0x4029('0x3'));var rs=require(_0x4029('0x4'));var fs=require('fs');var Redis=require(_0x4029('0x5'));var db=require(_0x4029('0x6'))['db'];var utils=require(_0x4029('0x7'));var logger=require(_0x4029('0x8'))(_0x4029('0x9'));var config=require(_0x4029('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4029('0xb')][_0x4029('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6f06ad,_0x13854a,_0x119715){return new BPromise(function(_0x2e5c13,_0x23cb26){return client[_0x4029('0xd')](_0x6f06ad,_0x119715)['then'](function(_0x43f3d9){logger[_0x4029('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x13854a,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x13854a,_0x4029('0xf'),JSON[_0x4029('0x10')](_0x43f3d9));if(_0x43f3d9[_0x4029('0x11')]){if(_0x43f3d9[_0x4029('0x11')]['code']===0x1f4){logger[_0x4029('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x13854a,_0x43f3d9[_0x4029('0x11')][_0x4029('0x12')]);return _0x23cb26(_0x43f3d9['error']['message']);}logger[_0x4029('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x13854a,_0x43f3d9['error']['message']);return _0x2e5c13(_0x43f3d9[_0x4029('0x11')][_0x4029('0x12')]);}else{logger['info'](_0x4029('0x13'),_0x13854a,_0x4029('0xf'));_0x2e5c13(_0x43f3d9[_0x4029('0x14')][_0x4029('0x12')]);}})[_0x4029('0x15')](function(_0x39e495){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x13854a,_0x39e495);_0x23cb26(_0x39e495);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index c1cda24..9530ed0 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 _0x48d8=['exports','INTEGER'];(function(_0x469b9b,_0x2e697f){var _0x4c8659=function(_0x2e61d2){while(--_0x2e61d2){_0x469b9b['push'](_0x469b9b['shift']());}};_0x4c8659(++_0x2e697f);}(_0x48d8,0x190));var _0x848d=function(_0x2d2113,_0x496760){_0x2d2113=_0x2d2113-0x0;var _0x4168ec=_0x48d8[_0x2d2113];return _0x4168ec;};'use strict';var Sequelize=require('sequelize');module[_0x848d('0x0')]={'UserId':{'type':Sequelize[_0x848d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x848d('0x1')]}}; \ No newline at end of file +var _0xb8b8=['INTEGER','exports'];(function(_0x301630,_0x2db8b4){var _0x3c651a=function(_0x63e45){while(--_0x63e45){_0x301630['push'](_0x301630['shift']());}};_0x3c651a(++_0x2db8b4);}(_0xb8b8,0x6f));var _0x8b8b=function(_0x4d7607,_0x321271){_0x4d7607=_0x4d7607-0x0;var _0x2155d8=_0xb8b8[_0x4d7607];return _0x2155d8;};'use strict';var Sequelize=require('sequelize');module[_0x8b8b('0x0')]={'UserId':{'type':Sequelize[_0x8b8b('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8b8b('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index d989785..3d01e12 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(_0x3ab084,_0xa9de4){var _0x3254ab=function(_0x35df2d){while(--_0x35df2d){_0x3ab084['push'](_0x3ab084['shift']());}};_0x3254ab(++_0xa9de4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3ba287,_0x28905a){var _0x197fb2=function(_0x387c4a){while(--_0x387c4a){_0x3ba287['push'](_0x3ba287['shift']());}};_0x197fb2(++_0x28905a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 4525ded..9a42fac 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(_0x217c20,_0x430613){var _0x1cb962=function(_0xb07932){while(--_0xb07932){_0x217c20['push'](_0x217c20['shift']());}};_0x1cb962(++_0x430613);}(_0x70e0,0x17b));var _0x070e=function(_0x143005,_0x187fa5){_0x143005=_0x143005-0x0;var _0x45c501=_0x70e0[_0x143005];return _0x45c501;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4ca6dd,_0x47ed65){var _0x21136d=function(_0x310d99){while(--_0x310d99){_0x4ca6dd['push'](_0x4ca6dd['shift']());}};_0x21136d(++_0x47ed65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index de94435..665f3c6 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 _0xe51b=['sequelize','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe51b,0x92));var _0xbe51=function(_0x1ec3fa,_0x3e9940){_0x1ec3fa=_0x1ec3fa-0x0;var _0x349bee=_0xe51b[_0x1ec3fa];return _0x349bee;};'use strict';var Sequelize=require(_0xbe51('0x0'));module[_0xbe51('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc521=['INTEGER','sequelize'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0xc521,0x67));var _0x1c52=function(_0x39ebe2,_0x15aeaa){_0x39ebe2=_0x39ebe2-0x0;var _0x48132a=_0xc521[_0x39ebe2];return _0x48132a;};'use strict';var Sequelize=require(_0x1c52('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1c52('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 5c49149..ed3a79a 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 _0x247b=['user_has_voice_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x247b,0xb5));var _0xb247=function(_0x44076c,_0x46d2c7){_0x44076c=_0x44076c-0x0;var _0x4b4e19=_0x247b[_0x44076c];return _0x4b4e19;};'use strict';var _=require(_0xb247('0x0'));var util=require(_0xb247('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb247('0x2'));var BPromise=require(_0xb247('0x3'));var rp=require(_0xb247('0x4'));var fs=require('fs');var path=require(_0xb247('0x5'));var rimraf=require(_0xb247('0x6'));var config=require('../../config/environment');var attributes=require(_0xb247('0x7'));module[_0xb247('0x8')]=function(_0x5f2191,_0x3c7494){return _0x5f2191[_0xb247('0x9')](_0xb247('0xa'),attributes,{'tableName':_0xb247('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3f5=['moment','request-promise','path','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xf3f5,0x1a9));var _0x5f3f=function(_0x616617,_0x54a7c0){_0x616617=_0x616617-0x0;var _0x188245=_0xf3f5[_0x616617];return _0x188245;};'use strict';var _=require(_0x5f3f('0x0'));var util=require(_0x5f3f('0x1'));var logger=require(_0x5f3f('0x2'))(_0x5f3f('0x3'));var moment=require(_0x5f3f('0x4'));var BPromise=require('bluebird');var rp=require(_0x5f3f('0x5'));var fs=require('fs');var path=require(_0x5f3f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x5f3f('0x7')]=function(_0x208f61,_0x1c85a3){return _0x208f61[_0x5f3f('0x8')](_0x5f3f('0x9'),attributes,{'tableName':_0x5f3f('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 44f1db0..78bd677 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 _0xcad4=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment'];(function(_0xe69156,_0x3c8847){var _0x4e5968=function(_0x4220ac){while(--_0x4220ac){_0xe69156['push'](_0xe69156['shift']());}};_0x4e5968(++_0x3c8847);}(_0xcad4,0x1cb));var _0x4cad=function(_0x56adeb,_0xc0483){_0x56adeb=_0x56adeb-0x0;var _0xa61331=_0xcad4[_0x56adeb];return _0xa61331;};'use strict';var _=require(_0x4cad('0x0'));var util=require(_0x4cad('0x1'));var moment=require(_0x4cad('0x2'));var BPromise=require(_0x4cad('0x3'));var rs=require(_0x4cad('0x4'));var fs=require('fs');var Redis=require(_0x4cad('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4cad('0x6'))(_0x4cad('0x7'));var config=require(_0x4cad('0x8'));var jayson=require(_0x4cad('0x9'));var client=jayson['client'][_0x4cad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b56fe,_0x225b73,_0x4c9a07){return new BPromise(function(_0x15bffa,_0x232c40){return client[_0x4cad('0xb')](_0x1b56fe,_0x4c9a07)[_0x4cad('0xc')](function(_0x4abd93){logger['info'](_0x4cad('0xd'),_0x225b73,_0x4cad('0xe'));logger['debug'](_0x4cad('0xf'),_0x225b73,'request\x20sent',JSON[_0x4cad('0x10')](_0x4abd93));if(_0x4abd93[_0x4cad('0x11')]){if(_0x4abd93[_0x4cad('0x11')][_0x4cad('0x12')]===0x1f4){logger[_0x4cad('0x11')](_0x4cad('0xd'),_0x225b73,_0x4abd93[_0x4cad('0x11')][_0x4cad('0x13')]);return _0x232c40(_0x4abd93[_0x4cad('0x11')][_0x4cad('0x13')]);}logger['error'](_0x4cad('0xd'),_0x225b73,_0x4abd93[_0x4cad('0x11')][_0x4cad('0x13')]);return _0x15bffa(_0x4abd93[_0x4cad('0x11')][_0x4cad('0x13')]);}else{logger[_0x4cad('0x14')](_0x4cad('0xd'),_0x225b73,_0x4cad('0xe'));_0x15bffa(_0x4abd93[_0x4cad('0x15')]['message']);}})['catch'](function(_0x461594){logger[_0x4cad('0x11')](_0x4cad('0xd'),_0x225b73,_0x461594);_0x232c40(_0x461594);});});} \ No newline at end of file +var _0x77e6=['../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77e6,0x125));var _0x677e=function(_0x2a710b,_0xbdd084){_0x2a710b=_0x2a710b-0x0;var _0x2f9e3e=_0x77e6[_0x2a710b];return _0x2f9e3e;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x677e('0x4'));var db=require(_0x677e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x677e('0x6'))(_0x677e('0x7'));var config=require(_0x677e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x677e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e67e2,_0x409ad9,_0x4159ca){return new BPromise(function(_0x52cf2c,_0x5b05d1){return client[_0x677e('0xa')](_0x4e67e2,_0x4159ca)[_0x677e('0xb')](function(_0x579434){logger[_0x677e('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x409ad9,_0x677e('0xd'));logger[_0x677e('0xe')](_0x677e('0xf'),_0x409ad9,_0x677e('0xd'),JSON[_0x677e('0x10')](_0x579434));if(_0x579434[_0x677e('0x11')]){if(_0x579434[_0x677e('0x11')][_0x677e('0x12')]===0x1f4){logger[_0x677e('0x11')](_0x677e('0x13'),_0x409ad9,_0x579434[_0x677e('0x11')][_0x677e('0x14')]);return _0x5b05d1(_0x579434[_0x677e('0x11')]['message']);}logger[_0x677e('0x11')](_0x677e('0x13'),_0x409ad9,_0x579434['error'][_0x677e('0x14')]);return _0x52cf2c(_0x579434['error']['message']);}else{logger[_0x677e('0xc')](_0x677e('0x13'),_0x409ad9,_0x677e('0xd'));_0x52cf2c(_0x579434[_0x677e('0x15')]['message']);}})[_0x677e('0x16')](function(_0x550b80){logger[_0x677e('0x11')](_0x677e('0x13'),_0x409ad9,_0x550b80);_0x5b05d1(_0x550b80);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index eccbce4..b101e07 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x504f51,_0x18f316){var _0x4b6027=function(_0x4a5480){while(--_0x4a5480){_0x504f51['push'](_0x504f51['shift']());}};_0x4b6027(++_0x18f316);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0xcb91[_0x4067ac];return _0x53d74d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2b2e68,_0x4e7325){var _0x3601bd=function(_0x25b0dd){while(--_0x25b0dd){_0x2b2e68['push'](_0x2b2e68['shift']());}};_0x3601bd(++_0x4e7325);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c90d0d6..4bf5d58 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 _0x38e9=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x2ee1da,_0xdd8b79){var _0x10e556=function(_0x576def){while(--_0x576def){_0x2ee1da['push'](_0x2ee1da['shift']());}};_0x10e556(++_0xdd8b79);}(_0x38e9,0x1b7));var _0x938e=function(_0x1fe8b9,_0xd87696){_0x1fe8b9=_0x1fe8b9-0x0;var _0x25d006=_0x38e9[_0x1fe8b9];return _0x25d006;};'use strict';var Sequelize=require(_0x938e('0x0'));module[_0x938e('0x1')]={'uniqueid':{'type':Sequelize[_0x938e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x938e('0x3')},'UserId':{'type':Sequelize[_0x938e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x938e('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x938e('0x3')},'VoiceQueueId':{'type':Sequelize[_0x938e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x938e('0x4')],'allowNull':![],'unique':_0x938e('0x5'),'comment':_0x938e('0x3')},'penalty':{'type':Sequelize[_0x938e('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x938e('0x2')](0xb),'defaultValue':0x0,'comment':_0x938e('0x3')}}; \ No newline at end of file +var _0x3f71=['INTEGER','queue_interface','Required\x20by\x20Asterisk','STRING'];(function(_0x4fa605,_0x2363dd){var _0x46a538=function(_0x5e0d5a){while(--_0x5e0d5a){_0x4fa605['push'](_0x4fa605['shift']());}};_0x46a538(++_0x2363dd);}(_0x3f71,0x102));var _0x13f7=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x3f71[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x13f7('0x0')},'membername':{'type':Sequelize[_0x13f7('0x1')],'allowNull':![],'comment':_0x13f7('0x0')},'UserId':{'type':Sequelize[_0x13f7('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x13f7('0x3'),'comment':_0x13f7('0x0')},'VoiceQueueId':{'type':Sequelize[_0x13f7('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x13f7('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x13f7('0x0')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x13f7('0x0')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index b74f5d1..391078c 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 _0x921f=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x59c3dc,_0x47c81a){var _0x4a710c=function(_0x6b66b){while(--_0x6b66b){_0x59c3dc['push'](_0x59c3dc['shift']());}};_0x4a710c(++_0x47c81a);}(_0x921f,0xdb));var _0xf921=function(_0x3052d6,_0x4d1cb9){_0x3052d6=_0x3052d6-0x0;var _0x969660=_0x921f[_0x3052d6];return _0x969660;};'use strict';var EventEmitter=require(_0xf921('0x0'));var UserVoiceQueueRt=require(_0xf921('0x1'))['db'][_0xf921('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf921('0x3')](0x0);var events={'afterCreate':_0xf921('0x4'),'afterUpdate':_0xf921('0x5'),'afterDestroy':_0xf921('0x6')};function emitEvent(_0x332847){return function(_0x2f4b8e,_0x48deb8,_0x4bd47e){UserVoiceQueueRtEvents[_0xf921('0x7')](_0x332847+':'+_0x2f4b8e['id'],_0x2f4b8e);UserVoiceQueueRtEvents[_0xf921('0x7')](_0x332847,_0x2f4b8e);_0x4bd47e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xf921('0x8')](e,emitEvent(event));}}module[_0xf921('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0062=['UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x19e426,_0x320e52){var _0x1c596e=function(_0x2b9d31){while(--_0x2b9d31){_0x19e426['push'](_0x19e426['shift']());}};_0x1c596e(++_0x320e52);}(_0x0062,0xb2));var _0x2006=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x0062[_0x3daa8c];return _0x2b1bd7;};'use strict';var EventEmitter=require(_0x2006('0x0'));var UserVoiceQueueRt=require(_0x2006('0x1'))['db'][_0x2006('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2006('0x3')](0x0);var events={'afterCreate':_0x2006('0x4'),'afterUpdate':'update','afterDestroy':_0x2006('0x5')};function emitEvent(_0x20e28e){return function(_0xc810bd,_0x25a818,_0x485abf){UserVoiceQueueRtEvents['emit'](_0x20e28e+':'+_0xc810bd['id'],_0xc810bd);UserVoiceQueueRtEvents[_0x2006('0x6')](_0x20e28e,_0xc810bd);_0x485abf(null);};}for(var e in events){if(events[_0x2006('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x2006('0x8')](e,emitEvent(event));}}module[_0x2006('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 8a372cc..c577799 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 _0x334e=['../../config/logger','api','moment','bluebird','../../config/environment','./userVoiceQueueRt.attributes','exports','define','lodash','util'];(function(_0x5a0f4e,_0x160144){var _0x547be1=function(_0x12107a){while(--_0x12107a){_0x5a0f4e['push'](_0x5a0f4e['shift']());}};_0x547be1(++_0x160144);}(_0x334e,0xc6));var _0xe334=function(_0x26779a,_0xf8273f){_0x26779a=_0x26779a-0x0;var _0x233176=_0x334e[_0x26779a];return _0x233176;};'use strict';var _=require(_0xe334('0x0'));var util=require(_0xe334('0x1'));var logger=require(_0xe334('0x2'))(_0xe334('0x3'));var moment=require(_0xe334('0x4'));var BPromise=require(_0xe334('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe334('0x6'));var attributes=require(_0xe334('0x7'));module[_0xe334('0x8')]=function(_0x28b545,_0x31c2fd){return _0x28b545[_0xe334('0x9')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5761=['define','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x5761,0x189));var _0x1576=function(_0x21ca16,_0x176a6a){_0x21ca16=_0x21ca16-0x0;var _0x456581=_0x5761[_0x21ca16];return _0x456581;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1576('0x0'))(_0x1576('0x1'));var moment=require('moment');var BPromise=require(_0x1576('0x2'));var rp=require(_0x1576('0x3'));var fs=require('fs');var path=require(_0x1576('0x4'));var rimraf=require('rimraf');var config=require(_0x1576('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x1576('0x6')]=function(_0x2e1db9,_0x4a7acf){return _0x2e1db9[_0x1576('0x7')](_0x1576('0x8'),attributes,{'tableName':_0x1576('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 738c708..df33217 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 _0x419c=['result','UserVoiceQueueRt','options','where','COUNT','sequelize','outboundQueuePauses','then','debug','GetVoiceQueueRtPauses','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x234732,_0x2dc38b){var _0xed5bc7=function(_0x172e7b){while(--_0x172e7b){_0x234732['push'](_0x234732['shift']());}};_0xed5bc7(++_0x2dc38b);}(_0x419c,0x159));var _0xc419=function(_0x41d552,_0x1e59db){_0x41d552=_0x41d552-0x0;var _0x45d056=_0x419c[_0x41d552];return _0x45d056;};'use strict';var _=require(_0xc419('0x0'));var util=require('util');var moment=require(_0xc419('0x1'));var BPromise=require(_0xc419('0x2'));var rs=require(_0xc419('0x3'));var fs=require('fs');var Redis=require(_0xc419('0x4'));var db=require(_0xc419('0x5'))['db'];var utils=require(_0xc419('0x6'));var logger=require(_0xc419('0x7'))(_0xc419('0x8'));var config=require(_0xc419('0x9'));var jayson=require(_0xc419('0xa'));var client=jayson[_0xc419('0xb')][_0xc419('0xc')]({'port':0x232a});config[_0xc419('0xd')]=_[_0xc419('0xe')](config[_0xc419('0xd')],{'host':_0xc419('0xf'),'port':0x18eb});var socket=require(_0xc419('0x10'))(new Redis(config[_0xc419('0xd')]));require(_0xc419('0x11'))[_0xc419('0x12')](socket);function respondWithRpcPromise(_0x10cc7d,_0x2165b7,_0x591b3f){return new BPromise(function(_0x22a676,_0x5b67bd){return client[_0xc419('0x13')](_0x10cc7d,_0x591b3f)['then'](function(_0x10e91b){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2165b7,_0xc419('0x14'));logger['debug'](_0xc419('0x15'),_0x2165b7,_0xc419('0x14'),JSON['stringify'](_0x10e91b));if(_0x10e91b[_0xc419('0x16')]){if(_0x10e91b[_0xc419('0x16')]['code']===0x1f4){logger[_0xc419('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2165b7,_0x10e91b['error'][_0xc419('0x17')]);return _0x5b67bd(_0x10e91b[_0xc419('0x16')][_0xc419('0x17')]);}logger[_0xc419('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2165b7,_0x10e91b[_0xc419('0x16')]['message']);return _0x22a676(_0x10e91b[_0xc419('0x16')][_0xc419('0x17')]);}else{logger['info'](_0xc419('0x18'),_0x2165b7,_0xc419('0x14'));_0x22a676(_0x10e91b[_0xc419('0x19')]['message']);}})['catch'](function(_0x1a1a04){logger['error'](_0xc419('0x18'),_0x2165b7,_0x1a1a04);_0x5b67bd(_0x1a1a04);});});}exports['GetVoiceQueueRtPauses']=function(_0x5b88f6){var _0x41bdc8=this;return new Promise(function(_0xb1e83d,_0xf03658){return db[_0xc419('0x1a')]['findAll']({'raw':_0x5b88f6[_0xc419('0x1b')]?_0x5b88f6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b88f6['options']?_0x5b88f6[_0xc419('0x1b')][_0xc419('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc419('0x1d'),db['sequelize']['fn']('IF',db[_0xc419('0x1e')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xc419('0x1f')]]})[_0xc419('0x20')](function(_0x564d4f){logger['info']('GetVoiceQueueRtPauses',_0x5b88f6);logger[_0xc419('0x21')](_0xc419('0x22'),_0x5b88f6,JSON[_0xc419('0x23')](_0x564d4f));_0xb1e83d(_0x564d4f);})[_0xc419('0x24')](function(_0x9abbaf){logger['error'](_0xc419('0x22'),_0x9abbaf['message'],_0x5b88f6);_0xf03658(_0x41bdc8[_0xc419('0x16')](0x1f4,_0x9abbaf['message']));});});}; \ No newline at end of file +var _0x3209=['../../config/logger','http','redis','defaults','localhost','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','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x5e833e,_0x4801c1){var _0x354dd1=function(_0x37fdf8){while(--_0x37fdf8){_0x5e833e['push'](_0x5e833e['shift']());}};_0x354dd1(++_0x4801c1);}(_0x3209,0x8f));var _0x9320=function(_0x33b050,_0x250c6f){_0x33b050=_0x33b050-0x0;var _0xf3567a=_0x3209[_0x33b050];return _0xf3567a;};'use strict';var _=require(_0x9320('0x0'));var util=require(_0x9320('0x1'));var moment=require(_0x9320('0x2'));var BPromise=require(_0x9320('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9320('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9320('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9320('0x6')]({'port':0x232a});config[_0x9320('0x7')]=_[_0x9320('0x8')](config[_0x9320('0x7')],{'host':_0x9320('0x9'),'port':0x18eb});var socket=require(_0x9320('0xa'))(new Redis(config[_0x9320('0x7')]));require(_0x9320('0xb'))[_0x9320('0xc')](socket);function respondWithRpcPromise(_0x362352,_0x6d3910,_0x3eac9e){return new BPromise(function(_0x4c81b8,_0x215a71){return client[_0x9320('0xd')](_0x362352,_0x3eac9e)[_0x9320('0xe')](function(_0x3d9483){logger[_0x9320('0xf')](_0x9320('0x10'),_0x6d3910,_0x9320('0x11'));logger[_0x9320('0x12')](_0x9320('0x13'),_0x6d3910,'request\x20sent',JSON['stringify'](_0x3d9483));if(_0x3d9483['error']){if(_0x3d9483[_0x9320('0x14')][_0x9320('0x15')]===0x1f4){logger[_0x9320('0x14')](_0x9320('0x10'),_0x6d3910,_0x3d9483[_0x9320('0x14')]['message']);return _0x215a71(_0x3d9483[_0x9320('0x14')][_0x9320('0x16')]);}logger[_0x9320('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x6d3910,_0x3d9483[_0x9320('0x14')][_0x9320('0x16')]);return _0x4c81b8(_0x3d9483[_0x9320('0x14')][_0x9320('0x16')]);}else{logger[_0x9320('0xf')](_0x9320('0x10'),_0x6d3910,_0x9320('0x11'));_0x4c81b8(_0x3d9483[_0x9320('0x17')][_0x9320('0x16')]);}})['catch'](function(_0x385d2b){logger[_0x9320('0x14')](_0x9320('0x10'),_0x6d3910,_0x385d2b);_0x215a71(_0x385d2b);});});}exports[_0x9320('0x18')]=function(_0x491051){var _0x5cfd6c=this;return new Promise(function(_0xad3132,_0x4cf4a2){return db[_0x9320('0x19')][_0x9320('0x1a')]({'raw':_0x491051[_0x9320('0x1b')]?_0x491051[_0x9320('0x1b')][_0x9320('0x1c')]===undefined?!![]:![]:!![],'where':_0x491051[_0x9320('0x1b')]?_0x491051[_0x9320('0x1b')][_0x9320('0x1d')]||null:null,'attributes':[[db[_0x9320('0x1e')]['fn'](_0x9320('0x1f'),db[_0x9320('0x1e')]['fn']('IF',db[_0x9320('0x1e')][_0x9320('0x20')](_0x9320('0x21')))),_0x9320('0x22')]]})['then'](function(_0xe8e95d){logger['info'](_0x9320('0x18'),_0x491051);logger[_0x9320('0x12')](_0x9320('0x18'),_0x491051,JSON[_0x9320('0x23')](_0xe8e95d));_0xad3132(_0xe8e95d);})[_0x9320('0x24')](function(_0x4e2532){logger[_0x9320('0x14')](_0x9320('0x18'),_0x4e2532[_0x9320('0x16')],_0x491051);_0x4cf4a2(_0x5cfd6c[_0x9320('0x14')](0x1f4,_0x4e2532[_0x9320('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5d353da..0febc56 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 _0xafdd=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x5c6652,_0x57ef7f){var _0x25728d=function(_0x5a40d2){while(--_0x5a40d2){_0x5c6652['push'](_0x5c6652['shift']());}};_0x25728d(++_0x57ef7f);}(_0xafdd,0x19a));var _0xdafd=function(_0x9cf8a2,_0x5acc81){_0x9cf8a2=_0x9cf8a2-0x0;var _0x530159=_0xafdd[_0x9cf8a2];return _0x530159;};'use strict';var UserVoiceQueueRtEvents=require(_0xdafd('0x0'));var events=[_0xdafd('0x1'),_0xdafd('0x2'),_0xdafd('0x3')];function createListener(_0xf13a21,_0x3ceef2){return function(_0x268b14){_0x3ceef2[_0xdafd('0x4')](_0xf13a21,_0x268b14);};}function removeListener(_0x5624f6,_0x283ab1){return function(){UserVoiceQueueRtEvents[_0xdafd('0x5')](_0x5624f6,_0x283ab1);};}exports[_0xdafd('0x6')]=function(_0x37f05a){for(var _0xfa4ad6=0x0,_0x57cfee=events[_0xdafd('0x7')];_0xfa4ad6<_0x57cfee;_0xfa4ad6++){var _0x53e09c=events[_0xfa4ad6];var _0x9b9c6b=createListener(_0xdafd('0x8')+_0x53e09c,_0x37f05a);UserVoiceQueueRtEvents['on'](_0x53e09c,_0x9b9c6b);}}; \ No newline at end of file +var _0xae30=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','removeListener','register'];(function(_0x345e4c,_0x3e73ba){var _0x40c41c=function(_0x23dfe0){while(--_0x23dfe0){_0x345e4c['push'](_0x345e4c['shift']());}};_0x40c41c(++_0x3e73ba);}(_0xae30,0x10a));var _0x0ae3=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0xae30[_0x1f1fb4];return _0x12fa15;};'use strict';var UserVoiceQueueRtEvents=require(_0x0ae3('0x0'));var events=[_0x0ae3('0x1'),_0x0ae3('0x2'),'update'];function createListener(_0x565144,_0x1352ef){return function(_0x405dd0){_0x1352ef[_0x0ae3('0x3')](_0x565144,_0x405dd0);};}function removeListener(_0x51f481,_0x23a7a1){return function(){UserVoiceQueueRtEvents[_0x0ae3('0x4')](_0x51f481,_0x23a7a1);};}exports[_0x0ae3('0x5')]=function(_0x7ce33e){for(var _0x2b8c53=0x0,_0xda3853=events[_0x0ae3('0x6')];_0x2b8c53<_0xda3853;_0x2b8c53++){var _0x15b7e2=events[_0x2b8c53];var _0x32ea6e=createListener(_0x0ae3('0x7')+_0x15b7e2,_0x7ce33e);UserVoiceQueueRtEvents['on'](_0x15b7e2,_0x32ea6e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 65b1b66..413b978 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(_0xb2e98d,_0x31daa1){var _0x56a0eb=function(_0x102910){while(--_0x102910){_0xb2e98d['push'](_0xb2e98d['shift']());}};_0x56a0eb(++_0x31daa1);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c91c411..5217f65 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 _0x50fd=['exports','INTEGER'];(function(_0x4d8a6e,_0x2c2485){var _0x191119=function(_0xf2b385){while(--_0xf2b385){_0x4d8a6e['push'](_0x4d8a6e['shift']());}};_0x191119(++_0x2c2485);}(_0x50fd,0x186));var _0xd50f=function(_0x20d597,_0xc0b77f){_0x20d597=_0x20d597-0x0;var _0xb77e19=_0x50fd[_0x20d597];return _0xb77e19;};'use strict';var Sequelize=require('sequelize');module[_0xd50f('0x0')]={'penalty':{'type':Sequelize[_0xd50f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2e8a=['INTEGER','exports'];(function(_0x45d303,_0x48dba3){var _0x22130f=function(_0x200112){while(--_0x200112){_0x45d303['push'](_0x45d303['shift']());}};_0x22130f(++_0x48dba3);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x2e8a[_0x2a8860];return _0x2f47a4;};'use strict';var Sequelize=require('sequelize');module[_0xa2e8('0x0')]={'penalty':{'type':Sequelize[_0xa2e8('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 9e138f8..28b50d4 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 _0x5889=['path','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3ca67a,_0x30c192){var _0x391e9b=function(_0x4e9fdd){while(--_0x4e9fdd){_0x3ca67a['push'](_0x3ca67a['shift']());}};_0x391e9b(++_0x30c192);}(_0x5889,0x171));var _0x9588=function(_0x1c8ff3,_0x5784dc){_0x1c8ff3=_0x1c8ff3-0x0;var _0x5ea359=_0x5889[_0x1c8ff3];return _0x5ea359;};'use strict';var _=require(_0x9588('0x0'));var util=require(_0x9588('0x1'));var logger=require(_0x9588('0x2'))('api');var moment=require(_0x9588('0x3'));var BPromise=require(_0x9588('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9588('0x5'));var rimraf=require('rimraf');var config=require(_0x9588('0x6'));var attributes=require(_0x9588('0x7'));module['exports']=function(_0x4d9fd9,_0x4b24fa){return _0x4d9fd9[_0x9588('0x8')](_0x9588('0x9'),attributes,{'tableName':_0x9588('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe730=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x2aeb6d,_0x41b50b){var _0x2c2e12=function(_0x273376){while(--_0x273376){_0x2aeb6d['push'](_0x2aeb6d['shift']());}};_0x2c2e12(++_0x41b50b);}(_0xe730,0x19b));var _0x0e73=function(_0x315055,_0x194609){_0x315055=_0x315055-0x0;var _0x3e3d16=_0xe730[_0x315055];return _0x3e3d16;};'use strict';var _=require(_0x0e73('0x0'));var util=require(_0x0e73('0x1'));var logger=require(_0x0e73('0x2'))(_0x0e73('0x3'));var moment=require('moment');var BPromise=require(_0x0e73('0x4'));var rp=require(_0x0e73('0x5'));var fs=require('fs');var path=require(_0x0e73('0x6'));var rimraf=require(_0x0e73('0x7'));var config=require(_0x0e73('0x8'));var attributes=require(_0x0e73('0x9'));module[_0x0e73('0xa')]=function(_0x1a1604,_0x50ee11){return _0x1a1604[_0x0e73('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0x0e73('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 95983bc..32db0ca 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 _0xd6c0=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x402265,_0x137911){var _0x700cc6=function(_0x64c5ee){while(--_0x64c5ee){_0x402265['push'](_0x402265['shift']());}};_0x700cc6(++_0x137911);}(_0xd6c0,0x128));var _0x0d6c=function(_0x5cf792,_0x59a0ad){_0x5cf792=_0x5cf792-0x0;var _0x514b2a=_0xd6c0[_0x5cf792];return _0x514b2a;};'use strict';var _=require(_0x0d6c('0x0'));var util=require(_0x0d6c('0x1'));var moment=require('moment');var BPromise=require(_0x0d6c('0x2'));var rs=require(_0x0d6c('0x3'));var fs=require('fs');var Redis=require(_0x0d6c('0x4'));var db=require(_0x0d6c('0x5'))['db'];var utils=require(_0x0d6c('0x6'));var logger=require(_0x0d6c('0x7'))(_0x0d6c('0x8'));var config=require(_0x0d6c('0x9'));var jayson=require(_0x0d6c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x372cab,_0x74cc6a,_0x3857f5){return new BPromise(function(_0x1370b0,_0x22e42c){return client[_0x0d6c('0xb')](_0x372cab,_0x3857f5)['then'](function(_0x5b7df8){logger[_0x0d6c('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x74cc6a,'request\x20sent');logger[_0x0d6c('0xd')](_0x0d6c('0xe'),_0x74cc6a,'request\x20sent',JSON[_0x0d6c('0xf')](_0x5b7df8));if(_0x5b7df8[_0x0d6c('0x10')]){if(_0x5b7df8[_0x0d6c('0x10')][_0x0d6c('0x11')]===0x1f4){logger[_0x0d6c('0x10')](_0x0d6c('0x12'),_0x74cc6a,_0x5b7df8[_0x0d6c('0x10')][_0x0d6c('0x13')]);return _0x22e42c(_0x5b7df8[_0x0d6c('0x10')][_0x0d6c('0x13')]);}logger[_0x0d6c('0x10')](_0x0d6c('0x12'),_0x74cc6a,_0x5b7df8[_0x0d6c('0x10')]['message']);return _0x1370b0(_0x5b7df8[_0x0d6c('0x10')][_0x0d6c('0x13')]);}else{logger[_0x0d6c('0xc')](_0x0d6c('0x12'),_0x74cc6a,'request\x20sent');_0x1370b0(_0x5b7df8[_0x0d6c('0x14')][_0x0d6c('0x13')]);}})['catch'](function(_0x9cc9f){logger[_0x0d6c('0x10')](_0x0d6c('0x12'),_0x74cc6a,_0x9cc9f);_0x22e42c(_0x9cc9f);});});} \ No newline at end of file +var _0x88b7=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4bd46c,_0x1ea033){var _0x59a412=function(_0x37e669){while(--_0x37e669){_0x4bd46c['push'](_0x4bd46c['shift']());}};_0x59a412(++_0x1ea033);}(_0x88b7,0x125));var _0x788b=function(_0x4e3793,_0x16003a){_0x4e3793=_0x4e3793-0x0;var _0x7dc917=_0x88b7[_0x4e3793];return _0x7dc917;};'use strict';var _=require(_0x788b('0x0'));var util=require(_0x788b('0x1'));var moment=require('moment');var BPromise=require(_0x788b('0x2'));var rs=require(_0x788b('0x3'));var fs=require('fs');var Redis=require(_0x788b('0x4'));var db=require(_0x788b('0x5'))['db'];var utils=require(_0x788b('0x6'));var logger=require(_0x788b('0x7'))(_0x788b('0x8'));var config=require('../../config/environment');var jayson=require(_0x788b('0x9'));var client=jayson[_0x788b('0xa')][_0x788b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bee22,_0x50eaf6,_0x227b20){return new BPromise(function(_0x5a068d,_0x3cf9ae){return client[_0x788b('0xc')](_0x5bee22,_0x227b20)['then'](function(_0x2fb197){logger[_0x788b('0xd')](_0x788b('0xe'),_0x50eaf6,_0x788b('0xf'));logger[_0x788b('0x10')](_0x788b('0x11'),_0x50eaf6,_0x788b('0xf'),JSON[_0x788b('0x12')](_0x2fb197));if(_0x2fb197[_0x788b('0x13')]){if(_0x2fb197[_0x788b('0x13')]['code']===0x1f4){logger[_0x788b('0x13')](_0x788b('0xe'),_0x50eaf6,_0x2fb197[_0x788b('0x13')]['message']);return _0x3cf9ae(_0x2fb197[_0x788b('0x13')][_0x788b('0x14')]);}logger[_0x788b('0x13')](_0x788b('0xe'),_0x50eaf6,_0x2fb197[_0x788b('0x13')][_0x788b('0x14')]);return _0x5a068d(_0x2fb197[_0x788b('0x13')]['message']);}else{logger[_0x788b('0xd')](_0x788b('0xe'),_0x50eaf6,_0x788b('0xf'));_0x5a068d(_0x2fb197[_0x788b('0x15')][_0x788b('0x14')]);}})[_0x788b('0x16')](function(_0x21ecc4){logger[_0x788b('0x13')](_0x788b('0xe'),_0x50eaf6,_0x21ecc4);_0x3cf9ae(_0x21ecc4);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 06852f1..1fc86e8 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 _0xee39=['../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x55d94e,_0x34a202){var _0x37110c=function(_0x43b958){while(--_0x43b958){_0x55d94e['push'](_0x55d94e['shift']());}};_0x37110c(++_0x34a202);}(_0xee39,0x1e6));var _0x9ee3=function(_0x4af698,_0x20318e){_0x4af698=_0x4af698-0x0;var _0x4c33b5=_0xee39[_0x4af698];return _0x4c33b5;};'use strict';var multer=require(_0x9ee3('0x0'));var util=require(_0x9ee3('0x1'));var path=require(_0x9ee3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ee3('0x3'));var router=express[_0x9ee3('0x4')]();var fs_extra=require(_0x9ee3('0x5'));var auth=require(_0x9ee3('0x6'));var interaction=require(_0x9ee3('0x7'));var config=require(_0x9ee3('0x8'));var controller=require(_0x9ee3('0x9'));router[_0x9ee3('0xa')]('/',auth[_0x9ee3('0xb')](),controller[_0x9ee3('0xc')]);router['get'](_0x9ee3('0xd'),auth[_0x9ee3('0xb')](),controller[_0x9ee3('0xe')]);router['post']('/',auth[_0x9ee3('0xb')](),controller['create']);router[_0x9ee3('0xf')]('/:id',auth[_0x9ee3('0xb')](),controller['update']);router['delete'](_0x9ee3('0xd'),auth['isAuthenticated'](),controller[_0x9ee3('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6282=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x6282,0x76));var _0x2628=function(_0xae1a00,_0x24dd7b){_0xae1a00=_0xae1a00-0x0;var _0x19e48b=_0x6282[_0xae1a00];return _0x19e48b;};'use strict';var multer=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var timeout=require(_0x2628('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2628('0x4'));var auth=require(_0x2628('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2628('0x6'));var controller=require(_0x2628('0x7'));router[_0x2628('0x8')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xa')]);router['get'](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0xc')]);router[_0x2628('0xd')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xe')]);router[_0x2628('0xf')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x10')]);router[_0x2628('0x11')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x12')]);module[_0x2628('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index dc018d9..22f8d38 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 _0x5dcd=['exports','STRING','sequelize'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0x5dcd,0xf8));var _0xd5dc=function(_0x43cf7c,_0x51a65f){_0x43cf7c=_0x43cf7c-0x0;var _0x56fc91=_0x5dcd[_0x43cf7c];return _0x56fc91;};'use strict';var Sequelize=require(_0xd5dc('0x0'));module[_0xd5dc('0x1')]={'name':{'type':Sequelize[_0xd5dc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd5dc('0x2')]}}; \ No newline at end of file +var _0x873a=['sequelize','exports','STRING'];(function(_0x10921d,_0x242a14){var _0x163ca1=function(_0x3429b2){while(--_0x3429b2){_0x10921d['push'](_0x10921d['shift']());}};_0x163ca1(++_0x242a14);}(_0x873a,0x1c2));var _0xa873=function(_0x5bc49c,_0x22d209){_0x5bc49c=_0x5bc49c-0x0;var _0x2b7c0d=_0x873a[_0x5bc49c];return _0x2b7c0d;};'use strict';var Sequelize=require(_0xa873('0x0'));module[_0xa873('0x1')]={'name':{'type':Sequelize[_0xa873('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa873('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 483bada..d44e9fd 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 _0x1d53=['UserProfileResource','end','error','stack','name','send','map','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','Variable','findAll','rows','catch','show','length','includeAll','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','params','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','Variables'];(function(_0x156770,_0x21446d){var _0x5e82b0=function(_0x34e665){while(--_0x34e665){_0x156770['push'](_0x156770['shift']());}};_0x5e82b0(++_0x21446d);}(_0x1d53,0x1b9));var _0x31d5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1d53[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x31d5('0x0'));var rimraf=require(_0x31d5('0x1'));var zipdir=require(_0x31d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x31d5('0x3'));var BPromise=require(_0x31d5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x31d5('0x5'));var sox=require(_0x31d5('0x6'));var csv=require(_0x31d5('0x7'));var ejs=require(_0x31d5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x31d5('0x9'));var crypto=require(_0x31d5('0xa'));var jsforce=require(_0x31d5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x31d5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x31d5('0xc'));var authService=require(_0x31d5('0xd'));var qs=require(_0x31d5('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x31d5('0xf'))('api');var utils=require(_0x31d5('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x31d5('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c41c6,_0x2d9ea3){_0x2d9ea3=_0x2d9ea3||0xcc;return function(_0x327491){if(_0x327491){return _0x4c41c6[_0x31d5('0x12')](_0x2d9ea3);}return _0x4c41c6['status'](_0x2d9ea3)['end']();};}function respondWithResult(_0x586adc,_0x41c635){_0x41c635=_0x41c635||0xc8;return function(_0xd86cba){if(_0xd86cba){return _0x586adc[_0x31d5('0x13')](_0x41c635)[_0x31d5('0x14')](_0xd86cba);}};}function respondWithFilteredResult(_0x3c651,_0x5c357b){return function(_0x58063d){if(_0x58063d){var _0x275ed6=typeof _0x5c357b[_0x31d5('0x15')]==='undefined'&&typeof _0x5c357b[_0x31d5('0x16')]===_0x31d5('0x17');var _0x446824=_0x58063d[_0x31d5('0x18')];var _0x14ad34=_0x275ed6?0x0:_0x5c357b[_0x31d5('0x15')];var _0x1761cd=_0x275ed6?_0x58063d[_0x31d5('0x18')]:_0x5c357b['offset']+_0x5c357b[_0x31d5('0x16')];var _0x42be97;if(_0x1761cd>=_0x446824){_0x1761cd=_0x446824;_0x42be97=0xc8;}else{_0x42be97=0xce;}_0x3c651[_0x31d5('0x13')](_0x42be97);return _0x3c651[_0x31d5('0x19')]('Content-Range',_0x14ad34+'-'+_0x1761cd+'/'+_0x446824)['json'](_0x58063d);}return null;};}function patchUpdates(_0xc75a93){return function(_0xc31f5c){try{jsonpatch[_0x31d5('0x1a')](_0xc31f5c,_0xc75a93,!![]);}catch(_0x623110){return BPromise[_0x31d5('0x1b')](_0x623110);}return _0xc31f5c[_0x31d5('0x1c')]();};}function saveUpdates(_0x38283b,_0x585710){return function(_0xaa4c65){if(_0xaa4c65){return _0xaa4c65['update'](_0x38283b)[_0x31d5('0x1d')](function(_0x9207d7){return _0x9207d7;});}return null;};}function removeEntity(_0x51a437,_0x55714a){return function(_0x58d7d6){if(_0x58d7d6){return _0x58d7d6[_0x31d5('0x1e')]()['then'](function(){var _0x1abce9=_0x58d7d6[_0x31d5('0x1f')]({'plain':!![]});var _0x58359e=_0x31d5('0x20');return db[_0x31d5('0x21')][_0x31d5('0x1e')]({'where':{'type':_0x58359e,'resourceId':_0x1abce9['id']}})[_0x31d5('0x1d')](function(){return _0x58d7d6;});})['then'](function(){_0x51a437[_0x31d5('0x13')](0xcc)[_0x31d5('0x22')]();});}};}function handleEntityNotFound(_0x49b37e,_0x470d9f){return function(_0x4529d1){if(!_0x4529d1){_0x49b37e[_0x31d5('0x12')](0x194);}return _0x4529d1;};}function handleError(_0x5e513d,_0x147536){_0x147536=_0x147536||0x1f4;return function(_0x2f8412){logger[_0x31d5('0x23')](_0x2f8412[_0x31d5('0x24')]);if(_0x2f8412[_0x31d5('0x25')]){delete _0x2f8412[_0x31d5('0x25')];}_0x5e513d['status'](_0x147536)[_0x31d5('0x26')](_0x2f8412);};}exports['index']=function(_0x29df9a,_0x564037){var _0x171af6={},_0x221d96={},_0x5a2c2={'count':0x0,'rows':[]};var _0x16a118=_[_0x31d5('0x27')](db['Variable'][_0x31d5('0x28')],function(_0x7b2d6b){return{'name':_0x7b2d6b[_0x31d5('0x29')],'type':_0x7b2d6b['type']['key']};});_0x221d96['model']=_[_0x31d5('0x27')](_0x16a118,_0x31d5('0x25'));_0x221d96[_0x31d5('0x2a')]=_[_0x31d5('0x2b')](_0x29df9a['query']);_0x221d96[_0x31d5('0x2c')]=_['intersection'](_0x221d96[_0x31d5('0x2d')],_0x221d96[_0x31d5('0x2a')]);_0x171af6[_0x31d5('0x2e')]=_[_0x31d5('0x2f')](_0x221d96[_0x31d5('0x2d')],qs[_0x31d5('0x30')](_0x29df9a[_0x31d5('0x2a')]['fields']));_0x171af6['attributes']=_0x171af6['attributes']['length']?_0x171af6['attributes']:_0x221d96[_0x31d5('0x2d')];if(!_0x29df9a[_0x31d5('0x2a')][_0x31d5('0x31')](_0x31d5('0x32'))){_0x171af6[_0x31d5('0x16')]=qs[_0x31d5('0x16')](_0x29df9a[_0x31d5('0x2a')][_0x31d5('0x16')]);_0x171af6[_0x31d5('0x15')]=qs[_0x31d5('0x15')](_0x29df9a[_0x31d5('0x2a')]['offset']);}_0x171af6[_0x31d5('0x33')]=qs[_0x31d5('0x34')](_0x29df9a[_0x31d5('0x2a')][_0x31d5('0x34')]);_0x171af6[_0x31d5('0x35')]=qs[_0x31d5('0x2c')](_['pick'](_0x29df9a[_0x31d5('0x2a')],_0x221d96[_0x31d5('0x2c')]),_0x16a118);if(_0x29df9a[_0x31d5('0x2a')][_0x31d5('0x36')]){_0x171af6[_0x31d5('0x35')]=_[_0x31d5('0x37')](_0x171af6['where'],{'$or':_[_0x31d5('0x27')](_0x16a118,function(_0x3ba3ff){if(_0x3ba3ff[_0x31d5('0x38')]!==_0x31d5('0x39')){var _0x15c1f0={};_0x15c1f0[_0x3ba3ff[_0x31d5('0x25')]]={'$like':'%'+_0x29df9a['query'][_0x31d5('0x36')]+'%'};return _0x15c1f0;}})});}_0x171af6=_[_0x31d5('0x37')]({},_0x171af6,_0x29df9a[_0x31d5('0x3a')]);var _0x1ad83b={'where':_0x171af6['where']};return db['Variable'][_0x31d5('0x18')](_0x1ad83b)[_0x31d5('0x1d')](function(_0x5ac373){_0x5a2c2[_0x31d5('0x18')]=_0x5ac373;if(_0x29df9a[_0x31d5('0x2a')]['includeAll']){_0x171af6[_0x31d5('0x3b')]=[{'all':!![]}];}return db[_0x31d5('0x3c')][_0x31d5('0x3d')](_0x171af6);})['then'](function(_0x214073){_0x5a2c2[_0x31d5('0x3e')]=_0x214073;return _0x5a2c2;})[_0x31d5('0x1d')](respondWithFilteredResult(_0x564037,_0x171af6))[_0x31d5('0x3f')](handleError(_0x564037,null));};exports[_0x31d5('0x40')]=function(_0x537290,_0x570dee){var _0x23a04c={'raw':!![],'where':{'id':_0x537290['params']['id']}},_0x338bf9={};_0x338bf9[_0x31d5('0x2d')]=_[_0x31d5('0x2b')](db['Variable'][_0x31d5('0x28')]);_0x338bf9['query']=_[_0x31d5('0x2b')](_0x537290['query']);_0x338bf9[_0x31d5('0x2c')]=_[_0x31d5('0x2f')](_0x338bf9[_0x31d5('0x2d')],_0x338bf9['query']);_0x23a04c['attributes']=_[_0x31d5('0x2f')](_0x338bf9[_0x31d5('0x2d')],qs['fields'](_0x537290[_0x31d5('0x2a')][_0x31d5('0x30')]));_0x23a04c[_0x31d5('0x2e')]=_0x23a04c['attributes'][_0x31d5('0x41')]?_0x23a04c['attributes']:_0x338bf9[_0x31d5('0x2d')];if(_0x537290[_0x31d5('0x2a')][_0x31d5('0x42')]){_0x23a04c[_0x31d5('0x3b')]=[{'all':!![]}];}_0x23a04c=_['merge']({},_0x23a04c,_0x537290[_0x31d5('0x3a')]);return db[_0x31d5('0x3c')][_0x31d5('0x43')](_0x23a04c)[_0x31d5('0x1d')](handleEntityNotFound(_0x570dee,null))['then'](respondWithResult(_0x570dee,null))['catch'](handleError(_0x570dee,null));};exports[_0x31d5('0x44')]=function(_0x4476eb,_0x23494e){return db[_0x31d5('0x3c')][_0x31d5('0x44')](_0x4476eb[_0x31d5('0x45')],{})[_0x31d5('0x1d')](function(_0x189af4){var _0x34db22=_0x4476eb['user'][_0x31d5('0x1f')]({'plain':!![]});if(!_0x34db22)throw new Error(_0x31d5('0x46'));if(_0x34db22[_0x31d5('0x47')]===_0x31d5('0x48')){var _0x500c52=_0x189af4[_0x31d5('0x1f')]({'plain':!![]});var _0x3b34e4=_0x31d5('0x20');return db[_0x31d5('0x49')][_0x31d5('0x43')]({'where':{'name':_0x3b34e4,'userProfileId':_0x34db22[_0x31d5('0x4a')]},'raw':!![]})[_0x31d5('0x1d')](function(_0x2e8a60){if(_0x2e8a60&&_0x2e8a60[_0x31d5('0x4b')]===0x0){return db[_0x31d5('0x21')][_0x31d5('0x44')]({'name':_0x500c52[_0x31d5('0x25')],'resourceId':_0x500c52['id'],'type':_0x2e8a60[_0x31d5('0x25')],'sectionId':_0x2e8a60['id']},{})[_0x31d5('0x1d')](function(){return _0x189af4;});}else{return _0x189af4;}})[_0x31d5('0x3f')](function(_0x4cf2da){logger['error'](_0x31d5('0x4c'),_0x4cf2da);throw _0x4cf2da;});}return _0x189af4;})[_0x31d5('0x1d')](respondWithResult(_0x23494e,0xc9))[_0x31d5('0x3f')](handleError(_0x23494e,null));};exports[_0x31d5('0x4d')]=function(_0x3f8b28,_0x3c796b){if(_0x3f8b28['body']['id']){delete _0x3f8b28[_0x31d5('0x45')]['id'];}return db[_0x31d5('0x3c')]['find']({'where':{'id':_0x3f8b28[_0x31d5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3c796b,null))[_0x31d5('0x1d')](saveUpdates(_0x3f8b28['body'],null))[_0x31d5('0x1d')](respondWithResult(_0x3c796b,null))[_0x31d5('0x3f')](handleError(_0x3c796b,null));};exports[_0x31d5('0x1e')]=function(_0x97387b,_0x45fbd2){return db[_0x31d5('0x3c')][_0x31d5('0x43')]({'where':{'id':_0x97387b[_0x31d5('0x4e')]['id']}})[_0x31d5('0x1d')](handleEntityNotFound(_0x45fbd2,null))[_0x31d5('0x1d')](removeEntity(_0x45fbd2,null))['catch'](handleError(_0x45fbd2,null));}; \ No newline at end of file +var _0xc173=['include','findAll','rows','show','params','find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x35bc02,_0x588fa9){var _0x259a27=function(_0xb5ce23){while(--_0xb5ce23){_0x35bc02['push'](_0x35bc02['shift']());}};_0x259a27(++_0x588fa9);}(_0xc173,0x65));var _0x3c17=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc173[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3c17('0x0'));var rimraf=require(_0x3c17('0x1'));var zipdir=require(_0x3c17('0x2'));var jsonpatch=require(_0x3c17('0x3'));var rp=require(_0x3c17('0x4'));var moment=require('moment');var BPromise=require(_0x3c17('0x5'));var Mustache=require(_0x3c17('0x6'));var util=require(_0x3c17('0x7'));var path=require(_0x3c17('0x8'));var sox=require(_0x3c17('0x9'));var csv=require(_0x3c17('0xa'));var ejs=require(_0x3c17('0xb'));var fs=require('fs');var fs_extra=require(_0x3c17('0xc'));var _=require(_0x3c17('0xd'));var squel=require(_0x3c17('0xe'));var crypto=require(_0x3c17('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3c17('0x10'));var toCsv=require(_0x3c17('0xa'));var querystring=require(_0x3c17('0x11'));var Papa=require(_0x3c17('0x12'));var Redis=require(_0x3c17('0x13'));var authService=require(_0x3c17('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3c17('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c17('0x16'))(_0x3c17('0x17'));var utils=require('../../config/utils');var config=require(_0x3c17('0x18'));var licenseUtil=require(_0x3c17('0x19'));var db=require(_0x3c17('0x1a'))['db'];function respondWithStatusCode(_0x5bf9ac,_0xc183cc){_0xc183cc=_0xc183cc||0xcc;return function(_0x3278df){if(_0x3278df){return _0x5bf9ac[_0x3c17('0x1b')](_0xc183cc);}return _0x5bf9ac[_0x3c17('0x1c')](_0xc183cc)[_0x3c17('0x1d')]();};}function respondWithResult(_0x4099fc,_0x3fce52){_0x3fce52=_0x3fce52||0xc8;return function(_0x474a57){if(_0x474a57){return _0x4099fc[_0x3c17('0x1c')](_0x3fce52)[_0x3c17('0x1e')](_0x474a57);}};}function respondWithFilteredResult(_0x580224,_0xad462b){return function(_0x1053a7){if(_0x1053a7){var _0x3379b8=typeof _0xad462b[_0x3c17('0x1f')]===_0x3c17('0x20')&&typeof _0xad462b[_0x3c17('0x21')]===_0x3c17('0x20');var _0x13dcac=_0x1053a7[_0x3c17('0x22')];var _0x4d130a=_0x3379b8?0x0:_0xad462b[_0x3c17('0x1f')];var _0x585faf=_0x3379b8?_0x1053a7[_0x3c17('0x22')]:_0xad462b[_0x3c17('0x1f')]+_0xad462b[_0x3c17('0x21')];var _0x4d42d7;if(_0x585faf>=_0x13dcac){_0x585faf=_0x13dcac;_0x4d42d7=0xc8;}else{_0x4d42d7=0xce;}_0x580224[_0x3c17('0x1c')](_0x4d42d7);return _0x580224[_0x3c17('0x23')]('Content-Range',_0x4d130a+'-'+_0x585faf+'/'+_0x13dcac)['json'](_0x1053a7);}return null;};}function patchUpdates(_0x5a272b){return function(_0x4857a9){try{jsonpatch[_0x3c17('0x24')](_0x4857a9,_0x5a272b,!![]);}catch(_0x2f1dca){return BPromise[_0x3c17('0x25')](_0x2f1dca);}return _0x4857a9[_0x3c17('0x26')]();};}function saveUpdates(_0x3a6d71,_0x2a0903){return function(_0x209774){if(_0x209774){return _0x209774[_0x3c17('0x27')](_0x3a6d71)[_0x3c17('0x28')](function(_0x10cae9){return _0x10cae9;});}return null;};}function removeEntity(_0x4fe4c6,_0x1805a1){return function(_0x2ba712){if(_0x2ba712){return _0x2ba712['destroy']()[_0x3c17('0x28')](function(){var _0x25c32b=_0x2ba712[_0x3c17('0x29')]({'plain':!![]});var _0x4b6fc0='Variables';return db[_0x3c17('0x2a')][_0x3c17('0x2b')]({'where':{'type':_0x4b6fc0,'resourceId':_0x25c32b['id']}})[_0x3c17('0x28')](function(){return _0x2ba712;});})[_0x3c17('0x28')](function(){_0x4fe4c6[_0x3c17('0x1c')](0xcc)[_0x3c17('0x1d')]();});}};}function handleEntityNotFound(_0x3c4c81,_0xca3dd){return function(_0xa50ab3){if(!_0xa50ab3){_0x3c4c81[_0x3c17('0x1b')](0x194);}return _0xa50ab3;};}function handleError(_0x17dfb4,_0x2f596d){_0x2f596d=_0x2f596d||0x1f4;return function(_0x1ab80c){logger['error'](_0x1ab80c[_0x3c17('0x2c')]);if(_0x1ab80c[_0x3c17('0x2d')]){delete _0x1ab80c[_0x3c17('0x2d')];}_0x17dfb4['status'](_0x2f596d)[_0x3c17('0x2e')](_0x1ab80c);};}exports[_0x3c17('0x2f')]=function(_0x15e64d,_0x1760fd){var _0x1880b0={},_0xf253cf={},_0x1c3150={'count':0x0,'rows':[]};var _0x454f56=_[_0x3c17('0x30')](db[_0x3c17('0x31')][_0x3c17('0x32')],function(_0x28a25b){return{'name':_0x28a25b[_0x3c17('0x33')],'type':_0x28a25b[_0x3c17('0x34')][_0x3c17('0x35')]};});_0xf253cf[_0x3c17('0x36')]=_[_0x3c17('0x30')](_0x454f56,_0x3c17('0x2d'));_0xf253cf['query']=_[_0x3c17('0x37')](_0x15e64d['query']);_0xf253cf[_0x3c17('0x38')]=_['intersection'](_0xf253cf[_0x3c17('0x36')],_0xf253cf[_0x3c17('0x39')]);_0x1880b0[_0x3c17('0x3a')]=_[_0x3c17('0x3b')](_0xf253cf[_0x3c17('0x36')],qs[_0x3c17('0x3c')](_0x15e64d[_0x3c17('0x39')][_0x3c17('0x3c')]));_0x1880b0['attributes']=_0x1880b0[_0x3c17('0x3a')][_0x3c17('0x3d')]?_0x1880b0[_0x3c17('0x3a')]:_0xf253cf[_0x3c17('0x36')];if(!_0x15e64d[_0x3c17('0x39')][_0x3c17('0x3e')](_0x3c17('0x3f'))){_0x1880b0[_0x3c17('0x21')]=qs[_0x3c17('0x21')](_0x15e64d['query'][_0x3c17('0x21')]);_0x1880b0[_0x3c17('0x1f')]=qs[_0x3c17('0x1f')](_0x15e64d[_0x3c17('0x39')][_0x3c17('0x1f')]);}_0x1880b0[_0x3c17('0x40')]=qs[_0x3c17('0x41')](_0x15e64d[_0x3c17('0x39')][_0x3c17('0x41')]);_0x1880b0[_0x3c17('0x42')]=qs[_0x3c17('0x38')](_[_0x3c17('0x43')](_0x15e64d[_0x3c17('0x39')],_0xf253cf[_0x3c17('0x38')]),_0x454f56);if(_0x15e64d[_0x3c17('0x39')][_0x3c17('0x44')]){_0x1880b0['where']=_[_0x3c17('0x45')](_0x1880b0[_0x3c17('0x42')],{'$or':_[_0x3c17('0x30')](_0x454f56,function(_0x1b58b6){if(_0x1b58b6[_0x3c17('0x34')]!==_0x3c17('0x46')){var _0x5b1a6d={};_0x5b1a6d[_0x1b58b6[_0x3c17('0x2d')]]={'$like':'%'+_0x15e64d[_0x3c17('0x39')][_0x3c17('0x44')]+'%'};return _0x5b1a6d;}})});}_0x1880b0=_[_0x3c17('0x45')]({},_0x1880b0,_0x15e64d[_0x3c17('0x47')]);var _0x14c75b={'where':_0x1880b0[_0x3c17('0x42')]};return db[_0x3c17('0x31')][_0x3c17('0x22')](_0x14c75b)['then'](function(_0x1756e9){_0x1c3150[_0x3c17('0x22')]=_0x1756e9;if(_0x15e64d[_0x3c17('0x39')][_0x3c17('0x48')]){_0x1880b0[_0x3c17('0x49')]=[{'all':!![]}];}return db[_0x3c17('0x31')][_0x3c17('0x4a')](_0x1880b0);})[_0x3c17('0x28')](function(_0x46f822){_0x1c3150[_0x3c17('0x4b')]=_0x46f822;return _0x1c3150;})[_0x3c17('0x28')](respondWithFilteredResult(_0x1760fd,_0x1880b0))['catch'](handleError(_0x1760fd,null));};exports[_0x3c17('0x4c')]=function(_0x322f65,_0x45c89f){var _0x26a9c7={'raw':!![],'where':{'id':_0x322f65[_0x3c17('0x4d')]['id']}},_0x27e9e7={};_0x27e9e7['model']=_['keys'](db[_0x3c17('0x31')]['rawAttributes']);_0x27e9e7['query']=_[_0x3c17('0x37')](_0x322f65[_0x3c17('0x39')]);_0x27e9e7[_0x3c17('0x38')]=_[_0x3c17('0x3b')](_0x27e9e7[_0x3c17('0x36')],_0x27e9e7['query']);_0x26a9c7['attributes']=_['intersection'](_0x27e9e7['model'],qs[_0x3c17('0x3c')](_0x322f65['query'][_0x3c17('0x3c')]));_0x26a9c7[_0x3c17('0x3a')]=_0x26a9c7[_0x3c17('0x3a')]['length']?_0x26a9c7['attributes']:_0x27e9e7[_0x3c17('0x36')];if(_0x322f65['query'][_0x3c17('0x48')]){_0x26a9c7[_0x3c17('0x49')]=[{'all':!![]}];}_0x26a9c7=_[_0x3c17('0x45')]({},_0x26a9c7,_0x322f65[_0x3c17('0x47')]);return db[_0x3c17('0x31')][_0x3c17('0x4e')](_0x26a9c7)['then'](handleEntityNotFound(_0x45c89f,null))['then'](respondWithResult(_0x45c89f,null))[_0x3c17('0x4f')](handleError(_0x45c89f,null));};exports['create']=function(_0x10bb70,_0x1d0799){return db[_0x3c17('0x31')]['create'](_0x10bb70['body'],{})['then'](function(_0x994e9){var _0x47c588=_0x10bb70[_0x3c17('0x50')]['get']({'plain':!![]});if(!_0x47c588)throw new Error(_0x3c17('0x51'));if(_0x47c588[_0x3c17('0x52')]==='user'){var _0x29146c=_0x994e9[_0x3c17('0x29')]({'plain':!![]});var _0x51e1f5='Variables';return db[_0x3c17('0x53')][_0x3c17('0x4e')]({'where':{'name':_0x51e1f5,'userProfileId':_0x47c588['userProfileId']},'raw':!![]})['then'](function(_0x147caf){if(_0x147caf&&_0x147caf[_0x3c17('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x29146c[_0x3c17('0x2d')],'resourceId':_0x29146c['id'],'type':_0x147caf[_0x3c17('0x2d')],'sectionId':_0x147caf['id']},{})['then'](function(){return _0x994e9;});}else{return _0x994e9;}})[_0x3c17('0x4f')](function(_0x47469d){logger['error'](_0x3c17('0x55'),_0x47469d);throw _0x47469d;});}return _0x994e9;})['then'](respondWithResult(_0x1d0799,0xc9))['catch'](handleError(_0x1d0799,null));};exports[_0x3c17('0x27')]=function(_0x1a7f7f,_0x4b3ef){if(_0x1a7f7f[_0x3c17('0x56')]['id']){delete _0x1a7f7f['body']['id'];}return db[_0x3c17('0x31')][_0x3c17('0x4e')]({'where':{'id':_0x1a7f7f[_0x3c17('0x4d')]['id']}})[_0x3c17('0x28')](handleEntityNotFound(_0x4b3ef,null))['then'](saveUpdates(_0x1a7f7f[_0x3c17('0x56')],null))['then'](respondWithResult(_0x4b3ef,null))[_0x3c17('0x4f')](handleError(_0x4b3ef,null));};exports[_0x3c17('0x2b')]=function(_0x2396ec,_0x52673e){return db[_0x3c17('0x31')][_0x3c17('0x4e')]({'where':{'id':_0x2396ec[_0x3c17('0x4d')]['id']}})[_0x3c17('0x28')](handleEntityNotFound(_0x52673e,null))['then'](removeEntity(_0x52673e,null))[_0x3c17('0x4f')](handleError(_0x52673e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ccfaf1a..e445751 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 _0x215a=['define','Variable','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x47470f,_0x411315){var _0x5b16a4=function(_0x781291){while(--_0x781291){_0x47470f['push'](_0x47470f['shift']());}};_0x5b16a4(++_0x411315);}(_0x215a,0x160));var _0xa215=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x215a[_0x58e469];return _0x4c01c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa215('0x0'))(_0xa215('0x1'));var moment=require('moment');var BPromise=require(_0xa215('0x2'));var rp=require(_0xa215('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa215('0x4'));var config=require(_0xa215('0x5'));var attributes=require(_0xa215('0x6'));module[_0xa215('0x7')]=function(_0x5955bf,_0x52a48c){return _0x5955bf[_0xa215('0x8')](_0xa215('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bb2=['rimraf','../../config/environment','./variable.attributes','Variable','tools_variables','lodash','api','moment','request-promise','path'];(function(_0xf7bf02,_0x13da13){var _0x4f263f=function(_0x3b5603){while(--_0x3b5603){_0xf7bf02['push'](_0xf7bf02['shift']());}};_0x4f263f(++_0x13da13);}(_0x8bb2,0x14f));var _0x28bb=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x8bb2[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x28bb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x28bb('0x1'));var moment=require(_0x28bb('0x2'));var BPromise=require('bluebird');var rp=require(_0x28bb('0x3'));var fs=require('fs');var path=require(_0x28bb('0x4'));var rimraf=require(_0x28bb('0x5'));var config=require(_0x28bb('0x6'));var attributes=require(_0x28bb('0x7'));module['exports']=function(_0x954f99,_0x31fd5e){return _0x954f99['define'](_0x28bb('0x8'),attributes,{'tableName':_0x28bb('0x9'),'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 a7e0706..360aad8 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x595c1d,_0x48e097){var _0x4c65b9=function(_0x45db78){while(--_0x45db78){_0x595c1d['push'](_0x595c1d['shift']());}};_0x4c65b9(++_0x48e097);}(_0x1cb9,0x14e));var _0x91cb=function(_0x53634a,_0x506ccf){_0x53634a=_0x53634a-0x0;var _0x222e72=_0x1cb9[_0x53634a];return _0x222e72;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x502a1c,_0x3c8a0f){var _0xf4aef7=function(_0x5a15f7){while(--_0x5a15f7){_0x502a1c['push'](_0x502a1c['shift']());}};_0xf4aef7(++_0x3c8a0f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x5fc3[_0x338f73];return _0x163fdf;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c7bbcc9..112e286 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 _0x8a84=['isAuthenticated','reset','pull','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','/fetch','canUpdate','fetch','/reset'];(function(_0xe7a81f,_0x458b3d){var _0x13e1f0=function(_0x5d1aeb){while(--_0x5d1aeb){_0xe7a81f['push'](_0xe7a81f['shift']());}};_0x13e1f0(++_0x458b3d);}(_0x8a84,0x124));var _0x48a8=function(_0x57bd4f,_0x42a4f5){_0x57bd4f=_0x57bd4f-0x0;var _0x25c08f=_0x8a84[_0x57bd4f];return _0x25c08f;};'use strict';var express=require('express');var router=express[_0x48a8('0x0')]();var auth=require(_0x48a8('0x1'));var controller=require(_0x48a8('0x2'));router[_0x48a8('0x3')]('/',controller['index']);router[_0x48a8('0x3')](_0x48a8('0x4'),auth['isAuthenticated'](),auth[_0x48a8('0x5')](),controller[_0x48a8('0x6')]);router[_0x48a8('0x3')](_0x48a8('0x7'),auth[_0x48a8('0x8')](),auth['canUpdate'](),controller[_0x48a8('0x9')]);router[_0x48a8('0x3')]('/pull',auth[_0x48a8('0x8')](),auth['canUpdate'](),controller[_0x48a8('0xa')]);router[_0x48a8('0x3')]('/restart',auth['isAuthenticated'](),controller[_0x48a8('0xb')]);router['get'](_0x48a8('0xc'),controller[_0x48a8('0xd')]);module[_0x48a8('0xe')]=router; \ No newline at end of file +var _0x9fd6=['/restart','restart','/migrations','migrations','exports','express','Router','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x9fd6,0x83));var _0x69fd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9fd6[_0x42cae2];return _0x5f256f;};'use strict';var express=require(_0x69fd('0x0'));var router=express[_0x69fd('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x69fd('0x2'));router[_0x69fd('0x3')]('/',controller[_0x69fd('0x4')]);router[_0x69fd('0x3')](_0x69fd('0x5'),auth[_0x69fd('0x6')](),auth['canUpdate'](),controller[_0x69fd('0x7')]);router[_0x69fd('0x3')](_0x69fd('0x8'),auth[_0x69fd('0x6')](),auth[_0x69fd('0x9')](),controller[_0x69fd('0xa')]);router['get'](_0x69fd('0xb'),auth[_0x69fd('0x6')](),auth[_0x69fd('0x9')](),controller[_0x69fd('0xc')]);router[_0x69fd('0x3')](_0x69fd('0xd'),auth[_0x69fd('0x6')](),controller[_0x69fd('0xe')]);router[_0x69fd('0x3')](_0x69fd('0xf'),controller[_0x69fd('0x10')]);module[_0x69fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 953a804..598e083 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 _0xaa28=['path','lodash','pkginfo','version','compare-versions','child_process','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','push','sort','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug'];(function(_0x5e700a,_0x376b77){var _0x50e1e1=function(_0x347946){while(--_0x347946){_0x5e700a['push'](_0x5e700a['shift']());}};_0x50e1e1(++_0x376b77);}(_0xaa28,0x67));var _0x8aa2=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xaa28[_0x3e2fcf];return _0x497db7;};'use strict';var Umzug=require(_0x8aa2('0x0'));var path=require(_0x8aa2('0x1'));var fs=require('fs');var _=require(_0x8aa2('0x2'));var pkginfo=require(_0x8aa2('0x3'))(module,_0x8aa2('0x4'));var compareVersions=require(_0x8aa2('0x5'));var exec=require(_0x8aa2('0x6'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x8aa2('0x7'));var pm2=require(_0x8aa2('0x8'));var logger=require(_0x8aa2('0x9'))(_0x8aa2('0xa'));var git=require(_0x8aa2('0xb'))(config[_0x8aa2('0xc')]);exports[_0x8aa2('0xd')]=function(_0x5926d0,_0x290883){var _0x4d380a={'current':module[_0x8aa2('0xe')]['version'],'phonebar':0x2};if(_0x5926d0['query']&&_0x5926d0['query'][_0x8aa2('0xf')]){return git[_0x8aa2('0x10')]()[_0x8aa2('0x11')](function(_0x22137b,_0x484c75){_0x4d380a[_0x8aa2('0xf')]=(_0x22137b?module[_0x8aa2('0xe')][_0x8aa2('0x4')]:_0x484c75[_0x8aa2('0xf')])||_0x8aa2('0x12');return _0x290883[_0x8aa2('0x13')](0xc8)[_0x8aa2('0x14')](_0x4d380a);});}else{return _0x290883['status'](0xc8)[_0x8aa2('0x14')](_0x4d380a);}};exports[_0x8aa2('0x10')]=function(_0x2c0702,_0x24abfa){return git[_0x8aa2('0x10')](['origin',_0x8aa2('0x15')],function(_0x2f1549){if(_0x2f1549){logger[_0x8aa2('0x16')](_0x2f1549);return _0x24abfa[_0x8aa2('0x13')](0x1f4)[_0x8aa2('0x14')](_0x2f1549);}logger[_0x8aa2('0x17')]('git\x20fetch');return _0x24abfa[_0x8aa2('0x13')](0xc8)['json']({'output':_0x8aa2('0x18')});});};exports['reset']=function(_0x1fa450,_0xc66e6){return git[_0x8aa2('0x19')]([_0x8aa2('0x1a'),_0x8aa2('0x1b')],function(_0x358562){if(_0x358562){logger['error'](_0x358562);return _0xc66e6['status'](0x1f4)[_0x8aa2('0x14')](_0x358562);}logger[_0x8aa2('0x17')](_0x8aa2('0x1c'));return _0xc66e6[_0x8aa2('0x13')](0xc8)['json']({'output':_0x8aa2('0x1d')});});};exports[_0x8aa2('0x1e')]=function(_0x1b82a8,_0x12d12b){exec(_0x8aa2('0x1f'),function(_0x3dd11f,_0x13069b,_0x1814be){logger[_0x8aa2('0x17')](_0x13069b);logger[_0x8aa2('0x17')](_0x1814be);if(_0x3dd11f){logger['error'](_0x3dd11f);return _0x12d12b[_0x8aa2('0x13')](0x1f4)[_0x8aa2('0x14')](_0x3dd11f);}return _0x12d12b[_0x8aa2('0x13')](0xc8)['json']({'output':_0x13069b});});};exports[_0x8aa2('0x20')]=function(_0x18e21d,_0x1b9b6a){return pm2[_0x8aa2('0x20')](_0x8aa2('0x21'))[_0x8aa2('0x22')](function(_0x1cf95f){logger[_0x8aa2('0x17')]('pm2\x20restart\x20motion\x20%s',_0x1cf95f);return _0x1b9b6a[_0x8aa2('0x13')](0xc8)[_0x8aa2('0x14')]({'output':_0x8aa2('0x23')});})[_0x8aa2('0x24')](function(_0x5e4394){logger[_0x8aa2('0x16')](_0x5e4394);return _0x1b9b6a[_0x8aa2('0x13')](0x1f4)[_0x8aa2('0x14')](_0x5e4394);});};exports[_0x8aa2('0x25')]=function(_0x44b5a1,_0xe37c7b){var _0xff91de=fs['readdirSync'](path[_0x8aa2('0x26')](config[_0x8aa2('0xc')],'server','migrations'));var _0x30425d=[];for(var _0x4781eb=0x0;_0x4781eb<_0xff91de[_0x8aa2('0x27')];_0x4781eb++){var _0x49c7c7=_0xff91de[_0x4781eb][_0x8aa2('0x28')]('.js','');if(compareVersions(module[_0x8aa2('0xe')][_0x8aa2('0x4')],_0x49c7c7)===-0x1){_0x30425d[_0x8aa2('0x29')](_0x49c7c7);}}if(_0x30425d[_0x8aa2('0x27')]){var _0x341244=_0x30425d[_0x8aa2('0x2a')](compareVersions);var _0x5c121c=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x8aa2('0x4')},'migrations':{'params':[db[_0x8aa2('0x2b')][_0x8aa2('0x2c')](),db[_0x8aa2('0x2b')]['constructor'],function(){throw new Error(_0x8aa2('0x2d'));}],'path':path[_0x8aa2('0x26')](config[_0x8aa2('0xc')],_0x8aa2('0x2e'),'migrations'),'pattern':/\.js$/}});_0x5c121c['up']({'migrations':_[_0x8aa2('0x2f')](_0x341244,function(_0x3b70ed){return _0x3b70ed+'.js';})})[_0x8aa2('0x22')](function(){return _0xe37c7b[_0x8aa2('0x13')](0xc8)['json']({'output':_0x8aa2('0x30')+module[_0x8aa2('0xe')][_0x8aa2('0x4')]+_0x8aa2('0x31')+_['last'](_0x341244),'migrations':_[_0x8aa2('0x26')](_0x341244)});})[_0x8aa2('0x24')](function(_0x52f896){if(_0x52f896 instanceof db[_0x8aa2('0x2b')][_0x8aa2('0x32')]){return _0xe37c7b['status'](0xc8)[_0x8aa2('0x14')]({'output':_0x8aa2('0x33')});}else{return _0xe37c7b[_0x8aa2('0x13')](0x1f4)[_0x8aa2('0x14')](_0x52f896);}});}else{return _0xe37c7b[_0x8aa2('0x13')](0xc8)[_0x8aa2('0x14')]({'output':_0x8aa2('0x33')});}}; \ No newline at end of file +var _0x53d9=['reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','.js','sort','sequelize','Migration','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','child_process','exec','../../mysqldb','../../config/pm2','update','simple-git','root','exports','query','latest','fetch','version','status','json','origin','master','info'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x53d9,0xb4));var _0x953d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d9[_0x3dd15e];return _0x231fd0;};'use strict';var Umzug=require(_0x953d('0x0'));var path=require(_0x953d('0x1'));var fs=require('fs');var _=require(_0x953d('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x953d('0x3'))[_0x953d('0x4')];var db=require(_0x953d('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x953d('0x6'));var logger=require('../../config/logger')(_0x953d('0x7'));var git=require(_0x953d('0x8'))(config[_0x953d('0x9')]);exports['index']=function(_0x245c73,_0x3be314){var _0x30e3fb={'current':module[_0x953d('0xa')]['version'],'phonebar':0x2};if(_0x245c73[_0x953d('0xb')]&&_0x245c73[_0x953d('0xb')][_0x953d('0xc')]){return git[_0x953d('0xd')]()['tags'](function(_0x403f7d,_0xed7089){_0x30e3fb[_0x953d('0xc')]=(_0x403f7d?module[_0x953d('0xa')][_0x953d('0xe')]:_0xed7089['latest'])||'2.0.0';return _0x3be314[_0x953d('0xf')](0xc8)[_0x953d('0x10')](_0x30e3fb);});}else{return _0x3be314[_0x953d('0xf')](0xc8)[_0x953d('0x10')](_0x30e3fb);}};exports[_0x953d('0xd')]=function(_0x4feb46,_0x5aa429){return git[_0x953d('0xd')]([_0x953d('0x11'),_0x953d('0x12')],function(_0x1443e5){if(_0x1443e5){logger['error'](_0x1443e5);return _0x5aa429[_0x953d('0xf')](0x1f4)['json'](_0x1443e5);}logger[_0x953d('0x13')]('git\x20fetch');return _0x5aa429[_0x953d('0xf')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x953d('0x14')]=function(_0x2ea176,_0x46d151){return git[_0x953d('0x14')]([_0x953d('0x15'),_0x953d('0x16')],function(_0x4d3ee0){if(_0x4d3ee0){logger[_0x953d('0x17')](_0x4d3ee0);return _0x46d151[_0x953d('0xf')](0x1f4)['json'](_0x4d3ee0);}logger[_0x953d('0x13')](_0x953d('0x18'));return _0x46d151['status'](0xc8)['json']({'output':_0x953d('0x19')});});};exports[_0x953d('0x1a')]=function(_0x2aa342,_0x307b5f){exec(_0x953d('0x1b'),function(_0x292f57,_0x4c4c74,_0x503f87){logger[_0x953d('0x13')](_0x4c4c74);logger[_0x953d('0x13')](_0x503f87);if(_0x292f57){logger[_0x953d('0x17')](_0x292f57);return _0x307b5f[_0x953d('0xf')](0x1f4)['json'](_0x292f57);}return _0x307b5f[_0x953d('0xf')](0xc8)[_0x953d('0x10')]({'output':_0x4c4c74});});};exports['restart']=function(_0x5251ab,_0x580edd){return pm2[_0x953d('0x1c')](_0x953d('0x1d'))[_0x953d('0x1e')](function(_0x309c44){logger['info'](_0x953d('0x1f'),_0x309c44);return _0x580edd['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x953d('0x20')](function(_0x5cd88a){logger['error'](_0x5cd88a);return _0x580edd['status'](0x1f4)[_0x953d('0x10')](_0x5cd88a);});};exports[_0x953d('0x21')]=function(_0x3c7cd1,_0x10a0d4){var _0x4faaa2=fs[_0x953d('0x22')](path[_0x953d('0x23')](config[_0x953d('0x9')],_0x953d('0x24'),_0x953d('0x21')));var _0x599de5=[];for(var _0x93a2f6=0x0;_0x93a2f6<_0x4faaa2[_0x953d('0x25')];_0x93a2f6++){var _0x5075b8=_0x4faaa2[_0x93a2f6][_0x953d('0x26')](_0x953d('0x27'),'');if(compareVersions(module['exports']['version'],_0x5075b8)===-0x1){_0x599de5['push'](_0x5075b8);}}if(_0x599de5[_0x953d('0x25')]){var _0x2e638e=_0x599de5[_0x953d('0x28')](compareVersions);var _0x39304e=new Umzug({'storage':_0x953d('0x29'),'storageOptions':{'model':db[_0x953d('0x2a')],'modelName':'Migration','columnName':_0x953d('0xe')},'migrations':{'params':[db[_0x953d('0x29')]['getQueryInterface'](),db[_0x953d('0x29')][_0x953d('0x2b')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x953d('0x23')](config['root'],_0x953d('0x24'),_0x953d('0x21')),'pattern':/\.js$/}});_0x39304e['up']({'migrations':_[_0x953d('0x2c')](_0x2e638e,function(_0x39ca00){return _0x39ca00+_0x953d('0x27');})})[_0x953d('0x1e')](function(){return _0x10a0d4[_0x953d('0xf')](0xc8)[_0x953d('0x10')]({'output':_0x953d('0x2d')+module['exports'][_0x953d('0xe')]+_0x953d('0x2e')+_[_0x953d('0x2f')](_0x2e638e),'migrations':_['join'](_0x2e638e)});})['catch'](function(_0x3982cc){if(_0x3982cc instanceof db[_0x953d('0x29')][_0x953d('0x30')]){return _0x10a0d4[_0x953d('0xf')](0xc8)[_0x953d('0x10')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x10a0d4['status'](0x1f4)[_0x953d('0x10')](_0x3982cc);}});}else{return _0x10a0d4['status'](0xc8)[_0x953d('0x10')]({'output':_0x953d('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3862d2a..091824c 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 _0x5b3e=['create','put','update','delete','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x5b3e,0x95));var _0xe5b3=function(_0x4c6b92,_0x4c3248){_0x4c6b92=_0x4c6b92-0x0;var _0x362ee9=_0x5b3e[_0x4c6b92];return _0x362ee9;};'use strict';var multer=require('multer');var util=require(_0xe5b3('0x0'));var path=require('path');var timeout=require(_0xe5b3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe5b3('0x2'));var auth=require(_0xe5b3('0x3'));var interaction=require(_0xe5b3('0x4'));var config=require('../../config/environment');var controller=require(_0xe5b3('0x5'));router[_0xe5b3('0x6')]('/',auth['isAuthenticated'](),controller[_0xe5b3('0x7')]);router[_0xe5b3('0x6')](_0xe5b3('0x8'),auth['isAuthenticated'](),controller[_0xe5b3('0x9')]);router[_0xe5b3('0x6')](_0xe5b3('0xa'),auth[_0xe5b3('0xb')](),controller[_0xe5b3('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe5b3('0xd')]);router[_0xe5b3('0xe')](_0xe5b3('0xa'),auth[_0xe5b3('0xb')](),controller[_0xe5b3('0xf')]);router[_0xe5b3('0x10')]('/:id',auth[_0xe5b3('0xb')](),controller['destroy']);module[_0xe5b3('0x11')]=router; \ No newline at end of file +var _0x7479=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0xd65a77,_0x3b1d84){var _0x6fc063=function(_0x361881){while(--_0x361881){_0xd65a77['push'](_0xd65a77['shift']());}};_0x6fc063(++_0x3b1d84);}(_0x7479,0x162));var _0x9747=function(_0xa9fe73,_0x3b8d13){_0xa9fe73=_0xa9fe73-0x0;var _0x4a1179=_0x7479[_0xa9fe73];return _0x4a1179;};'use strict';var multer=require(_0x9747('0x0'));var util=require('util');var path=require(_0x9747('0x1'));var timeout=require(_0x9747('0x2'));var express=require(_0x9747('0x3'));var router=express[_0x9747('0x4')]();var fs_extra=require(_0x9747('0x5'));var auth=require(_0x9747('0x6'));var interaction=require(_0x9747('0x7'));var config=require(_0x9747('0x8'));var controller=require(_0x9747('0x9'));router[_0x9747('0xa')]('/',auth[_0x9747('0xb')](),controller[_0x9747('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9747('0xd')]);router[_0x9747('0xa')](_0x9747('0xe'),auth[_0x9747('0xb')](),controller[_0x9747('0xf')]);router[_0x9747('0x10')]('/',auth['isAuthenticated'](),controller[_0x9747('0x11')]);router[_0x9747('0x12')](_0x9747('0xe'),auth[_0x9747('0xb')](),controller[_0x9747('0x13')]);router[_0x9747('0x14')](_0x9747('0xe'),auth[_0x9747('0xb')](),controller[_0x9747('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1b89e96..9043165 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 _0x2b65=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x408289,_0x4a57c6){var _0x1ae330=function(_0x3f622f){while(--_0x3f622f){_0x408289['push'](_0x408289['shift']());}};_0x1ae330(++_0x4a57c6);}(_0x2b65,0x131));var _0x52b6=function(_0x38c24b,_0x5a4734){_0x38c24b=_0x38c24b-0x0;var _0x4f8737=_0x2b65[_0x38c24b];return _0x4f8737;};'use strict';var Sequelize=require(_0x52b6('0x0'));module[_0x52b6('0x1')]={'type':{'type':Sequelize[_0x52b6('0x2')]},'uniqueid':{'type':Sequelize[_0x52b6('0x2')]},'calleridnum':{'type':Sequelize[_0x52b6('0x2')]},'calleridname':{'type':Sequelize[_0x52b6('0x2')]},'queue':{'type':Sequelize[_0x52b6('0x2')]},'interface':{'type':Sequelize[_0x52b6('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x52b6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x52b6('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x52b6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x52b6('0x3')]},'agentdumpAt':{'type':Sequelize[_0x52b6('0x3')]},'holdtime':{'type':Sequelize[_0x52b6('0x4')]},'agentcomplete':{'type':Sequelize[_0x52b6('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x52b6('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x52b6('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x52b6('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x52b6('0x4')]},'reason':{'type':Sequelize[_0x52b6('0x2')]},'lastevent':{'type':Sequelize[_0x52b6('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x52b6('0x4')]},'channelstatedesc':{'type':Sequelize[_0x52b6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x52b6('0x2')]},'connectedlinename':{'type':Sequelize[_0x52b6('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x52b6('0x2')]},'context':{'type':Sequelize[_0x52b6('0x2')]},'exten':{'type':Sequelize[_0x52b6('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x52b6('0x2')]},'destchannelstate':{'type':Sequelize[_0x52b6('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x52b6('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x52b6('0x2')]},'destlanguage':{'type':Sequelize[_0x52b6('0x2')]},'destaccountcode':{'type':Sequelize[_0x52b6('0x2')]},'destcontext':{'type':Sequelize[_0x52b6('0x2')]},'destexten':{'type':Sequelize[_0x52b6('0x2')]},'destpriority':{'type':Sequelize[_0x52b6('0x2')]},'destuniqueid':{'type':Sequelize[_0x52b6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x52b6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x52b6('0x2')]},'transfer':{'type':Sequelize[_0x52b6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x52b6('0x2')],'comment':_0x52b6('0x6')},'transferexten':{'type':Sequelize[_0x52b6('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x52b6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc692=['DATE','BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xc692,0x15f));var _0x2c69=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xc692[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0x2c69('0x0'));module[_0x2c69('0x1')]={'type':{'type':Sequelize[_0x2c69('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2c69('0x2')]},'queue':{'type':Sequelize[_0x2c69('0x2')]},'interface':{'type':Sequelize[_0x2c69('0x2')]},'membername':{'type':Sequelize[_0x2c69('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2c69('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2c69('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2c69('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x2c69('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2c69('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2c69('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2c69('0x5')]},'agentacw':{'type':Sequelize[_0x2c69('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2c69('0x5')]},'reason':{'type':Sequelize[_0x2c69('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2c69('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x2c69('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2c69('0x2')]},'language':{'type':Sequelize[_0x2c69('0x2')]},'accountcode':{'type':Sequelize[_0x2c69('0x2')]},'context':{'type':Sequelize[_0x2c69('0x2')]},'exten':{'type':Sequelize[_0x2c69('0x2')]},'priority':{'type':Sequelize[_0x2c69('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x2c69('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2c69('0x2')]},'destcalleridname':{'type':Sequelize[_0x2c69('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2c69('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x2c69('0x2')]},'destlanguage':{'type':Sequelize[_0x2c69('0x2')]},'destaccountcode':{'type':Sequelize[_0x2c69('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2c69('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2c69('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2c69('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2c69('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2c69('0x2')]},'agententerreason':{'type':Sequelize[_0x2c69('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index b9f75ad..d7b30eb 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(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_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(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 3bf56d1..3e8153d 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 _0x0309=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','report_agent','destuniqueid','lodash','../../config/logger','moment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x0309,0x165));var _0x9030=function(_0x121504,_0x142181){_0x121504=_0x121504-0x0;var _0x2fe9c9=_0x0309[_0x121504];return _0x2fe9c9;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x9030('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9030('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x52a739,_0x424453){var _0x27c513=function(_0xab87cf){while(--_0xab87cf){_0x52a739['push'](_0x52a739['shift']());}};_0x27c513(++_0x424453);}(_0x8ef6,0xf2));var _0x68ef=function(_0x586292,_0x62522f){_0x586292=_0x586292-0x0;var _0x56b696=_0x8ef6[_0x586292];return _0x56b696;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x68ef('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f41a631..6ca0058 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 _0xab3a=['catch','VoiceAgentReport','create','body','options','raw','info','CreateVoiceAgentReport','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xab3a,0x180));var _0xaab3=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xab3a[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var Redis=require(_0xaab3('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xaab3('0x6'));var jayson=require(_0xaab3('0x7'));var client=jayson[_0xaab3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d1273,_0x3ca933,_0x33ef1f){return new BPromise(function(_0x3e5cee,_0x32ac91){return client['request'](_0x5d1273,_0x33ef1f)[_0xaab3('0x9')](function(_0x5e46ed){logger['info'](_0xaab3('0xa'),_0x3ca933,_0xaab3('0xb'));logger[_0xaab3('0xc')](_0xaab3('0xd'),_0x3ca933,'request\x20sent',JSON[_0xaab3('0xe')](_0x5e46ed));if(_0x5e46ed['error']){if(_0x5e46ed[_0xaab3('0xf')][_0xaab3('0x10')]===0x1f4){logger[_0xaab3('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x3ca933,_0x5e46ed[_0xaab3('0xf')][_0xaab3('0x11')]);return _0x32ac91(_0x5e46ed[_0xaab3('0xf')]['message']);}logger[_0xaab3('0xf')](_0xaab3('0xa'),_0x3ca933,_0x5e46ed['error'][_0xaab3('0x11')]);return _0x3e5cee(_0x5e46ed[_0xaab3('0xf')][_0xaab3('0x11')]);}else{logger['info'](_0xaab3('0xa'),_0x3ca933,_0xaab3('0xb'));_0x3e5cee(_0x5e46ed[_0xaab3('0x12')][_0xaab3('0x11')]);}})[_0xaab3('0x13')](function(_0x18f45b){logger['error'](_0xaab3('0xa'),_0x3ca933,_0x18f45b);_0x32ac91(_0x18f45b);});});}exports['CreateVoiceAgentReport']=function(_0xac3cd){var _0x169541=this;return new Promise(function(_0x98ff0c,_0x57d9ed){return db[_0xaab3('0x14')][_0xaab3('0x15')](_0xac3cd[_0xaab3('0x16')],{'raw':_0xac3cd[_0xaab3('0x17')]?_0xac3cd[_0xaab3('0x17')][_0xaab3('0x18')]===undefined?!![]:![]:!![]})[_0xaab3('0x9')](function(_0x489d16){logger[_0xaab3('0x19')](_0xaab3('0x1a'),_0xac3cd);logger['debug'](_0xaab3('0x1a'),_0xac3cd,JSON[_0xaab3('0xe')](_0x489d16));_0x98ff0c(_0x489d16);})['catch'](function(_0x2585ce){logger['error'](_0xaab3('0x1a'),_0x2585ce[_0xaab3('0x11')],_0xac3cd);_0x57d9ed(_0x169541[_0xaab3('0xf')](0x1f4,_0x2585ce[_0xaab3('0x11')]));});});};exports['UpdateVoiceAgentReport']=function(_0x5b8f17){var _0x2bb611=this;return new Promise(function(_0x1dae9f,_0x3021ff){return db[_0xaab3('0x14')]['update'](_0x5b8f17[_0xaab3('0x16')],{'raw':_0x5b8f17[_0xaab3('0x17')]?_0x5b8f17['options'][_0xaab3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b8f17[_0xaab3('0x17')]?_0x5b8f17['options'][_0xaab3('0x1b')]||null:null,'attributes':_0x5b8f17[_0xaab3('0x17')]?_0x5b8f17[_0xaab3('0x17')][_0xaab3('0x1c')]||null:null,'limit':_0x5b8f17[_0xaab3('0x17')]?_0x5b8f17[_0xaab3('0x17')][_0xaab3('0x1d')]||null:null})['then'](function(_0x90eba0){logger[_0xaab3('0x19')](_0xaab3('0x1e'),_0x5b8f17);logger['debug']('UpdateVoiceAgentReport',_0x5b8f17,JSON[_0xaab3('0xe')](_0x90eba0));_0x1dae9f(_0x90eba0);})[_0xaab3('0x13')](function(_0x2eca84){logger['error'](_0xaab3('0x1e'),_0x2eca84[_0xaab3('0x11')],_0x5b8f17);_0x3021ff(_0x2bb611['error'](0x1f4,_0x2eca84['message']));});});}; \ No newline at end of file +var _0x1066=['http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x58f644,_0x5e5a43){var _0xa2d5f6=function(_0x1a8f74){while(--_0x1a8f74){_0x58f644['push'](_0x58f644['shift']());}};_0xa2d5f6(++_0x5e5a43);}(_0x1066,0x153));var _0x6106=function(_0x1b4f4b,_0x20795b){_0x1b4f4b=_0x1b4f4b-0x0;var _0x5a27d2=_0x1066[_0x1b4f4b];return _0x5a27d2;};'use strict';var _=require(_0x6106('0x0'));var util=require(_0x6106('0x1'));var moment=require('moment');var BPromise=require(_0x6106('0x2'));var rs=require(_0x6106('0x3'));var fs=require('fs');var Redis=require(_0x6106('0x4'));var db=require(_0x6106('0x5'))['db'];var utils=require(_0x6106('0x6'));var logger=require('../../config/logger')(_0x6106('0x7'));var config=require(_0x6106('0x8'));var jayson=require(_0x6106('0x9'));var client=jayson[_0x6106('0xa')][_0x6106('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x228e86,_0x19b651,_0x4c27aa){return new BPromise(function(_0x2b4735,_0x384e04){return client[_0x6106('0xc')](_0x228e86,_0x4c27aa)[_0x6106('0xd')](function(_0x587a63){logger[_0x6106('0xe')](_0x6106('0xf'),_0x19b651,_0x6106('0x10'));logger['debug'](_0x6106('0x11'),_0x19b651,_0x6106('0x10'),JSON[_0x6106('0x12')](_0x587a63));if(_0x587a63['error']){if(_0x587a63[_0x6106('0x13')]['code']===0x1f4){logger[_0x6106('0x13')](_0x6106('0xf'),_0x19b651,_0x587a63[_0x6106('0x13')]['message']);return _0x384e04(_0x587a63[_0x6106('0x13')][_0x6106('0x14')]);}logger[_0x6106('0x13')](_0x6106('0xf'),_0x19b651,_0x587a63[_0x6106('0x13')][_0x6106('0x14')]);return _0x2b4735(_0x587a63[_0x6106('0x13')][_0x6106('0x14')]);}else{logger['info'](_0x6106('0xf'),_0x19b651,_0x6106('0x10'));_0x2b4735(_0x587a63[_0x6106('0x15')][_0x6106('0x14')]);}})[_0x6106('0x16')](function(_0x74d539){logger['error'](_0x6106('0xf'),_0x19b651,_0x74d539);_0x384e04(_0x74d539);});});}exports[_0x6106('0x17')]=function(_0x333fb7){var _0x48cc21=this;return new Promise(function(_0x40e16,_0xece1f9){return db[_0x6106('0x18')][_0x6106('0x19')](_0x333fb7[_0x6106('0x1a')],{'raw':_0x333fb7[_0x6106('0x1b')]?_0x333fb7['options'][_0x6106('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x31e31b){logger[_0x6106('0xe')]('CreateVoiceAgentReport',_0x333fb7);logger[_0x6106('0x1d')](_0x6106('0x17'),_0x333fb7,JSON['stringify'](_0x31e31b));_0x40e16(_0x31e31b);})['catch'](function(_0x3ad552){logger['error'](_0x6106('0x17'),_0x3ad552['message'],_0x333fb7);_0xece1f9(_0x48cc21['error'](0x1f4,_0x3ad552['message']));});});};exports[_0x6106('0x1e')]=function(_0x3ec6be){var _0x57349a=this;return new Promise(function(_0xc61b4,_0x58e9bd){return db[_0x6106('0x18')][_0x6106('0x1f')](_0x3ec6be[_0x6106('0x1a')],{'raw':_0x3ec6be[_0x6106('0x1b')]?_0x3ec6be[_0x6106('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ec6be['options']?_0x3ec6be[_0x6106('0x1b')][_0x6106('0x20')]||null:null,'attributes':_0x3ec6be[_0x6106('0x1b')]?_0x3ec6be[_0x6106('0x1b')][_0x6106('0x21')]||null:null,'limit':_0x3ec6be[_0x6106('0x1b')]?_0x3ec6be['options'][_0x6106('0x22')]||null:null})[_0x6106('0xd')](function(_0x253fed){logger['info'](_0x6106('0x1e'),_0x3ec6be);logger[_0x6106('0x1d')](_0x6106('0x1e'),_0x3ec6be,JSON[_0x6106('0x12')](_0x253fed));_0xc61b4(_0x253fed);})['catch'](function(_0x3adc29){logger['error'](_0x6106('0x1e'),_0x3adc29[_0x6106('0x14')],_0x3ec6be);_0x58e9bd(_0x57349a[_0x6106('0x13')](0x1f4,_0x3adc29['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 48620dc..9b410ca 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 _0x81bd=['../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x560e64,_0x3b0905){var _0x5a9701=function(_0x2d438b){while(--_0x2d438b){_0x560e64['push'](_0x560e64['shift']());}};_0x5a9701(++_0x3b0905);}(_0x81bd,0x7c));var _0xd81b=function(_0x2e409e,_0x2d227e){_0x2e409e=_0x2e409e-0x0;var _0xe6e039=_0x81bd[_0x2e409e];return _0xe6e039;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xd81b('0xd')]);router['get'](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')]('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x13')]);router[_0xd81b('0x14')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller['destroy']);module[_0xd81b('0x15')]=router; \ No newline at end of file +var _0x9a19=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x105732,_0x52b0ef){var _0x5be813=function(_0x4b7b60){while(--_0x4b7b60){_0x105732['push'](_0x105732['shift']());}};_0x5be813(++_0x52b0ef);}(_0x9a19,0x114));var _0x99a1=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x9a19[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var fs_extra=require(_0x99a1('0x5'));var auth=require(_0x99a1('0x6'));var interaction=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var controller=require(_0x99a1('0x9'));router[_0x99a1('0xa')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xc')]);router[_0x99a1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x99a1('0xa')](_0x99a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x99a1('0xe')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x10')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x11')]);router[_0x99a1('0x12')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x13')]);module[_0x99a1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c19ec53..726dcda 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 _0x44d9=['exports','STRING','ENUM','inbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize'];(function(_0x2d8981,_0x130f97){var _0x52a8c9=function(_0x153591){while(--_0x153591){_0x2d8981['push'](_0x2d8981['shift']());}};_0x52a8c9(++_0x130f97);}(_0x44d9,0x155));var _0x944d=function(_0x4e2c7a,_0x3cd3aa){_0x4e2c7a=_0x4e2c7a-0x0;var _0x320d36=_0x44d9[_0x4e2c7a];return _0x320d36;};'use strict';var Sequelize=require(_0x944d('0x0'));module[_0x944d('0x1')]={'uniqueid':{'type':Sequelize[_0x944d('0x2')]},'type':{'type':Sequelize[_0x944d('0x3')](_0x944d('0x4'),'internal','outbound',_0x944d('0x5'),_0x944d('0x6'),'dialer')},'tag':{'type':Sequelize[_0x944d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x944d('0x2')]},'destination':{'type':Sequelize[_0x944d('0x2')]},'destinationcontext':{'type':Sequelize[_0x944d('0x2')]},'callerid':{'type':Sequelize[_0x944d('0x2')]},'channel':{'type':Sequelize[_0x944d('0x2')]},'destinationchannel':{'type':Sequelize[_0x944d('0x2')]},'lastapplication':{'type':Sequelize[_0x944d('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x944d('0x7')]},'systemanswertime':{'type':Sequelize[_0x944d('0x7')]},'answertime':{'type':Sequelize[_0x944d('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x944d('0x8')]},'billableseconds':{'type':Sequelize[_0x944d('0x8')]},'mohtime':{'type':Sequelize[_0x944d('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x944d('0x2')]},'amaflags':{'type':Sequelize[_0x944d('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x944d('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x944d('0x2')]},'prefix':{'type':Sequelize[_0x944d('0x2')]},'routeid':{'type':Sequelize[_0x944d('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x87d0=['inbound','outbound','inbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0x87d0,0xbd));var _0x087d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x87d0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x087d('0x0'));module[_0x087d('0x1')]={'uniqueid':{'type':Sequelize[_0x087d('0x2')]},'type':{'type':Sequelize['ENUM'](_0x087d('0x3'),'internal',_0x087d('0x4'),_0x087d('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x087d('0x2')]},'source':{'type':Sequelize[_0x087d('0x2')]},'destination':{'type':Sequelize[_0x087d('0x2')]},'destinationcontext':{'type':Sequelize[_0x087d('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x087d('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x087d('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x087d('0x6')]},'systemanswertime':{'type':Sequelize[_0x087d('0x6')]},'answertime':{'type':Sequelize[_0x087d('0x6')]},'endtime':{'type':Sequelize[_0x087d('0x6')]},'duration':{'type':Sequelize[_0x087d('0x7')]},'billableseconds':{'type':Sequelize[_0x087d('0x7')]},'mohtime':{'type':Sequelize[_0x087d('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x087d('0x2')]},'amaflags':{'type':Sequelize[_0x087d('0x2')]},'userfield':{'type':Sequelize[_0x087d('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x087d('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x087d('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x087d('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x087d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7a50511..90aac13 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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x5e4087,_0x3f7e8c){var _0x4d6adb=function(_0x103167){while(--_0x103167){_0x5e4087['push'](_0x5e4087['shift']());}};_0x4d6adb(++_0x3f7e8c);}(_0xb10b,0x12a));var _0xbb10=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xb10b[_0x213518];return _0x1baf75;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x4a3828,_0x1dacf6){_0x4a3828=_0x4a3828-0x0;var _0x226429=_0x2032[_0x4a3828];return _0x226429;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c61c252..8b352d7 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 _0x6a7a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5b20d1,_0x319620){var _0x36dde5=function(_0x38d8f8){while(--_0x38d8f8){_0x5b20d1['push'](_0x5b20d1['shift']());}};_0x36dde5(++_0x319620);}(_0x6a7a,0x122));var _0xa6a7=function(_0x9efee2,_0x44b68d){_0x9efee2=_0x9efee2-0x0;var _0x323eb5=_0x6a7a[_0x9efee2];return _0x323eb5;};'use strict';var _=require(_0xa6a7('0x0'));var util=require(_0xa6a7('0x1'));var logger=require(_0xa6a7('0x2'))(_0xa6a7('0x3'));var moment=require(_0xa6a7('0x4'));var BPromise=require(_0xa6a7('0x5'));var rp=require(_0xa6a7('0x6'));var fs=require('fs');var path=require(_0xa6a7('0x7'));var rimraf=require(_0xa6a7('0x8'));var config=require(_0xa6a7('0x9'));var attributes=require(_0xa6a7('0xa'));module['exports']=function(_0x3b2200,_0x10b910){return _0x3b2200[_0xa6a7('0xb')]('VoiceCallReport',attributes,{'tableName':_0xa6a7('0xc'),'paranoid':![],'indexes':[{'fields':[_0xa6a7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cff=['VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x3d6e5c,_0x5ef70a){var _0x41cf19=function(_0x160a14){while(--_0x160a14){_0x3d6e5c['push'](_0x3d6e5c['shift']());}};_0x41cf19(++_0x5ef70a);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x1da436,_0x2fab9d){_0x1da436=_0x1da436-0x0;var _0xe4468d=_0x9cff[_0x1da436];return _0xe4468d;};'use strict';var _=require('lodash');var util=require(_0xf9cf('0x0'));var logger=require(_0xf9cf('0x1'))(_0xf9cf('0x2'));var moment=require('moment');var BPromise=require(_0xf9cf('0x3'));var rp=require(_0xf9cf('0x4'));var fs=require('fs');var path=require(_0xf9cf('0x5'));var rimraf=require('rimraf');var config=require(_0xf9cf('0x6'));var attributes=require(_0xf9cf('0x7'));module[_0xf9cf('0x8')]=function(_0x183113,_0xcacbdc){return _0x183113[_0xf9cf('0x9')](_0xf9cf('0xa'),attributes,{'tableName':_0xf9cf('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf9cf('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 88cc9fd..63b69ae 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 _0xf594=['client','http','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceCallReport,\x20%s,\x20%s','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceCallReport','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x518ea1,_0x4bb44c){var _0x5713b3=function(_0x3195ce){while(--_0x3195ce){_0x518ea1['push'](_0x518ea1['shift']());}};_0x5713b3(++_0x4bb44c);}(_0xf594,0x135));var _0x4f59=function(_0x3b7f1a,_0x72e46d){_0x3b7f1a=_0x3b7f1a-0x0;var _0x3ed753=_0xf594[_0x3b7f1a];return _0x3ed753;};'use strict';var _=require('lodash');var util=require(_0x4f59('0x0'));var moment=require('moment');var BPromise=require(_0x4f59('0x1'));var rs=require(_0x4f59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f59('0x3'));var logger=require('../../config/logger')(_0x4f59('0x4'));var config=require('../../config/environment');var jayson=require(_0x4f59('0x5'));var client=jayson[_0x4f59('0x6')][_0x4f59('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28098f,_0x29db15,_0x2ac200){return new BPromise(function(_0x227561,_0x4a7b60){return client['request'](_0x28098f,_0x2ac200)[_0x4f59('0x8')](function(_0xafc1e4){logger[_0x4f59('0x9')]('VoiceCallReport,\x20%s,\x20%s',_0x29db15,_0x4f59('0xa'));logger[_0x4f59('0xb')](_0x4f59('0xc'),_0x29db15,'request\x20sent',JSON[_0x4f59('0xd')](_0xafc1e4));if(_0xafc1e4[_0x4f59('0xe')]){if(_0xafc1e4[_0x4f59('0xe')]['code']===0x1f4){logger[_0x4f59('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x29db15,_0xafc1e4['error'][_0x4f59('0xf')]);return _0x4a7b60(_0xafc1e4[_0x4f59('0xe')]['message']);}logger[_0x4f59('0xe')](_0x4f59('0x10'),_0x29db15,_0xafc1e4[_0x4f59('0xe')]['message']);return _0x227561(_0xafc1e4[_0x4f59('0xe')][_0x4f59('0xf')]);}else{logger['info'](_0x4f59('0x10'),_0x29db15,'request\x20sent');_0x227561(_0xafc1e4[_0x4f59('0x11')][_0x4f59('0xf')]);}})[_0x4f59('0x12')](function(_0x19e622){logger['error'](_0x4f59('0x10'),_0x29db15,_0x19e622);_0x4a7b60(_0x19e622);});});}exports['GetVoiceCallReport']=function(_0x445b82){var _0x4748ee=this;return new Promise(function(_0x340920,_0x22f89a){return db[_0x4f59('0x13')][_0x4f59('0x14')]({'raw':_0x445b82[_0x4f59('0x15')]?_0x445b82[_0x4f59('0x15')][_0x4f59('0x16')]===undefined?!![]:![]:!![],'where':_0x445b82['options']?_0x445b82['options'][_0x4f59('0x17')]||null:null,'attributes':_0x445b82['options']?_0x445b82[_0x4f59('0x15')][_0x4f59('0x18')]||null:null,'limit':_0x445b82[_0x4f59('0x15')]?_0x445b82[_0x4f59('0x15')][_0x4f59('0x19')]||null:null,'include':_0x445b82[_0x4f59('0x15')]?_0x445b82[_0x4f59('0x15')]['include']?_['map'](_0x445b82[_0x4f59('0x15')][_0x4f59('0x1a')],function(_0x26cddf){return{'model':db[_0x26cddf[_0x4f59('0x1b')]],'as':_0x26cddf['as'],'attributes':_0x26cddf['attributes'],'include':_0x26cddf['include']?_[_0x4f59('0x1c')](_0x26cddf['include'],function(_0x410207){return{'model':db[_0x410207[_0x4f59('0x1b')]],'as':_0x410207['as'],'attributes':_0x410207[_0x4f59('0x18')],'include':_0x410207['include']?_[_0x4f59('0x1c')](_0x410207['include'],function(_0xf72747){return{'model':db[_0xf72747['model']],'as':_0xf72747['as'],'attributes':_0xf72747[_0x4f59('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4f59('0x8')](function(_0x4a9690){logger[_0x4f59('0x9')](_0x4f59('0x1d'),_0x445b82);logger[_0x4f59('0xb')](_0x4f59('0x1d'),_0x445b82,JSON[_0x4f59('0xd')](_0x4a9690));_0x340920(_0x4a9690);})[_0x4f59('0x12')](function(_0x26776a){logger[_0x4f59('0xe')](_0x4f59('0x1d'),_0x26776a[_0x4f59('0xf')],_0x445b82);_0x22f89a(_0x4748ee['error'](0x1f4,_0x26776a['message']));});});};exports[_0x4f59('0x1e')]=function(_0x12ed5d){var _0x138d69=this;return new Promise(function(_0x41e441,_0x337fca){return db[_0x4f59('0x13')][_0x4f59('0x1f')](_0x12ed5d['body'],{'raw':_0x12ed5d[_0x4f59('0x15')]?_0x12ed5d[_0x4f59('0x15')][_0x4f59('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2c0877){logger[_0x4f59('0x9')]('CreateVoiceCallReport',_0x12ed5d);logger[_0x4f59('0xb')](_0x4f59('0x1e'),_0x12ed5d,JSON[_0x4f59('0xd')](_0x2c0877));_0x41e441(_0x2c0877);})[_0x4f59('0x12')](function(_0x7fd283){logger[_0x4f59('0xe')](_0x4f59('0x1e'),_0x7fd283[_0x4f59('0xf')],_0x12ed5d);_0x337fca(_0x138d69['error'](0x1f4,_0x7fd283['message']));});});};exports[_0x4f59('0x20')]=function(_0x45dc47){var _0x187dd6=this;return new Promise(function(_0x4d859c,_0x180ee3){return db[_0x4f59('0x13')][_0x4f59('0x21')](_0x45dc47[_0x4f59('0x22')],{'raw':_0x45dc47[_0x4f59('0x15')]?_0x45dc47[_0x4f59('0x15')][_0x4f59('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45dc47['options']?_0x45dc47[_0x4f59('0x15')][_0x4f59('0x17')]||null:null,'attributes':_0x45dc47[_0x4f59('0x15')]?_0x45dc47[_0x4f59('0x15')][_0x4f59('0x18')]||null:null,'limit':_0x45dc47[_0x4f59('0x15')]?_0x45dc47[_0x4f59('0x15')]['limit']||null:null})[_0x4f59('0x8')](function(_0x5f05a6){logger[_0x4f59('0x9')](_0x4f59('0x20'),_0x45dc47);logger[_0x4f59('0xb')]('UpdateVoiceCallReport',_0x45dc47,JSON[_0x4f59('0xd')](_0x5f05a6));_0x4d859c(_0x5f05a6);})[_0x4f59('0x12')](function(_0x1b44d9){logger['error'](_0x4f59('0x20'),_0x1b44d9[_0x4f59('0xf')],_0x45dc47);_0x180ee3(_0x187dd6[_0x4f59('0xe')](0x1f4,_0x1b44d9['message']));});});}; \ No newline at end of file +var _0xa957=['GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','map','model','attributes','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2156c0,_0x5362b0){var _0x275307=function(_0x266e26){while(--_0x266e26){_0x2156c0['push'](_0x2156c0['shift']());}};_0x275307(++_0x5362b0);}(_0xa957,0x1cb));var _0x7a95=function(_0x2d4b0a,_0x5147ba){_0x2d4b0a=_0x2d4b0a-0x0;var _0xe59a7a=_0xa957[_0x2d4b0a];return _0xe59a7a;};'use strict';var _=require(_0x7a95('0x0'));var util=require('util');var moment=require(_0x7a95('0x1'));var BPromise=require(_0x7a95('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a95('0x3'));var db=require(_0x7a95('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a95('0x5'))(_0x7a95('0x6'));var config=require(_0x7a95('0x7'));var jayson=require(_0x7a95('0x8'));var client=jayson['client'][_0x7a95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x276fbc,_0x448f6c,_0x565117){return new BPromise(function(_0x433d2b,_0x15818c){return client[_0x7a95('0xa')](_0x276fbc,_0x565117)[_0x7a95('0xb')](function(_0x152021){logger[_0x7a95('0xc')](_0x7a95('0xd'),_0x448f6c,'request\x20sent');logger[_0x7a95('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x448f6c,_0x7a95('0xf'),JSON[_0x7a95('0x10')](_0x152021));if(_0x152021[_0x7a95('0x11')]){if(_0x152021['error'][_0x7a95('0x12')]===0x1f4){logger['error'](_0x7a95('0xd'),_0x448f6c,_0x152021['error'][_0x7a95('0x13')]);return _0x15818c(_0x152021['error']['message']);}logger[_0x7a95('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x448f6c,_0x152021['error'][_0x7a95('0x13')]);return _0x433d2b(_0x152021[_0x7a95('0x11')][_0x7a95('0x13')]);}else{logger[_0x7a95('0xc')](_0x7a95('0xd'),_0x448f6c,'request\x20sent');_0x433d2b(_0x152021[_0x7a95('0x14')][_0x7a95('0x13')]);}})[_0x7a95('0x15')](function(_0x5200bc){logger[_0x7a95('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x448f6c,_0x5200bc);_0x15818c(_0x5200bc);});});}exports[_0x7a95('0x16')]=function(_0x3c9fdf){var _0x490f36=this;return new Promise(function(_0x6fce4f,_0x4c6415){return db[_0x7a95('0x17')][_0x7a95('0x18')]({'raw':_0x3c9fdf['options']?_0x3c9fdf[_0x7a95('0x19')][_0x7a95('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c9fdf['options']?_0x3c9fdf[_0x7a95('0x19')][_0x7a95('0x1b')]||null:null,'attributes':_0x3c9fdf[_0x7a95('0x19')]?_0x3c9fdf[_0x7a95('0x19')]['attributes']||null:null,'limit':_0x3c9fdf['options']?_0x3c9fdf['options'][_0x7a95('0x1c')]||null:null,'include':_0x3c9fdf[_0x7a95('0x19')]?_0x3c9fdf[_0x7a95('0x19')][_0x7a95('0x1d')]?_[_0x7a95('0x1e')](_0x3c9fdf['options']['include'],function(_0x222d9f){return{'model':db[_0x222d9f[_0x7a95('0x1f')]],'as':_0x222d9f['as'],'attributes':_0x222d9f[_0x7a95('0x20')],'include':_0x222d9f[_0x7a95('0x1d')]?_[_0x7a95('0x1e')](_0x222d9f[_0x7a95('0x1d')],function(_0x422fba){return{'model':db[_0x422fba['model']],'as':_0x422fba['as'],'attributes':_0x422fba[_0x7a95('0x20')],'include':_0x422fba[_0x7a95('0x1d')]?_[_0x7a95('0x1e')](_0x422fba[_0x7a95('0x1d')],function(_0x3cc574){return{'model':db[_0x3cc574[_0x7a95('0x1f')]],'as':_0x3cc574['as'],'attributes':_0x3cc574[_0x7a95('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7a95('0xb')](function(_0x1a6585){logger[_0x7a95('0xc')]('GetVoiceCallReport',_0x3c9fdf);logger[_0x7a95('0xe')](_0x7a95('0x16'),_0x3c9fdf,JSON[_0x7a95('0x10')](_0x1a6585));_0x6fce4f(_0x1a6585);})['catch'](function(_0x5935ed){logger[_0x7a95('0x11')](_0x7a95('0x16'),_0x5935ed['message'],_0x3c9fdf);_0x4c6415(_0x490f36['error'](0x1f4,_0x5935ed[_0x7a95('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x4e7697){var _0x2c4c97=this;return new Promise(function(_0x4f1faf,_0x3ee4c9){return db[_0x7a95('0x17')]['create'](_0x4e7697[_0x7a95('0x21')],{'raw':_0x4e7697[_0x7a95('0x19')]?_0x4e7697[_0x7a95('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x7a95('0xb')](function(_0x1690b9){logger[_0x7a95('0xc')](_0x7a95('0x22'),_0x4e7697);logger[_0x7a95('0xe')]('CreateVoiceCallReport',_0x4e7697,JSON[_0x7a95('0x10')](_0x1690b9));_0x4f1faf(_0x1690b9);})[_0x7a95('0x15')](function(_0x2db095){logger[_0x7a95('0x11')]('CreateVoiceCallReport',_0x2db095[_0x7a95('0x13')],_0x4e7697);_0x3ee4c9(_0x2c4c97[_0x7a95('0x11')](0x1f4,_0x2db095[_0x7a95('0x13')]));});});};exports[_0x7a95('0x23')]=function(_0xaa7175){var _0x113cdf=this;return new Promise(function(_0x54b75e,_0x9640fa){return db[_0x7a95('0x17')][_0x7a95('0x24')](_0xaa7175[_0x7a95('0x21')],{'raw':_0xaa7175[_0x7a95('0x19')]?_0xaa7175[_0x7a95('0x19')][_0x7a95('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaa7175[_0x7a95('0x19')]?_0xaa7175[_0x7a95('0x19')]['where']||null:null,'attributes':_0xaa7175[_0x7a95('0x19')]?_0xaa7175[_0x7a95('0x19')]['attributes']||null:null,'limit':_0xaa7175[_0x7a95('0x19')]?_0xaa7175[_0x7a95('0x19')][_0x7a95('0x1c')]||null:null})[_0x7a95('0xb')](function(_0x30cf2d){logger['info'](_0x7a95('0x23'),_0xaa7175);logger[_0x7a95('0xe')]('UpdateVoiceCallReport',_0xaa7175,JSON['stringify'](_0x30cf2d));_0x54b75e(_0x30cf2d);})['catch'](function(_0x7eae2e){logger[_0x7a95('0x11')](_0x7a95('0x23'),_0x7eae2e[_0x7a95('0x13')],_0xaa7175);_0x9640fa(_0x113cdf[_0x7a95('0x11')](0x1f4,_0x7eae2e[_0x7a95('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 8d3d82e..8c1afa9 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 _0xcccb=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a9ceb,_0x1f1ab2){var _0x1d0c8a=function(_0x4ed891){while(--_0x4ed891){_0x5a9ceb['push'](_0x5a9ceb['shift']());}};_0x1d0c8a(++_0x1f1ab2);}(_0xcccb,0xe6));var _0xbccc=function(_0x58e00c,_0x5053e9){_0x58e00c=_0x58e00c-0x0;var _0x16834a=_0xcccb[_0x58e00c];return _0x16834a;};'use strict';var multer=require(_0xbccc('0x0'));var util=require(_0xbccc('0x1'));var path=require('path');var timeout=require(_0xbccc('0x2'));var express=require(_0xbccc('0x3'));var router=express[_0xbccc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbccc('0x5'));var interaction=require(_0xbccc('0x6'));var config=require(_0xbccc('0x7'));var controller=require(_0xbccc('0x8'));router[_0xbccc('0x9')]('/',auth[_0xbccc('0xa')](),controller[_0xbccc('0xb')]);router[_0xbccc('0x9')](_0xbccc('0xc'),auth['isAuthenticated'](),controller[_0xbccc('0xd')]);router[_0xbccc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbccc('0xf')](_0xbccc('0xc'),auth[_0xbccc('0xa')](),controller[_0xbccc('0x10')]);router['delete'](_0xbccc('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9b14=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3fc287,_0x5c3f36){var _0x33af9f=function(_0x27cfc6){while(--_0x27cfc6){_0x3fc287['push'](_0x3fc287['shift']());}};_0x33af9f(++_0x5c3f36);}(_0x9b14,0xb8));var _0x49b1=function(_0x20634c,_0x5534fc){_0x20634c=_0x20634c-0x0;var _0x5d8936=_0x9b14[_0x20634c];return _0x5d8936;};'use strict';var multer=require(_0x49b1('0x0'));var util=require(_0x49b1('0x1'));var path=require(_0x49b1('0x2'));var timeout=require(_0x49b1('0x3'));var express=require('express');var router=express[_0x49b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x49b1('0x5'));var interaction=require(_0x49b1('0x6'));var config=require(_0x49b1('0x7'));var controller=require('./voiceChanSpy.controller');router[_0x49b1('0x8')]('/',auth[_0x49b1('0x9')](),controller[_0x49b1('0xa')]);router[_0x49b1('0x8')](_0x49b1('0xb'),auth[_0x49b1('0x9')](),controller[_0x49b1('0xc')]);router[_0x49b1('0xd')]('/',auth['isAuthenticated'](),controller[_0x49b1('0xe')]);router[_0x49b1('0xf')](_0x49b1('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x49b1('0x10')](_0x49b1('0xb'),auth[_0x49b1('0x9')](),controller[_0x49b1('0x11')]);module[_0x49b1('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index bcf95b4..e570651 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 _0xd8f8=['join','getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x538b47,_0x24b300){var _0x29d2df=function(_0x505219){while(--_0x505219){_0x538b47['push'](_0x538b47['shift']());}};_0x29d2df(++_0x24b300);}(_0xd8f8,0x10a));var _0x8d8f=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xd8f8[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require(_0x8d8f('0x0'));module[_0x8d8f('0x1')]={'name':{'type':Sequelize[_0x8d8f('0x2')]},'prefix':{'type':Sequelize[_0x8d8f('0x2')],'unique':_0x8d8f('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x8d8f('0x2')],'set':function(_0x40a371){this['setDataValue']('options',_0x40a371?_0x40a371[_0x8d8f('0x4')](''):[]);},'get':function(){return this[_0x8d8f('0x5')]('options')?this['getDataValue'](_0x8d8f('0x6'))[_0x8d8f('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x8d8f('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8d8f('0x2')]},'description':{'type':Sequelize[_0x8d8f('0x2')]}}; \ No newline at end of file +var _0x2ae6=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','options','join'];(function(_0x4d869a,_0x4c7344){var _0x11ad01=function(_0x10e34f){while(--_0x10e34f){_0x4d869a['push'](_0x4d869a['shift']());}};_0x11ad01(++_0x4c7344);}(_0x2ae6,0xeb));var _0x62ae=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x2ae6[_0x547456];return _0xc1fd7b;};'use strict';var Sequelize=require(_0x62ae('0x0'));module[_0x62ae('0x1')]={'name':{'type':Sequelize[_0x62ae('0x2')]},'prefix':{'type':Sequelize[_0x62ae('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5e7b02){this['setDataValue'](_0x62ae('0x3'),_0x5e7b02?_0x5e7b02[_0x62ae('0x4')](''):[]);},'get':function(){return this[_0x62ae('0x5')](_0x62ae('0x3'))?this[_0x62ae('0x5')](_0x62ae('0x3'))[_0x62ae('0x6')](''):[];}},'auth':{'type':Sequelize[_0x62ae('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x62ae('0x2')]},'record':{'type':Sequelize[_0x62ae('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x62ae('0x2')]},'description':{'type':Sequelize[_0x62ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 6dd0dc6..8f196c9 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 _0x8696=['create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find'];(function(_0x5ba6e8,_0xdccb96){var _0x559e90=function(_0x1a27a5){while(--_0x1a27a5){_0x5ba6e8['push'](_0x5ba6e8['shift']());}};_0x559e90(++_0xdccb96);}(_0x8696,0x143));var _0x6869=function(_0x1bbe3e,_0x577923){_0x1bbe3e=_0x1bbe3e-0x0;var _0x1f6a38=_0x8696[_0x1bbe3e];return _0x1f6a38;};'use strict';var emlformat=require(_0x6869('0x0'));var rimraf=require(_0x6869('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6869('0x2'));var rp=require('request-promise');var moment=require(_0x6869('0x3'));var BPromise=require(_0x6869('0x4'));var Mustache=require(_0x6869('0x5'));var util=require('util');var path=require(_0x6869('0x6'));var sox=require('sox');var csv=require(_0x6869('0x7'));var ejs=require(_0x6869('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6869('0x9'));var crypto=require(_0x6869('0xa'));var jsforce=require(_0x6869('0xb'));var deskjs=require(_0x6869('0xc'));var toCsv=require(_0x6869('0x7'));var querystring=require(_0x6869('0xd'));var Papa=require(_0x6869('0xe'));var Redis=require('ioredis');var authService=require(_0x6869('0xf'));var qs=require(_0x6869('0x10'));var as=require(_0x6869('0x11'));var hardwareService=require(_0x6869('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6869('0x13'));var licenseUtil=require(_0x6869('0x14'));var db=require(_0x6869('0x15'))['db'];function respondWithStatusCode(_0x470a8d,_0x42958f){_0x42958f=_0x42958f||0xcc;return function(_0x5936ef){if(_0x5936ef){return _0x470a8d[_0x6869('0x16')](_0x42958f);}return _0x470a8d[_0x6869('0x17')](_0x42958f)['end']();};}function respondWithResult(_0xc603fc,_0x3d5c59){_0x3d5c59=_0x3d5c59||0xc8;return function(_0x1fda61){if(_0x1fda61){return _0xc603fc['status'](_0x3d5c59)[_0x6869('0x18')](_0x1fda61);}};}function respondWithFilteredResult(_0x4f943b,_0x16f86f){return function(_0x4e5705){if(_0x4e5705){var _0x143f04=typeof _0x16f86f[_0x6869('0x19')]===_0x6869('0x1a')&&typeof _0x16f86f[_0x6869('0x1b')]==='undefined';var _0x7d83d0=_0x4e5705[_0x6869('0x1c')];var _0x36da1f=_0x143f04?0x0:_0x16f86f['offset'];var _0x327094=_0x143f04?_0x4e5705[_0x6869('0x1c')]:_0x16f86f['offset']+_0x16f86f['limit'];var _0x333809;if(_0x327094>=_0x7d83d0){_0x327094=_0x7d83d0;_0x333809=0xc8;}else{_0x333809=0xce;}_0x4f943b['status'](_0x333809);return _0x4f943b[_0x6869('0x1d')](_0x6869('0x1e'),_0x36da1f+'-'+_0x327094+'/'+_0x7d83d0)['json'](_0x4e5705);}return null;};}function patchUpdates(_0x19259a){return function(_0x18b29e){try{jsonpatch['apply'](_0x18b29e,_0x19259a,!![]);}catch(_0x23d1a8){return BPromise[_0x6869('0x1f')](_0x23d1a8);}return _0x18b29e[_0x6869('0x20')]();};}function saveUpdates(_0x45c0ce,_0xb775a7){return function(_0x22c5cf){if(_0x22c5cf){return _0x22c5cf['update'](_0x45c0ce)['then'](function(_0x64583e){return _0x64583e;});}return null;};}function removeEntity(_0x1dc71e,_0x35f962){return function(_0x4e37ff){if(_0x4e37ff){return _0x4e37ff['destroy']()[_0x6869('0x21')](function(){var _0x220cb2=_0x4e37ff['get']({'plain':!![]});var _0x44e798=_0x6869('0x22');return db[_0x6869('0x23')]['destroy']({'where':{'type':_0x44e798,'resourceId':_0x220cb2['id']}})['then'](function(){return _0x4e37ff;});})[_0x6869('0x21')](function(){_0x1dc71e[_0x6869('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x424e44,_0x317225){return function(_0x35d9c4){if(!_0x35d9c4){_0x424e44[_0x6869('0x16')](0x194);}return _0x35d9c4;};}function handleError(_0x285d11,_0x25842e){_0x25842e=_0x25842e||0x1f4;return function(_0x551650){logger['error'](_0x551650[_0x6869('0x24')]);if(_0x551650[_0x6869('0x25')]){delete _0x551650[_0x6869('0x25')];}_0x285d11[_0x6869('0x17')](_0x25842e)[_0x6869('0x26')](_0x551650);};}exports[_0x6869('0x27')]=function(_0x81cfb8,_0x4c735f){var _0x389166={},_0x1eabdb={},_0x21b3ee={'count':0x0,'rows':[]};var _0x130bba=_[_0x6869('0x28')](db[_0x6869('0x29')][_0x6869('0x2a')],function(_0x59343b){return{'name':_0x59343b['fieldName'],'type':_0x59343b[_0x6869('0x2b')][_0x6869('0x2c')]};});_0x1eabdb[_0x6869('0x2d')]=_[_0x6869('0x28')](_0x130bba,'name');_0x1eabdb[_0x6869('0x2e')]=_[_0x6869('0x2f')](_0x81cfb8[_0x6869('0x2e')]);_0x1eabdb[_0x6869('0x30')]=_[_0x6869('0x31')](_0x1eabdb[_0x6869('0x2d')],_0x1eabdb[_0x6869('0x2e')]);_0x389166[_0x6869('0x32')]=_['intersection'](_0x1eabdb[_0x6869('0x2d')],qs[_0x6869('0x33')](_0x81cfb8[_0x6869('0x2e')][_0x6869('0x33')]));_0x389166[_0x6869('0x32')]=_0x389166['attributes']['length']?_0x389166[_0x6869('0x32')]:_0x1eabdb[_0x6869('0x2d')];if(!_0x81cfb8['query'][_0x6869('0x34')]('nolimit')){_0x389166[_0x6869('0x1b')]=qs[_0x6869('0x1b')](_0x81cfb8[_0x6869('0x2e')]['limit']);_0x389166['offset']=qs[_0x6869('0x19')](_0x81cfb8[_0x6869('0x2e')][_0x6869('0x19')]);}_0x389166['order']=qs['sort'](_0x81cfb8[_0x6869('0x2e')][_0x6869('0x35')]);_0x389166[_0x6869('0x36')]=qs[_0x6869('0x30')](_[_0x6869('0x37')](_0x81cfb8[_0x6869('0x2e')],_0x1eabdb[_0x6869('0x30')]),_0x130bba);if(_0x81cfb8[_0x6869('0x2e')][_0x6869('0x38')]){_0x389166[_0x6869('0x36')]=_[_0x6869('0x39')](_0x389166[_0x6869('0x36')],{'$or':_[_0x6869('0x28')](_0x130bba,function(_0x1013aa){if(_0x1013aa[_0x6869('0x2b')]!==_0x6869('0x3a')){var _0x9bc091={};_0x9bc091[_0x1013aa[_0x6869('0x25')]]={'$like':'%'+_0x81cfb8['query'][_0x6869('0x38')]+'%'};return _0x9bc091;}})});}_0x389166=_[_0x6869('0x39')]({},_0x389166,_0x81cfb8[_0x6869('0x3b')]);var _0x22bdc3={'where':_0x389166[_0x6869('0x36')]};return db[_0x6869('0x29')]['count'](_0x22bdc3)[_0x6869('0x21')](function(_0x1d223c){_0x21b3ee[_0x6869('0x1c')]=_0x1d223c;if(_0x81cfb8['query']['includeAll']){_0x389166[_0x6869('0x3c')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x6869('0x3d')](_0x389166);})[_0x6869('0x21')](function(_0x462a4f){_0x21b3ee[_0x6869('0x3e')]=_0x462a4f;return _0x21b3ee;})['then'](respondWithFilteredResult(_0x4c735f,_0x389166))[_0x6869('0x3f')](handleError(_0x4c735f,null));};exports['show']=function(_0x3a193e,_0x17da6a){var _0x470647={'raw':![],'where':{'id':_0x3a193e[_0x6869('0x40')]['id']}},_0x29fead={};_0x29fead[_0x6869('0x2d')]=_[_0x6869('0x2f')](db[_0x6869('0x29')][_0x6869('0x2a')]);_0x29fead[_0x6869('0x2e')]=_['keys'](_0x3a193e[_0x6869('0x2e')]);_0x29fead[_0x6869('0x30')]=_['intersection'](_0x29fead['model'],_0x29fead[_0x6869('0x2e')]);_0x470647[_0x6869('0x32')]=_[_0x6869('0x31')](_0x29fead[_0x6869('0x2d')],qs[_0x6869('0x33')](_0x3a193e['query'][_0x6869('0x33')]));_0x470647[_0x6869('0x32')]=_0x470647[_0x6869('0x32')]['length']?_0x470647[_0x6869('0x32')]:_0x29fead[_0x6869('0x2d')];if(_0x3a193e[_0x6869('0x2e')][_0x6869('0x41')]){_0x470647[_0x6869('0x3c')]=[{'all':!![]}];}_0x470647=_[_0x6869('0x39')]({},_0x470647,_0x3a193e[_0x6869('0x3b')]);return db[_0x6869('0x29')][_0x6869('0x42')](_0x470647)[_0x6869('0x21')](handleEntityNotFound(_0x17da6a,null))[_0x6869('0x21')](respondWithResult(_0x17da6a,null))[_0x6869('0x3f')](handleError(_0x17da6a,null));};exports[_0x6869('0x43')]=function(_0x50719c,_0x1b8109){return db[_0x6869('0x29')][_0x6869('0x43')](_0x50719c['body'],{})[_0x6869('0x21')](function(_0x318c4f){var _0x487c09=_0x50719c['user'][_0x6869('0x44')]({'plain':!![]});if(!_0x487c09)throw new Error(_0x6869('0x45'));if(_0x487c09['role']===_0x6869('0x46')){var _0x1f7fc0=_0x318c4f['get']({'plain':!![]});var _0x1e7b44=_0x6869('0x22');return db[_0x6869('0x47')][_0x6869('0x42')]({'where':{'name':_0x1e7b44,'userProfileId':_0x487c09[_0x6869('0x48')]},'raw':!![]})[_0x6869('0x21')](function(_0x130c6c){if(_0x130c6c&&_0x130c6c[_0x6869('0x49')]===0x0){return db[_0x6869('0x23')][_0x6869('0x43')]({'name':_0x1f7fc0[_0x6869('0x25')],'resourceId':_0x1f7fc0['id'],'type':_0x130c6c[_0x6869('0x25')],'sectionId':_0x130c6c['id']},{})[_0x6869('0x21')](function(){return _0x318c4f;});}else{return _0x318c4f;}})[_0x6869('0x3f')](function(_0x57aee8){logger[_0x6869('0x4a')](_0x6869('0x4b'),_0x57aee8);throw _0x57aee8;});}return _0x318c4f;})['then'](respondWithResult(_0x1b8109,0xc9))['catch'](handleError(_0x1b8109,null));};exports[_0x6869('0x4c')]=function(_0x8f4072,_0x1cda9c){if(_0x8f4072['body']['id']){delete _0x8f4072[_0x6869('0x4d')]['id'];}return db['VoiceChanSpy'][_0x6869('0x42')]({'where':{'id':_0x8f4072['params']['id']}})[_0x6869('0x21')](handleEntityNotFound(_0x1cda9c,null))[_0x6869('0x21')](saveUpdates(_0x8f4072['body'],null))[_0x6869('0x21')](respondWithResult(_0x1cda9c,null))['catch'](handleError(_0x1cda9c,null));};exports['destroy']=function(_0x2d2383,_0x2eaaef){return db[_0x6869('0x29')][_0x6869('0x42')]({'where':{'id':_0x2d2383['params']['id']}})[_0x6869('0x21')](handleEntityNotFound(_0x2eaaef,null))[_0x6869('0x21')](removeEntity(_0x2eaaef,null))[_0x6869('0x3f')](handleError(_0x2eaaef,null));}; \ No newline at end of file +var _0xdfe9=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','VoiceChanSpy','rawAttributes','type','key','query','keys','intersection'];(function(_0x3c815e,_0x3d8105){var _0xf66654=function(_0x55cf6b){while(--_0x55cf6b){_0x3c815e['push'](_0x3c815e['shift']());}};_0xf66654(++_0x3d8105);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x2997ed,_0x4aae04){_0x2997ed=_0x2997ed-0x0;var _0x2dfeba=_0xdfe9[_0x2997ed];return _0x2dfeba;};'use strict';var emlformat=require(_0x9dfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9dfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9dfe('0x2'));var BPromise=require(_0x9dfe('0x3'));var Mustache=require(_0x9dfe('0x4'));var util=require(_0x9dfe('0x5'));var path=require(_0x9dfe('0x6'));var sox=require(_0x9dfe('0x7'));var csv=require(_0x9dfe('0x8'));var ejs=require(_0x9dfe('0x9'));var fs=require('fs');var fs_extra=require(_0x9dfe('0xa'));var _=require(_0x9dfe('0xb'));var squel=require(_0x9dfe('0xc'));var crypto=require('crypto');var jsforce=require(_0x9dfe('0xd'));var deskjs=require(_0x9dfe('0xe'));var toCsv=require(_0x9dfe('0x8'));var querystring=require(_0x9dfe('0xf'));var Papa=require(_0x9dfe('0x10'));var Redis=require(_0x9dfe('0x11'));var authService=require(_0x9dfe('0x12'));var qs=require(_0x9dfe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dfe('0x14'));var logger=require(_0x9dfe('0x15'))(_0x9dfe('0x16'));var utils=require(_0x9dfe('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9dfe('0x18'))['db'];function respondWithStatusCode(_0x1f3678,_0x4da42d){_0x4da42d=_0x4da42d||0xcc;return function(_0x547ae1){if(_0x547ae1){return _0x1f3678['sendStatus'](_0x4da42d);}return _0x1f3678[_0x9dfe('0x19')](_0x4da42d)[_0x9dfe('0x1a')]();};}function respondWithResult(_0x2a7734,_0x12794d){_0x12794d=_0x12794d||0xc8;return function(_0x189edc){if(_0x189edc){return _0x2a7734[_0x9dfe('0x19')](_0x12794d)[_0x9dfe('0x1b')](_0x189edc);}};}function respondWithFilteredResult(_0x7e1918,_0x316205){return function(_0x56c864){if(_0x56c864){var _0x538be3=typeof _0x316205[_0x9dfe('0x1c')]==='undefined'&&typeof _0x316205[_0x9dfe('0x1d')]===_0x9dfe('0x1e');var _0xc5e804=_0x56c864[_0x9dfe('0x1f')];var _0x15e32b=_0x538be3?0x0:_0x316205[_0x9dfe('0x1c')];var _0x5c7158=_0x538be3?_0x56c864[_0x9dfe('0x1f')]:_0x316205[_0x9dfe('0x1c')]+_0x316205[_0x9dfe('0x1d')];var _0x145e4d;if(_0x5c7158>=_0xc5e804){_0x5c7158=_0xc5e804;_0x145e4d=0xc8;}else{_0x145e4d=0xce;}_0x7e1918[_0x9dfe('0x19')](_0x145e4d);return _0x7e1918[_0x9dfe('0x20')](_0x9dfe('0x21'),_0x15e32b+'-'+_0x5c7158+'/'+_0xc5e804)[_0x9dfe('0x1b')](_0x56c864);}return null;};}function patchUpdates(_0x439cd4){return function(_0x1cf33d){try{jsonpatch[_0x9dfe('0x22')](_0x1cf33d,_0x439cd4,!![]);}catch(_0x2971b){return BPromise[_0x9dfe('0x23')](_0x2971b);}return _0x1cf33d[_0x9dfe('0x24')]();};}function saveUpdates(_0x54ee52,_0x484f22){return function(_0x35cb5c){if(_0x35cb5c){return _0x35cb5c[_0x9dfe('0x25')](_0x54ee52)[_0x9dfe('0x26')](function(_0x12ef2a){return _0x12ef2a;});}return null;};}function removeEntity(_0x30f0cd,_0x3da663){return function(_0x3354b7){if(_0x3354b7){return _0x3354b7[_0x9dfe('0x27')]()[_0x9dfe('0x26')](function(){var _0xf7fc28=_0x3354b7[_0x9dfe('0x28')]({'plain':!![]});var _0x512599='ChanSpies';return db[_0x9dfe('0x29')][_0x9dfe('0x27')]({'where':{'type':_0x512599,'resourceId':_0xf7fc28['id']}})['then'](function(){return _0x3354b7;});})[_0x9dfe('0x26')](function(){_0x30f0cd[_0x9dfe('0x19')](0xcc)[_0x9dfe('0x1a')]();});}};}function handleEntityNotFound(_0x5bb850,_0x2fba44){return function(_0xac36fc){if(!_0xac36fc){_0x5bb850[_0x9dfe('0x2a')](0x194);}return _0xac36fc;};}function handleError(_0x29a127,_0x2c8a09){_0x2c8a09=_0x2c8a09||0x1f4;return function(_0x4ae7ad){logger[_0x9dfe('0x2b')](_0x4ae7ad['stack']);if(_0x4ae7ad[_0x9dfe('0x2c')]){delete _0x4ae7ad[_0x9dfe('0x2c')];}_0x29a127[_0x9dfe('0x19')](_0x2c8a09)[_0x9dfe('0x2d')](_0x4ae7ad);};}exports[_0x9dfe('0x2e')]=function(_0x10c2d4,_0x3bf281){var _0x222cea={},_0x4de29c={},_0x580bd4={'count':0x0,'rows':[]};var _0x458521=_['map'](db[_0x9dfe('0x2f')][_0x9dfe('0x30')],function(_0x2fe43e){return{'name':_0x2fe43e['fieldName'],'type':_0x2fe43e[_0x9dfe('0x31')][_0x9dfe('0x32')]};});_0x4de29c['model']=_['map'](_0x458521,_0x9dfe('0x2c'));_0x4de29c[_0x9dfe('0x33')]=_[_0x9dfe('0x34')](_0x10c2d4[_0x9dfe('0x33')]);_0x4de29c['filters']=_[_0x9dfe('0x35')](_0x4de29c[_0x9dfe('0x36')],_0x4de29c[_0x9dfe('0x33')]);_0x222cea[_0x9dfe('0x37')]=_[_0x9dfe('0x35')](_0x4de29c['model'],qs[_0x9dfe('0x38')](_0x10c2d4[_0x9dfe('0x33')][_0x9dfe('0x38')]));_0x222cea[_0x9dfe('0x37')]=_0x222cea[_0x9dfe('0x37')][_0x9dfe('0x39')]?_0x222cea[_0x9dfe('0x37')]:_0x4de29c['model'];if(!_0x10c2d4[_0x9dfe('0x33')][_0x9dfe('0x3a')](_0x9dfe('0x3b'))){_0x222cea[_0x9dfe('0x1d')]=qs[_0x9dfe('0x1d')](_0x10c2d4['query'][_0x9dfe('0x1d')]);_0x222cea[_0x9dfe('0x1c')]=qs['offset'](_0x10c2d4[_0x9dfe('0x33')]['offset']);}_0x222cea[_0x9dfe('0x3c')]=qs[_0x9dfe('0x3d')](_0x10c2d4[_0x9dfe('0x33')][_0x9dfe('0x3d')]);_0x222cea[_0x9dfe('0x3e')]=qs['filters'](_['pick'](_0x10c2d4[_0x9dfe('0x33')],_0x4de29c[_0x9dfe('0x3f')]),_0x458521);if(_0x10c2d4['query'][_0x9dfe('0x40')]){_0x222cea['where']=_[_0x9dfe('0x41')](_0x222cea['where'],{'$or':_['map'](_0x458521,function(_0x5cd65d){if(_0x5cd65d[_0x9dfe('0x31')]!=='VIRTUAL'){var _0x4a1c6f={};_0x4a1c6f[_0x5cd65d[_0x9dfe('0x2c')]]={'$like':'%'+_0x10c2d4['query'][_0x9dfe('0x40')]+'%'};return _0x4a1c6f;}})});}_0x222cea=_[_0x9dfe('0x41')]({},_0x222cea,_0x10c2d4[_0x9dfe('0x42')]);var _0x207454={'where':_0x222cea[_0x9dfe('0x3e')]};return db[_0x9dfe('0x2f')][_0x9dfe('0x1f')](_0x207454)[_0x9dfe('0x26')](function(_0x340f34){_0x580bd4[_0x9dfe('0x1f')]=_0x340f34;if(_0x10c2d4[_0x9dfe('0x33')][_0x9dfe('0x43')]){_0x222cea[_0x9dfe('0x44')]=[{'all':!![]}];}return db[_0x9dfe('0x2f')][_0x9dfe('0x45')](_0x222cea);})[_0x9dfe('0x26')](function(_0x5dfa4b){_0x580bd4[_0x9dfe('0x46')]=_0x5dfa4b;return _0x580bd4;})[_0x9dfe('0x26')](respondWithFilteredResult(_0x3bf281,_0x222cea))[_0x9dfe('0x47')](handleError(_0x3bf281,null));};exports['show']=function(_0x4a17f5,_0x27fa70){var _0x551bbb={'raw':![],'where':{'id':_0x4a17f5[_0x9dfe('0x48')]['id']}},_0x50e327={};_0x50e327[_0x9dfe('0x36')]=_[_0x9dfe('0x34')](db[_0x9dfe('0x2f')][_0x9dfe('0x30')]);_0x50e327[_0x9dfe('0x33')]=_[_0x9dfe('0x34')](_0x4a17f5[_0x9dfe('0x33')]);_0x50e327[_0x9dfe('0x3f')]=_[_0x9dfe('0x35')](_0x50e327['model'],_0x50e327[_0x9dfe('0x33')]);_0x551bbb[_0x9dfe('0x37')]=_[_0x9dfe('0x35')](_0x50e327[_0x9dfe('0x36')],qs[_0x9dfe('0x38')](_0x4a17f5[_0x9dfe('0x33')]['fields']));_0x551bbb[_0x9dfe('0x37')]=_0x551bbb[_0x9dfe('0x37')][_0x9dfe('0x39')]?_0x551bbb[_0x9dfe('0x37')]:_0x50e327[_0x9dfe('0x36')];if(_0x4a17f5[_0x9dfe('0x33')]['includeAll']){_0x551bbb[_0x9dfe('0x44')]=[{'all':!![]}];}_0x551bbb=_[_0x9dfe('0x41')]({},_0x551bbb,_0x4a17f5[_0x9dfe('0x42')]);return db[_0x9dfe('0x2f')][_0x9dfe('0x49')](_0x551bbb)[_0x9dfe('0x26')](handleEntityNotFound(_0x27fa70,null))[_0x9dfe('0x26')](respondWithResult(_0x27fa70,null))[_0x9dfe('0x47')](handleError(_0x27fa70,null));};exports[_0x9dfe('0x4a')]=function(_0x36a433,_0xb597b1){return db[_0x9dfe('0x2f')][_0x9dfe('0x4a')](_0x36a433[_0x9dfe('0x4b')],{})[_0x9dfe('0x26')](function(_0x47b346){var _0x2c9c7a=_0x36a433[_0x9dfe('0x4c')]['get']({'plain':!![]});if(!_0x2c9c7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c9c7a[_0x9dfe('0x4d')]===_0x9dfe('0x4c')){var _0x556309=_0x47b346['get']({'plain':!![]});var _0x554811=_0x9dfe('0x4e');return db[_0x9dfe('0x4f')][_0x9dfe('0x49')]({'where':{'name':_0x554811,'userProfileId':_0x2c9c7a[_0x9dfe('0x50')]},'raw':!![]})['then'](function(_0x396bbe){if(_0x396bbe&&_0x396bbe[_0x9dfe('0x51')]===0x0){return db[_0x9dfe('0x29')][_0x9dfe('0x4a')]({'name':_0x556309[_0x9dfe('0x2c')],'resourceId':_0x556309['id'],'type':_0x396bbe['name'],'sectionId':_0x396bbe['id']},{})[_0x9dfe('0x26')](function(){return _0x47b346;});}else{return _0x47b346;}})[_0x9dfe('0x47')](function(_0x5a1f13){logger[_0x9dfe('0x2b')](_0x9dfe('0x52'),_0x5a1f13);throw _0x5a1f13;});}return _0x47b346;})['then'](respondWithResult(_0xb597b1,0xc9))[_0x9dfe('0x47')](handleError(_0xb597b1,null));};exports[_0x9dfe('0x25')]=function(_0x435486,_0x5b2d25){if(_0x435486[_0x9dfe('0x4b')]['id']){delete _0x435486[_0x9dfe('0x4b')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x435486[_0x9dfe('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b2d25,null))['then'](saveUpdates(_0x435486[_0x9dfe('0x4b')],null))[_0x9dfe('0x26')](respondWithResult(_0x5b2d25,null))[_0x9dfe('0x47')](handleError(_0x5b2d25,null));};exports['destroy']=function(_0x514083,_0x15e6e0){return db[_0x9dfe('0x2f')][_0x9dfe('0x49')]({'where':{'id':_0x514083[_0x9dfe('0x48')]['id']}})[_0x9dfe('0x26')](handleEntityNotFound(_0x15e6e0,null))[_0x9dfe('0x26')](removeEntity(_0x15e6e0,null))[_0x9dfe('0x47')](handleError(_0x15e6e0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 7aa1491..4addccc 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 _0xbf1f=['User','findAll','then','catch','exports','models','VoiceChanSpy','length','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xbf1f,0x19b));var _0xfbf1=function(_0x48a24a,_0x3cb63c){_0x48a24a=_0x48a24a-0x0;var _0x5e35d8=_0xbf1f[_0x48a24a];return _0x5e35d8;};'use strict';var _=require(_0xfbf1('0x0'));var util=require('util');var BPromise=require(_0xfbf1('0x1'));var attributes=require(_0xfbf1('0x2'));var getUserApplications=function(_0x247f09,_0x1ddffa,_0x4b1c27){var _0x719777=0x1;var _0x545494=[];var _0x488ca1={'context':_0x1ddffa[_0xfbf1('0x3')]||_0xfbf1('0x4'),'exten':util[_0xfbf1('0x5')](_0xfbf1('0x6'),_0x247f09[_0xfbf1('0x7')],_0x4b1c27),'type':_0xfbf1('0x8'),'isApp':![],'ChanSpyId':_0x247f09['id'],'UserId':_0x1ddffa['id']};_0x545494[_0xfbf1('0x9')](_[_0xfbf1('0xa')]({'app':_0xfbf1('0xb'),'appdata':util[_0xfbf1('0x5')](_0xfbf1('0xc'),_0xfbf1('0xd')),'priority':_0x719777++},_0x488ca1));if(_0x247f09[_0xfbf1('0xe')]){_0x545494[_0xfbf1('0x9')](_[_0xfbf1('0xa')]({'app':_0xfbf1('0xf'),'appdata':util[_0xfbf1('0x5')](_0xfbf1('0x10'),_0x247f09[_0xfbf1('0x11')]),'priority':_0x719777++},_0x488ca1));}if(_0x247f09[_0xfbf1('0x12')]){_0x545494[_0xfbf1('0x9')](_['merge']({'app':_0xfbf1('0x13'),'appdata':_0x247f09[_0xfbf1('0x14')],'priority':_0x719777++},_0x488ca1));}_0x545494[_0xfbf1('0x9')](_[_0xfbf1('0xa')]({'app':_0xfbf1('0x15'),'appdata':util[_0xfbf1('0x5')](_0xfbf1('0x16'),_0x1ddffa[_0xfbf1('0x17')],_0x247f09[_0xfbf1('0x18')]?_0x247f09[_0xfbf1('0x18')][_0xfbf1('0x19')](''):''),'priority':_0x719777++},_0x488ca1));if(_0x247f09[_0xfbf1('0xe')]){_0x545494[_0xfbf1('0x9')](_['merge']({'app':_0xfbf1('0x1a'),'priority':_0x719777++},_0x488ca1));}return _0x545494;};var getChanSpyApplications=function(_0x3125b4,_0x42dc33){var _0x9c08d7=[];for(var _0x3e0440=0x0,_0x383e61=0x1;_0x3e0440<_0x42dc33['length'];_0x3e0440++,_0x383e61=0x1){_0x9c08d7=_0x9c08d7[_0xfbf1('0x1b')](getUserApplications(_0x3125b4,_0x42dc33[_0x3e0440],_0x42dc33[_0x3e0440][_0xfbf1('0x1c')]));if(_0x42dc33[_0x3e0440][_0xfbf1('0x1c')]!=_0x42dc33[_0x3e0440][_0xfbf1('0x17')]){_0x9c08d7=_0x9c08d7[_0xfbf1('0x1b')](getUserApplications(_0x3125b4,_0x42dc33[_0x3e0440],_0x42dc33[_0x3e0440][_0xfbf1('0x17')]));}}return _0x9c08d7;};var getChanSpyPromise=function(_0x250cb7,_0x235fa2){return new BPromise(function(_0x92a398,_0x3d65ef){return _0x250cb7[_0xfbf1('0x1d')][_0xfbf1('0x1e')]({'attributes':['id','name',_0xfbf1('0x1c')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xfbf1('0x1f')](function(_0x1caff5){if(_0x1caff5){return _0x92a398(getChanSpyApplications(_0x235fa2,_0x1caff5));}return _0x92a398([]);})[_0xfbf1('0x20')](function(_0x2d84a1){_0x3d65ef(_0x2d84a1);});});};module[_0xfbf1('0x21')]=function(_0x239f9b,_0xdb8add){var _0xd57810=_0x239f9b[_0xfbf1('0x22')];return _0x239f9b['define'](_0xfbf1('0x23'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ed2f6,_0x3345a8,_0x305702){return getChanSpyPromise(_0xd57810,_0x5ed2f6)[_0xfbf1('0x1f')](function(_0x4d73ef){if(_0x4d73ef&&_0x4d73ef[_0xfbf1('0x24')]){return _0xd57810[_0xfbf1('0x25')]['bulkCreate'](_0x4d73ef);}})[_0xfbf1('0x1f')](function(){_0x305702();})[_0xfbf1('0x20')](function(_0x3c570b){_0x305702(_0x3c570b);});},'afterUpdate':function(_0x562f40,_0xeb88c1,_0x56a4a1){return _0xd57810[_0xfbf1('0x25')][_0xfbf1('0x26')]({'where':{'ChanSpyId':_0x562f40['id']}})[_0xfbf1('0x1f')](function(){return getChanSpyPromise(_0xd57810,_0x562f40);})['then'](function(_0x3c0d18){if(_0x3c0d18&&_0x3c0d18['length']){return _0xd57810[_0xfbf1('0x25')][_0xfbf1('0x27')](_0x3c0d18);}})[_0xfbf1('0x1f')](function(){_0x56a4a1();})[_0xfbf1('0x20')](function(_0x51882d){_0x56a4a1(_0x51882d);});},'afterDestroy':function(_0x20e7aa,_0x55c427,_0x38f7f2){return _0xd57810['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x20e7aa['id']}})[_0xfbf1('0x1f')](function(){_0x38f7f2();})[_0xfbf1('0x20')](function(_0x31411b){_0x38f7f2(_0x31411b);});}}});}; \ No newline at end of file +var _0xcd3a=['then','catch','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','push','Set','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','join','length','concat','internal','name','User','findAll','agent'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xcd3a,0x14d));var _0xacd3=function(_0x3e002e,_0x4aaf51){_0x3e002e=_0x3e002e-0x0;var _0x49db5c=_0xcd3a[_0x3e002e];return _0x49db5c;};'use strict';var _=require('lodash');var util=require(_0xacd3('0x0'));var BPromise=require(_0xacd3('0x1'));var attributes=require(_0xacd3('0x2'));var getUserApplications=function(_0x494dbe,_0x250ccc,_0x35081e){var _0x2d74ae=0x1;var _0x5e6743=[];var _0x1d19a9={'context':_0x250ccc[_0xacd3('0x3')]||_0xacd3('0x4'),'exten':util[_0xacd3('0x5')](_0xacd3('0x6'),_0x494dbe['prefix'],_0x35081e),'type':'system','isApp':![],'ChanSpyId':_0x494dbe['id'],'UserId':_0x250ccc['id']};_0x5e6743[_0xacd3('0x7')](_['merge']({'app':_0xacd3('0x8'),'appdata':util['format']('CDR(type)=%s',_0xacd3('0x9')),'priority':_0x2d74ae++},_0x1d19a9));if(_0x494dbe[_0xacd3('0xa')]){_0x5e6743[_0xacd3('0x7')](_[_0xacd3('0xb')]({'app':_0xacd3('0xc'),'appdata':util[_0xacd3('0x5')](_0xacd3('0xd'),_0x494dbe['recordingFormat']),'priority':_0x2d74ae++},_0x1d19a9));}if(_0x494dbe[_0xacd3('0xe')]){_0x5e6743['push'](_[_0xacd3('0xb')]({'app':_0xacd3('0xf'),'appdata':_0x494dbe[_0xacd3('0x10')],'priority':_0x2d74ae++},_0x1d19a9));}_0x5e6743['push'](_[_0xacd3('0xb')]({'app':_0xacd3('0x11'),'appdata':util[_0xacd3('0x5')](_0xacd3('0x12'),_0x250ccc['name'],_0x494dbe['options']?_0x494dbe['options'][_0xacd3('0x13')](''):''),'priority':_0x2d74ae++},_0x1d19a9));if(_0x494dbe['record']){_0x5e6743[_0xacd3('0x7')](_['merge']({'app':'StopMixMonitor','priority':_0x2d74ae++},_0x1d19a9));}return _0x5e6743;};var getChanSpyApplications=function(_0x3dd967,_0x11e448){var _0x5115f2=[];for(var _0x14978b=0x0,_0x541e90=0x1;_0x14978b<_0x11e448[_0xacd3('0x14')];_0x14978b++,_0x541e90=0x1){_0x5115f2=_0x5115f2[_0xacd3('0x15')](getUserApplications(_0x3dd967,_0x11e448[_0x14978b],_0x11e448[_0x14978b][_0xacd3('0x16')]));if(_0x11e448[_0x14978b][_0xacd3('0x16')]!=_0x11e448[_0x14978b][_0xacd3('0x17')]){_0x5115f2=_0x5115f2[_0xacd3('0x15')](getUserApplications(_0x3dd967,_0x11e448[_0x14978b],_0x11e448[_0x14978b]['name']));}}return _0x5115f2;};var getChanSpyPromise=function(_0x5d5d00,_0x71b77a){return new BPromise(function(_0x468371,_0x456e16){return _0x5d5d00[_0xacd3('0x18')][_0xacd3('0x19')]({'attributes':['id',_0xacd3('0x17'),_0xacd3('0x16')],'where':{'role':_0xacd3('0x1a'),'chanspy':!![]},'raw':!![]})[_0xacd3('0x1b')](function(_0x698987){if(_0x698987){return _0x468371(getChanSpyApplications(_0x71b77a,_0x698987));}return _0x468371([]);})[_0xacd3('0x1c')](function(_0x59e6df){_0x456e16(_0x59e6df);});});};module['exports']=function(_0x29ef03,_0xca4ac7){var _0x30508c=_0x29ef03[_0xacd3('0x1d')];return _0x29ef03[_0xacd3('0x1e')](_0xacd3('0x1f'),attributes,{'tableName':_0xacd3('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x36d133,_0x2e8247,_0x4f26c5){return getChanSpyPromise(_0x30508c,_0x36d133)[_0xacd3('0x1b')](function(_0x2a4aa){if(_0x2a4aa&&_0x2a4aa[_0xacd3('0x14')]){return _0x30508c['VoiceExtension'][_0xacd3('0x21')](_0x2a4aa);}})['then'](function(){_0x4f26c5();})['catch'](function(_0x3d881c){_0x4f26c5(_0x3d881c);});},'afterUpdate':function(_0x1b04de,_0xed526f,_0x49cce5){return _0x30508c[_0xacd3('0x22')][_0xacd3('0x23')]({'where':{'ChanSpyId':_0x1b04de['id']}})[_0xacd3('0x1b')](function(){return getChanSpyPromise(_0x30508c,_0x1b04de);})[_0xacd3('0x1b')](function(_0x134f86){if(_0x134f86&&_0x134f86['length']){return _0x30508c[_0xacd3('0x22')][_0xacd3('0x21')](_0x134f86);}})['then'](function(){_0x49cce5();})[_0xacd3('0x1c')](function(_0x4e5f21){_0x49cce5(_0x4e5f21);});},'afterDestroy':function(_0x2d842c,_0x4c6242,_0x4f996b){return _0x30508c[_0xacd3('0x22')][_0xacd3('0x23')]({'where':{'ChanSpyId':_0x2d842c['id']}})[_0xacd3('0x1b')](function(){_0x4f996b();})[_0xacd3('0x1c')](function(_0x290dc0){_0x4f996b(_0x290dc0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5f1863c..45d0094 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 _0x7341=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x32b21e,_0x4ac3fc){var _0x5c8d69=function(_0x2586f0){while(--_0x2586f0){_0x32b21e['push'](_0x32b21e['shift']());}};_0x5c8d69(++_0x4ac3fc);}(_0x7341,0xe4));var _0x1734=function(_0x3044c7,_0x2d33a8){_0x3044c7=_0x3044c7-0x0;var _0x46d18a=_0x7341[_0x3044c7];return _0x46d18a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1734('0x0'));var BPromise=require('bluebird');var rs=require(_0x1734('0x1'));var fs=require('fs');var Redis=require(_0x1734('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1734('0x3'));var logger=require(_0x1734('0x4'))(_0x1734('0x5'));var config=require(_0x1734('0x6'));var jayson=require(_0x1734('0x7'));var client=jayson[_0x1734('0x8')][_0x1734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c7349,_0x1ca30b,_0x2c223d){return new BPromise(function(_0x45c529,_0x5b8977){return client[_0x1734('0xa')](_0x4c7349,_0x2c223d)['then'](function(_0x56f0d5){logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));logger[_0x1734('0xe')](_0x1734('0xf'),_0x1ca30b,_0x1734('0xd'),JSON[_0x1734('0x10')](_0x56f0d5));if(_0x56f0d5[_0x1734('0x11')]){if(_0x56f0d5[_0x1734('0x11')][_0x1734('0x12')]===0x1f4){logger['error'](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x5b8977(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}logger[_0x1734('0x11')](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x45c529(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}else{logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));_0x45c529(_0x56f0d5[_0x1734('0x14')][_0x1734('0x13')]);}})[_0x1734('0x15')](function(_0x1ea188){logger[_0x1734('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x1ca30b,_0x1ea188);_0x5b8977(_0x1ea188);});});} \ No newline at end of file +var _0x4058=['request','then','info','request\x20sent','debug','stringify','VoiceChanSpy,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4058,0x129));var _0x8405=function(_0xf8e900,_0xd20855){_0xf8e900=_0xf8e900-0x0;var _0x2eee42=_0x4058[_0xf8e900];return _0x2eee42;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 298473b..f06c1cc 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 _0x2bb5=['./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0x2bb5,0x15b));var _0x52bb=function(_0x498118,_0x1c8762){_0x498118=_0x498118-0x0;var _0x5d5617=_0x2bb5[_0x498118];return _0x5d5617;};'use strict';var multer=require(_0x52bb('0x0'));var util=require(_0x52bb('0x1'));var path=require(_0x52bb('0x2'));var timeout=require(_0x52bb('0x3'));var express=require(_0x52bb('0x4'));var router=express[_0x52bb('0x5')]();var fs_extra=require(_0x52bb('0x6'));var auth=require(_0x52bb('0x7'));var interaction=require(_0x52bb('0x8'));var config=require(_0x52bb('0x9'));var controller=require(_0x52bb('0xa'));router[_0x52bb('0xb')]('/',auth['isAuthenticated'](),controller[_0x52bb('0xc')]);router[_0x52bb('0xb')](_0x52bb('0xd'),auth[_0x52bb('0xe')](),controller[_0x52bb('0xf')]);router[_0x52bb('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x52bb('0x11')]('/:id',auth[_0x52bb('0xe')](),controller[_0x52bb('0x12')]);router[_0x52bb('0x13')]('/:id',auth[_0x52bb('0xe')](),controller['destroy']);module[_0x52bb('0x14')]=router; \ No newline at end of file +var _0x9cc7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0x9cc7,0x192));var _0x79cc=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x9cc7[_0x1bb58c];return _0x277586;};'use strict';var multer=require('multer');var util=require(_0x79cc('0x0'));var path=require(_0x79cc('0x1'));var timeout=require(_0x79cc('0x2'));var express=require(_0x79cc('0x3'));var router=express[_0x79cc('0x4')]();var fs_extra=require(_0x79cc('0x5'));var auth=require(_0x79cc('0x6'));var interaction=require(_0x79cc('0x7'));var config=require('../../config/environment');var controller=require(_0x79cc('0x8'));router[_0x79cc('0x9')]('/',auth[_0x79cc('0xa')](),controller[_0x79cc('0xb')]);router[_0x79cc('0x9')](_0x79cc('0xc'),auth[_0x79cc('0xa')](),controller[_0x79cc('0xd')]);router[_0x79cc('0xe')]('/',auth['isAuthenticated'](),controller[_0x79cc('0xf')]);router[_0x79cc('0x10')](_0x79cc('0xc'),auth['isAuthenticated'](),controller[_0x79cc('0x11')]);router['delete'](_0x79cc('0xc'),auth[_0x79cc('0xa')](),controller[_0x79cc('0x12')]);module[_0x79cc('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 06bb3ab..29ab877 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 _0xdf09=['exports','name','STRING','BOOLEAN'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdf09,0x104));var _0x9df0=function(_0x18cbdd,_0x12a3e1){_0x18cbdd=_0x18cbdd-0x0;var _0x1f150b=_0xdf09[_0x18cbdd];return _0x1f150b;};'use strict';var Sequelize=require('sequelize');module[_0x9df0('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9df0('0x1')},'description':{'type':Sequelize[_0x9df0('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9df0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b2d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x514b64,_0x54ab07){var _0x1926fc=function(_0x289085){while(--_0x289085){_0x514b64['push'](_0x514b64['shift']());}};_0x1926fc(++_0x54ab07);}(_0x6b2d,0x14e));var _0xd6b2=function(_0x34c776,_0x52e903){_0x34c776=_0x34c776-0x0;var _0x343ab0=_0x6b2d[_0x34c776];return _0x343ab0;};'use strict';var Sequelize=require(_0xd6b2('0x0'));module[_0xd6b2('0x1')]={'name':{'type':Sequelize[_0xd6b2('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xd6b2('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd6b2('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 9b37d4f..def45eb 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 _0x0914=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','catch','create','body','readFileSync','join','root','utf8','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','writeFileSync','Reload','params','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','name','send','map','VoiceContext','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0914,0x1c9));var _0x4091=function(_0x4ea8ef,_0x43a84c){_0x4ea8ef=_0x4ea8ef-0x0;var _0x3b417e=_0x0914[_0x4ea8ef];return _0x3b417e;};'use strict';var emlformat=require(_0x4091('0x0'));var rimraf=require(_0x4091('0x1'));var zipdir=require(_0x4091('0x2'));var jsonpatch=require(_0x4091('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4091('0x4'));var Mustache=require(_0x4091('0x5'));var util=require(_0x4091('0x6'));var path=require(_0x4091('0x7'));var sox=require(_0x4091('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4091('0x9'));var _=require(_0x4091('0xa'));var squel=require(_0x4091('0xb'));var crypto=require(_0x4091('0xc'));var jsforce=require(_0x4091('0xd'));var deskjs=require(_0x4091('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4091('0xf'));var Papa=require(_0x4091('0x10'));var Redis=require(_0x4091('0x11'));var authService=require(_0x4091('0x12'));var qs=require(_0x4091('0x13'));var as=require(_0x4091('0x14'));var hardwareService=require(_0x4091('0x15'));var logger=require(_0x4091('0x16'))('api');var utils=require(_0x4091('0x17'));var config=require(_0x4091('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4091('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4091('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5de327,_0x165409,_0x4c6a59,_0x3e1a1f){return new BPromise(function(_0x5b5e06,_0x5761df){var _0x4529c3=_0x3e1a1f||client;return _0x4529c3['request'](_0x5de327,_0x4c6a59)[_0x4091('0x1b')](function(_0xc60da5){logger[_0x4091('0x1c')](_0x4091('0x1d'),_0x165409,_0x4091('0x1e'));logger[_0x4091('0x1f')](_0x4091('0x20'),_0x165409,_0x4091('0x1e'),JSON[_0x4091('0x21')](_0xc60da5));if(_0xc60da5[_0x4091('0x22')]){if(_0xc60da5[_0x4091('0x22')][_0x4091('0x23')]===0x1f4){logger[_0x4091('0x22')]('VoiceContext,\x20%s,\x20%s',_0x165409,_0xc60da5['error']['message']);return _0x5761df(_0xc60da5[_0x4091('0x22')][_0x4091('0x24')]);}logger[_0x4091('0x22')](_0x4091('0x1d'),_0x165409,_0xc60da5[_0x4091('0x22')]['message']);return _0x5b5e06(_0xc60da5[_0x4091('0x22')]['message']);}else{logger['info'](_0x4091('0x1d'),_0x165409,_0x4091('0x1e'));_0x5b5e06(_0xc60da5['result'][_0x4091('0x24')]);}})['catch'](function(_0x1c7631){logger[_0x4091('0x22')](_0x4091('0x1d'),_0x165409,_0x1c7631);_0x5761df(_0x1c7631);});});}function respondWithStatusCode(_0x52a6e1,_0x3c1f98){_0x3c1f98=_0x3c1f98||0xcc;return function(_0x57dac5){if(_0x57dac5){return _0x52a6e1['sendStatus'](_0x3c1f98);}return _0x52a6e1[_0x4091('0x25')](_0x3c1f98)[_0x4091('0x26')]();};}function respondWithResult(_0x4d13c0,_0x6827b1){_0x6827b1=_0x6827b1||0xc8;return function(_0x399979){if(_0x399979){return _0x4d13c0[_0x4091('0x25')](_0x6827b1)[_0x4091('0x27')](_0x399979);}};}function respondWithFilteredResult(_0x4cdeda,_0xfc5bef){return function(_0x4251f4){if(_0x4251f4){var _0x5cc860=typeof _0xfc5bef[_0x4091('0x28')]===_0x4091('0x29')&&typeof _0xfc5bef[_0x4091('0x2a')]==='undefined';var _0xd603df=_0x4251f4[_0x4091('0x2b')];var _0x4a9e93=_0x5cc860?0x0:_0xfc5bef[_0x4091('0x28')];var _0x4d10e1=_0x5cc860?_0x4251f4[_0x4091('0x2b')]:_0xfc5bef[_0x4091('0x28')]+_0xfc5bef[_0x4091('0x2a')];var _0x5861ee;if(_0x4d10e1>=_0xd603df){_0x4d10e1=_0xd603df;_0x5861ee=0xc8;}else{_0x5861ee=0xce;}_0x4cdeda[_0x4091('0x25')](_0x5861ee);return _0x4cdeda[_0x4091('0x2c')](_0x4091('0x2d'),_0x4a9e93+'-'+_0x4d10e1+'/'+_0xd603df)[_0x4091('0x27')](_0x4251f4);}return null;};}function patchUpdates(_0x532942){return function(_0x1ac806){try{jsonpatch[_0x4091('0x2e')](_0x1ac806,_0x532942,!![]);}catch(_0x56ced0){return BPromise[_0x4091('0x2f')](_0x56ced0);}return _0x1ac806[_0x4091('0x30')]();};}function saveUpdates(_0x38df8b,_0x283286){return function(_0x45cd98){if(_0x45cd98){return _0x45cd98[_0x4091('0x31')](_0x38df8b)['then'](function(_0x5e60ad){return _0x5e60ad;});}return null;};}function removeEntity(_0x1e48c8,_0x2f91b3){return function(_0x3b0f43){if(_0x3b0f43){return _0x3b0f43[_0x4091('0x32')]()[_0x4091('0x1b')](function(){var _0x3b545d=_0x3b0f43[_0x4091('0x33')]({'plain':!![]});var _0xc60be=_0x4091('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0xc60be,'resourceId':_0x3b545d['id']}})[_0x4091('0x1b')](function(){return _0x3b0f43;});})[_0x4091('0x1b')](function(){_0x1e48c8[_0x4091('0x25')](0xcc)[_0x4091('0x26')]();});}};}function handleEntityNotFound(_0x411b1a,_0x25f2d9){return function(_0x460300){if(!_0x460300){_0x411b1a['sendStatus'](0x194);}return _0x460300;};}function handleError(_0x2a2b27,_0x49527e){_0x49527e=_0x49527e||0x1f4;return function(_0x1bb184){logger[_0x4091('0x22')](_0x1bb184['stack']);if(_0x1bb184[_0x4091('0x35')]){delete _0x1bb184[_0x4091('0x35')];}_0x2a2b27[_0x4091('0x25')](_0x49527e)[_0x4091('0x36')](_0x1bb184);};}exports['index']=function(_0x373981,_0x18512c){var _0x237799={},_0x2c861f={},_0x42abe9={'count':0x0,'rows':[]};var _0x1f9c81=_[_0x4091('0x37')](db[_0x4091('0x38')]['rawAttributes'],function(_0x4abe15){return{'name':_0x4abe15[_0x4091('0x39')],'type':_0x4abe15[_0x4091('0x3a')]['key']};});_0x2c861f[_0x4091('0x3b')]=_[_0x4091('0x37')](_0x1f9c81,_0x4091('0x35'));_0x2c861f[_0x4091('0x3c')]=_[_0x4091('0x3d')](_0x373981[_0x4091('0x3c')]);_0x2c861f['filters']=_[_0x4091('0x3e')](_0x2c861f[_0x4091('0x3b')],_0x2c861f[_0x4091('0x3c')]);_0x237799[_0x4091('0x3f')]=_[_0x4091('0x3e')](_0x2c861f[_0x4091('0x3b')],qs[_0x4091('0x40')](_0x373981[_0x4091('0x3c')][_0x4091('0x40')]));_0x237799[_0x4091('0x3f')]=_0x237799['attributes'][_0x4091('0x41')]?_0x237799[_0x4091('0x3f')]:_0x2c861f['model'];if(!_0x373981[_0x4091('0x3c')][_0x4091('0x42')](_0x4091('0x43'))){_0x237799[_0x4091('0x2a')]=qs[_0x4091('0x2a')](_0x373981[_0x4091('0x3c')][_0x4091('0x2a')]);_0x237799[_0x4091('0x28')]=qs['offset'](_0x373981['query'][_0x4091('0x28')]);}_0x237799[_0x4091('0x44')]=qs[_0x4091('0x45')](_0x373981['query'][_0x4091('0x45')]);_0x237799[_0x4091('0x46')]=qs[_0x4091('0x47')](_[_0x4091('0x48')](_0x373981[_0x4091('0x3c')],_0x2c861f['filters']),_0x1f9c81);if(_0x373981[_0x4091('0x3c')][_0x4091('0x49')]){_0x237799[_0x4091('0x46')]=_[_0x4091('0x4a')](_0x237799['where'],{'$or':_[_0x4091('0x37')](_0x1f9c81,function(_0x433b3f){if(_0x433b3f[_0x4091('0x3a')]!==_0x4091('0x4b')){var _0x16f353={};_0x16f353[_0x433b3f[_0x4091('0x35')]]={'$like':'%'+_0x373981[_0x4091('0x3c')][_0x4091('0x49')]+'%'};return _0x16f353;}})});}_0x237799=_[_0x4091('0x4a')]({},_0x237799,_0x373981[_0x4091('0x4c')]);var _0x21ca40={'where':_0x237799[_0x4091('0x46')]};return db[_0x4091('0x38')]['count'](_0x21ca40)[_0x4091('0x1b')](function(_0x12b525){_0x42abe9[_0x4091('0x2b')]=_0x12b525;if(_0x373981['query'][_0x4091('0x4d')]){_0x237799[_0x4091('0x4e')]=[{'all':!![]}];}return db[_0x4091('0x38')][_0x4091('0x4f')](_0x237799);})[_0x4091('0x1b')](function(_0xfd30c6){_0x42abe9[_0x4091('0x50')]=_0xfd30c6;return _0x42abe9;})[_0x4091('0x1b')](respondWithFilteredResult(_0x18512c,_0x237799))['catch'](handleError(_0x18512c,null));};exports[_0x4091('0x51')]=function(_0x5b154b,_0x1648e4){var _0x1a65ec={'raw':![],'where':{'id':_0x5b154b['params']['id']}},_0x165a7b={};_0x165a7b[_0x4091('0x3b')]=_[_0x4091('0x3d')](db[_0x4091('0x38')][_0x4091('0x52')]);_0x165a7b['query']=_[_0x4091('0x3d')](_0x5b154b[_0x4091('0x3c')]);_0x165a7b[_0x4091('0x47')]=_[_0x4091('0x3e')](_0x165a7b[_0x4091('0x3b')],_0x165a7b[_0x4091('0x3c')]);_0x1a65ec[_0x4091('0x3f')]=_[_0x4091('0x3e')](_0x165a7b[_0x4091('0x3b')],qs[_0x4091('0x40')](_0x5b154b['query'][_0x4091('0x40')]));_0x1a65ec[_0x4091('0x3f')]=_0x1a65ec['attributes']['length']?_0x1a65ec[_0x4091('0x3f')]:_0x165a7b[_0x4091('0x3b')];if(_0x5b154b[_0x4091('0x3c')][_0x4091('0x4d')]){_0x1a65ec[_0x4091('0x4e')]=[{'all':!![]}];}_0x1a65ec=_[_0x4091('0x4a')]({},_0x1a65ec,_0x5b154b[_0x4091('0x4c')]);return db['VoiceContext']['find'](_0x1a65ec)[_0x4091('0x1b')](handleEntityNotFound(_0x1648e4,null))[_0x4091('0x1b')](respondWithResult(_0x1648e4,null))[_0x4091('0x53')](handleError(_0x1648e4,null));};exports[_0x4091('0x54')]=function(_0x29a8fc,_0x1df6e6,_0x5de703){var _0x10d35b;return db['VoiceContext'][_0x4091('0x54')](_0x29a8fc[_0x4091('0x55')],{'raw':!![]})[_0x4091('0x1b')](function(_0x2a4204){_0x10d35b=_0x2a4204;return db[_0x4091('0x38')]['findAll']({'raw':!![]});})[_0x4091('0x1b')](function(_0x5d1b2e){var _0x4035b0=fs[_0x4091('0x56')](path[_0x4091('0x57')](config[_0x4091('0x58')],'server/files/templates/context.ejs'),_0x4091('0x59'));var _0x371c25=ejs['render'](_0x4035b0,{'contexts':_0x5d1b2e||[]});fs['writeFileSync'](_0x4091('0x5a'),_0x371c25);})[_0x4091('0x1b')](function(){return respondWithRpcPromise('Reload',_0x4091('0x54'),{'module':_0x4091('0x5b')});})[_0x4091('0x1b')](function(){var _0x1faece=_0x29a8fc['user'][_0x4091('0x33')]({'plain':!![]});if(!_0x1faece)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1faece[_0x4091('0x5c')]===_0x4091('0x5d')){var _0x4abfdb=_0x10d35b[_0x4091('0x33')]({'plain':!![]});return db[_0x4091('0x5e')][_0x4091('0x5f')]({'where':{'name':_0x4091('0x34'),'userProfileId':_0x1faece[_0x4091('0x60')]},'raw':!![]})['then'](function(_0x2c7c11){if(_0x2c7c11&&_0x2c7c11[_0x4091('0x61')]===0x0){return db[_0x4091('0x62')][_0x4091('0x54')]({'name':_0x4abfdb[_0x4091('0x35')],'resourceId':_0x4abfdb['id'],'type':_0x2c7c11[_0x4091('0x35')],'sectionId':_0x2c7c11['id']},{})[_0x4091('0x1b')](function(){return _0x10d35b;});}else{return _0x10d35b;}})[_0x4091('0x53')](function(_0x5ae9c7){logger['error'](_0x4091('0x63'),_0x5ae9c7);throw _0x5ae9c7;});}return _0x10d35b;})[_0x4091('0x1b')](respondWithResult(_0x1df6e6,0xc9))[_0x4091('0x53')](handleError(_0x1df6e6,null));};exports[_0x4091('0x31')]=function(_0x1f50a9,_0x1faa3f,_0x116bdd){var _0x3cb2ed;return db[_0x4091('0x38')][_0x4091('0x5f')]({'where':{'id':_0x1f50a9['params']['id']}})['then'](handleEntityNotFound(_0x1faa3f,null))['then'](saveUpdates(_0x1f50a9[_0x4091('0x55')],null))[_0x4091('0x1b')](function(_0x44721d){if(_0x44721d){_0x3cb2ed=_0x44721d;return db[_0x4091('0x38')][_0x4091('0x4f')]({'raw':!![]});}})[_0x4091('0x1b')](function(_0x38b063){var _0x44cee7=fs[_0x4091('0x56')](path[_0x4091('0x57')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x4e38b7=ejs[_0x4091('0x64')](_0x44cee7,{'contexts':_0x38b063||[]});fs[_0x4091('0x65')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4e38b7);})[_0x4091('0x1b')](function(){return respondWithRpcPromise(_0x4091('0x66'),_0x4091('0x31'),{'module':'chan_sip.so'});})[_0x4091('0x1b')](function(){return _0x3cb2ed;})[_0x4091('0x1b')](respondWithResult(_0x1faa3f,null))['catch'](handleError(_0x1faa3f,null));};exports[_0x4091('0x32')]=function(_0x541437,_0x3640ee,_0x4f9d11){var _0x418bcf;return db[_0x4091('0x38')][_0x4091('0x5f')]({'where':{'id':_0x541437[_0x4091('0x67')]['id']}})[_0x4091('0x1b')](handleEntityNotFound(_0x3640ee,null))[_0x4091('0x1b')](removeEntity(_0x3640ee,null))[_0x4091('0x1b')](function(){return db[_0x4091('0x38')][_0x4091('0x4f')]({'raw':!![]});})[_0x4091('0x1b')](function(_0x3ed841){var _0x101bcc=fs[_0x4091('0x56')](path[_0x4091('0x57')](config['root'],_0x4091('0x68')),_0x4091('0x59'));var _0x29a75d=ejs[_0x4091('0x64')](_0x101bcc,{'contexts':_0x3ed841});fs[_0x4091('0x65')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x29a75d);return respondWithRpcPromise(_0x4091('0x66'),_0x4091('0x32'),{'module':_0x4091('0x5b')});})[_0x4091('0x53')](handleError(_0x3640ee,null));}; \ No newline at end of file +var _0x7cf4=['VIRTUAL','includeAll','findAll','rows','params','length','include','options','find','create','readFileSync','root','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','utf8','render','writeFileSync','Reload','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','Contexts','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','keys','intersection','model','query','attributes','fields','order','sort','where','filters','filter','merge','type'];(function(_0x2a93ab,_0x3cd987){var _0x52d571=function(_0x524441){while(--_0x524441){_0x2a93ab['push'](_0x2a93ab['shift']());}};_0x52d571(++_0x3cd987);}(_0x7cf4,0x1ae));var _0x47cf=function(_0x2a1c86,_0x4b583c){_0x2a1c86=_0x2a1c86-0x0;var _0x82472d=_0x7cf4[_0x2a1c86];return _0x82472d;};'use strict';var emlformat=require(_0x47cf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x47cf('0x1'));var rp=require(_0x47cf('0x2'));var moment=require(_0x47cf('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x47cf('0x4'));var path=require(_0x47cf('0x5'));var sox=require(_0x47cf('0x6'));var csv=require(_0x47cf('0x7'));var ejs=require(_0x47cf('0x8'));var fs=require('fs');var fs_extra=require(_0x47cf('0x9'));var _=require('lodash');var squel=require(_0x47cf('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x47cf('0xb'));var toCsv=require(_0x47cf('0x7'));var querystring=require(_0x47cf('0xc'));var Papa=require('papaparse');var Redis=require(_0x47cf('0xd'));var authService=require(_0x47cf('0xe'));var qs=require(_0x47cf('0xf'));var as=require(_0x47cf('0x10'));var hardwareService=require(_0x47cf('0x11'));var logger=require(_0x47cf('0x12'))('api');var utils=require(_0x47cf('0x13'));var config=require(_0x47cf('0x14'));var licenseUtil=require(_0x47cf('0x15'));var db=require(_0x47cf('0x16'))['db'];var jayson=require(_0x47cf('0x17'));var client=jayson[_0x47cf('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e6828,_0x1b6c86,_0x47af75,_0x536303){return new BPromise(function(_0x2bd20d,_0x427ae6){var _0x595203=_0x536303||client;return _0x595203['request'](_0x5e6828,_0x47af75)[_0x47cf('0x19')](function(_0x1c2271){logger[_0x47cf('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x1b6c86,_0x47cf('0x1b'));logger[_0x47cf('0x1c')](_0x47cf('0x1d'),_0x1b6c86,'request\x20sent',JSON[_0x47cf('0x1e')](_0x1c2271));if(_0x1c2271[_0x47cf('0x1f')]){if(_0x1c2271['error']['code']===0x1f4){logger[_0x47cf('0x1f')](_0x47cf('0x20'),_0x1b6c86,_0x1c2271['error'][_0x47cf('0x21')]);return _0x427ae6(_0x1c2271[_0x47cf('0x1f')][_0x47cf('0x21')]);}logger[_0x47cf('0x1f')](_0x47cf('0x20'),_0x1b6c86,_0x1c2271[_0x47cf('0x1f')][_0x47cf('0x21')]);return _0x2bd20d(_0x1c2271[_0x47cf('0x1f')][_0x47cf('0x21')]);}else{logger[_0x47cf('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x1b6c86,_0x47cf('0x1b'));_0x2bd20d(_0x1c2271[_0x47cf('0x22')][_0x47cf('0x21')]);}})[_0x47cf('0x23')](function(_0x35bca5){logger[_0x47cf('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x1b6c86,_0x35bca5);_0x427ae6(_0x35bca5);});});}function respondWithStatusCode(_0x4658c8,_0x4721ec){_0x4721ec=_0x4721ec||0xcc;return function(_0x2ad7dc){if(_0x2ad7dc){return _0x4658c8['sendStatus'](_0x4721ec);}return _0x4658c8[_0x47cf('0x24')](_0x4721ec)[_0x47cf('0x25')]();};}function respondWithResult(_0x7f13d7,_0x21b204){_0x21b204=_0x21b204||0xc8;return function(_0x388a4){if(_0x388a4){return _0x7f13d7[_0x47cf('0x24')](_0x21b204)[_0x47cf('0x26')](_0x388a4);}};}function respondWithFilteredResult(_0x3d0137,_0x2c48b2){return function(_0x559282){if(_0x559282){var _0x186e60=typeof _0x2c48b2[_0x47cf('0x27')]===_0x47cf('0x28')&&typeof _0x2c48b2[_0x47cf('0x29')]===_0x47cf('0x28');var _0x5376fb=_0x559282[_0x47cf('0x2a')];var _0x284c66=_0x186e60?0x0:_0x2c48b2[_0x47cf('0x27')];var _0x727cf0=_0x186e60?_0x559282['count']:_0x2c48b2[_0x47cf('0x27')]+_0x2c48b2[_0x47cf('0x29')];var _0x14d560;if(_0x727cf0>=_0x5376fb){_0x727cf0=_0x5376fb;_0x14d560=0xc8;}else{_0x14d560=0xce;}_0x3d0137[_0x47cf('0x24')](_0x14d560);return _0x3d0137[_0x47cf('0x2b')](_0x47cf('0x2c'),_0x284c66+'-'+_0x727cf0+'/'+_0x5376fb)['json'](_0x559282);}return null;};}function patchUpdates(_0x3ff294){return function(_0x41fa08){try{jsonpatch[_0x47cf('0x2d')](_0x41fa08,_0x3ff294,!![]);}catch(_0x1d9d11){return BPromise[_0x47cf('0x2e')](_0x1d9d11);}return _0x41fa08['save']();};}function saveUpdates(_0x3225a0,_0x4afc0a){return function(_0x563b6d){if(_0x563b6d){return _0x563b6d[_0x47cf('0x2f')](_0x3225a0)[_0x47cf('0x19')](function(_0x42c098){return _0x42c098;});}return null;};}function removeEntity(_0x43f186,_0xc5e964){return function(_0x4c98f5){if(_0x4c98f5){return _0x4c98f5['destroy']()[_0x47cf('0x19')](function(){var _0x5645bf=_0x4c98f5[_0x47cf('0x30')]({'plain':!![]});var _0x7a68e5=_0x47cf('0x31');return db[_0x47cf('0x32')][_0x47cf('0x33')]({'where':{'type':_0x7a68e5,'resourceId':_0x5645bf['id']}})[_0x47cf('0x19')](function(){return _0x4c98f5;});})[_0x47cf('0x19')](function(){_0x43f186[_0x47cf('0x24')](0xcc)[_0x47cf('0x25')]();});}};}function handleEntityNotFound(_0x63f640,_0x52930c){return function(_0x188bfc){if(!_0x188bfc){_0x63f640[_0x47cf('0x34')](0x194);}return _0x188bfc;};}function handleError(_0x20290a,_0x1c5a71){_0x1c5a71=_0x1c5a71||0x1f4;return function(_0x1432b3){logger[_0x47cf('0x1f')](_0x1432b3[_0x47cf('0x35')]);if(_0x1432b3['name']){delete _0x1432b3[_0x47cf('0x36')];}_0x20290a[_0x47cf('0x24')](_0x1c5a71)[_0x47cf('0x37')](_0x1432b3);};}exports[_0x47cf('0x38')]=function(_0x467130,_0x268cf4){var _0x3d9bf2={},_0x2acace={},_0x4b3378={'count':0x0,'rows':[]};var _0x57bc58=_[_0x47cf('0x39')](db[_0x47cf('0x3a')][_0x47cf('0x3b')],function(_0x3db771){return{'name':_0x3db771[_0x47cf('0x3c')],'type':_0x3db771['type'][_0x47cf('0x3d')]};});_0x2acace['model']=_[_0x47cf('0x39')](_0x57bc58,'name');_0x2acace['query']=_[_0x47cf('0x3e')](_0x467130['query']);_0x2acace['filters']=_[_0x47cf('0x3f')](_0x2acace[_0x47cf('0x40')],_0x2acace[_0x47cf('0x41')]);_0x3d9bf2[_0x47cf('0x42')]=_['intersection'](_0x2acace[_0x47cf('0x40')],qs[_0x47cf('0x43')](_0x467130['query'][_0x47cf('0x43')]));_0x3d9bf2['attributes']=_0x3d9bf2['attributes']['length']?_0x3d9bf2[_0x47cf('0x42')]:_0x2acace[_0x47cf('0x40')];if(!_0x467130['query']['hasOwnProperty']('nolimit')){_0x3d9bf2[_0x47cf('0x29')]=qs[_0x47cf('0x29')](_0x467130[_0x47cf('0x41')]['limit']);_0x3d9bf2['offset']=qs[_0x47cf('0x27')](_0x467130[_0x47cf('0x41')][_0x47cf('0x27')]);}_0x3d9bf2[_0x47cf('0x44')]=qs[_0x47cf('0x45')](_0x467130[_0x47cf('0x41')][_0x47cf('0x45')]);_0x3d9bf2[_0x47cf('0x46')]=qs['filters'](_['pick'](_0x467130[_0x47cf('0x41')],_0x2acace[_0x47cf('0x47')]),_0x57bc58);if(_0x467130[_0x47cf('0x41')][_0x47cf('0x48')]){_0x3d9bf2[_0x47cf('0x46')]=_[_0x47cf('0x49')](_0x3d9bf2[_0x47cf('0x46')],{'$or':_[_0x47cf('0x39')](_0x57bc58,function(_0xd1cf0b){if(_0xd1cf0b[_0x47cf('0x4a')]!==_0x47cf('0x4b')){var _0x178466={};_0x178466[_0xd1cf0b[_0x47cf('0x36')]]={'$like':'%'+_0x467130[_0x47cf('0x41')]['filter']+'%'};return _0x178466;}})});}_0x3d9bf2=_[_0x47cf('0x49')]({},_0x3d9bf2,_0x467130['options']);var _0xea4e26={'where':_0x3d9bf2[_0x47cf('0x46')]};return db['VoiceContext']['count'](_0xea4e26)[_0x47cf('0x19')](function(_0x3faab2){_0x4b3378[_0x47cf('0x2a')]=_0x3faab2;if(_0x467130[_0x47cf('0x41')][_0x47cf('0x4c')]){_0x3d9bf2['include']=[{'all':!![]}];}return db[_0x47cf('0x3a')][_0x47cf('0x4d')](_0x3d9bf2);})[_0x47cf('0x19')](function(_0x2b5f61){_0x4b3378[_0x47cf('0x4e')]=_0x2b5f61;return _0x4b3378;})['then'](respondWithFilteredResult(_0x268cf4,_0x3d9bf2))[_0x47cf('0x23')](handleError(_0x268cf4,null));};exports['show']=function(_0x599187,_0x213737){var _0x27f1a9={'raw':![],'where':{'id':_0x599187[_0x47cf('0x4f')]['id']}},_0x3b0450={};_0x3b0450[_0x47cf('0x40')]=_[_0x47cf('0x3e')](db[_0x47cf('0x3a')][_0x47cf('0x3b')]);_0x3b0450[_0x47cf('0x41')]=_[_0x47cf('0x3e')](_0x599187[_0x47cf('0x41')]);_0x3b0450[_0x47cf('0x47')]=_[_0x47cf('0x3f')](_0x3b0450[_0x47cf('0x40')],_0x3b0450[_0x47cf('0x41')]);_0x27f1a9[_0x47cf('0x42')]=_[_0x47cf('0x3f')](_0x3b0450[_0x47cf('0x40')],qs[_0x47cf('0x43')](_0x599187[_0x47cf('0x41')][_0x47cf('0x43')]));_0x27f1a9[_0x47cf('0x42')]=_0x27f1a9[_0x47cf('0x42')][_0x47cf('0x50')]?_0x27f1a9[_0x47cf('0x42')]:_0x3b0450[_0x47cf('0x40')];if(_0x599187[_0x47cf('0x41')][_0x47cf('0x4c')]){_0x27f1a9[_0x47cf('0x51')]=[{'all':!![]}];}_0x27f1a9=_[_0x47cf('0x49')]({},_0x27f1a9,_0x599187[_0x47cf('0x52')]);return db['VoiceContext'][_0x47cf('0x53')](_0x27f1a9)['then'](handleEntityNotFound(_0x213737,null))['then'](respondWithResult(_0x213737,null))[_0x47cf('0x23')](handleError(_0x213737,null));};exports['create']=function(_0x1e4377,_0x2746d8,_0x13a9de){var _0x533bbb;return db['VoiceContext'][_0x47cf('0x54')](_0x1e4377['body'],{'raw':!![]})[_0x47cf('0x19')](function(_0x377e53){_0x533bbb=_0x377e53;return db[_0x47cf('0x3a')][_0x47cf('0x4d')]({'raw':!![]});})['then'](function(_0x354990){var _0x4363d0=fs[_0x47cf('0x55')](path['join'](config[_0x47cf('0x56')],_0x47cf('0x57')),'utf8');var _0x5b0717=ejs['render'](_0x4363d0,{'contexts':_0x354990||[]});fs['writeFileSync'](_0x47cf('0x58'),_0x5b0717);})[_0x47cf('0x19')](function(){return respondWithRpcPromise('Reload',_0x47cf('0x54'),{'module':_0x47cf('0x59')});})['then'](function(){var _0x29151b=_0x1e4377[_0x47cf('0x5a')][_0x47cf('0x30')]({'plain':!![]});if(!_0x29151b)throw new Error(_0x47cf('0x5b'));if(_0x29151b[_0x47cf('0x5c')]===_0x47cf('0x5a')){var _0xad0e32=_0x533bbb[_0x47cf('0x30')]({'plain':!![]});return db[_0x47cf('0x5d')]['find']({'where':{'name':_0x47cf('0x31'),'userProfileId':_0x29151b[_0x47cf('0x5e')]},'raw':!![]})['then'](function(_0x256a0f){if(_0x256a0f&&_0x256a0f[_0x47cf('0x5f')]===0x0){return db[_0x47cf('0x32')][_0x47cf('0x54')]({'name':_0xad0e32[_0x47cf('0x36')],'resourceId':_0xad0e32['id'],'type':_0x256a0f['name'],'sectionId':_0x256a0f['id']},{})[_0x47cf('0x19')](function(){return _0x533bbb;});}else{return _0x533bbb;}})[_0x47cf('0x23')](function(_0x206c92){logger[_0x47cf('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x206c92);throw _0x206c92;});}return _0x533bbb;})[_0x47cf('0x19')](respondWithResult(_0x2746d8,0xc9))[_0x47cf('0x23')](handleError(_0x2746d8,null));};exports[_0x47cf('0x2f')]=function(_0x2078a3,_0xd27249,_0x3badea){var _0x1390f5;return db['VoiceContext'][_0x47cf('0x53')]({'where':{'id':_0x2078a3[_0x47cf('0x4f')]['id']}})['then'](handleEntityNotFound(_0xd27249,null))['then'](saveUpdates(_0x2078a3[_0x47cf('0x60')],null))[_0x47cf('0x19')](function(_0xe0c837){if(_0xe0c837){_0x1390f5=_0xe0c837;return db[_0x47cf('0x3a')][_0x47cf('0x4d')]({'raw':!![]});}})[_0x47cf('0x19')](function(_0x4db208){var _0x1a3c11=fs[_0x47cf('0x55')](path['join'](config[_0x47cf('0x56')],'server/files/templates/context.ejs'),_0x47cf('0x61'));var _0x5a8828=ejs[_0x47cf('0x62')](_0x1a3c11,{'contexts':_0x4db208||[]});fs[_0x47cf('0x63')](_0x47cf('0x58'),_0x5a8828);})[_0x47cf('0x19')](function(){return respondWithRpcPromise(_0x47cf('0x64'),'update',{'module':_0x47cf('0x59')});})[_0x47cf('0x19')](function(){return _0x1390f5;})[_0x47cf('0x19')](respondWithResult(_0xd27249,null))[_0x47cf('0x23')](handleError(_0xd27249,null));};exports[_0x47cf('0x33')]=function(_0xd9442a,_0x54bdaa,_0x160a43){var _0x32b116;return db['VoiceContext'][_0x47cf('0x53')]({'where':{'id':_0xd9442a[_0x47cf('0x4f')]['id']}})[_0x47cf('0x19')](handleEntityNotFound(_0x54bdaa,null))['then'](removeEntity(_0x54bdaa,null))['then'](function(){return db[_0x47cf('0x3a')][_0x47cf('0x4d')]({'raw':!![]});})['then'](function(_0x12110a){var _0x3b93f0=fs[_0x47cf('0x55')](path['join'](config['root'],'server/files/templates/context.ejs'),_0x47cf('0x61'));var _0x4632b5=ejs['render'](_0x3b93f0,{'contexts':_0x12110a});fs[_0x47cf('0x63')](_0x47cf('0x58'),_0x4632b5);return respondWithRpcPromise(_0x47cf('0x64'),_0x47cf('0x33'),{'module':_0x47cf('0x59')});})[_0x47cf('0x23')](handleError(_0x54bdaa,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5fa6ba5..20e5a2a 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 _0x3b94=['define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0x3b94,0xb3));var _0x43b9=function(_0x3c650a,_0x246fac){_0x3c650a=_0x3c650a-0x0;var _0x6d3fdf=_0x3b94[_0x3c650a];return _0x6d3fdf;};'use strict';var _=require(_0x43b9('0x0'));var util=require('util');var logger=require(_0x43b9('0x1'))(_0x43b9('0x2'));var moment=require(_0x43b9('0x3'));var BPromise=require(_0x43b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43b9('0x5'));var rimraf=require('rimraf');var config=require(_0x43b9('0x6'));var attributes=require('./voiceContext.attributes');module[_0x43b9('0x7')]=function(_0x589ae5,_0x34afb2){return _0x589ae5[_0x43b9('0x8')](_0x43b9('0x9'),attributes,{'tableName':_0x43b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x098f=['../../config/logger','api','moment','request-promise','path','define','VoiceContext','voice_contexts'];(function(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0x098f,0x1c8));var _0xf098=function(_0xb49837,_0x4dc4c3){_0xb49837=_0xb49837-0x0;var _0x19143f=_0x098f[_0xb49837];return _0x19143f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf098('0x0'))(_0xf098('0x1'));var moment=require(_0xf098('0x2'));var BPromise=require('bluebird');var rp=require(_0xf098('0x3'));var fs=require('fs');var path=require(_0xf098('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module['exports']=function(_0x15eb0c,_0x44fe6f){return _0x15eb0c[_0xf098('0x5')](_0xf098('0x6'),attributes,{'tableName':_0xf098('0x7'),'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 7f9532d..37c1355 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 _0xa699=['request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dbefc,_0x3a8a3f){var _0xc2ac7e=function(_0x1be0c2){while(--_0x1be0c2){_0x3dbefc['push'](_0x3dbefc['shift']());}};_0xc2ac7e(++_0x3a8a3f);}(_0xa699,0x6b));var _0x9a69=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0xa699[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var moment=require(_0x9a69('0x2'));var BPromise=require(_0x9a69('0x3'));var rs=require(_0x9a69('0x4'));var fs=require('fs');var Redis=require(_0x9a69('0x5'));var db=require(_0x9a69('0x6'))['db'];var utils=require(_0x9a69('0x7'));var logger=require(_0x9a69('0x8'))(_0x9a69('0x9'));var config=require(_0x9a69('0xa'));var jayson=require(_0x9a69('0xb'));var client=jayson[_0x9a69('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b842,_0x3f9bce,_0x3bb021){return new BPromise(function(_0x4665a9,_0x5031b0){return client[_0x9a69('0xd')](_0x26b842,_0x3bb021)[_0x9a69('0xe')](function(_0x3fb953){logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,'request\x20sent');logger['debug'](_0x9a69('0x11'),_0x3f9bce,'request\x20sent',JSON[_0x9a69('0x12')](_0x3fb953));if(_0x3fb953[_0x9a69('0x13')]){if(_0x3fb953['error'][_0x9a69('0x14')]===0x1f4){logger[_0x9a69('0x13')]('VoiceContext,\x20%s,\x20%s',_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x5031b0(_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);}logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x4665a9(_0x3fb953[_0x9a69('0x13')]['message']);}else{logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,_0x9a69('0x16'));_0x4665a9(_0x3fb953['result'][_0x9a69('0x15')]);}})[_0x9a69('0x17')](function(_0x380e46){logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x380e46);_0x5031b0(_0x380e46);});});} \ No newline at end of file +var _0x9a86=['then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4e8e38,_0x4a8e79){var _0x455ccd=function(_0x411131){while(--_0x411131){_0x4e8e38['push'](_0x4e8e38['shift']());}};_0x455ccd(++_0x4a8e79);}(_0x9a86,0x1ed));var _0x69a8=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x9a86[_0x480bc8];return _0x28c245;};'use strict';var _=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var moment=require('moment');var BPromise=require(_0x69a8('0x2'));var rs=require(_0x69a8('0x3'));var fs=require('fs');var Redis=require(_0x69a8('0x4'));var db=require(_0x69a8('0x5'))['db'];var utils=require(_0x69a8('0x6'));var logger=require(_0x69a8('0x7'))(_0x69a8('0x8'));var config=require(_0x69a8('0x9'));var jayson=require(_0x69a8('0xa'));var client=jayson[_0x69a8('0xb')][_0x69a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47592b,_0x40d196,_0x308ef9){return new BPromise(function(_0x1909fc,_0x1c826b){return client['request'](_0x47592b,_0x308ef9)[_0x69a8('0xd')](function(_0xaf3ed6){logger['info'](_0x69a8('0xe'),_0x40d196,_0x69a8('0xf'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x40d196,_0x69a8('0xf'),JSON[_0x69a8('0x10')](_0xaf3ed6));if(_0xaf3ed6[_0x69a8('0x11')]){if(_0xaf3ed6[_0x69a8('0x11')]['code']===0x1f4){logger['error'](_0x69a8('0xe'),_0x40d196,_0xaf3ed6['error'][_0x69a8('0x12')]);return _0x1c826b(_0xaf3ed6[_0x69a8('0x11')][_0x69a8('0x12')]);}logger[_0x69a8('0x11')](_0x69a8('0xe'),_0x40d196,_0xaf3ed6['error'][_0x69a8('0x12')]);return _0x1909fc(_0xaf3ed6['error'][_0x69a8('0x12')]);}else{logger[_0x69a8('0x13')]('VoiceContext,\x20%s,\x20%s',_0x40d196,_0x69a8('0xf'));_0x1909fc(_0xaf3ed6[_0x69a8('0x14')][_0x69a8('0x12')]);}})[_0x69a8('0x15')](function(_0x1d3ebf){logger[_0x69a8('0x11')](_0x69a8('0xe'),_0x40d196,_0x1d3ebf);_0x1c826b(_0x1d3ebf);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index fa7555d..167a26d 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 _0xf3bb=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put'];(function(_0x3ae93c,_0x579d7e){var _0xe06f19=function(_0x28a375){while(--_0x28a375){_0x3ae93c['push'](_0x3ae93c['shift']());}};_0xe06f19(++_0x579d7e);}(_0xf3bb,0x129));var _0xbf3b=function(_0x4e26ef,_0x1a3002){_0x4e26ef=_0x4e26ef-0x0;var _0x20a18b=_0xf3bb[_0x4e26ef];return _0x20a18b;};'use strict';var multer=require(_0xbf3b('0x0'));var util=require(_0xbf3b('0x1'));var path=require(_0xbf3b('0x2'));var timeout=require(_0xbf3b('0x3'));var express=require(_0xbf3b('0x4'));var router=express[_0xbf3b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbf3b('0x6'));var interaction=require(_0xbf3b('0x7'));var config=require(_0xbf3b('0x8'));var controller=require(_0xbf3b('0x9'));router[_0xbf3b('0xa')]('/',auth[_0xbf3b('0xb')](),controller[_0xbf3b('0xc')]);router[_0xbf3b('0xa')](_0xbf3b('0xd'),auth[_0xbf3b('0xb')](),controller['describe']);router[_0xbf3b('0xa')](_0xbf3b('0xe'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0xf')]);router['post']('/',auth[_0xbf3b('0xb')](),controller[_0xbf3b('0x10')]);router[_0xbf3b('0x11')](_0xbf3b('0xe'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0x12')]);router[_0xbf3b('0x13')](_0xbf3b('0xe'),auth[_0xbf3b('0xb')](),controller['destroy']);module[_0xbf3b('0x14')]=router; \ No newline at end of file +var _0x1d20=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','update'];(function(_0x12a064,_0x439211){var _0x2d639f=function(_0x57f27e){while(--_0x57f27e){_0x12a064['push'](_0x12a064['shift']());}};_0x2d639f(++_0x439211);}(_0x1d20,0x106));var _0x01d2=function(_0x3a8e88,_0x27c211){_0x3a8e88=_0x3a8e88-0x0;var _0x2c131e=_0x1d20[_0x3a8e88];return _0x2c131e;};'use strict';var multer=require(_0x01d2('0x0'));var util=require(_0x01d2('0x1'));var path=require(_0x01d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x01d2('0x3'));var router=express[_0x01d2('0x4')]();var fs_extra=require(_0x01d2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x01d2('0x6'));var config=require(_0x01d2('0x7'));var controller=require(_0x01d2('0x8'));router['get']('/',auth[_0x01d2('0x9')](),controller['index']);router[_0x01d2('0xa')](_0x01d2('0xb'),auth[_0x01d2('0x9')](),controller['describe']);router[_0x01d2('0xa')](_0x01d2('0xc'),auth[_0x01d2('0x9')](),controller[_0x01d2('0xd')]);router[_0x01d2('0xe')]('/',auth[_0x01d2('0x9')](),controller[_0x01d2('0xf')]);router[_0x01d2('0x10')](_0x01d2('0xc'),auth['isAuthenticated'](),controller[_0x01d2('0x11')]);router[_0x01d2('0x12')]('/:id',auth[_0x01d2('0x9')](),controller[_0x01d2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 06aab1b..d978d46 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 _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x9f62,0x154));var _0x29f6=function(_0x2215d8,_0x5ad9d3){_0x2215d8=_0x2215d8-0x0;var _0x1d9374=_0x9f62[_0x2215d8];return _0x1d9374;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x454def,_0x44673a){var _0x38c081=function(_0x249f13){while(--_0x249f13){_0x454def['push'](_0x454def['shift']());}};_0x38c081(++_0x44673a);}(_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')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b573808..5db5f3b 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 _0x51e3=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','set','reject','save','then','destroy','end','stack','name','send','index','rawAttributes','type','map','keys','query','filters','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','rows','show','params','intersection','length','find','create','body','catch','update','describe','eml-format','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x51e3,0x1d2));var _0x351e=function(_0x1d5c06,_0x53fdc0){_0x1d5c06=_0x1d5c06-0x0;var _0xaedef8=_0x51e3[_0x1d5c06];return _0xaedef8;};'use strict';var emlformat=require(_0x351e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x351e('0x1'));var rp=require(_0x351e('0x2'));var moment=require(_0x351e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x351e('0x4'));var path=require(_0x351e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x351e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x351e('0x7'));var squel=require(_0x351e('0x8'));var crypto=require(_0x351e('0x9'));var jsforce=require(_0x351e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x351e('0xb'));var querystring=require(_0x351e('0xc'));var Papa=require(_0x351e('0xd'));var Redis=require('ioredis');var authService=require(_0x351e('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x351e('0xf'));var logger=require(_0x351e('0x10'))(_0x351e('0x11'));var utils=require(_0x351e('0x12'));var config=require(_0x351e('0x13'));var licenseUtil=require(_0x351e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fdb1c,_0x374b0b){_0x374b0b=_0x374b0b||0xcc;return function(_0x5774ec){if(_0x5774ec){return _0x2fdb1c[_0x351e('0x15')](_0x374b0b);}return _0x2fdb1c[_0x351e('0x16')](_0x374b0b)['end']();};}function respondWithResult(_0x4c9acc,_0x5bf56b){_0x5bf56b=_0x5bf56b||0xc8;return function(_0x3841e9){if(_0x3841e9){return _0x4c9acc['status'](_0x5bf56b)[_0x351e('0x17')](_0x3841e9);}};}function respondWithFilteredResult(_0x40e6e8,_0x5be93a){return function(_0x3c8219){if(_0x3c8219){var _0x1b835f=typeof _0x5be93a[_0x351e('0x18')]==='undefined'&&typeof _0x5be93a['limit']==='undefined';var _0x38acb6=_0x3c8219['count'];var _0x23c080=_0x1b835f?0x0:_0x5be93a[_0x351e('0x18')];var _0x528653=_0x1b835f?_0x3c8219[_0x351e('0x19')]:_0x5be93a[_0x351e('0x18')]+_0x5be93a[_0x351e('0x1a')];var _0x20696f;if(_0x528653>=_0x38acb6){_0x528653=_0x38acb6;_0x20696f=0xc8;}else{_0x20696f=0xce;}_0x40e6e8[_0x351e('0x16')](_0x20696f);return _0x40e6e8[_0x351e('0x1b')]('Content-Range',_0x23c080+'-'+_0x528653+'/'+_0x38acb6)[_0x351e('0x17')](_0x3c8219);}return null;};}function patchUpdates(_0x2be9e0){return function(_0x467c73){try{jsonpatch['apply'](_0x467c73,_0x2be9e0,!![]);}catch(_0x38a01e){return BPromise[_0x351e('0x1c')](_0x38a01e);}return _0x467c73[_0x351e('0x1d')]();};}function saveUpdates(_0x114161,_0x43302d){return function(_0x3062cb){if(_0x3062cb){return _0x3062cb['update'](_0x114161)[_0x351e('0x1e')](function(_0x4c0f0b){return _0x4c0f0b;});}return null;};}function removeEntity(_0x5ad140,_0x3b47ce){return function(_0x443917){if(_0x443917){return _0x443917[_0x351e('0x1f')]()[_0x351e('0x1e')](function(){_0x5ad140[_0x351e('0x16')](0xcc)[_0x351e('0x20')]();});}};}function handleEntityNotFound(_0x17e7ae,_0x378cce){return function(_0x283513){if(!_0x283513){_0x17e7ae[_0x351e('0x15')](0x194);}return _0x283513;};}function handleError(_0x20a687,_0x396039){_0x396039=_0x396039||0x1f4;return function(_0x29eab0){logger['error'](_0x29eab0[_0x351e('0x21')]);if(_0x29eab0[_0x351e('0x22')]){delete _0x29eab0[_0x351e('0x22')];}_0x20a687[_0x351e('0x16')](_0x396039)[_0x351e('0x23')](_0x29eab0);};}exports[_0x351e('0x24')]=function(_0x5138e0,_0xed3d26){var _0x2bbc18={},_0x5bcaec={},_0x17ab94={'count':0x0,'rows':[]};var _0x125949=_['map'](db['VoiceDialReport'][_0x351e('0x25')],function(_0x3896d7){return{'name':_0x3896d7['fieldName'],'type':_0x3896d7[_0x351e('0x26')]['key']};});_0x5bcaec['model']=_[_0x351e('0x27')](_0x125949,'name');_0x5bcaec['query']=_[_0x351e('0x28')](_0x5138e0[_0x351e('0x29')]);_0x5bcaec[_0x351e('0x2a')]=_['intersection'](_0x5bcaec[_0x351e('0x2b')],_0x5bcaec[_0x351e('0x29')]);_0x2bbc18[_0x351e('0x2c')]=_['intersection'](_0x5bcaec[_0x351e('0x2b')],qs[_0x351e('0x2d')](_0x5138e0[_0x351e('0x29')][_0x351e('0x2d')]));_0x2bbc18[_0x351e('0x2c')]=_0x2bbc18['attributes']['length']?_0x2bbc18[_0x351e('0x2c')]:_0x5bcaec[_0x351e('0x2b')];if(!_0x5138e0[_0x351e('0x29')]['hasOwnProperty'](_0x351e('0x2e'))){_0x2bbc18['limit']=qs[_0x351e('0x1a')](_0x5138e0[_0x351e('0x29')][_0x351e('0x1a')]);_0x2bbc18['offset']=qs['offset'](_0x5138e0[_0x351e('0x29')]['offset']);}_0x2bbc18[_0x351e('0x2f')]=qs[_0x351e('0x30')](_0x5138e0[_0x351e('0x29')]['sort']);_0x2bbc18[_0x351e('0x31')]=qs[_0x351e('0x2a')](_[_0x351e('0x32')](_0x5138e0[_0x351e('0x29')],_0x5bcaec[_0x351e('0x2a')]),_0x125949);if(_0x5138e0[_0x351e('0x29')][_0x351e('0x33')]){_0x2bbc18[_0x351e('0x31')]=_[_0x351e('0x34')](_0x2bbc18['where'],{'$or':_[_0x351e('0x27')](_0x125949,function(_0x49de84){if(_0x49de84['type']!==_0x351e('0x35')){var _0x54e98a={};_0x54e98a[_0x49de84[_0x351e('0x22')]]={'$like':'%'+_0x5138e0['query'][_0x351e('0x33')]+'%'};return _0x54e98a;}})});}_0x2bbc18=_[_0x351e('0x34')]({},_0x2bbc18,_0x5138e0[_0x351e('0x36')]);var _0xef551c={'where':_0x2bbc18[_0x351e('0x31')]};return db[_0x351e('0x37')][_0x351e('0x19')](_0xef551c)[_0x351e('0x1e')](function(_0x23d900){_0x17ab94[_0x351e('0x19')]=_0x23d900;if(_0x5138e0['query'][_0x351e('0x38')]){_0x2bbc18[_0x351e('0x39')]=[{'all':!![]}];}return db[_0x351e('0x37')]['findAll'](_0x2bbc18);})[_0x351e('0x1e')](function(_0x959b98){_0x17ab94[_0x351e('0x3a')]=_0x959b98;return _0x17ab94;})[_0x351e('0x1e')](respondWithFilteredResult(_0xed3d26,_0x2bbc18))['catch'](handleError(_0xed3d26,null));};exports[_0x351e('0x3b')]=function(_0x2ab34a,_0x17f0cf){var _0x25a869={'raw':!![],'where':{'id':_0x2ab34a[_0x351e('0x3c')]['id']}},_0x2934d3={};_0x2934d3['model']=_[_0x351e('0x28')](db[_0x351e('0x37')]['rawAttributes']);_0x2934d3['query']=_[_0x351e('0x28')](_0x2ab34a[_0x351e('0x29')]);_0x2934d3[_0x351e('0x2a')]=_[_0x351e('0x3d')](_0x2934d3[_0x351e('0x2b')],_0x2934d3[_0x351e('0x29')]);_0x25a869[_0x351e('0x2c')]=_[_0x351e('0x3d')](_0x2934d3[_0x351e('0x2b')],qs['fields'](_0x2ab34a['query']['fields']));_0x25a869[_0x351e('0x2c')]=_0x25a869[_0x351e('0x2c')][_0x351e('0x3e')]?_0x25a869[_0x351e('0x2c')]:_0x2934d3[_0x351e('0x2b')];if(_0x2ab34a[_0x351e('0x29')][_0x351e('0x38')]){_0x25a869[_0x351e('0x39')]=[{'all':!![]}];}_0x25a869=_[_0x351e('0x34')]({},_0x25a869,_0x2ab34a[_0x351e('0x36')]);return db[_0x351e('0x37')][_0x351e('0x3f')](_0x25a869)[_0x351e('0x1e')](handleEntityNotFound(_0x17f0cf,null))[_0x351e('0x1e')](respondWithResult(_0x17f0cf,null))['catch'](handleError(_0x17f0cf,null));};exports[_0x351e('0x40')]=function(_0x3aa317,_0x44b8bb){return db[_0x351e('0x37')][_0x351e('0x40')](_0x3aa317[_0x351e('0x41')],{})[_0x351e('0x1e')](respondWithResult(_0x44b8bb,0xc9))[_0x351e('0x42')](handleError(_0x44b8bb,null));};exports[_0x351e('0x43')]=function(_0x2e4906,_0x3aae7d){if(_0x2e4906['body']['id']){delete _0x2e4906[_0x351e('0x41')]['id'];}return db[_0x351e('0x37')][_0x351e('0x3f')]({'where':{'id':_0x2e4906[_0x351e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3aae7d,null))['then'](saveUpdates(_0x2e4906[_0x351e('0x41')],null))[_0x351e('0x1e')](respondWithResult(_0x3aae7d,null))[_0x351e('0x42')](handleError(_0x3aae7d,null));};exports[_0x351e('0x1f')]=function(_0x46ebef,_0x460ba9){return db[_0x351e('0x37')][_0x351e('0x3f')]({'where':{'id':_0x46ebef[_0x351e('0x3c')]['id']}})[_0x351e('0x1e')](handleEntityNotFound(_0x460ba9,null))[_0x351e('0x1e')](removeEntity(_0x460ba9,null))['catch'](handleError(_0x460ba9,null));};exports[_0x351e('0x44')]=function(_0x500b5c,_0x4ff86a){return db['VoiceDialReport'][_0x351e('0x44')]()[_0x351e('0x1e')](respondWithResult(_0x4ff86a,null))['catch'](handleError(_0x4ff86a,null));}; \ No newline at end of file +var _0xfe9d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceDialReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','querystring','papaparse'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0xfe9d,0x1c5));var _0xdfe9=function(_0x1b6a9c,_0x168cf3){_0x1b6a9c=_0x1b6a9c-0x0;var _0x56a969=_0xfe9d[_0x1b6a9c];return _0x56a969;};'use strict';var emlformat=require(_0xdfe9('0x0'));var rimraf=require(_0xdfe9('0x1'));var zipdir=require(_0xdfe9('0x2'));var jsonpatch=require(_0xdfe9('0x3'));var rp=require(_0xdfe9('0x4'));var moment=require(_0xdfe9('0x5'));var BPromise=require(_0xdfe9('0x6'));var Mustache=require(_0xdfe9('0x7'));var util=require(_0xdfe9('0x8'));var path=require('path');var sox=require(_0xdfe9('0x9'));var csv=require(_0xdfe9('0xa'));var ejs=require(_0xdfe9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfe9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdfe9('0xa'));var querystring=require(_0xdfe9('0xd'));var Papa=require(_0xdfe9('0xe'));var Redis=require(_0xdfe9('0xf'));var authService=require(_0xdfe9('0x10'));var qs=require(_0xdfe9('0x11'));var as=require(_0xdfe9('0x12'));var hardwareService=require(_0xdfe9('0x13'));var logger=require(_0xdfe9('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xdfe9('0x15'));var licenseUtil=require(_0xdfe9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c496c,_0x5bc24a){_0x5bc24a=_0x5bc24a||0xcc;return function(_0x56d6e2){if(_0x56d6e2){return _0x1c496c[_0xdfe9('0x17')](_0x5bc24a);}return _0x1c496c[_0xdfe9('0x18')](_0x5bc24a)[_0xdfe9('0x19')]();};}function respondWithResult(_0x2802a8,_0x5cdcf3){_0x5cdcf3=_0x5cdcf3||0xc8;return function(_0x56911b){if(_0x56911b){return _0x2802a8[_0xdfe9('0x18')](_0x5cdcf3)[_0xdfe9('0x1a')](_0x56911b);}};}function respondWithFilteredResult(_0x15ed64,_0x4a051d){return function(_0x272749){if(_0x272749){var _0x278686=typeof _0x4a051d['offset']===_0xdfe9('0x1b')&&typeof _0x4a051d[_0xdfe9('0x1c')]===_0xdfe9('0x1b');var _0x52df95=_0x272749[_0xdfe9('0x1d')];var _0x359f6a=_0x278686?0x0:_0x4a051d['offset'];var _0x55dbd2=_0x278686?_0x272749[_0xdfe9('0x1d')]:_0x4a051d[_0xdfe9('0x1e')]+_0x4a051d['limit'];var _0x9a07a6;if(_0x55dbd2>=_0x52df95){_0x55dbd2=_0x52df95;_0x9a07a6=0xc8;}else{_0x9a07a6=0xce;}_0x15ed64[_0xdfe9('0x18')](_0x9a07a6);return _0x15ed64[_0xdfe9('0x1f')](_0xdfe9('0x20'),_0x359f6a+'-'+_0x55dbd2+'/'+_0x52df95)[_0xdfe9('0x1a')](_0x272749);}return null;};}function patchUpdates(_0x36be7f){return function(_0x394ce2){try{jsonpatch['apply'](_0x394ce2,_0x36be7f,!![]);}catch(_0x46d799){return BPromise[_0xdfe9('0x21')](_0x46d799);}return _0x394ce2[_0xdfe9('0x22')]();};}function saveUpdates(_0xbcbfe9,_0x31f069){return function(_0x2dd13a){if(_0x2dd13a){return _0x2dd13a[_0xdfe9('0x23')](_0xbcbfe9)['then'](function(_0x35b35e){return _0x35b35e;});}return null;};}function removeEntity(_0x2415a9,_0x7efc7a){return function(_0x1d4e3d){if(_0x1d4e3d){return _0x1d4e3d[_0xdfe9('0x24')]()[_0xdfe9('0x25')](function(){_0x2415a9[_0xdfe9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ae14,_0x376b3b){return function(_0x5c7a67){if(!_0x5c7a67){_0x25ae14[_0xdfe9('0x17')](0x194);}return _0x5c7a67;};}function handleError(_0x3acedf,_0x142a43){_0x142a43=_0x142a43||0x1f4;return function(_0x2159e7){logger[_0xdfe9('0x26')](_0x2159e7[_0xdfe9('0x27')]);if(_0x2159e7[_0xdfe9('0x28')]){delete _0x2159e7[_0xdfe9('0x28')];}_0x3acedf[_0xdfe9('0x18')](_0x142a43)[_0xdfe9('0x29')](_0x2159e7);};}exports[_0xdfe9('0x2a')]=function(_0x1eaffa,_0x202cff){var _0x27a212={},_0x5353b2={},_0x39e3cd={'count':0x0,'rows':[]};var _0x446126=_['map'](db['VoiceDialReport'][_0xdfe9('0x2b')],function(_0x3ec53c){return{'name':_0x3ec53c[_0xdfe9('0x2c')],'type':_0x3ec53c[_0xdfe9('0x2d')][_0xdfe9('0x2e')]};});_0x5353b2[_0xdfe9('0x2f')]=_[_0xdfe9('0x30')](_0x446126,_0xdfe9('0x28'));_0x5353b2[_0xdfe9('0x31')]=_[_0xdfe9('0x32')](_0x1eaffa[_0xdfe9('0x31')]);_0x5353b2[_0xdfe9('0x33')]=_['intersection'](_0x5353b2[_0xdfe9('0x2f')],_0x5353b2[_0xdfe9('0x31')]);_0x27a212[_0xdfe9('0x34')]=_[_0xdfe9('0x35')](_0x5353b2[_0xdfe9('0x2f')],qs[_0xdfe9('0x36')](_0x1eaffa[_0xdfe9('0x31')][_0xdfe9('0x36')]));_0x27a212[_0xdfe9('0x34')]=_0x27a212[_0xdfe9('0x34')][_0xdfe9('0x37')]?_0x27a212[_0xdfe9('0x34')]:_0x5353b2[_0xdfe9('0x2f')];if(!_0x1eaffa[_0xdfe9('0x31')][_0xdfe9('0x38')](_0xdfe9('0x39'))){_0x27a212[_0xdfe9('0x1c')]=qs[_0xdfe9('0x1c')](_0x1eaffa[_0xdfe9('0x31')][_0xdfe9('0x1c')]);_0x27a212[_0xdfe9('0x1e')]=qs[_0xdfe9('0x1e')](_0x1eaffa[_0xdfe9('0x31')]['offset']);}_0x27a212[_0xdfe9('0x3a')]=qs[_0xdfe9('0x3b')](_0x1eaffa['query'][_0xdfe9('0x3b')]);_0x27a212['where']=qs[_0xdfe9('0x33')](_[_0xdfe9('0x3c')](_0x1eaffa[_0xdfe9('0x31')],_0x5353b2['filters']),_0x446126);if(_0x1eaffa[_0xdfe9('0x31')][_0xdfe9('0x3d')]){_0x27a212[_0xdfe9('0x3e')]=_[_0xdfe9('0x3f')](_0x27a212['where'],{'$or':_['map'](_0x446126,function(_0x15b104){if(_0x15b104[_0xdfe9('0x2d')]!==_0xdfe9('0x40')){var _0x4acb06={};_0x4acb06[_0x15b104[_0xdfe9('0x28')]]={'$like':'%'+_0x1eaffa[_0xdfe9('0x31')][_0xdfe9('0x3d')]+'%'};return _0x4acb06;}})});}_0x27a212=_[_0xdfe9('0x3f')]({},_0x27a212,_0x1eaffa[_0xdfe9('0x41')]);var _0x7a30ab={'where':_0x27a212['where']};return db[_0xdfe9('0x42')]['count'](_0x7a30ab)['then'](function(_0x2291cd){_0x39e3cd['count']=_0x2291cd;if(_0x1eaffa[_0xdfe9('0x31')][_0xdfe9('0x43')]){_0x27a212['include']=[{'all':!![]}];}return db[_0xdfe9('0x42')][_0xdfe9('0x44')](_0x27a212);})[_0xdfe9('0x25')](function(_0x3b1fb8){_0x39e3cd[_0xdfe9('0x45')]=_0x3b1fb8;return _0x39e3cd;})[_0xdfe9('0x25')](respondWithFilteredResult(_0x202cff,_0x27a212))[_0xdfe9('0x46')](handleError(_0x202cff,null));};exports[_0xdfe9('0x47')]=function(_0x67af64,_0x529438){var _0x4505ea={'raw':!![],'where':{'id':_0x67af64[_0xdfe9('0x48')]['id']}},_0x80557b={};_0x80557b[_0xdfe9('0x2f')]=_['keys'](db[_0xdfe9('0x42')][_0xdfe9('0x2b')]);_0x80557b['query']=_[_0xdfe9('0x32')](_0x67af64[_0xdfe9('0x31')]);_0x80557b[_0xdfe9('0x33')]=_[_0xdfe9('0x35')](_0x80557b[_0xdfe9('0x2f')],_0x80557b['query']);_0x4505ea[_0xdfe9('0x34')]=_[_0xdfe9('0x35')](_0x80557b[_0xdfe9('0x2f')],qs['fields'](_0x67af64[_0xdfe9('0x31')][_0xdfe9('0x36')]));_0x4505ea[_0xdfe9('0x34')]=_0x4505ea[_0xdfe9('0x34')][_0xdfe9('0x37')]?_0x4505ea[_0xdfe9('0x34')]:_0x80557b[_0xdfe9('0x2f')];if(_0x67af64['query'][_0xdfe9('0x43')]){_0x4505ea[_0xdfe9('0x49')]=[{'all':!![]}];}_0x4505ea=_[_0xdfe9('0x3f')]({},_0x4505ea,_0x67af64[_0xdfe9('0x41')]);return db[_0xdfe9('0x42')][_0xdfe9('0x4a')](_0x4505ea)[_0xdfe9('0x25')](handleEntityNotFound(_0x529438,null))['then'](respondWithResult(_0x529438,null))['catch'](handleError(_0x529438,null));};exports[_0xdfe9('0x4b')]=function(_0xae5f35,_0x39d901){return db[_0xdfe9('0x42')][_0xdfe9('0x4b')](_0xae5f35['body'],{})[_0xdfe9('0x25')](respondWithResult(_0x39d901,0xc9))['catch'](handleError(_0x39d901,null));};exports[_0xdfe9('0x23')]=function(_0xb9ce6f,_0x16c812){if(_0xb9ce6f[_0xdfe9('0x4c')]['id']){delete _0xb9ce6f[_0xdfe9('0x4c')]['id'];}return db[_0xdfe9('0x42')][_0xdfe9('0x4a')]({'where':{'id':_0xb9ce6f[_0xdfe9('0x48')]['id']}})['then'](handleEntityNotFound(_0x16c812,null))[_0xdfe9('0x25')](saveUpdates(_0xb9ce6f[_0xdfe9('0x4c')],null))[_0xdfe9('0x25')](respondWithResult(_0x16c812,null))['catch'](handleError(_0x16c812,null));};exports[_0xdfe9('0x24')]=function(_0x4f527a,_0x4dc14d){return db['VoiceDialReport'][_0xdfe9('0x4a')]({'where':{'id':_0x4f527a['params']['id']}})[_0xdfe9('0x25')](handleEntityNotFound(_0x4dc14d,null))[_0xdfe9('0x25')](removeEntity(_0x4dc14d,null))[_0xdfe9('0x46')](handleError(_0x4dc14d,null));};exports[_0xdfe9('0x4d')]=function(_0x5dc394,_0x47580c){return db[_0xdfe9('0x42')]['describe']()[_0xdfe9('0x25')](respondWithResult(_0x47580c,null))[_0xdfe9('0x46')](handleError(_0x47580c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 77e8a39..91aa2e4 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 _0xae6b=['bluebird','request-promise','path','rimraf','exports','define','VoiceDialReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1c42a4,_0x10a808){var _0x262461=function(_0x52f897){while(--_0x52f897){_0x1c42a4['push'](_0x1c42a4['shift']());}};_0x262461(++_0x10a808);}(_0xae6b,0x158));var _0xbae6=function(_0xf7bf02,_0x13da13){_0xf7bf02=_0xf7bf02-0x0;var _0x4f263f=_0xae6b[_0xf7bf02];return _0x4f263f;};'use strict';var _=require(_0xbae6('0x0'));var util=require('util');var logger=require(_0xbae6('0x1'))(_0xbae6('0x2'));var moment=require(_0xbae6('0x3'));var BPromise=require(_0xbae6('0x4'));var rp=require(_0xbae6('0x5'));var fs=require('fs');var path=require(_0xbae6('0x6'));var rimraf=require(_0xbae6('0x7'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xbae6('0x8')]=function(_0x47597b,_0x24e0ad){return _0x47597b[_0xbae6('0x9')](_0xbae6('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xbae6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3584=['../../config/logger','api','moment','request-promise','rimraf','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util'];(function(_0xb51db3,_0x4c09b6){var _0x54ca89=function(_0x5dd7a2){while(--_0x5dd7a2){_0xb51db3['push'](_0xb51db3['shift']());}};_0x54ca89(++_0x4c09b6);}(_0x3584,0x8e));var _0x4358=function(_0x144a20,_0x157db4){_0x144a20=_0x144a20-0x0;var _0x49aca9=_0x3584[_0x144a20];return _0x49aca9;};'use strict';var _=require(_0x4358('0x0'));var util=require(_0x4358('0x1'));var logger=require(_0x4358('0x2'))(_0x4358('0x3'));var moment=require(_0x4358('0x4'));var BPromise=require('bluebird');var rp=require(_0x4358('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4358('0x6'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x4358('0x7')]=function(_0x48e1bd,_0x323abf){return _0x48e1bd[_0x4358('0x8')](_0x4358('0x9'),attributes,{'tableName':_0x4358('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4358('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 5b617ec..76fd2d4 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 _0x2460=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','CreateVoiceDialReport','create','options','raw','then','stringify','update','where','attributes','UpdateVoiceDialReport','moment','bluebird'];(function(_0x11261a,_0x1e66f9){var _0xa98b3b=function(_0x1fa535){while(--_0x1fa535){_0x11261a['push'](_0x11261a['shift']());}};_0xa98b3b(++_0x1e66f9);}(_0x2460,0xac));var _0x0246=function(_0x4b33dd,_0x2d64c0){_0x4b33dd=_0x4b33dd-0x0;var _0x579efe=_0x2460[_0x4b33dd];return _0x579efe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0246('0x0'));var BPromise=require(_0x0246('0x1'));var rs=require(_0x0246('0x2'));var fs=require('fs');var Redis=require(_0x0246('0x3'));var db=require(_0x0246('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0246('0x5'))(_0x0246('0x6'));var config=require(_0x0246('0x7'));var jayson=require(_0x0246('0x8'));var client=jayson[_0x0246('0x9')][_0x0246('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31398f,_0x2fbecb,_0x2591ba){return new BPromise(function(_0x560384,_0xef3990){return client[_0x0246('0xb')](_0x31398f,_0x2591ba)['then'](function(_0x25e360){logger[_0x0246('0xc')](_0x0246('0xd'),_0x2fbecb,_0x0246('0xe'));logger[_0x0246('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2fbecb,_0x0246('0xe'),JSON['stringify'](_0x25e360));if(_0x25e360[_0x0246('0x10')]){if(_0x25e360[_0x0246('0x10')]['code']===0x1f4){logger[_0x0246('0x10')](_0x0246('0xd'),_0x2fbecb,_0x25e360['error'][_0x0246('0x11')]);return _0xef3990(_0x25e360[_0x0246('0x10')][_0x0246('0x11')]);}logger[_0x0246('0x10')](_0x0246('0xd'),_0x2fbecb,_0x25e360['error'][_0x0246('0x11')]);return _0x560384(_0x25e360[_0x0246('0x10')]['message']);}else{logger['info'](_0x0246('0xd'),_0x2fbecb,_0x0246('0xe'));_0x560384(_0x25e360['result'][_0x0246('0x11')]);}})[_0x0246('0x12')](function(_0x12f8ea){logger[_0x0246('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x2fbecb,_0x12f8ea);_0xef3990(_0x12f8ea);});});}exports[_0x0246('0x13')]=function(_0x227212){var _0x5a8841=this;return new Promise(function(_0x2f45d8,_0x238b01){return db['VoiceDialReport'][_0x0246('0x14')](_0x227212['body'],{'raw':_0x227212[_0x0246('0x15')]?_0x227212['options'][_0x0246('0x16')]===undefined?!![]:![]:!![]})[_0x0246('0x17')](function(_0x536f82){logger[_0x0246('0xc')](_0x0246('0x13'),_0x227212);logger[_0x0246('0xf')](_0x0246('0x13'),_0x227212,JSON[_0x0246('0x18')](_0x536f82));_0x2f45d8(_0x536f82);})[_0x0246('0x12')](function(_0x14a00b){logger['error']('CreateVoiceDialReport',_0x14a00b[_0x0246('0x11')],_0x227212);_0x238b01(_0x5a8841[_0x0246('0x10')](0x1f4,_0x14a00b[_0x0246('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x45c55e){var _0x402416=this;return new Promise(function(_0x5aa249,_0x3e1fb5){return db['VoiceDialReport'][_0x0246('0x19')](_0x45c55e['body'],{'raw':_0x45c55e[_0x0246('0x15')]?_0x45c55e['options'][_0x0246('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45c55e['options']?_0x45c55e['options'][_0x0246('0x1a')]||null:null,'attributes':_0x45c55e[_0x0246('0x15')]?_0x45c55e[_0x0246('0x15')][_0x0246('0x1b')]||null:null,'limit':_0x45c55e[_0x0246('0x15')]?_0x45c55e[_0x0246('0x15')]['limit']||null:null})[_0x0246('0x17')](function(_0x546824){logger['info'](_0x0246('0x1c'),_0x45c55e);logger[_0x0246('0xf')]('UpdateVoiceDialReport',_0x45c55e,JSON[_0x0246('0x18')](_0x546824));_0x5aa249(_0x546824);})[_0x0246('0x12')](function(_0x3066fe){logger['error'](_0x0246('0x1c'),_0x3066fe[_0x0246('0x11')],_0x45c55e);_0x3e1fb5(_0x402416['error'](0x1f4,_0x3066fe['message']));});});}; \ No newline at end of file +var _0xe205=['create','body','options','raw','then','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport'];(function(_0xf471e6,_0x11a808){var _0x4464fd=function(_0x2498e2){while(--_0x2498e2){_0xf471e6['push'](_0xf471e6['shift']());}};_0x4464fd(++_0x11a808);}(_0xe205,0x76));var _0x5e20=function(_0x4ffd22,_0x40ae82){_0x4ffd22=_0x4ffd22-0x0;var _0x566b2d=_0xe205[_0x4ffd22];return _0x566b2d;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))(_0x5e20('0x9'));var config=require(_0x5e20('0xa'));var jayson=require(_0x5e20('0xb'));var client=jayson[_0x5e20('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58f6ff,_0x7e578,_0x1df389){return new BPromise(function(_0x3b17be,_0xcc09ff){return client[_0x5e20('0xd')](_0x58f6ff,_0x1df389)['then'](function(_0x23674c){logger[_0x5e20('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x7e578,_0x5e20('0xf'));logger[_0x5e20('0x10')](_0x5e20('0x11'),_0x7e578,_0x5e20('0xf'),JSON[_0x5e20('0x12')](_0x23674c));if(_0x23674c[_0x5e20('0x13')]){if(_0x23674c['error']['code']===0x1f4){logger[_0x5e20('0x13')](_0x5e20('0x14'),_0x7e578,_0x23674c[_0x5e20('0x13')]['message']);return _0xcc09ff(_0x23674c[_0x5e20('0x13')]['message']);}logger[_0x5e20('0x13')](_0x5e20('0x14'),_0x7e578,_0x23674c[_0x5e20('0x13')]['message']);return _0x3b17be(_0x23674c[_0x5e20('0x13')][_0x5e20('0x15')]);}else{logger[_0x5e20('0xe')](_0x5e20('0x14'),_0x7e578,_0x5e20('0xf'));_0x3b17be(_0x23674c[_0x5e20('0x16')][_0x5e20('0x15')]);}})[_0x5e20('0x17')](function(_0x5c42a1){logger[_0x5e20('0x13')](_0x5e20('0x14'),_0x7e578,_0x5c42a1);_0xcc09ff(_0x5c42a1);});});}exports[_0x5e20('0x18')]=function(_0x2f421f){var _0x29fabc=this;return new Promise(function(_0xd172e,_0xff1ac5){return db[_0x5e20('0x19')][_0x5e20('0x1a')](_0x2f421f[_0x5e20('0x1b')],{'raw':_0x2f421f['options']?_0x2f421f[_0x5e20('0x1c')][_0x5e20('0x1d')]===undefined?!![]:![]:!![]})[_0x5e20('0x1e')](function(_0xe84d33){logger[_0x5e20('0xe')](_0x5e20('0x18'),_0x2f421f);logger[_0x5e20('0x10')]('CreateVoiceDialReport',_0x2f421f,JSON['stringify'](_0xe84d33));_0xd172e(_0xe84d33);})['catch'](function(_0x4ab898){logger[_0x5e20('0x13')](_0x5e20('0x18'),_0x4ab898[_0x5e20('0x15')],_0x2f421f);_0xff1ac5(_0x29fabc['error'](0x1f4,_0x4ab898['message']));});});};exports[_0x5e20('0x1f')]=function(_0x47e38e){var _0x1d724a=this;return new Promise(function(_0x415b82,_0x2dedda){return db['VoiceDialReport'][_0x5e20('0x20')](_0x47e38e[_0x5e20('0x1b')],{'raw':_0x47e38e[_0x5e20('0x1c')]?_0x47e38e[_0x5e20('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47e38e[_0x5e20('0x1c')]?_0x47e38e['options'][_0x5e20('0x21')]||null:null,'attributes':_0x47e38e[_0x5e20('0x1c')]?_0x47e38e[_0x5e20('0x1c')][_0x5e20('0x22')]||null:null,'limit':_0x47e38e[_0x5e20('0x1c')]?_0x47e38e[_0x5e20('0x1c')][_0x5e20('0x23')]||null:null})['then'](function(_0x4d1753){logger[_0x5e20('0xe')](_0x5e20('0x1f'),_0x47e38e);logger[_0x5e20('0x10')](_0x5e20('0x1f'),_0x47e38e,JSON[_0x5e20('0x12')](_0x4d1753));_0x415b82(_0x4d1753);})[_0x5e20('0x17')](function(_0x3595f6){logger[_0x5e20('0x13')]('UpdateVoiceDialReport',_0x3595f6['message'],_0x47e38e);_0x2dedda(_0x1d724a[_0x5e20('0x13')](0x1f4,_0x3595f6[_0x5e20('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index dc99b4b..9387225 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 _0xb37e=['delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update'];(function(_0x3d131a,_0x2ee691){var _0x44c22d=function(_0xa7a9fe){while(--_0xa7a9fe){_0x3d131a['push'](_0x3d131a['shift']());}};_0x44c22d(++_0x2ee691);}(_0xb37e,0x1dd));var _0xeb37=function(_0xac0487,_0x5ea0a2){_0xac0487=_0xac0487-0x0;var _0x417aa5=_0xb37e[_0xac0487];return _0x417aa5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb37('0x0'));var timeout=require(_0xeb37('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeb37('0x2'));var auth=require(_0xeb37('0x3'));var interaction=require(_0xeb37('0x4'));var config=require(_0xeb37('0x5'));var controller=require(_0xeb37('0x6'));router[_0xeb37('0x7')]('/',auth[_0xeb37('0x8')](),controller[_0xeb37('0x9')]);router[_0xeb37('0x7')](_0xeb37('0xa'),auth['isAuthenticated'](),controller[_0xeb37('0xb')]);router['post']('/',auth[_0xeb37('0x8')](),controller['create']);router[_0xeb37('0xc')](_0xeb37('0xd'),auth[_0xeb37('0x8')](),controller[_0xeb37('0xe')]);router[_0xeb37('0xf')](_0xeb37('0xa'),auth[_0xeb37('0x8')](),controller[_0xeb37('0x10')]);router[_0xeb37('0x11')](_0xeb37('0xa'),auth[_0xeb37('0x8')](),controller[_0xeb37('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5658=['./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','addApplications','put','/:id','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31591e,_0xaf8b47){var _0x3e8b62=function(_0x233e83){while(--_0x233e83){_0x31591e['push'](_0x31591e['shift']());}};_0x3e8b62(++_0xaf8b47);}(_0x5658,0x1d6));var _0x8565=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5658[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x8565('0x0'));var util=require('util');var path=require(_0x8565('0x1'));var timeout=require(_0x8565('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8565('0x3'));var auth=require(_0x8565('0x4'));var interaction=require(_0x8565('0x5'));var config=require('../../config/environment');var controller=require(_0x8565('0x6'));router[_0x8565('0x7')]('/',auth[_0x8565('0x8')](),controller[_0x8565('0x9')]);router[_0x8565('0x7')]('/:id',auth[_0x8565('0x8')](),controller[_0x8565('0xa')]);router[_0x8565('0xb')]('/',auth[_0x8565('0x8')](),controller['create']);router[_0x8565('0xb')](_0x8565('0xc'),auth[_0x8565('0x8')](),controller[_0x8565('0xd')]);router[_0x8565('0xe')](_0x8565('0xf'),auth[_0x8565('0x8')](),controller['update']);router[_0x8565('0x10')](_0x8565('0xf'),auth[_0x8565('0x8')](),controller['destroy']);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 be9d803..9d63c2d 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 _0x9555=['INTEGER','BOOLEAN','getDataValue','sequelize','exports','STRING','compositeIndex','inbound','outbound','outbound-fax','system','any','*,*,*,*'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x9555,0x17c));var _0x5955=function(_0x329642,_0x5ef9a5){_0x329642=_0x329642-0x0;var _0x3d707c=_0x9555[_0x329642];return _0x3d707c;};'use strict';var Sequelize=require(_0x5955('0x0'));module[_0x5955('0x1')]={'context':{'type':Sequelize[_0x5955('0x2')],'allowNull':![],'unique':_0x5955('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5955('0x2')],'allowNull':![],'unique':_0x5955('0x3')},'priority':{'type':Sequelize[_0x5955('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x5955('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5955('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x5955('0x4'),_0x5955('0x5'),'internal','inbound-fax',_0x5955('0x6'),_0x5955('0x7'),_0x5955('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x5955('0x2')]},'interval':{'type':Sequelize[_0x5955('0x2')],'allowNull':![],'defaultValue':_0x5955('0x9')},'IntervalId':{'type':Sequelize[_0x5955('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x5955('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x5955('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5955('0xa')]},'recordingFormat':{'type':Sequelize[_0x5955('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x5955('0xb')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x11b79b){return this[_0x5955('0xc')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x51a6=['system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x51a6,0x14d));var _0x651a=function(_0x45a7a6,_0x380289){_0x45a7a6=_0x45a7a6-0x0;var _0x514f51=_0x51a6[_0x45a7a6];return _0x514f51;};'use strict';var Sequelize=require(_0x651a('0x0'));module[_0x651a('0x1')]={'context':{'type':Sequelize[_0x651a('0x2')],'allowNull':![],'unique':_0x651a('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x651a('0x2')],'allowNull':![],'unique':_0x651a('0x3')},'priority':{'type':Sequelize[_0x651a('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x651a('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x651a('0x2')],'allowNull':![],'defaultValue':_0x651a('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x651a('0x5'),_0x651a('0x6'),_0x651a('0x7'),_0x651a('0x8'),'outbound-fax',_0x651a('0x9'),_0x651a('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x651a('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x651a('0xb')},'IntervalId':{'type':Sequelize[_0x651a('0xc')]},'isApp':{'type':Sequelize[_0x651a('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x651a('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x651a('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x651a('0x2')],'defaultValue':_0x651a('0xe')},'answer':{'type':Sequelize[_0x651a('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x651a('0xf')],'get':function(_0x5b70aa){return this[_0x651a('0x10')](_0x651a('0x11'));}},'alias':{'type':Sequelize[_0x651a('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 69f9e3d..e5768f0 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 _0x8bc8=['VoiceExtensionId','isApp','createRouting','log','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','end','status','json','undefined','count','offset','limit','set','destroy','then','get','inbound','OutboundRoutes','InternalRoutes','internal','filter','map','value','type','UserProfileResource','error','stack','name','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','outbound','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction'];(function(_0x5b6fde,_0x302b91){var _0x44847e=function(_0x5beaa3){while(--_0x5beaa3){_0x5b6fde['push'](_0x5b6fde['shift']());}};_0x44847e(++_0x302b91);}(_0x8bc8,0x1c0));var _0x88bc=function(_0x4c8812,_0xa9d102){_0x4c8812=_0x4c8812-0x0;var _0x42d129=_0x8bc8[_0x4c8812];return _0x42d129;};'use strict';var _=require('lodash');var Redis=require(_0x88bc('0x0'));var qs=require(_0x88bc('0x1'));var logger=require(_0x88bc('0x2'))(_0x88bc('0x3'));var config=require(_0x88bc('0x4'));var db=require('../../mysqldb')['db'];config[_0x88bc('0x5')]=_[_0x88bc('0x6')](config[_0x88bc('0x5')],{'host':_0x88bc('0x7'),'port':0x18eb});var socket=require(_0x88bc('0x8'))(new Redis(config[_0x88bc('0x5')]));require(_0x88bc('0x9'))['register'](socket);function respondWithStatusCode(_0x513867,_0xce299a){_0xce299a=_0xce299a||0xcc;return function(_0x63c072){if(_0x63c072){return _0x513867[_0x88bc('0xa')](_0xce299a);}return _0x513867['status'](_0xce299a)[_0x88bc('0xb')]();};}function respondWithResult(_0xa11133,_0xbfa2af){_0xbfa2af=_0xbfa2af||0xc8;return function(_0x1ed625){if(_0x1ed625){return _0xa11133[_0x88bc('0xc')](_0xbfa2af)[_0x88bc('0xd')](_0x1ed625);}};}function respondWithFilteredResult(_0x45adf5,_0x46dc6d){return function(_0x543466){if(_0x543466){var _0x65c809=typeof _0x46dc6d['offset']===_0x88bc('0xe')&&typeof _0x46dc6d['limit']===_0x88bc('0xe');var _0x53d9f5=_0x543466[_0x88bc('0xf')];var _0x26f72f=_0x65c809?0x0:_0x46dc6d[_0x88bc('0x10')];var _0xf1378c=_0x65c809?_0x543466[_0x88bc('0xf')]:_0x46dc6d['offset']+_0x46dc6d[_0x88bc('0x11')];var _0x42db9a;if(_0xf1378c>=_0x53d9f5){_0xf1378c=_0x53d9f5;_0x42db9a=0xc8;}else{_0x42db9a=0xce;}_0x45adf5[_0x88bc('0xc')](_0x42db9a);return _0x45adf5[_0x88bc('0x12')]('Content-Range',_0x26f72f+'-'+_0xf1378c+'/'+_0x53d9f5)[_0x88bc('0xd')](_0x543466);}return null;};}function removeEntity(_0x1aae0b){return function(_0x27085a){if(_0x27085a){return _0x27085a[_0x88bc('0x13')]()[_0x88bc('0x14')](function(){var _0x54cefa=_0x27085a[_0x88bc('0x15')]({'plain':!![]});var _0x843f20=[{'name':'InboundRoutes','value':_0x88bc('0x16'),'ignore':![]},{'name':_0x88bc('0x17'),'value':'outbound','ignore':![]},{'name':_0x88bc('0x18'),'value':_0x88bc('0x19'),'ignore':![]}];var _0x166236=_(_0x843f20)[_0x88bc('0x1a')]('ignore')[_0x88bc('0x1b')](_0x88bc('0x1c'))['value']();if(_['includes'](_0x166236,_0x54cefa[_0x88bc('0x1d')])){return;}var _0x328ae4=_['find'](_0x843f20,[_0x88bc('0x1c'),_0x54cefa[_0x88bc('0x1d')]])['name'];return db[_0x88bc('0x1e')][_0x88bc('0x13')]({'where':{'type':_0x328ae4,'resourceId':_0x54cefa['id']}})[_0x88bc('0x14')](function(){return _0x27085a;});})['then'](function(){_0x1aae0b[_0x88bc('0xc')](0xcc)[_0x88bc('0xb')]();});}};}function handleEntityNotFound(_0x10a61d){return function(_0x24899c){if(!_0x24899c){_0x10a61d[_0x88bc('0xa')](0x194);}return _0x24899c;};}function handleError(_0x3e0dc1,_0xe6d10d){_0xe6d10d=_0xe6d10d||0x1f4;return function(_0x5b87e8){logger[_0x88bc('0x1f')](_0x5b87e8[_0x88bc('0x20')]);if(_0x5b87e8[_0x88bc('0x21')]){delete _0x5b87e8[_0x88bc('0x21')];}_0x3e0dc1[_0x88bc('0xc')](_0xe6d10d)['send'](_0x5b87e8);};}exports[_0x88bc('0x22')]=function(_0x2d1ed7,_0x436af1){var _0x584551={},_0x42f5fb={},_0x3b198b={'count':0x0,'rows':[]};var _0x509511=_[_0x88bc('0x1b')](db[_0x88bc('0x23')][_0x88bc('0x24')],function(_0x25e5b7){return{'name':_0x25e5b7[_0x88bc('0x25')],'type':_0x25e5b7[_0x88bc('0x1d')][_0x88bc('0x26')]};});_0x42f5fb[_0x88bc('0x27')]=_[_0x88bc('0x1b')](_0x509511,_0x88bc('0x21'));_0x42f5fb[_0x88bc('0x28')]=_[_0x88bc('0x29')](_0x2d1ed7[_0x88bc('0x28')]);_0x42f5fb[_0x88bc('0x2a')]=_[_0x88bc('0x2b')](_0x42f5fb[_0x88bc('0x27')],_0x42f5fb[_0x88bc('0x28')]);_0x584551[_0x88bc('0x2c')]=_['intersection'](_0x42f5fb[_0x88bc('0x27')],qs['fields'](_0x2d1ed7[_0x88bc('0x28')][_0x88bc('0x2d')]));_0x584551[_0x88bc('0x2c')]=_0x584551[_0x88bc('0x2c')]['length']?_0x584551[_0x88bc('0x2c')]:_0x42f5fb['model'];if(!_0x2d1ed7[_0x88bc('0x28')]['hasOwnProperty'](_0x88bc('0x2e'))){_0x584551['limit']=qs[_0x88bc('0x11')](_0x2d1ed7['query'][_0x88bc('0x11')]);_0x584551['offset']=qs[_0x88bc('0x10')](_0x2d1ed7[_0x88bc('0x28')][_0x88bc('0x10')]);}_0x584551[_0x88bc('0x2f')]=qs[_0x88bc('0x30')](_0x2d1ed7[_0x88bc('0x28')][_0x88bc('0x30')]);_0x584551[_0x88bc('0x31')]=qs[_0x88bc('0x2a')](_[_0x88bc('0x32')](_0x2d1ed7[_0x88bc('0x28')],_0x42f5fb[_0x88bc('0x2a')]),_0x509511);if(_0x2d1ed7[_0x88bc('0x28')]['filter']){_0x584551[_0x88bc('0x31')]=_[_0x88bc('0x33')](_0x584551[_0x88bc('0x31')],{'$or':_[_0x88bc('0x1b')](_0x509511,function(_0x3eb6f0){if(_0x3eb6f0['type']!==_0x88bc('0x34')){var _0xb3d8c2={};_0xb3d8c2[_0x3eb6f0[_0x88bc('0x21')]]={'$like':'%'+_0x2d1ed7[_0x88bc('0x28')][_0x88bc('0x1a')]+'%'};return _0xb3d8c2;}})});}_0x584551=_[_0x88bc('0x33')]({},_0x584551,_0x2d1ed7[_0x88bc('0x35')]);var _0x284d8f={'where':_0x584551[_0x88bc('0x31')]};return db['VoiceExtension'][_0x88bc('0xf')](_0x284d8f)[_0x88bc('0x14')](function(_0x232bf1){_0x3b198b[_0x88bc('0xf')]=_0x232bf1;if(_0x2d1ed7['query'][_0x88bc('0x36')]){_0x584551[_0x88bc('0x37')]=[{'all':!![]}];}return db[_0x88bc('0x23')][_0x88bc('0x38')](_0x584551);})[_0x88bc('0x14')](function(_0x2ece9f){_0x3b198b[_0x88bc('0x39')]=_0x2ece9f;return _0x3b198b;})[_0x88bc('0x14')](respondWithFilteredResult(_0x436af1,_0x584551))[_0x88bc('0x3a')](handleError(_0x436af1,null));};exports[_0x88bc('0x3b')]=function(_0x4169b5,_0x362e2c){var _0x222a39={'raw':![],'where':{'id':_0x4169b5[_0x88bc('0x3c')]['id']}},_0x29cabc={};_0x29cabc[_0x88bc('0x27')]=_[_0x88bc('0x29')](db[_0x88bc('0x23')]['rawAttributes']);_0x29cabc[_0x88bc('0x28')]=_['keys'](_0x4169b5['query']);_0x29cabc['filters']=_['intersection'](_0x29cabc['model'],_0x29cabc[_0x88bc('0x28')]);_0x222a39[_0x88bc('0x2c')]=_[_0x88bc('0x2b')](_0x29cabc[_0x88bc('0x27')],qs[_0x88bc('0x2d')](_0x4169b5['query'][_0x88bc('0x2d')]));_0x222a39[_0x88bc('0x2c')]=_0x222a39[_0x88bc('0x2c')]['length']?_0x222a39['attributes']:_0x29cabc['model'];if(_0x4169b5[_0x88bc('0x28')][_0x88bc('0x36')]){_0x222a39[_0x88bc('0x37')]=[{'all':!![]}];}_0x222a39=_[_0x88bc('0x33')]({},_0x222a39,_0x4169b5[_0x88bc('0x35')]);return db[_0x88bc('0x23')][_0x88bc('0x3d')](_0x222a39)['then'](handleEntityNotFound(_0x362e2c,null))[_0x88bc('0x14')](respondWithResult(_0x362e2c,null))['catch'](handleError(_0x362e2c,null));};exports[_0x88bc('0x13')]=function(_0x1bf0a6,_0x2b3b06){return db[_0x88bc('0x23')]['find']({'where':{'id':_0x1bf0a6[_0x88bc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2b3b06,null))[_0x88bc('0x14')](removeEntity(_0x2b3b06,null))[_0x88bc('0x3a')](handleError(_0x2b3b06,null));};exports[_0x88bc('0x3e')]=function(_0x40bca6,_0x1c9f96){if(_0x40bca6[_0x88bc('0x3f')]['type']===_0x88bc('0x40')&&!_['startsWith'](_0x40bca6[_0x88bc('0x3f')][_0x88bc('0x41')],'_')){_0x40bca6[_0x88bc('0x3f')][_0x88bc('0x41')]='_'['concat'](_0x40bca6[_0x88bc('0x3f')]['exten']);}return db[_0x88bc('0x23')]['create'](_0x40bca6[_0x88bc('0x3f')],{'raw':![]})[_0x88bc('0x14')](function(_0x44e27f){var _0x25deb3=_0x40bca6[_0x88bc('0x42')][_0x88bc('0x15')]({'plain':!![]});if(!_0x25deb3)throw new Error(_0x88bc('0x43'));if(_0x25deb3[_0x88bc('0x44')]===_0x88bc('0x42')){var _0x37ce2f=_0x44e27f['get']({'plain':!![]});var _0x3a51bf=[{'name':'InboundRoutes','value':_0x88bc('0x16')},{'name':_0x88bc('0x17'),'value':_0x88bc('0x40')},{'name':_0x88bc('0x18'),'value':_0x88bc('0x19')}];var _0x7cad44=_[_0x88bc('0x3d')](_0x3a51bf,[_0x88bc('0x1c'),_0x37ce2f['type']])[_0x88bc('0x21')];return db[_0x88bc('0x45')]['find']({'where':{'name':_0x7cad44,'userProfileId':_0x25deb3['userProfileId']},'raw':!![]})[_0x88bc('0x14')](function(_0x5c2ba9){if(_0x5c2ba9&&_0x5c2ba9[_0x88bc('0x46')]===0x0){return db['UserProfileResource'][_0x88bc('0x3e')]({'name':_0x37ce2f[_0x88bc('0x21')],'resourceId':_0x37ce2f['id'],'type':_0x5c2ba9[_0x88bc('0x21')],'sectionId':_0x5c2ba9['id']},{})[_0x88bc('0x14')](function(){return _0x44e27f;});}else{return _0x44e27f;}})[_0x88bc('0x3a')](function(_0x567909){logger[_0x88bc('0x1f')](_0x88bc('0x47'),_0x567909);throw _0x567909;});}return _0x44e27f;})['then'](respondWithResult(_0x1c9f96,0xc9))[_0x88bc('0x3a')](handleError(_0x1c9f96,null));};exports[_0x88bc('0x48')]=function(_0xda00fb,_0x373167){if(_0xda00fb['body']['id']){delete _0xda00fb[_0x88bc('0x3f')]['id'];}return db['VoiceExtension'][_0x88bc('0x3d')]({'where':{'id':_0xda00fb[_0x88bc('0x3c')]['id']}})[_0x88bc('0x14')](handleEntityNotFound(_0x373167,null))[_0x88bc('0x14')](function(_0x1b9168){if(_0x1b9168){return db[_0x88bc('0x23')]['update'](_[_0x88bc('0x32')](_0xda00fb[_0x88bc('0x3f')],[_0x88bc('0x41'),_0x88bc('0x49'),'description',_0x88bc('0x4a'),_0x88bc('0x4b'),'mandatoryDisposition',_0x88bc('0x4c')]),{'where':{'context':_0x1b9168['context'],'exten':_0x1b9168[_0x88bc('0x41')]},'individualHooks':!![]})[_0x88bc('0x14')](function(_0x3d0bf4){return _0x3d0bf4;});}return null;})[_0x88bc('0x14')](respondWithStatusCode(_0x373167,null))[_0x88bc('0x3a')](handleError(_0x373167,null));};exports[_0x88bc('0x4d')]=function(_0x281c91,_0x3f3c72){return db[_0x88bc('0x23')]['findOne']({'where':{'id':_0x281c91[_0x88bc('0x3c')]['id']}})['then'](function(_0x1f50de){if(_0x1f50de){return db[_0x88bc('0x4e')][_0x88bc('0x4f')](function(_0x4c6f2e){return db[_0x88bc('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x281c91[_0x88bc('0x3c')]['id']},'transaction':_0x4c6f2e})[_0x88bc('0x14')](function(){var _0x4bfaee=_[_0x88bc('0x1b')](_0x281c91[_0x88bc('0x3f')],function(_0x20fe4e){_0x20fe4e[_0x88bc('0x50')]=_0x281c91['params']['id'];_0x20fe4e[_0x88bc('0x51')]=!![];return _0x20fe4e;});return _0x1f50de[_0x88bc('0x52')](_0x4bfaee);})[_0x88bc('0x14')](function(_0x323981){console[_0x88bc('0x53')](_0x88bc('0x54'),_0x323981);return db[_0x88bc('0x23')][_0x88bc('0x55')](_0x323981,{'transaction':_0x4c6f2e});});})[_0x88bc('0x14')](function(){return db['VoiceExtension'][_0x88bc('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x281c91[_0x88bc('0x3c')]['id']},'order':_0x88bc('0x57')});});}})[_0x88bc('0x14')](respondWithResult(_0x3f3c72,null))['catch'](handleError(_0x3f3c72,null));}; \ No newline at end of file +var _0xdb2b=['status','end','offset','undefined','count','set','Content-Range','json','destroy','InboundRoutes','inbound','InternalRoutes','internal','map','value','includes','type','name','then','error','stack','VoiceExtension','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','outbound','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','update','recordingFormat','mandatoryDisposition','alias','findOne','sequelize','VoiceExtensionId','isApp','createRouting','log','bulkCreate','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus'];(function(_0x2aaf47,_0x23d0f6){var _0x449351=function(_0x34a1f9){while(--_0x34a1f9){_0x2aaf47['push'](_0x2aaf47['shift']());}};_0x449351(++_0x23d0f6);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x49f856,_0x26dc54){_0x49f856=_0x49f856-0x0;var _0x1bacb6=_0xdb2b[_0x49f856];return _0x1bacb6;};'use strict';var _=require(_0xbdb2('0x0'));var Redis=require('ioredis');var qs=require(_0xbdb2('0x1'));var logger=require(_0xbdb2('0x2'))(_0xbdb2('0x3'));var config=require(_0xbdb2('0x4'));var db=require(_0xbdb2('0x5'))['db'];config[_0xbdb2('0x6')]=_[_0xbdb2('0x7')](config[_0xbdb2('0x6')],{'host':_0xbdb2('0x8'),'port':0x18eb});var socket=require(_0xbdb2('0x9'))(new Redis(config[_0xbdb2('0x6')]));require(_0xbdb2('0xa'))['register'](socket);function respondWithStatusCode(_0x51fc95,_0x762443){_0x762443=_0x762443||0xcc;return function(_0x40717f){if(_0x40717f){return _0x51fc95[_0xbdb2('0xb')](_0x762443);}return _0x51fc95[_0xbdb2('0xc')](_0x762443)[_0xbdb2('0xd')]();};}function respondWithResult(_0x19839f,_0x4cbf3b){_0x4cbf3b=_0x4cbf3b||0xc8;return function(_0xeae40){if(_0xeae40){return _0x19839f[_0xbdb2('0xc')](_0x4cbf3b)['json'](_0xeae40);}};}function respondWithFilteredResult(_0x209b90,_0x1f1c2e){return function(_0x5b9af3){if(_0x5b9af3){var _0x3fcedd=typeof _0x1f1c2e[_0xbdb2('0xe')]===_0xbdb2('0xf')&&typeof _0x1f1c2e['limit']===_0xbdb2('0xf');var _0xb5cd89=_0x5b9af3[_0xbdb2('0x10')];var _0x37bcbf=_0x3fcedd?0x0:_0x1f1c2e['offset'];var _0x3acd95=_0x3fcedd?_0x5b9af3[_0xbdb2('0x10')]:_0x1f1c2e['offset']+_0x1f1c2e['limit'];var _0x18f32f;if(_0x3acd95>=_0xb5cd89){_0x3acd95=_0xb5cd89;_0x18f32f=0xc8;}else{_0x18f32f=0xce;}_0x209b90[_0xbdb2('0xc')](_0x18f32f);return _0x209b90[_0xbdb2('0x11')](_0xbdb2('0x12'),_0x37bcbf+'-'+_0x3acd95+'/'+_0xb5cd89)[_0xbdb2('0x13')](_0x5b9af3);}return null;};}function removeEntity(_0xc38bda){return function(_0x197822){if(_0x197822){return _0x197822[_0xbdb2('0x14')]()['then'](function(){var _0x3ef558=_0x197822['get']({'plain':!![]});var _0x2a8ec8=[{'name':_0xbdb2('0x15'),'value':_0xbdb2('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0xbdb2('0x17'),'value':_0xbdb2('0x18'),'ignore':![]}];var _0x5619e8=_(_0x2a8ec8)['filter']('ignore')[_0xbdb2('0x19')](_0xbdb2('0x1a'))[_0xbdb2('0x1a')]();if(_[_0xbdb2('0x1b')](_0x5619e8,_0x3ef558[_0xbdb2('0x1c')])){return;}var _0xd8f80c=_['find'](_0x2a8ec8,[_0xbdb2('0x1a'),_0x3ef558['type']])[_0xbdb2('0x1d')];return db['UserProfileResource'][_0xbdb2('0x14')]({'where':{'type':_0xd8f80c,'resourceId':_0x3ef558['id']}})[_0xbdb2('0x1e')](function(){return _0x197822;});})['then'](function(){_0xc38bda[_0xbdb2('0xc')](0xcc)[_0xbdb2('0xd')]();});}};}function handleEntityNotFound(_0x48a477){return function(_0x4481d5){if(!_0x4481d5){_0x48a477[_0xbdb2('0xb')](0x194);}return _0x4481d5;};}function handleError(_0xdbfbbb,_0x48dc74){_0x48dc74=_0x48dc74||0x1f4;return function(_0x560feb){logger[_0xbdb2('0x1f')](_0x560feb[_0xbdb2('0x20')]);if(_0x560feb['name']){delete _0x560feb[_0xbdb2('0x1d')];}_0xdbfbbb[_0xbdb2('0xc')](_0x48dc74)['send'](_0x560feb);};}exports['index']=function(_0x4bb221,_0x50d69b){var _0x596704={},_0x45d1a1={},_0x442b94={'count':0x0,'rows':[]};var _0x121312=_['map'](db[_0xbdb2('0x21')][_0xbdb2('0x22')],function(_0x1ad65a){return{'name':_0x1ad65a[_0xbdb2('0x23')],'type':_0x1ad65a['type']['key']};});_0x45d1a1['model']=_['map'](_0x121312,_0xbdb2('0x1d'));_0x45d1a1[_0xbdb2('0x24')]=_[_0xbdb2('0x25')](_0x4bb221[_0xbdb2('0x24')]);_0x45d1a1[_0xbdb2('0x26')]=_[_0xbdb2('0x27')](_0x45d1a1['model'],_0x45d1a1['query']);_0x596704[_0xbdb2('0x28')]=_[_0xbdb2('0x27')](_0x45d1a1[_0xbdb2('0x29')],qs[_0xbdb2('0x2a')](_0x4bb221['query'][_0xbdb2('0x2a')]));_0x596704[_0xbdb2('0x28')]=_0x596704[_0xbdb2('0x28')][_0xbdb2('0x2b')]?_0x596704['attributes']:_0x45d1a1[_0xbdb2('0x29')];if(!_0x4bb221[_0xbdb2('0x24')][_0xbdb2('0x2c')](_0xbdb2('0x2d'))){_0x596704[_0xbdb2('0x2e')]=qs[_0xbdb2('0x2e')](_0x4bb221[_0xbdb2('0x24')]['limit']);_0x596704[_0xbdb2('0xe')]=qs['offset'](_0x4bb221[_0xbdb2('0x24')][_0xbdb2('0xe')]);}_0x596704[_0xbdb2('0x2f')]=qs[_0xbdb2('0x30')](_0x4bb221[_0xbdb2('0x24')][_0xbdb2('0x30')]);_0x596704['where']=qs[_0xbdb2('0x26')](_[_0xbdb2('0x31')](_0x4bb221[_0xbdb2('0x24')],_0x45d1a1['filters']),_0x121312);if(_0x4bb221['query'][_0xbdb2('0x32')]){_0x596704[_0xbdb2('0x33')]=_['merge'](_0x596704[_0xbdb2('0x33')],{'$or':_[_0xbdb2('0x19')](_0x121312,function(_0xf3b945){if(_0xf3b945[_0xbdb2('0x1c')]!=='VIRTUAL'){var _0x53f7e5={};_0x53f7e5[_0xf3b945[_0xbdb2('0x1d')]]={'$like':'%'+_0x4bb221[_0xbdb2('0x24')]['filter']+'%'};return _0x53f7e5;}})});}_0x596704=_[_0xbdb2('0x34')]({},_0x596704,_0x4bb221[_0xbdb2('0x35')]);var _0x33e735={'where':_0x596704[_0xbdb2('0x33')]};return db['VoiceExtension'][_0xbdb2('0x10')](_0x33e735)[_0xbdb2('0x1e')](function(_0x3b4b09){_0x442b94['count']=_0x3b4b09;if(_0x4bb221[_0xbdb2('0x24')]['includeAll']){_0x596704[_0xbdb2('0x36')]=[{'all':!![]}];}return db[_0xbdb2('0x21')][_0xbdb2('0x37')](_0x596704);})['then'](function(_0x169a21){_0x442b94[_0xbdb2('0x38')]=_0x169a21;return _0x442b94;})[_0xbdb2('0x1e')](respondWithFilteredResult(_0x50d69b,_0x596704))[_0xbdb2('0x39')](handleError(_0x50d69b,null));};exports[_0xbdb2('0x3a')]=function(_0x36fba6,_0x272447){var _0x4e7b17={'raw':![],'where':{'id':_0x36fba6[_0xbdb2('0x3b')]['id']}},_0x37ec13={};_0x37ec13['model']=_['keys'](db[_0xbdb2('0x21')][_0xbdb2('0x22')]);_0x37ec13[_0xbdb2('0x24')]=_[_0xbdb2('0x25')](_0x36fba6[_0xbdb2('0x24')]);_0x37ec13[_0xbdb2('0x26')]=_[_0xbdb2('0x27')](_0x37ec13['model'],_0x37ec13['query']);_0x4e7b17['attributes']=_[_0xbdb2('0x27')](_0x37ec13[_0xbdb2('0x29')],qs['fields'](_0x36fba6[_0xbdb2('0x24')][_0xbdb2('0x2a')]));_0x4e7b17[_0xbdb2('0x28')]=_0x4e7b17[_0xbdb2('0x28')][_0xbdb2('0x2b')]?_0x4e7b17['attributes']:_0x37ec13['model'];if(_0x36fba6[_0xbdb2('0x24')][_0xbdb2('0x3c')]){_0x4e7b17['include']=[{'all':!![]}];}_0x4e7b17=_['merge']({},_0x4e7b17,_0x36fba6[_0xbdb2('0x35')]);return db[_0xbdb2('0x21')][_0xbdb2('0x3d')](_0x4e7b17)[_0xbdb2('0x1e')](handleEntityNotFound(_0x272447,null))[_0xbdb2('0x1e')](respondWithResult(_0x272447,null))[_0xbdb2('0x39')](handleError(_0x272447,null));};exports['destroy']=function(_0x13cd6b,_0x114085){return db['VoiceExtension'][_0xbdb2('0x3d')]({'where':{'id':_0x13cd6b[_0xbdb2('0x3b')]['id']}})[_0xbdb2('0x1e')](handleEntityNotFound(_0x114085,null))['then'](removeEntity(_0x114085,null))['catch'](handleError(_0x114085,null));};exports[_0xbdb2('0x3e')]=function(_0x105582,_0x447f73){if(_0x105582[_0xbdb2('0x3f')][_0xbdb2('0x1c')]===_0xbdb2('0x40')&&!_[_0xbdb2('0x41')](_0x105582['body'][_0xbdb2('0x42')],'_')){_0x105582[_0xbdb2('0x3f')][_0xbdb2('0x42')]='_'[_0xbdb2('0x43')](_0x105582['body']['exten']);}return db[_0xbdb2('0x21')][_0xbdb2('0x3e')](_0x105582[_0xbdb2('0x3f')],{'raw':![]})['then'](function(_0x227a6b){var _0x17b8b2=_0x105582[_0xbdb2('0x44')][_0xbdb2('0x45')]({'plain':!![]});if(!_0x17b8b2)throw new Error(_0xbdb2('0x46'));if(_0x17b8b2[_0xbdb2('0x47')]===_0xbdb2('0x44')){var _0x108c02=_0x227a6b[_0xbdb2('0x45')]({'plain':!![]});var _0x12130b=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xbdb2('0x48'),'value':_0xbdb2('0x40')},{'name':_0xbdb2('0x17'),'value':_0xbdb2('0x18')}];var _0x277dfe=_[_0xbdb2('0x3d')](_0x12130b,[_0xbdb2('0x1a'),_0x108c02['type']])[_0xbdb2('0x1d')];return db[_0xbdb2('0x49')][_0xbdb2('0x3d')]({'where':{'name':_0x277dfe,'userProfileId':_0x17b8b2[_0xbdb2('0x4a')]},'raw':!![]})[_0xbdb2('0x1e')](function(_0x285131){if(_0x285131&&_0x285131[_0xbdb2('0x4b')]===0x0){return db['UserProfileResource'][_0xbdb2('0x3e')]({'name':_0x108c02[_0xbdb2('0x1d')],'resourceId':_0x108c02['id'],'type':_0x285131[_0xbdb2('0x1d')],'sectionId':_0x285131['id']},{})[_0xbdb2('0x1e')](function(){return _0x227a6b;});}else{return _0x227a6b;}})['catch'](function(_0x46fd2b){logger[_0xbdb2('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46fd2b);throw _0x46fd2b;});}return _0x227a6b;})[_0xbdb2('0x1e')](respondWithResult(_0x447f73,0xc9))['catch'](handleError(_0x447f73,null));};exports[_0xbdb2('0x4c')]=function(_0x650f76,_0x1329ff){if(_0x650f76[_0xbdb2('0x3f')]['id']){delete _0x650f76['body']['id'];}return db[_0xbdb2('0x21')][_0xbdb2('0x3d')]({'where':{'id':_0x650f76[_0xbdb2('0x3b')]['id']}})[_0xbdb2('0x1e')](handleEntityNotFound(_0x1329ff,null))[_0xbdb2('0x1e')](function(_0x4b8ab6){if(_0x4b8ab6){return db['VoiceExtension']['update'](_[_0xbdb2('0x31')](_0x650f76[_0xbdb2('0x3f')],[_0xbdb2('0x42'),'context','description',_0xbdb2('0x4d'),'cutdigits',_0xbdb2('0x4e'),_0xbdb2('0x4f')]),{'where':{'context':_0x4b8ab6['context'],'exten':_0x4b8ab6[_0xbdb2('0x42')]},'individualHooks':!![]})[_0xbdb2('0x1e')](function(_0xfcd0a7){return _0xfcd0a7;});}return null;})['then'](respondWithStatusCode(_0x1329ff,null))[_0xbdb2('0x39')](handleError(_0x1329ff,null));};exports['addApplications']=function(_0x344da5,_0x2f5a36){return db[_0xbdb2('0x21')][_0xbdb2('0x50')]({'where':{'id':_0x344da5['params']['id']}})[_0xbdb2('0x1e')](function(_0xd017fb){if(_0xd017fb){return db[_0xbdb2('0x51')]['transaction'](function(_0x3a677a){return db[_0xbdb2('0x21')][_0xbdb2('0x14')]({'where':{'VoiceExtensionId':_0x344da5[_0xbdb2('0x3b')]['id']},'transaction':_0x3a677a})[_0xbdb2('0x1e')](function(){var _0x3b8126=_['map'](_0x344da5['body'],function(_0x18c488){_0x18c488[_0xbdb2('0x52')]=_0x344da5[_0xbdb2('0x3b')]['id'];_0x18c488[_0xbdb2('0x53')]=!![];return _0x18c488;});return _0xd017fb[_0xbdb2('0x54')](_0x3b8126);})[_0xbdb2('0x1e')](function(_0x26db6c){console[_0xbdb2('0x55')]('LOG\x20~\x20.then\x20~\x20routing',_0x26db6c);return db[_0xbdb2('0x21')][_0xbdb2('0x56')](_0x26db6c,{'transaction':_0x3a677a});});})[_0xbdb2('0x1e')](function(){return db[_0xbdb2('0x21')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x344da5['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x2f5a36,null))['catch'](handleError(_0x2f5a36,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e341002..ec191d9 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 _0x6745=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x489e56,_0x2f2e37){var _0x1a1a12=function(_0x66b8d6){while(--_0x66b8d6){_0x489e56['push'](_0x489e56['shift']());}};_0x1a1a12(++_0x2f2e37);}(_0x6745,0x189));var _0x5674=function(_0x299454,_0x592058){_0x299454=_0x299454-0x0;var _0x4db61e=_0x6745[_0x299454];return _0x4db61e;};'use strict';var EventEmitter=require(_0x5674('0x0'));var VoiceExtension=require(_0x5674('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5674('0x2')](0x0);var events={'afterCreate':_0x5674('0x3'),'afterUpdate':_0x5674('0x4'),'afterDestroy':_0x5674('0x5')};function emitEvent(_0x14bd78){return function(_0x4d2190,_0x10bd44,_0x282826){VoiceExtensionEvents[_0x5674('0x6')](_0x14bd78+':'+_0x4d2190['id'],_0x4d2190);VoiceExtensionEvents[_0x5674('0x6')](_0x14bd78,_0x4d2190);_0x282826(null);};}for(var e in events){if(events[_0x5674('0x7')](e)){var event=events[e];VoiceExtension[_0x5674('0x8')](e,emitEvent(event));}}module[_0x5674('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x7720=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3363ae,_0x5c3f3f){var _0x2bc795=function(_0xd9803c){while(--_0xd9803c){_0x3363ae['push'](_0x3363ae['shift']());}};_0x2bc795(++_0x5c3f3f);}(_0x7720,0x171));var _0x0772=function(_0x46255e,_0x36d16e){_0x46255e=_0x46255e-0x0;var _0x42ec9f=_0x7720[_0x46255e];return _0x42ec9f;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x0772('0x0'))['db'][_0x0772('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0772('0x2')](0x0);var events={'afterCreate':_0x0772('0x3'),'afterUpdate':_0x0772('0x4'),'afterDestroy':_0x0772('0x5')};function emitEvent(_0x11cc72){return function(_0x4fbedd,_0x3cf3a0,_0xe8688d){VoiceExtensionEvents[_0x0772('0x6')](_0x11cc72+':'+_0x4fbedd['id'],_0x4fbedd);VoiceExtensionEvents['emit'](_0x11cc72,_0x4fbedd);_0xe8688d(null);};}for(var e in events){if(events[_0x0772('0x7')](e)){var event=events[e];VoiceExtension[_0x0772('0x8')](e,emitEvent(event));}}module[_0x0772('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 e44a258..078e414 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 _0xb079=['U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','priority','concat','last','catch','define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','context','NoOp','alias','CDR(routeAlias)=','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','trunk','timeout','url','split','length','name','phone','param','prefix','${EXTEN:','join','options','indexOf'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb079,0x1c9));var _0x9b07=function(_0x47500c,_0x49602c){_0x47500c=_0x47500c-0x0;var _0x1d5b4d=_0xb079[_0x47500c];return _0x1d5b4d;};'use strict';var _=require('lodash');var attributes=require(_0x9b07('0x0'));module[_0x9b07('0x1')]=function(_0x447b2d){var _0x158a14=_0x447b2d[_0x9b07('0x2')];function _0x3c199c(_0x5dc42a){var _0x14a884=0x2;var _0x3bf703=[{'type':_0x5dc42a[_0x9b07('0x3')],'app':_0x9b07('0x4'),'appdata':'CDR(type)='+_0x5dc42a[_0x9b07('0x3')],'context':_0x5dc42a[_0x9b07('0x5')],'exten':_0x5dc42a['exten'],'priority':_0x14a884++,'VoiceExtensionId':_0x5dc42a['id']},{'type':_0x5dc42a[_0x9b07('0x3')],'app':_0x5dc42a['alias']?'Set':_0x9b07('0x6'),'appdata':_0x5dc42a[_0x9b07('0x7')]?_0x9b07('0x8')+_0x5dc42a[_0x9b07('0x7')]:'No\x20alias\x20set','context':_0x5dc42a[_0x9b07('0x5')],'exten':_0x5dc42a[_0x9b07('0x9')],'priority':_0x14a884++,'VoiceExtensionId':_0x5dc42a['id']}];if(_0x5dc42a[_0x9b07('0x3')]===_0x9b07('0xa')){_0x3bf703[_0x9b07('0xb')]({'type':_0x9b07('0xa'),'app':_0x9b07('0x4'),'appdata':_0x9b07('0xc')+_0x5dc42a['id'],'context':_0x5dc42a[_0x9b07('0x5')],'exten':_0x5dc42a[_0x9b07('0x9')],'priority':_0x14a884++,'VoiceExtensionId':_0x5dc42a['id']});}_0x3bf703[_0x9b07('0xb')]({'type':_0x5dc42a[_0x9b07('0x3')],'app':_0x9b07('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5dc42a['context'],'exten':_0x5dc42a[_0x9b07('0x9')],'priority':_0x14a884++,'VoiceExtensionId':_0x5dc42a['id']},{'type':_0x5dc42a[_0x9b07('0x3')],'app':_0x9b07('0x4'),'appdata':_0x9b07('0xd'),'context':_0x5dc42a[_0x9b07('0x5')],'exten':_0x5dc42a['exten'],'priority':_0x14a884++,'VoiceExtensionId':_0x5dc42a['id']},{'type':_0x5dc42a[_0x9b07('0x3')],'app':_0x9b07('0x4'),'appdata':_0x9b07('0xe'),'context':_0x5dc42a['context'],'exten':_0x5dc42a[_0x9b07('0x9')],'priority':_0x14a884++,'VoiceExtensionId':_0x5dc42a['id']});return _0x3bf703;}function _0x1cddd5(_0x3fe8ae){var _0x130668=0x2;var _0x38f77c=[{'type':_0x9b07('0xf'),'app':_0x9b07('0x4'),'appdata':_0x9b07('0x10'),'context':_0x3fe8ae['context'],'exten':_0x3fe8ae['exten'],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':_0x3fe8ae['alias']?_0x9b07('0x4'):'NoOp','appdata':_0x3fe8ae[_0x9b07('0x7')]?_0x9b07('0x8')+_0x3fe8ae[_0x9b07('0x7')]:'No\x20alias\x20set','context':_0x3fe8ae[_0x9b07('0x5')],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':_0x9b07('0x4'),'appdata':'CDR(destination)='+(_0x3fe8ae[_0x9b07('0x11')]?'${EXTEN:'+_0x3fe8ae[_0x9b07('0x11')]+'}':_0x9b07('0x12')),'context':_0x3fe8ae[_0x9b07('0x5')],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':'Set','appdata':_0x9b07('0xc')+_0x3fe8ae['id'],'context':_0x3fe8ae['context'],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':'ExecIf','appdata':_0x9b07('0x13')+(_0x130668+0x2)+'):Goto('+(_0x130668+0x1)+')','context':_0x3fe8ae[_0x9b07('0x5')],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':_0x9b07('0x4'),'appdata':_0x3fe8ae[_0x9b07('0x11')]?_0x9b07('0x14')+_0x3fe8ae[_0x9b07('0x11')]+'}':_0x9b07('0x15'),'context':_0x3fe8ae[_0x9b07('0x5')],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':_0x9b07('0x4'),'appdata':_0x9b07('0x16'),'context':_0x3fe8ae[_0x9b07('0x5')],'exten':_0x3fe8ae['exten'],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':_0x9b07('0x4'),'appdata':_0x9b07('0xd'),'context':_0x3fe8ae[_0x9b07('0x5')],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':_0x9b07('0x4'),'appdata':_0x9b07('0xe'),'context':_0x3fe8ae[_0x9b07('0x5')],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':_0x9b07('0x4'),'appdata':_0x9b07('0x17')+_0x3fe8ae['id'],'context':_0x3fe8ae['context'],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']}];if(_0x3fe8ae[_0x9b07('0x18')](_0x9b07('0x19'))&&_0x3fe8ae[_0x9b07('0x19')]!==_0x9b07('0x1a')){_0x38f77c[_0x9b07('0xb')]({'type':_0x9b07('0xf'),'app':_0x9b07('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3fe8ae[_0x9b07('0x5')],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']},{'type':_0x9b07('0xf'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3fe8ae[_0x9b07('0x19')]||_0x9b07('0x1b'),'context':_0x3fe8ae['context'],'exten':_0x3fe8ae[_0x9b07('0x9')],'priority':_0x130668++,'VoiceExtensionId':_0x3fe8ae['id']});}return _0x38f77c;}function _0x575858(_0x383c00,_0x14104a){var _0x4091aa=[{'name':_0x9b07('0x1c'),'param':0x0},{'name':_0x9b07('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':_0x9b07('0x1e'),'param':0x3}];var _0x5c78ba={};var _0x67dfdf=_0x14104a[_0x9b07('0x1f')](',');var _0x51a0ce=[];for(var _0xeb08f8=0x0;_0xeb08f8<_0x4091aa[_0x9b07('0x20')];_0xeb08f8++){switch(_0x4091aa[_0xeb08f8][_0x9b07('0x21')]){case _0x9b07('0x1c'):_0x5c78ba[_0x9b07('0x1c')]=_0x67dfdf[_0x4091aa[_0xeb08f8]['param']][_0x9b07('0x1f')]('/')[0x1];_0x5c78ba[_0x9b07('0x22')]=_0x67dfdf[_0x4091aa[_0xeb08f8][_0x9b07('0x23')]][_0x9b07('0x1f')]('/')[0x2];_0x5c78ba['prefix']=_0x5c78ba[_0x9b07('0x22')]?_0x5c78ba[_0x9b07('0x22')][_0x9b07('0x1f')]('$')[0x0]:undefined;_0x5c78ba[_0x9b07('0x22')]=_0x383c00['cutdigits']?(_0x5c78ba[_0x9b07('0x24')]||'')+_0x9b07('0x25')+_0x383c00[_0x9b07('0x11')]+'}':(_0x5c78ba[_0x9b07('0x24')]||'')+_0x9b07('0x12');_0x51a0ce[_0x4091aa[_0xeb08f8][_0x9b07('0x23')]]=['SIP',_0x5c78ba[_0x9b07('0x1c')],_0x5c78ba[_0x9b07('0x22')]][_0x9b07('0x26')]('/');break;case _0x9b07('0x27'):_0x5c78ba[_0x9b07('0x27')]=_0x67dfdf[_0x4091aa[_0xeb08f8][_0x9b07('0x23')]];if(_0x383c00[_0x9b07('0x19')]!==_0x9b07('0x1a')){if(_0x5c78ba[_0x9b07('0x27')][_0x9b07('0x28')](_0x9b07('0x29'))<0x0){_0x5c78ba['options']+=_0x9b07('0x29');}}else{_0x5c78ba[_0x9b07('0x27')]=_0x5c78ba[_0x9b07('0x27')][_0x9b07('0x2a')](_0x9b07('0x29'),'');}_0x51a0ce[_0x4091aa[_0xeb08f8][_0x9b07('0x23')]]=_0x5c78ba[_0x9b07('0x27')];break;default:_0x51a0ce[_0x4091aa[_0xeb08f8][_0x9b07('0x23')]]=_0x67dfdf[_0x4091aa[_0xeb08f8][_0x9b07('0x23')]];}}return _0x51a0ce[_0x9b07('0x26')](',');}function _0x11e113(_0x2f88ab,_0x352a3d,_0x37524a){return new Promise(function(_0xb9be08,_0x21831e){var _0x43302e=[];if(_[_0x9b07('0x2b')](_0x352a3d))return _0xb9be08(_0x43302e);_0x158a14['Interval'][_0x9b07('0x2c')]({'attributes':['id',_0x9b07('0x2d'),_0x9b07('0x2e')],'raw':!![]})[_0x9b07('0x2f')](function(_0x131c7b){for(var _0x55ed63=0x0,_0x2268f1=0x0;_0x55ed63<_0x352a3d[_0x9b07('0x20')];_0x55ed63++,_0x2268f1=0x0){var _0x1501d5=_0x352a3d[_0x55ed63];var _0x59d089=[];var _0x5ecf45=[];delete _0x1501d5['id'];if(_0x1501d5[_0x9b07('0x2d')]!==_0x9b07('0x30')){_0x1501d5[_0x9b07('0x31')]=[_0x1501d5[_0x9b07('0x2d')]];}else{_0x1501d5[_0x9b07('0x31')]=_0x1501d5[_0x9b07('0x2e')]?_[_0x9b07('0x32')](_[_0x9b07('0x33')](_0x131c7b,{'IntervalId':_0x1501d5[_0x9b07('0x2e')]}),_0x9b07('0x2d')):[];}_0x1501d5[_0x9b07('0x5')]=_0x2f88ab[_0x9b07('0x5')];_0x1501d5['exten']=_0x2f88ab[_0x9b07('0x9')];if(_0x1501d5[_0x9b07('0x3')])_0x1501d5[_0x9b07('0x3')]=_0x1501d5['type'][_0x9b07('0x34')]();if(_0x2f88ab['type']==='outbound'){if(_0x1501d5[_0x9b07('0x18')](_0x9b07('0x35'))&&_0x1501d5['tag']&&_0x1501d5[_0x9b07('0x35')]!=='--'){_0x59d089['push']({'type':_0x1501d5[_0x9b07('0x3')][_0x9b07('0x34')](),'app':'Set','appdata':_0x9b07('0x36')+_0x1501d5[_0x9b07('0x35')],'context':_0x2f88ab[_0x9b07('0x5')],'exten':_0x2f88ab[_0x9b07('0x9')],'priority':_0x1501d5[_0x9b07('0x31')][_0x9b07('0x20')]+_0x37524a+_0x2268f1++,'VoiceExtensionId':_0x2f88ab['id']});}_0x59d089[_0x9b07('0xb')]({'type':_0x1501d5[_0x9b07('0x3')][_0x9b07('0x34')](),'app':_0x9b07('0x37'),'appdata':_0x9b07('0x38')+(_0x1501d5[_0x9b07('0x39')]?_0x9b07('0x3a')+_0x1501d5[_0x9b07('0x39')]+')':_0x9b07('0x3b')),'context':_0x2f88ab[_0x9b07('0x5')],'exten':_0x2f88ab[_0x9b07('0x9')],'priority':_0x1501d5[_0x9b07('0x31')][_0x9b07('0x20')]+_0x37524a+_0x2268f1++,'VoiceExtensionId':_0x2f88ab['id']});}else{if(_0x1501d5[_0x9b07('0x18')](_0x9b07('0x3c'))){if([_0x9b07('0x3d'),_0x9b07('0x3e')][_0x9b07('0x3f')](_0x1501d5[_0x9b07('0x40')]['toLowerCase']())&&_0x1501d5[_0x9b07('0x41')]!==_0x9b07('0x42')){if(_0x1501d5[_0x9b07('0x3c')]){_0x59d089[_0x9b07('0xb')]({'type':_0x1501d5[_0x9b07('0x3')][_0x9b07('0x34')](),'app':_0x9b07('0x37'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2f88ab[_0x9b07('0x5')],'exten':_0x2f88ab[_0x9b07('0x9')],'priority':_0x1501d5[_0x9b07('0x31')][_0x9b07('0x20')]+_0x37524a+_0x2268f1++,'VoiceExtensionId':_0x2f88ab['id']});_0x59d089[_0x9b07('0xb')]({'type':_0x1501d5[_0x9b07('0x3')][_0x9b07('0x34')](),'app':_0x9b07('0x4'),'appdata':_0x9b07('0x43'),'context':_0x2f88ab[_0x9b07('0x5')],'exten':_0x2f88ab['exten'],'priority':_0x1501d5[_0x9b07('0x31')][_0x9b07('0x20')]+_0x37524a+_0x2268f1++,'VoiceExtensionId':_0x2f88ab['id']});}else{_0x59d089[_0x9b07('0xb')]({'type':_0x1501d5[_0x9b07('0x3')][_0x9b07('0x34')](),'app':_0x9b07('0x37'),'appdata':_0x9b07('0x44'),'context':_0x2f88ab[_0x9b07('0x5')],'exten':_0x2f88ab[_0x9b07('0x9')],'priority':_0x1501d5['intervals'][_0x9b07('0x20')]+_0x37524a+_0x2268f1++,'VoiceExtensionId':_0x2f88ab['id']});_0x59d089[_0x9b07('0xb')]({'type':_0x1501d5['type'][_0x9b07('0x34')](),'app':_0x9b07('0x4'),'appdata':_0x9b07('0x45'),'context':_0x2f88ab[_0x9b07('0x5')],'exten':_0x2f88ab[_0x9b07('0x9')],'priority':_0x1501d5[_0x9b07('0x31')][_0x9b07('0x20')]+_0x37524a+_0x2268f1++,'VoiceExtensionId':_0x2f88ab['id']});}}}}for(var _0x40d411=0x0;_0x40d411<_0x1501d5[_0x9b07('0x31')][_0x9b07('0x20')];_0x40d411++){var _0x501ca4=_0x37524a+_0x1501d5['intervals'][_0x9b07('0x20')];var _0x1ed6fc=_0x40d411===_0x1501d5[_0x9b07('0x31')]['length']-0x1?_0x37524a+_0x59d089['length']+_0x5ecf45[_0x9b07('0x20')]+0x2:_0x37524a+_0x40d411+0x1;_0x59d089[_0x9b07('0x46')](_0x40d411,0x0,{'type':_0x2f88ab['type'],'app':_0x9b07('0x47'),'appdata':_0x1501d5[_0x9b07('0x31')][_0x40d411]+'?'+_0x2f88ab[_0x9b07('0x5')]+',${EXTEN},'+_0x501ca4+':'+_0x2f88ab[_0x9b07('0x5')]+_0x9b07('0x48')+_0x1ed6fc,'exten':_0x2f88ab[_0x9b07('0x9')],'context':_0x2f88ab[_0x9b07('0x5')],'priority':_0x37524a+_0x40d411,'VoiceExtensionId':_0x2f88ab['id']});}if(_0x1501d5['appType']===_0x9b07('0x49'))_0x1501d5['appdata']=_0x575858(_0x2f88ab,_0x1501d5['appdata']);_0x1501d5[_0x9b07('0x4a')]=_0x59d089[_0x9b07('0x20')]?_['last'](_0x59d089)[_0x9b07('0x4a')]+0x1:_0x37524a;_0x43302e=_[_0x9b07('0x4b')](_0x43302e,_0x59d089,[_0x1501d5],_0x5ecf45);_0x37524a=_[_0x9b07('0x4c')](_0x43302e)[_0x9b07('0x4a')]+0x1;}return _0xb9be08(_0x43302e);})[_0x9b07('0x4d')](function(_0x7be411){_0x21831e(_0x7be411);});});}return _0x447b2d[_0x9b07('0x4e')](_0x9b07('0x4f'),attributes,{'tableName':_0x9b07('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4a3afa){var _0x1f9b10=this[_0x9b07('0x51')]({'plain':!![]});var _0x213786=_0x1f9b10[_0x9b07('0x3')]===_0x9b07('0xf')?_0x1cddd5(_0x1f9b10):_0x3c199c(_0x1f9b10);return _0x11e113(_0x1f9b10,_0x4a3afa,_[_0x9b07('0x4c')](_0x213786)['priority']+0x1)['then'](function(_0x4bea81){var _0x5aec74=_['concat'](_0x213786,_0x4bea81);_0x5aec74[_0x9b07('0xb')]({'type':_0x1f9b10[_0x9b07('0x3')],'app':_0x9b07('0x52'),'exten':_0x1f9b10[_0x9b07('0x9')],'context':_0x1f9b10[_0x9b07('0x5')],'priority':_[_0x9b07('0x4c')](_0x5aec74)['priority']+0x1,'VoiceExtensionId':_0x1f9b10['id']});return _0x5aec74;});}}});}; \ No newline at end of file +var _0x6eed=['appdata','priority','last','concat','catch','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','alias','CDR(routeAlias)=','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','name','prefix','phone','${EXTEN:','param','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','then','length','interval','*,*,*,*','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','playback','includes','app','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x6eed,0xff));var _0xd6ee=function(_0x26be12,_0x338b2c){_0x26be12=_0x26be12-0x0;var _0x110b3c=_0x6eed[_0x26be12];return _0x110b3c;};'use strict';var _=require(_0xd6ee('0x0'));var attributes=require(_0xd6ee('0x1'));module[_0xd6ee('0x2')]=function(_0x27b7bf){var _0x1a734a=_0x27b7bf['models'];function _0x25a92a(_0x315fdb){var _0x588715=0x2;var _0x53cce9=[{'type':_0x315fdb[_0xd6ee('0x3')],'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0x5')+_0x315fdb[_0xd6ee('0x3')],'context':_0x315fdb[_0xd6ee('0x6')],'exten':_0x315fdb['exten'],'priority':_0x588715++,'VoiceExtensionId':_0x315fdb['id']},{'type':_0x315fdb['type'],'app':_0x315fdb[_0xd6ee('0x7')]?'Set':'NoOp','appdata':_0x315fdb['alias']?_0xd6ee('0x8')+_0x315fdb[_0xd6ee('0x7')]:'No\x20alias\x20set','context':_0x315fdb[_0xd6ee('0x6')],'exten':_0x315fdb[_0xd6ee('0x9')],'priority':_0x588715++,'VoiceExtensionId':_0x315fdb['id']}];if(_0x315fdb[_0xd6ee('0x3')]===_0xd6ee('0xa')){_0x53cce9['push']({'type':_0xd6ee('0xa'),'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0xb')+_0x315fdb['id'],'context':_0x315fdb[_0xd6ee('0x6')],'exten':_0x315fdb[_0xd6ee('0x9')],'priority':_0x588715++,'VoiceExtensionId':_0x315fdb['id']});}_0x53cce9[_0xd6ee('0xc')]({'type':_0x315fdb['type'],'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0xd'),'context':_0x315fdb['context'],'exten':_0x315fdb[_0xd6ee('0x9')],'priority':_0x588715++,'VoiceExtensionId':_0x315fdb['id']},{'type':_0x315fdb[_0xd6ee('0x3')],'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0xe'),'context':_0x315fdb[_0xd6ee('0x6')],'exten':_0x315fdb[_0xd6ee('0x9')],'priority':_0x588715++,'VoiceExtensionId':_0x315fdb['id']},{'type':_0x315fdb['type'],'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0xf'),'context':_0x315fdb[_0xd6ee('0x6')],'exten':_0x315fdb['exten'],'priority':_0x588715++,'VoiceExtensionId':_0x315fdb['id']});return _0x53cce9;}function _0x3196c0(_0x5ef16b){var _0x3a82bf=0x2;var _0x2b0495=[{'type':_0xd6ee('0x10'),'app':'Set','appdata':_0xd6ee('0x11'),'context':_0x5ef16b['context'],'exten':_0x5ef16b[_0xd6ee('0x9')],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':'outbound','app':_0x5ef16b[_0xd6ee('0x7')]?_0xd6ee('0x4'):_0xd6ee('0x12'),'appdata':_0x5ef16b[_0xd6ee('0x7')]?_0xd6ee('0x8')+_0x5ef16b['alias']:_0xd6ee('0x13'),'context':_0x5ef16b['context'],'exten':_0x5ef16b[_0xd6ee('0x9')],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':_0xd6ee('0x10'),'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0x14')+(_0x5ef16b[_0xd6ee('0x15')]?'${EXTEN:'+_0x5ef16b['cutdigits']+'}':_0xd6ee('0x16')),'context':_0x5ef16b['context'],'exten':_0x5ef16b[_0xd6ee('0x9')],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':'outbound','app':_0xd6ee('0x4'),'appdata':_0xd6ee('0xb')+_0x5ef16b['id'],'context':_0x5ef16b[_0xd6ee('0x6')],'exten':_0x5ef16b[_0xd6ee('0x9')],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':_0xd6ee('0x10'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3a82bf+0x2)+_0xd6ee('0x17')+(_0x3a82bf+0x1)+')','context':_0x5ef16b[_0xd6ee('0x6')],'exten':_0x5ef16b['exten'],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':_0xd6ee('0x10'),'app':_0xd6ee('0x4'),'appdata':_0x5ef16b[_0xd6ee('0x15')]?_0xd6ee('0x18')+_0x5ef16b[_0xd6ee('0x15')]+'}':_0xd6ee('0x19'),'context':_0x5ef16b[_0xd6ee('0x6')],'exten':_0x5ef16b['exten'],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':_0xd6ee('0x10'),'app':_0xd6ee('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5ef16b['context'],'exten':_0x5ef16b[_0xd6ee('0x9')],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':_0xd6ee('0x10'),'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0xe'),'context':_0x5ef16b[_0xd6ee('0x6')],'exten':_0x5ef16b['exten'],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':_0xd6ee('0x10'),'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0xf'),'context':_0x5ef16b['context'],'exten':_0x5ef16b[_0xd6ee('0x9')],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':_0xd6ee('0x10'),'app':_0xd6ee('0x4'),'appdata':'outboundrouteid='+_0x5ef16b['id'],'context':_0x5ef16b[_0xd6ee('0x6')],'exten':_0x5ef16b[_0xd6ee('0x9')],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']}];if(_0x5ef16b[_0xd6ee('0x1a')](_0xd6ee('0x1b'))&&_0x5ef16b[_0xd6ee('0x1b')]!==_0xd6ee('0x1c')){_0x2b0495['push']({'type':_0xd6ee('0x10'),'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0x1d'),'context':_0x5ef16b[_0xd6ee('0x6')],'exten':_0x5ef16b['exten'],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']},{'type':_0xd6ee('0x10'),'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0x1e')+_0x5ef16b['recordingFormat']||'wav','context':_0x5ef16b[_0xd6ee('0x6')],'exten':_0x5ef16b[_0xd6ee('0x9')],'priority':_0x3a82bf++,'VoiceExtensionId':_0x5ef16b['id']});}return _0x2b0495;}function _0x1479a4(_0x139a15,_0x430b10){var _0x9ba178=[{'name':_0xd6ee('0x1f'),'param':0x0},{'name':_0xd6ee('0x20'),'param':0x1},{'name':_0xd6ee('0x21'),'param':0x2},{'name':_0xd6ee('0x22'),'param':0x3}];var _0x114ad4={};var _0x1ef8e5=_0x430b10[_0xd6ee('0x23')](',');var _0x15b752=[];for(var _0x19be90=0x0;_0x19be90<_0x9ba178['length'];_0x19be90++){switch(_0x9ba178[_0x19be90][_0xd6ee('0x24')]){case _0xd6ee('0x1f'):_0x114ad4[_0xd6ee('0x1f')]=_0x1ef8e5[_0x9ba178[_0x19be90]['param']]['split']('/')[0x1];_0x114ad4['phone']=_0x1ef8e5[_0x9ba178[_0x19be90]['param']][_0xd6ee('0x23')]('/')[0x2];_0x114ad4[_0xd6ee('0x25')]=_0x114ad4[_0xd6ee('0x26')]?_0x114ad4[_0xd6ee('0x26')][_0xd6ee('0x23')]('$')[0x0]:undefined;_0x114ad4[_0xd6ee('0x26')]=_0x139a15[_0xd6ee('0x15')]?(_0x114ad4['prefix']||'')+_0xd6ee('0x27')+_0x139a15[_0xd6ee('0x15')]+'}':(_0x114ad4[_0xd6ee('0x25')]||'')+_0xd6ee('0x16');_0x15b752[_0x9ba178[_0x19be90][_0xd6ee('0x28')]]=[_0xd6ee('0x29'),_0x114ad4[_0xd6ee('0x1f')],_0x114ad4[_0xd6ee('0x26')]][_0xd6ee('0x2a')]('/');break;case _0xd6ee('0x21'):_0x114ad4['options']=_0x1ef8e5[_0x9ba178[_0x19be90]['param']];if(_0x139a15['recordingFormat']!==_0xd6ee('0x1c')){if(_0x114ad4['options'][_0xd6ee('0x2b')](_0xd6ee('0x2c'))<0x0){_0x114ad4[_0xd6ee('0x21')]+=_0xd6ee('0x2c');}}else{_0x114ad4[_0xd6ee('0x21')]=_0x114ad4['options']['replace']('U(xcally-mixmonitor-context)','');}_0x15b752[_0x9ba178[_0x19be90]['param']]=_0x114ad4[_0xd6ee('0x21')];break;default:_0x15b752[_0x9ba178[_0x19be90][_0xd6ee('0x28')]]=_0x1ef8e5[_0x9ba178[_0x19be90][_0xd6ee('0x28')]];}}return _0x15b752[_0xd6ee('0x2a')](',');}function _0x164906(_0x1c48ba,_0x1311c1,_0x23ef7c){return new Promise(function(_0x160d05,_0x4b181c){var _0x331510=[];if(_[_0xd6ee('0x2d')](_0x1311c1))return _0x160d05(_0x331510);_0x1a734a['Interval'][_0xd6ee('0x2e')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xd6ee('0x2f')](function(_0x370c43){for(var _0x409558=0x0,_0x3a6007=0x0;_0x409558<_0x1311c1[_0xd6ee('0x30')];_0x409558++,_0x3a6007=0x0){var _0x878b3=_0x1311c1[_0x409558];var _0x513912=[];var _0x5cf265=[];delete _0x878b3['id'];if(_0x878b3[_0xd6ee('0x31')]!==_0xd6ee('0x32')){_0x878b3['intervals']=[_0x878b3[_0xd6ee('0x31')]];}else{_0x878b3['intervals']=_0x878b3[_0xd6ee('0x33')]?_[_0xd6ee('0x34')](_[_0xd6ee('0x35')](_0x370c43,{'IntervalId':_0x878b3[_0xd6ee('0x33')]}),_0xd6ee('0x31')):[];}_0x878b3[_0xd6ee('0x6')]=_0x1c48ba[_0xd6ee('0x6')];_0x878b3[_0xd6ee('0x9')]=_0x1c48ba[_0xd6ee('0x9')];if(_0x878b3[_0xd6ee('0x3')])_0x878b3[_0xd6ee('0x3')]=_0x878b3['type'][_0xd6ee('0x36')]();if(_0x1c48ba[_0xd6ee('0x3')]===_0xd6ee('0x10')){if(_0x878b3[_0xd6ee('0x1a')](_0xd6ee('0x37'))&&_0x878b3[_0xd6ee('0x37')]&&_0x878b3[_0xd6ee('0x37')]!=='--'){_0x513912[_0xd6ee('0xc')]({'type':_0x878b3[_0xd6ee('0x3')][_0xd6ee('0x36')](),'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0x38')+_0x878b3['tag'],'context':_0x1c48ba[_0xd6ee('0x6')],'exten':_0x1c48ba[_0xd6ee('0x9')],'priority':_0x878b3[_0xd6ee('0x39')]['length']+_0x23ef7c+_0x3a6007++,'VoiceExtensionId':_0x1c48ba['id']});}_0x513912[_0xd6ee('0xc')]({'type':_0x878b3['type'][_0xd6ee('0x36')](),'app':'ExecIf','appdata':_0xd6ee('0x3a')+(_0x878b3[_0xd6ee('0x3b')]?'Set(CALLERID(all)='+_0x878b3[_0xd6ee('0x3b')]+')':_0xd6ee('0x3c')),'context':_0x1c48ba[_0xd6ee('0x6')],'exten':_0x1c48ba['exten'],'priority':_0x878b3[_0xd6ee('0x39')][_0xd6ee('0x30')]+_0x23ef7c+_0x3a6007++,'VoiceExtensionId':_0x1c48ba['id']});}else{if(_0x878b3['hasOwnProperty'](_0xd6ee('0x3d'))){if(['queue',_0xd6ee('0x3e')][_0xd6ee('0x3f')](_0x878b3[_0xd6ee('0x40')][_0xd6ee('0x36')]())&&_0x878b3['appType']!==_0xd6ee('0x41')){if(_0x878b3['answer']){_0x513912[_0xd6ee('0xc')]({'type':_0x878b3[_0xd6ee('0x3')]['toLowerCase'](),'app':_0xd6ee('0x42'),'appdata':_0xd6ee('0x43'),'context':_0x1c48ba[_0xd6ee('0x6')],'exten':_0x1c48ba[_0xd6ee('0x9')],'priority':_0x878b3[_0xd6ee('0x39')][_0xd6ee('0x30')]+_0x23ef7c+_0x3a6007++,'VoiceExtensionId':_0x1c48ba['id']});_0x513912[_0xd6ee('0xc')]({'type':_0x878b3[_0xd6ee('0x3')]['toLowerCase'](),'app':_0xd6ee('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1c48ba[_0xd6ee('0x6')],'exten':_0x1c48ba[_0xd6ee('0x9')],'priority':_0x878b3[_0xd6ee('0x39')][_0xd6ee('0x30')]+_0x23ef7c+_0x3a6007++,'VoiceExtensionId':_0x1c48ba['id']});}else{_0x513912['push']({'type':_0x878b3[_0xd6ee('0x3')]['toLowerCase'](),'app':_0xd6ee('0x42'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1c48ba[_0xd6ee('0x6')],'exten':_0x1c48ba['exten'],'priority':_0x878b3[_0xd6ee('0x39')][_0xd6ee('0x30')]+_0x23ef7c+_0x3a6007++,'VoiceExtensionId':_0x1c48ba['id']});_0x513912[_0xd6ee('0xc')]({'type':_0x878b3[_0xd6ee('0x3')][_0xd6ee('0x36')](),'app':_0xd6ee('0x4'),'appdata':_0xd6ee('0x44'),'context':_0x1c48ba[_0xd6ee('0x6')],'exten':_0x1c48ba[_0xd6ee('0x9')],'priority':_0x878b3['intervals'][_0xd6ee('0x30')]+_0x23ef7c+_0x3a6007++,'VoiceExtensionId':_0x1c48ba['id']});}}}}for(var _0x538a8f=0x0;_0x538a8f<_0x878b3[_0xd6ee('0x39')][_0xd6ee('0x30')];_0x538a8f++){var _0x47c1f5=_0x23ef7c+_0x878b3['intervals'][_0xd6ee('0x30')];var _0x2f25c4=_0x538a8f===_0x878b3[_0xd6ee('0x39')][_0xd6ee('0x30')]-0x1?_0x23ef7c+_0x513912[_0xd6ee('0x30')]+_0x5cf265[_0xd6ee('0x30')]+0x2:_0x23ef7c+_0x538a8f+0x1;_0x513912[_0xd6ee('0x45')](_0x538a8f,0x0,{'type':_0x1c48ba[_0xd6ee('0x3')],'app':'GotoIfTime','appdata':_0x878b3[_0xd6ee('0x39')][_0x538a8f]+'?'+_0x1c48ba[_0xd6ee('0x6')]+',${EXTEN},'+_0x47c1f5+':'+_0x1c48ba[_0xd6ee('0x6')]+_0xd6ee('0x46')+_0x2f25c4,'exten':_0x1c48ba[_0xd6ee('0x9')],'context':_0x1c48ba[_0xd6ee('0x6')],'priority':_0x23ef7c+_0x538a8f,'VoiceExtensionId':_0x1c48ba['id']});}if(_0x878b3[_0xd6ee('0x47')]===_0xd6ee('0x48'))_0x878b3[_0xd6ee('0x49')]=_0x1479a4(_0x1c48ba,_0x878b3[_0xd6ee('0x49')]);_0x878b3[_0xd6ee('0x4a')]=_0x513912[_0xd6ee('0x30')]?_[_0xd6ee('0x4b')](_0x513912)['priority']+0x1:_0x23ef7c;_0x331510=_[_0xd6ee('0x4c')](_0x331510,_0x513912,[_0x878b3],_0x5cf265);_0x23ef7c=_[_0xd6ee('0x4b')](_0x331510)['priority']+0x1;}return _0x160d05(_0x331510);})[_0xd6ee('0x4d')](function(_0x18c951){_0x4b181c(_0x18c951);});});}return _0x27b7bf['define'](_0xd6ee('0x4e'),attributes,{'tableName':_0xd6ee('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5ce23d){var _0x2c8eb0=this[_0xd6ee('0x50')]({'plain':!![]});var _0x4e55ba=_0x2c8eb0[_0xd6ee('0x3')]===_0xd6ee('0x10')?_0x3196c0(_0x2c8eb0):_0x25a92a(_0x2c8eb0);return _0x164906(_0x2c8eb0,_0x5ce23d,_['last'](_0x4e55ba)['priority']+0x1)['then'](function(_0x517424){var _0x2b4133=_[_0xd6ee('0x4c')](_0x4e55ba,_0x517424);_0x2b4133[_0xd6ee('0xc')]({'type':_0x2c8eb0[_0xd6ee('0x3')],'app':_0xd6ee('0x51'),'exten':_0x2c8eb0[_0xd6ee('0x9')],'context':_0x2c8eb0[_0xd6ee('0x6')],'priority':_[_0xd6ee('0x4b')](_0x2b4133)[_0xd6ee('0x4a')]+0x1,'VoiceExtensionId':_0x2c8eb0['id']});return _0x2b4133;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 84baeb4..e7172fe 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 _0x3dba=['stringify','code','error','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','map','include','model','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3dba,0x73));var _0xa3db=function(_0x38c7e3,_0x34b4bc){_0x38c7e3=_0x38c7e3-0x0;var _0x34b66f=_0x3dba[_0x38c7e3];return _0x34b66f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa3db('0x0'));var rs=require(_0xa3db('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3db('0x2'))['db'];var utils=require(_0xa3db('0x3'));var logger=require(_0xa3db('0x4'))(_0xa3db('0x5'));var config=require(_0xa3db('0x6'));var jayson=require(_0xa3db('0x7'));var client=jayson[_0xa3db('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa3db('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0xa3db('0xa')](socket);function respondWithRpcPromise(_0x1d68f6,_0x3dbdc2,_0x18813f){return new BPromise(function(_0x17ac00,_0x282cfd){return client[_0xa3db('0xb')](_0x1d68f6,_0x18813f)[_0xa3db('0xc')](function(_0x6c9d3){logger['info'](_0xa3db('0xd'),_0x3dbdc2,_0xa3db('0xe'));logger[_0xa3db('0xf')](_0xa3db('0x10'),_0x3dbdc2,_0xa3db('0xe'),JSON[_0xa3db('0x11')](_0x6c9d3));if(_0x6c9d3['error']){if(_0x6c9d3['error'][_0xa3db('0x12')]===0x1f4){logger[_0xa3db('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x3dbdc2,_0x6c9d3[_0xa3db('0x13')][_0xa3db('0x14')]);return _0x282cfd(_0x6c9d3[_0xa3db('0x13')][_0xa3db('0x14')]);}logger[_0xa3db('0x13')](_0xa3db('0xd'),_0x3dbdc2,_0x6c9d3[_0xa3db('0x13')][_0xa3db('0x14')]);return _0x17ac00(_0x6c9d3[_0xa3db('0x13')]['message']);}else{logger['info'](_0xa3db('0xd'),_0x3dbdc2,_0xa3db('0xe'));_0x17ac00(_0x6c9d3[_0xa3db('0x15')][_0xa3db('0x14')]);}})['catch'](function(_0x1b8ce1){logger[_0xa3db('0x13')](_0xa3db('0xd'),_0x3dbdc2,_0x1b8ce1);_0x282cfd(_0x1b8ce1);});});}exports[_0xa3db('0x16')]=function(_0x2cdd17){var _0x199a7c=this;return new Promise(function(_0x439bb2,_0x2c817c){return db[_0xa3db('0x17')][_0xa3db('0x18')]({'raw':_0x2cdd17[_0xa3db('0x19')]?_0x2cdd17[_0xa3db('0x19')][_0xa3db('0x1a')]===undefined?!![]:![]:!![],'where':_0x2cdd17[_0xa3db('0x19')]?_0x2cdd17[_0xa3db('0x19')][_0xa3db('0x1b')]||null:null,'attributes':_0x2cdd17[_0xa3db('0x19')]?_0x2cdd17[_0xa3db('0x19')][_0xa3db('0x1c')]||null:null,'limit':_0x2cdd17['options']?_0x2cdd17[_0xa3db('0x19')]['limit']||null:null,'include':_0x2cdd17[_0xa3db('0x19')]?_0x2cdd17[_0xa3db('0x19')]['include']?_[_0xa3db('0x1d')](_0x2cdd17[_0xa3db('0x19')][_0xa3db('0x1e')],function(_0x5e71f2){return{'model':db[_0x5e71f2[_0xa3db('0x1f')]],'as':_0x5e71f2['as'],'attributes':_0x5e71f2[_0xa3db('0x1c')],'include':_0x5e71f2[_0xa3db('0x1e')]?_[_0xa3db('0x1d')](_0x5e71f2[_0xa3db('0x1e')],function(_0x53e89f){return{'model':db[_0x53e89f[_0xa3db('0x1f')]],'as':_0x53e89f['as'],'attributes':_0x53e89f[_0xa3db('0x1c')],'include':_0x53e89f[_0xa3db('0x1e')]?_[_0xa3db('0x1d')](_0x53e89f[_0xa3db('0x1e')],function(_0x2f8602){return{'model':db[_0x2f8602[_0xa3db('0x1f')]],'as':_0x2f8602['as'],'attributes':_0x2f8602[_0xa3db('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa3db('0xc')](function(_0x2ecde3){logger['info'](_0xa3db('0x16'),_0x2cdd17);logger[_0xa3db('0xf')](_0xa3db('0x16'),_0x2cdd17,JSON['stringify'](_0x2ecde3));_0x439bb2(_0x2ecde3);})[_0xa3db('0x20')](function(_0x3b3436){logger['error'](_0xa3db('0x16'),_0x3b3436[_0xa3db('0x14')],_0x2cdd17);_0x2c817c(_0x199a7c[_0xa3db('0x13')](0x1f4,_0x3b3436['message']));});});}; \ No newline at end of file +var _0x6c14=['raw','where','attributes','limit','include','map','model','GetVoiceExtension','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','VoiceExtension','findAll','options'];(function(_0x12b2ce,_0x349b04){var _0x546799=function(_0x663a43){while(--_0x663a43){_0x12b2ce['push'](_0x12b2ce['shift']());}};_0x546799(++_0x349b04);}(_0x6c14,0xd1));var _0x46c1=function(_0xe75b20,_0x4a056b){_0xe75b20=_0xe75b20-0x0;var _0x37d207=_0x6c14[_0xe75b20];return _0x37d207;};'use strict';var _=require(_0x46c1('0x0'));var util=require(_0x46c1('0x1'));var moment=require(_0x46c1('0x2'));var BPromise=require(_0x46c1('0x3'));var rs=require(_0x46c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46c1('0x5'))['db'];var utils=require(_0x46c1('0x6'));var logger=require(_0x46c1('0x7'))('rpc');var config=require(_0x46c1('0x8'));var jayson=require(_0x46c1('0x9'));var client=jayson[_0x46c1('0xa')][_0x46c1('0xb')]({'port':0x232a});config[_0x46c1('0xc')]=_[_0x46c1('0xd')](config[_0x46c1('0xc')],{'host':_0x46c1('0xe'),'port':0x18eb});var socket=require(_0x46c1('0xf'))(new Redis(config['redis']));require(_0x46c1('0x10'))[_0x46c1('0x11')](socket);function respondWithRpcPromise(_0x28fae2,_0x5e999d,_0x42af02){return new BPromise(function(_0x3676e3,_0x2c718c){return client['request'](_0x28fae2,_0x42af02)[_0x46c1('0x12')](function(_0x2e9325){logger[_0x46c1('0x13')](_0x46c1('0x14'),_0x5e999d,'request\x20sent');logger[_0x46c1('0x15')](_0x46c1('0x16'),_0x5e999d,'request\x20sent',JSON['stringify'](_0x2e9325));if(_0x2e9325[_0x46c1('0x17')]){if(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x18')]===0x1f4){logger[_0x46c1('0x17')](_0x46c1('0x14'),_0x5e999d,_0x2e9325['error'][_0x46c1('0x19')]);return _0x2c718c(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x19')]);}logger[_0x46c1('0x17')](_0x46c1('0x14'),_0x5e999d,_0x2e9325['error']['message']);return _0x3676e3(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x19')]);}else{logger[_0x46c1('0x13')](_0x46c1('0x14'),_0x5e999d,_0x46c1('0x1a'));_0x3676e3(_0x2e9325[_0x46c1('0x1b')][_0x46c1('0x19')]);}})['catch'](function(_0x247a8b){logger[_0x46c1('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x5e999d,_0x247a8b);_0x2c718c(_0x247a8b);});});}exports['GetVoiceExtension']=function(_0x17ff1d){var _0x5a5d95=this;return new Promise(function(_0x5b5290,_0x301c0c){return db[_0x46c1('0x1c')][_0x46c1('0x1d')]({'raw':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x1f')]===undefined?!![]:![]:!![],'where':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x20')]||null:null,'attributes':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x21')]||null:null,'limit':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x22')]||null:null,'include':_0x17ff1d[_0x46c1('0x1e')]?_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x23')]?_[_0x46c1('0x24')](_0x17ff1d[_0x46c1('0x1e')][_0x46c1('0x23')],function(_0x2924b8){return{'model':db[_0x2924b8[_0x46c1('0x25')]],'as':_0x2924b8['as'],'attributes':_0x2924b8['attributes'],'include':_0x2924b8['include']?_[_0x46c1('0x24')](_0x2924b8[_0x46c1('0x23')],function(_0x54f5e3){return{'model':db[_0x54f5e3[_0x46c1('0x25')]],'as':_0x54f5e3['as'],'attributes':_0x54f5e3[_0x46c1('0x21')],'include':_0x54f5e3[_0x46c1('0x23')]?_[_0x46c1('0x24')](_0x54f5e3[_0x46c1('0x23')],function(_0x3fdaea){return{'model':db[_0x3fdaea['model']],'as':_0x3fdaea['as'],'attributes':_0x3fdaea[_0x46c1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46c1('0x12')](function(_0x32f553){logger[_0x46c1('0x13')](_0x46c1('0x26'),_0x17ff1d);logger[_0x46c1('0x15')](_0x46c1('0x26'),_0x17ff1d,JSON['stringify'](_0x32f553));_0x5b5290(_0x32f553);})[_0x46c1('0x27')](function(_0x5448f4){logger[_0x46c1('0x17')](_0x46c1('0x26'),_0x5448f4[_0x46c1('0x19')],_0x17ff1d);_0x301c0c(_0x5a5d95[_0x46c1('0x17')](0x1f4,_0x5448f4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d0929bf..0e1d86c 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x550f39,_0x35a131){var _0xcf0e0c=function(_0x1933a8){while(--_0x1933a8){_0x550f39['push'](_0x550f39['shift']());}};_0xcf0e0c(++_0x35a131);}(_0x7a54,0x106));var _0x47a5=function(_0x284acd,_0x2dcedc){_0x284acd=_0x284acd-0x0;var _0x48afa5=_0x7a54[_0x284acd];return _0x48afa5;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x428d39,_0x528e86){var _0x2b9029=function(_0x3999a3){while(--_0x3999a3){_0x428d39['push'](_0x428d39['shift']());}};_0x2b9029(++_0x528e86);}(_0x326f,0xd1));var _0xf326=function(_0xf2d15c,_0x3192a1){_0xf2d15c=_0xf2d15c-0x0;var _0x3c0c80=_0x326f[_0xf2d15c];return _0x3c0c80;};'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 0a41a23..411a8cd 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 _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','getMessages','post'];(function(_0x2990ca,_0x602b60){var _0x115623=function(_0x22abb9){while(--_0x22abb9){_0x2990ca['push'](_0x2990ca['shift']());}};_0x115623(++_0x602b60);}(_0x2542,0x169));var _0x2254=function(_0x4c50a8,_0x90c411){_0x4c50a8=_0x4c50a8-0x0;var _0x323ae7=_0x2542[_0x4c50a8];return _0x323ae7;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','/:id','isAuthenticated','/:id/messages','getMessages','post','create','put','update','delete','destroy','multer','util'];(function(_0x2cfe2,_0x3b2e20){var _0x287633=function(_0x52f550){while(--_0x52f550){_0x2cfe2['push'](_0x2cfe2['shift']());}};_0x287633(++_0x3b2e20);}(_0x9f0e,0x116));var _0xe9f0=function(_0x521d06,_0x40fa11){_0x521d06=_0x521d06-0x0;var _0x1e430b=_0x9f0e[_0x521d06];return _0x1e430b;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['show']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 325ae5d..bc1a938 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 _0x1d05=['exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0x3410f7,_0x89b816){var _0x135c15=function(_0x245f82){while(--_0x245f82){_0x3410f7['push'](_0x3410f7['shift']());}};_0x135c15(++_0x89b816);}(_0x1d05,0x170));var _0x51d0=function(_0x49b655,_0x287c0a){_0x49b655=_0x49b655-0x0;var _0x1c95ad=_0x1d05[_0x49b655];return _0x1c95ad;};'use strict';var Sequelize=require('sequelize');module[_0x51d0('0x0')]={'customer_id':{'type':Sequelize[_0x51d0('0x1')]},'context':{'type':Sequelize[_0x51d0('0x1')],'defaultValue':_0x51d0('0x2'),'unique':_0x51d0('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x51d0('0x3')},'password':{'type':Sequelize[_0x51d0('0x1')]},'fullname':{'type':Sequelize[_0x51d0('0x1')]},'email':{'type':Sequelize[_0x51d0('0x1')],'validate':{'isEmail':!![]},'set':function(_0x8ac6f0){this['setDataValue'](_0x51d0('0x4'),typeof _0x8ac6f0===_0x51d0('0x5')&&_0x8ac6f0[_0x51d0('0x6')]()?_0x8ac6f0['trim']():null);}},'pager':{'type':Sequelize[_0x51d0('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x51d0('0x7')},'attach':{'type':Sequelize[_0x51d0('0x8')](_0x51d0('0x9'),'no'),'defaultValue':_0x51d0('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x51d0('0x8')]('yes','no'),'defaultValue':_0x51d0('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x51d0('0x1')]},'review':{'type':Sequelize[_0x51d0('0x8')](_0x51d0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x51d0('0x8')](_0x51d0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x51d0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x51d0('0x8')](_0x51d0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x51d0('0x8')](_0x51d0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x51d0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x51d0('0x8')]('yes','no'),'defaultValue':_0x51d0('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x51d0('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x51d0('0x8')](_0x51d0('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x51d0('0x8')]('yes','no'),'defaultValue':_0x51d0('0x9'),'allowNull':![]},'stamp':{'type':_0x51d0('0xa')},'emailsubject':{'type':Sequelize[_0x51d0('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x51d0('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x51d0('0xc')],'get':function(){return this[_0x51d0('0xd')](_0x51d0('0xe'))+_0x51d0('0xf')+this[_0x51d0('0xd')]('mailbox');}}}; \ No newline at end of file +var _0x9004=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0xa79b9,_0x45570c){var _0x33c7db=function(_0x1401db){while(--_0x1401db){_0xa79b9['push'](_0xa79b9['shift']());}};_0x33c7db(++_0x45570c);}(_0x9004,0x146));var _0x4900=function(_0x1865f3,_0x428267){_0x1865f3=_0x1865f3-0x0;var _0xc9e2b0=_0x9004[_0x1865f3];return _0xc9e2b0;};'use strict';var Sequelize=require(_0x4900('0x0'));module[_0x4900('0x1')]={'customer_id':{'type':Sequelize[_0x4900('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x4900('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x4900('0x2')],'defaultValue':'','allowNull':![],'unique':_0x4900('0x4')},'password':{'type':Sequelize[_0x4900('0x2')]},'fullname':{'type':Sequelize[_0x4900('0x2')]},'email':{'type':Sequelize[_0x4900('0x2')],'validate':{'isEmail':!![]},'set':function(_0x23f91f){this[_0x4900('0x5')](_0x4900('0x6'),typeof _0x23f91f===_0x4900('0x7')&&_0x23f91f['trim']()?_0x23f91f[_0x4900('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x4900('0x9')},'attach':{'type':Sequelize[_0x4900('0xa')](_0x4900('0xb'),'no'),'defaultValue':_0x4900('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4900('0xa')](_0x4900('0xb'),'no'),'defaultValue':_0x4900('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x4900('0x2')]},'review':{'type':Sequelize[_0x4900('0xa')](_0x4900('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4900('0xa')](_0x4900('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4900('0xa')](_0x4900('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4900('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4900('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4900('0xa')](_0x4900('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x4900('0xb'),'no'),'defaultValue':_0x4900('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x4900('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4900('0xa')](_0x4900('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4900('0xa')](_0x4900('0xb'),'no'),'defaultValue':_0x4900('0xb'),'allowNull':![]},'stamp':{'type':_0x4900('0xd')},'emailsubject':{'type':Sequelize[_0x4900('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x4900('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4900('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4900('0xf')],'get':function(){return this[_0x4900('0x10')](_0x4900('0x11'))+_0x4900('0x12')+this[_0x4900('0x10')](_0x4900('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e97944e..559129d 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 _0x1775=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','params','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','rawAttributes','mailbox','options','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','name','send','index','VoiceMail','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x3a4324,_0x3052dc){var _0x586440=function(_0x3bbcf8){while(--_0x3bbcf8){_0x3a4324['push'](_0x3a4324['shift']());}};_0x586440(++_0x3052dc);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){var _0x2503ef=_0x3b39b5['get']({'plain':!![]});var _0x564139=_0x5177('0x2a');return db[_0x5177('0x2b')]['destroy']({'where':{'type':_0x564139,'resourceId':_0x2503ef['id']}})[_0x5177('0x28')](function(){return _0x3b39b5;});})['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)[_0x5177('0x1e')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x1c')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x2c')]){delete _0x1cef5d[_0x5177('0x2c')];}_0x7f86e[_0x5177('0x1d')](_0xe98ff1)[_0x5177('0x2d')](_0x1cef5d);};}exports[_0x5177('0x2e')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x2f')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x30')],'type':_0x172b36[_0x5177('0x31')]['key']};});_0x49f6f1['model']=_[_0x5177('0x32')](_0x2233a2,_0x5177('0x2c'));_0x49f6f1[_0x5177('0x33')]=_[_0x5177('0x34')](_0x8134f9[_0x5177('0x33')]);_0x49f6f1[_0x5177('0x35')]=_[_0x5177('0x36')](_0x49f6f1[_0x5177('0x37')],_0x49f6f1['query']);_0x72dced[_0x5177('0x38')]=_[_0x5177('0x36')](_0x49f6f1['model'],qs[_0x5177('0x39')](_0x8134f9[_0x5177('0x33')][_0x5177('0x39')]));_0x72dced[_0x5177('0x38')]=_0x72dced[_0x5177('0x38')][_0x5177('0x3a')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x37')];if(!_0x8134f9[_0x5177('0x33')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x72dced[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x8134f9[_0x5177('0x33')]['limit']);_0x72dced[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x8134f9[_0x5177('0x33')][_0x5177('0x3f')]);_0x72dced[_0x5177('0x40')]=qs[_0x5177('0x35')](_[_0x5177('0x41')](_0x8134f9[_0x5177('0x33')],_0x49f6f1[_0x5177('0x35')]),_0x2233a2);if(_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]){_0x72dced[_0x5177('0x40')]=_[_0x5177('0x43')](_0x72dced['where'],{'$or':_[_0x5177('0x32')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x44')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x2c')]]={'$like':'%'+_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x40')]};return db[_0x5177('0x2f')][_0x5177('0x22')](_0x210510)[_0x5177('0x28')](function(_0x3e710d){_0x42e1db[_0x5177('0x22')]=_0x3e710d;if(_0x8134f9[_0x5177('0x33')]['includeAll']){_0x72dced[_0x5177('0x45')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x72dced);})[_0x5177('0x28')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x28')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':!![],'where':{'id':_0x46c833[_0x5177('0x46')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x37')]=_[_0x5177('0x34')](db['VoiceMail']['rawAttributes']);_0x3776b8[_0x5177('0x33')]=_['keys'](_0x46c833[_0x5177('0x33')]);_0x3776b8[_0x5177('0x35')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],_0x3776b8['query']);_0x262c71[_0x5177('0x38')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],qs[_0x5177('0x39')](_0x46c833[_0x5177('0x33')][_0x5177('0x39')]));_0x262c71[_0x5177('0x38')]=_0x262c71[_0x5177('0x38')][_0x5177('0x3a')]?_0x262c71[_0x5177('0x38')]:_0x3776b8[_0x5177('0x37')];if(_0x46c833['query'][_0x5177('0x47')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x2f')][_0x5177('0x48')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x28')](respondWithResult(_0x1769cd,null))[_0x5177('0x49')](handleError(_0x1769cd,null));};exports[_0x5177('0x4a')]=function(_0x4891fe,_0x1d4ae4){return db['VoiceMail']['create'](_0x4891fe['body'],{})[_0x5177('0x28')](function(_0x37d5dd){var _0x1300d7=_0x4891fe['user']['get']({'plain':!![]});if(!_0x1300d7)throw new Error(_0x5177('0x4b'));if(_0x1300d7['role']===_0x5177('0x4c')){var _0x9dd7a2=_0x37d5dd[_0x5177('0x4d')]({'plain':!![]});var _0x31a6e1=_0x5177('0x2a');return db[_0x5177('0x4e')][_0x5177('0x48')]({'where':{'name':_0x31a6e1,'userProfileId':_0x1300d7[_0x5177('0x4f')]},'raw':!![]})[_0x5177('0x28')](function(_0x217aca){if(_0x217aca&&_0x217aca[_0x5177('0x50')]===0x0){return db[_0x5177('0x2b')][_0x5177('0x4a')]({'name':_0x9dd7a2['name'],'resourceId':_0x9dd7a2['id'],'type':_0x217aca['name'],'sectionId':_0x217aca['id']},{})[_0x5177('0x28')](function(){return _0x37d5dd;});}else{return _0x37d5dd;}})['catch'](function(_0x649c6f){logger['error'](_0x5177('0x51'),_0x649c6f);throw _0x649c6f;});}return _0x37d5dd;})[_0x5177('0x28')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x49')](handleError(_0x1d4ae4,null));};exports['update']=function(_0x5be224,_0x19884e){if(_0x5be224[_0x5177('0x52')]['id']){delete _0x5be224[_0x5177('0x52')]['id'];}return db[_0x5177('0x2f')]['find']({'where':{'id':_0x5be224['params']['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x19884e,null))[_0x5177('0x28')](saveUpdates(_0x5be224[_0x5177('0x52')],null))[_0x5177('0x28')](respondWithResult(_0x19884e,null))['catch'](handleError(_0x19884e,null));};exports[_0x5177('0x29')]=function(_0x143aff,_0x3a18ad){return db['VoiceMail'][_0x5177('0x48')]({'where':{'id':_0x143aff[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x3a18ad,null))['then'](removeEntity(_0x3a18ad,null))[_0x5177('0x49')](handleError(_0x3a18ad,null));};exports['getMessages']=function(_0x40dfd6,_0x39fb92,_0x3268bd){return db['VoiceMail'][_0x5177('0x53')]({'where':{'id':_0x40dfd6[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x39fb92,null))[_0x5177('0x28')](function(_0xc7a59e){var _0x74589e;var _0x37380c={},_0x267599={};_0x267599['model']=_['keys'](db['VoiceMailMessage'][_0x5177('0x54')]);_0x267599[_0x5177('0x33')]=_[_0x5177('0x34')](_0x40dfd6[_0x5177('0x33')]);_0x267599[_0x5177('0x35')]=_[_0x5177('0x36')](_0x267599['model'],_0x267599['query']);_0x37380c[_0x5177('0x38')]=_[_0x5177('0x36')](_0x267599[_0x5177('0x37')],qs[_0x5177('0x39')](_0x40dfd6[_0x5177('0x33')][_0x5177('0x39')]));_0x37380c[_0x5177('0x38')]=_0x37380c[_0x5177('0x38')][_0x5177('0x3a')]?_0x37380c['attributes']:_0x267599[_0x5177('0x37')];if(!_0x40dfd6[_0x5177('0x33')]['hasOwnProperty'](_0x5177('0x3c'))){_0x37380c[_0x5177('0x3d')]=qs['limit'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x3d')]);_0x37380c[_0x5177('0x20')]=qs['offset'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x20')]);}_0x37380c['order']=qs['sort'](_0x40dfd6[_0x5177('0x33')]['sort']);_0x37380c[_0x5177('0x40')]=qs['filters'](_[_0x5177('0x41')](_0x40dfd6[_0x5177('0x33')],_0x267599['filters']));if(_0x40dfd6[_0x5177('0x33')][_0x5177('0x42')]){_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c[_0x5177('0x40')],{'$or':_[_0x5177('0x32')](_0x37380c[_0x5177('0x38')],function(_0x58ebdd){var _0x26b733={};_0x26b733[_0x58ebdd]={'$like':'%'+_0x40dfd6['query']['filter']+'%'};return _0x26b733;})});}_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c['where'],{'mailboxuser':_0xc7a59e[_0x5177('0x55')]});_0x37380c=_[_0x5177('0x43')]({},_0x37380c,_0x40dfd6[_0x5177('0x56')]);return db[_0x5177('0x57')][_0x5177('0x58')](_0x37380c)[_0x5177('0x28')](respondWithFilteredResult(_0x39fb92,_0x37380c));})[_0x5177('0x49')](handleError(_0x39fb92,null));}; \ No newline at end of file +var _0x7916=['update','then','get','destroy','end','error','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getMessages','VoiceMailMessage','hasOwnProperty','pick','mailbox','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','sendStatus','status','undefined','limit','count','offset','set','Content-Range','reject'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7916,0x128));var _0x6791=function(_0x4d4f3e,_0x1d9c5d){_0x4d4f3e=_0x4d4f3e-0x0;var _0xc99ca9=_0x7916[_0x4d4f3e];return _0xc99ca9;};'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'];function respondWithStatusCode(_0x61ac73,_0x16c62b){_0x16c62b=_0x16c62b||0xcc;return function(_0x423e22){if(_0x423e22){return _0x61ac73[_0x6791('0x17')](_0x16c62b);}return _0x61ac73[_0x6791('0x18')](_0x16c62b)['end']();};}function respondWithResult(_0x4b1719,_0x34b28d){_0x34b28d=_0x34b28d||0xc8;return function(_0x5122f9){if(_0x5122f9){return _0x4b1719[_0x6791('0x18')](_0x34b28d)['json'](_0x5122f9);}};}function respondWithFilteredResult(_0x3be9f0,_0x163898){return function(_0x517910){if(_0x517910){var _0x3e4792=typeof _0x163898['offset']===_0x6791('0x19')&&typeof _0x163898[_0x6791('0x1a')]==='undefined';var _0xbc35d=_0x517910[_0x6791('0x1b')];var _0x5bec14=_0x3e4792?0x0:_0x163898[_0x6791('0x1c')];var _0x4d8a79=_0x3e4792?_0x517910[_0x6791('0x1b')]:_0x163898[_0x6791('0x1c')]+_0x163898[_0x6791('0x1a')];var _0x3a72ce;if(_0x4d8a79>=_0xbc35d){_0x4d8a79=_0xbc35d;_0x3a72ce=0xc8;}else{_0x3a72ce=0xce;}_0x3be9f0[_0x6791('0x18')](_0x3a72ce);return _0x3be9f0[_0x6791('0x1d')](_0x6791('0x1e'),_0x5bec14+'-'+_0x4d8a79+'/'+_0xbc35d)['json'](_0x517910);}return null;};}function patchUpdates(_0x4a2922){return function(_0x306acb){try{jsonpatch['apply'](_0x306acb,_0x4a2922,!![]);}catch(_0x21ef16){return BPromise[_0x6791('0x1f')](_0x21ef16);}return _0x306acb['save']();};}function saveUpdates(_0x17f200,_0x309610){return function(_0x15b9ab){if(_0x15b9ab){return _0x15b9ab[_0x6791('0x20')](_0x17f200)['then'](function(_0x3e17b3){return _0x3e17b3;});}return null;};}function removeEntity(_0x1b516d,_0x4a8717){return function(_0x53bb44){if(_0x53bb44){return _0x53bb44['destroy']()[_0x6791('0x21')](function(){var _0x502043=_0x53bb44[_0x6791('0x22')]({'plain':!![]});var _0x5409f1='Voicemails';return db['UserProfileResource'][_0x6791('0x23')]({'where':{'type':_0x5409f1,'resourceId':_0x502043['id']}})[_0x6791('0x21')](function(){return _0x53bb44;});})[_0x6791('0x21')](function(){_0x1b516d['status'](0xcc)[_0x6791('0x24')]();});}};}function handleEntityNotFound(_0x30cc17,_0x493a59){return function(_0x342107){if(!_0x342107){_0x30cc17['sendStatus'](0x194);}return _0x342107;};}function handleError(_0x424b0e,_0x49dd24){_0x49dd24=_0x49dd24||0x1f4;return function(_0x4fc5d5){logger[_0x6791('0x25')](_0x4fc5d5['stack']);if(_0x4fc5d5[_0x6791('0x26')]){delete _0x4fc5d5[_0x6791('0x26')];}_0x424b0e['status'](_0x49dd24)[_0x6791('0x27')](_0x4fc5d5);};}exports[_0x6791('0x28')]=function(_0x234c5e,_0xd36448){var _0x5d9d54={},_0x4f91d6={},_0x348b9c={'count':0x0,'rows':[]};var _0x5e5ac3=_[_0x6791('0x29')](db[_0x6791('0x2a')][_0x6791('0x2b')],function(_0x2b98b8){return{'name':_0x2b98b8[_0x6791('0x2c')],'type':_0x2b98b8[_0x6791('0x2d')][_0x6791('0x2e')]};});_0x4f91d6[_0x6791('0x2f')]=_[_0x6791('0x29')](_0x5e5ac3,_0x6791('0x26'));_0x4f91d6['query']=_[_0x6791('0x30')](_0x234c5e[_0x6791('0x31')]);_0x4f91d6[_0x6791('0x32')]=_[_0x6791('0x33')](_0x4f91d6[_0x6791('0x2f')],_0x4f91d6[_0x6791('0x31')]);_0x5d9d54['attributes']=_['intersection'](_0x4f91d6['model'],qs[_0x6791('0x34')](_0x234c5e[_0x6791('0x31')][_0x6791('0x34')]));_0x5d9d54['attributes']=_0x5d9d54['attributes'][_0x6791('0x35')]?_0x5d9d54[_0x6791('0x36')]:_0x4f91d6[_0x6791('0x2f')];if(!_0x234c5e[_0x6791('0x31')]['hasOwnProperty'](_0x6791('0x37'))){_0x5d9d54[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x234c5e['query'][_0x6791('0x1a')]);_0x5d9d54['offset']=qs['offset'](_0x234c5e[_0x6791('0x31')][_0x6791('0x1c')]);}_0x5d9d54['order']=qs[_0x6791('0x38')](_0x234c5e[_0x6791('0x31')][_0x6791('0x38')]);_0x5d9d54[_0x6791('0x39')]=qs[_0x6791('0x32')](_['pick'](_0x234c5e[_0x6791('0x31')],_0x4f91d6[_0x6791('0x32')]),_0x5e5ac3);if(_0x234c5e[_0x6791('0x31')]['filter']){_0x5d9d54[_0x6791('0x39')]=_[_0x6791('0x3a')](_0x5d9d54[_0x6791('0x39')],{'$or':_['map'](_0x5e5ac3,function(_0x11a012){if(_0x11a012[_0x6791('0x2d')]!==_0x6791('0x3b')){var _0x122aa5={};_0x122aa5[_0x11a012['name']]={'$like':'%'+_0x234c5e[_0x6791('0x31')][_0x6791('0x3c')]+'%'};return _0x122aa5;}})});}_0x5d9d54=_[_0x6791('0x3a')]({},_0x5d9d54,_0x234c5e[_0x6791('0x3d')]);var _0x12f121={'where':_0x5d9d54[_0x6791('0x39')]};return db[_0x6791('0x2a')][_0x6791('0x1b')](_0x12f121)[_0x6791('0x21')](function(_0x4e4004){_0x348b9c['count']=_0x4e4004;if(_0x234c5e[_0x6791('0x31')][_0x6791('0x3e')]){_0x5d9d54['include']=[{'all':!![]}];}return db[_0x6791('0x2a')][_0x6791('0x3f')](_0x5d9d54);})[_0x6791('0x21')](function(_0x3edb86){_0x348b9c[_0x6791('0x40')]=_0x3edb86;return _0x348b9c;})[_0x6791('0x21')](respondWithFilteredResult(_0xd36448,_0x5d9d54))[_0x6791('0x41')](handleError(_0xd36448,null));};exports['show']=function(_0xb3bea8,_0x4b9fca){var _0x17ecf0={'raw':!![],'where':{'id':_0xb3bea8[_0x6791('0x42')]['id']}},_0xfc170e={};_0xfc170e[_0x6791('0x2f')]=_['keys'](db[_0x6791('0x2a')][_0x6791('0x2b')]);_0xfc170e[_0x6791('0x31')]=_[_0x6791('0x30')](_0xb3bea8[_0x6791('0x31')]);_0xfc170e[_0x6791('0x32')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],_0xfc170e['query']);_0x17ecf0[_0x6791('0x36')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],qs[_0x6791('0x34')](_0xb3bea8['query'][_0x6791('0x34')]));_0x17ecf0[_0x6791('0x36')]=_0x17ecf0['attributes'][_0x6791('0x35')]?_0x17ecf0['attributes']:_0xfc170e[_0x6791('0x2f')];if(_0xb3bea8[_0x6791('0x31')][_0x6791('0x3e')]){_0x17ecf0[_0x6791('0x43')]=[{'all':!![]}];}_0x17ecf0=_[_0x6791('0x3a')]({},_0x17ecf0,_0xb3bea8[_0x6791('0x3d')]);return db[_0x6791('0x2a')][_0x6791('0x44')](_0x17ecf0)[_0x6791('0x21')](handleEntityNotFound(_0x4b9fca,null))['then'](respondWithResult(_0x4b9fca,null))[_0x6791('0x41')](handleError(_0x4b9fca,null));};exports['create']=function(_0x10e806,_0x2bb86a){return db[_0x6791('0x2a')][_0x6791('0x45')](_0x10e806[_0x6791('0x46')],{})['then'](function(_0x2bc08d){var _0x35e087=_0x10e806[_0x6791('0x47')][_0x6791('0x22')]({'plain':!![]});if(!_0x35e087)throw new Error(_0x6791('0x48'));if(_0x35e087['role']===_0x6791('0x47')){var _0x42948b=_0x2bc08d['get']({'plain':!![]});var _0x3df699='Voicemails';return db[_0x6791('0x49')][_0x6791('0x44')]({'where':{'name':_0x3df699,'userProfileId':_0x35e087[_0x6791('0x4a')]},'raw':!![]})[_0x6791('0x21')](function(_0x558069){if(_0x558069&&_0x558069[_0x6791('0x4b')]===0x0){return db[_0x6791('0x4c')]['create']({'name':_0x42948b[_0x6791('0x26')],'resourceId':_0x42948b['id'],'type':_0x558069[_0x6791('0x26')],'sectionId':_0x558069['id']},{})[_0x6791('0x21')](function(){return _0x2bc08d;});}else{return _0x2bc08d;}})['catch'](function(_0x355e97){logger[_0x6791('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x355e97);throw _0x355e97;});}return _0x2bc08d;})[_0x6791('0x21')](respondWithResult(_0x2bb86a,0xc9))[_0x6791('0x41')](handleError(_0x2bb86a,null));};exports['update']=function(_0x169531,_0x216498){if(_0x169531[_0x6791('0x46')]['id']){delete _0x169531[_0x6791('0x46')]['id'];}return db['VoiceMail'][_0x6791('0x44')]({'where':{'id':_0x169531[_0x6791('0x42')]['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x216498,null))['then'](saveUpdates(_0x169531['body'],null))[_0x6791('0x21')](respondWithResult(_0x216498,null))[_0x6791('0x41')](handleError(_0x216498,null));};exports[_0x6791('0x23')]=function(_0x45756f,_0x288f05){return db['VoiceMail']['find']({'where':{'id':_0x45756f[_0x6791('0x42')]['id']}})['then'](handleEntityNotFound(_0x288f05,null))['then'](removeEntity(_0x288f05,null))[_0x6791('0x41')](handleError(_0x288f05,null));};exports[_0x6791('0x4d')]=function(_0x2cb48e,_0x10b41b,_0x13089d){return db[_0x6791('0x2a')]['findOne']({'where':{'id':_0x2cb48e['params']['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x10b41b,null))[_0x6791('0x21')](function(_0x56e424){var _0x44b1df;var _0x535ecf={},_0x473443={};_0x473443[_0x6791('0x2f')]=_['keys'](db[_0x6791('0x4e')][_0x6791('0x2b')]);_0x473443[_0x6791('0x31')]=_['keys'](_0x2cb48e[_0x6791('0x31')]);_0x473443[_0x6791('0x32')]=_[_0x6791('0x33')](_0x473443[_0x6791('0x2f')],_0x473443[_0x6791('0x31')]);_0x535ecf['attributes']=_['intersection'](_0x473443[_0x6791('0x2f')],qs[_0x6791('0x34')](_0x2cb48e['query'][_0x6791('0x34')]));_0x535ecf[_0x6791('0x36')]=_0x535ecf[_0x6791('0x36')][_0x6791('0x35')]?_0x535ecf[_0x6791('0x36')]:_0x473443[_0x6791('0x2f')];if(!_0x2cb48e[_0x6791('0x31')][_0x6791('0x4f')]('nolimit')){_0x535ecf[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x2cb48e[_0x6791('0x31')][_0x6791('0x1a')]);_0x535ecf['offset']=qs[_0x6791('0x1c')](_0x2cb48e[_0x6791('0x31')][_0x6791('0x1c')]);}_0x535ecf['order']=qs[_0x6791('0x38')](_0x2cb48e[_0x6791('0x31')][_0x6791('0x38')]);_0x535ecf[_0x6791('0x39')]=qs['filters'](_[_0x6791('0x50')](_0x2cb48e[_0x6791('0x31')],_0x473443['filters']));if(_0x2cb48e[_0x6791('0x31')][_0x6791('0x3c')]){_0x535ecf[_0x6791('0x39')]=_[_0x6791('0x3a')](_0x535ecf[_0x6791('0x39')],{'$or':_[_0x6791('0x29')](_0x535ecf['attributes'],function(_0x301f2f){var _0x33caf0={};_0x33caf0[_0x301f2f]={'$like':'%'+_0x2cb48e[_0x6791('0x31')]['filter']+'%'};return _0x33caf0;})});}_0x535ecf[_0x6791('0x39')]=_['merge'](_0x535ecf[_0x6791('0x39')],{'mailboxuser':_0x56e424[_0x6791('0x51')]});_0x535ecf=_[_0x6791('0x3a')]({},_0x535ecf,_0x2cb48e[_0x6791('0x3d')]);return db[_0x6791('0x4e')]['findAndCountAll'](_0x535ecf)[_0x6791('0x21')](respondWithFilteredResult(_0x10b41b,_0x535ecf));})[_0x6791('0x41')](handleError(_0x10b41b,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7796749..0c83d30 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 _0x55bd=['moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api'];(function(_0x4089c7,_0x120195){var _0x33dd04=function(_0x4e4fea){while(--_0x4e4fea){_0x4089c7['push'](_0x4089c7['shift']());}};_0x33dd04(++_0x120195);}(_0x55bd,0xdc));var _0xd55b=function(_0x1badb1,_0x375ec6){_0x1badb1=_0x1badb1-0x0;var _0x260dae=_0x55bd[_0x1badb1];return _0x260dae;};'use strict';var _=require(_0xd55b('0x0'));var util=require(_0xd55b('0x1'));var logger=require(_0xd55b('0x2'))(_0xd55b('0x3'));var moment=require(_0xd55b('0x4'));var BPromise=require(_0xd55b('0x5'));var rp=require(_0xd55b('0x6'));var fs=require('fs');var path=require(_0xd55b('0x7'));var rimraf=require(_0xd55b('0x8'));var config=require('../../config/environment');var attributes=require(_0xd55b('0x9'));module[_0xd55b('0xa')]=function(_0x14d554,_0x1af80d){return _0x14d554[_0xd55b('0xb')](_0xd55b('0xc'),attributes,{'tableName':_0xd55b('0xd'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xd55b('0xe'),_0xd55b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9bb7=['../../config/logger','api','moment','request-promise','path','exports','define','VoiceMail','voice_voicemail','context','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bb7,0x1ae));var _0x79bb=function(_0x2cbec0,_0x262fef){_0x2cbec0=_0x2cbec0-0x0;var _0x3d4101=_0x9bb7[_0x2cbec0];return _0x3d4101;};'use strict';var _=require(_0x79bb('0x0'));var util=require(_0x79bb('0x1'));var logger=require(_0x79bb('0x2'))(_0x79bb('0x3'));var moment=require(_0x79bb('0x4'));var BPromise=require('bluebird');var rp=require(_0x79bb('0x5'));var fs=require('fs');var path=require(_0x79bb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x79bb('0x7')]=function(_0xc352e6,_0x4d463f){return _0xc352e6[_0x79bb('0x8')](_0x79bb('0x9'),attributes,{'tableName':_0x79bb('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x79bb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 3cfbafc..7b89e26 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 _0x417b=['code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x4866ef,_0x5193d7){var _0x5b8add=function(_0xe567c){while(--_0xe567c){_0x4866ef['push'](_0x4866ef['shift']());}};_0x5b8add(++_0x5193d7);}(_0x417b,0xb7));var _0xb417=function(_0x14c71a,_0x4afbcd){_0x14c71a=_0x14c71a-0x0;var _0x4f6540=_0x417b[_0x14c71a];return _0x4f6540;};'use strict';var _=require(_0xb417('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb417('0x1'));var rs=require(_0xb417('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb417('0x3'))['db'];var utils=require(_0xb417('0x4'));var logger=require(_0xb417('0x5'))(_0xb417('0x6'));var config=require('../../config/environment');var jayson=require(_0xb417('0x7'));var client=jayson[_0xb417('0x8')][_0xb417('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa76fe5,_0x44a06a,_0x209650){return new BPromise(function(_0x23c5e7,_0x1fac91){return client[_0xb417('0xa')](_0xa76fe5,_0x209650)[_0xb417('0xb')](function(_0x5ed703){logger[_0xb417('0xc')](_0xb417('0xd'),_0x44a06a,_0xb417('0xe'));logger[_0xb417('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x44a06a,_0xb417('0xe'),JSON['stringify'](_0x5ed703));if(_0x5ed703['error']){if(_0x5ed703[_0xb417('0x10')][_0xb417('0x11')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x44a06a,_0x5ed703[_0xb417('0x10')][_0xb417('0x12')]);return _0x1fac91(_0x5ed703['error'][_0xb417('0x12')]);}logger[_0xb417('0x10')](_0xb417('0xd'),_0x44a06a,_0x5ed703[_0xb417('0x10')]['message']);return _0x23c5e7(_0x5ed703[_0xb417('0x10')][_0xb417('0x12')]);}else{logger[_0xb417('0xc')](_0xb417('0xd'),_0x44a06a,_0xb417('0xe'));_0x23c5e7(_0x5ed703['result'][_0xb417('0x12')]);}})[_0xb417('0x13')](function(_0x4c3ef6){logger[_0xb417('0x10')]('VoiceMail,\x20%s,\x20%s',_0x44a06a,_0x4c3ef6);_0x1fac91(_0x4c3ef6);});});} \ No newline at end of file +var _0x82b5=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x18312e,_0x4c8146){var _0x4a5527=function(_0x3d512d){while(--_0x3d512d){_0x18312e['push'](_0x18312e['shift']());}};_0x4a5527(++_0x4c8146);}(_0x82b5,0x149));var _0x582b=function(_0x278d3c,_0x432df7){_0x278d3c=_0x278d3c-0x0;var _0x381b70=_0x82b5[_0x278d3c];return _0x381b70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x582b('0x0'));var BPromise=require(_0x582b('0x1'));var rs=require(_0x582b('0x2'));var fs=require('fs');var Redis=require(_0x582b('0x3'));var db=require(_0x582b('0x4'))['db'];var utils=require(_0x582b('0x5'));var logger=require(_0x582b('0x6'))(_0x582b('0x7'));var config=require(_0x582b('0x8'));var jayson=require(_0x582b('0x9'));var client=jayson[_0x582b('0xa')][_0x582b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a32,_0x32b047,_0x1a542b){return new BPromise(function(_0x5119d3,_0x1412e9){return client[_0x582b('0xc')](_0x4a32,_0x1a542b)[_0x582b('0xd')](function(_0x3be6df){logger[_0x582b('0xe')](_0x582b('0xf'),_0x32b047,_0x582b('0x10'));logger['debug'](_0x582b('0x11'),_0x32b047,_0x582b('0x10'),JSON['stringify'](_0x3be6df));if(_0x3be6df[_0x582b('0x12')]){if(_0x3be6df[_0x582b('0x12')]['code']===0x1f4){logger[_0x582b('0x12')](_0x582b('0xf'),_0x32b047,_0x3be6df[_0x582b('0x12')][_0x582b('0x13')]);return _0x1412e9(_0x3be6df[_0x582b('0x12')]['message']);}logger[_0x582b('0x12')]('VoiceMail,\x20%s,\x20%s',_0x32b047,_0x3be6df['error'][_0x582b('0x13')]);return _0x5119d3(_0x3be6df[_0x582b('0x12')][_0x582b('0x13')]);}else{logger[_0x582b('0xe')](_0x582b('0xf'),_0x32b047,_0x582b('0x10'));_0x5119d3(_0x3be6df['result']['message']);}})[_0x582b('0x14')](function(_0x4dfa2e){logger[_0x582b('0x12')](_0x582b('0xf'),_0x32b047,_0x4dfa2e);_0x1412e9(_0x4dfa2e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c6f5312..de2835f 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 _0x5d0a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','path'];(function(_0x56e53b,_0x27fa9f){var _0x2ac35c=function(_0x51b9ce){while(--_0x51b9ce){_0x56e53b['push'](_0x56e53b['shift']());}};_0x2ac35c(++_0x27fa9f);}(_0x5d0a,0x155));var _0xa5d0=function(_0x5410f4,_0xfc25c5){_0x5410f4=_0x5410f4-0x0;var _0x3347c2=_0x5d0a[_0x5410f4];return _0x3347c2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa5d0('0x0'));var timeout=require(_0xa5d0('0x1'));var express=require(_0xa5d0('0x2'));var router=express[_0xa5d0('0x3')]();var fs_extra=require(_0xa5d0('0x4'));var auth=require(_0xa5d0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xa5d0('0x6')]('/',auth[_0xa5d0('0x7')](),controller[_0xa5d0('0x8')]);router['get'](_0xa5d0('0x9'),auth[_0xa5d0('0x7')](),controller[_0xa5d0('0xa')]);router[_0xa5d0('0x6')](_0xa5d0('0xb'),auth[_0xa5d0('0x7')](),controller[_0xa5d0('0xc')]);router[_0xa5d0('0xd')]('/',auth['isAuthenticated'](),controller[_0xa5d0('0xe')]);router['put'](_0xa5d0('0x9'),auth[_0xa5d0('0x7')](),controller[_0xa5d0('0xf')]);router[_0xa5d0('0x10')](_0xa5d0('0x9'),auth[_0xa5d0('0x7')](),controller[_0xa5d0('0x11')]);module[_0xa5d0('0x12')]=router; \ No newline at end of file +var _0x70a1=['/:id','show','/:id/download','download','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x4e800a,_0x180a42){var _0x34a328=function(_0x281a65){while(--_0x281a65){_0x4e800a['push'](_0x4e800a['shift']());}};_0x34a328(++_0x180a42);}(_0x70a1,0xec));var _0x170a=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0x70a1[_0x4d7116];return _0x4593dc;};'use strict';var multer=require(_0x170a('0x0'));var util=require(_0x170a('0x1'));var path=require(_0x170a('0x2'));var timeout=require('connect-timeout');var express=require(_0x170a('0x3'));var router=express[_0x170a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x170a('0x5'));var interaction=require(_0x170a('0x6'));var config=require(_0x170a('0x7'));var controller=require(_0x170a('0x8'));router[_0x170a('0x9')]('/',auth[_0x170a('0xa')](),controller['index']);router[_0x170a('0x9')](_0x170a('0xb'),auth[_0x170a('0xa')](),controller[_0x170a('0xc')]);router['get'](_0x170a('0xd'),auth[_0x170a('0xa')](),controller[_0x170a('0xe')]);router[_0x170a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x170a('0xa')](),controller['update']);router[_0x170a('0x10')](_0x170a('0xb'),auth['isAuthenticated'](),controller[_0x170a('0x11')]);module[_0x170a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 18f8bf9..55d7983 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 _0x4ceb=['sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4ceb,0x90));var _0xb4ce=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x4ceb[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0xb4ce('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4ce('0x1')],'get':function(_0x10072b){return this[_0xb4ce('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb4ce('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb4ce('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xb4ce('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xb4ce('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb4ce('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb4ce('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xb4ce('0x5')](_0xb4ce('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xb4ce('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb4ce('0x4')],'defaultValue':''},'stamp':{'type':_0xb4ce('0x7'),'defaultValue':Sequelize['literal'](_0xb4ce('0x8'))}}; \ No newline at end of file +var _0x18fc=['sequelize','INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x18fc,0x14a));var _0xc18f=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x18fc[_0x1d8119];return _0x3e30f6;};'use strict';var Sequelize=require(_0xc18f('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x171074){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xc18f('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc18f('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xc18f('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc18f('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0xc18f('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc18f('0x2')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc18f('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0xc18f('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xc18f('0x4')](_0xc18f('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 18f5255..1b4a35f 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 _0x9e67=['util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','send','map','fieldName','type','key','name','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VoiceMailMessage','include','findAll','rows','show','params','rawAttributes','keys','includeAll','find','catch','create','body','download','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x36fd99,_0x489822){var _0x3db617=function(_0x5af403){while(--_0x5af403){_0x36fd99['push'](_0x36fd99['shift']());}};_0x3db617(++_0x489822);}(_0x9e67,0xa3));var _0x79e6=function(_0x175d7a,_0x4ae54e){_0x175d7a=_0x175d7a-0x0;var _0x5aa1e1=_0x9e67[_0x175d7a];return _0x5aa1e1;};'use strict';var emlformat=require(_0x79e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79e6('0x1'));var jsonpatch=require(_0x79e6('0x2'));var rp=require(_0x79e6('0x3'));var moment=require(_0x79e6('0x4'));var BPromise=require(_0x79e6('0x5'));var Mustache=require(_0x79e6('0x6'));var util=require(_0x79e6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x79e6('0x8'));var ejs=require(_0x79e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79e6('0xa'));var squel=require(_0x79e6('0xb'));var crypto=require(_0x79e6('0xc'));var jsforce=require(_0x79e6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x79e6('0x8'));var querystring=require(_0x79e6('0xe'));var Papa=require(_0x79e6('0xf'));var Redis=require(_0x79e6('0x10'));var authService=require(_0x79e6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x79e6('0x12'));var hardwareService=require(_0x79e6('0x13'));var logger=require(_0x79e6('0x14'))(_0x79e6('0x15'));var utils=require(_0x79e6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x79e6('0x17'));var db=require(_0x79e6('0x18'))['db'];function respondWithStatusCode(_0xf7b9a3,_0x575175){_0x575175=_0x575175||0xcc;return function(_0x142084){if(_0x142084){return _0xf7b9a3['sendStatus'](_0x575175);}return _0xf7b9a3['status'](_0x575175)['end']();};}function respondWithResult(_0x3d98c4,_0x5625d0){_0x5625d0=_0x5625d0||0xc8;return function(_0x5ec997){if(_0x5ec997){return _0x3d98c4[_0x79e6('0x19')](_0x5625d0)[_0x79e6('0x1a')](_0x5ec997);}};}function respondWithFilteredResult(_0x316ad2,_0x2c14e0){return function(_0x5a8be1){if(_0x5a8be1){var _0x25ee1d=typeof _0x2c14e0['offset']===_0x79e6('0x1b')&&typeof _0x2c14e0[_0x79e6('0x1c')]===_0x79e6('0x1b');var _0x484c22=_0x5a8be1['count'];var _0x411875=_0x25ee1d?0x0:_0x2c14e0[_0x79e6('0x1d')];var _0x657a2f=_0x25ee1d?_0x5a8be1[_0x79e6('0x1e')]:_0x2c14e0[_0x79e6('0x1d')]+_0x2c14e0[_0x79e6('0x1c')];var _0x12a07f;if(_0x657a2f>=_0x484c22){_0x657a2f=_0x484c22;_0x12a07f=0xc8;}else{_0x12a07f=0xce;}_0x316ad2[_0x79e6('0x19')](_0x12a07f);return _0x316ad2['set'](_0x79e6('0x1f'),_0x411875+'-'+_0x657a2f+'/'+_0x484c22)[_0x79e6('0x1a')](_0x5a8be1);}return null;};}function patchUpdates(_0x462004){return function(_0x2e71ab){try{jsonpatch[_0x79e6('0x20')](_0x2e71ab,_0x462004,!![]);}catch(_0x5b81ee){return BPromise['reject'](_0x5b81ee);}return _0x2e71ab[_0x79e6('0x21')]();};}function saveUpdates(_0x14f7a3,_0x4d20e2){return function(_0xd922c9){if(_0xd922c9){return _0xd922c9[_0x79e6('0x22')](_0x14f7a3)[_0x79e6('0x23')](function(_0xfb7f54){return _0xfb7f54;});}return null;};}function removeEntity(_0x5750e4,_0x4b0131){return function(_0x274616){if(_0x274616){return _0x274616[_0x79e6('0x24')]()['then'](function(){_0x5750e4['status'](0xcc)[_0x79e6('0x25')]();});}};}function handleEntityNotFound(_0x2c4ac8,_0x564b76){return function(_0x49c34a){if(!_0x49c34a){_0x2c4ac8[_0x79e6('0x26')](0x194);}return _0x49c34a;};}function handleError(_0x2b3276,_0x336a12){_0x336a12=_0x336a12||0x1f4;return function(_0xe706b5){logger[_0x79e6('0x27')](_0xe706b5[_0x79e6('0x28')]);if(_0xe706b5['name']){delete _0xe706b5['name'];}_0x2b3276[_0x79e6('0x19')](_0x336a12)[_0x79e6('0x29')](_0xe706b5);};}exports['index']=function(_0x21fbd5,_0x5cd7f7){var _0x52ffbc={},_0x24461e={},_0x54c2e0={'count':0x0,'rows':[]};var _0x4996bd=_[_0x79e6('0x2a')](db['VoiceMailMessage']['rawAttributes'],function(_0xedc9a7){return{'name':_0xedc9a7[_0x79e6('0x2b')],'type':_0xedc9a7[_0x79e6('0x2c')][_0x79e6('0x2d')]};});_0x24461e['model']=_['differenceBy'](_[_0x79e6('0x2a')](_0x4996bd,_0x79e6('0x2e')),[_0x79e6('0x2e')]);_0x24461e[_0x79e6('0x2f')]=_['keys'](_0x21fbd5['query']);_0x24461e['filters']=_[_0x79e6('0x30')](_0x24461e[_0x79e6('0x31')],_0x24461e[_0x79e6('0x2f')]);_0x52ffbc['attributes']=_[_0x79e6('0x30')](_0x24461e[_0x79e6('0x31')],qs[_0x79e6('0x32')](_0x21fbd5['query']['fields']));_0x52ffbc[_0x79e6('0x33')]=_0x52ffbc[_0x79e6('0x33')][_0x79e6('0x34')]?_0x52ffbc[_0x79e6('0x33')]:_0x24461e[_0x79e6('0x31')];if(!_0x21fbd5['query'][_0x79e6('0x35')](_0x79e6('0x36'))){_0x52ffbc[_0x79e6('0x1c')]=qs['limit'](_0x21fbd5[_0x79e6('0x2f')][_0x79e6('0x1c')]);_0x52ffbc[_0x79e6('0x1d')]=qs['offset'](_0x21fbd5[_0x79e6('0x2f')][_0x79e6('0x1d')]);}_0x52ffbc[_0x79e6('0x37')]=qs[_0x79e6('0x38')](_0x21fbd5['query'][_0x79e6('0x38')]);_0x52ffbc['where']=qs[_0x79e6('0x39')](_[_0x79e6('0x3a')](_0x21fbd5[_0x79e6('0x2f')],_0x24461e[_0x79e6('0x39')]),_0x4996bd);if(_0x21fbd5[_0x79e6('0x2f')][_0x79e6('0x3b')]){_0x52ffbc[_0x79e6('0x3c')]=_[_0x79e6('0x3d')](_0x52ffbc[_0x79e6('0x3c')],{'$or':_[_0x79e6('0x2a')](_0x4996bd,function(_0x51e678){if(_0x51e678[_0x79e6('0x2c')]!==_0x79e6('0x3e')){var _0xc0ec5b={};_0xc0ec5b[_0x51e678[_0x79e6('0x2e')]]={'$like':'%'+_0x21fbd5[_0x79e6('0x2f')][_0x79e6('0x3b')]+'%'};return _0xc0ec5b;}})});}_0x52ffbc=_['merge']({},_0x52ffbc,_0x21fbd5[_0x79e6('0x3f')]);var _0x6b65e0={'where':_0x52ffbc['where']};return db[_0x79e6('0x40')][_0x79e6('0x1e')](_0x6b65e0)['then'](function(_0x50307b){_0x54c2e0[_0x79e6('0x1e')]=_0x50307b;if(_0x21fbd5['query']['includeAll']){_0x52ffbc[_0x79e6('0x41')]=[{'all':!![]}];}return db[_0x79e6('0x40')][_0x79e6('0x42')](_0x52ffbc);})[_0x79e6('0x23')](function(_0x28ae21){_0x54c2e0[_0x79e6('0x43')]=_0x28ae21;return _0x54c2e0;})[_0x79e6('0x23')](respondWithFilteredResult(_0x5cd7f7,_0x52ffbc))['catch'](handleError(_0x5cd7f7,null));};exports[_0x79e6('0x44')]=function(_0x1b533e,_0xbee73e){var _0x180ed7={'raw':!![],'where':{'id':_0x1b533e[_0x79e6('0x45')]['id']}},_0x22d082={};_0x22d082['model']=_['keys'](db[_0x79e6('0x40')][_0x79e6('0x46')]);_0x22d082['query']=_[_0x79e6('0x47')](_0x1b533e[_0x79e6('0x2f')]);_0x22d082[_0x79e6('0x39')]=_[_0x79e6('0x30')](_0x22d082[_0x79e6('0x31')],_0x22d082[_0x79e6('0x2f')]);_0x180ed7['attributes']=_[_0x79e6('0x30')](_0x22d082[_0x79e6('0x31')],qs['fields'](_0x1b533e['query'][_0x79e6('0x32')]));_0x180ed7['attributes']=_0x180ed7[_0x79e6('0x33')][_0x79e6('0x34')]?_0x180ed7['attributes']:_0x22d082['model'];if(_0x1b533e['query'][_0x79e6('0x48')]){_0x180ed7[_0x79e6('0x41')]=[{'all':!![]}];}_0x180ed7=_[_0x79e6('0x3d')]({},_0x180ed7,_0x1b533e[_0x79e6('0x3f')]);return db['VoiceMailMessage'][_0x79e6('0x49')](_0x180ed7)['then'](handleEntityNotFound(_0xbee73e,null))[_0x79e6('0x23')](respondWithResult(_0xbee73e,null))[_0x79e6('0x4a')](handleError(_0xbee73e,null));};exports[_0x79e6('0x4b')]=function(_0x1e10ce,_0x5ca769){return db['VoiceMailMessage'][_0x79e6('0x4b')](_0x1e10ce[_0x79e6('0x4c')],{})[_0x79e6('0x23')](respondWithResult(_0x5ca769,0xc9))['catch'](handleError(_0x5ca769,null));};exports[_0x79e6('0x22')]=function(_0xb400f8,_0x51ad74){if(_0xb400f8['body']['id']){delete _0xb400f8['body']['id'];}return db[_0x79e6('0x40')]['find']({'where':{'id':_0xb400f8[_0x79e6('0x45')]['id']}})[_0x79e6('0x23')](handleEntityNotFound(_0x51ad74,null))[_0x79e6('0x23')](saveUpdates(_0xb400f8['body'],null))['then'](respondWithResult(_0x51ad74,null))[_0x79e6('0x4a')](handleError(_0x51ad74,null));};exports[_0x79e6('0x24')]=function(_0x5d40b2,_0x20f302){return db[_0x79e6('0x40')][_0x79e6('0x49')]({'where':{'id':_0x5d40b2[_0x79e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x20f302,null))['then'](removeEntity(_0x20f302,null))['catch'](handleError(_0x20f302,null));};exports[_0x79e6('0x4d')]=function(_0x1f2738,_0x2c4b3d,_0x4b1ee0){return db[_0x79e6('0x40')][_0x79e6('0x49')]({'where':{'id':_0x1f2738[_0x79e6('0x45')]['id']},'attributes':['id',_0x79e6('0x4e'),_0x79e6('0x4f')]})[_0x79e6('0x23')](handleEntityNotFound(_0x2c4b3d,null))[_0x79e6('0x23')](function(_0x2cecad){if(_0x2cecad){if(!_0x2cecad['recording']){throw new db['Sequelize'][(_0x79e6('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x1f8de5={'Content-Type':_0x79e6('0x51'),'Content-Disposition':_0x79e6('0x52')};if(_0x2cecad['msg_id']){_0x1f8de5[_0x79e6('0x53')]='attachment;\x20filename=\x22'+_0x2cecad[_0x79e6('0x4f')]+_0x79e6('0x54');}_0x2c4b3d['set'](_0x1f8de5);return _0x2c4b3d[_0x79e6('0x29')](new Buffer(_0x2cecad[_0x79e6('0x4e')]));}})[_0x79e6('0x4a')](handleError(_0x2c4b3d,null));}; \ No newline at end of file +var _0x5a71=['find','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','set','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','sendStatus','error','stack','name','index','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','keys','intersection','model','fields','attributes','length','where','filters','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0x5a71,0x147));var _0x15a7=function(_0x4a9bbf,_0x36fbf3){_0x4a9bbf=_0x4a9bbf-0x0;var _0x37a005=_0x5a71[_0x4a9bbf];return _0x37a005;};'use strict';var emlformat=require(_0x15a7('0x0'));var rimraf=require(_0x15a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15a7('0x2'));var rp=require(_0x15a7('0x3'));var moment=require(_0x15a7('0x4'));var BPromise=require(_0x15a7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x15a7('0x6'));var sox=require(_0x15a7('0x7'));var csv=require(_0x15a7('0x8'));var ejs=require(_0x15a7('0x9'));var fs=require('fs');var fs_extra=require(_0x15a7('0xa'));var _=require('lodash');var squel=require(_0x15a7('0xb'));var crypto=require('crypto');var jsforce=require(_0x15a7('0xc'));var deskjs=require(_0x15a7('0xd'));var toCsv=require(_0x15a7('0x8'));var querystring=require('querystring');var Papa=require(_0x15a7('0xe'));var Redis=require(_0x15a7('0xf'));var authService=require(_0x15a7('0x10'));var qs=require(_0x15a7('0x11'));var as=require(_0x15a7('0x12'));var hardwareService=require(_0x15a7('0x13'));var logger=require('../../config/logger')(_0x15a7('0x14'));var utils=require('../../config/utils');var config=require(_0x15a7('0x15'));var licenseUtil=require(_0x15a7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f1e85,_0xd3c6c3){_0xd3c6c3=_0xd3c6c3||0xcc;return function(_0xdbe957){if(_0xdbe957){return _0x2f1e85['sendStatus'](_0xd3c6c3);}return _0x2f1e85[_0x15a7('0x17')](_0xd3c6c3)[_0x15a7('0x18')]();};}function respondWithResult(_0x4d59b1,_0x35c5f5){_0x35c5f5=_0x35c5f5||0xc8;return function(_0x2018c5){if(_0x2018c5){return _0x4d59b1['status'](_0x35c5f5)[_0x15a7('0x19')](_0x2018c5);}};}function respondWithFilteredResult(_0x2716b6,_0x3fe69f){return function(_0x57caa8){if(_0x57caa8){var _0x4c1160=typeof _0x3fe69f[_0x15a7('0x1a')]===_0x15a7('0x1b')&&typeof _0x3fe69f[_0x15a7('0x1c')]===_0x15a7('0x1b');var _0xe80a9f=_0x57caa8['count'];var _0x40fa89=_0x4c1160?0x0:_0x3fe69f[_0x15a7('0x1a')];var _0x1688b4=_0x4c1160?_0x57caa8[_0x15a7('0x1d')]:_0x3fe69f[_0x15a7('0x1a')]+_0x3fe69f['limit'];var _0x2f0f9a;if(_0x1688b4>=_0xe80a9f){_0x1688b4=_0xe80a9f;_0x2f0f9a=0xc8;}else{_0x2f0f9a=0xce;}_0x2716b6[_0x15a7('0x17')](_0x2f0f9a);return _0x2716b6['set']('Content-Range',_0x40fa89+'-'+_0x1688b4+'/'+_0xe80a9f)[_0x15a7('0x19')](_0x57caa8);}return null;};}function patchUpdates(_0x2ad5b3){return function(_0x55c4da){try{jsonpatch[_0x15a7('0x1e')](_0x55c4da,_0x2ad5b3,!![]);}catch(_0x4f6de2){return BPromise['reject'](_0x4f6de2);}return _0x55c4da[_0x15a7('0x1f')]();};}function saveUpdates(_0x2e9530,_0x38df6d){return function(_0x4b06e4){if(_0x4b06e4){return _0x4b06e4[_0x15a7('0x20')](_0x2e9530)[_0x15a7('0x21')](function(_0x4ac99c){return _0x4ac99c;});}return null;};}function removeEntity(_0x41e381,_0x533fc3){return function(_0x22705f){if(_0x22705f){return _0x22705f[_0x15a7('0x22')]()[_0x15a7('0x21')](function(){_0x41e381[_0x15a7('0x17')](0xcc)[_0x15a7('0x18')]();});}};}function handleEntityNotFound(_0x3aa618,_0x7820d7){return function(_0x505dba){if(!_0x505dba){_0x3aa618[_0x15a7('0x23')](0x194);}return _0x505dba;};}function handleError(_0x269597,_0x41fb23){_0x41fb23=_0x41fb23||0x1f4;return function(_0xc5b7e8){logger[_0x15a7('0x24')](_0xc5b7e8[_0x15a7('0x25')]);if(_0xc5b7e8['name']){delete _0xc5b7e8[_0x15a7('0x26')];}_0x269597[_0x15a7('0x17')](_0x41fb23)['send'](_0xc5b7e8);};}exports[_0x15a7('0x27')]=function(_0x4b7e03,_0x1c6135){var _0x23904a={},_0x5f0ad8={},_0x51ec84={'count':0x0,'rows':[]};var _0x524e19=_['map'](db[_0x15a7('0x28')][_0x15a7('0x29')],function(_0x430b57){return{'name':_0x430b57[_0x15a7('0x2a')],'type':_0x430b57[_0x15a7('0x2b')][_0x15a7('0x2c')]};});_0x5f0ad8['model']=_[_0x15a7('0x2d')](_['map'](_0x524e19,_0x15a7('0x26')),[_0x15a7('0x26')]);_0x5f0ad8[_0x15a7('0x2e')]=_[_0x15a7('0x2f')](_0x4b7e03['query']);_0x5f0ad8['filters']=_[_0x15a7('0x30')](_0x5f0ad8[_0x15a7('0x31')],_0x5f0ad8['query']);_0x23904a['attributes']=_[_0x15a7('0x30')](_0x5f0ad8['model'],qs['fields'](_0x4b7e03['query'][_0x15a7('0x32')]));_0x23904a['attributes']=_0x23904a[_0x15a7('0x33')][_0x15a7('0x34')]?_0x23904a[_0x15a7('0x33')]:_0x5f0ad8[_0x15a7('0x31')];if(!_0x4b7e03['query']['hasOwnProperty']('nolimit')){_0x23904a[_0x15a7('0x1c')]=qs[_0x15a7('0x1c')](_0x4b7e03[_0x15a7('0x2e')][_0x15a7('0x1c')]);_0x23904a[_0x15a7('0x1a')]=qs[_0x15a7('0x1a')](_0x4b7e03[_0x15a7('0x2e')]['offset']);}_0x23904a['order']=qs['sort'](_0x4b7e03[_0x15a7('0x2e')]['sort']);_0x23904a[_0x15a7('0x35')]=qs[_0x15a7('0x36')](_['pick'](_0x4b7e03[_0x15a7('0x2e')],_0x5f0ad8['filters']),_0x524e19);if(_0x4b7e03['query'][_0x15a7('0x37')]){_0x23904a[_0x15a7('0x35')]=_[_0x15a7('0x38')](_0x23904a['where'],{'$or':_[_0x15a7('0x39')](_0x524e19,function(_0xcb22a1){if(_0xcb22a1['type']!==_0x15a7('0x3a')){var _0x17772f={};_0x17772f[_0xcb22a1[_0x15a7('0x26')]]={'$like':'%'+_0x4b7e03[_0x15a7('0x2e')][_0x15a7('0x37')]+'%'};return _0x17772f;}})});}_0x23904a=_[_0x15a7('0x38')]({},_0x23904a,_0x4b7e03['options']);var _0x10bbe7={'where':_0x23904a[_0x15a7('0x35')]};return db['VoiceMailMessage']['count'](_0x10bbe7)[_0x15a7('0x21')](function(_0x52a1da){_0x51ec84[_0x15a7('0x1d')]=_0x52a1da;if(_0x4b7e03['query'][_0x15a7('0x3b')]){_0x23904a[_0x15a7('0x3c')]=[{'all':!![]}];}return db[_0x15a7('0x28')][_0x15a7('0x3d')](_0x23904a);})[_0x15a7('0x21')](function(_0x2b4f23){_0x51ec84['rows']=_0x2b4f23;return _0x51ec84;})[_0x15a7('0x21')](respondWithFilteredResult(_0x1c6135,_0x23904a))[_0x15a7('0x3e')](handleError(_0x1c6135,null));};exports[_0x15a7('0x3f')]=function(_0x3be719,_0x11e5ba){var _0x42f9d6={'raw':!![],'where':{'id':_0x3be719[_0x15a7('0x40')]['id']}},_0x552fed={};_0x552fed[_0x15a7('0x31')]=_[_0x15a7('0x2f')](db['VoiceMailMessage']['rawAttributes']);_0x552fed[_0x15a7('0x2e')]=_[_0x15a7('0x2f')](_0x3be719['query']);_0x552fed[_0x15a7('0x36')]=_[_0x15a7('0x30')](_0x552fed['model'],_0x552fed[_0x15a7('0x2e')]);_0x42f9d6['attributes']=_['intersection'](_0x552fed[_0x15a7('0x31')],qs[_0x15a7('0x32')](_0x3be719[_0x15a7('0x2e')][_0x15a7('0x32')]));_0x42f9d6[_0x15a7('0x33')]=_0x42f9d6[_0x15a7('0x33')][_0x15a7('0x34')]?_0x42f9d6[_0x15a7('0x33')]:_0x552fed[_0x15a7('0x31')];if(_0x3be719[_0x15a7('0x2e')]['includeAll']){_0x42f9d6[_0x15a7('0x3c')]=[{'all':!![]}];}_0x42f9d6=_[_0x15a7('0x38')]({},_0x42f9d6,_0x3be719[_0x15a7('0x41')]);return db[_0x15a7('0x28')]['find'](_0x42f9d6)[_0x15a7('0x21')](handleEntityNotFound(_0x11e5ba,null))[_0x15a7('0x21')](respondWithResult(_0x11e5ba,null))['catch'](handleError(_0x11e5ba,null));};exports['create']=function(_0x345712,_0x581d79){return db[_0x15a7('0x28')][_0x15a7('0x42')](_0x345712['body'],{})['then'](respondWithResult(_0x581d79,0xc9))[_0x15a7('0x3e')](handleError(_0x581d79,null));};exports[_0x15a7('0x20')]=function(_0x442adc,_0x5e7d17){if(_0x442adc[_0x15a7('0x43')]['id']){delete _0x442adc['body']['id'];}return db[_0x15a7('0x28')][_0x15a7('0x44')]({'where':{'id':_0x442adc[_0x15a7('0x40')]['id']}})[_0x15a7('0x21')](handleEntityNotFound(_0x5e7d17,null))['then'](saveUpdates(_0x442adc['body'],null))['then'](respondWithResult(_0x5e7d17,null))[_0x15a7('0x3e')](handleError(_0x5e7d17,null));};exports[_0x15a7('0x22')]=function(_0xe32bd9,_0x416a33){return db[_0x15a7('0x28')][_0x15a7('0x44')]({'where':{'id':_0xe32bd9[_0x15a7('0x40')]['id']}})[_0x15a7('0x21')](handleEntityNotFound(_0x416a33,null))[_0x15a7('0x21')](removeEntity(_0x416a33,null))[_0x15a7('0x3e')](handleError(_0x416a33,null));};exports[_0x15a7('0x45')]=function(_0x582d30,_0x3fd43b,_0x47878e){return db[_0x15a7('0x28')][_0x15a7('0x44')]({'where':{'id':_0x582d30[_0x15a7('0x40')]['id']},'attributes':['id','recording',_0x15a7('0x46')]})[_0x15a7('0x21')](handleEntityNotFound(_0x3fd43b,null))[_0x15a7('0x21')](function(_0x46b7a2){if(_0x46b7a2){if(!_0x46b7a2[_0x15a7('0x47')]){throw new db[(_0x15a7('0x48'))][(_0x15a7('0x49'))](_0x15a7('0x4a'));}var _0x4e8850={'Content-Type':_0x15a7('0x4b'),'Content-Disposition':_0x15a7('0x4c')};if(_0x46b7a2['msg_id']){_0x4e8850[_0x15a7('0x4d')]='attachment;\x20filename=\x22'+_0x46b7a2[_0x15a7('0x46')]+'.wav\x22';}_0x3fd43b[_0x15a7('0x4e')](_0x4e8850);return _0x3fd43b['send'](new Buffer(_0x46b7a2['recording']));}})[_0x15a7('0x3e')](handleError(_0x3fd43b,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 18f6a60..b43ef01 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 _0x4e25=['api','moment','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0x730fe6,_0x24d742){var _0x46c9cb=function(_0x6340a6){while(--_0x6340a6){_0x730fe6['push'](_0x730fe6['shift']());}};_0x46c9cb(++_0x24d742);}(_0x4e25,0x17e));var _0x54e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4e25[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x54e2('0x0'));var logger=require(_0x54e2('0x1'))(_0x54e2('0x2'));var moment=require(_0x54e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x54e2('0x4'));var fs=require('fs');var path=require(_0x54e2('0x5'));var rimraf=require(_0x54e2('0x6'));var config=require('../../config/environment');var attributes=require(_0x54e2('0x7'));module[_0x54e2('0x8')]=function(_0x1430d2,_0x197e9a){return _0x1430d2[_0x54e2('0x9')]('VoiceMailMessage',attributes,{'tableName':_0x54e2('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x54e2('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9e7b=['voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceMailMessage'];(function(_0x516eb0,_0x256118){var _0x26eb1c=function(_0x1af484){while(--_0x1af484){_0x516eb0['push'](_0x516eb0['shift']());}};_0x26eb1c(++_0x256118);}(_0x9e7b,0x1c9));var _0xb9e7=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x9e7b[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xb9e7('0x0'));var util=require('util');var logger=require(_0xb9e7('0x1'))(_0xb9e7('0x2'));var moment=require(_0xb9e7('0x3'));var BPromise=require(_0xb9e7('0x4'));var rp=require(_0xb9e7('0x5'));var fs=require('fs');var path=require(_0xb9e7('0x6'));var rimraf=require(_0xb9e7('0x7'));var config=require(_0xb9e7('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xb9e7('0x9')]=function(_0x174c43,_0x17fffb){return _0x174c43['define'](_0xb9e7('0xa'),attributes,{'tableName':_0xb9e7('0xb'),'paranoid':![],'indexes':[{'name':_0xb9e7('0xc'),'fields':[_0xb9e7('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 9381cab..a35f27e 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 _0x0237=['VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x47546a,_0x3601f3){var _0x9eaf97=function(_0x2eae79){while(--_0x2eae79){_0x47546a['push'](_0x47546a['shift']());}};_0x9eaf97(++_0x3601f3);}(_0x0237,0x110));var _0x7023=function(_0x4cdc00,_0x239a67){_0x4cdc00=_0x4cdc00-0x0;var _0x33de35=_0x0237[_0x4cdc00];return _0x33de35;};'use strict';var _=require('lodash');var util=require(_0x7023('0x0'));var moment=require(_0x7023('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7023('0x2'));var db=require(_0x7023('0x3'))['db'];var utils=require(_0x7023('0x4'));var logger=require(_0x7023('0x5'))(_0x7023('0x6'));var config=require(_0x7023('0x7'));var jayson=require(_0x7023('0x8'));var client=jayson[_0x7023('0x9')][_0x7023('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3b6c,_0x1ad61b,_0x35aae3){return new BPromise(function(_0x1ed021,_0xe5a8c){return client[_0x7023('0xb')](_0x3a3b6c,_0x35aae3)[_0x7023('0xc')](function(_0x59ff81){logger[_0x7023('0xd')](_0x7023('0xe'),_0x1ad61b,'request\x20sent');logger[_0x7023('0xf')](_0x7023('0x10'),_0x1ad61b,'request\x20sent',JSON['stringify'](_0x59ff81));if(_0x59ff81[_0x7023('0x11')]){if(_0x59ff81[_0x7023('0x11')][_0x7023('0x12')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1ad61b,_0x59ff81[_0x7023('0x11')][_0x7023('0x13')]);return _0xe5a8c(_0x59ff81['error'][_0x7023('0x13')]);}logger['error'](_0x7023('0xe'),_0x1ad61b,_0x59ff81['error'][_0x7023('0x13')]);return _0x1ed021(_0x59ff81[_0x7023('0x11')][_0x7023('0x13')]);}else{logger[_0x7023('0xd')](_0x7023('0xe'),_0x1ad61b,_0x7023('0x14'));_0x1ed021(_0x59ff81['result'][_0x7023('0x13')]);}})[_0x7023('0x15')](function(_0x20331c){logger[_0x7023('0x11')](_0x7023('0xe'),_0x1ad61b,_0x20331c);_0xe5a8c(_0x20331c);});});} \ No newline at end of file +var _0xf16d=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf16d,0x10a));var _0xdf16=function(_0x18e843,_0x39ed27){_0x18e843=_0x18e843-0x0;var _0x1ac063=_0xf16d[_0x18e843];return _0x1ac063;};'use strict';var _=require(_0xdf16('0x0'));var util=require(_0xdf16('0x1'));var moment=require(_0xdf16('0x2'));var BPromise=require(_0xdf16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf16('0x4'));var db=require(_0xdf16('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf16('0x6'))(_0xdf16('0x7'));var config=require(_0xdf16('0x8'));var jayson=require(_0xdf16('0x9'));var client=jayson[_0xdf16('0xa')][_0xdf16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d9a57,_0x3fc82a,_0xfa5d07){return new BPromise(function(_0x200222,_0x375a18){return client[_0xdf16('0xc')](_0x1d9a57,_0xfa5d07)[_0xdf16('0xd')](function(_0x521dc2){logger['info'](_0xdf16('0xe'),_0x3fc82a,_0xdf16('0xf'));logger[_0xdf16('0x10')](_0xdf16('0x11'),_0x3fc82a,_0xdf16('0xf'),JSON[_0xdf16('0x12')](_0x521dc2));if(_0x521dc2['error']){if(_0x521dc2[_0xdf16('0x13')][_0xdf16('0x14')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x3fc82a,_0x521dc2[_0xdf16('0x13')]['message']);return _0x375a18(_0x521dc2['error'][_0xdf16('0x15')]);}logger[_0xdf16('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x3fc82a,_0x521dc2[_0xdf16('0x13')][_0xdf16('0x15')]);return _0x200222(_0x521dc2[_0xdf16('0x13')][_0xdf16('0x15')]);}else{logger['info'](_0xdf16('0xe'),_0x3fc82a,_0xdf16('0xf'));_0x200222(_0x521dc2[_0xdf16('0x16')]['message']);}})[_0xdf16('0x17')](function(_0x2b6b52){logger[_0xdf16('0x13')](_0xdf16('0xe'),_0x3fc82a,_0x2b6b52);_0x375a18(_0x2b6b52);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6d1c4ee..3d20ddf 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 _0x4ce2=['post','addSound','put','delete','destroy','removeSound','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds'];(function(_0x3a3668,_0x45707d){var _0x2d1f7a=function(_0x341aca){while(--_0x341aca){_0x3a3668['push'](_0x3a3668['shift']());}};_0x2d1f7a(++_0x45707d);}(_0x4ce2,0xd7));var _0x24ce=function(_0x480474,_0xc810cd){_0x480474=_0x480474-0x0;var _0x56c3e5=_0x4ce2[_0x480474];return _0x56c3e5;};'use strict';var multer=require(_0x24ce('0x0'));var util=require('util');var path=require(_0x24ce('0x1'));var timeout=require(_0x24ce('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x24ce('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x24ce('0x4'));var config=require(_0x24ce('0x5'));var controller=require(_0x24ce('0x6'));router[_0x24ce('0x7')]('/',auth[_0x24ce('0x8')](),controller[_0x24ce('0x9')]);router[_0x24ce('0x7')](_0x24ce('0xa'),auth[_0x24ce('0x8')](),controller['show']);router[_0x24ce('0x7')](_0x24ce('0xb'),auth['isAuthenticated'](),controller[_0x24ce('0xc')]);router[_0x24ce('0xd')]('/',auth[_0x24ce('0x8')](),controller['create']);router[_0x24ce('0xd')](_0x24ce('0xb'),auth[_0x24ce('0x8')](),controller[_0x24ce('0xe')]);router[_0x24ce('0xf')](_0x24ce('0xa'),auth[_0x24ce('0x8')](),controller['update']);router[_0x24ce('0x10')](_0x24ce('0xa'),auth[_0x24ce('0x8')](),controller[_0x24ce('0x11')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x24ce('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3169=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post','create','put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','util','connect-timeout'];(function(_0x4ae419,_0x15318c){var _0xa01a18=function(_0x564711){while(--_0x564711){_0x4ae419['push'](_0x4ae419['shift']());}};_0xa01a18(++_0x15318c);}(_0x3169,0x16e));var _0x9316=function(_0x16438a,_0x3544be){_0x16438a=_0x16438a-0x0;var _0x9d2e74=_0x3169[_0x16438a];return _0x9d2e74;};'use strict';var multer=require('multer');var util=require(_0x9316('0x0'));var path=require('path');var timeout=require(_0x9316('0x1'));var express=require(_0x9316('0x2'));var router=express[_0x9316('0x3')]();var fs_extra=require(_0x9316('0x4'));var auth=require(_0x9316('0x5'));var interaction=require(_0x9316('0x6'));var config=require(_0x9316('0x7'));var controller=require(_0x9316('0x8'));router[_0x9316('0x9')]('/',auth[_0x9316('0xa')](),controller[_0x9316('0xb')]);router[_0x9316('0x9')](_0x9316('0xc'),auth[_0x9316('0xa')](),controller['show']);router[_0x9316('0x9')](_0x9316('0xd'),auth['isAuthenticated'](),controller['getSounds']);router[_0x9316('0xe')]('/',auth[_0x9316('0xa')](),controller[_0x9316('0xf')]);router[_0x9316('0xe')](_0x9316('0xd'),auth[_0x9316('0xa')](),controller['addSound']);router[_0x9316('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9316('0x11')]);router['delete'](_0x9316('0xc'),auth[_0x9316('0xa')](),controller[_0x9316('0x12')]);router[_0x9316('0x13')](_0x9316('0x14'),auth['isAuthenticated'](),controller[_0x9316('0x15')]);module[_0x9316('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c881726..a1e0589 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 _0xf1cf=['files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom','mp3nb','quietmp3nb','quietmp3'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xf1cf,0x184));var _0xff1c=function(_0x5b6d73,_0x9fe695){_0x5b6d73=_0x5b6d73-0x0;var _0x4fce56=_0xf1cf[_0x5b6d73];return _0x4fce56;};'use strict';var Sequelize=require(_0xff1c('0x0'));module[_0xff1c('0x1')]={'name':{'type':Sequelize[_0xff1c('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xff1c('0x3')](_0xff1c('0x4'),'files',_0xff1c('0x5'),_0xff1c('0x6'),_0xff1c('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xff1c('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xff1c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xff1c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xff1c('0x2')],'allowNull':!![],'defaultValue':_0xff1c('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xff1c('0xa')},'defaultEntry':{'type':Sequelize[_0xff1c('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x659c=['name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','files','STRING','alpha','TIMESTAMP','BOOLEAN','exports'];(function(_0x2ed3d8,_0x4aa8e3){var _0x12fac4=function(_0xe4fa39){while(--_0xe4fa39){_0x2ed3d8['push'](_0x2ed3d8['shift']());}};_0x12fac4(++_0x4aa8e3);}(_0x659c,0x6b));var _0xc659=function(_0x55daed,_0x892a6d){_0x55daed=_0x55daed-0x0;var _0x5d5451=_0x659c[_0x55daed];return _0x5d5451;};'use strict';var Sequelize=require('sequelize');module[_0xc659('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc659('0x1')},'mode':{'type':Sequelize[_0xc659('0x2')](_0xc659('0x3'),'files',_0xc659('0x4'),_0xc659('0x5'),_0xc659('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0xc659('0x7')},'directory':{'type':Sequelize[_0xc659('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0xc659('0x8')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xc659('0x8')],'allowNull':!![],'defaultValue':_0xc659('0x9')},'format':{'type':Sequelize[_0xc659('0x8')],'allowNull':!![]},'stamp':{'type':_0xc659('0xa')},'defaultEntry':{'type':Sequelize[_0xc659('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 72e477b..5d8ab7d 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 _0x6edb=['files','mkdirSync','0777','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','%s.%s','basename','extname','server/files/moh','format','symlinkSync','message','id2','createdAt','getSounds','order','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','get','MusicOnHolds','then','sendStatus','error','name','send','index','fieldName','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','pick','filter','merge','where','map','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','find','sequelize','mode','directory','root','create'];(function(_0x1b4960,_0x478b50){var _0x499b69=function(_0x5e7b75){while(--_0x5e7b75){_0x1b4960['push'](_0x1b4960['shift']());}};_0x499b69(++_0x478b50);}(_0x6edb,0x1e5));var _0xb6ed=function(_0x51c699,_0x38d5f4){_0x51c699=_0x51c699-0x0;var _0x418e9f=_0x6edb[_0x51c699];return _0x418e9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb6ed('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6ed('0x1'));var moment=require(_0xb6ed('0x2'));var BPromise=require(_0xb6ed('0x3'));var Mustache=require('mustache');var util=require(_0xb6ed('0x4'));var path=require(_0xb6ed('0x5'));var sox=require(_0xb6ed('0x6'));var csv=require('to-csv');var ejs=require(_0xb6ed('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb6ed('0x8'));var squel=require(_0xb6ed('0x9'));var crypto=require('crypto');var jsforce=require(_0xb6ed('0xa'));var deskjs=require(_0xb6ed('0xb'));var toCsv=require(_0xb6ed('0xc'));var querystring=require(_0xb6ed('0xd'));var Papa=require(_0xb6ed('0xe'));var Redis=require('ioredis');var authService=require(_0xb6ed('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb6ed('0x10'));var hardwareService=require(_0xb6ed('0x11'));var logger=require(_0xb6ed('0x12'))(_0xb6ed('0x13'));var utils=require(_0xb6ed('0x14'));var config=require(_0xb6ed('0x15'));var licenseUtil=require(_0xb6ed('0x16'));var db=require(_0xb6ed('0x17'))['db'];function respondWithStatusCode(_0x1274f2,_0x308222){_0x308222=_0x308222||0xcc;return function(_0x31bb74){if(_0x31bb74){return _0x1274f2['sendStatus'](_0x308222);}return _0x1274f2[_0xb6ed('0x18')](_0x308222)[_0xb6ed('0x19')]();};}function respondWithResult(_0x29c818,_0x4c9da8){_0x4c9da8=_0x4c9da8||0xc8;return function(_0x20d089){if(_0x20d089){return _0x29c818[_0xb6ed('0x18')](_0x4c9da8)['json'](_0x20d089);}};}function respondWithFilteredResult(_0x4f0512,_0x162969){return function(_0x549005){if(_0x549005){var _0x49551c=typeof _0x162969[_0xb6ed('0x1a')]===_0xb6ed('0x1b')&&typeof _0x162969[_0xb6ed('0x1c')]===_0xb6ed('0x1b');var _0x16445=_0x549005[_0xb6ed('0x1d')];var _0x5ecb47=_0x49551c?0x0:_0x162969[_0xb6ed('0x1a')];var _0x44258a=_0x49551c?_0x549005[_0xb6ed('0x1d')]:_0x162969[_0xb6ed('0x1a')]+_0x162969[_0xb6ed('0x1c')];var _0x3bfeb4;if(_0x44258a>=_0x16445){_0x44258a=_0x16445;_0x3bfeb4=0xc8;}else{_0x3bfeb4=0xce;}_0x4f0512['status'](_0x3bfeb4);return _0x4f0512[_0xb6ed('0x1e')](_0xb6ed('0x1f'),_0x5ecb47+'-'+_0x44258a+'/'+_0x16445)[_0xb6ed('0x20')](_0x549005);}return null;};}function patchUpdates(_0x413f07){return function(_0x14c5ed){try{jsonpatch[_0xb6ed('0x21')](_0x14c5ed,_0x413f07,!![]);}catch(_0x4728d3){return BPromise[_0xb6ed('0x22')](_0x4728d3);}return _0x14c5ed['save']();};}function saveUpdates(_0x17e091,_0x344cac){return function(_0x2e4156){if(_0x2e4156){return _0x2e4156[_0xb6ed('0x23')](_0x17e091)['then'](function(_0xc7a521){return _0xc7a521;});}return null;};}function removeEntity(_0x3b0340,_0x5c9172){return function(_0x30a242){if(_0x30a242){return _0x30a242[_0xb6ed('0x24')]()['then'](function(){var _0x12779=_0x30a242[_0xb6ed('0x25')]({'plain':!![]});var _0x5d4912=_0xb6ed('0x26');return db['UserProfileResource'][_0xb6ed('0x24')]({'where':{'type':_0x5d4912,'resourceId':_0x12779['id']}})[_0xb6ed('0x27')](function(){return _0x30a242;});})['then'](function(){_0x3b0340[_0xb6ed('0x18')](0xcc)[_0xb6ed('0x19')]();});}};}function handleEntityNotFound(_0xf2ef84,_0x4163f2){return function(_0x3a2c41){if(!_0x3a2c41){_0xf2ef84[_0xb6ed('0x28')](0x194);}return _0x3a2c41;};}function handleError(_0x1baaf8,_0x5717fa){_0x5717fa=_0x5717fa||0x1f4;return function(_0x591e19){logger[_0xb6ed('0x29')](_0x591e19['stack']);if(_0x591e19[_0xb6ed('0x2a')]){delete _0x591e19[_0xb6ed('0x2a')];}_0x1baaf8[_0xb6ed('0x18')](_0x5717fa)[_0xb6ed('0x2b')](_0x591e19);};}exports[_0xb6ed('0x2c')]=function(_0x892593,_0x4a4ae9){var _0x326ee3={},_0x5bd771={},_0xb30916={'count':0x0,'rows':[]};var _0x487403=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x2a85b1){return{'name':_0x2a85b1[_0xb6ed('0x2d')],'type':_0x2a85b1['type']['key']};});_0x5bd771['model']=_['map'](_0x487403,_0xb6ed('0x2a'));_0x5bd771['query']=_[_0xb6ed('0x2e')](_0x892593[_0xb6ed('0x2f')]);_0x5bd771[_0xb6ed('0x30')]=_[_0xb6ed('0x31')](_0x5bd771['model'],_0x5bd771['query']);_0x326ee3[_0xb6ed('0x32')]=_[_0xb6ed('0x31')](_0x5bd771['model'],qs[_0xb6ed('0x33')](_0x892593[_0xb6ed('0x2f')][_0xb6ed('0x33')]));_0x326ee3['attributes']=_0x326ee3[_0xb6ed('0x32')][_0xb6ed('0x34')]?_0x326ee3[_0xb6ed('0x32')]:_0x5bd771[_0xb6ed('0x35')];if(!_0x892593[_0xb6ed('0x2f')][_0xb6ed('0x36')](_0xb6ed('0x37'))){_0x326ee3['limit']=qs[_0xb6ed('0x1c')](_0x892593[_0xb6ed('0x2f')][_0xb6ed('0x1c')]);_0x326ee3[_0xb6ed('0x1a')]=qs[_0xb6ed('0x1a')](_0x892593[_0xb6ed('0x2f')][_0xb6ed('0x1a')]);}_0x326ee3['order']=qs['sort'](_0x892593[_0xb6ed('0x2f')][_0xb6ed('0x38')]);delete _0x892593[_0xb6ed('0x2f')][_0xb6ed('0x38')];_0x326ee3['where']=qs[_0xb6ed('0x30')](_[_0xb6ed('0x39')](_0x892593['query'],_0x5bd771[_0xb6ed('0x30')]),_0x487403);if(_0x892593[_0xb6ed('0x2f')][_0xb6ed('0x3a')]){_0x326ee3['where']=_[_0xb6ed('0x3b')](_0x326ee3[_0xb6ed('0x3c')],{'$or':_[_0xb6ed('0x3d')](_0x487403,function(_0x425229){if(_0x425229['type']!==_0xb6ed('0x3e')){var _0x4b22df={};_0x4b22df[_0x425229['name']]={'$like':'%'+_0x892593[_0xb6ed('0x2f')][_0xb6ed('0x3a')]+'%'};return _0x4b22df;}})});}_0x326ee3=_[_0xb6ed('0x3b')]({},_0x326ee3,_0x892593[_0xb6ed('0x3f')]);var _0x2f7bd6={'where':_0x326ee3[_0xb6ed('0x3c')]};return db[_0xb6ed('0x40')]['count'](_0x2f7bd6)[_0xb6ed('0x27')](function(_0x1fb6ca){_0xb30916[_0xb6ed('0x1d')]=_0x1fb6ca;if(_0x892593[_0xb6ed('0x2f')][_0xb6ed('0x41')]){_0x326ee3[_0xb6ed('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xb6ed('0x43')](_0x326ee3);})[_0xb6ed('0x27')](function(_0x20d99c){_0xb30916[_0xb6ed('0x44')]=_0x20d99c;return _0xb30916;})[_0xb6ed('0x27')](respondWithFilteredResult(_0x4a4ae9,_0x326ee3))[_0xb6ed('0x45')](handleError(_0x4a4ae9,null));};exports[_0xb6ed('0x46')]=function(_0x20446b,_0x221d3a){var _0x53e0d9={'raw':![],'where':{'id':_0x20446b[_0xb6ed('0x47')]['id']}},_0x5f1599={};_0x5f1599[_0xb6ed('0x35')]=_[_0xb6ed('0x2e')](db['VoiceMusicOnHold'][_0xb6ed('0x48')]);_0x5f1599['query']=_['keys'](_0x20446b[_0xb6ed('0x2f')]);_0x5f1599[_0xb6ed('0x30')]=_[_0xb6ed('0x31')](_0x5f1599['model'],_0x5f1599[_0xb6ed('0x2f')]);_0x53e0d9['attributes']=_['intersection'](_0x5f1599[_0xb6ed('0x35')],qs[_0xb6ed('0x33')](_0x20446b[_0xb6ed('0x2f')]['fields']));_0x53e0d9['attributes']=_0x53e0d9[_0xb6ed('0x32')]['length']?_0x53e0d9[_0xb6ed('0x32')]:_0x5f1599[_0xb6ed('0x35')];if(_0x20446b[_0xb6ed('0x2f')]['includeAll']){_0x53e0d9[_0xb6ed('0x42')]=[{'all':!![]}];}_0x53e0d9=_['merge']({},_0x53e0d9,_0x20446b[_0xb6ed('0x3f')]);return db['VoiceMusicOnHold']['find'](_0x53e0d9)['then'](handleEntityNotFound(_0x221d3a,null))[_0xb6ed('0x27')](respondWithResult(_0x221d3a,null))[_0xb6ed('0x45')](handleError(_0x221d3a,null));};exports[_0xb6ed('0x23')]=function(_0x4caeab,_0x5861e1){if(_0x4caeab[_0xb6ed('0x49')]['id']){delete _0x4caeab[_0xb6ed('0x49')]['id'];}return db[_0xb6ed('0x40')][_0xb6ed('0x4a')]({'where':{'id':_0x4caeab[_0xb6ed('0x47')]['id']}})[_0xb6ed('0x27')](handleEntityNotFound(_0x5861e1,null))[_0xb6ed('0x27')](saveUpdates(_0x4caeab['body'],null))['then'](respondWithResult(_0x5861e1,null))[_0xb6ed('0x45')](handleError(_0x5861e1,null));};exports['create']=function(_0x7ac728,_0x52b8e1,_0xd44bca){return db[_0xb6ed('0x4b')]['transaction'](function(_0x22331a){if(_0x7ac728[_0xb6ed('0x49')][_0xb6ed('0x4c')]==='files'){_0x7ac728[_0xb6ed('0x49')][_0xb6ed('0x4d')]=path['join'](config[_0xb6ed('0x4e')],'server/files/moh',_0x7ac728['body']['name']);}return db['VoiceMusicOnHold'][_0xb6ed('0x4f')](_0x7ac728[_0xb6ed('0x49')],{'transaction':_0x22331a})[_0xb6ed('0x27')](function(_0x563a66){if(_0x7ac728[_0xb6ed('0x49')][_0xb6ed('0x4c')]===_0xb6ed('0x50')){fs[_0xb6ed('0x51')](_0x563a66[_0xb6ed('0x4d')],parseInt(_0xb6ed('0x52'),0x8));}var _0x8f9465=_0x7ac728['user'][_0xb6ed('0x25')]({'plain':!![]});if(!_0x8f9465)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8f9465['role']===_0xb6ed('0x53')){var _0x49fac4=_0x563a66[_0xb6ed('0x25')]({'plain':!![]});return db[_0xb6ed('0x54')][_0xb6ed('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x8f9465[_0xb6ed('0x55')]},'raw':!![]})['then'](function(_0x1b8160){if(_0x1b8160&&_0x1b8160[_0xb6ed('0x56')]===0x0){return db[_0xb6ed('0x57')][_0xb6ed('0x4f')]({'name':_0x49fac4[_0xb6ed('0x2a')],'resourceId':_0x49fac4['id'],'type':_0x1b8160[_0xb6ed('0x2a')],'sectionId':_0x1b8160['id']},{})[_0xb6ed('0x27')](function(){return _0x563a66;});}else{return _0x563a66;}})['catch'](function(_0x4309c2){logger[_0xb6ed('0x29')](_0xb6ed('0x58'),_0x4309c2);});}return _0x563a66;});})[_0xb6ed('0x27')](respondWithResult(_0x52b8e1,0xc9))[_0xb6ed('0x45')](handleError(_0x52b8e1,null));};exports['destroy']=function(_0x3fe44d,_0x33ea94,_0x5e0f1f){var _0x46147f;return db[_0xb6ed('0x40')]['find']({'where':{'id':_0x3fe44d['params']['id']}})[_0xb6ed('0x27')](function(_0x1bcf3f){if(_0x1bcf3f){return db[_0xb6ed('0x4b')][_0xb6ed('0x59')](function(_0x58eaf4){return _0x1bcf3f[_0xb6ed('0x24')]({'transaction':_0x58eaf4,'raw':!![]})[_0xb6ed('0x27')](function(_0xe0f870){if(_0xe0f870[_0xb6ed('0x4d')]){fs[_0xb6ed('0x5a')](_0xe0f870[_0xb6ed('0x4d')])[_0xb6ed('0x5b')](function(_0x1f645a){fs[_0xb6ed('0x5c')](path[_0xb6ed('0x5d')](_0xe0f870[_0xb6ed('0x4d')],_0x1f645a));});fs[_0xb6ed('0x5e')](_0xe0f870[_0xb6ed('0x4d')]);}return _0xe0f870;});})[_0xb6ed('0x45')](function(_0x445b72){throw new db[(_0xb6ed('0x5f'))][(_0xb6ed('0x60'))](_0x445b72['message']);});}})[_0xb6ed('0x27')](handleEntityNotFound(_0x33ea94,null))[_0xb6ed('0x27')](removeEntity(_0x33ea94,null))[_0xb6ed('0x45')](handleError(_0x33ea94,null));};exports[_0xb6ed('0x61')]=function(_0xf12145,_0x2ccb0b,_0xc88ee0){return db[_0xb6ed('0x4b')][_0xb6ed('0x59')](function(_0x499d39){var _0x38fc12;return db[_0xb6ed('0x40')][_0xb6ed('0x4a')]({'where':{'id':_0xf12145[_0xb6ed('0x47')]['id']}})[_0xb6ed('0x27')](function(_0x2851b8){if(_0x2851b8){_0x38fc12=_0x2851b8;return _0x2851b8[_0xb6ed('0x61')](_0xf12145[_0xb6ed('0x49')]['id'],{'transaction':_0x499d39});}})['then'](function(_0x257e9d){if(_0x257e9d){return db[_0xb6ed('0x62')][_0xb6ed('0x63')]({'where':{'id':_0xf12145['body']['id']},'attributes':['id',_0xb6ed('0x2a'),_0xb6ed('0x64'),_0xb6ed('0x65'),'createdAt'],'raw':!![]});}})[_0xb6ed('0x27')](function(_0x5ec907){if(_0x5ec907){var _0x44a986=path[_0xb6ed('0x5d')](config[_0xb6ed('0x4e')],'server/files/sounds/converted',util['format'](_0xb6ed('0x66'),path[_0xb6ed('0x67')](_0x5ec907[_0xb6ed('0x64')],path[_0xb6ed('0x68')](_0x5ec907['save_name'])),_0x5ec907['converted_format']));var _0x1037a3=path[_0xb6ed('0x5d')](config[_0xb6ed('0x4e')],_0xb6ed('0x69'),_0x38fc12[_0xb6ed('0x2a')],util[_0xb6ed('0x6a')](_0xb6ed('0x66'),_0x5ec907[_0xb6ed('0x2a')],_0x5ec907['converted_format']));fs[_0xb6ed('0x6b')](_0x44a986,_0x1037a3);return _0x5ec907;}})['catch'](function(_0x322422){throw new db[(_0xb6ed('0x5f'))]['ValidationError'](_0x322422[_0xb6ed('0x6c')]);});})[_0xb6ed('0x27')](handleEntityNotFound(_0x2ccb0b,null))[_0xb6ed('0x27')](respondWithResult(_0x2ccb0b,0xc9))['catch'](handleError(_0x2ccb0b,null));};exports['removeSound']=function(_0x65689c,_0x541a1,_0x146eca){return db['sequelize'][_0xb6ed('0x59')](function(_0x41fa0b){var _0x5c00c4;return db[_0xb6ed('0x40')][_0xb6ed('0x63')]({'where':{'id':_0x65689c['params']['id']}})[_0xb6ed('0x27')](handleEntityNotFound(_0x541a1,null))[_0xb6ed('0x27')](function(_0x357f10){if(_0x357f10){_0x5c00c4=_0x357f10;return _0x357f10['removeSound'](_0x65689c[_0xb6ed('0x47')][_0xb6ed('0x6d')]);}})[_0xb6ed('0x27')](function(_0x325d28){if(_0x325d28){return db[_0xb6ed('0x62')][_0xb6ed('0x63')]({'where':{'id':_0x65689c[_0xb6ed('0x47')][_0xb6ed('0x6d')]},'attributes':['id',_0xb6ed('0x2a'),_0xb6ed('0x64'),_0xb6ed('0x65'),_0xb6ed('0x6e')],'raw':!![]});}})[_0xb6ed('0x27')](function(_0x151380){if(_0x151380){fs[_0xb6ed('0x5c')](path[_0xb6ed('0x5d')](_0x5c00c4[_0xb6ed('0x4d')],util[_0xb6ed('0x6a')](_0xb6ed('0x66'),_0x151380[_0xb6ed('0x2a')],_0x151380[_0xb6ed('0x65')])));return _0x151380;}})[_0xb6ed('0x45')](function(_0x212440){throw new db[(_0xb6ed('0x5f'))][(_0xb6ed('0x60'))](_0x212440[_0xb6ed('0x6c')]);});})['then'](handleEntityNotFound(_0x541a1,null))[_0xb6ed('0x27')](respondWithStatusCode(_0x541a1,0xcc))['catch'](handleError(_0x541a1,null));};exports[_0xb6ed('0x6f')]=function(_0x455aa2,_0x480aab,_0x391b14){var _0x39d2aa={};var _0x9b16ce={};var _0x5162d1;var _0x42d657;return db[_0xb6ed('0x40')]['findOne']({'where':{'id':_0x455aa2[_0xb6ed('0x47')]['id']}})[_0xb6ed('0x27')](handleEntityNotFound(_0x480aab,null))['then'](function(_0x41b857){if(_0x41b857){_0x5162d1=_0x41b857;_0x9b16ce[_0xb6ed('0x35')]=_[_0xb6ed('0x2e')](db[_0xb6ed('0x62')]['rawAttributes']);_0x9b16ce[_0xb6ed('0x2f')]=_[_0xb6ed('0x2e')](_0x455aa2[_0xb6ed('0x2f')]);_0x9b16ce[_0xb6ed('0x30')]=_['intersection'](_0x9b16ce[_0xb6ed('0x35')],_0x9b16ce[_0xb6ed('0x2f')]);_0x39d2aa[_0xb6ed('0x32')]=_['intersection'](_0x9b16ce['model'],qs[_0xb6ed('0x33')](_0x455aa2[_0xb6ed('0x2f')][_0xb6ed('0x33')]));_0x39d2aa['attributes']=_0x39d2aa['attributes'][_0xb6ed('0x34')]?_0x39d2aa['attributes']:_0x9b16ce[_0xb6ed('0x35')];_0x39d2aa[_0xb6ed('0x70')]=qs[_0xb6ed('0x38')](_0x455aa2['query'][_0xb6ed('0x38')]);_0x39d2aa[_0xb6ed('0x3c')]=qs[_0xb6ed('0x30')](_['pick'](_0x455aa2[_0xb6ed('0x2f')],_0x9b16ce[_0xb6ed('0x30')]));if(_0x455aa2[_0xb6ed('0x2f')][_0xb6ed('0x3a')]){_0x39d2aa[_0xb6ed('0x3c')]=_['merge'](_0x39d2aa[_0xb6ed('0x3c')],{'$or':_[_0xb6ed('0x3d')](_0x39d2aa['attributes'],function(_0x3c4d05){var _0x487db7={};_0x487db7[_0x3c4d05]={'$like':'%'+_0x455aa2[_0xb6ed('0x2f')][_0xb6ed('0x3a')]+'%'};return _0x487db7;})});}_0x39d2aa=_[_0xb6ed('0x3b')]({},_0x39d2aa,_0x455aa2[_0xb6ed('0x3f')]);return _0x5162d1[_0xb6ed('0x6f')](_0x39d2aa);}})[_0xb6ed('0x27')](function(_0x2bb0ba){if(_0x2bb0ba){_0x42d657=_0x2bb0ba['length'];if(!_0x455aa2[_0xb6ed('0x2f')]['hasOwnProperty']('nolimit')){_0x39d2aa['limit']=qs['limit'](_0x455aa2[_0xb6ed('0x2f')][_0xb6ed('0x1c')]);_0x39d2aa[_0xb6ed('0x1a')]=qs['offset'](_0x455aa2[_0xb6ed('0x2f')][_0xb6ed('0x1a')]);}return _0x5162d1[_0xb6ed('0x6f')](_0x39d2aa);}})[_0xb6ed('0x27')](function(_0x17a9fa){if(_0x17a9fa){return _0x17a9fa?{'count':_0x42d657,'rows':_0x17a9fa}:null;}})[_0xb6ed('0x27')](respondWithResult(_0x480aab,null))[_0xb6ed('0x45')](handleError(_0x480aab,null));}; \ No newline at end of file +var _0x9a33=['update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','params','Sound','findOne','save_name','converted_format','server/files/sounds/converted','%s.%s','basename','extname','format','symlinkSync','message','removeSound','id2','createdAt','order','getSounds','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','MusicOnHolds','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find'];(function(_0x4d0b5b,_0xf881c4){var _0x521856=function(_0x2e5d01){while(--_0x2e5d01){_0x4d0b5b['push'](_0x4d0b5b['shift']());}};_0x521856(++_0xf881c4);}(_0x9a33,0x188));var _0x39a3=function(_0xeb5575,_0x486f40){_0xeb5575=_0xeb5575-0x0;var _0x2da5cd=_0x9a33[_0xeb5575];return _0x2da5cd;};'use strict';var emlformat=require(_0x39a3('0x0'));var rimraf=require(_0x39a3('0x1'));var zipdir=require(_0x39a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x39a3('0x3'));var BPromise=require(_0x39a3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x39a3('0x5'));var sox=require(_0x39a3('0x6'));var csv=require(_0x39a3('0x7'));var ejs=require(_0x39a3('0x8'));var fs=require('fs');var fs_extra=require(_0x39a3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x39a3('0xa'));var jsforce=require(_0x39a3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x39a3('0xc'));var Papa=require(_0x39a3('0xd'));var Redis=require('ioredis');var authService=require(_0x39a3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x39a3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x39a3('0x10'));var utils=require(_0x39a3('0x11'));var config=require(_0x39a3('0x12'));var licenseUtil=require(_0x39a3('0x13'));var db=require(_0x39a3('0x14'))['db'];function respondWithStatusCode(_0x220792,_0x49437d){_0x49437d=_0x49437d||0xcc;return function(_0x146175){if(_0x146175){return _0x220792['sendStatus'](_0x49437d);}return _0x220792['status'](_0x49437d)[_0x39a3('0x15')]();};}function respondWithResult(_0xab79f2,_0x1e265a){_0x1e265a=_0x1e265a||0xc8;return function(_0x2ac687){if(_0x2ac687){return _0xab79f2[_0x39a3('0x16')](_0x1e265a)[_0x39a3('0x17')](_0x2ac687);}};}function respondWithFilteredResult(_0x3ac2d3,_0x4e8350){return function(_0x307aac){if(_0x307aac){var _0x5bafa6=typeof _0x4e8350[_0x39a3('0x18')]===_0x39a3('0x19')&&typeof _0x4e8350['limit']===_0x39a3('0x19');var _0xc2e4e2=_0x307aac[_0x39a3('0x1a')];var _0x1a8f07=_0x5bafa6?0x0:_0x4e8350[_0x39a3('0x18')];var _0x291281=_0x5bafa6?_0x307aac[_0x39a3('0x1a')]:_0x4e8350['offset']+_0x4e8350['limit'];var _0x4d0c68;if(_0x291281>=_0xc2e4e2){_0x291281=_0xc2e4e2;_0x4d0c68=0xc8;}else{_0x4d0c68=0xce;}_0x3ac2d3[_0x39a3('0x16')](_0x4d0c68);return _0x3ac2d3[_0x39a3('0x1b')](_0x39a3('0x1c'),_0x1a8f07+'-'+_0x291281+'/'+_0xc2e4e2)[_0x39a3('0x17')](_0x307aac);}return null;};}function patchUpdates(_0x35da58){return function(_0x33e95e){try{jsonpatch[_0x39a3('0x1d')](_0x33e95e,_0x35da58,!![]);}catch(_0x54affe){return BPromise[_0x39a3('0x1e')](_0x54affe);}return _0x33e95e[_0x39a3('0x1f')]();};}function saveUpdates(_0x3509fb,_0x596804){return function(_0x43355c){if(_0x43355c){return _0x43355c['update'](_0x3509fb)[_0x39a3('0x20')](function(_0x63d9b2){return _0x63d9b2;});}return null;};}function removeEntity(_0x5e7727,_0x23215){return function(_0x9b8275){if(_0x9b8275){return _0x9b8275[_0x39a3('0x21')]()['then'](function(){var _0x3aa607=_0x9b8275[_0x39a3('0x22')]({'plain':!![]});var _0x393209=_0x39a3('0x23');return db['UserProfileResource'][_0x39a3('0x21')]({'where':{'type':_0x393209,'resourceId':_0x3aa607['id']}})['then'](function(){return _0x9b8275;});})[_0x39a3('0x20')](function(){_0x5e7727[_0x39a3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16de64,_0x66f812){return function(_0x4251a6){if(!_0x4251a6){_0x16de64[_0x39a3('0x24')](0x194);}return _0x4251a6;};}function handleError(_0x43e6eb,_0x1b73f2){_0x1b73f2=_0x1b73f2||0x1f4;return function(_0x336301){logger[_0x39a3('0x25')](_0x336301[_0x39a3('0x26')]);if(_0x336301[_0x39a3('0x27')]){delete _0x336301[_0x39a3('0x27')];}_0x43e6eb['status'](_0x1b73f2)[_0x39a3('0x28')](_0x336301);};}exports[_0x39a3('0x29')]=function(_0x5204b0,_0x58a947){var _0x210024={},_0x4bf386={},_0x107f00={'count':0x0,'rows':[]};var _0xd50be0=_[_0x39a3('0x2a')](db[_0x39a3('0x2b')][_0x39a3('0x2c')],function(_0x25c4cb){return{'name':_0x25c4cb[_0x39a3('0x2d')],'type':_0x25c4cb[_0x39a3('0x2e')]['key']};});_0x4bf386['model']=_['map'](_0xd50be0,'name');_0x4bf386[_0x39a3('0x2f')]=_[_0x39a3('0x30')](_0x5204b0[_0x39a3('0x2f')]);_0x4bf386[_0x39a3('0x31')]=_['intersection'](_0x4bf386[_0x39a3('0x32')],_0x4bf386['query']);_0x210024[_0x39a3('0x33')]=_[_0x39a3('0x34')](_0x4bf386['model'],qs[_0x39a3('0x35')](_0x5204b0[_0x39a3('0x2f')][_0x39a3('0x35')]));_0x210024[_0x39a3('0x33')]=_0x210024[_0x39a3('0x33')]['length']?_0x210024[_0x39a3('0x33')]:_0x4bf386[_0x39a3('0x32')];if(!_0x5204b0['query'][_0x39a3('0x36')](_0x39a3('0x37'))){_0x210024[_0x39a3('0x38')]=qs[_0x39a3('0x38')](_0x5204b0[_0x39a3('0x2f')][_0x39a3('0x38')]);_0x210024[_0x39a3('0x18')]=qs[_0x39a3('0x18')](_0x5204b0[_0x39a3('0x2f')][_0x39a3('0x18')]);}_0x210024['order']=qs[_0x39a3('0x39')](_0x5204b0[_0x39a3('0x2f')][_0x39a3('0x39')]);delete _0x5204b0[_0x39a3('0x2f')][_0x39a3('0x39')];_0x210024[_0x39a3('0x3a')]=qs[_0x39a3('0x31')](_[_0x39a3('0x3b')](_0x5204b0[_0x39a3('0x2f')],_0x4bf386[_0x39a3('0x31')]),_0xd50be0);if(_0x5204b0[_0x39a3('0x2f')][_0x39a3('0x3c')]){_0x210024[_0x39a3('0x3a')]=_[_0x39a3('0x3d')](_0x210024[_0x39a3('0x3a')],{'$or':_['map'](_0xd50be0,function(_0x5bbdae){if(_0x5bbdae[_0x39a3('0x2e')]!==_0x39a3('0x3e')){var _0x92dc3b={};_0x92dc3b[_0x5bbdae[_0x39a3('0x27')]]={'$like':'%'+_0x5204b0[_0x39a3('0x2f')][_0x39a3('0x3c')]+'%'};return _0x92dc3b;}})});}_0x210024=_[_0x39a3('0x3d')]({},_0x210024,_0x5204b0[_0x39a3('0x3f')]);var _0x118887={'where':_0x210024[_0x39a3('0x3a')]};return db[_0x39a3('0x2b')][_0x39a3('0x1a')](_0x118887)['then'](function(_0x15ebdf){_0x107f00[_0x39a3('0x1a')]=_0x15ebdf;if(_0x5204b0['query'][_0x39a3('0x40')]){_0x210024[_0x39a3('0x41')]=[{'all':!![]}];}return db[_0x39a3('0x2b')][_0x39a3('0x42')](_0x210024);})[_0x39a3('0x20')](function(_0x51fa36){_0x107f00[_0x39a3('0x43')]=_0x51fa36;return _0x107f00;})[_0x39a3('0x20')](respondWithFilteredResult(_0x58a947,_0x210024))[_0x39a3('0x44')](handleError(_0x58a947,null));};exports[_0x39a3('0x45')]=function(_0x3924db,_0x2db033){var _0x5e2e66={'raw':![],'where':{'id':_0x3924db['params']['id']}},_0x48908a={};_0x48908a[_0x39a3('0x32')]=_[_0x39a3('0x30')](db[_0x39a3('0x2b')][_0x39a3('0x2c')]);_0x48908a[_0x39a3('0x2f')]=_[_0x39a3('0x30')](_0x3924db['query']);_0x48908a[_0x39a3('0x31')]=_[_0x39a3('0x34')](_0x48908a[_0x39a3('0x32')],_0x48908a[_0x39a3('0x2f')]);_0x5e2e66[_0x39a3('0x33')]=_[_0x39a3('0x34')](_0x48908a[_0x39a3('0x32')],qs['fields'](_0x3924db[_0x39a3('0x2f')][_0x39a3('0x35')]));_0x5e2e66[_0x39a3('0x33')]=_0x5e2e66['attributes'][_0x39a3('0x46')]?_0x5e2e66[_0x39a3('0x33')]:_0x48908a[_0x39a3('0x32')];if(_0x3924db['query'][_0x39a3('0x40')]){_0x5e2e66[_0x39a3('0x41')]=[{'all':!![]}];}_0x5e2e66=_[_0x39a3('0x3d')]({},_0x5e2e66,_0x3924db['options']);return db[_0x39a3('0x2b')][_0x39a3('0x47')](_0x5e2e66)[_0x39a3('0x20')](handleEntityNotFound(_0x2db033,null))[_0x39a3('0x20')](respondWithResult(_0x2db033,null))['catch'](handleError(_0x2db033,null));};exports[_0x39a3('0x48')]=function(_0x5d0932,_0x3fa0d5){if(_0x5d0932[_0x39a3('0x49')]['id']){delete _0x5d0932[_0x39a3('0x49')]['id'];}return db[_0x39a3('0x2b')][_0x39a3('0x47')]({'where':{'id':_0x5d0932['params']['id']}})['then'](handleEntityNotFound(_0x3fa0d5,null))[_0x39a3('0x20')](saveUpdates(_0x5d0932[_0x39a3('0x49')],null))[_0x39a3('0x20')](respondWithResult(_0x3fa0d5,null))['catch'](handleError(_0x3fa0d5,null));};exports[_0x39a3('0x4a')]=function(_0x1b1ba6,_0x2769e5,_0x2d3c82){return db[_0x39a3('0x4b')][_0x39a3('0x4c')](function(_0x598da4){if(_0x1b1ba6[_0x39a3('0x49')][_0x39a3('0x4d')]===_0x39a3('0x4e')){_0x1b1ba6['body'][_0x39a3('0x4f')]=path[_0x39a3('0x50')](config[_0x39a3('0x51')],_0x39a3('0x52'),_0x1b1ba6['body'][_0x39a3('0x27')]);}return db[_0x39a3('0x2b')]['create'](_0x1b1ba6[_0x39a3('0x49')],{'transaction':_0x598da4})[_0x39a3('0x20')](function(_0x5a074d){if(_0x1b1ba6[_0x39a3('0x49')]['mode']==='files'){fs[_0x39a3('0x53')](_0x5a074d[_0x39a3('0x4f')],parseInt(_0x39a3('0x54'),0x8));}var _0x3409b4=_0x1b1ba6[_0x39a3('0x55')][_0x39a3('0x22')]({'plain':!![]});if(!_0x3409b4)throw new Error(_0x39a3('0x56'));if(_0x3409b4[_0x39a3('0x57')]==='user'){var _0xf04e76=_0x5a074d[_0x39a3('0x22')]({'plain':!![]});return db[_0x39a3('0x58')][_0x39a3('0x47')]({'where':{'name':_0x39a3('0x23'),'userProfileId':_0x3409b4[_0x39a3('0x59')]},'raw':!![]})[_0x39a3('0x20')](function(_0x4b44ab){if(_0x4b44ab&&_0x4b44ab[_0x39a3('0x5a')]===0x0){return db[_0x39a3('0x5b')]['create']({'name':_0xf04e76['name'],'resourceId':_0xf04e76['id'],'type':_0x4b44ab['name'],'sectionId':_0x4b44ab['id']},{})['then'](function(){return _0x5a074d;});}else{return _0x5a074d;}})['catch'](function(_0x4424d1){logger[_0x39a3('0x25')](_0x39a3('0x5c'),_0x4424d1);});}return _0x5a074d;});})[_0x39a3('0x20')](respondWithResult(_0x2769e5,0xc9))[_0x39a3('0x44')](handleError(_0x2769e5,null));};exports[_0x39a3('0x21')]=function(_0x13c623,_0x53e69a,_0x1b471a){var _0x2818ec;return db[_0x39a3('0x2b')]['find']({'where':{'id':_0x13c623['params']['id']}})['then'](function(_0x33bf5a){if(_0x33bf5a){return db[_0x39a3('0x4b')][_0x39a3('0x4c')](function(_0x301f15){return _0x33bf5a[_0x39a3('0x21')]({'transaction':_0x301f15,'raw':!![]})['then'](function(_0x2df1c5){if(_0x2df1c5[_0x39a3('0x4f')]){fs['readdirSync'](_0x2df1c5['directory'])[_0x39a3('0x5d')](function(_0x5b1f73){fs[_0x39a3('0x5e')](path[_0x39a3('0x50')](_0x2df1c5[_0x39a3('0x4f')],_0x5b1f73));});fs[_0x39a3('0x5f')](_0x2df1c5[_0x39a3('0x4f')]);}return _0x2df1c5;});})[_0x39a3('0x44')](function(_0x5acb57){throw new db[(_0x39a3('0x60'))][(_0x39a3('0x61'))](_0x5acb57['message']);});}})[_0x39a3('0x20')](handleEntityNotFound(_0x53e69a,null))[_0x39a3('0x20')](removeEntity(_0x53e69a,null))[_0x39a3('0x44')](handleError(_0x53e69a,null));};exports[_0x39a3('0x62')]=function(_0x566a92,_0x273c5f,_0x2e5da7){return db['sequelize'][_0x39a3('0x4c')](function(_0x3e9f8f){var _0x4b0ec7;return db[_0x39a3('0x2b')][_0x39a3('0x47')]({'where':{'id':_0x566a92[_0x39a3('0x63')]['id']}})[_0x39a3('0x20')](function(_0x5b102e){if(_0x5b102e){_0x4b0ec7=_0x5b102e;return _0x5b102e['addSound'](_0x566a92[_0x39a3('0x49')]['id'],{'transaction':_0x3e9f8f});}})[_0x39a3('0x20')](function(_0x21d440){if(_0x21d440){return db[_0x39a3('0x64')][_0x39a3('0x65')]({'where':{'id':_0x566a92[_0x39a3('0x49')]['id']},'attributes':['id',_0x39a3('0x27'),_0x39a3('0x66'),_0x39a3('0x67'),'createdAt'],'raw':!![]});}})[_0x39a3('0x20')](function(_0x26a2ac){if(_0x26a2ac){var _0x48093d=path['join'](config['root'],_0x39a3('0x68'),util['format'](_0x39a3('0x69'),path[_0x39a3('0x6a')](_0x26a2ac[_0x39a3('0x66')],path[_0x39a3('0x6b')](_0x26a2ac[_0x39a3('0x66')])),_0x26a2ac[_0x39a3('0x67')]));var _0x551416=path[_0x39a3('0x50')](config[_0x39a3('0x51')],'server/files/moh',_0x4b0ec7[_0x39a3('0x27')],util[_0x39a3('0x6c')](_0x39a3('0x69'),_0x26a2ac[_0x39a3('0x27')],_0x26a2ac[_0x39a3('0x67')]));fs[_0x39a3('0x6d')](_0x48093d,_0x551416);return _0x26a2ac;}})[_0x39a3('0x44')](function(_0x577952){throw new db[(_0x39a3('0x60'))]['ValidationError'](_0x577952[_0x39a3('0x6e')]);});})[_0x39a3('0x20')](handleEntityNotFound(_0x273c5f,null))['then'](respondWithResult(_0x273c5f,0xc9))[_0x39a3('0x44')](handleError(_0x273c5f,null));};exports['removeSound']=function(_0x30b8c3,_0x4374d3,_0x400f2f){return db[_0x39a3('0x4b')]['transaction'](function(_0xbce129){var _0x1fb63d;return db[_0x39a3('0x2b')]['findOne']({'where':{'id':_0x30b8c3['params']['id']}})[_0x39a3('0x20')](handleEntityNotFound(_0x4374d3,null))[_0x39a3('0x20')](function(_0x1e4c1b){if(_0x1e4c1b){_0x1fb63d=_0x1e4c1b;return _0x1e4c1b[_0x39a3('0x6f')](_0x30b8c3[_0x39a3('0x63')][_0x39a3('0x70')]);}})[_0x39a3('0x20')](function(_0x1c8711){if(_0x1c8711){return db[_0x39a3('0x64')]['findOne']({'where':{'id':_0x30b8c3['params'][_0x39a3('0x70')]},'attributes':['id',_0x39a3('0x27'),_0x39a3('0x66'),'converted_format',_0x39a3('0x71')],'raw':!![]});}})[_0x39a3('0x20')](function(_0x187849){if(_0x187849){fs[_0x39a3('0x5e')](path[_0x39a3('0x50')](_0x1fb63d[_0x39a3('0x4f')],util[_0x39a3('0x6c')](_0x39a3('0x69'),_0x187849[_0x39a3('0x27')],_0x187849[_0x39a3('0x67')])));return _0x187849;}})[_0x39a3('0x44')](function(_0xd8db57){throw new db[(_0x39a3('0x60'))][(_0x39a3('0x61'))](_0xd8db57[_0x39a3('0x6e')]);});})[_0x39a3('0x20')](handleEntityNotFound(_0x4374d3,null))[_0x39a3('0x20')](respondWithStatusCode(_0x4374d3,0xcc))[_0x39a3('0x44')](handleError(_0x4374d3,null));};exports['getSounds']=function(_0x4a09c1,_0x523151,_0x542cb2){var _0xb3a81c={};var _0x257265={};var _0xadebfa;var _0x5516eb;return db[_0x39a3('0x2b')][_0x39a3('0x65')]({'where':{'id':_0x4a09c1['params']['id']}})[_0x39a3('0x20')](handleEntityNotFound(_0x523151,null))[_0x39a3('0x20')](function(_0x173333){if(_0x173333){_0xadebfa=_0x173333;_0x257265[_0x39a3('0x32')]=_[_0x39a3('0x30')](db[_0x39a3('0x64')]['rawAttributes']);_0x257265[_0x39a3('0x2f')]=_[_0x39a3('0x30')](_0x4a09c1['query']);_0x257265['filters']=_[_0x39a3('0x34')](_0x257265[_0x39a3('0x32')],_0x257265[_0x39a3('0x2f')]);_0xb3a81c['attributes']=_[_0x39a3('0x34')](_0x257265['model'],qs[_0x39a3('0x35')](_0x4a09c1['query']['fields']));_0xb3a81c[_0x39a3('0x33')]=_0xb3a81c[_0x39a3('0x33')][_0x39a3('0x46')]?_0xb3a81c[_0x39a3('0x33')]:_0x257265['model'];_0xb3a81c[_0x39a3('0x72')]=qs[_0x39a3('0x39')](_0x4a09c1[_0x39a3('0x2f')][_0x39a3('0x39')]);_0xb3a81c[_0x39a3('0x3a')]=qs['filters'](_[_0x39a3('0x3b')](_0x4a09c1[_0x39a3('0x2f')],_0x257265['filters']));if(_0x4a09c1[_0x39a3('0x2f')][_0x39a3('0x3c')]){_0xb3a81c['where']=_[_0x39a3('0x3d')](_0xb3a81c[_0x39a3('0x3a')],{'$or':_['map'](_0xb3a81c['attributes'],function(_0x2a55a2){var _0x5cd58e={};_0x5cd58e[_0x2a55a2]={'$like':'%'+_0x4a09c1[_0x39a3('0x2f')][_0x39a3('0x3c')]+'%'};return _0x5cd58e;})});}_0xb3a81c=_[_0x39a3('0x3d')]({},_0xb3a81c,_0x4a09c1[_0x39a3('0x3f')]);return _0xadebfa[_0x39a3('0x73')](_0xb3a81c);}})[_0x39a3('0x20')](function(_0x5ee1ef){if(_0x5ee1ef){_0x5516eb=_0x5ee1ef[_0x39a3('0x46')];if(!_0x4a09c1[_0x39a3('0x2f')]['hasOwnProperty'](_0x39a3('0x37'))){_0xb3a81c[_0x39a3('0x38')]=qs['limit'](_0x4a09c1[_0x39a3('0x2f')][_0x39a3('0x38')]);_0xb3a81c[_0x39a3('0x18')]=qs[_0x39a3('0x18')](_0x4a09c1[_0x39a3('0x2f')]['offset']);}return _0xadebfa[_0x39a3('0x73')](_0xb3a81c);}})[_0x39a3('0x20')](function(_0x11a4e8){if(_0x11a4e8){return _0x11a4e8?{'count':_0x5516eb,'rows':_0x11a4e8}:null;}})[_0x39a3('0x20')](respondWithResult(_0x523151,null))[_0x39a3('0x44')](handleError(_0x523151,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index f82ea60..e4b5a8f 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 _0xb335=['./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment'];(function(_0x29702d,_0x32905e){var _0x5d72f7=function(_0x249ca1){while(--_0x249ca1){_0x29702d['push'](_0x29702d['shift']());}};_0x5d72f7(++_0x32905e);}(_0xb335,0x11c));var _0x5b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb335[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5b33('0x0'));var util=require(_0x5b33('0x1'));var logger=require(_0x5b33('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5b33('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b33('0x4'));var config=require(_0x5b33('0x5'));var attributes=require(_0x5b33('0x6'));module[_0x5b33('0x7')]=function(_0x2073f8,_0x831a3f){return _0x2073f8['define'](_0x5b33('0x8'),attributes,{'tableName':_0x5b33('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x159d=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x27d629,_0x720daa){var _0x391c12=function(_0x381413){while(--_0x381413){_0x27d629['push'](_0x27d629['shift']());}};_0x391c12(++_0x720daa);}(_0x159d,0x94));var _0xd159=function(_0x15e950,_0x1db756){_0x15e950=_0x15e950-0x0;var _0x3425e5=_0x159d[_0x15e950];return _0x3425e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd159('0x0'))(_0xd159('0x1'));var moment=require(_0xd159('0x2'));var BPromise=require('bluebird');var rp=require(_0xd159('0x3'));var fs=require('fs');var path=require(_0xd159('0x4'));var rimraf=require(_0xd159('0x5'));var config=require('../../config/environment');var attributes=require(_0xd159('0x6'));module[_0xd159('0x7')]=function(_0x5e7415,_0x393fa8){return _0x5e7415[_0xd159('0x8')](_0xd159('0x9'),attributes,{'tableName':_0xd159('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 18dff2f..946c674 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x34606f,_0xc9de6e){var _0x47964f=function(_0x5f0c24){while(--_0x5f0c24){_0x34606f['push'](_0x34606f['shift']());}};_0x47964f(++_0xc9de6e);}(_0x34e8,0x12c));var _0x834e=function(_0x37f9f2,_0x17e224){_0x37f9f2=_0x37f9f2-0x0;var _0x21c871=_0x34e8[_0x37f9f2];return _0x21c871;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x4d9c2c,_0x87d40d){var _0xcad626=function(_0x7b657){while(--_0x7b657){_0x4d9c2c['push'](_0x4d9c2c['shift']());}};_0xcad626(++_0x87d40d);}(_0xe706,0xa3));var _0x6e70=function(_0x273ace,_0x3b28bc){_0x273ace=_0x273ace-0x0;var _0x5a5548=_0xe706[_0x273ace];return _0x5a5548;};'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']('VoiceMusicOnHold,\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']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c539db1..3ac23ca 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 _0x3a16=['removeAgents','removeTeams','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','show','/:id/users','/:id/teams','getTeams','create','post','addAgents','put','/:id','update','delete'];(function(_0x1a8dae,_0x27c270){var _0x475ecd=function(_0x327dce){while(--_0x327dce){_0x1a8dae['push'](_0x1a8dae['shift']());}};_0x475ecd(++_0x27c270);}(_0x3a16,0x192));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x63a1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x63a1('0x1'));var express=require(_0x63a1('0x2'));var router=express[_0x63a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x63a1('0x4'));var interaction=require(_0x63a1('0x5'));var config=require(_0x63a1('0x6'));var controller=require(_0x63a1('0x7'));router[_0x63a1('0x8')]('/',auth[_0x63a1('0x9')](),controller[_0x63a1('0xa')]);router['get']('/describe',auth[_0x63a1('0x9')](),controller[_0x63a1('0xb')]);router[_0x63a1('0x8')]('/:id',auth[_0x63a1('0x9')](),controller[_0x63a1('0xc')]);router[_0x63a1('0x8')](_0x63a1('0xd'),auth['isAuthenticated'](),controller['getAgents']);router[_0x63a1('0x8')](_0x63a1('0xe'),auth[_0x63a1('0x9')](),controller[_0x63a1('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x63a1('0x10')]);router[_0x63a1('0x11')](_0x63a1('0xd'),auth['isAuthenticated'](),controller[_0x63a1('0x12')]);router['post'](_0x63a1('0xe'),auth[_0x63a1('0x9')](),controller['addTeams']);router[_0x63a1('0x13')](_0x63a1('0x14'),auth[_0x63a1('0x9')](),controller[_0x63a1('0x15')]);router[_0x63a1('0x16')](_0x63a1('0x14'),auth[_0x63a1('0x9')](),controller['destroy']);router['delete'](_0x63a1('0xd'),auth[_0x63a1('0x9')](),controller[_0x63a1('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x63a1('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd694=['removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete'];(function(_0x3953d7,_0x32b102){var _0x1d9e59=function(_0x4178f6){while(--_0x4178f6){_0x3953d7['push'](_0x3953d7['shift']());}};_0x1d9e59(++_0x32b102);}(_0xd694,0x11b));var _0x4d69=function(_0x1c3517,_0x29132c){_0x1c3517=_0x1c3517-0x0;var _0x414567=_0xd694[_0x1c3517];return _0x414567;};'use strict';var multer=require(_0x4d69('0x0'));var util=require('util');var path=require(_0x4d69('0x1'));var timeout=require(_0x4d69('0x2'));var express=require(_0x4d69('0x3'));var router=express[_0x4d69('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4d69('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d69('0x6'));var controller=require(_0x4d69('0x7'));router['get']('/',auth[_0x4d69('0x8')](),controller[_0x4d69('0x9')]);router[_0x4d69('0xa')](_0x4d69('0xb'),auth['isAuthenticated'](),controller[_0x4d69('0xc')]);router['get'](_0x4d69('0xd'),auth[_0x4d69('0x8')](),controller[_0x4d69('0xe')]);router['get']('/:id/users',auth[_0x4d69('0x8')](),controller[_0x4d69('0xf')]);router[_0x4d69('0xa')](_0x4d69('0x10'),auth[_0x4d69('0x8')](),controller[_0x4d69('0x11')]);router[_0x4d69('0x12')]('/',auth[_0x4d69('0x8')](),controller[_0x4d69('0x13')]);router['post'](_0x4d69('0x14'),auth[_0x4d69('0x8')](),controller[_0x4d69('0x15')]);router[_0x4d69('0x12')](_0x4d69('0x10'),auth[_0x4d69('0x8')](),controller['addTeams']);router[_0x4d69('0x16')]('/:id',auth[_0x4d69('0x8')](),controller[_0x4d69('0x17')]);router[_0x4d69('0x18')](_0x4d69('0xd'),auth[_0x4d69('0x8')](),controller['destroy']);router[_0x4d69('0x18')](_0x4d69('0x14'),auth[_0x4d69('0x8')](),controller[_0x4d69('0x19')]);router[_0x4d69('0x18')](_0x4d69('0x10'),auth[_0x4d69('0x8')](),controller[_0x4d69('0x1a')]);module[_0x4d69('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 91a8a68..d9b4c6c 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 _0xd085=['INTEGER','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd085,0x17b));var _0x5d08=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0xd085[_0x28611e];return _0x530f69;};'use strict';var Sequelize=require('sequelize');module[_0x5d08('0x0')]={'name':{'type':Sequelize[_0x5d08('0x1')],'allowNull':![],'unique':_0x5d08('0x2')},'prefix':{'type':Sequelize[_0x5d08('0x3')],'get':function(_0x51e00c){return _0x5d08('0x4')+this[_0x5d08('0x5')](_0x5d08('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x5d08('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x5d08('0x6')]}}; \ No newline at end of file +var _0x5309=['name','getDataValue','exports','STRING'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0x5309,0x1be));var _0x9530=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x5309[_0x3c858f];return _0x198090;};'use strict';var Sequelize=require('sequelize');module[_0x9530('0x0')]={'name':{'type':Sequelize[_0x9530('0x1')],'allowNull':![],'unique':_0x9530('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x416d81){return'system-'+this[_0x9530('0x3')](_0x9530('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x9530('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 55c7d3c..72228db 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 _0xeb3b=['params','rawAttributes','find','destroy','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','removeAgents','userVoicePrefix:remove','emit','getAgents','findOne','order','pick','nolimit','getTeams','Team','addTeams','findAll','User','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','forEach','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','VoicePrefixes','UserProfileResource','end','error','name','send','index','map','VoicePrefix','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','rows','catch','show'];(function(_0x45b5ab,_0x5f2cfc){var _0x3392ea=function(_0x588f83){while(--_0x588f83){_0x45b5ab['push'](_0x45b5ab['shift']());}};_0x3392ea(++_0x5f2cfc);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x3485f8,_0x1b66cf){_0x3485f8=_0x3485f8-0x0;var _0x1fbba7=_0xeb3b[_0x3485f8];return _0x1fbba7;};'use strict';var emlformat=require(_0xbeb3('0x0'));var rimraf=require(_0xbeb3('0x1'));var zipdir=require(_0xbeb3('0x2'));var jsonpatch=require(_0xbeb3('0x3'));var rp=require(_0xbeb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbeb3('0x5'));var util=require('util');var path=require(_0xbeb3('0x6'));var sox=require('sox');var csv=require(_0xbeb3('0x7'));var ejs=require(_0xbeb3('0x8'));var fs=require('fs');var fs_extra=require(_0xbeb3('0x9'));var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x7'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];config[_0xbeb3('0x19')]=_[_0xbeb3('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbeb3('0x1b'))(new Redis(config[_0xbeb3('0x19')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0xed9879,_0x40f586){_0x40f586=_0x40f586||0xcc;return function(_0x395d2b){if(_0x395d2b){return _0xed9879[_0xbeb3('0x1c')](_0x40f586);}return _0xed9879[_0xbeb3('0x1d')](_0x40f586)['end']();};}function respondWithResult(_0x1aeaee,_0x5970a1){_0x5970a1=_0x5970a1||0xc8;return function(_0x80ef55){if(_0x80ef55){return _0x1aeaee['status'](_0x5970a1)['json'](_0x80ef55);}};}function respondWithFilteredResult(_0x4f8481,_0x9bc0a4){return function(_0x44a4bb){if(_0x44a4bb){var _0x32275b=typeof _0x9bc0a4[_0xbeb3('0x1e')]==='undefined'&&typeof _0x9bc0a4[_0xbeb3('0x1f')]===_0xbeb3('0x20');var _0xe2cc47=_0x44a4bb['count'];var _0x4af96f=_0x32275b?0x0:_0x9bc0a4[_0xbeb3('0x1e')];var _0x57e8b6=_0x32275b?_0x44a4bb[_0xbeb3('0x21')]:_0x9bc0a4['offset']+_0x9bc0a4['limit'];var _0xfa2736;if(_0x57e8b6>=_0xe2cc47){_0x57e8b6=_0xe2cc47;_0xfa2736=0xc8;}else{_0xfa2736=0xce;}_0x4f8481[_0xbeb3('0x1d')](_0xfa2736);return _0x4f8481[_0xbeb3('0x22')]('Content-Range',_0x4af96f+'-'+_0x57e8b6+'/'+_0xe2cc47)[_0xbeb3('0x23')](_0x44a4bb);}return null;};}function patchUpdates(_0x18ea0f){return function(_0x5e047e){try{jsonpatch[_0xbeb3('0x24')](_0x5e047e,_0x18ea0f,!![]);}catch(_0x366bdb){return BPromise['reject'](_0x366bdb);}return _0x5e047e[_0xbeb3('0x25')]();};}function saveUpdates(_0x278fe4,_0x16b079){return function(_0x42c6c3){if(_0x42c6c3){return _0x42c6c3[_0xbeb3('0x26')](_0x278fe4)[_0xbeb3('0x27')](function(_0x84921a){return _0x84921a;});}return null;};}function removeEntity(_0x340581,_0x46fe17){return function(_0x59f27c){if(_0x59f27c){return _0x59f27c['destroy']()[_0xbeb3('0x27')](function(){var _0x520116=_0x59f27c[_0xbeb3('0x28')]({'plain':!![]});var _0xda808c=_0xbeb3('0x29');return db[_0xbeb3('0x2a')]['destroy']({'where':{'type':_0xda808c,'resourceId':_0x520116['id']}})[_0xbeb3('0x27')](function(){return _0x59f27c;});})['then'](function(){_0x340581[_0xbeb3('0x1d')](0xcc)[_0xbeb3('0x2b')]();});}};}function handleEntityNotFound(_0x5bd93d,_0x483198){return function(_0x9b8f13){if(!_0x9b8f13){_0x5bd93d['sendStatus'](0x194);}return _0x9b8f13;};}function handleError(_0x51f7ef,_0x520b8e){_0x520b8e=_0x520b8e||0x1f4;return function(_0x5bfef7){logger[_0xbeb3('0x2c')](_0x5bfef7['stack']);if(_0x5bfef7[_0xbeb3('0x2d')]){delete _0x5bfef7[_0xbeb3('0x2d')];}_0x51f7ef[_0xbeb3('0x1d')](_0x520b8e)[_0xbeb3('0x2e')](_0x5bfef7);};}exports[_0xbeb3('0x2f')]=function(_0x12f7d4,_0x411cd3){var _0x30fcd4={},_0x2dc0d4={},_0x3002e3={'count':0x0,'rows':[]};var _0x4ead3b=_[_0xbeb3('0x30')](db[_0xbeb3('0x31')]['rawAttributes'],function(_0xb46de){return{'name':_0xb46de[_0xbeb3('0x32')],'type':_0xb46de[_0xbeb3('0x33')][_0xbeb3('0x34')]};});_0x2dc0d4['model']=_[_0xbeb3('0x30')](_0x4ead3b,_0xbeb3('0x2d'));_0x2dc0d4[_0xbeb3('0x35')]=_[_0xbeb3('0x36')](_0x12f7d4[_0xbeb3('0x35')]);_0x2dc0d4[_0xbeb3('0x37')]=_[_0xbeb3('0x38')](_0x2dc0d4[_0xbeb3('0x39')],_0x2dc0d4[_0xbeb3('0x35')]);_0x30fcd4['attributes']=_[_0xbeb3('0x38')](_0x2dc0d4['model'],qs[_0xbeb3('0x3a')](_0x12f7d4[_0xbeb3('0x35')][_0xbeb3('0x3a')]));_0x30fcd4[_0xbeb3('0x3b')]=_0x30fcd4[_0xbeb3('0x3b')][_0xbeb3('0x3c')]?_0x30fcd4[_0xbeb3('0x3b')]:_0x2dc0d4[_0xbeb3('0x39')];if(!_0x12f7d4['query'][_0xbeb3('0x3d')]('nolimit')){_0x30fcd4['limit']=qs['limit'](_0x12f7d4[_0xbeb3('0x35')][_0xbeb3('0x1f')]);_0x30fcd4[_0xbeb3('0x1e')]=qs[_0xbeb3('0x1e')](_0x12f7d4[_0xbeb3('0x35')][_0xbeb3('0x1e')]);}_0x30fcd4['order']=qs[_0xbeb3('0x3e')](_0x12f7d4[_0xbeb3('0x35')][_0xbeb3('0x3e')]);_0x30fcd4['where']=qs['filters'](_['pick'](_0x12f7d4[_0xbeb3('0x35')],_0x2dc0d4[_0xbeb3('0x37')]),_0x4ead3b);if(_0x12f7d4[_0xbeb3('0x35')]['filter']){_0x30fcd4[_0xbeb3('0x3f')]=_['merge'](_0x30fcd4[_0xbeb3('0x3f')],{'$or':_[_0xbeb3('0x30')](_0x4ead3b,function(_0x12156b){if(_0x12156b[_0xbeb3('0x33')]!=='VIRTUAL'){var _0x5676da={};_0x5676da[_0x12156b[_0xbeb3('0x2d')]]={'$like':'%'+_0x12f7d4[_0xbeb3('0x35')][_0xbeb3('0x40')]+'%'};return _0x5676da;}})});}_0x30fcd4=_[_0xbeb3('0x41')]({},_0x30fcd4,_0x12f7d4[_0xbeb3('0x42')]);var _0x1c31f1={'where':_0x30fcd4[_0xbeb3('0x3f')]};return db[_0xbeb3('0x31')]['count'](_0x1c31f1)[_0xbeb3('0x27')](function(_0x39f2d2){_0x3002e3[_0xbeb3('0x21')]=_0x39f2d2;if(_0x12f7d4[_0xbeb3('0x35')][_0xbeb3('0x43')]){_0x30fcd4[_0xbeb3('0x44')]=[{'all':!![]}];}return db[_0xbeb3('0x31')]['findAll'](_0x30fcd4);})[_0xbeb3('0x27')](function(_0xd0403f){_0x3002e3[_0xbeb3('0x45')]=_0xd0403f;return _0x3002e3;})[_0xbeb3('0x27')](respondWithFilteredResult(_0x411cd3,_0x30fcd4))[_0xbeb3('0x46')](handleError(_0x411cd3,null));};exports[_0xbeb3('0x47')]=function(_0x390c95,_0x42e9a2){var _0x1a213d={'raw':![],'where':{'id':_0x390c95[_0xbeb3('0x48')]['id']}},_0x18a485={};_0x18a485[_0xbeb3('0x39')]=_[_0xbeb3('0x36')](db['VoicePrefix'][_0xbeb3('0x49')]);_0x18a485[_0xbeb3('0x35')]=_[_0xbeb3('0x36')](_0x390c95['query']);_0x18a485['filters']=_[_0xbeb3('0x38')](_0x18a485[_0xbeb3('0x39')],_0x18a485[_0xbeb3('0x35')]);_0x1a213d[_0xbeb3('0x3b')]=_['intersection'](_0x18a485[_0xbeb3('0x39')],qs['fields'](_0x390c95['query'][_0xbeb3('0x3a')]));_0x1a213d[_0xbeb3('0x3b')]=_0x1a213d[_0xbeb3('0x3b')][_0xbeb3('0x3c')]?_0x1a213d['attributes']:_0x18a485[_0xbeb3('0x39')];if(_0x390c95[_0xbeb3('0x35')][_0xbeb3('0x43')]){_0x1a213d['include']=[{'all':!![]}];}_0x1a213d=_[_0xbeb3('0x41')]({},_0x1a213d,_0x390c95['options']);return db['VoicePrefix'][_0xbeb3('0x4a')](_0x1a213d)[_0xbeb3('0x27')](handleEntityNotFound(_0x42e9a2,null))[_0xbeb3('0x27')](respondWithResult(_0x42e9a2,null))['catch'](handleError(_0x42e9a2,null));};exports[_0xbeb3('0x4b')]=function(_0x312b28,_0x367942){return db['VoicePrefix'][_0xbeb3('0x4a')]({'where':{'id':_0x312b28['params']['id']}})[_0xbeb3('0x27')](handleEntityNotFound(_0x367942,null))['then'](removeEntity(_0x367942,null))[_0xbeb3('0x46')](handleError(_0x367942,null));};exports[_0xbeb3('0x4c')]=function(_0x3294c9,_0x3b48e2){return db[_0xbeb3('0x31')][_0xbeb3('0x4c')]()[_0xbeb3('0x27')](respondWithResult(_0x3b48e2,null))[_0xbeb3('0x46')](handleError(_0x3b48e2,null));};exports['create']=function(_0xde022c,_0x2416c0){var _0xa852bb;return db[_0xbeb3('0x4d')]['transaction'](function(_0x2771e3){return db[_0xbeb3('0x31')][_0xbeb3('0x4e')](_0xde022c[_0xbeb3('0x4f')],{'transaction':_0x2771e3})['then'](function(_0x2d980d){_0xa852bb=_0x2d980d['get']({'plain':!![]});return db[_0xbeb3('0x50')][_0xbeb3('0x4a')]({'where':{'id':_0xa852bb[_0xbeb3('0x51')]},'raw':!![]})['then'](function(_0x43379e){return createVoicePrefixExtensions(_0xa852bb,_0x43379e,_0x2771e3);});});})[_0xbeb3('0x27')](function(){var _0x1afd05=_0xde022c[_0xbeb3('0x52')][_0xbeb3('0x28')]({'plain':!![]});if(!_0x1afd05)throw new Error(_0xbeb3('0x53'));if(_0x1afd05[_0xbeb3('0x54')]===_0xbeb3('0x52')){var _0x27024e=_0xa852bb;return db[_0xbeb3('0x55')]['find']({'where':{'name':_0xbeb3('0x29'),'userProfileId':_0x1afd05[_0xbeb3('0x56')]},'raw':!![]})[_0xbeb3('0x27')](function(_0x8660b4){if(_0x8660b4&&_0x8660b4[_0xbeb3('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x27024e[_0xbeb3('0x2d')],'resourceId':_0x27024e['id'],'type':_0x8660b4[_0xbeb3('0x2d')],'sectionId':_0x8660b4['id']},{})['then'](function(){return _0xa852bb;});}else{return _0xa852bb;}})[_0xbeb3('0x46')](function(_0x405354){logger[_0xbeb3('0x2c')](_0xbeb3('0x58'),_0x405354);throw _0x405354;});}return _0xa852bb;})[_0xbeb3('0x27')](respondWithResult(_0x2416c0,null))[_0xbeb3('0x46')](handleError(_0x2416c0,null));};function Extension(_0x15128c,_0x5d813b,_0x31bda5,_0x40b0c0){this[_0xbeb3('0x59')]='from-sip';this[_0xbeb3('0x5a')]=_0x15128c;this[_0xbeb3('0x5b')]=_0x31bda5;this['type']=_0xbeb3('0x5c');this[_0xbeb3('0x5d')]=_0xbeb3('0x5e');this[_0xbeb3('0x5f')]=_0x5d813b;this['appdata']=_0x40b0c0;}function createVoicePrefixExtensions(_0x553e8c,_0x278d22,_0x52888c){return new BPromise(function(_0x1c8857,_0x59f2e3){var _0x2d36cb=new Extension(formatPrefixName(_0x553e8c[_0xbeb3('0x60')]),0x1,_0xbeb3('0x61'),_0xbeb3('0x62'));_0x2d36cb[_0xbeb3('0x63')]=_0x553e8c['id'];return db[_0xbeb3('0x50')][_0xbeb3('0x4e')](_0x2d36cb,{'transaction':_0x52888c})[_0xbeb3('0x27')](function(_0xc78a7a){var _0x17718a=_0xc78a7a[_0xbeb3('0x28')]({'plain':!![]});var _0x143c0c=_[_0xbeb3('0x30')](addVoicePrefixExtensions(_0x553e8c,_0x278d22),function(_0x450ea3){_0x450ea3[_0xbeb3('0x51')]=_0x17718a['id'];_0x450ea3[_0xbeb3('0x63')]=_0x553e8c['id'];return _0x450ea3;});return db[_0xbeb3('0x50')][_0xbeb3('0x64')](_0x143c0c,{'transaction':_0x52888c})['then'](function(_0x15c890){if(!_0x15c890){return _0x59f2e3(_0xbeb3('0x65'));}else{return _0x1c8857(_0x15c890);}})[_0xbeb3('0x46')](function(_0x3dd579){return _0x59f2e3(_0x3dd579);});});;});};function addVoicePrefixExtensions(_0x1dfb62,_0x515c6a){var _0x39546e=[];var _0x53e04c=formatPrefixName(_0x1dfb62[_0xbeb3('0x60')]);_0x39546e[_0xbeb3('0x66')](new Extension(_0x53e04c,0x2,_0xbeb3('0x67'),_0xbeb3('0x68')+_0x1dfb62[_0xbeb3('0x2d')]));if(_0x1dfb62[_0xbeb3('0x69')]){_0x39546e[_0xbeb3('0x66')](new Extension(_0x53e04c,0x3,_0xbeb3('0x67'),_0xbeb3('0x6a')+_0x1dfb62[_0xbeb3('0x69')]));}else{_0x39546e[_0xbeb3('0x66')](new Extension(_0x53e04c,0x3,_0xbeb3('0x61'),_0xbeb3('0x6b')));}_0x39546e[_0xbeb3('0x66')](new Extension(_0x53e04c,0x4,_0xbeb3('0x6c'),_0x515c6a[_0xbeb3('0x59')]+','+_0xbeb3('0x6d')+(0x8+_0x1dfb62[_0xbeb3('0x2d')][_0xbeb3('0x3c')])+'}'+','+0x1));return _0x39546e;}function formatPrefixName(_0x166f45){var _0x44191f='_';for(var _0x1dc478=0x0;_0x1dc478<_0x166f45[_0xbeb3('0x3c')];_0x1dc478++){if(_0x166f45[_0xbeb3('0x6e')](_0x1dc478)=='-'){_0x44191f+=_0x166f45[_0xbeb3('0x6e')](_0x1dc478);}else{_0x44191f+='['+_0x166f45[_0xbeb3('0x6e')](_0x1dc478)+']';}}_0x44191f+='.';return _0x44191f;}exports[_0xbeb3('0x26')]=function(_0x12e49d,_0x22acf9,_0x378f38){var _0xe9ad41=_0x12e49d[_0xbeb3('0x4f')];_0xe9ad41[_0xbeb3('0x60')]=_0xbeb3('0x6f')+_0xe9ad41[_0xbeb3('0x2d')]+'-';return db[_0xbeb3('0x4d')]['transaction'](function(_0x32fa71){return db[_0xbeb3('0x31')]['update'](_0xe9ad41,{'where':{'id':_0xe9ad41['id']},'transaction':_0x32fa71})[_0xbeb3('0x27')](function(){return db[_0xbeb3('0x50')][_0xbeb3('0x4b')]({'where':{'VoicePrefixId':_0xe9ad41['id']},'transaction':_0x32fa71})['then'](function(){return db['VoiceExtension'][_0xbeb3('0x4a')]({'where':{'id':_0xe9ad41[_0xbeb3('0x51')]},'raw':!![]})[_0xbeb3('0x27')](function(_0xebc0bc){return createVoicePrefixExtensions(_0xe9ad41,_0xebc0bc,_0x32fa71);});});});})[_0xbeb3('0x27')](function(){return db['VoicePrefix'][_0xbeb3('0x70')](_0xe9ad41['id']);})[_0xbeb3('0x27')](respondWithResult(_0x22acf9,null))[_0xbeb3('0x46')](handleError(_0x22acf9,null));};exports[_0xbeb3('0x71')]=function(_0x1b619a,_0x48f3e0,_0x1502a2){return db['VoicePrefix']['find']({'where':{'id':_0x1b619a[_0xbeb3('0x48')]['id']}})['then'](handleEntityNotFound(_0x48f3e0,null))[_0xbeb3('0x27')](function(_0x262563){if(_0x262563){return _0x262563[_0xbeb3('0x71')](_0x1b619a[_0xbeb3('0x4f')][_0xbeb3('0x72')],_[_0xbeb3('0x73')](_0x1b619a[_0xbeb3('0x4f')],['ids','id'])||{})[_0xbeb3('0x74')](function(_0xde4a75){for(var _0x367541=0x0;_0x367541<_0x1b619a['body']['ids'][_0xbeb3('0x3c')];_0x367541+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x1b619a['body'][_0xbeb3('0x72')][_0x367541]),'VoicePrefixId':Number(_0x1b619a[_0xbeb3('0x48')]['id'])});}return _0xde4a75;});}})[_0xbeb3('0x27')](respondWithResult(_0x48f3e0,null))[_0xbeb3('0x46')](handleError(_0x48f3e0,null));};exports['removeAgents']=function(_0x52dc94,_0xe45627,_0x16d9dd){return db[_0xbeb3('0x31')]['find']({'where':{'id':_0x52dc94['params']['id']}})[_0xbeb3('0x27')](handleEntityNotFound(_0xe45627,null))[_0xbeb3('0x27')](function(_0x28b9c2){if(_0x28b9c2){return _0x28b9c2[_0xbeb3('0x75')](_0x52dc94[_0xbeb3('0x35')][_0xbeb3('0x72')])[_0xbeb3('0x27')](function(){if(_['isArray'](_0x52dc94['query'][_0xbeb3('0x72')])){for(var _0x3013d4=0x0;_0x3013d4<_0x52dc94['query']['ids'][_0xbeb3('0x3c')];_0x3013d4+=0x1){socket['emit'](_0xbeb3('0x76'),{'UserId':Number(_0x52dc94[_0xbeb3('0x35')][_0xbeb3('0x72')][_0x3013d4]),'VoicePrefixId':Number(_0x52dc94[_0xbeb3('0x48')]['id'])});}}else{socket[_0xbeb3('0x77')](_0xbeb3('0x76'),{'UserId':Number(_0x52dc94[_0xbeb3('0x35')][_0xbeb3('0x72')]),'VoicePrefixId':Number(_0x52dc94[_0xbeb3('0x48')]['id'])});}});}})[_0xbeb3('0x27')](respondWithStatusCode(_0xe45627,null))[_0xbeb3('0x46')](handleError(_0xe45627,null));};exports[_0xbeb3('0x78')]=function(_0x466d62,_0x153d12,_0xf931d){var _0x3f0f18={};var _0x29fd6c={};var _0x82ade6;var _0x5be6ad;return db['VoicePrefix'][_0xbeb3('0x79')]({'where':{'id':_0x466d62[_0xbeb3('0x48')]['id']}})['then'](handleEntityNotFound(_0x153d12,null))[_0xbeb3('0x27')](function(_0x5d23d4){if(_0x5d23d4){_0x82ade6=_0x5d23d4;_0x29fd6c[_0xbeb3('0x39')]=_[_0xbeb3('0x36')](db['User'][_0xbeb3('0x49')]);_0x29fd6c[_0xbeb3('0x35')]=_[_0xbeb3('0x36')](_0x466d62[_0xbeb3('0x35')]);_0x29fd6c[_0xbeb3('0x37')]=_[_0xbeb3('0x38')](_0x29fd6c[_0xbeb3('0x39')],_0x29fd6c[_0xbeb3('0x35')]);_0x3f0f18[_0xbeb3('0x3b')]=_[_0xbeb3('0x38')](_0x29fd6c[_0xbeb3('0x39')],qs[_0xbeb3('0x3a')](_0x466d62['query'][_0xbeb3('0x3a')]));_0x3f0f18[_0xbeb3('0x3b')]=_0x3f0f18[_0xbeb3('0x3b')][_0xbeb3('0x3c')]?_0x3f0f18[_0xbeb3('0x3b')]:_0x29fd6c['model'];_0x3f0f18[_0xbeb3('0x7a')]=qs[_0xbeb3('0x3e')](_0x466d62['query'][_0xbeb3('0x3e')]);_0x3f0f18['where']=qs['filters'](_[_0xbeb3('0x7b')](_0x466d62[_0xbeb3('0x35')],_0x29fd6c[_0xbeb3('0x37')]));if(_0x466d62['query'][_0xbeb3('0x40')]){_0x3f0f18[_0xbeb3('0x3f')]=_[_0xbeb3('0x41')](_0x3f0f18['where'],{'$or':_[_0xbeb3('0x30')](_0x3f0f18[_0xbeb3('0x3b')],function(_0x201677){var _0x54a50e={};_0x54a50e[_0x201677]={'$like':'%'+_0x466d62[_0xbeb3('0x35')][_0xbeb3('0x40')]+'%'};return _0x54a50e;})});}_0x3f0f18=_[_0xbeb3('0x41')]({},_0x3f0f18,_0x466d62[_0xbeb3('0x42')]);return _0x82ade6[_0xbeb3('0x78')](_0x3f0f18);}})['then'](function(_0xdb820a){if(_0xdb820a){_0x5be6ad=_0xdb820a['length'];if(!_0x466d62[_0xbeb3('0x35')][_0xbeb3('0x3d')](_0xbeb3('0x7c'))){_0x3f0f18['limit']=qs[_0xbeb3('0x1f')](_0x466d62[_0xbeb3('0x35')][_0xbeb3('0x1f')]);_0x3f0f18[_0xbeb3('0x1e')]=qs[_0xbeb3('0x1e')](_0x466d62[_0xbeb3('0x35')]['offset']);}return _0x82ade6['getAgents'](_0x3f0f18);}})[_0xbeb3('0x27')](function(_0x393b66){if(_0x393b66){return _0x393b66?{'count':_0x5be6ad,'rows':_0x393b66}:null;}})[_0xbeb3('0x27')](respondWithResult(_0x153d12,null))['catch'](handleError(_0x153d12,null));};exports[_0xbeb3('0x7d')]=function(_0x4d5d73,_0x26a52d,_0x332543){var _0x4f44fb={};var _0x5c13e0={};var _0x2a9a98;var _0x560a0c;return db[_0xbeb3('0x31')][_0xbeb3('0x79')]({'where':{'id':_0x4d5d73['params']['id']}})[_0xbeb3('0x27')](handleEntityNotFound(_0x26a52d,null))['then'](function(_0x179de1){if(_0x179de1){_0x2a9a98=_0x179de1;_0x5c13e0['model']=_[_0xbeb3('0x36')](db[_0xbeb3('0x7e')][_0xbeb3('0x49')]);_0x5c13e0[_0xbeb3('0x35')]=_[_0xbeb3('0x36')](_0x4d5d73[_0xbeb3('0x35')]);_0x5c13e0[_0xbeb3('0x37')]=_[_0xbeb3('0x38')](_0x5c13e0['model'],_0x5c13e0['query']);_0x4f44fb[_0xbeb3('0x3b')]=_[_0xbeb3('0x38')](_0x5c13e0[_0xbeb3('0x39')],qs['fields'](_0x4d5d73[_0xbeb3('0x35')][_0xbeb3('0x3a')]));_0x4f44fb[_0xbeb3('0x3b')]=_0x4f44fb[_0xbeb3('0x3b')][_0xbeb3('0x3c')]?_0x4f44fb['attributes']:_0x5c13e0[_0xbeb3('0x39')];_0x4f44fb[_0xbeb3('0x7a')]=qs[_0xbeb3('0x3e')](_0x4d5d73['query'][_0xbeb3('0x3e')]);_0x4f44fb[_0xbeb3('0x3f')]=qs[_0xbeb3('0x37')](_[_0xbeb3('0x7b')](_0x4d5d73[_0xbeb3('0x35')],_0x5c13e0[_0xbeb3('0x37')]));if(_0x4d5d73[_0xbeb3('0x35')]['filter']){_0x4f44fb[_0xbeb3('0x3f')]=_[_0xbeb3('0x41')](_0x4f44fb[_0xbeb3('0x3f')],{'$or':_[_0xbeb3('0x30')](_0x4f44fb[_0xbeb3('0x3b')],function(_0x3e53af){var _0x52ef84={};_0x52ef84[_0x3e53af]={'$like':'%'+_0x4d5d73[_0xbeb3('0x35')][_0xbeb3('0x40')]+'%'};return _0x52ef84;})});}_0x4f44fb=_[_0xbeb3('0x41')]({},_0x4f44fb,_0x4d5d73['options']);return _0x2a9a98['getTeams'](_0x4f44fb);}})['then'](function(_0x14a29d){if(_0x14a29d){_0x560a0c=_0x14a29d['length'];if(!_0x4d5d73['query'][_0xbeb3('0x3d')]('nolimit')){_0x4f44fb['limit']=qs[_0xbeb3('0x1f')](_0x4d5d73['query'][_0xbeb3('0x1f')]);_0x4f44fb[_0xbeb3('0x1e')]=qs[_0xbeb3('0x1e')](_0x4d5d73['query'][_0xbeb3('0x1e')]);}return _0x2a9a98['getTeams'](_0x4f44fb);}})[_0xbeb3('0x27')](function(_0x104dd9){if(_0x104dd9){return _0x104dd9?{'count':_0x560a0c,'rows':_0x104dd9}:null;}})[_0xbeb3('0x27')](respondWithResult(_0x26a52d,null))[_0xbeb3('0x46')](handleError(_0x26a52d,null));};exports[_0xbeb3('0x7f')]=function(_0x3732be,_0x121994,_0x4e400e){var _0x226858=_0x3732be['body']['ids'];var _0x564ec8;return db['Team'][_0xbeb3('0x80')]({'where':{'id':_0x226858},'attributes':['id'],'include':[{'model':db[_0xbeb3('0x81')],'as':_0xbeb3('0x82'),'attributes':['id','name',_0xbeb3('0x83'),_0xbeb3('0x84'),_0xbeb3('0x85')],'raw':!![]}]})[_0xbeb3('0x27')](function(_0x212e32){if(_0x212e32){_0x564ec8=_0x212e32;var _0x432cdf=_[_0xbeb3('0x86')](_0x212e32,function(_0x475b09){var _0x1703ff=_0x475b09['get']({'plain':!![]});return _0x1703ff[_0xbeb3('0x82')];});return db['VoicePrefix'][_0xbeb3('0x4a')]({'where':{'id':_0x3732be[_0xbeb3('0x48')]['id']}})[_0xbeb3('0x27')](function(_0x25f2b4){return db['sequelize'][_0xbeb3('0x87')](function(_0x531dd8){return _0x25f2b4[_0xbeb3('0x7f')](_0x226858,{'transaction':_0x531dd8})[_0xbeb3('0x27')](function(){return BPromise[_0xbeb3('0x88')](_0x564ec8,function(_0x53f0c3){return db[_0xbeb3('0x89')][_0xbeb3('0x8a')]({'TeamId':_0x53f0c3['id'],'VoicePrefixId':_0x3732be[_0xbeb3('0x48')]['id']},{'transaction':_0x531dd8});});})[_0xbeb3('0x27')](function(){return BPromise[_0xbeb3('0x88')](_0x432cdf,function(_0x26897b){return db[_0xbeb3('0x8b')][_0xbeb3('0x8c')]({'where':{'UserId':_0x26897b['id'],'VoicePrefixId':_0x3732be[_0xbeb3('0x48')]['id']},'transaction':_0x531dd8});});})[_0xbeb3('0x27')](function(){_0x432cdf['forEach'](function(_0x6480d0){socket[_0xbeb3('0x77')]('userVoicePrefix:save',{'UserId':_0x6480d0['id'],'VoicePrefixId':_0x25f2b4['id']});});});});});}})[_0xbeb3('0x27')](respondWithStatusCode(_0x121994,null))[_0xbeb3('0x46')](handleError(_0x121994,null));};exports['removeTeams']=function(_0x296b8f,_0x76df64,_0x2744ed){return db['Team']['findAll']({'where':{'id':_0x296b8f[_0xbeb3('0x35')][_0xbeb3('0x72')]},'attributes':['id'],'include':[{'model':db[_0xbeb3('0x81')],'as':_0xbeb3('0x82'),'attributes':['id'],'raw':!![]}]})[_0xbeb3('0x27')](handleEntityNotFound(_0x76df64,null))['then'](function(_0x2dea1d){var _0x5f266f=_['map'](_0x2dea1d,'id');var _0x38b933=[];var _0xfbecae=[];var _0x8e33e8=squel[_0xbeb3('0x8d')]();_0x8e33e8[_0xbeb3('0x8e')](_0xbeb3('0x8f'))[_0xbeb3('0x90')](_0xbeb3('0x91'),'tq')[_0xbeb3('0x92')](_0xbeb3('0x93'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbeb3('0x3f')](_0xbeb3('0x94'),_0x296b8f[_0xbeb3('0x48')]['id']);for(var _0xdf203a=0x0;_0xdf203a<_0x2dea1d[_0xbeb3('0x3c')];_0xdf203a+=0x1){let _0xa80e4a=_0x2dea1d[_0xdf203a];for(var _0x41ab0a=0x0;_0x41ab0a<_0xa80e4a[_0xbeb3('0x82')][_0xbeb3('0x3c')];_0x41ab0a+=0x1){let _0x845f14=_0xa80e4a['Agents'][_0x41ab0a];var _0x2c805=_0x8e33e8[_0xbeb3('0x95')]();_0x2c805[_0xbeb3('0x3f')](_0xbeb3('0x96'),_0x845f14['id']);_0xfbecae[_0xbeb3('0x66')](db[_0xbeb3('0x4d')][_0xbeb3('0x35')](_0x2c805['toString'](),{'type':db[_0xbeb3('0x4d')]['QueryTypes'][_0xbeb3('0x97')]})[_0xbeb3('0x27')](function(_0x5d5ca6){if(_0x5d5ca6[_0xbeb3('0x3c')]===0x1){return _0x845f14['id'];}else{var _0xea74ad=_[_0xbeb3('0x98')](_['map'](_0x5d5ca6,_0xbeb3('0x99')),function(_0x2601bd){return _[_0xbeb3('0x9a')](_0x5f266f,_0x2601bd);});if(_0xea74ad){return _0x845f14['id'];}}}));}}return BPromise[_0xbeb3('0x9b')](_0xfbecae)[_0xbeb3('0x27')](function(_0x1fe82c){_0x38b933=_(_0x38b933)[_0xbeb3('0x9c')](_0x1fe82c)[_0xbeb3('0x9d')]()[_0xbeb3('0x9e')]();return db['VoicePrefix'][_0xbeb3('0x4a')]({'where':{'id':_0x296b8f['params']['id']}})[_0xbeb3('0x27')](function(_0x29b9fb){return db[_0xbeb3('0x4d')][_0xbeb3('0x87')](function(_0x1ab1bf){return _0x29b9fb[_0xbeb3('0x9f')](_0x296b8f[_0xbeb3('0x35')]['ids'],{'transaction':_0x1ab1bf})[_0xbeb3('0x27')](function(){if(!_[_0xbeb3('0xa0')](_0x38b933)){return _0x29b9fb['removeAgents'](_0x38b933,{'transaction':_0x1ab1bf});}})[_0xbeb3('0x27')](function(){_0x38b933[_0xbeb3('0xa1')](function(_0x4ec623){socket['emit'](_0xbeb3('0x76'),{'UserId':_0x4ec623,'VoicePrefixId':_0x29b9fb['id']});});});});});});})[_0xbeb3('0x27')](respondWithStatusCode(_0x76df64,null))[_0xbeb3('0x46')](handleError(_0x76df64,null));}; \ No newline at end of file +var _0xdb28=['length','nolimit','order','sort','where','filters','pick','filter','merge','VoicePrefix','includeAll','include','findAll','rows','catch','params','fields','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','findById','addAgents','omit','spread','ids','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','findOne','User','options','hasOwnProperty','getAgents','getTeams','rawAttributes','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','VoicePrefixes','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x12ceab,_0x26e82a){var _0x247715=function(_0x41dcdc){while(--_0x41dcdc){_0x12ceab['push'](_0x12ceab['shift']());}};_0x247715(++_0x26e82a);}(_0xdb28,0x106));var _0x8db2=function(_0x29a056,_0x27616d){_0x29a056=_0x29a056-0x0;var _0xa02b53=_0xdb28[_0x29a056];return _0xa02b53;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];config[_0x8db2('0x19')]=_[_0x8db2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8db2('0x1b'))(new Redis(config[_0x8db2('0x19')]));require(_0x8db2('0x1c'))[_0x8db2('0x1d')](socket);function respondWithStatusCode(_0x227355,_0xfa285b){_0xfa285b=_0xfa285b||0xcc;return function(_0x2f177a){if(_0x2f177a){return _0x227355[_0x8db2('0x1e')](_0xfa285b);}return _0x227355[_0x8db2('0x1f')](_0xfa285b)[_0x8db2('0x20')]();};}function respondWithResult(_0x5489a9,_0x13b0f5){_0x13b0f5=_0x13b0f5||0xc8;return function(_0x24da1b){if(_0x24da1b){return _0x5489a9['status'](_0x13b0f5)[_0x8db2('0x21')](_0x24da1b);}};}function respondWithFilteredResult(_0x44957d,_0x21db8c){return function(_0x3fddc2){if(_0x3fddc2){var _0x2efd06=typeof _0x21db8c[_0x8db2('0x22')]==='undefined'&&typeof _0x21db8c['limit']===_0x8db2('0x23');var _0x104e33=_0x3fddc2[_0x8db2('0x24')];var _0x1b64e4=_0x2efd06?0x0:_0x21db8c['offset'];var _0x431d60=_0x2efd06?_0x3fddc2[_0x8db2('0x24')]:_0x21db8c[_0x8db2('0x22')]+_0x21db8c[_0x8db2('0x25')];var _0x3dbe8e;if(_0x431d60>=_0x104e33){_0x431d60=_0x104e33;_0x3dbe8e=0xc8;}else{_0x3dbe8e=0xce;}_0x44957d['status'](_0x3dbe8e);return _0x44957d[_0x8db2('0x26')](_0x8db2('0x27'),_0x1b64e4+'-'+_0x431d60+'/'+_0x104e33)[_0x8db2('0x21')](_0x3fddc2);}return null;};}function patchUpdates(_0x125be2){return function(_0x2260d8){try{jsonpatch[_0x8db2('0x28')](_0x2260d8,_0x125be2,!![]);}catch(_0x796ec1){return BPromise['reject'](_0x796ec1);}return _0x2260d8[_0x8db2('0x29')]();};}function saveUpdates(_0x4f6516,_0x5725f0){return function(_0x52a9ca){if(_0x52a9ca){return _0x52a9ca['update'](_0x4f6516)[_0x8db2('0x2a')](function(_0x29b5cd){return _0x29b5cd;});}return null;};}function removeEntity(_0x3be281,_0x2baed0){return function(_0x145328){if(_0x145328){return _0x145328[_0x8db2('0x2b')]()['then'](function(){var _0x3544ba=_0x145328[_0x8db2('0x2c')]({'plain':!![]});var _0x430dd5=_0x8db2('0x2d');return db['UserProfileResource'][_0x8db2('0x2b')]({'where':{'type':_0x430dd5,'resourceId':_0x3544ba['id']}})[_0x8db2('0x2a')](function(){return _0x145328;});})[_0x8db2('0x2a')](function(){_0x3be281[_0x8db2('0x1f')](0xcc)[_0x8db2('0x20')]();});}};}function handleEntityNotFound(_0x21bae5,_0xa54ea3){return function(_0x3124d5){if(!_0x3124d5){_0x21bae5[_0x8db2('0x1e')](0x194);}return _0x3124d5;};}function handleError(_0x493cab,_0x4718ec){_0x4718ec=_0x4718ec||0x1f4;return function(_0x50b28d){logger['error'](_0x50b28d[_0x8db2('0x2e')]);if(_0x50b28d[_0x8db2('0x2f')]){delete _0x50b28d[_0x8db2('0x2f')];}_0x493cab['status'](_0x4718ec)[_0x8db2('0x30')](_0x50b28d);};}exports['index']=function(_0x3f7aac,_0x2b653b){var _0x14bd12={},_0x4d9e26={},_0x56e9c1={'count':0x0,'rows':[]};var _0x35d337=_[_0x8db2('0x31')](db['VoicePrefix']['rawAttributes'],function(_0x173989){return{'name':_0x173989[_0x8db2('0x32')],'type':_0x173989[_0x8db2('0x33')][_0x8db2('0x34')]};});_0x4d9e26[_0x8db2('0x35')]=_[_0x8db2('0x31')](_0x35d337,_0x8db2('0x2f'));_0x4d9e26[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x3f7aac[_0x8db2('0x36')]);_0x4d9e26['filters']=_[_0x8db2('0x38')](_0x4d9e26[_0x8db2('0x35')],_0x4d9e26['query']);_0x14bd12[_0x8db2('0x39')]=_[_0x8db2('0x38')](_0x4d9e26['model'],qs['fields'](_0x3f7aac[_0x8db2('0x36')]['fields']));_0x14bd12[_0x8db2('0x39')]=_0x14bd12[_0x8db2('0x39')][_0x8db2('0x3a')]?_0x14bd12[_0x8db2('0x39')]:_0x4d9e26['model'];if(!_0x3f7aac[_0x8db2('0x36')]['hasOwnProperty'](_0x8db2('0x3b'))){_0x14bd12[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0x3f7aac[_0x8db2('0x36')]['limit']);_0x14bd12['offset']=qs[_0x8db2('0x22')](_0x3f7aac[_0x8db2('0x36')]['offset']);}_0x14bd12[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0x3f7aac[_0x8db2('0x36')]['sort']);_0x14bd12[_0x8db2('0x3e')]=qs[_0x8db2('0x3f')](_[_0x8db2('0x40')](_0x3f7aac[_0x8db2('0x36')],_0x4d9e26[_0x8db2('0x3f')]),_0x35d337);if(_0x3f7aac[_0x8db2('0x36')][_0x8db2('0x41')]){_0x14bd12[_0x8db2('0x3e')]=_[_0x8db2('0x42')](_0x14bd12[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x35d337,function(_0x20bf0b){if(_0x20bf0b[_0x8db2('0x33')]!=='VIRTUAL'){var _0x3ee510={};_0x3ee510[_0x20bf0b[_0x8db2('0x2f')]]={'$like':'%'+_0x3f7aac['query']['filter']+'%'};return _0x3ee510;}})});}_0x14bd12=_[_0x8db2('0x42')]({},_0x14bd12,_0x3f7aac['options']);var _0x130eb9={'where':_0x14bd12[_0x8db2('0x3e')]};return db[_0x8db2('0x43')][_0x8db2('0x24')](_0x130eb9)[_0x8db2('0x2a')](function(_0x30d606){_0x56e9c1[_0x8db2('0x24')]=_0x30d606;if(_0x3f7aac['query'][_0x8db2('0x44')]){_0x14bd12[_0x8db2('0x45')]=[{'all':!![]}];}return db[_0x8db2('0x43')][_0x8db2('0x46')](_0x14bd12);})['then'](function(_0x424c27){_0x56e9c1[_0x8db2('0x47')]=_0x424c27;return _0x56e9c1;})[_0x8db2('0x2a')](respondWithFilteredResult(_0x2b653b,_0x14bd12))[_0x8db2('0x48')](handleError(_0x2b653b,null));};exports['show']=function(_0x12d62d,_0x4e0749){var _0x19bd06={'raw':![],'where':{'id':_0x12d62d[_0x8db2('0x49')]['id']}},_0x116b69={};_0x116b69['model']=_['keys'](db[_0x8db2('0x43')]['rawAttributes']);_0x116b69[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x12d62d[_0x8db2('0x36')]);_0x116b69[_0x8db2('0x3f')]=_[_0x8db2('0x38')](_0x116b69[_0x8db2('0x35')],_0x116b69[_0x8db2('0x36')]);_0x19bd06[_0x8db2('0x39')]=_[_0x8db2('0x38')](_0x116b69[_0x8db2('0x35')],qs[_0x8db2('0x4a')](_0x12d62d[_0x8db2('0x36')]['fields']));_0x19bd06[_0x8db2('0x39')]=_0x19bd06[_0x8db2('0x39')][_0x8db2('0x3a')]?_0x19bd06[_0x8db2('0x39')]:_0x116b69['model'];if(_0x12d62d['query'][_0x8db2('0x44')]){_0x19bd06[_0x8db2('0x45')]=[{'all':!![]}];}_0x19bd06=_[_0x8db2('0x42')]({},_0x19bd06,_0x12d62d['options']);return db['VoicePrefix']['find'](_0x19bd06)[_0x8db2('0x2a')](handleEntityNotFound(_0x4e0749,null))[_0x8db2('0x2a')](respondWithResult(_0x4e0749,null))[_0x8db2('0x48')](handleError(_0x4e0749,null));};exports[_0x8db2('0x2b')]=function(_0xaab731,_0x4195ef){return db[_0x8db2('0x43')]['find']({'where':{'id':_0xaab731['params']['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x4195ef,null))[_0x8db2('0x2a')](removeEntity(_0x4195ef,null))[_0x8db2('0x48')](handleError(_0x4195ef,null));};exports[_0x8db2('0x4b')]=function(_0x3daed6,_0x2bf408){return db[_0x8db2('0x43')][_0x8db2('0x4b')]()[_0x8db2('0x2a')](respondWithResult(_0x2bf408,null))[_0x8db2('0x48')](handleError(_0x2bf408,null));};exports[_0x8db2('0x4c')]=function(_0x319273,_0x345c74){var _0x2d518a;return db[_0x8db2('0x4d')]['transaction'](function(_0x2ded23){return db[_0x8db2('0x43')]['create'](_0x319273[_0x8db2('0x4e')],{'transaction':_0x2ded23})[_0x8db2('0x2a')](function(_0x3af298){_0x2d518a=_0x3af298['get']({'plain':!![]});return db[_0x8db2('0x4f')][_0x8db2('0x50')]({'where':{'id':_0x2d518a[_0x8db2('0x51')]},'raw':!![]})[_0x8db2('0x2a')](function(_0x1167d5){return createVoicePrefixExtensions(_0x2d518a,_0x1167d5,_0x2ded23);});});})['then'](function(){var _0x467505=_0x319273[_0x8db2('0x52')][_0x8db2('0x2c')]({'plain':!![]});if(!_0x467505)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x467505[_0x8db2('0x53')]===_0x8db2('0x52')){var _0x33dddd=_0x2d518a;return db[_0x8db2('0x54')][_0x8db2('0x50')]({'where':{'name':_0x8db2('0x2d'),'userProfileId':_0x467505[_0x8db2('0x55')]},'raw':!![]})['then'](function(_0x39ff90){if(_0x39ff90&&_0x39ff90[_0x8db2('0x56')]===0x0){return db['UserProfileResource'][_0x8db2('0x4c')]({'name':_0x33dddd[_0x8db2('0x2f')],'resourceId':_0x33dddd['id'],'type':_0x39ff90['name'],'sectionId':_0x39ff90['id']},{})[_0x8db2('0x2a')](function(){return _0x2d518a;});}else{return _0x2d518a;}})[_0x8db2('0x48')](function(_0x63e8f7){logger[_0x8db2('0x57')](_0x8db2('0x58'),_0x63e8f7);throw _0x63e8f7;});}return _0x2d518a;})[_0x8db2('0x2a')](respondWithResult(_0x345c74,null))[_0x8db2('0x48')](handleError(_0x345c74,null));};function Extension(_0x33a600,_0x120ef2,_0x173a5e,_0x12fd12){this[_0x8db2('0x59')]=_0x8db2('0x5a');this[_0x8db2('0x5b')]=_0x33a600;this[_0x8db2('0x5c')]=_0x173a5e;this[_0x8db2('0x33')]='system';this[_0x8db2('0x5d')]=_0x8db2('0x5e');this[_0x8db2('0x5f')]=_0x120ef2;this[_0x8db2('0x60')]=_0x12fd12;}function createVoicePrefixExtensions(_0x349db0,_0x53b2dc,_0x3dd6b1){return new BPromise(function(_0x2c3087,_0x3ab670){var _0x1e1c0d=new Extension(formatPrefixName(_0x349db0[_0x8db2('0x61')]),0x1,_0x8db2('0x62'),_0x8db2('0x63'));_0x1e1c0d[_0x8db2('0x64')]=_0x349db0['id'];return db[_0x8db2('0x4f')][_0x8db2('0x4c')](_0x1e1c0d,{'transaction':_0x3dd6b1})[_0x8db2('0x2a')](function(_0xfe6bac){var _0x170a72=_0xfe6bac[_0x8db2('0x2c')]({'plain':!![]});var _0xed9d36=_[_0x8db2('0x31')](addVoicePrefixExtensions(_0x349db0,_0x53b2dc),function(_0x1d7862){_0x1d7862[_0x8db2('0x51')]=_0x170a72['id'];_0x1d7862['VoicePrefixId']=_0x349db0['id'];return _0x1d7862;});return db[_0x8db2('0x4f')]['bulkCreate'](_0xed9d36,{'transaction':_0x3dd6b1})[_0x8db2('0x2a')](function(_0x570c53){if(!_0x570c53){return _0x3ab670(_0x8db2('0x65'));}else{return _0x2c3087(_0x570c53);}})[_0x8db2('0x48')](function(_0xe4fd6a){return _0x3ab670(_0xe4fd6a);});});;});};function addVoicePrefixExtensions(_0x1e2ccd,_0x1e812e){var _0x59a32e=[];var _0x50c5fb=formatPrefixName(_0x1e2ccd[_0x8db2('0x61')]);_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x2,_0x8db2('0x67'),_0x8db2('0x68')+_0x1e2ccd[_0x8db2('0x2f')]));if(_0x1e2ccd[_0x8db2('0x69')]){_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x3,_0x8db2('0x67'),'PREFIX-CALLERIDALL='+_0x1e2ccd[_0x8db2('0x69')]));}else{_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x3,_0x8db2('0x62'),_0x8db2('0x6a')));}_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x4,_0x8db2('0x6b'),_0x1e812e[_0x8db2('0x59')]+','+_0x8db2('0x6c')+(0x8+_0x1e2ccd['name']['length'])+'}'+','+0x1));return _0x59a32e;}function formatPrefixName(_0x358009){var _0x2f8beb='_';for(var _0x1d2dfc=0x0;_0x1d2dfc<_0x358009[_0x8db2('0x3a')];_0x1d2dfc++){if(_0x358009[_0x8db2('0x6d')](_0x1d2dfc)=='-'){_0x2f8beb+=_0x358009['charAt'](_0x1d2dfc);}else{_0x2f8beb+='['+_0x358009['charAt'](_0x1d2dfc)+']';}}_0x2f8beb+='.';return _0x2f8beb;}exports[_0x8db2('0x6e')]=function(_0x364807,_0x54f0d4,_0xa698bd){var _0x2be647=_0x364807[_0x8db2('0x4e')];_0x2be647['prefix']=_0x8db2('0x6f')+_0x2be647[_0x8db2('0x2f')]+'-';return db[_0x8db2('0x4d')]['transaction'](function(_0x3ff023){return db[_0x8db2('0x43')][_0x8db2('0x6e')](_0x2be647,{'where':{'id':_0x2be647['id']},'transaction':_0x3ff023})[_0x8db2('0x2a')](function(){return db[_0x8db2('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x2be647['id']},'transaction':_0x3ff023})[_0x8db2('0x2a')](function(){return db[_0x8db2('0x4f')][_0x8db2('0x50')]({'where':{'id':_0x2be647['VoiceExtensionId']},'raw':!![]})['then'](function(_0x2cdf3c){return createVoicePrefixExtensions(_0x2be647,_0x2cdf3c,_0x3ff023);});});});})[_0x8db2('0x2a')](function(){return db['VoicePrefix'][_0x8db2('0x70')](_0x2be647['id']);})[_0x8db2('0x2a')](respondWithResult(_0x54f0d4,null))[_0x8db2('0x48')](handleError(_0x54f0d4,null));};exports[_0x8db2('0x71')]=function(_0xbf1fce,_0x16848b,_0x395ebb){return db[_0x8db2('0x43')][_0x8db2('0x50')]({'where':{'id':_0xbf1fce[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x16848b,null))[_0x8db2('0x2a')](function(_0x24a52d){if(_0x24a52d){return _0x24a52d['addAgents'](_0xbf1fce[_0x8db2('0x4e')]['ids'],_[_0x8db2('0x72')](_0xbf1fce[_0x8db2('0x4e')],['ids','id'])||{})[_0x8db2('0x73')](function(_0x2fa89d){for(var _0x5cdf53=0x0;_0x5cdf53<_0xbf1fce[_0x8db2('0x4e')][_0x8db2('0x74')][_0x8db2('0x3a')];_0x5cdf53+=0x1){socket[_0x8db2('0x75')](_0x8db2('0x76'),{'UserId':Number(_0xbf1fce[_0x8db2('0x4e')][_0x8db2('0x74')][_0x5cdf53]),'VoicePrefixId':Number(_0xbf1fce[_0x8db2('0x49')]['id'])});}return _0x2fa89d;});}})[_0x8db2('0x2a')](respondWithResult(_0x16848b,null))['catch'](handleError(_0x16848b,null));};exports['removeAgents']=function(_0x198c3b,_0x508f4a,_0xf8afa5){return db[_0x8db2('0x43')][_0x8db2('0x50')]({'where':{'id':_0x198c3b['params']['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x508f4a,null))[_0x8db2('0x2a')](function(_0x3e37e7){if(_0x3e37e7){return _0x3e37e7['removeAgents'](_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')])[_0x8db2('0x2a')](function(){if(_[_0x8db2('0x77')](_0x198c3b['query'][_0x8db2('0x74')])){for(var _0x5f61b8=0x0;_0x5f61b8<_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')][_0x8db2('0x3a')];_0x5f61b8+=0x1){socket[_0x8db2('0x75')](_0x8db2('0x78'),{'UserId':Number(_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')][_0x5f61b8]),'VoicePrefixId':Number(_0x198c3b[_0x8db2('0x49')]['id'])});}}else{socket[_0x8db2('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')]),'VoicePrefixId':Number(_0x198c3b[_0x8db2('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x508f4a,null))['catch'](handleError(_0x508f4a,null));};exports['getAgents']=function(_0xa09b1d,_0xdba223,_0x3191c8){var _0x454377={};var _0x2ad024={};var _0x313918;var _0x339d09;return db[_0x8db2('0x43')][_0x8db2('0x79')]({'where':{'id':_0xa09b1d[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0xdba223,null))['then'](function(_0x360a06){if(_0x360a06){_0x313918=_0x360a06;_0x2ad024[_0x8db2('0x35')]=_[_0x8db2('0x37')](db[_0x8db2('0x7a')]['rawAttributes']);_0x2ad024['query']=_[_0x8db2('0x37')](_0xa09b1d[_0x8db2('0x36')]);_0x2ad024['filters']=_[_0x8db2('0x38')](_0x2ad024[_0x8db2('0x35')],_0x2ad024[_0x8db2('0x36')]);_0x454377['attributes']=_['intersection'](_0x2ad024['model'],qs[_0x8db2('0x4a')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x4a')]));_0x454377[_0x8db2('0x39')]=_0x454377[_0x8db2('0x39')]['length']?_0x454377[_0x8db2('0x39')]:_0x2ad024['model'];_0x454377[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x3d')]);_0x454377[_0x8db2('0x3e')]=qs['filters'](_['pick'](_0xa09b1d[_0x8db2('0x36')],_0x2ad024['filters']));if(_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x41')]){_0x454377[_0x8db2('0x3e')]=_[_0x8db2('0x42')](_0x454377[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x454377['attributes'],function(_0x19f9a0){var _0x222ea2={};_0x222ea2[_0x19f9a0]={'$like':'%'+_0xa09b1d[_0x8db2('0x36')]['filter']+'%'};return _0x222ea2;})});}_0x454377=_[_0x8db2('0x42')]({},_0x454377,_0xa09b1d[_0x8db2('0x7b')]);return _0x313918['getAgents'](_0x454377);}})[_0x8db2('0x2a')](function(_0x7cb97d){if(_0x7cb97d){_0x339d09=_0x7cb97d[_0x8db2('0x3a')];if(!_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x7c')](_0x8db2('0x3b'))){_0x454377[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0xa09b1d[_0x8db2('0x36')]['limit']);_0x454377[_0x8db2('0x22')]=qs[_0x8db2('0x22')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x22')]);}return _0x313918[_0x8db2('0x7d')](_0x454377);}})[_0x8db2('0x2a')](function(_0x16d1c5){if(_0x16d1c5){return _0x16d1c5?{'count':_0x339d09,'rows':_0x16d1c5}:null;}})[_0x8db2('0x2a')](respondWithResult(_0xdba223,null))[_0x8db2('0x48')](handleError(_0xdba223,null));};exports[_0x8db2('0x7e')]=function(_0x5e6fc4,_0x3e79cc,_0x7e4bf){var _0x339ffe={};var _0x1587e8={};var _0x5d371b;var _0x4589c7;return db[_0x8db2('0x43')][_0x8db2('0x79')]({'where':{'id':_0x5e6fc4['params']['id']}})['then'](handleEntityNotFound(_0x3e79cc,null))[_0x8db2('0x2a')](function(_0x6e5a58){if(_0x6e5a58){_0x5d371b=_0x6e5a58;_0x1587e8[_0x8db2('0x35')]=_[_0x8db2('0x37')](db['Team'][_0x8db2('0x7f')]);_0x1587e8[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x5e6fc4[_0x8db2('0x36')]);_0x1587e8['filters']=_[_0x8db2('0x38')](_0x1587e8[_0x8db2('0x35')],_0x1587e8[_0x8db2('0x36')]);_0x339ffe['attributes']=_['intersection'](_0x1587e8['model'],qs[_0x8db2('0x4a')](_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x4a')]));_0x339ffe[_0x8db2('0x39')]=_0x339ffe['attributes']['length']?_0x339ffe[_0x8db2('0x39')]:_0x1587e8[_0x8db2('0x35')];_0x339ffe[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x3d')]);_0x339ffe['where']=qs[_0x8db2('0x3f')](_['pick'](_0x5e6fc4[_0x8db2('0x36')],_0x1587e8[_0x8db2('0x3f')]));if(_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x41')]){_0x339ffe[_0x8db2('0x3e')]=_['merge'](_0x339ffe[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x339ffe['attributes'],function(_0x28beec){var _0x1334ea={};_0x1334ea[_0x28beec]={'$like':'%'+_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x41')]+'%'};return _0x1334ea;})});}_0x339ffe=_['merge']({},_0x339ffe,_0x5e6fc4[_0x8db2('0x7b')]);return _0x5d371b['getTeams'](_0x339ffe);}})['then'](function(_0xaa90b9){if(_0xaa90b9){_0x4589c7=_0xaa90b9[_0x8db2('0x3a')];if(!_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x7c')](_0x8db2('0x3b'))){_0x339ffe[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0x5e6fc4['query'][_0x8db2('0x25')]);_0x339ffe['offset']=qs['offset'](_0x5e6fc4[_0x8db2('0x36')]['offset']);}return _0x5d371b['getTeams'](_0x339ffe);}})[_0x8db2('0x2a')](function(_0x1642a7){if(_0x1642a7){return _0x1642a7?{'count':_0x4589c7,'rows':_0x1642a7}:null;}})[_0x8db2('0x2a')](respondWithResult(_0x3e79cc,null))['catch'](handleError(_0x3e79cc,null));};exports[_0x8db2('0x80')]=function(_0xb2ab8e,_0x30d410,_0x555ed0){var _0x27a916=_0xb2ab8e[_0x8db2('0x4e')][_0x8db2('0x74')];var _0x7ff636;return db[_0x8db2('0x81')][_0x8db2('0x46')]({'where':{'id':_0x27a916},'attributes':['id'],'include':[{'model':db[_0x8db2('0x7a')],'as':_0x8db2('0x82'),'attributes':['id','name',_0x8db2('0x83'),_0x8db2('0x84'),_0x8db2('0x85')],'raw':!![]}]})[_0x8db2('0x2a')](function(_0x20d69b){if(_0x20d69b){_0x7ff636=_0x20d69b;var _0x36199d=_[_0x8db2('0x86')](_0x20d69b,function(_0x2910c8){var _0x3a53e2=_0x2910c8[_0x8db2('0x2c')]({'plain':!![]});return _0x3a53e2[_0x8db2('0x82')];});return db['VoicePrefix'][_0x8db2('0x50')]({'where':{'id':_0xb2ab8e[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](function(_0x58063b){return db[_0x8db2('0x4d')][_0x8db2('0x87')](function(_0x3c105f){return _0x58063b['addTeams'](_0x27a916,{'transaction':_0x3c105f})['then'](function(){return BPromise[_0x8db2('0x88')](_0x7ff636,function(_0x17d3ee){return db[_0x8db2('0x89')][_0x8db2('0x8a')]({'TeamId':_0x17d3ee['id'],'VoicePrefixId':_0xb2ab8e[_0x8db2('0x49')]['id']},{'transaction':_0x3c105f});});})[_0x8db2('0x2a')](function(){return BPromise[_0x8db2('0x88')](_0x36199d,function(_0x1f1aa5){return db[_0x8db2('0x8b')][_0x8db2('0x8c')]({'where':{'UserId':_0x1f1aa5['id'],'VoicePrefixId':_0xb2ab8e['params']['id']},'transaction':_0x3c105f});});})[_0x8db2('0x2a')](function(){_0x36199d[_0x8db2('0x8d')](function(_0x5b8adc){socket[_0x8db2('0x75')](_0x8db2('0x76'),{'UserId':_0x5b8adc['id'],'VoicePrefixId':_0x58063b['id']});});});});});}})[_0x8db2('0x2a')](respondWithStatusCode(_0x30d410,null))[_0x8db2('0x48')](handleError(_0x30d410,null));};exports[_0x8db2('0x8e')]=function(_0x2e4fb3,_0x8f84e4,_0x372efd){return db[_0x8db2('0x81')][_0x8db2('0x46')]({'where':{'id':_0x2e4fb3[_0x8db2('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8db2('0x7a')],'as':_0x8db2('0x82'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x2a')](handleEntityNotFound(_0x8f84e4,null))[_0x8db2('0x2a')](function(_0x1d27e3){var _0x296981=_['map'](_0x1d27e3,'id');var _0x137788=[];var _0x19bc4d=[];var _0x339dbf=squel[_0x8db2('0x8f')]();_0x339dbf[_0x8db2('0x90')](_0x8db2('0x91'))[_0x8db2('0x92')](_0x8db2('0x93'),'tq')[_0x8db2('0x94')](_0x8db2('0x95'),'ut',_0x8db2('0x96'))['where']('VoicePrefixId\x20=\x20?',_0x2e4fb3[_0x8db2('0x49')]['id']);for(var _0x56f59b=0x0;_0x56f59b<_0x1d27e3[_0x8db2('0x3a')];_0x56f59b+=0x1){let _0xccdab2=_0x1d27e3[_0x56f59b];for(var _0x2428f1=0x0;_0x2428f1<_0xccdab2['Agents'][_0x8db2('0x3a')];_0x2428f1+=0x1){let _0x28cfee=_0xccdab2[_0x8db2('0x82')][_0x2428f1];var _0x3e154a=_0x339dbf['clone']();_0x3e154a[_0x8db2('0x3e')](_0x8db2('0x97'),_0x28cfee['id']);_0x19bc4d[_0x8db2('0x66')](db['sequelize'][_0x8db2('0x36')](_0x3e154a[_0x8db2('0x98')](),{'type':db[_0x8db2('0x4d')]['QueryTypes'][_0x8db2('0x99')]})[_0x8db2('0x2a')](function(_0x41957f){if(_0x41957f['length']===0x1){return _0x28cfee['id'];}else{var _0x18ac5c=_[_0x8db2('0x9a')](_['map'](_0x41957f,_0x8db2('0x9b')),function(_0x231360){return _['includes'](_0x296981,_0x231360);});if(_0x18ac5c){return _0x28cfee['id'];}}}));}}return BPromise[_0x8db2('0x9c')](_0x19bc4d)[_0x8db2('0x2a')](function(_0x3d2729){_0x137788=_(_0x137788)['union'](_0x3d2729)['compact']()[_0x8db2('0x9d')]();return db['VoicePrefix']['find']({'where':{'id':_0x2e4fb3[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](function(_0x37fda2){return db[_0x8db2('0x4d')][_0x8db2('0x87')](function(_0x3695cd){return _0x37fda2['removeTeams'](_0x2e4fb3['query'][_0x8db2('0x74')],{'transaction':_0x3695cd})[_0x8db2('0x2a')](function(){if(!_[_0x8db2('0x9e')](_0x137788)){return _0x37fda2[_0x8db2('0x9f')](_0x137788,{'transaction':_0x3695cd});}})['then'](function(){_0x137788[_0x8db2('0x8d')](function(_0x51d15e){socket[_0x8db2('0x75')]('userVoicePrefix:remove',{'UserId':_0x51d15e,'VoicePrefixId':_0x37fda2['id']});});});});});});})[_0x8db2('0x2a')](respondWithStatusCode(_0x8f84e4,null))[_0x8db2('0x48')](handleError(_0x8f84e4,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 40f0f1d..86ffc15 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 _0xe626=['hook','exports','events','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty'];(function(_0x4cab86,_0xc9414){var _0x4a0762=function(_0x10bbff){while(--_0x10bbff){_0x4cab86['push'](_0x4cab86['shift']());}};_0x4a0762(++_0xc9414);}(_0xe626,0x124));var _0x6e62=function(_0xf136bc,_0x4cb677){_0xf136bc=_0xf136bc-0x0;var _0x447aa6=_0xe626[_0xf136bc];return _0x447aa6;};'use strict';var EventEmitter=require(_0x6e62('0x0'));var VoicePrefix=require(_0x6e62('0x1'))['db'][_0x6e62('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e62('0x3'),'afterUpdate':_0x6e62('0x4'),'afterDestroy':_0x6e62('0x5')};function emitEvent(_0x166d6b){return function(_0x10cb1a,_0x2992f3,_0xa26913){VoicePrefixEvents[_0x6e62('0x6')](_0x166d6b+':'+_0x10cb1a['id'],_0x10cb1a);VoicePrefixEvents[_0x6e62('0x6')](_0x166d6b,_0x10cb1a);_0xa26913(null);};}for(var e in events){if(events[_0x6e62('0x7')](e)){var event=events[e];VoicePrefix[_0x6e62('0x8')](e,emitEvent(event));}}module[_0x6e62('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0xf27c=['update','remove','emit','exports','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf27c,0x70));var _0xcf27=function(_0x64ada5,_0x2d4c76){_0x64ada5=_0x64ada5-0x0;var _0xc420a6=_0xf27c[_0x64ada5];return _0xc420a6;};'use strict';var EventEmitter=require(_0xcf27('0x0'));var VoicePrefix=require(_0xcf27('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf27('0x2'),'afterDestroy':_0xcf27('0x3')};function emitEvent(_0x4d7fd7){return function(_0x32047f,_0x48f2ba,_0x148c83){VoicePrefixEvents[_0xcf27('0x4')](_0x4d7fd7+':'+_0x32047f['id'],_0x32047f);VoicePrefixEvents[_0xcf27('0x4')](_0x4d7fd7,_0x32047f);_0x148c83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xcf27('0x5')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index cae63e7..946fd6e 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 _0xa428=['voice_prefixes','util','../../config/logger','moment','bluebird','path','rimraf','./voicePrefix.attributes','exports','VoicePrefix'];(function(_0x33bc0d,_0x57aa0d){var _0x97447a=function(_0x16191a){while(--_0x16191a){_0x33bc0d['push'](_0x33bc0d['shift']());}};_0x97447a(++_0x57aa0d);}(_0xa428,0x187));var _0x8a42=function(_0x45af38,_0x4db8f7){_0x45af38=_0x45af38-0x0;var _0x1c22b0=_0xa428[_0x45af38];return _0x1c22b0;};'use strict';var _=require('lodash');var util=require(_0x8a42('0x0'));var logger=require(_0x8a42('0x1'))('api');var moment=require(_0x8a42('0x2'));var BPromise=require(_0x8a42('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a42('0x4'));var rimraf=require(_0x8a42('0x5'));var config=require('../../config/environment');var attributes=require(_0x8a42('0x6'));module[_0x8a42('0x7')]=function(_0x471ece,_0xba43fa){return _0x471ece['define'](_0x8a42('0x8'),attributes,{'tableName':_0x8a42('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe657=['define','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0xe657,0xd0));var _0x7e65=function(_0x31701d,_0x25897a){_0x31701d=_0x31701d-0x0;var _0x422109=_0xe657[_0x31701d];return _0x422109;};'use strict';var _=require('lodash');var util=require(_0x7e65('0x0'));var logger=require(_0x7e65('0x1'))(_0x7e65('0x2'));var moment=require(_0x7e65('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e65('0x4'));var rimraf=require(_0x7e65('0x5'));var config=require(_0x7e65('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x7e65('0x7')]=function(_0x5c1abc,_0xe1e939){return _0x5c1abc[_0x7e65('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index fe2d080..da33b65 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 _0xb422=['localhost','socket.io-emitter','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','redis'];(function(_0x2e7237,_0x5be71b){var _0x2cf3cc=function(_0x4ab597){while(--_0x4ab597){_0x2e7237['push'](_0x2e7237['shift']());}};_0x2cf3cc(++_0x5be71b);}(_0xb422,0x85));var _0x2b42=function(_0x4ab6fc,_0x74d68a){_0x4ab6fc=_0x4ab6fc-0x0;var _0x187477=_0xb422[_0x4ab6fc];return _0x187477;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2b42('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b42('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b42('0x2'))('rpc');var config=require(_0x2b42('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x2b42('0x4')][_0x2b42('0x5')]({'port':0x232a});config[_0x2b42('0x6')]=_['defaults'](config[_0x2b42('0x6')],{'host':_0x2b42('0x7'),'port':0x18eb});var socket=require(_0x2b42('0x8'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x2b42('0x9')](socket);function respondWithRpcPromise(_0x5dc850,_0x132066,_0xcc84af){return new BPromise(function(_0x1dcab0,_0x1ec844){return client['request'](_0x5dc850,_0xcc84af)[_0x2b42('0xa')](function(_0x18f30b){logger['info'](_0x2b42('0xb'),_0x132066,_0x2b42('0xc'));logger[_0x2b42('0xd')](_0x2b42('0xe'),_0x132066,'request\x20sent',JSON['stringify'](_0x18f30b));if(_0x18f30b[_0x2b42('0xf')]){if(_0x18f30b[_0x2b42('0xf')]['code']===0x1f4){logger[_0x2b42('0xf')](_0x2b42('0xb'),_0x132066,_0x18f30b[_0x2b42('0xf')][_0x2b42('0x10')]);return _0x1ec844(_0x18f30b[_0x2b42('0xf')][_0x2b42('0x10')]);}logger[_0x2b42('0xf')](_0x2b42('0xb'),_0x132066,_0x18f30b[_0x2b42('0xf')][_0x2b42('0x10')]);return _0x1dcab0(_0x18f30b['error'][_0x2b42('0x10')]);}else{logger[_0x2b42('0x11')](_0x2b42('0xb'),_0x132066,_0x2b42('0xc'));_0x1dcab0(_0x18f30b[_0x2b42('0x12')][_0x2b42('0x10')]);}})[_0x2b42('0x13')](function(_0x4728f4){logger['error'](_0x2b42('0xb'),_0x132066,_0x4728f4);_0x1ec844(_0x4728f4);});});} \ No newline at end of file +var _0xed5c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','lodash'];(function(_0x287bc8,_0x26b6c0){var _0x5796f5=function(_0xafdb75){while(--_0xafdb75){_0x287bc8['push'](_0x287bc8['shift']());}};_0x5796f5(++_0x26b6c0);}(_0xed5c,0x81));var _0xced5=function(_0x9b250b,_0x22ccaf){_0x9b250b=_0x9b250b-0x0;var _0x153b87=_0xed5c[_0x9b250b];return _0x153b87;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var moment=require(_0xced5('0x2'));var BPromise=require(_0xced5('0x3'));var rs=require(_0xced5('0x4'));var fs=require('fs');var Redis=require(_0xced5('0x5'));var db=require(_0xced5('0x6'))['db'];var utils=require(_0xced5('0x7'));var logger=require(_0xced5('0x8'))(_0xced5('0x9'));var config=require('../../config/environment');var jayson=require(_0xced5('0xa'));var client=jayson[_0xced5('0xb')]['http']({'port':0x232a});config['redis']=_[_0xced5('0xc')](config[_0xced5('0xd')],{'host':_0xced5('0xe'),'port':0x18eb});var socket=require(_0xced5('0xf'))(new Redis(config[_0xced5('0xd')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x708a5a,_0x2f2606,_0x37d308){return new BPromise(function(_0x10fd53,_0x5b760e){return client[_0xced5('0x10')](_0x708a5a,_0x37d308)['then'](function(_0x3ba212){logger[_0xced5('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0xced5('0x12'));logger['debug'](_0xced5('0x13'),_0x2f2606,_0xced5('0x12'),JSON[_0xced5('0x14')](_0x3ba212));if(_0x3ba212[_0xced5('0x15')]){if(_0x3ba212[_0xced5('0x15')][_0xced5('0x16')]===0x1f4){logger[_0xced5('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0x3ba212['error'][_0xced5('0x17')]);return _0x5b760e(_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);return _0x10fd53(_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);}else{logger[_0xced5('0x11')](_0xced5('0x18'),_0x2f2606,'request\x20sent');_0x10fd53(_0x3ba212[_0xced5('0x19')][_0xced5('0x17')]);}})['catch'](function(_0x33851d){logger[_0xced5('0x15')](_0xced5('0x18'),_0x2f2606,_0x33851d);_0x5b760e(_0x33851d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7d9aa6d..5c99340 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 _0x37b4=['remove','update','emit','voicePrefix:','./voicePrefix.events'];(function(_0xe088cd,_0x38d843){var _0x3d5903=function(_0xf091f){while(--_0xf091f){_0xe088cd['push'](_0xe088cd['shift']());}};_0x3d5903(++_0x38d843);}(_0x37b4,0xef));var _0x437b=function(_0x27def7,_0x3f0835){_0x27def7=_0x27def7-0x0;var _0x581cbc=_0x37b4[_0x27def7];return _0x581cbc;};'use strict';var VoicePrefixEvents=require(_0x437b('0x0'));var events=['save',_0x437b('0x1'),_0x437b('0x2')];function createListener(_0xc42699,_0x5bc1e3){return function(_0x308d00){_0x5bc1e3[_0x437b('0x3')](_0xc42699,_0x308d00);};}function removeListener(_0x317df4,_0x3d353d){return function(){VoicePrefixEvents['removeListener'](_0x317df4,_0x3d353d);};}exports['register']=function(_0x1bab79){for(var _0x560099=0x0,_0x3c7dea=events['length'];_0x560099<_0x3c7dea;_0x560099++){var _0x226e3c=events[_0x560099];var _0x5df980=createListener(_0x437b('0x4')+_0x226e3c,_0x1bab79);VoicePrefixEvents['on'](_0x226e3c,_0x5df980);}}; \ No newline at end of file +var _0x2821=['save','remove','update','emit','removeListener','length','voicePrefix:','./voicePrefix.events'];(function(_0x168a78,_0x33c04c){var _0x841237=function(_0x50ab51){while(--_0x50ab51){_0x168a78['push'](_0x168a78['shift']());}};_0x841237(++_0x33c04c);}(_0x2821,0x87));var _0x1282=function(_0x518875,_0x13a368){_0x518875=_0x518875-0x0;var _0xd1c60c=_0x2821[_0x518875];return _0xd1c60c;};'use strict';var VoicePrefixEvents=require(_0x1282('0x0'));var events=[_0x1282('0x1'),_0x1282('0x2'),_0x1282('0x3')];function createListener(_0x27c0ae,_0x1bebaa){return function(_0x279fa6){_0x1bebaa[_0x1282('0x4')](_0x27c0ae,_0x279fa6);};}function removeListener(_0x3f5e68,_0x7c8e0f){return function(){VoicePrefixEvents[_0x1282('0x5')](_0x3f5e68,_0x7c8e0f);};}exports['register']=function(_0x31e0cf){for(var _0x1843f2=0x0,_0x293947=events[_0x1282('0x6')];_0x1843f2<_0x293947;_0x1843f2++){var _0xa4eee9=events[_0x1843f2];var _0x1a8666=createListener(_0x1282('0x7')+_0xa4eee9,_0x31e0cf);VoicePrefixEvents['on'](_0xa4eee9,_0x1a8666);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index da511e3..181c692 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 _0x6800=['isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/users','/:id/members','getMembers','/:id/lists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addAgents','addLists','put','/:id','update','delete','destroy','removeTeams','removeAgents','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get'];(function(_0x3d5ad8,_0x338d1c){var _0x40bf6a=function(_0x4be312){while(--_0x4be312){_0x3d5ad8['push'](_0x3d5ad8['shift']());}};_0x40bf6a(++_0x338d1c);}(_0x6800,0x1d6));var _0x0680=function(_0x1e6059,_0x3b6730){_0x1e6059=_0x1e6059-0x0;var _0x59c48b=_0x6800[_0x1e6059];return _0x59c48b;};'use strict';var multer=require(_0x0680('0x0'));var util=require(_0x0680('0x1'));var path=require(_0x0680('0x2'));var timeout=require(_0x0680('0x3'));var express=require(_0x0680('0x4'));var router=express['Router']();var fs_extra=require(_0x0680('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0680('0x6'));var config=require(_0x0680('0x7'));var controller=require(_0x0680('0x8'));router[_0x0680('0x9')]('/',auth[_0x0680('0xa')](),controller['index']);router[_0x0680('0x9')]('/:id',auth[_0x0680('0xa')](),controller[_0x0680('0xb')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0680('0xc')]);router['get'](_0x0680('0xd'),auth[_0x0680('0xa')](),controller[_0x0680('0xe')]);router['get'](_0x0680('0xf'),auth['isAuthenticated'](),controller[_0x0680('0x10')]);router[_0x0680('0x9')](_0x0680('0x11'),auth['isAuthenticated'](),controller[_0x0680('0x12')]);router[_0x0680('0x9')]('/:id/teams',auth[_0x0680('0xa')](),controller['getTeams']);router['get'](_0x0680('0x13'),auth[_0x0680('0xa')](),controller['getAgents']);router[_0x0680('0x9')](_0x0680('0x14'),auth['isAuthenticated'](),controller[_0x0680('0x15')]);router[_0x0680('0x9')](_0x0680('0x16'),auth[_0x0680('0xa')](),controller['getLists']);router[_0x0680('0x9')]('/:id/blacklists',auth[_0x0680('0xa')](),controller[_0x0680('0x17')]);router[_0x0680('0x18')]('/',auth['isAuthenticated'](),controller[_0x0680('0x19')]);router[_0x0680('0x18')](_0x0680('0x1a'),auth['isAuthenticated'](),controller[_0x0680('0x1b')]);router[_0x0680('0x18')](_0x0680('0x1c'),auth['isAuthenticated'](),controller['addTeams']);router[_0x0680('0x18')](_0x0680('0x13'),auth[_0x0680('0xa')](),controller[_0x0680('0x1d')]);router[_0x0680('0x18')]('/:id/lists',auth[_0x0680('0xa')](),controller[_0x0680('0x1e')]);router[_0x0680('0x18')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0x0680('0x1f')](_0x0680('0x20'),auth[_0x0680('0xa')](),controller[_0x0680('0x21')]);router[_0x0680('0x22')](_0x0680('0x20'),auth['isAuthenticated'](),controller[_0x0680('0x23')]);router[_0x0680('0x22')](_0x0680('0x1c'),auth[_0x0680('0xa')](),controller[_0x0680('0x24')]);router['delete'](_0x0680('0x13'),auth[_0x0680('0xa')](),controller[_0x0680('0x25')]);router[_0x0680('0x22')](_0x0680('0x16'),auth[_0x0680('0xa')](),controller['removeLists']);router[_0x0680('0x22')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x0680('0x26')]);module[_0x0680('0x27')]=router; \ No newline at end of file +var _0x201e=['getHopperFinals','getHopperBlacks','getTeams','/:id/users','getMembers','/:id/lists','/:id/blacklists','post','create','clone','addTeams','addAgents','addLists','addBlackLists','put','update','destroy','delete','/:id/teams','removeTeams','removeAgents','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0xb91507,_0x1a4296){var _0x1f1136=function(_0x561bc8){while(--_0x561bc8){_0xb91507['push'](_0xb91507['shift']());}};_0x1f1136(++_0x1a4296);}(_0x201e,0x1bb));var _0xe201=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x201e[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0xe201('0x0'));var util=require(_0xe201('0x1'));var path=require(_0xe201('0x2'));var timeout=require(_0xe201('0x3'));var express=require(_0xe201('0x4'));var router=express[_0xe201('0x5')]();var fs_extra=require(_0xe201('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe201('0x7'));var config=require('../../config/environment');var controller=require(_0xe201('0x8'));router[_0xe201('0x9')]('/',auth[_0xe201('0xa')](),controller[_0xe201('0xb')]);router[_0xe201('0x9')](_0xe201('0xc'),auth['isAuthenticated'](),controller[_0xe201('0xd')]);router[_0xe201('0x9')](_0xe201('0xe'),auth[_0xe201('0xa')](),controller[_0xe201('0xf')]);router[_0xe201('0x9')](_0xe201('0x10'),auth[_0xe201('0xa')](),controller[_0xe201('0x11')]);router[_0xe201('0x9')](_0xe201('0x12'),auth['isAuthenticated'](),controller[_0xe201('0x13')]);router['get']('/:id/hopper_black',auth[_0xe201('0xa')](),controller[_0xe201('0x14')]);router[_0xe201('0x9')]('/:id/teams',auth[_0xe201('0xa')](),controller[_0xe201('0x15')]);router[_0xe201('0x9')](_0xe201('0x16'),auth[_0xe201('0xa')](),controller['getAgents']);router[_0xe201('0x9')]('/:id/members',auth[_0xe201('0xa')](),controller[_0xe201('0x17')]);router[_0xe201('0x9')](_0xe201('0x18'),auth[_0xe201('0xa')](),controller['getLists']);router[_0xe201('0x9')](_0xe201('0x19'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xe201('0x1a')]('/',auth[_0xe201('0xa')](),controller[_0xe201('0x1b')]);router[_0xe201('0x1a')]('/:id/clone',auth['isAuthenticated'](),controller[_0xe201('0x1c')]);router['post']('/:id/teams',auth[_0xe201('0xa')](),controller[_0xe201('0x1d')]);router[_0xe201('0x1a')](_0xe201('0x16'),auth['isAuthenticated'](),controller[_0xe201('0x1e')]);router[_0xe201('0x1a')]('/:id/lists',auth[_0xe201('0xa')](),controller[_0xe201('0x1f')]);router[_0xe201('0x1a')](_0xe201('0x19'),auth[_0xe201('0xa')](),controller[_0xe201('0x20')]);router[_0xe201('0x21')](_0xe201('0xc'),auth[_0xe201('0xa')](),controller[_0xe201('0x22')]);router['delete'](_0xe201('0xc'),auth[_0xe201('0xa')](),controller[_0xe201('0x23')]);router[_0xe201('0x24')](_0xe201('0x25'),auth[_0xe201('0xa')](),controller[_0xe201('0x26')]);router['delete'](_0xe201('0x16'),auth[_0xe201('0xa')](),controller[_0xe201('0x27')]);router['delete'](_0xe201('0x18'),auth[_0xe201('0xa')](),controller['removeLists']);router[_0xe201('0x24')](_0xe201('0x19'),auth[_0xe201('0xa')](),controller[_0xe201('0x28')]);module[_0xe201('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 26f4bcf..f0d18b0 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 _0x72a2=['Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls','random','rrmemory','rrordered','strategy','getDataValue','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','split','joinempty','join','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.'];(function(_0x180582,_0x593c31){var _0x5b2638=function(_0x9e4e06){while(--_0x9e4e06){_0x180582['push'](_0x180582['shift']());}};_0x5b2638(++_0x593c31);}(_0x72a2,0x161));var _0x272a=function(_0xddc4f1,_0x458ec0){_0xddc4f1=_0xddc4f1-0x0;var _0x52ff6a=_0x72a2[_0xddc4f1];return _0x52ff6a;};'use strict';var Sequelize=require('sequelize');module[_0x272a('0x0')]={'name':{'type':Sequelize[_0x272a('0x1')],'allowNull':![],'unique':_0x272a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x272a('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x272a('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x272a('0x6'),_0x272a('0x7'),_0x272a('0x8'),_0x272a('0x9'),'linear','wrandom',_0x272a('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0x830fb6){this['setDataValue'](_0x272a('0xb'),_0x830fb6?_0x830fb6:_0x272a('0x9'));},'get':function(){var _0x103fff=this[_0x272a('0xc')]('type');var _0x4e1381=this[_0x272a('0xc')](_0x272a('0xd'));var _0x5c2e7a=this[_0x272a('0xc')](_0x272a('0xb'));if(_0x103fff===_0x272a('0x4')){return _0x5c2e7a;}if(_0x4e1381===_0x272a('0xe')&&_0x5c2e7a===_0x272a('0x9')||_0x4e1381==='booked'&&_0x5c2e7a===_0x272a('0xf')){return _0x5c2e7a;}if(_0x4e1381===_0x272a('0x10')||_0x4e1381===_0x272a('0x11')||_0x4e1381===_0x272a('0x12')){return _0x5c2e7a;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x272a('0x13')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x272a('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no',_0x272a('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x272a('0x13')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x272a('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x272a('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x272a('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x272a('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x272a('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x272a('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x272a('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x272a('0x3')]('yes','no'),'defaultValue':_0x272a('0x14')},'announce_holdtime':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no',_0x272a('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x272a('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x272a('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x272a('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x272a('0x1')]},'queue_youarenext':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x272a('0x1')]},'queue_quantity1':{'type':Sequelize[_0x272a('0x1')]},'queue_quantity2':{'type':Sequelize[_0x272a('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x272a('0x1')]},'queue_less_than':{'type':Sequelize[_0x272a('0x1')]},'periodic_announce':{'type':Sequelize[_0x272a('0x17')],'set':function(_0x14d866){this[_0x272a('0x18')](_0x272a('0x19'),_0x14d866?_0x14d866['join'](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x272a('0xc')]('periodic_announce')[_0x272a('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x272a('0x1')],'defaultValue':'yes','set':function(_0x17c49f){this[_0x272a('0x18')](_0x272a('0x1b'),_0x17c49f?_0x17c49f[_0x272a('0x1c')](','):undefined);},'get':function(){return this[_0x272a('0xc')](_0x272a('0x1b'))?this[_0x272a('0xc')](_0x272a('0x1b'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x272a('0x1')],'defaultValue':'no','set':function(_0x708c46){this[_0x272a('0x18')]('leavewhenempty',_0x708c46?_0x708c46[_0x272a('0x1c')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x272a('0xc')]('leavewhenempty')[_0x272a('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x272a('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x272a('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x272a('0x1')]},'description':{'type':Sequelize[_0x272a('0x1')]},'acw':{'type':Sequelize[_0x272a('0x1d')],'defaultValue':0x0,'set':function(_0x17b44c){this[_0x272a('0x18')](_0x272a('0x1e'),_0x17b44c);if(_0x17b44c){if(this['getDataValue'](_0x272a('0x1f'))<0x2){this[_0x272a('0x18')](_0x272a('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x272a('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x272a('0x1d')],'defaultValue':0x0,'comment':_0x272a('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x272a('0x10'),_0x272a('0x12'),_0x272a('0x11'),_0x272a('0xe')),'defaultValue':_0x272a('0x10'),'comment':_0x272a('0x21')},'dialLimitChannel':{'type':Sequelize[_0x272a('0x13')](0x4)[_0x272a('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x272a('0x23')},'dialLimitQueue':{'type':Sequelize[_0x272a('0x13')](0x4)[_0x272a('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x272a('0x24')},'dialPowerLevel':{'type':Sequelize[_0x272a('0x25')](0x2)[_0x272a('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x272a('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x272a('0x27'),_0x272a('0x28')),'defaultValue':'dropRate','comment':_0x272a('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x272a('0x25')](0x2)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x272a('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x272a('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x272a('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x272a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x272a('0x1')],'defaultValue':'tTxX','comment':_0x272a('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x272a('0x2d')},'dialQueueProject':{'type':Sequelize[_0x272a('0x1')],'comment':_0x272a('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x272a('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x272a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x272a('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x272a('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x272a('0x13')](0x5)[_0x272a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x272a('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x272a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x272a('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x272a('0x13')](0x5)[_0x272a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x272a('0x1')],'defaultValue':_0x272a('0x34')},'dialPrefix':{'type':Sequelize[_0x272a('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x35'),_0x272a('0x36'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x272a('0x13')](0x9)[_0x272a('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x272a('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x272a('0x13')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x272a('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x272a('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x272a('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x272a('0x13')](0x9)[_0x272a('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x272a('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x272a('0x13')](0x9)[_0x272a('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x272a('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x272a('0x13')](0x9)[_0x272a('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x272a('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x272a('0x13')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x272a('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x272a('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x272a('0x13')](0x9)[_0x272a('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x272a('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x272a('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x272a('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x272a('0x3')](_0x272a('0x3f'),_0x272a('0x40')),'defaultValue':_0x272a('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x272a('0x1')],'comment':_0x272a('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x272a('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x272a('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x272a('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x272a('0x13')](0x5)[_0x272a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x272a('0x43')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x272a('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x272a('0x13')](0x5)[_0x272a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x272a('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x272a('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x272a('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x272a('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0x272a('0x13')](0x5)[_0x272a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x272a('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x272a('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x272a('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x272a('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x272a('0x13')],'allowNull':!![],'comment':_0x272a('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x272a('0x1d')],'defaultValue':![],'comment':_0x272a('0x4c'),'set':function(_0x4dbe1b){if(!_0x4dbe1b)this[_0x272a('0x18')](_0x272a('0x4d'),null);this[_0x272a('0x18')](_0x272a('0x4e'),_0x4dbe1b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x272a('0x13')](0x3)[_0x272a('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x8169=['strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','inbound','outbound','ENUM','leastrecent','fewestcalls','random','rrmemory','rrordered'];(function(_0x5ad74d,_0xc5b4db){var _0x5b0b4f=function(_0x396ef9){while(--_0x396ef9){_0x5ad74d['push'](_0x5ad74d['shift']());}};_0x5b0b4f(++_0xc5b4db);}(_0x8169,0xd4));var _0x9816=function(_0x261fce,_0x103751){_0x261fce=_0x261fce-0x0;var _0x4b763b=_0x8169[_0x261fce];return _0x4b763b;};'use strict';var Sequelize=require(_0x9816('0x0'));module['exports']={'name':{'type':Sequelize[_0x9816('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x9816('0x2'),_0x9816('0x3')),'allowNull':![],'defaultValue':_0x9816('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x9816('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x9816('0x4')]('rr','ringall',_0x9816('0x5'),_0x9816('0x6'),_0x9816('0x7'),_0x9816('0x8'),'linear','wrandom',_0x9816('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x2a7e47){this['setDataValue'](_0x9816('0xa'),_0x2a7e47?_0x2a7e47:_0x9816('0x8'));},'get':function(){var _0x2a912f=this[_0x9816('0xb')](_0x9816('0xc'));var _0x36c69b=this[_0x9816('0xb')](_0x9816('0xd'));var _0x35b87f=this[_0x9816('0xb')]('strategy');if(_0x2a912f===_0x9816('0x2')){return _0x35b87f;}if(_0x36c69b===_0x9816('0xe')&&_0x35b87f===_0x9816('0x8')||_0x36c69b===_0x9816('0xe')&&_0x35b87f==='roundrobin'){return _0x35b87f;}if(_0x36c69b===_0x9816('0xf')||_0x36c69b===_0x9816('0x10')||_0x36c69b===_0x9816('0x11')){return _0x35b87f;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9816('0x12')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9816('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x9816('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no'),'defaultValue':_0x9816('0x13')},'autopause':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no',_0x9816('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9816('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9816('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9816('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9816('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9816('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9816('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9816('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9816('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9816('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x9816('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no'),'defaultValue':_0x9816('0x13')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x9816('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9816('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x9816('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9816('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9816('0x1')]},'queue_youarenext':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9816('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9816('0x1')]},'queue_quantity1':{'type':Sequelize[_0x9816('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x9816('0x1')]},'queue_less_than':{'type':Sequelize[_0x9816('0x1')]},'periodic_announce':{'type':Sequelize[_0x9816('0x16')],'set':function(_0x16f453){this[_0x9816('0x17')](_0x9816('0x18'),_0x16f453?_0x16f453['join'](','):[]);},'get':function(){return this['getDataValue'](_0x9816('0x18'))?this[_0x9816('0xb')](_0x9816('0x18'))[_0x9816('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x9816('0x1')],'defaultValue':_0x9816('0x13'),'set':function(_0x2a899a){this[_0x9816('0x17')](_0x9816('0x1a'),_0x2a899a?_0x2a899a[_0x9816('0x1b')](','):undefined);},'get':function(){return this[_0x9816('0xb')](_0x9816('0x1a'))?this[_0x9816('0xb')](_0x9816('0x1a'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9816('0x1')],'defaultValue':'no','set':function(_0x295c73){this[_0x9816('0x17')](_0x9816('0x1c'),_0x295c73?_0x295c73['join'](','):undefined);},'get':function(){return this[_0x9816('0xb')](_0x9816('0x1c'))?this[_0x9816('0xb')](_0x9816('0x1c'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x9816('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x9816('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9816('0x1')]},'description':{'type':Sequelize[_0x9816('0x1')]},'acw':{'type':Sequelize[_0x9816('0x1d')],'defaultValue':0x0,'set':function(_0x363979){this[_0x9816('0x17')](_0x9816('0x1e'),_0x363979);if(_0x363979){if(this['getDataValue'](_0x9816('0x1f'))<0x2){this[_0x9816('0x17')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9816('0x1d')],'defaultValue':0x0,'comment':_0x9816('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0x9816('0x21'),'progressive',_0x9816('0x11'),'predictive','booked'),'defaultValue':_0x9816('0xf'),'comment':_0x9816('0x22')},'dialLimitChannel':{'type':Sequelize[_0x9816('0x12')](0x4)[_0x9816('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9816('0x24')},'dialLimitQueue':{'type':Sequelize[_0x9816('0x12')](0x4)[_0x9816('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x9816('0x25')](0x2)[_0x9816('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9816('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x27'),'dropRate'),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x9816('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x9816('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9816('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9816('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9816('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9816('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9816('0x29')},'dialQueueOptions':{'type':Sequelize[_0x9816('0x1')],'defaultValue':_0x9816('0x2a'),'comment':_0x9816('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x9816('0x12')](0x3)[_0x9816('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9816('0x2c')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x9816('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9816('0x12')](0x3)[_0x9816('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9816('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9816('0x12')](0x5)[_0x9816('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9816('0x12')](0x3)[_0x9816('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x9816('0x12')](0x5)[_0x9816('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9816('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9816('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9816('0x12')](0x5)[_0x9816('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9816('0x30')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9816('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9816('0x31')},'dialTimezone':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9816('0x1')],'defaultValue':_0x9816('0x32')},'dialPrefix':{'type':Sequelize[_0x9816('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9816('0x4')](_0x9816('0x33'),_0x9816('0x34'),_0x9816('0x35')),'defaultValue':_0x9816('0x33')},'dialAMDActive':{'type':Sequelize[_0x9816('0x1d')],'defaultValue':0x0,'comment':_0x9816('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x9816('0x12')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9816('0x12')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9816('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9816('0x12')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9816('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9816('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9816('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9816('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9816('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9816('0x12')](0x9)[_0x9816('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9816('0x12')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9816('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9816('0x12')](0x5)[_0x9816('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9816('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9816('0x12')](0x9)[_0x9816('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9816('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x9816('0x12')](0x5)[_0x9816('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9816('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9816('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9816('0x4')]('DESC','ASC'),'defaultValue':_0x9816('0x40')},'dialQueueProject2':{'type':Sequelize[_0x9816('0x1')],'comment':_0x9816('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9816('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9816('0x12')](0x3)[_0x9816('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9816('0x41')},'dialCutDigit':{'type':Sequelize[_0x9816('0x12')](0x3)[_0x9816('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9816('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9816('0x12')](0x3)[_0x9816('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9816('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x9816('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9816('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9816('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9816('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9816('0x12')](0x5)[_0x9816('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9816('0x45')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9816('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9816('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9816('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9816('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9816('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9816('0x12')](0x5)[_0x9816('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9816('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9816('0x1d')],'defaultValue':![],'comment':_0x9816('0x48'),'set':function(_0x384004){if(!_0x384004)this[_0x9816('0x17')](_0x9816('0x49'),null);this[_0x9816('0x17')]('mandatoryDisposition',_0x384004);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x9816('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index e9add12..8d0dac2 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 _0x0e83=['params','createdAt','updatedAt','userProfileId','getHoppers','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','flatMap','forEach','penalty','each','upsert','findOrCreate','interface','format','SIP/%s','emit','userVoiceQueue:save','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','addAgents','omit','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','CmListId','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','onlyIfOpen','scheduledAt','COALESCE(phone,\x27\x27)','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','type','find','name','UserProfileResource','stack','send','index','VoiceQueue','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone'];(function(_0x289a73,_0x37f9a2){var _0x460ba0=function(_0x412de5){while(--_0x412de5){_0x289a73['push'](_0x289a73['shift']());}};_0x460ba0(++_0x37f9a2);}(_0x0e83,0x116));var _0x30e8=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x0e83[_0x2d34d6];return _0x1d3d12;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x30e8('0x0'));var jsonpatch=require(_0x30e8('0x1'));var rp=require(_0x30e8('0x2'));var moment=require(_0x30e8('0x3'));var BPromise=require(_0x30e8('0x4'));var Mustache=require('mustache');var util=require(_0x30e8('0x5'));var path=require(_0x30e8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30e8('0x7'));var _=require(_0x30e8('0x8'));var squel=require(_0x30e8('0x9'));var crypto=require(_0x30e8('0xa'));var jsforce=require(_0x30e8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x30e8('0xc'));var querystring=require(_0x30e8('0xd'));var Papa=require(_0x30e8('0xe'));var Redis=require(_0x30e8('0xf'));var authService=require(_0x30e8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x30e8('0x11'))(_0x30e8('0x12'));var utils=require(_0x30e8('0x13'));var config=require(_0x30e8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x30e8('0x15'))['db'];config['redis']=_[_0x30e8('0x16')](config[_0x30e8('0x17')],{'host':_0x30e8('0x18'),'port':0x18eb});var socket=require(_0x30e8('0x19'))(new Redis(config[_0x30e8('0x17')]));require(_0x30e8('0x1a'))[_0x30e8('0x1b')](socket);function respondWithStatusCode(_0x213300,_0x35072a){_0x35072a=_0x35072a||0xcc;return function(_0x1e48e5){if(_0x1e48e5){return _0x213300[_0x30e8('0x1c')](_0x35072a);}return _0x213300[_0x30e8('0x1d')](_0x35072a)[_0x30e8('0x1e')]();};}function respondWithResult(_0x156570,_0x523cc5){_0x523cc5=_0x523cc5||0xc8;return function(_0x3dfbce){if(_0x3dfbce){return _0x156570[_0x30e8('0x1d')](_0x523cc5)[_0x30e8('0x1f')](_0x3dfbce);}};}function respondWithFilteredResult(_0x501f20,_0x1ef65e){return function(_0x3fb1db){if(_0x3fb1db){var _0x22679d=typeof _0x1ef65e[_0x30e8('0x20')]==='undefined'&&typeof _0x1ef65e[_0x30e8('0x21')]===_0x30e8('0x22');var _0x7efa20=_0x3fb1db['count'];var _0x20a101=_0x22679d?0x0:_0x1ef65e['offset'];var _0x428867=_0x22679d?_0x3fb1db[_0x30e8('0x23')]:_0x1ef65e['offset']+_0x1ef65e[_0x30e8('0x21')];var _0x27e6f0;if(_0x428867>=_0x7efa20){_0x428867=_0x7efa20;_0x27e6f0=0xc8;}else{_0x27e6f0=0xce;}_0x501f20[_0x30e8('0x1d')](_0x27e6f0);return _0x501f20[_0x30e8('0x24')](_0x30e8('0x25'),_0x20a101+'-'+_0x428867+'/'+_0x7efa20)['json'](_0x3fb1db);}return null;};}function patchUpdates(_0x34c210){return function(_0x479c29){try{jsonpatch[_0x30e8('0x26')](_0x479c29,_0x34c210,!![]);}catch(_0x23f143){return BPromise['reject'](_0x23f143);}return _0x479c29[_0x30e8('0x27')]();};}function saveUpdates(_0x3de5c5,_0x20aa94){return function(_0x3bbf49){if(_0x3bbf49){return _0x3bbf49[_0x30e8('0x28')](_0x3de5c5)[_0x30e8('0x29')](function(_0x3a9408){return _0x3a9408;});}return null;};}function removeEntity(_0x46f336,_0xe58bd3){return function(_0x52379c){if(_0x52379c){return _0x52379c[_0x30e8('0x2a')]()[_0x30e8('0x29')](function(){var _0x225d8c=_0x52379c['get']({'plain':!![]});var _0x5532a2=[{'name':_0x30e8('0x2b'),'value':_0x30e8('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':_0x30e8('0x2d'),'ignore':![]}];var _0x271874=_(_0x5532a2)['filter'](_0x30e8('0x2e'))[_0x30e8('0x2f')](_0x30e8('0x30'))[_0x30e8('0x30')]();if(_['includes'](_0x271874,_0x225d8c[_0x30e8('0x31')])){return;}var _0x4f7231=_[_0x30e8('0x32')](_0x5532a2,[_0x30e8('0x30'),_0x225d8c['type']])[_0x30e8('0x33')];return db[_0x30e8('0x34')][_0x30e8('0x2a')]({'where':{'type':_0x4f7231,'resourceId':_0x225d8c['id']}})[_0x30e8('0x29')](function(){return _0x52379c;});})[_0x30e8('0x29')](function(){_0x46f336['status'](0xcc)[_0x30e8('0x1e')]();});}};}function handleEntityNotFound(_0x3e6d06,_0x3f6759){return function(_0x101258){if(!_0x101258){_0x3e6d06['sendStatus'](0x194);}return _0x101258;};}function handleError(_0x45ddd0,_0x189482){_0x189482=_0x189482||0x1f4;return function(_0x5d6b8f){logger['error'](_0x5d6b8f[_0x30e8('0x35')]);if(_0x5d6b8f[_0x30e8('0x33')]){delete _0x5d6b8f['name'];}_0x45ddd0['status'](_0x189482)[_0x30e8('0x36')](_0x5d6b8f);};}exports[_0x30e8('0x37')]=function(_0x31592a,_0x39616a){var _0x46c1a8={},_0x2b7cdf={},_0x2f1bca={'count':0x0,'rows':[]};var _0x56760f=_[_0x30e8('0x2f')](db[_0x30e8('0x38')][_0x30e8('0x39')],function(_0x1b7209){return{'name':_0x1b7209[_0x30e8('0x3a')],'type':_0x1b7209[_0x30e8('0x31')]['key']};});_0x2b7cdf['model']=_[_0x30e8('0x2f')](_0x56760f,_0x30e8('0x33'));_0x2b7cdf[_0x30e8('0x3b')]=_[_0x30e8('0x3c')](_0x31592a[_0x30e8('0x3b')]);_0x2b7cdf[_0x30e8('0x3d')]=_[_0x30e8('0x3e')](_0x2b7cdf['model'],_0x2b7cdf[_0x30e8('0x3b')]);_0x46c1a8[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x2b7cdf[_0x30e8('0x40')],qs['fields'](_0x31592a[_0x30e8('0x3b')][_0x30e8('0x41')]));_0x46c1a8['attributes']=_0x46c1a8[_0x30e8('0x3f')][_0x30e8('0x42')]?_0x46c1a8['attributes']:_0x2b7cdf[_0x30e8('0x40')];if(!_0x31592a[_0x30e8('0x3b')][_0x30e8('0x43')](_0x30e8('0x44'))){_0x46c1a8['limit']=qs[_0x30e8('0x21')](_0x31592a[_0x30e8('0x3b')]['limit']);_0x46c1a8[_0x30e8('0x20')]=qs['offset'](_0x31592a[_0x30e8('0x3b')][_0x30e8('0x20')]);}_0x46c1a8[_0x30e8('0x45')]=qs[_0x30e8('0x46')](_0x31592a[_0x30e8('0x3b')][_0x30e8('0x46')]);_0x46c1a8[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_[_0x30e8('0x48')](_0x31592a['query'],_0x2b7cdf[_0x30e8('0x3d')]),_0x56760f);if(_0x31592a['query'][_0x30e8('0x49')]){_0x46c1a8['where']=_[_0x30e8('0x4a')](_0x46c1a8[_0x30e8('0x47')],{'$or':_[_0x30e8('0x2f')](_0x56760f,function(_0x2ab8e1){if(_0x2ab8e1['type']!==_0x30e8('0x4b')){var _0x55254a={};_0x55254a[_0x2ab8e1[_0x30e8('0x33')]]={'$like':'%'+_0x31592a[_0x30e8('0x3b')]['filter']+'%'};return _0x55254a;}})});}_0x46c1a8=_[_0x30e8('0x4a')]({},_0x46c1a8,_0x31592a[_0x30e8('0x4c')]);var _0x2dd52d={'where':_0x46c1a8[_0x30e8('0x47')]};return db[_0x30e8('0x38')][_0x30e8('0x23')](_0x2dd52d)[_0x30e8('0x29')](function(_0x1eecf2){_0x2f1bca[_0x30e8('0x23')]=_0x1eecf2;if(_0x31592a[_0x30e8('0x3b')][_0x30e8('0x4d')]){_0x46c1a8['include']=[{'all':!![]}];}return db[_0x30e8('0x38')][_0x30e8('0x4e')](_0x46c1a8);})[_0x30e8('0x29')](function(_0x50ae9e){_0x2f1bca['rows']=_0x50ae9e;return _0x2f1bca;})['then'](respondWithFilteredResult(_0x39616a,_0x46c1a8))[_0x30e8('0x4f')](handleError(_0x39616a,null));};exports[_0x30e8('0x50')]=function(_0x31c63d,_0x32c9d4){var _0x526180={'raw':![],'where':{'id':_0x31c63d['params']['id']}},_0x522faf={};_0x522faf['model']=_[_0x30e8('0x3c')](db[_0x30e8('0x38')][_0x30e8('0x39')]);_0x522faf[_0x30e8('0x3b')]=_['keys'](_0x31c63d[_0x30e8('0x3b')]);_0x522faf['filters']=_[_0x30e8('0x3e')](_0x522faf['model'],_0x522faf[_0x30e8('0x3b')]);_0x526180['attributes']=_[_0x30e8('0x3e')](_0x522faf[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x31c63d['query'][_0x30e8('0x41')]));_0x526180[_0x30e8('0x3f')]=_0x526180[_0x30e8('0x3f')][_0x30e8('0x42')]?_0x526180['attributes']:_0x522faf[_0x30e8('0x40')];if(_0x31c63d[_0x30e8('0x3b')]['includeAll']){_0x526180[_0x30e8('0x51')]=[{'all':!![]}];}_0x526180=_[_0x30e8('0x4a')]({},_0x526180,_0x31c63d['options']);return db['VoiceQueue']['find'](_0x526180)['then'](handleEntityNotFound(_0x32c9d4,null))['then'](respondWithResult(_0x32c9d4,null))['catch'](handleError(_0x32c9d4,null));};exports[_0x30e8('0x52')]=function(_0x145569,_0x482dfa){return db['VoiceQueue'][_0x30e8('0x52')](_0x145569[_0x30e8('0x53')],{})['then'](function(_0x48dee1){var _0x126d8b=_0x145569[_0x30e8('0x54')][_0x30e8('0x55')]({'plain':!![]});if(!_0x126d8b)throw new Error(_0x30e8('0x56'));if(_0x126d8b[_0x30e8('0x57')]===_0x30e8('0x54')){var _0x151dc6=_0x48dee1[_0x30e8('0x55')]({'plain':!![]});var _0xf8d96=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x30e8('0x58'),'value':_0x30e8('0x2d')}];var _0x422677=_[_0x30e8('0x32')](_0xf8d96,['value',_0x151dc6[_0x30e8('0x31')]])[_0x30e8('0x33')];return db[_0x30e8('0x59')][_0x30e8('0x32')]({'where':{'name':_0x422677,'userProfileId':_0x126d8b['userProfileId']},'raw':!![]})[_0x30e8('0x29')](function(_0x3ca66f){if(_0x3ca66f&&_0x3ca66f[_0x30e8('0x5a')]===0x0){return db['UserProfileResource'][_0x30e8('0x52')]({'name':_0x151dc6[_0x30e8('0x33')],'resourceId':_0x151dc6['id'],'type':_0x3ca66f[_0x30e8('0x33')],'sectionId':_0x3ca66f['id']},{})['then'](function(){return _0x48dee1;});}else{return _0x48dee1;}})[_0x30e8('0x4f')](function(_0x46fadf){logger[_0x30e8('0x5b')](_0x30e8('0x5c'),_0x46fadf);throw _0x46fadf;});}return _0x48dee1;})[_0x30e8('0x29')](respondWithResult(_0x482dfa,0xc9))[_0x30e8('0x4f')](handleError(_0x482dfa,null));};exports[_0x30e8('0x5d')]=function(_0x13c314,_0x2f3473){var _0x7a5c11={'where':{'id':_0x13c314[_0x30e8('0x5e')]['id']}},_0x264a94={};_0x264a94[_0x30e8('0x40')]=_[_0x30e8('0x3c')](db['VoiceQueue']['rawAttributes']);_0x7a5c11[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x264a94[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x13c314[_0x30e8('0x3b')][_0x30e8('0x41')]));_0x7a5c11[_0x30e8('0x3f')]=_0x7a5c11['attributes']['length']?_0x7a5c11[_0x30e8('0x3f')]:_0x264a94['model'];if(_0x13c314[_0x30e8('0x3b')]['includeAll']){_0x7a5c11[_0x30e8('0x51')]=[{'all':!![]}];}_0x7a5c11=_[_0x30e8('0x4a')]({},_0x7a5c11,_0x13c314[_0x30e8('0x4c')]);return db['VoiceQueue']['find'](_0x7a5c11)['then'](handleEntityNotFound(_0x2f3473,null))[_0x30e8('0x29')](function(_0x5f51f6){if(_0x5f51f6){var _0x1dc952=_0x5f51f6['get']({'plain':!![]});_0x1dc952=qs['omit'](_0x1dc952,['id',_0x30e8('0x5f'),_0x30e8('0x60')]);_0x13c314[_0x30e8('0x53')]=_['omit'](_0x13c314['body'],['id',_0x30e8('0x5f'),_0x30e8('0x60')]);return db[_0x30e8('0x38')][_0x30e8('0x52')](_[_0x30e8('0x4a')](_0x1dc952,_0x13c314[_0x30e8('0x53')]),{'include':_0x13c314[_0x30e8('0x3b')][_0x30e8('0x4d')]?[{'all':!![]}]:undefined})[_0x30e8('0x29')](function(_0x3ce106){var _0x5edcc7=_0x13c314[_0x30e8('0x54')][_0x30e8('0x55')]({'plain':!![]});if(!_0x5edcc7)throw new Error(_0x30e8('0x56'));if(_0x5edcc7[_0x30e8('0x57')]===_0x30e8('0x54')){var _0x260a0d=_0x3ce106[_0x30e8('0x55')]({'plain':!![]});var _0x18e3d4=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0x30e8('0x2d')}];var _0x27a1af=_['find'](_0x18e3d4,[_0x30e8('0x30'),_0x260a0d['type']])[_0x30e8('0x33')];return db[_0x30e8('0x59')][_0x30e8('0x32')]({'where':{'name':_0x27a1af,'userProfileId':_0x5edcc7[_0x30e8('0x61')]},'raw':!![]})['then'](function(_0x291a20){if(_0x291a20&&_0x291a20[_0x30e8('0x5a')]===0x0){return db[_0x30e8('0x34')][_0x30e8('0x52')]({'name':_0x260a0d[_0x30e8('0x33')],'resourceId':_0x260a0d['id'],'type':_0x291a20['name'],'sectionId':_0x291a20['id']},{})[_0x30e8('0x29')](function(){return _0x3ce106;});}else{return _0x3ce106;}})[_0x30e8('0x4f')](function(_0x2baebb){logger[_0x30e8('0x5b')](_0x30e8('0x5c'),_0x2baebb);throw _0x2baebb;});}return _0x3ce106;});}})[_0x30e8('0x29')](respondWithResult(_0x2f3473,0xc9))[_0x30e8('0x4f')](handleError(_0x2f3473,null));};exports['update']=function(_0x266b78,_0x213b39){if(_0x266b78[_0x30e8('0x53')]['id']){delete _0x266b78['body']['id'];}return db['VoiceQueue'][_0x30e8('0x32')]({'where':{'id':_0x266b78[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x213b39,null))[_0x30e8('0x29')](saveUpdates(_0x266b78['body'],null))[_0x30e8('0x29')](respondWithResult(_0x213b39,null))[_0x30e8('0x4f')](handleError(_0x213b39,null));};exports['destroy']=function(_0x35894e,_0x214227){return db[_0x30e8('0x38')][_0x30e8('0x32')]({'where':{'id':_0x35894e[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x214227,null))['then'](removeEntity(_0x214227,null))[_0x30e8('0x4f')](handleError(_0x214227,null));};exports[_0x30e8('0x62')]=function(_0x5df2ba,_0x2bbf50,_0x121d66){var _0x59ed11={'raw':![],'where':{}};var _0x4afd32={};var _0x2e1655={'count':0x0,'rows':[]};return db[_0x30e8('0x38')]['findOne']({'where':{'id':_0x5df2ba[_0x30e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2bbf50,null))[_0x30e8('0x29')](function(_0x18dabd){if(_0x18dabd){_0x4afd32[_0x30e8('0x40')]=_['keys'](db[_0x30e8('0x63')][_0x30e8('0x39')]);_0x4afd32[_0x30e8('0x3b')]=_[_0x30e8('0x3c')](_0x5df2ba['query']);_0x4afd32[_0x30e8('0x3d')]=_['intersection'](_0x4afd32[_0x30e8('0x40')],_0x4afd32[_0x30e8('0x3b')]);_0x59ed11[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x4afd32[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x5df2ba[_0x30e8('0x3b')][_0x30e8('0x41')]));_0x59ed11[_0x30e8('0x3f')]=_0x59ed11[_0x30e8('0x3f')][_0x30e8('0x42')]?_0x59ed11[_0x30e8('0x3f')]:_0x4afd32[_0x30e8('0x40')];if(!_0x5df2ba['query'][_0x30e8('0x43')](_0x30e8('0x44'))){_0x59ed11[_0x30e8('0x21')]=qs['limit'](_0x5df2ba[_0x30e8('0x3b')]['limit']);_0x59ed11['offset']=qs[_0x30e8('0x20')](_0x5df2ba[_0x30e8('0x3b')]['offset']);}_0x59ed11[_0x30e8('0x45')]=qs['sort'](_0x5df2ba[_0x30e8('0x3b')][_0x30e8('0x46')]);_0x59ed11[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_[_0x30e8('0x48')](_0x5df2ba[_0x30e8('0x3b')],_0x4afd32[_0x30e8('0x3d')]));_0x59ed11['where'][_0x30e8('0x64')]=_0x18dabd['id'];if(_0x5df2ba[_0x30e8('0x3b')][_0x30e8('0x49')]){_0x59ed11[_0x30e8('0x47')]=_[_0x30e8('0x4a')](_0x59ed11[_0x30e8('0x47')],{'$or':_[_0x30e8('0x2f')](_0x59ed11[_0x30e8('0x3f')],function(_0x44f5e7){var _0x4346a7={};_0x4346a7[_0x44f5e7]={'$like':'%'+_0x5df2ba[_0x30e8('0x3b')]['filter']+'%'};return _0x4346a7;})});}_0x59ed11=_['merge']({},_0x59ed11,_0x5df2ba[_0x30e8('0x4c')]);return db[_0x30e8('0x63')]['count']({'where':_0x59ed11[_0x30e8('0x47')]})[_0x30e8('0x29')](function(_0x3e9cdb){_0x2e1655[_0x30e8('0x23')]=_0x3e9cdb;if(_0x5df2ba[_0x30e8('0x3b')][_0x30e8('0x4d')]){_0x59ed11[_0x30e8('0x51')]=[{'all':!![]}];}return db[_0x30e8('0x63')]['findAll'](_0x59ed11);})['then'](function(_0x18f58e){_0x2e1655[_0x30e8('0x65')]=_0x18f58e;return _0x2e1655;});}})['then'](respondWithFilteredResult(_0x2bbf50,_0x59ed11))[_0x30e8('0x4f')](handleError(_0x2bbf50,null));};exports[_0x30e8('0x66')]=function(_0x57b1d3,_0x414dd9,_0x13294e){var _0x5aa6dc={'raw':!![],'where':{}};var _0x55c4c8={};var _0x317589={'count':0x0,'rows':[]};return db[_0x30e8('0x38')]['findOne']({'where':{'id':_0x57b1d3['params']['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x414dd9,null))[_0x30e8('0x29')](function(_0x5114da){if(_0x5114da){_0x55c4c8[_0x30e8('0x40')]=_['keys'](db[_0x30e8('0x67')][_0x30e8('0x39')]);_0x55c4c8[_0x30e8('0x3b')]=_[_0x30e8('0x3c')](_0x57b1d3[_0x30e8('0x3b')]);_0x55c4c8[_0x30e8('0x3d')]=_['intersection'](_0x55c4c8[_0x30e8('0x40')],_0x55c4c8[_0x30e8('0x3b')]);_0x5aa6dc[_0x30e8('0x3f')]=_['intersection'](_0x55c4c8[_0x30e8('0x40')],qs['fields'](_0x57b1d3[_0x30e8('0x3b')][_0x30e8('0x41')]));_0x5aa6dc['attributes']=_0x5aa6dc[_0x30e8('0x3f')][_0x30e8('0x42')]?_0x5aa6dc[_0x30e8('0x3f')]:_0x55c4c8['model'];if(!_0x57b1d3['query'][_0x30e8('0x43')](_0x30e8('0x44'))){_0x5aa6dc[_0x30e8('0x21')]=qs['limit'](_0x57b1d3[_0x30e8('0x3b')][_0x30e8('0x21')]);_0x5aa6dc[_0x30e8('0x20')]=qs[_0x30e8('0x20')](_0x57b1d3['query'][_0x30e8('0x20')]);}_0x5aa6dc[_0x30e8('0x45')]=qs['sort'](_0x57b1d3['query'][_0x30e8('0x46')]);_0x5aa6dc[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_['pick'](_0x57b1d3[_0x30e8('0x3b')],_0x55c4c8[_0x30e8('0x3d')]));_0x5aa6dc[_0x30e8('0x47')][_0x30e8('0x64')]=_0x5114da['id'];if(_0x57b1d3['query'][_0x30e8('0x49')]){_0x5aa6dc[_0x30e8('0x47')]=_['merge'](_0x5aa6dc[_0x30e8('0x47')],{'$or':_[_0x30e8('0x2f')](_0x5aa6dc[_0x30e8('0x3f')],function(_0x53afbb){var _0x44d5eb={};_0x44d5eb[_0x53afbb]={'$like':'%'+_0x57b1d3[_0x30e8('0x3b')][_0x30e8('0x49')]+'%'};return _0x44d5eb;})});}_0x5aa6dc=_[_0x30e8('0x4a')]({},_0x5aa6dc,_0x57b1d3[_0x30e8('0x4c')]);return db[_0x30e8('0x67')][_0x30e8('0x23')]({'where':_0x5aa6dc[_0x30e8('0x47')]})[_0x30e8('0x29')](function(_0x492ae7){_0x317589[_0x30e8('0x23')]=_0x492ae7;if(_0x57b1d3[_0x30e8('0x3b')][_0x30e8('0x4d')]){_0x5aa6dc['include']=[{'all':!![]}];}return db[_0x30e8('0x67')][_0x30e8('0x4e')](_0x5aa6dc);})[_0x30e8('0x29')](function(_0x3f9e61){_0x317589[_0x30e8('0x65')]=_0x3f9e61;return _0x317589;});}})[_0x30e8('0x29')](respondWithFilteredResult(_0x414dd9,_0x5aa6dc))[_0x30e8('0x4f')](handleError(_0x414dd9,null));};exports[_0x30e8('0x68')]=function(_0x5423ec,_0x17daee,_0x2f0b02){var _0x18f41c={'raw':!![],'where':{}};var _0x14785b={};var _0x37b206={'count':0x0,'rows':[]};return db[_0x30e8('0x38')][_0x30e8('0x69')]({'where':{'id':_0x5423ec[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x17daee,null))['then'](function(_0x13ab57){if(_0x13ab57){_0x14785b[_0x30e8('0x40')]=_[_0x30e8('0x3c')](db[_0x30e8('0x6a')][_0x30e8('0x39')]);_0x14785b[_0x30e8('0x3b')]=_[_0x30e8('0x3c')](_0x5423ec[_0x30e8('0x3b')]);_0x14785b['filters']=_['intersection'](_0x14785b[_0x30e8('0x40')],_0x14785b[_0x30e8('0x3b')]);_0x18f41c[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x14785b[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x5423ec[_0x30e8('0x3b')]['fields']));_0x18f41c[_0x30e8('0x3f')]=_0x18f41c[_0x30e8('0x3f')][_0x30e8('0x42')]?_0x18f41c[_0x30e8('0x3f')]:_0x14785b[_0x30e8('0x40')];if(!_0x5423ec['query']['hasOwnProperty'](_0x30e8('0x44'))){_0x18f41c[_0x30e8('0x21')]=qs[_0x30e8('0x21')](_0x5423ec[_0x30e8('0x3b')][_0x30e8('0x21')]);_0x18f41c[_0x30e8('0x20')]=qs[_0x30e8('0x20')](_0x5423ec['query'][_0x30e8('0x20')]);}_0x18f41c['order']=qs[_0x30e8('0x46')](_0x5423ec['query'][_0x30e8('0x46')]);_0x18f41c[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_['pick'](_0x5423ec[_0x30e8('0x3b')],_0x14785b[_0x30e8('0x3d')]));_0x18f41c[_0x30e8('0x47')][_0x30e8('0x64')]=_0x13ab57['id'];if(_0x5423ec[_0x30e8('0x3b')][_0x30e8('0x49')]){_0x18f41c['where']=_[_0x30e8('0x4a')](_0x18f41c[_0x30e8('0x47')],{'$or':_['map'](_0x18f41c[_0x30e8('0x3f')],function(_0x12d202){var _0x4d0a16={};_0x4d0a16[_0x12d202]={'$like':'%'+_0x5423ec['query'][_0x30e8('0x49')]+'%'};return _0x4d0a16;})});}_0x18f41c=_[_0x30e8('0x4a')]({},_0x18f41c,_0x5423ec[_0x30e8('0x4c')]);return db[_0x30e8('0x6a')][_0x30e8('0x23')]({'where':_0x18f41c[_0x30e8('0x47')]})[_0x30e8('0x29')](function(_0x261a19){_0x37b206[_0x30e8('0x23')]=_0x261a19;if(_0x5423ec[_0x30e8('0x3b')]['includeAll']){_0x18f41c[_0x30e8('0x51')]=[{'all':!![]}];}return db[_0x30e8('0x6a')][_0x30e8('0x4e')](_0x18f41c);})[_0x30e8('0x29')](function(_0x53fcbf){_0x37b206[_0x30e8('0x65')]=_0x53fcbf;return _0x37b206;});}})[_0x30e8('0x29')](respondWithFilteredResult(_0x17daee,_0x18f41c))[_0x30e8('0x4f')](handleError(_0x17daee,null));};exports[_0x30e8('0x6b')]=function(_0x5bfec1,_0x2e4f1e,_0x3cdb00){var _0x1b5a46={'raw':!![],'where':{}};var _0x269a45={};var _0x3d6aeb={'count':0x0,'rows':[]};return db[_0x30e8('0x38')][_0x30e8('0x69')]({'where':{'id':_0x5bfec1['params']['id']}})['then'](handleEntityNotFound(_0x2e4f1e,null))[_0x30e8('0x29')](function(_0x41e48b){if(_0x41e48b){_0x269a45[_0x30e8('0x40')]=_[_0x30e8('0x3c')](db[_0x30e8('0x6c')][_0x30e8('0x39')]);_0x269a45['query']=_[_0x30e8('0x3c')](_0x5bfec1[_0x30e8('0x3b')]);_0x269a45[_0x30e8('0x3d')]=_[_0x30e8('0x3e')](_0x269a45[_0x30e8('0x40')],_0x269a45[_0x30e8('0x3b')]);_0x1b5a46[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x269a45[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x5bfec1[_0x30e8('0x3b')][_0x30e8('0x41')]));_0x1b5a46['attributes']=_0x1b5a46['attributes']['length']?_0x1b5a46[_0x30e8('0x3f')]:_0x269a45[_0x30e8('0x40')];if(!_0x5bfec1[_0x30e8('0x3b')]['hasOwnProperty'](_0x30e8('0x44'))){_0x1b5a46[_0x30e8('0x21')]=qs[_0x30e8('0x21')](_0x5bfec1[_0x30e8('0x3b')][_0x30e8('0x21')]);_0x1b5a46[_0x30e8('0x20')]=qs[_0x30e8('0x20')](_0x5bfec1[_0x30e8('0x3b')][_0x30e8('0x20')]);}_0x1b5a46[_0x30e8('0x45')]=qs[_0x30e8('0x46')](_0x5bfec1[_0x30e8('0x3b')]['sort']);_0x1b5a46[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_[_0x30e8('0x48')](_0x5bfec1[_0x30e8('0x3b')],_0x269a45[_0x30e8('0x3d')]));_0x1b5a46[_0x30e8('0x47')][_0x30e8('0x64')]=_0x41e48b['id'];if(_0x5bfec1[_0x30e8('0x3b')][_0x30e8('0x49')]){_0x1b5a46['where']=_[_0x30e8('0x4a')](_0x1b5a46['where'],{'$or':_[_0x30e8('0x2f')](_0x1b5a46['attributes'],function(_0x22da92){var _0x798dd9={};_0x798dd9[_0x22da92]={'$like':'%'+_0x5bfec1['query'][_0x30e8('0x49')]+'%'};return _0x798dd9;})});}_0x1b5a46=_[_0x30e8('0x4a')]({},_0x1b5a46,_0x5bfec1[_0x30e8('0x4c')]);return db[_0x30e8('0x6c')][_0x30e8('0x23')]({'where':_0x1b5a46['where']})[_0x30e8('0x29')](function(_0x1d5b98){_0x3d6aeb['count']=_0x1d5b98;if(_0x5bfec1['query']['includeAll']){_0x1b5a46[_0x30e8('0x51')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x30e8('0x4e')](_0x1b5a46);})[_0x30e8('0x29')](function(_0x1812c2){_0x3d6aeb['rows']=_0x1812c2;return _0x3d6aeb;});}})[_0x30e8('0x29')](respondWithFilteredResult(_0x2e4f1e,_0x1b5a46))['catch'](handleError(_0x2e4f1e,null));};exports[_0x30e8('0x6d')]=function(_0x4049a6,_0x160c8d,_0x4b59ab){var _0x560d68={};var _0x4c20b9={};var _0x2c5b7c;var _0x29035a;return db[_0x30e8('0x38')][_0x30e8('0x69')]({'where':{'id':_0x4049a6[_0x30e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x160c8d,null))['then'](function(_0x1a6656){if(_0x1a6656){_0x2c5b7c=_0x1a6656;_0x4c20b9['model']=_[_0x30e8('0x3c')](db['Team']['rawAttributes']);_0x4c20b9[_0x30e8('0x3b')]=_[_0x30e8('0x3c')](_0x4049a6[_0x30e8('0x3b')]);_0x4c20b9[_0x30e8('0x3d')]=_[_0x30e8('0x3e')](_0x4c20b9[_0x30e8('0x40')],_0x4c20b9['query']);_0x560d68[_0x30e8('0x3f')]=_['intersection'](_0x4c20b9[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x4049a6[_0x30e8('0x3b')]['fields']));_0x560d68[_0x30e8('0x3f')]=_0x560d68[_0x30e8('0x3f')][_0x30e8('0x42')]?_0x560d68[_0x30e8('0x3f')]:_0x4c20b9[_0x30e8('0x40')];_0x560d68['order']=qs['sort'](_0x4049a6[_0x30e8('0x3b')][_0x30e8('0x46')]);_0x560d68[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_[_0x30e8('0x48')](_0x4049a6['query'],_0x4c20b9[_0x30e8('0x3d')]));if(_0x4049a6[_0x30e8('0x3b')][_0x30e8('0x49')]){_0x560d68[_0x30e8('0x47')]=_[_0x30e8('0x4a')](_0x560d68[_0x30e8('0x47')],{'$or':_[_0x30e8('0x2f')](_0x560d68[_0x30e8('0x3f')],function(_0x276121){var _0x44f478={};_0x44f478[_0x276121]={'$like':'%'+_0x4049a6['query'][_0x30e8('0x49')]+'%'};return _0x44f478;})});}_0x560d68=_[_0x30e8('0x4a')]({},_0x560d68,_0x4049a6[_0x30e8('0x4c')]);return _0x2c5b7c[_0x30e8('0x6d')](_0x560d68);}})[_0x30e8('0x29')](function(_0x236e4e){if(_0x236e4e){_0x29035a=_0x236e4e[_0x30e8('0x42')];if(!_0x4049a6['query'][_0x30e8('0x43')]('nolimit')){_0x560d68[_0x30e8('0x21')]=qs[_0x30e8('0x21')](_0x4049a6[_0x30e8('0x3b')]['limit']);_0x560d68[_0x30e8('0x20')]=qs[_0x30e8('0x20')](_0x4049a6[_0x30e8('0x3b')][_0x30e8('0x20')]);}return _0x2c5b7c[_0x30e8('0x6d')](_0x560d68);}})['then'](function(_0x4841cd){if(_0x4841cd){return _0x4841cd?{'count':_0x29035a,'rows':_0x4841cd}:null;}})[_0x30e8('0x29')](respondWithResult(_0x160c8d,null))[_0x30e8('0x4f')](handleError(_0x160c8d,null));};exports[_0x30e8('0x6e')]=function(_0x438851,_0x3382c2,_0xe5f4f4){var _0x45134e=_0x438851[_0x30e8('0x53')][_0x30e8('0x6f')];var _0x3e6434=_[_0x30e8('0x2f')](_0x45134e,'id');return db[_0x30e8('0x70')][_0x30e8('0x4e')]({'where':{'id':_0x3e6434},'attributes':['id'],'include':[{'model':db[_0x30e8('0x71')],'as':_0x30e8('0x72'),'attributes':['id','name',_0x30e8('0x73'),_0x30e8('0x74'),'interface'],'raw':!![]}]})[_0x30e8('0x29')](function(_0x4783a9){if(_0x4783a9){var _0x48c025=_[_0x30e8('0x75')](_0x4783a9,function(_0x2be7e0){var _0x25b255=_0x2be7e0[_0x30e8('0x55')]({'plain':!![]});_0x25b255['Agents'][_0x30e8('0x76')](function(_0x55218d){_0x55218d[_0x30e8('0x77')]=_[_0x30e8('0x32')](_0x45134e,{'id':_0x25b255['id']})[_0x30e8('0x77')];});return _0x25b255[_0x30e8('0x72')];});return db[_0x30e8('0x38')][_0x30e8('0x32')]({'where':{'id':_0x438851[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](function(_0x52fa5a){return db['sequelize']['transaction'](function(_0x3abd03){return _0x52fa5a[_0x30e8('0x6e')](_0x3e6434,{'transaction':_0x3abd03})['then'](function(){return BPromise[_0x30e8('0x78')](_0x45134e,function(_0x403d44){return db['TeamVoiceQueue'][_0x30e8('0x79')]({'TeamId':_0x403d44['id'],'VoiceQueueId':_0x438851[_0x30e8('0x5e')]['id'],'penalty':_0x403d44[_0x30e8('0x77')]},{'transaction':_0x3abd03});});})[_0x30e8('0x29')](function(){return BPromise[_0x30e8('0x78')](_0x48c025,function(_0x38d550){return db['UserVoiceQueue'][_0x30e8('0x7a')]({'where':{'UserId':_0x38d550['id'],'VoiceQueueId':_0x438851[_0x30e8('0x5e')]['id']},'defaults':{'penalty':_0x38d550[_0x30e8('0x77')]},'transaction':_0x3abd03});});})[_0x30e8('0x29')](function(){return BPromise[_0x30e8('0x78')](_[_0x30e8('0x49')](_0x48c025,{'online':!![]}),function(_0x40e014){return db['UserVoiceQueueRt'][_0x30e8('0x79')]({'membername':_0x40e014[_0x30e8('0x33')],'UserId':_0x40e014['id'],'queue_name':_0x52fa5a[_0x30e8('0x33')],'VoiceQueueId':_0x52fa5a['id'],'interface':_['isNil'](_0x40e014[_0x30e8('0x7b')])?util[_0x30e8('0x7c')](_0x30e8('0x7d'),_0x40e014[_0x30e8('0x33')]):_0x40e014[_0x30e8('0x7b')],'paused':_0x40e014[_0x30e8('0x74')]||![],'penalty':_0x40e014[_0x30e8('0x77')]},{'transaction':_0x3abd03});});})[_0x30e8('0x29')](function(){_0x48c025[_0x30e8('0x76')](function(_0x284a8e){socket[_0x30e8('0x7e')](_0x30e8('0x7f'),{'UserId':_0x284a8e['id'],'VoiceQueueId':_0x52fa5a['id']});});});});});}})[_0x30e8('0x29')](respondWithStatusCode(_0x3382c2,null))[_0x30e8('0x4f')](handleError(_0x3382c2,null));};exports['removeTeams']=function(_0x429d75,_0x12fd98,_0x3f504a){return db[_0x30e8('0x70')][_0x30e8('0x4e')]({'where':{'id':_0x429d75['query'][_0x30e8('0x80')]},'attributes':['id'],'include':[{'model':db[_0x30e8('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x30e8('0x29')](handleEntityNotFound(_0x12fd98,null))[_0x30e8('0x29')](function(_0x444859){var _0x4f510a=_['map'](_0x444859,'id');var _0x258cfd=[];var _0x52677d=[];var _0x567524=squel['select']();_0x567524[_0x30e8('0x81')](_0x30e8('0x82'))[_0x30e8('0x83')](_0x30e8('0x84'),'tq')[_0x30e8('0x85')](_0x30e8('0x86'),'ut',_0x30e8('0x87'))[_0x30e8('0x47')](_0x30e8('0x88'),_0x429d75[_0x30e8('0x5e')]['id']);for(var _0x2b49dc=0x0;_0x2b49dc<_0x444859[_0x30e8('0x42')];_0x2b49dc+=0x1){let _0x56ccfe=_0x444859[_0x2b49dc];for(var _0x2c6240=0x0;_0x2c6240<_0x56ccfe[_0x30e8('0x72')][_0x30e8('0x42')];_0x2c6240+=0x1){let _0x3d5a43=_0x56ccfe[_0x30e8('0x72')][_0x2c6240];var _0x3e729d=_0x567524[_0x30e8('0x5d')]();_0x3e729d['where'](_0x30e8('0x89'),_0x3d5a43['id']);_0x52677d[_0x30e8('0x8a')](db[_0x30e8('0x8b')][_0x30e8('0x3b')](_0x3e729d[_0x30e8('0x8c')](),{'type':db[_0x30e8('0x8b')][_0x30e8('0x8d')]['SELECT']})[_0x30e8('0x29')](function(_0x18d614){if(_0x18d614['length']===0x1){return _0x3d5a43['id'];}else{var _0x3b9604=_[_0x30e8('0x8e')](_[_0x30e8('0x2f')](_0x18d614,_0x30e8('0x8f')),function(_0x16606c){return _[_0x30e8('0x90')](_0x4f510a,_0x16606c);});if(_0x3b9604){return _0x3d5a43['id'];}}}));}}return BPromise['all'](_0x52677d)[_0x30e8('0x29')](function(_0x554272){_0x258cfd=_(_0x258cfd)[_0x30e8('0x91')](_0x554272)[_0x30e8('0x92')]()[_0x30e8('0x30')]();return db['VoiceQueue'][_0x30e8('0x32')]({'where':{'id':_0x429d75[_0x30e8('0x5e')]['id']}})['then'](function(_0x25bb71){return db[_0x30e8('0x8b')]['transaction'](function(_0x503190){return _0x25bb71['removeTeams'](_0x429d75[_0x30e8('0x3b')][_0x30e8('0x80')],{'transaction':_0x503190})[_0x30e8('0x29')](function(){if(!_[_0x30e8('0x93')](_0x258cfd)){return _0x25bb71[_0x30e8('0x94')](_0x258cfd,{'transaction':_0x503190})[_0x30e8('0x29')](function(){return db[_0x30e8('0x95')][_0x30e8('0x2a')]({'where':{'VoiceQueueId':_0x429d75[_0x30e8('0x5e')]['id'],'UserId':_0x258cfd},'transaction':_0x503190});});}})[_0x30e8('0x29')](function(){_0x258cfd[_0x30e8('0x76')](function(_0x2ccbb8){socket[_0x30e8('0x7e')]('userVoiceQueue:remove',{'UserId':_0x2ccbb8,'VoiceQueueId':_0x25bb71['id']});});});});});});})[_0x30e8('0x29')](respondWithStatusCode(_0x12fd98,null))['catch'](handleError(_0x12fd98,null));};exports['addAgents']=function(_0x557634,_0x475c66,_0x44bea4){var _0x51c2a6,_0xc3abd1;return db[_0x30e8('0x38')][_0x30e8('0x32')]({'where':{'id':_0x557634[_0x30e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x475c66,null))[_0x30e8('0x29')](function(_0x224734){if(_0x224734){_0xc3abd1=_0x224734;return _0x224734[_0x30e8('0x96')](_0x557634[_0x30e8('0x53')]['ids'],_[_0x30e8('0x97')](_0x557634['body'],[_0x30e8('0x80'),'id'])||{})[_0x30e8('0x98')](function(_0x5cfede){for(var _0x403438=0x0;_0x403438<_0x557634[_0x30e8('0x53')][_0x30e8('0x80')]['length'];_0x403438+=0x1){socket[_0x30e8('0x7e')](_0x30e8('0x7f'),{'UserId':Number(_0x557634['body'][_0x30e8('0x80')][_0x403438]),'VoiceQueueId':Number(_0x557634[_0x30e8('0x5e')]['id'])});}return _0x5cfede;});}})[_0x30e8('0x29')](function(_0x4142e6){_0x51c2a6=_0x4142e6||[];if(_0xc3abd1){return db[_0x30e8('0x71')][_0x30e8('0x4e')]({'where':{'id':_0x557634[_0x30e8('0x53')][_0x30e8('0x80')]},'attributes':['id',_0x30e8('0x33'),_0x30e8('0x73'),_0x30e8('0x74'),_0x30e8('0x7b')],'raw':!![]});}})['then'](function(_0x170896){if(!_[_0x30e8('0x93')](_0x170896)){var _0x1bfa1b=[];for(var _0x22e543=0x0;_0x22e543<_0x170896[_0x30e8('0x42')];_0x22e543++){if(_0x170896[_0x22e543][_0x30e8('0x73')]){_0x1bfa1b[_0x30e8('0x8a')](db[_0x30e8('0x95')][_0x30e8('0x79')]({'membername':_0x170896[_0x22e543]['name'],'UserId':_0x170896[_0x22e543]['id'],'queue_name':_0xc3abd1[_0x30e8('0x33')],'VoiceQueueId':_0xc3abd1['id'],'interface':_['isNil'](_0x170896[_0x22e543]['interface'])?util[_0x30e8('0x7c')](_0x30e8('0x7d'),_0x170896[_0x22e543]['name']):_0x170896[_0x22e543][_0x30e8('0x7b')],'paused':_0x170896[_0x22e543][_0x30e8('0x74')]||![],'penalty':_0x557634[_0x30e8('0x53')]['penalty']||0x0}));}}return BPromise['all'](_0x1bfa1b);}})[_0x30e8('0x29')](function(){return _0x51c2a6;})['then'](respondWithResult(_0x475c66,null))[_0x30e8('0x4f')](handleError(_0x475c66,null));};exports[_0x30e8('0x94')]=function(_0x3c56cd,_0x445fc9,_0x82af59){return db[_0x30e8('0x38')][_0x30e8('0x32')]({'where':{'id':_0x3c56cd[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x445fc9,null))[_0x30e8('0x29')](function(_0x995918){if(_0x995918){return _0x995918[_0x30e8('0x94')](_0x3c56cd[_0x30e8('0x3b')][_0x30e8('0x80')])['then'](function(){if(_['isArray'](_0x3c56cd['query']['ids'])){for(var _0x420c6c=0x0;_0x420c6c<_0x3c56cd[_0x30e8('0x3b')][_0x30e8('0x80')][_0x30e8('0x42')];_0x420c6c+=0x1){socket[_0x30e8('0x7e')](_0x30e8('0x99'),{'UserId':Number(_0x3c56cd[_0x30e8('0x3b')][_0x30e8('0x80')][_0x420c6c]),'VoiceQueueId':Number(_0x3c56cd[_0x30e8('0x5e')]['id'])});}}else{socket[_0x30e8('0x7e')](_0x30e8('0x99'),{'UserId':Number(_0x3c56cd[_0x30e8('0x3b')][_0x30e8('0x80')]),'VoiceQueueId':Number(_0x3c56cd[_0x30e8('0x5e')]['id'])});}});}})[_0x30e8('0x29')](function(_0x4c8e01){return db[_0x30e8('0x95')][_0x30e8('0x2a')]({'where':{'VoiceQueueId':_0x3c56cd[_0x30e8('0x5e')]['id'],'UserId':_0x3c56cd['query']['ids']}})['then'](function(){return _0x4c8e01;});})[_0x30e8('0x29')](respondWithStatusCode(_0x445fc9,null))[_0x30e8('0x4f')](handleError(_0x445fc9,null));};exports['getAgents']=function(_0x50bdd8,_0x5ed7ef,_0x32a9ec){var _0x451a75={};var _0x2e5a09={};var _0x2e8efe;var _0x224edb;return db[_0x30e8('0x38')][_0x30e8('0x69')]({'where':{'id':_0x50bdd8['params']['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x5ed7ef,null))[_0x30e8('0x29')](function(_0x70f010){if(_0x70f010){_0x2e8efe=_0x70f010;_0x2e5a09[_0x30e8('0x40')]=_['keys'](db[_0x30e8('0x71')]['rawAttributes']);_0x2e5a09['query']=_['keys'](_0x50bdd8[_0x30e8('0x3b')]);_0x2e5a09['filters']=_['intersection'](_0x2e5a09['model'],_0x2e5a09[_0x30e8('0x3b')]);_0x451a75[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x2e5a09[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x50bdd8[_0x30e8('0x3b')]['fields']));_0x451a75[_0x30e8('0x3f')]=_0x451a75[_0x30e8('0x3f')][_0x30e8('0x42')]?_0x451a75[_0x30e8('0x3f')]:_0x2e5a09[_0x30e8('0x40')];_0x451a75[_0x30e8('0x45')]=qs[_0x30e8('0x46')](_0x50bdd8[_0x30e8('0x3b')][_0x30e8('0x46')]);_0x451a75[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_[_0x30e8('0x48')](_0x50bdd8[_0x30e8('0x3b')],_0x2e5a09[_0x30e8('0x3d')]));if(_0x50bdd8[_0x30e8('0x3b')][_0x30e8('0x49')]){_0x451a75[_0x30e8('0x47')]=_[_0x30e8('0x4a')](_0x451a75[_0x30e8('0x47')],{'$or':_[_0x30e8('0x2f')](_0x451a75[_0x30e8('0x3f')],function(_0x2e9281){var _0x42e251={};_0x42e251[_0x2e9281]={'$like':'%'+_0x50bdd8[_0x30e8('0x3b')][_0x30e8('0x49')]+'%'};return _0x42e251;})});}_0x451a75=_['merge']({},_0x451a75,_0x50bdd8['options']);return _0x2e8efe['getAgents'](_0x451a75);}})[_0x30e8('0x29')](function(_0x5c64fe){if(_0x5c64fe){_0x224edb=_0x5c64fe[_0x30e8('0x42')];if(!_0x50bdd8['query'][_0x30e8('0x43')](_0x30e8('0x44'))){_0x451a75['limit']=qs[_0x30e8('0x21')](_0x50bdd8['query'][_0x30e8('0x21')]);_0x451a75[_0x30e8('0x20')]=qs[_0x30e8('0x20')](_0x50bdd8[_0x30e8('0x3b')][_0x30e8('0x20')]);}return _0x2e8efe[_0x30e8('0x9a')](_0x451a75);}})[_0x30e8('0x29')](function(_0x5c8be8){if(_0x5c8be8){return _0x5c8be8?{'count':_0x224edb,'rows':_0x5c8be8}:null;}})[_0x30e8('0x29')](respondWithResult(_0x5ed7ef,null))[_0x30e8('0x4f')](handleError(_0x5ed7ef,null));};exports[_0x30e8('0x9b')]=function(_0xf03f85,_0x58e1fd,_0x1037d3){var _0xa5252c={};var _0x59909c={};var _0x35604a;var _0x321ee1;return db[_0x30e8('0x38')][_0x30e8('0x69')]({'where':{'id':_0xf03f85[_0x30e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x58e1fd,null))[_0x30e8('0x29')](function(_0x335a42){if(_0x335a42){_0x35604a=_0x335a42;_0x59909c[_0x30e8('0x40')]=_[_0x30e8('0x3c')](db[_0x30e8('0x95')]['rawAttributes']);_0x59909c['query']=_[_0x30e8('0x3c')](_0xf03f85[_0x30e8('0x3b')]);_0x59909c[_0x30e8('0x3d')]=_[_0x30e8('0x3e')](_0x59909c['model'],_0x59909c[_0x30e8('0x3b')]);_0xa5252c[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x59909c[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0xf03f85[_0x30e8('0x3b')][_0x30e8('0x41')]));_0xa5252c[_0x30e8('0x3f')]=_0xa5252c[_0x30e8('0x3f')]['length']?_0xa5252c[_0x30e8('0x3f')]:_0x59909c[_0x30e8('0x40')];_0xa5252c[_0x30e8('0x45')]=qs[_0x30e8('0x46')](_0xf03f85[_0x30e8('0x3b')][_0x30e8('0x46')]);_0xa5252c[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_['pick'](_0xf03f85[_0x30e8('0x3b')],_0x59909c['filters']));if(_0xf03f85[_0x30e8('0x3b')][_0x30e8('0x49')]){_0xa5252c[_0x30e8('0x47')]=_[_0x30e8('0x4a')](_0xa5252c[_0x30e8('0x47')],{'$or':_[_0x30e8('0x2f')](_0xa5252c[_0x30e8('0x3f')],function(_0x583edd){var _0x289c99={};_0x289c99[_0x583edd]={'$like':'%'+_0xf03f85[_0x30e8('0x3b')]['filter']+'%'};return _0x289c99;})});}_0xa5252c=_[_0x30e8('0x4a')]({},_0xa5252c,_0xf03f85[_0x30e8('0x4c')]);return _0x35604a[_0x30e8('0x9b')](_0xa5252c);}})[_0x30e8('0x29')](function(_0x2e4dd2){if(_0x2e4dd2){_0x321ee1=_0x2e4dd2[_0x30e8('0x42')];if(!_0xf03f85[_0x30e8('0x3b')]['hasOwnProperty'](_0x30e8('0x44'))){_0xa5252c[_0x30e8('0x21')]=qs[_0x30e8('0x21')](_0xf03f85[_0x30e8('0x3b')][_0x30e8('0x21')]);_0xa5252c[_0x30e8('0x20')]=qs[_0x30e8('0x20')](_0xf03f85[_0x30e8('0x3b')][_0x30e8('0x20')]);}return _0x35604a[_0x30e8('0x9b')](_0xa5252c);}})[_0x30e8('0x29')](function(_0x4e1d10){return _0x4e1d10?{'count':_0x321ee1,'rows':_0x4e1d10}:null;})['then'](respondWithResult(_0x58e1fd,null))['catch'](handleError(_0x58e1fd,null));};exports['getLists']=function(_0x23d182,_0x38e96e,_0x317016){var _0x2eef6c={};var _0x373827={};var _0x624393;var _0x5df1be;return db['VoiceQueue'][_0x30e8('0x69')]({'where':{'id':_0x23d182[_0x30e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x38e96e,null))[_0x30e8('0x29')](function(_0x556f84){if(_0x556f84){_0x624393=_0x556f84;_0x373827[_0x30e8('0x40')]=_['keys'](db['CmList'][_0x30e8('0x39')]);_0x373827['query']=_[_0x30e8('0x3c')](_0x23d182[_0x30e8('0x3b')]);_0x373827[_0x30e8('0x3d')]=_[_0x30e8('0x3e')](_0x373827[_0x30e8('0x40')],_0x373827[_0x30e8('0x3b')]);_0x2eef6c[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x373827[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x23d182[_0x30e8('0x3b')][_0x30e8('0x41')]));_0x2eef6c[_0x30e8('0x3f')]=_0x2eef6c[_0x30e8('0x3f')]['length']?_0x2eef6c[_0x30e8('0x3f')]:_0x373827[_0x30e8('0x40')];_0x2eef6c[_0x30e8('0x45')]=qs[_0x30e8('0x46')](_0x23d182[_0x30e8('0x3b')][_0x30e8('0x46')]);_0x2eef6c[_0x30e8('0x47')]=qs['filters'](_['pick'](_0x23d182[_0x30e8('0x3b')],_0x373827[_0x30e8('0x3d')]));if(_0x23d182[_0x30e8('0x3b')][_0x30e8('0x49')]){_0x2eef6c['where']=_['merge'](_0x2eef6c[_0x30e8('0x47')],{'$or':_['map'](_0x2eef6c[_0x30e8('0x3f')],function(_0x1b4a21){var _0x30dea6={};_0x30dea6[_0x1b4a21]={'$like':'%'+_0x23d182[_0x30e8('0x3b')]['filter']+'%'};return _0x30dea6;})});}_0x2eef6c=_[_0x30e8('0x4a')]({},_0x2eef6c,_0x23d182[_0x30e8('0x4c')]);return _0x624393[_0x30e8('0x9c')](_0x2eef6c);}})['then'](function(_0x328c6b){if(_0x328c6b){_0x5df1be=_0x328c6b[_0x30e8('0x42')];if(!_0x23d182['query'][_0x30e8('0x43')](_0x30e8('0x44'))){_0x2eef6c[_0x30e8('0x21')]=qs[_0x30e8('0x21')](_0x23d182[_0x30e8('0x3b')][_0x30e8('0x21')]);_0x2eef6c[_0x30e8('0x20')]=qs[_0x30e8('0x20')](_0x23d182[_0x30e8('0x3b')][_0x30e8('0x20')]);}return _0x624393[_0x30e8('0x9c')](_0x2eef6c);}})[_0x30e8('0x29')](function(_0x58a089){if(_0x58a089){return _0x58a089?{'count':_0x5df1be,'rows':_0x58a089}:null;}})[_0x30e8('0x29')](respondWithResult(_0x38e96e,null))[_0x30e8('0x4f')](handleError(_0x38e96e,null));};exports[_0x30e8('0x9d')]=function(_0x537328,_0x2ac836,_0x40f807){var _0x37ebb1,_0x3136e7;return db[_0x30e8('0x38')]['find']({'where':{'id':_0x537328['params']['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x2ac836,null))[_0x30e8('0x29')](function(_0x54a98d){if(_0x54a98d){_0x3136e7=_0x54a98d;return _0x54a98d[_0x30e8('0x9d')](_0x537328[_0x30e8('0x53')]['ids'],_[_0x30e8('0x97')](_0x537328[_0x30e8('0x53')],[_0x30e8('0x80'),'id'])||{});}return null;})[_0x30e8('0x98')](function(_0x5a6837){var _0x44eb46;_0x37ebb1=_0x5a6837||[];var _0x207d54=[];if(_0x5a6837){for(var _0x45957f=0x0;_0x45957f<_0x5a6837['length'];_0x45957f+=0x1){var _0x5d1d09=_0x5a6837[_0x45957f][_0x30e8('0x55')]({'plain':!![]});_0x3136e7[_0x30e8('0x9e')]=_0x537328[_0x30e8('0x53')]['dialCheckDuplicateType']?_0x537328[_0x30e8('0x53')][_0x30e8('0x9e')]:_0x3136e7[_0x30e8('0x9e')];switch(_0x3136e7[_0x30e8('0x9e')]){case _0x30e8('0x9f'):_0x44eb46=squel[_0x30e8('0xa0')]()[_0x30e8('0xa1')](_0x30e8('0xa2'))[_0x30e8('0xa3')]([_0x30e8('0xa4'),'scheduledAt',_0x30e8('0xa5'),'ListId','VoiceQueueId',_0x30e8('0x5f'),_0x30e8('0x60')],squel['select']()['field'](_0x30e8('0xa4'),_0x30e8('0xa4'))[_0x30e8('0x81')]('NOW()','scheduledAt')[_0x30e8('0x81')]('id',_0x30e8('0xa5'))[_0x30e8('0x81')](_0x5d1d09[_0x30e8('0xa6')][_0x30e8('0x8c')](),_0x30e8('0xa7'))[_0x30e8('0x81')](_0x537328[_0x30e8('0x5e')]['id'][_0x30e8('0x8c')](),_0x30e8('0x64'))[_0x30e8('0x81')](_0x30e8('0xa8'),_0x30e8('0x5f'))[_0x30e8('0x81')]('NOW()',_0x30e8('0x60'))['from'](_0x30e8('0xa9'))[_0x30e8('0x47')](_0x30e8('0xaa'))[_0x30e8('0x47')](_0x30e8('0xab'),_0x5d1d09[_0x30e8('0xa6')][_0x30e8('0x8c')]())[_0x30e8('0x47')](_0x30e8('0xac'))[_0x30e8('0x47')](_0x30e8('0xad'),squel[_0x30e8('0xae')]()['field'](_0x30e8('0xaf'))[_0x30e8('0x83')]('cm_hopper_final')[_0x30e8('0x47')]('VoiceQueueId\x20=\x20?',_0x537328[_0x30e8('0x5e')]['id'][_0x30e8('0x8c')]()))[_0x30e8('0x47')](_0x30e8('0xad'),squel[_0x30e8('0xae')]()[_0x30e8('0x81')]('COALESCE(phone,\x27\x27)')[_0x30e8('0x83')](_0x30e8('0xa2'))[_0x30e8('0x47')](_0x30e8('0x88'),_0x537328[_0x30e8('0x5e')]['id'][_0x30e8('0x8c')]())))[_0x30e8('0x8c')]();break;case _0x30e8('0xb0'):_0x44eb46=squel[_0x30e8('0xa0')]()[_0x30e8('0xa1')](_0x30e8('0xa2'))[_0x30e8('0xa3')](['phone','scheduledAt',_0x30e8('0xa5'),_0x30e8('0xa7'),_0x30e8('0x64'),'createdAt',_0x30e8('0x60')],squel['select']()[_0x30e8('0x81')]('phone',_0x30e8('0xa4'))[_0x30e8('0x81')](_0x30e8('0xa8'),_0x30e8('0xb1'))[_0x30e8('0x81')]('id',_0x30e8('0xa5'))[_0x30e8('0x81')](_0x5d1d09[_0x30e8('0xa6')][_0x30e8('0x8c')](),_0x30e8('0xa7'))[_0x30e8('0x81')](_0x537328[_0x30e8('0x5e')]['id'][_0x30e8('0x8c')](),'VoiceQueueId')['field'](_0x30e8('0xa8'),_0x30e8('0x5f'))[_0x30e8('0x81')]('NOW()','updatedAt')['from'](_0x30e8('0xa9'))[_0x30e8('0x47')](_0x30e8('0xaa'))[_0x30e8('0x47')](_0x30e8('0xab'),_0x5d1d09[_0x30e8('0xa6')][_0x30e8('0x8c')]())[_0x30e8('0x47')](_0x30e8('0xac'))[_0x30e8('0x47')](_0x30e8('0xad'),squel[_0x30e8('0xae')]()['field'](_0x30e8('0xb2'))[_0x30e8('0x83')]('cm_hopper')['where'](_0x30e8('0x88'),_0x537328['params']['id'][_0x30e8('0x8c')]())))[_0x30e8('0x8c')]();break;default:_0x44eb46=squel[_0x30e8('0xa0')]()[_0x30e8('0xa1')](_0x30e8('0xa2'))[_0x30e8('0xa3')](['phone','scheduledAt',_0x30e8('0xa5'),_0x30e8('0xa7'),_0x30e8('0x64'),_0x30e8('0x5f'),'updatedAt'],squel[_0x30e8('0xae')]()[_0x30e8('0x81')](_0x30e8('0xa4'),'phone')['field'](_0x30e8('0xa8'),_0x30e8('0xb1'))[_0x30e8('0x81')]('id','ContactId')[_0x30e8('0x81')](_0x5d1d09[_0x30e8('0xa6')][_0x30e8('0x8c')](),'ListId')['field'](_0x537328[_0x30e8('0x5e')]['id'][_0x30e8('0x8c')](),_0x30e8('0x64'))[_0x30e8('0x81')](_0x30e8('0xa8'),_0x30e8('0x5f'))['field'](_0x30e8('0xa8'),_0x30e8('0x60'))[_0x30e8('0x83')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x30e8('0xab'),_0x5d1d09[_0x30e8('0xa6')][_0x30e8('0x8c')]())[_0x30e8('0x47')](_0x30e8('0xac')))[_0x30e8('0x8c')]();}_0x207d54[_0x30e8('0x8a')](db[_0x30e8('0x8b')][_0x30e8('0x3b')](_0x44eb46));}return BPromise[_0x30e8('0xb3')](_0x207d54);}})[_0x30e8('0x29')](function(){return _0x37ebb1;})[_0x30e8('0x29')](respondWithResult(_0x2ac836,null))[_0x30e8('0x4f')](handleError(_0x2ac836,null));};exports[_0x30e8('0xb4')]=function(_0x30547b,_0xe37a0d,_0x1acf30){return db['VoiceQueue'][_0x30e8('0x32')]({'where':{'id':_0x30547b[_0x30e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0xe37a0d,null))[_0x30e8('0x29')](function(_0x30489c){if(_0x30489c){return _0x30489c[_0x30e8('0xb4')](_0x30547b[_0x30e8('0x3b')][_0x30e8('0x80')]);}})['then'](function(_0x92cf63){if(_0x92cf63){return db[_0x30e8('0x63')][_0x30e8('0x2a')]({'where':{'ListId':_0x30547b[_0x30e8('0x3b')]['ids'],'VoiceQueueId':_0x30547b[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](function(){return _0x92cf63;});}})['then'](respondWithStatusCode(_0xe37a0d,null))['catch'](handleError(_0xe37a0d,null));};exports[_0x30e8('0xb5')]=function(_0x4ca194,_0x4ee0e9,_0x21b8c9){var _0x41d530={};var _0x43e1a6={};var _0x413f78;var _0x18cc23;return db['VoiceQueue'][_0x30e8('0x69')]({'where':{'id':_0x4ca194[_0x30e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4ee0e9,null))[_0x30e8('0x29')](function(_0x1a8ec9){if(_0x1a8ec9){_0x413f78=_0x1a8ec9;_0x43e1a6[_0x30e8('0x40')]=_[_0x30e8('0x3c')](db[_0x30e8('0xb6')][_0x30e8('0x39')]);_0x43e1a6[_0x30e8('0x3b')]=_['keys'](_0x4ca194['query']);_0x43e1a6[_0x30e8('0x3d')]=_[_0x30e8('0x3e')](_0x43e1a6[_0x30e8('0x40')],_0x43e1a6[_0x30e8('0x3b')]);_0x41d530[_0x30e8('0x3f')]=_[_0x30e8('0x3e')](_0x43e1a6[_0x30e8('0x40')],qs[_0x30e8('0x41')](_0x4ca194[_0x30e8('0x3b')]['fields']));_0x41d530[_0x30e8('0x3f')]=_0x41d530['attributes'][_0x30e8('0x42')]?_0x41d530[_0x30e8('0x3f')]:_0x43e1a6[_0x30e8('0x40')];_0x41d530[_0x30e8('0x45')]=qs[_0x30e8('0x46')](_0x4ca194[_0x30e8('0x3b')][_0x30e8('0x46')]);_0x41d530[_0x30e8('0x47')]=qs[_0x30e8('0x3d')](_['pick'](_0x4ca194[_0x30e8('0x3b')],_0x43e1a6[_0x30e8('0x3d')]));if(_0x4ca194[_0x30e8('0x3b')][_0x30e8('0x49')]){_0x41d530[_0x30e8('0x47')]=_['merge'](_0x41d530[_0x30e8('0x47')],{'$or':_[_0x30e8('0x2f')](_0x41d530['attributes'],function(_0x4e8f6f){var _0x3419e2={};_0x3419e2[_0x4e8f6f]={'$like':'%'+_0x4ca194[_0x30e8('0x3b')]['filter']+'%'};return _0x3419e2;})});}_0x41d530=_[_0x30e8('0x4a')]({},_0x41d530,_0x4ca194['options']);return _0x413f78[_0x30e8('0xb5')](_0x41d530);}})[_0x30e8('0x29')](function(_0x532352){if(_0x532352){_0x18cc23=_0x532352[_0x30e8('0x42')];if(!_0x4ca194[_0x30e8('0x3b')][_0x30e8('0x43')]('nolimit')){_0x41d530[_0x30e8('0x21')]=qs[_0x30e8('0x21')](_0x4ca194['query'][_0x30e8('0x21')]);_0x41d530['offset']=qs[_0x30e8('0x20')](_0x4ca194[_0x30e8('0x3b')][_0x30e8('0x20')]);}return _0x413f78[_0x30e8('0xb5')](_0x41d530);}})[_0x30e8('0x29')](function(_0x72bcc3){if(_0x72bcc3){return _0x72bcc3?{'count':_0x18cc23,'rows':_0x72bcc3}:null;}})[_0x30e8('0x29')](respondWithResult(_0x4ee0e9,null))['catch'](handleError(_0x4ee0e9,null));};exports['addBlackLists']=function(_0x280de5,_0x3e696e,_0x5da084){var _0x3293ed,_0x4d8603;return db['VoiceQueue'][_0x30e8('0x32')]({'where':{'id':_0x280de5[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x3e696e,null))[_0x30e8('0x29')](function(_0x346288){if(_0x346288){_0x4d8603=_0x346288;return _0x346288[_0x30e8('0xb7')](_0x280de5[_0x30e8('0x53')][_0x30e8('0x80')],_[_0x30e8('0x97')](_0x280de5[_0x30e8('0x53')],['ids','id'])||{});}return null;})['spread'](function(_0x294f92){var _0x20a00f;_0x3293ed=_0x294f92||[];var _0x2644de=[];if(_0x294f92){for(var _0x144cac=0x0;_0x144cac<_0x294f92['length'];_0x144cac+=0x1){var _0x333dc3=_0x294f92[_0x144cac]['get']({'plain':!![]});_0x20a00f=squel[_0x30e8('0xa0')]()['into'](_0x30e8('0xb8'))[_0x30e8('0xa3')]([_0x30e8('0xa4'),'ContactId',_0x30e8('0xa7'),_0x30e8('0x64'),_0x30e8('0x5f'),_0x30e8('0x60')],squel[_0x30e8('0xae')]()['field']('phone',_0x30e8('0xa4'))['field']('id','ContactId')[_0x30e8('0x81')](_0x333dc3['CmListId'][_0x30e8('0x8c')](),_0x30e8('0xa7'))[_0x30e8('0x81')](_0x280de5['params']['id'][_0x30e8('0x8c')](),_0x30e8('0x64'))[_0x30e8('0x81')](_0x30e8('0xa8'),_0x30e8('0x5f'))[_0x30e8('0x81')](_0x30e8('0xa8'),_0x30e8('0x60'))[_0x30e8('0x83')](_0x30e8('0xa9'))['where'](_0x30e8('0xaa'))[_0x30e8('0x47')](_0x30e8('0xab'),_0x333dc3['CmListId'][_0x30e8('0x8c')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x30e8('0x8c')]();_0x2644de[_0x30e8('0x8a')](db[_0x30e8('0x8b')]['query'](_0x20a00f));}return BPromise['all'](_0x2644de);}})['then'](function(){return _0x3293ed;})['then'](respondWithResult(_0x3e696e,null))[_0x30e8('0x4f')](handleError(_0x3e696e,null));};exports['removeBlackLists']=function(_0x86e310,_0x1d7fc2,_0x3abae1){return db[_0x30e8('0x38')]['find']({'where':{'id':_0x86e310[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](handleEntityNotFound(_0x1d7fc2,null))[_0x30e8('0x29')](function(_0x4f804d){if(_0x4f804d){return _0x4f804d[_0x30e8('0xb9')](_0x86e310['query'][_0x30e8('0x80')]);}})[_0x30e8('0x29')](function(_0xdacc73){if(_0xdacc73){return db[_0x30e8('0x6c')][_0x30e8('0x2a')]({'where':{'ListId':_0x86e310[_0x30e8('0x3b')]['ids'],'VoiceQueueId':_0x86e310[_0x30e8('0x5e')]['id']}})[_0x30e8('0x29')](function(){return _0xdacc73;});}})[_0x30e8('0x29')](respondWithStatusCode(_0x1d7fc2,null))[_0x30e8('0x4f')](handleError(_0x1d7fc2,null));}; \ No newline at end of file +var _0x1c12=['VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','fromQuery','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','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','redis','defaults','socket.io-emitter','./voiceQueue.socket','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','sendStatus','error','stack','VoiceQueue','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','keys','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','update','getHoppers','CmHopper','VoiceQueueId','options','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','SIP/%s','interface','emit','userVoiceQueue:save','removeTeams','User','select','field','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','UserVoiceQueueRt','format','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final'];(function(_0x3ed054,_0x4d4f16){var _0x16dd95=function(_0xc0c19c){while(--_0xc0c19c){_0x3ed054['push'](_0x3ed054['shift']());}};_0x16dd95(++_0x4d4f16);}(_0x1c12,0x17a));var _0x21c1=function(_0x3f9f81,_0x56975b){_0x3f9f81=_0x3f9f81-0x0;var _0x5a8352=_0x1c12[_0x3f9f81];return _0x5a8352;};'use strict';var emlformat=require(_0x21c1('0x0'));var rimraf=require(_0x21c1('0x1'));var zipdir=require(_0x21c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21c1('0x3'));var moment=require(_0x21c1('0x4'));var BPromise=require(_0x21c1('0x5'));var Mustache=require(_0x21c1('0x6'));var util=require(_0x21c1('0x7'));var path=require(_0x21c1('0x8'));var sox=require('sox');var csv=require(_0x21c1('0x9'));var ejs=require(_0x21c1('0xa'));var fs=require('fs');var fs_extra=require(_0x21c1('0xb'));var _=require(_0x21c1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x21c1('0xd'));var deskjs=require(_0x21c1('0xe'));var toCsv=require(_0x21c1('0x9'));var querystring=require(_0x21c1('0xf'));var Papa=require('papaparse');var Redis=require(_0x21c1('0x10'));var authService=require(_0x21c1('0x11'));var qs=require(_0x21c1('0x12'));var as=require(_0x21c1('0x13'));var hardwareService=require(_0x21c1('0x14'));var logger=require(_0x21c1('0x15'))('api');var utils=require(_0x21c1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x21c1('0x17'));var db=require(_0x21c1('0x18'))['db'];config[_0x21c1('0x19')]=_[_0x21c1('0x1a')](config[_0x21c1('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x21c1('0x1b'))(new Redis(config[_0x21c1('0x19')]));require(_0x21c1('0x1c'))['register'](socket);function respondWithStatusCode(_0x58661a,_0x5782b3){_0x5782b3=_0x5782b3||0xcc;return function(_0x1fd23a){if(_0x1fd23a){return _0x58661a['sendStatus'](_0x5782b3);}return _0x58661a['status'](_0x5782b3)['end']();};}function respondWithResult(_0x514184,_0x26f2a7){_0x26f2a7=_0x26f2a7||0xc8;return function(_0x321a62){if(_0x321a62){return _0x514184[_0x21c1('0x1d')](_0x26f2a7)[_0x21c1('0x1e')](_0x321a62);}};}function respondWithFilteredResult(_0x40f999,_0x48e31c){return function(_0xb22534){if(_0xb22534){var _0x314f8e=typeof _0x48e31c[_0x21c1('0x1f')]===_0x21c1('0x20')&&typeof _0x48e31c['limit']===_0x21c1('0x20');var _0x5b37a6=_0xb22534[_0x21c1('0x21')];var _0x81d991=_0x314f8e?0x0:_0x48e31c[_0x21c1('0x1f')];var _0x219351=_0x314f8e?_0xb22534[_0x21c1('0x21')]:_0x48e31c[_0x21c1('0x1f')]+_0x48e31c['limit'];var _0x2bdf21;if(_0x219351>=_0x5b37a6){_0x219351=_0x5b37a6;_0x2bdf21=0xc8;}else{_0x2bdf21=0xce;}_0x40f999[_0x21c1('0x1d')](_0x2bdf21);return _0x40f999[_0x21c1('0x22')](_0x21c1('0x23'),_0x81d991+'-'+_0x219351+'/'+_0x5b37a6)[_0x21c1('0x1e')](_0xb22534);}return null;};}function patchUpdates(_0x22975c){return function(_0x3459c6){try{jsonpatch[_0x21c1('0x24')](_0x3459c6,_0x22975c,!![]);}catch(_0x2e3f9f){return BPromise[_0x21c1('0x25')](_0x2e3f9f);}return _0x3459c6[_0x21c1('0x26')]();};}function saveUpdates(_0x4bfe4a,_0x2d3acd){return function(_0x436efa){if(_0x436efa){return _0x436efa['update'](_0x4bfe4a)[_0x21c1('0x27')](function(_0x5a55fc){return _0x5a55fc;});}return null;};}function removeEntity(_0xeebf48,_0x4d1ce8){return function(_0x71f0ef){if(_0x71f0ef){return _0x71f0ef[_0x21c1('0x28')]()[_0x21c1('0x27')](function(){var _0x1ce5c8=_0x71f0ef['get']({'plain':!![]});var _0x9002a3=[{'name':_0x21c1('0x29'),'value':_0x21c1('0x2a'),'ignore':![]},{'name':_0x21c1('0x2b'),'value':_0x21c1('0x2c'),'ignore':![]}];var _0x263b65=_(_0x9002a3)[_0x21c1('0x2d')](_0x21c1('0x2e'))[_0x21c1('0x2f')]('value')[_0x21c1('0x30')]();if(_[_0x21c1('0x31')](_0x263b65,_0x1ce5c8[_0x21c1('0x32')])){return;}var _0x4a9c71=_[_0x21c1('0x33')](_0x9002a3,[_0x21c1('0x30'),_0x1ce5c8[_0x21c1('0x32')]])[_0x21c1('0x34')];return db[_0x21c1('0x35')]['destroy']({'where':{'type':_0x4a9c71,'resourceId':_0x1ce5c8['id']}})[_0x21c1('0x27')](function(){return _0x71f0ef;});})['then'](function(){_0xeebf48[_0x21c1('0x1d')](0xcc)[_0x21c1('0x36')]();});}};}function handleEntityNotFound(_0x4cc41f,_0x37b483){return function(_0x396c80){if(!_0x396c80){_0x4cc41f[_0x21c1('0x37')](0x194);}return _0x396c80;};}function handleError(_0xad5b7a,_0x5d056d){_0x5d056d=_0x5d056d||0x1f4;return function(_0x20e55e){logger[_0x21c1('0x38')](_0x20e55e[_0x21c1('0x39')]);if(_0x20e55e[_0x21c1('0x34')]){delete _0x20e55e[_0x21c1('0x34')];}_0xad5b7a['status'](_0x5d056d)['send'](_0x20e55e);};}exports['index']=function(_0x2c138f,_0x45592a){var _0x5ce126={},_0x414d45={},_0x155e13={'count':0x0,'rows':[]};var _0x4808a9=_[_0x21c1('0x2f')](db[_0x21c1('0x3a')][_0x21c1('0x3b')],function(_0x16d9d4){return{'name':_0x16d9d4[_0x21c1('0x3c')],'type':_0x16d9d4[_0x21c1('0x32')]['key']};});_0x414d45[_0x21c1('0x3d')]=_[_0x21c1('0x2f')](_0x4808a9,'name');_0x414d45[_0x21c1('0x3e')]=_['keys'](_0x2c138f['query']);_0x414d45[_0x21c1('0x3f')]=_['intersection'](_0x414d45['model'],_0x414d45[_0x21c1('0x3e')]);_0x5ce126[_0x21c1('0x40')]=_[_0x21c1('0x41')](_0x414d45['model'],qs[_0x21c1('0x42')](_0x2c138f[_0x21c1('0x3e')][_0x21c1('0x42')]));_0x5ce126['attributes']=_0x5ce126[_0x21c1('0x40')][_0x21c1('0x43')]?_0x5ce126[_0x21c1('0x40')]:_0x414d45[_0x21c1('0x3d')];if(!_0x2c138f['query'][_0x21c1('0x44')](_0x21c1('0x45'))){_0x5ce126[_0x21c1('0x46')]=qs['limit'](_0x2c138f[_0x21c1('0x3e')][_0x21c1('0x46')]);_0x5ce126['offset']=qs[_0x21c1('0x1f')](_0x2c138f[_0x21c1('0x3e')][_0x21c1('0x1f')]);}_0x5ce126[_0x21c1('0x47')]=qs[_0x21c1('0x48')](_0x2c138f['query'][_0x21c1('0x48')]);_0x5ce126[_0x21c1('0x49')]=qs['filters'](_[_0x21c1('0x4a')](_0x2c138f[_0x21c1('0x3e')],_0x414d45['filters']),_0x4808a9);if(_0x2c138f['query'][_0x21c1('0x2d')]){_0x5ce126['where']=_[_0x21c1('0x4b')](_0x5ce126['where'],{'$or':_[_0x21c1('0x2f')](_0x4808a9,function(_0x3835b4){if(_0x3835b4['type']!=='VIRTUAL'){var _0x113bd7={};_0x113bd7[_0x3835b4[_0x21c1('0x34')]]={'$like':'%'+_0x2c138f[_0x21c1('0x3e')][_0x21c1('0x2d')]+'%'};return _0x113bd7;}})});}_0x5ce126=_[_0x21c1('0x4b')]({},_0x5ce126,_0x2c138f['options']);var _0x1746ee={'where':_0x5ce126[_0x21c1('0x49')]};return db[_0x21c1('0x3a')][_0x21c1('0x21')](_0x1746ee)['then'](function(_0x2d1086){_0x155e13[_0x21c1('0x21')]=_0x2d1086;if(_0x2c138f['query'][_0x21c1('0x4c')]){_0x5ce126[_0x21c1('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x21c1('0x4e')](_0x5ce126);})[_0x21c1('0x27')](function(_0x4804bd){_0x155e13[_0x21c1('0x4f')]=_0x4804bd;return _0x155e13;})[_0x21c1('0x27')](respondWithFilteredResult(_0x45592a,_0x5ce126))[_0x21c1('0x50')](handleError(_0x45592a,null));};exports[_0x21c1('0x51')]=function(_0xcd2e02,_0x3e21b7){var _0x200143={'raw':![],'where':{'id':_0xcd2e02[_0x21c1('0x52')]['id']}},_0x2fb6b1={};_0x2fb6b1[_0x21c1('0x3d')]=_[_0x21c1('0x53')](db[_0x21c1('0x3a')][_0x21c1('0x3b')]);_0x2fb6b1['query']=_[_0x21c1('0x53')](_0xcd2e02[_0x21c1('0x3e')]);_0x2fb6b1['filters']=_[_0x21c1('0x41')](_0x2fb6b1[_0x21c1('0x3d')],_0x2fb6b1[_0x21c1('0x3e')]);_0x200143[_0x21c1('0x40')]=_[_0x21c1('0x41')](_0x2fb6b1['model'],qs['fields'](_0xcd2e02[_0x21c1('0x3e')][_0x21c1('0x42')]));_0x200143[_0x21c1('0x40')]=_0x200143[_0x21c1('0x40')][_0x21c1('0x43')]?_0x200143['attributes']:_0x2fb6b1[_0x21c1('0x3d')];if(_0xcd2e02['query'][_0x21c1('0x4c')]){_0x200143['include']=[{'all':!![]}];}_0x200143=_['merge']({},_0x200143,_0xcd2e02['options']);return db[_0x21c1('0x3a')]['find'](_0x200143)[_0x21c1('0x27')](handleEntityNotFound(_0x3e21b7,null))[_0x21c1('0x27')](respondWithResult(_0x3e21b7,null))['catch'](handleError(_0x3e21b7,null));};exports[_0x21c1('0x54')]=function(_0x6a3f9a,_0x41a89a){return db[_0x21c1('0x3a')]['create'](_0x6a3f9a['body'],{})[_0x21c1('0x27')](function(_0x2fedb3){var _0x3dc80e=_0x6a3f9a['user'][_0x21c1('0x55')]({'plain':!![]});if(!_0x3dc80e)throw new Error(_0x21c1('0x56'));if(_0x3dc80e['role']===_0x21c1('0x57')){var _0x4dd029=_0x2fedb3[_0x21c1('0x55')]({'plain':!![]});var _0x327b3c=[{'name':_0x21c1('0x29'),'value':_0x21c1('0x2a')},{'name':'QueueCampaigns','value':_0x21c1('0x2c')}];var _0x5a00e1=_['find'](_0x327b3c,[_0x21c1('0x30'),_0x4dd029['type']])[_0x21c1('0x34')];return db[_0x21c1('0x58')][_0x21c1('0x33')]({'where':{'name':_0x5a00e1,'userProfileId':_0x3dc80e[_0x21c1('0x59')]},'raw':!![]})[_0x21c1('0x27')](function(_0x5ac35a){if(_0x5ac35a&&_0x5ac35a['autoAssociation']===0x0){return db[_0x21c1('0x35')][_0x21c1('0x54')]({'name':_0x4dd029[_0x21c1('0x34')],'resourceId':_0x4dd029['id'],'type':_0x5ac35a['name'],'sectionId':_0x5ac35a['id']},{})[_0x21c1('0x27')](function(){return _0x2fedb3;});}else{return _0x2fedb3;}})[_0x21c1('0x50')](function(_0x178461){logger[_0x21c1('0x38')](_0x21c1('0x5a'),_0x178461);throw _0x178461;});}return _0x2fedb3;})[_0x21c1('0x27')](respondWithResult(_0x41a89a,0xc9))['catch'](handleError(_0x41a89a,null));};exports[_0x21c1('0x5b')]=function(_0xde8078,_0x57e436){var _0x41f01a={'where':{'id':_0xde8078[_0x21c1('0x52')]['id']}},_0x1ada8f={};_0x1ada8f['model']=_[_0x21c1('0x53')](db[_0x21c1('0x3a')]['rawAttributes']);_0x41f01a[_0x21c1('0x40')]=_[_0x21c1('0x41')](_0x1ada8f[_0x21c1('0x3d')],qs['fields'](_0xde8078[_0x21c1('0x3e')][_0x21c1('0x42')]));_0x41f01a[_0x21c1('0x40')]=_0x41f01a[_0x21c1('0x40')][_0x21c1('0x43')]?_0x41f01a[_0x21c1('0x40')]:_0x1ada8f[_0x21c1('0x3d')];if(_0xde8078[_0x21c1('0x3e')][_0x21c1('0x4c')]){_0x41f01a[_0x21c1('0x4d')]=[{'all':!![]}];}_0x41f01a=_['merge']({},_0x41f01a,_0xde8078['options']);return db[_0x21c1('0x3a')][_0x21c1('0x33')](_0x41f01a)[_0x21c1('0x27')](handleEntityNotFound(_0x57e436,null))[_0x21c1('0x27')](function(_0x10ddf2){if(_0x10ddf2){var _0x513e3f=_0x10ddf2[_0x21c1('0x55')]({'plain':!![]});_0x513e3f=qs[_0x21c1('0x5c')](_0x513e3f,['id',_0x21c1('0x5d'),_0x21c1('0x5e')]);_0xde8078['body']=_[_0x21c1('0x5c')](_0xde8078[_0x21c1('0x5f')],['id','createdAt',_0x21c1('0x5e')]);return db[_0x21c1('0x3a')]['create'](_['merge'](_0x513e3f,_0xde8078['body']),{'include':_0xde8078[_0x21c1('0x3e')][_0x21c1('0x4c')]?[{'all':!![]}]:undefined})[_0x21c1('0x27')](function(_0x5b35fa){var _0x3ce421=_0xde8078[_0x21c1('0x57')][_0x21c1('0x55')]({'plain':!![]});if(!_0x3ce421)throw new Error(_0x21c1('0x56'));if(_0x3ce421['role']===_0x21c1('0x57')){var _0x23aa74=_0x5b35fa[_0x21c1('0x55')]({'plain':!![]});var _0x526d70=[{'name':_0x21c1('0x29'),'value':'inbound'},{'name':_0x21c1('0x2b'),'value':'outbound'}];var _0x4a29f7=_[_0x21c1('0x33')](_0x526d70,[_0x21c1('0x30'),_0x23aa74['type']])[_0x21c1('0x34')];return db[_0x21c1('0x58')][_0x21c1('0x33')]({'where':{'name':_0x4a29f7,'userProfileId':_0x3ce421[_0x21c1('0x59')]},'raw':!![]})[_0x21c1('0x27')](function(_0x5f5aa3){if(_0x5f5aa3&&_0x5f5aa3['autoAssociation']===0x0){return db[_0x21c1('0x35')][_0x21c1('0x54')]({'name':_0x23aa74[_0x21c1('0x34')],'resourceId':_0x23aa74['id'],'type':_0x5f5aa3[_0x21c1('0x34')],'sectionId':_0x5f5aa3['id']},{})[_0x21c1('0x27')](function(){return _0x5b35fa;});}else{return _0x5b35fa;}})[_0x21c1('0x50')](function(_0x3e9efe){logger[_0x21c1('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e9efe);throw _0x3e9efe;});}return _0x5b35fa;});}})[_0x21c1('0x27')](respondWithResult(_0x57e436,0xc9))['catch'](handleError(_0x57e436,null));};exports[_0x21c1('0x60')]=function(_0x395d92,_0x1af8a6){if(_0x395d92['body']['id']){delete _0x395d92[_0x21c1('0x5f')]['id'];}return db[_0x21c1('0x3a')]['find']({'where':{'id':_0x395d92['params']['id']}})['then'](handleEntityNotFound(_0x1af8a6,null))[_0x21c1('0x27')](saveUpdates(_0x395d92[_0x21c1('0x5f')],null))['then'](respondWithResult(_0x1af8a6,null))['catch'](handleError(_0x1af8a6,null));};exports['destroy']=function(_0x546cdd,_0x2818c3){return db[_0x21c1('0x3a')][_0x21c1('0x33')]({'where':{'id':_0x546cdd[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x2818c3,null))[_0x21c1('0x27')](removeEntity(_0x2818c3,null))[_0x21c1('0x50')](handleError(_0x2818c3,null));};exports[_0x21c1('0x61')]=function(_0x519abc,_0x16170a,_0x436f78){var _0x4d1229={'raw':![],'where':{}};var _0x54a495={};var _0x2c5bcd={'count':0x0,'rows':[]};return db[_0x21c1('0x3a')]['findOne']({'where':{'id':_0x519abc['params']['id']}})['then'](handleEntityNotFound(_0x16170a,null))['then'](function(_0x1e9ccb){if(_0x1e9ccb){_0x54a495[_0x21c1('0x3d')]=_['keys'](db[_0x21c1('0x62')][_0x21c1('0x3b')]);_0x54a495[_0x21c1('0x3e')]=_[_0x21c1('0x53')](_0x519abc[_0x21c1('0x3e')]);_0x54a495[_0x21c1('0x3f')]=_['intersection'](_0x54a495['model'],_0x54a495[_0x21c1('0x3e')]);_0x4d1229[_0x21c1('0x40')]=_['intersection'](_0x54a495['model'],qs[_0x21c1('0x42')](_0x519abc[_0x21c1('0x3e')]['fields']));_0x4d1229[_0x21c1('0x40')]=_0x4d1229[_0x21c1('0x40')]['length']?_0x4d1229[_0x21c1('0x40')]:_0x54a495['model'];if(!_0x519abc[_0x21c1('0x3e')][_0x21c1('0x44')](_0x21c1('0x45'))){_0x4d1229[_0x21c1('0x46')]=qs['limit'](_0x519abc[_0x21c1('0x3e')]['limit']);_0x4d1229[_0x21c1('0x1f')]=qs[_0x21c1('0x1f')](_0x519abc[_0x21c1('0x3e')][_0x21c1('0x1f')]);}_0x4d1229[_0x21c1('0x47')]=qs[_0x21c1('0x48')](_0x519abc['query']['sort']);_0x4d1229[_0x21c1('0x49')]=qs[_0x21c1('0x3f')](_[_0x21c1('0x4a')](_0x519abc[_0x21c1('0x3e')],_0x54a495[_0x21c1('0x3f')]));_0x4d1229[_0x21c1('0x49')][_0x21c1('0x63')]=_0x1e9ccb['id'];if(_0x519abc['query'][_0x21c1('0x2d')]){_0x4d1229[_0x21c1('0x49')]=_[_0x21c1('0x4b')](_0x4d1229[_0x21c1('0x49')],{'$or':_[_0x21c1('0x2f')](_0x4d1229[_0x21c1('0x40')],function(_0x55fb72){var _0x12c093={};_0x12c093[_0x55fb72]={'$like':'%'+_0x519abc[_0x21c1('0x3e')][_0x21c1('0x2d')]+'%'};return _0x12c093;})});}_0x4d1229=_[_0x21c1('0x4b')]({},_0x4d1229,_0x519abc[_0x21c1('0x64')]);return db[_0x21c1('0x62')]['count']({'where':_0x4d1229[_0x21c1('0x49')]})[_0x21c1('0x27')](function(_0x21908b){_0x2c5bcd[_0x21c1('0x21')]=_0x21908b;if(_0x519abc[_0x21c1('0x3e')]['includeAll']){_0x4d1229['include']=[{'all':!![]}];}return db['CmHopper'][_0x21c1('0x4e')](_0x4d1229);})[_0x21c1('0x27')](function(_0x47a9f7){_0x2c5bcd[_0x21c1('0x4f')]=_0x47a9f7;return _0x2c5bcd;});}})[_0x21c1('0x27')](respondWithFilteredResult(_0x16170a,_0x4d1229))[_0x21c1('0x50')](handleError(_0x16170a,null));};exports[_0x21c1('0x65')]=function(_0x10783b,_0x36adcd,_0x520077){var _0x14ca93={'raw':!![],'where':{}};var _0x514afb={};var _0x150f68={'count':0x0,'rows':[]};return db[_0x21c1('0x3a')][_0x21c1('0x66')]({'where':{'id':_0x10783b[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x36adcd,null))[_0x21c1('0x27')](function(_0x2d4a2c){if(_0x2d4a2c){_0x514afb[_0x21c1('0x3d')]=_[_0x21c1('0x53')](db[_0x21c1('0x67')]['rawAttributes']);_0x514afb[_0x21c1('0x3e')]=_[_0x21c1('0x53')](_0x10783b[_0x21c1('0x3e')]);_0x514afb[_0x21c1('0x3f')]=_[_0x21c1('0x41')](_0x514afb['model'],_0x514afb[_0x21c1('0x3e')]);_0x14ca93['attributes']=_[_0x21c1('0x41')](_0x514afb['model'],qs[_0x21c1('0x42')](_0x10783b['query'][_0x21c1('0x42')]));_0x14ca93[_0x21c1('0x40')]=_0x14ca93[_0x21c1('0x40')]['length']?_0x14ca93[_0x21c1('0x40')]:_0x514afb[_0x21c1('0x3d')];if(!_0x10783b[_0x21c1('0x3e')][_0x21c1('0x44')](_0x21c1('0x45'))){_0x14ca93[_0x21c1('0x46')]=qs['limit'](_0x10783b[_0x21c1('0x3e')][_0x21c1('0x46')]);_0x14ca93[_0x21c1('0x1f')]=qs[_0x21c1('0x1f')](_0x10783b[_0x21c1('0x3e')][_0x21c1('0x1f')]);}_0x14ca93[_0x21c1('0x47')]=qs[_0x21c1('0x48')](_0x10783b['query']['sort']);_0x14ca93['where']=qs[_0x21c1('0x3f')](_[_0x21c1('0x4a')](_0x10783b['query'],_0x514afb['filters']));_0x14ca93['where'][_0x21c1('0x63')]=_0x2d4a2c['id'];if(_0x10783b[_0x21c1('0x3e')][_0x21c1('0x2d')]){_0x14ca93['where']=_[_0x21c1('0x4b')](_0x14ca93[_0x21c1('0x49')],{'$or':_[_0x21c1('0x2f')](_0x14ca93[_0x21c1('0x40')],function(_0x34a6f3){var _0x26418b={};_0x26418b[_0x34a6f3]={'$like':'%'+_0x10783b[_0x21c1('0x3e')][_0x21c1('0x2d')]+'%'};return _0x26418b;})});}_0x14ca93=_[_0x21c1('0x4b')]({},_0x14ca93,_0x10783b['options']);return db[_0x21c1('0x67')][_0x21c1('0x21')]({'where':_0x14ca93[_0x21c1('0x49')]})[_0x21c1('0x27')](function(_0x184cee){_0x150f68[_0x21c1('0x21')]=_0x184cee;if(_0x10783b[_0x21c1('0x3e')]['includeAll']){_0x14ca93[_0x21c1('0x4d')]=[{'all':!![]}];}return db[_0x21c1('0x67')][_0x21c1('0x4e')](_0x14ca93);})[_0x21c1('0x27')](function(_0x28125c){_0x150f68[_0x21c1('0x4f')]=_0x28125c;return _0x150f68;});}})['then'](respondWithFilteredResult(_0x36adcd,_0x14ca93))[_0x21c1('0x50')](handleError(_0x36adcd,null));};exports[_0x21c1('0x68')]=function(_0x31f27d,_0x536f4a,_0x1e86f1){var _0x5c16ca={'raw':!![],'where':{}};var _0x20d482={};var _0x1d96fc={'count':0x0,'rows':[]};return db[_0x21c1('0x3a')][_0x21c1('0x66')]({'where':{'id':_0x31f27d[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x536f4a,null))[_0x21c1('0x27')](function(_0x3c0591){if(_0x3c0591){_0x20d482[_0x21c1('0x3d')]=_[_0x21c1('0x53')](db['CmHopperFinal'][_0x21c1('0x3b')]);_0x20d482[_0x21c1('0x3e')]=_[_0x21c1('0x53')](_0x31f27d['query']);_0x20d482[_0x21c1('0x3f')]=_[_0x21c1('0x41')](_0x20d482[_0x21c1('0x3d')],_0x20d482[_0x21c1('0x3e')]);_0x5c16ca[_0x21c1('0x40')]=_['intersection'](_0x20d482['model'],qs[_0x21c1('0x42')](_0x31f27d['query'][_0x21c1('0x42')]));_0x5c16ca[_0x21c1('0x40')]=_0x5c16ca[_0x21c1('0x40')][_0x21c1('0x43')]?_0x5c16ca[_0x21c1('0x40')]:_0x20d482['model'];if(!_0x31f27d[_0x21c1('0x3e')][_0x21c1('0x44')]('nolimit')){_0x5c16ca[_0x21c1('0x46')]=qs[_0x21c1('0x46')](_0x31f27d['query'][_0x21c1('0x46')]);_0x5c16ca[_0x21c1('0x1f')]=qs[_0x21c1('0x1f')](_0x31f27d['query'][_0x21c1('0x1f')]);}_0x5c16ca['order']=qs[_0x21c1('0x48')](_0x31f27d['query']['sort']);_0x5c16ca[_0x21c1('0x49')]=qs['filters'](_[_0x21c1('0x4a')](_0x31f27d[_0x21c1('0x3e')],_0x20d482[_0x21c1('0x3f')]));_0x5c16ca['where'][_0x21c1('0x63')]=_0x3c0591['id'];if(_0x31f27d[_0x21c1('0x3e')][_0x21c1('0x2d')]){_0x5c16ca['where']=_[_0x21c1('0x4b')](_0x5c16ca[_0x21c1('0x49')],{'$or':_[_0x21c1('0x2f')](_0x5c16ca[_0x21c1('0x40')],function(_0x5ad47f){var _0x12a758={};_0x12a758[_0x5ad47f]={'$like':'%'+_0x31f27d[_0x21c1('0x3e')][_0x21c1('0x2d')]+'%'};return _0x12a758;})});}_0x5c16ca=_[_0x21c1('0x4b')]({},_0x5c16ca,_0x31f27d[_0x21c1('0x64')]);return db[_0x21c1('0x69')][_0x21c1('0x21')]({'where':_0x5c16ca['where']})[_0x21c1('0x27')](function(_0x5b722a){_0x1d96fc[_0x21c1('0x21')]=_0x5b722a;if(_0x31f27d['query'][_0x21c1('0x4c')]){_0x5c16ca['include']=[{'all':!![]}];}return db[_0x21c1('0x69')]['findAll'](_0x5c16ca);})[_0x21c1('0x27')](function(_0x559473){_0x1d96fc[_0x21c1('0x4f')]=_0x559473;return _0x1d96fc;});}})[_0x21c1('0x27')](respondWithFilteredResult(_0x536f4a,_0x5c16ca))[_0x21c1('0x50')](handleError(_0x536f4a,null));};exports['getHopperBlacks']=function(_0x3e1ff7,_0x119277,_0x30167b){var _0x3ba82b={'raw':!![],'where':{}};var _0x266dda={};var _0x327530={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x21c1('0x66')]({'where':{'id':_0x3e1ff7[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x119277,null))[_0x21c1('0x27')](function(_0x16d32d){if(_0x16d32d){_0x266dda['model']=_[_0x21c1('0x53')](db['CmHopperBlack']['rawAttributes']);_0x266dda['query']=_[_0x21c1('0x53')](_0x3e1ff7[_0x21c1('0x3e')]);_0x266dda['filters']=_[_0x21c1('0x41')](_0x266dda['model'],_0x266dda['query']);_0x3ba82b[_0x21c1('0x40')]=_[_0x21c1('0x41')](_0x266dda[_0x21c1('0x3d')],qs[_0x21c1('0x42')](_0x3e1ff7[_0x21c1('0x3e')]['fields']));_0x3ba82b[_0x21c1('0x40')]=_0x3ba82b['attributes'][_0x21c1('0x43')]?_0x3ba82b['attributes']:_0x266dda['model'];if(!_0x3e1ff7['query'][_0x21c1('0x44')](_0x21c1('0x45'))){_0x3ba82b[_0x21c1('0x46')]=qs[_0x21c1('0x46')](_0x3e1ff7[_0x21c1('0x3e')][_0x21c1('0x46')]);_0x3ba82b[_0x21c1('0x1f')]=qs['offset'](_0x3e1ff7[_0x21c1('0x3e')][_0x21c1('0x1f')]);}_0x3ba82b[_0x21c1('0x47')]=qs['sort'](_0x3e1ff7[_0x21c1('0x3e')][_0x21c1('0x48')]);_0x3ba82b[_0x21c1('0x49')]=qs[_0x21c1('0x3f')](_[_0x21c1('0x4a')](_0x3e1ff7[_0x21c1('0x3e')],_0x266dda[_0x21c1('0x3f')]));_0x3ba82b[_0x21c1('0x49')][_0x21c1('0x63')]=_0x16d32d['id'];if(_0x3e1ff7[_0x21c1('0x3e')][_0x21c1('0x2d')]){_0x3ba82b['where']=_[_0x21c1('0x4b')](_0x3ba82b['where'],{'$or':_[_0x21c1('0x2f')](_0x3ba82b[_0x21c1('0x40')],function(_0x47195a){var _0x59081b={};_0x59081b[_0x47195a]={'$like':'%'+_0x3e1ff7['query'][_0x21c1('0x2d')]+'%'};return _0x59081b;})});}_0x3ba82b=_[_0x21c1('0x4b')]({},_0x3ba82b,_0x3e1ff7[_0x21c1('0x64')]);return db[_0x21c1('0x6a')][_0x21c1('0x21')]({'where':_0x3ba82b[_0x21c1('0x49')]})['then'](function(_0xad2256){_0x327530[_0x21c1('0x21')]=_0xad2256;if(_0x3e1ff7[_0x21c1('0x3e')]['includeAll']){_0x3ba82b[_0x21c1('0x4d')]=[{'all':!![]}];}return db[_0x21c1('0x6a')]['findAll'](_0x3ba82b);})['then'](function(_0x547636){_0x327530[_0x21c1('0x4f')]=_0x547636;return _0x327530;});}})[_0x21c1('0x27')](respondWithFilteredResult(_0x119277,_0x3ba82b))['catch'](handleError(_0x119277,null));};exports[_0x21c1('0x6b')]=function(_0x3a15ba,_0x276581,_0x5311c5){var _0x3be094={};var _0x51e93f={};var _0x550891;var _0xee796c;return db[_0x21c1('0x3a')][_0x21c1('0x66')]({'where':{'id':_0x3a15ba[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x276581,null))[_0x21c1('0x27')](function(_0x181eff){if(_0x181eff){_0x550891=_0x181eff;_0x51e93f[_0x21c1('0x3d')]=_[_0x21c1('0x53')](db[_0x21c1('0x6c')][_0x21c1('0x3b')]);_0x51e93f[_0x21c1('0x3e')]=_['keys'](_0x3a15ba[_0x21c1('0x3e')]);_0x51e93f['filters']=_[_0x21c1('0x41')](_0x51e93f['model'],_0x51e93f[_0x21c1('0x3e')]);_0x3be094[_0x21c1('0x40')]=_[_0x21c1('0x41')](_0x51e93f[_0x21c1('0x3d')],qs[_0x21c1('0x42')](_0x3a15ba['query'][_0x21c1('0x42')]));_0x3be094[_0x21c1('0x40')]=_0x3be094[_0x21c1('0x40')]['length']?_0x3be094[_0x21c1('0x40')]:_0x51e93f['model'];_0x3be094[_0x21c1('0x47')]=qs[_0x21c1('0x48')](_0x3a15ba[_0x21c1('0x3e')]['sort']);_0x3be094[_0x21c1('0x49')]=qs[_0x21c1('0x3f')](_[_0x21c1('0x4a')](_0x3a15ba[_0x21c1('0x3e')],_0x51e93f[_0x21c1('0x3f')]));if(_0x3a15ba['query'][_0x21c1('0x2d')]){_0x3be094[_0x21c1('0x49')]=_[_0x21c1('0x4b')](_0x3be094[_0x21c1('0x49')],{'$or':_[_0x21c1('0x2f')](_0x3be094[_0x21c1('0x40')],function(_0xd312ea){var _0x3ab2b8={};_0x3ab2b8[_0xd312ea]={'$like':'%'+_0x3a15ba['query']['filter']+'%'};return _0x3ab2b8;})});}_0x3be094=_[_0x21c1('0x4b')]({},_0x3be094,_0x3a15ba[_0x21c1('0x64')]);return _0x550891[_0x21c1('0x6b')](_0x3be094);}})[_0x21c1('0x27')](function(_0x31bbb7){if(_0x31bbb7){_0xee796c=_0x31bbb7[_0x21c1('0x43')];if(!_0x3a15ba['query'][_0x21c1('0x44')](_0x21c1('0x45'))){_0x3be094[_0x21c1('0x46')]=qs[_0x21c1('0x46')](_0x3a15ba['query'][_0x21c1('0x46')]);_0x3be094[_0x21c1('0x1f')]=qs['offset'](_0x3a15ba[_0x21c1('0x3e')][_0x21c1('0x1f')]);}return _0x550891[_0x21c1('0x6b')](_0x3be094);}})[_0x21c1('0x27')](function(_0x1fcf8b){if(_0x1fcf8b){return _0x1fcf8b?{'count':_0xee796c,'rows':_0x1fcf8b}:null;}})[_0x21c1('0x27')](respondWithResult(_0x276581,null))[_0x21c1('0x50')](handleError(_0x276581,null));};exports['addTeams']=function(_0xd0007,_0xb73f5e,_0x5a37e8){var _0x55edad=_0xd0007[_0x21c1('0x5f')][_0x21c1('0x6d')];var _0x52b30b=_[_0x21c1('0x2f')](_0x55edad,'id');return db['Team'][_0x21c1('0x4e')]({'where':{'id':_0x52b30b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x21c1('0x6e'),'attributes':['id','name',_0x21c1('0x6f'),_0x21c1('0x70'),'interface'],'raw':!![]}]})[_0x21c1('0x27')](function(_0x244880){if(_0x244880){var _0x2a6def=_[_0x21c1('0x71')](_0x244880,function(_0x21577e){var _0x5464f8=_0x21577e['get']({'plain':!![]});_0x5464f8[_0x21c1('0x6e')][_0x21c1('0x72')](function(_0x473dff){_0x473dff[_0x21c1('0x73')]=_[_0x21c1('0x33')](_0x55edad,{'id':_0x5464f8['id']})[_0x21c1('0x73')];});return _0x5464f8[_0x21c1('0x6e')];});return db[_0x21c1('0x3a')][_0x21c1('0x33')]({'where':{'id':_0xd0007[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](function(_0x546a6c){return db[_0x21c1('0x74')]['transaction'](function(_0x218476){return _0x546a6c[_0x21c1('0x75')](_0x52b30b,{'transaction':_0x218476})['then'](function(){return BPromise[_0x21c1('0x76')](_0x55edad,function(_0x596fad){return db[_0x21c1('0x77')][_0x21c1('0x78')]({'TeamId':_0x596fad['id'],'VoiceQueueId':_0xd0007[_0x21c1('0x52')]['id'],'penalty':_0x596fad[_0x21c1('0x73')]},{'transaction':_0x218476});});})['then'](function(){return BPromise[_0x21c1('0x76')](_0x2a6def,function(_0x3e8de7){return db[_0x21c1('0x79')][_0x21c1('0x7a')]({'where':{'UserId':_0x3e8de7['id'],'VoiceQueueId':_0xd0007[_0x21c1('0x52')]['id']},'defaults':{'penalty':_0x3e8de7['penalty']},'transaction':_0x218476});});})[_0x21c1('0x27')](function(){return BPromise[_0x21c1('0x76')](_['filter'](_0x2a6def,{'online':!![]}),function(_0x56958a){return db['UserVoiceQueueRt']['upsert']({'membername':_0x56958a[_0x21c1('0x34')],'UserId':_0x56958a['id'],'queue_name':_0x546a6c[_0x21c1('0x34')],'VoiceQueueId':_0x546a6c['id'],'interface':_['isNil'](_0x56958a['interface'])?util['format'](_0x21c1('0x7b'),_0x56958a[_0x21c1('0x34')]):_0x56958a[_0x21c1('0x7c')],'paused':_0x56958a[_0x21c1('0x70')]||![],'penalty':_0x56958a[_0x21c1('0x73')]},{'transaction':_0x218476});});})['then'](function(){_0x2a6def['forEach'](function(_0x3074f6){socket[_0x21c1('0x7d')](_0x21c1('0x7e'),{'UserId':_0x3074f6['id'],'VoiceQueueId':_0x546a6c['id']});});});});});}})['then'](respondWithStatusCode(_0xb73f5e,null))[_0x21c1('0x50')](handleError(_0xb73f5e,null));};exports[_0x21c1('0x7f')]=function(_0x4bbd54,_0x5a9b7d,_0x4b0df9){return db[_0x21c1('0x6c')][_0x21c1('0x4e')]({'where':{'id':_0x4bbd54[_0x21c1('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x21c1('0x80')],'as':_0x21c1('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a9b7d,null))[_0x21c1('0x27')](function(_0x13a174){var _0x584224=_['map'](_0x13a174,'id');var _0x9dc6d=[];var _0x509603=[];var _0x1a7fbd=squel[_0x21c1('0x81')]();_0x1a7fbd[_0x21c1('0x82')]('tq.TeamId')['from'](_0x21c1('0x83'),'tq')['join'](_0x21c1('0x84'),'ut',_0x21c1('0x85'))[_0x21c1('0x49')]('VoiceQueueId\x20=\x20?',_0x4bbd54[_0x21c1('0x52')]['id']);for(var _0x2b59e2=0x0;_0x2b59e2<_0x13a174[_0x21c1('0x43')];_0x2b59e2+=0x1){let _0x1b4056=_0x13a174[_0x2b59e2];for(var _0xf25af9=0x0;_0xf25af9<_0x1b4056['Agents'][_0x21c1('0x43')];_0xf25af9+=0x1){let _0x51f9f4=_0x1b4056['Agents'][_0xf25af9];var _0xd6aa2d=_0x1a7fbd[_0x21c1('0x5b')]();_0xd6aa2d[_0x21c1('0x49')](_0x21c1('0x86'),_0x51f9f4['id']);_0x509603[_0x21c1('0x87')](db[_0x21c1('0x74')]['query'](_0xd6aa2d[_0x21c1('0x88')](),{'type':db[_0x21c1('0x74')][_0x21c1('0x89')][_0x21c1('0x8a')]})[_0x21c1('0x27')](function(_0x358006){if(_0x358006[_0x21c1('0x43')]===0x1){return _0x51f9f4['id'];}else{var _0x1b7d62=_[_0x21c1('0x8b')](_[_0x21c1('0x2f')](_0x358006,_0x21c1('0x8c')),function(_0x2293cd){return _[_0x21c1('0x31')](_0x584224,_0x2293cd);});if(_0x1b7d62){return _0x51f9f4['id'];}}}));}}return BPromise[_0x21c1('0x8d')](_0x509603)['then'](function(_0x1e2d2f){_0x9dc6d=_(_0x9dc6d)['union'](_0x1e2d2f)[_0x21c1('0x8e')]()['value']();return db[_0x21c1('0x3a')][_0x21c1('0x33')]({'where':{'id':_0x4bbd54['params']['id']}})[_0x21c1('0x27')](function(_0x583716){return db[_0x21c1('0x74')][_0x21c1('0x8f')](function(_0x1772af){return _0x583716[_0x21c1('0x7f')](_0x4bbd54[_0x21c1('0x3e')][_0x21c1('0x90')],{'transaction':_0x1772af})[_0x21c1('0x27')](function(){if(!_[_0x21c1('0x91')](_0x9dc6d)){return _0x583716[_0x21c1('0x92')](_0x9dc6d,{'transaction':_0x1772af})[_0x21c1('0x27')](function(){return db['UserVoiceQueueRt'][_0x21c1('0x28')]({'where':{'VoiceQueueId':_0x4bbd54[_0x21c1('0x52')]['id'],'UserId':_0x9dc6d},'transaction':_0x1772af});});}})[_0x21c1('0x27')](function(){_0x9dc6d[_0x21c1('0x72')](function(_0x24454a){socket['emit'](_0x21c1('0x93'),{'UserId':_0x24454a,'VoiceQueueId':_0x583716['id']});});});});});});})[_0x21c1('0x27')](respondWithStatusCode(_0x5a9b7d,null))[_0x21c1('0x50')](handleError(_0x5a9b7d,null));};exports[_0x21c1('0x94')]=function(_0x5b7948,_0xce6145,_0xebf33){var _0x308dee,_0xdeed1;return db['VoiceQueue'][_0x21c1('0x33')]({'where':{'id':_0x5b7948[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0xce6145,null))[_0x21c1('0x27')](function(_0x18e97b){if(_0x18e97b){_0xdeed1=_0x18e97b;return _0x18e97b[_0x21c1('0x94')](_0x5b7948['body'][_0x21c1('0x90')],_[_0x21c1('0x5c')](_0x5b7948[_0x21c1('0x5f')],[_0x21c1('0x90'),'id'])||{})['spread'](function(_0x22f24e){for(var _0x1a32de=0x0;_0x1a32de<_0x5b7948[_0x21c1('0x5f')]['ids']['length'];_0x1a32de+=0x1){socket[_0x21c1('0x7d')](_0x21c1('0x7e'),{'UserId':Number(_0x5b7948['body']['ids'][_0x1a32de]),'VoiceQueueId':Number(_0x5b7948[_0x21c1('0x52')]['id'])});}return _0x22f24e;});}})[_0x21c1('0x27')](function(_0x2ee057){_0x308dee=_0x2ee057||[];if(_0xdeed1){return db[_0x21c1('0x80')][_0x21c1('0x4e')]({'where':{'id':_0x5b7948[_0x21c1('0x5f')][_0x21c1('0x90')]},'attributes':['id',_0x21c1('0x34'),'online',_0x21c1('0x70'),_0x21c1('0x7c')],'raw':!![]});}})[_0x21c1('0x27')](function(_0x21d3db){if(!_[_0x21c1('0x91')](_0x21d3db)){var _0x1bfe23=[];for(var _0x1aacae=0x0;_0x1aacae<_0x21d3db[_0x21c1('0x43')];_0x1aacae++){if(_0x21d3db[_0x1aacae]['online']){_0x1bfe23[_0x21c1('0x87')](db[_0x21c1('0x95')][_0x21c1('0x78')]({'membername':_0x21d3db[_0x1aacae]['name'],'UserId':_0x21d3db[_0x1aacae]['id'],'queue_name':_0xdeed1[_0x21c1('0x34')],'VoiceQueueId':_0xdeed1['id'],'interface':_['isNil'](_0x21d3db[_0x1aacae]['interface'])?util[_0x21c1('0x96')](_0x21c1('0x7b'),_0x21d3db[_0x1aacae][_0x21c1('0x34')]):_0x21d3db[_0x1aacae][_0x21c1('0x7c')],'paused':_0x21d3db[_0x1aacae][_0x21c1('0x70')]||![],'penalty':_0x5b7948[_0x21c1('0x5f')][_0x21c1('0x73')]||0x0}));}}return BPromise['all'](_0x1bfe23);}})[_0x21c1('0x27')](function(){return _0x308dee;})['then'](respondWithResult(_0xce6145,null))[_0x21c1('0x50')](handleError(_0xce6145,null));};exports[_0x21c1('0x92')]=function(_0x16b64b,_0x1429fc,_0x24339b){return db[_0x21c1('0x3a')]['find']({'where':{'id':_0x16b64b[_0x21c1('0x52')]['id']}})['then'](handleEntityNotFound(_0x1429fc,null))['then'](function(_0x1a87d9){if(_0x1a87d9){return _0x1a87d9[_0x21c1('0x92')](_0x16b64b['query'][_0x21c1('0x90')])[_0x21c1('0x27')](function(){if(_[_0x21c1('0x97')](_0x16b64b[_0x21c1('0x3e')][_0x21c1('0x90')])){for(var _0x2accb0=0x0;_0x2accb0<_0x16b64b[_0x21c1('0x3e')][_0x21c1('0x90')]['length'];_0x2accb0+=0x1){socket[_0x21c1('0x7d')](_0x21c1('0x93'),{'UserId':Number(_0x16b64b[_0x21c1('0x3e')][_0x21c1('0x90')][_0x2accb0]),'VoiceQueueId':Number(_0x16b64b[_0x21c1('0x52')]['id'])});}}else{socket[_0x21c1('0x7d')](_0x21c1('0x93'),{'UserId':Number(_0x16b64b[_0x21c1('0x3e')][_0x21c1('0x90')]),'VoiceQueueId':Number(_0x16b64b[_0x21c1('0x52')]['id'])});}});}})['then'](function(_0x5df564){return db[_0x21c1('0x95')][_0x21c1('0x28')]({'where':{'VoiceQueueId':_0x16b64b[_0x21c1('0x52')]['id'],'UserId':_0x16b64b[_0x21c1('0x3e')][_0x21c1('0x90')]}})[_0x21c1('0x27')](function(){return _0x5df564;});})['then'](respondWithStatusCode(_0x1429fc,null))[_0x21c1('0x50')](handleError(_0x1429fc,null));};exports[_0x21c1('0x98')]=function(_0x324384,_0x390c3c,_0x42b1d6){var _0x35866d={};var _0x241339={};var _0x26d77b;var _0x282fb3;return db[_0x21c1('0x3a')][_0x21c1('0x66')]({'where':{'id':_0x324384[_0x21c1('0x52')]['id']}})['then'](handleEntityNotFound(_0x390c3c,null))[_0x21c1('0x27')](function(_0x4d2703){if(_0x4d2703){_0x26d77b=_0x4d2703;_0x241339[_0x21c1('0x3d')]=_[_0x21c1('0x53')](db[_0x21c1('0x80')]['rawAttributes']);_0x241339['query']=_[_0x21c1('0x53')](_0x324384[_0x21c1('0x3e')]);_0x241339[_0x21c1('0x3f')]=_['intersection'](_0x241339[_0x21c1('0x3d')],_0x241339['query']);_0x35866d[_0x21c1('0x40')]=_[_0x21c1('0x41')](_0x241339[_0x21c1('0x3d')],qs[_0x21c1('0x42')](_0x324384['query'][_0x21c1('0x42')]));_0x35866d[_0x21c1('0x40')]=_0x35866d[_0x21c1('0x40')][_0x21c1('0x43')]?_0x35866d[_0x21c1('0x40')]:_0x241339['model'];_0x35866d[_0x21c1('0x47')]=qs[_0x21c1('0x48')](_0x324384[_0x21c1('0x3e')]['sort']);_0x35866d[_0x21c1('0x49')]=qs['filters'](_[_0x21c1('0x4a')](_0x324384[_0x21c1('0x3e')],_0x241339['filters']));if(_0x324384[_0x21c1('0x3e')][_0x21c1('0x2d')]){_0x35866d[_0x21c1('0x49')]=_[_0x21c1('0x4b')](_0x35866d['where'],{'$or':_['map'](_0x35866d[_0x21c1('0x40')],function(_0x4d3b4d){var _0x228c02={};_0x228c02[_0x4d3b4d]={'$like':'%'+_0x324384[_0x21c1('0x3e')]['filter']+'%'};return _0x228c02;})});}_0x35866d=_[_0x21c1('0x4b')]({},_0x35866d,_0x324384[_0x21c1('0x64')]);return _0x26d77b[_0x21c1('0x98')](_0x35866d);}})['then'](function(_0x3e690e){if(_0x3e690e){_0x282fb3=_0x3e690e[_0x21c1('0x43')];if(!_0x324384['query'][_0x21c1('0x44')]('nolimit')){_0x35866d[_0x21c1('0x46')]=qs[_0x21c1('0x46')](_0x324384[_0x21c1('0x3e')][_0x21c1('0x46')]);_0x35866d[_0x21c1('0x1f')]=qs[_0x21c1('0x1f')](_0x324384[_0x21c1('0x3e')][_0x21c1('0x1f')]);}return _0x26d77b['getAgents'](_0x35866d);}})[_0x21c1('0x27')](function(_0x3b1e12){if(_0x3b1e12){return _0x3b1e12?{'count':_0x282fb3,'rows':_0x3b1e12}:null;}})[_0x21c1('0x27')](respondWithResult(_0x390c3c,null))[_0x21c1('0x50')](handleError(_0x390c3c,null));};exports['getMembers']=function(_0x563f0e,_0x1fdb22,_0x3f2657){var _0x57ec88={};var _0x13b88f={};var _0x15393c;var _0x339b85;return db[_0x21c1('0x3a')][_0x21c1('0x66')]({'where':{'id':_0x563f0e[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x1fdb22,null))['then'](function(_0x2385fa){if(_0x2385fa){_0x15393c=_0x2385fa;_0x13b88f[_0x21c1('0x3d')]=_[_0x21c1('0x53')](db[_0x21c1('0x95')][_0x21c1('0x3b')]);_0x13b88f[_0x21c1('0x3e')]=_[_0x21c1('0x53')](_0x563f0e[_0x21c1('0x3e')]);_0x13b88f['filters']=_[_0x21c1('0x41')](_0x13b88f[_0x21c1('0x3d')],_0x13b88f['query']);_0x57ec88[_0x21c1('0x40')]=_[_0x21c1('0x41')](_0x13b88f[_0x21c1('0x3d')],qs[_0x21c1('0x42')](_0x563f0e['query'][_0x21c1('0x42')]));_0x57ec88[_0x21c1('0x40')]=_0x57ec88[_0x21c1('0x40')][_0x21c1('0x43')]?_0x57ec88[_0x21c1('0x40')]:_0x13b88f[_0x21c1('0x3d')];_0x57ec88[_0x21c1('0x47')]=qs[_0x21c1('0x48')](_0x563f0e[_0x21c1('0x3e')][_0x21c1('0x48')]);_0x57ec88[_0x21c1('0x49')]=qs[_0x21c1('0x3f')](_['pick'](_0x563f0e[_0x21c1('0x3e')],_0x13b88f[_0x21c1('0x3f')]));if(_0x563f0e[_0x21c1('0x3e')]['filter']){_0x57ec88['where']=_[_0x21c1('0x4b')](_0x57ec88['where'],{'$or':_[_0x21c1('0x2f')](_0x57ec88[_0x21c1('0x40')],function(_0x5f526e){var _0x5aa331={};_0x5aa331[_0x5f526e]={'$like':'%'+_0x563f0e[_0x21c1('0x3e')][_0x21c1('0x2d')]+'%'};return _0x5aa331;})});}_0x57ec88=_[_0x21c1('0x4b')]({},_0x57ec88,_0x563f0e[_0x21c1('0x64')]);return _0x15393c['getMembers'](_0x57ec88);}})[_0x21c1('0x27')](function(_0x399eeb){if(_0x399eeb){_0x339b85=_0x399eeb[_0x21c1('0x43')];if(!_0x563f0e[_0x21c1('0x3e')][_0x21c1('0x44')](_0x21c1('0x45'))){_0x57ec88[_0x21c1('0x46')]=qs['limit'](_0x563f0e[_0x21c1('0x3e')][_0x21c1('0x46')]);_0x57ec88[_0x21c1('0x1f')]=qs['offset'](_0x563f0e['query'][_0x21c1('0x1f')]);}return _0x15393c[_0x21c1('0x99')](_0x57ec88);}})['then'](function(_0x48786c){return _0x48786c?{'count':_0x339b85,'rows':_0x48786c}:null;})[_0x21c1('0x27')](respondWithResult(_0x1fdb22,null))[_0x21c1('0x50')](handleError(_0x1fdb22,null));};exports[_0x21c1('0x9a')]=function(_0xc0c0ae,_0x3afc85,_0x1e0657){var _0x847ea={};var _0x2cff0b={};var _0x497d10;var _0x2fd859;return db[_0x21c1('0x3a')]['findOne']({'where':{'id':_0xc0c0ae[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x3afc85,null))[_0x21c1('0x27')](function(_0x320f80){if(_0x320f80){_0x497d10=_0x320f80;_0x2cff0b['model']=_['keys'](db['CmList'][_0x21c1('0x3b')]);_0x2cff0b['query']=_[_0x21c1('0x53')](_0xc0c0ae[_0x21c1('0x3e')]);_0x2cff0b[_0x21c1('0x3f')]=_[_0x21c1('0x41')](_0x2cff0b[_0x21c1('0x3d')],_0x2cff0b[_0x21c1('0x3e')]);_0x847ea[_0x21c1('0x40')]=_['intersection'](_0x2cff0b['model'],qs[_0x21c1('0x42')](_0xc0c0ae[_0x21c1('0x3e')][_0x21c1('0x42')]));_0x847ea[_0x21c1('0x40')]=_0x847ea[_0x21c1('0x40')]['length']?_0x847ea[_0x21c1('0x40')]:_0x2cff0b[_0x21c1('0x3d')];_0x847ea[_0x21c1('0x47')]=qs[_0x21c1('0x48')](_0xc0c0ae['query'][_0x21c1('0x48')]);_0x847ea['where']=qs[_0x21c1('0x3f')](_[_0x21c1('0x4a')](_0xc0c0ae[_0x21c1('0x3e')],_0x2cff0b[_0x21c1('0x3f')]));if(_0xc0c0ae[_0x21c1('0x3e')][_0x21c1('0x2d')]){_0x847ea[_0x21c1('0x49')]=_[_0x21c1('0x4b')](_0x847ea[_0x21c1('0x49')],{'$or':_[_0x21c1('0x2f')](_0x847ea[_0x21c1('0x40')],function(_0x327af0){var _0x4c5d00={};_0x4c5d00[_0x327af0]={'$like':'%'+_0xc0c0ae[_0x21c1('0x3e')][_0x21c1('0x2d')]+'%'};return _0x4c5d00;})});}_0x847ea=_[_0x21c1('0x4b')]({},_0x847ea,_0xc0c0ae[_0x21c1('0x64')]);return _0x497d10[_0x21c1('0x9a')](_0x847ea);}})[_0x21c1('0x27')](function(_0xe0b335){if(_0xe0b335){_0x2fd859=_0xe0b335[_0x21c1('0x43')];if(!_0xc0c0ae[_0x21c1('0x3e')][_0x21c1('0x44')](_0x21c1('0x45'))){_0x847ea[_0x21c1('0x46')]=qs[_0x21c1('0x46')](_0xc0c0ae['query'][_0x21c1('0x46')]);_0x847ea[_0x21c1('0x1f')]=qs['offset'](_0xc0c0ae[_0x21c1('0x3e')]['offset']);}return _0x497d10[_0x21c1('0x9a')](_0x847ea);}})[_0x21c1('0x27')](function(_0xa2c325){if(_0xa2c325){return _0xa2c325?{'count':_0x2fd859,'rows':_0xa2c325}:null;}})[_0x21c1('0x27')](respondWithResult(_0x3afc85,null))['catch'](handleError(_0x3afc85,null));};exports['addLists']=function(_0x57b481,_0x58866c,_0x244c26){var _0x35a290,_0x511e08;return db[_0x21c1('0x3a')][_0x21c1('0x33')]({'where':{'id':_0x57b481[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x58866c,null))[_0x21c1('0x27')](function(_0xaed5d8){if(_0xaed5d8){_0x511e08=_0xaed5d8;return _0xaed5d8[_0x21c1('0x9b')](_0x57b481[_0x21c1('0x5f')][_0x21c1('0x90')],_[_0x21c1('0x5c')](_0x57b481[_0x21c1('0x5f')],['ids','id'])||{});}return null;})[_0x21c1('0x9c')](function(_0x28e6bb){var _0x275288;_0x35a290=_0x28e6bb||[];var _0x3325bf=[];if(_0x28e6bb){for(var _0x40f820=0x0;_0x40f820<_0x28e6bb['length'];_0x40f820+=0x1){var _0x4e3b76=_0x28e6bb[_0x40f820][_0x21c1('0x55')]({'plain':!![]});_0x511e08[_0x21c1('0x9d')]=_0x57b481[_0x21c1('0x5f')][_0x21c1('0x9d')]?_0x57b481[_0x21c1('0x5f')][_0x21c1('0x9d')]:_0x511e08[_0x21c1('0x9d')];switch(_0x511e08[_0x21c1('0x9d')]){case _0x21c1('0x9e'):_0x275288=squel[_0x21c1('0x9f')]()[_0x21c1('0xa0')]('cm_hopper')['fromQuery']([_0x21c1('0xa1'),_0x21c1('0xa2'),_0x21c1('0xa3'),_0x21c1('0xa4'),_0x21c1('0x63'),_0x21c1('0x5d'),_0x21c1('0x5e')],squel[_0x21c1('0x81')]()[_0x21c1('0x82')]('phone',_0x21c1('0xa1'))[_0x21c1('0x82')](_0x21c1('0xa5'),_0x21c1('0xa2'))[_0x21c1('0x82')]('id',_0x21c1('0xa3'))['field'](_0x4e3b76[_0x21c1('0xa6')][_0x21c1('0x88')](),_0x21c1('0xa4'))[_0x21c1('0x82')](_0x57b481[_0x21c1('0x52')]['id']['toString'](),_0x21c1('0x63'))['field']('NOW()',_0x21c1('0x5d'))[_0x21c1('0x82')](_0x21c1('0xa5'),'updatedAt')[_0x21c1('0xa7')](_0x21c1('0xa8'))[_0x21c1('0x49')](_0x21c1('0xa9'))[_0x21c1('0x49')](_0x21c1('0xaa'),_0x4e3b76[_0x21c1('0xa6')][_0x21c1('0x88')]())[_0x21c1('0x49')](_0x21c1('0xab'))[_0x21c1('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x21c1('0x81')]()[_0x21c1('0x82')](_0x21c1('0xac'))[_0x21c1('0xa7')](_0x21c1('0xad'))[_0x21c1('0x49')](_0x21c1('0xae'),_0x57b481[_0x21c1('0x52')]['id'][_0x21c1('0x88')]()))[_0x21c1('0x49')](_0x21c1('0xaf'),squel[_0x21c1('0x81')]()[_0x21c1('0x82')](_0x21c1('0xb0'))[_0x21c1('0xa7')]('cm_hopper')[_0x21c1('0x49')](_0x21c1('0xae'),_0x57b481['params']['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x275288=squel[_0x21c1('0x9f')]()[_0x21c1('0xa0')](_0x21c1('0xb1'))[_0x21c1('0xb2')]([_0x21c1('0xa1'),_0x21c1('0xa2'),_0x21c1('0xa3'),_0x21c1('0xa4'),_0x21c1('0x63'),_0x21c1('0x5d'),'updatedAt'],squel[_0x21c1('0x81')]()['field']('phone',_0x21c1('0xa1'))[_0x21c1('0x82')](_0x21c1('0xa5'),_0x21c1('0xa2'))[_0x21c1('0x82')]('id',_0x21c1('0xa3'))[_0x21c1('0x82')](_0x4e3b76[_0x21c1('0xa6')][_0x21c1('0x88')](),_0x21c1('0xa4'))[_0x21c1('0x82')](_0x57b481[_0x21c1('0x52')]['id'][_0x21c1('0x88')](),_0x21c1('0x63'))['field'](_0x21c1('0xa5'),_0x21c1('0x5d'))[_0x21c1('0x82')](_0x21c1('0xa5'),_0x21c1('0x5e'))[_0x21c1('0xa7')](_0x21c1('0xa8'))[_0x21c1('0x49')](_0x21c1('0xa9'))[_0x21c1('0x49')](_0x21c1('0xaa'),_0x4e3b76['CmListId'][_0x21c1('0x88')]())['where'](_0x21c1('0xab'))[_0x21c1('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x21c1('0x81')]()['field'](_0x21c1('0xb0'))['from'](_0x21c1('0xb1'))[_0x21c1('0x49')](_0x21c1('0xae'),_0x57b481[_0x21c1('0x52')]['id'][_0x21c1('0x88')]())))[_0x21c1('0x88')]();break;default:_0x275288=squel[_0x21c1('0x9f')]()[_0x21c1('0xa0')](_0x21c1('0xb1'))[_0x21c1('0xb2')]([_0x21c1('0xa1'),_0x21c1('0xa2'),_0x21c1('0xa3'),'ListId',_0x21c1('0x63'),_0x21c1('0x5d'),_0x21c1('0x5e')],squel[_0x21c1('0x81')]()[_0x21c1('0x82')](_0x21c1('0xa1'),'phone')[_0x21c1('0x82')]('NOW()',_0x21c1('0xa2'))[_0x21c1('0x82')]('id',_0x21c1('0xa3'))[_0x21c1('0x82')](_0x4e3b76[_0x21c1('0xa6')]['toString'](),_0x21c1('0xa4'))[_0x21c1('0x82')](_0x57b481[_0x21c1('0x52')]['id'][_0x21c1('0x88')](),'VoiceQueueId')[_0x21c1('0x82')]('NOW()',_0x21c1('0x5d'))[_0x21c1('0x82')](_0x21c1('0xa5'),_0x21c1('0x5e'))[_0x21c1('0xa7')](_0x21c1('0xa8'))[_0x21c1('0x49')](_0x21c1('0xa9'))[_0x21c1('0x49')](_0x21c1('0xaa'),_0x4e3b76[_0x21c1('0xa6')][_0x21c1('0x88')]())[_0x21c1('0x49')](_0x21c1('0xab')))['toString']();}_0x3325bf[_0x21c1('0x87')](db[_0x21c1('0x74')][_0x21c1('0x3e')](_0x275288));}return BPromise[_0x21c1('0x8d')](_0x3325bf);}})[_0x21c1('0x27')](function(){return _0x35a290;})[_0x21c1('0x27')](respondWithResult(_0x58866c,null))[_0x21c1('0x50')](handleError(_0x58866c,null));};exports[_0x21c1('0xb3')]=function(_0x23f7f6,_0x57e2a0,_0x179c68){return db[_0x21c1('0x3a')]['find']({'where':{'id':_0x23f7f6[_0x21c1('0x52')]['id']}})['then'](handleEntityNotFound(_0x57e2a0,null))['then'](function(_0x54ef68){if(_0x54ef68){return _0x54ef68[_0x21c1('0xb3')](_0x23f7f6[_0x21c1('0x3e')][_0x21c1('0x90')]);}})[_0x21c1('0x27')](function(_0xcc16b9){if(_0xcc16b9){return db[_0x21c1('0x62')][_0x21c1('0x28')]({'where':{'ListId':_0x23f7f6[_0x21c1('0x3e')][_0x21c1('0x90')],'VoiceQueueId':_0x23f7f6[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](function(){return _0xcc16b9;});}})[_0x21c1('0x27')](respondWithStatusCode(_0x57e2a0,null))[_0x21c1('0x50')](handleError(_0x57e2a0,null));};exports[_0x21c1('0xb4')]=function(_0x51358b,_0x50f173,_0x2b5442){var _0x4fb876={};var _0x56afb2={};var _0x34a7b1;var _0x122493;return db['VoiceQueue'][_0x21c1('0x66')]({'where':{'id':_0x51358b[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x50f173,null))[_0x21c1('0x27')](function(_0x54cb84){if(_0x54cb84){_0x34a7b1=_0x54cb84;_0x56afb2[_0x21c1('0x3d')]=_['keys'](db[_0x21c1('0xb5')][_0x21c1('0x3b')]);_0x56afb2[_0x21c1('0x3e')]=_['keys'](_0x51358b[_0x21c1('0x3e')]);_0x56afb2[_0x21c1('0x3f')]=_[_0x21c1('0x41')](_0x56afb2[_0x21c1('0x3d')],_0x56afb2[_0x21c1('0x3e')]);_0x4fb876[_0x21c1('0x40')]=_['intersection'](_0x56afb2[_0x21c1('0x3d')],qs[_0x21c1('0x42')](_0x51358b[_0x21c1('0x3e')][_0x21c1('0x42')]));_0x4fb876['attributes']=_0x4fb876[_0x21c1('0x40')][_0x21c1('0x43')]?_0x4fb876['attributes']:_0x56afb2['model'];_0x4fb876['order']=qs['sort'](_0x51358b[_0x21c1('0x3e')]['sort']);_0x4fb876['where']=qs['filters'](_[_0x21c1('0x4a')](_0x51358b['query'],_0x56afb2['filters']));if(_0x51358b[_0x21c1('0x3e')][_0x21c1('0x2d')]){_0x4fb876[_0x21c1('0x49')]=_['merge'](_0x4fb876[_0x21c1('0x49')],{'$or':_[_0x21c1('0x2f')](_0x4fb876[_0x21c1('0x40')],function(_0x2d43ee){var _0x201403={};_0x201403[_0x2d43ee]={'$like':'%'+_0x51358b[_0x21c1('0x3e')][_0x21c1('0x2d')]+'%'};return _0x201403;})});}_0x4fb876=_[_0x21c1('0x4b')]({},_0x4fb876,_0x51358b[_0x21c1('0x64')]);return _0x34a7b1['getBlackLists'](_0x4fb876);}})[_0x21c1('0x27')](function(_0x19a62f){if(_0x19a62f){_0x122493=_0x19a62f[_0x21c1('0x43')];if(!_0x51358b[_0x21c1('0x3e')][_0x21c1('0x44')](_0x21c1('0x45'))){_0x4fb876[_0x21c1('0x46')]=qs[_0x21c1('0x46')](_0x51358b[_0x21c1('0x3e')][_0x21c1('0x46')]);_0x4fb876['offset']=qs[_0x21c1('0x1f')](_0x51358b[_0x21c1('0x3e')]['offset']);}return _0x34a7b1[_0x21c1('0xb4')](_0x4fb876);}})[_0x21c1('0x27')](function(_0x1536f8){if(_0x1536f8){return _0x1536f8?{'count':_0x122493,'rows':_0x1536f8}:null;}})['then'](respondWithResult(_0x50f173,null))['catch'](handleError(_0x50f173,null));};exports[_0x21c1('0xb6')]=function(_0x437d82,_0x1db2e0,_0x2f021e){var _0x268572,_0x36144e;return db[_0x21c1('0x3a')][_0x21c1('0x33')]({'where':{'id':_0x437d82[_0x21c1('0x52')]['id']}})['then'](handleEntityNotFound(_0x1db2e0,null))[_0x21c1('0x27')](function(_0x56f768){if(_0x56f768){_0x36144e=_0x56f768;return _0x56f768[_0x21c1('0xb6')](_0x437d82[_0x21c1('0x5f')][_0x21c1('0x90')],_[_0x21c1('0x5c')](_0x437d82['body'],[_0x21c1('0x90'),'id'])||{});}return null;})[_0x21c1('0x9c')](function(_0xb87b37){var _0x36148f;_0x268572=_0xb87b37||[];var _0x1f715f=[];if(_0xb87b37){for(var _0x191359=0x0;_0x191359<_0xb87b37[_0x21c1('0x43')];_0x191359+=0x1){var _0x7fa8d5=_0xb87b37[_0x191359][_0x21c1('0x55')]({'plain':!![]});_0x36148f=squel[_0x21c1('0x9f')]()[_0x21c1('0xa0')]('cm_hopper_black')[_0x21c1('0xb2')](['phone',_0x21c1('0xa3'),_0x21c1('0xa4'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x21c1('0x81')]()[_0x21c1('0x82')](_0x21c1('0xa1'),_0x21c1('0xa1'))[_0x21c1('0x82')]('id',_0x21c1('0xa3'))['field'](_0x7fa8d5[_0x21c1('0xa6')][_0x21c1('0x88')](),_0x21c1('0xa4'))[_0x21c1('0x82')](_0x437d82[_0x21c1('0x52')]['id'][_0x21c1('0x88')](),_0x21c1('0x63'))[_0x21c1('0x82')](_0x21c1('0xa5'),'createdAt')[_0x21c1('0x82')]('NOW()',_0x21c1('0x5e'))[_0x21c1('0xa7')](_0x21c1('0xa8'))[_0x21c1('0x49')](_0x21c1('0xa9'))[_0x21c1('0x49')]('ListId\x20=\x20?',_0x7fa8d5[_0x21c1('0xa6')][_0x21c1('0x88')]())[_0x21c1('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0x21c1('0x88')]();_0x1f715f[_0x21c1('0x87')](db[_0x21c1('0x74')]['query'](_0x36148f));}return BPromise['all'](_0x1f715f);}})[_0x21c1('0x27')](function(){return _0x268572;})[_0x21c1('0x27')](respondWithResult(_0x1db2e0,null))[_0x21c1('0x50')](handleError(_0x1db2e0,null));};exports[_0x21c1('0xb7')]=function(_0x3a3eb5,_0x2b470a,_0x2a630b){return db[_0x21c1('0x3a')]['find']({'where':{'id':_0x3a3eb5['params']['id']}})[_0x21c1('0x27')](handleEntityNotFound(_0x2b470a,null))[_0x21c1('0x27')](function(_0x5f923f){if(_0x5f923f){return _0x5f923f['removeBlackLists'](_0x3a3eb5[_0x21c1('0x3e')][_0x21c1('0x90')]);}})[_0x21c1('0x27')](function(_0x5b7dfb){if(_0x5b7dfb){return db[_0x21c1('0x6a')][_0x21c1('0x28')]({'where':{'ListId':_0x3a3eb5[_0x21c1('0x3e')][_0x21c1('0x90')],'VoiceQueueId':_0x3a3eb5[_0x21c1('0x52')]['id']}})[_0x21c1('0x27')](function(){return _0x5b7dfb;});}})[_0x21c1('0x27')](respondWithStatusCode(_0x2b470a,null))['catch'](handleError(_0x2b470a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f83993f..fa7162c 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 _0xb7f7=['../../mysqldb','VoiceQueue','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x714227,_0x15307b){var _0x535f2a=function(_0x59670c){while(--_0x59670c){_0x714227['push'](_0x714227['shift']());}};_0x535f2a(++_0x15307b);}(_0xb7f7,0xee));var _0x7b7f=function(_0x2ce20d,_0x3403fa){_0x2ce20d=_0x2ce20d-0x0;var _0x21f577=_0xb7f7[_0x2ce20d];return _0x21f577;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x7b7f('0x0'))['db'][_0x7b7f('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7b7f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x424b8b){return function(_0x4706c4,_0x351b06,_0x25a2d8){VoiceQueueEvents[_0x7b7f('0x3')](_0x424b8b+':'+_0x4706c4['id'],_0x4706c4);VoiceQueueEvents['emit'](_0x424b8b,_0x4706c4);_0x25a2d8(null);};}for(var e in events){if(events[_0x7b7f('0x4')](e)){var event=events[e];VoiceQueue[_0x7b7f('0x5')](e,emitEvent(event));}}module[_0x7b7f('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x68a6=['events','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x68a6,0x140));var _0x668a=function(_0x590baf,_0x4609e2){_0x590baf=_0x590baf-0x0;var _0x44cd9f=_0x68a6[_0x590baf];return _0x44cd9f;};'use strict';var EventEmitter=require(_0x668a('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x668a('0x1'),'afterUpdate':_0x668a('0x2'),'afterDestroy':_0x668a('0x3')};function emitEvent(_0x9ba675){return function(_0x7d8c16,_0x510fd0,_0x496194){VoiceQueueEvents[_0x668a('0x4')](_0x9ba675+':'+_0x7d8c16['id'],_0x7d8c16);VoiceQueueEvents[_0x668a('0x4')](_0x9ba675,_0x7d8c16);_0x496194(null);};}for(var e in events){if(events[_0x668a('0x5')](e)){var event=events[e];VoiceQueue[_0x668a('0x6')](e,emitEvent(event));}}module[_0x668a('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d91f7f3..80b4fd3 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x1ffce6,_0x9f5f58){var _0x5b2e5b=function(_0x1b32a3){while(--_0x1b32a3){_0x1ffce6['push'](_0x1ffce6['shift']());}};_0x5b2e5b(++_0x9f5f58);}(_0xedd9,0xfc));var _0x9edd=function(_0x489948,_0x550de9){_0x489948=_0x489948-0x0;var _0x2920e6=_0xedd9[_0x489948];return _0x2920e6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x45a0c0,_0x4a4455){var _0x3dbe5a=function(_0x1686aa){while(--_0x1686aa){_0x45a0c0['push'](_0x45a0c0['shift']());}};_0x3dbe5a(++_0x4a4455);}(_0x34e8,0x12c));var _0x834e=function(_0x4a5c97,_0x3651b8){_0x4a5c97=_0x4a5c97-0x0;var _0x33d051=_0x34e8[_0x4a5c97];return _0x33d051;};'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 c3731da..b3870e5 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 _0x6ede=['../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','then','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x399ce5,_0xb502f0){var _0x27a470=function(_0x269fc8){while(--_0x269fc8){_0x399ce5['push'](_0x399ce5['shift']());}};_0x27a470(++_0xb502f0);}(_0x6ede,0xc6));var _0xe6ed=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0x6ede[_0x22093a];return _0x2f4989;};'use strict';var _=require(_0xe6ed('0x0'));var util=require(_0xe6ed('0x1'));var moment=require(_0xe6ed('0x2'));var BPromise=require(_0xe6ed('0x3'));var rs=require(_0xe6ed('0x4'));var fs=require('fs');var Redis=require(_0xe6ed('0x5'));var db=require(_0xe6ed('0x6'))['db'];var utils=require(_0xe6ed('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe6ed('0x8'));var client=jayson[_0xe6ed('0x9')][_0xe6ed('0xa')]({'port':0x232a});config[_0xe6ed('0xb')]=_[_0xe6ed('0xc')](config['redis'],{'host':_0xe6ed('0xd'),'port':0x18eb});var socket=require(_0xe6ed('0xe'))(new Redis(config[_0xe6ed('0xb')]));require(_0xe6ed('0xf'))['register'](socket);function respondWithRpcPromise(_0x29a49c,_0x1f9c12,_0x2f27b4){return new BPromise(function(_0x3fdc2a,_0x4520fc){return client[_0xe6ed('0x10')](_0x29a49c,_0x2f27b4)['then'](function(_0x2eb1e5){logger[_0xe6ed('0x11')](_0xe6ed('0x12'),_0x1f9c12,_0xe6ed('0x13'));logger[_0xe6ed('0x14')](_0xe6ed('0x15'),_0x1f9c12,_0xe6ed('0x13'),JSON[_0xe6ed('0x16')](_0x2eb1e5));if(_0x2eb1e5['error']){if(_0x2eb1e5['error'][_0xe6ed('0x17')]===0x1f4){logger[_0xe6ed('0x18')](_0xe6ed('0x12'),_0x1f9c12,_0x2eb1e5[_0xe6ed('0x18')][_0xe6ed('0x19')]);return _0x4520fc(_0x2eb1e5[_0xe6ed('0x18')][_0xe6ed('0x19')]);}logger[_0xe6ed('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x1f9c12,_0x2eb1e5['error'][_0xe6ed('0x19')]);return _0x3fdc2a(_0x2eb1e5[_0xe6ed('0x18')]['message']);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x1f9c12,_0xe6ed('0x13'));_0x3fdc2a(_0x2eb1e5[_0xe6ed('0x1a')][_0xe6ed('0x19')]);}})[_0xe6ed('0x1b')](function(_0x105db8){logger[_0xe6ed('0x18')](_0xe6ed('0x12'),_0x1f9c12,_0x105db8);_0x4520fc(_0x105db8);});});}exports[_0xe6ed('0x1c')]=function(_0x57298e){var _0x2271a0=this;return new Promise(function(_0x31296e,_0x2cdcc0){return db[_0xe6ed('0x1d')][_0xe6ed('0x1e')]({'raw':_0x57298e[_0xe6ed('0x1f')]?_0x57298e[_0xe6ed('0x1f')][_0xe6ed('0x20')]===undefined?!![]:![]:!![],'where':_0x57298e[_0xe6ed('0x1f')]?_0x57298e[_0xe6ed('0x1f')][_0xe6ed('0x21')]||null:null,'attributes':_0x57298e[_0xe6ed('0x1f')]?_0x57298e[_0xe6ed('0x1f')][_0xe6ed('0x22')]||null:null,'limit':_0x57298e[_0xe6ed('0x1f')]?_0x57298e[_0xe6ed('0x1f')]['limit']||null:null,'include':_0x57298e['options']?_0x57298e[_0xe6ed('0x1f')][_0xe6ed('0x23')]?_[_0xe6ed('0x24')](_0x57298e[_0xe6ed('0x1f')][_0xe6ed('0x23')],function(_0x52ef48){return{'model':db[_0x52ef48[_0xe6ed('0x25')]],'as':_0x52ef48['as'],'attributes':_0x52ef48[_0xe6ed('0x22')],'include':_0x52ef48[_0xe6ed('0x23')]?_['map'](_0x52ef48['include'],function(_0x1b43cf){return{'model':db[_0x1b43cf[_0xe6ed('0x25')]],'as':_0x1b43cf['as'],'attributes':_0x1b43cf[_0xe6ed('0x22')],'include':_0x1b43cf[_0xe6ed('0x23')]?_['map'](_0x1b43cf[_0xe6ed('0x23')],function(_0x56726b){return{'model':db[_0x56726b[_0xe6ed('0x25')]],'as':_0x56726b['as'],'attributes':_0x56726b[_0xe6ed('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe6ed('0x26')](function(_0x437f43){logger['info'](_0xe6ed('0x1c'),_0x57298e);logger[_0xe6ed('0x14')](_0xe6ed('0x1c'),_0x57298e,JSON['stringify'](_0x437f43));_0x31296e(_0x437f43);})[_0xe6ed('0x1b')](function(_0x2e4aa1){logger['error'](_0xe6ed('0x1c'),_0x2e4aa1[_0xe6ed('0x19')],_0x57298e);_0x2cdcc0(_0x2271a0[_0xe6ed('0x18')](0x1f4,_0x2e4aa1['message']));});});};exports[_0xe6ed('0x27')]=function(_0x334a17){var _0x1bdebb=this;return new Promise(function(_0xbfb83d,_0x1e01bf){return db[_0xe6ed('0x1d')][_0xe6ed('0x28')]({'raw':_0x334a17[_0xe6ed('0x1f')]?_0x334a17[_0xe6ed('0x1f')][_0xe6ed('0x20')]===undefined?!![]:![]:!![],'where':_0x334a17[_0xe6ed('0x1f')]?_0x334a17['options']['where']||null:null,'attributes':_0x334a17[_0xe6ed('0x1f')]?_0x334a17[_0xe6ed('0x1f')][_0xe6ed('0x22')]||null:null,'include':_0x334a17[_0xe6ed('0x1f')]?_0x334a17['options']['include']?_[_0xe6ed('0x24')](_0x334a17['options'][_0xe6ed('0x23')],function(_0x3476f7){return{'model':db[_0x3476f7[_0xe6ed('0x25')]],'as':_0x3476f7['as'],'attributes':_0x3476f7['attributes'],'include':_0x3476f7[_0xe6ed('0x23')]?_['map'](_0x3476f7['include'],function(_0x5c261d){return{'model':db[_0x5c261d['model']],'as':_0x5c261d['as'],'attributes':_0x5c261d[_0xe6ed('0x22')],'include':_0x5c261d[_0xe6ed('0x23')]?_['map'](_0x5c261d[_0xe6ed('0x23')],function(_0x33b551){return{'model':db[_0x33b551['model']],'as':_0x33b551['as'],'attributes':_0x33b551['attributes']};}):[]};}):[]};}):[]:[]})[_0xe6ed('0x26')](function(_0x36d8b4){logger['info'](_0xe6ed('0x27'),_0x334a17);logger['debug']('ShowVoiceQueue',_0x334a17,JSON['stringify'](_0x36d8b4));_0xbfb83d(_0x36d8b4);})['catch'](function(_0xf91d86){logger[_0xe6ed('0x18')]('ShowVoiceQueue',_0xf91d86['message'],_0x334a17);_0x1e01bf(_0x1bdebb[_0xe6ed('0x18')](0x1f4,_0xf91d86['message']));});});}; \ No newline at end of file +var _0x0762=['model','map','info','ShowVoiceQueue','VoiceQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','findAll','options','where','attributes','limit','include'];(function(_0xdaee61,_0x4d1346){var _0x4c2df9=function(_0x4e794c){while(--_0x4e794c){_0xdaee61['push'](_0xdaee61['shift']());}};_0x4c2df9(++_0x4d1346);}(_0x0762,0x1e7));var _0x2076=function(_0x133f22,_0x3d0cbb){_0x133f22=_0x133f22-0x0;var _0x5a9fca=_0x0762[_0x133f22];return _0x5a9fca;};'use strict';var _=require('lodash');var util=require(_0x2076('0x0'));var moment=require(_0x2076('0x1'));var BPromise=require('bluebird');var rs=require(_0x2076('0x2'));var fs=require('fs');var Redis=require(_0x2076('0x3'));var db=require(_0x2076('0x4'))['db'];var utils=require(_0x2076('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2076('0x6'));var client=jayson['client'][_0x2076('0x7')]({'port':0x232a});config[_0x2076('0x8')]=_[_0x2076('0x9')](config[_0x2076('0x8')],{'host':_0x2076('0xa'),'port':0x18eb});var socket=require(_0x2076('0xb'))(new Redis(config[_0x2076('0x8')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x452e56,_0x276c0b,_0x454c52){return new BPromise(function(_0x890796,_0x7dc156){return client[_0x2076('0xc')](_0x452e56,_0x454c52)[_0x2076('0xd')](function(_0x435822){logger['info'](_0x2076('0xe'),_0x276c0b,_0x2076('0xf'));logger[_0x2076('0x10')](_0x2076('0x11'),_0x276c0b,_0x2076('0xf'),JSON[_0x2076('0x12')](_0x435822));if(_0x435822[_0x2076('0x13')]){if(_0x435822[_0x2076('0x13')][_0x2076('0x14')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x276c0b,_0x435822[_0x2076('0x13')][_0x2076('0x15')]);return _0x7dc156(_0x435822[_0x2076('0x13')][_0x2076('0x15')]);}logger[_0x2076('0x13')](_0x2076('0xe'),_0x276c0b,_0x435822['error']['message']);return _0x890796(_0x435822['error'][_0x2076('0x15')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x276c0b,_0x2076('0xf'));_0x890796(_0x435822[_0x2076('0x16')][_0x2076('0x15')]);}})[_0x2076('0x17')](function(_0x492b8d){logger[_0x2076('0x13')](_0x2076('0xe'),_0x276c0b,_0x492b8d);_0x7dc156(_0x492b8d);});});}exports[_0x2076('0x18')]=function(_0x573e24){var _0x15e98b=this;return new Promise(function(_0x36a808,_0x1c7bdb){return db['VoiceQueue'][_0x2076('0x19')]({'raw':_0x573e24['options']?_0x573e24['options']['raw']===undefined?!![]:![]:!![],'where':_0x573e24[_0x2076('0x1a')]?_0x573e24['options'][_0x2076('0x1b')]||null:null,'attributes':_0x573e24[_0x2076('0x1a')]?_0x573e24['options'][_0x2076('0x1c')]||null:null,'limit':_0x573e24[_0x2076('0x1a')]?_0x573e24[_0x2076('0x1a')][_0x2076('0x1d')]||null:null,'include':_0x573e24[_0x2076('0x1a')]?_0x573e24[_0x2076('0x1a')]['include']?_['map'](_0x573e24[_0x2076('0x1a')][_0x2076('0x1e')],function(_0x4178a8){return{'model':db[_0x4178a8[_0x2076('0x1f')]],'as':_0x4178a8['as'],'attributes':_0x4178a8[_0x2076('0x1c')],'include':_0x4178a8[_0x2076('0x1e')]?_['map'](_0x4178a8[_0x2076('0x1e')],function(_0x4d8faf){return{'model':db[_0x4d8faf[_0x2076('0x1f')]],'as':_0x4d8faf['as'],'attributes':_0x4d8faf[_0x2076('0x1c')],'include':_0x4d8faf[_0x2076('0x1e')]?_[_0x2076('0x20')](_0x4d8faf[_0x2076('0x1e')],function(_0x63f9b8){return{'model':db[_0x63f9b8[_0x2076('0x1f')]],'as':_0x63f9b8['as'],'attributes':_0x63f9b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2076('0xd')](function(_0x51ebb8){logger[_0x2076('0x21')]('GetVoiceQueue',_0x573e24);logger['debug'](_0x2076('0x18'),_0x573e24,JSON[_0x2076('0x12')](_0x51ebb8));_0x36a808(_0x51ebb8);})[_0x2076('0x17')](function(_0x1fd828){logger[_0x2076('0x13')]('GetVoiceQueue',_0x1fd828[_0x2076('0x15')],_0x573e24);_0x1c7bdb(_0x15e98b[_0x2076('0x13')](0x1f4,_0x1fd828[_0x2076('0x15')]));});});};exports[_0x2076('0x22')]=function(_0x35e2b4){var _0x31d218=this;return new Promise(function(_0x2b097a,_0x414814){return db[_0x2076('0x23')][_0x2076('0x24')]({'raw':_0x35e2b4[_0x2076('0x1a')]?_0x35e2b4[_0x2076('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x35e2b4[_0x2076('0x1a')]?_0x35e2b4['options'][_0x2076('0x1b')]||null:null,'attributes':_0x35e2b4[_0x2076('0x1a')]?_0x35e2b4[_0x2076('0x1a')][_0x2076('0x1c')]||null:null,'include':_0x35e2b4[_0x2076('0x1a')]?_0x35e2b4['options'][_0x2076('0x1e')]?_['map'](_0x35e2b4['options'][_0x2076('0x1e')],function(_0x4dbe2c){return{'model':db[_0x4dbe2c[_0x2076('0x1f')]],'as':_0x4dbe2c['as'],'attributes':_0x4dbe2c['attributes'],'include':_0x4dbe2c[_0x2076('0x1e')]?_[_0x2076('0x20')](_0x4dbe2c[_0x2076('0x1e')],function(_0x328f1e){return{'model':db[_0x328f1e[_0x2076('0x1f')]],'as':_0x328f1e['as'],'attributes':_0x328f1e['attributes'],'include':_0x328f1e[_0x2076('0x1e')]?_[_0x2076('0x20')](_0x328f1e['include'],function(_0x2bd2d5){return{'model':db[_0x2bd2d5[_0x2076('0x1f')]],'as':_0x2bd2d5['as'],'attributes':_0x2bd2d5[_0x2076('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2076('0xd')](function(_0x465dc9){logger[_0x2076('0x21')](_0x2076('0x22'),_0x35e2b4);logger[_0x2076('0x10')](_0x2076('0x22'),_0x35e2b4,JSON[_0x2076('0x12')](_0x465dc9));_0x2b097a(_0x465dc9);})['catch'](function(_0x19769a){logger[_0x2076('0x13')](_0x2076('0x22'),_0x19769a[_0x2076('0x15')],_0x35e2b4);_0x414814(_0x31d218[_0x2076('0x13')](0x1f4,_0x19769a[_0x2076('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4f9c284..f6a4732 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 _0x1637=['update','emit','removeListener','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x5f5cce,_0x138cc5){var _0x705ecf=function(_0x28bc5d){while(--_0x28bc5d){_0x5f5cce['push'](_0x5f5cce['shift']());}};_0x705ecf(++_0x138cc5);}(_0x1637,0xbd));var _0x7163=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1637[_0x13d07a];return _0x5ee0ee;};'use strict';var VoiceQueueEvents=require(_0x7163('0x0'));var events=[_0x7163('0x1'),_0x7163('0x2'),_0x7163('0x3')];function createListener(_0x384b38,_0x54b8e8){return function(_0x2ecc5e){_0x54b8e8[_0x7163('0x4')](_0x384b38,_0x2ecc5e);};}function removeListener(_0x3e3ff6,_0x5c4d64){return function(){VoiceQueueEvents[_0x7163('0x5')](_0x3e3ff6,_0x5c4d64);};}exports['register']=function(_0x121797){for(var _0x16fb20=0x0,_0x20abe8=events[_0x7163('0x6')];_0x16fb20<_0x20abe8;_0x16fb20++){var _0x5dd43f=events[_0x16fb20];var _0x42ad3a=createListener(_0x7163('0x7')+_0x5dd43f,_0x121797);VoiceQueueEvents['on'](_0x5dd43f,_0x42ad3a);}}; \ No newline at end of file +var _0xe811=['voiceQueue:','./voiceQueue.events','update','emit','removeListener','register','length'];(function(_0x19c5dd,_0x2a35f5){var _0x40218d=function(_0x1a07ad){while(--_0x1a07ad){_0x19c5dd['push'](_0x19c5dd['shift']());}};_0x40218d(++_0x2a35f5);}(_0xe811,0xe1));var _0x1e81=function(_0x1aaf71,_0x495878){_0x1aaf71=_0x1aaf71-0x0;var _0x1a3993=_0xe811[_0x1aaf71];return _0x1a3993;};'use strict';var VoiceQueueEvents=require(_0x1e81('0x0'));var events=['save','remove',_0x1e81('0x1')];function createListener(_0x3a8e32,_0x29ce62){return function(_0x9e021c){_0x29ce62[_0x1e81('0x2')](_0x3a8e32,_0x9e021c);};}function removeListener(_0x3fccec,_0xcf08d0){return function(){VoiceQueueEvents[_0x1e81('0x3')](_0x3fccec,_0xcf08d0);};}exports[_0x1e81('0x4')]=function(_0x13d6d7){for(var _0x4abcf0=0x0,_0x2ede97=events[_0x1e81('0x5')];_0x4abcf0<_0x2ede97;_0x4abcf0++){var _0xa28eae=events[_0x4abcf0];var _0x177314=createListener(_0x1e81('0x6')+_0xa28eae,_0x13d6d7);VoiceQueueEvents['on'](_0xa28eae,_0x177314);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 778b1ec..e1297f0 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 _0x3d9c=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout'];(function(_0x3675db,_0x3a5668){var _0x5b0a5b=function(_0x5536a6){while(--_0x5536a6){_0x3675db['push'](_0x3675db['shift']());}};_0x5b0a5b(++_0x3a5668);}(_0x3d9c,0x111));var _0xc3d9=function(_0x4d67e7,_0x16a1a8){_0x4d67e7=_0x4d67e7-0x0;var _0x3c81b4=_0x3d9c[_0x4d67e7];return _0x3c81b4;};'use strict';var multer=require('multer');var util=require(_0xc3d9('0x0'));var path=require(_0xc3d9('0x1'));var timeout=require(_0xc3d9('0x2'));var express=require(_0xc3d9('0x3'));var router=express[_0xc3d9('0x4')]();var fs_extra=require(_0xc3d9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var controller=require(_0xc3d9('0x8'));router[_0xc3d9('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3d9('0xa')]);router[_0xc3d9('0x9')](_0xc3d9('0xb'),auth[_0xc3d9('0xc')](),controller[_0xc3d9('0xd')]);router[_0xc3d9('0x9')](_0xc3d9('0xe'),auth[_0xc3d9('0xc')](),controller[_0xc3d9('0xf')]);router[_0xc3d9('0x9')](_0xc3d9('0x10'),auth['isAuthenticated'](),controller[_0xc3d9('0x11')]);router[_0xc3d9('0x12')]('/',auth[_0xc3d9('0xc')](),controller[_0xc3d9('0x13')]);router[_0xc3d9('0x14')]('/:id',auth[_0xc3d9('0xc')](),controller['update']);router['delete'](_0xc3d9('0x10'),auth[_0xc3d9('0xc')](),controller[_0xc3d9('0x15')]);module[_0xc3d9('0x16')]=router; \ No newline at end of file +var _0xf980=['/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','describe'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xf980,0xcf));var _0x0f98=function(_0x59d546,_0x107f05){_0x59d546=_0x59d546-0x0;var _0x41fbdb=_0xf980[_0x59d546];return _0x41fbdb;};'use strict';var multer=require(_0x0f98('0x0'));var util=require(_0x0f98('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0f98('0x2'));var router=express['Router']();var fs_extra=require(_0x0f98('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0f98('0x4'));var config=require(_0x0f98('0x5'));var controller=require(_0x0f98('0x6'));router['get']('/',auth[_0x0f98('0x7')](),controller['index']);router['get']('/describe',auth[_0x0f98('0x7')](),controller[_0x0f98('0x8')]);router['get'](_0x0f98('0x9'),auth[_0x0f98('0x7')](),controller[_0x0f98('0xa')]);router['get'](_0x0f98('0xb'),auth['isAuthenticated'](),controller[_0x0f98('0xc')]);router[_0x0f98('0xd')]('/',auth[_0x0f98('0x7')](),controller['create']);router[_0x0f98('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0f98('0xf')]);router[_0x0f98('0x10')](_0x0f98('0xb'),auth[_0x0f98('0x7')](),controller[_0x0f98('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2e17ea3..53a2511 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 _0x5daa=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x39e5a1,_0x3c80e5){var _0x29f7bf=function(_0x5d16a5){while(--_0x5d16a5){_0x39e5a1['push'](_0x39e5a1['shift']());}};_0x29f7bf(++_0x3c80e5);}(_0x5daa,0xe7));var _0xa5da=function(_0x28894d,_0x1232b6){_0x28894d=_0x28894d-0x0;var _0x4031be=_0x5daa[_0x28894d];return _0x4031be;};'use strict';var Sequelize=require(_0xa5da('0x0'));var moment=require(_0xa5da('0x1'));module[_0xa5da('0x2')]={'type':{'type':Sequelize[_0xa5da('0x3')]},'uniqueid':{'type':Sequelize[_0xa5da('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa5da('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xa5da('0x4')],'set':function(_0x15d192){var _0x4d3575=moment(_0x15d192);var _0x4e9c89=moment(this[_0xa5da('0x5')](_0xa5da('0x6')))[_0xa5da('0x7')](_0xa5da('0x8'));var _0x1f869e=_0x4d3575[_0xa5da('0x9')](_0x4e9c89,_0xa5da('0xa'));this[_0xa5da('0xb')](_0xa5da('0xc'),_0x15d192);this[_0xa5da('0xb')](_0xa5da('0xd'),_0x1f869e||null);}},'position':{'type':Sequelize[_0xa5da('0xe')]},'count':{'type':Sequelize[_0xa5da('0xe')]},'queuecallerabandon':{'type':Sequelize[_0xa5da('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa5da('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xa5da('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa5da('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa5da('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xa5da('0xe')]},'channel':{'type':Sequelize[_0xa5da('0x3')]},'connectedlinenum':{'type':Sequelize[_0xa5da('0x3')]},'connectedlinename':{'type':Sequelize[_0xa5da('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa5da('0x3')]},'exten':{'type':Sequelize[_0xa5da('0x3')]},'priority':{'type':Sequelize[_0xa5da('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa5da('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa5da('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa5da('0x3')],'comment':_0xa5da('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa5da('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xa5da('0xe')],'defaultValue':0x0}}; \ No newline at end of file +var _0x00d9=['DATE','getDataValue','queuecallerjoinAt','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING'];(function(_0x5fb80e,_0x5a2095){var _0xa58c1=function(_0x57a0f1){while(--_0x57a0f1){_0x5fb80e['push'](_0x5fb80e['shift']());}};_0xa58c1(++_0x5a2095);}(_0x00d9,0xec));var _0x900d=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x00d9[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0x900d('0x0'));var moment=require(_0x900d('0x1'));module[_0x900d('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x900d('0x3')]},'calleridnum':{'type':Sequelize[_0x900d('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x900d('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x900d('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x900d('0x4')],'set':function(_0x24e285){var _0x4eaa29=moment(_0x24e285);var _0x53a9f3=moment(this[_0x900d('0x5')](_0x900d('0x6')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x461233=_0x4eaa29[_0x900d('0x7')](_0x53a9f3,_0x900d('0x8'));this[_0x900d('0x9')](_0x900d('0xa'),_0x24e285);this['setDataValue'](_0x900d('0xb'),_0x461233||null);}},'position':{'type':Sequelize[_0x900d('0xc')]},'count':{'type':Sequelize[_0x900d('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x900d('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x900d('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x900d('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x900d('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x900d('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x900d('0xc')]},'channel':{'type':Sequelize[_0x900d('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x900d('0x3')]},'accountcode':{'type':Sequelize[_0x900d('0x3')]},'context':{'type':Sequelize[_0x900d('0x3')]},'exten':{'type':Sequelize[_0x900d('0x3')]},'priority':{'type':Sequelize[_0x900d('0x3')]},'holdtime':{'type':Sequelize[_0x900d('0xc')]},'mohtime':{'type':Sequelize[_0x900d('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x900d('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x900d('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x900d('0x3')],'comment':_0x900d('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x900d('0x3')]},'disposition':{'type':Sequelize[_0x900d('0x3')]},'secondDisposition':{'type':Sequelize[_0x900d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x900d('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x900d('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b80177e..3a97d80 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 _0xf00b=['findAll','catch','show','params','find','create','body','describe','pick','options','getVoiceQueuesReport','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include'];(function(_0x18ceb7,_0x391446){var _0x2c5b33=function(_0x52589b){while(--_0x52589b){_0x18ceb7['push'](_0x18ceb7['shift']());}};_0x2c5b33(++_0x391446);}(_0xf00b,0x14f));var _0xbf00=function(_0x4d64a4,_0x1dceda){_0x4d64a4=_0x4d64a4-0x0;var _0x1b5010=_0xf00b[_0x4d64a4];return _0x1b5010;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf00('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf00('0x1'));var BPromise=require(_0xbf00('0x2'));var Mustache=require(_0xbf00('0x3'));var util=require(_0xbf00('0x4'));var path=require(_0xbf00('0x5'));var sox=require('sox');var csv=require(_0xbf00('0x6'));var ejs=require(_0xbf00('0x7'));var fs=require('fs');var fs_extra=require(_0xbf00('0x8'));var _=require(_0xbf00('0x9'));var squel=require(_0xbf00('0xa'));var crypto=require(_0xbf00('0xb'));var jsforce=require(_0xbf00('0xc'));var deskjs=require(_0xbf00('0xd'));var toCsv=require(_0xbf00('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbf00('0xe'));var authService=require(_0xbf00('0xf'));var qs=require(_0xbf00('0x10'));var as=require(_0xbf00('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf00('0x12'))(_0xbf00('0x13'));var utils=require('../../config/utils');var config=require(_0xbf00('0x14'));var licenseUtil=require(_0xbf00('0x15'));var db=require(_0xbf00('0x16'))['db'];config[_0xbf00('0x17')]=_['defaults'](config['redis'],{'host':_0xbf00('0x18'),'port':0x18eb});var socket=require(_0xbf00('0x19'))(new Redis(config['redis']));require(_0xbf00('0x1a'))[_0xbf00('0x1b')](socket);function respondWithStatusCode(_0x323e2b,_0x255e48){_0x255e48=_0x255e48||0xcc;return function(_0x1b4034){if(_0x1b4034){return _0x323e2b[_0xbf00('0x1c')](_0x255e48);}return _0x323e2b['status'](_0x255e48)[_0xbf00('0x1d')]();};}function respondWithResult(_0x4e0365,_0x294c26){_0x294c26=_0x294c26||0xc8;return function(_0x2ca087){if(_0x2ca087){return _0x4e0365[_0xbf00('0x1e')](_0x294c26)[_0xbf00('0x1f')](_0x2ca087);}};}function respondWithFilteredResult(_0x47311f,_0x36236a){return function(_0x109041){if(_0x109041){var _0x2ea328=typeof _0x36236a[_0xbf00('0x20')]===_0xbf00('0x21')&&typeof _0x36236a['limit']==='undefined';var _0x2557e3=_0x109041['count'];var _0x343ddc=_0x2ea328?0x0:_0x36236a['offset'];var _0x26692f=_0x2ea328?_0x109041[_0xbf00('0x22')]:_0x36236a['offset']+_0x36236a[_0xbf00('0x23')];var _0x468d7b;if(_0x26692f>=_0x2557e3){_0x26692f=_0x2557e3;_0x468d7b=0xc8;}else{_0x468d7b=0xce;}_0x47311f[_0xbf00('0x1e')](_0x468d7b);return _0x47311f[_0xbf00('0x24')]('Content-Range',_0x343ddc+'-'+_0x26692f+'/'+_0x2557e3)[_0xbf00('0x1f')](_0x109041);}return null;};}function patchUpdates(_0x27a53f){return function(_0x2c5a2a){try{jsonpatch[_0xbf00('0x25')](_0x2c5a2a,_0x27a53f,!![]);}catch(_0x238607){return BPromise[_0xbf00('0x26')](_0x238607);}return _0x2c5a2a[_0xbf00('0x27')]();};}function saveUpdates(_0x340b93,_0x36e26e){return function(_0x4c6e67){if(_0x4c6e67){return _0x4c6e67[_0xbf00('0x28')](_0x340b93)[_0xbf00('0x29')](function(_0x2ba1d0){return _0x2ba1d0;});}return null;};}function removeEntity(_0x5086a9,_0x54bf84){return function(_0x40bb27){if(_0x40bb27){return _0x40bb27[_0xbf00('0x2a')]()[_0xbf00('0x29')](function(){_0x5086a9[_0xbf00('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x144658,_0x5f1ca1){return function(_0x5a976b){if(!_0x5a976b){_0x144658[_0xbf00('0x1c')](0x194);}return _0x5a976b;};}function handleError(_0x5e20d1,_0x325be3){_0x325be3=_0x325be3||0x1f4;return function(_0x8e5350){logger[_0xbf00('0x2b')](_0x8e5350[_0xbf00('0x2c')]);if(_0x8e5350[_0xbf00('0x2d')]){delete _0x8e5350[_0xbf00('0x2d')];}_0x5e20d1[_0xbf00('0x1e')](_0x325be3)[_0xbf00('0x2e')](_0x8e5350);};}exports['index']=function(_0x1e2681,_0x40b200){var _0x11ea49={},_0x237d02={},_0x14fc43={'count':0x0,'rows':[]};var _0x3c3682=_[_0xbf00('0x2f')](db[_0xbf00('0x30')][_0xbf00('0x31')],function(_0x22f04c){return{'name':_0x22f04c[_0xbf00('0x32')],'type':_0x22f04c['type'][_0xbf00('0x33')]};});_0x237d02[_0xbf00('0x34')]=_[_0xbf00('0x2f')](_0x3c3682,_0xbf00('0x2d'));_0x237d02[_0xbf00('0x35')]=_[_0xbf00('0x36')](_0x1e2681['query']);_0x237d02[_0xbf00('0x37')]=_[_0xbf00('0x38')](_0x237d02[_0xbf00('0x34')],_0x237d02[_0xbf00('0x35')]);_0x11ea49['attributes']=_[_0xbf00('0x38')](_0x237d02[_0xbf00('0x34')],qs[_0xbf00('0x39')](_0x1e2681[_0xbf00('0x35')]['fields']));_0x11ea49[_0xbf00('0x3a')]=_0x11ea49['attributes'][_0xbf00('0x3b')]?_0x11ea49[_0xbf00('0x3a')]:_0x237d02[_0xbf00('0x34')];if(!_0x1e2681[_0xbf00('0x35')][_0xbf00('0x3c')](_0xbf00('0x3d'))){_0x11ea49[_0xbf00('0x23')]=qs[_0xbf00('0x23')](_0x1e2681['query'][_0xbf00('0x23')]);_0x11ea49[_0xbf00('0x20')]=qs[_0xbf00('0x20')](_0x1e2681[_0xbf00('0x35')][_0xbf00('0x20')]);}_0x11ea49[_0xbf00('0x3e')]=qs[_0xbf00('0x3f')](_0x1e2681[_0xbf00('0x35')][_0xbf00('0x3f')]);_0x11ea49[_0xbf00('0x40')]=qs['filters'](_['pick'](_0x1e2681[_0xbf00('0x35')],_0x237d02[_0xbf00('0x37')]),_0x3c3682);if(_0x1e2681[_0xbf00('0x35')]['filter']){_0x11ea49[_0xbf00('0x40')]=_[_0xbf00('0x41')](_0x11ea49[_0xbf00('0x40')],{'$or':_[_0xbf00('0x2f')](_0x3c3682,function(_0x23215e){if(_0x23215e['type']!==_0xbf00('0x42')){var _0x36da6d={};_0x36da6d[_0x23215e['name']]={'$like':'%'+_0x1e2681[_0xbf00('0x35')][_0xbf00('0x43')]+'%'};return _0x36da6d;}})});}_0x11ea49=_[_0xbf00('0x41')]({},_0x11ea49,_0x1e2681['options']);var _0x4647b5={'where':_0x11ea49[_0xbf00('0x40')]};return db['VoiceQueueReport'][_0xbf00('0x22')](_0x4647b5)[_0xbf00('0x29')](function(_0x2e3450){_0x14fc43[_0xbf00('0x22')]=_0x2e3450;if(_0x1e2681['query'][_0xbf00('0x44')]){_0x11ea49[_0xbf00('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xbf00('0x46')](_0x11ea49);})['then'](function(_0x45903b){_0x14fc43['rows']=_0x45903b;return _0x14fc43;})[_0xbf00('0x29')](respondWithFilteredResult(_0x40b200,_0x11ea49))[_0xbf00('0x47')](handleError(_0x40b200,null));};exports[_0xbf00('0x48')]=function(_0x3add03,_0x4fbea0){var _0x213b9d={'raw':![],'where':{'id':_0x3add03[_0xbf00('0x49')]['id']}},_0x4c8b80={};_0x4c8b80[_0xbf00('0x34')]=_['keys'](db['VoiceQueueReport']['rawAttributes']);_0x4c8b80[_0xbf00('0x35')]=_[_0xbf00('0x36')](_0x3add03['query']);_0x4c8b80[_0xbf00('0x37')]=_['intersection'](_0x4c8b80['model'],_0x4c8b80[_0xbf00('0x35')]);_0x213b9d[_0xbf00('0x3a')]=_[_0xbf00('0x38')](_0x4c8b80[_0xbf00('0x34')],qs[_0xbf00('0x39')](_0x3add03[_0xbf00('0x35')]['fields']));_0x213b9d[_0xbf00('0x3a')]=_0x213b9d['attributes'][_0xbf00('0x3b')]?_0x213b9d[_0xbf00('0x3a')]:_0x4c8b80[_0xbf00('0x34')];if(_0x3add03[_0xbf00('0x35')][_0xbf00('0x44')]){_0x213b9d['include']=[{'all':!![]}];}_0x213b9d=_[_0xbf00('0x41')]({},_0x213b9d,_0x3add03['options']);return db[_0xbf00('0x30')][_0xbf00('0x4a')](_0x213b9d)['then'](handleEntityNotFound(_0x4fbea0,null))[_0xbf00('0x29')](respondWithResult(_0x4fbea0,null))[_0xbf00('0x47')](handleError(_0x4fbea0,null));};exports[_0xbf00('0x4b')]=function(_0x409338,_0x33431e){return db[_0xbf00('0x30')]['create'](_0x409338[_0xbf00('0x4c')],{})[_0xbf00('0x29')](respondWithResult(_0x33431e,0xc9))[_0xbf00('0x47')](handleError(_0x33431e,null));};exports[_0xbf00('0x28')]=function(_0x324347,_0x1f31f8){if(_0x324347[_0xbf00('0x4c')]['id']){delete _0x324347[_0xbf00('0x4c')]['id'];}return db[_0xbf00('0x30')][_0xbf00('0x4a')]({'where':{'id':_0x324347[_0xbf00('0x49')]['id']}})[_0xbf00('0x29')](handleEntityNotFound(_0x1f31f8,null))[_0xbf00('0x29')](saveUpdates(_0x324347[_0xbf00('0x4c')],null))['then'](respondWithResult(_0x1f31f8,null))['catch'](handleError(_0x1f31f8,null));};exports[_0xbf00('0x2a')]=function(_0x262018,_0x25d4ed){return db['VoiceQueueReport'][_0xbf00('0x4a')]({'where':{'id':_0x262018[_0xbf00('0x49')]['id']}})[_0xbf00('0x29')](handleEntityNotFound(_0x25d4ed,null))['then'](removeEntity(_0x25d4ed,null))[_0xbf00('0x47')](handleError(_0x25d4ed,null));};exports[_0xbf00('0x4d')]=function(_0xdb96c1,_0x49578e){return db['VoiceQueueReport'][_0xbf00('0x4d')]()[_0xbf00('0x29')](respondWithResult(_0x49578e,null))[_0xbf00('0x47')](handleError(_0x49578e,null));};exports['getVoiceQueuesReport']=function(_0x97edfb,_0x2b6897){var _0x1bad9e={},_0x47fe62={},_0x2b8c3e={'count':0x0,'rows':[]};_0x47fe62[_0xbf00('0x34')]=_[_0xbf00('0x36')](db[_0xbf00('0x30')]['rawAttributes']);_0x47fe62[_0xbf00('0x35')]=_[_0xbf00('0x36')](_0x97edfb[_0xbf00('0x35')]);_0x47fe62[_0xbf00('0x37')]=_[_0xbf00('0x38')](_0x47fe62['model'],_0x47fe62[_0xbf00('0x35')]);_0x1bad9e[_0xbf00('0x3a')]=_[_0xbf00('0x38')](_0x47fe62[_0xbf00('0x34')],qs[_0xbf00('0x39')](_0x97edfb[_0xbf00('0x35')][_0xbf00('0x39')]));_0x1bad9e[_0xbf00('0x3a')]=_0x1bad9e['attributes'][_0xbf00('0x3b')]?_0x1bad9e[_0xbf00('0x3a')]:_0x47fe62[_0xbf00('0x34')];if(!_0x97edfb[_0xbf00('0x35')]['hasOwnProperty'](_0xbf00('0x3d'))){_0x1bad9e[_0xbf00('0x23')]=qs['limit'](_0x97edfb[_0xbf00('0x35')][_0xbf00('0x23')]);_0x1bad9e[_0xbf00('0x20')]=qs[_0xbf00('0x20')](_0x97edfb[_0xbf00('0x35')][_0xbf00('0x20')]);}_0x1bad9e[_0xbf00('0x3e')]=qs['sort'](_0x97edfb[_0xbf00('0x35')][_0xbf00('0x3f')]);_0x1bad9e[_0xbf00('0x40')]=qs[_0xbf00('0x37')](_[_0xbf00('0x4e')](_0x97edfb[_0xbf00('0x35')],_0x47fe62[_0xbf00('0x37')]));if(_0x97edfb[_0xbf00('0x35')]['filter']){_0x1bad9e['where']=_[_0xbf00('0x41')](_0x1bad9e[_0xbf00('0x40')],{'$or':_[_0xbf00('0x2f')](_0x1bad9e[_0xbf00('0x3a')],function(_0x88a398){var _0x939aa={};_0x939aa[_0x88a398]={'$like':'%'+_0x97edfb['query'][_0xbf00('0x43')]+'%'};return _0x939aa;})});}_0x1bad9e=_[_0xbf00('0x41')]({},_0x1bad9e,_0x97edfb[_0xbf00('0x4f')]);var _0x35f91b={'where':_0x1bad9e[_0xbf00('0x40')]};return db['VoiceQueueReport']['count'](_0x35f91b)[_0xbf00('0x29')](function(_0x289bd2){_0x2b8c3e[_0xbf00('0x22')]=_0x289bd2;if(_0x97edfb[_0xbf00('0x35')][_0xbf00('0x44')]){_0x1bad9e[_0xbf00('0x45')]=[{'all':!![]}];}return db[_0xbf00('0x30')]['findAll'](_0x1bad9e);})[_0xbf00('0x29')](function(_0x42c95c){_0x2b8c3e['rows']=_0x42c95c;return _0x2b8c3e;})[_0xbf00('0x29')](respondWithFilteredResult(_0x2b6897,_0x1bad9e,_0xbf00('0x50')))['catch'](handleError(_0x2b6897,null,_0xbf00('0x50')));}; \ No newline at end of file +var _0x69d2=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','index','VoiceQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','map','filter','options','includeAll','include','catch','show','params','rawAttributes','merge','find','create','body','describe','getVoiceQueuesReport','nolimit','rows','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x69d2,0x13f));var _0x269d=function(_0x4ddfb3,_0x5d75b7){_0x4ddfb3=_0x4ddfb3-0x0;var _0x34a1b6=_0x69d2[_0x4ddfb3];return _0x34a1b6;};'use strict';var emlformat=require(_0x269d('0x0'));var rimraf=require(_0x269d('0x1'));var zipdir=require(_0x269d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x269d('0x3'));var moment=require('moment');var BPromise=require(_0x269d('0x4'));var Mustache=require(_0x269d('0x5'));var util=require(_0x269d('0x6'));var path=require(_0x269d('0x7'));var sox=require(_0x269d('0x8'));var csv=require('to-csv');var ejs=require(_0x269d('0x9'));var fs=require('fs');var fs_extra=require(_0x269d('0xa'));var _=require(_0x269d('0xb'));var squel=require(_0x269d('0xc'));var crypto=require(_0x269d('0xd'));var jsforce=require(_0x269d('0xe'));var deskjs=require(_0x269d('0xf'));var toCsv=require(_0x269d('0x10'));var querystring=require(_0x269d('0x11'));var Papa=require(_0x269d('0x12'));var Redis=require('ioredis');var authService=require(_0x269d('0x13'));var qs=require(_0x269d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x269d('0x15'));var logger=require(_0x269d('0x16'))(_0x269d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x269d('0x18'));var db=require(_0x269d('0x19'))['db'];config[_0x269d('0x1a')]=_[_0x269d('0x1b')](config[_0x269d('0x1a')],{'host':_0x269d('0x1c'),'port':0x18eb});var socket=require(_0x269d('0x1d'))(new Redis(config[_0x269d('0x1a')]));require(_0x269d('0x1e'))[_0x269d('0x1f')](socket);function respondWithStatusCode(_0x16bb77,_0x24bf4b){_0x24bf4b=_0x24bf4b||0xcc;return function(_0x5cb263){if(_0x5cb263){return _0x16bb77[_0x269d('0x20')](_0x24bf4b);}return _0x16bb77[_0x269d('0x21')](_0x24bf4b)[_0x269d('0x22')]();};}function respondWithResult(_0xddbb15,_0x4fb52b){_0x4fb52b=_0x4fb52b||0xc8;return function(_0xab33d5){if(_0xab33d5){return _0xddbb15[_0x269d('0x21')](_0x4fb52b)[_0x269d('0x23')](_0xab33d5);}};}function respondWithFilteredResult(_0x13d33f,_0x2f1cb2){return function(_0x5810c1){if(_0x5810c1){var _0x362077=typeof _0x2f1cb2[_0x269d('0x24')]==='undefined'&&typeof _0x2f1cb2['limit']===_0x269d('0x25');var _0x2ac44d=_0x5810c1[_0x269d('0x26')];var _0x2a920a=_0x362077?0x0:_0x2f1cb2[_0x269d('0x24')];var _0x5f448f=_0x362077?_0x5810c1[_0x269d('0x26')]:_0x2f1cb2['offset']+_0x2f1cb2[_0x269d('0x27')];var _0x1cf11b;if(_0x5f448f>=_0x2ac44d){_0x5f448f=_0x2ac44d;_0x1cf11b=0xc8;}else{_0x1cf11b=0xce;}_0x13d33f[_0x269d('0x21')](_0x1cf11b);return _0x13d33f[_0x269d('0x28')](_0x269d('0x29'),_0x2a920a+'-'+_0x5f448f+'/'+_0x2ac44d)[_0x269d('0x23')](_0x5810c1);}return null;};}function patchUpdates(_0x549c85){return function(_0x29abe0){try{jsonpatch['apply'](_0x29abe0,_0x549c85,!![]);}catch(_0x265495){return BPromise[_0x269d('0x2a')](_0x265495);}return _0x29abe0['save']();};}function saveUpdates(_0xff81b9,_0x375623){return function(_0x5e2bbd){if(_0x5e2bbd){return _0x5e2bbd[_0x269d('0x2b')](_0xff81b9)[_0x269d('0x2c')](function(_0x140399){return _0x140399;});}return null;};}function removeEntity(_0x27523b,_0x35863b){return function(_0x55c0b5){if(_0x55c0b5){return _0x55c0b5[_0x269d('0x2d')]()['then'](function(){_0x27523b[_0x269d('0x21')](0xcc)[_0x269d('0x22')]();});}};}function handleEntityNotFound(_0x31360c,_0x2235bd){return function(_0xc9e2f6){if(!_0xc9e2f6){_0x31360c[_0x269d('0x20')](0x194);}return _0xc9e2f6;};}function handleError(_0x137bb2,_0x12cc75){_0x12cc75=_0x12cc75||0x1f4;return function(_0xa61a8){logger['error'](_0xa61a8[_0x269d('0x2e')]);if(_0xa61a8['name']){delete _0xa61a8[_0x269d('0x2f')];}_0x137bb2[_0x269d('0x21')](_0x12cc75)[_0x269d('0x30')](_0xa61a8);};}exports[_0x269d('0x31')]=function(_0x35c746,_0x4315bb){var _0x468747={},_0x3003cb={},_0x2893fb={'count':0x0,'rows':[]};var _0x3ffbf2=_['map'](db[_0x269d('0x32')]['rawAttributes'],function(_0x191412){return{'name':_0x191412[_0x269d('0x33')],'type':_0x191412[_0x269d('0x34')][_0x269d('0x35')]};});_0x3003cb[_0x269d('0x36')]=_['map'](_0x3ffbf2,'name');_0x3003cb[_0x269d('0x37')]=_[_0x269d('0x38')](_0x35c746[_0x269d('0x37')]);_0x3003cb[_0x269d('0x39')]=_['intersection'](_0x3003cb[_0x269d('0x36')],_0x3003cb[_0x269d('0x37')]);_0x468747['attributes']=_[_0x269d('0x3a')](_0x3003cb[_0x269d('0x36')],qs['fields'](_0x35c746[_0x269d('0x37')][_0x269d('0x3b')]));_0x468747['attributes']=_0x468747[_0x269d('0x3c')][_0x269d('0x3d')]?_0x468747[_0x269d('0x3c')]:_0x3003cb[_0x269d('0x36')];if(!_0x35c746['query'][_0x269d('0x3e')]('nolimit')){_0x468747[_0x269d('0x27')]=qs[_0x269d('0x27')](_0x35c746[_0x269d('0x37')][_0x269d('0x27')]);_0x468747[_0x269d('0x24')]=qs[_0x269d('0x24')](_0x35c746['query'][_0x269d('0x24')]);}_0x468747[_0x269d('0x3f')]=qs[_0x269d('0x40')](_0x35c746[_0x269d('0x37')][_0x269d('0x40')]);_0x468747[_0x269d('0x41')]=qs[_0x269d('0x39')](_[_0x269d('0x42')](_0x35c746[_0x269d('0x37')],_0x3003cb[_0x269d('0x39')]),_0x3ffbf2);if(_0x35c746[_0x269d('0x37')]['filter']){_0x468747[_0x269d('0x41')]=_['merge'](_0x468747[_0x269d('0x41')],{'$or':_[_0x269d('0x43')](_0x3ffbf2,function(_0x330c56){if(_0x330c56['type']!=='VIRTUAL'){var _0x4ce2b9={};_0x4ce2b9[_0x330c56[_0x269d('0x2f')]]={'$like':'%'+_0x35c746['query'][_0x269d('0x44')]+'%'};return _0x4ce2b9;}})});}_0x468747=_['merge']({},_0x468747,_0x35c746[_0x269d('0x45')]);var _0x25dca9={'where':_0x468747[_0x269d('0x41')]};return db['VoiceQueueReport']['count'](_0x25dca9)['then'](function(_0x44514d){_0x2893fb[_0x269d('0x26')]=_0x44514d;if(_0x35c746[_0x269d('0x37')][_0x269d('0x46')]){_0x468747[_0x269d('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x468747);})[_0x269d('0x2c')](function(_0x2602b4){_0x2893fb['rows']=_0x2602b4;return _0x2893fb;})[_0x269d('0x2c')](respondWithFilteredResult(_0x4315bb,_0x468747))[_0x269d('0x48')](handleError(_0x4315bb,null));};exports[_0x269d('0x49')]=function(_0x3ba0c9,_0x50adc8){var _0x241a33={'raw':![],'where':{'id':_0x3ba0c9[_0x269d('0x4a')]['id']}},_0x19016d={};_0x19016d[_0x269d('0x36')]=_[_0x269d('0x38')](db[_0x269d('0x32')][_0x269d('0x4b')]);_0x19016d[_0x269d('0x37')]=_['keys'](_0x3ba0c9[_0x269d('0x37')]);_0x19016d[_0x269d('0x39')]=_[_0x269d('0x3a')](_0x19016d[_0x269d('0x36')],_0x19016d[_0x269d('0x37')]);_0x241a33[_0x269d('0x3c')]=_[_0x269d('0x3a')](_0x19016d[_0x269d('0x36')],qs[_0x269d('0x3b')](_0x3ba0c9[_0x269d('0x37')]['fields']));_0x241a33[_0x269d('0x3c')]=_0x241a33[_0x269d('0x3c')][_0x269d('0x3d')]?_0x241a33[_0x269d('0x3c')]:_0x19016d[_0x269d('0x36')];if(_0x3ba0c9[_0x269d('0x37')][_0x269d('0x46')]){_0x241a33['include']=[{'all':!![]}];}_0x241a33=_[_0x269d('0x4c')]({},_0x241a33,_0x3ba0c9[_0x269d('0x45')]);return db[_0x269d('0x32')][_0x269d('0x4d')](_0x241a33)[_0x269d('0x2c')](handleEntityNotFound(_0x50adc8,null))[_0x269d('0x2c')](respondWithResult(_0x50adc8,null))[_0x269d('0x48')](handleError(_0x50adc8,null));};exports[_0x269d('0x4e')]=function(_0x53aa65,_0x54ab52){return db[_0x269d('0x32')]['create'](_0x53aa65[_0x269d('0x4f')],{})[_0x269d('0x2c')](respondWithResult(_0x54ab52,0xc9))[_0x269d('0x48')](handleError(_0x54ab52,null));};exports[_0x269d('0x2b')]=function(_0x104998,_0x37e0d1){if(_0x104998['body']['id']){delete _0x104998[_0x269d('0x4f')]['id'];}return db[_0x269d('0x32')]['find']({'where':{'id':_0x104998[_0x269d('0x4a')]['id']}})[_0x269d('0x2c')](handleEntityNotFound(_0x37e0d1,null))[_0x269d('0x2c')](saveUpdates(_0x104998[_0x269d('0x4f')],null))[_0x269d('0x2c')](respondWithResult(_0x37e0d1,null))['catch'](handleError(_0x37e0d1,null));};exports[_0x269d('0x2d')]=function(_0x564294,_0x1ccdde){return db[_0x269d('0x32')][_0x269d('0x4d')]({'where':{'id':_0x564294[_0x269d('0x4a')]['id']}})[_0x269d('0x2c')](handleEntityNotFound(_0x1ccdde,null))[_0x269d('0x2c')](removeEntity(_0x1ccdde,null))['catch'](handleError(_0x1ccdde,null));};exports[_0x269d('0x50')]=function(_0x3f7741,_0x5e9a27){return db['VoiceQueueReport'][_0x269d('0x50')]()[_0x269d('0x2c')](respondWithResult(_0x5e9a27,null))[_0x269d('0x48')](handleError(_0x5e9a27,null));};exports[_0x269d('0x51')]=function(_0x14be69,_0x3fb387){var _0x6c6cae={},_0x1fb7f4={},_0x3e19a6={'count':0x0,'rows':[]};_0x1fb7f4[_0x269d('0x36')]=_['keys'](db['VoiceQueueReport'][_0x269d('0x4b')]);_0x1fb7f4[_0x269d('0x37')]=_[_0x269d('0x38')](_0x14be69[_0x269d('0x37')]);_0x1fb7f4[_0x269d('0x39')]=_[_0x269d('0x3a')](_0x1fb7f4[_0x269d('0x36')],_0x1fb7f4[_0x269d('0x37')]);_0x6c6cae[_0x269d('0x3c')]=_['intersection'](_0x1fb7f4[_0x269d('0x36')],qs['fields'](_0x14be69[_0x269d('0x37')][_0x269d('0x3b')]));_0x6c6cae[_0x269d('0x3c')]=_0x6c6cae[_0x269d('0x3c')][_0x269d('0x3d')]?_0x6c6cae[_0x269d('0x3c')]:_0x1fb7f4[_0x269d('0x36')];if(!_0x14be69['query'][_0x269d('0x3e')](_0x269d('0x52'))){_0x6c6cae[_0x269d('0x27')]=qs['limit'](_0x14be69[_0x269d('0x37')][_0x269d('0x27')]);_0x6c6cae[_0x269d('0x24')]=qs[_0x269d('0x24')](_0x14be69[_0x269d('0x37')][_0x269d('0x24')]);}_0x6c6cae[_0x269d('0x3f')]=qs['sort'](_0x14be69[_0x269d('0x37')]['sort']);_0x6c6cae[_0x269d('0x41')]=qs[_0x269d('0x39')](_['pick'](_0x14be69[_0x269d('0x37')],_0x1fb7f4[_0x269d('0x39')]));if(_0x14be69[_0x269d('0x37')][_0x269d('0x44')]){_0x6c6cae['where']=_[_0x269d('0x4c')](_0x6c6cae[_0x269d('0x41')],{'$or':_[_0x269d('0x43')](_0x6c6cae[_0x269d('0x3c')],function(_0xfcc55e){var _0xe471c3={};_0xe471c3[_0xfcc55e]={'$like':'%'+_0x14be69[_0x269d('0x37')][_0x269d('0x44')]+'%'};return _0xe471c3;})});}_0x6c6cae=_[_0x269d('0x4c')]({},_0x6c6cae,_0x14be69[_0x269d('0x45')]);var _0x305a8a={'where':_0x6c6cae[_0x269d('0x41')]};return db[_0x269d('0x32')]['count'](_0x305a8a)[_0x269d('0x2c')](function(_0x3478cc){_0x3e19a6['count']=_0x3478cc;if(_0x14be69[_0x269d('0x37')][_0x269d('0x46')]){_0x6c6cae[_0x269d('0x47')]=[{'all':!![]}];}return db[_0x269d('0x32')]['findAll'](_0x6c6cae);})[_0x269d('0x2c')](function(_0x301457){_0x3e19a6[_0x269d('0x53')]=_0x301457;return _0x3e19a6;})[_0x269d('0x2c')](respondWithFilteredResult(_0x3fb387,_0x6c6cae,_0x269d('0x51')))[_0x269d('0x48')](handleError(_0x3fb387,null,_0x269d('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f71b4b7..dc68580 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 _0xa27b=['exports','../../mysqldb','VoiceQueueReport','save','update','emit','hasOwnProperty'];(function(_0x2ae870,_0x1cd95a){var _0x301e88=function(_0x4ceae5){while(--_0x4ceae5){_0x2ae870['push'](_0x2ae870['shift']());}};_0x301e88(++_0x1cd95a);}(_0xa27b,0x174));var _0xba27=function(_0x3b7be7,_0x499482){_0x3b7be7=_0x3b7be7-0x0;var _0xa955ad=_0xa27b[_0x3b7be7];return _0xa955ad;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xba27('0x0'))['db'][_0xba27('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xba27('0x2'),'afterUpdate':_0xba27('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4d828c){return function(_0x2a403b,_0x460320,_0x2036ca){VoiceQueueReportEvents['emit'](_0x4d828c+':'+_0x2a403b['id'],_0x2a403b);VoiceQueueReportEvents[_0xba27('0x4')](_0x4d828c,_0x2a403b);_0x2036ca(null);};}for(var e in events){if(events[_0xba27('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xba27('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xa1b6=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hook','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa1b6,0x156));var _0x6a1b=function(_0x8982f2,_0x1068cb){_0x8982f2=_0x8982f2-0x0;var _0x30eea8=_0xa1b6[_0x8982f2];return _0x30eea8;};'use strict';var EventEmitter=require(_0x6a1b('0x0'));var VoiceQueueReport=require(_0x6a1b('0x1'))['db'][_0x6a1b('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6a1b('0x3')](0x0);var events={'afterCreate':_0x6a1b('0x4'),'afterUpdate':_0x6a1b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4824a1){return function(_0xb00ec1,_0x527985,_0x57e3a2){VoiceQueueReportEvents[_0x6a1b('0x6')](_0x4824a1+':'+_0xb00ec1['id'],_0xb00ec1);VoiceQueueReportEvents[_0x6a1b('0x6')](_0x4824a1,_0xb00ec1);_0x57e3a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x6a1b('0x7')](e,emitEvent(event));}}module[_0x6a1b('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 4b4d6e7..604701d 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 _0x331c=['request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','util','bluebird'];(function(_0x1c0fa0,_0x43e1e7){var _0x47525f=function(_0x2a2f5a){while(--_0x2a2f5a){_0x1c0fa0['push'](_0x1c0fa0['shift']());}};_0x47525f(++_0x43e1e7);}(_0x331c,0xe4));var _0xc331=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x331c[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0xc331('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc331('0x1'));var rp=require(_0xc331('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc331('0x3'));var config=require(_0xc331('0x4'));var attributes=require(_0xc331('0x5'));module['exports']=function(_0x1f6f78,_0x588301){return _0x1f6f78[_0xc331('0x6')](_0xc331('0x7'),attributes,{'tableName':_0xc331('0x8'),'paranoid':![],'indexes':[{'fields':[_0xc331('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9279=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3dabf6,_0x39ae1b){var _0x579a75=function(_0x4c0adb){while(--_0x4c0adb){_0x3dabf6['push'](_0x3dabf6['shift']());}};_0x579a75(++_0x39ae1b);}(_0x9279,0x78));var _0x9927=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x9279[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require(_0x9927('0x0'));var util=require(_0x9927('0x1'));var logger=require(_0x9927('0x2'))(_0x9927('0x3'));var moment=require(_0x9927('0x4'));var BPromise=require('bluebird');var rp=require(_0x9927('0x5'));var fs=require('fs');var path=require(_0x9927('0x6'));var rimraf=require(_0x9927('0x7'));var config=require(_0x9927('0x8'));var attributes=require(_0x9927('0x9'));module[_0x9927('0xa')]=function(_0xd70f46,_0x48406e){return _0xd70f46[_0x9927('0xb')](_0x9927('0xc'),attributes,{'tableName':_0x9927('0xd'),'paranoid':![],'indexes':[{'fields':[_0x9927('0xe')]},{'fields':[_0x9927('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 771cc2e..fdebd6e 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 _0x1328=['CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','map','include','model'];(function(_0x4bf61a,_0x3a649b){var _0x27f463=function(_0x62b90){while(--_0x62b90){_0x4bf61a['push'](_0x4bf61a['shift']());}};_0x27f463(++_0x3a649b);}(_0x1328,0x11e));var _0x8132=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x1328[_0x125ff8];return _0x2d9ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8132('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8132('0x1'));var db=require(_0x8132('0x2'))['db'];var utils=require(_0x8132('0x3'));var logger=require(_0x8132('0x4'))('rpc');var config=require(_0x8132('0x5'));var jayson=require(_0x8132('0x6'));var client=jayson[_0x8132('0x7')]['http']({'port':0x232a});config['redis']=_[_0x8132('0x8')](config[_0x8132('0x9')],{'host':_0x8132('0xa'),'port':0x18eb});var socket=require(_0x8132('0xb'))(new Redis(config[_0x8132('0x9')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x1a3469,_0xde83f3,_0x13eb56){return new BPromise(function(_0x73e6b1,_0x1c338d){return client['request'](_0x1a3469,_0x13eb56)[_0x8132('0xc')](function(_0x49a2e0){logger[_0x8132('0xd')](_0x8132('0xe'),_0xde83f3,_0x8132('0xf'));logger[_0x8132('0x10')](_0x8132('0x11'),_0xde83f3,_0x8132('0xf'),JSON[_0x8132('0x12')](_0x49a2e0));if(_0x49a2e0['error']){if(_0x49a2e0[_0x8132('0x13')][_0x8132('0x14')]===0x1f4){logger[_0x8132('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0xde83f3,_0x49a2e0['error'][_0x8132('0x15')]);return _0x1c338d(_0x49a2e0[_0x8132('0x13')][_0x8132('0x15')]);}logger[_0x8132('0x13')](_0x8132('0xe'),_0xde83f3,_0x49a2e0[_0x8132('0x13')][_0x8132('0x15')]);return _0x73e6b1(_0x49a2e0[_0x8132('0x13')][_0x8132('0x15')]);}else{logger[_0x8132('0xd')](_0x8132('0xe'),_0xde83f3,_0x8132('0xf'));_0x73e6b1(_0x49a2e0[_0x8132('0x16')][_0x8132('0x15')]);}})[_0x8132('0x17')](function(_0x148281){logger[_0x8132('0x13')](_0x8132('0xe'),_0xde83f3,_0x148281);_0x1c338d(_0x148281);});});}exports[_0x8132('0x18')]=function(_0x2c208d){var _0x293a4e=this;return new Promise(function(_0x170aaa,_0xbc17a7){return db[_0x8132('0x19')][_0x8132('0x1a')]({'raw':_0x2c208d[_0x8132('0x1b')]?_0x2c208d[_0x8132('0x1b')][_0x8132('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c208d['options']?_0x2c208d[_0x8132('0x1b')]['where']||null:null,'attributes':_0x2c208d[_0x8132('0x1b')]?_0x2c208d[_0x8132('0x1b')][_0x8132('0x1d')]||null:null,'limit':_0x2c208d['options']?_0x2c208d[_0x8132('0x1b')][_0x8132('0x1e')]||null:null,'include':_0x2c208d[_0x8132('0x1b')]?_0x2c208d[_0x8132('0x1b')]['include']?_[_0x8132('0x1f')](_0x2c208d[_0x8132('0x1b')][_0x8132('0x20')],function(_0x140c27){return{'model':db[_0x140c27[_0x8132('0x21')]],'as':_0x140c27['as'],'attributes':_0x140c27[_0x8132('0x1d')],'include':_0x140c27['include']?_['map'](_0x140c27[_0x8132('0x20')],function(_0x6bc2a8){return{'model':db[_0x6bc2a8['model']],'as':_0x6bc2a8['as'],'attributes':_0x6bc2a8[_0x8132('0x1d')],'include':_0x6bc2a8['include']?_[_0x8132('0x1f')](_0x6bc2a8[_0x8132('0x20')],function(_0x280c88){return{'model':db[_0x280c88[_0x8132('0x21')]],'as':_0x280c88['as'],'attributes':_0x280c88['attributes']};}):[]};}):[]};}):[]:[]})[_0x8132('0xc')](function(_0x46cb9d){logger[_0x8132('0xd')](_0x8132('0x18'),_0x2c208d);logger['debug'](_0x8132('0x18'),_0x2c208d,JSON[_0x8132('0x12')](_0x46cb9d));_0x170aaa(_0x46cb9d);})[_0x8132('0x17')](function(_0x873e00){logger[_0x8132('0x13')](_0x8132('0x18'),_0x873e00[_0x8132('0x15')],_0x2c208d);_0xbc17a7(_0x293a4e['error'](0x1f4,_0x873e00[_0x8132('0x15')]));});});};exports[_0x8132('0x22')]=function(_0x53f6ad){var _0x230ab3=this;return new Promise(function(_0x593f9f,_0x3339b9){return db[_0x8132('0x19')][_0x8132('0x23')](_0x53f6ad[_0x8132('0x24')],{'raw':_0x53f6ad['options']?_0x53f6ad[_0x8132('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8132('0xc')](function(_0x4a758e){logger[_0x8132('0xd')](_0x8132('0x22'),_0x53f6ad);logger['debug'](_0x8132('0x22'),_0x53f6ad,JSON[_0x8132('0x12')](_0x4a758e));_0x593f9f(_0x4a758e);})[_0x8132('0x17')](function(_0x1d7cff){logger[_0x8132('0x13')](_0x8132('0x22'),_0x1d7cff[_0x8132('0x15')],_0x53f6ad);_0x3339b9(_0x230ab3['error'](0x1f4,_0x1d7cff['message']));});});};exports[_0x8132('0x25')]=function(_0x5501e1){var _0x2c420e=this;return new Promise(function(_0x59288e,_0x385c5c){return db[_0x8132('0x19')][_0x8132('0x26')](_0x5501e1[_0x8132('0x24')],{'raw':_0x5501e1[_0x8132('0x1b')]?_0x5501e1[_0x8132('0x1b')][_0x8132('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5501e1[_0x8132('0x1b')]?_0x5501e1['options'][_0x8132('0x27')]||null:null,'attributes':_0x5501e1[_0x8132('0x1b')]?_0x5501e1['options'][_0x8132('0x1d')]||null:null,'limit':_0x5501e1[_0x8132('0x1b')]?_0x5501e1[_0x8132('0x1b')][_0x8132('0x1e')]||null:null})[_0x8132('0xc')](function(_0x51a674){logger[_0x8132('0xd')](_0x8132('0x25'),_0x5501e1);logger[_0x8132('0x10')](_0x8132('0x25'),_0x5501e1,JSON[_0x8132('0x12')](_0x51a674));_0x59288e(_0x51a674);})[_0x8132('0x17')](function(_0x316bdc){logger['error'](_0x8132('0x25'),_0x316bdc[_0x8132('0x15')],_0x5501e1);_0x385c5c(_0x2c420e[_0x8132('0x13')](0x1f4,_0x316bdc['message']));});});}; \ No newline at end of file +var _0xf0ea=['./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x205034,_0x374ce6){var _0x31bebb=function(_0x3869c9){while(--_0x3869c9){_0x205034['push'](_0x205034['shift']());}};_0x31bebb(++_0x374ce6);}(_0xf0ea,0x143));var _0xaf0e=function(_0x3af7b2,_0x5728ee){_0x3af7b2=_0x3af7b2-0x0;var _0x4bf040=_0xf0ea[_0x3af7b2];return _0x4bf040;};'use strict';var _=require(_0xaf0e('0x0'));var util=require('util');var moment=require(_0xaf0e('0x1'));var BPromise=require('bluebird');var rs=require(_0xaf0e('0x2'));var fs=require('fs');var Redis=require(_0xaf0e('0x3'));var db=require(_0xaf0e('0x4'))['db'];var utils=require(_0xaf0e('0x5'));var logger=require('../../config/logger')(_0xaf0e('0x6'));var config=require('../../config/environment');var jayson=require(_0xaf0e('0x7'));var client=jayson['client'][_0xaf0e('0x8')]({'port':0x232a});config['redis']=_[_0xaf0e('0x9')](config[_0xaf0e('0xa')],{'host':_0xaf0e('0xb'),'port':0x18eb});var socket=require(_0xaf0e('0xc'))(new Redis(config['redis']));require(_0xaf0e('0xd'))[_0xaf0e('0xe')](socket);function respondWithRpcPromise(_0x1382d0,_0x2c49da,_0x1e7907){return new BPromise(function(_0x28eed3,_0x32e8ee){return client['request'](_0x1382d0,_0x1e7907)[_0xaf0e('0xf')](function(_0x7cb866){logger[_0xaf0e('0x10')](_0xaf0e('0x11'),_0x2c49da,_0xaf0e('0x12'));logger['debug'](_0xaf0e('0x13'),_0x2c49da,_0xaf0e('0x12'),JSON[_0xaf0e('0x14')](_0x7cb866));if(_0x7cb866[_0xaf0e('0x15')]){if(_0x7cb866[_0xaf0e('0x15')]['code']===0x1f4){logger[_0xaf0e('0x15')](_0xaf0e('0x11'),_0x2c49da,_0x7cb866[_0xaf0e('0x15')]['message']);return _0x32e8ee(_0x7cb866['error'][_0xaf0e('0x16')]);}logger[_0xaf0e('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x2c49da,_0x7cb866['error'][_0xaf0e('0x16')]);return _0x28eed3(_0x7cb866['error']['message']);}else{logger[_0xaf0e('0x10')](_0xaf0e('0x11'),_0x2c49da,_0xaf0e('0x12'));_0x28eed3(_0x7cb866[_0xaf0e('0x17')][_0xaf0e('0x16')]);}})[_0xaf0e('0x18')](function(_0x4a2050){logger[_0xaf0e('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x2c49da,_0x4a2050);_0x32e8ee(_0x4a2050);});});}exports[_0xaf0e('0x19')]=function(_0xfe80e5){var _0x15055d=this;return new Promise(function(_0x40d229,_0x2cd1e8){return db[_0xaf0e('0x1a')][_0xaf0e('0x1b')]({'raw':_0xfe80e5[_0xaf0e('0x1c')]?_0xfe80e5[_0xaf0e('0x1c')][_0xaf0e('0x1d')]===undefined?!![]:![]:!![],'where':_0xfe80e5[_0xaf0e('0x1c')]?_0xfe80e5['options'][_0xaf0e('0x1e')]||null:null,'attributes':_0xfe80e5['options']?_0xfe80e5[_0xaf0e('0x1c')][_0xaf0e('0x1f')]||null:null,'limit':_0xfe80e5[_0xaf0e('0x1c')]?_0xfe80e5[_0xaf0e('0x1c')][_0xaf0e('0x20')]||null:null,'include':_0xfe80e5[_0xaf0e('0x1c')]?_0xfe80e5[_0xaf0e('0x1c')][_0xaf0e('0x21')]?_[_0xaf0e('0x22')](_0xfe80e5['options'][_0xaf0e('0x21')],function(_0x55a3a7){return{'model':db[_0x55a3a7[_0xaf0e('0x23')]],'as':_0x55a3a7['as'],'attributes':_0x55a3a7[_0xaf0e('0x1f')],'include':_0x55a3a7['include']?_['map'](_0x55a3a7[_0xaf0e('0x21')],function(_0x334fd0){return{'model':db[_0x334fd0[_0xaf0e('0x23')]],'as':_0x334fd0['as'],'attributes':_0x334fd0[_0xaf0e('0x1f')],'include':_0x334fd0['include']?_[_0xaf0e('0x22')](_0x334fd0[_0xaf0e('0x21')],function(_0x25599d){return{'model':db[_0x25599d['model']],'as':_0x25599d['as'],'attributes':_0x25599d[_0xaf0e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaf0e('0xf')](function(_0x4239cf){logger[_0xaf0e('0x10')](_0xaf0e('0x19'),_0xfe80e5);logger[_0xaf0e('0x24')](_0xaf0e('0x19'),_0xfe80e5,JSON[_0xaf0e('0x14')](_0x4239cf));_0x40d229(_0x4239cf);})[_0xaf0e('0x18')](function(_0x30234b){logger[_0xaf0e('0x15')](_0xaf0e('0x19'),_0x30234b[_0xaf0e('0x16')],_0xfe80e5);_0x2cd1e8(_0x15055d[_0xaf0e('0x15')](0x1f4,_0x30234b[_0xaf0e('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0xcb43e6){var _0x4a79cf=this;return new Promise(function(_0x273388,_0x222f22){return db[_0xaf0e('0x1a')][_0xaf0e('0x25')](_0xcb43e6[_0xaf0e('0x26')],{'raw':_0xcb43e6[_0xaf0e('0x1c')]?_0xcb43e6[_0xaf0e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xaf0e('0xf')](function(_0x15d167){logger[_0xaf0e('0x10')](_0xaf0e('0x27'),_0xcb43e6);logger['debug']('CreateVoiceQueueReport',_0xcb43e6,JSON[_0xaf0e('0x14')](_0x15d167));_0x273388(_0x15d167);})['catch'](function(_0x161bd7){logger[_0xaf0e('0x15')]('CreateVoiceQueueReport',_0x161bd7[_0xaf0e('0x16')],_0xcb43e6);_0x222f22(_0x4a79cf[_0xaf0e('0x15')](0x1f4,_0x161bd7[_0xaf0e('0x16')]));});});};exports[_0xaf0e('0x28')]=function(_0x433878){var _0x454655=this;return new Promise(function(_0x557042,_0x439761){return db[_0xaf0e('0x1a')][_0xaf0e('0x29')](_0x433878[_0xaf0e('0x26')],{'raw':_0x433878[_0xaf0e('0x1c')]?_0x433878[_0xaf0e('0x1c')][_0xaf0e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x433878[_0xaf0e('0x1c')]?_0x433878['options']['where']||null:null,'attributes':_0x433878[_0xaf0e('0x1c')]?_0x433878['options'][_0xaf0e('0x1f')]||null:null,'limit':_0x433878[_0xaf0e('0x1c')]?_0x433878[_0xaf0e('0x1c')][_0xaf0e('0x20')]||null:null})[_0xaf0e('0xf')](function(_0x4a6303){logger[_0xaf0e('0x10')](_0xaf0e('0x28'),_0x433878);logger['debug'](_0xaf0e('0x28'),_0x433878,JSON['stringify'](_0x4a6303));_0x557042(_0x4a6303);})[_0xaf0e('0x18')](function(_0x3f41fa){logger[_0xaf0e('0x15')](_0xaf0e('0x28'),_0x3f41fa['message'],_0x433878);_0x439761(_0x454655['error'](0x1f4,_0x3f41fa[_0xaf0e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index cf6a0b5..496eeac 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 _0xe1dc=['remove','update','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x16406c,_0x65184){var _0x3162bd=function(_0x1e80a0){while(--_0x1e80a0){_0x16406c['push'](_0x16406c['shift']());}};_0x3162bd(++_0x65184);}(_0xe1dc,0x8a));var _0xce1d=function(_0x536e4a,_0x78dc6c){_0x536e4a=_0x536e4a-0x0;var _0x1c3344=_0xe1dc[_0x536e4a];return _0x1c3344;};'use strict';var VoiceQueueReportEvents=require(_0xce1d('0x0'));var events=[_0xce1d('0x1'),_0xce1d('0x2'),_0xce1d('0x3')];function createListener(_0xe03a5b,_0x353517){return function(_0x341b17){_0x353517['emit'](_0xe03a5b,_0x341b17);};}function removeListener(_0xcc6bdf,_0x509109){return function(){VoiceQueueReportEvents['removeListener'](_0xcc6bdf,_0x509109);};}exports[_0xce1d('0x4')]=function(_0x232005){for(var _0x2782b7=0x0,_0x110cc2=events[_0xce1d('0x5')];_0x2782b7<_0x110cc2;_0x2782b7++){var _0x62d18b=events[_0x2782b7];var _0x4b9a85=createListener(_0xce1d('0x6')+_0x62d18b,_0x232005);VoiceQueueReportEvents['on'](_0x62d18b,_0x4b9a85);}}; \ No newline at end of file +var _0xfaec=['remove','emit','removeListener','./voiceQueueReport.events','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfaec,0x12f));var _0xcfae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfaec[_0x2dafbe];return _0x58a45a;};'use strict';var VoiceQueueReportEvents=require(_0xcfae('0x0'));var events=[_0xcfae('0x1'),_0xcfae('0x2'),'update'];function createListener(_0x4be32b,_0x4fdf31){return function(_0x2e1ad6){_0x4fdf31[_0xcfae('0x3')](_0x4be32b,_0x2e1ad6);};}function removeListener(_0xa45aee,_0x3035db){return function(){VoiceQueueReportEvents[_0xcfae('0x4')](_0xa45aee,_0x3035db);};}exports['register']=function(_0x5dcf1e){for(var _0x31e193=0x0,_0x4597ff=events['length'];_0x31e193<_0x4597ff;_0x31e193++){var _0x3a2df6=events[_0x31e193];var _0xc4c26b=createListener('voiceQueueReport:'+_0x3a2df6,_0x5dcf1e);VoiceQueueReportEvents['on'](_0x3a2df6,_0xc4c26b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e6afa2a..27ba637 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 _0x6666=['fs-extra','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer','Router'];(function(_0x31dcf2,_0x114ccb){var _0x35b86c=function(_0x4a9d33){while(--_0x4a9d33){_0x31dcf2['push'](_0x31dcf2['shift']());}};_0x35b86c(++_0x114ccb);}(_0x6666,0x6e));var _0x6666=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0x6666[_0x15a634];return _0xf4f7a0;};'use strict';var multer=require(_0x6666('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6666('0x1')]();var fs_extra=require(_0x6666('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6666('0x3'));var controller=require(_0x6666('0x4'));router[_0x6666('0x5')]('/',auth[_0x6666('0x6')](),controller[_0x6666('0x7')]);router[_0x6666('0x5')](_0x6666('0x8'),auth[_0x6666('0x6')](),controller[_0x6666('0x9')]);router['post']('/',auth[_0x6666('0x6')](),controller[_0x6666('0xa')]);router[_0x6666('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6666('0xc')]);router['delete'](_0x6666('0x8'),auth['isAuthenticated'](),controller[_0x6666('0xd')]);module['exports']=router; \ No newline at end of file +var _0x493b=['index','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','get'];(function(_0x32f519,_0x44748f){var _0x1488a2=function(_0x26926c){while(--_0x26926c){_0x32f519['push'](_0x32f519['shift']());}};_0x1488a2(++_0x44748f);}(_0x493b,0x1b9));var _0xb493=function(_0x138841,_0xc4ca7f){_0x138841=_0x138841-0x0;var _0x39f544=_0x493b[_0x138841];return _0x39f544;};'use strict';var multer=require(_0xb493('0x0'));var util=require('util');var path=require(_0xb493('0x1'));var timeout=require(_0xb493('0x2'));var express=require('express');var router=express[_0xb493('0x3')]();var fs_extra=require(_0xb493('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb493('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0xb493('0x6')]('/',auth['isAuthenticated'](),controller[_0xb493('0x7')]);router[_0xb493('0x6')](_0xb493('0x8'),auth['isAuthenticated'](),controller[_0xb493('0x9')]);router['post']('/',auth[_0xb493('0xa')](),controller['create']);router[_0xb493('0xb')](_0xb493('0x8'),auth[_0xb493('0xa')](),controller[_0xb493('0xc')]);router[_0xb493('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb493('0xe')]);module[_0xb493('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index f392e27..97e7bc6 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 _0xc734=['sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4d1ce8,_0x1a778e){var _0x129384=function(_0x15e43b){while(--_0x15e43b){_0x4d1ce8['push'](_0x4d1ce8['shift']());}};_0x129384(++_0x1a778e);}(_0xc734,0x108));var _0x4c73=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xc734[_0x37a79c];return _0x561d89;};'use strict';var Sequelize=require(_0x4c73('0x0'));var moment=require(_0x4c73('0x1'));module[_0x4c73('0x2')]={'time':{'type':Sequelize[_0x4c73('0x3')]},'callid':{'type':Sequelize[_0x4c73('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4c73('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4c73('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4c73('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4c73('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4c73('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4c73('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4c73('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4c73('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x4c73('0x5'))}}; \ No newline at end of file +var _0x89a1=['moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x31e1c6,_0x22883d){var _0x3298c4=function(_0x52c13e){while(--_0x52c13e){_0x31e1c6['push'](_0x31e1c6['shift']());}};_0x3298c4(++_0x22883d);}(_0x89a1,0x1db));var _0x189a=function(_0x52d4c8,_0x172769){_0x52d4c8=_0x52d4c8-0x0;var _0xdc428b=_0x89a1[_0x52d4c8];return _0xdc428b;};'use strict';var Sequelize=require(_0x189a('0x0'));var moment=require(_0x189a('0x1'));module[_0x189a('0x2')]={'time':{'type':Sequelize[_0x189a('0x3')]},'callid':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x189a('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x189a('0x4')],'allowNull':![],'defaultValue':moment()[_0x189a('0x5')](_0x189a('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e66f8ac..9018427 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 _0x90ab=['../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','VoiceQueuesLog','findAll','rows','catch','params','rawAttributes','create','body','find','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x90ab,0x1e9));var _0xb90a=function(_0x2e7577,_0xee78c1){_0x2e7577=_0x2e7577-0x0;var _0x364cf3=_0x90ab[_0x2e7577];return _0x364cf3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb90a('0x0'));var jsonpatch=require(_0xb90a('0x1'));var rp=require(_0xb90a('0x2'));var moment=require(_0xb90a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb90a('0x4'));var util=require('util');var path=require(_0xb90a('0x5'));var sox=require(_0xb90a('0x6'));var csv=require('to-csv');var ejs=require(_0xb90a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb90a('0x8'));var squel=require(_0xb90a('0x9'));var crypto=require('crypto');var jsforce=require(_0xb90a('0xa'));var deskjs=require(_0xb90a('0xb'));var toCsv=require(_0xb90a('0xc'));var querystring=require(_0xb90a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb90a('0xe'));var authService=require(_0xb90a('0xf'));var qs=require(_0xb90a('0x10'));var as=require(_0xb90a('0x11'));var hardwareService=require(_0xb90a('0x12'));var logger=require('../../config/logger')(_0xb90a('0x13'));var utils=require('../../config/utils');var config=require(_0xb90a('0x14'));var licenseUtil=require(_0xb90a('0x15'));var db=require(_0xb90a('0x16'))['db'];function respondWithStatusCode(_0x4b2dba,_0x5250a5){_0x5250a5=_0x5250a5||0xcc;return function(_0x32ca9e){if(_0x32ca9e){return _0x4b2dba[_0xb90a('0x17')](_0x5250a5);}return _0x4b2dba[_0xb90a('0x18')](_0x5250a5)[_0xb90a('0x19')]();};}function respondWithResult(_0x58015c,_0x44c21b){_0x44c21b=_0x44c21b||0xc8;return function(_0x4b0fe9){if(_0x4b0fe9){return _0x58015c['status'](_0x44c21b)['json'](_0x4b0fe9);}};}function respondWithFilteredResult(_0x333e6f,_0x454a3a){return function(_0xe834a6){if(_0xe834a6){var _0xc93ae5=typeof _0x454a3a['offset']===_0xb90a('0x1a')&&typeof _0x454a3a['limit']==='undefined';var _0x5bdeb0=_0xe834a6[_0xb90a('0x1b')];var _0x202707=_0xc93ae5?0x0:_0x454a3a[_0xb90a('0x1c')];var _0x2c15ec=_0xc93ae5?_0xe834a6[_0xb90a('0x1b')]:_0x454a3a[_0xb90a('0x1c')]+_0x454a3a[_0xb90a('0x1d')];var _0x55c4c0;if(_0x2c15ec>=_0x5bdeb0){_0x2c15ec=_0x5bdeb0;_0x55c4c0=0xc8;}else{_0x55c4c0=0xce;}_0x333e6f[_0xb90a('0x18')](_0x55c4c0);return _0x333e6f[_0xb90a('0x1e')](_0xb90a('0x1f'),_0x202707+'-'+_0x2c15ec+'/'+_0x5bdeb0)[_0xb90a('0x20')](_0xe834a6);}return null;};}function patchUpdates(_0xffcb5b){return function(_0x44f89e){try{jsonpatch[_0xb90a('0x21')](_0x44f89e,_0xffcb5b,!![]);}catch(_0x2b0230){return BPromise[_0xb90a('0x22')](_0x2b0230);}return _0x44f89e[_0xb90a('0x23')]();};}function saveUpdates(_0x833c3d,_0x1a9012){return function(_0xbee8fe){if(_0xbee8fe){return _0xbee8fe[_0xb90a('0x24')](_0x833c3d)[_0xb90a('0x25')](function(_0x58f07b){return _0x58f07b;});}return null;};}function removeEntity(_0x2574fa,_0x4f999b){return function(_0x359beb){if(_0x359beb){return _0x359beb[_0xb90a('0x26')]()[_0xb90a('0x25')](function(){_0x2574fa[_0xb90a('0x18')](0xcc)[_0xb90a('0x19')]();});}};}function handleEntityNotFound(_0x41af64,_0x346f24){return function(_0xed8aa3){if(!_0xed8aa3){_0x41af64['sendStatus'](0x194);}return _0xed8aa3;};}function handleError(_0x20a21d,_0x1abce0){_0x1abce0=_0x1abce0||0x1f4;return function(_0x373374){logger['error'](_0x373374[_0xb90a('0x27')]);if(_0x373374[_0xb90a('0x28')]){delete _0x373374['name'];}_0x20a21d[_0xb90a('0x18')](_0x1abce0)[_0xb90a('0x29')](_0x373374);};}exports[_0xb90a('0x2a')]=function(_0x596934,_0x3275af){var _0x5c598a={},_0xa1bec1={},_0x4b9dc0={'count':0x0,'rows':[]};var _0x48091e=_[_0xb90a('0x2b')](db['VoiceQueuesLog']['rawAttributes'],function(_0x3aacc9){return{'name':_0x3aacc9[_0xb90a('0x2c')],'type':_0x3aacc9[_0xb90a('0x2d')][_0xb90a('0x2e')]};});_0xa1bec1[_0xb90a('0x2f')]=_[_0xb90a('0x2b')](_0x48091e,_0xb90a('0x28'));_0xa1bec1[_0xb90a('0x30')]=_[_0xb90a('0x31')](_0x596934[_0xb90a('0x30')]);_0xa1bec1[_0xb90a('0x32')]=_['intersection'](_0xa1bec1[_0xb90a('0x2f')],_0xa1bec1[_0xb90a('0x30')]);_0x5c598a['attributes']=_[_0xb90a('0x33')](_0xa1bec1[_0xb90a('0x2f')],qs[_0xb90a('0x34')](_0x596934[_0xb90a('0x30')][_0xb90a('0x34')]));_0x5c598a['attributes']=_0x5c598a[_0xb90a('0x35')][_0xb90a('0x36')]?_0x5c598a[_0xb90a('0x35')]:_0xa1bec1[_0xb90a('0x2f')];if(!_0x596934['query'][_0xb90a('0x37')]('nolimit')){_0x5c598a[_0xb90a('0x1d')]=qs[_0xb90a('0x1d')](_0x596934[_0xb90a('0x30')][_0xb90a('0x1d')]);_0x5c598a['offset']=qs[_0xb90a('0x1c')](_0x596934['query']['offset']);}_0x5c598a[_0xb90a('0x38')]=qs['sort'](_0x596934[_0xb90a('0x30')]['sort']);_0x5c598a[_0xb90a('0x39')]=qs[_0xb90a('0x32')](_[_0xb90a('0x3a')](_0x596934['query'],_0xa1bec1[_0xb90a('0x32')]),_0x48091e);if(_0x596934['query'][_0xb90a('0x3b')]){_0x5c598a[_0xb90a('0x39')]=_[_0xb90a('0x3c')](_0x5c598a[_0xb90a('0x39')],{'$or':_[_0xb90a('0x2b')](_0x48091e,function(_0x13b509){if(_0x13b509[_0xb90a('0x2d')]!=='VIRTUAL'){var _0x4b9780={};_0x4b9780[_0x13b509[_0xb90a('0x28')]]={'$like':'%'+_0x596934['query']['filter']+'%'};return _0x4b9780;}})});}_0x5c598a=_['merge']({},_0x5c598a,_0x596934[_0xb90a('0x3d')]);var _0x3cb3f8={'where':_0x5c598a['where']};return db['VoiceQueuesLog'][_0xb90a('0x1b')](_0x3cb3f8)[_0xb90a('0x25')](function(_0x37b8c5){_0x4b9dc0['count']=_0x37b8c5;if(_0x596934[_0xb90a('0x30')][_0xb90a('0x3e')]){_0x5c598a[_0xb90a('0x3f')]=[{'all':!![]}];}return db[_0xb90a('0x40')][_0xb90a('0x41')](_0x5c598a);})[_0xb90a('0x25')](function(_0x21ace9){_0x4b9dc0[_0xb90a('0x42')]=_0x21ace9;return _0x4b9dc0;})['then'](respondWithFilteredResult(_0x3275af,_0x5c598a))[_0xb90a('0x43')](handleError(_0x3275af,null));};exports['show']=function(_0x5ac59e,_0x559e25){var _0x26c2af={'raw':!![],'where':{'id':_0x5ac59e[_0xb90a('0x44')]['id']}},_0x38589e={};_0x38589e[_0xb90a('0x2f')]=_[_0xb90a('0x31')](db[_0xb90a('0x40')][_0xb90a('0x45')]);_0x38589e[_0xb90a('0x30')]=_[_0xb90a('0x31')](_0x5ac59e['query']);_0x38589e[_0xb90a('0x32')]=_[_0xb90a('0x33')](_0x38589e[_0xb90a('0x2f')],_0x38589e[_0xb90a('0x30')]);_0x26c2af[_0xb90a('0x35')]=_[_0xb90a('0x33')](_0x38589e[_0xb90a('0x2f')],qs[_0xb90a('0x34')](_0x5ac59e['query']['fields']));_0x26c2af['attributes']=_0x26c2af[_0xb90a('0x35')][_0xb90a('0x36')]?_0x26c2af[_0xb90a('0x35')]:_0x38589e[_0xb90a('0x2f')];if(_0x5ac59e[_0xb90a('0x30')][_0xb90a('0x3e')]){_0x26c2af[_0xb90a('0x3f')]=[{'all':!![]}];}_0x26c2af=_[_0xb90a('0x3c')]({},_0x26c2af,_0x5ac59e['options']);return db[_0xb90a('0x40')]['find'](_0x26c2af)[_0xb90a('0x25')](handleEntityNotFound(_0x559e25,null))[_0xb90a('0x25')](respondWithResult(_0x559e25,null))[_0xb90a('0x43')](handleError(_0x559e25,null));};exports[_0xb90a('0x46')]=function(_0x366e4f,_0x37c3a0){return db['VoiceQueuesLog'][_0xb90a('0x46')](_0x366e4f[_0xb90a('0x47')],{})[_0xb90a('0x25')](respondWithResult(_0x37c3a0,0xc9))['catch'](handleError(_0x37c3a0,null));};exports[_0xb90a('0x24')]=function(_0xfad118,_0xfed90a){if(_0xfad118[_0xb90a('0x47')]['id']){delete _0xfad118['body']['id'];}return db['VoiceQueuesLog'][_0xb90a('0x48')]({'where':{'id':_0xfad118[_0xb90a('0x44')]['id']}})[_0xb90a('0x25')](handleEntityNotFound(_0xfed90a,null))[_0xb90a('0x25')](saveUpdates(_0xfad118['body'],null))[_0xb90a('0x25')](respondWithResult(_0xfed90a,null))['catch'](handleError(_0xfed90a,null));};exports[_0xb90a('0x26')]=function(_0xfbab31,_0x30dd9b){return db[_0xb90a('0x40')][_0xb90a('0x48')]({'where':{'id':_0xfbab31[_0xb90a('0x44')]['id']}})['then'](handleEntityNotFound(_0x30dd9b,null))['then'](removeEntity(_0x30dd9b,null))[_0xb90a('0x43')](handleError(_0x30dd9b,null));}; \ No newline at end of file +var _0xd0ab=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','merge','options','includeAll','include','rows','catch','params','find','create','body','rimraf','zip-dir'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xd0ab,0xd0));var _0xbd0a=function(_0x3a3e48,_0x485a65){_0x3a3e48=_0x3a3e48-0x0;var _0x4b327d=_0xd0ab[_0x3a3e48];return _0x4b327d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd0a('0x0'));var zipdir=require(_0xbd0a('0x1'));var jsonpatch=require(_0xbd0a('0x2'));var rp=require(_0xbd0a('0x3'));var moment=require(_0xbd0a('0x4'));var BPromise=require(_0xbd0a('0x5'));var Mustache=require(_0xbd0a('0x6'));var util=require(_0xbd0a('0x7'));var path=require(_0xbd0a('0x8'));var sox=require('sox');var csv=require(_0xbd0a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbd0a('0xa'));var crypto=require(_0xbd0a('0xb'));var jsforce=require(_0xbd0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbd0a('0x9'));var querystring=require(_0xbd0a('0xd'));var Papa=require(_0xbd0a('0xe'));var Redis=require(_0xbd0a('0xf'));var authService=require(_0xbd0a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd0a('0x11'));var logger=require(_0xbd0a('0x12'))(_0xbd0a('0x13'));var utils=require(_0xbd0a('0x14'));var config=require(_0xbd0a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd0a('0x16'))['db'];function respondWithStatusCode(_0x3ad298,_0x11e327){_0x11e327=_0x11e327||0xcc;return function(_0x42cd3c){if(_0x42cd3c){return _0x3ad298[_0xbd0a('0x17')](_0x11e327);}return _0x3ad298[_0xbd0a('0x18')](_0x11e327)[_0xbd0a('0x19')]();};}function respondWithResult(_0x360bfb,_0xb00337){_0xb00337=_0xb00337||0xc8;return function(_0x1db2e0){if(_0x1db2e0){return _0x360bfb['status'](_0xb00337)[_0xbd0a('0x1a')](_0x1db2e0);}};}function respondWithFilteredResult(_0x5c0cb0,_0x5b6d20){return function(_0x9e1fa0){if(_0x9e1fa0){var _0x2b6126=typeof _0x5b6d20[_0xbd0a('0x1b')]===_0xbd0a('0x1c')&&typeof _0x5b6d20[_0xbd0a('0x1d')]===_0xbd0a('0x1c');var _0x242a5a=_0x9e1fa0['count'];var _0x17b10f=_0x2b6126?0x0:_0x5b6d20[_0xbd0a('0x1b')];var _0x5d562d=_0x2b6126?_0x9e1fa0[_0xbd0a('0x1e')]:_0x5b6d20[_0xbd0a('0x1b')]+_0x5b6d20[_0xbd0a('0x1d')];var _0xecabc8;if(_0x5d562d>=_0x242a5a){_0x5d562d=_0x242a5a;_0xecabc8=0xc8;}else{_0xecabc8=0xce;}_0x5c0cb0[_0xbd0a('0x18')](_0xecabc8);return _0x5c0cb0[_0xbd0a('0x1f')](_0xbd0a('0x20'),_0x17b10f+'-'+_0x5d562d+'/'+_0x242a5a)['json'](_0x9e1fa0);}return null;};}function patchUpdates(_0x3677c2){return function(_0x1a7400){try{jsonpatch[_0xbd0a('0x21')](_0x1a7400,_0x3677c2,!![]);}catch(_0x37b4ca){return BPromise[_0xbd0a('0x22')](_0x37b4ca);}return _0x1a7400['save']();};}function saveUpdates(_0x3dedd1,_0x26d9a3){return function(_0x28f4f1){if(_0x28f4f1){return _0x28f4f1[_0xbd0a('0x23')](_0x3dedd1)[_0xbd0a('0x24')](function(_0x4a2723){return _0x4a2723;});}return null;};}function removeEntity(_0x2977cd,_0xb289b1){return function(_0x123b1f){if(_0x123b1f){return _0x123b1f[_0xbd0a('0x25')]()[_0xbd0a('0x24')](function(){_0x2977cd[_0xbd0a('0x18')](0xcc)[_0xbd0a('0x19')]();});}};}function handleEntityNotFound(_0x3efa15,_0x3ad92c){return function(_0x42a2e3){if(!_0x42a2e3){_0x3efa15[_0xbd0a('0x17')](0x194);}return _0x42a2e3;};}function handleError(_0x6edb53,_0x4e9bf1){_0x4e9bf1=_0x4e9bf1||0x1f4;return function(_0x3b30e2){logger[_0xbd0a('0x26')](_0x3b30e2[_0xbd0a('0x27')]);if(_0x3b30e2[_0xbd0a('0x28')]){delete _0x3b30e2[_0xbd0a('0x28')];}_0x6edb53[_0xbd0a('0x18')](_0x4e9bf1)[_0xbd0a('0x29')](_0x3b30e2);};}exports[_0xbd0a('0x2a')]=function(_0x239121,_0x1285b2){var _0x438ef3={},_0x29acf9={},_0x495427={'count':0x0,'rows':[]};var _0x2d9e10=_[_0xbd0a('0x2b')](db[_0xbd0a('0x2c')][_0xbd0a('0x2d')],function(_0xe02d05){return{'name':_0xe02d05[_0xbd0a('0x2e')],'type':_0xe02d05[_0xbd0a('0x2f')]['key']};});_0x29acf9[_0xbd0a('0x30')]=_[_0xbd0a('0x2b')](_0x2d9e10,'name');_0x29acf9[_0xbd0a('0x31')]=_[_0xbd0a('0x32')](_0x239121['query']);_0x29acf9[_0xbd0a('0x33')]=_['intersection'](_0x29acf9[_0xbd0a('0x30')],_0x29acf9[_0xbd0a('0x31')]);_0x438ef3[_0xbd0a('0x34')]=_[_0xbd0a('0x35')](_0x29acf9[_0xbd0a('0x30')],qs['fields'](_0x239121[_0xbd0a('0x31')][_0xbd0a('0x36')]));_0x438ef3[_0xbd0a('0x34')]=_0x438ef3[_0xbd0a('0x34')][_0xbd0a('0x37')]?_0x438ef3[_0xbd0a('0x34')]:_0x29acf9[_0xbd0a('0x30')];if(!_0x239121[_0xbd0a('0x31')][_0xbd0a('0x38')]('nolimit')){_0x438ef3[_0xbd0a('0x1d')]=qs['limit'](_0x239121[_0xbd0a('0x31')][_0xbd0a('0x1d')]);_0x438ef3[_0xbd0a('0x1b')]=qs[_0xbd0a('0x1b')](_0x239121[_0xbd0a('0x31')][_0xbd0a('0x1b')]);}_0x438ef3[_0xbd0a('0x39')]=qs['sort'](_0x239121['query']['sort']);_0x438ef3[_0xbd0a('0x3a')]=qs['filters'](_[_0xbd0a('0x3b')](_0x239121[_0xbd0a('0x31')],_0x29acf9[_0xbd0a('0x33')]),_0x2d9e10);if(_0x239121[_0xbd0a('0x31')]['filter']){_0x438ef3[_0xbd0a('0x3a')]=_[_0xbd0a('0x3c')](_0x438ef3[_0xbd0a('0x3a')],{'$or':_[_0xbd0a('0x2b')](_0x2d9e10,function(_0x3ef9c1){if(_0x3ef9c1[_0xbd0a('0x2f')]!=='VIRTUAL'){var _0x2e92d0={};_0x2e92d0[_0x3ef9c1[_0xbd0a('0x28')]]={'$like':'%'+_0x239121[_0xbd0a('0x31')]['filter']+'%'};return _0x2e92d0;}})});}_0x438ef3=_[_0xbd0a('0x3c')]({},_0x438ef3,_0x239121[_0xbd0a('0x3d')]);var _0x2b2424={'where':_0x438ef3[_0xbd0a('0x3a')]};return db[_0xbd0a('0x2c')][_0xbd0a('0x1e')](_0x2b2424)['then'](function(_0x4a2c45){_0x495427[_0xbd0a('0x1e')]=_0x4a2c45;if(_0x239121[_0xbd0a('0x31')][_0xbd0a('0x3e')]){_0x438ef3[_0xbd0a('0x3f')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x438ef3);})[_0xbd0a('0x24')](function(_0x3ac693){_0x495427[_0xbd0a('0x40')]=_0x3ac693;return _0x495427;})[_0xbd0a('0x24')](respondWithFilteredResult(_0x1285b2,_0x438ef3))[_0xbd0a('0x41')](handleError(_0x1285b2,null));};exports['show']=function(_0x17a824,_0x1cd910){var _0xc31240={'raw':!![],'where':{'id':_0x17a824[_0xbd0a('0x42')]['id']}},_0x2bf5dd={};_0x2bf5dd[_0xbd0a('0x30')]=_[_0xbd0a('0x32')](db['VoiceQueuesLog'][_0xbd0a('0x2d')]);_0x2bf5dd[_0xbd0a('0x31')]=_[_0xbd0a('0x32')](_0x17a824[_0xbd0a('0x31')]);_0x2bf5dd[_0xbd0a('0x33')]=_[_0xbd0a('0x35')](_0x2bf5dd[_0xbd0a('0x30')],_0x2bf5dd[_0xbd0a('0x31')]);_0xc31240[_0xbd0a('0x34')]=_[_0xbd0a('0x35')](_0x2bf5dd[_0xbd0a('0x30')],qs[_0xbd0a('0x36')](_0x17a824[_0xbd0a('0x31')][_0xbd0a('0x36')]));_0xc31240[_0xbd0a('0x34')]=_0xc31240[_0xbd0a('0x34')][_0xbd0a('0x37')]?_0xc31240[_0xbd0a('0x34')]:_0x2bf5dd[_0xbd0a('0x30')];if(_0x17a824['query'][_0xbd0a('0x3e')]){_0xc31240[_0xbd0a('0x3f')]=[{'all':!![]}];}_0xc31240=_[_0xbd0a('0x3c')]({},_0xc31240,_0x17a824[_0xbd0a('0x3d')]);return db[_0xbd0a('0x2c')][_0xbd0a('0x43')](_0xc31240)[_0xbd0a('0x24')](handleEntityNotFound(_0x1cd910,null))[_0xbd0a('0x24')](respondWithResult(_0x1cd910,null))[_0xbd0a('0x41')](handleError(_0x1cd910,null));};exports['create']=function(_0x612b99,_0xe96a9d){return db[_0xbd0a('0x2c')][_0xbd0a('0x44')](_0x612b99[_0xbd0a('0x45')],{})['then'](respondWithResult(_0xe96a9d,0xc9))[_0xbd0a('0x41')](handleError(_0xe96a9d,null));};exports['update']=function(_0x15ac99,_0x5249d7){if(_0x15ac99[_0xbd0a('0x45')]['id']){delete _0x15ac99[_0xbd0a('0x45')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x15ac99[_0xbd0a('0x42')]['id']}})[_0xbd0a('0x24')](handleEntityNotFound(_0x5249d7,null))['then'](saveUpdates(_0x15ac99[_0xbd0a('0x45')],null))[_0xbd0a('0x24')](respondWithResult(_0x5249d7,null))[_0xbd0a('0x41')](handleError(_0x5249d7,null));};exports['destroy']=function(_0x510577,_0x22ccfd){return db[_0xbd0a('0x2c')][_0xbd0a('0x43')]({'where':{'id':_0x510577[_0xbd0a('0x42')]['id']}})[_0xbd0a('0x24')](handleEntityNotFound(_0x22ccfd,null))['then'](removeEntity(_0x22ccfd,null))[_0xbd0a('0x41')](handleError(_0x22ccfd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index fac25be..e5dc801 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 _0x5718=['define','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x574ef6,_0x4cf4ab){var _0x5dc934=function(_0x3498b2){while(--_0x3498b2){_0x574ef6['push'](_0x574ef6['shift']());}};_0x5dc934(++_0x4cf4ab);}(_0x5718,0xb9));var _0x8571=function(_0x1b534c,_0x2fe090){_0x1b534c=_0x1b534c-0x0;var _0x5db369=_0x5718[_0x1b534c];return _0x5db369;};'use strict';var _=require(_0x8571('0x0'));var util=require(_0x8571('0x1'));var logger=require(_0x8571('0x2'))(_0x8571('0x3'));var moment=require(_0x8571('0x4'));var BPromise=require(_0x8571('0x5'));var rp=require(_0x8571('0x6'));var fs=require('fs');var path=require(_0x8571('0x7'));var rimraf=require(_0x8571('0x8'));var config=require(_0x8571('0x9'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x5ee879,_0x1f1b51){return _0x5ee879[_0x8571('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x8571('0xb'),'paranoid':![],'indexes':[{'name':_0x8571('0xc'),'fields':[_0x8571('0xd'),_0x8571('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x18e4=['VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x220b6d,_0x3691e4){var _0xaf17c9=function(_0x57b9fd){while(--_0x57b9fd){_0x220b6d['push'](_0x220b6d['shift']());}};_0xaf17c9(++_0x3691e4);}(_0x18e4,0xb4));var _0x418e=function(_0x61fd3a,_0x15a094){_0x61fd3a=_0x61fd3a-0x0;var _0x546d6b=_0x18e4[_0x61fd3a];return _0x546d6b;};'use strict';var _=require(_0x418e('0x0'));var util=require(_0x418e('0x1'));var logger=require(_0x418e('0x2'))(_0x418e('0x3'));var moment=require(_0x418e('0x4'));var BPromise=require(_0x418e('0x5'));var rp=require(_0x418e('0x6'));var fs=require('fs');var path=require(_0x418e('0x7'));var rimraf=require(_0x418e('0x8'));var config=require(_0x418e('0x9'));var attributes=require(_0x418e('0xa'));module[_0x418e('0xb')]=function(_0xcbbd5b,_0xaf0e88){return _0xcbbd5b['define'](_0x418e('0xc'),attributes,{'tableName':_0x418e('0xd'),'paranoid':![],'indexes':[{'name':_0x418e('0xe'),'fields':[_0x418e('0xf'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 36fc98f..b8af99e 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 _0x43b7=['info','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x305183,_0x4a7431){var _0x23caab=function(_0x1a08dc){while(--_0x1a08dc){_0x305183['push'](_0x305183['shift']());}};_0x23caab(++_0x4a7431);}(_0x43b7,0x183));var _0x743b=function(_0x2b9ddc,_0x15ac0f){_0x2b9ddc=_0x2b9ddc-0x0;var _0x34f382=_0x43b7[_0x2b9ddc];return _0x34f382;};'use strict';var _=require(_0x743b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x743b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x743b('0x2'));var db=require(_0x743b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x743b('0x4'));var config=require(_0x743b('0x5'));var jayson=require(_0x743b('0x6'));var client=jayson[_0x743b('0x7')][_0x743b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b25ec,_0x2560ad,_0x515ed3){return new BPromise(function(_0x542c29,_0x5c3a06){return client['request'](_0x1b25ec,_0x515ed3)['then'](function(_0xfb58b2){logger[_0x743b('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2560ad,_0x743b('0xa'));logger['debug'](_0x743b('0xb'),_0x2560ad,_0x743b('0xa'),JSON[_0x743b('0xc')](_0xfb58b2));if(_0xfb58b2[_0x743b('0xd')]){if(_0xfb58b2[_0x743b('0xd')][_0x743b('0xe')]===0x1f4){logger[_0x743b('0xd')](_0x743b('0xf'),_0x2560ad,_0xfb58b2[_0x743b('0xd')][_0x743b('0x10')]);return _0x5c3a06(_0xfb58b2[_0x743b('0xd')]['message']);}logger[_0x743b('0xd')](_0x743b('0xf'),_0x2560ad,_0xfb58b2[_0x743b('0xd')][_0x743b('0x10')]);return _0x542c29(_0xfb58b2[_0x743b('0xd')]['message']);}else{logger[_0x743b('0x9')](_0x743b('0xf'),_0x2560ad,_0x743b('0xa'));_0x542c29(_0xfb58b2[_0x743b('0x11')]['message']);}})['catch'](function(_0x34db76){logger['error'](_0x743b('0xf'),_0x2560ad,_0x34db76);_0x5c3a06(_0x34db76);});});} \ No newline at end of file +var _0x8aa5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x40ff40,_0x426577){var _0x33e79d=function(_0xbbde19){while(--_0xbbde19){_0x40ff40['push'](_0x40ff40['shift']());}};_0x33e79d(++_0x426577);}(_0x8aa5,0x78));var _0x58aa=function(_0x4b247b,_0x464c13){_0x4b247b=_0x4b247b-0x0;var _0x41cb0a=_0x8aa5[_0x4b247b];return _0x41cb0a;};'use strict';var _=require(_0x58aa('0x0'));var util=require(_0x58aa('0x1'));var moment=require(_0x58aa('0x2'));var BPromise=require(_0x58aa('0x3'));var rs=require(_0x58aa('0x4'));var fs=require('fs');var Redis=require(_0x58aa('0x5'));var db=require(_0x58aa('0x6'))['db'];var utils=require(_0x58aa('0x7'));var logger=require(_0x58aa('0x8'))(_0x58aa('0x9'));var config=require('../../config/environment');var jayson=require(_0x58aa('0xa'));var client=jayson[_0x58aa('0xb')][_0x58aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8c5e44,_0x47d691,_0x1fd061){return new BPromise(function(_0x4a70f2,_0x7f3997){return client['request'](_0x8c5e44,_0x1fd061)[_0x58aa('0xd')](function(_0x35faad){logger[_0x58aa('0xe')](_0x58aa('0xf'),_0x47d691,_0x58aa('0x10'));logger[_0x58aa('0x11')](_0x58aa('0x12'),_0x47d691,_0x58aa('0x10'),JSON[_0x58aa('0x13')](_0x35faad));if(_0x35faad[_0x58aa('0x14')]){if(_0x35faad['error'][_0x58aa('0x15')]===0x1f4){logger['error'](_0x58aa('0xf'),_0x47d691,_0x35faad['error'][_0x58aa('0x16')]);return _0x7f3997(_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);}logger[_0x58aa('0x14')](_0x58aa('0xf'),_0x47d691,_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);return _0x4a70f2(_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);}else{logger[_0x58aa('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x47d691,_0x58aa('0x10'));_0x4a70f2(_0x35faad[_0x58aa('0x17')][_0x58aa('0x16')]);}})[_0x58aa('0x18')](function(_0x1baffc){logger[_0x58aa('0x14')](_0x58aa('0xf'),_0x47d691,_0x1baffc);_0x7f3997(_0x1baffc);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 304c382..a7c1448 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 _0xd04a=['show','/:id/download','download','/:id/downloads','/:id/transcribe','create','post','runTranscribe','put','/:id','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','describe'];(function(_0x2f20f8,_0x54a3f2){var _0xfcb1b7=function(_0xfd0c0d){while(--_0xfd0c0d){_0x2f20f8['push'](_0x2f20f8['shift']());}};_0xfcb1b7(++_0x54a3f2);}(_0xd04a,0x85));var _0xad04=function(_0x141b49,_0x249428){_0x141b49=_0x141b49-0x0;var _0xb4cd2b=_0xd04a[_0x141b49];return _0xb4cd2b;};'use strict';var multer=require(_0xad04('0x0'));var util=require(_0xad04('0x1'));var path=require(_0xad04('0x2'));var timeout=require('connect-timeout');var express=require(_0xad04('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xad04('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xad04('0x5'));var controller=require(_0xad04('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xad04('0x7')](_0xad04('0x8'),auth[_0xad04('0x9')](),controller[_0xad04('0xa')]);router[_0xad04('0x7')]('/:id',auth[_0xad04('0x9')](),controller[_0xad04('0xb')]);router[_0xad04('0x7')](_0xad04('0xc'),auth['isAuthenticated'](),controller[_0xad04('0xd')]);router[_0xad04('0x7')](_0xad04('0xe'),controller['downloads']);router['get'](_0xad04('0xf'),auth[_0xad04('0x9')](),controller['downloadTranscribe']);router['post']('/',auth[_0xad04('0x9')](),controller[_0xad04('0x10')]);router[_0xad04('0x11')](_0xad04('0xf'),auth[_0xad04('0x9')](),controller[_0xad04('0x12')]);router[_0xad04('0x13')](_0xad04('0x14'),auth[_0xad04('0x9')](),controller['update']);router[_0xad04('0x15')](_0xad04('0x14'),auth['isAuthenticated'](),controller[_0xad04('0x16')]);module[_0xad04('0x17')]=router; \ No newline at end of file +var _0x6113=['./voiceRecording.controller','get','index','/describe','describe','/:id','show','/:id/download','isAuthenticated','download','downloads','/:id/transcribe','downloadTranscribe','runTranscribe','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x47d931,_0x254590){var _0x1f7fe8=function(_0x131846){while(--_0x131846){_0x47d931['push'](_0x47d931['shift']());}};_0x1f7fe8(++_0x254590);}(_0x6113,0xa7));var _0x3611=function(_0x100573,_0x443a74){_0x100573=_0x100573-0x0;var _0x38be6a=_0x6113[_0x100573];return _0x38be6a;};'use strict';var multer=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var path=require(_0x3611('0x2'));var timeout=require(_0x3611('0x3'));var express=require(_0x3611('0x4'));var router=express['Router']();var fs_extra=require(_0x3611('0x5'));var auth=require(_0x3611('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3611('0x7'));var controller=require(_0x3611('0x8'));router[_0x3611('0x9')]('/',auth['isAuthenticated'](),controller[_0x3611('0xa')]);router[_0x3611('0x9')](_0x3611('0xb'),auth['isAuthenticated'](),controller[_0x3611('0xc')]);router[_0x3611('0x9')](_0x3611('0xd'),auth['isAuthenticated'](),controller[_0x3611('0xe')]);router['get'](_0x3611('0xf'),auth[_0x3611('0x10')](),controller[_0x3611('0x11')]);router[_0x3611('0x9')]('/:id/downloads',controller[_0x3611('0x12')]);router['get'](_0x3611('0x13'),auth[_0x3611('0x10')](),controller[_0x3611('0x14')]);router['post']('/',auth[_0x3611('0x10')](),controller['create']);router['post'](_0x3611('0x13'),auth[_0x3611('0x10')](),controller[_0x3611('0x15')]);router[_0x3611('0x16')]('/:id',auth[_0x3611('0x10')](),controller[_0x3611('0x17')]);router['delete'](_0x3611('0xd'),auth[_0x3611('0x10')](),controller[_0x3611('0x18')]);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 2f2aeff..fb75235 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(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 15984e1..74abd15 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 _0xbded=['TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','.txt','Transcript\x20not\x20available','rimraf','request-promise','util','path','sox','ejs','fs-extra','squel','desk.js','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','%s.cypher','existsSync','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName'];(function(_0x46e7f6,_0x59d4ef){var _0x5dbce7=function(_0x58bc73){while(--_0x58bc73){_0x46e7f6['push'](_0x46e7f6['shift']());}};_0x5dbce7(++_0x59d4ef);}(_0xbded,0x1e5));var _0xdbde=function(_0x34c1b5,_0x3171ab){_0x34c1b5=_0x34c1b5-0x0;var _0x1bac02=_0xbded[_0x34c1b5];return _0x1bac02;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbde('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdbde('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbde('0x2'));var path=require(_0xdbde('0x3'));var sox=require(_0xdbde('0x4'));var csv=require('to-csv');var ejs=require(_0xdbde('0x5'));var fs=require('fs');var fs_extra=require(_0xdbde('0x6'));var _=require('lodash');var squel=require(_0xdbde('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdbde('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xdbde('0x9'));var uuidv4=require(_0xdbde('0xa'));var Redis=require(_0xdbde('0xb'));var authService=require(_0xdbde('0xc'));var qs=require(_0xdbde('0xd'));var as=require(_0xdbde('0xe'));var hardwareService=require(_0xdbde('0xf'));var logger=require(_0xdbde('0x10'))(_0xdbde('0x11'));var utils=require(_0xdbde('0x12'));var config=require(_0xdbde('0x13'));var licenseUtil=require(_0xdbde('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58fe47,_0x39e638){_0x39e638=_0x39e638||0xcc;return function(_0x18dde7){if(_0x18dde7){return _0x58fe47[_0xdbde('0x15')](_0x39e638);}return _0x58fe47[_0xdbde('0x16')](_0x39e638)['end']();};}function respondWithResult(_0x21a06a,_0x24cc6d){_0x24cc6d=_0x24cc6d||0xc8;return function(_0x4b6cfb){if(_0x4b6cfb){return _0x21a06a[_0xdbde('0x16')](_0x24cc6d)[_0xdbde('0x17')](_0x4b6cfb);}};}function respondWithFilteredResult(_0x5dc592,_0x570244){return function(_0x354adb){if(_0x354adb){var _0x434bc2=typeof _0x570244[_0xdbde('0x18')]===_0xdbde('0x19')&&typeof _0x570244[_0xdbde('0x1a')]==='undefined';var _0x51d415=_0x354adb[_0xdbde('0x1b')];var _0x2a41dd=_0x434bc2?0x0:_0x570244[_0xdbde('0x18')];var _0x3c43af=_0x434bc2?_0x354adb[_0xdbde('0x1b')]:_0x570244[_0xdbde('0x18')]+_0x570244[_0xdbde('0x1a')];var _0x1146a7;if(_0x3c43af>=_0x51d415){_0x3c43af=_0x51d415;_0x1146a7=0xc8;}else{_0x1146a7=0xce;}_0x5dc592['status'](_0x1146a7);return _0x5dc592[_0xdbde('0x1c')](_0xdbde('0x1d'),_0x2a41dd+'-'+_0x3c43af+'/'+_0x51d415)['json'](_0x354adb);}return null;};}function patchUpdates(_0x3d9c73){return function(_0x464950){try{jsonpatch[_0xdbde('0x1e')](_0x464950,_0x3d9c73,!![]);}catch(_0x30bbfa){return BPromise[_0xdbde('0x1f')](_0x30bbfa);}return _0x464950[_0xdbde('0x20')]();};}function saveUpdates(_0x26d2ff,_0x2a3e2c){return function(_0x46288c){if(_0x46288c){return _0x46288c[_0xdbde('0x21')](_0x26d2ff)['then'](function(_0xddb95b){return _0xddb95b;});}return null;};}function removeEntity(_0x29b96f,_0x1d2b07){return function(_0x32768b){if(_0x32768b){return _0x32768b[_0xdbde('0x22')]()[_0xdbde('0x23')](function(){_0x29b96f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e007,_0x56ccee){return function(_0x119f00){if(!_0x119f00){_0x17e007[_0xdbde('0x15')](0x194);}return _0x119f00;};}function handleError(_0x54345e,_0x5bc5ba){_0x5bc5ba=_0x5bc5ba||0x1f4;return function(_0x5cee93){logger[_0xdbde('0x24')](_0x5cee93['stack']);if(_0x5cee93[_0xdbde('0x25')]){delete _0x5cee93[_0xdbde('0x25')];}_0x54345e[_0xdbde('0x16')](_0x5bc5ba)[_0xdbde('0x26')](_0x5cee93);};}exports[_0xdbde('0x27')]=function(_0x2faac3,_0x45983d){var _0x57ec08={},_0x536ca1={},_0x11b67d={'count':0x0,'rows':[]};var _0x1bb638=_[_0xdbde('0x28')](db[_0xdbde('0x29')][_0xdbde('0x2a')],function(_0x1f8303){return{'name':_0x1f8303[_0xdbde('0x2b')],'type':_0x1f8303[_0xdbde('0x2c')][_0xdbde('0x2d')]};});_0x536ca1['model']=_[_0xdbde('0x2e')](_['map'](_0x1bb638,_0xdbde('0x25')),[_0xdbde('0x2f')]);_0x536ca1[_0xdbde('0x30')]=_['keys'](_0x2faac3[_0xdbde('0x30')]);_0x536ca1[_0xdbde('0x31')]=_[_0xdbde('0x32')](_0x536ca1[_0xdbde('0x33')],_0x536ca1[_0xdbde('0x30')]);_0x57ec08['attributes']=_[_0xdbde('0x32')](_0x536ca1[_0xdbde('0x33')],qs['fields'](_0x2faac3[_0xdbde('0x30')][_0xdbde('0x34')]));_0x57ec08['attributes']=_0x57ec08[_0xdbde('0x35')][_0xdbde('0x36')]?_0x57ec08[_0xdbde('0x35')]:_0x536ca1[_0xdbde('0x33')];if(!_0x2faac3['query'][_0xdbde('0x37')]('nolimit')){_0x57ec08[_0xdbde('0x1a')]=qs['limit'](_0x2faac3[_0xdbde('0x30')]['limit']);_0x57ec08[_0xdbde('0x18')]=qs['offset'](_0x2faac3[_0xdbde('0x30')]['offset']);}_0x57ec08[_0xdbde('0x38')]=qs[_0xdbde('0x39')](_0x2faac3[_0xdbde('0x30')]['sort']);_0x57ec08[_0xdbde('0x3a')]=qs[_0xdbde('0x31')](_[_0xdbde('0x3b')](_0x2faac3[_0xdbde('0x30')],_0x536ca1[_0xdbde('0x31')]),_0x1bb638);if(_0x2faac3[_0xdbde('0x30')][_0xdbde('0x3c')]){_0x57ec08[_0xdbde('0x3a')]=_['merge'](_0x57ec08[_0xdbde('0x3a')],{'$or':_['map'](_0x1bb638,function(_0x36e718){if(_0x36e718[_0xdbde('0x2c')]!==_0xdbde('0x3d')){var _0x28a6bb={};_0x28a6bb[_0x36e718[_0xdbde('0x25')]]={'$like':'%'+_0x2faac3[_0xdbde('0x30')][_0xdbde('0x3c')]+'%'};return _0x28a6bb;}})});}_0x57ec08=_[_0xdbde('0x3e')]({},_0x57ec08,_0x2faac3[_0xdbde('0x3f')]);var _0xf12e2e={'where':_0x57ec08['where']};return db['VoiceRecording']['count'](_0xf12e2e)[_0xdbde('0x23')](function(_0x5e04fb){_0x11b67d['count']=_0x5e04fb;if(_0x2faac3[_0xdbde('0x30')][_0xdbde('0x40')]){_0x57ec08[_0xdbde('0x41')]=[{'all':!![]}];}return db[_0xdbde('0x29')]['findAll'](_0x57ec08);})[_0xdbde('0x23')](function(_0x17a9f4){_0x11b67d[_0xdbde('0x42')]=_0x17a9f4;return _0x11b67d;})[_0xdbde('0x23')](respondWithFilteredResult(_0x45983d,_0x57ec08))[_0xdbde('0x43')](handleError(_0x45983d,null));};exports[_0xdbde('0x44')]=function(_0x4ccac1,_0x4b88c8){var _0xb8275a={'raw':![],'where':{'id':_0x4ccac1['params']['id']}},_0x315869={};_0x315869[_0xdbde('0x33')]=_[_0xdbde('0x45')](db[_0xdbde('0x29')][_0xdbde('0x2a')]);_0x315869['query']=_['keys'](_0x4ccac1[_0xdbde('0x30')]);_0x315869['filters']=_[_0xdbde('0x32')](_0x315869['model'],_0x315869[_0xdbde('0x30')]);_0xb8275a['attributes']=_['intersection'](_0x315869['model'],qs[_0xdbde('0x34')](_0x4ccac1[_0xdbde('0x30')][_0xdbde('0x34')]));_0xb8275a['attributes']=_0xb8275a['attributes'][_0xdbde('0x36')]?_0xb8275a[_0xdbde('0x35')]:_0x315869['model'];if(_0x4ccac1[_0xdbde('0x30')][_0xdbde('0x40')]){_0xb8275a[_0xdbde('0x41')]=[{'all':!![]}];}_0xb8275a=_['merge']({},_0xb8275a,_0x4ccac1[_0xdbde('0x3f')]);return db['VoiceRecording'][_0xdbde('0x46')](_0xb8275a)[_0xdbde('0x23')](handleEntityNotFound(_0x4b88c8,null))['then'](respondWithResult(_0x4b88c8,null))[_0xdbde('0x43')](handleError(_0x4b88c8,null));};exports[_0xdbde('0x47')]=function(_0x57b7cf,_0x4b211c){return db[_0xdbde('0x29')][_0xdbde('0x47')](_0x57b7cf['body'],{})['then'](respondWithResult(_0x4b211c,0xc9))['catch'](handleError(_0x4b211c,null));};exports['update']=function(_0x44e1c3,_0x3f874b){if(_0x44e1c3[_0xdbde('0x48')]['id']){delete _0x44e1c3['body']['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x44e1c3['params']['id']}})[_0xdbde('0x23')](handleEntityNotFound(_0x3f874b,null))[_0xdbde('0x23')](saveUpdates(_0x44e1c3[_0xdbde('0x48')],null))['then'](respondWithResult(_0x3f874b,null))[_0xdbde('0x43')](handleError(_0x3f874b,null));};exports['describe']=function(_0x22eb38,_0x26b4b1){return db[_0xdbde('0x29')][_0xdbde('0x49')]()['then'](respondWithResult(_0x26b4b1,null))[_0xdbde('0x43')](handleError(_0x26b4b1,null));};exports[_0xdbde('0x4a')]=function(_0x224216,_0x5b0092,_0x3348db){var _0x5bbdad=require(_0xdbde('0x4b'));var _0x545a52=![];var _0x52e91d={};if(_0x224216[_0xdbde('0x30')][_0xdbde('0x2c')]&&_0x224216[_0xdbde('0x30')][_0xdbde('0x2c')]==='uniqueid'){_0x52e91d[_0xdbde('0x4c')]=_0x224216[_0xdbde('0x4d')]['id'];}else{_0x52e91d['id']=_0x224216['params']['id'];}return db[_0xdbde('0x29')][_0xdbde('0x46')]({'where':_0x52e91d,'attributes':['id',_0xdbde('0x4e')],'raw':!![]})[_0xdbde('0x23')](handleEntityNotFound(_0x5b0092,null))[_0xdbde('0x23')](function(_0xdebcd0){if(_0xdebcd0){var _0x10da50=_0xdebcd0[_0xdbde('0x4e')];var _0x461556=util[_0xdbde('0x2f')]('%s.cypher',_0x10da50);if(fs['existsSync'](_0x461556)){_0x545a52=!![];return _0x5bbdad[_0xdbde('0x4f')](_0x461556,_0x10da50,config[_0xdbde('0x50')][_0xdbde('0x51')])[_0xdbde('0x23')](function(){return _0xdebcd0;});}return _0xdebcd0;}})[_0xdbde('0x23')](function(_0x18d631){if(_0x18d631){var _0x833f18=_0x18d631['value'];if(!fs['existsSync'](_0x833f18)){throw new db[(_0xdbde('0x52'))][(_0xdbde('0x53'))](_0xdbde('0x54'));}if(_0x18d631[_0xdbde('0x55')]){return _0x5b0092[_0xdbde('0x4a')](_0x833f18,_0x18d631['filename']+path[_0xdbde('0x56')](_0x833f18),function(){if(_0x545a52){fs[_0xdbde('0x57')](_0x833f18);}});}else{return _0x5b0092[_0xdbde('0x4a')](_0x833f18,function(_0x590e4){if(_0x545a52){fs[_0xdbde('0x57')](_0x833f18);}});}}})[_0xdbde('0x43')](function(_0x4af34d){if(_0x4af34d[_0xdbde('0x58')]===_0xdbde('0x54')){_0x5b0092[_0xdbde('0x16')](0x194)['send'](_0xdbde('0x59'));}else{return handleError(_0x5b0092,null);}});};exports[_0xdbde('0x5a')]=function(_0x59569f,_0x5176a8,_0x3520b5){var _0x4662f7=require(_0xdbde('0x4b'));var _0x3420e3=![];var _0x4573b6={'$and':[db[_0xdbde('0x5b')][_0xdbde('0x3a')](db[_0xdbde('0x5b')]['fn'](_0xdbde('0x5c'),db[_0xdbde('0x5b')][_0xdbde('0x5d')](_0xdbde('0x4c'))),_0x59569f[_0xdbde('0x30')][_0xdbde('0x5e')])]};if(_0x59569f[_0xdbde('0x30')][_0xdbde('0x2c')]&&_0x59569f[_0xdbde('0x30')][_0xdbde('0x2c')]==='uniqueid'){_0x4573b6[_0xdbde('0x5f')]['push']({'uniqueid':_0x59569f[_0xdbde('0x4d')]['id']});}else{_0x4573b6[_0xdbde('0x5f')]['push']({'id':_0x59569f['params']['id']});}return db[_0xdbde('0x29')][_0xdbde('0x46')]({'where':_0x4573b6,'attributes':['id',_0xdbde('0x4e')],'raw':!![]})[_0xdbde('0x23')](handleEntityNotFound(_0x5176a8,null))[_0xdbde('0x23')](function(_0x436795){if(_0x436795){var _0x123ab5=util[_0xdbde('0x2f')](_0xdbde('0x60'),_0x436795[_0xdbde('0x4e')]);if(fs['existsSync'](_0x123ab5)){_0x3420e3=!![];return _0x4662f7['decryptFile'](_0x123ab5,_0x436795[_0xdbde('0x4e')],config[_0xdbde('0x50')]['recording'])[_0xdbde('0x23')](function(){return _0x436795;});}return _0x436795;}})['then'](function(_0x326496){if(_0x326496){if(!fs[_0xdbde('0x61')](_0x326496[_0xdbde('0x4e')])){throw new db[(_0xdbde('0x52'))][(_0xdbde('0x53'))](_0xdbde('0x54'));}if(_0x326496[_0xdbde('0x55')]){return _0x5176a8['download'](_0x326496['value'],_0x326496['filename']+path['extname'](_0x326496[_0xdbde('0x4e')]),function(){if(_0x3420e3){fs['unlink'](_0x326496[_0xdbde('0x4e')]);}});}else{return _0x5176a8[_0xdbde('0x4a')](_0x326496[_0xdbde('0x4e')],function(_0xcff9aa){if(_0x3420e3){fs[_0xdbde('0x57')](_0x326496[_0xdbde('0x4e')]);}});}}})[_0xdbde('0x43')](handleError(_0x5176a8,null));};exports[_0xdbde('0x22')]=function(_0xecfed9,_0x35a99f){return db['VoiceRecording'][_0xdbde('0x46')]({'where':{'id':_0xecfed9[_0xdbde('0x4d')]['id']}})[_0xdbde('0x23')](function(_0x5b5e01){if(_[_0xdbde('0x62')](_0x5b5e01)){throw new ReferenceError(_0xdbde('0x63'));}return _0x5b5e01;})[_0xdbde('0x23')](function(_0x11fac7){var _0x324838=_0x11fac7['value'];logger[_0xdbde('0x64')](_0xdbde('0x65'),_0x324838);if(!_['isNil'](_0x11fac7[_0xdbde('0x4e')])&&fs[_0xdbde('0x61')](_0x324838)){logger[_0xdbde('0x64')](_0xdbde('0x66')+_0x324838+_0xdbde('0x67'));fs[_0xdbde('0x68')](_0x324838);}_0x324838=_0x324838+'.cypher';if(!_[_0xdbde('0x62')](_0x11fac7['value'])&&fs[_0xdbde('0x61')](_0x324838)){logger[_0xdbde('0x64')]('File:\x20\x22'+_0x324838+_0xdbde('0x67'));fs[_0xdbde('0x68')](_0x324838);}return _0x11fac7;})[_0xdbde('0x23')](function(_0x17635){if(!_0x17635)throw new InternalError();return _0x17635[_0xdbde('0x22')]();})[_0xdbde('0x23')](function(){_0x35a99f['status'](0xcc)[_0xdbde('0x69')]();})[_0xdbde('0x43')](handleError(_0x35a99f,null));};function getBucketslist(_0x4f90d9,_0x4d1e1c,_0x51c25f){return new Promise(function(_0x3178c8,_0xbc57a0){var _0x4f539a=new AWS['S3']({'accessKeyId':_0x4d1e1c,'secretAccessKey':_0x4f90d9,'region':_0x51c25f});_0x4f539a[_0xdbde('0x6a')]({},function(_0x3546e7,_0x48706b){if(_0x3546e7){return _0xbc57a0(_0x3546e7);}else{return _0x3178c8(_0x48706b);}});});}function createBucket(_0x127614,_0x49a8e8,_0x52de67,_0x51c58b){return new Promise(function(_0x2ebb46,_0x22f1e0){var _0x4e9a11=new AWS['S3']({'accessKeyId':_0x49a8e8,'secretAccessKey':_0x127614,'region':_0x52de67});_0x4e9a11[_0xdbde('0x6b')]({'Bucket':_0x51c58b},function(_0x5b3bdf,_0x517789){if(_0x5b3bdf){return _0x22f1e0(_0x5b3bdf);}else{return _0x2ebb46(_0x517789);}});});}function uploadFile(_0x1e7c4c,_0x164998,_0x560794,_0x3d1442,_0x2b79d0,_0xb88dd6){return new Promise(function(_0x5603bc,_0x445bfb){var _0x5d4a7d=new AWS['S3']({'accessKeyId':_0x164998,'secretAccessKey':_0x1e7c4c,'region':_0x560794});_0x5d4a7d[_0xdbde('0x6c')]({'Bucket':_0x3d1442,'Key':_0x2b79d0,'Body':_0xb88dd6},function(_0x99c281,_0x9ed18c){if(_0x99c281){return _0x445bfb(_0x99c281);}else{return _0x5603bc(_0x9ed18c);}});});}function startTranscribe(_0x41158b,_0x398f4e,_0x228cbe,_0x45a24c,_0x1153f1,_0x191cf3){return new Promise(function(_0x4f5014,_0x56970e){var _0x3776bc=new AWS[(_0xdbde('0x6d'))]({'accessKeyId':_0x398f4e,'secretAccessKey':_0x41158b,'region':_0x228cbe});_0x3776bc['startTranscriptionJob']({'TranscriptionJobName':_0x45a24c,'LanguageCode':_0x1153f1,'Media':{'MediaFileUri':_0x191cf3}},function(_0x3d0d67,_0x93c9b8){if(_0x3d0d67){return _0x56970e(_0x3d0d67);}else{return _0x4f5014(_0x93c9b8);}});});}function transcribe(_0xf2ad2,_0x4bd076,_0x266fd9,_0x2d2910,_0x4ea1c8,_0x33bf0b,_0x4b6f5d){return new Promise(function(_0x249568,_0x114a98){var _0x4406bc={};logger[_0xdbde('0x64')](util['format'](_0xdbde('0x6e'),_0xf2ad2,_0x4ea1c8));return uploadFile(_0x4bd076,_0x266fd9,_0x2d2910,_0x4ea1c8,path[_0xdbde('0x6f')](_0x33bf0b),fs[_0xdbde('0x70')](_0x33bf0b))[_0xdbde('0x23')](function(_0xb0dbd0){logger[_0xdbde('0x64')](util[_0xdbde('0x2f')](_0xdbde('0x71'),_0xf2ad2,_0x4ea1c8,_0xb0dbd0[_0xdbde('0x72')]));_0x4406bc[_0xdbde('0x73')]=_0xb0dbd0[_0xdbde('0x74')];_0x4406bc[_0xdbde('0x75')]=_0xb0dbd0[_0xdbde('0x72')];logger[_0xdbde('0x64')](util[_0xdbde('0x2f')](_0xdbde('0x76'),_0xf2ad2));return startTranscribe(_0x4bd076,_0x266fd9,_0x2d2910,uuidv4(),_0x4b6f5d,_0xb0dbd0['Location']);})[_0xdbde('0x23')](function(_0x56ef96){logger['info'](util[_0xdbde('0x2f')](_0xdbde('0x77'),_0xf2ad2,_0x56ef96[_0xdbde('0x78')]['TranscriptionJobName']));_0x4406bc[_0xdbde('0x79')]=_0x56ef96['TranscriptionJob'][_0xdbde('0x7a')];_0x4406bc['transcribeStatus']=_0x56ef96[_0xdbde('0x78')][_0xdbde('0x7b')];return _0x249568(_0x4406bc);})[_0xdbde('0x43')](function(_0x5e86f9){return _0x114a98(_0x5e86f9);});});}exports[_0xdbde('0x7c')]=function(_0x2577ec,_0x1426e0,_0x4d2e9c){var _0x4d7968;var _0x1b9363;var _0x57abfd;var _0xd933de=require(_0xdbde('0x4b'));return db[_0xdbde('0x29')][_0xdbde('0x7d')]({'where':{'id':_0x2577ec[_0xdbde('0x4d')]['id']}})[_0xdbde('0x23')](function(_0x343a34){if(_0x343a34){var _0x5701c6=util[_0xdbde('0x2f')]('%s.cypher',_0x343a34[_0xdbde('0x4e')]);if(fs[_0xdbde('0x61')](_0x5701c6)){cypher=!![];return _0xd933de['decryptFile'](_0x5701c6,_0x343a34[_0xdbde('0x4e')],config['secrets'][_0xdbde('0x51')])[_0xdbde('0x23')](function(){return _0x343a34;});}return _0x343a34;}})['then'](function(_0x551d04){if(!_0x551d04){throw new db[(_0xdbde('0x52'))]['ValidationError'](_0xdbde('0x7e'));}_0x1b9363=_0x551d04;return db[_0xdbde('0x7f')][_0xdbde('0x7d')]({'where':{'id':0x1}});})[_0xdbde('0x23')](handleEntityNotFound(_0x1426e0,null))[_0xdbde('0x23')](function(_0x20bbfd){if(_0x20bbfd){_0x4d7968=_0x20bbfd;if(!_0x4d7968[_0xdbde('0x80')]||!_0x4d7968['transcribeAccountId']||!_0x4d7968[_0xdbde('0x81')]||!_0x4d7968[_0xdbde('0x82')]||!_0x4d7968['bucket']){throw new db['Sequelize'][(_0xdbde('0x53'))]('Transcribe\x20not\x20configured');}if(_0x2577ec[_0xdbde('0x48')][_0xdbde('0x83')]&&(!_0x4d7968[_0xdbde('0x84')]||!_0x4d7968[_0xdbde('0x85')]||!_0x4d7968['sentimentRegion']||!_0x4d7968['language']||!_0x4d7968[_0xdbde('0x73')])){throw new db[(_0xdbde('0x52'))][(_0xdbde('0x53'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xdbde('0x86')][_0xdbde('0x7d')]({'where':{'id':_0x4d7968[_0xdbde('0x87')]}});}})[_0xdbde('0x23')](function(_0x3ec73e){if(!_0x3ec73e){throw new db[(_0xdbde('0x52'))][(_0xdbde('0x53'))](_0xdbde('0x88'));}if(!_0x3ec73e['data1']||!_0x3ec73e[_0xdbde('0x89')]){throw new db[(_0xdbde('0x52'))][(_0xdbde('0x53'))](_0xdbde('0x8a'));}_0x57abfd=_0x3ec73e;return getBucketslist(_0x57abfd[_0xdbde('0x8b')],_0x57abfd[_0xdbde('0x89')],_0x4d7968['transcribeRegion']);})[_0xdbde('0x23')](function(_0x480bd5){if(_0x480bd5&&_0x480bd5[_0xdbde('0x8c')]){var _0x18bb3b=_['find'](_0x480bd5[_0xdbde('0x8c')],function(_0x408892){return _0x408892[_0xdbde('0x8d')]===_0x4d7968[_0xdbde('0x73')];});if(!_0x18bb3b){logger[_0xdbde('0x64')](util['format'](_0xdbde('0x8e'),_0x2577ec[_0xdbde('0x4d')]['id'],_0x4d7968[_0xdbde('0x73')]));return createBucket(_0x57abfd[_0xdbde('0x8b')],_0x57abfd[_0xdbde('0x89')],_0x4d7968[_0xdbde('0x81')],_0x4d7968[_0xdbde('0x73')]);}logger['info'](util[_0xdbde('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2577ec[_0xdbde('0x4d')]['id'],_0x4d7968[_0xdbde('0x73')]));return;}})[_0xdbde('0x23')](function(_0x201274){if(_0x1b9363[_0xdbde('0x8f')]===_0xdbde('0x90')){return transcribe(_0x2577ec[_0xdbde('0x4d')]['id'],_0x57abfd[_0xdbde('0x8b')],_0x57abfd[_0xdbde('0x89')],_0x4d7968[_0xdbde('0x81')],_0x4d7968[_0xdbde('0x73')],_0x1b9363[_0xdbde('0x4e')],_0x4d7968[_0xdbde('0x82')]);}else{logger[_0xdbde('0x64')](util[_0xdbde('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x2577ec[_0xdbde('0x4d')]['id']));return{'transcribeStatus':_0xdbde('0x91')};}})['then'](function(_0x5c025d){if(_0x5c025d){_0x5c025d[_0xdbde('0x92')]=_0x2577ec[_0xdbde('0x48')]['runSentiment'];return _0x1b9363['updateAttributes'](_0x5c025d);}})[_0xdbde('0x23')](respondWithResult(_0x1426e0,null))[_0xdbde('0x43')](handleError(_0x1426e0,null));};function writeFile(_0x108fb1,_0x1e8951){return new Promise(function(_0x17077b,_0x2b2067){fs[_0xdbde('0x93')](_0x1e8951,_0x108fb1,function(_0x90222c,_0x3eade5){if(_0x90222c){return _0x2b2067(_0x90222c);}else{return _0x17077b(_0x3eade5);}});});}exports[_0xdbde('0x94')]=function(_0x119149,_0x1fdc02,_0x44489d){return db[_0xdbde('0x29')]['findOne']({'where':{'id':_0x119149['params']['id']}})['then'](handleEntityNotFound(_0x1fdc02))[_0xdbde('0x23')](function(_0x1d1d05){if(_0x1d1d05&&_0x1d1d05[_0xdbde('0x95')]){var _0x43827b=_0x1d1d05[_0xdbde('0x95')];var _0x2b629b=config['root']+'/server/files/transcribes/transcribe_'+_0x1d1d05['id']+_0xdbde('0x96');if(fs[_0xdbde('0x61')](_0x2b629b)){return _0x2b629b;}return writeFile(_0x43827b,_0x2b629b)[_0xdbde('0x23')](function(){return _0x2b629b;});}else{throw new db[(_0xdbde('0x52'))]['ValidationError'](_0xdbde('0x97'));}})[_0xdbde('0x23')](function(_0x34f0fd){return _0x1fdc02[_0xdbde('0x4a')](_0x34f0fd);})['catch'](handleError(_0x1fdc02));}; \ No newline at end of file +var _0x5125=['TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','.txt','Transcript\x20not\x20available','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../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','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','keys','intersection','model','query','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','fields','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','MD5','sequelize','col','$and','push','%s.cypher','extname','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x5125,0x14c));var _0x5512=function(_0x2f2ed0,_0x1c6435){_0x2f2ed0=_0x2f2ed0-0x0;var _0x250b0d=_0x5125[_0x2f2ed0];return _0x250b0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5512('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5512('0x1'));var moment=require(_0x5512('0x2'));var BPromise=require(_0x5512('0x3'));var Mustache=require('mustache');var util=require(_0x5512('0x4'));var path=require('path');var sox=require(_0x5512('0x5'));var csv=require(_0x5512('0x6'));var ejs=require(_0x5512('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5512('0x8'));var crypto=require(_0x5512('0x9'));var jsforce=require(_0x5512('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5512('0x6'));var querystring=require(_0x5512('0xb'));var Papa=require(_0x5512('0xc'));var AWS=require(_0x5512('0xd'));var uuidv4=require(_0x5512('0xe'));var Redis=require('ioredis');var authService=require(_0x5512('0xf'));var qs=require(_0x5512('0x10'));var as=require(_0x5512('0x11'));var hardwareService=require(_0x5512('0x12'));var logger=require(_0x5512('0x13'))(_0x5512('0x14'));var utils=require(_0x5512('0x15'));var config=require(_0x5512('0x16'));var licenseUtil=require(_0x5512('0x17'));var db=require(_0x5512('0x18'))['db'];function respondWithStatusCode(_0x11eff2,_0x31fe70){_0x31fe70=_0x31fe70||0xcc;return function(_0x565458){if(_0x565458){return _0x11eff2['sendStatus'](_0x31fe70);}return _0x11eff2[_0x5512('0x19')](_0x31fe70)[_0x5512('0x1a')]();};}function respondWithResult(_0x55c25b,_0x54cc91){_0x54cc91=_0x54cc91||0xc8;return function(_0x340a30){if(_0x340a30){return _0x55c25b['status'](_0x54cc91)['json'](_0x340a30);}};}function respondWithFilteredResult(_0x9aa01d,_0x102736){return function(_0x2ee430){if(_0x2ee430){var _0x5792f6=typeof _0x102736[_0x5512('0x1b')]==='undefined'&&typeof _0x102736[_0x5512('0x1c')]===_0x5512('0x1d');var _0x144e84=_0x2ee430[_0x5512('0x1e')];var _0x159bb7=_0x5792f6?0x0:_0x102736[_0x5512('0x1b')];var _0x38882b=_0x5792f6?_0x2ee430[_0x5512('0x1e')]:_0x102736[_0x5512('0x1b')]+_0x102736[_0x5512('0x1c')];var _0x5d94a9;if(_0x38882b>=_0x144e84){_0x38882b=_0x144e84;_0x5d94a9=0xc8;}else{_0x5d94a9=0xce;}_0x9aa01d[_0x5512('0x19')](_0x5d94a9);return _0x9aa01d[_0x5512('0x1f')](_0x5512('0x20'),_0x159bb7+'-'+_0x38882b+'/'+_0x144e84)[_0x5512('0x21')](_0x2ee430);}return null;};}function patchUpdates(_0xe425a){return function(_0x50bdda){try{jsonpatch['apply'](_0x50bdda,_0xe425a,!![]);}catch(_0x49fd98){return BPromise[_0x5512('0x22')](_0x49fd98);}return _0x50bdda[_0x5512('0x23')]();};}function saveUpdates(_0x1dcff3,_0x4ca9b0){return function(_0x2b19b9){if(_0x2b19b9){return _0x2b19b9[_0x5512('0x24')](_0x1dcff3)[_0x5512('0x25')](function(_0x415a33){return _0x415a33;});}return null;};}function removeEntity(_0x3a56bc,_0x481be3){return function(_0x39303e){if(_0x39303e){return _0x39303e[_0x5512('0x26')]()[_0x5512('0x25')](function(){_0x3a56bc[_0x5512('0x19')](0xcc)[_0x5512('0x1a')]();});}};}function handleEntityNotFound(_0x522269,_0x7a9dd1){return function(_0x12d003){if(!_0x12d003){_0x522269['sendStatus'](0x194);}return _0x12d003;};}function handleError(_0x36ec2f,_0x25b62e){_0x25b62e=_0x25b62e||0x1f4;return function(_0x25aa38){logger[_0x5512('0x27')](_0x25aa38[_0x5512('0x28')]);if(_0x25aa38[_0x5512('0x29')]){delete _0x25aa38[_0x5512('0x29')];}_0x36ec2f[_0x5512('0x19')](_0x25b62e)[_0x5512('0x2a')](_0x25aa38);};}exports[_0x5512('0x2b')]=function(_0x5d7974,_0x542b73){var _0x34e703={},_0x4fe528={},_0x2a52f6={'count':0x0,'rows':[]};var _0x1a9fe7=_[_0x5512('0x2c')](db[_0x5512('0x2d')][_0x5512('0x2e')],function(_0x538337){return{'name':_0x538337[_0x5512('0x2f')],'type':_0x538337[_0x5512('0x30')]['key']};});_0x4fe528['model']=_[_0x5512('0x31')](_['map'](_0x1a9fe7,'name'),[_0x5512('0x32')]);_0x4fe528['query']=_[_0x5512('0x33')](_0x5d7974['query']);_0x4fe528['filters']=_[_0x5512('0x34')](_0x4fe528[_0x5512('0x35')],_0x4fe528[_0x5512('0x36')]);_0x34e703[_0x5512('0x37')]=_[_0x5512('0x34')](_0x4fe528[_0x5512('0x35')],qs['fields'](_0x5d7974[_0x5512('0x36')]['fields']));_0x34e703[_0x5512('0x37')]=_0x34e703['attributes'][_0x5512('0x38')]?_0x34e703[_0x5512('0x37')]:_0x4fe528[_0x5512('0x35')];if(!_0x5d7974[_0x5512('0x36')]['hasOwnProperty'](_0x5512('0x39'))){_0x34e703[_0x5512('0x1c')]=qs[_0x5512('0x1c')](_0x5d7974['query'][_0x5512('0x1c')]);_0x34e703[_0x5512('0x1b')]=qs[_0x5512('0x1b')](_0x5d7974['query'][_0x5512('0x1b')]);}_0x34e703['order']=qs[_0x5512('0x3a')](_0x5d7974[_0x5512('0x36')][_0x5512('0x3a')]);_0x34e703[_0x5512('0x3b')]=qs[_0x5512('0x3c')](_[_0x5512('0x3d')](_0x5d7974[_0x5512('0x36')],_0x4fe528[_0x5512('0x3c')]),_0x1a9fe7);if(_0x5d7974['query'][_0x5512('0x3e')]){_0x34e703[_0x5512('0x3b')]=_[_0x5512('0x3f')](_0x34e703[_0x5512('0x3b')],{'$or':_['map'](_0x1a9fe7,function(_0x51c4fe){if(_0x51c4fe[_0x5512('0x30')]!==_0x5512('0x40')){var _0x3620e3={};_0x3620e3[_0x51c4fe[_0x5512('0x29')]]={'$like':'%'+_0x5d7974[_0x5512('0x36')]['filter']+'%'};return _0x3620e3;}})});}_0x34e703=_[_0x5512('0x3f')]({},_0x34e703,_0x5d7974[_0x5512('0x41')]);var _0x3d3296={'where':_0x34e703[_0x5512('0x3b')]};return db[_0x5512('0x2d')][_0x5512('0x1e')](_0x3d3296)[_0x5512('0x25')](function(_0x1d261d){_0x2a52f6[_0x5512('0x1e')]=_0x1d261d;if(_0x5d7974[_0x5512('0x36')]['includeAll']){_0x34e703[_0x5512('0x42')]=[{'all':!![]}];}return db[_0x5512('0x2d')][_0x5512('0x43')](_0x34e703);})['then'](function(_0x2b668d){_0x2a52f6[_0x5512('0x44')]=_0x2b668d;return _0x2a52f6;})['then'](respondWithFilteredResult(_0x542b73,_0x34e703))[_0x5512('0x45')](handleError(_0x542b73,null));};exports['show']=function(_0x400746,_0x3f4eaf){var _0x468c03={'raw':![],'where':{'id':_0x400746['params']['id']}},_0x439497={};_0x439497[_0x5512('0x35')]=_[_0x5512('0x33')](db['VoiceRecording'][_0x5512('0x2e')]);_0x439497[_0x5512('0x36')]=_['keys'](_0x400746[_0x5512('0x36')]);_0x439497[_0x5512('0x3c')]=_[_0x5512('0x34')](_0x439497[_0x5512('0x35')],_0x439497[_0x5512('0x36')]);_0x468c03[_0x5512('0x37')]=_[_0x5512('0x34')](_0x439497[_0x5512('0x35')],qs[_0x5512('0x46')](_0x400746[_0x5512('0x36')][_0x5512('0x46')]));_0x468c03['attributes']=_0x468c03[_0x5512('0x37')]['length']?_0x468c03[_0x5512('0x37')]:_0x439497['model'];if(_0x400746['query']['includeAll']){_0x468c03[_0x5512('0x42')]=[{'all':!![]}];}_0x468c03=_[_0x5512('0x3f')]({},_0x468c03,_0x400746['options']);return db[_0x5512('0x2d')][_0x5512('0x47')](_0x468c03)[_0x5512('0x25')](handleEntityNotFound(_0x3f4eaf,null))[_0x5512('0x25')](respondWithResult(_0x3f4eaf,null))[_0x5512('0x45')](handleError(_0x3f4eaf,null));};exports[_0x5512('0x48')]=function(_0xb16a46,_0x29c78d){return db[_0x5512('0x2d')][_0x5512('0x48')](_0xb16a46[_0x5512('0x49')],{})[_0x5512('0x25')](respondWithResult(_0x29c78d,0xc9))['catch'](handleError(_0x29c78d,null));};exports['update']=function(_0x1fa7c3,_0x52736e){if(_0x1fa7c3[_0x5512('0x49')]['id']){delete _0x1fa7c3[_0x5512('0x49')]['id'];}return db[_0x5512('0x2d')]['find']({'where':{'id':_0x1fa7c3[_0x5512('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52736e,null))[_0x5512('0x25')](saveUpdates(_0x1fa7c3['body'],null))[_0x5512('0x25')](respondWithResult(_0x52736e,null))[_0x5512('0x45')](handleError(_0x52736e,null));};exports[_0x5512('0x4b')]=function(_0xe7db27,_0x1c3e76){return db['VoiceRecording'][_0x5512('0x4b')]()[_0x5512('0x25')](respondWithResult(_0x1c3e76,null))[_0x5512('0x45')](handleError(_0x1c3e76,null));};exports[_0x5512('0x4c')]=function(_0x32a343,_0x3a1375,_0x25e95f){var _0x111265=require(_0x5512('0x4d'));var _0x479732=![];var _0xc2f739={};if(_0x32a343[_0x5512('0x36')]['type']&&_0x32a343[_0x5512('0x36')][_0x5512('0x30')]===_0x5512('0x4e')){_0xc2f739['uniqueid']=_0x32a343[_0x5512('0x4a')]['id'];}else{_0xc2f739['id']=_0x32a343[_0x5512('0x4a')]['id'];}return db['VoiceRecording']['find']({'where':_0xc2f739,'attributes':['id',_0x5512('0x4f')],'raw':!![]})[_0x5512('0x25')](handleEntityNotFound(_0x3a1375,null))['then'](function(_0x2e1808){if(_0x2e1808){var _0x52d151=_0x2e1808[_0x5512('0x4f')];var _0x529fd8=util[_0x5512('0x32')]('%s.cypher',_0x52d151);if(fs[_0x5512('0x50')](_0x529fd8)){_0x479732=!![];return _0x111265[_0x5512('0x51')](_0x529fd8,_0x52d151,config[_0x5512('0x52')][_0x5512('0x53')])[_0x5512('0x25')](function(){return _0x2e1808;});}return _0x2e1808;}})[_0x5512('0x25')](function(_0x23383c){if(_0x23383c){var _0x190644=_0x23383c['value'];if(!fs[_0x5512('0x50')](_0x190644)){throw new db[(_0x5512('0x54'))][(_0x5512('0x55'))](_0x5512('0x56'));}if(_0x23383c[_0x5512('0x57')]){return _0x3a1375[_0x5512('0x4c')](_0x190644,_0x23383c[_0x5512('0x57')]+path['extname'](_0x190644),function(){if(_0x479732){fs[_0x5512('0x58')](_0x190644);}});}else{return _0x3a1375[_0x5512('0x4c')](_0x190644,function(_0x7e6806){if(_0x479732){fs[_0x5512('0x58')](_0x190644);}});}}})[_0x5512('0x45')](function(_0x3fb04d){if(_0x3fb04d['message']===_0x5512('0x56')){_0x3a1375[_0x5512('0x19')](0x194)[_0x5512('0x2a')](_0x5512('0x59'));}else{return handleError(_0x3a1375,null);}});};exports['downloads']=function(_0xd0db97,_0xabbc3d,_0x2bc734){var _0x1c5800=require('../../components/encryptor');var _0x3b6c6c=![];var _0x5cf0bc={'$and':[db['sequelize'][_0x5512('0x3b')](db['sequelize']['fn'](_0x5512('0x5a'),db[_0x5512('0x5b')][_0x5512('0x5c')](_0x5512('0x4e'))),_0xd0db97[_0x5512('0x36')]['token'])]};if(_0xd0db97[_0x5512('0x36')][_0x5512('0x30')]&&_0xd0db97[_0x5512('0x36')][_0x5512('0x30')]===_0x5512('0x4e')){_0x5cf0bc[_0x5512('0x5d')][_0x5512('0x5e')]({'uniqueid':_0xd0db97['params']['id']});}else{_0x5cf0bc[_0x5512('0x5d')][_0x5512('0x5e')]({'id':_0xd0db97[_0x5512('0x4a')]['id']});}return db['VoiceRecording'][_0x5512('0x47')]({'where':_0x5cf0bc,'attributes':['id',_0x5512('0x4f')],'raw':!![]})[_0x5512('0x25')](handleEntityNotFound(_0xabbc3d,null))[_0x5512('0x25')](function(_0x9240b){if(_0x9240b){var _0x104ee8=util['format'](_0x5512('0x5f'),_0x9240b[_0x5512('0x4f')]);if(fs[_0x5512('0x50')](_0x104ee8)){_0x3b6c6c=!![];return _0x1c5800['decryptFile'](_0x104ee8,_0x9240b[_0x5512('0x4f')],config[_0x5512('0x52')]['recording'])[_0x5512('0x25')](function(){return _0x9240b;});}return _0x9240b;}})[_0x5512('0x25')](function(_0x4261d9){if(_0x4261d9){if(!fs[_0x5512('0x50')](_0x4261d9[_0x5512('0x4f')])){throw new db[(_0x5512('0x54'))][(_0x5512('0x55'))](_0x5512('0x56'));}if(_0x4261d9[_0x5512('0x57')]){return _0xabbc3d[_0x5512('0x4c')](_0x4261d9[_0x5512('0x4f')],_0x4261d9['filename']+path[_0x5512('0x60')](_0x4261d9[_0x5512('0x4f')]),function(){if(_0x3b6c6c){fs[_0x5512('0x58')](_0x4261d9[_0x5512('0x4f')]);}});}else{return _0xabbc3d[_0x5512('0x4c')](_0x4261d9[_0x5512('0x4f')],function(_0x3bfd98){if(_0x3b6c6c){fs[_0x5512('0x58')](_0x4261d9['value']);}});}}})['catch'](handleError(_0xabbc3d,null));};exports[_0x5512('0x26')]=function(_0x4ba150,_0x3556c0){return db[_0x5512('0x2d')][_0x5512('0x47')]({'where':{'id':_0x4ba150['params']['id']}})[_0x5512('0x25')](function(_0xc23741){if(_['isNil'](_0xc23741)){throw new ReferenceError(_0x5512('0x61'));}return _0xc23741;})[_0x5512('0x25')](function(_0x367c46){var _0x3b2f4f=_0x367c46[_0x5512('0x4f')];logger[_0x5512('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x3b2f4f);if(!_[_0x5512('0x63')](_0x367c46[_0x5512('0x4f')])&&fs['existsSync'](_0x3b2f4f)){logger[_0x5512('0x62')](_0x5512('0x64')+_0x3b2f4f+_0x5512('0x65'));fs[_0x5512('0x66')](_0x3b2f4f);}_0x3b2f4f=_0x3b2f4f+_0x5512('0x67');if(!_['isNil'](_0x367c46['value'])&&fs[_0x5512('0x50')](_0x3b2f4f)){logger['info']('File:\x20\x22'+_0x3b2f4f+_0x5512('0x65'));fs[_0x5512('0x66')](_0x3b2f4f);}return _0x367c46;})[_0x5512('0x25')](function(_0x2a9e81){if(!_0x2a9e81)throw new InternalError();return _0x2a9e81[_0x5512('0x26')]();})['then'](function(){_0x3556c0['status'](0xcc)[_0x5512('0x1a')]();})['catch'](handleError(_0x3556c0,null));};function getBucketslist(_0x5c908a,_0x2189d2,_0x2ce350){return new Promise(function(_0x571a80,_0x1653a8){var _0x202d46=new AWS['S3']({'accessKeyId':_0x2189d2,'secretAccessKey':_0x5c908a,'region':_0x2ce350});_0x202d46['listBuckets']({},function(_0x4f3cf9,_0x5e009b){if(_0x4f3cf9){return _0x1653a8(_0x4f3cf9);}else{return _0x571a80(_0x5e009b);}});});}function createBucket(_0x6caeae,_0x53a88a,_0x3655b8,_0x36d0ef){return new Promise(function(_0x47a484,_0x4fe68d){var _0x7edc72=new AWS['S3']({'accessKeyId':_0x53a88a,'secretAccessKey':_0x6caeae,'region':_0x3655b8});_0x7edc72[_0x5512('0x68')]({'Bucket':_0x36d0ef},function(_0x6cc209,_0x23284c){if(_0x6cc209){return _0x4fe68d(_0x6cc209);}else{return _0x47a484(_0x23284c);}});});}function uploadFile(_0x392d99,_0x29e63f,_0x592d62,_0x3dc9cd,_0x18bb61,_0x12c2b9){return new Promise(function(_0x1e377c,_0x57a863){var _0x4026c6=new AWS['S3']({'accessKeyId':_0x29e63f,'secretAccessKey':_0x392d99,'region':_0x592d62});_0x4026c6[_0x5512('0x69')]({'Bucket':_0x3dc9cd,'Key':_0x18bb61,'Body':_0x12c2b9},function(_0x61048e,_0x2436ea){if(_0x61048e){return _0x57a863(_0x61048e);}else{return _0x1e377c(_0x2436ea);}});});}function startTranscribe(_0x10646a,_0x1143f4,_0x233df4,_0x1715d0,_0x48a9f1,_0x248693){return new Promise(function(_0x4dd588,_0x4ffb31){var _0x10c449=new AWS[(_0x5512('0x6a'))]({'accessKeyId':_0x1143f4,'secretAccessKey':_0x10646a,'region':_0x233df4});_0x10c449[_0x5512('0x6b')]({'TranscriptionJobName':_0x1715d0,'LanguageCode':_0x48a9f1,'Media':{'MediaFileUri':_0x248693}},function(_0x3369f3,_0xab94a3){if(_0x3369f3){return _0x4ffb31(_0x3369f3);}else{return _0x4dd588(_0xab94a3);}});});}function transcribe(_0x8bb1b4,_0x5886aa,_0x1a4a5b,_0xe26223,_0x3aa0b0,_0x563312,_0x346c5f){return new Promise(function(_0x14eb05,_0x53b773){var _0x15a275={};logger[_0x5512('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x8bb1b4,_0x3aa0b0));return uploadFile(_0x5886aa,_0x1a4a5b,_0xe26223,_0x3aa0b0,path[_0x5512('0x6c')](_0x563312),fs['readFileSync'](_0x563312))[_0x5512('0x25')](function(_0x48b8b5){logger['info'](util[_0x5512('0x32')](_0x5512('0x6d'),_0x8bb1b4,_0x3aa0b0,_0x48b8b5[_0x5512('0x6e')]));_0x15a275['bucket']=_0x48b8b5[_0x5512('0x6f')];_0x15a275[_0x5512('0x70')]=_0x48b8b5[_0x5512('0x6e')];logger[_0x5512('0x62')](util[_0x5512('0x32')](_0x5512('0x71'),_0x8bb1b4));return startTranscribe(_0x5886aa,_0x1a4a5b,_0xe26223,uuidv4(),_0x346c5f,_0x48b8b5['Location']);})[_0x5512('0x25')](function(_0x16ca3d){logger[_0x5512('0x62')](util[_0x5512('0x32')](_0x5512('0x72'),_0x8bb1b4,_0x16ca3d[_0x5512('0x73')]['TranscriptionJobName']));_0x15a275[_0x5512('0x74')]=_0x16ca3d[_0x5512('0x73')]['TranscriptionJobName'];_0x15a275[_0x5512('0x75')]=_0x16ca3d[_0x5512('0x73')][_0x5512('0x76')];return _0x14eb05(_0x15a275);})[_0x5512('0x45')](function(_0x224dba){return _0x53b773(_0x224dba);});});}exports[_0x5512('0x77')]=function(_0x2e7f0d,_0x3276fd,_0x55b9c7){var _0x5a7af7;var _0x462c63;var _0x518dcb;var _0x159e0c=require(_0x5512('0x4d'));return db[_0x5512('0x2d')]['findOne']({'where':{'id':_0x2e7f0d['params']['id']}})[_0x5512('0x25')](function(_0x16c4a1){if(_0x16c4a1){var _0x30328e=util[_0x5512('0x32')]('%s.cypher',_0x16c4a1[_0x5512('0x4f')]);if(fs[_0x5512('0x50')](_0x30328e)){cypher=!![];return _0x159e0c['decryptFile'](_0x30328e,_0x16c4a1[_0x5512('0x4f')],config[_0x5512('0x52')]['recording'])[_0x5512('0x25')](function(){return _0x16c4a1;});}return _0x16c4a1;}})['then'](function(_0x1b3f3e){if(!_0x1b3f3e){throw new db[(_0x5512('0x54'))]['ValidationError'](_0x5512('0x78'));}_0x462c63=_0x1b3f3e;return db['Setting'][_0x5512('0x79')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x3276fd,null))[_0x5512('0x25')](function(_0x2202e7){if(_0x2202e7){_0x5a7af7=_0x2202e7;if(!_0x5a7af7[_0x5512('0x7a')]||!_0x5a7af7[_0x5512('0x7b')]||!_0x5a7af7[_0x5512('0x7c')]||!_0x5a7af7[_0x5512('0x7d')]||!_0x5a7af7[_0x5512('0x7e')]){throw new db['Sequelize'][(_0x5512('0x55'))](_0x5512('0x7f'));}if(_0x2e7f0d['body'][_0x5512('0x80')]&&(!_0x5a7af7['sentiment']||!_0x5a7af7['sentimentAccountId']||!_0x5a7af7[_0x5512('0x81')]||!_0x5a7af7[_0x5512('0x7d')]||!_0x5a7af7[_0x5512('0x7e')])){throw new db[(_0x5512('0x54'))][(_0x5512('0x55'))](_0x5512('0x82'));}return db[_0x5512('0x83')][_0x5512('0x79')]({'where':{'id':_0x5a7af7[_0x5512('0x7b')]}});}})['then'](function(_0x468971){if(!_0x468971){throw new db['Sequelize'][(_0x5512('0x55'))](_0x5512('0x84'));}if(!_0x468971[_0x5512('0x85')]||!_0x468971[_0x5512('0x86')]){throw new db[(_0x5512('0x54'))]['ValidationError'](_0x5512('0x87'));}_0x518dcb=_0x468971;return getBucketslist(_0x518dcb['data1'],_0x518dcb[_0x5512('0x86')],_0x5a7af7['transcribeRegion']);})[_0x5512('0x25')](function(_0x2624c8){if(_0x2624c8&&_0x2624c8['Buckets']){var _0x3c6570=_[_0x5512('0x47')](_0x2624c8['Buckets'],function(_0xbe0160){return _0xbe0160[_0x5512('0x88')]===_0x5a7af7[_0x5512('0x7e')];});if(!_0x3c6570){logger[_0x5512('0x62')](util[_0x5512('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x2e7f0d['params']['id'],_0x5a7af7[_0x5512('0x7e')]));return createBucket(_0x518dcb['data1'],_0x518dcb[_0x5512('0x86')],_0x5a7af7[_0x5512('0x7c')],_0x5a7af7[_0x5512('0x7e')]);}logger[_0x5512('0x62')](util['format'](_0x5512('0x89'),_0x2e7f0d[_0x5512('0x4a')]['id'],_0x5a7af7[_0x5512('0x7e')]));return;}})[_0x5512('0x25')](function(_0x1a0685){if(_0x462c63[_0x5512('0x75')]===_0x5512('0x8a')){return transcribe(_0x2e7f0d[_0x5512('0x4a')]['id'],_0x518dcb['data1'],_0x518dcb[_0x5512('0x86')],_0x5a7af7[_0x5512('0x7c')],_0x5a7af7[_0x5512('0x7e')],_0x462c63[_0x5512('0x4f')],_0x5a7af7[_0x5512('0x7d')]);}else{logger['info'](util[_0x5512('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x2e7f0d[_0x5512('0x4a')]['id']));return{'transcribeStatus':_0x5512('0x8b')};}})[_0x5512('0x25')](function(_0x37a5be){if(_0x37a5be){_0x37a5be[_0x5512('0x8c')]=_0x2e7f0d[_0x5512('0x49')][_0x5512('0x80')];return _0x462c63[_0x5512('0x8d')](_0x37a5be);}})[_0x5512('0x25')](respondWithResult(_0x3276fd,null))[_0x5512('0x45')](handleError(_0x3276fd,null));};function writeFile(_0x4dc919,_0x423ae8){return new Promise(function(_0x37cf3a,_0x1646ae){fs[_0x5512('0x8e')](_0x423ae8,_0x4dc919,function(_0xea2473,_0x48f753){if(_0xea2473){return _0x1646ae(_0xea2473);}else{return _0x37cf3a(_0x48f753);}});});}exports['downloadTranscribe']=function(_0x30c675,_0x4b5284,_0x567acd){return db['VoiceRecording'][_0x5512('0x79')]({'where':{'id':_0x30c675[_0x5512('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b5284))[_0x5512('0x25')](function(_0x409721){if(_0x409721&&_0x409721[_0x5512('0x8f')]){var _0x1e7ede=_0x409721[_0x5512('0x8f')];var _0x2cb756=config['root']+'/server/files/transcribes/transcribe_'+_0x409721['id']+_0x5512('0x90');if(fs[_0x5512('0x50')](_0x2cb756)){return _0x2cb756;}return writeFile(_0x1e7ede,_0x2cb756)[_0x5512('0x25')](function(){return _0x2cb756;});}else{throw new db[(_0x5512('0x54'))][(_0x5512('0x55'))](_0x5512('0x91'));}})['then'](function(_0x5e1b1f){return _0x4b5284['download'](_0x5e1b1f);})['catch'](handleError(_0x4b5284));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b045a76..151eb11 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 _0xb520=['VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define'];(function(_0x53b53f,_0x2cbc77){var _0x500a1f=function(_0x2ccf44){while(--_0x2ccf44){_0x53b53f['push'](_0x53b53f['shift']());}};_0x500a1f(++_0x2cbc77);}(_0xb520,0x162));var _0x0b52=function(_0x234956,_0x12ffe8){_0x234956=_0x234956-0x0;var _0x28cc18=_0xb520[_0x234956];return _0x28cc18;};'use strict';var _=require(_0x0b52('0x0'));var util=require(_0x0b52('0x1'));var logger=require(_0x0b52('0x2'))(_0x0b52('0x3'));var moment=require(_0x0b52('0x4'));var BPromise=require(_0x0b52('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0b52('0x6'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module[_0x0b52('0x7')]=function(_0x2449f5,_0x311065){return _0x2449f5[_0x0b52('0x8')](_0x0b52('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x0b52('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x66d4=['bluebird','request-promise','path','./voiceRecording.attributes','define','VoiceRecording','uniqueid','util','api','moment'];(function(_0x1b2531,_0x447a58){var _0x12c2b8=function(_0x348ddc){while(--_0x348ddc){_0x1b2531['push'](_0x1b2531['shift']());}};_0x12c2b8(++_0x447a58);}(_0x66d4,0x10b));var _0x466d=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x66d4[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var util=require(_0x466d('0x0'));var logger=require('../../config/logger')(_0x466d('0x1'));var moment=require(_0x466d('0x2'));var BPromise=require(_0x466d('0x3'));var rp=require(_0x466d('0x4'));var fs=require('fs');var path=require(_0x466d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x466d('0x6'));module['exports']=function(_0x10fd8d,_0x201317){return _0x10fd8d[_0x466d('0x7')](_0x466d('0x8'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x466d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f271f2d..04b192c 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 _0x5b12=['Setting','callRecordingEncryption','create','body','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','UpdateVoiceRecording','VoiceRecording','options','raw','attributes','CreateVoiceRecording','../../components/encryptor'];(function(_0x2eb38f,_0x17b21e){var _0x179f7e=function(_0x1323cc){while(--_0x1323cc){_0x2eb38f['push'](_0x2eb38f['shift']());}};_0x179f7e(++_0x17b21e);}(_0x5b12,0xa3));var _0x25b1=function(_0x2d0b0b,_0x59f115){_0x2d0b0b=_0x2d0b0b-0x0;var _0x2381c4=_0x5b12[_0x2d0b0b];return _0x2381c4;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});}exports[_0x25b1('0x14')]=function(_0x27ccc9){var _0x1f78c2=this;return new Promise(function(_0x2a7d14,_0x17024a){return db[_0x25b1('0x15')]['update'](_0x27ccc9['body'],{'raw':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ccc9['options']?_0x27ccc9[_0x25b1('0x16')]['where']||null:null,'attributes':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x18')]||null:null,'limit':_0x27ccc9['options']?_0x27ccc9['options']['limit']||null:null})[_0x25b1('0x9')](function(_0x150436){logger['info'](_0x25b1('0x14'),_0x27ccc9);logger[_0x25b1('0xc')](_0x25b1('0x14'),_0x27ccc9,JSON[_0x25b1('0xe')](_0x150436));_0x2a7d14(_0x150436);})[_0x25b1('0x13')](function(_0x5e6b6b){logger[_0x25b1('0xf')](_0x25b1('0x14'),_0x5e6b6b[_0x25b1('0x12')],_0x27ccc9);_0x17024a(_0x1f78c2[_0x25b1('0xf')](0x1f4,_0x5e6b6b[_0x25b1('0x12')]));});});};exports[_0x25b1('0x19')]=function(_0x5d9ed7){var _0x3c05c6=this;return new Promise(function(_0x27dd68,_0x3d279f){var _0x5bc8fc=require(_0x25b1('0x1a'));var _0x9e175f;return db[_0x25b1('0x1b')]['findOne']({'attributes':['id',_0x25b1('0x1c')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x19ecd1){_0x9e175f=_0x19ecd1;return db[_0x25b1('0x15')][_0x25b1('0x1d')](_0x5d9ed7[_0x25b1('0x1e')]);})[_0x25b1('0x9')](function(_0x300a14){if(_0x9e175f[_0x25b1('0x1c')]&&fs['existsSync'](_0x300a14[_0x25b1('0x1f')])){var _0xca56f0=util[_0x25b1('0x20')](_0x25b1('0x21'),_0x300a14[_0x25b1('0x1f')]);return _0x5bc8fc['encryptFile'](_0x300a14[_0x25b1('0x1f')],_0xca56f0,config[_0x25b1('0x22')][_0x25b1('0x23')])[_0x25b1('0x9')](function(){fs[_0x25b1('0x24')](_0x300a14['value']);logger['info'](_0x25b1('0x25'));return _0x300a14;});}return _0x300a14;})['then'](function(_0x446984){logger[_0x25b1('0xa')](_0x25b1('0x19'),_0x5d9ed7);logger['debug']('CreateVoiceRecording',_0x5d9ed7,JSON[_0x25b1('0xe')](_0x446984));_0x27dd68(_0x446984);})[_0x25b1('0x13')](function(_0x26d3bc){logger['error'](_0x25b1('0x19'),_0x26d3bc[_0x25b1('0x12')],_0x5d9ed7);_0x3d279f(_0x3c05c6[_0x25b1('0xf')](0x1f4,_0x26d3bc[_0x25b1('0x12')]));});});}; \ No newline at end of file +var _0x2a07=['body','options','raw','where','attributes','limit','UpdateVoiceRecording','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','VoiceRecording','update'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x2a07,0x74));var _0x72a0=function(_0x2effa6,_0x1440d7){_0x2effa6=_0x2effa6-0x0;var _0x226598=_0x2a07[_0x2effa6];return _0x226598;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});}exports['UpdateVoiceRecording']=function(_0x100d8f){var _0x42e9ec=this;return new Promise(function(_0x131b73,_0x5b63c8){return db[_0x72a0('0x17')][_0x72a0('0x18')](_0x100d8f[_0x72a0('0x19')],{'raw':_0x100d8f[_0x72a0('0x1a')]?_0x100d8f['options'][_0x72a0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100d8f['options']?_0x100d8f[_0x72a0('0x1a')][_0x72a0('0x1c')]||null:null,'attributes':_0x100d8f[_0x72a0('0x1a')]?_0x100d8f['options'][_0x72a0('0x1d')]||null:null,'limit':_0x100d8f[_0x72a0('0x1a')]?_0x100d8f[_0x72a0('0x1a')][_0x72a0('0x1e')]||null:null})['then'](function(_0x38a7ba){logger[_0x72a0('0x15')](_0x72a0('0x1f'),_0x100d8f);logger[_0x72a0('0x20')](_0x72a0('0x1f'),_0x100d8f,JSON[_0x72a0('0x12')](_0x38a7ba));_0x131b73(_0x38a7ba);})['catch'](function(_0x4dd1a6){logger[_0x72a0('0x13')](_0x72a0('0x1f'),_0x4dd1a6[_0x72a0('0x14')],_0x100d8f);_0x5b63c8(_0x42e9ec[_0x72a0('0x13')](0x1f4,_0x4dd1a6[_0x72a0('0x14')]));});});};exports[_0x72a0('0x21')]=function(_0xa5bda0){var _0x15922a=this;return new Promise(function(_0xee99e2,_0x12dcc9){var _0x4f9718=require(_0x72a0('0x22'));var _0x553641;return db[_0x72a0('0x23')][_0x72a0('0x24')]({'attributes':['id',_0x72a0('0x25')],'where':{'id':0x1},'raw':!![]})[_0x72a0('0xe')](function(_0x432179){_0x553641=_0x432179;return db[_0x72a0('0x17')][_0x72a0('0x26')](_0xa5bda0[_0x72a0('0x19')]);})['then'](function(_0x41efc1){if(_0x553641[_0x72a0('0x25')]&&fs[_0x72a0('0x27')](_0x41efc1[_0x72a0('0x28')])){var _0x13c04=util[_0x72a0('0x29')](_0x72a0('0x2a'),_0x41efc1['value']);return _0x4f9718[_0x72a0('0x2b')](_0x41efc1[_0x72a0('0x28')],_0x13c04,config[_0x72a0('0x2c')][_0x72a0('0x2d')])[_0x72a0('0xe')](function(){fs[_0x72a0('0x2e')](_0x41efc1[_0x72a0('0x28')]);logger[_0x72a0('0x15')]('CreateVoiceRecording\x20file\x20encrypted');return _0x41efc1;});}return _0x41efc1;})[_0x72a0('0xe')](function(_0x1fb485){logger[_0x72a0('0x15')]('CreateVoiceRecording',_0xa5bda0);logger[_0x72a0('0x20')]('CreateVoiceRecording',_0xa5bda0,JSON[_0x72a0('0x12')](_0x1fb485));_0xee99e2(_0x1fb485);})[_0x72a0('0x16')](function(_0x1d02c4){logger[_0x72a0('0x13')](_0x72a0('0x21'),_0x1d02c4[_0x72a0('0x14')],_0xa5bda0);_0x12dcc9(_0x15922a[_0x72a0('0x13')](0x1f4,_0x1d02c4[_0x72a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 05b2e24..7e12aca 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 _0x68a2=['Router','fs-extra','../../components/auth/service','./voiceTransferReport.controller','isAuthenticated','index','/describe','describe','/:id','put','delete','destroy','multer','connect-timeout','express'];(function(_0x5d1d99,_0x10ca23){var _0x2957ec=function(_0x4f4ba){while(--_0x4f4ba){_0x5d1d99['push'](_0x5d1d99['shift']());}};_0x2957ec(++_0x10ca23);}(_0x68a2,0x1b0));var _0x268a=function(_0xf01a44,_0x2cf8dc){_0xf01a44=_0xf01a44-0x0;var _0x4bd3b7=_0x68a2[_0xf01a44];return _0x4bd3b7;};'use strict';var multer=require(_0x268a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x268a('0x1'));var express=require(_0x268a('0x2'));var router=express[_0x268a('0x3')]();var fs_extra=require(_0x268a('0x4'));var auth=require(_0x268a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x268a('0x6'));router['get']('/',auth[_0x268a('0x7')](),controller[_0x268a('0x8')]);router['get'](_0x268a('0x9'),auth[_0x268a('0x7')](),controller[_0x268a('0xa')]);router['get'](_0x268a('0xb'),auth[_0x268a('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x268a('0xc')](_0x268a('0xb'),auth[_0x268a('0x7')](),controller['update']);router[_0x268a('0xd')](_0x268a('0xb'),auth[_0x268a('0x7')](),controller[_0x268a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xaaae=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','create','update','delete'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0xaaae,0x9b));var _0xeaaa=function(_0x234bdf,_0x4ec25f){_0x234bdf=_0x234bdf-0x0;var _0x3d742d=_0xaaae[_0x234bdf];return _0x3d742d;};'use strict';var multer=require('multer');var util=require(_0xeaaa('0x0'));var path=require(_0xeaaa('0x1'));var timeout=require(_0xeaaa('0x2'));var express=require(_0xeaaa('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeaaa('0x4'));var interaction=require(_0xeaaa('0x5'));var config=require(_0xeaaa('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xeaaa('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xeaaa('0x8'),auth[_0xeaaa('0x9')](),controller['describe']);router[_0xeaaa('0x7')](_0xeaaa('0xa'),auth[_0xeaaa('0x9')](),controller[_0xeaaa('0xb')]);router['post']('/',auth[_0xeaaa('0x9')](),controller[_0xeaaa('0xc')]);router['put']('/:id',auth[_0xeaaa('0x9')](),controller[_0xeaaa('0xd')]);router[_0xeaaa('0xe')](_0xeaaa('0xa'),auth[_0xeaaa('0x9')](),controller[_0xeaaa('0xf')]);module[_0xeaaa('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 98cbfce..0531ddf 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 _0x54d2=['blind','attended','STRING','Yes'];(function(_0x5f1456,_0x3f70da){var _0x4b6fd5=function(_0x350d4e){while(--_0x350d4e){_0x5f1456['push'](_0x5f1456['shift']());}};_0x4b6fd5(++_0x3f70da);}(_0x54d2,0x17c));var _0x254d=function(_0x64a5a0,_0x5f598e){_0x64a5a0=_0x64a5a0-0x0;var _0x531585=_0x54d2[_0x64a5a0];return _0x531585;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0x254d('0x0'),_0x254d('0x1'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x254d('0x2')]},'transferercalleridnum':{'type':Sequelize[_0x254d('0x2')]},'transferercalleridname':{'type':Sequelize[_0x254d('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x254d('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x254d('0x2')]},'transferercontext':{'type':Sequelize[_0x254d('0x2')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x254d('0x2')]},'transfereechannel':{'type':Sequelize[_0x254d('0x2')]},'transfereecalleridnum':{'type':Sequelize[_0x254d('0x2')]},'transfereecalleridname':{'type':Sequelize[_0x254d('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x254d('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x254d('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x254d('0x2')]},'transfereecontext':{'type':Sequelize[_0x254d('0x2')]},'transfereeexten':{'type':Sequelize[_0x254d('0x2')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x254d('0x3'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7561=['attended','STRING','ENUM','Yes','sequelize','moment','blind'];(function(_0x347a92,_0x5b2219){var _0x324a60=function(_0x2d1e59){while(--_0x2d1e59){_0x347a92['push'](_0x347a92['shift']());}};_0x324a60(++_0x5b2219);}(_0x7561,0x1cb));var _0x1756=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7561[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x1756('0x0'));var moment=require(_0x1756('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x1756('0x2'),_0x1756('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x1756('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x1756('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x1756('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x1756('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x1756('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x1756('0x4')]},'transfereechannel':{'type':Sequelize[_0x1756('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x1756('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1756('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1756('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1756('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x1756('0x4')]},'transfereecontext':{'type':Sequelize[_0x1756('0x4')]},'transfereeexten':{'type':Sequelize[_0x1756('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x1756('0x4')]},'isexternal':{'type':Sequelize[_0x1756('0x5')](_0x1756('0x6'),'No')},'context':{'type':Sequelize[_0x1756('0x4')]},'extension':{'type':Sequelize[_0x1756('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 31621da..93932f9 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 _0x39a7=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','show','params','keys','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','offset','limit','count','status','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39a7,0xe8));var _0x739a=function(_0x1f8069,_0x10b62c){_0x1f8069=_0x1f8069-0x0;var _0x1c2603=_0x39a7[_0x1f8069];return _0x1c2603;};'use strict';var emlformat=require(_0x739a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x739a('0x1'));var jsonpatch=require(_0x739a('0x2'));var rp=require(_0x739a('0x3'));var moment=require(_0x739a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x739a('0x5'));var path=require(_0x739a('0x6'));var sox=require(_0x739a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x739a('0x8'));var _=require(_0x739a('0x9'));var squel=require(_0x739a('0xa'));var crypto=require('crypto');var jsforce=require(_0x739a('0xb'));var deskjs=require(_0x739a('0xc'));var toCsv=require(_0x739a('0xd'));var querystring=require(_0x739a('0xe'));var Papa=require('papaparse');var Redis=require(_0x739a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x739a('0x10'));var hardwareService=require(_0x739a('0x11'));var logger=require(_0x739a('0x12'))('api');var utils=require(_0x739a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x739a('0x14'))['db'];function respondWithStatusCode(_0x366b91,_0x4e4a6b){_0x4e4a6b=_0x4e4a6b||0xcc;return function(_0x258e1a){if(_0x258e1a){return _0x366b91['sendStatus'](_0x4e4a6b);}return _0x366b91['status'](_0x4e4a6b)['end']();};}function respondWithResult(_0x3d02cb,_0x1f356f){_0x1f356f=_0x1f356f||0xc8;return function(_0x5cdfe2){if(_0x5cdfe2){return _0x3d02cb['status'](_0x1f356f)['json'](_0x5cdfe2);}};}function respondWithFilteredResult(_0x5772d8,_0x23e552){return function(_0x445cd4){if(_0x445cd4){var _0x12f4c0=typeof _0x23e552[_0x739a('0x15')]==='undefined'&&typeof _0x23e552[_0x739a('0x16')]==='undefined';var _0x17dfcc=_0x445cd4['count'];var _0x54e0f2=_0x12f4c0?0x0:_0x23e552[_0x739a('0x15')];var _0x123b74=_0x12f4c0?_0x445cd4[_0x739a('0x17')]:_0x23e552['offset']+_0x23e552['limit'];var _0x50e122;if(_0x123b74>=_0x17dfcc){_0x123b74=_0x17dfcc;_0x50e122=0xc8;}else{_0x50e122=0xce;}_0x5772d8[_0x739a('0x18')](_0x50e122);return _0x5772d8[_0x739a('0x19')](_0x739a('0x1a'),_0x54e0f2+'-'+_0x123b74+'/'+_0x17dfcc)[_0x739a('0x1b')](_0x445cd4);}return null;};}function patchUpdates(_0x490251){return function(_0x3e66a1){try{jsonpatch['apply'](_0x3e66a1,_0x490251,!![]);}catch(_0x507686){return BPromise[_0x739a('0x1c')](_0x507686);}return _0x3e66a1[_0x739a('0x1d')]();};}function saveUpdates(_0x1769c5,_0x1b2adc){return function(_0x5ab68e){if(_0x5ab68e){return _0x5ab68e[_0x739a('0x1e')](_0x1769c5)[_0x739a('0x1f')](function(_0x273518){return _0x273518;});}return null;};}function removeEntity(_0x19846a,_0x59e81b){return function(_0xb2576f){if(_0xb2576f){return _0xb2576f[_0x739a('0x20')]()['then'](function(){_0x19846a['status'](0xcc)[_0x739a('0x21')]();});}};}function handleEntityNotFound(_0x3a792a,_0x588760){return function(_0x106a17){if(!_0x106a17){_0x3a792a[_0x739a('0x22')](0x194);}return _0x106a17;};}function handleError(_0x57ab61,_0x2e5620){_0x2e5620=_0x2e5620||0x1f4;return function(_0x4c187d){logger[_0x739a('0x23')](_0x4c187d[_0x739a('0x24')]);if(_0x4c187d[_0x739a('0x25')]){delete _0x4c187d['name'];}_0x57ab61[_0x739a('0x18')](_0x2e5620)['send'](_0x4c187d);};}exports[_0x739a('0x26')]=function(_0x30bd95,_0x614725){var _0x64fbd2={},_0x21af92={},_0x5907a8={'count':0x0,'rows':[]};var _0x839d50=_[_0x739a('0x27')](db[_0x739a('0x28')][_0x739a('0x29')],function(_0x20cc3d){return{'name':_0x20cc3d[_0x739a('0x2a')],'type':_0x20cc3d[_0x739a('0x2b')][_0x739a('0x2c')]};});_0x21af92[_0x739a('0x2d')]=_[_0x739a('0x27')](_0x839d50,'name');_0x21af92[_0x739a('0x2e')]=_['keys'](_0x30bd95[_0x739a('0x2e')]);_0x21af92[_0x739a('0x2f')]=_[_0x739a('0x30')](_0x21af92[_0x739a('0x2d')],_0x21af92[_0x739a('0x2e')]);_0x64fbd2[_0x739a('0x31')]=_[_0x739a('0x30')](_0x21af92['model'],qs[_0x739a('0x32')](_0x30bd95[_0x739a('0x2e')][_0x739a('0x32')]));_0x64fbd2[_0x739a('0x31')]=_0x64fbd2[_0x739a('0x31')][_0x739a('0x33')]?_0x64fbd2['attributes']:_0x21af92[_0x739a('0x2d')];if(!_0x30bd95[_0x739a('0x2e')][_0x739a('0x34')](_0x739a('0x35'))){_0x64fbd2[_0x739a('0x16')]=qs[_0x739a('0x16')](_0x30bd95[_0x739a('0x2e')]['limit']);_0x64fbd2[_0x739a('0x15')]=qs['offset'](_0x30bd95[_0x739a('0x2e')][_0x739a('0x15')]);}_0x64fbd2['order']=qs[_0x739a('0x36')](_0x30bd95[_0x739a('0x2e')]['sort']);_0x64fbd2['where']=qs[_0x739a('0x2f')](_['pick'](_0x30bd95[_0x739a('0x2e')],_0x21af92[_0x739a('0x2f')]),_0x839d50);if(_0x30bd95[_0x739a('0x2e')]['filter']){_0x64fbd2[_0x739a('0x37')]=_[_0x739a('0x38')](_0x64fbd2[_0x739a('0x37')],{'$or':_[_0x739a('0x27')](_0x839d50,function(_0x2394ef){if(_0x2394ef[_0x739a('0x2b')]!==_0x739a('0x39')){var _0x4c90b0={};_0x4c90b0[_0x2394ef[_0x739a('0x25')]]={'$like':'%'+_0x30bd95[_0x739a('0x2e')]['filter']+'%'};return _0x4c90b0;}})});}_0x64fbd2=_['merge']({},_0x64fbd2,_0x30bd95[_0x739a('0x3a')]);var _0x45d536={'where':_0x64fbd2[_0x739a('0x37')]};return db['VoiceTransferReport'][_0x739a('0x17')](_0x45d536)['then'](function(_0x40d869){_0x5907a8[_0x739a('0x17')]=_0x40d869;if(_0x30bd95[_0x739a('0x2e')][_0x739a('0x3b')]){_0x64fbd2[_0x739a('0x3c')]=[{'all':!![]}];}return db[_0x739a('0x28')]['findAll'](_0x64fbd2);})[_0x739a('0x1f')](function(_0x4021da){_0x5907a8['rows']=_0x4021da;return _0x5907a8;})[_0x739a('0x1f')](respondWithFilteredResult(_0x614725,_0x64fbd2))['catch'](handleError(_0x614725,null));};exports[_0x739a('0x3d')]=function(_0x4f0bdb,_0x59f197){var _0x476159={'raw':!![],'where':{'id':_0x4f0bdb[_0x739a('0x3e')]['id']}},_0x1e3b5b={};_0x1e3b5b[_0x739a('0x2d')]=_[_0x739a('0x3f')](db['VoiceTransferReport'][_0x739a('0x29')]);_0x1e3b5b['query']=_[_0x739a('0x3f')](_0x4f0bdb[_0x739a('0x2e')]);_0x1e3b5b['filters']=_[_0x739a('0x30')](_0x1e3b5b['model'],_0x1e3b5b[_0x739a('0x2e')]);_0x476159[_0x739a('0x31')]=_['intersection'](_0x1e3b5b[_0x739a('0x2d')],qs[_0x739a('0x32')](_0x4f0bdb['query'][_0x739a('0x32')]));_0x476159[_0x739a('0x31')]=_0x476159[_0x739a('0x31')][_0x739a('0x33')]?_0x476159[_0x739a('0x31')]:_0x1e3b5b[_0x739a('0x2d')];if(_0x4f0bdb['query'][_0x739a('0x3b')]){_0x476159[_0x739a('0x3c')]=[{'all':!![]}];}_0x476159=_[_0x739a('0x38')]({},_0x476159,_0x4f0bdb[_0x739a('0x3a')]);return db[_0x739a('0x28')][_0x739a('0x40')](_0x476159)[_0x739a('0x1f')](handleEntityNotFound(_0x59f197,null))['then'](respondWithResult(_0x59f197,null))[_0x739a('0x41')](handleError(_0x59f197,null));};exports[_0x739a('0x42')]=function(_0x289aeb,_0x7119e1){return db[_0x739a('0x28')][_0x739a('0x42')](_0x289aeb['body'],{})[_0x739a('0x1f')](respondWithResult(_0x7119e1,0xc9))[_0x739a('0x41')](handleError(_0x7119e1,null));};exports['update']=function(_0x492b83,_0x5107e5){if(_0x492b83[_0x739a('0x43')]['id']){delete _0x492b83[_0x739a('0x43')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x492b83[_0x739a('0x3e')]['id']}})[_0x739a('0x1f')](handleEntityNotFound(_0x5107e5,null))[_0x739a('0x1f')](saveUpdates(_0x492b83['body'],null))['then'](respondWithResult(_0x5107e5,null))['catch'](handleError(_0x5107e5,null));};exports[_0x739a('0x20')]=function(_0xad31a4,_0x102d7a){return db[_0x739a('0x28')][_0x739a('0x40')]({'where':{'id':_0xad31a4[_0x739a('0x3e')]['id']}})[_0x739a('0x1f')](handleEntityNotFound(_0x102d7a,null))[_0x739a('0x1f')](removeEntity(_0x102d7a,null))[_0x739a('0x41')](handleError(_0x102d7a,null));};exports[_0x739a('0x44')]=function(_0x4856a3,_0x20fedb){return db['VoiceTransferReport'][_0x739a('0x44')]()[_0x739a('0x1f')](respondWithResult(_0x20fedb,null))[_0x739a('0x41')](handleError(_0x20fedb,null));}; \ No newline at end of file +var _0x40dc=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','rows','catch','params','rawAttributes','includeAll','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','json','reject','then','destroy','sendStatus','error','stack','name','index','map','VoiceTransferReport','fieldName','type','model','query','keys'];(function(_0xfa514e,_0x2665aa){var _0x39d8b0=function(_0x46328e){while(--_0x46328e){_0xfa514e['push'](_0xfa514e['shift']());}};_0x39d8b0(++_0x2665aa);}(_0x40dc,0xed));var _0xc40d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40dc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc40d('0x0'));var rimraf=require(_0xc40d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc40d('0x2'));var rp=require(_0xc40d('0x3'));var moment=require(_0xc40d('0x4'));var BPromise=require(_0xc40d('0x5'));var Mustache=require(_0xc40d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc40d('0x7'));var csv=require(_0xc40d('0x8'));var ejs=require(_0xc40d('0x9'));var fs=require('fs');var fs_extra=require(_0xc40d('0xa'));var _=require(_0xc40d('0xb'));var squel=require(_0xc40d('0xc'));var crypto=require(_0xc40d('0xd'));var jsforce=require(_0xc40d('0xe'));var deskjs=require(_0xc40d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc40d('0x10'));var Redis=require(_0xc40d('0x11'));var authService=require(_0xc40d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc40d('0x13'));var logger=require(_0xc40d('0x14'))(_0xc40d('0x15'));var utils=require('../../config/utils');var config=require(_0xc40d('0x16'));var licenseUtil=require(_0xc40d('0x17'));var db=require(_0xc40d('0x18'))['db'];function respondWithStatusCode(_0x34f77c,_0x48bfa9){_0x48bfa9=_0x48bfa9||0xcc;return function(_0x1bd46a){if(_0x1bd46a){return _0x34f77c['sendStatus'](_0x48bfa9);}return _0x34f77c[_0xc40d('0x19')](_0x48bfa9)[_0xc40d('0x1a')]();};}function respondWithResult(_0x370d63,_0x3fbbba){_0x3fbbba=_0x3fbbba||0xc8;return function(_0x69fd2c){if(_0x69fd2c){return _0x370d63['status'](_0x3fbbba)['json'](_0x69fd2c);}};}function respondWithFilteredResult(_0x4f6a8b,_0x2e76e7){return function(_0x5b3503){if(_0x5b3503){var _0x251354=typeof _0x2e76e7[_0xc40d('0x1b')]===_0xc40d('0x1c')&&typeof _0x2e76e7[_0xc40d('0x1d')]==='undefined';var _0x43aae0=_0x5b3503['count'];var _0x4cf946=_0x251354?0x0:_0x2e76e7[_0xc40d('0x1b')];var _0x51f4ee=_0x251354?_0x5b3503['count']:_0x2e76e7[_0xc40d('0x1b')]+_0x2e76e7['limit'];var _0x459e32;if(_0x51f4ee>=_0x43aae0){_0x51f4ee=_0x43aae0;_0x459e32=0xc8;}else{_0x459e32=0xce;}_0x4f6a8b[_0xc40d('0x19')](_0x459e32);return _0x4f6a8b[_0xc40d('0x1e')]('Content-Range',_0x4cf946+'-'+_0x51f4ee+'/'+_0x43aae0)[_0xc40d('0x1f')](_0x5b3503);}return null;};}function patchUpdates(_0x275782){return function(_0x357f22){try{jsonpatch['apply'](_0x357f22,_0x275782,!![]);}catch(_0x22831c){return BPromise[_0xc40d('0x20')](_0x22831c);}return _0x357f22['save']();};}function saveUpdates(_0x3ab6cd,_0xec0e97){return function(_0x1a5578){if(_0x1a5578){return _0x1a5578['update'](_0x3ab6cd)[_0xc40d('0x21')](function(_0xfc9c42){return _0xfc9c42;});}return null;};}function removeEntity(_0xe008e8,_0x261da1){return function(_0x4acbf4){if(_0x4acbf4){return _0x4acbf4[_0xc40d('0x22')]()[_0xc40d('0x21')](function(){_0xe008e8[_0xc40d('0x19')](0xcc)[_0xc40d('0x1a')]();});}};}function handleEntityNotFound(_0x503e54,_0x235ee4){return function(_0xa7d276){if(!_0xa7d276){_0x503e54[_0xc40d('0x23')](0x194);}return _0xa7d276;};}function handleError(_0x335581,_0x1dd184){_0x1dd184=_0x1dd184||0x1f4;return function(_0x1a9b95){logger[_0xc40d('0x24')](_0x1a9b95[_0xc40d('0x25')]);if(_0x1a9b95[_0xc40d('0x26')]){delete _0x1a9b95[_0xc40d('0x26')];}_0x335581['status'](_0x1dd184)['send'](_0x1a9b95);};}exports[_0xc40d('0x27')]=function(_0x1ecf02,_0x207dd1){var _0x5dbdb5={},_0xb9271b={},_0x4ac404={'count':0x0,'rows':[]};var _0x37438e=_[_0xc40d('0x28')](db[_0xc40d('0x29')]['rawAttributes'],function(_0x3c5669){return{'name':_0x3c5669[_0xc40d('0x2a')],'type':_0x3c5669[_0xc40d('0x2b')]['key']};});_0xb9271b[_0xc40d('0x2c')]=_['map'](_0x37438e,'name');_0xb9271b[_0xc40d('0x2d')]=_[_0xc40d('0x2e')](_0x1ecf02['query']);_0xb9271b['filters']=_[_0xc40d('0x2f')](_0xb9271b[_0xc40d('0x2c')],_0xb9271b['query']);_0x5dbdb5['attributes']=_[_0xc40d('0x2f')](_0xb9271b[_0xc40d('0x2c')],qs['fields'](_0x1ecf02[_0xc40d('0x2d')][_0xc40d('0x30')]));_0x5dbdb5[_0xc40d('0x31')]=_0x5dbdb5[_0xc40d('0x31')][_0xc40d('0x32')]?_0x5dbdb5['attributes']:_0xb9271b[_0xc40d('0x2c')];if(!_0x1ecf02[_0xc40d('0x2d')][_0xc40d('0x33')](_0xc40d('0x34'))){_0x5dbdb5['limit']=qs['limit'](_0x1ecf02['query'][_0xc40d('0x1d')]);_0x5dbdb5[_0xc40d('0x1b')]=qs[_0xc40d('0x1b')](_0x1ecf02[_0xc40d('0x2d')]['offset']);}_0x5dbdb5['order']=qs[_0xc40d('0x35')](_0x1ecf02[_0xc40d('0x2d')][_0xc40d('0x35')]);_0x5dbdb5[_0xc40d('0x36')]=qs[_0xc40d('0x37')](_['pick'](_0x1ecf02[_0xc40d('0x2d')],_0xb9271b[_0xc40d('0x37')]),_0x37438e);if(_0x1ecf02[_0xc40d('0x2d')][_0xc40d('0x38')]){_0x5dbdb5[_0xc40d('0x36')]=_[_0xc40d('0x39')](_0x5dbdb5[_0xc40d('0x36')],{'$or':_[_0xc40d('0x28')](_0x37438e,function(_0x263972){if(_0x263972['type']!==_0xc40d('0x3a')){var _0x34f81f={};_0x34f81f[_0x263972[_0xc40d('0x26')]]={'$like':'%'+_0x1ecf02[_0xc40d('0x2d')][_0xc40d('0x38')]+'%'};return _0x34f81f;}})});}_0x5dbdb5=_[_0xc40d('0x39')]({},_0x5dbdb5,_0x1ecf02[_0xc40d('0x3b')]);var _0x5ca5a1={'where':_0x5dbdb5[_0xc40d('0x36')]};return db[_0xc40d('0x29')][_0xc40d('0x3c')](_0x5ca5a1)[_0xc40d('0x21')](function(_0x3e5e87){_0x4ac404['count']=_0x3e5e87;if(_0x1ecf02['query']['includeAll']){_0x5dbdb5['include']=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x5dbdb5);})[_0xc40d('0x21')](function(_0x175a69){_0x4ac404[_0xc40d('0x3d')]=_0x175a69;return _0x4ac404;})['then'](respondWithFilteredResult(_0x207dd1,_0x5dbdb5))[_0xc40d('0x3e')](handleError(_0x207dd1,null));};exports['show']=function(_0x275517,_0x5c9b14){var _0x4d825f={'raw':!![],'where':{'id':_0x275517[_0xc40d('0x3f')]['id']}},_0x4d485d={};_0x4d485d['model']=_[_0xc40d('0x2e')](db[_0xc40d('0x29')][_0xc40d('0x40')]);_0x4d485d[_0xc40d('0x2d')]=_[_0xc40d('0x2e')](_0x275517[_0xc40d('0x2d')]);_0x4d485d['filters']=_['intersection'](_0x4d485d[_0xc40d('0x2c')],_0x4d485d['query']);_0x4d825f['attributes']=_['intersection'](_0x4d485d[_0xc40d('0x2c')],qs[_0xc40d('0x30')](_0x275517['query'][_0xc40d('0x30')]));_0x4d825f[_0xc40d('0x31')]=_0x4d825f[_0xc40d('0x31')][_0xc40d('0x32')]?_0x4d825f[_0xc40d('0x31')]:_0x4d485d['model'];if(_0x275517['query'][_0xc40d('0x41')]){_0x4d825f[_0xc40d('0x42')]=[{'all':!![]}];}_0x4d825f=_[_0xc40d('0x39')]({},_0x4d825f,_0x275517[_0xc40d('0x3b')]);return db[_0xc40d('0x29')]['find'](_0x4d825f)[_0xc40d('0x21')](handleEntityNotFound(_0x5c9b14,null))['then'](respondWithResult(_0x5c9b14,null))[_0xc40d('0x3e')](handleError(_0x5c9b14,null));};exports[_0xc40d('0x43')]=function(_0x1cfb72,_0x595f6a){return db['VoiceTransferReport']['create'](_0x1cfb72[_0xc40d('0x44')],{})[_0xc40d('0x21')](respondWithResult(_0x595f6a,0xc9))[_0xc40d('0x3e')](handleError(_0x595f6a,null));};exports['update']=function(_0x154026,_0xfcccb1){if(_0x154026[_0xc40d('0x44')]['id']){delete _0x154026[_0xc40d('0x44')]['id'];}return db[_0xc40d('0x29')][_0xc40d('0x45')]({'where':{'id':_0x154026['params']['id']}})[_0xc40d('0x21')](handleEntityNotFound(_0xfcccb1,null))[_0xc40d('0x21')](saveUpdates(_0x154026[_0xc40d('0x44')],null))[_0xc40d('0x21')](respondWithResult(_0xfcccb1,null))[_0xc40d('0x3e')](handleError(_0xfcccb1,null));};exports[_0xc40d('0x22')]=function(_0x2d2164,_0x418c6c){return db[_0xc40d('0x29')][_0xc40d('0x45')]({'where':{'id':_0x2d2164['params']['id']}})[_0xc40d('0x21')](handleEntityNotFound(_0x418c6c,null))[_0xc40d('0x21')](removeEntity(_0x418c6c,null))['catch'](handleError(_0x418c6c,null));};exports[_0xc40d('0x46')]=function(_0x410cfc,_0x1b801c){return db[_0xc40d('0x29')][_0xc40d('0x46')]()[_0xc40d('0x21')](respondWithResult(_0x1b801c,null))[_0xc40d('0x3e')](handleError(_0x1b801c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 703a54f..4e4dc4f 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 _0x11e1=['report_call_transfer','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports','VoiceTransferReport'];(function(_0x932e09,_0x45f0d7){var _0x3c8ed4=function(_0x3c7238){while(--_0x3c7238){_0x932e09['push'](_0x932e09['shift']());}};_0x3c8ed4(++_0x45f0d7);}(_0x11e1,0x191));var _0x111e=function(_0x1e3708,_0x3a2b3e){_0x1e3708=_0x1e3708-0x0;var _0x9d5849=_0x11e1[_0x1e3708];return _0x9d5849;};'use strict';var _=require(_0x111e('0x0'));var util=require(_0x111e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x111e('0x2'));var BPromise=require(_0x111e('0x3'));var rp=require(_0x111e('0x4'));var fs=require('fs');var path=require(_0x111e('0x5'));var rimraf=require('rimraf');var config=require(_0x111e('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x111e('0x7')]=function(_0x56224d,_0x8c5b94){return _0x56224d['define'](_0x111e('0x8'),attributes,{'tableName':_0x111e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d97=['rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','api','moment','bluebird','request-promise','path'];(function(_0x2ce7e4,_0x185a63){var _0x52abf2=function(_0x2c418c){while(--_0x2c418c){_0x2ce7e4['push'](_0x2ce7e4['shift']());}};_0x52abf2(++_0x185a63);}(_0x6d97,0xd2));var _0x76d9=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x6d97[_0x363ef8];return _0x148822;};'use strict';var _=require(_0x76d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x76d9('0x1'));var moment=require(_0x76d9('0x2'));var BPromise=require(_0x76d9('0x3'));var rp=require(_0x76d9('0x4'));var fs=require('fs');var path=require(_0x76d9('0x5'));var rimraf=require(_0x76d9('0x6'));var config=require(_0x76d9('0x7'));var attributes=require(_0x76d9('0x8'));module['exports']=function(_0x14269a,_0x2b384b){return _0x14269a[_0x76d9('0x9')](_0x76d9('0xa'),attributes,{'tableName':_0x76d9('0xb'),'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 deef327..6c8d840 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 _0xf07d=['request\x20sent','debug','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','then','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xf07d,0x76));var _0xdf07=function(_0x342987,_0x547a7b){_0x342987=_0x342987-0x0;var _0x508695=_0xf07d[_0x342987];return _0x508695;};'use strict';var _=require(_0xdf07('0x0'));var util=require(_0xdf07('0x1'));var moment=require(_0xdf07('0x2'));var BPromise=require(_0xdf07('0x3'));var rs=require(_0xdf07('0x4'));var fs=require('fs');var Redis=require(_0xdf07('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdf07('0x6'))(_0xdf07('0x7'));var config=require('../../config/environment');var jayson=require(_0xdf07('0x8'));var client=jayson[_0xdf07('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c724b,_0x2e5724,_0x11b798){return new BPromise(function(_0x2d0f87,_0x4c7ced){return client['request'](_0x2c724b,_0x11b798)[_0xdf07('0xa')](function(_0x12d632){logger['info'](_0xdf07('0xb'),_0x2e5724,_0xdf07('0xc'));logger[_0xdf07('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2e5724,_0xdf07('0xc'),JSON['stringify'](_0x12d632));if(_0x12d632[_0xdf07('0xe')]){if(_0x12d632[_0xdf07('0xe')][_0xdf07('0xf')]===0x1f4){logger[_0xdf07('0xe')](_0xdf07('0xb'),_0x2e5724,_0x12d632[_0xdf07('0xe')][_0xdf07('0x10')]);return _0x4c7ced(_0x12d632[_0xdf07('0xe')]['message']);}logger[_0xdf07('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e5724,_0x12d632[_0xdf07('0xe')][_0xdf07('0x10')]);return _0x2d0f87(_0x12d632[_0xdf07('0xe')][_0xdf07('0x10')]);}else{logger[_0xdf07('0x11')](_0xdf07('0xb'),_0x2e5724,_0xdf07('0xc'));_0x2d0f87(_0x12d632['result'][_0xdf07('0x10')]);}})[_0xdf07('0x12')](function(_0x2b1668){logger[_0xdf07('0xe')](_0xdf07('0xb'),_0x2e5724,_0x2b1668);_0x4c7ced(_0x2b1668);});});}exports[_0xdf07('0x13')]=function(_0x48d53e){var _0x146692=this;return new Promise(function(_0x395a96,_0x407422){return db[_0xdf07('0x14')][_0xdf07('0x15')](_0x48d53e[_0xdf07('0x16')],{'raw':_0x48d53e['options']?_0x48d53e[_0xdf07('0x17')][_0xdf07('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x537f9c){logger['info'](_0xdf07('0x13'),_0x48d53e);logger[_0xdf07('0xd')](_0xdf07('0x13'),_0x48d53e,JSON[_0xdf07('0x19')](_0x537f9c));_0x395a96(_0x537f9c);})['catch'](function(_0xeb7f93){logger[_0xdf07('0xe')](_0xdf07('0x13'),_0xeb7f93['message'],_0x48d53e);_0x407422(_0x146692[_0xdf07('0xe')](0x1f4,_0xeb7f93[_0xdf07('0x10')]));});});}; \ No newline at end of file +var _0x58ee=['code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x58ee,0x1ea));var _0xe58e=function(_0x5de7fb,_0x110458){_0x5de7fb=_0x5de7fb-0x0;var _0x57d3f4=_0x58ee[_0x5de7fb];return _0x57d3f4;};'use strict';var _=require('lodash');var util=require(_0xe58e('0x0'));var moment=require(_0xe58e('0x1'));var BPromise=require('bluebird');var rs=require(_0xe58e('0x2'));var fs=require('fs');var Redis=require(_0xe58e('0x3'));var db=require(_0xe58e('0x4'))['db'];var utils=require(_0xe58e('0x5'));var logger=require(_0xe58e('0x6'))('rpc');var config=require(_0xe58e('0x7'));var jayson=require(_0xe58e('0x8'));var client=jayson[_0xe58e('0x9')][_0xe58e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x259424,_0x1e4740,_0xa5ee86){return new BPromise(function(_0x16be8d,_0x41e08b){return client[_0xe58e('0xb')](_0x259424,_0xa5ee86)[_0xe58e('0xc')](function(_0x2e43ad){logger[_0xe58e('0xd')](_0xe58e('0xe'),_0x1e4740,_0xe58e('0xf'));logger[_0xe58e('0x10')](_0xe58e('0x11'),_0x1e4740,_0xe58e('0xf'),JSON[_0xe58e('0x12')](_0x2e43ad));if(_0x2e43ad['error']){if(_0x2e43ad[_0xe58e('0x13')][_0xe58e('0x14')]===0x1f4){logger[_0xe58e('0x13')](_0xe58e('0xe'),_0x1e4740,_0x2e43ad['error'][_0xe58e('0x15')]);return _0x41e08b(_0x2e43ad['error'][_0xe58e('0x15')]);}logger[_0xe58e('0x13')](_0xe58e('0xe'),_0x1e4740,_0x2e43ad[_0xe58e('0x13')][_0xe58e('0x15')]);return _0x16be8d(_0x2e43ad['error'][_0xe58e('0x15')]);}else{logger[_0xe58e('0xd')](_0xe58e('0xe'),_0x1e4740,_0xe58e('0xf'));_0x16be8d(_0x2e43ad[_0xe58e('0x16')][_0xe58e('0x15')]);}})[_0xe58e('0x17')](function(_0x58a4b5){logger[_0xe58e('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e4740,_0x58a4b5);_0x41e08b(_0x58a4b5);});});}exports[_0xe58e('0x18')]=function(_0xdb7ae1){var _0x2a3b6b=this;return new Promise(function(_0x2b0fbb,_0x3b143e){return db[_0xe58e('0x19')][_0xe58e('0x1a')](_0xdb7ae1[_0xe58e('0x1b')],{'raw':_0xdb7ae1[_0xe58e('0x1c')]?_0xdb7ae1[_0xe58e('0x1c')][_0xe58e('0x1d')]===undefined?!![]:![]:!![]})[_0xe58e('0xc')](function(_0x4a5365){logger['info']('CreateVoiceTransferReport',_0xdb7ae1);logger[_0xe58e('0x10')](_0xe58e('0x18'),_0xdb7ae1,JSON[_0xe58e('0x12')](_0x4a5365));_0x2b0fbb(_0x4a5365);})[_0xe58e('0x17')](function(_0xa79d2c){logger['error'](_0xe58e('0x18'),_0xa79d2c['message'],_0xdb7ae1);_0x3b143e(_0x2a3b6b[_0xe58e('0x13')](0x1f4,_0xa79d2c[_0xe58e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index be0cc49..4f87f12 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 _0xb42f=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','originate','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xb42f,0x134));var _0xfb42=function(_0x194d42,_0x138502){_0x194d42=_0x194d42-0x0;var _0x1cebed=_0xb42f[_0x194d42];return _0x1cebed;};'use strict';var express=require(_0xfb42('0x0'));var router=express[_0xfb42('0x1')]();var auth=require(_0xfb42('0x2'));var controller=require('./webbar.controller');router[_0xfb42('0x3')](_0xfb42('0x4'),auth[_0xfb42('0x5')](),auth['canUpdate'](),controller[_0xfb42('0x6')]);router[_0xfb42('0x3')](_0xfb42('0x7'),auth[_0xfb42('0x5')](),auth[_0xfb42('0x8')](),controller[_0xfb42('0x9')]);router[_0xfb42('0x3')](_0xfb42('0xa'),auth[_0xfb42('0x5')](),auth[_0xfb42('0x8')](),controller[_0xfb42('0xb')]);router[_0xfb42('0x3')](_0xfb42('0xc'),auth[_0xfb42('0x5')](),auth[_0xfb42('0x8')](),controller[_0xfb42('0xd')]);router[_0xfb42('0x3')](_0xfb42('0xe'),auth[_0xfb42('0x5')](),auth[_0xfb42('0x8')](),controller[_0xfb42('0xf')]);router[_0xfb42('0x3')](_0xfb42('0x10'),auth[_0xfb42('0x5')](),auth['canUpdate'](),controller['calls']);router[_0xfb42('0x3')](_0xfb42('0x11'),auth[_0xfb42('0x5')](),auth[_0xfb42('0x8')](),controller[_0xfb42('0x12')]);module['exports']=router; \ No newline at end of file +var _0x55fa=['hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','canUpdate','originate','post','/hangup'];(function(_0x236f46,_0x38b639){var _0x1b67c8=function(_0xb37552){while(--_0xb37552){_0x236f46['push'](_0x236f46['shift']());}};_0x1b67c8(++_0x38b639);}(_0x55fa,0x185));var _0xa55f=function(_0xd25b90,_0x9600e){_0xd25b90=_0xd25b90-0x0;var _0xb076c3=_0x55fa[_0xd25b90];return _0xb076c3;};'use strict';var express=require(_0xa55f('0x0'));var router=express[_0xa55f('0x1')]();var auth=require(_0xa55f('0x2'));var controller=require(_0xa55f('0x3'));router['post'](_0xa55f('0x4'),auth[_0xa55f('0x5')](),auth[_0xa55f('0x6')](),controller[_0xa55f('0x7')]);router[_0xa55f('0x8')](_0xa55f('0x9'),auth[_0xa55f('0x5')](),auth[_0xa55f('0x6')](),controller[_0xa55f('0xa')]);router['post'](_0xa55f('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xa55f('0xc')]);router[_0xa55f('0x8')](_0xa55f('0xd'),auth[_0xa55f('0x5')](),auth['canUpdate'](),controller[_0xa55f('0xe')]);router[_0xa55f('0x8')](_0xa55f('0xf'),auth['isAuthenticated'](),auth[_0xa55f('0x6')](),controller[_0xa55f('0x10')]);router[_0xa55f('0x8')](_0xa55f('0x11'),auth['isAuthenticated'](),auth[_0xa55f('0x6')](),controller['calls']);router[_0xa55f('0x8')](_0xa55f('0x12'),auth[_0xa55f('0x5')](),auth[_0xa55f('0x6')](),controller[_0xa55f('0x13')]);module[_0xa55f('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d732506..2c19738 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 _0x4c6d=['webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','webbarapi','ioredis','defaults','redis','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','send','status','request','then','error','code','message','result','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer\x20fired:','webbar:answer','hold','hold\x20fired:'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x41ceed,_0xb593fd){_0x41ceed=_0x41ceed-0x0;var _0x32d18e=_0x4c6d[_0x41ceed];return _0x32d18e;};'use strict';var path=require(_0xd4c6('0x0'));var fs=require('fs');var _=require(_0xd4c6('0x1'));var db=require(_0xd4c6('0x2'))['db'];var config=require(_0xd4c6('0x3'));var util=require(_0xd4c6('0x4'));var BPromise=require('bluebird');var jayson=require(_0xd4c6('0x5'));var amiClient=jayson[_0xd4c6('0x6')][_0xd4c6('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xd4c6('0x8'));var Redis=require(_0xd4c6('0x9'));config['redis']=_[_0xd4c6('0xa')](config[_0xd4c6('0xb')],{'host':_0xd4c6('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4c6('0xb')]));var Schema=require(_0xd4c6('0xd'));var originateValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xd4c6('0xf'),'required':[!![],_0xd4c6('0x10')]},'callerId':{'type':_0xd4c6('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd4c6('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xd4c6('0xf'),'required':[!![],_0xd4c6('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd4c6('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]}});function emit(_0x25204d,_0x3cb95c,_0x3da1f4){logger[_0xd4c6('0x13')](_0x25204d,_0x3cb95c,JSON['stringify'](_0x3da1f4));io['to'](_0x25204d)[_0xd4c6('0x14')](_0x3cb95c,_0x3da1f4);}function handleError(_0x44126c){return function(_0x23a16f){console[_0xd4c6('0x15')](_0xd4c6('0x16'),_0x23a16f,_0x23a16f instanceof RangeError);logger['error'](_0x23a16f[_0xd4c6('0x17')]);if(_0x23a16f instanceof RangeError){if(_0x23a16f[_0xd4c6('0x18')]){delete _0x23a16f[_0xd4c6('0x18')];}_0x44126c['status'](0x194)[_0xd4c6('0x19')](_0x23a16f);}else{if(_0x23a16f[_0xd4c6('0x18')]){delete _0x23a16f[_0xd4c6('0x18')];}_0x44126c[_0xd4c6('0x1a')](0x1f4)['send'](_0x23a16f);}};}function checkError(){return function(_0x1c8427){if(!_0x1c8427){throw new RangeError('NotFound');}return _0x1c8427;};}function respondWithRpcPromise(_0x37f552,_0x150e28){return new BPromise(function(_0x2750c9,_0x222813){var _0xf536e0=amiClient;return _0xf536e0[_0xd4c6('0x1b')](_0x37f552,_0x150e28)[_0xd4c6('0x1c')](function(_0x3f99e8){if(_0x3f99e8[_0xd4c6('0x1d')]){if(_0x3f99e8[_0xd4c6('0x1d')][_0xd4c6('0x1e')]===0x1f4){return _0x222813(_0x3f99e8[_0xd4c6('0x1d')]['message']);}return _0x2750c9(_0x3f99e8['error'][_0xd4c6('0x1f')]);}else{_0x2750c9(_0x3f99e8[_0xd4c6('0x20')]);}})['catch'](function(_0x1dee19){_0x222813(_0x1dee19);});});}function getAgent(_0x3a2c50){return db[_0xd4c6('0x21')]['findOne']({'where':{'id':_0x3a2c50,'role':_0xd4c6('0x22')}})[_0xd4c6('0x1c')](checkError());}function getAgentCheckSession(_0x5614f3,_0x406ed0){return new BPromise(function(_0x8ce066,_0x25ea15){var _0x488e7e=respondWithRpcPromise(_0xd4c6('0x23'));var _0x3b656d=getAgent(_0x5614f3);Promise[_0xd4c6('0x24')]([_0x488e7e,_0x3b656d])[_0xd4c6('0x1c')](function(_0x2e8c34){var _0x160330=_0x2e8c34[0x0];var _0x41a8d2=_0x2e8c34[0x1];var _0x1f32d8=_[_0xd4c6('0x25')](_0x160330[_0xd4c6('0x26')],function(_0x441119){return _0x441119[_0xd4c6('0x27')]==_0x41a8d2['id']&&_0x441119[_0xd4c6('0x28')]==_0x406ed0;});if(_0x1f32d8[_0xd4c6('0x29')]==0x1){_0x8ce066(_0x41a8d2);}else{_0x25ea15(new RangeError('sessionId\x20'+_0x406ed0+_0xd4c6('0x2a')));}});});}exports[_0xd4c6('0x2b')]=function(_0x32deb7,_0x38d423){logger['info']('originate\x20fired:',_0x32deb7['body']);var _0x103ac3=originateValidation[_0xd4c6('0xd')](_0x32deb7[_0xd4c6('0x2c')]);if(_0x103ac3[_0xd4c6('0x29')]>0x0){return _0x38d423[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x103ac3);}var _0x1615ff=_0x32deb7['body'][_0xd4c6('0x2e')];var _0x3ae596=_0x32deb7[_0xd4c6('0x2c')]['callNumber'];var _0x24a716=_0x32deb7[_0xd4c6('0x2c')][_0xd4c6('0x2f')];var _0x4c69af=_0x32deb7[_0xd4c6('0x2c')][_0xd4c6('0x30')];return getAgent(_0x1615ff)[_0xd4c6('0x1c')](function(_0xe5aa2d){logger['info'](_0xd4c6('0x31'),_0xe5aa2d[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')](_0xd4c6('0x33'),_0xe5aa2d[_0xd4c6('0x18')]),'webbar:originate',{'callNumber':_0x3ae596,'callerId':_0x24a716,'callbackUrl':_0x4c69af});return _0x38d423[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x34')});})[_0xd4c6('0x35')](handleError(_0x38d423));};exports[_0xd4c6('0x36')]=function(_0x2cdb9d,_0x554666){logger[_0xd4c6('0x13')](_0xd4c6('0x37'),_0x2cdb9d[_0xd4c6('0x2c')]);var _0x5f4060=hangupValidation[_0xd4c6('0xd')](_0x2cdb9d[_0xd4c6('0x2c')]);if(_0x5f4060[_0xd4c6('0x29')]>0x0){return _0x554666[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5f4060);}var _0x20a4e8=_0x2cdb9d[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x2e1768=_0x2cdb9d['body'][_0xd4c6('0x28')];return getAgent(_0x20a4e8)['then'](function(_0x55063c){logger[_0xd4c6('0x13')](_0xd4c6('0x31'),_0x55063c[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')](_0xd4c6('0x33'),_0x55063c['name']),'webbar:hangup',{'sessionId':_0x2e1768});return _0x554666[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x38')});})[_0xd4c6('0x35')](handleError(_0x554666));};exports['answer']=function(_0x211d47,_0x494811){logger[_0xd4c6('0x13')](_0xd4c6('0x39'),_0x211d47[_0xd4c6('0x2c')]);var _0x51585c=answerValidation[_0xd4c6('0xd')](_0x211d47[_0xd4c6('0x2c')]);if(_0x51585c[_0xd4c6('0x29')]>0x0){return _0x494811[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x51585c);}var _0x3ef1b0=_0x211d47[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x343d94=_0x211d47['body'][_0xd4c6('0x28')];return getAgent(_0x3ef1b0)[_0xd4c6('0x1c')](function(_0xefcd5){logger['info'](_0xd4c6('0x31'),_0xefcd5[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')]('user:%s',_0xefcd5['name']),_0xd4c6('0x3a'),{'sessionId':_0x343d94});return _0x494811[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0xd4c6('0x35')](handleError(_0x494811));};exports[_0xd4c6('0x3b')]=function(_0x1a53e9,_0x258a95){logger[_0xd4c6('0x13')](_0xd4c6('0x3c'),_0x1a53e9['body']);var _0x22298a=holdValidation[_0xd4c6('0xd')](_0x1a53e9[_0xd4c6('0x2c')]);if(_0x22298a[_0xd4c6('0x29')]>0x0){return _0x258a95[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x22298a);}var _0x34fb42=_0x1a53e9[_0xd4c6('0x2c')]['userId'];var _0x4f26fc=_0x1a53e9[_0xd4c6('0x2c')][_0xd4c6('0x28')];return getAgent(_0x34fb42)[_0xd4c6('0x1c')](function(_0x5bb875){logger[_0xd4c6('0x13')](_0xd4c6('0x31'),_0x5bb875[_0xd4c6('0x18')]);emit(util['format'](_0xd4c6('0x33'),_0x5bb875[_0xd4c6('0x18')]),_0xd4c6('0x3d'),{'sessionId':_0x4f26fc});return _0x258a95[_0xd4c6('0x1a')](0xc8)['json']({'error':![],'message':_0xd4c6('0x3e')});})[_0xd4c6('0x35')](handleError(_0x258a95));};exports[_0xd4c6('0x3f')]=function(_0x14279d,_0x291837){logger[_0xd4c6('0x13')](_0xd4c6('0x40'),_0x14279d['body']);var _0x304f96=unholdValidation[_0xd4c6('0xd')](_0x14279d[_0xd4c6('0x2c')]);if(_0x304f96['length']>0x0){return _0x291837[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x304f96);}var _0x46bf10=_0x14279d[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x3e6df8=_0x14279d[_0xd4c6('0x2c')]['sessionId'];return getAgent(_0x46bf10)[_0xd4c6('0x1c')](function(_0x4a3092){logger['info'](_0xd4c6('0x31'),_0x4a3092['name']);emit(util[_0xd4c6('0x32')]('user:%s',_0x4a3092[_0xd4c6('0x18')]),'webbar:unhold',{'sessionId':_0x3e6df8});return _0x291837['status'](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x41')});})[_0xd4c6('0x35')](handleError(_0x291837));};exports[_0xd4c6('0x42')]=function(_0x5639b6,_0x241e6c){logger[_0xd4c6('0x13')](_0xd4c6('0x43'),_0x241e6c[_0xd4c6('0x2c')]);var _0x5e52db=callsValidation[_0xd4c6('0xd')](_0x5639b6[_0xd4c6('0x2c')]);if(_0x5e52db[_0xd4c6('0x29')]>0x0){return _0x241e6c[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5e52db);}var _0x1525a4=_0x5639b6[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x106710=respondWithRpcPromise(_0xd4c6('0x23'));var _0xe07a2d=getAgent(_0x1525a4);return Promise['all']([_0x106710,_0xe07a2d])['then'](function(_0x2dab4a){var _0x11c37d=_0x2dab4a[0x0];var _0x558ce2=_0x2dab4a[0x1];var _0x5179af=_['filter'](_0x11c37d[_0xd4c6('0x26')],function(_0x218250){return _0x218250['UserId']==_0x558ce2['id'];});return _0x241e6c['status'](0xc8)[_0xd4c6('0x2d')]({'count':_0x5179af[_0xd4c6('0x29')],'rows':_0x5179af});})[_0xd4c6('0x35')](handleError(_0x241e6c));};exports[_0xd4c6('0x44')]=function(_0x226549,_0x516e12){logger[_0xd4c6('0x13')](_0xd4c6('0x45'),_0x226549[_0xd4c6('0x2c')]);var _0x26cff1=conferenceValidation[_0xd4c6('0xd')](_0x226549[_0xd4c6('0x2c')]);if(_0x26cff1[_0xd4c6('0x29')]>0x0){return _0x516e12[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x26cff1);}var _0x20b5b9=_0x226549[_0xd4c6('0x2c')][_0xd4c6('0x2e')];return getAgent(_0x20b5b9)[_0xd4c6('0x1c')](function(_0x5a0400){logger['info'](_0xd4c6('0x31'),_0x5a0400['name']);emit(util['format']('user:%s',_0x5a0400[_0xd4c6('0x18')]),_0xd4c6('0x46'));return _0x516e12[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0xd4c6('0x35')](handleError(_0x516e12));};exports[_0xd4c6('0x47')]=function(_0x53dcea,_0x705041){logger[_0xd4c6('0x13')](_0xd4c6('0x48'),_0x53dcea[_0xd4c6('0x2c')]);var _0x5cf823=transferValidation[_0xd4c6('0xd')](_0x53dcea[_0xd4c6('0x2c')]);if(_0x5cf823['length']>0x0){return _0x705041[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5cf823);}var _0x5ae295=_0x53dcea[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x4cdf5f=_0x53dcea[_0xd4c6('0x2c')]['sessionId'];var _0x7aef4=_0x53dcea[_0xd4c6('0x2c')][_0xd4c6('0x49')];return getAgent(_0x5ae295)[_0xd4c6('0x1c')](function(_0x2a8448){logger[_0xd4c6('0x13')]('entityFound:',_0x2a8448[_0xd4c6('0x18')]);emit(util['format'](_0xd4c6('0x33'),_0x2a8448[_0xd4c6('0x18')]),'webbar:transfer',{'sessionId':_0x4cdf5f,'transferNumber':_0x7aef4});return _0x705041[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x4a')});})['catch'](handleError(_0x705041));}; \ No newline at end of file +var _0xb7c8=['log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','format','user:%s','originate\x20executed!','hangup','entityFound:','answer','answer\x20fired:','answer\x20executed!','hold','webbar:hold','hold\x20executed!','catch','unhold','unhold\x20fired:','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify'];(function(_0x2994cb,_0x9bb51e){var _0x300862=function(_0x59d02d){while(--_0x59d02d){_0x2994cb['push'](_0x2994cb['shift']());}};_0x300862(++_0x9bb51e);}(_0xb7c8,0x119));var _0x8b7c=function(_0x3f8544,_0x38b6fb){_0x3f8544=_0x3f8544-0x0;var _0xa28ea=_0xb7c8[_0x3f8544];return _0xa28ea;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8b7c('0x0'));var db=require(_0x8b7c('0x1'))['db'];var config=require(_0x8b7c('0x2'));var util=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var jayson=require(_0x8b7c('0x5'));var amiClient=jayson[_0x8b7c('0x6')]['http']({'port':0x232a});var logger=require(_0x8b7c('0x7'))(_0x8b7c('0x8'));var Redis=require(_0x8b7c('0x9'));config[_0x8b7c('0xa')]=_[_0x8b7c('0xb')](config[_0x8b7c('0xa')],{'host':_0x8b7c('0xc'),'port':0x18eb});var io=require(_0x8b7c('0xd'))(new Redis(config[_0x8b7c('0xa')]));var Schema=require(_0x8b7c('0xe'));var originateValidation=new Schema({'userId':{'type':_0x8b7c('0xf'),'required':[!![],_0x8b7c('0x10')]},'callNumber':{'type':'string','required':[!![],_0x8b7c('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x8b7c('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x8b7c('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8b7c('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8b7c('0xf'),'required':[!![],_0x8b7c('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8b7c('0x10')]},'sessionId':{'type':_0x8b7c('0x12'),'required':[!![],_0x8b7c('0x13')]},'transferNumber':{'type':_0x8b7c('0x12'),'required':[!![],_0x8b7c('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x8b7c('0xf'),'required':[!![],_0x8b7c('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8b7c('0xf'),'required':[!![],_0x8b7c('0x10')]},'sessionId':{'type':_0x8b7c('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8b7c('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8b7c('0xf'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x3b8d62,_0xcc0fcc,_0x4262b5){logger[_0x8b7c('0x15')](_0x3b8d62,_0xcc0fcc,JSON[_0x8b7c('0x16')](_0x4262b5));io['to'](_0x3b8d62)['emit'](_0xcc0fcc,_0x4262b5);}function handleError(_0x402448){return function(_0x3ef583){console[_0x8b7c('0x17')](_0x8b7c('0x18'),_0x3ef583,_0x3ef583 instanceof RangeError);logger[_0x8b7c('0x19')](_0x3ef583['stack']);if(_0x3ef583 instanceof RangeError){if(_0x3ef583[_0x8b7c('0x1a')]){delete _0x3ef583[_0x8b7c('0x1a')];}_0x402448[_0x8b7c('0x1b')](0x194)[_0x8b7c('0x1c')](_0x3ef583);}else{if(_0x3ef583[_0x8b7c('0x1a')]){delete _0x3ef583[_0x8b7c('0x1a')];}_0x402448[_0x8b7c('0x1b')](0x1f4)[_0x8b7c('0x1c')](_0x3ef583);}};}function checkError(){return function(_0x108781){if(!_0x108781){throw new RangeError(_0x8b7c('0x1d'));}return _0x108781;};}function respondWithRpcPromise(_0x32bac0,_0x1fe931){return new BPromise(function(_0x53451d,_0x4222ab){var _0x3186cd=amiClient;return _0x3186cd[_0x8b7c('0x1e')](_0x32bac0,_0x1fe931)[_0x8b7c('0x1f')](function(_0x9365e3){if(_0x9365e3[_0x8b7c('0x19')]){if(_0x9365e3[_0x8b7c('0x19')][_0x8b7c('0x20')]===0x1f4){return _0x4222ab(_0x9365e3[_0x8b7c('0x19')][_0x8b7c('0x21')]);}return _0x53451d(_0x9365e3['error']['message']);}else{_0x53451d(_0x9365e3[_0x8b7c('0x22')]);}})['catch'](function(_0x28e8ba){_0x4222ab(_0x28e8ba);});});}function getAgent(_0x341ff6){return db[_0x8b7c('0x23')][_0x8b7c('0x24')]({'where':{'id':_0x341ff6,'role':_0x8b7c('0x25')}})[_0x8b7c('0x1f')](checkError());}function getAgentCheckSession(_0x58dc4a,_0x39d677){return new BPromise(function(_0x31390d,_0x19c015){var _0x94a31e=respondWithRpcPromise(_0x8b7c('0x26'));var _0x3c4b0c=getAgent(_0x58dc4a);Promise[_0x8b7c('0x27')]([_0x94a31e,_0x3c4b0c])[_0x8b7c('0x1f')](function(_0x329998){var _0x148d1f=_0x329998[0x0];var _0x57f97d=_0x329998[0x1];var _0x4bfe5d=_[_0x8b7c('0x28')](_0x148d1f[_0x8b7c('0x29')],function(_0x101649){return _0x101649[_0x8b7c('0x2a')]==_0x57f97d['id']&&_0x101649[_0x8b7c('0x2b')]==_0x39d677;});if(_0x4bfe5d[_0x8b7c('0x2c')]==0x1){_0x31390d(_0x57f97d);}else{_0x19c015(new RangeError(_0x8b7c('0x2d')+_0x39d677+_0x8b7c('0x2e')));}});});}exports[_0x8b7c('0x2f')]=function(_0xfd1e12,_0x57406f){logger[_0x8b7c('0x15')]('originate\x20fired:',_0xfd1e12[_0x8b7c('0x30')]);var _0x254e50=originateValidation['validate'](_0xfd1e12[_0x8b7c('0x30')]);if(_0x254e50['length']>0x0){return _0x57406f[_0x8b7c('0x1b')](0x190)[_0x8b7c('0x31')](_0x254e50);}var _0x2910c5=_0xfd1e12[_0x8b7c('0x30')][_0x8b7c('0x32')];var _0x1e9438=_0xfd1e12[_0x8b7c('0x30')][_0x8b7c('0x33')];var _0x3f16d3=_0xfd1e12['body'][_0x8b7c('0x34')];var _0x2e1ad5=_0xfd1e12['body']['callbackUrl'];return getAgent(_0x2910c5)['then'](function(_0x1b3ff0){logger[_0x8b7c('0x15')]('entityFound:',_0x1b3ff0[_0x8b7c('0x1a')]);emit(util[_0x8b7c('0x35')](_0x8b7c('0x36'),_0x1b3ff0[_0x8b7c('0x1a')]),'webbar:originate',{'callNumber':_0x1e9438,'callerId':_0x3f16d3,'callbackUrl':_0x2e1ad5});return _0x57406f[_0x8b7c('0x1b')](0xc8)[_0x8b7c('0x31')]({'error':![],'message':_0x8b7c('0x37')});})['catch'](handleError(_0x57406f));};exports[_0x8b7c('0x38')]=function(_0x10f6a9,_0x517dab){logger['info']('hangup\x20fired:',_0x10f6a9[_0x8b7c('0x30')]);var _0x3236dd=hangupValidation[_0x8b7c('0xe')](_0x10f6a9[_0x8b7c('0x30')]);if(_0x3236dd[_0x8b7c('0x2c')]>0x0){return _0x517dab[_0x8b7c('0x1b')](0x190)['json'](_0x3236dd);}var _0x3da514=_0x10f6a9[_0x8b7c('0x30')][_0x8b7c('0x32')];var _0x3bc968=_0x10f6a9[_0x8b7c('0x30')][_0x8b7c('0x2b')];return getAgent(_0x3da514)['then'](function(_0x2458b2){logger[_0x8b7c('0x15')](_0x8b7c('0x39'),_0x2458b2[_0x8b7c('0x1a')]);emit(util[_0x8b7c('0x35')](_0x8b7c('0x36'),_0x2458b2['name']),'webbar:hangup',{'sessionId':_0x3bc968});return _0x517dab[_0x8b7c('0x1b')](0xc8)[_0x8b7c('0x31')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x517dab));};exports[_0x8b7c('0x3a')]=function(_0x3119be,_0x3a226e){logger[_0x8b7c('0x15')](_0x8b7c('0x3b'),_0x3119be[_0x8b7c('0x30')]);var _0xcdd5a7=answerValidation[_0x8b7c('0xe')](_0x3119be[_0x8b7c('0x30')]);if(_0xcdd5a7[_0x8b7c('0x2c')]>0x0){return _0x3a226e[_0x8b7c('0x1b')](0x190)[_0x8b7c('0x31')](_0xcdd5a7);}var _0x5aec7d=_0x3119be[_0x8b7c('0x30')][_0x8b7c('0x32')];var _0x1afec7=_0x3119be[_0x8b7c('0x30')][_0x8b7c('0x2b')];return getAgent(_0x5aec7d)['then'](function(_0x5b7c4b){logger[_0x8b7c('0x15')](_0x8b7c('0x39'),_0x5b7c4b[_0x8b7c('0x1a')]);emit(util[_0x8b7c('0x35')](_0x8b7c('0x36'),_0x5b7c4b[_0x8b7c('0x1a')]),'webbar:answer',{'sessionId':_0x1afec7});return _0x3a226e['status'](0xc8)[_0x8b7c('0x31')]({'error':![],'message':_0x8b7c('0x3c')});})['catch'](handleError(_0x3a226e));};exports[_0x8b7c('0x3d')]=function(_0x18dea0,_0x3a8d52){logger['info']('hold\x20fired:',_0x18dea0[_0x8b7c('0x30')]);var _0x49a65a=holdValidation[_0x8b7c('0xe')](_0x18dea0[_0x8b7c('0x30')]);if(_0x49a65a[_0x8b7c('0x2c')]>0x0){return _0x3a8d52[_0x8b7c('0x1b')](0x190)[_0x8b7c('0x31')](_0x49a65a);}var _0x39219c=_0x18dea0[_0x8b7c('0x30')]['userId'];var _0x6179ec=_0x18dea0[_0x8b7c('0x30')][_0x8b7c('0x2b')];return getAgent(_0x39219c)[_0x8b7c('0x1f')](function(_0x5d5758){logger['info']('entityFound:',_0x5d5758[_0x8b7c('0x1a')]);emit(util[_0x8b7c('0x35')](_0x8b7c('0x36'),_0x5d5758['name']),_0x8b7c('0x3e'),{'sessionId':_0x6179ec});return _0x3a8d52[_0x8b7c('0x1b')](0xc8)[_0x8b7c('0x31')]({'error':![],'message':_0x8b7c('0x3f')});})[_0x8b7c('0x40')](handleError(_0x3a8d52));};exports[_0x8b7c('0x41')]=function(_0x58c25a,_0x2584fe){logger[_0x8b7c('0x15')](_0x8b7c('0x42'),_0x58c25a['body']);var _0x2c85c1=unholdValidation[_0x8b7c('0xe')](_0x58c25a[_0x8b7c('0x30')]);if(_0x2c85c1[_0x8b7c('0x2c')]>0x0){return _0x2584fe['status'](0x190)['json'](_0x2c85c1);}var _0x3e007d=_0x58c25a[_0x8b7c('0x30')]['userId'];var _0x36b1e2=_0x58c25a[_0x8b7c('0x30')][_0x8b7c('0x2b')];return getAgent(_0x3e007d)['then'](function(_0xa4e02e){logger[_0x8b7c('0x15')](_0x8b7c('0x39'),_0xa4e02e[_0x8b7c('0x1a')]);emit(util[_0x8b7c('0x35')](_0x8b7c('0x36'),_0xa4e02e['name']),'webbar:unhold',{'sessionId':_0x36b1e2});return _0x2584fe[_0x8b7c('0x1b')](0xc8)[_0x8b7c('0x31')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x2584fe));};exports['calls']=function(_0x2c9d16,_0x5b5817){logger['info'](_0x8b7c('0x43'),_0x5b5817['body']);var _0x2746fb=callsValidation[_0x8b7c('0xe')](_0x2c9d16[_0x8b7c('0x30')]);if(_0x2746fb[_0x8b7c('0x2c')]>0x0){return _0x5b5817[_0x8b7c('0x1b')](0x190)['json'](_0x2746fb);}var _0x13175e=_0x2c9d16[_0x8b7c('0x30')][_0x8b7c('0x32')];var _0x313361=respondWithRpcPromise(_0x8b7c('0x26'));var _0xda5984=getAgent(_0x13175e);return Promise[_0x8b7c('0x27')]([_0x313361,_0xda5984])[_0x8b7c('0x1f')](function(_0x3db1a6){var _0x2a50e3=_0x3db1a6[0x0];var _0x210b13=_0x3db1a6[0x1];var _0x26c0a2=_['filter'](_0x2a50e3[_0x8b7c('0x29')],function(_0x32d2e4){return _0x32d2e4['UserId']==_0x210b13['id'];});return _0x5b5817['status'](0xc8)['json']({'count':_0x26c0a2[_0x8b7c('0x2c')],'rows':_0x26c0a2});})[_0x8b7c('0x40')](handleError(_0x5b5817));};exports[_0x8b7c('0x44')]=function(_0x4b8075,_0x8350ad){logger[_0x8b7c('0x15')](_0x8b7c('0x45'),_0x4b8075[_0x8b7c('0x30')]);var _0x14e49b=conferenceValidation['validate'](_0x4b8075[_0x8b7c('0x30')]);if(_0x14e49b[_0x8b7c('0x2c')]>0x0){return _0x8350ad[_0x8b7c('0x1b')](0x190)[_0x8b7c('0x31')](_0x14e49b);}var _0x263dde=_0x4b8075[_0x8b7c('0x30')][_0x8b7c('0x32')];return getAgent(_0x263dde)[_0x8b7c('0x1f')](function(_0x713761){logger[_0x8b7c('0x15')](_0x8b7c('0x39'),_0x713761['name']);emit(util[_0x8b7c('0x35')](_0x8b7c('0x36'),_0x713761[_0x8b7c('0x1a')]),_0x8b7c('0x46'));return _0x8350ad[_0x8b7c('0x1b')](0xc8)[_0x8b7c('0x31')]({'error':![],'message':_0x8b7c('0x47')});})[_0x8b7c('0x40')](handleError(_0x8350ad));};exports[_0x8b7c('0x48')]=function(_0xd1d677,_0x1e3817){logger[_0x8b7c('0x15')](_0x8b7c('0x49'),_0xd1d677[_0x8b7c('0x30')]);var _0x24f291=transferValidation[_0x8b7c('0xe')](_0xd1d677[_0x8b7c('0x30')]);if(_0x24f291[_0x8b7c('0x2c')]>0x0){return _0x1e3817[_0x8b7c('0x1b')](0x190)[_0x8b7c('0x31')](_0x24f291);}var _0x526e69=_0xd1d677['body']['userId'];var _0x13d420=_0xd1d677[_0x8b7c('0x30')][_0x8b7c('0x2b')];var _0xa42d22=_0xd1d677[_0x8b7c('0x30')]['transferNumber'];return getAgent(_0x526e69)[_0x8b7c('0x1f')](function(_0x2a3e3a){logger[_0x8b7c('0x15')]('entityFound:',_0x2a3e3a['name']);emit(util[_0x8b7c('0x35')]('user:%s',_0x2a3e3a['name']),_0x8b7c('0x4a'),{'sessionId':_0x13d420,'transferNumber':_0xa42d22});return _0x1e3817[_0x8b7c('0x1b')](0xc8)[_0x8b7c('0x31')]({'error':![],'message':_0x8b7c('0x4b')});})['catch'](handleError(_0x1e3817));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8150c06..906d7f0 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 _0x7a54=['index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','getApplications','post','create','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','/:id','delete','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x5a4a08,_0x2b237f){var _0xdcff44=function(_0x3eb4ff){while(--_0x3eb4ff){_0x5a4a08['push'](_0x5a4a08['shift']());}};_0xdcff44(++_0x2b237f);}(_0x7a54,0x106));var _0x47a5=function(_0x3c8b91,_0x5664dc){_0x3c8b91=_0x3c8b91-0x0;var _0x19cad2=_0x7a54[_0x3c8b91];return _0x19cad2;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/applications',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x13')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x14')]);router[_0x47a5('0x13')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['addDisposition']);router[_0x47a5('0x13')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x16')]);router[_0x47a5('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x47a5('0x17')]);router['post']('/:id/applications',auth[_0x47a5('0xc')](),controller[_0x47a5('0x18')]);router[_0x47a5('0x13')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x13')](_0x47a5('0x1b'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['put'](_0x47a5('0x1d'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0x1e')](_0x47a5('0x1d'),auth[_0x47a5('0xc')](),controller['destroy']);router[_0x47a5('0x1e')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1f')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['removeAnswers']);router[_0x47a5('0x1e')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x20')]);module[_0x47a5('0x21')]=router; \ No newline at end of file +var _0x4975=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','/:id/users','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x2d6db1,_0x9a6781){var _0x6379dc=function(_0x4c56dd){while(--_0x4c56dd){_0x2d6db1['push'](_0x2d6db1['shift']());}};_0x6379dc(++_0x9a6781);}(_0x4975,0x86));var _0x5497=function(_0x1f7a0e,_0x1db9da){_0x1f7a0e=_0x1f7a0e-0x0;var _0x23495f=_0x4975[_0x1f7a0e];return _0x23495f;};'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('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router[_0x5497('0xa')](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x17')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x18')]);router[_0x5497('0x17')]('/:id/dispositions',auth[_0x5497('0xd')](),controller['addDisposition']);router[_0x5497('0x17')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller[_0x5497('0x19')]);router[_0x5497('0x17')](_0x5497('0x1a'),auth[_0x5497('0xd')](),controller['addAgents']);router['post'](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x1b')]);router['post'](_0x5497('0x1c'),controller[_0x5497('0x1d')]);router[_0x5497('0x17')](_0x5497('0x1e'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);router[_0x5497('0x20')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x21')]);router[_0x5497('0x22')]('/:id',auth[_0x5497('0xd')](),controller['destroy']);router[_0x5497('0x22')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x23')]);router[_0x5497('0x22')](_0x5497('0x13'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x5497('0x22')](_0x5497('0x1a'),auth[_0x5497('0xd')](),controller[_0x5497('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a2e22cb..bb24b32 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 _0x0a71=['ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0a71,0x113));var _0x10a7=function(_0x5dea53,_0x27c45d){_0x5dea53=_0x5dea53-0x0;var _0x443233=_0x0a71[_0x5dea53];return _0x443233;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x10a7('0x0'));module[_0x10a7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x10a7('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x10a7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x10a7('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x10a7('0x4')]();}},'phone':{'type':Sequelize[_0x10a7('0x3')]},'type':{'type':Sequelize[_0x10a7('0x5')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0x10a7('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x10a7('0x3')]},'notificationTemplate':{'type':Sequelize[_0x10a7('0x6')],'defaultValue':function(){return _0x10a7('0x7');}},'notificationSound':{'type':Sequelize[_0x10a7('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x10a7('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x10a7('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x10a7('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x10a7('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x10a7('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x10a7('0xa'),'set':function(_0xc1f8a4){if(!_0xc1f8a4){this[_0x10a7('0xb')](_0x10a7('0xc'),null);}this[_0x10a7('0xb')](_0x10a7('0xd'),_0xc1f8a4);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4713=['name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x511b28,_0x410e28){var _0x1864e1=function(_0x4b1b3e){while(--_0x4b1b3e){_0x511b28['push'](_0x511b28['shift']());}};_0x1864e1(++_0x410e28);}(_0x4713,0x1cc));var _0x3471=function(_0x253141,_0x396c1e){_0x253141=_0x253141-0x0;var _0x4472f3=_0x4713[_0x253141];return _0x4472f3;};'use strict';var Sequelize=require(_0x3471('0x0'));var rs=require(_0x3471('0x1'));module[_0x3471('0x2')]={'name':{'type':Sequelize[_0x3471('0x3')],'unique':_0x3471('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3471('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x3471('0x3')],'defaultValue':function(){return rs[_0x3471('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3471('0x6')](_0x3471('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0x3471('0x3')]},'baseUrl':{'type':Sequelize[_0x3471('0x3')]},'authToken':{'type':Sequelize[_0x3471('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3471('0x8')],'defaultValue':function(){return _0x3471('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3471('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3471('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3471('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3471('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3471('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3471('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3471('0xa')],'defaultValue':![],'comment':_0x3471('0xc'),'set':function(_0x38e8b8){if(!_0x38e8b8){this[_0x3471('0xd')](_0x3471('0xe'),null);}this[_0x3471('0xd')](_0x3471('0xf'),_0x38e8b8);}},'description':{'type':Sequelize[_0x3471('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 25d6c7d..e89b34a 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 _0x7d74=['WhatsappAccounts','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','rows','removeAnswers','addAgents','omit','spread','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','twilio','from','From','replace','Body','messageId','notifications','message_id','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','user','out','Messages','dataValues','eml-format','rimraf','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','params','keys','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get'];(function(_0x4ac1d0,_0x516c27){var _0x202219=function(_0x1f7016){while(--_0x1f7016){_0x4ac1d0['push'](_0x4ac1d0['shift']());}};_0x202219(++_0x516c27);}(_0x7d74,0x11e));var _0x47d7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7d74[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x47d7('0x0'));var rimraf=require(_0x47d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x47d7('0x2'));var moment=require(_0x47d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x47d7('0x4'));var util=require('util');var path=require(_0x47d7('0x5'));var sox=require('sox');var csv=require(_0x47d7('0x6'));var ejs=require(_0x47d7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47d7('0x8'));var squel=require(_0x47d7('0x9'));var crypto=require(_0x47d7('0xa'));var jsforce=require(_0x47d7('0xb'));var deskjs=require(_0x47d7('0xc'));var toCsv=require(_0x47d7('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47d7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x47d7('0xe'));var as=require(_0x47d7('0xf'));var hardwareService=require(_0x47d7('0x10'));var logger=require(_0x47d7('0x11'))(_0x47d7('0x12'));var utils=require(_0x47d7('0x13'));var config=require(_0x47d7('0x14'));var licenseUtil=require(_0x47d7('0x15'));var db=require(_0x47d7('0x16'))['db'];config[_0x47d7('0x17')]=_[_0x47d7('0x18')](config[_0x47d7('0x17')],{'host':_0x47d7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47d7('0x17')]));require(_0x47d7('0x1a'))[_0x47d7('0x1b')](socket);var jayson=require(_0x47d7('0x1c'));var client=jayson[_0x47d7('0x1d')][_0x47d7('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3d5936,_0x44a8db,_0x231e8d,_0x57f096){return new BPromise(function(_0x36ba07,_0x1f0031){var _0x6eac23=_0x57f096||client;return _0x6eac23[_0x47d7('0x1f')](_0x3d5936,_0x231e8d)[_0x47d7('0x20')](function(_0x498d97){logger[_0x47d7('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x44a8db,_0x47d7('0x22'));logger[_0x47d7('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x44a8db,_0x47d7('0x22'),JSON[_0x47d7('0x24')](_0x498d97));if(_0x498d97[_0x47d7('0x25')]){if(_0x498d97[_0x47d7('0x25')][_0x47d7('0x26')]===0x1f4){logger[_0x47d7('0x25')](_0x47d7('0x27'),_0x44a8db,_0x498d97[_0x47d7('0x25')]['message']);return _0x1f0031(_0x498d97[_0x47d7('0x25')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x44a8db,_0x498d97[_0x47d7('0x25')][_0x47d7('0x28')]);return _0x36ba07(_0x498d97[_0x47d7('0x25')][_0x47d7('0x28')]);}else{logger[_0x47d7('0x21')](_0x47d7('0x27'),_0x44a8db,_0x47d7('0x22'));_0x36ba07(_0x498d97[_0x47d7('0x29')][_0x47d7('0x28')]);}})[_0x47d7('0x2a')](function(_0x1048eb){logger[_0x47d7('0x25')](_0x47d7('0x27'),_0x44a8db,_0x1048eb);_0x1f0031(_0x1048eb);});});}function respondWithStatusCode(_0x186400,_0x1d5399){_0x1d5399=_0x1d5399||0xcc;return function(_0x4da238){if(_0x4da238){return _0x186400[_0x47d7('0x2b')](_0x1d5399);}return _0x186400[_0x47d7('0x2c')](_0x1d5399)[_0x47d7('0x2d')]();};}function respondWithResult(_0x351cee,_0x9a0f62){_0x9a0f62=_0x9a0f62||0xc8;return function(_0x3a5416){if(_0x3a5416){return _0x351cee[_0x47d7('0x2c')](_0x9a0f62)['json'](_0x3a5416);}};}function respondWithFilteredResult(_0x343286,_0x69fb5f){return function(_0x305626){if(_0x305626){var _0x2de0ca=typeof _0x69fb5f['offset']===_0x47d7('0x2e')&&typeof _0x69fb5f['limit']===_0x47d7('0x2e');var _0x773e24=_0x305626[_0x47d7('0x2f')];var _0x127216=_0x2de0ca?0x0:_0x69fb5f[_0x47d7('0x30')];var _0x3f5ae5=_0x2de0ca?_0x305626[_0x47d7('0x2f')]:_0x69fb5f[_0x47d7('0x30')]+_0x69fb5f[_0x47d7('0x31')];var _0xfa1da1;if(_0x3f5ae5>=_0x773e24){_0x3f5ae5=_0x773e24;_0xfa1da1=0xc8;}else{_0xfa1da1=0xce;}_0x343286[_0x47d7('0x2c')](_0xfa1da1);return _0x343286['set'](_0x47d7('0x32'),_0x127216+'-'+_0x3f5ae5+'/'+_0x773e24)[_0x47d7('0x33')](_0x305626);}return null;};}function patchUpdates(_0x3268e2){return function(_0x5142ee){try{jsonpatch[_0x47d7('0x34')](_0x5142ee,_0x3268e2,!![]);}catch(_0x7a18a3){return BPromise[_0x47d7('0x35')](_0x7a18a3);}return _0x5142ee[_0x47d7('0x36')]();};}function saveUpdates(_0x5d9258,_0x58684d){return function(_0x313d57){if(_0x313d57){return _0x313d57[_0x47d7('0x37')](_0x5d9258)[_0x47d7('0x20')](function(_0x1e7da9){return _0x1e7da9;});}return null;};}function removeEntity(_0x3a3034,_0x4ebc0f){return function(_0x46c083){if(_0x46c083){return _0x46c083[_0x47d7('0x38')]()['then'](function(){var _0x412e45=_0x46c083['get']({'plain':!![]});var _0x4d1786='WhatsappAccounts';return db[_0x47d7('0x39')]['destroy']({'where':{'type':_0x4d1786,'resourceId':_0x412e45['id']}})[_0x47d7('0x20')](function(){return _0x46c083;});})['then'](function(){_0x3a3034[_0x47d7('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x442ef2,_0x4fb39e){return function(_0x3bf576){if(!_0x3bf576){_0x442ef2['sendStatus'](0x194);}return _0x3bf576;};}function handleError(_0x392f42,_0x23969e){_0x23969e=_0x23969e||0x1f4;return function(_0x4b054d){logger[_0x47d7('0x25')](_0x4b054d[_0x47d7('0x3a')]);if(_0x4b054d[_0x47d7('0x3b')]){delete _0x4b054d[_0x47d7('0x3b')];}_0x392f42[_0x47d7('0x2c')](_0x23969e)[_0x47d7('0x3c')](_0x4b054d);};}exports[_0x47d7('0x3d')]=function(_0x3f9384,_0x5cfaa3){var _0x512c11={'include':[{'model':db[_0x47d7('0x3e')],'as':_0x47d7('0x3f')}]},_0x416924={},_0x4d5d36={'count':0x0,'rows':[]};var _0x382f63=_['map'](db[_0x47d7('0x40')][_0x47d7('0x41')],function(_0x4e77dc){return{'name':_0x4e77dc[_0x47d7('0x42')],'type':_0x4e77dc[_0x47d7('0x43')]['key']};});_0x416924[_0x47d7('0x44')]=_[_0x47d7('0x45')](_0x382f63,_0x47d7('0x3b'));_0x416924[_0x47d7('0x46')]=_['keys'](_0x3f9384[_0x47d7('0x46')]);_0x416924[_0x47d7('0x47')]=_[_0x47d7('0x48')](_0x416924[_0x47d7('0x44')],_0x416924['query']);_0x512c11['attributes']=_[_0x47d7('0x48')](_0x416924[_0x47d7('0x44')],qs[_0x47d7('0x49')](_0x3f9384[_0x47d7('0x46')][_0x47d7('0x49')]));_0x512c11['attributes']=_0x512c11[_0x47d7('0x4a')][_0x47d7('0x4b')]?_0x512c11[_0x47d7('0x4a')]:_0x416924[_0x47d7('0x44')];if(!_0x3f9384[_0x47d7('0x46')][_0x47d7('0x4c')](_0x47d7('0x4d'))){_0x512c11[_0x47d7('0x31')]=qs['limit'](_0x3f9384[_0x47d7('0x46')][_0x47d7('0x31')]);_0x512c11['offset']=qs[_0x47d7('0x30')](_0x3f9384[_0x47d7('0x46')][_0x47d7('0x30')]);}_0x512c11[_0x47d7('0x4e')]=qs[_0x47d7('0x4f')](_0x3f9384['query'][_0x47d7('0x4f')]);_0x512c11[_0x47d7('0x50')]=qs[_0x47d7('0x47')](_[_0x47d7('0x51')](_0x3f9384[_0x47d7('0x46')],_0x416924['filters']),_0x382f63);if(_0x3f9384[_0x47d7('0x46')][_0x47d7('0x52')]){_0x512c11['where']=_[_0x47d7('0x53')](_0x512c11[_0x47d7('0x50')],{'$or':_['map'](_0x382f63,function(_0x1251ee){if(_0x1251ee['type']!=='VIRTUAL'){var _0x48a567={};_0x48a567[_0x1251ee[_0x47d7('0x3b')]]={'$like':'%'+_0x3f9384[_0x47d7('0x46')]['filter']+'%'};return _0x48a567;}})});}_0x512c11=_[_0x47d7('0x53')]({},_0x512c11,_0x3f9384[_0x47d7('0x54')]);var _0xdccc40={'where':_0x512c11['where']};return db['WhatsappAccount'][_0x47d7('0x2f')](_0xdccc40)['then'](function(_0xefd15e){_0x4d5d36[_0x47d7('0x2f')]=_0xefd15e;if(_0x3f9384[_0x47d7('0x46')][_0x47d7('0x55')]){_0x512c11[_0x47d7('0x56')]=[{'all':!![]}];}return db[_0x47d7('0x40')][_0x47d7('0x57')](_0x512c11);})[_0x47d7('0x20')](function(_0x601007){_0x4d5d36['rows']=_0x601007;return _0x4d5d36;})['then'](respondWithFilteredResult(_0x5cfaa3,_0x512c11))[_0x47d7('0x2a')](handleError(_0x5cfaa3,null));};exports['show']=function(_0x4d96ba,_0x4d1d71){var _0x5d70bb={'raw':![],'where':{'id':_0x4d96ba[_0x47d7('0x58')]['id']},'include':[{'model':db[_0x47d7('0x3e')],'as':'mandatoryDispositionPause'}]},_0x288fd0={};_0x288fd0[_0x47d7('0x44')]=_[_0x47d7('0x59')](db[_0x47d7('0x40')][_0x47d7('0x41')]);_0x288fd0[_0x47d7('0x46')]=_[_0x47d7('0x59')](_0x4d96ba[_0x47d7('0x46')]);_0x288fd0[_0x47d7('0x47')]=_[_0x47d7('0x48')](_0x288fd0[_0x47d7('0x44')],_0x288fd0[_0x47d7('0x46')]);_0x5d70bb['attributes']=_['intersection'](_0x288fd0[_0x47d7('0x44')],qs[_0x47d7('0x49')](_0x4d96ba[_0x47d7('0x46')][_0x47d7('0x49')]));_0x5d70bb[_0x47d7('0x4a')]=_0x5d70bb[_0x47d7('0x4a')]['length']?_0x5d70bb[_0x47d7('0x4a')]:_0x288fd0['model'];if(_0x4d96ba['query'][_0x47d7('0x55')]){_0x5d70bb[_0x47d7('0x56')]=[{'all':!![]}];}_0x5d70bb=_[_0x47d7('0x53')]({},_0x5d70bb,_0x4d96ba['options']);return db['WhatsappAccount']['find'](_0x5d70bb)['then'](handleEntityNotFound(_0x4d1d71,null))[_0x47d7('0x20')](respondWithResult(_0x4d1d71,null))['catch'](handleError(_0x4d1d71,null));};exports[_0x47d7('0x5a')]=function(_0xfd8d54,_0x2dfe3f){return db['WhatsappAccount'][_0x47d7('0x5a')](_0xfd8d54['body'],{})[_0x47d7('0x20')](function(_0x5652cd){var _0x26e350=_0xfd8d54['user']['get']({'plain':!![]});if(!_0x26e350)throw new Error(_0x47d7('0x5b'));if(_0x26e350[_0x47d7('0x5c')]==='user'){var _0xdf9cee=_0x5652cd[_0x47d7('0x5d')]({'plain':!![]});var _0x201d5b=_0x47d7('0x5e');return db['UserProfileSection'][_0x47d7('0x5f')]({'where':{'name':_0x201d5b,'userProfileId':_0x26e350['userProfileId']},'raw':!![]})['then'](function(_0x1e00f4){if(_0x1e00f4&&_0x1e00f4[_0x47d7('0x60')]===0x0){return db[_0x47d7('0x39')][_0x47d7('0x5a')]({'name':_0xdf9cee[_0x47d7('0x3b')],'resourceId':_0xdf9cee['id'],'type':_0x1e00f4[_0x47d7('0x3b')],'sectionId':_0x1e00f4['id']},{})[_0x47d7('0x20')](function(){return _0x5652cd;});}else{return _0x5652cd;}})[_0x47d7('0x2a')](function(_0x410595){logger[_0x47d7('0x25')](_0x47d7('0x61'),_0x410595);throw _0x410595;});}return _0x5652cd;})[_0x47d7('0x20')](respondWithResult(_0x2dfe3f,0xc9))['catch'](handleError(_0x2dfe3f,null));};exports['update']=function(_0x4af3c3,_0x4d237b){if(_0x4af3c3[_0x47d7('0x62')]['id']){delete _0x4af3c3[_0x47d7('0x62')]['id'];}return db[_0x47d7('0x40')][_0x47d7('0x5f')]({'where':{'id':_0x4af3c3[_0x47d7('0x58')]['id']},'include':[{'model':db[_0x47d7('0x3e')],'as':_0x47d7('0x3f')}]})['then'](handleEntityNotFound(_0x4d237b,null))[_0x47d7('0x20')](saveUpdates(_0x4af3c3[_0x47d7('0x62')],null))[_0x47d7('0x20')](respondWithResult(_0x4d237b,null))[_0x47d7('0x2a')](handleError(_0x4d237b,null));};exports[_0x47d7('0x38')]=function(_0x31e8a5,_0x88e3b7){return db[_0x47d7('0x40')][_0x47d7('0x5f')]({'where':{'id':_0x31e8a5[_0x47d7('0x58')]['id']}})[_0x47d7('0x20')](handleEntityNotFound(_0x88e3b7,null))[_0x47d7('0x20')](removeEntity(_0x88e3b7,null))[_0x47d7('0x2a')](handleError(_0x88e3b7,null));};exports[_0x47d7('0x63')]=function(_0x502272,_0x68e62){return db[_0x47d7('0x40')][_0x47d7('0x63')]()[_0x47d7('0x20')](respondWithResult(_0x68e62,null))[_0x47d7('0x2a')](handleError(_0x68e62,null));};exports[_0x47d7('0x64')]=function(_0x407b6e,_0x4987ae,_0x212ae5){if(_0x407b6e[_0x47d7('0x62')]['id']){delete _0x407b6e[_0x47d7('0x62')]['id'];}return db[_0x47d7('0x40')]['find']({'where':{'id':_0x407b6e[_0x47d7('0x58')]['id']}})['then'](handleEntityNotFound(_0x4987ae,null))['then'](function(_0x278ccf){if(_0x278ccf){_0x407b6e[_0x47d7('0x62')][_0x47d7('0x65')]=_0x278ccf['id'];return db[_0x47d7('0x66')][_0x47d7('0x5a')](_0x407b6e[_0x47d7('0x62')]);}})[_0x47d7('0x20')](respondWithResult(_0x4987ae,null))['catch'](handleError(_0x4987ae,null));};exports[_0x47d7('0x67')]=function(_0x5955df,_0x169e9f,_0x31a01f){var _0x7697b3={'raw':![],'where':{}};var _0x13e94e={};var _0x5daaa9={'count':0x0,'rows':[]};return db[_0x47d7('0x40')]['findOne']({'where':{'id':_0x5955df['params']['id']}})[_0x47d7('0x20')](handleEntityNotFound(_0x169e9f,null))['then'](function(_0x183594){if(_0x183594){_0x13e94e[_0x47d7('0x44')]=_['keys'](db[_0x47d7('0x66')][_0x47d7('0x41')]);_0x13e94e['query']=_[_0x47d7('0x59')](_0x5955df['query']);_0x13e94e[_0x47d7('0x47')]=_[_0x47d7('0x48')](_0x13e94e[_0x47d7('0x44')],_0x13e94e[_0x47d7('0x46')]);_0x7697b3[_0x47d7('0x4a')]=_[_0x47d7('0x48')](_0x13e94e[_0x47d7('0x44')],qs['fields'](_0x5955df[_0x47d7('0x46')]['fields']));_0x7697b3['attributes']=_0x7697b3[_0x47d7('0x4a')]['length']?_0x7697b3[_0x47d7('0x4a')]:_0x13e94e[_0x47d7('0x44')];if(!_0x5955df['query'][_0x47d7('0x4c')](_0x47d7('0x4d'))){_0x7697b3[_0x47d7('0x31')]=qs[_0x47d7('0x31')](_0x5955df[_0x47d7('0x46')][_0x47d7('0x31')]);_0x7697b3[_0x47d7('0x30')]=qs['offset'](_0x5955df[_0x47d7('0x46')][_0x47d7('0x30')]);}_0x7697b3[_0x47d7('0x4e')]=qs[_0x47d7('0x4f')](_0x5955df[_0x47d7('0x46')][_0x47d7('0x4f')]);_0x7697b3['where']=qs[_0x47d7('0x47')](_['pick'](_0x5955df[_0x47d7('0x46')],_0x13e94e[_0x47d7('0x47')]));_0x7697b3['where'][_0x47d7('0x65')]=_0x183594['id'];if(_0x5955df[_0x47d7('0x46')][_0x47d7('0x52')]){_0x7697b3[_0x47d7('0x50')]=_['merge'](_0x7697b3[_0x47d7('0x50')],{'$or':_[_0x47d7('0x45')](_0x7697b3[_0x47d7('0x4a')],function(_0x6a0c28){var _0x5dd0b9={};_0x5dd0b9[_0x6a0c28]={'$like':'%'+_0x5955df[_0x47d7('0x46')][_0x47d7('0x52')]+'%'};return _0x5dd0b9;})});}_0x7697b3=_[_0x47d7('0x53')]({},_0x7697b3,_0x5955df[_0x47d7('0x54')]);return db['Disposition']['count']({'where':_0x7697b3[_0x47d7('0x50')]})[_0x47d7('0x20')](function(_0x2f7dc5){_0x5daaa9[_0x47d7('0x2f')]=_0x2f7dc5;if(_0x5955df[_0x47d7('0x46')][_0x47d7('0x55')]){_0x7697b3[_0x47d7('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x47d7('0x57')](_0x7697b3);})['then'](function(_0x4dd3b8){_0x5daaa9['rows']=_0x4dd3b8;return _0x5daaa9;});}})[_0x47d7('0x20')](respondWithFilteredResult(_0x169e9f,_0x7697b3))[_0x47d7('0x2a')](handleError(_0x169e9f,null));};exports[_0x47d7('0x68')]=function(_0x140529,_0x4a0cce,_0x251792){return db[_0x47d7('0x40')][_0x47d7('0x5f')]({'where':{'id':_0x140529[_0x47d7('0x58')]['id']}})['then'](handleEntityNotFound(_0x4a0cce,null))[_0x47d7('0x20')](function(_0x3cc30e){if(_0x3cc30e){return _0x3cc30e[_0x47d7('0x68')](_0x140529['query'][_0x47d7('0x69')]);}})['then'](respondWithStatusCode(_0x4a0cce,null))[_0x47d7('0x2a')](handleError(_0x4a0cce,null));};exports[_0x47d7('0x6a')]=function(_0x1f3d10,_0x317fab,_0x16608c){if(_0x1f3d10[_0x47d7('0x62')]['id']){delete _0x1f3d10[_0x47d7('0x62')]['id'];}return db[_0x47d7('0x40')][_0x47d7('0x5f')]({'where':{'id':_0x1f3d10['params']['id']}})['then'](handleEntityNotFound(_0x317fab,null))['then'](function(_0x5d5f32){if(_0x5d5f32){_0x1f3d10[_0x47d7('0x62')][_0x47d7('0x65')]=_0x5d5f32['id'];return db[_0x47d7('0x6b')][_0x47d7('0x5a')](_0x1f3d10[_0x47d7('0x62')]);}})['then'](respondWithResult(_0x317fab,null))[_0x47d7('0x2a')](handleError(_0x317fab,null));};exports['getAnswers']=function(_0xd3cdae,_0x5c8f58,_0x3abbd5){var _0x4d535b={'raw':![],'where':{}};var _0x3fbace={};var _0x4a0fe4={'count':0x0,'rows':[]};return db[_0x47d7('0x40')][_0x47d7('0x6c')]({'where':{'id':_0xd3cdae['params']['id']}})[_0x47d7('0x20')](handleEntityNotFound(_0x5c8f58,null))[_0x47d7('0x20')](function(_0xcbc338){if(_0xcbc338){_0x3fbace[_0x47d7('0x44')]=_['keys'](db['CannedAnswer'][_0x47d7('0x41')]);_0x3fbace[_0x47d7('0x46')]=_['keys'](_0xd3cdae[_0x47d7('0x46')]);_0x3fbace[_0x47d7('0x47')]=_[_0x47d7('0x48')](_0x3fbace[_0x47d7('0x44')],_0x3fbace[_0x47d7('0x46')]);_0x4d535b[_0x47d7('0x4a')]=_[_0x47d7('0x48')](_0x3fbace['model'],qs['fields'](_0xd3cdae[_0x47d7('0x46')][_0x47d7('0x49')]));_0x4d535b[_0x47d7('0x4a')]=_0x4d535b[_0x47d7('0x4a')][_0x47d7('0x4b')]?_0x4d535b[_0x47d7('0x4a')]:_0x3fbace[_0x47d7('0x44')];if(!_0xd3cdae[_0x47d7('0x46')][_0x47d7('0x4c')]('nolimit')){_0x4d535b['limit']=qs['limit'](_0xd3cdae[_0x47d7('0x46')][_0x47d7('0x31')]);_0x4d535b[_0x47d7('0x30')]=qs[_0x47d7('0x30')](_0xd3cdae[_0x47d7('0x46')][_0x47d7('0x30')]);}_0x4d535b[_0x47d7('0x4e')]=qs[_0x47d7('0x4f')](_0xd3cdae[_0x47d7('0x46')]['sort']);_0x4d535b[_0x47d7('0x50')]=qs['filters'](_[_0x47d7('0x51')](_0xd3cdae[_0x47d7('0x46')],_0x3fbace[_0x47d7('0x47')]));_0x4d535b['where'][_0x47d7('0x65')]=_0xcbc338['id'];if(_0xd3cdae['query'][_0x47d7('0x52')]){_0x4d535b[_0x47d7('0x50')]=_[_0x47d7('0x53')](_0x4d535b['where'],{'$or':_[_0x47d7('0x45')](_0x4d535b[_0x47d7('0x4a')],function(_0x12af14){var _0x49af9e={};_0x49af9e[_0x12af14]={'$like':'%'+_0xd3cdae[_0x47d7('0x46')][_0x47d7('0x52')]+'%'};return _0x49af9e;})});}_0x4d535b=_[_0x47d7('0x53')]({},_0x4d535b,_0xd3cdae[_0x47d7('0x54')]);return db[_0x47d7('0x6b')][_0x47d7('0x2f')]({'where':_0x4d535b['where']})[_0x47d7('0x20')](function(_0x9f89df){_0x4a0fe4[_0x47d7('0x2f')]=_0x9f89df;if(_0xd3cdae['query'][_0x47d7('0x55')]){_0x4d535b[_0x47d7('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x47d7('0x57')](_0x4d535b);})[_0x47d7('0x20')](function(_0x422397){_0x4a0fe4[_0x47d7('0x6d')]=_0x422397;return _0x4a0fe4;});}})['then'](respondWithFilteredResult(_0x5c8f58,_0x4d535b))[_0x47d7('0x2a')](handleError(_0x5c8f58,null));};exports[_0x47d7('0x6e')]=function(_0x338d21,_0x18c2fc,_0x3944a0){return db[_0x47d7('0x40')][_0x47d7('0x5f')]({'where':{'id':_0x338d21[_0x47d7('0x58')]['id']}})[_0x47d7('0x20')](handleEntityNotFound(_0x18c2fc,null))[_0x47d7('0x20')](function(_0x1bcb3f){if(_0x1bcb3f){return _0x1bcb3f[_0x47d7('0x6e')](_0x338d21[_0x47d7('0x46')][_0x47d7('0x69')]);}})[_0x47d7('0x20')](respondWithStatusCode(_0x18c2fc,null))[_0x47d7('0x2a')](handleError(_0x18c2fc,null));};exports[_0x47d7('0x6f')]=function(_0x2b67c5,_0x2a7cb5,_0x1682d8){return db[_0x47d7('0x40')]['find']({'where':{'id':_0x2b67c5[_0x47d7('0x58')]['id']}})[_0x47d7('0x20')](handleEntityNotFound(_0x2a7cb5,null))[_0x47d7('0x20')](function(_0x2dd039){if(_0x2dd039){return _0x2dd039[_0x47d7('0x6f')](_0x2b67c5[_0x47d7('0x62')][_0x47d7('0x69')],_[_0x47d7('0x70')](_0x2b67c5[_0x47d7('0x62')],[_0x47d7('0x69'),'id'])||{})[_0x47d7('0x71')](function(_0x4946a8){for(var _0x140663=0x0;_0x140663<_0x2b67c5[_0x47d7('0x62')]['ids'][_0x47d7('0x4b')];_0x140663+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x2b67c5['body'][_0x47d7('0x69')][_0x140663]),'WhatsappAccountId':Number(_0x2b67c5[_0x47d7('0x58')]['id'])});}return _0x4946a8;});}})[_0x47d7('0x20')](respondWithResult(_0x2a7cb5,null))[_0x47d7('0x2a')](handleError(_0x2a7cb5,null));};exports[_0x47d7('0x72')]=function(_0x4ec8d6,_0x456330,_0x16dc9c){return db[_0x47d7('0x40')][_0x47d7('0x5f')]({'where':{'id':_0x4ec8d6[_0x47d7('0x58')]['id']}})['then'](handleEntityNotFound(_0x456330,null))[_0x47d7('0x20')](function(_0xc44dfe){if(_0xc44dfe){return _0xc44dfe[_0x47d7('0x72')](_0x4ec8d6[_0x47d7('0x46')][_0x47d7('0x69')])['then'](function(){if(_['isArray'](_0x4ec8d6[_0x47d7('0x46')][_0x47d7('0x69')])){for(var _0x507336=0x0;_0x507336<_0x4ec8d6[_0x47d7('0x46')][_0x47d7('0x69')]['length'];_0x507336+=0x1){socket[_0x47d7('0x73')](_0x47d7('0x74'),{'UserId':Number(_0x4ec8d6[_0x47d7('0x46')][_0x47d7('0x69')][_0x507336]),'WhatsappAccountId':Number(_0x4ec8d6['params']['id'])});}}else{socket[_0x47d7('0x73')](_0x47d7('0x74'),{'UserId':Number(_0x4ec8d6[_0x47d7('0x46')][_0x47d7('0x69')]),'WhatsappAccountId':Number(_0x4ec8d6[_0x47d7('0x58')]['id'])});}});}})[_0x47d7('0x20')](respondWithStatusCode(_0x456330,null))[_0x47d7('0x2a')](handleError(_0x456330,null));};exports[_0x47d7('0x75')]=function(_0x36fad5,_0x45e003,_0xcf20dc){var _0x333c78={};var _0x49916b={};var _0x5cc8d3;var _0x18357a;return db['WhatsappAccount'][_0x47d7('0x6c')]({'where':{'id':_0x36fad5['params']['id']}})[_0x47d7('0x20')](handleEntityNotFound(_0x45e003,null))[_0x47d7('0x20')](function(_0x32f3f1){if(_0x32f3f1){_0x5cc8d3=_0x32f3f1;_0x49916b[_0x47d7('0x44')]=_[_0x47d7('0x59')](db[_0x47d7('0x76')][_0x47d7('0x41')]);_0x49916b['query']=_['keys'](_0x36fad5[_0x47d7('0x46')]);_0x49916b[_0x47d7('0x47')]=_[_0x47d7('0x48')](_0x49916b[_0x47d7('0x44')],_0x49916b[_0x47d7('0x46')]);_0x333c78[_0x47d7('0x4a')]=_['intersection'](_0x49916b[_0x47d7('0x44')],qs[_0x47d7('0x49')](_0x36fad5[_0x47d7('0x46')][_0x47d7('0x49')]));_0x333c78[_0x47d7('0x4a')]=_0x333c78['attributes'][_0x47d7('0x4b')]?_0x333c78[_0x47d7('0x4a')]:_0x49916b[_0x47d7('0x44')];_0x333c78[_0x47d7('0x4e')]=qs[_0x47d7('0x4f')](_0x36fad5[_0x47d7('0x46')][_0x47d7('0x4f')]);_0x333c78[_0x47d7('0x50')]=qs[_0x47d7('0x47')](_[_0x47d7('0x51')](_0x36fad5[_0x47d7('0x46')],_0x49916b[_0x47d7('0x47')]));if(_0x36fad5['query']['filter']){_0x333c78[_0x47d7('0x50')]=_['merge'](_0x333c78[_0x47d7('0x50')],{'$or':_['map'](_0x333c78[_0x47d7('0x4a')],function(_0x4897b1){var _0x3b4a87={};_0x3b4a87[_0x4897b1]={'$like':'%'+_0x36fad5[_0x47d7('0x46')][_0x47d7('0x52')]+'%'};return _0x3b4a87;})});}_0x333c78=_[_0x47d7('0x53')]({},_0x333c78,_0x36fad5['options']);return _0x5cc8d3['getAgents'](_0x333c78);}})[_0x47d7('0x20')](function(_0x20ca23){if(_0x20ca23){_0x18357a=_0x20ca23[_0x47d7('0x4b')];if(!_0x36fad5['query'][_0x47d7('0x4c')]('nolimit')){_0x333c78[_0x47d7('0x31')]=qs[_0x47d7('0x31')](_0x36fad5[_0x47d7('0x46')][_0x47d7('0x31')]);_0x333c78[_0x47d7('0x30')]=qs['offset'](_0x36fad5[_0x47d7('0x46')][_0x47d7('0x30')]);}return _0x5cc8d3['getAgents'](_0x333c78);}})[_0x47d7('0x20')](function(_0x48e18d){if(_0x48e18d){return _0x48e18d?{'count':_0x18357a,'rows':_0x48e18d}:null;}})[_0x47d7('0x20')](respondWithResult(_0x45e003,null))[_0x47d7('0x2a')](handleError(_0x45e003,null));};exports[_0x47d7('0x77')]=function(_0x1d6399,_0x512124,_0x5ef8c3){return db[_0x47d7('0x40')]['findOne']({'where':{'id':_0x1d6399[_0x47d7('0x58')]['id']}})[_0x47d7('0x20')](handleEntityNotFound(_0x512124,null))[_0x47d7('0x20')](function(_0x18476e){if(_0x18476e){return db[_0x47d7('0x78')][_0x47d7('0x79')](function(_0x285841){return db[_0x47d7('0x7a')][_0x47d7('0x38')]({'where':{'WhatsappAccountId':_0x1d6399[_0x47d7('0x58')]['id']},'transaction':_0x285841})[_0x47d7('0x20')](function(_0x3fa26a){var _0x3fbc14=_[_0x47d7('0x45')](_0x1d6399[_0x47d7('0x62')],function(_0xb86e83){_0xb86e83[_0x47d7('0x65')]=_0x1d6399[_0x47d7('0x58')]['id'];return _0xb86e83;});return db['WhatsappApplication']['bulkCreate'](_0x3fbc14,{'transaction':_0x285841});});})[_0x47d7('0x20')](function(){return db[_0x47d7('0x7a')][_0x47d7('0x7b')]({'where':{'WhatsappAccountId':_0x1d6399[_0x47d7('0x58')]['id']},'order':_0x47d7('0x7c')});});}})[_0x47d7('0x20')](respondWithResult(_0x512124,null))[_0x47d7('0x2a')](handleError(_0x512124,null));};exports[_0x47d7('0x7d')]=function(_0x36c24f,_0x4259f6,_0x1b2294){var _0x2668f8={};var _0x5637f0={};var _0x201a00;var _0x19684c;return db[_0x47d7('0x40')][_0x47d7('0x6c')]({'where':{'id':_0x36c24f[_0x47d7('0x58')]['id']}})[_0x47d7('0x20')](handleEntityNotFound(_0x4259f6,null))[_0x47d7('0x20')](function(_0x376493){if(_0x376493){_0x201a00=_0x376493;_0x5637f0['model']=_[_0x47d7('0x59')](db[_0x47d7('0x7a')][_0x47d7('0x41')]);_0x5637f0[_0x47d7('0x46')]=_[_0x47d7('0x59')](_0x36c24f[_0x47d7('0x46')]);_0x5637f0[_0x47d7('0x47')]=_[_0x47d7('0x48')](_0x5637f0['model'],_0x5637f0[_0x47d7('0x46')]);_0x2668f8[_0x47d7('0x4a')]=_[_0x47d7('0x48')](_0x5637f0['model'],qs[_0x47d7('0x49')](_0x36c24f[_0x47d7('0x46')][_0x47d7('0x49')]));_0x2668f8['attributes']=_0x2668f8[_0x47d7('0x4a')]['length']?_0x2668f8[_0x47d7('0x4a')]:_0x5637f0[_0x47d7('0x44')];_0x2668f8[_0x47d7('0x4e')]=qs[_0x47d7('0x4f')](_0x36c24f[_0x47d7('0x46')][_0x47d7('0x4f')]);_0x2668f8[_0x47d7('0x50')]=qs[_0x47d7('0x47')](_['pick'](_0x36c24f['query'],_0x5637f0[_0x47d7('0x47')]));if(_0x36c24f['query']['filter']){_0x2668f8[_0x47d7('0x50')]=_[_0x47d7('0x53')](_0x2668f8['where'],{'$or':_['map'](_0x2668f8[_0x47d7('0x4a')],function(_0x9d22e1){var _0x4e4bb8={};_0x4e4bb8[_0x9d22e1]={'$like':'%'+_0x36c24f[_0x47d7('0x46')][_0x47d7('0x52')]+'%'};return _0x4e4bb8;})});}_0x2668f8=_[_0x47d7('0x53')]({},_0x2668f8,_0x36c24f[_0x47d7('0x54')]);return _0x201a00['getApplications'](_0x2668f8);}})[_0x47d7('0x20')](function(_0x4f5b5a){if(_0x4f5b5a){_0x19684c=_0x4f5b5a[_0x47d7('0x4b')];if(!_0x36c24f['query']['hasOwnProperty'](_0x47d7('0x4d'))){_0x2668f8[_0x47d7('0x31')]=qs[_0x47d7('0x31')](_0x36c24f[_0x47d7('0x46')][_0x47d7('0x31')]);_0x2668f8[_0x47d7('0x30')]=qs[_0x47d7('0x30')](_0x36c24f[_0x47d7('0x46')]['offset']);}return _0x201a00[_0x47d7('0x7d')](_0x2668f8);}})['then'](function(_0x21c1cc){if(_0x21c1cc){return _0x21c1cc?{'count':_0x19684c,'rows':_0x21c1cc}:null;}})[_0x47d7('0x20')](respondWithResult(_0x4259f6,null))['catch'](handleError(_0x4259f6,null));};exports[_0x47d7('0x7e')]=function(_0x294409,_0x180601,_0x4323fa){var _0x1f1d4e={'channel':_0x47d7('0x7f')};var _0xf2caaa=[];var _0x1a859b=[];var _0x4cb9d0={};return db[_0x47d7('0x40')][_0x47d7('0x5f')]({'where':{'id':_0x294409[_0x47d7('0x58')]['id']},'include':[{'model':db[_0x47d7('0x7a')],'as':_0x47d7('0x80')}]})['then'](handleEntityNotFound(_0x180601,null))[_0x47d7('0x20')](function(_0x3ebbd2){_0x1f1d4e[_0x47d7('0x81')]=_0x3ebbd2;if(_0x1f1d4e[_0x47d7('0x81')]&&_0x1f1d4e['account'][_0x47d7('0x43')]===_0x47d7('0x82')&&_0x294409[_0x47d7('0x62')][_0x47d7('0x83')]&&_0x294409[_0x47d7('0x62')]['statuses'][0x0][_0x47d7('0x84')]===_0x47d7('0x85')){if(_0x294409['body']['statuses'][0x0][_0x47d7('0x84')]!=='read')return;return db[_0x47d7('0x86')][_0x47d7('0x37')]({'read':!![],'readAt':_0x294409[_0x47d7('0x62')][_0x47d7('0x83')][0x0][_0x47d7('0x87')]},{'where':{'messageId':_0x294409['body'][_0x47d7('0x83')][0x0]['message_id']},'individualHooks':!![]})[_0x47d7('0x20')](function(_0x1445bc){return _0x180601[_0x47d7('0x2c')](0xc8)[_0x47d7('0x33')](_0x1445bc);});}_0x1f1d4e[_0x47d7('0x88')]=_[_0x47d7('0x89')](_0x3ebbd2[_0x47d7('0x80')],['priority'],[_0x47d7('0x8a')]);if(_0x1f1d4e[_0x47d7('0x81')][_0x47d7('0x80')]){delete _0x1f1d4e[_0x47d7('0x81')][_0x47d7('0x80')];}return db[_0x47d7('0x8b')][_0x47d7('0x63')]()['then'](function(_0x2e6fab){if(!_0x2e6fab){throw new db[(_0x47d7('0x8c'))][(_0x47d7('0x8d'))](_0x47d7('0x8e'));}_0xf2caaa=_[_0x47d7('0x8f')](_[_0x47d7('0x59')](_0x2e6fab),['createdAt',_0x47d7('0x90')]);_0x1a859b=_[_0x47d7('0x8f')](_['keys'](_0x2e6fab),['createdAt',_0x47d7('0x90'),_0x47d7('0x91'),_0x47d7('0x92')]);_0x1f1d4e['body']={'mapKey':'mobile'};if(_0x1f1d4e['account']&&_0x1f1d4e['account']['type']===_0x47d7('0x93')){_0x1f1d4e['body'][_0x47d7('0x94')]=_0x294409[_0x47d7('0x62')][_0x47d7('0x95')][_0x47d7('0x96')]('whatsapp:','');_0x1f1d4e['body'][_0x47d7('0x62')]=_0x294409['body'][_0x47d7('0x97')];_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x98')]=_0x294409[_0x47d7('0x62')]['MessageSid'];}if(_0x1f1d4e['account']&&_0x1f1d4e[_0x47d7('0x81')][_0x47d7('0x43')]===_0x47d7('0x82')){_0x1f1d4e[_0x47d7('0x62')]['from']=_0x294409[_0x47d7('0x62')][_0x47d7('0x99')][0x0][_0x47d7('0x94')];_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x62')]=_0x294409[_0x47d7('0x62')][_0x47d7('0x99')][0x0][_0x47d7('0x28')][_0x47d7('0x62')];_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x98')]=_0x294409[_0x47d7('0x62')][_0x47d7('0x99')][0x0][_0x47d7('0x9a')];}if(_0x1f1d4e['body']['id']){delete _0x1f1d4e[_0x47d7('0x62')]['id'];}if(_[_0x47d7('0x9b')](_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x94')])){throw new db[(_0x47d7('0x8c'))][(_0x47d7('0x8d'))](_0x47d7('0x9c'));}if(_[_0x47d7('0x9b')](_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x62')])||_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x62')]===''){throw new db[(_0x47d7('0x8c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47d7('0x9b')](_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x9d')])){throw new db['Sequelize'][(_0x47d7('0x8d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1a859b);}if(!_[_0x47d7('0x9e')](_0x1a859b,_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x9d')])){throw new db[(_0x47d7('0x8c'))][(_0x47d7('0x8d'))](_0x47d7('0x9f')+_0x1a859b);}_0x4cb9d0[_0x1f1d4e[_0x47d7('0x62')]['mapKey']]=_0x1f1d4e[_0x47d7('0x62')]['from'];return db[_0x47d7('0xa0')][_0x47d7('0x5f')]({'where':{'id':_0x1f1d4e[_0x47d7('0x81')][_0x47d7('0x92')]},'include':[{'model':db['CmContact'],'as':_0x47d7('0xa1'),'where':_0x4cb9d0,'limit':0x1,'order':[[_0x47d7('0x90'),'DESC']]}]});})['then'](handleEntityNotFound(_0x180601,null))[_0x47d7('0x20')](function(_0x337e98){if(_0x337e98){_0x1f1d4e['list']=_['omit'](_0x337e98,[_0x47d7('0xa1')]);if(_0x337e98[_0x47d7('0xa1')][_0x47d7('0x4b')]){return _0x337e98[_0x47d7('0xa1')][0x0];}var _0x4ee65d=_[_0x47d7('0x18')](_0x1f1d4e['body'],{'firstName':_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x94')],'ListId':_0x337e98['id']});_0x4ee65d[_0x1f1d4e['body']['mapKey']]=_0x1f1d4e[_0x47d7('0x62')]['from'];return db['CmContact']['create'](_0x4ee65d,{'fields':_0xf2caaa,'raw':!![]});}})[_0x47d7('0x20')](handleEntityNotFound(_0x180601,null))[_0x47d7('0x20')](function(_0x20f4c5){if(_0x20f4c5){_0x1f1d4e[_0x47d7('0xa2')]=_0x20f4c5;var _0x5b4cb5={'ContactId':_0x20f4c5['id'],'phone':_0x1f1d4e['body'][_0x47d7('0x94')],'WhatsappAccountId':_0x294409[_0x47d7('0x58')]['id']};var _0x5d6e36={'ContactId':_0x20f4c5['id'],'WhatsappAccountId':_0x294409[_0x47d7('0x58')]['id'],'closed':![]};return db[_0x47d7('0xa3')]['find']({'where':_0x5d6e36})[_0x47d7('0x20')](function(_0xa8b5d3){if(_0xa8b5d3){return[_0xa8b5d3,![]];}return db[_0x47d7('0xa3')][_0x47d7('0x5a')](_0x5b4cb5)[_0x47d7('0x20')](function(_0x184b4d){return[_0x184b4d,!![]];});});}})[_0x47d7('0x71')](function(_0x2d18a1,_0x4b06ea){_0x1f1d4e['interaction']=_0x2d18a1[_0x47d7('0x5d')]({'plain':!![]});_0x1f1d4e[_0x47d7('0xa4')][_0x47d7('0xa5')]=![];if(_0x4b06ea){if(_0x1f1d4e[_0x47d7('0x81')]['autoclose']){_0x1f1d4e[_0x47d7('0x88')][_0x47d7('0xa6')]({'id':0x0,'priority':_0x1f1d4e[_0x47d7('0x88')][_0x47d7('0x4b')]+0x1,'app':_0x47d7('0xa7'),'appdata':_0x47d7('0xa8'),'interval':_0x47d7('0xa9')});}_0x1f1d4e[_0x47d7('0xa4')][_0x47d7('0xa5')]=!![];}return db[_0x47d7('0x86')][_0x47d7('0x5a')]({'phone':_0x1f1d4e['body']['from'],'messageId':_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x98')],'body':_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0x62')],'WhatsappAccountId':_0x294409[_0x47d7('0x58')]['id'],'WhatsappInteractionId':_0x2d18a1['id'],'direction':'in','ContactId':_0x2d18a1[_0x47d7('0xaa')],'AttachmentId':_0x1f1d4e[_0x47d7('0x62')][_0x47d7('0xab')]});})[_0x47d7('0x20')](function(_0x105ecb){_0x1f1d4e[_0x47d7('0x28')]=_0x105ecb;if(_0x1f1d4e['interaction'][_0x47d7('0xac')]){return db[_0x47d7('0x76')][_0x47d7('0x5f')]({'attributes':['id',_0x47d7('0x3b')],'where':{'id':_0x1f1d4e[_0x47d7('0xa4')][_0x47d7('0xac')]}})[_0x47d7('0x20')](function(_0x35d471){if(_0x35d471){_0x1f1d4e[_0x47d7('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':_0x47d7('0xad'),'appdata':_0x35d471[_0x47d7('0x3b')]+','+(_0x1f1d4e[_0x47d7('0x81')][_0x47d7('0xae')]||0xa),'interval':_0x47d7('0xa9')});}return respondWithRpcPromise(_0x47d7('0xaf'),_0x47d7('0xb0'),_0x1f1d4e);});}return respondWithRpcPromise('Start','startRouting',_0x1f1d4e);})[_0x47d7('0x20')](function(_0x4993e4){if(_0x4993e4){var _0x515e17=0xc8;var _0x42ac25=_0x47d7('0xb1');logger[_0x47d7('0x21')](_0x47d7('0xb2'),_0x42ac25,_0x515e17,'entity\x20found');logger[_0x47d7('0x23')](_0x47d7('0xb3'),_0x42ac25,_0x515e17,_0x47d7('0xb4'),JSON[_0x47d7('0x24')](_0x4993e4));if(_0x1f1d4e[_0x47d7('0x81')][_0x47d7('0x43')]==='twilio'){return _0x180601['status'](_0x515e17)[_0x47d7('0xb5')]('Content-Type','text/xml')[_0x47d7('0x3c')]('\x0a');}else{return _0x180601['status'](_0x515e17)[_0x47d7('0x33')](_0x4993e4);}}});})['catch'](handleError(_0x180601,null));};exports[_0x47d7('0x3c')]=function(_0x178f82,_0x527d09,_0x309d83){var _0x1c785c,_0x1238db,_0xf8e18b;if(_[_0x47d7('0x9b')](_0x178f82['body'][_0x47d7('0x62')])||_0x178f82[_0x47d7('0x62')][_0x47d7('0x62')]===''){throw new db[(_0x47d7('0x8c'))][(_0x47d7('0x8d'))](_0x47d7('0xb6'));}if(_[_0x47d7('0x9b')](_0x178f82[_0x47d7('0x62')]['to'])){throw new db[(_0x47d7('0x8c'))]['ValidationError'](_0x47d7('0xb7'));}_0x1c785c=_0x178f82[_0x47d7('0x62')]['to'];return db['WhatsappAccount'][_0x47d7('0x5f')]({'where':{'id':_0x178f82[_0x47d7('0x58')]['id']},'include':[{'model':db[_0x47d7('0xa0')],'as':_0x47d7('0xb8'),'include':[{'model':db[_0x47d7('0x8b')],'as':_0x47d7('0xa1'),'where':{'mobile':_0x1c785c},'limit':0x1,'order':[[_0x47d7('0x90'),_0x47d7('0xb9')]]}]}]})[_0x47d7('0x20')](handleEntityNotFound(_0x527d09,null))['then'](function(_0x56acd8){if(_0x56acd8&&_0x56acd8['List']){_0x1238db=_0x56acd8['get']({'plain':!![]});if(_0x1238db[_0x47d7('0xb8')]&&_0x1238db[_0x47d7('0xb8')][_0x47d7('0xa1')]['length']){return _0x1238db[_0x47d7('0xb8')][_0x47d7('0xa1')][0x0];}return db['CmContact']['create'](_[_0x47d7('0x18')](_0x178f82[_0x47d7('0x62')],{'firstName':_0x1c785c,'mobile':_0x1c785c,'phone':_0x1c785c,'ListId':_0x1238db['ListId']}));}})[_0x47d7('0x20')](handleEntityNotFound(_0x527d09,null))[_0x47d7('0x20')](function(_0x54872f){if(_0x54872f){_0xf8e18b=_0x54872f;return db[_0x47d7('0xa3')]['find']({'where':{'ContactId':_0xf8e18b['id'],'closed':![],'WhatsappAccountId':_0x1238db['id']}})['then'](function(_0x18eb25){if(_0x18eb25){return[_0x18eb25,![]];}return db['WhatsappInteraction'][_0x47d7('0x5a')]({'UserId':_0x178f82[_0x47d7('0xba')]['id'],'ContactId':_0xf8e18b['id'],'WhatsappAccountId':_0x1238db['id'],'phone':_0x1c785c,'firstMsgDirection':_0x47d7('0xbb'),'Messages':[_['merge'](_0x178f82[_0x47d7('0x62')],{'read':![],'body':_0x178f82[_0x47d7('0x62')]['body'],'phone':_0x1c785c,'WhatsappAccountId':_0x1238db['id'],'UserId':_0x178f82[_0x47d7('0xba')]['id'],'ContactId':_0xf8e18b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x47d7('0xbc')}]})[_0x47d7('0x20')](function(_0x1335b5){return[_0x1335b5,!![]];});});}})[_0x47d7('0x71')](function(_0x7fa7dc,_0x64a385){if(_0x64a385){return _0x7fa7dc;}return db['WhatsappMessage'][_0x47d7('0x5a')](_['merge'](_0x178f82[_0x47d7('0x62')],{'read':![],'body':_0x178f82[_0x47d7('0x62')][_0x47d7('0x62')],'phone':_0x1c785c,'WhatsappAccountId':_0x1238db['id'],'WhatsappInteractionId':_0x7fa7dc['id'],'UserId':_0x178f82[_0x47d7('0xba')]['id'],'ContactId':_0xf8e18b['id']}))['then'](function(_0x3f4095){_0x7fa7dc[_0x47d7('0xbd')]['Messages']=[];_0x7fa7dc['dataValues']['Messages']['push'](_0x3f4095[_0x47d7('0xbd')]);return _0x7fa7dc;});})['then'](respondWithResult(_0x527d09,null))[_0x47d7('0x2a')](handleError(_0x527d09,null));}; \ No newline at end of file +var _0x01c0=['interaction','close','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','to\x20is\x20mandatory','List','Messages','dataValues','push','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','length','hasOwnProperty','nolimit','pick','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','Applications','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','replace','Body','MessageSid','from','notifications','messageId','message_id','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction'];(function(_0x5eb7ba,_0x3ff644){var _0x22581d=function(_0x38afe6){while(--_0x38afe6){_0x5eb7ba['push'](_0x5eb7ba['shift']());}};_0x22581d(++_0x3ff644);}(_0x01c0,0xdc));var _0x001c=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x01c0[_0x32b542];return _0x554d54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x001c('0x0'));var zipdir=require(_0x001c('0x1'));var jsonpatch=require(_0x001c('0x2'));var rp=require(_0x001c('0x3'));var moment=require('moment');var BPromise=require(_0x001c('0x4'));var Mustache=require(_0x001c('0x5'));var util=require(_0x001c('0x6'));var path=require(_0x001c('0x7'));var sox=require(_0x001c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x001c('0x9'));var _=require(_0x001c('0xa'));var squel=require(_0x001c('0xb'));var crypto=require(_0x001c('0xc'));var jsforce=require(_0x001c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x001c('0xe'));var querystring=require(_0x001c('0xf'));var Papa=require(_0x001c('0x10'));var Redis=require(_0x001c('0x11'));var authService=require(_0x001c('0x12'));var qs=require(_0x001c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x001c('0x14'))(_0x001c('0x15'));var utils=require('../../config/utils');var config=require(_0x001c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x001c('0x17'))['db'];config[_0x001c('0x18')]=_['defaults'](config[_0x001c('0x18')],{'host':_0x001c('0x19'),'port':0x18eb});var socket=require(_0x001c('0x1a'))(new Redis(config[_0x001c('0x18')]));require(_0x001c('0x1b'))[_0x001c('0x1c')](socket);var jayson=require(_0x001c('0x1d'));var client=jayson[_0x001c('0x1e')][_0x001c('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xa436bc,_0x17d472,_0x548214,_0x46022d){return new BPromise(function(_0x3bbe40,_0x2dbbb1){var _0x58dbc5=_0x46022d||client;return _0x58dbc5[_0x001c('0x20')](_0xa436bc,_0x548214)['then'](function(_0x71fd93){logger[_0x001c('0x21')](_0x001c('0x22'),_0x17d472,'request\x20sent');logger[_0x001c('0x23')](_0x001c('0x24'),_0x17d472,_0x001c('0x25'),JSON[_0x001c('0x26')](_0x71fd93));if(_0x71fd93['error']){if(_0x71fd93[_0x001c('0x27')][_0x001c('0x28')]===0x1f4){logger[_0x001c('0x27')](_0x001c('0x22'),_0x17d472,_0x71fd93[_0x001c('0x27')][_0x001c('0x29')]);return _0x2dbbb1(_0x71fd93[_0x001c('0x27')]['message']);}logger[_0x001c('0x27')](_0x001c('0x22'),_0x17d472,_0x71fd93['error']['message']);return _0x3bbe40(_0x71fd93[_0x001c('0x27')][_0x001c('0x29')]);}else{logger[_0x001c('0x21')](_0x001c('0x22'),_0x17d472,_0x001c('0x25'));_0x3bbe40(_0x71fd93[_0x001c('0x2a')][_0x001c('0x29')]);}})['catch'](function(_0x21b17d){logger[_0x001c('0x27')](_0x001c('0x22'),_0x17d472,_0x21b17d);_0x2dbbb1(_0x21b17d);});});}function respondWithStatusCode(_0x4b2e9e,_0x7726b4){_0x7726b4=_0x7726b4||0xcc;return function(_0x3430e0){if(_0x3430e0){return _0x4b2e9e[_0x001c('0x2b')](_0x7726b4);}return _0x4b2e9e[_0x001c('0x2c')](_0x7726b4)[_0x001c('0x2d')]();};}function respondWithResult(_0x552618,_0x5ae368){_0x5ae368=_0x5ae368||0xc8;return function(_0x272dff){if(_0x272dff){return _0x552618['status'](_0x5ae368)[_0x001c('0x2e')](_0x272dff);}};}function respondWithFilteredResult(_0x5e494b,_0xc4fa9b){return function(_0x3b4692){if(_0x3b4692){var _0x4a31be=typeof _0xc4fa9b[_0x001c('0x2f')]===_0x001c('0x30')&&typeof _0xc4fa9b[_0x001c('0x31')]===_0x001c('0x30');var _0x2e918c=_0x3b4692['count'];var _0x6d6258=_0x4a31be?0x0:_0xc4fa9b[_0x001c('0x2f')];var _0xdb253c=_0x4a31be?_0x3b4692[_0x001c('0x32')]:_0xc4fa9b[_0x001c('0x2f')]+_0xc4fa9b[_0x001c('0x31')];var _0x154ba2;if(_0xdb253c>=_0x2e918c){_0xdb253c=_0x2e918c;_0x154ba2=0xc8;}else{_0x154ba2=0xce;}_0x5e494b[_0x001c('0x2c')](_0x154ba2);return _0x5e494b[_0x001c('0x33')](_0x001c('0x34'),_0x6d6258+'-'+_0xdb253c+'/'+_0x2e918c)['json'](_0x3b4692);}return null;};}function patchUpdates(_0x2ca0e0){return function(_0xd9afda){try{jsonpatch['apply'](_0xd9afda,_0x2ca0e0,!![]);}catch(_0x3bc5bb){return BPromise[_0x001c('0x35')](_0x3bc5bb);}return _0xd9afda['save']();};}function saveUpdates(_0xcb74d5,_0x4cd6ec){return function(_0x418759){if(_0x418759){return _0x418759[_0x001c('0x36')](_0xcb74d5)[_0x001c('0x37')](function(_0x154385){return _0x154385;});}return null;};}function removeEntity(_0x57b692,_0x512981){return function(_0x32f402){if(_0x32f402){return _0x32f402['destroy']()['then'](function(){var _0x4ecdff=_0x32f402[_0x001c('0x38')]({'plain':!![]});var _0x220eb1=_0x001c('0x39');return db[_0x001c('0x3a')][_0x001c('0x3b')]({'where':{'type':_0x220eb1,'resourceId':_0x4ecdff['id']}})[_0x001c('0x37')](function(){return _0x32f402;});})['then'](function(){_0x57b692[_0x001c('0x2c')](0xcc)[_0x001c('0x2d')]();});}};}function handleEntityNotFound(_0x196a05,_0x1f7d4e){return function(_0x4dc455){if(!_0x4dc455){_0x196a05[_0x001c('0x2b')](0x194);}return _0x4dc455;};}function handleError(_0x2e6262,_0x57e9db){_0x57e9db=_0x57e9db||0x1f4;return function(_0x532022){logger[_0x001c('0x27')](_0x532022[_0x001c('0x3c')]);if(_0x532022[_0x001c('0x3d')]){delete _0x532022[_0x001c('0x3d')];}_0x2e6262[_0x001c('0x2c')](_0x57e9db)[_0x001c('0x3e')](_0x532022);};}exports[_0x001c('0x3f')]=function(_0x23bd10,_0x23ada8){var _0x4664bd={'include':[{'model':db[_0x001c('0x40')],'as':_0x001c('0x41')}]},_0x5ee730={},_0x4d3bf7={'count':0x0,'rows':[]};var _0x3cf9c4=_['map'](db[_0x001c('0x42')]['rawAttributes'],function(_0x49cc0b){return{'name':_0x49cc0b[_0x001c('0x43')],'type':_0x49cc0b[_0x001c('0x44')][_0x001c('0x45')]};});_0x5ee730[_0x001c('0x46')]=_[_0x001c('0x47')](_0x3cf9c4,_0x001c('0x3d'));_0x5ee730[_0x001c('0x48')]=_[_0x001c('0x49')](_0x23bd10['query']);_0x5ee730[_0x001c('0x4a')]=_['intersection'](_0x5ee730[_0x001c('0x46')],_0x5ee730[_0x001c('0x48')]);_0x4664bd['attributes']=_[_0x001c('0x4b')](_0x5ee730[_0x001c('0x46')],qs['fields'](_0x23bd10['query'][_0x001c('0x4c')]));_0x4664bd[_0x001c('0x4d')]=_0x4664bd['attributes']['length']?_0x4664bd[_0x001c('0x4d')]:_0x5ee730['model'];if(!_0x23bd10[_0x001c('0x48')]['hasOwnProperty']('nolimit')){_0x4664bd[_0x001c('0x31')]=qs[_0x001c('0x31')](_0x23bd10[_0x001c('0x48')][_0x001c('0x31')]);_0x4664bd['offset']=qs[_0x001c('0x2f')](_0x23bd10[_0x001c('0x48')][_0x001c('0x2f')]);}_0x4664bd[_0x001c('0x4e')]=qs['sort'](_0x23bd10['query'][_0x001c('0x4f')]);_0x4664bd[_0x001c('0x50')]=qs['filters'](_['pick'](_0x23bd10['query'],_0x5ee730[_0x001c('0x4a')]),_0x3cf9c4);if(_0x23bd10[_0x001c('0x48')][_0x001c('0x51')]){_0x4664bd[_0x001c('0x50')]=_[_0x001c('0x52')](_0x4664bd[_0x001c('0x50')],{'$or':_[_0x001c('0x47')](_0x3cf9c4,function(_0x2fdebc){if(_0x2fdebc[_0x001c('0x44')]!==_0x001c('0x53')){var _0x24f519={};_0x24f519[_0x2fdebc[_0x001c('0x3d')]]={'$like':'%'+_0x23bd10[_0x001c('0x48')][_0x001c('0x51')]+'%'};return _0x24f519;}})});}_0x4664bd=_['merge']({},_0x4664bd,_0x23bd10[_0x001c('0x54')]);var _0x279d03={'where':_0x4664bd[_0x001c('0x50')]};return db[_0x001c('0x42')][_0x001c('0x32')](_0x279d03)[_0x001c('0x37')](function(_0xa9b3c8){_0x4d3bf7[_0x001c('0x32')]=_0xa9b3c8;if(_0x23bd10['query'][_0x001c('0x55')]){_0x4664bd[_0x001c('0x56')]=[{'all':!![]}];}return db[_0x001c('0x42')][_0x001c('0x57')](_0x4664bd);})['then'](function(_0x6bf8ff){_0x4d3bf7[_0x001c('0x58')]=_0x6bf8ff;return _0x4d3bf7;})[_0x001c('0x37')](respondWithFilteredResult(_0x23ada8,_0x4664bd))[_0x001c('0x59')](handleError(_0x23ada8,null));};exports[_0x001c('0x5a')]=function(_0x3cd46f,_0x52a8d1){var _0x49e2e1={'raw':![],'where':{'id':_0x3cd46f[_0x001c('0x5b')]['id']},'include':[{'model':db[_0x001c('0x40')],'as':_0x001c('0x41')}]},_0x324061={};_0x324061[_0x001c('0x46')]=_[_0x001c('0x49')](db['WhatsappAccount']['rawAttributes']);_0x324061['query']=_[_0x001c('0x49')](_0x3cd46f[_0x001c('0x48')]);_0x324061[_0x001c('0x4a')]=_['intersection'](_0x324061['model'],_0x324061[_0x001c('0x48')]);_0x49e2e1[_0x001c('0x4d')]=_['intersection'](_0x324061[_0x001c('0x46')],qs[_0x001c('0x4c')](_0x3cd46f[_0x001c('0x48')][_0x001c('0x4c')]));_0x49e2e1[_0x001c('0x4d')]=_0x49e2e1[_0x001c('0x4d')]['length']?_0x49e2e1[_0x001c('0x4d')]:_0x324061[_0x001c('0x46')];if(_0x3cd46f['query']['includeAll']){_0x49e2e1[_0x001c('0x56')]=[{'all':!![]}];}_0x49e2e1=_[_0x001c('0x52')]({},_0x49e2e1,_0x3cd46f[_0x001c('0x54')]);return db[_0x001c('0x42')][_0x001c('0x5c')](_0x49e2e1)[_0x001c('0x37')](handleEntityNotFound(_0x52a8d1,null))['then'](respondWithResult(_0x52a8d1,null))['catch'](handleError(_0x52a8d1,null));};exports[_0x001c('0x5d')]=function(_0x2054d9,_0x58f511){return db[_0x001c('0x42')][_0x001c('0x5d')](_0x2054d9['body'],{})[_0x001c('0x37')](function(_0x13858d){var _0x2e9d30=_0x2054d9[_0x001c('0x5e')][_0x001c('0x38')]({'plain':!![]});if(!_0x2e9d30)throw new Error(_0x001c('0x5f'));if(_0x2e9d30[_0x001c('0x60')]===_0x001c('0x5e')){var _0xe56335=_0x13858d[_0x001c('0x38')]({'plain':!![]});var _0x5b1084=_0x001c('0x39');return db[_0x001c('0x61')][_0x001c('0x5c')]({'where':{'name':_0x5b1084,'userProfileId':_0x2e9d30[_0x001c('0x62')]},'raw':!![]})['then'](function(_0x1bc4e6){if(_0x1bc4e6&&_0x1bc4e6['autoAssociation']===0x0){return db[_0x001c('0x3a')][_0x001c('0x5d')]({'name':_0xe56335['name'],'resourceId':_0xe56335['id'],'type':_0x1bc4e6['name'],'sectionId':_0x1bc4e6['id']},{})[_0x001c('0x37')](function(){return _0x13858d;});}else{return _0x13858d;}})[_0x001c('0x59')](function(_0x5e88c7){logger[_0x001c('0x27')](_0x001c('0x63'),_0x5e88c7);throw _0x5e88c7;});}return _0x13858d;})[_0x001c('0x37')](respondWithResult(_0x58f511,0xc9))[_0x001c('0x59')](handleError(_0x58f511,null));};exports[_0x001c('0x36')]=function(_0x1e66b4,_0x12c9a2){if(_0x1e66b4[_0x001c('0x64')]['id']){delete _0x1e66b4[_0x001c('0x64')]['id'];}return db[_0x001c('0x42')][_0x001c('0x5c')]({'where':{'id':_0x1e66b4[_0x001c('0x5b')]['id']},'include':[{'model':db[_0x001c('0x40')],'as':_0x001c('0x41')}]})[_0x001c('0x37')](handleEntityNotFound(_0x12c9a2,null))['then'](saveUpdates(_0x1e66b4[_0x001c('0x64')],null))['then'](respondWithResult(_0x12c9a2,null))['catch'](handleError(_0x12c9a2,null));};exports[_0x001c('0x3b')]=function(_0x11458c,_0x4904c0){return db[_0x001c('0x42')][_0x001c('0x5c')]({'where':{'id':_0x11458c['params']['id']}})['then'](handleEntityNotFound(_0x4904c0,null))['then'](removeEntity(_0x4904c0,null))[_0x001c('0x59')](handleError(_0x4904c0,null));};exports[_0x001c('0x65')]=function(_0x6f4bae,_0x31abc2){return db[_0x001c('0x42')][_0x001c('0x65')]()['then'](respondWithResult(_0x31abc2,null))[_0x001c('0x59')](handleError(_0x31abc2,null));};exports[_0x001c('0x66')]=function(_0x4ec622,_0x23a3db,_0x37c200){if(_0x4ec622[_0x001c('0x64')]['id']){delete _0x4ec622[_0x001c('0x64')]['id'];}return db[_0x001c('0x42')][_0x001c('0x5c')]({'where':{'id':_0x4ec622[_0x001c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x23a3db,null))['then'](function(_0x3ff823){if(_0x3ff823){_0x4ec622[_0x001c('0x64')][_0x001c('0x67')]=_0x3ff823['id'];return db[_0x001c('0x68')][_0x001c('0x5d')](_0x4ec622[_0x001c('0x64')]);}})[_0x001c('0x37')](respondWithResult(_0x23a3db,null))[_0x001c('0x59')](handleError(_0x23a3db,null));};exports[_0x001c('0x69')]=function(_0x567ab7,_0x2543bf,_0x201cee){var _0x104de7={'raw':![],'where':{}};var _0x1c7cf6={};var _0x1ac204={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x001c('0x6a')]({'where':{'id':_0x567ab7[_0x001c('0x5b')]['id']}})[_0x001c('0x37')](handleEntityNotFound(_0x2543bf,null))[_0x001c('0x37')](function(_0x4cf9b3){if(_0x4cf9b3){_0x1c7cf6['model']=_[_0x001c('0x49')](db['Disposition'][_0x001c('0x6b')]);_0x1c7cf6[_0x001c('0x48')]=_[_0x001c('0x49')](_0x567ab7['query']);_0x1c7cf6[_0x001c('0x4a')]=_[_0x001c('0x4b')](_0x1c7cf6['model'],_0x1c7cf6[_0x001c('0x48')]);_0x104de7[_0x001c('0x4d')]=_[_0x001c('0x4b')](_0x1c7cf6[_0x001c('0x46')],qs[_0x001c('0x4c')](_0x567ab7[_0x001c('0x48')]['fields']));_0x104de7[_0x001c('0x4d')]=_0x104de7['attributes'][_0x001c('0x6c')]?_0x104de7[_0x001c('0x4d')]:_0x1c7cf6[_0x001c('0x46')];if(!_0x567ab7[_0x001c('0x48')][_0x001c('0x6d')](_0x001c('0x6e'))){_0x104de7[_0x001c('0x31')]=qs['limit'](_0x567ab7[_0x001c('0x48')][_0x001c('0x31')]);_0x104de7[_0x001c('0x2f')]=qs[_0x001c('0x2f')](_0x567ab7[_0x001c('0x48')][_0x001c('0x2f')]);}_0x104de7[_0x001c('0x4e')]=qs[_0x001c('0x4f')](_0x567ab7['query'][_0x001c('0x4f')]);_0x104de7[_0x001c('0x50')]=qs[_0x001c('0x4a')](_[_0x001c('0x6f')](_0x567ab7['query'],_0x1c7cf6['filters']));_0x104de7[_0x001c('0x50')][_0x001c('0x67')]=_0x4cf9b3['id'];if(_0x567ab7[_0x001c('0x48')][_0x001c('0x51')]){_0x104de7['where']=_[_0x001c('0x52')](_0x104de7[_0x001c('0x50')],{'$or':_[_0x001c('0x47')](_0x104de7[_0x001c('0x4d')],function(_0x1a5a3b){var _0x39380a={};_0x39380a[_0x1a5a3b]={'$like':'%'+_0x567ab7['query']['filter']+'%'};return _0x39380a;})});}_0x104de7=_[_0x001c('0x52')]({},_0x104de7,_0x567ab7['options']);return db[_0x001c('0x68')][_0x001c('0x32')]({'where':_0x104de7[_0x001c('0x50')]})[_0x001c('0x37')](function(_0x2bafa4){_0x1ac204[_0x001c('0x32')]=_0x2bafa4;if(_0x567ab7[_0x001c('0x48')][_0x001c('0x55')]){_0x104de7[_0x001c('0x56')]=[{'all':!![]}];}return db[_0x001c('0x68')][_0x001c('0x57')](_0x104de7);})[_0x001c('0x37')](function(_0x2d4081){_0x1ac204[_0x001c('0x58')]=_0x2d4081;return _0x1ac204;});}})[_0x001c('0x37')](respondWithFilteredResult(_0x2543bf,_0x104de7))[_0x001c('0x59')](handleError(_0x2543bf,null));};exports['removeDispositions']=function(_0x5b524e,_0x30b818,_0x54e8a8){return db['WhatsappAccount']['find']({'where':{'id':_0x5b524e[_0x001c('0x5b')]['id']}})[_0x001c('0x37')](handleEntityNotFound(_0x30b818,null))['then'](function(_0x143ab9){if(_0x143ab9){return _0x143ab9[_0x001c('0x70')](_0x5b524e[_0x001c('0x48')]['ids']);}})[_0x001c('0x37')](respondWithStatusCode(_0x30b818,null))['catch'](handleError(_0x30b818,null));};exports[_0x001c('0x71')]=function(_0x8cdbed,_0x599737,_0x2939c3){if(_0x8cdbed[_0x001c('0x64')]['id']){delete _0x8cdbed['body']['id'];}return db[_0x001c('0x42')]['find']({'where':{'id':_0x8cdbed[_0x001c('0x5b')]['id']}})[_0x001c('0x37')](handleEntityNotFound(_0x599737,null))[_0x001c('0x37')](function(_0x3b1330){if(_0x3b1330){_0x8cdbed['body'][_0x001c('0x67')]=_0x3b1330['id'];return db['CannedAnswer'][_0x001c('0x5d')](_0x8cdbed[_0x001c('0x64')]);}})[_0x001c('0x37')](respondWithResult(_0x599737,null))[_0x001c('0x59')](handleError(_0x599737,null));};exports[_0x001c('0x72')]=function(_0x47767a,_0x431d5e,_0x392dbe){var _0x48e46b={'raw':![],'where':{}};var _0x469d37={};var _0x40aad0={'count':0x0,'rows':[]};return db[_0x001c('0x42')]['findOne']({'where':{'id':_0x47767a[_0x001c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x431d5e,null))['then'](function(_0x293ab7){if(_0x293ab7){_0x469d37['model']=_[_0x001c('0x49')](db['CannedAnswer']['rawAttributes']);_0x469d37[_0x001c('0x48')]=_[_0x001c('0x49')](_0x47767a[_0x001c('0x48')]);_0x469d37[_0x001c('0x4a')]=_['intersection'](_0x469d37[_0x001c('0x46')],_0x469d37['query']);_0x48e46b['attributes']=_[_0x001c('0x4b')](_0x469d37['model'],qs[_0x001c('0x4c')](_0x47767a[_0x001c('0x48')]['fields']));_0x48e46b[_0x001c('0x4d')]=_0x48e46b['attributes'][_0x001c('0x6c')]?_0x48e46b[_0x001c('0x4d')]:_0x469d37[_0x001c('0x46')];if(!_0x47767a[_0x001c('0x48')][_0x001c('0x6d')]('nolimit')){_0x48e46b[_0x001c('0x31')]=qs[_0x001c('0x31')](_0x47767a[_0x001c('0x48')][_0x001c('0x31')]);_0x48e46b[_0x001c('0x2f')]=qs[_0x001c('0x2f')](_0x47767a[_0x001c('0x48')]['offset']);}_0x48e46b[_0x001c('0x4e')]=qs[_0x001c('0x4f')](_0x47767a[_0x001c('0x48')][_0x001c('0x4f')]);_0x48e46b[_0x001c('0x50')]=qs[_0x001c('0x4a')](_[_0x001c('0x6f')](_0x47767a[_0x001c('0x48')],_0x469d37[_0x001c('0x4a')]));_0x48e46b[_0x001c('0x50')]['WhatsappAccountId']=_0x293ab7['id'];if(_0x47767a['query'][_0x001c('0x51')]){_0x48e46b[_0x001c('0x50')]=_['merge'](_0x48e46b[_0x001c('0x50')],{'$or':_[_0x001c('0x47')](_0x48e46b[_0x001c('0x4d')],function(_0x301ca8){var _0x118e26={};_0x118e26[_0x301ca8]={'$like':'%'+_0x47767a['query'][_0x001c('0x51')]+'%'};return _0x118e26;})});}_0x48e46b=_[_0x001c('0x52')]({},_0x48e46b,_0x47767a[_0x001c('0x54')]);return db[_0x001c('0x73')]['count']({'where':_0x48e46b[_0x001c('0x50')]})[_0x001c('0x37')](function(_0x5ac970){_0x40aad0['count']=_0x5ac970;if(_0x47767a[_0x001c('0x48')][_0x001c('0x55')]){_0x48e46b[_0x001c('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x001c('0x57')](_0x48e46b);})[_0x001c('0x37')](function(_0x4d87e0){_0x40aad0[_0x001c('0x58')]=_0x4d87e0;return _0x40aad0;});}})['then'](respondWithFilteredResult(_0x431d5e,_0x48e46b))[_0x001c('0x59')](handleError(_0x431d5e,null));};exports['removeAnswers']=function(_0x379985,_0x525455,_0xff18e0){return db[_0x001c('0x42')]['find']({'where':{'id':_0x379985['params']['id']}})['then'](handleEntityNotFound(_0x525455,null))[_0x001c('0x37')](function(_0x1ef34f){if(_0x1ef34f){return _0x1ef34f[_0x001c('0x74')](_0x379985[_0x001c('0x48')][_0x001c('0x75')]);}})[_0x001c('0x37')](respondWithStatusCode(_0x525455,null))[_0x001c('0x59')](handleError(_0x525455,null));};exports[_0x001c('0x76')]=function(_0x11fd67,_0x1fe852,_0x3e29b8){return db[_0x001c('0x42')][_0x001c('0x5c')]({'where':{'id':_0x11fd67[_0x001c('0x5b')]['id']}})[_0x001c('0x37')](handleEntityNotFound(_0x1fe852,null))[_0x001c('0x37')](function(_0x39a611){if(_0x39a611){return _0x39a611['addAgents'](_0x11fd67['body']['ids'],_[_0x001c('0x77')](_0x11fd67[_0x001c('0x64')],[_0x001c('0x75'),'id'])||{})[_0x001c('0x78')](function(_0x126a3a){for(var _0x247215=0x0;_0x247215<_0x11fd67[_0x001c('0x64')][_0x001c('0x75')][_0x001c('0x6c')];_0x247215+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x11fd67['body'][_0x001c('0x75')][_0x247215]),'WhatsappAccountId':Number(_0x11fd67[_0x001c('0x5b')]['id'])});}return _0x126a3a;});}})[_0x001c('0x37')](respondWithResult(_0x1fe852,null))[_0x001c('0x59')](handleError(_0x1fe852,null));};exports[_0x001c('0x79')]=function(_0x2213fd,_0x3ab0d0,_0x1c8feb){return db[_0x001c('0x42')][_0x001c('0x5c')]({'where':{'id':_0x2213fd['params']['id']}})[_0x001c('0x37')](handleEntityNotFound(_0x3ab0d0,null))[_0x001c('0x37')](function(_0x426dd2){if(_0x426dd2){return _0x426dd2[_0x001c('0x79')](_0x2213fd[_0x001c('0x48')][_0x001c('0x75')])[_0x001c('0x37')](function(){if(_[_0x001c('0x7a')](_0x2213fd['query']['ids'])){for(var _0x1becd0=0x0;_0x1becd0<_0x2213fd[_0x001c('0x48')]['ids'][_0x001c('0x6c')];_0x1becd0+=0x1){socket['emit'](_0x001c('0x7b'),{'UserId':Number(_0x2213fd['query'][_0x001c('0x75')][_0x1becd0]),'WhatsappAccountId':Number(_0x2213fd[_0x001c('0x5b')]['id'])});}}else{socket[_0x001c('0x7c')](_0x001c('0x7b'),{'UserId':Number(_0x2213fd[_0x001c('0x48')][_0x001c('0x75')]),'WhatsappAccountId':Number(_0x2213fd[_0x001c('0x5b')]['id'])});}});}})[_0x001c('0x37')](respondWithStatusCode(_0x3ab0d0,null))['catch'](handleError(_0x3ab0d0,null));};exports[_0x001c('0x7d')]=function(_0x41cd40,_0x539874,_0x223987){var _0x5fa024={};var _0x3708a4={};var _0x4c8aad;var _0x5d04e0;return db['WhatsappAccount']['findOne']({'where':{'id':_0x41cd40['params']['id']}})[_0x001c('0x37')](handleEntityNotFound(_0x539874,null))[_0x001c('0x37')](function(_0x48f1b9){if(_0x48f1b9){_0x4c8aad=_0x48f1b9;_0x3708a4[_0x001c('0x46')]=_[_0x001c('0x49')](db[_0x001c('0x7e')]['rawAttributes']);_0x3708a4[_0x001c('0x48')]=_['keys'](_0x41cd40[_0x001c('0x48')]);_0x3708a4[_0x001c('0x4a')]=_[_0x001c('0x4b')](_0x3708a4['model'],_0x3708a4[_0x001c('0x48')]);_0x5fa024[_0x001c('0x4d')]=_[_0x001c('0x4b')](_0x3708a4['model'],qs[_0x001c('0x4c')](_0x41cd40[_0x001c('0x48')][_0x001c('0x4c')]));_0x5fa024['attributes']=_0x5fa024['attributes'][_0x001c('0x6c')]?_0x5fa024['attributes']:_0x3708a4[_0x001c('0x46')];_0x5fa024['order']=qs[_0x001c('0x4f')](_0x41cd40[_0x001c('0x48')][_0x001c('0x4f')]);_0x5fa024[_0x001c('0x50')]=qs[_0x001c('0x4a')](_[_0x001c('0x6f')](_0x41cd40[_0x001c('0x48')],_0x3708a4[_0x001c('0x4a')]));if(_0x41cd40[_0x001c('0x48')]['filter']){_0x5fa024['where']=_[_0x001c('0x52')](_0x5fa024[_0x001c('0x50')],{'$or':_[_0x001c('0x47')](_0x5fa024[_0x001c('0x4d')],function(_0x1ebc10){var _0x50858e={};_0x50858e[_0x1ebc10]={'$like':'%'+_0x41cd40[_0x001c('0x48')][_0x001c('0x51')]+'%'};return _0x50858e;})});}_0x5fa024=_[_0x001c('0x52')]({},_0x5fa024,_0x41cd40[_0x001c('0x54')]);return _0x4c8aad[_0x001c('0x7d')](_0x5fa024);}})[_0x001c('0x37')](function(_0x31be20){if(_0x31be20){_0x5d04e0=_0x31be20[_0x001c('0x6c')];if(!_0x41cd40[_0x001c('0x48')][_0x001c('0x6d')](_0x001c('0x6e'))){_0x5fa024[_0x001c('0x31')]=qs[_0x001c('0x31')](_0x41cd40[_0x001c('0x48')][_0x001c('0x31')]);_0x5fa024['offset']=qs[_0x001c('0x2f')](_0x41cd40[_0x001c('0x48')][_0x001c('0x2f')]);}return _0x4c8aad['getAgents'](_0x5fa024);}})['then'](function(_0x7304d){if(_0x7304d){return _0x7304d?{'count':_0x5d04e0,'rows':_0x7304d}:null;}})[_0x001c('0x37')](respondWithResult(_0x539874,null))['catch'](handleError(_0x539874,null));};exports[_0x001c('0x7f')]=function(_0x58f0db,_0x4f12fc,_0x27b6d7){return db[_0x001c('0x42')]['findOne']({'where':{'id':_0x58f0db[_0x001c('0x5b')]['id']}})[_0x001c('0x37')](handleEntityNotFound(_0x4f12fc,null))['then'](function(_0x589f90){if(_0x589f90){return db[_0x001c('0x80')][_0x001c('0x81')](function(_0x4849c9){return db[_0x001c('0x82')][_0x001c('0x3b')]({'where':{'WhatsappAccountId':_0x58f0db[_0x001c('0x5b')]['id']},'transaction':_0x4849c9})[_0x001c('0x37')](function(_0x5c9a99){var _0x468085=_[_0x001c('0x47')](_0x58f0db['body'],function(_0x1426f6){_0x1426f6['WhatsappAccountId']=_0x58f0db[_0x001c('0x5b')]['id'];return _0x1426f6;});return db[_0x001c('0x82')][_0x001c('0x83')](_0x468085,{'transaction':_0x4849c9});});})[_0x001c('0x37')](function(){return db[_0x001c('0x82')][_0x001c('0x84')]({'where':{'WhatsappAccountId':_0x58f0db[_0x001c('0x5b')]['id']},'order':_0x001c('0x85')});});}})[_0x001c('0x37')](respondWithResult(_0x4f12fc,null))[_0x001c('0x59')](handleError(_0x4f12fc,null));};exports[_0x001c('0x86')]=function(_0x1901c2,_0x2403d6,_0x25c382){var _0xbfef08={};var _0x173481={};var _0x1f9769;var _0x72ce33;return db[_0x001c('0x42')][_0x001c('0x6a')]({'where':{'id':_0x1901c2[_0x001c('0x5b')]['id']}})[_0x001c('0x37')](handleEntityNotFound(_0x2403d6,null))[_0x001c('0x37')](function(_0x56979d){if(_0x56979d){_0x1f9769=_0x56979d;_0x173481[_0x001c('0x46')]=_['keys'](db[_0x001c('0x82')][_0x001c('0x6b')]);_0x173481['query']=_[_0x001c('0x49')](_0x1901c2[_0x001c('0x48')]);_0x173481[_0x001c('0x4a')]=_['intersection'](_0x173481[_0x001c('0x46')],_0x173481['query']);_0xbfef08[_0x001c('0x4d')]=_[_0x001c('0x4b')](_0x173481['model'],qs[_0x001c('0x4c')](_0x1901c2[_0x001c('0x48')]['fields']));_0xbfef08['attributes']=_0xbfef08[_0x001c('0x4d')][_0x001c('0x6c')]?_0xbfef08['attributes']:_0x173481[_0x001c('0x46')];_0xbfef08['order']=qs[_0x001c('0x4f')](_0x1901c2['query'][_0x001c('0x4f')]);_0xbfef08['where']=qs[_0x001c('0x4a')](_[_0x001c('0x6f')](_0x1901c2[_0x001c('0x48')],_0x173481[_0x001c('0x4a')]));if(_0x1901c2[_0x001c('0x48')][_0x001c('0x51')]){_0xbfef08[_0x001c('0x50')]=_[_0x001c('0x52')](_0xbfef08[_0x001c('0x50')],{'$or':_[_0x001c('0x47')](_0xbfef08[_0x001c('0x4d')],function(_0x2ddec9){var _0x1ff899={};_0x1ff899[_0x2ddec9]={'$like':'%'+_0x1901c2[_0x001c('0x48')][_0x001c('0x51')]+'%'};return _0x1ff899;})});}_0xbfef08=_['merge']({},_0xbfef08,_0x1901c2[_0x001c('0x54')]);return _0x1f9769['getApplications'](_0xbfef08);}})[_0x001c('0x37')](function(_0x2903db){if(_0x2903db){_0x72ce33=_0x2903db[_0x001c('0x6c')];if(!_0x1901c2[_0x001c('0x48')][_0x001c('0x6d')]('nolimit')){_0xbfef08[_0x001c('0x31')]=qs[_0x001c('0x31')](_0x1901c2['query'][_0x001c('0x31')]);_0xbfef08['offset']=qs[_0x001c('0x2f')](_0x1901c2[_0x001c('0x48')][_0x001c('0x2f')]);}return _0x1f9769[_0x001c('0x86')](_0xbfef08);}})[_0x001c('0x37')](function(_0x157c22){if(_0x157c22){return _0x157c22?{'count':_0x72ce33,'rows':_0x157c22}:null;}})[_0x001c('0x37')](respondWithResult(_0x2403d6,null))['catch'](handleError(_0x2403d6,null));};exports[_0x001c('0x87')]=function(_0x554543,_0x1cf4dc,_0x490103){var _0x58c76d={'channel':_0x001c('0x88')};var _0x526b7b=[];var _0x1c2aef=[];var _0xfbbf6e={};return db[_0x001c('0x42')][_0x001c('0x5c')]({'where':{'id':_0x554543[_0x001c('0x5b')]['id']},'include':[{'model':db[_0x001c('0x82')],'as':'Applications'}]})[_0x001c('0x37')](handleEntityNotFound(_0x1cf4dc,null))[_0x001c('0x37')](function(_0xa05856){_0x58c76d[_0x001c('0x89')]=_0xa05856;if(_0x58c76d[_0x001c('0x89')]&&_0x58c76d['account']['type']===_0x001c('0x8a')&&_0x554543['body'][_0x001c('0x8b')]&&_0x554543[_0x001c('0x64')][_0x001c('0x8b')][0x0][_0x001c('0x8c')]===_0x001c('0x8d')){if(_0x554543['body'][_0x001c('0x8b')][0x0][_0x001c('0x8c')]!==_0x001c('0x8d'))return;return db[_0x001c('0x8e')][_0x001c('0x36')]({'read':!![],'readAt':_0x554543['body']['statuses'][0x0][_0x001c('0x8f')]},{'where':{'messageId':_0x554543['body'][_0x001c('0x8b')][0x0]['message_id']},'individualHooks':!![]})[_0x001c('0x37')](function(_0x247b9a){return _0x1cf4dc[_0x001c('0x2c')](0xc8)[_0x001c('0x2e')](_0x247b9a);});}_0x58c76d[_0x001c('0x90')]=_[_0x001c('0x91')](_0xa05856[_0x001c('0x92')],[_0x001c('0x85')],['asc']);if(_0x58c76d[_0x001c('0x89')]['Applications']){delete _0x58c76d['account']['Applications'];}return db[_0x001c('0x93')][_0x001c('0x65')]()[_0x001c('0x37')](function(_0x1fc211){if(!_0x1fc211){throw new db[(_0x001c('0x94'))]['ValidationError'](_0x001c('0x95'));}_0x526b7b=_[_0x001c('0x96')](_['keys'](_0x1fc211),[_0x001c('0x97'),_0x001c('0x98')]);_0x1c2aef=_['difference'](_[_0x001c('0x49')](_0x1fc211),[_0x001c('0x97'),_0x001c('0x98'),_0x001c('0x99'),_0x001c('0x9a')]);_0x58c76d[_0x001c('0x64')]={'mapKey':_0x001c('0x9b')};if(_0x58c76d[_0x001c('0x89')]&&_0x58c76d[_0x001c('0x89')][_0x001c('0x44')]==='twilio'){_0x58c76d['body']['from']=_0x554543[_0x001c('0x64')][_0x001c('0x9c')][_0x001c('0x9d')]('whatsapp:','');_0x58c76d[_0x001c('0x64')][_0x001c('0x64')]=_0x554543['body'][_0x001c('0x9e')];_0x58c76d[_0x001c('0x64')]['messageId']=_0x554543['body'][_0x001c('0x9f')];}if(_0x58c76d[_0x001c('0x89')]&&_0x58c76d[_0x001c('0x89')][_0x001c('0x44')]===_0x001c('0x8a')){_0x58c76d[_0x001c('0x64')][_0x001c('0xa0')]=_0x554543['body'][_0x001c('0xa1')][0x0][_0x001c('0xa0')];_0x58c76d[_0x001c('0x64')]['body']=_0x554543[_0x001c('0x64')][_0x001c('0xa1')][0x0]['message'][_0x001c('0x64')];_0x58c76d[_0x001c('0x64')][_0x001c('0xa2')]=_0x554543[_0x001c('0x64')]['notifications'][0x0][_0x001c('0xa3')];}if(_0x58c76d[_0x001c('0x64')]['id']){delete _0x58c76d[_0x001c('0x64')]['id'];}if(_[_0x001c('0xa4')](_0x58c76d[_0x001c('0x64')]['from'])){throw new db[(_0x001c('0x94'))][(_0x001c('0xa5'))](_0x001c('0xa6'));}if(_[_0x001c('0xa4')](_0x58c76d[_0x001c('0x64')][_0x001c('0x64')])||_0x58c76d[_0x001c('0x64')][_0x001c('0x64')]===''){throw new db[(_0x001c('0x94'))][(_0x001c('0xa5'))](_0x001c('0xa7'));}if(_[_0x001c('0xa4')](_0x58c76d[_0x001c('0x64')][_0x001c('0xa8')])){throw new db[(_0x001c('0x94'))][(_0x001c('0xa5'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c2aef);}if(!_[_0x001c('0xa9')](_0x1c2aef,_0x58c76d[_0x001c('0x64')][_0x001c('0xa8')])){throw new db[(_0x001c('0x94'))][(_0x001c('0xa5'))](_0x001c('0xaa')+_0x1c2aef);}_0xfbbf6e[_0x58c76d[_0x001c('0x64')][_0x001c('0xa8')]]=_0x58c76d[_0x001c('0x64')]['from'];return db[_0x001c('0xab')]['find']({'where':{'id':_0x58c76d['account'][_0x001c('0x9a')]},'include':[{'model':db['CmContact'],'as':_0x001c('0xac'),'where':_0xfbbf6e,'limit':0x1,'order':[[_0x001c('0x98'),_0x001c('0xad')]]}]});})['then'](handleEntityNotFound(_0x1cf4dc,null))[_0x001c('0x37')](function(_0x2cd1c1){if(_0x2cd1c1){_0x58c76d[_0x001c('0xae')]=_['omit'](_0x2cd1c1,[_0x001c('0xac')]);if(_0x2cd1c1['Contacts']['length']){return _0x2cd1c1['Contacts'][0x0];}var _0x3e9518=_[_0x001c('0xaf')](_0x58c76d['body'],{'firstName':_0x58c76d[_0x001c('0x64')][_0x001c('0xa0')],'ListId':_0x2cd1c1['id']});_0x3e9518[_0x58c76d[_0x001c('0x64')][_0x001c('0xa8')]]=_0x58c76d[_0x001c('0x64')][_0x001c('0xa0')];return db[_0x001c('0x93')][_0x001c('0x5d')](_0x3e9518,{'fields':_0x526b7b,'raw':!![]});}})[_0x001c('0x37')](handleEntityNotFound(_0x1cf4dc,null))[_0x001c('0x37')](function(_0x4a68b8){if(_0x4a68b8){_0x58c76d[_0x001c('0xb0')]=_0x4a68b8;var _0x1fdbf0={'ContactId':_0x4a68b8['id'],'phone':_0x58c76d[_0x001c('0x64')][_0x001c('0xa0')],'WhatsappAccountId':_0x554543[_0x001c('0x5b')]['id']};var _0x4cc3c0={'ContactId':_0x4a68b8['id'],'WhatsappAccountId':_0x554543[_0x001c('0x5b')]['id'],'closed':![]};return db[_0x001c('0xb1')][_0x001c('0x5c')]({'where':_0x4cc3c0})[_0x001c('0x37')](function(_0x57b48a){if(_0x57b48a){return[_0x57b48a,![]];}return db[_0x001c('0xb1')][_0x001c('0x5d')](_0x1fdbf0)[_0x001c('0x37')](function(_0x390424){return[_0x390424,!![]];});});}})[_0x001c('0x78')](function(_0x17e612,_0x1ad88a){_0x58c76d[_0x001c('0xb2')]=_0x17e612[_0x001c('0x38')]({'plain':!![]});_0x58c76d[_0x001c('0xb2')]['created']=![];if(_0x1ad88a){if(_0x58c76d[_0x001c('0x89')]['autoclose']){_0x58c76d[_0x001c('0x90')]['push']({'id':0x0,'priority':_0x58c76d[_0x001c('0x90')][_0x001c('0x6c')]+0x1,'app':_0x001c('0xb3'),'appdata':'unmanaged','interval':_0x001c('0xb4')});}_0x58c76d[_0x001c('0xb2')][_0x001c('0xb5')]=!![];}return db[_0x001c('0x8e')][_0x001c('0x5d')]({'phone':_0x58c76d[_0x001c('0x64')][_0x001c('0xa0')],'messageId':_0x58c76d['body'][_0x001c('0xa2')],'body':_0x58c76d[_0x001c('0x64')][_0x001c('0x64')],'WhatsappAccountId':_0x554543['params']['id'],'WhatsappInteractionId':_0x17e612['id'],'direction':'in','ContactId':_0x17e612[_0x001c('0xb6')],'AttachmentId':_0x58c76d['body'][_0x001c('0xb7')]});})[_0x001c('0x37')](function(_0x65e71){_0x58c76d[_0x001c('0x29')]=_0x65e71;if(_0x58c76d[_0x001c('0xb2')][_0x001c('0xb8')]){return db[_0x001c('0x7e')][_0x001c('0x5c')]({'attributes':['id',_0x001c('0x3d')],'where':{'id':_0x58c76d[_0x001c('0xb2')][_0x001c('0xb8')]}})[_0x001c('0x37')](function(_0x45f625){if(_0x45f625){_0x58c76d['applications'][_0x001c('0xb9')]({'id':0x0,'priority':0x0,'app':_0x001c('0xba'),'appdata':_0x45f625['name']+','+(_0x58c76d[_0x001c('0x89')][_0x001c('0xbb')]||0xa),'interval':_0x001c('0xb4')});}return respondWithRpcPromise(_0x001c('0xbc'),_0x001c('0xbd'),_0x58c76d);});}return respondWithRpcPromise(_0x001c('0xbc'),_0x001c('0xbd'),_0x58c76d);})[_0x001c('0x37')](function(_0x2b6c49){if(_0x2b6c49){var _0x595633=0xc8;var _0xe6f4b0=_0x001c('0xbe');logger[_0x001c('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe6f4b0,_0x595633,_0x001c('0xbf'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xe6f4b0,_0x595633,_0x001c('0xbf'),JSON[_0x001c('0x26')](_0x2b6c49));if(_0x58c76d[_0x001c('0x89')]['type']===_0x001c('0xc0')){return _0x1cf4dc[_0x001c('0x2c')](_0x595633)[_0x001c('0x33')](_0x001c('0xc1'),'text/xml')['send']('\x0a');}else{return _0x1cf4dc['status'](_0x595633)['json'](_0x2b6c49);}}});})['catch'](handleError(_0x1cf4dc,null));};exports['send']=function(_0x78906d,_0x938999,_0x5041fe){var _0xc65ec4,_0xfe10be,_0x16b6a8;if(_[_0x001c('0xa4')](_0x78906d[_0x001c('0x64')]['body'])||_0x78906d[_0x001c('0x64')][_0x001c('0x64')]===''){throw new db['Sequelize'][(_0x001c('0xa5'))](_0x001c('0xa7'));}if(_[_0x001c('0xa4')](_0x78906d[_0x001c('0x64')]['to'])){throw new db[(_0x001c('0x94'))][(_0x001c('0xa5'))](_0x001c('0xc2'));}_0xc65ec4=_0x78906d[_0x001c('0x64')]['to'];return db[_0x001c('0x42')]['find']({'where':{'id':_0x78906d[_0x001c('0x5b')]['id']},'include':[{'model':db[_0x001c('0xab')],'as':_0x001c('0xc3'),'include':[{'model':db['CmContact'],'as':_0x001c('0xac'),'where':{'mobile':_0xc65ec4},'limit':0x1,'order':[[_0x001c('0x98'),'DESC']]}]}]})[_0x001c('0x37')](handleEntityNotFound(_0x938999,null))[_0x001c('0x37')](function(_0x13ff7d){if(_0x13ff7d&&_0x13ff7d[_0x001c('0xc3')]){_0xfe10be=_0x13ff7d[_0x001c('0x38')]({'plain':!![]});if(_0xfe10be[_0x001c('0xc3')]&&_0xfe10be[_0x001c('0xc3')][_0x001c('0xac')][_0x001c('0x6c')]){return _0xfe10be['List'][_0x001c('0xac')][0x0];}return db[_0x001c('0x93')][_0x001c('0x5d')](_['defaults'](_0x78906d[_0x001c('0x64')],{'firstName':_0xc65ec4,'mobile':_0xc65ec4,'phone':_0xc65ec4,'ListId':_0xfe10be[_0x001c('0x9a')]}));}})['then'](handleEntityNotFound(_0x938999,null))[_0x001c('0x37')](function(_0x32af41){if(_0x32af41){_0x16b6a8=_0x32af41;return db[_0x001c('0xb1')][_0x001c('0x5c')]({'where':{'ContactId':_0x16b6a8['id'],'closed':![],'WhatsappAccountId':_0xfe10be['id']}})[_0x001c('0x37')](function(_0xfd2e5e){if(_0xfd2e5e){return[_0xfd2e5e,![]];}return db[_0x001c('0xb1')][_0x001c('0x5d')]({'UserId':_0x78906d['user']['id'],'ContactId':_0x16b6a8['id'],'WhatsappAccountId':_0xfe10be['id'],'phone':_0xc65ec4,'firstMsgDirection':'out','Messages':[_[_0x001c('0x52')](_0x78906d['body'],{'read':![],'body':_0x78906d[_0x001c('0x64')]['body'],'phone':_0xc65ec4,'WhatsappAccountId':_0xfe10be['id'],'UserId':_0x78906d[_0x001c('0x5e')]['id'],'ContactId':_0x16b6a8['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x001c('0xc4')}]})[_0x001c('0x37')](function(_0x305b7e){return[_0x305b7e,!![]];});});}})[_0x001c('0x78')](function(_0x6deefd,_0x2749da){if(_0x2749da){return _0x6deefd;}return db['WhatsappMessage'][_0x001c('0x5d')](_['merge'](_0x78906d[_0x001c('0x64')],{'read':![],'body':_0x78906d[_0x001c('0x64')][_0x001c('0x64')],'phone':_0xc65ec4,'WhatsappAccountId':_0xfe10be['id'],'WhatsappInteractionId':_0x6deefd['id'],'UserId':_0x78906d[_0x001c('0x5e')]['id'],'ContactId':_0x16b6a8['id']}))[_0x001c('0x37')](function(_0x240d77){_0x6deefd[_0x001c('0xc5')][_0x001c('0xc4')]=[];_0x6deefd['dataValues'][_0x001c('0xc4')][_0x001c('0xc6')](_0x240d77[_0x001c('0xc5')]);return _0x6deefd;});})[_0x001c('0x37')](respondWithResult(_0x938999,null))[_0x001c('0x59')](handleError(_0x938999,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index af86ad1..cc7fd6b 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 _0x3990=['hasOwnProperty','events','../../mysqldb','WhatsappAccount','setMaxListeners','update','emit'];(function(_0x32713e,_0x16708d){var _0x50e9ad=function(_0x1bde5a){while(--_0x1bde5a){_0x32713e['push'](_0x32713e['shift']());}};_0x50e9ad(++_0x16708d);}(_0x3990,0x13c));var _0x0399=function(_0x237ead,_0x1869d8){_0x237ead=_0x237ead-0x0;var _0x3f78bf=_0x3990[_0x237ead];return _0x3f78bf;};'use strict';var EventEmitter=require(_0x0399('0x0'));var WhatsappAccount=require(_0x0399('0x1'))['db'][_0x0399('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0399('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0399('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b019e){return function(_0x5469ae,_0x4d92a0,_0x377f7f){WhatsappAccountEvents[_0x0399('0x5')](_0x2b019e+':'+_0x5469ae['id'],_0x5469ae);WhatsappAccountEvents[_0x0399('0x5')](_0x2b019e,_0x5469ae);_0x377f7f(null);};}for(var e in events){if(events[_0x0399('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xc785=['events','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4e0aa5,_0x265ec0){var _0xbe1964=function(_0x2ebcb4){while(--_0x2ebcb4){_0x4e0aa5['push'](_0x4e0aa5['shift']());}};_0xbe1964(++_0x265ec0);}(_0xc785,0x98));var _0x5c78=function(_0x369afb,_0x530b2c){_0x369afb=_0x369afb-0x0;var _0x4401a7=_0xc785[_0x369afb];return _0x4401a7;};'use strict';var EventEmitter=require(_0x5c78('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5c78('0x1')](0x0);var events={'afterCreate':_0x5c78('0x2'),'afterUpdate':_0x5c78('0x3'),'afterDestroy':'remove'};function emitEvent(_0x43d188){return function(_0x19268f,_0x473e8e,_0x71bbee){WhatsappAccountEvents['emit'](_0x43d188+':'+_0x19268f['id'],_0x19268f);WhatsappAccountEvents[_0x5c78('0x4')](_0x43d188,_0x19268f);_0x71bbee(null);};}for(var e in events){if(events[_0x5c78('0x5')](e)){var event=events[e];WhatsappAccount[_0x5c78('0x6')](e,emitEvent(event));}}module[_0x5c78('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index c9da47e..6f269ed 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 _0xb083=['util','../../config/logger','api','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb083,0x10e));var _0x3b08=function(_0x3d686b,_0x532d50){_0x3d686b=_0x3d686b-0x0;var _0x26da89=_0xb083[_0x3d686b];return _0x26da89;};'use strict';var _=require('lodash');var util=require(_0x3b08('0x0'));var logger=require(_0x3b08('0x1'))(_0x3b08('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b08('0x3'));var rimraf=require(_0x3b08('0x4'));var config=require('../../config/environment');var attributes=require(_0x3b08('0x5'));module[_0x3b08('0x6')]=function(_0x41ee90,_0xe5ea4){return _0x41ee90[_0x3b08('0x7')](_0x3b08('0x8'),attributes,{'tableName':_0x3b08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28b8=['lodash','../../config/logger','api','request-promise','path','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x47afcc,_0x4eb0a6){var _0x5b8ab5=function(_0x598988){while(--_0x598988){_0x47afcc['push'](_0x47afcc['shift']());}};_0x5b8ab5(++_0x4eb0a6);}(_0x28b8,0x186));var _0x828b=function(_0xde1b5,_0x291eca){_0xde1b5=_0xde1b5-0x0;var _0x52cd92=_0x28b8[_0xde1b5];return _0x52cd92;};'use strict';var _=require(_0x828b('0x0'));var util=require('util');var logger=require(_0x828b('0x1'))(_0x828b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x828b('0x3'));var fs=require('fs');var path=require(_0x828b('0x4'));var rimraf=require('rimraf');var config=require(_0x828b('0x5'));var attributes=require('./whatsappAccount.attributes');module[_0x828b('0x6')]=function(_0x2fd1a6,_0x5c2ece){return _0x2fd1a6[_0x828b('0x7')](_0x828b('0x8'),attributes,{'tableName':_0x828b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 0d82b08..189acab 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 _0xb126=['./whatsappAccount.socket','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','WhatsappAccount','find','options','raw','attributes','include','map','model','info','ShowWhatsappAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter'];(function(_0x2f69e,_0x325a70){var _0x4bfcf5=function(_0x17648e){while(--_0x17648e){_0x2f69e['push'](_0x2f69e['shift']());}};_0x4bfcf5(++_0x325a70);}(_0xb126,0x127));var _0x6b12=function(_0x5bf316,_0x42567e){_0x5bf316=_0x5bf316-0x0;var _0xece8fc=_0xb126[_0x5bf316];return _0xece8fc;};'use strict';var _=require(_0x6b12('0x0'));var util=require(_0x6b12('0x1'));var moment=require(_0x6b12('0x2'));var BPromise=require(_0x6b12('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b12('0x4'))['db'];var utils=require(_0x6b12('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b12('0x6'));var jayson=require(_0x6b12('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x6b12('0x8')]=_['defaults'](config[_0x6b12('0x8')],{'host':_0x6b12('0x9'),'port':0x18eb});var socket=require(_0x6b12('0xa'))(new Redis(config[_0x6b12('0x8')]));require(_0x6b12('0xb'))['register'](socket);function respondWithRpcPromise(_0x272e37,_0xfa2634,_0x39ec3d){return new BPromise(function(_0x517e99,_0x4c7155){return client[_0x6b12('0xc')](_0x272e37,_0x39ec3d)[_0x6b12('0xd')](function(_0x2ff2ec){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0xfa2634,_0x6b12('0xe'));logger[_0x6b12('0xf')](_0x6b12('0x10'),_0xfa2634,_0x6b12('0xe'),JSON[_0x6b12('0x11')](_0x2ff2ec));if(_0x2ff2ec[_0x6b12('0x12')]){if(_0x2ff2ec[_0x6b12('0x12')][_0x6b12('0x13')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xfa2634,_0x2ff2ec[_0x6b12('0x12')][_0x6b12('0x14')]);return _0x4c7155(_0x2ff2ec['error'][_0x6b12('0x14')]);}logger[_0x6b12('0x12')](_0x6b12('0x15'),_0xfa2634,_0x2ff2ec[_0x6b12('0x12')][_0x6b12('0x14')]);return _0x517e99(_0x2ff2ec[_0x6b12('0x12')]['message']);}else{logger['info'](_0x6b12('0x15'),_0xfa2634,_0x6b12('0xe'));_0x517e99(_0x2ff2ec[_0x6b12('0x16')]['message']);}})[_0x6b12('0x17')](function(_0xc3008d){logger[_0x6b12('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0xfa2634,_0xc3008d);_0x4c7155(_0xc3008d);});});}exports['ShowWhatsappAccount']=function(_0x6fc531){var _0x50e37f=this;return new Promise(function(_0x521033,_0x31f21a){return db[_0x6b12('0x18')][_0x6b12('0x19')]({'raw':_0x6fc531[_0x6b12('0x1a')]?_0x6fc531[_0x6b12('0x1a')][_0x6b12('0x1b')]===undefined?!![]:![]:!![],'where':_0x6fc531['options']?_0x6fc531[_0x6b12('0x1a')]['where']||null:null,'attributes':_0x6fc531[_0x6b12('0x1a')]?_0x6fc531[_0x6b12('0x1a')][_0x6b12('0x1c')]||null:null,'include':_0x6fc531[_0x6b12('0x1a')]?_0x6fc531['options'][_0x6b12('0x1d')]?_[_0x6b12('0x1e')](_0x6fc531['options']['include'],function(_0x123363){return{'model':db[_0x123363[_0x6b12('0x1f')]],'as':_0x123363['as'],'attributes':_0x123363[_0x6b12('0x1c')],'include':_0x123363[_0x6b12('0x1d')]?_[_0x6b12('0x1e')](_0x123363[_0x6b12('0x1d')],function(_0x24093b){return{'model':db[_0x24093b[_0x6b12('0x1f')]],'as':_0x24093b['as'],'attributes':_0x24093b['attributes'],'include':_0x24093b['include']?_['map'](_0x24093b[_0x6b12('0x1d')],function(_0x39b991){return{'model':db[_0x39b991[_0x6b12('0x1f')]],'as':_0x39b991['as'],'attributes':_0x39b991['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b12('0xd')](function(_0x286ee0){logger[_0x6b12('0x20')](_0x6b12('0x21'),_0x6fc531);logger['debug'](_0x6b12('0x21'),_0x6fc531,JSON[_0x6b12('0x11')](_0x286ee0));_0x521033(_0x286ee0);})[_0x6b12('0x17')](function(_0x2764a){logger['error'](_0x6b12('0x21'),_0x2764a[_0x6b12('0x14')],_0x6fc531);_0x31f21a(_0x50e37f[_0x6b12('0x12')](0x1f4,_0x2764a[_0x6b12('0x14')]));});});}; \ No newline at end of file +var _0x4215=['model','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4215,0x1b0));var _0x5421=function(_0x43eff0,_0x45498d){_0x43eff0=_0x43eff0-0x0;var _0x414ff5=_0x4215[_0x43eff0];return _0x414ff5;};'use strict';var _=require(_0x5421('0x0'));var util=require(_0x5421('0x1'));var moment=require(_0x5421('0x2'));var BPromise=require(_0x5421('0x3'));var rs=require(_0x5421('0x4'));var fs=require('fs');var Redis=require(_0x5421('0x5'));var db=require(_0x5421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5421('0x7'))(_0x5421('0x8'));var config=require(_0x5421('0x9'));var jayson=require(_0x5421('0xa'));var client=jayson['client'][_0x5421('0xb')]({'port':0x232a});config[_0x5421('0xc')]=_[_0x5421('0xd')](config[_0x5421('0xc')],{'host':_0x5421('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5421('0xc')]));require('./whatsappAccount.socket')[_0x5421('0xf')](socket);function respondWithRpcPromise(_0x2a4230,_0x1a6380,_0x56b92d){return new BPromise(function(_0x192d84,_0x3002c3){return client[_0x5421('0x10')](_0x2a4230,_0x56b92d)[_0x5421('0x11')](function(_0x35ad75){logger[_0x5421('0x12')](_0x5421('0x13'),_0x1a6380,'request\x20sent');logger['debug'](_0x5421('0x14'),_0x1a6380,_0x5421('0x15'),JSON['stringify'](_0x35ad75));if(_0x35ad75[_0x5421('0x16')]){if(_0x35ad75[_0x5421('0x16')][_0x5421('0x17')]===0x1f4){logger[_0x5421('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x1a6380,_0x35ad75['error'][_0x5421('0x18')]);return _0x3002c3(_0x35ad75[_0x5421('0x16')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1a6380,_0x35ad75['error'][_0x5421('0x18')]);return _0x192d84(_0x35ad75[_0x5421('0x16')][_0x5421('0x18')]);}else{logger[_0x5421('0x12')](_0x5421('0x13'),_0x1a6380,_0x5421('0x15'));_0x192d84(_0x35ad75[_0x5421('0x19')][_0x5421('0x18')]);}})[_0x5421('0x1a')](function(_0x299a28){logger['error'](_0x5421('0x13'),_0x1a6380,_0x299a28);_0x3002c3(_0x299a28);});});}exports[_0x5421('0x1b')]=function(_0x1cbb21){var _0x333c7a=this;return new Promise(function(_0x2f9508,_0x51b3bb){return db[_0x5421('0x1c')][_0x5421('0x1d')]({'raw':_0x1cbb21['options']?_0x1cbb21['options'][_0x5421('0x1e')]===undefined?!![]:![]:!![],'where':_0x1cbb21[_0x5421('0x1f')]?_0x1cbb21[_0x5421('0x1f')][_0x5421('0x20')]||null:null,'attributes':_0x1cbb21['options']?_0x1cbb21['options'][_0x5421('0x21')]||null:null,'include':_0x1cbb21['options']?_0x1cbb21['options'][_0x5421('0x22')]?_['map'](_0x1cbb21[_0x5421('0x1f')]['include'],function(_0x2c30fe){return{'model':db[_0x2c30fe['model']],'as':_0x2c30fe['as'],'attributes':_0x2c30fe['attributes'],'include':_0x2c30fe[_0x5421('0x22')]?_['map'](_0x2c30fe[_0x5421('0x22')],function(_0x4633f0){return{'model':db[_0x4633f0['model']],'as':_0x4633f0['as'],'attributes':_0x4633f0[_0x5421('0x21')],'include':_0x4633f0[_0x5421('0x22')]?_[_0x5421('0x23')](_0x4633f0[_0x5421('0x22')],function(_0x2092d4){return{'model':db[_0x2092d4[_0x5421('0x24')]],'as':_0x2092d4['as'],'attributes':_0x2092d4[_0x5421('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5421('0x11')](function(_0x46f502){logger[_0x5421('0x12')](_0x5421('0x1b'),_0x1cbb21);logger[_0x5421('0x25')](_0x5421('0x1b'),_0x1cbb21,JSON[_0x5421('0x26')](_0x46f502));_0x2f9508(_0x46f502);})[_0x5421('0x1a')](function(_0x4343a3){logger['error'](_0x5421('0x1b'),_0x4343a3[_0x5421('0x18')],_0x1cbb21);_0x51b3bb(_0x333c7a[_0x5421('0x16')](0x1f4,_0x4343a3[_0x5421('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d81da62..030265e 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 _0x9989=['update','removeListener','length','./whatsappAccount.events','save'];(function(_0xb94070,_0x5c6650){var _0x3dbb3f=function(_0x3730fd){while(--_0x3730fd){_0xb94070['push'](_0xb94070['shift']());}};_0x3dbb3f(++_0x5c6650);}(_0x9989,0x1cf));var _0x9998=function(_0x1f76bb,_0x2275e2){_0x1f76bb=_0x1f76bb-0x0;var _0x355cfd=_0x9989[_0x1f76bb];return _0x355cfd;};'use strict';var WhatsappAccountEvents=require(_0x9998('0x0'));var events=[_0x9998('0x1'),'remove',_0x9998('0x2')];function createListener(_0x5c90bf,_0x250238){return function(_0x15638e){_0x250238['emit'](_0x5c90bf,_0x15638e);};}function removeListener(_0x237aa4,_0x38c452){return function(){WhatsappAccountEvents[_0x9998('0x3')](_0x237aa4,_0x38c452);};}exports['register']=function(_0x10db39){for(var _0xf0fd9f=0x0,_0x423693=events[_0x9998('0x4')];_0xf0fd9f<_0x423693;_0xf0fd9f++){var _0x3c5c40=events[_0xf0fd9f];var _0x6c5075=createListener('whatsappAccount:'+_0x3c5c40,_0x10db39);WhatsappAccountEvents['on'](_0x3c5c40,_0x6c5075);}}; \ No newline at end of file +var _0xe417=['register','length','removeListener'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xe417,0x6b));var _0x7e41=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xe417[_0x50007c];return _0x5c1ec7;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save','remove','update'];function createListener(_0x7a132,_0x17b032){return function(_0x9ae7f){_0x17b032['emit'](_0x7a132,_0x9ae7f);};}function removeListener(_0x1a3072,_0x5c3641){return function(){WhatsappAccountEvents[_0x7e41('0x0')](_0x1a3072,_0x5c3641);};}exports[_0x7e41('0x1')]=function(_0x567d15){for(var _0x327951=0x0,_0x273c6b=events[_0x7e41('0x2')];_0x327951<_0x273c6b;_0x327951++){var _0x3bc783=events[_0x327951];var _0x21d47b=createListener('whatsappAccount:'+_0x3bc783,_0x567d15);WhatsappAccountEvents['on'](_0x3bc783,_0x21d47b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d885e19..9075355 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 _0xbe42=['/:id','update','delete','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','post','create','put'];(function(_0x199c4d,_0x2c6fd9){var _0x42d717=function(_0x3265c5){while(--_0x3265c5){_0x199c4d['push'](_0x199c4d['shift']());}};_0x42d717(++_0x2c6fd9);}(_0xbe42,0x1b4));var _0x2be4=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0xbe42[_0xe2c95e];return _0x42ce6f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2be4('0x0'));var timeout=require(_0x2be4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2be4('0x2'));var auth=require(_0x2be4('0x3'));var interaction=require(_0x2be4('0x4'));var config=require('../../config/environment');var controller=require(_0x2be4('0x5'));router[_0x2be4('0x6')]('/',auth[_0x2be4('0x7')](),controller[_0x2be4('0x8')]);router[_0x2be4('0x6')]('/:id',auth[_0x2be4('0x7')](),controller['show']);router[_0x2be4('0x9')]('/',auth[_0x2be4('0x7')](),controller[_0x2be4('0xa')]);router[_0x2be4('0xb')](_0x2be4('0xc'),auth[_0x2be4('0x7')](),controller[_0x2be4('0xd')]);router[_0x2be4('0xe')]('/:id',auth[_0x2be4('0x7')](),controller['destroy']);module[_0x2be4('0xf')]=router; \ No newline at end of file +var _0x4c5d=['show','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x4c5d,0xfe));var _0xd4c5=function(_0x272233,_0x4d1a8d){_0x272233=_0x272233-0x0;var _0x2ea904=_0x4c5d[_0x272233];return _0x2ea904;};'use strict';var multer=require(_0xd4c5('0x0'));var util=require(_0xd4c5('0x1'));var path=require('path');var timeout=require(_0xd4c5('0x2'));var express=require(_0xd4c5('0x3'));var router=express[_0xd4c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd4c5('0x5'));var interaction=require(_0xd4c5('0x6'));var config=require(_0xd4c5('0x7'));var controller=require(_0xd4c5('0x8'));router[_0xd4c5('0x9')]('/',auth[_0xd4c5('0xa')](),controller[_0xd4c5('0xb')]);router[_0xd4c5('0x9')]('/:id',auth[_0xd4c5('0xa')](),controller[_0xd4c5('0xc')]);router['post']('/',auth[_0xd4c5('0xa')](),controller[_0xd4c5('0xd')]);router[_0xd4c5('0xe')](_0xd4c5('0xf'),auth[_0xd4c5('0xa')](),controller[_0xd4c5('0x10')]);router[_0xd4c5('0x11')](_0xd4c5('0xf'),auth[_0xd4c5('0xa')](),controller['destroy']);module[_0xd4c5('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 2d43d2f..9cd4034 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 _0x908f=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x908f,0x70));var _0xf908=function(_0x137c16,_0x1cdbe2){_0x137c16=_0x137c16-0x0;var _0x2df557=_0x908f[_0x137c16];return _0x2df557;};'use strict';var Sequelize=require(_0xf908('0x0'));module[_0xf908('0x1')]={'priority':{'type':Sequelize[_0xf908('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf908('0x3')],'allowNull':![],'defaultValue':_0xf908('0x4')},'appdata':{'type':Sequelize[_0xf908('0x5')]()},'description':{'type':Sequelize[_0xf908('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf908('0x6')}}; \ No newline at end of file +var _0xe7c9=['STRING','sequelize','noop','TEXT'];(function(_0x25eae9,_0x5d3260){var _0x3a8d1f=function(_0xbd6b18){while(--_0xbd6b18){_0x25eae9['push'](_0x25eae9['shift']());}};_0x3a8d1f(++_0x5d3260);}(_0xe7c9,0x12d));var _0x9e7c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe7c9[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x9e7c('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9e7c('0x1')},'appdata':{'type':Sequelize[_0x9e7c('0x2')]()},'description':{'type':Sequelize[_0x9e7c('0x3')]},'interval':{'type':Sequelize[_0x9e7c('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 95d05de..2b90a99 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 _0xfb11=['options','includeAll','include','rows','params','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge'];(function(_0x215954,_0x59b51e){var _0x2f8a10=function(_0x5f0033){while(--_0x5f0033){_0x215954['push'](_0x215954['shift']());}};_0x2f8a10(++_0x59b51e);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xfb11[_0x3ce3c];return _0x55a2c9;};'use strict';var emlformat=require(_0x1fb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb1('0x1'));var jsonpatch=require(_0x1fb1('0x2'));var rp=require('request-promise');var moment=require(_0x1fb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1fb1('0x4'));var util=require('util');var path=require(_0x1fb1('0x5'));var sox=require(_0x1fb1('0x6'));var csv=require('to-csv');var ejs=require(_0x1fb1('0x7'));var fs=require('fs');var fs_extra=require(_0x1fb1('0x8'));var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0xd'));var querystring=require(_0x1fb1('0xe'));var Papa=require(_0x1fb1('0xf'));var Redis=require(_0x1fb1('0x10'));var authService=require(_0x1fb1('0x11'));var qs=require(_0x1fb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x13'));var logger=require('../../config/logger')(_0x1fb1('0x14'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x15'));var licenseUtil=require(_0x1fb1('0x16'));var db=require(_0x1fb1('0x17'))['db'];function respondWithStatusCode(_0x10bcac,_0x333229){_0x333229=_0x333229||0xcc;return function(_0x14f290){if(_0x14f290){return _0x10bcac['sendStatus'](_0x333229);}return _0x10bcac[_0x1fb1('0x18')](_0x333229)[_0x1fb1('0x19')]();};}function respondWithResult(_0x2c5be1,_0x44f24c){_0x44f24c=_0x44f24c||0xc8;return function(_0xd83038){if(_0xd83038){return _0x2c5be1[_0x1fb1('0x18')](_0x44f24c)[_0x1fb1('0x1a')](_0xd83038);}};}function respondWithFilteredResult(_0x316fe5,_0x358b58){return function(_0x4cbe42){if(_0x4cbe42){var _0x5c8d23=typeof _0x358b58[_0x1fb1('0x1b')]===_0x1fb1('0x1c')&&typeof _0x358b58[_0x1fb1('0x1d')]==='undefined';var _0x161ca3=_0x4cbe42[_0x1fb1('0x1e')];var _0x24d4df=_0x5c8d23?0x0:_0x358b58[_0x1fb1('0x1b')];var _0x33c6b6=_0x5c8d23?_0x4cbe42[_0x1fb1('0x1e')]:_0x358b58[_0x1fb1('0x1b')]+_0x358b58[_0x1fb1('0x1d')];var _0x4041ea;if(_0x33c6b6>=_0x161ca3){_0x33c6b6=_0x161ca3;_0x4041ea=0xc8;}else{_0x4041ea=0xce;}_0x316fe5['status'](_0x4041ea);return _0x316fe5[_0x1fb1('0x1f')]('Content-Range',_0x24d4df+'-'+_0x33c6b6+'/'+_0x161ca3)['json'](_0x4cbe42);}return null;};}function patchUpdates(_0xdf9c1b){return function(_0x313d9a){try{jsonpatch[_0x1fb1('0x20')](_0x313d9a,_0xdf9c1b,!![]);}catch(_0x54ad97){return BPromise[_0x1fb1('0x21')](_0x54ad97);}return _0x313d9a['save']();};}function saveUpdates(_0x5c76f5,_0x532c63){return function(_0x31178c){if(_0x31178c){return _0x31178c[_0x1fb1('0x22')](_0x5c76f5)[_0x1fb1('0x23')](function(_0x10924f){return _0x10924f;});}return null;};}function removeEntity(_0x303a06,_0x53b8af){return function(_0x4272c7){if(_0x4272c7){return _0x4272c7[_0x1fb1('0x24')]()[_0x1fb1('0x23')](function(){_0x303a06[_0x1fb1('0x18')](0xcc)[_0x1fb1('0x19')]();});}};}function handleEntityNotFound(_0x1353a4,_0x3680b5){return function(_0x2de1d4){if(!_0x2de1d4){_0x1353a4['sendStatus'](0x194);}return _0x2de1d4;};}function handleError(_0x1b25b3,_0x1aac7d){_0x1aac7d=_0x1aac7d||0x1f4;return function(_0x46ff60){logger[_0x1fb1('0x25')](_0x46ff60[_0x1fb1('0x26')]);if(_0x46ff60[_0x1fb1('0x27')]){delete _0x46ff60[_0x1fb1('0x27')];}_0x1b25b3[_0x1fb1('0x18')](_0x1aac7d)[_0x1fb1('0x28')](_0x46ff60);};}exports[_0x1fb1('0x29')]=function(_0x5e99e7,_0x497017){var _0x39fc43={},_0xe8ec0a={},_0x2f6c88={'count':0x0,'rows':[]};var _0x520ee2=_[_0x1fb1('0x2a')](db[_0x1fb1('0x2b')][_0x1fb1('0x2c')],function(_0x1b71cb){return{'name':_0x1b71cb['fieldName'],'type':_0x1b71cb[_0x1fb1('0x2d')][_0x1fb1('0x2e')]};});_0xe8ec0a['model']=_[_0x1fb1('0x2a')](_0x520ee2,'name');_0xe8ec0a['query']=_[_0x1fb1('0x2f')](_0x5e99e7[_0x1fb1('0x30')]);_0xe8ec0a['filters']=_[_0x1fb1('0x31')](_0xe8ec0a[_0x1fb1('0x32')],_0xe8ec0a[_0x1fb1('0x30')]);_0x39fc43[_0x1fb1('0x33')]=_[_0x1fb1('0x31')](_0xe8ec0a['model'],qs[_0x1fb1('0x34')](_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x34')]));_0x39fc43[_0x1fb1('0x33')]=_0x39fc43[_0x1fb1('0x33')][_0x1fb1('0x35')]?_0x39fc43[_0x1fb1('0x33')]:_0xe8ec0a[_0x1fb1('0x32')];if(!_0x5e99e7[_0x1fb1('0x30')]['hasOwnProperty'](_0x1fb1('0x36'))){_0x39fc43['limit']=qs[_0x1fb1('0x1d')](_0x5e99e7['query'][_0x1fb1('0x1d')]);_0x39fc43['offset']=qs['offset'](_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x1b')]);}_0x39fc43[_0x1fb1('0x37')]=qs[_0x1fb1('0x38')](_0x5e99e7['query'][_0x1fb1('0x38')]);_0x39fc43[_0x1fb1('0x39')]=qs[_0x1fb1('0x3a')](_['pick'](_0x5e99e7[_0x1fb1('0x30')],_0xe8ec0a[_0x1fb1('0x3a')]),_0x520ee2);if(_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3b')]){_0x39fc43[_0x1fb1('0x39')]=_[_0x1fb1('0x3c')](_0x39fc43[_0x1fb1('0x39')],{'$or':_['map'](_0x520ee2,function(_0x3a8a63){if(_0x3a8a63[_0x1fb1('0x2d')]!=='VIRTUAL'){var _0x473894={};_0x473894[_0x3a8a63['name']]={'$like':'%'+_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3b')]+'%'};return _0x473894;}})});}_0x39fc43=_[_0x1fb1('0x3c')]({},_0x39fc43,_0x5e99e7[_0x1fb1('0x3d')]);var _0x1a0b32={'where':_0x39fc43[_0x1fb1('0x39')]};return db[_0x1fb1('0x2b')][_0x1fb1('0x1e')](_0x1a0b32)[_0x1fb1('0x23')](function(_0x2c023e){_0x2f6c88[_0x1fb1('0x1e')]=_0x2c023e;if(_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3e')]){_0x39fc43[_0x1fb1('0x3f')]=[{'all':!![]}];}return db[_0x1fb1('0x2b')]['findAll'](_0x39fc43);})[_0x1fb1('0x23')](function(_0xca1fd3){_0x2f6c88[_0x1fb1('0x40')]=_0xca1fd3;return _0x2f6c88;})[_0x1fb1('0x23')](respondWithFilteredResult(_0x497017,_0x39fc43))['catch'](handleError(_0x497017,null));};exports['show']=function(_0xf6f17d,_0xef42e0){var _0x307faf={'raw':!![],'where':{'id':_0xf6f17d[_0x1fb1('0x41')]['id']}},_0x3edc8a={};_0x3edc8a[_0x1fb1('0x32')]=_[_0x1fb1('0x2f')](db[_0x1fb1('0x2b')][_0x1fb1('0x2c')]);_0x3edc8a[_0x1fb1('0x30')]=_['keys'](_0xf6f17d[_0x1fb1('0x30')]);_0x3edc8a['filters']=_['intersection'](_0x3edc8a[_0x1fb1('0x32')],_0x3edc8a[_0x1fb1('0x30')]);_0x307faf[_0x1fb1('0x33')]=_[_0x1fb1('0x31')](_0x3edc8a['model'],qs['fields'](_0xf6f17d[_0x1fb1('0x30')][_0x1fb1('0x34')]));_0x307faf[_0x1fb1('0x33')]=_0x307faf[_0x1fb1('0x33')][_0x1fb1('0x35')]?_0x307faf[_0x1fb1('0x33')]:_0x3edc8a[_0x1fb1('0x32')];if(_0xf6f17d[_0x1fb1('0x30')][_0x1fb1('0x3e')]){_0x307faf['include']=[{'all':!![]}];}_0x307faf=_['merge']({},_0x307faf,_0xf6f17d[_0x1fb1('0x3d')]);return db['WhatsappApplication'][_0x1fb1('0x42')](_0x307faf)[_0x1fb1('0x23')](handleEntityNotFound(_0xef42e0,null))[_0x1fb1('0x23')](respondWithResult(_0xef42e0,null))[_0x1fb1('0x43')](handleError(_0xef42e0,null));};exports[_0x1fb1('0x44')]=function(_0x3c3fbf,_0x5af135){return db[_0x1fb1('0x2b')][_0x1fb1('0x44')](_0x3c3fbf[_0x1fb1('0x45')],{})['then'](respondWithResult(_0x5af135,0xc9))[_0x1fb1('0x43')](handleError(_0x5af135,null));};exports['update']=function(_0x6e105b,_0xba4fa7){if(_0x6e105b[_0x1fb1('0x45')]['id']){delete _0x6e105b['body']['id'];}return db[_0x1fb1('0x2b')][_0x1fb1('0x42')]({'where':{'id':_0x6e105b['params']['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0xba4fa7,null))[_0x1fb1('0x23')](saveUpdates(_0x6e105b[_0x1fb1('0x45')],null))['then'](respondWithResult(_0xba4fa7,null))['catch'](handleError(_0xba4fa7,null));};exports['destroy']=function(_0x31a85a,_0x2365b5){return db[_0x1fb1('0x2b')][_0x1fb1('0x42')]({'where':{'id':_0x31a85a[_0x1fb1('0x41')]['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0x2365b5,null))['then'](removeEntity(_0x2365b5,null))['catch'](handleError(_0x2365b5,null));}; \ No newline at end of file +var _0x86dc=['fieldName','type','query','keys','intersection','attributes','model','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','length','includeAll','find','body','catch','params','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes'];(function(_0x304954,_0x319bf8){var _0x3afe3a=function(_0x56de64){while(--_0x56de64){_0x304954['push'](_0x304954['shift']());}};_0x3afe3a(++_0x319bf8);}(_0x86dc,0x13e));var _0xc86d=function(_0x5609e4,_0x1d34a9){_0x5609e4=_0x5609e4-0x0;var _0x313939=_0x86dc[_0x5609e4];return _0x313939;};'use strict';var emlformat=require(_0xc86d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc86d('0x1'));var rp=require(_0xc86d('0x2'));var moment=require(_0xc86d('0x3'));var BPromise=require(_0xc86d('0x4'));var Mustache=require('mustache');var util=require(_0xc86d('0x5'));var path=require('path');var sox=require(_0xc86d('0x6'));var csv=require('to-csv');var ejs=require(_0xc86d('0x7'));var fs=require('fs');var fs_extra=require(_0xc86d('0x8'));var _=require(_0xc86d('0x9'));var squel=require('squel');var crypto=require(_0xc86d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc86d('0xb'));var toCsv=require(_0xc86d('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc86d('0xd'));var authService=require(_0xc86d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc86d('0xf'));var hardwareService=require(_0xc86d('0x10'));var logger=require(_0xc86d('0x11'))(_0xc86d('0x12'));var utils=require(_0xc86d('0x13'));var config=require(_0xc86d('0x14'));var licenseUtil=require(_0xc86d('0x15'));var db=require(_0xc86d('0x16'))['db'];function respondWithStatusCode(_0x299776,_0x38abd7){_0x38abd7=_0x38abd7||0xcc;return function(_0x352469){if(_0x352469){return _0x299776[_0xc86d('0x17')](_0x38abd7);}return _0x299776[_0xc86d('0x18')](_0x38abd7)[_0xc86d('0x19')]();};}function respondWithResult(_0x450fb1,_0x2a963c){_0x2a963c=_0x2a963c||0xc8;return function(_0x176ce1){if(_0x176ce1){return _0x450fb1[_0xc86d('0x18')](_0x2a963c)[_0xc86d('0x1a')](_0x176ce1);}};}function respondWithFilteredResult(_0x24c9c3,_0x199a4a){return function(_0x5e58aa){if(_0x5e58aa){var _0x4fb8e7=typeof _0x199a4a['offset']===_0xc86d('0x1b')&&typeof _0x199a4a[_0xc86d('0x1c')]===_0xc86d('0x1b');var _0x2a9459=_0x5e58aa[_0xc86d('0x1d')];var _0x3d7e72=_0x4fb8e7?0x0:_0x199a4a[_0xc86d('0x1e')];var _0x5f3ece=_0x4fb8e7?_0x5e58aa['count']:_0x199a4a[_0xc86d('0x1e')]+_0x199a4a[_0xc86d('0x1c')];var _0x445863;if(_0x5f3ece>=_0x2a9459){_0x5f3ece=_0x2a9459;_0x445863=0xc8;}else{_0x445863=0xce;}_0x24c9c3['status'](_0x445863);return _0x24c9c3[_0xc86d('0x1f')](_0xc86d('0x20'),_0x3d7e72+'-'+_0x5f3ece+'/'+_0x2a9459)[_0xc86d('0x1a')](_0x5e58aa);}return null;};}function patchUpdates(_0x4eb0e5){return function(_0x330c70){try{jsonpatch[_0xc86d('0x21')](_0x330c70,_0x4eb0e5,!![]);}catch(_0x548f59){return BPromise[_0xc86d('0x22')](_0x548f59);}return _0x330c70[_0xc86d('0x23')]();};}function saveUpdates(_0x3a4abb,_0x27ebd8){return function(_0x57d804){if(_0x57d804){return _0x57d804[_0xc86d('0x24')](_0x3a4abb)[_0xc86d('0x25')](function(_0xad7be1){return _0xad7be1;});}return null;};}function removeEntity(_0x1bb9ed,_0xbeed40){return function(_0x56278d){if(_0x56278d){return _0x56278d[_0xc86d('0x26')]()[_0xc86d('0x25')](function(){_0x1bb9ed[_0xc86d('0x18')](0xcc)[_0xc86d('0x19')]();});}};}function handleEntityNotFound(_0x27d636,_0x5347f7){return function(_0x1458fe){if(!_0x1458fe){_0x27d636['sendStatus'](0x194);}return _0x1458fe;};}function handleError(_0x4e1312,_0x533cce){_0x533cce=_0x533cce||0x1f4;return function(_0x2782b8){logger[_0xc86d('0x27')](_0x2782b8[_0xc86d('0x28')]);if(_0x2782b8[_0xc86d('0x29')]){delete _0x2782b8[_0xc86d('0x29')];}_0x4e1312[_0xc86d('0x18')](_0x533cce)[_0xc86d('0x2a')](_0x2782b8);};}exports[_0xc86d('0x2b')]=function(_0x4db581,_0x397a55){var _0x2bce7b={},_0x581a9e={},_0x5cf11a={'count':0x0,'rows':[]};var _0x7dfc22=_[_0xc86d('0x2c')](db[_0xc86d('0x2d')][_0xc86d('0x2e')],function(_0x384bc9){return{'name':_0x384bc9[_0xc86d('0x2f')],'type':_0x384bc9[_0xc86d('0x30')]['key']};});_0x581a9e['model']=_[_0xc86d('0x2c')](_0x7dfc22,_0xc86d('0x29'));_0x581a9e[_0xc86d('0x31')]=_[_0xc86d('0x32')](_0x4db581[_0xc86d('0x31')]);_0x581a9e['filters']=_[_0xc86d('0x33')](_0x581a9e['model'],_0x581a9e[_0xc86d('0x31')]);_0x2bce7b[_0xc86d('0x34')]=_[_0xc86d('0x33')](_0x581a9e[_0xc86d('0x35')],qs[_0xc86d('0x36')](_0x4db581[_0xc86d('0x31')][_0xc86d('0x36')]));_0x2bce7b[_0xc86d('0x34')]=_0x2bce7b[_0xc86d('0x34')]['length']?_0x2bce7b['attributes']:_0x581a9e['model'];if(!_0x4db581['query']['hasOwnProperty']('nolimit')){_0x2bce7b[_0xc86d('0x1c')]=qs[_0xc86d('0x1c')](_0x4db581[_0xc86d('0x31')][_0xc86d('0x1c')]);_0x2bce7b[_0xc86d('0x1e')]=qs[_0xc86d('0x1e')](_0x4db581['query'][_0xc86d('0x1e')]);}_0x2bce7b[_0xc86d('0x37')]=qs[_0xc86d('0x38')](_0x4db581[_0xc86d('0x31')][_0xc86d('0x38')]);_0x2bce7b[_0xc86d('0x39')]=qs[_0xc86d('0x3a')](_[_0xc86d('0x3b')](_0x4db581[_0xc86d('0x31')],_0x581a9e[_0xc86d('0x3a')]),_0x7dfc22);if(_0x4db581['query'][_0xc86d('0x3c')]){_0x2bce7b['where']=_[_0xc86d('0x3d')](_0x2bce7b[_0xc86d('0x39')],{'$or':_[_0xc86d('0x2c')](_0x7dfc22,function(_0x560997){if(_0x560997[_0xc86d('0x30')]!==_0xc86d('0x3e')){var _0x3202b8={};_0x3202b8[_0x560997['name']]={'$like':'%'+_0x4db581[_0xc86d('0x31')][_0xc86d('0x3c')]+'%'};return _0x3202b8;}})});}_0x2bce7b=_[_0xc86d('0x3d')]({},_0x2bce7b,_0x4db581[_0xc86d('0x3f')]);var _0xa6a0f9={'where':_0x2bce7b['where']};return db[_0xc86d('0x2d')][_0xc86d('0x1d')](_0xa6a0f9)[_0xc86d('0x25')](function(_0x38d25e){_0x5cf11a[_0xc86d('0x1d')]=_0x38d25e;if(_0x4db581[_0xc86d('0x31')]['includeAll']){_0x2bce7b[_0xc86d('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xc86d('0x41')](_0x2bce7b);})[_0xc86d('0x25')](function(_0x39bdc7){_0x5cf11a[_0xc86d('0x42')]=_0x39bdc7;return _0x5cf11a;})['then'](respondWithFilteredResult(_0x397a55,_0x2bce7b))['catch'](handleError(_0x397a55,null));};exports['show']=function(_0x9841ff,_0x1a583b){var _0x172f7b={'raw':!![],'where':{'id':_0x9841ff['params']['id']}},_0x2c3f3d={};_0x2c3f3d[_0xc86d('0x35')]=_[_0xc86d('0x32')](db[_0xc86d('0x2d')][_0xc86d('0x2e')]);_0x2c3f3d[_0xc86d('0x31')]=_['keys'](_0x9841ff[_0xc86d('0x31')]);_0x2c3f3d[_0xc86d('0x3a')]=_[_0xc86d('0x33')](_0x2c3f3d[_0xc86d('0x35')],_0x2c3f3d['query']);_0x172f7b[_0xc86d('0x34')]=_['intersection'](_0x2c3f3d['model'],qs[_0xc86d('0x36')](_0x9841ff['query'][_0xc86d('0x36')]));_0x172f7b[_0xc86d('0x34')]=_0x172f7b[_0xc86d('0x34')][_0xc86d('0x43')]?_0x172f7b['attributes']:_0x2c3f3d[_0xc86d('0x35')];if(_0x9841ff[_0xc86d('0x31')][_0xc86d('0x44')]){_0x172f7b['include']=[{'all':!![]}];}_0x172f7b=_['merge']({},_0x172f7b,_0x9841ff[_0xc86d('0x3f')]);return db['WhatsappApplication'][_0xc86d('0x45')](_0x172f7b)[_0xc86d('0x25')](handleEntityNotFound(_0x1a583b,null))[_0xc86d('0x25')](respondWithResult(_0x1a583b,null))['catch'](handleError(_0x1a583b,null));};exports['create']=function(_0xe8a2aa,_0x21b745){return db[_0xc86d('0x2d')]['create'](_0xe8a2aa[_0xc86d('0x46')],{})['then'](respondWithResult(_0x21b745,0xc9))[_0xc86d('0x47')](handleError(_0x21b745,null));};exports[_0xc86d('0x24')]=function(_0x57231e,_0x485e8b){if(_0x57231e[_0xc86d('0x46')]['id']){delete _0x57231e['body']['id'];}return db[_0xc86d('0x2d')]['find']({'where':{'id':_0x57231e[_0xc86d('0x48')]['id']}})[_0xc86d('0x25')](handleEntityNotFound(_0x485e8b,null))[_0xc86d('0x25')](saveUpdates(_0x57231e['body'],null))['then'](respondWithResult(_0x485e8b,null))[_0xc86d('0x47')](handleError(_0x485e8b,null));};exports[_0xc86d('0x26')]=function(_0x3b5d6a,_0x1ed0fb){return db['WhatsappApplication'][_0xc86d('0x45')]({'where':{'id':_0x3b5d6a[_0xc86d('0x48')]['id']}})[_0xc86d('0x25')](handleEntityNotFound(_0x1ed0fb,null))[_0xc86d('0x25')](removeEntity(_0x1ed0fb,null))[_0xc86d('0x47')](handleError(_0x1ed0fb,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 37f3305..63040e0 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 _0xe64a=['util','../../config/logger','api','moment','bluebird','request-promise','path','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4fca8e,_0x4c2162){var _0x23f51d=function(_0x4e42ae){while(--_0x4e42ae){_0x4fca8e['push'](_0x4fca8e['shift']());}};_0x23f51d(++_0x4c2162);}(_0xe64a,0x1e0));var _0xae64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe64a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var logger=require(_0xae64('0x2'))(_0xae64('0x3'));var moment=require(_0xae64('0x4'));var BPromise=require(_0xae64('0x5'));var rp=require(_0xae64('0x6'));var fs=require('fs');var path=require(_0xae64('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x2b1046,_0x896007){return _0x2b1046[_0xae64('0x8')](_0xae64('0x9'),attributes,{'tableName':_0xae64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xae64('0xb'),'collate':_0xae64('0xc')});}; \ No newline at end of file +var _0x7d9f=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','whatsapp_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x32f08d,_0x1364e4){var _0x1b6d8b=function(_0x5e0e6c){while(--_0x5e0e6c){_0x32f08d['push'](_0x32f08d['shift']());}};_0x1b6d8b(++_0x1364e4);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x7d9f[_0x4dab14];return _0xf41aa;};'use strict';var _=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var logger=require(_0xf7d9('0x2'))(_0xf7d9('0x3'));var moment=require(_0xf7d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7d9('0x5'));var fs=require('fs');var path=require(_0xf7d9('0x6'));var rimraf=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var attributes=require(_0xf7d9('0x9'));module['exports']=function(_0x4b50c7,_0x2eb0f1){return _0x4b50c7[_0xf7d9('0xa')]('WhatsappApplication',attributes,{'tableName':_0xf7d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf7d9('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1b7bbbb..e4fc8e4 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 _0x0e85=['bluebird','randomstring','../../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','message','result','catch','lodash','util'];(function(_0x9e18e9,_0x2dc272){var _0x1051b0=function(_0x3557d9){while(--_0x3557d9){_0x9e18e9['push'](_0x9e18e9['shift']());}};_0x1051b0(++_0x2dc272);}(_0x0e85,0x7c));var _0x50e8=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0e85[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file +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(_0x3cfdf3,_0x2d3ca8){var _0xf4b57f=function(_0x4d7b79){while(--_0x4d7b79){_0x3cfdf3['push'](_0x3cfdf3['shift']());}};_0xf4b57f(++_0x2d3ca8);}(_0x425d,0x1e0));var _0xd425=function(_0x54a6b1,_0x3399e9){_0x54a6b1=_0x54a6b1-0x0;var _0x453d7b=_0x425d[_0x54a6b1];return _0x453d7b;};'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 diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c29c897..bb735f2 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 _0x86f4=['get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','put','whatsapp','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2c5fe4,_0x2ae8e5){var _0x20a6cf=function(_0x55e50f){while(--_0x55e50f){_0x2c5fe4['push'](_0x2c5fe4['shift']());}};_0x20a6cf(++_0x2ae8e5);}(_0x86f4,0x18a));var _0x486f=function(_0x13bf7a,_0x11a14a){_0x13bf7a=_0x13bf7a-0x0;var _0x4caf9b=_0x86f4[_0x13bf7a];return _0x4caf9b;};'use strict';var multer=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var path=require(_0x486f('0x2'));var timeout=require(_0x486f('0x3'));var express=require(_0x486f('0x4'));var router=express[_0x486f('0x5')]();var fs_extra=require(_0x486f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var controller=require('./whatsappInteraction.controller');router[_0x486f('0x9')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0xb')]);router[_0x486f('0x9')](_0x486f('0xc'),auth[_0x486f('0xa')](),controller['describe']);router[_0x486f('0x9')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0xe')]);router[_0x486f('0x9')](_0x486f('0xf'),auth[_0x486f('0xa')](),controller[_0x486f('0x10')]);router[_0x486f('0x9')](_0x486f('0x11'),auth[_0x486f('0xa')](),controller[_0x486f('0x12')]);router[_0x486f('0x13')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0x14')]);router[_0x486f('0x13')](_0x486f('0xf'),auth['isAuthenticated'](),controller[_0x486f('0x15')]);router['post'](_0x486f('0x16'),auth[_0x486f('0xa')](),interaction[_0x486f('0x17')]('whatsapp','whatsappinteraction:addtags'),controller[_0x486f('0x18')]);router[_0x486f('0x19')]('/:id',auth[_0x486f('0xa')](),interaction[_0x486f('0x17')](_0x486f('0x1a'),'whatsappinteraction:update'),controller['update']);router[_0x486f('0x1b')](_0x486f('0xd'),auth[_0x486f('0xa')](),interaction[_0x486f('0x17')]('whatsapp','whatsappinteraction:destroy'),controller[_0x486f('0x1c')]);router[_0x486f('0x1b')](_0x486f('0x16'),auth[_0x486f('0xa')](),controller[_0x486f('0x1d')]);module[_0x486f('0x1e')]=router; \ No newline at end of file +var _0xf767=['removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:update','delete'];(function(_0x3c9f86,_0x57eee3){var _0x648c=function(_0x525539){while(--_0x525539){_0x3c9f86['push'](_0x3c9f86['shift']());}};_0x648c(++_0x57eee3);}(_0xf767,0x76));var _0x7f76=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0xf767[_0x25efdf];return _0x22c495;};'use strict';var multer=require('multer');var util=require(_0x7f76('0x0'));var path=require(_0x7f76('0x1'));var timeout=require(_0x7f76('0x2'));var express=require(_0x7f76('0x3'));var router=express[_0x7f76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f76('0x5'));var interaction=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var controller=require(_0x7f76('0x8'));router['get']('/',auth[_0x7f76('0x9')](),controller[_0x7f76('0xa')]);router[_0x7f76('0xb')](_0x7f76('0xc'),auth[_0x7f76('0x9')](),controller['describe']);router[_0x7f76('0xb')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0xe')]);router['get'](_0x7f76('0xf'),auth['isAuthenticated'](),controller[_0x7f76('0x10')]);router[_0x7f76('0xb')](_0x7f76('0x11'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x12')]);router[_0x7f76('0x13')]('/',auth['isAuthenticated'](),controller[_0x7f76('0x14')]);router[_0x7f76('0x13')](_0x7f76('0xf'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x15')]);router['post'](_0x7f76('0x16'),auth['isAuthenticated'](),interaction[_0x7f76('0x17')](_0x7f76('0x18'),'whatsappinteraction:addtags'),controller['addTags']);router['put'](_0x7f76('0xd'),auth[_0x7f76('0x9')](),interaction[_0x7f76('0x17')]('whatsapp',_0x7f76('0x19')),controller['update']);router[_0x7f76('0x1a')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),interaction['tracked']('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router['delete'](_0x7f76('0x16'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x1b')]);module[_0x7f76('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 15d1aca..25e97fd 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 _0xea31=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x52e566,_0x271d09){var _0x3709a0=function(_0x17b662){while(--_0x17b662){_0x52e566['push'](_0x52e566['shift']());}};_0x3709a0(++_0x271d09);}(_0xea31,0x6b));var _0x1ea3=function(_0x12686c,_0x4a58db){_0x12686c=_0x12686c-0x0;var _0x4a72b7=_0xea31[_0x12686c];return _0x4a72b7;};'use strict';var Sequelize=require(_0x1ea3('0x0'));var moment=require('moment');module[_0x1ea3('0x1')]={'closed':{'type':Sequelize[_0x1ea3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1ea3('0x3')]},'disposition':{'type':Sequelize[_0x1ea3('0x4')]},'secondDisposition':{'type':Sequelize[_0x1ea3('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1ea3('0x4')]},'note':{'type':Sequelize[_0x1ea3('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1ea3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1ea3('0x5')]('in',_0x1ea3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1ea3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1ea3('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1ea3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf29c=['STRING','ENUM','out','moment','exports','BOOLEAN','DATE'];(function(_0x28a3e7,_0xee96f8){var _0x37e334=function(_0x36b198){while(--_0x36b198){_0x28a3e7['push'](_0x28a3e7['shift']());}};_0x37e334(++_0xee96f8);}(_0xf29c,0xc7));var _0xcf29=function(_0x5e54df,_0x22f872){_0x5e54df=_0x5e54df-0x0;var _0x45bd8a=_0xf29c[_0x5e54df];return _0x45bd8a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcf29('0x0'));module[_0xcf29('0x1')]={'closed':{'type':Sequelize[_0xcf29('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcf29('0x3')]},'disposition':{'type':Sequelize[_0xcf29('0x4')]},'secondDisposition':{'type':Sequelize[_0xcf29('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcf29('0x4')]},'note':{'type':Sequelize[_0xcf29('0x4')]},'phone':{'type':Sequelize[_0xcf29('0x4')]},'read1stAt':{'type':Sequelize[_0xcf29('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcf29('0x5')]('in',_0xcf29('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcf29('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xcf29('0x5')]('in',_0xcf29('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcf29('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 3586aa3..b4528ee 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 _0x6b1c=['firstName','Contact','out','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','WhatsappInteraction','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','WhatsappAccountId','toString','sequelize','merge','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','keys','includeAll','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','filter','findAll','addTags','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','format','CmContact','lastName','Attachment','Messages','direction','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','existsSync','pipe','basename'];(function(_0x5010df,_0x321a81){var _0x1ebdcd=function(_0x1ba111){while(--_0x1ba111){_0x5010df['push'](_0x5010df['shift']());}};_0x1ebdcd(++_0x321a81);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x234cb4,_0x128512){_0x234cb4=_0x234cb4-0x0;var _0x29e00d=_0x6b1c[_0x234cb4];return _0x29e00d;};'use strict';var emlformat=require(_0xc6b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6b1('0x1'));var jsonpatch=require(_0xc6b1('0x2'));var rp=require(_0xc6b1('0x3'));var moment=require(_0xc6b1('0x4'));var BPromise=require(_0xc6b1('0x5'));var Mustache=require(_0xc6b1('0x6'));var util=require('util');var path=require(_0xc6b1('0x7'));var sox=require('sox');var csv=require(_0xc6b1('0x8'));var ejs=require(_0xc6b1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6b1('0xa'));var squel=require(_0xc6b1('0xb'));var crypto=require(_0xc6b1('0xc'));var jsforce=require(_0xc6b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc6b1('0x8'));var querystring=require(_0xc6b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc6b1('0xf'));var qs=require(_0xc6b1('0x10'));var as=require(_0xc6b1('0x11'));var pdf=require(_0xc6b1('0x12'));var hardwareService=require(_0xc6b1('0x13'));var logger=require(_0xc6b1('0x14'))('api');var utils=require(_0xc6b1('0x15'));var config=require(_0xc6b1('0x16'));var licenseUtil=require(_0xc6b1('0x17'));var db=require(_0xc6b1('0x18'))['db'];config[_0xc6b1('0x19')]=_['defaults'](config[_0xc6b1('0x19')],{'host':_0xc6b1('0x1a'),'port':0x18eb});var socket=require(_0xc6b1('0x1b'))(new Redis(config[_0xc6b1('0x19')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4607ee,_0x12079c){_0x12079c=_0x12079c||0xcc;return function(_0x37ea66){if(_0x37ea66){return _0x4607ee[_0xc6b1('0x1c')](_0x12079c);}return _0x4607ee[_0xc6b1('0x1d')](_0x12079c)[_0xc6b1('0x1e')]();};}function respondWithResult(_0x4ba242,_0x4fbf72){_0x4fbf72=_0x4fbf72||0xc8;return function(_0xaed550){if(_0xaed550){return _0x4ba242[_0xc6b1('0x1d')](_0x4fbf72)[_0xc6b1('0x1f')](_0xaed550);}};}function respondWithFilteredResult(_0x4c1fec,_0x2c4bae){return function(_0x40a267){if(_0x40a267){var _0x5d732e=typeof _0x2c4bae[_0xc6b1('0x20')]===_0xc6b1('0x21')&&typeof _0x2c4bae[_0xc6b1('0x22')]==='undefined';var _0x24e135=_0x40a267[_0xc6b1('0x23')];var _0x193c78=_0x5d732e?0x0:_0x2c4bae[_0xc6b1('0x20')];var _0x57a253=_0x5d732e?_0x40a267['count']:_0x2c4bae[_0xc6b1('0x20')]+_0x2c4bae[_0xc6b1('0x22')];var _0x9ac881;if(_0x57a253>=_0x24e135){_0x57a253=_0x24e135;_0x9ac881=0xc8;}else{_0x9ac881=0xce;}_0x4c1fec[_0xc6b1('0x1d')](_0x9ac881);return _0x4c1fec[_0xc6b1('0x24')](_0xc6b1('0x25'),_0x193c78+'-'+_0x57a253+'/'+_0x24e135)[_0xc6b1('0x1f')](_0x40a267);}return null;};}function patchUpdates(_0xda9ac){return function(_0x3cb0d0){try{jsonpatch[_0xc6b1('0x26')](_0x3cb0d0,_0xda9ac,!![]);}catch(_0x267e1f){return BPromise[_0xc6b1('0x27')](_0x267e1f);}return _0x3cb0d0[_0xc6b1('0x28')]();};}function saveUpdates(_0x9a919c,_0x311b3f){return function(_0x3976df){if(_0x3976df){return _0x3976df['update'](_0x9a919c)[_0xc6b1('0x29')](function(_0x5afcb5){return _0x5afcb5;});}return null;};}function removeEntity(_0x2b657d,_0x2b0a39){return function(_0x1339f1){if(_0x1339f1){return _0x1339f1[_0xc6b1('0x2a')]()['then'](function(){_0x2b657d[_0xc6b1('0x1d')](0xcc)[_0xc6b1('0x1e')]();});}};}function handleEntityNotFound(_0x168187,_0x71ce3e){return function(_0x443774){if(!_0x443774){_0x168187[_0xc6b1('0x1c')](0x194);}return _0x443774;};}function handleError(_0x23ab88,_0x497dac){_0x497dac=_0x497dac||0x1f4;return function(_0x196927){logger[_0xc6b1('0x2b')](_0x196927[_0xc6b1('0x2c')]);if(_0x196927[_0xc6b1('0x2d')]){delete _0x196927[_0xc6b1('0x2d')];}_0x23ab88[_0xc6b1('0x1d')](_0x497dac)['send'](_0x196927);};}function getInteractionUsers(_0x2c85bf,_0x1ffd49){return new BPromise(function(_0x2a7e40,_0x4dd229){try{if(_0x1ffd49[_0x2c85bf['id']]){_0x2c85bf[_0xc6b1('0x2e')]=_[_0xc6b1('0x2f')](_0x1ffd49[_0x2c85bf['id']],function(_0x167ff2){return{'id':_0x167ff2['id'],'fullname':_0x167ff2[_0xc6b1('0x30')]};});}}catch(_0x4e35de){_0x4dd229(_0x4e35de);}_0x2a7e40(_0x2c85bf);});}function getInteractionTags(_0x4a4839,_0x453a9c){return new BPromise(function(_0x5dc371,_0xe55de5){try{if(_0x4a4839[_0xc6b1('0x31')]){_0x4a4839[_0xc6b1('0x32')]=[];_0x4a4839[_0xc6b1('0x31')][_0xc6b1('0x33')](',')[_0xc6b1('0x34')](function(_0x38c9fb){_0x4a4839[_0xc6b1('0x32')][_0xc6b1('0x35')](_0x453a9c[_0x38c9fb]);});}delete _0x4a4839[_0xc6b1('0x31')];}catch(_0x57436b){_0xe55de5(_0x57436b);}_0x5dc371(_0x4a4839);});}function updateWhatsappInteraction(_0x5a5c1c,_0x2e2758,_0x4a560b){return new BPromise(function(_0x1aea81,_0x216f43){return getInteractionUsers(_0x5a5c1c,_0x4a560b)[_0xc6b1('0x29')](function(_0x23413f){return getInteractionTags(_0x23413f,_0x2e2758);})[_0xc6b1('0x29')](function(_0x17613b){_0x1aea81(_0x17613b);})[_0xc6b1('0x36')](function(_0x185d26){_0x216f43(_0x185d26);});});}exports[_0xc6b1('0x37')]=function(_0x54e0d5,_0x1683ef){var _0x470aa6={},_0x393938={},_0x2e284e={'count':0x0,'rows':[]};var _0x455a41=_[_0xc6b1('0x2f')](db[_0xc6b1('0x38')][_0xc6b1('0x39')],function(_0x4fac76){return{'name':_0x4fac76['fieldName'],'type':_0x4fac76['type']['key']};});_0x393938[_0xc6b1('0x3a')]=_[_0xc6b1('0x2f')](_0x455a41,_0xc6b1('0x2d'));_0x393938[_0xc6b1('0x3b')]=_['keys'](_0x54e0d5[_0xc6b1('0x3b')]);_0x393938[_0xc6b1('0x3c')]=_[_0xc6b1('0x3d')](_0x393938['model'],_0x393938[_0xc6b1('0x3b')]);_0x470aa6[_0xc6b1('0x3e')]=_[_0xc6b1('0x3d')](_0x393938[_0xc6b1('0x3a')],qs[_0xc6b1('0x3f')](_0x54e0d5[_0xc6b1('0x3b')]['fields']));_0x470aa6[_0xc6b1('0x3e')]=_0x470aa6[_0xc6b1('0x3e')][_0xc6b1('0x40')]?_0x470aa6[_0xc6b1('0x3e')]:_0x393938['model'];if(!_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x41')](_0xc6b1('0x42'))){_0x470aa6[_0xc6b1('0x22')]=qs[_0xc6b1('0x22')](_0x54e0d5['query']['limit']);_0x470aa6[_0xc6b1('0x20')]=qs['offset'](_0x54e0d5[_0xc6b1('0x3b')]['offset']);}_0x470aa6[_0xc6b1('0x43')]=qs[_0xc6b1('0x44')](_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x44')]);_0x470aa6[_0xc6b1('0x45')]=qs[_0xc6b1('0x3c')](_[_0xc6b1('0x46')](_0x54e0d5[_0xc6b1('0x3b')],_0x393938[_0xc6b1('0x3c')]),_0x455a41);var _0x394e00=[];var _0x21d473=squel[_0xc6b1('0x47')]()[_0xc6b1('0x48')]('id')[_0xc6b1('0x48')](_0xc6b1('0x2d'))[_0xc6b1('0x48')]('color')[_0xc6b1('0x49')](_0xc6b1('0x4a'));var _0x254958=squel[_0xc6b1('0x47')]()['field'](_0xc6b1('0x4b'))['field'](_0xc6b1('0x4c'))[_0xc6b1('0x48')](_0xc6b1('0x4d'))[_0xc6b1('0x49')](_0xc6b1('0x4e'),'ui')['left_join'](_0xc6b1('0x4f'),'u',_0xc6b1('0x50'));var _0x13acb7=squel[_0xc6b1('0x47')]()[_0xc6b1('0x49')](_0xc6b1('0x51'),'i')[_0xc6b1('0x52')]('cm_contacts','c',_0xc6b1('0x53'))[_0xc6b1('0x52')](_0xc6b1('0x4f'),'o',_0xc6b1('0x54'))['left_join'](_0xc6b1('0x55'),'a',_0xc6b1('0x56'))[_0xc6b1('0x52')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0xc6b1('0x52')](_0xc6b1('0x57'),'it',_0xc6b1('0x58'))[_0xc6b1('0x52')](_0xc6b1('0x4a'),'t',_0xc6b1('0x59'));var _0x19037d=squel[_0xc6b1('0x5a')]();var _0x1e1ded=[];var _0x17b7a3=squel[_0xc6b1('0x5a')]();var _0x5ba94b;if(_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x5b')]){_0x5ba94b=as[_0xc6b1('0x5c')](_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x5b')]);var _0x149e21=_0x5ba94b[_0xc6b1('0x5d')];for(var _0x17de4e=0x0;_0x17de4e<_0x5ba94b['conditions'][_0xc6b1('0x40')];_0x17de4e++){var _0x21f5da=_0x5ba94b[_0xc6b1('0x5e')][_0x17de4e];var _0x3ff121='i';var _0x11eecd=_[_0xc6b1('0x5f')](_0x455a41,[_0xc6b1('0x2d'),_0x21f5da[_0xc6b1('0x48')]]);if(!_0x11eecd){switch(_0x21f5da[_0xc6b1('0x48')]){case _0xc6b1('0x60'):if(_0x21f5da['value']==0x1){_0x13acb7[_0xc6b1('0x61')]('`'+_0x21f5da[_0xc6b1('0x48')]+_0xc6b1('0x62'));}else{_0x13acb7['having']('`'+_0x21f5da['field']+_0xc6b1('0x63'));}break;case'Contact':if(_0x21f5da[_0xc6b1('0x64')]==='$substring'){if(_0x21f5da[_0xc6b1('0x65')]['split']('\x20')['length']>0x1){_0x19037d[_0x149e21]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc6b1('0x66')](_0x21f5da[_0xc6b1('0x65')]),null);}else{var _0x1e8f0c='%'+_0x21f5da[_0xc6b1('0x65')]+'%';_0x19037d[_0x149e21](_0xc6b1('0x67'),_0x1e8f0c,_0x1e8f0c,_0x1e8f0c);}}else{_0x11eecd=_['find'](_0x455a41,[_0xc6b1('0x2d'),_0xc6b1('0x68')]);_0x21f5da[_0xc6b1('0x48')]=_0xc6b1('0x68');_0x384ed1=as[_0xc6b1('0x69')](_0x3ff121,_0x11eecd[_0xc6b1('0x6a')],_0x21f5da);_0x19037d[_0x149e21](_0x384ed1[_0xc6b1('0x6b')],_0x384ed1[_0xc6b1('0x65')][_0xc6b1('0x6c')],_0x384ed1['value']['end']);}break;case _0xc6b1('0x6d'):var _0x21fc47=_0x21f5da[_0xc6b1('0x65')]['split'](',')[_0xc6b1('0x2f')](function(_0x1d4488){return Number(_0x1d4488);});_0x21fc47[_0xc6b1('0x34')](function(_0x273afa){_0x17b7a3['or'](_0xc6b1('0x6e'),'%,'+_0x273afa+',%');});_0x1e1ded=_[_0xc6b1('0x6f')](_0x1e1ded,_0x21fc47);break;case _0xc6b1('0x70'):if(_0x21f5da[_0xc6b1('0x64')]==='$substring'){_0x19037d[_0x149e21](_0xc6b1('0x71'),'%'+_0x21f5da[_0xc6b1('0x65')]+'%',null);}else{_0x11eecd=_['find'](_0x455a41,[_0xc6b1('0x2d'),'UserId']);_0x21f5da[_0xc6b1('0x48')]=_0xc6b1('0x72');_0x384ed1=as[_0xc6b1('0x69')](_0x3ff121,_0x11eecd[_0xc6b1('0x6a')],_0x21f5da);_0x19037d[_0x149e21](_0x384ed1[_0xc6b1('0x6b')],_0x384ed1[_0xc6b1('0x65')][_0xc6b1('0x6c')],_0x384ed1['value'][_0xc6b1('0x1e')]);}break;case _0xc6b1('0x73'):_0x384ed1=as['buildExpression']('me',null,_0x21f5da);_0x19037d[_0x149e21](_0x384ed1[_0xc6b1('0x6b')],_0x384ed1[_0xc6b1('0x65')]['start'],_0x384ed1[_0xc6b1('0x65')][_0xc6b1('0x1e')]);break;}}else{var _0x384ed1=as[_0xc6b1('0x69')](_0x3ff121,_0x11eecd[_0xc6b1('0x6a')],_0x21f5da);_0x19037d[_0x149e21](_0x384ed1['text'],_0x384ed1[_0xc6b1('0x65')][_0xc6b1('0x6c')],_0x384ed1[_0xc6b1('0x65')][_0xc6b1('0x1e')]);}}}else{var _0x3f1c65=_(_0x54e0d5['query'])['keys']()[_0xc6b1('0x2f')](function(_0xadaa7){return _['some'](_0x455a41,['name',_0xadaa7])?_0xadaa7:undefined;})[_0xc6b1('0x74')]()['value']();if(!_[_0xc6b1('0x75')](_0x3f1c65)){_0x3f1c65[_0xc6b1('0x34')](function(_0x297701){if(_0x297701==='WhatsappAccountId'){_0x13acb7[_0xc6b1('0x45')](_0xc6b1('0x76'),[][_0xc6b1('0x77')](_0x54e0d5[_0xc6b1('0x3b')][_0x297701]));}else if(_0x297701===_0xc6b1('0x78')){var _0x2aae10=JSON[_0xc6b1('0x79')](_0x54e0d5[_0xc6b1('0x3b')][_0x297701])[_0xc6b1('0x7a')];var _0x1bd882=JSON['parse'](_0x54e0d5['query'][_0x297701])[_0xc6b1('0x7b')];_0x13acb7[_0xc6b1('0x45')](_0xc6b1('0x7c'),_0x2aae10,_0x1bd882);}else{if(_0x54e0d5[_0xc6b1('0x3b')][_0x297701]===_0xc6b1('0x7d')){_0x13acb7[_0xc6b1('0x45')]('i.'+_0x297701+_0xc6b1('0x7e'));}else{_0x13acb7[_0xc6b1('0x45')]('i.'+_0x297701+'\x20=\x20?',_0x54e0d5[_0xc6b1('0x3b')][_0x297701]);}}});}if(_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x7f')]){if(_0x54e0d5[_0xc6b1('0x3b')]['read']==0x1){_0x13acb7[_0xc6b1('0x61')](_0xc6b1('0x80'));}else{_0x13acb7[_0xc6b1('0x61')](_0xc6b1('0x81'));}}if(_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x82')]){_0x1e1ded=_[_0xc6b1('0x83')](_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x82')])?_0x54e0d5[_0xc6b1('0x3b')]['tag']:new Array(_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x82')]);_0x1e1ded[_0xc6b1('0x34')](function(_0x2b0035){_0x17b7a3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b0035+',%');});}if(_0x54e0d5[_0xc6b1('0x3b')]['filter']){var _0x1f663d=_0x54e0d5['query']['filter'][_0xc6b1('0x84')]('\x5c','\x5c\x5c')[_0xc6b1('0x84')](/'/g,'\x27\x27');if(qs[_0xc6b1('0x85')](_0x1f663d)){_0x19037d['or'](_0xc6b1('0x86'),_0x1f663d+'%')['or'](_0xc6b1('0x87'),_0x1f663d+'%');}else{_0x19037d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc6b1('0x66')](_0x1f663d))['or'](_0xc6b1('0x88'),_0x1f663d+'%');}}}_0x13acb7[_0xc6b1('0x45')](_0x19037d);_0x13acb7[_0xc6b1('0x89')](_0xc6b1('0x8a'));var _0x117ca0={'type':db[_0xc6b1('0x8b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x126c46=_0x13acb7['clone']();_0x126c46[_0xc6b1('0x48')](_0xc6b1('0x8a'));_0x126c46[_0xc6b1('0x48')](_0xc6b1('0x8c'),_0xc6b1('0x60'));if(_0x470aa6[_0xc6b1('0x43')]){_0x470aa6[_0xc6b1('0x43')][_0xc6b1('0x34')](function(_0x394b16){var _0x41ac3f=_0x394b16[0x0]===_0xc6b1('0x8d')?_0x394b16[0x0]:'i.'+_0x394b16[0x0];_0x13acb7[_0xc6b1('0x43')](_0x41ac3f,_0x394b16[0x1]===_0xc6b1('0x8e')?![]:!![]);});}if(!_[_0xc6b1('0x75')](_0x1e1ded)){_0x13acb7[_0xc6b1('0x61')](_0x17b7a3);_0x126c46[_0xc6b1('0x45')](_0xc6b1('0x8f'),_0x1e1ded);}BPromise[_0xc6b1('0x90')]()[_0xc6b1('0x29')](function(){if(!_0x5ba94b){if(_0x54e0d5['query']['WhatsappAccountId'])return;_0x126c46[_0xc6b1('0x45')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x13acb7[_0xc6b1('0x45')](_0xc6b1('0x91'));return;}if(_0x54e0d5[_0xc6b1('0x92')]['role']!==_0xc6b1('0x93'))return;return _0x54e0d5[_0xc6b1('0x92')][_0xc6b1('0x94')]({'attributes':['id'],'raw':!![]})[_0xc6b1('0x29')](function(_0x2b5af9){if(_[_0xc6b1('0x75')](_0x2b5af9)){_0x126c46['where'](_0xc6b1('0x95'));_0x13acb7[_0xc6b1('0x45')](_0xc6b1('0x95'));}else{_0x126c46[_0xc6b1('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0xc6b1('0x2f')](_0x2b5af9,'id'));_0x13acb7[_0xc6b1('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0xc6b1('0x2f')](_0x2b5af9,'id'));}});})['then'](function(){if(_0x54e0d5[_0xc6b1('0x92')]['role']===_0xc6b1('0x93')&&!_0x5ba94b&&!_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x96')])return[];return db['sequelize']['query'](_0x126c46[_0xc6b1('0x97')](),_0x117ca0);})[_0xc6b1('0x29')](function(_0xa98b5a){_0x2e284e['count']=_0xa98b5a['length'];if(_0x2e284e[_0xc6b1('0x23')]===0x0)return[];return db[_0xc6b1('0x98')][_0xc6b1('0x3b')](_0x21d473['toString'](),_0x117ca0)[_0xc6b1('0x29')](function(_0x38ea39){_0x394e00=_['keyBy'](_0x38ea39,'id');_0x117ca0=_[_0xc6b1('0x99')](_0x117ca0,{'model':db[_0xc6b1('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54e0d5[_0xc6b1('0x3b')][_0xc6b1('0x3f')]){_0x470aa6[_0xc6b1('0x3e')]['forEach'](function(_0x356de7){_0x13acb7[_0xc6b1('0x48')]('i.'+_0x356de7);});}else{_0x13acb7[_0xc6b1('0x48')](_0xc6b1('0x8c'),_0xc6b1('0x60'));_0x13acb7[_0xc6b1('0x48')]('a.key','Account.key');_0x13acb7[_0xc6b1('0x48')]('a.mandatoryDisposition',_0xc6b1('0x9a'));_0x13acb7[_0xc6b1('0x48')](_0xc6b1('0x9b'),_0xc6b1('0x8d'));_0x13acb7[_0xc6b1('0x48')](_0xc6b1('0x9c'));_0x13acb7[_0xc6b1('0x48')](_0xc6b1('0x9d'),_0xc6b1('0x9e'));_0x13acb7[_0xc6b1('0x48')](_0xc6b1('0x9f'),_0xc6b1('0xa0'));_0x13acb7[_0xc6b1('0x48')](_0xc6b1('0xa1'),'Contact.email');_0x13acb7[_0xc6b1('0x48')](_0xc6b1('0xa2'),_0xc6b1('0xa3'));_0x13acb7[_0xc6b1('0x48')]('c.mobile',_0xc6b1('0xa4'));_0x13acb7[_0xc6b1('0x48')]('c.fax',_0xc6b1('0xa5'));_0x13acb7[_0xc6b1('0x48')](_0xc6b1('0xa6'),_0xc6b1('0xa7'));_0x13acb7['field'](_0xc6b1('0xa8'),_0xc6b1('0xa9'));_0x13acb7[_0xc6b1('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc6b1('0x31'));}if(_0x470aa6[_0xc6b1('0x22')])_0x13acb7[_0xc6b1('0x22')](_0x470aa6['limit']);if(_0x470aa6[_0xc6b1('0x20')])_0x13acb7['offset'](_0x470aa6['offset']);return db[_0xc6b1('0x98')]['query'](_0x13acb7[_0xc6b1('0x97')](),_0x117ca0);})[_0xc6b1('0x29')](function(_0x50bb14){if(_0x50bb14[_0xc6b1('0x40')]>0x0)_0x254958[_0xc6b1('0x45')](_0xc6b1('0xaa'),_['map'](_0x50bb14,'id'));return db[_0xc6b1('0x98')][_0xc6b1('0x3b')](_0x254958['toString'](),_0x117ca0)['then'](function(_0x172320){var _0x48a9e5=_[_0xc6b1('0xab')](_0x172320,_0xc6b1('0xac'));var _0x4f36b3=[];_0x50bb14['forEach'](function(_0x58a7f3){_0x4f36b3[_0xc6b1('0x35')](updateWhatsappInteraction(_0x58a7f3,_0x394e00,_0x48a9e5));});return BPromise[_0xc6b1('0xad')](_0x4f36b3);});});})['then'](function(_0x3737ea){_0x2e284e[_0xc6b1('0xae')]=_0x3737ea;return _0x2e284e;})[_0xc6b1('0x29')](respondWithFilteredResult(_0x1683ef,_0x470aa6))[_0xc6b1('0x36')](handleError(_0x1683ef,null));};exports[_0xc6b1('0xaf')]=function(_0x13872b,_0x4f352e){var _0x221435={'raw':![],'where':{'id':_0x13872b[_0xc6b1('0xb0')]['id']}},_0x474f2f={};_0x474f2f['model']=_[_0xc6b1('0xb1')](db[_0xc6b1('0x38')][_0xc6b1('0x39')]);_0x474f2f[_0xc6b1('0x3b')]=_[_0xc6b1('0xb1')](_0x13872b['query']);_0x474f2f[_0xc6b1('0x3c')]=_[_0xc6b1('0x3d')](_0x474f2f[_0xc6b1('0x3a')],_0x474f2f['query']);_0x221435[_0xc6b1('0x3e')]=_[_0xc6b1('0x3d')](_0x474f2f[_0xc6b1('0x3a')],qs['fields'](_0x13872b[_0xc6b1('0x3b')][_0xc6b1('0x3f')]));_0x221435[_0xc6b1('0x3e')]=_0x221435[_0xc6b1('0x3e')][_0xc6b1('0x40')]?_0x221435[_0xc6b1('0x3e')]:_0x474f2f[_0xc6b1('0x3a')];if(_0x13872b[_0xc6b1('0x3b')][_0xc6b1('0xb2')]){_0x221435[_0xc6b1('0xb3')]=[{'all':!![]}];}_0x221435=_[_0xc6b1('0x99')]({},_0x221435,_0x13872b[_0xc6b1('0xb4')]);return db['WhatsappInteraction'][_0xc6b1('0x5f')](_0x221435)[_0xc6b1('0x29')](handleEntityNotFound(_0x4f352e,null))['then'](respondWithResult(_0x4f352e,null))['catch'](handleError(_0x4f352e,null));};exports[_0xc6b1('0xb5')]=function(_0x2170a2,_0xd2eba5){return db[_0xc6b1('0x38')][_0xc6b1('0xb5')](_0x2170a2['body'],{})[_0xc6b1('0x29')](respondWithResult(_0xd2eba5,0xc9))[_0xc6b1('0x36')](handleError(_0xd2eba5,null));};exports['update']=function(_0xfc26c7,_0x47a611){if(_0xfc26c7['body']['id']){delete _0xfc26c7[_0xc6b1('0x73')]['id'];}return db[_0xc6b1('0x38')][_0xc6b1('0x5f')]({'where':{'id':_0xfc26c7[_0xc6b1('0xb0')]['id']}})[_0xc6b1('0x29')](handleEntityNotFound(_0x47a611,null))['then'](saveUpdates(_0xfc26c7['body'],null))[_0xc6b1('0x29')](respondWithResult(_0x47a611,null))[_0xc6b1('0x36')](handleError(_0x47a611,null));};exports[_0xc6b1('0x2a')]=function(_0x3bfe4e,_0x45e1a2){return db[_0xc6b1('0x38')][_0xc6b1('0x5f')]({'where':{'id':_0x3bfe4e[_0xc6b1('0xb0')]['id']}})['then'](handleEntityNotFound(_0x45e1a2,null))['then'](removeEntity(_0x45e1a2,null))['catch'](handleError(_0x45e1a2,null));};exports[_0xc6b1('0xb6')]=function(_0x388a0d,_0x53ac07){return db[_0xc6b1('0x38')][_0xc6b1('0xb6')]()[_0xc6b1('0x29')](respondWithResult(_0x53ac07,null))['catch'](handleError(_0x53ac07,null));};exports[_0xc6b1('0xb7')]=function(_0x3bb63a,_0x4d8a35,_0x4098fb){return db[_0xc6b1('0xb8')][_0xc6b1('0x5f')]({'where':{'id':_0x3bb63a[_0xc6b1('0xb0')]['id']}})[_0xc6b1('0x29')](handleEntityNotFound(_0x4d8a35,null))['then'](function(_0x1f56c5){if(_0x1f56c5){return _0x1f56c5['addMessage'](_0x3bb63a[_0xc6b1('0x73')][_0xc6b1('0xb9')],_[_0xc6b1('0xba')](_0x3bb63a[_0xc6b1('0x73')],['ids','id'])||{});}})[_0xc6b1('0x29')](respondWithResult(_0x4d8a35,null))[_0xc6b1('0x36')](handleError(_0x4d8a35,null));};exports[_0xc6b1('0xbb')]=function(_0x3270bc,_0x21d032,_0xcd0d00){var _0x5b1fae={'raw':![],'where':{}};var _0x2790b0={};var _0x22f264={'count':0x0,'rows':[]};return db[_0xc6b1('0x38')][_0xc6b1('0xbc')]({'where':{'id':_0x3270bc[_0xc6b1('0xb0')]['id']}})[_0xc6b1('0x29')](handleEntityNotFound(_0x21d032,null))[_0xc6b1('0x29')](function(_0x4e7180){if(_0x4e7180){_0x2790b0[_0xc6b1('0x3a')]=_[_0xc6b1('0xb1')](db[_0xc6b1('0xb8')][_0xc6b1('0x39')]);_0x2790b0[_0xc6b1('0x3b')]=_[_0xc6b1('0xb1')](_0x3270bc[_0xc6b1('0x3b')]);_0x2790b0[_0xc6b1('0x3c')]=_[_0xc6b1('0x3d')](_0x2790b0[_0xc6b1('0x3a')],_0x2790b0[_0xc6b1('0x3b')]);_0x5b1fae[_0xc6b1('0x3e')]=_[_0xc6b1('0x3d')](_0x2790b0[_0xc6b1('0x3a')],qs[_0xc6b1('0x3f')](_0x3270bc[_0xc6b1('0x3b')]['fields']));_0x5b1fae[_0xc6b1('0x3e')]=_0x5b1fae[_0xc6b1('0x3e')][_0xc6b1('0x40')]?_0x5b1fae[_0xc6b1('0x3e')]:_0x2790b0[_0xc6b1('0x3a')];if(!_0x3270bc['query'][_0xc6b1('0x41')](_0xc6b1('0x42'))){_0x5b1fae[_0xc6b1('0x22')]=qs[_0xc6b1('0x22')](_0x3270bc[_0xc6b1('0x3b')][_0xc6b1('0x22')]);_0x5b1fae[_0xc6b1('0x20')]=qs[_0xc6b1('0x20')](_0x3270bc[_0xc6b1('0x3b')]['offset']);}_0x5b1fae[_0xc6b1('0x43')]=qs[_0xc6b1('0x44')](_0x3270bc[_0xc6b1('0x3b')][_0xc6b1('0x44')]);_0x5b1fae[_0xc6b1('0x45')]=qs[_0xc6b1('0x3c')](_[_0xc6b1('0x46')](_0x3270bc['query'],_0x2790b0[_0xc6b1('0x3c')]));_0x5b1fae[_0xc6b1('0x45')][_0xc6b1('0xac')]=_0x4e7180['id'];if(_0x3270bc['query']['filter']){_0x5b1fae[_0xc6b1('0x45')]=_[_0xc6b1('0x99')](_0x5b1fae[_0xc6b1('0x45')],{'$or':_['map'](_0x5b1fae[_0xc6b1('0x3e')],function(_0xed220f){var _0xc60c75={};_0xc60c75[_0xed220f]={'$like':'%'+_0x3270bc[_0xc6b1('0x3b')][_0xc6b1('0xbd')]+'%'};return _0xc60c75;})});}if(_0x3270bc['query'][_0xc6b1('0x7a')]){var _0x5a9954=_0x3270bc[_0xc6b1('0x3b')][_0xc6b1('0x7a')]['split'](',');var _0x5f0578={};_0x5f0578[_0x5a9954[0x0]]={'$gte':moment(_0x5a9954[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5b1fae[_0xc6b1('0x45')]=_[_0xc6b1('0x99')](_0x5b1fae[_0xc6b1('0x45')],_0x5f0578);}_0x5b1fae=_[_0xc6b1('0x99')]({},_0x5b1fae,_0x3270bc[_0xc6b1('0xb4')]);return db['WhatsappMessage'][_0xc6b1('0x23')]({'where':_0x5b1fae[_0xc6b1('0x45')]})[_0xc6b1('0x29')](function(_0x445e31){_0x22f264[_0xc6b1('0x23')]=_0x445e31;if(_0x3270bc['query'][_0xc6b1('0xb2')]){_0x5b1fae['include']=[{'all':!![]}];}return db[_0xc6b1('0xb8')][_0xc6b1('0xbe')](_0x5b1fae);})['then'](function(_0x2c6555){_0x22f264[_0xc6b1('0xae')]=_0x2c6555;return _0x22f264;});}})['then'](respondWithFilteredResult(_0x21d032,_0x5b1fae))[_0xc6b1('0x36')](handleError(_0x21d032,null));};exports[_0xc6b1('0xbf')]=function(_0x5a7eb7,_0x10e8b0,_0x249acf){return db[_0xc6b1('0x38')]['find']({'where':{'id':_0x5a7eb7[_0xc6b1('0xb0')]['id']}})[_0xc6b1('0x29')](handleEntityNotFound(_0x10e8b0,null))['then'](function(_0x3c3641){if(_0x3c3641){return _0x3c3641[_0xc6b1('0xc0')](_0x5a7eb7[_0xc6b1('0x73')][_0xc6b1('0xb9')],_[_0xc6b1('0xba')](_0x5a7eb7['body'],['ids','id'])||{})[_0xc6b1('0xc1')](function(){return db[_0xc6b1('0x6d')]['findAll']({'attributes':['id',_0xc6b1('0x2d'),_0xc6b1('0xc2')],'where':{'id':_0x5a7eb7['body'][_0xc6b1('0xb9')]}});})['then'](function(_0x181a22){socket[_0xc6b1('0xc3')](_0xc6b1('0xc4'),{'id':Number(_0x5a7eb7[_0xc6b1('0xb0')]['id']),'tags':_0x181a22||[]});return{'id':Number(_0x5a7eb7['params']['id']),'tags':_0x181a22||[]};});}})[_0xc6b1('0x29')](respondWithResult(_0x10e8b0,null))[_0xc6b1('0x36')](handleError(_0x10e8b0,null));};exports[_0xc6b1('0xc5')]=function(_0x2fab1f,_0x2e3bd6,_0xfc2715){return db[_0xc6b1('0x38')]['find']({'where':{'id':_0x2fab1f['params']['id']}})[_0xc6b1('0x29')](handleEntityNotFound(_0x2e3bd6,null))[_0xc6b1('0x29')](function(_0x11e612){if(_0x11e612){return _0x11e612[_0xc6b1('0xc5')](_0x2fab1f[_0xc6b1('0x3b')]['ids']);}})[_0xc6b1('0x29')](respondWithStatusCode(_0x2e3bd6,null))[_0xc6b1('0x36')](handleError(_0x2e3bd6,null));};exports[_0xc6b1('0xc6')]=function(_0x4c720e,_0x292b58){var _0x3c4cc1=moment()['unix']()[_0xc6b1('0x97')]();var _0x5f68e6=path[_0xc6b1('0xc7')](config[_0xc6b1('0xc8')],_0xc6b1('0xc9'),_0xc6b1('0xca'),_0xc6b1('0xcb'));var _0x1dbf5d=path[_0xc6b1('0xc7')](config[_0xc6b1('0xc8')],_0xc6b1('0xc9'),_0xc6b1('0xca'),_0xc6b1('0xcc'));var _0x5eec9b=path['join'](_0x5f68e6,_0x3c4cc1);var _0x500a66=util[_0xc6b1('0xcd')]('transcript-%d-%s.zip',_0x4c720e['params']['id'],_0x3c4cc1);var _0x2918cf=path['join'](_0x5f68e6,_0x500a66);var _0xd0908e=[];_0xd0908e['push']({'model':db[_0xc6b1('0x70')],'as':'User','attributes':['id',_0xc6b1('0x30')],'raw':!![]});_0xd0908e[_0xc6b1('0x35')]({'model':db[_0xc6b1('0xce')],'as':'Contact','attributes':['id','firstName',_0xc6b1('0xcf')],'raw':!![]});if(_0x4c720e[_0xc6b1('0x3b')][_0xc6b1('0xcc')]){_0xd0908e['push']({'model':db[_0xc6b1('0xd0')],'as':_0xc6b1('0xd0'),'raw':!![]});}var _0x279a2b=[{'model':db['WhatsappMessage'],'as':_0xc6b1('0xd1'),'attributes':['id',_0xc6b1('0x73'),_0xc6b1('0x78'),_0xc6b1('0xd2'),'secret','read'],'include':_0xd0908e}];_0x279a2b[_0xc6b1('0x35')]({'model':db[_0xc6b1('0xd3')],'as':_0xc6b1('0xd4'),'attributes':['id','name']});_0x279a2b[_0xc6b1('0x35')]({'model':db['User'],'as':_0xc6b1('0xd5'),'attributes':['id',_0xc6b1('0x30')]});return db[_0xc6b1('0x38')]['find']({'where':{'id':_0x4c720e['params']['id']},'include':_0x279a2b})[_0xc6b1('0x29')](handleEntityNotFound(_0x292b58,null))[_0xc6b1('0x29')](function(_0x4e525e){if(_0x4e525e){var _0x1aed30=_0x4e525e[_0xc6b1('0xd6')]({'plain':!![]});fs[_0xc6b1('0xd7')](_0x5eec9b);var _0x1fbaf5={'channel':_0xc6b1('0xd8'),'account':_0x1aed30[_0xc6b1('0xd4')]['name'],'agent':_0x1aed30[_0xc6b1('0xd5')]?_0x1aed30['Owner'][_0xc6b1('0x30')]:_0xc6b1('0xd9'),'createdAt':moment(_0x1aed30[_0xc6b1('0x78')])['format'](_0xc6b1('0xda'))[_0xc6b1('0x97')](),'closedAt':_0x1aed30[_0xc6b1('0xdb')]?moment(_0x1aed30['closedAt'])[_0xc6b1('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc6b1('0x97')]():'','disposition':_0x1aed30['disposition'],'messages':_(_0x1aed30[_0xc6b1('0xd1')])[_0xc6b1('0xbd')]({'secret':![]})['map'](function(_0x1de042){if(_0x1de042[_0xc6b1('0xd0')]){var _0x1aed8e=path[_0xc6b1('0xc7')](_0x1dbf5d,_0x1de042['Attachment']['basename']);if(fs[_0xc6b1('0xdc')](_0x1aed8e)){fs['createReadStream'](_0x1aed8e)[_0xc6b1('0xdd')](fs['createWriteStream'](path[_0xc6b1('0xc7')](_0x5eec9b,_0x1de042[_0xc6b1('0xd0')][_0xc6b1('0xde')])));}}return{'date':moment(_0x1de042[_0xc6b1('0x78')])['format'](_0xc6b1('0xda'))[_0xc6b1('0x97')](),'sender':_0x1de042[_0xc6b1('0xd2')]==='out'?_0x1de042[_0xc6b1('0x70')]?_0x1de042[_0xc6b1('0x70')]['fullname']:'System':_0x1de042['Contact'][_0xc6b1('0xdf')]+(_0x1de042['Contact'][_0xc6b1('0xcf')]?'\x20'+_0x1de042[_0xc6b1('0xe0')][_0xc6b1('0xcf')]:''),'body':_0x1de042[_0xc6b1('0xd0')]?_0x1de042[_0xc6b1('0xd0')][_0xc6b1('0xde')]:_0x1de042[_0xc6b1('0x73')],'direction':_0x1de042['direction']===_0xc6b1('0xe1')?'A':'C','secret':_0x1de042[_0xc6b1('0xe2')],'read':_0x1de042[_0xc6b1('0x7f')],'attachment':_0x1de042['Attachment']};})[_0xc6b1('0x65')]()};return ejs[_0xc6b1('0xe3')](path[_0xc6b1('0xc7')](config['root'],_0xc6b1('0xc9'),'views',_0xc6b1('0xe4')),{'interaction':_0x1fbaf5})['then'](function(_0x53f98b){var _0x452a17=path[_0xc6b1('0xc7')](_0x5eec9b,_0xc6b1('0xe5')+_0x1aed30['id']+'-'+_0x3c4cc1+_0xc6b1('0xe6'));var _0x13bc99={'path':_0x452a17,'channel':_0xc6b1('0xd8'),'interactionId':_0x1aed30['id']};return pdf[_0xc6b1('0xe7')](_0x53f98b,_0x13bc99);})[_0xc6b1('0x29')](function(){return new BPromise(function(_0x19e374,_0xb37340){zipdir(_0x5eec9b,{'saveTo':_0x2918cf},function(_0x4b9c89,_0x7f543d){if(_0x4b9c89)return _0xb37340(_0x4b9c89);return _0x19e374(_0x7f543d);});})[_0xc6b1('0x29')](function(){return new BPromise(function(_0x2c4edc,_0x55d2ef){rimraf(_0x5eec9b,function(_0x51a079){if(_0x51a079)_0x55d2ef(_0x51a079);return _0x2c4edc();});});})['then'](function(){return _0x292b58[_0xc6b1('0xc6')](_0x2918cf,_0x500a66,function(_0x40f58f){if(_0x40f58f){console[_0xc6b1('0xe8')]('err',_0x40f58f);}else{fs['unlinkSync'](_0x2918cf);}});});});}else{return _0x292b58[_0xc6b1('0x1c')](0xc8);}})[_0xc6b1('0x36')](handleError(_0x292b58,null));}; \ No newline at end of file +var _0x2043=['ids','getMessages','format','include','addTags','setTags','spread','findAll','whatsappInteractionTags:save','removeTags','download','unix','server','tmp','join','root','attachments','CmContact','firstName','lastName','Attachment','direction','secret','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','basename','existsSync','createReadStream','pipe','out','System','renderFile','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','select','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','contactName','order','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','WhatsappAccountId','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','show','params','includeAll','options','create','describe','addMessage','WhatsappMessage','omit'];(function(_0x2291f1,_0x4a379b){var _0x26713c=function(_0x1ae593){while(--_0x1ae593){_0x2291f1['push'](_0x2291f1['shift']());}};_0x26713c(++_0x4a379b);}(_0x2043,0x122));var _0x3204=function(_0x3135d7,_0x1829ed){_0x3135d7=_0x3135d7-0x0;var _0x370c07=_0x2043[_0x3135d7];return _0x370c07;};'use strict';var emlformat=require(_0x3204('0x0'));var rimraf=require(_0x3204('0x1'));var zipdir=require(_0x3204('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3204('0x3'));var BPromise=require(_0x3204('0x4'));var Mustache=require(_0x3204('0x5'));var util=require(_0x3204('0x6'));var path=require(_0x3204('0x7'));var sox=require(_0x3204('0x8'));var csv=require(_0x3204('0x9'));var ejs=require(_0x3204('0xa'));var fs=require('fs');var fs_extra=require(_0x3204('0xb'));var _=require(_0x3204('0xc'));var squel=require(_0x3204('0xd'));var crypto=require('crypto');var jsforce=require(_0x3204('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3204('0x9'));var querystring=require(_0x3204('0xf'));var Papa=require(_0x3204('0x10'));var Redis=require(_0x3204('0x11'));var authService=require(_0x3204('0x12'));var qs=require(_0x3204('0x13'));var as=require(_0x3204('0x14'));var pdf=require(_0x3204('0x15'));var hardwareService=require(_0x3204('0x16'));var logger=require(_0x3204('0x17'))(_0x3204('0x18'));var utils=require('../../config/utils');var config=require(_0x3204('0x19'));var licenseUtil=require(_0x3204('0x1a'));var db=require(_0x3204('0x1b'))['db'];config['redis']=_[_0x3204('0x1c')](config[_0x3204('0x1d')],{'host':_0x3204('0x1e'),'port':0x18eb});var socket=require(_0x3204('0x1f'))(new Redis(config[_0x3204('0x1d')]));require('./whatsappInteraction.socket')[_0x3204('0x20')](socket);function respondWithStatusCode(_0x127f83,_0x48d9d5){_0x48d9d5=_0x48d9d5||0xcc;return function(_0x4ed143){if(_0x4ed143){return _0x127f83[_0x3204('0x21')](_0x48d9d5);}return _0x127f83[_0x3204('0x22')](_0x48d9d5)[_0x3204('0x23')]();};}function respondWithResult(_0x586c52,_0x28e798){_0x28e798=_0x28e798||0xc8;return function(_0x1a038e){if(_0x1a038e){return _0x586c52[_0x3204('0x22')](_0x28e798)['json'](_0x1a038e);}};}function respondWithFilteredResult(_0x41cb7b,_0x35edce){return function(_0x218c9b){if(_0x218c9b){var _0x1fbf21=typeof _0x35edce['offset']===_0x3204('0x24')&&typeof _0x35edce[_0x3204('0x25')]===_0x3204('0x24');var _0x2b3c2e=_0x218c9b[_0x3204('0x26')];var _0x4a0ad9=_0x1fbf21?0x0:_0x35edce[_0x3204('0x27')];var _0x513209=_0x1fbf21?_0x218c9b[_0x3204('0x26')]:_0x35edce[_0x3204('0x27')]+_0x35edce[_0x3204('0x25')];var _0x140580;if(_0x513209>=_0x2b3c2e){_0x513209=_0x2b3c2e;_0x140580=0xc8;}else{_0x140580=0xce;}_0x41cb7b[_0x3204('0x22')](_0x140580);return _0x41cb7b[_0x3204('0x28')](_0x3204('0x29'),_0x4a0ad9+'-'+_0x513209+'/'+_0x2b3c2e)[_0x3204('0x2a')](_0x218c9b);}return null;};}function patchUpdates(_0xd0aa4c){return function(_0x292b2e){try{jsonpatch[_0x3204('0x2b')](_0x292b2e,_0xd0aa4c,!![]);}catch(_0x50ba9d){return BPromise[_0x3204('0x2c')](_0x50ba9d);}return _0x292b2e[_0x3204('0x2d')]();};}function saveUpdates(_0x33c388,_0x88d20b){return function(_0x923384){if(_0x923384){return _0x923384[_0x3204('0x2e')](_0x33c388)['then'](function(_0x5529d5){return _0x5529d5;});}return null;};}function removeEntity(_0x5c6bc5,_0x3388c2){return function(_0x7185db){if(_0x7185db){return _0x7185db[_0x3204('0x2f')]()[_0x3204('0x30')](function(){_0x5c6bc5[_0x3204('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d7e7b,_0x642fbe){return function(_0x30b33b){if(!_0x30b33b){_0x3d7e7b[_0x3204('0x21')](0x194);}return _0x30b33b;};}function handleError(_0x4d7dca,_0x451c08){_0x451c08=_0x451c08||0x1f4;return function(_0xd7a029){logger[_0x3204('0x31')](_0xd7a029[_0x3204('0x32')]);if(_0xd7a029[_0x3204('0x33')]){delete _0xd7a029[_0x3204('0x33')];}_0x4d7dca['status'](_0x451c08)[_0x3204('0x34')](_0xd7a029);};}function getInteractionUsers(_0x28ffda,_0x2cc74f){return new BPromise(function(_0x23eb4d,_0x1caec0){try{if(_0x2cc74f[_0x28ffda['id']]){_0x28ffda[_0x3204('0x35')]=_['map'](_0x2cc74f[_0x28ffda['id']],function(_0x3bdc51){return{'id':_0x3bdc51['id'],'fullname':_0x3bdc51[_0x3204('0x36')]};});}}catch(_0x167493){_0x1caec0(_0x167493);}_0x23eb4d(_0x28ffda);});}function getInteractionTags(_0xfa7414,_0x1eb55d){return new BPromise(function(_0x5c8b2b,_0x228f14){try{if(_0xfa7414[_0x3204('0x37')]){_0xfa7414[_0x3204('0x38')]=[];_0xfa7414['TagIds'][_0x3204('0x39')](',')[_0x3204('0x3a')](function(_0x441731){_0xfa7414[_0x3204('0x38')]['push'](_0x1eb55d[_0x441731]);});}delete _0xfa7414['TagIds'];}catch(_0x4930ba){_0x228f14(_0x4930ba);}_0x5c8b2b(_0xfa7414);});}function updateWhatsappInteraction(_0x8885b8,_0x330f27,_0x3399cb){return new BPromise(function(_0x2138d9,_0x50e0e7){return getInteractionUsers(_0x8885b8,_0x3399cb)['then'](function(_0x5d2ed7){return getInteractionTags(_0x5d2ed7,_0x330f27);})[_0x3204('0x30')](function(_0x49f706){_0x2138d9(_0x49f706);})[_0x3204('0x3b')](function(_0x31e888){_0x50e0e7(_0x31e888);});});}exports['index']=function(_0x4b9dfe,_0xadbf8b){var _0x54bbd4={},_0x1172ec={},_0xca85d={'count':0x0,'rows':[]};var _0xe1eb17=_[_0x3204('0x3c')](db[_0x3204('0x3d')][_0x3204('0x3e')],function(_0x467f77){return{'name':_0x467f77[_0x3204('0x3f')],'type':_0x467f77[_0x3204('0x40')][_0x3204('0x41')]};});_0x1172ec[_0x3204('0x42')]=_[_0x3204('0x3c')](_0xe1eb17,_0x3204('0x33'));_0x1172ec[_0x3204('0x43')]=_[_0x3204('0x44')](_0x4b9dfe[_0x3204('0x43')]);_0x1172ec[_0x3204('0x45')]=_[_0x3204('0x46')](_0x1172ec[_0x3204('0x42')],_0x1172ec[_0x3204('0x43')]);_0x54bbd4[_0x3204('0x47')]=_[_0x3204('0x46')](_0x1172ec['model'],qs[_0x3204('0x48')](_0x4b9dfe[_0x3204('0x43')]['fields']));_0x54bbd4['attributes']=_0x54bbd4[_0x3204('0x47')][_0x3204('0x49')]?_0x54bbd4['attributes']:_0x1172ec[_0x3204('0x42')];if(!_0x4b9dfe[_0x3204('0x43')][_0x3204('0x4a')](_0x3204('0x4b'))){_0x54bbd4[_0x3204('0x25')]=qs[_0x3204('0x25')](_0x4b9dfe[_0x3204('0x43')]['limit']);_0x54bbd4[_0x3204('0x27')]=qs[_0x3204('0x27')](_0x4b9dfe[_0x3204('0x43')][_0x3204('0x27')]);}_0x54bbd4['order']=qs[_0x3204('0x4c')](_0x4b9dfe[_0x3204('0x43')][_0x3204('0x4c')]);_0x54bbd4[_0x3204('0x4d')]=qs[_0x3204('0x45')](_['pick'](_0x4b9dfe[_0x3204('0x43')],_0x1172ec[_0x3204('0x45')]),_0xe1eb17);var _0x2ee6d2=[];var _0x545864=squel[_0x3204('0x4e')]()[_0x3204('0x4f')]('id')[_0x3204('0x4f')](_0x3204('0x33'))['field'](_0x3204('0x50'))['from'](_0x3204('0x51'));var _0x76d648=squel['select']()[_0x3204('0x4f')](_0x3204('0x52'))[_0x3204('0x4f')](_0x3204('0x53'))[_0x3204('0x4f')](_0x3204('0x54'))['from'](_0x3204('0x55'),'ui')[_0x3204('0x56')](_0x3204('0x57'),'u',_0x3204('0x58'));var _0x8e8cce=squel['select']()['from']('whatsapp_interactions','i')[_0x3204('0x56')](_0x3204('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3204('0x56')](_0x3204('0x57'),'o',_0x3204('0x5a'))['left_join'](_0x3204('0x5b'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0x3204('0x5c'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x3204('0x56')](_0x3204('0x5d'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x3204('0x56')](_0x3204('0x51'),'t',_0x3204('0x5e'));var _0x4c4c06=squel[_0x3204('0x5f')]();var _0xfd4696=[];var _0xf49648=squel['expr']();var _0x3e47c0;if(_0x4b9dfe[_0x3204('0x43')][_0x3204('0x60')]){_0x3e47c0=as[_0x3204('0x61')](_0x4b9dfe[_0x3204('0x43')][_0x3204('0x60')]);var _0x1e4bf7=_0x3e47c0[_0x3204('0x62')];for(var _0x2fff52=0x0;_0x2fff52<_0x3e47c0['conditions'][_0x3204('0x49')];_0x2fff52++){var _0x3a0641=_0x3e47c0['conditions'][_0x2fff52];var _0x414c9c='i';var _0xb91af8=_[_0x3204('0x63')](_0xe1eb17,['name',_0x3a0641[_0x3204('0x4f')]]);if(!_0xb91af8){switch(_0x3a0641[_0x3204('0x4f')]){case _0x3204('0x64'):if(_0x3a0641[_0x3204('0x65')]==0x1){_0x8e8cce['having']('`'+_0x3a0641[_0x3204('0x4f')]+'`\x20=\x200');}else{_0x8e8cce[_0x3204('0x66')]('`'+_0x3a0641[_0x3204('0x4f')]+_0x3204('0x67'));}break;case _0x3204('0x68'):if(_0x3a0641['operator']===_0x3204('0x69')){if(_0x3a0641[_0x3204('0x65')]['split']('\x20')[_0x3204('0x49')]>0x1){_0x4c4c06[_0x1e4bf7](_0x3204('0x6a'),qs[_0x3204('0x6b')](_0x3a0641[_0x3204('0x65')]),null);}else{var _0x34dc4a='%'+_0x3a0641[_0x3204('0x65')]+'%';_0x4c4c06[_0x1e4bf7](_0x3204('0x6c'),_0x34dc4a,_0x34dc4a,_0x34dc4a);}}else{_0xb91af8=_[_0x3204('0x63')](_0xe1eb17,[_0x3204('0x33'),_0x3204('0x6d')]);_0x3a0641[_0x3204('0x4f')]='ContactId';_0x4cc523=as[_0x3204('0x6e')](_0x414c9c,_0xb91af8[_0x3204('0x40')],_0x3a0641);_0x4c4c06[_0x1e4bf7](_0x4cc523[_0x3204('0x6f')],_0x4cc523['value'][_0x3204('0x70')],_0x4cc523[_0x3204('0x65')][_0x3204('0x23')]);}break;case _0x3204('0x71'):var _0x56f27e=_0x3a0641[_0x3204('0x65')]['split'](',')['map'](function(_0x2d5490){return Number(_0x2d5490);});_0x56f27e[_0x3204('0x3a')](function(_0x3ca6b8){_0xf49648['or'](_0x3204('0x72'),'%,'+_0x3ca6b8+',%');});_0xfd4696=_[_0x3204('0x73')](_0xfd4696,_0x56f27e);break;case _0x3204('0x74'):if(_0x3a0641[_0x3204('0x75')]===_0x3204('0x69')){_0x4c4c06[_0x1e4bf7](_0x3204('0x76'),'%'+_0x3a0641[_0x3204('0x65')]+'%',null);}else{_0xb91af8=_[_0x3204('0x63')](_0xe1eb17,[_0x3204('0x33'),_0x3204('0x77')]);_0x3a0641[_0x3204('0x4f')]='UserId';_0x4cc523=as[_0x3204('0x6e')](_0x414c9c,_0xb91af8[_0x3204('0x40')],_0x3a0641);_0x4c4c06[_0x1e4bf7](_0x4cc523[_0x3204('0x6f')],_0x4cc523[_0x3204('0x65')][_0x3204('0x70')],_0x4cc523[_0x3204('0x65')][_0x3204('0x23')]);}break;case _0x3204('0x78'):_0x4cc523=as[_0x3204('0x6e')]('me',null,_0x3a0641);_0x4c4c06[_0x1e4bf7](_0x4cc523[_0x3204('0x6f')],_0x4cc523[_0x3204('0x65')][_0x3204('0x70')],_0x4cc523['value'][_0x3204('0x23')]);break;}}else{var _0x4cc523=as[_0x3204('0x6e')](_0x414c9c,_0xb91af8['type'],_0x3a0641);_0x4c4c06[_0x1e4bf7](_0x4cc523[_0x3204('0x6f')],_0x4cc523[_0x3204('0x65')]['start'],_0x4cc523['value'][_0x3204('0x23')]);}}}else{var _0x5a5a75=_(_0x4b9dfe[_0x3204('0x43')])[_0x3204('0x44')]()[_0x3204('0x3c')](function(_0x1c5214){return _[_0x3204('0x79')](_0xe1eb17,['name',_0x1c5214])?_0x1c5214:undefined;})[_0x3204('0x7a')]()[_0x3204('0x65')]();if(!_[_0x3204('0x7b')](_0x5a5a75)){_0x5a5a75[_0x3204('0x3a')](function(_0xf5f651){if(_0xf5f651==='WhatsappAccountId'){_0x8e8cce[_0x3204('0x4d')](_0x3204('0x7c'),[][_0x3204('0x7d')](_0x4b9dfe['query'][_0xf5f651]));}else if(_0xf5f651===_0x3204('0x7e')){var _0x73c182=JSON[_0x3204('0x7f')](_0x4b9dfe[_0x3204('0x43')][_0xf5f651])[_0x3204('0x80')];var _0x3734b5=JSON['parse'](_0x4b9dfe[_0x3204('0x43')][_0xf5f651])['$lte'];_0x8e8cce[_0x3204('0x4d')](_0x3204('0x81'),_0x73c182,_0x3734b5);}else{if(_0x4b9dfe[_0x3204('0x43')][_0xf5f651]===_0x3204('0x82')){_0x8e8cce[_0x3204('0x4d')]('i.'+_0xf5f651+'\x20IS\x20NULL');}else{_0x8e8cce[_0x3204('0x4d')]('i.'+_0xf5f651+_0x3204('0x83'),_0x4b9dfe[_0x3204('0x43')][_0xf5f651]);}}});}if(_0x4b9dfe['query'][_0x3204('0x84')]){if(_0x4b9dfe['query'][_0x3204('0x84')]==0x1){_0x8e8cce[_0x3204('0x66')](_0x3204('0x85'));}else{_0x8e8cce[_0x3204('0x66')](_0x3204('0x86'));}}if(_0x4b9dfe[_0x3204('0x43')][_0x3204('0x87')]){_0xfd4696=_[_0x3204('0x88')](_0x4b9dfe['query'][_0x3204('0x87')])?_0x4b9dfe['query'][_0x3204('0x87')]:new Array(_0x4b9dfe[_0x3204('0x43')][_0x3204('0x87')]);_0xfd4696[_0x3204('0x3a')](function(_0x26e1d7){_0xf49648['or'](_0x3204('0x72'),'%,'+_0x26e1d7+',%');});}if(_0x4b9dfe[_0x3204('0x43')][_0x3204('0x89')]){var _0x172be6=_0x4b9dfe[_0x3204('0x43')]['filter'][_0x3204('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x3204('0x8b')](_0x172be6)){_0x4c4c06['or']('i.id\x20LIKE\x20?',_0x172be6+'%')['or']('i.phone\x20LIKE\x20?',_0x172be6+'%');}else{_0x4c4c06['or'](_0x3204('0x8c'),qs[_0x3204('0x6b')](_0x172be6))['or'](_0x3204('0x8d'),_0x172be6+'%');}}}_0x8e8cce[_0x3204('0x4d')](_0x4c4c06);_0x8e8cce['group'](_0x3204('0x8e'));var _0x520df3={'type':db[_0x3204('0x8f')][_0x3204('0x90')][_0x3204('0x91')],'raw':!![]};var _0x4e712f=_0x8e8cce['clone']();_0x4e712f[_0x3204('0x4f')](_0x3204('0x8e'));_0x4e712f[_0x3204('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3204('0x64'));if(_0x54bbd4['order']){_0x54bbd4['order']['forEach'](function(_0x43933a){var _0x3c0460=_0x43933a[0x0]===_0x3204('0x92')?_0x43933a[0x0]:'i.'+_0x43933a[0x0];_0x8e8cce[_0x3204('0x93')](_0x3c0460,_0x43933a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3204('0x7b')](_0xfd4696)){_0x8e8cce['having'](_0xf49648);_0x4e712f['where'](_0x3204('0x94'),_0xfd4696);}BPromise[_0x3204('0x95')]()[_0x3204('0x30')](function(){if(!_0x3e47c0){if(_0x4b9dfe[_0x3204('0x43')]['WhatsappAccountId'])return;_0x4e712f[_0x3204('0x4d')](_0x3204('0x96'));_0x8e8cce['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4b9dfe[_0x3204('0x97')]['role']!==_0x3204('0x98'))return;return _0x4b9dfe[_0x3204('0x97')][_0x3204('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3327f5){if(_[_0x3204('0x7b')](_0x3327f5)){_0x4e712f[_0x3204('0x4d')](_0x3204('0x9a'));_0x8e8cce[_0x3204('0x4d')](_0x3204('0x9a'));}else{_0x4e712f[_0x3204('0x4d')](_0x3204('0x7c'),_[_0x3204('0x3c')](_0x3327f5,'id'));_0x8e8cce[_0x3204('0x4d')](_0x3204('0x7c'),_[_0x3204('0x3c')](_0x3327f5,'id'));}});})[_0x3204('0x30')](function(){if(_0x4b9dfe[_0x3204('0x97')][_0x3204('0x9b')]===_0x3204('0x98')&&!_0x3e47c0&&!_0x4b9dfe[_0x3204('0x43')][_0x3204('0x9c')])return[];return db[_0x3204('0x9d')][_0x3204('0x43')](_0x4e712f[_0x3204('0x9e')](),_0x520df3);})['then'](function(_0xcaf003){_0xca85d[_0x3204('0x26')]=_0xcaf003[_0x3204('0x49')];if(_0xca85d[_0x3204('0x26')]===0x0)return[];return db[_0x3204('0x9d')]['query'](_0x545864[_0x3204('0x9e')](),_0x520df3)[_0x3204('0x30')](function(_0x527211){_0x2ee6d2=_[_0x3204('0x9f')](_0x527211,'id');_0x520df3=_[_0x3204('0xa0')](_0x520df3,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b9dfe['query']['fields']){_0x54bbd4[_0x3204('0x47')][_0x3204('0x3a')](function(_0x183660){_0x8e8cce[_0x3204('0x4f')]('i.'+_0x183660);});}else{_0x8e8cce[_0x3204('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3204('0x64'));_0x8e8cce[_0x3204('0x4f')](_0x3204('0xa1'),_0x3204('0xa2'));_0x8e8cce[_0x3204('0x4f')](_0x3204('0xa3'),_0x3204('0xa4'));_0x8e8cce[_0x3204('0x4f')](_0x3204('0xa5'),'contactName');_0x8e8cce[_0x3204('0x4f')](_0x3204('0xa6'));_0x8e8cce[_0x3204('0x4f')](_0x3204('0xa7'),_0x3204('0xa8'));_0x8e8cce['field'](_0x3204('0xa9'),_0x3204('0xaa'));_0x8e8cce[_0x3204('0x4f')](_0x3204('0xab'),_0x3204('0xac'));_0x8e8cce[_0x3204('0x4f')](_0x3204('0xad'),_0x3204('0xae'));_0x8e8cce['field'](_0x3204('0xaf'),_0x3204('0xb0'));_0x8e8cce[_0x3204('0x4f')]('c.fax',_0x3204('0xb1'));_0x8e8cce[_0x3204('0x4f')]('o.fullname',_0x3204('0xb2'));_0x8e8cce[_0x3204('0x4f')](_0x3204('0xb3'),'Owner.internal');_0x8e8cce[_0x3204('0x4f')](_0x3204('0xb4'),_0x3204('0x37'));}if(_0x54bbd4['limit'])_0x8e8cce['limit'](_0x54bbd4[_0x3204('0x25')]);if(_0x54bbd4[_0x3204('0x27')])_0x8e8cce[_0x3204('0x27')](_0x54bbd4['offset']);return db['sequelize']['query'](_0x8e8cce['toString'](),_0x520df3);})[_0x3204('0x30')](function(_0x327392){if(_0x327392[_0x3204('0x49')]>0x0)_0x76d648[_0x3204('0x4d')](_0x3204('0xb5'),_[_0x3204('0x3c')](_0x327392,'id'));return db[_0x3204('0x9d')][_0x3204('0x43')](_0x76d648[_0x3204('0x9e')](),_0x520df3)[_0x3204('0x30')](function(_0x5ea13c){var _0x50264c=_[_0x3204('0xb6')](_0x5ea13c,_0x3204('0xb7'));var _0x4580c4=[];_0x327392[_0x3204('0x3a')](function(_0x2178ef){_0x4580c4[_0x3204('0xb8')](updateWhatsappInteraction(_0x2178ef,_0x2ee6d2,_0x50264c));});return BPromise[_0x3204('0xb9')](_0x4580c4);});});})[_0x3204('0x30')](function(_0x364059){_0xca85d[_0x3204('0xba')]=_0x364059;return _0xca85d;})['then'](respondWithFilteredResult(_0xadbf8b,_0x54bbd4))[_0x3204('0x3b')](handleError(_0xadbf8b,null));};exports[_0x3204('0xbb')]=function(_0x37f775,_0x20da43){var _0x191918={'raw':![],'where':{'id':_0x37f775[_0x3204('0xbc')]['id']}},_0x25cb90={};_0x25cb90['model']=_[_0x3204('0x44')](db[_0x3204('0x3d')]['rawAttributes']);_0x25cb90[_0x3204('0x43')]=_[_0x3204('0x44')](_0x37f775[_0x3204('0x43')]);_0x25cb90[_0x3204('0x45')]=_[_0x3204('0x46')](_0x25cb90[_0x3204('0x42')],_0x25cb90['query']);_0x191918[_0x3204('0x47')]=_['intersection'](_0x25cb90['model'],qs[_0x3204('0x48')](_0x37f775[_0x3204('0x43')][_0x3204('0x48')]));_0x191918[_0x3204('0x47')]=_0x191918[_0x3204('0x47')][_0x3204('0x49')]?_0x191918[_0x3204('0x47')]:_0x25cb90['model'];if(_0x37f775[_0x3204('0x43')][_0x3204('0xbd')]){_0x191918['include']=[{'all':!![]}];}_0x191918=_['merge']({},_0x191918,_0x37f775[_0x3204('0xbe')]);return db[_0x3204('0x3d')]['find'](_0x191918)[_0x3204('0x30')](handleEntityNotFound(_0x20da43,null))[_0x3204('0x30')](respondWithResult(_0x20da43,null))[_0x3204('0x3b')](handleError(_0x20da43,null));};exports['create']=function(_0x1a0a28,_0x9ddf8e){return db[_0x3204('0x3d')][_0x3204('0xbf')](_0x1a0a28['body'],{})[_0x3204('0x30')](respondWithResult(_0x9ddf8e,0xc9))[_0x3204('0x3b')](handleError(_0x9ddf8e,null));};exports[_0x3204('0x2e')]=function(_0x2a0f5b,_0x14349a){if(_0x2a0f5b['body']['id']){delete _0x2a0f5b['body']['id'];}return db[_0x3204('0x3d')]['find']({'where':{'id':_0x2a0f5b['params']['id']}})[_0x3204('0x30')](handleEntityNotFound(_0x14349a,null))[_0x3204('0x30')](saveUpdates(_0x2a0f5b[_0x3204('0x78')],null))[_0x3204('0x30')](respondWithResult(_0x14349a,null))['catch'](handleError(_0x14349a,null));};exports['destroy']=function(_0x345967,_0x44e444){return db['WhatsappInteraction']['find']({'where':{'id':_0x345967[_0x3204('0xbc')]['id']}})[_0x3204('0x30')](handleEntityNotFound(_0x44e444,null))[_0x3204('0x30')](removeEntity(_0x44e444,null))[_0x3204('0x3b')](handleError(_0x44e444,null));};exports[_0x3204('0xc0')]=function(_0x1df335,_0x1802b6){return db[_0x3204('0x3d')]['describe']()[_0x3204('0x30')](respondWithResult(_0x1802b6,null))[_0x3204('0x3b')](handleError(_0x1802b6,null));};exports[_0x3204('0xc1')]=function(_0x3388f1,_0x33b218,_0x12be5f){return db[_0x3204('0xc2')][_0x3204('0x63')]({'where':{'id':_0x3388f1[_0x3204('0xbc')]['id']}})[_0x3204('0x30')](handleEntityNotFound(_0x33b218,null))[_0x3204('0x30')](function(_0x57e5d0){if(_0x57e5d0){return _0x57e5d0[_0x3204('0xc1')](_0x3388f1[_0x3204('0x78')]['ids'],_[_0x3204('0xc3')](_0x3388f1[_0x3204('0x78')],[_0x3204('0xc4'),'id'])||{});}})[_0x3204('0x30')](respondWithResult(_0x33b218,null))[_0x3204('0x3b')](handleError(_0x33b218,null));};exports[_0x3204('0xc5')]=function(_0x1a170c,_0x24e814,_0x42825d){var _0x366065={'raw':![],'where':{}};var _0x59dc63={};var _0xdaf1e9={'count':0x0,'rows':[]};return db[_0x3204('0x3d')]['findOne']({'where':{'id':_0x1a170c[_0x3204('0xbc')]['id']}})[_0x3204('0x30')](handleEntityNotFound(_0x24e814,null))[_0x3204('0x30')](function(_0x2a00e2){if(_0x2a00e2){_0x59dc63[_0x3204('0x42')]=_['keys'](db['WhatsappMessage'][_0x3204('0x3e')]);_0x59dc63['query']=_[_0x3204('0x44')](_0x1a170c[_0x3204('0x43')]);_0x59dc63['filters']=_[_0x3204('0x46')](_0x59dc63[_0x3204('0x42')],_0x59dc63[_0x3204('0x43')]);_0x366065[_0x3204('0x47')]=_[_0x3204('0x46')](_0x59dc63[_0x3204('0x42')],qs['fields'](_0x1a170c[_0x3204('0x43')]['fields']));_0x366065[_0x3204('0x47')]=_0x366065[_0x3204('0x47')][_0x3204('0x49')]?_0x366065[_0x3204('0x47')]:_0x59dc63['model'];if(!_0x1a170c[_0x3204('0x43')][_0x3204('0x4a')](_0x3204('0x4b'))){_0x366065[_0x3204('0x25')]=qs[_0x3204('0x25')](_0x1a170c[_0x3204('0x43')][_0x3204('0x25')]);_0x366065[_0x3204('0x27')]=qs[_0x3204('0x27')](_0x1a170c['query'][_0x3204('0x27')]);}_0x366065[_0x3204('0x93')]=qs[_0x3204('0x4c')](_0x1a170c[_0x3204('0x43')][_0x3204('0x4c')]);_0x366065[_0x3204('0x4d')]=qs[_0x3204('0x45')](_['pick'](_0x1a170c[_0x3204('0x43')],_0x59dc63[_0x3204('0x45')]));_0x366065[_0x3204('0x4d')][_0x3204('0xb7')]=_0x2a00e2['id'];if(_0x1a170c[_0x3204('0x43')]['filter']){_0x366065[_0x3204('0x4d')]=_[_0x3204('0xa0')](_0x366065[_0x3204('0x4d')],{'$or':_['map'](_0x366065[_0x3204('0x47')],function(_0x44860d){var _0x2effc6={};_0x2effc6[_0x44860d]={'$like':'%'+_0x1a170c[_0x3204('0x43')][_0x3204('0x89')]+'%'};return _0x2effc6;})});}if(_0x1a170c[_0x3204('0x43')][_0x3204('0x80')]){var _0x5d1018=_0x1a170c['query'][_0x3204('0x80')][_0x3204('0x39')](',');var _0x2f4bac={};_0x2f4bac[_0x5d1018[0x0]]={'$gte':moment(_0x5d1018[0x1])[_0x3204('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x366065['where']=_[_0x3204('0xa0')](_0x366065[_0x3204('0x4d')],_0x2f4bac);}_0x366065=_['merge']({},_0x366065,_0x1a170c['options']);return db[_0x3204('0xc2')][_0x3204('0x26')]({'where':_0x366065['where']})[_0x3204('0x30')](function(_0x16c578){_0xdaf1e9['count']=_0x16c578;if(_0x1a170c[_0x3204('0x43')][_0x3204('0xbd')]){_0x366065[_0x3204('0xc7')]=[{'all':!![]}];}return db[_0x3204('0xc2')]['findAll'](_0x366065);})['then'](function(_0xa1ee74){_0xdaf1e9[_0x3204('0xba')]=_0xa1ee74;return _0xdaf1e9;});}})[_0x3204('0x30')](respondWithFilteredResult(_0x24e814,_0x366065))['catch'](handleError(_0x24e814,null));};exports[_0x3204('0xc8')]=function(_0x296d3a,_0x42a615,_0x4b72de){return db[_0x3204('0x3d')]['find']({'where':{'id':_0x296d3a[_0x3204('0xbc')]['id']}})[_0x3204('0x30')](handleEntityNotFound(_0x42a615,null))[_0x3204('0x30')](function(_0x53c685){if(_0x53c685){return _0x53c685[_0x3204('0xc9')](_0x296d3a[_0x3204('0x78')][_0x3204('0xc4')],_[_0x3204('0xc3')](_0x296d3a[_0x3204('0x78')],[_0x3204('0xc4'),'id'])||{})[_0x3204('0xca')](function(){return db[_0x3204('0x71')][_0x3204('0xcb')]({'attributes':['id',_0x3204('0x33'),_0x3204('0x50')],'where':{'id':_0x296d3a[_0x3204('0x78')][_0x3204('0xc4')]}});})[_0x3204('0x30')](function(_0x54059a){socket['emit'](_0x3204('0xcc'),{'id':Number(_0x296d3a[_0x3204('0xbc')]['id']),'tags':_0x54059a||[]});return{'id':Number(_0x296d3a[_0x3204('0xbc')]['id']),'tags':_0x54059a||[]};});}})[_0x3204('0x30')](respondWithResult(_0x42a615,null))[_0x3204('0x3b')](handleError(_0x42a615,null));};exports[_0x3204('0xcd')]=function(_0x17c761,_0x110e0b,_0x51a5d7){return db[_0x3204('0x3d')][_0x3204('0x63')]({'where':{'id':_0x17c761[_0x3204('0xbc')]['id']}})[_0x3204('0x30')](handleEntityNotFound(_0x110e0b,null))[_0x3204('0x30')](function(_0x7c3bd1){if(_0x7c3bd1){return _0x7c3bd1['removeTags'](_0x17c761[_0x3204('0x43')]['ids']);}})[_0x3204('0x30')](respondWithStatusCode(_0x110e0b,null))['catch'](handleError(_0x110e0b,null));};exports[_0x3204('0xce')]=function(_0x419b41,_0x4cd7c5){var _0x4e3302=moment()[_0x3204('0xcf')]()[_0x3204('0x9e')]();var _0x226b19=path['join'](config['root'],_0x3204('0xd0'),'files',_0x3204('0xd1'));var _0x391f88=path[_0x3204('0xd2')](config[_0x3204('0xd3')],_0x3204('0xd0'),'files',_0x3204('0xd4'));var _0x42babb=path['join'](_0x226b19,_0x4e3302);var _0x517efa=util['format']('transcript-%d-%s.zip',_0x419b41[_0x3204('0xbc')]['id'],_0x4e3302);var _0x278f51=path[_0x3204('0xd2')](_0x226b19,_0x517efa);var _0x7683fd=[];_0x7683fd[_0x3204('0xb8')]({'model':db[_0x3204('0x74')],'as':_0x3204('0x74'),'attributes':['id','fullname'],'raw':!![]});_0x7683fd[_0x3204('0xb8')]({'model':db[_0x3204('0xd5')],'as':'Contact','attributes':['id',_0x3204('0xd6'),_0x3204('0xd7')],'raw':!![]});if(_0x419b41[_0x3204('0x43')]['attachments']){_0x7683fd[_0x3204('0xb8')]({'model':db[_0x3204('0xd8')],'as':_0x3204('0xd8'),'raw':!![]});}var _0x2d5ca4=[{'model':db[_0x3204('0xc2')],'as':'Messages','attributes':['id',_0x3204('0x78'),_0x3204('0x7e'),_0x3204('0xd9'),_0x3204('0xda'),_0x3204('0x84')],'include':_0x7683fd}];_0x2d5ca4[_0x3204('0xb8')]({'model':db['WhatsappAccount'],'as':_0x3204('0xdb'),'attributes':['id',_0x3204('0x33')]});_0x2d5ca4[_0x3204('0xb8')]({'model':db[_0x3204('0x74')],'as':_0x3204('0xdc'),'attributes':['id',_0x3204('0x36')]});return db[_0x3204('0x3d')][_0x3204('0x63')]({'where':{'id':_0x419b41[_0x3204('0xbc')]['id']},'include':_0x2d5ca4})[_0x3204('0x30')](handleEntityNotFound(_0x4cd7c5,null))[_0x3204('0x30')](function(_0x2e67c8){if(_0x2e67c8){var _0x5d8d33=_0x2e67c8[_0x3204('0xdd')]({'plain':!![]});fs[_0x3204('0xde')](_0x42babb);var _0x3957ed={'channel':'Whatsapp','account':_0x5d8d33[_0x3204('0xdb')]['name'],'agent':_0x5d8d33['Owner']?_0x5d8d33[_0x3204('0xdc')][_0x3204('0x36')]:_0x3204('0xdf'),'createdAt':moment(_0x5d8d33[_0x3204('0x7e')])[_0x3204('0xc6')](_0x3204('0xe0'))[_0x3204('0x9e')](),'closedAt':_0x5d8d33[_0x3204('0xe1')]?moment(_0x5d8d33['closedAt'])[_0x3204('0xc6')](_0x3204('0xe0'))['toString']():'','disposition':_0x5d8d33[_0x3204('0xe2')],'messages':_(_0x5d8d33[_0x3204('0xe3')])[_0x3204('0x89')]({'secret':![]})['map'](function(_0x5a4623){if(_0x5a4623[_0x3204('0xd8')]){var _0x310bb=path[_0x3204('0xd2')](_0x391f88,_0x5a4623[_0x3204('0xd8')][_0x3204('0xe4')]);if(fs[_0x3204('0xe5')](_0x310bb)){fs[_0x3204('0xe6')](_0x310bb)[_0x3204('0xe7')](fs['createWriteStream'](path[_0x3204('0xd2')](_0x42babb,_0x5a4623['Attachment'][_0x3204('0xe4')])));}}return{'date':moment(_0x5a4623[_0x3204('0x7e')])[_0x3204('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3204('0x9e')](),'sender':_0x5a4623[_0x3204('0xd9')]===_0x3204('0xe8')?_0x5a4623['User']?_0x5a4623[_0x3204('0x74')][_0x3204('0x36')]:_0x3204('0xe9'):_0x5a4623[_0x3204('0x68')]['firstName']+(_0x5a4623[_0x3204('0x68')][_0x3204('0xd7')]?'\x20'+_0x5a4623['Contact'][_0x3204('0xd7')]:''),'body':_0x5a4623['Attachment']?_0x5a4623['Attachment'][_0x3204('0xe4')]:_0x5a4623['body'],'direction':_0x5a4623[_0x3204('0xd9')]===_0x3204('0xe8')?'A':'C','secret':_0x5a4623['secret'],'read':_0x5a4623[_0x3204('0x84')],'attachment':_0x5a4623['Attachment']};})['value']()};return ejs[_0x3204('0xea')](path[_0x3204('0xd2')](config[_0x3204('0xd3')],_0x3204('0xd0'),_0x3204('0xeb'),'downloadInteraction.ejs'),{'interaction':_0x3957ed})[_0x3204('0x30')](function(_0x47cacd){var _0x10c06e=path[_0x3204('0xd2')](_0x42babb,_0x3204('0xec')+_0x5d8d33['id']+'-'+_0x4e3302+_0x3204('0xed'));var _0x2d5ac7={'path':_0x10c06e,'channel':_0x3204('0xee'),'interactionId':_0x5d8d33['id']};return pdf[_0x3204('0xef')](_0x47cacd,_0x2d5ac7);})[_0x3204('0x30')](function(){return new BPromise(function(_0x41b1fd,_0x169831){zipdir(_0x42babb,{'saveTo':_0x278f51},function(_0x4b39d6,_0x3de3de){if(_0x4b39d6)return _0x169831(_0x4b39d6);return _0x41b1fd(_0x3de3de);});})[_0x3204('0x30')](function(){return new BPromise(function(_0x51f991,_0x1f1586){rimraf(_0x42babb,function(_0x261e22){if(_0x261e22)_0x1f1586(_0x261e22);return _0x51f991();});});})[_0x3204('0x30')](function(){return _0x4cd7c5[_0x3204('0xce')](_0x278f51,_0x517efa,function(_0x2b80ae){if(_0x2b80ae){console[_0x3204('0xf0')](_0x3204('0xf1'),_0x2b80ae);}else{fs[_0x3204('0xf2')](_0x278f51);}});});});}else{return _0x4cd7c5[_0x3204('0x21')](0xc8);}})[_0x3204('0x3b')](handleError(_0x4cd7c5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d11ea71..521b495 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 _0x0aaf=['setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage'];(function(_0x24cbb8,_0x477ebd){var _0x173903=function(_0x2e5148){while(--_0x2e5148){_0x24cbb8['push'](_0x24cbb8['shift']());}};_0x173903(++_0x477ebd);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x22e101,_0x412840){_0x22e101=_0x22e101-0x0;var _0xa51f61=_0x0aaf[_0x22e101];return _0xa51f61;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0xf0aa('0x0')];var WhatsappMessage=require(_0xf0aa('0x1'))['db'][_0xf0aa('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf0aa('0x3')](0x0);var events={'afterCreate':_0xf0aa('0x4'),'afterUpdate':'update','afterDestroy':_0xf0aa('0x5')};function emitEvent(_0x2f72d3){return function(_0x4e013e,_0x322cf5,_0x4c20b5){_0x4e013e[_0xf0aa('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xe4a744){_0x4e013e[_0xf0aa('0x7')](_0xf0aa('0x8'),_0xe4a744['map'](function(_0x14137c){return{'id':_0x14137c['id']};}));return WhatsappMessage[_0xf0aa('0x9')]({'where':{'WhatsappInteractionId':_0x4e013e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x475284){_0x4e013e[_0xf0aa('0x7')](_0xf0aa('0xa'),_0x475284[_0xf0aa('0xb')]);WhatsappInteractionEvents[_0xf0aa('0xc')](_0x2f72d3+':'+_0x4e013e['id'],_0x4e013e);WhatsappInteractionEvents[_0xf0aa('0xc')](_0x2f72d3,_0x4e013e);_0x4c20b5(null);})[_0xf0aa('0xd')](_0x4c20b5(null));};}for(var e in events){if(events[_0xf0aa('0xe')](e)){var event=events[e];WhatsappInteraction[_0xf0aa('0xf')](e,emitEvent(event));}}module[_0xf0aa('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1789=['catch','hasOwnProperty','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit'];(function(_0xd3b0ac,_0x2f5065){var _0x3d773e=function(_0x2e10d1){while(--_0x2e10d1){_0xd3b0ac['push'](_0xd3b0ac['shift']());}};_0x3d773e(++_0x2f5065);}(_0x1789,0x92));var _0x9178=function(_0x3e08f3,_0x35bf04){_0x3e08f3=_0x3e08f3-0x0;var _0x4cdb44=_0x1789[_0x3e08f3];return _0x4cdb44;};'use strict';var EventEmitter=require(_0x9178('0x0'));var WhatsappInteraction=require(_0x9178('0x1'))['db'][_0x9178('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x9178('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9178('0x4')](0x0);var events={'afterCreate':_0x9178('0x5'),'afterUpdate':_0x9178('0x6'),'afterDestroy':_0x9178('0x7')};function emitEvent(_0x5911d4){return function(_0x4dc4f8,_0x96260b,_0x30f085){_0x4dc4f8[_0x9178('0x8')]({'attributes':['id'],'raw':!![]})[_0x9178('0x9')](function(_0x502d21){_0x4dc4f8[_0x9178('0xa')](_0x9178('0xb'),_0x502d21[_0x9178('0xc')](function(_0x31a183){return{'id':_0x31a183['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x4dc4f8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x537261){_0x4dc4f8[_0x9178('0xa')](_0x9178('0xd'),_0x537261[_0x9178('0xe')]);WhatsappInteractionEvents[_0x9178('0xf')](_0x5911d4+':'+_0x4dc4f8['id'],_0x4dc4f8);WhatsappInteractionEvents['emit'](_0x5911d4,_0x4dc4f8);_0x30f085(null);})[_0x9178('0x10')](_0x30f085(null));};}for(var e in events){if(events[_0x9178('0x11')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 10d1fb3..e185091 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 _0x0cbd=['bluebird','request-promise','path','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','api','moment'];(function(_0x2375f7,_0x4e7c41){var _0x3b2ca3=function(_0x1ea87a){while(--_0x1ea87a){_0x2375f7['push'](_0x2375f7['shift']());}};_0x3b2ca3(++_0x4e7c41);}(_0x0cbd,0x196));var _0xd0cb=function(_0x2b12d4,_0x2c47d9){_0x2b12d4=_0x2b12d4-0x0;var _0x4c67bb=_0x0cbd[_0x2b12d4];return _0x4c67bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0cb('0x0'));var moment=require(_0xd0cb('0x1'));var BPromise=require(_0xd0cb('0x2'));var rp=require(_0xd0cb('0x3'));var fs=require('fs');var path=require(_0xd0cb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd0cb('0x5'));module[_0xd0cb('0x6')]=function(_0x589ebf,_0x20a5e1){return _0x589ebf[_0xd0cb('0x7')](_0xd0cb('0x8'),attributes,{'tableName':_0xd0cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2cbaaa,_0x1c4a1b,_0x3ad5cf){if(_0x2cbaaa[_0xd0cb('0xa')]('closed')){_0x2cbaaa[_0xd0cb('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3ad5cf(null,_0x2cbaaa);}}});}; \ No newline at end of file +var _0x1cdd=['bluebird','path','./whatsappInteraction.attributes','define','WhatsappInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x1cdd,0xa3));var _0xd1cd=function(_0xbb47ac,_0x305cdf){_0xbb47ac=_0xbb47ac-0x0;var _0x422fd4=_0x1cdd[_0xbb47ac];return _0x422fd4;};'use strict';var _=require(_0xd1cd('0x0'));var util=require(_0xd1cd('0x1'));var logger=require(_0xd1cd('0x2'))(_0xd1cd('0x3'));var moment=require(_0xd1cd('0x4'));var BPromise=require(_0xd1cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd1cd('0x7'));module['exports']=function(_0x16f2e6,_0x1ed491){return _0x16f2e6[_0xd1cd('0x8')](_0xd1cd('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11fdc3,_0x28cbef,_0xa5775f){if(_0x11fdc3[_0xd1cd('0xa')](_0xd1cd('0xb'))){_0x11fdc3[_0xd1cd('0xc')]=moment()['format'](_0xd1cd('0xd'));}_0xa5775f(null,_0x11fdc3);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index ad3ab3f..3caecc2 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 _0xbf66=['body','options','raw','where','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappInteraction','update'];(function(_0xf86b0b,_0x42246f){var _0x5042dc=function(_0x18d0ae){while(--_0x18d0ae){_0xf86b0b['push'](_0xf86b0b['shift']());}};_0x5042dc(++_0x42246f);}(_0xbf66,0x1e5));var _0x6bf6=function(_0xc6dfa2,_0x5c864f){_0xc6dfa2=_0xc6dfa2-0x0;var _0x2fb362=_0xbf66[_0xc6dfa2];return _0x2fb362;};'use strict';var _=require(_0x6bf6('0x0'));var util=require(_0x6bf6('0x1'));var moment=require('moment');var BPromise=require(_0x6bf6('0x2'));var rs=require(_0x6bf6('0x3'));var fs=require('fs');var Redis=require(_0x6bf6('0x4'));var db=require(_0x6bf6('0x5'))['db'];var utils=require(_0x6bf6('0x6'));var logger=require(_0x6bf6('0x7'))(_0x6bf6('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6bf6('0x9')][_0x6bf6('0xa')]({'port':0x232a});config['redis']=_[_0x6bf6('0xb')](config[_0x6bf6('0xc')],{'host':_0x6bf6('0xd'),'port':0x18eb});var socket=require(_0x6bf6('0xe'))(new Redis(config[_0x6bf6('0xc')]));require(_0x6bf6('0xf'))[_0x6bf6('0x10')](socket);function respondWithRpcPromise(_0x51ea9b,_0x50b640,_0x5a0119){return new BPromise(function(_0x352d76,_0x19a584){return client[_0x6bf6('0x11')](_0x51ea9b,_0x5a0119)[_0x6bf6('0x12')](function(_0x312998){logger[_0x6bf6('0x13')](_0x6bf6('0x14'),_0x50b640,_0x6bf6('0x15'));logger[_0x6bf6('0x16')](_0x6bf6('0x17'),_0x50b640,'request\x20sent',JSON[_0x6bf6('0x18')](_0x312998));if(_0x312998[_0x6bf6('0x19')]){if(_0x312998[_0x6bf6('0x19')]['code']===0x1f4){logger[_0x6bf6('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x50b640,_0x312998['error'][_0x6bf6('0x1a')]);return _0x19a584(_0x312998[_0x6bf6('0x19')][_0x6bf6('0x1a')]);}logger['error'](_0x6bf6('0x14'),_0x50b640,_0x312998['error'][_0x6bf6('0x1a')]);return _0x352d76(_0x312998[_0x6bf6('0x19')][_0x6bf6('0x1a')]);}else{logger['info'](_0x6bf6('0x14'),_0x50b640,'request\x20sent');_0x352d76(_0x312998[_0x6bf6('0x1b')][_0x6bf6('0x1a')]);}})[_0x6bf6('0x1c')](function(_0x336c31){logger['error'](_0x6bf6('0x14'),_0x50b640,_0x336c31);_0x19a584(_0x336c31);});});}exports['UpdateWhatsappInteraction']=function(_0x3a5d36){var _0x215e5f=this;return new Promise(function(_0x46d048,_0x840875){return db[_0x6bf6('0x1d')][_0x6bf6('0x1e')](_0x3a5d36[_0x6bf6('0x1f')],{'raw':_0x3a5d36['options']?_0x3a5d36[_0x6bf6('0x20')][_0x6bf6('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5d36[_0x6bf6('0x20')]?_0x3a5d36[_0x6bf6('0x20')][_0x6bf6('0x22')]||null:null,'attributes':_0x3a5d36[_0x6bf6('0x20')]?_0x3a5d36[_0x6bf6('0x20')]['attributes']||null:null,'limit':_0x3a5d36[_0x6bf6('0x20')]?_0x3a5d36['options'][_0x6bf6('0x23')]||null:null})[_0x6bf6('0x12')](function(_0x40bfa9){logger['info']('UpdateWhatsappInteraction',_0x3a5d36);logger[_0x6bf6('0x16')](_0x6bf6('0x24'),_0x3a5d36,JSON['stringify'](_0x40bfa9));_0x46d048(_0x40bfa9);})[_0x6bf6('0x1c')](function(_0x289333){logger[_0x6bf6('0x19')](_0x6bf6('0x24'),_0x289333[_0x6bf6('0x1a')],_0x3a5d36);_0x840875(_0x215e5f[_0x6bf6('0x19')](0x1f4,_0x289333[_0x6bf6('0x1a')]));});});};exports[_0x6bf6('0x25')]=function(_0x5635b8){return new Promise(function(_0xa0b253,_0x4c2cc0){return db['WhatsappInteraction'][_0x6bf6('0x26')]({'where':_0x5635b8[_0x6bf6('0x20')]?_0x5635b8[_0x6bf6('0x20')][_0x6bf6('0x22')]||null:null})['then'](function(_0x2809ce){if(_0x2809ce){return _0x2809ce[_0x6bf6('0x27')](_0x5635b8[_0x6bf6('0x1f')][_0x6bf6('0x28')],_['omit'](_0x5635b8[_0x6bf6('0x1f')],[_0x6bf6('0x28'),'id'])||{});}})[_0x6bf6('0x29')](function(_0x44aba2){logger[_0x6bf6('0x13')]('AddTags',_0x5635b8);logger[_0x6bf6('0x16')](_0x6bf6('0x2a'),_0x5635b8,JSON[_0x6bf6('0x18')](_0x44aba2));_0xa0b253(_0x44aba2);})[_0x6bf6('0x1c')](function(_0x4e2e5a){logger[_0x6bf6('0x19')](_0x6bf6('0x2a'),_0x4e2e5a[_0x6bf6('0x1a')],_0x5635b8);_0x4c2cc0(_this[_0x6bf6('0x19')](0x1f4,_0x4e2e5a['message']));});});}; \ No newline at end of file +var _0x5e47=['register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x323709,_0x4f1de6){var _0x412313=function(_0x20b5b6){while(--_0x20b5b6){_0x323709['push'](_0x323709['shift']());}};_0x412313(++_0x4f1de6);}(_0x5e47,0x6d));var _0x75e4=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x5e47[_0x58a4fe];return _0x697de2;};'use strict';var _=require(_0x75e4('0x0'));var util=require(_0x75e4('0x1'));var moment=require(_0x75e4('0x2'));var BPromise=require(_0x75e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75e4('0x4'));var db=require(_0x75e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x75e4('0x6'));var config=require(_0x75e4('0x7'));var jayson=require(_0x75e4('0x8'));var client=jayson[_0x75e4('0x9')]['http']({'port':0x232a});config[_0x75e4('0xa')]=_[_0x75e4('0xb')](config['redis'],{'host':_0x75e4('0xc'),'port':0x18eb});var socket=require(_0x75e4('0xd'))(new Redis(config[_0x75e4('0xa')]));require('./whatsappInteraction.socket')[_0x75e4('0xe')](socket);function respondWithRpcPromise(_0x3e8c3b,_0x2d935c,_0x42fe0e){return new BPromise(function(_0x35e1a6,_0xc0d97f){return client[_0x75e4('0xf')](_0x3e8c3b,_0x42fe0e)[_0x75e4('0x10')](function(_0x1cd757){logger[_0x75e4('0x11')](_0x75e4('0x12'),_0x2d935c,_0x75e4('0x13'));logger[_0x75e4('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x2d935c,_0x75e4('0x13'),JSON[_0x75e4('0x15')](_0x1cd757));if(_0x1cd757[_0x75e4('0x16')]){if(_0x1cd757[_0x75e4('0x16')]['code']===0x1f4){logger['error'](_0x75e4('0x12'),_0x2d935c,_0x1cd757[_0x75e4('0x16')][_0x75e4('0x17')]);return _0xc0d97f(_0x1cd757[_0x75e4('0x16')][_0x75e4('0x17')]);}logger['error'](_0x75e4('0x12'),_0x2d935c,_0x1cd757[_0x75e4('0x16')][_0x75e4('0x17')]);return _0x35e1a6(_0x1cd757[_0x75e4('0x16')][_0x75e4('0x17')]);}else{logger[_0x75e4('0x11')](_0x75e4('0x12'),_0x2d935c,_0x75e4('0x13'));_0x35e1a6(_0x1cd757[_0x75e4('0x18')][_0x75e4('0x17')]);}})[_0x75e4('0x19')](function(_0x465d6f){logger[_0x75e4('0x16')](_0x75e4('0x12'),_0x2d935c,_0x465d6f);_0xc0d97f(_0x465d6f);});});}exports['UpdateWhatsappInteraction']=function(_0x40130b){var _0x33f19c=this;return new Promise(function(_0x1514f6,_0xa07a81){return db['WhatsappInteraction']['update'](_0x40130b['body'],{'raw':_0x40130b[_0x75e4('0x1a')]?_0x40130b[_0x75e4('0x1a')][_0x75e4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40130b[_0x75e4('0x1a')]?_0x40130b['options'][_0x75e4('0x1c')]||null:null,'attributes':_0x40130b[_0x75e4('0x1a')]?_0x40130b[_0x75e4('0x1a')][_0x75e4('0x1d')]||null:null,'limit':_0x40130b[_0x75e4('0x1a')]?_0x40130b[_0x75e4('0x1a')][_0x75e4('0x1e')]||null:null})[_0x75e4('0x10')](function(_0x7a87c4){logger['info'](_0x75e4('0x1f'),_0x40130b);logger[_0x75e4('0x14')](_0x75e4('0x1f'),_0x40130b,JSON[_0x75e4('0x15')](_0x7a87c4));_0x1514f6(_0x7a87c4);})[_0x75e4('0x19')](function(_0x3f8140){logger['error']('UpdateWhatsappInteraction',_0x3f8140[_0x75e4('0x17')],_0x40130b);_0xa07a81(_0x33f19c[_0x75e4('0x16')](0x1f4,_0x3f8140[_0x75e4('0x17')]));});});};exports[_0x75e4('0x20')]=function(_0x392de0){return new Promise(function(_0x38abd4,_0x3fb763){return db[_0x75e4('0x21')][_0x75e4('0x22')]({'where':_0x392de0[_0x75e4('0x1a')]?_0x392de0[_0x75e4('0x1a')][_0x75e4('0x1c')]||null:null})[_0x75e4('0x10')](function(_0x5ddb18){if(_0x5ddb18){return _0x5ddb18[_0x75e4('0x23')](_0x392de0[_0x75e4('0x24')][_0x75e4('0x25')],_[_0x75e4('0x26')](_0x392de0[_0x75e4('0x24')],[_0x75e4('0x25'),'id'])||{});}})[_0x75e4('0x27')](function(_0x4b1451){logger[_0x75e4('0x11')](_0x75e4('0x28'),_0x392de0);logger['debug'](_0x75e4('0x28'),_0x392de0,JSON[_0x75e4('0x15')](_0x4b1451));_0x38abd4(_0x4b1451);})['catch'](function(_0x26f036){logger['error'](_0x75e4('0x28'),_0x26f036[_0x75e4('0x17')],_0x392de0);_0x3fb763(_this[_0x75e4('0x16')](0x1f4,_0x26f036['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 510fe83..c094786 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 _0xaee7=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','update'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0xaee7,0x185));var _0x7aee=function(_0x40aec9,_0x43ab43){_0x40aec9=_0x40aec9-0x0;var _0x37f182=_0xaee7[_0x40aec9];return _0x37f182;};'use strict';var WhatsappInteractionEvents=require(_0x7aee('0x0'));var events=[_0x7aee('0x1'),'remove',_0x7aee('0x2')];function createListener(_0x455e35,_0x3f85bc){return function(_0x6c2839){_0x3f85bc[_0x7aee('0x3')](_0x455e35,_0x6c2839);};}function removeListener(_0x2a8212,_0x8184d8){return function(){WhatsappInteractionEvents[_0x7aee('0x4')](_0x2a8212,_0x8184d8);};}exports[_0x7aee('0x5')]=function(_0x5d52e3){for(var _0x537224=0x0,_0x3317d8=events['length'];_0x537224<_0x3317d8;_0x537224++){var _0x29df57=events[_0x537224];var _0x332622=createListener(_0x7aee('0x6')+_0x29df57,_0x5d52e3);WhatsappInteractionEvents['on'](_0x29df57,_0x332622);}}; \ No newline at end of file +var _0xc6bc=['remove','update','register','length','whatsappInteraction:'];(function(_0x45964e,_0x280b94){var _0x90d72=function(_0x26ee2b){while(--_0x26ee2b){_0x45964e['push'](_0x45964e['shift']());}};_0x90d72(++_0x280b94);}(_0xc6bc,0x104));var _0xcc6b=function(_0x3e4843,_0x41f17a){_0x3e4843=_0x3e4843-0x0;var _0x2d3edb=_0xc6bc[_0x3e4843];return _0x2d3edb;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xcc6b('0x0'),_0xcc6b('0x1')];function createListener(_0x6bc493,_0x2954dc){return function(_0x13811b){_0x2954dc['emit'](_0x6bc493,_0x13811b);};}function removeListener(_0x5f5c19,_0x509662){return function(){WhatsappInteractionEvents['removeListener'](_0x5f5c19,_0x509662);};}exports[_0xcc6b('0x2')]=function(_0x2afb93){for(var _0x5cb7e5=0x0,_0x15e212=events[_0xcc6b('0x3')];_0x5cb7e5<_0x15e212;_0x5cb7e5++){var _0x458168=events[_0x5cb7e5];var _0xa634d6=createListener(_0xcc6b('0x4')+_0x458168,_0x2afb93);WhatsappInteractionEvents['on'](_0x458168,_0xa634d6);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1168722..7929086 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 _0x37ee=['reject','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x18ff6a,_0x331e15){var _0x26661c=function(_0x1bb099){while(--_0x1bb099){_0x18ff6a['push'](_0x18ff6a['shift']());}};_0x26661c(++_0x331e15);}(_0x37ee,0x12d));var _0xe37e=function(_0x5219b0,_0x4120f7){_0x5219b0=_0x5219b0-0x0;var _0x3257fc=_0x37ee[_0x5219b0];return _0x3257fc;};'use strict';var multer=require('multer');var util=require(_0xe37e('0x0'));var path=require(_0xe37e('0x1'));var timeout=require(_0xe37e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe37e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe37e('0x4'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xe37e('0x5')](),controller[_0xe37e('0x6')]);router[_0xe37e('0x7')](_0xe37e('0x8'),auth[_0xe37e('0x5')](),controller[_0xe37e('0x9')]);router['get'](_0xe37e('0xa'),auth[_0xe37e('0x5')](),controller[_0xe37e('0xb')]);router[_0xe37e('0xc')]('/',auth[_0xe37e('0x5')](),interaction['tracked'](_0xe37e('0xd'),_0xe37e('0xe')),controller[_0xe37e('0xf')]);router['post'](_0xe37e('0x10'),controller[_0xe37e('0x11')]);router[_0xe37e('0x12')](_0xe37e('0xa'),auth[_0xe37e('0x5')](),controller[_0xe37e('0x13')]);router[_0xe37e('0x12')](_0xe37e('0x14'),auth[_0xe37e('0x5')](),controller[_0xe37e('0x15')]);router[_0xe37e('0x12')](_0xe37e('0x16'),auth['isAuthenticated'](),controller[_0xe37e('0x17')]);router[_0xe37e('0x18')](_0xe37e('0xa'),auth[_0xe37e('0x5')](),controller[_0xe37e('0x19')]);module[_0xe37e('0x1a')]=router; \ No newline at end of file +var _0xfaed=['express','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','update','put','accept','/:id/reject','delete','destroy','exports','multer','util','path'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0xfaed,0x15c));var _0xdfae=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xfaed[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xdfae('0x0'));var util=require(_0xdfae('0x1'));var path=require(_0xdfae('0x2'));var timeout=require('connect-timeout');var express=require(_0xdfae('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdfae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdfae('0x5'));var controller=require(_0xdfae('0x6'));router['get']('/',auth[_0xdfae('0x7')](),controller[_0xdfae('0x8')]);router[_0xdfae('0x9')](_0xdfae('0xa'),auth[_0xdfae('0x7')](),controller[_0xdfae('0xb')]);router[_0xdfae('0x9')](_0xdfae('0xc'),auth[_0xdfae('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0xdfae('0xd')](_0xdfae('0xe'),_0xdfae('0xf')),controller[_0xdfae('0x10')]);router[_0xdfae('0x11')](_0xdfae('0x12'),controller[_0xdfae('0x13')]);router['put'](_0xdfae('0xc'),auth['isAuthenticated'](),controller[_0xdfae('0x14')]);router[_0xdfae('0x15')]('/:id/accept',auth[_0xdfae('0x7')](),controller[_0xdfae('0x16')]);router[_0xdfae('0x15')](_0xdfae('0x17'),auth[_0xdfae('0x7')](),controller['reject']);router[_0xdfae('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xdfae('0x19')]);module[_0xdfae('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 64b899e..56eba62 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 _0x22c4=['STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x31082b,_0x15108a){var _0x3b41f7=function(_0x5bf19c){while(--_0x5bf19c){_0x31082b['push'](_0x31082b['shift']());}};_0x3b41f7(++_0x15108a);}(_0x22c4,0x81));var _0x422c=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x22c4[_0xe719ec];return _0x4842a1;};'use strict';var Sequelize=require(_0x422c('0x0'));module['exports']={'body':{'type':Sequelize[_0x422c('0x1')](_0x422c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x422c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x422c('0x4')]('in',_0x422c('0x5')),'defaultValue':_0x422c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x422c('0x6')]},'secret':{'type':Sequelize[_0x422c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x422c('0x7')]},'providerResponse':{'type':Sequelize[_0x422c('0x1')]}}; \ No newline at end of file +var _0xdbf5=['out','STRING','DATE','TEXT','exports','BOOLEAN','ENUM'];(function(_0x1172f5,_0x52590f){var _0x36898b=function(_0x1b0dde){while(--_0x1b0dde){_0x1172f5['push'](_0x1172f5['shift']());}};_0x36898b(++_0x52590f);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xcdee17,_0x140a5f){_0xcdee17=_0xcdee17-0x0;var _0x2c9016=_0xdbf5[_0xcdee17];return _0x2c9016;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5dbf('0x2')]('in',_0x5dbf('0x3')),'defaultValue':_0x5dbf('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5dbf('0x4')](0xbe)},'phone':{'type':Sequelize[_0x5dbf('0x4')]},'readAt':{'type':Sequelize[_0x5dbf('0x5')]},'secret':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5dbf('0x4')]},'providerResponse':{'type':Sequelize[_0x5dbf('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5aff3bd..d99eb6e 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 _0xa14c=['code','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','name','index','map','WhatsappMessage','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','update','body','destroy','describe','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteraction','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','email','manual','SIP/%s','user','channel','motionChannel','EventManager','acceptmessage','whatsapp-interactions','whatsapp','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fullname','internal','interface','event','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3e779c,_0x546ea2){var _0x22ab11=function(_0x4f2b7a){while(--_0x4f2b7a){_0x3e779c['push'](_0x3e779c['shift']());}};_0x22ab11(++_0x546ea2);}(_0xa14c,0x187));var _0xca14=function(_0x50d15f,_0x5e75dc){_0x50d15f=_0x50d15f-0x0;var _0x1cc3a2=_0xa14c[_0x50d15f];return _0x1cc3a2;};'use strict';var emlformat=require(_0xca14('0x0'));var rimraf=require(_0xca14('0x1'));var zipdir=require(_0xca14('0x2'));var jsonpatch=require(_0xca14('0x3'));var rp=require(_0xca14('0x4'));var moment=require(_0xca14('0x5'));var BPromise=require(_0xca14('0x6'));var Mustache=require(_0xca14('0x7'));var util=require('util');var path=require(_0xca14('0x8'));var sox=require('sox');var csv=require(_0xca14('0x9'));var ejs=require(_0xca14('0xa'));var fs=require('fs');var fs_extra=require(_0xca14('0xb'));var _=require('lodash');var squel=require(_0xca14('0xc'));var crypto=require('crypto');var jsforce=require(_0xca14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xca14('0x9'));var querystring=require('querystring');var Papa=require(_0xca14('0xe'));var Redis=require(_0xca14('0xf'));var authService=require(_0xca14('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca14('0x11'));var logger=require(_0xca14('0x12'))(_0xca14('0x13'));var utils=require(_0xca14('0x14'));var config=require(_0xca14('0x15'));var licenseUtil=require(_0xca14('0x16'));var db=require(_0xca14('0x17'))['db'];config[_0xca14('0x18')]=_[_0xca14('0x19')](config['redis'],{'host':_0xca14('0x1a'),'port':0x18eb});var socket=require(_0xca14('0x1b'))(new Redis(config['redis']));require(_0xca14('0x1c'))[_0xca14('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xca14('0x1e')][_0xca14('0x1f')]({'port':0x232c});var client9002=jayson[_0xca14('0x1e')][_0xca14('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2c9a23,_0x5e0de0,_0x11c8a5,_0x26e58b){return new BPromise(function(_0x1974b2,_0x392e47){var _0x3d45bd=_0x26e58b||client;return _0x3d45bd['request'](_0x2c9a23,_0x11c8a5)[_0xca14('0x20')](function(_0x599df7){logger['info'](_0xca14('0x21'),_0x5e0de0,'request\x20sent');logger[_0xca14('0x22')](_0xca14('0x23'),_0x5e0de0,'request\x20sent',JSON[_0xca14('0x24')](_0x599df7));if(_0x599df7[_0xca14('0x25')]){if(_0x599df7['error'][_0xca14('0x26')]===0x1f4){logger[_0xca14('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x5e0de0,_0x599df7[_0xca14('0x25')][_0xca14('0x27')]);return _0x392e47(_0x599df7[_0xca14('0x25')][_0xca14('0x27')]);}logger[_0xca14('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x5e0de0,_0x599df7[_0xca14('0x25')][_0xca14('0x27')]);return _0x1974b2(_0x599df7['error'][_0xca14('0x27')]);}else{logger[_0xca14('0x28')](_0xca14('0x21'),_0x5e0de0,'request\x20sent');_0x1974b2(_0x599df7[_0xca14('0x29')][_0xca14('0x27')]);}})['catch'](function(_0x920924){logger['error'](_0xca14('0x21'),_0x5e0de0,_0x920924);_0x392e47(_0x920924);});});}function respondWithStatusCode(_0x2680db,_0x457804){_0x457804=_0x457804||0xcc;return function(_0x3470f5){if(_0x3470f5){return _0x2680db[_0xca14('0x2a')](_0x457804);}return _0x2680db[_0xca14('0x2b')](_0x457804)[_0xca14('0x2c')]();};}function respondWithResult(_0x28e185,_0x25fe20){_0x25fe20=_0x25fe20||0xc8;return function(_0x2f1353){if(_0x2f1353){return _0x28e185[_0xca14('0x2b')](_0x25fe20)[_0xca14('0x2d')](_0x2f1353);}};}function respondWithFilteredResult(_0x246c43,_0x22f968){return function(_0xf4152f){if(_0xf4152f){var _0x376560=typeof _0x22f968[_0xca14('0x2e')]==='undefined'&&typeof _0x22f968[_0xca14('0x2f')]===_0xca14('0x30');var _0xf5a528=_0xf4152f[_0xca14('0x31')];var _0xd8618b=_0x376560?0x0:_0x22f968[_0xca14('0x2e')];var _0xc94d11=_0x376560?_0xf4152f[_0xca14('0x31')]:_0x22f968[_0xca14('0x2e')]+_0x22f968['limit'];var _0x272728;if(_0xc94d11>=_0xf5a528){_0xc94d11=_0xf5a528;_0x272728=0xc8;}else{_0x272728=0xce;}_0x246c43['status'](_0x272728);return _0x246c43[_0xca14('0x32')](_0xca14('0x33'),_0xd8618b+'-'+_0xc94d11+'/'+_0xf5a528)[_0xca14('0x2d')](_0xf4152f);}return null;};}function patchUpdates(_0x1ea2ac){return function(_0x30c9be){try{jsonpatch['apply'](_0x30c9be,_0x1ea2ac,!![]);}catch(_0x1198b6){return BPromise[_0xca14('0x34')](_0x1198b6);}return _0x30c9be[_0xca14('0x35')]();};}function saveUpdates(_0x568b5c,_0x3e7147){return function(_0x48f5fc){if(_0x48f5fc){return _0x48f5fc['update'](_0x568b5c)[_0xca14('0x20')](function(_0x4e2015){return _0x4e2015;});}return null;};}function removeEntity(_0x53114d,_0x3303e0){return function(_0x8e2775){if(_0x8e2775){return _0x8e2775['destroy']()['then'](function(){_0x53114d[_0xca14('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594a52,_0x31616c){return function(_0x5015f9){if(!_0x5015f9){_0x594a52[_0xca14('0x2a')](0x194);}return _0x5015f9;};}function handleError(_0x25a78e,_0x55b0f8){_0x55b0f8=_0x55b0f8||0x1f4;return function(_0x177c8a){logger[_0xca14('0x25')](_0x177c8a['stack']);if(_0x177c8a[_0xca14('0x36')]){delete _0x177c8a[_0xca14('0x36')];}_0x25a78e[_0xca14('0x2b')](_0x55b0f8)['send'](_0x177c8a);};}exports[_0xca14('0x37')]=function(_0x1744d4,_0x236211){var _0xf0c4c1={},_0x337e67={},_0x540037={'count':0x0,'rows':[]};var _0xbaf10e=_[_0xca14('0x38')](db[_0xca14('0x39')]['rawAttributes'],function(_0x437958){return{'name':_0x437958[_0xca14('0x3a')],'type':_0x437958[_0xca14('0x3b')][_0xca14('0x3c')]};});_0x337e67['model']=_[_0xca14('0x38')](_0xbaf10e,_0xca14('0x36'));_0x337e67[_0xca14('0x3d')]=_[_0xca14('0x3e')](_0x1744d4['query']);_0x337e67['filters']=_[_0xca14('0x3f')](_0x337e67[_0xca14('0x40')],_0x337e67[_0xca14('0x3d')]);_0xf0c4c1[_0xca14('0x41')]=_['intersection'](_0x337e67[_0xca14('0x40')],qs[_0xca14('0x42')](_0x1744d4[_0xca14('0x3d')][_0xca14('0x42')]));_0xf0c4c1[_0xca14('0x41')]=_0xf0c4c1[_0xca14('0x41')][_0xca14('0x43')]?_0xf0c4c1[_0xca14('0x41')]:_0x337e67[_0xca14('0x40')];if(!_0x1744d4['query'][_0xca14('0x44')](_0xca14('0x45'))){_0xf0c4c1['limit']=qs[_0xca14('0x2f')](_0x1744d4[_0xca14('0x3d')][_0xca14('0x2f')]);_0xf0c4c1['offset']=qs['offset'](_0x1744d4['query'][_0xca14('0x2e')]);}_0xf0c4c1[_0xca14('0x46')]=qs[_0xca14('0x47')](_0x1744d4[_0xca14('0x3d')][_0xca14('0x47')]);_0xf0c4c1['where']=qs[_0xca14('0x48')](_[_0xca14('0x49')](_0x1744d4[_0xca14('0x3d')],_0x337e67['filters']),_0xbaf10e);if(_0x1744d4[_0xca14('0x3d')][_0xca14('0x4a')]){_0xf0c4c1['where']=_[_0xca14('0x4b')](_0xf0c4c1[_0xca14('0x4c')],{'$or':_['map'](_0xbaf10e,function(_0x25460f){if(_0x25460f['type']!==_0xca14('0x4d')){var _0x51f4ab={};_0x51f4ab[_0x25460f[_0xca14('0x36')]]={'$like':'%'+_0x1744d4[_0xca14('0x3d')][_0xca14('0x4a')]+'%'};return _0x51f4ab;}})});}_0xf0c4c1=_[_0xca14('0x4b')]({},_0xf0c4c1,_0x1744d4['options']);var _0x234d0e={'where':_0xf0c4c1[_0xca14('0x4c')]};return db[_0xca14('0x39')][_0xca14('0x31')](_0x234d0e)['then'](function(_0x52c503){_0x540037['count']=_0x52c503;if(_0x1744d4[_0xca14('0x3d')][_0xca14('0x4e')]){_0xf0c4c1[_0xca14('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xca14('0x50')](_0xf0c4c1);})[_0xca14('0x20')](function(_0x1c2b9e){_0x540037[_0xca14('0x51')]=_0x1c2b9e;return _0x540037;})[_0xca14('0x20')](respondWithFilteredResult(_0x236211,_0xf0c4c1))[_0xca14('0x52')](handleError(_0x236211,null));};exports[_0xca14('0x53')]=function(_0x5597c0,_0x544b12){var _0x3956a8={'raw':!![],'where':{'id':_0x5597c0[_0xca14('0x54')]['id']}},_0x30f50c={};_0x30f50c[_0xca14('0x40')]=_[_0xca14('0x3e')](db['WhatsappMessage'][_0xca14('0x55')]);_0x30f50c[_0xca14('0x3d')]=_[_0xca14('0x3e')](_0x5597c0[_0xca14('0x3d')]);_0x30f50c[_0xca14('0x48')]=_[_0xca14('0x3f')](_0x30f50c[_0xca14('0x40')],_0x30f50c[_0xca14('0x3d')]);_0x3956a8['attributes']=_[_0xca14('0x3f')](_0x30f50c[_0xca14('0x40')],qs[_0xca14('0x42')](_0x5597c0[_0xca14('0x3d')][_0xca14('0x42')]));_0x3956a8[_0xca14('0x41')]=_0x3956a8[_0xca14('0x41')][_0xca14('0x43')]?_0x3956a8[_0xca14('0x41')]:_0x30f50c[_0xca14('0x40')];if(_0x5597c0['query'][_0xca14('0x4e')]){_0x3956a8['include']=[{'all':!![]}];}_0x3956a8=_[_0xca14('0x4b')]({},_0x3956a8,_0x5597c0[_0xca14('0x56')]);return db[_0xca14('0x39')][_0xca14('0x57')](_0x3956a8)[_0xca14('0x20')](handleEntityNotFound(_0x544b12,null))[_0xca14('0x20')](respondWithResult(_0x544b12,null))[_0xca14('0x52')](handleError(_0x544b12,null));};exports[_0xca14('0x58')]=function(_0x51e8e4,_0x4222f2){return db[_0xca14('0x39')][_0xca14('0x58')](_0x51e8e4['body'],{})['then'](respondWithResult(_0x4222f2,0xc9))[_0xca14('0x52')](handleError(_0x4222f2,null));};exports[_0xca14('0x59')]=function(_0x120a06,_0x111ff0){if(_0x120a06[_0xca14('0x5a')]['id']){delete _0x120a06[_0xca14('0x5a')]['id'];}return db[_0xca14('0x39')]['find']({'where':{'id':_0x120a06[_0xca14('0x54')]['id']}})[_0xca14('0x20')](handleEntityNotFound(_0x111ff0,null))[_0xca14('0x20')](saveUpdates(_0x120a06[_0xca14('0x5a')],null))[_0xca14('0x20')](respondWithResult(_0x111ff0,null))[_0xca14('0x52')](handleError(_0x111ff0,null));};exports[_0xca14('0x5b')]=function(_0x1ccf1b,_0x4109ef){return db[_0xca14('0x39')][_0xca14('0x57')]({'where':{'id':_0x1ccf1b[_0xca14('0x54')]['id']}})[_0xca14('0x20')](handleEntityNotFound(_0x4109ef,null))['then'](removeEntity(_0x4109ef,null))[_0xca14('0x52')](handleError(_0x4109ef,null));};exports['describe']=function(_0x2d6b11,_0x4403a0){return db[_0xca14('0x39')][_0xca14('0x5c')]()[_0xca14('0x20')](respondWithResult(_0x4403a0,null))[_0xca14('0x52')](handleError(_0x4403a0,null));};var interaction_log=require(_0xca14('0x12'))('whatsapp-interactions');exports[_0xca14('0x5d')]=function(_0x310621,_0x2d0729,_0x4af155){var _0x824870={'agent':{},'channel':'whatsapp'};if(_0x310621[_0xca14('0x5a')]['id']){delete _0x310621['body']['id'];}_0x310621[_0xca14('0x5a')]['read']=!![];_0x310621[_0xca14('0x5a')]['readAt']=moment()[_0xca14('0x5e')](_0xca14('0x5f'));_0x310621[_0xca14('0x5a')][_0xca14('0x60')]=_0x310621[_0xca14('0x5a')][_0xca14('0x60')]||_0x310621['user']['id'];_0x824870[_0xca14('0x61')]['id']=_0x310621['body'][_0xca14('0x60')];return db['WhatsappMessage']['find']({'where':{'id':_0x310621['params']['id'],'UserId':null}})[_0xca14('0x20')](handleEntityNotFound(_0x2d0729,null))[_0xca14('0x20')](saveUpdates(_0x310621[_0xca14('0x5a')],null))[_0xca14('0x20')](function(_0x330028){if(_0x330028){_0x824870['message']=_0x330028['get']({'plain':!![]});return db[_0xca14('0x62')]['find']({'where':{'id':_0x330028['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2d0729,null))['then'](function(_0x36ce5c){if(_0x36ce5c){return _0x36ce5c[_0xca14('0x59')]({'UserId':_0x310621['body'][_0xca14('0x60')],'read1stAt':_[_0xca14('0x63')](_0x36ce5c[_0xca14('0x64')])?moment()[_0xca14('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xca14('0x20')](function(_0x4415d4){if(_0x4415d4){_0x824870[_0xca14('0x65')]=_0x4415d4[_0xca14('0x66')]({'plain':!![]});interaction_log[_0xca14('0x28')](_0xca14('0x67'),_0x310621['user']['id'],_0x310621['user'][_0xca14('0x36')],_0x310621['user'][_0xca14('0x68')],_0x824870[_0xca14('0x65')]['id'],_0x310621[_0xca14('0x5a')]?JSON[_0xca14('0x24')](_0x310621[_0xca14('0x5a')]):_0xca14('0x69'));return respondWithRpcPromise('AcceptMessage',_0xca14('0x6a'),_0x824870);}return null;})[_0xca14('0x20')](function(_0x3fa274){var _0xfc7e75=_0xca14('0x6b')+_0x3fa274[_0xca14('0x27')][_0xca14('0x6c')];return db[_0xca14('0x6d')][_0xca14('0x3d')](_0xfc7e75,{'type':db[_0xca14('0x6e')][_0xca14('0x6f')]['SELECT'],'raw':!![]})[_0xca14('0x20')](function(_0x476cd4){return _0x476cd4;});})[_0xca14('0x20')](function(_0x5b4016){if(_0x5b4016){_0x824870[_0xca14('0x27')][_0xca14('0x70')]=_0x5b4016[0x0];if(!_0x310621[_0xca14('0x5a')][_0xca14('0x60')])return;return db[_0xca14('0x71')][_0xca14('0x57')]({'where':{'id':_0x310621[_0xca14('0x5a')]['UserId'],'role':_0xca14('0x61')},'attributes':['id','name','fullname',_0xca14('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4efeca){if(!_0x4efeca)return null;_0x824870[_0xca14('0x27')]['agent']=_0x4efeca;return _0x824870;})[_0xca14('0x20')](function(_0x2f58d1){if(_0x2f58d1){if(_0x310621[_0xca14('0x5a')][_0xca14('0x73')]){_0x824870[_0xca14('0x27')]['interface']=util[_0xca14('0x5e')](_0xca14('0x74'),_0x310621[_0xca14('0x75')][_0xca14('0x36')]);_0x824870['message'][_0xca14('0x76')]=_0x824870[_0xca14('0x76')];_0x824870['message'][_0xca14('0x77')]=_0x824870[_0xca14('0x76')];_0x824870[_0xca14('0x27')]['event']=_0xca14('0x5d');return respondWithRpcPromise(_0xca14('0x78'),'EventManager',{'event':_0xca14('0x79'),'message':_0x824870[_0xca14('0x27')]},client9002)[_0xca14('0x20')](function(){return _0x824870;});}return _0x824870;}return null;})['then'](respondWithResult(_0x2d0729,null))['catch'](handleError(_0x2d0729,null));};var interaction_log=require(_0xca14('0x12'))(_0xca14('0x7a'));exports[_0xca14('0x34')]=function(_0x1253cb,_0x1b3458,_0x149f28){var _0x45404c={'agent':{},'channel':_0xca14('0x7b')};if(_0x1253cb[_0xca14('0x5a')]['id']){delete _0x1253cb[_0xca14('0x5a')]['id'];}_0x1253cb[_0xca14('0x5a')]['UserId']=_0x1253cb['body']['UserId']||_0x1253cb[_0xca14('0x75')]['id'];_0x45404c[_0xca14('0x61')]['id']=_0x1253cb[_0xca14('0x5a')][_0xca14('0x60')];return db['WhatsappMessage'][_0xca14('0x57')]({'where':{'id':_0x1253cb[_0xca14('0x54')]['id'],'UserId':null}})[_0xca14('0x20')](handleEntityNotFound(_0x1b3458,null))[_0xca14('0x20')](function(_0x4f9421){if(_0x4f9421){_0x45404c[_0xca14('0x27')]=_0x4f9421[_0xca14('0x66')]({'plain':!![]});return db[_0xca14('0x62')][_0xca14('0x57')]({'where':{'id':_0x4f9421[_0xca14('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x1b3458,null))[_0xca14('0x20')](function(_0x219d47){if(_0x219d47){_0x45404c[_0xca14('0x65')]=_0x219d47[_0xca14('0x66')]({'plain':!![]});interaction_log[_0xca14('0x28')](_0xca14('0x7d'),_0x1253cb[_0xca14('0x75')]['id'],_0x1253cb[_0xca14('0x75')][_0xca14('0x36')],_0x1253cb[_0xca14('0x75')][_0xca14('0x68')],_0x45404c['interaction']['id'],_0x1253cb[_0xca14('0x5a')]?JSON[_0xca14('0x24')](_0x1253cb[_0xca14('0x5a')]):'null');return respondWithRpcPromise(_0xca14('0x7e'),_0xca14('0x7f'),_0x45404c);}return null;})[_0xca14('0x20')](function(_0x13285f){var _0x479d6c=_0xca14('0x6b')+_0x13285f[_0xca14('0x27')][_0xca14('0x6c')];return db[_0xca14('0x6d')]['query'](_0x479d6c,{'type':db[_0xca14('0x6e')][_0xca14('0x6f')][_0xca14('0x80')],'raw':!![]})['then'](function(_0x4b8e80){return _0x4b8e80;});})['then'](function(_0x3426af){if(_0x3426af){_0x45404c[_0xca14('0x27')][_0xca14('0x70')]=_0x3426af[0x0];if(!_0x1253cb['body']['UserId'])return;return db[_0xca14('0x71')]['find']({'where':{'id':_0x1253cb[_0xca14('0x5a')][_0xca14('0x60')],'role':_0xca14('0x61')},'attributes':['id',_0xca14('0x36'),_0xca14('0x81'),_0xca14('0x72'),_0xca14('0x82')],'raw':!![]});}return null;})[_0xca14('0x20')](function(_0x2156b1){if(!_0x2156b1)return null;_0x45404c['message']['agent']=_0x2156b1;return _0x45404c;})[_0xca14('0x20')](function(_0x4c83cc){if(_0x4c83cc){_0x4c83cc[_0xca14('0x27')][_0xca14('0x83')]=util[_0xca14('0x5e')](_0xca14('0x74'),_0x1253cb[_0xca14('0x75')]['name']);_0x4c83cc[_0xca14('0x27')]['channel']=_0x45404c[_0xca14('0x76')];_0x4c83cc[_0xca14('0x27')][_0xca14('0x77')]=_0x45404c[_0xca14('0x76')];_0x4c83cc[_0xca14('0x27')][_0xca14('0x84')]=_0xca14('0x34');respondWithRpcPromise(_0xca14('0x78'),_0xca14('0x78'),{'event':'rejectmessage','message':_0x4c83cc[_0xca14('0x27')]},client9002);return _0x45404c;}return null;})[_0xca14('0x20')](respondWithResult(_0x1b3458,null))['catch'](handleError(_0x1b3458,null));};exports[_0xca14('0x2b')]=function(_0x421b1e,_0x49763d,_0x28cee4){if(_0x421b1e[_0xca14('0x5a')]['id']){delete _0x421b1e[_0xca14('0x5a')]['id'];}var _0x2bd742;return db[_0xca14('0x39')][_0xca14('0x57')]({'where':{'id':_0x421b1e['params']['id']}})[_0xca14('0x20')](handleEntityNotFound(_0x49763d,null))[_0xca14('0x20')](function(_0x365bc8){if(_0x365bc8){_0x2bd742=_0x365bc8;return db[_0xca14('0x85')][_0xca14('0x57')]({'where':{'id':_0x365bc8[_0xca14('0x86')]}});}})[_0xca14('0x20')](handleEntityNotFound(_0x49763d,null))[_0xca14('0x20')](function(_0x1c3b70){if(_0x1c3b70){logger[_0xca14('0x22')](_0xca14('0x87'),_0xca14('0x2b'),_0xca14('0x88'),_0x1c3b70[_0xca14('0x3b')],util[_0xca14('0x89')](_0x421b1e[_0xca14('0x5a')],{'showHidden':![],'depth':null}));switch(_0x1c3b70[_0xca14('0x3b')]){case'twilio':if(_0x421b1e[_0xca14('0x5a')][_0xca14('0x8a')]&&_0x421b1e[_0xca14('0x5a')][_0xca14('0x8a')]===_0x2bd742[_0xca14('0x8b')]&&_0x421b1e[_0xca14('0x5a')][_0xca14('0x8c')]&&_0x421b1e['body']['MessageStatus']===_0xca14('0x8d')){return _0x2bd742[_0xca14('0x59')]({'read':!![]});}else{logger[_0xca14('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xca14('0x2b'),_0xca14('0x8e'),util[_0xca14('0x89')](_0x421b1e[_0xca14('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2bd742;}})[_0xca14('0x20')](respondWithResult(_0x49763d,null))[_0xca14('0x52')](handleError(_0x49763d,null));}; \ No newline at end of file +var _0x7a5d=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','email','internal','manual','channel','motionChannel','event','accept','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','User','fullname','SIP/%s','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','find','create','body','params','describe','../../config/logger','whatsapp-interactions','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null'];(function(_0x49e6ee,_0x36baf5){var _0x589568=function(_0x29a1dd){while(--_0x29a1dd){_0x49e6ee['push'](_0x49e6ee['shift']());}};_0x589568(++_0x36baf5);}(_0x7a5d,0xa1));var _0xd7a5=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7a5d[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xd7a5('0x0'));var rimraf=require(_0xd7a5('0x1'));var zipdir=require(_0xd7a5('0x2'));var jsonpatch=require(_0xd7a5('0x3'));var rp=require(_0xd7a5('0x4'));var moment=require(_0xd7a5('0x5'));var BPromise=require(_0xd7a5('0x6'));var Mustache=require('mustache');var util=require(_0xd7a5('0x7'));var path=require(_0xd7a5('0x8'));var sox=require('sox');var csv=require(_0xd7a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd7a5('0xa'));var _=require(_0xd7a5('0xb'));var squel=require(_0xd7a5('0xc'));var crypto=require(_0xd7a5('0xd'));var jsforce=require(_0xd7a5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd7a5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd7a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd7a5('0x10'));var as=require(_0xd7a5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd7a5('0x12'));var utils=require(_0xd7a5('0x13'));var config=require(_0xd7a5('0x14'));var licenseUtil=require(_0xd7a5('0x15'));var db=require(_0xd7a5('0x16'))['db'];config[_0xd7a5('0x17')]=_[_0xd7a5('0x18')](config[_0xd7a5('0x17')],{'host':_0xd7a5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd7a5('0x1a'))[_0xd7a5('0x1b')](socket);var jayson=require(_0xd7a5('0x1c'));var client=jayson[_0xd7a5('0x1d')][_0xd7a5('0x1e')]({'port':0x232c});var client9002=jayson[_0xd7a5('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c45e5,_0x5f2422,_0x2cc136,_0x358e32){return new BPromise(function(_0xa7e954,_0x4de7e1){var _0x571cb7=_0x358e32||client;return _0x571cb7['request'](_0x5c45e5,_0x2cc136)[_0xd7a5('0x1f')](function(_0x1fe369){logger[_0xd7a5('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x5f2422,_0xd7a5('0x21'));logger[_0xd7a5('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5f2422,'request\x20sent',JSON[_0xd7a5('0x23')](_0x1fe369));if(_0x1fe369[_0xd7a5('0x24')]){if(_0x1fe369['error'][_0xd7a5('0x25')]===0x1f4){logger[_0xd7a5('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x5f2422,_0x1fe369[_0xd7a5('0x24')]['message']);return _0x4de7e1(_0x1fe369['error']['message']);}logger['error'](_0xd7a5('0x26'),_0x5f2422,_0x1fe369[_0xd7a5('0x24')][_0xd7a5('0x27')]);return _0xa7e954(_0x1fe369[_0xd7a5('0x24')][_0xd7a5('0x27')]);}else{logger[_0xd7a5('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x5f2422,_0xd7a5('0x21'));_0xa7e954(_0x1fe369[_0xd7a5('0x28')][_0xd7a5('0x27')]);}})['catch'](function(_0x404cc0){logger[_0xd7a5('0x24')](_0xd7a5('0x26'),_0x5f2422,_0x404cc0);_0x4de7e1(_0x404cc0);});});}function respondWithStatusCode(_0x10af4d,_0x19ebcf){_0x19ebcf=_0x19ebcf||0xcc;return function(_0x62067e){if(_0x62067e){return _0x10af4d[_0xd7a5('0x29')](_0x19ebcf);}return _0x10af4d[_0xd7a5('0x2a')](_0x19ebcf)[_0xd7a5('0x2b')]();};}function respondWithResult(_0x125df1,_0x5a782b){_0x5a782b=_0x5a782b||0xc8;return function(_0x2e02e1){if(_0x2e02e1){return _0x125df1['status'](_0x5a782b)[_0xd7a5('0x2c')](_0x2e02e1);}};}function respondWithFilteredResult(_0x485d23,_0x1c69d6){return function(_0x3b7011){if(_0x3b7011){var _0xaac479=typeof _0x1c69d6[_0xd7a5('0x2d')]===_0xd7a5('0x2e')&&typeof _0x1c69d6[_0xd7a5('0x2f')]===_0xd7a5('0x2e');var _0x11614d=_0x3b7011['count'];var _0x5d3427=_0xaac479?0x0:_0x1c69d6[_0xd7a5('0x2d')];var _0x105247=_0xaac479?_0x3b7011[_0xd7a5('0x30')]:_0x1c69d6[_0xd7a5('0x2d')]+_0x1c69d6[_0xd7a5('0x2f')];var _0x11077a;if(_0x105247>=_0x11614d){_0x105247=_0x11614d;_0x11077a=0xc8;}else{_0x11077a=0xce;}_0x485d23['status'](_0x11077a);return _0x485d23['set'](_0xd7a5('0x31'),_0x5d3427+'-'+_0x105247+'/'+_0x11614d)['json'](_0x3b7011);}return null;};}function patchUpdates(_0x5eb6c6){return function(_0x542ff8){try{jsonpatch[_0xd7a5('0x32')](_0x542ff8,_0x5eb6c6,!![]);}catch(_0x968f2){return BPromise[_0xd7a5('0x33')](_0x968f2);}return _0x542ff8[_0xd7a5('0x34')]();};}function saveUpdates(_0x47bf3c,_0x446b8b){return function(_0x4fb7b2){if(_0x4fb7b2){return _0x4fb7b2[_0xd7a5('0x35')](_0x47bf3c)['then'](function(_0x33fa33){return _0x33fa33;});}return null;};}function removeEntity(_0x3c67a3,_0x5ef1d5){return function(_0x25c8a9){if(_0x25c8a9){return _0x25c8a9[_0xd7a5('0x36')]()[_0xd7a5('0x1f')](function(){_0x3c67a3[_0xd7a5('0x2a')](0xcc)[_0xd7a5('0x2b')]();});}};}function handleEntityNotFound(_0x526ae3,_0x1260dd){return function(_0x5bb9eb){if(!_0x5bb9eb){_0x526ae3[_0xd7a5('0x29')](0x194);}return _0x5bb9eb;};}function handleError(_0x5eede9,_0x21c129){_0x21c129=_0x21c129||0x1f4;return function(_0x2bc60c){logger['error'](_0x2bc60c[_0xd7a5('0x37')]);if(_0x2bc60c['name']){delete _0x2bc60c[_0xd7a5('0x38')];}_0x5eede9[_0xd7a5('0x2a')](_0x21c129)[_0xd7a5('0x39')](_0x2bc60c);};}exports[_0xd7a5('0x3a')]=function(_0x47be84,_0x1ab057){var _0x1333ce={},_0x21c74c={},_0x2f93ca={'count':0x0,'rows':[]};var _0x270f28=_[_0xd7a5('0x3b')](db[_0xd7a5('0x3c')][_0xd7a5('0x3d')],function(_0x310cfa){return{'name':_0x310cfa['fieldName'],'type':_0x310cfa[_0xd7a5('0x3e')][_0xd7a5('0x3f')]};});_0x21c74c[_0xd7a5('0x40')]=_[_0xd7a5('0x3b')](_0x270f28,_0xd7a5('0x38'));_0x21c74c[_0xd7a5('0x41')]=_[_0xd7a5('0x42')](_0x47be84[_0xd7a5('0x41')]);_0x21c74c[_0xd7a5('0x43')]=_[_0xd7a5('0x44')](_0x21c74c[_0xd7a5('0x40')],_0x21c74c[_0xd7a5('0x41')]);_0x1333ce['attributes']=_[_0xd7a5('0x44')](_0x21c74c[_0xd7a5('0x40')],qs['fields'](_0x47be84[_0xd7a5('0x41')][_0xd7a5('0x45')]));_0x1333ce[_0xd7a5('0x46')]=_0x1333ce['attributes'][_0xd7a5('0x47')]?_0x1333ce[_0xd7a5('0x46')]:_0x21c74c['model'];if(!_0x47be84['query'][_0xd7a5('0x48')]('nolimit')){_0x1333ce[_0xd7a5('0x2f')]=qs[_0xd7a5('0x2f')](_0x47be84[_0xd7a5('0x41')][_0xd7a5('0x2f')]);_0x1333ce[_0xd7a5('0x2d')]=qs['offset'](_0x47be84['query'][_0xd7a5('0x2d')]);}_0x1333ce[_0xd7a5('0x49')]=qs['sort'](_0x47be84['query'][_0xd7a5('0x4a')]);_0x1333ce[_0xd7a5('0x4b')]=qs[_0xd7a5('0x43')](_['pick'](_0x47be84[_0xd7a5('0x41')],_0x21c74c[_0xd7a5('0x43')]),_0x270f28);if(_0x47be84[_0xd7a5('0x41')][_0xd7a5('0x4c')]){_0x1333ce[_0xd7a5('0x4b')]=_['merge'](_0x1333ce[_0xd7a5('0x4b')],{'$or':_[_0xd7a5('0x3b')](_0x270f28,function(_0x56dba4){if(_0x56dba4[_0xd7a5('0x3e')]!==_0xd7a5('0x4d')){var _0xca62a4={};_0xca62a4[_0x56dba4[_0xd7a5('0x38')]]={'$like':'%'+_0x47be84['query'][_0xd7a5('0x4c')]+'%'};return _0xca62a4;}})});}_0x1333ce=_[_0xd7a5('0x4e')]({},_0x1333ce,_0x47be84[_0xd7a5('0x4f')]);var _0x2254b7={'where':_0x1333ce[_0xd7a5('0x4b')]};return db[_0xd7a5('0x3c')]['count'](_0x2254b7)[_0xd7a5('0x1f')](function(_0x113402){_0x2f93ca['count']=_0x113402;if(_0x47be84[_0xd7a5('0x41')][_0xd7a5('0x50')]){_0x1333ce[_0xd7a5('0x51')]=[{'all':!![]}];}return db[_0xd7a5('0x3c')]['findAll'](_0x1333ce);})[_0xd7a5('0x1f')](function(_0x299d69){_0x2f93ca[_0xd7a5('0x52')]=_0x299d69;return _0x2f93ca;})[_0xd7a5('0x1f')](respondWithFilteredResult(_0x1ab057,_0x1333ce))[_0xd7a5('0x53')](handleError(_0x1ab057,null));};exports['show']=function(_0x339e4c,_0x4a5d68){var _0x430644={'raw':!![],'where':{'id':_0x339e4c['params']['id']}},_0x304738={};_0x304738['model']=_[_0xd7a5('0x42')](db['WhatsappMessage']['rawAttributes']);_0x304738[_0xd7a5('0x41')]=_[_0xd7a5('0x42')](_0x339e4c[_0xd7a5('0x41')]);_0x304738['filters']=_[_0xd7a5('0x44')](_0x304738[_0xd7a5('0x40')],_0x304738[_0xd7a5('0x41')]);_0x430644[_0xd7a5('0x46')]=_[_0xd7a5('0x44')](_0x304738[_0xd7a5('0x40')],qs[_0xd7a5('0x45')](_0x339e4c[_0xd7a5('0x41')][_0xd7a5('0x45')]));_0x430644[_0xd7a5('0x46')]=_0x430644[_0xd7a5('0x46')][_0xd7a5('0x47')]?_0x430644[_0xd7a5('0x46')]:_0x304738['model'];if(_0x339e4c[_0xd7a5('0x41')][_0xd7a5('0x50')]){_0x430644[_0xd7a5('0x51')]=[{'all':!![]}];}_0x430644=_[_0xd7a5('0x4e')]({},_0x430644,_0x339e4c[_0xd7a5('0x4f')]);return db[_0xd7a5('0x3c')][_0xd7a5('0x54')](_0x430644)[_0xd7a5('0x1f')](handleEntityNotFound(_0x4a5d68,null))['then'](respondWithResult(_0x4a5d68,null))[_0xd7a5('0x53')](handleError(_0x4a5d68,null));};exports['create']=function(_0x552af6,_0x377d18){return db['WhatsappMessage'][_0xd7a5('0x55')](_0x552af6['body'],{})[_0xd7a5('0x1f')](respondWithResult(_0x377d18,0xc9))[_0xd7a5('0x53')](handleError(_0x377d18,null));};exports[_0xd7a5('0x35')]=function(_0x1ae4b6,_0x5c2d4e){if(_0x1ae4b6['body']['id']){delete _0x1ae4b6[_0xd7a5('0x56')]['id'];}return db[_0xd7a5('0x3c')][_0xd7a5('0x54')]({'where':{'id':_0x1ae4b6[_0xd7a5('0x57')]['id']}})[_0xd7a5('0x1f')](handleEntityNotFound(_0x5c2d4e,null))[_0xd7a5('0x1f')](saveUpdates(_0x1ae4b6[_0xd7a5('0x56')],null))['then'](respondWithResult(_0x5c2d4e,null))[_0xd7a5('0x53')](handleError(_0x5c2d4e,null));};exports[_0xd7a5('0x36')]=function(_0x2a63d1,_0x5ce580){return db['WhatsappMessage'][_0xd7a5('0x54')]({'where':{'id':_0x2a63d1[_0xd7a5('0x57')]['id']}})[_0xd7a5('0x1f')](handleEntityNotFound(_0x5ce580,null))[_0xd7a5('0x1f')](removeEntity(_0x5ce580,null))[_0xd7a5('0x53')](handleError(_0x5ce580,null));};exports[_0xd7a5('0x58')]=function(_0x1057c3,_0x5cb3f3){return db[_0xd7a5('0x3c')][_0xd7a5('0x58')]()[_0xd7a5('0x1f')](respondWithResult(_0x5cb3f3,null))['catch'](handleError(_0x5cb3f3,null));};var interaction_log=require(_0xd7a5('0x59'))(_0xd7a5('0x5a'));exports['accept']=function(_0xdd2055,_0x11d357,_0xa6ffbc){var _0x2a1b60={'agent':{},'channel':_0xd7a5('0x5b')};if(_0xdd2055[_0xd7a5('0x56')]['id']){delete _0xdd2055['body']['id'];}_0xdd2055[_0xd7a5('0x56')][_0xd7a5('0x5c')]=!![];_0xdd2055[_0xd7a5('0x56')]['readAt']=moment()[_0xd7a5('0x5d')](_0xd7a5('0x5e'));_0xdd2055[_0xd7a5('0x56')]['UserId']=_0xdd2055[_0xd7a5('0x56')][_0xd7a5('0x5f')]||_0xdd2055['user']['id'];_0x2a1b60[_0xd7a5('0x60')]['id']=_0xdd2055[_0xd7a5('0x56')][_0xd7a5('0x5f')];return db[_0xd7a5('0x3c')][_0xd7a5('0x54')]({'where':{'id':_0xdd2055[_0xd7a5('0x57')]['id'],'UserId':null}})[_0xd7a5('0x1f')](handleEntityNotFound(_0x11d357,null))[_0xd7a5('0x1f')](saveUpdates(_0xdd2055['body'],null))['then'](function(_0x53cdf7){if(_0x53cdf7){_0x2a1b60[_0xd7a5('0x27')]=_0x53cdf7[_0xd7a5('0x61')]({'plain':!![]});return db[_0xd7a5('0x62')]['find']({'where':{'id':_0x53cdf7[_0xd7a5('0x63')]}});}return null;})[_0xd7a5('0x1f')](handleEntityNotFound(_0x11d357,null))[_0xd7a5('0x1f')](function(_0x4ea80e){if(_0x4ea80e){return _0x4ea80e[_0xd7a5('0x35')]({'UserId':_0xdd2055[_0xd7a5('0x56')][_0xd7a5('0x5f')],'read1stAt':_[_0xd7a5('0x64')](_0x4ea80e[_0xd7a5('0x65')])?moment()[_0xd7a5('0x5d')](_0xd7a5('0x5e')):undefined});}return null;})['then'](function(_0x2c0c81){if(_0x2c0c81){_0x2a1b60[_0xd7a5('0x66')]=_0x2c0c81[_0xd7a5('0x61')]({'plain':!![]});interaction_log[_0xd7a5('0x20')](_0xd7a5('0x67'),_0xdd2055[_0xd7a5('0x68')]['id'],_0xdd2055[_0xd7a5('0x68')][_0xd7a5('0x38')],_0xdd2055[_0xd7a5('0x68')][_0xd7a5('0x69')],_0x2a1b60[_0xd7a5('0x66')]['id'],_0xdd2055[_0xd7a5('0x56')]?JSON[_0xd7a5('0x23')](_0xdd2055[_0xd7a5('0x56')]):_0xd7a5('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xd7a5('0x6b'),_0x2a1b60);}return null;})[_0xd7a5('0x1f')](function(_0x4c238a){var _0xca63e0=_0xd7a5('0x6c')+_0x4c238a[_0xd7a5('0x27')][_0xd7a5('0x6d')];return db[_0xd7a5('0x6e')][_0xd7a5('0x41')](_0xca63e0,{'type':db[_0xd7a5('0x6f')]['QueryTypes'][_0xd7a5('0x70')],'raw':!![]})[_0xd7a5('0x1f')](function(_0x5f2c5a){return _0x5f2c5a;});})[_0xd7a5('0x1f')](function(_0x89b086){if(_0x89b086){_0x2a1b60['message']['contact']=_0x89b086[0x0];if(!_0xdd2055[_0xd7a5('0x56')][_0xd7a5('0x5f')])return;return db['User'][_0xd7a5('0x54')]({'where':{'id':_0xdd2055['body']['UserId'],'role':_0xd7a5('0x60')},'attributes':['id','name','fullname',_0xd7a5('0x71'),_0xd7a5('0x72')],'raw':!![]});}return null;})['then'](function(_0x55af38){if(!_0x55af38)return null;_0x2a1b60['message'][_0xd7a5('0x60')]=_0x55af38;return _0x2a1b60;})[_0xd7a5('0x1f')](function(_0x480c8d){if(_0x480c8d){if(_0xdd2055['body'][_0xd7a5('0x73')]){_0x2a1b60['message']['interface']=util[_0xd7a5('0x5d')]('SIP/%s',_0xdd2055['user'][_0xd7a5('0x38')]);_0x2a1b60['message'][_0xd7a5('0x74')]=_0x2a1b60[_0xd7a5('0x74')];_0x2a1b60[_0xd7a5('0x27')][_0xd7a5('0x75')]=_0x2a1b60['channel'];_0x2a1b60[_0xd7a5('0x27')][_0xd7a5('0x76')]=_0xd7a5('0x77');return respondWithRpcPromise('EventManager',_0xd7a5('0x78'),{'event':'acceptmessage','message':_0x2a1b60[_0xd7a5('0x27')]},client9002)[_0xd7a5('0x1f')](function(){return _0x2a1b60;});}return _0x2a1b60;}return null;})[_0xd7a5('0x1f')](respondWithResult(_0x11d357,null))[_0xd7a5('0x53')](handleError(_0x11d357,null));};var interaction_log=require(_0xd7a5('0x59'))(_0xd7a5('0x5a'));exports[_0xd7a5('0x33')]=function(_0x51804c,_0x211a9c,_0x1eef84){var _0x579f05={'agent':{},'channel':_0xd7a5('0x5b')};if(_0x51804c['body']['id']){delete _0x51804c['body']['id'];}_0x51804c[_0xd7a5('0x56')][_0xd7a5('0x5f')]=_0x51804c[_0xd7a5('0x56')][_0xd7a5('0x5f')]||_0x51804c[_0xd7a5('0x68')]['id'];_0x579f05[_0xd7a5('0x60')]['id']=_0x51804c[_0xd7a5('0x56')][_0xd7a5('0x5f')];return db[_0xd7a5('0x3c')]['find']({'where':{'id':_0x51804c[_0xd7a5('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x211a9c,null))[_0xd7a5('0x1f')](function(_0x6ea0af){if(_0x6ea0af){_0x579f05['message']=_0x6ea0af[_0xd7a5('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0xd7a5('0x54')]({'where':{'id':_0x6ea0af[_0xd7a5('0x63')]}});}return null;})[_0xd7a5('0x1f')](handleEntityNotFound(_0x211a9c,null))['then'](function(_0x17bae9){if(_0x17bae9){_0x579f05[_0xd7a5('0x66')]=_0x17bae9[_0xd7a5('0x61')]({'plain':!![]});interaction_log['info'](_0xd7a5('0x79'),_0x51804c[_0xd7a5('0x68')]['id'],_0x51804c[_0xd7a5('0x68')][_0xd7a5('0x38')],_0x51804c[_0xd7a5('0x68')][_0xd7a5('0x69')],_0x579f05['interaction']['id'],_0x51804c[_0xd7a5('0x56')]?JSON[_0xd7a5('0x23')](_0x51804c[_0xd7a5('0x56')]):_0xd7a5('0x6a'));return respondWithRpcPromise(_0xd7a5('0x7a'),'rejectMessage',_0x579f05);}return null;})[_0xd7a5('0x1f')](function(_0x3b1122){var _0x21bbc3=_0xd7a5('0x6c')+_0x3b1122[_0xd7a5('0x27')][_0xd7a5('0x6d')];return db['sequelize'][_0xd7a5('0x41')](_0x21bbc3,{'type':db[_0xd7a5('0x6f')][_0xd7a5('0x7b')][_0xd7a5('0x70')],'raw':!![]})['then'](function(_0x3755b1){return _0x3755b1;});})[_0xd7a5('0x1f')](function(_0x4d99d3){if(_0x4d99d3){_0x579f05[_0xd7a5('0x27')]['contact']=_0x4d99d3[0x0];if(!_0x51804c[_0xd7a5('0x56')][_0xd7a5('0x5f')])return;return db[_0xd7a5('0x7c')][_0xd7a5('0x54')]({'where':{'id':_0x51804c['body'][_0xd7a5('0x5f')],'role':'agent'},'attributes':['id',_0xd7a5('0x38'),_0xd7a5('0x7d'),'email',_0xd7a5('0x72')],'raw':!![]});}return null;})[_0xd7a5('0x1f')](function(_0x353ed0){if(!_0x353ed0)return null;_0x579f05[_0xd7a5('0x27')]['agent']=_0x353ed0;return _0x579f05;})[_0xd7a5('0x1f')](function(_0x3ad59b){if(_0x3ad59b){_0x3ad59b['message']['interface']=util[_0xd7a5('0x5d')](_0xd7a5('0x7e'),_0x51804c['user'][_0xd7a5('0x38')]);_0x3ad59b['message']['channel']=_0x579f05[_0xd7a5('0x74')];_0x3ad59b['message'][_0xd7a5('0x75')]=_0x579f05[_0xd7a5('0x74')];_0x3ad59b[_0xd7a5('0x27')][_0xd7a5('0x76')]=_0xd7a5('0x33');respondWithRpcPromise(_0xd7a5('0x78'),_0xd7a5('0x78'),{'event':'rejectmessage','message':_0x3ad59b[_0xd7a5('0x27')]},client9002);return _0x579f05;}return null;})['then'](respondWithResult(_0x211a9c,null))['catch'](handleError(_0x211a9c,null));};exports['status']=function(_0x20f907,_0xde3347,_0x593c74){if(_0x20f907['body']['id']){delete _0x20f907[_0xd7a5('0x56')]['id'];}var _0x375df8;return db[_0xd7a5('0x3c')][_0xd7a5('0x54')]({'where':{'id':_0x20f907[_0xd7a5('0x57')]['id']}})['then'](handleEntityNotFound(_0xde3347,null))['then'](function(_0x1890c2){if(_0x1890c2){_0x375df8=_0x1890c2;return db[_0xd7a5('0x7f')][_0xd7a5('0x54')]({'where':{'id':_0x1890c2['WhatsappAccountId']}});}})[_0xd7a5('0x1f')](handleEntityNotFound(_0xde3347,null))['then'](function(_0x1a8bb7){if(_0x1a8bb7){logger[_0xd7a5('0x22')](_0xd7a5('0x80'),_0xd7a5('0x2a'),_0xd7a5('0x81'),_0x1a8bb7[_0xd7a5('0x3e')],util[_0xd7a5('0x82')](_0x20f907['body'],{'showHidden':![],'depth':null}));switch(_0x1a8bb7[_0xd7a5('0x3e')]){case _0xd7a5('0x83'):if(_0x20f907[_0xd7a5('0x56')][_0xd7a5('0x84')]&&_0x20f907[_0xd7a5('0x56')][_0xd7a5('0x84')]===_0x375df8['messageId']&&_0x20f907['body'][_0xd7a5('0x85')]&&_0x20f907[_0xd7a5('0x56')][_0xd7a5('0x85')]===_0xd7a5('0x5c')){return _0x375df8[_0xd7a5('0x35')]({'read':!![]});}else{logger[_0xd7a5('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xd7a5('0x2a'),_0xd7a5('0x83'),util['inspect'](_0x20f907[_0xd7a5('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x375df8;}})[_0xd7a5('0x1f')](respondWithResult(_0xde3347,null))['catch'](handleError(_0xde3347,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2c5be95..1e58730 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 _0x6215=['events','../../mysqldb','WhatsappMessage','save','update','remove','hook','exports'];(function(_0x200834,_0x33ed16){var _0x582388=function(_0x204fb6){while(--_0x204fb6){_0x200834['push'](_0x200834['shift']());}};_0x582388(++_0x33ed16);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5621('0x0'));var WhatsappMessage=require(_0x5621('0x1'))['db'][_0x5621('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5621('0x3'),'afterUpdate':_0x5621('0x4'),'afterDestroy':_0x5621('0x5')};function emitEvent(_0x173213){return function(_0x204284,_0x13397a,_0x492c6d){WhatsappMessageEvents['emit'](_0x173213+':'+_0x204284['id'],_0x204284);WhatsappMessageEvents['emit'](_0x173213,_0x204284);_0x492c6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x5621('0x6')](e,emitEvent(event));}}module[_0x5621('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb248=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','WhatsappMessage'];(function(_0x28feea,_0x4c5c94){var _0x388762=function(_0x46a42b){while(--_0x46a42b){_0x28feea['push'](_0x28feea['shift']());}};_0x388762(++_0x4c5c94);}(_0xb248,0xc6));var _0x8b24=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb248[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0x8b24('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x8b24('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8b24('0x2')](0x0);var events={'afterCreate':_0x8b24('0x3'),'afterUpdate':_0x8b24('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ea760){return function(_0x4438f7,_0x5d4103,_0x253441){WhatsappMessageEvents[_0x8b24('0x5')](_0x1ea760+':'+_0x4438f7['id'],_0x4438f7);WhatsappMessageEvents['emit'](_0x1ea760,_0x4438f7);_0x253441(null);};}for(var e in events){if(events[_0x8b24('0x6')](e)){var event=events[e];WhatsappMessage[_0x8b24('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index f27ebb2..1a6876e 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 _0x1f93=['path','rimraf','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','toLowerCase','out','secret','UserId','WhatsappInteraction','then','update','createdAt','direction','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','node-fetch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f93,0x112));var _0x31f9=function(_0x31bf12,_0x4d3b14){_0x31bf12=_0x31bf12-0x0;var _0x12e1d4=_0x1f93[_0x31bf12];return _0x12e1d4;};'use strict';var _=require(_0x31f9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31f9('0x1'));var moment=require(_0x31f9('0x2'));var BPromise=require(_0x31f9('0x3'));var rp=require(_0x31f9('0x4'));var fetch=require(_0x31f9('0x5'));var fs=require('fs');var path=require(_0x31f9('0x6'));var rimraf=require(_0x31f9('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x31f9('0x8')]=function(_0x332e7c,_0x1e514d){return _0x332e7c[_0x31f9('0x9')](_0x31f9('0xa'),attributes,{'tableName':_0x31f9('0xb'),'paranoid':![],'indexes':[{'name':_0x31f9('0xc'),'fields':[_0x31f9('0xc')]},{'name':_0x31f9('0xd'),'fields':[_0x31f9('0xe')],'type':_0x31f9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x336020,_0x1e635c,_0x56898e){var _0x26ea60=_0x332e7c['models'];var _0x301553=_0x336020[_0x31f9('0x10')]({'plain':!![]});if(_0x301553['direction'][_0x31f9('0x11')]()==='in'||_0x301553['direction'][_0x31f9('0x11')]()===_0x31f9('0x12')&&!_0x301553[_0x31f9('0x13')]&&!_['isNil'](_0x301553[_0x31f9('0x14')])){_0x26ea60[_0x31f9('0x15')]['findOne']({'where':{'id':_0x301553['WhatsappInteractionId']}})[_0x31f9('0x16')](function(_0x1b2997){if(_0x1b2997){_0x1b2997[_0x31f9('0x17')]({'lastMsgAt':_0x301553[_0x31f9('0x18')],'lastMsgDirection':_0x301553[_0x31f9('0x19')][_0x31f9('0x11')]()});}})[_0x31f9('0x1a')](function(_0x523af8){console[_0x31f9('0x1b')](_0x523af8);});}if(_0x301553[_0x31f9('0x19')]===_0x31f9('0x12')&&!_0x301553[_0x31f9('0x13')]){var _0xdf302d;_0x26ea60[_0x31f9('0x1c')]['find']({'where':{'id':_0x301553[_0x31f9('0x1d')]},'raw':!![]})['then'](function(_0x538de6){_0xdf302d=_0x538de6;if(_0xdf302d&&_0xdf302d[_0x31f9('0x1e')]){switch(_0xdf302d[_0x31f9('0x1e')]){case _0x31f9('0x1f'):var _0x345a7d=require('twilio');if(_0xdf302d[_0x31f9('0x20')]&&_0xdf302d[_0x31f9('0x21')]&&_0xdf302d[_0x31f9('0x22')]){var _0x33fdf1=new _0x345a7d(_0xdf302d[_0x31f9('0x20')],_0xdf302d['authToken']);_0x33fdf1['messages']['create']({'body':_0x301553[_0x31f9('0xe')],'to':'whatsapp:'+_0x301553[_0x31f9('0x22')],'from':_0x31f9('0x23')+_0xdf302d[_0x31f9('0x22')],'statusCallback':_0xdf302d[_0x31f9('0x24')]+_0x31f9('0x25')+_0x301553['id']+_0x31f9('0x26')+_0xdf302d[_0x31f9('0x27')]})[_0x31f9('0x16')](function(_0x3b9907){if(_0x3b9907[_0x31f9('0x28')]){return _0x336020[_0x31f9('0x17')]({'messageId':_0x3b9907[_0x31f9('0x28')]});}})[_0x31f9('0x1a')](function(_0x3593a4){logger[_0x31f9('0x1b')](_0x31f9('0x29'),_0x31f9('0x2a'),'twilio',util['inspect'](_0x3593a4,{'showHidden':![],'depth':null}));});}else{logger[_0x31f9('0x1b')](_0x31f9('0x29'),_0x31f9('0x2a'),'twilio',_0x31f9('0x2b'));}break;case _0x31f9('0x2c'):var _0x272ef5=_0xdf302d[_0x31f9('0x20')];var _0x562ffc=_0xdf302d[_0x31f9('0x22')];var _0x273e3e=_0xdf302d[_0x31f9('0x21')];var _0x1f1540=_0xdf302d[_0x31f9('0x2d')]+_0x31f9('0x2e')+_0x272ef5+_0x31f9('0x2f');var _0x1bc482={'to':[_0x301553[_0x31f9('0x22')]],'message':{'type':_0x31f9('0x30'),'text':_0x301553['body']}};var _0x5bfed1={'method':_0x31f9('0x31'),'uri':_0x1f1540,'headers':{'Authorization':_0x31f9('0x32')+_0x273e3e,'Content-Type':_0x31f9('0x33')},'body':_0x1bc482,'json':!![]};rp(_0x5bfed1)[_0x31f9('0x16')](function(_0x10cce2){console['log']('LOG\x20~\x20~\x20SEND',_0x10cce2);if(_0x10cce2[_0x31f9('0x34')][0x0][_0x31f9('0x35')]){return _0x336020[_0x31f9('0x17')]({'messageId':_0x10cce2[_0x31f9('0x34')][0x0][_0x31f9('0x35')]});}})[_0x31f9('0x1a')](function(_0x584f00){console['log'](_0x584f00);});break;}}})['finally'](function(){_0x56898e();});}else{_0x56898e();}}},'charset':_0x31f9('0x36'),'collate':_0x31f9('0x37')});}; \ No newline at end of file +var _0xeda2=['secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','out','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','sinch','phone','/whatsapp/v1/','POST','log','LOG\x20~\x20~\x20SEND','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0xc7132d,_0x1a579b){var _0x3093a0=function(_0x21bc26){while(--_0x21bc26){_0xc7132d['push'](_0xc7132d['shift']());}};_0x3093a0(++_0x1a579b);}(_0xeda2,0x181));var _0x2eda=function(_0x58aad3,_0x2a1647){_0x58aad3=_0x58aad3-0x0;var _0x2618d9=_0xeda2[_0x58aad3];return _0x2618d9;};'use strict';var _=require(_0x2eda('0x0'));var util=require(_0x2eda('0x1'));var logger=require(_0x2eda('0x2'))(_0x2eda('0x3'));var moment=require(_0x2eda('0x4'));var BPromise=require(_0x2eda('0x5'));var rp=require('request-promise');var fetch=require(_0x2eda('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2eda('0x7'));var config=require(_0x2eda('0x8'));var attributes=require(_0x2eda('0x9'));module['exports']=function(_0x27d21c,_0x25caf9){return _0x27d21c[_0x2eda('0xa')](_0x2eda('0xb'),attributes,{'tableName':_0x2eda('0xc'),'paranoid':![],'indexes':[{'name':_0x2eda('0xd'),'fields':['messageId']},{'name':_0x2eda('0xe'),'fields':[_0x2eda('0xf')],'type':_0x2eda('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2728fd,_0x18f077,_0x497c25){var _0x25de18=_0x27d21c[_0x2eda('0x11')];var _0x3c25dc=_0x2728fd[_0x2eda('0x12')]({'plain':!![]});if(_0x3c25dc[_0x2eda('0x13')][_0x2eda('0x14')]()==='in'||_0x3c25dc[_0x2eda('0x13')]['toLowerCase']()==='out'&&!_0x3c25dc[_0x2eda('0x15')]&&!_['isNil'](_0x3c25dc[_0x2eda('0x16')])){_0x25de18[_0x2eda('0x17')][_0x2eda('0x18')]({'where':{'id':_0x3c25dc[_0x2eda('0x19')]}})['then'](function(_0xbe0786){if(_0xbe0786){_0xbe0786[_0x2eda('0x1a')]({'lastMsgAt':_0x3c25dc[_0x2eda('0x1b')],'lastMsgDirection':_0x3c25dc[_0x2eda('0x13')][_0x2eda('0x14')]()});}})[_0x2eda('0x1c')](function(_0x306c0b){console[_0x2eda('0x1d')](_0x306c0b);});}if(_0x3c25dc[_0x2eda('0x13')]===_0x2eda('0x1e')&&!_0x3c25dc[_0x2eda('0x15')]){var _0x1bcb03;_0x25de18[_0x2eda('0x1f')]['find']({'where':{'id':_0x3c25dc[_0x2eda('0x20')]},'raw':!![]})[_0x2eda('0x21')](function(_0x36ea49){_0x1bcb03=_0x36ea49;if(_0x1bcb03&&_0x1bcb03[_0x2eda('0x22')]){switch(_0x1bcb03[_0x2eda('0x22')]){case _0x2eda('0x23'):var _0x42613d=require(_0x2eda('0x23'));if(_0x1bcb03[_0x2eda('0x24')]&&_0x1bcb03[_0x2eda('0x25')]&&_0x1bcb03['phone']){var _0x47d091=new _0x42613d(_0x1bcb03[_0x2eda('0x24')],_0x1bcb03[_0x2eda('0x25')]);_0x47d091[_0x2eda('0x26')][_0x2eda('0x27')]({'body':_0x3c25dc[_0x2eda('0xf')],'to':_0x2eda('0x28')+_0x3c25dc['phone'],'from':'whatsapp:'+_0x1bcb03['phone'],'statusCallback':_0x1bcb03[_0x2eda('0x29')]+_0x2eda('0x2a')+_0x3c25dc['id']+_0x2eda('0x2b')+_0x1bcb03['token']})[_0x2eda('0x21')](function(_0x297a29){if(_0x297a29[_0x2eda('0x2c')]){return _0x2728fd[_0x2eda('0x1a')]({'messageId':_0x297a29[_0x2eda('0x2c')]});}})[_0x2eda('0x1c')](function(_0xbcffc8){logger[_0x2eda('0x1d')](_0x2eda('0x2d'),'afterCreate',_0x2eda('0x23'),util[_0x2eda('0x2e')](_0xbcffc8,{'showHidden':![],'depth':null}));});}else{logger[_0x2eda('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2eda('0x23'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x2eda('0x2f'):var _0x544281=_0x1bcb03['accountSid'];var _0x29d196=_0x1bcb03[_0x2eda('0x30')];var _0x43dd0c=_0x1bcb03[_0x2eda('0x25')];var _0x212348=_0x1bcb03['baseUrl']+_0x2eda('0x31')+_0x544281+'/messages/';var _0x453926={'to':[_0x3c25dc['phone']],'message':{'type':'text','text':_0x3c25dc[_0x2eda('0xf')]}};var _0x3e83ff={'method':_0x2eda('0x32'),'uri':_0x212348,'headers':{'Authorization':'Bearer\x20'+_0x43dd0c,'Content-Type':'application/json'},'body':_0x453926,'json':!![]};rp(_0x3e83ff)['then'](function(_0x126bf2){console[_0x2eda('0x33')](_0x2eda('0x34'),_0x126bf2);if(_0x126bf2[_0x2eda('0x35')][0x0][_0x2eda('0x36')]){return _0x2728fd[_0x2eda('0x1a')]({'messageId':_0x126bf2[_0x2eda('0x35')][0x0][_0x2eda('0x36')]});}})[_0x2eda('0x1c')](function(_0x20c8a1){console[_0x2eda('0x33')](_0x20c8a1);});break;}}})[_0x2eda('0x37')](function(){_0x497c25();});}else{_0x497c25();}}},'charset':_0x2eda('0x38'),'collate':_0x2eda('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ec4ab4f..002237a 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 _0xfc74=['CreateWhatsappMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','WhatsappMessage','create','body','raw'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfc74,0x156));var _0x4fc7=function(_0x483008,_0x3735cc){_0x483008=_0x483008-0x0;var _0x1b501f=_0xfc74[_0x483008];return _0x1b501f;};'use strict';var _=require(_0x4fc7('0x0'));var util=require(_0x4fc7('0x1'));var moment=require('moment');var BPromise=require(_0x4fc7('0x2'));var rs=require(_0x4fc7('0x3'));var fs=require('fs');var Redis=require(_0x4fc7('0x4'));var db=require(_0x4fc7('0x5'))['db'];var utils=require(_0x4fc7('0x6'));var logger=require(_0x4fc7('0x7'))(_0x4fc7('0x8'));var config=require(_0x4fc7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4fc7('0xa')]['http']({'port':0x232a});config[_0x4fc7('0xb')]=_['defaults'](config['redis'],{'host':_0x4fc7('0xc'),'port':0x18eb});var socket=require(_0x4fc7('0xd'))(new Redis(config[_0x4fc7('0xb')]));require('./whatsappMessage.socket')[_0x4fc7('0xe')](socket);function respondWithRpcPromise(_0x10209a,_0x5f12dc,_0x4a96cb){return new BPromise(function(_0x15301e,_0x5c29a8){return client[_0x4fc7('0xf')](_0x10209a,_0x4a96cb)[_0x4fc7('0x10')](function(_0xf1d5ca){logger[_0x4fc7('0x11')](_0x4fc7('0x12'),_0x5f12dc,'request\x20sent');logger[_0x4fc7('0x13')](_0x4fc7('0x14'),_0x5f12dc,_0x4fc7('0x15'),JSON['stringify'](_0xf1d5ca));if(_0xf1d5ca[_0x4fc7('0x16')]){if(_0xf1d5ca[_0x4fc7('0x16')]['code']===0x1f4){logger[_0x4fc7('0x16')](_0x4fc7('0x12'),_0x5f12dc,_0xf1d5ca['error']['message']);return _0x5c29a8(_0xf1d5ca['error']['message']);}logger[_0x4fc7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x5f12dc,_0xf1d5ca[_0x4fc7('0x16')][_0x4fc7('0x17')]);return _0x15301e(_0xf1d5ca['error']['message']);}else{logger[_0x4fc7('0x11')](_0x4fc7('0x12'),_0x5f12dc,'request\x20sent');_0x15301e(_0xf1d5ca[_0x4fc7('0x18')]['message']);}})[_0x4fc7('0x19')](function(_0x491e12){logger[_0x4fc7('0x16')](_0x4fc7('0x12'),_0x5f12dc,_0x491e12);_0x5c29a8(_0x491e12);});});}exports['CreateWhatsappMessage']=function(_0x5c1988){var _0x72243a=this;return new Promise(function(_0x4b5751,_0x59ead6){return db[_0x4fc7('0x1a')][_0x4fc7('0x1b')](_0x5c1988[_0x4fc7('0x1c')],{'raw':_0x5c1988['options']?_0x5c1988['options'][_0x4fc7('0x1d')]===undefined?!![]:![]:!![]})[_0x4fc7('0x10')](function(_0x5194d8){logger[_0x4fc7('0x11')](_0x4fc7('0x1e'),_0x5c1988);logger['debug']('CreateWhatsappMessage',_0x5c1988,JSON['stringify'](_0x5194d8));_0x4b5751(_0x5194d8);})[_0x4fc7('0x19')](function(_0x1f0867){logger[_0x4fc7('0x16')](_0x4fc7('0x1e'),_0x1f0867[_0x4fc7('0x17')],_0x5c1988);_0x59ead6(_0x72243a[_0x4fc7('0x16')](0x1f4,_0x1f0867['message']));});});}; \ No newline at end of file +var _0x999e=['redis','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateWhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter'];(function(_0x5e8749,_0x8f8d00){var _0x7a4571=function(_0x43514b){while(--_0x43514b){_0x5e8749['push'](_0x5e8749['shift']());}};_0x7a4571(++_0x8f8d00);}(_0x999e,0x8e));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe999('0x0'));var util=require(_0xe999('0x1'));var moment=require(_0xe999('0x2'));var BPromise=require(_0xe999('0x3'));var rs=require(_0xe999('0x4'));var fs=require('fs');var Redis=require(_0xe999('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe999('0x6'));var config=require(_0xe999('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe999('0x8')][_0xe999('0x9')]({'port':0x232a});config['redis']=_[_0xe999('0xa')](config['redis'],{'host':_0xe999('0xb'),'port':0x18eb});var socket=require(_0xe999('0xc'))(new Redis(config[_0xe999('0xd')]));require('./whatsappMessage.socket')[_0xe999('0xe')](socket);function respondWithRpcPromise(_0x322048,_0x3151a7,_0x1b2814){return new BPromise(function(_0x1097f0,_0xbbccfe){return client[_0xe999('0xf')](_0x322048,_0x1b2814)[_0xe999('0x10')](function(_0x1e8751){logger['info'](_0xe999('0x11'),_0x3151a7,_0xe999('0x12'));logger[_0xe999('0x13')](_0xe999('0x14'),_0x3151a7,_0xe999('0x12'),JSON['stringify'](_0x1e8751));if(_0x1e8751[_0xe999('0x15')]){if(_0x1e8751[_0xe999('0x15')][_0xe999('0x16')]===0x1f4){logger[_0xe999('0x15')](_0xe999('0x11'),_0x3151a7,_0x1e8751[_0xe999('0x15')][_0xe999('0x17')]);return _0xbbccfe(_0x1e8751[_0xe999('0x15')][_0xe999('0x17')]);}logger[_0xe999('0x15')](_0xe999('0x11'),_0x3151a7,_0x1e8751[_0xe999('0x15')]['message']);return _0x1097f0(_0x1e8751[_0xe999('0x15')][_0xe999('0x17')]);}else{logger[_0xe999('0x18')](_0xe999('0x11'),_0x3151a7,_0xe999('0x12'));_0x1097f0(_0x1e8751[_0xe999('0x19')][_0xe999('0x17')]);}})['catch'](function(_0x3ce169){logger[_0xe999('0x15')](_0xe999('0x11'),_0x3151a7,_0x3ce169);_0xbbccfe(_0x3ce169);});});}exports[_0xe999('0x1a')]=function(_0x42a72d){var _0x1a73e9=this;return new Promise(function(_0x50fe9c,_0x381d37){return db['WhatsappMessage'][_0xe999('0x1b')](_0x42a72d[_0xe999('0x1c')],{'raw':_0x42a72d[_0xe999('0x1d')]?_0x42a72d[_0xe999('0x1d')][_0xe999('0x1e')]===undefined?!![]:![]:!![]})[_0xe999('0x10')](function(_0x18a6a8){logger['info']('CreateWhatsappMessage',_0x42a72d);logger[_0xe999('0x13')](_0xe999('0x1a'),_0x42a72d,JSON['stringify'](_0x18a6a8));_0x50fe9c(_0x18a6a8);})['catch'](function(_0x103b98){logger[_0xe999('0x15')](_0xe999('0x1a'),_0x103b98[_0xe999('0x17')],_0x42a72d);_0x381d37(_0x1a73e9[_0xe999('0x15')](0x1f4,_0x103b98['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3feede6..1991de2 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 _0x6d2e=['./whatsappMessage.events','save','update','length','whatsappMessage:'];(function(_0x21755e,_0x3c261f){var _0x48b662=function(_0x5e4397){while(--_0x5e4397){_0x21755e['push'](_0x21755e['shift']());}};_0x48b662(++_0x3c261f);}(_0x6d2e,0x1a9));var _0xe6d2=function(_0x9a825b,_0x35c63e){_0x9a825b=_0x9a825b-0x0;var _0x4e5706=_0x6d2e[_0x9a825b];return _0x4e5706;};'use strict';var WhatsappMessageEvents=require(_0xe6d2('0x0'));var events=[_0xe6d2('0x1'),'remove',_0xe6d2('0x2')];function createListener(_0x290d25,_0x348774){return function(_0x15914d){_0x348774['emit'](_0x290d25,_0x15914d);};}function removeListener(_0x2d0051,_0x2ac46d){return function(){WhatsappMessageEvents['removeListener'](_0x2d0051,_0x2ac46d);};}exports['register']=function(_0x14292c){for(var _0x6f26b6=0x0,_0x250080=events[_0xe6d2('0x3')];_0x6f26b6<_0x250080;_0x6f26b6++){var _0x47e65a=events[_0x6f26b6];var _0x215e20=createListener(_0xe6d2('0x4')+_0x47e65a,_0x14292c);WhatsappMessageEvents['on'](_0x47e65a,_0x215e20);}}; \ No newline at end of file +var _0xb079=['remove','update','emit','removeListener','whatsappMessage:','./whatsappMessage.events','save'];(function(_0xba0348,_0x5b753e){var _0x1ec6f7=function(_0x2bccf1){while(--_0x2bccf1){_0xba0348['push'](_0xba0348['shift']());}};_0x1ec6f7(++_0x5b753e);}(_0xb079,0x194));var _0x9b07=function(_0x1df070,_0x53979d){_0x1df070=_0x1df070-0x0;var _0x297081=_0xb079[_0x1df070];return _0x297081;};'use strict';var WhatsappMessageEvents=require(_0x9b07('0x0'));var events=[_0x9b07('0x1'),_0x9b07('0x2'),_0x9b07('0x3')];function createListener(_0x33aa7a,_0x4bdac5){return function(_0x40aa53){_0x4bdac5[_0x9b07('0x4')](_0x33aa7a,_0x40aa53);};}function removeListener(_0x3742b3,_0x3aea3b){return function(){WhatsappMessageEvents[_0x9b07('0x5')](_0x3742b3,_0x3aea3b);};}exports['register']=function(_0xedc196){for(var _0x175b1e=0x0,_0x56645f=events['length'];_0x175b1e<_0x56645f;_0x175b1e++){var _0x44f4ac=events[_0x175b1e];var _0x5c1b98=createListener(_0x9b07('0x6')+_0x44f4ac,_0xedc196);WhatsappMessageEvents['on'](_0x44f4ac,_0x5c1b98);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index bfec332..c01a882 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 _0x7299=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7299,0x1ac));var _0x9729=function(_0x2706fd,_0x558552){_0x2706fd=_0x2706fd-0x0;var _0x250261=_0x7299[_0x2706fd];return _0x250261;};'use strict';var multer=require(_0x9729('0x0'));var util=require(_0x9729('0x1'));var path=require('path');var timeout=require(_0x9729('0x2'));var express=require(_0x9729('0x3'));var router=express['Router']();var fs_extra=require(_0x9729('0x4'));var auth=require(_0x9729('0x5'));var interaction=require(_0x9729('0x6'));var config=require(_0x9729('0x7'));var controller=require('./whatsappQueue.controller');router[_0x9729('0x8')]('/',auth['isAuthenticated'](),controller[_0x9729('0x9')]);router['get'](_0x9729('0xa'),auth[_0x9729('0xb')](),controller['describe']);router[_0x9729('0x8')](_0x9729('0xc'),auth[_0x9729('0xb')](),controller[_0x9729('0xd')]);router[_0x9729('0x8')]('/:id/members',auth[_0x9729('0xb')](),controller[_0x9729('0xe')]);router['get'](_0x9729('0xf'),auth[_0x9729('0xb')](),controller[_0x9729('0x10')]);router[_0x9729('0x8')]('/:id/users',auth[_0x9729('0xb')](),controller[_0x9729('0x11')]);router[_0x9729('0x12')]('/',auth[_0x9729('0xb')](),controller['create']);router[_0x9729('0x12')]('/:id/teams',auth[_0x9729('0xb')](),controller[_0x9729('0x13')]);router[_0x9729('0x12')](_0x9729('0x14'),auth[_0x9729('0xb')](),controller[_0x9729('0x15')]);router[_0x9729('0x16')](_0x9729('0xc'),auth[_0x9729('0xb')](),controller['update']);router[_0x9729('0x17')](_0x9729('0xc'),auth['isAuthenticated'](),controller[_0x9729('0x18')]);router[_0x9729('0x17')]('/:id/teams',auth[_0x9729('0xb')](),controller[_0x9729('0x19')]);router[_0x9729('0x17')](_0x9729('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9729('0x1a')]=router; \ No newline at end of file +var _0x47b3=['show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x88127b,_0x10b7ad){var _0x417922=function(_0x332d7c){while(--_0x332d7c){_0x88127b['push'](_0x88127b['shift']());}};_0x417922(++_0x10b7ad);}(_0x47b3,0x153));var _0x347b=function(_0x3c7ba4,_0x9af4e9){_0x3c7ba4=_0x3c7ba4-0x0;var _0x35d996=_0x47b3[_0x3c7ba4];return _0x35d996;};'use strict';var multer=require('multer');var util=require(_0x347b('0x0'));var path=require(_0x347b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x347b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x347b('0x3'));var interaction=require(_0x347b('0x4'));var config=require('../../config/environment');var controller=require(_0x347b('0x5'));router[_0x347b('0x6')]('/',auth[_0x347b('0x7')](),controller[_0x347b('0x8')]);router[_0x347b('0x6')](_0x347b('0x9'),auth[_0x347b('0x7')](),controller[_0x347b('0xa')]);router['get'](_0x347b('0xb'),auth[_0x347b('0x7')](),controller[_0x347b('0xc')]);router[_0x347b('0x6')]('/:id/members',auth[_0x347b('0x7')](),controller[_0x347b('0xd')]);router[_0x347b('0x6')](_0x347b('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x347b('0x6')](_0x347b('0xf'),auth[_0x347b('0x7')](),controller[_0x347b('0x10')]);router[_0x347b('0x11')]('/',auth[_0x347b('0x7')](),controller[_0x347b('0x12')]);router[_0x347b('0x11')]('/:id/teams',auth[_0x347b('0x7')](),controller[_0x347b('0x13')]);router['post'](_0x347b('0xf'),auth[_0x347b('0x7')](),controller[_0x347b('0x14')]);router[_0x347b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x347b('0x16')]);router[_0x347b('0x17')]('/:id',auth[_0x347b('0x7')](),controller[_0x347b('0x18')]);router['delete'](_0x347b('0xe'),auth[_0x347b('0x7')](),controller[_0x347b('0x19')]);router[_0x347b('0x17')]('/:id/users',auth[_0x347b('0x7')](),controller['removeAgents']);module[_0x347b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0d3d500..75975e4 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 _0x9086=['rrmemory','beepall','roundrobin','sequelize','exports','name','INTEGER','ENUM'];(function(_0x3098d1,_0x4c6dc9){var _0x80fc9c=function(_0x54a889){while(--_0x54a889){_0x3098d1['push'](_0x3098d1['shift']());}};_0x80fc9c(++_0x4c6dc9);}(_0x9086,0x10b));var _0x6908=function(_0x558010,_0x4a71e6){_0x558010=_0x558010-0x0;var _0x3b9dba=_0x9086[_0x558010];return _0x3b9dba;};'use strict';var Sequelize=require(_0x6908('0x0'));module[_0x6908('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6908('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6908('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6908('0x4')](_0x6908('0x5'),_0x6908('0x6'),_0x6908('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xce25=['beepall','STRING','rrmemory'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xce25,0x196));var _0x5ce2=function(_0x304c6b,_0x527d76){_0x304c6b=_0x304c6b-0x0;var _0x11ee9b=_0xce25[_0x304c6b];return _0x11ee9b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5ce2('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5ce2('0x1'),_0x5ce2('0x2'),'roundrobin')},'description':{'type':Sequelize[_0x5ce2('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 93f8f5b..baace49 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 _0x8d8f=['offset','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','nolimit','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','emit','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','userWhatsappQueue:remove','getAgents','User','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','save','update','get','destroy','then','error','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x18056f,_0x9ed645){var _0x3a88a9=function(_0x468a19){while(--_0x468a19){_0x18056f['push'](_0x18056f['shift']());}};_0x3a88a9(++_0x9ed645);}(_0x8d8f,0x1e7));var _0xf8d8=function(_0x1a06b6,_0x25f709){_0x1a06b6=_0x1a06b6-0x0;var _0x4a4754=_0x8d8f[_0x1a06b6];return _0x4a4754;};'use strict';var emlformat=require(_0xf8d8('0x0'));var rimraf=require(_0xf8d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8d8('0x2'));var rp=require('request-promise');var moment=require(_0xf8d8('0x3'));var BPromise=require(_0xf8d8('0x4'));var Mustache=require(_0xf8d8('0x5'));var util=require(_0xf8d8('0x6'));var path=require(_0xf8d8('0x7'));var sox=require('sox');var csv=require(_0xf8d8('0x8'));var ejs=require(_0xf8d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8d8('0xa'));var squel=require(_0xf8d8('0xb'));var crypto=require('crypto');var jsforce=require(_0xf8d8('0xc'));var deskjs=require(_0xf8d8('0xd'));var toCsv=require(_0xf8d8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8d8('0xe'));var authService=require(_0xf8d8('0xf'));var qs=require(_0xf8d8('0x10'));var as=require(_0xf8d8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8d8('0x12'))('api');var utils=require(_0xf8d8('0x13'));var config=require(_0xf8d8('0x14'));var licenseUtil=require(_0xf8d8('0x15'));var db=require(_0xf8d8('0x16'))['db'];config[_0xf8d8('0x17')]=_[_0xf8d8('0x18')](config[_0xf8d8('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8d8('0x19'))(new Redis(config[_0xf8d8('0x17')]));require(_0xf8d8('0x1a'))[_0xf8d8('0x1b')](socket);function respondWithStatusCode(_0x4881fd,_0x1b82c1){_0x1b82c1=_0x1b82c1||0xcc;return function(_0x3ad751){if(_0x3ad751){return _0x4881fd[_0xf8d8('0x1c')](_0x1b82c1);}return _0x4881fd[_0xf8d8('0x1d')](_0x1b82c1)[_0xf8d8('0x1e')]();};}function respondWithResult(_0x2271f5,_0x57ec94){_0x57ec94=_0x57ec94||0xc8;return function(_0x43e5b2){if(_0x43e5b2){return _0x2271f5[_0xf8d8('0x1d')](_0x57ec94)[_0xf8d8('0x1f')](_0x43e5b2);}};}function respondWithFilteredResult(_0x2bdf26,_0x201896){return function(_0x40231f){if(_0x40231f){var _0x5a05c7=typeof _0x201896['offset']===_0xf8d8('0x20')&&typeof _0x201896[_0xf8d8('0x21')]===_0xf8d8('0x20');var _0x56fe13=_0x40231f[_0xf8d8('0x22')];var _0x1dd14e=_0x5a05c7?0x0:_0x201896['offset'];var _0x2030c1=_0x5a05c7?_0x40231f['count']:_0x201896['offset']+_0x201896[_0xf8d8('0x21')];var _0x13c476;if(_0x2030c1>=_0x56fe13){_0x2030c1=_0x56fe13;_0x13c476=0xc8;}else{_0x13c476=0xce;}_0x2bdf26[_0xf8d8('0x1d')](_0x13c476);return _0x2bdf26[_0xf8d8('0x23')]('Content-Range',_0x1dd14e+'-'+_0x2030c1+'/'+_0x56fe13)[_0xf8d8('0x1f')](_0x40231f);}return null;};}function patchUpdates(_0x4f8c62){return function(_0x45c04d){try{jsonpatch[_0xf8d8('0x24')](_0x45c04d,_0x4f8c62,!![]);}catch(_0x15b77){return BPromise[_0xf8d8('0x25')](_0x15b77);}return _0x45c04d[_0xf8d8('0x26')]();};}function saveUpdates(_0x124b82,_0x4f6225){return function(_0x1b4e6a){if(_0x1b4e6a){return _0x1b4e6a[_0xf8d8('0x27')](_0x124b82)['then'](function(_0x2ba5f1){return _0x2ba5f1;});}return null;};}function removeEntity(_0x203954,_0x514b9b){return function(_0x248f8f){if(_0x248f8f){return _0x248f8f['destroy']()['then'](function(){var _0x524a49=_0x248f8f[_0xf8d8('0x28')]({'plain':!![]});var _0x182b68='WhatsappQueues';return db['UserProfileResource'][_0xf8d8('0x29')]({'where':{'type':_0x182b68,'resourceId':_0x524a49['id']}})['then'](function(){return _0x248f8f;});})[_0xf8d8('0x2a')](function(){_0x203954[_0xf8d8('0x1d')](0xcc)[_0xf8d8('0x1e')]();});}};}function handleEntityNotFound(_0xd94cd3,_0x4c6270){return function(_0xc22ff){if(!_0xc22ff){_0xd94cd3['sendStatus'](0x194);}return _0xc22ff;};}function handleError(_0x264f40,_0x45586c){_0x45586c=_0x45586c||0x1f4;return function(_0x3e1a75){logger[_0xf8d8('0x2b')](_0x3e1a75['stack']);if(_0x3e1a75[_0xf8d8('0x2c')]){delete _0x3e1a75[_0xf8d8('0x2c')];}_0x264f40[_0xf8d8('0x1d')](_0x45586c)['send'](_0x3e1a75);};}exports[_0xf8d8('0x2d')]=function(_0x46edb7,_0x3b244f){var _0x426855={},_0x6cf2e6={},_0x2eb4de={'count':0x0,'rows':[]};var _0x1f514c=_[_0xf8d8('0x2e')](db[_0xf8d8('0x2f')][_0xf8d8('0x30')],function(_0xd5c4a0){return{'name':_0xd5c4a0[_0xf8d8('0x31')],'type':_0xd5c4a0[_0xf8d8('0x32')][_0xf8d8('0x33')]};});_0x6cf2e6[_0xf8d8('0x34')]=_[_0xf8d8('0x2e')](_0x1f514c,'name');_0x6cf2e6[_0xf8d8('0x35')]=_[_0xf8d8('0x36')](_0x46edb7[_0xf8d8('0x35')]);_0x6cf2e6[_0xf8d8('0x37')]=_[_0xf8d8('0x38')](_0x6cf2e6[_0xf8d8('0x34')],_0x6cf2e6[_0xf8d8('0x35')]);_0x426855[_0xf8d8('0x39')]=_[_0xf8d8('0x38')](_0x6cf2e6[_0xf8d8('0x34')],qs[_0xf8d8('0x3a')](_0x46edb7[_0xf8d8('0x35')][_0xf8d8('0x3a')]));_0x426855[_0xf8d8('0x39')]=_0x426855['attributes'][_0xf8d8('0x3b')]?_0x426855[_0xf8d8('0x39')]:_0x6cf2e6[_0xf8d8('0x34')];if(!_0x46edb7[_0xf8d8('0x35')][_0xf8d8('0x3c')]('nolimit')){_0x426855[_0xf8d8('0x21')]=qs[_0xf8d8('0x21')](_0x46edb7[_0xf8d8('0x35')][_0xf8d8('0x21')]);_0x426855[_0xf8d8('0x3d')]=qs[_0xf8d8('0x3d')](_0x46edb7[_0xf8d8('0x35')][_0xf8d8('0x3d')]);}_0x426855[_0xf8d8('0x3e')]=qs[_0xf8d8('0x3f')](_0x46edb7['query'][_0xf8d8('0x3f')]);_0x426855['where']=qs['filters'](_[_0xf8d8('0x40')](_0x46edb7[_0xf8d8('0x35')],_0x6cf2e6[_0xf8d8('0x37')]),_0x1f514c);if(_0x46edb7['query'][_0xf8d8('0x41')]){_0x426855[_0xf8d8('0x42')]=_['merge'](_0x426855[_0xf8d8('0x42')],{'$or':_[_0xf8d8('0x2e')](_0x1f514c,function(_0x511667){if(_0x511667[_0xf8d8('0x32')]!==_0xf8d8('0x43')){var _0x38708e={};_0x38708e[_0x511667[_0xf8d8('0x2c')]]={'$like':'%'+_0x46edb7[_0xf8d8('0x35')][_0xf8d8('0x41')]+'%'};return _0x38708e;}})});}_0x426855=_[_0xf8d8('0x44')]({},_0x426855,_0x46edb7[_0xf8d8('0x45')]);var _0x11547f={'where':_0x426855[_0xf8d8('0x42')]};return db[_0xf8d8('0x2f')]['count'](_0x11547f)['then'](function(_0x19913c){_0x2eb4de['count']=_0x19913c;if(_0x46edb7['query'][_0xf8d8('0x46')]){_0x426855[_0xf8d8('0x47')]=[{'all':!![]}];}return db[_0xf8d8('0x2f')][_0xf8d8('0x48')](_0x426855);})[_0xf8d8('0x2a')](function(_0x25266a){_0x2eb4de[_0xf8d8('0x49')]=_0x25266a;return _0x2eb4de;})[_0xf8d8('0x2a')](respondWithFilteredResult(_0x3b244f,_0x426855))['catch'](handleError(_0x3b244f,null));};exports[_0xf8d8('0x4a')]=function(_0x13385f,_0x35d731){var _0x3472c2={'raw':!![],'where':{'id':_0x13385f[_0xf8d8('0x4b')]['id']}},_0x529e41={};_0x529e41[_0xf8d8('0x34')]=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x529e41['query']=_[_0xf8d8('0x36')](_0x13385f[_0xf8d8('0x35')]);_0x529e41[_0xf8d8('0x37')]=_['intersection'](_0x529e41[_0xf8d8('0x34')],_0x529e41[_0xf8d8('0x35')]);_0x3472c2[_0xf8d8('0x39')]=_['intersection'](_0x529e41[_0xf8d8('0x34')],qs[_0xf8d8('0x3a')](_0x13385f['query'][_0xf8d8('0x3a')]));_0x3472c2['attributes']=_0x3472c2[_0xf8d8('0x39')][_0xf8d8('0x3b')]?_0x3472c2[_0xf8d8('0x39')]:_0x529e41[_0xf8d8('0x34')];if(_0x13385f[_0xf8d8('0x35')][_0xf8d8('0x46')]){_0x3472c2['include']=[{'all':!![]}];}_0x3472c2=_[_0xf8d8('0x44')]({},_0x3472c2,_0x13385f[_0xf8d8('0x45')]);return db[_0xf8d8('0x2f')][_0xf8d8('0x4c')](_0x3472c2)['then'](handleEntityNotFound(_0x35d731,null))['then'](respondWithResult(_0x35d731,null))[_0xf8d8('0x4d')](handleError(_0x35d731,null));};exports[_0xf8d8('0x4e')]=function(_0x43299f,_0x59929c){return db['WhatsappQueue'][_0xf8d8('0x4e')](_0x43299f[_0xf8d8('0x4f')],{})['then'](function(_0x98e471){var _0x98cc3=_0x43299f[_0xf8d8('0x50')][_0xf8d8('0x28')]({'plain':!![]});if(!_0x98cc3)throw new Error(_0xf8d8('0x51'));if(_0x98cc3['role']===_0xf8d8('0x50')){var _0x385e2c=_0x98e471[_0xf8d8('0x28')]({'plain':!![]});var _0x3187ab='WhatsappQueues';return db[_0xf8d8('0x52')]['find']({'where':{'name':_0x3187ab,'userProfileId':_0x98cc3[_0xf8d8('0x53')]},'raw':!![]})[_0xf8d8('0x2a')](function(_0x2408eb){if(_0x2408eb&&_0x2408eb[_0xf8d8('0x54')]===0x0){return db[_0xf8d8('0x55')]['create']({'name':_0x385e2c[_0xf8d8('0x2c')],'resourceId':_0x385e2c['id'],'type':_0x2408eb[_0xf8d8('0x2c')],'sectionId':_0x2408eb['id']},{})[_0xf8d8('0x2a')](function(){return _0x98e471;});}else{return _0x98e471;}})[_0xf8d8('0x4d')](function(_0x355464){logger[_0xf8d8('0x2b')](_0xf8d8('0x56'),_0x355464);throw _0x355464;});}return _0x98e471;})['then'](respondWithResult(_0x59929c,0xc9))[_0xf8d8('0x4d')](handleError(_0x59929c,null));};exports[_0xf8d8('0x27')]=function(_0x5b1442,_0x4712c4){if(_0x5b1442[_0xf8d8('0x4f')]['id']){delete _0x5b1442[_0xf8d8('0x4f')]['id'];}return db['WhatsappQueue'][_0xf8d8('0x4c')]({'where':{'id':_0x5b1442[_0xf8d8('0x4b')]['id']}})[_0xf8d8('0x2a')](handleEntityNotFound(_0x4712c4,null))['then'](saveUpdates(_0x5b1442[_0xf8d8('0x4f')],null))['then'](respondWithResult(_0x4712c4,null))[_0xf8d8('0x4d')](handleError(_0x4712c4,null));};exports[_0xf8d8('0x29')]=function(_0x255993,_0x2e761e){return db['WhatsappQueue'][_0xf8d8('0x4c')]({'where':{'id':_0x255993['params']['id']}})['then'](handleEntityNotFound(_0x2e761e,null))['then'](removeEntity(_0x2e761e,null))[_0xf8d8('0x4d')](handleError(_0x2e761e,null));};exports[_0xf8d8('0x57')]=function(_0x561e1c,_0x45a563){return db[_0xf8d8('0x2f')][_0xf8d8('0x57')]()[_0xf8d8('0x2a')](respondWithResult(_0x45a563,null))[_0xf8d8('0x4d')](handleError(_0x45a563,null));};exports[_0xf8d8('0x58')]=function(_0x193fb7,_0x305728,_0xe20043){var _0x563ab4={'raw':!![],'where':{}},_0x8fe2f0={},_0x3ee1c1;return db['WhatsappQueue']['findOne']({'where':{'id':_0x193fb7[_0xf8d8('0x4b')]['id']}})[_0xf8d8('0x2a')](handleEntityNotFound(_0x305728,null))[_0xf8d8('0x2a')](function(_0xf0f8ea){if(_0xf0f8ea){_0x3ee1c1=_0xf0f8ea[_0xf8d8('0x28')]({'plain':!![]});_0x8fe2f0[_0xf8d8('0x34')]=_['keys'](db[_0xf8d8('0x59')][_0xf8d8('0x30')]);_0x8fe2f0[_0xf8d8('0x35')]=_[_0xf8d8('0x36')](_0x193fb7['query']);_0x8fe2f0[_0xf8d8('0x37')]=_[_0xf8d8('0x38')](_0x8fe2f0['model'],_0x8fe2f0[_0xf8d8('0x35')]);_0x563ab4[_0xf8d8('0x39')]=_[_0xf8d8('0x38')](_0x8fe2f0[_0xf8d8('0x34')],qs[_0xf8d8('0x3a')](_0x193fb7[_0xf8d8('0x35')]['fields']));_0x563ab4['attributes']=_0x563ab4[_0xf8d8('0x39')]['length']?_0x563ab4[_0xf8d8('0x39')]:_0x8fe2f0[_0xf8d8('0x34')];if(!_0x193fb7[_0xf8d8('0x35')][_0xf8d8('0x3c')](_0xf8d8('0x5a'))){_0x563ab4[_0xf8d8('0x21')]=qs[_0xf8d8('0x21')](_0x193fb7[_0xf8d8('0x35')][_0xf8d8('0x21')]);_0x563ab4[_0xf8d8('0x3d')]=qs[_0xf8d8('0x3d')](_0x193fb7[_0xf8d8('0x35')]['offset']);}_0x563ab4['order']=qs[_0xf8d8('0x3f')](_0x193fb7[_0xf8d8('0x35')][_0xf8d8('0x3f')]);_0x563ab4[_0xf8d8('0x42')]=qs[_0xf8d8('0x37')](_['pick'](_0x193fb7[_0xf8d8('0x35')],_0x8fe2f0[_0xf8d8('0x37')]));_0x563ab4[_0xf8d8('0x42')]['WhatsappQueueId']=_0xf0f8ea['id'];if(_0x193fb7[_0xf8d8('0x35')][_0xf8d8('0x41')]){_0x563ab4[_0xf8d8('0x42')]=_[_0xf8d8('0x44')](_0x563ab4[_0xf8d8('0x42')],{'$or':_[_0xf8d8('0x2e')](_0x563ab4['attributes'],function(_0x12cf0d){var _0x31c399={};_0x31c399[_0x12cf0d]={'$like':'%'+_0x193fb7[_0xf8d8('0x35')]['filter']+'%'};return _0x31c399;})});}_0x563ab4=_[_0xf8d8('0x44')]({},_0x563ab4,_0x193fb7['options']);return db['UserWhatsappQueue']['findAll'](_0x563ab4);}})[_0xf8d8('0x2a')](function(_0x4a54e6){if(_0x4a54e6){return db['User'][_0xf8d8('0x5b')]({'where':{'id':_[_0xf8d8('0x2e')](_0x4a54e6,_0xf8d8('0x5c')),'role':'agent'},'attributes':['id',_0xf8d8('0x2c'),_0xf8d8('0x5d'),_0xf8d8('0x5e'),'createdAt']});}})['then'](function(_0xe74d4d){if(_0xe74d4d){return{'count':_0xe74d4d[_0xf8d8('0x22')],'rows':_['map'](_0xe74d4d[_0xf8d8('0x49')],function(_0x5b9458){return{'membername':_0x5b9458['name'],'UserId':_0x5b9458['id'],'queue_name':_0x3ee1c1[_0xf8d8('0x2c')],'WhatsappQueueId':_0x3ee1c1['id'],'interface':util[_0xf8d8('0x5f')](_0xf8d8('0x60'),_0xf8d8('0x61'),_0x5b9458[_0xf8d8('0x2c')]),'penalty':0x0,'paused':_0x5b9458[_0xf8d8('0x5d')],'createdAt':_0x5b9458[_0xf8d8('0x62')],'updatedAt':_0x5b9458[_0xf8d8('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf8d8('0x2a')](respondWithFilteredResult(_0x305728,_0x563ab4))[_0xf8d8('0x4d')](handleError(_0x305728,null));};exports[_0xf8d8('0x63')]=function(_0x45336c,_0x3fce18,_0x2a7b3e){var _0x216c74={};var _0x44417a={};var _0x45fed1;var _0x36f0bf;return db[_0xf8d8('0x2f')][_0xf8d8('0x64')]({'where':{'id':_0x45336c[_0xf8d8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3fce18,null))[_0xf8d8('0x2a')](function(_0x2b4dbc){if(_0x2b4dbc){_0x45fed1=_0x2b4dbc;_0x44417a['model']=_[_0xf8d8('0x36')](db[_0xf8d8('0x65')][_0xf8d8('0x30')]);_0x44417a[_0xf8d8('0x35')]=_[_0xf8d8('0x36')](_0x45336c[_0xf8d8('0x35')]);_0x44417a['filters']=_[_0xf8d8('0x38')](_0x44417a[_0xf8d8('0x34')],_0x44417a[_0xf8d8('0x35')]);_0x216c74[_0xf8d8('0x39')]=_[_0xf8d8('0x38')](_0x44417a[_0xf8d8('0x34')],qs[_0xf8d8('0x3a')](_0x45336c['query'][_0xf8d8('0x3a')]));_0x216c74[_0xf8d8('0x39')]=_0x216c74[_0xf8d8('0x39')][_0xf8d8('0x3b')]?_0x216c74[_0xf8d8('0x39')]:_0x44417a[_0xf8d8('0x34')];_0x216c74[_0xf8d8('0x3e')]=qs[_0xf8d8('0x3f')](_0x45336c[_0xf8d8('0x35')][_0xf8d8('0x3f')]);_0x216c74[_0xf8d8('0x42')]=qs[_0xf8d8('0x37')](_[_0xf8d8('0x40')](_0x45336c[_0xf8d8('0x35')],_0x44417a[_0xf8d8('0x37')]));if(_0x45336c[_0xf8d8('0x35')][_0xf8d8('0x41')]){_0x216c74['where']=_[_0xf8d8('0x44')](_0x216c74[_0xf8d8('0x42')],{'$or':_[_0xf8d8('0x2e')](_0x216c74[_0xf8d8('0x39')],function(_0x353d4a){var _0x5aaf7e={};_0x5aaf7e[_0x353d4a]={'$like':'%'+_0x45336c[_0xf8d8('0x35')][_0xf8d8('0x41')]+'%'};return _0x5aaf7e;})});}_0x216c74=_[_0xf8d8('0x44')]({},_0x216c74,_0x45336c['options']);return _0x45fed1[_0xf8d8('0x63')](_0x216c74);}})['then'](function(_0x2a62ce){if(_0x2a62ce){_0x36f0bf=_0x2a62ce[_0xf8d8('0x3b')];if(!_0x45336c[_0xf8d8('0x35')][_0xf8d8('0x3c')](_0xf8d8('0x5a'))){_0x216c74['limit']=qs['limit'](_0x45336c['query']['limit']);_0x216c74['offset']=qs[_0xf8d8('0x3d')](_0x45336c['query']['offset']);}return _0x45fed1[_0xf8d8('0x63')](_0x216c74);}})[_0xf8d8('0x2a')](function(_0x29aa8a){if(_0x29aa8a){return _0x29aa8a?{'count':_0x36f0bf,'rows':_0x29aa8a}:null;}})[_0xf8d8('0x2a')](respondWithResult(_0x3fce18,null))[_0xf8d8('0x4d')](handleError(_0x3fce18,null));};exports[_0xf8d8('0x66')]=function(_0x254749,_0x3b6f3f,_0x530afa){var _0x3597a9=_0x254749[_0xf8d8('0x4f')][_0xf8d8('0x67')];return db[_0xf8d8('0x65')][_0xf8d8('0x48')]({'where':{'id':_0x3597a9},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xf8d8('0x68'),_0xf8d8('0x69')],'raw':!![]}]})[_0xf8d8('0x2a')](function(_0x288b17){if(_0x288b17){var _0x21793c=_[_0xf8d8('0x6a')](_0x288b17,function(_0xd7204d){var _0x4b109e=_0xd7204d[_0xf8d8('0x28')]({'plain':!![]});return _0x4b109e[_0xf8d8('0x6b')];});return db['WhatsappQueue'][_0xf8d8('0x4c')]({'where':{'id':_0x254749['params']['id']}})[_0xf8d8('0x2a')](function(_0x2e7c56){return db[_0xf8d8('0x6c')][_0xf8d8('0x6d')](function(_0xc27a4c){return _0x2e7c56['addTeams'](_0x3597a9,{'transaction':_0xc27a4c})['then'](function(){return BPromise['each'](_0x21793c,function(_0x5a78ed){return db[_0xf8d8('0x59')]['findOrCreate']({'where':{'UserId':_0x5a78ed['id'],'WhatsappQueueId':_0x254749[_0xf8d8('0x4b')]['id']},'transaction':_0xc27a4c});});})[_0xf8d8('0x2a')](function(){_0x21793c[_0xf8d8('0x6e')](function(_0x5e4a3d){socket['emit']('userWhatsappQueue:save',{'UserId':_0x5e4a3d['id'],'WhatsappQueueId':_0x2e7c56['id']});});});});});}})[_0xf8d8('0x2a')](respondWithStatusCode(_0x3b6f3f,null))[_0xf8d8('0x4d')](handleError(_0x3b6f3f,null));};exports[_0xf8d8('0x6f')]=function(_0x1af4da,_0x24d054,_0x990e92){return db[_0xf8d8('0x65')][_0xf8d8('0x48')]({'where':{'id':_0x1af4da[_0xf8d8('0x35')][_0xf8d8('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf8d8('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xf8d8('0x2a')](handleEntityNotFound(_0x24d054,null))[_0xf8d8('0x2a')](function(_0xfb224e){var _0x1ce6c6=_[_0xf8d8('0x2e')](_0xfb224e,'id');var _0x4ce85d=[];var _0x131bf0=[];var _0x3d52df=squel[_0xf8d8('0x70')]();_0x3d52df[_0xf8d8('0x71')](_0xf8d8('0x72'))['from'](_0xf8d8('0x73'),'tq')['join']('user_has_teams','ut',_0xf8d8('0x74'))[_0xf8d8('0x42')](_0xf8d8('0x75'),_0x1af4da[_0xf8d8('0x4b')]['id']);for(var _0x211def=0x0;_0x211def<_0xfb224e[_0xf8d8('0x3b')];_0x211def+=0x1){let _0x3b9837=_0xfb224e[_0x211def];for(var _0x3875e2=0x0;_0x3875e2<_0x3b9837[_0xf8d8('0x6b')][_0xf8d8('0x3b')];_0x3875e2+=0x1){let _0xf70099=_0x3b9837[_0xf8d8('0x6b')][_0x3875e2];var _0x48cb49=_0x3d52df['clone']();_0x48cb49[_0xf8d8('0x42')](_0xf8d8('0x76'),_0xf70099['id']);_0x131bf0['push'](db['sequelize'][_0xf8d8('0x35')](_0x48cb49[_0xf8d8('0x77')](),{'type':db['sequelize'][_0xf8d8('0x78')][_0xf8d8('0x79')]})[_0xf8d8('0x2a')](function(_0x2fda8d){if(_0x2fda8d[_0xf8d8('0x3b')]===0x1){return _0xf70099['id'];}else{var _0x514855=_[_0xf8d8('0x7a')](_[_0xf8d8('0x2e')](_0x2fda8d,'TeamId'),function(_0x15458b){return _[_0xf8d8('0x7b')](_0x1ce6c6,_0x15458b);});if(_0x514855){return _0xf70099['id'];}}}));}}return BPromise['all'](_0x131bf0)[_0xf8d8('0x2a')](function(_0x1dfba0){_0x4ce85d=_(_0x4ce85d)[_0xf8d8('0x7c')](_0x1dfba0)[_0xf8d8('0x7d')]()[_0xf8d8('0x7e')]();return db[_0xf8d8('0x2f')]['find']({'where':{'id':_0x1af4da[_0xf8d8('0x4b')]['id']}})[_0xf8d8('0x2a')](function(_0x23fc1d){return db['sequelize'][_0xf8d8('0x6d')](function(_0x553728){return _0x23fc1d['removeTeams'](_0x1af4da[_0xf8d8('0x35')][_0xf8d8('0x67')],{'transaction':_0x553728})[_0xf8d8('0x2a')](function(){if(!_[_0xf8d8('0x7f')](_0x4ce85d)){return _0x23fc1d['removeAgents'](_0x4ce85d,{'transaction':_0x553728});}})[_0xf8d8('0x2a')](function(){_0x4ce85d['forEach'](function(_0x1ac67a){socket[_0xf8d8('0x80')]('userWhatsappQueue:remove',{'UserId':_0x1ac67a,'WhatsappQueueId':_0x23fc1d['id']});});});});});});})[_0xf8d8('0x2a')](respondWithStatusCode(_0x24d054,null))[_0xf8d8('0x4d')](handleError(_0x24d054,null));};exports[_0xf8d8('0x81')]=function(_0x42247f,_0x25614c,_0x4a7369){return db[_0xf8d8('0x2f')]['find']({'where':{'id':_0x42247f['params']['id']}})[_0xf8d8('0x2a')](handleEntityNotFound(_0x25614c,null))[_0xf8d8('0x2a')](function(_0x392184){if(_0x392184){return _0x392184[_0xf8d8('0x81')](_0x42247f['body']['ids'],_[_0xf8d8('0x82')](_0x42247f['body'],[_0xf8d8('0x67'),'id'])||{})[_0xf8d8('0x83')](function(_0x4e7093){for(var _0x2039f7=0x0;_0x2039f7<_0x42247f[_0xf8d8('0x4f')][_0xf8d8('0x67')][_0xf8d8('0x3b')];_0x2039f7+=0x1){socket[_0xf8d8('0x80')](_0xf8d8('0x84'),{'UserId':Number(_0x42247f[_0xf8d8('0x4f')]['ids'][_0x2039f7]),'WhatsappQueueId':Number(_0x42247f[_0xf8d8('0x4b')]['id'])});}return _0x4e7093;});}})[_0xf8d8('0x2a')](respondWithResult(_0x25614c,null))[_0xf8d8('0x4d')](handleError(_0x25614c,null));};exports[_0xf8d8('0x85')]=function(_0x192b80,_0x466134,_0x3642d0){return db['WhatsappQueue'][_0xf8d8('0x4c')]({'where':{'id':_0x192b80['params']['id']}})['then'](handleEntityNotFound(_0x466134,null))['then'](function(_0x3b6c55){if(_0x3b6c55){return _0x3b6c55[_0xf8d8('0x85')](_0x192b80['query']['ids'])[_0xf8d8('0x2a')](function(){if(_['isArray'](_0x192b80[_0xf8d8('0x35')][_0xf8d8('0x67')])){for(var _0x3fc5a1=0x0;_0x3fc5a1<_0x192b80[_0xf8d8('0x35')]['ids'][_0xf8d8('0x3b')];_0x3fc5a1+=0x1){socket[_0xf8d8('0x80')](_0xf8d8('0x86'),{'UserId':Number(_0x192b80[_0xf8d8('0x35')][_0xf8d8('0x67')][_0x3fc5a1]),'WhatsappQueueId':Number(_0x192b80['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x192b80['query'][_0xf8d8('0x67')]),'WhatsappQueueId':Number(_0x192b80[_0xf8d8('0x4b')]['id'])});}});}})[_0xf8d8('0x2a')](respondWithStatusCode(_0x466134,null))[_0xf8d8('0x4d')](handleError(_0x466134,null));};exports[_0xf8d8('0x87')]=function(_0x162458,_0x107b80,_0x54e66e){var _0x24b80c={};var _0x38a16e={};var _0xacded9;var _0x2d7669;return db[_0xf8d8('0x2f')][_0xf8d8('0x64')]({'where':{'id':_0x162458['params']['id']}})[_0xf8d8('0x2a')](handleEntityNotFound(_0x107b80,null))[_0xf8d8('0x2a')](function(_0x350307){if(_0x350307){_0xacded9=_0x350307;_0x38a16e[_0xf8d8('0x34')]=_[_0xf8d8('0x36')](db[_0xf8d8('0x88')][_0xf8d8('0x30')]);_0x38a16e[_0xf8d8('0x35')]=_[_0xf8d8('0x36')](_0x162458[_0xf8d8('0x35')]);_0x38a16e['filters']=_[_0xf8d8('0x38')](_0x38a16e['model'],_0x38a16e[_0xf8d8('0x35')]);_0x24b80c['attributes']=_[_0xf8d8('0x38')](_0x38a16e['model'],qs['fields'](_0x162458[_0xf8d8('0x35')][_0xf8d8('0x3a')]));_0x24b80c[_0xf8d8('0x39')]=_0x24b80c[_0xf8d8('0x39')][_0xf8d8('0x3b')]?_0x24b80c[_0xf8d8('0x39')]:_0x38a16e[_0xf8d8('0x34')];_0x24b80c[_0xf8d8('0x3e')]=qs[_0xf8d8('0x3f')](_0x162458[_0xf8d8('0x35')]['sort']);_0x24b80c[_0xf8d8('0x42')]=qs[_0xf8d8('0x37')](_[_0xf8d8('0x40')](_0x162458['query'],_0x38a16e[_0xf8d8('0x37')]));if(_0x162458[_0xf8d8('0x35')]['filter']){_0x24b80c[_0xf8d8('0x42')]=_['merge'](_0x24b80c['where'],{'$or':_[_0xf8d8('0x2e')](_0x24b80c[_0xf8d8('0x39')],function(_0x4e3013){var _0xbe6ea8={};_0xbe6ea8[_0x4e3013]={'$like':'%'+_0x162458[_0xf8d8('0x35')][_0xf8d8('0x41')]+'%'};return _0xbe6ea8;})});}_0x24b80c=_['merge']({},_0x24b80c,_0x162458[_0xf8d8('0x45')]);return _0xacded9[_0xf8d8('0x87')](_0x24b80c);}})[_0xf8d8('0x2a')](function(_0x56e577){if(_0x56e577){_0x2d7669=_0x56e577[_0xf8d8('0x3b')];if(!_0x162458[_0xf8d8('0x35')][_0xf8d8('0x3c')](_0xf8d8('0x5a'))){_0x24b80c[_0xf8d8('0x21')]=qs['limit'](_0x162458[_0xf8d8('0x35')][_0xf8d8('0x21')]);_0x24b80c[_0xf8d8('0x3d')]=qs[_0xf8d8('0x3d')](_0x162458[_0xf8d8('0x35')][_0xf8d8('0x3d')]);}return _0xacded9[_0xf8d8('0x87')](_0x24b80c);}})['then'](function(_0x5c500c){if(_0x5c500c){return _0x5c500c?{'count':_0x2d7669,'rows':_0x5c500c}:null;}})[_0xf8d8('0x2a')](respondWithResult(_0x107b80,null))[_0xf8d8('0x4d')](handleError(_0x107b80,null));}; \ No newline at end of file +var _0xd8d7=['moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','user','role','WhatsappQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserWhatsappQueue','nolimit','pick','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','findOne','Team','addTeams','ids','online','flatMap','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd8d7,0x1a0));var _0x7d8d=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0xd8d7[_0x10b48a];return _0x2c4533;};'use strict';var emlformat=require(_0x7d8d('0x0'));var rimraf=require(_0x7d8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d8d('0x2'));var rp=require(_0x7d8d('0x3'));var moment=require(_0x7d8d('0x4'));var BPromise=require(_0x7d8d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d8d('0x6'));var sox=require(_0x7d8d('0x7'));var csv=require(_0x7d8d('0x8'));var ejs=require(_0x7d8d('0x9'));var fs=require('fs');var fs_extra=require(_0x7d8d('0xa'));var _=require(_0x7d8d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7d8d('0xc'));var deskjs=require(_0x7d8d('0xd'));var toCsv=require(_0x7d8d('0x8'));var querystring=require(_0x7d8d('0xe'));var Papa=require(_0x7d8d('0xf'));var Redis=require(_0x7d8d('0x10'));var authService=require(_0x7d8d('0x11'));var qs=require(_0x7d8d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d8d('0x13'));var logger=require(_0x7d8d('0x14'))(_0x7d8d('0x15'));var utils=require(_0x7d8d('0x16'));var config=require(_0x7d8d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d8d('0x18'))['db'];config[_0x7d8d('0x19')]=_['defaults'](config['redis'],{'host':_0x7d8d('0x1a'),'port':0x18eb});var socket=require(_0x7d8d('0x1b'))(new Redis(config['redis']));require(_0x7d8d('0x1c'))[_0x7d8d('0x1d')](socket);function respondWithStatusCode(_0x4a4c12,_0x4d244e){_0x4d244e=_0x4d244e||0xcc;return function(_0x4ba4af){if(_0x4ba4af){return _0x4a4c12[_0x7d8d('0x1e')](_0x4d244e);}return _0x4a4c12[_0x7d8d('0x1f')](_0x4d244e)[_0x7d8d('0x20')]();};}function respondWithResult(_0x141fb4,_0x22a641){_0x22a641=_0x22a641||0xc8;return function(_0x1e7fb7){if(_0x1e7fb7){return _0x141fb4[_0x7d8d('0x1f')](_0x22a641)[_0x7d8d('0x21')](_0x1e7fb7);}};}function respondWithFilteredResult(_0x304324,_0x361809){return function(_0x5779af){if(_0x5779af){var _0x2fd30c=typeof _0x361809[_0x7d8d('0x22')]==='undefined'&&typeof _0x361809[_0x7d8d('0x23')]===_0x7d8d('0x24');var _0x218312=_0x5779af[_0x7d8d('0x25')];var _0x5ec3fe=_0x2fd30c?0x0:_0x361809[_0x7d8d('0x22')];var _0x7647bf=_0x2fd30c?_0x5779af[_0x7d8d('0x25')]:_0x361809[_0x7d8d('0x22')]+_0x361809[_0x7d8d('0x23')];var _0x23aecf;if(_0x7647bf>=_0x218312){_0x7647bf=_0x218312;_0x23aecf=0xc8;}else{_0x23aecf=0xce;}_0x304324[_0x7d8d('0x1f')](_0x23aecf);return _0x304324[_0x7d8d('0x26')](_0x7d8d('0x27'),_0x5ec3fe+'-'+_0x7647bf+'/'+_0x218312)['json'](_0x5779af);}return null;};}function patchUpdates(_0x31483c){return function(_0x218e04){try{jsonpatch[_0x7d8d('0x28')](_0x218e04,_0x31483c,!![]);}catch(_0x3867e0){return BPromise['reject'](_0x3867e0);}return _0x218e04[_0x7d8d('0x29')]();};}function saveUpdates(_0x3f4e9f,_0x4a2946){return function(_0x6bb493){if(_0x6bb493){return _0x6bb493[_0x7d8d('0x2a')](_0x3f4e9f)[_0x7d8d('0x2b')](function(_0x4639ac){return _0x4639ac;});}return null;};}function removeEntity(_0xadb801,_0x12c2ff){return function(_0x29628a){if(_0x29628a){return _0x29628a[_0x7d8d('0x2c')]()['then'](function(){var _0x3ba23f=_0x29628a[_0x7d8d('0x2d')]({'plain':!![]});var _0x4605e7='WhatsappQueues';return db['UserProfileResource'][_0x7d8d('0x2c')]({'where':{'type':_0x4605e7,'resourceId':_0x3ba23f['id']}})[_0x7d8d('0x2b')](function(){return _0x29628a;});})[_0x7d8d('0x2b')](function(){_0xadb801[_0x7d8d('0x1f')](0xcc)[_0x7d8d('0x20')]();});}};}function handleEntityNotFound(_0x1d4cad,_0x2b0d0d){return function(_0x473e45){if(!_0x473e45){_0x1d4cad[_0x7d8d('0x1e')](0x194);}return _0x473e45;};}function handleError(_0x1a4fef,_0x2ac374){_0x2ac374=_0x2ac374||0x1f4;return function(_0x383b1d){logger[_0x7d8d('0x2e')](_0x383b1d[_0x7d8d('0x2f')]);if(_0x383b1d[_0x7d8d('0x30')]){delete _0x383b1d[_0x7d8d('0x30')];}_0x1a4fef['status'](_0x2ac374)['send'](_0x383b1d);};}exports[_0x7d8d('0x31')]=function(_0x155b43,_0x3783e9){var _0x15905c={},_0x3719ce={},_0x29c851={'count':0x0,'rows':[]};var _0x481a49=_['map'](db[_0x7d8d('0x32')][_0x7d8d('0x33')],function(_0x54d002){return{'name':_0x54d002[_0x7d8d('0x34')],'type':_0x54d002[_0x7d8d('0x35')][_0x7d8d('0x36')]};});_0x3719ce[_0x7d8d('0x37')]=_[_0x7d8d('0x38')](_0x481a49,_0x7d8d('0x30'));_0x3719ce[_0x7d8d('0x39')]=_[_0x7d8d('0x3a')](_0x155b43[_0x7d8d('0x39')]);_0x3719ce[_0x7d8d('0x3b')]=_[_0x7d8d('0x3c')](_0x3719ce[_0x7d8d('0x37')],_0x3719ce['query']);_0x15905c[_0x7d8d('0x3d')]=_['intersection'](_0x3719ce[_0x7d8d('0x37')],qs[_0x7d8d('0x3e')](_0x155b43['query'][_0x7d8d('0x3e')]));_0x15905c[_0x7d8d('0x3d')]=_0x15905c[_0x7d8d('0x3d')][_0x7d8d('0x3f')]?_0x15905c['attributes']:_0x3719ce[_0x7d8d('0x37')];if(!_0x155b43['query'][_0x7d8d('0x40')]('nolimit')){_0x15905c[_0x7d8d('0x23')]=qs['limit'](_0x155b43['query'][_0x7d8d('0x23')]);_0x15905c[_0x7d8d('0x22')]=qs[_0x7d8d('0x22')](_0x155b43[_0x7d8d('0x39')][_0x7d8d('0x22')]);}_0x15905c[_0x7d8d('0x41')]=qs[_0x7d8d('0x42')](_0x155b43[_0x7d8d('0x39')][_0x7d8d('0x42')]);_0x15905c[_0x7d8d('0x43')]=qs[_0x7d8d('0x3b')](_['pick'](_0x155b43['query'],_0x3719ce[_0x7d8d('0x3b')]),_0x481a49);if(_0x155b43[_0x7d8d('0x39')][_0x7d8d('0x44')]){_0x15905c['where']=_[_0x7d8d('0x45')](_0x15905c['where'],{'$or':_['map'](_0x481a49,function(_0x372d40){if(_0x372d40[_0x7d8d('0x35')]!=='VIRTUAL'){var _0x196c47={};_0x196c47[_0x372d40['name']]={'$like':'%'+_0x155b43['query'][_0x7d8d('0x44')]+'%'};return _0x196c47;}})});}_0x15905c=_['merge']({},_0x15905c,_0x155b43['options']);var _0x36f02d={'where':_0x15905c[_0x7d8d('0x43')]};return db[_0x7d8d('0x32')]['count'](_0x36f02d)['then'](function(_0x583db6){_0x29c851[_0x7d8d('0x25')]=_0x583db6;if(_0x155b43[_0x7d8d('0x39')][_0x7d8d('0x46')]){_0x15905c[_0x7d8d('0x47')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x7d8d('0x48')](_0x15905c);})[_0x7d8d('0x2b')](function(_0xa44d27){_0x29c851['rows']=_0xa44d27;return _0x29c851;})[_0x7d8d('0x2b')](respondWithFilteredResult(_0x3783e9,_0x15905c))[_0x7d8d('0x49')](handleError(_0x3783e9,null));};exports[_0x7d8d('0x4a')]=function(_0x4327ab,_0x442038){var _0x2393d4={'raw':!![],'where':{'id':_0x4327ab[_0x7d8d('0x4b')]['id']}},_0xa3b18f={};_0xa3b18f[_0x7d8d('0x37')]=_[_0x7d8d('0x3a')](db['WhatsappQueue'][_0x7d8d('0x33')]);_0xa3b18f[_0x7d8d('0x39')]=_[_0x7d8d('0x3a')](_0x4327ab[_0x7d8d('0x39')]);_0xa3b18f['filters']=_[_0x7d8d('0x3c')](_0xa3b18f[_0x7d8d('0x37')],_0xa3b18f[_0x7d8d('0x39')]);_0x2393d4[_0x7d8d('0x3d')]=_[_0x7d8d('0x3c')](_0xa3b18f[_0x7d8d('0x37')],qs[_0x7d8d('0x3e')](_0x4327ab[_0x7d8d('0x39')][_0x7d8d('0x3e')]));_0x2393d4['attributes']=_0x2393d4['attributes'][_0x7d8d('0x3f')]?_0x2393d4[_0x7d8d('0x3d')]:_0xa3b18f[_0x7d8d('0x37')];if(_0x4327ab[_0x7d8d('0x39')][_0x7d8d('0x46')]){_0x2393d4[_0x7d8d('0x47')]=[{'all':!![]}];}_0x2393d4=_[_0x7d8d('0x45')]({},_0x2393d4,_0x4327ab[_0x7d8d('0x4c')]);return db['WhatsappQueue'][_0x7d8d('0x4d')](_0x2393d4)['then'](handleEntityNotFound(_0x442038,null))[_0x7d8d('0x2b')](respondWithResult(_0x442038,null))[_0x7d8d('0x49')](handleError(_0x442038,null));};exports['create']=function(_0xd06705,_0x11d59a){return db['WhatsappQueue'][_0x7d8d('0x4e')](_0xd06705['body'],{})[_0x7d8d('0x2b')](function(_0x3b83d6){var _0x545d25=_0xd06705[_0x7d8d('0x4f')][_0x7d8d('0x2d')]({'plain':!![]});if(!_0x545d25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x545d25[_0x7d8d('0x50')]===_0x7d8d('0x4f')){var _0x2479d4=_0x3b83d6[_0x7d8d('0x2d')]({'plain':!![]});var _0x5564c6=_0x7d8d('0x51');return db['UserProfileSection'][_0x7d8d('0x4d')]({'where':{'name':_0x5564c6,'userProfileId':_0x545d25[_0x7d8d('0x52')]},'raw':!![]})[_0x7d8d('0x2b')](function(_0x4672ca){if(_0x4672ca&&_0x4672ca['autoAssociation']===0x0){return db['UserProfileResource'][_0x7d8d('0x4e')]({'name':_0x2479d4[_0x7d8d('0x30')],'resourceId':_0x2479d4['id'],'type':_0x4672ca[_0x7d8d('0x30')],'sectionId':_0x4672ca['id']},{})[_0x7d8d('0x2b')](function(){return _0x3b83d6;});}else{return _0x3b83d6;}})[_0x7d8d('0x49')](function(_0x385314){logger[_0x7d8d('0x2e')](_0x7d8d('0x53'),_0x385314);throw _0x385314;});}return _0x3b83d6;})[_0x7d8d('0x2b')](respondWithResult(_0x11d59a,0xc9))[_0x7d8d('0x49')](handleError(_0x11d59a,null));};exports[_0x7d8d('0x2a')]=function(_0x42e8bf,_0xedef8a){if(_0x42e8bf[_0x7d8d('0x54')]['id']){delete _0x42e8bf[_0x7d8d('0x54')]['id'];}return db[_0x7d8d('0x32')][_0x7d8d('0x4d')]({'where':{'id':_0x42e8bf['params']['id']}})[_0x7d8d('0x2b')](handleEntityNotFound(_0xedef8a,null))[_0x7d8d('0x2b')](saveUpdates(_0x42e8bf[_0x7d8d('0x54')],null))[_0x7d8d('0x2b')](respondWithResult(_0xedef8a,null))[_0x7d8d('0x49')](handleError(_0xedef8a,null));};exports[_0x7d8d('0x2c')]=function(_0x39bd60,_0x171e1b){return db['WhatsappQueue'][_0x7d8d('0x4d')]({'where':{'id':_0x39bd60['params']['id']}})[_0x7d8d('0x2b')](handleEntityNotFound(_0x171e1b,null))[_0x7d8d('0x2b')](removeEntity(_0x171e1b,null))[_0x7d8d('0x49')](handleError(_0x171e1b,null));};exports[_0x7d8d('0x55')]=function(_0x397514,_0x204d2b){return db[_0x7d8d('0x32')][_0x7d8d('0x55')]()[_0x7d8d('0x2b')](respondWithResult(_0x204d2b,null))['catch'](handleError(_0x204d2b,null));};exports['getMembers']=function(_0x533f86,_0x2dba56,_0x1381d7){var _0x5c1ec0={'raw':!![],'where':{}},_0x1ed650={},_0x4fce85;return db['WhatsappQueue']['findOne']({'where':{'id':_0x533f86[_0x7d8d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2dba56,null))[_0x7d8d('0x2b')](function(_0x2df247){if(_0x2df247){_0x4fce85=_0x2df247[_0x7d8d('0x2d')]({'plain':!![]});_0x1ed650[_0x7d8d('0x37')]=_[_0x7d8d('0x3a')](db[_0x7d8d('0x56')][_0x7d8d('0x33')]);_0x1ed650[_0x7d8d('0x39')]=_[_0x7d8d('0x3a')](_0x533f86[_0x7d8d('0x39')]);_0x1ed650[_0x7d8d('0x3b')]=_['intersection'](_0x1ed650[_0x7d8d('0x37')],_0x1ed650[_0x7d8d('0x39')]);_0x5c1ec0[_0x7d8d('0x3d')]=_[_0x7d8d('0x3c')](_0x1ed650['model'],qs[_0x7d8d('0x3e')](_0x533f86[_0x7d8d('0x39')][_0x7d8d('0x3e')]));_0x5c1ec0[_0x7d8d('0x3d')]=_0x5c1ec0[_0x7d8d('0x3d')][_0x7d8d('0x3f')]?_0x5c1ec0[_0x7d8d('0x3d')]:_0x1ed650[_0x7d8d('0x37')];if(!_0x533f86[_0x7d8d('0x39')][_0x7d8d('0x40')](_0x7d8d('0x57'))){_0x5c1ec0[_0x7d8d('0x23')]=qs[_0x7d8d('0x23')](_0x533f86[_0x7d8d('0x39')]['limit']);_0x5c1ec0[_0x7d8d('0x22')]=qs[_0x7d8d('0x22')](_0x533f86['query'][_0x7d8d('0x22')]);}_0x5c1ec0[_0x7d8d('0x41')]=qs['sort'](_0x533f86[_0x7d8d('0x39')][_0x7d8d('0x42')]);_0x5c1ec0[_0x7d8d('0x43')]=qs[_0x7d8d('0x3b')](_[_0x7d8d('0x58')](_0x533f86[_0x7d8d('0x39')],_0x1ed650[_0x7d8d('0x3b')]));_0x5c1ec0[_0x7d8d('0x43')][_0x7d8d('0x59')]=_0x2df247['id'];if(_0x533f86[_0x7d8d('0x39')][_0x7d8d('0x44')]){_0x5c1ec0[_0x7d8d('0x43')]=_[_0x7d8d('0x45')](_0x5c1ec0['where'],{'$or':_['map'](_0x5c1ec0[_0x7d8d('0x3d')],function(_0x1de435){var _0x51ca86={};_0x51ca86[_0x1de435]={'$like':'%'+_0x533f86[_0x7d8d('0x39')][_0x7d8d('0x44')]+'%'};return _0x51ca86;})});}_0x5c1ec0=_[_0x7d8d('0x45')]({},_0x5c1ec0,_0x533f86[_0x7d8d('0x4c')]);return db[_0x7d8d('0x56')][_0x7d8d('0x48')](_0x5c1ec0);}})[_0x7d8d('0x2b')](function(_0x51447d){if(_0x51447d){return db[_0x7d8d('0x5a')][_0x7d8d('0x5b')]({'where':{'id':_[_0x7d8d('0x38')](_0x51447d,'UserId'),'role':_0x7d8d('0x5c')},'attributes':['id','name',_0x7d8d('0x5d'),_0x7d8d('0x5e'),_0x7d8d('0x5f')]});}})[_0x7d8d('0x2b')](function(_0xf00742){if(_0xf00742){return{'count':_0xf00742[_0x7d8d('0x25')],'rows':_['map'](_0xf00742[_0x7d8d('0x60')],function(_0x35fa93){return{'membername':_0x35fa93[_0x7d8d('0x30')],'UserId':_0x35fa93['id'],'queue_name':_0x4fce85[_0x7d8d('0x30')],'WhatsappQueueId':_0x4fce85['id'],'interface':util[_0x7d8d('0x61')](_0x7d8d('0x62'),'SIP',_0x35fa93[_0x7d8d('0x30')]),'penalty':0x0,'paused':_0x35fa93[_0x7d8d('0x5d')],'createdAt':_0x35fa93[_0x7d8d('0x5f')],'updatedAt':_0x35fa93[_0x7d8d('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2dba56,_0x5c1ec0))['catch'](handleError(_0x2dba56,null));};exports[_0x7d8d('0x63')]=function(_0x2d7c10,_0x19e971,_0x3d14a1){var _0x2bae3b={};var _0x3c6127={};var _0x3fae6e;var _0x246e82;return db[_0x7d8d('0x32')][_0x7d8d('0x64')]({'where':{'id':_0x2d7c10[_0x7d8d('0x4b')]['id']}})[_0x7d8d('0x2b')](handleEntityNotFound(_0x19e971,null))[_0x7d8d('0x2b')](function(_0x4f3e6c){if(_0x4f3e6c){_0x3fae6e=_0x4f3e6c;_0x3c6127[_0x7d8d('0x37')]=_[_0x7d8d('0x3a')](db[_0x7d8d('0x65')][_0x7d8d('0x33')]);_0x3c6127[_0x7d8d('0x39')]=_['keys'](_0x2d7c10[_0x7d8d('0x39')]);_0x3c6127[_0x7d8d('0x3b')]=_[_0x7d8d('0x3c')](_0x3c6127[_0x7d8d('0x37')],_0x3c6127[_0x7d8d('0x39')]);_0x2bae3b['attributes']=_[_0x7d8d('0x3c')](_0x3c6127['model'],qs[_0x7d8d('0x3e')](_0x2d7c10[_0x7d8d('0x39')][_0x7d8d('0x3e')]));_0x2bae3b[_0x7d8d('0x3d')]=_0x2bae3b[_0x7d8d('0x3d')][_0x7d8d('0x3f')]?_0x2bae3b['attributes']:_0x3c6127['model'];_0x2bae3b[_0x7d8d('0x41')]=qs[_0x7d8d('0x42')](_0x2d7c10['query'][_0x7d8d('0x42')]);_0x2bae3b[_0x7d8d('0x43')]=qs['filters'](_['pick'](_0x2d7c10[_0x7d8d('0x39')],_0x3c6127[_0x7d8d('0x3b')]));if(_0x2d7c10[_0x7d8d('0x39')][_0x7d8d('0x44')]){_0x2bae3b['where']=_['merge'](_0x2bae3b[_0x7d8d('0x43')],{'$or':_['map'](_0x2bae3b[_0x7d8d('0x3d')],function(_0x4ea3ec){var _0x120fd2={};_0x120fd2[_0x4ea3ec]={'$like':'%'+_0x2d7c10[_0x7d8d('0x39')][_0x7d8d('0x44')]+'%'};return _0x120fd2;})});}_0x2bae3b=_[_0x7d8d('0x45')]({},_0x2bae3b,_0x2d7c10[_0x7d8d('0x4c')]);return _0x3fae6e[_0x7d8d('0x63')](_0x2bae3b);}})[_0x7d8d('0x2b')](function(_0x491ee4){if(_0x491ee4){_0x246e82=_0x491ee4[_0x7d8d('0x3f')];if(!_0x2d7c10[_0x7d8d('0x39')][_0x7d8d('0x40')](_0x7d8d('0x57'))){_0x2bae3b[_0x7d8d('0x23')]=qs[_0x7d8d('0x23')](_0x2d7c10[_0x7d8d('0x39')][_0x7d8d('0x23')]);_0x2bae3b['offset']=qs[_0x7d8d('0x22')](_0x2d7c10[_0x7d8d('0x39')][_0x7d8d('0x22')]);}return _0x3fae6e[_0x7d8d('0x63')](_0x2bae3b);}})[_0x7d8d('0x2b')](function(_0x4f8bc3){if(_0x4f8bc3){return _0x4f8bc3?{'count':_0x246e82,'rows':_0x4f8bc3}:null;}})[_0x7d8d('0x2b')](respondWithResult(_0x19e971,null))['catch'](handleError(_0x19e971,null));};exports[_0x7d8d('0x66')]=function(_0x490fa0,_0x1e9475,_0x313c03){var _0x2210fc=_0x490fa0[_0x7d8d('0x54')][_0x7d8d('0x67')];return db['Team'][_0x7d8d('0x48')]({'where':{'id':_0x2210fc},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7d8d('0x30'),_0x7d8d('0x68'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1b57ad){if(_0x1b57ad){var _0x142f1d=_[_0x7d8d('0x69')](_0x1b57ad,function(_0x3c71fc){var _0x53ba1b=_0x3c71fc[_0x7d8d('0x2d')]({'plain':!![]});return _0x53ba1b['Agents'];});return db[_0x7d8d('0x32')][_0x7d8d('0x4d')]({'where':{'id':_0x490fa0[_0x7d8d('0x4b')]['id']}})[_0x7d8d('0x2b')](function(_0x2d5a91){return db['sequelize']['transaction'](function(_0x5968bb){return _0x2d5a91[_0x7d8d('0x66')](_0x2210fc,{'transaction':_0x5968bb})[_0x7d8d('0x2b')](function(){return BPromise[_0x7d8d('0x6a')](_0x142f1d,function(_0x105eac){return db[_0x7d8d('0x56')][_0x7d8d('0x6b')]({'where':{'UserId':_0x105eac['id'],'WhatsappQueueId':_0x490fa0[_0x7d8d('0x4b')]['id']},'transaction':_0x5968bb});});})[_0x7d8d('0x2b')](function(){_0x142f1d[_0x7d8d('0x6c')](function(_0x671845){socket[_0x7d8d('0x6d')]('userWhatsappQueue:save',{'UserId':_0x671845['id'],'WhatsappQueueId':_0x2d5a91['id']});});});});});}})[_0x7d8d('0x2b')](respondWithStatusCode(_0x1e9475,null))[_0x7d8d('0x49')](handleError(_0x1e9475,null));};exports[_0x7d8d('0x6e')]=function(_0x10d701,_0xf60efd,_0x570f51){return db[_0x7d8d('0x65')][_0x7d8d('0x48')]({'where':{'id':_0x10d701['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf60efd,null))[_0x7d8d('0x2b')](function(_0x25ee9d){var _0x3597f4=_[_0x7d8d('0x38')](_0x25ee9d,'id');var _0x6791c0=[];var _0x269028=[];var _0xb9e37b=squel[_0x7d8d('0x6f')]();_0xb9e37b['field'](_0x7d8d('0x70'))[_0x7d8d('0x71')]('team_has_whatsapp_queues','tq')[_0x7d8d('0x72')](_0x7d8d('0x73'),'ut',_0x7d8d('0x74'))['where'](_0x7d8d('0x75'),_0x10d701[_0x7d8d('0x4b')]['id']);for(var _0x20cb56=0x0;_0x20cb56<_0x25ee9d['length'];_0x20cb56+=0x1){let _0x176239=_0x25ee9d[_0x20cb56];for(var _0x11e969=0x0;_0x11e969<_0x176239[_0x7d8d('0x76')][_0x7d8d('0x3f')];_0x11e969+=0x1){let _0x1e5bbe=_0x176239[_0x7d8d('0x76')][_0x11e969];var _0x194b8a=_0xb9e37b[_0x7d8d('0x77')]();_0x194b8a['where'](_0x7d8d('0x78'),_0x1e5bbe['id']);_0x269028[_0x7d8d('0x79')](db[_0x7d8d('0x7a')]['query'](_0x194b8a['toString'](),{'type':db[_0x7d8d('0x7a')][_0x7d8d('0x7b')][_0x7d8d('0x7c')]})[_0x7d8d('0x2b')](function(_0x43fa48){if(_0x43fa48['length']===0x1){return _0x1e5bbe['id'];}else{var _0x4e5bc4=_[_0x7d8d('0x7d')](_[_0x7d8d('0x38')](_0x43fa48,_0x7d8d('0x7e')),function(_0x2c60a5){return _[_0x7d8d('0x7f')](_0x3597f4,_0x2c60a5);});if(_0x4e5bc4){return _0x1e5bbe['id'];}}}));}}return BPromise[_0x7d8d('0x80')](_0x269028)[_0x7d8d('0x2b')](function(_0x55b9f3){_0x6791c0=_(_0x6791c0)[_0x7d8d('0x81')](_0x55b9f3)[_0x7d8d('0x82')]()['value']();return db['WhatsappQueue'][_0x7d8d('0x4d')]({'where':{'id':_0x10d701['params']['id']}})[_0x7d8d('0x2b')](function(_0xd99e1c){return db[_0x7d8d('0x7a')][_0x7d8d('0x83')](function(_0x293ddf){return _0xd99e1c[_0x7d8d('0x6e')](_0x10d701['query'][_0x7d8d('0x67')],{'transaction':_0x293ddf})[_0x7d8d('0x2b')](function(){if(!_['isEmpty'](_0x6791c0)){return _0xd99e1c[_0x7d8d('0x84')](_0x6791c0,{'transaction':_0x293ddf});}})[_0x7d8d('0x2b')](function(){_0x6791c0[_0x7d8d('0x6c')](function(_0x1f351c){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x1f351c,'WhatsappQueueId':_0xd99e1c['id']});});});});});});})[_0x7d8d('0x2b')](respondWithStatusCode(_0xf60efd,null))[_0x7d8d('0x49')](handleError(_0xf60efd,null));};exports[_0x7d8d('0x85')]=function(_0x4eab3a,_0x17a726,_0x3208f8){return db['WhatsappQueue'][_0x7d8d('0x4d')]({'where':{'id':_0x4eab3a[_0x7d8d('0x4b')]['id']}})[_0x7d8d('0x2b')](handleEntityNotFound(_0x17a726,null))[_0x7d8d('0x2b')](function(_0x10e608){if(_0x10e608){return _0x10e608[_0x7d8d('0x85')](_0x4eab3a['body'][_0x7d8d('0x67')],_[_0x7d8d('0x86')](_0x4eab3a[_0x7d8d('0x54')],[_0x7d8d('0x67'),'id'])||{})[_0x7d8d('0x87')](function(_0x90e60b){for(var _0xc6a09e=0x0;_0xc6a09e<_0x4eab3a[_0x7d8d('0x54')][_0x7d8d('0x67')][_0x7d8d('0x3f')];_0xc6a09e+=0x1){socket['emit'](_0x7d8d('0x88'),{'UserId':Number(_0x4eab3a[_0x7d8d('0x54')][_0x7d8d('0x67')][_0xc6a09e]),'WhatsappQueueId':Number(_0x4eab3a[_0x7d8d('0x4b')]['id'])});}return _0x90e60b;});}})[_0x7d8d('0x2b')](respondWithResult(_0x17a726,null))[_0x7d8d('0x49')](handleError(_0x17a726,null));};exports[_0x7d8d('0x84')]=function(_0x36a60a,_0x2a75c8,_0x21de4e){return db['WhatsappQueue'][_0x7d8d('0x4d')]({'where':{'id':_0x36a60a[_0x7d8d('0x4b')]['id']}})[_0x7d8d('0x2b')](handleEntityNotFound(_0x2a75c8,null))[_0x7d8d('0x2b')](function(_0x3a814a){if(_0x3a814a){return _0x3a814a[_0x7d8d('0x84')](_0x36a60a[_0x7d8d('0x39')][_0x7d8d('0x67')])[_0x7d8d('0x2b')](function(){if(_[_0x7d8d('0x89')](_0x36a60a[_0x7d8d('0x39')]['ids'])){for(var _0x313c75=0x0;_0x313c75<_0x36a60a[_0x7d8d('0x39')]['ids'][_0x7d8d('0x3f')];_0x313c75+=0x1){socket[_0x7d8d('0x6d')]('userWhatsappQueue:remove',{'UserId':Number(_0x36a60a[_0x7d8d('0x39')][_0x7d8d('0x67')][_0x313c75]),'WhatsappQueueId':Number(_0x36a60a[_0x7d8d('0x4b')]['id'])});}}else{socket[_0x7d8d('0x6d')](_0x7d8d('0x8a'),{'UserId':Number(_0x36a60a[_0x7d8d('0x39')]['ids']),'WhatsappQueueId':Number(_0x36a60a[_0x7d8d('0x4b')]['id'])});}});}})[_0x7d8d('0x2b')](respondWithStatusCode(_0x2a75c8,null))['catch'](handleError(_0x2a75c8,null));};exports[_0x7d8d('0x8b')]=function(_0xcb1a7f,_0x558a87,_0x76427){var _0x44a4c0={};var _0xf29927={};var _0x3554d6;var _0x1428b5;return db[_0x7d8d('0x32')]['findOne']({'where':{'id':_0xcb1a7f[_0x7d8d('0x4b')]['id']}})[_0x7d8d('0x2b')](handleEntityNotFound(_0x558a87,null))[_0x7d8d('0x2b')](function(_0x236601){if(_0x236601){_0x3554d6=_0x236601;_0xf29927[_0x7d8d('0x37')]=_[_0x7d8d('0x3a')](db[_0x7d8d('0x5a')]['rawAttributes']);_0xf29927[_0x7d8d('0x39')]=_['keys'](_0xcb1a7f[_0x7d8d('0x39')]);_0xf29927[_0x7d8d('0x3b')]=_[_0x7d8d('0x3c')](_0xf29927[_0x7d8d('0x37')],_0xf29927['query']);_0x44a4c0[_0x7d8d('0x3d')]=_['intersection'](_0xf29927[_0x7d8d('0x37')],qs[_0x7d8d('0x3e')](_0xcb1a7f['query'][_0x7d8d('0x3e')]));_0x44a4c0['attributes']=_0x44a4c0[_0x7d8d('0x3d')][_0x7d8d('0x3f')]?_0x44a4c0[_0x7d8d('0x3d')]:_0xf29927[_0x7d8d('0x37')];_0x44a4c0[_0x7d8d('0x41')]=qs[_0x7d8d('0x42')](_0xcb1a7f[_0x7d8d('0x39')][_0x7d8d('0x42')]);_0x44a4c0[_0x7d8d('0x43')]=qs[_0x7d8d('0x3b')](_[_0x7d8d('0x58')](_0xcb1a7f[_0x7d8d('0x39')],_0xf29927[_0x7d8d('0x3b')]));if(_0xcb1a7f['query'][_0x7d8d('0x44')]){_0x44a4c0[_0x7d8d('0x43')]=_[_0x7d8d('0x45')](_0x44a4c0[_0x7d8d('0x43')],{'$or':_[_0x7d8d('0x38')](_0x44a4c0['attributes'],function(_0x27a75f){var _0xdbc34e={};_0xdbc34e[_0x27a75f]={'$like':'%'+_0xcb1a7f['query'][_0x7d8d('0x44')]+'%'};return _0xdbc34e;})});}_0x44a4c0=_['merge']({},_0x44a4c0,_0xcb1a7f[_0x7d8d('0x4c')]);return _0x3554d6['getAgents'](_0x44a4c0);}})[_0x7d8d('0x2b')](function(_0xacaaf4){if(_0xacaaf4){_0x1428b5=_0xacaaf4[_0x7d8d('0x3f')];if(!_0xcb1a7f[_0x7d8d('0x39')][_0x7d8d('0x40')](_0x7d8d('0x57'))){_0x44a4c0['limit']=qs[_0x7d8d('0x23')](_0xcb1a7f[_0x7d8d('0x39')][_0x7d8d('0x23')]);_0x44a4c0['offset']=qs['offset'](_0xcb1a7f['query'][_0x7d8d('0x22')]);}return _0x3554d6[_0x7d8d('0x8b')](_0x44a4c0);}})[_0x7d8d('0x2b')](function(_0x133191){if(_0x133191){return _0x133191?{'count':_0x1428b5,'rows':_0x133191}:null;}})['then'](respondWithResult(_0x558a87,null))[_0x7d8d('0x49')](handleError(_0x558a87,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9316af9..d529d3d 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 _0x16c9=['remove','emit','hook','events','WhatsappQueue','setMaxListeners','save','update'];(function(_0xb27038,_0x168df8){var _0x329900=function(_0x4440f3){while(--_0x4440f3){_0xb27038['push'](_0xb27038['shift']());}};_0x329900(++_0x168df8);}(_0x16c9,0xd3));var _0x916c=function(_0x5b8cf5,_0x21eab0){_0x5b8cf5=_0x5b8cf5-0x0;var _0x5bce68=_0x16c9[_0x5b8cf5];return _0x5bce68;};'use strict';var EventEmitter=require(_0x916c('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x916c('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x916c('0x2')](0x0);var events={'afterCreate':_0x916c('0x3'),'afterUpdate':_0x916c('0x4'),'afterDestroy':_0x916c('0x5')};function emitEvent(_0x4dcd50){return function(_0x630e57,_0x27385e,_0x2988f7){WhatsappQueueEvents[_0x916c('0x6')](_0x4dcd50+':'+_0x630e57['id'],_0x630e57);WhatsappQueueEvents['emit'](_0x4dcd50,_0x630e57);_0x2988f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x916c('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xd4ed=['hook','exports','events','../../mysqldb','WhatsappQueue','remove','hasOwnProperty'];(function(_0x1c0b4e,_0x1aa303){var _0x5681a5=function(_0x288855){while(--_0x288855){_0x1c0b4e['push'](_0x1c0b4e['shift']());}};_0x5681a5(++_0x1aa303);}(_0xd4ed,0x10c));var _0xdd4e=function(_0x57af2f,_0x7cbe2c){_0x57af2f=_0x57af2f-0x0;var _0x1f6295=_0xd4ed[_0x57af2f];return _0x1f6295;};'use strict';var EventEmitter=require(_0xdd4e('0x0'));var WhatsappQueue=require(_0xdd4e('0x1'))['db'][_0xdd4e('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdd4e('0x3')};function emitEvent(_0x5ad5e0){return function(_0x4fc07e,_0x26281c,_0x33cfed){WhatsappQueueEvents['emit'](_0x5ad5e0+':'+_0x4fc07e['id'],_0x4fc07e);WhatsappQueueEvents['emit'](_0x5ad5e0,_0x4fc07e);_0x33cfed(null);};}for(var e in events){if(events[_0xdd4e('0x4')](e)){var event=events[e];WhatsappQueue[_0xdd4e('0x5')](e,emitEvent(event));}}module[_0xdd4e('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index dbb447b..4b63926 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 _0x0ca8=['exports','define','whatsapp_queues','lodash','util','../../config/logger','api','moment','path','rimraf','./whatsappQueue.attributes'];(function(_0x2aba94,_0x52e54a){var _0x2c5874=function(_0x400bd7){while(--_0x400bd7){_0x2aba94['push'](_0x2aba94['shift']());}};_0x2c5874(++_0x52e54a);}(_0x0ca8,0x92));var _0x80ca=function(_0x1c2d9a,_0x4e34a4){_0x1c2d9a=_0x1c2d9a-0x0;var _0x24def0=_0x0ca8[_0x1c2d9a];return _0x24def0;};'use strict';var _=require(_0x80ca('0x0'));var util=require(_0x80ca('0x1'));var logger=require(_0x80ca('0x2'))(_0x80ca('0x3'));var moment=require(_0x80ca('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x80ca('0x5'));var rimraf=require(_0x80ca('0x6'));var config=require('../../config/environment');var attributes=require(_0x80ca('0x7'));module[_0x80ca('0x8')]=function(_0x241f59,_0x55e91c){return _0x241f59[_0x80ca('0x9')]('WhatsappQueue',attributes,{'tableName':_0x80ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7330=['request-promise','path','rimraf','exports','define','WhatsappQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0xb09943,_0x4ac90c){var _0x110eb1=function(_0x294c1a){while(--_0x294c1a){_0xb09943['push'](_0xb09943['shift']());}};_0x110eb1(++_0x4ac90c);}(_0x7330,0x166));var _0x0733=function(_0x4fa63e,_0x323098){_0x4fa63e=_0x4fa63e-0x0;var _0x4202c1=_0x7330[_0x4fa63e];return _0x4202c1;};'use strict';var _=require(_0x0733('0x0'));var util=require(_0x0733('0x1'));var logger=require(_0x0733('0x2'))('api');var moment=require(_0x0733('0x3'));var BPromise=require(_0x0733('0x4'));var rp=require(_0x0733('0x5'));var fs=require('fs');var path=require(_0x0733('0x6'));var rimraf=require(_0x0733('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x0733('0x8')]=function(_0x5cac5a,_0x16907b){return _0x5cac5a[_0x0733('0x9')](_0x0733('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 5943282..e2b5964 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 _0xd452=['client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','findAll','options','raw','where','limit','map','include','model','attributes','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue','find','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd452,0xba));var _0x2d45=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xd452[_0x2df724];return _0x1b2504;};'use strict';var _=require(_0x2d45('0x0'));var util=require('util');var moment=require(_0x2d45('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d45('0x2'));var fs=require('fs');var Redis=require(_0x2d45('0x3'));var db=require(_0x2d45('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d45('0x5'))(_0x2d45('0x6'));var config=require(_0x2d45('0x7'));var jayson=require(_0x2d45('0x8'));var client=jayson[_0x2d45('0x9')][_0x2d45('0xa')]({'port':0x232a});config[_0x2d45('0xb')]=_[_0x2d45('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2d45('0xd'))(new Redis(config['redis']));require(_0x2d45('0xe'))['register'](socket);function respondWithRpcPromise(_0x5366c0,_0x199862,_0x5b3669){return new BPromise(function(_0x12c51e,_0x4ccdf8){return client['request'](_0x5366c0,_0x5b3669)[_0x2d45('0xf')](function(_0x56e429){logger[_0x2d45('0x10')](_0x2d45('0x11'),_0x199862,_0x2d45('0x12'));logger[_0x2d45('0x13')](_0x2d45('0x14'),_0x199862,'request\x20sent',JSON['stringify'](_0x56e429));if(_0x56e429[_0x2d45('0x15')]){if(_0x56e429[_0x2d45('0x15')]['code']===0x1f4){logger[_0x2d45('0x15')](_0x2d45('0x11'),_0x199862,_0x56e429[_0x2d45('0x15')][_0x2d45('0x16')]);return _0x4ccdf8(_0x56e429['error'][_0x2d45('0x16')]);}logger[_0x2d45('0x15')](_0x2d45('0x11'),_0x199862,_0x56e429[_0x2d45('0x15')][_0x2d45('0x16')]);return _0x12c51e(_0x56e429[_0x2d45('0x15')][_0x2d45('0x16')]);}else{logger[_0x2d45('0x10')](_0x2d45('0x11'),_0x199862,_0x2d45('0x12'));_0x12c51e(_0x56e429[_0x2d45('0x17')][_0x2d45('0x16')]);}})[_0x2d45('0x18')](function(_0xf1f845){logger[_0x2d45('0x15')](_0x2d45('0x11'),_0x199862,_0xf1f845);_0x4ccdf8(_0xf1f845);});});}exports['GetWhatsappQueue']=function(_0x2ad56e){var _0x18d2b5=this;return new Promise(function(_0x229f13,_0x585050){return db['WhatsappQueue'][_0x2d45('0x19')]({'raw':_0x2ad56e[_0x2d45('0x1a')]?_0x2ad56e[_0x2d45('0x1a')][_0x2d45('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ad56e[_0x2d45('0x1a')]?_0x2ad56e[_0x2d45('0x1a')][_0x2d45('0x1c')]||null:null,'attributes':_0x2ad56e[_0x2d45('0x1a')]?_0x2ad56e['options']['attributes']||null:null,'limit':_0x2ad56e['options']?_0x2ad56e[_0x2d45('0x1a')][_0x2d45('0x1d')]||null:null,'include':_0x2ad56e[_0x2d45('0x1a')]?_0x2ad56e[_0x2d45('0x1a')]['include']?_[_0x2d45('0x1e')](_0x2ad56e['options'][_0x2d45('0x1f')],function(_0x48d15f){return{'model':db[_0x48d15f[_0x2d45('0x20')]],'as':_0x48d15f['as'],'attributes':_0x48d15f[_0x2d45('0x21')],'include':_0x48d15f[_0x2d45('0x1f')]?_[_0x2d45('0x1e')](_0x48d15f[_0x2d45('0x1f')],function(_0x8a661c){return{'model':db[_0x8a661c[_0x2d45('0x20')]],'as':_0x8a661c['as'],'attributes':_0x8a661c['attributes'],'include':_0x8a661c[_0x2d45('0x1f')]?_[_0x2d45('0x1e')](_0x8a661c['include'],function(_0x4b1c98){return{'model':db[_0x4b1c98[_0x2d45('0x20')]],'as':_0x4b1c98['as'],'attributes':_0x4b1c98['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b9ad1){logger[_0x2d45('0x10')](_0x2d45('0x22'),_0x2ad56e);logger[_0x2d45('0x13')](_0x2d45('0x22'),_0x2ad56e,JSON['stringify'](_0x5b9ad1));_0x229f13(_0x5b9ad1);})[_0x2d45('0x18')](function(_0x406897){logger[_0x2d45('0x15')](_0x2d45('0x22'),_0x406897[_0x2d45('0x16')],_0x2ad56e);_0x585050(_0x18d2b5[_0x2d45('0x15')](0x1f4,_0x406897[_0x2d45('0x16')]));});});};exports[_0x2d45('0x23')]=function(_0x16d656){var _0x3a810d=this;return new Promise(function(_0x2f8378,_0xb748c7){return db[_0x2d45('0x24')][_0x2d45('0x25')]({'raw':_0x16d656[_0x2d45('0x1a')]?_0x16d656['options'][_0x2d45('0x1b')]===undefined?!![]:![]:!![],'where':_0x16d656[_0x2d45('0x1a')]?_0x16d656[_0x2d45('0x1a')][_0x2d45('0x1c')]||null:null,'attributes':_0x16d656['options']?_0x16d656['options'][_0x2d45('0x21')]||null:null,'include':_0x16d656['options']?_0x16d656[_0x2d45('0x1a')][_0x2d45('0x1f')]?_[_0x2d45('0x1e')](_0x16d656[_0x2d45('0x1a')]['include'],function(_0x1a03a5){return{'model':db[_0x1a03a5['model']],'as':_0x1a03a5['as'],'attributes':_0x1a03a5[_0x2d45('0x21')],'include':_0x1a03a5[_0x2d45('0x1f')]?_['map'](_0x1a03a5[_0x2d45('0x1f')],function(_0x2f72f6){return{'model':db[_0x2f72f6['model']],'as':_0x2f72f6['as'],'attributes':_0x2f72f6[_0x2d45('0x21')],'include':_0x2f72f6[_0x2d45('0x1f')]?_[_0x2d45('0x1e')](_0x2f72f6['include'],function(_0x5c9157){return{'model':db[_0x5c9157[_0x2d45('0x20')]],'as':_0x5c9157['as'],'attributes':_0x5c9157[_0x2d45('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2d45('0xf')](function(_0x24c18a){logger[_0x2d45('0x10')](_0x2d45('0x23'),_0x16d656);logger[_0x2d45('0x13')](_0x2d45('0x23'),_0x16d656,JSON[_0x2d45('0x26')](_0x24c18a));_0x2f8378(_0x24c18a);})['catch'](function(_0x4da027){logger[_0x2d45('0x15')]('ShowWhatsappQueue',_0x4da027[_0x2d45('0x16')],_0x16d656);_0xb748c7(_0x3a810d['error'](0x1f4,_0x4da027[_0x2d45('0x16')]));});});}; \ No newline at end of file +var _0xb221=['model','debug','catch','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','raw','options','where','attributes','limit','include','map'];(function(_0x5eb737,_0x4601da){var _0x5bc9e6=function(_0x17e09e){while(--_0x17e09e){_0x5eb737['push'](_0x5eb737['shift']());}};_0x5bc9e6(++_0x4601da);}(_0xb221,0x16d));var _0x1b22=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xb221[_0x43e4b3];return _0x10c655;};'use strict';var _=require(_0x1b22('0x0'));var util=require(_0x1b22('0x1'));var moment=require(_0x1b22('0x2'));var BPromise=require(_0x1b22('0x3'));var rs=require(_0x1b22('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b22('0x5'))['db'];var utils=require(_0x1b22('0x6'));var logger=require(_0x1b22('0x7'))(_0x1b22('0x8'));var config=require(_0x1b22('0x9'));var jayson=require(_0x1b22('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x1b22('0xb')]=_[_0x1b22('0xc')](config[_0x1b22('0xb')],{'host':_0x1b22('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b22('0xb')]));require('./whatsappQueue.socket')[_0x1b22('0xe')](socket);function respondWithRpcPromise(_0x40fd01,_0x6ae1c,_0x53fdd8){return new BPromise(function(_0x513ebb,_0x2e8bc6){return client[_0x1b22('0xf')](_0x40fd01,_0x53fdd8)[_0x1b22('0x10')](function(_0x49d5b0){logger[_0x1b22('0x11')](_0x1b22('0x12'),_0x6ae1c,_0x1b22('0x13'));logger['debug'](_0x1b22('0x14'),_0x6ae1c,'request\x20sent',JSON[_0x1b22('0x15')](_0x49d5b0));if(_0x49d5b0[_0x1b22('0x16')]){if(_0x49d5b0[_0x1b22('0x16')][_0x1b22('0x17')]===0x1f4){logger[_0x1b22('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x6ae1c,_0x49d5b0[_0x1b22('0x16')][_0x1b22('0x18')]);return _0x2e8bc6(_0x49d5b0[_0x1b22('0x16')]['message']);}logger[_0x1b22('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x6ae1c,_0x49d5b0['error'][_0x1b22('0x18')]);return _0x513ebb(_0x49d5b0['error'][_0x1b22('0x18')]);}else{logger[_0x1b22('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x6ae1c,'request\x20sent');_0x513ebb(_0x49d5b0[_0x1b22('0x19')][_0x1b22('0x18')]);}})['catch'](function(_0x4e09cd){logger[_0x1b22('0x16')](_0x1b22('0x12'),_0x6ae1c,_0x4e09cd);_0x2e8bc6(_0x4e09cd);});});}exports[_0x1b22('0x1a')]=function(_0x3b25ac){var _0x355088=this;return new Promise(function(_0x456571,_0x1e8a03){return db[_0x1b22('0x1b')]['findAll']({'raw':_0x3b25ac['options']?_0x3b25ac['options'][_0x1b22('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b25ac[_0x1b22('0x1d')]?_0x3b25ac[_0x1b22('0x1d')][_0x1b22('0x1e')]||null:null,'attributes':_0x3b25ac[_0x1b22('0x1d')]?_0x3b25ac[_0x1b22('0x1d')][_0x1b22('0x1f')]||null:null,'limit':_0x3b25ac[_0x1b22('0x1d')]?_0x3b25ac[_0x1b22('0x1d')][_0x1b22('0x20')]||null:null,'include':_0x3b25ac[_0x1b22('0x1d')]?_0x3b25ac[_0x1b22('0x1d')][_0x1b22('0x21')]?_[_0x1b22('0x22')](_0x3b25ac[_0x1b22('0x1d')][_0x1b22('0x21')],function(_0x3dd824){return{'model':db[_0x3dd824[_0x1b22('0x23')]],'as':_0x3dd824['as'],'attributes':_0x3dd824[_0x1b22('0x1f')],'include':_0x3dd824[_0x1b22('0x21')]?_[_0x1b22('0x22')](_0x3dd824[_0x1b22('0x21')],function(_0x246551){return{'model':db[_0x246551[_0x1b22('0x23')]],'as':_0x246551['as'],'attributes':_0x246551[_0x1b22('0x1f')],'include':_0x246551[_0x1b22('0x21')]?_[_0x1b22('0x22')](_0x246551['include'],function(_0x2a6c4c){return{'model':db[_0x2a6c4c[_0x1b22('0x23')]],'as':_0x2a6c4c['as'],'attributes':_0x2a6c4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x296b3e){logger['info'](_0x1b22('0x1a'),_0x3b25ac);logger[_0x1b22('0x24')](_0x1b22('0x1a'),_0x3b25ac,JSON[_0x1b22('0x15')](_0x296b3e));_0x456571(_0x296b3e);})[_0x1b22('0x25')](function(_0x1af883){logger['error']('GetWhatsappQueue',_0x1af883[_0x1b22('0x18')],_0x3b25ac);_0x1e8a03(_0x355088[_0x1b22('0x16')](0x1f4,_0x1af883[_0x1b22('0x18')]));});});};exports[_0x1b22('0x26')]=function(_0x2fcc76){var _0xfcaa2b=this;return new Promise(function(_0x29585b,_0x3fb5fc){return db[_0x1b22('0x1b')][_0x1b22('0x27')]({'raw':_0x2fcc76[_0x1b22('0x1d')]?_0x2fcc76['options'][_0x1b22('0x1c')]===undefined?!![]:![]:!![],'where':_0x2fcc76[_0x1b22('0x1d')]?_0x2fcc76['options'][_0x1b22('0x1e')]||null:null,'attributes':_0x2fcc76['options']?_0x2fcc76['options'][_0x1b22('0x1f')]||null:null,'include':_0x2fcc76[_0x1b22('0x1d')]?_0x2fcc76[_0x1b22('0x1d')][_0x1b22('0x21')]?_[_0x1b22('0x22')](_0x2fcc76[_0x1b22('0x1d')][_0x1b22('0x21')],function(_0x376a68){return{'model':db[_0x376a68[_0x1b22('0x23')]],'as':_0x376a68['as'],'attributes':_0x376a68[_0x1b22('0x1f')],'include':_0x376a68['include']?_[_0x1b22('0x22')](_0x376a68[_0x1b22('0x21')],function(_0x463fd4){return{'model':db[_0x463fd4[_0x1b22('0x23')]],'as':_0x463fd4['as'],'attributes':_0x463fd4[_0x1b22('0x1f')],'include':_0x463fd4[_0x1b22('0x21')]?_[_0x1b22('0x22')](_0x463fd4['include'],function(_0x107482){return{'model':db[_0x107482['model']],'as':_0x107482['as'],'attributes':_0x107482[_0x1b22('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b03b0){logger[_0x1b22('0x11')](_0x1b22('0x26'),_0x2fcc76);logger['debug'](_0x1b22('0x26'),_0x2fcc76,JSON[_0x1b22('0x15')](_0x4b03b0));_0x29585b(_0x4b03b0);})[_0x1b22('0x25')](function(_0x7a3f17){logger[_0x1b22('0x16')](_0x1b22('0x26'),_0x7a3f17[_0x1b22('0x18')],_0x2fcc76);_0x3fb5fc(_0xfcaa2b[_0x1b22('0x16')](0x1f4,_0x7a3f17[_0x1b22('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8f18cce..27e0bdd 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 _0x3329=['removeListener','register','length','whatsappQueue:','save','remove','update','emit'];(function(_0x3de23d,_0x136075){var _0x5acbd9=function(_0x15b871){while(--_0x15b871){_0x3de23d['push'](_0x3de23d['shift']());}};_0x5acbd9(++_0x136075);}(_0x3329,0xac));var _0x9332=function(_0x716991,_0x39e69f){_0x716991=_0x716991-0x0;var _0x452f6d=_0x3329[_0x716991];return _0x452f6d;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x9332('0x0'),_0x9332('0x1'),_0x9332('0x2')];function createListener(_0x404694,_0x43979e){return function(_0x4c600c){_0x43979e[_0x9332('0x3')](_0x404694,_0x4c600c);};}function removeListener(_0x130709,_0x54f476){return function(){WhatsappQueueEvents[_0x9332('0x4')](_0x130709,_0x54f476);};}exports[_0x9332('0x5')]=function(_0x25365d){for(var _0x38ab1c=0x0,_0x1fe6bc=events[_0x9332('0x6')];_0x38ab1c<_0x1fe6bc;_0x38ab1c++){var _0x99b758=events[_0x38ab1c];var _0x1043b0=createListener(_0x9332('0x7')+_0x99b758,_0x25365d);WhatsappQueueEvents['on'](_0x99b758,_0x1043b0);}}; \ No newline at end of file +var _0x36a4=['register','whatsappQueue:','save','remove','emit','removeListener'];(function(_0x3c2850,_0x506c72){var _0x528228=function(_0x2642e5){while(--_0x2642e5){_0x3c2850['push'](_0x3c2850['shift']());}};_0x528228(++_0x506c72);}(_0x36a4,0x13a));var _0x436a=function(_0x1ddde2,_0x4d8814){_0x1ddde2=_0x1ddde2-0x0;var _0x32fb62=_0x36a4[_0x1ddde2];return _0x32fb62;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x436a('0x0'),_0x436a('0x1'),'update'];function createListener(_0x1b8e97,_0x2f1f7f){return function(_0x4b4570){_0x2f1f7f[_0x436a('0x2')](_0x1b8e97,_0x4b4570);};}function removeListener(_0x414d67,_0x55b262){return function(){WhatsappQueueEvents[_0x436a('0x3')](_0x414d67,_0x55b262);};}exports[_0x436a('0x4')]=function(_0x2aec8f){for(var _0x764a30=0x0,_0x5b500f=events['length'];_0x764a30<_0x5b500f;_0x764a30++){var _0x409bc2=events[_0x764a30];var _0x494781=createListener(_0x436a('0x5')+_0x409bc2,_0x2aec8f);WhatsappQueueEvents['on'](_0x409bc2,_0x494781);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a23aec7..f7c84d1 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 _0x8620=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x3f4471,_0x1cc8be){var _0x16c1f7=function(_0x5891cc){while(--_0x5891cc){_0x3f4471['push'](_0x3f4471['shift']());}};_0x16c1f7(++_0x1cc8be);}(_0x8620,0x178));var _0x0862=function(_0x4b223c,_0x112aca){_0x4b223c=_0x4b223c-0x0;var _0x21d0bf=_0x8620[_0x4b223c];return _0x21d0bf;};'use strict';var multer=require(_0x0862('0x0'));var util=require(_0x0862('0x1'));var path=require(_0x0862('0x2'));var timeout=require('connect-timeout');var express=require(_0x0862('0x3'));var router=express['Router']();var fs_extra=require(_0x0862('0x4'));var auth=require(_0x0862('0x5'));var interaction=require(_0x0862('0x6'));var config=require(_0x0862('0x7'));var controller=require(_0x0862('0x8'));router[_0x0862('0x9')]('/',auth[_0x0862('0xa')](),controller['index']);router[_0x0862('0x9')](_0x0862('0xb'),auth['isAuthenticated'](),controller[_0x0862('0xc')]);router[_0x0862('0x9')](_0x0862('0xd'),auth[_0x0862('0xa')](),controller[_0x0862('0xe')]);router[_0x0862('0xf')]('/',auth[_0x0862('0xa')](),controller[_0x0862('0x10')]);router[_0x0862('0x11')](_0x0862('0xd'),auth['isAuthenticated'](),controller[_0x0862('0x12')]);router['delete'](_0x0862('0xd'),auth[_0x0862('0xa')](),controller[_0x0862('0x13')]);module[_0x0862('0x14')]=router; \ No newline at end of file +var _0xf039=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x550060,_0x146ef4){var _0x4c4afe=function(_0x59cd8e){while(--_0x59cd8e){_0x550060['push'](_0x550060['shift']());}};_0x4c4afe(++_0x146ef4);}(_0xf039,0x1e1));var _0x9f03=function(_0x409b2f,_0x35621c){_0x409b2f=_0x409b2f-0x0;var _0x3fb528=_0xf039[_0x409b2f];return _0x3fb528;};'use strict';var multer=require(_0x9f03('0x0'));var util=require(_0x9f03('0x1'));var path=require(_0x9f03('0x2'));var timeout=require(_0x9f03('0x3'));var express=require(_0x9f03('0x4'));var router=express[_0x9f03('0x5')]();var fs_extra=require(_0x9f03('0x6'));var auth=require(_0x9f03('0x7'));var interaction=require(_0x9f03('0x8'));var config=require('../../config/environment');var controller=require(_0x9f03('0x9'));router['get']('/',auth[_0x9f03('0xa')](),controller['index']);router[_0x9f03('0xb')](_0x9f03('0xc'),auth[_0x9f03('0xa')](),controller[_0x9f03('0xd')]);router[_0x9f03('0xb')](_0x9f03('0xe'),auth[_0x9f03('0xa')](),controller[_0x9f03('0xf')]);router['post']('/',auth[_0x9f03('0xa')](),controller[_0x9f03('0x10')]);router[_0x9f03('0x11')]('/:id',auth[_0x9f03('0xa')](),controller[_0x9f03('0x12')]);router[_0x9f03('0x13')]('/:id',auth[_0x9f03('0xa')](),controller[_0x9f03('0x14')]);module[_0x9f03('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 14112db..f75fccb 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(_0x3ec54c,_0x203cf1){var _0x35e31b=function(_0x1730c5){while(--_0x1730c5){_0x3ec54c['push'](_0x3ec54c['shift']());}};_0x35e31b(++_0x203cf1);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x2161fd,_0x32be8d){var _0x9304b4=function(_0x3622bd){while(--_0x3622bd){_0x2161fd['push'](_0x2161fd['shift']());}};_0x9304b4(++_0x32be8d);}(_0x7a54,0x106));var _0x47a5=function(_0x38e45d,_0xc3130){_0x38e45d=_0x38e45d-0x0;var _0x5d166d=_0x7a54[_0x38e45d];return _0x5d166d;};'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 887ce06..fe068e3 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 _0x34b7=['WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','show','params','includeAll','include','find','catch','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../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','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x34b7,0x196));var _0x734b=function(_0x4b7af6,_0x2bb0cd){_0x4b7af6=_0x4b7af6-0x0;var _0x4215b5=_0x34b7[_0x4b7af6];return _0x4215b5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x26')]();});}};}function handleEntityNotFound(_0x3abbe6,_0x44ffa9){return function(_0x148abe){if(!_0x148abe){_0x3abbe6[_0x734b('0x18')](0x194);}return _0x148abe;};}function handleError(_0x566d55,_0x49732b){_0x49732b=_0x49732b||0x1f4;return function(_0x13cc5a){logger[_0x734b('0x27')](_0x13cc5a['stack']);if(_0x13cc5a[_0x734b('0x28')]){delete _0x13cc5a[_0x734b('0x28')];}_0x566d55[_0x734b('0x19')](_0x49732b)[_0x734b('0x29')](_0x13cc5a);};}exports[_0x734b('0x2a')]=function(_0x1b8295,_0x3ba39c){var _0x5c6c5d={},_0x1f3652={},_0x436efe={'count':0x0,'rows':[]};var _0x42e9ae=_[_0x734b('0x2b')](db[_0x734b('0x2c')][_0x734b('0x2d')],function(_0x1fed72){return{'name':_0x1fed72[_0x734b('0x2e')],'type':_0x1fed72[_0x734b('0x2f')][_0x734b('0x30')]};});_0x1f3652['model']=_[_0x734b('0x2b')](_0x42e9ae,_0x734b('0x28'));_0x1f3652['query']=_[_0x734b('0x31')](_0x1b8295[_0x734b('0x32')]);_0x1f3652[_0x734b('0x33')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x35')],_0x1f3652[_0x734b('0x32')]);_0x5c6c5d[_0x734b('0x36')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x35')],qs[_0x734b('0x37')](_0x1b8295[_0x734b('0x32')][_0x734b('0x37')]));_0x5c6c5d[_0x734b('0x36')]=_0x5c6c5d[_0x734b('0x36')][_0x734b('0x38')]?_0x5c6c5d['attributes']:_0x1f3652[_0x734b('0x35')];if(!_0x1b8295['query'][_0x734b('0x39')](_0x734b('0x3a'))){_0x5c6c5d[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x1b8295[_0x734b('0x32')][_0x734b('0x1e')]);_0x5c6c5d['offset']=qs['offset'](_0x1b8295[_0x734b('0x32')]['offset']);}_0x5c6c5d[_0x734b('0x3b')]=qs['sort'](_0x1b8295[_0x734b('0x32')]['sort']);_0x5c6c5d[_0x734b('0x3c')]=qs['filters'](_[_0x734b('0x3d')](_0x1b8295[_0x734b('0x32')],_0x1f3652[_0x734b('0x33')]),_0x42e9ae);if(_0x1b8295[_0x734b('0x32')][_0x734b('0x3e')]){_0x5c6c5d[_0x734b('0x3c')]=_[_0x734b('0x3f')](_0x5c6c5d['where'],{'$or':_[_0x734b('0x2b')](_0x42e9ae,function(_0x317d32){if(_0x317d32['type']!==_0x734b('0x40')){var _0x309b31={};_0x309b31[_0x317d32[_0x734b('0x28')]]={'$like':'%'+_0x1b8295[_0x734b('0x32')]['filter']+'%'};return _0x309b31;}})});}_0x5c6c5d=_[_0x734b('0x3f')]({},_0x5c6c5d,_0x1b8295[_0x734b('0x41')]);var _0x4efb1f={'where':_0x5c6c5d[_0x734b('0x3c')]};return db[_0x734b('0x2c')]['count'](_0x4efb1f)[_0x734b('0x24')](function(_0x2d8f31){_0x436efe[_0x734b('0x1d')]=_0x2d8f31;if(_0x1b8295[_0x734b('0x32')]['includeAll']){_0x5c6c5d['include']=[{'all':!![]}];}return db[_0x734b('0x2c')]['findAll'](_0x5c6c5d);})['then'](function(_0x121a00){_0x436efe['rows']=_0x121a00;return _0x436efe;})[_0x734b('0x24')](respondWithFilteredResult(_0x3ba39c,_0x5c6c5d))['catch'](handleError(_0x3ba39c,null));};exports[_0x734b('0x42')]=function(_0x337106,_0xe4fe38){var _0x4c3fdc={'raw':!![],'where':{'id':_0x337106[_0x734b('0x43')]['id']}},_0x5cf3a0={};_0x5cf3a0['model']=_['keys'](db[_0x734b('0x2c')][_0x734b('0x2d')]);_0x5cf3a0['query']=_[_0x734b('0x31')](_0x337106['query']);_0x5cf3a0[_0x734b('0x33')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x35')],_0x5cf3a0['query']);_0x4c3fdc[_0x734b('0x36')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x35')],qs[_0x734b('0x37')](_0x337106['query']['fields']));_0x4c3fdc['attributes']=_0x4c3fdc[_0x734b('0x36')]['length']?_0x4c3fdc['attributes']:_0x5cf3a0[_0x734b('0x35')];if(_0x337106['query'][_0x734b('0x44')]){_0x4c3fdc[_0x734b('0x45')]=[{'all':!![]}];}_0x4c3fdc=_[_0x734b('0x3f')]({},_0x4c3fdc,_0x337106[_0x734b('0x41')]);return db['WhatsappQueueReport'][_0x734b('0x46')](_0x4c3fdc)['then'](handleEntityNotFound(_0xe4fe38,null))[_0x734b('0x24')](respondWithResult(_0xe4fe38,null))[_0x734b('0x47')](handleError(_0xe4fe38,null));};exports[_0x734b('0x48')]=function(_0x5cdacb,_0x370326){return db['WhatsappQueueReport'][_0x734b('0x48')](_0x5cdacb[_0x734b('0x49')],{})['then'](respondWithResult(_0x370326,0xc9))[_0x734b('0x47')](handleError(_0x370326,null));};exports[_0x734b('0x4a')]=function(_0x145ced,_0x38125a){if(_0x145ced[_0x734b('0x49')]['id']){delete _0x145ced['body']['id'];}return db[_0x734b('0x2c')]['find']({'where':{'id':_0x145ced[_0x734b('0x43')]['id']}})['then'](handleEntityNotFound(_0x38125a,null))[_0x734b('0x24')](saveUpdates(_0x145ced[_0x734b('0x49')],null))[_0x734b('0x24')](respondWithResult(_0x38125a,null))[_0x734b('0x47')](handleError(_0x38125a,null));};exports[_0x734b('0x25')]=function(_0x4b70f2,_0x4c0378){return db['WhatsappQueueReport'][_0x734b('0x46')]({'where':{'id':_0x4b70f2[_0x734b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c0378,null))[_0x734b('0x24')](removeEntity(_0x4c0378,null))[_0x734b('0x47')](handleError(_0x4c0378,null));};exports['describe']=function(_0x167173,_0x3a9749){return db[_0x734b('0x2c')]['describe']()[_0x734b('0x24')](respondWithResult(_0x3a9749,null))[_0x734b('0x47')](handleError(_0x3a9749,null));}; \ No newline at end of file +var _0x4cf8=['limit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','merge','find','create','body','params','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x4cf8[_0x8b0f43];return _0x3f4425;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){_0x29e9e1[_0x84cf('0x19')](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x1d220a,_0x44d4bf){return function(_0x3c7eda){if(!_0x3c7eda){_0x1d220a[_0x84cf('0x18')](0x194);}return _0x3c7eda;};}function handleError(_0x401aa4,_0x6797c0){_0x6797c0=_0x6797c0||0x1f4;return function(_0x5179c1){logger[_0x84cf('0x27')](_0x5179c1[_0x84cf('0x28')]);if(_0x5179c1[_0x84cf('0x29')]){delete _0x5179c1[_0x84cf('0x29')];}_0x401aa4['status'](_0x6797c0)[_0x84cf('0x2a')](_0x5179c1);};}exports['index']=function(_0x29455e,_0x4092fd){var _0x43b41b={},_0xc15298={},_0x51adcf={'count':0x0,'rows':[]};var _0x20de4b=_[_0x84cf('0x2b')](db[_0x84cf('0x2c')][_0x84cf('0x2d')],function(_0xb4fc5a){return{'name':_0xb4fc5a[_0x84cf('0x2e')],'type':_0xb4fc5a[_0x84cf('0x2f')][_0x84cf('0x30')]};});_0xc15298[_0x84cf('0x31')]=_['map'](_0x20de4b,'name');_0xc15298[_0x84cf('0x32')]=_[_0x84cf('0x33')](_0x29455e[_0x84cf('0x32')]);_0xc15298[_0x84cf('0x34')]=_[_0x84cf('0x35')](_0xc15298[_0x84cf('0x31')],_0xc15298[_0x84cf('0x32')]);_0x43b41b[_0x84cf('0x36')]=_['intersection'](_0xc15298[_0x84cf('0x31')],qs[_0x84cf('0x37')](_0x29455e['query'][_0x84cf('0x37')]));_0x43b41b['attributes']=_0x43b41b[_0x84cf('0x36')][_0x84cf('0x38')]?_0x43b41b[_0x84cf('0x36')]:_0xc15298[_0x84cf('0x31')];if(!_0x29455e[_0x84cf('0x32')]['hasOwnProperty'](_0x84cf('0x39'))){_0x43b41b['limit']=qs['limit'](_0x29455e[_0x84cf('0x32')][_0x84cf('0x3a')]);_0x43b41b['offset']=qs[_0x84cf('0x1c')](_0x29455e[_0x84cf('0x32')][_0x84cf('0x1c')]);}_0x43b41b[_0x84cf('0x3b')]=qs[_0x84cf('0x3c')](_0x29455e[_0x84cf('0x32')]['sort']);_0x43b41b[_0x84cf('0x3d')]=qs[_0x84cf('0x34')](_[_0x84cf('0x3e')](_0x29455e[_0x84cf('0x32')],_0xc15298[_0x84cf('0x34')]),_0x20de4b);if(_0x29455e[_0x84cf('0x32')]['filter']){_0x43b41b[_0x84cf('0x3d')]=_['merge'](_0x43b41b[_0x84cf('0x3d')],{'$or':_[_0x84cf('0x2b')](_0x20de4b,function(_0x3fa39a){if(_0x3fa39a[_0x84cf('0x2f')]!==_0x84cf('0x3f')){var _0x3897b0={};_0x3897b0[_0x3fa39a[_0x84cf('0x29')]]={'$like':'%'+_0x29455e[_0x84cf('0x32')][_0x84cf('0x40')]+'%'};return _0x3897b0;}})});}_0x43b41b=_['merge']({},_0x43b41b,_0x29455e[_0x84cf('0x41')]);var _0x516928={'where':_0x43b41b[_0x84cf('0x3d')]};return db[_0x84cf('0x2c')]['count'](_0x516928)[_0x84cf('0x25')](function(_0x531410){_0x51adcf[_0x84cf('0x1e')]=_0x531410;if(_0x29455e['query'][_0x84cf('0x42')]){_0x43b41b['include']=[{'all':!![]}];}return db[_0x84cf('0x2c')][_0x84cf('0x43')](_0x43b41b);})['then'](function(_0x847ce9){_0x51adcf[_0x84cf('0x44')]=_0x847ce9;return _0x51adcf;})[_0x84cf('0x25')](respondWithFilteredResult(_0x4092fd,_0x43b41b))['catch'](handleError(_0x4092fd,null));};exports[_0x84cf('0x45')]=function(_0x5f1b8e,_0x1c84e0){var _0x58b539={'raw':!![],'where':{'id':_0x5f1b8e['params']['id']}},_0x56b0e5={};_0x56b0e5[_0x84cf('0x31')]=_[_0x84cf('0x33')](db['WhatsappQueueReport'][_0x84cf('0x2d')]);_0x56b0e5['query']=_[_0x84cf('0x33')](_0x5f1b8e[_0x84cf('0x32')]);_0x56b0e5['filters']=_[_0x84cf('0x35')](_0x56b0e5['model'],_0x56b0e5[_0x84cf('0x32')]);_0x58b539['attributes']=_['intersection'](_0x56b0e5['model'],qs['fields'](_0x5f1b8e['query']['fields']));_0x58b539['attributes']=_0x58b539[_0x84cf('0x36')][_0x84cf('0x38')]?_0x58b539[_0x84cf('0x36')]:_0x56b0e5[_0x84cf('0x31')];if(_0x5f1b8e['query'][_0x84cf('0x42')]){_0x58b539['include']=[{'all':!![]}];}_0x58b539=_[_0x84cf('0x46')]({},_0x58b539,_0x5f1b8e[_0x84cf('0x41')]);return db[_0x84cf('0x2c')][_0x84cf('0x47')](_0x58b539)[_0x84cf('0x25')](handleEntityNotFound(_0x1c84e0,null))[_0x84cf('0x25')](respondWithResult(_0x1c84e0,null))['catch'](handleError(_0x1c84e0,null));};exports[_0x84cf('0x48')]=function(_0x2732bf,_0x4a4cf7){return db[_0x84cf('0x2c')][_0x84cf('0x48')](_0x2732bf[_0x84cf('0x49')],{})['then'](respondWithResult(_0x4a4cf7,0xc9))['catch'](handleError(_0x4a4cf7,null));};exports['update']=function(_0x1cf3f6,_0x104421){if(_0x1cf3f6[_0x84cf('0x49')]['id']){delete _0x1cf3f6[_0x84cf('0x49')]['id'];}return db[_0x84cf('0x2c')][_0x84cf('0x47')]({'where':{'id':_0x1cf3f6['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x104421,null))['then'](saveUpdates(_0x1cf3f6[_0x84cf('0x49')],null))['then'](respondWithResult(_0x104421,null))['catch'](handleError(_0x104421,null));};exports[_0x84cf('0x26')]=function(_0xb1c3a8,_0x426df1){return db['WhatsappQueueReport']['find']({'where':{'id':_0xb1c3a8[_0x84cf('0x4a')]['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x426df1,null))[_0x84cf('0x25')](removeEntity(_0x426df1,null))[_0x84cf('0x4b')](handleError(_0x426df1,null));};exports[_0x84cf('0x4c')]=function(_0x4c2025,_0xcfe28f){return db[_0x84cf('0x2c')]['describe']()[_0x84cf('0x25')](respondWithResult(_0xcfe28f,null))['catch'](handleError(_0xcfe28f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index d2276fd..81bffba 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 _0xa365=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa365,0xdd));var _0x5a36=function(_0x4936e4,_0x4eb6ff){_0x4936e4=_0x4936e4-0x0;var _0x48f367=_0xa365[_0x4936e4];return _0x48f367;};'use strict';var _=require(_0x5a36('0x0'));var util=require(_0x5a36('0x1'));var logger=require('../../config/logger')(_0x5a36('0x2'));var moment=require(_0x5a36('0x3'));var BPromise=require(_0x5a36('0x4'));var rp=require(_0x5a36('0x5'));var fs=require('fs');var path=require(_0x5a36('0x6'));var rimraf=require(_0x5a36('0x7'));var config=require(_0x5a36('0x8'));var attributes=require(_0x5a36('0x9'));module[_0x5a36('0xa')]=function(_0x5a8e15,_0x20f823){return _0x5a8e15[_0x5a36('0xb')](_0x5a36('0xc'),attributes,{'tableName':_0x5a36('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5a36('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7beb=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7beb,0x72));var _0xb7be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7beb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb7be('0x0'));var util=require(_0xb7be('0x1'));var logger=require('../../config/logger')(_0xb7be('0x2'));var moment=require('moment');var BPromise=require(_0xb7be('0x3'));var rp=require(_0xb7be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7be('0x5'));var attributes=require('./whatsappQueueReport.attributes');module[_0xb7be('0x6')]=function(_0xa8c195,_0x39b343){return _0xa8c195[_0xb7be('0x7')](_0xb7be('0x8'),attributes,{'tableName':_0xb7be('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb7be('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index fedb4b8..396068d 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 _0x5fbd=['UpdateWhatsappQueueReport','update','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x5fbd,0x192));var _0xd5fb=function(_0x1ed64f,_0x3a9696){_0x1ed64f=_0x1ed64f-0x0;var _0x12c806=_0x5fbd[_0x1ed64f];return _0x12c806;};'use strict';var _=require(_0xd5fb('0x0'));var util=require(_0xd5fb('0x1'));var moment=require(_0xd5fb('0x2'));var BPromise=require(_0xd5fb('0x3'));var rs=require(_0xd5fb('0x4'));var fs=require('fs');var Redis=require(_0xd5fb('0x5'));var db=require(_0xd5fb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd5fb('0x7'));var config=require('../../config/environment');var jayson=require(_0xd5fb('0x8'));var client=jayson['client'][_0xd5fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a95b,_0x35fd72,_0x14177){return new BPromise(function(_0x1ceb5e,_0x3b3c24){return client['request'](_0x29a95b,_0x14177)[_0xd5fb('0xa')](function(_0xa0e18b){logger[_0xd5fb('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x35fd72,_0xd5fb('0xc'));logger['debug'](_0xd5fb('0xd'),_0x35fd72,_0xd5fb('0xc'),JSON['stringify'](_0xa0e18b));if(_0xa0e18b[_0xd5fb('0xe')]){if(_0xa0e18b[_0xd5fb('0xe')][_0xd5fb('0xf')]===0x1f4){logger[_0xd5fb('0xe')](_0xd5fb('0x10'),_0x35fd72,_0xa0e18b[_0xd5fb('0xe')][_0xd5fb('0x11')]);return _0x3b3c24(_0xa0e18b[_0xd5fb('0xe')][_0xd5fb('0x11')]);}logger[_0xd5fb('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x35fd72,_0xa0e18b[_0xd5fb('0xe')][_0xd5fb('0x11')]);return _0x1ceb5e(_0xa0e18b['error'][_0xd5fb('0x11')]);}else{logger[_0xd5fb('0xb')](_0xd5fb('0x10'),_0x35fd72,_0xd5fb('0xc'));_0x1ceb5e(_0xa0e18b[_0xd5fb('0x12')][_0xd5fb('0x11')]);}})[_0xd5fb('0x13')](function(_0x36f90b){logger[_0xd5fb('0xe')](_0xd5fb('0x10'),_0x35fd72,_0x36f90b);_0x3b3c24(_0x36f90b);});});}exports[_0xd5fb('0x14')]=function(_0x3f2f2d){var _0x530455=this;return new Promise(function(_0x323f15,_0x4bb600){return db[_0xd5fb('0x15')][_0xd5fb('0x16')](_0x3f2f2d[_0xd5fb('0x17')],{'raw':_0x3f2f2d[_0xd5fb('0x18')]?_0x3f2f2d[_0xd5fb('0x18')][_0xd5fb('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x435783){logger['info']('CreateWhatsappQueueReport',_0x3f2f2d);logger[_0xd5fb('0x1a')](_0xd5fb('0x14'),_0x3f2f2d,JSON['stringify'](_0x435783));_0x323f15(_0x435783);})['catch'](function(_0x4ba030){logger[_0xd5fb('0xe')]('CreateWhatsappQueueReport',_0x4ba030['message'],_0x3f2f2d);_0x4bb600(_0x530455[_0xd5fb('0xe')](0x1f4,_0x4ba030[_0xd5fb('0x11')]));});});};exports[_0xd5fb('0x1b')]=function(_0x11124c){var _0x49c7d6=this;return new Promise(function(_0x4fe4d0,_0x37e440){return db['WhatsappQueueReport'][_0xd5fb('0x1c')](_0x11124c['body'],{'raw':_0x11124c['options']?_0x11124c[_0xd5fb('0x18')][_0xd5fb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11124c[_0xd5fb('0x18')]?_0x11124c[_0xd5fb('0x18')][_0xd5fb('0x1d')]||null:null,'attributes':_0x11124c[_0xd5fb('0x18')]?_0x11124c[_0xd5fb('0x18')][_0xd5fb('0x1e')]||null:null,'limit':_0x11124c['options']?_0x11124c[_0xd5fb('0x18')][_0xd5fb('0x1f')]||null:null})['then'](function(_0x32a262){logger[_0xd5fb('0xb')](_0xd5fb('0x1b'),_0x11124c);logger[_0xd5fb('0x1a')](_0xd5fb('0x1b'),_0x11124c,JSON[_0xd5fb('0x20')](_0x32a262));_0x4fe4d0(_0x32a262);})[_0xd5fb('0x13')](function(_0x164893){logger[_0xd5fb('0xe')](_0xd5fb('0x1b'),_0x164893[_0xd5fb('0x11')],_0x11124c);_0x37e440(_0x49c7d6['error'](0x1f4,_0x164893[_0xd5fb('0x11')]));});});}; \ No newline at end of file +var _0xd460=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','body','where','attributes','limit','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x50079d,_0x41b79d){var _0x5d3bcd=function(_0x3dffe2){while(--_0x3dffe2){_0x50079d['push'](_0x50079d['shift']());}};_0x5d3bcd(++_0x41b79d);}(_0xd460,0x121));var _0x0d46=function(_0x5239ff,_0x46ff0f){_0x5239ff=_0x5239ff-0x0;var _0x466b66=_0xd460[_0x5239ff];return _0x466b66;};'use strict';var _=require(_0x0d46('0x0'));var util=require(_0x0d46('0x1'));var moment=require(_0x0d46('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d46('0x3'));var fs=require('fs');var Redis=require(_0x0d46('0x4'));var db=require(_0x0d46('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d46('0x6'))(_0x0d46('0x7'));var config=require(_0x0d46('0x8'));var jayson=require(_0x0d46('0x9'));var client=jayson[_0x0d46('0xa')][_0x0d46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x181e4c,_0x51ba7c,_0x61dd48){return new BPromise(function(_0xd5895c,_0x555065){return client[_0x0d46('0xc')](_0x181e4c,_0x61dd48)[_0x0d46('0xd')](function(_0x432264){logger[_0x0d46('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x51ba7c,_0x0d46('0xf'));logger[_0x0d46('0x10')](_0x0d46('0x11'),_0x51ba7c,_0x0d46('0xf'),JSON['stringify'](_0x432264));if(_0x432264[_0x0d46('0x12')]){if(_0x432264[_0x0d46('0x12')]['code']===0x1f4){logger[_0x0d46('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x51ba7c,_0x432264[_0x0d46('0x12')]['message']);return _0x555065(_0x432264[_0x0d46('0x12')][_0x0d46('0x13')]);}logger[_0x0d46('0x12')](_0x0d46('0x14'),_0x51ba7c,_0x432264['error'][_0x0d46('0x13')]);return _0xd5895c(_0x432264[_0x0d46('0x12')][_0x0d46('0x13')]);}else{logger[_0x0d46('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x51ba7c,_0x0d46('0xf'));_0xd5895c(_0x432264[_0x0d46('0x15')][_0x0d46('0x13')]);}})[_0x0d46('0x16')](function(_0x2bb7d9){logger['error'](_0x0d46('0x14'),_0x51ba7c,_0x2bb7d9);_0x555065(_0x2bb7d9);});});}exports[_0x0d46('0x17')]=function(_0x42d0da){var _0x4620d5=this;return new Promise(function(_0x51a44e,_0x131468){return db['WhatsappQueueReport']['create'](_0x42d0da['body'],{'raw':_0x42d0da['options']?_0x42d0da[_0x0d46('0x18')][_0x0d46('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1a0963){logger['info'](_0x0d46('0x17'),_0x42d0da);logger[_0x0d46('0x10')](_0x0d46('0x17'),_0x42d0da,JSON['stringify'](_0x1a0963));_0x51a44e(_0x1a0963);})[_0x0d46('0x16')](function(_0xfe0083){logger['error'](_0x0d46('0x17'),_0xfe0083['message'],_0x42d0da);_0x131468(_0x4620d5['error'](0x1f4,_0xfe0083[_0x0d46('0x13')]));});});};exports[_0x0d46('0x1a')]=function(_0x1b9499){var _0x1311a7=this;return new Promise(function(_0x312255,_0x148a21){return db[_0x0d46('0x1b')][_0x0d46('0x1c')](_0x1b9499[_0x0d46('0x1d')],{'raw':_0x1b9499['options']?_0x1b9499[_0x0d46('0x18')][_0x0d46('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b9499[_0x0d46('0x18')]?_0x1b9499[_0x0d46('0x18')][_0x0d46('0x1e')]||null:null,'attributes':_0x1b9499[_0x0d46('0x18')]?_0x1b9499[_0x0d46('0x18')][_0x0d46('0x1f')]||null:null,'limit':_0x1b9499['options']?_0x1b9499[_0x0d46('0x18')][_0x0d46('0x20')]||null:null})[_0x0d46('0xd')](function(_0x4dcd8c){logger[_0x0d46('0xe')]('UpdateWhatsappQueueReport',_0x1b9499);logger['debug'](_0x0d46('0x1a'),_0x1b9499,JSON[_0x0d46('0x21')](_0x4dcd8c));_0x312255(_0x4dcd8c);})[_0x0d46('0x16')](function(_0x5c1790){logger['error'](_0x0d46('0x1a'),_0x5c1790['message'],_0x1b9499);_0x148a21(_0x1311a7[_0x0d46('0x12')](0x1f4,_0x5c1790[_0x0d46('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7373dbc..3363da7 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 _0xfe4b=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer'];(function(_0x4773fa,_0x226c9e){var _0xe195cf=function(_0x3aebd2){while(--_0x3aebd2){_0x4773fa['push'](_0x4773fa['shift']());}};_0xe195cf(++_0x226c9e);}(_0xfe4b,0x1c1));var _0xbfe4=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xfe4b[_0xb1cf84];return _0x4bad2e;};'use strict';var multer=require(_0xbfe4('0x0'));var util=require(_0xbfe4('0x1'));var path=require(_0xbfe4('0x2'));var timeout=require('connect-timeout');var express=require(_0xbfe4('0x3'));var router=express[_0xbfe4('0x4')]();var fs_extra=require(_0xbfe4('0x5'));var auth=require(_0xbfe4('0x6'));var interaction=require(_0xbfe4('0x7'));var config=require('../../config/environment');var controller=require(_0xbfe4('0x8'));router[_0xbfe4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbfe4('0x9')]('/describe',auth[_0xbfe4('0xa')](),controller['describe']);router[_0xbfe4('0x9')](_0xbfe4('0xb'),auth[_0xbfe4('0xa')](),controller[_0xbfe4('0xc')]);router[_0xbfe4('0xd')]('/',auth[_0xbfe4('0xa')](),controller[_0xbfe4('0xe')]);router[_0xbfe4('0xf')](_0xbfe4('0xb'),auth[_0xbfe4('0xa')](),controller[_0xbfe4('0x10')]);router['delete'](_0xbfe4('0xb'),auth[_0xbfe4('0xa')](),controller['destroy']);module[_0xbfe4('0x11')]=router; \ No newline at end of file +var _0x5457=['index','/describe','/:id','post','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x26c12e,_0x55ef42){var _0xbab0c7=function(_0x35eecb){while(--_0x35eecb){_0x26c12e['push'](_0x26c12e['shift']());}};_0xbab0c7(++_0x55ef42);}(_0x5457,0x107));var _0x7545=function(_0x1eaab5,_0x305861){_0x1eaab5=_0x1eaab5-0x0;var _0x7d347e=_0x5457[_0x1eaab5];return _0x7d347e;};'use strict';var multer=require(_0x7545('0x0'));var util=require(_0x7545('0x1'));var path=require(_0x7545('0x2'));var timeout=require('connect-timeout');var express=require(_0x7545('0x3'));var router=express['Router']();var fs_extra=require(_0x7545('0x4'));var auth=require(_0x7545('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7545('0x6'));router[_0x7545('0x7')]('/',auth[_0x7545('0x8')](),controller[_0x7545('0x9')]);router[_0x7545('0x7')](_0x7545('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7545('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7545('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7545('0xd')](_0x7545('0xb'),auth[_0x7545('0x8')](),controller[_0x7545('0xe')]);router[_0x7545('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7545('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a67888d..b1a5df8 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 _0x867f=['STRING','account','agent','queue','sequelize','exports'];(function(_0x53209e,_0x300d2a){var _0x542bf6=function(_0x27e70d){while(--_0x27e70d){_0x53209e['push'](_0x53209e['shift']());}};_0x542bf6(++_0x300d2a);}(_0x867f,0xdc));var _0xf867=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0x867f[_0x549928];return _0x941e27;};'use strict';var Sequelize=require(_0xf867('0x0'));module[_0xf867('0x1')]={'uniqueid':{'type':Sequelize[_0xf867('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf867('0x3'),_0xf867('0x4'),_0xf867('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x05b6=['account','agent','queue','DATE','sequelize','STRING','ENUM'];(function(_0x477e8a,_0x5612bd){var _0x20595f=function(_0x25b2b4){while(--_0x25b2b4){_0x477e8a['push'](_0x477e8a['shift']());}};_0x20595f(++_0x5612bd);}(_0x05b6,0x74));var _0x605b=function(_0x4d23dc,_0x30def6){_0x4d23dc=_0x4d23dc-0x0;var _0x1ffc30=_0x05b6[_0x4d23dc];return _0x1ffc30;};'use strict';var Sequelize=require(_0x605b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x605b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x605b('0x2')](_0x605b('0x3'),_0x605b('0x4'),_0x605b('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x605b('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index cf84cff..813ba38 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 _0xb04a=['WhatsappTransferReport','fieldName','type','model','keys','query','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','intersection','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x5584ce,_0x4701e7){var _0x4461e0=function(_0x6ab250){while(--_0x6ab250){_0x5584ce['push'](_0x5584ce['shift']());}};_0x4461e0(++_0x4701e7);}(_0xb04a,0x1ed));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xab04('0x0'));var rimraf=require(_0xab04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab04('0x2'));var rp=require(_0xab04('0x3'));var moment=require(_0xab04('0x4'));var BPromise=require(_0xab04('0x5'));var Mustache=require(_0xab04('0x6'));var util=require(_0xab04('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xab04('0x8'));var ejs=require(_0xab04('0x9'));var fs=require('fs');var fs_extra=require(_0xab04('0xa'));var _=require(_0xab04('0xb'));var squel=require(_0xab04('0xc'));var crypto=require(_0xab04('0xd'));var jsforce=require(_0xab04('0xe'));var deskjs=require(_0xab04('0xf'));var toCsv=require(_0xab04('0x8'));var querystring=require('querystring');var Papa=require(_0xab04('0x10'));var Redis=require(_0xab04('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xab04('0x12'));var as=require(_0xab04('0x13'));var hardwareService=require(_0xab04('0x14'));var logger=require(_0xab04('0x15'))('api');var utils=require(_0xab04('0x16'));var config=require(_0xab04('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xab04('0x18'))['db'];function respondWithStatusCode(_0xec3947,_0x287196){_0x287196=_0x287196||0xcc;return function(_0x54cd4c){if(_0x54cd4c){return _0xec3947[_0xab04('0x19')](_0x287196);}return _0xec3947[_0xab04('0x1a')](_0x287196)[_0xab04('0x1b')]();};}function respondWithResult(_0x864b03,_0x5a252d){_0x5a252d=_0x5a252d||0xc8;return function(_0x3a132f){if(_0x3a132f){return _0x864b03[_0xab04('0x1a')](_0x5a252d)[_0xab04('0x1c')](_0x3a132f);}};}function respondWithFilteredResult(_0x5a7525,_0x4b6656){return function(_0x26cf10){if(_0x26cf10){var _0x24aa02=typeof _0x4b6656[_0xab04('0x1d')]===_0xab04('0x1e')&&typeof _0x4b6656['limit']==='undefined';var _0x325e85=_0x26cf10[_0xab04('0x1f')];var _0x2f2238=_0x24aa02?0x0:_0x4b6656['offset'];var _0x4a73c7=_0x24aa02?_0x26cf10[_0xab04('0x1f')]:_0x4b6656[_0xab04('0x1d')]+_0x4b6656['limit'];var _0x108c89;if(_0x4a73c7>=_0x325e85){_0x4a73c7=_0x325e85;_0x108c89=0xc8;}else{_0x108c89=0xce;}_0x5a7525[_0xab04('0x1a')](_0x108c89);return _0x5a7525[_0xab04('0x20')](_0xab04('0x21'),_0x2f2238+'-'+_0x4a73c7+'/'+_0x325e85)[_0xab04('0x1c')](_0x26cf10);}return null;};}function patchUpdates(_0x530cb8){return function(_0x15c6a5){try{jsonpatch[_0xab04('0x22')](_0x15c6a5,_0x530cb8,!![]);}catch(_0xcaa1e2){return BPromise[_0xab04('0x23')](_0xcaa1e2);}return _0x15c6a5[_0xab04('0x24')]();};}function saveUpdates(_0x4ec94d,_0x3a39bf){return function(_0x582b41){if(_0x582b41){return _0x582b41[_0xab04('0x25')](_0x4ec94d)[_0xab04('0x26')](function(_0x54e2e4){return _0x54e2e4;});}return null;};}function removeEntity(_0x2e7128,_0x5cf159){return function(_0x1aedc5){if(_0x1aedc5){return _0x1aedc5[_0xab04('0x27')]()[_0xab04('0x26')](function(){_0x2e7128[_0xab04('0x1a')](0xcc)[_0xab04('0x1b')]();});}};}function handleEntityNotFound(_0x114f08,_0xc747df){return function(_0x4d077b){if(!_0x4d077b){_0x114f08[_0xab04('0x19')](0x194);}return _0x4d077b;};}function handleError(_0x3d4514,_0x226d3a){_0x226d3a=_0x226d3a||0x1f4;return function(_0x573a61){logger[_0xab04('0x28')](_0x573a61[_0xab04('0x29')]);if(_0x573a61[_0xab04('0x2a')]){delete _0x573a61[_0xab04('0x2a')];}_0x3d4514[_0xab04('0x1a')](_0x226d3a)[_0xab04('0x2b')](_0x573a61);};}exports[_0xab04('0x2c')]=function(_0x301a66,_0x3251f6){var _0x5c1d26={},_0x46d90e={},_0x284d43={'count':0x0,'rows':[]};var _0x4855c3=_[_0xab04('0x2d')](db[_0xab04('0x2e')]['rawAttributes'],function(_0x38762d){return{'name':_0x38762d[_0xab04('0x2f')],'type':_0x38762d[_0xab04('0x30')]['key']};});_0x46d90e[_0xab04('0x31')]=_[_0xab04('0x2d')](_0x4855c3,_0xab04('0x2a'));_0x46d90e['query']=_[_0xab04('0x32')](_0x301a66[_0xab04('0x33')]);_0x46d90e['filters']=_['intersection'](_0x46d90e[_0xab04('0x31')],_0x46d90e[_0xab04('0x33')]);_0x5c1d26[_0xab04('0x34')]=_['intersection'](_0x46d90e[_0xab04('0x31')],qs[_0xab04('0x35')](_0x301a66[_0xab04('0x33')][_0xab04('0x35')]));_0x5c1d26['attributes']=_0x5c1d26[_0xab04('0x34')][_0xab04('0x36')]?_0x5c1d26[_0xab04('0x34')]:_0x46d90e[_0xab04('0x31')];if(!_0x301a66['query'][_0xab04('0x37')]('nolimit')){_0x5c1d26[_0xab04('0x38')]=qs['limit'](_0x301a66['query']['limit']);_0x5c1d26[_0xab04('0x1d')]=qs[_0xab04('0x1d')](_0x301a66['query'][_0xab04('0x1d')]);}_0x5c1d26[_0xab04('0x39')]=qs[_0xab04('0x3a')](_0x301a66[_0xab04('0x33')]['sort']);_0x5c1d26['where']=qs[_0xab04('0x3b')](_[_0xab04('0x3c')](_0x301a66[_0xab04('0x33')],_0x46d90e[_0xab04('0x3b')]),_0x4855c3);if(_0x301a66[_0xab04('0x33')]['filter']){_0x5c1d26[_0xab04('0x3d')]=_[_0xab04('0x3e')](_0x5c1d26[_0xab04('0x3d')],{'$or':_[_0xab04('0x2d')](_0x4855c3,function(_0x1bf264){if(_0x1bf264[_0xab04('0x30')]!==_0xab04('0x3f')){var _0x570798={};_0x570798[_0x1bf264['name']]={'$like':'%'+_0x301a66[_0xab04('0x33')][_0xab04('0x40')]+'%'};return _0x570798;}})});}_0x5c1d26=_[_0xab04('0x3e')]({},_0x5c1d26,_0x301a66['options']);var _0x3151de={'where':_0x5c1d26[_0xab04('0x3d')]};return db[_0xab04('0x2e')]['count'](_0x3151de)[_0xab04('0x26')](function(_0x304f22){_0x284d43[_0xab04('0x1f')]=_0x304f22;if(_0x301a66[_0xab04('0x33')][_0xab04('0x41')]){_0x5c1d26[_0xab04('0x42')]=[{'all':!![]}];}return db[_0xab04('0x2e')]['findAll'](_0x5c1d26);})[_0xab04('0x26')](function(_0x397df8){_0x284d43[_0xab04('0x43')]=_0x397df8;return _0x284d43;})['then'](respondWithFilteredResult(_0x3251f6,_0x5c1d26))[_0xab04('0x44')](handleError(_0x3251f6,null));};exports[_0xab04('0x45')]=function(_0x472de6,_0x248294){var _0x4a79dc={'raw':!![],'where':{'id':_0x472de6['params']['id']}},_0x4fe481={};_0x4fe481['model']=_[_0xab04('0x32')](db[_0xab04('0x2e')][_0xab04('0x46')]);_0x4fe481[_0xab04('0x33')]=_[_0xab04('0x32')](_0x472de6[_0xab04('0x33')]);_0x4fe481[_0xab04('0x3b')]=_[_0xab04('0x47')](_0x4fe481[_0xab04('0x31')],_0x4fe481['query']);_0x4a79dc[_0xab04('0x34')]=_[_0xab04('0x47')](_0x4fe481[_0xab04('0x31')],qs[_0xab04('0x35')](_0x472de6[_0xab04('0x33')]['fields']));_0x4a79dc['attributes']=_0x4a79dc[_0xab04('0x34')]['length']?_0x4a79dc[_0xab04('0x34')]:_0x4fe481[_0xab04('0x31')];if(_0x472de6[_0xab04('0x33')][_0xab04('0x41')]){_0x4a79dc[_0xab04('0x42')]=[{'all':!![]}];}_0x4a79dc=_[_0xab04('0x3e')]({},_0x4a79dc,_0x472de6['options']);return db[_0xab04('0x2e')]['find'](_0x4a79dc)[_0xab04('0x26')](handleEntityNotFound(_0x248294,null))['then'](respondWithResult(_0x248294,null))[_0xab04('0x44')](handleError(_0x248294,null));};exports[_0xab04('0x48')]=function(_0x5532fd,_0x1ea0df){return db[_0xab04('0x2e')][_0xab04('0x48')](_0x5532fd[_0xab04('0x49')],{})['then'](respondWithResult(_0x1ea0df,0xc9))[_0xab04('0x44')](handleError(_0x1ea0df,null));};exports[_0xab04('0x25')]=function(_0xe2f28a,_0x13e1f5){if(_0xe2f28a[_0xab04('0x49')]['id']){delete _0xe2f28a[_0xab04('0x49')]['id'];}return db[_0xab04('0x2e')][_0xab04('0x4a')]({'where':{'id':_0xe2f28a[_0xab04('0x4b')]['id']}})[_0xab04('0x26')](handleEntityNotFound(_0x13e1f5,null))['then'](saveUpdates(_0xe2f28a[_0xab04('0x49')],null))['then'](respondWithResult(_0x13e1f5,null))[_0xab04('0x44')](handleError(_0x13e1f5,null));};exports[_0xab04('0x27')]=function(_0x3e0053,_0x4cddb4){return db['WhatsappTransferReport'][_0xab04('0x4a')]({'where':{'id':_0x3e0053[_0xab04('0x4b')]['id']}})[_0xab04('0x26')](handleEntityNotFound(_0x4cddb4,null))[_0xab04('0x26')](removeEntity(_0x4cddb4,null))[_0xab04('0x44')](handleError(_0x4cddb4,null));};exports[_0xab04('0x4c')]=function(_0x41d326,_0x232454){return db[_0xab04('0x2e')][_0xab04('0x4c')]()['then'](respondWithResult(_0x232454,null))[_0xab04('0x44')](handleError(_0x232454,null));}; \ No newline at end of file +var _0xe469=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','save','update','then','end','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x5f4ba1,_0x50f8b7){var _0x3b7082=function(_0xbf3e13){while(--_0xbf3e13){_0x5f4ba1['push'](_0x5f4ba1['shift']());}};_0x3b7082(++_0x50f8b7);}(_0xe469,0xef));var _0x9e46=function(_0x4d7d5c,_0x1a456d){_0x4d7d5c=_0x4d7d5c-0x0;var _0x2c0910=_0xe469[_0x4d7d5c];return _0x2c0910;};'use strict';var emlformat=require(_0x9e46('0x0'));var rimraf=require(_0x9e46('0x1'));var zipdir=require(_0x9e46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e46('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9e46('0x4'));var path=require(_0x9e46('0x5'));var sox=require(_0x9e46('0x6'));var csv=require(_0x9e46('0x7'));var ejs=require(_0x9e46('0x8'));var fs=require('fs');var fs_extra=require(_0x9e46('0x9'));var _=require(_0x9e46('0xa'));var squel=require('squel');var crypto=require(_0x9e46('0xb'));var jsforce=require(_0x9e46('0xc'));var deskjs=require(_0x9e46('0xd'));var toCsv=require(_0x9e46('0x7'));var querystring=require(_0x9e46('0xe'));var Papa=require(_0x9e46('0xf'));var Redis=require(_0x9e46('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e46('0x11'));var logger=require(_0x9e46('0x12'))(_0x9e46('0x13'));var utils=require('../../config/utils');var config=require(_0x9e46('0x14'));var licenseUtil=require(_0x9e46('0x15'));var db=require(_0x9e46('0x16'))['db'];function respondWithStatusCode(_0x3cbd98,_0x136c82){_0x136c82=_0x136c82||0xcc;return function(_0x4f85b3){if(_0x4f85b3){return _0x3cbd98[_0x9e46('0x17')](_0x136c82);}return _0x3cbd98['status'](_0x136c82)['end']();};}function respondWithResult(_0x2a5d04,_0x22efa0){_0x22efa0=_0x22efa0||0xc8;return function(_0x100911){if(_0x100911){return _0x2a5d04[_0x9e46('0x18')](_0x22efa0)['json'](_0x100911);}};}function respondWithFilteredResult(_0x1cd770,_0x201bae){return function(_0x53ebc0){if(_0x53ebc0){var _0x480f5f=typeof _0x201bae[_0x9e46('0x19')]===_0x9e46('0x1a')&&typeof _0x201bae['limit']==='undefined';var _0x519525=_0x53ebc0['count'];var _0x3a027a=_0x480f5f?0x0:_0x201bae[_0x9e46('0x19')];var _0x5b54c6=_0x480f5f?_0x53ebc0[_0x9e46('0x1b')]:_0x201bae[_0x9e46('0x19')]+_0x201bae['limit'];var _0x25e777;if(_0x5b54c6>=_0x519525){_0x5b54c6=_0x519525;_0x25e777=0xc8;}else{_0x25e777=0xce;}_0x1cd770[_0x9e46('0x18')](_0x25e777);return _0x1cd770[_0x9e46('0x1c')](_0x9e46('0x1d'),_0x3a027a+'-'+_0x5b54c6+'/'+_0x519525)[_0x9e46('0x1e')](_0x53ebc0);}return null;};}function patchUpdates(_0x1f2131){return function(_0x2c334d){try{jsonpatch['apply'](_0x2c334d,_0x1f2131,!![]);}catch(_0xaa8b60){return BPromise['reject'](_0xaa8b60);}return _0x2c334d[_0x9e46('0x1f')]();};}function saveUpdates(_0x590f73,_0x52b780){return function(_0x5a2b81){if(_0x5a2b81){return _0x5a2b81[_0x9e46('0x20')](_0x590f73)['then'](function(_0x3b89ab){return _0x3b89ab;});}return null;};}function removeEntity(_0x223557,_0x330ea6){return function(_0x1f8d35){if(_0x1f8d35){return _0x1f8d35['destroy']()[_0x9e46('0x21')](function(){_0x223557[_0x9e46('0x18')](0xcc)[_0x9e46('0x22')]();});}};}function handleEntityNotFound(_0x2454a6,_0x5bc271){return function(_0x37c568){if(!_0x37c568){_0x2454a6['sendStatus'](0x194);}return _0x37c568;};}function handleError(_0x28a43a,_0x49aaaa){_0x49aaaa=_0x49aaaa||0x1f4;return function(_0x4a665e){logger['error'](_0x4a665e[_0x9e46('0x23')]);if(_0x4a665e[_0x9e46('0x24')]){delete _0x4a665e[_0x9e46('0x24')];}_0x28a43a[_0x9e46('0x18')](_0x49aaaa)[_0x9e46('0x25')](_0x4a665e);};}exports[_0x9e46('0x26')]=function(_0x1cb0a1,_0x1dbe55){var _0x47997d={},_0x13b25c={},_0x194c70={'count':0x0,'rows':[]};var _0x10c6cd=_[_0x9e46('0x27')](db[_0x9e46('0x28')]['rawAttributes'],function(_0x4d5fc8){return{'name':_0x4d5fc8[_0x9e46('0x29')],'type':_0x4d5fc8[_0x9e46('0x2a')][_0x9e46('0x2b')]};});_0x13b25c[_0x9e46('0x2c')]=_['map'](_0x10c6cd,_0x9e46('0x24'));_0x13b25c[_0x9e46('0x2d')]=_[_0x9e46('0x2e')](_0x1cb0a1[_0x9e46('0x2d')]);_0x13b25c[_0x9e46('0x2f')]=_[_0x9e46('0x30')](_0x13b25c[_0x9e46('0x2c')],_0x13b25c[_0x9e46('0x2d')]);_0x47997d[_0x9e46('0x31')]=_[_0x9e46('0x30')](_0x13b25c['model'],qs['fields'](_0x1cb0a1['query'][_0x9e46('0x32')]));_0x47997d[_0x9e46('0x31')]=_0x47997d['attributes']['length']?_0x47997d[_0x9e46('0x31')]:_0x13b25c['model'];if(!_0x1cb0a1['query'][_0x9e46('0x33')](_0x9e46('0x34'))){_0x47997d['limit']=qs[_0x9e46('0x35')](_0x1cb0a1['query'][_0x9e46('0x35')]);_0x47997d[_0x9e46('0x19')]=qs['offset'](_0x1cb0a1['query']['offset']);}_0x47997d[_0x9e46('0x36')]=qs['sort'](_0x1cb0a1['query'][_0x9e46('0x37')]);_0x47997d[_0x9e46('0x38')]=qs['filters'](_[_0x9e46('0x39')](_0x1cb0a1['query'],_0x13b25c[_0x9e46('0x2f')]),_0x10c6cd);if(_0x1cb0a1[_0x9e46('0x2d')][_0x9e46('0x3a')]){_0x47997d['where']=_[_0x9e46('0x3b')](_0x47997d['where'],{'$or':_[_0x9e46('0x27')](_0x10c6cd,function(_0x26dce9){if(_0x26dce9['type']!==_0x9e46('0x3c')){var _0x5e4b3a={};_0x5e4b3a[_0x26dce9[_0x9e46('0x24')]]={'$like':'%'+_0x1cb0a1[_0x9e46('0x2d')][_0x9e46('0x3a')]+'%'};return _0x5e4b3a;}})});}_0x47997d=_['merge']({},_0x47997d,_0x1cb0a1[_0x9e46('0x3d')]);var _0x2e695d={'where':_0x47997d[_0x9e46('0x38')]};return db['WhatsappTransferReport'][_0x9e46('0x1b')](_0x2e695d)[_0x9e46('0x21')](function(_0x1f8acb){_0x194c70[_0x9e46('0x1b')]=_0x1f8acb;if(_0x1cb0a1['query'][_0x9e46('0x3e')]){_0x47997d['include']=[{'all':!![]}];}return db[_0x9e46('0x28')][_0x9e46('0x3f')](_0x47997d);})[_0x9e46('0x21')](function(_0x37d3b5){_0x194c70[_0x9e46('0x40')]=_0x37d3b5;return _0x194c70;})[_0x9e46('0x21')](respondWithFilteredResult(_0x1dbe55,_0x47997d))[_0x9e46('0x41')](handleError(_0x1dbe55,null));};exports['show']=function(_0xdfa815,_0x50ea44){var _0x3d468d={'raw':!![],'where':{'id':_0xdfa815[_0x9e46('0x42')]['id']}},_0x1e3bb4={};_0x1e3bb4[_0x9e46('0x2c')]=_['keys'](db[_0x9e46('0x28')][_0x9e46('0x43')]);_0x1e3bb4[_0x9e46('0x2d')]=_[_0x9e46('0x2e')](_0xdfa815['query']);_0x1e3bb4[_0x9e46('0x2f')]=_[_0x9e46('0x30')](_0x1e3bb4[_0x9e46('0x2c')],_0x1e3bb4[_0x9e46('0x2d')]);_0x3d468d[_0x9e46('0x31')]=_['intersection'](_0x1e3bb4[_0x9e46('0x2c')],qs[_0x9e46('0x32')](_0xdfa815[_0x9e46('0x2d')][_0x9e46('0x32')]));_0x3d468d[_0x9e46('0x31')]=_0x3d468d[_0x9e46('0x31')]['length']?_0x3d468d['attributes']:_0x1e3bb4[_0x9e46('0x2c')];if(_0xdfa815[_0x9e46('0x2d')][_0x9e46('0x3e')]){_0x3d468d[_0x9e46('0x44')]=[{'all':!![]}];}_0x3d468d=_[_0x9e46('0x3b')]({},_0x3d468d,_0xdfa815[_0x9e46('0x3d')]);return db[_0x9e46('0x28')][_0x9e46('0x45')](_0x3d468d)[_0x9e46('0x21')](handleEntityNotFound(_0x50ea44,null))[_0x9e46('0x21')](respondWithResult(_0x50ea44,null))[_0x9e46('0x41')](handleError(_0x50ea44,null));};exports[_0x9e46('0x46')]=function(_0x1cc59b,_0x9cf596){return db['WhatsappTransferReport'][_0x9e46('0x46')](_0x1cc59b[_0x9e46('0x47')],{})[_0x9e46('0x21')](respondWithResult(_0x9cf596,0xc9))[_0x9e46('0x41')](handleError(_0x9cf596,null));};exports['update']=function(_0x3be8b4,_0x4223dd){if(_0x3be8b4[_0x9e46('0x47')]['id']){delete _0x3be8b4[_0x9e46('0x47')]['id'];}return db[_0x9e46('0x28')]['find']({'where':{'id':_0x3be8b4[_0x9e46('0x42')]['id']}})['then'](handleEntityNotFound(_0x4223dd,null))[_0x9e46('0x21')](saveUpdates(_0x3be8b4[_0x9e46('0x47')],null))[_0x9e46('0x21')](respondWithResult(_0x4223dd,null))[_0x9e46('0x41')](handleError(_0x4223dd,null));};exports[_0x9e46('0x48')]=function(_0x5d71b4,_0x5b1419){return db[_0x9e46('0x28')]['find']({'where':{'id':_0x5d71b4[_0x9e46('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b1419,null))['then'](removeEntity(_0x5b1419,null))[_0x9e46('0x41')](handleError(_0x5b1419,null));};exports[_0x9e46('0x49')]=function(_0x52fd09,_0x4b021a){return db[_0x9e46('0x28')]['describe']()[_0x9e46('0x21')](respondWithResult(_0x4b021a,null))['catch'](handleError(_0x4b021a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3777234..48458ff 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 _0x8829=['lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappTransferReport','uniqueid'];(function(_0x5b2a9f,_0x4e2abe){var _0x2fba35=function(_0x285f64){while(--_0x285f64){_0x5b2a9f['push'](_0x5b2a9f['shift']());}};_0x2fba35(++_0x4e2abe);}(_0x8829,0x108));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9882('0x0'));var util=require(_0x9882('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9882('0x2'));var BPromise=require(_0x9882('0x3'));var rp=require(_0x9882('0x4'));var fs=require('fs');var path=require(_0x9882('0x5'));var rimraf=require(_0x9882('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x9882('0x7')]=function(_0x526cc0,_0x5f0b69){return _0x526cc0[_0x9882('0x8')](_0x9882('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x9882('0xa'),'fields':[_0x9882('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b76=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_whatsapp_transfer','lodash','util','../../config/logger'];(function(_0x1b2c62,_0x345b54){var _0x1bfcfd=function(_0x4ee8ee){while(--_0x4ee8ee){_0x1b2c62['push'](_0x1b2c62['shift']());}};_0x1bfcfd(++_0x345b54);}(_0x3b76,0x141));var _0x63b7=function(_0x5d995f,_0x370626){_0x5d995f=_0x5d995f-0x0;var _0x5e3e76=_0x3b76[_0x5d995f];return _0x5e3e76;};'use strict';var _=require(_0x63b7('0x0'));var util=require(_0x63b7('0x1'));var logger=require(_0x63b7('0x2'))(_0x63b7('0x3'));var moment=require(_0x63b7('0x4'));var BPromise=require(_0x63b7('0x5'));var rp=require(_0x63b7('0x6'));var fs=require('fs');var path=require(_0x63b7('0x7'));var rimraf=require(_0x63b7('0x8'));var config=require(_0x63b7('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0x63b7('0xa')]=function(_0x543035,_0x65231a){return _0x543035['define']('WhatsappTransferReport',attributes,{'tableName':_0x63b7('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 4f2cd01..c2252bf 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 _0x54dc=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x160d95,_0x1f42b3){var _0x57c03b=function(_0x371703){while(--_0x371703){_0x160d95['push'](_0x160d95['shift']());}};_0x57c03b(++_0x1f42b3);}(_0x54dc,0x6f));var _0xc54d=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0x54dc[_0x45ee03];return _0x13d535;};'use strict';var _=require(_0xc54d('0x0'));var util=require(_0xc54d('0x1'));var moment=require(_0xc54d('0x2'));var BPromise=require(_0xc54d('0x3'));var rs=require(_0xc54d('0x4'));var fs=require('fs');var Redis=require(_0xc54d('0x5'));var db=require(_0xc54d('0x6'))['db'];var utils=require(_0xc54d('0x7'));var logger=require(_0xc54d('0x8'))(_0xc54d('0x9'));var config=require(_0xc54d('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc54d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59af71,_0x287563,_0x413783){return new BPromise(function(_0x5f06f8,_0x58ba57){return client[_0xc54d('0xc')](_0x59af71,_0x413783)['then'](function(_0x3e5242){logger[_0xc54d('0xd')](_0xc54d('0xe'),_0x287563,'request\x20sent');logger[_0xc54d('0xf')](_0xc54d('0x10'),_0x287563,_0xc54d('0x11'),JSON['stringify'](_0x3e5242));if(_0x3e5242[_0xc54d('0x12')]){if(_0x3e5242[_0xc54d('0x12')]['code']===0x1f4){logger[_0xc54d('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x287563,_0x3e5242[_0xc54d('0x12')][_0xc54d('0x13')]);return _0x58ba57(_0x3e5242[_0xc54d('0x12')]['message']);}logger[_0xc54d('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x287563,_0x3e5242[_0xc54d('0x12')]['message']);return _0x5f06f8(_0x3e5242['error'][_0xc54d('0x13')]);}else{logger[_0xc54d('0xd')](_0xc54d('0xe'),_0x287563,_0xc54d('0x11'));_0x5f06f8(_0x3e5242[_0xc54d('0x14')][_0xc54d('0x13')]);}})[_0xc54d('0x15')](function(_0x136986){logger[_0xc54d('0x12')](_0xc54d('0xe'),_0x287563,_0x136986);_0x58ba57(_0x136986);});});} \ No newline at end of file +var _0xd281=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x152aba,_0x181945){var _0x2dccb6=function(_0x50aba4){while(--_0x50aba4){_0x152aba['push'](_0x152aba['shift']());}};_0x2dccb6(++_0x181945);}(_0xd281,0xde));var _0x1d28=function(_0x1d126e,_0x1dca74){_0x1d126e=_0x1d126e-0x0;var _0x36e277=_0xd281[_0x1d126e];return _0x36e277;};'use strict';var _=require('lodash');var util=require(_0x1d28('0x0'));var moment=require(_0x1d28('0x1'));var BPromise=require(_0x1d28('0x2'));var rs=require(_0x1d28('0x3'));var fs=require('fs');var Redis=require(_0x1d28('0x4'));var db=require(_0x1d28('0x5'))['db'];var utils=require(_0x1d28('0x6'));var logger=require(_0x1d28('0x7'))(_0x1d28('0x8'));var config=require(_0x1d28('0x9'));var jayson=require(_0x1d28('0xa'));var client=jayson['client'][_0x1d28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51d2bd,_0x27c51c,_0x42c9fa){return new BPromise(function(_0x5b4c69,_0x20237c){return client[_0x1d28('0xc')](_0x51d2bd,_0x42c9fa)[_0x1d28('0xd')](function(_0x48eb05){logger[_0x1d28('0xe')](_0x1d28('0xf'),_0x27c51c,_0x1d28('0x10'));logger[_0x1d28('0x11')](_0x1d28('0x12'),_0x27c51c,'request\x20sent',JSON[_0x1d28('0x13')](_0x48eb05));if(_0x48eb05[_0x1d28('0x14')]){if(_0x48eb05[_0x1d28('0x14')][_0x1d28('0x15')]===0x1f4){logger['error'](_0x1d28('0xf'),_0x27c51c,_0x48eb05['error'][_0x1d28('0x16')]);return _0x20237c(_0x48eb05['error'][_0x1d28('0x16')]);}logger[_0x1d28('0x14')](_0x1d28('0xf'),_0x27c51c,_0x48eb05[_0x1d28('0x14')][_0x1d28('0x16')]);return _0x5b4c69(_0x48eb05['error'][_0x1d28('0x16')]);}else{logger[_0x1d28('0xe')](_0x1d28('0xf'),_0x27c51c,_0x1d28('0x10'));_0x5b4c69(_0x48eb05[_0x1d28('0x17')]['message']);}})['catch'](function(_0x28ee3c){logger[_0x1d28('0x14')](_0x1d28('0xf'),_0x27c51c,_0x28ee3c);_0x20237c(_0x28ee3c);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 4efed11..20c62ab 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf223=['error','exit','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','info','start','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','status','None','./config/seedDB','default','catch'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xf223,0x107));var _0x3f22=function(_0x2cd176,_0x176f09){_0x2cd176=_0x2cd176-0x0;var _0x8b7cff=_0xf223[_0x2cd176];return _0x8b7cff;};'use strict';var _=require('lodash');var mysqldb=require(_0x3f22('0x0'));var rpc=require(_0x3f22('0x1'));var config=require(_0x3f22('0x2'));var logger=require('./config/logger')(_0x3f22('0x3'));var pm2=require(_0x3f22('0x4'));var pm2Config=require(_0x3f22('0x5'));var schedule=require(_0x3f22('0x6'));var chat=require(_0x3f22('0x7'));var whatsapp=require(_0x3f22('0x8'));var transcribe=require(_0x3f22('0x9'));function main(){return mysqldb['db'][_0x3f22('0xa')][_0x3f22('0xb')]()[_0x3f22('0xc')](function(){return rpc['listen']();})[_0x3f22('0xc')](function(_0x5561e){logger[_0x3f22('0xd')](_0x5561e);return chat[_0x3f22('0xe')]();})[_0x3f22('0xc')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x3f22('0xc')](function(){return transcribe[_0x3f22('0xe')]();})[_0x3f22('0xc')](function(_0x3f405a){logger['info'](_0x3f405a);return pm2[_0x3f22('0xe')](pm2Config);})['then'](function(_0xc8bb2e){logger[_0x3f22('0xd')](_0x3f22('0xf'),_['map'](_[_0x3f22('0x10')](_0xc8bb2e,{'status':_0x3f22('0x11')}),_0x3f22('0x12'))[_0x3f22('0x13')]());logger[_0x3f22('0xd')](_0x3f22('0x14'),_[_0x3f22('0x15')](_[_0x3f22('0x10')](_0xc8bb2e,function(_0x18567d){return _0x18567d[_0x3f22('0x16')]!=='online';}),_0x3f22('0x12'))[_0x3f22('0x13')]()||_0x3f22('0x17'));config['seedDB']&&require(_0x3f22('0x18'))[_0x3f22('0x19')]();require('./config/license')[_0x3f22('0x19')]();})[_0x3f22('0x1a')](function(_0x356b11){logger[_0x3f22('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x356b11);process[_0x3f22('0x1c')](0x1);});}main(); \ No newline at end of file +var _0xd952=['./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','Offline\x20apps:','status','join','seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./rpc','./config/environment','./config/pm2'];(function(_0x4778b3,_0x4a0dfa){var _0x4cfd84=function(_0x60839f){while(--_0x60839f){_0x4778b3['push'](_0x4778b3['shift']());}};_0x4cfd84(++_0x4a0dfa);}(_0xd952,0x129));var _0x2d95=function(_0x489997,_0x124ace){_0x489997=_0x489997-0x0;var _0x97432e=_0xd952[_0x489997];return _0x97432e;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x2d95('0x0'));var config=require(_0x2d95('0x1'));var logger=require('./config/logger')('app');var pm2=require(_0x2d95('0x2'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x2d95('0x3'));var chat=require(_0x2d95('0x4'));var whatsapp=require(_0x2d95('0x5'));var transcribe=require(_0x2d95('0x6'));function main(){return mysqldb['db']['sequelize'][_0x2d95('0x7')]()[_0x2d95('0x8')](function(){return rpc[_0x2d95('0x9')]();})[_0x2d95('0x8')](function(_0x50ba2b){logger[_0x2d95('0xa')](_0x50ba2b);return chat[_0x2d95('0xb')]();})['then'](function(){return whatsapp['start']();})[_0x2d95('0x8')](function(){return schedule['start']();})[_0x2d95('0x8')](function(){return transcribe[_0x2d95('0xb')]();})[_0x2d95('0x8')](function(_0x14c13e){logger['info'](_0x14c13e);return pm2['start'](pm2Config);})[_0x2d95('0x8')](function(_0x6141e1){logger['info'](_0x2d95('0xc'),_[_0x2d95('0xd')](_[_0x2d95('0xe')](_0x6141e1,{'status':_0x2d95('0xf')}),_0x2d95('0x10'))['join']());logger[_0x2d95('0xa')](_0x2d95('0x11'),_[_0x2d95('0xd')](_[_0x2d95('0xe')](_0x6141e1,function(_0x563311){return _0x563311[_0x2d95('0x12')]!==_0x2d95('0xf');}),_0x2d95('0x10'))[_0x2d95('0x13')]()||'None');config[_0x2d95('0x14')]&&require('./config/seedDB')[_0x2d95('0x15')]();require(_0x2d95('0x16'))[_0x2d95('0x15')]();})['catch'](function(_0x4ec65a){logger['error'](_0x2d95('0x17'),_0x4ec65a);process[_0x2d95('0x18')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d8e0def..3779409 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 _0xf082=['/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','decryptString','length','unshift','encryptString','sign','secret','promisify','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','secrets','session','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','isAuthenticated','headers','authorization','Basic','User','find','then','pass','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','getUuid','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','add','catch','canUpdate','Forbidden','isMiddleware','signToken','setTokenCookie','role','cookie','motion.token','redirect'];(function(_0x4c5013,_0x4198a1){var _0x2d1a74=function(_0x6dd2a){while(--_0x6dd2a){_0x4c5013['push'](_0x4c5013['shift']());}};_0x2d1a74(++_0x4198a1);}(_0xf082,0x106));var _0x2f08=function(_0x21b39c,_0x33edbc){_0x21b39c=_0x21b39c-0x0;var _0x5908e9=_0xf082[_0x21b39c];return _0x5908e9;};'use strict';var db=require(_0x2f08('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x2f08('0x1'));var licenseUtil=require(_0x2f08('0x2'));var encryptor=require(_0x2f08('0x3'));var _=require(_0x2f08('0x4'));var jwt=require(_0x2f08('0x5'));var expressJwt=require(_0x2f08('0x6'));var compose=require(_0x2f08('0x7'));var basicAuth=require(_0x2f08('0x8'));var crypto=require(_0x2f08('0x9'));var BPromise=require(_0x2f08('0xa'));var util=require(_0x2f08('0xb'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x2f08('0xc')][_0x2f08('0xd')]});var userAttributes=['id','role',_0x2f08('0xe'),_0x2f08('0xf'),'internal',_0x2f08('0x10'),_0x2f08('0x11'),_0x2f08('0x12'),_0x2f08('0x13'),_0x2f08('0x14'),_0x2f08('0x15'),_0x2f08('0x16'),'faxPause',_0x2f08('0x17'),_0x2f08('0x18'),'pauseType',_0x2f08('0x19'),_0x2f08('0x1a'),_0x2f08('0x1b'),'crudPermissions',_0x2f08('0x1c'),_0x2f08('0x1d'),'alias',_0x2f08('0x1e'),_0x2f08('0x1f'),_0x2f08('0x20'),_0x2f08('0x21'),_0x2f08('0x22'),'phoneBarEnableSettings',_0x2f08('0x23'),_0x2f08('0x24'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x2f08('0x25'),_0x2f08('0x26'),'userProfileId',_0x2f08('0x27'),_0x2f08('0x28'),_0x2f08('0x29'),'downloadVoiceRecordings',_0x2f08('0x2a'),_0x2f08('0x2b')];exports[_0x2f08('0x2c')]=function(){return this['isAuthenticated'](!![])[_0x2f08('0x2d')](function(_0x263784,_0x1b29ca,_0x492d58){if(_0x263784[_0x2f08('0x2e')]){_0x492d58();}else{return db[_0x2f08('0x2f')][_0x2f08('0x30')]({'where':{'id':_0x263784[_0x2f08('0x31')]['id']},'attributes':['id',_0x2f08('0x32'),_0x2f08('0x33')],'raw':!![]})['then'](function(_0x3b3a54){if(_0x3b3a54&&_0x3b3a54[_0x2f08('0x32')]){return _0x1b29ca[_0x2f08('0x34')](_0x3b3a54['disposition']===_0x2f08('0x35')?0x195:0x193)[_0x2f08('0x36')]({'message':_0x3b3a54[_0x2f08('0x33')]===_0x2f08('0x35')?_0x2f08('0x37'):_0x2f08('0x38')});}else{_0x492d58();}})['catch'](function(_0x170754){_0x492d58(_0x170754);});}});};exports[_0x2f08('0x39')]=function isAuthenticated(_0x414a1b){return compose()[_0x2f08('0x2d')](function(_0x44e5f5,_0x5c323a,_0x2a25ce){var _0x44af12;if(_0x44e5f5[_0x2f08('0x3a')][_0x2f08('0x3b')]){if(_['startsWith'](_0x44e5f5[_0x2f08('0x3a')][_0x2f08('0x3b')],_0x2f08('0x3c'))){var _0x78b8fe=basicAuth(_0x44e5f5);db[_0x2f08('0x3d')][_0x2f08('0x3e')]({'where':{'name':_0x78b8fe[_0x2f08('0xf')]}})[_0x2f08('0x3f')](function(_0x12d34e){if(!_0x12d34e||!_0x12d34e['authenticate'](_0x78b8fe[_0x2f08('0x40')])){return _0x5c323a['status'](0x191)[_0x2f08('0x36')]({'message':_0x2f08('0x41')});}_0x44e5f5[_0x2f08('0x2e')]={'id':_0x12d34e['id']};_0x2a25ce();})['catch'](function(_0x43917a){_0x2a25ce(_0x43917a);});}else if(_[_0x2f08('0x42')](_0x44e5f5[_0x2f08('0x3a')][_0x2f08('0x3b')],_0x2f08('0x43'))){validateJwt(_0x44e5f5,_0x5c323a,_0x2a25ce);}else{if(_0x414a1b){_0x2a25ce();}else{return _0x5c323a[_0x2f08('0x34')](0x193)['json']({'message':_0x2f08('0x44')});}}}else if(_0x44e5f5[_0x2f08('0x45')]['apikey']){try{var _0xf26391={'audience':hardwareConf[_0x2f08('0x46')](),'issuer':hardwareConf[_0x2f08('0x46')]()};verifyJwt(_0x44e5f5['query']['apikey'],_0xf26391)[_0x2f08('0x3f')](function(_0x14971e){return db[_0x2f08('0x3d')]['find']({'where':{'id':_0x14971e['sub']}})['then'](function(_0x3943fc){_0x44af12=_0x3943fc;return db['Setting'][_0x2f08('0x30')]({'where':{'id':0x1},'attributes':[_0x2f08('0x47'),_0x2f08('0x48')],'raw':!![]});})[_0x2f08('0x3f')](function(_0x43a37d){if(!_0x44af12||!_['isEqual'](_0x44af12[_0x2f08('0x49')],_0x14971e[_0x2f08('0x4a')])){return _0x5c323a[_0x2f08('0x34')](0x191)[_0x2f08('0x36')]({'message':_0x2f08('0x4b')});}if(_0x44af12[_0x2f08('0x4c')]){return _0x5c323a[_0x2f08('0x34')](0x191)['json']({'message':_0x2f08('0x4d')});}if(_0x44af12['blocked']){if(_0x43a37d[_0x2f08('0x48')]>0x0){if(moment(_0x44af12['blockedAt'])[_0x2f08('0x4e')](_0x43a37d[_0x2f08('0x48')],'minutes')>moment()){return _0x5c323a['status'](0x191)[_0x2f08('0x36')]({'message':_0x2f08('0x4d')});}}else{return _0x5c323a[_0x2f08('0x34')](0x191)['json']({'message':_0x2f08('0x4d')});}}_0x44e5f5[_0x2f08('0x2e')]={'id':_0x44af12['id']};_0x2a25ce();});})[_0x2f08('0x4f')](function(){return _0x5c323a[_0x2f08('0x34')](0x191)[_0x2f08('0x36')]({'message':_0x2f08('0x4d')});});}catch(_0x4eec64){_0x2a25ce(_0x4eec64);}}else if(_0x414a1b){_0x2a25ce();}else{return _0x5c323a[_0x2f08('0x34')](0x193)[_0x2f08('0x36')]({'message':_0x2f08('0x44')});}})[_0x2f08('0x2d')](function(_0x558139,_0x58d89d,_0x48dca9){if(_0x558139['user']){db[_0x2f08('0x3d')][_0x2f08('0x3e')]({'where':{'id':_0x558139[_0x2f08('0x2e')]['id']},'attributes':userAttributes})[_0x2f08('0x3f')](function(_0x2f0753){if(!_0x2f0753){return _0x58d89d[_0x2f08('0x34')](0x194)[_0x2f08('0x36')]({'message':'User\x20not\x20found.'});}_0x558139[_0x2f08('0x2e')]=_0x2f0753;_0x48dca9();})[_0x2f08('0x4f')](function(_0x75ebc){_0x48dca9(_0x75ebc);});}else if(_0x414a1b){_0x48dca9();}else{return _0x58d89d[_0x2f08('0x34')](0x194)[_0x2f08('0x36')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2f08('0x50')]=function canUpdate(){return compose()['use'](function(_0x20041f,_0x50f080,_0x38a175){return licenseUtil['getLicense']()['then'](function(_0x57271f){if(_0x57271f['update']){_0x38a175();}else{return _0x50f080[_0x2f08('0x34')](0x193)[_0x2f08('0x36')]({'message':_0x2f08('0x51')});}})[_0x2f08('0x4f')](function(_0x37fb1d){_0x38a175(_0x37fb1d);});});};exports[_0x2f08('0x52')]=function(_0x5b32de,_0x32ded6,_0x165873){_0x5b32de[_0x2f08('0x52')]=!![];return _0x165873();};exports[_0x2f08('0x53')]=function signToken(_0x3b7400){return signJwt(_0x3b7400);};exports[_0x2f08('0x54')]=function(_0x445a20,_0x41b582){if(!_0x445a20[_0x2f08('0x2e')]){return _0x41b582[_0x2f08('0x34')](0x194)[_0x2f08('0x36')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x259b59={'payload':{'id':_0x445a20[_0x2f08('0x2e')]['id'],'role':_0x445a20[_0x2f08('0x2e')][_0x2f08('0x55')]},'options':{'expiresIn':0x15180}};return signJwt(_0x259b59)[_0x2f08('0x3f')](function(_0x29ee91){_0x41b582[_0x2f08('0x56')](_0x2f08('0x57'),_0x29ee91);_0x41b582[_0x2f08('0x58')](_0x2f08('0x59'));})['catch'](function(_0x8fcb5d){return _0x41b582[_0x2f08('0x34')](0x1f4)['send'](_0x8fcb5d);});};exports[_0x2f08('0x5a')]=function(_0x447289){if(_[_0x2f08('0x5b')](_0x447289[_0x2f08('0x49')])||_[_0x2f08('0x5b')](_0x447289[_0x2f08('0x5c')])){return null;}else{return createJwt(_0x447289);}};exports[_0x2f08('0x5d')]=function(_0x5b9c4c){_0x5b9c4c[_0x2f08('0x49')]=generateNonce();_0x5b9c4c['apiKeyIat']=generateIssuedAt();return createJwt(_0x5b9c4c);};exports[_0x2f08('0x5e')]=function(_0x137e1e,_0x27f134){var _0x44b447=_0x137e1e[_0x2f08('0x45')][_0x2f08('0x5f')];if(_0x44b447){var _0x5cf08a={'nonce':_0x27f134['apiKeyNonce'],'iat':_0x27f134[_0x2f08('0x5c')],'audience':hardwareConf[_0x2f08('0x46')](),'issuer':hardwareConf[_0x2f08('0x46')]()};return verifyJwt(_0x44b447,_0x5cf08a)[_0x2f08('0x3f')](function(){return generateApiKey(_0x27f134);});}else{throw{'message':_0x2f08('0x60')};}};exports['validatePasswordPattern']=function(_0x564421){var _0x518adf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x518adf['test'](_0x564421))throw new db[(_0x2f08('0x61'))][(_0x2f08('0x62'))](_0x2f08('0x63'));return;};exports[_0x2f08('0x64')]=function(_0x3c98ad,_0x214c82,_0x502d8e){var _0x12a12d=encryptor['decryptString'](_0x214c82)[_0x2f08('0x65')](',');for(var _0x4c4050=0x0;_0x4c4050<_0x502d8e;_0x4c4050++){if(!_0x12a12d[_0x4c4050])break;if(_0x3c98ad[_0x2f08('0x66')]()===_0x12a12d[_0x4c4050][_0x2f08('0x66')]()){var _0x5e14b2=util['format'](_0x2f08('0x67'),_0x502d8e);if(_0x502d8e===0x1){_0x5e14b2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2f08('0x61'))][(_0x2f08('0x62'))](_0x5e14b2);}}return;};exports['updatePasswordsHistory']=function(_0x52406e,_0x96e45c){var _0x45c351=_0x96e45c?encryptor[_0x2f08('0x68')](_0x96e45c)[_0x2f08('0x65')](','):[];if(_0x45c351[_0x2f08('0x69')]===0x5){_0x45c351['splice'](-0x1,0x1);}_0x45c351[_0x2f08('0x6a')](_0x52406e);return encryptor[_0x2f08('0x6b')](_0x45c351['join'](','));};function signJwt(_0x191662){var _0x30866a=BPromise['promisify'](jwt[_0x2f08('0x6c')],{'context':jwt});var _0x487dbd=_0x191662[_0x2f08('0x6d')]||config['secrets'][_0x2f08('0xd')];return new BPromise(function(_0x2f70f8,_0x4216d0){_0x30866a(_0x191662['payload'],_0x487dbd,_0x191662['options'])[_0x2f08('0x3f')](function(_0x5070f5){_0x2f70f8(_0x5070f5);})[_0x2f08('0x4f')](function(_0xb03aa0){_0x4216d0(_0xb03aa0);});});}function verifyJwt(_0x21a397,_0x28e534,_0x33467){var _0xa29c05=BPromise[_0x2f08('0x6e')](jwt[_0x2f08('0x6f')],{'context':jwt});var _0x24878a=_0x33467||config['secrets'][_0x2f08('0xd')];return new BPromise(function(_0x219f8b,_0x3d9870){_0xa29c05(_0x21a397,_0x24878a,_0x28e534)[_0x2f08('0x3f')](function(_0x5a3a6a){_0x219f8b(_0x5a3a6a);})['catch'](function(_0x532cc0){_0x3d9870(_0x532cc0);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x2f08('0x70')](_0x2f08('0x71'));}function generateIssuedAt(){return Math[_0x2f08('0x72')](Date[_0x2f08('0x73')]()/0x3e8)['toString']();}function createJwt(_0x1a5ec7){var _0x50cb75={'payload':{'iat':_0x1a5ec7[_0x2f08('0x5c')],'nonce':_0x1a5ec7[_0x2f08('0x49')]},'options':{'algorithm':_0x2f08('0x74'),'subject':_0x1a5ec7['id'][_0x2f08('0x70')](),'issuer':hardwareConf[_0x2f08('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x50cb75)[_0x2f08('0x3f')](function(_0x2b79c8){return{'iat':_0x1a5ec7[_0x2f08('0x5c')],'nonce':_0x1a5ec7[_0x2f08('0x49')],'token':_0x2b79c8};});} \ No newline at end of file +var _0x8536=['express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','use','startsWith','headers','authorization','Basic','User','find','authenticate','pass','Wrong\x20credentials.','user','apikey','getUuid','query','Setting','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','catch','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','session','options','verify','randomBytes','toString','hex','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x8536,0x100));var _0x6853=function(_0x6301a6,_0x8ea6b0){_0x6301a6=_0x6301a6-0x0;var _0x16f841=_0x8536[_0x6301a6];return _0x16f841;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x6853('0x0'));var hardwareConf=require(_0x6853('0x1'));var licenseUtil=require(_0x6853('0x2'));var encryptor=require(_0x6853('0x3'));var _=require(_0x6853('0x4'));var jwt=require(_0x6853('0x5'));var expressJwt=require(_0x6853('0x6'));var compose=require(_0x6853('0x7'));var basicAuth=require(_0x6853('0x8'));var crypto=require('crypto');var BPromise=require(_0x6853('0x9'));var util=require(_0x6853('0xa'));var moment=require(_0x6853('0xb'));var validateJwt=expressJwt({'secret':config[_0x6853('0xc')]['session']});var userAttributes=['id',_0x6853('0xd'),_0x6853('0xe'),_0x6853('0xf'),_0x6853('0x10'),_0x6853('0x11'),_0x6853('0x12'),_0x6853('0x13'),_0x6853('0x14'),_0x6853('0x15'),'chatPause',_0x6853('0x16'),_0x6853('0x17'),_0x6853('0x18'),'openchannelPause',_0x6853('0x19'),_0x6853('0x1a'),_0x6853('0x1b'),'lastPauseAt','crudPermissions',_0x6853('0x1c'),_0x6853('0x1d'),_0x6853('0x1e'),_0x6853('0x1f'),_0x6853('0x20'),_0x6853('0x21'),_0x6853('0x22'),_0x6853('0x23'),_0x6853('0x24'),_0x6853('0x25'),_0x6853('0x26'),_0x6853('0x27'),_0x6853('0x28'),'hotdesk',_0x6853('0x29'),_0x6853('0x2a'),_0x6853('0x2b'),_0x6853('0x2c'),_0x6853('0x2d'),'downloadVoiceRecordings',_0x6853('0x2e'),'downloadAttachments'];exports[_0x6853('0x2f')]=function(){return this[_0x6853('0x30')](!![])['use'](function(_0x1cfa33,_0x552621,_0x2e3490){if(_0x1cfa33['user']){_0x2e3490();}else{return db[_0x6853('0x31')][_0x6853('0x32')]({'where':{'id':_0x1cfa33['params']['id']},'attributes':['id',_0x6853('0x33'),_0x6853('0x34')],'raw':!![]})[_0x6853('0x35')](function(_0x131289){if(_0x131289&&_0x131289[_0x6853('0x33')]){return _0x552621[_0x6853('0x36')](_0x131289['disposition']===_0x6853('0x37')?0x195:0x193)[_0x6853('0x38')]({'message':_0x131289[_0x6853('0x34')]==='unmanaged'?_0x6853('0x39'):_0x6853('0x3a')});}else{_0x2e3490();}})['catch'](function(_0x5c2f02){_0x2e3490(_0x5c2f02);});}});};exports[_0x6853('0x30')]=function isAuthenticated(_0x2f4d2e){return compose()[_0x6853('0x3b')](function(_0x4e5b70,_0x3b13ff,_0x196941){var _0x4d2d2b;if(_0x4e5b70['headers']['authorization']){if(_[_0x6853('0x3c')](_0x4e5b70[_0x6853('0x3d')][_0x6853('0x3e')],_0x6853('0x3f'))){var _0x2d615d=basicAuth(_0x4e5b70);db[_0x6853('0x40')][_0x6853('0x41')]({'where':{'name':_0x2d615d[_0x6853('0xf')]}})[_0x6853('0x35')](function(_0x4b7efb){if(!_0x4b7efb||!_0x4b7efb[_0x6853('0x42')](_0x2d615d[_0x6853('0x43')])){return _0x3b13ff['status'](0x191)[_0x6853('0x38')]({'message':_0x6853('0x44')});}_0x4e5b70[_0x6853('0x45')]={'id':_0x4b7efb['id']};_0x196941();})['catch'](function(_0x3b8271){_0x196941(_0x3b8271);});}else if(_[_0x6853('0x3c')](_0x4e5b70[_0x6853('0x3d')][_0x6853('0x3e')],'Bearer')){validateJwt(_0x4e5b70,_0x3b13ff,_0x196941);}else{if(_0x2f4d2e){_0x196941();}else{return _0x3b13ff[_0x6853('0x36')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4e5b70['query'][_0x6853('0x46')]){try{var _0xd26184={'audience':hardwareConf[_0x6853('0x47')](),'issuer':hardwareConf[_0x6853('0x47')]()};verifyJwt(_0x4e5b70[_0x6853('0x48')][_0x6853('0x46')],_0xd26184)[_0x6853('0x35')](function(_0x173d0f){return db[_0x6853('0x40')][_0x6853('0x41')]({'where':{'id':_0x173d0f['sub']}})[_0x6853('0x35')](function(_0x2a4a16){_0x4d2d2b=_0x2a4a16;return db[_0x6853('0x49')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x6853('0x35')](function(_0x3171c8){if(!_0x4d2d2b||!_['isEqual'](_0x4d2d2b['apiKeyNonce'],_0x173d0f[_0x6853('0x4a')])){return _0x3b13ff[_0x6853('0x36')](0x191)[_0x6853('0x38')]({'message':_0x6853('0x4b')});}if(_0x4d2d2b[_0x6853('0x4c')]){return _0x3b13ff['status'](0x191)[_0x6853('0x38')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x4d2d2b['blocked']){if(_0x3171c8[_0x6853('0x4d')]>0x0){if(moment(_0x4d2d2b[_0x6853('0x4e')])[_0x6853('0x4f')](_0x3171c8[_0x6853('0x4d')],_0x6853('0x50'))>moment()){return _0x3b13ff[_0x6853('0x36')](0x191)[_0x6853('0x38')]({'message':_0x6853('0x51')});}}else{return _0x3b13ff['status'](0x191)[_0x6853('0x38')]({'message':_0x6853('0x51')});}}_0x4e5b70[_0x6853('0x45')]={'id':_0x4d2d2b['id']};_0x196941();});})['catch'](function(){return _0x3b13ff[_0x6853('0x36')](0x191)['json']({'message':_0x6853('0x51')});});}catch(_0xb3f34f){_0x196941(_0xb3f34f);}}else if(_0x2f4d2e){_0x196941();}else{return _0x3b13ff[_0x6853('0x36')](0x193)[_0x6853('0x38')]({'message':_0x6853('0x52')});}})['use'](function(_0x3bacb2,_0x51b129,_0x43bcbb){if(_0x3bacb2[_0x6853('0x45')]){db['User'][_0x6853('0x41')]({'where':{'id':_0x3bacb2[_0x6853('0x45')]['id']},'attributes':userAttributes})[_0x6853('0x35')](function(_0x33e234){if(!_0x33e234){return _0x51b129[_0x6853('0x36')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x3bacb2[_0x6853('0x45')]=_0x33e234;_0x43bcbb();})[_0x6853('0x53')](function(_0x37f3e5){_0x43bcbb(_0x37f3e5);});}else if(_0x2f4d2e){_0x43bcbb();}else{return _0x51b129[_0x6853('0x36')](0x194)['json']({'message':_0x6853('0x54')});}});};exports[_0x6853('0x55')]=function canUpdate(){return compose()[_0x6853('0x3b')](function(_0x3aed39,_0xe7f6c3,_0x14a87d){return licenseUtil[_0x6853('0x56')]()[_0x6853('0x35')](function(_0x1163a0){if(_0x1163a0[_0x6853('0x57')]){_0x14a87d();}else{return _0xe7f6c3[_0x6853('0x36')](0x193)['json']({'message':_0x6853('0x58')});}})['catch'](function(_0x5e6386){_0x14a87d(_0x5e6386);});});};exports[_0x6853('0x59')]=function(_0x4f9028,_0x2ee9b8,_0x26b873){_0x4f9028[_0x6853('0x59')]=!![];return _0x26b873();};exports[_0x6853('0x5a')]=function signToken(_0x23f950){return signJwt(_0x23f950);};exports[_0x6853('0x5b')]=function(_0x17d0cc,_0x577527){if(!_0x17d0cc[_0x6853('0x45')]){return _0x577527[_0x6853('0x36')](0x194)[_0x6853('0x38')]({'message':_0x6853('0x5c')});}var _0x533a82={'payload':{'id':_0x17d0cc[_0x6853('0x45')]['id'],'role':_0x17d0cc['user'][_0x6853('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x533a82)['then'](function(_0x7c6984){_0x577527[_0x6853('0x5d')](_0x6853('0x5e'),_0x7c6984);_0x577527[_0x6853('0x5f')](_0x6853('0x60'));})[_0x6853('0x53')](function(_0x661354){return _0x577527[_0x6853('0x36')](0x1f4)[_0x6853('0x61')](_0x661354);});};exports[_0x6853('0x62')]=function(_0x3e995e){if(_[_0x6853('0x63')](_0x3e995e[_0x6853('0x64')])||_[_0x6853('0x63')](_0x3e995e[_0x6853('0x65')])){return null;}else{return createJwt(_0x3e995e);}};exports[_0x6853('0x66')]=function(_0x2185b5){_0x2185b5[_0x6853('0x64')]=generateNonce();_0x2185b5['apiKeyIat']=generateIssuedAt();return createJwt(_0x2185b5);};exports['regenerateApiKey']=function(_0x35b37a,_0x2a99a2){var _0x4752b4=_0x35b37a[_0x6853('0x48')][_0x6853('0x46')];if(_0x4752b4){var _0x4b8df1={'nonce':_0x2a99a2['apiKeyNonce'],'iat':_0x2a99a2['apiKeyIat'],'audience':hardwareConf[_0x6853('0x47')](),'issuer':hardwareConf[_0x6853('0x47')]()};return verifyJwt(_0x4752b4,_0x4b8df1)[_0x6853('0x35')](function(){return generateApiKey(_0x2a99a2);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x6853('0x67')]=function(_0x93f912){var _0x210d48=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x210d48[_0x6853('0x68')](_0x93f912))throw new db[(_0x6853('0x69'))][(_0x6853('0x6a'))](_0x6853('0x6b'));return;};exports[_0x6853('0x6c')]=function(_0x3c75ca,_0x212add,_0x213013){var _0x3f7a14=encryptor[_0x6853('0x6d')](_0x212add)[_0x6853('0x6e')](',');for(var _0x10b559=0x0;_0x10b559<_0x213013;_0x10b559++){if(!_0x3f7a14[_0x10b559])break;if(_0x3c75ca[_0x6853('0x6f')]()===_0x3f7a14[_0x10b559][_0x6853('0x6f')]()){var _0xb58013=util[_0x6853('0x70')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x213013);if(_0x213013===0x1){_0xb58013=_0x6853('0x71');}throw new db['Sequelize'][(_0x6853('0x6a'))](_0xb58013);}}return;};exports[_0x6853('0x72')]=function(_0x33744e,_0x1fbea0){var _0x1acd1d=_0x1fbea0?encryptor[_0x6853('0x6d')](_0x1fbea0)[_0x6853('0x6e')](','):[];if(_0x1acd1d[_0x6853('0x73')]===0x5){_0x1acd1d[_0x6853('0x74')](-0x1,0x1);}_0x1acd1d[_0x6853('0x75')](_0x33744e);return encryptor[_0x6853('0x76')](_0x1acd1d[_0x6853('0x77')](','));};function signJwt(_0x2da92d){var _0x65cbe5=BPromise[_0x6853('0x78')](jwt[_0x6853('0x79')],{'context':jwt});var _0xab9f59=_0x2da92d[_0x6853('0x7a')]||config[_0x6853('0xc')][_0x6853('0x7b')];return new BPromise(function(_0x34fc6b,_0xc8b1c9){_0x65cbe5(_0x2da92d['payload'],_0xab9f59,_0x2da92d[_0x6853('0x7c')])['then'](function(_0x36c358){_0x34fc6b(_0x36c358);})[_0x6853('0x53')](function(_0x180e50){_0xc8b1c9(_0x180e50);});});}function verifyJwt(_0x59c7ef,_0x209942,_0x3eb4ab){var _0x57beb5=BPromise[_0x6853('0x78')](jwt[_0x6853('0x7d')],{'context':jwt});var _0x6593b4=_0x3eb4ab||config[_0x6853('0xc')][_0x6853('0x7b')];return new BPromise(function(_0x11fe2e,_0x30c6cd){_0x57beb5(_0x59c7ef,_0x6593b4,_0x209942)['then'](function(_0x2f4984){_0x11fe2e(_0x2f4984);})[_0x6853('0x53')](function(_0x2a91b2){_0x30c6cd(_0x2a91b2);});});}function generateNonce(){return crypto[_0x6853('0x7e')](0x10)[_0x6853('0x7f')](_0x6853('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x6853('0x81')]()/0x3e8)[_0x6853('0x7f')]();}function createJwt(_0x5e25a4){var _0x3b873d={'payload':{'iat':_0x5e25a4[_0x6853('0x65')],'nonce':_0x5e25a4[_0x6853('0x64')]},'options':{'algorithm':_0x6853('0x82'),'subject':_0x5e25a4['id']['toString'](),'issuer':hardwareConf[_0x6853('0x47')](),'audience':hardwareConf[_0x6853('0x47')]()}};return signJwt(_0x3b873d)['then'](function(_0x23a96b){return{'iat':_0x5e25a4[_0x6853('0x65')],'nonce':_0x5e25a4[_0x6853('0x64')],'token':_0x23a96b};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 76b5d47..15f6382 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 _0x18d0=['data','binary','write','end','final','close','unlink','createDecipher','update','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','secrets','session','aes-256-ctr','algorithm','encrypt','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x18d0,0x6f));var _0x018d=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x18d0[_0x5d2803];return _0xdcad2c;};'use strict';var crypto=require(_0x018d('0x0'));var fs=require('fs');var BPromise=require(_0x018d('0x1'));var _=require(_0x018d('0x2'));var config=require(_0x018d('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x018d('0x4')][_0x018d('0x5')],'algorithm':_0x018d('0x6')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config['encrypt'][_0x018d('0x7')]){var isSupported=isAlgorithmSupported(config[_0x018d('0x8')][_0x018d('0x7')]);if(isSupported){fileOptions[_0x018d('0x7')]=config[_0x018d('0x8')][_0x018d('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x018d('0x9')](',\x20');logger[_0x018d('0xa')](config[_0x018d('0x8')]['algorithm'],_0x018d('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x9a778d){return AES_SUPPORTED_RX['test'](_0x9a778d);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x4c2e6b){return getSupportedCiphers()[_0x018d('0xc')](_0x4c2e6b)>-0x1;}function combineOptions(_0xefcdc){var _0x5c0040={};for(var _0x2fd9f7 in fileOptions){if(fileOptions[_0x018d('0xd')](_0x2fd9f7)){_0x5c0040[_0x2fd9f7]=fileOptions[_0x2fd9f7];}}if(_0xefcdc){for(var _0x21b53e in _0xefcdc){if(_0xefcdc[_0x018d('0xd')](_0x21b53e)){_0x5c0040[_0x21b53e]=_0xefcdc[_0x21b53e];}}}return _0x5c0040;}exports[_0x018d('0xe')]=function(_0x309b77,_0x30af0f,_0xc998a1,_0x44e4bd){return new BPromise(function(_0x169bb8,_0x1dcad9){_0x44e4bd=combineOptions(_0x44e4bd);var _0x5717dc=new Buffer(_0xc998a1);var _0x548682=fs[_0x018d('0xf')](_0x309b77);var _0x4bf73b=fs[_0x018d('0x10')](_0x30af0f);var _0x45f2d4=crypto['createCipher'](_0x44e4bd[_0x018d('0x7')],_0x5717dc);_0x548682['on'](_0x018d('0x11'),function(_0xb76404){var _0x4a2bc5=new Buffer(_0x45f2d4['update'](_0xb76404),_0x018d('0x12'));_0x4bf73b[_0x018d('0x13')](_0x4a2bc5);});_0x548682['on'](_0x018d('0x14'),function(){try{var _0x3f589e=new Buffer(_0x45f2d4[_0x018d('0x15')]('binary'),_0x018d('0x12'));_0x4bf73b['write'](_0x3f589e);_0x4bf73b[_0x018d('0x14')]();_0x4bf73b['on'](_0x018d('0x16'),function(){return _0x169bb8(_0x30af0f);});}catch(_0x42f01b){fs[_0x018d('0x17')](_0x30af0f);return _0x1dcad9(_0x42f01b);}});});};exports['decryptFile']=function(_0x45de23,_0x4e300f,_0x11a256,_0x15aa96){return new BPromise(function(_0x22df04,_0x3608df){_0x15aa96=combineOptions(_0x15aa96);var _0x314922=new Buffer(_0x11a256);var _0x24bed2=fs[_0x018d('0xf')](_0x45de23);var _0x37ae7a=fs[_0x018d('0x10')](_0x4e300f);var _0x10ca6f=crypto[_0x018d('0x18')](_0x15aa96[_0x018d('0x7')],_0x314922);_0x24bed2['on']('data',function(_0x1b490e){var _0x22230e=new Buffer(_0x10ca6f[_0x018d('0x19')](_0x1b490e),_0x018d('0x12'));_0x37ae7a[_0x018d('0x13')](_0x22230e);});_0x24bed2['on']('end',function(){try{var _0x5c1fd4=new Buffer(_0x10ca6f[_0x018d('0x15')](_0x018d('0x12')),'binary');_0x37ae7a[_0x018d('0x13')](_0x5c1fd4);_0x37ae7a[_0x018d('0x14')]();_0x37ae7a['on'](_0x018d('0x16'),function(){return _0x22df04(_0x4e300f);});}catch(_0x396b2f){fs[_0x018d('0x17')](_0x4e300f);return _0x3608df(_0x396b2f);}});});};exports[_0x018d('0x1a')]=function(_0x41e404,_0x20054e,_0x5960f6){var _0x2e511c=_0x5960f6||stringOptions[_0x018d('0x7')];var _0x25ae39=_0x20054e||stringOptions[_0x018d('0x1b')];var _0x2d0272=crypto[_0x018d('0x1c')](_0x2e511c,_0x25ae39);var _0x12c6ad=_0x2d0272[_0x018d('0x19')](_0x41e404,_0x018d('0x1d'),_0x018d('0x1e'));_0x12c6ad+=_0x2d0272[_0x018d('0x15')]('base64');return _0x12c6ad;};exports[_0x018d('0x1f')]=function(_0x244d60,_0x3c104f,_0x1e55ad){var _0x6681b0=_0x1e55ad||stringOptions[_0x018d('0x7')];var _0x434102=_0x3c104f||stringOptions[_0x018d('0x1b')];var _0x3ede4e=crypto['createDecipher'](_0x6681b0,_0x434102);var _0x5dec93=_0x3ede4e[_0x018d('0x19')](_0x244d60,_0x018d('0x1e'),_0x018d('0x1d'));_0x5dec93+=_0x3ede4e[_0x018d('0x15')]('utf8');return _0x5dec93;}; \ No newline at end of file +var _0x4ca7=['aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','data','update','write','end','final','binary','close','unlink','decryptFile','createWriteStream','createDecipher','encryptString','secret','utf8','base64','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr'];(function(_0x4de377,_0x2badfc){var _0xaffd72=function(_0x586974){while(--_0x586974){_0x4de377['push'](_0x4de377['shift']());}};_0xaffd72(++_0x2badfc);}(_0x4ca7,0xcf));var _0x74ca=function(_0x1e7517,_0x16adb3){_0x1e7517=_0x1e7517-0x0;var _0x5e79c2=_0x4ca7[_0x1e7517];return _0x5e79c2;};'use strict';var crypto=require(_0x74ca('0x0'));var fs=require('fs');var BPromise=require(_0x74ca('0x1'));var _=require(_0x74ca('0x2'));var config=require(_0x74ca('0x3'));var logger=require(_0x74ca('0x4'))(_0x74ca('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x74ca('0x6')][_0x74ca('0x7')],'algorithm':_0x74ca('0x8')};const fileOptions={'algorithm':_0x74ca('0x9')};if(config[_0x74ca('0xa')]&&config['encrypt'][_0x74ca('0xb')]){var isSupported=isAlgorithmSupported(config[_0x74ca('0xa')][_0x74ca('0xb')]);if(isSupported){fileOptions[_0x74ca('0xb')]=config[_0x74ca('0xa')][_0x74ca('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x74ca('0xc')](',\x20');logger[_0x74ca('0xd')](config[_0x74ca('0xa')]['algorithm'],_0x74ca('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x522e3d){return AES_SUPPORTED_RX['test'](_0x522e3d);}function getSupportedCiphers(){return crypto[_0x74ca('0xf')]()[_0x74ca('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x5db127){return getSupportedCiphers()[_0x74ca('0x11')](_0x5db127)>-0x1;}function combineOptions(_0x55ecf8){var _0x32f7a1={};for(var _0x5f28d8 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5f28d8)){_0x32f7a1[_0x5f28d8]=fileOptions[_0x5f28d8];}}if(_0x55ecf8){for(var _0x2a3749 in _0x55ecf8){if(_0x55ecf8[_0x74ca('0x12')](_0x2a3749)){_0x32f7a1[_0x2a3749]=_0x55ecf8[_0x2a3749];}}}return _0x32f7a1;}exports[_0x74ca('0x13')]=function(_0x2e9356,_0x4b36f8,_0x46f45e,_0x246f74){return new BPromise(function(_0x1e920e,_0x25326e){_0x246f74=combineOptions(_0x246f74);var _0x445b07=new Buffer(_0x46f45e);var _0x556207=fs[_0x74ca('0x14')](_0x2e9356);var _0x262925=fs['createWriteStream'](_0x4b36f8);var _0x1ed9b1=crypto['createCipher'](_0x246f74[_0x74ca('0xb')],_0x445b07);_0x556207['on'](_0x74ca('0x15'),function(_0x4d75ed){var _0x1d9971=new Buffer(_0x1ed9b1[_0x74ca('0x16')](_0x4d75ed),'binary');_0x262925[_0x74ca('0x17')](_0x1d9971);});_0x556207['on'](_0x74ca('0x18'),function(){try{var _0x2b3d13=new Buffer(_0x1ed9b1[_0x74ca('0x19')]('binary'),_0x74ca('0x1a'));_0x262925[_0x74ca('0x17')](_0x2b3d13);_0x262925[_0x74ca('0x18')]();_0x262925['on'](_0x74ca('0x1b'),function(){return _0x1e920e(_0x4b36f8);});}catch(_0xe394c5){fs[_0x74ca('0x1c')](_0x4b36f8);return _0x25326e(_0xe394c5);}});});};exports[_0x74ca('0x1d')]=function(_0x2f61c5,_0x241f22,_0x2b2c40,_0x22e13b){return new BPromise(function(_0x451ef9,_0x3aea8a){_0x22e13b=combineOptions(_0x22e13b);var _0x3d4bd5=new Buffer(_0x2b2c40);var _0x11ce1a=fs[_0x74ca('0x14')](_0x2f61c5);var _0x29997b=fs[_0x74ca('0x1e')](_0x241f22);var _0x513b11=crypto[_0x74ca('0x1f')](_0x22e13b[_0x74ca('0xb')],_0x3d4bd5);_0x11ce1a['on'](_0x74ca('0x15'),function(_0x12cd1c){var _0x3bbd3a=new Buffer(_0x513b11[_0x74ca('0x16')](_0x12cd1c),'binary');_0x29997b[_0x74ca('0x17')](_0x3bbd3a);});_0x11ce1a['on'](_0x74ca('0x18'),function(){try{var _0x130055=new Buffer(_0x513b11['final'](_0x74ca('0x1a')),'binary');_0x29997b['write'](_0x130055);_0x29997b[_0x74ca('0x18')]();_0x29997b['on'](_0x74ca('0x1b'),function(){return _0x451ef9(_0x241f22);});}catch(_0x40a6c1){fs[_0x74ca('0x1c')](_0x241f22);return _0x3aea8a(_0x40a6c1);}});});};exports[_0x74ca('0x20')]=function(_0x322c04,_0x24ac06,_0x435a47){var _0x36715d=_0x435a47||stringOptions[_0x74ca('0xb')];var _0xc6807f=_0x24ac06||stringOptions[_0x74ca('0x21')];var _0x2f325a=crypto['createCipher'](_0x36715d,_0xc6807f);var _0x59ed1c=_0x2f325a[_0x74ca('0x16')](_0x322c04,_0x74ca('0x22'),_0x74ca('0x23'));_0x59ed1c+=_0x2f325a['final'](_0x74ca('0x23'));return _0x59ed1c;};exports['decryptString']=function(_0x454190,_0x557963,_0x36aad2){var _0x36384b=_0x36aad2||stringOptions[_0x74ca('0xb')];var _0x5dbc41=_0x557963||stringOptions[_0x74ca('0x21')];var _0x1fc066=crypto['createDecipher'](_0x36384b,_0x5dbc41);var _0x3a1daf=_0x1fc066[_0x74ca('0x16')](_0x454190,_0x74ca('0x23'),_0x74ca('0x22'));_0x3a1daf+=_0x1fc066[_0x74ca('0x19')](_0x74ca('0x22'));return _0x3a1daf;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a141d9c..b3a0ad4 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 _0xbbec=['finally','exit','util','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','sequelize','query','SELECT','then','num','Empty','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','length','existsSync','join','mkdirSync','each','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x3d4698,_0x2c9d8c){var _0x58c0f9=function(_0x5a32b7){while(--_0x5a32b7){_0x3d4698['push'](_0x3d4698['shift']());}};_0x58c0f9(++_0x2c9d8c);}(_0xbbec,0x1ec));var _0xcbbe=function(_0x1817a8,_0x23a441){_0x1817a8=_0x1817a8-0x0;var _0x2b66bc=_0xbbec[_0x1817a8];return _0x2b66bc;};'use strict';var util=require(_0xcbbe('0x0'));var path=require('path');var _=require(_0xcbbe('0x1'));var csv=require(_0xcbbe('0x2'));var fs=require('fs');var BPromise=require(_0xcbbe('0x3'));var zipdir=require(_0xcbbe('0x4'));var rimraf=require('rimraf');var db=require(_0xcbbe('0x5'))['db'];var dbH=require(_0xcbbe('0x5'))[_0xcbbe('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcbbe('0x7')][0x2]);var QUERY=process[_0xcbbe('0x7')][0x3];var PATH=process[_0xcbbe('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x472f17,_0x3e2fb8){var _0x1e6c9b={'status':_0x472f17};var _0x2143d9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e2fb8){_0x1e6c9b[_0xcbbe('0x8')]=_0x3e2fb8;}return db[_0xcbbe('0x9')][_0xcbbe('0xa')](_0x1e6c9b,_0x2143d9);}function main(){var _0x2779ae=0x1388;var _0xc9fc9;logger[_0xcbbe('0xb')](util[_0xcbbe('0xc')](_0xcbbe('0xd'),EXTRACTED_REPORT_ID,_0xcbbe('0xe')));return db[_0xcbbe('0xf')][_0xcbbe('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcbbe('0x11'),_0xcbbe('0x12')]})['then'](function(_0x151157){if(_0x151157){_0xc9fc9=_0x151157;_0x2779ae=_0xc9fc9[_0xcbbe('0x12')]||0x1388;}})['then'](function(){return dbH[_0xcbbe('0x13')][_0xcbbe('0x14')](util[_0xcbbe('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xcbbe('0x13')]['QueryTypes'][_0xcbbe('0x15')]});})[_0xcbbe('0x16')](function(_0x1e4228){if(!_0x1e4228[0x0][_0xcbbe('0x17')]){return analyticExtractedReport(_0xcbbe('0x18'));}var _0x580b44=[];var _0x2d84f9=0x0;if(_0xc9fc9['split']){if(_0x1e4228&&_0x1e4228['length']){var _0x1fc904=_['range'](_0x1e4228[0x0]['num']/_0x2779ae);var _0xc1ce9e=Number[_0xcbbe('0x19')](_0x1e4228[0x0][_0xcbbe('0x17')]/_0x2779ae)?_0x1e4228[0x0]['num']%_0x2779ae:0x0;_0x1fc904['forEach'](function(_0x21a3e6){if(_0x21a3e6>0x0){_0x2d84f9+=_0x2779ae;}_0x580b44[_0xcbbe('0x1a')](dbH[_0xcbbe('0x13')][_0xcbbe('0x14')](util[_0xcbbe('0xc')](_0xcbbe('0x1b'),QUERY,_0x2779ae,_0x2d84f9),{'type':dbH[_0xcbbe('0x13')][_0xcbbe('0x1c')]['SELECT']}));});if(_0xc1ce9e>0x0){_0x2d84f9+=_0x2779ae;_0x580b44[_0xcbbe('0x1a')](dbH[_0xcbbe('0x13')][_0xcbbe('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xc1ce9e,_0x2d84f9),{'type':dbH['sequelize'][_0xcbbe('0x1c')][_0xcbbe('0x15')]}));}}}else{_0x580b44[_0xcbbe('0x1a')](dbH[_0xcbbe('0x13')]['query'](QUERY,{'type':dbH[_0xcbbe('0x13')][_0xcbbe('0x1c')][_0xcbbe('0x15')]}));}var _0x542447=path[_0xcbbe('0x1d')](PATH);var _0x1905ea=path[_0xcbbe('0x1e')](PATH,'.csv');var _0x7369c=_0xc9fc9['split']&&_0x580b44[_0xcbbe('0x1f')]>0x1;var _0x74b43=[];if(!fs[_0xcbbe('0x20')](path[_0xcbbe('0x21')](_0x542447,_0x1905ea))&&_0x7369c){fs[_0xcbbe('0x22')](path[_0xcbbe('0x21')](_0x542447,_0x1905ea));}return BPromise[_0xcbbe('0x23')](_0x580b44,function(_0x4e5c0f){_0x74b43[_0xcbbe('0x1a')](_0x4e5c0f);})[_0xcbbe('0x16')](function(){for(var _0x2a63f1=0x0;_0x2a63f1<_0x74b43[_0xcbbe('0x1f')];_0x2a63f1+=0x1){var _0xc7ac11;var _0x492eea=_0x74b43[_0x2a63f1];if(_0x7369c){_0xc7ac11=path[_0xcbbe('0x21')](_0x542447,_0x1905ea,util[_0xcbbe('0xc')]('%s%d.%s',_0x1905ea,_0x2a63f1,_0xcbbe('0x24')));}else{_0xc7ac11=path[_0xcbbe('0x21')](_0x542447,util[_0xcbbe('0xc')]('%s.%s',_0x1905ea,_0xcbbe('0x24')));}fs[_0xcbbe('0x25')](_0xc7ac11,csv(_0x492eea));}})[_0xcbbe('0x16')](function(){if(_0x7369c){return new Promise(function(_0x35c68e){zipdir(path[_0xcbbe('0x21')](_0x542447,_0x1905ea),{'saveTo':path[_0xcbbe('0x21')](_0x542447,util[_0xcbbe('0xc')]('%s.%s',_0x1905ea,_0xcbbe('0x26')))},function(_0x4ccd56,_0x14b6d2){rimraf(path[_0xcbbe('0x21')](_0x542447,_0x1905ea),function(){});_0x35c68e(_0xcbbe('0x27'));});});}})[_0xcbbe('0x16')](function(){logger[_0xcbbe('0xb')](util[_0xcbbe('0xc')](_0xcbbe('0x28'),EXTRACTED_REPORT_ID,_0xcbbe('0xe')));return analyticExtractedReport(_0xcbbe('0x29'),_0x7369c?util['format'](_0xcbbe('0x2a'),_0x1905ea,_0x7369c?'zip':'csv'):null);});})[_0xcbbe('0x2b')](function(_0x14fb08){logger[_0xcbbe('0xb')](util[_0xcbbe('0xc')](_0xcbbe('0x2c'),EXTRACTED_REPORT_ID,_0xcbbe('0xe')),util[_0xcbbe('0x2d')](_0x14fb08,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcbbe('0x2e'));})[_0xcbbe('0x2f')](function(){process[_0xcbbe('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6ae8=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.csv','existsSync','join','%s%d.%s','%s.%s','csv','writeFileSync','zip','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','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','info','format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger'];(function(_0x38f5f8,_0xefe164){var _0x34e820=function(_0x3a2407){while(--_0x3a2407){_0x38f5f8['push'](_0x38f5f8['shift']());}};_0x34e820(++_0xefe164);}(_0x6ae8,0xa2));var _0x86ae=function(_0x571714,_0x30d2b3){_0x571714=_0x571714-0x0;var _0x599a14=_0x6ae8[_0x571714];return _0x599a14;};'use strict';var util=require(_0x86ae('0x0'));var path=require('path');var _=require(_0x86ae('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x86ae('0x2'));var zipdir=require(_0x86ae('0x3'));var rimraf=require(_0x86ae('0x4'));var db=require(_0x86ae('0x5'))['db'];var dbH=require('../../mysqldb')[_0x86ae('0x6')];var logger=require(_0x86ae('0x7'))(_0x86ae('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x86ae('0x9')][0x3];var PATH=process[_0x86ae('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x131e51,_0x53cb67){var _0x3557f7={'status':_0x131e51};var _0x26981a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x53cb67){_0x3557f7['savename']=_0x53cb67;}return db['AnalyticExtractedReport']['update'](_0x3557f7,_0x26981a);}function main(){var _0x6cfc8c=0x1388;var _0x436977;logger[_0x86ae('0xa')](util[_0x86ae('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x86ae('0xc')));return db[_0x86ae('0xd')][_0x86ae('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x86ae('0xf'),'splitSizeCsv']})[_0x86ae('0x10')](function(_0x3f4c3e){if(_0x3f4c3e){_0x436977=_0x3f4c3e;_0x6cfc8c=_0x436977[_0x86ae('0x11')]||0x1388;}})[_0x86ae('0x10')](function(){return dbH[_0x86ae('0x12')]['query'](util['format'](_0x86ae('0x13'),QUERY),{'type':dbH[_0x86ae('0x12')][_0x86ae('0x14')][_0x86ae('0x15')]});})[_0x86ae('0x10')](function(_0x73fab5){if(!_0x73fab5[0x0][_0x86ae('0x16')]){return analyticExtractedReport(_0x86ae('0x17'));}var _0x2f39c9=[];var _0x49a75e=0x0;if(_0x436977[_0x86ae('0xf')]){if(_0x73fab5&&_0x73fab5[_0x86ae('0x18')]){var _0x540980=_['range'](_0x73fab5[0x0][_0x86ae('0x16')]/_0x6cfc8c);var _0x151cd1=Number[_0x86ae('0x19')](_0x73fab5[0x0][_0x86ae('0x16')]/_0x6cfc8c)?_0x73fab5[0x0][_0x86ae('0x16')]%_0x6cfc8c:0x0;_0x540980[_0x86ae('0x1a')](function(_0x38a259){if(_0x38a259>0x0){_0x49a75e+=_0x6cfc8c;}_0x2f39c9[_0x86ae('0x1b')](dbH[_0x86ae('0x12')]['query'](util['format'](_0x86ae('0x1c'),QUERY,_0x6cfc8c,_0x49a75e),{'type':dbH[_0x86ae('0x12')]['QueryTypes'][_0x86ae('0x15')]}));});if(_0x151cd1>0x0){_0x49a75e+=_0x6cfc8c;_0x2f39c9[_0x86ae('0x1b')](dbH[_0x86ae('0x12')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x151cd1,_0x49a75e),{'type':dbH[_0x86ae('0x12')][_0x86ae('0x14')][_0x86ae('0x15')]}));}}}else{_0x2f39c9[_0x86ae('0x1b')](dbH[_0x86ae('0x12')][_0x86ae('0x1d')](QUERY,{'type':dbH[_0x86ae('0x12')][_0x86ae('0x14')]['SELECT']}));}var _0x48ce04=path[_0x86ae('0x1e')](PATH);var _0x21f4cc=path[_0x86ae('0x1f')](PATH,_0x86ae('0x20'));var _0x900a26=_0x436977['split']&&_0x2f39c9[_0x86ae('0x18')]>0x1;var _0x1ef061=[];if(!fs[_0x86ae('0x21')](path[_0x86ae('0x22')](_0x48ce04,_0x21f4cc))&&_0x900a26){fs['mkdirSync'](path['join'](_0x48ce04,_0x21f4cc));}return BPromise['each'](_0x2f39c9,function(_0x2748fa){_0x1ef061[_0x86ae('0x1b')](_0x2748fa);})['then'](function(){for(var _0xb13681=0x0;_0xb13681<_0x1ef061[_0x86ae('0x18')];_0xb13681+=0x1){var _0xe3d1db;var _0x47b596=_0x1ef061[_0xb13681];if(_0x900a26){_0xe3d1db=path[_0x86ae('0x22')](_0x48ce04,_0x21f4cc,util[_0x86ae('0xb')](_0x86ae('0x23'),_0x21f4cc,_0xb13681,'csv'));}else{_0xe3d1db=path[_0x86ae('0x22')](_0x48ce04,util['format'](_0x86ae('0x24'),_0x21f4cc,_0x86ae('0x25')));}fs[_0x86ae('0x26')](_0xe3d1db,csv(_0x47b596));}})[_0x86ae('0x10')](function(){if(_0x900a26){return new Promise(function(_0x4723a9){zipdir(path[_0x86ae('0x22')](_0x48ce04,_0x21f4cc),{'saveTo':path[_0x86ae('0x22')](_0x48ce04,util[_0x86ae('0xb')]('%s.%s',_0x21f4cc,_0x86ae('0x27')))},function(_0x1c7300,_0x37f02c){rimraf(path[_0x86ae('0x22')](_0x48ce04,_0x21f4cc),function(){});_0x4723a9('zip\x20finished');});});}})[_0x86ae('0x10')](function(){logger['info'](util[_0x86ae('0xb')](_0x86ae('0x28'),EXTRACTED_REPORT_ID,_0x86ae('0xc')));return analyticExtractedReport(_0x86ae('0x29'),_0x900a26?util[_0x86ae('0xb')](_0x86ae('0x24'),_0x21f4cc,_0x900a26?_0x86ae('0x27'):_0x86ae('0x25')):null);});})[_0x86ae('0x2a')](function(_0x587786){logger[_0x86ae('0xa')](util[_0x86ae('0xb')](_0x86ae('0x2b'),EXTRACTED_REPORT_ID,_0x86ae('0xc')),util[_0x86ae('0x2c')](_0x587786,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x86ae('0x2d'));})['finally'](function(){process[_0x86ae('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3330775..33a93f9 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 _0xa2b9=['fill','length','auto','body','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','pageBreak','margin','push','\x20/\x20','footer','black','right','num','Empty','Setting','find','split','then','range','isInteger','sequelize','query','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','createPdfKitDocument','pdf','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','bluebird','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','toString','value'];(function(_0x229643,_0x71e2a3){var _0x15ce21=function(_0xe2cc94){while(--_0xe2cc94){_0x229643['push'](_0x229643['shift']());}};_0x15ce21(++_0x71e2a3);}(_0xa2b9,0x1df));var _0x9a2b=function(_0x6bab10,_0x502973){_0x6bab10=_0x6bab10-0x0;var _0x3b45cf=_0xa2b9[_0x6bab10];return _0x3b45cf;};'use strict';var _=require(_0x9a2b('0x0'));var fs=require('fs');var util=require(_0x9a2b('0x1'));var path=require(_0x9a2b('0x2'));var moment=require(_0x9a2b('0x3'));var htmlToPdfmake=require(_0x9a2b('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x9a2b('0x5'));var rimraf=require(_0x9a2b('0x6'));var JSDOM=require(_0x9a2b('0x7'))[_0x9a2b('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0x9a2b('0x9'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x9a2b('0xa')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9a2b('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9a2b('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x9a2b('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2da1bf,_0x27381d){var _0x1c375d={'status':_0x2da1bf};var _0x4c08a4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27381d){_0x1c375d[_0x9a2b('0xd')]=_0x27381d;}return db[_0x9a2b('0xe')]['update'](_0x1c375d,_0x4c08a4);}function getHeaders(_0x7a8f80){return _[_0x9a2b('0xf')](_0x7a8f80,function(_0x5a2d10){return{'text':_0x5a2d10,'style':_0x9a2b('0x10')};});}function getRows(_0x425c79,_0x2f593e){return _['map'](_0x2f593e,function(_0x5866a8){return _(_0x5866a8)['pick'](_0x425c79)[_0x9a2b('0xf')](function(_0x22728a){return _0x22728a?_[_0x9a2b('0x11')](_0x22728a):'';})[_0x9a2b('0x12')]();});}function createTable(_0x3060e6,_0x16efae){var _0x1f785f={'widths':_[_0x9a2b('0x13')](Array(_0x3060e6[_0x9a2b('0x14')]),0x91),'heights':function(_0xfbddc7){return _0xfbddc7===0x0?_0x9a2b('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1d6d0d=getHeaders(_0x3060e6);_0x1f785f[_0x9a2b('0x16')]['push'](_0x1d6d0d);var _0x31190b=getRows(_0x3060e6,_0x16efae);_0x1f785f['body']=_0x1f785f['body'][_0x9a2b('0x17')](_0x31190b);return _0x1f785f;}function createTables(_0x2b8b54){var _0x17476b=[];var _0x4868f2=_[_0x9a2b('0x18')](Object[_0x9a2b('0x19')](_0x2b8b54[0x0]),0x5);_0x4868f2['forEach'](function(_0x2d2c90){_0x17476b['push'](createTable(_0x2d2c90,_0x2b8b54));});return _0x17476b;}function getPDFDocDefinition(_0x4afdc4){var _0x1c279b=util[_0x9a2b('0x1a')](_0x9a2b('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x9a2b('0x1c')])[_0x9a2b('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x3c917a=[];for(var _0x2945d6=0x0;_0x2945d6<_0x4afdc4[_0x9a2b('0x14')];_0x2945d6++){var _0x6c410=[];if(_0x2945d6===0x0){_0x6c410['push']({'text':_0x1c279b,'style':'header'});}var _0x1aa265={'table':_0x4afdc4[_0x2945d6]};if(_0x2945d6>0x0){_0x1aa265[_0x9a2b('0x1d')]='before';_0x1aa265[_0x9a2b('0x1e')]=[0x0,0x46,0x0,0x0];}_0x6c410[_0x9a2b('0x1f')](_0x1aa265);_0x3c917a[_0x9a2b('0x1f')](_0x6c410);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3c917a,'footer':function(_0x39a957,_0x318d14){return{'text':_0x39a957[_0x9a2b('0x11')]()+_0x9a2b('0x20')+_0x318d14,'style':_0x9a2b('0x21')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9a2b('0x22')},'footer':{'alignment':_0x9a2b('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x340fa4){var _0x25d925=0x1388;var _0x17687d;if(!_0x340fa4[0x0][_0x9a2b('0x24')]){return analyticExtractedReport(_0x9a2b('0x25'));}return db[_0x9a2b('0x26')][_0x9a2b('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9a2b('0x28'),'splitSizePdf']})[_0x9a2b('0x29')](function(_0x56c77a){if(_0x56c77a){_0x17687d=_0x56c77a;_0x25d925=_0x17687d['splitSizePdf']||0x3e8;}})[_0x9a2b('0x29')](function(){var _0x3dc0fc=[];var _0x400a00=0x0;if(_0x17687d[_0x9a2b('0x28')]){if(_0x340fa4&&_0x340fa4['length']){var _0x23ea76=_[_0x9a2b('0x2a')](_0x340fa4[0x0][_0x9a2b('0x24')]/_0x25d925);var _0x59ffa1=Number[_0x9a2b('0x2b')](_0x340fa4[0x0]['num']/_0x25d925)?_0x340fa4[0x0][_0x9a2b('0x24')]%_0x25d925:0x0;_0x23ea76['forEach'](function(_0x4c4a42){if(_0x4c4a42>0x0){_0x400a00+=_0x25d925;}_0x3dc0fc['push'](dbH[_0x9a2b('0x2c')][_0x9a2b('0x2d')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x25d925,_0x400a00),{'type':dbH[_0x9a2b('0x2c')][_0x9a2b('0x2e')]['SELECT']}));});if(_0x59ffa1>0x0){_0x400a00+=_0x25d925;_0x3dc0fc[_0x9a2b('0x1f')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x59ffa1,_0x400a00),{'type':dbH['sequelize'][_0x9a2b('0x2e')]['SELECT']}));}}}else{_0x3dc0fc[_0x9a2b('0x1f')](dbH[_0x9a2b('0x2c')][_0x9a2b('0x2d')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x9a2b('0x2f')]}));}var _0x19d1aa=path[_0x9a2b('0x30')](PATH);var _0x395449=path[_0x9a2b('0x31')](PATH,'.pdf');var _0x5d923c=_0x17687d[_0x9a2b('0x28')]&&_0x3dc0fc[_0x9a2b('0x14')]>0x1;var _0x282c0a=[];if(!fs[_0x9a2b('0x32')](path[_0x9a2b('0x33')](_0x19d1aa,_0x395449))&&_0x5d923c){fs[_0x9a2b('0x34')](path[_0x9a2b('0x33')](_0x19d1aa,_0x395449));}return BPromise[_0x9a2b('0x35')](_0x3dc0fc,function(_0x532dc1){_0x282c0a['push'](_0x532dc1);})['then'](function(){var _0x3d58ed=[];for(var _0x517805=0x0;_0x517805<_0x282c0a['length'];_0x517805+=0x1){var _0x371e77=_0x282c0a[_0x517805];var _0x44eb14=createTables(_['flatten'](_0x371e77));var _0x31568a;var _0x547aeb=getPDFDocDefinition(_0x44eb14);var _0x2e6487=getPDFPrinter();var _0x3aa246=_0x2e6487[_0x9a2b('0x36')](_0x547aeb);if(_0x5d923c){_0x31568a=path['join'](_0x19d1aa,_0x395449,util[_0x9a2b('0x1a')]('%s%d.%s',_0x395449,_0x517805,_0x9a2b('0x37')));}else{_0x31568a=path[_0x9a2b('0x33')](_0x19d1aa,util['format'](_0x9a2b('0x38'),_0x395449,_0x9a2b('0x37')));}_0x3d58ed['push'](writePDFDocument(_0x3aa246,_0x31568a));}return Promise['all'](_0x3d58ed);})['then'](function(){if(_0x5d923c){return new Promise(function(_0x16d612){zipdir(path['join'](_0x19d1aa,_0x395449),{'saveTo':path[_0x9a2b('0x33')](_0x19d1aa,util[_0x9a2b('0x1a')]('%s.%s',_0x395449,'zip'))},function(){rimraf(path[_0x9a2b('0x33')](_0x19d1aa,_0x395449),function(){});_0x16d612(_0x9a2b('0x39'));});});}})[_0x9a2b('0x29')](function(){if(!_0x5d923c)return;rimraf(path[_0x9a2b('0x33')](_0x19d1aa,_0x395449),function(){});})[_0x9a2b('0x29')](function(){logger[_0x9a2b('0x3a')](util[_0x9a2b('0x1a')](_0x9a2b('0x3b'),EXTRACTED_REPORT_ID,_0x9a2b('0x3c')));return analyticExtractedReport(_0x9a2b('0x3d'),_0x5d923c?util[_0x9a2b('0x1a')](_0x9a2b('0x38'),_0x395449,_0x5d923c?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9a2b('0x3a')](util[_0x9a2b('0x1a')](_0x9a2b('0x3e'),EXTRACTED_REPORT_ID,_0x9a2b('0x3c')));return db['AnalyticExtractedReport'][_0x9a2b('0x3f')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9a2b('0x29')](function(_0x577dab){EXTRACTED_REPORT=_0x577dab;return dbH[_0x9a2b('0x2c')][_0x9a2b('0x2d')](util[_0x9a2b('0x1a')](_0x9a2b('0x40'),QUERY),{'type':dbH[_0x9a2b('0x2c')][_0x9a2b('0x2e')]['SELECT']});})[_0x9a2b('0x29')](extractReport)['catch'](function(_0x19a2a7){logger['info'](util[_0x9a2b('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x19a2a7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9a2b('0x41'));})[_0x9a2b('0x42')](function(){process[_0x9a2b('0x43')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xde66f4=new PdfPrinter({'Arial':{'normal':__dirname+_0x9a2b('0x44'),'bold':__dirname+_0x9a2b('0x45'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x9a2b('0x46')}});return _0xde66f4;}function getPDFDocDefinitionFromHTML(_0x172e64,_0x1dee2f){var _0x2748e8=util['format'](_0x9a2b('0x47'),_0x1dee2f['channel'],_0x1dee2f[_0x9a2b('0x48')]);var _0xeaff4a=moment()[_0x9a2b('0x1a')](_0x9a2b('0x49'))[_0x9a2b('0x11')]();var _0x2ea601=htmlToPdfmake(_0x172e64,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2ea601],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9a2b('0x4a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9a2b('0x4a'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9a2b('0x4a')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x9a2b('0x4b')}];},'footer':function(_0x5821a0,_0x554c14){return[{'text':util[_0x9a2b('0x1a')](_0x9a2b('0x4c'),_0x2748e8,_0x5821a0,_0x554c14,_0xeaff4a),'style':'footer'}];}};}function writePDFDocument(_0x28ef07,_0x105f30){return new Promise(function(_0x5f17c8,_0x51501c){var _0x1d8a81=_0x28ef07[_0x9a2b('0x4d')](fs[_0x9a2b('0x4e')](_0x105f30));_0x1d8a81['on'](_0x9a2b('0x4f'),function(){_0x5f17c8(_0x9a2b('0x4f'));});_0x1d8a81['on'](_0x9a2b('0x50'),function(_0x193fc3){_0x51501c(_0x193fc3);});_0x28ef07[_0x9a2b('0x51')]();});}exports[_0x9a2b('0x52')]=function(_0x56ddf8,_0x16996d){var _0x535f99=getPDFPrinter();var _0x34831f=getPDFDocDefinitionFromHTML(_0x56ddf8,_0x16996d);var _0xc27351=_0x535f99[_0x9a2b('0x36')](_0x34831f);return writePDFDocument(_0xc27351,_0x16996d[_0x9a2b('0x2')])['catch'](function(_0x56d795){throw _0x56d795;});}; \ No newline at end of file +var _0xe9fa=['util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','map','pick','toString','length','auto','body','chunk','keys','forEach','push','format','name','startDate','endDate','header','pageBreak','before','margin','footer','num','Empty','Setting','find','splitSizePdf','then','split','range','sequelize','query','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash'];(function(_0x1970da,_0x1343e7){var _0x23aa5d=function(_0x39e3e2){while(--_0x39e3e2){_0x1970da['push'](_0x1970da['shift']());}};_0x23aa5d(++_0x1343e7);}(_0xe9fa,0xbb));var _0xae9f=function(_0x5de02a,_0x31f96e){_0x5de02a=_0x5de02a-0x0;var _0x31c50b=_0xe9fa[_0x5de02a];return _0x31c50b;};'use strict';var _=require(_0xae9f('0x0'));var fs=require('fs');var util=require(_0xae9f('0x1'));var path=require(_0xae9f('0x2'));var moment=require(_0xae9f('0x3'));var htmlToPdfmake=require(_0xae9f('0x4'));var PdfPrinter=require(_0xae9f('0x5'));var zipdir=require(_0xae9f('0x6'));var rimraf=require(_0xae9f('0x7'));var JSDOM=require(_0xae9f('0x8'))[_0xae9f('0x9')];var window=new JSDOM('')[_0xae9f('0xa')];var BPromise=require(_0xae9f('0xb'));var db=require(_0xae9f('0xc'))['db'];var dbH=require(_0xae9f('0xc'))[_0xae9f('0xd')];var logger=require(_0xae9f('0xe'))(_0xae9f('0xf'));var EXTRACTED_REPORT_ID=Number(process[_0xae9f('0x10')][0x2]);var QUERY=process[_0xae9f('0x10')][0x3];var PATH=process[_0xae9f('0x10')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xae9f('0x11');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3905c2,_0x11699e){var _0x570551={'status':_0x3905c2};var _0x3352dd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11699e){_0x570551[_0xae9f('0x12')]=_0x11699e;}return db[_0xae9f('0x13')]['update'](_0x570551,_0x3352dd);}function getHeaders(_0x131de6){return _['map'](_0x131de6,function(_0x51e96d){return{'text':_0x51e96d,'style':_0xae9f('0x14')};});}function getRows(_0x66524b,_0x2a95a1){return _[_0xae9f('0x15')](_0x2a95a1,function(_0x458810){return _(_0x458810)[_0xae9f('0x16')](_0x66524b)['map'](function(_0x2b24de){return _0x2b24de?_[_0xae9f('0x17')](_0x2b24de):'';})['value']();});}function createTable(_0x12ba1a,_0x2b2663){var _0x46b1f5={'widths':_['fill'](Array(_0x12ba1a[_0xae9f('0x18')]),0x91),'heights':function(_0x76cb9f){return _0x76cb9f===0x0?_0xae9f('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x26f9bc=getHeaders(_0x12ba1a);_0x46b1f5[_0xae9f('0x1a')]['push'](_0x26f9bc);var _0x3d3a07=getRows(_0x12ba1a,_0x2b2663);_0x46b1f5[_0xae9f('0x1a')]=_0x46b1f5[_0xae9f('0x1a')]['concat'](_0x3d3a07);return _0x46b1f5;}function createTables(_0x7eef24){var _0x5597aa=[];var _0x34e11e=_[_0xae9f('0x1b')](Object[_0xae9f('0x1c')](_0x7eef24[0x0]),0x5);_0x34e11e[_0xae9f('0x1d')](function(_0x27c16d){_0x5597aa[_0xae9f('0x1e')](createTable(_0x27c16d,_0x7eef24));});return _0x5597aa;}function getPDFDocDefinition(_0x3a4e85){var _0x10cbb9=util[_0xae9f('0x1f')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xae9f('0x20')],moment(EXTRACTED_REPORT[_0xae9f('0x21')])[_0xae9f('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xae9f('0x22')])[_0xae9f('0x1f')](FORMAT));var _0x2ba083=[];for(var _0x222c1d=0x0;_0x222c1d<_0x3a4e85[_0xae9f('0x18')];_0x222c1d++){var _0x1d2b03=[];if(_0x222c1d===0x0){_0x1d2b03[_0xae9f('0x1e')]({'text':_0x10cbb9,'style':_0xae9f('0x23')});}var _0x594f0f={'table':_0x3a4e85[_0x222c1d]};if(_0x222c1d>0x0){_0x594f0f[_0xae9f('0x24')]=_0xae9f('0x25');_0x594f0f[_0xae9f('0x26')]=[0x0,0x46,0x0,0x0];}_0x1d2b03[_0xae9f('0x1e')](_0x594f0f);_0x2ba083[_0xae9f('0x1e')](_0x1d2b03);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2ba083,'footer':function(_0x2cb9c7,_0x371e7a){return{'text':_0x2cb9c7[_0xae9f('0x17')]()+'\x20/\x20'+_0x371e7a,'style':_0xae9f('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1427d7){var _0x464d24=0x1388;var _0x1413b2;if(!_0x1427d7[0x0][_0xae9f('0x28')]){return analyticExtractedReport(_0xae9f('0x29'));}return db[_0xae9f('0x2a')][_0xae9f('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xae9f('0x2c')]})[_0xae9f('0x2d')](function(_0x161b4c){if(_0x161b4c){_0x1413b2=_0x161b4c;_0x464d24=_0x1413b2['splitSizePdf']||0x3e8;}})[_0xae9f('0x2d')](function(){var _0x45f13e=[];var _0x19f1d7=0x0;if(_0x1413b2[_0xae9f('0x2e')]){if(_0x1427d7&&_0x1427d7[_0xae9f('0x18')]){var _0xb9f876=_[_0xae9f('0x2f')](_0x1427d7[0x0][_0xae9f('0x28')]/_0x464d24);var _0x5b82d1=Number['isInteger'](_0x1427d7[0x0][_0xae9f('0x28')]/_0x464d24)?_0x1427d7[0x0]['num']%_0x464d24:0x0;_0xb9f876['forEach'](function(_0x4835fe){if(_0x4835fe>0x0){_0x19f1d7+=_0x464d24;}_0x45f13e[_0xae9f('0x1e')](dbH[_0xae9f('0x30')][_0xae9f('0x31')](util[_0xae9f('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x464d24,_0x19f1d7),{'type':dbH[_0xae9f('0x30')]['QueryTypes'][_0xae9f('0x32')]}));});if(_0x5b82d1>0x0){_0x19f1d7+=_0x464d24;_0x45f13e[_0xae9f('0x1e')](dbH[_0xae9f('0x30')][_0xae9f('0x31')](util[_0xae9f('0x1f')](_0xae9f('0x33'),QUERY,_0x5b82d1,_0x19f1d7),{'type':dbH['sequelize'][_0xae9f('0x34')][_0xae9f('0x32')]}));}}}else{_0x45f13e[_0xae9f('0x1e')](dbH[_0xae9f('0x30')][_0xae9f('0x31')](QUERY,{'type':dbH[_0xae9f('0x30')][_0xae9f('0x34')][_0xae9f('0x32')]}));}var _0xcdd7a7=path[_0xae9f('0x35')](PATH);var _0x13092c=path[_0xae9f('0x36')](PATH,_0xae9f('0x37'));var _0x45633d=_0x1413b2[_0xae9f('0x2e')]&&_0x45f13e[_0xae9f('0x18')]>0x1;var _0x40a8f3=[];if(!fs[_0xae9f('0x38')](path[_0xae9f('0x39')](_0xcdd7a7,_0x13092c))&&_0x45633d){fs[_0xae9f('0x3a')](path[_0xae9f('0x39')](_0xcdd7a7,_0x13092c));}return BPromise['each'](_0x45f13e,function(_0x1dc125){_0x40a8f3['push'](_0x1dc125);})[_0xae9f('0x2d')](function(){var _0x54b20b=[];for(var _0x2eb739=0x0;_0x2eb739<_0x40a8f3[_0xae9f('0x18')];_0x2eb739+=0x1){var _0x1a0f79=_0x40a8f3[_0x2eb739];var _0x46d019=createTables(_[_0xae9f('0x3b')](_0x1a0f79));var _0x446bd5;var _0x39513e=getPDFDocDefinition(_0x46d019);var _0xfb2197=getPDFPrinter();var _0x2cfec8=_0xfb2197[_0xae9f('0x3c')](_0x39513e);if(_0x45633d){_0x446bd5=path[_0xae9f('0x39')](_0xcdd7a7,_0x13092c,util[_0xae9f('0x1f')]('%s%d.%s',_0x13092c,_0x2eb739,_0xae9f('0x3d')));}else{_0x446bd5=path['join'](_0xcdd7a7,util[_0xae9f('0x1f')](_0xae9f('0x3e'),_0x13092c,_0xae9f('0x3d')));}_0x54b20b['push'](writePDFDocument(_0x2cfec8,_0x446bd5));}return Promise['all'](_0x54b20b);})['then'](function(){if(_0x45633d){return new Promise(function(_0x5989b0){zipdir(path[_0xae9f('0x39')](_0xcdd7a7,_0x13092c),{'saveTo':path['join'](_0xcdd7a7,util[_0xae9f('0x1f')](_0xae9f('0x3e'),_0x13092c,_0xae9f('0x3f')))},function(){rimraf(path[_0xae9f('0x39')](_0xcdd7a7,_0x13092c),function(){});_0x5989b0(_0xae9f('0x40'));});});}})[_0xae9f('0x2d')](function(){if(!_0x45633d)return;rimraf(path[_0xae9f('0x39')](_0xcdd7a7,_0x13092c),function(){});})[_0xae9f('0x2d')](function(){logger[_0xae9f('0x41')](util[_0xae9f('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xae9f('0x42')));return analyticExtractedReport(_0xae9f('0x43'),_0x45633d?util[_0xae9f('0x1f')]('%s.%s',_0x13092c,_0x45633d?_0xae9f('0x3f'):_0xae9f('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xae9f('0x41')](util[_0xae9f('0x1f')](_0xae9f('0x44'),EXTRACTED_REPORT_ID,_0xae9f('0x42')));return db[_0xae9f('0x13')][_0xae9f('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xae9f('0x2d')](function(_0x2bf8e4){EXTRACTED_REPORT=_0x2bf8e4;return dbH[_0xae9f('0x30')]['query'](util[_0xae9f('0x1f')](_0xae9f('0x46'),QUERY),{'type':dbH[_0xae9f('0x30')][_0xae9f('0x34')]['SELECT']});})[_0xae9f('0x2d')](extractReport)[_0xae9f('0x47')](function(_0x3a4f1){logger['info'](util[_0xae9f('0x1f')](_0xae9f('0x48'),EXTRACTED_REPORT_ID,_0xae9f('0x42')),util[_0xae9f('0x49')](_0x3a4f1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xae9f('0x4a'));})[_0xae9f('0x4b')](function(){process[_0xae9f('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5896aa=new PdfPrinter({'Arial':{'normal':__dirname+_0xae9f('0x4d'),'bold':__dirname+_0xae9f('0x4e'),'italics':__dirname+_0xae9f('0x4f'),'bolditalics':__dirname+_0xae9f('0x50')}});return _0x5896aa;}function getPDFDocDefinitionFromHTML(_0x4fc99c,_0x41c004){var _0x7ebd11=util['format'](_0xae9f('0x51'),_0x41c004[_0xae9f('0x52')],_0x41c004['interactionId']);var _0xeeed3=moment()[_0xae9f('0x1f')](_0xae9f('0x53'))[_0xae9f('0x17')]();var _0x4480ba=htmlToPdfmake(_0x4fc99c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4480ba],'defaultStyle':{'font':_0xae9f('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xae9f('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xae9f('0x56'),'style':_0xae9f('0x23')}];},'footer':function(_0x3e6b8a,_0x3fa90f){return[{'text':util[_0xae9f('0x1f')](_0xae9f('0x57'),_0x7ebd11,_0x3e6b8a,_0x3fa90f,_0xeeed3),'style':_0xae9f('0x27')}];}};}function writePDFDocument(_0x533999,_0x2d1910){return new Promise(function(_0x55041c,_0x468fcb){var _0x129482=_0x533999[_0xae9f('0x58')](fs[_0xae9f('0x59')](_0x2d1910));_0x129482['on'](_0xae9f('0x5a'),function(){_0x55041c('finish');});_0x129482['on'](_0xae9f('0x5b'),function(_0x12dfe0){_0x468fcb(_0x12dfe0);});_0x533999[_0xae9f('0x5c')]();});}exports[_0xae9f('0x5d')]=function(_0x27c812,_0x131f4b){var _0xf563bd=getPDFPrinter();var _0x5e4de6=getPDFDocDefinitionFromHTML(_0x27c812,_0x131f4b);var _0x2a0fc5=_0xf563bd['createPdfKitDocument'](_0x5e4de6);return writePDFDocument(_0x2a0fc5,_0x131f4b[_0xae9f('0x2')])[_0xae9f('0x47')](function(_0x5ec4dd){throw _0x5ec4dd;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 22fd46e..4977ead 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 _0x47cb=['info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','join','%s%d.%s','%s.%s','xlsx','writeFileSync','zip\x20finished'];(function(_0x20c6c4,_0x7a89a0){var _0x3ff330=function(_0x40e46c){while(--_0x40e46c){_0x20c6c4['push'](_0x20c6c4['shift']());}};_0x3ff330(++_0x7a89a0);}(_0x47cb,0x74));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xb47c('0x0'));var path=require(_0xb47c('0x1'));var _=require(_0xb47c('0x2'));var fs=require('fs');var json2xls=require(_0xb47c('0x3'));var BPromise=require(_0xb47c('0x4'));var zipdir=require(_0xb47c('0x5'));var rimraf=require(_0xb47c('0x6'));var db=require(_0xb47c('0x7'))['db'];var dbH=require('../../mysqldb')[_0xb47c('0x8')];var logger=require(_0xb47c('0x9'))(_0xb47c('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xb47c('0xb')][0x2]);var QUERY=process[_0xb47c('0xb')][0x3];var PATH=process[_0xb47c('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x341cce,_0x1234b5){var _0x2f25ac={'status':_0x341cce};var _0x3fe803={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1234b5){_0x2f25ac[_0xb47c('0xc')]=_0x1234b5;}return db[_0xb47c('0xd')][_0xb47c('0xe')](_0x2f25ac,_0x3fe803);}function main(){var _0x2e04d7=0x1388;var _0x336f67;logger['info'](util[_0xb47c('0xf')](_0xb47c('0x10'),EXTRACTED_REPORT_ID,_0xb47c('0x11')));return db['Setting'][_0xb47c('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb47c('0x13'),'splitSizeXlsx']})[_0xb47c('0x14')](function(_0x80cf99){if(_0x80cf99){_0x336f67=_0x80cf99;_0x2e04d7=_0x336f67[_0xb47c('0x15')]||0x1388;}})['then'](function(){return dbH[_0xb47c('0x16')][_0xb47c('0x17')](util[_0xb47c('0xf')](_0xb47c('0x18'),QUERY),{'type':dbH[_0xb47c('0x16')][_0xb47c('0x19')][_0xb47c('0x1a')]});})[_0xb47c('0x14')](function(_0xca925c){if(!_0xca925c[0x0][_0xb47c('0x1b')]){return analyticExtractedReport(_0xb47c('0x1c'));}var _0x4a335e=[];var _0x33dbe3=0x0;if(_0x336f67[_0xb47c('0x13')]){if(_0xca925c&&_0xca925c[_0xb47c('0x1d')]){var _0x4b8f13=_[_0xb47c('0x1e')](_0xca925c[0x0][_0xb47c('0x1b')]/_0x2e04d7);var _0x2749ff=Number[_0xb47c('0x1f')](_0xca925c[0x0][_0xb47c('0x1b')]/_0x2e04d7)?_0xca925c[0x0][_0xb47c('0x1b')]%_0x2e04d7:0x0;_0x4b8f13[_0xb47c('0x20')](function(_0x2a67da){if(_0x2a67da>0x0){_0x33dbe3+=_0x2e04d7;}_0x4a335e[_0xb47c('0x21')](dbH[_0xb47c('0x16')][_0xb47c('0x17')](util[_0xb47c('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2e04d7,_0x33dbe3),{'type':dbH[_0xb47c('0x16')][_0xb47c('0x19')][_0xb47c('0x1a')]}));});if(_0x2749ff>0x0){_0x33dbe3+=_0x2e04d7;_0x4a335e['push'](dbH['sequelize']['query'](util[_0xb47c('0xf')](_0xb47c('0x22'),QUERY,_0x2749ff,_0x33dbe3),{'type':dbH[_0xb47c('0x16')]['QueryTypes'][_0xb47c('0x1a')]}));}}}else{_0x4a335e['push'](dbH[_0xb47c('0x16')][_0xb47c('0x17')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xb47c('0x1a')]}));}var _0x71d3ac=path[_0xb47c('0x23')](PATH);var _0x39d0ff=path[_0xb47c('0x24')](PATH,_0xb47c('0x25'));var _0x14a73e=_0x336f67[_0xb47c('0x13')]&&_0x4a335e[_0xb47c('0x1d')]>0x1;var _0x1ce9dc=[];if(!fs[_0xb47c('0x26')](path['join'](_0x71d3ac,_0x39d0ff))&&_0x14a73e){fs[_0xb47c('0x27')](path[_0xb47c('0x28')](_0x71d3ac,_0x39d0ff));}return BPromise['each'](_0x4a335e,function(_0x4e2e9f){_0x1ce9dc[_0xb47c('0x21')](_0x4e2e9f);})[_0xb47c('0x14')](function(){for(var _0x38c4df=0x0;_0x38c4df<_0x1ce9dc[_0xb47c('0x1d')];_0x38c4df+=0x1){var _0x587835;var _0xf3633=_0x1ce9dc[_0x38c4df];if(_0x14a73e){_0x587835=path[_0xb47c('0x28')](_0x71d3ac,_0x39d0ff,util['format'](_0xb47c('0x29'),_0x39d0ff,_0x38c4df,'xlsx'));}else{_0x587835=path[_0xb47c('0x28')](_0x71d3ac,util[_0xb47c('0xf')](_0xb47c('0x2a'),_0x39d0ff,_0xb47c('0x2b')));}fs[_0xb47c('0x2c')](_0x587835,json2xls(_0xf3633),'binary');}})['then'](function(){if(_0x14a73e){return new Promise(function(_0x2c0e34){zipdir(path['join'](_0x71d3ac,_0x39d0ff),{'saveTo':path[_0xb47c('0x28')](_0x71d3ac,util[_0xb47c('0xf')]('%s.%s',_0x39d0ff,'zip'))},function(_0x5ecfab,_0x4fbca5){rimraf(path[_0xb47c('0x28')](_0x71d3ac,_0x39d0ff),function(){});_0x2c0e34(_0xb47c('0x2d'));});});}})['then'](function(){logger[_0xb47c('0x2e')](util['format'](_0xb47c('0x2f'),EXTRACTED_REPORT_ID,_0xb47c('0x11')));return analyticExtractedReport(_0xb47c('0x30'),_0x14a73e?util[_0xb47c('0xf')](_0xb47c('0x2a'),_0x39d0ff,_0x14a73e?_0xb47c('0x31'):'xlsx'):null);});})[_0xb47c('0x32')](function(_0x2003f2){logger[_0xb47c('0x2e')](util[_0xb47c('0xf')](_0xb47c('0x33'),EXTRACTED_REPORT_ID,_0xb47c('0x11')),util['inspect'](_0x2003f2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb47c('0x34'));})[_0xb47c('0x35')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4ea0=['../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','format','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','lodash','zip-dir','../../mysqldb','dbH'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x4ea0,0x8e));var _0x04ea=function(_0x3d13bb,_0x262a54){_0x3d13bb=_0x3d13bb-0x0;var _0x4b5a1b=_0x4ea0[_0x3d13bb];return _0x4b5a1b;};'use strict';var util=require(_0x04ea('0x0'));var path=require('path');var _=require(_0x04ea('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x04ea('0x2'));var rimraf=require('rimraf');var db=require(_0x04ea('0x3'))['db'];var dbH=require(_0x04ea('0x3'))[_0x04ea('0x4')];var logger=require(_0x04ea('0x5'))(_0x04ea('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x04ea('0x7')][0x2]);var QUERY=process[_0x04ea('0x7')][0x3];var PATH=process[_0x04ea('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x374244,_0x4be120){var _0x465e4f={'status':_0x374244};var _0x1dbcdc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4be120){_0x465e4f['savename']=_0x4be120;}return db[_0x04ea('0x8')][_0x04ea('0x9')](_0x465e4f,_0x1dbcdc);}function main(){var _0x235918=0x1388;var _0x5d1c16;logger[_0x04ea('0xa')](util['format'](_0x04ea('0xb'),EXTRACTED_REPORT_ID,_0x04ea('0xc')));return db[_0x04ea('0xd')][_0x04ea('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x04ea('0xf'),_0x04ea('0x10')]})['then'](function(_0x5b657e){if(_0x5b657e){_0x5d1c16=_0x5b657e;_0x235918=_0x5d1c16[_0x04ea('0x10')]||0x1388;}})[_0x04ea('0x11')](function(){return dbH[_0x04ea('0x12')][_0x04ea('0x13')](util['format'](_0x04ea('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x04ea('0x15')]});})[_0x04ea('0x11')](function(_0x489327){if(!_0x489327[0x0][_0x04ea('0x16')]){return analyticExtractedReport(_0x04ea('0x17'));}var _0x1ea37f=[];var _0x3165f7=0x0;if(_0x5d1c16[_0x04ea('0xf')]){if(_0x489327&&_0x489327[_0x04ea('0x18')]){var _0x203af7=_['range'](_0x489327[0x0]['num']/_0x235918);var _0x52c45d=Number[_0x04ea('0x19')](_0x489327[0x0][_0x04ea('0x16')]/_0x235918)?_0x489327[0x0]['num']%_0x235918:0x0;_0x203af7['forEach'](function(_0x5da437){if(_0x5da437>0x0){_0x3165f7+=_0x235918;}_0x1ea37f[_0x04ea('0x1a')](dbH[_0x04ea('0x12')]['query'](util['format'](_0x04ea('0x1b'),QUERY,_0x235918,_0x3165f7),{'type':dbH['sequelize'][_0x04ea('0x1c')][_0x04ea('0x15')]}));});if(_0x52c45d>0x0){_0x3165f7+=_0x235918;_0x1ea37f[_0x04ea('0x1a')](dbH[_0x04ea('0x12')][_0x04ea('0x13')](util['format'](_0x04ea('0x1b'),QUERY,_0x52c45d,_0x3165f7),{'type':dbH[_0x04ea('0x12')][_0x04ea('0x1c')][_0x04ea('0x15')]}));}}}else{_0x1ea37f[_0x04ea('0x1a')](dbH[_0x04ea('0x12')]['query'](QUERY,{'type':dbH[_0x04ea('0x12')][_0x04ea('0x1c')][_0x04ea('0x15')]}));}var _0x2acadd=path[_0x04ea('0x1d')](PATH);var _0x257f8c=path[_0x04ea('0x1e')](PATH,_0x04ea('0x1f'));var _0x207907=_0x5d1c16[_0x04ea('0xf')]&&_0x1ea37f['length']>0x1;var _0x22049f=[];if(!fs[_0x04ea('0x20')](path[_0x04ea('0x21')](_0x2acadd,_0x257f8c))&&_0x207907){fs[_0x04ea('0x22')](path['join'](_0x2acadd,_0x257f8c));}return BPromise['each'](_0x1ea37f,function(_0x38864b){_0x22049f[_0x04ea('0x1a')](_0x38864b);})['then'](function(){for(var _0x56e30f=0x0;_0x56e30f<_0x22049f[_0x04ea('0x18')];_0x56e30f+=0x1){var _0x76dded;var _0x2d4981=_0x22049f[_0x56e30f];if(_0x207907){_0x76dded=path[_0x04ea('0x21')](_0x2acadd,_0x257f8c,util[_0x04ea('0x23')](_0x04ea('0x24'),_0x257f8c,_0x56e30f,_0x04ea('0x25')));}else{_0x76dded=path['join'](_0x2acadd,util[_0x04ea('0x23')](_0x04ea('0x26'),_0x257f8c,'xlsx'));}fs[_0x04ea('0x27')](_0x76dded,json2xls(_0x2d4981),_0x04ea('0x28'));}})[_0x04ea('0x11')](function(){if(_0x207907){return new Promise(function(_0x1f0de6){zipdir(path[_0x04ea('0x21')](_0x2acadd,_0x257f8c),{'saveTo':path[_0x04ea('0x21')](_0x2acadd,util[_0x04ea('0x23')]('%s.%s',_0x257f8c,_0x04ea('0x29')))},function(_0x118d86,_0x53b6c2){rimraf(path[_0x04ea('0x21')](_0x2acadd,_0x257f8c),function(){});_0x1f0de6(_0x04ea('0x2a'));});});}})['then'](function(){logger[_0x04ea('0xa')](util[_0x04ea('0x23')](_0x04ea('0x2b'),EXTRACTED_REPORT_ID,_0x04ea('0xc')));return analyticExtractedReport(_0x04ea('0x2c'),_0x207907?util[_0x04ea('0x23')]('%s.%s',_0x257f8c,_0x207907?_0x04ea('0x29'):'xlsx'):null);});})['catch'](function(_0x175f16){logger[_0x04ea('0xa')](util[_0x04ea('0x23')](_0x04ea('0x2d'),EXTRACTED_REPORT_ID,_0x04ea('0xc')),util[_0x04ea('0x2e')](_0x175f16,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x04ea('0x2f'));})[_0x04ea('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 41c9939..c6eebcc 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 _0x887e=['recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','length','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','catch','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','IntervalId','map','exten','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','push','type','Set','format','CDR(type)=%s','priority','VoiceExtensionId','CDR(routeid)=','context','outbound','CDR(destination)=','extension','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix'];(function(_0x14842f,_0x1e605c){var _0x388e42=function(_0xcf5ccb){while(--_0xcf5ccb){_0x14842f['push'](_0x14842f['shift']());}};_0x388e42(++_0x1e605c);}(_0x887e,0xe5));var _0xe887=function(_0x23c434,_0x22b505){_0x23c434=_0x23c434-0x0;var _0x34009e=_0x887e[_0x23c434];return _0x34009e;};'use strict';var _=require(_0xe887('0x0'));var util=require(_0xe887('0x1'));function rewrite(_0x585bf4,_0x402a9f){var _0x32b34b=this;return _0x585bf4[_0xe887('0x2')]['Interval'][_0xe887('0x3')]({'raw':!![]})[_0xe887('0x4')](function(_0x177e6f){_0x32b34b[_0xe887('0x5')]=_0x177e6f;return _0x585bf4[_0xe887('0x2')][_0xe887('0x6')][_0xe887('0x3')]({'where':{'IntervalId':_0x402a9f[_0xe887('0x7')]},'raw':!![]});})[_0xe887('0x4')](function(_0xe2857a){return _0x585bf4['models'][_0xe887('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xe887('0x8')](_0xe2857a,_0xe887('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x44f187){var _0x4f9031=_['filter'](_0x44f187,{'priority':'1'});var _0xb15bc3=_[_0xe887('0xa')](_0x44f187,{'isApp':0x1});var _0x3c9b11=_[_0xe887('0xb')](_0xb15bc3,_0xe887('0x9'));var _0x38279d=[_0xe887('0xc'),_0xe887('0xd')];var _0x3ddb79=[];var _0xa72df=[];for(var _0x2fed99 in _0x3c9b11){if(_0x3c9b11[_0xe887('0xe')](_0x2fed99)){_0x32b34b['priority']=0x2;_0x32b34b[_0xe887('0xf')]=[];_0x32b34b['extension']=_[_0xe887('0x10')](_0x4f9031,{'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')]});_0x32b34b[_0xe887('0xf')][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':util[_0xe887('0x14')](_0xe887('0x15'),_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')]),'context':_0x3c9b11[_0x2fed99][0x0]['context'],'exten':_0x3c9b11[_0x2fed99][0x0]['exten'],'priority':_0x32b34b[_0xe887('0x16')]++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});if(_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')]==='inbound'){_0x32b34b[_0xe887('0xf')][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':_0xe887('0x18')+_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')],'context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0]['exten'],'priority':_0x32b34b[_0xe887('0x16')]++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});}else if(_0x3c9b11[_0x2fed99][0x0]['type']===_0xe887('0x1a')){if(_0x32b34b['extension']){_0x32b34b[_0xe887('0xf')]['push']({'type':_0x3c9b11[_0x2fed99][0x0]['type'],'app':'Set','appdata':_0xe887('0x1b')+(_0x32b34b[_0xe887('0x1c')][_0xe887('0x1d')]?'${EXTEN:'+_0x32b34b['extension'][_0xe887('0x1d')]+'}':_0xe887('0x1e')),'context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')],'priority':_0x32b34b['priority']++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});}_0x32b34b[_0xe887('0xf')][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':'CDR(routeid)='+_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')],'context':_0x3c9b11[_0x2fed99][0x0]['context'],'exten':_0x3c9b11[_0x2fed99][0x0]['exten'],'priority':_0x32b34b['priority']++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});var _0x2cbc64=_0x32b34b[_0xe887('0x16')]++;_0x32b34b[_0xe887('0xf')][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x1f'),'appdata':_0xe887('0x20')+(_0x2cbc64+0x2)+_0xe887('0x21')+(_0x2cbc64+0x1)+')','context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')],'priority':_0x2cbc64,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});if(_0x32b34b['extension']){_0x32b34b['extensions'][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':_0x32b34b[_0xe887('0x1c')][_0xe887('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x32b34b[_0xe887('0x1c')][_0xe887('0x1d')]+'}':_0xe887('0x22'),'context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0]['exten'],'priority':_0x32b34b['priority']++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0]['VoiceExtensionId']});}_0x32b34b['extensions']['push']({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':'Set','appdata':'outboundrouteid='+_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')],'context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')],'priority':_0x32b34b[_0xe887('0x16')]++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});if(_0x32b34b[_0xe887('0x1c')]&&_0x32b34b[_0xe887('0x1c')][_0xe887('0xe')](_0xe887('0x23'))&&_0x32b34b[_0xe887('0x1c')][_0xe887('0x23')]!==_0xe887('0x24')){_0x32b34b[_0xe887('0xf')][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0]['type'],'app':'Set','appdata':_0xe887('0x25'),'context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')],'priority':_0x32b34b[_0xe887('0x16')]++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});_0x32b34b['extensions'][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0]['type'],'app':_0xe887('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x32b34b[_0xe887('0x1c')]['recordingFormat']||_0xe887('0x26'),'context':_0x3c9b11[_0x2fed99][0x0]['context'],'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')],'priority':_0x32b34b['priority']++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0]['VoiceExtensionId']});}}_0x32b34b[_0xe887('0xf')][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0]['exten'],'priority':_0x32b34b['priority']++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});_0x32b34b[_0xe887('0xf')][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')],'priority':_0x32b34b['priority']++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});_0x32b34b[_0xe887('0xf')][_0xe887('0x11')]({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')],'priority':_0x32b34b[_0xe887('0x16')]++,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0]['VoiceExtensionId']});for(var _0x87ab6f=0x0,_0x15c67e=0x0;_0x87ab6f<_0x3c9b11[_0x2fed99][_0xe887('0x27')];_0x87ab6f+=0x1,_0x15c67e=0x0){var _0x3794ca=_0x3c9b11[_0x2fed99][_0x87ab6f];if(_0x3794ca[_0xe887('0x12')]){_0x3794ca[_0xe887('0x12')]=_0x3794ca['type'][_0xe887('0x28')]();}var _0x22819d=[];var _0x2fd6fe=[];delete _0x3794ca['id'];delete _0x3794ca[_0xe887('0x29')];delete _0x3794ca[_0xe887('0x2a')];var _0x1b9d1b=_0x3794ca['interval']!=='*,*,*,*'?[_0x3794ca[_0xe887('0x2b')]]:_0x3794ca[_0xe887('0x7')]?_[_0xe887('0x8')](_['filter'](_0x32b34b[_0xe887('0x5')],{'IntervalId':_0x3794ca[_0xe887('0x7')]}),_0xe887('0x2b')):[];if(_0x3794ca[_0xe887('0xe')](_0xe887('0x2c'))){if(_0x3794ca[_0xe887('0x2c')]&&_0x3794ca[_0xe887('0x2c')]!=='--'){_0x22819d[_0xe887('0x11')]({'type':_0x3794ca[_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':_0xe887('0x2d')+_0x3794ca[_0xe887('0x2c')],'context':_0x3794ca[_0xe887('0x19')],'exten':_0x3794ca['exten'],'priority':_0x1b9d1b[_0xe887('0x27')]+_0x32b34b[_0xe887('0x16')]+_0x15c67e++,'VoiceExtensionId':_0x3794ca[_0xe887('0x17')]});}}if(_0x3794ca[_0xe887('0x12')]==='outbound'&&_0x3794ca[_0xe887('0xe')](_0xe887('0x2e'))){if(_0x3794ca['callerID']){_0x22819d[_0xe887('0x11')]({'type':_0x3794ca[_0xe887('0x12')],'app':_0xe887('0x1f'),'appdata':_0xe887('0x2f')+_0x3794ca[_0xe887('0x2e')]+')','context':_0x3794ca['context'],'exten':_0x3794ca[_0xe887('0x9')],'priority':_0x1b9d1b[_0xe887('0x27')]+_0x32b34b['priority']+_0x15c67e++,'VoiceExtensionId':_0x3794ca['VoiceExtensionId']});}else{_0x22819d['push']({'type':_0x3794ca['type'],'app':_0xe887('0x1f'),'appdata':_0xe887('0x30'),'context':_0x3794ca[_0xe887('0x19')],'exten':_0x3794ca[_0xe887('0x9')],'priority':_0x1b9d1b['length']+_0x32b34b['priority']+_0x15c67e++,'VoiceExtensionId':_0x3794ca[_0xe887('0x17')]});}}if(_0x3794ca[_0xe887('0xe')](_0xe887('0x31'))){if(_0x38279d[_0xe887('0x32')](_0x3794ca[_0xe887('0x33')]['toLowerCase']())>=0x0&&_0x3794ca[_0xe887('0x34')]!==_0xe887('0x35')){if(_0x3794ca[_0xe887('0x31')]){_0x22819d[_0xe887('0x11')]({'type':_0x3794ca['type'],'app':_0xe887('0x1f'),'appdata':_0xe887('0x36'),'context':_0x3794ca[_0xe887('0x19')],'exten':_0x3794ca[_0xe887('0x9')],'priority':_0x1b9d1b[_0xe887('0x27')]+_0x32b34b[_0xe887('0x16')]+_0x15c67e++,'VoiceExtensionId':_0x3794ca[_0xe887('0x17')]});_0x22819d[_0xe887('0x11')]({'type':_0x3794ca[_0xe887('0x12')],'app':'Set','appdata':_0xe887('0x37'),'context':_0x3794ca[_0xe887('0x19')],'exten':_0x3794ca[_0xe887('0x9')],'priority':_0x1b9d1b[_0xe887('0x27')]+_0x32b34b[_0xe887('0x16')]+_0x15c67e++,'VoiceExtensionId':_0x3794ca[_0xe887('0x17')]});}else{_0x22819d[_0xe887('0x11')]({'type':_0x3794ca['type'],'app':'ExecIf','appdata':_0xe887('0x38'),'context':_0x3794ca[_0xe887('0x19')],'exten':_0x3794ca[_0xe887('0x9')],'priority':_0x1b9d1b[_0xe887('0x27')]+_0x32b34b['priority']+_0x15c67e++,'VoiceExtensionId':_0x3794ca[_0xe887('0x17')]});_0x22819d['push']({'type':_0x3794ca[_0xe887('0x12')],'app':_0xe887('0x13'),'appdata':_0xe887('0x39'),'context':_0x3794ca[_0xe887('0x19')],'exten':_0x3794ca['exten'],'priority':_0x1b9d1b[_0xe887('0x27')]+_0x32b34b[_0xe887('0x16')]+_0x15c67e++,'VoiceExtensionId':_0x3794ca[_0xe887('0x17')]});}}}for(var _0x1b7d3a=0x0;_0x1b7d3a<_0x1b9d1b[_0xe887('0x27')];_0x1b7d3a+=0x1){var _0x534418=_0x32b34b[_0xe887('0x16')]+_0x1b9d1b[_0xe887('0x27')];var _0x4eed24=_0x1b7d3a===_0x1b9d1b[_0xe887('0x27')]-0x1?_0x32b34b[_0xe887('0x16')]+_0x22819d[_0xe887('0x27')]+_0x2fd6fe[_0xe887('0x27')]+0x2:_0x32b34b[_0xe887('0x16')]+_0x1b7d3a+0x1;_0x22819d[_0xe887('0x3a')](_0x1b7d3a,0x0,{'type':_0x3794ca[_0xe887('0x12')],'app':'GotoIfTime','appdata':_0x1b9d1b[_0x1b7d3a]+'?'+_0x3794ca[_0xe887('0x19')]+',${EXTEN},'+_0x534418+':'+_0x3794ca[_0xe887('0x19')]+_0xe887('0x3b')+_0x4eed24,'exten':_0x3794ca['exten'],'context':_0x3794ca[_0xe887('0x19')],'priority':_0x32b34b[_0xe887('0x16')]+_0x1b7d3a,'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});}_0x3794ca[_0xe887('0x16')]=_0x22819d['length']?_[_0xe887('0x3c')](_0x22819d)['priority']+0x1:_0x32b34b['priority'];_0x32b34b['priority']=(_0x2fd6fe['length']?_[_0xe887('0x3c')](_0x2fd6fe)[_0xe887('0x16')]:_0x3794ca[_0xe887('0x16')])+0x1;_0x32b34b['extensions']=_[_0xe887('0x3d')](_0x32b34b[_0xe887('0xf')],_0x22819d,[_0x3794ca],_0x2fd6fe);}_0x32b34b[_0xe887('0xf')]['push']({'type':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x12')],'app':_0xe887('0x3e'),'exten':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x9')],'context':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x19')],'priority':_0x32b34b[_0xe887('0x16')],'VoiceExtensionId':_0x3c9b11[_0x2fed99][0x0][_0xe887('0x17')]});_0x3ddb79[_0xe887('0x11')](_0x3c9b11[_0x2fed99][0x0]['VoiceExtensionId']);_0xa72df=_[_0xe887('0x3d')](_0xa72df,_0x32b34b[_0xe887('0xf')]);}}return _0x585bf4[_0xe887('0x3f')](function(_0x500e83){return _0x585bf4['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3ddb79}},'transaction':_0x500e83})[_0xe887('0x4')](function(_0x319c74){return _0x585bf4[_0xe887('0x2')]['VoiceExtension']['bulkCreate'](_['sortBy'](_0xa72df,_0xe887('0x16')),{'transaction':_0x500e83});});});})[_0xe887('0x40')](function(_0x2860f2){console['error'](_0x2860f2);});}exports[_0xe887('0x41')]=rewrite; \ No newline at end of file +var _0x12a6=['error','rewrite','lodash','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push','Set','format','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','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=1','splice','last','concat','Hangup','transaction','bulkCreate','sortBy'];(function(_0x16591f,_0x5c3628){var _0x573a5a=function(_0x210b96){while(--_0x210b96){_0x16591f['push'](_0x16591f['shift']());}};_0x573a5a(++_0x5c3628);}(_0x12a6,0x116));var _0x612a=function(_0x5bab8e,_0x5a9ed6){_0x5bab8e=_0x5bab8e-0x0;var _0x3e14ea=_0x12a6[_0x5bab8e];return _0x3e14ea;};'use strict';var _=require(_0x612a('0x0'));var util=require('util');function rewrite(_0xc0092c,_0x5945c8){var _0x535caa=this;return _0xc0092c['models'][_0x612a('0x1')][_0x612a('0x2')]({'raw':!![]})[_0x612a('0x3')](function(_0x38d2d8){_0x535caa[_0x612a('0x4')]=_0x38d2d8;return _0xc0092c[_0x612a('0x5')][_0x612a('0x6')]['findAll']({'where':{'IntervalId':_0x5945c8[_0x612a('0x7')]},'raw':!![]});})[_0x612a('0x3')](function(_0x53e493){return _0xc0092c[_0x612a('0x5')][_0x612a('0x6')][_0x612a('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x53e493,_0x612a('0x8')))}},'order':[{'raw':_0x612a('0x9')}],'raw':!![]});})['then'](function(_0x308909){var _0x348ffc=_[_0x612a('0xa')](_0x308909,{'priority':'1'});var _0x26e820=_[_0x612a('0xa')](_0x308909,{'isApp':0x1});var _0x3d2a9b=_[_0x612a('0xb')](_0x26e820,_0x612a('0x8'));var _0x1a65db=[_0x612a('0xc'),_0x612a('0xd')];var _0x62daa9=[];var _0x247263=[];for(var _0x51238a in _0x3d2a9b){if(_0x3d2a9b['hasOwnProperty'](_0x51238a)){_0x535caa[_0x612a('0xe')]=0x2;_0x535caa[_0x612a('0xf')]=[];_0x535caa[_0x612a('0x10')]=_[_0x612a('0x11')](_0x348ffc,{'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')]});_0x535caa[_0x612a('0xf')][_0x612a('0x12')]({'type':_0x3d2a9b[_0x51238a][0x0]['type'],'app':_0x612a('0x13'),'appdata':util[_0x612a('0x14')]('CDR(type)=%s',_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')]),'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0]['exten'],'priority':_0x535caa['priority']++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});if(_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')]===_0x612a('0x18')){_0x535caa['extensions'][_0x612a('0x12')]({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':'Set','appdata':_0x612a('0x19')+_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')],'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'priority':_0x535caa[_0x612a('0xe')]++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});}else if(_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')]===_0x612a('0x1a')){if(_0x535caa[_0x612a('0x10')]){_0x535caa['extensions']['push']({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':_0x612a('0x13'),'appdata':'CDR(destination)='+(_0x535caa[_0x612a('0x10')][_0x612a('0x1b')]?'${EXTEN:'+_0x535caa[_0x612a('0x10')][_0x612a('0x1b')]+'}':_0x612a('0x1c')),'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'priority':_0x535caa[_0x612a('0xe')]++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0]['VoiceExtensionId']});}_0x535caa['extensions'][_0x612a('0x12')]({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':'Set','appdata':_0x612a('0x19')+_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')],'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0]['exten'],'priority':_0x535caa['priority']++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});var _0x152e8e=_0x535caa[_0x612a('0xe')]++;_0x535caa[_0x612a('0xf')][_0x612a('0x12')]({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':'ExecIf','appdata':_0x612a('0x1d')+(_0x152e8e+0x2)+_0x612a('0x1e')+(_0x152e8e+0x1)+')','context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0]['exten'],'priority':_0x152e8e,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});if(_0x535caa[_0x612a('0x10')]){_0x535caa[_0x612a('0xf')]['push']({'type':_0x3d2a9b[_0x51238a][0x0]['type'],'app':_0x612a('0x13'),'appdata':_0x535caa['extension'][_0x612a('0x1b')]?_0x612a('0x1f')+_0x535caa[_0x612a('0x10')][_0x612a('0x1b')]+'}':_0x612a('0x20'),'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'priority':_0x535caa[_0x612a('0xe')]++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});}_0x535caa['extensions'][_0x612a('0x12')]({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':_0x612a('0x13'),'appdata':_0x612a('0x21')+_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')],'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0]['exten'],'priority':_0x535caa['priority']++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});if(_0x535caa[_0x612a('0x10')]&&_0x535caa[_0x612a('0x10')][_0x612a('0x22')](_0x612a('0x23'))&&_0x535caa[_0x612a('0x10')][_0x612a('0x23')]!==_0x612a('0x24')){_0x535caa[_0x612a('0xf')][_0x612a('0x12')]({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':_0x612a('0x13'),'appdata':_0x612a('0x25'),'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'priority':_0x535caa[_0x612a('0xe')]++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0]['VoiceExtensionId']});_0x535caa[_0x612a('0xf')]['push']({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':_0x612a('0x13'),'appdata':_0x612a('0x26')+_0x535caa['extension']['recordingFormat']||_0x612a('0x27'),'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'priority':_0x535caa[_0x612a('0xe')]++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});}}_0x535caa[_0x612a('0xf')]['push']({'type':_0x3d2a9b[_0x51238a][0x0]['type'],'app':_0x612a('0x13'),'appdata':_0x612a('0x28'),'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'priority':_0x535caa[_0x612a('0xe')]++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});_0x535caa[_0x612a('0xf')][_0x612a('0x12')]({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':'Set','appdata':_0x612a('0x29'),'context':_0x3d2a9b[_0x51238a][0x0]['context'],'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'priority':_0x535caa['priority']++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0]['VoiceExtensionId']});_0x535caa[_0x612a('0xf')][_0x612a('0x12')]({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':'Set','appdata':_0x612a('0x2a'),'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'priority':_0x535caa['priority']++,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});for(var _0x121397=0x0,_0x442b27=0x0;_0x121397<_0x3d2a9b[_0x51238a][_0x612a('0x2b')];_0x121397+=0x1,_0x442b27=0x0){var _0x2bb951=_0x3d2a9b[_0x51238a][_0x121397];if(_0x2bb951[_0x612a('0x15')]){_0x2bb951[_0x612a('0x15')]=_0x2bb951['type'][_0x612a('0x2c')]();}var _0x410204=[];var _0x315660=[];delete _0x2bb951['id'];delete _0x2bb951['createdAt'];delete _0x2bb951['updatedAt'];var _0x205bcc=_0x2bb951[_0x612a('0x2d')]!==_0x612a('0x2e')?[_0x2bb951[_0x612a('0x2d')]]:_0x2bb951[_0x612a('0x7')]?_[_0x612a('0x2f')](_[_0x612a('0xa')](_0x535caa[_0x612a('0x4')],{'IntervalId':_0x2bb951[_0x612a('0x7')]}),'interval'):[];if(_0x2bb951[_0x612a('0x22')](_0x612a('0x30'))){if(_0x2bb951['tag']&&_0x2bb951[_0x612a('0x30')]!=='--'){_0x410204[_0x612a('0x12')]({'type':_0x2bb951[_0x612a('0x15')],'app':_0x612a('0x13'),'appdata':_0x612a('0x31')+_0x2bb951[_0x612a('0x30')],'context':_0x2bb951['context'],'exten':_0x2bb951[_0x612a('0x8')],'priority':_0x205bcc[_0x612a('0x2b')]+_0x535caa[_0x612a('0xe')]+_0x442b27++,'VoiceExtensionId':_0x2bb951[_0x612a('0x17')]});}}if(_0x2bb951[_0x612a('0x15')]==='outbound'&&_0x2bb951['hasOwnProperty'](_0x612a('0x32'))){if(_0x2bb951[_0x612a('0x32')]){_0x410204[_0x612a('0x12')]({'type':_0x2bb951[_0x612a('0x15')],'app':_0x612a('0x33'),'appdata':_0x612a('0x34')+_0x2bb951[_0x612a('0x32')]+')','context':_0x2bb951[_0x612a('0x16')],'exten':_0x2bb951[_0x612a('0x8')],'priority':_0x205bcc['length']+_0x535caa['priority']+_0x442b27++,'VoiceExtensionId':_0x2bb951[_0x612a('0x17')]});}else{_0x410204[_0x612a('0x12')]({'type':_0x2bb951[_0x612a('0x15')],'app':_0x612a('0x33'),'appdata':_0x612a('0x35'),'context':_0x2bb951[_0x612a('0x16')],'exten':_0x2bb951['exten'],'priority':_0x205bcc[_0x612a('0x2b')]+_0x535caa['priority']+_0x442b27++,'VoiceExtensionId':_0x2bb951[_0x612a('0x17')]});}}if(_0x2bb951[_0x612a('0x22')](_0x612a('0x36'))){if(_0x1a65db[_0x612a('0x37')](_0x2bb951[_0x612a('0x38')][_0x612a('0x2c')]())>=0x0&&_0x2bb951[_0x612a('0x39')]!==_0x612a('0x3a')){if(_0x2bb951[_0x612a('0x36')]){_0x410204[_0x612a('0x12')]({'type':_0x2bb951[_0x612a('0x15')],'app':_0x612a('0x33'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2bb951[_0x612a('0x16')],'exten':_0x2bb951[_0x612a('0x8')],'priority':_0x205bcc[_0x612a('0x2b')]+_0x535caa[_0x612a('0xe')]+_0x442b27++,'VoiceExtensionId':_0x2bb951['VoiceExtensionId']});_0x410204[_0x612a('0x12')]({'type':_0x2bb951[_0x612a('0x15')],'app':'Set','appdata':_0x612a('0x3b'),'context':_0x2bb951[_0x612a('0x16')],'exten':_0x2bb951[_0x612a('0x8')],'priority':_0x205bcc[_0x612a('0x2b')]+_0x535caa[_0x612a('0xe')]+_0x442b27++,'VoiceExtensionId':_0x2bb951[_0x612a('0x17')]});}else{_0x410204[_0x612a('0x12')]({'type':_0x2bb951[_0x612a('0x15')],'app':_0x612a('0x33'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2bb951['context'],'exten':_0x2bb951[_0x612a('0x8')],'priority':_0x205bcc[_0x612a('0x2b')]+_0x535caa['priority']+_0x442b27++,'VoiceExtensionId':_0x2bb951[_0x612a('0x17')]});_0x410204['push']({'type':_0x2bb951[_0x612a('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2bb951[_0x612a('0x16')],'exten':_0x2bb951[_0x612a('0x8')],'priority':_0x205bcc[_0x612a('0x2b')]+_0x535caa['priority']+_0x442b27++,'VoiceExtensionId':_0x2bb951[_0x612a('0x17')]});}}}for(var _0x3a6cfc=0x0;_0x3a6cfc<_0x205bcc[_0x612a('0x2b')];_0x3a6cfc+=0x1){var _0x21e36f=_0x535caa[_0x612a('0xe')]+_0x205bcc['length'];var _0x51c096=_0x3a6cfc===_0x205bcc['length']-0x1?_0x535caa[_0x612a('0xe')]+_0x410204[_0x612a('0x2b')]+_0x315660[_0x612a('0x2b')]+0x2:_0x535caa['priority']+_0x3a6cfc+0x1;_0x410204[_0x612a('0x3c')](_0x3a6cfc,0x0,{'type':_0x2bb951[_0x612a('0x15')],'app':'GotoIfTime','appdata':_0x205bcc[_0x3a6cfc]+'?'+_0x2bb951['context']+',${EXTEN},'+_0x21e36f+':'+_0x2bb951[_0x612a('0x16')]+',${EXTEN},'+_0x51c096,'exten':_0x2bb951[_0x612a('0x8')],'context':_0x2bb951[_0x612a('0x16')],'priority':_0x535caa['priority']+_0x3a6cfc,'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});}_0x2bb951[_0x612a('0xe')]=_0x410204[_0x612a('0x2b')]?_[_0x612a('0x3d')](_0x410204)['priority']+0x1:_0x535caa['priority'];_0x535caa[_0x612a('0xe')]=(_0x315660[_0x612a('0x2b')]?_[_0x612a('0x3d')](_0x315660)[_0x612a('0xe')]:_0x2bb951[_0x612a('0xe')])+0x1;_0x535caa[_0x612a('0xf')]=_[_0x612a('0x3e')](_0x535caa[_0x612a('0xf')],_0x410204,[_0x2bb951],_0x315660);}_0x535caa['extensions']['push']({'type':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x15')],'app':_0x612a('0x3f'),'exten':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x8')],'context':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x16')],'priority':_0x535caa[_0x612a('0xe')],'VoiceExtensionId':_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]});_0x62daa9[_0x612a('0x12')](_0x3d2a9b[_0x51238a][0x0][_0x612a('0x17')]);_0x247263=_[_0x612a('0x3e')](_0x247263,_0x535caa[_0x612a('0xf')]);}}return _0xc0092c[_0x612a('0x40')](function(_0x512614){return _0xc0092c[_0x612a('0x5')][_0x612a('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x62daa9}},'transaction':_0x512614})[_0x612a('0x3')](function(_0x47df9b){return _0xc0092c[_0x612a('0x5')][_0x612a('0x6')][_0x612a('0x41')](_[_0x612a('0x42')](_0x247263,_0x612a('0xe')),{'transaction':_0x512614});});});})['catch'](function(_0x1cdece){console[_0x612a('0x43')](_0x1cdece);});}exports[_0x612a('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 ccd96dc..9f5e0a4 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 _0x8d7a=['stringify','cmContact','checkHopper','insert','into','cm_hopper','updatedAt','select','field','NOW()','scheduledAt','ContactId','toString','createdAt','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','cm_contacts','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','onlyIfOpen','sequelize','query','VoiceQueueId','all','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','parse','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','errors','length','map','message','join','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','catch','Error\x20while\x20creating\x20contact:\x20'];(function(_0x5dffac,_0x291be7){var _0x1861b1=function(_0x2d17bc){while(--_0x2d17bc){_0x5dffac['push'](_0x5dffac['shift']());}};_0x1861b1(++_0x291be7);}(_0x8d7a,0x1dd));var _0xa8d7=function(_0x2c7b42,_0x42d8c6){_0x2c7b42=_0x2c7b42-0x0;var _0x36146d=_0x8d7a[_0x2c7b42];return _0x36146d;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xa8d7('0x0'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xa8d7('0x1'));var Redis=require('ioredis');var db=require(_0xa8d7('0x2'))['db'];var config=require(_0xa8d7('0x3'));var logger=require(_0xa8d7('0x4'))('api');config[_0xa8d7('0x5')]=_[_0xa8d7('0x6')](config[_0xa8d7('0x5')],{'host':_0xa8d7('0x7'),'port':0x18eb});var socket=require(_0xa8d7('0x8'))(new Redis(config[_0xa8d7('0x5')]));require(_0xa8d7('0x9'))[_0xa8d7('0xa')](socket);try{if(!process[_0xa8d7('0xb')][0x2]||process[_0xa8d7('0xb')][0x2]===_0xa8d7('0xc')||process[_0xa8d7('0xb')][0x2]===_0xa8d7('0xd')){throw new Error(_0xa8d7('0xe'));}var FILEPATH=process[_0xa8d7('0xb')][0x2];if(!process[_0xa8d7('0xb')][0x3]||process[_0xa8d7('0xb')][0x3]===_0xa8d7('0xc')||process[_0xa8d7('0xb')][0x3]===_0xa8d7('0xd')||!process['argv'][0x4]||process['argv'][0x4]===_0xa8d7('0xc')||process[_0xa8d7('0xb')][0x4]===_0xa8d7('0xd')){throw new Error(_0xa8d7('0xf'));}var FIELDS=_[_0xa8d7('0x10')](process['argv'][0x3][_0xa8d7('0x11')](','),process[_0xa8d7('0xb')][0x4]['split'](','));if(!process[_0xa8d7('0xb')][0x5]||process[_0xa8d7('0xb')][0x5]===_0xa8d7('0xc')||process[_0xa8d7('0xb')][0x5]===_0xa8d7('0xd')){throw new Error(_0xa8d7('0x12'));}var LISTID=process[_0xa8d7('0xb')][0x5];var COMPANYID=process[_0xa8d7('0xb')][0x6]&&process['argv'][0x6]!==_0xa8d7('0xc')&&process['argv'][0x6]!==_0xa8d7('0xd')?process[_0xa8d7('0xb')][0x6]:null;var DUPLICATES=process[_0xa8d7('0xb')][0x7]&&process[_0xa8d7('0xb')][0x7]!==_0xa8d7('0xc')&&process[_0xa8d7('0xb')][0x7]!=='null'?process[_0xa8d7('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0xa8d7('0xb')][0x8]==='undefined'||process[_0xa8d7('0xb')][0x8]==='null'){throw new Error(_0xa8d7('0x13'));}var SOCKET_TIMESTAMP=process[_0xa8d7('0xb')][0x8];}catch(_0x173f57){logger['error'](_0x173f57);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(_0x72977c,_0x58b6ee,_0x120055,_0x499b5d){var _0x43a800={'message':_0x58b6ee};_0x43a800[_0x72977c]=!![];if(_0x120055){_0x43a800[_0xa8d7('0x14')]=_0x120055;}if(_0x499b5d){_0x43a800[_0xa8d7('0x15')]=_0x499b5d;}return _0x43a800;}function isEmail(_0x343bba){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))*$/[_0xa8d7('0x16')](_0x343bba);}function checkRow(_0x1903ec,_0x45d27d,_0x1b546f){return new BPromise(function(_0x1fdb8b,_0x164182){if(_['isNil'](_0x1903ec)){return _0x164182(handleCheckRowError(_0xa8d7('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x1b546f));}if(_0x1903ec['errors']&&_0x1903ec[_0xa8d7('0x18')][_0xa8d7('0x19')]){var _0x5a1da5=_[_0xa8d7('0x1a')](_0x1903ec['errors'],_0xa8d7('0x1b'))[_0xa8d7('0x1c')](';');return _0x164182(handleCheckRowError(_0xa8d7('0x17'),_0x5a1da5,null,_0x1b546f));}var _0x50ff48={};for(var _0x35d9c5 in FIELDS){if(FIELDS['hasOwnProperty'](_0x35d9c5)&&FIELDS[_0x35d9c5]){_0x50ff48[_0x35d9c5]=_0x1903ec[_0xa8d7('0x1d')][0x0][FIELDS[_0x35d9c5]]||_0x1903ec[_0xa8d7('0x1d')][0x0]['\ufeff'+FIELDS[_0x35d9c5]];}}if(!_0x50ff48[_0xa8d7('0x1e')]){return _0x164182(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x1b546f));}if(!_0x50ff48[_0xa8d7('0x1f')]){return _0x164182(handleCheckRowError('error',_0xa8d7('0x20'),null,_0x1b546f));}if(_0x50ff48[_0xa8d7('0x21')]){var _0x390528=moment(_0x50ff48[_0xa8d7('0x21')],_0xa8d7('0x22'));if(!_0x390528['isValid']()){return _0x164182(handleCheckRowError('error',_0xa8d7('0x23'),null,_0x1b546f));}}if(_0x50ff48[_0xa8d7('0x24')]){if(!isEmail(_0x50ff48['email'])){return _0x164182(handleCheckRowError(_0xa8d7('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x1b546f));}}_0x50ff48[_0xa8d7('0x25')]=LISTID;_0x50ff48[_0xa8d7('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x45d27d){var _0x3311ef={};for(var _0x5df1c0=0x0,_0x2a9afb=DUPLICATES[_0xa8d7('0x19')];_0x5df1c0<_0x2a9afb;_0x5df1c0+=0x1){_0x3311ef[DUPLICATES[_0x5df1c0]]=_0x50ff48[DUPLICATES[_0x5df1c0]];}var _0x276703=_[_0xa8d7('0x27')](_0x45d27d,_0x3311ef);if(_0x276703){return _0x164182(handleCheckRowError(_0xa8d7('0x28'),_0xa8d7('0x29'),_0x276703,_0x1b546f));}}return db[_0xa8d7('0x2a')][_0xa8d7('0x2b')](_0x50ff48,{'raw':!![],'hooks':![],'fields':_['keys'](_0x50ff48)})[_0xa8d7('0x2c')](function(_0x460814){if(DUPLICATES&&DUPLICATES[_0xa8d7('0x19')]&&_0x45d27d){_0x45d27d[_0xa8d7('0x2d')](_['pick'](_0x50ff48,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x460814['id'];return _0x1fdb8b();})[_0xa8d7('0x2e')](function(_0x7bf759){return _0x164182(handleCheckRowError(_0xa8d7('0x17'),_0xa8d7('0x2f')+(_0x7bf759['message']||JSON[_0xa8d7('0x30')](_0x7bf759)),null,_0x1b546f));});});}function checkHopper(){function _0x2610f3(){return function(_0x3a9224){logger[_0xa8d7('0x17')](_0xa8d7('0x31'),_0xa8d7('0x32'),util['inspect'](_0x3a9224,{'showHidden':![],'depth':null}));};}var _0x5671b7=function(_0x4ceb72,_0x5262ff){var _0x45d284=squel[_0xa8d7('0x33')]()[_0xa8d7('0x34')](_0xa8d7('0x35'))['fromQuery']([_0xa8d7('0x1f'),'scheduledAt','ContactId',_0xa8d7('0x25'),_0x5262ff,'createdAt',_0xa8d7('0x36')],squel[_0xa8d7('0x37')]()['field'](_0xa8d7('0x1f'),_0xa8d7('0x1f'))[_0xa8d7('0x38')](_0xa8d7('0x39'),_0xa8d7('0x3a'))['field']('id',_0xa8d7('0x3b'))[_0xa8d7('0x38')](LISTID[_0xa8d7('0x3c')](),'ListId')[_0xa8d7('0x38')](_0x4ceb72['id']['toString'](),_0x5262ff)[_0xa8d7('0x38')](_0xa8d7('0x39'),_0xa8d7('0x3d'))[_0xa8d7('0x38')](_0xa8d7('0x39'),_0xa8d7('0x36'))[_0xa8d7('0x3e')]('cm_contacts')['where'](_0xa8d7('0x3f'))['where'](_0xa8d7('0x40'),LISTID[_0xa8d7('0x3c')]())[_0xa8d7('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0xa8d7('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa8d7('0x37')]()[_0xa8d7('0x38')](_0xa8d7('0x1f'))[_0xa8d7('0x3e')]('cm_hopper')[_0xa8d7('0x41')](_0x5262ff+_0xa8d7('0x42'),_0x4ceb72['id'][_0xa8d7('0x3c')]())))['toString']();return _0x45d284;};var _0x555744=function(_0x241a92,_0x19e11a){var _0x3e96c5=squel[_0xa8d7('0x33')]()[_0xa8d7('0x34')]('cm_hopper')['fromQuery']([_0xa8d7('0x1f'),_0xa8d7('0x3a'),'ContactId',_0xa8d7('0x25'),_0x19e11a,_0xa8d7('0x3d'),_0xa8d7('0x36')],squel['select']()[_0xa8d7('0x38')]('phone',_0xa8d7('0x1f'))[_0xa8d7('0x38')]('NOW()',_0xa8d7('0x3a'))[_0xa8d7('0x38')]('id',_0xa8d7('0x3b'))[_0xa8d7('0x38')](LISTID[_0xa8d7('0x3c')](),_0xa8d7('0x25'))['field'](_0x241a92['id']['toString'](),_0x19e11a)[_0xa8d7('0x38')](_0xa8d7('0x39'),_0xa8d7('0x3d'))[_0xa8d7('0x38')](_0xa8d7('0x39'),'updatedAt')[_0xa8d7('0x3e')]('cm_contacts')[_0xa8d7('0x41')](_0xa8d7('0x3f'))[_0xa8d7('0x41')]('ListId\x20=\x20?',LISTID[_0xa8d7('0x3c')]())[_0xa8d7('0x41')](_0xa8d7('0x43'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xa8d7('0x41')](_0xa8d7('0x44'),squel[_0xa8d7('0x37')]()[_0xa8d7('0x38')](_0xa8d7('0x45'))['from'](_0xa8d7('0x46'))[_0xa8d7('0x41')](_0x19e11a+_0xa8d7('0x42'),_0x241a92['id'][_0xa8d7('0x3c')]()))[_0xa8d7('0x41')](_0xa8d7('0x44'),squel[_0xa8d7('0x37')]()[_0xa8d7('0x38')]('phone')['from'](_0xa8d7('0x35'))[_0xa8d7('0x41')](_0x19e11a+_0xa8d7('0x42'),_0x241a92['id']['toString']())))[_0xa8d7('0x3c')]();return _0x3e96c5;};function _0x5879a1(_0x518bee,_0x2ef5ea){var _0x34af7d=squel['insert']()['into'](_0xa8d7('0x35'))['fromQuery']([_0xa8d7('0x1f'),_0xa8d7('0x3a'),_0xa8d7('0x3b'),_0xa8d7('0x25'),_0x2ef5ea,_0xa8d7('0x3d'),_0xa8d7('0x36')],squel[_0xa8d7('0x37')]()[_0xa8d7('0x38')](_0xa8d7('0x1f'),_0xa8d7('0x1f'))[_0xa8d7('0x38')](_0xa8d7('0x39'),_0xa8d7('0x3a'))[_0xa8d7('0x38')]('id',_0xa8d7('0x3b'))[_0xa8d7('0x38')](LISTID[_0xa8d7('0x3c')](),_0xa8d7('0x25'))[_0xa8d7('0x38')](_0x518bee['id'][_0xa8d7('0x3c')](),_0x2ef5ea)[_0xa8d7('0x38')]('NOW()',_0xa8d7('0x3d'))[_0xa8d7('0x38')](_0xa8d7('0x39'),_0xa8d7('0x36'))[_0xa8d7('0x3e')](_0xa8d7('0x47'))[_0xa8d7('0x41')](_0xa8d7('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0xa8d7('0x3c')]())[_0xa8d7('0x41')](_0xa8d7('0x43'),squel[_0xa8d7('0x48')](hopperContacts))[_0xa8d7('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0xa8d7('0x3c')]();return _0x34af7d;}function _0x272cd2(_0x34a1d0,_0x5ca4ca){var _0x5f38ab=squel['insert']()['into'](_0xa8d7('0x49'))['fromQuery']([_0xa8d7('0x1f'),_0xa8d7('0x3b'),'ListId',_0x5ca4ca,_0xa8d7('0x3d'),'updatedAt'],squel['select']()[_0xa8d7('0x38')](_0xa8d7('0x1f'),_0xa8d7('0x1f'))['field']('id','ContactId')[_0xa8d7('0x38')](LISTID[_0xa8d7('0x3c')](),_0xa8d7('0x25'))[_0xa8d7('0x38')](_0x34a1d0['id']['toString'](),_0x5ca4ca)['field']('NOW()',_0xa8d7('0x3d'))[_0xa8d7('0x38')](_0xa8d7('0x39'),'updatedAt')[_0xa8d7('0x3e')](_0xa8d7('0x47'))[_0xa8d7('0x41')](_0xa8d7('0x3f'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xa8d7('0x41')]('id\x20IN\x20?',squel[_0xa8d7('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xa8d7('0x3c')]();return _0x5f38ab;}return db[_0xa8d7('0x4a')][_0xa8d7('0x4b')]({'where':{'type':_0xa8d7('0x4c')},'attributes':['id',_0xa8d7('0x4d')],'include':[{'model':db[_0xa8d7('0x4e')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0xca57d1){var _0x268d32=[];if(_0xca57d1){var _0x45c4b2;for(var _0x4bf5c2=0x0,_0x33dbda;_0x4bf5c2<_0xca57d1['length'];_0x4bf5c2+=0x1){_0x33dbda=_0xca57d1[_0x4bf5c2][_0xa8d7('0x4f')]({'plain':!![]});switch(_0x33dbda['dialCheckDuplicateType']){case _0xa8d7('0x50'):_0x268d32[_0xa8d7('0x2d')](db['sequelize']['query'](_0x555744(_0x33dbda,'VoiceQueueId'))['then'](function(){})[_0xa8d7('0x2e')](_0x2610f3()));break;case _0xa8d7('0x51'):_0x268d32[_0xa8d7('0x2d')](db[_0xa8d7('0x52')][_0xa8d7('0x53')](_0x5671b7(_0x33dbda,_0xa8d7('0x54')))[_0xa8d7('0x2c')](function(){})[_0xa8d7('0x2e')](_0x2610f3()));break;default:_0x268d32[_0xa8d7('0x2d')](db[_0xa8d7('0x52')][_0xa8d7('0x53')](_0x5879a1(_0x33dbda,_0xa8d7('0x54')))[_0xa8d7('0x2c')](function(){})[_0xa8d7('0x2e')](_0x2610f3()));}}}return _0x268d32;})[_0xa8d7('0x55')]()[_0xa8d7('0x2c')](function(){return db[_0xa8d7('0x4a')][_0xa8d7('0x4b')]({'where':{'type':_0xa8d7('0x4c')},'attributes':['id'],'include':[{'model':db[_0xa8d7('0x4e')],'as':_0xa8d7('0x56'),'where':{'id':LISTID}}]})[_0xa8d7('0x2c')](function(_0x4affad){var _0x87f575=[];if(_0x4affad){var _0x31e415;for(var _0x1ae337=0x0,_0x18420c;_0x1ae337<_0x4affad[_0xa8d7('0x19')];_0x1ae337+=0x1){_0x18420c=_0x4affad[_0x1ae337][_0xa8d7('0x4f')]({'plain':!![]});_0x87f575[_0xa8d7('0x2d')](db[_0xa8d7('0x52')][_0xa8d7('0x53')](_0x272cd2(_0x18420c,_0xa8d7('0x54')))[_0xa8d7('0x2c')](function(){})[_0xa8d7('0x2e')](_0x2610f3()));}}return _0x87f575;})[_0xa8d7('0x55')]();})['then'](function(){return db[_0xa8d7('0x57')]['findAll']({'attributes':['id',_0xa8d7('0x4d')],'include':[{'model':db[_0xa8d7('0x4e')],'as':_0xa8d7('0x58'),'where':{'id':LISTID}}]})[_0xa8d7('0x2c')](function(_0xde10a2){var _0x143059=[];if(_0xde10a2){for(var _0x1cf504=0x0,_0x2a25d2;_0x1cf504<_0xde10a2[_0xa8d7('0x19')];_0x1cf504+=0x1){_0x2a25d2=_0xde10a2[_0x1cf504][_0xa8d7('0x4f')]({'plain':!![]});switch(_0x2a25d2['dialCheckDuplicateType']){case _0xa8d7('0x50'):_0x143059[_0xa8d7('0x2d')](db[_0xa8d7('0x52')]['query'](_0x555744(_0x2a25d2,_0xa8d7('0x59')))[_0xa8d7('0x2c')](function(){})[_0xa8d7('0x2e')](_0x2610f3()));break;case _0xa8d7('0x51'):_0x143059[_0xa8d7('0x2d')](db[_0xa8d7('0x52')]['query'](_0x5671b7(_0x2a25d2,'CampaignId'))[_0xa8d7('0x2c')](function(){})[_0xa8d7('0x2e')](_0x2610f3()));break;default:_0x143059[_0xa8d7('0x2d')](db['sequelize']['query'](_0x5879a1(_0x2a25d2,_0xa8d7('0x59')))[_0xa8d7('0x2c')](function(){})[_0xa8d7('0x2e')](_0x2610f3()));}}}return _0x143059;})[_0xa8d7('0x55')]();})[_0xa8d7('0x2c')](function(){return db[_0xa8d7('0x57')][_0xa8d7('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xa8d7('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa8d7('0x2c')](function(_0x443e13){var _0x4980d8=[];if(_0x443e13){for(var _0x3fe78f=0x0,_0x593e4d;_0x3fe78f<_0x443e13['length'];_0x3fe78f+=0x1){_0x593e4d=_0x443e13[_0x3fe78f]['get']({'plain':!![]});_0x4980d8['push'](db[_0xa8d7('0x52')][_0xa8d7('0x53')](_0x272cd2(_0x593e4d,_0xa8d7('0x59')))[_0xa8d7('0x2c')](function(){})[_0xa8d7('0x2e')](_0x2610f3()));}}return _0x4980d8;})[_0xa8d7('0x55')]();})[_0xa8d7('0x2e')](function(_0x415bf2){logger[_0xa8d7('0x17')](_0xa8d7('0x5a'),'generalCheckHopper',_0x415bf2[_0xa8d7('0x1b')]);});}var processPromises=function(_0x52ed19){return BPromise[_0xa8d7('0x55')](promises)[_0xa8d7('0x2c')](function(_0x4b09e3){})[_0xa8d7('0x2e')](function(_0x2ed1a4){logger[_0xa8d7('0x17')](_0xa8d7('0x5b'),JSON[_0xa8d7('0x30')](_0x2ed1a4));})[_0xa8d7('0x5c')](function(){socket[_0xa8d7('0x5d')](_0xa8d7('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x52ed19){return _0x52ed19[_0xa8d7('0x5f')]();}});};var endCsv=function(){return BPromise[_0xa8d7('0x60')]()[_0xa8d7('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xa8d7('0x2c')](function(){socket[_0xa8d7('0x5d')](_0xa8d7('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x203673){logger[_0xa8d7('0x17')](_0xa8d7('0x61'),JSON[_0xa8d7('0x30')](_0x203673));}finally{process[_0xa8d7('0x62')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xa8d7('0x63'));endCsv();});function main(){return BPromise[_0xa8d7('0x60')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa8d7('0x11')](',');return db['CmContact'][_0xa8d7('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa8d7('0x2c')](function(_0x30ebbb){var _0x340f34=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa8d7('0x64')](_0x340f34,{'header':!![],'skipEmptyLines':!![],'step':function(_0x28cb5b,_0x2f71fb){total+=0x1;var _0x198ab=total;promises[_0xa8d7('0x2d')](checkRow(_0x28cb5b,_0x30ebbb,_0x198ab)[_0xa8d7('0x2c')](function(){success+=0x1;})[_0xa8d7('0x2e')](function(_0x3f28c9){if(_0x3f28c9[_0xa8d7('0x17')]){errors+=0x1;delete _0x3f28c9['error'];}else if(_0x3f28c9[_0xa8d7('0x28')]){duplicates+=0x1;delete _0x3f28c9[_0xa8d7('0x28')];}rows[_0xa8d7('0x2d')](_0x3f28c9);}));if(total%0xc8===0x0){_0x2f71fb['pause']();return processPromises(_0x2f71fb);}},'complete':function(){return processPromises()[_0xa8d7('0x2c')](function(){logger[_0xa8d7('0x65')](_0xa8d7('0x66'));endCsv();});},'error':function(_0x5e16ca,_0x28f160){logger[_0xa8d7('0x65')](_0xa8d7('0x67'),JSON[_0xa8d7('0x30')](_0x5e16ca));endCsv();}});})[_0xa8d7('0x2e')](function(_0x291c88){logger['error'](_0xa8d7('0x68'),JSON['stringify'](_0x291c88));});}main(); \ No newline at end of file +var _0x3532=['from','deletedAt\x20IS\x20NULL','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','str','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','query','VoiceQueueId','all','findAll','BlackLists','Campaign','onlyIfOpen','CampaignId','cmContact,\x20%s,\x20%s','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','CSV\x20import\x20process\x20stopped!','createReadStream','parse','info','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','errors','length','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','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','select'];(function(_0x3e13ee,_0x402e81){var _0x4b458c=function(_0x42dc5f){while(--_0x42dc5f){_0x3e13ee['push'](_0x3e13ee['shift']());}};_0x4b458c(++_0x402e81);}(_0x3532,0xec));var _0x2353=function(_0x2dd027,_0xde90b1){_0x2dd027=_0x2dd027-0x0;var _0x269fd7=_0x3532[_0x2dd027];return _0x269fd7;};'use strict';var BPromise=require('bluebird');var util=require(_0x2353('0x0'));var _=require(_0x2353('0x1'));var fs=require('fs');var squel=require(_0x2353('0x2'));var Papa=require(_0x2353('0x3'));var Redis=require(_0x2353('0x4'));var db=require(_0x2353('0x5'))['db'];var config=require(_0x2353('0x6'));var logger=require('../../../config/logger')('api');config['redis']=_['defaults'](config[_0x2353('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x2353('0x8'))(new Redis(config[_0x2353('0x7')]));require(_0x2353('0x9'))[_0x2353('0xa')](socket);try{if(!process['argv'][0x2]||process[_0x2353('0xb')][0x2]==='undefined'||process[_0x2353('0xb')][0x2]===_0x2353('0xc')){throw new Error(_0x2353('0xd'));}var FILEPATH=process[_0x2353('0xb')][0x2];if(!process[_0x2353('0xb')][0x3]||process[_0x2353('0xb')][0x3]===_0x2353('0xe')||process[_0x2353('0xb')][0x3]==='null'||!process['argv'][0x4]||process[_0x2353('0xb')][0x4]===_0x2353('0xe')||process[_0x2353('0xb')][0x4]===_0x2353('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x2353('0xf')](process[_0x2353('0xb')][0x3]['split'](','),process[_0x2353('0xb')][0x4]['split'](','));if(!process[_0x2353('0xb')][0x5]||process[_0x2353('0xb')][0x5]===_0x2353('0xe')||process[_0x2353('0xb')][0x5]==='null'){throw new Error(_0x2353('0x10'));}var LISTID=process[_0x2353('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x2353('0xb')][0x6]!==_0x2353('0xe')&&process['argv'][0x6]!==_0x2353('0xc')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x2353('0xb')][0x7]!==_0x2353('0xe')&&process[_0x2353('0xb')][0x7]!==_0x2353('0xc')?process[_0x2353('0xb')][0x7]:null;if(!process[_0x2353('0xb')][0x8]||process[_0x2353('0xb')][0x8]===_0x2353('0xe')||process[_0x2353('0xb')][0x8]==='null'){throw new Error(_0x2353('0x11'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x19ef86){logger['error'](_0x19ef86);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(_0x40f0c2,_0x37413b,_0x56594f,_0x3bc710){var _0x54e532={'message':_0x37413b};_0x54e532[_0x40f0c2]=!![];if(_0x56594f){_0x54e532[_0x2353('0x12')]=_0x56594f;}if(_0x3bc710){_0x54e532[_0x2353('0x13')]=_0x3bc710;}return _0x54e532;}function isEmail(_0x2c6bf3){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))*$/[_0x2353('0x14')](_0x2c6bf3);}function checkRow(_0x3b6f11,_0x5d13ca,_0x3dc464){return new BPromise(function(_0x4cde07,_0x5eeb57){if(_['isNil'](_0x3b6f11)){return _0x5eeb57(handleCheckRowError(_0x2353('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3dc464));}if(_0x3b6f11[_0x2353('0x16')]&&_0x3b6f11[_0x2353('0x16')][_0x2353('0x17')]){var _0x7317b7=_['map'](_0x3b6f11[_0x2353('0x16')],'message')[_0x2353('0x18')](';');return _0x5eeb57(handleCheckRowError(_0x2353('0x15'),_0x7317b7,null,_0x3dc464));}var _0x33bf74={};for(var _0x20dcdc in FIELDS){if(FIELDS[_0x2353('0x19')](_0x20dcdc)&&FIELDS[_0x20dcdc]){_0x33bf74[_0x20dcdc]=_0x3b6f11[_0x2353('0x1a')][0x0][FIELDS[_0x20dcdc]]||_0x3b6f11[_0x2353('0x1a')][0x0]['\ufeff'+FIELDS[_0x20dcdc]];}}if(!_0x33bf74[_0x2353('0x1b')]){return _0x5eeb57(handleCheckRowError('error',_0x2353('0x1c'),null,_0x3dc464));}if(!_0x33bf74[_0x2353('0x1d')]){return _0x5eeb57(handleCheckRowError(_0x2353('0x15'),_0x2353('0x1e'),null,_0x3dc464));}if(_0x33bf74[_0x2353('0x1f')]){var _0x363900=moment(_0x33bf74[_0x2353('0x1f')],_0x2353('0x20'));if(!_0x363900[_0x2353('0x21')]()){return _0x5eeb57(handleCheckRowError(_0x2353('0x15'),_0x2353('0x22'),null,_0x3dc464));}}if(_0x33bf74['email']){if(!isEmail(_0x33bf74[_0x2353('0x23')])){return _0x5eeb57(handleCheckRowError(_0x2353('0x15'),_0x2353('0x24'),null,_0x3dc464));}}_0x33bf74[_0x2353('0x25')]=LISTID;_0x33bf74[_0x2353('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x2353('0x17')]&&_0x5d13ca){var _0xc33247={};for(var _0x39e048=0x0,_0x208f58=DUPLICATES[_0x2353('0x17')];_0x39e048<_0x208f58;_0x39e048+=0x1){_0xc33247[DUPLICATES[_0x39e048]]=_0x33bf74[DUPLICATES[_0x39e048]];}var _0x7aef43=_[_0x2353('0x27')](_0x5d13ca,_0xc33247);if(_0x7aef43){return _0x5eeb57(handleCheckRowError(_0x2353('0x28'),_0x2353('0x29'),_0x7aef43,_0x3dc464));}}return db[_0x2353('0x2a')][_0x2353('0x2b')](_0x33bf74,{'raw':!![],'hooks':![],'fields':_[_0x2353('0x2c')](_0x33bf74)})[_0x2353('0x2d')](function(_0x21f26b){if(DUPLICATES&&DUPLICATES[_0x2353('0x17')]&&_0x5d13ca){_0x5d13ca['push'](_['pick'](_0x33bf74,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x21f26b['id'];return _0x4cde07();})[_0x2353('0x2e')](function(_0x3a7953){return _0x5eeb57(handleCheckRowError(_0x2353('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x3a7953['message']||JSON[_0x2353('0x2f')](_0x3a7953)),null,_0x3dc464));});});}function checkHopper(){function _0xea2639(){return function(_0x272285){logger[_0x2353('0x15')]('cmContact',_0x2353('0x30'),util[_0x2353('0x31')](_0x272285,{'showHidden':![],'depth':null}));};}var _0x3b4ead=function(_0x11e058,_0x1bb32a){var _0x39b9a5=squel[_0x2353('0x32')]()[_0x2353('0x33')](_0x2353('0x34'))[_0x2353('0x35')]([_0x2353('0x1d'),_0x2353('0x36'),_0x2353('0x37'),_0x2353('0x25'),_0x1bb32a,_0x2353('0x38'),_0x2353('0x39')],squel['select']()[_0x2353('0x3a')](_0x2353('0x1d'),_0x2353('0x1d'))[_0x2353('0x3a')](_0x2353('0x3b'),_0x2353('0x36'))[_0x2353('0x3a')]('id',_0x2353('0x37'))[_0x2353('0x3a')](LISTID[_0x2353('0x3c')](),_0x2353('0x25'))[_0x2353('0x3a')](_0x11e058['id'][_0x2353('0x3c')](),_0x1bb32a)['field'](_0x2353('0x3b'),_0x2353('0x38'))[_0x2353('0x3a')]('NOW()',_0x2353('0x39'))['from'](_0x2353('0x3d'))[_0x2353('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0x2353('0x3f'),LISTID[_0x2353('0x3c')]())[_0x2353('0x3e')](_0x2353('0x40'))[_0x2353('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2353('0x3a')](_0x2353('0x1d'))['from'](_0x2353('0x34'))['where'](_0x1bb32a+_0x2353('0x41'),_0x11e058['id'][_0x2353('0x3c')]())))['toString']();return _0x39b9a5;};var _0x3361c3=function(_0x5022db,_0x11d748){var _0x33dd40=squel[_0x2353('0x32')]()[_0x2353('0x33')](_0x2353('0x34'))[_0x2353('0x35')](['phone','scheduledAt',_0x2353('0x37'),_0x2353('0x25'),_0x11d748,'createdAt',_0x2353('0x39')],squel[_0x2353('0x42')]()[_0x2353('0x3a')]('phone','phone')[_0x2353('0x3a')]('NOW()',_0x2353('0x36'))[_0x2353('0x3a')]('id','ContactId')['field'](LISTID['toString'](),_0x2353('0x25'))['field'](_0x5022db['id'][_0x2353('0x3c')](),_0x11d748)[_0x2353('0x3a')]('NOW()',_0x2353('0x38'))['field'](_0x2353('0x3b'),_0x2353('0x39'))[_0x2353('0x43')](_0x2353('0x3d'))[_0x2353('0x3e')](_0x2353('0x44'))[_0x2353('0x3e')]('ListId\x20=\x20?',LISTID[_0x2353('0x3c')]())[_0x2353('0x3e')](_0x2353('0x45'),squel['str'](hopperContacts))[_0x2353('0x3e')](_0x2353('0x40'))[_0x2353('0x3e')](_0x2353('0x46'),squel['select']()[_0x2353('0x3a')](_0x2353('0x47'))['from']('cm_hopper_final')[_0x2353('0x3e')](_0x11d748+_0x2353('0x41'),_0x5022db['id'][_0x2353('0x3c')]()))[_0x2353('0x3e')](_0x2353('0x46'),squel[_0x2353('0x42')]()[_0x2353('0x3a')](_0x2353('0x1d'))[_0x2353('0x43')]('cm_hopper')[_0x2353('0x3e')](_0x11d748+_0x2353('0x41'),_0x5022db['id'][_0x2353('0x3c')]())))[_0x2353('0x3c')]();return _0x33dd40;};function _0x56795a(_0x3b2aa9,_0x1f1543){var _0x4bcbb9=squel[_0x2353('0x32')]()[_0x2353('0x33')]('cm_hopper')[_0x2353('0x35')]([_0x2353('0x1d'),_0x2353('0x36'),'ContactId','ListId',_0x1f1543,_0x2353('0x38'),_0x2353('0x39')],squel['select']()[_0x2353('0x3a')](_0x2353('0x1d'),_0x2353('0x1d'))[_0x2353('0x3a')]('NOW()',_0x2353('0x36'))[_0x2353('0x3a')]('id',_0x2353('0x37'))[_0x2353('0x3a')](LISTID['toString'](),_0x2353('0x25'))[_0x2353('0x3a')](_0x3b2aa9['id']['toString'](),_0x1f1543)['field'](_0x2353('0x3b'),_0x2353('0x38'))['field'](_0x2353('0x3b'),_0x2353('0x39'))[_0x2353('0x43')](_0x2353('0x3d'))[_0x2353('0x3e')]('deletedAt\x20IS\x20NULL')[_0x2353('0x3e')]('ListId\x20=\x20?',LISTID[_0x2353('0x3c')]())[_0x2353('0x3e')](_0x2353('0x45'),squel[_0x2353('0x48')](hopperContacts))[_0x2353('0x3e')](_0x2353('0x40')))[_0x2353('0x3c')]();return _0x4bcbb9;}function _0x194925(_0xe6b42f,_0x33871f){var _0xdcab38=squel[_0x2353('0x32')]()[_0x2353('0x33')](_0x2353('0x49'))[_0x2353('0x35')]([_0x2353('0x1d'),'ContactId','ListId',_0x33871f,'createdAt',_0x2353('0x39')],squel['select']()[_0x2353('0x3a')]('phone',_0x2353('0x1d'))[_0x2353('0x3a')]('id',_0x2353('0x37'))[_0x2353('0x3a')](LISTID['toString'](),'ListId')['field'](_0xe6b42f['id'][_0x2353('0x3c')](),_0x33871f)[_0x2353('0x3a')](_0x2353('0x3b'),'createdAt')[_0x2353('0x3a')](_0x2353('0x3b'),_0x2353('0x39'))['from'](_0x2353('0x3d'))[_0x2353('0x3e')](_0x2353('0x44'))[_0x2353('0x3e')](_0x2353('0x3f'),LISTID['toString']())[_0x2353('0x3e')](_0x2353('0x45'),squel[_0x2353('0x48')](hopperContacts))[_0x2353('0x3e')](_0x2353('0x40')))[_0x2353('0x3c')]();return _0xdcab38;}return db[_0x2353('0x4a')]['findAll']({'where':{'type':_0x2353('0x4b')},'attributes':['id',_0x2353('0x4c')],'include':[{'model':db[_0x2353('0x4d')],'as':_0x2353('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0xd425b7){var _0x1b0239=[];if(_0xd425b7){var _0x583b6a;for(var _0xf8cc28=0x0,_0x17041a;_0xf8cc28<_0xd425b7[_0x2353('0x17')];_0xf8cc28+=0x1){_0x17041a=_0xd425b7[_0xf8cc28][_0x2353('0x4f')]({'plain':!![]});switch(_0x17041a[_0x2353('0x4c')]){case'always':_0x1b0239[_0x2353('0x50')](db[_0x2353('0x51')][_0x2353('0x52')](_0x3361c3(_0x17041a,_0x2353('0x53')))['then'](function(){})[_0x2353('0x2e')](_0xea2639()));break;case'onlyIfOpen':_0x1b0239['push'](db[_0x2353('0x51')][_0x2353('0x52')](_0x3b4ead(_0x17041a,_0x2353('0x53')))[_0x2353('0x2d')](function(){})[_0x2353('0x2e')](_0xea2639()));break;default:_0x1b0239[_0x2353('0x50')](db[_0x2353('0x51')][_0x2353('0x52')](_0x56795a(_0x17041a,'VoiceQueueId'))['then'](function(){})[_0x2353('0x2e')](_0xea2639()));}}}return _0x1b0239;})[_0x2353('0x54')]()[_0x2353('0x2d')](function(){return db[_0x2353('0x4a')][_0x2353('0x55')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x2353('0x4d')],'as':_0x2353('0x56'),'where':{'id':LISTID}}]})[_0x2353('0x2d')](function(_0x471761){var _0x469610=[];if(_0x471761){var _0xb53544;for(var _0x55f729=0x0,_0x2d210b;_0x55f729<_0x471761[_0x2353('0x17')];_0x55f729+=0x1){_0x2d210b=_0x471761[_0x55f729][_0x2353('0x4f')]({'plain':!![]});_0x469610[_0x2353('0x50')](db['sequelize'][_0x2353('0x52')](_0x194925(_0x2d210b,'VoiceQueueId'))[_0x2353('0x2d')](function(){})[_0x2353('0x2e')](_0xea2639()));}}return _0x469610;})[_0x2353('0x54')]();})[_0x2353('0x2d')](function(){return db[_0x2353('0x57')][_0x2353('0x55')]({'attributes':['id',_0x2353('0x4c')],'include':[{'model':db[_0x2353('0x4d')],'as':_0x2353('0x4e'),'where':{'id':LISTID}}]})[_0x2353('0x2d')](function(_0x2f37d9){var _0x275da9=[];if(_0x2f37d9){for(var _0x472b65=0x0,_0x40d112;_0x472b65<_0x2f37d9[_0x2353('0x17')];_0x472b65+=0x1){_0x40d112=_0x2f37d9[_0x472b65][_0x2353('0x4f')]({'plain':!![]});switch(_0x40d112[_0x2353('0x4c')]){case'always':_0x275da9['push'](db['sequelize'][_0x2353('0x52')](_0x3361c3(_0x40d112,'CampaignId'))[_0x2353('0x2d')](function(){})['catch'](_0xea2639()));break;case _0x2353('0x58'):_0x275da9[_0x2353('0x50')](db[_0x2353('0x51')][_0x2353('0x52')](_0x3b4ead(_0x40d112,_0x2353('0x59')))['then'](function(){})[_0x2353('0x2e')](_0xea2639()));break;default:_0x275da9[_0x2353('0x50')](db[_0x2353('0x51')][_0x2353('0x52')](_0x56795a(_0x40d112,_0x2353('0x59')))[_0x2353('0x2d')](function(){})[_0x2353('0x2e')](_0xea2639()));}}}return _0x275da9;})[_0x2353('0x54')]();})['then'](function(){return db[_0x2353('0x57')][_0x2353('0x55')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x2353('0x56'),'where':{'id':LISTID}}]})[_0x2353('0x2d')](function(_0x314d5e){var _0x109f2d=[];if(_0x314d5e){for(var _0x2d7e08=0x0,_0x32f040;_0x2d7e08<_0x314d5e[_0x2353('0x17')];_0x2d7e08+=0x1){_0x32f040=_0x314d5e[_0x2d7e08][_0x2353('0x4f')]({'plain':!![]});_0x109f2d[_0x2353('0x50')](db[_0x2353('0x51')][_0x2353('0x52')](_0x194925(_0x32f040,_0x2353('0x59')))[_0x2353('0x2d')](function(){})['catch'](_0xea2639()));}}return _0x109f2d;})[_0x2353('0x54')]();})['catch'](function(_0x42e4d4){logger[_0x2353('0x15')](_0x2353('0x5a'),'generalCheckHopper',_0x42e4d4['message']);});}var processPromises=function(_0x2ab823){return BPromise[_0x2353('0x54')](promises)[_0x2353('0x2d')](function(_0x1d3f38){})[_0x2353('0x2e')](function(_0x5363d8){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x2353('0x2f')](_0x5363d8));})['finally'](function(){socket[_0x2353('0x5b')](_0x2353('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2ab823){return _0x2ab823[_0x2353('0x5d')]();}});};var endCsv=function(){return BPromise[_0x2353('0x5e')]()[_0x2353('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x2353('0x2d')](function(){socket['emit'](_0x2353('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x240233){logger[_0x2353('0x15')](_0x2353('0x5f'),JSON['stringify'](_0x240233));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x2353('0x60'));endCsv();});function main(){return BPromise[_0x2353('0x5e')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x2353('0x2a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x3e20bc){var _0x3a7c95=fs[_0x2353('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x2353('0x62')](_0x3a7c95,{'header':!![],'skipEmptyLines':!![],'step':function(_0x12b879,_0x52d734){total+=0x1;var _0x4b5e95=total;promises[_0x2353('0x50')](checkRow(_0x12b879,_0x3e20bc,_0x4b5e95)[_0x2353('0x2d')](function(){success+=0x1;})[_0x2353('0x2e')](function(_0x197585){if(_0x197585[_0x2353('0x15')]){errors+=0x1;delete _0x197585[_0x2353('0x15')];}else if(_0x197585[_0x2353('0x28')]){duplicates+=0x1;delete _0x197585['duplicate'];}rows[_0x2353('0x50')](_0x197585);}));if(total%0xc8===0x0){_0x52d734['pause']();return processPromises(_0x52d734);}},'complete':function(){return processPromises()[_0x2353('0x2d')](function(){logger[_0x2353('0x63')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x9ddcfe,_0x148891){logger[_0x2353('0x63')]('CSV\x20parse\x20error',JSON['stringify'](_0x9ddcfe));endCsv();}});})[_0x2353('0x2e')](function(_0x5ce683){logger[_0x2353('0x15')](_0x2353('0x64'),JSON[_0x2353('0x2f')](_0x5ce683));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e7123d0..04f9bbb 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 _0x2517=['cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','join','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','cm_contacts','\x20=\x20?','concat','keys','CompanyId','into',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','push','catch','stringify','send','start','binding','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\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','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','each','then','finish','affectedRows','unlink','complete','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','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','format','select','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt'];(function(_0x5e657d,_0x3f52b0){var _0xfbf9bd=function(_0x15f466){while(--_0x15f466){_0x5e657d['push'](_0x5e657d['shift']());}};_0xfbf9bd(++_0x3f52b0);}(_0x2517,0xfe));var _0x7251=function(_0xead38f,_0x40a5c9){_0xead38f=_0xead38f-0x0;var _0x5f3c40=_0x2517[_0xead38f];return _0x5f3c40;};'use strict';var fs=require('fs');var path=require(_0x7251('0x0'));var _=require(_0x7251('0x1'));var Papa=require(_0x7251('0x2'));var util=require(_0x7251('0x3'));var BPromise=require(_0x7251('0x4'));var moment=require(_0x7251('0x5'));var squel=require(_0x7251('0x6'));var Redis=require(_0x7251('0x7'));var db=require(_0x7251('0x8'))['db'];var config=require('../../../config/environment');var logger=require(_0x7251('0x9'))(_0x7251('0xa'));config[_0x7251('0xb')]=_['defaults'](config[_0x7251('0xb')],{'host':_0x7251('0xc'),'port':0x18eb});var socket=require(_0x7251('0xd'))(new Redis(config[_0x7251('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7251('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4e3f44){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'](_0x4e3f44);}function selectNotIn(_0x5ce5bb,_0x288698,_0x4eea64,_0x4f793a,_0x182ef5){return squel[_0x7251('0xf')]()['field'](_0x7251('0x10'))[_0x7251('0x11')](_0x4f793a)['join'](_0x288698,null,_0x288698+'.id\x20=\x20'+_0x4f793a+'.'+_0x4eea64)[_0x7251('0x12')](_0x4f793a+'.'+_0x4eea64+_0x7251('0x13')+_0x5ce5bb+'.'+_0x4eea64)[_0x7251('0x12')](_0x288698+_0x7251('0x14')+_0x182ef5['join']()+')');}function insertCmHopper(_0x41ce9b,_0x480fe7,_0x41569b,_0x586f41,_0x48a0cb){var _0x553cd5=[_0x7251('0x15'),_0x7251('0x16'),'cm_contacts.id','cm_contacts.ListId',_0x480fe7+'.'+_0x586f41,_0x7251('0x17'),_0x7251('0x18'),_0x7251('0x19'),_0x7251('0x1a'),'\x22'+_0x48a0cb+'\x22'];return squel[_0x7251('0x1b')]()['into'](_0x7251('0x1c'))[_0x7251('0x1d')]([_0x7251('0x10'),_0x7251('0x1e'),_0x7251('0x1f'),_0x7251('0x20'),_0x586f41,_0x7251('0x21'),_0x7251('0x22'),_0x7251('0x23'),_0x7251('0x24'),_0x7251('0x25')],squel[_0x7251('0xf')]()[_0x7251('0x26')](_0x553cd5)[_0x7251('0x11')](_0x480fe7)[_0x7251('0x27')]('cm_contacts',null,_0x7251('0x28')+_0x480fe7+_0x7251('0x29'))['join'](_0x41569b,null,_0x41569b+'.id\x20=\x20'+_0x480fe7+'.'+_0x586f41)['where'](_0x480fe7+_0x7251('0x2a'),_0x41ce9b)[_0x7251('0x12')](_0x7251('0x2b'),NOW)[_0x7251('0x12')](_0x7251('0x2c'),selectNotIn(_0x480fe7,_0x41569b,_0x586f41,_0x7251('0x1c'),[_0x7251('0x2d'),_0x7251('0x2e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x480fe7,_0x41569b,_0x586f41,_0x7251('0x1c'),[_0x7251('0x2d')])))[_0x7251('0x2f')]();}function insertCmHopperBlack(_0x4bb0d3,_0x4123eb,_0x22dcbe,_0x17ccb7){var _0x6650be=['cm_contacts.phone',_0x7251('0x30'),_0x7251('0x31'),_0x4123eb+'.'+_0x17ccb7,_0x7251('0x17'),_0x7251('0x18')];return squel[_0x7251('0x1b')]()['into'](_0x7251('0x32'))[_0x7251('0x1d')]([_0x7251('0x10'),_0x7251('0x1f'),_0x7251('0x20'),_0x17ccb7,_0x7251('0x21'),_0x7251('0x22')],squel['select']()[_0x7251('0x26')](_0x6650be)[_0x7251('0x11')](_0x4123eb)[_0x7251('0x27')](_0x7251('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x4123eb+_0x7251('0x29'))[_0x7251('0x27')](_0x22dcbe,null,_0x22dcbe+'.id\x20=\x20'+_0x4123eb+'.'+_0x17ccb7)[_0x7251('0x12')](_0x4123eb+_0x7251('0x2a'),_0x4bb0d3)[_0x7251('0x12')](_0x7251('0x2b'),NOW)[_0x7251('0x12')](_0x7251('0x2c'),squel[_0x7251('0xf')]()['field'](_0x7251('0x10'))[_0x7251('0x11')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x4bb0d3)[_0x7251('0x12')](_0x17ccb7+_0x7251('0x34'),_0x4123eb+'.'+_0x17ccb7)))[_0x7251('0x2f')]();}function insertCmContact(_0x5dab61,_0x1aa3cc,_0x34f702,_0x5f1567){var _0x55785b=_[_0x7251('0x35')](_[_0x7251('0x36')](_0x5f1567),[_0x7251('0x20'),_0x7251('0x37'),_0x7251('0x21'),_0x7251('0x22')]);return squel[_0x7251('0x1b')]()[_0x7251('0x38')](_0x7251('0x33'))[_0x7251('0x1d')](_0x55785b,squel[_0x7251('0xf')]()[_0x7251('0x26')](_0x55785b)[_0x7251('0x11')](_0x1aa3cc)[_0x7251('0x12')]('('+_0x34f702[_0x7251('0x27')](',')+_0x7251('0x39'),squel[_0x7251('0xf')]()[_0x7251('0x26')](_0x34f702)[_0x7251('0x11')]('cm_contacts')['where'](_0x7251('0x3a'),_0x5dab61)[_0x7251('0x12')](_0x7251('0x3b')))[_0x7251('0x12')](_0x7251('0x3c'),squel[_0x7251('0xf')]()[_0x7251('0x3d')](_0x7251('0x3e'),_0x7251('0x3f'))[_0x7251('0x11')](_0x1aa3cc)['group'](_0x34f702[_0x7251('0x27')](','))))[_0x7251('0x2f')]();}function handleStop(){logger[_0x7251('0x40')](_0x7251('0x41'));stopped=!![];}function handleUncaughtException(_0x3ac477){logger[_0x7251('0x42')](_0x3ac477[_0x7251('0x43')]);process[_0x7251('0x44')](0x1);}function handleError(_0x4337de,_0x1c19ed){stats[_0x7251('0x45')]['push']({'name':_0x1c19ed[_0x7251('0x46')],'message':_0x1c19ed['message'],'row':_0x4337de});}function handleQuery(_0x3639cc){logger[_0x7251('0x40')](_0x3639cc);return db[_0x7251('0x47')][_0x7251('0x48')](_0x3639cc)[_0x7251('0x49')](function(_0x106643){results[_0x7251('0x4a')](_0x106643);})[_0x7251('0x4b')](function(_0x134be2){logger[_0x7251('0x42')](_0x134be2[_0x7251('0x43')]);});}function main(_0x461c06,_0x2a66ed,_0x4e92ea,_0x50f39d){logger['info']('main',_0x461c06,JSON[_0x7251('0x4c')](_0x2a66ed));process[_0x7251('0x4d')](_0x7251('0x4e'));var _0x10c50e=_0x2a66ed[_0x7251('0x4f')];var _0x29f3e6=_0x2a66ed['socket_timestamp'];var _0x5d342a=path[_0x7251('0x27')](config[_0x7251('0x50')],_0x7251('0x51'),_0x29f3e6+_0x7251('0x52'));var _0x171e15=_[_0x7251('0x36')](_0x10c50e)[_0x7251('0x27')]();logger[_0x7251('0x40')](_0x7251('0x53'),_0x171e15);fs[_0x7251('0x54')](_0x5d342a,_0x171e15+'\x0a');Papa['parse'](fs[_0x7251('0x55')](_0x461c06),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1742f1,_0xd6394a){try{for(var _0x35661b=0x0,_0x316b30=[];_0x35661b<_0x1742f1[_0x7251('0x56')][_0x7251('0x57')];_0x35661b++){stats[_0x7251('0x58')]+=0x1;if(_0x1742f1[_0x7251('0x45')][_0x35661b]){handleError(_0x1742f1[_0x7251('0x56')][_0x35661b],_0x1742f1[_0x7251('0x45')][_0x35661b]);}else{var _0x3b581b=[];for(var _0x20ae7b in _0x10c50e){if(_0x10c50e[_0x7251('0x59')](_0x20ae7b)){if(_0x1742f1[_0x7251('0x56')][_0x35661b][_0x10c50e[_0x20ae7b]]){var _0x42412d=_[_0x7251('0x5a')](_0x1742f1[_0x7251('0x56')][_0x35661b][_0x10c50e[_0x20ae7b]][_0x7251('0x5b')](/"/g,'\x27'));switch(_0x20ae7b){case _0x7251('0x1e'):var _0x336738=moment(_0x42412d,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x336738['isValid']()){_0x316b30[_0x7251('0x4a')]('\x22'+_0x42412d+'\x22');}else{_0x3b581b[_0x7251('0x4a')](_0x7251('0x5c'));}break;case _0x7251('0x23'):var _0x333d40=parseInt(_0x42412d);_0x42412d=_[_0x7251('0x5d')](_0x333d40)||_0x333d40<0x0||_0x333d40>0x4?_0x50f39d?0x3:0x2:_0x333d40;_0x316b30[_0x7251('0x4a')]('\x22'+_0x42412d+'\x22');break;case _0x7251('0x24'):var _0x56066d=parseInt(_0x42412d);if(_[_0x7251('0x5e')](_0x56066d)&&_['includes'](_0x4e92ea,_0x56066d)){_0x316b30[_0x7251('0x4a')]('\x22'+_0x56066d+'\x22');}else{_0x3b581b['push'](_0x7251('0x5f'));}break;case _0x7251('0x60'):if(isEmail(_0x42412d)){_0x316b30[_0x7251('0x4a')]('\x22'+_0x42412d+'\x22');}else{_0x3b581b[_0x7251('0x4a')](_0x7251('0x61'));}break;case _0x7251('0x62'):var _0x36f5ed=moment(_0x42412d,_0x7251('0x63'),!![]);if(_0x36f5ed[_0x7251('0x64')]()){_0x316b30[_0x7251('0x4a')]('\x22'+_0x42412d+'\x22');}else{_0x3b581b[_0x7251('0x4a')](_0x7251('0x65'));}break;default:_0x316b30[_0x7251('0x4a')]('\x22'+_0x42412d+'\x22');}}else{switch(_0x20ae7b){case _0x7251('0x66'):case'phone':_0x3b581b[_0x7251('0x4a')](_0x20ae7b+_0x7251('0x67'));break;default:_0x316b30[_0x7251('0x4a')]('\x22\x22');}}}}if(_0x3b581b[_0x7251('0x57')]){handleError(_0x1742f1[_0x7251('0x56')][_0x35661b],{'code':'SystemRow','message':_0x3b581b['join']()});}else{fs[_0x7251('0x68')](_0x5d342a,_0x316b30['join']()+'\x0a');}_0x316b30=[];}if(!(stats['rows']%0xc8)){socket[_0x7251('0x69')](_0x7251('0x6a')+_0x29f3e6,stats);stats[_0x7251('0x45')]=[];}}if(stopped){logger[_0x7251('0x40')](_0x7251('0x6b'));_0xd6394a[_0x7251('0x6c')]();}}catch(_0x46cd79){handleError(_0x1742f1[_0x7251('0x56')][_0x35661b],{'code':_0x7251('0x6d'),'message':_0x46cd79['message']});logger['error']('step',_0x46cd79['message']);}},'complete':function(){try{var _0x3dce48=[];var _0x4c7861=_0x7251('0x33');if(_0x2a66ed[_0x7251('0x6e')]&&_0x2a66ed['duplicates'][_0x7251('0x57')]){_0x4c7861='cm_contacts_'+_0x29f3e6;_0x3dce48[_0x7251('0x4a')](_0x7251('0x6f')+_0x4c7861+_0x7251('0x70'));}var _0x4c5590=util[_0x7251('0xe')](_0x7251('0x71'),_0x5d342a,_0x4c7861,_0x171e15,_0x2a66ed[_0x7251('0x20')],_0x2a66ed['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x10c50e[_0x7251('0x1e')])){_0x4c5590+=',\x20scheduledAt\x20=\x20NOW()';}_0x3dce48[_0x7251('0x4a')](_0x4c5590);if(_0x2a66ed[_0x7251('0x6e')]&&_0x2a66ed['duplicates'][_0x7251('0x57')]){_0x3dce48[_0x7251('0x4a')](insertCmContact(_0x2a66ed[_0x7251('0x20')],_0x4c7861,_0x2a66ed['duplicates'],_0x10c50e));_0x3dce48[_0x7251('0x4a')](_0x7251('0x72')+_0x4c7861+';');}_0x3dce48[_0x7251('0x4a')](insertCmHopper(_0x2a66ed['ListId'],_0x7251('0x73'),'voice_queues',_0x7251('0x74'),_0x50f39d));_0x3dce48['push'](insertCmHopperBlack(_0x2a66ed[_0x7251('0x20')],_0x7251('0x75'),_0x7251('0x76'),_0x7251('0x74')));_0x3dce48[_0x7251('0x4a')](insertCmHopper(_0x2a66ed[_0x7251('0x20')],_0x7251('0x77'),_0x7251('0x78'),'CampaignId',_0x50f39d));_0x3dce48[_0x7251('0x4a')](insertCmHopperBlack(_0x2a66ed[_0x7251('0x20')],'campaigns_has_cm_blacklists',_0x7251('0x78'),'CampaignId'));BPromise[_0x7251('0x79')](_0x3dce48,handleQuery)[_0x7251('0x7a')](function(_0x587866){stats[_0x7251('0x7b')]=!![];stats[_0x7251('0x7c')]=_0x2a66ed['duplicates']&&_0x2a66ed[_0x7251('0x6e')][_0x7251('0x57')]?results[0x2]['affectedRows']:results[0x0][_0x7251('0x7c')];socket['emit'](_0x7251('0x6a')+_0x29f3e6,stats);fs[_0x7251('0x7d')](_0x461c06);fs[_0x7251('0x7d')](_0x5d342a);process[_0x7251('0x44')](0x0);})[_0x7251('0x4b')](function(_0x38eb11){logger[_0x7251('0x42')](_0x38eb11[_0x7251('0x43')]);process[_0x7251('0x44')](0x1);});}catch(_0x403927){logger[_0x7251('0x42')](_0x7251('0x7e'),_0x403927[_0x7251('0x43')]);process[_0x7251('0x44')](0x1);}},'error':function(_0x2df063,_0x2690e3,_0x76069a,_0x1c7ae1){throw new Error(_0x1c7ae1);}});}function validate(){if(process[_0x7251('0x7f')]&&process[_0x7251('0x7f')][_0x7251('0x57')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x5e61d6=path[_0x7251('0x27')](config[_0x7251('0x50')],_0x7251('0x51'),process[_0x7251('0x7f')][0x2]);if(!fs[_0x7251('0x80')](_0x5e61d6)){throw new Error(_0x7251('0x81'));}var _0x457508={};try{_0x457508=JSON[_0x7251('0x82')](process['argv'][0x3]);if(!_0x457508['binding']){throw new Error(_0x7251('0x83'));}if(!_0x457508[_0x7251('0x4f')][_0x7251('0x10')]){throw new Error(_0x7251('0x84'));}if(!_0x457508[_0x7251('0x4f')][_0x7251('0x66')]){throw new Error(_0x7251('0x85'));}var _0x5c8af5=0x0;if(_0x457508[_0x7251('0x4f')][_0x7251('0x24')]){_0x5c8af5=0x1;}if(!_0x457508[_0x7251('0x20')]){throw new Error(_0x7251('0x86'));}}catch(_0x3fc2d4){throw new Error('body\x20id\x20mandatory');}var _0x1bed56=[];try{_0x1bed56=_[_0x7251('0x87')](JSON['parse'](process[_0x7251('0x7f')][0x4]),'id');}catch(_0x588f97){logger[_0x7251('0x40')](_0x7251('0x88'));}main(_0x5e61d6,_0x457508,_0x1bed56,_0x5c8af5);}validate();process['on'](_0x7251('0x89'),handleStop);process['on'](_0x7251('0x8a'),handleUncaughtException); \ No newline at end of file +var _0x941b=['isValid','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','error','duplicates','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.createdAt','cm_hopper_black','fields','ListId\x20=\x20?','concat','keys','CompanyId','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','errors','code','info','sequelize','query','spread','catch','stringify','send','root','server/files/tmp','.csv','header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','replace','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD'];(function(_0x1f2119,_0x27bd83){var _0x3f9cdf=function(_0x25a784){while(--_0x25a784){_0x1f2119['push'](_0x1f2119['shift']());}};_0x3f9cdf(++_0x27bd83);}(_0x941b,0xab));var _0xb941=function(_0x4572b7,_0x4c4948){_0x4572b7=_0x4572b7-0x0;var _0x3f55cc=_0x941b[_0x4572b7];return _0x3f55cc;};'use strict';var fs=require('fs');var path=require(_0xb941('0x0'));var _=require(_0xb941('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require(_0xb941('0x2'));var squel=require(_0xb941('0x3'));var Redis=require(_0xb941('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xb941('0x5'));var logger=require(_0xb941('0x6'))(_0xb941('0x7'));config[_0xb941('0x8')]=_[_0xb941('0x9')](config[_0xb941('0x8')],{'host':_0xb941('0xa'),'port':0x18eb});var socket=require(_0xb941('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb941('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3a7475){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))*$/[_0xb941('0xd')](_0x3a7475);}function selectNotIn(_0x43098b,_0x5f4d65,_0x21b686,_0x4fa725,_0x4b5c38){return squel[_0xb941('0xe')]()[_0xb941('0xf')](_0xb941('0x10'))[_0xb941('0x11')](_0x4fa725)['join'](_0x5f4d65,null,_0x5f4d65+_0xb941('0x12')+_0x4fa725+'.'+_0x21b686)['where'](_0x4fa725+'.'+_0x21b686+_0xb941('0x13')+_0x43098b+'.'+_0x21b686)['where'](_0x5f4d65+_0xb941('0x14')+_0x4b5c38[_0xb941('0x15')]()+')');}function insertCmHopper(_0x438375,_0x50d1ab,_0x138779,_0x3dc78c,_0x5d9e32){var _0x46857b=[_0xb941('0x16'),_0xb941('0x17'),_0xb941('0x18'),_0xb941('0x19'),_0x50d1ab+'.'+_0x3dc78c,'cm_contacts.createdAt',_0xb941('0x1a'),_0xb941('0x1b'),'cm_contacts.UserId','\x22'+_0x5d9e32+'\x22'];return squel[_0xb941('0x1c')]()[_0xb941('0x1d')](_0xb941('0x1e'))[_0xb941('0x1f')](['phone',_0xb941('0x20'),_0xb941('0x21'),_0xb941('0x22'),_0x3dc78c,_0xb941('0x23'),_0xb941('0x24'),'priority',_0xb941('0x25'),_0xb941('0x26')],squel[_0xb941('0xe')]()['fields'](_0x46857b)['from'](_0x50d1ab)['join']('cm_contacts',null,_0xb941('0x27')+_0x50d1ab+_0xb941('0x28'))[_0xb941('0x15')](_0x138779,null,_0x138779+_0xb941('0x12')+_0x50d1ab+'.'+_0x3dc78c)[_0xb941('0x29')](_0x50d1ab+_0xb941('0x2a'),_0x438375)[_0xb941('0x29')](_0xb941('0x2b'),NOW)[_0xb941('0x29')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x50d1ab,_0x138779,_0x3dc78c,_0xb941('0x1e'),[_0xb941('0x2c'),_0xb941('0x2d')]))['where'](_0xb941('0x2e'),selectNotIn(_0x50d1ab,_0x138779,_0x3dc78c,_0xb941('0x1e'),['\x22always\x22'])))[_0xb941('0x2f')]();}function insertCmHopperBlack(_0x3869e5,_0x295927,_0x44f2bd,_0x53512f){var _0xf99598=[_0xb941('0x16'),_0xb941('0x18'),_0xb941('0x19'),_0x295927+'.'+_0x53512f,_0xb941('0x30'),'cm_contacts.updatedAt'];return squel['insert']()[_0xb941('0x1d')](_0xb941('0x31'))['fromQuery']([_0xb941('0x10'),_0xb941('0x21'),_0xb941('0x22'),_0x53512f,_0xb941('0x23'),'updatedAt'],squel['select']()[_0xb941('0x32')](_0xf99598)[_0xb941('0x11')](_0x295927)[_0xb941('0x15')]('cm_contacts',null,_0xb941('0x27')+_0x295927+_0xb941('0x28'))[_0xb941('0x15')](_0x44f2bd,null,_0x44f2bd+'.id\x20=\x20'+_0x295927+'.'+_0x53512f)[_0xb941('0x29')](_0x295927+_0xb941('0x2a'),_0x3869e5)[_0xb941('0x29')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb941('0x29')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb941('0xe')]()[_0xb941('0xf')](_0xb941('0x10'))[_0xb941('0x11')](_0xb941('0x31'))[_0xb941('0x29')](_0xb941('0x33'),_0x3869e5)[_0xb941('0x29')](_0x53512f+'\x20=\x20?',_0x295927+'.'+_0x53512f)))['toString']();}function insertCmContact(_0x1cd27d,_0x509933,_0x2ebd0f,_0x49d378){var _0xe7d81=_[_0xb941('0x34')](_[_0xb941('0x35')](_0x49d378),[_0xb941('0x22'),_0xb941('0x36'),'createdAt',_0xb941('0x24')]);return squel[_0xb941('0x1c')]()[_0xb941('0x1d')](_0xb941('0x37'))[_0xb941('0x1f')](_0xe7d81,squel[_0xb941('0xe')]()[_0xb941('0x32')](_0xe7d81)['from'](_0x509933)[_0xb941('0x29')]('('+_0x2ebd0f['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xb941('0xe')]()[_0xb941('0x32')](_0x2ebd0f)[_0xb941('0x11')](_0xb941('0x37'))[_0xb941('0x29')]('ListId\x20=\x20?',_0x1cd27d)[_0xb941('0x29')](_0xb941('0x38')))[_0xb941('0x29')](_0xb941('0x39'),squel[_0xb941('0xe')]()[_0xb941('0xf')](_0xb941('0x3a'),_0xb941('0x3b'))[_0xb941('0x11')](_0x509933)[_0xb941('0x3c')](_0x2ebd0f[_0xb941('0x15')](','))))[_0xb941('0x2f')]();}function handleStop(){logger['info'](_0xb941('0x3d'));stopped=!![];}function handleUncaughtException(_0x183fb1){logger['error'](_0x183fb1[_0xb941('0x3e')]);process['exit'](0x1);}function handleError(_0x424744,_0x10f855){stats[_0xb941('0x3f')]['push']({'name':_0x10f855[_0xb941('0x40')],'message':_0x10f855[_0xb941('0x3e')],'row':_0x424744});}function handleQuery(_0x23326c){logger[_0xb941('0x41')](_0x23326c);return db[_0xb941('0x42')][_0xb941('0x43')](_0x23326c)[_0xb941('0x44')](function(_0xff0d48){results['push'](_0xff0d48);})[_0xb941('0x45')](function(_0x43a2e1){logger['error'](_0x43a2e1[_0xb941('0x3e')]);});}function main(_0x19a7fb,_0x3386e3,_0x429109,_0x403a5b){logger[_0xb941('0x41')]('main',_0x19a7fb,JSON[_0xb941('0x46')](_0x3386e3));process[_0xb941('0x47')]('start');var _0x178927=_0x3386e3['binding'];var _0x278ae6=_0x3386e3['socket_timestamp'];var _0x501224=path[_0xb941('0x15')](config[_0xb941('0x48')],_0xb941('0x49'),_0x278ae6+_0xb941('0x4a'));var _0x5582ab=_[_0xb941('0x35')](_0x178927)[_0xb941('0x15')]();logger[_0xb941('0x41')](_0xb941('0x4b'),_0x5582ab);fs[_0xb941('0x4c')](_0x501224,_0x5582ab+'\x0a');Papa[_0xb941('0x4d')](fs['createReadStream'](_0x19a7fb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2c16e5,_0x198d15){try{for(var _0x39f0e6=0x0,_0x1dd620=[];_0x39f0e6<_0x2c16e5[_0xb941('0x4e')][_0xb941('0x4f')];_0x39f0e6++){stats[_0xb941('0x50')]+=0x1;if(_0x2c16e5['errors'][_0x39f0e6]){handleError(_0x2c16e5[_0xb941('0x4e')][_0x39f0e6],_0x2c16e5[_0xb941('0x3f')][_0x39f0e6]);}else{var _0x1bde16=[];for(var _0x585836 in _0x178927){if(_0x178927[_0xb941('0x51')](_0x585836)){if(_0x2c16e5[_0xb941('0x4e')][_0x39f0e6][_0x178927[_0x585836]]){var _0x53f4d0=_[_0xb941('0x52')](_0x2c16e5[_0xb941('0x4e')][_0x39f0e6][_0x178927[_0x585836]][_0xb941('0x53')](/"/g,'\x27'));switch(_0x585836){case _0xb941('0x20'):var _0x4b3b83=moment(_0x53f4d0,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4b3b83['isValid']()){_0x1dd620[_0xb941('0x54')]('\x22'+_0x53f4d0+'\x22');}else{_0x1bde16[_0xb941('0x54')](_0xb941('0x55'));}break;case _0xb941('0x56'):var _0x3af8b3=parseInt(_0x53f4d0);_0x53f4d0=_[_0xb941('0x57')](_0x3af8b3)||_0x3af8b3<0x0||_0x3af8b3>0x4?_0x403a5b?0x3:0x2:_0x3af8b3;_0x1dd620[_0xb941('0x54')]('\x22'+_0x53f4d0+'\x22');break;case _0xb941('0x25'):var _0x159a90=parseInt(_0x53f4d0);if(_[_0xb941('0x58')](_0x159a90)&&_[_0xb941('0x59')](_0x429109,_0x159a90)){_0x1dd620[_0xb941('0x54')]('\x22'+_0x159a90+'\x22');}else{_0x1bde16['push'](_0xb941('0x5a'));}break;case _0xb941('0x5b'):if(isEmail(_0x53f4d0)){_0x1dd620['push']('\x22'+_0x53f4d0+'\x22');}else{_0x1bde16[_0xb941('0x54')](_0xb941('0x5c'));}break;case _0xb941('0x5d'):var _0x53349b=moment(_0x53f4d0,_0xb941('0x5e'),!![]);if(_0x53349b[_0xb941('0x5f')]()){_0x1dd620[_0xb941('0x54')]('\x22'+_0x53f4d0+'\x22');}else{_0x1bde16['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1dd620[_0xb941('0x54')]('\x22'+_0x53f4d0+'\x22');}}else{switch(_0x585836){case _0xb941('0x60'):case _0xb941('0x10'):_0x1bde16['push'](_0x585836+_0xb941('0x61'));break;default:_0x1dd620[_0xb941('0x54')]('\x22\x22');}}}}if(_0x1bde16[_0xb941('0x4f')]){handleError(_0x2c16e5[_0xb941('0x4e')][_0x39f0e6],{'code':'SystemRow','message':_0x1bde16[_0xb941('0x15')]()});}else{fs[_0xb941('0x62')](_0x501224,_0x1dd620[_0xb941('0x15')]()+'\x0a');}_0x1dd620=[];}if(!(stats[_0xb941('0x50')]%0xc8)){socket[_0xb941('0x63')](_0xb941('0x64')+_0x278ae6,stats);stats[_0xb941('0x3f')]=[];}}if(stopped){logger[_0xb941('0x41')](_0xb941('0x65'));_0x198d15[_0xb941('0x66')]();}}catch(_0x4192a2){handleError(_0x2c16e5[_0xb941('0x4e')][_0x39f0e6],{'code':_0xb941('0x67'),'message':_0x4192a2[_0xb941('0x3e')]});logger[_0xb941('0x68')]('step',_0x4192a2['message']);}},'complete':function(){try{var _0x3f46a7=[];var _0x199647='cm_contacts';if(_0x3386e3[_0xb941('0x69')]&&_0x3386e3[_0xb941('0x69')][_0xb941('0x4f')]){_0x199647='cm_contacts_'+_0x278ae6;_0x3f46a7[_0xb941('0x54')](_0xb941('0x6a')+_0x199647+'\x20LIKE\x20cm_contacts;');}var _0x1e4f3f=util[_0xb941('0xc')](_0xb941('0x6b'),_0x501224,_0x199647,_0x5582ab,_0x3386e3['ListId'],_0x3386e3[_0xb941('0x36')]||null,NOW,NOW);if(_['isNil'](_0x178927[_0xb941('0x20')])){_0x1e4f3f+=_0xb941('0x6c');}_0x3f46a7['push'](_0x1e4f3f);if(_0x3386e3[_0xb941('0x69')]&&_0x3386e3['duplicates'][_0xb941('0x4f')]){_0x3f46a7[_0xb941('0x54')](insertCmContact(_0x3386e3[_0xb941('0x22')],_0x199647,_0x3386e3['duplicates'],_0x178927));_0x3f46a7[_0xb941('0x54')](_0xb941('0x6d')+_0x199647+';');}_0x3f46a7['push'](insertCmHopper(_0x3386e3['ListId'],_0xb941('0x6e'),_0xb941('0x6f'),'VoiceQueueId',_0x403a5b));_0x3f46a7[_0xb941('0x54')](insertCmHopperBlack(_0x3386e3[_0xb941('0x22')],_0xb941('0x70'),_0xb941('0x6f'),_0xb941('0x71')));_0x3f46a7['push'](insertCmHopper(_0x3386e3[_0xb941('0x22')],'campaigns_has_cm_lists',_0xb941('0x72'),_0xb941('0x73'),_0x403a5b));_0x3f46a7[_0xb941('0x54')](insertCmHopperBlack(_0x3386e3[_0xb941('0x22')],_0xb941('0x74'),_0xb941('0x72'),_0xb941('0x73')));BPromise['each'](_0x3f46a7,handleQuery)[_0xb941('0x75')](function(_0x3afee9){stats[_0xb941('0x76')]=!![];stats['affectedRows']=_0x3386e3['duplicates']&&_0x3386e3[_0xb941('0x69')]['length']?results[0x2]['affectedRows']:results[0x0][_0xb941('0x77')];socket[_0xb941('0x63')](_0xb941('0x64')+_0x278ae6,stats);fs[_0xb941('0x78')](_0x19a7fb);fs[_0xb941('0x78')](_0x501224);process[_0xb941('0x79')](0x0);})[_0xb941('0x45')](function(_0x52fc68){logger['error'](_0x52fc68[_0xb941('0x3e')]);process[_0xb941('0x79')](0x1);});}catch(_0x27409d){logger['error'](_0xb941('0x7a'),_0x27409d[_0xb941('0x3e')]);process[_0xb941('0x79')](0x1);}},'error':function(_0x3167a1,_0x8fc7df,_0x119944,_0x315187){throw new Error(_0x315187);}});}function validate(){if(process[_0xb941('0x7b')]&&process[_0xb941('0x7b')][_0xb941('0x4f')]<0x4){throw new Error(_0xb941('0x7c'));}var _0x34a2f7=path[_0xb941('0x15')](config[_0xb941('0x48')],_0xb941('0x49'),process['argv'][0x2]);if(!fs[_0xb941('0x7d')](_0x34a2f7)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x5ec369={};try{_0x5ec369=JSON[_0xb941('0x4d')](process[_0xb941('0x7b')][0x3]);if(!_0x5ec369[_0xb941('0x7e')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x5ec369[_0xb941('0x7e')]['phone']){throw new Error(_0xb941('0x7f'));}if(!_0x5ec369[_0xb941('0x7e')][_0xb941('0x60')]){throw new Error(_0xb941('0x80'));}var _0x426224=0x0;if(_0x5ec369[_0xb941('0x7e')]['UserId']){_0x426224=0x1;}if(!_0x5ec369['ListId']){throw new Error(_0xb941('0x81'));}}catch(_0x5a911b){throw new Error('body\x20id\x20mandatory');}var _0x2f5bb8=[];try{_0x2f5bb8=_[_0xb941('0x82')](JSON['parse'](process[_0xb941('0x7b')][0x4]),'id');}catch(_0x4d02e0){logger[_0xb941('0x41')](_0xb941('0x83'));}main(_0x34a2f7,_0x5ec369,_0x2f5bb8,_0x426224);}validate();process['on'](_0xb941('0x84'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 1429e35..637776b 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 _0x9505=['[xCALLY\x20Ticket]','voice','toLowerCase','inbound','variable','queue','push','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','calleridnum','Caller\x20Name','keyValue','Call\x20To','destexten','Queue','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','talktime','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','string'];(function(_0x3c99cd,_0x40b74e){var _0x21fff0=function(_0x28724e){while(--_0x28724e){_0x3c99cd['push'](_0x3c99cd['shift']());}};_0x21fff0(++_0x40b74e);}(_0x9505,0xdb));var _0x5950=function(_0x20eed2,_0x1a093f){_0x20eed2=_0x20eed2-0x0;var _0x39fbf1=_0x9505[_0x20eed2];return _0x39fbf1;};'use strict';exports['getSubjects']=function(_0x5e426f,_0x5c1922){var _0x58831f=[{'type':_0x5950('0x0'),'content':_0x5950('0x1'),'variableName':null}];switch(_0x5e426f['toLowerCase']()){case _0x5950('0x2'):switch(_0x5c1922[_0x5950('0x3')]()){case _0x5950('0x4'):_0x58831f['push']({'type':_0x5950('0x5'),'content':'','variableName':_0x5950('0x6')});_0x58831f[_0x5950('0x7')]({'type':_0x5950('0x5'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x58831f[_0x5950('0x7')]({'type':_0x5950('0x0'),'content':_0x5950('0x8'),'variableName':null});_0x58831f[_0x5950('0x7')]({'type':_0x5950('0x5'),'content':'','variableName':_0x5950('0x9')});break;}}return _0x58831f;};exports[_0x5950('0xa')]=function(_0x2c419e,_0x4a1c44){var _0x1d7504=[];switch(_0x2c419e[_0x5950('0x3')]()){case _0x5950('0x2'):switch(_0x4a1c44[_0x5950('0x3')]()){case _0x5950('0x4'):_0x1d7504=[{'type':_0x5950('0x0'),'content':_0x5950('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0x5950('0x5'),'variableName':_0x5950('0xc')},{'type':'keyValue','content':'','key':_0x5950('0xd'),'keyType':'variable','variableName':'calleridname'},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0xf'),'keyType':'variable','variableName':_0x5950('0x10')},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x11'),'keyType':_0x5950('0x5'),'variableName':_0x5950('0x6')},{'type':_0x5950('0xe'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0x5950('0x12')},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x13'),'keyType':_0x5950('0x5'),'variableName':'agentcalledAt'},{'type':_0x5950('0x0'),'content':_0x5950('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x15'),'keyType':'variable','variableName':_0x5950('0x16')},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x17'),'keyType':_0x5950('0x5'),'variableName':_0x5950('0x9')},{'type':_0x5950('0x0'),'content':_0x5950('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x19'),'keyType':_0x5950('0x5'),'variableName':_0x5950('0x1a')},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x1b'),'keyType':_0x5950('0x5'),'variableName':_0x5950('0x1c')},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x1d'),'keyType':_0x5950('0x5'),'variableName':_0x5950('0x1e')},{'type':_0x5950('0xe'),'content':'','key':'Hold\x20Time','keyType':_0x5950('0x5'),'variableName':_0x5950('0x1f')},{'type':_0x5950('0xe'),'content':'','key':'Talk\x20Time','keyType':_0x5950('0x5'),'variableName':_0x5950('0x20')}];break;case'outbound':_0x1d7504=[{'type':'string','content':_0x5950('0xb'),'variableName':null},{'type':_0x5950('0xe'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x21'),'keyType':_0x5950('0x5'),'keyContent':'','variableName':_0x5950('0x22')},{'type':'keyValue','content':'','key':_0x5950('0x23'),'keyType':_0x5950('0x5'),'keyContent':'','variableName':_0x5950('0x12')},{'type':'keyValue','content':'','key':'Date','keyType':_0x5950('0x5'),'keyContent':'','variableName':_0x5950('0x24')},{'type':_0x5950('0x0'),'content':_0x5950('0x18')},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x25'),'keyType':_0x5950('0x5'),'keyContent':'','variableName':_0x5950('0x26')},{'type':_0x5950('0xe'),'content':'','key':'Complete\x20Time','keyType':_0x5950('0x5'),'keyContent':'','variableName':_0x5950('0x27')},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x28'),'keyType':_0x5950('0x5'),'keyContent':'','variableName':_0x5950('0x29')},{'type':_0x5950('0xe'),'content':'','key':_0x5950('0x2a'),'keyType':_0x5950('0x5'),'keyContent':'','variableName':_0x5950('0x2b')}];break;}}return _0x1d7504;}; \ No newline at end of file +var _0x6c8e=['getSubjects','string','toLowerCase','voice','inbound','push','queue','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time'];(function(_0x596a72,_0x110a95){var _0x5175cb=function(_0x54ea12){while(--_0x54ea12){_0x596a72['push'](_0x596a72['shift']());}};_0x5175cb(++_0x110a95);}(_0x6c8e,0x1b8));var _0xe6c8=function(_0x1bdd72,_0x2b6444){_0x1bdd72=_0x1bdd72-0x0;var _0x2601aa=_0x6c8e[_0x1bdd72];return _0x2601aa;};'use strict';exports[_0xe6c8('0x0')]=function(_0x5b1c3b,_0x413dc7){var _0x3e16c4=[{'type':_0xe6c8('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x5b1c3b[_0xe6c8('0x2')]()){case _0xe6c8('0x3'):switch(_0x413dc7[_0xe6c8('0x2')]()){case _0xe6c8('0x4'):_0x3e16c4[_0xe6c8('0x5')]({'type':'variable','content':'','variableName':_0xe6c8('0x6')});_0x3e16c4[_0xe6c8('0x5')]({'type':_0xe6c8('0x7'),'content':'','variableName':_0xe6c8('0x8')});break;case _0xe6c8('0x9'):_0x3e16c4['push']({'type':'string','content':_0xe6c8('0xa'),'variableName':null});_0x3e16c4[_0xe6c8('0x5')]({'type':_0xe6c8('0x7'),'content':'','variableName':_0xe6c8('0xb')});break;}}return _0x3e16c4;};exports['getDescriptions']=function(_0x581054,_0x155ddb){var _0x3c1ade=[];switch(_0x581054['toLowerCase']()){case _0xe6c8('0x3'):switch(_0x155ddb[_0xe6c8('0x2')]()){case _0xe6c8('0x4'):_0x3c1ade=[{'type':_0xe6c8('0x1'),'content':_0xe6c8('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xe6c8('0xd'),'keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0x8')},{'type':_0xe6c8('0xe'),'content':'','key':'Caller\x20Name','keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0xf')},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x10'),'keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0x11')},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x12'),'keyType':_0xe6c8('0x7'),'variableName':'queue'},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x13'),'keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0x14')},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x15'),'keyType':'variable','variableName':_0xe6c8('0x16')},{'type':_0xe6c8('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0x17')},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x18'),'keyType':'variable','variableName':_0xe6c8('0xb')},{'type':_0xe6c8('0x1'),'content':_0xe6c8('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xe6c8('0xe'),'content':'','key':'Agent\x20Ring','keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0x16')},{'type':'keyValue','content':'','key':_0xe6c8('0x1a'),'keyType':'variable','variableName':_0xe6c8('0x1b')},{'type':_0xe6c8('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0x1c')},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x1d'),'keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0x1e')},{'type':'keyValue','content':'','key':_0xe6c8('0x1f'),'keyType':_0xe6c8('0x7'),'variableName':_0xe6c8('0x20')}];break;case _0xe6c8('0x9'):_0x3c1ade=[{'type':_0xe6c8('0x1'),'content':_0xe6c8('0xc'),'variableName':null},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x21'),'keyType':_0xe6c8('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x22'),'keyType':_0xe6c8('0x7'),'keyContent':'','variableName':_0xe6c8('0x23')},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x13'),'keyType':_0xe6c8('0x7'),'keyContent':'','variableName':_0xe6c8('0x14')},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x15'),'keyType':_0xe6c8('0x7'),'keyContent':'','variableName':_0xe6c8('0x24')},{'type':_0xe6c8('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x25'),'keyType':_0xe6c8('0x7'),'keyContent':'','variableName':_0xe6c8('0x26')},{'type':'keyValue','content':'','key':_0xe6c8('0x27'),'keyType':'variable','keyContent':'','variableName':_0xe6c8('0x28')},{'type':_0xe6c8('0xe'),'content':'','key':_0xe6c8('0x29'),'keyType':_0xe6c8('0x7'),'keyContent':'','variableName':_0xe6c8('0x2a')},{'type':'keyValue','content':'','key':_0xe6c8('0x2b'),'keyType':_0xe6c8('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x3c1ade;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index bd9be5b..fac98e5 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 _0x30b4=['stringify','null','Interaction','then','update','info','catch','error','tracked','user','clone','omit','body','html','phone','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x30b4,0x127));var _0x430b=function(_0x226ad1,_0x2858e2){_0x226ad1=_0x226ad1-0x0;var _0x16b625=_0x30b4[_0x226ad1];return _0x16b625;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x430b('0x0')),'mail':require(_0x430b('0x1'))(_0x430b('0x2')),'fax':require(_0x430b('0x1'))(_0x430b('0x3')),'sms':require('../../config/logger')(_0x430b('0x4')),'chat':require(_0x430b('0x1'))(_0x430b('0x5')),'whatsapp':require(_0x430b('0x1'))(_0x430b('0x6'))};function getInteractionId(_0x422daa,_0x3fa6e8,_0x41c53b){if(_0x422daa&&_0x422daa[_[_0x430b('0x7')](_0x41c53b)+_0x430b('0x8')]){return _0x422daa[_[_0x430b('0x7')](_0x41c53b)+_0x430b('0x8')];}else if(_0x422daa&&_0x422daa['id']){return _0x422daa['id'];}else if(_0x3fa6e8&&_0x3fa6e8['id']){return _0x3fa6e8['id'];}else{return _0x430b('0x9');}}function log(_0x328157,_0xe34f2e,_0x251ff6,_0x22d7d0,_0x5b174b,_0x2523fa){loggers[_0x5b174b[_0x430b('0xa')]()][_0x328157]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2523fa[_0x430b('0xb')](),_0xe34f2e?_0xe34f2e['id']:null,_0xe34f2e?_0xe34f2e[_0x430b('0xc')]:null,_0xe34f2e?_0xe34f2e['role']:null,getInteractionId(_0x251ff6,_0x22d7d0,_0x5b174b),_0x251ff6?JSON[_0x430b('0xd')](_0x251ff6):_0x430b('0xe'));}function updateUser(_0x136a4e,_0x4f4be9,_0x514bbf,_0x15c05c,_0x2da2ff){db[_['upperFirst'](_0x15c05c)+_0x430b('0xf')]['findOne']({'where':{'id':getInteractionId(_0x4f4be9,_0x514bbf,_0x15c05c)}})[_0x430b('0x10')](function(_0x1fd145){if(_0x1fd145){return _0x1fd145[_0x430b('0x11')]({'UserId':_0x136a4e?_0x136a4e['id']:null});}})[_0x430b('0x10')](function(_0x25c55d){if(_0x25c55d){log(_0x430b('0x12'),_0x136a4e,_0x4f4be9,_0x514bbf,_0x15c05c,_0x2da2ff);}})[_0x430b('0x13')](function(){log(_0x430b('0x14'),_0x136a4e,_0x4f4be9,_0x514bbf,_0x15c05c,_0x2da2ff);});}exports[_0x430b('0x15')]=function(_0x499eb2,_0x450a23){return function(_0x2d12e4,_0x55df3d,_0x12c70e){var _0x5bbfaf=_0x2d12e4[_0x430b('0x16')];var _0x263400={};var _0x55a794=_0x2d12e4['query'];if(_0x263400){_0x263400=_[_0x430b('0x17')](_0x2d12e4['body']);_0x263400=_[_0x430b('0x18')](_0x263400,[_0x430b('0x19'),_0x430b('0x1a'),_0x430b('0x1b'),'fax','mobile']);}updateUser(_0x5bbfaf,_0x263400,_0x55a794,_0x499eb2,_0x450a23);_0x12c70e(null);};}; \ No newline at end of file +var _0xf4f2=['catch','error','tracked','query','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','findOne','then','info'];(function(_0x27c5c2,_0x4b4582){var _0x121b98=function(_0x23b8b8){while(--_0x23b8b8){_0x27c5c2['push'](_0x27c5c2['shift']());}};_0x121b98(++_0x4b4582);}(_0xf4f2,0xb9));var _0x2f4f=function(_0x278f15,_0x148b72){_0x278f15=_0x278f15-0x0;var _0x8d7fef=_0xf4f2[_0x278f15];return _0x8d7fef;};'use strict';var _=require(_0x2f4f('0x0'));var db=require(_0x2f4f('0x1'))['db'];var loggers={'openchannel':require(_0x2f4f('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')(_0x2f4f('0x3')),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0x2f4f('0x4')),'chat':require(_0x2f4f('0x2'))(_0x2f4f('0x5')),'whatsapp':require(_0x2f4f('0x2'))(_0x2f4f('0x6'))};function getInteractionId(_0x458642,_0x4350e1,_0x47d713){if(_0x458642&&_0x458642[_[_0x2f4f('0x7')](_0x47d713)+_0x2f4f('0x8')]){return _0x458642[_[_0x2f4f('0x7')](_0x47d713)+_0x2f4f('0x8')];}else if(_0x458642&&_0x458642['id']){return _0x458642['id'];}else if(_0x4350e1&&_0x4350e1['id']){return _0x4350e1['id'];}else{return _0x2f4f('0x9');}}function log(_0x4fb89c,_0x244cba,_0x5b4ef9,_0x53b4cc,_0xda784c,_0x361144){loggers[_0xda784c[_0x2f4f('0xa')]()][_0x4fb89c](_0x2f4f('0xb'),_0x361144[_0x2f4f('0xc')](),_0x244cba?_0x244cba['id']:null,_0x244cba?_0x244cba[_0x2f4f('0xd')]:null,_0x244cba?_0x244cba['role']:null,getInteractionId(_0x5b4ef9,_0x53b4cc,_0xda784c),_0x5b4ef9?JSON[_0x2f4f('0xe')](_0x5b4ef9):'null');}function updateUser(_0x5b9402,_0x53d4fe,_0x476e00,_0x20da53,_0x28d16a){db[_[_0x2f4f('0x7')](_0x20da53)+'Interaction'][_0x2f4f('0xf')]({'where':{'id':getInteractionId(_0x53d4fe,_0x476e00,_0x20da53)}})[_0x2f4f('0x10')](function(_0x164829){if(_0x164829){return _0x164829['update']({'UserId':_0x5b9402?_0x5b9402['id']:null});}})[_0x2f4f('0x10')](function(_0x3c64b2){if(_0x3c64b2){log(_0x2f4f('0x11'),_0x5b9402,_0x53d4fe,_0x476e00,_0x20da53,_0x28d16a);}})[_0x2f4f('0x12')](function(){log(_0x2f4f('0x13'),_0x5b9402,_0x53d4fe,_0x476e00,_0x20da53,_0x28d16a);});}exports[_0x2f4f('0x14')]=function(_0x12812b,_0x48015f){return function(_0x5dee56,_0x14742d,_0x3821f5){var _0xbd0536=_0x5dee56['user'];var _0x1a40dc={};var _0x493287=_0x5dee56[_0x2f4f('0x15')];if(_0x1a40dc){_0x1a40dc=_[_0x2f4f('0x16')](_0x5dee56[_0x2f4f('0x17')]);_0x1a40dc=_[_0x2f4f('0x18')](_0x1a40dc,['body',_0x2f4f('0x19'),_0x2f4f('0x1a'),_0x2f4f('0x1b'),_0x2f4f('0x1c')]);}updateUser(_0xbd0536,_0x1a40dc,_0x493287,_0x12812b,_0x48015f);_0x3821f5(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 8219082..b85b7fd 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 _0x796f=['License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','createDecipher','aes-256-ctr','format','update','base64','utf8','parse','hasOwnProperty','use'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x796f,0x78));var _0xf796=function(_0x392223,_0x155967){_0x392223=_0x392223-0x0;var _0x17b2e7=_0x796f[_0x392223];return _0x17b2e7;};'use strict';var crypto=require(_0xf796('0x0'));var util=require(_0xf796('0x1'));var compose=require(_0xf796('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xf796('0x3'));function getValueFromLicense(_0x4da2d6,_0x10de66){if(_0x4da2d6&&_0x10de66){if(_0x10de66[_0xf796('0x4')]&&_0x10de66[_0xf796('0x5')]){var _0x4ea7b9=_0x10de66[_0xf796('0x4')];var _0x9e6f61=_0x10de66['license'];var _0x3109fc=_0x4ea7b9['split']('-')[0x4];var _0x579162=_0x4ea7b9['split']('-')[0x0];var _0x431dbf=crypto[_0xf796('0x6')](_0xf796('0x7'),util[_0xf796('0x8')]('%s:%s:%s',_0x3109fc,_0x4ea7b9,_0x579162));var _0xaead57=_0x431dbf[_0xf796('0x9')](_0x9e6f61,_0xf796('0xa'),_0xf796('0xb'));_0xaead57+=_0x431dbf['final'](_0xf796('0xb'));var _0x5ae1c9=JSON[_0xf796('0xc')](_0xaead57);return _0x5ae1c9[_0xf796('0xd')](_0x4da2d6)?_0x5ae1c9[_0x4da2d6]:null;}}return null;}function isLimit(_0xa789fd,_0x54d9d1,_0x5cbdb2,_0x4a1b67){var _0x3bd333=_0x54d9d1;return compose()[_0xf796('0xe')](function(_0x38314b,_0x2c3523,_0x1dae30){return db[_0xf796('0xf')][_0xf796('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1f3061){var _0xfa0948=getValueFromLicense(_0xa789fd,_0x1f3061);return _0xfa0948?_0xfa0948:_0x3bd333;})[_0xf796('0x11')](function(_0x57efed){_0x3bd333=_0x57efed;return _0x5cbdb2[_0xf796('0x12')](_0x4a1b67);})[_0xf796('0x11')](function(_0xc83bd9){if(_0xc83bd9>=_0x3bd333){return _0x2c3523[_0xf796('0x13')](0x193)[_0xf796('0x14')]({'message':util[_0xf796('0x8')](_0xf796('0x15'),_0xa789fd)});}_0x1dae30();})[_0xf796('0x16')](function(_0x462975){_0x1dae30(_0x462975);});});}function isUserLimit(){return isLimit(_0xf796('0x17'),0x1,db[_0xf796('0x18')],{'where':{'$or':[{'role':_0xf796('0x19')},{'role':'user'}]}});}exports[_0xf796('0x1a')]=isUserLimit; \ No newline at end of file +var _0xad34=['createDecipher','%s:%s:%s','update','base64','parse','hasOwnProperty','use','License','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split'];(function(_0x2e15bc,_0x3800ae){var _0x12fcb3=function(_0x309f9d){while(--_0x309f9d){_0x2e15bc['push'](_0x2e15bc['shift']());}};_0x12fcb3(++_0x3800ae);}(_0xad34,0x18e));var _0x4ad3=function(_0x1aa749,_0x3ad3ca){_0x1aa749=_0x1aa749-0x0;var _0x4e0964=_0xad34[_0x1aa749];return _0x4e0964;};'use strict';var crypto=require(_0x4ad3('0x0'));var util=require(_0x4ad3('0x1'));var compose=require(_0x4ad3('0x2'));var db=require(_0x4ad3('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3f8b2c,_0x753ad1){if(_0x3f8b2c&&_0x753ad1){if(_0x753ad1[_0x4ad3('0x4')]&&_0x753ad1[_0x4ad3('0x5')]){var _0x2468bb=_0x753ad1[_0x4ad3('0x4')];var _0x44ae94=_0x753ad1['license'];var _0x2eb0b5=_0x2468bb[_0x4ad3('0x6')]('-')[0x4];var _0x382f7f=_0x2468bb['split']('-')[0x0];var _0x2d95ec=crypto[_0x4ad3('0x7')]('aes-256-ctr',util['format'](_0x4ad3('0x8'),_0x2eb0b5,_0x2468bb,_0x382f7f));var _0x40472b=_0x2d95ec[_0x4ad3('0x9')](_0x44ae94,_0x4ad3('0xa'),'utf8');_0x40472b+=_0x2d95ec['final']('utf8');var _0x51d425=JSON[_0x4ad3('0xb')](_0x40472b);return _0x51d425[_0x4ad3('0xc')](_0x3f8b2c)?_0x51d425[_0x3f8b2c]:null;}}return null;}function isLimit(_0x27df3d,_0x262699,_0x2aa46b,_0x3ff4a6){var _0x499e42=_0x262699;return compose()[_0x4ad3('0xd')](function(_0xc5bd1b,_0x2c890c,_0x338deb){return db[_0x4ad3('0xe')][_0x4ad3('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x4ad3('0x10')](function(_0x5dcafa){var _0xba52d3=getValueFromLicense(_0x27df3d,_0x5dcafa);return _0xba52d3?_0xba52d3:_0x499e42;})[_0x4ad3('0x10')](function(_0x534d8f){_0x499e42=_0x534d8f;return _0x2aa46b[_0x4ad3('0x11')](_0x3ff4a6);})[_0x4ad3('0x10')](function(_0x1e603e){if(_0x1e603e>=_0x499e42){return _0x2c890c[_0x4ad3('0x12')](0x193)[_0x4ad3('0x13')]({'message':util[_0x4ad3('0x14')](_0x4ad3('0x15'),_0x27df3d)});}_0x338deb();})[_0x4ad3('0x16')](function(_0x1c736c){_0x338deb(_0x1c736c);});});}function isUserLimit(){return isLimit(_0x4ad3('0x17'),0x1,db[_0x4ad3('0x18')],{'where':{'$or':[{'role':_0x4ad3('0x19')},{'role':'user'}]}});}exports[_0x4ad3('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8ffbc18..3bcfb9c 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 _0xa122=['>\x20?','$lte','<=\x20?','$gte','>=\x20?','$in','start','$startsWith','pop','utcOffset','format','hours','minutes','seconds','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','filter','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','\x20OR\x20','$notIn','=\x20?','<>\x20?','$substring','$endsWith','$lt','<\x20?'];(function(_0x93a23e,_0xa070c0){var _0x449575=function(_0x5f455b){while(--_0x5f455b){_0x93a23e['push'](_0x93a23e['shift']());}};_0x449575(++_0xa070c0);}(_0xa122,0x7a));var _0x2a12=function(_0x4b6614,_0xfa7944){_0x4b6614=_0x4b6614-0x0;var _0x93d54f=_0xa122[_0x4b6614];return _0x93d54f;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0x2a12('0x0')]=function(_0x206bb1){var _0x28b796={'conditions':[]};_0x28b796[_0x2a12('0x1')]=_[_0x2a12('0x2')](_0x206bb1,_0x2a12('0x3'))?'or':_0x2a12('0x4');var _0x5469a8=_0x206bb1[_0x2a12('0x5')](_0x2a12('0x6'),'')[_0x2a12('0x5')](_0x2a12('0x3'),'')[_0x2a12('0x7')]('||');for(var _0x2f53af=0x0;_0x2f53af<_0x5469a8['length'];_0x2f53af++){var _0x3e22ab=_0x5469a8[_0x2f53af][_0x2a12('0x7')](':=');var _0xadb4ec=_0x3e22ab[0x0];var _0x4fd81b=_0x3e22ab[_0x2a12('0x8')](0x1);_0x4fd81b[_0x2a12('0x9')](function(_0x298867){var _0x330b4c=_0x298867[_0x2a12('0x7')]('[')[_0x2a12('0xa')]();var _0x31a406=_0x298867['match'](/\[(.*?)\]/g);_0x31a406[_0x2a12('0x9')](function(_0x5c760d){var _0xa1742=_0x5c760d[_0x2a12('0x7')]('[')[_0x2a12('0xb')](function(_0x5e04d6){return _0x5e04d6['indexOf'](']')>-0x1;})[_0x2a12('0xc')](function(_0x124b59){return _0x124b59[_0x2a12('0x7')](']')[0x0];})[0x0];_0x28b796[_0x2a12('0xd')][_0x2a12('0xe')]({'field':_0xadb4ec,'operator':_0x330b4c,'value':_0xa1742});});});}return _0x28b796;};exports[_0x2a12('0xf')]=function(_0xb8bae1,_0x4c4431,_0x1b3cad){var _0x32a214={};if(_0x4c4431===_0x2a12('0x10')){if(_0x1b3cad[_0x2a12('0x11')]===_0x2a12('0x12')){_0x1b3cad['operator']=_0x2a12('0x13');_0x1b3cad[_0x2a12('0x14')]+=','+_0x1b3cad[_0x2a12('0x14')];}else if(_['includes']([_0x2a12('0x15'),'$lte'],_0x1b3cad[_0x2a12('0x11')])){_0x1b3cad[_0x2a12('0x14')]=moment(_0x1b3cad[_0x2a12('0x14')])[_0x2a12('0x16')](0x1,_0x2a12('0x17'))['format'](_0x2a12('0x18'));}}if(_0x1b3cad['castTo']){_0x4c4431=_0x1b3cad[_0x2a12('0x19')];_0x32a214[_0x2a12('0x1a')]=_0x2a12('0x1b')+_0xb8bae1+'.'+_0x1b3cad[_0x2a12('0x1c')]+_0x2a12('0x1d')+_0x1b3cad[_0x2a12('0x19')]+')\x20'+parseOperator(_0x1b3cad['operator']);}else{_0x32a214['text']=_0xb8bae1+'.'+_0x1b3cad[_0x2a12('0x1c')]+'\x20'+parseOperator(_0x1b3cad[_0x2a12('0x11')]);}if(_[_0x2a12('0x1e')]([_0x2a12('0x1f'),'$notIn'],_0x1b3cad[_0x2a12('0x11')]))_0x32a214[_0x2a12('0x1a')]='('+_0x32a214[_0x2a12('0x1a')]+_0x2a12('0x20')+_0xb8bae1+'.'+_0x1b3cad[_0x2a12('0x1c')]+'\x20IS\x20NULL)';_0x32a214[_0x2a12('0x14')]=parseValue(_0x4c4431,_0x1b3cad[_0x2a12('0x11')],_0x1b3cad[_0x2a12('0x14')]);return _0x32a214;};function parseOperator(_0x103d61){var _0x9a2a8a;switch(_0x103d61){case'$in':_0x9a2a8a='IN\x20?';break;case _0x2a12('0x21'):_0x9a2a8a='NOT\x20IN\x20?';break;case _0x2a12('0x12'):_0x9a2a8a=_0x2a12('0x22');break;case'$ne':_0x9a2a8a=_0x2a12('0x23');break;case _0x2a12('0x24'):case'$startsWith':case _0x2a12('0x25'):_0x9a2a8a='LIKE\x20?';break;case _0x2a12('0x26'):_0x9a2a8a=_0x2a12('0x27');break;case _0x2a12('0x15'):_0x9a2a8a=_0x2a12('0x28');break;case _0x2a12('0x29'):_0x9a2a8a=_0x2a12('0x2a');break;case _0x2a12('0x2b'):_0x9a2a8a=_0x2a12('0x2c');break;case _0x2a12('0x13'):_0x9a2a8a='BETWEEN\x20?\x20AND\x20?';break;}return _0x9a2a8a;}function parseValue(_0x276566,_0xb71c35,_0x1d807c){var _0x332047={'start':undefined,'end':undefined};switch(_0xb71c35){case _0x2a12('0x2d'):case _0x2a12('0x21'):_0x332047[_0x2a12('0x2e')]=_0x1d807c['split'](',');break;case _0x2a12('0x24'):_0x332047[_0x2a12('0x2e')]='%'+_0x1d807c+'%';break;case _0x2a12('0x2f'):_0x332047[_0x2a12('0x2e')]=_0x1d807c+'%';break;case'$endsWith':_0x332047[_0x2a12('0x2e')]='%'+_0x1d807c;break;case _0x2a12('0x13'):var _0x2b21c5=_0x1d807c[_0x2a12('0x7')](',');var _0x1d807c=_0x2b21c5[_0x2a12('0xa')]();var _0x4c2baa=_0x2b21c5[_0x2a12('0x30')]();if(_0x276566===_0x2a12('0x10')){_0x1d807c=moment(_0x1d807c)[_0x2a12('0x31')](0x0,!![])[_0x2a12('0x32')]();_0x4c2baa=moment(_0x4c2baa)[_0x2a12('0x31')](0x0,!![])[_0x2a12('0x16')](0x17,_0x2a12('0x33'))[_0x2a12('0x16')](0x3b,_0x2a12('0x34'))[_0x2a12('0x16')](0x3b,_0x2a12('0x35'))[_0x2a12('0x32')]();}_0x332047={'start':_0x1d807c,'end':_0x4c2baa};break;default:_0x332047[_0x2a12('0x2e')]=_0x1d807c;break;}return _0x332047;} \ No newline at end of file +var _0x3496=['hours','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match','filter','indexOf','map','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','field','text','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','$gte','>=\x20?','start','utcOffset'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x3496,0x15f));var _0x6349=function(_0x7843d1,_0x5c9239){_0x7843d1=_0x7843d1-0x0;var _0x5c3465=_0x3496[_0x7843d1];return _0x5c3465;};'use strict';var _=require(_0x6349('0x0'));var moment=require(_0x6349('0x1'));exports[_0x6349('0x2')]=function(_0x4ee26b){var _0x512fc5={'conditions':[]};_0x512fc5[_0x6349('0x3')]=_[_0x6349('0x4')](_0x4ee26b,_0x6349('0x5'))?'or':_0x6349('0x6');var _0x155310=_0x4ee26b[_0x6349('0x7')](_0x6349('0x8'),'')['replace'](_0x6349('0x5'),'')[_0x6349('0x9')]('||');for(var _0x4ef52a=0x0;_0x4ef52a<_0x155310[_0x6349('0xa')];_0x4ef52a++){var _0x28b0d4=_0x155310[_0x4ef52a][_0x6349('0x9')](':=');var _0x28ed8c=_0x28b0d4[0x0];var _0x45d78f=_0x28b0d4['slice'](0x1);_0x45d78f[_0x6349('0xb')](function(_0x1c06fa){var _0x2d9240=_0x1c06fa['split']('[')[_0x6349('0xc')]();var _0x181de9=_0x1c06fa[_0x6349('0xd')](/\[(.*?)\]/g);_0x181de9[_0x6349('0xb')](function(_0xebb263){var _0x1aa8be=_0xebb263[_0x6349('0x9')]('[')[_0x6349('0xe')](function(_0x5786ea){return _0x5786ea[_0x6349('0xf')](']')>-0x1;})[_0x6349('0x10')](function(_0x1e487c){return _0x1e487c[_0x6349('0x9')](']')[0x0];})[0x0];_0x512fc5['conditions']['push']({'field':_0x28ed8c,'operator':_0x2d9240,'value':_0x1aa8be});});});}return _0x512fc5;};exports[_0x6349('0x11')]=function(_0x316531,_0x6abda8,_0x26e5df){var _0x2f1e45={};if(_0x6abda8===_0x6349('0x12')){if(_0x26e5df['operator']===_0x6349('0x13')){_0x26e5df[_0x6349('0x14')]=_0x6349('0x15');_0x26e5df[_0x6349('0x16')]+=','+_0x26e5df['value'];}else if(_[_0x6349('0x17')]([_0x6349('0x18'),_0x6349('0x19')],_0x26e5df['operator'])){_0x26e5df['value']=moment(_0x26e5df['value'])[_0x6349('0x1a')](0x1,'days')[_0x6349('0x1b')](_0x6349('0x1c'));}}if(_0x26e5df[_0x6349('0x1d')]){_0x6abda8=_0x26e5df[_0x6349('0x1d')];_0x2f1e45['text']='CAST('+_0x316531+'.'+_0x26e5df[_0x6349('0x1e')]+'\x20AS\x20'+_0x26e5df[_0x6349('0x1d')]+')\x20'+parseOperator(_0x26e5df['operator']);}else{_0x2f1e45[_0x6349('0x1f')]=_0x316531+'.'+_0x26e5df['field']+'\x20'+parseOperator(_0x26e5df['operator']);}if(_[_0x6349('0x17')](['$ne',_0x6349('0x20')],_0x26e5df[_0x6349('0x14')]))_0x2f1e45[_0x6349('0x1f')]='('+_0x2f1e45['text']+_0x6349('0x21')+_0x316531+'.'+_0x26e5df['field']+'\x20IS\x20NULL)';_0x2f1e45[_0x6349('0x16')]=parseValue(_0x6abda8,_0x26e5df[_0x6349('0x14')],_0x26e5df[_0x6349('0x16')]);return _0x2f1e45;};function parseOperator(_0x2e9c2e){var _0x324786;switch(_0x2e9c2e){case _0x6349('0x22'):_0x324786=_0x6349('0x23');break;case _0x6349('0x20'):_0x324786=_0x6349('0x24');break;case _0x6349('0x13'):_0x324786=_0x6349('0x25');break;case _0x6349('0x26'):_0x324786=_0x6349('0x27');break;case _0x6349('0x28'):case _0x6349('0x29'):case _0x6349('0x2a'):_0x324786=_0x6349('0x2b');break;case'$lt':_0x324786=_0x6349('0x2c');break;case'$gt':_0x324786='>\x20?';break;case _0x6349('0x19'):_0x324786='<=\x20?';break;case _0x6349('0x2d'):_0x324786=_0x6349('0x2e');break;case _0x6349('0x15'):_0x324786='BETWEEN\x20?\x20AND\x20?';break;}return _0x324786;}function parseValue(_0x299075,_0x58b344,_0x4fa304){var _0x44bb03={'start':undefined,'end':undefined};switch(_0x58b344){case _0x6349('0x22'):case'$notIn':_0x44bb03[_0x6349('0x2f')]=_0x4fa304[_0x6349('0x9')](',');break;case _0x6349('0x28'):_0x44bb03[_0x6349('0x2f')]='%'+_0x4fa304+'%';break;case _0x6349('0x29'):_0x44bb03[_0x6349('0x2f')]=_0x4fa304+'%';break;case _0x6349('0x2a'):_0x44bb03[_0x6349('0x2f')]='%'+_0x4fa304;break;case _0x6349('0x15'):var _0x31558b=_0x4fa304[_0x6349('0x9')](',');var _0x4fa304=_0x31558b[_0x6349('0xc')]();var _0x1704be=_0x31558b['pop']();if(_0x299075==='DATE'){_0x4fa304=moment(_0x4fa304)['utcOffset'](0x0,!![])[_0x6349('0x1b')]();_0x1704be=moment(_0x1704be)[_0x6349('0x30')](0x0,!![])[_0x6349('0x1a')](0x17,_0x6349('0x31'))[_0x6349('0x1a')](0x3b,'minutes')[_0x6349('0x1a')](0x3b,'seconds')[_0x6349('0x1b')]();}_0x44bb03={'start':_0x4fa304,'end':_0x1704be};break;default:_0x44bb03[_0x6349('0x2f')]=_0x4fa304;break;}return _0x44bb03;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 48593c0..b4a0846 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 _0x94d3=['model','filters','intersection','attributes','fields','hasOwnProperty','where','pick','merge','lower','filter','options','lodash','sequelize','moment','keys','parse','split','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','sort','map','priority','cast','col','unsigned','ASC','omit','length','isString','isNumeric','match','isEmail','forEach','replace','includes','push','join','getOptions','query'];(function(_0x2a8a31,_0x5e551b){var _0x2c199e=function(_0x404738){while(--_0x404738){_0x2a8a31['push'](_0x2a8a31['shift']());}};_0x2c199e(++_0x5e551b);}(_0x94d3,0x1b4));var _0x394d=function(_0x33cd42,_0x37725a){_0x33cd42=_0x33cd42-0x0;var _0x234c55=_0x94d3[_0x33cd42];return _0x234c55;};'use strict';var _=require(_0x394d('0x0'));var sequelize=require(_0x394d('0x1'));var moment=require(_0x394d('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1538f1){var _0x56571c=['ne'];try{var _0x1694b9=JSON['parse'](_0x1538f1);var _0xe77376=Object[_0x394d('0x3')](_0x1694b9)[0x0];return _0x56571c['includes'](_0xe77376);}catch(_0x53fc0b){return![];}}function getOperatorValue(_0x409dd7){var _0xcb9ec7=JSON[_0x394d('0x4')](_0x409dd7);var _0x221bae=Object[_0x394d('0x3')](_0xcb9ec7)[0x0];var _0x348a0a=_0xcb9ec7[_0x221bae];return{['$'+_0x221bae]:_0x348a0a};}exports['fields']=function(_0x529faf){var _0x15cd8b=null;if(_0x529faf){_0x15cd8b=_0x529faf[_0x394d('0x5')](',');}return _0x15cd8b;};exports['filters']=function(_0x2cefc2,_0x436ef0){var _0x11bc7b={};if(!_[_0x394d('0x6')](_0x2cefc2)){_[_0x394d('0x7')](_0x2cefc2,function(_0x2be379,_0xd125ff){try{if(_0x436ef0){var _0x4b4c86=_[_0x394d('0x8')](_0x436ef0,{'name':_0xd125ff})||{};if(hasSequelizeOperator(_0x2be379)){_0x11bc7b[_0xd125ff]=getOperatorValue(_0x2be379);}else if(_0x4b4c86[_0x394d('0x9')]==='DATE'&&_[_0x394d('0xa')](_0x2be379)){var _0xf00048=JSON[_0x394d('0x4')](_0x2be379);var _0x2161d7={'$gte':moment(moment(_0xf00048[_0x394d('0xb')])[_0x394d('0xc')](_0x394d('0xd')))[_0x394d('0xe')]()['format'](),'$lte':moment(moment(_0xf00048[_0x394d('0xf')])[_0x394d('0xc')](_0x394d('0xd')))['utc']()[_0x394d('0x10')](0x1,'s')[_0x394d('0xc')]()};_0x11bc7b[_0xd125ff]=_0x2161d7;}else if(_0x4b4c86[_0x394d('0x11')]==='uniqueid'){_0x11bc7b[_0xd125ff]=_0x2be379;}else{_0x11bc7b[_0xd125ff]=_[_0x394d('0x12')](_0x2be379)?_0x2be379:JSON[_0x394d('0x4')](_0x2be379);}}else{_0x11bc7b[_0xd125ff]=_[_0x394d('0x12')](_0x2be379)?_0x2be379:JSON['parse'](_0x2be379);}}catch(_0x4d57fc){_0x11bc7b[_0xd125ff]=_0x2be379[_0x394d('0x5')](',');}});}return _0x11bc7b;};exports[_0x394d('0x13')]=function(_0x27a4ec){_0x27a4ec=parseInt(_0x27a4ec,0xa);if(!_0x27a4ec||_0x27a4ec<0x0){_0x27a4ec=LIMIT_VALUE;}return _0x27a4ec;};exports[_0x394d('0x14')]=function(_0x663d5c){_0x663d5c=parseInt(_0x663d5c,0xa);if(!_0x663d5c||_0x663d5c<0x0){_0x663d5c=0x0;}return _0x663d5c;};exports[_0x394d('0x15')]=function(_0x10bc7a){var _0x1c0760,_0xd0f1b4=null;if(_0x10bc7a){_0x1c0760=_0x10bc7a[_0x394d('0x5')](',');_0xd0f1b4=_[_0x394d('0x16')](_0x1c0760,function(_0x57a871){if(_0x57a871['indexOf']('-')===0x0){return[_0x57a871===_0x394d('0x17')?sequelize[_0x394d('0x18')](sequelize[_0x394d('0x19')](_0x394d('0x17')),'unsigned'):_0x57a871['substr'](0x1),'DESC'];}else{return[_0x57a871===_0x394d('0x17')?sequelize[_0x394d('0x18')](sequelize[_0x394d('0x19')]('priority'),_0x394d('0x1a')):_0x57a871,_0x394d('0x1b')];}});}return _0xd0f1b4;};exports[_0x394d('0x1c')]=function(_0x1e55f1,_0x4a1182){if(_[_0x394d('0x6')](_0x1e55f1)){return _0x1e55f1;}if(_[_0x394d('0x12')](_0x1e55f1)){for(var _0x2ca39d=0x0;_0x2ca39d<_0x1e55f1[_0x394d('0x1d')];_0x2ca39d+=0x1){_0x1e55f1[_0x2ca39d]=this['omit'](_0x1e55f1[_0x2ca39d],_0x4a1182);}return _0x1e55f1;}if(!_['isObject'](_0x1e55f1)){return _0x1e55f1;}if(_[_0x394d('0x1e')](_0x4a1182)){_0x4a1182=[_0x4a1182];}if(!_[_0x394d('0x12')](_0x4a1182)){return _0x1e55f1;}for(var _0x57a864=0x0;_0x57a864<_0x4a1182['length'];_0x57a864+=0x1){_['unset'](_0x1e55f1,_0x4a1182[_0x57a864]);}for(var _0x34551b in _0x1e55f1){if(_0x1e55f1['hasOwnProperty'](_0x34551b)){_0x1e55f1[_0x34551b]=this[_0x394d('0x1c')](_0x1e55f1[_0x34551b],_0x4a1182);}}return _0x1e55f1;};exports[_0x394d('0x1f')]=function(_0x91c203){return _0x91c203[_0x394d('0x20')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x394d('0x21')]=function(_0x26f459){return _0x26f459[_0x394d('0x20')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2f5ea0){var _0x1f449d=[];_0x2f5ea0[_0x394d('0x5')](/[ ,]+/)[_0x394d('0x22')](function(_0x29c0f8){_0x29c0f8=_0x29c0f8[_0x394d('0x23')](/([^:]")"+/g,'$1');_0x29c0f8='+'+_0x29c0f8+'*';if(_0x29c0f8[_0x394d('0x24')]('@'))_0x29c0f8='\x22'+_0x29c0f8+'\x22';_0x1f449d[_0x394d('0x25')](_0x29c0f8);});return _0x1f449d[_0x394d('0x26')]('\x20');};exports[_0x394d('0x27')]=function(_0x3ebfac,_0xf40353,_0x44c706){var _0x591b38={},_0x31db52={};if(_0xf40353[_0x394d('0x28')]['$id']){_0xf40353[_0x394d('0x28')]['id']=_0xf40353[_0x394d('0x28')]['$id'];delete _0xf40353[_0x394d('0x28')]['$id'];}_0x591b38[_0x394d('0x29')]=_['map'](_0x3ebfac,_0x394d('0x11'));_0x591b38[_0x394d('0x28')]=_[_0x394d('0x3')](_0xf40353['query']);_0x591b38[_0x394d('0x2a')]=_[_0x394d('0x2b')](_0x591b38[_0x394d('0x29')],_0x591b38[_0x394d('0x28')]);_0x31db52[_0x394d('0x2c')]=_[_0x394d('0x2b')](_0x591b38[_0x394d('0x29')],this[_0x394d('0x2d')](_0xf40353[_0x394d('0x28')]['fields']));_0x31db52[_0x394d('0x2c')]=_0x31db52[_0x394d('0x2c')][_0x394d('0x1d')]?_0x31db52[_0x394d('0x2c')]:_0x591b38[_0x394d('0x29')];if(!_0xf40353[_0x394d('0x28')][_0x394d('0x2e')]('nolimit')){_0x31db52[_0x394d('0x13')]=this['limit'](_0xf40353[_0x394d('0x28')][_0x394d('0x13')]);_0x31db52[_0x394d('0x14')]=this['offset'](_0xf40353[_0x394d('0x28')][_0x394d('0x14')]);}_0x31db52['order']=this['sort'](_0xf40353[_0x394d('0x28')][_0x394d('0x15')]);_0x31db52[_0x394d('0x2f')]=this[_0x394d('0x2a')](_[_0x394d('0x30')](_0xf40353['query'],_0x591b38[_0x394d('0x2a')]),_0x3ebfac);if(_0xf40353[_0x394d('0x28')]['filter']){_0x31db52[_0x394d('0x2f')]=_[_0x394d('0x31')](_0x31db52['where'],{'$or':_[_0x394d('0x16')](_0x3ebfac,function(_0x419a82){if(_0x419a82[_0x394d('0x9')]!=='VIRTUAL'){if(_0x44c706){return sequelize[_0x394d('0x2f')](sequelize['fn'](_0x394d('0x32'),sequelize[_0x394d('0x19')](_0x419a82[_0x394d('0x11')])),{'$like':sequelize['fn']('lower','%'+_0xf40353['query'][_0x394d('0x33')]+'%')});}else{var _0x55f2c9={};_0x55f2c9[_0x419a82[_0x394d('0x11')]]={'$like':'%'+_0xf40353[_0x394d('0x28')][_0x394d('0x33')]+'%'};return _0x55f2c9;}}})});}_0x31db52=_[_0x394d('0x31')]({},_0x31db52,_0xf40353[_0x394d('0x34')]);return _0x31db52;}; \ No newline at end of file +var _0xb0c8=['intersection','attributes','nolimit','order','pick','filter','where','merge','lower','options','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','push','query','$id','model'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xb0c8,0x172));var _0x8b0c=function(_0x29e8b0,_0x5a77ae){_0x29e8b0=_0x29e8b0-0x0;var _0x5bb088=_0xb0c8[_0x29e8b0];return _0x5bb088;};'use strict';var _=require('lodash');var sequelize=require(_0x8b0c('0x0'));var moment=require(_0x8b0c('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4b3d24){var _0x295a5f=['ne'];try{var _0x6435d3=JSON[_0x8b0c('0x2')](_0x4b3d24);var _0x14d281=Object[_0x8b0c('0x3')](_0x6435d3)[0x0];return _0x295a5f[_0x8b0c('0x4')](_0x14d281);}catch(_0x5c95ad){return![];}}function getOperatorValue(_0x3cb01c){var _0x4f03aa=JSON[_0x8b0c('0x2')](_0x3cb01c);var _0x198be5=Object[_0x8b0c('0x3')](_0x4f03aa)[0x0];var _0x140460=_0x4f03aa[_0x198be5];return{['$'+_0x198be5]:_0x140460};}exports[_0x8b0c('0x5')]=function(_0x35ea98){var _0x33fe4f=null;if(_0x35ea98){_0x33fe4f=_0x35ea98[_0x8b0c('0x6')](',');}return _0x33fe4f;};exports[_0x8b0c('0x7')]=function(_0x189aae,_0x40144b){var _0x549d2a={};if(!_[_0x8b0c('0x8')](_0x189aae)){_[_0x8b0c('0x9')](_0x189aae,function(_0x118096,_0x1f46b2){try{if(_0x40144b){var _0x52992d=_[_0x8b0c('0xa')](_0x40144b,{'name':_0x1f46b2})||{};if(hasSequelizeOperator(_0x118096)){_0x549d2a[_0x1f46b2]=getOperatorValue(_0x118096);}else if(_0x52992d[_0x8b0c('0xb')]===_0x8b0c('0xc')&&_[_0x8b0c('0xd')](_0x118096)){var _0x480884=JSON[_0x8b0c('0x2')](_0x118096);var _0x333319={'$gte':moment(moment(_0x480884[_0x8b0c('0xe')])[_0x8b0c('0xf')](_0x8b0c('0x10')))[_0x8b0c('0x11')]()[_0x8b0c('0xf')](),'$lte':moment(moment(_0x480884[_0x8b0c('0x12')])[_0x8b0c('0xf')](_0x8b0c('0x10')))['utc']()[_0x8b0c('0x13')](0x1,'s')[_0x8b0c('0xf')]()};_0x549d2a[_0x1f46b2]=_0x333319;}else if(_0x52992d[_0x8b0c('0x14')]===_0x8b0c('0x15')){_0x549d2a[_0x1f46b2]=_0x118096;}else{_0x549d2a[_0x1f46b2]=_[_0x8b0c('0x16')](_0x118096)?_0x118096:JSON[_0x8b0c('0x2')](_0x118096);}}else{_0x549d2a[_0x1f46b2]=_[_0x8b0c('0x16')](_0x118096)?_0x118096:JSON[_0x8b0c('0x2')](_0x118096);}}catch(_0x19d71a){_0x549d2a[_0x1f46b2]=_0x118096[_0x8b0c('0x6')](',');}});}return _0x549d2a;};exports[_0x8b0c('0x17')]=function(_0x40083a){_0x40083a=parseInt(_0x40083a,0xa);if(!_0x40083a||_0x40083a<0x0){_0x40083a=LIMIT_VALUE;}return _0x40083a;};exports[_0x8b0c('0x18')]=function(_0x4b74b1){_0x4b74b1=parseInt(_0x4b74b1,0xa);if(!_0x4b74b1||_0x4b74b1<0x0){_0x4b74b1=0x0;}return _0x4b74b1;};exports[_0x8b0c('0x19')]=function(_0x876451){var _0x1766db,_0x5877cc=null;if(_0x876451){_0x1766db=_0x876451[_0x8b0c('0x6')](',');_0x5877cc=_[_0x8b0c('0x1a')](_0x1766db,function(_0x2aafb0){if(_0x2aafb0[_0x8b0c('0x1b')]('-')===0x0){return[_0x2aafb0===_0x8b0c('0x1c')?sequelize[_0x8b0c('0x1d')](sequelize[_0x8b0c('0x1e')]('priority'),_0x8b0c('0x1f')):_0x2aafb0['substr'](0x1),_0x8b0c('0x20')];}else{return[_0x2aafb0==='priority'?sequelize[_0x8b0c('0x1d')](sequelize[_0x8b0c('0x1e')](_0x8b0c('0x1c')),_0x8b0c('0x1f')):_0x2aafb0,_0x8b0c('0x21')];}});}return _0x5877cc;};exports[_0x8b0c('0x22')]=function(_0x1d4009,_0x8d5976){if(_[_0x8b0c('0x8')](_0x1d4009)){return _0x1d4009;}if(_['isArray'](_0x1d4009)){for(var _0x9de7d8=0x0;_0x9de7d8<_0x1d4009[_0x8b0c('0x23')];_0x9de7d8+=0x1){_0x1d4009[_0x9de7d8]=this[_0x8b0c('0x22')](_0x1d4009[_0x9de7d8],_0x8d5976);}return _0x1d4009;}if(!_[_0x8b0c('0x24')](_0x1d4009)){return _0x1d4009;}if(_[_0x8b0c('0x25')](_0x8d5976)){_0x8d5976=[_0x8d5976];}if(!_[_0x8b0c('0x16')](_0x8d5976)){return _0x1d4009;}for(var _0x6a4d9=0x0;_0x6a4d9<_0x8d5976[_0x8b0c('0x23')];_0x6a4d9+=0x1){_[_0x8b0c('0x26')](_0x1d4009,_0x8d5976[_0x6a4d9]);}for(var _0x5cb31d in _0x1d4009){if(_0x1d4009[_0x8b0c('0x27')](_0x5cb31d)){_0x1d4009[_0x5cb31d]=this[_0x8b0c('0x22')](_0x1d4009[_0x5cb31d],_0x8d5976);}}return _0x1d4009;};exports[_0x8b0c('0x28')]=function(_0x4fc397){return _0x4fc397[_0x8b0c('0x29')](RegExp(_0x8b0c('0x2a')))?!![]:![];};exports[_0x8b0c('0x2b')]=function(_0x53d27a){return _0x53d27a['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x8b0c('0x2c')]=function(_0x27c8b5){var _0x405cc1=[];_0x27c8b5['split'](/[ ,]+/)['forEach'](function(_0xcd3dce){_0xcd3dce=_0xcd3dce[_0x8b0c('0x2d')](/([^:]")"+/g,'$1');_0xcd3dce='+'+_0xcd3dce+'*';if(_0xcd3dce['includes']('@'))_0xcd3dce='\x22'+_0xcd3dce+'\x22';_0x405cc1[_0x8b0c('0x2e')](_0xcd3dce);});return _0x405cc1['join']('\x20');};exports['getOptions']=function(_0x5d39f3,_0x2512ed,_0x145520){var _0x5e98bd={},_0x32766c={};if(_0x2512ed[_0x8b0c('0x2f')]['$id']){_0x2512ed[_0x8b0c('0x2f')]['id']=_0x2512ed[_0x8b0c('0x2f')][_0x8b0c('0x30')];delete _0x2512ed[_0x8b0c('0x2f')]['$id'];}_0x5e98bd[_0x8b0c('0x31')]=_['map'](_0x5d39f3,'name');_0x5e98bd['query']=_[_0x8b0c('0x3')](_0x2512ed[_0x8b0c('0x2f')]);_0x5e98bd[_0x8b0c('0x7')]=_[_0x8b0c('0x32')](_0x5e98bd['model'],_0x5e98bd[_0x8b0c('0x2f')]);_0x32766c[_0x8b0c('0x33')]=_[_0x8b0c('0x32')](_0x5e98bd[_0x8b0c('0x31')],this[_0x8b0c('0x5')](_0x2512ed['query']['fields']));_0x32766c[_0x8b0c('0x33')]=_0x32766c[_0x8b0c('0x33')][_0x8b0c('0x23')]?_0x32766c[_0x8b0c('0x33')]:_0x5e98bd[_0x8b0c('0x31')];if(!_0x2512ed['query']['hasOwnProperty'](_0x8b0c('0x34'))){_0x32766c[_0x8b0c('0x17')]=this['limit'](_0x2512ed[_0x8b0c('0x2f')][_0x8b0c('0x17')]);_0x32766c[_0x8b0c('0x18')]=this['offset'](_0x2512ed[_0x8b0c('0x2f')][_0x8b0c('0x18')]);}_0x32766c[_0x8b0c('0x35')]=this[_0x8b0c('0x19')](_0x2512ed['query'][_0x8b0c('0x19')]);_0x32766c['where']=this['filters'](_[_0x8b0c('0x36')](_0x2512ed[_0x8b0c('0x2f')],_0x5e98bd['filters']),_0x5d39f3);if(_0x2512ed[_0x8b0c('0x2f')][_0x8b0c('0x37')]){_0x32766c[_0x8b0c('0x38')]=_[_0x8b0c('0x39')](_0x32766c[_0x8b0c('0x38')],{'$or':_['map'](_0x5d39f3,function(_0x217aa1){if(_0x217aa1['type']!=='VIRTUAL'){if(_0x145520){return sequelize[_0x8b0c('0x38')](sequelize['fn']('lower',sequelize[_0x8b0c('0x1e')](_0x217aa1[_0x8b0c('0x14')])),{'$like':sequelize['fn'](_0x8b0c('0x3a'),'%'+_0x2512ed['query'][_0x8b0c('0x37')]+'%')});}else{var _0x38c5e0={};_0x38c5e0[_0x217aa1['name']]={'$like':'%'+_0x2512ed[_0x8b0c('0x2f')][_0x8b0c('0x37')]+'%'};return _0x38c5e0;}}})});}_0x32766c=_[_0x8b0c('0x39')]({},_0x32766c,_0x2512ed[_0x8b0c('0x3b')]);return _0x32766c;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8d60176..9434d17 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb12=['express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default','get','env','set','appPath','join','development','root','client','use','json\x20replacer','toISOString','static','views','/server/views','html','ejs','view\x20engine','urlencoded','json','50mb','initialize'];(function(_0x25d467,_0x10b801){var _0x399ff6=function(_0x5b595d){while(--_0x5b595d){_0x25d467['push'](_0x25d467['shift']());}};_0x399ff6(++_0x10b801);}(_0xeb12,0x108));var _0x2eb1=function(_0x44d797,_0x276017){_0x44d797=_0x44d797-0x0;var _0x4005c2=_0xeb12[_0x44d797];return _0x4005c2;};'use strict';var express=require(_0x2eb1('0x0'));var favicon=require(_0x2eb1('0x1'));var bodyParser=require(_0x2eb1('0x2'));var methodOverride=require(_0x2eb1('0x3'));var cookieParser=require(_0x2eb1('0x4'));var errorHandler=require(_0x2eb1('0x5'));var path=require(_0x2eb1('0x6'));var passport=require('passport');var cors=require(_0x2eb1('0x7'));var moment=require(_0x2eb1('0x8'));var config=require(_0x2eb1('0x9'));var db=require(_0x2eb1('0xa'))['db'];exports[_0x2eb1('0xb')]=function(_0x1b6212){var _0x7c6690=_0x1b6212[_0x2eb1('0xc')](_0x2eb1('0xd'));if(_0x7c6690==='production'){_0x1b6212[_0x2eb1('0xe')](_0x2eb1('0xf'),path[_0x2eb1('0x10')](config['root'],'public'));}if(_0x7c6690===_0x2eb1('0x11')||_0x7c6690==='test'){_0x1b6212[_0x2eb1('0xe')]('appPath',path[_0x2eb1('0x10')](config[_0x2eb1('0x12')],_0x2eb1('0x13')));_0x1b6212[_0x2eb1('0x14')](errorHandler());}_0x1b6212['set'](_0x2eb1('0x15'),function(_0x1b648a,_0x3b2e94){if(this[_0x1b648a]instanceof Date){_0x3b2e94=this[_0x1b648a][_0x2eb1('0x16')]()['split']('.')[0x0]+'Z';}return _0x3b2e94;});_0x1b6212[_0x2eb1('0x14')](express[_0x2eb1('0x17')](_0x1b6212[_0x2eb1('0xc')](_0x2eb1('0xf'))));_0x1b6212[_0x2eb1('0xe')](_0x2eb1('0x18'),config[_0x2eb1('0x12')]+_0x2eb1('0x19'));_0x1b6212['engine'](_0x2eb1('0x1a'),require(_0x2eb1('0x1b'))['renderFile']);_0x1b6212[_0x2eb1('0xe')](_0x2eb1('0x1c'),_0x2eb1('0x1a'));_0x1b6212[_0x2eb1('0x14')](bodyParser[_0x2eb1('0x1d')]({'limit':'50mb','extended':!![]}));_0x1b6212['use'](bodyParser[_0x2eb1('0x1e')]({'limit':_0x2eb1('0x1f')}));_0x1b6212['use'](cors());_0x1b6212[_0x2eb1('0x14')](methodOverride());_0x1b6212[_0x2eb1('0x14')](cookieParser());_0x1b6212[_0x2eb1('0x14')](passport[_0x2eb1('0x20')]());}; \ No newline at end of file +var _0xe26b=['renderFile','view\x20engine','50mb','json','express','serve-favicon','body-parser','method-override','cookie-parser','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','join','root','test','appPath','client','use','json\x20replacer','toISOString','static','views','/server/views','engine','html'];(function(_0x300796,_0x4f7e0f){var _0x57d382=function(_0x286d12){while(--_0x286d12){_0x300796['push'](_0x300796['shift']());}};_0x57d382(++_0x4f7e0f);}(_0xe26b,0x14e));var _0xbe26=function(_0x258c5e,_0x407908){_0x258c5e=_0x258c5e-0x0;var _0x4ce92e=_0xe26b[_0x258c5e];return _0x4ce92e;};'use strict';var express=require(_0xbe26('0x0'));var favicon=require(_0xbe26('0x1'));var bodyParser=require(_0xbe26('0x2'));var methodOverride=require(_0xbe26('0x3'));var cookieParser=require(_0xbe26('0x4'));var errorHandler=require('errorhandler');var path=require(_0xbe26('0x5'));var passport=require(_0xbe26('0x6'));var cors=require(_0xbe26('0x7'));var moment=require(_0xbe26('0x8'));var config=require(_0xbe26('0x9'));var db=require(_0xbe26('0xa'))['db'];exports[_0xbe26('0xb')]=function(_0x5cf75c){var _0x1d67e7=_0x5cf75c[_0xbe26('0xc')](_0xbe26('0xd'));if(_0x1d67e7===_0xbe26('0xe')){_0x5cf75c[_0xbe26('0xf')]('appPath',path[_0xbe26('0x10')](config[_0xbe26('0x11')],'public'));}if(_0x1d67e7==='development'||_0x1d67e7===_0xbe26('0x12')){_0x5cf75c[_0xbe26('0xf')](_0xbe26('0x13'),path[_0xbe26('0x10')](config['root'],_0xbe26('0x14')));_0x5cf75c[_0xbe26('0x15')](errorHandler());}_0x5cf75c[_0xbe26('0xf')](_0xbe26('0x16'),function(_0xbe8037,_0xc240f8){if(this[_0xbe8037]instanceof Date){_0xc240f8=this[_0xbe8037][_0xbe26('0x17')]()['split']('.')[0x0]+'Z';}return _0xc240f8;});_0x5cf75c[_0xbe26('0x15')](express[_0xbe26('0x18')](_0x5cf75c[_0xbe26('0xc')]('appPath')));_0x5cf75c[_0xbe26('0xf')](_0xbe26('0x19'),config[_0xbe26('0x11')]+_0xbe26('0x1a'));_0x5cf75c[_0xbe26('0x1b')](_0xbe26('0x1c'),require('ejs')[_0xbe26('0x1d')]);_0x5cf75c[_0xbe26('0xf')](_0xbe26('0x1e'),_0xbe26('0x1c'));_0x5cf75c[_0xbe26('0x15')](bodyParser['urlencoded']({'limit':_0xbe26('0x1f'),'extended':!![]}));_0x5cf75c['use'](bodyParser[_0xbe26('0x20')]({'limit':_0xbe26('0x1f')}));_0x5cf75c['use'](cors());_0x5cf75c[_0xbe26('0x15')](methodOverride());_0x5cf75c[_0xbe26('0x15')](cookieParser());_0x5cf75c[_0xbe26('0x15')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 5ca679d..16d8d7e 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 _0x2f4f=['child_process','../environment','networkInterfaces','orderBy','keys','length','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','createHash','md5','update','hex','getUuid','licenseToken','win32','utf8','replace','hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid'];(function(_0x2b2c1c,_0x2408c6){var _0x460cab=function(_0x79877c){while(--_0x79877c){_0x2b2c1c['push'](_0x2b2c1c['shift']());}};_0x460cab(++_0x2408c6);}(_0x2f4f,0x19d));var _0xf2f4=function(_0x1b0f39,_0x5b01fa){_0x1b0f39=_0x1b0f39-0x0;var _0x37732e=_0x2f4f[_0x1b0f39];return _0x37732e;};'use strict';var _=require(_0xf2f4('0x0'));var os=require('os');var crypto=require(_0xf2f4('0x1'));var machine=require(_0xf2f4('0x2'));var exec=require(_0xf2f4('0x3'))['execSync'];var config=require(_0xf2f4('0x4'));function getInterfaces(){var _0x17b8fa=[];var _0x10cf4f=os[_0xf2f4('0x5')]();var _0x1e06ec=_[_0xf2f4('0x6')](_[_0xf2f4('0x7')](_0x10cf4f));for(var _0x5984ad=0x0;_0x5984ad<_0x1e06ec[_0xf2f4('0x8')];_0x5984ad++){var _0x5de80e=_0x10cf4f[_0x1e06ec[_0x5984ad]]['filter'](function(_0x36e28f){return _0x36e28f['family']===_0xf2f4('0x9')&&_0x36e28f[_0xf2f4('0xa')]===![];});_0x17b8fa=_0x17b8fa[_0xf2f4('0xb')](_0x5de80e);}return _0x17b8fa;}function getFirstInterface(){var _0x3276a5=_[_0xf2f4('0xc')](getInterfaces());return{'macAddress':_0x3276a5&&_0x3276a5[_0xf2f4('0xd')]?_0x3276a5[_0xf2f4('0xd')]:_0xf2f4('0xe'),'ipAddress':_0x3276a5&&_0x3276a5[_0xf2f4('0xf')]?_0x3276a5[_0xf2f4('0xf')]:'127.0.0.1'};}exports[_0xf2f4('0x10')]=getFirstInterface;function getCPUhash(){var _0x4c9ba2=_[_0xf2f4('0x6')](os[_0xf2f4('0x11')]()[_0xf2f4('0x12')](function(_0x2554cf){return _0x2554cf[_0xf2f4('0x13')];}))['join'](':');return crypto[_0xf2f4('0x14')](_0xf2f4('0x15'))[_0xf2f4('0x16')](_0x4c9ba2)['digest'](_0xf2f4('0x17'));}exports[_0xf2f4('0x18')]=function(){var _0x1835ad=os['platform']();var _0x5a0ef7=/[0-9a-f-]{36}/;if(config[_0xf2f4('0x19')]&&_0x5a0ef7['test'](config[_0xf2f4('0x19')])){return config[_0xf2f4('0x19')];}else if(_0x1835ad===_0xf2f4('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf2f4('0x1b')})[_0xf2f4('0x1c')]('\x0d\x0a','');}else{var _0xc036c7=getFirstInterface();var _0x20bcb3=getCPUhash();var _0x40c97a=_0x20bcb3+'|'+os[_0xf2f4('0x1d')]()+'|'+_0xc036c7[_0xf2f4('0x1e')]+'|'+_0xc036c7['ipAddress'];var _0x372364=crypto[_0xf2f4('0x14')](_0xf2f4('0x15'))[_0xf2f4('0x16')](_0x40c97a)['digest'](_0xf2f4('0x17'));return _0x372364['substring'](0x0,0x8)+'-'+_0x372364['substring'](0x8,0xc)+'-'+_0x372364[_0xf2f4('0x1f')](0xc,0x10)+'-'+_0x372364['substring'](0x10,0x14)+'-'+_0x372364['substring'](0x14);}}; \ No newline at end of file +var _0x0f87=['test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','model','join','createHash','md5','update','digest','hex','getUuid','licenseToken'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f87,0x138));var _0x70f8=function(_0x51182a,_0x8c6ab2){_0x51182a=_0x51182a-0x0;var _0x458068=_0x0f87[_0x51182a];return _0x458068;};'use strict';var _=require(_0x70f8('0x0'));var os=require('os');var crypto=require(_0x70f8('0x1'));var machine=require(_0x70f8('0x2'));var exec=require(_0x70f8('0x3'))[_0x70f8('0x4')];var config=require(_0x70f8('0x5'));function getInterfaces(){var _0x3a070b=[];var _0x23cf4f=os[_0x70f8('0x6')]();var _0x471456=_['orderBy'](_[_0x70f8('0x7')](_0x23cf4f));for(var _0x44d021=0x0;_0x44d021<_0x471456['length'];_0x44d021++){var _0x272991=_0x23cf4f[_0x471456[_0x44d021]][_0x70f8('0x8')](function(_0x1d5a21){return _0x1d5a21[_0x70f8('0x9')]===_0x70f8('0xa')&&_0x1d5a21[_0x70f8('0xb')]===![];});_0x3a070b=_0x3a070b[_0x70f8('0xc')](_0x272991);}return _0x3a070b;}function getFirstInterface(){var _0x27bef3=_[_0x70f8('0xd')](getInterfaces());return{'macAddress':_0x27bef3&&_0x27bef3[_0x70f8('0xe')]?_0x27bef3[_0x70f8('0xe')]:_0x70f8('0xf'),'ipAddress':_0x27bef3&&_0x27bef3[_0x70f8('0x10')]?_0x27bef3[_0x70f8('0x10')]:_0x70f8('0x11')};}exports[_0x70f8('0x12')]=getFirstInterface;function getCPUhash(){var _0x3bbcfe=_[_0x70f8('0x13')](os[_0x70f8('0x14')]()['map'](function(_0x32fcd0){return _0x32fcd0[_0x70f8('0x15')];}))[_0x70f8('0x16')](':');return crypto[_0x70f8('0x17')](_0x70f8('0x18'))[_0x70f8('0x19')](_0x3bbcfe)[_0x70f8('0x1a')](_0x70f8('0x1b'));}exports[_0x70f8('0x1c')]=function(){var _0x21d8e5=os['platform']();var _0x3909b4=/[0-9a-f-]{36}/;if(config[_0x70f8('0x1d')]&&_0x3909b4[_0x70f8('0x1e')](config[_0x70f8('0x1d')])){return config[_0x70f8('0x1d')];}else if(_0x21d8e5===_0x70f8('0x1f')){return exec(_0x70f8('0x20'),{'encoding':_0x70f8('0x21')})['replace']('\x0d\x0a','');}else{var _0xdc13f1=getFirstInterface();var _0x4e680d=getCPUhash();var _0x1d93f9=_0x4e680d+'|'+os[_0x70f8('0x22')]()+'|'+_0xdc13f1[_0x70f8('0x23')]+'|'+_0xdc13f1[_0x70f8('0x24')];var _0x8f0d2b=crypto[_0x70f8('0x17')](_0x70f8('0x18'))[_0x70f8('0x19')](_0x1d93f9)['digest']('hex');return _0x8f0d2b['substring'](0x0,0x8)+'-'+_0x8f0d2b[_0x70f8('0x25')](0x8,0xc)+'-'+_0x8f0d2b[_0x70f8('0x25')](0xc,0x10)+'-'+_0x8f0d2b['substring'](0x10,0x14)+'-'+_0x8f0d2b['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2e244d9..db22b82 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 _0xc110=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','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','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License','findOrCreate','spread','catch','default','moment','request-promise','bluebird','pkginfo','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','get','data1'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc110,0x14f));var _0x0c11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc110[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var moment=require(_0x0c11('0x0'));var rp=require(_0x0c11('0x1'));var BPromise=require(_0x0c11('0x2'));var pkginfo=require(_0x0c11('0x3'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x0c11('0x4'));var hardware=require(_0x0c11('0x5'));var logger=require('../logger')(_0x0c11('0x6'));var HOST=_0x0c11('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x59150f){return new BPromise(function(_0x223991,_0x11b19d){var _0x3c0e2b=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x59150f,module['exports'][_0x0c11('0x8')]);if(oldToken){_0x3c0e2b=util[_0x0c11('0x9')](_0x0c11('0xa'),HOST,_0x59150f,module[_0x0c11('0xb')][_0x0c11('0x8')],oldToken);}var _0x410624={'uri':_0x3c0e2b,'method':_0x0c11('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x410624)[_0x0c11('0xd')](function(_0x5a2226){_0x223991(_0x5a2226);})['catch'](function(_0x147c3b){_0x11b19d(_0x147c3b);});});}function manageLicense(_0x1e2c28,_0x561aa6){var _0x1abd55=_0x561aa6[_0x0c11('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x1abd55[_0x0c11('0xf')]!==_0x1e2c28&&!_0x1abd55['data2']){oldToken=_0x1abd55[_0x0c11('0xf')];}httpRequest(_0x1e2c28)['then'](function(_0x5dcb08){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5dcb08['active']){isOldTokenSent=![];if(!_0x1abd55[_0x0c11('0x6')]&&_0x1abd55[_0x0c11('0x6')]!=_0x5dcb08[_0x0c11('0x6')]||_0x1abd55[_0x0c11('0x6')]&&_0x1abd55['data2']){logger[_0x0c11('0x10')](_0x0c11('0x11'));}if(_0x1abd55[_0x0c11('0x6')]&&!_0x1abd55['data2']&&_0x1abd55[_0x0c11('0x6')]!=_0x5dcb08['license']){logger[_0x0c11('0x10')](_0x0c11('0x12'));}if(_0x1abd55[_0x0c11('0x6')]&&!_0x1abd55['data2']&&_0x1abd55['license']==_0x5dcb08[_0x0c11('0x6')]){return _0x561aa6;}return _0x561aa6['update']({'data1':_0x1e2c28,'data2':null,'license':_0x5dcb08['license']});}else{if(_0x5dcb08[_0x0c11('0x6')]||_0x1abd55[_0x0c11('0x6')]){if(!_0x1abd55[_0x0c11('0x13')]){if(_0x1abd55[_0x0c11('0xf')]==_0x1e2c28){GRAY_PERIOD_REASON=_0x0c11('0x14');logger[_0x0c11('0x10')](_0x0c11('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1abd55[_0x0c11('0xf')],_0x1e2c28);}logger[_0x0c11('0x10')](_0x0c11('0x16'),GRAY_PERIOD_REASON[_0x0c11('0x17')](),moment()['format'](_0x0c11('0x18')));return _0x561aa6[_0x0c11('0x19')]({'data2':encryptor[_0x0c11('0x1a')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x0c11('0x1b')](encryptor[_0x0c11('0x1c')](_0x1abd55['data2']),_0x0c11('0x1d'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x0c11('0x9')](_0x0c11('0x18')));isOldTokenSent=![];return _0x561aa6[_0x0c11('0x19')]({'data1':_0x1e2c28,'data2':null,'license':null});}}}else{if(_0x1abd55[_0x0c11('0xf')]!=_0x1e2c28){logger[_0x0c11('0x10')](_0x0c11('0x1e'),_0x1abd55['data1'],_0x1e2c28);return _0x561aa6[_0x0c11('0x19')]({'data1':_0x1e2c28,'data2':null,'license':null});}}}return _0x561aa6;})['then'](function(_0x5dfdeb){_0x561aa6=_0x5dfdeb;})['catch'](function(_0x3c2b68){logger['error'](_0x3c2b68[_0x0c11('0x1f')]);})[_0x0c11('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x0c11('0x21')](),_0x561aa6);},TIME);});}function defaultLicense(){var _0x13bbfb=hardware[_0x0c11('0x21')]();if(_0x13bbfb){return db[_0x0c11('0x22')][_0x0c11('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x13bbfb}})[_0x0c11('0x24')](function(_0x2b6fee,_0x2cdb53){logger[_0x0c11('0x10')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x13bbfb);manageLicense(_0x13bbfb,_0x2b6fee);})[_0x0c11('0x25')](function(_0x50a099){logger['error'](_0x50a099['message']);});}}exports[_0x0c11('0x26')]=defaultLicense; \ No newline at end of file +var _0x09f1=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','default','util','moment','request-promise','bluebird','../../components/encryptor','../logger','license','%s/api/servers/%s/check?version=%s','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x24d8b9,_0x72d98){var _0x2fd908=function(_0x12d53a){while(--_0x12d53a){_0x24d8b9['push'](_0x24d8b9['shift']());}};_0x2fd908(++_0x72d98);}(_0x09f1,0x198));var _0x109f=function(_0x25548c,_0x3e2f63){_0x25548c=_0x25548c-0x0;var _0x5ace5b=_0x09f1[_0x25548c];return _0x5ace5b;};'use strict';var util=require(_0x109f('0x0'));var moment=require(_0x109f('0x1'));var rp=require(_0x109f('0x2'));var BPromise=require(_0x109f('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x109f('0x4'));var hardware=require('./hardware');var logger=require(_0x109f('0x5'))(_0x109f('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x23501d){return new BPromise(function(_0xd1b660,_0x343199){var _0x4911e3=util['format'](_0x109f('0x7'),HOST,_0x23501d,module[_0x109f('0x8')][_0x109f('0x9')]);if(oldToken){_0x4911e3=util[_0x109f('0xa')](_0x109f('0xb'),HOST,_0x23501d,module['exports'][_0x109f('0x9')],oldToken);}var _0x4183bf={'uri':_0x4911e3,'method':_0x109f('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x4183bf)[_0x109f('0xd')](function(_0x4ab6e2){_0xd1b660(_0x4ab6e2);})[_0x109f('0xe')](function(_0x58af4d){_0x343199(_0x58af4d);});});}function manageLicense(_0x5d6386,_0x4c926a){var _0x5591a6=_0x4c926a['get']({'plain':!![]});if(!isOldTokenSent&&_0x5591a6[_0x109f('0xf')]!==_0x5d6386&&!_0x5591a6['data2']){oldToken=_0x5591a6[_0x109f('0xf')];}httpRequest(_0x5d6386)[_0x109f('0xd')](function(_0x3cbc45){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3cbc45[_0x109f('0x10')]){isOldTokenSent=![];if(!_0x5591a6['license']&&_0x5591a6['license']!=_0x3cbc45[_0x109f('0x6')]||_0x5591a6[_0x109f('0x6')]&&_0x5591a6[_0x109f('0x11')]){logger[_0x109f('0x12')](_0x109f('0x13'));}if(_0x5591a6[_0x109f('0x6')]&&!_0x5591a6[_0x109f('0x11')]&&_0x5591a6[_0x109f('0x6')]!=_0x3cbc45[_0x109f('0x6')]){logger['info'](_0x109f('0x14'));}if(_0x5591a6[_0x109f('0x6')]&&!_0x5591a6[_0x109f('0x11')]&&_0x5591a6[_0x109f('0x6')]==_0x3cbc45['license']){return _0x4c926a;}return _0x4c926a['update']({'data1':_0x5d6386,'data2':null,'license':_0x3cbc45[_0x109f('0x6')]});}else{if(_0x3cbc45[_0x109f('0x6')]||_0x5591a6[_0x109f('0x6')]){if(!_0x5591a6[_0x109f('0x11')]){if(_0x5591a6[_0x109f('0xf')]==_0x5d6386){GRAY_PERIOD_REASON=_0x109f('0x15');logger[_0x109f('0x12')](_0x109f('0x16'));}else{GRAY_PERIOD_REASON=_0x109f('0x17');logger[_0x109f('0x12')](_0x109f('0x18'),_0x5591a6[_0x109f('0xf')],_0x5d6386);}logger[_0x109f('0x12')](_0x109f('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x109f('0xa')](_0x109f('0x1a')));return _0x4c926a[_0x109f('0x1b')]({'data2':encryptor['encryptString'](moment()[_0x109f('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x109f('0x1c')](encryptor[_0x109f('0x1d')](_0x5591a6['data2']),_0x109f('0x1e'))>DAYS){logger[_0x109f('0x12')](_0x109f('0x1f'),moment()[_0x109f('0xa')](_0x109f('0x1a')));isOldTokenSent=![];return _0x4c926a[_0x109f('0x1b')]({'data1':_0x5d6386,'data2':null,'license':null});}}}else{if(_0x5591a6['data1']!=_0x5d6386){logger[_0x109f('0x12')](_0x109f('0x18'),_0x5591a6[_0x109f('0xf')],_0x5d6386);return _0x4c926a['update']({'data1':_0x5d6386,'data2':null,'license':null});}}}return _0x4c926a;})[_0x109f('0xd')](function(_0x344db1){_0x4c926a=_0x344db1;})[_0x109f('0xe')](function(_0x51370a){logger['error'](_0x51370a[_0x109f('0x20')]);})[_0x109f('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x109f('0x22')](),_0x4c926a);},TIME);});}function defaultLicense(){var _0x5e8627=hardware[_0x109f('0x22')]();if(_0x5e8627){return db[_0x109f('0x23')][_0x109f('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5e8627}})[_0x109f('0x25')](function(_0x5a477a,_0x46885d){logger[_0x109f('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5e8627);manageLicense(_0x5e8627,_0x5a477a);})[_0x109f('0xe')](function(_0x2cb799){logger['error'](_0x2cb799['message']);});}}exports[_0x109f('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 68aa7b9..1c20cac 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 _0xa965=['../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','split','decryptString','parse','demo','gray','deadline','add','days','format','grayReason','changed','disabled','message','User','role','sequelize','COUNT','col','count','admin','user','telephone','users','forEach','pick','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware'];(function(_0x183b21,_0x271b8e){var _0x4dbe1b=function(_0x32e3e2){while(--_0x32e3e2){_0x183b21['push'](_0x183b21['shift']());}};_0x4dbe1b(++_0x271b8e);}(_0xa965,0x109));var _0x5a96=function(_0x20c59f,_0x583d0a){_0x20c59f=_0x20c59f-0x0;var _0x2b6df8=_0xa965[_0x20c59f];return _0x2b6df8;};'use strict';var util=require(_0x5a96('0x0'));var _=require(_0x5a96('0x1'));var moment=require(_0x5a96('0x2'));var BPromise=require(_0x5a96('0x3'));var hardware=require(_0x5a96('0x4'));var encryptor=require(_0x5a96('0x5'));var db=require(_0x5a96('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5a96('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5a96('0x8'),'machineUuid':hardware[_0x5a96('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5a96('0xa'),'machineUuid':hardware[_0x5a96('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x40f089){return new BPromise(function(_0x55d239,_0xe4fde){return db[_0x5a96('0xb')][_0x5a96('0xc')](_['defaults'](_0x40f089,{'raw':!![],'where':{'id':0x1}}))[_0x5a96('0xd')](function(_0x323087){return checkLicense(_0x323087,null);})[_0x5a96('0xd')](function(_0x43c412){_0x55d239(_0x43c412);return;})[_0x5a96('0xe')](function(_0x51f7c7){_0xe4fde(_0x51f7c7);});});}function checkLicense(_0x642068,_0xa5796d){if(!_0x642068){demoLicense[_0x5a96('0xf')]=_0x642068[_0x5a96('0x10')];return demoLicense;}try{var _0x578e9b=_0xa5796d||_0x642068[_0x5a96('0x11')];if(_['isEmpty'](_0x578e9b)){throw new Error(_0x5a96('0x12'));}var _0x33c574=_0x642068[_0x5a96('0x10')];var _0x23c6e0=_0x642068['data2'];var _0x30c694=_0x33c574[_0x5a96('0x13')]('-')[0x4];var _0x470cfc=_0x33c574[_0x5a96('0x13')]('-')[0x0];var _0x1a6e4a=encryptor[_0x5a96('0x14')](_0x578e9b,util['format']('%s:%s:%s',_0x30c694,_0x33c574,_0x470cfc));var _0xc34ef1=JSON[_0x5a96('0x15')](_0x1a6e4a);_0xc34ef1[_0x5a96('0x16')]=![];_0xc34ef1[_0x5a96('0xf')]=_0x33c574;_0xc34ef1['machineUuid']=hardware[_0x5a96('0x9')]();if(_0x23c6e0){var _0x9950b5=encryptor['decryptString'](_0x23c6e0);_0xc34ef1[_0x5a96('0x17')]=_0x9950b5;_0xc34ef1[_0x5a96('0x18')]=moment(_0x9950b5)[_0x5a96('0x19')](0x7,_0x5a96('0x1a'))[_0x5a96('0x1b')]();_0xc34ef1[_0x5a96('0x1c')]=_0xc34ef1[_0x5a96('0xf')]!=_0xc34ef1['machineUuid']?_0x5a96('0x1d'):_0x5a96('0x1e');}return _0xc34ef1;}catch(_0x522c34){breakingLicense[_0x5a96('0xf')]=_0x642068[_0x5a96('0x10')];breakingLicense[_0x5a96('0x1f')]=_0x522c34[_0x5a96('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x373ece,_0xaaf272){getLicense()[_0x5a96('0xd')](function(_0x49bb48){return db[_0x5a96('0x20')]['findAll']({'attributes':[_0x5a96('0x21'),[db[_0x5a96('0x22')]['fn'](_0x5a96('0x23'),db[_0x5a96('0x22')][_0x5a96('0x24')](_0x5a96('0x21'))),_0x5a96('0x25')]],'group':_0x5a96('0x21'),'where':{'role':{'$or':[_0x5a96('0x26'),_0x5a96('0x27'),_0x5a96('0x28')]}},'raw':!![]})[_0x5a96('0xd')](function(_0x39cb78){var _0x4272fa={'user':_0x49bb48[_0x5a96('0x29')]||0x0,'telephone':_0x49bb48['telephones']||0x0};_0x39cb78[_0x5a96('0x2a')](function(_0x4675f5){var _0x67fa79=_0x4675f5['role']===_0x5a96('0x26')?_0x5a96('0x27'):_0x4675f5['role'];_0x4272fa[_0x67fa79]-=_0x4675f5['count'];if(_0x4272fa[_0x67fa79]<0x0)_0x4272fa[_0x67fa79]=0x0;});_0x373ece(_0x4272fa);return;});})['catch'](function(_0x342325){_0xaaf272(_0x342325);});});}function checkUserLimits(_0x2de756){return new BPromise(function(_0x325622,_0x51c114){getLimits()[_0x5a96('0xd')](function(_0x161119){var _0x1c15c9=_[_0x5a96('0x2b')](_['countBy'](_0x2de756,'role'),['admin',_0x5a96('0x27'),_0x5a96('0x28')]);var _0x101740=(_0x1c15c9['admin']||0x0)+(_0x1c15c9[_0x5a96('0x27')]||0x0);var _0x15f89a=_0x1c15c9[_0x5a96('0x28')]||0x0;if(_0x101740>_0x161119['user'])return _0x51c114('License\x20limit\x20reached\x20for\x20users');if(_0x15f89a>_0x161119[_0x5a96('0x28')])return _0x51c114(_0x5a96('0x2c'));return _0x325622();})['catch'](function(_0x3c6008){_0x51c114(_0x3c6008);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5b92=['split','format','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','user','telephone','telephones','forEach','count','catch','pick','countBy','admin','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2'];(function(_0x1afe96,_0x2dfdf4){var _0x44df93=function(_0x5f0539){while(--_0x5f0539){_0x1afe96['push'](_0x1afe96['shift']());}};_0x44df93(++_0x2dfdf4);}(_0x5b92,0xb0));var _0x25b9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x5b92[_0x56482c];return _0x5aae7a;};'use strict';var util=require(_0x25b9('0x0'));var _=require(_0x25b9('0x1'));var moment=require(_0x25b9('0x2'));var BPromise=require(_0x25b9('0x3'));var hardware=require(_0x25b9('0x4'));var encryptor=require(_0x25b9('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x25b9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x25b9('0x7'),'machineUuid':hardware[_0x25b9('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x25b9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x25b9('0x9'),'machineUuid':hardware[_0x25b9('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5e3689){return new BPromise(function(_0x139dd6,_0x50e33c){return db[_0x25b9('0xa')][_0x25b9('0xb')](_[_0x25b9('0xc')](_0x5e3689,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x54c868){return checkLicense(_0x54c868,null);})[_0x25b9('0xd')](function(_0x1f3a09){_0x139dd6(_0x1f3a09);return;})['catch'](function(_0xbfe597){_0x50e33c(_0xbfe597);});});}function checkLicense(_0x2c7c59,_0x1fc31e){if(!_0x2c7c59){demoLicense[_0x25b9('0xe')]=_0x2c7c59[_0x25b9('0xf')];return demoLicense;}try{var _0x5a0520=_0x1fc31e||_0x2c7c59[_0x25b9('0x10')];if(_[_0x25b9('0x11')](_0x5a0520)){throw new Error(_0x25b9('0x12'));}var _0x46a668=_0x2c7c59['data1'];var _0x57ab7c=_0x2c7c59[_0x25b9('0x13')];var _0x4a29e9=_0x46a668[_0x25b9('0x14')]('-')[0x4];var _0x5f3af2=_0x46a668['split']('-')[0x0];var _0x400d37=encryptor['decryptString'](_0x5a0520,util[_0x25b9('0x15')](_0x25b9('0x16'),_0x4a29e9,_0x46a668,_0x5f3af2));var _0x5ae931=JSON[_0x25b9('0x17')](_0x400d37);_0x5ae931[_0x25b9('0x18')]=![];_0x5ae931[_0x25b9('0xe')]=_0x46a668;_0x5ae931[_0x25b9('0x19')]=hardware[_0x25b9('0x8')]();if(_0x57ab7c){var _0x5b763b=encryptor[_0x25b9('0x1a')](_0x57ab7c);_0x5ae931[_0x25b9('0x1b')]=_0x5b763b;_0x5ae931['deadline']=moment(_0x5b763b)['add'](0x7,_0x25b9('0x1c'))[_0x25b9('0x15')]();_0x5ae931['grayReason']=_0x5ae931[_0x25b9('0xe')]!=_0x5ae931['machineUuid']?_0x25b9('0x1d'):_0x25b9('0x1e');}return _0x5ae931;}catch(_0x3c988b){breakingLicense[_0x25b9('0xe')]=_0x2c7c59[_0x25b9('0xf')];breakingLicense[_0x25b9('0x1f')]=_0x3c988b['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1aab6a,_0x50752d){getLicense()[_0x25b9('0xd')](function(_0x195673){return db[_0x25b9('0x20')][_0x25b9('0x21')]({'attributes':[_0x25b9('0x22'),[db[_0x25b9('0x23')]['fn'](_0x25b9('0x24'),db[_0x25b9('0x23')][_0x25b9('0x25')](_0x25b9('0x22'))),'count']],'group':_0x25b9('0x22'),'where':{'role':{'$or':['admin',_0x25b9('0x26'),_0x25b9('0x27')]}},'raw':!![]})['then'](function(_0x112d6e){var _0x3add92={'user':_0x195673['users']||0x0,'telephone':_0x195673[_0x25b9('0x28')]||0x0};_0x112d6e[_0x25b9('0x29')](function(_0x810346){var _0x2199c3=_0x810346[_0x25b9('0x22')]==='admin'?_0x25b9('0x26'):_0x810346['role'];_0x3add92[_0x2199c3]-=_0x810346[_0x25b9('0x2a')];if(_0x3add92[_0x2199c3]<0x0)_0x3add92[_0x2199c3]=0x0;});_0x1aab6a(_0x3add92);return;});})[_0x25b9('0x2b')](function(_0x2547a1){_0x50752d(_0x2547a1);});});}function checkUserLimits(_0x2fa06a){return new BPromise(function(_0x3bdf67,_0x1b8447){getLimits()[_0x25b9('0xd')](function(_0x41c977){var _0x4dcaa1=_[_0x25b9('0x2c')](_[_0x25b9('0x2d')](_0x2fa06a,_0x25b9('0x22')),[_0x25b9('0x2e'),_0x25b9('0x26'),_0x25b9('0x27')]);var _0x1a88cf=(_0x4dcaa1[_0x25b9('0x2e')]||0x0)+(_0x4dcaa1[_0x25b9('0x26')]||0x0);var _0x46d9e9=_0x4dcaa1['telephone']||0x0;if(_0x1a88cf>_0x41c977['user'])return _0x1b8447(_0x25b9('0x2f'));if(_0x46d9e9>_0x41c977[_0x25b9('0x27')])return _0x1b8447(_0x25b9('0x30'));return _0x3bdf67();})[_0x25b9('0x2b')](function(_0x3abbb2){_0x1b8447(_0x3abbb2);});});}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 c0f2c54..b1e452a 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 _0xa30a=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x29cb4f,_0x26a21d){var _0x51e06d=function(_0x3ce158){while(--_0x3ce158){_0x29cb4f['push'](_0x29cb4f['shift']());}};_0x51e06d(++_0x26a21d);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';module[_0xaa30('0x0')]={'DOMAIN':_0xaa30('0x1'),'SESSION_SECRET':_0xaa30('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xaa30('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x236c=['secret','exports','myappanuglar-secret','app-id'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x236c,0x155));var _0xc236=function(_0xd7ea2a,_0x3ba5fa){_0xd7ea2a=_0xd7ea2a-0x0;var _0x2338f5=_0x236c[_0xd7ea2a];return _0x2338f5;};'use strict';module[_0xc236('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xc236('0x1'),'GOOGLE_ID':_0xc236('0x2'),'GOOGLE_SECRET':_0xc236('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2747c03..7a64c15 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35ec=['error','info','debugLevel','moment','winston','util','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s'];(function(_0xc77e05,_0x2b0b77){var _0x4dc84d=function(_0x30beb9){while(--_0x30beb9){_0xc77e05['push'](_0xc77e05['shift']());}};_0x4dc84d(++_0x2b0b77);}(_0x35ec,0x17a));var _0xc35e=function(_0x296a8f,_0xc2cd79){_0x296a8f=_0x296a8f-0x0;var _0x545d75=_0x35ec[_0x296a8f];return _0x545d75;};'use strict';var moment=require(_0xc35e('0x0'));var winston=require(_0xc35e('0x1'));var util=require(_0xc35e('0x2'));var path=require(_0xc35e('0x3'));var debugLevel=_0xc35e('0x4');function filename(_0x4f5993,_0x3baaa1){return path[_0xc35e('0x5')](_0xc35e('0x6'),_0xc35e('0x7'),_0xc35e('0x8'),util[_0xc35e('0x9')](_0xc35e('0xa'),_0x4f5993,_0x3baaa1));}function formatter(_0xe9c95e,_0x45e94b){_0x45e94b[_0xc35e('0xb')]=_0x45e94b[_0xc35e('0xb')][_0xc35e('0xc')](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0xc35e('0xc')](/@{/g,'{{')[_0xc35e('0xc')](/}@/g,'}}');return util['format'](_0xc35e('0xd'),moment()['format'](_0xc35e('0xe')),_0x45e94b[_0xc35e('0xf')][_0xc35e('0x10')](),_0xe9c95e,_0x45e94b[_0xc35e('0xb')]);}module[_0xc35e('0x11')]=function(_0x1ca91e){return new winston[(_0xc35e('0x12'))]({'transports':[new winston[(_0xc35e('0x13'))][(_0xc35e('0x14'))]({'name':util[_0xc35e('0x9')](_0xc35e('0x15'),_0x1ca91e,_0xc35e('0x16')),'filename':filename(_0x1ca91e,_0xc35e('0x16')),'level':_0xc35e('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x31d695){return formatter(_0x1ca91e,_0x31d695);}}),new winston[(_0xc35e('0x13'))]['File']({'name':util[_0xc35e('0x9')]('%s-%s',_0x1ca91e,'info'),'filename':filename(_0x1ca91e,_0xc35e('0x17')),'level':_0xc35e('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x41d0d4){return formatter(_0x1ca91e,_0x41d0d4);}}),new winston['transports']['Console']({'level':process['env'][_0xc35e('0x18')]||debugLevel,'json':![],'formatter':function(_0x2a6975){return formatter(_0x1ca91e,_0x2a6975);}})]});}; \ No newline at end of file +var _0x5156=['join','/var','log','xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','INFO'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5156,0x1dd));var _0x6515=function(_0x572165,_0x6a45cc){_0x572165=_0x572165-0x0;var _0x8c8709=_0x5156[_0x572165];return _0x8c8709;};'use strict';var moment=require(_0x6515('0x0'));var winston=require(_0x6515('0x1'));var util=require('util');var path=require('path');var debugLevel=_0x6515('0x2');function filename(_0x37b272,_0x944fa){return path[_0x6515('0x3')](_0x6515('0x4'),_0x6515('0x5'),_0x6515('0x6'),util[_0x6515('0x7')](_0x6515('0x8'),_0x37b272,_0x944fa));}function formatter(_0x1af2fb,_0x58fdec){_0x58fdec[_0x6515('0x9')]=_0x58fdec[_0x6515('0x9')][_0x6515('0xa')](/@@{/g,_0x6515('0xb'))[_0x6515('0xa')](/}@@/g,_0x6515('0xc'))[_0x6515('0xa')](/@{/g,'{{')[_0x6515('0xa')](/}@/g,'}}');return util[_0x6515('0x7')](_0x6515('0xd'),moment()['format'](_0x6515('0xe')),_0x58fdec['level']['toUpperCase'](),_0x1af2fb,_0x58fdec[_0x6515('0x9')]);}module['exports']=function(_0x498842){return new winston[(_0x6515('0xf'))]({'transports':[new winston[(_0x6515('0x10'))][(_0x6515('0x11'))]({'name':util[_0x6515('0x7')](_0x6515('0x12'),_0x498842,_0x6515('0x13')),'filename':filename(_0x498842,_0x6515('0x13')),'level':_0x6515('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x567fc5){return formatter(_0x498842,_0x567fc5);}}),new winston['transports'][(_0x6515('0x11'))]({'name':util[_0x6515('0x7')](_0x6515('0x12'),_0x498842,_0x6515('0x14')),'filename':filename(_0x498842,_0x6515('0x14')),'level':_0x6515('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x14f95f){return formatter(_0x498842,_0x14f95f);}}),new winston['transports'][(_0x6515('0x15'))]({'level':process[_0x6515('0x16')][_0x6515('0x17')]||debugLevel,'json':![],'formatter':function(_0x5770eb){return formatter(_0x498842,_0x5770eb);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 44eabf1..03efbac 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 _0xeeeb=['ami','join','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','../../services/express/index.js'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0xeeeb,0x141));var _0xbeee=function(_0x12ab29,_0x118533){_0x12ab29=_0x12ab29-0x0;var _0x34550d=_0xeeeb[_0x12ab29];return _0x34550d;};'use strict';var path=require(_0xbeee('0x0'));var os=require('os');var config={'apps':[{'name':_0xbeee('0x1'),'script':path['join'](__dirname,_0xbeee('0x2'))},{'name':_0xbeee('0x3'),'script':path[_0xbeee('0x4')](__dirname,'../../services/ami/index.js')},{'name':_0xbeee('0x5'),'script':path[_0xbeee('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0xbeee('0x6'),'script':path['join'](__dirname,_0xbeee('0x7'))},{'name':_0xbeee('0x8'),'script':path[_0xbeee('0x4')](__dirname,_0xbeee('0x9'))},{'name':_0xbeee('0xa'),'script':path[_0xbeee('0x4')](__dirname,_0xbeee('0xb'))}]};module['exports']=config; \ No newline at end of file +var _0x28b5=['../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x28b5,0x118));var _0x528b=function(_0x1a3052,_0x2411ce){_0x1a3052=_0x1a3052-0x0;var _0x19b0a5=_0x28b5[_0x1a3052];return _0x19b0a5;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x528b('0x0'),'script':path[_0x528b('0x1')](__dirname,_0x528b('0x2'))},{'name':_0x528b('0x3'),'script':path[_0x528b('0x1')](__dirname,_0x528b('0x4'))},{'name':_0x528b('0x5'),'script':path[_0x528b('0x1')](__dirname,_0x528b('0x6'))},{'name':'email','script':path[_0x528b('0x1')](__dirname,_0x528b('0x7'))},{'name':_0x528b('0x8'),'script':path[_0x528b('0x1')](__dirname,_0x528b('0x9'))},{'name':_0x528b('0xa'),'script':path[_0x528b('0x1')](__dirname,_0x528b('0xb'))}]};module[_0x528b('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ce41544..1f0a8ff 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 _0x725a=['pm2','bluebird','./config','connect','start','stop','then','disconnect','restart','list','describe','delete','dump'];(function(_0x2e039a,_0xdae0ab){var _0x4a50b2=function(_0x4e83e5){while(--_0x4e83e5){_0x2e039a['push'](_0x2e039a['shift']());}};_0x4a50b2(++_0xdae0ab);}(_0x725a,0x12b));var _0xa725=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x725a[_0x57a50d];return _0x1b25b3;};'use strict';var pm2=require(_0xa725('0x0'));var BPromise=require(_0xa725('0x1'));var config=require(_0xa725('0x2'));function connect(){return new BPromise(function(_0x3c30ae,_0x3f800e){return pm2[_0xa725('0x3')](function(_0x2be1f0){if(_0x2be1f0){return _0x3f800e(_0x2be1f0);}return _0x3c30ae('connected');});});};exports[_0xa725('0x4')]=function(_0x15eccf){return connect()['then'](function(){return new BPromise(function(_0x33c3e0,_0x209b10){return pm2[_0xa725('0x4')](_0x15eccf,function(_0x5bc125,_0x5a887f){if(_0x5bc125){return _0x209b10(_0x5bc125);}pm2['disconnect']();return _0x33c3e0(_0x5a887f);});});});};exports[_0xa725('0x5')]=function(_0x22246f){return connect()[_0xa725('0x6')](function(){return new BPromise(function(_0x574823,_0x4705fe){return pm2['stop'](_0x22246f,function(_0x5c6662,_0x587bc3){if(_0x5c6662){return _0x4705fe(_0x5c6662);}pm2[_0xa725('0x7')]();return _0x574823(_0x587bc3);});});});};exports['restart']=function(_0x3fa908){return connect()['then'](function(){return new BPromise(function(_0x11091c,_0x49968c){return pm2[_0xa725('0x8')](_0x3fa908,function(_0x3cf2f6,_0x4f103f){if(_0x3cf2f6){return _0x49968c(_0x3cf2f6);}pm2[_0xa725('0x7')]();return _0x11091c(_0x4f103f);});});});};exports[_0xa725('0x9')]=function(){return connect()[_0xa725('0x6')](function(){return new BPromise(function(_0x1279ba,_0x2014d1){return pm2[_0xa725('0x9')](function(_0x20e8f9,_0x155b37){if(_0x20e8f9){return _0x2014d1(_0x20e8f9);}pm2['disconnect']();return _0x1279ba(_0x155b37);});});});};exports[_0xa725('0xa')]=function(_0x5d4e33){return connect()['then'](function(){return new BPromise(function(_0x7dd145,_0x110918){return pm2[_0xa725('0xa')](_0x5d4e33,function(_0x22083b,_0x4aa938){if(_0x22083b){return _0x110918(_0x22083b);}pm2[_0xa725('0x7')]();return _0x7dd145(_0x4aa938);});});});};exports['delete']=function(_0x3e0f11){return connect()[_0xa725('0x6')](function(){return new BPromise(function(_0x3ce6ec,_0x4b6d88){return pm2[_0xa725('0xb')](_0x3e0f11,function(_0xbe35ae,_0x4c8b79){if(_0xbe35ae){return _0x4b6d88(_0xbe35ae);}pm2[_0xa725('0x7')]();return _0x3ce6ec(_0x4c8b79);});});});};exports[_0xa725('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x25f566,_0xd8e11f){return pm2[_0xa725('0xc')](function(_0x11e08b){if(_0x11e08b){return _0xd8e11f(_0x11e08b);}return _0x25f566('saved');});});});}; \ No newline at end of file +var _0x4b81=['delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','describe'];(function(_0x3950fd,_0x288896){var _0x2b0fe5=function(_0x1d1c4b){while(--_0x1d1c4b){_0x3950fd['push'](_0x3950fd['shift']());}};_0x2b0fe5(++_0x288896);}(_0x4b81,0x1d1));var _0x14b8=function(_0x433b9c,_0x16500a){_0x433b9c=_0x433b9c-0x0;var _0x12a1ed=_0x4b81[_0x433b9c];return _0x12a1ed;};'use strict';var pm2=require(_0x14b8('0x0'));var BPromise=require(_0x14b8('0x1'));var config=require(_0x14b8('0x2'));function connect(){return new BPromise(function(_0x4f7ecb,_0x11dd8b){return pm2[_0x14b8('0x3')](function(_0xb54bea){if(_0xb54bea){return _0x11dd8b(_0xb54bea);}return _0x4f7ecb(_0x14b8('0x4'));});});};exports[_0x14b8('0x5')]=function(_0x58f841){return connect()[_0x14b8('0x6')](function(){return new BPromise(function(_0x4d4e80,_0x411b5f){return pm2[_0x14b8('0x5')](_0x58f841,function(_0xded216,_0x2c6998){if(_0xded216){return _0x411b5f(_0xded216);}pm2[_0x14b8('0x7')]();return _0x4d4e80(_0x2c6998);});});});};exports[_0x14b8('0x8')]=function(_0x1befce){return connect()[_0x14b8('0x6')](function(){return new BPromise(function(_0x285c17,_0x3b63bc){return pm2[_0x14b8('0x8')](_0x1befce,function(_0x7d0e9c,_0x93e704){if(_0x7d0e9c){return _0x3b63bc(_0x7d0e9c);}pm2[_0x14b8('0x7')]();return _0x285c17(_0x93e704);});});});};exports[_0x14b8('0x9')]=function(_0x2487e8){return connect()['then'](function(){return new BPromise(function(_0x4cd263,_0xec407c){return pm2[_0x14b8('0x9')](_0x2487e8,function(_0x4c98d4,_0x1a981a){if(_0x4c98d4){return _0xec407c(_0x4c98d4);}pm2[_0x14b8('0x7')]();return _0x4cd263(_0x1a981a);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x4f5a74,_0x4014f6){return pm2['list'](function(_0x16535d,_0x361ce5){if(_0x16535d){return _0x4014f6(_0x16535d);}pm2[_0x14b8('0x7')]();return _0x4f5a74(_0x361ce5);});});});};exports['describe']=function(_0x356b9f){return connect()['then'](function(){return new BPromise(function(_0x41cc3b,_0x272173){return pm2[_0x14b8('0xa')](_0x356b9f,function(_0x5f4699,_0x5d96b6){if(_0x5f4699){return _0x272173(_0x5f4699);}pm2['disconnect']();return _0x41cc3b(_0x5d96b6);});});});};exports['delete']=function(_0x1802e5){return connect()[_0x14b8('0x6')](function(){return new BPromise(function(_0xef9948,_0x190632){return pm2[_0x14b8('0xb')](_0x1802e5,function(_0x4acc4b,_0x46b6e1){if(_0x4acc4b){return _0x190632(_0x4acc4b);}pm2['disconnect']();return _0xef9948(_0x46b6e1);});});});};exports[_0x14b8('0xc')]=function(){return connect()[_0x14b8('0x6')](function(){return new BPromise(function(_0x5bc087,_0x6ba9df){return pm2[_0x14b8('0xc')](function(_0x3e5996){if(_0x3e5996){return _0x6ba9df(_0x3e5996);}return _0x5bc087(_0x14b8('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4c6419e..8371233 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 _0xc35c=['schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','lastMsgAt','minutes','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc35c,0xdb));var _0xcc35=function(_0x59bde6,_0x594345){_0x59bde6=_0x59bde6-0x0;var _0x4557cc=_0xc35c[_0x59bde6];return _0x4557cc;};'use strict';var _=require(_0xcc35('0x0'));var moment=require(_0xcc35('0x1'));var Redis=require(_0xcc35('0x2'));var util=require('util');var config=require(_0xcc35('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xcc35('0x4'))(_0xcc35('0x5'));config[_0xcc35('0x6')]=_[_0xcc35('0x7')](config[_0xcc35('0x6')],{'host':_0xcc35('0x8'),'port':0x18eb});var io=require(_0xcc35('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x196fd7=0x0;var _0x306dd6=[];return db[_0xcc35('0xa')][_0xcc35('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xcc35('0xc')](function(_0x41e51a){_0x196fd7=_0x41e51a[_0xcc35('0xd')];if(_0x196fd7){return db[_0xcc35('0xe')]['findAll']({'raw':!![],'attributes':['id',_0xcc35('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x41e51a['chatTimeout'],_0xcc35('0x10'))}}});}else{return[];}})[_0xcc35('0xc')](function(_0x808090){if(_0x808090&&_0x808090['length']){_0x306dd6=_[_0xcc35('0x11')](_0x808090||[],'id');logger[_0xcc35('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x306dd6[_0xcc35('0x13')]());return db[_0xcc35('0xe')][_0xcc35('0x14')]({'closeReason':_0xcc35('0x15'),'disposition':_0xcc35('0x16'),'closed':!![],'closedAt':moment()[_0xcc35('0x17')](_0xcc35('0x18'))},{'where':{'id':_0x306dd6}});}})['then'](function(){if(_0x306dd6&&_0x306dd6[_0xcc35('0x19')]){logger[_0xcc35('0x12')](_0xcc35('0x1a'),_0x306dd6[_0xcc35('0x13')]());for(var _0x61f5ef=0x0;_0x61f5ef<_0x306dd6['length'];_0x61f5ef++){io['emit']('chatInteraction:update',{'id':_0x306dd6[_0x61f5ef],'closed':!![]});}}})[_0xcc35('0x1b')](function(_0x38ec44){logger[_0xcc35('0x1c')](_0xcc35('0x1d'),_0x38ec44?util[_0xcc35('0x1e')](_0x38ec44,{'showHidden':![],'depth':null}):'');});}exports[_0xcc35('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa985=['moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xa985,0x1a3));var _0x5a98=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xa985[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x5a98('0x0'));var moment=require(_0x5a98('0x1'));var Redis=require(_0x5a98('0x2'));var util=require('util');var config=require(_0x5a98('0x3'));var db=require(_0x5a98('0x4'))['db'];var logger=require(_0x5a98('0x5'))(_0x5a98('0x6'));config[_0x5a98('0x7')]=_[_0x5a98('0x8')](config[_0x5a98('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5a98('0x7')]));function closeInteractions(){var _0x213d5e=0x0;var _0x200474=[];return db[_0x5a98('0x9')][_0x5a98('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x5a98('0xb')](function(_0x28a803){_0x213d5e=_0x28a803[_0x5a98('0xc')];if(_0x213d5e){return db[_0x5a98('0xd')][_0x5a98('0xe')]({'raw':!![],'attributes':['id',_0x5a98('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5a98('0x10')](_0x28a803[_0x5a98('0xc')],_0x5a98('0x11'))}}});}else{return[];}})[_0x5a98('0xb')](function(_0x3db046){if(_0x3db046&&_0x3db046[_0x5a98('0x12')]){_0x200474=_['map'](_0x3db046||[],'id');logger[_0x5a98('0x13')](_0x5a98('0x14'),_0x200474[_0x5a98('0x15')]());return db[_0x5a98('0xd')][_0x5a98('0x16')]({'closeReason':_0x5a98('0x17'),'disposition':_0x5a98('0x18'),'closed':!![],'closedAt':moment()[_0x5a98('0x19')](_0x5a98('0x1a'))},{'where':{'id':_0x200474}});}})['then'](function(){if(_0x200474&&_0x200474[_0x5a98('0x12')]){logger[_0x5a98('0x13')](_0x5a98('0x1b'),_0x200474[_0x5a98('0x15')]());for(var _0x4cf406=0x0;_0x4cf406<_0x200474[_0x5a98('0x12')];_0x4cf406++){io[_0x5a98('0x1c')](_0x5a98('0x1d'),{'id':_0x200474[_0x4cf406],'closed':!![]});}}})[_0x5a98('0x1e')](function(_0x3ae4a9){logger[_0x5a98('0x1f')](_0x5a98('0x20'),_0x3ae4a9?util[_0x5a98('0x21')](_0x3ae4a9,{'showHidden':![],'depth':null}):'');});}exports[_0x5a98('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index caffc2a..e0d1e08 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 _0x566f=['MailServerOut','keys','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','stop\x20cron','active','update','update\x20cron','run','util','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','user','pass','\x22%s\x22\x20<%s>','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','../../files/reports','savename','%s.%s','basename','extname','join','existsSync','status','message','stringify','Sent','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','error','email\x20sent','catch','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','exec\x20defaul\x20report\x20id:%s','DefaultReportId','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule'];(function(_0x44748e,_0x5254c1){var _0x1287f5=function(_0x2e6afe){while(--_0x2e6afe){_0x44748e['push'](_0x44748e['shift']());}};_0x1287f5(++_0x5254c1);}(_0x566f,0x1d9));var _0xf566=function(_0x3ab593,_0x47a446){_0x3ab593=_0x3ab593-0x0;var _0x2eca2b=_0x566f[_0x3ab593];return _0x2eca2b;};'use strict';var fs=require('fs');var util=require(_0xf566('0x0'));var path=require('path');var _=require(_0xf566('0x1'));var moment=require('moment');var CronJobManager=require(_0xf566('0x2'));var jayson=require(_0xf566('0x3'));var BPromise=require(_0xf566('0x4'));var logger=require(_0xf566('0x5'))(_0xf566('0x6'));var db=require(_0xf566('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xf566('0x8'));var client=jayson[_0xf566('0x9')][_0xf566('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4279cb,_0x5e7984){return function(){logger[_0xf566('0xb')](_0xf566('0xc'),_0x4279cb[_0xf566('0xd')]);var _0x142be0=!![];var _0x37df86={'tls':{'rejectUnauthorized':![]}};if(_0x4279cb[_0xf566('0xe')][_0xf566('0xf')][_0xf566('0x10')]){_0x37df86[_0xf566('0x10')]=_0x4279cb[_0xf566('0xe')][_0xf566('0xf')][_0xf566('0x10')];}else{_0x37df86['host']=_0x4279cb[_0xf566('0xe')]['Smtp'][_0xf566('0x11')];_0x37df86['port']=_0x4279cb[_0xf566('0xe')][_0xf566('0xf')][_0xf566('0x12')];_0x37df86['secure']=_0x4279cb[_0xf566('0xe')][_0xf566('0xf')][_0xf566('0x13')];}if(_0x4279cb[_0xf566('0xe')][_0xf566('0xf')]['authentication']){_0x37df86['auth']={'user':_0x4279cb['MailAccount'][_0xf566('0xf')][_0xf566('0x14')],'pass':_0x4279cb['MailAccount'][_0xf566('0xf')][_0xf566('0x15')]};}var _0x484f14={'account':_0x37df86,'message':{'from':util['format'](_0xf566('0x16'),_0x4279cb[_0xf566('0xe')][_0xf566('0x17')],_0x4279cb[_0xf566('0xe')][_0xf566('0xd')]||_0x4279cb[_0xf566('0xe')]['Smtp'][_0xf566('0x14')]),'to':_0x4279cb[_0xf566('0xd')],'cc':_0x4279cb['cc'],'bcc':_0x4279cb[_0xf566('0x18')],'subject':util[_0xf566('0x19')](_0xf566('0x1a'),_0x5e7984[_0xf566('0x17')],_0x4279cb[_0xf566('0x1b')],_0x4279cb['subtractUnit'])}};var _0x39baa4=path['join'](__dirname,_0xf566('0x1c'));var _0x269959=_0x5e7984[_0xf566('0x1d')];var _0x57cc85=util[_0xf566('0x19')](_0xf566('0x1e'),path[_0xf566('0x1f')](_0x5e7984[_0xf566('0x1d')],path[_0xf566('0x20')](_0x5e7984['savename'])),'zip');var _0x283e58=path[_0xf566('0x21')](_0x39baa4,_0x269959);var _0x887edc=path[_0xf566('0x21')](_0x39baa4,_0x57cc85);if(fs[_0xf566('0x22')](_0x283e58)){_0x5e7984[_0xf566('0x23')]='Sent';_0x484f14['message']['attachments']=[{'filename':_0x269959,'path':_0x283e58}];_0x484f14[_0xf566('0x24')]['text']=util[_0xf566('0x19')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xf566('0x25')](_0x5e7984,null,0x2));}else if(fs[_0xf566('0x22')](_0x887edc)){_0x5e7984[_0xf566('0x23')]=_0xf566('0x26');_0x484f14[_0xf566('0x24')][_0xf566('0x27')]=[{'filename':_0x57cc85,'path':_0x887edc}];}else{_0x484f14[_0xf566('0x24')][_0xf566('0x28')]=_0xf566('0x29');if(!_0x4279cb[_0xf566('0x2a')]){_0x142be0=![];logger['info'](_0xf566('0x2b'));}}if(_0x142be0){return client['request'](_0xf566('0x2c'),_0x484f14)['then'](function(_0x24b2d0){if(_0x24b2d0[_0xf566('0x2d')]){return logger[_0xf566('0x2d')]('error\x20mail',JSON['stringify'](_0x24b2d0));}return logger[_0xf566('0xb')](_0xf566('0x2e'));})[_0xf566('0x2f')](function(_0x53d765){return logger['error'](_0xf566('0x30'),JSON[_0xf566('0x25')](_0x53d765));});}};}function handleError(){return function(_0x3f4700){return logger[_0xf566('0x2d')](JSON[_0xf566('0x25')](_0x3f4700));};}function handleResult(_0x19ed11){return function(_0x19a5c0){logger['info']('data',JSON[_0xf566('0x25')](_0x19a5c0));if(_0x19ed11[_0xf566('0xe')]&&_0x19ed11[_0xf566('0xe')][_0xf566('0xf')]&&!_[_0xf566('0x31')](_0x19ed11[_0xf566('0xd')])){setTimeout(handleSendEmail(_0x19ed11,_0x19a5c0),0x3c*0x3e8);}};}function handleJob(_0x3b23f3){return function(){try{if(_['isNil'](_0x3b23f3[_0xf566('0x1b')])){return logger[_0xf566('0xb')](_0xf566('0x32'));}if(_[_0xf566('0x31')](_0x3b23f3[_0xf566('0x33')])){return logger[_0xf566('0xb')](_0xf566('0x34'));}var _0x3e712b={'startDate':moment()['subtract'](_0x3b23f3[_0xf566('0x1b')],_0x3b23f3[_0xf566('0x33')])[_0xf566('0x19')](_0xf566('0x35')),'endDate':moment()['format'](_0xf566('0x35')),'type':'scheduled','output':_0x3b23f3['output'],'name':_0x3b23f3['name']};if(!_[_0xf566('0x31')](_0x3b23f3['DefaultReportId'])){logger[_0xf566('0xb')](_0xf566('0x36'),_0x3b23f3[_0xf566('0x37')]);return analyticDefaultReportController['runReport']({'id':_0x3b23f3['DefaultReportId']},_0x3e712b)[_0xf566('0x38')](handleResult(_0x3b23f3))['catch'](handleError());}if(!_[_0xf566('0x31')](_0x3b23f3[_0xf566('0x39')])){logger[_0xf566('0xb')](_0xf566('0x3a'),_0x3b23f3[_0xf566('0x39')]);return analyticCustomReportController['runReport']({'id':_0x3b23f3[_0xf566('0x39')]},_0x3e712b)[_0xf566('0x38')](handleResult(_0x3b23f3))[_0xf566('0x2f')](handleError());}}catch(_0x4a396e){logger[_0xf566('0x2d')](JSON['stringify'](_0x4a396e));}return logger[_0xf566('0xb')](_0xf566('0x3b'));};}function getJobs(_0x362189){var _0x1db9a5={};if(_0x362189){_0x1db9a5['id']=_0x362189;}return db[_0xf566('0x3c')]['findAll']({'where':_0x1db9a5,'include':[{'model':db[_0xf566('0xe')],'attributes':['id',_0xf566('0x17'),_0xf566('0xd')],'include':[{'model':db[_0xf566('0x3d')],'as':'Smtp'}]}]})[_0xf566('0x38')](function(_0x1b1bc9){var _0x5dae54=_[_0xf566('0x3e')](manager[_0xf566('0x3f')]);var _0x520b7c=_[_0xf566('0x40')](_0x1b1bc9,function(_0x1ddfaf){return _0x1ddfaf['id'][_0xf566('0x41')]();});var _0x23409d=_[_0xf566('0x42')](_0x1b1bc9,function(_0x4db7ff){return _0x4db7ff['id']['toString']();});var _0x4ef30d=_0x362189?_0x520b7c:_[_0xf566('0x43')](_0x520b7c,_0x5dae54);var _0x534ac7=_['intersection'](_0x520b7c,_0x5dae54);var _0x5b67d9=_[_0xf566('0x43')](_0x5dae54,_0x520b7c);var _0xa882e7;var _0x389104;for(_0xa882e7=0x0;_0xa882e7<_0x5b67d9[_0xf566('0x44')]&&!_0x362189;_0xa882e7+=0x1){_0x389104=_0x5b67d9[_0xa882e7][_0xf566('0x41')]();if(manager[_0xf566('0x45')](_0x389104)){manager[_0xf566('0x46')](_0x389104);manager[_0xf566('0x47')](_0x389104);logger[_0xf566('0xb')](_0xf566('0x48'),_0x389104);}}logger[_0xf566('0xb')](_0xf566('0x49'),JSON[_0xf566('0x25')](_0x4ef30d));for(_0xa882e7=0x0;_0xa882e7<_0x4ef30d['length'];_0xa882e7+=0x1){_0x389104=_0x4ef30d[_0xa882e7][_0xf566('0x41')]();logger[_0xf566('0xb')](_0xf566('0x4a'),_0x389104);if(_0x362189){logger[_0xf566('0xb')](_0xf566('0x4b'),_0x362189);logger[_0xf566('0xb')](JSON[_0xf566('0x25')](_0x23409d[_0x389104]));BPromise[_0xf566('0x4c')]()['then'](handleJob(_0x23409d[_0x389104]));logger['info'](_0xf566('0x4d'),_0x23409d[_0x389104][_0xf566('0x17')],_0x23409d[_0x389104][_0xf566('0x4e')]);}else if(_0x23409d[_0x389104]['cron']&&_0x23409d[_0x389104]['active']&&moment()[_0xf566('0x4f')](_0x23409d[_0x389104][_0xf566('0x50')],_0x23409d[_0x389104][_0xf566('0x51')])){manager[_0xf566('0x52')](_0x389104,_0x23409d[_0x389104][_0xf566('0x4e')],handleJob(_0x23409d[_0x389104]));manager[_0xf566('0x53')](_0x389104);logger[_0xf566('0xb')]('add\x20cron',_0x23409d[_0x389104][_0xf566('0x17')],_0x23409d[_0x389104][_0xf566('0x4e')]);}else if(manager[_0xf566('0x45')](_0x389104)){manager[_0xf566('0x46')](_0x389104);manager[_0xf566('0x47')](_0x389104);logger[_0xf566('0xb')](_0xf566('0x54'),_0x23409d[_0x389104][_0xf566('0x17')],_0x23409d[_0x389104][_0xf566('0x4e')]);}}for(_0xa882e7=0x0,_0x389104;_0xa882e7<_0x534ac7[_0xf566('0x44')]&&!_0x362189;_0xa882e7+=0x1){_0x389104=_0x534ac7[_0xa882e7][_0xf566('0x41')]();if(manager['exists'](_0x389104)){if(_0x23409d[_0x389104]['cron']&&_0x23409d[_0x389104][_0xf566('0x55')]&&moment()['isBetween'](_0x23409d[_0x389104][_0xf566('0x50')],_0x23409d[_0x389104][_0xf566('0x51')])){manager[_0xf566('0x56')](_0x389104,_0x23409d[_0x389104][_0xf566('0x4e')],handleJob(_0x23409d[_0x389104]));logger[_0xf566('0xb')](_0xf566('0x57'),_0x23409d[_0x389104]['name'],_0x23409d[_0x389104][_0xf566('0x4e')]);}else{manager[_0xf566('0x46')](_0x389104);manager['deleteJob'](_0x389104);logger['info'](_0xf566('0x54'),_0x23409d[_0x389104][_0xf566('0x17')],_0x23409d[_0x389104][_0xf566('0x4e')]);}}}})[_0xf566('0x2f')](function(_0x34ce8f){logger[_0xf566('0x2d')](JSON[_0xf566('0x25')](_0x34ce8f));});}exports[_0xf566('0x58')]=function(_0xe73722){return getJobs(_0xe73722);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8a27=['\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','findAll','MailServerOut','keys','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','isBetween','startAt','add','add\x20cron','exists','stop\x20cron','active','endAt','update','update\x20cron','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','user','pass','format'];(function(_0x48ef90,_0x5c78ec){var _0x38a46b=function(_0x538113){while(--_0x538113){_0x48ef90['push'](_0x48ef90['shift']());}};_0x38a46b(++_0x5c78ec);}(_0x8a27,0x155));var _0x78a2=function(_0x5b5b27,_0x46cc6a){_0x5b5b27=_0x5b5b27-0x0;var _0x10f039=_0x8a27[_0x5b5b27];return _0x10f039;};'use strict';var fs=require('fs');var util=require(_0x78a2('0x0'));var path=require(_0x78a2('0x1'));var _=require(_0x78a2('0x2'));var moment=require('moment');var CronJobManager=require(_0x78a2('0x3'));var jayson=require(_0x78a2('0x4'));var BPromise=require(_0x78a2('0x5'));var logger=require(_0x78a2('0x6'))(_0x78a2('0x7'));var db=require(_0x78a2('0x8'))['db'];var analyticCustomReportController=require(_0x78a2('0x9'));var analyticDefaultReportController=require(_0x78a2('0xa'));var client=jayson['client'][_0x78a2('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x220935,_0x25e316){return function(){logger[_0x78a2('0xc')](_0x78a2('0xd'),_0x220935['email']);var _0x8a09fe=!![];var _0x3053f7={'tls':{'rejectUnauthorized':![]}};if(_0x220935[_0x78a2('0xe')][_0x78a2('0xf')]['service']){_0x3053f7[_0x78a2('0x10')]=_0x220935[_0x78a2('0xe')][_0x78a2('0xf')]['service'];}else{_0x3053f7[_0x78a2('0x11')]=_0x220935[_0x78a2('0xe')][_0x78a2('0xf')][_0x78a2('0x11')];_0x3053f7[_0x78a2('0x12')]=_0x220935['MailAccount'][_0x78a2('0xf')][_0x78a2('0x12')];_0x3053f7['secure']=_0x220935['MailAccount'][_0x78a2('0xf')][_0x78a2('0x13')];}if(_0x220935[_0x78a2('0xe')]['Smtp']['authentication']){_0x3053f7['auth']={'user':_0x220935[_0x78a2('0xe')][_0x78a2('0xf')][_0x78a2('0x14')],'pass':_0x220935['MailAccount'][_0x78a2('0xf')][_0x78a2('0x15')]};}var _0x301c62={'account':_0x3053f7,'message':{'from':util[_0x78a2('0x16')](_0x78a2('0x17'),_0x220935['MailAccount'][_0x78a2('0x18')],_0x220935[_0x78a2('0xe')][_0x78a2('0x19')]||_0x220935[_0x78a2('0xe')][_0x78a2('0xf')][_0x78a2('0x14')]),'to':_0x220935['email'],'cc':_0x220935['cc'],'bcc':_0x220935[_0x78a2('0x1a')],'subject':util[_0x78a2('0x16')](_0x78a2('0x1b'),_0x25e316[_0x78a2('0x18')],_0x220935[_0x78a2('0x1c')],_0x220935[_0x78a2('0x1d')])}};var _0x3411e3=path['join'](__dirname,'../../files/reports');var _0x293c88=_0x25e316[_0x78a2('0x1e')];var _0xc7175f=util[_0x78a2('0x16')](_0x78a2('0x1f'),path[_0x78a2('0x20')](_0x25e316[_0x78a2('0x1e')],path[_0x78a2('0x21')](_0x25e316['savename'])),_0x78a2('0x22'));var _0xd25b3a=path[_0x78a2('0x23')](_0x3411e3,_0x293c88);var _0x1b0b73=path[_0x78a2('0x23')](_0x3411e3,_0xc7175f);if(fs[_0x78a2('0x24')](_0xd25b3a)){_0x25e316[_0x78a2('0x25')]=_0x78a2('0x26');_0x301c62[_0x78a2('0x27')][_0x78a2('0x28')]=[{'filename':_0x293c88,'path':_0xd25b3a}];_0x301c62['message'][_0x78a2('0x29')]=util[_0x78a2('0x16')](_0x78a2('0x2a'),JSON[_0x78a2('0x2b')](_0x25e316,null,0x2));}else if(fs[_0x78a2('0x24')](_0x1b0b73)){_0x25e316[_0x78a2('0x25')]=_0x78a2('0x26');_0x301c62['message'][_0x78a2('0x28')]=[{'filename':_0xc7175f,'path':_0x1b0b73}];}else{_0x301c62['message'][_0x78a2('0x29')]=_0x78a2('0x2c');if(!_0x220935[_0x78a2('0x2d')]){_0x8a09fe=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x8a09fe){return client[_0x78a2('0x2e')](_0x78a2('0x2f'),_0x301c62)[_0x78a2('0x30')](function(_0x3b981e){if(_0x3b981e[_0x78a2('0x31')]){return logger['error'](_0x78a2('0x32'),JSON['stringify'](_0x3b981e));}return logger[_0x78a2('0xc')]('email\x20sent');})['catch'](function(_0x504af7){return logger['error'](_0x78a2('0x32'),JSON['stringify'](_0x504af7));});}};}function handleError(){return function(_0x94cd0d){return logger[_0x78a2('0x31')](JSON['stringify'](_0x94cd0d));};}function handleResult(_0x2f18d4){return function(_0x3e2627){logger['info'](_0x78a2('0x33'),JSON['stringify'](_0x3e2627));if(_0x2f18d4[_0x78a2('0xe')]&&_0x2f18d4[_0x78a2('0xe')][_0x78a2('0xf')]&&!_[_0x78a2('0x34')](_0x2f18d4[_0x78a2('0x19')])){setTimeout(handleSendEmail(_0x2f18d4,_0x3e2627),0x3c*0x3e8);}};}function handleJob(_0x134e5c){return function(){try{if(_[_0x78a2('0x34')](_0x134e5c['subtractNumber'])){return logger[_0x78a2('0xc')](_0x78a2('0x35'));}if(_[_0x78a2('0x34')](_0x134e5c[_0x78a2('0x1d')])){return logger[_0x78a2('0xc')](_0x78a2('0x36'));}var _0x1a73dc={'startDate':moment()['subtract'](_0x134e5c[_0x78a2('0x1c')],_0x134e5c['subtractUnit'])[_0x78a2('0x16')](_0x78a2('0x37')),'endDate':moment()[_0x78a2('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x78a2('0x38'),'output':_0x134e5c[_0x78a2('0x39')],'name':_0x134e5c[_0x78a2('0x18')]};if(!_['isNil'](_0x134e5c[_0x78a2('0x3a')])){logger[_0x78a2('0xc')](_0x78a2('0x3b'),_0x134e5c[_0x78a2('0x3a')]);return analyticDefaultReportController[_0x78a2('0x3c')]({'id':_0x134e5c[_0x78a2('0x3a')]},_0x1a73dc)['then'](handleResult(_0x134e5c))[_0x78a2('0x3d')](handleError());}if(!_['isNil'](_0x134e5c[_0x78a2('0x3e')])){logger[_0x78a2('0xc')]('exec\x20custom\x20report\x20id:%s',_0x134e5c[_0x78a2('0x3e')]);return analyticCustomReportController[_0x78a2('0x3c')]({'id':_0x134e5c[_0x78a2('0x3e')]},_0x1a73dc)[_0x78a2('0x30')](handleResult(_0x134e5c))[_0x78a2('0x3d')](handleError());}}catch(_0x4afcf9){logger['error'](JSON[_0x78a2('0x2b')](_0x4afcf9));}return logger[_0x78a2('0xc')](_0x78a2('0x3f'));};}function getJobs(_0x161729){var _0x226da8={};if(_0x161729){_0x226da8['id']=_0x161729;}return db['Schedule'][_0x78a2('0x40')]({'where':_0x226da8,'include':[{'model':db[_0x78a2('0xe')],'attributes':['id',_0x78a2('0x18'),_0x78a2('0x19')],'include':[{'model':db[_0x78a2('0x41')],'as':_0x78a2('0xf')}]}]})['then'](function(_0x44e418){var _0x1af7a0=_[_0x78a2('0x42')](manager['jobs']);var _0x1fbc57=_[_0x78a2('0x43')](_0x44e418,function(_0x15c78a){return _0x15c78a['id'][_0x78a2('0x44')]();});var _0x2d77db=_[_0x78a2('0x45')](_0x44e418,function(_0x12acf3){return _0x12acf3['id'][_0x78a2('0x44')]();});var _0x5f31a0=_0x161729?_0x1fbc57:_[_0x78a2('0x46')](_0x1fbc57,_0x1af7a0);var _0x451b98=_[_0x78a2('0x47')](_0x1fbc57,_0x1af7a0);var _0x3ade74=_['difference'](_0x1af7a0,_0x1fbc57);var _0x3aba35;var _0x226fe0;for(_0x3aba35=0x0;_0x3aba35<_0x3ade74[_0x78a2('0x48')]&&!_0x161729;_0x3aba35+=0x1){_0x226fe0=_0x3ade74[_0x3aba35][_0x78a2('0x44')]();if(manager['exists'](_0x226fe0)){manager[_0x78a2('0x49')](_0x226fe0);manager[_0x78a2('0x4a')](_0x226fe0);logger['info'](_0x78a2('0x4b'),_0x226fe0);}}logger[_0x78a2('0xc')](_0x78a2('0x4c'),JSON[_0x78a2('0x2b')](_0x5f31a0));for(_0x3aba35=0x0;_0x3aba35<_0x5f31a0['length'];_0x3aba35+=0x1){_0x226fe0=_0x5f31a0[_0x3aba35][_0x78a2('0x44')]();logger[_0x78a2('0xc')](_0x78a2('0x4d'),_0x226fe0);if(_0x161729){logger['info']('my\x20id',_0x161729);logger[_0x78a2('0xc')](JSON[_0x78a2('0x2b')](_0x2d77db[_0x226fe0]));BPromise[_0x78a2('0x4e')]()[_0x78a2('0x30')](handleJob(_0x2d77db[_0x226fe0]));logger['info'](_0x78a2('0x4f'),_0x2d77db[_0x226fe0][_0x78a2('0x18')],_0x2d77db[_0x226fe0][_0x78a2('0x50')]);}else if(_0x2d77db[_0x226fe0][_0x78a2('0x50')]&&_0x2d77db[_0x226fe0]['active']&&moment()[_0x78a2('0x51')](_0x2d77db[_0x226fe0][_0x78a2('0x52')],_0x2d77db[_0x226fe0]['endAt'])){manager[_0x78a2('0x53')](_0x226fe0,_0x2d77db[_0x226fe0][_0x78a2('0x50')],handleJob(_0x2d77db[_0x226fe0]));manager['start'](_0x226fe0);logger[_0x78a2('0xc')](_0x78a2('0x54'),_0x2d77db[_0x226fe0][_0x78a2('0x18')],_0x2d77db[_0x226fe0][_0x78a2('0x50')]);}else if(manager[_0x78a2('0x55')](_0x226fe0)){manager[_0x78a2('0x49')](_0x226fe0);manager['deleteJob'](_0x226fe0);logger[_0x78a2('0xc')](_0x78a2('0x56'),_0x2d77db[_0x226fe0][_0x78a2('0x18')],_0x2d77db[_0x226fe0][_0x78a2('0x50')]);}}for(_0x3aba35=0x0,_0x226fe0;_0x3aba35<_0x451b98[_0x78a2('0x48')]&&!_0x161729;_0x3aba35+=0x1){_0x226fe0=_0x451b98[_0x3aba35][_0x78a2('0x44')]();if(manager[_0x78a2('0x55')](_0x226fe0)){if(_0x2d77db[_0x226fe0][_0x78a2('0x50')]&&_0x2d77db[_0x226fe0][_0x78a2('0x57')]&&moment()[_0x78a2('0x51')](_0x2d77db[_0x226fe0]['startAt'],_0x2d77db[_0x226fe0][_0x78a2('0x58')])){manager[_0x78a2('0x59')](_0x226fe0,_0x2d77db[_0x226fe0][_0x78a2('0x50')],handleJob(_0x2d77db[_0x226fe0]));logger[_0x78a2('0xc')](_0x78a2('0x5a'),_0x2d77db[_0x226fe0][_0x78a2('0x18')],_0x2d77db[_0x226fe0][_0x78a2('0x50')]);}else{manager[_0x78a2('0x49')](_0x226fe0);manager['deleteJob'](_0x226fe0);logger['info'](_0x78a2('0x56'),_0x2d77db[_0x226fe0][_0x78a2('0x18')],_0x2d77db[_0x226fe0][_0x78a2('0x50')]);}}}})[_0x78a2('0x3d')](function(_0x287820){logger[_0x78a2('0x31')](JSON[_0x78a2('0x2b')](_0x287820));});}exports['run']=function(_0x518557){return getJobs(_0x518557);};exports['start']=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 8b3564f..e09695e 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 _0x1572=['Sentiment','SentimentScore','Mixed','FAILED','FailureReason','tempSentiment','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','Neutral','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','inspect','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis'];(function(_0x39999c,_0x38659a){var _0x4a232d=function(_0x13d570){while(--_0x13d570){_0x39999c['push'](_0x39999c['shift']());}};_0x4a232d(++_0x38659a);}(_0x1572,0xf5));var _0x2157=function(_0x4c1979,_0x74a3ba){_0x4c1979=_0x4c1979-0x0;var _0x180b3e=_0x1572[_0x4c1979];return _0x180b3e;};var _=require(_0x2157('0x0'));var AWS=require(_0x2157('0x1'));var rp=require(_0x2157('0x2'));var util=require(_0x2157('0x3'));var BPromise=require(_0x2157('0x4'));var db=require(_0x2157('0x5'))['db'];var logger=require(_0x2157('0x6'))(_0x2157('0x7'));function getTranscriptionJob(_0x214311,_0x30e5c6,_0x2cb065,_0x3c3eb5){return new Promise(function(_0x2f13ab,_0x9e1c46){var _0x286be0=new AWS[(_0x2157('0x8'))]({'accessKeyId':_0x30e5c6,'secretAccessKey':_0x214311,'region':_0x2cb065});_0x286be0[_0x2157('0x9')]({'TranscriptionJobName':_0x3c3eb5},function(_0x91bf75,_0x5e9959){if(_0x91bf75){return _0x9e1c46(_0x91bf75);}else{return _0x2f13ab(_0x5e9959);}});});}function sentiment(_0x2ee42e,_0x4cd82d,_0x91d81,_0xaa87db,_0x17d4c0){return new Promise(function(_0x366643,_0x2ae8d5){var _0x3bcff9=new AWS[(_0x2157('0xa'))]({'accessKeyId':_0x4cd82d,'secretAccessKey':_0x2ee42e,'region':_0x91d81});_0x3bcff9[_0x2157('0xb')]({'Text':_0xaa87db,'LanguageCode':_0x17d4c0['substring'](0x0,0x2)},function(_0x3ff739,_0x2088ab){if(_0x3ff739){return _0x2ae8d5(_0x3ff739);}else{return _0x366643(_0x2088ab);}});});}function checkTranscribeJob(_0xd969d2,_0x1434ee,_0x5d64d3){var _0x32683b;return new BPromise(function(_0x418d29,_0xba98c0){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0xe'),_0xd969d2['id'],_0xd969d2[_0x2157('0xf')]));return getTranscriptionJob(_0x5d64d3['data1'],_0x5d64d3['data2'],_0x1434ee['transcribeRegion'],_0xd969d2[_0x2157('0xf')])[_0x2157('0x10')](function(_0x371461){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x11'),_0xd969d2['id'],_0xd969d2[_0x2157('0xf')],_0x371461[_0x2157('0x12')][_0x2157('0x13')]));if(!_0xd969d2['fileText']){switch(_0x371461[_0x2157('0x12')][_0x2157('0x13')]){case _0x2157('0x14'):var _0x5c6661={'transcribeStatus':_0x371461[_0x2157('0x12')][_0x2157('0x13')],'fileUri':_0x371461[_0x2157('0x12')][_0x2157('0x15')][_0x2157('0x16')]};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0xd969d2['id']));return rp({'uri':_0x371461[_0x2157('0x12')]['Transcript'][_0x2157('0x16')],'json':!![]})[_0x2157('0x10')](function(_0x537ada){logger['info'](util[_0x2157('0xd')](_0x2157('0x17'),_0xd969d2['id']));if(_0x537ada&&_0x537ada[_0x2157('0x18')]&&_0x537ada[_0x2157('0x18')]['transcripts']&&_0x537ada[_0x2157('0x18')][_0x2157('0x19')]['length']){_0x5c6661['fileText']='';for(var _0x138c0e=0x0;_0x138c0e<_0x537ada[_0x2157('0x18')][_0x2157('0x19')][_0x2157('0x1a')];_0x138c0e++){_0x5c6661[_0x2157('0x1b')]+=_0x537ada[_0x2157('0x18')]['transcripts'][_0x138c0e][_0x2157('0x1c')]+'';}}return _0xd969d2[_0x2157('0x1d')](_0x5c6661);})[_0x2157('0x10')](function(){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x1e'),_0xd969d2['id']));if(!_0xd969d2['tempSentiment']){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x21'));}if(!_0x1434ee[_0x2157('0x22')]||!_0x1434ee['sentimentAccountId']||!_0x1434ee[_0x2157('0x23')]||!_0x1434ee[_0x2157('0x24')]||!_0x1434ee[_0x2157('0x25')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x26'));}if(!_0x5c6661[_0x2157('0x1b')]){throw new Error(_0x2157('0x27'));}if(_0x1434ee[_0x2157('0x28')]===_0x5d64d3['id']){return _0x5d64d3;}else{return db[_0x2157('0x29')][_0x2157('0x2a')]({'where':{'id':_settings[_0x2157('0x28')]}});}})[_0x2157('0x10')](function(_0x3c887e){if(!_0x3c887e){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3c887e[_0x2157('0x2b')]||!_0x3c887e[_0x2157('0x2c')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x2d'));}_0x32683b=_0x3c887e;logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x2e'),_0xd969d2['id']));return sentiment(_0x32683b[_0x2157('0x2b')],_0x32683b['data2'],_0x1434ee['sentimentRegion'],_0x5c6661[_0x2157('0x1b')],_0x1434ee[_0x2157('0x24')]);})['then'](function(_0x6096fe){logger[_0x2157('0xc')](util[_0x2157('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd969d2['id']));return _0xd969d2[_0x2157('0x1d')]({'sentiment':_0x6096fe[_0x2157('0x2f')],'sPositive':_0x6096fe[_0x2157('0x30')]['Positive'],'sNegative':_0x6096fe[_0x2157('0x30')]['Negative'],'sMixed':_0x6096fe[_0x2157('0x30')][_0x2157('0x31')],'sNeutral':_0x6096fe[_0x2157('0x30')]['Neutral']});})[_0x2157('0x10')](function(){logger[_0x2157('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xd969d2['id']));_0x418d29();});case _0x2157('0x32'):return _0xd969d2[_0x2157('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x371461[_0x2157('0x12')][_0x2157('0x33')]})['then'](function(){logger[_0x2157('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xd969d2['id']));_0x418d29();});default:logger[_0x2157('0xc')](util[_0x2157('0xd')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0xd969d2['id']));break;}}else{return BPromise['resolve']()[_0x2157('0x10')](function(){if(!_0xd969d2[_0x2157('0x34')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x21'));}if(!_0x1434ee[_0x2157('0x22')]||!_0x1434ee[_0x2157('0x28')]||!_0x1434ee['sentimentRegion']||!_0x1434ee[_0x2157('0x24')]||!_0x1434ee[_0x2157('0x25')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x26'));}if(!_0xd969d2[_0x2157('0x1b')]){throw new Error('Transcript\x20not\x20available');}if(_0x1434ee['sentimentAccountId']===_0x5d64d3['id']){return _0x5d64d3;}else{return db['CloudProvider'][_0x2157('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2157('0x10')](function(_0x10cfc3){if(!_0x10cfc3){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x10cfc3[_0x2157('0x2b')]||!_0x10cfc3[_0x2157('0x2c')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x2d'));}_0x32683b=_0x10cfc3;logger[_0x2157('0xc')](util[_0x2157('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xd969d2['id']));return sentiment(_0x32683b[_0x2157('0x2b')],_0x32683b[_0x2157('0x2c')],_0x1434ee['sentimentRegion'],_0xd969d2[_0x2157('0x1b')],_0x1434ee[_0x2157('0x24')]);})[_0x2157('0x10')](function(_0x5289e0){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x35'),_0xd969d2['id']));return _0xd969d2[_0x2157('0x1d')]({'sentiment':_0x5289e0[_0x2157('0x2f')],'sPositive':_0x5289e0['SentimentScore'][_0x2157('0x36')],'sNegative':_0x5289e0['SentimentScore'][_0x2157('0x37')],'sMixed':_0x5289e0[_0x2157('0x30')][_0x2157('0x31')],'sNeutral':_0x5289e0[_0x2157('0x30')][_0x2157('0x38')],'transcribeStatus':_0x2157('0x14')});})['then'](function(){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x1e'),_0xd969d2['id']));_0x418d29();});}})[_0x2157('0x39')](function(_0x5e04ca){if(_0x5e04ca){if(!_0x5e04ca[_0x2157('0x3a')]||_0x5e04ca[_0x2157('0x3a')]!=='SequelizeValidationError'){logger[_0x2157('0x3b')](util[_0x2157('0xd')](_0x2157('0x3c'),_0xd969d2['id']),util['inspect'](_0x5e04ca,{'showHidden':![],'depth':null}));}}_0x418d29();});});}function checkTranscribe(){var _0x2d0963;var _0x545b46;var _0xb6b619;return db[_0x2157('0x3d')]['findAll']({'where':{'transcribeStatus':_0x2157('0x3e')}})[_0x2157('0x10')](function(_0x1f18f1){if(!_0x1f18f1||!_0x1f18f1[_0x2157('0x1a')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x3f'));}_0x2d0963=_0x1f18f1;return db[_0x2157('0x40')][_0x2157('0x2a')]({'where':{'id':0x1}});})['then'](function(_0x3c7cbf){if(!_0x3c7cbf){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x41'));}_0x545b46=_0x3c7cbf;if(!_0x545b46[_0x2157('0x7')]||!_0x545b46['transcribeAccountId']||!_0x545b46[_0x2157('0x42')]||!_0x545b46['language']||!_0x545b46['bucket']){throw new db[(_0x2157('0x1f'))]['ValidationError'](_0x2157('0x43'));}return db[_0x2157('0x29')][_0x2157('0x2a')]({'where':{'id':_0x545b46['transcribeAccountId']}});})[_0x2157('0x10')](function(_0x2aba0a){if(!_0x2aba0a){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2aba0a[_0x2157('0x2b')]||!_0x2aba0a[_0x2157('0x2c')]){throw new db['Sequelize'][(_0x2157('0x20'))](_0x2157('0x2d'));}_0xb6b619=_0x2aba0a;var _0x44ee05=[];_0x2d0963[_0x2157('0x44')](function(_0x1dc792){_0x44ee05[_0x2157('0x45')](checkTranscribeJob(_0x1dc792,_0x545b46,_0xb6b619));});return BPromise[_0x2157('0x46')](_0x44ee05);})[_0x2157('0x39')](function(_0x4aca70){if(_0x4aca70){if(!_0x4aca70[_0x2157('0x3a')]||_0x4aca70[_0x2157('0x3a')]!==_0x2157('0x47')){logger[_0x2157('0x3b')](util[_0x2157('0x48')](_0x4aca70,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb627=['findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','forEach','push','all','inspect','start','lodash','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeName','format','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider'];(function(_0xd89a9f,_0x401bf2){var _0xee62f4=function(_0x43e64c){while(--_0x43e64c){_0xd89a9f['push'](_0xd89a9f['shift']());}};_0xee62f4(++_0x401bf2);}(_0xb627,0x144));var _0x7b62=function(_0x4b025b,_0x9b2ee1){_0x4b025b=_0x4b025b-0x0;var _0x152904=_0xb627[_0x4b025b];return _0x152904;};var _=require(_0x7b62('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x7b62('0x1'));var BPromise=require('bluebird');var db=require(_0x7b62('0x2'))['db'];var logger=require(_0x7b62('0x3'))(_0x7b62('0x4'));function getTranscriptionJob(_0x312f67,_0x242a8d,_0x31c821,_0x349367){return new Promise(function(_0x4ad3e8,_0x71aec9){var _0x547533=new AWS[(_0x7b62('0x5'))]({'accessKeyId':_0x242a8d,'secretAccessKey':_0x312f67,'region':_0x31c821});_0x547533[_0x7b62('0x6')]({'TranscriptionJobName':_0x349367},function(_0x4ae3ef,_0x30652e){if(_0x4ae3ef){return _0x71aec9(_0x4ae3ef);}else{return _0x4ad3e8(_0x30652e);}});});}function sentiment(_0x4c462a,_0x29a0b4,_0x379d07,_0x1e1fd0,_0x5a1f7e){return new Promise(function(_0x19fe5c,_0xe5c80e){var _0x20a8dc=new AWS[(_0x7b62('0x7'))]({'accessKeyId':_0x29a0b4,'secretAccessKey':_0x4c462a,'region':_0x379d07});_0x20a8dc[_0x7b62('0x8')]({'Text':_0x1e1fd0,'LanguageCode':_0x5a1f7e[_0x7b62('0x9')](0x0,0x2)},function(_0x364089,_0x8d110f){if(_0x364089){return _0xe5c80e(_0x364089);}else{return _0x19fe5c(_0x8d110f);}});});}function checkTranscribeJob(_0x41b6f3,_0x243110,_0x2559c2){var _0x2faaed;return new BPromise(function(_0x413eb4,_0x5221fd){logger[_0x7b62('0xa')](util['format'](_0x7b62('0xb'),_0x41b6f3['id'],_0x41b6f3['transcribeName']));return getTranscriptionJob(_0x2559c2[_0x7b62('0xc')],_0x2559c2['data2'],_0x243110['transcribeRegion'],_0x41b6f3[_0x7b62('0xd')])['then'](function(_0x3f9afa){logger[_0x7b62('0xa')](util[_0x7b62('0xe')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x41b6f3['id'],_0x41b6f3[_0x7b62('0xd')],_0x3f9afa['TranscriptionJob'][_0x7b62('0xf')]));if(!_0x41b6f3[_0x7b62('0x10')]){switch(_0x3f9afa['TranscriptionJob'][_0x7b62('0xf')]){case'COMPLETED':var _0x1af762={'transcribeStatus':_0x3f9afa[_0x7b62('0x11')][_0x7b62('0xf')],'fileUri':_0x3f9afa[_0x7b62('0x11')][_0x7b62('0x12')]['TranscriptFileUri']};logger[_0x7b62('0xa')](util[_0x7b62('0xe')](_0x7b62('0x13'),_0x41b6f3['id']));return rp({'uri':_0x3f9afa[_0x7b62('0x11')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x7b62('0x14')](function(_0x2b0a21){logger[_0x7b62('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x41b6f3['id']));if(_0x2b0a21&&_0x2b0a21[_0x7b62('0x15')]&&_0x2b0a21[_0x7b62('0x15')][_0x7b62('0x16')]&&_0x2b0a21['results']['transcripts']['length']){_0x1af762[_0x7b62('0x10')]='';for(var _0x36289c=0x0;_0x36289c<_0x2b0a21[_0x7b62('0x15')][_0x7b62('0x16')][_0x7b62('0x17')];_0x36289c++){_0x1af762['fileText']+=_0x2b0a21[_0x7b62('0x15')][_0x7b62('0x16')][_0x36289c]['transcript']+'';}}return _0x41b6f3['update'](_0x1af762);})[_0x7b62('0x14')](function(){logger[_0x7b62('0xa')](util[_0x7b62('0xe')](_0x7b62('0x18'),_0x41b6f3['id']));if(!_0x41b6f3[_0x7b62('0x19')]){throw new db[(_0x7b62('0x1a'))]['ValidationError'](_0x7b62('0x1b'));}if(!_0x243110[_0x7b62('0x1c')]||!_0x243110['sentimentAccountId']||!_0x243110[_0x7b62('0x1d')]||!_0x243110[_0x7b62('0x1e')]||!_0x243110['bucket']){throw new db[(_0x7b62('0x1a'))][(_0x7b62('0x1f'))](_0x7b62('0x20'));}if(!_0x1af762['fileText']){throw new Error(_0x7b62('0x21'));}if(_0x243110[_0x7b62('0x22')]===_0x2559c2['id']){return _0x2559c2;}else{return db[_0x7b62('0x23')][_0x7b62('0x24')]({'where':{'id':_settings[_0x7b62('0x22')]}});}})[_0x7b62('0x14')](function(_0x296911){if(!_0x296911){throw new db[(_0x7b62('0x1a'))][(_0x7b62('0x1f'))](_0x7b62('0x25'));}if(!_0x296911[_0x7b62('0xc')]||!_0x296911[_0x7b62('0x26')]){throw new db[(_0x7b62('0x1a'))]['ValidationError'](_0x7b62('0x27'));}_0x2faaed=_0x296911;logger[_0x7b62('0xa')](util[_0x7b62('0xe')](_0x7b62('0x28'),_0x41b6f3['id']));return sentiment(_0x2faaed[_0x7b62('0xc')],_0x2faaed['data2'],_0x243110['sentimentRegion'],_0x1af762[_0x7b62('0x10')],_0x243110[_0x7b62('0x1e')]);})[_0x7b62('0x14')](function(_0x583b22){logger[_0x7b62('0xa')](util[_0x7b62('0xe')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x41b6f3['id']));return _0x41b6f3[_0x7b62('0x29')]({'sentiment':_0x583b22[_0x7b62('0x2a')],'sPositive':_0x583b22[_0x7b62('0x2b')]['Positive'],'sNegative':_0x583b22[_0x7b62('0x2b')][_0x7b62('0x2c')],'sMixed':_0x583b22['SentimentScore'][_0x7b62('0x2d')],'sNeutral':_0x583b22[_0x7b62('0x2b')][_0x7b62('0x2e')]});})['then'](function(){logger[_0x7b62('0xa')](util[_0x7b62('0xe')](_0x7b62('0x18'),_0x41b6f3['id']));_0x413eb4();});case _0x7b62('0x2f'):return _0x41b6f3[_0x7b62('0x29')]({'transcribeStatus':_0x7b62('0x2f'),'failureReason':_0x3f9afa[_0x7b62('0x11')][_0x7b62('0x30')]})[_0x7b62('0x14')](function(){logger[_0x7b62('0xa')](util[_0x7b62('0xe')](_0x7b62('0x18'),_0x41b6f3['id']));_0x413eb4();});default:logger[_0x7b62('0xa')](util[_0x7b62('0xe')](_0x7b62('0x31'),_0x41b6f3['id']));break;}}else{return BPromise[_0x7b62('0x32')]()[_0x7b62('0x14')](function(){if(!_0x41b6f3[_0x7b62('0x19')]){throw new db[(_0x7b62('0x1a'))][(_0x7b62('0x1f'))](_0x7b62('0x1b'));}if(!_0x243110['sentiment']||!_0x243110['sentimentAccountId']||!_0x243110[_0x7b62('0x1d')]||!_0x243110[_0x7b62('0x1e')]||!_0x243110[_0x7b62('0x33')]){throw new db['Sequelize'][(_0x7b62('0x1f'))](_0x7b62('0x20'));}if(!_0x41b6f3[_0x7b62('0x10')]){throw new Error(_0x7b62('0x21'));}if(_0x243110[_0x7b62('0x22')]===_0x2559c2['id']){return _0x2559c2;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7b62('0x14')](function(_0x38fd0b){if(!_0x38fd0b){throw new db[(_0x7b62('0x1a'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x38fd0b[_0x7b62('0xc')]||!_0x38fd0b[_0x7b62('0x26')]){throw new db[(_0x7b62('0x1a'))]['ValidationError'](_0x7b62('0x27'));}_0x2faaed=_0x38fd0b;logger[_0x7b62('0xa')](util[_0x7b62('0xe')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x41b6f3['id']));return sentiment(_0x2faaed[_0x7b62('0xc')],_0x2faaed['data2'],_0x243110[_0x7b62('0x1d')],_0x41b6f3[_0x7b62('0x10')],_0x243110['language']);})[_0x7b62('0x14')](function(_0x472945){logger[_0x7b62('0xa')](util['format'](_0x7b62('0x34'),_0x41b6f3['id']));return _0x41b6f3['update']({'sentiment':_0x472945[_0x7b62('0x2a')],'sPositive':_0x472945['SentimentScore'][_0x7b62('0x35')],'sNegative':_0x472945[_0x7b62('0x2b')][_0x7b62('0x2c')],'sMixed':_0x472945['SentimentScore'][_0x7b62('0x2d')],'sNeutral':_0x472945[_0x7b62('0x2b')][_0x7b62('0x2e')],'transcribeStatus':_0x7b62('0x36')});})[_0x7b62('0x14')](function(){logger[_0x7b62('0xa')](util[_0x7b62('0xe')](_0x7b62('0x18'),_0x41b6f3['id']));_0x413eb4();});}})[_0x7b62('0x37')](function(_0x10ad11){if(_0x10ad11){if(!_0x10ad11[_0x7b62('0x38')]||_0x10ad11[_0x7b62('0x38')]!==_0x7b62('0x39')){logger[_0x7b62('0x3a')](util[_0x7b62('0xe')](_0x7b62('0x3b'),_0x41b6f3['id']),util['inspect'](_0x10ad11,{'showHidden':![],'depth':null}));}}_0x413eb4();});});}function checkTranscribe(){var _0x5b3e45;var _0x11e83d;var _0x5bc0dd;return db[_0x7b62('0x3c')]['findAll']({'where':{'transcribeStatus':_0x7b62('0x3d')}})[_0x7b62('0x14')](function(_0x19bcf8){if(!_0x19bcf8||!_0x19bcf8[_0x7b62('0x17')]){throw new db['Sequelize'][(_0x7b62('0x1f'))](_0x7b62('0x3e'));}_0x5b3e45=_0x19bcf8;return db[_0x7b62('0x3f')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x5c8139){if(!_0x5c8139){throw new db[(_0x7b62('0x1a'))][(_0x7b62('0x1f'))](_0x7b62('0x40'));}_0x11e83d=_0x5c8139;if(!_0x11e83d[_0x7b62('0x4')]||!_0x11e83d[_0x7b62('0x41')]||!_0x11e83d[_0x7b62('0x42')]||!_0x11e83d[_0x7b62('0x1e')]||!_0x11e83d[_0x7b62('0x33')]){throw new db[(_0x7b62('0x1a'))][(_0x7b62('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0x7b62('0x23')]['findOne']({'where':{'id':_0x11e83d[_0x7b62('0x41')]}});})[_0x7b62('0x14')](function(_0x39d087){if(!_0x39d087){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x39d087[_0x7b62('0xc')]||!_0x39d087[_0x7b62('0x26')]){throw new db[(_0x7b62('0x1a'))][(_0x7b62('0x1f'))](_0x7b62('0x27'));}_0x5bc0dd=_0x39d087;var _0x5e9267=[];_0x5b3e45[_0x7b62('0x43')](function(_0x2dde17){_0x5e9267[_0x7b62('0x44')](checkTranscribeJob(_0x2dde17,_0x11e83d,_0x5bc0dd));});return BPromise[_0x7b62('0x45')](_0x5e9267);})['catch'](function(_0x1d9025){if(_0x1d9025){if(!_0x1d9025[_0x7b62('0x38')]||_0x1d9025[_0x7b62('0x38')]!==_0x7b62('0x39')){logger[_0x7b62('0x3a')](util[_0x7b62('0x46')](_0x1d9025,{'showHidden':![],'depth':null}));}}});}exports[_0x7b62('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 0041aeb..a1e9c46 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 _0x8491=['subtract','hours','then','length','map','info','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8491,0xc5));var _0x1849=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x8491[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var moment=require(_0x1849('0x0'));var Redis=require(_0x1849('0x1'));var util=require(_0x1849('0x2'));var config=require(_0x1849('0x3'));var db=require(_0x1849('0x4'))['db'];var logger=require(_0x1849('0x5'))(_0x1849('0x6'));config[_0x1849('0x7')]=_[_0x1849('0x8')](config['redis'],{'host':_0x1849('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1849('0x7')]));function closeInteractions(){var _0x474b12=[];return db[_0x1849('0xa')][_0x1849('0xb')]({'raw':!![],'attributes':['id',_0x1849('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1849('0xd')](0x18,_0x1849('0xe'))}}})[_0x1849('0xf')](function(_0x359234){if(_0x359234&&_0x359234[_0x1849('0x10')]){_0x474b12=_[_0x1849('0x11')](_0x359234||[],'id');logger[_0x1849('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x474b12[_0x1849('0x13')]());return db[_0x1849('0xa')][_0x1849('0x14')]({'closeReason':_0x1849('0x15'),'disposition':_0x1849('0x16'),'closed':!![],'closedAt':moment()['format'](_0x1849('0x17'))},{'where':{'id':_0x474b12}});}})[_0x1849('0xf')](function(){if(_0x474b12&&_0x474b12[_0x1849('0x10')]){logger['info'](_0x1849('0x18'),_0x474b12[_0x1849('0x13')]());for(var _0xcf507=0x0;_0xcf507<_0x474b12[_0x1849('0x10')];_0xcf507++){io[_0x1849('0x19')](_0x1849('0x1a'),{'id':_0x474b12[_0xcf507],'closed':!![]});}}})['catch'](function(_0x2d651d){logger[_0x1849('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2d651d?util[_0x1849('0x1c')](_0x2d651d,{'showHidden':![],'depth':null}):'');});}exports[_0x1849('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7860=['defaults','hours','length','join','update','timeout','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','util','redis'];(function(_0x3207a4,_0x1b9024){var _0x5c8dff=function(_0x4611b9){while(--_0x4611b9){_0x3207a4['push'](_0x3207a4['shift']());}};_0x5c8dff(++_0x1b9024);}(_0x7860,0x74));var _0x0786=function(_0x3e343b,_0x5a28d0){_0x3e343b=_0x3e343b-0x0;var _0x17c8fd=_0x7860[_0x3e343b];return _0x17c8fd;};'use strict';var _=require(_0x0786('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x0786('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0x0786('0x2')]=_[_0x0786('0x3')](config[_0x0786('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x1b4b0=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x0786('0x4'))}}})['then'](function(_0x4fcd9c){if(_0x4fcd9c&&_0x4fcd9c[_0x0786('0x5')]){_0x1b4b0=_['map'](_0x4fcd9c||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x1b4b0[_0x0786('0x6')]());return db['WhatsappInteraction'][_0x0786('0x7')]({'closeReason':'system','disposition':_0x0786('0x8'),'closed':!![],'closedAt':moment()[_0x0786('0x9')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1b4b0}});}})[_0x0786('0xa')](function(){if(_0x1b4b0&&_0x1b4b0[_0x0786('0x5')]){logger['info'](_0x0786('0xb'),_0x1b4b0['join']());for(var _0x288503=0x0;_0x288503<_0x1b4b0[_0x0786('0x5')];_0x288503++){io[_0x0786('0xc')](_0x0786('0xd'),{'id':_0x1b4b0[_0x288503],'closed':!![]});}}})['catch'](function(_0xebc131){logger[_0x0786('0xe')](_0x0786('0xf'),_0xebc131?util[_0x0786('0x10')](_0xebc131,{'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/seedContact.js b/server/config/seedContact.js index b0c319f..7da1bc0 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b1d=['innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo'];(function(_0x2f3412,_0x2b8d24){var _0x4071d6=function(_0x5af33d){while(--_0x5af33d){_0x2f3412['push'](_0x2f3412['shift']());}};_0x4071d6(++_0x2b8d24);}(_0x6b1d,0x164));var _0xd6b1=function(_0x435348,_0x617493){_0x435348=_0x435348-0x0;var _0x35d479=_0x6b1d[_0x435348];return _0x35d479;};'use strict';var util=require(_0xd6b1('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd6b1('0x1')]({'id':i,'firstName':_0xd6b1('0x2')+i,'lastName':_0xd6b1('0x3')+i,'phone':0xf879fb460+i,'email':_0xd6b1('0x4')+i+_0xd6b1('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd6b1('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xd6b1('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd6b1('0x6')](),'updatedAt':Date[_0xd6b1('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd6b1('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xd6b1('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd6b1('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd6b1('0x6')](),'updatedAt':Date[_0xd6b1('0x6')]()});}db[_0xd6b1('0x7')][_0xd6b1('0x8')]({'where':{}})[_0xd6b1('0x9')](function(){return db[_0xd6b1('0x7')][_0xd6b1('0xa')](contacts);})[_0xd6b1('0x9')](function(){console[_0xd6b1('0xb')](_0xd6b1('0xc'),'contacts1');return db[_0xd6b1('0xd')][_0xd6b1('0x8')]({'where':{}});})[_0xd6b1('0x9')](function(){return db[_0xd6b1('0xd')][_0xd6b1('0xa')](hopper);})[_0xd6b1('0x9')](function(){console['log']('finished\x20populating',_0xd6b1('0xe'));return db[_0xd6b1('0x7')][_0xd6b1('0xa')](contacts2);})[_0xd6b1('0x9')](function(){console[_0xd6b1('0xb')](_0xd6b1('0xc'),_0xd6b1('0xf'));return db[_0xd6b1('0xd')][_0xd6b1('0xa')](hopper2);})[_0xd6b1('0x9')](function(){console[_0xd6b1('0xb')](_0xd6b1('0xc'),_0xd6b1('0x10'));})[_0xd6b1('0x11')](function(_0x218812){console[_0xd6b1('0xb')](_0x218812);}); \ No newline at end of file +var _0x2726=['contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','now','Biondo','CmContact','then','log','finished\x20populating','CmHopper','destroy','bulkCreate','hopper1'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2726,0x93));var _0x6272=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x2726[_0x1ebc6c];return _0x3a826d;};'use strict';var util=require(_0x6272('0x0'));var db=require(_0x6272('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6272('0x2')]({'id':i,'firstName':_0x6272('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6272('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6272('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x6272('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6272('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x6272('0x6')+i,'phone':0xf879fb460+i,'email':_0x6272('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x6272('0x5')]()});}db[_0x6272('0x7')]['destroy']({'where':{}})[_0x6272('0x8')](function(){return db[_0x6272('0x7')]['bulkCreate'](contacts);})[_0x6272('0x8')](function(){console[_0x6272('0x9')](_0x6272('0xa'),'contacts1');return db[_0x6272('0xb')][_0x6272('0xc')]({'where':{}});})[_0x6272('0x8')](function(){return db[_0x6272('0xb')][_0x6272('0xd')](hopper);})[_0x6272('0x8')](function(){console[_0x6272('0x9')](_0x6272('0xa'),_0x6272('0xe'));return db[_0x6272('0x7')]['bulkCreate'](contacts2);})[_0x6272('0x8')](function(){console[_0x6272('0x9')]('finished\x20populating',_0x6272('0xf'));return db[_0x6272('0xb')]['bulkCreate'](hopper2);})[_0x6272('0x8')](function(){console['log'](_0x6272('0xa'),_0x6272('0x10'));})[_0x6272('0x11')](function(_0x1f3217){console['log'](_0x1f3217);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3ba7486..0d50b23 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf28e=['friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','log','add\x20user','catch','util','../mysqldb','%s%s','format','agent','password'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xf28e,0xd2));var _0xef28=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0xf28e[_0x1d04b5];return _0x161342;};'use strict';var util=require(_0xef28('0x0'));var db=require(_0xef28('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xef28('0x2'),'agent',i),'fullname':util[_0xef28('0x3')](_0xef28('0x2'),_0xef28('0x4'),i),'email':util['format']('%s%s@xcally.com',_0xef28('0x4'),i),'role':_0xef28('0x4'),'password':_0xef28('0x5'),'internal':0xfa0+i,'type':_0xef28('0x6'),'transport':[_0xef28('0x7'),'ws',_0xef28('0x8')],'disallow':[_0xef28('0x9')],'allow':[_0xef28('0xa')],'defaultuser':util[_0xef28('0x3')](_0xef28('0x2'),_0xef28('0x4'),i),'encryption':_0xef28('0xb'),'avpf':'yes','force_avp':_0xef28('0xb'),'icesupport':'yes','dtlsenable':_0xef28('0xb'),'dtlsverify':'no','dtlscertfile':_0xef28('0xc'),'dtlsprivatekey':_0xef28('0xd'),'dtlssetup':_0xef28('0xe'),'callerid':util[_0xef28('0x3')]('\x22%s\x22\x20<%s>',util[_0xef28('0x3')]('%s%s',_0xef28('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)['then'](function(){console[_0xef28('0xf')](_0xef28('0x10'));})[_0xef28('0x11')](function(_0x4aead0){console[_0xef28('0xf')](_0x4aead0);}); \ No newline at end of file +var _0xc6bb=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x5ec0e1,_0x3185df){var _0x2d5769=function(_0xb20b80){while(--_0xb20b80){_0x5ec0e1['push'](_0x5ec0e1['shift']());}};_0x2d5769(++_0x3185df);}(_0xc6bb,0x1af));var _0xbc6b=function(_0x396bf3,_0xfc0f39){_0x396bf3=_0x396bf3-0x0;var _0x3f3623=_0xc6bb[_0x396bf3];return _0x3f3623;};'use strict';var util=require(_0xbc6b('0x0'));var db=require(_0xbc6b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xbc6b('0x2')](_0xbc6b('0x3'),_0xbc6b('0x4'),i),'fullname':util[_0xbc6b('0x2')](_0xbc6b('0x3'),'agent',i),'email':util[_0xbc6b('0x2')](_0xbc6b('0x5'),'agent',i),'role':_0xbc6b('0x4'),'password':_0xbc6b('0x6'),'internal':0xfa0+i,'type':_0xbc6b('0x7'),'transport':[_0xbc6b('0x8'),'ws',_0xbc6b('0x9')],'disallow':[_0xbc6b('0xa')],'allow':[_0xbc6b('0xb')],'defaultuser':util[_0xbc6b('0x2')]('%s%s',_0xbc6b('0x4'),i),'encryption':'yes','avpf':_0xbc6b('0xc'),'force_avp':_0xbc6b('0xc'),'icesupport':_0xbc6b('0xc'),'dtlsenable':_0xbc6b('0xc'),'dtlsverify':'no','dtlscertfile':_0xbc6b('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xbc6b('0xe'),'callerid':util[_0xbc6b('0x2')]('\x22%s\x22\x20<%s>',util[_0xbc6b('0x2')](_0xbc6b('0x3'),_0xbc6b('0x4'),i),0xfa0+i)});}db[_0xbc6b('0xf')][_0xbc6b('0x10')](users)[_0xbc6b('0x11')](function(){console['log'](_0xbc6b('0x12'));})[_0xbc6b('0x13')](function(_0x474312){console[_0xbc6b('0x14')](_0x474312);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index ce2839b..8a0f284 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb11=['removeSmsInteractions','emit','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','request','remoteAddress','connection','remotePort','SocketIO\x20','disconnect','CONNECTED','lodash','bluebird','../mysqldb','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','%s:queue:%s','Agents','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','admin','voice:outbound','hasOwnProperty','include','push','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueues','VoiceQueue','ChatQueue','FaxQueues','SmsQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','length','chat','fax','sms','openchannel','trunk:%s','campaign:%s:%s','user:%s','map','removeChatInteractions','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xfb11[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var BPromise=require(_0x1fb1('0x1'));var db=require(_0x1fb1('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x1fb1('0x3')],'include':[{'as':'Agents','model':db[_0x1fb1('0x4')],'attributes':['id','name',_0x1fb1('0x5')],'raw':!![],'where':{'role':_0x1fb1('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x1fb1('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1fb1('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x1fb1('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1fb1('0x3'),_0x1fb1('0x8')],'where':{'type':_0x1fb1('0x9')}};function getAssociatedResources(_0x161e1b,_0x2d6be9,_0x438d15){return db[_0x1fb1('0xa')][_0x1fb1('0xb')]({'where':{'name':_0x161e1b,'userProfileId':_0x2d6be9},'raw':!![]})[_0x1fb1('0xc')](function(_0x5bb066){if(_0x5bb066){if(_0x5bb066[_0x1fb1('0xd')]){switch(_0x161e1b){case'VoiceQueues':case _0x1fb1('0xe'):case'FaxQueues':case _0x1fb1('0xf'):case _0x1fb1('0x10'):case _0x1fb1('0x11'):case _0x1fb1('0x12'):return db[_0x438d15][_0x1fb1('0x13')](queryQueues);case _0x1fb1('0x14'):return db[_0x438d15]['findAll'](queryTelephones);case _0x1fb1('0x15'):return db[_0x438d15][_0x1fb1('0x13')](queryTrunks);case _0x1fb1('0x16'):return db[_0x438d15][_0x1fb1('0x13')](queryCampaigns);}}else{return db[_0x1fb1('0x17')][_0x1fb1('0x13')]({'attributes':[_0x1fb1('0x18')],'where':{'sectionId':_0x5bb066['id']},'raw':!![]})[_0x1fb1('0xc')](function(_0x358b58){if(_0x358b58){var _0x4cbe42={'where':{'id':_['map'](_0x358b58,_0x1fb1('0x18'))},'raw':!![]};switch(_0x438d15){case _0x1fb1('0x4'):_0x4cbe42[_0x1fb1('0x19')]['role']=_0x1fb1('0x7');break;case _0x1fb1('0x1a'):_0x4cbe42[_0x1fb1('0x19')][_0x1fb1('0x8')]=_0x1fb1('0x9');break;}return db[_0x438d15][_0x1fb1('0x13')](_0x4cbe42);}else{return[];}});}}else{return[];}})[_0x1fb1('0xc')](function(_0x373e3c){return _0x373e3c;});}function joinOrLeaveQueues(_0x4041ea,_0x5c4169,_0xa6d7b8,_0x55ba5b){_0x4041ea[_0x5c4169](util['format'](_0x1fb1('0x1b'),_0xa6d7b8,_0x55ba5b[_0x1fb1('0x3')]));if(_0x55ba5b[_0x1fb1('0x1c')]){for(var _0x54ad97=0x0;_0x54ad97<_0x55ba5b[_0x1fb1('0x1c')]['length'];_0x54ad97+=0x1){_0x4041ea[_0x5c4169](util['format']('user:%s',_0x55ba5b[_0x1fb1('0x1c')][_0x54ad97][_0x1fb1('0x3')]));}}}function joinOrLeave(_0x12c1d0,_0x10924f,_0x303a06){var _0x53b8af;if(_0x12c1d0[_0x1fb1('0x1d')][_0x1fb1('0x1e')]['id']){db[_0x1fb1('0x4')][_0x1fb1('0x1f')]({'attributes':['id',_0x1fb1('0x3'),_0x1fb1('0x5'),_0x1fb1('0x20')],'where':{'id':_0x12c1d0[_0x1fb1('0x1d')]['query']['id']},'include':[{'model':db[_0x1fb1('0x21')],'as':_0x1fb1('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fb1('0x23')],'as':_0x1fb1('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fb1('0x25')],'as':_0x1fb1('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fb1('0x27')],'as':_0x1fb1('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fb1('0x29')],'as':_0x1fb1('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fb1('0x2b')],'as':_0x1fb1('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x1fb1('0xc')](function(_0xe8ec0a){if(_0xe8ec0a){_0x53b8af=_0xe8ec0a;_0x12c1d0[_0x10924f](util[_0x1fb1('0x2d')]('user:%s',_0xe8ec0a[_0x1fb1('0x3')]));var _0x316f7c=[];switch(_0xe8ec0a[_0x1fb1('0x5')]){case _0x1fb1('0x2e'):_0x12c1d0[_0x10924f]('voice:inbound');_0x12c1d0[_0x10924f](_0x1fb1('0x2f'));if(queryQueues[_0x1fb1('0x30')]('include')){delete queryQueues[_0x1fb1('0x31')];}_0x316f7c['push'](db['VoiceQueue'][_0x1fb1('0x13')](queryQueues));_0x316f7c[_0x1fb1('0x32')](db['ChatQueue'][_0x1fb1('0x13')](queryQueues));_0x316f7c[_0x1fb1('0x32')](db[_0x1fb1('0x33')][_0x1fb1('0x13')](queryQueues));_0x316f7c[_0x1fb1('0x32')](db['SmsQueue'][_0x1fb1('0x13')](queryQueues));_0x316f7c[_0x1fb1('0x32')](db[_0x1fb1('0x34')][_0x1fb1('0x13')](queryQueues));_0x316f7c[_0x1fb1('0x32')](db[_0x1fb1('0x35')][_0x1fb1('0x13')](queryQueues));_0x316f7c[_0x1fb1('0x32')](db[_0x1fb1('0x36')]['findAll'](queryQueues));_0x316f7c[_0x1fb1('0x32')](db['User'][_0x1fb1('0x13')](queryTelephones));_0x316f7c['push'](db[_0x1fb1('0x37')]['findAll'](queryTrunks));_0x316f7c['push'](db[_0x1fb1('0x1a')][_0x1fb1('0x13')](queryCampaigns));_0x316f7c[_0x1fb1('0x32')](db[_0x1fb1('0x4')]['findAll'](queryAgents));break;case _0x1fb1('0x38'):_0x12c1d0[_0x10924f](_0x1fb1('0x39'));_0x12c1d0[_0x10924f](_0x1fb1('0x2f'));_0x316f7c['push'](getAssociatedResources(_0x1fb1('0x3a'),_0xe8ec0a[_0x1fb1('0x20')],_0x1fb1('0x3b')));_0x316f7c[_0x1fb1('0x32')](getAssociatedResources(_0x1fb1('0xe'),_0xe8ec0a[_0x1fb1('0x20')],_0x1fb1('0x3c')));_0x316f7c['push'](getAssociatedResources(_0x1fb1('0x3d'),_0xe8ec0a[_0x1fb1('0x20')],'FaxQueue'));_0x316f7c[_0x1fb1('0x32')](getAssociatedResources('SmsQueues',_0xe8ec0a[_0x1fb1('0x20')],_0x1fb1('0x3e')));_0x316f7c[_0x1fb1('0x32')](getAssociatedResources(_0x1fb1('0x10'),_0xe8ec0a[_0x1fb1('0x20')],_0x1fb1('0x34')));_0x316f7c[_0x1fb1('0x32')](getAssociatedResources(_0x1fb1('0x11'),_0xe8ec0a[_0x1fb1('0x20')],_0x1fb1('0x35')));_0x316f7c[_0x1fb1('0x32')](getAssociatedResources(_0x1fb1('0x12'),_0xe8ec0a[_0x1fb1('0x20')],_0x1fb1('0x36')));_0x316f7c[_0x1fb1('0x32')](getAssociatedResources('Telephones',_0xe8ec0a[_0x1fb1('0x20')],_0x1fb1('0x4')));_0x316f7c[_0x1fb1('0x32')](getAssociatedResources(_0x1fb1('0x15'),_0xe8ec0a['userProfileId'],'Trunk'));_0x316f7c[_0x1fb1('0x32')](getAssociatedResources(_0x1fb1('0x16'),_0xe8ec0a[_0x1fb1('0x20')],_0x1fb1('0x1a')));_0x316f7c[_0x1fb1('0x32')](db[_0x1fb1('0x4')][_0x1fb1('0x13')](queryAgents));break;case _0x1fb1('0x6'):_0x12c1d0[_0x10924f](_0x1fb1('0x39'));_0x12c1d0[_0x10924f](_0x1fb1('0x2f'));_0x316f7c['push'](_0xe8ec0a[_0x1fb1('0x3f')]({'attributes':['id','name']}));_0x316f7c['push'](_0xe8ec0a[_0x1fb1('0x40')]({'attributes':['id',_0x1fb1('0x3')]}));_0x316f7c[_0x1fb1('0x32')](_0xe8ec0a[_0x1fb1('0x41')]({'attributes':['id','name']}));_0x316f7c['push'](_0xe8ec0a[_0x1fb1('0x42')]({'attributes':['id',_0x1fb1('0x3')]}));_0x316f7c[_0x1fb1('0x32')](_0xe8ec0a[_0x1fb1('0x43')]({'attributes':['id',_0x1fb1('0x3')]}));_0x316f7c[_0x1fb1('0x32')](_0xe8ec0a[_0x1fb1('0x44')]({'attributes':['id',_0x1fb1('0x3')]}));_0x316f7c[_0x1fb1('0x32')](_0xe8ec0a['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x1fb1('0x45')](_0x316f7c);}})['then'](function(_0x475e71){if(_0x475e71&&_0x475e71[_0x1fb1('0x46')]){for(var _0x103560=0x0;_0x103560<_0x475e71[_0x1fb1('0x46')];_0x103560+=0x1){for(var _0x3c37af=0x0;_0x3c37af<_0x475e71[_0x103560][_0x1fb1('0x46')];_0x3c37af+=0x1){switch(_0x103560){case 0x0:joinOrLeaveQueues(_0x12c1d0,_0x10924f,'voice',_0x475e71[_0x103560][_0x3c37af]);break;case 0x1:joinOrLeaveQueues(_0x12c1d0,_0x10924f,_0x1fb1('0x47'),_0x475e71[_0x103560][_0x3c37af]);break;case 0x2:joinOrLeaveQueues(_0x12c1d0,_0x10924f,_0x1fb1('0x48'),_0x475e71[_0x103560][_0x3c37af]);break;case 0x3:joinOrLeaveQueues(_0x12c1d0,_0x10924f,_0x1fb1('0x49'),_0x475e71[_0x103560][_0x3c37af]);break;case 0x4:joinOrLeaveQueues(_0x12c1d0,_0x10924f,'mail',_0x475e71[_0x103560][_0x3c37af]);break;case 0x5:joinOrLeaveQueues(_0x12c1d0,_0x10924f,_0x1fb1('0x4a'),_0x475e71[_0x103560][_0x3c37af]);break;case 0x6:joinOrLeaveQueues(_0x12c1d0,_0x10924f,'whatsapp',_0x475e71[_0x103560][_0x3c37af]);break;case 0x7:if(_0x53b8af[_0x1fb1('0x5')]!==_0x1fb1('0x6'))_0x12c1d0[_0x10924f](util[_0x1fb1('0x2d')]('telephone:%s',_0x475e71[_0x103560][_0x3c37af][_0x1fb1('0x3')]));break;case 0x8:if(_0x53b8af[_0x1fb1('0x5')]!=='agent')_0x12c1d0[_0x10924f](util[_0x1fb1('0x2d')](_0x1fb1('0x4b'),_0x475e71[_0x103560][_0x3c37af][_0x1fb1('0x3')]));break;case 0x9:if(_0x53b8af['role']!=='agent')_0x12c1d0[_0x10924f](util['format'](_0x1fb1('0x4c'),_0x475e71[_0x103560][_0x3c37af][_0x1fb1('0x8')],_0x475e71[_0x103560][_0x3c37af][_0x1fb1('0x3')]));break;case 0xa:_0x12c1d0[_0x10924f](util[_0x1fb1('0x2d')](_0x1fb1('0x4d'),_0x475e71[_0x103560][_0x3c37af][_0x1fb1('0x3')]));break;}}}}})['then'](function(){if(_0x10924f==='leave'){var _0x267c36=_[_0x1fb1('0x4e')](_0x53b8af[_0x1fb1('0x22')],'id');return _0x53b8af[_0x1fb1('0x4f')](_0x267c36)['then'](function(){for(var _0x4c53fe=0x0;_0x4c53fe<_0x267c36[_0x1fb1('0x46')];_0x4c53fe+=0x1){_0x303a06['emit'](_0x1fb1('0x50'),{'ChatInteractionId':Number(_0x267c36[_0x4c53fe]),'UserId':Number(_0x53b8af['id'])});}});}})['then'](function(){if(_0x10924f===_0x1fb1('0x51')){var _0x5ad2be=_[_0x1fb1('0x4e')](_0x53b8af[_0x1fb1('0x24')],'id');return _0x53b8af[_0x1fb1('0x52')](_0x5ad2be)[_0x1fb1('0xc')](function(){for(var _0x1b197c=0x0;_0x1b197c<_0x5ad2be['length'];_0x1b197c+=0x1){_0x303a06['emit'](_0x1fb1('0x53'),{'MailInteractionId':Number(_0x5ad2be[_0x1b197c]),'UserId':Number(_0x53b8af['id'])});}});}})[_0x1fb1('0xc')](function(){if(_0x10924f==='leave'){var _0x5c9695=_[_0x1fb1('0x4e')](_0x53b8af[_0x1fb1('0x26')],'id');return _0x53b8af[_0x1fb1('0x54')](_0x5c9695)[_0x1fb1('0xc')](function(){for(var _0x439670=0x0;_0x439670<_0x5c9695[_0x1fb1('0x46')];_0x439670+=0x1){_0x303a06['emit'](_0x1fb1('0x55'),{'FaxInteractionId':Number(_0x5c9695[_0x439670]),'UserId':Number(_0x53b8af['id'])});}});}})[_0x1fb1('0xc')](function(){if(_0x10924f===_0x1fb1('0x51')){var _0x285df6=_[_0x1fb1('0x4e')](_0x53b8af[_0x1fb1('0x28')],'id');return _0x53b8af[_0x1fb1('0x56')](_0x285df6)['then'](function(){for(var _0x1fd9e1=0x0;_0x1fd9e1<_0x285df6[_0x1fb1('0x46')];_0x1fd9e1+=0x1){_0x303a06[_0x1fb1('0x57')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x285df6[_0x1fd9e1]),'UserId':Number(_0x53b8af['id'])});}});}})[_0x1fb1('0xc')](function(){if(_0x10924f===_0x1fb1('0x51')){var _0xeeb8ce=_['map'](_0x53b8af[_0x1fb1('0x2a')],'id');return _0x53b8af[_0x1fb1('0x58')](_0xeeb8ce)[_0x1fb1('0xc')](function(){for(var _0x4232cf=0x0;_0x4232cf<_0xeeb8ce[_0x1fb1('0x46')];_0x4232cf+=0x1){_0x303a06[_0x1fb1('0x57')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xeeb8ce[_0x4232cf]),'UserId':Number(_0x53b8af['id'])});}});}})['then'](function(){if(_0x10924f===_0x1fb1('0x51')){var _0x1d7478=_[_0x1fb1('0x4e')](_0x53b8af[_0x1fb1('0x2c')],'id');return _0x53b8af[_0x1fb1('0x59')](_0x1d7478)[_0x1fb1('0xc')](function(){for(var _0x428fc9=0x0;_0x428fc9<_0x1d7478['length'];_0x428fc9+=0x1){_0x303a06[_0x1fb1('0x57')](_0x1fb1('0x5a'),{'WhatsappInteractionId':Number(_0x1d7478[_0x428fc9]),'UserId':Number(_0x53b8af['id'])});}});}})[_0x1fb1('0x5b')](function(_0x2c0c36){_0x12c1d0[_0x1fb1('0x5c')](_0x2c0c36);});}}function onDisconnect(_0xd87c55,_0x5659b1){joinOrLeave(_0xd87c55,_0x1fb1('0x51'),_0x5659b1);}function onConnect(_0x417c9e){joinOrLeave(_0x417c9e,_0x1fb1('0x5d'));}exports[_0x1fb1('0x5e')]=function(_0x3d3bfa){_0x3d3bfa['on']('connection',function(_0x441fcb){_0x441fcb[_0x1fb1('0x5f')](0x0);_0x441fcb['address']=_0x441fcb[_0x1fb1('0x60')]['connection'][_0x1fb1('0x61')]+':'+_0x441fcb[_0x1fb1('0x60')][_0x1fb1('0x62')][_0x1fb1('0x63')];_0x441fcb['connectedAt']=new Date();_0x441fcb[_0x1fb1('0x5c')]=function(_0x3fda2b){console[_0x1fb1('0x5c')](_0x1fb1('0x64')+_0x441fcb['nsp'][_0x1fb1('0x3')]+'['+_0x441fcb['address']+']',_0x3fda2b);};_0x441fcb['on'](_0x1fb1('0x65'),function(){onDisconnect(_0x441fcb,_0x3d3bfa);_0x441fcb[_0x1fb1('0x5c')]('DISCONNECTED');});onConnect(_0x441fcb);_0x441fcb[_0x1fb1('0x5c')](_0x1fb1('0x66'));});}; \ No newline at end of file +var _0x110f=['user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','name','User','role','telephone','agent','type','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','Agents','length','format','user:%s','handshake','query','find','userProfileId','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','VoiceQueues','SmsQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','openchannel','whatsapp','telephone:%s','trunk:%s','ChatInteractions','leave','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','emit','user_has_sms_interactions:remove','removeOpenchannelInteractions'];(function(_0x3d4787,_0x425210){var _0xbeeb22=function(_0x28888e){while(--_0x28888e){_0x3d4787['push'](_0x3d4787['shift']());}};_0xbeeb22(++_0x425210);}(_0x110f,0x1e6));var _0xf110=function(_0x1609ae,_0x5c1282){_0x1609ae=_0x1609ae-0x0;var _0xea5e74=_0x110f[_0x1609ae];return _0xea5e74;};'use strict';var _=require(_0xf110('0x0'));var util=require(_0xf110('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xf110('0x2')],'include':[{'as':'Agents','model':db[_0xf110('0x3')],'attributes':['id',_0xf110('0x2'),_0xf110('0x4')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf110('0x2')],'where':{'role':_0xf110('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0xf110('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf110('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf110('0x2'),_0xf110('0x7')],'where':{'type':'ivr'}};function getAssociatedResources(_0x307bce,_0xb51c4b,_0x11c28f){return db['UserProfileSection'][_0xf110('0x8')]({'where':{'name':_0x307bce,'userProfileId':_0xb51c4b},'raw':!![]})[_0xf110('0x9')](function(_0x17a94a){if(_0x17a94a){if(_0x17a94a[_0xf110('0xa')]){switch(_0x307bce){case'VoiceQueues':case _0xf110('0xb'):case _0xf110('0xc'):case'SmsQueues':case _0xf110('0xd'):case _0xf110('0xe'):case _0xf110('0xf'):return db[_0x11c28f][_0xf110('0x10')](queryQueues);case'Telephones':return db[_0x11c28f][_0xf110('0x10')](queryTelephones);case _0xf110('0x11'):return db[_0x11c28f][_0xf110('0x10')](queryTrunks);case'IvrCampaigns':return db[_0x11c28f][_0xf110('0x10')](queryCampaigns);}}else{return db[_0xf110('0x12')]['findAll']({'attributes':[_0xf110('0x13')],'where':{'sectionId':_0x17a94a['id']},'raw':!![]})[_0xf110('0x9')](function(_0x40cd2b){if(_0x40cd2b){var _0x325496={'where':{'id':_[_0xf110('0x14')](_0x40cd2b,_0xf110('0x13'))},'raw':!![]};switch(_0x11c28f){case _0xf110('0x3'):_0x325496[_0xf110('0x15')][_0xf110('0x4')]='telephone';break;case _0xf110('0x16'):_0x325496[_0xf110('0x15')][_0xf110('0x7')]='ivr';break;}return db[_0x11c28f][_0xf110('0x10')](_0x325496);}else{return[];}});}}else{return[];}})['then'](function(_0x1217a8){return _0x1217a8;});}function joinOrLeaveQueues(_0x36092a,_0x119e56,_0x36d6d7,_0xcde9b9){_0x36092a[_0x119e56](util['format'](_0xf110('0x17'),_0x36d6d7,_0xcde9b9[_0xf110('0x2')]));if(_0xcde9b9['Agents']){for(var _0x7f7608=0x0;_0x7f7608<_0xcde9b9[_0xf110('0x18')][_0xf110('0x19')];_0x7f7608+=0x1){_0x36092a[_0x119e56](util[_0xf110('0x1a')](_0xf110('0x1b'),_0xcde9b9['Agents'][_0x7f7608][_0xf110('0x2')]));}}}function joinOrLeave(_0x2558c5,_0x4c156f,_0x9980ec){var _0xc52064;if(_0x2558c5[_0xf110('0x1c')][_0xf110('0x1d')]['id']){db[_0xf110('0x3')][_0xf110('0x1e')]({'attributes':['id',_0xf110('0x2'),'role',_0xf110('0x1f')],'where':{'id':_0x2558c5['handshake'][_0xf110('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf110('0x20')],'as':_0xf110('0x21'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xf110('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xf110('0x23')],'as':_0xf110('0x24'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xf110('0x25'),'attributes':['id'],'raw':!![]}]})[_0xf110('0x9')](function(_0x56f9fd){if(_0x56f9fd){_0xc52064=_0x56f9fd;_0x2558c5[_0x4c156f](util[_0xf110('0x1a')](_0xf110('0x1b'),_0x56f9fd[_0xf110('0x2')]));var _0x44c603=[];switch(_0x56f9fd[_0xf110('0x4')]){case _0xf110('0x26'):_0x2558c5[_0x4c156f](_0xf110('0x27'));_0x2558c5[_0x4c156f](_0xf110('0x28'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0xf110('0x29')];}_0x44c603['push'](db[_0xf110('0x2a')][_0xf110('0x10')](queryQueues));_0x44c603[_0xf110('0x2b')](db[_0xf110('0x2c')][_0xf110('0x10')](queryQueues));_0x44c603[_0xf110('0x2b')](db[_0xf110('0x2d')][_0xf110('0x10')](queryQueues));_0x44c603[_0xf110('0x2b')](db['SmsQueue'][_0xf110('0x10')](queryQueues));_0x44c603[_0xf110('0x2b')](db[_0xf110('0x2e')][_0xf110('0x10')](queryQueues));_0x44c603[_0xf110('0x2b')](db[_0xf110('0x2f')][_0xf110('0x10')](queryQueues));_0x44c603[_0xf110('0x2b')](db[_0xf110('0x30')][_0xf110('0x10')](queryQueues));_0x44c603[_0xf110('0x2b')](db[_0xf110('0x3')][_0xf110('0x10')](queryTelephones));_0x44c603[_0xf110('0x2b')](db['Trunk'][_0xf110('0x10')](queryTrunks));_0x44c603[_0xf110('0x2b')](db[_0xf110('0x16')][_0xf110('0x10')](queryCampaigns));_0x44c603[_0xf110('0x2b')](db[_0xf110('0x3')][_0xf110('0x10')](queryAgents));break;case _0xf110('0x31'):_0x2558c5[_0x4c156f](_0xf110('0x27'));_0x2558c5[_0x4c156f](_0xf110('0x28'));_0x44c603['push'](getAssociatedResources(_0xf110('0x32'),_0x56f9fd[_0xf110('0x1f')],_0xf110('0x2a')));_0x44c603[_0xf110('0x2b')](getAssociatedResources(_0xf110('0xb'),_0x56f9fd[_0xf110('0x1f')],_0xf110('0x2c')));_0x44c603[_0xf110('0x2b')](getAssociatedResources(_0xf110('0xc'),_0x56f9fd[_0xf110('0x1f')],_0xf110('0x2d')));_0x44c603[_0xf110('0x2b')](getAssociatedResources('SmsQueues',_0x56f9fd['userProfileId'],_0xf110('0x33')));_0x44c603[_0xf110('0x2b')](getAssociatedResources(_0xf110('0xd'),_0x56f9fd[_0xf110('0x1f')],_0xf110('0x2e')));_0x44c603['push'](getAssociatedResources(_0xf110('0xe'),_0x56f9fd[_0xf110('0x1f')],_0xf110('0x2f')));_0x44c603[_0xf110('0x2b')](getAssociatedResources('WhatsappQueues',_0x56f9fd[_0xf110('0x1f')],_0xf110('0x30')));_0x44c603['push'](getAssociatedResources(_0xf110('0x34'),_0x56f9fd[_0xf110('0x1f')],_0xf110('0x3')));_0x44c603[_0xf110('0x2b')](getAssociatedResources('Trunks',_0x56f9fd[_0xf110('0x1f')],'Trunk'));_0x44c603[_0xf110('0x2b')](getAssociatedResources('IvrCampaigns',_0x56f9fd[_0xf110('0x1f')],_0xf110('0x16')));_0x44c603[_0xf110('0x2b')](db['User'][_0xf110('0x10')](queryAgents));break;case'agent':_0x2558c5[_0x4c156f](_0xf110('0x27'));_0x2558c5[_0x4c156f](_0xf110('0x28'));_0x44c603[_0xf110('0x2b')](_0x56f9fd[_0xf110('0x35')]({'attributes':['id',_0xf110('0x2')]}));_0x44c603[_0xf110('0x2b')](_0x56f9fd[_0xf110('0x36')]({'attributes':['id',_0xf110('0x2')]}));_0x44c603[_0xf110('0x2b')](_0x56f9fd[_0xf110('0x37')]({'attributes':['id','name']}));_0x44c603['push'](_0x56f9fd[_0xf110('0x38')]({'attributes':['id',_0xf110('0x2')]}));_0x44c603['push'](_0x56f9fd[_0xf110('0x39')]({'attributes':['id','name']}));_0x44c603[_0xf110('0x2b')](_0x56f9fd[_0xf110('0x3a')]({'attributes':['id',_0xf110('0x2')]}));_0x44c603[_0xf110('0x2b')](_0x56f9fd[_0xf110('0x3b')]({'attributes':['id',_0xf110('0x2')]}));break;}return BPromise[_0xf110('0x3c')](_0x44c603);}})[_0xf110('0x9')](function(_0x3a50e9){if(_0x3a50e9&&_0x3a50e9[_0xf110('0x19')]){for(var _0x4dbf57=0x0;_0x4dbf57<_0x3a50e9[_0xf110('0x19')];_0x4dbf57+=0x1){for(var _0x253c8d=0x0;_0x253c8d<_0x3a50e9[_0x4dbf57][_0xf110('0x19')];_0x253c8d+=0x1){switch(_0x4dbf57){case 0x0:joinOrLeaveQueues(_0x2558c5,_0x4c156f,_0xf110('0x3d'),_0x3a50e9[_0x4dbf57][_0x253c8d]);break;case 0x1:joinOrLeaveQueues(_0x2558c5,_0x4c156f,'chat',_0x3a50e9[_0x4dbf57][_0x253c8d]);break;case 0x2:joinOrLeaveQueues(_0x2558c5,_0x4c156f,_0xf110('0x3e'),_0x3a50e9[_0x4dbf57][_0x253c8d]);break;case 0x3:joinOrLeaveQueues(_0x2558c5,_0x4c156f,'sms',_0x3a50e9[_0x4dbf57][_0x253c8d]);break;case 0x4:joinOrLeaveQueues(_0x2558c5,_0x4c156f,'mail',_0x3a50e9[_0x4dbf57][_0x253c8d]);break;case 0x5:joinOrLeaveQueues(_0x2558c5,_0x4c156f,_0xf110('0x3f'),_0x3a50e9[_0x4dbf57][_0x253c8d]);break;case 0x6:joinOrLeaveQueues(_0x2558c5,_0x4c156f,_0xf110('0x40'),_0x3a50e9[_0x4dbf57][_0x253c8d]);break;case 0x7:if(_0xc52064[_0xf110('0x4')]!=='agent')_0x2558c5[_0x4c156f](util[_0xf110('0x1a')](_0xf110('0x41'),_0x3a50e9[_0x4dbf57][_0x253c8d][_0xf110('0x2')]));break;case 0x8:if(_0xc52064[_0xf110('0x4')]!==_0xf110('0x6'))_0x2558c5[_0x4c156f](util[_0xf110('0x1a')](_0xf110('0x42'),_0x3a50e9[_0x4dbf57][_0x253c8d][_0xf110('0x2')]));break;case 0x9:if(_0xc52064[_0xf110('0x4')]!==_0xf110('0x6'))_0x2558c5[_0x4c156f](util[_0xf110('0x1a')]('campaign:%s:%s',_0x3a50e9[_0x4dbf57][_0x253c8d][_0xf110('0x7')],_0x3a50e9[_0x4dbf57][_0x253c8d][_0xf110('0x2')]));break;case 0xa:_0x2558c5[_0x4c156f](util['format'](_0xf110('0x1b'),_0x3a50e9[_0x4dbf57][_0x253c8d]['name']));break;}}}}})['then'](function(){if(_0x4c156f==='leave'){var _0x6765d9=_[_0xf110('0x14')](_0xc52064[_0xf110('0x43')],'id');return _0xc52064['removeChatInteractions'](_0x6765d9)[_0xf110('0x9')](function(){for(var _0x495fe9=0x0;_0x495fe9<_0x6765d9[_0xf110('0x19')];_0x495fe9+=0x1){_0x9980ec['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6765d9[_0x495fe9]),'UserId':Number(_0xc52064['id'])});}});}})[_0xf110('0x9')](function(){if(_0x4c156f===_0xf110('0x44')){var _0x123b8c=_[_0xf110('0x14')](_0xc52064[_0xf110('0x45')],'id');return _0xc52064[_0xf110('0x46')](_0x123b8c)[_0xf110('0x9')](function(){for(var _0x1e8984=0x0;_0x1e8984<_0x123b8c[_0xf110('0x19')];_0x1e8984+=0x1){_0x9980ec['emit'](_0xf110('0x47'),{'MailInteractionId':Number(_0x123b8c[_0x1e8984]),'UserId':Number(_0xc52064['id'])});}});}})[_0xf110('0x9')](function(){if(_0x4c156f===_0xf110('0x44')){var _0x4c606a=_[_0xf110('0x14')](_0xc52064[_0xf110('0x21')],'id');return _0xc52064[_0xf110('0x48')](_0x4c606a)[_0xf110('0x9')](function(){for(var _0x3829e9=0x0;_0x3829e9<_0x4c606a[_0xf110('0x19')];_0x3829e9+=0x1){_0x9980ec['emit'](_0xf110('0x49'),{'FaxInteractionId':Number(_0x4c606a[_0x3829e9]),'UserId':Number(_0xc52064['id'])});}});}})[_0xf110('0x9')](function(){if(_0x4c156f==='leave'){var _0x2b652b=_[_0xf110('0x14')](_0xc52064[_0xf110('0x22')],'id');return _0xc52064[_0xf110('0x4a')](_0x2b652b)['then'](function(){for(var _0x1fc17b=0x0;_0x1fc17b<_0x2b652b[_0xf110('0x19')];_0x1fc17b+=0x1){_0x9980ec[_0xf110('0x4b')](_0xf110('0x4c'),{'SmsInteractionId':Number(_0x2b652b[_0x1fc17b]),'UserId':Number(_0xc52064['id'])});}});}})['then'](function(){if(_0x4c156f===_0xf110('0x44')){var _0x17a0f6=_[_0xf110('0x14')](_0xc52064[_0xf110('0x24')],'id');return _0xc52064[_0xf110('0x4d')](_0x17a0f6)[_0xf110('0x9')](function(){for(var _0x2765cf=0x0;_0x2765cf<_0x17a0f6['length'];_0x2765cf+=0x1){_0x9980ec[_0xf110('0x4b')](_0xf110('0x4e'),{'OpenchannelInteractionId':Number(_0x17a0f6[_0x2765cf]),'UserId':Number(_0xc52064['id'])});}});}})[_0xf110('0x9')](function(){if(_0x4c156f===_0xf110('0x44')){var _0x3098fd=_[_0xf110('0x14')](_0xc52064[_0xf110('0x25')],'id');return _0xc52064[_0xf110('0x4f')](_0x3098fd)[_0xf110('0x9')](function(){for(var _0x3bc38e=0x0;_0x3bc38e<_0x3098fd[_0xf110('0x19')];_0x3bc38e+=0x1){_0x9980ec[_0xf110('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3098fd[_0x3bc38e]),'UserId':Number(_0xc52064['id'])});}});}})[_0xf110('0x50')](function(_0x493060){_0x2558c5[_0xf110('0x51')](_0x493060);});}}function onDisconnect(_0x4b759a,_0x16cdcf){joinOrLeave(_0x4b759a,_0xf110('0x44'),_0x16cdcf);}function onConnect(_0x5aa8c5){joinOrLeave(_0x5aa8c5,_0xf110('0x52'));}exports[_0xf110('0x53')]=function(_0x4e0e60){_0x4e0e60['on'](_0xf110('0x54'),function(_0x58c397){_0x58c397[_0xf110('0x55')](0x0);_0x58c397[_0xf110('0x56')]=_0x58c397[_0xf110('0x57')][_0xf110('0x54')][_0xf110('0x58')]+':'+_0x58c397['request']['connection']['remotePort'];_0x58c397[_0xf110('0x59')]=new Date();_0x58c397[_0xf110('0x51')]=function(_0x34b670){console[_0xf110('0x51')](_0xf110('0x5a')+_0x58c397['nsp'][_0xf110('0x2')]+'['+_0x58c397[_0xf110('0x56')]+']',_0x34b670);};_0x58c397['on'](_0xf110('0x5b'),function(){onDisconnect(_0x58c397,_0x4e0e60);_0x58c397[_0xf110('0x51')](_0xf110('0x5c'));});onConnect(_0x58c397);_0x58c397[_0xf110('0x51')](_0xf110('0x5d'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8f09985..5dd7074 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 _0x78e0=['query','Sequelize','QueryTypes','SELECT','then','contact','UserId','User','find','name','fullname','email','internal','interface','SIP/%s','outgoingmessage','get','opened','changed','closed','substatus','format','agent','default','length','hasOwnProperty','model','toLowerCase','util','../../mysqldb','jayson/promise','../logger','triggers','lodash','http','ChatInteraction','afterCreate','Chat','afterUpdate','closedinteraction','newinteraction','SmsInteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','EventManager','info','error','code','Trigger,\x20%s','catch','channel','motionChannel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize'];(function(_0x431bae,_0xfec86c){var _0x3a4789=function(_0x4b4b6f){while(--_0x4b4b6f){_0x431bae['push'](_0x431bae['shift']());}};_0x3a4789(++_0xfec86c);}(_0x78e0,0xe5));var _0x078e=function(_0x2b3b3a,_0x3226e0){_0x2b3b3a=_0x2b3b3a-0x0;var _0x4b1b2c=_0x78e0[_0x2b3b3a];return _0x4b1b2c;};'use strict';var util=require(_0x078e('0x0'));var db=require(_0x078e('0x1'))['db'];var jayson=require(_0x078e('0x2'));var logger=require(_0x078e('0x3'))(_0x078e('0x4'));var _=require(_0x078e('0x5'));var client=jayson['client'][_0x078e('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x078e('0x7'),'event':_0x078e('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x078e('0x9'),'model':_0x078e('0x7'),'event':_0x078e('0xa'),'condition':_0x078e('0xb'),'callback':afterUpdate},{'channel':_0x078e('0x9'),'model':'ChatMessage','event':_0x078e('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':'SmsInteraction','event':_0x078e('0x8'),'condition':_0x078e('0xc'),'callback':afterCreate},{'channel':'Sms','model':_0x078e('0xd'),'event':_0x078e('0xa'),'condition':_0x078e('0xb'),'callback':afterUpdate},{'channel':'Sms','model':_0x078e('0xe'),'event':_0x078e('0x8'),'condition':_0x078e('0xf'),'callback':afterCreateMessage},{'channel':_0x078e('0x10'),'model':_0x078e('0x11'),'event':'afterCreate','condition':_0x078e('0xc'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x078e('0x11'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x078e('0x10'),'model':_0x078e('0x12'),'event':_0x078e('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x078e('0x13'),'model':_0x078e('0x14'),'event':_0x078e('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x078e('0x13'),'model':_0x078e('0x14'),'event':'afterUpdate','condition':_0x078e('0xb'),'callback':afterUpdate},{'channel':_0x078e('0x13'),'model':_0x078e('0x15'),'event':_0x078e('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x078e('0x16'),'model':_0x078e('0x17'),'event':_0x078e('0x8'),'condition':_0x078e('0xc'),'callback':afterCreate},{'channel':_0x078e('0x16'),'model':_0x078e('0x17'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x078e('0x16'),'model':_0x078e('0x18'),'event':'afterCreate','condition':_0x078e('0xf'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x078e('0x8'),'condition':_0x078e('0xc'),'callback':afterCreate},{'channel':_0x078e('0x19'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x078e('0xb'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x078e('0x8'),'condition':_0x078e('0xf'),'callback':afterCreateMessage}];function request(_0x494d5e){return client['request'](_0x078e('0x1a'),_0x494d5e)['then'](function(_0x4c85af){logger[_0x078e('0x1b')]('Trigger,\x20%s',_0x078e('0x1a'),_0x4c85af);if(_0x4c85af[_0x078e('0x1c')]){if(_0x4c85af['error'][_0x078e('0x1d')]===0x1f4){logger[_0x078e('0x1c')](_0x078e('0x1e'),_0x078e('0x1a'),_0x4c85af[_0x078e('0x1c')]);}}})[_0x078e('0x1f')](function(_0x41289c){logger['error']('Trigger,\x20%s',_0x078e('0x1a'),_0x41289c);});}function afterCreateMessage(_0x28073e,_0x19e092){return function(_0x59ea25,_0x9bd023){_0x59ea25=_0x59ea25['get']({'plain':!![]});_0x59ea25[_0x078e('0x20')]=_0x28073e;_0x59ea25[_0x078e('0x21')]=_0x28073e;_0x59ea25[_0x078e('0x22')]=_0x59ea25[_0x078e('0x23')];var _0x1c114a=_0x078e('0x24')+_0x59ea25[_0x078e('0x25')];return db[_0x078e('0x26')][_0x078e('0x27')](_0x1c114a,{'type':db[_0x078e('0x28')][_0x078e('0x29')][_0x078e('0x2a')],'raw':!![]})['then'](function(_0x1e44a3){return _0x1e44a3;})[_0x078e('0x2b')](function(_0x40d17f){if(_0x40d17f){_0x59ea25[_0x078e('0x2c')]=_0x40d17f[0x0];}if(_0x59ea25[_0x078e('0x2d')]){return db[_0x078e('0x2e')][_0x078e('0x2f')]({'where':{'id':_0x59ea25['UserId']},'attributes':['id',_0x078e('0x30'),_0x078e('0x31'),_0x078e('0x32'),_0x078e('0x33')],'raw':!![]})[_0x078e('0x2b')](function(_0xbeab56){_0x59ea25[_0x078e('0x34')]=util['format'](_0x078e('0x35'),_0xbeab56['name']);_0x59ea25[_0x078e('0x20')]=_0x28073e;_0x59ea25['agent']=_0xbeab56;return request({'event':'incomingmessage','message':_0x59ea25});})[_0x078e('0x1f')](function(_0x183308){console[_0x078e('0x1c')](_0x183308);});}else{return request({'event':_0x078e('0x36'),'message':_0x59ea25});}});};}function afterCreate(_0x2c7666,_0x5ea3b6){return function(_0x3cd3,_0xf19572){_0x3cd3=_0x3cd3[_0x078e('0x37')]({'plain':!![]});_0x3cd3[_0x078e('0x20')]=_0x2c7666;_0x3cd3[_0x078e('0x21')]=_0x2c7666;_0x3cd3[_0x078e('0x22')]=_0x078e('0x38');var _0x2d2e6d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3cd3[_0x078e('0x25')];return db[_0x078e('0x26')][_0x078e('0x27')](_0x2d2e6d,{'type':db[_0x078e('0x28')]['QueryTypes'][_0x078e('0x2a')],'raw':!![]})[_0x078e('0x2b')](function(_0x40376a){return _0x40376a;})[_0x078e('0x2b')](function(_0x5c75a6){if(_0x5c75a6){_0x3cd3['contact']=_0x5c75a6[0x0];}return request({'event':_0x5ea3b6,'message':_0x3cd3});});};}function afterUpdate(_0x50f02f){return function(_0x1cc399){var _0x174e0f=_0x1cc399[_0x078e('0x39')](_0x078e('0x3a'))&&_0x1cc399[_0x078e('0x3a')];var _0x11deae=_0x1cc399[_0x078e('0x39')](_0x078e('0x3b'));if(_0x174e0f||_0x11deae){var _0x3b1526=_0x174e0f?_0x078e('0xb'):_0x078e('0x3b');var _0x4c88bf=_0x1cc399[_0x078e('0x37')]({'plain':!![]});_0x4c88bf[_0x078e('0x20')]=_0x50f02f;_0x4c88bf[_0x078e('0x21')]=_0x50f02f;_0x4c88bf['event']=_0x174e0f?_0x078e('0x3a'):_0x078e('0x3b');var _0x496439=_0x078e('0x24')+_0x4c88bf['ContactId'];return db[_0x078e('0x26')]['query'](_0x496439,{'type':db[_0x078e('0x28')]['QueryTypes'][_0x078e('0x2a')],'raw':!![]})[_0x078e('0x2b')](function(_0x56d228){if(_0x56d228){_0x4c88bf['contact']=_0x56d228[0x0];}if(_0x4c88bf['UserId']){return db[_0x078e('0x2e')][_0x078e('0x2f')]({'where':{'id':_0x4c88bf[_0x078e('0x2d')]},'attributes':['id',_0x078e('0x30'),_0x078e('0x31'),_0x078e('0x32'),_0x078e('0x33')],'raw':!![]})[_0x078e('0x2b')](function(_0x19c520){_0x4c88bf[_0x078e('0x34')]=util[_0x078e('0x3c')](_0x078e('0x35'),_0x19c520[_0x078e('0x30')]);_0x4c88bf[_0x078e('0x3d')]=_0x19c520;return request({'event':_0x3b1526,'message':_0x4c88bf});})['catch'](function(_0x231161){console[_0x078e('0x1c')](_0x231161);});}else{return request({'event':_0x3b1526,'message':_0x4c88bf});}});}};}exports[_0x078e('0x3e')]=function(){for(var _0x2449cf=0x0;_0x2449cf=_0x45155c[_0x66f1('0x17')]){throw Error(_0x66f1('0x18'));}_0x44c8b2(_0x44c433);})['catch'](function(_0x626d9c){_0x5c1a73(_0x626d9c);});});}; \ No newline at end of file +var _0xc3ca=['sms','whatsapp','openchannel','getChannels','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','voice','mail','chat','fax'];(function(_0x3e8005,_0x512ba9){var _0x24af1b=function(_0x56e859){while(--_0x56e859){_0x3e8005['push'](_0x3e8005['shift']());}};_0x24af1b(++_0x512ba9);}(_0xc3ca,0x7e));var _0xac3c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xc3ca[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xac3c('0x0'));var BPromise=require('bluebird');var db=require(_0xac3c('0x1'))['db'];var util=require('./license/util');var channels=[_0xac3c('0x2'),_0xac3c('0x3'),_0xac3c('0x4'),_0xac3c('0x5'),_0xac3c('0x6'),_0xac3c('0x7'),_0xac3c('0x8')];exports[_0xac3c('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x507587){_0x507587=_0x507587['toLowerCase']();return _[_0xac3c('0xa')](channels,_0x507587);};exports[_0xac3c('0xb')]=function(_0x1dc55d,_0x274c8c,_0x200340,_0x28cbaf){var _0x53d7e0={'loginAttempts':_0x274c8c,'blocked':_0x200340};if(!_[_0xac3c('0xc')](_0x28cbaf)){_0x53d7e0[_0xac3c('0xd')]=_0x28cbaf;}return _0x1dc55d[_0xac3c('0xe')](_0x53d7e0);};exports[_0xac3c('0xf')]=function(_0x4f5c50){return new BPromise(function(_0x4d0156,_0x3ef9e3){var _0x34a48d=0x0;if(_0x4f5c50[_0xac3c('0x10')]!==_0xac3c('0x11')){_0x4d0156(_0x4f5c50);}db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4f5c50['id']}}})['then'](function(_0x1c3789){_0x34a48d=_0x1c3789;return util['getLicense']();})[_0xac3c('0x12')](function(_0x4397d6){if(_0x4397d6&&_0x4397d6[_0xac3c('0x13')]&&_0x34a48d>=_0x4397d6[_0xac3c('0x13')]){throw Error(_0xac3c('0x14'));}_0x4d0156(_0x4f5c50);})[_0xac3c('0x15')](function(_0x3715ed){_0x3ef9e3(_0x3715ed);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ab685e7..bb12e4f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7453=['status','send','exports','404'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7453,0xc6));var _0x3745=function(_0x48c913,_0x1e9a4f){_0x48c913=_0x48c913-0x0;var _0x1d0547=_0x7453[_0x48c913];return _0x1d0547;};'use strict';module[_0x3745('0x0')][0x194]=function pageNotFound(_0x5ebd7b,_0x1d06db){var _0x4a99af=_0x3745('0x1');var _0x2976c6=0x194;var _0x136acd={'status':_0x2976c6};_0x1d06db[_0x3745('0x2')](_0x136acd['status']);_0x1d06db['render'](_0x4a99af,{},function(_0x1846ec,_0x15146c){if(_0x1846ec){return _0x1d06db[_0x3745('0x2')](_0x136acd['status'])['json'](_0x136acd);}_0x1d06db[_0x3745('0x3')](_0x15146c);});}; \ No newline at end of file +var _0x2369=['status','render','send'];(function(_0x1d525d,_0x491998){var _0x135719=function(_0x2b0426){while(--_0x2b0426){_0x1d525d['push'](_0x1d525d['shift']());}};_0x135719(++_0x491998);}(_0x2369,0x1e6));var _0x9236=function(_0x56e6e9,_0x291627){_0x56e6e9=_0x56e6e9-0x0;var _0x5e3a01=_0x2369[_0x56e6e9];return _0x5e3a01;};'use strict';module['exports'][0x194]=function pageNotFound(_0x7482f1,_0xe44306){var _0x5dc818='404';var _0x5c31f5=0x194;var _0x49a1ef={'status':_0x5c31f5};_0xe44306[_0x9236('0x0')](_0x49a1ef[_0x9236('0x0')]);_0xe44306[_0x9236('0x1')](_0x5dc818,{},function(_0x35cb4a,_0x3e01b8){if(_0x35cb4a){return _0xe44306[_0x9236('0x0')](_0x49a1ef['status'])['json'](_0x49a1ef);}_0xe44306[_0x9236('0x2')](_0x3e01b8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1110449..f272ff0 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa571=['../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','User','hasOne','Recordings','UserId','hasMany','VoiceQueuesRt','Extensions','cascade','CmHopperFinal','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','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','VoiceQueues','VoicePrefixes','MailQueue','UserMailQueue','ChatQueues','FaxQueues','OpenchannelQueues','cm_user_has_lists','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','CmHopper','Hoppers','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','TemplateId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Contact','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatOfflineMessage','ChatOfflineMessageId','restrict','ListId','Dashboard','Items','FaxAccountId','Exntensions','TagId','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Website','HopperHistories','Company','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','All','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','moh_has_sounds','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','SalesforceAccount','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Field','Dynamics365Account','FreshsalesConfiguration','FreshsalesField','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','user_has_square_projects','MailQueues','SmsQueues','WhatsappQueues','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','CmCustomField','CustomFields','Queues','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','sequelize','lodash','jstz','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xC@LL1234','username','password','options','VoiceChanSpy','import','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../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','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport'];(function(_0xf67acd,_0x1256f7){var _0x34766d=function(_0x21cc6f){while(--_0x21cc6f){_0xf67acd['push'](_0xf67acd['shift']());}};_0x34766d(++_0x1256f7);}(_0xa571,0x107));var _0x1a57=function(_0x588834,_0x141d48){_0x588834=_0x588834-0x0;var _0x387b9c=_0xa571[_0x588834];return _0x387b9c;};'use strict';var config=require(_0x1a57('0x0'));var Sequelize=require(_0x1a57('0x1'));var _=require(_0x1a57('0x2'));var jstz=require(_0x1a57('0x3'));var timezone=jstz['determine']();config[_0x1a57('0x1')]=_[_0x1a57('0x4')](config['sequelize'],{'database':'motion2','username':_0x1a57('0x5'),'password':'xC@LL1234','options':{'host':_0x1a57('0x6'),'port':0xcea,'dialect':_0x1a57('0x7'),'dialectOptions':{'charset':_0x1a57('0x8')},'logging':![],'timezone':timezone[_0x1a57('0x9')](),'define':{'charset':_0x1a57('0xa'),'collate':_0x1a57('0xb')}}});config['sequelizeHistory']=_[_0x1a57('0x4')](config[_0x1a57('0xc')],{'database':_0x1a57('0xd'),'username':'xcall','password':_0x1a57('0xe'),'options':{'host':_0x1a57('0x6'),'port':0xcea,'dialect':_0x1a57('0x7'),'dialectOptions':{'charset':_0x1a57('0x8')},'logging':![],'timezone':timezone[_0x1a57('0x9')](),'define':{'charset':_0x1a57('0xa'),'collate':_0x1a57('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a57('0x1')]['database'],config['sequelize'][_0x1a57('0xf')],config[_0x1a57('0x1')][_0x1a57('0x10')],config['sequelize'][_0x1a57('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a57('0xc')]['database'],config[_0x1a57('0xc')]['username'],config[_0x1a57('0xc')][_0x1a57('0x10')],config[_0x1a57('0xc')][_0x1a57('0x11')])};db['User']=db[_0x1a57('0x1')]['import']('../api/user/user.model');db[_0x1a57('0x12')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x1a57('0x14')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/voiceContext/voiceContext.model');db[_0x1a57('0x15')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x16'));db[_0x1a57('0x17')]=db['sequelize']['import'](_0x1a57('0x18'));db[_0x1a57('0x19')]=db[_0x1a57('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x1a'));db[_0x1a57('0x1b')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x1c'));db[_0x1a57('0x1d')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x1e'));db[_0x1a57('0x1f')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x20'));db[_0x1a57('0x21')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x22'));db[_0x1a57('0x23')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x1a57('0x24')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x25'));db['MemberReport']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x26'));db[_0x1a57('0x27')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x28'));db[_0x1a57('0x29')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x2a'));db[_0x1a57('0x2b')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x2c'));db[_0x1a57('0x2d')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x2e'));db['UserChatQueue']=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x2f'));db[_0x1a57('0x30')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x31'));db[_0x1a57('0x32')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x33'));db[_0x1a57('0x34')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x35'));db[_0x1a57('0x36')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x1a57('0x37')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x38'));db[_0x1a57('0x39')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x3a'));db[_0x1a57('0x3b')]=db['sequelize']['import']('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x3c'));db['MailSubstatus']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x3d'));db[_0x1a57('0x3e')]=db['sequelize'][_0x1a57('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x1a57('0x3f')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/mailMessage/mailMessage.model');db[_0x1a57('0x40')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x41'));db[_0x1a57('0x42')]=db['sequelize'][_0x1a57('0x13')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x1a57('0x1')]['import'](_0x1a57('0x43'));db[_0x1a57('0x44')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x45'));db[_0x1a57('0x46')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/faxAccount/faxAccount.model');db[_0x1a57('0x47')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x48'));db['FaxInteraction']=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x49'));db[_0x1a57('0x4a')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x4b'));db[_0x1a57('0x4c')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x4d'));db['FaxQueueReport']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x4e'));db[_0x1a57('0x4f')]=db['sequelize'][_0x1a57('0x13')]('../api/smsAccount/smsAccount.model');db[_0x1a57('0x50')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x51'));db[_0x1a57('0x52')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x53'));db[_0x1a57('0x54')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x55'));db[_0x1a57('0x56')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x57'));db[_0x1a57('0x58')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x59'));db[_0x1a57('0x5a')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x5b'));db[_0x1a57('0x5c')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x5d'));db['OpenchannelMessage']=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x1a57('0x5e')]=db[_0x1a57('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x1a57('0x5f')]=db[_0x1a57('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x60'));db[_0x1a57('0x61')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x62'));db[_0x1a57('0x63')]=db['sequelize']['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x64'));db[_0x1a57('0x65')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x66'));db[_0x1a57('0x67')]=db[_0x1a57('0x1')]['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x1a57('0x1')]['import'](_0x1a57('0x68'));db[_0x1a57('0x69')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x6a'));db[_0x1a57('0x6b')]=db[_0x1a57('0x1')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x6c'));db[_0x1a57('0x6d')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x6e'));db['CmHopperFinal']=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x6f'));db[_0x1a57('0x70')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x71'));db['ReportAgentPreview']=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x72'));db['CmCustomField']=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x73'));db[_0x1a57('0x74')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x75'));db[_0x1a57('0x76')]=db['sequelize']['import'](_0x1a57('0x77'));db[_0x1a57('0x78')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x1a57('0x79')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x7a'));db[_0x1a57('0x7b')]=db['sequelize']['import']('../api/condition/condition.model');db[_0x1a57('0x7c')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x7d'));db[_0x1a57('0x7e')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x7f'));db['Cdr']=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x1a57('0x1')]['import'](_0x1a57('0x80'));db[_0x1a57('0x81')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x82'));db[_0x1a57('0x83')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/sound/sound.model');db[_0x1a57('0x84')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x85'));db[_0x1a57('0x86')]=db[_0x1a57('0x1')]['import']('../api/template/template.model');db[_0x1a57('0x87')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x88'));db['Variable']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x89'));db[_0x1a57('0x8a')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x8b'));db[_0x1a57('0x8c')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x8d'));db[_0x1a57('0x8e')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x8f'));db[_0x1a57('0x90')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x91'));db[_0x1a57('0x92')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x93'));db['AnalyticMetric']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x94'));db[_0x1a57('0x95')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x96'));db[_0x1a57('0x97')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x98'));db['SalesforceAccount']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x99'));db[_0x1a57('0x9a')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x9b'));db[_0x1a57('0x9c')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x9d'));db[_0x1a57('0x9e')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x9f'));db['SugarcrmConfiguration']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xa0'));db[_0x1a57('0xa1')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xa2'));db[_0x1a57('0xa3')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xa4'));db[_0x1a57('0xa5')]=db[_0x1a57('0x1')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db['sequelize']['import'](_0x1a57('0xa6'));db[_0x1a57('0xa7')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xa8'));db['ZohoConfiguration']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xa9'));db[_0x1a57('0xaa')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xab'));db['ZendeskAccount']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xac'));db[_0x1a57('0xad')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xae'));db['ZendeskField']=db[_0x1a57('0x1')]['import'](_0x1a57('0xaf'));db[_0x1a57('0xb0')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x1a57('0xb1')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x1a57('0xb2')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x1a57('0xb3')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xb4'));db[_0x1a57('0xb5')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xb6'));db[_0x1a57('0xb7')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x1a57('0xb8')]=db['sequelize'][_0x1a57('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db['sequelize']['import'](_0x1a57('0xb9'));db[_0x1a57('0xba')]=db[_0x1a57('0x1')]['import'](_0x1a57('0xbb'));db['Dynamics365Account']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xbc'));db[_0x1a57('0xbd')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x1a57('0x1')]['import'](_0x1a57('0xbe'));db[_0x1a57('0xbf')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xc0'));db['FreshsalesConfiguration']=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x1a57('0x1')]['import'](_0x1a57('0xc1'));db[_0x1a57('0x8a')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0x8b'));db[_0x1a57('0xc2')]=db[_0x1a57('0x1')]['import'](_0x1a57('0xc3'));db[_0x1a57('0xc4')]=db[_0x1a57('0x1')]['import']('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xc5'));db['JscriptyQuestionReport']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xc6'));db[_0x1a57('0xc7')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xc8'));db[_0x1a57('0xc9')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xca'));db[_0x1a57('0xcb')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/squareReport/squareReport.model');db[_0x1a57('0xcc')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xcd'));db[_0x1a57('0xce')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xcf'));db[_0x1a57('0xd0')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xd1'));db[_0x1a57('0xd2')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xd3'));db[_0x1a57('0xd4')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xd5'));db['SquareRecording']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xd6'));db[_0x1a57('0xd7')]=db[_0x1a57('0x1')]['import'](_0x1a57('0xd8'));db[_0x1a57('0xd9')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xda'));db[_0x1a57('0xdb')]=db[_0x1a57('0x1')]['import']('../api/license/license.model');db[_0x1a57('0xdc')]=db[_0x1a57('0x1')]['import'](_0x1a57('0xdd'));db[_0x1a57('0xde')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xdf'));db[_0x1a57('0xe0')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xe1'));db[_0x1a57('0xe2')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/plugin/plugin.model');db[_0x1a57('0xe3')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xe4'));db[_0x1a57('0xe5')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xe6'));db[_0x1a57('0xe7')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xe8'));db[_0x1a57('0xe9')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xea'));db[_0x1a57('0xeb')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xec'));db[_0x1a57('0xed')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xee'));db[_0x1a57('0xef')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xf0'));db[_0x1a57('0xf1')]=db['sequelize']['import'](_0x1a57('0xf2'));db['UserProfileSection']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xf3'));db[_0x1a57('0xf4')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xf5'));db[_0x1a57('0xf6')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xf7'));db[_0x1a57('0xf8')]=db[_0x1a57('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x1a57('0xf9')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0xfa'));db['WhatsappInteraction']=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xfb'));db[_0x1a57('0xfc')]=db[_0x1a57('0x1')][_0x1a57('0x13')](_0x1a57('0xfd'));db['WhatsappQueueReport']=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x1a57('0xfe')]=db[_0x1a57('0x1')][_0x1a57('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x1a57('0xff')]=db['sequelize']['import'](_0x1a57('0x100'));db['CloudProvider']=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x101'));db[_0x1a57('0x102')]=db[_0x1a57('0x1')]['import'](_0x1a57('0x103'));db[_0x1a57('0x104')]=db['sequelize'][_0x1a57('0x13')](_0x1a57('0x105'));db[_0x1a57('0x106')]=db[_0x1a57('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x1a57('0x107')][_0x1a57('0x108')](db[_0x1a57('0x1d')],{'as':_0x1a57('0x1d'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x1a57('0x107')]['hasMany'](db['VoiceRecording'],{'as':_0x1a57('0x109'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')][_0x1a57('0x10b')](db[_0x1a57('0x2b')],{'as':_0x1a57('0x10c'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')][_0x1a57('0x10b')](db[_0x1a57('0x15')],{'as':_0x1a57('0x10d'),'onDelete':_0x1a57('0x10e'),'hooks':!![]});db[_0x1a57('0x107')]['hasMany'](db[_0x1a57('0x10f')],{'as':_0x1a57('0x110'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')][_0x1a57('0x10b')](db[_0x1a57('0x70')],{'as':_0x1a57('0x111'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')][_0x1a57('0x10b')](db['ReportAgentPreview'],{'as':_0x1a57('0x112'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')][_0x1a57('0x10b')](db[_0x1a57('0x5c')],{'as':_0x1a57('0x113'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')]['hasMany'](db[_0x1a57('0x61')],{'as':_0x1a57('0x114'),'foreignKey':'UserId'});db[_0x1a57('0x107')][_0x1a57('0x10b')](db[_0x1a57('0x52')],{'as':'SmsInteractions','foreignKey':_0x1a57('0x10a')});db['User'][_0x1a57('0x10b')](db[_0x1a57('0x115')],{'as':_0x1a57('0x116'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')]['hasMany'](db[_0x1a57('0x3e')],{'as':_0x1a57('0x117'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')][_0x1a57('0x10b')](db[_0x1a57('0x118')],{'as':_0x1a57('0x119'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x107')][_0x1a57('0x10b')](db[_0x1a57('0xf6')],{'as':_0x1a57('0x11a'),'foreignKey':'SenderId'});db['User'][_0x1a57('0x11b')](db['UserProfile'],{'as':_0x1a57('0xf1'),'foreignKey':_0x1a57('0x11c')});db['User'][_0x1a57('0x11d')](db[_0x1a57('0x67')],{'as':'Groups','through':_0x1a57('0x11e')});db['User'][_0x1a57('0x11d')](db[_0x1a57('0x6b')],{'as':_0x1a57('0x11f'),'through':'cm_user_has_contacts'});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0xed')],{'as':_0x1a57('0x120'),'through':'cm_user_has_lists'});db[_0x1a57('0x107')][_0x1a57('0x11d')](db['Team'],{'through':_0x1a57('0x121')});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x3e')],{'as':'MailInteractions','through':_0x1a57('0x122')});db[_0x1a57('0x107')][_0x1a57('0x11d')](db['ChatInteraction'],{'as':_0x1a57('0x114'),'through':_0x1a57('0x123')});db[_0x1a57('0x107')]['belongsToMany'](db['FaxInteraction'],{'as':_0x1a57('0x116'),'through':_0x1a57('0x124')});db[_0x1a57('0x107')]['belongsToMany'](db[_0x1a57('0x52')],{'as':'SmsInteractions','through':_0x1a57('0x125')});db['User']['belongsToMany'](db[_0x1a57('0x5c')],{'as':_0x1a57('0x113'),'through':_0x1a57('0x126')});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x118')],{'as':_0x1a57('0x119'),'through':_0x1a57('0x127')});db['User']['belongsToMany'](db['VoiceQueue'],{'as':_0x1a57('0x128'),'through':'UserVoiceQueue','required':![]});db[_0x1a57('0x107')]['belongsToMany'](db[_0x1a57('0xef')],{'as':_0x1a57('0x129'),'through':_0x1a57('0x106'),'required':![]});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x12a')],{'as':'MailQueues','through':_0x1a57('0x12b'),'required':![]});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x65')],{'as':_0x1a57('0x12c'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x1a57('0x107')]['belongsToMany'](db[_0x1a57('0x4c')],{'as':_0x1a57('0x12d'),'through':_0x1a57('0x30'),'required':![]});db[_0x1a57('0x107')]['belongsToMany'](db[_0x1a57('0x56')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x5e')],{'as':_0x1a57('0x12e'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x1a57('0x11d')](db[_0x1a57('0xff')],{'as':'WhatsappQueues','through':_0x1a57('0x36'),'required':![]});db['User'][_0x1a57('0x11d')](db[_0x1a57('0xed')],{'through':_0x1a57('0x12f')});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x130')],{'as':_0x1a57('0x131'),'through':_0x1a57('0x132')});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x46')],{'as':_0x1a57('0x133'),'through':_0x1a57('0x134')});db[_0x1a57('0x107')][_0x1a57('0x11d')](db['MailAccount'],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x58')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0x4f')],{'as':_0x1a57('0x135'),'through':_0x1a57('0x136')});db['User'][_0x1a57('0x11d')](db[_0x1a57('0xf8')],{'as':_0x1a57('0x137'),'through':_0x1a57('0x138')});db[_0x1a57('0x107')][_0x1a57('0x11d')](db[_0x1a57('0xd4')],{'as':_0x1a57('0x139'),'through':'user_has_square_projects'});db['VoiceChanSpy']['hasMany'](db[_0x1a57('0x15')],{'as':_0x1a57('0x13a'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x13b')});db[_0x1a57('0x14')][_0x1a57('0x10b')](db[_0x1a57('0x15')],{'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x15')]['hasMany'](db[_0x1a57('0x15')],{'as':_0x1a57('0x13c'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x17')]['belongsToMany'](db[_0x1a57('0x83')],{'as':_0x1a57('0x13d'),'through':'moh_has_sounds'});db[_0x1a57('0x19')][_0x1a57('0x10b')](db[_0x1a57('0x2b')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x1a57('0x19')][_0x1a57('0x10b')](db[_0x1a57('0x13e')],{'as':_0x1a57('0x13f'),'foreignKey':_0x1a57('0x140')});db[_0x1a57('0x19')][_0x1a57('0x10b')](db['CmHopperFinal'],{'as':_0x1a57('0x110'),'foreignKey':_0x1a57('0x140')});db[_0x1a57('0x19')][_0x1a57('0x10b')](db[_0x1a57('0x70')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0x1a57('0x19')][_0x1a57('0x10b')](db[_0x1a57('0x112')],{'as':_0x1a57('0x112'),'foreignKey':_0x1a57('0x140')});db['VoiceQueue'][_0x1a57('0x10b')](db[_0x1a57('0x6d')],{'as':_0x1a57('0x141'),'foreignKey':_0x1a57('0x140')});db[_0x1a57('0x19')][_0x1a57('0x10b')](db[_0x1a57('0xc7')],{'as':_0x1a57('0x142'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x1a57('0x11b')](db[_0x1a57('0x27')],{'as':_0x1a57('0x27'),'foreignKey':_0x1a57('0x143')});db[_0x1a57('0x19')]['belongsTo'](db['Trunk'],{'as':_0x1a57('0x144'),'foreignKey':_0x1a57('0x145')});db[_0x1a57('0x19')][_0x1a57('0x11b')](db['Interval'],{'as':'Interval','foreignKey':_0x1a57('0x146')});db[_0x1a57('0x19')][_0x1a57('0x11b')](db[_0x1a57('0x7e')],{'as':_0x1a57('0x147'),'foreignKey':_0x1a57('0x148')});db[_0x1a57('0x19')]['belongsToMany'](db[_0x1a57('0xed')],{'as':'Lists','through':_0x1a57('0x149')});db[_0x1a57('0x19')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x2d')});db['VoiceQueue'][_0x1a57('0x11d')](db['Team'],{'as':_0x1a57('0x14b'),'through':'TeamVoiceQueue'});db[_0x1a57('0x19')][_0x1a57('0x11d')](db['CmList'],{'as':_0x1a57('0x14c'),'through':_0x1a57('0x14d')});db[_0x1a57('0x14e')][_0x1a57('0x11b')](db['User'],{'as':_0x1a57('0x107'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x1b')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':'User','foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x1d')][_0x1a57('0x10b')](db[_0x1a57('0x1f')],{'as':_0x1a57('0x14f'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x150'),'sourceKey':_0x1a57('0x151')});db[_0x1a57('0x1f')]['belongsTo'](db[_0x1a57('0x1d')],{'foreignKey':'mailboxuser','targetKey':_0x1a57('0x151')});db[_0x1a57('0x21')]['hasMany'](db[_0x1a57('0x24')],{'as':_0x1a57('0x152'),'foreignKey':_0x1a57('0x153'),'constraints':![]});db[_0x1a57('0x21')]['hasMany'](db[_0x1a57('0x154')],{'as':_0x1a57('0x155'),'foreignKey':'uniqueid','constraints':![]});db[_0x1a57('0x21')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':_0x1a57('0x107'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x21')][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'as':'Contact','foreignKey':_0x1a57('0x156')});db['MailServerIn'][_0x1a57('0x11b')](db[_0x1a57('0x3b')],{'as':_0x1a57('0x3b'),'foreignKey':_0x1a57('0x157')});db[_0x1a57('0x39')][_0x1a57('0x11b')](db[_0x1a57('0x3b')],{'as':_0x1a57('0x3b'),'foreignKey':'MailAccountId'});db[_0x1a57('0x3b')][_0x1a57('0x108')](db[_0x1a57('0x37')],{'as':_0x1a57('0x158'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x3b')]['hasOne'](db[_0x1a57('0x39')],{'as':_0x1a57('0x159'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x3b')]['hasMany'](db[_0x1a57('0x79')],{'as':_0x1a57('0x15a'),'foreignKey':'MailAccountId','onDelete':_0x1a57('0x10e')});db['MailAccount']['hasMany'](db[_0x1a57('0x78')],{'as':_0x1a57('0x15b'),'foreignKey':'MailAccountId'});db[_0x1a57('0x3b')][_0x1a57('0x10b')](db[_0x1a57('0x3f')],{'as':_0x1a57('0x14f'),'foreignKey':_0x1a57('0x157')});db[_0x1a57('0x3b')][_0x1a57('0x10b')](db[_0x1a57('0x3e')],{'as':_0x1a57('0x15c')});db['MailAccount'][_0x1a57('0x10b')](db[_0x1a57('0x40')],{'as':_0x1a57('0x13c')});db[_0x1a57('0x3b')][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':'ListId'});db[_0x1a57('0x3b')][_0x1a57('0x11b')](db[_0x1a57('0x86')],{'as':'Template','foreignKey':_0x1a57('0x15e')});db[_0x1a57('0x3b')][_0x1a57('0x11b')](db['Pause'],{'as':_0x1a57('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x15f')});db[_0x1a57('0x12a')]['belongsToMany'](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x12b')});db['MailQueue'][_0x1a57('0x11d')](db[_0x1a57('0xd9')],{'through':_0x1a57('0x160'),'as':_0x1a57('0x14b')});db['MailInteraction'][_0x1a57('0x10b')](db[_0x1a57('0x3f')],{'as':_0x1a57('0x14f'),'onDelete':'cascade','foreignKey':_0x1a57('0x161')});db[_0x1a57('0x3e')][_0x1a57('0x11b')](db[_0x1a57('0x3b')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x157')});db[_0x1a57('0x3e')][_0x1a57('0x11b')](db['CmContact'],{'as':_0x1a57('0x163'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x3e')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':'Owner','foreignKey':_0x1a57('0x10a')});db['MailInteraction'][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'through':_0x1a57('0x164'),'as':_0x1a57('0x165')});db[_0x1a57('0x3e')]['belongsToMany'](db['Tag'],{'through':_0x1a57('0x164'),'as':_0x1a57('0x166')});db['MailInteraction'][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x167'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage'][_0x1a57('0x10b')](db['Attachment'],{'as':_0x1a57('0x168'),'onDelete':'cascade'});db[_0x1a57('0x3f')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':'User'});db['MailMessage'][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x163')});db['MailMessage']['belongsTo'](db[_0x1a57('0x3e')],{'as':_0x1a57('0x169'),'foreignKey':'MailInteractionId'});db[_0x1a57('0x3f')][_0x1a57('0x11b')](db[_0x1a57('0x3b')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x157')});db['MailMessage']['belongsTo'](db[_0x1a57('0x130')],{'as':_0x1a57('0x130'),'foreignKey':'ChatWebsiteId'});db[_0x1a57('0x3f')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x1a57('0x16a'),'foreignKey':_0x1a57('0x16b')});db[_0x1a57('0x40')][_0x1a57('0x11b')](db['User'],{'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x40')][_0x1a57('0x11b')](db[_0x1a57('0x12a')],{'onDelete':'restrict'});db[_0x1a57('0x40')][_0x1a57('0x11b')](db[_0x1a57('0x3b')],{'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x40')][_0x1a57('0x11b')](db[_0x1a57('0x7c')],{'onDelete':'restrict','foreignKey':_0x1a57('0x146')});db[_0x1a57('0x40')][_0x1a57('0x11b')](db[_0x1a57('0x84')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x1a57('0x42')][_0x1a57('0x11b')](db[_0x1a57('0x3b')],{});db[_0x1a57('0x42')][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d')});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x1a57('0x156')});db[_0x1a57('0x42')]['belongsTo'](db[_0x1a57('0x3e')],{});db[_0x1a57('0x42')][_0x1a57('0x11b')](db[_0x1a57('0x3f')],{});db[_0x1a57('0x42')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{});db[_0x1a57('0x42')][_0x1a57('0x11b')](db[_0x1a57('0x12a')],{});db[_0x1a57('0x16e')][_0x1a57('0x10b')](db[_0x1a57('0x44')],{'as':_0x1a57('0x16f'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x46')][_0x1a57('0x10b')](db['Disposition'],{'as':_0x1a57('0x15a'),'foreignKey':_0x1a57('0x170'),'onDelete':_0x1a57('0x10e')});db['FaxAccount']['hasMany'](db[_0x1a57('0x78')],{'as':_0x1a57('0x15b'),'foreignKey':_0x1a57('0x170')});db[_0x1a57('0x46')][_0x1a57('0x10b')](db['FaxInteraction'],{'as':_0x1a57('0x15c')});db[_0x1a57('0x46')][_0x1a57('0x10b')](db['FaxApplication'],{'as':'Applications'});db[_0x1a57('0x46')][_0x1a57('0x10b')](db[_0x1a57('0x15')],{'as':_0x1a57('0x171'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x46')][_0x1a57('0x10b')](db[_0x1a57('0x4a')],{'as':_0x1a57('0x14f')});db['FaxAccount']['belongsTo'](db['Trunk'],{'as':_0x1a57('0x27')});db[_0x1a57('0x46')][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d')});db[_0x1a57('0x46')][_0x1a57('0x11b')](db[_0x1a57('0x7e')],{'as':_0x1a57('0x147'),'foreignKey':_0x1a57('0x148')});db[_0x1a57('0x46')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x134')});db[_0x1a57('0x47')]['belongsTo'](db[_0x1a57('0x107')],{'onDelete':_0x1a57('0x16c')});db['FaxApplication'][_0x1a57('0x11b')](db[_0x1a57('0x4c')],{'onDelete':'restrict'});db[_0x1a57('0x47')]['belongsTo'](db[_0x1a57('0x46')],{'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x47')][_0x1a57('0x11b')](db['Tag'],{'onDelete':_0x1a57('0x16c'),'foreignKey':_0x1a57('0x172')});db[_0x1a57('0x115')]['hasMany'](db[_0x1a57('0x4a')],{'as':_0x1a57('0x14f'),'onDelete':'cascade','foreignKey':_0x1a57('0x173')});db[_0x1a57('0x115')][_0x1a57('0x11b')](db['FaxAccount'],{'as':'Account','foreignKey':_0x1a57('0x170')});db['FaxInteraction'][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'as':_0x1a57('0x163'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x115')]['belongsTo'](db[_0x1a57('0x107')],{'as':_0x1a57('0x174'),'foreignKey':_0x1a57('0x10a')});db['FaxInteraction'][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'through':_0x1a57('0x175'),'as':_0x1a57('0x165')});db['FaxInteraction'][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'through':_0x1a57('0x175'),'as':_0x1a57('0x166')});db[_0x1a57('0x115')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':'Users','through':_0x1a57('0x124'),'foreignKey':'FaxInteractionId'});db[_0x1a57('0x4a')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x107')});db[_0x1a57('0x4a')][_0x1a57('0x11b')](db[_0x1a57('0x115')],{'as':'Interaction','foreignKey':_0x1a57('0x173')});db[_0x1a57('0x4a')][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x163')});db[_0x1a57('0x4a')][_0x1a57('0x11b')](db[_0x1a57('0xe0')],{'as':_0x1a57('0xe0'),'foreignKey':_0x1a57('0x176')});db[_0x1a57('0x4a')][_0x1a57('0x11b')](db['FaxAccount'],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x170')});db['FaxQueue'][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':'UserFaxQueue'});db[_0x1a57('0x4c')][_0x1a57('0x11d')](db[_0x1a57('0xd9')],{'through':_0x1a57('0x177'),'as':_0x1a57('0x14b')});db[_0x1a57('0x178')][_0x1a57('0x11b')](db['FaxAccount'],{});db[_0x1a57('0x178')]['belongsTo'](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':'ListId'});db['FaxQueueReport'][_0x1a57('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0x1a57('0x156')});db[_0x1a57('0x178')][_0x1a57('0x11b')](db[_0x1a57('0x115')],{});db['FaxQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0x4a')],{});db[_0x1a57('0x178')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{});db[_0x1a57('0x178')][_0x1a57('0x11b')](db[_0x1a57('0x4c')],{});db[_0x1a57('0x4f')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x1a57('0x179'),'onDelete':_0x1a57('0x10e')});db['SmsAccount'][_0x1a57('0x10b')](db[_0x1a57('0x78')],{'as':_0x1a57('0x15b'),'foreignKey':_0x1a57('0x179')});db[_0x1a57('0x4f')][_0x1a57('0x10b')](db[_0x1a57('0x54')],{'as':'Messages','foreignKey':_0x1a57('0x179')});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0x1a57('0x15c')});db[_0x1a57('0x4f')][_0x1a57('0x10b')](db['SmsApplication'],{'as':_0x1a57('0x13c')});db[_0x1a57('0x4f')][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':'List','foreignKey':_0x1a57('0x16d')});db['SmsAccount']['belongsTo'](db['Pause'],{'as':_0x1a57('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1a57('0x4f')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x1a57('0x50')]['belongsTo'](db[_0x1a57('0x107')],{'onDelete':'restrict'});db[_0x1a57('0x50')][_0x1a57('0x11b')](db['SmsQueue'],{'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x50')][_0x1a57('0x11b')](db[_0x1a57('0x4f')],{'onDelete':'restrict'});db[_0x1a57('0x50')]['belongsTo'](db['Interval'],{'onDelete':_0x1a57('0x16c'),'foreignKey':'IntervalId'});db[_0x1a57('0x50')][_0x1a57('0x11b')](db['Tag'],{'onDelete':_0x1a57('0x16c'),'foreignKey':_0x1a57('0x172')});db[_0x1a57('0x52')][_0x1a57('0x10b')](db[_0x1a57('0x54')],{'as':_0x1a57('0x14f'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x1a57('0x52')][_0x1a57('0x11b')](db[_0x1a57('0x4f')],{'as':'Account','foreignKey':_0x1a57('0x179')});db['SmsInteraction'][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'as':_0x1a57('0x163'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x52')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':_0x1a57('0x174'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x52')]['belongsToMany'](db[_0x1a57('0x84')],{'through':'sms_interaction_has_tags','as':_0x1a57('0x165')});db[_0x1a57('0x52')][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'through':_0x1a57('0x17a'),'as':_0x1a57('0x166')});db[_0x1a57('0x52')][_0x1a57('0x11d')](db['User'],{'as':_0x1a57('0x167'),'through':_0x1a57('0x125'),'foreignKey':_0x1a57('0x17b')});db['SmsMessage'][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':_0x1a57('0x107')});db[_0x1a57('0x54')][_0x1a57('0x11b')](db['CmContact'],{'onDelete':_0x1a57('0x10e'),'as':'Contact'});db[_0x1a57('0x54')][_0x1a57('0x11b')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x1a57('0x169'),'foreignKey':'SmsInteractionId'});db[_0x1a57('0x54')]['belongsTo'](db[_0x1a57('0x4f')],{'as':'Account','foreignKey':'SmsAccountId'});db['SmsQueue'][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x32'),'foreignKey':'SmsQueueId'});db[_0x1a57('0x56')]['belongsToMany'](db[_0x1a57('0xd9')],{'through':_0x1a57('0x17c'),'as':_0x1a57('0x14b')});db[_0x1a57('0x58')][_0x1a57('0x10b')](db[_0x1a57('0x79')],{'as':_0x1a57('0x15a'),'foreignKey':_0x1a57('0x17d'),'onDelete':'cascade'});db[_0x1a57('0x58')]['hasMany'](db[_0x1a57('0x78')],{'as':_0x1a57('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x1a57('0x58')][_0x1a57('0x10b')](db[_0x1a57('0x5c')],{'as':_0x1a57('0x15c'),'foreignKey':_0x1a57('0x17d')});db[_0x1a57('0x58')][_0x1a57('0x10b')](db[_0x1a57('0x17e')],{'as':_0x1a57('0x14f'),'foreignKey':_0x1a57('0x17d')});db[_0x1a57('0x58')][_0x1a57('0x10b')](db[_0x1a57('0x5a')],{'as':'Applications','foreignKey':_0x1a57('0x17d')});db['OpenchannelAccount'][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d')});db[_0x1a57('0x58')][_0x1a57('0x11b')](db[_0x1a57('0x7e')],{'as':_0x1a57('0x147'),'foreignKey':_0x1a57('0x148')});db['OpenchannelAccount'][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':'user_has_openchannel_accounts'});db[_0x1a57('0x5a')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x5a')][_0x1a57('0x11b')](db[_0x1a57('0x5e')],{'onDelete':_0x1a57('0x16c'),'foreignKey':_0x1a57('0x17f')});db['OpenchannelApplication'][_0x1a57('0x11b')](db[_0x1a57('0x58')],{'onDelete':'restrict','foreignKey':_0x1a57('0x17d')});db[_0x1a57('0x5a')][_0x1a57('0x11b')](db['Interval'],{'onDelete':_0x1a57('0x16c'),'foreignKey':'IntervalId'});db[_0x1a57('0x5a')][_0x1a57('0x11b')](db[_0x1a57('0x84')],{'onDelete':_0x1a57('0x16c'),'foreignKey':_0x1a57('0x172')});db[_0x1a57('0x5c')]['hasMany'](db[_0x1a57('0x17e')],{'as':'Messages','onDelete':_0x1a57('0x10e'),'foreignKey':'OpenchannelInteractionId'});db[_0x1a57('0x5c')]['belongsTo'](db[_0x1a57('0x58')],{'as':_0x1a57('0x162'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x1a57('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0x1a57('0x156')});db[_0x1a57('0x5c')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':_0x1a57('0x174'),'foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x5c')][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'through':_0x1a57('0x180'),'as':_0x1a57('0x165')});db[_0x1a57('0x5c')][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'through':'openchannel_interaction_has_tags','as':_0x1a57('0x166')});db[_0x1a57('0x5c')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':'Users','through':_0x1a57('0x126'),'foreignKey':'OpenchannelInteractionId'});db[_0x1a57('0x17e')][_0x1a57('0x11b')](db['User'],{'onDelete':'cascade','as':_0x1a57('0x107')});db[_0x1a57('0x17e')]['belongsTo'](db[_0x1a57('0x6b')],{'onDelete':'cascade','as':_0x1a57('0x163')});db[_0x1a57('0x17e')][_0x1a57('0x11b')](db['OpenchannelInteraction'],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x169'),'foreignKey':_0x1a57('0x181')});db[_0x1a57('0x17e')][_0x1a57('0x11b')](db[_0x1a57('0xe0')],{'as':_0x1a57('0xe0'),'foreignKey':'AttachmentId'});db[_0x1a57('0x17e')]['belongsTo'](db[_0x1a57('0x58')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x17d')});db[_0x1a57('0x5e')][_0x1a57('0x11d')](db['User'],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x34'),'foreignKey':_0x1a57('0x17f')});db[_0x1a57('0x5e')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0x1a57('0x14b')});db[_0x1a57('0x130')][_0x1a57('0x10b')](db[_0x1a57('0x79')],{'as':'Dispositions','foreignKey':_0x1a57('0x182'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x130')][_0x1a57('0x10b')](db['CannedAnswer'],{'as':_0x1a57('0x15b'),'foreignKey':_0x1a57('0x182')});db['ChatWebsite'][_0x1a57('0x10b')](db['ChatProactiveAction'],{'as':_0x1a57('0x183')});db[_0x1a57('0x130')]['hasMany'](db[_0x1a57('0x61')],{'as':_0x1a57('0x15c')});db[_0x1a57('0x130')]['hasMany'](db[_0x1a57('0x184')],{'as':_0x1a57('0x13c')});db[_0x1a57('0x130')]['hasMany'](db['ChatMessage'],{'as':_0x1a57('0x14f')});db[_0x1a57('0x130')][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':'ListId'});db[_0x1a57('0x130')][_0x1a57('0x11b')](db[_0x1a57('0x7c')],{'as':_0x1a57('0x7c'),'foreignKey':_0x1a57('0x146')});db[_0x1a57('0x130')][_0x1a57('0x11b')](db[_0x1a57('0x3b')],{'as':'MailAccount','foreignKey':_0x1a57('0x157')});db[_0x1a57('0x130')][_0x1a57('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x1a57('0x148')});db['ChatWebsite']['belongsToMany'](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport']['belongsTo'](db[_0x1a57('0x58')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d')});db[_0x1a57('0x5f')][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'as':_0x1a57('0x163'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x5f')][_0x1a57('0x11b')](db[_0x1a57('0x5c')],{});db['OpenchannelQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0x17e')],{});db[_0x1a57('0x5f')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{});db['OpenchannelQueueReport'][_0x1a57('0x11b')](db['OpenchannelQueue'],{});db[_0x1a57('0x184')]['belongsTo'](db[_0x1a57('0x107')],{'as':_0x1a57('0x185'),'foreignKey':_0x1a57('0x10a'),'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x184')]['belongsTo'](db[_0x1a57('0x65')],{'as':_0x1a57('0x186'),'foreignKey':_0x1a57('0x187'),'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x184')]['belongsTo'](db[_0x1a57('0x130')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x1a57('0x16c')});db['ChatApplication'][_0x1a57('0x11b')](db[_0x1a57('0x84')],{'onDelete':_0x1a57('0x16c'),'foreignKey':_0x1a57('0x172')});db[_0x1a57('0x61')]['hasMany'](db[_0x1a57('0x63')],{'as':_0x1a57('0x14f'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x188')});db['ChatInteraction'][_0x1a57('0x11b')](db[_0x1a57('0x130')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x182')});db[_0x1a57('0x61')]['belongsTo'](db['CmContact'],{'as':_0x1a57('0x163'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x61')][_0x1a57('0x11b')](db['User'],{'as':_0x1a57('0x174'),'foreignKey':_0x1a57('0x10a')});db['ChatInteraction'][_0x1a57('0x11d')](db['Tag'],{'through':_0x1a57('0x189'),'as':'Tags'});db['ChatInteraction'][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'through':'chat_interaction_has_tags','as':_0x1a57('0x166')});db[_0x1a57('0x61')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x167'),'through':'user_has_chat_interactions','foreignKey':_0x1a57('0x188')});db['ChatMessage'][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x107')});db['ChatMessage'][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x163'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x63')][_0x1a57('0x11b')](db['ChatInteraction'],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x169'),'foreignKey':_0x1a57('0x188')});db[_0x1a57('0x63')]['belongsTo'](db['Attachment'],{'as':_0x1a57('0xe0'),'foreignKey':_0x1a57('0x176')});db['ChatMessage'][_0x1a57('0x11b')](db[_0x1a57('0x130')],{'as':_0x1a57('0x162'),'foreignKey':'ChatWebsiteId'});db[_0x1a57('0x16a')][_0x1a57('0x10b')](db[_0x1a57('0xe0')],{'as':_0x1a57('0x168'),'foreignKey':_0x1a57('0x16b'),'onDelete':_0x1a57('0x10e'),'hooks':!![]});db['ChatOfflineMessage'][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x163'),'foreignKey':_0x1a57('0x156')});db['ChatOfflineMessage'][_0x1a57('0x11b')](db['ChatWebsite'],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x182')});db[_0x1a57('0x65')]['belongsToMany'](db['User'],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x18a'),'hooks':!![]});db[_0x1a57('0x65')][_0x1a57('0x11d')](db['Team'],{'through':_0x1a57('0x18b'),'as':_0x1a57('0x14b')});db[_0x1a57('0x67')][_0x1a57('0x10b')](db[_0x1a57('0x18c')],{'as':_0x1a57('0x14f'),'foreignKey':_0x1a57('0x18d'),'onDelete':_0x1a57('0x10e')});db['ChatGroup'][_0x1a57('0x11d')](db['User'],{'as':'Members','through':_0x1a57('0x11e')});db['ChatProactiveAction'][_0x1a57('0x11b')](db[_0x1a57('0x130')],{'as':_0x1a57('0x18e'),'foreignKey':_0x1a57('0x182')});db[_0x1a57('0x69')][_0x1a57('0x10b')](db[_0x1a57('0x6b')],{'as':_0x1a57('0x11f'),'foreignKey':'CompanyId'});db[_0x1a57('0x6b')][_0x1a57('0x10b')](db[_0x1a57('0x13e')],{'as':_0x1a57('0x13f'),'foreignKey':_0x1a57('0x156')});db['CmContact']['hasMany'](db[_0x1a57('0x10f')],{'as':_0x1a57('0x110'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x6b')]['hasMany'](db['CmHopperHistory'],{'as':_0x1a57('0x18f'),'foreignKey':_0x1a57('0x156')});db['CmContact'][_0x1a57('0x10b')](db['ReportAgentPreview'],{'as':_0x1a57('0x112'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x6b')][_0x1a57('0x10b')](db['JscriptySessionReport'],{'as':_0x1a57('0x142'),'foreignKey':'ContactId'});db[_0x1a57('0x6b')][_0x1a57('0x10b')](db[_0x1a57('0x5c')],{'as':_0x1a57('0x113'),'foreignKey':_0x1a57('0x156'),'onDelete':'restrict'});db['CmContact'][_0x1a57('0x10b')](db['ChatInteraction'],{'as':_0x1a57('0x114'),'foreignKey':'ContactId','onDelete':_0x1a57('0x16c')});db['CmContact'][_0x1a57('0x10b')](db[_0x1a57('0x52')],{'as':'SmsInteractions','foreignKey':_0x1a57('0x156'),'onDelete':'restrict'});db[_0x1a57('0x6b')][_0x1a57('0x10b')](db[_0x1a57('0x115')],{'as':'FaxInteractions','foreignKey':_0x1a57('0x156'),'onDelete':_0x1a57('0x16c')});db['CmContact']['hasMany'](db[_0x1a57('0x3e')],{'as':'MailInteractions','foreignKey':_0x1a57('0x156'),'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x6b')][_0x1a57('0x11b')](db[_0x1a57('0x69')],{'as':_0x1a57('0x190'),'foreignKey':'CompanyId'});db['CmContact'][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x6b')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x167'),'through':_0x1a57('0x191')});db['CmContact'][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'as':_0x1a57('0x165'),'through':_0x1a57('0x192')});db[_0x1a57('0x6b')]['belongsToMany'](db[_0x1a57('0x84')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x1a57('0x13e')][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'as':_0x1a57('0x163'),'foreignKey':'ContactId','onDelete':_0x1a57('0x10e')});db['CmHopper'][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x13e')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':_0x1a57('0x185'),'foreignKey':_0x1a57('0x10a')});db['CmHopper'][_0x1a57('0x11b')](db[_0x1a57('0x19')],{'as':_0x1a57('0x186'),'foreignKey':_0x1a57('0x140'),'onDelete':'cascade'});db[_0x1a57('0x13e')][_0x1a57('0x11b')](db[_0x1a57('0xdc')],{'as':'Campaign','foreignKey':_0x1a57('0x193'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x13e')][_0x1a57('0x11b')](db['User'],{'as':_0x1a57('0x174'),'foreignKey':_0x1a57('0x194')});db[_0x1a57('0x6d')]['belongsTo'](db[_0x1a57('0x6b')],{'as':_0x1a57('0x163'),'foreignKey':'ContactId','onDelete':_0x1a57('0x10e')});db[_0x1a57('0x6d')][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d'),'onDelete':'cascade'});db['CmHopperBlack'][_0x1a57('0x11b')](db['VoiceQueue'],{'as':_0x1a57('0x186'),'foreignKey':_0x1a57('0x140'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x6d')][_0x1a57('0x11b')](db['Campaign'],{'as':_0x1a57('0xdc'),'foreignKey':_0x1a57('0x193'),'onDelete':_0x1a57('0x10e')});db['Automation'][_0x1a57('0x10b')](db[_0x1a57('0x7b')],{'as':{'plural':_0x1a57('0x195'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x1a57('0x10e'),'hooks':!![]});db[_0x1a57('0x76')][_0x1a57('0x10b')](db['Condition'],{'as':{'plural':_0x1a57('0x196'),'singular':_0x1a57('0x197')},'foreignKey':_0x1a57('0x198'),'onDelete':'cascade','hooks':!![]});db[_0x1a57('0x76')][_0x1a57('0x10b')](db['Action'],{'as':_0x1a57('0x199'),'foreignKey':'AutomationId','onDelete':_0x1a57('0x10e'),'hooks':!![]});db[_0x1a57('0x79')][_0x1a57('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x1a57('0x19a'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x7c')][_0x1a57('0x10b')](db[_0x1a57('0x7c')],{'as':_0x1a57('0x19b'),'foreignKey':_0x1a57('0x146'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x1a57('0x15')],{'as':_0x1a57('0x10d'),'foreignKey':_0x1a57('0x146'),'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x7c')]['hasMany'](db['MailApplication'],{'as':_0x1a57('0x19c'),'foreignKey':_0x1a57('0x146')});db[_0x1a57('0x7c')][_0x1a57('0x10b')](db[_0x1a57('0x184')],{'as':'ChatApplications','foreignKey':_0x1a57('0x146')});db[_0x1a57('0x7c')][_0x1a57('0x10b')](db[_0x1a57('0x47')],{'as':_0x1a57('0x19d'),'foreignKey':'IntervalId'});db[_0x1a57('0x7c')]['hasMany'](db[_0x1a57('0x50')],{'as':_0x1a57('0x19e'),'foreignKey':_0x1a57('0x146')});db[_0x1a57('0x81')][_0x1a57('0x11b')](db[_0x1a57('0x3b')],{});db['Schedule'][_0x1a57('0x11b')](db[_0x1a57('0x90')],{'foreignKey':_0x1a57('0x19f')});db[_0x1a57('0x81')][_0x1a57('0x11b')](db[_0x1a57('0x8e')],{'foreignKey':_0x1a57('0x1a0')});db[_0x1a57('0x83')][_0x1a57('0x11d')](db[_0x1a57('0x17')],{'as':'Mohs','through':_0x1a57('0x1a1'),'onDelete':_0x1a57('0x16c')});db[_0x1a57('0x84')]['belongsToMany'](db[_0x1a57('0x6b')],{'through':_0x1a57('0x192')});db[_0x1a57('0x84')][_0x1a57('0x11d')](db[_0x1a57('0x61')],{'through':'chat_interaction_has_tags'});db[_0x1a57('0x84')]['belongsToMany'](db[_0x1a57('0x3e')],{'through':_0x1a57('0x164')});db[_0x1a57('0x84')][_0x1a57('0x11d')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x1a57('0x84')][_0x1a57('0x11d')](db[_0x1a57('0x115')],{'through':_0x1a57('0x175')});db[_0x1a57('0x84')][_0x1a57('0x11d')](db[_0x1a57('0x5c')],{'through':_0x1a57('0x180')});db[_0x1a57('0x84')][_0x1a57('0x11d')](db[_0x1a57('0x118')],{'through':_0x1a57('0x1a2')});db[_0x1a57('0x87')][_0x1a57('0x10b')](db['Condition'],{'as':{'plural':_0x1a57('0x1a3'),'singular':_0x1a57('0x1a4')},'foreignKey':_0x1a57('0x1a5'),'onDelete':_0x1a57('0x10e'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x1a57('0x7b')],{'as':{'plural':_0x1a57('0x1a6'),'singular':_0x1a57('0x1a7')},'foreignKey':_0x1a57('0x1a8'),'onDelete':_0x1a57('0x10e'),'hooks':!![]});db[_0x1a57('0x87')][_0x1a57('0x10b')](db[_0x1a57('0x74')],{'as':'Actions','foreignKey':_0x1a57('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0x1a57('0x8e')][_0x1a57('0x10b')](db[_0x1a57('0x95')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x1a57('0x90')][_0x1a57('0x10b')](db[_0x1a57('0x95')],{'as':_0x1a57('0x1aa'),'onDelete':_0x1a57('0x10e'),'foreignKey':'DefaultReportId'});db[_0x1a57('0x1ab')]['hasMany'](db[_0x1a57('0x95')],{'as':_0x1a57('0x1aa'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1ac')});db[_0x1a57('0x95')]['belongsTo'](db[_0x1a57('0x1ab')],{'foreignKey':_0x1a57('0x1ac')});db['SalesforceAccount'][_0x1a57('0x10b')](db['SalesforceConfiguration'],{'as':_0x1a57('0x1ad'),'onDelete':'cascade','foreignKey':_0x1a57('0x1ae')});db['SalesforceConfiguration'][_0x1a57('0x10b')](db[_0x1a57('0x9c')],{'as':_0x1a57('0x1af'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0x9a')][_0x1a57('0x10b')](db[_0x1a57('0x9c')],{'as':_0x1a57('0x1b1'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b2')});db['SalesforceConfiguration'][_0x1a57('0x10b')](db[_0x1a57('0x9c')],{'as':_0x1a57('0x1aa'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0x9a')][_0x1a57('0x11b')](db[_0x1a57('0x1b4')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0x9c')][_0x1a57('0x10b')](db['SalesforceField'],{'as':_0x1a57('0x1b5'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0x9c')][_0x1a57('0x10b')](db[_0x1a57('0x9c')],{'as':_0x1a57('0x1b6'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0x9c')][_0x1a57('0x10b')](db[_0x1a57('0x9c')],{'as':_0x1a57('0x1b7'),'foreignKey':'FieldId'});db[_0x1a57('0x9c')][_0x1a57('0x11b')](db[_0x1a57('0x1b8')],{'as':_0x1a57('0x1b8'),'foreignKey':_0x1a57('0x1b9')});db[_0x1a57('0x9e')][_0x1a57('0x10b')](db[_0x1a57('0x1ba')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0x1ba')][_0x1a57('0x10b')](db[_0x1a57('0xa1')],{'as':'Subjects','onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0x1ba')]['hasMany'](db[_0x1a57('0xa1')],{'as':_0x1a57('0x1b1'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0x1ba')]['hasMany'](db[_0x1a57('0xa1')],{'as':_0x1a57('0x1aa'),'onDelete':_0x1a57('0x10e'),'foreignKey':'FieldId'});db[_0x1a57('0x1ba')]['belongsTo'](db[_0x1a57('0x9e')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1ae')});db['SugarcrmField'][_0x1a57('0x10b')](db[_0x1a57('0xa1')],{'as':_0x1a57('0x1b5'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0x1a57('0x10b')](db[_0x1a57('0xa1')],{'as':_0x1a57('0x1b6'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0xa1')][_0x1a57('0x10b')](db[_0x1a57('0xa1')],{'as':_0x1a57('0x1b7'),'foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0xa1')]['belongsTo'](db[_0x1a57('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1a57('0xa3')][_0x1a57('0x10b')](db[_0x1a57('0xa5')],{'as':'Configurations','onDelete':_0x1a57('0x10e'),'foreignKey':'AccountId'});db[_0x1a57('0xa5')][_0x1a57('0x10b')](db[_0x1a57('0x1bb')],{'as':'Subjects','onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0xa5')][_0x1a57('0x10b')](db['DeskField'],{'as':_0x1a57('0x1b1'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0xa5')][_0x1a57('0x10b')](db['DeskField'],{'as':_0x1a57('0x1aa'),'onDelete':_0x1a57('0x10e'),'foreignKey':'FieldId'});db[_0x1a57('0xa5')]['belongsTo'](db[_0x1a57('0xa3')],{'as':'Account','foreignKey':'AccountId'});db[_0x1a57('0xa5')]['belongsToMany'](db[_0x1a57('0x84')],{'through':_0x1a57('0x1bc')});db[_0x1a57('0x1bb')][_0x1a57('0x10b')](db[_0x1a57('0x1bb')],{'as':_0x1a57('0x1b5'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0x1bb')][_0x1a57('0x10b')](db['DeskField'],{'as':_0x1a57('0x1b6'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0x1bb')][_0x1a57('0x10b')](db[_0x1a57('0x1bb')],{'as':_0x1a57('0x1b7'),'foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0x1bb')]['belongsTo'](db[_0x1a57('0x1b8')],{'as':_0x1a57('0x1b8'),'foreignKey':_0x1a57('0x1b9')});db[_0x1a57('0xa7')][_0x1a57('0x10b')](db[_0x1a57('0x1bd')],{'as':_0x1a57('0x1ad'),'onDelete':_0x1a57('0x10e'),'foreignKey':'AccountId'});db[_0x1a57('0x1bd')][_0x1a57('0x10b')](db['ZohoField'],{'as':'Subjects','onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0x1bd')]['hasMany'](db['ZohoField'],{'as':_0x1a57('0x1b1'),'onDelete':_0x1a57('0x10e'),'foreignKey':'DescriptionId'});db[_0x1a57('0x1bd')][_0x1a57('0x10b')](db['ZohoField'],{'as':'Fields','onDelete':_0x1a57('0x10e'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0x1a57('0x11b')](db[_0x1a57('0xa7')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0xaa')]['hasMany'](db[_0x1a57('0xaa')],{'as':_0x1a57('0x1b5'),'foreignKey':_0x1a57('0x1b0')});db['ZohoField'][_0x1a57('0x10b')](db['ZohoField'],{'as':'Description','foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0xaa')][_0x1a57('0x10b')](db[_0x1a57('0xaa')],{'as':'Field','foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0xaa')]['belongsTo'](db['Variable'],{'as':_0x1a57('0x1b8'),'foreignKey':'VariableId'});db[_0x1a57('0x1be')][_0x1a57('0x10b')](db[_0x1a57('0xad')],{'as':'Configurations','onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0xad')]['hasMany'](db[_0x1a57('0x1bf')],{'as':_0x1a57('0x1af'),'foreignKey':'SubjectId'});db[_0x1a57('0xad')]['hasMany'](db[_0x1a57('0x1bf')],{'as':_0x1a57('0x1b1'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0xad')][_0x1a57('0x10b')](db[_0x1a57('0x1bf')],{'as':_0x1a57('0x1aa'),'foreignKey':'FieldId'});db[_0x1a57('0xad')]['belongsTo'](db[_0x1a57('0x1be')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0xad')][_0x1a57('0x11d')](db['Tag'],{'through':_0x1a57('0x1c0')});db[_0x1a57('0x1bf')]['hasMany'](db['ZendeskField'],{'as':_0x1a57('0x1b5'),'foreignKey':'SubjectId'});db[_0x1a57('0x1bf')]['hasMany'](db[_0x1a57('0x1bf')],{'as':_0x1a57('0x1b6'),'foreignKey':'DescriptionId'});db[_0x1a57('0x1bf')][_0x1a57('0x10b')](db[_0x1a57('0x1bf')],{'as':_0x1a57('0x1b7'),'foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0x1bf')][_0x1a57('0x11b')](db[_0x1a57('0x1b8')],{'as':'Variable','foreignKey':_0x1a57('0x1b9')});db[_0x1a57('0xb0')][_0x1a57('0x10b')](db['FreshdeskConfiguration'],{'as':_0x1a57('0x1ad'),'onDelete':_0x1a57('0x10e'),'foreignKey':'AccountId'});db[_0x1a57('0xb1')][_0x1a57('0x10b')](db[_0x1a57('0xb2')],{'as':_0x1a57('0x1af'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0xb1')][_0x1a57('0x10b')](db[_0x1a57('0xb2')],{'as':_0x1a57('0x1b1'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x1a57('0xb1')]['hasMany'](db[_0x1a57('0xb2')],{'as':_0x1a57('0x1aa'),'onDelete':_0x1a57('0x10e'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x1a57('0x11b')](db[_0x1a57('0xb0')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0xb1')]['belongsToMany'](db[_0x1a57('0x84')],{'through':_0x1a57('0x1c1')});db['FreshdeskField'][_0x1a57('0x10b')](db[_0x1a57('0xb2')],{'as':_0x1a57('0x1b5'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0xb2')][_0x1a57('0x10b')](db[_0x1a57('0xb2')],{'as':_0x1a57('0x1b6'),'foreignKey':_0x1a57('0x1b2')});db['FreshdeskField'][_0x1a57('0x10b')](db[_0x1a57('0xb2')],{'as':_0x1a57('0x1b7'),'foreignKey':'FieldId'});db[_0x1a57('0xb2')][_0x1a57('0x11b')](db[_0x1a57('0x1b8')],{'as':_0x1a57('0x1b8'),'foreignKey':'VariableId'});db[_0x1a57('0xb3')][_0x1a57('0x10b')](db[_0x1a57('0xb5')],{'as':_0x1a57('0x1ad'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0xb5')][_0x1a57('0x10b')](db[_0x1a57('0xb7')],{'as':_0x1a57('0x1af'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0xb5')][_0x1a57('0x10b')](db[_0x1a57('0xb7')],{'as':_0x1a57('0x1b1'),'foreignKey':_0x1a57('0x1b2')});db['VtigerConfiguration'][_0x1a57('0x10b')](db[_0x1a57('0xb7')],{'as':'Fields','foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0xb5')]['belongsTo'](db[_0x1a57('0xb3')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0xb7')]['hasMany'](db[_0x1a57('0xb7')],{'as':_0x1a57('0x1b5'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0xb7')][_0x1a57('0x10b')](db[_0x1a57('0xb7')],{'as':_0x1a57('0x1b6'),'foreignKey':_0x1a57('0x1b2')});db['VtigerField']['hasMany'](db[_0x1a57('0xb7')],{'as':'Field','foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0xb7')][_0x1a57('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0x1a57('0x1b9')});db[_0x1a57('0xb8')][_0x1a57('0x10b')](db[_0x1a57('0x1c2')],{'as':_0x1a57('0x1ad'),'onDelete':'cascade','foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0x1c2')][_0x1a57('0x10b')](db['ServicenowField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x1a57('0x1c2')][_0x1a57('0x10b')](db['ServicenowField'],{'as':_0x1a57('0x1b1'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0x1c2')]['hasMany'](db[_0x1a57('0xba')],{'as':_0x1a57('0x1aa'),'foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0x1c2')][_0x1a57('0x11b')](db[_0x1a57('0xb8')],{'as':_0x1a57('0x162'),'foreignKey':'AccountId'});db[_0x1a57('0xba')][_0x1a57('0x10b')](db[_0x1a57('0xba')],{'as':_0x1a57('0x1b5'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0xba')][_0x1a57('0x10b')](db[_0x1a57('0xba')],{'as':_0x1a57('0x1b6'),'foreignKey':'DescriptionId'});db[_0x1a57('0xba')][_0x1a57('0x10b')](db[_0x1a57('0xba')],{'as':_0x1a57('0x1b7'),'foreignKey':'FieldId'});db['ServicenowField'][_0x1a57('0x11b')](db[_0x1a57('0x1b8')],{'as':_0x1a57('0x1b8'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0x1a57('0x10b')](db[_0x1a57('0xbd')],{'as':_0x1a57('0x1ad'),'onDelete':_0x1a57('0x10e'),'foreignKey':'AccountId'});db[_0x1a57('0xbd')][_0x1a57('0x10b')](db[_0x1a57('0x1c3')],{'as':_0x1a57('0x1af'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b0')});db[_0x1a57('0xbd')]['hasMany'](db['Dynamics365Field'],{'as':_0x1a57('0x1b1'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0xbd')][_0x1a57('0x10b')](db[_0x1a57('0x1c3')],{'as':_0x1a57('0x1aa'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0xbd')][_0x1a57('0x11b')](db[_0x1a57('0x1c4')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1ae')});db[_0x1a57('0x1c3')][_0x1a57('0x10b')](db[_0x1a57('0x1c3')],{'as':_0x1a57('0x1b5'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0x1a57('0x10b')](db[_0x1a57('0x1c3')],{'as':_0x1a57('0x1b6'),'foreignKey':'DescriptionId'});db[_0x1a57('0x1c3')][_0x1a57('0x10b')](db[_0x1a57('0x1c3')],{'as':'Field','foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0x1c3')][_0x1a57('0x11b')](db[_0x1a57('0x1b8')],{'as':_0x1a57('0x1b8'),'foreignKey':_0x1a57('0x1b9')});db[_0x1a57('0xbf')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x1a57('0x1ad'),'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1ae')});db['FreshsalesConfiguration'][_0x1a57('0x10b')](db['FreshsalesField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x1a57('0x1c5')]['hasMany'](db[_0x1a57('0x1c6')],{'as':_0x1a57('0x1b1'),'foreignKey':_0x1a57('0x1b2')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x1a57('0x1aa'),'foreignKey':_0x1a57('0x1b3')});db['FreshsalesConfiguration'][_0x1a57('0x11b')](db[_0x1a57('0xbf')],{'as':_0x1a57('0x162'),'foreignKey':'AccountId'});db[_0x1a57('0x1c6')]['hasMany'](db[_0x1a57('0x1c6')],{'as':_0x1a57('0x1b5'),'foreignKey':'SubjectId'});db[_0x1a57('0x1c6')]['hasMany'](db[_0x1a57('0x1c6')],{'as':_0x1a57('0x1b6'),'foreignKey':_0x1a57('0x1b2')});db[_0x1a57('0x1c6')][_0x1a57('0x10b')](db[_0x1a57('0x1c6')],{'as':_0x1a57('0x1b7'),'foreignKey':_0x1a57('0x1b3')});db[_0x1a57('0x1c6')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x1a57('0xc4')]['belongsTo'](db[_0x1a57('0x130')],{});db[_0x1a57('0xc4')]['belongsTo'](db['CmList'],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d')});db[_0x1a57('0xc4')][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'as':'Contact','foreignKey':_0x1a57('0x156')});db[_0x1a57('0xc4')][_0x1a57('0x11b')](db[_0x1a57('0x61')],{});db['ChatQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0x63')],{});db['ChatQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0x107')],{});db[_0x1a57('0xc4')][_0x1a57('0x11b')](db[_0x1a57('0x65')],{});db[_0x1a57('0x18c')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x1a57('0x18c')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x1c7')});db['JscriptySessionReport'][_0x1a57('0x10b')](db[_0x1a57('0x1c8')],{'foreignKey':_0x1a57('0x1c9'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0xc7')][_0x1a57('0x10b')](db[_0x1a57('0x1ca')],{'foreignKey':_0x1a57('0x1c9'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0xc9')][_0x1a57('0x11b')](db[_0x1a57('0x4f')],{});db['SmsQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':'List','foreignKey':_0x1a57('0x16d')});db[_0x1a57('0xc9')][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'as':_0x1a57('0x163'),'foreignKey':'ContactId'});db[_0x1a57('0xc9')][_0x1a57('0x11b')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0x54')],{});db['SmsQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0x107')],{});db['SmsQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0x56')],{});db[_0x1a57('0xce')][_0x1a57('0x10b')](db[_0x1a57('0xc7')],{'foreignKey':_0x1a57('0x1cb')});db[_0x1a57('0xce')]['hasMany'](db[_0x1a57('0x1c8')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x1a57('0x10b')](db[_0x1a57('0x1ca')],{'foreignKey':_0x1a57('0x1cb')});db[_0x1a57('0xd4')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x167'),'through':_0x1a57('0x1cc')});db[_0x1a57('0xd9')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':'user_has_teams'});db['Team'][_0x1a57('0x11d')](db[_0x1a57('0x19')],{'through':'TeamVoiceQueue','as':_0x1a57('0x128')});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0x1a57('0x160'),'as':_0x1a57('0x1cd')});db[_0x1a57('0xd9')][_0x1a57('0x11d')](db[_0x1a57('0x65')],{'through':_0x1a57('0x18b'),'as':_0x1a57('0x12c')});db[_0x1a57('0xd9')][_0x1a57('0x11d')](db[_0x1a57('0x4c')],{'through':'team_has_fax_queues','as':_0x1a57('0x12d')});db[_0x1a57('0xd9')][_0x1a57('0x11d')](db[_0x1a57('0x56')],{'through':_0x1a57('0x17c'),'as':_0x1a57('0x1ce')});db[_0x1a57('0xd9')][_0x1a57('0x11d')](db[_0x1a57('0x5e')],{'through':'team_has_openchannel_queues','as':_0x1a57('0x12e')});db[_0x1a57('0xd9')][_0x1a57('0x11d')](db[_0x1a57('0xff')],{'through':'team_has_whatsapp_queues','as':_0x1a57('0x1cf')});db[_0x1a57('0xd9')][_0x1a57('0x11d')](db[_0x1a57('0xef')],{'through':_0x1a57('0x104'),'as':_0x1a57('0x129')});db[_0x1a57('0xdc')]['hasMany'](db[_0x1a57('0x13e')],{'as':_0x1a57('0x13f'),'foreignKey':'CampaignId'});db['Campaign']['hasMany'](db['CmHopperFinal'],{'as':_0x1a57('0x110'),'foreignKey':_0x1a57('0x193')});db[_0x1a57('0xdc')][_0x1a57('0x10b')](db[_0x1a57('0x70')],{'as':_0x1a57('0x18f'),'foreignKey':_0x1a57('0x193')});db[_0x1a57('0xdc')][_0x1a57('0x10b')](db[_0x1a57('0x6d')],{'as':'HopperBlacks','foreignKey':_0x1a57('0x193')});db[_0x1a57('0xdc')][_0x1a57('0x11b')](db[_0x1a57('0x27')],{'as':_0x1a57('0x27'),'foreignKey':'TrunkId'});db[_0x1a57('0xdc')][_0x1a57('0x11b')](db[_0x1a57('0x27')],{'as':_0x1a57('0x144'),'foreignKey':_0x1a57('0x145')});db[_0x1a57('0xdc')][_0x1a57('0x11b')](db[_0x1a57('0x7c')],{'as':'Interval','foreignKey':'IntervalId'});db['Campaign']['belongsTo'](db[_0x1a57('0xd4')],{'as':_0x1a57('0xd4'),'foreignKey':'SquareProjectId'});db[_0x1a57('0xdc')][_0x1a57('0x11d')](db['CmList'],{'as':_0x1a57('0x120'),'through':_0x1a57('0x1d0')});db[_0x1a57('0xdc')][_0x1a57('0x11d')](db[_0x1a57('0xed')],{'as':'BlackLists','through':_0x1a57('0x1d1')});db[_0x1a57('0xe0')][_0x1a57('0x11b')](db['ChatOfflineMessage'],{'as':_0x1a57('0x16a'),'foreignKey':_0x1a57('0x16b')});db[_0x1a57('0xe3')][_0x1a57('0x11b')](db[_0x1a57('0x3f')],{});db['MailTransferReport'][_0x1a57('0x11b')](db[_0x1a57('0x3e')],{});db[_0x1a57('0xe3')][_0x1a57('0x11b')](db['MailAccount'],{'foreignKey':_0x1a57('0x1d2'),'as':_0x1a57('0x1d3')});db['MailTransferReport'][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':_0x1a57('0x1d4'),'as':_0x1a57('0x1d5')});db[_0x1a57('0xe3')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':_0x1a57('0x1d6'),'as':_0x1a57('0x1d7')});db[_0x1a57('0xe3')]['belongsTo'](db[_0x1a57('0x12a')],{'foreignKey':_0x1a57('0x1d8'),'as':'ToQueue'});db['MailTransferReport'][_0x1a57('0x11b')](db['MailAccount'],{'foreignKey':_0x1a57('0x1d9'),'as':_0x1a57('0x1da')});db[_0x1a57('0xe5')][_0x1a57('0x11b')](db['ChatMessage'],{});db[_0x1a57('0xe5')][_0x1a57('0x11b')](db['ChatInteraction'],{});db[_0x1a57('0xe5')]['belongsTo'](db[_0x1a57('0x130')],{'foreignKey':_0x1a57('0x1db'),'as':_0x1a57('0x1d3')});db[_0x1a57('0xe5')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x1a57('0x1d5')});db[_0x1a57('0xe5')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':_0x1a57('0x1d6'),'as':_0x1a57('0x1d7')});db[_0x1a57('0xe5')]['belongsTo'](db[_0x1a57('0x65')],{'foreignKey':_0x1a57('0x1dc'),'as':_0x1a57('0x1dd')});db[_0x1a57('0xe5')][_0x1a57('0x11b')](db[_0x1a57('0x130')],{'foreignKey':'ToChatWebsiteId','as':_0x1a57('0x1da')});db[_0x1a57('0xe7')]['belongsTo'](db[_0x1a57('0x4a')],{});db[_0x1a57('0xe7')]['belongsTo'](db[_0x1a57('0x115')],{});db[_0x1a57('0xe7')][_0x1a57('0x11b')](db[_0x1a57('0x46')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x1a57('0xe7')][_0x1a57('0x11b')](db['User'],{'foreignKey':_0x1a57('0x1d4'),'as':_0x1a57('0x1d5')});db[_0x1a57('0xe7')]['belongsTo'](db['User'],{'foreignKey':_0x1a57('0x1d6'),'as':_0x1a57('0x1d7')});db[_0x1a57('0xe7')][_0x1a57('0x11b')](db[_0x1a57('0x4c')],{'foreignKey':_0x1a57('0x1de'),'as':_0x1a57('0x1dd')});db['FaxTransferReport']['belongsTo'](db[_0x1a57('0x46')],{'foreignKey':_0x1a57('0x1df'),'as':_0x1a57('0x1da')});db[_0x1a57('0xe9')]['belongsTo'](db[_0x1a57('0x17e')],{});db[_0x1a57('0xe9')][_0x1a57('0x11b')](db['OpenchannelInteraction'],{});db[_0x1a57('0xe9')][_0x1a57('0x11b')](db[_0x1a57('0x58')],{'foreignKey':_0x1a57('0x1e0'),'as':'FromAccount'});db[_0x1a57('0xe9')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':'FromUserId','as':_0x1a57('0x1d5')});db[_0x1a57('0xe9')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x1a57('0xe9')]['belongsTo'](db[_0x1a57('0x5e')],{'foreignKey':_0x1a57('0x1e1'),'as':_0x1a57('0x1dd')});db[_0x1a57('0xe9')][_0x1a57('0x11b')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x1a57('0x1da')});db['SmsTransferReport'][_0x1a57('0x11b')](db['SmsMessage'],{});db[_0x1a57('0xeb')]['belongsTo'](db[_0x1a57('0x52')],{});db['SmsTransferReport'][_0x1a57('0x11b')](db[_0x1a57('0x4f')],{'foreignKey':_0x1a57('0x1e2'),'as':_0x1a57('0x1d3')});db[_0x1a57('0xeb')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':_0x1a57('0x1d4'),'as':_0x1a57('0x1d5')});db[_0x1a57('0xeb')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':_0x1a57('0x1d6'),'as':_0x1a57('0x1d7')});db[_0x1a57('0xeb')][_0x1a57('0x11b')](db[_0x1a57('0x56')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0x1a57('0xeb')]['belongsTo'](db[_0x1a57('0x4f')],{'foreignKey':'ToSmsAccountId','as':_0x1a57('0x1da')});db[_0x1a57('0xed')]['hasMany'](db[_0x1a57('0x79')],{'as':_0x1a57('0x15a'),'foreignKey':_0x1a57('0x16d'),'onDelete':'cascade'});db[_0x1a57('0xed')][_0x1a57('0x10b')](db[_0x1a57('0x1e3')],{'as':_0x1a57('0x1e4'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0x1a57('0x10e'),'foreignKey':_0x1a57('0x16d')});db['CmList'][_0x1a57('0x10b')](db[_0x1a57('0x10f')],{'as':_0x1a57('0x110'),'foreignKey':_0x1a57('0x16d')});db[_0x1a57('0xed')][_0x1a57('0x10b')](db[_0x1a57('0x70')],{'as':_0x1a57('0x111'),'foreignKey':_0x1a57('0x16d')});db['CmList'][_0x1a57('0x10b')](db[_0x1a57('0x112')],{'as':_0x1a57('0x112'),'foreignKey':_0x1a57('0x16d')});db[_0x1a57('0xed')][_0x1a57('0x11d')](db[_0x1a57('0x19')],{'as':_0x1a57('0x1e5'),'through':_0x1a57('0x149')});db[_0x1a57('0xed')]['belongsToMany'](db['User'],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x12f')});db[_0x1a57('0xef')]['hasMany'](db[_0x1a57('0x15')],{'as':_0x1a57('0x10d'),'onDelete':'cascade'});db[_0x1a57('0xef')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':'UserVoicePrefix'});db[_0x1a57('0xef')][_0x1a57('0x11d')](db[_0x1a57('0xd9')],{'through':_0x1a57('0x104'),'as':_0x1a57('0x14b')});db[_0x1a57('0xf1')]['hasMany'](db[_0x1a57('0x107')],{'as':_0x1a57('0x167'),'foreignKey':_0x1a57('0x11c')});db[_0x1a57('0xf1')][_0x1a57('0x10b')](db[_0x1a57('0x1e6')],{'as':_0x1a57('0x1e7'),'foreignKey':_0x1a57('0x11c'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0x1e6')]['hasMany'](db[_0x1a57('0xf4')],{'as':'Resources','foreignKey':_0x1a57('0x1e8'),'onDelete':_0x1a57('0x10e')});db['WhatsappAccount'][_0x1a57('0x10b')](db['Disposition'],{'as':_0x1a57('0x15a'),'foreignKey':_0x1a57('0x1e9'),'onDelete':_0x1a57('0x10e')});db[_0x1a57('0xf8')][_0x1a57('0x10b')](db[_0x1a57('0x78')],{'as':_0x1a57('0x15b'),'foreignKey':_0x1a57('0x1e9')});db[_0x1a57('0xf8')][_0x1a57('0x10b')](db[_0x1a57('0xfc')],{'as':'Messages','foreignKey':_0x1a57('0x1e9')});db[_0x1a57('0xf8')][_0x1a57('0x10b')](db[_0x1a57('0x118')],{'as':_0x1a57('0x15c')});db[_0x1a57('0xf8')]['hasMany'](db[_0x1a57('0xf9')],{'as':_0x1a57('0x13c')});db[_0x1a57('0xf8')][_0x1a57('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x1a57('0x16d')});db[_0x1a57('0xf8')][_0x1a57('0x11b')](db['Pause'],{'as':_0x1a57('0x147'),'foreignKey':_0x1a57('0x148')});db['WhatsappAccount']['belongsToMany'](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x138')});db['WhatsappApplication']['belongsTo'](db[_0x1a57('0x107')],{'onDelete':_0x1a57('0x16c')});db[_0x1a57('0xf9')][_0x1a57('0x11b')](db['WhatsappQueue'],{'onDelete':_0x1a57('0x16c')});db['WhatsappApplication'][_0x1a57('0x11b')](db[_0x1a57('0xf8')],{'onDelete':_0x1a57('0x16c')});db[_0x1a57('0xf9')][_0x1a57('0x11b')](db[_0x1a57('0x7c')],{'onDelete':_0x1a57('0x16c'),'foreignKey':_0x1a57('0x146')});db[_0x1a57('0xf9')][_0x1a57('0x11b')](db[_0x1a57('0x84')],{'onDelete':_0x1a57('0x16c'),'foreignKey':_0x1a57('0x172')});db[_0x1a57('0x118')][_0x1a57('0x10b')](db[_0x1a57('0xfc')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x1a57('0x1ea')});db['WhatsappInteraction']['belongsTo'](db[_0x1a57('0xf8')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1e9')});db[_0x1a57('0x118')][_0x1a57('0x11b')](db['CmContact'],{'as':_0x1a57('0x163'),'foreignKey':_0x1a57('0x156')});db[_0x1a57('0x118')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'as':'Owner','foreignKey':_0x1a57('0x10a')});db[_0x1a57('0x118')]['belongsToMany'](db[_0x1a57('0x84')],{'through':_0x1a57('0x1a2'),'as':_0x1a57('0x165')});db[_0x1a57('0x118')][_0x1a57('0x11d')](db[_0x1a57('0x84')],{'through':_0x1a57('0x1a2'),'as':_0x1a57('0x166')});db['WhatsappInteraction'][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x167'),'through':_0x1a57('0x127'),'foreignKey':_0x1a57('0x1ea')});db[_0x1a57('0xfc')]['belongsTo'](db[_0x1a57('0x107')],{'as':_0x1a57('0x107')});db[_0x1a57('0xfc')][_0x1a57('0x11b')](db['CmContact'],{'onDelete':'cascade','as':_0x1a57('0x163')});db[_0x1a57('0xfc')][_0x1a57('0x11b')](db[_0x1a57('0x118')],{'onDelete':_0x1a57('0x10e'),'as':_0x1a57('0x169'),'foreignKey':_0x1a57('0x1ea')});db[_0x1a57('0xfc')][_0x1a57('0x11b')](db[_0x1a57('0xf8')],{'as':_0x1a57('0x162'),'foreignKey':_0x1a57('0x1e9')});db[_0x1a57('0x1eb')][_0x1a57('0x11b')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0xed')],{'as':_0x1a57('0x15d'),'foreignKey':_0x1a57('0x16d')});db[_0x1a57('0x1eb')][_0x1a57('0x11b')](db[_0x1a57('0x6b')],{'as':'Contact','foreignKey':_0x1a57('0x156')});db[_0x1a57('0x1eb')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x1a57('0x11b')](db[_0x1a57('0xff')],{});db[_0x1a57('0x1eb')][_0x1a57('0x11b')](db[_0x1a57('0xfc')],{});db[_0x1a57('0x1eb')]['belongsTo'](db[_0x1a57('0x107')],{});db[_0x1a57('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x1a57('0xfe')][_0x1a57('0x11b')](db[_0x1a57('0x118')],{});db[_0x1a57('0xfe')]['belongsTo'](db[_0x1a57('0xf8')],{'foreignKey':_0x1a57('0x1ec'),'as':_0x1a57('0x1d3')});db[_0x1a57('0xfe')][_0x1a57('0x11b')](db['WhatsappAccount'],{'foreignKey':_0x1a57('0x1ed'),'as':_0x1a57('0x1da')});db[_0x1a57('0xfe')][_0x1a57('0x11b')](db['WhatsappQueue'],{'foreignKey':_0x1a57('0x1ee'),'as':_0x1a57('0x1dd')});db[_0x1a57('0xfe')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':'FromUserId','as':_0x1a57('0x1d5')});db[_0x1a57('0xfe')][_0x1a57('0x11b')](db[_0x1a57('0x107')],{'foreignKey':_0x1a57('0x1d6'),'as':'ToAgent'});db[_0x1a57('0xff')][_0x1a57('0x11d')](db[_0x1a57('0x107')],{'as':_0x1a57('0x14a'),'through':_0x1a57('0x36'),'foreignKey':_0x1a57('0x1ef')});db[_0x1a57('0xff')][_0x1a57('0x11d')](db[_0x1a57('0xd9')],{'through':_0x1a57('0x1f0'),'as':_0x1a57('0x14b')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x9ffd=['ScreenRecording','VoiceMailMessage','Messages','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','VoiceCallReport','Contact','ContactId','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','Answers','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','Items','FaxAccountId','Interactions','FaxApplication','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatGroupId','chat_group_has_users','CmCompany','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','Automation','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','Fields','MetricId','Configurations','Subjects','SubjectId','FieldId','AccountId','Subject','DescriptionId','Field','VariableId','Description','int_desk_configuration_has_tags','ZohoConfiguration','Descriptions','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshsalesAccount','FreshsalesField','FromId','ToId','SessionId','ProjectId','user_has_square_projects','MailQueues','ChatQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','VoicePrefix','TeamVoicePrefix','TrunkBackup','TrunkBackupId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserVoicePrefix','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','options','password','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','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','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','Campaign','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','User','hasMany','VoiceRecording','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','SenderId','belongsToMany','Contacts','cm_user_has_contacts','Lists','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','VoiceQueue','VoiceQueues','VoicePrefixes','FaxQueues','SmsQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','CmHopper','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','IntervalId','Agents','Teams','voice_queues_has_cm_blacklists'];(function(_0x4db790,_0x3228bc){var _0x2b5d97=function(_0x8a6f8e){while(--_0x8a6f8e){_0x4db790['push'](_0x4db790['shift']());}};_0x2b5d97(++_0x3228bc);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4edc44,_0x361cfd){_0x4edc44=_0x4edc44-0x0;var _0x1b9eaf=_0x9ffd[_0x4edc44];return _0x1b9eaf;};'use strict';var config=require(_0xd9ff('0x0'));var Sequelize=require(_0xd9ff('0x1'));var _=require(_0xd9ff('0x2'));var jstz=require('jstz');var timezone=jstz[_0xd9ff('0x3')]();config[_0xd9ff('0x1')]=_[_0xd9ff('0x4')](config[_0xd9ff('0x1')],{'database':'motion2','username':_0xd9ff('0x5'),'password':_0xd9ff('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd9ff('0x7'),'dialectOptions':{'charset':_0xd9ff('0x8')},'logging':![],'timezone':timezone[_0xd9ff('0x9')](),'define':{'charset':_0xd9ff('0xa'),'collate':_0xd9ff('0xb')}}});config[_0xd9ff('0xc')]=_[_0xd9ff('0x4')](config[_0xd9ff('0xc')],{'database':_0xd9ff('0xd'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xd9ff('0x8')},'logging':![],'timezone':timezone[_0xd9ff('0x9')](),'define':{'charset':_0xd9ff('0xa'),'collate':_0xd9ff('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd9ff('0x1')][_0xd9ff('0xe')],config[_0xd9ff('0x1')][_0xd9ff('0xf')],config['sequelize']['password'],config[_0xd9ff('0x1')][_0xd9ff('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd9ff('0xc')][_0xd9ff('0xe')],config[_0xd9ff('0xc')]['username'],config[_0xd9ff('0xc')][_0xd9ff('0x11')],config['sequelizeHistory'][_0xd9ff('0x10')])};db['User']=db['sequelize']['import']('../api/user/user.model');db[_0xd9ff('0x12')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x14'));db[_0xd9ff('0x15')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x16'));db[_0xd9ff('0x17')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x18'));db[_0xd9ff('0x19')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize']['import'](_0xd9ff('0x1a'));db['ScreenRecording']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x1b'));db[_0xd9ff('0x1c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x1d'));db['VoiceCallReport']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x1e'));db[_0xd9ff('0x1f')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0xd9ff('0x20')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x21'));db['VoiceQueueReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x22'));db[_0xd9ff('0x23')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x24'));db[_0xd9ff('0x25')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x26'));db['VoiceTransferReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x27'));db['UserVoiceQueueRt']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x28'));db[_0xd9ff('0x29')]=db['sequelize'][_0xd9ff('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xd9ff('0x2a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2b'));db[_0xd9ff('0x2c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2d'));db[_0xd9ff('0x2e')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2f'));db[_0xd9ff('0x30')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x31'));db[_0xd9ff('0x32')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x33'));db['UserWhatsappQueue']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x34'));db['MailServerIn']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x35'));db['MailServerOut']=db['sequelize']['import'](_0xd9ff('0x36'));db[_0xd9ff('0x37')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x38'));db[_0xd9ff('0x39')]=db['sequelize']['import']('../api/mailQueue/mailQueue.model');db[_0xd9ff('0x3a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x3b'));db['MailInteraction']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x3c'));db[_0xd9ff('0x3d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/mailMessage/mailMessage.model');db[_0xd9ff('0x3e')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x3f'));db[_0xd9ff('0x40')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x41'));db[_0xd9ff('0x42')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x43'));db[_0xd9ff('0x44')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0xd9ff('0x45')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x46'));db[_0xd9ff('0x47')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xd9ff('0x48')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x49'));db[_0xd9ff('0x4a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4b'));db['FaxQueueReport']=db['sequelize']['import'](_0xd9ff('0x4c'));db['SmsAccount']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4d'));db['SmsApplication']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/smsApplication/smsApplication.model');db[_0xd9ff('0x4e')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4f'));db['SmsMessage']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x50'));db['SmsQueue']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x51'));db[_0xd9ff('0x52')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x53'));db[_0xd9ff('0x54')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x55'));db[_0xd9ff('0x56')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x57'));db[_0xd9ff('0x58')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x59'));db[_0xd9ff('0x5a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x5b'));db[_0xd9ff('0x5c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xd9ff('0x5d')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatApplication/chatApplication.model');db[_0xd9ff('0x5e')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0xd9ff('0x5f')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatMessage/chatMessage.model');db[_0xd9ff('0x60')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x61'));db[_0xd9ff('0x62')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x63'));db[_0xd9ff('0x64')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x65'));db[_0xd9ff('0x66')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x67'));db['CmCompany']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x68'));db[_0xd9ff('0x69')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x6a'));db['CmHopper']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/cmHopper/cmHopper.model');db[_0xd9ff('0x6b')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x6c'));db[_0xd9ff('0x6d')]=db[_0xd9ff('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xd9ff('0x6e')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x6f'));db[_0xd9ff('0x70')]=db[_0xd9ff('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x71'));db[_0xd9ff('0x72')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x73'));db['Automation']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x74'));db[_0xd9ff('0x75')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x76'));db[_0xd9ff('0x77')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x78'));db['Condition']=db['sequelize'][_0xd9ff('0x13')]('../api/condition/condition.model');db[_0xd9ff('0x79')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x7a'));db[_0xd9ff('0x7b')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7c'));db['Cdr']=db[_0xd9ff('0x1')]['import']('../api/cdr/cdr.model');db[_0xd9ff('0x7d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7e'));db['Schedule']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7f'));db[_0xd9ff('0x80')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x81'));db[_0xd9ff('0x82')]=db['sequelize']['import']('../api/tag/tag.model');db[_0xd9ff('0x83')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x84'));db[_0xd9ff('0x85')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x86'));db[_0xd9ff('0x87')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/variable/variable.model');db[_0xd9ff('0x88')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/integration/integration.model');db[_0xd9ff('0x89')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x8a'));db[_0xd9ff('0x8b')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x8c'));db[_0xd9ff('0x8d')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x8e'));db[_0xd9ff('0x8f')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x90'));db[_0xd9ff('0x91')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x92'));db[_0xd9ff('0x93')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x94'));db['AnalyticTreeReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xd9ff('0x95')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xd9ff('0x96')]=db['sequelize'][_0xd9ff('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xd9ff('0x97')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x98'));db[_0xd9ff('0x99')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x9a'));db[_0xd9ff('0x9b')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x9c'));db[_0xd9ff('0x9d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x9e'));db[_0xd9ff('0x9f')]=db['sequelize']['import'](_0xd9ff('0xa0'));db[_0xd9ff('0xa1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa2'));db[_0xd9ff('0xa3')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xa4'));db[_0xd9ff('0xa5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa6'));db['ZohoConfiguration']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa7'));db[_0xd9ff('0xa8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa9'));db[_0xd9ff('0xaa')]=db['sequelize'][_0xd9ff('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xd9ff('0xab')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xac'));db[_0xd9ff('0xad')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xae'));db[_0xd9ff('0xaf')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xb0'));db[_0xd9ff('0xb1')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xb2'));db[_0xd9ff('0xb3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xb4'));db[_0xd9ff('0xb5')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xb6'));db[_0xd9ff('0xb7')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xb8'));db[_0xd9ff('0xb9')]=db['sequelize'][_0xd9ff('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0xd9ff('0xba')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xbb'));db[_0xd9ff('0xbc')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xbd'));db[_0xd9ff('0xbe')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xd9ff('0xbf')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xc0'));db[_0xd9ff('0xc1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xc2'));db[_0xd9ff('0xc3')]=db['sequelize']['import'](_0xd9ff('0xc4'));db['FreshsalesAccount']=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xd9ff('0xc5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xc6'));db['Integration']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xc7'));db[_0xd9ff('0xc8')]=db[_0xd9ff('0x1')]['import']('../api/network/network.model');db[_0xd9ff('0xc9')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xca'));db[_0xd9ff('0xcb')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xcc'));db[_0xd9ff('0xcd')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xce'));db[_0xd9ff('0xcf')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xd0'));db[_0xd9ff('0xd1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd9ff('0xd2')]=db[_0xd9ff('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0xd9ff('0xd3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xd4'));db[_0xd9ff('0xd5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xd6'));db[_0xd9ff('0xd7')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xd8'));db[_0xd9ff('0xd9')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xda'));db[_0xd9ff('0xdb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xdc'));db['SquareRecording']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xdd'));db[_0xd9ff('0xde')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/squareMessage/squareMessage.model');db[_0xd9ff('0xdf')]=db[_0xd9ff('0x1')]['import']('../api/team/team.model');db['License']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/license/license.model');db[_0xd9ff('0xe0')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/campaign/campaign.model');db['Migration']=db['sequelize'][_0xd9ff('0x13')]('../api/migration/migration.model');db[_0xd9ff('0xe1')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xe2'));db[_0xd9ff('0xe3')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe4'));db['MailTransferReport']=db[_0xd9ff('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe5'));db[_0xd9ff('0xe6')]=db['sequelize']['import'](_0xd9ff('0xe7'));db[_0xd9ff('0xe8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe9'));db['SmsTransferReport']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xea'));db[_0xd9ff('0xeb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xec'));db['VoicePrefix']=db[_0xd9ff('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db[_0xd9ff('0xed')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xee'));db['UserProfileSection']=db['sequelize'][_0xd9ff('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xef'));db['UserNotification']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf0'));db[_0xd9ff('0xf1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf2'));db['WhatsappApplication']=db[_0xd9ff('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xd9ff('0xf3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xf4'));db['WhatsappMessage']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xf5'));db[_0xd9ff('0xf6')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf7'));db[_0xd9ff('0xf8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf9'));db[_0xd9ff('0xfa')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0xd9ff('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0xd9ff('0xfb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xfc'));db['TeamVoicePrefix']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xfd'));db['UserVoicePrefix']=db['sequelize']['import'](_0xd9ff('0xfe'));db['User'][_0xd9ff('0xff')](db['VoiceMail'],{'as':_0xd9ff('0x1c'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x104')],{'as':'Recordings','foreignKey':'UserId'});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x105')],{'as':_0xd9ff('0x106'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':_0xd9ff('0x108'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x109'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')]['hasMany'](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db['FaxInteraction'],{'as':_0xd9ff('0x10e'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x110'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0xf3')],{'as':_0xd9ff('0x111'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0x112')],{'as':'UserNotifications','foreignKey':_0xd9ff('0x113')});db[_0xd9ff('0x102')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x64')],{'as':'Groups','through':'chat_group_has_users'});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'through':_0xd9ff('0x116')});db['User']['belongsToMany'](db['CmList'],{'as':_0xd9ff('0x117'),'through':_0xd9ff('0x118')});db['User'][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x119')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x110'),'through':_0xd9ff('0x11a')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'through':_0xd9ff('0x11b')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x10e'),'through':_0xd9ff('0x11c')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'through':_0xd9ff('0x11d')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'through':_0xd9ff('0x11e')});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0xf3')],{'as':_0xd9ff('0x111'),'through':'user_has_whatsapp_interactions'});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x120'),'through':_0xd9ff('0x29'),'required':![]});db[_0xd9ff('0x102')]['belongsToMany'](db['VoicePrefix'],{'as':_0xd9ff('0x121'),'through':'UserVoicePrefix','required':![]});db['User'][_0xd9ff('0x114')](db[_0xd9ff('0x39')],{'as':'MailQueues','through':_0xd9ff('0x2c'),'required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x62')],{'as':'ChatQueues','through':_0xd9ff('0x2a'),'required':![],'hooks':!![]});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x4a')],{'as':_0xd9ff('0x122'),'through':'UserFaxQueue','required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x123')],{'as':'SmsQueues','through':_0xd9ff('0x30'),'required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db['OpenchannelQueue'],{'as':_0xd9ff('0x124'),'through':'UserOpenchannelQueue','required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0xfa')],{'as':_0xd9ff('0x125'),'through':_0xd9ff('0x126'),'required':![]});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0xeb')],{'through':_0xd9ff('0x118')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x5a')],{'as':'ChatWebsites','through':_0xd9ff('0x127')});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x45')],{'as':_0xd9ff('0x128'),'through':_0xd9ff('0x129')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x12a'),'through':_0xd9ff('0x12b')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x12c'),'through':_0xd9ff('0x12d')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x12e')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User'][_0xd9ff('0x114')](db['WhatsappAccount'],{'as':_0xd9ff('0x12f'),'through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db[_0xd9ff('0xdb')],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0xd9ff('0x12')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x130'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x131')});db[_0xd9ff('0x15')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x17')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x132'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0xd9ff('0x114')](db[_0xd9ff('0x80')],{'as':_0xd9ff('0x133'),'through':_0xd9ff('0x134')});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x105')],{'as':_0xd9ff('0x135'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xd9ff('0x103')](db[_0xd9ff('0x6d')],{'as':'HopperFinals','foreignKey':_0xd9ff('0x138')});db[_0xd9ff('0x11f')]['hasMany'](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x138')});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x6b')],{'as':_0xd9ff('0x13a'),'foreignKey':_0xd9ff('0x138')});db['VoiceQueue'][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'as':_0xd9ff('0x13b'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x13c')](db[_0xd9ff('0x25')],{'as':'Trunk','foreignKey':_0xd9ff('0x13d')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xd9ff('0x11f')][_0xd9ff('0x13c')](db['Interval'],{'as':_0xd9ff('0x79'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x11f')]['belongsTo'](db[_0xd9ff('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x29')});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'as':_0xd9ff('0x140'),'through':_0xd9ff('0xfb')});db['VoiceQueue'][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':'BlackLists','through':_0xd9ff('0x141')});db[_0xd9ff('0x104')]['belongsTo'](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x142')]['belongsTo'](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x1c')][_0xd9ff('0x103')](db[_0xd9ff('0x143')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xd9ff('0x143')]['belongsTo'](db[_0xd9ff('0x1c')],{'foreignKey':_0xd9ff('0x145'),'targetKey':'mailbox'});db['VoiceCallReport']['hasMany'](db[_0xd9ff('0x146')],{'as':_0xd9ff('0x147'),'foreignKey':_0xd9ff('0x148'),'constraints':![]});db['VoiceCallReport'][_0xd9ff('0x103')](db[_0xd9ff('0x20')],{'as':_0xd9ff('0x149'),'foreignKey':_0xd9ff('0x148'),'constraints':![]});db[_0xd9ff('0x14a')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x14a')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x14d')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x37'),'foreignKey':_0xd9ff('0x14e')});db['MailServerOut']['belongsTo'](db[_0xd9ff('0x37')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xd9ff('0x37')][_0xd9ff('0xff')](db[_0xd9ff('0x14d')],{'as':_0xd9ff('0x14f'),'onDelete':_0xd9ff('0x100')});db['MailAccount'][_0xd9ff('0xff')](db['MailServerOut'],{'as':_0xd9ff('0x150'),'onDelete':_0xd9ff('0x100')});db['MailAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x14e'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db['CannedAnswer'],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x14e')});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db[_0xd9ff('0x3d')],{'as':_0xd9ff('0x144'),'foreignKey':'MailAccountId'});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':'Interactions'});db[_0xd9ff('0x37')]['hasMany'](db[_0xd9ff('0x3e')],{'as':'Applications'});db[_0xd9ff('0x37')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153')});db['MailAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0x83')],{'as':_0xd9ff('0x83'),'foreignKey':_0xd9ff('0x154')});db[_0xd9ff('0x37')]['belongsTo'](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0x37')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xd9ff('0x39')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x2c')});db[_0xd9ff('0x39')][_0xd9ff('0x114')](db['Team'],{'through':_0xd9ff('0x157'),'as':_0xd9ff('0x140')});db[_0xd9ff('0x10f')][_0xd9ff('0x103')](db[_0xd9ff('0x3d')],{'as':_0xd9ff('0x144'),'onDelete':'cascade','foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x10f')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x14e')});db['MailInteraction']['belongsTo'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x10f')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db['MailInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x15b'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x10f')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x15b'),'as':'ThroughTags'});db['MailInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11a'),'foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x3d')][_0xd9ff('0x103')](db[_0xd9ff('0xe1')],{'as':'Attachments','onDelete':_0xd9ff('0x100')});db['MailMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x3d')]['belongsTo'](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x3d')]['belongsTo'](db[_0xd9ff('0x37')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x5a'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x60')],{'as':_0xd9ff('0x60'),'foreignKey':_0xd9ff('0x160')});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db['MailApplication'][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{'onDelete':'restrict'});db['MailApplication'][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'onDelete':'restrict'});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db['Interval'],{'onDelete':_0xd9ff('0x161'),'foreignKey':'IntervalId'});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x40')]['belongsTo'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db['MailQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db['MailQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{});db[_0xd9ff('0x42')]['hasMany'](db['DashboardItem'],{'as':_0xd9ff('0x164'),'onDelete':_0xd9ff('0x100')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x165')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x167')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':'Exntensions','onDelete':_0xd9ff('0x100')});db['FaxAccount'][_0xd9ff('0x103')](db['FaxMessage'],{'as':_0xd9ff('0x144')});db[_0xd9ff('0x45')][_0xd9ff('0x13c')](db['Trunk'],{'as':'Trunk'});db['FaxAccount']['belongsTo'](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x45')][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x45')][_0xd9ff('0x114')](db['User'],{'as':'Agents','through':_0xd9ff('0x129')});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x167')]['belongsTo'](db[_0xd9ff('0x4a')],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':_0xd9ff('0x161'),'foreignKey':'TagId'});db[_0xd9ff('0x47')][_0xd9ff('0x103')](db[_0xd9ff('0x48')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x168')});db['FaxInteraction']['belongsTo'](db[_0xd9ff('0x45')],{'as':'Account','foreignKey':_0xd9ff('0x165')});db['FaxInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':'ContactId'});db[_0xd9ff('0x47')][_0xd9ff('0x13c')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x169'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':'fax_interaction_has_tags','as':_0xd9ff('0x16a')});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11c'),'foreignKey':_0xd9ff('0x168')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['User'],{'onDelete':'cascade','as':'User'});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['FaxInteraction'],{'as':_0xd9ff('0x15e'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['Attachment'],{'as':_0xd9ff('0xe1'),'foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xd9ff('0x4a')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x2e')});db[_0xd9ff('0x4a')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x16c'),'as':_0xd9ff('0x140')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{});db['FaxQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x47')],{});db[_0xd9ff('0x16d')]['belongsTo'](db[_0xd9ff('0x48')],{});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db['FaxQueueReport'][_0xd9ff('0x13c')](db['FaxQueue'],{});db['SmsAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x16e'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db['CannedAnswer'],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x16e')});db['SmsAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x16f')],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db[_0xd9ff('0x170')],{'as':'Applications'});db['SmsAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x12e')][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x12e')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'user_has_sms_accounts'});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db['SmsApplication']['belongsTo'](db[_0xd9ff('0x123')],{'onDelete':'restrict'});db['SmsApplication'][_0xd9ff('0x13c')](db['SmsAccount'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'onDelete':_0xd9ff('0x161'),'foreignKey':'IntervalId'});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db['SmsInteraction']['hasMany'](db[_0xd9ff('0x16f')],{'as':'Messages','onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xd9ff('0x4e')]['belongsTo'](db['SmsAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x4e')][_0xd9ff('0x13c')](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x4e')][_0xd9ff('0x13c')](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':'UserId'});db['SmsInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x171'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x4e')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x171'),'as':_0xd9ff('0x16a')});db['SmsInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11d'),'foreignKey':_0xd9ff('0x172')});db[_0xd9ff('0x16f')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x16f')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'onDelete':'cascade','as':_0xd9ff('0x14b')});db[_0xd9ff('0x16f')][_0xd9ff('0x13c')](db[_0xd9ff('0x4e')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x172')});db['SmsMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'as':'Account','foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x123')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x30'),'foreignKey':_0xd9ff('0x173')});db[_0xd9ff('0x123')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':'team_has_sms_queues','as':_0xd9ff('0x140')});db[_0xd9ff('0x52')]['hasMany'](db[_0xd9ff('0x77')],{'as':'Dispositions','foreignKey':_0xd9ff('0x174'),'onDelete':_0xd9ff('0x100')});db['OpenchannelAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':'OpenchannelAccountId'});db[_0xd9ff('0x52')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xd9ff('0x166'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x103')](db[_0xd9ff('0x56')],{'as':'Messages','foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x103')](db[_0xd9ff('0x54')],{'as':'Applications','foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x52')][_0xd9ff('0x13c')](db['Pause'],{'as':_0xd9ff('0x155'),'foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0x52')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x12d')});db['OpenchannelApplication'][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x58')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x175')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db['OpenchannelInteraction'][_0xd9ff('0x103')](db[_0xd9ff('0x56')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x10a')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x174')});db['OpenchannelInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x10a')]['belongsTo'](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db['OpenchannelInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x177'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x10a')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':'openchannel_interaction_has_tags','as':_0xd9ff('0x16a')});db['OpenchannelInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11e'),'foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x56')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x100'),'as':'User'});db['OpenchannelMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db['OpenchannelMessage'][_0xd9ff('0x13c')](db['OpenchannelInteraction'],{'onDelete':_0xd9ff('0x100'),'as':'Interaction','foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x56')]['belongsTo'](db[_0xd9ff('0xe1')],{'as':_0xd9ff('0xe1'),'foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x56')]['belongsTo'](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x58')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xd9ff('0x175')});db[_0xd9ff('0x58')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x178'),'as':_0xd9ff('0x140')});db['ChatWebsite'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x15f'),'onDelete':_0xd9ff('0x100')});db['ChatWebsite'][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db[_0xd9ff('0x66')],{'as':_0xd9ff('0x179')});db['ChatWebsite'][_0xd9ff('0x103')](db['ChatInteraction'],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db[_0xd9ff('0x5d')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db['ChatMessage'],{'as':_0xd9ff('0x144')});db[_0xd9ff('0x5a')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db['ChatWebsite']['belongsTo'](db[_0xd9ff('0x79')],{'as':_0xd9ff('0x79'),'foreignKey':_0xd9ff('0x13e')});db['ChatWebsite'][_0xd9ff('0x13c')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xd9ff('0x14e')});db[_0xd9ff('0x5a')][_0xd9ff('0x13c')](db['Pause'],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':'ListId'});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x10a')],{});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x56')],{});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x58')],{});db[_0xd9ff('0x5d')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x17a'),'foreignKey':'UserId','onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x62')],{'as':'Queue','foreignKey':_0xd9ff('0x17b'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x17c'),'foreignKey':_0xd9ff('0x15f'),'onDelete':'restrict'});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':'TagId'});db['ChatInteraction'][_0xd9ff('0x103')](db[_0xd9ff('0x5f')],{'as':'Messages','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':'ContactId'});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x5e')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x17e'),'as':_0xd9ff('0x15c')});db['ChatInteraction']['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x17e'),'as':'ThroughTags'});db[_0xd9ff('0x5e')][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x15d'),'through':'user_has_chat_interactions','foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x102')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x5e')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db[_0xd9ff('0xe1')],{'as':'Attachment','foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db['ChatWebsite'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x60')][_0xd9ff('0x103')](db[_0xd9ff('0xe1')],{'as':_0xd9ff('0x17f'),'foreignKey':_0xd9ff('0x160'),'onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x60')]['belongsTo'](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatOfflineMessage']['belongsTo'](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db['ChatQueue'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':'team_has_chat_queues','as':_0xd9ff('0x140')});db[_0xd9ff('0x64')][_0xd9ff('0x103')](db[_0xd9ff('0xcb')],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x180'),'onDelete':'cascade'});db[_0xd9ff('0x64')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x135'),'through':_0xd9ff('0x181')});db[_0xd9ff('0x66')][_0xd9ff('0x13c')](db['ChatWebsite'],{'as':_0xd9ff('0x17c'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0xd9ff('0x103')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'foreignKey':'CompanyId'});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':_0xd9ff('0x14c')});db['CmContact'][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'as':'JscriptySessions','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db['CmContact']['hasMany'](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'foreignKey':'ContactId','onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x10e'),'foreignKey':_0xd9ff('0x14c'),'onDelete':'restrict'});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':'MailInteractions','foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x13c')](db[_0xd9ff('0x182')],{'as':_0xd9ff('0x183'),'foreignKey':'CompanyId'});db[_0xd9ff('0x69')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153'),'onDelete':'cascade'});db[_0xd9ff('0x69')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x116')});db[_0xd9ff('0x69')]['belongsToMany'](db[_0xd9ff('0x82')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xd9ff('0x69')]['belongsToMany'](db['Tag'],{'through':_0xd9ff('0x184'),'as':_0xd9ff('0x16a')});db['CmHopper']['belongsTo'](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153'),'onDelete':'cascade'});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x17a'),'foreignKey':_0xd9ff('0x101')});db['CmHopper'][_0xd9ff('0x13c')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x185'),'foreignKey':_0xd9ff('0x138'),'onDelete':_0xd9ff('0x100')});db['CmHopper'][_0xd9ff('0x13c')](db[_0xd9ff('0xe0')],{'as':'Campaign','foreignKey':_0xd9ff('0x186'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x187')});db['CmHopperBlack']['belongsTo'](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xd9ff('0x100')});db['CmHopperBlack'][_0xd9ff('0x13c')](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x6b')][_0xd9ff('0x13c')](db['VoiceQueue'],{'as':_0xd9ff('0x185'),'foreignKey':_0xd9ff('0x138'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x6b')][_0xd9ff('0x13c')](db[_0xd9ff('0xe0')],{'as':_0xd9ff('0xe0'),'foreignKey':_0xd9ff('0x186'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x18a'),'singular':_0xd9ff('0x18b')},'foreignKey':_0xd9ff('0x18c'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x18d'),'singular':_0xd9ff('0x18e')},'foreignKey':_0xd9ff('0x18f'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x72')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x77')]['hasMany'](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x190'),'onDelete':_0xd9ff('0x100')});db['Interval'][_0xd9ff('0x103')](db[_0xd9ff('0x79')],{'as':'Intervals','foreignKey':_0xd9ff('0x13e'),'onDelete':_0xd9ff('0x100'),'hooks':!![],'required':![]});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'foreignKey':_0xd9ff('0x13e'),'onDelete':'restrict'});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db['MailApplication'],{'as':_0xd9ff('0x191'),'foreignKey':'IntervalId'});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x5d')],{'as':_0xd9ff('0x192'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x167')],{'as':_0xd9ff('0x193'),'foreignKey':'IntervalId'});db[_0xd9ff('0x79')]['hasMany'](db['SmsApplication'],{'as':_0xd9ff('0x194'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x195')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{});db[_0xd9ff('0x195')][_0xd9ff('0x13c')](db[_0xd9ff('0x8d')],{'foreignKey':_0xd9ff('0x196')});db['Schedule'][_0xd9ff('0x13c')](db[_0xd9ff('0x8b')],{'foreignKey':_0xd9ff('0x197')});db[_0xd9ff('0x80')][_0xd9ff('0x114')](db[_0xd9ff('0x19')],{'as':_0xd9ff('0x198'),'through':_0xd9ff('0x134'),'onDelete':_0xd9ff('0x161')});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0x69')],{'through':_0xd9ff('0x184')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x5e')],{'through':_0xd9ff('0x17e')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x10f')],{'through':'mail_interaction_has_tags'});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x4e')],{'through':'sms_interaction_has_tags'});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0x47')],{'through':_0xd9ff('0x169')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db['OpenchannelInteraction'],{'through':_0xd9ff('0x177')});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0xf3')],{'through':_0xd9ff('0x199')});db[_0xd9ff('0x85')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x19a'),'singular':_0xd9ff('0x19b')},'foreignKey':_0xd9ff('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x85')][_0xd9ff('0x103')](db['Condition'],{'as':{'plural':_0xd9ff('0x19d'),'singular':_0xd9ff('0x19e')},'foreignKey':'TriggerAnyId','onDelete':_0xd9ff('0x100'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xd9ff('0x72')],{'as':_0xd9ff('0x19f'),'foreignKey':'TriggerId','onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x8b')][_0xd9ff('0x103')](db['AnalyticFieldReport'],{'as':_0xd9ff('0x1a0'),'onDelete':'cascade','foreignKey':_0xd9ff('0x197'),'hooks':!![]});db[_0xd9ff('0x8d')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x196')});db[_0xd9ff('0x91')]['hasMany'](db[_0xd9ff('0x93')],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a1')});db['AnalyticFieldReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x91')],{'foreignKey':_0xd9ff('0x1a1')});db['SalesforceAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x96')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':'AccountId'});db[_0xd9ff('0x96')][_0xd9ff('0x103')](db['SalesforceField'],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x96')]['hasMany'](db[_0xd9ff('0x97')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':'DescriptionId'});db[_0xd9ff('0x96')]['hasMany'](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0x96')][_0xd9ff('0x13c')](db[_0xd9ff('0x95')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':'Description','foreignKey':_0xd9ff('0x1a8')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['SalesforceField']['belongsTo'](db[_0xd9ff('0x87')],{'as':'Variable','foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x99')][_0xd9ff('0x103')](db['SugarcrmConfiguration'],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x9b')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a3'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x9b')]['hasMany'](db[_0xd9ff('0x9d')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0x9b')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db['SugarcrmConfiguration'][_0xd9ff('0x13c')](db['SugarcrmAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x9d')]['hasMany'](db['SugarcrmField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x9d')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['SugarcrmField'][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0x9d')]['belongsTo'](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x9f')]['hasMany'](db[_0xd9ff('0xa1')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db['DeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':'Subjects','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xa1')]['hasMany'](db[_0xd9ff('0xa3')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa1')][_0xd9ff('0x13c')](db['DeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xd9ff('0xa1')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x1ac')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db['DeskField'],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db['DeskField'],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa3')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xa5')][_0xd9ff('0x103')](db[_0xd9ff('0x1ad')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1a3'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1ae'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xd9ff('0x1ad')]['belongsTo'](db[_0xd9ff('0xa5')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db['ZohoField'][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xa8')][_0xd9ff('0x103')](db['ZohoField'],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa8')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xaa')][_0xd9ff('0x103')](db[_0xd9ff('0xab')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Subjects','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Descriptions','foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db['ZendeskField'],{'as':_0xd9ff('0x1a0'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db[_0xd9ff('0xaa')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['ZendeskConfiguration'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x1af')});db[_0xd9ff('0xad')]['hasMany'](db[_0xd9ff('0xad')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xad')]['hasMany'](db[_0xd9ff('0xad')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xad')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Field','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xad')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xaf')][_0xd9ff('0x103')](db['FreshdeskConfiguration'],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb1')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb1')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xb1')][_0xd9ff('0x13c')](db[_0xd9ff('0xaf')],{'as':'Account','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb1')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x1b0')});db['FreshdeskField'][_0xd9ff('0x103')](db['FreshdeskField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb3')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1a9'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':'VariableId'});db[_0xd9ff('0xb5')]['hasMany'](db[_0xd9ff('0xb7')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db['VtigerConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a3'),'foreignKey':'SubjectId'});db[_0xd9ff('0xb7')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a0'),'foreignKey':'FieldId'});db[_0xd9ff('0xb7')][_0xd9ff('0x13c')](db['VtigerAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb9')]['hasMany'](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb9')]['hasMany'](db['VtigerField'],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['VtigerField']['hasMany'](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xb9')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xba')][_0xd9ff('0x103')](db[_0xd9ff('0xbc')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db['ServicenowConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1a3'),'foreignKey':'SubjectId'});db[_0xd9ff('0xbc')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Descriptions','foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xbc')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Fields','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xbc')][_0xd9ff('0x13c')](db[_0xd9ff('0xba')],{'as':_0xd9ff('0x159'),'foreignKey':'AccountId'});db['ServicenowField'][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xbe')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1ab'),'foreignKey':'DescriptionId'});db[_0xd9ff('0xbe')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xbe')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':'Variable','foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xbf')]['hasMany'](db[_0xd9ff('0xc1')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xc1')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db['Dynamics365Configuration'][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db['Dynamics365Configuration'][_0xd9ff('0x13c')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['Dynamics365Field']['belongsTo'](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x1b1')][_0xd9ff('0x103')](db[_0xd9ff('0xc5')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':'AccountId'});db[_0xd9ff('0xc5')]['hasMany'](db['FreshsalesField'],{'as':_0xd9ff('0x1a3'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xc5')][_0xd9ff('0x103')](db['FreshsalesField'],{'as':_0xd9ff('0x1ae'),'foreignKey':'DescriptionId'});db[_0xd9ff('0xc5')][_0xd9ff('0x103')](db['FreshsalesField'],{'as':_0xd9ff('0x1a0'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xc5')][_0xd9ff('0x13c')](db[_0xd9ff('0x1b1')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x1b2')]['hasMany'](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1a7'),'foreignKey':'SubjectId'});db[_0xd9ff('0x1b2')][_0xd9ff('0x103')](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['FreshsalesField'][_0xd9ff('0x103')](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['FreshsalesField'][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':'VariableId'});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatQueueReport'][_0xd9ff('0x13c')](db['ChatInteraction'],{});db['ChatQueueReport'][_0xd9ff('0x13c')](db['ChatMessage'],{});db['ChatQueueReport'][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db[_0xd9ff('0x62')],{});db[_0xd9ff('0xcb')][_0xd9ff('0x13c')](db['User'],{'onDelete':'cascade','foreignKey':_0xd9ff('0x1b3')});db['ChatInternalMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1b4')});db[_0xd9ff('0xd1')][_0xd9ff('0x103')](db[_0xd9ff('0xcf')],{'foreignKey':'SessionId','onDelete':_0xd9ff('0x100')});db['JscriptySessionReport']['hasMany'](db[_0xd9ff('0xcd')],{'foreignKey':_0xd9ff('0x1b5'),'onDelete':_0xd9ff('0x100')});db['SmsQueueReport'][_0xd9ff('0x13c')](db['SmsAccount'],{});db['SmsQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xd2')][_0xd9ff('0x13c')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xd9ff('0xd2')]['belongsTo'](db[_0xd9ff('0x4e')],{});db[_0xd9ff('0xd2')]['belongsTo'](db[_0xd9ff('0x16f')],{});db['SmsQueueReport'][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0xd2')][_0xd9ff('0x13c')](db[_0xd9ff('0x123')],{});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'foreignKey':_0xd9ff('0x1b6')});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xcf')],{'foreignKey':_0xd9ff('0x1b6')});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xcd')],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db['User'],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x1b7')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':_0xd9ff('0x119')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'through':_0xd9ff('0xfb'),'as':_0xd9ff('0x120')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xd9ff('0x1b8')});db['Team'][_0xd9ff('0x114')](db[_0xd9ff('0x62')],{'through':'team_has_chat_queues','as':_0xd9ff('0x1b9')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x4a')],{'through':_0xd9ff('0x16c'),'as':_0xd9ff('0x122')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x123')],{'through':_0xd9ff('0x1ba'),'as':_0xd9ff('0x1bb')});db['Team']['belongsToMany'](db['OpenchannelQueue'],{'through':_0xd9ff('0x178'),'as':'OpenchannelQueues'});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':_0xd9ff('0x1bc'),'as':_0xd9ff('0x125')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x1bd')],{'through':_0xd9ff('0x1be'),'as':_0xd9ff('0x121')});db['Campaign'][_0xd9ff('0x103')](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':'CampaignId'});db['Campaign'][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x186')});db[_0xd9ff('0xe0')]['hasMany'](db['CmHopperHistory'],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x186')});db[_0xd9ff('0xe0')][_0xd9ff('0x103')](db[_0xd9ff('0x6b')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0xd9ff('0xe0')]['belongsTo'](db[_0xd9ff('0x25')],{'as':_0xd9ff('0x25'),'foreignKey':_0xd9ff('0x13d')});db['Campaign'][_0xd9ff('0x13c')](db[_0xd9ff('0x25')],{'as':_0xd9ff('0x1bf'),'foreignKey':_0xd9ff('0x1c0')});db[_0xd9ff('0xe0')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'as':'Interval','foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0xe0')][_0xd9ff('0x13c')](db['SquareProject'],{'as':_0xd9ff('0xdb'),'foreignKey':'SquareProjectId'});db[_0xd9ff('0xe0')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x117'),'through':_0xd9ff('0x1c1')});db[_0xd9ff('0xe0')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x1c2'),'through':_0xd9ff('0x1c3')});db[_0xd9ff('0xe1')][_0xd9ff('0x13c')](db[_0xd9ff('0x60')],{'as':_0xd9ff('0x60'),'foreignKey':_0xd9ff('0x160')});db['MailTransferReport']['belongsTo'](db[_0xd9ff('0x3d')],{});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'foreignKey':_0xd9ff('0x1c5'),'as':_0xd9ff('0x1c6')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1c4')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{'foreignKey':'ToMailQueueId','as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'foreignKey':_0xd9ff('0x1ca'),'as':'ToAccount'});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db[_0xd9ff('0x5f')],{});db['ChatTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x5e')],{});db[_0xd9ff('0x1cb')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xd9ff('0x1cc'),'as':_0xd9ff('0x1c6')});db[_0xd9ff('0x1cb')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1cb')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db['ChatQueue'],{'foreignKey':_0xd9ff('0x1cf'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'foreignKey':'ToChatWebsiteId','as':_0xd9ff('0x1d0')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db['FaxMessage'],{});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db['FaxInteraction'],{});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'foreignKey':_0xd9ff('0x1d1'),'as':'FromAccount'});db[_0xd9ff('0xe6')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'FromUserId','as':_0xd9ff('0x1c8')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':_0xd9ff('0x1ce')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x4a')],{'foreignKey':_0xd9ff('0x1d2'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'foreignKey':_0xd9ff('0x1d3'),'as':'ToAccount'});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db['OpenchannelMessage'],{});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x10a')],{});db['OpenchannelTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'foreignKey':_0xd9ff('0x1d4'),'as':_0xd9ff('0x1c6')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db['User'],{'foreignKey':'FromUserId','as':_0xd9ff('0x1c8')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db[_0xd9ff('0xe8')]['belongsTo'](db[_0xd9ff('0x58')],{'foreignKey':_0xd9ff('0x1d5'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'foreignKey':_0xd9ff('0x1d6'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x16f')],{});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x4e')],{});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'foreignKey':'FromSmsAccountId','as':_0xd9ff('0x1c6')});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db['User'],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':_0xd9ff('0x1ce')});db['SmsTransferReport'][_0xd9ff('0x13c')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'foreignKey':_0xd9ff('0x1d8'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xd9ff('0xeb')]['hasMany'](db[_0xd9ff('0x1d9')],{'as':_0xd9ff('0x1da'),'foreignKey':'ListId'});db[_0xd9ff('0xeb')]['hasMany'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x153')});db['CmList'][_0xd9ff('0x103')](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x109'),'foreignKey':'ListId'});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':'ReportAgentPreview','foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xeb')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x1db'),'through':'voice_queues_has_cm_lists'});db[_0xd9ff('0xeb')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'cm_user_has_lists'});db[_0xd9ff('0x1bd')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x1bd')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x1dc')});db[_0xd9ff('0x1bd')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x1be'),'as':_0xd9ff('0x140')});db[_0xd9ff('0xed')][_0xd9ff('0x103')](db['User'],{'as':'Users','foreignKey':_0xd9ff('0x1dd')});db[_0xd9ff('0xed')][_0xd9ff('0x103')](db[_0xd9ff('0x1de')],{'as':_0xd9ff('0x1df'),'foreignKey':'userProfileId','onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x1de')][_0xd9ff('0x103')](db[_0xd9ff('0x1e0')],{'as':'Resources','foreignKey':_0xd9ff('0x1e1'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x1e2'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x1e2')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db['WhatsappMessage'],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x1e2')});db[_0xd9ff('0xf1')]['hasMany'](db[_0xd9ff('0xf3')],{'as':'Interactions'});db['WhatsappAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x1e3')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0xf1')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db['WhatsappAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0xf1')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':'Agents','through':_0xd9ff('0x1e4')});db[_0xd9ff('0x1e3')]['belongsTo'](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['WhatsappAccount'],{'onDelete':_0xd9ff('0x161')});db['WhatsappApplication'][_0xd9ff('0x13c')](db['Interval'],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xd9ff('0x162')});db[_0xd9ff('0xf3')][_0xd9ff('0x103')](db[_0xd9ff('0x1e5')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0xf3')][_0xd9ff('0x13c')](db[_0xd9ff('0xf1')],{'as':'Account','foreignKey':_0xd9ff('0x1e2')});db['WhatsappInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0xd9ff('0xf3')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0xf3')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x199'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0xf3')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x199'),'as':_0xd9ff('0x16a')});db['WhatsappInteraction'][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x15d'),'through':'user_has_whatsapp_interactions','foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':'Contact'});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db[_0xd9ff('0xf3')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0x1e5')]['belongsTo'](db[_0xd9ff('0xf1')],{'as':_0xd9ff('0x159'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0xd9ff('0x13c')](db['WhatsappAccount'],{});db[_0xd9ff('0xf6')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db['WhatsappInteraction'],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0xfa')],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x1e5')],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db['WhatsappMessage'],{});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db[_0xd9ff('0xf3')],{});db['WhatsappTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xf1')],{'foreignKey':_0xd9ff('0x1e7'),'as':'FromAccount'});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0xf1')],{'foreignKey':_0xd9ff('0x1e8'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db[_0xd9ff('0xfa')],{'foreignKey':_0xd9ff('0x1e9'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1c7'),'as':'FromAgent'});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db['WhatsappQueue'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'UserWhatsappQueue','foreignKey':_0xd9ff('0x1ea')});db[_0xd9ff('0xfa')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x1bc'),'as':'Teams'});module[_0xd9ff('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 9164cf2..a2985e5 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8250=['/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','./api/condition','/api/intervals','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/tags','./api/tag','/api/templates','./api/trigger','/api/variables','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','lastName','street','mobile','fax','email','clientId','clientSecret','securityToken','accessKey','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','vidaooApiKey','clientEmail','privateKey','accesskeyid','accountSid','localstationid','secret','oldPassword','isPlainObject','isArray','length','isString','replace','includes','lodash','path','express','express-winston','./errors','./config/environment','api','auth','safeTemplate','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','inspect','use','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','role','device','other','agent_name','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8250,0xfa));var _0x0825=function(_0x148bbb,_0x543b1c){_0x148bbb=_0x148bbb-0x0;var _0x29f11a=_0x8250[_0x148bbb];return _0x29f11a;};'use strict';var _=require(_0x0825('0x0'));var path=require(_0x0825('0x1'));var express=require(_0x0825('0x2'));var ewinston=require(_0x0825('0x3'));var util=require('util');var errors=require(_0x0825('0x4'));var config=require(_0x0825('0x5'));var logger=require('./config/logger')(_0x0825('0x6'));var authLogger=require('./config/logger')(_0x0825('0x7'));var safeTemplate=require('./safe-template')[_0x0825('0x8')];exports[_0x0825('0x9')]=function(_0x25c12d){_0x25c12d['use'](ewinston[_0x0825('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4da840,_0x2e93f9){var _0x1b6415=_0x0825('0xb');if(!_[_0x0825('0xc')](_0x4da840[_0x0825('0xd')])){_0x1b6415+='\x20body=%s';var _0x1e627d=_0x4da840['body'];maskSensitiveData(_0x1e627d);}return safeTemplate(util[_0x0825('0xe')](_0x1b6415,_0x4da840[_0x0825('0xf')],_0x4da840[_0x0825('0x10')][_0x0825('0x11')]?_0x4da840[_0x0825('0x10')][_0x0825('0x11')]:_0x4da840['connection'][_0x0825('0x12')]||_0x4da840['ip'],_0x4da840[_0x0825('0x13')],_0x2e93f9[_0x0825('0x14')],_0x2e93f9[_0x0825('0x15')],_0x4da840[_0x0825('0x16')]?_0x4da840[_0x0825('0x16')]['id']:null,_0x4da840[_0x0825('0x16')]?_0x4da840['user']['name']:null,_0x4da840['user']?_0x4da840[_0x0825('0x16')]['role']:null,_0x1e627d?util[_0x0825('0x17')](_0x1e627d,![],null):''));}}));_0x25c12d[_0x0825('0x18')](ewinston[_0x0825('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x431558,_0x1b7243){var _0x5bdbb7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x431558[_0x0825('0xd')]&&_0x431558['body']['device']&&_0x431558[_0x0825('0xd')][_0x0825('0x19')]){_0x5bdbb7=_0x0825('0x1a');}return util[_0x0825('0xe')](_0x5bdbb7,_0x431558[_0x0825('0xf')],_0x431558[_0x0825('0x10')][_0x0825('0x11')]?_0x431558[_0x0825('0x10')][_0x0825('0x11')]:_0x431558['connection'][_0x0825('0x12')]||_0x431558['ip'],_0x431558[_0x0825('0x13')],_0x1b7243[_0x0825('0x14')],_0x1b7243[_0x0825('0x15')],_0x431558['user']?_0x431558[_0x0825('0x16')]['id']:null,_0x431558[_0x0825('0x16')]?_0x431558['user'][_0x0825('0x1b')]:null,_0x431558[_0x0825('0x16')]?_0x431558[_0x0825('0x16')][_0x0825('0x1c')]:null,_0x431558[_0x0825('0xd')]&&_0x431558['body']['device']?_0x431558['body'][_0x0825('0x1d')]:_0x0825('0x1e'),_0x431558[_0x0825('0xd')]&&_0x431558[_0x0825('0xd')][_0x0825('0x19')]?_0x431558[_0x0825('0xd')][_0x0825('0x19')]:'',_0x431558['body']&&_0x431558[_0x0825('0xd')]['agent_name']?_0x431558['body'][_0x0825('0x1f')]:'');},'ignoreRoute':function(_0xaaee1a){var _0x4ec632=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4ec632['test'](_0xaaee1a['url']);}}));_0x25c12d['use']('/api/users',require(_0x0825('0x20')));_0x25c12d[_0x0825('0x18')]('/api/voice/chanspy',require(_0x0825('0x21')));_0x25c12d[_0x0825('0x18')](_0x0825('0x22'),require(_0x0825('0x23')));_0x25c12d[_0x0825('0x18')](_0x0825('0x24'),require('./api/voiceExtension'));_0x25c12d[_0x0825('0x18')](_0x0825('0x25'),require('./api/voiceMusicOnHold'));_0x25c12d[_0x0825('0x18')](_0x0825('0x26'),require(_0x0825('0x27')));_0x25c12d['use'](_0x0825('0x28'),require('./api/voiceRecording'));_0x25c12d[_0x0825('0x18')](_0x0825('0x29'),require(_0x0825('0x2a')));_0x25c12d[_0x0825('0x18')](_0x0825('0x2b'),require(_0x0825('0x2c')));_0x25c12d[_0x0825('0x18')](_0x0825('0x2d'),require(_0x0825('0x2e')));_0x25c12d[_0x0825('0x18')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x25c12d[_0x0825('0x18')](_0x0825('0x2f'),require(_0x0825('0x30')));_0x25c12d[_0x0825('0x18')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x25c12d[_0x0825('0x18')](_0x0825('0x31'),require(_0x0825('0x32')));_0x25c12d['use']('/api/members/reports',require(_0x0825('0x33')));_0x25c12d[_0x0825('0x18')]('/api/trunks',require(_0x0825('0x34')));_0x25c12d['use'](_0x0825('0x35'),require(_0x0825('0x36')));_0x25c12d[_0x0825('0x18')](_0x0825('0x37'),require(_0x0825('0x38')));_0x25c12d[_0x0825('0x18')]('/api/mail/accounts',require(_0x0825('0x39')));_0x25c12d[_0x0825('0x18')](_0x0825('0x3a'),require(_0x0825('0x3b')));_0x25c12d[_0x0825('0x18')](_0x0825('0x3c'),require('./api/mailSubstatus'));_0x25c12d['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x25c12d[_0x0825('0x18')](_0x0825('0x3d'),require(_0x0825('0x3e')));_0x25c12d[_0x0825('0x18')](_0x0825('0x3f'),require(_0x0825('0x40')));_0x25c12d['use'](_0x0825('0x41'),require(_0x0825('0x42')));_0x25c12d['use'](_0x0825('0x43'),require(_0x0825('0x44')));_0x25c12d[_0x0825('0x18')]('/api/dashboards/items',require(_0x0825('0x45')));_0x25c12d[_0x0825('0x18')]('/api/fax/accounts',require(_0x0825('0x46')));_0x25c12d[_0x0825('0x18')](_0x0825('0x47'),require(_0x0825('0x48')));_0x25c12d['use'](_0x0825('0x49'),require('./api/faxInteraction'));_0x25c12d['use'](_0x0825('0x4a'),require(_0x0825('0x4b')));_0x25c12d[_0x0825('0x18')](_0x0825('0x4c'),require('./api/faxQueue'));_0x25c12d[_0x0825('0x18')](_0x0825('0x4d'),require(_0x0825('0x4e')));_0x25c12d[_0x0825('0x18')](_0x0825('0x4f'),require(_0x0825('0x50')));_0x25c12d[_0x0825('0x18')](_0x0825('0x51'),require(_0x0825('0x52')));_0x25c12d[_0x0825('0x18')]('/api/sms/interactions',require('./api/smsInteraction'));_0x25c12d['use']('/api/sms/messages',require(_0x0825('0x53')));_0x25c12d['use'](_0x0825('0x54'),require(_0x0825('0x55')));_0x25c12d[_0x0825('0x18')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x25c12d[_0x0825('0x18')](_0x0825('0x56'),require(_0x0825('0x57')));_0x25c12d[_0x0825('0x18')](_0x0825('0x58'),require(_0x0825('0x59')));_0x25c12d[_0x0825('0x18')](_0x0825('0x5a'),require(_0x0825('0x5b')));_0x25c12d[_0x0825('0x18')]('/api/openchannel/queues',require(_0x0825('0x5c')));_0x25c12d[_0x0825('0x18')](_0x0825('0x5d'),require(_0x0825('0x5e')));_0x25c12d['use'](_0x0825('0x5f'),require(_0x0825('0x60')));_0x25c12d[_0x0825('0x18')]('/api/chat/applications',require(_0x0825('0x61')));_0x25c12d[_0x0825('0x18')](_0x0825('0x62'),require(_0x0825('0x63')));_0x25c12d[_0x0825('0x18')](_0x0825('0x64'),require(_0x0825('0x65')));_0x25c12d['use']('/api/chat/offline_messages',require(_0x0825('0x66')));_0x25c12d[_0x0825('0x18')]('/api/chat/queues',require(_0x0825('0x67')));_0x25c12d[_0x0825('0x18')](_0x0825('0x68'),require(_0x0825('0x69')));_0x25c12d[_0x0825('0x18')](_0x0825('0x6a'),require('./api/chatProactiveAction'));_0x25c12d['use'](_0x0825('0x6b'),require(_0x0825('0x6c')));_0x25c12d[_0x0825('0x18')](_0x0825('0x6d'),require(_0x0825('0x6e')));_0x25c12d[_0x0825('0x18')]('/api/cm/hopper',require(_0x0825('0x6f')));_0x25c12d[_0x0825('0x18')](_0x0825('0x70'),require('./api/cmHopperBlack'));_0x25c12d['use']('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x25c12d[_0x0825('0x18')](_0x0825('0x71'),require('./api/cmHopperHistory'));_0x25c12d[_0x0825('0x18')](_0x0825('0x72'),require(_0x0825('0x73')));_0x25c12d['use'](_0x0825('0x74'),require(_0x0825('0x75')));_0x25c12d['use'](_0x0825('0x76'),require(_0x0825('0x77')));_0x25c12d[_0x0825('0x18')]('/api/canned_answers',require('./api/cannedAnswer'));_0x25c12d[_0x0825('0x18')](_0x0825('0x78'),require(_0x0825('0x79')));_0x25c12d[_0x0825('0x18')]('/api/conditions',require(_0x0825('0x7a')));_0x25c12d['use'](_0x0825('0x7b'),require('./api/interval'));_0x25c12d['use'](_0x0825('0x7c'),require(_0x0825('0x7d')));_0x25c12d['use']('/api/cdr',require(_0x0825('0x7e')));_0x25c12d[_0x0825('0x18')](_0x0825('0x7f'),require(_0x0825('0x80')));_0x25c12d[_0x0825('0x18')](_0x0825('0x81'),require(_0x0825('0x82')));_0x25c12d['use']('/api/sounds',require('./api/sound'));_0x25c12d[_0x0825('0x18')](_0x0825('0x83'),require(_0x0825('0x84')));_0x25c12d[_0x0825('0x18')](_0x0825('0x85'),require('./api/template'));_0x25c12d[_0x0825('0x18')]('/api/triggers',require(_0x0825('0x86')));_0x25c12d[_0x0825('0x18')](_0x0825('0x87'),require('./api/variable'));_0x25c12d['use'](_0x0825('0x88'),require('./api/integration'));_0x25c12d[_0x0825('0x18')](_0x0825('0x89'),require(_0x0825('0x8a')));_0x25c12d[_0x0825('0x18')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x25c12d['use'](_0x0825('0x8b'),require(_0x0825('0x8c')));_0x25c12d[_0x0825('0x18')]('/api/analytics/extracted_reports',require(_0x0825('0x8d')));_0x25c12d[_0x0825('0x18')]('/api/analytics/metrics',require(_0x0825('0x8e')));_0x25c12d['use']('/api/analytics/field_reports',require(_0x0825('0x8f')));_0x25c12d['use'](_0x0825('0x90'),require(_0x0825('0x91')));_0x25c12d[_0x0825('0x18')](_0x0825('0x92'),require(_0x0825('0x93')));_0x25c12d['use'](_0x0825('0x94'),require(_0x0825('0x95')));_0x25c12d[_0x0825('0x18')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x25c12d[_0x0825('0x18')](_0x0825('0x96'),require(_0x0825('0x97')));_0x25c12d[_0x0825('0x18')]('/api/integrations/sugarcrm/configurations',require(_0x0825('0x98')));_0x25c12d[_0x0825('0x18')](_0x0825('0x99'),require('./api/intSugarcrmField'));_0x25c12d[_0x0825('0x18')]('/api/integrations/desk/accounts',require(_0x0825('0x9a')));_0x25c12d[_0x0825('0x18')](_0x0825('0x9b'),require(_0x0825('0x9c')));_0x25c12d[_0x0825('0x18')](_0x0825('0x9d'),require(_0x0825('0x9e')));_0x25c12d[_0x0825('0x18')]('/api/integrations/zoho/accounts',require(_0x0825('0x9f')));_0x25c12d['use'](_0x0825('0xa0'),require(_0x0825('0xa1')));_0x25c12d[_0x0825('0x18')]('/api/integrations/zoho/fields',require(_0x0825('0xa2')));_0x25c12d[_0x0825('0x18')](_0x0825('0xa3'),require(_0x0825('0xa4')));_0x25c12d[_0x0825('0x18')](_0x0825('0xa5'),require(_0x0825('0xa6')));_0x25c12d['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x25c12d[_0x0825('0x18')](_0x0825('0xa7'),require(_0x0825('0xa8')));_0x25c12d[_0x0825('0x18')](_0x0825('0xa9'),require(_0x0825('0xaa')));_0x25c12d[_0x0825('0x18')](_0x0825('0xab'),require(_0x0825('0xac')));_0x25c12d['use']('/api/integrations/vtiger/accounts',require(_0x0825('0xad')));_0x25c12d[_0x0825('0x18')](_0x0825('0xae'),require(_0x0825('0xaf')));_0x25c12d[_0x0825('0x18')](_0x0825('0xb0'),require(_0x0825('0xb1')));_0x25c12d[_0x0825('0x18')]('/api/integrations/servicenow/accounts',require(_0x0825('0xb2')));_0x25c12d[_0x0825('0x18')](_0x0825('0xb3'),require(_0x0825('0xb4')));_0x25c12d[_0x0825('0x18')](_0x0825('0xb5'),require(_0x0825('0xb6')));_0x25c12d[_0x0825('0x18')](_0x0825('0xb7'),require('./api/intDynamics365Account'));_0x25c12d[_0x0825('0x18')](_0x0825('0xb8'),require(_0x0825('0xb9')));_0x25c12d[_0x0825('0x18')](_0x0825('0xba'),require(_0x0825('0xbb')));_0x25c12d['use']('/api/integrations/freshsales/accounts',require(_0x0825('0xbc')));_0x25c12d['use']('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x25c12d[_0x0825('0x18')](_0x0825('0xbd'),require(_0x0825('0xbe')));_0x25c12d[_0x0825('0x18')](_0x0825('0xbf'),require(_0x0825('0xc0')));_0x25c12d[_0x0825('0x18')](_0x0825('0xc1'),require('./api/chatQueueReport'));_0x25c12d[_0x0825('0x18')](_0x0825('0xc2'),require(_0x0825('0xc3')));_0x25c12d[_0x0825('0x18')](_0x0825('0xc4'),require(_0x0825('0xc5')));_0x25c12d['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x25c12d['use'](_0x0825('0xc6'),require(_0x0825('0xc7')));_0x25c12d[_0x0825('0x18')](_0x0825('0xc8'),require('./api/smsQueueReport'));_0x25c12d[_0x0825('0x18')](_0x0825('0xc9'),require('./api/squareReport'));_0x25c12d[_0x0825('0x18')](_0x0825('0xca'),require(_0x0825('0xcb')));_0x25c12d[_0x0825('0x18')](_0x0825('0xcc'),require(_0x0825('0xcd')));_0x25c12d[_0x0825('0x18')](_0x0825('0xce'),require(_0x0825('0xcf')));_0x25c12d[_0x0825('0x18')]('/api/square/odbc',require(_0x0825('0xd0')));_0x25c12d['use']('/api/square/projects',require(_0x0825('0xd1')));_0x25c12d[_0x0825('0x18')](_0x0825('0xd2'),require('./api/squareRecording'));_0x25c12d[_0x0825('0x18')]('/api/square/messages',require('./api/squareMessage'));_0x25c12d[_0x0825('0x18')](_0x0825('0xd3'),require(_0x0825('0xd4')));_0x25c12d['use'](_0x0825('0xd5'),require(_0x0825('0xd6')));_0x25c12d['use'](_0x0825('0xd7'),require('./api/campaign'));_0x25c12d[_0x0825('0x18')]('/api/migrations',require(_0x0825('0xd8')));_0x25c12d['use'](_0x0825('0xd9'),require('./api/attachment'));_0x25c12d[_0x0825('0x18')](_0x0825('0xda'),require(_0x0825('0xdb')));_0x25c12d['use'](_0x0825('0xdc'),require(_0x0825('0xdd')));_0x25c12d[_0x0825('0x18')]('/api/chat/reports/transfer',require(_0x0825('0xde')));_0x25c12d[_0x0825('0x18')](_0x0825('0xdf'),require(_0x0825('0xe0')));_0x25c12d[_0x0825('0x18')](_0x0825('0xe1'),require('./api/openchannelTransferReport'));_0x25c12d[_0x0825('0x18')](_0x0825('0xe2'),require(_0x0825('0xe3')));_0x25c12d[_0x0825('0x18')]('/api/cm/lists',require(_0x0825('0xe4')));_0x25c12d['use'](_0x0825('0xe5'),require('./api/voicePrefix'));_0x25c12d[_0x0825('0x18')](_0x0825('0xe6'),require(_0x0825('0xe7')));_0x25c12d[_0x0825('0x18')](_0x0825('0xe8'),require(_0x0825('0xe9')));_0x25c12d[_0x0825('0x18')]('/api/userProfile/resources',require(_0x0825('0xea')));_0x25c12d['use'](_0x0825('0xeb'),require(_0x0825('0xec')));_0x25c12d[_0x0825('0x18')](_0x0825('0xed'),require('./api/whatsappAccount'));_0x25c12d[_0x0825('0x18')](_0x0825('0xee'),require('./api/whatsappApplication'));_0x25c12d[_0x0825('0x18')](_0x0825('0xef'),require('./api/whatsappInteraction'));_0x25c12d['use'](_0x0825('0xf0'),require('./api/whatsappMessage'));_0x25c12d[_0x0825('0x18')]('/api/whatsapp/reports/queue',require(_0x0825('0xf1')));_0x25c12d[_0x0825('0x18')](_0x0825('0xf2'),require(_0x0825('0xf3')));_0x25c12d[_0x0825('0x18')]('/api/whatsapp/queues',require(_0x0825('0xf4')));_0x25c12d[_0x0825('0x18')]('/api/cloudProviders',require(_0x0825('0xf5')));_0x25c12d[_0x0825('0x18')](_0x0825('0xf6'),require(_0x0825('0xf7')));_0x25c12d[_0x0825('0x18')]('/api/auth/local',require(_0x0825('0xf8')));_0x25c12d[_0x0825('0x18')](_0x0825('0xf9'),require('./api/authGoogle'));_0x25c12d['use'](_0x0825('0xfa'),require(_0x0825('0xfb')));_0x25c12d[_0x0825('0x18')](_0x0825('0xfc'),require('./api/rpc'));_0x25c12d[_0x0825('0x18')](_0x0825('0xfd'),require(_0x0825('0xfe')));_0x25c12d[_0x0825('0x18')]('/api/system',require(_0x0825('0xff')));_0x25c12d['use'](_0x0825('0x100'),require(_0x0825('0x101')));_0x25c12d[_0x0825('0x18')](_0x0825('0x102'),require(_0x0825('0x103')));_0x25c12d['use']('/apidoc',express[_0x0825('0x104')](path[_0x0825('0x105')](config[_0x0825('0x106')],_0x0825('0x107'))));_0x25c12d[_0x0825('0x18')]('/www',express[_0x0825('0x104')](path[_0x0825('0x105')](config[_0x0825('0x106')],_0x0825('0x108'))));_0x25c12d[_0x0825('0x18')](_0x0825('0x109'),express[_0x0825('0x104')](path['join'](config[_0x0825('0x106')],_0x0825('0x109'))));_0x25c12d[_0x0825('0x18')](_0x0825('0x10a'),express[_0x0825('0x104')](path['join'](config[_0x0825('0x106')],_0x0825('0x10b'),_0x0825('0x10c'))));_0x25c12d[_0x0825('0x18')](_0x0825('0x10d'),express[_0x0825('0x104')](path['join'](config[_0x0825('0x106')],_0x0825('0x10e'))));_0x25c12d['route'](_0x0825('0x10f'))[_0x0825('0x110')](errors[0x194]);_0x25c12d[_0x0825('0x111')]('/*')[_0x0825('0x110')](function(_0x4d0aaa,_0x2f933c){_0x2f933c[_0x0825('0x112')](path[_0x0825('0x113')](_0x25c12d[_0x0825('0x110')](_0x0825('0x114'))+_0x0825('0x115')));});};var sensitiveFields=[_0x0825('0x116'),_0x0825('0x117'),_0x0825('0x118'),_0x0825('0x119'),'firstName',_0x0825('0x11a'),_0x0825('0x11b'),'phone',_0x0825('0x11c'),_0x0825('0x11d'),_0x0825('0x11e'),_0x0825('0x11f'),_0x0825('0x120'),_0x0825('0x121'),'code',_0x0825('0x122'),'tenantId',_0x0825('0x123'),_0x0825('0x124'),_0x0825('0x125'),_0x0825('0x126'),_0x0825('0x127'),_0x0825('0x128'),_0x0825('0x129'),_0x0825('0x12a'),_0x0825('0x12b'),_0x0825('0x12c'),'exten',_0x0825('0x12d'),_0x0825('0x12e'),_0x0825('0x12f'),_0x0825('0x130'),'secretaccesskey','key','user','pass',_0x0825('0x131'),_0x0825('0x132'),'dsn',_0x0825('0x133'),'registry',_0x0825('0x134')];function maskSensitiveData(_0xefdc61){var _0x5a14bb=/(?!^)[\s\S](?!$)/g;if(!_[_0x0825('0x135')](_0xefdc61))return;for(var _0x1108ef in _0xefdc61){if(_[_0x0825('0x136')](_0xefdc61[_0x1108ef])){for(var _0x4c528a=0x0;_0x4c528a<_0xefdc61[_0x1108ef][_0x0825('0x137')];_0x4c528a++){maskSensitiveData(_0xefdc61[_0x1108ef][_0x4c528a]);}}else if(_[_0x0825('0x135')](_0xefdc61[_0x1108ef])){maskSensitiveData(_0xefdc61[_0x1108ef]);}else if(_[_0x0825('0x138')](_0xefdc61[_0x1108ef])){_0xefdc61[_0x1108ef]=_0xefdc61[_0x1108ef][_0x0825('0x139')](/{{{/g,'@@{')[_0x0825('0x139')](/}}}/g,'}@@')[_0x0825('0x139')](/{{/g,'@{')[_0x0825('0x139')](/}}/g,'}@');if(_[_0x0825('0x13a')](sensitiveFields,_0x1108ef)){_0xefdc61[_0x1108ef]=_0xefdc61[_0x1108ef][_0x0825('0x139')](_0x5a14bb,'*');}}}} \ No newline at end of file +var _0x0298=['./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/apidoc','static','/www','join','root','/demo','/snippet','snippet','3.0.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','resolve','username','password','apiKey','lastName','street','phone','mobile','fax','clientId','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','pass','localstationid','dsn','isPlainObject','isString','replace','@@{','}@@','includes','lodash','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','safeTemplate','default','use','logger','body','\x20body=%s','method','headers','connection','remoteAddress','url','statusCode','responseTime','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','x-forwarded-for','role','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_history','./api/cmHopperHistory','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts'];(function(_0x9a774b,_0x37f1c1){var _0x4ede1b=function(_0xd24195){while(--_0xd24195){_0x9a774b['push'](_0x9a774b['shift']());}};_0x4ede1b(++_0x37f1c1);}(_0x0298,0x95));var _0x8029=function(_0x3d0ab3,_0x2e1926){_0x3d0ab3=_0x3d0ab3-0x0;var _0x17fd2c=_0x0298[_0x3d0ab3];return _0x17fd2c;};'use strict';var _=require(_0x8029('0x0'));var path=require('path');var express=require(_0x8029('0x1'));var ewinston=require(_0x8029('0x2'));var util=require(_0x8029('0x3'));var errors=require(_0x8029('0x4'));var config=require(_0x8029('0x5'));var logger=require(_0x8029('0x6'))(_0x8029('0x7'));var authLogger=require(_0x8029('0x6'))(_0x8029('0x8'));var safeTemplate=require('./safe-template')[_0x8029('0x9')];exports[_0x8029('0xa')]=function(_0x49e3e4){_0x49e3e4[_0x8029('0xb')](ewinston[_0x8029('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1b3573,_0xe53462){var _0x1ac957='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x1b3573[_0x8029('0xd')])){_0x1ac957+=_0x8029('0xe');var _0x288b07=_0x1b3573['body'];maskSensitiveData(_0x288b07);}return safeTemplate(util['format'](_0x1ac957,_0x1b3573[_0x8029('0xf')],_0x1b3573[_0x8029('0x10')]['x-forwarded-for']?_0x1b3573[_0x8029('0x10')]['x-forwarded-for']:_0x1b3573[_0x8029('0x11')][_0x8029('0x12')]||_0x1b3573['ip'],_0x1b3573[_0x8029('0x13')],_0xe53462[_0x8029('0x14')],_0xe53462[_0x8029('0x15')],_0x1b3573[_0x8029('0x16')]?_0x1b3573['user']['id']:null,_0x1b3573[_0x8029('0x16')]?_0x1b3573[_0x8029('0x16')][_0x8029('0x17')]:null,_0x1b3573[_0x8029('0x16')]?_0x1b3573['user']['role']:null,_0x288b07?util['inspect'](_0x288b07,![],null):''));}}));_0x49e3e4[_0x8029('0xb')](ewinston[_0x8029('0xc')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x6615a5,_0x1cef49){var _0x14ad14=_0x8029('0x18');if(_0x6615a5['body']&&_0x6615a5[_0x8029('0xd')][_0x8029('0x19')]&&_0x6615a5[_0x8029('0xd')][_0x8029('0x1a')]){_0x14ad14='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x8029('0x1b')](_0x14ad14,_0x6615a5[_0x8029('0xf')],_0x6615a5['headers'][_0x8029('0x1c')]?_0x6615a5['headers'][_0x8029('0x1c')]:_0x6615a5[_0x8029('0x11')][_0x8029('0x12')]||_0x6615a5['ip'],_0x6615a5[_0x8029('0x13')],_0x1cef49['statusCode'],_0x1cef49[_0x8029('0x15')],_0x6615a5[_0x8029('0x16')]?_0x6615a5['user']['id']:null,_0x6615a5['user']?_0x6615a5[_0x8029('0x16')][_0x8029('0x17')]:null,_0x6615a5[_0x8029('0x16')]?_0x6615a5[_0x8029('0x16')][_0x8029('0x1d')]:null,_0x6615a5[_0x8029('0xd')]&&_0x6615a5[_0x8029('0xd')][_0x8029('0x19')]?_0x6615a5[_0x8029('0xd')][_0x8029('0x19')]:_0x8029('0x1e'),_0x6615a5[_0x8029('0xd')]&&_0x6615a5[_0x8029('0xd')][_0x8029('0x1a')]?_0x6615a5[_0x8029('0xd')][_0x8029('0x1a')]:'',_0x6615a5[_0x8029('0xd')]&&_0x6615a5[_0x8029('0xd')][_0x8029('0x1f')]?_0x6615a5[_0x8029('0xd')]['agent_name']:'');},'ignoreRoute':function(_0x3525ed){var _0x479a21=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x479a21[_0x8029('0x20')](_0x3525ed[_0x8029('0x13')]);}}));_0x49e3e4[_0x8029('0xb')](_0x8029('0x21'),require(_0x8029('0x22')));_0x49e3e4['use'](_0x8029('0x23'),require(_0x8029('0x24')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x25'),require(_0x8029('0x26')));_0x49e3e4['use'](_0x8029('0x27'),require(_0x8029('0x28')));_0x49e3e4['use'](_0x8029('0x29'),require('./api/voiceMusicOnHold'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x2a'),require(_0x8029('0x2b')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x2c'),require(_0x8029('0x2d')));_0x49e3e4['use'](_0x8029('0x2e'),require(_0x8029('0x2f')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x30'),require('./api/voiceMail'));_0x49e3e4['use']('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x31'),require(_0x8029('0x32')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x33'),require(_0x8029('0x34')));_0x49e3e4['use'](_0x8029('0x35'),require(_0x8029('0x36')));_0x49e3e4[_0x8029('0xb')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x37'),require('./api/memberReport'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x38'),require(_0x8029('0x39')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x3a'),require(_0x8029('0x3b')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x3c'),require(_0x8029('0x3d')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x3e'),require('./api/mailAccount'));_0x49e3e4['use'](_0x8029('0x3f'),require(_0x8029('0x40')));_0x49e3e4[_0x8029('0xb')]('/api/mail/substatuses',require(_0x8029('0x41')));_0x49e3e4[_0x8029('0xb')]('/api/mail/interactions',require(_0x8029('0x42')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x43'),require(_0x8029('0x44')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x45'),require(_0x8029('0x46')));_0x49e3e4['use']('/api/mail/reports/queue',require(_0x8029('0x47')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x48'),require(_0x8029('0x49')));_0x49e3e4['use'](_0x8029('0x4a'),require(_0x8029('0x4b')));_0x49e3e4['use'](_0x8029('0x4c'),require(_0x8029('0x4d')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x4e'),require(_0x8029('0x4f')));_0x49e3e4[_0x8029('0xb')]('/api/fax/interactions',require(_0x8029('0x50')));_0x49e3e4['use'](_0x8029('0x51'),require('./api/faxMessage'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x52'),require(_0x8029('0x53')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x54'),require(_0x8029('0x55')));_0x49e3e4[_0x8029('0xb')]('/api/sms/accounts',require(_0x8029('0x56')));_0x49e3e4['use'](_0x8029('0x57'),require(_0x8029('0x58')));_0x49e3e4['use'](_0x8029('0x59'),require('./api/smsInteraction'));_0x49e3e4[_0x8029('0xb')]('/api/sms/messages',require(_0x8029('0x5a')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x5b'),require(_0x8029('0x5c')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x5d'),require(_0x8029('0x5e')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x5f'),require(_0x8029('0x60')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x61'),require(_0x8029('0x62')));_0x49e3e4[_0x8029('0xb')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x63'),require(_0x8029('0x64')));_0x49e3e4['use'](_0x8029('0x65'),require(_0x8029('0x66')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x67'),require(_0x8029('0x68')));_0x49e3e4['use'](_0x8029('0x69'),require(_0x8029('0x6a')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x6b'),require(_0x8029('0x6c')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x6d'),require(_0x8029('0x6e')));_0x49e3e4['use'](_0x8029('0x6f'),require('./api/chatOfflineMessage'));_0x49e3e4[_0x8029('0xb')]('/api/chat/queues',require('./api/chatQueue'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x70'),require('./api/chatGroup'));_0x49e3e4['use'](_0x8029('0x71'),require(_0x8029('0x72')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x73'),require(_0x8029('0x74')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x75'),require('./api/cmContact'));_0x49e3e4['use'](_0x8029('0x76'),require('./api/cmHopper'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x77'),require('./api/cmHopperBlack'));_0x49e3e4['use']('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x49e3e4['use'](_0x8029('0x78'),require(_0x8029('0x79')));_0x49e3e4[_0x8029('0xb')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x49e3e4[_0x8029('0xb')]('/api/actions',require(_0x8029('0x7a')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x7b'),require(_0x8029('0x7c')));_0x49e3e4['use'](_0x8029('0x7d'),require('./api/cannedAnswer'));_0x49e3e4['use'](_0x8029('0x7e'),require(_0x8029('0x7f')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x80'),require(_0x8029('0x81')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x82'),require(_0x8029('0x83')));_0x49e3e4[_0x8029('0xb')]('/api/pauses',require(_0x8029('0x84')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x85'),require(_0x8029('0x86')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x87'),require(_0x8029('0x88')));_0x49e3e4[_0x8029('0xb')]('/api/schedules',require(_0x8029('0x89')));_0x49e3e4[_0x8029('0xb')]('/api/sounds',require(_0x8029('0x8a')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x8b'),require('./api/tag'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x8c'),require(_0x8029('0x8d')));_0x49e3e4['use'](_0x8029('0x8e'),require('./api/trigger'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x8f'),require(_0x8029('0x90')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x91'),require(_0x8029('0x92')));_0x49e3e4['use'](_0x8029('0x93'),require(_0x8029('0x94')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x95'),require(_0x8029('0x96')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x97'),require('./api/analyticDefaultReport'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x98'),require(_0x8029('0x99')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x9a'),require('./api/analyticMetric'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x9b'),require(_0x8029('0x9c')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x9d'),require(_0x8029('0x9e')));_0x49e3e4[_0x8029('0xb')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x49e3e4['use'](_0x8029('0x9f'),require(_0x8029('0xa0')));_0x49e3e4[_0x8029('0xb')]('/api/integrations/salesforce/fields',require(_0x8029('0xa1')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xa2'),require(_0x8029('0xa3')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xa4'),require(_0x8029('0xa5')));_0x49e3e4[_0x8029('0xb')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xa6'),require('./api/intDeskAccount'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xa7'),require(_0x8029('0xa8')));_0x49e3e4['use'](_0x8029('0xa9'),require('./api/intDeskField'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xaa'),require(_0x8029('0xab')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xac'),require(_0x8029('0xad')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xae'),require(_0x8029('0xaf')));_0x49e3e4['use'](_0x8029('0xb0'),require(_0x8029('0xb1')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xb2'),require(_0x8029('0xb3')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xb4'),require(_0x8029('0xb5')));_0x49e3e4['use'](_0x8029('0xb6'),require('./api/intFreshdeskAccount'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xb7'),require(_0x8029('0xb8')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xb9'),require(_0x8029('0xba')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xbb'),require('./api/intVtigerAccount'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xbc'),require(_0x8029('0xbd')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xbe'),require(_0x8029('0xbf')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xc0'),require(_0x8029('0xc1')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xc2'),require(_0x8029('0xc3')));_0x49e3e4[_0x8029('0xb')]('/api/integrations/servicenow/fields',require(_0x8029('0xc4')));_0x49e3e4['use']('/api/integrations/dynamics365/accounts',require(_0x8029('0xc5')));_0x49e3e4[_0x8029('0xb')]('/api/integrations/dynamics365/configurations',require(_0x8029('0xc6')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xc7'),require(_0x8029('0xc8')));_0x49e3e4[_0x8029('0xb')]('/api/integrations/freshsales/accounts',require(_0x8029('0xc9')));_0x49e3e4['use'](_0x8029('0xca'),require('./api/intFreshsalesConfiguration'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xcb'),require('./api/intFreshsalesField'));_0x49e3e4['use'](_0x8029('0xcc'),require('./api/network'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xcd'),require(_0x8029('0xce')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xcf'),require('./api/chatInternalMessage'));_0x49e3e4[_0x8029('0xb')]('/api/jscripty/answers/reports',require(_0x8029('0xd0')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xd1'),require('./api/jscriptyQuestionReport'));_0x49e3e4[_0x8029('0xb')]('/api/jscripty/sessions/reports',require(_0x8029('0xd2')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xd3'),require('./api/smsQueueReport'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xd4'),require(_0x8029('0xd5')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xd6'),require(_0x8029('0xd7')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xd8'),require(_0x8029('0xd9')));_0x49e3e4[_0x8029('0xb')]('/api/settings',require('./api/setting'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xda'),require('./api/squareOdbc'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xdb'),require(_0x8029('0xdc')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xdd'),require(_0x8029('0xde')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xdf'),require(_0x8029('0xe0')));_0x49e3e4[_0x8029('0xb')]('/api/teams',require(_0x8029('0xe1')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xe2'),require(_0x8029('0xe3')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xe4'),require(_0x8029('0xe5')));_0x49e3e4['use'](_0x8029('0xe6'),require(_0x8029('0xe7')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xe8'),require(_0x8029('0xe9')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xea'),require(_0x8029('0xeb')));_0x49e3e4['use'](_0x8029('0xec'),require(_0x8029('0xed')));_0x49e3e4['use'](_0x8029('0xee'),require(_0x8029('0xef')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xf0'),require('./api/faxTransferReport'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xf1'),require(_0x8029('0xf2')));_0x49e3e4['use'](_0x8029('0xf3'),require('./api/smsTransferReport'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xf4'),require(_0x8029('0xf5')));_0x49e3e4[_0x8029('0xb')](_0x8029('0xf6'),require(_0x8029('0xf7')));_0x49e3e4['use'](_0x8029('0xf8'),require('./api/userProfile'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xf9'),require(_0x8029('0xfa')));_0x49e3e4['use']('/api/userProfile/resources',require(_0x8029('0xfb')));_0x49e3e4['use'](_0x8029('0xfc'),require('./api/userNotification'));_0x49e3e4[_0x8029('0xb')](_0x8029('0xfd'),require(_0x8029('0xfe')));_0x49e3e4['use']('/api/whatsapp/applications',require(_0x8029('0xff')));_0x49e3e4[_0x8029('0xb')]('/api/whatsapp/interactions',require(_0x8029('0x100')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x101'),require(_0x8029('0x102')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x103'),require(_0x8029('0x104')));_0x49e3e4['use'](_0x8029('0x105'),require(_0x8029('0x106')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x107'),require(_0x8029('0x108')));_0x49e3e4['use'](_0x8029('0x109'),require(_0x8029('0x10a')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x10b'),require(_0x8029('0x10c')));_0x49e3e4['use']('/api/auth/local',require(_0x8029('0x10d')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x10e'),require(_0x8029('0x10f')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x110'),require(_0x8029('0x111')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x112'),require('./api/rpc'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x113'),require(_0x8029('0x114')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x115'),require(_0x8029('0x116')));_0x49e3e4['use'](_0x8029('0x117'),require('./api/pm2'));_0x49e3e4[_0x8029('0xb')]('/api/webbar',require('./api/webbar'));_0x49e3e4[_0x8029('0xb')](_0x8029('0x118'),express[_0x8029('0x119')](path['join'](config['root'],_0x8029('0x118'))));_0x49e3e4['use'](_0x8029('0x11a'),express['static'](path[_0x8029('0x11b')](config[_0x8029('0x11c')],_0x8029('0x11a'))));_0x49e3e4[_0x8029('0xb')](_0x8029('0x11d'),express[_0x8029('0x119')](path['join'](config[_0x8029('0x11c')],'/demo')));_0x49e3e4[_0x8029('0xb')](_0x8029('0x11e'),express[_0x8029('0x119')](path['join'](config[_0x8029('0x11c')],_0x8029('0x11f'),_0x8029('0x120'))));_0x49e3e4['use']('/plugins',express[_0x8029('0x119')](path[_0x8029('0x11b')](config['root'],_0x8029('0x121'))));_0x49e3e4['route'](_0x8029('0x122'))[_0x8029('0x123')](errors[0x194]);_0x49e3e4[_0x8029('0x124')]('/*')[_0x8029('0x123')](function(_0x556bb7,_0x2334b9){_0x2334b9['sendFile'](path[_0x8029('0x125')](_0x49e3e4[_0x8029('0x123')]('appPath')+'/index.html'));});};var sensitiveFields=[_0x8029('0x126'),_0x8029('0x127'),'newPassword',_0x8029('0x128'),'firstName',_0x8029('0x129'),_0x8029('0x12a'),_0x8029('0x12b'),_0x8029('0x12c'),_0x8029('0x12d'),'email',_0x8029('0x12e'),'clientSecret','securityToken',_0x8029('0x12f'),'accessKey',_0x8029('0x130'),_0x8029('0x131'),_0x8029('0x132'),_0x8029('0x133'),_0x8029('0x134'),'authToken','consumerKey','consumerSecret',_0x8029('0x135'),_0x8029('0x136'),_0x8029('0x137'),_0x8029('0x138'),_0x8029('0x139'),_0x8029('0x13a'),_0x8029('0x13b'),_0x8029('0x13c'),'secretaccesskey','key',_0x8029('0x16'),_0x8029('0x13d'),'accountSid',_0x8029('0x13e'),_0x8029('0x13f'),'secret','registry','oldPassword'];function maskSensitiveData(_0x2c52d2){var _0x4091dd=/(?!^)[\s\S](?!$)/g;if(!_[_0x8029('0x140')](_0x2c52d2))return;for(var _0x428f8e in _0x2c52d2){if(_['isArray'](_0x2c52d2[_0x428f8e])){for(var _0x1257b9=0x0;_0x1257b9<_0x2c52d2[_0x428f8e]['length'];_0x1257b9++){maskSensitiveData(_0x2c52d2[_0x428f8e][_0x1257b9]);}}else if(_[_0x8029('0x140')](_0x2c52d2[_0x428f8e])){maskSensitiveData(_0x2c52d2[_0x428f8e]);}else if(_[_0x8029('0x141')](_0x2c52d2[_0x428f8e])){_0x2c52d2[_0x428f8e]=_0x2c52d2[_0x428f8e][_0x8029('0x142')](/{{{/g,_0x8029('0x143'))[_0x8029('0x142')](/}}}/g,_0x8029('0x144'))[_0x8029('0x142')](/{{/g,'@{')[_0x8029('0x142')](/}}/g,'}@');if(_[_0x8029('0x145')](sensitiveFields,_0x428f8e)){_0x2c52d2[_0x428f8e]=_0x2c52d2[_0x428f8e]['replace'](_0x4091dd,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index ad28d03..2ab6528 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d79=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.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','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.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/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x5d79,0xff));var _0x95d7=function(_0x2ec6a8,_0x753f48){_0x2ec6a8=_0x2ec6a8-0x0;var _0x4011c2=_0x5d79[_0x2ec6a8];return _0x4011c2;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x95d7('0x0'));var _=require('lodash');var config=require(_0x95d7('0x1'));exports[_0x95d7('0x2')]=function(){return new BPromise(function(_0x12e246,_0x113e7c){var _0x1692a7={};_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x4')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x5')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x6')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x7')));_0x1692a7=_['merge'](_0x1692a7,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x8')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x9')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0xa')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0xb')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0xc')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0xd')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0xe')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0xf')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/mailAccount/mailAccount.rpc'));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x10')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x11')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x12')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x13')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x14')));_0x1692a7=_['merge'](_0x1692a7,require('../api/faxAccount/faxAccount.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/faxApplication/faxApplication.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x15')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x16')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/faxQueue/faxQueue.rpc'));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x17')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x18')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x19')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x1a')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/smsQueue/smsQueue.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x1b')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x1c')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x1d')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x1e')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x1f')));_0x1692a7=_['merge'](_0x1692a7,require('../api/chatMessage/chatMessage.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/chatQueue/chatQueue.rpc'));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x20')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/cmHopper/cmHopper.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x21')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x22')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x23')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x24')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x25')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x26')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x27')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x28')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x29')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x2a')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x2b')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x2c')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x2d')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x2e')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x2f')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x30')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x31')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x32')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x33')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x34')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x35')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/squareReport/squareReport.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x36')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x37')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x38')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x39')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x3a')));_0x1692a7=_['merge'](_0x1692a7,require('../api/squareMessage/squareMessage.rpc'));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x3b')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x3c')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x3d')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x3e')));_0x1692a7=_['merge'](_0x1692a7,require(_0x95d7('0x3f')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x40')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require(_0x95d7('0x41')));_0x1692a7=_[_0x95d7('0x3')](_0x1692a7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3d6194=jayson[_0x95d7('0x42')](_0x1692a7)[_0x95d7('0x43')]();var _0x39ba9d=config['rpc'][_0x95d7('0x44')]||config[_0x95d7('0x44')]+0x1;var _0x449709=config[_0x95d7('0x45')]['ip']||_0x95d7('0x46');_0x3d6194['on'](_0x95d7('0x47'),function(_0x189824){return _0x113e7c(_0x189824);});_0x3d6194[_0x95d7('0x2')](_0x39ba9d,_0x449709,function(){console[_0x95d7('0x48')](_0x95d7('0x49'),_0x449709,_0x39ba9d);require('../config/triggers')[_0x95d7('0x4a')]();return _0x12e246(_0x95d7('0x4b')+_0x449709+':'+_0x39ba9d);});});}; \ No newline at end of file +var _0x0fd4=['../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','default','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x0fd4,0x1dd));var _0x40fd=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x0fd4[_0x455c6c];return _0x488242;};'use strict';var jayson=require(_0x40fd('0x0'));var BPromise=require(_0x40fd('0x1'));var _=require(_0x40fd('0x2'));var config=require(_0x40fd('0x3'));exports[_0x40fd('0x4')]=function(){return new BPromise(function(_0x582eb7,_0x30181b){var _0x36d85d={};_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x6')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/voiceExtension/voiceExtension.rpc'));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x7')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/voiceRecording/voiceRecording.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x8')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x9')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0xa')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0xb')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0xc')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0xd')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0xe')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0xf')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x10')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x11')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x12')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x13')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x14')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x15')));_0x36d85d=_['merge'](_0x36d85d,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x16')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x17')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x18')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x19')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x1a')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x1b')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/smsAccount/smsAccount.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x1c')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x1d')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x1e')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x1f')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x36d85d=_['merge'](_0x36d85d,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x20')));_0x36d85d=_['merge'](_0x36d85d,require('../api/chatMessage/chatMessage.rpc'));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x21')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x22')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x23')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x24')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x25')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x26')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/pause/pause.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x27')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/template/template.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x28')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x29')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x2a')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x2b')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x2c')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x2d')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x2e')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x2f')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x30')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x31')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x32')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x33')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x34')));_0x36d85d=_['merge'](_0x36d85d,require(_0x40fd('0x35')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x36')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x37')));_0x36d85d=_['merge'](_0x36d85d,require('../api/squareOdbc/squareOdbc.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x38')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x39')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x3a')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x3b')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require('../api/attachment/attachment.rpc'));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x3c')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x3d')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x3e')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x3f')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x40')));_0x36d85d=_[_0x40fd('0x5')](_0x36d85d,require(_0x40fd('0x41')));var _0x1d1f52=jayson[_0x40fd('0x42')](_0x36d85d)['http']();var _0x1b306e=config[_0x40fd('0x43')][_0x40fd('0x44')]||config['port']+0x1;var _0x30dc21=config[_0x40fd('0x43')]['ip']||_0x40fd('0x45');_0x1d1f52['on'](_0x40fd('0x46'),function(_0x36232c){return _0x30181b(_0x36232c);});_0x1d1f52[_0x40fd('0x4')](_0x1b306e,_0x30dc21,function(){console[_0x40fd('0x47')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x30dc21,_0x1b306e);require('../config/triggers')[_0x40fd('0x48')]();return _0x582eb7('RPC\x20listening\x20on\x20'+_0x30dc21+':'+_0x1b306e);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 2963baa..e843828 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['\x20}\x20}','string','replace','map','isPlainObject','keys','exports','safeTemplate'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x61c60c){return _0x61c60c==='{{'?'{\x20{\x20':_0x65f6('0x0');}function safeTemplate(_0x2f06ae){var _0x3461cd=_0x2f06ae;if(typeof _0x2f06ae===_0x65f6('0x1')){_0x3461cd=_0x2f06ae[_0x65f6('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x2f06ae)){_0x3461cd=_0x2f06ae[_0x65f6('0x3')](function(_0x5150c8){return safeTemplate(_0x5150c8);});}else if(_[_0x65f6('0x4')](_0x2f06ae)){_0x3461cd=Object[_0x65f6('0x5')](_0x2f06ae)['reduce'](function(_0x4ed98f,_0x1c0e12){_0x4ed98f[_0x1c0e12]=safeTemplate(_0x2f06ae[_0x1c0e12]);return _0x4ed98f;},{});}return _0x3461cd;}module[_0x65f6('0x6')][_0x65f6('0x7')]=safeTemplate; \ No newline at end of file +var _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2032,0xd9));var _0x2203=function(_0x561013,_0x162dfa){_0x561013=_0x561013-0x0;var _0x40d515=_0x2032[_0x561013];return _0x40d515;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c58f410..7a10356 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 _0xc22d=['util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','headers','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','split','length','match','error','emit','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sync','sendRequest','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc22d,0x172));var _0xdc22=function(_0x118ed4,_0x57c4a6){_0x118ed4=_0x118ed4-0x0;var _0x153302=_0xc22d[_0x118ed4];return _0x153302;};'use strict';var util=require(_0xdc22('0x0'));var _=require(_0xdc22('0x1'));var EventEmitter=require(_0xdc22('0x2'))[_0xdc22('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xdc22('0x4'));function AGIChannel(_0x4c7170){var _0x526335=this,_0x1a91f5=new AGIReply(),_0x44431e=![],_0x1d1f89={};EventEmitter[_0xdc22('0x5')](_0x526335);_0x4c7170['setEncoding']('utf8');_0x4c7170['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1a91f5[_0xdc22('0x6')](_0xdc22('0x7'));_0x1a91f5['on'](_0xdc22('0x8'),function(_0x5e590a){for(var _0x23e40c in _0x5e590a){_0x526335[_0x23e40c]=_0x5e590a[_0x23e40c];}_0x526335['emit'](_0xdc22('0x9'));});_0x1a91f5['on'](_0xdc22('0xa'),function(_0x37aa7f){if(_0x37aa7f[_0xdc22('0xb')]()==_0xdc22('0xc')){_0x526335['emit']('hangup');return;}if(_0x37aa7f[_0xdc22('0xd')](0x0,0xb)=='520-Invalid'){_0x44431e=!![];}if(_0x44431e){_0x1d1f89['rx']+=_0x37aa7f+'\x0a';if(_0x37aa7f[_0xdc22('0xe')](_0xdc22('0xf'))!=-0x1){_0x44431e=![];}}else{_0x1d1f89['rx']=_0x37aa7f;}if(_0x44431e){return;}if(typeof _0x1d1f89['cb']==_0xdc22('0x10')){var _0x11f556=_0x1d1f89['rx'][_0xdc22('0xd')](0x0,0x3),_0x320adf=null,_0x44b522=null;_0x11f556=parseInt(_0x11f556);if(isNaN(_0x11f556)){_0x1d1f89['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xdc22('0x11')});return;}if(_0x11f556!=0xc8){_0x1d1f89['cb'](null,{'code':_0x11f556,'result':-0x1,'extra':'KO'});return;}_0x320adf=_0x1d1f89['rx'][_0xdc22('0xd')](0x4)[_0xdc22('0x12')](_0xdc22('0x13'),'');if(_0x320adf[_0xdc22('0x14')]('\x20')!=-0x1){_0x320adf=_0x320adf[_0xdc22('0x15')](0x0,_0x320adf[_0xdc22('0x14')]('\x20'));}if(_['startsWith'](_0x320adf,'-1')){_0x320adf=parseInt(_0x320adf);}_0x44b522=_0x1d1f89['rx'][_0xdc22('0x16')]('\x20');if(_0x44b522[_0xdc22('0x17')]==0x3){_0x44b522=_0x44b522[0x2][_0xdc22('0xd')](0x1,_0x44b522[0x2][_0xdc22('0x17')]-0x1);}else if(_0x44b522[_0xdc22('0x17')]>0x3){var _0xf66b02=/\((.+)\)/;var _0x2a762b=_0x1d1f89['rx'][_0xdc22('0x18')](_0xf66b02);if(_0x2a762b){_0x44b522=_0x2a762b[0x1];}else{_0x44b522=null;}}else{_0x44b522=null;}_0x1d1f89['cb'](null,{'code':_0x11f556,'result':_0x320adf,'extra':_0x44b522});}});_0x4c7170['on'](_0xdc22('0x19'),function(_0x4a9904){_0x526335[_0xdc22('0x1a')]('error',new AGIError(_0xdc22('0x1b'),_0x4a9904['code']));});_0x4c7170['on']('close',function(){_0x526335[_0xdc22('0x1a')](_0xdc22('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4c7170['on'](_0xdc22('0x1d'),function(){_0x526335[_0xdc22('0x1a')](_0xdc22('0x1d'),new AGIError(_0xdc22('0x1e')));_0x4c7170[_0xdc22('0x1f')]();});_0x4c7170[_0xdc22('0x20')](_0x1a91f5);this[_0xdc22('0x21')]=function(_0x110977,_0x3740cb){var _0x110977=_0x110977||'',_0x3740cb=typeof _0x3740cb=='function'?_0x3740cb:new Function();_0x1d1f89={'tx':_0x110977,'rx':'','cb':_0x3740cb};_0x4c7170[_0xdc22('0x22')](_0x110977+'\x0a');},this[_0xdc22('0x1c')]=function(){_0x4c7170['destroy']();};}util[_0xdc22('0x23')](AGIChannel,EventEmitter);AGIChannel[_0xdc22('0x24')]['sendRequest']=function(_0x49dd40){return this['command'][_0xdc22('0x25')](this,_0x49dd40);};AGIChannel['prototype']['answer']=function(){return this[_0xdc22('0x26')](_0xdc22('0x27'));};AGIChannel['prototype']['getData']=function(_0x399384,_0x163868,_0x3e0e1a){_0x399384=_0x399384===undefined?_0xdc22('0x28'):_0x399384;_0x163868=_0x163868===undefined?'5':_0x163868;_0x3e0e1a=_0x3e0e1a===undefined?'1':_0x3e0e1a;return this[_0xdc22('0x26')](util['format'](_0xdc22('0x29'),_0x399384,_0x163868*0x3e8,_0x3e0e1a));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x2a')]=function(_0x1b6f67){_0x1b6f67=_0x1b6f67||_0xdc22('0x2b');return this[_0xdc22('0x26')](util[_0xdc22('0x2c')]('VERBOSE\x20\x22%s\x22',_0x1b6f67));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x2d')]=function(_0x3149fa,_0x328647){if(_[_0xdc22('0x2e')](_0x328647)){return this[_0xdc22('0x26')](util['format'](_0xdc22('0x2f'),_0x3149fa,_0x328647['join'](',')));}return this['sendRequest'](util[_0xdc22('0x2c')]('EXEC\x20%s\x20%s',_0x3149fa,_0x328647));};AGIChannel['prototype']['setContext']=function(_0x21a252){return this[_0xdc22('0x26')](util[_0xdc22('0x2c')]('SET\x20CONTEXT\x20%s',_0x21a252));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x30')]=function(_0x359d28){return this[_0xdc22('0x26')](util[_0xdc22('0x2c')]('SET\x20EXTENSION\x20%s',_0x359d28));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x31')]=function(_0x364cdc){return this[_0xdc22('0x26')](util[_0xdc22('0x2c')](_0xdc22('0x32'),_0x364cdc));};AGIChannel['prototype'][_0xdc22('0xc')]=function(){return this['sendRequest'](_0xdc22('0x33'));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x34')]=function(_0x566520,_0x1983eb){var _0x50d677=_['isBoolean'](_0x1983eb)||_[_0xdc22('0x35')](_0x1983eb)?_0x1983eb[_0xdc22('0x36')]():_0x1983eb;return this[_0xdc22('0x26')](util[_0xdc22('0x2c')](_0xdc22('0x37'),_0x566520,_0x50d677?_0x50d677[_0xdc22('0x36')]()[_0xdc22('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x38')]=function(_0x4636a1,_0x42318d){return this[_0xdc22('0x26')](util[_0xdc22('0x2c')](_0xdc22('0x39'),_0x4636a1,_0x42318d));};AGIChannel['prototype'][_0xdc22('0x3a')]=function(_0x3dea61,_0x5afe94){return this[_0xdc22('0x26')](util[_0xdc22('0x2c')]('SAY\x20DIGITS\x20%s\x20%s',_0x3dea61,_0x5afe94));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x3b')]=function(_0x462065,_0x11fc25){return this[_0xdc22('0x26')](util[_0xdc22('0x2c')](_0xdc22('0x3c'),_0x462065,_0x11fc25));};AGIChannel['prototype'][_0xdc22('0x3d')]=function(_0x3d369a,_0x444bb1,_0x41e4f7){_0x444bb1=_0x444bb1||this[_0xdc22('0x3e')];_0x41e4f7=_0x41e4f7||0x1;this['setContext'](_0x3d369a);this[_0xdc22('0x30')](_0x444bb1);this['setPriority'](_0x41e4f7);return this[_0xdc22('0x2a')](util[_0xdc22('0x2c')](_0xdc22('0x3f'),_0x3d369a,_0x444bb1,_0x41e4f7));};AGIChannel[_0xdc22('0x24')]['getVariable']=function(_0x5dd1fc){return this[_0xdc22('0x26')](util[_0xdc22('0x2c')](_0xdc22('0x40'),_0x5dd1fc));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x41')]=function(_0x153f7d,_0x546474,_0x45603a,_0x1c9f1a,_0xaed413,_0x2aa84d){_0x546474=_0x546474||'wav';_0x45603a=_0x45603a||'';_0x1c9f1a=_0x1c9f1a===undefined?-0x1:_0x1c9f1a==='-1'?-0x1:_0x1c9f1a*0x3e8;_0xaed413=_0xaed413===undefined?'':'s='+_0xaed413;_0x2aa84d=_0x2aa84d?_0xdc22('0x42'):'';return this['sendRequest'](util['format'](_0xdc22('0x43'),_0x153f7d,_0x546474,_0x45603a,_0x1c9f1a,_0x2aa84d,_0xaed413));};AGIChannel[_0xdc22('0x24')]['streamFile']=function(_0x502c6e,_0x4b4889){_0x4b4889=_0x4b4889||'';return this[_0xdc22('0x26')](util[_0xdc22('0x2c')](_0xdc22('0x44'),_0x502c6e,_0x4b4889));};AGIChannel[_0xdc22('0x24')][_0xdc22('0x45')]=function(_0x43c337){return this[_0xdc22('0x2d')]('AGI',_0x43c337);};AGIChannel[_0xdc22('0x24')][_0xdc22('0x46')]=function(_0x1321a7){return this[_0xdc22('0x2d')](_0xdc22('0x47'),_0x1321a7);};AGIChannel[_0xdc22('0x24')][_0xdc22('0x19')]=function(_0x1e412b,_0x13ab21){this['noop'](util[_0xdc22('0x2c')](_0xdc22('0x48'),_0x1e412b['id'],_0x1e412b[_0xdc22('0x49')],_0x13ab21));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x6fb2=['error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sync','answer','sendRequest','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','agi','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','length','match'];(function(_0x40b749,_0x388015){var _0x5755dc=function(_0x1ded69){while(--_0x1ded69){_0x40b749['push'](_0x40b749['shift']());}};_0x5755dc(++_0x388015);}(_0x6fb2,0x1ef));var _0x26fb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6fb2[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x26fb('0x0'));var _=require(_0x26fb('0x1'));var EventEmitter=require(_0x26fb('0x2'))[_0x26fb('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x26fb('0x4'));function AGIChannel(_0x3d20be){var _0x51779b=this,_0x335164=new AGIReply(),_0x46897b=![],_0x2211ba={};EventEmitter[_0x26fb('0x5')](_0x51779b);_0x3d20be[_0x26fb('0x6')](_0x26fb('0x7'));_0x3d20be['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x335164[_0x26fb('0x6')]('utf8');_0x335164['on']('headers',function(_0x17b315){for(var _0x401d62 in _0x17b315){_0x51779b[_0x401d62]=_0x17b315[_0x401d62];}_0x51779b[_0x26fb('0x8')](_0x26fb('0x9'));});_0x335164['on'](_0x26fb('0xa'),function(_0x474489){if(_0x474489[_0x26fb('0xb')]()==_0x26fb('0xc')){_0x51779b[_0x26fb('0x8')]('hangup');return;}if(_0x474489[_0x26fb('0xd')](0x0,0xb)==_0x26fb('0xe')){_0x46897b=!![];}if(_0x46897b){_0x2211ba['rx']+=_0x474489+'\x0a';if(_0x474489[_0x26fb('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x46897b=![];}}else{_0x2211ba['rx']=_0x474489;}if(_0x46897b){return;}if(typeof _0x2211ba['cb']==_0x26fb('0x10')){var _0x2c8475=_0x2211ba['rx']['substring'](0x0,0x3),_0x175441=null,_0x3efacf=null;_0x2c8475=parseInt(_0x2c8475);if(isNaN(_0x2c8475)){_0x2211ba['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x26fb('0x11')});return;}if(_0x2c8475!=0xc8){_0x2211ba['cb'](null,{'code':_0x2c8475,'result':-0x1,'extra':'KO'});return;}_0x175441=_0x2211ba['rx'][_0x26fb('0xd')](0x4)[_0x26fb('0x12')](_0x26fb('0x13'),'');if(_0x175441['indexOf']('\x20')!=-0x1){_0x175441=_0x175441['substr'](0x0,_0x175441[_0x26fb('0x14')]('\x20'));}if(_['startsWith'](_0x175441,'-1')){_0x175441=parseInt(_0x175441);}_0x3efacf=_0x2211ba['rx']['split']('\x20');if(_0x3efacf[_0x26fb('0x15')]==0x3){_0x3efacf=_0x3efacf[0x2][_0x26fb('0xd')](0x1,_0x3efacf[0x2]['length']-0x1);}else if(_0x3efacf[_0x26fb('0x15')]>0x3){var _0x4a166c=/\((.+)\)/;var _0x11d923=_0x2211ba['rx'][_0x26fb('0x16')](_0x4a166c);if(_0x11d923){_0x3efacf=_0x11d923[0x1];}else{_0x3efacf=null;}}else{_0x3efacf=null;}_0x2211ba['cb'](null,{'code':_0x2c8475,'result':_0x175441,'extra':_0x3efacf});}});_0x3d20be['on'](_0x26fb('0x17'),function(_0x50c2e0){_0x51779b[_0x26fb('0x8')]('error',new AGIError(_0x26fb('0x18'),_0x50c2e0[_0x26fb('0x19')]));});_0x3d20be['on'](_0x26fb('0x1a'),function(){_0x51779b[_0x26fb('0x8')](_0x26fb('0x1a'),new AGIError(_0x26fb('0x1b')));});_0x3d20be['on']('timeout',function(){_0x51779b['emit'](_0x26fb('0x1c'),new AGIError(_0x26fb('0x1d')));_0x3d20be[_0x26fb('0x1e')]();});_0x3d20be[_0x26fb('0x1f')](_0x335164);this[_0x26fb('0x20')]=function(_0x183248,_0xfe85fa){var _0x183248=_0x183248||'',_0xfe85fa=typeof _0xfe85fa==_0x26fb('0x10')?_0xfe85fa:new Function();_0x2211ba={'tx':_0x183248,'rx':'','cb':_0xfe85fa};_0x3d20be[_0x26fb('0x21')](_0x183248+'\x0a');},this['close']=function(){_0x3d20be[_0x26fb('0x1e')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x26fb('0x22')]['sendRequest']=function(_0x37e6dd){return this[_0x26fb('0x20')][_0x26fb('0x23')](this,_0x37e6dd);};AGIChannel[_0x26fb('0x22')][_0x26fb('0x24')]=function(){return this[_0x26fb('0x25')](_0x26fb('0x26'));};AGIChannel[_0x26fb('0x22')]['getData']=function(_0x46f1b1,_0x3d53bb,_0xbb7174){_0x46f1b1=_0x46f1b1===undefined?_0x26fb('0x27'):_0x46f1b1;_0x3d53bb=_0x3d53bb===undefined?'5':_0x3d53bb;_0xbb7174=_0xbb7174===undefined?'1':_0xbb7174;return this[_0x26fb('0x25')](util['format'](_0x26fb('0x28'),_0x46f1b1,_0x3d53bb*0x3e8,_0xbb7174));};AGIChannel[_0x26fb('0x22')][_0x26fb('0x29')]=function(_0x432243){_0x432243=_0x432243||_0x26fb('0x2a');return this[_0x26fb('0x25')](util[_0x26fb('0x2b')](_0x26fb('0x2c'),_0x432243));};AGIChannel[_0x26fb('0x22')][_0x26fb('0x2d')]=function(_0x1cb89e,_0x4cbb03){if(_[_0x26fb('0x2e')](_0x4cbb03)){return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x1cb89e,_0x4cbb03[_0x26fb('0x2f')](',')));}return this['sendRequest'](util['format'](_0x26fb('0x30'),_0x1cb89e,_0x4cbb03));};AGIChannel[_0x26fb('0x22')]['setContext']=function(_0xbe6bb1){return this[_0x26fb('0x25')](util[_0x26fb('0x2b')](_0x26fb('0x31'),_0xbe6bb1));};AGIChannel[_0x26fb('0x22')][_0x26fb('0x32')]=function(_0x2aacb4){return this['sendRequest'](util[_0x26fb('0x2b')]('SET\x20EXTENSION\x20%s',_0x2aacb4));};AGIChannel[_0x26fb('0x22')][_0x26fb('0x33')]=function(_0x33d120){return this[_0x26fb('0x25')](util[_0x26fb('0x2b')](_0x26fb('0x34'),_0x33d120));};AGIChannel[_0x26fb('0x22')][_0x26fb('0xc')]=function(){return this[_0x26fb('0x25')]('HANGUP');};AGIChannel[_0x26fb('0x22')][_0x26fb('0x35')]=function(_0x2c271f,_0x3a00de){var _0x424517=_[_0x26fb('0x36')](_0x3a00de)||_[_0x26fb('0x37')](_0x3a00de)?_0x3a00de[_0x26fb('0x38')]():_0x3a00de;return this[_0x26fb('0x25')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2c271f,_0x424517?_0x424517[_0x26fb('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x26fb('0x22')]['sayNumber']=function(_0x2c7842,_0x1ce10e){return this['sendRequest'](util['format'](_0x26fb('0x39'),_0x2c7842,_0x1ce10e));};AGIChannel['prototype'][_0x26fb('0x3a')]=function(_0x110703,_0x1fac34){return this[_0x26fb('0x25')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x110703,_0x1fac34));};AGIChannel[_0x26fb('0x22')]['sayPhonetic']=function(_0x13551f,_0xf26038){return this[_0x26fb('0x25')](util[_0x26fb('0x2b')](_0x26fb('0x3b'),_0x13551f,_0xf26038));};AGIChannel[_0x26fb('0x22')][_0x26fb('0x3c')]=function(_0x46af0e,_0x34fcaa,_0x2ca76e){_0x34fcaa=_0x34fcaa||this[_0x26fb('0x3d')];_0x2ca76e=_0x2ca76e||0x1;this[_0x26fb('0x3e')](_0x46af0e);this[_0x26fb('0x32')](_0x34fcaa);this[_0x26fb('0x33')](_0x2ca76e);return this[_0x26fb('0x29')](util[_0x26fb('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x46af0e,_0x34fcaa,_0x2ca76e));};AGIChannel[_0x26fb('0x22')][_0x26fb('0x3f')]=function(_0x55373e){return this[_0x26fb('0x25')](util[_0x26fb('0x2b')](_0x26fb('0x40'),_0x55373e));};AGIChannel[_0x26fb('0x22')][_0x26fb('0x41')]=function(_0x16d383,_0x5edbea,_0xe896bf,_0x2cbc68,_0x1ecd96,_0x48a756){_0x5edbea=_0x5edbea||_0x26fb('0x42');_0xe896bf=_0xe896bf||'';_0x2cbc68=_0x2cbc68===undefined?-0x1:_0x2cbc68==='-1'?-0x1:_0x2cbc68*0x3e8;_0x1ecd96=_0x1ecd96===undefined?'':'s='+_0x1ecd96;_0x48a756=_0x48a756?'BEEP':'';return this[_0x26fb('0x25')](util[_0x26fb('0x2b')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x16d383,_0x5edbea,_0xe896bf,_0x2cbc68,_0x48a756,_0x1ecd96));};AGIChannel['prototype'][_0x26fb('0x43')]=function(_0x2c08ba,_0x2da1d8){_0x2da1d8=_0x2da1d8||'';return this[_0x26fb('0x25')](util[_0x26fb('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x2c08ba,_0x2da1d8));};AGIChannel[_0x26fb('0x22')][_0x26fb('0x44')]=function(_0x482ae1){return this['exec'](_0x26fb('0x45'),_0x482ae1);};AGIChannel[_0x26fb('0x22')][_0x26fb('0x46')]=function(_0x15b7de){return this[_0x26fb('0x2d')](_0x26fb('0x47'),_0x15b7de);};AGIChannel[_0x26fb('0x22')][_0x26fb('0x17')]=function(_0x2f076f,_0x53440f){this[_0x26fb('0x29')](util[_0x26fb('0x2b')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2f076f['id'],_0x2f076f[_0x26fb('0x48')],_0x53440f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x26fb('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index a114a10..16ea25a 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 _0x3361=['format','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push'];(function(_0x288746,_0xd7743f){var _0x482d7d=function(_0x119540){while(--_0x119540){_0x288746['push'](_0x288746['shift']());}};_0x482d7d(++_0xd7743f);}(_0x3361,0x1a9));var _0x1336=function(_0x49dd78,_0x5cc02f){_0x49dd78=_0x49dd78-0x0;var _0x37d8c6=_0x3361[_0x49dd78];return _0x37d8c6;};'use strict';var util=require(_0x1336('0x0'));var error={'E_AGI_UNDEFINED':_0x1336('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x1336('0x2'),'E_AGI_SERVER_CLOSE':_0x1336('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x1336('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x1336('0x5'),'E_AGI_SOCKET_CLOSE':_0x1336('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1336('0x7'),'E_AGI_IVR_ENTRY':_0x1336('0x8')};function AGIError(_0x528e16){var _0x528e16=_0x528e16||null,_0x357694=_0x357694||[],_0xce0d91=0x1,_0x18e797='';if(!error[_0x528e16]){_0x528e16='E_AGI_UNDEFINED';}_0x357694[_0x1336('0x9')](error[_0x528e16]);while(arguments[_0xce0d91]){_0x357694[_0x1336('0x9')](arguments[_0xce0d91]);_0xce0d91++;}_0x18e797=util[_0x1336('0xa')][_0x1336('0xb')](util,_0x357694);this[_0x1336('0xc')]=_0x18e797;this[_0x1336('0xd')]=_0x528e16;}module[_0x1336('0xe')]=AGIError; \ No newline at end of file +var _0x949e=['E_AGI_UNDEFINED','push','format','apply','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0x949e,0x157));var _0xe949=function(_0x10bfee,_0x34195e){_0x10bfee=_0x10bfee-0x0;var _0x427cd2=_0x949e[_0x10bfee];return _0x427cd2;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xe949('0x0'),'E_AGI_SERVER_ERROR':_0xe949('0x1'),'E_AGI_SERVER_CLOSE':_0xe949('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xe949('0x3'),'E_AGI_SOCKET_ERROR':_0xe949('0x4'),'E_AGI_SOCKET_CLOSE':_0xe949('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xe949('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe949('0x7'),'E_AGI_IVR_ENTRY':_0xe949('0x8')};function AGIError(_0x3943d5){var _0x3943d5=_0x3943d5||null,_0x29d4b8=_0x29d4b8||[],_0x18586b=0x1,_0x4f8aa6='';if(!error[_0x3943d5]){_0x3943d5=_0xe949('0x9');}_0x29d4b8['push'](error[_0x3943d5]);while(arguments[_0x18586b]){_0x29d4b8[_0xe949('0xa')](arguments[_0x18586b]);_0x18586b++;}_0x4f8aa6=util[_0xe949('0xb')][_0xe949('0xc')](util,_0x29d4b8);this[_0xe949('0xd')]=_0x4f8aa6;this[_0xe949('0xe')]=_0x3943d5;}module[_0xe949('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 890c78e..64ffe45 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 _0xda22=['traverseBFS','includes','condition\x20not\x20found','exports','../../../config/logger','agi','getsecretdigits','edges','numberOfEdges','addVertex','vertices','prototype','addEdge','push','size','relations','getVertex','no\x20vertex\x20found','stop\x20traverse','info','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','default','menu','invalid'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xda22,0xb8));var _0x2da2=function(_0x31feca,_0x3ac71c){_0x31feca=_0x31feca-0x0;var _0x2654d7=_0xda22[_0x31feca];return _0x2654d7;};'use strict';var _=require('lodash');var logger=require(_0x2da2('0x0'))(_0x2da2('0x1'));var verticesWithRetry=['menu','getdigits',_0x2da2('0x2')];var Graph=function(){this['vertices']={};this[_0x2da2('0x3')]={};this[_0x2da2('0x4')]=0x0;};Graph['prototype'][_0x2da2('0x5')]=function(_0x815dc9){this[_0x2da2('0x6')][_0x815dc9['id']]=_0x815dc9;this['edges'][_0x815dc9['id']]=[];};Graph[_0x2da2('0x7')][_0x2da2('0x8')]=function(_0x36209b,_0x3bd21a,_0x40ceea){this['edges'][_0x36209b][_0x2da2('0x9')]({'target':_0x3bd21a,'condition':_0x40ceea});this[_0x2da2('0x4')]+=0x1;};Graph[_0x2da2('0x7')][_0x2da2('0xa')]=function(){return _[_0x2da2('0xa')](this['vertices']);};Graph['prototype'][_0x2da2('0xb')]=function(){return this['numberOfEdges'];};Graph['prototype'][_0x2da2('0xc')]=function(_0x194653){return this[_0x2da2('0x6')][_0x194653];};Graph['prototype']['traverseBFS']=function(_0x40b535,_0x27380b){if(!this[_0x2da2('0x6')][_0x40b535]){return logger['info'](_0x2da2('0xd'));}var _0x1fe373=_0x27380b(this[_0x2da2('0x6')][_0x40b535]);if(!_0x1fe373){return logger['info'](_0x2da2('0xe'));}if(this['edges'][_0x40b535]['length']===0x0){return logger[_0x2da2('0xf')](_0x2da2('0x10'));}for(var _0x24b7e8=0x0,_0x44f7f5=[],_0x518ce8=![];_0x24b7e8\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','toString','response','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry'];(function(_0x338338,_0x782573){var _0x3cf852=function(_0x3016d8){while(--_0x3016d8){_0x338338['push'](_0x338338['shift']());}};_0x3cf852(++_0x782573);}(_0x6560,0x14e));var _0x0656=function(_0x210698,_0x256b1e){_0x210698=_0x210698-0x0;var _0x3c4762=_0x6560[_0x210698];return _0x3c4762;};'use strict';var parser=require(_0x0656('0x0'));var _=require(_0x0656('0x1'));var syncho=require('syncho');var util=require(_0x0656('0x2'));var moment=require(_0x0656('0x3'));var config=require(_0x0656('0x4'));var logger=require(_0x0656('0x5'))(_0x0656('0x6'));var utilLicense=require(_0x0656('0x7'));var rpc=require(_0x0656('0x8'));var mailRpc=require(_0x0656('0x9'));var Graph=require('./graph');var Vertices=require(_0x0656('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0656('0x6')]=_[_0x0656('0xb')](config[_0x0656('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x4e1a2e){process[_0x0656('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4e1a2e);agiHandler(_0x4e1a2e);}catch(_0x23dff6){logger[_0x0656('0xd')](_0x23dff6['stack']);}});});}function listeningHandler(){console[_0x0656('0xe')](_0x0656('0xf'),config[_0x0656('0x6')][_0x0656('0x10')]);logger[_0x0656('0x11')](util[_0x0656('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x0656('0x6')][_0x0656('0x10')]));}function errorHandler(_0x1110b4){if(_0x1110b4&&_0x1110b4[_0x0656('0x13')]&&_0x1110b4[_0x0656('0x14')]){logger[_0x0656('0xd')](util[_0x0656('0x12')]('[%s]\x20%s',_0x1110b4['name'],_0x1110b4[_0x0656('0x14')]));}else{logger[_0x0656('0xd')](util[_0x0656('0x12')](_0x0656('0x15'),_0x1110b4[_0x0656('0x16')]));}}function closeHandler(){logger['info'](util['format'](_0x0656('0x17'),this[_0x0656('0x18')],this[_0x0656('0x19')],this[_0x0656('0x1a')],this[_0x0656('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x502f41){logger[_0x0656('0xd')](_0x502f41[_0x0656('0x16')]);}}function timeoutHandler(){logger[_0x0656('0x11')](util['format'](_0x0656('0x1c'),this[_0x0656('0x18')],this[_0x0656('0x19')],this[_0x0656('0x1a')],this['dnid'],this[_0x0656('0x1d')]));}function hangupHandler(){logger[_0x0656('0x11')](util[_0x0656('0x12')](_0x0656('0x1e'),this['arg_1'],this[_0x0656('0x19')],this[_0x0656('0x1a')],this[_0x0656('0x1b')],this[_0x0656('0x1d')]));this[_0x0656('0x1f')]=!![];}function getRoot(_0x576bf4){return parser[_0x0656('0x20')](_0x576bf4,{'object':!![]})[_0x0656('0x21')][_0x0656('0x22')];}function addVertex(_0x5e54ec,_0x159b86,_0x4cc8b7){_0x159b86[_0x0656('0x23')]=_0x4cc8b7;if(_0x159b86[_0x0656('0x24')](_0x0656('0x25'))){_0x159b86[_0x0656('0x26')]=parseInt(_0x159b86[_0x0656('0x25')],0xa);}_0x5e54ec[_0x0656('0x27')](_[_0x0656('0x28')](_0x159b86,_0x0656('0x29')));}function initGraph(_0x16cf91,_0x284896){var _0x323b5c=new Graph();for(var _0x5a73a1 in _0x16cf91){if(_0x16cf91[_0x0656('0x24')](_0x5a73a1)){if(_[_0x0656('0x2a')](_0x16cf91[_0x5a73a1])){for(var _0x570587=0x0;_0x570587<_0x16cf91[_0x5a73a1][_0x0656('0x2b')];_0x570587+=0x1){addVertex(_0x323b5c,_0x16cf91[_0x5a73a1][_0x570587],_0x5a73a1);}}else{addVertex(_0x323b5c,_0x16cf91[_0x5a73a1],_0x5a73a1);}}}for(var _0x533740=0x0;_0x533740<_0x284896[_0x0656('0x2b')];_0x533740+=0x1){if(_0x284896[_0x533740][_0x0656('0x2c')]&&_0x284896[_0x533740][_0x0656('0x2d')]){_0x323b5c[_0x0656('0x2e')](_0x284896[_0x533740][_0x0656('0x2c')],_0x284896[_0x533740][_0x0656('0x2d')],_0x284896[_0x533740][_0x0656('0x2f')]);}}return _0x323b5c;}function getSquareProject(_0x2e1a9c,_0x283e50){rpc[_0x0656('0x30')](_0x2e1a9c)[_0x0656('0x31')](function(_0x34f046){_0x283e50(null,_0x34f046);})[_0x0656('0x32')](function(_0x3c16d3){_0x283e50(null,_0x3c16d3);});}function createSquareReport(_0x2a017c,_0x358330){rpc[_0x0656('0x33')](_0x2a017c)['then'](function(_0x514f94){if(_0x358330){_0x358330(null,_0x514f94);}})['catch'](function(_0x200daa){if(_0x358330){_0x358330(null,_0x200daa);}});}function setChannelVariables(_0x1bf0d1){for(var _0x2638aa in _0x1bf0d1){if(_0x1bf0d1[_0x0656('0x24')](_0x2638aa)){if(_0x2638aa[_0x0656('0x34')](_0x0656('0x35'))===0x0){_0x1bf0d1[_0x2638aa[_0x0656('0x36')](0x4)]=_0x1bf0d1[_0x2638aa];delete _0x1bf0d1[_0x2638aa];}}}}function getLogFromObject(_0x3968b7){return util['inspect'](_0x3968b7,{'showHidden':![],'depth':null});}function agiHandler(_0x52103c){var _0x2bbee1,_0x147122,_0x3733ca,_0x599d0d,_0x5b338f;logger[_0x0656('0x37')]('variables',JSON[_0x0656('0x38')](_0x52103c,null,0x2));logger[_0x0656('0x11')](util['format'](_0x0656('0x39'),_0x52103c['arg_1'],_0x52103c[_0x0656('0x19')],_0x52103c[_0x0656('0x1a')],_0x52103c[_0x0656('0x1b')],_0x52103c[_0x0656('0x1d')]));_0x52103c['on'](_0x0656('0xd'),errorHandler);_0x52103c['on'](_0x0656('0x3a'),closeHandler);_0x52103c['on'](_0x0656('0x3b'),timeoutHandler);_0x52103c[_0x0656('0x1f')]=![];_0x52103c['on']('hangup',hangupHandler);var _0x3e8f46=getSquareProject[_0x0656('0x3c')](null,_0x52103c[_0x0656('0x18')]);if(_0x3e8f46){if(_0x3e8f46[_0x0656('0x3d')]){_0x2bbee1=getRoot(_0x3e8f46[_0x0656('0x3d')]);if(_0x2bbee1&&_0x2bbee1[_0x0656('0x3e')]){logger[_0x0656('0x37')](_0x0656('0x22'),JSON[_0x0656('0x38')](_0x2bbee1,null,0x2));_0x52103c[_0x0656('0x3f')]=moment()[_0x0656('0x12')](_0x0656('0x40'));_0x147122=initGraph(_['omit'](_0x2bbee1,_0x0656('0x29')),_0x2bbee1[_0x0656('0x29')]);_0x3733ca=new Vertices(_0x52103c,rpc,mailRpc);logger[_0x0656('0x11')](util[_0x0656('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x52103c[_0x0656('0x18')],_0x52103c[_0x0656('0x19')],_0x52103c[_0x0656('0x1a')],_0x52103c['dnid'],_0x52103c[_0x0656('0x1d')]));_0x147122[_0x0656('0x41')](_0x2bbee1[_0x0656('0x3e')]['id'],function(_0x2d6b97){try{_0x2d6b97=_0x3733ca['clear'](_0x2d6b97);logger[_0x0656('0x37')](_0x0656('0x42'),JSON[_0x0656('0x38')](_0x2d6b97,null,0x2));if(_0x2d6b97['agicommand']==='gotoc'){logger['info'](_0x0656('0x43'));_0x52103c[_0x0656('0x44')]=_0x2d6b97[_0x0656('0x44')]||_0x52103c['context'];_0x52103c['extension']=_0x2d6b97[_0x0656('0x45')];_0x52103c[_0x0656('0x46')]=_0x2d6b97['priority']?_0x2d6b97[_0x0656('0x46')]-0x1:0x1;return null;}else if(_0x2d6b97&&_0x3733ca[_0x2d6b97[_0x0656('0x23')]]){_0x5b338f=_0x3733ca[_0x2d6b97[_0x0656('0x23')]](_0x2d6b97);logger[_0x0656('0x11')]('response',JSON[_0x0656('0x38')](_0x5b338f,null,0x2));if(_0x5b338f&&_0x5b338f[_0x0656('0x47')]===AGI_CODE_SUCCESS&&_0x5b338f[_0x0656('0x48')]!==AGI_RESULT_ERROR&&!_0x52103c[_0x0656('0x1f')]){logger[_0x0656('0x37')]('response',getLogFromObject(_0x5b338f));return _['isUndefined'](_0x5b338f[_0x0656('0x48')])?null:_0x5b338f[_0x0656('0x48')][_0x0656('0x49')]();}else{logger['error'](_0x0656('0x4a'),getLogFromObject(_0x5b338f));return null;}}else{logger[_0x0656('0xd')](_0x0656('0x4b'));return null;}}catch(_0xb22921){logger[_0x0656('0xd')](_0xb22921[_0x0656('0x16')]);return null;}});if(_0x2bbee1['finally']){logger[_0x0656('0x11')](util[_0x0656('0x12')](_0x0656('0x4c'),_0x52103c[_0x0656('0x18')],_0x52103c[_0x0656('0x19')],_0x52103c[_0x0656('0x1a')],_0x52103c[_0x0656('0x1b')],_0x52103c[_0x0656('0x1d')]));_0x147122[_0x0656('0x41')](_0x2bbee1[_0x0656('0x4d')]['id'],function(_0x438659){try{_0x438659=_0x3733ca[_0x0656('0x4e')](_0x438659);logger[_0x0656('0x37')](_0x0656('0x42'),JSON[_0x0656('0x38')](_0x438659,null,0x2));if(_0x438659&&_0x3733ca[_0x438659[_0x0656('0x23')]]){_0x5b338f=_0x3733ca[_0x438659['agicommand']](_0x438659);if(_0x5b338f){logger[_0x0656('0x37')]('response',getLogFromObject(_0x5b338f));return _[_0x0656('0x4f')](_0x5b338f['result'])?null:_0x5b338f[_0x0656('0x48')][_0x0656('0x49')]();}else{logger['error']('response',getLogFromObject(_0x5b338f));return null;}}else{logger[_0x0656('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x21f031){logger[_0x0656('0xd')](_0x21f031[_0x0656('0x16')]);return null;}});}logger[_0x0656('0x11')](util[_0x0656('0x12')](_0x0656('0x50'),_0x52103c[_0x0656('0x18')],_0x52103c[_0x0656('0x19')],_0x52103c['callerid'],_0x52103c[_0x0656('0x1b')],_0x52103c[_0x0656('0x1d')]));logger[_0x0656('0x11')](util['format'](_0x0656('0x51'),_0x52103c[_0x0656('0x44')],_0x52103c['extension'],parseInt(_0x52103c[_0x0656('0x46')],0xa)+0x1));_0x52103c[_0x0656('0x52')](_0x52103c['context'],_0x52103c['extension'],parseInt(_0x52103c[_0x0656('0x46')],0xa)+0x1);_0x52103c[_0x0656('0x3a')]();}}else{logger[_0x0656('0xd')](util[_0x0656('0x12')](_0x0656('0x53'),_0x52103c[_0x0656('0x18')]));_0x52103c[_0x0656('0x52')](_0x52103c[_0x0656('0x44')],_0x52103c[_0x0656('0x45')],parseInt(_0x52103c['priority'],0xa)+0x1);_0x52103c[_0x0656('0x3a')]();}}else{logger['error'](util[_0x0656('0x12')](_0x0656('0x54'),_0x52103c[_0x0656('0x18')]));_0x52103c[_0x0656('0x52')](_0x52103c[_0x0656('0x44')],_0x52103c[_0x0656('0x45')],parseInt(_0x52103c[_0x0656('0x46')],0xa)+0x1);_0x52103c['close']();}}function main(){var _0x2fec76;return utilLicense[_0x0656('0x55')]()[_0x0656('0x31')](function(_0x51cf15){if(_0x51cf15){if(_0x51cf15['voice']){if(_0x51cf15[_0x0656('0x56')]&&_0x51cf15['callysquare']>0x0){logger['info'](util['format'](_0x0656('0x57'),_0x51cf15[_0x0656('0x56')]));_0x2fec76=_0x51cf15[_0x0656('0x56')];}else{logger[_0x0656('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x0656('0x58'));_0x2fec76=-0x1;}}})[_0x0656('0x32')](function(_0x2ee112){logger[_0x0656('0xd')](_0x0656('0x59'),_0x2ee112['stack']);})[_0x0656('0x4d')](function(){var _0x430a5b=require(_0x0656('0x5a'))(config['agi'][_0x0656('0x10')],config['agi']['ip'],_0x2fec76);_0x430a5b['on'](_0x0656('0xd'),errorHandler);_0x430a5b['on'](_0x0656('0x5b'),listeningHandler);_0x430a5b['on'](_0x0656('0x5c'),connectionHandler);_0x430a5b['on'](_0x0656('0x3a'),closeHandler);});}main(); \ No newline at end of file +var _0x4271=['isUndefined','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','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','syncho','moment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[%s]\x20%s','message','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','then','catch','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4271,0x1cb));var _0x1427=function(_0x321b98,_0x4c7b2b){_0x321b98=_0x321b98-0x0;var _0x22948f=_0x4271[_0x321b98];return _0x22948f;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0x1427('0x0'));var util=require('util');var moment=require(_0x1427('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x1427('0x2'));var utilLicense=require(_0x1427('0x3'));var rpc=require(_0x1427('0x4'));var mailRpc=require(_0x1427('0x5'));var Graph=require(_0x1427('0x6'));var Vertices=require(_0x1427('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1427('0x2')]=_['defaults'](config[_0x1427('0x2')],{'ip':_0x1427('0x8'),'port':0x11dd});function connectionHandler(_0x497db5){process[_0x1427('0x9')](function(){syncho(function(){try{setChannelVariables(_0x497db5);agiHandler(_0x497db5);}catch(_0x1ca9dd){logger[_0x1427('0xa')](_0x1ca9dd['stack']);}});});}function listeningHandler(){console[_0x1427('0xb')](_0x1427('0xc'),config['agi'][_0x1427('0xd')]);logger[_0x1427('0xe')](util['format'](_0x1427('0xf'),config[_0x1427('0x2')]['ip'],config['agi']['port']));}function errorHandler(_0x379749){if(_0x379749&&_0x379749[_0x1427('0x10')]&&_0x379749['message']){logger['error'](util[_0x1427('0x11')](_0x1427('0x12'),_0x379749['name'],_0x379749[_0x1427('0x13')]));}else{logger[_0x1427('0xa')](util['format'](_0x1427('0x14'),_0x379749[_0x1427('0x15')]));}}function closeHandler(){logger[_0x1427('0xe')](util['format'](_0x1427('0x16'),this['arg_1'],this[_0x1427('0x17')],this[_0x1427('0x18')],this['dnid'],this[_0x1427('0x19')]));try{createSquareReport(this);}catch(_0x2958d3){logger[_0x1427('0xa')](_0x2958d3[_0x1427('0x15')]);}}function timeoutHandler(){logger[_0x1427('0xe')](util[_0x1427('0x11')](_0x1427('0x1a'),this[_0x1427('0x1b')],this[_0x1427('0x17')],this[_0x1427('0x18')],this[_0x1427('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0x1427('0xe')](util[_0x1427('0x11')](_0x1427('0x1d'),this['arg_1'],this[_0x1427('0x17')],this[_0x1427('0x18')],this[_0x1427('0x1c')],this[_0x1427('0x19')]));this[_0x1427('0x1e')]=!![];}function getRoot(_0x431e68){return parser[_0x1427('0x1f')](_0x431e68,{'object':!![]})[_0x1427('0x20')]['root'];}function addVertex(_0x56c5d7,_0x25eab9,_0x182f18){_0x25eab9[_0x1427('0x21')]=_0x182f18;if(_0x25eab9['hasOwnProperty'](_0x1427('0x22'))){_0x25eab9['maxRetry']=parseInt(_0x25eab9['retry'],0xa);}_0x56c5d7[_0x1427('0x23')](_[_0x1427('0x24')](_0x25eab9,_0x1427('0x25')));}function initGraph(_0x1f2341,_0xcf7eb4){var _0x368e10=new Graph();for(var _0x402c3e in _0x1f2341){if(_0x1f2341[_0x1427('0x26')](_0x402c3e)){if(_[_0x1427('0x27')](_0x1f2341[_0x402c3e])){for(var _0x309398=0x0;_0x309398<_0x1f2341[_0x402c3e][_0x1427('0x28')];_0x309398+=0x1){addVertex(_0x368e10,_0x1f2341[_0x402c3e][_0x309398],_0x402c3e);}}else{addVertex(_0x368e10,_0x1f2341[_0x402c3e],_0x402c3e);}}}for(var _0xdf0755=0x0;_0xdf0755<_0xcf7eb4[_0x1427('0x28')];_0xdf0755+=0x1){if(_0xcf7eb4[_0xdf0755][_0x1427('0x29')]&&_0xcf7eb4[_0xdf0755]['target']){_0x368e10[_0x1427('0x2a')](_0xcf7eb4[_0xdf0755][_0x1427('0x29')],_0xcf7eb4[_0xdf0755][_0x1427('0x2b')],_0xcf7eb4[_0xdf0755]['value']);}}return _0x368e10;}function getSquareProject(_0x5387d1,_0x3aca34){rpc['getSquareProject'](_0x5387d1)[_0x1427('0x2c')](function(_0x4461a4){_0x3aca34(null,_0x4461a4);})['catch'](function(_0x55e667){_0x3aca34(null,_0x55e667);});}function createSquareReport(_0xadb541,_0x8e60a1){rpc['createSquareReport'](_0xadb541)['then'](function(_0x1c4acc){if(_0x8e60a1){_0x8e60a1(null,_0x1c4acc);}})[_0x1427('0x2d')](function(_0x290e24){if(_0x8e60a1){_0x8e60a1(null,_0x290e24);}});}function setChannelVariables(_0x3218d6){for(var _0x53e471 in _0x3218d6){if(_0x3218d6[_0x1427('0x26')](_0x53e471)){if(_0x53e471['indexOf'](_0x1427('0x2e'))===0x0){_0x3218d6[_0x53e471[_0x1427('0x2f')](0x4)]=_0x3218d6[_0x53e471];delete _0x3218d6[_0x53e471];}}}}function getLogFromObject(_0x1c98e1){return util['inspect'](_0x1c98e1,{'showHidden':![],'depth':null});}function agiHandler(_0x4185fe){var _0x167f25,_0x47842e,_0x4476da,_0x24e62e,_0x2d4ce9;logger[_0x1427('0x30')](_0x1427('0x31'),JSON[_0x1427('0x32')](_0x4185fe,null,0x2));logger[_0x1427('0xe')](util[_0x1427('0x11')](_0x1427('0x33'),_0x4185fe[_0x1427('0x1b')],_0x4185fe[_0x1427('0x17')],_0x4185fe['callerid'],_0x4185fe['dnid'],_0x4185fe['uniqueid']));_0x4185fe['on'](_0x1427('0xa'),errorHandler);_0x4185fe['on']('close',closeHandler);_0x4185fe['on']('timeout',timeoutHandler);_0x4185fe[_0x1427('0x1e')]=![];_0x4185fe['on']('hangup',hangupHandler);var _0x555c6c=getSquareProject[_0x1427('0x34')](null,_0x4185fe[_0x1427('0x1b')]);if(_0x555c6c){if(_0x555c6c[_0x1427('0x35')]){_0x167f25=getRoot(_0x555c6c[_0x1427('0x35')]);if(_0x167f25&&_0x167f25[_0x1427('0x36')]){logger[_0x1427('0x30')]('root',JSON[_0x1427('0x32')](_0x167f25,null,0x2));_0x4185fe[_0x1427('0x37')]=moment()[_0x1427('0x11')](_0x1427('0x38'));_0x47842e=initGraph(_[_0x1427('0x24')](_0x167f25,_0x1427('0x25')),_0x167f25[_0x1427('0x25')]);_0x4476da=new Vertices(_0x4185fe,rpc,mailRpc);logger[_0x1427('0xe')](util['format'](_0x1427('0x39'),_0x4185fe['arg_1'],_0x4185fe[_0x1427('0x17')],_0x4185fe[_0x1427('0x18')],_0x4185fe[_0x1427('0x1c')],_0x4185fe[_0x1427('0x19')]));_0x47842e[_0x1427('0x3a')](_0x167f25[_0x1427('0x36')]['id'],function(_0x4b7971){try{_0x4b7971=_0x4476da[_0x1427('0x3b')](_0x4b7971);logger[_0x1427('0x30')](_0x1427('0x3c'),JSON[_0x1427('0x32')](_0x4b7971,null,0x2));if(_0x4b7971[_0x1427('0x21')]===_0x1427('0x3d')){logger['info'](_0x1427('0x3e'));_0x4185fe[_0x1427('0x3f')]=_0x4b7971[_0x1427('0x3f')]||_0x4185fe['context'];_0x4185fe[_0x1427('0x40')]=_0x4b7971[_0x1427('0x40')];_0x4185fe[_0x1427('0x41')]=_0x4b7971[_0x1427('0x41')]?_0x4b7971['priority']-0x1:0x1;return null;}else if(_0x4b7971&&_0x4476da[_0x4b7971[_0x1427('0x21')]]){_0x2d4ce9=_0x4476da[_0x4b7971[_0x1427('0x21')]](_0x4b7971);logger[_0x1427('0xe')](_0x1427('0x42'),JSON[_0x1427('0x32')](_0x2d4ce9,null,0x2));if(_0x2d4ce9&&_0x2d4ce9[_0x1427('0x43')]===AGI_CODE_SUCCESS&&_0x2d4ce9[_0x1427('0x44')]!==AGI_RESULT_ERROR&&!_0x4185fe['evtHangup']){logger[_0x1427('0x30')]('response',getLogFromObject(_0x2d4ce9));return _[_0x1427('0x45')](_0x2d4ce9['result'])?null:_0x2d4ce9[_0x1427('0x44')][_0x1427('0x46')]();}else{logger[_0x1427('0xa')](_0x1427('0x42'),getLogFromObject(_0x2d4ce9));return null;}}else{logger['error'](_0x1427('0x47'));return null;}}catch(_0x8d601a){logger[_0x1427('0xa')](_0x8d601a[_0x1427('0x15')]);return null;}});if(_0x167f25[_0x1427('0x48')]){logger[_0x1427('0xe')](util['format'](_0x1427('0x49'),_0x4185fe['arg_1'],_0x4185fe[_0x1427('0x17')],_0x4185fe['callerid'],_0x4185fe[_0x1427('0x1c')],_0x4185fe[_0x1427('0x19')]));_0x47842e[_0x1427('0x3a')](_0x167f25[_0x1427('0x48')]['id'],function(_0x519e77){try{_0x519e77=_0x4476da['clear'](_0x519e77);logger['debug'](_0x1427('0x3c'),JSON[_0x1427('0x32')](_0x519e77,null,0x2));if(_0x519e77&&_0x4476da[_0x519e77['agicommand']]){_0x2d4ce9=_0x4476da[_0x519e77[_0x1427('0x21')]](_0x519e77);if(_0x2d4ce9){logger[_0x1427('0x30')](_0x1427('0x42'),getLogFromObject(_0x2d4ce9));return _[_0x1427('0x45')](_0x2d4ce9[_0x1427('0x44')])?null:_0x2d4ce9[_0x1427('0x44')][_0x1427('0x46')]();}else{logger[_0x1427('0xa')](_0x1427('0x42'),getLogFromObject(_0x2d4ce9));return null;}}else{logger[_0x1427('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x278a5f){logger[_0x1427('0xa')](_0x278a5f[_0x1427('0x15')]);return null;}});}logger[_0x1427('0xe')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4185fe[_0x1427('0x1b')],_0x4185fe['calleridname'],_0x4185fe[_0x1427('0x18')],_0x4185fe[_0x1427('0x1c')],_0x4185fe[_0x1427('0x19')]));logger[_0x1427('0xe')](util[_0x1427('0x11')](_0x1427('0x4a'),_0x4185fe['context'],_0x4185fe['extension'],parseInt(_0x4185fe[_0x1427('0x41')],0xa)+0x1));_0x4185fe[_0x1427('0x4b')](_0x4185fe[_0x1427('0x3f')],_0x4185fe[_0x1427('0x40')],parseInt(_0x4185fe[_0x1427('0x41')],0xa)+0x1);_0x4185fe[_0x1427('0x4c')]();}}else{logger['error'](util['format'](_0x1427('0x4d'),_0x4185fe[_0x1427('0x1b')]));_0x4185fe[_0x1427('0x4b')](_0x4185fe[_0x1427('0x3f')],_0x4185fe[_0x1427('0x40')],parseInt(_0x4185fe[_0x1427('0x41')],0xa)+0x1);_0x4185fe[_0x1427('0x4c')]();}}else{logger[_0x1427('0xa')](util[_0x1427('0x11')](_0x1427('0x4e'),_0x4185fe['arg_1']));_0x4185fe['continueAt'](_0x4185fe['context'],_0x4185fe[_0x1427('0x40')],parseInt(_0x4185fe['priority'],0xa)+0x1);_0x4185fe[_0x1427('0x4c')]();}}function main(){var _0x26c290;return utilLicense[_0x1427('0x4f')]()[_0x1427('0x2c')](function(_0x1e7bb1){if(_0x1e7bb1){if(_0x1e7bb1[_0x1427('0x50')]){if(_0x1e7bb1[_0x1427('0x51')]&&_0x1e7bb1[_0x1427('0x51')]>0x0){logger[_0x1427('0xe')](util['format'](_0x1427('0x52'),_0x1e7bb1[_0x1427('0x51')]));_0x26c290=_0x1e7bb1['callysquare'];}else{logger[_0x1427('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x1427('0xe')](_0x1427('0x53'));_0x26c290=-0x1;}}})[_0x1427('0x2d')](function(_0x4999e4){logger[_0x1427('0xa')](_0x1427('0x54'),_0x4999e4[_0x1427('0x15')]);})[_0x1427('0x48')](function(){var _0x33a58c=require(_0x1427('0x55'))(config[_0x1427('0x2')][_0x1427('0xd')],config['agi']['ip'],_0x26c290);_0x33a58c['on'](_0x1427('0xa'),errorHandler);_0x33a58c['on'](_0x1427('0x56'),listeningHandler);_0x33a58c['on'](_0x1427('0x57'),connectionHandler);_0x33a58c['on'](_0x1427('0x4c'),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 bea7118..54fd8a5 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 _0xd027=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xd027,0x176));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x7d02('0x0'));var jayson=require(_0x7d02('0x1'));var client=jayson[_0x7d02('0x2')][_0x7d02('0x3')]({'port':0x232b});function request(_0x1985e7,_0x15bd19){return new BPromise(function(_0xf45aad,_0x29efee){return client[_0x7d02('0x4')](_0x1985e7,_0x15bd19)[_0x7d02('0x5')](function(_0x3de328){if(_0x3de328[_0x7d02('0x6')]){return _0x29efee(_0x3de328[_0x7d02('0x6')][_0x7d02('0x7')]);}else{return _0xf45aad(_0x3de328[_0x7d02('0x8')]);}})[_0x7d02('0x9')](function(_0x566d0b){return _0x29efee(_0x566d0b);});});}exports[_0x7d02('0xa')]=function(_0xd59aa7,_0x28d672){return request(_0x7d02('0xb'),{'account':_0xd59aa7,'message':_0x28d672});}; \ No newline at end of file +var _0x8ee0=['http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8ee0,0x17d));var _0x08ee=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0x8ee0[_0x203d64];return _0x462ab3;};'use strict';var BPromise=require(_0x08ee('0x0'));var jayson=require(_0x08ee('0x1'));var client=jayson[_0x08ee('0x2')][_0x08ee('0x3')]({'port':0x232b});function request(_0x403eb1,_0x1f7adf){return new BPromise(function(_0x398c0d,_0x1e9dd8){return client[_0x08ee('0x4')](_0x403eb1,_0x1f7adf)[_0x08ee('0x5')](function(_0x1c0bad){if(_0x1c0bad[_0x08ee('0x6')]){return _0x1e9dd8(_0x1c0bad[_0x08ee('0x6')][_0x08ee('0x7')]);}else{return _0x398c0d(_0x1c0bad[_0x08ee('0x8')]);}})[_0x08ee('0x9')](function(_0x9cca){return _0x1e9dd8(_0x9cca);});});}exports[_0x08ee('0xa')]=function(_0x57edbd,_0x4de22d){return request(_0x08ee('0xb'),{'account':_0x57edbd,'message':_0x4de22d});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 72992d9..e4b143d 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 _0xbf31=['util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','exports'];(function(_0x23781a,_0x37897){var _0xe2b19b=function(_0x1d09fb){while(--_0x1d09fb){_0x23781a['push'](_0x23781a['shift']());}};_0xe2b19b(++_0x37897);}(_0xbf31,0x10a));var _0x1bf3=function(_0x2a883b,_0x440afe){_0x2a883b=_0x2a883b-0x0;var _0x1196b1=_0xbf31[_0x2a883b];return _0x1196b1;};'use strict';var util=require(_0x1bf3('0x0'));var Transform=require(_0x1bf3('0x1'))[_0x1bf3('0x2')];function AGIReply(_0x312f1c){Transform[_0x1bf3('0x3')](this,_0x312f1c);this[_0x1bf3('0x4')]='';this[_0x1bf3('0x5')]=![];}util[_0x1bf3('0x6')](AGIReply,Transform);AGIReply[_0x1bf3('0x7')][_0x1bf3('0x8')]=function(_0x4f40e2,_0x269cb4,_0x58624c){var _0x41ec3c='\x0a',_0x10d834=['\x0a\x0a',_0x1bf3('0x9')],_0x571b24=-0x1,_0x34e2e3=-0x1,_0x1e5a42='',_0xc70fd5=0x0,_0x22ebbf='',_0x12dd2b='';this[_0x1bf3('0x4')]+=_0x4f40e2[_0x1bf3('0xa')]();_0x22ebbf=this['_localBuffer'];if(!this['_inBody']){_0xc70fd5=0x0;while(_0x10d834[_0xc70fd5]){while((_0x34e2e3=_0x22ebbf[_0x1bf3('0xb')](_0x10d834[_0xc70fd5]))!=-0x1){_0x1e5a42=_0x10d834[_0xc70fd5];_0x12dd2b=_0x22ebbf['substring'](0x0,_0x34e2e3);_0x22ebbf=_0x22ebbf[_0x1bf3('0xc')](_0x34e2e3+_0x1e5a42[_0x1bf3('0xd')]);var _0x213bfc=_0x12dd2b['split'](_0x41ec3c),_0x40dc47=0x0,_0x302f3b={},_0x149514='',_0xdb49e5='',_0x51221a=-0x1;while(_0x213bfc[_0x40dc47]){_0x51221a=_0x213bfc[_0x40dc47][_0x1bf3('0xb')](':');if(_0x51221a!=-0x1){_0x149514=_0x213bfc[_0x40dc47][_0x1bf3('0xe')](0x0,_0x51221a)[_0x1bf3('0xf')]();_0xdb49e5=_0x213bfc[_0x40dc47][_0x1bf3('0xe')](_0x51221a+0x1)[_0x1bf3('0xf')]();if(_0x149514[_0x1bf3('0xd')]>0x0){_0x302f3b[_0x149514]=_0xdb49e5;}}else{}_0x40dc47++;}this[_0x1bf3('0x10')](_0x1bf3('0x11'),_0x302f3b);this[_0x1bf3('0x5')]=!![];}_0xc70fd5++;}this['_localBuffer']=_0x22ebbf;}else{while((_0x571b24=_0x22ebbf['indexOf'](_0x41ec3c))!=-0x1){_0x12dd2b=_0x22ebbf[_0x1bf3('0xc')](0x0,_0x571b24);this['emit']('line',_0x12dd2b);_0x22ebbf=_0x22ebbf[_0x1bf3('0xc')](_0x571b24+_0x41ec3c[_0x1bf3('0xd')]);}this[_0x1bf3('0x4')]=_0x22ebbf;}_0x58624c();};module[_0x1bf3('0x12')]=AGIReply; \ No newline at end of file +var _0x3f8c=['headers','_inBody','line','exports','Transform','call','_localBuffer','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit'];(function(_0x2d23f1,_0x19c0f4){var _0x54b7f4=function(_0x55a99a){while(--_0x55a99a){_0x2d23f1['push'](_0x2d23f1['shift']());}};_0x54b7f4(++_0x19c0f4);}(_0x3f8c,0x104));var _0xc3f8=function(_0x10d6f4,_0x4858b9){_0x10d6f4=_0x10d6f4-0x0;var _0x477608=_0x3f8c[_0x10d6f4];return _0x477608;};'use strict';var util=require('util');var Transform=require('stream')[_0xc3f8('0x0')];function AGIReply(_0x3a1f6a){Transform[_0xc3f8('0x1')](this,_0x3a1f6a);this[_0xc3f8('0x2')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x51b8b5,_0x249286,_0x1a6976){var _0x3a4e2f='\x0a',_0x44c25d=['\x0a\x0a',_0xc3f8('0x3')],_0x2bbaa5=-0x1,_0x15512a=-0x1,_0x51093a='',_0x28397e=0x0,_0x315dff='',_0x15cb3b='';this[_0xc3f8('0x2')]+=_0x51b8b5[_0xc3f8('0x4')]();_0x315dff=this[_0xc3f8('0x2')];if(!this['_inBody']){_0x28397e=0x0;while(_0x44c25d[_0x28397e]){while((_0x15512a=_0x315dff[_0xc3f8('0x5')](_0x44c25d[_0x28397e]))!=-0x1){_0x51093a=_0x44c25d[_0x28397e];_0x15cb3b=_0x315dff[_0xc3f8('0x6')](0x0,_0x15512a);_0x315dff=_0x315dff[_0xc3f8('0x6')](_0x15512a+_0x51093a[_0xc3f8('0x7')]);var _0x58118f=_0x15cb3b[_0xc3f8('0x8')](_0x3a4e2f),_0x313714=0x0,_0x28e4c7={},_0x256e3d='',_0x155c80='',_0x511763=-0x1;while(_0x58118f[_0x313714]){_0x511763=_0x58118f[_0x313714][_0xc3f8('0x5')](':');if(_0x511763!=-0x1){_0x256e3d=_0x58118f[_0x313714][_0xc3f8('0x9')](0x0,_0x511763)[_0xc3f8('0xa')]();_0x155c80=_0x58118f[_0x313714][_0xc3f8('0x9')](_0x511763+0x1)[_0xc3f8('0xa')]();if(_0x256e3d[_0xc3f8('0x7')]>0x0){_0x28e4c7[_0x256e3d]=_0x155c80;}}else{}_0x313714++;}this[_0xc3f8('0xb')](_0xc3f8('0xc'),_0x28e4c7);this[_0xc3f8('0xd')]=!![];}_0x28397e++;}this[_0xc3f8('0x2')]=_0x315dff;}else{while((_0x2bbaa5=_0x315dff[_0xc3f8('0x5')](_0x3a4e2f))!=-0x1){_0x15cb3b=_0x315dff[_0xc3f8('0x6')](0x0,_0x2bbaa5);this['emit'](_0xc3f8('0xe'),_0x15cb3b);_0x315dff=_0x315dff['substring'](_0x2bbaa5+_0x3a4e2f['length']);}this[_0xc3f8('0x2')]=_0x315dff;}_0x1a6976();};module[_0xc3f8('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index dae3d6d..5c02b14 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 _0xd91a=['dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc'];(function(_0x2050f7,_0x3833c6){var _0x219da1=function(_0x554dc1){while(--_0x554dc1){_0x2050f7['push'](_0x2050f7['shift']());}};_0x219da1(++_0x3833c6);}(_0xd91a,0x13e));var _0xad91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd91a[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xad91('0x0'));var moment=require(_0xad91('0x1'));var _=require(_0xad91('0x2'));var util=require(_0xad91('0x3'));var jayson=require(_0xad91('0x4'));var client=jayson[_0xad91('0x5')]['http']({'port':0x2329});function request(_0x5ec4e9,_0x4ec043){return new BPromise(function(_0x4d5ec3,_0xaa0164){return client[_0xad91('0x6')](_0x5ec4e9,_0x4ec043)[_0xad91('0x7')](function(_0x3f4591){if(_0x3f4591[_0xad91('0x8')]){return _0xaa0164(_0x3f4591[_0xad91('0x8')][_0xad91('0x9')]);}else{return _0x4d5ec3(_0x3f4591[_0xad91('0xa')]);}})[_0xad91('0xb')](function(_0x38e186){return _0xaa0164(_0x38e186);});});}exports[_0xad91('0xc')]=function(_0x348e3b){return request(_0xad91('0xd'),{'options':{'raw':![],'where':{'name':_0x348e3b},'attributes':[_0xad91('0xe')]}});};exports['getMailAccountById']=function(_0x160ba0){return request(_0xad91('0xf'),{'options':{'raw':![],'where':{'id':_0x160ba0},'include':[{'model':_0xad91('0x10'),'as':_0xad91('0x11')}],'attributes':['id',_0xad91('0x12'),'email']}});};exports[_0xad91('0x13')]=function(_0xeb52b3){return request(_0xad91('0xd'),{'options':{'where':{'id':_0xeb52b3},'attributes':[_0xad91('0x12')]}});};exports['getVoiceQueueById']=function(_0x1adc65){return request(_0xad91('0x14'),{'options':{'where':{'id':_0x1adc65},'attributes':['name']}});};exports[_0xad91('0x15')]=function(_0x57e1db){return request('ShowVariable',{'options':{'where':{'id':_0x57e1db},'attributes':['name']}});};exports[_0xad91('0x16')]=function(_0x4868e3){return request(_0xad91('0x17'),{'options':{'where':{'id':_0x4868e3},'attributes':[_0xad91('0x18')]}});};exports[_0xad91('0x19')]=function(_0x182c28){return request(_0xad91('0x1a'),{'options':{'where':{'id':_0x182c28},'attributes':[_0xad91('0x12')]}});};exports[_0xad91('0x1b')]=function(_0x3474b5){return request(_0xad91('0x1c'),{'options':{'where':{'id':_0x3474b5},'attributes':[_0xad91('0x12')]}});};exports[_0xad91('0x1d')]=function(_0x5931bf){return request('ShowSound',{'options':{'where':{'id':_0x5931bf},'attributes':[_0xad91('0x1e')]}});};exports[_0xad91('0x1f')]=function(_0x1225f7){return request(_0xad91('0x20'),{'options':{'raw':![],'where':{'id':_0x1225f7},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x111043){return request(_0xad91('0x21'),{'options':{'where':{'id':_0x111043},'attributes':['id',_0xad91('0x12')]}});};exports[_0xad91('0x22')]=function(_0x39d12c){return request(_0xad91('0x23'),{'body':_0x39d12c});};exports[_0xad91('0x24')]=function(_0x200b6d){return request(_0xad91('0x25'),{'body':_0x200b6d});};exports[_0xad91('0x26')]=function(_0x1d2e9f){return request(_0xad91('0x27'),{'body':_[_0xad91('0x28')](_0x1d2e9f,{'project_name':_0x1d2e9f['arg_1'],'prev_project_name':_0x1d2e9f['arg_2']||'','is_subproject':_0x1d2e9f[_0xad91('0x29')]?!![]:![],'leaveAt':moment()['format'](_0xad91('0x2a'))})});};exports[_0xad91('0x2b')]=function(_0x4da87a){return request(_0xad91('0x2c'),{'body':_0x4da87a});};exports['createSquareMessage']=function(_0x48c2df){return request('CreateSquareMessage',{'body':_0x48c2df});};exports[_0xad91('0x2d')]=function(_0x10a0e7){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x10a0e7[_0xad91('0x2e')],'ListId':_0x10a0e7[_0xad91('0x2f')]}}})[_0xad91('0x7')](function(_0x4f8dad){if(_0x4f8dad){return _0x4f8dad;}return request('CreateCmContact',{'body':_0x10a0e7});});};exports[_0xad91('0x30')]=function(_0x6b27e4){return request('ShowPause',{'options':{'where':{'id':_0x6b27e4},'attributes':[_0xad91('0x12')]}});};exports[_0xad91('0x31')]=function(_0x1c72fa,_0x4e8bc1){return request(_0xad91('0x32'),{'body':{'interface':_0x4e8bc1},'options':{'where':_0x1c72fa}});};exports[_0xad91('0x33')]=function(_0xb91109,_0x212f21,_0xc0c4f6){return request(_0xad91('0x34'),{'body':{'type':_0x212f21,'uniqueid':_0xc0c4f6},'options':{'where':_0xb91109}});};exports[_0xad91('0x35')]=function(_0x18f126){return request(_0xad91('0x36'),{'body':{},'options':{'where':_0x18f126}});};exports[_0xad91('0x37')]=function(_0x45f4e0){return request(_0xad91('0x38'),{'body':{},'options':{'where':_0x45f4e0}});}; \ No newline at end of file +var _0xe770=['ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','http','request','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById'];(function(_0x4f1afe,_0x29a790){var _0x552767=function(_0x89caf1){while(--_0x89caf1){_0x4f1afe['push'](_0x4f1afe['shift']());}};_0x552767(++_0x29a790);}(_0xe770,0x67));var _0x0e77=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe770[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x0e77('0x0'));var moment=require(_0x0e77('0x1'));var _=require(_0x0e77('0x2'));var util=require(_0x0e77('0x3'));var jayson=require(_0x0e77('0x4'));var client=jayson[_0x0e77('0x5')][_0x0e77('0x6')]({'port':0x2329});function request(_0xe2d30f,_0x26af07){return new BPromise(function(_0x4a97db,_0x38c9cb){return client[_0x0e77('0x7')](_0xe2d30f,_0x26af07)['then'](function(_0x14242a){if(_0x14242a['error']){return _0x38c9cb(_0x14242a[_0x0e77('0x8')][_0x0e77('0x9')]);}else{return _0x4a97db(_0x14242a[_0x0e77('0xa')]);}})['catch'](function(_0x1da8d6){return _0x38c9cb(_0x1da8d6);});});}exports[_0x0e77('0xb')]=function(_0x510164){return request(_0x0e77('0xc'),{'options':{'raw':![],'where':{'name':_0x510164},'attributes':[_0x0e77('0xd')]}});};exports[_0x0e77('0xe')]=function(_0x438f6b){return request(_0x0e77('0xf'),{'options':{'raw':![],'where':{'id':_0x438f6b},'include':[{'model':_0x0e77('0x10'),'as':_0x0e77('0x11')}],'attributes':['id',_0x0e77('0x12'),_0x0e77('0x13')]}});};exports[_0x0e77('0x14')]=function(_0x467a94){return request(_0x0e77('0xc'),{'options':{'where':{'id':_0x467a94},'attributes':[_0x0e77('0x12')]}});};exports[_0x0e77('0x15')]=function(_0x3efacb){return request(_0x0e77('0x16'),{'options':{'where':{'id':_0x3efacb},'attributes':[_0x0e77('0x12')]}});};exports[_0x0e77('0x17')]=function(_0x510517){return request(_0x0e77('0x18'),{'options':{'where':{'id':_0x510517},'attributes':[_0x0e77('0x12')]}});};exports[_0x0e77('0x19')]=function(_0x5873ae){return request(_0x0e77('0x1a'),{'options':{'where':{'id':_0x5873ae},'attributes':[_0x0e77('0x1b')]}});};exports['getUserById']=function(_0x5f1cb9){return request('ShowUser',{'options':{'where':{'id':_0x5f1cb9},'attributes':[_0x0e77('0x12')]}});};exports[_0x0e77('0x1c')]=function(_0x294a08){return request(_0x0e77('0x1d'),{'options':{'where':{'id':_0x294a08},'attributes':[_0x0e77('0x12')]}});};exports[_0x0e77('0x1e')]=function(_0x4c669d){return request(_0x0e77('0x1f'),{'options':{'where':{'id':_0x4c669d},'attributes':[_0x0e77('0x20')]}});};exports[_0x0e77('0x21')]=function(_0x158161){return request(_0x0e77('0x22'),{'options':{'raw':![],'where':{'id':_0x158161},'include':[{'model':_0x0e77('0x23'),'as':_0x0e77('0x24')}]}});};exports['getSmsAccountById']=function(_0x3c930e){return request(_0x0e77('0x25'),{'options':{'where':{'id':_0x3c930e},'attributes':['id',_0x0e77('0x12')]}});};exports['createSmsMessage']=function(_0x25213b){return request('CreateSmsMessage',{'body':_0x25213b});};exports[_0x0e77('0x26')]=function(_0x24dfb7){return request(_0x0e77('0x27'),{'body':_0x24dfb7});};exports['createSquareReport']=function(_0x10efe1){return request(_0x0e77('0x28'),{'body':_['merge'](_0x10efe1,{'project_name':_0x10efe1[_0x0e77('0x29')],'prev_project_name':_0x10efe1['arg_2']||'','is_subproject':_0x10efe1[_0x0e77('0x2a')]?!![]:![],'leaveAt':moment()[_0x0e77('0x2b')](_0x0e77('0x2c'))})});};exports[_0x0e77('0x2d')]=function(_0x4cd273){return request('CreateSquareRecording',{'body':_0x4cd273});};exports['createSquareMessage']=function(_0x574bfd){return request(_0x0e77('0x2e'),{'body':_0x574bfd});};exports['createCmContact']=function(_0x597aab){return request(_0x0e77('0x2f'),{'options':{'raw':![],'where':{'phone':_0x597aab[_0x0e77('0x30')],'ListId':_0x597aab[_0x0e77('0x31')]}}})[_0x0e77('0x32')](function(_0x2486b7){if(_0x2486b7){return _0x2486b7;}return request(_0x0e77('0x33'),{'body':_0x597aab});});};exports[_0x0e77('0x34')]=function(_0x3cf3f){return request(_0x0e77('0x35'),{'options':{'where':{'id':_0x3cf3f},'attributes':['name']}});};exports[_0x0e77('0x36')]=function(_0x1cae32,_0x4f66f2){return request(_0x0e77('0x37'),{'body':{'interface':_0x4f66f2},'options':{'where':_0x1cae32}});};exports['agentPause']=function(_0x4e4fdf,_0x453f6c,_0x3891e9){return request('PauseUser',{'body':{'type':_0x453f6c,'uniqueid':_0x3891e9},'options':{'where':_0x4e4fdf}});};exports[_0x0e77('0x38')]=function(_0xcdc0b9){return request(_0x0e77('0x39'),{'body':{},'options':{'where':_0xcdc0b9}});};exports[_0x0e77('0x3a')]=function(_0x552181){return request('LogoutUser',{'body':{},'options':{'where':_0x552181}});}; \ 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 091f54a..58e8e45 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 _0xd9a8=['./polly','./lex','exports'];(function(_0x1a4d90,_0x1c0fac){var _0x23e845=function(_0xfc4c95){while(--_0xfc4c95){_0x1a4d90['push'](_0x1a4d90['shift']());}};_0x23e845(++_0x1c0fac);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x342cb9,_0x42ba68){_0x342cb9=_0x342cb9-0x0;var _0x9456bc=_0xd9a8[_0x342cb9];return _0x9456bc;};var polly=require(_0x8d9a('0x0'));var lex=require(_0x8d9a('0x1'));module[_0x8d9a('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x8efc=['exports'];(function(_0x399053,_0x3248cf){var _0x322594=function(_0x18c1b4){while(--_0x18c1b4){_0x399053['push'](_0x399053['shift']());}};_0x322594(++_0x3248cf);}(_0x8efc,0x8f));var _0xc8ef=function(_0x1c3386,_0x2868c0){_0x1c3386=_0x1c3386-0x0;var _0x2cc8e9=_0x8efc[_0x1c3386];return _0x2cc8e9;};var polly=require('./polly');var lex=require('./lex');module[_0xc8ef('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 4013ebd..0dcf46b 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 _0xa571=['exports','./lib/api'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0xa571,0x107));var _0x1a57=function(_0x1cb574,_0x318720){_0x1cb574=_0x1cb574-0x0;var _0x3f11a5=_0xa571[_0x1cb574];return _0x3f11a5;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file +var _0xf4eb=['./lib/api'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x143f84,_0x57273a){_0x143f84=_0x143f84-0x0;var _0x214255=_0xf4eb[_0x143f84];return _0x214255;};'use strict';var lex=require(_0xbf4e('0x0'));module['exports']=function(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7){return lex(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 31a7928..3bfafe6 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(_0x3df3c6,_0x496e1a){var _0x254c43=function(_0x371daa){while(--_0x371daa){_0x3df3c6['push'](_0x3df3c6['shift']());}};_0x254c43(++_0x496e1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x127910,_0x278aaf){var _0x1643da=function(_0x3d3091){while(--_0x3d3091){_0x127910['push'](_0x127910['shift']());}};_0x1643da(++_0x278aaf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 bb33d20..1c57eb7 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 _0x701b=['./lib/api','exports'];(function(_0x5a1fc7,_0x27e395){var _0x383243=function(_0x12e720){while(--_0x12e720){_0x5a1fc7['push'](_0x5a1fc7['shift']());}};_0x383243(++_0x27e395);}(_0x701b,0x1d0));var _0xb701=function(_0x47e771,_0x5763a1){_0x47e771=_0x47e771-0x0;var _0x4dcb00=_0x701b[_0x47e771];return _0x4dcb00;};'use strict';var polly=require(_0xb701('0x0'));module[_0xb701('0x1')]=function(_0x1007ab,_0x9a33d2,_0x1f9bba,_0x2c2623,_0x456936,_0x10431a,_0x4dceaf){return polly(_0x1007ab,_0x9a33d2,_0x1f9bba,_0x2c2623,_0x456936,_0x10431a,_0x4dceaf);}; \ No newline at end of file +var _0xd163=['exports','./lib/api'];(function(_0xb97efc,_0x1243fe){var _0x4a6e4a=function(_0x3dae65){while(--_0x3dae65){_0xb97efc['push'](_0xb97efc['shift']());}};_0x4a6e4a(++_0x1243fe);}(_0xd163,0x1a9));var _0x3d16=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xd163[_0x52e0ee];return _0x32534c;};'use strict';var polly=require(_0x3d16('0x0'));module[_0x3d16('0x1')]=function(_0x4cc9d8,_0x12704d,_0x4a2e26,_0x4351b4,_0x30193f,_0xcc86a6,_0x1c6f2b){return polly(_0x4cc9d8,_0x12704d,_0x4a2e26,_0x4351b4,_0x30193f,_0xcc86a6,_0x1c6f2b);}; \ 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 380134e..21d1723 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 _0xc525=['synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','bluebird','randomstring','aws-sdk'];(function(_0x2cef2b,_0x35baa0){var _0x3e0838=function(_0x4a991d){while(--_0x4a991d){_0x2cef2b['push'](_0x2cef2b['shift']());}};_0x3e0838(++_0x35baa0);}(_0xc525,0xdd));var _0x5c52=function(_0x1ba1c0,_0x5f4307){_0x1ba1c0=_0x1ba1c0-0x0;var _0x35436e=_0xc525[_0x1ba1c0];return _0x35436e;};'use strict';var fs=require('fs');var path=require(_0x5c52('0x0'));var BPromise=require(_0x5c52('0x1'));var rs=require(_0x5c52('0x2'));var AWS=require(_0x5c52('0x3'));function pollyResult(_0x5a7f9e,_0x437585,_0x3e9ddf){return new BPromise(function(_0x506f9e,_0x413d15){_0x5a7f9e[_0x5c52('0x4')](_0x437585,function(_0x5c9213,_0x5a2437){if(_0x5c9213){_0x413d15(_0x5c9213);}else if(_0x5a2437){if(_0x5a2437['AudioStream']instanceof Buffer){fs['writeFile'](_0x3e9ddf,_0x5a2437[_0x5c52('0x5')],function(_0x426800){if(_0x426800){_0x413d15(_0x426800);}else{_0x506f9e();}});}else{_0x413d15(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x413d15(new Error(_0x5c52('0x6')));}});});}module['exports']=function(_0x2f40e3,_0x1a75d3,_0x5b12d5,_0x13fcd7,_0x4fa07b,_0x54d706,_0x16b324){var _0x5b4ba8=new AWS[(_0x5c52('0x7'))]({'accessKeyId':_0x2f40e3,'secretAccessKey':_0x1a75d3,'region':_0x5b12d5});var _0xa6285f={'Text':_0x4fa07b,'TextType':_0x54d706||_0x5c52('0x8'),'OutputFormat':'mp3','VoiceId':_0x13fcd7};return pollyResult(_0x5b4ba8,_0xa6285f,_0x16b324);}; \ No newline at end of file +var _0x4fa0=['Polly','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x312181,_0x1e3d48){var _0x1ec92d=function(_0x3f1210){while(--_0x3f1210){_0x312181['push'](_0x312181['shift']());}};_0x1ec92d(++_0x1e3d48);}(_0x4fa0,0xbd));var _0x04fa=function(_0x2c492c,_0x50e279){_0x2c492c=_0x2c492c-0x0;var _0x51c7f6=_0x4fa0[_0x2c492c];return _0x51c7f6;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x04fa('0x0'));var rs=require(_0x04fa('0x1'));var AWS=require(_0x04fa('0x2'));function pollyResult(_0x24d46f,_0xe6545,_0x37c046){return new BPromise(function(_0x5588a9,_0x2059e9){_0x24d46f[_0x04fa('0x3')](_0xe6545,function(_0x5860d8,_0x475ac9){if(_0x5860d8){_0x2059e9(_0x5860d8);}else if(_0x475ac9){if(_0x475ac9['AudioStream']instanceof Buffer){fs[_0x04fa('0x4')](_0x37c046,_0x475ac9[_0x04fa('0x5')],function(_0x2b32f0){if(_0x2b32f0){_0x2059e9(_0x2b32f0);}else{_0x5588a9();}});}else{_0x2059e9(new Error(_0x04fa('0x6')));}}else{_0x2059e9(new Error(_0x04fa('0x7')));}});});}module[_0x04fa('0x8')]=function(_0x1e1e66,_0x31f280,_0xe1804d,_0x49c052,_0xf4e7f0,_0x1022bb,_0x3e5e6b){var _0x40340f=new AWS[(_0x04fa('0x9'))]({'accessKeyId':_0x1e1e66,'secretAccessKey':_0x31f280,'region':_0xe1804d});var _0x3ba1de={'Text':_0xf4e7f0,'TextType':_0x1022bb||'text','OutputFormat':_0x04fa('0xa'),'VoiceId':_0x49c052};return pollyResult(_0x40340f,_0x3ba1de,_0x3e5e6b);}; \ 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 e32298a..9665d53 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 _0x146f=['exports','./lib/api'];(function(_0x22f94c,_0x33208a){var _0x2cf3e8=function(_0x405dd0){while(--_0x405dd0){_0x22f94c['push'](_0x22f94c['shift']());}};_0x2cf3e8(++_0x33208a);}(_0x146f,0xc3));var _0xf146=function(_0xa42909,_0x24e11a){_0xa42909=_0xa42909-0x0;var _0x5551ef=_0x146f[_0xa42909];return _0x5551ef;};'use strict';var asr=require(_0xf146('0x0'));module[_0xf146('0x1')]=function(_0x192ac9,_0x7599b2,_0x398c26,_0x2607ef){return asr(_0x192ac9,_0x7599b2,_0x398c26);}; \ No newline at end of file +var _0x0d40=['./lib/api','exports'];(function(_0xd80466,_0x5506d8){var _0x140f2d=function(_0x2a7f62){while(--_0x2a7f62){_0xd80466['push'](_0xd80466['shift']());}};_0x140f2d(++_0x5506d8);}(_0x0d40,0x14c));var _0x00d4=function(_0x469104,_0x42c4ae){_0x469104=_0x469104-0x0;var _0x3f4a27=_0x0d40[_0x469104];return _0x3f4a27;};'use strict';var asr=require(_0x00d4('0x0'));module[_0x00d4('0x1')]=function(_0x47f547,_0x16a67c,_0x369b0d,_0xa19450){return asr(_0x47f547,_0x16a67c,_0x369b0d);}; \ 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 92f078a..e648096 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 _0x0e9f=['/v1/speech:recognize?key=','LINEAR16','url','bluebird','string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST'];(function(_0x22fee6,_0x395b9d){var _0x258622=function(_0x54e057){while(--_0x54e057){_0x22fee6['push'](_0x22fee6['shift']());}};_0x258622(++_0x395b9d);}(_0x0e9f,0x116));var _0xf0e9=function(_0x5ac03d,_0x148920){_0x5ac03d=_0x5ac03d-0x0;var _0x414f9a=_0x0e9f[_0x5ac03d];return _0x414f9a;};'use strict';var url=require(_0xf0e9('0x0'));var BPromise=require(_0xf0e9('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x15215f,_0x4c067c,_0x4b7f25){return new BPromise(function(_0x2d2d99,_0x559cad){var _0x52a19d;if(typeof _0x15215f!==_0xf0e9('0x2')||_0x15215f[_0xf0e9('0x3')]===0x0){return _0x559cad('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4c067c!==_0xf0e9('0x2')||_0x4c067c['length']===0x0){return _0x559cad(_0xf0e9('0x4'));}if(typeof _0x4b7f25!==_0xf0e9('0x5')&&(typeof _0x4b7f25!==_0xf0e9('0x2')||_0x4b7f25['length']===0x0)){return _0x559cad('lang\x20should\x20be\x20a\x20string');}try{_0x52a19d=fs[_0xf0e9('0x6')](_0x15215f)[_0xf0e9('0x7')](_0xf0e9('0x8'));}catch(_0x5071a4){return _0x559cad(_0x5071a4);}return _0x2d2d99({'method':_0xf0e9('0x9'),'uri':host+_0xf0e9('0xa')+_0x4c067c,'body':{'config':{'encoding':_0xf0e9('0xb'),'sampleRateHertz':'8000','languageCode':_0x4b7f25},'audio':{'content':_0x52a19d}},'json':!![]});});}; \ No newline at end of file +var _0x7dc2=['readFileSync','toString','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x16fa57,_0x5b65cd){var _0x2186d8=function(_0xbbf0b1){while(--_0xbbf0b1){_0x16fa57['push'](_0x16fa57['shift']());}};_0x2186d8(++_0x5b65cd);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x27dc('0x0');module[_0x27dc('0x1')]=function(_0x49a9e7,_0x426f56,_0x57d4b4){return new BPromise(function(_0x15d70c,_0x29ba23){var _0x52337b;if(typeof _0x49a9e7!==_0x27dc('0x2')||_0x49a9e7[_0x27dc('0x3')]===0x0){return _0x29ba23('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x426f56!==_0x27dc('0x2')||_0x426f56['length']===0x0){return _0x29ba23(_0x27dc('0x4'));}if(typeof _0x57d4b4!==_0x27dc('0x5')&&(typeof _0x57d4b4!=='string'||_0x57d4b4[_0x27dc('0x3')]===0x0)){return _0x29ba23(_0x27dc('0x6'));}try{_0x52337b=fs[_0x27dc('0x7')](_0x49a9e7)[_0x27dc('0x8')]('base64');}catch(_0x1d93ef){return _0x29ba23(_0x1d93ef);}return _0x15d70c({'method':'POST','uri':host+_0x27dc('0x9')+_0x426f56,'body':{'config':{'encoding':_0x27dc('0xa'),'sampleRateHertz':_0x27dc('0xb'),'languageCode':_0x57d4b4},'audio':{'content':_0x52337b}},'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 a58dd5d..1e6bbb7 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 _0xfa14=['exports'];(function(_0x480e1a,_0x3be65e){var _0x273822=function(_0xce7b33){while(--_0xce7b33){_0x480e1a['push'](_0x480e1a['shift']());}};_0x273822(++_0x3be65e);}(_0xfa14,0x19b));var _0x4fa1=function(_0x3452c5,_0x11829a){_0x3452c5=_0x3452c5-0x0;var _0x3d2172=_0xfa14[_0x3452c5];return _0x3d2172;};var asr=require('./asr');module[_0x4fa1('0x0')]={'asr':asr}; \ No newline at end of file +var _0x2bde=['exports'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x2bde,0x1ba));var _0xe2bd=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x2bde[_0x1beef3];return _0x5af964;};var asr=require('./asr');module[_0xe2bd('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 2d70d33..d20b5de 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 _0x905d=['isFallbackIntent','googleDialogflowV2','replace','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','querystring','randomstring','sox','google-tts-api','url','parse','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','path','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','WHAT_EVER','request\x20to\x20','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','text:synthesize','POST','then','.mp3','from','chmodSync','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','data','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','resolvedQuery','action','fulfillment','speech','score','status','code','metadata','endConversation'];(function(_0x29eb7e,_0x2694e8){var _0x4b5b8c=function(_0x22d998){while(--_0x22d998){_0x29eb7e['push'](_0x29eb7e['shift']());}};_0x4b5b8c(++_0x2694e8);}(_0x905d,0x1b0));var _0xd905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x905d[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require(_0xd905('0x0'));var BPromise=require(_0xd905('0x1'));var dialogflow=require(_0xd905('0x2'));var fs=require('fs');var http=require(_0xd905('0x3'));var https=require(_0xd905('0x4'));var md5=require('md5');var path=require('path');var querystring=require(_0xd905('0x5'));var rp=require('request-promise');var rs=require(_0xd905('0x6'));var sox=require(_0xd905('0x7'));var tts=require(_0xd905('0x8'));var urlParse=require(_0xd905('0x9'))[_0xd905('0xa')];var util=require('util');var aws=require('./aws');var google=require(_0xd905('0xb'));var sestek=require(_0xd905('0xc'));var tilde=require(_0xd905('0xd'));var logger=require('../../../config/logger')(_0xd905('0xe'));var ISPEECH_API=_0xd905('0xf');function downloadFile(_0x1171d1,_0x365df8){return new BPromise(function(_0x113926,_0x4c75bb){var _0x4beca0=urlParse(_0x1171d1);var _0x7c6c32=_0x4beca0[_0xd905('0x10')]==='https:'?https:http;var _0x3c160f={'host':_0x4beca0[_0xd905('0x11')],'path':_0x4beca0[_0xd905('0x12')],'headers':{'user-agent':'WHAT_EVER'}};_0x7c6c32[_0xd905('0x13')](_0x3c160f,function(_0x422f0a){if(_0x422f0a[_0xd905('0x14')]!==0xc8){logger[_0xd905('0x15')]('request\x20to\x20'+_0x1171d1+_0xd905('0x16')+_0x422f0a[_0xd905('0x14')]+'\x20('+_0x422f0a['statusMessage']+')');_0x4c75bb(new Error('request\x20to\x20'+_0x1171d1+_0xd905('0x16')+_0x422f0a[_0xd905('0x14')]+'\x20('+_0x422f0a[_0xd905('0x17')]+')'));return;}var _0x2c9cf7=fs[_0xd905('0x18')](_0x365df8);_0x2c9cf7['on']('finish',function(){logger[_0xd905('0x19')](_0xd905('0x1a'));_0x2c9cf7[_0xd905('0x1b')](_0x113926);});_0x2c9cf7['on'](_0xd905('0x15'),function(_0x1720fb){fs[_0xd905('0x1c')](_0x365df8);logger[_0xd905('0x15')](_0xd905('0x1d'),_0x1720fb);_0x4c75bb(_0x1720fb);});_0x422f0a[_0xd905('0x1e')](_0x2c9cf7);})['on'](_0xd905('0x15'),function(_0x20cedd){logger[_0xd905('0x15')](_0x20cedd);_0x4c75bb(_0x20cedd);})[_0xd905('0x1f')]();});}function uploadFile(_0x261300){return new BPromise(function(_0x2bfc6f,_0x53ec0d){var _0x246e8c=urlParse(_0x261300);var _0x4eb846=_0x246e8c[_0xd905('0x10')]==='https:'?https:http;var _0x43d372={'host':_0x246e8c['host'],'path':_0x246e8c[_0xd905('0x12')],'headers':{'user-agent':_0xd905('0x20')}};_0x4eb846['get'](_0x43d372,function(_0x1fbd5a){if(_0x1fbd5a[_0xd905('0x14')]!==0xc8){_0x53ec0d(new Error(_0xd905('0x21')+_0x261300+_0xd905('0x16')+_0x1fbd5a[_0xd905('0x14')]+'\x20('+_0x1fbd5a[_0xd905('0x17')]+')'));return;}var _0x16253a='';_0x1fbd5a['on']('data',function(_0x1a30db){_0x16253a+=_0x1a30db;});_0x1fbd5a['on'](_0xd905('0x1f'),function(){_0x2bfc6f(_0x16253a);});})['on'](_0xd905('0x15'),function(_0x48f4e9){_0x53ec0d(_0x48f4e9);})[_0xd905('0x1f')]();});}function convertFile(_0x1721cd,_0x129b94){return new BPromise(function(_0xe9b864,_0x51a641){var _0x1fb7e1=sox['transcode'](_0x1721cd,_0x129b94,{'sampleRate':0x1f40,'format':_0xd905('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1fb7e1['on'](_0xd905('0x15'),function(_0x128a65){logger['error'](_0xd905('0x23'),_0x128a65);_0x51a641(_0x128a65);});_0x1fb7e1['on'](_0xd905('0x1f'),function(){logger['info'](_0xd905('0x24'));_0xe9b864();});_0x1fb7e1['start']();});}function base64Decode(_0x3c67a1,_0x4056c7){var _0xa302e8=path[_0xd905('0x25')](__dirname,_0xd905('0x26'),rs[_0xd905('0x27')](0x4)+_0xd905('0x28'));fs[_0xd905('0x29')](_0xa302e8,_0x3c67a1,_0xd905('0x2a'));return convertFile(_0xa302e8,_0x4056c7)['then'](function(){try{fs['unlink'](_0xa302e8);fs['chmodSync'](_0x4056c7,_0xd905('0x2b'));}catch(_0x19b828){logger[_0xd905('0x15')](_0x19b828);}return _0x4056c7[_0xd905('0x2c')]('.')[0x0];});}function base64Encode(_0x295a9b){var _0xe61a52=fs['readFileSync'](_0x295a9b);return new Buffer(_0xe61a52)[_0xd905('0x2d')](_0xd905('0x2a'));}exports[_0xd905('0x2e')]=function(_0x36f449,_0x3cbb87,_0x5792ca,_0xbd4ec9,_0x259b46,_0x4682a4){var _0x20145f,_0x452107;var _0x472832=_0xd905('0x2f');var _0x6cfdcb='?key='+_0x36f449;var _0x1cb010={};if(_0x3cbb87===_0xd905('0x30')){_0x1cb010[_0xd905('0x31')]={'ssml':_0x5792ca};}else{_0x1cb010[_0xd905('0x31')]={'text':_0x5792ca};};_0x1cb010[_0xd905('0x32')]={'languageCode':_0xbd4ec9,'ssmlGender':_0x259b46};_0x1cb010[_0xd905('0x33')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0xa0dc81={'url':_0x472832+_0xd905('0x34')+_0x6cfdcb,'method':_0xd905('0x35'),'json':!![],'body':_0x1cb010};return rp(_0xa0dc81)[_0xd905('0x36')](function(_0x5b3156){return new BPromise(function(_0x19603a,_0x13b2f6){_0x20145f=path[_0xd905('0x25')](__dirname,_0xd905('0x26'),rs[_0xd905('0x27')](0x4)+_0xd905('0x37'));var _0x26e3da=Buffer[_0xd905('0x38')](_0x5b3156['audioContent'],_0xd905('0x2a'));return fs['writeFile'](_0x20145f,_0x26e3da,function(_0x4854ee){_0x13b2f6(_0x4854ee);},function(_0x4f881a){fs[_0xd905('0x39')](_0x20145f,_0xd905('0x2b'));_0x19603a(_0x4f881a);});});})[_0xd905('0x36')](function(_0x584980){_0x452107=path[_0xd905('0x25')](__dirname,_0xd905('0x26'),rs[_0xd905('0x27')](0x4)+'.wav');return convertFile(_0x20145f,_0x452107);})['then'](function(){try{fs[_0xd905('0x1c')](_0x20145f);fs[_0xd905('0x39')](_0x452107,'777');}catch(_0x542709){logger[_0xd905('0x15')](_0x542709);}logger[_0xd905('0x19')]('googleCloudTTS\x20path',_0x452107[_0xd905('0x2c')]('.')[0x0]);return _0x452107[_0xd905('0x2c')]('.')[0x0];});};exports[_0xd905('0x3a')]=function(_0x1af782,_0x5ec7f2){var _0x3d7eae=_0xd905('0x3b');var _0x440eae,_0xb08814;var _0xfcc33;var _0x12bf58={'encoding':'utf8','method':_0xd905('0x35'),'timeout':0x2710,'url':_0x3d7eae,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xd905('0x3c'),JSON[_0xd905('0x3d')]([_0x1af782,_0x5ec7f2||'en',![],_0xd905('0x3e')]),null,_0xd905('0x3f')]]]))};return rp(_0x12bf58)['then'](function(_0x42ef75){try{_0xfcc33=eval(_0x42ef75[_0xd905('0x40')](0x5))[0x0][0x2];}catch(_0x3487f0){throw new Error(_0xd905('0x41')+_0x42ef75['data']);}if(!_0xfcc33){if(_0x1af782[_0xd905('0x42')]>0xc8){throw new Error(_0xd905('0x43'));}else{throw new Error('lang\x20\x22'+_0x5ec7f2+'\x22\x20might\x20not\x20exist');}}try{_0xfcc33=eval(_0xfcc33)[0x0];}catch(_0x2a180a){throw new Error(_0xd905('0x41')+res[_0xd905('0x44')]);}const _0x45f42e=_0xfcc33;_0x440eae=path[_0xd905('0x25')](__dirname,_0xd905('0x26'),rs[_0xd905('0x27')](0x4)+'.mp3');fs[_0xd905('0x29')](_0x440eae,_0xfcc33,{'encoding':'base64'});_0xb08814=path[_0xd905('0x25')](__dirname,_0xd905('0x26'),rs['generate'](0x4)+_0xd905('0x28'));return convertFile(_0x440eae,_0xb08814);})['then'](function(){try{fs['unlink'](_0x440eae);fs['chmodSync'](_0xb08814,'777');}catch(_0x2bd9f7){logger[_0xd905('0x15')](_0x2bd9f7);}logger['info'](_0xd905('0x45'),_0xb08814[_0xd905('0x2c')]('.')[0x0]);return _0xb08814[_0xd905('0x2c')]('.')[0x0];});};exports[_0xd905('0x46')]=function(_0x4cf293,_0x2d772c,_0x376e16){return google[_0xd905('0x47')](_0x4cf293,_0x2d772c,_0x376e16)['then'](function(_0x5dd8b3){logger[_0xd905('0x19')](_0x5dd8b3['uri']);return rp(_0x5dd8b3);})[_0xd905('0x36')](function(_0x59e6a5){var _0x3ffca0='';var _0x2f524e=0x0;try{fs[_0xd905('0x1c')](_0x4cf293);}catch(_0x39e222){logger[_0xd905('0x15')](_0x39e222);}if(_0x59e6a5&&_0x59e6a5[_0xd905('0x48')]){_0x3ffca0=_0x59e6a5[_0xd905('0x48')][_0xd905('0x49')](function(_0x2370ca){return _0x2370ca&&_0x2370ca[_0xd905('0x4a')][0x0]&&_0x2370ca[_0xd905('0x4a')][0x0]['transcript']?_0x2370ca[_0xd905('0x4a')][0x0][_0xd905('0x4b')]:'';})[_0xd905('0x4c')]('\x0a');_0x2f524e=_0x59e6a5[_0xd905('0x48')][_0xd905('0x49')](function(_0x404074){return _0x404074&&_0x404074['alternatives'][0x0]&&_0x404074['alternatives'][0x0]['confidence']?_0x404074[_0xd905('0x4a')][0x0][_0xd905('0x4d')]:0x0;})[_0xd905('0x4c')]('\x0a');}logger[_0xd905('0x19')](_0xd905('0x4e'),_0x3ffca0);logger[_0xd905('0x19')](_0xd905('0x4f'),_0x2f524e);return{'transcript':_0x3ffca0,'confidence':_0x2f524e};})[_0xd905('0x50')](function(_0x124793){logger['error'](_0xd905('0x51'),_0x124793[_0xd905('0x14')],_0x124793[_0xd905('0x52')],_0x124793[_0xd905('0x53')]);});};exports[_0xd905('0x54')]=function(_0x50ac38,_0x37c5fb,_0xf30d44,_0x46af81){var _0x3267c6=apiai(_0x37c5fb,{'language':_0x46af81||'en'});return _0x3267c6['textRequest'](_0xf30d44,{'sessionId':md5(_0x50ac38)})['then'](function(_0x38804d){logger[_0xd905('0x19')](JSON[_0xd905('0x3d')](_0x38804d));return{'source':_0x38804d['result'][_0xd905('0x55')],'resolvedQuery':_0x38804d[_0xd905('0x56')][_0xd905('0x57')],'action':_0x38804d[_0xd905('0x56')][_0xd905('0x58')],'actionIncomplete':_0x38804d[_0xd905('0x56')]['actionIncomplete'],'speech':_0x38804d[_0xd905('0x56')][_0xd905('0x59')][_0xd905('0x5a')],'score':_0x38804d[_0xd905('0x56')][_0xd905('0x5b')],'statusCode':_0x38804d[_0xd905('0x5c')][_0xd905('0x5d')],'endConversation':_0x38804d[_0xd905('0x56')][_0xd905('0x5e')][_0xd905('0x5f')]||![],'isFallbackIntent':_0x38804d[_0xd905('0x56')][_0xd905('0x5e')][_0xd905('0x60')]};});};exports[_0xd905('0x61')]=function(_0x38a2e0,_0x417e5f,_0x10cce4,_0x4e0e6f,_0x51a3b3,_0x55d976){var _0x3c3d8f=_0x4e0e6f[_0xd905('0x62')](/\\n/g,'\x0a');var _0x2df00d={'credentials':{'private_key':_0x3c3d8f,'client_email':_0x10cce4}};var _0x48b243=new dialogflow['SessionsClient'](_0x2df00d);var _0x279950=_0x48b243[_0xd905('0x63')](_0x417e5f,md5(_0x38a2e0));var _0x43419c={'session':_0x279950,'queryInput':{'text':{'text':_0x51a3b3,'languageCode':_0x55d976}}};return _0x48b243['detectIntent'](_0x43419c)[_0xd905('0x36')](function(_0x281a95){if(_0x281a95&&_0x281a95[_0xd905('0x42')]){logger[_0xd905('0x19')](_0xd905('0x64'),JSON[_0xd905('0x3d')](_0x281a95));var _0x52e75d=_0x281a95[0x0];if(_0x52e75d){var _0x4c12ed={'action':_0x52e75d[_0xd905('0x65')][_0xd905('0x58')],'allRequiredParamsPresent':_0x52e75d[_0xd905('0x65')][_0xd905('0x66')],'endConversation':_0x52e75d['queryResult'][_0xd905('0x67')]&&_0x52e75d[_0xd905('0x65')]['diagnosticInfo'][_0xd905('0x68')]?_0x52e75d[_0xd905('0x65')][_0xd905('0x67')][_0xd905('0x68')][_0xd905('0x69')][_0xd905('0x6a')]:![],'fulfillmentText':_0x52e75d[_0xd905('0x65')][_0xd905('0x6b')],'intentName':_0x52e75d[_0xd905('0x65')][_0xd905('0x6c')][_0xd905('0x52')],'intentDisplayName':_0x52e75d[_0xd905('0x65')]['intent'][_0xd905('0x6d')],'isFallbackIntent':_0x52e75d[_0xd905('0x65')][_0xd905('0x6c')][_0xd905('0x6e')],'languageCode':_0x52e75d[_0xd905('0x65')][_0xd905('0x6f')],'queryText':_0x52e75d[_0xd905('0x65')][_0xd905('0x70')],'responseId':_0x52e75d[_0xd905('0x71')],'score':_0x52e75d[_0xd905('0x65')][_0xd905('0x72')],'speech':_0x52e75d[_0xd905('0x65')][_0xd905('0x6b')],'providerResponse':JSON[_0xd905('0x3d')](_0x281a95)};return _0x4c12ed;}}});};exports[_0xd905('0x73')]=function(_0x489576,_0x44f2c5,_0x400904,_0x313d35){return tilde['asr'](_0x489576,_0x44f2c5,_0x400904,_0x313d35)[_0xd905('0x36')](function(_0x395ea6){try{fs[_0xd905('0x1c')](_0x489576);}catch(_0x44e798){logger['error'](_0x44e798);}logger[_0xd905('0x19')](_0xd905('0x74'),_0x395ea6[_0xd905('0x4b')]);logger['info'](_0xd905('0x75'),_0x395ea6[_0xd905('0x4d')]);return _0x395ea6;});};exports['awsPolly']=function(_0x52aeef,_0x35cc2f,_0x50ef65,_0x148bef,_0x22c747,_0x39b594){var _0x3d8714=path[_0xd905('0x25')](__dirname,'tmp',rs[_0xd905('0x27')](0x4)+'.mp3');var _0x16d984;return aws['polly'](_0x52aeef,_0x35cc2f,_0x50ef65,_0x148bef,_0x22c747,_0x39b594,_0x3d8714)[_0xd905('0x36')](function(){_0x16d984=path[_0xd905('0x25')](__dirname,_0xd905('0x26'),rs[_0xd905('0x27')](0x4)+_0xd905('0x28'));return convertFile(_0x3d8714,_0x16d984);})['then'](function(){try{fs['unlink'](_0x3d8714);fs['chmodSync'](_0x16d984,_0xd905('0x2b'));}catch(_0x2486ce){logger[_0xd905('0x15')](_0x2486ce);}return _0x16d984['split']('.')[0x0];});};exports[_0xd905('0x76')]=function(_0x48707a,_0x88eb52,_0xe3b3e9,_0x2b9850,_0x467090,_0x280af7){return aws[_0xd905('0x77')](_0x48707a,_0x88eb52,_0xe3b3e9,_0x2b9850,_0x467090,_0x280af7)[_0xd905('0x36')](function(_0x2a8114){logger['info'](JSON[_0xd905('0x3d')](_0x2a8114));return _0x2a8114;});};exports[_0xd905('0x78')]=function(_0x4c793b,_0xc644ae,_0x3a3830,_0x502f35){var _0x2f647d=util[_0xd905('0x79')](_0xd905('0x7a'),ISPEECH_API,_0x4c793b,encodeURIComponent(_0xc644ae),_0x3a3830,_0x502f35);var _0x12abf5=path['resolve'](__dirname,'tmp',rs[_0xd905('0x27')](0x4)+_0xd905('0x37'));var _0x42fea6;return downloadFile(_0x2f647d,_0x12abf5)['then'](function(){_0x42fea6=path[_0xd905('0x25')](__dirname,_0xd905('0x26'),rs['generate'](0x4)+_0xd905('0x28'));return convertFile(_0x12abf5,_0x42fea6);})[_0xd905('0x36')](function(){try{fs[_0xd905('0x1c')](_0x12abf5);fs[_0xd905('0x39')](_0x42fea6,_0xd905('0x2b'));}catch(_0x5e8fcf){logger[_0xd905('0x15')](_0x5e8fcf);}return _0x42fea6['split']('.')[0x0];});};exports[_0xd905('0x7b')]=function(_0x4eb90f,_0x5d0e08,_0x31651c,_0x8061ea){var _0x6bb844=util[_0xd905('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5d0e08,_0x31651c,base64Encode(_0x4eb90f),_0x8061ea?util['format']('model=%s',encodeURIComponent(_0x8061ea)):_0xd905('0x7c'));return uploadFile(_0x6bb844)[_0xd905('0x36')](function(_0x544e75){return querystring['parse'](_0x544e75);});};exports[_0xd905('0x7d')]=function(_0x55bf4b,_0x15c71a){return sestek['nda'](_0x55bf4b,_0x15c71a)[_0xd905('0x36')](function(_0x19cb58){logger[_0xd905('0x19')](JSON[_0xd905('0x3d')](_0x19cb58));var _0x246d0d={'speech':_0x19cb58[_0xd905('0x7e')],'action':_0x19cb58[_0xd905('0x7f')]?_0x19cb58[_0xd905('0x7f')][_0xd905('0x80')]:undefined,'actiondata':_0x19cb58[_0xd905('0x7f')]?_0x19cb58[_0xd905('0x7f')]['CustomActionData']:undefined};if(_0x19cb58[_0xd905('0x7f')]&&_0x19cb58[_0xd905('0x7f')][_0xd905('0x81')]){return base64Decode(_0x19cb58[_0xd905('0x7f')][_0xd905('0x81')]['Data'],path[_0xd905('0x25')](__dirname,'tmp',rs[_0xd905('0x27')](0x4)+'.wav'))[_0xd905('0x36')](function(_0x1f533f){_0x246d0d[_0xd905('0x82')]=_0x1f533f;return _0x246d0d;});}return _0x246d0d;});};exports[_0xd905('0x83')]=function(){return __dirname;}; \ No newline at end of file +var _0x7750=['statusMessage','createWriteStream','finish','close','unlink','download\x20error','pipe','end','https:','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','chmodSync','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','POST','.mp3','from','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','result','resolvedQuery','action','fulfillment','score','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','intent','name','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','asr','awsPolly','awsLex','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','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','./aws','./tilde','../../../config/logger','agi','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20'];(function(_0x3c768f,_0x187d00){var _0x45878c=function(_0x45b108){while(--_0x45b108){_0x3c768f['push'](_0x3c768f['shift']());}};_0x45878c(++_0x187d00);}(_0x7750,0x6a));var _0x0775=function(_0x2b3086,_0x1906e8){_0x2b3086=_0x2b3086-0x0;var _0x5c3531=_0x7750[_0x2b3086];return _0x5c3531;};'use strict';var apiai=require(_0x0775('0x0'));var BPromise=require(_0x0775('0x1'));var dialogflow=require(_0x0775('0x2'));var fs=require('fs');var http=require(_0x0775('0x3'));var https=require(_0x0775('0x4'));var md5=require(_0x0775('0x5'));var path=require(_0x0775('0x6'));var querystring=require(_0x0775('0x7'));var rp=require('request-promise');var rs=require(_0x0775('0x8'));var sox=require(_0x0775('0x9'));var tts=require(_0x0775('0xa'));var urlParse=require(_0x0775('0xb'))[_0x0775('0xc')];var util=require('util');var aws=require(_0x0775('0xd'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x0775('0xe'));var logger=require(_0x0775('0xf'))(_0x0775('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x4d810d,_0x5a4247){return new BPromise(function(_0x3e7c3f,_0x422f29){var _0x216717=urlParse(_0x4d810d);var _0x489c26=_0x216717[_0x0775('0x11')]==='https:'?https:http;var _0x4f6e7c={'host':_0x216717[_0x0775('0x12')],'path':_0x216717[_0x0775('0x6')],'headers':{'user-agent':_0x0775('0x13')}};_0x489c26[_0x0775('0x14')](_0x4f6e7c,function(_0x1db188){if(_0x1db188[_0x0775('0x15')]!==0xc8){logger[_0x0775('0x16')](_0x0775('0x17')+_0x4d810d+_0x0775('0x18')+_0x1db188[_0x0775('0x15')]+'\x20('+_0x1db188['statusMessage']+')');_0x422f29(new Error(_0x0775('0x17')+_0x4d810d+_0x0775('0x18')+_0x1db188[_0x0775('0x15')]+'\x20('+_0x1db188[_0x0775('0x19')]+')'));return;}var _0x498b69=fs[_0x0775('0x1a')](_0x5a4247);_0x498b69['on'](_0x0775('0x1b'),function(){logger['info']('finish\x20download\x20file');_0x498b69[_0x0775('0x1c')](_0x3e7c3f);});_0x498b69['on'](_0x0775('0x16'),function(_0xb80a36){fs[_0x0775('0x1d')](_0x5a4247);logger[_0x0775('0x16')](_0x0775('0x1e'),_0xb80a36);_0x422f29(_0xb80a36);});_0x1db188[_0x0775('0x1f')](_0x498b69);})['on'](_0x0775('0x16'),function(_0xd2b083){logger[_0x0775('0x16')](_0xd2b083);_0x422f29(_0xd2b083);})[_0x0775('0x20')]();});}function uploadFile(_0xa7d6aa){return new BPromise(function(_0xd6ca0d,_0x162605){var _0x47f8da=urlParse(_0xa7d6aa);var _0x25e330=_0x47f8da[_0x0775('0x11')]===_0x0775('0x21')?https:http;var _0x3fd51d={'host':_0x47f8da[_0x0775('0x12')],'path':_0x47f8da[_0x0775('0x6')],'headers':{'user-agent':_0x0775('0x13')}};_0x25e330['get'](_0x3fd51d,function(_0x521417){if(_0x521417[_0x0775('0x15')]!==0xc8){_0x162605(new Error(_0x0775('0x17')+_0xa7d6aa+_0x0775('0x18')+_0x521417[_0x0775('0x15')]+'\x20('+_0x521417[_0x0775('0x19')]+')'));return;}var _0x357a50='';_0x521417['on']('data',function(_0x284a5d){_0x357a50+=_0x284a5d;});_0x521417['on'](_0x0775('0x20'),function(){_0xd6ca0d(_0x357a50);});})['on']('error',function(_0x5adb1f){_0x162605(_0x5adb1f);})[_0x0775('0x20')]();});}function convertFile(_0x5e8f68,_0x3dd76c){return new BPromise(function(_0x1888af,_0x36a350){var _0x483ef1=sox[_0x0775('0x22')](_0x5e8f68,_0x3dd76c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x483ef1['on'](_0x0775('0x16'),function(_0x2a8111){logger[_0x0775('0x16')](_0x0775('0x23'),_0x2a8111);_0x36a350(_0x2a8111);});_0x483ef1['on'](_0x0775('0x20'),function(){logger[_0x0775('0x24')](_0x0775('0x25'));_0x1888af();});_0x483ef1[_0x0775('0x26')]();});}function base64Decode(_0x3f7468,_0x1c6fe8){var _0x4676a7=path[_0x0775('0x27')](__dirname,_0x0775('0x28'),rs[_0x0775('0x29')](0x4)+_0x0775('0x2a'));fs['writeFileSync'](_0x4676a7,_0x3f7468,'base64');return convertFile(_0x4676a7,_0x1c6fe8)[_0x0775('0x2b')](function(){try{fs[_0x0775('0x1d')](_0x4676a7);fs[_0x0775('0x2c')](_0x1c6fe8,_0x0775('0x2d'));}catch(_0x2abe4b){logger[_0x0775('0x16')](_0x2abe4b);}return _0x1c6fe8[_0x0775('0x2e')]('.')[0x0];});}function base64Encode(_0x6bd259){var _0x1afa65=fs['readFileSync'](_0x6bd259);return new Buffer(_0x1afa65)[_0x0775('0x2f')](_0x0775('0x30'));}exports[_0x0775('0x31')]=function(_0xaa9459,_0x544d31,_0x8c5bb6,_0x4514e2,_0x23a558,_0x90a76a){var _0x3a3efd,_0x2981e9;var _0x4f1d80=_0x0775('0x32');var _0x9b9e3c=_0x0775('0x33')+_0xaa9459;var _0xe35681={};if(_0x544d31===_0x0775('0x34')){_0xe35681[_0x0775('0x35')]={'ssml':_0x8c5bb6};}else{_0xe35681[_0x0775('0x35')]={'text':_0x8c5bb6};};_0xe35681[_0x0775('0x36')]={'languageCode':_0x4514e2,'ssmlGender':_0x23a558};_0xe35681['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x11f236={'url':_0x4f1d80+'text:synthesize'+_0x9b9e3c,'method':_0x0775('0x37'),'json':!![],'body':_0xe35681};return rp(_0x11f236)[_0x0775('0x2b')](function(_0x4f5b1a){return new BPromise(function(_0x2e641b,_0x197e2c){_0x3a3efd=path[_0x0775('0x27')](__dirname,'tmp',rs[_0x0775('0x29')](0x4)+_0x0775('0x38'));var _0x8ca14d=Buffer[_0x0775('0x39')](_0x4f5b1a['audioContent'],_0x0775('0x30'));return fs[_0x0775('0x3a')](_0x3a3efd,_0x8ca14d,function(_0x33a984){_0x197e2c(_0x33a984);},function(_0x3cf052){fs['chmodSync'](_0x3a3efd,_0x0775('0x2d'));_0x2e641b(_0x3cf052);});});})[_0x0775('0x2b')](function(_0x3b69cd){_0x2981e9=path[_0x0775('0x27')](__dirname,_0x0775('0x28'),rs[_0x0775('0x29')](0x4)+'.wav');return convertFile(_0x3a3efd,_0x2981e9);})[_0x0775('0x2b')](function(){try{fs['unlink'](_0x3a3efd);fs[_0x0775('0x2c')](_0x2981e9,_0x0775('0x2d'));}catch(_0x34946a){logger['error'](_0x34946a);}logger[_0x0775('0x24')](_0x0775('0x3b'),_0x2981e9['split']('.')[0x0]);return _0x2981e9[_0x0775('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x258ea0,_0x298d9c){var _0xff2b6d=_0x0775('0x3c');var _0x9fc3a6,_0x561b93;var _0x3c5cf9;var _0x4e4756={'encoding':'utf8','method':_0x0775('0x37'),'timeout':0x2710,'url':_0xff2b6d,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x0775('0x3d')+encodeURIComponent(JSON[_0x0775('0x3e')]([[[_0x0775('0x3f'),JSON['stringify']([_0x258ea0,_0x298d9c||'en',![],_0x0775('0x40')]),null,_0x0775('0x41')]]]))};return rp(_0x4e4756)['then'](function(_0x45c334){try{_0x3c5cf9=eval(_0x45c334[_0x0775('0x42')](0x5))[0x0][0x2];}catch(_0x46cf72){throw new Error(_0x0775('0x43')+_0x45c334['data']);}if(!_0x3c5cf9){if(_0x258ea0[_0x0775('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x0775('0x45')+_0x298d9c+_0x0775('0x46'));}}try{_0x3c5cf9=eval(_0x3c5cf9)[0x0];}catch(_0x2a77c6){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0xb8faf4=_0x3c5cf9;_0x9fc3a6=path[_0x0775('0x27')](__dirname,_0x0775('0x28'),rs['generate'](0x4)+_0x0775('0x38'));fs[_0x0775('0x47')](_0x9fc3a6,_0x3c5cf9,{'encoding':_0x0775('0x30')});_0x561b93=path[_0x0775('0x27')](__dirname,'tmp',rs[_0x0775('0x29')](0x4)+_0x0775('0x2a'));return convertFile(_0x9fc3a6,_0x561b93);})[_0x0775('0x2b')](function(){try{fs[_0x0775('0x1d')](_0x9fc3a6);fs[_0x0775('0x2c')](_0x561b93,_0x0775('0x2d'));}catch(_0x1fe1b0){logger[_0x0775('0x16')](_0x1fe1b0);}logger[_0x0775('0x24')]('goggleTTS\x20path',_0x561b93[_0x0775('0x2e')]('.')[0x0]);return _0x561b93[_0x0775('0x2e')]('.')[0x0];});};exports[_0x0775('0x48')]=function(_0x29c2dd,_0x2e13ef,_0x4c3f7f){return google['asr'](_0x29c2dd,_0x2e13ef,_0x4c3f7f)[_0x0775('0x2b')](function(_0x56975a){logger['info'](_0x56975a[_0x0775('0x49')]);return rp(_0x56975a);})[_0x0775('0x2b')](function(_0x9d55b2){var _0x48666b='';var _0x14fc97=0x0;try{fs[_0x0775('0x1d')](_0x29c2dd);}catch(_0x1c04c6){logger[_0x0775('0x16')](_0x1c04c6);}if(_0x9d55b2&&_0x9d55b2['results']){_0x48666b=_0x9d55b2[_0x0775('0x4a')][_0x0775('0x4b')](function(_0x134b07){return _0x134b07&&_0x134b07['alternatives'][0x0]&&_0x134b07[_0x0775('0x4c')][0x0][_0x0775('0x4d')]?_0x134b07[_0x0775('0x4c')][0x0][_0x0775('0x4d')]:'';})[_0x0775('0x4e')]('\x0a');_0x14fc97=_0x9d55b2[_0x0775('0x4a')][_0x0775('0x4b')](function(_0x2e3fa7){return _0x2e3fa7&&_0x2e3fa7[_0x0775('0x4c')][0x0]&&_0x2e3fa7[_0x0775('0x4c')][0x0][_0x0775('0x4f')]?_0x2e3fa7['alternatives'][0x0][_0x0775('0x4f')]:0x0;})[_0x0775('0x4e')]('\x0a');}logger[_0x0775('0x24')](_0x0775('0x50'),_0x48666b);logger['info'](_0x0775('0x51'),_0x14fc97);return{'transcript':_0x48666b,'confidence':_0x14fc97};})[_0x0775('0x52')](function(_0x157bdf){logger[_0x0775('0x16')](_0x0775('0x53'),_0x157bdf['statusCode'],_0x157bdf['name'],_0x157bdf[_0x0775('0x54')]);});};exports['googleDialogflow']=function(_0x23aa2c,_0x778a66,_0xbe757b,_0x14a5a7){var _0x2cda21=apiai(_0x778a66,{'language':_0x14a5a7||'en'});return _0x2cda21[_0x0775('0x55')](_0xbe757b,{'sessionId':md5(_0x23aa2c)})[_0x0775('0x2b')](function(_0x40a45f){logger[_0x0775('0x24')](JSON['stringify'](_0x40a45f));return{'source':_0x40a45f['result']['source'],'resolvedQuery':_0x40a45f[_0x0775('0x56')][_0x0775('0x57')],'action':_0x40a45f[_0x0775('0x56')][_0x0775('0x58')],'actionIncomplete':_0x40a45f['result']['actionIncomplete'],'speech':_0x40a45f[_0x0775('0x56')][_0x0775('0x59')]['speech'],'score':_0x40a45f[_0x0775('0x56')][_0x0775('0x5a')],'statusCode':_0x40a45f['status'][_0x0775('0x5b')],'endConversation':_0x40a45f[_0x0775('0x56')][_0x0775('0x5c')][_0x0775('0x5d')]||![],'isFallbackIntent':_0x40a45f['result'][_0x0775('0x5c')][_0x0775('0x5e')]};});};exports['googleDialogflowV2']=function(_0x18f517,_0x1c9c96,_0x333bb0,_0x52cf49,_0x38a06a,_0x4cb50b){var _0x1ccf78=_0x52cf49[_0x0775('0x5f')](/\\n/g,'\x0a');var _0x6921ec={'credentials':{'private_key':_0x1ccf78,'client_email':_0x333bb0}};var _0x45efa9=new dialogflow[(_0x0775('0x60'))](_0x6921ec);var _0x17804e=_0x45efa9[_0x0775('0x61')](_0x1c9c96,md5(_0x18f517));var _0x24011c={'session':_0x17804e,'queryInput':{'text':{'text':_0x38a06a,'languageCode':_0x4cb50b}}};return _0x45efa9[_0x0775('0x62')](_0x24011c)[_0x0775('0x2b')](function(_0xb835c6){if(_0xb835c6&&_0xb835c6['length']){logger[_0x0775('0x24')](_0x0775('0x63'),JSON[_0x0775('0x3e')](_0xb835c6));var _0x42e9db=_0xb835c6[0x0];if(_0x42e9db){var _0xddf4ed={'action':_0x42e9db[_0x0775('0x64')][_0x0775('0x58')],'allRequiredParamsPresent':_0x42e9db[_0x0775('0x64')]['allRequiredParamsPresent'],'endConversation':_0x42e9db[_0x0775('0x64')]['diagnosticInfo']&&_0x42e9db[_0x0775('0x64')][_0x0775('0x65')][_0x0775('0x66')]?_0x42e9db[_0x0775('0x64')][_0x0775('0x65')]['fields']['end_conversation'][_0x0775('0x67')]:![],'fulfillmentText':_0x42e9db['queryResult']['fulfillmentText'],'intentName':_0x42e9db['queryResult'][_0x0775('0x68')][_0x0775('0x69')],'intentDisplayName':_0x42e9db['queryResult']['intent'][_0x0775('0x6a')],'isFallbackIntent':_0x42e9db[_0x0775('0x64')]['intent'][_0x0775('0x6b')],'languageCode':_0x42e9db[_0x0775('0x64')][_0x0775('0x6c')],'queryText':_0x42e9db[_0x0775('0x64')][_0x0775('0x6d')],'responseId':_0x42e9db['responseId'],'score':_0x42e9db['queryResult'][_0x0775('0x6e')],'speech':_0x42e9db['queryResult'][_0x0775('0x6f')],'providerResponse':JSON[_0x0775('0x3e')](_0xb835c6)};return _0xddf4ed;}}});};exports[_0x0775('0x70')]=function(_0x41e2a2,_0x3e3547,_0x4f42b8,_0x277cf4){return tilde[_0x0775('0x71')](_0x41e2a2,_0x3e3547,_0x4f42b8,_0x277cf4)[_0x0775('0x2b')](function(_0x190772){try{fs[_0x0775('0x1d')](_0x41e2a2);}catch(_0x374941){logger[_0x0775('0x16')](_0x374941);}logger[_0x0775('0x24')]('Tilde\x20ASR\x20transcription',_0x190772['transcript']);logger[_0x0775('0x24')]('Tilde\x20ASR\x20confidence',_0x190772[_0x0775('0x4f')]);return _0x190772;});};exports[_0x0775('0x72')]=function(_0x126def,_0x589d27,_0x637e6c,_0x5e34ca,_0x55e958,_0x413384){var _0xaead2b=path[_0x0775('0x27')](__dirname,'tmp',rs[_0x0775('0x29')](0x4)+_0x0775('0x38'));var _0x235b04;return aws['polly'](_0x126def,_0x589d27,_0x637e6c,_0x5e34ca,_0x55e958,_0x413384,_0xaead2b)[_0x0775('0x2b')](function(){_0x235b04=path[_0x0775('0x27')](__dirname,_0x0775('0x28'),rs[_0x0775('0x29')](0x4)+_0x0775('0x2a'));return convertFile(_0xaead2b,_0x235b04);})['then'](function(){try{fs[_0x0775('0x1d')](_0xaead2b);fs[_0x0775('0x2c')](_0x235b04,'777');}catch(_0x5d0641){logger['error'](_0x5d0641);}return _0x235b04[_0x0775('0x2e')]('.')[0x0];});};exports[_0x0775('0x73')]=function(_0x5ec5c7,_0x3a7328,_0x14adae,_0x3108bb,_0x41526b,_0x57e206){return aws['lex'](_0x5ec5c7,_0x3a7328,_0x14adae,_0x3108bb,_0x41526b,_0x57e206)[_0x0775('0x2b')](function(_0x1976b8){logger[_0x0775('0x24')](JSON['stringify'](_0x1976b8));return _0x1976b8;});};exports[_0x0775('0x74')]=function(_0x33a9c7,_0x27a17b,_0x50dca1,_0x8f1a8b){var _0x57d0f2=util[_0x0775('0x75')](_0x0775('0x76'),ISPEECH_API,_0x33a9c7,encodeURIComponent(_0x27a17b),_0x50dca1,_0x8f1a8b);var _0x5def49=path[_0x0775('0x27')](__dirname,_0x0775('0x28'),rs[_0x0775('0x29')](0x4)+_0x0775('0x38'));var _0x5a56c6;return downloadFile(_0x57d0f2,_0x5def49)[_0x0775('0x2b')](function(){_0x5a56c6=path[_0x0775('0x27')](__dirname,'tmp',rs[_0x0775('0x29')](0x4)+_0x0775('0x2a'));return convertFile(_0x5def49,_0x5a56c6);})[_0x0775('0x2b')](function(){try{fs[_0x0775('0x1d')](_0x5def49);fs[_0x0775('0x2c')](_0x5a56c6,_0x0775('0x2d'));}catch(_0x310423){logger[_0x0775('0x16')](_0x310423);}return _0x5a56c6[_0x0775('0x2e')]('.')[0x0];});};exports['ispeechASR']=function(_0x2a0341,_0x3b3e4a,_0x16f442,_0x9849eb){var _0xa4339d=util[_0x0775('0x75')](_0x0775('0x77'),ISPEECH_API,_0x3b3e4a,_0x16f442,base64Encode(_0x2a0341),_0x9849eb?util[_0x0775('0x75')](_0x0775('0x78'),encodeURIComponent(_0x9849eb)):_0x0775('0x79'));return uploadFile(_0xa4339d)[_0x0775('0x2b')](function(_0x3b1c9c){return querystring[_0x0775('0xc')](_0x3b1c9c);});};exports['sestekNDA']=function(_0x12b992,_0x590308){return sestek[_0x0775('0x7a')](_0x12b992,_0x590308)['then'](function(_0x3ad4f5){logger['info'](JSON[_0x0775('0x3e')](_0x3ad4f5));var _0x3683d6={'speech':_0x3ad4f5[_0x0775('0x7b')],'action':_0x3ad4f5[_0x0775('0x7c')]?_0x3ad4f5[_0x0775('0x7c')][_0x0775('0x7d')]:undefined,'actiondata':_0x3ad4f5['channelData']?_0x3ad4f5[_0x0775('0x7c')][_0x0775('0x7e')]:undefined};if(_0x3ad4f5['channelData']&&_0x3ad4f5['channelData'][_0x0775('0x7f')]){return base64Decode(_0x3ad4f5['channelData'][_0x0775('0x7f')][_0x0775('0x80')],path[_0x0775('0x27')](__dirname,_0x0775('0x28'),rs['generate'](0x4)+_0x0775('0x2a')))[_0x0775('0x2b')](function(_0x22d5c8){_0x3683d6[_0x0775('0x81')]=_0x22d5c8;return _0x3683d6;});}return _0x3683d6;});};exports[_0x0775('0x82')]=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 0c85aa9..9577566 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 _0x9dc7=['./nda'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9dc7,0x10e));var _0x79dc=function(_0xf57664,_0x43dd89){_0xf57664=_0xf57664-0x0;var _0x4ada58=_0x9dc7[_0xf57664];return _0x4ada58;};var nda=require(_0x79dc('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x85c6=['./nda'];(function(_0x32cd29,_0x29f6bb){var _0x2f7e6e=function(_0x20a924){while(--_0x20a924){_0x32cd29['push'](_0x32cd29['shift']());}};_0x2f7e6e(++_0x29f6bb);}(_0x85c6,0xe0));var _0x685c=function(_0x22afff,_0x2d3a32){_0x22afff=_0x22afff-0x0;var _0x3d1392=_0x85c6[_0x22afff];return _0x3d1392;};var nda=require(_0x685c('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 3d4cf1c..009753d 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 _0xc125=['dnid','extension','text','Bearer\x20','access_token','channelData','project','ndagenerate_audio','body','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','url','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid'];(function(_0x1a9d2a,_0x15db4d){var _0x2bde55=function(_0x5509f9){while(--_0x5509f9){_0x1a9d2a['push'](_0x1a9d2a['shift']());}};_0x2bde55(++_0x15db4d);}(_0xc125,0x150));var _0x5c12=function(_0x376de4,_0x5660db){_0x376de4=_0x376de4-0x0;var _0x177bc5=_0xc125[_0x376de4];return _0x177bc5;};'use strict';var rp=require('request-promise');var url=require(_0x5c12('0x0'));var logger=require('../../../../../config/logger')(_0x5c12('0x1'));module[_0x5c12('0x2')]=function(_0x2b4f53,_0x2423dc){var _0x1c16af={'method':_0x5c12('0x3'),'uri':url[_0x5c12('0x4')](_0x2423dc[_0x5c12('0x5')],_0x5c12('0x6')),'form':{'grant_type':_0x5c12('0x7'),'username':_0x2423dc[_0x5c12('0x8')],'password':_0x2423dc[_0x5c12('0x7')]},'json':!![]};return rp(_0x1c16af)['then'](function(_0x1d0635){var _0x4465e3={'method':'POST','uri':url[_0x5c12('0x4')](_0x2423dc[_0x5c12('0x9')],_0x5c12('0xa')),'body':{'type':_0x2423dc[_0x5c12('0xb')]||_0x5c12('0xc'),'channelId':_0x5c12('0xd'),'conversation':{'id':_0x2b4f53[_0x5c12('0xe')]},'from':{'id':_0x2b4f53[_0x5c12('0xf')],'name':_0x2b4f53['calleridname']},'recipient':{'id':_0x2b4f53[_0x5c12('0x10')],'name':_0x2b4f53[_0x5c12('0x11')]},'text':_0x2423dc[_0x5c12('0x12')],'channelData':{}},'headers':{'Authorization':_0x5c12('0x13')+_0x1d0635[_0x5c12('0x14')]},'json':!![]};if(_0x2423dc['project']){_0x4465e3['body'][_0x5c12('0x15')]['ProjectName']=_0x2423dc[_0x5c12('0x16')];}if(_0x2423dc[_0x5c12('0x17')]=='1'){_0x4465e3[_0x5c12('0x18')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5c12('0x19')};}if(_0x2423dc[_0x5c12('0x1a')]){_0x4465e3['body'][_0x5c12('0x15')][_0x5c12('0x1b')]=_0x2423dc[_0x5c12('0x1a')];if(_0x2423dc['custom_action_data']){_0x4465e3['body'][_0x5c12('0x15')][_0x5c12('0x1c')]=_0x2423dc[_0x5c12('0x1d')];}}logger[_0x5c12('0x1e')](JSON[_0x5c12('0x1f')](_0x4465e3));return rp(_0x4465e3);});}; \ No newline at end of file +var _0x4b8a=['text','Bearer\x20','body','ProjectName','project','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','url','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension'];(function(_0x3bd2ab,_0x133f0f){var _0x3dd462=function(_0x3239c9){while(--_0x3239c9){_0x3bd2ab['push'](_0x3bd2ab['shift']());}};_0x3dd462(++_0x133f0f);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b8a[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var url=require(_0xa4b8('0x0'));var logger=require('../../../../../config/logger')(_0xa4b8('0x1'));module[_0xa4b8('0x2')]=function(_0x20eea6,_0x34c820){var _0x2cfc6c={'method':_0xa4b8('0x3'),'uri':url[_0xa4b8('0x4')](_0x34c820[_0xa4b8('0x5')],_0xa4b8('0x6')),'form':{'grant_type':_0xa4b8('0x7'),'username':_0x34c820[_0xa4b8('0x8')],'password':_0x34c820[_0xa4b8('0x7')]},'json':!![]};return rp(_0x2cfc6c)[_0xa4b8('0x9')](function(_0x1fea78){var _0x517970={'method':_0xa4b8('0x3'),'uri':url[_0xa4b8('0x4')](_0x34c820[_0xa4b8('0xa')],_0xa4b8('0xb')),'body':{'type':_0x34c820[_0xa4b8('0xc')]||_0xa4b8('0xd'),'channelId':_0xa4b8('0xe'),'conversation':{'id':_0x20eea6[_0xa4b8('0xf')]},'from':{'id':_0x20eea6[_0xa4b8('0x10')],'name':_0x20eea6[_0xa4b8('0x11')]},'recipient':{'id':_0x20eea6[_0xa4b8('0x12')],'name':_0x20eea6[_0xa4b8('0x13')]},'text':_0x34c820[_0xa4b8('0x14')],'channelData':{}},'headers':{'Authorization':_0xa4b8('0x15')+_0x1fea78['access_token']},'json':!![]};if(_0x34c820['project']){_0x517970[_0xa4b8('0x16')]['channelData'][_0xa4b8('0x17')]=_0x34c820[_0xa4b8('0x18')];}if(_0x34c820['ndagenerate_audio']=='1'){_0x517970[_0xa4b8('0x16')][_0xa4b8('0x19')][_0xa4b8('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa4b8('0x1b')};}if(_0x34c820[_0xa4b8('0x1c')]){_0x517970[_0xa4b8('0x16')][_0xa4b8('0x19')][_0xa4b8('0x1d')]=_0x34c820[_0xa4b8('0x1c')];if(_0x34c820['custom_action_data']){_0x517970[_0xa4b8('0x16')][_0xa4b8('0x19')]['CustomActionData']=_0x34c820[_0xa4b8('0x1e')];}}logger[_0xa4b8('0x1f')](JSON[_0xa4b8('0x20')](_0x517970));return rp(_0x517970);});}; \ 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 ff7c5c8..5af9d2d 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe0d=['./lib/api','exports'];(function(_0x481459,_0x54f988){var _0x1e0dc7=function(_0x15aae4){while(--_0x15aae4){_0x481459['push'](_0x481459['shift']());}};_0x1e0dc7(++_0x54f988);}(_0xbe0d,0x17e));var _0xdbe0=function(_0x1e3ed1,_0x54e8cb){_0x1e3ed1=_0x1e3ed1-0x0;var _0x3430f8=_0xbe0d[_0x1e3ed1];return _0x3430f8;};'use strict';var asr=require(_0xdbe0('0x0'));module[_0xdbe0('0x1')]=function(_0x10e92a,_0x503233,_0x3532c9,_0xe1ba5f){return asr(_0x10e92a,_0x503233,_0x3532c9,_0xe1ba5f);}; \ No newline at end of file +var _0x4d51=['exports','./lib/api'];(function(_0x7495b4,_0x553cf8){var _0x5b64ea=function(_0x4dae3d){while(--_0x4dae3d){_0x7495b4['push'](_0x7495b4['shift']());}};_0x5b64ea(++_0x553cf8);}(_0x4d51,0x1f3));var _0x14d5=function(_0x487fb0,_0x3cf91e){_0x487fb0=_0x487fb0-0x0;var _0x5840c0=_0x4d51[_0x487fb0];return _0x5840c0;};'use strict';var asr=require(_0x14d5('0x0'));module[_0x14d5('0x1')]=function(_0x36fbe0,_0xb5f901,_0x685a6a,_0x107b5a){return asr(_0x36fbe0,_0xb5f901,_0x685a6a,_0x107b5a);}; \ 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 7bf9f69..e774f85 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 _0x9d16=['send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x9d16,0x130));var _0x69d1=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x9d16[_0x4dcc2d];return _0x1bbd79;};'use strict';var BPromise=require(_0x69d1('0x0'));var _=require(_0x69d1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x69d1('0x2'));var crypto=require(_0x69d1('0x3'));var logger=require(_0x69d1('0x4'))(_0x69d1('0x5'));module[_0x69d1('0x6')]=function(_0x5dab4c,_0x3ff3f7,_0x55b731,_0x160f10){return new BPromise(function(_0x1f02e5,_0x4aa582){logger[_0x69d1('0x7')](_0x69d1('0x8'),_0x160f10||_0x69d1('0x9'));var _0x49e15d=new WebSocket(_0x160f10||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4ac159='';var _0x56b160='0';var _0x102d2b='1';var _0x399c1a=_0x69d1('0xa');function _0x57a01f(_0x58bf29){var _0x311f4b=crypto['createHash'](_0x69d1('0xb'));_0x311f4b[_0x69d1('0xc')](_0x58bf29);return _0x311f4b['digest'](_0x69d1('0xd'));}function _0x3016e2(){try{logger['info'](_0x69d1('0xe'));var _0x50d8d4=moment()[_0x69d1('0xf')]();var _0x26b8f3=_0x57a01f(_0x50d8d4+_0x3ff3f7+_0x55b731);_0x49e15d[_0x69d1('0x10')](JSON[_0x69d1('0x11')]({'appID':_0x3ff3f7,'timestamp':_0x50d8d4,'appKey':_0x26b8f3}));var _0x2d8d09=fs['createReadStream'](_0x5dab4c);_0x2d8d09['on'](_0x69d1('0x12'),function(_0x2a0b1a){_0x49e15d[_0x69d1('0x10')](_0x2a0b1a);});_0x2d8d09['on'](_0x69d1('0x13'),function(){_0x49e15d[_0x69d1('0x10')](_0x69d1('0x14'));});}catch(_0x2186e4){logger[_0x69d1('0x15')](_0x69d1('0x16'),JSON[_0x69d1('0x11')](_0x2186e4));_0x49e15d['terminate']();}}function _0x2656df(_0x16e036){try{if(_0x16e036){var _0x15d8c7=JSON[_0x69d1('0x17')](_0x16e036);switch(_0x15d8c7['status']){case 0x0:if(_0x15d8c7[_0x69d1('0x18')]){if(_0x15d8c7[_0x69d1('0x18')][_0x69d1('0x19')]){logger[_0x69d1('0x7')]('Tilde\x20ASR\x20hypoteses',JSON[_0x69d1('0x11')](_0x15d8c7['result'][_0x69d1('0x1a')]));_0x4ac159=_0x15d8c7[_0x69d1('0x18')]['hypotheses'][0x0][_0x69d1('0x1b')];_0x56b160=_0x15d8c7['result'][_0x69d1('0x1a')][0x0][_0x69d1('0x1c')];_0x102d2b='0';_0x399c1a=_0x69d1('0x1d');_0x49e15d[_0x69d1('0x1e')]();}}break;case 0x1:logger[_0x69d1('0x7')](_0x69d1('0xa'));_0x102d2b='1';_0x399c1a=_0x69d1('0xa');break;case 0x2:logger['info'](_0x69d1('0x1f'));_0x102d2b='2';_0x399c1a=_0x69d1('0x1f');break;case 0x9:logger[_0x69d1('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x102d2b='9';_0x399c1a='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x69d1('0x7')](_0x69d1('0x20'));_0x102d2b='10';_0x399c1a=_0x69d1('0x20');break;case 0xb:logger[_0x69d1('0x7')](_0x69d1('0x21'));_0x102d2b='11';_0x399c1a=_0x69d1('0x21');}}}catch(_0x49b411){logger[_0x69d1('0x15')](_0x69d1('0x22'),JSON[_0x69d1('0x11')](_0x49b411));_0x49e15d[_0x69d1('0x1e')]();}}function _0x45fcf0(){logger['info'](_0x69d1('0x23'));_0x1f02e5({'transcript':_0x4ac159,'confidence':_0x56b160,'status':_0x102d2b,'status_message':_0x399c1a});}function _0x74c50(_0xd365b3){logger['error'](_0x69d1('0x24'));if(!_[_0x69d1('0x25')](_0xd365b3)){logger[_0x69d1('0x15')](_[_0x69d1('0x26')](_0xd365b3)?JSON['stringify'](_0xd365b3):_0xd365b3);}}_0x49e15d['on'](_0x69d1('0x27'),_0x3016e2);_0x49e15d['on']('message',_0x2656df);_0x49e15d['on'](_0x69d1('0x13'),_0x45fcf0);_0x49e15d['on'](_0x69d1('0x15'),_0x74c50);});}; \ No newline at end of file +var _0xbd29=['message','lodash','moment','crypto','../../../../../../config/logger','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','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','EOS','error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open'];(function(_0x11aee5,_0x27fa94){var _0x2e8c9d=function(_0x33ff83){while(--_0x33ff83){_0x11aee5['push'](_0x11aee5['shift']());}};_0x2e8c9d(++_0x27fa94);}(_0xbd29,0x76));var _0x9bd2=function(_0x5886c7,_0x7d36c1){_0x5886c7=_0x5886c7-0x0;var _0x521027=_0xbd29[_0x5886c7];return _0x521027;};'use strict';var BPromise=require('bluebird');var _=require(_0x9bd2('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9bd2('0x1'));var crypto=require(_0x9bd2('0x2'));var logger=require(_0x9bd2('0x3'))('agi');module['exports']=function(_0x8d0981,_0x3190d5,_0x428638,_0x2d84e5){return new BPromise(function(_0x3764e8,_0xb54551){logger['info'](_0x9bd2('0x4'),_0x2d84e5||_0x9bd2('0x5'));var _0x5f2c00=new WebSocket(_0x2d84e5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x23060c='';var _0x5e64eb='0';var _0x11b402='1';var _0x562727=_0x9bd2('0x6');function _0x4bc327(_0x4d7c1a){var _0x5e70fc=crypto[_0x9bd2('0x7')](_0x9bd2('0x8'));_0x5e70fc[_0x9bd2('0x9')](_0x4d7c1a);return _0x5e70fc[_0x9bd2('0xa')](_0x9bd2('0xb'));}function _0x2b9220(){try{logger[_0x9bd2('0xc')](_0x9bd2('0xd'));var _0x331c1d=moment()[_0x9bd2('0xe')]();var _0x385a3d=_0x4bc327(_0x331c1d+_0x3190d5+_0x428638);_0x5f2c00['send'](JSON[_0x9bd2('0xf')]({'appID':_0x3190d5,'timestamp':_0x331c1d,'appKey':_0x385a3d}));var _0x73d0b3=fs[_0x9bd2('0x10')](_0x8d0981);_0x73d0b3['on'](_0x9bd2('0x11'),function(_0x9c8464){_0x5f2c00[_0x9bd2('0x12')](_0x9c8464);});_0x73d0b3['on']('close',function(){_0x5f2c00['send'](_0x9bd2('0x13'));});}catch(_0x57862c){logger[_0x9bd2('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x9bd2('0xf')](_0x57862c));_0x5f2c00[_0x9bd2('0x15')]();}}function _0x13acbc(_0x8bf55f){try{if(_0x8bf55f){var _0x3416bb=JSON['parse'](_0x8bf55f);switch(_0x3416bb[_0x9bd2('0x16')]){case 0x0:if(_0x3416bb[_0x9bd2('0x17')]){if(_0x3416bb[_0x9bd2('0x17')][_0x9bd2('0x18')]){logger[_0x9bd2('0xc')](_0x9bd2('0x19'),JSON[_0x9bd2('0xf')](_0x3416bb[_0x9bd2('0x17')][_0x9bd2('0x1a')]));_0x23060c=_0x3416bb[_0x9bd2('0x17')][_0x9bd2('0x1a')][0x0][_0x9bd2('0x1b')];_0x5e64eb=_0x3416bb[_0x9bd2('0x17')][_0x9bd2('0x1a')][0x0][_0x9bd2('0x1c')];_0x11b402='0';_0x562727=_0x9bd2('0x1d');_0x5f2c00[_0x9bd2('0x15')]();}}break;case 0x1:logger[_0x9bd2('0xc')](_0x9bd2('0x6'));_0x11b402='1';_0x562727='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x9bd2('0xc')](_0x9bd2('0x1e'));_0x11b402='2';_0x562727='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x9bd2('0xc')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x11b402='9';_0x562727=_0x9bd2('0x1f');break;case 0xa:logger['info'](_0x9bd2('0x20'));_0x11b402='10';_0x562727=_0x9bd2('0x20');break;case 0xb:logger[_0x9bd2('0xc')](_0x9bd2('0x21'));_0x11b402='11';_0x562727=_0x9bd2('0x21');}}}catch(_0x495f7f){logger[_0x9bd2('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x9bd2('0xf')](_0x495f7f));_0x5f2c00[_0x9bd2('0x15')]();}}function _0x3e8d5e(){logger[_0x9bd2('0xc')](_0x9bd2('0x22'));_0x3764e8({'transcript':_0x23060c,'confidence':_0x5e64eb,'status':_0x11b402,'status_message':_0x562727});}function _0x21545c(_0x33fd7d){logger['error'](_0x9bd2('0x23'));if(!_[_0x9bd2('0x24')](_0x33fd7d)){logger['error'](_['isObject'](_0x33fd7d)?JSON[_0x9bd2('0xf')](_0x33fd7d):_0x33fd7d);}}_0x5f2c00['on'](_0x9bd2('0x25'),_0x2b9220);_0x5f2c00['on'](_0x9bd2('0x26'),_0x13acbc);_0x5f2c00['on']('close',_0x3e8d5e);_0x5f2c00['on'](_0x9bd2('0x14'),_0x21545c);});}; \ 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 1b010a4..c00fdfd 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 _0x2985=['exports','./asr'];(function(_0x203e1b,_0x307eec){var _0x4b9285=function(_0x3d0cdc){while(--_0x3d0cdc){_0x203e1b['push'](_0x203e1b['shift']());}};_0x4b9285(++_0x307eec);}(_0x2985,0x65));var _0x5298=function(_0x4c8feb,_0xe425fc){_0x4c8feb=_0x4c8feb-0x0;var _0x5efb17=_0x2985[_0x4c8feb];return _0x5efb17;};var asr=require(_0x5298('0x0'));module[_0x5298('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3136=['./asr'];(function(_0x386613,_0x4a005a){var _0x42c55d=function(_0x2702ce){while(--_0x2702ce){_0x386613['push'](_0x386613['shift']());}};_0x42c55d(++_0x4a005a);}(_0x3136,0x8a));var _0x6313=function(_0x1206ba,_0x5654b7){_0x1206ba=_0x1206ba-0x0;var _0x55c854=_0x3136[_0x1206ba];return _0x55c854;};var asr=require(_0x6313('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 6d52c19..25f6e23 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 _0x531e=['emit','error','E_AGI_ARGUMENT_PORT','listen','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','nextTick','inherits','exports','util','net','EventEmitter','./channel','127.0.0.1'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x531e,0x1f3));var _0xe531=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x531e[_0x254b22];return _0x1279db;};'use strict';var util=require(_0xe531('0x0'));var net=require(_0xe531('0x1'));var EventEmitter=require('events')[_0xe531('0x2')];var AGIError=require('./error');var AGIChannel=require(_0xe531('0x3'));var AGIServer=function(_0x278eac,_0x5391f6,_0x411a3b){var _0x418d3f=this,_0x278eac=_0x278eac||0x11dd,_0x5391f6=_0x5391f6||_0xe531('0x4'),_0x1007e2=null,_0x4df912=0x0;EventEmitter['call'](_0x418d3f);function _0x411128(){if(!_0x278eac){_0x418d3f[_0xe531('0x5')](_0xe531('0x6'),new AGIError(_0xe531('0x7')));return![];}_0x1007e2=net['createServer']();_0x1007e2[_0xe531('0x8')](_0x278eac,_0x5391f6);_0x1007e2['on']('listening',function(){_0x418d3f[_0xe531('0x5')]('listening');});_0x1007e2['on'](_0xe531('0x9'),function(_0x35fd42){_0x1007e2[_0xe531('0xa')](function(_0x3bfbeb,_0x33f82d){if(_0x3bfbeb){_0x418d3f[_0xe531('0x5')](_0xe531('0x6'),new AGIError(_0xe531('0xb'),_0x3bfbeb));}else if(_0x411a3b&&_0x411a3b<0x0){_0x418d3f[_0xe531('0x5')](_0xe531('0x6'),new AGIError(_0xe531('0xc')));_0x35fd42[_0xe531('0xd')]();}else if(_0x411a3b&&_0x411a3b>0x0&&_0x411a3b<_0x33f82d){_0x4df912+=0x1;_0x418d3f['emit']('error',new AGIError(_0xe531('0xe'),_0x4df912));_0x35fd42[_0xe531('0xd')]();}else{var _0x535ad6=new AGIChannel(_0x35fd42);_0x535ad6['on'](_0xe531('0xf'),function(){_0x418d3f[_0xe531('0x5')]('connection',_0x535ad6);});}});});_0x1007e2['on'](_0xe531('0x6'),function(_0x374591){_0x418d3f[_0xe531('0x5')](_0xe531('0x6'),new AGIError(_0xe531('0xb'),_0x374591[_0xe531('0x10')]));});_0x1007e2['on'](_0xe531('0x11'),function(){_0x418d3f['emit'](_0xe531('0x11'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xe531('0x12')](function(){_0x411128();});};util[_0xe531('0x13')](AGIServer,EventEmitter);module[_0xe531('0x14')]=function(_0x566d13,_0x5db695,_0x34c600){return new AGIServer(_0x566d13,_0x5db695,_0x34c600);}; \ No newline at end of file +var _0x41f4=['destroy','error','code','close','exports','util','net','events','EventEmitter','./error','127.0.0.1','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x58136e,_0x2fcfc3){var _0x3bace3=function(_0x261a05){while(--_0x261a05){_0x58136e['push'](_0x58136e['shift']());}};_0x3bace3(++_0x2fcfc3);}(_0x41f4,0x1cd));var _0x441f=function(_0x334c13,_0x106041){_0x334c13=_0x334c13-0x0;var _0x432975=_0x41f4[_0x334c13];return _0x432975;};'use strict';var util=require(_0x441f('0x0'));var net=require(_0x441f('0x1'));var EventEmitter=require(_0x441f('0x2'))[_0x441f('0x3')];var AGIError=require(_0x441f('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x4a9bfa,_0x2e1908,_0x1a8d29){var _0x4cba0d=this,_0x4a9bfa=_0x4a9bfa||0x11dd,_0x2e1908=_0x2e1908||_0x441f('0x5'),_0x568eb3=null,_0x5511fd=0x0;EventEmitter['call'](_0x4cba0d);function _0x330ea3(){if(!_0x4a9bfa){_0x4cba0d[_0x441f('0x6')]('error',new AGIError(_0x441f('0x7')));return![];}_0x568eb3=net[_0x441f('0x8')]();_0x568eb3[_0x441f('0x9')](_0x4a9bfa,_0x2e1908);_0x568eb3['on'](_0x441f('0xa'),function(){_0x4cba0d[_0x441f('0x6')](_0x441f('0xa'));});_0x568eb3['on'](_0x441f('0xb'),function(_0x178489){_0x568eb3['getConnections'](function(_0xedb9bf,_0x20ad28){if(_0xedb9bf){_0x4cba0d['emit']('error',new AGIError(_0x441f('0xc'),_0xedb9bf));}else if(_0x1a8d29&&_0x1a8d29<0x0){_0x4cba0d[_0x441f('0x6')]('error',new AGIError(_0x441f('0xd')));_0x178489[_0x441f('0xe')]();}else if(_0x1a8d29&&_0x1a8d29>0x0&&_0x1a8d29<_0x20ad28){_0x5511fd+=0x1;_0x4cba0d[_0x441f('0x6')](_0x441f('0xf'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x5511fd));_0x178489['destroy']();}else{var _0x39add8=new AGIChannel(_0x178489);_0x39add8['on']('ready',function(){_0x4cba0d['emit'](_0x441f('0xb'),_0x39add8);});}});});_0x568eb3['on'](_0x441f('0xf'),function(_0x4cb480){_0x4cba0d[_0x441f('0x6')]('error',new AGIError(_0x441f('0xc'),_0x4cb480[_0x441f('0x10')]));});_0x568eb3['on'](_0x441f('0x11'),function(){_0x4cba0d[_0x441f('0x6')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x330ea3();});};util['inherits'](AGIServer,EventEmitter);module[_0x441f('0x12')]=function(_0x4fed88,_0xce1d75,_0x53e082){return new AGIServer(_0x4fed88,_0xce1d75,_0x53e082);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3ae7ce8..744ec83 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 _0x91ac=['math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','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','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','path','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','/var/opt/motion2/server/files','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccountById','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','context','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','callerid','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','rawBody','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','google_asr_language','tildeASR','appsecret','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','hasOwnProperty','saveRestApiResult','%s.%s','length','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','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','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','no\x20password\x20configured','bot','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20variable\x20selected\x20for\x20the\x20result','response','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','googleASR','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','recordFile','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured'];(function(_0x3ec698,_0x4998f9){var _0x307590=function(_0x291421){while(--_0x291421){_0x3ec698['push'](_0x3ec698['shift']());}};_0x307590(++_0x4998f9);}(_0x91ac,0x73));var _0xc91a=function(_0x386836,_0x35b7fc){_0x386836=_0x386836-0x0;var _0x395f19=_0x91ac[_0x386836];return _0x395f19;};'use strict';var fs=require('fs');var path=require(_0xc91a('0x0'));var util=require('util');var _=require(_0xc91a('0x1'));var sh=require(_0xc91a('0x2'));var odbc=require(_0xc91a('0x3'))();var rs=require(_0xc91a('0x4'));var moment=require(_0xc91a('0x5'));var Mustache=require(_0xc91a('0x6'));var rp=require('request-promise');var logger=require(_0xc91a('0x7'))(_0xc91a('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0xc91a('0x9');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=['menu','getdigits',_0xc91a('0xa')];var AGIVertices=function(_0x29b0d7,_0x45e998,_0x5e69cf){this[_0xc91a('0xb')]=_0x29b0d7;this[_0xc91a('0xc')]=_0x45e998;this['mailRpc']=_0x5e69cf;};AGIVertices[_0xc91a('0xd')][_0xc91a('0xe')]=function(_0x3c0024,_0xf37914){this['rpc'][_0xc91a('0xf')](_0x3c0024)[_0xc91a('0x10')](function(_0x4eadc9){_0xf37914(null,_0x4eadc9?_0x4eadc9[_0xc91a('0x11')]:![]);})[_0xc91a('0x12')](function(_0x44402b){_0xf37914(_0x44402b);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x13')]=function(_0x1fabef,_0x195648){this['rpc'][_0xc91a('0x14')](_0x1fabef)[_0xc91a('0x10')](function(_0x587c7f){_0x195648(null,_0x587c7f?_0x587c7f[_0xc91a('0x11')]:![]);})['catch'](function(_0x11623b){_0x195648(_0x11623b);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x15')]=function(_0x5450f1,_0x16c746){this['rpc'][_0xc91a('0x16')](_0x5450f1)[_0xc91a('0x10')](function(_0x1694fe){_0x16c746(null,_0x1694fe?_0x1694fe[_0xc91a('0x11')]:![]);})[_0xc91a('0x12')](function(_0x32f0fd){_0x16c746(_0x32f0fd);});};AGIVertices['prototype'][_0xc91a('0x17')]=function(_0x18fab1,_0x5563ed){this[_0xc91a('0xc')]['getSquareOdbcById'](_0x18fab1)[_0xc91a('0x10')](function(_0x598349){_0x5563ed(null,_0x598349?_0x598349[_0xc91a('0x18')]:![]);})[_0xc91a('0x12')](function(_0x460e08){_0x5563ed(_0x460e08);});};AGIVertices['prototype'][_0xc91a('0x19')]=function(_0x4677fd,_0xec263c){this[_0xc91a('0xc')][_0xc91a('0x1a')](_0x4677fd)[_0xc91a('0x10')](function(_0x253b7d){_0xec263c(null,_0x253b7d?_0x253b7d[_0xc91a('0x11')]:![]);})['catch'](function(_0x137273){_0xec263c(_0x137273);});};AGIVertices['prototype'][_0xc91a('0x1b')]=function(_0x59a73b,_0x5df36b){this['rpc'][_0xc91a('0x1c')](_0x59a73b)[_0xc91a('0x10')](function(_0x2d4ac5){_0x5df36b(null,_0x2d4ac5?_0x2d4ac5[_0xc91a('0x11')]:![]);})['catch'](function(_0x37480b){_0x5df36b(_0x37480b);});};AGIVertices[_0xc91a('0xd')]['getSound']=function(_0x4246fb,_0x5f31ef){var _0x102215=this;this['rpc']['getSoundById'](_0x4246fb)[_0xc91a('0x10')](function(_0x1ae5b6){_0x5f31ef(null,_0x1ae5b6?_0x102215[_0xc91a('0x1d')](_0x1ae5b6[_0xc91a('0x1e')]):![]);})[_0xc91a('0x12')](function(_0x39e474){_0x5f31ef(_0x39e474);});};AGIVertices[_0xc91a('0xd')]['getMailAccount']=function(_0x1a91f9,_0x46d485){this[_0xc91a('0xc')][_0xc91a('0x1f')](_0x1a91f9)[_0xc91a('0x10')](function(_0xe9f5fe){_0x46d485(null,_0xe9f5fe?_0xe9f5fe:![]);})[_0xc91a('0x12')](function(_0x475e51){_0x46d485(_0x475e51);});};AGIVertices[_0xc91a('0xd')]['sendMailMessage']=function(_0x1192bd,_0x7eda35,_0x583b1c){this[_0xc91a('0x20')][_0xc91a('0x21')](_0x1192bd,_0x7eda35)['then'](function(){_0x583b1c(null);})[_0xc91a('0x12')](function(_0x18c5ec){_0x583b1c(_0x18c5ec);});};AGIVertices['prototype'][_0xc91a('0x22')]=function(_0x4ebad4,_0x11f588){this['rpc'][_0xc91a('0x23')](_0x4ebad4)[_0xc91a('0x10')](function(_0x4a9021){if(_0x4a9021){if(_0x4a9021[_0xc91a('0x24')]){_0x11f588(null,[_0x4a9021[_0xc91a('0x25')]]);}else{_0x11f588(null,_[_0xc91a('0x26')](_0x4a9021[_0xc91a('0x27')],'interval'));}}else{_0x11f588(null,![]);}})[_0xc91a('0x12')](function(_0x3d3787){_0x11f588(_0x3d3787);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1d')]=function(_0x5b0781){return util[_0xc91a('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x5b0781);};AGIVertices[_0xc91a('0xd')]['getQueryOdbc']=function(_0xfb3a26,_0x1c6671,_0x2a928c){odbc[_0xc91a('0x29')](_0xfb3a26,function(_0x8a1941){if(_0x8a1941){logger[_0xc91a('0x2a')](_0xc91a('0x2b'),_0x8a1941);_0x2a928c(_0x8a1941);}else{logger[_0xc91a('0x2c')](_0xc91a('0x2d'));odbc['query'](_0x1c6671,function(_0xb967e4,_0x16f0e6){if(_0xb967e4){logger['info']('Error\x20executing\x20query\x20%s',_0x1c6671);_0x2a928c(_0xb967e4);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x1c6671);odbc[_0xc91a('0x2e')](function(_0x2b1fab){if(_0x2b1fab){logger['error'](_0xc91a('0x2f'),_0x2b1fab);}_0x2a928c(null,_0x16f0e6);});}});}});};AGIVertices['prototype'][_0xc91a('0x30')]=function(_0x3d5452,_0x5331e7){this[_0xc91a('0xc')][_0xc91a('0x31')](_0x3d5452)['then'](function(_0x28765c){_0x5331e7(null,_0x28765c?_0x28765c:![]);})[_0xc91a('0x12')](function(_0x349c48){_0x5331e7(_0x349c48);});};AGIVertices[_0xc91a('0xd')]['createSmsMessage']=function(_0x100c68,_0x4896a1){this['rpc'][_0xc91a('0x32')](_0x100c68)['then'](function(_0x1349cd){_0x4896a1(null,_0x1349cd);})[_0xc91a('0x12')](function(_0x1fd567){_0x4896a1(_0x1fd567);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x33')]=function(_0x3758cc,_0x3254f2,_0x122620){this[_0xc91a('0xc')][_0xc91a('0x33')]({'uniqueid':this[_0xc91a('0xb')][_0xc91a('0x34')],'node':_0x3758cc[_0xc91a('0x35')],'application':_0x3758cc['agicommand'],'data':_0x3254f2||null,'project_name':this[_0xc91a('0xb')][_0xc91a('0x36')],'callerid':this[_0xc91a('0xb')]['callerid']})[_0xc91a('0x10')](function(_0x146ebc){if(_0x122620){_0x122620(null,_0x146ebc);}})[_0xc91a('0x12')](function(_0x978c26){if(_0x122620){_0x122620(_0x978c26);}});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x37')]=function(_0x3bc2e3,_0x59417b,_0x1ef063,_0x5bb2ca){this[_0xc91a('0xc')]['createSquareRecording']({'uniqueid':this['channel'][_0xc91a('0x34')],'callerid':this[_0xc91a('0xb')]['callerid'],'calleridname':this[_0xc91a('0xb')]['calleridname'],'context':this['channel'][_0xc91a('0x38')],'extension':this['channel']['extension'],'priority':this['channel']['priority'],'accountcode':this['channel'][_0xc91a('0x39')],'dnid':this[_0xc91a('0xb')][_0xc91a('0x3a')],'projectName':this[_0xc91a('0xb')][_0xc91a('0x36')],'saveName':_0x59417b,'filename':_0x3bc2e3[_0xc91a('0x3b')]||_0x59417b,'savePath':_0x1ef063})[_0xc91a('0x10')](function(_0xaf2e7f){_0x5bb2ca(null,_0xaf2e7f);})[_0xc91a('0x12')](function(_0x532f75){_0x5bb2ca(_0x532f75);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x3c')]=function(_0x295b94,_0x5f29a8,_0x3773c3,_0x5b8e7e,_0x37132f){this[_0xc91a('0xc')][_0xc91a('0x3c')]({'uniqueid':this[_0xc91a('0xb')][_0xc91a('0x34')],'body':_0x295b94,'direction':_0x5f29a8,'providerName':_0x3773c3,'providerResponse':_0x5b8e7e})[_0xc91a('0x10')](function(_0x159598){if(_0x37132f){_0x37132f(null,_0x159598);}})[_0xc91a('0x12')](function(_0x205330){if(_0x37132f){_0x37132f(_0x205330);}});};AGIVertices['prototype']['createCmContact']=function(_0x13eb96,_0x33bebe){this['rpc'][_0xc91a('0x3d')]({'firstName':_[_0xc91a('0x3e')](_0x13eb96[_0xc91a('0x11')])||_[_0xc91a('0x3f')](_0x13eb96[_0xc91a('0x11')])?'callback_'+Math[_0xc91a('0x40')]():_0x13eb96['name'],'lastName':_[_0xc91a('0x3e')](_0x13eb96[_0xc91a('0x41')])||_['isNil'](_0x13eb96[_0xc91a('0x41')])?null:_0x13eb96[_0xc91a('0x41')],'phone':_0x13eb96[_0xc91a('0x42')],'ListId':_0x13eb96['list_id'],'scheduledat':_0x13eb96[_0xc91a('0x43')],'callbackUniqueid':this['channel'][_0xc91a('0x34')],'tags':_0xc91a('0x44'),'description':_0xc91a('0x45')+_0x13eb96[_0xc91a('0x43')][_0xc91a('0x46')](),'priority':_0x13eb96[_0xc91a('0x47')]})[_0xc91a('0x10')](function(_0x50af2e){_0x33bebe(null,_0x50af2e);})[_0xc91a('0x12')](function(_0x2aa0ad){_0x33bebe(_0x2aa0ad);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x48')]=function(_0xf8d7f6,_0x55bebf){this['rpc'][_0xc91a('0x49')](_0xf8d7f6)['then'](function(_0x5a94bb){_0x55bebf(null,_0x5a94bb?_0x5a94bb['name']:![]);})[_0xc91a('0x12')](function(_0x337882){_0x55bebf(_0x337882);});};AGIVertices[_0xc91a('0xd')]['agentPause']=function(_0x102191,_0x47c2e3,_0x197546){var _0x5e3080={'role':_0xc91a('0x4a')};_0x5e3080[_0x102191]=this[_0xc91a('0xb')]['callerid'];this[_0xc91a('0xc')]['agentPause'](_0x5e3080,_0x47c2e3,this[_0xc91a('0xb')][_0xc91a('0x34')])[_0xc91a('0x10')](function(_0x1fb7e2){_0x197546(null,_[_0xc91a('0x3f')](_0x1fb7e2)?![]:!![]);})[_0xc91a('0x12')](function(_0x5a5403){logger['error'](_0x5a5403);_0x197546(null,![]);});};AGIVertices[_0xc91a('0xd')]['agentUnpause']=function(_0x1f8096,_0x25f255){var _0x4c760c={'role':_0xc91a('0x4a')};_0x4c760c[_0x1f8096]=this['channel'][_0xc91a('0x4b')];this[_0xc91a('0xc')][_0xc91a('0x4c')](_0x4c760c)[_0xc91a('0x10')](function(_0x395258){_0x25f255(null,_[_0xc91a('0x3f')](_0x395258)?![]:!![]);})[_0xc91a('0x12')](function(_0x3b0b3f){logger[_0xc91a('0x2a')](_0x3b0b3f);_0x25f255(null,![]);});};AGIVertices['prototype'][_0xc91a('0x4d')]=function(_0x5d68ce,_0x57f676){var _0x4e7b85={'role':_0xc91a('0x4a')};_0x4e7b85[_0x5d68ce]=this['channel'][_0xc91a('0x4b')];this[_0xc91a('0xc')][_0xc91a('0x4d')](_0x4e7b85)[_0xc91a('0x10')](function(_0x38eec3){_0x57f676(null,_['isNil'](_0x38eec3)?![]:!![]);})[_0xc91a('0x12')](function(_0x1471f0){logger[_0xc91a('0x2a')](_0x1471f0);_0x57f676(null,![]);});};AGIVertices[_0xc91a('0xd')]['agentLogin']=function(_0x728cdd,_0x2c8cb9){var _0x2605cc={'role':_0xc91a('0x4a')};_0x2605cc[_0x728cdd]=this[_0xc91a('0xb')][_0xc91a('0x4b')];var _0x1428ab=_0x728cdd!=_0xc91a('0x4e')?util['format'](_0xc91a('0x4f'),_0xc91a('0x50'),this[_0xc91a('0xb')][_0xc91a('0x4b')]):undefined;this[_0xc91a('0xc')]['agentLogin'](_0x2605cc,_0x1428ab)[_0xc91a('0x10')](function(_0x3a3dea){_0x2c8cb9(null,_[_0xc91a('0x3f')](_0x3a3dea)?![]:!![]);})[_0xc91a('0x12')](function(_0x30efac){logger['error'](_0x30efac);_0x2c8cb9(null,![]);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x51')]=function(_0x18cac0,_0x28f501){sh['exec'](_[_0xc91a('0x52')](_0x18cac0),function(_0x2acfee,_0x33bbc0){var _0xc4111=_0x33bbc0['replace'](/(\r\n|\n|\r)/gm,'');_0x28f501(null,_0xc4111);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x53')]=function(_0x280d9c,_0x41e471){scripts[_0xc91a('0x53')](_0x280d9c['apiKey'],_0x280d9c[_0xc91a('0x54')]||_0xc91a('0x55'),_0x280d9c[_0xc91a('0x55')],_0x280d9c[_0xc91a('0x56')]||_0xc91a('0x57'),_0x280d9c[_0xc91a('0x58')]||_0xc91a('0x59'),_0x280d9c['audioEncoding']||_0xc91a('0x5a'))[_0xc91a('0x10')](function(_0x52954e){_0x41e471(null,_0x52954e);})['catch'](function(_0xec24dc){_0x41e471(_0xec24dc);});};AGIVertices['prototype'][_0xc91a('0x5b')]=function(_0x2c9cca,_0x172939){scripts[_0xc91a('0x5b')](_0x2c9cca[_0xc91a('0x55')],_0x2c9cca['google_tts_language']||'en',0x1)[_0xc91a('0x10')](function(_0x2c2da9){_0x172939(null,_0x2c2da9);})[_0xc91a('0x12')](function(_0x39fb84){_0x172939(_0x39fb84);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x5c')]=function(_0x3fbcf5,_0x2cffdc){var _0x369249={'uri':_0x3fbcf5[_0xc91a('0x5d')],'method':_0x3fbcf5[_0xc91a('0x5e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3fbcf5[_0xc91a('0x5f')])===_0xc91a('0x60')&&parseInt(_0x3fbcf5['timeout'])>=0x1?parseInt(_0x3fbcf5['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xc91a('0x61')]([_0xc91a('0x62'),_0xc91a('0x63')],_0x369249[_0xc91a('0x5e')][_0xc91a('0x64')]())){try{_0x369249['body']=_0x3fbcf5[_0xc91a('0x65')]?JSON[_0xc91a('0x66')](_0x3fbcf5['rawBody']):{};}catch(_0x147f40){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x147f40);}}try{_0x369249['headers']=_0x3fbcf5[_0xc91a('0x67')]?JSON[_0xc91a('0x66')](_0x3fbcf5['rawHeaders']):{};}catch(_0x416644){logger[_0xc91a('0x2a')](_0xc91a('0x68'),_0x416644);}if(_0x3fbcf5[_0xc91a('0x69')]){try{var _0x275631=require(_0x3fbcf5[_0xc91a('0x69')])[_0xc91a('0x6a')](this,_0x369249);_0x369249[_0xc91a('0x6b')]=Mustache[_0xc91a('0x6c')](_0x3fbcf5['url'],_0x275631,{},['$$','$$']);if(_0x369249[_0xc91a('0x6d')]){_0x369249[_0xc91a('0x6d')]=JSON[_0xc91a('0x66')](Mustache['render'](JSON[_0xc91a('0x6e')](_0x369249[_0xc91a('0x6d')]),_0x275631,{},['$$','$$']));}if(_0x369249['body']){_0x369249['body']=JSON[_0xc91a('0x66')](Mustache[_0xc91a('0x6c')](JSON[_0xc91a('0x6e')](_0x369249[_0xc91a('0x6f')]),_0x275631,{},['$$','$$']));}}catch(_0x512fa8){logger[_0xc91a('0x2a')](_0xc91a('0x70'),_0x512fa8);}}rp(_0x369249)['then'](function(_0x5177aa){var _0xe202b1={'statusCode':_0x5177aa[_0xc91a('0x71')]||0xc8,'statusMessage':_0x5177aa[_0xc91a('0x72')]||'OK','headers':_0x5177aa[_0xc91a('0x6d')]||{},'body':_0x5177aa[_0xc91a('0x6f')]||{}};_0x2cffdc(null,_0xe202b1);})['catch'](function(_0x42a689){var _0x5e778e={'statusCode':_0x42a689[_0xc91a('0x71')]||0x1f4,'statusMessage':_0x42a689[_0xc91a('0x73')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x42a689[_0xc91a('0x74')][_0xc91a('0x6d')]||{},'body':_0x42a689[_0xc91a('0x74')][_0xc91a('0x6f')]||{}};_0x2cffdc(null,_0x5e778e);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x75')]=function(_0x2c7087,_0x62dffb){scripts[_0xc91a('0x75')](this[_0xc91a('0xb')][_0xc91a('0x34')],_0x2c7087[_0xc91a('0x76')],_0x2c7087['text'],_0x2c7087[_0xc91a('0x77')]||'en')[_0xc91a('0x10')](function(_0x1a2636){_0x62dffb(null,_0x1a2636);})['catch'](function(_0x3cb37b){_0x62dffb(_0x3cb37b);});};AGIVertices['prototype'][_0xc91a('0x78')]=function(_0x3af8e1,_0x1a451d){scripts[_0xc91a('0x78')](this[_0xc91a('0xb')][_0xc91a('0x34')],_0x3af8e1[_0xc91a('0x79')],_0x3af8e1[_0xc91a('0x7a')],_0x3af8e1[_0xc91a('0x7b')],_0x3af8e1[_0xc91a('0x55')],_0x3af8e1['dialogflowV2_language']||'en')[_0xc91a('0x10')](function(_0x269db2){_0x1a451d(null,_0x269db2);})[_0xc91a('0x12')](function(_0x1a6bbe){_0x1a451d(_0x1a6bbe);});};AGIVertices['prototype'][_0xc91a('0x7c')]=function(_0x397992,_0x521e83){scripts[_0xc91a('0x7c')](this[_0xc91a('0xb')],_0x397992)[_0xc91a('0x10')](function(_0x59b5ea){_0x521e83(null,_0x59b5ea);})['catch'](function(_0x2da228){_0x521e83(_0x2da228);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x7d')]=function(_0x3d73f1,_0x6abc6f){scripts[_0xc91a('0x7d')](_0x3d73f1[_0xc91a('0x76')],_0x3d73f1[_0xc91a('0x55')],_0x3d73f1[_0xc91a('0x7e')]||_0xc91a('0x57'),_0x3d73f1[_0xc91a('0x7f')])[_0xc91a('0x10')](function(_0x2a1e35){_0x6abc6f(null,_0x2a1e35);})[_0xc91a('0x12')](function(_0x3abe03){_0x6abc6f(_0x3abe03);});};AGIVertices['prototype'][_0xc91a('0x80')]=function(_0x59611f,_0x325d66,_0x5f2e41){scripts['ispeechASR'](_0x325d66,_0x59611f['key'],_0x59611f['ispeech_asr_language']||_0xc91a('0x57'),this[_0xc91a('0x81')](_0x59611f[_0xc91a('0x82')])?_0x59611f[_0xc91a('0x82')]:undefined)[_0xc91a('0x10')](function(_0x1bf544){_0x5f2e41(null,_0x1bf544);})[_0xc91a('0x12')](function(_0x5148db){_0x5f2e41(_0x5148db);});};AGIVertices['prototype'][_0xc91a('0x83')]=function(_0x3089da,_0x331f96){scripts[_0xc91a('0x83')](_0x3089da[_0xc91a('0x84')],_0x3089da['aws_secret_access_key'],_0x3089da[_0xc91a('0x85')],_0x3089da[_0xc91a('0x86')]||_0xc91a('0x87'),_0x3089da[_0xc91a('0x55')],_0x3089da[_0xc91a('0x88')]||_0xc91a('0x55'))['then'](function(_0x3aaeb7){_0x331f96(null,_0x3aaeb7);})[_0xc91a('0x12')](function(_0x22c30d){_0x331f96(_0x22c30d);});};AGIVertices['prototype'][_0xc91a('0x89')]=function(_0x1a44ca,_0xa036e){scripts['awsLex'](this['channel'][_0xc91a('0x34')],_0x1a44ca[_0xc91a('0x84')],_0x1a44ca['aws_secret_access_key'],_0x1a44ca['aws_lex_region'],_0x1a44ca[_0xc91a('0x55')],_0x1a44ca[_0xc91a('0x8a')])[_0xc91a('0x10')](function(_0x407d9d){_0xa036e(null,_0x407d9d);})[_0xc91a('0x12')](function(_0x4abe89){_0xa036e(_0x4abe89);});};AGIVertices[_0xc91a('0xd')]['googleASR']=function(_0x738363,_0x56437e,_0x320229){scripts['googleASR'](_0x56437e,_0x738363[_0xc91a('0x76')],_0x738363[_0xc91a('0x8b')]||_0xc91a('0x57'))[_0xc91a('0x10')](function(_0x178ea6){_0x320229(null,_0x178ea6);})[_0xc91a('0x12')](function(_0x33ed3e){_0x320229(_0x33ed3e);});};AGIVertices[_0xc91a('0xd')][_0xc91a('0x8c')]=function(_0x390479,_0x19bbba,_0x3d3539){scripts[_0xc91a('0x8c')](_0x19bbba,_0x390479['appid'],_0x390479[_0xc91a('0x8d')],_0x390479[_0xc91a('0x6b')])[_0xc91a('0x10')](function(_0x3179c8){_0x3d3539(null,_0x3179c8);})[_0xc91a('0x12')](function(_0x151ba1){_0x3d3539(_0x151ba1);});};AGIVertices['prototype']['clear']=function(_0x3be648){var _0x40f67b=_[_0xc91a('0x61')](verticesWithRetry,_0x3be648[_0xc91a('0x8e')])?_0x3be648:_[_0xc91a('0x8f')](_0x3be648);for(var _0x327552 in _0x40f67b){if(_0x40f67b['hasOwnProperty'](_0x327552)){if(_0x40f67b[_0x327552]&&_[_0xc91a('0x90')](_0x40f67b[_0x327552])){if(_[_0xc91a('0x61')](recursiveMapAttributes,_0x327552)){_0x40f67b[_0x327552]=this[_0xc91a('0x91')](_0x40f67b[_0x327552]);}else{_0x40f67b[_0x327552]=this[_0xc91a('0x92')](_0x40f67b[_0x327552]);}}}}return _0x40f67b;};AGIVertices[_0xc91a('0xd')][_0xc91a('0x93')]=function(_0x2f4dcc){for(var _0x35569b in _0x2f4dcc){if(_0x2f4dcc['hasOwnProperty'](_0x35569b)){if(_[_0xc91a('0x94')](_0x2f4dcc[_0x35569b])){this[_0xc91a('0x93')](_0x2f4dcc[_0x35569b]);}else if(_[_0xc91a('0x95')](_0x2f4dcc[_0x35569b])){for(var _0x366051=0x0;_0x366051<_0x2f4dcc[_0x35569b]['length'];_0x366051++){this[_0xc91a('0x93')](_0x2f4dcc[_0x35569b][_0x366051]);}}else if(_['isString'](_0x2f4dcc[_0x35569b])){_0x2f4dcc[_0x35569b]=this[_0xc91a('0x92')](_0x2f4dcc[_0x35569b]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x8cb9cd,_0x3e72ab){for(var _0x383bf0 in _0x8cb9cd){if(_0x8cb9cd[_0xc91a('0x96')](_0x383bf0)){if(_[_0xc91a('0x94')](_0x8cb9cd[_0x383bf0])){if(!_['isEmpty'](_0x8cb9cd[_0x383bf0])){this[_0xc91a('0x97')](_0x8cb9cd[_0x383bf0],util['format'](_0xc91a('0x98'),_0x3e72ab,_0x383bf0));}}else if(_['isArray'](_0x8cb9cd[_0x383bf0])){for(var _0x186be4=0x0;_0x186be4<_0x8cb9cd[_0x383bf0][_0xc91a('0x99')];_0x186be4++){this['saveRestApiResult'](_0x8cb9cd[_0x383bf0][_0x186be4],util['format'](_0xc91a('0x98'),_0x3e72ab,_0x383bf0+'['+_0x186be4+']'));}}else{if(!_[_0xc91a('0x3f')](_0x8cb9cd[_0x383bf0])){this[_0xc91a('0xb')][_0xc91a('0x9a')](util[_0xc91a('0x28')]('%s.%s',_0x3e72ab,_0x383bf0),_0x8cb9cd[_0x383bf0]);}}}}};AGIVertices[_0xc91a('0xd')][_0xc91a('0x91')]=function(_0x42421d){try{var _0x356d5c=JSON[_0xc91a('0x66')](_0x42421d);this['recursiveNodeIndex'](_0x356d5c);return JSON[_0xc91a('0x6e')](_0x356d5c);}catch(_0x258570){return this[_0xc91a('0x92')](_0x42421d);}};AGIVertices[_0xc91a('0xd')]['replaceAllVariables']=function(_0x19576b){var _0x106a33=_0x19576b[_0xc91a('0x9b')]('{');for(var _0x235a3b=0x1;_0x235a3b<_0x106a33[_0xc91a('0x99')];_0x235a3b+=0x1){var _0x7bc3f2=_0x106a33[_0x235a3b][_0xc91a('0x9b')]('}');if(_0x7bc3f2[_0xc91a('0x99')]>0x1){_0x19576b=_0x19576b['replaceAll']('{'+_0x7bc3f2[0x0]+'}',this['channel'][_0xc91a('0xe')](_0x7bc3f2[0x0])[_0xc91a('0x9c')]||_0x7bc3f2[0x0]);}}if(_0x106a33[_0xc91a('0x99')]===0x1){return _0x19576b[_0xc91a('0x46')]();}return this[_0xc91a('0x92')](_0x19576b);};AGIVertices[_0xc91a('0xd')][_0xc91a('0x9d')]=function(_0x120048,_0x381040){var _0x31ae23=this['channel'][_0xc91a('0xe')](_0x120048);if(_0x31ae23[_0xc91a('0x9e')]===-0x1){return _0x31ae23;}logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x9f'),_0x381040,_0x31ae23[_0xc91a('0x9c')]));return this[_0xc91a('0xb')][_0xc91a('0x9a')](_0x381040,_0x31ae23[_0xc91a('0x9c')]);};AGIVertices[_0xc91a('0xd')]['isConfigured']=function(_0x3c1e1f){return _0x3c1e1f&&_0x3c1e1f!=='0'&&_0x3c1e1f!=='-1'&&_0x3c1e1f!=='';};AGIVertices[_0xc91a('0xd')][_0xc91a('0xa0')]=function(_0x33116b){this[_0xc91a('0x33')][_0xc91a('0x6a')](this,_0x33116b,'-');_0x33116b['retry']=_0x33116b[_0xc91a('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc91a('0xd')][_0xc91a('0xa1')]=function(_0x3d5a10){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xa2'),_0x3d5a10[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x3d5a10['text'])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20text\x20configured');}var _0x46ccc4='\x22'+_0x3d5a10['text']+'\x22';if(this[_0xc91a('0x81')](_0x3d5a10[_0xc91a('0x74')])){_0x46ccc4+=','+_0x3d5a10[_0xc91a('0x74')];}var _0x35194f=this[_0xc91a('0xb')][_0xc91a('0xa4')](_0xc91a('0xa5'),_0x46ccc4);if(_0x35194f[_0xc91a('0x9e')]===-0x1){return _0x35194f;}return this[_0xc91a('0xb')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x46ccc4));};AGIVertices['prototype'][_0xc91a('0xa6')]=function(_0x3ffac7){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x3ffac7['label']));if(!this['isConfigured'](_0x3ffac7['grammar'])){return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0xa7'));}var _0x158303=_0x3ffac7[_0xc91a('0xa8')];if(this[_0xc91a('0x81')](_0x3ffac7['options'])){_0x158303+=','+_0x3ffac7[_0xc91a('0x74')];}var _0x4fb79c=this[_0xc91a('0xb')][_0xc91a('0xa4')](_0xc91a('0xa9'),_0x158303);if(_0x4fb79c[_0xc91a('0x9e')]===-0x1){return _0x4fb79c;}var _0x1858e4=this['getAndSetVariable'](_0xc91a('0xaa'),'MRCP_RECOG_CONFIDENCE');if(_0x1858e4[_0xc91a('0x9e')]===-0x1){return _0x1858e4;}var _0x448746=this[_0xc91a('0x9d')](_0xc91a('0xab'),_0xc91a('0xac'));if(_0x448746[_0xc91a('0x9e')]===-0x1){return _0x448746;}var _0xd3ab01=this[_0xc91a('0x9d')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0xd3ab01[_0xc91a('0x9e')]===-0x1){return _0xd3ab01;}return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x158303));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x8')]=function(_0x319332){logger['info'](util[_0xc91a('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x319332['label']));return this['channel'][_0xc91a('0x8')]([_0x319332['command'],_0x319332[_0xc91a('0xad')]]);};AGIVertices[_0xc91a('0xd')]['answer']=function(_0x589b74){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x589b74[_0xc91a('0x35')]));if(this[_0xc91a('0x81')](_0x589b74[_0xc91a('0x5f')])){logger['info'](util[_0xc91a('0x28')](_0xc91a('0xae'),_0x589b74[_0xc91a('0x5f')]));var _0x408cdd=this['channel'][_0xc91a('0xaf')](_0x589b74[_0xc91a('0x5f')]);if(_0x408cdd['result']===-0x1){return _0x408cdd;}}return this[_0xc91a('0xb')][_0xc91a('0xb0')]();};AGIVertices[_0xc91a('0xd')][_0xc91a('0x44')]=function(_0x42a36a){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xb1'),_0x42a36a[_0xc91a('0x35')]));if(!this['isConfigured'](_0x42a36a[_0xc91a('0xb2')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x42a36a,_0xc91a('0xb3'));}_0x42a36a[_0xc91a('0x43')]=moment();if(this[_0xc91a('0x81')](_0x42a36a[_0xc91a('0xb4')])){_0x42a36a[_0xc91a('0x43')]=moment()[_0xc91a('0xb5')](_0x42a36a[_0xc91a('0xb4')],_0xc91a('0xb6'));}if(!this[_0xc91a('0x81')](_0x42a36a['callback_priority'])){_0x42a36a['callback_priority']=0x2;}this[_0xc91a('0x3d')]['sync'](this,_0x42a36a);return this[_0xc91a('0xb')]['noop'](util[_0xc91a('0x28')](_0xc91a('0xb7'),_0x42a36a[_0xc91a('0x42')],_0x42a36a[_0xc91a('0xb2')],_0x42a36a[_0xc91a('0x43')]));};AGIVertices[_0xc91a('0xd')]['custom_app']=function(_0x4790e4){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xb8'),_0x4790e4[_0xc91a('0x35')]));var _0x120559=this['channel'][_0xc91a('0xa4')](_0x4790e4[_0xc91a('0xb9')],_0x4790e4['options']);if(_0x120559[_0xc91a('0x9e')]===-0x1){return _0x120559;}return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')]('Executed\x20command\x20%s\x20%s',_0x4790e4[_0xc91a('0xb9')],_0x4790e4['options']));};AGIVertices['prototype'][_0xc91a('0xba')]=function(_0x31d1ad){logger[_0xc91a('0x2c')](util['format'](_0xc91a('0xbb'),_0x31d1ad[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x31d1ad[_0xc91a('0x55')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0xbc'));}var _0x44c49d='\x22'+_0x31d1ad[_0xc91a('0x55')]+'\x22';if(this['isConfigured'](_0x31d1ad['options'])){_0x44c49d+=','+_0x31d1ad[_0xc91a('0x74')];}var _0x233c36=this[_0xc91a('0xb')][_0xc91a('0xa4')](_0xc91a('0xa5'),_0x44c49d);if(_0x233c36[_0xc91a('0x9e')]===-0x1){return _0x233c36;}return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0xbd'),_0x44c49d));};AGIVertices[_0xc91a('0xd')]['sestektts']=function(_0x4ad7ee){logger[_0xc91a('0x2c')](util['format'](_0xc91a('0xbe'),_0x4ad7ee[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x4ad7ee[_0xc91a('0x55')])){return this['channel']['noop'](_0xc91a('0xbc'));}var _0xa45797='\x22'+_0x4ad7ee[_0xc91a('0x55')]+'\x22';if(this[_0xc91a('0x81')](_0x4ad7ee[_0xc91a('0x74')])){_0xa45797+=','+_0x4ad7ee[_0xc91a('0x74')];}var _0x294e82=this[_0xc91a('0xb')]['exec'](_0xc91a('0xa5'),_0xa45797);if(_0x294e82['result']===-0x1){return _0x294e82;}return this[_0xc91a('0xb')]['noop'](util[_0xc91a('0x28')](_0xc91a('0xbd'),_0xa45797));};AGIVertices[_0xc91a('0xd')][_0xc91a('0xbf')]=function(_0x2d1c80){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xc0'),_0x2d1c80[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x2d1c80[_0xc91a('0xa8')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0xa7'));}var _0x30fd03=_0x2d1c80[_0xc91a('0xa8')];if(this[_0xc91a('0x81')](_0x2d1c80[_0xc91a('0x74')])){_0x30fd03+=','+_0x2d1c80['options'];}var _0x26a6ae=this[_0xc91a('0xb')][_0xc91a('0xa4')](_0xc91a('0xa9'),_0x30fd03);if(_0x26a6ae[_0xc91a('0x9e')]===-0x1){return _0x26a6ae;}var _0x1dc74d=this[_0xc91a('0x9d')](_0xc91a('0xaa'),_0xc91a('0xc1'));if(_0x1dc74d['result']===-0x1){return _0x1dc74d;}var _0xf45a82=this[_0xc91a('0x9d')](_0xc91a('0xab'),_0xc91a('0xc2'));if(_0xf45a82[_0xc91a('0x9e')]===-0x1){return _0xf45a82;}var _0x1e2e96=this['getAndSetVariable'](_0xc91a('0xc3'),'LUMENVOX_ASR_INSTANCE');if(_0x1e2e96[_0xc91a('0x9e')]===-0x1){return _0x1e2e96;}return this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x30fd03));};AGIVertices['prototype'][_0xc91a('0xc4')]=function(_0x5a9d0b){logger[_0xc91a('0x2c')](util['format'](_0xc91a('0xc5'),_0x5a9d0b[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x5a9d0b[_0xc91a('0xa8')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0xa7'));}var _0x1c3bf5=_0x5a9d0b[_0xc91a('0xa8')];if(this[_0xc91a('0x81')](_0x5a9d0b[_0xc91a('0x74')])){_0x1c3bf5+=','+_0x5a9d0b[_0xc91a('0x74')];}var _0xbccb0e=this[_0xc91a('0xb')][_0xc91a('0xa4')](_0xc91a('0xa9'),_0x1c3bf5);if(_0xbccb0e['result']===-0x1){return _0xbccb0e;}var _0x5ad2e6=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xc91a('0xc6'));if(_0x5ad2e6[_0xc91a('0x9e')]===-0x1){return _0x5ad2e6;}var _0x61fb69=this['getAndSetVariable'](_0xc91a('0xab'),_0xc91a('0xc7'));if(_0x61fb69[_0xc91a('0x9e')]===-0x1){return _0x61fb69;}var _0x518896=this[_0xc91a('0x9d')](_0xc91a('0xc3'),_0xc91a('0xc8'));if(_0x518896[_0xc91a('0x9e')]===-0x1){return _0x518896;}return this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1c3bf5));};AGIVertices[_0xc91a('0xd')][_0xc91a('0xc9')]=function(_0x5afd26){logger['info'](util[_0xc91a('0x28')](_0xc91a('0xca'),_0x5afd26[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x5afd26[_0xc91a('0xcb')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x5afd26,_0xc91a('0xcc'));}var _0x1322cb=this[_0xc91a('0x17')][_0xc91a('0x6a')](this,_0x5afd26[_0xc91a('0xcb')]);if(!_0x1322cb){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x5afd26,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5afd26[_0xc91a('0xcd')])){return this[_0xc91a('0xb')]['error'](_0x5afd26,'no\x20query\x20configured');}var _0x433322=_0x5afd26[_0xc91a('0xcd')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0xce'),_0x433322));var _0x194d89=this['getQueryOdbc'][_0xc91a('0x6a')](this,_0x1322cb,_0x433322);this[_0xc91a('0x33')]['sync'](this,_0x5afd26,_0x433322);if(!this['isConfigured'](_0x5afd26[_0xc91a('0xcf')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x32dd3d=this['getVariable']['sync'](this,_0x5afd26[_0xc91a('0xcf')]);if(!_0x32dd3d){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x5afd26,_0xc91a('0xd0'));}var _0x147fb2=this;_0x194d89[_0xc91a('0xd1')](function(_0x33422d,_0x2585eb){Object[_0xc91a('0xd2')](_0x33422d)['forEach'](function(_0x2922ff){_0x147fb2[_0xc91a('0xb')]['setVariable'](util[_0xc91a('0x28')]('%s[%s][%s]',_0x32dd3d,_0x2585eb,_0x2922ff),_0x33422d[_0x2922ff]);});});this[_0xc91a('0xb')][_0xc91a('0x9a')](util['format'](_0xc91a('0xd3'),_0x32dd3d),_0x194d89[_0xc91a('0x99')]);return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0xd4'),_0x32dd3d));};AGIVertices[_0xc91a('0xd')]['dial']=function(_0x11d647){logger[_0xc91a('0xd5')](util[_0xc91a('0x28')](_0xc91a('0xd6'),_0x11d647[_0xc91a('0x35')]));if(!this['isConfigured'](_0x11d647['sip_id'])){return this[_0xc91a('0xb')]['error'](_0x11d647,_0xc91a('0xd7'));}var _0x5dbfba=this[_0xc91a('0x19')][_0xc91a('0x6a')](this,_0x11d647['sip_id']);if(!_0x5dbfba){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x11d647,_0xc91a('0xd8'));}var _0x65dd77=this[_0xc91a('0xb')][_0xc91a('0xa4')](_0xc91a('0xd9'),[util[_0xc91a('0x28')](_0xc91a('0xda'),_0x5dbfba),_0x11d647[_0xc91a('0x5f')],_0x11d647[_0xc91a('0xdb')],_0x11d647[_0xc91a('0x5d')]]);if(_0x65dd77[_0xc91a('0x9e')]===-0x1){return _0x65dd77;}return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0xdc'),_0xc91a('0xd9')));};AGIVertices[_0xc91a('0xd')][_0xc91a('0xdd')]=function(_0x317887){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xde'),_0x317887[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x317887[_0xc91a('0x76')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0xdf'));}if(!this[_0xc91a('0x81')](_0x317887[_0xc91a('0x55')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0xbc'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x317887);this[_0xc91a('0x3c')](_0x317887['text'],'in','','');this['channel']['noop'](util['format'](_0xc91a('0xe0'),_0x317887[_0xc91a('0x55')]));var _0x4af70e=this[_0xc91a('0x75')]['sync'](this,_0x317887);if(_0x4af70e){for(var _0x5d7fa5 in _0x4af70e){if(_0x4af70e[_0xc91a('0x96')](_0x5d7fa5)){this[_0xc91a('0xb')][_0xc91a('0x9a')](util[_0xc91a('0x28')](_0xc91a('0xe1'),_0x5d7fa5[_0xc91a('0x64')]()),_0x4af70e[_0x5d7fa5]);}}this['createSquareMessage'](_0x4af70e[_0xc91a('0xe2')],'out','dialogflow','');return this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format'](_0xc91a('0xe3'),_0x4af70e[_0xc91a('0xe2')]));}return this[_0xc91a('0xb')]['error'](_0x317887,_0xc91a('0xe4'));};AGIVertices['prototype'][_0xc91a('0xe5')]=function(_0x171b5d){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xe6'),_0x171b5d['label']));if(!this[_0xc91a('0x81')](_0x171b5d['dialogflowV2_project_id'])){return this[_0xc91a('0xb')]['noop']('no\x20project_id\x20configured');}if(!this[_0xc91a('0x81')](_0x171b5d['client_email'])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20client_email\x20configured');}if(!this[_0xc91a('0x81')](_0x171b5d[_0xc91a('0x7b')])){return this['channel'][_0xc91a('0xa3')]('no\x20private_key\x20configured');}if(!this[_0xc91a('0x81')](_0x171b5d[_0xc91a('0xe7')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20anguage\x20configured');}if(!this[_0xc91a('0x81')](_0x171b5d[_0xc91a('0x55')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0xbc'));}this[_0xc91a('0xb')]['bot']=!![];this['createSquareDetailsReport'](_0x171b5d);this[_0xc91a('0x3c')](_0x171b5d[_0xc91a('0x55')],'in','','');this[_0xc91a('0xb')]['noop'](util[_0xc91a('0x28')](_0xc91a('0xe8'),_0x171b5d[_0xc91a('0x55')]));var _0x5d4ee2=this[_0xc91a('0x78')][_0xc91a('0x6a')](this,_0x171b5d);if(_0x5d4ee2){for(var _0xe976d2 in _0x5d4ee2){if(_0x5d4ee2['hasOwnProperty'](_0xe976d2)){if(_0xe976d2!==_0xc91a('0xe9')){this['channel'][_0xc91a('0x9a')](util[_0xc91a('0x28')](_0xc91a('0xe1'),_0xe976d2[_0xc91a('0x64')]()),_0x5d4ee2[_0xe976d2]);}}}this['createSquareMessage'](_0x5d4ee2[_0xc91a('0xe2')],_0xc91a('0xea'),_0xc91a('0xe5'),_0x5d4ee2[_0xc91a('0xe9')]);return this['channel'][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0xeb'),_0x5d4ee2[_0xc91a('0xe2')]));}return this['channel'][_0xc91a('0x2a')](_0x171b5d,_0xc91a('0xec'));};AGIVertices[_0xc91a('0xd')][_0xc91a('0xed')]=function(_0x3006b1){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xee'),_0x3006b1['label']));if(!this[_0xc91a('0x81')](_0x3006b1['ndauth_url'])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x3006b1[_0xc91a('0xef')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0xf0'));}if(!this['isConfigured'](_0x3006b1['password'])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0xf1'));}if(!this[_0xc91a('0x81')](_0x3006b1['ndassistant_url'])){return this[_0xc91a('0xb')]['noop'](_0xc91a('0xbc'));}this['channel'][_0xc91a('0xf2')]=!![];this[_0xc91a('0x33')](_0x3006b1);this[_0xc91a('0x3c')](_0x3006b1[_0xc91a('0x55')],'in','','');this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0x3006b1[_0xc91a('0x55')]));var _0x4ae24d=this[_0xc91a('0x7c')][_0xc91a('0x6a')](this,_0x3006b1);if(_0x4ae24d){for(var _0x289b4c in _0x4ae24d){if(_0x4ae24d[_0xc91a('0x96')](_0x289b4c)){this[_0xc91a('0xb')][_0xc91a('0x9a')](util['format'](_0xc91a('0xf3'),_0x289b4c[_0xc91a('0x64')]()),_0x4ae24d[_0x289b4c]);}}this[_0xc91a('0x3c')](_0x4ae24d[_0xc91a('0xe2')],_0xc91a('0xea'),_0xc91a('0xed'),'');if(_0x4ae24d[_0xc91a('0xf4')]){this['channel'][_0xc91a('0xa3')](util['format'](_0xc91a('0xf5'),_0x4ae24d[_0xc91a('0xf4')]));var _0x3d5989=this['channel'][_0xc91a('0xf6')](_0x4ae24d[_0xc91a('0xf4')]);try{fs['unlink'](_0x4ae24d['audiofile']+_0xc91a('0xf7'));}catch(_0x38dcac){logger[_0xc91a('0x2a')](_0x38dcac);}return _0x3d5989;}else{return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0xf8'),_0x4ae24d['speech']));}}return this['channel'][_0xc91a('0x2a')](_0x3006b1,_0xc91a('0xf9'));};AGIVertices['prototype']['end']=function(_0x8e983d){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xfa'),_0x8e983d[_0xc91a('0x35')]));return this[_0xc91a('0xb')]['noop'](_0xc91a('0xfb'));};AGIVertices[_0xc91a('0xd')]['ext_dial']=function(_0x599421){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0xfc'),_0x599421[_0xc91a('0x35')]));var _0x37e405='';if(_0x599421[_0xc91a('0xfd')]){if(!this[_0xc91a('0x81')](_0x599421[_0xc91a('0xfd')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x599421,_0xc91a('0xfe'));}else{var _0x4890f2=parseInt(_0x599421[_0xc91a('0xfd')],0xa);if(isNaN(_0x4890f2)){_0x37e405=_0x599421[_0xc91a('0xfd')];}else{_0x37e405=this[_0xc91a('0x1b')]['sync'](this,_0x599421[_0xc91a('0xfd')]);if(!_0x37e405){return this['channel'][_0xc91a('0x2a')](_0x599421,_0xc91a('0xff'));}}}}else if(_0x599421[_0xc91a('0x100')]){_0x37e405=_0x599421[_0xc91a('0x100')];}else{return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x599421,_0xc91a('0xfe'));}var _0x4c0d75=this[_0xc91a('0xb')][_0xc91a('0xa4')](_0xc91a('0xd9'),[util[_0xc91a('0x28')](_0xc91a('0x101'),_0x37e405,_0x599421['phone']),_0x599421[_0xc91a('0x5f')],_0x599421[_0xc91a('0xdb')],_0x599421[_0xc91a('0x5d')]]);if(_0x4c0d75[_0xc91a('0x9e')]===-0x1){return _0x4c0d75;}return this[_0xc91a('0xb')]['noop'](util['format'](_0xc91a('0xdc'),'DIAL'));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x102')]=function(_0x2e25f9){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x103'),_0x2e25f9[_0xc91a('0x35')]));return this[_0xc91a('0xb')]['noop']('finally');};AGIVertices['prototype']['getdigits']=function(_0x422ad1){logger['info'](util[_0xc91a('0x28')](_0xc91a('0x104'),_0x422ad1['label']));if(_0x422ad1['retry']===0x0){return this[_0xc91a('0xa0')](_0x422ad1);}_0x422ad1[_0xc91a('0x105')]-=0x1;if(!this['isConfigured'](_0x422ad1[_0xc91a('0x106')])){return this[_0xc91a('0xb')]['error'](_0x422ad1,_0xc91a('0x107'));}var _0x150341=this[_0xc91a('0x108')]['sync'](this,_0x422ad1[_0xc91a('0x106')]);if(!_0x150341){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x422ad1,'no\x20file\x20audio\x20found');}if(!this[_0xc91a('0x81')](_0x422ad1[_0xc91a('0xcf')])){return this[_0xc91a('0xb')]['error'](_0xc91a('0x109'));}var _0x160a1d=this[_0xc91a('0xb')]['getData'](_0x150341,_0x422ad1[_0xc91a('0x10a')],_0x422ad1['maxdigit']);var _0x5ef9ce=_0x160a1d['result']?_0x160a1d['result'][_0xc91a('0x46')]():'';logger[_0xc91a('0x2c')]('test',JSON[_0xc91a('0x6e')](_0x160a1d));if(_0x160a1d[_0xc91a('0x9e')]===-0x1){this[_0xc91a('0x33')][_0xc91a('0x6a')](this,_0x422ad1,_0x5ef9ce);return _0x160a1d;}else if(_0x160a1d[_0xc91a('0x9c')]===_0xc91a('0x5f')){_0x160a1d[_0xc91a('0x9e')]=_0x5ef9ce[_0xc91a('0x99')]>=parseInt(_0x422ad1[_0xc91a('0x10b')])?'x':'i';}else{_0x160a1d[_0xc91a('0x9e')]=_0x5ef9ce[_0xc91a('0x99')]>=parseInt(_0x422ad1[_0xc91a('0x10b')])&&_0x5ef9ce[_0xc91a('0x99')]<=parseInt(_0x422ad1[_0xc91a('0x10c')])?'x':'i';}var _0xfc0d7b=this[_0xc91a('0xe')][_0xc91a('0x6a')](this,_0x422ad1[_0xc91a('0xcf')]);if(!_0xfc0d7b){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x422ad1,_0xc91a('0xd0'));}this['channel']['setVariable'](_0xfc0d7b,_0x5ef9ce);if(this[_0xc91a('0x81')](_0x422ad1[_0xc91a('0x10d')])){var _0x76ceb1=parseInt(_0x422ad1[_0xc91a('0x10d')],0xa);var _0x5ee32e=rs[_0xc91a('0x10e')]({'charset':'*','length':_0x76ceb1});var _0x361369=_0x5ef9ce[_0xc91a('0x99')];if(_0x361369>0x0){if(_0x361369>_0x76ceb1){this['createSquareDetailsReport'][_0xc91a('0x6a')](this,_0x422ad1,_0x422ad1[_0xc91a('0x10f')]===_0xc91a('0x110')?_0x5ee32e+_0x5ef9ce[_0xc91a('0x111')](_0x76ceb1):_0x5ef9ce['substr'](0x0,_0x361369-_0x76ceb1)+_0x5ee32e);}else{this['createSquareDetailsReport'][_0xc91a('0x6a')](this,_0x422ad1,rs[_0xc91a('0x10e')]({'charset':'*','length':_0x361369}));}}else{this[_0xc91a('0x33')][_0xc91a('0x6a')](this,_0x422ad1,'');}}else{this[_0xc91a('0x33')][_0xc91a('0x6a')](this,_0x422ad1,_0x5ef9ce);}return _0x160a1d;};AGIVertices[_0xc91a('0xd')][_0xc91a('0xa')]=function(_0x5f5772){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x112'),_0x5f5772[_0xc91a('0x35')]));return this[_0xc91a('0x113')](_0x5f5772);};AGIVertices[_0xc91a('0xd')]['goal']=function(_0x5c1137){logger['info'](util['format'](_0xc91a('0x114'),_0x5c1137[_0xc91a('0x35')]));this[_0xc91a('0x33')][_0xc91a('0x6a')](this,_0x5c1137,_0x5c1137['goalname']);return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x115'),_0x5c1137['goalname']));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x116')]=function(_0x5bce10){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x117'),_0x5bce10[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x5bce10[_0xc91a('0x84')])||!this['isConfigured'](_0x5bce10[_0xc91a('0x118')])){return this['channel']['noop'](_0xc91a('0x119'));}if(!this['isConfigured'](_0x5bce10[_0xc91a('0x55')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20text\x20configured');}this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x11a'),_0x5bce10[_0xc91a('0x55')]));var _0x176d0a=this[_0xc91a('0x83')][_0xc91a('0x6a')](this,_0x5bce10);if(_0x176d0a){this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x11b'),_0x176d0a));var _0x5a4a69=this['channel'][_0xc91a('0xf6')](_0x176d0a);try{fs[_0xc91a('0x11c')](_0x176d0a+_0xc91a('0xf7'));}catch(_0x324914){logger[_0xc91a('0x2a')](_0x324914);}return _0x5a4a69;}return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x5bce10,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0xc91a('0x11d')]=function(_0x1384d2){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x11e'),_0x1384d2[_0xc91a('0x35')]));if(!this['isConfigured'](_0x1384d2[_0xc91a('0x84')])||!this[_0xc91a('0x81')](_0x1384d2[_0xc91a('0x118')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0x119'));}if(!this[_0xc91a('0x81')](_0x1384d2[_0xc91a('0x8a')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20bot\x20name\x20configured');}if(!this[_0xc91a('0x81')](_0x1384d2[_0xc91a('0x55')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20text\x20configured');}this[_0xc91a('0xb')]['bot']=!![];this[_0xc91a('0x33')](_0x1384d2);this[_0xc91a('0x3c')](_0x1384d2['text'],'in','','');this['channel'][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x11f'),_0x1384d2['text']));var _0x110628=this[_0xc91a('0x89')][_0xc91a('0x6a')](this,_0x1384d2);if(_0x110628){for(var _0x423647 in _0x110628){if(_0x110628[_0xc91a('0x96')](_0x423647)&&_[_0xc91a('0x90')](_0x110628[_0x423647])){this['channel'][_0xc91a('0x9a')](util[_0xc91a('0x28')](_0xc91a('0x120'),_0x423647[_0xc91a('0x64')]()),_0x110628[_0x423647]);}}if(_['isNil'](_0x110628[_0xc91a('0x73')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0x121'));}else{this[_0xc91a('0x3c')](_0x110628[_0xc91a('0x73')],_0xc91a('0xea'),_0xc91a('0x122'),'');return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x110628[_0xc91a('0x73')]));}}return this['channel']['error'](_0x1384d2,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xc91a('0xd')][_0xc91a('0x123')]=function(_0x42eb9a){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x42eb9a['label'],_0x42eb9a[_0xc91a('0x5f')]));if(!this[_0xc91a('0x81')](_0x42eb9a[_0xc91a('0x76')])){return this[_0xc91a('0xb')]['noop'](_0xc91a('0xdf'));}var _0xda16ab=_0xc91a('0x124');var _0x1fd555=util[_0xc91a('0x28')](_0xc91a('0x125'),FILES_PATH,rs['generate'](0x4));var _0x2b449a=util[_0xc91a('0x28')](_0xc91a('0x98'),_0x1fd555,_0xda16ab);var _0x556c23=!![];if(_0x42eb9a['beep']===_0xc91a('0x126')){_0x556c23=![];}var _0x34af85=this[_0xc91a('0xb')]['recordFile'](_0x1fd555,_0xda16ab,_0x42eb9a[_0xc91a('0x127')],_0x42eb9a[_0xc91a('0x5f')],undefined,_0x556c23);if(_0x34af85[_0xc91a('0x9e')]!==-0x1){this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format'](_0xc91a('0x128'),_0x2b449a));var _0x300204=this[_0xc91a('0x129')][_0xc91a('0x6a')](this,_0x42eb9a,_0x2b449a);if(_0x300204){for(var _0x5e12c9 in _0x300204){if(_0x300204[_0xc91a('0x96')](_0x5e12c9)){this[_0xc91a('0xb')][_0xc91a('0x9a')](util[_0xc91a('0x28')]('GOOGLE_ASR_%s',_0x5e12c9['toUpperCase']()),_0x300204[_0x5e12c9]);}}return this['channel']['noop'](util[_0xc91a('0x28')](_0xc91a('0x12a'),JSON[_0xc91a('0x6e')](_0x300204)));}}return _0x34af85;};AGIVertices[_0xc91a('0xd')]['tildeasr']=function(_0xbe75d9){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x12b'),_0xbe75d9[_0xc91a('0x35')]));if(!this['isConfigured'](_0xbe75d9[_0xc91a('0x12c')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0x12d'));}if(!this[_0xc91a('0x81')](_0xbe75d9[_0xc91a('0x8d')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0x12e'));}var _0x450283=_0xc91a('0x124');var _0x17c431=util[_0xc91a('0x28')](_0xc91a('0x125'),FILES_PATH,rs[_0xc91a('0x10e')](0x4));var _0xf3cb0c=util[_0xc91a('0x28')](_0xc91a('0x98'),_0x17c431,_0x450283);var _0xb0a1f=!![];if(_0xbe75d9['beep']===_0xc91a('0x126')){_0xb0a1f=![];}var _0x3a8ed5=this[_0xc91a('0xb')]['recordFile'](_0x17c431,_0x450283,_0xbe75d9[_0xc91a('0x127')],_0xbe75d9[_0xc91a('0x5f')],undefined,_0xb0a1f);if(_0x3a8ed5[_0xc91a('0x9e')]!==-0x1){this['channel'][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x12f'),_0xf3cb0c));var _0x3ada4c=this[_0xc91a('0x8c')][_0xc91a('0x6a')](this,_0xbe75d9,_0xf3cb0c);if(_0x3ada4c){for(var _0x3f5456 in _0x3ada4c){if(_0x3ada4c[_0xc91a('0x96')](_0x3f5456)){this[_0xc91a('0xb')][_0xc91a('0x9a')](util[_0xc91a('0x28')]('TILDE_ASR_%s',_0x3f5456[_0xc91a('0x64')]()),_0x3ada4c[_0x3f5456]);}}return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')]('TildeASR\x20Result\x20%s',JSON[_0xc91a('0x6e')](_0x3ada4c)));}}return _0x3a8ed5;};AGIVertices[_0xc91a('0xd')][_0xc91a('0x130')]=function(_0x107d71){logger['info'](util[_0xc91a('0x28')](_0xc91a('0x131'),_0x107d71[_0xc91a('0x35')]));return this[_0xc91a('0xb')][_0xc91a('0x132')](_0x107d71[_0xc91a('0x38')],_0x107d71[_0xc91a('0x133')],_0x107d71[_0xc91a('0x134')]);};AGIVertices[_0xc91a('0xd')][_0xc91a('0x135')]=function(_0x109f4f){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x136'),_0x109f4f[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x109f4f[_0xc91a('0x137')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x109f4f,_0xc91a('0x138'));}try{var _0x3fa881=eval(_0x109f4f[_0xc91a('0x137')])?_0xc91a('0x139'):'false';this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x13a'),_0x109f4f[_0xc91a('0x137')],_0x3fa881));return{'code':0xc8,'result':_0x3fa881};}catch(_0x4498db){return{'code':0xc8,'result':_0xc91a('0x13b')};}};AGIVertices[_0xc91a('0xd')]['gotoiftime']=function(_0x1a0e5c){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x13c'),_0x1a0e5c['label']));if(!this[_0xc91a('0x81')](_0x1a0e5c['interval_id'])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x1a0e5c,_0xc91a('0x13d'));}var _0x4f6d73=this[_0xc91a('0x22')][_0xc91a('0x6a')](this,_0x1a0e5c[_0xc91a('0x13e')]);if(!_0x4f6d73){return this['channel']['error'](_0x1a0e5c,_0xc91a('0x13f'));}for(var _0x29db26=0x0;_0x29db26<_0x4f6d73[_0xc91a('0x99')];_0x29db26+=0x1){var _0x2d127a=this[_0xc91a('0xb')]['getVariable'](util['format'](_0xc91a('0x140'),_0x4f6d73[_0x29db26]));if(_0x2d127a[_0xc91a('0x9e')]===-0x1){return _0x2d127a;}logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x141'),_0x4f6d73[_0x29db26],_0x2d127a[_0xc91a('0x9c')]));if(_0x2d127a[_0xc91a('0x9c')]===_0xc91a('0x139')){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x141'),_0x4f6d73[_0x29db26],_0xc91a('0x139')));this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x141'),_0x4f6d73[_0x29db26],_0xc91a('0x139')));return{'code':0xc8,'result':_0xc91a('0x139')};}else{logger['info'](util[_0xc91a('0x28')](_0xc91a('0x141'),_0x4f6d73[_0x29db26],'false'));this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x141'),_0x4f6d73[_0x29db26],_0xc91a('0x13b')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xc91a('0xd')][_0xc91a('0x142')]=function(_0x54b25b){logger[_0xc91a('0x2c')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x54b25b['label']));return this['channel']['hangup']();};AGIVertices[_0xc91a('0xd')][_0xc91a('0x143')]=function(_0x3f85f2){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x144'),_0x3f85f2[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x3f85f2[_0xc91a('0x76')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0xdf'));}var _0x2d04b7=_0xc91a('0x124');var _0x5e3693=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xc91a('0x10e')](0x4));var _0x534e5c=util[_0xc91a('0x28')](_0xc91a('0x98'),_0x5e3693,_0x2d04b7);var _0x4167e2=!![];if(_0x3f85f2[_0xc91a('0x145')]==='NOBEEP'){_0x4167e2=![];}var _0x2a0ca9=this[_0xc91a('0xb')][_0xc91a('0x146')](_0x5e3693,_0x2d04b7,_0x3f85f2[_0xc91a('0x127')],_0x3f85f2[_0xc91a('0x5f')],undefined,_0x4167e2);if(_0x2a0ca9[_0xc91a('0x9e')]!==-0x1){this['channel'][_0xc91a('0xa3')](util['format'](_0xc91a('0x147'),_0x534e5c));var _0xef3d9a=this[_0xc91a('0x80')][_0xc91a('0x6a')](this,_0x3f85f2,_0x534e5c);if(_0xef3d9a){for(var _0x139855 in _0xef3d9a){if(_0xef3d9a[_0xc91a('0x96')](_0x139855)){this[_0xc91a('0xb')]['setVariable'](util[_0xc91a('0x28')]('ISPEECH_ASR_%s',_0x139855[_0xc91a('0x64')]()),_0xef3d9a[_0x139855]);}}return this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format'](_0xc91a('0x148'),JSON[_0xc91a('0x6e')](_0xef3d9a)));}}return _0x2a0ca9;};AGIVertices[_0xc91a('0xd')][_0xc91a('0x149')]=function(_0x4156a4){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x14a'),_0x4156a4[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x4156a4[_0xc91a('0x76')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0xdf'));}if(!this[_0xc91a('0x81')](_0x4156a4[_0xc91a('0x55')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0xbc'));}this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format'](_0xc91a('0x14b'),_0x4156a4[_0xc91a('0x55')]));var _0xbe9278=this[_0xc91a('0x7d')]['sync'](this,_0x4156a4);if(_0xbe9278){this[_0xc91a('0xb')]['noop'](util[_0xc91a('0x28')](_0xc91a('0x147'),_0xbe9278));var _0x59fc9d=this[_0xc91a('0xb')][_0xc91a('0xf6')](_0xbe9278,_0x4156a4[_0xc91a('0x127')]);try{fs['unlink'](_0xbe9278+_0xc91a('0xf7'));}catch(_0xeec91){logger['error'](_0xeec91);}return _0x59fc9d;}return this[_0xc91a('0xb')]['error'](_0x4156a4,_0xc91a('0x14c'));};AGIVertices[_0xc91a('0xd')]['login']=function(_0xb15b90){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x14d'),_0xb15b90[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0xb15b90['findBy'])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0xb15b90,_0xc91a('0x14e'));}logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x14f'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0xb15b90[_0xc91a('0x150')]));var _0x52a543=this[_0xc91a('0x151')][_0xc91a('0x6a')](this,_0xb15b90[_0xc91a('0x150')]);if(_0x52a543){logger['info'](util[_0xc91a('0x28')](_0xc91a('0x152'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0xb15b90[_0xc91a('0x150')]));this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc91a('0xb')][_0xc91a('0x4b')],_0xb15b90[_0xc91a('0x150')]));return{'code':0xc8,'result':_0xc91a('0x153')};}else{logger[_0xc91a('0x2c')](util['format'](_0xc91a('0x154'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0xb15b90[_0xc91a('0x150')]));this['channel']['noop'](util[_0xc91a('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc91a('0x4b')],_0xb15b90[_0xc91a('0x150')]));return{'code':0xc8,'result':_0xc91a('0x155')};}};AGIVertices[_0xc91a('0xd')][_0xc91a('0x156')]=function(_0x276fa9){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x157'),_0x276fa9[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x276fa9['findBy'])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x276fa9,_0xc91a('0x14e'));}logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x14f'),this['channel'][_0xc91a('0x4b')],_0x276fa9[_0xc91a('0x150')]));var _0xa00ab9=this['agentLogout'][_0xc91a('0x6a')](this,_0x276fa9[_0xc91a('0x150')]);if(_0xa00ab9){logger['info'](util['format'](_0xc91a('0x152'),this[_0xc91a('0xb')]['callerid'],_0x276fa9[_0xc91a('0x150')]));this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x152'),this['channel'][_0xc91a('0x4b')],_0x276fa9[_0xc91a('0x150')]));return{'code':0xc8,'result':_0xc91a('0x153')};}else{logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x154'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0x276fa9[_0xc91a('0x150')]));this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x154'),this[_0xc91a('0xb')]['callerid'],_0x276fa9[_0xc91a('0x150')]));return{'code':0xc8,'result':_0xc91a('0x155')};}};AGIVertices[_0xc91a('0xd')][_0xc91a('0x158')]=function(_0x32e978){logger[_0xc91a('0x2c')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x32e978['label']));if(!this['isConfigured'](_0x32e978[_0xc91a('0x159')])){return this['channel'][_0xc91a('0x2a')](_0x32e978,_0xc91a('0x15a'));}this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x15b'),_0x32e978[_0xc91a('0x159')]));var _0x86431a=eval(_0x32e978[_0xc91a('0x159')]);if(!this[_0xc91a('0x81')](_0x32e978[_0xc91a('0xcf')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0x109'));}var _0x41c555=this['getVariable'][_0xc91a('0x6a')](this,_0x32e978[_0xc91a('0xcf')]);if(!_0x41c555){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x32e978,_0xc91a('0xd0'));}if(_[_0xc91a('0x95')](_0x86431a)){var _0x286118=this;_0x86431a[_0xc91a('0xd1')](function(_0x5308a4,_0xc1b790){_0x286118[_0xc91a('0xb')]['setVariable'](util[_0xc91a('0x28')](_0xc91a('0x15c'),_0x41c555,_0xc1b790),_0x5308a4);});return this[_0xc91a('0xb')]['noop'](util[_0xc91a('0x28')](_0xc91a('0x15d'),_0x41c555));}else{return this[_0xc91a('0xb')][_0xc91a('0x9a')](_0x41c555,_0x86431a);}};AGIVertices[_0xc91a('0xd')][_0xc91a('0x15e')]=function(_0x21eb3d){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x15f'),_0x21eb3d[_0xc91a('0x35')]));if(_0x21eb3d[_0xc91a('0x105')]===0x0){return this[_0xc91a('0xa0')](_0x21eb3d);}_0x21eb3d[_0xc91a('0x105')]-=0x1;if(!this[_0xc91a('0x81')](_0x21eb3d['file_id'])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x21eb3d,'no\x20file\x20audio\x20selected');}var _0x44ae06=this[_0xc91a('0x108')][_0xc91a('0x6a')](this,_0x21eb3d['file_id']);if(!_0x44ae06){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x21eb3d,_0xc91a('0x160'));}var _0x21d25e=this[_0xc91a('0xb')][_0xc91a('0x161')](_0x44ae06,_0x21eb3d[_0xc91a('0x10a')],_0x21eb3d[_0xc91a('0x162')]);var _0x34ba94=_0x21d25e[_0xc91a('0x9e')];if(_0x21d25e['result']===-0x1){this['createSquareDetailsReport'][_0xc91a('0x6a')](this,_0x21eb3d,'-1');return _0x21d25e;}else if(_0x21d25e[_0xc91a('0x9c')]===_0xc91a('0x5f')){_0x21d25e[_0xc91a('0x9e')]=_0x21d25e['result'][_0xc91a('0x99')]>0x0?_0x21d25e[_0xc91a('0x9e')]:'t';}else if(_[_0xc91a('0x3e')](_0x21d25e['result'])){_0x21d25e[_0xc91a('0x9e')]='#';_0x34ba94='#';}if(!this[_0xc91a('0x81')](_0x21eb3d[_0xc91a('0xcf')])){this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5387cf=this[_0xc91a('0xe')][_0xc91a('0x6a')](this,_0x21eb3d['variable_id']);if(!_0x5387cf){return this[_0xc91a('0xb')]['error'](_0x21eb3d,'no\x20variable\x20found');}this[_0xc91a('0xb')]['setVariable'](_0x5387cf,_0x34ba94);}this[_0xc91a('0x33')][_0xc91a('0x6a')](this,_0x21eb3d,_0x34ba94);return _0x21d25e;};AGIVertices[_0xc91a('0xd')][_0xc91a('0xa3')]=function(_0x329ae9){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x163'),_0x329ae9['label']));return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0x329ae9[_0xc91a('0x164')]||_0x329ae9[_0xc91a('0x35')]);};AGIVertices[_0xc91a('0xd')][_0xc91a('0x165')]=function(_0x25b439){logger[_0xc91a('0x2c')](util['format'](_0xc91a('0x166'),_0x25b439[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x25b439[_0xc91a('0x150')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x25b439,_0xc91a('0x14e'));}logger['info'](util[_0xc91a('0x28')](_0xc91a('0x14f'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0x25b439[_0xc91a('0x150')]));var _0x1465c8=this[_0xc91a('0x48')]['sync'](this,_0x25b439['pause_id']);var _0xf9027c=this[_0xc91a('0x167')][_0xc91a('0x6a')](this,_0x25b439[_0xc91a('0x150')],_0x1465c8);if(_0xf9027c){logger['info'](util[_0xc91a('0x28')](_0xc91a('0x152'),this['channel']['callerid'],_0x25b439[_0xc91a('0x150')]));this[_0xc91a('0xb')]['noop'](util[_0xc91a('0x28')](_0xc91a('0x152'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0x25b439[_0xc91a('0x150')]));return{'code':0xc8,'result':_0xc91a('0x153')};}else{logger[_0xc91a('0x2c')](util['format'](_0xc91a('0x154'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0x25b439[_0xc91a('0x150')]));this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x152'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0x25b439[_0xc91a('0x150')]));return{'code':0xc8,'result':_0xc91a('0x155')};}};AGIVertices[_0xc91a('0xd')][_0xc91a('0x168')]=function(_0x963938){logger[_0xc91a('0x2c')](util['format'](_0xc91a('0x169'),_0x963938[_0xc91a('0x35')]));if(!this['isConfigured'](_0x963938[_0xc91a('0x106')])){return this['channel'][_0xc91a('0x2a')](_0x963938,'no\x20file\x20audio\x20selected');}var _0x36c17e=this[_0xc91a('0x108')][_0xc91a('0x6a')](this,_0x963938[_0xc91a('0x106')]);if(!_0x36c17e){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x963938,'no\x20file\x20audio\x20found');}var _0x47f10f=this[_0xc91a('0xb')]['exec'](_0xc91a('0x16a'),[_0x36c17e,_0x963938[_0xc91a('0xdb')]]);if(_0x47f10f['result']===-0x1){return _0x47f10f;}return this['channel'][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x16b'),_0xc91a('0x16a'),_0x36c17e));};AGIVertices['prototype'][_0xc91a('0x16c')]=function(_0x595c1b){logger['info'](util[_0xc91a('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x595c1b['label']));if(!this[_0xc91a('0x81')](_0x595c1b[_0xc91a('0x16d')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x595c1b,_0xc91a('0x16e'));}var _0x2b683e='';var _0x3a1c64=parseInt(_0x595c1b[_0xc91a('0x16d')],0xa);if(isNaN(_0x3a1c64)){_0x2b683e=_0x595c1b[_0xc91a('0x16d')];}else{_0x2b683e=this[_0xc91a('0x13')][_0xc91a('0x6a')](this,_0x595c1b['queue_id']);if(!_0x2b683e){return this['channel'][_0xc91a('0x2a')](_0x595c1b,_0xc91a('0x16f'));}}var _0x730c8e='';if(this[_0xc91a('0x81')](_0x595c1b[_0xc91a('0x106')])){var _0x188b9b=this[_0xc91a('0x108')][_0xc91a('0x6a')](this,_0x595c1b[_0xc91a('0x106')]);if(_0x188b9b){_0x730c8e=_0x188b9b;}}this['createSquareDetailsReport'][_0xc91a('0x6a')](this,_0x595c1b,_0x2b683e);if(_0x595c1b[_0xc91a('0xdb')][_0xc91a('0x170')]('x')<0x0){_0x595c1b[_0xc91a('0xdb')]+='x';}if(_0x595c1b[_0xc91a('0xdb')][_0xc91a('0x170')]('X')<0x0){_0x595c1b[_0xc91a('0xdb')]+='X';}this[_0xc91a('0xb')][_0xc91a('0x9a')](_0xc91a('0x171'),_0x2b683e?_0x2b683e['toLowerCase']():'');var _0xfabe10=this[_0xc91a('0xb')][_0xc91a('0xa4')]('QUEUE',[_0x2b683e,_0x595c1b[_0xc91a('0xdb')],_0x595c1b['url'],_0x730c8e,_0x595c1b['timeout'],_0x595c1b['agi'],_0x595c1b[_0xc91a('0x172')],_0x595c1b['gosub'],'',_0x595c1b['position']]);if(_0xfabe10['result']===-0x1){return _0xfabe10;}return this['channel'][_0xc91a('0xa3')](util[_0xc91a('0x28')]('Executed\x20command\x20%s\x20%s',_0xc91a('0x173'),_0x2b683e));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x174')]=function(_0x3c48bc){logger[_0xc91a('0x2c')](util['format'](_0xc91a('0x175'),_0x3c48bc[_0xc91a('0x35')]));var _0x30d97d=_0x3c48bc[_0xc91a('0x176')]||_0xc91a('0x124');var _0x24d237=util['format']('%s_%s',this[_0xc91a('0xb')][_0xc91a('0x34')],rs['generate'](0x5));var _0x5b4532=util[_0xc91a('0x28')](_0xc91a('0x177'),FILES_PATH,_0x24d237,_0x30d97d);var _0xa85b23=util[_0xc91a('0x28')]('%s/recordings/%s',FILES_PATH,_0x24d237);this[_0xc91a('0x37')][_0xc91a('0x6a')](this,_0x3c48bc,_0x24d237,_0x5b4532);this[_0xc91a('0xb')]['setVariable'](_0xc91a('0x178'),_0x24d237);logger[_0xc91a('0x2c')](_0xc91a('0x179'),_0xa85b23,_0x30d97d,_0x3c48bc[_0xc91a('0x17a')],_0x3c48bc[_0xc91a('0x5f')]);return this[_0xc91a('0xb')][_0xc91a('0x146')](_0xa85b23,_0x30d97d,_0x3c48bc[_0xc91a('0x17a')],_0x3c48bc[_0xc91a('0x5f')],undefined,!![]);};AGIVertices[_0xc91a('0xd')][_0xc91a('0x17b')]=function(_0x34b397){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x17c'),_0x34b397['label']));if(!this[_0xc91a('0x81')](_0x34b397[_0xc91a('0x5d')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0x17d'));}var _0x4c5534=this[_0xc91a('0x5c')][_0xc91a('0x6a')](this,_0x34b397);logger['info'](util[_0xc91a('0x28')](_0xc91a('0x17e'),util['inspect'](_0x4c5534,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x34b397[_0xc91a('0xcf')])){return this[_0xc91a('0xb')][_0xc91a('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x3156dd=this['getVariable'][_0xc91a('0x6a')](this,_0x34b397[_0xc91a('0xcf')]);if(!_0x3156dd){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x34b397,_0xc91a('0xd0'));}this[_0xc91a('0xb')][_0xc91a('0x9a')](util[_0xc91a('0x28')](_0xc91a('0x17f'),_0x3156dd),_0x4c5534[_0xc91a('0x71')]?_0x4c5534[_0xc91a('0x71')]:_0xc91a('0x180'));this['channel'][_0xc91a('0x9a')](util[_0xc91a('0x28')](_0xc91a('0x181'),_0x3156dd),_0x4c5534[_0xc91a('0x72')]?_0x4c5534[_0xc91a('0x72')]:'OK');if(_0x4c5534[_0xc91a('0x6f')]){try{this['saveRestApiResult'](_0x4c5534[_0xc91a('0x6f')],_0x3156dd);}catch(_0x4df061){logger[_0xc91a('0x2a')](util[_0xc91a('0x28')](_0xc91a('0x182'),_0x3156dd));}}return this[_0xc91a('0xb')]['noop'](util[_0xc91a('0x28')](_0xc91a('0xd4'),_0x3156dd));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x183')]=function(_0x69d7da){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x184'),_0x69d7da['label']));return this['channel'][_0xc91a('0x185')](_0x69d7da[_0xc91a('0x186')][_0xc91a('0x187')](/\s+/g,''),_0x69d7da[_0xc91a('0x17a')]);};AGIVertices[_0xc91a('0xd')]['saynumber']=function(_0x56b77d){logger['info'](util[_0xc91a('0x28')](_0xc91a('0x188'),_0x56b77d[_0xc91a('0x35')]));return this[_0xc91a('0xb')][_0xc91a('0x189')](_0x56b77d[_0xc91a('0x60')]['replace'](/\s+/g,''),_0x56b77d[_0xc91a('0x17a')]);};AGIVertices[_0xc91a('0xd')][_0xc91a('0x18a')]=function(_0x7177a4){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x7177a4[_0xc91a('0x35')]));return this['channel'][_0xc91a('0x18b')](_0x7177a4[_0xc91a('0x55')],_0x7177a4[_0xc91a('0x17a')]);};AGIVertices['prototype'][_0xc91a('0x18c')]=function(_0x4fb109){logger['info'](util[_0xc91a('0x28')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4fb109[_0xc91a('0x35')]));if(!this['isConfigured'](_0x4fb109['account_id'])){return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0x18d'));}var _0x5e6a3a=this[_0xc91a('0x18e')][_0xc91a('0x6a')](this,_0x4fb109['account_id']);if(!_0x5e6a3a||!_0x5e6a3a[_0xc91a('0x18f')]){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x4fb109,'no\x20mail\x20account\x20found');}var _0x970261={'from':util[_0xc91a('0x28')](_0xc91a('0x190'),_0x5e6a3a[_0xc91a('0x11')],_0x5e6a3a[_0xc91a('0x191')]||_0x5e6a3a[_0xc91a('0x18f')][_0xc91a('0x192')]),'to':_0x4fb109['to']||'','cc':_0x4fb109['cc']||'','bcc':_0x4fb109[_0xc91a('0x193')]||'','subject':_0x4fb109[_0xc91a('0x194')],'html':_0x4fb109[_0xc91a('0x55')],'text':_0x4fb109[_0xc91a('0x55')]};var _0x28902e={'tls':{'rejectUnauthorized':![]}};if(_0x5e6a3a[_0xc91a('0x18f')][_0xc91a('0x195')]){_0x28902e[_0xc91a('0x195')]=_0x5e6a3a[_0xc91a('0x18f')][_0xc91a('0x195')];}else{_0x28902e[_0xc91a('0x196')]=_0x5e6a3a['Smtp'][_0xc91a('0x196')];_0x28902e[_0xc91a('0x197')]=_0x5e6a3a['Smtp']['port'];_0x28902e[_0xc91a('0x198')]=_0x5e6a3a[_0xc91a('0x18f')][_0xc91a('0x198')];}if(_0x5e6a3a[_0xc91a('0x18f')][_0xc91a('0x199')]){_0x28902e[_0xc91a('0x19a')]={'user':_0x5e6a3a['Smtp'][_0xc91a('0x192')],'pass':_0x5e6a3a[_0xc91a('0x18f')][_0xc91a('0x19b')]};}if(this[_0xc91a('0x81')](_0x4fb109[_0xc91a('0x19c')])){}logger[_0xc91a('0xd5')]('sendMail\x20message',JSON[_0xc91a('0x6e')](_0x970261));this[_0xc91a('0x33')][_0xc91a('0x6a')](this,_0x4fb109,_0x4fb109[_0xc91a('0x19d')]);this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format'](_0xc91a('0x19e'),_0x5e6a3a[_0xc91a('0x11')]));this[_0xc91a('0x21')]['sync'](this,_0x28902e,_0x970261);return this['channel']['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xc91a('0xd')]['sendFax']=function(_0x5a98bd){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x19f'),_0x5a98bd[_0xc91a('0x35')]));return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0x1a0'));};AGIVertices[_0xc91a('0xd')]['sendSMS']=function(_0x144084){logger['info'](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x144084[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x144084['sms_account_id'])){return this['channel'][_0xc91a('0xa3')]('no\x20sms\x20account\x20configured');}var _0x242b56=this[_0xc91a('0x30')][_0xc91a('0x6a')](this,_0x144084[_0xc91a('0x1a1')]);if(!_0x242b56){return this['channel'][_0xc91a('0x2a')](_0x144084,_0xc91a('0x1a2'));}var _0x3af9ff={'body':_0x144084[_0xc91a('0x1a3')],'phone':_0x144084['to']||'','SmsAccountId':_0x242b56['id']};logger[_0xc91a('0xd5')](_0xc91a('0x1a4'),JSON[_0xc91a('0x6e')](_0x3af9ff));this[_0xc91a('0x33')]['sync'](this,_0x144084,_0x144084['sms_account_id']);this[_0xc91a('0xb')]['noop'](util['format'](_0xc91a('0x1a5'),_0x242b56[_0xc91a('0x11')]));this['createSmsMessage'][_0xc91a('0x6a')](this,_0x3af9ff);return this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0x1a6'));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1a7')]=function(_0x1e9c5a){logger[_0xc91a('0x2c')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x1e9c5a[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x1e9c5a['variable_id'])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x1e9c5a,_0xc91a('0x1a8'));}var _0x44d80e=this[_0xc91a('0xe')][_0xc91a('0x6a')](this,_0x1e9c5a[_0xc91a('0xcf')]);if(!_0x44d80e){return this['channel'][_0xc91a('0x2a')](_0x1e9c5a,_0xc91a('0xd0'));}return this[_0xc91a('0xb')][_0xc91a('0x9a')](_0x44d80e,_0x1e9c5a[_0xc91a('0x1a9')]);};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1aa')]=function(_0x5eccac){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x1ab'),_0x5eccac[_0xc91a('0x35')]));this['channel']['noop'](_0xc91a('0x1ac'));if(_0x5eccac[_0xc91a('0xb0')]==='yes'){this[_0xc91a('0xb')][_0xc91a('0xa3')](_0xc91a('0x1ad'));return this['channel']['answer']();}return this['channel'][_0xc91a('0xa3')](_0xc91a('0x1ae'));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1af')]=function(_0x48da18){logger[_0xc91a('0x2c')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x48da18[_0xc91a('0x35')]));if(!this['isConfigured'](_0x48da18[_0xc91a('0x1b0')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x48da18,_0xc91a('0x1b1'));}var _0x1cb7c9=this[_0xc91a('0x15')][_0xc91a('0x6a')](this,_0x48da18[_0xc91a('0x1b0')]);if(!this['isConfigured'](_0x1cb7c9)){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x48da18,util[_0xc91a('0x28')](_0xc91a('0x1b2'),_0x48da18['project_id']));}if(_0x1cb7c9===this[_0xc91a('0xb')][_0xc91a('0x36')]){return this[_0xc91a('0xb')]['error'](_0x48da18,_0xc91a('0x1b3'));}this[_0xc91a('0x33')]['sync'](this,_0x48da18,_0x1cb7c9);var _0x802369=this['channel'][_0xc91a('0xa4')](_0xc91a('0x1b4'),util[_0xc91a('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xc91a('0x8')][_0xc91a('0x196')]||_0xc91a('0x1b5'),_0x1cb7c9,this['channel']['arg_1']));if(_0x802369[_0xc91a('0x9e')]===-0x1){return _0x802369;}return this['channel'][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x16b'),_0xc91a('0x1b4'),_0x1cb7c9));};AGIVertices[_0xc91a('0xd')]['system']=function(_0x4d9e27){logger['info'](util[_0xc91a('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4d9e27['label']));var _0x5365b7=this[_0xc91a('0x51')][_0xc91a('0x6a')](this,_0x4d9e27['command']);this['createSquareDetailsReport'][_0xc91a('0x6a')](this,_0x4d9e27,_0x4d9e27['command']);if(this['isConfigured'](_0x4d9e27[_0xc91a('0xcf')])){var _0x1b8119=this[_0xc91a('0xe')][_0xc91a('0x6a')](this,_0x4d9e27[_0xc91a('0xcf')]);if(_0x1b8119){this[_0xc91a('0xb')][_0xc91a('0x9a')](_0x1b8119,_0x5365b7);return this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x1b6'),_0x4d9e27[_0xc91a('0x1b7')],_0x1b8119));}}return this['channel'][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x1b8'),_0x4d9e27[_0xc91a('0x1b7')]));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1b9')]=function(_0x398ed7){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x1ba'),_0x398ed7[_0xc91a('0x35')]));_0x398ed7[_0xc91a('0x55')]=_0x398ed7['text'][_0xc91a('0x187')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc91a('0x81')](_0x398ed7['apiKey'])){return this['channel']['noop'](_0xc91a('0x1bb'));}if(!this[_0xc91a('0x81')](_0x398ed7[_0xc91a('0x55')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0xbc'));}this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x1bc'),_0x398ed7['text']));var _0x4a0144=this['googleCloudTTS'][_0xc91a('0x6a')](this,_0x398ed7);if(_0x4a0144){this['channel'][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x1bd'),_0x4a0144));var _0x4cbcff=this[_0xc91a('0xb')][_0xc91a('0xf6')](_0x4a0144);try{fs['unlink'](_0x4a0144+'.wav');}catch(_0x58fb84){logger[_0xc91a('0x2a')](_0x58fb84);}return _0x4cbcff;}return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x398ed7,_0xc91a('0x1be'));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1bf')]=function(_0x488b5b){logger[_0xc91a('0x2c')](util['format'](_0xc91a('0x1c0'),_0x488b5b[_0xc91a('0x35')]));_0x488b5b[_0xc91a('0x55')]=_0x488b5b['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc91a('0x81')](_0x488b5b[_0xc91a('0x55')])){return this['channel'][_0xc91a('0xa3')](_0xc91a('0xbc'));}this['channel'][_0xc91a('0xa3')](util['format'](_0xc91a('0x1c1'),_0x488b5b[_0xc91a('0x55')]));var _0x4f8060=this[_0xc91a('0x5b')]['sync'](this,_0x488b5b);if(_0x4f8060){this[_0xc91a('0xb')][_0xc91a('0xa3')](util[_0xc91a('0x28')](_0xc91a('0x1c2'),_0x4f8060));var _0x572ad0=this[_0xc91a('0xb')][_0xc91a('0xf6')](_0x4f8060);try{fs[_0xc91a('0x11c')](_0x4f8060+_0xc91a('0xf7'));}catch(_0x2df598){logger['error'](_0x2df598);}return _0x572ad0;}return this[_0xc91a('0xb')]['error'](_0x488b5b,_0xc91a('0x1c3'));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1c4')]=function(_0x20f4a6){logger['info'](util[_0xc91a('0x28')](_0xc91a('0x1c5'),_0x20f4a6[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x20f4a6[_0xc91a('0x150')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x20f4a6,_0xc91a('0x14e'));}logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x14f'),this['channel'][_0xc91a('0x4b')],_0x20f4a6[_0xc91a('0x150')]));var _0x15fe06=this[_0xc91a('0x4c')][_0xc91a('0x6a')](this,_0x20f4a6['findBy']);if(_0x15fe06){logger[_0xc91a('0x2c')](util[_0xc91a('0x28')](_0xc91a('0x152'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0x20f4a6[_0xc91a('0x150')]));this['channel']['noop'](util[_0xc91a('0x28')](_0xc91a('0x152'),this[_0xc91a('0xb')][_0xc91a('0x4b')],_0x20f4a6[_0xc91a('0x150')]));return{'code':0xc8,'result':_0xc91a('0x153')};}else{logger[_0xc91a('0x2c')](util['format'](_0xc91a('0x154'),this[_0xc91a('0xb')]['callerid'],_0x20f4a6[_0xc91a('0x150')]));this[_0xc91a('0xb')][_0xc91a('0xa3')](util['format'](_0xc91a('0x154'),this['channel'][_0xc91a('0x4b')],_0x20f4a6['findBy']));return{'code':0xc8,'result':_0xc91a('0x155')};}};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1c6')]=function(_0x5a0f2d){logger[_0xc91a('0x2c')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5a0f2d[_0xc91a('0x35')]));var _0x3dd4e5=this['channel']['exec'](_0xc91a('0x1c7'),[_0x5a0f2d[_0xc91a('0x1c8')],_0x5a0f2d['options']]);if(_0x3dd4e5[_0xc91a('0x9e')]===-0x1){return _0x3dd4e5;}return this[_0xc91a('0xb')]['noop'](util[_0xc91a('0x28')](_0xc91a('0x16b'),_0xc91a('0x1c7'),_0x5a0f2d[_0xc91a('0x1c8')]));};AGIVertices[_0xc91a('0xd')][_0xc91a('0x1c9')]=function(_0x27b6bb){logger['info'](util[_0xc91a('0x28')](_0xc91a('0x1ca'),_0x27b6bb[_0xc91a('0x35')]));if(!this[_0xc91a('0x81')](_0x27b6bb[_0xc91a('0xcf')])){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x27b6bb,_0xc91a('0x1a8'));}var _0x5a66f4=this[_0xc91a('0xe')]['sync'](this,_0x27b6bb[_0xc91a('0xcf')]);if(!_0x5a66f4){return this[_0xc91a('0xb')][_0xc91a('0x2a')](_0x27b6bb,_0xc91a('0xd0'));}var _0x2cf406=this[_0xc91a('0xb')]['getVariable'](_0x5a66f4);return{'code':0xc8,'result':_0x2cf406[_0xc91a('0x9c')]?_0x2cf406[_0xc91a('0x9c')]:'-'};};String[_0xc91a('0xd')][_0xc91a('0x1cb')]=function(_0x3d6d89,_0x268e81){return this[_0xc91a('0x9b')](_0x3d6d89)[_0xc91a('0x1cc')](_0x268e81);};module[_0xc91a('0x1cd')]=AGIVertices; \ No newline at end of file +var _0xa0b2=['google_asr_language','tildeASR','appid','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','options','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','delay','add','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','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','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','ispeechasr','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','catch','prototype','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MP3','googleTTS','url','method','timeout','number','includes','POST','body','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_lex_region','googleASR'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa0b2,0x14f));var _0x2a0b=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xa0b2[_0x2300c7];return _0x23f720;};'use strict';var fs=require('fs');var path=require(_0x2a0b('0x0'));var util=require(_0x2a0b('0x1'));var _=require('lodash');var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x2a0b('0x2'));var moment=require('moment');var Mustache=require(_0x2a0b('0x3'));var rp=require(_0x2a0b('0x4'));var logger=require(_0x2a0b('0x5'))(_0x2a0b('0x6'));var config=require(_0x2a0b('0x7'));var scripts=require(_0x2a0b('0x8'));var FILES_PATH=_0x2a0b('0x9');var recursiveMapAttributes=[_0x2a0b('0xa'),'rawBody'];var verticesWithRetry=[_0x2a0b('0xb'),'getdigits',_0x2a0b('0xc')];var AGIVertices=function(_0xbdc769,_0x182f13,_0x299184){this[_0x2a0b('0xd')]=_0xbdc769;this[_0x2a0b('0xe')]=_0x182f13;this['mailRpc']=_0x299184;};AGIVertices['prototype'][_0x2a0b('0xf')]=function(_0x460b92,_0x6ea87a){this[_0x2a0b('0xe')][_0x2a0b('0x10')](_0x460b92)[_0x2a0b('0x11')](function(_0x3bc3a0){_0x6ea87a(null,_0x3bc3a0?_0x3bc3a0[_0x2a0b('0x12')]:![]);})['catch'](function(_0x207e80){_0x6ea87a(_0x207e80);});};AGIVertices['prototype'][_0x2a0b('0x13')]=function(_0x5e8a1f,_0x37f768){this[_0x2a0b('0xe')][_0x2a0b('0x14')](_0x5e8a1f)[_0x2a0b('0x11')](function(_0x1778bf){_0x37f768(null,_0x1778bf?_0x1778bf[_0x2a0b('0x12')]:![]);})['catch'](function(_0x23f354){_0x37f768(_0x23f354);});};AGIVertices['prototype'][_0x2a0b('0x15')]=function(_0x526132,_0x3dc478){this[_0x2a0b('0xe')][_0x2a0b('0x16')](_0x526132)[_0x2a0b('0x11')](function(_0x2bea7a){_0x3dc478(null,_0x2bea7a?_0x2bea7a[_0x2a0b('0x12')]:![]);})[_0x2a0b('0x17')](function(_0x3ce59f){_0x3dc478(_0x3ce59f);});};AGIVertices[_0x2a0b('0x18')]['getSquareOdbc']=function(_0x51bd2c,_0x45efb7){this[_0x2a0b('0xe')]['getSquareOdbcById'](_0x51bd2c)[_0x2a0b('0x11')](function(_0x300829){_0x45efb7(null,_0x300829?_0x300829[_0x2a0b('0x19')]:![]);})[_0x2a0b('0x17')](function(_0x86712e){_0x45efb7(_0x86712e);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x1a')]=function(_0x268a08,_0x20c9ca){this['rpc'][_0x2a0b('0x1b')](_0x268a08)[_0x2a0b('0x11')](function(_0x2ce9d6){_0x20c9ca(null,_0x2ce9d6?_0x2ce9d6['name']:![]);})[_0x2a0b('0x17')](function(_0x4eb2c7){_0x20c9ca(_0x4eb2c7);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x1c')]=function(_0x3d73cf,_0x5412e4){this[_0x2a0b('0xe')][_0x2a0b('0x1d')](_0x3d73cf)[_0x2a0b('0x11')](function(_0x530916){_0x5412e4(null,_0x530916?_0x530916[_0x2a0b('0x12')]:![]);})[_0x2a0b('0x17')](function(_0x3e7082){_0x5412e4(_0x3e7082);});};AGIVertices['prototype'][_0x2a0b('0x1e')]=function(_0x4c3b2a,_0x247e09){var _0x580204=this;this[_0x2a0b('0xe')]['getSoundById'](_0x4c3b2a)[_0x2a0b('0x11')](function(_0x53c46b){_0x247e09(null,_0x53c46b?_0x580204[_0x2a0b('0x1f')](_0x53c46b['save_name']):![]);})[_0x2a0b('0x17')](function(_0x2aab39){_0x247e09(_0x2aab39);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x20')]=function(_0x8ba38,_0x1401d4){this['rpc'][_0x2a0b('0x21')](_0x8ba38)['then'](function(_0x450fb4){_0x1401d4(null,_0x450fb4?_0x450fb4:![]);})[_0x2a0b('0x17')](function(_0x455687){_0x1401d4(_0x455687);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x22')]=function(_0x3a498a,_0x145c33,_0x40ee99){this['mailRpc'][_0x2a0b('0x22')](_0x3a498a,_0x145c33)[_0x2a0b('0x11')](function(){_0x40ee99(null);})[_0x2a0b('0x17')](function(_0x2261de){_0x40ee99(_0x2261de);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x23')]=function(_0x1eb1c0,_0x41894e){this[_0x2a0b('0xe')]['getIntervalById'](_0x1eb1c0)[_0x2a0b('0x11')](function(_0x2d318c){if(_0x2d318c){if(_0x2d318c[_0x2a0b('0x24')]){_0x41894e(null,[_0x2d318c['interval']]);}else{_0x41894e(null,_[_0x2a0b('0x25')](_0x2d318c[_0x2a0b('0x26')],_0x2a0b('0x27')));}}else{_0x41894e(null,![]);}})[_0x2a0b('0x17')](function(_0x51f3af){_0x41894e(_0x51f3af);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x1f')]=function(_0x122637){return util[_0x2a0b('0x28')](_0x2a0b('0x29'),FILES_PATH,_0x122637);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x2a')]=function(_0x5293b9,_0x566402,_0xc6a323){odbc[_0x2a0b('0x2b')](_0x5293b9,function(_0x1723e5){if(_0x1723e5){logger[_0x2a0b('0x2c')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1723e5);_0xc6a323(_0x1723e5);}else{logger[_0x2a0b('0x2d')](_0x2a0b('0x2e'));odbc[_0x2a0b('0x2f')](_0x566402,function(_0x2539b6,_0x4b208d){if(_0x2539b6){logger[_0x2a0b('0x2d')]('Error\x20executing\x20query\x20%s',_0x566402);_0xc6a323(_0x2539b6);}else{logger[_0x2a0b('0x2d')](_0x2a0b('0x30'),_0x566402);odbc[_0x2a0b('0x31')](function(_0x3e9fb6){if(_0x3e9fb6){logger[_0x2a0b('0x2c')](_0x2a0b('0x32'),_0x3e9fb6);}_0xc6a323(null,_0x4b208d);});}});}});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x33')]=function(_0x46a314,_0x25282f){this[_0x2a0b('0xe')][_0x2a0b('0x34')](_0x46a314)[_0x2a0b('0x11')](function(_0x1d93c0){_0x25282f(null,_0x1d93c0?_0x1d93c0:![]);})['catch'](function(_0x361319){_0x25282f(_0x361319);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x35')]=function(_0x8ab48e,_0x319785){this['rpc']['createSmsMessage'](_0x8ab48e)[_0x2a0b('0x11')](function(_0xdb89e1){_0x319785(null,_0xdb89e1);})[_0x2a0b('0x17')](function(_0x546b27){_0x319785(_0x546b27);});};AGIVertices[_0x2a0b('0x18')]['createSquareDetailsReport']=function(_0x58bc16,_0x417354,_0x4aeec6){this[_0x2a0b('0xe')][_0x2a0b('0x36')]({'uniqueid':this[_0x2a0b('0xd')][_0x2a0b('0x37')],'node':_0x58bc16['label'],'application':_0x58bc16[_0x2a0b('0x38')],'data':_0x417354||null,'project_name':this[_0x2a0b('0xd')]['arg_1'],'callerid':this['channel'][_0x2a0b('0x39')]})[_0x2a0b('0x11')](function(_0x2d232d){if(_0x4aeec6){_0x4aeec6(null,_0x2d232d);}})['catch'](function(_0x27ad9e){if(_0x4aeec6){_0x4aeec6(_0x27ad9e);}});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x3a')]=function(_0x9cb0a4,_0x71e098,_0x247e34,_0x51e6c0){this['rpc']['createSquareRecording']({'uniqueid':this[_0x2a0b('0xd')][_0x2a0b('0x37')],'callerid':this[_0x2a0b('0xd')]['callerid'],'calleridname':this[_0x2a0b('0xd')][_0x2a0b('0x3b')],'context':this[_0x2a0b('0xd')][_0x2a0b('0x3c')],'extension':this[_0x2a0b('0xd')][_0x2a0b('0x3d')],'priority':this[_0x2a0b('0xd')][_0x2a0b('0x3e')],'accountcode':this[_0x2a0b('0xd')][_0x2a0b('0x3f')],'dnid':this[_0x2a0b('0xd')][_0x2a0b('0x40')],'projectName':this[_0x2a0b('0xd')][_0x2a0b('0x41')],'saveName':_0x71e098,'filename':_0x9cb0a4[_0x2a0b('0x42')]||_0x71e098,'savePath':_0x247e34})['then'](function(_0xf05e36){_0x51e6c0(null,_0xf05e36);})[_0x2a0b('0x17')](function(_0x2c2e98){_0x51e6c0(_0x2c2e98);});};AGIVertices['prototype'][_0x2a0b('0x43')]=function(_0x3470f9,_0xcd1921,_0x1d0d7f,_0x47f06a,_0x2e4cf3){this['rpc'][_0x2a0b('0x43')]({'uniqueid':this[_0x2a0b('0xd')][_0x2a0b('0x37')],'body':_0x3470f9,'direction':_0xcd1921,'providerName':_0x1d0d7f,'providerResponse':_0x47f06a})['then'](function(_0x238740){if(_0x2e4cf3){_0x2e4cf3(null,_0x238740);}})['catch'](function(_0x45c7da){if(_0x2e4cf3){_0x2e4cf3(_0x45c7da);}});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x44')]=function(_0x13d5d1,_0x4007a0){this[_0x2a0b('0xe')]['createCmContact']({'firstName':_[_0x2a0b('0x45')](_0x13d5d1[_0x2a0b('0x12')])||_[_0x2a0b('0x46')](_0x13d5d1[_0x2a0b('0x12')])?_0x2a0b('0x47')+Math[_0x2a0b('0x48')]():_0x13d5d1[_0x2a0b('0x12')],'lastName':_[_0x2a0b('0x45')](_0x13d5d1['lastName'])||_[_0x2a0b('0x46')](_0x13d5d1['lastName'])?null:_0x13d5d1[_0x2a0b('0x49')],'phone':_0x13d5d1[_0x2a0b('0x4a')],'ListId':_0x13d5d1[_0x2a0b('0x4b')],'scheduledat':_0x13d5d1['scheduledAt'],'callbackUniqueid':this[_0x2a0b('0xd')]['uniqueid'],'tags':_0x2a0b('0x4c'),'description':_0x2a0b('0x4d')+_0x13d5d1['scheduledAt'][_0x2a0b('0x4e')](),'priority':_0x13d5d1[_0x2a0b('0x4f')]})['then'](function(_0x32f2b6){_0x4007a0(null,_0x32f2b6);})['catch'](function(_0x5ecf6f){_0x4007a0(_0x5ecf6f);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x50')]=function(_0x54ac40,_0x3446b9){this[_0x2a0b('0xe')]['getPauseById'](_0x54ac40)[_0x2a0b('0x11')](function(_0x41053e){_0x3446b9(null,_0x41053e?_0x41053e['name']:![]);})[_0x2a0b('0x17')](function(_0x4360f3){_0x3446b9(_0x4360f3);});};AGIVertices['prototype'][_0x2a0b('0x51')]=function(_0x1b50b6,_0x4a99fc,_0x1c0d21){var _0x3a9c0c={'role':_0x2a0b('0x52')};_0x3a9c0c[_0x1b50b6]=this['channel'][_0x2a0b('0x39')];this['rpc'][_0x2a0b('0x51')](_0x3a9c0c,_0x4a99fc,this[_0x2a0b('0xd')]['uniqueid'])['then'](function(_0x237e82){_0x1c0d21(null,_[_0x2a0b('0x46')](_0x237e82)?![]:!![]);})[_0x2a0b('0x17')](function(_0x1e6767){logger[_0x2a0b('0x2c')](_0x1e6767);_0x1c0d21(null,![]);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x53')]=function(_0x387a27,_0x384990){var _0x51f9a6={'role':'agent'};_0x51f9a6[_0x387a27]=this['channel'][_0x2a0b('0x39')];this[_0x2a0b('0xe')][_0x2a0b('0x53')](_0x51f9a6)['then'](function(_0x4bc13b){_0x384990(null,_['isNil'](_0x4bc13b)?![]:!![]);})['catch'](function(_0x2e350b){logger[_0x2a0b('0x2c')](_0x2e350b);_0x384990(null,![]);});};AGIVertices[_0x2a0b('0x18')]['agentLogout']=function(_0x3b5565,_0x18ec50){var _0x514cb0={'role':'agent'};_0x514cb0[_0x3b5565]=this['channel']['callerid'];this[_0x2a0b('0xe')][_0x2a0b('0x54')](_0x514cb0)[_0x2a0b('0x11')](function(_0x494de2){_0x18ec50(null,_['isNil'](_0x494de2)?![]:!![]);})[_0x2a0b('0x17')](function(_0xe73fcd){logger[_0x2a0b('0x2c')](_0xe73fcd);_0x18ec50(null,![]);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x55')]=function(_0x4ca183,_0x19133f){var _0x21410a={'role':_0x2a0b('0x52')};_0x21410a[_0x4ca183]=this[_0x2a0b('0xd')]['callerid'];var _0x2f505b=_0x4ca183!=_0x2a0b('0x56')?util[_0x2a0b('0x28')](_0x2a0b('0x57'),'LOCAL',this[_0x2a0b('0xd')][_0x2a0b('0x39')]):undefined;this[_0x2a0b('0xe')]['agentLogin'](_0x21410a,_0x2f505b)[_0x2a0b('0x11')](function(_0x45dca4){_0x19133f(null,_[_0x2a0b('0x46')](_0x45dca4)?![]:!![]);})[_0x2a0b('0x17')](function(_0x3e7d96){logger[_0x2a0b('0x2c')](_0x3e7d96);_0x19133f(null,![]);});};AGIVertices[_0x2a0b('0x18')]['shellCommand']=function(_0x446fbb,_0x561e57){sh['exec'](_[_0x2a0b('0x58')](_0x446fbb),function(_0x53f847,_0x55c884){var _0x8c1099=_0x55c884[_0x2a0b('0x59')](/(\r\n|\n|\r)/gm,'');_0x561e57(null,_0x8c1099);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x5a')]=function(_0x32033e,_0x2d5f05){scripts[_0x2a0b('0x5a')](_0x32033e[_0x2a0b('0x5b')],_0x32033e[_0x2a0b('0x5c')]||'text',_0x32033e[_0x2a0b('0x5d')],_0x32033e[_0x2a0b('0x5e')]||_0x2a0b('0x5f'),_0x32033e[_0x2a0b('0x60')]||'MALE',_0x32033e['audioEncoding']||_0x2a0b('0x61'))['then'](function(_0x3d8819){_0x2d5f05(null,_0x3d8819);})[_0x2a0b('0x17')](function(_0x1aafce){_0x2d5f05(_0x1aafce);});};AGIVertices['prototype'][_0x2a0b('0x62')]=function(_0x327fef,_0x48d44d){scripts[_0x2a0b('0x62')](_0x327fef[_0x2a0b('0x5d')],_0x327fef['google_tts_language']||'en',0x1)[_0x2a0b('0x11')](function(_0x33f684){_0x48d44d(null,_0x33f684);})[_0x2a0b('0x17')](function(_0x273c79){_0x48d44d(_0x273c79);});};AGIVertices[_0x2a0b('0x18')]['restAPI']=function(_0x504952,_0x15731d){var _0x3206a7={'uri':_0x504952[_0x2a0b('0x63')],'method':_0x504952[_0x2a0b('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x504952[_0x2a0b('0x65')])===_0x2a0b('0x66')&&parseInt(_0x504952['timeout'])>=0x1?parseInt(_0x504952[_0x2a0b('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x2a0b('0x67')]([_0x2a0b('0x68'),'PUT'],_0x3206a7[_0x2a0b('0x64')]['toUpperCase']())){try{_0x3206a7[_0x2a0b('0x69')]=_0x504952['rawBody']?JSON['parse'](_0x504952['rawBody']):{};}catch(_0x3bacf5){logger[_0x2a0b('0x2c')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3bacf5);}}try{_0x3206a7[_0x2a0b('0x6a')]=_0x504952['rawHeaders']?JSON[_0x2a0b('0x6b')](_0x504952[_0x2a0b('0xa')]):{};}catch(_0x265b91){logger[_0x2a0b('0x2c')](_0x2a0b('0x6c'),_0x265b91);}if(_0x504952[_0x2a0b('0x6d')]){try{var _0x3c3597=require(_0x504952[_0x2a0b('0x6d')])[_0x2a0b('0x6e')](this,_0x3206a7);_0x3206a7['uri']=Mustache['render'](_0x504952[_0x2a0b('0x63')],_0x3c3597,{},['$$','$$']);if(_0x3206a7[_0x2a0b('0x6a')]){_0x3206a7['headers']=JSON[_0x2a0b('0x6b')](Mustache[_0x2a0b('0x6f')](JSON['stringify'](_0x3206a7[_0x2a0b('0x6a')]),_0x3c3597,{},['$$','$$']));}if(_0x3206a7[_0x2a0b('0x69')]){_0x3206a7[_0x2a0b('0x69')]=JSON['parse'](Mustache[_0x2a0b('0x6f')](JSON[_0x2a0b('0x70')](_0x3206a7[_0x2a0b('0x69')]),_0x3c3597,{},['$$','$$']));}}catch(_0x59dda2){logger['error'](_0x2a0b('0x71'),_0x59dda2);}}rp(_0x3206a7)['then'](function(_0x155fff){var _0x366fa3={'statusCode':_0x155fff[_0x2a0b('0x72')]||0xc8,'statusMessage':_0x155fff['statusMessage']||'OK','headers':_0x155fff['headers']||{},'body':_0x155fff[_0x2a0b('0x69')]||{}};_0x15731d(null,_0x366fa3);})['catch'](function(_0x2953c8){var _0x3e1fad={'statusCode':_0x2953c8[_0x2a0b('0x72')]||0x1f4,'statusMessage':_0x2953c8[_0x2a0b('0x73')]||_0x2a0b('0x74'),'headers':_0x2953c8['options'][_0x2a0b('0x6a')]||{},'body':_0x2953c8['options'][_0x2a0b('0x69')]||{}};_0x15731d(null,_0x3e1fad);});};AGIVertices['prototype'][_0x2a0b('0x75')]=function(_0x303ed5,_0x1953e4){scripts['googleDialogflow'](this[_0x2a0b('0xd')][_0x2a0b('0x37')],_0x303ed5[_0x2a0b('0x76')],_0x303ed5[_0x2a0b('0x5d')],_0x303ed5[_0x2a0b('0x77')]||'en')[_0x2a0b('0x11')](function(_0x690135){_0x1953e4(null,_0x690135);})[_0x2a0b('0x17')](function(_0x56210c){_0x1953e4(_0x56210c);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x78')]=function(_0x17fc88,_0x5b1092){scripts[_0x2a0b('0x78')](this['channel']['uniqueid'],_0x17fc88[_0x2a0b('0x79')],_0x17fc88['client_email'],_0x17fc88[_0x2a0b('0x7a')],_0x17fc88[_0x2a0b('0x5d')],_0x17fc88['dialogflowV2_language']||'en')['then'](function(_0x1258e6){_0x5b1092(null,_0x1258e6);})[_0x2a0b('0x17')](function(_0x4f69c1){_0x5b1092(_0x4f69c1);});};AGIVertices[_0x2a0b('0x18')]['sestekNDA']=function(_0x279028,_0x35d04a){scripts[_0x2a0b('0x7b')](this[_0x2a0b('0xd')],_0x279028)[_0x2a0b('0x11')](function(_0x1657d4){_0x35d04a(null,_0x1657d4);})[_0x2a0b('0x17')](function(_0x37c0b8){_0x35d04a(_0x37c0b8);});};AGIVertices[_0x2a0b('0x18')]['ispeechTTS']=function(_0x20a0c5,_0x2aa78a){scripts[_0x2a0b('0x7c')](_0x20a0c5['key'],_0x20a0c5[_0x2a0b('0x5d')],_0x20a0c5[_0x2a0b('0x7d')]||_0x2a0b('0x5f'),_0x20a0c5[_0x2a0b('0x7e')])[_0x2a0b('0x11')](function(_0x3e71c4){_0x2aa78a(null,_0x3e71c4);})['catch'](function(_0x3a2fb0){_0x2aa78a(_0x3a2fb0);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x7f')]=function(_0x55e8ad,_0xb7a5bd,_0xe68bb0){scripts[_0x2a0b('0x7f')](_0xb7a5bd,_0x55e8ad['key'],_0x55e8ad['ispeech_asr_language']||'en-US',this['isConfigured'](_0x55e8ad[_0x2a0b('0x80')])?_0x55e8ad['model']:undefined)[_0x2a0b('0x11')](function(_0x59efa8){_0xe68bb0(null,_0x59efa8);})[_0x2a0b('0x17')](function(_0x51070c){_0xe68bb0(_0x51070c);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x81')]=function(_0x4d1fdd,_0x466e45){scripts['awsPolly'](_0x4d1fdd[_0x2a0b('0x82')],_0x4d1fdd[_0x2a0b('0x83')],_0x4d1fdd['aws_polly_region'],_0x4d1fdd['aws_polly_voice']||_0x2a0b('0x84'),_0x4d1fdd['text'],_0x4d1fdd[_0x2a0b('0x85')]||_0x2a0b('0x5d'))[_0x2a0b('0x11')](function(_0x48ca05){_0x466e45(null,_0x48ca05);})['catch'](function(_0x23be93){_0x466e45(_0x23be93);});};AGIVertices[_0x2a0b('0x18')]['awsLex']=function(_0x40e1d8,_0xe5189c){scripts[_0x2a0b('0x86')](this['channel'][_0x2a0b('0x37')],_0x40e1d8[_0x2a0b('0x82')],_0x40e1d8[_0x2a0b('0x83')],_0x40e1d8[_0x2a0b('0x87')],_0x40e1d8['text'],_0x40e1d8['aws_bot_name'])['then'](function(_0x30de6e){_0xe5189c(null,_0x30de6e);})[_0x2a0b('0x17')](function(_0x254022){_0xe5189c(_0x254022);});};AGIVertices['prototype']['googleASR']=function(_0x407949,_0x10f3b5,_0x48846f){scripts[_0x2a0b('0x88')](_0x10f3b5,_0x407949[_0x2a0b('0x76')],_0x407949[_0x2a0b('0x89')]||_0x2a0b('0x5f'))['then'](function(_0x3ef397){_0x48846f(null,_0x3ef397);})[_0x2a0b('0x17')](function(_0x3a385c){_0x48846f(_0x3a385c);});};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x8a')]=function(_0x126edc,_0x259e18,_0x50eae1){scripts['tildeASR'](_0x259e18,_0x126edc[_0x2a0b('0x8b')],_0x126edc['appsecret'],_0x126edc['uri'])[_0x2a0b('0x11')](function(_0x2dcdee){_0x50eae1(null,_0x2dcdee);})['catch'](function(_0x34b6af){_0x50eae1(_0x34b6af);});};AGIVertices['prototype'][_0x2a0b('0x8c')]=function(_0x5dbcbd){var _0x5115d2=_[_0x2a0b('0x67')](verticesWithRetry,_0x5dbcbd['agicommand'])?_0x5dbcbd:_['clone'](_0x5dbcbd);for(var _0x4de023 in _0x5115d2){if(_0x5115d2[_0x2a0b('0x8d')](_0x4de023)){if(_0x5115d2[_0x4de023]&&_[_0x2a0b('0x8e')](_0x5115d2[_0x4de023])){if(_['includes'](recursiveMapAttributes,_0x4de023)){_0x5115d2[_0x4de023]=this[_0x2a0b('0x8f')](_0x5115d2[_0x4de023]);}else{_0x5115d2[_0x4de023]=this[_0x2a0b('0x90')](_0x5115d2[_0x4de023]);}}}}return _0x5115d2;};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x91')]=function(_0x155926){for(var _0x24747e in _0x155926){if(_0x155926['hasOwnProperty'](_0x24747e)){if(_[_0x2a0b('0x92')](_0x155926[_0x24747e])){this['recursiveNodeIndex'](_0x155926[_0x24747e]);}else if(_[_0x2a0b('0x93')](_0x155926[_0x24747e])){for(var _0x23721b=0x0;_0x23721b<_0x155926[_0x24747e][_0x2a0b('0x94')];_0x23721b++){this[_0x2a0b('0x91')](_0x155926[_0x24747e][_0x23721b]);}}else if(_['isString'](_0x155926[_0x24747e])){_0x155926[_0x24747e]=this[_0x2a0b('0x90')](_0x155926[_0x24747e]);}}}};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x95')]=function(_0x54465b,_0x593ba4){for(var _0x181473 in _0x54465b){if(_0x54465b[_0x2a0b('0x8d')](_0x181473)){if(_[_0x2a0b('0x92')](_0x54465b[_0x181473])){if(!_[_0x2a0b('0x45')](_0x54465b[_0x181473])){this['saveRestApiResult'](_0x54465b[_0x181473],util['format'](_0x2a0b('0x96'),_0x593ba4,_0x181473));}}else if(_['isArray'](_0x54465b[_0x181473])){for(var _0x1c2296=0x0;_0x1c2296<_0x54465b[_0x181473]['length'];_0x1c2296++){this['saveRestApiResult'](_0x54465b[_0x181473][_0x1c2296],util['format'](_0x2a0b('0x96'),_0x593ba4,_0x181473+'['+_0x1c2296+']'));}}else{if(!_['isNil'](_0x54465b[_0x181473])){this[_0x2a0b('0xd')][_0x2a0b('0x97')](util['format'](_0x2a0b('0x96'),_0x593ba4,_0x181473),_0x54465b[_0x181473]);}}}}};AGIVertices[_0x2a0b('0x18')]['replaceObjectAllVariables']=function(_0xc3af9e){try{var _0x442bb9=JSON[_0x2a0b('0x6b')](_0xc3af9e);this[_0x2a0b('0x91')](_0x442bb9);return JSON['stringify'](_0x442bb9);}catch(_0x4a72a4){return this[_0x2a0b('0x90')](_0xc3af9e);}};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x90')]=function(_0x38f984){var _0x54d06b=_0x38f984[_0x2a0b('0x98')]('{');for(var _0x1cf070=0x1;_0x1cf070<_0x54d06b[_0x2a0b('0x94')];_0x1cf070+=0x1){var _0xb779b6=_0x54d06b[_0x1cf070]['split']('}');if(_0xb779b6[_0x2a0b('0x94')]>0x1){_0x38f984=_0x38f984[_0x2a0b('0x99')]('{'+_0xb779b6[0x0]+'}',this[_0x2a0b('0xd')]['getVariable'](_0xb779b6[0x0])[_0x2a0b('0x9a')]||_0xb779b6[0x0]);}}if(_0x54d06b[_0x2a0b('0x94')]===0x1){return _0x38f984[_0x2a0b('0x4e')]();}return this[_0x2a0b('0x90')](_0x38f984);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x9b')]=function(_0x2cb613,_0x52dad5){var _0x1deadc=this[_0x2a0b('0xd')][_0x2a0b('0xf')](_0x2cb613);if(_0x1deadc[_0x2a0b('0x9c')]===-0x1){return _0x1deadc;}logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x9d'),_0x52dad5,_0x1deadc['extra']));return this[_0x2a0b('0xd')]['setVariable'](_0x52dad5,_0x1deadc[_0x2a0b('0x9a')]);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x9e')]=function(_0x17bec5){return _0x17bec5&&_0x17bec5!=='0'&&_0x17bec5!=='-1'&&_0x17bec5!=='';};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x9f')]=function(_0x5a7fd7){this['createSquareDetailsReport'][_0x2a0b('0x6e')](this,_0x5a7fd7,'-');_0x5a7fd7['retry']=_0x5a7fd7[_0x2a0b('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x5804d8){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0xa0'),_0x5804d8[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x5804d8[_0x2a0b('0x5d')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xa3'));}var _0x4073a0='\x22'+_0x5804d8[_0x2a0b('0x5d')]+'\x22';if(this[_0x2a0b('0x9e')](_0x5804d8['options'])){_0x4073a0+=','+_0x5804d8[_0x2a0b('0xa4')];}var _0x566eec=this[_0x2a0b('0xd')][_0x2a0b('0xa5')](_0x2a0b('0xa6'),_0x4073a0);if(_0x566eec['result']===-0x1){return _0x566eec;}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xa7'),_0x4073a0));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xa8')]=function(_0x529b9b){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0xa9'),_0x529b9b[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x529b9b[_0x2a0b('0xaa')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x9e01d5=_0x529b9b[_0x2a0b('0xaa')];if(this[_0x2a0b('0x9e')](_0x529b9b[_0x2a0b('0xa4')])){_0x9e01d5+=','+_0x529b9b[_0x2a0b('0xa4')];}var _0x4d516c=this[_0x2a0b('0xd')][_0x2a0b('0xa5')](_0x2a0b('0xab'),_0x9e01d5);if(_0x4d516c[_0x2a0b('0x9c')]===-0x1){return _0x4d516c;}var _0x3aea08=this[_0x2a0b('0x9b')](_0x2a0b('0xac'),_0x2a0b('0xad'));if(_0x3aea08[_0x2a0b('0x9c')]===-0x1){return _0x3aea08;}var _0x2b34af=this['getAndSetVariable'](_0x2a0b('0xae'),'MRCP_RECOG_TRANSCRIPT');if(_0x2b34af['result']===-0x1){return _0x2b34af;}var _0x2b1cc0=this['getAndSetVariable'](_0x2a0b('0xaf'),'MRCP_RECOG_INSTANCE');if(_0x2b1cc0[_0x2a0b('0x9c')]===-0x1){return _0x2b1cc0;}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xb0'),_0x9e01d5));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x6')]=function(_0x2a0e4f){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0xb1'),_0x2a0e4f['label']));return this[_0x2a0b('0xd')][_0x2a0b('0x6')]([_0x2a0e4f[_0x2a0b('0xb2')],_0x2a0e4f[_0x2a0b('0xb3')]]);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xb4')]=function(_0x2b9b68){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0xb5'),_0x2b9b68[_0x2a0b('0xa1')]));if(this[_0x2a0b('0x9e')](_0x2b9b68['timeout'])){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0xb6'),_0x2b9b68[_0x2a0b('0x65')]));var _0x1799e3=this[_0x2a0b('0xd')][_0x2a0b('0xb7')](_0x2b9b68[_0x2a0b('0x65')]);if(_0x1799e3['result']===-0x1){return _0x1799e3;}}return this[_0x2a0b('0xd')]['answer']();};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x4c')]=function(_0x291f10){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0xb8'),_0x291f10[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x291f10[_0x2a0b('0x4b')])){return this[_0x2a0b('0xd')]['error'](_0x291f10,_0x2a0b('0xb9'));}_0x291f10[_0x2a0b('0xba')]=moment();if(this['isConfigured'](_0x291f10[_0x2a0b('0xbb')])){_0x291f10[_0x2a0b('0xba')]=moment()[_0x2a0b('0xbc')](_0x291f10[_0x2a0b('0xbb')],'minutes');}if(!this[_0x2a0b('0x9e')](_0x291f10[_0x2a0b('0x4f')])){_0x291f10[_0x2a0b('0x4f')]=0x2;}this[_0x2a0b('0x44')]['sync'](this,_0x291f10);return this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x291f10[_0x2a0b('0x4a')],_0x291f10[_0x2a0b('0x4b')],_0x291f10['scheduledAt']));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xbd')]=function(_0x4dbe7d){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0xbe'),_0x4dbe7d['label']));var _0x5be4ca=this[_0x2a0b('0xd')]['exec'](_0x4dbe7d[_0x2a0b('0xbf')],_0x4dbe7d[_0x2a0b('0xa4')]);if(_0x5be4ca[_0x2a0b('0x9c')]===-0x1){return _0x5be4ca;}return this[_0x2a0b('0xd')]['noop'](util['format'](_0x2a0b('0xc0'),_0x4dbe7d['application'],_0x4dbe7d[_0x2a0b('0xa4')]));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xc1')]=function(_0xcc52dd){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0xc2'),_0xcc52dd[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0xcc52dd[_0x2a0b('0x5d')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')]('no\x20text\x20configured');}var _0x229417='\x22'+_0xcc52dd[_0x2a0b('0x5d')]+'\x22';if(this[_0x2a0b('0x9e')](_0xcc52dd[_0x2a0b('0xa4')])){_0x229417+=','+_0xcc52dd['options'];}var _0x2cb9dc=this[_0x2a0b('0xd')][_0x2a0b('0xa5')]('MRCPSynth',_0x229417);if(_0x2cb9dc[_0x2a0b('0x9c')]===-0x1){return _0x2cb9dc;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x229417));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xc3')]=function(_0xcc0f6c){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0xc4'),_0xcc0f6c[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0xcc0f6c[_0x2a0b('0x5d')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0xa3'));}var _0x2308cf='\x22'+_0xcc0f6c[_0x2a0b('0x5d')]+'\x22';if(this[_0x2a0b('0x9e')](_0xcc0f6c[_0x2a0b('0xa4')])){_0x2308cf+=','+_0xcc0f6c[_0x2a0b('0xa4')];}var _0x28f4df=this['channel'][_0x2a0b('0xa5')]('MRCPSynth',_0x2308cf);if(_0x28f4df[_0x2a0b('0x9c')]===-0x1){return _0x28f4df;}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xa7'),_0x2308cf));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xc5')]=function(_0x16c5c6){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0xc6'),_0x16c5c6['label']));if(!this[_0x2a0b('0x9e')](_0x16c5c6[_0x2a0b('0xaa')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xc7'));}var _0xeebb7b=_0x16c5c6['grammar'];if(this[_0x2a0b('0x9e')](_0x16c5c6[_0x2a0b('0xa4')])){_0xeebb7b+=','+_0x16c5c6[_0x2a0b('0xa4')];}var _0x56e10a=this['channel'][_0x2a0b('0xa5')](_0x2a0b('0xab'),_0xeebb7b);if(_0x56e10a[_0x2a0b('0x9c')]===-0x1){return _0x56e10a;}var _0x4d8196=this[_0x2a0b('0x9b')](_0x2a0b('0xac'),_0x2a0b('0xc8'));if(_0x4d8196[_0x2a0b('0x9c')]===-0x1){return _0x4d8196;}var _0x536e20=this['getAndSetVariable'](_0x2a0b('0xae'),_0x2a0b('0xc9'));if(_0x536e20['result']===-0x1){return _0x536e20;}var _0x4ddf10=this[_0x2a0b('0x9b')](_0x2a0b('0xaf'),_0x2a0b('0xca'));if(_0x4ddf10['result']===-0x1){return _0x4ddf10;}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xb0'),_0xeebb7b));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xcb')]=function(_0x5c7195){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0xcc'),_0x5c7195[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x5c7195[_0x2a0b('0xaa')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xc7'));}var _0x4cab46=_0x5c7195[_0x2a0b('0xaa')];if(this[_0x2a0b('0x9e')](_0x5c7195[_0x2a0b('0xa4')])){_0x4cab46+=','+_0x5c7195[_0x2a0b('0xa4')];}var _0xd9a0cb=this[_0x2a0b('0xd')][_0x2a0b('0xa5')](_0x2a0b('0xab'),_0x4cab46);if(_0xd9a0cb['result']===-0x1){return _0xd9a0cb;}var _0x1a6ca4=this[_0x2a0b('0x9b')](_0x2a0b('0xac'),_0x2a0b('0xcd'));if(_0x1a6ca4[_0x2a0b('0x9c')]===-0x1){return _0x1a6ca4;}var _0x5f0545=this[_0x2a0b('0x9b')](_0x2a0b('0xae'),_0x2a0b('0xce'));if(_0x5f0545[_0x2a0b('0x9c')]===-0x1){return _0x5f0545;}var _0x29d9aa=this[_0x2a0b('0x9b')](_0x2a0b('0xaf'),'SESTEK_ASR_INSTANCE');if(_0x29d9aa['result']===-0x1){return _0x29d9aa;}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xb0'),_0x4cab46));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xcf')]=function(_0x477cfe){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0xd0'),_0x477cfe[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x477cfe[_0x2a0b('0xd1')])){return this[_0x2a0b('0xd')]['error'](_0x477cfe,_0x2a0b('0xd2'));}var _0x11c299=this[_0x2a0b('0xd3')][_0x2a0b('0x6e')](this,_0x477cfe[_0x2a0b('0xd1')]);if(!_0x11c299){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x477cfe,_0x2a0b('0xd4'));}if(!this[_0x2a0b('0x9e')](_0x477cfe['query'])){return this[_0x2a0b('0xd')]['error'](_0x477cfe,_0x2a0b('0xd5'));}var _0x2b5299=_0x477cfe[_0x2a0b('0x2f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xd6'),_0x2b5299));var _0x3a467e=this[_0x2a0b('0x2a')]['sync'](this,_0x11c299,_0x2b5299);this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x477cfe,_0x2b5299);if(!this[_0x2a0b('0x9e')](_0x477cfe[_0x2a0b('0xd7')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0xd8'));}var _0xef07f5=this['getVariable'][_0x2a0b('0x6e')](this,_0x477cfe['variable_id']);if(!_0xef07f5){return this[_0x2a0b('0xd')]['error'](_0x477cfe,'no\x20variable\x20found');}var _0x1baf7c=this;_0x3a467e[_0x2a0b('0xd9')](function(_0x2dc7b2,_0x186ade){Object[_0x2a0b('0xda')](_0x2dc7b2)[_0x2a0b('0xd9')](function(_0x22a22d){_0x1baf7c['channel']['setVariable'](util[_0x2a0b('0x28')](_0x2a0b('0xdb'),_0xef07f5,_0x186ade,_0x22a22d),_0x2dc7b2[_0x22a22d]);});});this['channel'][_0x2a0b('0x97')](util[_0x2a0b('0x28')](_0x2a0b('0xdc'),_0xef07f5),_0x3a467e[_0x2a0b('0x94')]);return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format'](_0x2a0b('0xdd'),_0xef07f5));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xde')]=function(_0x57ff69){logger[_0x2a0b('0xdf')](util[_0x2a0b('0x28')](_0x2a0b('0xe0'),_0x57ff69['label']));if(!this['isConfigured'](_0x57ff69[_0x2a0b('0xe1')])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x57ff69,_0x2a0b('0xe2'));}var _0x4d7816=this['getUser'][_0x2a0b('0x6e')](this,_0x57ff69[_0x2a0b('0xe1')]);if(!_0x4d7816){return this['channel'][_0x2a0b('0x2c')](_0x57ff69,_0x2a0b('0xe3'));}var _0x4fff9b=this[_0x2a0b('0xd')][_0x2a0b('0xa5')]('DIAL',[util[_0x2a0b('0x28')](_0x2a0b('0xe4'),_0x4d7816),_0x57ff69[_0x2a0b('0x65')],_0x57ff69[_0x2a0b('0xe5')],_0x57ff69[_0x2a0b('0x63')]]);if(_0x4fff9b[_0x2a0b('0x9c')]===-0x1){return _0x4fff9b;}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xe6'),_0x2a0b('0xe7')));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xe8')]=function(_0x373f17){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0xe9'),_0x373f17[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x373f17[_0x2a0b('0x76')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0xea'));}if(!this[_0x2a0b('0x9e')](_0x373f17[_0x2a0b('0x5d')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0xa3'));}this[_0x2a0b('0xd')][_0x2a0b('0xeb')]=!![];this[_0x2a0b('0x36')](_0x373f17);this[_0x2a0b('0x43')](_0x373f17[_0x2a0b('0x5d')],'in','','');this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xec'),_0x373f17[_0x2a0b('0x5d')]));var _0x78c7cb=this[_0x2a0b('0x75')][_0x2a0b('0x6e')](this,_0x373f17);if(_0x78c7cb){for(var _0x36e6ba in _0x78c7cb){if(_0x78c7cb['hasOwnProperty'](_0x36e6ba)){this[_0x2a0b('0xd')][_0x2a0b('0x97')](util[_0x2a0b('0x28')]('DIALOGFLOW_%s',_0x36e6ba[_0x2a0b('0xed')]()),_0x78c7cb[_0x36e6ba]);}}this['createSquareMessage'](_0x78c7cb[_0x2a0b('0xee')],_0x2a0b('0xef'),_0x2a0b('0xe8'),'');return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format'](_0x2a0b('0xf0'),_0x78c7cb[_0x2a0b('0xee')]));}return this[_0x2a0b('0xd')]['error'](_0x373f17,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xf1')]=function(_0x1b9901){logger[_0x2a0b('0x2d')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1b9901[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x1b9901[_0x2a0b('0x79')])){return this[_0x2a0b('0xd')]['noop']('no\x20project_id\x20configured');}if(!this[_0x2a0b('0x9e')](_0x1b9901['client_email'])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xf2'));}if(!this[_0x2a0b('0x9e')](_0x1b9901[_0x2a0b('0x7a')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xf3'));}if(!this[_0x2a0b('0x9e')](_0x1b9901[_0x2a0b('0xf4')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xf5'));}if(!this[_0x2a0b('0x9e')](_0x1b9901[_0x2a0b('0x5d')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')]('no\x20text\x20configured');}this['channel'][_0x2a0b('0xeb')]=!![];this['createSquareDetailsReport'](_0x1b9901);this['createSquareMessage'](_0x1b9901[_0x2a0b('0x5d')],'in','','');this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x1b9901[_0x2a0b('0x5d')]));var _0x38dcb8=this['googleDialogflowV2'][_0x2a0b('0x6e')](this,_0x1b9901);if(_0x38dcb8){for(var _0x35ca72 in _0x38dcb8){if(_0x38dcb8['hasOwnProperty'](_0x35ca72)){if(_0x35ca72!==_0x2a0b('0xf6')){this[_0x2a0b('0xd')][_0x2a0b('0x97')](util['format'](_0x2a0b('0xf7'),_0x35ca72[_0x2a0b('0xed')]()),_0x38dcb8[_0x35ca72]);}}}this[_0x2a0b('0x43')](_0x38dcb8[_0x2a0b('0xee')],_0x2a0b('0xef'),'dialogflowV2',_0x38dcb8[_0x2a0b('0xf6')]);return this[_0x2a0b('0xd')]['noop'](util[_0x2a0b('0x28')]('DialogflowV2\x20Result\x20%s',_0x38dcb8[_0x2a0b('0xee')]));}return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x1b9901,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xf8')]=function(_0x11763a){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0xf9'),_0x11763a[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x11763a[_0x2a0b('0xfa')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0xfb'));}if(!this[_0x2a0b('0x9e')](_0x11763a[_0x2a0b('0xfc')])){return this[_0x2a0b('0xd')]['noop'](_0x2a0b('0xfd'));}if(!this[_0x2a0b('0x9e')](_0x11763a[_0x2a0b('0xfe')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xff'));}if(!this['isConfigured'](_0x11763a[_0x2a0b('0x100')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')]('no\x20text\x20configured');}this['channel'][_0x2a0b('0xeb')]=!![];this['createSquareDetailsReport'](_0x11763a);this['createSquareMessage'](_0x11763a[_0x2a0b('0x5d')],'in','','');this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x101'),_0x11763a[_0x2a0b('0x5d')]));var _0x121771=this[_0x2a0b('0x7b')]['sync'](this,_0x11763a);if(_0x121771){for(var _0x45846a in _0x121771){if(_0x121771[_0x2a0b('0x8d')](_0x45846a)){this[_0x2a0b('0xd')]['setVariable'](util[_0x2a0b('0x28')]('SESTEK_NDA_%s',_0x45846a[_0x2a0b('0xed')]()),_0x121771[_0x45846a]);}}this[_0x2a0b('0x43')](_0x121771['speech'],_0x2a0b('0xef'),_0x2a0b('0xf8'),'');if(_0x121771[_0x2a0b('0x102')]){this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x103'),_0x121771[_0x2a0b('0x102')]));var _0x3bd96f=this['channel'][_0x2a0b('0x104')](_0x121771[_0x2a0b('0x102')]);try{fs[_0x2a0b('0x105')](_0x121771[_0x2a0b('0x102')]+'.wav');}catch(_0x489863){logger[_0x2a0b('0x2c')](_0x489863);}return _0x3bd96f;}else{return this['channel'][_0x2a0b('0xa2')](util['format']('SestekNDA\x20Result\x20%s',_0x121771[_0x2a0b('0xee')]));}}return this[_0x2a0b('0xd')]['error'](_0x11763a,_0x2a0b('0x106'));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x107')]=function(_0x3ea62e){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x108'),_0x3ea62e[_0x2a0b('0xa1')]));return this['channel'][_0x2a0b('0xa2')]('end');};AGIVertices[_0x2a0b('0x18')]['ext_dial']=function(_0x971144){logger['info'](util[_0x2a0b('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x971144['label']));var _0x3eccb6='';if(_0x971144[_0x2a0b('0x109')]){if(!this[_0x2a0b('0x9e')](_0x971144[_0x2a0b('0x109')])){return this[_0x2a0b('0xd')]['error'](_0x971144,_0x2a0b('0x10a'));}else{var _0x2d4422=parseInt(_0x971144['trunk_id'],0xa);if(isNaN(_0x2d4422)){_0x3eccb6=_0x971144[_0x2a0b('0x109')];}else{_0x3eccb6=this[_0x2a0b('0x1c')][_0x2a0b('0x6e')](this,_0x971144['trunk_id']);if(!_0x3eccb6){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x971144,'no\x20trunk\x20found');}}}}else if(_0x971144[_0x2a0b('0x10b')]){_0x3eccb6=_0x971144[_0x2a0b('0x10b')];}else{return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x971144,_0x2a0b('0x10a'));}var _0x47b53a=this[_0x2a0b('0xd')][_0x2a0b('0xa5')](_0x2a0b('0xe7'),[util[_0x2a0b('0x28')](_0x2a0b('0x10c'),_0x3eccb6,_0x971144[_0x2a0b('0x4a')]),_0x971144[_0x2a0b('0x65')],_0x971144['opts'],_0x971144[_0x2a0b('0x63')]]);if(_0x47b53a['result']===-0x1){return _0x47b53a;}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format'](_0x2a0b('0xe6'),'DIAL'));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x10d')]=function(_0x3e5c93){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x10e'),_0x3e5c93[_0x2a0b('0xa1')]));return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x10d'));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x10f')]=function(_0x22a26e){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x110'),_0x22a26e['label']));if(_0x22a26e[_0x2a0b('0x111')]===0x0){return this['maxRetry'](_0x22a26e);}_0x22a26e[_0x2a0b('0x111')]-=0x1;if(!this[_0x2a0b('0x9e')](_0x22a26e[_0x2a0b('0x112')])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x22a26e,_0x2a0b('0x113'));}var _0x141b0a=this[_0x2a0b('0x1e')][_0x2a0b('0x6e')](this,_0x22a26e[_0x2a0b('0x112')]);if(!_0x141b0a){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x22a26e,_0x2a0b('0x114'));}if(!this[_0x2a0b('0x9e')](_0x22a26e['variable_id'])){return this[_0x2a0b('0xd')]['error'](_0x2a0b('0xd8'));}var _0x4c6cb8=this['channel'][_0x2a0b('0x115')](_0x141b0a,_0x22a26e[_0x2a0b('0x116')],_0x22a26e[_0x2a0b('0x117')]);var _0x4fb781=_0x4c6cb8['result']?_0x4c6cb8[_0x2a0b('0x9c')][_0x2a0b('0x4e')]():'';logger[_0x2a0b('0x2d')](_0x2a0b('0x118'),JSON[_0x2a0b('0x70')](_0x4c6cb8));if(_0x4c6cb8[_0x2a0b('0x9c')]===-0x1){this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x22a26e,_0x4fb781);return _0x4c6cb8;}else if(_0x4c6cb8[_0x2a0b('0x9a')]===_0x2a0b('0x65')){_0x4c6cb8[_0x2a0b('0x9c')]=_0x4fb781[_0x2a0b('0x94')]>=parseInt(_0x22a26e['mindigit'])?'x':'i';}else{_0x4c6cb8['result']=_0x4fb781[_0x2a0b('0x94')]>=parseInt(_0x22a26e[_0x2a0b('0x119')])&&_0x4fb781[_0x2a0b('0x94')]<=parseInt(_0x22a26e[_0x2a0b('0x117')])?'x':'i';}var _0x2aa8a2=this[_0x2a0b('0xf')][_0x2a0b('0x6e')](this,_0x22a26e[_0x2a0b('0xd7')]);if(!_0x2aa8a2){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x22a26e,_0x2a0b('0x11a'));}this[_0x2a0b('0xd')][_0x2a0b('0x97')](_0x2aa8a2,_0x4fb781);if(this[_0x2a0b('0x9e')](_0x22a26e[_0x2a0b('0x11b')])){var _0xb210c6=parseInt(_0x22a26e['hiddendigitsnum'],0xa);var _0xbc1f14=rs[_0x2a0b('0x11c')]({'charset':'*','length':_0xb210c6});var _0x2534a7=_0x4fb781[_0x2a0b('0x94')];if(_0x2534a7>0x0){if(_0x2534a7>_0xb210c6){this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x22a26e,_0x22a26e['hiddendigitspos']===_0x2a0b('0x11d')?_0xbc1f14+_0x4fb781[_0x2a0b('0x11e')](_0xb210c6):_0x4fb781['substr'](0x0,_0x2534a7-_0xb210c6)+_0xbc1f14);}else{this[_0x2a0b('0x36')]['sync'](this,_0x22a26e,rs[_0x2a0b('0x11c')]({'charset':'*','length':_0x2534a7}));}}else{this[_0x2a0b('0x36')]['sync'](this,_0x22a26e,'');}}else{this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x22a26e,_0x4fb781);}return _0x4c6cb8;};AGIVertices['prototype'][_0x2a0b('0xc')]=function(_0x484fc4){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x11f'),_0x484fc4[_0x2a0b('0xa1')]));return this[_0x2a0b('0x10f')](_0x484fc4);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x120')]=function(_0x411a48){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x121'),_0x411a48[_0x2a0b('0xa1')]));this[_0x2a0b('0x36')]['sync'](this,_0x411a48,_0x411a48[_0x2a0b('0x122')]);return this[_0x2a0b('0xd')]['noop'](util[_0x2a0b('0x28')](_0x2a0b('0x123'),_0x411a48['goalname']));};AGIVertices['prototype'][_0x2a0b('0x124')]=function(_0x3d4cc3){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x125'),_0x3d4cc3[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x3d4cc3['aws_access_key_id'])||!this[_0x2a0b('0x9e')](_0x3d4cc3[_0x2a0b('0x83')])){return this[_0x2a0b('0xd')]['noop'](_0x2a0b('0x126'));}if(!this[_0x2a0b('0x9e')](_0x3d4cc3[_0x2a0b('0x5d')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xa3'));}this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format'](_0x2a0b('0x127'),_0x3d4cc3[_0x2a0b('0x5d')]));var _0xa45034=this[_0x2a0b('0x81')][_0x2a0b('0x6e')](this,_0x3d4cc3);if(_0xa45034){this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x128'),_0xa45034));var _0x53abdc=this[_0x2a0b('0xd')][_0x2a0b('0x104')](_0xa45034);try{fs[_0x2a0b('0x105')](_0xa45034+_0x2a0b('0x129'));}catch(_0x528bab){logger['error'](_0x528bab);}return _0x53abdc;}return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x3d4cc3,_0x2a0b('0x12a'));};AGIVertices[_0x2a0b('0x18')]['awslex']=function(_0x16442e){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x12b'),_0x16442e[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x16442e[_0x2a0b('0x82')])||!this[_0x2a0b('0x9e')](_0x16442e[_0x2a0b('0x83')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x126'));}if(!this[_0x2a0b('0x9e')](_0x16442e[_0x2a0b('0x12c')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0x12d'));}if(!this['isConfigured'](_0x16442e['text'])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xa3'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x16442e);this[_0x2a0b('0x43')](_0x16442e[_0x2a0b('0x5d')],'in','','');this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format'](_0x2a0b('0x12e'),_0x16442e[_0x2a0b('0x5d')]));var _0x201918=this[_0x2a0b('0x86')][_0x2a0b('0x6e')](this,_0x16442e);if(_0x201918){for(var _0x4fc6f7 in _0x201918){if(_0x201918['hasOwnProperty'](_0x4fc6f7)&&_['isString'](_0x201918[_0x4fc6f7])){this[_0x2a0b('0xd')][_0x2a0b('0x97')](util[_0x2a0b('0x28')](_0x2a0b('0x12f'),_0x4fc6f7[_0x2a0b('0xed')]()),_0x201918[_0x4fc6f7]);}}if(_['isNil'](_0x201918['message'])){return this[_0x2a0b('0xd')]['noop'](_0x2a0b('0x130'));}else{this[_0x2a0b('0x43')](_0x201918[_0x2a0b('0x73')],_0x2a0b('0xef'),_0x2a0b('0x131'),'');return this[_0x2a0b('0xd')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x201918[_0x2a0b('0x73')]));}}return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x16442e,_0x2a0b('0x132'));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x133')]=function(_0x2bfd62){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x134'),_0x2bfd62[_0x2a0b('0xa1')],_0x2bfd62[_0x2a0b('0x65')]));if(!this[_0x2a0b('0x9e')](_0x2bfd62[_0x2a0b('0x76')])){return this['channel']['noop'](_0x2a0b('0xea'));}var _0x199955='wav';var _0x6c5162=util[_0x2a0b('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x2a0b('0x11c')](0x4));var _0x5dcc8f=util[_0x2a0b('0x28')]('%s.%s',_0x6c5162,_0x199955);var _0x10fccd=!![];if(_0x2bfd62[_0x2a0b('0x135')]===_0x2a0b('0x136')){_0x10fccd=![];}var _0x4ef1a5=this[_0x2a0b('0xd')][_0x2a0b('0x137')](_0x6c5162,_0x199955,_0x2bfd62[_0x2a0b('0x138')],_0x2bfd62['timeout'],undefined,_0x10fccd);if(_0x4ef1a5[_0x2a0b('0x9c')]!==-0x1){this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x139'),_0x5dcc8f));var _0x128454=this[_0x2a0b('0x88')][_0x2a0b('0x6e')](this,_0x2bfd62,_0x5dcc8f);if(_0x128454){for(var _0x4e4b61 in _0x128454){if(_0x128454['hasOwnProperty'](_0x4e4b61)){this[_0x2a0b('0xd')]['setVariable'](util[_0x2a0b('0x28')](_0x2a0b('0x13a'),_0x4e4b61[_0x2a0b('0xed')]()),_0x128454[_0x4e4b61]);}}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0x2a0b('0x70')](_0x128454)));}}return _0x4ef1a5;};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x13b')]=function(_0x29ab50){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x13c'),_0x29ab50[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x29ab50[_0x2a0b('0x8b')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x13d'));}if(!this[_0x2a0b('0x9e')](_0x29ab50['appsecret'])){return this[_0x2a0b('0xd')]['noop'](_0x2a0b('0x13e'));}var _0x1a426e=_0x2a0b('0x13f');var _0x14e4f4=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x2a0b('0x11c')](0x4));var _0x4b5dc0=util['format'](_0x2a0b('0x96'),_0x14e4f4,_0x1a426e);var _0x352934=!![];if(_0x29ab50[_0x2a0b('0x135')]==='NOBEEP'){_0x352934=![];}var _0x2a6bdd=this['channel'][_0x2a0b('0x137')](_0x14e4f4,_0x1a426e,_0x29ab50[_0x2a0b('0x138')],_0x29ab50['timeout'],undefined,_0x352934);if(_0x2a6bdd['result']!==-0x1){this[_0x2a0b('0xd')]['noop'](util[_0x2a0b('0x28')](_0x2a0b('0x140'),_0x4b5dc0));var _0x480fc0=this[_0x2a0b('0x8a')][_0x2a0b('0x6e')](this,_0x29ab50,_0x4b5dc0);if(_0x480fc0){for(var _0x4444ae in _0x480fc0){if(_0x480fc0['hasOwnProperty'](_0x4444ae)){this['channel'][_0x2a0b('0x97')](util[_0x2a0b('0x28')](_0x2a0b('0x141'),_0x4444ae[_0x2a0b('0xed')]()),_0x480fc0[_0x4444ae]);}}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x2a0b('0x70')](_0x480fc0)));}}return _0x2a6bdd;};AGIVertices['prototype'][_0x2a0b('0x142')]=function(_0x1bd15f){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x143'),_0x1bd15f[_0x2a0b('0xa1')]));return this['channel'][_0x2a0b('0x144')](_0x1bd15f[_0x2a0b('0x3c')],_0x1bd15f[_0x2a0b('0x3d')],_0x1bd15f[_0x2a0b('0x3e')]);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x145')]=function(_0x340d21){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x146'),_0x340d21[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x340d21['condition'])){return this[_0x2a0b('0xd')]['error'](_0x340d21,_0x2a0b('0x147'));}try{var _0x2e17ef=eval(_0x340d21[_0x2a0b('0x148')])?'true':'false';this[_0x2a0b('0xd')]['noop'](util[_0x2a0b('0x28')](_0x2a0b('0x149'),_0x340d21[_0x2a0b('0x148')],_0x2e17ef));return{'code':0xc8,'result':_0x2e17ef};}catch(_0x234896){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x14a')]=function(_0x45eb9e){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x14b'),_0x45eb9e[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x45eb9e[_0x2a0b('0x14c')])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x45eb9e,_0x2a0b('0x14d'));}var _0x5c6346=this[_0x2a0b('0x23')][_0x2a0b('0x6e')](this,_0x45eb9e[_0x2a0b('0x14c')]);if(!_0x5c6346){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x45eb9e,'no\x20intervals\x20found');}for(var _0x5897f5=0x0;_0x5897f5<_0x5c6346[_0x2a0b('0x94')];_0x5897f5+=0x1){var _0x2c8a1f=this[_0x2a0b('0xd')]['getVariable'](util[_0x2a0b('0x28')](_0x2a0b('0x14e'),_0x5c6346[_0x5897f5]));if(_0x2c8a1f[_0x2a0b('0x9c')]===-0x1){return _0x2c8a1f;}logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x14f'),_0x5c6346[_0x5897f5],_0x2c8a1f[_0x2a0b('0x9a')]));if(_0x2c8a1f[_0x2a0b('0x9a')]===_0x2a0b('0x150')){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')]('IFTIME\x20%s\x20%s',_0x5c6346[_0x5897f5],_0x2a0b('0x150')));this['channel'][_0x2a0b('0xa2')](util['format'](_0x2a0b('0x14f'),_0x5c6346[_0x5897f5],_0x2a0b('0x150')));return{'code':0xc8,'result':_0x2a0b('0x150')};}else{logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x14f'),_0x5c6346[_0x5897f5],_0x2a0b('0x151')));this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('IFTIME\x20%s\x20%s',_0x5c6346[_0x5897f5],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x152')]=function(_0x478676){logger['info'](util[_0x2a0b('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x478676[_0x2a0b('0xa1')]));return this[_0x2a0b('0xd')][_0x2a0b('0x152')]();};AGIVertices['prototype'][_0x2a0b('0x153')]=function(_0xc5964f){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0xc5964f[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0xc5964f[_0x2a0b('0x76')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0xea'));}var _0x3960f2=_0x2a0b('0x13f');var _0x2b81a2=util['format'](_0x2a0b('0x154'),FILES_PATH,rs[_0x2a0b('0x11c')](0x4));var _0x5250d3=util['format'](_0x2a0b('0x96'),_0x2b81a2,_0x3960f2);var _0x51feed=!![];if(_0xc5964f[_0x2a0b('0x135')]===_0x2a0b('0x136')){_0x51feed=![];}var _0x59fae9=this[_0x2a0b('0xd')]['recordFile'](_0x2b81a2,_0x3960f2,_0xc5964f[_0x2a0b('0x138')],_0xc5964f[_0x2a0b('0x65')],undefined,_0x51feed);if(_0x59fae9['result']!==-0x1){this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x155'),_0x5250d3));var _0x29d587=this['ispeechASR']['sync'](this,_0xc5964f,_0x5250d3);if(_0x29d587){for(var _0xacd8cd in _0x29d587){if(_0x29d587[_0x2a0b('0x8d')](_0xacd8cd)){this[_0x2a0b('0xd')][_0x2a0b('0x97')](util['format'](_0x2a0b('0x156'),_0xacd8cd[_0x2a0b('0xed')]()),_0x29d587[_0xacd8cd]);}}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x157'),JSON[_0x2a0b('0x70')](_0x29d587)));}}return _0x59fae9;};AGIVertices[_0x2a0b('0x18')]['ispeechtts']=function(_0x14248a){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x158'),_0x14248a[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x14248a[_0x2a0b('0x76')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xea'));}if(!this['isConfigured'](_0x14248a[_0x2a0b('0x5d')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0xa3'));}this[_0x2a0b('0xd')]['noop'](util[_0x2a0b('0x28')](_0x2a0b('0x159'),_0x14248a['text']));var _0x31f5a1=this['ispeechTTS'][_0x2a0b('0x6e')](this,_0x14248a);if(_0x31f5a1){this['channel'][_0x2a0b('0xa2')](util['format']('ispeech\x20%s\x20file\x20created',_0x31f5a1));var _0x437f0d=this[_0x2a0b('0xd')]['streamFile'](_0x31f5a1,_0x14248a[_0x2a0b('0x138')]);try{fs[_0x2a0b('0x105')](_0x31f5a1+_0x2a0b('0x129'));}catch(_0x2a10fc){logger[_0x2a0b('0x2c')](_0x2a10fc);}return _0x437f0d;}return this[_0x2a0b('0xd')]['error'](_0x14248a,_0x2a0b('0x15a'));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x15b')]=function(_0x397116){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x15c'),_0x397116[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x397116[_0x2a0b('0x15d')])){return this['channel'][_0x2a0b('0x2c')](_0x397116,_0x2a0b('0x15e'));}logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x15f'),this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x397116[_0x2a0b('0x15d')]));var _0x2dce30=this['agentLogin'][_0x2a0b('0x6e')](this,_0x397116[_0x2a0b('0x15d')]);if(_0x2dce30){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x160'),this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x397116['findBy']));this['channel'][_0x2a0b('0xa2')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x2a0b('0x39')],_0x397116[_0x2a0b('0x15d')]));return{'code':0xc8,'result':_0x2a0b('0x161')};}else{logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x162'),this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x397116[_0x2a0b('0x15d')]));this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x2a0b('0x39')],_0x397116[_0x2a0b('0x15d')]));return{'code':0xc8,'result':_0x2a0b('0x163')};}};AGIVertices[_0x2a0b('0x18')]['logout']=function(_0x286481){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x164'),_0x286481[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x286481[_0x2a0b('0x15d')])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x286481,'no\x20find\x20by\x20configured');}logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x15f'),this[_0x2a0b('0xd')]['callerid'],_0x286481[_0x2a0b('0x15d')]));var _0x29cfab=this[_0x2a0b('0x54')][_0x2a0b('0x6e')](this,_0x286481[_0x2a0b('0x15d')]);if(_0x29cfab){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x160'),this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x286481[_0x2a0b('0x15d')]));this['channel'][_0x2a0b('0xa2')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x2a0b('0xd')]['callerid'],_0x286481[_0x2a0b('0x15d')]));return{'code':0xc8,'result':_0x2a0b('0x161')};}else{logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x162'),this[_0x2a0b('0xd')]['callerid'],_0x286481[_0x2a0b('0x15d')]));this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x162'),this['channel'][_0x2a0b('0x39')],_0x286481['findBy']));return{'code':0xc8,'result':_0x2a0b('0x163')};}};AGIVertices[_0x2a0b('0x18')]['math']=function(_0x9c96b9){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x165'),_0x9c96b9[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x9c96b9[_0x2a0b('0x166')])){return this[_0x2a0b('0xd')]['error'](_0x9c96b9,_0x2a0b('0x167'));}this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('math\x20%s',_0x9c96b9[_0x2a0b('0x166')]));var _0x1f992e=eval(_0x9c96b9[_0x2a0b('0x166')]);if(!this[_0x2a0b('0x9e')](_0x9c96b9[_0x2a0b('0xd7')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xd8'));}var _0x3ddb31=this[_0x2a0b('0xf')][_0x2a0b('0x6e')](this,_0x9c96b9[_0x2a0b('0xd7')]);if(!_0x3ddb31){return this[_0x2a0b('0xd')]['error'](_0x9c96b9,'no\x20variable\x20found');}if(_[_0x2a0b('0x93')](_0x1f992e)){var _0x3e05b5=this;_0x1f992e[_0x2a0b('0xd9')](function(_0x38cb1c,_0x38322a){_0x3e05b5[_0x2a0b('0xd')][_0x2a0b('0x97')](util[_0x2a0b('0x28')](_0x2a0b('0x168'),_0x3ddb31,_0x38322a),_0x38cb1c);});return this['channel']['noop'](util['format'](_0x2a0b('0x169'),_0x3ddb31));}else{return this['channel']['setVariable'](_0x3ddb31,_0x1f992e);}};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xb')]=function(_0x3bb167){logger['info'](util['format'](_0x2a0b('0x16a'),_0x3bb167[_0x2a0b('0xa1')]));if(_0x3bb167[_0x2a0b('0x111')]===0x0){return this[_0x2a0b('0x9f')](_0x3bb167);}_0x3bb167[_0x2a0b('0x111')]-=0x1;if(!this[_0x2a0b('0x9e')](_0x3bb167[_0x2a0b('0x112')])){return this['channel'][_0x2a0b('0x2c')](_0x3bb167,_0x2a0b('0x113'));}var _0x3c4964=this[_0x2a0b('0x1e')][_0x2a0b('0x6e')](this,_0x3bb167[_0x2a0b('0x112')]);if(!_0x3c4964){return this['channel'][_0x2a0b('0x2c')](_0x3bb167,_0x2a0b('0x114'));}var _0x8401e0=this[_0x2a0b('0xd')]['getData'](_0x3c4964,_0x3bb167[_0x2a0b('0x116')],_0x3bb167[_0x2a0b('0x16b')]);var _0x4d550e=_0x8401e0[_0x2a0b('0x9c')];if(_0x8401e0[_0x2a0b('0x9c')]===-0x1){this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x3bb167,'-1');return _0x8401e0;}else if(_0x8401e0[_0x2a0b('0x9a')]===_0x2a0b('0x65')){_0x8401e0[_0x2a0b('0x9c')]=_0x8401e0[_0x2a0b('0x9c')]['length']>0x0?_0x8401e0[_0x2a0b('0x9c')]:'t';}else if(_[_0x2a0b('0x45')](_0x8401e0[_0x2a0b('0x9c')])){_0x8401e0[_0x2a0b('0x9c')]='#';_0x4d550e='#';}if(!this[_0x2a0b('0x9e')](_0x3bb167[_0x2a0b('0xd7')])){this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xd8'));}else{var _0xf269ac=this[_0x2a0b('0xf')]['sync'](this,_0x3bb167['variable_id']);if(!_0xf269ac){return this['channel'][_0x2a0b('0x2c')](_0x3bb167,_0x2a0b('0x11a'));}this[_0x2a0b('0xd')][_0x2a0b('0x97')](_0xf269ac,_0x4d550e);}this[_0x2a0b('0x36')]['sync'](this,_0x3bb167,_0x4d550e);return _0x8401e0;};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0xa2')]=function(_0x2eb285){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x16c'),_0x2eb285[_0x2a0b('0xa1')]));return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2eb285[_0x2a0b('0x16d')]||_0x2eb285['label']);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x16e')]=function(_0x4d5314){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x16f'),_0x4d5314[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x4d5314[_0x2a0b('0x15d')])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x4d5314,'no\x20find\x20by\x20configured');}logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x15f'),this[_0x2a0b('0xd')]['callerid'],_0x4d5314[_0x2a0b('0x15d')]));var _0x5699a1=this[_0x2a0b('0x50')][_0x2a0b('0x6e')](this,_0x4d5314[_0x2a0b('0x170')]);var _0x49afde=this[_0x2a0b('0x51')][_0x2a0b('0x6e')](this,_0x4d5314[_0x2a0b('0x15d')],_0x5699a1);if(_0x49afde){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x4d5314[_0x2a0b('0x15d')]));this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format'](_0x2a0b('0x160'),this['channel'][_0x2a0b('0x39')],_0x4d5314['findBy']));return{'code':0xc8,'result':_0x2a0b('0x161')};}else{logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x4d5314[_0x2a0b('0x15d')]));this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x160'),this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x4d5314[_0x2a0b('0x15d')]));return{'code':0xc8,'result':_0x2a0b('0x163')};}};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x171')]=function(_0x153783){logger['info'](util[_0x2a0b('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x153783[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x153783['file_id'])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x153783,_0x2a0b('0x113'));}var _0x240b17=this['getSound'][_0x2a0b('0x6e')](this,_0x153783[_0x2a0b('0x112')]);if(!_0x240b17){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x153783,_0x2a0b('0x114'));}var _0x37c820=this[_0x2a0b('0xd')][_0x2a0b('0xa5')](_0x2a0b('0x172'),[_0x240b17,_0x153783[_0x2a0b('0xe5')]]);if(_0x37c820[_0x2a0b('0x9c')]===-0x1){return _0x37c820;}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util['format'](_0x2a0b('0xc0'),'PLAYBACK',_0x240b17));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x173')]=function(_0x71965b){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x174'),_0x71965b[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x71965b[_0x2a0b('0x175')])){return this['channel'][_0x2a0b('0x2c')](_0x71965b,_0x2a0b('0x176'));}var _0x546ee3='';var _0x3b109e=parseInt(_0x71965b[_0x2a0b('0x175')],0xa);if(isNaN(_0x3b109e)){_0x546ee3=_0x71965b[_0x2a0b('0x175')];}else{_0x546ee3=this[_0x2a0b('0x13')]['sync'](this,_0x71965b[_0x2a0b('0x175')]);if(!_0x546ee3){return this['channel'][_0x2a0b('0x2c')](_0x71965b,_0x2a0b('0x177'));}}var _0x535477='';if(this[_0x2a0b('0x9e')](_0x71965b[_0x2a0b('0x112')])){var _0x4bdbd2=this[_0x2a0b('0x1e')][_0x2a0b('0x6e')](this,_0x71965b[_0x2a0b('0x112')]);if(_0x4bdbd2){_0x535477=_0x4bdbd2;}}this['createSquareDetailsReport'][_0x2a0b('0x6e')](this,_0x71965b,_0x546ee3);if(_0x71965b[_0x2a0b('0xe5')][_0x2a0b('0x178')]('x')<0x0){_0x71965b[_0x2a0b('0xe5')]+='x';}if(_0x71965b[_0x2a0b('0xe5')][_0x2a0b('0x178')]('X')<0x0){_0x71965b['opts']+='X';}this[_0x2a0b('0xd')][_0x2a0b('0x97')](_0x2a0b('0x179'),_0x546ee3?_0x546ee3[_0x2a0b('0x17a')]():'');var _0x38884d=this['channel'][_0x2a0b('0xa5')](_0x2a0b('0x17b'),[_0x546ee3,_0x71965b['opts'],_0x71965b[_0x2a0b('0x63')],_0x535477,_0x71965b['timeout'],_0x71965b[_0x2a0b('0x6')],_0x71965b[_0x2a0b('0x17c')],_0x71965b[_0x2a0b('0x17d')],'',_0x71965b['position']]);if(_0x38884d[_0x2a0b('0x9c')]===-0x1){return _0x38884d;}return this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xc0'),'QUEUE',_0x546ee3));};AGIVertices['prototype'][_0x2a0b('0x17e')]=function(_0x24e934){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x17f'),_0x24e934[_0x2a0b('0xa1')]));var _0x54a063=_0x24e934['recordingFormat']||_0x2a0b('0x13f');var _0x48375a=util[_0x2a0b('0x28')]('%s_%s',this[_0x2a0b('0xd')][_0x2a0b('0x37')],rs[_0x2a0b('0x11c')](0x5));var _0x57bac3=util[_0x2a0b('0x28')](_0x2a0b('0x180'),FILES_PATH,_0x48375a,_0x54a063);var _0x3fa24e=util[_0x2a0b('0x28')](_0x2a0b('0x154'),FILES_PATH,_0x48375a);this[_0x2a0b('0x3a')]['sync'](this,_0x24e934,_0x48375a,_0x57bac3);this[_0x2a0b('0xd')]['setVariable'](_0x2a0b('0x181'),_0x48375a);logger[_0x2a0b('0x2d')](_0x2a0b('0x182'),_0x3fa24e,_0x54a063,_0x24e934['escape_digits'],_0x24e934[_0x2a0b('0x65')]);return this[_0x2a0b('0xd')][_0x2a0b('0x137')](_0x3fa24e,_0x54a063,_0x24e934[_0x2a0b('0x183')],_0x24e934['timeout'],undefined,!![]);};AGIVertices[_0x2a0b('0x18')]['restapi']=function(_0x1044fd){logger['info'](util['format'](_0x2a0b('0x184'),_0x1044fd[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x1044fd[_0x2a0b('0x63')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0x185'));}var _0x3514e6=this['restAPI'][_0x2a0b('0x6e')](this,_0x1044fd);logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x186'),util[_0x2a0b('0x187')](_0x3514e6,{'showHidden':![],'depth':null})));if(!this[_0x2a0b('0x9e')](_0x1044fd[_0x2a0b('0xd7')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0x188'));}var _0x18cd35=this['getVariable'][_0x2a0b('0x6e')](this,_0x1044fd['variable_id']);if(!_0x18cd35){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x1044fd,'no\x20variable\x20found');}this[_0x2a0b('0xd')]['setVariable'](util[_0x2a0b('0x28')](_0x2a0b('0x189'),_0x18cd35),_0x3514e6[_0x2a0b('0x72')]?_0x3514e6[_0x2a0b('0x72')]:_0x2a0b('0x18a'));this[_0x2a0b('0xd')][_0x2a0b('0x97')](util[_0x2a0b('0x28')](_0x2a0b('0x18b'),_0x18cd35),_0x3514e6[_0x2a0b('0x18c')]?_0x3514e6[_0x2a0b('0x18c')]:'OK');if(_0x3514e6[_0x2a0b('0x69')]){try{this['saveRestApiResult'](_0x3514e6[_0x2a0b('0x69')],_0x18cd35);}catch(_0x224d0b){logger[_0x2a0b('0x2c')](util[_0x2a0b('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x18cd35));}}return this[_0x2a0b('0xd')]['noop'](util[_0x2a0b('0x28')](_0x2a0b('0xdd'),_0x18cd35));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x18d')]=function(_0x4b7555){logger['info'](util['format'](_0x2a0b('0x18e'),_0x4b7555[_0x2a0b('0xa1')]));return this[_0x2a0b('0xd')][_0x2a0b('0x18f')](_0x4b7555['digits'][_0x2a0b('0x59')](/\s+/g,''),_0x4b7555[_0x2a0b('0x183')]);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x190')]=function(_0x4af94a){logger['info'](util['format'](_0x2a0b('0x191'),_0x4af94a[_0x2a0b('0xa1')]));return this[_0x2a0b('0xd')][_0x2a0b('0x192')](_0x4af94a['number'][_0x2a0b('0x59')](/\s+/g,''),_0x4af94a[_0x2a0b('0x183')]);};AGIVertices['prototype'][_0x2a0b('0x193')]=function(_0x560fc8){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x194'),_0x560fc8[_0x2a0b('0xa1')]));return this[_0x2a0b('0xd')][_0x2a0b('0x195')](_0x560fc8[_0x2a0b('0x5d')],_0x560fc8['escape_digits']);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x196')]=function(_0x1be6ee){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x197'),_0x1be6ee[_0x2a0b('0xa1')]));if(!this['isConfigured'](_0x1be6ee[_0x2a0b('0x198')])){return this['channel'][_0x2a0b('0xa2')](_0x2a0b('0x199'));}var _0x4ed956=this[_0x2a0b('0x20')][_0x2a0b('0x6e')](this,_0x1be6ee[_0x2a0b('0x198')]);if(!_0x4ed956||!_0x4ed956[_0x2a0b('0x19a')]){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x1be6ee,_0x2a0b('0x19b'));}var _0x3d7c28={'from':util[_0x2a0b('0x28')]('\x22%s\x22\x20<%s>',_0x4ed956['name'],_0x4ed956[_0x2a0b('0x19c')]||_0x4ed956[_0x2a0b('0x19a')]['user']),'to':_0x1be6ee['to']||'','cc':_0x1be6ee['cc']||'','bcc':_0x1be6ee[_0x2a0b('0x19d')]||'','subject':_0x1be6ee[_0x2a0b('0x19e')],'html':_0x1be6ee[_0x2a0b('0x5d')],'text':_0x1be6ee[_0x2a0b('0x5d')]};var _0x364d03={'tls':{'rejectUnauthorized':![]}};if(_0x4ed956[_0x2a0b('0x19a')][_0x2a0b('0x19f')]){_0x364d03['service']=_0x4ed956[_0x2a0b('0x19a')][_0x2a0b('0x19f')];}else{_0x364d03[_0x2a0b('0x1a0')]=_0x4ed956[_0x2a0b('0x19a')][_0x2a0b('0x1a0')];_0x364d03[_0x2a0b('0x1a1')]=_0x4ed956[_0x2a0b('0x19a')]['port'];_0x364d03['secure']=_0x4ed956[_0x2a0b('0x19a')][_0x2a0b('0x1a2')];}if(_0x4ed956[_0x2a0b('0x19a')][_0x2a0b('0x1a3')]){_0x364d03[_0x2a0b('0x1a4')]={'user':_0x4ed956[_0x2a0b('0x19a')][_0x2a0b('0x1a5')],'pass':_0x4ed956[_0x2a0b('0x19a')][_0x2a0b('0x1a6')]};}if(this['isConfigured'](_0x1be6ee['template_id'])){}logger[_0x2a0b('0xdf')]('sendMail\x20message',JSON['stringify'](_0x3d7c28));this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x1be6ee,_0x1be6ee[_0x2a0b('0x198')]);this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4ed956[_0x2a0b('0x12')]));this[_0x2a0b('0x22')][_0x2a0b('0x6e')](this,_0x364d03,_0x3d7c28);return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x1a7'));};AGIVertices['prototype'][_0x2a0b('0x1a8')]=function(_0x19b2eb){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x1a9'),_0x19b2eb['label']));return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x1aa'));};AGIVertices['prototype'][_0x2a0b('0x1ab')]=function(_0x74306a){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x1ac'),_0x74306a[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x74306a[_0x2a0b('0x1ad')])){return this[_0x2a0b('0xd')]['noop']('no\x20sms\x20account\x20configured');}var _0xb6a769=this[_0x2a0b('0x33')][_0x2a0b('0x6e')](this,_0x74306a[_0x2a0b('0x1ad')]);if(!_0xb6a769){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x74306a,_0x2a0b('0x1ae'));}var _0x91be1b={'body':_0x74306a[_0x2a0b('0x1af')],'phone':_0x74306a['to']||'','SmsAccountId':_0xb6a769['id']};logger[_0x2a0b('0xdf')](_0x2a0b('0x1b0'),JSON['stringify'](_0x91be1b));this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x74306a,_0x74306a[_0x2a0b('0x1ad')]);this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x1b1'),_0xb6a769[_0x2a0b('0x12')]));this['createSmsMessage'][_0x2a0b('0x6e')](this,_0x91be1b);return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x1b2'));};AGIVertices['prototype'][_0x2a0b('0x1b3')]=function(_0x26126d){logger[_0x2a0b('0x2d')](util['format'](_0x2a0b('0x1b4'),_0x26126d[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x26126d[_0x2a0b('0xd7')])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x26126d,'no\x20variable\x20selected');}var _0x148777=this[_0x2a0b('0xf')][_0x2a0b('0x6e')](this,_0x26126d[_0x2a0b('0xd7')]);if(!_0x148777){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x26126d,'no\x20variable\x20found');}return this[_0x2a0b('0xd')][_0x2a0b('0x97')](_0x148777,_0x26126d[_0x2a0b('0x1b5')]);};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x1b6')]=function(_0x2e1069){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x1b7'),_0x2e1069[_0x2a0b('0xa1')]));this['channel'][_0x2a0b('0xa2')](_0x2a0b('0x1b8'));if(_0x2e1069[_0x2a0b('0xb4')]===_0x2a0b('0x1b9')){this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x1ba'));return this[_0x2a0b('0xd')][_0x2a0b('0xb4')]();}return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x1bb'));};AGIVertices[_0x2a0b('0x18')]['subproject']=function(_0x223616){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x223616['label']));if(!this['isConfigured'](_0x223616['project_id'])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x223616,_0x2a0b('0x1bc'));}var _0x576fbb=this[_0x2a0b('0x15')]['sync'](this,_0x223616[_0x2a0b('0x1bd')]);if(!this['isConfigured'](_0x576fbb)){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x223616,util[_0x2a0b('0x28')](_0x2a0b('0x1be'),_0x223616[_0x2a0b('0x1bd')]));}if(_0x576fbb===this[_0x2a0b('0xd')][_0x2a0b('0x41')]){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x223616,_0x2a0b('0x1bf'));}this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x223616,_0x576fbb);var _0x53cd54=this[_0x2a0b('0xd')]['exec'](_0x2a0b('0x1c0'),util[_0x2a0b('0x28')](_0x2a0b('0x1c1'),config[_0x2a0b('0x6')][_0x2a0b('0x1a0')]||_0x2a0b('0x1c2'),_0x576fbb,this['channel'][_0x2a0b('0x41')]));if(_0x53cd54[_0x2a0b('0x9c')]===-0x1){return _0x53cd54;}return this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0xc0'),_0x2a0b('0x1c0'),_0x576fbb));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x1c3')]=function(_0x53ef54){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x1c4'),_0x53ef54['label']));var _0x4851d9=this['shellCommand'][_0x2a0b('0x6e')](this,_0x53ef54['command']);this[_0x2a0b('0x36')][_0x2a0b('0x6e')](this,_0x53ef54,_0x53ef54[_0x2a0b('0xb2')]);if(this['isConfigured'](_0x53ef54[_0x2a0b('0xd7')])){var _0x3d753a=this[_0x2a0b('0xf')][_0x2a0b('0x6e')](this,_0x53ef54[_0x2a0b('0xd7')]);if(_0x3d753a){this['channel']['setVariable'](_0x3d753a,_0x4851d9);return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x1c5'),_0x53ef54[_0x2a0b('0xb2')],_0x3d753a));}}return this['channel'][_0x2a0b('0xa2')](util['format'](_0x2a0b('0x1c6'),_0x53ef54['command']));};AGIVertices['prototype'][_0x2a0b('0x1c7')]=function(_0x34d063){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x1c8'),_0x34d063[_0x2a0b('0xa1')]));_0x34d063[_0x2a0b('0x5d')]=_0x34d063[_0x2a0b('0x5d')][_0x2a0b('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x34d063[_0x2a0b('0x5b')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0x1c9'));}if(!this[_0x2a0b('0x9e')](_0x34d063[_0x2a0b('0x5d')])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xa3'));}this['channel'][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x34d063['text']));var _0x19e720=this['googleCloudTTS'][_0x2a0b('0x6e')](this,_0x34d063);if(_0x19e720){this[_0x2a0b('0xd')]['noop'](util[_0x2a0b('0x28')](_0x2a0b('0x1ca'),_0x19e720));var _0x578254=this[_0x2a0b('0xd')][_0x2a0b('0x104')](_0x19e720);try{fs['unlink'](_0x19e720+_0x2a0b('0x129'));}catch(_0x5b30fc){logger['error'](_0x5b30fc);}return _0x578254;}return this[_0x2a0b('0xd')]['error'](_0x34d063,_0x2a0b('0x1cb'));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x1cc')]=function(_0x4e2f0d){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x1cd'),_0x4e2f0d[_0x2a0b('0xa1')]));_0x4e2f0d['text']=_0x4e2f0d[_0x2a0b('0x5d')][_0x2a0b('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2a0b('0x9e')](_0x4e2f0d['text'])){return this[_0x2a0b('0xd')][_0x2a0b('0xa2')](_0x2a0b('0xa3'));}this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x4e2f0d[_0x2a0b('0x5d')]));var _0x188c8f=this[_0x2a0b('0x62')][_0x2a0b('0x6e')](this,_0x4e2f0d);if(_0x188c8f){this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x188c8f));var _0x105dc8=this['channel'][_0x2a0b('0x104')](_0x188c8f);try{fs[_0x2a0b('0x105')](_0x188c8f+_0x2a0b('0x129'));}catch(_0x32835b){logger[_0x2a0b('0x2c')](_0x32835b);}return _0x105dc8;}return this['channel'][_0x2a0b('0x2c')](_0x4e2f0d,_0x2a0b('0x1ce'));};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x1cf')]=function(_0x41d5c6){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x1d0'),_0x41d5c6[_0x2a0b('0xa1')]));if(!this[_0x2a0b('0x9e')](_0x41d5c6['findBy'])){return this[_0x2a0b('0xd')][_0x2a0b('0x2c')](_0x41d5c6,_0x2a0b('0x15e'));}logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2a0b('0xd')]['callerid'],_0x41d5c6['findBy']));var _0x150677=this[_0x2a0b('0x53')][_0x2a0b('0x6e')](this,_0x41d5c6[_0x2a0b('0x15d')]);if(_0x150677){logger['info'](util[_0x2a0b('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x2a0b('0x39')],_0x41d5c6['findBy']));this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x2a0b('0x39')],_0x41d5c6[_0x2a0b('0x15d')]));return{'code':0xc8,'result':_0x2a0b('0x161')};}else{logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x41d5c6['findBy']));this[_0x2a0b('0xd')][_0x2a0b('0xa2')](util[_0x2a0b('0x28')](_0x2a0b('0x162'),this[_0x2a0b('0xd')][_0x2a0b('0x39')],_0x41d5c6[_0x2a0b('0x15d')]));return{'code':0xc8,'result':_0x2a0b('0x163')};}};AGIVertices[_0x2a0b('0x18')][_0x2a0b('0x1d1')]=function(_0x3e3006){logger[_0x2a0b('0x2d')](util[_0x2a0b('0x28')](_0x2a0b('0x1d2'),_0x3e3006[_0x2a0b('0xa1')]));var _0x584f95=this[_0x2a0b('0xd')][_0x2a0b('0xa5')]('VOICEMAIL',[_0x3e3006[_0x2a0b('0x1d3')],_0x3e3006[_0x2a0b('0xa4')]]);if(_0x584f95[_0x2a0b('0x9c')]===-0x1){return _0x584f95;}return this[_0x2a0b('0xd')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x2a0b('0x1d4'),_0x3e3006[_0x2a0b('0x1d3')]));};AGIVertices['prototype'][_0x2a0b('0x1d5')]=function(_0x59c46d){logger['info'](util[_0x2a0b('0x28')](_0x2a0b('0x1d6'),_0x59c46d['label']));if(!this[_0x2a0b('0x9e')](_0x59c46d[_0x2a0b('0xd7')])){return this[_0x2a0b('0xd')]['error'](_0x59c46d,'no\x20variable\x20selected');}var _0x1ae2ea=this['getVariable']['sync'](this,_0x59c46d[_0x2a0b('0xd7')]);if(!_0x1ae2ea){return this['channel'][_0x2a0b('0x2c')](_0x59c46d,_0x2a0b('0x11a'));}var _0x173ab9=this[_0x2a0b('0xd')][_0x2a0b('0xf')](_0x1ae2ea);return{'code':0xc8,'result':_0x173ab9[_0x2a0b('0x9a')]?_0x173ab9['extra']:'-'};};String[_0x2a0b('0x18')][_0x2a0b('0x99')]=function(_0x7a6f2d,_0x5b3039){return this[_0x2a0b('0x98')](_0x7a6f2d)[_0x2a0b('0x1d7')](_0x5b3039);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c5178f2..fe441b9 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 _0x944a=['prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','stringify','[ACW][STOP]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','transfererlinkedid','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','channels','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','info','attended','destlinkedid','savePause','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message'];(function(_0xbf491b,_0x243d25){var _0x2ff60b=function(_0x387a67){while(--_0x387a67){_0xbf491b['push'](_0xbf491b['shift']());}};_0x2ff60b(++_0x243d25);}(_0x944a,0xb5));var _0xa944=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x944a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xa944('0x0'));var moment=require(_0xa944('0x1'));var ami=require(_0xa944('0x2'));var logger=require(_0xa944('0x3'))(_0xa944('0x4'));var RpcUser=require(_0xa944('0x5'));var RpcVoiceAgentReport=require(_0xa944('0x6'));function Acw(_0x30e400){this[_0xa944('0x7')]=_0x30e400[_0xa944('0x7')];this[_0xa944('0x8')]=_0x30e400[_0xa944('0x8')];this[_0xa944('0x9')]=_0x30e400[_0xa944('0x9')];this['channels']={};ami['on'](_0xa944('0xa'),this[_0xa944('0xb')][_0xa944('0xc')](this));ami['on'](_0xa944('0xd'),this['syncHangupRequest']['bind'](this));ami['on'](_0xa944('0xe'),this[_0xa944('0xf')][_0xa944('0xc')](this));ami['on'](_0xa944('0x10'),this['syncAgentRingNoAnswer'][_0xa944('0xc')](this));ami['on'](_0xa944('0x11'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xa944('0x12'),this['syncBlindTransfer'][_0xa944('0xc')](this));ami['on'](_0xa944('0x13'),this[_0xa944('0x14')][_0xa944('0xc')](this));}function getDiff(_0x5c437f){var _0x5a5f95=moment()[_0xa944('0x15')](0x0);var _0x467d46=moment(_0x5c437f)[_0xa944('0x15')](0x0);return _0x5a5f95[_0xa944('0x16')](_0x467d46,_0xa944('0x17'));}Acw['prototype'][_0xa944('0x18')]=function(_0x33369f){try{var _0x4478c1=this;var _0x5af772=this[_0xa944('0x19')][_0x33369f][_0xa944('0x1a')];var _0x846bef=this[_0xa944('0x19')][_0x33369f]['queue'];var _0x5c8d8d=this[_0xa944('0x7')][_0x846bef];var _0x251fde=![];var _0x2199dd=_0xa944('0x1b');if(_0x5c8d8d[_0xa944('0x1c')]){if(_0x5c8d8d[_0xa944('0x1d')][_0xa944('0x1e')]){_0x251fde=!![];_0x2199dd=_0x5c8d8d[_0xa944('0x1d')][_0xa944('0x1e')];}}ami['Action']({'action':_0xa944('0x1f'),'interface':_0x5af772,'paused':!![],'reason':_0x2199dd})[_0xa944('0x20')](function(_0xfd9059){if(_0x4478c1[_0xa944('0x8')][_0x5af772]){return RpcUser[_0xa944('0x21')](_0x4478c1['agents'][_0x5af772]['id'])[_0xa944('0x20')](function(_0x2bc167){if(_0x2bc167&&!_0x2bc167['voicePause']){logger[_0xa944('0x22')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x33369f,_0x5af772,_0x846bef);var _0xd75a97=_0x4478c1[_0xa944('0x19')][_0x33369f][_0xa944('0x23')]&&_0x4478c1[_0xa944('0x19')][_0x33369f][_0xa944('0x24')]?_0x4478c1['channels'][_0x33369f][_0xa944('0x24')]:_0x33369f;return RpcUser[_0xa944('0x25')](_0x4478c1[_0xa944('0x8')][_0x5af772],_0x2199dd,_0xd75a97)[_0xa944('0x20')](function(_0x2d2fab){if(!_0x251fde){_0x4478c1[_0xa944('0x9')][_0x5af772]={};logger[_0xa944('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x33369f,_0x4478c1[_0xa944('0x7')][_0x846bef][_0xa944('0x26')],_0x5af772,_0x846bef);_0x4478c1['timers'][_0x5af772][_0xa944('0x27')]=setTimeout(_0x4478c1['stopAcw'][_0xa944('0xc')](_0x4478c1,_0x5af772),_0x4478c1[_0xa944('0x7')][_0x846bef][_0xa944('0x26')]*0x3e8);_0x4478c1[_0xa944('0x9')][_0x5af772][_0xa944('0x28')]=moment()[_0xa944('0x29')](_0xa944('0x2a'));_0x4478c1[_0xa944('0x9')][_0x5af772]['uniqueid']=_0x33369f;_0x4478c1['timers'][_0x5af772][_0xa944('0x2b')]=_0x846bef;_0x4478c1[_0xa944('0x9')][_0x5af772]['updateAcw']=function(){var _0x3189bb=getDiff(_0x4478c1[_0xa944('0x9')][_0x5af772][_0xa944('0x28')]);clearTimeout(_0x4478c1['timers'][_0x5af772][_0xa944('0x27')]);_0x4478c1[_0xa944('0x9')][_0x5af772][_0xa944('0x27')]=![];RpcVoiceAgentReport[_0xa944('0x2c')]({'acwtime':_0x3189bb},_0x4478c1[_0xa944('0x9')][_0x5af772][_0xa944('0x2d')],_0x5af772)[_0xa944('0x20')](function(_0x2701ff){logger[_0xa944('0x22')](_0xa944('0x2e'),_0x33369f,_0x3189bb,_0x2701ff);})[_0xa944('0x2f')](function(_0xbce7cf){logger[_0xa944('0x30')](_0xa944('0x31'),_0x33369f,_0xbce7cf);});delete _0x4478c1[_0xa944('0x9')][_0x5af772];};}});}else{logger[_0xa944('0x22')](_0xa944('0x32'),_0x33369f,_0x5af772,_0x846bef);}});}})['catch'](function(_0x5c8d43){logger[_0xa944('0x30')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x33369f,_0x4478c1['voiceQueues'][_0x846bef][_0xa944('0x26')],_0x5af772,_0x846bef);})[_0xa944('0x33')](function(){delete _0x4478c1[_0xa944('0x19')][_0x33369f];});}catch(_0xd028ab){logger[_0xa944('0x30')]('[ACW][START]\x20%s',_0xd028ab[_0xa944('0x34')]);}};Acw[_0xa944('0x35')]['stopAcw']=function(_0x5916c2){try{var _0x3f8967=this;if(_0x3f8967[_0xa944('0x9')][_0x5916c2]){_0x3f8967[_0xa944('0x9')][_0x5916c2][_0xa944('0x27')]=![];var _0x412308=_0x3f8967[_0xa944('0x9')][_0x5916c2]['uniqueid'];var _0x1a4065=_0x3f8967['timers'][_0x5916c2][_0xa944('0x2b')];var _0xb2ffd1=_0x3f8967[_0xa944('0x7')][_0x1a4065][_0xa944('0x26')];logger['info'](_0xa944('0x36'),_0x412308,_0x5916c2);RpcUser[_0xa944('0x37')](this[_0xa944('0x8')][_0x5916c2]);RpcVoiceAgentReport[_0xa944('0x2c')]({'acwtime':_0xb2ffd1,'agentacw':!![]},_0x412308,_0x5916c2)[_0xa944('0x20')](function(_0x13983d){logger[_0xa944('0x22')](_0xa944('0x2e'),_0x412308,_0xb2ffd1,_0x13983d);})[_0xa944('0x2f')](function(_0x6dab65){logger[_0xa944('0x30')](_0xa944('0x31'),_0x412308,_0x6dab65);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5916c2);if(_0x3f8967[_0xa944('0x9')]){logger[_0xa944('0x22')]('[ACW][TIMERS]',JSON[_0xa944('0x38')](_0x3f8967[_0xa944('0x9')]));}}}catch(_0x379f1e){logger['error'](_0xa944('0x39'),_0x379f1e[_0xa944('0x34')]);}};Acw['prototype']['syncAgentConnect']=function(_0x51d694){try{if(this[_0xa944('0x7')][_0x51d694[_0xa944('0x2b')]]&&(this[_0xa944('0x7')][_0x51d694['queue']]['acw']||this[_0xa944('0x7')][_0x51d694[_0xa944('0x2b')]][_0xa944('0x1c')])){if(this['agents'][_0x51d694[_0xa944('0x1a')]]){this[_0xa944('0x19')][_0x51d694[_0xa944('0x2d')]]={'queue':_0x51d694[_0xa944('0x2b')],'interface':_0x51d694[_0xa944('0x1a')],'destlinkedid':_0x51d694['destlinkedid']};}}}catch(_0x407ee6){logger[_0xa944('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x407ee6[_0xa944('0x34')]);}};Acw[_0xa944('0x35')][_0xa944('0x14')]=function(_0x2e1cba){try{if(this[_0xa944('0x7')][_0x2e1cba[_0xa944('0x2b')]]&&(this[_0xa944('0x7')][_0x2e1cba['queue']][_0xa944('0x4')]||this[_0xa944('0x7')][_0x2e1cba[_0xa944('0x2b')]]['mandatoryDisposition'])){if(this[_0xa944('0x8')][_0x2e1cba[_0xa944('0x1a')]]){this['channels'][_0x2e1cba[_0xa944('0x2d')]]={'queue':_0x2e1cba[_0xa944('0x2b')],'interface':_0x2e1cba[_0xa944('0x1a')]};}}}catch(_0x3fbf1f){logger[_0xa944('0x30')]('[ACW][syncAgentConnectPreview]\x20%s',_0x3fbf1f[_0xa944('0x34')]);}};Acw['prototype']['syncHangupRequest']=function(_0x377743){try{if(this[_0xa944('0x19')][_0x377743['uniqueid']]&&_[_0xa944('0x3a')](this['channels'][_0x377743['uniqueid']][_0xa944('0x23')])){logger[_0xa944('0x22')](_0xa944('0x3b'),_0x377743[_0xa944('0x2d')]);this[_0xa944('0x18')](_0x377743[_0xa944('0x2d')]);}else if(this['channels'][_0x377743[_0xa944('0x3c')]]&&_[_0xa944('0x3a')](this[_0xa944('0x19')][_0x377743[_0xa944('0x3c')]][_0xa944('0x23')])){logger[_0xa944('0x22')]('[%s][HANGUP:LINKEDID]',_0x377743[_0xa944('0x3c')]);this['startAcw'](_0x377743['linkedid']);}}catch(_0x341244){logger[_0xa944('0x30')](_0xa944('0x3d'),_0x341244[_0xa944('0x34')]);}};Acw[_0xa944('0x35')][_0xa944('0xf')]=function(_0x35bba9){try{if(this[_0xa944('0x19')][_0x35bba9[_0xa944('0x2d')]]&&this[_0xa944('0x19')][_0x35bba9['uniqueid']][_0xa944('0x23')]){logger[_0xa944('0x22')](_0xa944('0x3e'),_0x35bba9['uniqueid']);this[_0xa944('0x18')](_0x35bba9[_0xa944('0x2d')]);}else if(this['channels'][_0x35bba9[_0xa944('0x3c')]]&&this['channels'][_0x35bba9['linkedid']][_0xa944('0x23')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x35bba9['linkedid']);this[_0xa944('0x18')](_0x35bba9[_0xa944('0x3c')]);}}catch(_0x1d59c3){logger[_0xa944('0x30')](_0xa944('0x3f'),_0x1d59c3[_0xa944('0x34')]);}};Acw[_0xa944('0x35')]['syncAttendedTransfer']=function(_0x58282a){try{if(!_[_0xa944('0x40')](this[_0xa944('0x19')][_0x58282a['transfereeuniqueid']])){this[_0xa944('0x18')](_0x58282a[_0xa944('0x41')]);if(this[_0xa944('0x19')][_0x58282a[_0xa944('0x42')]]){this[_0xa944('0x19')][_0x58282a[_0xa944('0x42')]][_0xa944('0x23')]=!![];this['channels'][_0x58282a['transfertargetuniqueid']]=this[_0xa944('0x19')][_0x58282a[_0xa944('0x42')]];delete this[_0xa944('0x19')][_0x58282a[_0xa944('0x42')]];}}else if(!_[_0xa944('0x40')](this[_0xa944('0x19')][_0x58282a['transfertargetuniqueid']])){this[_0xa944('0x18')](_0x58282a[_0xa944('0x43')]);if(this['channels'][_0x58282a[_0xa944('0x44')]]){this[_0xa944('0x19')][_0x58282a[_0xa944('0x44')]][_0xa944('0x23')]=!![];this['channels'][_0x58282a['transfereeuniqueid']]=this[_0xa944('0x19')][_0x58282a[_0xa944('0x44')]];delete this[_0xa944('0x19')][_0x58282a['origtransfereruniqueid']];}}}catch(_0x15853c){logger[_0xa944('0x30')]('[ACW][syncAttendedTransfer]\x20%s',_0x15853c[_0xa944('0x34')]);}};Acw[_0xa944('0x35')][_0xa944('0x45')]=function(_0x55fb27){try{if(this['channels'][_0x55fb27['transfereruniqueid']]){logger[_0xa944('0x22')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x55fb27[_0xa944('0x46')]));this['startAcw'](_0x55fb27[_0xa944('0x46')]);}else if(this[_0xa944('0x19')][_0x55fb27[_0xa944('0x47')]]){logger[_0xa944('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x55fb27['transfererlinkedid']));this[_0xa944('0x18')](_0x55fb27['transfererlinkedid']);}}catch(_0x1f16e6){logger[_0xa944('0x30')]('[ACW][syncBlindTransfer]\x20%s',_0x1f16e6[_0xa944('0x34')]);}};Acw[_0xa944('0x35')][_0xa944('0x48')]=function(_0x4b2ead){try{if(this['voiceQueues'][_0x4b2ead[_0xa944('0x2b')]]&&this[_0xa944('0x7')][_0x4b2ead[_0xa944('0x2b')]][_0xa944('0x49')]===_0xa944('0x4a')){if(this[_0xa944('0x8')][_0x4b2ead[_0xa944('0x1a')]]){logger[_0xa944('0x22')](_0xa944('0x4b'),_0x4b2ead[_0xa944('0x2d')],_0x4b2ead[_0xa944('0x1a')],_0x4b2ead[_0xa944('0x2b')]);return RpcUser['savePause'](this['agents'][_0x4b2ead[_0xa944('0x1a')]],_0xa944('0x4c'),_0x4b2ead[_0xa944('0x2d')]);}}}catch(_0x1c080b){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1c080b[_0xa944('0x34')]);}};module[_0xa944('0x4d')]=Acw; \ No newline at end of file +var _0x0bd6=['catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','acwTimeout','stopAcw','lastPauseAt','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]'];(function(_0x517489,_0x44b005){var _0x18e1d8=function(_0x58bf52){while(--_0x58bf52){_0x517489['push'](_0x517489['shift']());}};_0x18e1d8(++_0x44b005);}(_0x0bd6,0x72));var _0x60bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bd6[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x60bd('0x0'));var _=require('lodash');var moment=require('moment');var ami=require(_0x60bd('0x1'));var logger=require('../../../config/logger')(_0x60bd('0x2'));var RpcUser=require(_0x60bd('0x3'));var RpcVoiceAgentReport=require(_0x60bd('0x4'));function Acw(_0x19c30f){this[_0x60bd('0x5')]=_0x19c30f[_0x60bd('0x5')];this[_0x60bd('0x6')]=_0x19c30f[_0x60bd('0x6')];this['timers']=_0x19c30f[_0x60bd('0x7')];this['channels']={};ami['on']('agentconnect',this[_0x60bd('0x8')][_0x60bd('0x9')](this));ami['on']('hanguprequest',this[_0x60bd('0xa')][_0x60bd('0x9')](this));ami['on'](_0x60bd('0xb'),this[_0x60bd('0xc')]['bind'](this));ami['on'](_0x60bd('0xd'),this[_0x60bd('0xe')][_0x60bd('0x9')](this));ami['on'](_0x60bd('0xf'),this[_0x60bd('0x10')]['bind'](this));ami['on'](_0x60bd('0x11'),this[_0x60bd('0x12')]['bind'](this));ami['on'](_0x60bd('0x13'),this[_0x60bd('0x14')][_0x60bd('0x9')](this));}function getDiff(_0x24cc36){var _0x203d54=moment()[_0x60bd('0x15')](0x0);var _0x4a171f=moment(_0x24cc36)['milliseconds'](0x0);return _0x203d54['diff'](_0x4a171f,_0x60bd('0x16'));}Acw[_0x60bd('0x17')][_0x60bd('0x18')]=function(_0x4ee4b4){try{var _0x37c1a7=this;var _0x54676a=this[_0x60bd('0x19')][_0x4ee4b4][_0x60bd('0x1a')];var _0x3e9710=this['channels'][_0x4ee4b4][_0x60bd('0x1b')];var _0x157512=this[_0x60bd('0x5')][_0x3e9710];var _0x24402e=![];var _0x550408=_0x60bd('0x1c');if(_0x157512[_0x60bd('0x1d')]){if(_0x157512[_0x60bd('0x1e')]['name']){_0x24402e=!![];_0x550408=_0x157512[_0x60bd('0x1e')][_0x60bd('0x1f')];}}ami[_0x60bd('0x20')]({'action':_0x60bd('0x21'),'interface':_0x54676a,'paused':!![],'reason':_0x550408})['then'](function(_0x3599ca){if(_0x37c1a7[_0x60bd('0x6')][_0x54676a]){return RpcUser[_0x60bd('0x22')](_0x37c1a7[_0x60bd('0x6')][_0x54676a]['id'])[_0x60bd('0x23')](function(_0x36d4e9){if(_0x36d4e9&&!_0x36d4e9[_0x60bd('0x24')]){logger[_0x60bd('0x25')](_0x60bd('0x26'),_0x4ee4b4,_0x54676a,_0x3e9710);var _0x1f0563=_0x37c1a7[_0x60bd('0x19')][_0x4ee4b4][_0x60bd('0x27')]&&_0x37c1a7['channels'][_0x4ee4b4]['destlinkedid']?_0x37c1a7[_0x60bd('0x19')][_0x4ee4b4]['destlinkedid']:_0x4ee4b4;return RpcUser['savePause'](_0x37c1a7[_0x60bd('0x6')][_0x54676a],_0x550408,_0x1f0563)[_0x60bd('0x23')](function(_0x54af8f){if(!_0x24402e){_0x37c1a7['timers'][_0x54676a]={};logger[_0x60bd('0x25')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4ee4b4,_0x37c1a7['voiceQueues'][_0x3e9710][_0x60bd('0x28')],_0x54676a,_0x3e9710);_0x37c1a7[_0x60bd('0x7')][_0x54676a]['timer']=setTimeout(_0x37c1a7[_0x60bd('0x29')][_0x60bd('0x9')](_0x37c1a7,_0x54676a),_0x37c1a7[_0x60bd('0x5')][_0x3e9710][_0x60bd('0x28')]*0x3e8);_0x37c1a7[_0x60bd('0x7')][_0x54676a][_0x60bd('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37c1a7[_0x60bd('0x7')][_0x54676a][_0x60bd('0x2b')]=_0x4ee4b4;_0x37c1a7[_0x60bd('0x7')][_0x54676a][_0x60bd('0x1b')]=_0x3e9710;_0x37c1a7['timers'][_0x54676a][_0x60bd('0x2c')]=function(){var _0x4d71af=getDiff(_0x37c1a7['timers'][_0x54676a][_0x60bd('0x2a')]);clearTimeout(_0x37c1a7['timers'][_0x54676a][_0x60bd('0x2d')]);_0x37c1a7[_0x60bd('0x7')][_0x54676a][_0x60bd('0x2d')]=![];RpcVoiceAgentReport[_0x60bd('0x2e')]({'acwtime':_0x4d71af},_0x37c1a7[_0x60bd('0x7')][_0x54676a][_0x60bd('0x2b')],_0x54676a)[_0x60bd('0x23')](function(_0x1b124e){logger['info'](_0x60bd('0x2f'),_0x4ee4b4,_0x4d71af,_0x1b124e);})[_0x60bd('0x30')](function(_0x4c8b32){logger[_0x60bd('0x31')](_0x60bd('0x32'),_0x4ee4b4,_0x4c8b32);});delete _0x37c1a7['timers'][_0x54676a];};}});}else{logger[_0x60bd('0x25')](_0x60bd('0x33'),_0x4ee4b4,_0x54676a,_0x3e9710);}});}})['catch'](function(_0x2692f8){logger['error'](_0x60bd('0x34'),_0x4ee4b4,_0x37c1a7[_0x60bd('0x5')][_0x3e9710][_0x60bd('0x28')],_0x54676a,_0x3e9710);})[_0x60bd('0x35')](function(){delete _0x37c1a7[_0x60bd('0x19')][_0x4ee4b4];});}catch(_0x21a023){logger['error'](_0x60bd('0x36'),_0x21a023[_0x60bd('0x37')]);}};Acw[_0x60bd('0x17')]['stopAcw']=function(_0x3d0173){try{var _0x1cde1f=this;if(_0x1cde1f['timers'][_0x3d0173]){_0x1cde1f['timers'][_0x3d0173][_0x60bd('0x2d')]=![];var _0x4d554a=_0x1cde1f['timers'][_0x3d0173]['uniqueid'];var _0x2ce5c7=_0x1cde1f[_0x60bd('0x7')][_0x3d0173][_0x60bd('0x1b')];var _0x22a70b=_0x1cde1f[_0x60bd('0x5')][_0x2ce5c7]['acwTimeout'];logger[_0x60bd('0x25')]('[%s][TIMER][STOP][AGENT:%s]',_0x4d554a,_0x3d0173);RpcUser[_0x60bd('0x38')](this[_0x60bd('0x6')][_0x3d0173]);RpcVoiceAgentReport[_0x60bd('0x2e')]({'acwtime':_0x22a70b,'agentacw':!![]},_0x4d554a,_0x3d0173)[_0x60bd('0x23')](function(_0x18f181){logger[_0x60bd('0x25')](_0x60bd('0x2f'),_0x4d554a,_0x22a70b,_0x18f181);})[_0x60bd('0x30')](function(_0xa3dffb){logger[_0x60bd('0x31')](_0x60bd('0x32'),_0x4d554a,_0xa3dffb);});}else{logger['error'](_0x60bd('0x39'),_0x3d0173);if(_0x1cde1f['timers']){logger[_0x60bd('0x25')](_0x60bd('0x3a'),JSON['stringify'](_0x1cde1f[_0x60bd('0x7')]));}}}catch(_0x3db88f){logger['error'](_0x60bd('0x3b'),_0x3db88f[_0x60bd('0x37')]);}};Acw[_0x60bd('0x17')][_0x60bd('0x8')]=function(_0x4daaf9){try{if(this[_0x60bd('0x5')][_0x4daaf9[_0x60bd('0x1b')]]&&(this[_0x60bd('0x5')][_0x4daaf9[_0x60bd('0x1b')]]['acw']||this[_0x60bd('0x5')][_0x4daaf9[_0x60bd('0x1b')]][_0x60bd('0x1d')])){if(this[_0x60bd('0x6')][_0x4daaf9[_0x60bd('0x1a')]]){this[_0x60bd('0x19')][_0x4daaf9[_0x60bd('0x2b')]]={'queue':_0x4daaf9[_0x60bd('0x1b')],'interface':_0x4daaf9['interface'],'destlinkedid':_0x4daaf9['destlinkedid']};}}}catch(_0x4be171){logger[_0x60bd('0x31')](_0x60bd('0x3c'),_0x4be171[_0x60bd('0x37')]);}};Acw[_0x60bd('0x17')][_0x60bd('0x14')]=function(_0x4b7d9f){try{if(this[_0x60bd('0x5')][_0x4b7d9f[_0x60bd('0x1b')]]&&(this[_0x60bd('0x5')][_0x4b7d9f['queue']][_0x60bd('0x2')]||this[_0x60bd('0x5')][_0x4b7d9f[_0x60bd('0x1b')]][_0x60bd('0x1d')])){if(this['agents'][_0x4b7d9f[_0x60bd('0x1a')]]){this[_0x60bd('0x19')][_0x4b7d9f[_0x60bd('0x2b')]]={'queue':_0x4b7d9f[_0x60bd('0x1b')],'interface':_0x4b7d9f[_0x60bd('0x1a')]};}}}catch(_0x1c2992){logger[_0x60bd('0x31')](_0x60bd('0x3d'),_0x1c2992[_0x60bd('0x37')]);}};Acw[_0x60bd('0x17')][_0x60bd('0xa')]=function(_0xa3527f){try{if(this['channels'][_0xa3527f[_0x60bd('0x2b')]]&&_[_0x60bd('0x3e')](this[_0x60bd('0x19')][_0xa3527f['uniqueid']]['attended'])){logger[_0x60bd('0x25')](_0x60bd('0x3f'),_0xa3527f[_0x60bd('0x2b')]);this[_0x60bd('0x18')](_0xa3527f[_0x60bd('0x2b')]);}else if(this[_0x60bd('0x19')][_0xa3527f['linkedid']]&&_[_0x60bd('0x3e')](this[_0x60bd('0x19')][_0xa3527f['linkedid']][_0x60bd('0x27')])){logger[_0x60bd('0x25')](_0x60bd('0x40'),_0xa3527f[_0x60bd('0x41')]);this['startAcw'](_0xa3527f[_0x60bd('0x41')]);}}catch(_0x4e255d){logger[_0x60bd('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x4e255d[_0x60bd('0x37')]);}};Acw['prototype'][_0x60bd('0xc')]=function(_0xe7da3c){try{if(this[_0x60bd('0x19')][_0xe7da3c[_0x60bd('0x2b')]]&&this[_0x60bd('0x19')][_0xe7da3c[_0x60bd('0x2b')]][_0x60bd('0x27')]){logger[_0x60bd('0x25')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0xe7da3c[_0x60bd('0x2b')]);this[_0x60bd('0x18')](_0xe7da3c[_0x60bd('0x2b')]);}else if(this[_0x60bd('0x19')][_0xe7da3c[_0x60bd('0x41')]]&&this[_0x60bd('0x19')][_0xe7da3c[_0x60bd('0x41')]][_0x60bd('0x27')]){logger[_0x60bd('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xe7da3c['linkedid']);this[_0x60bd('0x18')](_0xe7da3c['linkedid']);}}catch(_0x56f16a){logger['error'](_0x60bd('0x42'),_0x56f16a[_0x60bd('0x37')]);}};Acw[_0x60bd('0x17')][_0x60bd('0x10')]=function(_0x27b6ed){try{if(!_[_0x60bd('0x43')](this[_0x60bd('0x19')][_0x27b6ed[_0x60bd('0x44')]])){this['startAcw'](_0x27b6ed['transfereeuniqueid']);if(this['channels'][_0x27b6ed[_0x60bd('0x45')]]){this[_0x60bd('0x19')][_0x27b6ed[_0x60bd('0x45')]][_0x60bd('0x27')]=!![];this[_0x60bd('0x19')][_0x27b6ed[_0x60bd('0x46')]]=this[_0x60bd('0x19')][_0x27b6ed[_0x60bd('0x45')]];delete this[_0x60bd('0x19')][_0x27b6ed[_0x60bd('0x45')]];}}else if(!_[_0x60bd('0x43')](this['channels'][_0x27b6ed[_0x60bd('0x46')]])){this[_0x60bd('0x18')](_0x27b6ed[_0x60bd('0x46')]);if(this['channels'][_0x27b6ed[_0x60bd('0x47')]]){this[_0x60bd('0x19')][_0x27b6ed[_0x60bd('0x47')]][_0x60bd('0x27')]=!![];this['channels'][_0x27b6ed['transfereeuniqueid']]=this['channels'][_0x27b6ed['origtransfereruniqueid']];delete this[_0x60bd('0x19')][_0x27b6ed[_0x60bd('0x47')]];}}}catch(_0x3d2938){logger[_0x60bd('0x31')](_0x60bd('0x48'),_0x3d2938['message']);}};Acw[_0x60bd('0x17')][_0x60bd('0x12')]=function(_0x447400){try{if(this[_0x60bd('0x19')][_0x447400['transfereruniqueid']]){logger[_0x60bd('0x25')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x447400[_0x60bd('0x49')]));this['startAcw'](_0x447400['transfereruniqueid']);}else if(this[_0x60bd('0x19')][_0x447400['transfererlinkedid']]){logger[_0x60bd('0x25')](_0x60bd('0x4a'),JSON['stringify'](_0x447400[_0x60bd('0x4b')]));this[_0x60bd('0x18')](_0x447400[_0x60bd('0x4b')]);}}catch(_0x4e52e6){logger['error'](_0x60bd('0x4c'),_0x4e52e6[_0x60bd('0x37')]);}};Acw[_0x60bd('0x17')][_0x60bd('0xe')]=function(_0x42d8a3){try{if(this[_0x60bd('0x5')][_0x42d8a3[_0x60bd('0x1b')]]&&this['voiceQueues'][_0x42d8a3[_0x60bd('0x1b')]][_0x60bd('0x4d')]==='all'){if(this[_0x60bd('0x6')][_0x42d8a3['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x42d8a3[_0x60bd('0x2b')],_0x42d8a3[_0x60bd('0x1a')],_0x42d8a3[_0x60bd('0x1b')]);return RpcUser['savePause'](this[_0x60bd('0x6')][_0x42d8a3[_0x60bd('0x1a')]],_0x60bd('0x4e'),_0x42d8a3[_0x60bd('0x2b')]);}}}catch(_0x18d70c){logger[_0x60bd('0x31')](_0x60bd('0x4f'),_0x18d70c[_0x60bd('0x37')]);}};module[_0x60bd('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 2bfdc90..1baa9c6 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 _0x3f14=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionCoreShowChannels','catch','log','exports','bluebird','moment','util','lodash','../../config/environment','port','asterisk','password','keepConnected','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','format','actionSipShowRegistry','Action','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown'];(function(_0xd8b66,_0xa7e707){var _0x1e53d2=function(_0x57f7c2){while(--_0x57f7c2){_0xd8b66['push'](_0xd8b66['shift']());}};_0x1e53d2(++_0xa7e707);}(_0x3f14,0x127));var _0x43f1=function(_0x1481ad,_0x2d3888){_0x1481ad=_0x1481ad-0x0;var _0x5ef3cb=_0x3f14[_0x1481ad];return _0x5ef3cb;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x43f1('0x0'));var moment=require(_0x43f1('0x1'));var util=require(_0x43f1('0x2'));var _=require(_0x43f1('0x3'));var logger=require('../../config/logger')('ami');var config=require(_0x43f1('0x4'));var ami=new Manager(config['asterisk'][_0x43f1('0x5')],config[_0x43f1('0x6')]['ip'],config[_0x43f1('0x6')]['username'],config[_0x43f1('0x6')][_0x43f1('0x7')],!![]);ami[_0x43f1('0x8')]();ami['Action']=BPromise[_0x43f1('0x9')](ami[_0x43f1('0xa')]);function error(_0x38f631){logger[_0x43f1('0xb')](util['format'](_0x43f1('0xc'),config[_0x43f1('0x6')][_0x43f1('0xd')],config[_0x43f1('0x6')]['ip'],config[_0x43f1('0x6')]['port'],util[_0x43f1('0xe')](_0x38f631,![],null)));}function close(){logger[_0x43f1('0xb')](util[_0x43f1('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x43f1('0x6')][_0x43f1('0xd')],config['asterisk']['ip'],config[_0x43f1('0x6')][_0x43f1('0x5')]));}ami[_0x43f1('0x10')]=function(){return function(){return ami[_0x43f1('0x11')]({'action':'sipshowregistry'});};};ami[_0x43f1('0x12')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x43f1('0x13')]=function(){return function(){return ami[_0x43f1('0x11')]({'action':_0x43f1('0x14')});};};ami[_0x43f1('0x15')]=function(){return function(){return ami[_0x43f1('0x11')]({'action':_0x43f1('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x507a7e){logger[_0x43f1('0x17')](util[_0x43f1('0xf')](_0x43f1('0x18'),config['asterisk'][_0x43f1('0xd')],config[_0x43f1('0x6')]['ip'],config[_0x43f1('0x6')][_0x43f1('0x5')]));ami[_0x43f1('0x19')]('error',error);ami['once'](_0x43f1('0x1a'),close);}ami['on'](_0x43f1('0x1b'),connect);ami['on'](_0x43f1('0x1c'),function(_0x1310ec){logger[_0x43f1('0x17')](util[_0x43f1('0xf')](_0x43f1('0x1d'),config['asterisk'][_0x43f1('0xd')],config['asterisk']['ip'],config[_0x43f1('0x6')]['port'],util['inspect'](_0x1310ec,![],null)));});ami['on']('fullybooted',function(_0x262a0d){logger['info'](util[_0x43f1('0xf')](_0x43f1('0x1e'),config[_0x43f1('0x6')]['username'],config[_0x43f1('0x6')]['ip'],config[_0x43f1('0x6')][_0x43f1('0x5')]));return BPromise['resolve']()[_0x43f1('0x1f')](ami['actionSipShowRegistry']())[_0x43f1('0x1f')](ami[_0x43f1('0x12')]())[_0x43f1('0x1f')](ami['actionSipPeerStatus']())[_0x43f1('0x1f')](ami[_0x43f1('0x15')]())[_0x43f1('0x1f')](ami[_0x43f1('0x20')]())[_0x43f1('0x21')](function(_0x273aa5){console[_0x43f1('0x22')](_0x273aa5);});});ami[_0x43f1('0x19')](_0x43f1('0xb'),error);ami['once'](_0x43f1('0x1a'),close);module[_0x43f1('0x23')]=ami; \ No newline at end of file +var _0x4ed0=['bluebird','moment','util','lodash','ami','../../config/environment','asterisk','port','username','keepConnected','Action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','resolve','then','catch','log','exports','asterisk-manager'];(function(_0x53ba5d,_0x45fa01){var _0x38f736=function(_0x2451f4){while(--_0x2451f4){_0x53ba5d['push'](_0x53ba5d['shift']());}};_0x38f736(++_0x45fa01);}(_0x4ed0,0x1c7));var _0x04ed=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ed0[_0x3947c9];return _0x2e7871;};'use strict';var Manager=require(_0x04ed('0x0'));var BPromise=require(_0x04ed('0x1'));var moment=require(_0x04ed('0x2'));var util=require(_0x04ed('0x3'));var _=require(_0x04ed('0x4'));var logger=require('../../config/logger')(_0x04ed('0x5'));var config=require(_0x04ed('0x6'));var ami=new Manager(config[_0x04ed('0x7')][_0x04ed('0x8')],config['asterisk']['ip'],config[_0x04ed('0x7')][_0x04ed('0x9')],config[_0x04ed('0x7')]['password'],!![]);ami[_0x04ed('0xa')]();ami[_0x04ed('0xb')]=BPromise['promisify'](ami['action']);function error(_0x250802){logger['error'](util[_0x04ed('0xc')](_0x04ed('0xd'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x04ed('0x7')][_0x04ed('0x8')],util['inspect'](_0x250802,![],null)));}function close(){logger[_0x04ed('0xe')](util[_0x04ed('0xc')](_0x04ed('0xf'),config[_0x04ed('0x7')]['username'],config['asterisk']['ip'],config[_0x04ed('0x7')]['port']));}ami[_0x04ed('0x10')]=function(){return function(){return ami[_0x04ed('0xb')]({'action':_0x04ed('0x11')});};};ami[_0x04ed('0x12')]=function(){return function(){return ami[_0x04ed('0xb')]({'action':'devicestatelist'});};};ami[_0x04ed('0x13')]=function(){return function(){return ami['Action']({'action':_0x04ed('0x14')});};};ami[_0x04ed('0x15')]=function(){return function(){return ami['Action']({'action':_0x04ed('0x16')});};};ami[_0x04ed('0x17')]=function(){return function(){return ami[_0x04ed('0xb')]({'action':_0x04ed('0x18')});};};function connect(_0x586a45){logger[_0x04ed('0x19')](util[_0x04ed('0xc')](_0x04ed('0x1a'),config[_0x04ed('0x7')][_0x04ed('0x9')],config[_0x04ed('0x7')]['ip'],config[_0x04ed('0x7')][_0x04ed('0x8')]));ami[_0x04ed('0x1b')](_0x04ed('0xe'),error);ami[_0x04ed('0x1b')](_0x04ed('0x1c'),close);}ami['on'](_0x04ed('0x1d'),connect);ami['on'](_0x04ed('0x1e'),function(_0x964756){logger[_0x04ed('0x19')](util[_0x04ed('0xc')](_0x04ed('0x1f'),config['asterisk'][_0x04ed('0x9')],config[_0x04ed('0x7')]['ip'],config[_0x04ed('0x7')][_0x04ed('0x8')],util[_0x04ed('0x20')](_0x964756,![],null)));});ami['on']('fullybooted',function(_0x783f53){logger[_0x04ed('0x19')](util[_0x04ed('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x04ed('0x9')],config[_0x04ed('0x7')]['ip'],config['asterisk'][_0x04ed('0x8')]));return BPromise[_0x04ed('0x21')]()[_0x04ed('0x22')](ami[_0x04ed('0x10')]())[_0x04ed('0x22')](ami[_0x04ed('0x12')]())[_0x04ed('0x22')](ami['actionSipPeerStatus']())[_0x04ed('0x22')](ami[_0x04ed('0x15')]())[_0x04ed('0x22')](ami[_0x04ed('0x17')]())[_0x04ed('0x23')](function(_0x502735){console[_0x04ed('0x24')](_0x502735);});});ami[_0x04ed('0x1b')](_0x04ed('0xe'),error);ami[_0x04ed('0x1b')](_0x04ed('0x1c'),close);module[_0x04ed('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 38e312a..3b04a8b 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0xac4a,0x13f));var _0xaac4=function(_0x58a47f,_0x7d24d5){_0x58a47f=_0x58a47f-0x0;var _0xfafcf0=_0xac4a[_0x58a47f];return _0xfafcf0;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xda3f,0xec));var _0xfda3=function(_0x12a8a8,_0x2e5f91){_0x12a8a8=_0x12a8a8-0x0;var _0x5b1d28=_0xda3f[_0x12a8a8];return _0x5b1d28;};'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/action.js b/server/services/ami/dialer/action.js index 9d708b1..28a1e7a 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda05=['countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x1ecaa5,_0x1a2fec){var _0x353b9d=function(_0x3b2a52){while(--_0x3b2a52){_0x1ecaa5['push'](_0x1ecaa5['shift']());}};_0x353b9d(++_0x1a2fec);}(_0xda05,0x1d8));var _0x5da0=function(_0x442ea1,_0x25bb90){_0x442ea1=_0x442ea1-0x0;var _0x181711=_0xda05[_0x442ea1];return _0x181711;};'use strict';var util=require(_0x5da0('0x0'));var _=require(_0x5da0('0x1'));var moment=require(_0x5da0('0x2'));function checkNameSurname(_0x27823b,_0x5d6563,_0x22ec8c){var _0x1cebaa='';if(!_[_0x5da0('0x3')](_0x5d6563)&&_0x5da0('0x4')===typeof _0x5d6563){_0x1cebaa+=_0x5d6563;}if(!_[_0x5da0('0x3')](_0x22ec8c)&&_0x5da0('0x4')===typeof _0x22ec8c){_0x1cebaa+='\x20'+_0x22ec8c;}if(_0x1cebaa!==''){return _0x1cebaa;}return _0x27823b;}function Action(_0x57dfed,_0x142ba0,_0x3077ee){this[_0x5da0('0x5')]=_0x57dfed;this[_0x5da0('0x6')]=_0x3077ee||undefined;this[_0x5da0('0x7')]=checkNameSurname(_0x142ba0[_0x5da0('0x8')][_0x5da0('0x9')],_0x142ba0[_0x5da0('0x8')][_0x5da0('0xa')],_0x142ba0[_0x5da0('0x8')][_0x5da0('0xb')]);this[_0x5da0('0xc')]=_0x142ba0['Contact']['phone'];this['queue']=_0x57dfed[_0x5da0('0x7')];this[_0x5da0('0xd')]=_0x142ba0[_0x5da0('0xd')]||![];this['type']=_0x57dfed[_0x5da0('0xe')];this[_0x5da0('0xf')]=_0x57dfed[_0x5da0('0xf')]||0x3;this[_0x5da0('0x10')]=_0x142ba0['scheduledat'];this['countbusyretry']=_0x142ba0[_0x5da0('0x11')];this[_0x5da0('0x12')]=_0x142ba0[_0x5da0('0x12')];this[_0x5da0('0x13')]=_0x142ba0[_0x5da0('0x13')];this[_0x5da0('0x14')]=_0x142ba0[_0x5da0('0x14')];this[_0x5da0('0x15')]=_0x142ba0[_0x5da0('0x15')];this[_0x5da0('0x16')]=_0x142ba0['countabandonedretry'];this[_0x5da0('0x17')]=_0x142ba0[_0x5da0('0x17')];this[_0x5da0('0x18')]=_0x142ba0[_0x5da0('0x18')];this['ContactId']=_0x142ba0[_0x5da0('0x19')];this['ListId']=_0x142ba0[_0x5da0('0x1a')];this[_0x5da0('0x1b')]=_0x142ba0[_0x5da0('0x1b')];this[_0x5da0('0x1c')]=_0x142ba0['VoiceQueueId'];this[_0x5da0('0x1d')]=_0x142ba0[_0x5da0('0x1d')];this[_0x5da0('0x1e')]=_0x142ba0['id'];this['ContactFirstName']=_0x142ba0[_0x5da0('0x8')]['firstName']||'';this[_0x5da0('0x1f')]=moment()[_0x5da0('0x20')](_0x5da0('0x21'));this[_0x5da0('0x22')]=_0x142ba0[_0x5da0('0x22')];this[_0x5da0('0x23')]=_0x142ba0[_0x5da0('0x23')];this['callbackat']=_0x142ba0['callbackat'];this[_0x5da0('0x24')]=_0x142ba0[_0x5da0('0x24')];this[_0x5da0('0x25')]='';this[_0x5da0('0x26')]='';}Action[_0x5da0('0x27')][_0x5da0('0x28')]=function(){return util[_0x5da0('0x20')]('\x22%s\x22\x20<%s>',this[_0x5da0('0x7')],this[_0x5da0('0x5')][_0x5da0('0x29')]>0x0?this['number'][_0x5da0('0x2a')](this[_0x5da0('0x5')][_0x5da0('0x29')]):this[_0x5da0('0xc')]);};Action[_0x5da0('0x27')]['getQueue']=function(){return this[_0x5da0('0x2b')];};module[_0x5da0('0x2c')]=Action; \ No newline at end of file +var _0x7eda=['originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','queue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme'];(function(_0xa5d421,_0x27a825){var _0x50d500=function(_0x542fc0){while(--_0x542fc0){_0xa5d421['push'](_0xa5d421['shift']());}};_0x50d500(++_0x27a825);}(_0x7eda,0x93));var _0xa7ed=function(_0x379336,_0x2e9c97){_0x379336=_0x379336-0x0;var _0x2fe67d=_0x7eda[_0x379336];return _0x2fe67d;};'use strict';var util=require(_0xa7ed('0x0'));var _=require('lodash');var moment=require(_0xa7ed('0x1'));function checkNameSurname(_0x549229,_0x158000,_0x39d0bf){var _0x5cc34f='';if(!_[_0xa7ed('0x2')](_0x158000)&&_0xa7ed('0x3')===typeof _0x158000){_0x5cc34f+=_0x158000;}if(!_['isNil'](_0x39d0bf)&&_0xa7ed('0x3')===typeof _0x39d0bf){_0x5cc34f+='\x20'+_0x39d0bf;}if(_0x5cc34f!==''){return _0x5cc34f;}return _0x549229;}function Action(_0x3313dc,_0x2731f4,_0x5cf07f){this[_0xa7ed('0x4')]=_0x3313dc;this[_0xa7ed('0x5')]=_0x5cf07f||undefined;this[_0xa7ed('0x6')]=checkNameSurname(_0x2731f4['Contact']['phone'],_0x2731f4[_0xa7ed('0x7')]['firstName'],_0x2731f4[_0xa7ed('0x7')][_0xa7ed('0x8')]);this[_0xa7ed('0x9')]=_0x2731f4[_0xa7ed('0x7')][_0xa7ed('0xa')];this['queue']=_0x3313dc[_0xa7ed('0x6')];this[_0xa7ed('0xb')]=_0x2731f4['active']||![];this['type']=_0x3313dc[_0xa7ed('0xc')];this[_0xa7ed('0xd')]=_0x3313dc[_0xa7ed('0xd')]||0x3;this[_0xa7ed('0xe')]=_0x2731f4['scheduledat'];this[_0xa7ed('0xf')]=_0x2731f4[_0xa7ed('0xf')];this[_0xa7ed('0x10')]=_0x2731f4[_0xa7ed('0x10')];this[_0xa7ed('0x11')]=_0x2731f4['countnoanswerretry'];this[_0xa7ed('0x12')]=_0x2731f4[_0xa7ed('0x12')];this[_0xa7ed('0x13')]=_0x2731f4[_0xa7ed('0x13')];this['countabandonedretry']=_0x2731f4[_0xa7ed('0x14')];this['countmachineretry']=_0x2731f4[_0xa7ed('0x15')];this[_0xa7ed('0x16')]=_0x2731f4[_0xa7ed('0x16')];this[_0xa7ed('0x17')]=_0x2731f4[_0xa7ed('0x17')];this[_0xa7ed('0x18')]=_0x2731f4[_0xa7ed('0x18')];this['UserId']=_0x2731f4[_0xa7ed('0x19')];this[_0xa7ed('0x1a')]=_0x2731f4[_0xa7ed('0x1a')];this[_0xa7ed('0x1b')]=_0x2731f4[_0xa7ed('0x1b')];this[_0xa7ed('0x1c')]=_0x2731f4['id'];this[_0xa7ed('0x1d')]=_0x2731f4[_0xa7ed('0x7')][_0xa7ed('0x1e')]||'';this[_0xa7ed('0x1f')]=moment()[_0xa7ed('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa7ed('0x21')]=_0x2731f4[_0xa7ed('0x21')];this[_0xa7ed('0x22')]=_0x2731f4['callbackuniqueid'];this['callbackat']=_0x2731f4[_0xa7ed('0x23')];this[_0xa7ed('0x24')]=_0x2731f4[_0xa7ed('0x24')];this[_0xa7ed('0x25')]='';this[_0xa7ed('0x26')]='';}Action[_0xa7ed('0x27')][_0xa7ed('0x28')]=function(){return util[_0xa7ed('0x20')]('\x22%s\x22\x20<%s>',this[_0xa7ed('0x6')],this['voiceQueue'][_0xa7ed('0x29')]>0x0?this[_0xa7ed('0x9')][_0xa7ed('0x2a')](this[_0xa7ed('0x4')][_0xa7ed('0x29')]):this[_0xa7ed('0x9')]);};Action[_0xa7ed('0x27')][_0xa7ed('0x2b')]=function(){return this[_0xa7ed('0x2c')];};module[_0xa7ed('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index dbbc086..f081a13 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a15=['originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x408787,_0x373c9c){var _0x51463d=function(_0xdd93ed){while(--_0xdd93ed){_0x408787['push'](_0x408787['shift']());}};_0x51463d(++_0x373c9c);}(_0x8a15,0x17a));var _0x58a1=function(_0x503699,_0x152145){_0x503699=_0x503699-0x0;var _0xd66c82=_0x8a15[_0x503699];return _0xd66c82;};'use strict';var util=require(_0x58a1('0x0'));var _=require(_0x58a1('0x1'));var moment=require(_0x58a1('0x2'));function getSeconds(_0x895c94,_0x158d7a){var _0x110bb9=moment(_0x895c94)[_0x58a1('0x3')](0x0);var _0x3d0667=moment(_0x158d7a)['milliseconds'](0x0);return _0x110bb9[_0x58a1('0x4')](_0x3d0667,_0x58a1('0x5'));}function AgentComplete(_0x21ee4a,_0x5f5dbb){this[_0x58a1('0x6')]=0x4;this[_0x58a1('0x7')]=_0x58a1('0x8');this[_0x58a1('0x9')]=_0x21ee4a[_0x58a1('0x9')];this[_0x58a1('0xa')]=_0x21ee4a[_0x58a1('0xa')];this['campaigntype']=_0x21ee4a['type']==='outbound'?'queue':_0x21ee4a[_0x58a1('0xa')];this['countbusyretry']=_0x21ee4a[_0x58a1('0xb')];this[_0x58a1('0xc')]=_0x21ee4a['countcongestionretry'];this['countnoanswerretry']=_0x21ee4a[_0x58a1('0xd')];this[_0x58a1('0xe')]=_0x21ee4a[_0x58a1('0xb')]+_0x21ee4a['countcongestionretry']+_0x21ee4a[_0x58a1('0xd')]+_0x21ee4a['countnosuchnumberretry']+_0x21ee4a[_0x58a1('0xf')]+_0x21ee4a[_0x58a1('0x10')]+_0x21ee4a['countmachineretry']+_0x21ee4a[_0x58a1('0x11')];this['countnosuchnumberretry']=_0x21ee4a[_0x58a1('0x12')];this[_0x58a1('0xf')]=_0x21ee4a[_0x58a1('0xf')];this[_0x58a1('0x10')]=_0x21ee4a[_0x58a1('0x10')];this['countmachineretry']=_0x21ee4a[_0x58a1('0x13')];this[_0x58a1('0x11')]=_0x21ee4a[_0x58a1('0x11')];this[_0x58a1('0x14')]=_0x5f5dbb['uniqueid'];this[_0x58a1('0x15')]=_0x21ee4a[_0x58a1('0x16')];this['calleridnum']=_0x21ee4a[_0x58a1('0x17')];this[_0x58a1('0x18')]=_0x21ee4a[_0x58a1('0x18')];this[_0x58a1('0x19')]=_0x21ee4a[_0x58a1('0x19')];this[_0x58a1('0x1a')]=_0x21ee4a[_0x58a1('0x1a')];this[_0x58a1('0x1b')]=moment()['format'](_0x58a1('0x1c'));this[_0x58a1('0x1d')]=getSeconds(_0x21ee4a[_0x58a1('0x19')],_0x21ee4a[_0x58a1('0x18')]);this[_0x58a1('0x1e')]=getSeconds(_0x21ee4a[_0x58a1('0x1a')],_0x21ee4a[_0x58a1('0x19')]);this[_0x58a1('0x1f')]=getSeconds(this[_0x58a1('0x1b')],_0x21ee4a[_0x58a1('0x1a')]);this[_0x58a1('0x20')]=_0x5f5dbb[_0x58a1('0x20')];this[_0x58a1('0x21')]=_0x5f5dbb[_0x58a1('0x21')];this[_0x58a1('0x22')]=_0x5f5dbb['reason'];this[_0x58a1('0x23')]=_0x21ee4a[_0x58a1('0x23')];this[_0x58a1('0x24')]=_0x21ee4a[_0x58a1('0x24')];this[_0x58a1('0x25')]=_0x21ee4a[_0x58a1('0x25')];this['recallme']=_0x21ee4a[_0x58a1('0x26')];this[_0x58a1('0x27')]=_0x21ee4a[_0x58a1('0x27')];this[_0x58a1('0x28')]=_0x21ee4a[_0x58a1('0x28')];this[_0x58a1('0x29')]=_0x21ee4a[_0x58a1('0x29')];this['VoiceQueueId']=_0x21ee4a[_0x58a1('0x2a')];this[_0x58a1('0x2b')]=_0x21ee4a[_0x58a1('0x2b')];this[_0x58a1('0x2c')]=_0x21ee4a[_0x58a1('0x2c')]||'';this['originatecalleridname']=_0x21ee4a[_0x58a1('0x2d')]||'';}module[_0x58a1('0x2e')]=AgentComplete; \ No newline at end of file +var _0xf801=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','answertime','endtime'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf801,0xa0));var _0x1f80=function(_0x3b1aec,_0x4a66ff){_0x3b1aec=_0x3b1aec-0x0;var _0x574c45=_0xf801[_0x3b1aec];return _0x574c45;};'use strict';var util=require(_0x1f80('0x0'));var _=require(_0x1f80('0x1'));var moment=require(_0x1f80('0x2'));function getSeconds(_0x4edd34,_0x337101){var _0x3e6254=moment(_0x4edd34)[_0x1f80('0x3')](0x0);var _0x2d933d=moment(_0x337101)[_0x1f80('0x3')](0x0);return _0x3e6254[_0x1f80('0x4')](_0x2d933d,_0x1f80('0x5'));}function AgentComplete(_0x5d3e75,_0x20e615){this[_0x1f80('0x6')]=0x4;this[_0x1f80('0x7')]=_0x1f80('0x8');this['scheduledat']=_0x5d3e75['scheduledat'];this[_0x1f80('0x9')]=_0x5d3e75[_0x1f80('0x9')];this[_0x1f80('0xa')]=_0x5d3e75['type']==='outbound'?_0x1f80('0xb'):_0x5d3e75[_0x1f80('0x9')];this['countbusyretry']=_0x5d3e75[_0x1f80('0xc')];this[_0x1f80('0xd')]=_0x5d3e75[_0x1f80('0xd')];this[_0x1f80('0xe')]=_0x5d3e75[_0x1f80('0xe')];this[_0x1f80('0xf')]=_0x5d3e75[_0x1f80('0xc')]+_0x5d3e75['countcongestionretry']+_0x5d3e75[_0x1f80('0xe')]+_0x5d3e75[_0x1f80('0x10')]+_0x5d3e75[_0x1f80('0x11')]+_0x5d3e75[_0x1f80('0x12')]+_0x5d3e75[_0x1f80('0x13')]+_0x5d3e75[_0x1f80('0x14')];this[_0x1f80('0x10')]=_0x5d3e75[_0x1f80('0x10')];this['countdropretry']=_0x5d3e75['countdropretry'];this[_0x1f80('0x12')]=_0x5d3e75[_0x1f80('0x12')];this['countmachineretry']=_0x5d3e75['countmachineretry'];this[_0x1f80('0x14')]=_0x5d3e75[_0x1f80('0x14')];this['uniqueid']=_0x20e615['uniqueid'];this['calleridname']=_0x5d3e75[_0x1f80('0x15')];this[_0x1f80('0x16')]=_0x5d3e75[_0x1f80('0x17')];this[_0x1f80('0x18')]=_0x5d3e75[_0x1f80('0x18')];this[_0x1f80('0x19')]=_0x5d3e75['responsetime'];this['answertime']=_0x5d3e75[_0x1f80('0x1a')];this[_0x1f80('0x1b')]=moment()[_0x1f80('0x1c')](_0x1f80('0x1d'));this[_0x1f80('0x1e')]=getSeconds(_0x5d3e75[_0x1f80('0x19')],_0x5d3e75['starttime']);this[_0x1f80('0x1f')]=getSeconds(_0x5d3e75['answertime'],_0x5d3e75['responsetime']);this[_0x1f80('0x20')]=getSeconds(this[_0x1f80('0x1b')],_0x5d3e75['answertime']);this[_0x1f80('0xb')]=_0x20e615[_0x1f80('0xb')];this[_0x1f80('0x21')]=_0x20e615[_0x1f80('0x21')];this[_0x1f80('0x22')]=_0x20e615[_0x1f80('0x22')];this['callback']=_0x5d3e75[_0x1f80('0x23')];this[_0x1f80('0x24')]=_0x5d3e75[_0x1f80('0x24')];this[_0x1f80('0x25')]=_0x5d3e75[_0x1f80('0x25')];this[_0x1f80('0x26')]=_0x5d3e75['recallme'];this['ContactId']=_0x5d3e75[_0x1f80('0x27')];this[_0x1f80('0x28')]=_0x5d3e75['ListId'];this[_0x1f80('0x29')]=_0x5d3e75['UserId'];this['VoiceQueueId']=_0x5d3e75[_0x1f80('0x2a')];this[_0x1f80('0x2b')]=_0x5d3e75[_0x1f80('0x2b')];this[_0x1f80('0x2c')]=_0x5d3e75['originatecalleridnum']||'';this['originatecalleridname']=_0x5d3e75[_0x1f80('0x2d')]||'';}module[_0x1f80('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 5b843fe..0a1ba85 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcca7=['milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0x59b25d,_0x5eeea3){var _0x46782a=function(_0x3869de){while(--_0x3869de){_0x59b25d['push'](_0x59b25d['shift']());}};_0x46782a(++_0x5eeea3);}(_0xcca7,0x1aa));var _0x7cca=function(_0x2416d3,_0x1d2de8){_0x2416d3=_0x2416d3-0x0;var _0x31cb1b=_0xcca7[_0x2416d3];return _0x31cb1b;};'use strict';var util=require(_0x7cca('0x0'));var _=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));function getSeconds(_0x33db4f,_0x5cfce5){var _0x4c311e=moment(_0x33db4f)[_0x7cca('0x3')](0x0);var _0x533b00=moment(_0x5cfce5)[_0x7cca('0x3')](0x0);return _0x4c311e[_0x7cca('0x4')](_0x533b00,_0x7cca('0x5'));}function Final(_0x312e98){this[_0x7cca('0x6')]=_0x312e98[_0x7cca('0x6')];this['scheduledat']=_0x312e98['scheduledat'];this[_0x7cca('0x7')]=_0x312e98[_0x7cca('0x7')];this[_0x7cca('0x8')]=_0x312e98[_0x7cca('0x7')]===_0x7cca('0x9')?_0x7cca('0xa'):_0x312e98[_0x7cca('0x7')];this[_0x7cca('0xb')]=_0x312e98[_0x7cca('0xb')];this[_0x7cca('0xc')]=_0x312e98['countcongestionretry'];this[_0x7cca('0xd')]=_0x312e98[_0x7cca('0xd')];this[_0x7cca('0xe')]=_0x312e98[_0x7cca('0xb')]+_0x312e98[_0x7cca('0xc')]+_0x312e98['countnoanswerretry']+_0x312e98[_0x7cca('0xf')]+_0x312e98[_0x7cca('0x10')]+_0x312e98[_0x7cca('0x11')]+_0x312e98['countmachineretry']+_0x312e98['countagentrejectretry'];this[_0x7cca('0xf')]=_0x312e98[_0x7cca('0xf')];this[_0x7cca('0x10')]=_0x312e98[_0x7cca('0x10')];this[_0x7cca('0x11')]=_0x312e98[_0x7cca('0x11')];this[_0x7cca('0x12')]=_0x312e98['countmachineretry'];this[_0x7cca('0x13')]=_0x312e98['countagentrejectretry'];this['queue']=_0x312e98['queue'];this[_0x7cca('0x14')]=_0x312e98[_0x7cca('0x14')];this[_0x7cca('0x15')]=_0x312e98[_0x7cca('0x15')];this[_0x7cca('0x16')]=_0x312e98['starttime'];this[_0x7cca('0x17')]=_0x312e98['responsetime'];this['endtime']=_0x312e98['responsetime'];this[_0x7cca('0x18')]=_0x312e98[_0x7cca('0x18')]||0x0;this[_0x7cca('0x19')]=_0x312e98[_0x7cca('0x19')]||0x0;this[_0x7cca('0x1a')]=_0x312e98[_0x7cca('0x1a')]||0x0;this[_0x7cca('0x1b')]=_0x312e98[_0x7cca('0x1b')];this['callbackuniqueid']=_0x312e98[_0x7cca('0x1c')];this[_0x7cca('0x1d')]=_0x312e98[_0x7cca('0x1d')];this[_0x7cca('0x1e')]=_0x312e98['recallme'];this[_0x7cca('0x1f')]=_0x312e98[_0x7cca('0x1f')];this[_0x7cca('0x20')]=_0x312e98[_0x7cca('0x20')];this[_0x7cca('0x21')]=_0x312e98[_0x7cca('0x21')];this[_0x7cca('0x22')]=_0x312e98[_0x7cca('0x22')];this['CampaignId']=_0x312e98[_0x7cca('0x23')];this[_0x7cca('0x24')]=_0x312e98[_0x7cca('0x24')]||'';this[_0x7cca('0x25')]=_0x312e98[_0x7cca('0x25')]||'';}module[_0x7cca('0x26')]=Final; \ No newline at end of file +var _0xec39=['countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0xda3559,_0x460825){var _0x2ff9f9=function(_0x7191ea){while(--_0x7191ea){_0xda3559['push'](_0xda3559['shift']());}};_0x2ff9f9(++_0x460825);}(_0xec39,0x19f));var _0x9ec3=function(_0x3f0de1,_0x25ce78){_0x3f0de1=_0x3f0de1-0x0;var _0x408bc2=_0xec39[_0x3f0de1];return _0x408bc2;};'use strict';var util=require(_0x9ec3('0x0'));var _=require(_0x9ec3('0x1'));var moment=require(_0x9ec3('0x2'));function getSeconds(_0x3ea667,_0x1fc7a7){var _0xb3d117=moment(_0x3ea667)[_0x9ec3('0x3')](0x0);var _0x5c0885=moment(_0x1fc7a7)[_0x9ec3('0x3')](0x0);return _0xb3d117[_0x9ec3('0x4')](_0x5c0885,_0x9ec3('0x5'));}function Final(_0x4a3996){this['uniqueid']=_0x4a3996['uniqueid'];this[_0x9ec3('0x6')]=_0x4a3996[_0x9ec3('0x6')];this[_0x9ec3('0x7')]=_0x4a3996['type'];this[_0x9ec3('0x8')]=_0x4a3996[_0x9ec3('0x7')]===_0x9ec3('0x9')?_0x9ec3('0xa'):_0x4a3996[_0x9ec3('0x7')];this[_0x9ec3('0xb')]=_0x4a3996[_0x9ec3('0xb')];this['countcongestionretry']=_0x4a3996[_0x9ec3('0xc')];this[_0x9ec3('0xd')]=_0x4a3996[_0x9ec3('0xd')];this[_0x9ec3('0xe')]=_0x4a3996[_0x9ec3('0xb')]+_0x4a3996[_0x9ec3('0xc')]+_0x4a3996[_0x9ec3('0xd')]+_0x4a3996['countnosuchnumberretry']+_0x4a3996[_0x9ec3('0xf')]+_0x4a3996[_0x9ec3('0x10')]+_0x4a3996[_0x9ec3('0x11')]+_0x4a3996['countagentrejectretry'];this[_0x9ec3('0x12')]=_0x4a3996['countnosuchnumberretry'];this[_0x9ec3('0xf')]=_0x4a3996[_0x9ec3('0xf')];this[_0x9ec3('0x10')]=_0x4a3996[_0x9ec3('0x10')];this[_0x9ec3('0x11')]=_0x4a3996[_0x9ec3('0x11')];this[_0x9ec3('0x13')]=_0x4a3996[_0x9ec3('0x13')];this[_0x9ec3('0xa')]=_0x4a3996['queue'];this[_0x9ec3('0x14')]=_0x4a3996['calleridname'];this['calleridnum']=_0x4a3996[_0x9ec3('0x15')];this[_0x9ec3('0x16')]=_0x4a3996[_0x9ec3('0x16')];this[_0x9ec3('0x17')]=_0x4a3996[_0x9ec3('0x17')];this['endtime']=_0x4a3996[_0x9ec3('0x17')];this['ringtime']=_0x4a3996[_0x9ec3('0x18')]||0x0;this['holdtime']=_0x4a3996[_0x9ec3('0x19')]||0x0;this[_0x9ec3('0x1a')]=_0x4a3996[_0x9ec3('0x1a')]||0x0;this['callback']=_0x4a3996[_0x9ec3('0x1b')];this['callbackuniqueid']=_0x4a3996[_0x9ec3('0x1c')];this['callbackat']=_0x4a3996[_0x9ec3('0x1d')];this[_0x9ec3('0x1e')]=_0x4a3996[_0x9ec3('0x1e')];this[_0x9ec3('0x1f')]=_0x4a3996[_0x9ec3('0x1f')];this[_0x9ec3('0x20')]=_0x4a3996[_0x9ec3('0x20')];this['UserId']=_0x4a3996[_0x9ec3('0x21')];this[_0x9ec3('0x22')]=_0x4a3996[_0x9ec3('0x22')];this[_0x9ec3('0x23')]=_0x4a3996[_0x9ec3('0x23')];this[_0x9ec3('0x24')]=_0x4a3996[_0x9ec3('0x24')]||'';this[_0x9ec3('0x25')]=_0x4a3996[_0x9ec3('0x25')]||'';}module[_0x9ec3('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 968a846..24c709f 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb055=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0xf1791b,_0x2e2854){var _0x4ed802=function(_0xead908){while(--_0xead908){_0xf1791b['push'](_0xf1791b['shift']());}};_0x4ed802(++_0x2e2854);}(_0xb055,0x181));var _0x5b05=function(_0x371799,_0x565cf5){_0x371799=_0x371799-0x0;var _0x5f2802=_0xb055[_0x371799];return _0x5f2802;};'use strict';var util=require('util');var _=require(_0x5b05('0x0'));var moment=require(_0x5b05('0x1'));function getSeconds(_0x16fdc8,_0x42add1){var _0x260df0=moment(_0x16fdc8)[_0x5b05('0x2')](0x0);var _0x1a34bc=moment(_0x42add1)[_0x5b05('0x2')](0x0);return _0x260df0[_0x5b05('0x3')](_0x1a34bc,_0x5b05('0x4'));}function Hangup(_0x214172,_0x221b98){this['state']=0x4;this['statedesc']='Answer';this[_0x5b05('0x5')]=_0x214172['scheduledat'];this[_0x5b05('0x6')]=_0x214172[_0x5b05('0x6')];this[_0x5b05('0x7')]=_0x214172[_0x5b05('0x6')]===_0x5b05('0x8')?_0x5b05('0x9'):_0x214172[_0x5b05('0x6')];this[_0x5b05('0xa')]=_0x214172['countbusyretry'];this[_0x5b05('0xb')]=_0x214172['countcongestionretry'];this[_0x5b05('0xc')]=_0x214172[_0x5b05('0xc')];this[_0x5b05('0xd')]=_0x214172[_0x5b05('0xa')]+_0x214172[_0x5b05('0xb')]+_0x214172[_0x5b05('0xc')]+_0x214172[_0x5b05('0xe')]+_0x214172[_0x5b05('0xf')]+_0x214172[_0x5b05('0x10')]+_0x214172['countmachineretry']+_0x214172['countagentrejectretry'];this[_0x5b05('0xe')]=_0x214172[_0x5b05('0xe')];this[_0x5b05('0xf')]=_0x214172['countdropretry'];this[_0x5b05('0x10')]=_0x214172[_0x5b05('0x10')];this[_0x5b05('0x11')]=_0x214172[_0x5b05('0x11')];this['countagentrejectretry']=_0x214172[_0x5b05('0x12')];this['uniqueid']=_0x221b98['uniqueid'];this[_0x5b05('0x13')]=_0x214172[_0x5b05('0x14')];this[_0x5b05('0x15')]=_0x214172[_0x5b05('0x16')];this[_0x5b05('0x17')]=_0x214172[_0x5b05('0x17')];this[_0x5b05('0x18')]=_0x214172[_0x5b05('0x18')];this[_0x5b05('0x19')]=moment()[_0x5b05('0x1a')](_0x5b05('0x1b'));this[_0x5b05('0x1c')]=getSeconds(_0x214172[_0x5b05('0x18')],_0x214172[_0x5b05('0x17')]);this[_0x5b05('0x1d')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x214172[_0x5b05('0x18')]);this['queue']=_0x214172[_0x5b05('0x9')];this['membername']='IVR';this['reason']=_0x221b98[_0x5b05('0x1e')];this[_0x5b05('0x1f')]=_0x214172[_0x5b05('0x1f')];this[_0x5b05('0x20')]=_0x214172[_0x5b05('0x20')];this[_0x5b05('0x21')]=_0x214172[_0x5b05('0x21')];this[_0x5b05('0x22')]=_0x214172['recallme'];this[_0x5b05('0x23')]=_0x214172[_0x5b05('0x23')];this[_0x5b05('0x24')]=_0x214172['ListId'];this[_0x5b05('0x25')]=_0x214172['UserId'];this[_0x5b05('0x26')]=_0x214172[_0x5b05('0x26')];this[_0x5b05('0x27')]=_0x214172[_0x5b05('0x27')];}module['exports']=Hangup; \ No newline at end of file +var _0xe3a9=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','format','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xe3a9,0x18b));var _0x9e3a=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xe3a9[_0x565c49];return _0x20ca34;};'use strict';var util=require(_0x9e3a('0x0'));var _=require(_0x9e3a('0x1'));var moment=require(_0x9e3a('0x2'));function getSeconds(_0x5046d0,_0x1704a7){var _0x42d7cc=moment(_0x5046d0)[_0x9e3a('0x3')](0x0);var _0xf605dc=moment(_0x1704a7)[_0x9e3a('0x3')](0x0);return _0x42d7cc[_0x9e3a('0x4')](_0xf605dc,_0x9e3a('0x5'));}function Hangup(_0x3e10f,_0x436482){this['state']=0x4;this[_0x9e3a('0x6')]=_0x9e3a('0x7');this['scheduledat']=_0x3e10f[_0x9e3a('0x8')];this[_0x9e3a('0x9')]=_0x3e10f[_0x9e3a('0x9')];this[_0x9e3a('0xa')]=_0x3e10f[_0x9e3a('0x9')]===_0x9e3a('0xb')?'queue':_0x3e10f[_0x9e3a('0x9')];this[_0x9e3a('0xc')]=_0x3e10f[_0x9e3a('0xc')];this[_0x9e3a('0xd')]=_0x3e10f[_0x9e3a('0xd')];this[_0x9e3a('0xe')]=_0x3e10f[_0x9e3a('0xe')];this[_0x9e3a('0xf')]=_0x3e10f[_0x9e3a('0xc')]+_0x3e10f['countcongestionretry']+_0x3e10f[_0x9e3a('0xe')]+_0x3e10f[_0x9e3a('0x10')]+_0x3e10f[_0x9e3a('0x11')]+_0x3e10f['countabandonedretry']+_0x3e10f[_0x9e3a('0x12')]+_0x3e10f[_0x9e3a('0x13')];this['countnosuchnumberretry']=_0x3e10f[_0x9e3a('0x10')];this[_0x9e3a('0x11')]=_0x3e10f[_0x9e3a('0x11')];this[_0x9e3a('0x14')]=_0x3e10f[_0x9e3a('0x14')];this[_0x9e3a('0x12')]=_0x3e10f[_0x9e3a('0x12')];this[_0x9e3a('0x13')]=_0x3e10f[_0x9e3a('0x13')];this[_0x9e3a('0x15')]=_0x436482[_0x9e3a('0x15')];this['calleridname']=_0x3e10f[_0x9e3a('0x16')];this[_0x9e3a('0x17')]=_0x3e10f['number'];this[_0x9e3a('0x18')]=_0x3e10f[_0x9e3a('0x18')];this[_0x9e3a('0x19')]=_0x3e10f[_0x9e3a('0x19')];this[_0x9e3a('0x1a')]=moment()[_0x9e3a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x3e10f['responsetime'],_0x3e10f[_0x9e3a('0x18')]);this[_0x9e3a('0x1c')]=0x0;this[_0x9e3a('0x1d')]=getSeconds(this[_0x9e3a('0x1a')],_0x3e10f[_0x9e3a('0x19')]);this[_0x9e3a('0x1e')]=_0x3e10f[_0x9e3a('0x1e')];this[_0x9e3a('0x1f')]=_0x9e3a('0x20');this[_0x9e3a('0x21')]=_0x436482[_0x9e3a('0x22')];this['callback']=_0x3e10f[_0x9e3a('0x23')];this[_0x9e3a('0x24')]=_0x3e10f[_0x9e3a('0x24')];this[_0x9e3a('0x25')]=_0x3e10f['callbackat'];this[_0x9e3a('0x26')]=_0x3e10f[_0x9e3a('0x26')];this[_0x9e3a('0x27')]=_0x3e10f[_0x9e3a('0x27')];this[_0x9e3a('0x28')]=_0x3e10f[_0x9e3a('0x28')];this[_0x9e3a('0x29')]=_0x3e10f[_0x9e3a('0x29')];this[_0x9e3a('0x2a')]=_0x3e10f[_0x9e3a('0x2a')];this[_0x9e3a('0x2b')]=_0x3e10f['CampaignId'];}module[_0x9e3a('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 5b2c9ab..a100fac 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd99b=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x3765a7,_0x328a44){var _0x154834=function(_0x5024c2){while(--_0x5024c2){_0x3765a7['push'](_0x3765a7['shift']());}};_0x154834(++_0x328a44);}(_0xd99b,0x11e));var _0xbd99=function(_0x32b066,_0x8c6b13){_0x32b066=_0x32b066-0x0;var _0x34c871=_0xd99b[_0x32b066];return _0x34c871;};'use strict';var util=require(_0xbd99('0x0'));var _=require(_0xbd99('0x1'));var moment=require(_0xbd99('0x2'));function getSeconds(_0x25a3d5,_0x4c3e1a){var _0x44b65e=moment(_0x25a3d5)[_0xbd99('0x3')](0x0);var _0x5237f8=moment(_0x4c3e1a)[_0xbd99('0x3')](0x0);return _0x44b65e[_0xbd99('0x4')](_0x5237f8,_0xbd99('0x5'));}function History(_0x459c24){this['uniqueid']=_0x459c24[_0xbd99('0x6')];this[_0xbd99('0x7')]=_0x459c24[_0xbd99('0x7')]||undefined;this[_0xbd99('0x8')]=_0x459c24[_0xbd99('0x8')];this[_0xbd99('0x9')]=_0x459c24[_0xbd99('0x8')]===_0xbd99('0xa')?_0xbd99('0xb'):_0x459c24[_0xbd99('0x8')];this[_0xbd99('0xc')]=_0x459c24[_0xbd99('0xc')];this[_0xbd99('0xd')]=_0x459c24['countcongestionretry'];this[_0xbd99('0xe')]=_0x459c24['countnoanswerretry'];this[_0xbd99('0xf')]=_0x459c24[_0xbd99('0xc')]+_0x459c24[_0xbd99('0xd')]+_0x459c24[_0xbd99('0xe')]+_0x459c24[_0xbd99('0x10')]+_0x459c24[_0xbd99('0x11')]+_0x459c24['countabandonedretry']+_0x459c24['countmachineretry']+_0x459c24[_0xbd99('0x12')];this[_0xbd99('0x10')]=_0x459c24['countnosuchnumberretry'];this[_0xbd99('0x11')]=_0x459c24[_0xbd99('0x11')];this[_0xbd99('0x13')]=_0x459c24[_0xbd99('0x13')];this['countmachineretry']=_0x459c24['countmachineretry'];this[_0xbd99('0x12')]=_0x459c24[_0xbd99('0x12')];this[_0xbd99('0xb')]=_0x459c24[_0xbd99('0xb')];this[_0xbd99('0x14')]=_0x459c24[_0xbd99('0x15')];this['calleridnum']=_0x459c24[_0xbd99('0x16')];this['starttime']=_0x459c24[_0xbd99('0x17')];this[_0xbd99('0x18')]=_0x459c24[_0xbd99('0x18')];this[_0xbd99('0x19')]=_0x459c24[_0xbd99('0x18')];this[_0xbd99('0x1a')]=getSeconds(_0x459c24[_0xbd99('0x18')],_0x459c24[_0xbd99('0x17')]);this[_0xbd99('0x1b')]=0x0;this[_0xbd99('0x1c')]=0x0;this[_0xbd99('0x1d')]=_0x459c24[_0xbd99('0x1d')];this[_0xbd99('0x1e')]=_0x459c24[_0xbd99('0x1e')];this[_0xbd99('0x1f')]=_0x459c24[_0xbd99('0x1f')];this[_0xbd99('0x20')]=_0x459c24[_0xbd99('0x20')];this[_0xbd99('0x21')]=_0x459c24[_0xbd99('0x21')];this[_0xbd99('0x22')]=_0x459c24[_0xbd99('0x22')];this[_0xbd99('0x23')]=_0x459c24[_0xbd99('0x23')];this[_0xbd99('0x24')]=_0x459c24['VoiceQueueId'];this[_0xbd99('0x25')]=_0x459c24[_0xbd99('0x25')];this[_0xbd99('0x26')]=_0x459c24[_0xbd99('0x26')]||'';this[_0xbd99('0x27')]=_0x459c24[_0xbd99('0x27')]||'';}module['exports']=History; \ No newline at end of file +var _0x3a7a=['callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x967e31,_0x5d2a4e){var _0x36aff5=function(_0x4a2f84){while(--_0x4a2f84){_0x967e31['push'](_0x967e31['shift']());}};_0x36aff5(++_0x5d2a4e);}(_0x3a7a,0xf3));var _0xa3a7=function(_0x1d3019,_0x8dbbd5){_0x1d3019=_0x1d3019-0x0;var _0x36458e=_0x3a7a[_0x1d3019];return _0x36458e;};'use strict';var util=require(_0xa3a7('0x0'));var _=require(_0xa3a7('0x1'));var moment=require(_0xa3a7('0x2'));function getSeconds(_0x2e83e5,_0xdb11f4){var _0x4e854a=moment(_0x2e83e5)['milliseconds'](0x0);var _0x2ff231=moment(_0xdb11f4)[_0xa3a7('0x3')](0x0);return _0x4e854a['diff'](_0x2ff231,_0xa3a7('0x4'));}function History(_0x1518c7){this[_0xa3a7('0x5')]=_0x1518c7[_0xa3a7('0x5')];this[_0xa3a7('0x6')]=_0x1518c7[_0xa3a7('0x6')]||undefined;this[_0xa3a7('0x7')]=_0x1518c7[_0xa3a7('0x7')];this[_0xa3a7('0x8')]=_0x1518c7[_0xa3a7('0x7')]===_0xa3a7('0x9')?'queue':_0x1518c7[_0xa3a7('0x7')];this[_0xa3a7('0xa')]=_0x1518c7[_0xa3a7('0xa')];this[_0xa3a7('0xb')]=_0x1518c7[_0xa3a7('0xb')];this[_0xa3a7('0xc')]=_0x1518c7[_0xa3a7('0xc')];this[_0xa3a7('0xd')]=_0x1518c7[_0xa3a7('0xa')]+_0x1518c7['countcongestionretry']+_0x1518c7[_0xa3a7('0xc')]+_0x1518c7[_0xa3a7('0xe')]+_0x1518c7[_0xa3a7('0xf')]+_0x1518c7[_0xa3a7('0x10')]+_0x1518c7[_0xa3a7('0x11')]+_0x1518c7[_0xa3a7('0x12')];this[_0xa3a7('0xe')]=_0x1518c7[_0xa3a7('0xe')];this[_0xa3a7('0xf')]=_0x1518c7[_0xa3a7('0xf')];this['countabandonedretry']=_0x1518c7[_0xa3a7('0x10')];this[_0xa3a7('0x11')]=_0x1518c7[_0xa3a7('0x11')];this[_0xa3a7('0x12')]=_0x1518c7[_0xa3a7('0x12')];this[_0xa3a7('0x13')]=_0x1518c7[_0xa3a7('0x13')];this[_0xa3a7('0x14')]=_0x1518c7[_0xa3a7('0x15')];this['calleridnum']=_0x1518c7[_0xa3a7('0x16')];this[_0xa3a7('0x17')]=_0x1518c7[_0xa3a7('0x17')];this[_0xa3a7('0x18')]=_0x1518c7[_0xa3a7('0x18')];this[_0xa3a7('0x19')]=_0x1518c7['responsetime'];this[_0xa3a7('0x1a')]=getSeconds(_0x1518c7[_0xa3a7('0x18')],_0x1518c7[_0xa3a7('0x17')]);this[_0xa3a7('0x1b')]=0x0;this[_0xa3a7('0x1c')]=0x0;this[_0xa3a7('0x1d')]=_0x1518c7[_0xa3a7('0x1d')];this['callbackuniqueid']=_0x1518c7[_0xa3a7('0x1e')];this[_0xa3a7('0x1f')]=_0x1518c7[_0xa3a7('0x1f')];this[_0xa3a7('0x20')]=_0x1518c7['recallme'];this['ContactId']=_0x1518c7['ContactId'];this[_0xa3a7('0x21')]=_0x1518c7['ListId'];this[_0xa3a7('0x22')]=_0x1518c7[_0xa3a7('0x22')];this[_0xa3a7('0x23')]=_0x1518c7[_0xa3a7('0x23')];this['CampaignId']=_0x1518c7['CampaignId'];this[_0xa3a7('0x24')]=_0x1518c7[_0xa3a7('0x24')]||'';this[_0xa3a7('0x25')]=_0x1518c7[_0xa3a7('0x25')]||'';}module[_0xa3a7('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 18a988a..abfb111 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 _0x1782=['unmonitored','syncVarSet','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','AMD','custom:amd','amd','[syncHangupInAMD][createHistory]','value','MACHINE','Machine','countmachineretry','countglobal','buildObj','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','emit','[syncAgentComplete][createHistory][0]','countdropretry','countabandonedretry','dialMachineMaxRetry','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','syncQueueMember','actionid','strategy','locked','paused','stateinterface','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','unlockRR','[booked][RR]','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','iftime\x20%s,%s','interval','content','indexOf','timezones','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','callerid','dialOriginateCallerIdNumber','TrunkBackup','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','substring','dialCutDigit','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','dialGlobalMaxRetry','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','booked','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','format','voice:queue:%s','ivr','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\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','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','Agent\x20Busy\x20Factor:\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','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','sequence','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','reachable','SIP/%s'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1782,0x13e));var _0x2178=function(_0x99079,_0x1183d5){_0x99079=_0x99079-0x0;var _0x566382=_0x1782[_0x99079];return _0x566382;};'use strict';var util=require(_0x2178('0x0'));var _=require('lodash');var BPromise=require(_0x2178('0x1'));var uuid=require(_0x2178('0x2'));var moment=require(_0x2178('0x3'));var rr=require('rr');var md5=require(_0x2178('0x4'));var Redis=require(_0x2178('0x5'));var ut=require('../preview/util/util');var config=require(_0x2178('0x6'));var logger=require(_0x2178('0x7'))('dialer');var loggerBooked=require('../../../config/logger')(_0x2178('0x8'));var loggerPredictive=require(_0x2178('0x7'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x2178('0x7'))(_0x2178('0x9'));var ami=require(_0x2178('0xa'));config[_0x2178('0xb')]=_[_0x2178('0xc')](config[_0x2178('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x2178('0xd'))(new Redis(config[_0x2178('0xb')]));var cmHopper=require(_0x2178('0xe'));var cmHopperHistory=require(_0x2178('0xf'));var cmHopperBlack=require(_0x2178('0x10'));var voiceQueueRt=require(_0x2178('0x11'));var Action=require(_0x2178('0x12'));var History=require(_0x2178('0x13'));var Final=require(_0x2178('0x14'));var AgentComplete=require(_0x2178('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x2178('0x16'));var ipAgi=process[_0x2178('0x17')]['XCALLY_IP_AGI']||_0x2178('0x18');var strategy={'rrmemory':_0x2178('0x19'),'roundrobin':_0x2178('0x1a')};var Sequence=function(){};Sequence[_0x2178('0x1b')][_0x2178('0x1c')]=function(_0x4ad093){this['tail']=this['tail']?this[_0x2178('0x1d')]['finally'](_0x4ad093):_0x4ad093();};function Dialer(_0x2bea9d,_0x46701e){this['sequence']=new Sequence();this['preview']=_0x46701e;this[_0x2178('0x1e')]=_0x2bea9d[_0x2178('0x1e')];this['campaigns']=_0x2bea9d[_0x2178('0x1f')];this[_0x2178('0x20')]=_0x2bea9d[_0x2178('0x20')];this[_0x2178('0x21')]=_0x2bea9d[_0x2178('0x21')];this[_0x2178('0x22')]=config[_0x2178('0x22')]||0x2;this[_0x2178('0x23')]={};this[_0x2178('0x24')]={};this[_0x2178('0x25')]={};this[_0x2178('0x26')]={};this[_0x2178('0x27')]={};this['startPredictive']={};this[_0x2178('0x28')]={};this[_0x2178('0x29')]={};this[_0x2178('0x2a')]={};this[_0x2178('0x2b')]={};ami['on'](_0x2178('0x2c'),this[_0x2178('0x2d')][_0x2178('0x2e')](this));ami['on'](_0x2178('0x2f'),this[_0x2178('0x30')][_0x2178('0x2e')](this));ami['on'](_0x2178('0x31'),this[_0x2178('0x32')][_0x2178('0x2e')](this));ami['on'](_0x2178('0x33'),this[_0x2178('0x34')][_0x2178('0x2e')](this));ami['on'](_0x2178('0x35'),this[_0x2178('0x9')][_0x2178('0x2e')](this));ami['on'](_0x2178('0x36'),this[_0x2178('0x37')][_0x2178('0x2e')](this));ami['on'](_0x2178('0x38'),this['syncNewExten'][_0x2178('0x2e')](this));ami['on'](_0x2178('0x39'),this['syncVarSet']['bind'](this));ami['on'](_0x2178('0x3a'),this['syncQueueMember'][_0x2178('0x2e')](this));ami['on'](_0x2178('0x3b'),this[_0x2178('0x3c')]['bind'](this));this['loopCampaigns']();this[_0x2178('0x3d')]();}function isNotNull(_0x30e02f){return _0x30e02f!==null&&!_[_0x2178('0x3e')](_0x30e02f);}function checkIsLoggedIn(_0x505cc3,_0x4baf93){return function(){if(_0x4baf93<=0x0){_0x505cc3[_0x2178('0x3f')]=_0x2178('0x40');throw _0x505cc3[_0x2178('0x41')]+_0x2178('0x42');}};}function isActive(_0x42fad2){return _0x42fad2;}function checkIsActive(_0x23cd38,_0x44b79d){return function(){if(!isActive(_0x44b79d)){_0x23cd38['message']=_0x2178('0x43');throw _0x23cd38[_0x2178('0x41')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4332ac){return function(){if(!isNotNull(_0x4332ac[_0x2178('0x44')])){_0x4332ac[_0x2178('0x3f')]=_0x2178('0x45');throw _0x4332ac['name']+_0x2178('0x46');}if(!isNotNull(_0x4332ac['Interval']['Intervals'])){_0x4332ac[_0x2178('0x3f')]=_0x2178('0x45');throw _0x4332ac[_0x2178('0x41')]+_0x2178('0x46');}if(!isNotNull(_[_0x2178('0x47')](_0x4332ac[_0x2178('0x44')][_0x2178('0x48')]))){_0x4332ac['message']=_0x2178('0x45');throw _0x4332ac['name']+_0x2178('0x46');}};}function msgResponse(_0xaa0a10,_0x4c1047,_0x44607b){return{'action':_0xaa0a10,'response':_0x4c1047,'message':_0x44607b,'stack':_0x44607b};}function myreject(_0x3196f5){return function(_0x10e293){return _0x3196f5(msgResponse(_0x2178('0x49'),_0x2178('0x4a'),JSON[_0x2178('0x4b')](_0x10e293)));};}function getSeconds(_0x322351,_0x5876d8){var _0x515696=moment(_0x322351)['milliseconds'](0x0);var _0x48dd90=moment(_0x5876d8)[_0x2178('0x4c')](0x0);return _0x515696[_0x2178('0x4d')](_0x48dd90,_0x2178('0x4e'));}function emit(_0x16bd22,_0x35fcb7,_0x482f8a){io['to'](_0x16bd22)['emit'](_0x35fcb7,_0x482f8a);}function emitVoiceQueueSummary(_0x578277){if(_0x578277['type']===_0x2178('0x4f')){var _0x6a430b={'id':_0x578277['id'],'name':_0x578277[_0x2178('0x41')],'strategy':_0x578277['strategy'],'answered':_0x578277[_0x2178('0x50')],'available':_0x578277[_0x2178('0x51')],'loggedIn':_0x578277[_0x2178('0x52')],'pTalking':_0x578277[_0x2178('0x53')],'sumBillable':_0x578277[_0x2178('0x54')],'sumDuration':_0x578277[_0x2178('0x55')],'sumHoldTime':_0x578277[_0x2178('0x56')]||0x0,'talking':_0x578277[_0x2178('0x57')],'total':_0x578277[_0x2178('0x58')],'type':_0x578277[_0x2178('0x59')],'unmanaged':_0x578277[_0x2178('0x5a')],'abandoned':_0x578277['abandoned'],'waiting':_0x578277[_0x2178('0x5b')],'loggedInDb':_0x578277[_0x2178('0x5c')],'dialActive':_0x578277[_0x2178('0x5d')],'dialMethod':_0x578277[_0x2178('0x5e')],'dialOriginateCallerIdName':_0x578277[_0x2178('0x5f')],'dialOriginateCallerIdNumber':_0x578277['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x578277[_0x2178('0x60')],'dialPrefix':_0x578277[_0x2178('0x61')],'outboundAnswerAgiCallsDay':_0x578277[_0x2178('0x62')],'outboundAnswerCallsDay':_0x578277[_0x2178('0x63')],'outboundBlacklistCallsDay':_0x578277[_0x2178('0x64')],'outboundBusyCallsDay':_0x578277[_0x2178('0x65')],'outboundCongestionCallsDay':_0x578277[_0x2178('0x66')],'outboundDropCallsDayACS':_0x578277[_0x2178('0x67')],'outboundDropCallsDayCallersExit':_0x578277[_0x2178('0x68')],'outboundDropCallsDayTimeout':_0x578277[_0x2178('0x69')],'outboundNoAnswerCallsDay':_0x578277[_0x2178('0x6a')],'outboundNoSuchCallsDay':_0x578277['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x578277[_0x2178('0x6b')],'outboundReCallsDay':_0x578277['outboundReCallsDay'],'outboundRejectCallsDay':_0x578277[_0x2178('0x6c')],'outboundUnknownCallsDay':_0x578277[_0x2178('0x6d')],'predictiveIntervalAnsweredCalls':_0x578277[_0x2178('0x6e')],'predictiveIntervalAvgHoldtime':_0x578277[_0x2178('0x6f')],'predictiveIntervalAvgTalktime':_0x578277[_0x2178('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x578277[_0x2178('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x578277[_0x2178('0x72')],'predictiveIntervalErlangCalls':_0x578277[_0x2178('0x73')],'predictiveIntervalErlangCallsDroppedCalls':_0x578277['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x578277[_0x2178('0x74')],'predictiveIntervalMultiplicativeFactor':_0x578277[_0x2178('0x75')],'predictiveIntervalPauses':_0x578277[_0x2178('0x76')],'predictiveIntervalAvailable':_0x578277[_0x2178('0x77')],'predictiveIntervalTotalCalls':_0x578277[_0x2178('0x78')],'message':_0x578277[_0x2178('0x3f')],'originated':_0x578277[_0x2178('0x79')],'erlangCalls':_0x578277[_0x2178('0x7a')],'erlangCallToSecond':_0x578277[_0x2178('0x7b')],'erlangAbandonmentRate':_0x578277[_0x2178('0x7c')],'erlangBusyFactor':_0x578277[_0x2178('0x7d')],'startPredictive':_0x578277[_0x2178('0x7e')],'startProgressive':_0x578277[_0x2178('0x28')]};if(_0x578277[_0x2178('0x7f')]){_0x6a430b[_0x2178('0x7f')]={'id':_0x578277['Trunk']['id'],'name':_0x578277[_0x2178('0x7f')]['name'],'active':_0x578277[_0x2178('0x7f')][_0x2178('0x80')],'callerid':_0x578277[_0x2178('0x7f')]['callerid']};}if(_0x578277[_0x2178('0x44')]){_0x6a430b[_0x2178('0x44')]={'id':_0x578277[_0x2178('0x44')]['id'],'name':_0x578277[_0x2178('0x44')][_0x2178('0x41')]};}var _0x5f150d=md5(JSON[_0x2178('0x4b')](_0x6a430b));if(_0x578277[_0x2178('0x4')]!==_0x5f150d){_0x578277[_0x2178('0x4')]=_0x5f150d;emit(util[_0x2178('0x81')](_0x2178('0x82'),_0x6a430b['name']),'voice_queue:save',_0x6a430b);}}}function emitCampaignSummary(_0x32f459){if(_0x32f459[_0x2178('0x59')]===_0x2178('0x83')){emit(util[_0x2178('0x81')]('campaign:ivr:%s',_0x32f459['name']),'campaign:save',_0x32f459);}}function checkGetDataPredictive(_0x370007){if(isNotNull(_0x370007)&&!_[_0x2178('0x47')](_0x370007)){loggerPredictive[_0x2178('0x84')](_0x2178('0x85'));loggerPredictive[_0x2178('0x84')](_0x2178('0x86'),_0x370007['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x2178('0x87'),_0x370007[_0x2178('0x6e')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x370007['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x2178('0x84')](_0x2178('0x88'),_0x370007[_0x2178('0x71')]);loggerPredictive[_0x2178('0x84')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x370007['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x2178('0x84')](_0x2178('0x89'),_0x370007[_0x2178('0x70')]);loggerPredictive[_0x2178('0x84')](_0x2178('0x8a'));if(_0x370007[_0x2178('0x78')]>0x0){if(!_['isUndefined'](_0x370007[_0x2178('0x70')])&&_0x370007['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x370007[_0x2178('0x6f')])&&_0x370007['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x2178('0x84')](_0x2178('0x8b'));}else{loggerPredictive[_0x2178('0x84')](_0x2178('0x8c'));}}else{loggerPredictive[_0x2178('0x84')](_0x2178('0x8d'));}return![];}function mergeDataErlangB(_0x1cfe51){return function(_0x4ee12a){loggerPredictive[_0x2178('0x84')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x2178('0x8e'),_0x4ee12a[_0x2178('0x7a')]);loggerPredictive[_0x2178('0x84')](_0x2178('0x8f'),_0x4ee12a[_0x2178('0x7b')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ee12a[_0x2178('0x7c')]);loggerPredictive[_0x2178('0x84')](_0x2178('0x90'),_0x4ee12a[_0x2178('0x7d')]);loggerPredictive['info'](_0x2178('0x91'),_0x4ee12a[_0x2178('0x7c')]);loggerPredictive['info']('---------------------------');_[_0x2178('0x92')](_0x1cfe51,_0x4ee12a);};}function getDiff(_0xbf383f){var _0x40a65f=moment()['milliseconds'](0x0);var _0x482ed4=moment(_0xbf383f)[_0x2178('0x4c')](0x0);return _0x40a65f[_0x2178('0x4d')](_0x482ed4,_0x2178('0x4e'));}function ifInterval(_0x11ee5a,_0x986486){if(_[_0x2178('0x3e')](_0x986486)){return![];}return getDiff(_0x986486)<_0x11ee5a*0x3c;}function freeVariablesPredictive(_0x25685e){if(isNotNull(_0x25685e)){if(!_['isUndefined'](_0x25685e[_0x2178('0x28')])){_0x25685e[_0x2178('0x28')]=undefined;loggerPredictive[_0x2178('0x84')](_0x25685e['name'],_0x2178('0x93'));}if(!_[_0x2178('0x3e')](_0x25685e[_0x2178('0x7e')])){_0x25685e[_0x2178('0x7e')]=undefined;loggerPredictive[_0x2178('0x84')](_0x25685e[_0x2178('0x41')],_0x2178('0x94'));}if(!_[_0x2178('0x3e')](_0x25685e['handlePredictive'])){clearInterval(_0x25685e['handlePredictive']);_0x25685e[_0x2178('0x95')]=undefined;loggerPredictive['info'](_0x25685e[_0x2178('0x41')],_0x2178('0x96'));}}}function erlangb(_0x3b249a,_0x137dad){if(_0x137dad===0x0){return 0x0;}var _0xb3f299=0x1;for(var _0x480275=0x1;_0x480275<=_0x137dad;_0x480275+=0x1){_0xb3f299=0x1+_0xb3f299*_0x480275/_0x3b249a;}return 0x1/_0xb3f299;}function isVoiceQueueOutbound(_0xf7aa31){return _0xf7aa31===_0x2178('0x4f');}function isNotPreview(_0x3ab061){return _0x3ab061!==_0x2178('0x97');}function isCampaignIvr(_0x1ac8c0){return _0x1ac8c0==='ivr';}function getCallerId(_0x39bf9f,_0x4c7b7f,_0x4060bf){if(!_['isUndefined'](_0x4060bf)&&typeof _0x4060bf===_0x2178('0x98')&&!_['isEmpty'](_0x4060bf)){if(!_[_0x2178('0x3e')](_0x4c7b7f)&&typeof _0x4c7b7f===_0x2178('0x98')&&!_[_0x2178('0x47')](_0x4c7b7f)){return util[_0x2178('0x81')](_0x2178('0x99'),_0x4c7b7f,_0x4060bf);}return util[_0x2178('0x81')](_0x2178('0x99'),_0x4060bf,_0x4060bf);}if(!_[_0x2178('0x3e')](_0x39bf9f)&&typeof _0x39bf9f==='string'&&!_['isEmpty'](_0x39bf9f)){return _0x39bf9f;}return _0x2178('0x9a');}function loggerCatchQueueSummary(_0x2b9292,_0x513127){return function(_0x487b64){freeVariablesPredictive(_0x513127);emitVoiceQueueSummary(_0x513127);emitCampaignSummary(_0x513127);loggerSyncQueueSummary[_0x2178('0x9b')](_0x2b9292,util['inspect'](_0x487b64,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x59d580,_0x46c467){return function(_0x2e65aa){loggerPredictive[_0x2178('0x9b')](_0x46c467[_0x2178('0x41')],_0x59d580);loggerPredictive[_0x2178('0x9b')](_0x2e65aa[_0x2178('0x9c')]);freeVariablesPredictive(_0x46c467);};}function loggerCatch(_0x429192){return function(_0x1121ca){logger[_0x2178('0x9b')](_0x429192,util[_0x2178('0x9d')](_0x1121ca,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x351bde){return _0x351bde&&!_[_0x2178('0x3e')](_0x351bde)&&_0x351bde[_0x2178('0x9e')]>0x0;}function decremetOriginate(_0x34d5e8){if(!_['isUndefined'](_0x34d5e8)&&_0x34d5e8!==null){if(typeof _0x34d5e8[_0x2178('0x79')]!==_0x2178('0x9f')){if(_0x34d5e8['originated']>0x0){_0x34d5e8[_0x2178('0x79')]-=0x1;}else{logger['error'](_0x2178('0xa0'));}}}else{logger[_0x2178('0x9b')](_0x2178('0xa1'));}}function checkContactLowerLimitOriginate(_0x56a7c7,_0x849a9c,_0x5fea42){if(_0x849a9c>_0x5fea42){for(var _0x5af89e=0x0;_0x5af89e<_0x849a9c-_0x5fea42;_0x5af89e+=0x1){decremetOriginate(_0x56a7c7);}}}function loggerGetContactDialer(_0x11c825,_0x3c7f65,_0x16d575){return function(_0x43a937){checkContactLowerLimitOriginate(_0x3c7f65,_0x16d575,0x0);logger['error'](_0x11c825,util[_0x2178('0x9d')](_0x43a937,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2dd2bb){return function(_0x5e7525){if(isNotNull(_0x5e7525)&&isNotNull(_0x5e7525[0x0])){if(_0x5e7525[0x0][_0x2178('0xa2')]>0x0){_0x2dd2bb[_0x2178('0x3f')]=_0x2178('0xa3');logger[_0x2178('0x84')](_0x2178('0xa4')+_0x2dd2bb['name'],_0x5e7525[0x0]['contactsRescheduled'],_0x2178('0xa5'));}else{_0x2dd2bb['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x2178('0xa6')+_0x2dd2bb['name']);}}};}function notSendMessagesQueue(_0x46a2c7){if(_0x46a2c7[_0x2178('0xa7')]){freeVariablesPredictive(_0x46a2c7);if(_0x46a2c7[_0x2178('0x79')]===0x0&&_0x46a2c7[_0x2178('0x57')]===0x0&&_0x46a2c7[_0x2178('0x5b')]===0x0&&(_0x46a2c7[_0x2178('0x53')]||0x0)===0x0){_0x46a2c7['sendMessageOneNotActive']=![];_0x46a2c7[_0x2178('0x51')]=0x0;_0x46a2c7[_0x2178('0x3f')]=_0x2178('0x43');loggerSyncQueueSummary[_0x2178('0x9b')](_0x2178('0xa8'),_0x46a2c7['name'],_0x2178('0xa9'));}else{_0x46a2c7[_0x2178('0x3f')]=_0x2178('0xaa');loggerSyncQueueSummary[_0x2178('0x9b')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x46a2c7[_0x2178('0x41')],_0x2178('0xab'));}emitVoiceQueueSummary(_0x46a2c7);}}function notSendMessagesCampaign(_0x249daa){if(_0x249daa['sendMessageOneNotActive']){if(_0x249daa['originated']===0x0){_0x249daa[_0x2178('0xa7')]=![];_0x249daa[_0x2178('0x3f')]=_0x2178('0x43');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x249daa[_0x2178('0x41')],_0x2178('0xa9'));}else{_0x249daa[_0x2178('0x3f')]=_0x2178('0xaa');loggerSyncQueueSummary[_0x2178('0x9b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x249daa[_0x2178('0x41')],_0x2178('0xab'));}emitCampaignSummary(_0x249daa);}}function createObjHistory(_0x458d3d,_0x5851,_0x46a9d9,_0x46a515,_0x24e184){_0x458d3d[_0x2178('0x3f')]=_0x46a9d9;var _0xc0038c=new Action(_0x458d3d,_0x5851);var _0x4b9e62=new History(_0xc0038c);_0x4b9e62[_0x2178('0xac')]=_0x46a515;_0x4b9e62[_0x2178('0xad')]=_0x24e184;_0x4b9e62[_0x2178('0xae')]=_0xc0038c[_0x2178('0xaf')];return _0x4b9e62;}Dialer[_0x2178('0x1b')][_0x2178('0x3d')]=function(){var _0x1148a6=this;setInterval(function(){_0x1148a6['clearZombieChannels'](_0x1148a6['uniqueId'],'[uniqueid]');_0x1148a6[_0x2178('0xb0')](_0x1148a6[_0x2178('0x24')],'[actions]');},0x32c8);};Dialer[_0x2178('0x1b')][_0x2178('0xb0')]=function(_0x254f72,_0x367b1d){var _0x3566e1=this;for(var _0x28e1d7 in _0x254f72){if(typeof _0x254f72[_0x28e1d7]!==_0x2178('0x9f')){this[_0x2178('0xb1')][_0x2178('0x1c')](function(){if(!_[_0x2178('0xb2')](_0x254f72[_0x28e1d7])){return ami[_0x2178('0xb3')]({'action':_0x2178('0xb4'),'channel':_0x254f72[_0x28e1d7][_0x2178('0xb5')]})[_0x2178('0xb6')](function(_0x480e4c){if(_0x480e4c[_0x2178('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x254f72[_0x28e1d7]&&_0x254f72[_0x28e1d7][_0x2178('0x59')]!==_0x2178('0x83')){_0x3566e1[_0x2178('0xb7')](_0x3566e1['voiceQueues'][_0x254f72[_0x28e1d7][_0x2178('0xb8')]]);logger[_0x2178('0x9b')]('[Dialer][checkChannel]',_0x367b1d,_0x28e1d7,_0x254f72[_0x28e1d7][_0x2178('0xb8')]);delete _0x254f72[_0x28e1d7];}if(_0x254f72[_0x28e1d7]&&_0x254f72[_0x28e1d7][_0x2178('0x59')]===_0x2178('0x83')){_0x3566e1[_0x2178('0xb7')](_0x3566e1[_0x2178('0x1f')][_0x254f72[_0x28e1d7][_0x2178('0xb8')]]);logger['error'](_0x2178('0xb9'),_0x367b1d,_0x28e1d7,_0x254f72[_0x28e1d7][_0x2178('0xb8')]);delete _0x254f72[_0x28e1d7];}},0x2328);}});}});}}};Dialer[_0x2178('0x1b')][_0x2178('0xba')]=function(_0x2775d9){return BPromise[_0x2178('0xbb')]()[_0x2178('0xbc')](cmHopper[_0x2178('0xba')](_0x2775d9))['catch'](loggerCatch(_0x2178('0xbd')));};Dialer[_0x2178('0x1b')][_0x2178('0xbe')]=function(_0x15d273){return BPromise[_0x2178('0xbb')]()[_0x2178('0xbc')](cmHopperBlack['checkIsBlackList'](_0x15d273))[_0x2178('0xb6')](loggerCatch(_0x2178('0xbf')));};Dialer['prototype'][_0x2178('0xc0')]=function(_0x977387){return BPromise[_0x2178('0xbb')]()[_0x2178('0xbc')](cmHopperBlack[_0x2178('0xc0')](_0x977387))[_0x2178('0xb6')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x2178('0x1b')][_0x2178('0xc1')]=function(_0xeb41ad){return BPromise[_0x2178('0xbb')]()[_0x2178('0xbc')](cmHopperHistory[_0x2178('0xc2')](_0xeb41ad))['catch'](loggerCatch(_0x2178('0xc3')));};Dialer['prototype'][_0x2178('0xc4')]=function(_0x32be8d){return BPromise['resolve']()[_0x2178('0xbc')](cmHopper[_0x2178('0xc4')](_0x32be8d))[_0x2178('0xb6')](loggerCatch(_0x2178('0xc5')));};Dialer['prototype'][_0x2178('0xc6')]=function(_0x33eaa8,_0x4c1fe5,_0x1dfce4){return BPromise[_0x2178('0xbb')]()['then'](cmHopper[_0x2178('0xc6')](_0x33eaa8,_0x4c1fe5,_0x1dfce4))[_0x2178('0xb6')](loggerCatch(_0x2178('0xc7')));};Dialer[_0x2178('0x1b')]['getContactDialer']=function(_0x431cb0,_0x1b004d,_0x16fa81,_0x32aa4e,_0xe31b40){return BPromise[_0x2178('0xbb')]()[_0x2178('0xbc')](cmHopper[_0x2178('0xc8')](_0x431cb0,_0x1b004d,_0x16fa81,_0x32aa4e))[_0x2178('0xb6')](function(_0x517716){_0xe31b40[_0x2178('0xc9')]-=_0x16fa81;_0xe31b40[_0x2178('0xc9')]=_0xe31b40[_0x2178('0xc9')]>0x0?_0xe31b40['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0x517716);});};Dialer[_0x2178('0x1b')][_0x2178('0xca')]=function(_0x4bebf9,_0x1d9605,_0x306326,_0x51b6df){return BPromise[_0x2178('0xbb')]()['then'](cmHopper[_0x2178('0xca')](_0x4bebf9,_0x1d9605,_0x306326))[_0x2178('0xb6')](function(_0x35beac){_0x51b6df['temp']-=_0x1d9605;_0x51b6df[_0x2178('0xc9')]=_0x51b6df['temp']>0x0?_0x51b6df[_0x2178('0xc9')]:0x0;loggerCatch(_0x2178('0xcb'))(_0x35beac);});};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x5098cd){return BPromise[_0x2178('0xbb')]()[_0x2178('0xbc')](voiceQueueRt[_0x2178('0xcc')](_0x5098cd))[_0x2178('0xb6')](loggerCatch(_0x2178('0xcd')));};Dialer[_0x2178('0x1b')][_0x2178('0xce')]=function(_0x4998e6){return BPromise[_0x2178('0xbb')]()[_0x2178('0xbc')](cmHopper[_0x2178('0xce')](_0x4998e6))[_0x2178('0xb6')](loggerCatch(_0x2178('0xcf')));};Dialer[_0x2178('0x1b')][_0x2178('0xd0')]=function(_0x3d2baa){return BPromise['resolve']()[_0x2178('0xbc')](cmHopperHistory['createHistory'](_0x3d2baa))[_0x2178('0xb6')](loggerCatch(_0x2178('0xd1')));};Dialer['prototype']['updateOriginated']=function(_0xb8f606){if(!_[_0x2178('0x3e')](_0xb8f606)&&_0xb8f606!==null){if(typeof _0xb8f606[_0x2178('0x79')]!==_0x2178('0x9f')){if(_0xb8f606[_0x2178('0x79')]>0x0){_0xb8f606[_0x2178('0x79')]-=0x1;}else{logger[_0x2178('0x9b')](_0x2178('0xd2'));}}}else{logger[_0x2178('0x9b')](_0x2178('0xd3'));}};Dialer['prototype'][_0x2178('0xd4')]=function(_0x50dc51,_0x2cca21){var _0x54b1e4=this;return function(_0x22f7b3){_0x54b1e4[_0x2178('0xb7')](_0x2cca21);logger[_0x2178('0x9b')](_0x50dc51,util[_0x2178('0x9d')](_0x22f7b3,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x2178('0xd5')]=function(_0x440641,_0x2ad88e,_0x1401cf){var _0x3a0df7={'state':0x19,'statedesc':'notFound'};this[_0x2178('0xb7')](_0x2ad88e);this[_0x2178('0xd6')](_['merge'](_0x3a0df7,_['pick'](_0x1401cf,[_0x2178('0xd7'),_0x2178('0xd8'),_0x2178('0xd9'),_0x2178('0xda'),_0x2178('0xdb')])),_0x2178('0xdc'),_0x2178('0xdd'));logger[_0x2178('0x9b')](_0x440641);};Dialer[_0x2178('0x1b')][_0x2178('0xde')]=function(_0x19c48c){return _0x19c48c===_0x2178('0xdf');};Dialer[_0x2178('0x1b')]['isTrunkReachable']=function(_0x5669ea){return!_[_0x2178('0x3e')](_0x5669ea)&&_0x5669ea&&!_[_0x2178('0x3e')](_0x5669ea[_0x2178('0x41')])&&!_[_0x2178('0x3e')](_0x5669ea[_0x2178('0x80')])&&_0x5669ea[_0x2178('0x80')]&&(this[_0x2178('0x21')][util['format']('SIP/%s',_0x5669ea[_0x2178('0x41')])][_0x2178('0xb4')]===_0x2178('0xe0')||this['trunks'][util[_0x2178('0x81')](_0x2178('0xe1'),_0x5669ea[_0x2178('0x41')])][_0x2178('0xb4')]===_0x2178('0xe2'));};Dialer[_0x2178('0x1b')][_0x2178('0xd6')]=function(_0x42b401,_0x2ee12a,_0x487bde){this[_0x2178('0xd0')](_0x42b401)[_0x2178('0xb6')](loggerCatch(_0x2ee12a));this[_0x2178('0xce')](_0x42b401)[_0x2178('0xb6')](loggerCatch(_0x487bde));};Dialer[_0x2178('0x1b')][_0x2178('0xe3')]=function(_0x3ad524){var _0x168b54=this[_0x2178('0x26')][_0x3ad524[_0x2178('0xe4')]];var _0x21caa7;if(!_[_0x2178('0xb2')](_0x3ad524)&&!_[_0x2178('0xb2')](_0x3ad524['variable'])&&!_['isNil'](_0x3ad524[_0x2178('0xe5')][_0x2178('0xe6')])&&_0x3ad524['exten']===_0x2178('0xe7')&&_0x168b54){if(_0x168b54[_0x2178('0x59')]!==_0x2178('0x83')&&this['voiceQueues'][_0x168b54[_0x2178('0xb8')]][_0x2178('0xe8')]&&_0x3ad524['value']===_0x2178('0xe9')){delete this[_0x2178('0x26')][_0x3ad524['uniqueid']];this[_0x2178('0xb7')](this[_0x2178('0x1e')][_0x168b54[_0x2178('0xb8')]]);this[_0x2178('0x1e')][_0x168b54[_0x2178('0xb8')]][_0x2178('0x63')]+=0x1;this[_0x2178('0x1e')][_0x168b54['queue']][_0x2178('0x62')]+=0x1;_0x21caa7=new Hangup(_0x168b54,_0x3ad524);_0x21caa7['state']=0x12;_0x21caa7['statedesc']=_0x2178('0xea');_0x21caa7[_0x2178('0xeb')]=_0x2178('0xec');ami['emit'](_0x2178('0xed'),ut['buildObj'](_0x21caa7,_0x2178('0xee')));this[_0x2178('0xd6')](_0x21caa7,_0x2178('0xef'),'[syncHangupInAMD]');}if(_0x168b54[_0x2178('0x59')]!==_0x2178('0x83')&&this[_0x2178('0x1e')][_0x168b54[_0x2178('0xb8')]][_0x2178('0xe8')]&&_0x3ad524[_0x2178('0xf0')]===_0x2178('0xf1')){var _0x218057=this;return new BPromise(function(_0x4c9880,_0x10e7f6){delete _0x218057[_0x2178('0x26')][_0x3ad524[_0x2178('0xe4')]];_0x218057[_0x2178('0xb7')](_0x218057['voiceQueues'][_0x168b54[_0x2178('0xb8')]]);_0x218057[_0x2178('0x1e')][_0x168b54[_0x2178('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0x218057[_0x2178('0x1e')][_0x168b54[_0x2178('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x258402=_0x218057[_0x2178('0x1e')][_0x168b54['queue']];var _0x3b9d5e=new Hangup(_0x168b54,_0x3ad524);_0x3b9d5e['state']=0x13;_0x3b9d5e['statedesc']=_0x2178('0xf2');_0x3b9d5e['membername']='AMD';_0x3b9d5e[_0x2178('0xf3')]+=0x1;_0x3b9d5e[_0x2178('0xf4')]+=0x1;_0x3b9d5e[_0x2178('0xee')]=!![];ami['emit']('custom:amd',ut[_0x2178('0xf5')](_0x3b9d5e,_0x2178('0xee')));_0x218057['createHistory'](_0x3b9d5e)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3b9d5e[_0x2178('0xf6')]+_0x3b9d5e[_0x2178('0xf7')]+_0x3b9d5e[_0x2178('0xf8')]+_0x3b9d5e[_0x2178('0xf9')]+_0x3b9d5e['countdropretry']+_0x3b9d5e['countabandonedretry']+_0x3b9d5e[_0x2178('0xf3')]+_0x3b9d5e[_0x2178('0xfa')]>=_0x258402['dialGlobalMaxRetry']){_0x218057[_0x2178('0xfb')](_0x3b9d5e,_0x4c9880,_0x10e7f6,_0x2178('0xfc'));}else{if(_0x3b9d5e[_0x2178('0xf3')]>=_0x258402['dialMachineMaxRetry']){_0x218057['createStateFinal'](_0x3b9d5e,_0x4c9880,_0x10e7f6,_0x2178('0xfd'));}else{_0x218057[_0x2178('0xc4')]({'active':![],'countmachineretry':_0x3b9d5e[_0x2178('0xf3')],'scheduledat':moment()[_0x2178('0xfe')](_0x258402[_0x2178('0xff')],_0x2178('0x100'))[_0x2178('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b9d5e['ContactId'],'ListId':_0x3b9d5e[_0x2178('0xd8')],'VoiceQueueId':_0x3b9d5e['VoiceQueueId']||undefined,'CampaignId':_0x3b9d5e[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x101')));_0x4c9880({'reschedule':0x1});}}});}if(_0x168b54[_0x2178('0x59')]==='ivr'&&this[_0x2178('0x1f')][_0x168b54[_0x2178('0xb8')]][_0x2178('0xe8')]&&_0x3ad524[_0x2178('0xf0')]===_0x2178('0xe9')){delete this[_0x2178('0x26')][_0x3ad524[_0x2178('0xe4')]];this['updateOriginated'](this['campaigns'][_0x168b54[_0x2178('0xb8')]]);_0x21caa7=new Hangup(_0x168b54,_0x3ad524);_0x21caa7[_0x2178('0xac')]=0x12;_0x21caa7[_0x2178('0xad')]=_0x2178('0xea');_0x21caa7[_0x2178('0xeb')]=_0x2178('0xec');ami['emit'](_0x2178('0xed'),ut[_0x2178('0xf5')](_0x21caa7,'amd'));this[_0x2178('0xd6')](_0x21caa7,_0x2178('0x102'),_0x2178('0x103'));}if(_0x168b54['type']===_0x2178('0x83')&&this[_0x2178('0x1f')][_0x168b54['queue']]['dialAMDActive']&&_0x3ad524['value']===_0x2178('0xf1')){var _0x218057=this;return new BPromise(function(_0x25f216,_0x310c70){delete _0x218057[_0x2178('0x26')][_0x3ad524[_0x2178('0xe4')]];_0x218057[_0x2178('0xb7')](_0x218057[_0x2178('0x1f')][_0x168b54[_0x2178('0xb8')]]);_0x218057[_0x2178('0x1f')][_0x168b54['queue']][_0x2178('0x63')]+=0x1;_0x218057[_0x2178('0x1f')][_0x168b54[_0x2178('0xb8')]][_0x2178('0x62')]+=0x1;var _0x5753cc=_0x218057['campaigns'][_0x168b54['queue']];var _0x1073ee=new Hangup(_0x168b54,_0x3ad524);_0x1073ee[_0x2178('0xac')]=0x13;_0x1073ee[_0x2178('0xad')]=_0x2178('0xf2');_0x1073ee[_0x2178('0xeb')]=_0x2178('0xec');_0x1073ee[_0x2178('0xf3')]+=0x1;_0x1073ee['countglobal']+=0x1;_0x1073ee['amd']=!![];ami[_0x2178('0x104')]('custom:amd',ut[_0x2178('0xf5')](_0x1073ee,_0x2178('0xee')));_0x218057['createHistory'](_0x1073ee)[_0x2178('0xb6')](loggerCatch(_0x2178('0x105')));if(_0x1073ee[_0x2178('0xf6')]+_0x1073ee['countcongestionretry']+_0x1073ee[_0x2178('0xf8')]+_0x1073ee[_0x2178('0xf9')]+_0x1073ee[_0x2178('0x106')]+_0x1073ee[_0x2178('0x107')]+_0x1073ee[_0x2178('0xf3')]+_0x1073ee['countagentrejectretry']>=_0x5753cc['dialGlobalMaxRetry']){_0x218057['stateGlobal'](_0x1073ee,_0x25f216,_0x310c70,'reason19\x20machine....');}else{if(_0x1073ee[_0x2178('0xf3')]>=_0x5753cc[_0x2178('0x108')]){_0x218057['createStateFinal'](_0x1073ee,_0x25f216,_0x310c70,'reason\x2019\x20machine....');}else{_0x218057[_0x2178('0xc4')]({'active':![],'countmachineretry':_0x1073ee['countmachineretry'],'scheduledat':moment()[_0x2178('0xfe')](_0x5753cc['dialMachineRetryFrequency'],_0x2178('0x100'))['format'](_0x2178('0x109')),'ContactId':_0x1073ee[_0x2178('0xd7')],'ListId':_0x1073ee['ListId'],'VoiceQueueId':_0x1073ee[_0x2178('0xda')]||undefined,'CampaignId':_0x1073ee[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch('[rescheduleContact][Machine]'));_0x25f216({'reschedule':0x1});}}});}}};Dialer[_0x2178('0x1b')][_0x2178('0x37')]=function(_0x19befc){var _0x2e9bdc=this[_0x2178('0x26')][_0x19befc[_0x2178('0xe4')]];var _0x386599=this;var _0x488830;if(_0x2e9bdc&&_0x2e9bdc['type']===_0x2178('0x83')){delete this[_0x2178('0x26')][_0x19befc[_0x2178('0xe4')]];this[_0x2178('0xb7')](this[_0x2178('0x1f')][_0x2e9bdc[_0x2178('0xb8')]]);this[_0x2178('0x1f')][_0x2e9bdc[_0x2178('0xb8')]][_0x2178('0x10a')]+=0x1;_0x488830=new Hangup(_0x2e9bdc,_0x19befc);this['createHistory'](_0x488830)['catch'](loggerCatch(_0x2178('0x10b')));this[_0x2178('0xce')](_0x488830)[_0x2178('0xb6')](loggerCatch('[syncHangupIvr]'));}if(_0x2e9bdc&&_0x2e9bdc[_0x2178('0x59')]!=='ivr'&&isNotNull(this[_0x2178('0x1e')][_0x2e9bdc[_0x2178('0xb8')]][_0x2178('0x10c')])){delete this[_0x2178('0x26')][_0x19befc[_0x2178('0xe4')]];this[_0x2178('0xb7')](this['voiceQueues'][_0x2e9bdc[_0x2178('0xb8')]]);this[_0x2178('0x1e')][_0x2e9bdc[_0x2178('0xb8')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x2e9bdc[_0x2178('0xb8')]][_0x2178('0x62')]+=0x1;_0x488830=new Hangup(_0x2e9bdc,_0x19befc);_0x488830['state']=0x10;_0x488830[_0x2178('0xad')]=_0x2178('0x10d');_0x488830[_0x2178('0xeb')]='AGI';this[_0x2178('0xd0')](_0x488830)[_0x2178('0xb6')](loggerCatch(_0x2178('0x10b')));this['moveContactManagedDialer'](_0x488830)[_0x2178('0xb6')](loggerCatch('[syncHangupIvr]'));}if(_0x2e9bdc&&_0x2e9bdc['type']!=='ivr'&&!isNotNull(this[_0x2178('0x1e')][_0x2e9bdc['queue']]['dialQueueProject'])){delete this[_0x2178('0x26')][_0x19befc[_0x2178('0xe4')]];this['updateOriginated'](this[_0x2178('0x1e')][_0x2e9bdc[_0x2178('0xb8')]]);this[_0x2178('0x1e')][_0x2e9bdc['queue']]['outboundUnknownCallsDay']+=0x1;_0x488830=new Hangup(_0x2e9bdc,_0x19befc);_0x488830[_0x2178('0xac')]=0xc;_0x488830[_0x2178('0xad')]=_0x19befc[_0x2178('0x10e')];_0x488830[_0x2178('0xeb')]=_0x2178('0x10f');this['createHistory'](_0x488830)[_0x2178('0xb6')](loggerCatch(_0x2178('0x10b')));this['moveContactManagedDialer'](_0x488830)[_0x2178('0xb6')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x2178('0x1b')][_0x2178('0x34')]=function(_0x58413c){var _0xb53e75=this[_0x2178('0x26')][_0x58413c['uniqueid']];var _0x56e45f=this;if(this[_0x2178('0x1e')][_0x58413c[_0x2178('0xb8')]]){if(_0xb53e75&&_0xb53e75[_0x2178('0x59')]!==_0x2178('0x83')){delete this[_0x2178('0x26')][_0x58413c['uniqueid']];this[_0x2178('0x1e')][_0x58413c[_0x2178('0xb8')]]['outboundAnswerCallsDay']+=0x1;var _0x2e6c7e=new AgentComplete(_0xb53e75,_0x58413c);if(_0x58413c[_0x2178('0x110')]===_0x2178('0x111')){_0x2e6c7e[_0x2178('0x112')]=this[_0x2178('0x1e')][_0x58413c['queue']][_0x2178('0x113')]&&this[_0x2178('0x1e')][_0x58413c[_0x2178('0xb8')]][_0x2178('0x114')]?moment()[_0x2178('0x81')](_0x2178('0x109')):undefined;}this[_0x2178('0xd0')](_0x2e6c7e)[_0x2178('0xb6')](loggerCatch(_0x2178('0x115')));this[_0x2178('0xce')](_0x2e6c7e)[_0x2178('0xb6')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x2178('0x1b')]['syncAgentConnect']=function(_0xe1ae61){if(this[_0x2178('0x1e')][_0xe1ae61[_0x2178('0xb8')]]){if(this['uniqueId'][_0xe1ae61[_0x2178('0xe4')]]&&this['uniqueId'][_0xe1ae61[_0x2178('0xe4')]]['type']!==_0x2178('0x83')){this[_0x2178('0xb7')](this[_0x2178('0x1e')][_0xe1ae61[_0x2178('0xb8')]]);this[_0x2178('0x26')][_0xe1ae61[_0x2178('0xe4')]]['answertime']=moment()['format'](_0x2178('0x109'));}}};Dialer[_0x2178('0x1b')][_0x2178('0x116')]=function(_0xb32e29){this[_0x2178('0xd0')](_0xb32e29)['catch'](loggerCatch(_0x2178('0x115')));this[_0x2178('0xce')](_0xb32e29)['catch'](loggerCatch(_0x2178('0x117')));};Dialer[_0x2178('0x1b')][_0x2178('0x30')]=function(_0x2cc3aa){var _0x4cb4ac=this[_0x2178('0x26')][_0x2cc3aa['uniqueid']];var _0x46d9c6=this;if(this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]]){if(_0x4cb4ac&&_0x4cb4ac[_0x2178('0x59')]!==_0x2178('0x83')){delete this['uniqueId'][_0x2cc3aa[_0x2178('0xe4')]];this['updateOriginated'](this['voiceQueues'][_0x2cc3aa[_0x2178('0xb8')]]);_0x4cb4ac[_0x2178('0x118')]=moment()[_0x2178('0x81')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4c0219=new QueueCallerAbandon(_0x4cb4ac,_0x2cc3aa);if(getSeconds(_0x4cb4ac[_0x2178('0x118')],_0x4cb4ac['responsetime'])>=_0x4cb4ac[_0x2178('0x119')]){this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]][_0x2178('0x72')]+=0x1;this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]][_0x2178('0x69')]+=0x1;this['voiceQueues'][_0x2cc3aa[_0x2178('0xb8')]][_0x2178('0x11a')]+=0x1;_0x4c0219['state']=0xa;_0x4c0219['statedesc']='Drop';_0x4c0219[_0x2178('0x11b')]=_0x2178('0x11c');_0x4c0219[_0x2178('0x112')]=this[_0x2178('0x1e')][_0x2cc3aa['queue']][_0x2178('0x113')]?moment()[_0x2178('0x81')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4c0219[_0x2178('0x106')]+=0x1;_0x4c0219[_0x2178('0xf4')]+=0x1;if(_0x4c0219['countdropretry']>=this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]]['dialDropMaxRetry']){this['queueCallerAbandonCreateState'](_0x4c0219);}else{this[_0x2178('0xc4')]({'active':![],'countdropretry':_0x4c0219[_0x2178('0x106')],'scheduledat':moment()[_0x2178('0xfe')](this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]][_0x2178('0x11d')],_0x2178('0x100'))[_0x2178('0x81')](_0x2178('0x109')),'ContactId':_0x4cb4ac[_0x2178('0xd7')],'ListId':_0x4cb4ac[_0x2178('0xd8')],'VoiceQueueId':_0x4cb4ac[_0x2178('0xda')]||undefined,'CampaignId':_0x4cb4ac[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x11e')));var _0x4955dd=new History(_0x4c0219);_0x4955dd['state']=0xa;_0x4955dd[_0x2178('0xad')]='Drop';_0x4955dd[_0x2178('0xaf')]=moment()['format'](_0x2178('0x109'));_0x4955dd[_0x2178('0xae')]=_0x4955dd['starttime'];_0x4955dd[_0x2178('0x11f')]=_0x4c0219[_0x2178('0x11f')];_0x4955dd[_0x2178('0x120')]=_0x4c0219['calleridnum'];this[_0x2178('0xd0')](_0x4955dd)[_0x2178('0xb6')](loggerCatch(_0x2178('0x121')));}}else{this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]][_0x2178('0x71')]+=0x1;this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]][_0x2178('0x68')]+=0x1;_0x4c0219[_0x2178('0xac')]=0xb;_0x4c0219[_0x2178('0xad')]=_0x2178('0x122');_0x4c0219[_0x2178('0x11b')]='CALLEREXIT';_0x4c0219[_0x2178('0x107')]+=0x1;_0x4c0219[_0x2178('0xf4')]+=0x1;if(_0x4c0219[_0x2178('0x107')]>=this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]][_0x2178('0x123')]){this[_0x2178('0x116')](_0x4c0219);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x4c0219[_0x2178('0x107')],'scheduledat':moment()[_0x2178('0xfe')](this[_0x2178('0x1e')][_0x2cc3aa[_0x2178('0xb8')]][_0x2178('0x124')],_0x2178('0x100'))[_0x2178('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4cb4ac[_0x2178('0xd7')],'ListId':_0x4cb4ac[_0x2178('0xd8')],'VoiceQueueId':_0x4cb4ac[_0x2178('0xda')]||undefined,'CampaignId':_0x4cb4ac[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x125')));var _0x4955dd=new History(_0x4c0219);_0x4955dd[_0x2178('0xac')]=0xb;_0x4955dd[_0x2178('0xad')]=_0x2178('0x122');_0x4955dd['starttime']=moment()['format'](_0x2178('0x109'));_0x4955dd[_0x2178('0xae')]=_0x4955dd[_0x2178('0xaf')];_0x4955dd[_0x2178('0x11f')]=_0x4c0219['calleridname'];_0x4955dd['calleridnum']=_0x4c0219[_0x2178('0x120')];this[_0x2178('0xd0')](_0x4955dd)[_0x2178('0xb6')](loggerCatch(_0x2178('0x126')));}}}}};Dialer[_0x2178('0x1b')][_0x2178('0x127')]=function(_0x218f59){if(this[_0x2178('0x24')][_0x218f59['uniqueid']]){this['actions'][_0x218f59['uniqueid']][_0x2178('0xb5')]=_0x218f59['channel'];}if(this[_0x2178('0x26')][_0x218f59[_0x2178('0xe4')]]){this[_0x2178('0x26')][_0x218f59[_0x2178('0xe4')]]['channel']=_0x218f59[_0x2178('0xb5')];}};Dialer[_0x2178('0x1b')][_0x2178('0x128')]=function(_0x22e5a5){if(strategy[this[_0x2178('0x1e')][this[_0x2178('0x24')][_0x22e5a5[_0x2178('0x129')]][_0x2178('0xb8')]][_0x2178('0x12a')]]===_0x2178('0x1a')){if(this[_0x2178('0x24')][_0x22e5a5[_0x2178('0x129')]]&&_[_0x2178('0xb2')](this[_0x2178('0x24')][_0x22e5a5['actionid']][_0x2178('0x12b')])&&_0x22e5a5[_0x2178('0xb4')]==='1'&&_0x22e5a5[_0x2178('0x12c')]==='0'){if(this[_0x2178('0x20')][_0x22e5a5[_0x2178('0x12d')]]){if(!this['agents'][_0x22e5a5[_0x2178('0x12d')]][_0x2178('0x12b')]){this['agents'][_0x22e5a5[_0x2178('0x12d')]][_0x2178('0x12b')]=!![];this[_0x2178('0x24')][_0x22e5a5[_0x2178('0x129')]][_0x2178('0x12b')]=!![];this[_0x2178('0x24')][_0x22e5a5['actionid']]['stateinterface']=_0x22e5a5['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x2178('0x24')][_0x22e5a5['actionid']][_0x2178('0xb8')]][_0x2178('0x12a')]]||_0x2178('0x19'))===_0x2178('0x19')){if(this[_0x2178('0x24')][_0x22e5a5['actionid']]){if(this['agents'][_0x22e5a5[_0x2178('0x12d')]]){this[_0x2178('0x24')][_0x22e5a5[_0x2178('0x129')]][_0x2178('0x12d')]=_0x22e5a5[_0x2178('0x12d')];if(_[_0x2178('0xb2')](this[_0x2178('0x2a')][this[_0x2178('0x24')][_0x22e5a5['actionid']][_0x2178('0xb8')]])){this[_0x2178('0x2a')][this[_0x2178('0x24')][_0x22e5a5[_0x2178('0x129')]][_0x2178('0xb8')]]=[];}this[_0x2178('0x2a')][this[_0x2178('0x24')][_0x22e5a5[_0x2178('0x129')]][_0x2178('0xb8')]][_0x2178('0x12e')](_[_0x2178('0x92')](_[_0x2178('0x12f')](this[_0x2178('0x24')][_0x22e5a5['actionid']],[_0x2178('0x130'),_0x2178('0x12d')]),{'status':_0x22e5a5[_0x2178('0xb4')],'paused':_0x22e5a5[_0x2178('0x12c')]}));}}}};function unlockQueueStatus(_0x2c5746,_0x5bd7c6){setTimeout(function(){if(_[_0x2178('0x3e')](_0x2c5746[_0x2178('0x131')])){loggerBooked['error'](_0x2178('0x132'),_0x5bd7c6);}_0x2c5746['queueStatusComplete']=!![];loggerBooked[_0x2178('0x84')](_0x2178('0x133'),_0x5bd7c6,JSON[_0x2178('0x4b')](_[_0x2178('0x12f')](_0x2c5746,[_0x2178('0x41'),_0x2178('0x131')])));},0x1f3);}Dialer[_0x2178('0x1b')][_0x2178('0x3c')]=function(_0x44253a){var _0xb49e59=this;var _0x3b48cb=_0xb49e59[_0x2178('0x1e')][_0xb49e59[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xb8')]];if(strategy[this[_0x2178('0x1e')][this[_0x2178('0x24')][_0x44253a['actionid']][_0x2178('0xb8')]]['strategy']]===_0x2178('0x1a')){if(this['actions'][_0x44253a[_0x2178('0x129')]]&&this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]]['stateinterface']){this[_0x2178('0x97')][_0x2178('0x134')](this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0x130')],this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0x12d')])[_0x2178('0xb6')](function(_0x51c3c0){logger[_0x2178('0x9b')](_0x2178('0x135'),util[_0x2178('0x9d')](_0x51c3c0,{'showHidden':![],'depth':null}));})[_0x2178('0x136')](function(){_0xb49e59[_0x2178('0xb7')](_0xb49e59[_0x2178('0x1e')][_0xb49e59['actions'][_0x44253a['actionid']]['queue']]);_0xb49e59[_0x2178('0x20')][_0xb49e59['actions'][_0x44253a[_0x2178('0x129')]]['stateinterface']][_0x2178('0x12b')]=![];delete _0xb49e59[_0x2178('0x24')][_0x44253a['actionid']];unlockQueueStatus(_0x3b48cb);});}else{this[_0x2178('0xb7')](this[_0x2178('0x1e')][this['actions'][_0x44253a['actionid']][_0x2178('0xb8')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xd7')],'ListId':this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xd8')],'VoiceQueueId':this[_0x2178('0x24')][_0x44253a['actionid']][_0x2178('0xda')]||undefined,'CampaignId':this['actions'][_0x44253a[_0x2178('0x129')]][_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x137')));delete this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]];unlockQueueStatus(_0x3b48cb);}}else if((strategy[this[_0x2178('0x1e')][this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xb8')]][_0x2178('0x12a')]]||_0x2178('0x19'))==='rrmemory'){var _0x5ada41;if(this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]]&&!_[_0x2178('0x47')](this[_0x2178('0x2a')][this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xb8')]])){if(this[_0x2178('0x2b')][_0xb49e59['actions'][_0x44253a[_0x2178('0x129')]][_0x2178('0xb8')]]){this[_0x2178('0x2b')][_0xb49e59[_0x2178('0x24')][_0x44253a['actionid']][_0x2178('0xb8')]]=this[_0x2178('0x2b')][this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xb8')]]?this[_0x2178('0x2b')][this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]]['queue']]:this['queueBooked'][this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xb8')]]?this[_0x2178('0x2a')][this[_0x2178('0x24')][_0x44253a['actionid']][_0x2178('0xb8')]]['_rr']||0x0:0x0;}this[_0x2178('0x2a')][this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xb8')]]['_rr']=this[_0x2178('0x2b')][this[_0x2178('0x24')][_0x44253a[_0x2178('0x129')]][_0x2178('0xb8')]];for(var _0x446fe9=0x0;_0x446fe9=0x0;})[_0x2178('0xb6')](myreject(_0x84a5fd)));}}else{_0xe67091[_0x2178('0x12e')](ami['Action']({'action':'command','command':util[_0x2178('0x81')]('iftime\x20%s,%s',_0x24136d,!_[_0x2178('0x3e')](config[_0x2178('0x151')][_0x43c7e2])?_0x43c7e2:'')})[_0x2178('0xbc')](function(_0x167980){return _0x167980[_0x2178('0x14f')][_0x2178('0x150')](_0x2178('0x152'))>=0x0;})[_0x2178('0xb6')](myreject(_0x84a5fd)));}BPromise[_0x2178('0x153')](_0xe67091)[_0x2178('0xbc')](function(_0x4e2f99){var _0x22b2bd=_[_0x2178('0x154')](_0x4e2f99);if(_0x22b2bd){return _0x1b398b(_0x22b2bd);}else{_0x16b009[_0x2178('0x3f')]=_0xc833a8?_0x2178('0x155'):_0x2178('0x156');return _0x84a5fd(msgResponse(_0x2178('0x157'),_0x2178('0x147'),_0x2178('0x158')+_0xc833a8+'\x20'+_0x16d277+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2178('0x9d')](_0x24136d,{'showHidden':![],'depth':null})+_0x2178('0x159')+_0x43c7e2));}})[_0x2178('0xb6')](function(_0x37fca9){return _0x84a5fd(msgResponse('ifTime',_0x2178('0x147'),JSON[_0x2178('0x4b')](_0x37fca9)));});});};Dialer[_0x2178('0x1b')][_0x2178('0x15a')]=function(_0x5e0261){var _0x365e94=this;return function(){switch(_0x5e0261['dialMethod']){case _0x2178('0x15b'):freeVariablesPredictive(_0x5e0261);_0x365e94[_0x2178('0x15c')](_0x5e0261,0x1);break;case _0x2178('0x15d'):freeVariablesPredictive(_0x5e0261);_0x365e94['handlePower'](_0x5e0261,_0x5e0261['dialPowerLevel']);break;case'predictive':_0x365e94['predictive'](_0x5e0261);break;case _0x2178('0x8'):freeVariablesPredictive(_0x5e0261);_0x365e94['handlePower'](_0x5e0261,0x1);break;default:freeVariablesPredictive(_0x5e0261);logger[_0x2178('0x9b')]('Queue',_0x5e0261['name'],_0x2178('0x15e'));}};};Dialer[_0x2178('0x1b')][_0x2178('0x15f')]=function(_0x46d437){var _0x299a58=this;return function(){_0x299a58[_0x2178('0x160')](_0x46d437);};};Dialer[_0x2178('0x1b')][_0x2178('0x9')]=function(_0x58f303){var _0x900a79=this;if(isNotPreview(_0x58f303[_0x2178('0x5e')])){if(isVoiceQueueOutbound(_0x58f303[_0x2178('0x59')])&&isActive(_0x58f303[_0x2178('0x5d')])){_0x58f303[_0x2178('0xa7')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x58f303,_0x58f303['loggedIn']))[_0x2178('0xbc')](checkIsActive(_0x58f303,_0x58f303['dialActive']))[_0x2178('0xbc')](checkInterval(_0x58f303))[_0x2178('0xbc')](_0x900a79[_0x2178('0x161')](_0x58f303))[_0x2178('0xbc')](_0x900a79[_0x2178('0x144')](_0x58f303[_0x2178('0x162')],_0x58f303[_0x2178('0x163')],_0x58f303[_0x2178('0x41')],_0x58f303))[_0x2178('0xbc')](_0x900a79['checkIfTimeIntervals'](_0x58f303['Interval'],_0x58f303[_0x2178('0x163')],_0x58f303[_0x2178('0x41')],_0x58f303))[_0x2178('0xbc')](_0x900a79['checkDialMethod'](_0x58f303))[_0x2178('0xb6')](loggerCatchQueueSummary(_0x2178('0x164'),_0x58f303));}else{notSendMessagesQueue(_0x58f303);}}else{freeVariablesPredictive(_0x58f303);}};Dialer[_0x2178('0x1b')]['syncCampaigns']=function(){var _0x206b04=this;var _0x1d052a;for(var _0x2038d7 in this[_0x2178('0x1f')]){if(typeof this[_0x2178('0x1f')][_0x2038d7]!==_0x2178('0x9f')){_0x1d052a=this[_0x2178('0x1f')][_0x2038d7];if(isCampaignIvr(_0x1d052a[_0x2178('0x59')])&&isActive(_0x1d052a[_0x2178('0x80')])){_0x1d052a['sendMessageOneNotActive']=!![];BPromise[_0x2178('0xbb')]()[_0x2178('0xbc')](checkIsActive(_0x1d052a,_0x1d052a[_0x2178('0x80')]))[_0x2178('0xbc')](checkInterval(_0x1d052a))[_0x2178('0xbc')](_0x206b04[_0x2178('0x161')](_0x1d052a))[_0x2178('0xbc')](_0x206b04[_0x2178('0x144')](_0x1d052a[_0x2178('0x162')],_0x1d052a['dialTimezone'],_0x1d052a[_0x2178('0x41')],_0x1d052a))[_0x2178('0xbc')](_0x206b04[_0x2178('0x145')](_0x1d052a[_0x2178('0x44')],_0x1d052a[_0x2178('0x163')],_0x1d052a[_0x2178('0x41')],_0x1d052a))[_0x2178('0xbc')](_0x206b04[_0x2178('0x15f')](_0x1d052a))['catch'](loggerCatchQueueSummary(_0x2178('0x165'),_0x1d052a));}else{notSendMessagesCampaign(_0x1d052a);}}}};function getCallerIdRandom(_0x53d684,_0x2c036f){var _0x358b5b;var _0x11e4b8;var _0x471bbf;if(_0x2c036f<=0x0){_0x2c036f=0x1;}_0x358b5b=new RegExp(_0x2178('0x166')+_0x2c036f+'}$');_0x11e4b8=Math[_0x2178('0x167')](0xa,_0x2c036f-0x1);_0x471bbf=Math[_0x2178('0x167')](0xa,_0x2c036f)-0x1;return util[_0x2178('0x81')]('%s',_[_0x2178('0x168')](_0x53d684,_0x358b5b,_['random'](_0x11e4b8,_0x471bbf)));}function extractCalleridName(_0x127484){var _0x539a3a=_0x127484['match'](/"(.*?)"/);return _0x539a3a?_0x539a3a[0x1]:_0x127484;}function extractCalleridNumber(_0xf6cedc){var _0x53e8a8=_0xf6cedc['match'](/<(.*?)>/);return _0x53e8a8?_0x53e8a8[0x1]:_0xf6cedc;}Dialer[_0x2178('0x1b')][_0x2178('0x169')]=function(_0x261b16,_0x2a077b){var _0x5b39cc=this;var _0x4cdfb3=uuid['v4']();this['actions'][_0x4cdfb3]=new Action(_0x261b16,_0x2a077b,_0x4cdfb3);return new BPromise(function(_0x53197c,_0x8c71e8){if(_['isUndefined'](_0x261b16)&&typeof _0x261b16!==_0x2178('0x16a')){return _0x8c71e8(msgResponse(_0x2178('0x16b'),'Failure',_0x2178('0x16c')));}if(_[_0x2178('0x3e')](_0x2a077b[_0x2178('0x16d')][_0x2178('0x16e')])||_0x2a077b[_0x2178('0x16d')][_0x2178('0x16e')]===null){return _0x8c71e8(msgResponse(_0x2178('0x16b'),_0x2178('0x147'),_0x2178('0x16f')));}var _0x26dbc5={'XMD-CALLERID':_0x5b39cc['actions'][_0x4cdfb3][_0x2178('0x170')](),'XMD-AGI':_0x261b16[_0x2178('0x10c')]?util[_0x2178('0x81')](_0x2178('0x171'),ipAgi,_0x261b16[_0x2178('0x10c')]):_0x2178('0x172'),'XMD-AGIAFTER':_0x261b16[_0x2178('0x113')]?util[_0x2178('0x81')](_0x2178('0x171'),ipAgi,_0x261b16[_0x2178('0x113')]):_0x2178('0x172'),'XMD-QUEUE':_0x261b16[_0x2178('0x59')]==='outbound'?util['format'](_0x2178('0x173'),_0x261b16['name'],_0x261b16[_0x2178('0x174')]||'',_0x261b16[_0x2178('0x114')]?'c':'',_0x261b16['dialQueueTimeout']||0x3):_0x2178('0x172'),'XMD-CONTACTID':_0x2a077b['ContactId'],'XMD-CDRTYPE':_0x2178('0x175'),'CALLERID(all)':_0x5b39cc[_0x2178('0x24')][_0x4cdfb3]['getCaller'](),'XMD-AMD':_0x261b16[_0x2178('0xe8')]?_0x2178('0x176'):_0x2178('0x172'),'XMD-DESTINATION':_0x2178('0xe7')};if(_0x261b16[_0x2178('0xe8')]){_0x26dbc5[_0x2178('0x177')]=_0x261b16[_0x2178('0x178')]||0x9c4;_0x26dbc5[_0x2178('0x179')]=_0x261b16[_0x2178('0x17a')]||0x5dc;_0x26dbc5[_0x2178('0x17b')]=_0x261b16['dialAMDAfterGreetingSilence']||0x320;_0x26dbc5[_0x2178('0x17c')]=_0x261b16[_0x2178('0x17d')]||0x1388;_0x26dbc5[_0x2178('0x17e')]=_0x261b16[_0x2178('0x17f')]||0x64;_0x26dbc5[_0x2178('0x180')]=_0x261b16['dialAMDBetweenWordsSilence']||0x32;_0x26dbc5[_0x2178('0x181')]=_0x261b16[_0x2178('0x182')]||0x3;_0x26dbc5[_0x2178('0x183')]=_0x261b16[_0x2178('0x184')]||0x100;_0x26dbc5[_0x2178('0x185')]=_0x261b16[_0x2178('0x186')]||0x1388;}if(_0x261b16['type']===_0x2178('0x4f')){_0x26dbc5[_0x2178('0x187')]=_0x2a077b[_0x2178('0xda')];}else{_0x26dbc5[_0x2178('0x188')]=_0x2a077b['CampaignId'];}for(var _0x5b0e0f in _0x2a077b['Contact']){if(typeof _0x2a077b[_0x2178('0x16d')][_0x5b0e0f]!==_0x2178('0x9f')){if(isNotNull(_0x2a077b[_0x2178('0x16d')][_0x5b0e0f])&&_0x5b0e0f!=='id'&&_0x5b0e0f!==_0x2178('0x189')&&_0x5b0e0f!==_0x2178('0x18a')&&_0x5b0e0f!=='updatedAt'){_0x26dbc5[util[_0x2178('0x81')](_0x2178('0x18b'),_0x2178('0x18c'),_['toUpper'](_0x5b0e0f))]=_0x2a077b['Contact'][_0x5b0e0f];}}}var _0x538d8b=_0x5b39cc[_0x2178('0x142')](_0x261b16['Trunk'])?getCallerId(_0x261b16['Trunk'][_0x2178('0x18d')],_0x261b16[_0x2178('0x5f')],_0x261b16['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x261b16[_0x2178('0x18e')],_0x261b16['dialRandomLastDigitCallerIdNumber']):_0x261b16['dialOriginateCallerIdNumber']):getCallerId(_[_0x2178('0xb2')](_0x261b16['TrunkBackup'])?_0x261b16[_0x2178('0x7f')]['callerid']:_0x261b16[_0x2178('0x18f')][_0x2178('0x18d')],_0x261b16[_0x2178('0x5f')],_0x261b16['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x261b16['dialOriginateCallerIdNumber'],_0x261b16[_0x2178('0x190')]):_0x261b16[_0x2178('0x18e')]);if(_0x538d8b){_0x26dbc5['XMD-ORIGINATECALLERIDNAME']=_0x5b39cc[_0x2178('0x24')][_0x4cdfb3]['originatecalleridname']=extractCalleridName(_0x538d8b);_0x26dbc5[_0x2178('0x191')]=_0x5b39cc[_0x2178('0x24')][_0x4cdfb3][_0x2178('0x192')]=extractCalleridNumber(_0x538d8b);}return ami[_0x2178('0xb3')]({'actionid':_0x4cdfb3,'action':'originate','channel':_0x5b39cc[_0x2178('0x142')](_0x261b16[_0x2178('0x7f')])?util[_0x2178('0x81')](_0x2178('0x193'),_0x261b16[_0x2178('0x7f')]['name'],isNotNull(_0x261b16['dialPrefix'])?_0x261b16[_0x2178('0x61')]['trim']()||'':'',_0x261b16['dialCutDigit']>0x0?_0x2a077b[_0x2178('0x16d')][_0x2178('0x16e')][_0x2178('0x194')](_0x261b16[_0x2178('0x195')]):_0x2a077b['Contact'][_0x2178('0x16e')]):util[_0x2178('0x81')](_0x2178('0x193'),_[_0x2178('0xb2')](_0x261b16[_0x2178('0x18f')])?_0x261b16[_0x2178('0x7f')][_0x2178('0x41')]:_0x261b16['TrunkBackup']['name'],isNotNull(_0x261b16[_0x2178('0x61')])?_0x261b16[_0x2178('0x61')]['trim']()||'':'',_0x261b16[_0x2178('0x195')]>0x0?_0x2a077b[_0x2178('0x16d')][_0x2178('0x16e')][_0x2178('0x194')](_0x261b16[_0x2178('0x195')]):_0x2a077b[_0x2178('0x16d')][_0x2178('0x16e')]),'callerid':_0x538d8b,'Exten':'xcally-motion-dialer','Context':_0x2178('0x196'),'Priority':'1','variable':_0x26dbc5,'timeout':(_0x261b16[_0x2178('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4cdfb3})[_0x2178('0xbc')](function(_0x269aeb){return _0x53197c(_0x269aeb);})[_0x2178('0xb6')](function(_0x3b3ae0){_0x261b16[_0x2178('0x6b')]+=0x1;var _0x572a3b=new History(_0x5b39cc['actions'][_0x4cdfb3]);logger[_0x2178('0x9b')](util[_0x2178('0x81')]('[originateError]:\x20%s',JSON[_0x2178('0x4b')](_0x3b3ae0)));_0x572a3b[_0x2178('0xac')]=0xe;_0x572a3b['statedesc']=_0x2178('0x197');_0x572a3b[_0x2178('0xaf')]=moment()['format'](_0x2178('0x109'));_0x572a3b[_0x2178('0xae')]=_0x572a3b['starttime'];_0x5b39cc['createHistory'](_0x572a3b)['catch'](loggerCatch('[originate][error]'));_0x5b39cc['moveContactManagedDialer'](_0x572a3b)[_0x2178('0xb6')](loggerCatch(_0x2178('0x198')))[_0x2178('0x136')](function(){delete _0x5b39cc['actions'][_0x4cdfb3];return _0x8c71e8(msgResponse(_0x2178('0x16b'),_0x2178('0x4a'),_0x2178('0x199')));});});});};Dialer[_0x2178('0x1b')][_0x2178('0x32')]=function(_0x6b972f){var _0x3f8c9c=this[_0x2178('0x24')][_0x6b972f['actionid']];if(_0x3f8c9c){delete this[_0x2178('0x24')][_0x6b972f[_0x2178('0x129')]];_0x3f8c9c[_0x2178('0x19a')]=moment()[_0x2178('0x81')](_0x2178('0x109'));var _0x2b138f=_0x3f8c9c['type']==='ivr'?this['campaigns'][_0x3f8c9c[_0x2178('0xb8')]]:this['voiceQueues'][_0x3f8c9c['getQueue']()];if(!this['isSuccess'](_0x6b972f['response'])){this[_0x2178('0xb7')](_0x2b138f);return this[_0x2178('0x19b')](_0x3f8c9c,_0x2b138f,_0x6b972f)['catch'](loggerCatch(_0x2178('0x19c')));}this['uniqueId'][_0x6b972f['uniqueid']]=_0x3f8c9c;}};Dialer[_0x2178('0x1b')][_0x2178('0x19d')]=function(_0x2109c9,_0x388fbb,_0xd9339b){var _0x313649=new History(_0x388fbb);if(_0x313649['countbusyretry']+_0x313649[_0x2178('0xf7')]+_0x313649[_0x2178('0xf8')]+_0x313649[_0x2178('0xf9')]+_0x313649['countdropretry']+_0x313649[_0x2178('0x107')]+_0x313649['countmachineretry']+_0x313649['countagentrejectretry']>=_0xd9339b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2109c9){case 0x3:if(_0x313649[_0x2178('0xf8')]>=_0xd9339b[_0x2178('0x19e')]-0x1){return!![];}this[_0x2178('0xc4')]({'active':![],'countnoanswerretry':_0x313649[_0x2178('0xf8')]+=0x1,'scheduledat':moment()[_0x2178('0xfe')](_0xd9339b['dialNoAnswerRetryFrequency'],_0x2178('0x100'))['format'](_0x2178('0x109')),'ContactId':_0x313649[_0x2178('0xd7')],'ListId':_0x313649['ListId'],'VoiceQueueId':_0x313649[_0x2178('0xda')]||undefined,'CampaignId':_0x313649[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x19f')));break;case 0x5:if(_0x313649[_0x2178('0xf6')]>=_0xd9339b[_0x2178('0x1a0')]-0x1){return!![];}this[_0x2178('0xc4')]({'active':![],'countbusyretry':_0x313649['countbusyretry']+=0x1,'scheduledat':moment()[_0x2178('0xfe')](_0xd9339b[_0x2178('0x1a1')],'minutes')[_0x2178('0x81')](_0x2178('0x109')),'ContactId':_0x313649['ContactId'],'ListId':_0x313649['ListId'],'VoiceQueueId':_0x313649[_0x2178('0xda')]||undefined,'CampaignId':_0x313649[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x313649['countcongestionretry']>=_0xd9339b['dialCongestionMaxRetry']-0x1){return!![];}this[_0x2178('0xc4')]({'active':![],'countcongestionretry':_0x313649[_0x2178('0xf7')]+=0x1,'scheduledat':moment()[_0x2178('0xfe')](_0xd9339b[_0x2178('0x1a2')],_0x2178('0x100'))[_0x2178('0x81')](_0x2178('0x109')),'ContactId':_0x313649[_0x2178('0xd7')],'ListId':_0x313649[_0x2178('0xd8')],'VoiceQueueId':_0x313649[_0x2178('0xda')]||undefined,'CampaignId':_0x313649['CampaignId']||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x1a3')));break;case 0x0:if(_0x313649[_0x2178('0xf9')]>=_0xd9339b['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x2178('0xc4')]({'active':![],'countnosuchnumberretry':_0x313649['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x2178('0xfe')](_0xd9339b[_0x2178('0x1a4')],_0x2178('0x100'))[_0x2178('0x81')](_0x2178('0x109')),'ContactId':_0x313649[_0x2178('0xd7')],'ListId':_0x313649[_0x2178('0xd8')],'VoiceQueueId':_0x313649[_0x2178('0xda')]||undefined,'CampaignId':_0x313649[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x1a5')));}break;case 0xa:if(_0x313649['countdropretry']>=_0xd9339b[_0x2178('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x313649['countdropretry']+=0x1,'scheduledat':moment()[_0x2178('0xfe')](_0xd9339b[_0x2178('0x11d')],_0x2178('0x100'))['format'](_0x2178('0x109')),'ContactId':_0x313649['ContactId'],'ListId':_0x313649['ListId'],'VoiceQueueId':_0x313649['VoiceQueueId']||undefined,'CampaignId':_0x313649[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x11e')));break;case 0xb:if(_0x313649[_0x2178('0x107')]>=_0xd9339b['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x2178('0xc4')]({'active':![],'countabandonedretry':_0x313649[_0x2178('0x107')]+=0x1,'scheduledat':moment()['add'](_0xd9339b['dialAbandonedRetryFrequency'],_0x2178('0x100'))[_0x2178('0x81')](_0x2178('0x109')),'ContactId':_0x313649[_0x2178('0xd7')],'ListId':_0x313649[_0x2178('0xd8')],'VoiceQueueId':_0x313649[_0x2178('0xda')]||undefined,'CampaignId':_0x313649[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x125')));break;case 0x13:if(_0x313649[_0x2178('0xf3')]>=_0xd9339b[_0x2178('0x108')]-0x1){return!![];}this[_0x2178('0xc4')]({'active':![],'countmachineretry':_0x313649[_0x2178('0xf3')]+=0x1,'scheduledat':moment()[_0x2178('0xfe')](_0xd9339b[_0x2178('0xff')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x313649[_0x2178('0xd7')],'ListId':_0x313649[_0x2178('0xd8')],'VoiceQueueId':_0x313649[_0x2178('0xda')]||undefined,'CampaignId':_0x313649[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x101')));break;case 0x14:if(_0x313649[_0x2178('0xfa')]>=_0xd9339b[_0x2178('0x1a7')]-0x1){return!![];}this[_0x2178('0xc4')]({'active':![],'countagentrejectretry':_0x313649['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x2178('0xfe')](_0xd9339b['dialAgentRejectRetryFrequency'],_0x2178('0x100'))[_0x2178('0x81')](_0x2178('0x109')),'ContactId':_0x313649['ContactId'],'ListId':_0x313649[_0x2178('0xd8')],'VoiceQueueId':_0x313649[_0x2178('0xda')]||undefined,'CampaignId':_0x313649[_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x1a8')));break;default:return!![];}};Dialer[_0x2178('0x1b')][_0x2178('0x19b')]=function(_0xe52b2b,_0x514aab,_0x3f78e2){var _0x698170=this;var _0xb981aa=new History(_0xe52b2b);return new BPromise(function(_0x5ea9b1,_0x12ad55){if(_[_0x2178('0x3e')](_0x514aab)&&typeof _0x514aab!==_0x2178('0x16a')){return _0x12ad55(msgResponse('[callProgressDetecting]',_0x2178('0x147'),_0x2178('0x1a9')));}if(_[_0x2178('0x3e')](_0x3f78e2)&&typeof _0x3f78e2!==_0x2178('0x16a')){return _0x12ad55(msgResponse(_0x2178('0x1aa'),_0x2178('0x147'),_0x2178('0x1ab')));}switch(_0x3f78e2[_0x2178('0x110')]){case'0':_0x514aab[_0x2178('0x1ac')]+=0x1;_0xb981aa['state']=0x0;_0xb981aa[_0x2178('0xad')]='NoSuchNumber';_0xb981aa[_0x2178('0xf9')]+=0x1;_0xb981aa['countglobal']+=0x1;ami[_0x2178('0x104')](_0x2178('0x1ad'),ut[_0x2178('0xf5')](_0xe52b2b,_0x2178('0x1ae')));_0x698170[_0x2178('0xd0')](_0xb981aa)[_0x2178('0xb6')](loggerCatch(_0x2178('0x105')));if(_0x698170[_0x2178('0x19d')](0x0,_0xe52b2b,_0x514aab)){if(_0xb981aa[_0x2178('0xf9')]>=_0x514aab[_0x2178('0x1af')]){_0x698170[_0x2178('0x1b0')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1b1'));}else{_0x698170[_0x2178('0xfb')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1b1'));}}break;case'3':_0x514aab['outboundNoAnswerCallsDay']+=0x1;_0xb981aa[_0x2178('0xac')]=0x3;_0xb981aa[_0x2178('0xad')]=_0x2178('0x1b2');_0xb981aa[_0x2178('0xf8')]+=0x1;_0xb981aa[_0x2178('0xf4')]+=0x1;ami['emit']('custom:agentnoanswer',ut[_0x2178('0xf5')](_0xe52b2b,_0x2178('0x1b3')));_0x698170[_0x2178('0xd0')](_0xb981aa)[_0x2178('0xb6')](loggerCatch(_0x2178('0x1b4')));if(_0x698170['checkRetriveMax'](0x3,_0xe52b2b,_0x514aab)){if(_0xb981aa[_0x2178('0xf8')]>=_0x514aab['dialNoAnswerMaxRetry']){_0x698170[_0x2178('0x1b0')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1b5'));}else{_0x698170[_0x2178('0xfb')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1b5'));}}break;case'5':_0x514aab[_0x2178('0x65')]+=0x1;_0xb981aa[_0x2178('0xac')]=0x5;_0xb981aa[_0x2178('0xad')]=_0x2178('0x1b6');_0xb981aa[_0x2178('0xf6')]+=0x1;_0xb981aa[_0x2178('0xf4')]+=0x1;ami[_0x2178('0x104')](_0x2178('0x1b7'),ut[_0x2178('0xf5')](_0xe52b2b,_0x2178('0x1b8')));_0x698170[_0x2178('0xd0')](_0xb981aa)[_0x2178('0xb6')](loggerCatch(_0x2178('0x1b9')));if(_0x698170[_0x2178('0x19d')](0x5,_0xe52b2b,_0x514aab)){if(_0xb981aa['countbusyretry']>=_0x514aab['dialBusyMaxRetry']){_0x698170[_0x2178('0x1b0')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1ba'));}else{_0x698170['stateGlobal'](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1ba'));}}break;case'8':_0x514aab[_0x2178('0x66')]+=0x1;_0xb981aa[_0x2178('0xac')]=0x8;_0xb981aa[_0x2178('0xad')]=_0x2178('0x1bb');_0xb981aa[_0x2178('0xf7')]+=0x1;_0xb981aa['countglobal']+=0x1;ami[_0x2178('0x104')](_0x2178('0x1bc'),ut['buildObj'](_0xe52b2b,'congestion'));_0x698170[_0x2178('0xd0')](_0xb981aa)[_0x2178('0xb6')](loggerCatch(_0x2178('0x1bd')));if(_0x698170['checkRetriveMax'](0x8,_0xe52b2b,_0x514aab)){if(_0xb981aa[_0x2178('0xf7')]>=_0x514aab[_0x2178('0x1be')]){_0x698170[_0x2178('0x1b0')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1bf'));}else{_0x698170[_0x2178('0xfb')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1bf'));}}break;case'11':_0x514aab[_0x2178('0x1c0')]+=0x1;_0xb981aa['state']=0xb;_0xb981aa[_0x2178('0xad')]='Abandoned';_0xb981aa['countabandonedretry']+=0x1;_0xb981aa[_0x2178('0xf4')]+=0x1;_0x698170[_0x2178('0xd0')](_0xb981aa)[_0x2178('0xb6')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x698170[_0x2178('0x19d')](0xb,_0xe52b2b,_0x514aab)){if(_0xb981aa['countabandonedretry']>=_0x514aab[_0x2178('0x123')]){_0x698170[_0x2178('0x1b0')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1c1'));}else{_0x698170[_0x2178('0xfb')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1c1'));}}break;case'20':_0x514aab['outboundRejectCallsDay']+=0x1;_0xb981aa['state']=0x14;_0xb981aa[_0x2178('0xad')]=_0x2178('0x1c2');_0xb981aa[_0x2178('0xfa')]+=0x1;_0xb981aa[_0x2178('0xf4')]+=0x1;ami[_0x2178('0x104')](_0x2178('0x1c3'),ut['buildObj'](_0xe52b2b,_0x2178('0x1c4')));_0x698170['createHistory'](_0xb981aa)[_0x2178('0xb6')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x698170[_0x2178('0x19d')](0x14,_0xe52b2b,_0x514aab)){if(_0xb981aa[_0x2178('0xfa')]>=_0x514aab[_0x2178('0x1a7')]){_0x698170['createStateFinal'](_0xb981aa,_0x5ea9b1,_0x12ad55,'reason\x2020\x20agentreject');}else{_0x698170[_0x2178('0xfb')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x2178('0x1c5'));}}break;default:_0x514aab[_0x2178('0x6d')]+=0x1;_0xb981aa['state']=0xc;_0xb981aa[_0x2178('0xad')]=_0x3f78e2[_0x2178('0x110')];_0x698170['createHistory'](_0xb981aa)[_0x2178('0xb6')](loggerCatch(_0x2178('0x1c6')));if(_0x698170[_0x2178('0x19d')](_0x3f78e2[_0x2178('0x110')],_0xe52b2b,_0x514aab)){if(_0xb981aa[_0x2178('0xf6')]+_0xb981aa[_0x2178('0xf7')]+_0xb981aa[_0x2178('0xf8')]+_0xb981aa[_0x2178('0xf9')]+_0xb981aa[_0x2178('0x106')]+_0xb981aa[_0x2178('0x107')]+_0xb981aa[_0x2178('0xf3')]+_0xb981aa['countagentrejectretry']>=_0x514aab[_0x2178('0x1c7')]){_0x698170[_0x2178('0xfb')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x3f78e2['reason']);}else{_0x698170[_0x2178('0x1b0')](_0xb981aa,_0x5ea9b1,_0x12ad55,_0x3f78e2[_0x2178('0x110')]);}}}});};Dialer[_0x2178('0x1b')]['stateGlobal']=function(_0x421c96,_0x5cad87,_0x1d46b0,_0x41db3d){var _0x5de897=new Final(_0x421c96);_0x5de897['state']=0xf;_0x5de897[_0x2178('0xad')]=_0x2178('0x1c8');this[_0x2178('0x1b0')](_0x5de897,_0x5cad87,_0x1d46b0,_0x41db3d);};Dialer[_0x2178('0x1b')]['createStateFinal']=function(_0x5d2af7,_0x5e46a9,_0x10510a,_0x3551af){this[_0x2178('0xce')](_0x5d2af7)[_0x2178('0xbc')](function(){return _0x5e46a9(msgResponse(_0x2178('0x1aa'),_0x2178('0xdf'),_0x3551af));})[_0x2178('0xb6')](function(){return _0x10510a(msgResponse(_0x2178('0x1c9'),_0x2178('0x147'),_0x2178('0x1ca')));});};Dialer[_0x2178('0x1b')]['predictive']=function(_0x1d6b25){var _0xe2c128=_0x1d6b25['dialPredictiveOptimizationPercentage']/0x64;var _0x4d7a20=_0x1d6b25[_0x2178('0x69')]/(_0x1d6b25[_0x2178('0x69')]+_0x1d6b25['outboundAnswerCallsDay']);var _0x199206=Math[_0x2178('0x1cb')](_0x1d6b25[_0x2178('0x77')]*(_0x1d6b25[_0x2178('0x1cc')]/0x64));var _0x4d523f=Math['round'](_0x1d6b25[_0x2178('0x77')]*(_0x1d6b25[_0x2178('0x1cd')]/0x64));var _0x2745b6=_0x1d6b25[_0x2178('0x51')]+_0x1d6b25[_0x2178('0x57')];var _0x2260e6=Math[_0x2178('0x1ce')](_0x1d6b25['erlangCalls']*_0x1d6b25['erlangAbandonmentRate']*_0x1d6b25[_0x2178('0x74')]*_0x1d6b25['predictiveIntervalMultiplicativeFactor']);if(_[_0x2178('0x3e')](_0x1d6b25[_0x2178('0x28')])){if(!_[_0x2178('0x3e')](_0x1d6b25[_0x2178('0x7e')])){_0x1d6b25[_0x2178('0x7e')]=undefined;loggerPredictive[_0x2178('0x9b')](_0x2178('0x1cf'),_0x2178('0x1d0'));}if(!_[_0x2178('0x3e')](_0x1d6b25[_0x2178('0x95')])){loggerPredictive[_0x2178('0x9b')](_0x2178('0x1cf'),_0x2178('0x1d1'));clearInterval(_0x1d6b25[_0x2178('0x95')]);_0x1d6b25['handlePredictive']=undefined;}_0x1d6b25[_0x2178('0x28')]=moment()[_0x2178('0x81')](_0x2178('0x109'));loggerPredictive[_0x2178('0x84')](_0x1d6b25[_0x2178('0x41')],_0x2178('0x1d2'),_0x1d6b25[_0x2178('0x28')]);this[_0x2178('0x15c')](_0x1d6b25,0x1);}else if(ifInterval(_0x1d6b25[_0x2178('0x1d3')],_0x1d6b25[_0x2178('0x28')])){this[_0x2178('0x15c')](_0x1d6b25,0x1);loggerPredictiveCalls[_0x2178('0x84')](_0x2178('0x1d4'),_0x1d6b25[_0x2178('0x28')],_0x1d6b25[_0x2178('0x41')]);_0x1d6b25[_0x2178('0x7a')]=0x0;_0x1d6b25['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xe2c128<_0x4d7a20&&_0x1d6b25[_0x2178('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x1d6b25);loggerPredictive[_0x2178('0x84')](_0x2178('0x1d6'),_0x2178('0x1d7'),_0x4d7a20,_0x2178('0x28'),_0x1d6b25['name']);}else if(_0x2260e6<_0x1d6b25[_0x2178('0x11a')]&&_0x1d6b25[_0x2178('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x1d6b25);loggerPredictive[_0x2178('0x84')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2178('0x1d8'),_0x2260e6,'Drop\x20in\x20this\x20interval',_0x1d6b25[_0x2178('0x11a')],_0x2178('0x28'),_0x1d6b25[_0x2178('0x41')]);}else if(!ifInterval(_0x1d6b25[_0x2178('0x1d3')],_0x1d6b25[_0x2178('0x28')])&&_[_0x2178('0x3e')](_0x1d6b25[_0x2178('0x7e')])&&!_[_0x2178('0x3e')](_0x1d6b25[_0x2178('0x28')])){_0x1d6b25['startPredictive']=moment()[_0x2178('0x81')](_0x2178('0x109'));loggerPredictive['info'](_0x1d6b25[_0x2178('0x41')],_0x2178('0x1d9'),_0x1d6b25[_0x2178('0x7e')]);this[_0x2178('0xc1')](_0x1d6b25['dialPredictiveInterval'])['then'](this[_0x2178('0x1da')](_0x1d6b25))['then'](mergeDataErlangB(_0x1d6b25))[_0x2178('0xbc')](this['startMethodPredictive'](_0x1d6b25))[_0x2178('0xb6')](loggerCatchPredictive(_0x2178('0x1db'),_0x1d6b25));}else if(!ifInterval(_0x1d6b25['dialPredictiveInterval'],_0x1d6b25['startPredictive'])){_0x1d6b25[_0x2178('0x11a')]=0x0;_0x1d6b25[_0x2178('0x7e')]=moment()[_0x2178('0x81')](_0x2178('0x109'));loggerPredictive[_0x2178('0x84')](_0x1d6b25['name'],_0x2178('0x1dc'),_0x1d6b25[_0x2178('0x7e')]);clearInterval(_0x1d6b25[_0x2178('0x95')]);_0x1d6b25[_0x2178('0x95')]=undefined;this[_0x2178('0xc1')](_0x1d6b25['dialPredictiveInterval'])[_0x2178('0xbc')](this[_0x2178('0x1da')](_0x1d6b25))[_0x2178('0xbc')](mergeDataErlangB(_0x1d6b25))[_0x2178('0xbc')](this[_0x2178('0x1dd')](_0x1d6b25))[_0x2178('0xb6')](loggerCatchPredictive(_0x2178('0x1de'),_0x1d6b25));}else if(_0x1d6b25[_0x2178('0x77')]&&_0x2745b6<_0x1d6b25[_0x2178('0x77')]-_0x4d523f){freeVariablesPredictive(_0x1d6b25);loggerPredictive[_0x2178('0x84')](_0x1d6b25[_0x2178('0x41')],_0x2178('0x1df'),_0x2745b6,_0x2178('0x1e0'),_0x1d6b25[_0x2178('0x77')],'-',_0x4d523f,'=',_0x1d6b25[_0x2178('0x77')]-_0x4d523f,')');}else if(_0x1d6b25[_0x2178('0x77')]&&_0x2745b6>_0x1d6b25[_0x2178('0x77')]+_0x199206){freeVariablesPredictive(_0x1d6b25);loggerPredictive[_0x2178('0x84')](_0x1d6b25[_0x2178('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2745b6,_0x2178('0x1e1'),_0x1d6b25[_0x2178('0x77')],'+',_0x199206,'=',_0x1d6b25[_0x2178('0x77')]+_0x199206,')');}};Dialer[_0x2178('0x1b')]['getDataPredictive']=function(_0x3ef2fd){var _0x491026=this;return function(_0x38a4ae){return new BPromise(function(_0xe2fc93,_0x303f21){_[_0x2178('0x92')](_0x3ef2fd,_0x38a4ae[0x0]);if(checkGetDataPredictive(_0x38a4ae[0x0])){var _0x1b8b29=_0x3ef2fd['predictiveIntervalAvailable']=_0x3ef2fd[_0x2178('0x57')]+_0x3ef2fd[_0x2178('0x51')];var _0x1b47cb=_0x3ef2fd[_0x2178('0x1d3')]*0x3c;var _0x344edc=_0x38a4ae[0x0][_0x2178('0x70')]+_0x38a4ae[0x0][_0x2178('0x6f')];var _0x2f4e78=(_0x38a4ae[0x0][_0x2178('0x6e')]+_0x38a4ae[0x0][_0x2178('0x72')]+_0x38a4ae[0x0][_0x2178('0x71')])/_0x38a4ae[0x0][_0x2178('0x78')];_0x3ef2fd['predictiveIntervalHitRate']=_0x2f4e78>0x0?_0x2f4e78:0x1;switch(_0x3ef2fd['dialPredictiveOptimization']){case _0x2178('0x1e2'):var _0x24dd2b=_0x3ef2fd[_0x2178('0x1e3')]/0x64;return _0x491026[_0x2178('0x1e4')](_0x1b8b29,_0x1b47cb,_0x344edc,_0x2f4e78,_0x24dd2b)[_0x2178('0xbc')](function(_0x365b0a){return _0xe2fc93(_0x365b0a);});case'agentBusyFactor':var _0x18224f=_0x3ef2fd[_0x2178('0x1e3')]/0x64;return _0x491026[_0x2178('0x1e5')](_0x1b8b29,_0x1b47cb,_0x344edc,_0x2f4e78,_0x18224f)['then'](function(_0x28875d){return _0xe2fc93(_0x28875d);});default:return _0x303f21(msgResponse(_0x2178('0x1e6'),'Failure','Unknown\x20Predictive'));}}else{return _0x303f21(msgResponse(_0x2178('0x1e6'),_0x2178('0x147'),_0x2178('0x1e7')));}});};};Dialer[_0x2178('0x1b')][_0x2178('0x1e8')]=function(_0x42cb62){var _0x19d2bc=this;return function(_0x38eb6c){return new BPromise(function(_0x69ac06,_0xaa32a4){_['merge'](_0x42cb62,_0x38eb6c[0x0]);if(checkGetDataPredictive(_0x38eb6c[0x0])){loggerPredictive[_0x2178('0x84')](JSON['stringify'](_0x38eb6c[0x0]));if(_0x42cb62['dialPredictiveOptimization']==='dropRate'){return _0x19d2bc[_0x2178('0xcc')](_0x42cb62['id'])[_0x2178('0xbc')](function(_0x41109d){var _0x3608d3=_0x42cb62[_0x2178('0x52')]-_0x41109d[0x0][_0x2178('0x1e9')];var _0x874072=_0x42cb62['dialPredictiveInterval']*0x3c;var _0xb3f77f=_0x38eb6c[0x0][_0x2178('0x70')]+_0x38eb6c[0x0]['predictiveIntervalAvgHoldtime'];var _0x3acd7e=(_0x38eb6c[0x0][_0x2178('0x6e')]+_0x38eb6c[0x0][_0x2178('0x72')]+_0x38eb6c[0x0][_0x2178('0x71')])/_0x38eb6c[0x0][_0x2178('0x78')];var _0x3e4070=_0x42cb62[_0x2178('0x1e3')]/0x64;_0x42cb62['predictiveIntervalPauses']=_0x41109d[0x0][_0x2178('0x1e9')]||0x0;_0x42cb62[_0x2178('0x74')]=_0x3acd7e>0x0?_0x3acd7e:0x1;return _0x19d2bc['abandonmentRate'](_0x3608d3,_0x874072,_0xb3f77f,_0x3acd7e,_0x3e4070);})['then'](function(_0x46cee1){return _0x69ac06(_0x46cee1);})[_0x2178('0xb6')](function(_0x57b051){return _0xaa32a4(msgResponse(_0x2178('0x1ea'),_0x2178('0x147'),JSON['stringify'](_0x57b051)));});}if(_0x42cb62[_0x2178('0x1d5')]===_0x2178('0x1eb')){return _0x19d2bc['getVoiceQueueRtPauses'](_0x42cb62['id'])[_0x2178('0xbc')](function(_0x536759){var _0x1a38e6=_0x42cb62[_0x2178('0x52')]-_0x536759[0x0][_0x2178('0x1e9')];var _0x41ee74=_0x42cb62[_0x2178('0x1d3')]*0x3c;var _0x160332=_0x38eb6c[0x0][_0x2178('0x70')]+_0x38eb6c[0x0]['predictiveIntervalAvgHoldtime'];var _0x50b8c5=(_0x38eb6c[0x0][_0x2178('0x6e')]+_0x38eb6c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x38eb6c[0x0][_0x2178('0x71')])/_0x38eb6c[0x0]['predictiveIntervalTotalCalls'];var _0x5b111e=_0x42cb62[_0x2178('0x1e3')]/0x64;_0x42cb62['predictiveIntervalPauses']=_0x536759[0x0][_0x2178('0x1e9')]||0x0;_0x42cb62[_0x2178('0x74')]=_0x50b8c5>0x0?_0x50b8c5:0x1;return _0x19d2bc[_0x2178('0x1e5')](_0x1a38e6,_0x41ee74,_0x160332,_0x50b8c5,_0x5b111e);})[_0x2178('0xbc')](function(_0x6c7c75){return _0x69ac06(_0x6c7c75);})[_0x2178('0xb6')](function(_0x44dbbf){return _0xaa32a4(msgResponse(_0x2178('0x1ea'),_0x2178('0x147'),JSON[_0x2178('0x4b')](_0x44dbbf)));});}}else{return _0xaa32a4(msgResponse(_0x2178('0x1e6'),_0x2178('0x147'),_0x2178('0x1e7')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x45e63b){var _0xbee927=this;return function(){var _0x2c0995=0x0;var _0x27a2d1=Math[_0x2178('0x1ce')](_0x45e63b[_0x2178('0x7b')]*0x3e8);if(_0x27a2d1>0x0){_0x27a2d1=_0x27a2d1<0x64?0x64:_0x27a2d1;loggerPredictive['info'](_0x45e63b[_0x2178('0x41')],_0x2178('0x1ec'),_0x27a2d1,'milliseconds');_0x45e63b[_0x2178('0x95')]=setInterval(function(){_0xbee927['handlePredictive'](_0x45e63b);loggerPredictiveCalls[_0x2178('0x84')](_0x2178('0x1ed'),_0x2c0995+=0x1);},_0x27a2d1);}else{loggerPredictive['info'](_0x45e63b[_0x2178('0x41')],_0x2178('0x1ee'));}};};Dialer[_0x2178('0x1b')]['checkContactBlack']=function(_0x16cf3e,_0x5c04ff){var _0x2e40a3=this;return function(_0x2f7b71){if(_['isEmpty'](_0x2f7b71)){if(_[_0x2178('0xb2')](_0x5c04ff[_0x2178('0xd9')])||!_0x5c04ff[_0x2178('0x1ef')]){if(_0x16cf3e[_0x2178('0x5e')]==='booked'){_0x16cf3e[_0x2178('0x131')]=_[_0x2178('0x3e')](_0x16cf3e['queueStatusComplete'])?!![]:_0x16cf3e['queueStatusComplete'];var _0x459745=uuid['v4']();_0x2e40a3['actions'][_0x459745]=new Action(_0x16cf3e,_0x5c04ff,_0x459745);loggerBooked[_0x2178('0x84')]('[booked][checkContactBlack]',_0x459745,_0x2178('0x1f0'),JSON[_0x2178('0x4b')](_0x16cf3e[_0x2178('0x131')]),_0x2178('0x1f1'),_0x16cf3e[_0x2178('0x41')]);if(_0x16cf3e[_0x2178('0x131')]){_0x16cf3e['queueStatusComplete']=![];_0x2e40a3[_0x2178('0x2a')][_0x2e40a3[_0x2178('0x24')][_0x459745][_0x2178('0xb8')]]=[];ami[_0x2178('0xb3')]({'actionid':_0x459745,'action':'queuestatus','queue':_0x16cf3e['name']})[_0x2178('0xb6')](function(){_0x2e40a3['updateOriginated'](_0x16cf3e);_0x2e40a3['rescheduleContact']({'active':![],'ContactId':_0x2e40a3[_0x2178('0x24')][_0x459745]['ContactId'],'ListId':_0x2e40a3[_0x2178('0x24')][_0x459745]['ListId'],'VoiceQueueId':_0x2e40a3['actions'][_0x459745][_0x2178('0xda')]||undefined,'CampaignId':_0x2e40a3[_0x2178('0x24')][_0x459745][_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2e40a3[_0x2178('0x24')][_0x459745];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON['stringify'](_0x16cf3e[_0x2178('0x131')]),_0x2178('0x1f1'),_0x16cf3e[_0x2178('0x41')]);_0x2e40a3[_0x2178('0xb7')](_0x16cf3e);_0x2e40a3[_0x2178('0xc4')]({'active':![],'ContactId':_0x2e40a3[_0x2178('0x24')][_0x459745]['ContactId'],'ListId':_0x2e40a3[_0x2178('0x24')][_0x459745][_0x2178('0xd8')],'VoiceQueueId':_0x2e40a3[_0x2178('0x24')][_0x459745][_0x2178('0xda')]||undefined,'CampaignId':_0x2e40a3[_0x2178('0x24')][_0x459745][_0x2178('0xdb')]||undefined})[_0x2178('0xb6')](loggerCatch(_0x2178('0x1f2')));delete _0x2e40a3['actions'][_0x459745];}}else{return _0x2e40a3['actionOriginate'](_0x16cf3e,_0x5c04ff);}}else{if(getDiff(_0x5c04ff['scheduledat'])<_0x16cf3e[_0x2178('0x1f3')]*0x3c){if(_0x5c04ff['Agent']&&!_0x5c04ff[_0x2178('0x1f4')][_0x2178('0x1f5')]){_0x2e40a3[_0x2178('0x97')][_0x2178('0x134')](_0x5c04ff['id'])[_0x2178('0x136')](function(){_0x2e40a3[_0x2178('0xb7')](_0x16cf3e);});}else{_0x2e40a3[_0x2178('0xc6')]({'active':![]},_0x5c04ff['id'],0x1)[_0x2178('0x136')](function(){_0x2e40a3[_0x2178('0xb7')](_0x16cf3e);});}}else{_0x16cf3e['outboundReCallsDay']+=0x1;_0x2e40a3['updateOriginated'](_0x16cf3e);if(_0x16cf3e[_0x2178('0x1f6')]){_0x2e40a3['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c04ff[_0x2178('0xd7')],'ListId':_0x5c04ff['ListId'],'VoiceQueueId':_0x5c04ff[_0x2178('0xda')]||undefined,'CampaignId':_0x5c04ff[_0x2178('0xdb')]||undefined})['catch'](loggerCatch(_0x2178('0x1f7')));_0x2e40a3[_0x2178('0xd0')](createObjHistory(_0x16cf3e,_0x5c04ff,_0x2178('0x1f8'),0x17,_0x2178('0x1f9')))[_0x2178('0xb6')](loggerCatch(_0x2178('0x1fa')));}else{_0x2e40a3[_0x2178('0xd6')](createObjHistory(_0x16cf3e,_0x5c04ff,'RECALLFAILEDTIMEOUT',0x16,_0x2178('0x1fb')),_0x2178('0x1fc'),'[Originate][HistoryRecallClose]');}}}}else{_0x16cf3e[_0x2178('0x64')]+=0x1;_0x2e40a3[_0x2178('0xd6')](createObjHistory(_0x16cf3e,_0x5c04ff,_0x2178('0x1fd'),0xd,_0x2178('0x1fe')),_0x2178('0x1ff'),_0x2178('0x200'));throw _0x2178('0x201');}};};Dialer['prototype']['handleIvr']=function(_0x1bb29c){var _0x1e23b3=this;var _0x19008d=_0x1bb29c[_0x2178('0x202')]-_0x1bb29c['originated']-_0x1bb29c['temp'];emitCampaignSummary(_0x1bb29c);if(_0x19008d>0x0){if(_0x19008d>this[_0x2178('0x22')]){_0x19008d=this['maxNumberOriginate'];}_0x1bb29c[_0x2178('0xc9')]+=_0x19008d;this[_0x2178('0xca')](_0x1bb29c['id'],_0x19008d,_0x1bb29c['dialOrderByScheduledAt'],_0x1bb29c)[_0x2178('0xbc')](function(_0x16c602){_0x1bb29c[_0x2178('0xc9')]-=_0x19008d;_0x1bb29c[_0x2178('0xc9')]=_0x1bb29c['temp']>0x0?_0x1bb29c[_0x2178('0xc9')]:0x0;if(!checkContactEmpty(_0x16c602)){_0x1bb29c[_0x2178('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x2178('0x84')](_0x2178('0x203')+_0x1bb29c['name']);}else{_0x1bb29c[_0x2178('0x79')]+=_0x16c602[_0x2178('0x9e')];_0x1bb29c[_0x2178('0x3f')]=_0x2178('0x204');for(var _0x319336=0x0;_0x319336<_0x16c602[_0x2178('0x9e')];_0x319336+=0x1){_0x1bb29c[_0x2178('0x205')]+=0x1;if(_[_0x2178('0xb2')](_0x16c602[_0x319336])||_[_0x2178('0xb2')](_0x16c602[_0x319336][_0x2178('0x16d')])||_[_0x2178('0xb2')](_0x16c602[_0x319336][_0x2178('0x16d')]['phone'])){_0x1e23b3[_0x2178('0xd5')](_0x2178('0x206'),_0x1bb29c,_0x16c602[_0x319336]);}else{_0x1e23b3['checkIsBlackListIvr'](_[_0x2178('0x12f')](_0x16c602[_0x319336],['CampaignId',_0x2178('0x207')]))[_0x2178('0xbc')](_0x1e23b3[_0x2178('0x208')](_0x1bb29c,_0x16c602[_0x319336]))[_0x2178('0xb6')](_0x1e23b3[_0x2178('0xd4')](_0x2178('0x209'),_0x1bb29c));}}}})[_0x2178('0xb6')](loggerGetContactDialer(_0x2178('0x20a'),_0x1bb29c,_0x19008d));}};Dialer[_0x2178('0x1b')][_0x2178('0x15c')]=function(_0x5ee02a,_0x490cd3){var _0x4a93c8=this;var _0x119b4a=[];var _0xad822=_0x490cd3>=0x1?_0x490cd3:0x1;if(_0x5ee02a[_0x2178('0x5e')]===_0x2178('0x8')){_0xad822=0x1;}var _0x1a314e=Math['floor'](_0x5ee02a['available']*_0xad822)-_0x5ee02a[_0x2178('0x79')]-_0x5ee02a[_0x2178('0xc9')];emitVoiceQueueSummary(_0x5ee02a);if(_0x5ee02a['dialLimitQueue']>0x0){var _0x58b26d=_0x5ee02a[_0x2178('0x20b')]-_0x5ee02a['originated']-_0x5ee02a['talking']-_0x5ee02a[_0x2178('0xc9')]-_0x5ee02a[_0x2178('0x53')];if(_0x1a314e>_0x58b26d){_0x1a314e=_0x58b26d;}}if(_0x1a314e>0x0){if(_0x5ee02a[_0x2178('0x5e')]==='booked'){_0x1a314e=0x1;}if(_0x1a314e>this[_0x2178('0x22')]){_0x1a314e=this['maxNumberOriginate'];}_0x5ee02a[_0x2178('0xc9')]+=_0x1a314e;for(var _0x432dc1 in this['agents']){if(typeof this[_0x2178('0x20')][_0x432dc1]!==_0x2178('0x9f')){if(this['agents'][_0x432dc1][_0x2178('0xac')]==='not_inuse'&&this[_0x2178('0x20')][_0x432dc1][_0x2178('0xb4')]===_0x2178('0xe0')){_0x119b4a[_0x2178('0x12e')](this[_0x2178('0x20')][_0x432dc1]['id']);}}}this['getContactDialer'](_0x5ee02a['id'],_0x119b4a,_0x1a314e,_0x5ee02a['dialOrderByScheduledAt'],_0x5ee02a)[_0x2178('0xbc')](function(_0xa827d9){_0x5ee02a['temp']-=_0x1a314e;_0x5ee02a[_0x2178('0xc9')]=_0x5ee02a[_0x2178('0xc9')]>0x0?_0x5ee02a[_0x2178('0xc9')]:0x0;if(!checkContactEmpty(_0xa827d9)){_0x4a93c8[_0x2178('0xba')](_0x5ee02a)['then'](sendMessageReschedule(_0x5ee02a))[_0x2178('0xb6')](loggerCatch(_0x2178('0xbd')));}else{_0x5ee02a[_0x2178('0x79')]+=_0xa827d9['length'];_0x5ee02a[_0x2178('0x3f')]=_0x5ee02a[_0x2178('0x5e')]==='booked'?_0x2178('0x176'):_0x2178('0x204');for(var _0x399e23=0x0;_0x399e23<_0xa827d9[_0x2178('0x9e')];_0x399e23+=0x1){if(_[_0x2178('0xb2')](_0xa827d9[_0x399e23])||_[_0x2178('0xb2')](_0xa827d9[_0x399e23][_0x2178('0x16d')])||_['isNil'](_0xa827d9[_0x399e23]['Contact']['phone'])){_0x4a93c8[_0x2178('0xd5')](_0x2178('0x206'),_0x5ee02a,_0xa827d9[_0x399e23]);}else{_0x4a93c8[_0x2178('0xbe')](_['pick'](_0xa827d9[_0x399e23],[_0x2178('0xda'),_0x2178('0x207')]))[_0x2178('0xbc')](_0x4a93c8[_0x2178('0x208')](_0x5ee02a,_0xa827d9[_0x399e23]))[_0x2178('0xb6')](_0x4a93c8[_0x2178('0xd4')](_0x2178('0x206'),_0x5ee02a));}}}})['catch'](loggerGetContactDialer(_0x2178('0x20c'),_0x5ee02a,_0x1a314e));}};Dialer[_0x2178('0x1b')][_0x2178('0x95')]=function(_0x4a965d){if(_0x4a965d[_0x2178('0x20b')]>0x0){var _0x1ebbba=_0x4a965d[_0x2178('0x20b')]-_0x4a965d['originated']-_0x4a965d[_0x2178('0x57')];if(_0x1ebbba>0x0){this['tryOriginatePredictive'](_0x4a965d);}else{loggerPredictiveCalls[_0x2178('0x84')](_0x2178('0x20d'));}}else{this[_0x2178('0x20e')](_0x4a965d);}};Dialer[_0x2178('0x1b')][_0x2178('0x20e')]=function(_0x17a9c4){var _0x14688d=this;var _0x2efd78=[];_0x17a9c4[_0x2178('0x79')]+=0x1;for(var _0x5aaba8 in this[_0x2178('0x20')]){if(typeof this['agents'][_0x5aaba8]!=='undefined'){if(this[_0x2178('0x20')][_0x5aaba8]['state']===_0x2178('0x20f')&&this[_0x2178('0x20')][_0x5aaba8][_0x2178('0xb4')]===_0x2178('0xe0')){_0x2efd78['push'](this['agents'][_0x5aaba8]['id']);}}}this[_0x2178('0xc8')](_0x17a9c4['id'],_0x2efd78,0x1,_0x17a9c4[_0x2178('0x210')],_0x17a9c4)['then'](function(_0x225a9d){if(!checkContactEmpty(_0x225a9d)){checkContactLowerLimitOriginate(_0x17a9c4,0x1,0x0);_0x14688d['countReScheduled'](_0x17a9c4)[_0x2178('0xbc')](sendMessageReschedule(_0x17a9c4))['catch'](loggerCatch(_0x2178('0xbd')));}else{_0x17a9c4[_0x2178('0x3f')]=_0x2178('0x204');if(_['isNil'](_0x225a9d[0x0])||_['isNil'](_0x225a9d[0x0]['Contact'])||_[_0x2178('0xb2')](_0x225a9d[0x0]['Contact']['phone'])){_0x14688d[_0x2178('0xd5')](_0x2178('0x206'),_0x17a9c4,_0x225a9d[0x0]);}else{_0x14688d[_0x2178('0xbe')](_['pick'](_0x225a9d[0x0],[_0x2178('0xda'),'Contact.phone']))[_0x2178('0xbc')](_0x14688d[_0x2178('0x208')](_0x17a9c4,_0x225a9d[0x0]))[_0x2178('0xb6')](_0x14688d[_0x2178('0xd4')](_0x2178('0x211'),_0x17a9c4));}}})[_0x2178('0xb6')](loggerGetContactDialer('[getContactDialerPredictive]',_0x17a9c4,0x1));emitVoiceQueueSummary(_0x17a9c4);};Dialer[_0x2178('0x1b')][_0x2178('0x1e4')]=function(_0x4d7b0a,_0x110ecf,_0x2e8681,_0xfeecae,_0x98b05d,_0x5276c0){loggerPredictive['info'](_0x2178('0x212'));loggerPredictive[_0x2178('0x84')]('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',_0x4d7b0a);loggerPredictive[_0x2178('0x84')](_0x2178('0x213'),_0x110ecf);loggerPredictive[_0x2178('0x84')](_0x2178('0x214'),_0x2e8681);loggerPredictive[_0x2178('0x84')](_0x2178('0x215'),_0xfeecae);loggerPredictive[_0x2178('0x84')](_0x2178('0x216'),_0x98b05d);loggerPredictive[_0x2178('0x84')](_0x2178('0x8a'));return new BPromise(function(_0x14f3a8,_0x56b525){if(_0x4d7b0a<=0x0||isNaN(_0x4d7b0a)){return _0x56b525(msgResponse('[abandonmentRate]',_0x2178('0x4a'),'m\x20=\x20'+_0x4d7b0a));}if(_0x2e8681<=0x0||isNaN(_0x2e8681)){return _0x56b525(msgResponse(_0x2178('0x217'),_0x2178('0x4a'),_0x2178('0x218')+_0x2e8681));}if(_0xfeecae<=0x0||isNaN(_0xfeecae)){return _0x56b525(msgResponse('[abandonmentRate]',_0x2178('0x4a'),_0x2178('0x219')+_0xfeecae));}if(_0x110ecf<=0x0||isNaN(_0x110ecf)){return _0x56b525(msgResponse(_0x2178('0x217'),_0x2178('0x4a'),_0x2178('0x21a')+_0x110ecf));}if(_0x98b05d<=0x0||isNaN(_0x98b05d)){return _0x56b525(msgResponse(_0x2178('0x217'),_0x2178('0x4a'),_0x2178('0x21b')+_0x98b05d));}_0x5276c0=_0x5276c0||0x0;var _0x5e2516=0x1/_0x2e8681;var _0x2f57e2=0x0;var _0xd30500=0x0;var _0x5889ad=0x0;var _0x519bdc=0x0;for(var _0x5b55d2=0x0;_0x5889ad<_0x98b05d;_0x5b55d2+=0x1){_0xd30500=_0x5b55d2/_0x110ecf;_0x2f57e2=(_0xfeecae*_0xd30500+_0x5276c0)/_0x5e2516;_0x5889ad=erlangb(_0x2f57e2,_0x4d7b0a);_0x519bdc=_0x2f57e2/_0x4d7b0a*(0x1-erlangb(_0x2f57e2,_0x4d7b0a));}return _0x14f3a8({'erlangCalls':_0x5b55d2,'erlangCallToSecond':_0x110ecf/_0x5b55d2,'erlangAbandonmentRate':_0x5889ad,'erlangBusyFactor':_0x519bdc});});};Dialer['prototype'][_0x2178('0x1e5')]=function(_0x149595,_0x567c55,_0x233d71,_0x25ceac,_0x16ee36,_0x1e48e6){loggerPredictive[_0x2178('0x84')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x2178('0x84')]('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',_0x149595);loggerPredictive[_0x2178('0x84')](_0x2178('0x213'),_0x567c55);loggerPredictive[_0x2178('0x84')]('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',_0x233d71);loggerPredictive[_0x2178('0x84')](_0x2178('0x215'),_0x25ceac);loggerPredictive[_0x2178('0x84')](_0x2178('0x21c'),_0x16ee36);loggerPredictive[_0x2178('0x84')](_0x2178('0x8a'));return new BPromise(function(_0x4609df,_0x2843da){if(_0x149595<=0x0||isNaN(_0x149595)){return _0x2843da(msgResponse(_0x2178('0x21d'),_0x2178('0x4a'),_0x2178('0x21e')+_0x149595));}if(_0x233d71<=0x0||isNaN(_0x233d71)){return _0x2843da(msgResponse(_0x2178('0x21d'),_0x2178('0x4a'),_0x2178('0x218')+_0x233d71));}if(_0x25ceac<=0x0||isNaN(_0x25ceac)){return _0x2843da(msgResponse(_0x2178('0x21d'),'Error','p\x20=\x20'+_0x25ceac));}if(_0x567c55<=0x0||isNaN(_0x567c55)){return _0x2843da(msgResponse('[busyFactor]','Error',_0x2178('0x21a')+_0x567c55));}if(_0x16ee36<=0x0||isNaN(_0x16ee36)){return _0x2843da(msgResponse('[busyFactor]',_0x2178('0x4a'),_0x2178('0x21f')+_0x16ee36));}_0x1e48e6=_0x1e48e6||0x0;var _0x2edf85=0x1/_0x233d71;var _0x1f1475=0x0;var _0x594cae=0x0;var _0x28bd90=0x0;var _0x4c7ead=0x0;for(var _0x2e88ef=0x0;_0x4c7ead<_0x16ee36;_0x2e88ef+=0x1){_0x594cae=_0x2e88ef/_0x567c55;_0x1f1475=(_0x25ceac*_0x594cae+_0x1e48e6)/_0x2edf85;_0x28bd90=erlangb(_0x1f1475,_0x149595);_0x4c7ead=_0x1f1475/_0x149595*(0x1-erlangb(_0x1f1475,_0x149595));}return _0x4609df({'erlangCalls':_0x2e88ef,'erlangCallToSecond':_0x567c55/_0x2e88ef,'erlangAbandonmentRate':_0x28bd90,'erlangBusyFactor':_0x4c7ead});});};module['exports']=Dialer; \ No newline at end of file +var _0x3ae9=['\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','syncCampaigns','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','erlangAbandonmentRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','Agent','run','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[getContactCampaign2]','available','dialLimitQueue','not_inuse','Contact.phone','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./agentComplete','env','127.0.0.1','rrmemory','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumDuration','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','erlangCalls','erlangBusyFactor','startPredictive','Trunk','callerid','md5','format','voice:queue:%s','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','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','endtime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','statedesc','Machine','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countdropretry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','agent','agiafterat','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','roundrobin','locked','stateinterface','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','paused','[booked][RR]','contactAgent-idHopper:\x20','unlockRR','preview','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup'];(function(_0x31b84b,_0x1d0f10){var _0x3a3552=function(_0x15fbaf){while(--_0x15fbaf){_0x31b84b['push'](_0x31b84b['shift']());}};_0x3a3552(++_0x1d0f10);}(_0x3ae9,0xdb));var _0x93ae=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3ae9[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x93ae('0x0'));var uuid=require(_0x93ae('0x1'));var moment=require(_0x93ae('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x93ae('0x3'));var ut=require(_0x93ae('0x4'));var config=require(_0x93ae('0x5'));var logger=require(_0x93ae('0x6'))('dialer');var loggerBooked=require(_0x93ae('0x6'))('booked');var loggerPredictive=require(_0x93ae('0x6'))(_0x93ae('0x7'));var loggerPredictiveCalls=require(_0x93ae('0x6'))(_0x93ae('0x8'));var loggerSyncQueueSummary=require(_0x93ae('0x6'))(_0x93ae('0x9'));var ami=require('../ami');config[_0x93ae('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x93ae('0xb'))(new Redis(config[_0x93ae('0xa')]));var cmHopper=require(_0x93ae('0xc'));var cmHopperHistory=require(_0x93ae('0xd'));var cmHopperBlack=require(_0x93ae('0xe'));var voiceQueueRt=require(_0x93ae('0xf'));var Action=require('./action');var History=require('./history');var Final=require(_0x93ae('0x10'));var AgentComplete=require(_0x93ae('0x11'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x93ae('0x12')]['XCALLY_IP_AGI']||_0x93ae('0x13');var strategy={'rrmemory':_0x93ae('0x14'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x93ae('0x15')][_0x93ae('0x16')]=function(_0x3c38b9){this[_0x93ae('0x17')]=this[_0x93ae('0x17')]?this[_0x93ae('0x17')]['finally'](_0x3c38b9):_0x3c38b9();};function Dialer(_0x11a9ce,_0x282094){this[_0x93ae('0x18')]=new Sequence();this['preview']=_0x282094;this[_0x93ae('0x19')]=_0x11a9ce['voiceQueues'];this['campaigns']=_0x11a9ce[_0x93ae('0x1a')];this['agents']=_0x11a9ce[_0x93ae('0x1b')];this[_0x93ae('0x1c')]=_0x11a9ce['trunks'];this[_0x93ae('0x1d')]=config[_0x93ae('0x1d')]||0x2;this[_0x93ae('0x1e')]={};this[_0x93ae('0x1f')]={};this['contactsId']={};this[_0x93ae('0x20')]={};this[_0x93ae('0x21')]={};this['startPredictive']={};this[_0x93ae('0x22')]={};this[_0x93ae('0x23')]={};this[_0x93ae('0x24')]={};this[_0x93ae('0x25')]={};ami['on'](_0x93ae('0x26'),this[_0x93ae('0x27')][_0x93ae('0x28')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x93ae('0x28')](this));ami['on'](_0x93ae('0x29'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x93ae('0x2a'),this[_0x93ae('0x2b')][_0x93ae('0x28')](this));ami['on'](_0x93ae('0x2c'),this[_0x93ae('0x9')][_0x93ae('0x28')](this));ami['on'](_0x93ae('0x2d'),this[_0x93ae('0x2e')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x93ae('0x28')](this));ami['on'](_0x93ae('0x2f'),this[_0x93ae('0x30')][_0x93ae('0x28')](this));ami['on'](_0x93ae('0x31'),this[_0x93ae('0x32')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x93ae('0x33')][_0x93ae('0x28')](this));this[_0x93ae('0x34')]();this[_0x93ae('0x35')]();}function isNotNull(_0x485622){return _0x485622!==null&&!_['isUndefined'](_0x485622);}function checkIsLoggedIn(_0x554318,_0x19aaaa){return function(){if(_0x19aaaa<=0x0){_0x554318['message']=_0x93ae('0x36');throw _0x554318[_0x93ae('0x37')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x4369c2){return _0x4369c2;}function checkIsActive(_0x1554cf,_0x11359d){return function(){if(!isActive(_0x11359d)){_0x1554cf[_0x93ae('0x38')]=_0x93ae('0x39');throw _0x1554cf[_0x93ae('0x37')]+_0x93ae('0x3a');}};}function checkInterval(_0x371c53){return function(){if(!isNotNull(_0x371c53['Interval'])){_0x371c53[_0x93ae('0x38')]=_0x93ae('0x3b');throw _0x371c53[_0x93ae('0x37')]+_0x93ae('0x3c');}if(!isNotNull(_0x371c53[_0x93ae('0x3d')][_0x93ae('0x3e')])){_0x371c53[_0x93ae('0x38')]=_0x93ae('0x3b');throw _0x371c53['name']+_0x93ae('0x3c');}if(!isNotNull(_['isEmpty'](_0x371c53[_0x93ae('0x3d')][_0x93ae('0x3e')]))){_0x371c53[_0x93ae('0x38')]=_0x93ae('0x3b');throw _0x371c53[_0x93ae('0x37')]+_0x93ae('0x3c');}};}function msgResponse(_0x47ed0b,_0x1b9777,_0x1453c0){return{'action':_0x47ed0b,'response':_0x1b9777,'message':_0x1453c0,'stack':_0x1453c0};}function myreject(_0x2aa4ae){return function(_0x4fab04){return _0x2aa4ae(msgResponse(_0x93ae('0x3f'),_0x93ae('0x40'),JSON[_0x93ae('0x41')](_0x4fab04)));};}function getSeconds(_0x4d4712,_0x588916){var _0x2e5b91=moment(_0x4d4712)[_0x93ae('0x42')](0x0);var _0x31e9b0=moment(_0x588916)[_0x93ae('0x42')](0x0);return _0x2e5b91[_0x93ae('0x43')](_0x31e9b0,_0x93ae('0x44'));}function emit(_0xc588e4,_0x4319ed,_0x174dca){io['to'](_0xc588e4)[_0x93ae('0x45')](_0x4319ed,_0x174dca);}function emitVoiceQueueSummary(_0x6ee0de){if(_0x6ee0de[_0x93ae('0x46')]===_0x93ae('0x47')){var _0x3fdf77={'id':_0x6ee0de['id'],'name':_0x6ee0de['name'],'strategy':_0x6ee0de[_0x93ae('0x48')],'answered':_0x6ee0de[_0x93ae('0x49')],'available':_0x6ee0de['available'],'loggedIn':_0x6ee0de[_0x93ae('0x4a')],'pTalking':_0x6ee0de['pTalking'],'sumBillable':_0x6ee0de['sumBillable'],'sumDuration':_0x6ee0de[_0x93ae('0x4b')],'sumHoldTime':_0x6ee0de['sumHoldTime']||0x0,'talking':_0x6ee0de[_0x93ae('0x4c')],'total':_0x6ee0de[_0x93ae('0x4d')],'type':_0x6ee0de[_0x93ae('0x46')],'unmanaged':_0x6ee0de[_0x93ae('0x4e')],'abandoned':_0x6ee0de[_0x93ae('0x4f')],'waiting':_0x6ee0de[_0x93ae('0x50')],'loggedInDb':_0x6ee0de['loggedInDb'],'dialActive':_0x6ee0de[_0x93ae('0x51')],'dialMethod':_0x6ee0de[_0x93ae('0x52')],'dialOriginateCallerIdName':_0x6ee0de[_0x93ae('0x53')],'dialOriginateCallerIdNumber':_0x6ee0de[_0x93ae('0x54')],'dialOriginateTimeout':_0x6ee0de[_0x93ae('0x55')],'dialPrefix':_0x6ee0de[_0x93ae('0x56')],'outboundAnswerAgiCallsDay':_0x6ee0de[_0x93ae('0x57')],'outboundAnswerCallsDay':_0x6ee0de[_0x93ae('0x58')],'outboundBlacklistCallsDay':_0x6ee0de[_0x93ae('0x59')],'outboundBusyCallsDay':_0x6ee0de[_0x93ae('0x5a')],'outboundCongestionCallsDay':_0x6ee0de[_0x93ae('0x5b')],'outboundDropCallsDayACS':_0x6ee0de['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x6ee0de[_0x93ae('0x5c')],'outboundDropCallsDayTimeout':_0x6ee0de[_0x93ae('0x5d')],'outboundNoAnswerCallsDay':_0x6ee0de['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x6ee0de['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x6ee0de[_0x93ae('0x5e')],'outboundReCallsDay':_0x6ee0de[_0x93ae('0x5f')],'outboundRejectCallsDay':_0x6ee0de[_0x93ae('0x60')],'outboundUnknownCallsDay':_0x6ee0de[_0x93ae('0x61')],'predictiveIntervalAnsweredCalls':_0x6ee0de[_0x93ae('0x62')],'predictiveIntervalAvgHoldtime':_0x6ee0de[_0x93ae('0x63')],'predictiveIntervalAvgTalktime':_0x6ee0de[_0x93ae('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x6ee0de[_0x93ae('0x65')],'predictiveIntervalDroppedCallsTimeout':_0x6ee0de['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x6ee0de[_0x93ae('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x6ee0de[_0x93ae('0x67')],'predictiveIntervalHitRate':_0x6ee0de[_0x93ae('0x68')],'predictiveIntervalMultiplicativeFactor':_0x6ee0de[_0x93ae('0x69')],'predictiveIntervalPauses':_0x6ee0de[_0x93ae('0x6a')],'predictiveIntervalAvailable':_0x6ee0de['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x6ee0de['predictiveIntervalTotalCalls'],'message':_0x6ee0de[_0x93ae('0x38')],'originated':_0x6ee0de['originated'],'erlangCalls':_0x6ee0de[_0x93ae('0x6b')],'erlangCallToSecond':_0x6ee0de['erlangCallToSecond'],'erlangAbandonmentRate':_0x6ee0de['erlangAbandonmentRate'],'erlangBusyFactor':_0x6ee0de[_0x93ae('0x6c')],'startPredictive':_0x6ee0de[_0x93ae('0x6d')],'startProgressive':_0x6ee0de[_0x93ae('0x22')]};if(_0x6ee0de[_0x93ae('0x6e')]){_0x3fdf77[_0x93ae('0x6e')]={'id':_0x6ee0de[_0x93ae('0x6e')]['id'],'name':_0x6ee0de[_0x93ae('0x6e')]['name'],'active':_0x6ee0de[_0x93ae('0x6e')]['active'],'callerid':_0x6ee0de['Trunk'][_0x93ae('0x6f')]};}if(_0x6ee0de[_0x93ae('0x3d')]){_0x3fdf77[_0x93ae('0x3d')]={'id':_0x6ee0de[_0x93ae('0x3d')]['id'],'name':_0x6ee0de['Interval'][_0x93ae('0x37')]};}var _0x4e7652=md5(JSON[_0x93ae('0x41')](_0x3fdf77));if(_0x6ee0de[_0x93ae('0x70')]!==_0x4e7652){_0x6ee0de[_0x93ae('0x70')]=_0x4e7652;emit(util[_0x93ae('0x71')](_0x93ae('0x72'),_0x3fdf77[_0x93ae('0x37')]),_0x93ae('0x73'),_0x3fdf77);}}}function emitCampaignSummary(_0x411ec6){if(_0x411ec6[_0x93ae('0x46')]==='ivr'){emit(util['format']('campaign:ivr:%s',_0x411ec6['name']),'campaign:save',_0x411ec6);}}function checkGetDataPredictive(_0x2a837b){if(isNotNull(_0x2a837b)&&!_[_0x93ae('0x74')](_0x2a837b)){loggerPredictive[_0x93ae('0x75')](_0x93ae('0x76'));loggerPredictive['info'](_0x93ae('0x77'),_0x2a837b['predictiveIntervalTotalCalls']);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x78'),_0x2a837b[_0x93ae('0x62')]);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x79'),_0x2a837b[_0x93ae('0x7a')]);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x7b'),_0x2a837b[_0x93ae('0x65')]);loggerPredictive['info'](_0x93ae('0x7c'),_0x2a837b['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x7d'),_0x2a837b[_0x93ae('0x64')]);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x7e'));if(_0x2a837b[_0x93ae('0x7f')]>0x0){if(!_[_0x93ae('0x80')](_0x2a837b['predictiveIntervalAvgTalktime'])&&_0x2a837b[_0x93ae('0x64')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x93ae('0x80')](_0x2a837b[_0x93ae('0x63')])&&_0x2a837b['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x93ae('0x75')](_0x93ae('0x81'));}else{loggerPredictive[_0x93ae('0x75')](_0x93ae('0x82'));}}else{loggerPredictive[_0x93ae('0x75')](_0x93ae('0x83'));}return![];}function mergeDataErlangB(_0x450ec8){return function(_0x2f3e1d){loggerPredictive[_0x93ae('0x75')](_0x93ae('0x84'));loggerPredictive[_0x93ae('0x75')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2f3e1d[_0x93ae('0x6b')]);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x85'),_0x2f3e1d[_0x93ae('0x86')]);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x87'),_0x2f3e1d['erlangAbandonmentRate']);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x88'),_0x2f3e1d[_0x93ae('0x6c')]);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x87'),_0x2f3e1d['erlangAbandonmentRate']);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x7e'));_[_0x93ae('0x89')](_0x450ec8,_0x2f3e1d);};}function getDiff(_0x492d93){var _0x930065=moment()[_0x93ae('0x42')](0x0);var _0x5605ca=moment(_0x492d93)[_0x93ae('0x42')](0x0);return _0x930065[_0x93ae('0x43')](_0x5605ca,_0x93ae('0x44'));}function ifInterval(_0x120e65,_0xb38655){if(_[_0x93ae('0x80')](_0xb38655)){return![];}return getDiff(_0xb38655)<_0x120e65*0x3c;}function freeVariablesPredictive(_0x339459){if(isNotNull(_0x339459)){if(!_['isUndefined'](_0x339459[_0x93ae('0x22')])){_0x339459['startProgressive']=undefined;loggerPredictive['info'](_0x339459[_0x93ae('0x37')],_0x93ae('0x8a'));}if(!_['isUndefined'](_0x339459[_0x93ae('0x6d')])){_0x339459[_0x93ae('0x6d')]=undefined;loggerPredictive[_0x93ae('0x75')](_0x339459[_0x93ae('0x37')],_0x93ae('0x8b'));}if(!_[_0x93ae('0x80')](_0x339459[_0x93ae('0x8c')])){clearInterval(_0x339459[_0x93ae('0x8c')]);_0x339459[_0x93ae('0x8c')]=undefined;loggerPredictive['info'](_0x339459['name'],_0x93ae('0x8d'));}}}function erlangb(_0xb656c9,_0xc622ff){if(_0xc622ff===0x0){return 0x0;}var _0x40a4b5=0x1;for(var _0xfe944d=0x1;_0xfe944d<=_0xc622ff;_0xfe944d+=0x1){_0x40a4b5=0x1+_0x40a4b5*_0xfe944d/_0xb656c9;}return 0x1/_0x40a4b5;}function isVoiceQueueOutbound(_0x20f2af){return _0x20f2af===_0x93ae('0x47');}function isNotPreview(_0x591020){return _0x591020!=='preview';}function isCampaignIvr(_0x12dd3c){return _0x12dd3c===_0x93ae('0x8e');}function getCallerId(_0x71867b,_0x3dd412,_0x45b6bb){if(!_[_0x93ae('0x80')](_0x45b6bb)&&typeof _0x45b6bb===_0x93ae('0x8f')&&!_[_0x93ae('0x74')](_0x45b6bb)){if(!_[_0x93ae('0x80')](_0x3dd412)&&typeof _0x3dd412==='string'&&!_[_0x93ae('0x74')](_0x3dd412)){return util['format']('\x22%s\x22\x20<%s>',_0x3dd412,_0x45b6bb);}return util[_0x93ae('0x71')](_0x93ae('0x90'),_0x45b6bb,_0x45b6bb);}if(!_[_0x93ae('0x80')](_0x71867b)&&typeof _0x71867b===_0x93ae('0x8f')&&!_[_0x93ae('0x74')](_0x71867b)){return _0x71867b;}return _0x93ae('0x91');}function loggerCatchQueueSummary(_0x1885fe,_0x44e861){return function(_0x1e0f7a){freeVariablesPredictive(_0x44e861);emitVoiceQueueSummary(_0x44e861);emitCampaignSummary(_0x44e861);loggerSyncQueueSummary[_0x93ae('0x92')](_0x1885fe,util[_0x93ae('0x93')](_0x1e0f7a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x24e2d8,_0x540324){return function(_0x5b5b5a){loggerPredictive[_0x93ae('0x92')](_0x540324[_0x93ae('0x37')],_0x24e2d8);loggerPredictive[_0x93ae('0x92')](_0x5b5b5a['stack']);freeVariablesPredictive(_0x540324);};}function loggerCatch(_0x57fcc8){return function(_0x21cff4){logger[_0x93ae('0x92')](_0x57fcc8,util['inspect'](_0x21cff4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x13055a){return _0x13055a&&!_[_0x93ae('0x80')](_0x13055a)&&_0x13055a[_0x93ae('0x94')]>0x0;}function decremetOriginate(_0x2ab139){if(!_[_0x93ae('0x80')](_0x2ab139)&&_0x2ab139!==null){if(typeof _0x2ab139['originated']!==_0x93ae('0x95')){if(_0x2ab139[_0x93ae('0x96')]>0x0){_0x2ab139[_0x93ae('0x96')]-=0x1;}else{logger['error'](_0x93ae('0x97'));}}}else{logger[_0x93ae('0x92')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2ba026,_0x239921,_0x2ccb2b){if(_0x239921>_0x2ccb2b){for(var _0x974aea=0x0;_0x974aea<_0x239921-_0x2ccb2b;_0x974aea+=0x1){decremetOriginate(_0x2ba026);}}}function loggerGetContactDialer(_0x563fe6,_0x26fd6e,_0x4d3bdf){return function(_0x2d68f4){checkContactLowerLimitOriginate(_0x26fd6e,_0x4d3bdf,0x0);logger[_0x93ae('0x92')](_0x563fe6,util['inspect'](_0x2d68f4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xc344b8){return function(_0x23a3fe){if(isNotNull(_0x23a3fe)&&isNotNull(_0x23a3fe[0x0])){if(_0x23a3fe[0x0]['contactsRescheduled']>0x0){_0xc344b8[_0x93ae('0x38')]=_0x93ae('0x98');logger[_0x93ae('0x75')]('[getContactDialer2][ReScheduled]'+_0xc344b8[_0x93ae('0x37')],_0x23a3fe[0x0]['contactsRescheduled'],'contacts');}else{_0xc344b8[_0x93ae('0x38')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x93ae('0x75')](_0x93ae('0x99')+_0xc344b8[_0x93ae('0x37')]);}}};}function notSendMessagesQueue(_0x18bed6){if(_0x18bed6[_0x93ae('0x9a')]){freeVariablesPredictive(_0x18bed6);if(_0x18bed6[_0x93ae('0x96')]===0x0&&_0x18bed6[_0x93ae('0x4c')]===0x0&&_0x18bed6[_0x93ae('0x50')]===0x0&&(_0x18bed6[_0x93ae('0x9b')]||0x0)===0x0){_0x18bed6[_0x93ae('0x9a')]=![];_0x18bed6['available']=0x0;_0x18bed6['message']=_0x93ae('0x39');loggerSyncQueueSummary[_0x93ae('0x92')](_0x93ae('0x9c'),_0x18bed6[_0x93ae('0x37')],_0x93ae('0x9d'));}else{_0x18bed6['message']=_0x93ae('0x9e');loggerSyncQueueSummary[_0x93ae('0x92')](_0x93ae('0x9c'),_0x18bed6[_0x93ae('0x37')],'is\x20disactive');}emitVoiceQueueSummary(_0x18bed6);}}function notSendMessagesCampaign(_0x505e8f){if(_0x505e8f['sendMessageOneNotActive']){if(_0x505e8f[_0x93ae('0x96')]===0x0){_0x505e8f['sendMessageOneNotActive']=![];_0x505e8f[_0x93ae('0x38')]=_0x93ae('0x39');loggerSyncQueueSummary['error'](_0x93ae('0x9f'),_0x505e8f[_0x93ae('0x37')],_0x93ae('0x9d'));}else{_0x505e8f[_0x93ae('0x38')]=_0x93ae('0x9e');loggerSyncQueueSummary[_0x93ae('0x92')](_0x93ae('0x9f'),_0x505e8f[_0x93ae('0x37')],_0x93ae('0xa0'));}emitCampaignSummary(_0x505e8f);}}function createObjHistory(_0x149814,_0xc1d90e,_0x3bfa80,_0x47eaf7,_0xc486eb){_0x149814[_0x93ae('0x38')]=_0x3bfa80;var _0x1f93b5=new Action(_0x149814,_0xc1d90e);var _0x91efd7=new History(_0x1f93b5);_0x91efd7[_0x93ae('0xa1')]=_0x47eaf7;_0x91efd7['statedesc']=_0xc486eb;_0x91efd7[_0x93ae('0xa2')]=_0x1f93b5['starttime'];return _0x91efd7;}Dialer[_0x93ae('0x15')][_0x93ae('0x35')]=function(){var _0x2445b6=this;setInterval(function(){_0x2445b6[_0x93ae('0xa3')](_0x2445b6['uniqueId'],_0x93ae('0xa4'));_0x2445b6['clearZombieChannels'](_0x2445b6[_0x93ae('0x1f')],_0x93ae('0xa5'));},0x32c8);};Dialer[_0x93ae('0x15')][_0x93ae('0xa3')]=function(_0x1c2429,_0x15d85a){var _0x4abe7b=this;for(var _0x238d88 in _0x1c2429){if(typeof _0x1c2429[_0x238d88]!==_0x93ae('0x95')){this[_0x93ae('0x18')]['enqueue'](function(){if(!_[_0x93ae('0xa6')](_0x1c2429[_0x238d88])){return ami[_0x93ae('0xa7')]({'action':_0x93ae('0xa8'),'channel':_0x1c2429[_0x238d88]['channel']})[_0x93ae('0xa9')](function(_0x5d59b0){if(_0x5d59b0[_0x93ae('0x38')]===_0x93ae('0xaa')){setTimeout(function(){if(_0x1c2429[_0x238d88]&&_0x1c2429[_0x238d88]['type']!==_0x93ae('0x8e')){_0x4abe7b[_0x93ae('0xab')](_0x4abe7b[_0x93ae('0x19')][_0x1c2429[_0x238d88][_0x93ae('0xac')]]);logger['error'](_0x93ae('0xad'),_0x15d85a,_0x238d88,_0x1c2429[_0x238d88][_0x93ae('0xac')]);delete _0x1c2429[_0x238d88];}if(_0x1c2429[_0x238d88]&&_0x1c2429[_0x238d88][_0x93ae('0x46')]==='ivr'){_0x4abe7b[_0x93ae('0xab')](_0x4abe7b[_0x93ae('0x1a')][_0x1c2429[_0x238d88][_0x93ae('0xac')]]);logger[_0x93ae('0x92')](_0x93ae('0xae'),_0x15d85a,_0x238d88,_0x1c2429[_0x238d88][_0x93ae('0xac')]);delete _0x1c2429[_0x238d88];}},0x2328);}});}});}}};Dialer[_0x93ae('0x15')]['countReScheduled']=function(_0x20827f){return BPromise[_0x93ae('0xaf')]()['then'](cmHopper[_0x93ae('0xb0')](_0x20827f))[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xb1')));};Dialer['prototype'][_0x93ae('0xb2')]=function(_0x54728b){return BPromise[_0x93ae('0xaf')]()[_0x93ae('0xb3')](cmHopperBlack[_0x93ae('0xb2')](_0x54728b))[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xb4')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x17de69){return BPromise[_0x93ae('0xaf')]()[_0x93ae('0xb3')](cmHopperBlack[_0x93ae('0xb5')](_0x17de69))['catch'](loggerCatch(_0x93ae('0xb6')));};Dialer[_0x93ae('0x15')][_0x93ae('0xb7')]=function(_0x51af24){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x51af24))[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xb8')));};Dialer[_0x93ae('0x15')]['rescheduleContact']=function(_0x43d8d2){return BPromise['resolve']()[_0x93ae('0xb3')](cmHopper[_0x93ae('0xb9')](_0x43d8d2))[_0x93ae('0xa9')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype']['unlockContact']=function(_0x4ae222,_0x6e3646,_0x487ff0){return BPromise['resolve']()[_0x93ae('0xb3')](cmHopper['unlockContact'](_0x4ae222,_0x6e3646,_0x487ff0))[_0x93ae('0xa9')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x93ae('0x15')][_0x93ae('0xba')]=function(_0x3c99f2,_0x42d0a5,_0x48dc1d,_0x2467d3,_0x14545c){return BPromise[_0x93ae('0xaf')]()['then'](cmHopper['getContactDialer'](_0x3c99f2,_0x42d0a5,_0x48dc1d,_0x2467d3))['catch'](function(_0x1eb18e){_0x14545c['temp']-=_0x48dc1d;_0x14545c[_0x93ae('0xbb')]=_0x14545c[_0x93ae('0xbb')]>0x0?_0x14545c[_0x93ae('0xbb')]:0x0;loggerCatch(_0x93ae('0xbc'))(_0x1eb18e);});};Dialer[_0x93ae('0x15')][_0x93ae('0xbd')]=function(_0x257bcf,_0x30d7cb,_0x1f0db0,_0x2b825e){return BPromise[_0x93ae('0xaf')]()[_0x93ae('0xb3')](cmHopper[_0x93ae('0xbd')](_0x257bcf,_0x30d7cb,_0x1f0db0))[_0x93ae('0xa9')](function(_0x4a66c8){_0x2b825e[_0x93ae('0xbb')]-=_0x30d7cb;_0x2b825e['temp']=_0x2b825e['temp']>0x0?_0x2b825e[_0x93ae('0xbb')]:0x0;loggerCatch(_0x93ae('0xbe'))(_0x4a66c8);});};Dialer[_0x93ae('0x15')][_0x93ae('0xbf')]=function(_0x111694){return BPromise[_0x93ae('0xaf')]()[_0x93ae('0xb3')](voiceQueueRt[_0x93ae('0xbf')](_0x111694))[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xc0')));};Dialer['prototype'][_0x93ae('0xc1')]=function(_0x1683fe){return BPromise[_0x93ae('0xaf')]()[_0x93ae('0xb3')](cmHopper[_0x93ae('0xc1')](_0x1683fe))[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xc2')));};Dialer[_0x93ae('0x15')][_0x93ae('0xc3')]=function(_0x4c68c9){return BPromise['resolve']()[_0x93ae('0xb3')](cmHopperHistory['createHistory'](_0x4c68c9))['catch'](loggerCatch(_0x93ae('0xc4')));};Dialer[_0x93ae('0x15')][_0x93ae('0xab')]=function(_0xf0f1af){if(!_[_0x93ae('0x80')](_0xf0f1af)&&_0xf0f1af!==null){if(typeof _0xf0f1af['originated']!==_0x93ae('0x95')){if(_0xf0f1af[_0x93ae('0x96')]>0x0){_0xf0f1af['originated']-=0x1;}else{logger[_0x93ae('0x92')](_0x93ae('0xc5'));}}}else{logger[_0x93ae('0x92')](_0x93ae('0xc6'));}};Dialer[_0x93ae('0x15')][_0x93ae('0xc7')]=function(_0x129443,_0x5502ae){var _0x5392c1=this;return function(_0x3b85a4){_0x5392c1[_0x93ae('0xab')](_0x5502ae);logger[_0x93ae('0x92')](_0x129443,util[_0x93ae('0x93')](_0x3b85a4,{'showHidden':![],'depth':null}));};};Dialer[_0x93ae('0x15')][_0x93ae('0xc8')]=function(_0x46fdb2,_0x2f6279,_0x444318){var _0x187353={'state':0x19,'statedesc':_0x93ae('0xc9')};this[_0x93ae('0xab')](_0x2f6279);this[_0x93ae('0xca')](_[_0x93ae('0x89')](_0x187353,_['pick'](_0x444318,[_0x93ae('0xcb'),_0x93ae('0xcc'),_0x93ae('0xcd'),_0x93ae('0xce'),_0x93ae('0xcf')])),_0x93ae('0xd0'),_0x93ae('0xd1'));logger['error'](_0x46fdb2);};Dialer['prototype'][_0x93ae('0xd2')]=function(_0x21e113){return _0x21e113===_0x93ae('0xd3');};Dialer[_0x93ae('0x15')][_0x93ae('0xd4')]=function(_0x1aeb35){return!_['isUndefined'](_0x1aeb35)&&_0x1aeb35&&!_['isUndefined'](_0x1aeb35['name'])&&!_[_0x93ae('0x80')](_0x1aeb35[_0x93ae('0xd5')])&&_0x1aeb35[_0x93ae('0xd5')]&&(this[_0x93ae('0x1c')][util['format'](_0x93ae('0xd6'),_0x1aeb35['name'])]['status']===_0x93ae('0xd7')||this[_0x93ae('0x1c')][util[_0x93ae('0x71')]('SIP/%s',_0x1aeb35['name'])][_0x93ae('0xa8')]==='unmonitored');};Dialer[_0x93ae('0x15')][_0x93ae('0xca')]=function(_0xebc7ea,_0x19cc71,_0x39da90){this[_0x93ae('0xc3')](_0xebc7ea)['catch'](loggerCatch(_0x19cc71));this[_0x93ae('0xc1')](_0xebc7ea)[_0x93ae('0xa9')](loggerCatch(_0x39da90));};Dialer[_0x93ae('0x15')][_0x93ae('0x30')]=function(_0x20f753){var _0xd28ba8=this[_0x93ae('0x20')][_0x20f753[_0x93ae('0xd8')]];var _0x57cbb3;if(!_['isNil'](_0x20f753)&&!_[_0x93ae('0xa6')](_0x20f753[_0x93ae('0xd9')])&&!_[_0x93ae('0xa6')](_0x20f753[_0x93ae('0xd9')]['amdstatus'])&&_0x20f753[_0x93ae('0xda')]===_0x93ae('0xdb')&&_0xd28ba8){if(_0xd28ba8['type']!==_0x93ae('0x8e')&&this[_0x93ae('0x19')][_0xd28ba8[_0x93ae('0xac')]][_0x93ae('0xdc')]&&_0x20f753[_0x93ae('0xdd')]===_0x93ae('0xde')){delete this[_0x93ae('0x20')][_0x20f753[_0x93ae('0xd8')]];this[_0x93ae('0xab')](this[_0x93ae('0x19')][_0xd28ba8[_0x93ae('0xac')]]);this[_0x93ae('0x19')][_0xd28ba8[_0x93ae('0xac')]][_0x93ae('0x58')]+=0x1;this[_0x93ae('0x19')][_0xd28ba8['queue']][_0x93ae('0x57')]+=0x1;_0x57cbb3=new Hangup(_0xd28ba8,_0x20f753);_0x57cbb3['state']=0x12;_0x57cbb3['statedesc']=_0x93ae('0xdf');_0x57cbb3[_0x93ae('0xe0')]=_0x93ae('0xe1');ami[_0x93ae('0x45')]('custom:amd',ut[_0x93ae('0xe2')](_0x57cbb3,_0x93ae('0xe3')));this[_0x93ae('0xca')](_0x57cbb3,_0x93ae('0xe4'),_0x93ae('0xe5'));}if(_0xd28ba8[_0x93ae('0x46')]!==_0x93ae('0x8e')&&this[_0x93ae('0x19')][_0xd28ba8[_0x93ae('0xac')]][_0x93ae('0xdc')]&&_0x20f753[_0x93ae('0xdd')]===_0x93ae('0xe6')){var _0xc5a12=this;return new BPromise(function(_0x129dab,_0x678df5){delete _0xc5a12[_0x93ae('0x20')][_0x20f753[_0x93ae('0xd8')]];_0xc5a12[_0x93ae('0xab')](_0xc5a12['voiceQueues'][_0xd28ba8[_0x93ae('0xac')]]);_0xc5a12['voiceQueues'][_0xd28ba8[_0x93ae('0xac')]][_0x93ae('0x58')]+=0x1;_0xc5a12[_0x93ae('0x19')][_0xd28ba8[_0x93ae('0xac')]][_0x93ae('0x57')]+=0x1;var _0x2058e2=_0xc5a12[_0x93ae('0x19')][_0xd28ba8[_0x93ae('0xac')]];var _0x50ecc0=new Hangup(_0xd28ba8,_0x20f753);_0x50ecc0[_0x93ae('0xa1')]=0x13;_0x50ecc0[_0x93ae('0xe7')]=_0x93ae('0xe8');_0x50ecc0[_0x93ae('0xe0')]=_0x93ae('0xe1');_0x50ecc0['countmachineretry']+=0x1;_0x50ecc0[_0x93ae('0xe9')]+=0x1;_0x50ecc0[_0x93ae('0xe3')]=!![];ami['emit'](_0x93ae('0xea'),ut[_0x93ae('0xe2')](_0x50ecc0,_0x93ae('0xe3')));_0xc5a12[_0x93ae('0xc3')](_0x50ecc0)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xeb')));if(_0x50ecc0[_0x93ae('0xec')]+_0x50ecc0[_0x93ae('0xed')]+_0x50ecc0[_0x93ae('0xee')]+_0x50ecc0[_0x93ae('0xef')]+_0x50ecc0['countdropretry']+_0x50ecc0[_0x93ae('0xf0')]+_0x50ecc0[_0x93ae('0xf1')]+_0x50ecc0[_0x93ae('0xf2')]>=_0x2058e2[_0x93ae('0xf3')]){_0xc5a12[_0x93ae('0xf4')](_0x50ecc0,_0x129dab,_0x678df5,_0x93ae('0xf5'));}else{if(_0x50ecc0[_0x93ae('0xf1')]>=_0x2058e2[_0x93ae('0xf6')]){_0xc5a12[_0x93ae('0xf7')](_0x50ecc0,_0x129dab,_0x678df5,'reason\x2019\x20machine....');}else{_0xc5a12['rescheduleContact']({'active':![],'countmachineretry':_0x50ecc0[_0x93ae('0xf1')],'scheduledat':moment()[_0x93ae('0xf8')](_0x2058e2['dialMachineRetryFrequency'],_0x93ae('0xf9'))['format'](_0x93ae('0xfa')),'ContactId':_0x50ecc0[_0x93ae('0xcb')],'ListId':_0x50ecc0[_0x93ae('0xcc')],'VoiceQueueId':_0x50ecc0[_0x93ae('0xce')]||undefined,'CampaignId':_0x50ecc0['CampaignId']||undefined})[_0x93ae('0xa9')](loggerCatch('[rescheduleContact][Machine]'));_0x129dab({'reschedule':0x1});}}});}if(_0xd28ba8[_0x93ae('0x46')]===_0x93ae('0x8e')&&this[_0x93ae('0x1a')][_0xd28ba8[_0x93ae('0xac')]][_0x93ae('0xdc')]&&_0x20f753[_0x93ae('0xdd')]===_0x93ae('0xde')){delete this['uniqueId'][_0x20f753['uniqueid']];this['updateOriginated'](this['campaigns'][_0xd28ba8[_0x93ae('0xac')]]);_0x57cbb3=new Hangup(_0xd28ba8,_0x20f753);_0x57cbb3[_0x93ae('0xa1')]=0x12;_0x57cbb3['statedesc']='HangupInAMD';_0x57cbb3['membername']=_0x93ae('0xe1');ami[_0x93ae('0x45')]('custom:amd',ut[_0x93ae('0xe2')](_0x57cbb3,_0x93ae('0xe3')));this[_0x93ae('0xca')](_0x57cbb3,_0x93ae('0xfb'),_0x93ae('0xfc'));}if(_0xd28ba8['type']===_0x93ae('0x8e')&&this[_0x93ae('0x1a')][_0xd28ba8[_0x93ae('0xac')]][_0x93ae('0xdc')]&&_0x20f753[_0x93ae('0xdd')]==='MACHINE'){var _0xc5a12=this;return new BPromise(function(_0x17081f,_0x104a93){delete _0xc5a12[_0x93ae('0x20')][_0x20f753['uniqueid']];_0xc5a12[_0x93ae('0xab')](_0xc5a12['campaigns'][_0xd28ba8[_0x93ae('0xac')]]);_0xc5a12[_0x93ae('0x1a')][_0xd28ba8[_0x93ae('0xac')]]['outboundAnswerCallsDay']+=0x1;_0xc5a12[_0x93ae('0x1a')][_0xd28ba8['queue']][_0x93ae('0x57')]+=0x1;var _0x384d73=_0xc5a12['campaigns'][_0xd28ba8['queue']];var _0x5da0fc=new Hangup(_0xd28ba8,_0x20f753);_0x5da0fc[_0x93ae('0xa1')]=0x13;_0x5da0fc[_0x93ae('0xe7')]=_0x93ae('0xe8');_0x5da0fc[_0x93ae('0xe0')]=_0x93ae('0xe1');_0x5da0fc[_0x93ae('0xf1')]+=0x1;_0x5da0fc[_0x93ae('0xe9')]+=0x1;_0x5da0fc['amd']=!![];ami['emit'](_0x93ae('0xea'),ut['buildObj'](_0x5da0fc,'amd'));_0xc5a12[_0x93ae('0xc3')](_0x5da0fc)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xeb')));if(_0x5da0fc['countbusyretry']+_0x5da0fc[_0x93ae('0xed')]+_0x5da0fc[_0x93ae('0xee')]+_0x5da0fc[_0x93ae('0xef')]+_0x5da0fc[_0x93ae('0xfd')]+_0x5da0fc[_0x93ae('0xf0')]+_0x5da0fc['countmachineretry']+_0x5da0fc[_0x93ae('0xf2')]>=_0x384d73['dialGlobalMaxRetry']){_0xc5a12[_0x93ae('0xf4')](_0x5da0fc,_0x17081f,_0x104a93,_0x93ae('0xf5'));}else{if(_0x5da0fc['countmachineretry']>=_0x384d73[_0x93ae('0xf6')]){_0xc5a12[_0x93ae('0xf7')](_0x5da0fc,_0x17081f,_0x104a93,'reason\x2019\x20machine....');}else{_0xc5a12[_0x93ae('0xb9')]({'active':![],'countmachineretry':_0x5da0fc[_0x93ae('0xf1')],'scheduledat':moment()['add'](_0x384d73['dialMachineRetryFrequency'],_0x93ae('0xf9'))[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x5da0fc[_0x93ae('0xcb')],'ListId':_0x5da0fc['ListId'],'VoiceQueueId':_0x5da0fc['VoiceQueueId']||undefined,'CampaignId':_0x5da0fc[_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xfe')));_0x17081f({'reschedule':0x1});}}});}}};Dialer[_0x93ae('0x15')][_0x93ae('0x2e')]=function(_0x5c8cb0){var _0x5c5937=this[_0x93ae('0x20')][_0x5c8cb0[_0x93ae('0xd8')]];var _0xf5bb85=this;var _0x4f981a;if(_0x5c5937&&_0x5c5937[_0x93ae('0x46')]===_0x93ae('0x8e')){delete this[_0x93ae('0x20')][_0x5c8cb0[_0x93ae('0xd8')]];this[_0x93ae('0xab')](this[_0x93ae('0x1a')][_0x5c5937[_0x93ae('0xac')]]);this['campaigns'][_0x5c5937[_0x93ae('0xac')]][_0x93ae('0xff')]+=0x1;_0x4f981a=new Hangup(_0x5c5937,_0x5c8cb0);this[_0x93ae('0xc3')](_0x4f981a)[_0x93ae('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x4f981a)['catch'](loggerCatch(_0x93ae('0x100')));}if(_0x5c5937&&_0x5c5937[_0x93ae('0x46')]!==_0x93ae('0x8e')&&isNotNull(this[_0x93ae('0x19')][_0x5c5937[_0x93ae('0xac')]][_0x93ae('0x101')])){delete this[_0x93ae('0x20')][_0x5c8cb0[_0x93ae('0xd8')]];this[_0x93ae('0xab')](this[_0x93ae('0x19')][_0x5c5937['queue']]);this[_0x93ae('0x19')][_0x5c5937[_0x93ae('0xac')]][_0x93ae('0x58')]+=0x1;this['voiceQueues'][_0x5c5937[_0x93ae('0xac')]][_0x93ae('0x57')]+=0x1;_0x4f981a=new Hangup(_0x5c5937,_0x5c8cb0);_0x4f981a[_0x93ae('0xa1')]=0x10;_0x4f981a['statedesc']=_0x93ae('0x102');_0x4f981a[_0x93ae('0xe0')]=_0x93ae('0x103');this[_0x93ae('0xc3')](_0x4f981a)['catch'](loggerCatch(_0x93ae('0x104')));this[_0x93ae('0xc1')](_0x4f981a)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x100')));}if(_0x5c5937&&_0x5c5937['type']!==_0x93ae('0x8e')&&!isNotNull(this[_0x93ae('0x19')][_0x5c5937[_0x93ae('0xac')]][_0x93ae('0x101')])){delete this[_0x93ae('0x20')][_0x5c8cb0['uniqueid']];this[_0x93ae('0xab')](this[_0x93ae('0x19')][_0x5c5937[_0x93ae('0xac')]]);this[_0x93ae('0x19')][_0x5c5937[_0x93ae('0xac')]][_0x93ae('0x61')]+=0x1;_0x4f981a=new Hangup(_0x5c5937,_0x5c8cb0);_0x4f981a[_0x93ae('0xa1')]=0xc;_0x4f981a[_0x93ae('0xe7')]=_0x5c8cb0[_0x93ae('0x105')];_0x4f981a['membername']=_0x93ae('0x106');this[_0x93ae('0xc3')](_0x4f981a)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x104')));this[_0x93ae('0xc1')](_0x4f981a)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x93ae('0x2b')]=function(_0x7b711){var _0x394db7=this[_0x93ae('0x20')][_0x7b711[_0x93ae('0xd8')]];var _0x144912=this;if(this[_0x93ae('0x19')][_0x7b711['queue']]){if(_0x394db7&&_0x394db7['type']!==_0x93ae('0x8e')){delete this['uniqueId'][_0x7b711[_0x93ae('0xd8')]];this[_0x93ae('0x19')][_0x7b711[_0x93ae('0xac')]][_0x93ae('0x58')]+=0x1;var _0x1e9179=new AgentComplete(_0x394db7,_0x7b711);if(_0x7b711['reason']===_0x93ae('0x107')){_0x1e9179[_0x93ae('0x108')]=this[_0x93ae('0x19')][_0x7b711[_0x93ae('0xac')]]['dialQueueProject2']&&this[_0x93ae('0x19')][_0x7b711[_0x93ae('0xac')]]['dialAgiAfterHangupAgent']?moment()[_0x93ae('0x71')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x93ae('0xc3')](_0x1e9179)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x93ae('0xc1')](_0x1e9179)['catch'](loggerCatch(_0x93ae('0x109')));}}};Dialer[_0x93ae('0x15')][_0x93ae('0x27')]=function(_0x3a2956){if(this['voiceQueues'][_0x3a2956['queue']]){if(this[_0x93ae('0x20')][_0x3a2956['uniqueid']]&&this['uniqueId'][_0x3a2956[_0x93ae('0xd8')]][_0x93ae('0x46')]!=='ivr'){this[_0x93ae('0xab')](this[_0x93ae('0x19')][_0x3a2956[_0x93ae('0xac')]]);this['uniqueId'][_0x3a2956['uniqueid']][_0x93ae('0x10a')]=moment()[_0x93ae('0x71')](_0x93ae('0xfa'));}}};Dialer[_0x93ae('0x15')][_0x93ae('0x10b')]=function(_0x3a6126){this[_0x93ae('0xc3')](_0x3a6126)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x10c')));this[_0x93ae('0xc1')](_0x3a6126)[_0x93ae('0xa9')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x93ae('0x15')]['syncQueueCallerAbandon']=function(_0x2d9a45){var _0x277505=this['uniqueId'][_0x2d9a45[_0x93ae('0xd8')]];var _0x554c01=this;if(this['voiceQueues'][_0x2d9a45[_0x93ae('0xac')]]){if(_0x277505&&_0x277505[_0x93ae('0x46')]!==_0x93ae('0x8e')){delete this['uniqueId'][_0x2d9a45['uniqueid']];this[_0x93ae('0xab')](this[_0x93ae('0x19')][_0x2d9a45['queue']]);_0x277505[_0x93ae('0x10d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3c7000=new QueueCallerAbandon(_0x277505,_0x2d9a45);if(getSeconds(_0x277505[_0x93ae('0x10d')],_0x277505[_0x93ae('0x10e')])>=_0x277505[_0x93ae('0x10f')]){this[_0x93ae('0x19')][_0x2d9a45['queue']][_0x93ae('0x7a')]+=0x1;this[_0x93ae('0x19')][_0x2d9a45['queue']][_0x93ae('0x5d')]+=0x1;this['voiceQueues'][_0x2d9a45['queue']][_0x93ae('0x67')]+=0x1;_0x3c7000[_0x93ae('0xa1')]=0xa;_0x3c7000[_0x93ae('0xe7')]=_0x93ae('0x110');_0x3c7000[_0x93ae('0x111')]=_0x93ae('0x112');_0x3c7000[_0x93ae('0x108')]=this[_0x93ae('0x19')][_0x2d9a45[_0x93ae('0xac')]][_0x93ae('0x113')]?moment()[_0x93ae('0x71')](_0x93ae('0xfa')):undefined;_0x3c7000[_0x93ae('0xfd')]+=0x1;_0x3c7000[_0x93ae('0xe9')]+=0x1;if(_0x3c7000['countdropretry']>=this[_0x93ae('0x19')][_0x2d9a45[_0x93ae('0xac')]][_0x93ae('0x114')]){this[_0x93ae('0x10b')](_0x3c7000);}else{this[_0x93ae('0xb9')]({'active':![],'countdropretry':_0x3c7000[_0x93ae('0xfd')],'scheduledat':moment()['add'](this[_0x93ae('0x19')][_0x2d9a45['queue']][_0x93ae('0x115')],_0x93ae('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x277505[_0x93ae('0xcb')],'ListId':_0x277505['ListId'],'VoiceQueueId':_0x277505[_0x93ae('0xce')]||undefined,'CampaignId':_0x277505['CampaignId']||undefined})[_0x93ae('0xa9')](loggerCatch('[rescheduleContact][Drop]'));var _0x6394a2=new History(_0x3c7000);_0x6394a2[_0x93ae('0xa1')]=0xa;_0x6394a2['statedesc']=_0x93ae('0x110');_0x6394a2['starttime']=moment()[_0x93ae('0x71')]('YYYY-MM-DD\x20HH:mm:ss');_0x6394a2[_0x93ae('0xa2')]=_0x6394a2[_0x93ae('0x116')];_0x6394a2[_0x93ae('0x117')]=_0x3c7000['calleridname'];_0x6394a2[_0x93ae('0x118')]=_0x3c7000['calleridnum'];this[_0x93ae('0xc3')](_0x6394a2)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x119')));}}else{this[_0x93ae('0x19')][_0x2d9a45[_0x93ae('0xac')]][_0x93ae('0x65')]+=0x1;this[_0x93ae('0x19')][_0x2d9a45[_0x93ae('0xac')]][_0x93ae('0x5c')]+=0x1;_0x3c7000[_0x93ae('0xa1')]=0xb;_0x3c7000[_0x93ae('0xe7')]=_0x93ae('0x11a');_0x3c7000[_0x93ae('0x111')]=_0x93ae('0x11b');_0x3c7000[_0x93ae('0xf0')]+=0x1;_0x3c7000[_0x93ae('0xe9')]+=0x1;if(_0x3c7000['countabandonedretry']>=this[_0x93ae('0x19')][_0x2d9a45[_0x93ae('0xac')]][_0x93ae('0x11c')]){this[_0x93ae('0x10b')](_0x3c7000);}else{this[_0x93ae('0xb9')]({'active':![],'countabandonedretry':_0x3c7000[_0x93ae('0xf0')],'scheduledat':moment()[_0x93ae('0xf8')](this['voiceQueues'][_0x2d9a45['queue']][_0x93ae('0x11d')],_0x93ae('0xf9'))[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x277505[_0x93ae('0xcb')],'ListId':_0x277505[_0x93ae('0xcc')],'VoiceQueueId':_0x277505[_0x93ae('0xce')]||undefined,'CampaignId':_0x277505['CampaignId']||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x11e')));var _0x6394a2=new History(_0x3c7000);_0x6394a2['state']=0xb;_0x6394a2['statedesc']='Abandoned';_0x6394a2[_0x93ae('0x116')]=moment()[_0x93ae('0x71')](_0x93ae('0xfa'));_0x6394a2[_0x93ae('0xa2')]=_0x6394a2[_0x93ae('0x116')];_0x6394a2['calleridname']=_0x3c7000['calleridname'];_0x6394a2['calleridnum']=_0x3c7000[_0x93ae('0x118')];this['createHistory'](_0x6394a2)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x11f')));}}}}};Dialer[_0x93ae('0x15')][_0x93ae('0x120')]=function(_0x4dfa3b){if(this[_0x93ae('0x1f')][_0x4dfa3b[_0x93ae('0xd8')]]){this[_0x93ae('0x1f')][_0x4dfa3b['uniqueid']][_0x93ae('0x121')]=_0x4dfa3b[_0x93ae('0x121')];}if(this[_0x93ae('0x20')][_0x4dfa3b[_0x93ae('0xd8')]]){this[_0x93ae('0x20')][_0x4dfa3b['uniqueid']][_0x93ae('0x121')]=_0x4dfa3b[_0x93ae('0x121')];}};Dialer[_0x93ae('0x15')][_0x93ae('0x32')]=function(_0x1e4a7a){if(strategy[this['voiceQueues'][this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]][_0x93ae('0xac')]][_0x93ae('0x48')]]===_0x93ae('0x123')){if(this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]]&&_[_0x93ae('0xa6')](this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]][_0x93ae('0x124')])&&_0x1e4a7a[_0x93ae('0xa8')]==='1'&&_0x1e4a7a['paused']==='0'){if(this[_0x93ae('0x1b')][_0x1e4a7a['stateinterface']]){if(!this[_0x93ae('0x1b')][_0x1e4a7a[_0x93ae('0x125')]][_0x93ae('0x124')]){this[_0x93ae('0x1b')][_0x1e4a7a[_0x93ae('0x125')]][_0x93ae('0x124')]=!![];this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]][_0x93ae('0x124')]=!![];this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]][_0x93ae('0x125')]=_0x1e4a7a[_0x93ae('0x125')];}}}}else if((strategy[this[_0x93ae('0x19')][this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]][_0x93ae('0xac')]][_0x93ae('0x48')]]||'rrmemory')===_0x93ae('0x14')){if(this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]]){if(this['agents'][_0x1e4a7a[_0x93ae('0x125')]]){this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]]['stateinterface']=_0x1e4a7a[_0x93ae('0x125')];if(_[_0x93ae('0xa6')](this['queueBooked'][this['actions'][_0x1e4a7a['actionid']][_0x93ae('0xac')]])){this['queueBooked'][this['actions'][_0x1e4a7a[_0x93ae('0x122')]][_0x93ae('0xac')]]=[];}this[_0x93ae('0x24')][this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]][_0x93ae('0xac')]][_0x93ae('0x126')](_[_0x93ae('0x89')](_[_0x93ae('0x127')](this[_0x93ae('0x1f')][_0x1e4a7a[_0x93ae('0x122')]],[_0x93ae('0x128'),_0x93ae('0x125')]),{'status':_0x1e4a7a[_0x93ae('0xa8')],'paused':_0x1e4a7a['paused']}));}}}};function unlockQueueStatus(_0x32339f,_0x22106a){setTimeout(function(){if(_[_0x93ae('0x80')](_0x32339f[_0x93ae('0x129')])){loggerBooked[_0x93ae('0x92')](_0x93ae('0x12a'),_0x22106a);}_0x32339f[_0x93ae('0x129')]=!![];loggerBooked['info'](_0x93ae('0x12b'),_0x22106a,JSON[_0x93ae('0x41')](_['pick'](_0x32339f,[_0x93ae('0x37'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x93ae('0x15')][_0x93ae('0x33')]=function(_0x332145){var _0x52e2d1=this;var _0x3aacf0=_0x52e2d1[_0x93ae('0x19')][_0x52e2d1[_0x93ae('0x1f')][_0x332145['actionid']][_0x93ae('0xac')]];if(strategy[this[_0x93ae('0x19')][this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]]['queue']]['strategy']]===_0x93ae('0x123')){if(this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]]&&this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0x125')]){this['preview']['run'](this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0x128')],this['actions'][_0x332145[_0x93ae('0x122')]][_0x93ae('0x125')])[_0x93ae('0xa9')](function(_0x2589db){logger[_0x93ae('0x92')](_0x93ae('0x12c'),util[_0x93ae('0x93')](_0x2589db,{'showHidden':![],'depth':null}));})[_0x93ae('0x12d')](function(){_0x52e2d1[_0x93ae('0xab')](_0x52e2d1[_0x93ae('0x19')][_0x52e2d1[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]]);_0x52e2d1[_0x93ae('0x1b')][_0x52e2d1[_0x93ae('0x1f')][_0x332145['actionid']][_0x93ae('0x125')]][_0x93ae('0x124')]=![];delete _0x52e2d1[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]];unlockQueueStatus(_0x3aacf0);});}else{this[_0x93ae('0xab')](this[_0x93ae('0x19')][this['actions'][_0x332145['actionid']]['queue']]);this[_0x93ae('0xb9')]({'active':![],'ContactId':this['actions'][_0x332145[_0x93ae('0x122')]]['ContactId'],'ListId':this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]]['ListId'],'VoiceQueueId':this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xcf')]||undefined})['catch'](loggerCatch(_0x93ae('0x12e')));delete this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]];unlockQueueStatus(_0x3aacf0);}}else if((strategy[this['voiceQueues'][this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]][_0x93ae('0x48')]]||_0x93ae('0x14'))===_0x93ae('0x14')){var _0x4bbd5e;if(this['actions'][_0x332145[_0x93ae('0x122')]]&&!_[_0x93ae('0x74')](this['queueBooked'][this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]])){if(this[_0x93ae('0x25')][_0x52e2d1[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]]){this['queueBookedRR'][_0x52e2d1[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]]=this[_0x93ae('0x25')][this[_0x93ae('0x1f')][_0x332145['actionid']][_0x93ae('0xac')]]?this[_0x93ae('0x25')][this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]]:this[_0x93ae('0x24')][this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]]?this[_0x93ae('0x24')][this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]]['_rr']||0x0:0x0;}this[_0x93ae('0x24')][this[_0x93ae('0x1f')][_0x332145['actionid']][_0x93ae('0xac')]]['_rr']=this['queueBookedRR'][this[_0x93ae('0x1f')][_0x332145[_0x93ae('0x122')]][_0x93ae('0xac')]];for(var _0x4d61e8=0x0;_0x4d61e8=0x0;})[_0x93ae('0xa9')](myreject(_0x2c11db)));}}else{_0x513dec['push'](ami[_0x93ae('0xa7')]({'action':_0x93ae('0x146'),'command':util['format'](_0x93ae('0x147'),_0x281ac1,!_[_0x93ae('0x80')](config['timezones'][_0xd6c655])?_0xd6c655:'')})['then'](function(_0x220cf4){return _0x220cf4[_0x93ae('0x149')]['indexOf'](_0x93ae('0x14b'))>=0x0;})['catch'](myreject(_0x2c11db)));}BPromise[_0x93ae('0x14c')](_0x513dec)[_0x93ae('0xb3')](function(_0x21001c){var _0x54e540=_[_0x93ae('0x14d')](_0x21001c);if(_0x54e540){return _0x1d6a19(_0x54e540);}else{_0x5d058b[_0x93ae('0x38')]=_0x3a0888?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x2c11db(msgResponse(_0x93ae('0x14e'),_0x93ae('0x141'),_0x93ae('0x14f')+_0x3a0888+'\x20'+_0x13d9c5+_0x93ae('0x150')+util[_0x93ae('0x93')](_0x281ac1,{'showHidden':![],'depth':null})+_0x93ae('0x151')+_0xd6c655));}})[_0x93ae('0xa9')](function(_0x29c525){return _0x2c11db(msgResponse(_0x93ae('0x140'),'Failure',JSON[_0x93ae('0x41')](_0x29c525)));});});};Dialer['prototype'][_0x93ae('0x152')]=function(_0x7efff0){var _0x4ec4e4=this;return function(){switch(_0x7efff0['dialMethod']){case _0x93ae('0x153'):freeVariablesPredictive(_0x7efff0);_0x4ec4e4[_0x93ae('0x154')](_0x7efff0,0x1);break;case _0x93ae('0x155'):freeVariablesPredictive(_0x7efff0);_0x4ec4e4[_0x93ae('0x154')](_0x7efff0,_0x7efff0[_0x93ae('0x156')]);break;case'predictive':_0x4ec4e4['predictive'](_0x7efff0);break;case _0x93ae('0x157'):freeVariablesPredictive(_0x7efff0);_0x4ec4e4[_0x93ae('0x154')](_0x7efff0,0x1);break;default:freeVariablesPredictive(_0x7efff0);logger[_0x93ae('0x92')](_0x93ae('0x158'),_0x7efff0[_0x93ae('0x37')],_0x93ae('0x159'));}};};Dialer[_0x93ae('0x15')]['launchHandleIvr']=function(_0x30e2da){var _0x5555e7=this;return function(){_0x5555e7[_0x93ae('0x15a')](_0x30e2da);};};Dialer['prototype']['syncQueueSummary']=function(_0x4c3ec5){var _0x2479b1=this;if(isNotPreview(_0x4c3ec5[_0x93ae('0x52')])){if(isVoiceQueueOutbound(_0x4c3ec5[_0x93ae('0x46')])&&isActive(_0x4c3ec5[_0x93ae('0x51')])){_0x4c3ec5[_0x93ae('0x9a')]=!![];BPromise[_0x93ae('0xaf')]()['then'](checkIsLoggedIn(_0x4c3ec5,_0x4c3ec5[_0x93ae('0x4a')]))['then'](checkIsActive(_0x4c3ec5,_0x4c3ec5[_0x93ae('0x51')]))['then'](checkInterval(_0x4c3ec5))[_0x93ae('0xb3')](_0x2479b1['checkIsTrunkReachable'](_0x4c3ec5))[_0x93ae('0xb3')](_0x2479b1[_0x93ae('0x13f')](_0x4c3ec5[_0x93ae('0x15b')],_0x4c3ec5[_0x93ae('0x15c')],_0x4c3ec5[_0x93ae('0x37')],_0x4c3ec5))[_0x93ae('0xb3')](_0x2479b1[_0x93ae('0x15d')](_0x4c3ec5[_0x93ae('0x3d')],_0x4c3ec5['dialTimezone'],_0x4c3ec5['name'],_0x4c3ec5))['then'](_0x2479b1['checkDialMethod'](_0x4c3ec5))[_0x93ae('0xa9')](loggerCatchQueueSummary(_0x93ae('0x15e'),_0x4c3ec5));}else{notSendMessagesQueue(_0x4c3ec5);}}else{freeVariablesPredictive(_0x4c3ec5);}};Dialer[_0x93ae('0x15')][_0x93ae('0x15f')]=function(){var _0x1a1691=this;var _0x4da4e5;for(var _0xb3c15f in this[_0x93ae('0x1a')]){if(typeof this['campaigns'][_0xb3c15f]!=='undefined'){_0x4da4e5=this[_0x93ae('0x1a')][_0xb3c15f];if(isCampaignIvr(_0x4da4e5['type'])&&isActive(_0x4da4e5[_0x93ae('0xd5')])){_0x4da4e5[_0x93ae('0x9a')]=!![];BPromise[_0x93ae('0xaf')]()['then'](checkIsActive(_0x4da4e5,_0x4da4e5[_0x93ae('0xd5')]))[_0x93ae('0xb3')](checkInterval(_0x4da4e5))[_0x93ae('0xb3')](_0x1a1691[_0x93ae('0x13c')](_0x4da4e5))[_0x93ae('0xb3')](_0x1a1691['checkIfTime'](_0x4da4e5['dialGlobalInterval'],_0x4da4e5[_0x93ae('0x15c')],_0x4da4e5[_0x93ae('0x37')],_0x4da4e5))[_0x93ae('0xb3')](_0x1a1691[_0x93ae('0x15d')](_0x4da4e5[_0x93ae('0x3d')],_0x4da4e5[_0x93ae('0x15c')],_0x4da4e5[_0x93ae('0x37')],_0x4da4e5))[_0x93ae('0xb3')](_0x1a1691['launchHandleIvr'](_0x4da4e5))[_0x93ae('0xa9')](loggerCatchQueueSummary('[syncCampaigns]',_0x4da4e5));}else{notSendMessagesCampaign(_0x4da4e5);}}}};function getCallerIdRandom(_0x5dbf40,_0x47e9af){var _0x45d1cc;var _0x26d028;var _0x218ccc;if(_0x47e9af<=0x0){_0x47e9af=0x1;}_0x45d1cc=new RegExp(_0x93ae('0x160')+_0x47e9af+'}$');_0x26d028=Math[_0x93ae('0x161')](0xa,_0x47e9af-0x1);_0x218ccc=Math[_0x93ae('0x161')](0xa,_0x47e9af)-0x1;return util[_0x93ae('0x71')]('%s',_['replace'](_0x5dbf40,_0x45d1cc,_[_0x93ae('0x162')](_0x26d028,_0x218ccc)));}function extractCalleridName(_0x41a4e4){var _0x533e5a=_0x41a4e4[_0x93ae('0x163')](/"(.*?)"/);return _0x533e5a?_0x533e5a[0x1]:_0x41a4e4;}function extractCalleridNumber(_0x123cff){var _0x598a68=_0x123cff[_0x93ae('0x163')](/<(.*?)>/);return _0x598a68?_0x598a68[0x1]:_0x123cff;}Dialer[_0x93ae('0x15')][_0x93ae('0x164')]=function(_0x5ca56f,_0x210284){var _0x1e02d6=this;var _0x29ea63=uuid['v4']();this[_0x93ae('0x1f')][_0x29ea63]=new Action(_0x5ca56f,_0x210284,_0x29ea63);return new BPromise(function(_0x4753a7,_0x2ca1f2){if(_[_0x93ae('0x80')](_0x5ca56f)&&typeof _0x5ca56f!==_0x93ae('0x165')){return _0x2ca1f2(msgResponse(_0x93ae('0x166'),'Failure',_0x93ae('0x167')));}if(_['isUndefined'](_0x210284[_0x93ae('0x168')][_0x93ae('0x169')])||_0x210284[_0x93ae('0x168')][_0x93ae('0x169')]===null){return _0x2ca1f2(msgResponse(_0x93ae('0x166'),_0x93ae('0x141'),_0x93ae('0x16a')));}var _0x236bb0={'XMD-CALLERID':_0x1e02d6[_0x93ae('0x1f')][_0x29ea63]['getCaller'](),'XMD-AGI':_0x5ca56f['dialQueueProject']?util[_0x93ae('0x71')](_0x93ae('0x16b'),ipAgi,_0x5ca56f[_0x93ae('0x101')]):_0x93ae('0x16c'),'XMD-AGIAFTER':_0x5ca56f[_0x93ae('0x113')]?util[_0x93ae('0x71')](_0x93ae('0x16b'),ipAgi,_0x5ca56f[_0x93ae('0x113')]):_0x93ae('0x16c'),'XMD-QUEUE':_0x5ca56f['type']===_0x93ae('0x47')?util[_0x93ae('0x71')]('\x22%s,%s%s,,,%s\x22',_0x5ca56f[_0x93ae('0x37')],_0x5ca56f[_0x93ae('0x16d')]||'',_0x5ca56f[_0x93ae('0x16e')]?'c':'',_0x5ca56f['dialQueueTimeout']||0x3):_0x93ae('0x16c'),'XMD-CONTACTID':_0x210284[_0x93ae('0xcb')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1e02d6[_0x93ae('0x1f')][_0x29ea63][_0x93ae('0x16f')](),'XMD-AMD':_0x5ca56f['dialAMDActive']?_0x93ae('0x170'):_0x93ae('0x16c'),'XMD-DESTINATION':_0x93ae('0xdb')};if(_0x5ca56f[_0x93ae('0xdc')]){_0x236bb0[_0x93ae('0x171')]=_0x5ca56f[_0x93ae('0x172')]||0x9c4;_0x236bb0[_0x93ae('0x173')]=_0x5ca56f['dialAMDGreeting']||0x5dc;_0x236bb0[_0x93ae('0x174')]=_0x5ca56f['dialAMDAfterGreetingSilence']||0x320;_0x236bb0['XMD-AMDTOTALANALYSISTIME']=_0x5ca56f[_0x93ae('0x175')]||0x1388;_0x236bb0[_0x93ae('0x176')]=_0x5ca56f['dialAMDMinWordLength']||0x64;_0x236bb0[_0x93ae('0x177')]=_0x5ca56f['dialAMDBetweenWordsSilence']||0x32;_0x236bb0[_0x93ae('0x178')]=_0x5ca56f[_0x93ae('0x179')]||0x3;_0x236bb0['XMD-AMDSILENCETHRESHOLD']=_0x5ca56f[_0x93ae('0x17a')]||0x100;_0x236bb0[_0x93ae('0x17b')]=_0x5ca56f[_0x93ae('0x17c')]||0x1388;}if(_0x5ca56f[_0x93ae('0x46')]===_0x93ae('0x47')){_0x236bb0['XMD-VOICEQUEUEID']=_0x210284[_0x93ae('0xce')];}else{_0x236bb0['XMD-CAMPAIGNID']=_0x210284[_0x93ae('0xcf')];}for(var _0x35ba4d in _0x210284['Contact']){if(typeof _0x210284[_0x93ae('0x168')][_0x35ba4d]!==_0x93ae('0x95')){if(isNotNull(_0x210284[_0x93ae('0x168')][_0x35ba4d])&&_0x35ba4d!=='id'&&_0x35ba4d!=='tags'&&_0x35ba4d!=='createdAt'&&_0x35ba4d!=='updatedAt'){_0x236bb0[util[_0x93ae('0x71')](_0x93ae('0x17d'),_0x93ae('0x17e'),_[_0x93ae('0x17f')](_0x35ba4d))]=_0x210284['Contact'][_0x35ba4d];}}}var _0x424516=_0x1e02d6[_0x93ae('0xd4')](_0x5ca56f[_0x93ae('0x6e')])?getCallerId(_0x5ca56f[_0x93ae('0x6e')][_0x93ae('0x6f')],_0x5ca56f[_0x93ae('0x53')],_0x5ca56f[_0x93ae('0x180')]>0x0?getCallerIdRandom(_0x5ca56f['dialOriginateCallerIdNumber'],_0x5ca56f[_0x93ae('0x180')]):_0x5ca56f['dialOriginateCallerIdNumber']):getCallerId(_[_0x93ae('0xa6')](_0x5ca56f[_0x93ae('0x13d')])?_0x5ca56f[_0x93ae('0x6e')][_0x93ae('0x6f')]:_0x5ca56f[_0x93ae('0x13d')]['callerid'],_0x5ca56f[_0x93ae('0x53')],_0x5ca56f['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5ca56f[_0x93ae('0x54')],_0x5ca56f[_0x93ae('0x180')]):_0x5ca56f[_0x93ae('0x54')]);if(_0x424516){_0x236bb0['XMD-ORIGINATECALLERIDNAME']=_0x1e02d6[_0x93ae('0x1f')][_0x29ea63][_0x93ae('0x181')]=extractCalleridName(_0x424516);_0x236bb0[_0x93ae('0x182')]=_0x1e02d6[_0x93ae('0x1f')][_0x29ea63][_0x93ae('0x183')]=extractCalleridNumber(_0x424516);}return ami['Action']({'actionid':_0x29ea63,'action':_0x93ae('0x166'),'channel':_0x1e02d6[_0x93ae('0xd4')](_0x5ca56f[_0x93ae('0x6e')])?util[_0x93ae('0x71')](_0x93ae('0x184'),_0x5ca56f['Trunk'][_0x93ae('0x37')],isNotNull(_0x5ca56f['dialPrefix'])?_0x5ca56f['dialPrefix'][_0x93ae('0x185')]()||'':'',_0x5ca56f[_0x93ae('0x186')]>0x0?_0x210284[_0x93ae('0x168')][_0x93ae('0x169')][_0x93ae('0x187')](_0x5ca56f['dialCutDigit']):_0x210284[_0x93ae('0x168')][_0x93ae('0x169')]):util['format'](_0x93ae('0x184'),_[_0x93ae('0xa6')](_0x5ca56f[_0x93ae('0x13d')])?_0x5ca56f[_0x93ae('0x6e')]['name']:_0x5ca56f[_0x93ae('0x13d')][_0x93ae('0x37')],isNotNull(_0x5ca56f['dialPrefix'])?_0x5ca56f[_0x93ae('0x56')]['trim']()||'':'',_0x5ca56f[_0x93ae('0x186')]>0x0?_0x210284[_0x93ae('0x168')][_0x93ae('0x169')]['substring'](_0x5ca56f[_0x93ae('0x186')]):_0x210284[_0x93ae('0x168')][_0x93ae('0x169')]),'callerid':_0x424516,'Exten':_0x93ae('0xdb'),'Context':_0x93ae('0x188'),'Priority':'1','variable':_0x236bb0,'timeout':(_0x5ca56f['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x29ea63})[_0x93ae('0xb3')](function(_0x171eb0){return _0x4753a7(_0x171eb0);})['catch'](function(_0x40b3ce){_0x5ca56f['outboundOriginateFailureCallsDay']+=0x1;var _0x219e0e=new History(_0x1e02d6[_0x93ae('0x1f')][_0x29ea63]);logger[_0x93ae('0x92')](util[_0x93ae('0x71')]('[originateError]:\x20%s',JSON['stringify'](_0x40b3ce)));_0x219e0e[_0x93ae('0xa1')]=0xe;_0x219e0e[_0x93ae('0xe7')]=_0x93ae('0x189');_0x219e0e[_0x93ae('0x116')]=moment()[_0x93ae('0x71')](_0x93ae('0xfa'));_0x219e0e[_0x93ae('0xa2')]=_0x219e0e[_0x93ae('0x116')];_0x1e02d6[_0x93ae('0xc3')](_0x219e0e)[_0x93ae('0xa9')](loggerCatch('[originate][error]'));_0x1e02d6[_0x93ae('0xc1')](_0x219e0e)['catch'](loggerCatch(_0x93ae('0x18a')))['finally'](function(){delete _0x1e02d6[_0x93ae('0x1f')][_0x29ea63];return _0x2ca1f2(msgResponse('originate','Error',_0x93ae('0x18b')));});});});};Dialer[_0x93ae('0x15')][_0x93ae('0x18c')]=function(_0x105639){var _0x5f1ae7=this[_0x93ae('0x1f')][_0x105639['actionid']];if(_0x5f1ae7){delete this['actions'][_0x105639[_0x93ae('0x122')]];_0x5f1ae7[_0x93ae('0x10e')]=moment()[_0x93ae('0x71')]('YYYY-MM-DD\x20HH:mm:ss');var _0x52cae7=_0x5f1ae7[_0x93ae('0x46')]===_0x93ae('0x8e')?this[_0x93ae('0x1a')][_0x5f1ae7['queue']]:this[_0x93ae('0x19')][_0x5f1ae7[_0x93ae('0x18d')]()];if(!this[_0x93ae('0xd2')](_0x105639[_0x93ae('0x18e')])){this[_0x93ae('0xab')](_0x52cae7);return this[_0x93ae('0x18f')](_0x5f1ae7,_0x52cae7,_0x105639)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x190')));}this[_0x93ae('0x20')][_0x105639['uniqueid']]=_0x5f1ae7;}};Dialer[_0x93ae('0x15')][_0x93ae('0x191')]=function(_0x3e88a9,_0x196a1e,_0x274be1){var _0x51f75c=new History(_0x196a1e);if(_0x51f75c[_0x93ae('0xec')]+_0x51f75c[_0x93ae('0xed')]+_0x51f75c[_0x93ae('0xee')]+_0x51f75c['countnosuchnumberretry']+_0x51f75c['countdropretry']+_0x51f75c['countabandonedretry']+_0x51f75c[_0x93ae('0xf1')]+_0x51f75c[_0x93ae('0xf2')]>=_0x274be1[_0x93ae('0xf3')]-0x1){return!![];}switch(_0x3e88a9){case 0x3:if(_0x51f75c['countnoanswerretry']>=_0x274be1[_0x93ae('0x192')]-0x1){return!![];}this[_0x93ae('0xb9')]({'active':![],'countnoanswerretry':_0x51f75c['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x93ae('0xf8')](_0x274be1[_0x93ae('0x193')],_0x93ae('0xf9'))[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x51f75c[_0x93ae('0xcb')],'ListId':_0x51f75c[_0x93ae('0xcc')],'VoiceQueueId':_0x51f75c[_0x93ae('0xce')]||undefined,'CampaignId':_0x51f75c[_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x194')));break;case 0x5:if(_0x51f75c[_0x93ae('0xec')]>=_0x274be1[_0x93ae('0x195')]-0x1){return!![];}this[_0x93ae('0xb9')]({'active':![],'countbusyretry':_0x51f75c[_0x93ae('0xec')]+=0x1,'scheduledat':moment()[_0x93ae('0xf8')](_0x274be1[_0x93ae('0x196')],_0x93ae('0xf9'))[_0x93ae('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x51f75c['ContactId'],'ListId':_0x51f75c[_0x93ae('0xcc')],'VoiceQueueId':_0x51f75c[_0x93ae('0xce')]||undefined,'CampaignId':_0x51f75c[_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x51f75c[_0x93ae('0xed')]>=_0x274be1['dialCongestionMaxRetry']-0x1){return!![];}this[_0x93ae('0xb9')]({'active':![],'countcongestionretry':_0x51f75c['countcongestionretry']+=0x1,'scheduledat':moment()[_0x93ae('0xf8')](_0x274be1[_0x93ae('0x197')],_0x93ae('0xf9'))[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x51f75c[_0x93ae('0xcb')],'ListId':_0x51f75c[_0x93ae('0xcc')],'VoiceQueueId':_0x51f75c['VoiceQueueId']||undefined,'CampaignId':_0x51f75c[_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x198')));break;case 0x0:if(_0x51f75c['countnosuchnumberretry']>=_0x274be1[_0x93ae('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x51f75c[_0x93ae('0xef')]+=0x1,'scheduledat':moment()['add'](_0x274be1['dialNoSuchNumberRetryFrequency'],_0x93ae('0xf9'))[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x51f75c[_0x93ae('0xcb')],'ListId':_0x51f75c[_0x93ae('0xcc')],'VoiceQueueId':_0x51f75c[_0x93ae('0xce')]||undefined,'CampaignId':_0x51f75c[_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x19a')));}break;case 0xa:if(_0x51f75c[_0x93ae('0xfd')]>=_0x274be1[_0x93ae('0x114')]-0x1){return!![];}this[_0x93ae('0xb9')]({'active':![],'countdropretry':_0x51f75c[_0x93ae('0xfd')]+=0x1,'scheduledat':moment()[_0x93ae('0xf8')](_0x274be1[_0x93ae('0x115')],_0x93ae('0xf9'))[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x51f75c[_0x93ae('0xcb')],'ListId':_0x51f75c[_0x93ae('0xcc')],'VoiceQueueId':_0x51f75c[_0x93ae('0xce')]||undefined,'CampaignId':_0x51f75c[_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x19b')));break;case 0xb:if(_0x51f75c['countabandonedretry']>=_0x274be1[_0x93ae('0x11c')]-0x1){return!![];}this[_0x93ae('0xb9')]({'active':![],'countabandonedretry':_0x51f75c[_0x93ae('0xf0')]+=0x1,'scheduledat':moment()[_0x93ae('0xf8')](_0x274be1[_0x93ae('0x11d')],'minutes')[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x51f75c['ContactId'],'ListId':_0x51f75c[_0x93ae('0xcc')],'VoiceQueueId':_0x51f75c[_0x93ae('0xce')]||undefined,'CampaignId':_0x51f75c['CampaignId']||undefined})[_0x93ae('0xa9')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x51f75c[_0x93ae('0xf1')]>=_0x274be1[_0x93ae('0xf6')]-0x1){return!![];}this[_0x93ae('0xb9')]({'active':![],'countmachineretry':_0x51f75c[_0x93ae('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x274be1[_0x93ae('0x19c')],'minutes')[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x51f75c['ContactId'],'ListId':_0x51f75c[_0x93ae('0xcc')],'VoiceQueueId':_0x51f75c['VoiceQueueId']||undefined,'CampaignId':_0x51f75c['CampaignId']||undefined})[_0x93ae('0xa9')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x51f75c[_0x93ae('0xf2')]>=_0x274be1[_0x93ae('0x19d')]-0x1){return!![];}this[_0x93ae('0xb9')]({'active':![],'countagentrejectretry':_0x51f75c[_0x93ae('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x274be1[_0x93ae('0x19e')],_0x93ae('0xf9'))[_0x93ae('0x71')](_0x93ae('0xfa')),'ContactId':_0x51f75c[_0x93ae('0xcb')],'ListId':_0x51f75c[_0x93ae('0xcc')],'VoiceQueueId':_0x51f75c[_0x93ae('0xce')]||undefined,'CampaignId':_0x51f75c[_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x19f')));break;default:return!![];}};Dialer[_0x93ae('0x15')][_0x93ae('0x18f')]=function(_0x88c23c,_0x5495df,_0x56083b){var _0x2340a3=this;var _0x17ffe0=new History(_0x88c23c);return new BPromise(function(_0x2c4646,_0x4d9794){if(_[_0x93ae('0x80')](_0x5495df)&&typeof _0x5495df!=='object'){return _0x4d9794(msgResponse('[callProgressDetecting]',_0x93ae('0x141'),_0x93ae('0x1a0')));}if(_['isUndefined'](_0x56083b)&&typeof _0x56083b!==_0x93ae('0x165')){return _0x4d9794(msgResponse('[callProgressDetecting]','Failure',_0x93ae('0x1a1')));}switch(_0x56083b[_0x93ae('0x1a2')]){case'0':_0x5495df[_0x93ae('0x1a3')]+=0x1;_0x17ffe0[_0x93ae('0xa1')]=0x0;_0x17ffe0['statedesc']=_0x93ae('0x1a4');_0x17ffe0[_0x93ae('0xef')]+=0x1;_0x17ffe0[_0x93ae('0xe9')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x93ae('0xe2')](_0x88c23c,_0x93ae('0x1a5')));_0x2340a3[_0x93ae('0xc3')](_0x17ffe0)[_0x93ae('0xa9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2340a3[_0x93ae('0x191')](0x0,_0x88c23c,_0x5495df)){if(_0x17ffe0['countnosuchnumberretry']>=_0x5495df[_0x93ae('0x199')]){_0x2340a3['createStateFinal'](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1a6'));}else{_0x2340a3['stateGlobal'](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1a6'));}}break;case'3':_0x5495df[_0x93ae('0x1a7')]+=0x1;_0x17ffe0[_0x93ae('0xa1')]=0x3;_0x17ffe0[_0x93ae('0xe7')]=_0x93ae('0x1a8');_0x17ffe0[_0x93ae('0xee')]+=0x1;_0x17ffe0[_0x93ae('0xe9')]+=0x1;ami[_0x93ae('0x45')](_0x93ae('0x1a9'),ut['buildObj'](_0x88c23c,_0x93ae('0x1aa')));_0x2340a3[_0x93ae('0xc3')](_0x17ffe0)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2340a3['checkRetriveMax'](0x3,_0x88c23c,_0x5495df)){if(_0x17ffe0[_0x93ae('0xee')]>=_0x5495df[_0x93ae('0x192')]){_0x2340a3['createStateFinal'](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1ab'));}else{_0x2340a3[_0x93ae('0xf4')](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1ab'));}}break;case'5':_0x5495df[_0x93ae('0x5a')]+=0x1;_0x17ffe0['state']=0x5;_0x17ffe0[_0x93ae('0xe7')]=_0x93ae('0x1ac');_0x17ffe0[_0x93ae('0xec')]+=0x1;_0x17ffe0[_0x93ae('0xe9')]+=0x1;ami[_0x93ae('0x45')](_0x93ae('0x1ad'),ut['buildObj'](_0x88c23c,'busy'));_0x2340a3[_0x93ae('0xc3')](_0x17ffe0)[_0x93ae('0xa9')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2340a3[_0x93ae('0x191')](0x5,_0x88c23c,_0x5495df)){if(_0x17ffe0[_0x93ae('0xec')]>=_0x5495df[_0x93ae('0x195')]){_0x2340a3[_0x93ae('0xf7')](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1ae'));}else{_0x2340a3[_0x93ae('0xf4')](_0x17ffe0,_0x2c4646,_0x4d9794,'reason\x205\x20busy');}}break;case'8':_0x5495df[_0x93ae('0x5b')]+=0x1;_0x17ffe0[_0x93ae('0xa1')]=0x8;_0x17ffe0[_0x93ae('0xe7')]=_0x93ae('0x1af');_0x17ffe0['countcongestionretry']+=0x1;_0x17ffe0['countglobal']+=0x1;ami[_0x93ae('0x45')](_0x93ae('0x1b0'),ut[_0x93ae('0xe2')](_0x88c23c,_0x93ae('0x1b1')));_0x2340a3[_0x93ae('0xc3')](_0x17ffe0)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x1b2')));if(_0x2340a3[_0x93ae('0x191')](0x8,_0x88c23c,_0x5495df)){if(_0x17ffe0[_0x93ae('0xed')]>=_0x5495df['dialCongestionMaxRetry']){_0x2340a3['createStateFinal'](_0x17ffe0,_0x2c4646,_0x4d9794,'reason\x208\x20congestion');}else{_0x2340a3['stateGlobal'](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1b3'));}}break;case'11':_0x5495df[_0x93ae('0x1b4')]+=0x1;_0x17ffe0[_0x93ae('0xa1')]=0xb;_0x17ffe0['statedesc']=_0x93ae('0x11a');_0x17ffe0['countabandonedretry']+=0x1;_0x17ffe0['countglobal']+=0x1;_0x2340a3['createHistory'](_0x17ffe0)[_0x93ae('0xa9')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2340a3[_0x93ae('0x191')](0xb,_0x88c23c,_0x5495df)){if(_0x17ffe0['countabandonedretry']>=_0x5495df['dialAbandonedMaxRetry']){_0x2340a3['createStateFinal'](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1b5'));}else{_0x2340a3['stateGlobal'](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1b5'));}}break;case'20':_0x5495df['outboundRejectCallsDay']+=0x1;_0x17ffe0[_0x93ae('0xa1')]=0x14;_0x17ffe0[_0x93ae('0xe7')]='AgentReject';_0x17ffe0[_0x93ae('0xf2')]+=0x1;_0x17ffe0['countglobal']+=0x1;ami[_0x93ae('0x45')]('custom:agentreject',ut[_0x93ae('0xe2')](_0x88c23c,_0x93ae('0x1b6')));_0x2340a3[_0x93ae('0xc3')](_0x17ffe0)['catch'](loggerCatch(_0x93ae('0x1b7')));if(_0x2340a3[_0x93ae('0x191')](0x14,_0x88c23c,_0x5495df)){if(_0x17ffe0['countagentrejectretry']>=_0x5495df['dialAgentRejectMaxRetry']){_0x2340a3['createStateFinal'](_0x17ffe0,_0x2c4646,_0x4d9794,_0x93ae('0x1b8'));}else{_0x2340a3['stateGlobal'](_0x17ffe0,_0x2c4646,_0x4d9794,'reason\x2020\x20agentreject');}}break;default:_0x5495df[_0x93ae('0x61')]+=0x1;_0x17ffe0[_0x93ae('0xa1')]=0xc;_0x17ffe0[_0x93ae('0xe7')]=_0x56083b[_0x93ae('0x1a2')];_0x2340a3[_0x93ae('0xc3')](_0x17ffe0)[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x1b9')));if(_0x2340a3[_0x93ae('0x191')](_0x56083b[_0x93ae('0x1a2')],_0x88c23c,_0x5495df)){if(_0x17ffe0[_0x93ae('0xec')]+_0x17ffe0[_0x93ae('0xed')]+_0x17ffe0[_0x93ae('0xee')]+_0x17ffe0['countnosuchnumberretry']+_0x17ffe0[_0x93ae('0xfd')]+_0x17ffe0[_0x93ae('0xf0')]+_0x17ffe0['countmachineretry']+_0x17ffe0['countagentrejectretry']>=_0x5495df[_0x93ae('0xf3')]){_0x2340a3[_0x93ae('0xf4')](_0x17ffe0,_0x2c4646,_0x4d9794,_0x56083b[_0x93ae('0x1a2')]);}else{_0x2340a3[_0x93ae('0xf7')](_0x17ffe0,_0x2c4646,_0x4d9794,_0x56083b[_0x93ae('0x1a2')]);}}}});};Dialer[_0x93ae('0x15')][_0x93ae('0xf4')]=function(_0x55d964,_0x13391b,_0x2e624d,_0xdc83c2){var _0x42719a=new Final(_0x55d964);_0x42719a[_0x93ae('0xa1')]=0xf;_0x42719a[_0x93ae('0xe7')]=_0x93ae('0x1ba');this[_0x93ae('0xf7')](_0x42719a,_0x13391b,_0x2e624d,_0xdc83c2);};Dialer['prototype'][_0x93ae('0xf7')]=function(_0x5b4801,_0x373f60,_0x56b2ba,_0x4c6142){this['moveContactManagedDialer'](_0x5b4801)[_0x93ae('0xb3')](function(){return _0x373f60(msgResponse(_0x93ae('0x1bb'),_0x93ae('0xd3'),_0x4c6142));})[_0x93ae('0xa9')](function(){return _0x56b2ba(msgResponse(_0x93ae('0x1bc'),_0x93ae('0x141'),_0x93ae('0x1bd')));});};Dialer[_0x93ae('0x15')]['predictive']=function(_0x3a762d){var _0x4bc2f9=_0x3a762d[_0x93ae('0x1be')]/0x64;var _0x324e3a=_0x3a762d[_0x93ae('0x5d')]/(_0x3a762d[_0x93ae('0x5d')]+_0x3a762d[_0x93ae('0x58')]);var _0x44746a=Math[_0x93ae('0x1bf')](_0x3a762d['predictiveIntervalAvailable']*(_0x3a762d['predictiveIntervalMaxThreshold']/0x64));var _0x2619b6=Math[_0x93ae('0x1bf')](_0x3a762d[_0x93ae('0x1c0')]*(_0x3a762d[_0x93ae('0x1c1')]/0x64));var _0x36aaef=_0x3a762d['available']+_0x3a762d[_0x93ae('0x4c')];var _0x5cee7c=Math['floor'](_0x3a762d[_0x93ae('0x6b')]*_0x3a762d[_0x93ae('0x1c2')]*_0x3a762d['predictiveIntervalHitRate']*_0x3a762d['predictiveIntervalMultiplicativeFactor']);if(_[_0x93ae('0x80')](_0x3a762d[_0x93ae('0x22')])){if(!_[_0x93ae('0x80')](_0x3a762d[_0x93ae('0x6d')])){_0x3a762d[_0x93ae('0x6d')]=undefined;loggerPredictive[_0x93ae('0x92')](_0x93ae('0x1c3'),_0x93ae('0x1c4'));}if(!_['isUndefined'](_0x3a762d[_0x93ae('0x8c')])){loggerPredictive['error'](_0x93ae('0x1c3'),_0x93ae('0x1c5'));clearInterval(_0x3a762d[_0x93ae('0x8c')]);_0x3a762d[_0x93ae('0x8c')]=undefined;}_0x3a762d[_0x93ae('0x22')]=moment()['format'](_0x93ae('0xfa'));loggerPredictive[_0x93ae('0x75')](_0x3a762d[_0x93ae('0x37')],_0x93ae('0x1c6'),_0x3a762d[_0x93ae('0x22')]);this[_0x93ae('0x154')](_0x3a762d,0x1);}else if(ifInterval(_0x3a762d[_0x93ae('0x1c7')],_0x3a762d[_0x93ae('0x22')])){this[_0x93ae('0x154')](_0x3a762d,0x1);loggerPredictiveCalls['info'](_0x93ae('0x1c8'),_0x3a762d['startProgressive'],_0x3a762d[_0x93ae('0x37')]);_0x3a762d[_0x93ae('0x6b')]=0x0;_0x3a762d[_0x93ae('0x67')]=0x0;}else if(_0x4bc2f9<_0x324e3a&&_0x3a762d[_0x93ae('0x1c9')]===_0x93ae('0x1ca')){freeVariablesPredictive(_0x3a762d);loggerPredictive[_0x93ae('0x75')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x93ae('0x1cb'),_0x324e3a,'startProgressive',_0x3a762d[_0x93ae('0x37')]);}else if(_0x5cee7c<_0x3a762d['predictiveIntervalErlangCallsDroppedCalls']&&_0x3a762d[_0x93ae('0x1c9')]===_0x93ae('0x1ca')){freeVariablesPredictive(_0x3a762d);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x1cc'),_0x93ae('0x1cd'),_0x5cee7c,_0x93ae('0x1ce'),_0x3a762d[_0x93ae('0x67')],_0x93ae('0x22'),_0x3a762d[_0x93ae('0x37')]);}else if(!ifInterval(_0x3a762d[_0x93ae('0x1c7')],_0x3a762d[_0x93ae('0x22')])&&_['isUndefined'](_0x3a762d[_0x93ae('0x6d')])&&!_[_0x93ae('0x80')](_0x3a762d['startProgressive'])){_0x3a762d[_0x93ae('0x6d')]=moment()[_0x93ae('0x71')](_0x93ae('0xfa'));loggerPredictive[_0x93ae('0x75')](_0x3a762d[_0x93ae('0x37')],_0x93ae('0x1cf'),_0x3a762d['startPredictive']);this['averageHandleTime'](_0x3a762d['dialPredictiveInterval'])[_0x93ae('0xb3')](this['getDataPredictive'](_0x3a762d))['then'](mergeDataErlangB(_0x3a762d))[_0x93ae('0xb3')](this['startMethodPredictive'](_0x3a762d))[_0x93ae('0xa9')](loggerCatchPredictive(_0x93ae('0x1d0'),_0x3a762d));}else if(!ifInterval(_0x3a762d[_0x93ae('0x1c7')],_0x3a762d['startPredictive'])){_0x3a762d[_0x93ae('0x67')]=0x0;_0x3a762d[_0x93ae('0x6d')]=moment()[_0x93ae('0x71')](_0x93ae('0xfa'));loggerPredictive[_0x93ae('0x75')](_0x3a762d['name'],_0x93ae('0x1d1'),_0x3a762d[_0x93ae('0x6d')]);clearInterval(_0x3a762d[_0x93ae('0x8c')]);_0x3a762d[_0x93ae('0x8c')]=undefined;this[_0x93ae('0xb7')](_0x3a762d['dialPredictiveInterval'])[_0x93ae('0xb3')](this['getDataPredictive'](_0x3a762d))[_0x93ae('0xb3')](mergeDataErlangB(_0x3a762d))[_0x93ae('0xb3')](this[_0x93ae('0x1d2')](_0x3a762d))[_0x93ae('0xa9')](loggerCatchPredictive(_0x93ae('0x1d3'),_0x3a762d));}else if(_0x3a762d[_0x93ae('0x1c0')]&&_0x36aaef<_0x3a762d[_0x93ae('0x1c0')]-_0x2619b6){freeVariablesPredictive(_0x3a762d);loggerPredictive[_0x93ae('0x75')](_0x3a762d[_0x93ae('0x37')],_0x93ae('0x1d4'),_0x36aaef,_0x93ae('0x1d5'),_0x3a762d[_0x93ae('0x1c0')],'-',_0x2619b6,'=',_0x3a762d[_0x93ae('0x1c0')]-_0x2619b6,')');}else if(_0x3a762d[_0x93ae('0x1c0')]&&_0x36aaef>_0x3a762d[_0x93ae('0x1c0')]+_0x44746a){freeVariablesPredictive(_0x3a762d);loggerPredictive[_0x93ae('0x75')](_0x3a762d[_0x93ae('0x37')],_0x93ae('0x1d4'),_0x36aaef,_0x93ae('0x1d6'),_0x3a762d[_0x93ae('0x1c0')],'+',_0x44746a,'=',_0x3a762d['predictiveIntervalAvailable']+_0x44746a,')');}};Dialer[_0x93ae('0x15')][_0x93ae('0x1d7')]=function(_0x5d89f8){var _0x64b639=this;return function(_0x309d03){return new BPromise(function(_0x197e5a,_0x59d863){_[_0x93ae('0x89')](_0x5d89f8,_0x309d03[0x0]);if(checkGetDataPredictive(_0x309d03[0x0])){var _0x5966c4=_0x5d89f8[_0x93ae('0x1c0')]=_0x5d89f8[_0x93ae('0x4c')]+_0x5d89f8['available'];var _0x3286b4=_0x5d89f8[_0x93ae('0x1c7')]*0x3c;var _0x398a0c=_0x309d03[0x0][_0x93ae('0x64')]+_0x309d03[0x0][_0x93ae('0x63')];var _0x20d02c=(_0x309d03[0x0][_0x93ae('0x62')]+_0x309d03[0x0][_0x93ae('0x7a')]+_0x309d03[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x309d03[0x0][_0x93ae('0x7f')];_0x5d89f8[_0x93ae('0x68')]=_0x20d02c>0x0?_0x20d02c:0x1;switch(_0x5d89f8[_0x93ae('0x1c9')]){case _0x93ae('0x1ca'):var _0x377fa0=_0x5d89f8['dialPredictiveOptimizationPercentage']/0x64;return _0x64b639[_0x93ae('0x1d8')](_0x5966c4,_0x3286b4,_0x398a0c,_0x20d02c,_0x377fa0)['then'](function(_0x24397d){return _0x197e5a(_0x24397d);});case _0x93ae('0x1d9'):var _0x2aec98=_0x5d89f8[_0x93ae('0x1be')]/0x64;return _0x64b639[_0x93ae('0x1da')](_0x5966c4,_0x3286b4,_0x398a0c,_0x20d02c,_0x2aec98)[_0x93ae('0xb3')](function(_0x184f8a){return _0x197e5a(_0x184f8a);});default:return _0x59d863(msgResponse(_0x93ae('0x1db'),_0x93ae('0x141'),_0x93ae('0x1dc')));}}else{return _0x59d863(msgResponse(_0x93ae('0x1db'),_0x93ae('0x141'),_0x93ae('0x1dd')));}});};};Dialer['prototype'][_0x93ae('0x1de')]=function(_0x36de24){var _0x414cea=this;return function(_0x35d52b){return new BPromise(function(_0x225a16,_0x5b2a33){_[_0x93ae('0x89')](_0x36de24,_0x35d52b[0x0]);if(checkGetDataPredictive(_0x35d52b[0x0])){loggerPredictive[_0x93ae('0x75')](JSON[_0x93ae('0x41')](_0x35d52b[0x0]));if(_0x36de24[_0x93ae('0x1c9')]===_0x93ae('0x1ca')){return _0x414cea['getVoiceQueueRtPauses'](_0x36de24['id'])[_0x93ae('0xb3')](function(_0x5514c5){var _0x1fa9b7=_0x36de24['loggedIn']-_0x5514c5[0x0][_0x93ae('0x1df')];var _0x16340b=_0x36de24[_0x93ae('0x1c7')]*0x3c;var _0x1201f4=_0x35d52b[0x0][_0x93ae('0x64')]+_0x35d52b[0x0][_0x93ae('0x63')];var _0x2e3543=(_0x35d52b[0x0][_0x93ae('0x62')]+_0x35d52b[0x0][_0x93ae('0x7a')]+_0x35d52b[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x35d52b[0x0][_0x93ae('0x7f')];var _0x101760=_0x36de24['dialPredictiveOptimizationPercentage']/0x64;_0x36de24[_0x93ae('0x6a')]=_0x5514c5[0x0]['outboundQueuePauses']||0x0;_0x36de24[_0x93ae('0x68')]=_0x2e3543>0x0?_0x2e3543:0x1;return _0x414cea[_0x93ae('0x1d8')](_0x1fa9b7,_0x16340b,_0x1201f4,_0x2e3543,_0x101760);})['then'](function(_0x46763b){return _0x225a16(_0x46763b);})[_0x93ae('0xa9')](function(_0x4f8200){return _0x5b2a33(msgResponse(_0x93ae('0x1e0'),'Failure',JSON[_0x93ae('0x41')](_0x4f8200)));});}if(_0x36de24[_0x93ae('0x1c9')]===_0x93ae('0x1d9')){return _0x414cea[_0x93ae('0xbf')](_0x36de24['id'])[_0x93ae('0xb3')](function(_0x15a2e4){var _0x49f837=_0x36de24['loggedIn']-_0x15a2e4[0x0][_0x93ae('0x1df')];var _0xe2a430=_0x36de24[_0x93ae('0x1c7')]*0x3c;var _0x4476c7=_0x35d52b[0x0][_0x93ae('0x64')]+_0x35d52b[0x0][_0x93ae('0x63')];var _0x5356db=(_0x35d52b[0x0][_0x93ae('0x62')]+_0x35d52b[0x0][_0x93ae('0x7a')]+_0x35d52b[0x0][_0x93ae('0x65')])/_0x35d52b[0x0][_0x93ae('0x7f')];var _0x554626=_0x36de24[_0x93ae('0x1be')]/0x64;_0x36de24['predictiveIntervalPauses']=_0x15a2e4[0x0][_0x93ae('0x1df')]||0x0;_0x36de24[_0x93ae('0x68')]=_0x5356db>0x0?_0x5356db:0x1;return _0x414cea['busyFactor'](_0x49f837,_0xe2a430,_0x4476c7,_0x5356db,_0x554626);})[_0x93ae('0xb3')](function(_0x165345){return _0x225a16(_0x165345);})[_0x93ae('0xa9')](function(_0x3d6df9){return _0x5b2a33(msgResponse(_0x93ae('0x1e0'),_0x93ae('0x141'),JSON[_0x93ae('0x41')](_0x3d6df9)));});}}else{return _0x5b2a33(msgResponse(_0x93ae('0x1db'),_0x93ae('0x141'),'check\x20failure'));}});};};Dialer[_0x93ae('0x15')][_0x93ae('0x1d2')]=function(_0x4bba84){var _0x3a942f=this;return function(){var _0x19b41c=0x0;var _0x30854c=Math[_0x93ae('0x1e1')](_0x4bba84[_0x93ae('0x86')]*0x3e8);if(_0x30854c>0x0){_0x30854c=_0x30854c<0x64?0x64:_0x30854c;loggerPredictive[_0x93ae('0x75')](_0x4bba84[_0x93ae('0x37')],_0x93ae('0x1e2'),_0x30854c,'milliseconds');_0x4bba84[_0x93ae('0x8c')]=setInterval(function(){_0x3a942f[_0x93ae('0x8c')](_0x4bba84);loggerPredictiveCalls['info'](_0x93ae('0x1e3'),_0x19b41c+=0x1);},_0x30854c);}else{loggerPredictive['info'](_0x4bba84[_0x93ae('0x37')],_0x93ae('0x1e4'));}};};Dialer[_0x93ae('0x15')][_0x93ae('0x1e5')]=function(_0x59984f,_0x16f386){var _0x4c2885=this;return function(_0x1775c8){if(_['isEmpty'](_0x1775c8)){if(_[_0x93ae('0xa6')](_0x16f386[_0x93ae('0xcd')])||!_0x16f386[_0x93ae('0x1e6')]){if(_0x59984f[_0x93ae('0x52')]===_0x93ae('0x157')){_0x59984f['queueStatusComplete']=_[_0x93ae('0x80')](_0x59984f[_0x93ae('0x129')])?!![]:_0x59984f[_0x93ae('0x129')];var _0x35fc41=uuid['v4']();_0x4c2885[_0x93ae('0x1f')][_0x35fc41]=new Action(_0x59984f,_0x16f386,_0x35fc41);loggerBooked[_0x93ae('0x75')](_0x93ae('0x1e7'),_0x35fc41,_0x93ae('0x1e8'),JSON[_0x93ae('0x41')](_0x59984f[_0x93ae('0x129')]),'Queue:\x20',_0x59984f[_0x93ae('0x37')]);if(_0x59984f[_0x93ae('0x129')]){_0x59984f[_0x93ae('0x129')]=![];_0x4c2885[_0x93ae('0x24')][_0x4c2885['actions'][_0x35fc41]['queue']]=[];ami[_0x93ae('0xa7')]({'actionid':_0x35fc41,'action':_0x93ae('0x1e9'),'queue':_0x59984f[_0x93ae('0x37')]})[_0x93ae('0xa9')](function(){_0x4c2885[_0x93ae('0xab')](_0x59984f);_0x4c2885['rescheduleContact']({'active':![],'ContactId':_0x4c2885[_0x93ae('0x1f')][_0x35fc41][_0x93ae('0xcb')],'ListId':_0x4c2885[_0x93ae('0x1f')][_0x35fc41]['ListId'],'VoiceQueueId':_0x4c2885['actions'][_0x35fc41][_0x93ae('0xce')]||undefined,'CampaignId':_0x4c2885[_0x93ae('0x1f')][_0x35fc41][_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x1ea')));delete _0x4c2885[_0x93ae('0x1f')][_0x35fc41];});}else{loggerBooked[_0x93ae('0x75')](_0x93ae('0x1eb'),JSON[_0x93ae('0x41')](_0x59984f['queueStatusComplete']),_0x93ae('0x1ec'),_0x59984f[_0x93ae('0x37')]);_0x4c2885[_0x93ae('0xab')](_0x59984f);_0x4c2885[_0x93ae('0xb9')]({'active':![],'ContactId':_0x4c2885[_0x93ae('0x1f')][_0x35fc41]['ContactId'],'ListId':_0x4c2885[_0x93ae('0x1f')][_0x35fc41][_0x93ae('0xcc')],'VoiceQueueId':_0x4c2885[_0x93ae('0x1f')][_0x35fc41]['VoiceQueueId']||undefined,'CampaignId':_0x4c2885['actions'][_0x35fc41][_0x93ae('0xcf')]||undefined})[_0x93ae('0xa9')](loggerCatch(_0x93ae('0x1ea')));delete _0x4c2885[_0x93ae('0x1f')][_0x35fc41];}}else{return _0x4c2885[_0x93ae('0x164')](_0x59984f,_0x16f386);}}else{if(getDiff(_0x16f386[_0x93ae('0x1ed')])<_0x59984f['dialRecallMeTimeout']*0x3c){if(_0x16f386[_0x93ae('0x1ee')]&&!_0x16f386[_0x93ae('0x1ee')]['voicePause']){_0x4c2885[_0x93ae('0x134')][_0x93ae('0x1ef')](_0x16f386['id'])[_0x93ae('0x12d')](function(){_0x4c2885['updateOriginated'](_0x59984f);});}else{_0x4c2885[_0x93ae('0x1f0')]({'active':![]},_0x16f386['id'],0x1)[_0x93ae('0x12d')](function(){_0x4c2885[_0x93ae('0xab')](_0x59984f);});}}else{_0x59984f['outboundReCallsDay']+=0x1;_0x4c2885['updateOriginated'](_0x59984f);if(_0x59984f[_0x93ae('0x1f1')]){_0x4c2885['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x16f386[_0x93ae('0xcb')],'ListId':_0x16f386[_0x93ae('0xcc')],'VoiceQueueId':_0x16f386[_0x93ae('0xce')]||undefined,'CampaignId':_0x16f386[_0x93ae('0xcf')]||undefined})['catch'](loggerCatch(_0x93ae('0x1f2')));_0x4c2885[_0x93ae('0xc3')](createObjHistory(_0x59984f,_0x16f386,_0x93ae('0x1f3'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x93ae('0x1f4')));}else{_0x4c2885[_0x93ae('0xca')](createObjHistory(_0x59984f,_0x16f386,'RECALLFAILEDTIMEOUT',0x16,_0x93ae('0x1f5')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x59984f[_0x93ae('0x59')]+=0x1;_0x4c2885[_0x93ae('0xca')](createObjHistory(_0x59984f,_0x16f386,_0x93ae('0x1f6'),0xd,_0x93ae('0x1f7')),_0x93ae('0x1f8'),'[Originate][MoveBlacklist]');throw _0x93ae('0x1f9');}};};Dialer[_0x93ae('0x15')][_0x93ae('0x15a')]=function(_0x3b913c){var _0x13f136=this;var _0x567de0=_0x3b913c[_0x93ae('0x1fa')]-_0x3b913c[_0x93ae('0x96')]-_0x3b913c[_0x93ae('0xbb')];emitCampaignSummary(_0x3b913c);if(_0x567de0>0x0){if(_0x567de0>this[_0x93ae('0x1d')]){_0x567de0=this[_0x93ae('0x1d')];}_0x3b913c[_0x93ae('0xbb')]+=_0x567de0;this[_0x93ae('0xbd')](_0x3b913c['id'],_0x567de0,_0x3b913c[_0x93ae('0x1fb')],_0x3b913c)[_0x93ae('0xb3')](function(_0xb5029f){_0x3b913c['temp']-=_0x567de0;_0x3b913c[_0x93ae('0xbb')]=_0x3b913c['temp']>0x0?_0x3b913c[_0x93ae('0xbb')]:0x0;if(!checkContactEmpty(_0xb5029f)){_0x3b913c[_0x93ae('0x38')]=_0x93ae('0x1fc');logger[_0x93ae('0x75')](_0x93ae('0x1fd')+_0x3b913c[_0x93ae('0x37')]);}else{_0x3b913c[_0x93ae('0x96')]+=_0xb5029f[_0x93ae('0x94')];_0x3b913c[_0x93ae('0x38')]=_0x93ae('0x1fe');for(var _0x5e9acb=0x0;_0x5e9acb<_0xb5029f[_0x93ae('0x94')];_0x5e9acb+=0x1){_0x3b913c[_0x93ae('0x1ff')]+=0x1;if(_['isNil'](_0xb5029f[_0x5e9acb])||_[_0x93ae('0xa6')](_0xb5029f[_0x5e9acb][_0x93ae('0x168')])||_['isNil'](_0xb5029f[_0x5e9acb][_0x93ae('0x168')][_0x93ae('0x169')])){_0x13f136[_0x93ae('0xc8')](_0x93ae('0x200'),_0x3b913c,_0xb5029f[_0x5e9acb]);}else{_0x13f136[_0x93ae('0xb5')](_[_0x93ae('0x127')](_0xb5029f[_0x5e9acb],['CampaignId','Contact.phone']))[_0x93ae('0xb3')](_0x13f136[_0x93ae('0x1e5')](_0x3b913c,_0xb5029f[_0x5e9acb]))[_0x93ae('0xa9')](_0x13f136[_0x93ae('0xc7')]('[actionOriginateIvr]\x20',_0x3b913c));}}}})[_0x93ae('0xa9')](loggerGetContactDialer(_0x93ae('0x201'),_0x3b913c,_0x567de0));}};Dialer['prototype'][_0x93ae('0x154')]=function(_0x56b25b,_0x5d3a4f){var _0x542489=this;var _0x8a40=[];var _0xc48e12=_0x5d3a4f>=0x1?_0x5d3a4f:0x1;if(_0x56b25b[_0x93ae('0x52')]==='booked'){_0xc48e12=0x1;}var _0x1d60ca=Math[_0x93ae('0x1e1')](_0x56b25b[_0x93ae('0x202')]*_0xc48e12)-_0x56b25b[_0x93ae('0x96')]-_0x56b25b[_0x93ae('0xbb')];emitVoiceQueueSummary(_0x56b25b);if(_0x56b25b[_0x93ae('0x203')]>0x0){var _0x44a1dc=_0x56b25b['dialLimitQueue']-_0x56b25b[_0x93ae('0x96')]-_0x56b25b[_0x93ae('0x4c')]-_0x56b25b[_0x93ae('0xbb')]-_0x56b25b['pTalking'];if(_0x1d60ca>_0x44a1dc){_0x1d60ca=_0x44a1dc;}}if(_0x1d60ca>0x0){if(_0x56b25b[_0x93ae('0x52')]===_0x93ae('0x157')){_0x1d60ca=0x1;}if(_0x1d60ca>this['maxNumberOriginate']){_0x1d60ca=this[_0x93ae('0x1d')];}_0x56b25b['temp']+=_0x1d60ca;for(var _0x95a710 in this['agents']){if(typeof this[_0x93ae('0x1b')][_0x95a710]!==_0x93ae('0x95')){if(this[_0x93ae('0x1b')][_0x95a710][_0x93ae('0xa1')]===_0x93ae('0x204')&&this[_0x93ae('0x1b')][_0x95a710][_0x93ae('0xa8')]===_0x93ae('0xd7')){_0x8a40['push'](this[_0x93ae('0x1b')][_0x95a710]['id']);}}}this[_0x93ae('0xba')](_0x56b25b['id'],_0x8a40,_0x1d60ca,_0x56b25b[_0x93ae('0x1fb')],_0x56b25b)[_0x93ae('0xb3')](function(_0x189cb5){_0x56b25b[_0x93ae('0xbb')]-=_0x1d60ca;_0x56b25b[_0x93ae('0xbb')]=_0x56b25b['temp']>0x0?_0x56b25b[_0x93ae('0xbb')]:0x0;if(!checkContactEmpty(_0x189cb5)){_0x542489[_0x93ae('0xb0')](_0x56b25b)[_0x93ae('0xb3')](sendMessageReschedule(_0x56b25b))[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xb1')));}else{_0x56b25b[_0x93ae('0x96')]+=_0x189cb5['length'];_0x56b25b['message']=_0x56b25b[_0x93ae('0x52')]===_0x93ae('0x157')?_0x93ae('0x170'):_0x93ae('0x1fe');for(var _0x512272=0x0;_0x512272<_0x189cb5['length'];_0x512272+=0x1){if(_['isNil'](_0x189cb5[_0x512272])||_[_0x93ae('0xa6')](_0x189cb5[_0x512272][_0x93ae('0x168')])||_[_0x93ae('0xa6')](_0x189cb5[_0x512272][_0x93ae('0x168')][_0x93ae('0x169')])){_0x542489[_0x93ae('0xc8')](_0x93ae('0x200'),_0x56b25b,_0x189cb5[_0x512272]);}else{_0x542489[_0x93ae('0xb2')](_[_0x93ae('0x127')](_0x189cb5[_0x512272],[_0x93ae('0xce'),_0x93ae('0x205')]))[_0x93ae('0xb3')](_0x542489['checkContactBlack'](_0x56b25b,_0x189cb5[_0x512272]))[_0x93ae('0xa9')](_0x542489[_0x93ae('0xc7')](_0x93ae('0x200'),_0x56b25b));}}}})[_0x93ae('0xa9')](loggerGetContactDialer('[getContactDialer2]',_0x56b25b,_0x1d60ca));}};Dialer[_0x93ae('0x15')][_0x93ae('0x8c')]=function(_0xdecc1c){if(_0xdecc1c[_0x93ae('0x203')]>0x0){var _0x47bf87=_0xdecc1c[_0x93ae('0x203')]-_0xdecc1c[_0x93ae('0x96')]-_0xdecc1c[_0x93ae('0x4c')];if(_0x47bf87>0x0){this[_0x93ae('0x206')](_0xdecc1c);}else{loggerPredictiveCalls[_0x93ae('0x75')]('[handlePredictive][limitChannel]');}}else{this[_0x93ae('0x206')](_0xdecc1c);}};Dialer[_0x93ae('0x15')][_0x93ae('0x206')]=function(_0x157df5){var _0x5ee573=this;var _0x5e3c06=[];_0x157df5['originated']+=0x1;for(var _0x5e11e4 in this[_0x93ae('0x1b')]){if(typeof this['agents'][_0x5e11e4]!==_0x93ae('0x95')){if(this[_0x93ae('0x1b')][_0x5e11e4]['state']===_0x93ae('0x204')&&this[_0x93ae('0x1b')][_0x5e11e4][_0x93ae('0xa8')]==='reachable'){_0x5e3c06[_0x93ae('0x126')](this[_0x93ae('0x1b')][_0x5e11e4]['id']);}}}this[_0x93ae('0xba')](_0x157df5['id'],_0x5e3c06,0x1,_0x157df5[_0x93ae('0x1fb')],_0x157df5)['then'](function(_0x57b5af){if(!checkContactEmpty(_0x57b5af)){checkContactLowerLimitOriginate(_0x157df5,0x1,0x0);_0x5ee573[_0x93ae('0xb0')](_0x157df5)[_0x93ae('0xb3')](sendMessageReschedule(_0x157df5))[_0x93ae('0xa9')](loggerCatch(_0x93ae('0xb1')));}else{_0x157df5[_0x93ae('0x38')]=_0x93ae('0x1fe');if(_['isNil'](_0x57b5af[0x0])||_['isNil'](_0x57b5af[0x0][_0x93ae('0x168')])||_[_0x93ae('0xa6')](_0x57b5af[0x0]['Contact']['phone'])){_0x5ee573[_0x93ae('0xc8')](_0x93ae('0x200'),_0x157df5,_0x57b5af[0x0]);}else{_0x5ee573['checkIsBlackList'](_['pick'](_0x57b5af[0x0],[_0x93ae('0xce'),'Contact.phone']))[_0x93ae('0xb3')](_0x5ee573['checkContactBlack'](_0x157df5,_0x57b5af[0x0]))[_0x93ae('0xa9')](_0x5ee573[_0x93ae('0xc7')](_0x93ae('0x207'),_0x157df5));}}})[_0x93ae('0xa9')](loggerGetContactDialer(_0x93ae('0x208'),_0x157df5,0x1));emitVoiceQueueSummary(_0x157df5);};Dialer[_0x93ae('0x15')][_0x93ae('0x1d8')]=function(_0x42dc0c,_0x4da04b,_0x406c06,_0xb8848f,_0x2dda87,_0x3b2b1b){loggerPredictive[_0x93ae('0x75')](_0x93ae('0x209'));loggerPredictive[_0x93ae('0x75')]('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',_0x42dc0c);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x20a'),_0x4da04b);loggerPredictive[_0x93ae('0x75')]('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',_0x406c06);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x20b'),_0xb8848f);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x20c'),_0x2dda87);loggerPredictive['info'](_0x93ae('0x7e'));return new BPromise(function(_0x635841,_0x1c8041){if(_0x42dc0c<=0x0||isNaN(_0x42dc0c)){return _0x1c8041(msgResponse(_0x93ae('0x20d'),_0x93ae('0x40'),_0x93ae('0x20e')+_0x42dc0c));}if(_0x406c06<=0x0||isNaN(_0x406c06)){return _0x1c8041(msgResponse(_0x93ae('0x20d'),_0x93ae('0x40'),_0x93ae('0x20f')+_0x406c06));}if(_0xb8848f<=0x0||isNaN(_0xb8848f)){return _0x1c8041(msgResponse(_0x93ae('0x20d'),_0x93ae('0x40'),_0x93ae('0x210')+_0xb8848f));}if(_0x4da04b<=0x0||isNaN(_0x4da04b)){return _0x1c8041(msgResponse(_0x93ae('0x20d'),'Error','interval\x20=\x20'+_0x4da04b));}if(_0x2dda87<=0x0||isNaN(_0x2dda87)){return _0x1c8041(msgResponse(_0x93ae('0x20d'),'Error',_0x93ae('0x211')+_0x2dda87));}_0x3b2b1b=_0x3b2b1b||0x0;var _0x355789=0x1/_0x406c06;var _0x48f59d=0x0;var _0x171e33=0x0;var _0x66b5e4=0x0;var _0x2eac6b=0x0;for(var _0x47d4c4=0x0;_0x66b5e4<_0x2dda87;_0x47d4c4+=0x1){_0x171e33=_0x47d4c4/_0x4da04b;_0x48f59d=(_0xb8848f*_0x171e33+_0x3b2b1b)/_0x355789;_0x66b5e4=erlangb(_0x48f59d,_0x42dc0c);_0x2eac6b=_0x48f59d/_0x42dc0c*(0x1-erlangb(_0x48f59d,_0x42dc0c));}return _0x635841({'erlangCalls':_0x47d4c4,'erlangCallToSecond':_0x4da04b/_0x47d4c4,'erlangAbandonmentRate':_0x66b5e4,'erlangBusyFactor':_0x2eac6b});});};Dialer[_0x93ae('0x15')]['busyFactor']=function(_0xe86224,_0x53eff3,_0x52fa58,_0x201d10,_0x5cfba2,_0x3fb84b){loggerPredictive[_0x93ae('0x75')](_0x93ae('0x212'));loggerPredictive['info'](_0x93ae('0x213'),_0xe86224);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x20a'),_0x53eff3);loggerPredictive['info'](_0x93ae('0x214'),_0x52fa58);loggerPredictive['info'](_0x93ae('0x20b'),_0x201d10);loggerPredictive[_0x93ae('0x75')](_0x93ae('0x215'),_0x5cfba2);loggerPredictive['info'](_0x93ae('0x7e'));return new BPromise(function(_0x1659bc,_0x566de1){if(_0xe86224<=0x0||isNaN(_0xe86224)){return _0x566de1(msgResponse(_0x93ae('0x216'),_0x93ae('0x40'),_0x93ae('0x20e')+_0xe86224));}if(_0x52fa58<=0x0||isNaN(_0x52fa58)){return _0x566de1(msgResponse(_0x93ae('0x216'),_0x93ae('0x40'),_0x93ae('0x20f')+_0x52fa58));}if(_0x201d10<=0x0||isNaN(_0x201d10)){return _0x566de1(msgResponse(_0x93ae('0x216'),_0x93ae('0x40'),'p\x20=\x20'+_0x201d10));}if(_0x53eff3<=0x0||isNaN(_0x53eff3)){return _0x566de1(msgResponse(_0x93ae('0x216'),_0x93ae('0x40'),_0x93ae('0x217')+_0x53eff3));}if(_0x5cfba2<=0x0||isNaN(_0x5cfba2)){return _0x566de1(msgResponse(_0x93ae('0x216'),_0x93ae('0x40'),'Umin\x20=\x20'+_0x5cfba2));}_0x3fb84b=_0x3fb84b||0x0;var _0x1fe767=0x1/_0x52fa58;var _0x13eb9a=0x0;var _0x50752b=0x0;var _0x5d6167=0x0;var _0x53f8ab=0x0;for(var _0x272ebd=0x0;_0x53f8ab<_0x5cfba2;_0x272ebd+=0x1){_0x50752b=_0x272ebd/_0x53eff3;_0x13eb9a=(_0x201d10*_0x50752b+_0x3fb84b)/_0x1fe767;_0x5d6167=erlangb(_0x13eb9a,_0xe86224);_0x53f8ab=_0x13eb9a/_0xe86224*(0x1-erlangb(_0x13eb9a,_0xe86224));}return _0x1659bc({'erlangCalls':_0x272ebd,'erlangCallToSecond':_0x53eff3/_0x272ebd,'erlangAbandonmentRate':_0x5d6167,'erlangBusyFactor':_0x53f8ab});});};module[_0x93ae('0x218')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 8283028..51bc984 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd3d=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type'];(function(_0x3cf114,_0x53ea34){var _0x2b590e=function(_0x5f2cab){while(--_0x5f2cab){_0x3cf114['push'](_0x3cf114['shift']());}};_0x2b590e(++_0x53ea34);}(_0xcd3d,0x1f1));var _0xdcd3=function(_0xd818dd,_0x2a4dbe){_0xd818dd=_0xd818dd-0x0;var _0x2d43b8=_0xcd3d[_0xd818dd];return _0x2d43b8;};'use strict';var util=require(_0xdcd3('0x0'));var _=require(_0xdcd3('0x1'));var moment=require(_0xdcd3('0x2'));function getSeconds(_0x5ce431,_0x36cf0f){var _0x2478ac=moment(_0x5ce431)[_0xdcd3('0x3')](0x0);var _0x426228=moment(_0x36cf0f)[_0xdcd3('0x3')](0x0);return _0x2478ac[_0xdcd3('0x4')](_0x426228,'seconds');}function QueueCallerAbandon(_0x5629bd,_0xefb25){this[_0xdcd3('0x5')]=_0x5629bd[_0xdcd3('0x5')];this[_0xdcd3('0x6')]=_0x5629bd['type'];this[_0xdcd3('0x7')]=_0x5629bd[_0xdcd3('0x6')]===_0xdcd3('0x8')?_0xdcd3('0x9'):_0x5629bd[_0xdcd3('0x6')];this[_0xdcd3('0xa')]=_0x5629bd['countbusyretry'];this[_0xdcd3('0xb')]=_0x5629bd[_0xdcd3('0xb')];this[_0xdcd3('0xc')]=_0x5629bd['countnoanswerretry'];this[_0xdcd3('0xd')]=_0x5629bd[_0xdcd3('0xa')]+_0x5629bd[_0xdcd3('0xb')]+_0x5629bd[_0xdcd3('0xc')]+_0x5629bd[_0xdcd3('0xe')]+_0x5629bd[_0xdcd3('0xf')]+_0x5629bd[_0xdcd3('0x10')]+_0x5629bd[_0xdcd3('0x11')]+_0x5629bd[_0xdcd3('0x12')];this['countnosuchnumberretry']=_0x5629bd[_0xdcd3('0xe')];this[_0xdcd3('0xf')]=_0x5629bd['countdropretry'];this['countabandonedretry']=_0x5629bd[_0xdcd3('0x10')];this['countmachineretry']=_0x5629bd[_0xdcd3('0x11')];this[_0xdcd3('0x12')]=_0x5629bd[_0xdcd3('0x12')];this[_0xdcd3('0x13')]=_0xefb25[_0xdcd3('0x13')];this['calleridname']=_0x5629bd[_0xdcd3('0x14')];this[_0xdcd3('0x15')]=_0x5629bd['number'];this[_0xdcd3('0x16')]=_0x5629bd['starttime'];this[_0xdcd3('0x17')]=_0x5629bd['responsetime'];this[_0xdcd3('0x18')]=_0x5629bd[_0xdcd3('0x18')];this[_0xdcd3('0x19')]=this[_0xdcd3('0x18')];this[_0xdcd3('0x1a')]=getSeconds(_0x5629bd['responsetime'],_0x5629bd[_0xdcd3('0x16')]);this['holdtime']=getSeconds(this[_0xdcd3('0x18')],_0x5629bd['responsetime']);this['talktime']=0x0;this[_0xdcd3('0x9')]=_0xefb25[_0xdcd3('0x9')];this[_0xdcd3('0x1b')]=_0xefb25[_0xdcd3('0x1c')];this[_0xdcd3('0x1d')]=_0xefb25[_0xdcd3('0x1d')];this[_0xdcd3('0x1e')]=_0x5629bd['callback'];this['callbackuniqueid']=_0x5629bd[_0xdcd3('0x1f')];this[_0xdcd3('0x20')]=_0x5629bd[_0xdcd3('0x20')];this[_0xdcd3('0x21')]=_0x5629bd[_0xdcd3('0x21')];this[_0xdcd3('0x22')]=_0x5629bd['ContactId'];this[_0xdcd3('0x23')]=_0x5629bd[_0xdcd3('0x23')];this[_0xdcd3('0x24')]=_0x5629bd[_0xdcd3('0x24')];this[_0xdcd3('0x25')]=_0x5629bd['VoiceQueueId'];this['CampaignId']=_0x5629bd[_0xdcd3('0x26')];this[_0xdcd3('0x27')]=_0x5629bd[_0xdcd3('0x27')]||'';this['originatecalleridname']=_0x5629bd[_0xdcd3('0x28')]||'';}module[_0xdcd3('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x71c3=['holdtime','queue','membername','connectedlinename','reason','callback','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime'];(function(_0x20a394,_0x5c4e0c){var _0x8a454f=function(_0x26d21c){while(--_0x26d21c){_0x20a394['push'](_0x20a394['shift']());}};_0x8a454f(++_0x5c4e0c);}(_0x71c3,0xc6));var _0x371c=function(_0x6685d0,_0x2cf954){_0x6685d0=_0x6685d0-0x0;var _0x55de67=_0x71c3[_0x6685d0];return _0x55de67;};'use strict';var util=require(_0x371c('0x0'));var _=require(_0x371c('0x1'));var moment=require('moment');function getSeconds(_0x40d7af,_0x2fb78c){var _0x2eb6a5=moment(_0x40d7af)[_0x371c('0x2')](0x0);var _0xa6dc80=moment(_0x2fb78c)[_0x371c('0x2')](0x0);return _0x2eb6a5[_0x371c('0x3')](_0xa6dc80,'seconds');}function QueueCallerAbandon(_0x4cc567,_0x13e51a){this['scheduledat']=_0x4cc567[_0x371c('0x4')];this[_0x371c('0x5')]=_0x4cc567[_0x371c('0x5')];this['campaigntype']=_0x4cc567[_0x371c('0x5')]==='outbound'?'queue':_0x4cc567[_0x371c('0x5')];this[_0x371c('0x6')]=_0x4cc567[_0x371c('0x6')];this[_0x371c('0x7')]=_0x4cc567[_0x371c('0x7')];this[_0x371c('0x8')]=_0x4cc567[_0x371c('0x8')];this[_0x371c('0x9')]=_0x4cc567[_0x371c('0x6')]+_0x4cc567['countcongestionretry']+_0x4cc567[_0x371c('0x8')]+_0x4cc567[_0x371c('0xa')]+_0x4cc567[_0x371c('0xb')]+_0x4cc567[_0x371c('0xc')]+_0x4cc567[_0x371c('0xd')]+_0x4cc567[_0x371c('0xe')];this[_0x371c('0xa')]=_0x4cc567[_0x371c('0xa')];this['countdropretry']=_0x4cc567[_0x371c('0xb')];this[_0x371c('0xc')]=_0x4cc567[_0x371c('0xc')];this[_0x371c('0xd')]=_0x4cc567[_0x371c('0xd')];this['countagentrejectretry']=_0x4cc567[_0x371c('0xe')];this[_0x371c('0xf')]=_0x13e51a[_0x371c('0xf')];this[_0x371c('0x10')]=_0x4cc567['name'];this[_0x371c('0x11')]=_0x4cc567[_0x371c('0x12')];this['starttime']=_0x4cc567[_0x371c('0x13')];this['responsetime']=_0x4cc567[_0x371c('0x14')];this[_0x371c('0x15')]=_0x4cc567['droptime'];this[_0x371c('0x16')]=this[_0x371c('0x15')];this[_0x371c('0x17')]=getSeconds(_0x4cc567[_0x371c('0x14')],_0x4cc567[_0x371c('0x13')]);this[_0x371c('0x18')]=getSeconds(this[_0x371c('0x15')],_0x4cc567[_0x371c('0x14')]);this['talktime']=0x0;this[_0x371c('0x19')]=_0x13e51a[_0x371c('0x19')];this[_0x371c('0x1a')]=_0x13e51a[_0x371c('0x1b')];this[_0x371c('0x1c')]=_0x13e51a['reason'];this['callback']=_0x4cc567[_0x371c('0x1d')];this['callbackuniqueid']=_0x4cc567['callbackuniqueid'];this['callbackat']=_0x4cc567['callbackat'];this[_0x371c('0x1e')]=_0x4cc567['recallme'];this[_0x371c('0x1f')]=_0x4cc567[_0x371c('0x1f')];this[_0x371c('0x20')]=_0x4cc567[_0x371c('0x20')];this[_0x371c('0x21')]=_0x4cc567[_0x371c('0x21')];this[_0x371c('0x22')]=_0x4cc567['VoiceQueueId'];this['CampaignId']=_0x4cc567['CampaignId'];this['originatecalleridnum']=_0x4cc567[_0x371c('0x23')]||'';this[_0x371c('0x24')]=_0x4cc567[_0x371c('0x24')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 202e4d3..b6d7ff5 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(_0x304615,_0x292d24){var _0xeb5b56=function(_0x3159d4){while(--_0x3159d4){_0x304615['push'](_0x304615['shift']());}};_0xeb5b56(++_0x292d24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x478734,_0x13b975){var _0x493c17=function(_0x539083){while(--_0x539083){_0x478734['push'](_0x478734['shift']());}};_0x493c17(++_0x13b975);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 18d0b17..ea0c6b3 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 _0x812c=['updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','exports','util','lodash','bluebird','moment','path','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]'];(function(_0x502f16,_0x40dd18){var _0xb2b447=function(_0x4936b){while(--_0x4936b){_0x502f16['push'](_0x502f16['shift']());}};_0xb2b447(++_0x40dd18);}(_0x812c,0x18a));var _0xc812=function(_0x14bbf2,_0x1f1bc9){_0x14bbf2=_0x14bbf2-0x0;var _0xb1ee82=_0x812c[_0x14bbf2];return _0xb1ee82;};'use strict';var util=require(_0xc812('0x0'));var _=require(_0xc812('0x1'));var BPromise=require(_0xc812('0x2'));var uuid=require('uuid');var moment=require(_0xc812('0x3'));var path=require(_0xc812('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xc812('0x5'));var logger=require(_0xc812('0x6'))(_0xc812('0x7'));var ami=require(_0xc812('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0xc812('0x9'));var ut=require(_0xc812('0xa'));var Action=require(_0xc812('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xc812('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x494fc8){this[_0xc812('0xd')]={};this[_0xc812('0xe')]=_0x494fc8['faxAccounts'];this[_0xc812('0xf')]=_0x494fc8['trunks'];this[_0xc812('0x10')]={};ami['on'](_0xc812('0x11'),this['syncNewchannel'][_0xc812('0x12')](this));ami['on'](_0xc812('0x13'),this[_0xc812('0x14')][_0xc812('0x12')](this));ami['on']('newstate',this[_0xc812('0x15')][_0xc812('0x12')](this));ami['on'](_0xc812('0x16'),this[_0xc812('0x17')][_0xc812('0x12')](this));ami['on'](_0xc812('0x18'),this[_0xc812('0x19')][_0xc812('0x12')](this));ami['on'](_0xc812('0x1a'),this[_0xc812('0x1b')][_0xc812('0x12')](this));ami['on'](_0xc812('0x1c'),this[_0xc812('0x1d')]['bind'](this));ami['on'](_0xc812('0x1e'),this['syncOriginateResponse']['bind'](this));}Fax[_0xc812('0x1f')]['syncNewchannel']=function(_0x1d7723){if(_0x1d7723[_0xc812('0x20')]===_0xc812('0x21')){for(var _0x63fc29 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x63fc29)){if(_0x1d7723[_0xc812('0x22')]===this[_0xc812('0xe')][_0x63fc29][_0xc812('0x23')]){this[_0xc812('0xd')][_0x1d7723[_0xc812('0x24')]]={};this[_0xc812('0xd')][_0x1d7723[_0xc812('0x24')]]['channel']=_0x1d7723[_0xc812('0x25')];this['channels'][_0x1d7723[_0xc812('0x24')]]['id']=this['faxAccounts'][_0x63fc29]['id'];this[_0xc812('0xd')][_0x1d7723[_0xc812('0x24')]][_0xc812('0x26')]=this[_0xc812('0xe')][_0x63fc29][_0xc812('0x26')];logger[_0xc812('0x27')](_0x1d7723['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0xc812('0x10')][_0x1d7723[_0xc812('0x24')]]){this[_0xc812('0xd')][_0x1d7723[_0xc812('0x24')]]={};this[_0xc812('0xd')][_0x1d7723[_0xc812('0x24')]]['channel']=_0x1d7723[_0xc812('0x25')];logger[_0xc812('0x27')](_0x1d7723[_0xc812('0x24')],_0xc812('0x28'));}};Fax['prototype'][_0xc812('0x14')]=function(_0x371732){if(this[_0xc812('0xd')][_0x371732[_0xc812('0x24')]]){for(var _0x427ba3 in _0x371732['variable']){if(_0x371732[_0xc812('0x29')]['hasOwnProperty'](_0x427ba3)){this['channels'][_0x371732[_0xc812('0x24')]][_0x427ba3]=_0x371732[_0xc812('0x2a')];}}}};Fax[_0xc812('0x1f')][_0xc812('0x15')]=function(_0x3ae9f9){if(this[_0xc812('0xd')][_0x3ae9f9[_0xc812('0x24')]]){this[_0xc812('0xd')][_0x3ae9f9['uniqueid']][_0xc812('0x2b')]=_0x3ae9f9[_0xc812('0x2b')];this['channels'][_0x3ae9f9[_0xc812('0x24')]][_0xc812('0x2c')]=_0x3ae9f9[_0xc812('0x2c')];}};Fax[_0xc812('0x1f')][_0xc812('0x17')]=function(_0x3ad7d9){if(this[_0xc812('0xd')][_0x3ad7d9[_0xc812('0x24')]]){for(var _0x5bc2fe in _0x3ad7d9[_0xc812('0x29')]){if(_0x3ad7d9[_0xc812('0x29')][_0xc812('0x2d')](_0x5bc2fe)){this['channels'][_0x3ad7d9[_0xc812('0x24')]][_0x5bc2fe]=_0x3ad7d9['value'];}}}};Fax[_0xc812('0x1f')][_0xc812('0x19')]=function(_0x31cb71){if(this['channels'][_0x31cb71[_0xc812('0x24')]]){this['channels'][_0x31cb71[_0xc812('0x24')]][_0xc812('0x2e')]=_0x31cb71['operation'];this[_0xc812('0xd')][_0x31cb71['uniqueid']][_0xc812('0x2f')]=_0x31cb71['status'];this[_0xc812('0xd')][_0x31cb71[_0xc812('0x24')]]['localstationid']=_0x31cb71['localstationid'];this[_0xc812('0xd')][_0x31cb71[_0xc812('0x24')]][_0xc812('0x30')]=_0x31cb71[_0xc812('0x30')];logger['info'](_0x31cb71[_0xc812('0x24')],_0xc812('0x31'));}};Fax[_0xc812('0x1f')][_0xc812('0x1b')]=function(_0x32e468){var _0x182615=this;if(this[_0xc812('0xd')][_0x32e468['uniqueid']]){var _0x4cd2cf=this[_0xc812('0xd')][_0x32e468[_0xc812('0x24')]]['id'];this['channels'][_0x32e468['uniqueid']][_0xc812('0x32')]=_0x32e468[_0xc812('0x32')];this['channels'][_0x32e468[_0xc812('0x24')]]['pagestransferred']=_0x32e468[_0xc812('0x33')];this[_0xc812('0xd')][_0x32e468[_0xc812('0x24')]]['localstationid']=_0x32e468['localstationid'];this[_0xc812('0xd')][_0x32e468[_0xc812('0x24')]][_0xc812('0x34')]=_0x32e468[_0xc812('0x34')];this[_0xc812('0xd')][_0x32e468[_0xc812('0x24')]]['transferrate']=_0x32e468[_0xc812('0x35')];this[_0xc812('0xd')][_0x32e468[_0xc812('0x24')]][_0xc812('0x30')]=_0x32e468[_0xc812('0x30')];this[_0xc812('0xd')][_0x32e468[_0xc812('0x24')]][_0xc812('0x36')]=_0x32e468[_0xc812('0x36')];if(this['channels'][_0x32e468[_0xc812('0x24')]][_0xc812('0x33')]>0x0){tiff2pdf(_0x32e468[_0xc812('0x30')],_0xc812('0x37'),function(_0x3e255a){logger[_0xc812('0x27')](_0x32e468['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x3e255a[_0xc812('0x38')]);attachment[_0xc812('0x39')]({'name':path[_0xc812('0x3a')](_0x32e468[_0xc812('0x30')])[_0xc812('0x26')],'basename':path['parse'](_0x32e468[_0xc812('0x30')])[_0xc812('0x26')]+_0xc812('0x3b'),'type':_0xc812('0x3c')})[_0xc812('0x3d')](function(_0x486b5e){faxAccount[_0xc812('0x3e')](_0x4cd2cf,{'from':_0x32e468['calleridnum'],'mapKey':_0xc812('0x7'),'body':path[_0xc812('0x3a')](_0x32e468['filename'])[_0xc812('0x26')]+_0xc812('0x3b'),'AttachmentId':_0x486b5e['id']})[_0xc812('0x3f')](function(_0x157474){logger[_0xc812('0x40')](_0x32e468[_0xc812('0x24')],_0xc812('0x41'),JSON[_0xc812('0x42')](_0x157474));});})[_0xc812('0x3f')](function(_0x59a759){logger[_0xc812('0x40')](_0x32e468[_0xc812('0x24')],_0xc812('0x43'),JSON['stringify'](_0x59a759));});});}logger[_0xc812('0x27')](_0x32e468[_0xc812('0x24')],'\x20receiveFax\x20');}};Fax[_0xc812('0x1f')][_0xc812('0x44')]=function(_0x286ec9){if(this[_0xc812('0x10')][_0x286ec9[_0xc812('0x24')]]){_[_0xc812('0x45')](this[_0xc812('0xd')][_0x286ec9[_0xc812('0x24')]],_['pick'](_0x286ec9,[_0xc812('0x46'),_0xc812('0x47')]));}};function updateStatus(_0xe8fa4c){if(_0xe8fa4c[_0xc812('0x48')]){faxMessage[_0xc812('0x49')](_0xe8fa4c[_0xc812('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xc812('0x3d')](function(_0x53e73c){ut[_0xc812('0x4a')](_0xc812('0x4b'),_0x53e73c);})['catch'](function(_0x23b745){ut['logger'](_0xc812('0x4c'),_0x23b745);});}else{ut[_0xc812('0x4a')](_0xc812('0x4d'));}}Fax[_0xc812('0x1f')][_0xc812('0x4e')]=function(_0x1e700d,_0x7ad828,_0x2d3609){var _0xaa430a=this;var _0x36acfe={};if(_0x7ad828){_0x36acfe={'read':_0x7ad828};}else{_0x36acfe={'failMessage':_0x2d3609};}if(this['actions'][_0x1e700d]['AttachmentId']){faxMessage[_0xc812('0x49')](this[_0xc812('0x10')][_0x1e700d][_0xc812('0x48')],_0x36acfe)[_0xc812('0x3d')](function(_0x2a0fb6){ut[_0xc812('0x4a')](_0xc812('0x4f'),_0x2a0fb6);})['catch'](function(_0x21e406){ut[_0xc812('0x4a')](_0xc812('0x50'),_0x21e406);})[_0xc812('0x51')](function(){delete _0xaa430a['channels'][_0x1e700d];delete _0xaa430a[_0xc812('0x10')][_0x1e700d];});}else{ut[_0xc812('0x4a')](_0xc812('0x52'));delete this['channels'][_0x1e700d];delete this[_0xc812('0x10')][_0x1e700d];}};Fax[_0xc812('0x1f')]['syncHangup']=function(_0x8197cb){var _0x2340e3=this;if(this[_0xc812('0xd')][_0x8197cb['uniqueid']]){if(this['actions'][_0x8197cb[_0xc812('0x24')]]){this[_0xc812('0xd')][_0x8197cb[_0xc812('0x24')]]['id']=this[_0xc812('0x10')][_0x8197cb[_0xc812('0x24')]]['id'];this[_0xc812('0xd')][_0x8197cb[_0xc812('0x24')]][_0xc812('0x26')]=this[_0xc812('0x10')][_0x8197cb[_0xc812('0x24')]][_0xc812('0x26')];}logger[_0xc812('0x27')](_0x8197cb[_0xc812('0x24')],this[_0xc812('0x10')][_0x8197cb[_0xc812('0x24')]]?_0xc812('0x53'):_0xc812('0x54'),JSON[_0xc812('0x42')](this[_0xc812('0xd')][_0x8197cb['uniqueid']]));if(this[_0xc812('0x10')][_0x8197cb[_0xc812('0x24')]]){if(this[_0xc812('0xd')][_0x8197cb['uniqueid']]['faxpages']>0x0&&this[_0xc812('0xd')][_0x8197cb['uniqueid']][_0xc812('0x18')]===_0xc812('0x55')){this[_0xc812('0x4e')](_0x8197cb[_0xc812('0x24')],!![]);}else{this[_0xc812('0x4e')](_0x8197cb[_0xc812('0x24')],![],this[_0xc812('0xd')][_0x8197cb[_0xc812('0x24')]]['faxstatusstring']?_0xc812('0x56')+this[_0xc812('0xd')][_0x8197cb[_0xc812('0x24')]][_0xc812('0x57')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0xc812('0x58')]=function(_0x114a61){var _0x659ecc=this;return new BPromise(function(_0x1d2022,_0x1c3971){_0x659ecc[_0xc812('0x59')](_0x114a61,_0x659ecc[_0xc812('0xe')][_0x114a61[_0xc812('0x5a')]])[_0xc812('0x3d')](function(_0x2aa33){ut[_0xc812('0x4a')](_0xc812('0x5b'),_0x2aa33);_0x1d2022(ut[_0xc812('0x38')]('Fax\x20received'));})[_0xc812('0x3f')](function(_0x5e3272){ut[_0xc812('0x4a')](_0xc812('0x5c'),_0x5e3272);updateStatus(_0x114a61);_0x1c3971(ut[_0xc812('0x38')]('Fax\x20failed'));});});};Fax[_0xc812('0x1f')][_0xc812('0x5d')]=function(_0x224d2f){var _0x2049d9=this;return new BPromise(function(_0x303cbf,_0x1969e2){var _0x384dcc=_0x2049d9[_0xc812('0x5e')](_0x2049d9[_0xc812('0xe')][_0x224d2f[_0xc812('0x5a')]][_0xc812('0x5f')],_0x224d2f);if(_0x384dcc[_0xc812('0x60')]){_0x303cbf(ut[_0xc812('0x38')](_0xc812('0x61')));}else{_0x1969e2(ut[_0xc812('0x38')](_0x384dcc[_0xc812('0x38')]));}});};function originate(_0xe6bd73,_0x383773,_0x3a9f96){return new BPromise(function(_0x14f8dd,_0x57d01b){if(_0x3a9f96){var _0x39aaae=util['format'](_0xc812('0x62'),path[_0xc812('0x3a')](_0xe6bd73['path'])[_0xc812('0x26')],_0xe6bd73['path']);gs[_0xc812('0x63')](_0x39aaae)['then'](function(){_0xe6bd73[_0xc812('0x4')]=util[_0xc812('0x64')](_0xc812('0x65'),path[_0xc812('0x3a')](_0xe6bd73[_0xc812('0x4')])[_0xc812('0x66')],path[_0xc812('0x3a')](_0xe6bd73[_0xc812('0x4')])[_0xc812('0x26')]);_0x383773[_0xc812('0x67')]=_0xe6bd73[_0xc812('0x4')];ut[_0xc812('0x4a')](_0xc812('0x68'),'');ami['Action'](ut['variablesAction'](_0xe6bd73,_0x383773))[_0xc812('0x3d')](function(_0x5998db){_0x14f8dd(_0x5998db);})[_0xc812('0x3f')](function(_0x8a4d87){_0x57d01b(_0x8a4d87);});})[_0xc812('0x3f')](function(_0x40d99f){_0x57d01b(_0x40d99f);});}else{ami[_0xc812('0x69')](ut[_0xc812('0x6a')](_0xe6bd73,_0x383773))['then'](function(_0x1a9d48){_0x14f8dd(_0x1a9d48);})[_0xc812('0x3f')](function(_0x1ce6a5){_0x57d01b(_0x1ce6a5);});}});}Fax['prototype']['execOriginate']=function(_0x6d0646,_0xb407e4){var _0x37ceb7=this;return new BPromise(function(_0x3aad76,_0x24c4d4){var _0x2d674c=uuid['v4']();var _0x24bca4=ut[_0xc812('0x6b')](_0x6d0646,_0xb407e4);_0x37ceb7[_0xc812('0x10')][_0x2d674c]=new Action(_0x2d674c,_0xb407e4,_0x6d0646);var _0x46aae6=_0x37ceb7[_0xc812('0x10')][_0x2d674c];if(path[_0xc812('0x3a')](_0x6d0646[_0xc812('0x4')])['ext']==='.pdf'){originate(_0x46aae6,_0x24bca4,!![])['then'](function(_0x4a83ad){_0x3aad76(_0x4a83ad);})['catch'](function(_0x1fa261){_0x24c4d4(_0x1fa261);});}else{originate(_0x46aae6,_0x24bca4,![])[_0xc812('0x3d')](function(_0x1d6cd1){_0x3aad76(_0x1d6cd1);})[_0xc812('0x3f')](function(_0x1f3dd5){_0x24c4d4(_0x1f3dd5);});}});};Fax[_0xc812('0x1f')][_0xc812('0x6c')]=function(_0xced72d){return!_[_0xc812('0x6d')](_0xced72d)&&!_['isNil'](_0xced72d[_0xc812('0x26')])&&!_[_0xc812('0x6d')](_0xced72d[_0xc812('0x6e')])&&_0xced72d[_0xc812('0x6e')]&&!_[_0xc812('0x6d')](this[_0xc812('0xf')][util[_0xc812('0x64')](_0xc812('0x6f'),_0xced72d[_0xc812('0x26')])])&&!_[_0xc812('0x6d')](this['trunks'][util['format'](_0xc812('0x6f'),_0xced72d[_0xc812('0x26')])]['status'])&&(this[_0xc812('0xf')][util[_0xc812('0x64')](_0xc812('0x6f'),_0xced72d[_0xc812('0x26')])][_0xc812('0x2f')]===_0xc812('0x70')||this[_0xc812('0xf')][util[_0xc812('0x64')](_0xc812('0x6f'),_0xced72d[_0xc812('0x26')])][_0xc812('0x2f')]==='unmonitored');};Fax[_0xc812('0x1f')][_0xc812('0x5e')]=function(_0x339a62,_0x70ab5a){if(!this[_0xc812('0x6c')](_0x339a62)){ut['logger'](_0xc812('0x71'),_[_0xc812('0x6d')](_0x339a62)?'':_0x339a62['name']+_0xc812('0x72'));return{'isValid':![],'message':_0xc812('0x73')};}if(_[_0xc812('0x6d')](_0x70ab5a[_0xc812('0x7')])){ut[_0xc812('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xc812('0x42')](_0x70ab5a));return{'isValid':![],'message':_0xc812('0x74')};}if(_[_0xc812('0x6d')](_0x70ab5a['path'])){ut[_0xc812('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xc812('0x42')](_0x70ab5a));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xc812('0x75')]=Fax; \ No newline at end of file +var _0xe4fd=['[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','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','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','status','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','moment','path','tiff2pdf','./util/gs','../ami','./channel','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','hangup','originateresponse','syncOriginateResponse','prototype','channels','channel','uniqueid','name','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncFaxStatus','operation','localstationid','filename','info','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','\x20notify\x20','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate'];(function(_0x5886ea,_0xf1a4b5){var _0x206a01=function(_0x1be4d5){while(--_0x1be4d5){_0x5886ea['push'](_0x5886ea['shift']());}};_0x206a01(++_0xf1a4b5);}(_0xe4fd,0x100));var _0xde4f=function(_0x29ffb7,_0x296a68){_0x29ffb7=_0x29ffb7-0x0;var _0x23d28a=_0xe4fd[_0x29ffb7];return _0x23d28a;};'use strict';var util=require(_0xde4f('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xde4f('0x1'));var path=require(_0xde4f('0x2'));var tiff2pdf=require(_0xde4f('0x3'));var gs=require(_0xde4f('0x4'));var logger=require('../../../config/logger')('fax');var ami=require(_0xde4f('0x5'));var rpcDb=require('./rpcDb');var Channel=require(_0xde4f('0x6'));var ut=require('./util/util');var Action=require(_0xde4f('0x7'));var faxAccount=require(_0xde4f('0x8'));var attachment=require(_0xde4f('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0xbdab99){this['channels']={};this[_0xde4f('0xa')]=_0xbdab99[_0xde4f('0xa')];this['trunks']=_0xbdab99[_0xde4f('0xb')];this[_0xde4f('0xc')]={};ami['on'](_0xde4f('0xd'),this[_0xde4f('0xe')][_0xde4f('0xf')](this));ami['on'](_0xde4f('0x10'),this[_0xde4f('0x11')][_0xde4f('0xf')](this));ami['on'](_0xde4f('0x12'),this['syncNewState'][_0xde4f('0xf')](this));ami['on'](_0xde4f('0x13'),this[_0xde4f('0x14')]['bind'](this));ami['on'](_0xde4f('0x15'),this['syncFaxStatus'][_0xde4f('0xf')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xde4f('0xf')](this));ami['on'](_0xde4f('0x16'),this['syncHangup'][_0xde4f('0xf')](this));ami['on'](_0xde4f('0x17'),this[_0xde4f('0x18')][_0xde4f('0xf')](this));}Fax[_0xde4f('0x19')]['syncNewchannel']=function(_0x123568){if(_0x123568['context']==='from-voip-provider'){for(var _0x25481f in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x25481f)){if(_0x123568['exten']===this[_0xde4f('0xa')][_0x25481f]['localstationid']){this[_0xde4f('0x1a')][_0x123568['uniqueid']]={};this[_0xde4f('0x1a')][_0x123568['uniqueid']][_0xde4f('0x1b')]=_0x123568['channel'];this['channels'][_0x123568['uniqueid']]['id']=this[_0xde4f('0xa')][_0x25481f]['id'];this[_0xde4f('0x1a')][_0x123568[_0xde4f('0x1c')]][_0xde4f('0x1d')]=this[_0xde4f('0xa')][_0x25481f][_0xde4f('0x1d')];logger['info'](_0x123568[_0xde4f('0x1c')],'\x20syncNewchannel\x20');}}}}if(this[_0xde4f('0xc')][_0x123568[_0xde4f('0x1c')]]){this[_0xde4f('0x1a')][_0x123568[_0xde4f('0x1c')]]={};this[_0xde4f('0x1a')][_0x123568[_0xde4f('0x1c')]][_0xde4f('0x1b')]=_0x123568[_0xde4f('0x1b')];logger['info'](_0x123568[_0xde4f('0x1c')],_0xde4f('0x1e'));}};Fax[_0xde4f('0x19')][_0xde4f('0x11')]=function(_0x34ae9c){if(this[_0xde4f('0x1a')][_0x34ae9c[_0xde4f('0x1c')]]){for(var _0x59e342 in _0x34ae9c[_0xde4f('0x1f')]){if(_0x34ae9c[_0xde4f('0x1f')][_0xde4f('0x20')](_0x59e342)){this['channels'][_0x34ae9c[_0xde4f('0x1c')]][_0x59e342]=_0x34ae9c[_0xde4f('0x21')];}}}};Fax[_0xde4f('0x19')]['syncNewState']=function(_0xfa64c){if(this[_0xde4f('0x1a')][_0xfa64c[_0xde4f('0x1c')]]){this[_0xde4f('0x1a')][_0xfa64c['uniqueid']][_0xde4f('0x22')]=_0xfa64c[_0xde4f('0x22')];this[_0xde4f('0x1a')][_0xfa64c[_0xde4f('0x1c')]][_0xde4f('0x23')]=_0xfa64c[_0xde4f('0x23')];}};Fax[_0xde4f('0x19')][_0xde4f('0x14')]=function(_0x2254e5){if(this['channels'][_0x2254e5[_0xde4f('0x1c')]]){for(var _0x1fe92a in _0x2254e5['variable']){if(_0x2254e5[_0xde4f('0x1f')]['hasOwnProperty'](_0x1fe92a)){this[_0xde4f('0x1a')][_0x2254e5[_0xde4f('0x1c')]][_0x1fe92a]=_0x2254e5[_0xde4f('0x21')];}}}};Fax[_0xde4f('0x19')][_0xde4f('0x24')]=function(_0x4b9fbe){if(this['channels'][_0x4b9fbe[_0xde4f('0x1c')]]){this[_0xde4f('0x1a')][_0x4b9fbe[_0xde4f('0x1c')]][_0xde4f('0x25')]=_0x4b9fbe[_0xde4f('0x25')];this[_0xde4f('0x1a')][_0x4b9fbe[_0xde4f('0x1c')]]['status']=_0x4b9fbe['status'];this['channels'][_0x4b9fbe[_0xde4f('0x1c')]][_0xde4f('0x26')]=_0x4b9fbe[_0xde4f('0x26')];this['channels'][_0x4b9fbe[_0xde4f('0x1c')]][_0xde4f('0x27')]=_0x4b9fbe[_0xde4f('0x27')];logger[_0xde4f('0x28')](_0x4b9fbe[_0xde4f('0x1c')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xde4f('0x29')]=function(_0x5f0691){var _0x4716e5=this;if(this['channels'][_0x5f0691['uniqueid']]){var _0x13cbb3=this[_0xde4f('0x1a')][_0x5f0691[_0xde4f('0x1c')]]['id'];this['channels'][_0x5f0691[_0xde4f('0x1c')]][_0xde4f('0x2a')]=_0x5f0691[_0xde4f('0x2a')];this[_0xde4f('0x1a')][_0x5f0691[_0xde4f('0x1c')]][_0xde4f('0x2b')]=_0x5f0691[_0xde4f('0x2b')];this[_0xde4f('0x1a')][_0x5f0691[_0xde4f('0x1c')]]['localstationid']=_0x5f0691['localstationid'];this[_0xde4f('0x1a')][_0x5f0691[_0xde4f('0x1c')]][_0xde4f('0x2c')]=_0x5f0691[_0xde4f('0x2c')];this['channels'][_0x5f0691[_0xde4f('0x1c')]][_0xde4f('0x2d')]=_0x5f0691['transferrate'];this[_0xde4f('0x1a')][_0x5f0691['uniqueid']][_0xde4f('0x27')]=_0x5f0691[_0xde4f('0x27')];this[_0xde4f('0x1a')][_0x5f0691[_0xde4f('0x1c')]][_0xde4f('0x2e')]=_0x5f0691[_0xde4f('0x2e')];if(this[_0xde4f('0x1a')][_0x5f0691['uniqueid']][_0xde4f('0x2b')]>0x0){tiff2pdf(_0x5f0691[_0xde4f('0x27')],_0xde4f('0x2f'),function(_0x9f5508){logger[_0xde4f('0x28')](_0x5f0691[_0xde4f('0x1c')],'\x20result\x20conversion\x20file\x20',_0x9f5508[_0xde4f('0x30')]);attachment[_0xde4f('0x31')]({'name':path[_0xde4f('0x32')](_0x5f0691[_0xde4f('0x27')])[_0xde4f('0x1d')],'basename':path[_0xde4f('0x32')](_0x5f0691[_0xde4f('0x27')])[_0xde4f('0x1d')]+_0xde4f('0x33'),'type':_0xde4f('0x34')})[_0xde4f('0x35')](function(_0x5252b3){faxAccount[_0xde4f('0x36')](_0x13cbb3,{'from':_0x5f0691[_0xde4f('0x2e')],'mapKey':_0xde4f('0x37'),'body':path[_0xde4f('0x32')](_0x5f0691[_0xde4f('0x27')])[_0xde4f('0x1d')]+_0xde4f('0x33'),'AttachmentId':_0x5252b3['id']})[_0xde4f('0x38')](function(_0x40e440){logger['error'](_0x5f0691[_0xde4f('0x1c')],_0xde4f('0x39'),JSON['stringify'](_0x40e440));});})[_0xde4f('0x38')](function(_0x490a7a){logger[_0xde4f('0x3a')](_0x5f0691[_0xde4f('0x1c')],'\x20receiveFax\x20',JSON[_0xde4f('0x3b')](_0x490a7a));});});}logger['info'](_0x5f0691[_0xde4f('0x1c')],_0xde4f('0x3c'));}};Fax['prototype'][_0xde4f('0x18')]=function(_0x5ab2e3){if(this['actions'][_0x5ab2e3['uniqueid']]){_[_0xde4f('0x3d')](this['channels'][_0x5ab2e3[_0xde4f('0x1c')]],_[_0xde4f('0x3e')](_0x5ab2e3,[_0xde4f('0x3f'),_0xde4f('0x40')]));}};function updateStatus(_0x3a6683){if(_0x3a6683[_0xde4f('0x41')]){faxMessage[_0xde4f('0x42')](_0x3a6683[_0xde4f('0x41')],{'failMessage':_0xde4f('0x43')})[_0xde4f('0x35')](function(_0x48efcf){ut[_0xde4f('0x44')](_0xde4f('0x45'),_0x48efcf);})[_0xde4f('0x38')](function(_0x6fa325){ut['logger'](_0xde4f('0x46'),_0x6fa325);});}else{ut['logger'](_0xde4f('0x47'));}}Fax[_0xde4f('0x19')]['updateStatus']=function(_0x2f15fa,_0x3e61bc,_0x3bd73b){var _0x2019a1=this;var _0x1c422d={};if(_0x3e61bc){_0x1c422d={'read':_0x3e61bc};}else{_0x1c422d={'failMessage':_0x3bd73b};}if(this[_0xde4f('0xc')][_0x2f15fa][_0xde4f('0x41')]){faxMessage[_0xde4f('0x42')](this[_0xde4f('0xc')][_0x2f15fa][_0xde4f('0x41')],_0x1c422d)[_0xde4f('0x35')](function(_0x57fba2){ut[_0xde4f('0x44')](_0xde4f('0x48'),_0x57fba2);})['catch'](function(_0x47d070){ut[_0xde4f('0x44')](_0xde4f('0x49'),_0x47d070);})[_0xde4f('0x4a')](function(){delete _0x2019a1['channels'][_0x2f15fa];delete _0x2019a1[_0xde4f('0xc')][_0x2f15fa];});}else{ut[_0xde4f('0x44')](_0xde4f('0x4b'));delete this[_0xde4f('0x1a')][_0x2f15fa];delete this[_0xde4f('0xc')][_0x2f15fa];}};Fax['prototype'][_0xde4f('0x4c')]=function(_0x5ea3c2){var _0x17a574=this;if(this['channels'][_0x5ea3c2[_0xde4f('0x1c')]]){if(this['actions'][_0x5ea3c2[_0xde4f('0x1c')]]){this['channels'][_0x5ea3c2[_0xde4f('0x1c')]]['id']=this[_0xde4f('0xc')][_0x5ea3c2[_0xde4f('0x1c')]]['id'];this[_0xde4f('0x1a')][_0x5ea3c2['uniqueid']]['name']=this[_0xde4f('0xc')][_0x5ea3c2['uniqueid']][_0xde4f('0x1d')];}logger[_0xde4f('0x28')](_0x5ea3c2[_0xde4f('0x1c')],this[_0xde4f('0xc')][_0x5ea3c2[_0xde4f('0x1c')]]?_0xde4f('0x4d'):_0xde4f('0x4e'),JSON[_0xde4f('0x3b')](this[_0xde4f('0x1a')][_0x5ea3c2[_0xde4f('0x1c')]]));if(this['actions'][_0x5ea3c2['uniqueid']]){if(this[_0xde4f('0x1a')][_0x5ea3c2[_0xde4f('0x1c')]][_0xde4f('0x4f')]>0x0&&this['channels'][_0x5ea3c2[_0xde4f('0x1c')]][_0xde4f('0x15')]===_0xde4f('0x50')){this[_0xde4f('0x51')](_0x5ea3c2['uniqueid'],!![]);}else{this[_0xde4f('0x51')](_0x5ea3c2[_0xde4f('0x1c')],![],this[_0xde4f('0x1a')][_0x5ea3c2['uniqueid']][_0xde4f('0x52')]?_0xde4f('0x53')+this[_0xde4f('0x1a')][_0x5ea3c2[_0xde4f('0x1c')]][_0xde4f('0x52')]:'SENDING\x20FAILED');}}}};Fax[_0xde4f('0x19')][_0xde4f('0x54')]=function(_0x1a7777){var _0x5aec3f=this;return new BPromise(function(_0x359d17,_0xe853fe){_0x5aec3f[_0xde4f('0x55')](_0x1a7777,_0x5aec3f[_0xde4f('0xa')][_0x1a7777['FaxAccountId']])[_0xde4f('0x35')](function(_0x3c0674){ut['logger'](_0xde4f('0x56'),_0x3c0674);_0x359d17(ut[_0xde4f('0x30')]('Fax\x20received'));})[_0xde4f('0x38')](function(_0x43d218){ut[_0xde4f('0x44')](_0xde4f('0x57'),_0x43d218);updateStatus(_0x1a7777);_0xe853fe(ut[_0xde4f('0x30')](_0xde4f('0x58')));});});};Fax[_0xde4f('0x19')][_0xde4f('0x59')]=function(_0x374c26){var _0x1f7101=this;return new BPromise(function(_0x4b5c0a,_0x5b2065){var _0x1b86d7=_0x1f7101['checkTrunk'](_0x1f7101[_0xde4f('0xa')][_0x374c26['FaxAccountId']][_0xde4f('0x5a')],_0x374c26);if(_0x1b86d7['isValid']){_0x4b5c0a(ut[_0xde4f('0x30')]('Trunk\x20Reachable'));}else{_0x5b2065(ut[_0xde4f('0x30')](_0x1b86d7[_0xde4f('0x30')]));}});};function originate(_0x31a688,_0x735972,_0x15f18a){return new BPromise(function(_0x262dc9,_0x2c536a){if(_0x15f18a){var _0x4e8f4c=util[_0xde4f('0x5b')](_0xde4f('0x5c'),path[_0xde4f('0x32')](_0x31a688['path'])['name'],_0x31a688[_0xde4f('0x2')]);gs[_0xde4f('0x5d')](_0x4e8f4c)[_0xde4f('0x35')](function(){_0x31a688[_0xde4f('0x2')]=util[_0xde4f('0x5b')]('%s/%s.tif',path[_0xde4f('0x32')](_0x31a688['path'])[_0xde4f('0x5e')],path[_0xde4f('0x32')](_0x31a688[_0xde4f('0x2')])[_0xde4f('0x1d')]);_0x735972[_0xde4f('0x5f')]=_0x31a688['path'];ut[_0xde4f('0x44')]('Convert\x20pdf\x20to\x20tif','');ami[_0xde4f('0x60')](ut[_0xde4f('0x61')](_0x31a688,_0x735972))['then'](function(_0x4da1ce){_0x262dc9(_0x4da1ce);})['catch'](function(_0x66109c){_0x2c536a(_0x66109c);});})[_0xde4f('0x38')](function(_0x251e60){_0x2c536a(_0x251e60);});}else{ami['Action'](ut['variablesAction'](_0x31a688,_0x735972))[_0xde4f('0x35')](function(_0x4b0efb){_0x262dc9(_0x4b0efb);})['catch'](function(_0xe41e1c){_0x2c536a(_0xe41e1c);});}});}Fax[_0xde4f('0x19')][_0xde4f('0x55')]=function(_0x498eda,_0x2ca804){var _0x1cc3ec=this;return new BPromise(function(_0x584423,_0x551abf){var _0x191055=uuid['v4']();var _0x57a628=ut[_0xde4f('0x62')](_0x498eda,_0x2ca804);_0x1cc3ec[_0xde4f('0xc')][_0x191055]=new Action(_0x191055,_0x2ca804,_0x498eda);var _0x3866d8=_0x1cc3ec[_0xde4f('0xc')][_0x191055];if(path[_0xde4f('0x32')](_0x498eda[_0xde4f('0x2')])[_0xde4f('0x63')]===_0xde4f('0x33')){originate(_0x3866d8,_0x57a628,!![])['then'](function(_0xcee50c){_0x584423(_0xcee50c);})[_0xde4f('0x38')](function(_0xa819fb){_0x551abf(_0xa819fb);});}else{originate(_0x3866d8,_0x57a628,![])[_0xde4f('0x35')](function(_0x241648){_0x584423(_0x241648);})[_0xde4f('0x38')](function(_0x511508){_0x551abf(_0x511508);});}});};Fax[_0xde4f('0x19')][_0xde4f('0x64')]=function(_0x2c7c7a){return!_[_0xde4f('0x65')](_0x2c7c7a)&&!_[_0xde4f('0x65')](_0x2c7c7a[_0xde4f('0x1d')])&&!_[_0xde4f('0x65')](_0x2c7c7a[_0xde4f('0x66')])&&_0x2c7c7a['active']&&!_[_0xde4f('0x65')](this[_0xde4f('0xb')][util[_0xde4f('0x5b')]('SIP/%s',_0x2c7c7a[_0xde4f('0x1d')])])&&!_['isNil'](this[_0xde4f('0xb')][util[_0xde4f('0x5b')]('SIP/%s',_0x2c7c7a[_0xde4f('0x1d')])][_0xde4f('0x67')])&&(this[_0xde4f('0xb')][util[_0xde4f('0x5b')](_0xde4f('0x68'),_0x2c7c7a['name'])][_0xde4f('0x67')]===_0xde4f('0x69')||this[_0xde4f('0xb')][util['format']('SIP/%s',_0x2c7c7a[_0xde4f('0x1d')])][_0xde4f('0x67')]===_0xde4f('0x6a'));};Fax[_0xde4f('0x19')][_0xde4f('0x6b')]=function(_0xfaef9b,_0x1e10a7){if(!this[_0xde4f('0x64')](_0xfaef9b)){ut[_0xde4f('0x44')](_0xde4f('0x6c'),_[_0xde4f('0x65')](_0xfaef9b)?'':_0xfaef9b['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xde4f('0x6d')};}if(_['isNil'](_0x1e10a7['fax'])){ut[_0xde4f('0x44')](_0xde4f('0x6e'),JSON[_0xde4f('0x3b')](_0x1e10a7));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xde4f('0x65')](_0x1e10a7[_0xde4f('0x2')])){ut[_0xde4f('0x44')](_0xde4f('0x6f'),JSON[_0xde4f('0x3b')](_0x1e10a7));return{'isValid':![],'message':_0xde4f('0x70')};}return{'isValid':!![],'message':_0xde4f('0x71')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d63fde7..6697aaf 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 _0x8bb1=['util','bluebird','../../../config/logger','inspect','then','notify','catch','[Notify]\x20'];(function(_0x3aeec8,_0x2c1553){var _0x20da91=function(_0x2534a6){while(--_0x2534a6){_0x3aeec8['push'](_0x3aeec8['shift']());}};_0x20da91(++_0x2c1553);}(_0x8bb1,0xd0));var _0x18bb=function(_0x43031c,_0x4af984){_0x43031c=_0x43031c-0x0;var _0x1fd90f=_0x8bb1[_0x43031c];return _0x1fd90f;};'use strict';var util=require(_0x18bb('0x0'));var BPromise=require(_0x18bb('0x1'));var logger=require(_0x18bb('0x2'))('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x31eb8b){return function(_0x5f417c){logger['error'](_0x31eb8b,util[_0x18bb('0x3')](_0x5f417c,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2c2986,_0x19f32a){return BPromise['resolve']()[_0x18bb('0x4')](faxAccount[_0x18bb('0x5')](_0x2c2986,_0x19f32a))[_0x18bb('0x6')](loggerCatch(_0x18bb('0x7')));}; \ No newline at end of file +var _0x0844=['error','inspect','catch','[Notify]\x20','util','preview','lodash','../rpc/faxAccount'];(function(_0x49d4d0,_0x586c1d){var _0x12bccf=function(_0xffb899){while(--_0xffb899){_0x49d4d0['push'](_0x49d4d0['shift']());}};_0x12bccf(++_0x586c1d);}(_0x0844,0x14c));var _0x4084=function(_0x4196c9,_0x103775){_0x4196c9=_0x4196c9-0x0;var _0xa05df4=_0x0844[_0x4196c9];return _0xa05df4;};'use strict';var util=require(_0x4084('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x4084('0x1'));var _=require(_0x4084('0x2'));var faxAccount=require(_0x4084('0x3'));function loggerCatch(_0x54a5bc){return function(_0x28d6df){logger[_0x4084('0x4')](_0x54a5bc,util[_0x4084('0x5')](_0x28d6df,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x154f30,_0x41ab7a){return BPromise['resolve']()['then'](faxAccount['notify'](_0x154f30,_0x41ab7a))[_0x4084('0x6')](loggerCatch(_0x4084('0x7')));}; \ 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 66ceb5a..ab2c346 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 _0x0fee=['info','Exec\x20gs','util','../../../../config/logger','fax','child_process','exec','execute'];(function(_0x44e904,_0x224df7){var _0x2640db=function(_0x18e9e7){while(--_0x18e9e7){_0x44e904['push'](_0x44e904['shift']());}};_0x2640db(++_0x224df7);}(_0x0fee,0x172));var _0xe0fe=function(_0x334bdb,_0x1d188e){_0x334bdb=_0x334bdb-0x0;var _0x520f1b=_0x0fee[_0x334bdb];return _0x520f1b;};'use strict';var util=require(_0xe0fe('0x0'));var logger=require(_0xe0fe('0x1'))(_0xe0fe('0x2'));var BPromise=require('bluebird');var exec=require(_0xe0fe('0x3'))[_0xe0fe('0x4')];exports[_0xe0fe('0x5')]=function(_0xa1ea0){return new BPromise(function(_0xb75da,_0x5bc1a4){exec(_0xa1ea0,function(_0x3ff928,_0x24bf9b,_0x3fb0ac){logger[_0xe0fe('0x6')](_0xe0fe('0x7'),_0x24bf9b);if(_0x3ff928){logger[_0xe0fe('0x6')](_0xe0fe('0x7'),'\x20Error\x20:',util['inspect'](_0x3ff928,{'showHidden':![],'depth':null}),_0x24bf9b,_0x3fb0ac);_0x5bc1a4(_0x3ff928);}_0xb75da(_0x24bf9b);});});}; \ No newline at end of file +var _0xd6de=['\x20Error\x20:','../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xd6de,0xa1));var _0xed6d=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd6de[_0x46698a];return _0x356db0;};'use strict';var util=require('util');var logger=require(_0xed6d('0x0'))(_0xed6d('0x1'));var BPromise=require(_0xed6d('0x2'));var exec=require(_0xed6d('0x3'))['exec'];exports[_0xed6d('0x4')]=function(_0x542c67){return new BPromise(function(_0x2c1656,_0xbfeccc){exec(_0x542c67,function(_0x5a21dc,_0xb166a,_0xbf9186){logger[_0xed6d('0x5')](_0xed6d('0x6'),_0xb166a);if(_0x5a21dc){logger['info']('Exec\x20gs',_0xed6d('0x7'),util['inspect'](_0x5a21dc,{'showHidden':![],'depth':null}),_0xb166a,_0xbf9186);_0xbfeccc(_0x5a21dc);}_0x2c1656(_0xb166a);});});}; \ 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 4e667f8..f59c2d2 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 _0x8ee7=['faxdetect','t38timeout','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','localstationid','util','../../../../config/logger','fax','logger','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem'];(function(_0x200827,_0x4af951){var _0x120047=function(_0x4431de){while(--_0x4431de){_0x200827['push'](_0x200827['shift']());}};_0x120047(++_0x4af951);}(_0x8ee7,0x1c1));var _0x78ee=function(_0x413704,_0x1ec284){_0x413704=_0x413704-0x0;var _0x372b28=_0x8ee7[_0x413704];return _0x372b28;};'use strict';var util=require(_0x78ee('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x78ee('0x1'))(_0x78ee('0x2'));exports['message']=function(_0x33ce4b){return{'message':_0x33ce4b};};exports[_0x78ee('0x3')]=function(_0x16e3c2,_0x43ed8c){logger['info'](_0x16e3c2,util['inspect'](_0x43ed8c,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x443f6f,_0x1a95af){var _0x50611e={'XMF-ECM':_0x1a95af[_0x78ee('0x4')],'XMF-HEADERINFO':_0x1a95af[_0x78ee('0x5')],'XMF-MINRATE':_0x1a95af[_0x78ee('0x6')],'XMF-MAXRATE':_0x1a95af[_0x78ee('0x7')],'XMF-MODEM':util[_0x78ee('0x8')](_0x78ee('0x9'),_0x1a95af[_0x78ee('0xa')]),'XMF-GATEWAY':_0x1a95af['gateway'],'XMF-FAXDETECT':_0x1a95af[_0x78ee('0xb')],'XMF-T38TIMEOUT':_0x1a95af[_0x78ee('0xc')],'XMF-LOCALSTATIONID':_0x1a95af['localstationid'],'XMF-PATH':_0x443f6f[_0x78ee('0xd')]};return _0x50611e;};exports[_0x78ee('0xe')]=function(_0x42af2c,_0x5cfbdf){return{'actionid':_0x42af2c['uniqueid'],'action':_0x78ee('0xf'),'channel':_0x42af2c[_0x78ee('0x10')],'Exten':_0x78ee('0x11'),'Context':_0x78ee('0x12'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x42af2c[_0x78ee('0x5')]?_0x42af2c[_0x78ee('0x5')]:'',_0x42af2c[_0x78ee('0x13')]),'variable':_0x5cfbdf,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x42af2c['uniqueid']};}; \ No newline at end of file +var _0xd6cd=['info','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','faxdetect','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','moment','fax','message','logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd6cd,0x19d));var _0xdd6c=function(_0x9dab17,_0x2283f3){_0x9dab17=_0x9dab17-0x0;var _0x370f25=_0xd6cd[_0x9dab17];return _0x370f25;};'use strict';var util=require(_0xdd6c('0x0'));var _=require('lodash');var moment=require(_0xdd6c('0x1'));var logger=require('../../../../config/logger')(_0xdd6c('0x2'));exports[_0xdd6c('0x3')]=function(_0x488207){return{'message':_0x488207};};exports[_0xdd6c('0x4')]=function(_0x3ee5a2,_0x3e669a){logger[_0xdd6c('0x5')](_0x3ee5a2,util[_0xdd6c('0x6')](_0x3e669a,{'showHidden':![],'depth':null}));};exports[_0xdd6c('0x7')]=function(_0x10b8b9,_0x497504){var _0x2a2ee3={'XMF-ECM':_0x497504['ecm'],'XMF-HEADERINFO':_0x497504[_0xdd6c('0x8')],'XMF-MINRATE':_0x497504[_0xdd6c('0x9')],'XMF-MAXRATE':_0x497504[_0xdd6c('0xa')],'XMF-MODEM':util['format'](_0xdd6c('0xb'),_0x497504[_0xdd6c('0xc')]),'XMF-GATEWAY':_0x497504['gateway'],'XMF-FAXDETECT':_0x497504[_0xdd6c('0xd')],'XMF-T38TIMEOUT':_0x497504['t38timeout'],'XMF-LOCALSTATIONID':_0x497504[_0xdd6c('0xe')],'XMF-PATH':_0x10b8b9['path']};return _0x2a2ee3;};exports[_0xdd6c('0xf')]=function(_0x1f37a5,_0x55df79){return{'actionid':_0x1f37a5[_0xdd6c('0x10')],'action':'originate','channel':_0x1f37a5[_0xdd6c('0x11')],'Exten':_0xdd6c('0x12'),'Context':_0xdd6c('0x13'),'Priority':'1','callerid':util[_0xdd6c('0x14')](_0xdd6c('0x15'),_0x1f37a5['headerinfo']?_0x1f37a5['headerinfo']:'',_0x1f37a5[_0xdd6c('0xe')]),'variable':_0x55df79,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1f37a5[_0xdd6c('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9427251..16a146c 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 _0x11cf=['./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','hour','get','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueHopperHistory','catch','log','listen','sync','bluebird','moment','./server','./realtime','./report','./trigger','./dialer','./preview'];(function(_0x5dbb7a,_0x481d9e){var _0x4fea06=function(_0x3e3f18){while(--_0x3e3f18){_0x5dbb7a['push'](_0x5dbb7a['shift']());}};_0x4fea06(++_0x481d9e);}(_0x11cf,0xfc));var _0xf11c=function(_0x1b25ca,_0x1c43b3){_0x1b25ca=_0x1b25ca-0x0;var _0x118990=_0x11cf[_0x1b25ca];return _0x118990;};'use strict';var BPromise=require(_0xf11c('0x0'));var util=require('util');var moment=require(_0xf11c('0x1'));var server=require(_0xf11c('0x2'));var Realtime=require(_0xf11c('0x3'));var Report=require(_0xf11c('0x4'));var Acw=require('./acw');var Trigger=require(_0xf11c('0x5'));var Dialer=require(_0xf11c('0x6'));var Preview=require(_0xf11c('0x7'));var Fax=require(_0xf11c('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xf11c('0x9'));var voiceQueueReport=require(_0xf11c('0xa'));var voiceCallReport=require(_0xf11c('0xb'));var trunk=require(_0xf11c('0xc'));var trigger=require(_0xf11c('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0xf11c('0xe'));var campaign=require(_0xf11c('0xf'));var voiceExtension=require(_0xf11c('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xf11c('0x11'));var salesforce=require(_0xf11c('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xf11c('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xf11c('0x14'));var vtiger=require(_0xf11c('0x15'));var freshsales=require(_0xf11c('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xf11c('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xf11c('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf11c('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf11c('0x1a')]()['then'](user[_0xf11c('0x1b')]())[_0xf11c('0x1c')](realtime['initAgents']())[_0xf11c('0x1c')](user[_0xf11c('0x1d')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x1e')]())[_0xf11c('0x1c')](trunk[_0xf11c('0x1f')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x20')]())[_0xf11c('0x1c')](voiceQueue[_0xf11c('0x21')]())['then'](realtime[_0xf11c('0x22')]())['then'](trigger[_0xf11c('0x23')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x24')]())['then'](template[_0xf11c('0x25')]())[_0xf11c('0x1c')](realtime['initTemplates']())[_0xf11c('0x1c')](zendesk[_0xf11c('0x26')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x27')]())['then'](salesforce[_0xf11c('0x28')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x29')]())[_0xf11c('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0xf11c('0x1c')](realtime[_0xf11c('0x2a')]())[_0xf11c('0x1c')](freshdesk[_0xf11c('0x2b')]())['then'](realtime[_0xf11c('0x2c')]())[_0xf11c('0x1c')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0xf11c('0x1c')](zoho[_0xf11c('0x2d')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x2e')]())[_0xf11c('0x1c')](vtiger[_0xf11c('0x2f')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x30')]())[_0xf11c('0x1c')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xf11c('0x31')]())[_0xf11c('0x1c')](servicenow[_0xf11c('0x32')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x33')]())[_0xf11c('0x1c')](dynamics365[_0xf11c('0x34')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x35')]())[_0xf11c('0x1c')](campaign[_0xf11c('0x36')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x37')]())[_0xf11c('0x1c')](voiceExtension[_0xf11c('0x38')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x39')]())[_0xf11c('0x1c')](faxAccount[_0xf11c('0x3a')]())[_0xf11c('0x1c')](realtime[_0xf11c('0x3b')]())[_0xf11c('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xf11c('0x1a')]()[_0xf11c('0x1c')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime['initVoiceQueueReports']())[_0xf11c('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xf11c('0x1c')](realtime[_0xf11c('0x3c')]())[_0xf11c('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0xf11c('0x1c')](realtime['initCampaignHopperHistory']())[_0xf11c('0x1c')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())['then'](function(_0x9e4456){})[_0xf11c('0x3d')](function(_0xeab199){console[_0xf11c('0x3e')](_0xeab199);});}function main(){return server[_0xf11c('0x3f')](realtime,preview,fax)['then'](function(_0x4259cb){return initRealtime();})['then'](function(){return initParams();})[_0xf11c('0x1c')](function(){report[_0xf11c('0x40')]();setInterval(initRealtime,0x1388);})[_0xf11c('0x3d')](function(_0x2b9a7f){console[_0xf11c('0x3e')](_0x2b9a7f);});}main(); \ No newline at end of file +var _0xd7d2=['get','hour','resolve','then','initAgents','getTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xd7d2,0xa9));var _0x2d7d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd7d2[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var util=require(_0x2d7d('0x0'));var moment=require(_0x2d7d('0x1'));var server=require(_0x2d7d('0x2'));var Realtime=require(_0x2d7d('0x3'));var Report=require(_0x2d7d('0x4'));var Acw=require('./acw');var Trigger=require(_0x2d7d('0x5'));var Dialer=require(_0x2d7d('0x6'));var Preview=require(_0x2d7d('0x7'));var Fax=require(_0x2d7d('0x8'));var user=require(_0x2d7d('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x2d7d('0xa'));var trunk=require(_0x2d7d('0xb'));var trigger=require(_0x2d7d('0xc'));var template=require(_0x2d7d('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x2d7d('0xe'));var voiceExtension=require(_0x2d7d('0xf'));var faxAccount=require(_0x2d7d('0x10'));var zendesk=require(_0x2d7d('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x2d7d('0x12'));var freshdesk=require(_0x2d7d('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x2d7d('0x14'));var freshsales=require(_0x2d7d('0x15'));var servicenow=require(_0x2d7d('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2d7d('0x17')](_0x2d7d('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2d7d('0x17')](_0x2d7d('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2d7d('0x19')]()[_0x2d7d('0x1a')](user['getAgents']())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x1b')]())['then'](user[_0x2d7d('0x1c')]())[_0x2d7d('0x1a')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x2d7d('0x1a')](realtime['initTrunks']())[_0x2d7d('0x1a')](voiceQueue[_0x2d7d('0x1d')]())['then'](realtime[_0x2d7d('0x1e')]())[_0x2d7d('0x1a')](trigger[_0x2d7d('0x1f')]())[_0x2d7d('0x1a')](realtime['initTriggers']())[_0x2d7d('0x1a')](template['getTemplates']())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x20')]())[_0x2d7d('0x1a')](zendesk[_0x2d7d('0x21')]())['then'](realtime['initZendeskAccounts']())['then'](salesforce[_0x2d7d('0x22')]())['then'](realtime[_0x2d7d('0x23')]())[_0x2d7d('0x1a')](sugarcrm[_0x2d7d('0x24')]())['then'](realtime[_0x2d7d('0x25')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x26')]())['then'](desk[_0x2d7d('0x27')]())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x28')]())[_0x2d7d('0x1a')](zoho[_0x2d7d('0x29')]())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x2a')]())[_0x2d7d('0x1a')](vtiger[_0x2d7d('0x2b')]())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x2c')]())['then'](freshsales[_0x2d7d('0x2d')]())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x2e')]())['then'](servicenow[_0x2d7d('0x2f')]())['then'](realtime['initServicenowAccounts']())[_0x2d7d('0x1a')](dynamics365[_0x2d7d('0x30')]())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x31')]())[_0x2d7d('0x1a')](campaign['getCampaigns']())['then'](realtime[_0x2d7d('0x32')]())[_0x2d7d('0x1a')](voiceExtension[_0x2d7d('0x33')]())['then'](realtime['initVoiceExtensions']())[_0x2d7d('0x1a')](faxAccount['getFaxAccounts']())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x34')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x2d7d('0x1a')](voiceQueueReport[_0x2d7d('0x35')]())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x36')]())[_0x2d7d('0x1a')](cmHopperHistory[_0x2d7d('0x37')]())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x38')]())[_0x2d7d('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x39')]())[_0x2d7d('0x1a')](voiceCallReport[_0x2d7d('0x3a')]())[_0x2d7d('0x1a')](realtime[_0x2d7d('0x3b')]())[_0x2d7d('0x1a')](function(_0x22a5a6){})[_0x2d7d('0x3c')](function(_0x108ed3){console['log'](_0x108ed3);});}function main(){return server[_0x2d7d('0x3d')](realtime,preview,fax)[_0x2d7d('0x1a')](function(_0x31da4e){return initRealtime();})[_0x2d7d('0x1a')](function(){return initParams();})[_0x2d7d('0x1a')](function(){report[_0x2d7d('0x3e')]();setInterval(initRealtime,0x1388);})[_0x2d7d('0x3c')](function(_0x9f985f){console[_0x2d7d('0x3f')](_0x9f985f);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index e1e5c15..35ea650 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x472a2d,_0x124249){var _0xf2b4e9=function(_0x424c38){while(--_0x424c38){_0x472a2d['push'](_0x472a2d['shift']());}};_0xf2b4e9(++_0x124249);}(_0x70e0,0x17b));var _0x070e=function(_0x599d32,_0x382829){_0x599d32=_0x599d32-0x0;var _0x5e9f55=_0x70e0[_0x599d32];return _0x5e9f55;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x2db63f,_0x5e3dcc){var _0x2da78c=function(_0x3598ea){while(--_0x3598ea){_0x2db63f['push'](_0x2db63f['shift']());}};_0x2da78c(++_0x5e3dcc);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 1f668e2..ce19155 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 _0xd2a5=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x1c98e2,_0x59f74c){var _0x1f045b=function(_0x48ee23){while(--_0x48ee23){_0x1c98e2['push'](_0x1c98e2['shift']());}};_0x1f045b(++_0x59f74c);}(_0xd2a5,0x192));var _0x5d2a=function(_0x290ef5,_0x32cfa7){_0x290ef5=_0x290ef5-0x0;var _0x450d92=_0xd2a5[_0x290ef5];return _0x450d92;};'use strict';function Campaign(_0x18839b){this['id']=_0x18839b['id']||0x0;this['name']=_0x18839b['name']||'';this[_0x5d2a('0x0')]=_0x18839b[_0x5d2a('0x0')]||_0x5d2a('0x1');this['originated']=0x0;this[_0x5d2a('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x5d2a('0x3')]='';this[_0x5d2a('0x4')]=!![];this['active']=_0x18839b[_0x5d2a('0x5')];this[_0x5d2a('0x6')]=_0x18839b[_0x5d2a('0x6')];this[_0x5d2a('0x7')]=_0x18839b[_0x5d2a('0x7')]||null;this[_0x5d2a('0x8')]=_0x18839b['dialGlobalInterval']?_0x18839b['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x18839b['dialOriginateCallerIdName'];this[_0x5d2a('0x9')]=_0x18839b['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x18839b['dialOriginateTimeout']||0x1e;this[_0x5d2a('0xa')]=_0x18839b[_0x5d2a('0xa')];this[_0x5d2a('0xb')]=_0x18839b[_0x5d2a('0xb')];this['dialBusyMaxRetry']=_0x18839b[_0x5d2a('0xc')];this[_0x5d2a('0xd')]=_0x18839b[_0x5d2a('0xd')];this[_0x5d2a('0xe')]=_0x18839b[_0x5d2a('0xe')];this[_0x5d2a('0xf')]=_0x18839b[_0x5d2a('0xf')];this[_0x5d2a('0x10')]=_0x18839b[_0x5d2a('0x10')];this['dialNoSuchNumberMaxRetry']=_0x18839b[_0x5d2a('0x11')]||0x3;this[_0x5d2a('0x12')]=_0x18839b[_0x5d2a('0x12')]||0x96;this[_0x5d2a('0x13')]=_0x18839b[_0x5d2a('0x13')]||0x3;this['dialDropRetryFrequency']=_0x18839b[_0x5d2a('0x14')]||0x96;this[_0x5d2a('0x15')]=_0x18839b[_0x5d2a('0x15')]||0x3;this['dialAbandonedRetryFrequency']=_0x18839b[_0x5d2a('0x16')]||0x96;this[_0x5d2a('0x17')]=_0x18839b[_0x5d2a('0x17')]||0x3;this[_0x5d2a('0x18')]=_0x18839b[_0x5d2a('0x18')]||0x96;this['dialAgentRejectMaxRetry']=_0x18839b[_0x5d2a('0x19')]||0x3;this['dialAgentRejectRetryFrequency']=_0x18839b['dialAgentRejectRetryFrequency']||0x96;this[_0x5d2a('0x1a')]=_0x18839b[_0x5d2a('0x1a')]||'DESC';this[_0x5d2a('0x1b')]=_0x18839b[_0x5d2a('0x1b')]||undefined;this[_0x5d2a('0x1c')]=_0x18839b[_0x5d2a('0x1c')]||undefined;this[_0x5d2a('0x1d')]=_0x18839b[_0x5d2a('0x1d')]||undefined;this['TrunkBackup']=_0x18839b[_0x5d2a('0x1e')]?_0x18839b[_0x5d2a('0x1e')]:undefined;this[_0x5d2a('0x1f')]=_0x18839b[_0x5d2a('0x1f')]?_0x18839b['Trunk']:undefined;this[_0x5d2a('0x20')]=_0x18839b[_0x5d2a('0x20')]?_0x18839b[_0x5d2a('0x20')]:undefined;this[_0x5d2a('0x21')]=_0x18839b[_0x5d2a('0x21')]?_0x18839b[_0x5d2a('0x21')]:undefined;this[_0x5d2a('0x22')]=_0x18839b[_0x5d2a('0x21')]?_0x18839b[_0x5d2a('0x21')]['name']:undefined;this[_0x5d2a('0x23')]=_0x18839b[_0x5d2a('0x23')]||![];this[_0x5d2a('0x24')]=_0x18839b[_0x5d2a('0x24')];this[_0x5d2a('0x25')]=_0x18839b[_0x5d2a('0x25')];this[_0x5d2a('0x26')]=_0x18839b[_0x5d2a('0x26')];this[_0x5d2a('0x27')]=_0x18839b[_0x5d2a('0x27')];this['dialAMDMinWordLength']=_0x18839b[_0x5d2a('0x28')];this[_0x5d2a('0x29')]=_0x18839b['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x18839b[_0x5d2a('0x2a')];this[_0x5d2a('0x2b')]=_0x18839b[_0x5d2a('0x2b')];this[_0x5d2a('0x2c')]=_0x18839b[_0x5d2a('0x2c')];}module[_0x5d2a('0x2d')]=Campaign; \ No newline at end of file +var _0xe821=['ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp'];(function(_0x45cd22,_0x38bd5c){var _0x8e5a46=function(_0x5dabd3){while(--_0x5dabd3){_0x45cd22['push'](_0x45cd22['shift']());}};_0x8e5a46(++_0x38bd5c);}(_0xe821,0x1cf));var _0x1e82=function(_0x14faf4,_0x4a369d){_0x14faf4=_0x14faf4-0x0;var _0x5b2381=_0xe821[_0x14faf4];return _0x5b2381;};'use strict';function Campaign(_0x5a312e){this['id']=_0x5a312e['id']||0x0;this[_0x1e82('0x0')]=_0x5a312e[_0x1e82('0x0')]||'';this['type']=_0x5a312e[_0x1e82('0x1')]||_0x1e82('0x2');this[_0x1e82('0x3')]=0x0;this[_0x1e82('0x4')]=0x0;this[_0x1e82('0x5')]=0x0;this[_0x1e82('0x6')]=0x0;this[_0x1e82('0x7')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x5a312e[_0x1e82('0x8')];this[_0x1e82('0x9')]=_0x5a312e[_0x1e82('0x9')];this[_0x1e82('0xa')]=_0x5a312e[_0x1e82('0xa')]||null;this[_0x1e82('0xb')]=_0x5a312e['dialGlobalInterval']?_0x5a312e[_0x1e82('0xb')]:null;this[_0x1e82('0xc')]=_0x5a312e[_0x1e82('0xc')];this[_0x1e82('0xd')]=_0x5a312e['dialOriginateCallerIdNumber'];this[_0x1e82('0xe')]=_0x5a312e['dialOriginateTimeout']||0x1e;this[_0x1e82('0xf')]=_0x5a312e[_0x1e82('0xf')];this['dialCongestionRetryFrequency']=_0x5a312e[_0x1e82('0x10')];this['dialBusyMaxRetry']=_0x5a312e['dialBusyMaxRetry'];this[_0x1e82('0x11')]=_0x5a312e[_0x1e82('0x11')];this[_0x1e82('0x12')]=_0x5a312e[_0x1e82('0x12')];this[_0x1e82('0x13')]=_0x5a312e[_0x1e82('0x13')];this[_0x1e82('0x14')]=_0x5a312e['dialGlobalMaxRetry'];this[_0x1e82('0x15')]=_0x5a312e[_0x1e82('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5a312e[_0x1e82('0x16')]||0x96;this[_0x1e82('0x17')]=_0x5a312e[_0x1e82('0x17')]||0x3;this[_0x1e82('0x18')]=_0x5a312e[_0x1e82('0x18')]||0x96;this[_0x1e82('0x19')]=_0x5a312e[_0x1e82('0x19')]||0x3;this[_0x1e82('0x1a')]=_0x5a312e[_0x1e82('0x1a')]||0x96;this[_0x1e82('0x1b')]=_0x5a312e[_0x1e82('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x5a312e[_0x1e82('0x1c')]||0x96;this[_0x1e82('0x1d')]=_0x5a312e[_0x1e82('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5a312e[_0x1e82('0x1e')]||0x96;this[_0x1e82('0x1f')]=_0x5a312e[_0x1e82('0x1f')]||_0x1e82('0x20');this['dialPrefix']=_0x5a312e[_0x1e82('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5a312e[_0x1e82('0x22')]||undefined;this[_0x1e82('0x23')]=_0x5a312e[_0x1e82('0x23')]||undefined;this['TrunkBackup']=_0x5a312e[_0x1e82('0x24')]?_0x5a312e[_0x1e82('0x24')]:undefined;this[_0x1e82('0x25')]=_0x5a312e['Trunk']?_0x5a312e[_0x1e82('0x25')]:undefined;this[_0x1e82('0x26')]=_0x5a312e[_0x1e82('0x26')]?_0x5a312e['Interval']:undefined;this['SquareProject']=_0x5a312e[_0x1e82('0x27')]?_0x5a312e[_0x1e82('0x27')]:undefined;this[_0x1e82('0x28')]=_0x5a312e[_0x1e82('0x27')]?_0x5a312e[_0x1e82('0x27')][_0x1e82('0x0')]:undefined;this[_0x1e82('0x29')]=_0x5a312e[_0x1e82('0x29')]||![];this['dialAMDInitialSilence']=_0x5a312e[_0x1e82('0x2a')];this[_0x1e82('0x2b')]=_0x5a312e['dialAMDGreeting'];this[_0x1e82('0x2c')]=_0x5a312e['dialAMDAfterGreetingSilence'];this[_0x1e82('0x2d')]=_0x5a312e[_0x1e82('0x2d')];this[_0x1e82('0x2e')]=_0x5a312e[_0x1e82('0x2e')];this[_0x1e82('0x2f')]=_0x5a312e[_0x1e82('0x2f')];this['dialAMDMaximumNumberOfWords']=_0x5a312e[_0x1e82('0x30')];this[_0x1e82('0x31')]=_0x5a312e[_0x1e82('0x31')];this[_0x1e82('0x32')]=_0x5a312e[_0x1e82('0x32')];}module[_0x1e82('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 95aec12..77b99be 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 _0x7d8a=['type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime'];(function(_0x10dc8e,_0x349d57){var _0x527f53=function(_0x4d457f){while(--_0x4d457f){_0x10dc8e['push'](_0x10dc8e['shift']());}};_0x527f53(++_0x349d57);}(_0x7d8a,0xbf));var _0xa7d8=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x7d8a[_0x5f1391];return _0x50ebe3;};'use strict';function Channel(){this[_0xa7d8('0x0')]=null;this[_0xa7d8('0x1')]='';this[_0xa7d8('0x2')]='';this['calleridnum']=0x0;this[_0xa7d8('0x3')]='';this['connectedlinenum']=undefined;this[_0xa7d8('0x4')]=undefined;this[_0xa7d8('0x5')]=0x0;this[_0xa7d8('0x6')]='';this[_0xa7d8('0x7')]=0x0;this[_0xa7d8('0x8')]=0x0;this['exten']=0x0;this[_0xa7d8('0x9')]=![];this[_0xa7d8('0xa')]=null;this[_0xa7d8('0xb')]=null;this[_0xa7d8('0xc')]=![];this['abandoned']=![];this[_0xa7d8('0xd')]='';this[_0xa7d8('0xe')]='';this[_0xa7d8('0xf')]=0x0;this['billableseconds']=0x0;this[_0xa7d8('0x10')]=0x0;this[_0xa7d8('0x11')]=null;this[_0xa7d8('0x12')]=null;this['disposition']=null;this[_0xa7d8('0x13')]=![];this[_0xa7d8('0x14')]=null;this[_0xa7d8('0x15')]=null;this[_0xa7d8('0x16')]=[];this[_0xa7d8('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0xa7d8('0x18')]=0x0;}module[_0xa7d8('0x19')]=Channel; \ No newline at end of file +var _0xb8f0=['exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastdata','duration','type','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x1f13f0,_0x66cc8d){var _0xeda5eb=function(_0x18874d){while(--_0x18874d){_0x1f13f0['push'](_0x1f13f0['shift']());}};_0xeda5eb(++_0x66cc8d);}(_0xb8f0,0x16d));var _0x0b8f=function(_0x22b17c,_0x4d2f9d){_0x22b17c=_0x22b17c-0x0;var _0x5b2817=_0xb8f0[_0x22b17c];return _0x5b2817;};'use strict';function Channel(){this[_0x0b8f('0x0')]=null;this[_0x0b8f('0x1')]='';this['destinationchannel']='';this[_0x0b8f('0x2')]=0x0;this[_0x0b8f('0x3')]='';this[_0x0b8f('0x4')]=undefined;this[_0x0b8f('0x5')]=undefined;this[_0x0b8f('0x6')]=0x0;this[_0x0b8f('0x7')]='';this[_0x0b8f('0x8')]=0x0;this[_0x0b8f('0x9')]=0x0;this[_0x0b8f('0xa')]=0x0;this[_0x0b8f('0xb')]=![];this['answertime']=null;this[_0x0b8f('0xc')]=null;this[_0x0b8f('0xd')]=![];this[_0x0b8f('0xe')]=![];this['lastapplication']='';this[_0x0b8f('0xf')]='';this[_0x0b8f('0x10')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x0b8f('0x11')]=null;this['tag']=null;this[_0x0b8f('0x12')]=null;this[_0x0b8f('0x13')]=![];this[_0x0b8f('0x14')]=null;this[_0x0b8f('0x15')]=null;this['monitors']=[];this[_0x0b8f('0x16')]=undefined;this[_0x0b8f('0x17')]=undefined;this[_0x0b8f('0x18')]=undefined;this['mohtime']=0x0;}module[_0x0b8f('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9eff8dd..3a68a2a 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 _0x2fe1=['exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x2fe1,0x1c9));var _0x12fe=function(_0x4efe81,_0x38346c){_0x4efe81=_0x4efe81-0x0;var _0x1976e3=_0x2fe1[_0x4efe81];return _0x1976e3;};'use strict';function DeskAccount(_0x479a26){this['id']=_0x479a26['id']||0x0;this[_0x12fe('0x0')]=_0x479a26[_0x12fe('0x0')]||'';this['username']=_0x479a26['username']||'';this['remoteUri']=_0x479a26[_0x12fe('0x1')]||'';this[_0x12fe('0x2')]=_0x479a26[_0x12fe('0x2')]||'';this[_0x12fe('0x3')]=_0x479a26[_0x12fe('0x3')]||'';this['consumerKey']=_0x479a26[_0x12fe('0x4')]||'';this[_0x12fe('0x5')]=_0x479a26['consumerSecret']||'';this[_0x12fe('0x6')]=_0x479a26[_0x12fe('0x6')]||'';this['tokenSecret']=_0x479a26[_0x12fe('0x7')]||'';this[_0x12fe('0x8')]=_0x479a26[_0x12fe('0x8')]||'';this[_0x12fe('0x9')]=_0x479a26[_0x12fe('0x9')]||'';this[_0x12fe('0xa')]=_0x479a26[_0x12fe('0xa')]||{};}module[_0x12fe('0xb')]=DeskAccount; \ No newline at end of file +var _0x8fcc=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x2ceb9b,_0x52abdc){var _0x498972=function(_0x5ec937){while(--_0x5ec937){_0x2ceb9b['push'](_0x2ceb9b['shift']());}};_0x498972(++_0x52abdc);}(_0x8fcc,0x172));var _0xc8fc=function(_0x169863,_0x3118e5){_0x169863=_0x169863-0x0;var _0x1c7a83=_0x8fcc[_0x169863];return _0x1c7a83;};'use strict';function DeskAccount(_0x4bc2a7){this['id']=_0x4bc2a7['id']||0x0;this['name']=_0x4bc2a7[_0xc8fc('0x0')]||'';this['username']=_0x4bc2a7[_0xc8fc('0x1')]||'';this[_0xc8fc('0x2')]=_0x4bc2a7[_0xc8fc('0x2')]||'';this[_0xc8fc('0x3')]=_0x4bc2a7[_0xc8fc('0x3')]||'';this[_0xc8fc('0x4')]=_0x4bc2a7['password']||'';this[_0xc8fc('0x5')]=_0x4bc2a7[_0xc8fc('0x5')]||'';this[_0xc8fc('0x6')]=_0x4bc2a7['consumerSecret']||'';this[_0xc8fc('0x7')]=_0x4bc2a7[_0xc8fc('0x7')]||'';this[_0xc8fc('0x8')]=_0x4bc2a7[_0xc8fc('0x8')]||'';this['type']=_0x4bc2a7[_0xc8fc('0x9')]||'';this[_0xc8fc('0xa')]=_0x4bc2a7[_0xc8fc('0xa')]||'';this[_0xc8fc('0xb')]=_0x4bc2a7[_0xc8fc('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index b49136a..5b6206c 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 _0xf4eb=['tenantId','clientId','clientSecret','serverUrl','exports','password','remoteUri'];(function(_0x952282,_0x51a614){var _0x613507=function(_0x3d37c8){while(--_0x3d37c8){_0x952282['push'](_0x952282['shift']());}};_0x613507(++_0x51a614);}(_0xf4eb,0xec));var _0xbf4e=function(_0x43bed1,_0x34b64d){_0x43bed1=_0x43bed1-0x0;var _0x32821f=_0xf4eb[_0x43bed1];return _0x32821f;};'use strict';function Dynamics365Account(_0x3e6fbd){this['id']=_0x3e6fbd['id']||0x0;this['name']=_0x3e6fbd['name']||'';this['username']=_0x3e6fbd['username']||'';this[_0xbf4e('0x0')]=_0x3e6fbd['password']||'';this['remoteUri']=_0x3e6fbd[_0xbf4e('0x1')]||'';this[_0xbf4e('0x2')]=_0x3e6fbd[_0xbf4e('0x2')]||'';this[_0xbf4e('0x3')]=_0x3e6fbd[_0xbf4e('0x3')]||'';this[_0xbf4e('0x4')]=_0x3e6fbd[_0xbf4e('0x4')]||{};this['serverUrl']=_0x3e6fbd[_0xbf4e('0x5')]||'';this['Configurations']=_0x3e6fbd['Configurations']||{};}module[_0xbf4e('0x6')]=Dynamics365Account; \ No newline at end of file +var _0x3c81=['Configurations','exports','name','username','tenantId','clientId','clientSecret','serverUrl'];(function(_0xb3a07f,_0x20bd4b){var _0x515ff9=function(_0x2c9c59){while(--_0x2c9c59){_0xb3a07f['push'](_0xb3a07f['shift']());}};_0x515ff9(++_0x20bd4b);}(_0x3c81,0x102));var _0x13c8=function(_0x19c58e,_0x5b888d){_0x19c58e=_0x19c58e-0x0;var _0x15c633=_0x3c81[_0x19c58e];return _0x15c633;};'use strict';function Dynamics365Account(_0x55010d){this['id']=_0x55010d['id']||0x0;this[_0x13c8('0x0')]=_0x55010d['name']||'';this[_0x13c8('0x1')]=_0x55010d[_0x13c8('0x1')]||'';this['password']=_0x55010d['password']||'';this['remoteUri']=_0x55010d['remoteUri']||'';this[_0x13c8('0x2')]=_0x55010d[_0x13c8('0x2')]||'';this[_0x13c8('0x3')]=_0x55010d[_0x13c8('0x3')]||'';this[_0x13c8('0x4')]=_0x55010d[_0x13c8('0x4')]||{};this[_0x13c8('0x5')]=_0x55010d['serverUrl']||'';this[_0x13c8('0x6')]=_0x55010d['Configurations']||{};}module[_0x13c8('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 31641cf..9f7b94a 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 _0x5d19=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x5d19,0x1e7));var _0x95d1=function(_0x48c2ae,_0x4cea90){_0x48c2ae=_0x48c2ae-0x0;var _0x8f7531=_0x5d19[_0x48c2ae];return _0x8f7531;};'use strict';function FaxAccount(_0x3d104d){this['id']=_0x3d104d['id']||0x0;this['name']=_0x3d104d['name']||'';this[_0x95d1('0x0')]=_0x3d104d[_0x95d1('0x0')];this[_0x95d1('0x1')]=_0x3d104d[_0x95d1('0x1')];this[_0x95d1('0x2')]=_0x3d104d['headerinfo'];this[_0x95d1('0x3')]=_0x3d104d[_0x95d1('0x3')];this['minrate']=_0x3d104d[_0x95d1('0x4')]||0x960;this['maxrate']=_0x3d104d[_0x95d1('0x5')]||0x3840;this['modem']=_0x3d104d[_0x95d1('0x6')]||_0x95d1('0x7');this[_0x95d1('0x8')]=_0x3d104d['gateway']||'no';this[_0x95d1('0x9')]=_0x3d104d['faxdetect']||'no';this[_0x95d1('0xa')]=_0x3d104d['t38timeout']||0x1388;this[_0x95d1('0xb')]=_0x3d104d[_0x95d1('0xb')]||_0x95d1('0xc');this[_0x95d1('0xd')]=_0x3d104d[_0x95d1('0xd')]?_0x3d104d[_0x95d1('0xd')]:undefined;this['ListId']=_0x3d104d[_0x95d1('0xe')];this[_0x95d1('0xf')]=_0x3d104d[_0x95d1('0xf')];}module[_0x95d1('0x10')]=FaxAccount; \ No newline at end of file +var _0x78f1=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x2e2292,_0x1891b8){var _0x4f77ab=function(_0x3e5cb6){while(--_0x3e5cb6){_0x2e2292['push'](_0x2e2292['shift']());}};_0x4f77ab(++_0x1891b8);}(_0x78f1,0xd5));var _0x178f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x78f1[_0x2b4411];return _0x8e41ef;};'use strict';function FaxAccount(_0x2e43a2){this['id']=_0x2e43a2['id']||0x0;this[_0x178f('0x0')]=_0x2e43a2[_0x178f('0x0')]||'';this['description']=_0x2e43a2[_0x178f('0x1')];this[_0x178f('0x2')]=_0x2e43a2[_0x178f('0x2')];this[_0x178f('0x3')]=_0x2e43a2[_0x178f('0x3')];this[_0x178f('0x4')]=_0x2e43a2[_0x178f('0x4')];this[_0x178f('0x5')]=_0x2e43a2['minrate']||0x960;this[_0x178f('0x6')]=_0x2e43a2[_0x178f('0x6')]||0x3840;this[_0x178f('0x7')]=_0x2e43a2[_0x178f('0x7')]||_0x178f('0x8');this['gateway']=_0x2e43a2[_0x178f('0x9')]||'no';this[_0x178f('0xa')]=_0x2e43a2[_0x178f('0xa')]||'no';this[_0x178f('0xb')]=_0x2e43a2[_0x178f('0xb')]||0x1388;this[_0x178f('0xc')]=_0x2e43a2[_0x178f('0xc')]||_0x178f('0xd');this[_0x178f('0xe')]=_0x2e43a2[_0x178f('0xe')]?_0x2e43a2[_0x178f('0xe')]:undefined;this[_0x178f('0xf')]=_0x2e43a2['ListId'];this[_0x178f('0x10')]=_0x2e43a2[_0x178f('0x10')];}module[_0x178f('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 958863d..65d99bf 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 _0x1ab8=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x422061,_0x523a37){var _0x1ebf07=function(_0x1c8bea){while(--_0x1c8bea){_0x422061['push'](_0x422061['shift']());}};_0x1ebf07(++_0x523a37);}(_0x1ab8,0x115));var _0x81ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1ab8[_0x432682];return _0x463d05;};'use strict';function FreshdeskAccount(_0x36b677){this['id']=_0x36b677['id']||0x0;this['name']=_0x36b677[_0x81ab('0x0')]||'';this[_0x81ab('0x1')]=_0x36b677[_0x81ab('0x1')]||'';this[_0x81ab('0x2')]=_0x36b677[_0x81ab('0x3')]||'';this[_0x81ab('0x4')]=_0x36b677['remoteUri']||'';this[_0x81ab('0x5')]=_0x36b677['serverUrl']||'';this[_0x81ab('0x6')]=_0x36b677[_0x81ab('0x6')]||{};}module[_0x81ab('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xacc8=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1496eb,_0x4ffc87){var _0x550b2f=function(_0x402496){while(--_0x402496){_0x1496eb['push'](_0x1496eb['shift']());}};_0x550b2f(++_0x4ffc87);}(_0xacc8,0xee));var _0x8acc=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0xacc8[_0x4fd109];return _0x30f0a6;};'use strict';function FreshdeskAccount(_0x2d595c){this['id']=_0x2d595c['id']||0x0;this[_0x8acc('0x0')]=_0x2d595c['name']||'';this[_0x8acc('0x1')]=_0x2d595c[_0x8acc('0x1')]||'';this[_0x8acc('0x2')]=_0x2d595c[_0x8acc('0x3')]||'';this[_0x8acc('0x4')]=_0x2d595c[_0x8acc('0x4')]||'';this[_0x8acc('0x5')]=_0x2d595c['serverUrl']||'';this[_0x8acc('0x6')]=_0x2d595c[_0x8acc('0x6')]||{};}module[_0x8acc('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 13c88e2..62b611f 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 _0x251b=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x304bf7,_0x4fcafc){var _0x5036cd=function(_0x39e810){while(--_0x39e810){_0x304bf7['push'](_0x304bf7['shift']());}};_0x5036cd(++_0x4fcafc);}(_0x251b,0x185));var _0xb251=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0x251b[_0xc36d01];return _0xecb231;};'use strict';function FreshsalesAccount(_0x1e22dd){this['id']=_0x1e22dd['id']||0x0;this[_0xb251('0x0')]=_0x1e22dd[_0xb251('0x0')]||'';this[_0xb251('0x1')]=_0x1e22dd[_0xb251('0x1')]||'';this[_0xb251('0x2')]=_0x1e22dd[_0xb251('0x3')]||'';this[_0xb251('0x4')]=_0x1e22dd[_0xb251('0x4')]||'';this[_0xb251('0x5')]=_0x1e22dd[_0xb251('0x5')]||'';this[_0xb251('0x6')]=_0x1e22dd['Configurations']||{};}module[_0xb251('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xd5da=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3e0ddb,_0x2b875c){var _0x132898=function(_0x3ff560){while(--_0x3ff560){_0x3e0ddb['push'](_0x3e0ddb['shift']());}};_0x132898(++_0x2b875c);}(_0xd5da,0x9f));var _0xad5d=function(_0x2ab6e4,_0x265db7){_0x2ab6e4=_0x2ab6e4-0x0;var _0xe4253c=_0xd5da[_0x2ab6e4];return _0xe4253c;};'use strict';function FreshsalesAccount(_0x419aa8){this['id']=_0x419aa8['id']||0x0;this[_0xad5d('0x0')]=_0x419aa8['name']||'';this[_0xad5d('0x1')]=_0x419aa8[_0xad5d('0x1')]||'';this[_0xad5d('0x2')]=_0x419aa8['token']||'';this[_0xad5d('0x3')]=_0x419aa8['remoteUri']||'';this[_0xad5d('0x4')]=_0x419aa8[_0xad5d('0x4')]||'';this[_0xad5d('0x5')]=_0x419aa8[_0xad5d('0x5')]||{};}module[_0xad5d('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 7f3e063..bc20f13 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 _0x9836=['queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','assigned','lastAssignedTo','voice','variables','exports','inbound','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','position','count'];(function(_0x41513a,_0x36ad3d){var _0x3cbc5b=function(_0x5ea99c){while(--_0x5ea99c){_0x41513a['push'](_0x41513a['shift']());}};_0x3cbc5b(++_0x36ad3d);}(_0x9836,0x1dc));var _0x6983=function(_0x43b145,_0x334544){_0x43b145=_0x43b145-0x0;var _0x4b80ec=_0x9836[_0x43b145];return _0x4b80ec;};'use strict';function QueueReport(){this['type']=_0x6983('0x0');this[_0x6983('0x1')]='';this['calleridnum']='';this['calleridname']='';this[_0x6983('0x2')]='';this[_0x6983('0x3')]=null;this[_0x6983('0x4')]=null;this[_0x6983('0x5')]=0x1;this[_0x6983('0x6')]=0x1;this[_0x6983('0x7')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x6983('0x8')]=null;this[_0x6983('0x9')]=![];this[_0x6983('0xa')]=null;this[_0x6983('0xb')]=0x1;this[_0x6983('0xc')]='';this[_0x6983('0xd')]='';this['connectedlinename']='';this[_0x6983('0xe')]='';this[_0x6983('0xf')]='';this[_0x6983('0x10')]='';this[_0x6983('0x11')]='';this['holdtime']=0x0;this[_0x6983('0x12')]=![];this[_0x6983('0x13')]='';this['motionChannel']=_0x6983('0x14');this['mohtime']=0x0;this[_0x6983('0x15')]={};}module[_0x6983('0x16')]=QueueReport; \ No newline at end of file +var _0x7ed6=['assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','queuecallerjoinAt','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','exten','priority','holdtime'];(function(_0x4f9350,_0x1eb2e1){var _0x4af838=function(_0x3a121c){while(--_0x3a121c){_0x4f9350['push'](_0x4f9350['shift']());}};_0x4af838(++_0x1eb2e1);}(_0x7ed6,0x13a));var _0x67ed=function(_0x2be673,_0x11746c){_0x2be673=_0x2be673-0x0;var _0x4e4e15=_0x7ed6[_0x2be673];return _0x4e4e15;};'use strict';function QueueReport(){this[_0x67ed('0x0')]=_0x67ed('0x1');this[_0x67ed('0x2')]='';this[_0x67ed('0x3')]='';this['calleridname']='';this['queue']='';this[_0x67ed('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0x67ed('0x5')]=![];this[_0x67ed('0x6')]=null;this['queuecallercomplete']=![];this[_0x67ed('0x7')]=null;this[_0x67ed('0x8')]=![];this[_0x67ed('0x9')]=null;this['originalposition']=0x1;this[_0x67ed('0xa')]='';this[_0x67ed('0xb')]='';this[_0x67ed('0xc')]='';this['accountcode']='';this['context']='';this[_0x67ed('0xd')]='';this[_0x67ed('0xe')]='';this[_0x67ed('0xf')]=0x0;this[_0x67ed('0x10')]=![];this[_0x67ed('0x11')]='';this[_0x67ed('0x12')]=_0x67ed('0x13');this[_0x67ed('0x14')]=0x0;this[_0x67ed('0x15')]={};}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 6a6f74a..c0f9c19 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 _0x50a8=['integrationTab','serverUrl','Configurations','name','username','remoteUri','clientId','clientSecret','securityToken','type'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x50a8,0x193));var _0x850a=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x50a8[_0x86b219];return _0x1f320c;};'use strict';function SalesforceAccount(_0x20788d){this['id']=_0x20788d['id']||0x0;this[_0x850a('0x0')]=_0x20788d['name']||'';this[_0x850a('0x1')]=_0x20788d[_0x850a('0x1')]||'';this[_0x850a('0x2')]=_0x20788d[_0x850a('0x2')]||'';this['password']=_0x20788d['password']||'';this['clientId']=_0x20788d[_0x850a('0x3')]||'';this[_0x850a('0x4')]=_0x20788d['clientSecret']||'';this[_0x850a('0x5')]=_0x20788d['securityToken']||'';this[_0x850a('0x6')]=_0x20788d[_0x850a('0x6')]||_0x850a('0x7');this['serverUrl']=_0x20788d[_0x850a('0x8')]||'';this[_0x850a('0x9')]=_0x20788d[_0x850a('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x675f=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','exports','name'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x675f,0x149));var _0xf675=function(_0x56df34,_0x1f8f3f){_0x56df34=_0x56df34-0x0;var _0x2e9b2a=_0x675f[_0x56df34];return _0x2e9b2a;};'use strict';function SalesforceAccount(_0x58f8c0){this['id']=_0x58f8c0['id']||0x0;this[_0xf675('0x0')]=_0x58f8c0[_0xf675('0x0')]||'';this[_0xf675('0x1')]=_0x58f8c0[_0xf675('0x1')]||'';this[_0xf675('0x2')]=_0x58f8c0[_0xf675('0x2')]||'';this[_0xf675('0x3')]=_0x58f8c0[_0xf675('0x3')]||'';this[_0xf675('0x4')]=_0x58f8c0[_0xf675('0x4')]||'';this['clientSecret']=_0x58f8c0[_0xf675('0x5')]||'';this[_0xf675('0x6')]=_0x58f8c0[_0xf675('0x6')]||'';this['type']=_0x58f8c0[_0xf675('0x7')]||_0xf675('0x8');this[_0xf675('0x9')]=_0x58f8c0['serverUrl']||'';this['Configurations']=_0x58f8c0['Configurations']||{};}module[_0xf675('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index f6fd164..1e85a47 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 _0xdb17=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x146dd7,_0x4d877d){var _0x2af0bb=function(_0x2327bc){while(--_0x2327bc){_0x146dd7['push'](_0x146dd7['shift']());}};_0x2af0bb(++_0x4d877d);}(_0xdb17,0x18f));var _0x7db1=function(_0x225ade,_0x4ac72b){_0x225ade=_0x225ade-0x0;var _0x48fd50=_0xdb17[_0x225ade];return _0x48fd50;};'use strict';function ServicenowAccount(_0x5916c9){this['id']=_0x5916c9['id']||0x0;this[_0x7db1('0x0')]=_0x5916c9[_0x7db1('0x0')]||'';this['username']=_0x5916c9[_0x7db1('0x1')]||'';this[_0x7db1('0x2')]=_0x5916c9[_0x7db1('0x2')]||'';this[_0x7db1('0x3')]=_0x5916c9['remoteUri']||'';this[_0x7db1('0x4')]=_0x5916c9[_0x7db1('0x4')]||'';this[_0x7db1('0x5')]=_0x5916c9[_0x7db1('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xfab3=['remoteUri','serverUrl','name','username','password'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0xfab3,0x12e));var _0x3fab=function(_0x50e5cc,_0x218037){_0x50e5cc=_0x50e5cc-0x0;var _0x1d241d=_0xfab3[_0x50e5cc];return _0x1d241d;};'use strict';function ServicenowAccount(_0x3a3041){this['id']=_0x3a3041['id']||0x0;this[_0x3fab('0x0')]=_0x3a3041['name']||'';this[_0x3fab('0x1')]=_0x3a3041['username']||'';this[_0x3fab('0x2')]=_0x3a3041[_0x3fab('0x2')]||'';this[_0x3fab('0x3')]=_0x3a3041[_0x3fab('0x3')]||'';this[_0x3fab('0x4')]=_0x3a3041[_0x3fab('0x4')]||'';this['Configurations']=_0x3a3041['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 da9aa3b..62d63fd 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 _0x9fbb=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x292893,_0x3cd21e){var _0x5a55ac=function(_0x420f8d){while(--_0x420f8d){_0x292893['push'](_0x292893['shift']());}};_0x5a55ac(++_0x3cd21e);}(_0x9fbb,0x1eb));var _0xb9fb=function(_0x34fc64,_0x5e250d){_0x34fc64=_0x34fc64-0x0;var _0x592c62=_0x9fbb[_0x34fc64];return _0x592c62;};'use strict';function SugarcrmAccount(_0x1dd6c4){this['id']=_0x1dd6c4['id']||0x0;this['name']=_0x1dd6c4[_0xb9fb('0x0')]||'';this['username']=_0x1dd6c4[_0xb9fb('0x1')]||'';this[_0xb9fb('0x2')]=_0x1dd6c4['password']||'';this[_0xb9fb('0x3')]=_0x1dd6c4[_0xb9fb('0x3')]||'';this[_0xb9fb('0x4')]=_0x1dd6c4[_0xb9fb('0x4')]||'';this[_0xb9fb('0x5')]=_0x1dd6c4['Configurations']||{};}module[_0xb9fb('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x9371=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x898e7e,_0x3e9c59){var _0x58b3a8=function(_0x758655){while(--_0x758655){_0x898e7e['push'](_0x898e7e['shift']());}};_0x58b3a8(++_0x3e9c59);}(_0x9371,0x120));var _0x1937=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9371[_0x122ef9];return _0x42fba0;};'use strict';function SugarcrmAccount(_0x54b2b1){this['id']=_0x54b2b1['id']||0x0;this[_0x1937('0x0')]=_0x54b2b1[_0x1937('0x0')]||'';this[_0x1937('0x1')]=_0x54b2b1[_0x1937('0x1')]||'';this[_0x1937('0x2')]=_0x54b2b1['password']||'';this['remoteUri']=_0x54b2b1[_0x1937('0x3')]||'';this[_0x1937('0x4')]=_0x54b2b1[_0x1937('0x4')]||'';this[_0x1937('0x5')]=_0x54b2b1[_0x1937('0x5')]||{};}module[_0x1937('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 099a9e6..2cbcbae 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 _0x280d=['name','accountcode','state','unknown','stateTime','address','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x280d,0x69));var _0xd280=function(_0x15143e,_0x45528a){_0x15143e=_0x15143e-0x0;var _0xde4a8e=_0x280d[_0x15143e];return _0xde4a8e;};'use strict';function Telephone(_0x4a11cc){this['id']=_0x4a11cc['id']||0x0;this[_0xd280('0x0')]=_0x4a11cc[_0xd280('0x0')]||'';this[_0xd280('0x1')]=_0x4a11cc[_0xd280('0x1')]||'';this[_0xd280('0x2')]=_0xd280('0x3');this[_0xd280('0x4')]=0x0;this['status']='unknown';this[_0xd280('0x5')]='';}module[_0xd280('0x6')]=Telephone; \ No newline at end of file +var _0xe1fb=['exports','name','accountcode','state','unknown','status','address'];(function(_0x21f696,_0x39f55a){var _0x53f5aa=function(_0x91a005){while(--_0x91a005){_0x21f696['push'](_0x21f696['shift']());}};_0x53f5aa(++_0x39f55a);}(_0xe1fb,0xe1));var _0xbe1f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe1fb[_0x21a9d9];return _0x46adce;};'use strict';function Telephone(_0x2edec1){this['id']=_0x2edec1['id']||0x0;this['name']=_0x2edec1[_0xbe1f('0x0')]||'';this[_0xbe1f('0x1')]=_0x2edec1[_0xbe1f('0x1')]||'';this[_0xbe1f('0x2')]=_0xbe1f('0x3');this['stateTime']=0x0;this[_0xbe1f('0x4')]='unknown';this[_0xbe1f('0x5')]='';}module[_0xbe1f('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 b0ccf2b..fdd01f4 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x291e2e,_0x3bc802){var _0x2e7313=function(_0x3e330c){while(--_0x3e330c){_0x291e2e['push'](_0x291e2e['shift']());}};_0x2e7313(++_0x3bc802);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x37a8bc,_0x133f7a){var _0xff7b91=function(_0x290156){while(--_0x290156){_0x37a8bc['push'](_0x37a8bc['shift']());}};_0xff7b91(++_0x133f7a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a5276,_0x262d69){_0x5a5276=_0x5a5276-0x0;var _0x3e8ee2=_0xb10b[_0x5a5276];return _0x3e8ee2;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 27a8c05..f81dc3e 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x4480c8,_0x1c7c34){var _0x61d9f6=function(_0x365445){while(--_0x365445){_0x4480c8['push'](_0x4480c8['shift']());}};_0x61d9f6(++_0x1c7c34);}(_0xda2d,0x102));var _0xdda2=function(_0x2cb835,_0x4e7e4c){_0x2cb835=_0x2cb835-0x0;var _0x5673ea=_0xda2d[_0x2cb835];return _0x5673ea;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0xd122de,_0x12e49d){var _0x12649a=function(_0x3702c8){while(--_0x3702c8){_0xd122de['push'](_0xd122de['shift']());}};_0x12649a(++_0x12e49d);}(_0xda3f,0xec));var _0xfda3=function(_0x4f6ac8,_0x4001ff){_0x4f6ac8=_0x4f6ac8-0x0;var _0x1a0af5=_0xda3f[_0x4f6ac8];return _0x1a0af5;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['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 6858b8a..1be5011 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 _0xa6b2=['stateRegistry','registrationtime','address','defaultuser','exports','name','state','stateTime','status','unknown','registry','indexOf','split','port','domain','domainport','refresh'];(function(_0x2262c9,_0xb5382e){var _0x1efed8=function(_0x2e619f){while(--_0x2e619f){_0x2262c9['push'](_0x2262c9['shift']());}};_0x1efed8(++_0xb5382e);}(_0xa6b2,0x1d0));var _0x2a6b=function(_0x29f113,_0x2d4932){_0x29f113=_0x29f113-0x0;var _0x5cfadb=_0xa6b2[_0x29f113];return _0x5cfadb;};'use strict';function Trunk(_0x3ff3cf){this['id']=_0x3ff3cf['id']||0x0;this['active']=_0x3ff3cf['active']||![];this[_0x2a6b('0x0')]=_0x3ff3cf[_0x2a6b('0x0')]||'';this[_0x2a6b('0x1')]='unknown';this[_0x2a6b('0x2')]=0x0;this[_0x2a6b('0x3')]=_0x2a6b('0x4');this['registry']=_0x3ff3cf[_0x2a6b('0x5')]&&_0x3ff3cf[_0x2a6b('0x5')][_0x2a6b('0x6')](':')?_0x3ff3cf[_0x2a6b('0x5')][_0x2a6b('0x7')](':')[0x0]:'';this['host']='';this[_0x2a6b('0x8')]='';this[_0x2a6b('0x9')]='';this[_0x2a6b('0xa')]='';this[_0x2a6b('0xb')]='';this[_0x2a6b('0xc')]=_0x2a6b('0x4');this[_0x2a6b('0xd')]='';this[_0x2a6b('0xe')]='';this['defaultuser']=_0x3ff3cf[_0x2a6b('0xf')]||'';}module[_0x2a6b('0x10')]=Trunk; \ No newline at end of file +var _0x7295=['active','name','unknown','stateTime','status','registry','indexOf','host','domain','domainport','refresh','stateRegistry','registrationtime','exports'];(function(_0x14866a,_0x3e915e){var _0x1d3d8c=function(_0x2ecb83){while(--_0x2ecb83){_0x14866a['push'](_0x14866a['shift']());}};_0x1d3d8c(++_0x3e915e);}(_0x7295,0x1c0));var _0x5729=function(_0x5d04ee,_0x2a38ca){_0x5d04ee=_0x5d04ee-0x0;var _0x4a666a=_0x7295[_0x5d04ee];return _0x4a666a;};'use strict';function Trunk(_0x432c5f){this['id']=_0x432c5f['id']||0x0;this[_0x5729('0x0')]=_0x432c5f['active']||![];this[_0x5729('0x1')]=_0x432c5f['name']||'';this['state']=_0x5729('0x2');this[_0x5729('0x3')]=0x0;this[_0x5729('0x4')]=_0x5729('0x2');this[_0x5729('0x5')]=_0x432c5f['registry']&&_0x432c5f[_0x5729('0x5')][_0x5729('0x6')](':')?_0x432c5f['registry']['split'](':')[0x0]:'';this[_0x5729('0x7')]='';this['port']='';this[_0x5729('0x8')]='';this[_0x5729('0x9')]='';this[_0x5729('0xa')]='';this[_0x5729('0xb')]=_0x5729('0x2');this[_0x5729('0xc')]='';this['address']='';this['defaultuser']=_0x432c5f['defaultuser']||'';}module[_0x5729('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a709de9..c85498c 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 _0x9e61=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9e61,0x1c4));var _0x19e6=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x9e61[_0x42bdad];return _0x122626;};'use strict';function voiceExtension(_0x18840b){this['id']=_0x18840b['id']||0x0;this[_0x19e6('0x0')]=_0x18840b[_0x19e6('0x0')]||'';this[_0x19e6('0x1')]=_0x18840b[_0x19e6('0x1')]||_0x19e6('0x2');this[_0x19e6('0x3')]=_0x18840b['mandatoryDisposition']||![];}module[_0x19e6('0x4')]=voiceExtension; \ No newline at end of file +var _0x0a4c=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x0a4c,0x182));var _0xc0a4=function(_0x328e47,_0x56289c){_0x328e47=_0x328e47-0x0;var _0x548939=_0x0a4c[_0x328e47];return _0x548939;};'use strict';function voiceExtension(_0x44106b){this['id']=_0x44106b['id']||0x0;this[_0xc0a4('0x0')]=_0x44106b[_0xc0a4('0x0')]||'';this['recordingFormat']=_0x44106b[_0xc0a4('0x1')]||_0xc0a4('0x2');this['mandatoryDisposition']=_0x44106b[_0xc0a4('0x3')]||![];}module[_0xc0a4('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 c4df9cd..554722b 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 _0xa2d7=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x2670bf,_0x54050b){var _0x35356d=function(_0x3be385){while(--_0x3be385){_0x2670bf['push'](_0x2670bf['shift']());}};_0x35356d(++_0x54050b);}(_0xa2d7,0x195));var _0x7a2d=function(_0x240c18,_0x52ba5d){_0x240c18=_0x240c18-0x0;var _0x3b8baf=_0xa2d7[_0x240c18];return _0x3b8baf;};'use strict';var statusDesc=[_0x7a2d('0x0'),'not_inuse',_0x7a2d('0x1'),'busy',_0x7a2d('0x2'),_0x7a2d('0x3'),_0x7a2d('0x4'),_0x7a2d('0x5'),_0x7a2d('0x6')];var monitorFormat={'wav':_0x7a2d('0x7'),'wav49':_0x7a2d('0x8'),'gsm':_0x7a2d('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x596358){this['id']=_0x596358['id']||0x0;this[_0x7a2d('0xa')]=_0x596358[_0x7a2d('0xa')]||'';this[_0x7a2d('0xb')]=_0x596358[_0x7a2d('0xb')]||'';this[_0x7a2d('0xc')]=_0x596358[_0x7a2d('0xc')]||_0x7a2d('0xd');this[_0x7a2d('0xe')]=0x0;this[_0x7a2d('0xf')]=0x0;this[_0x7a2d('0x10')]=0x0;this[_0x7a2d('0x11')]=0x0;this[_0x7a2d('0x12')]=0x0;this[_0x7a2d('0x13')]=0x0;this['sumBillable']=0x0;this[_0x7a2d('0x14')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x7a2d('0x15')]=_0x596358['acw']||![];this[_0x7a2d('0x16')]=_0x596358[_0x7a2d('0x16')]||0xa;this['autopause']=_0x596358[_0x7a2d('0x17')]||'no';this[_0x7a2d('0x18')]=!![];this[_0x7a2d('0x19')]='';this[_0x7a2d('0x1a')]=0x0;this[_0x7a2d('0x1b')]=0x0;this[_0x7a2d('0x1c')]=_0x596358['dialTimezone']||null;this['dialGlobalInterval']=_0x596358[_0x7a2d('0x1d')]?_0x596358['dialGlobalInterval']:null;this[_0x7a2d('0x1e')]=_0x596358[_0x7a2d('0x1e')];this[_0x7a2d('0x1f')]=_0x596358[_0x7a2d('0x1f')]||'progressive';this[_0x7a2d('0x20')]=_0x596358[_0x7a2d('0x20')]||0x0;this['dialLimitQueue']=_0x596358[_0x7a2d('0x21')]||0x0;this['dialPowerLevel']=_0x596358[_0x7a2d('0x22')]||0x1;this[_0x7a2d('0x23')]=_0x596358[_0x7a2d('0x23')]||_0x7a2d('0x24');this[_0x7a2d('0x25')]=_0x596358['dialPredictiveOptimizationPercentage']||0.03;this[_0x7a2d('0x26')]=_0x596358[_0x7a2d('0x26')]||0x258;this[_0x7a2d('0x27')]=_0x596358[_0x7a2d('0x27')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x596358[_0x7a2d('0x28')]||_0x7a2d('0x29');this['dialOriginateTimeout']=_0x596358[_0x7a2d('0x2a')]||0x1e;this['dialQueueOptions']=_0x596358[_0x7a2d('0x2b')]||_0x7a2d('0x2c');this['dialQueueTimeout']=_0x596358[_0x7a2d('0x2d')]||0x3;this[_0x7a2d('0x2e')]=_0x596358['dialQueueProject']||undefined;this[_0x7a2d('0x2f')]=_0x596358['dialCongestionMaxRetry']||0x3;this[_0x7a2d('0x30')]=_0x596358[_0x7a2d('0x30')]||0x96;this[_0x7a2d('0x31')]=_0x596358[_0x7a2d('0x31')]||0x3;this[_0x7a2d('0x32')]=_0x596358[_0x7a2d('0x32')]||0x96;this[_0x7a2d('0x33')]=_0x596358[_0x7a2d('0x33')]||0x3;this[_0x7a2d('0x34')]=_0x596358[_0x7a2d('0x34')]||0x96;this[_0x7a2d('0x35')]=_0x596358[_0x7a2d('0x35')]||0x3;this[_0x7a2d('0x36')]=_0x596358[_0x7a2d('0x36')]||0x96;this[_0x7a2d('0x37')]=_0x596358[_0x7a2d('0x37')]||0x3;this[_0x7a2d('0x38')]=_0x596358[_0x7a2d('0x38')]||0x96;this[_0x7a2d('0x39')]=_0x596358['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x596358[_0x7a2d('0x3a')]||0x96;this[_0x7a2d('0x3b')]=_0x596358[_0x7a2d('0x3b')]||0x3;this[_0x7a2d('0x3c')]=_0x596358[_0x7a2d('0x3c')]||0x96;this[_0x7a2d('0x3d')]=_0x596358['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x596358[_0x7a2d('0x3e')]||0x96;this['dialGlobalMaxRetry']=_0x596358[_0x7a2d('0x3f')]||0x4;this[_0x7a2d('0x40')]=_0x596358['Trunk']?_0x596358[_0x7a2d('0x40')]:undefined;this[_0x7a2d('0x41')]=_0x596358[_0x7a2d('0x41')]?_0x596358[_0x7a2d('0x41')]:undefined;this['dialPrefix']=_0x596358[_0x7a2d('0x42')]||undefined;this[_0x7a2d('0x43')]=_0x596358[_0x7a2d('0x43')]?_0x596358['Interval']:undefined;this[_0x7a2d('0x44')]=_0x596358['dialOrderByScheduledAt']||'DESC';this[_0x7a2d('0x45')]=_0x596358[_0x7a2d('0x45')]||undefined;this[_0x7a2d('0x46')]=_0x596358[_0x7a2d('0x46')]||undefined;this['strategy']=strategy[_0x596358[_0x7a2d('0x47')]]||'rrmemory';this['queueStatusComplete']=!![];this['dialAMDActive']=_0x596358[_0x7a2d('0x48')]||![];this['dialAMDInitialSilence']=_0x596358[_0x7a2d('0x49')];this['dialAMDGreeting']=_0x596358[_0x7a2d('0x4a')];this[_0x7a2d('0x4b')]=_0x596358[_0x7a2d('0x4b')];this[_0x7a2d('0x4c')]=_0x596358[_0x7a2d('0x4c')];this[_0x7a2d('0x4d')]=_0x596358[_0x7a2d('0x4d')];this['dialAMDBetweenWordsSilence']=_0x596358[_0x7a2d('0x4e')];this['dialAMDMaximumNumberOfWords']=_0x596358[_0x7a2d('0x4f')];this[_0x7a2d('0x50')]=_0x596358[_0x7a2d('0x50')];this[_0x7a2d('0x51')]=_0x596358[_0x7a2d('0x51')];this[_0x7a2d('0x52')]=0x0;this[_0x7a2d('0x53')]=0x0;this[_0x7a2d('0x54')]=_0x596358[_0x7a2d('0x54')];this[_0x7a2d('0x55')]=0x0;this[_0x7a2d('0x56')]=0x0;this[_0x7a2d('0x57')]=0x0;this[_0x7a2d('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x7a2d('0x59')]=0x0;this[_0x7a2d('0x5a')]=0x0;this[_0x7a2d('0x5b')]=0x0;this[_0x7a2d('0x5c')]=0x0;this[_0x7a2d('0x5d')]=0x0;this[_0x7a2d('0x5e')]=0x0;this[_0x7a2d('0x5f')]=0x0;this[_0x7a2d('0x60')]=0x0;this[_0x7a2d('0x61')]=undefined;this['startPredictive']=undefined;this[_0x7a2d('0x62')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x7a2d('0x63')]=0x0;this[_0x7a2d('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x7a2d('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x7a2d('0x66')]=0x0;this[_0x7a2d('0x67')]=0x0;this[_0x7a2d('0x68')]=_0x596358[_0x7a2d('0x69')]||0x14;this[_0x7a2d('0x6a')]=_0x596358[_0x7a2d('0x69')]||0xa;this[_0x7a2d('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x7a2d('0x6c')]=0x1;this[_0x7a2d('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7a2d('0x6e')]=0x0;this[_0x7a2d('0x6f')]=0x0;this[_0x7a2d('0x70')]=_0x596358['dialRecallMeTimeout']||0x1e;this[_0x7a2d('0x71')]=_0x596358[_0x7a2d('0x71')]||![];this['dialQueueProject2']=_0x596358[_0x7a2d('0x72')]||undefined;this['dialAgiAfterHangupClient']=_0x596358[_0x7a2d('0x73')]||![];this['dialAgiAfterHangupAgent']=_0x596358[_0x7a2d('0x74')]||![];this[_0x7a2d('0xb')]=monitorFormat[_0x596358[_0x7a2d('0xb')]]?monitorFormat[_0x596358[_0x7a2d('0xb')]]:undefined;this[_0x7a2d('0x75')]=_0x596358[_0x7a2d('0x75')]||![];this[_0x7a2d('0x76')]=_0x596358[_0x7a2d('0x76')]?_0x596358[_0x7a2d('0x76')]:undefined;}module[_0x7a2d('0x77')]=VoiceQueue; \ No newline at end of file +var _0x1730=['outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','unavailable','ringing','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x1730,0x97));var _0x0173=function(_0x575311,_0x3ec166){_0x575311=_0x575311-0x0;var _0x112660=_0x1730[_0x575311];return _0x112660;};'use strict';var statusDesc=['unknown',_0x0173('0x0'),'inuse',_0x0173('0x1'),'invalid',_0x0173('0x2'),_0x0173('0x3'),'ringinuse',_0x0173('0x4')];var monitorFormat={'wav':_0x0173('0x5'),'wav49':_0x0173('0x6'),'gsm':_0x0173('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x0173('0x8')};function VoiceQueue(_0x197f49){this['id']=_0x197f49['id']||0x0;this[_0x0173('0x9')]=_0x197f49['name']||'';this[_0x0173('0xa')]=_0x197f49[_0x0173('0xa')]||'';this[_0x0173('0xb')]=_0x197f49[_0x0173('0xb')]||_0x0173('0xc');this[_0x0173('0xd')]=0x0;this[_0x0173('0xe')]=0x0;this[_0x0173('0xf')]=0x0;this[_0x0173('0x10')]=0x0;this[_0x0173('0x11')]=0x0;this[_0x0173('0x12')]=0x0;this[_0x0173('0x13')]=0x0;this[_0x0173('0x14')]=0x0;this[_0x0173('0x15')]=0x0;this[_0x0173('0x16')]=0x0;this[_0x0173('0x17')]=0x0;this[_0x0173('0x18')]=_0x197f49['acw']||![];this[_0x0173('0x19')]=_0x197f49[_0x0173('0x19')]||0xa;this[_0x0173('0x1a')]=_0x197f49['autopause']||'no';this[_0x0173('0x1b')]=!![];this['message']='';this[_0x0173('0x1c')]=0x0;this[_0x0173('0x1d')]=0x0;this['dialTimezone']=_0x197f49[_0x0173('0x1e')]||null;this[_0x0173('0x1f')]=_0x197f49[_0x0173('0x1f')]?_0x197f49[_0x0173('0x1f')]:null;this[_0x0173('0x20')]=_0x197f49[_0x0173('0x20')];this[_0x0173('0x21')]=_0x197f49[_0x0173('0x21')]||_0x0173('0x22');this[_0x0173('0x23')]=_0x197f49['dialLimitChannel']||0x0;this[_0x0173('0x24')]=_0x197f49[_0x0173('0x24')]||0x0;this[_0x0173('0x25')]=_0x197f49[_0x0173('0x25')]||0x1;this[_0x0173('0x26')]=_0x197f49[_0x0173('0x26')]||'dropRate';this[_0x0173('0x27')]=_0x197f49[_0x0173('0x27')]||0.03;this['dialPredictiveInterval']=_0x197f49[_0x0173('0x28')]||0x258;this[_0x0173('0x29')]=_0x197f49[_0x0173('0x29')]||_0x0173('0x2a');this[_0x0173('0x2b')]=_0x197f49['dialOriginateCallerIdNumber']||_0x0173('0x2a');this['dialOriginateTimeout']=_0x197f49[_0x0173('0x2c')]||0x1e;this[_0x0173('0x2d')]=_0x197f49['dialQueueOptions']||_0x0173('0x2e');this[_0x0173('0x2f')]=_0x197f49['dialQueueTimeout']||0x3;this[_0x0173('0x30')]=_0x197f49[_0x0173('0x30')]||undefined;this[_0x0173('0x31')]=_0x197f49[_0x0173('0x31')]||0x3;this[_0x0173('0x32')]=_0x197f49[_0x0173('0x32')]||0x96;this['dialBusyMaxRetry']=_0x197f49[_0x0173('0x33')]||0x3;this[_0x0173('0x34')]=_0x197f49[_0x0173('0x34')]||0x96;this['dialNoAnswerMaxRetry']=_0x197f49[_0x0173('0x35')]||0x3;this['dialNoAnswerRetryFrequency']=_0x197f49[_0x0173('0x36')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x197f49['dialNoSuchNumberMaxRetry']||0x3;this[_0x0173('0x37')]=_0x197f49['dialNoSuchNumberRetryFrequency']||0x96;this[_0x0173('0x38')]=_0x197f49[_0x0173('0x38')]||0x3;this[_0x0173('0x39')]=_0x197f49[_0x0173('0x39')]||0x96;this[_0x0173('0x3a')]=_0x197f49[_0x0173('0x3a')]||0x3;this[_0x0173('0x3b')]=_0x197f49['dialAbandonedRetryFrequency']||0x96;this[_0x0173('0x3c')]=_0x197f49[_0x0173('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x197f49[_0x0173('0x3d')]||0x96;this[_0x0173('0x3e')]=_0x197f49[_0x0173('0x3e')]||0x3;this[_0x0173('0x3f')]=_0x197f49['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x197f49[_0x0173('0x40')]||0x4;this[_0x0173('0x41')]=_0x197f49['Trunk']?_0x197f49[_0x0173('0x41')]:undefined;this[_0x0173('0x42')]=_0x197f49[_0x0173('0x42')]?_0x197f49[_0x0173('0x42')]:undefined;this[_0x0173('0x43')]=_0x197f49[_0x0173('0x43')]||undefined;this[_0x0173('0x44')]=_0x197f49[_0x0173('0x44')]?_0x197f49[_0x0173('0x44')]:undefined;this['dialOrderByScheduledAt']=_0x197f49[_0x0173('0x45')]||_0x0173('0x46');this['dialRandomLastDigitCallerIdNumber']=_0x197f49[_0x0173('0x47')]||undefined;this[_0x0173('0x48')]=_0x197f49[_0x0173('0x48')]||undefined;this[_0x0173('0x49')]=strategy[_0x197f49[_0x0173('0x49')]]||_0x0173('0x4a');this[_0x0173('0x4b')]=!![];this[_0x0173('0x4c')]=_0x197f49['dialAMDActive']||![];this[_0x0173('0x4d')]=_0x197f49[_0x0173('0x4d')];this[_0x0173('0x4e')]=_0x197f49['dialAMDGreeting'];this[_0x0173('0x4f')]=_0x197f49[_0x0173('0x4f')];this[_0x0173('0x50')]=_0x197f49[_0x0173('0x50')];this[_0x0173('0x51')]=_0x197f49[_0x0173('0x51')];this[_0x0173('0x52')]=_0x197f49[_0x0173('0x52')];this['dialAMDMaximumNumberOfWords']=_0x197f49[_0x0173('0x53')];this[_0x0173('0x54')]=_0x197f49[_0x0173('0x54')];this[_0x0173('0x55')]=_0x197f49[_0x0173('0x55')];this[_0x0173('0x56')]=0x0;this[_0x0173('0x57')]=0x0;this['timeout']=_0x197f49[_0x0173('0x58')];this[_0x0173('0x59')]=0x0;this[_0x0173('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x0173('0x5b')]=0x0;this[_0x0173('0x5c')]=0x0;this[_0x0173('0x5d')]=0x0;this[_0x0173('0x5e')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x0173('0x5f')]=0x0;this[_0x0173('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x0173('0x61')]=0x0;this[_0x0173('0x62')]=0x0;this[_0x0173('0x63')]=0x0;this[_0x0173('0x64')]=undefined;this[_0x0173('0x65')]=undefined;this[_0x0173('0x66')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x0173('0x67')]=0x0;this[_0x0173('0x68')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x0173('0x69')]=0x0;this[_0x0173('0x6a')]=0x0;this[_0x0173('0x6b')]=0x0;this[_0x0173('0x6c')]=0x0;this[_0x0173('0x6d')]=_0x197f49[_0x0173('0x6e')]||0x14;this[_0x0173('0x6f')]=_0x197f49['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x0173('0x70')]=0x0;this[_0x0173('0x71')]=0x1;this[_0x0173('0x72')]=0x0;this['erlangCallToSecond']=0x0;this[_0x0173('0x73')]=0x0;this[_0x0173('0x74')]=0x0;this[_0x0173('0x75')]=_0x197f49[_0x0173('0x75')]||0x1e;this[_0x0173('0x76')]=_0x197f49[_0x0173('0x76')]||![];this[_0x0173('0x77')]=_0x197f49[_0x0173('0x77')]||undefined;this['dialAgiAfterHangupClient']=_0x197f49[_0x0173('0x78')]||![];this['dialAgiAfterHangupAgent']=_0x197f49['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x197f49[_0x0173('0xa')]]?monitorFormat[_0x197f49[_0x0173('0xa')]]:undefined;this['mandatoryDisposition']=_0x197f49[_0x0173('0x79')]||![];this['mandatoryDispositionPause']=_0x197f49[_0x0173('0x7a')]?_0x197f49[_0x0173('0x7a')]:undefined;}module[_0x0173('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 1cd2cb4..8ee4c79 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 _0x7881=['name','username','accessKey','remoteUri','Configurations','exports'];(function(_0x36f05f,_0x5bfa89){var _0x4a3382=function(_0x167042){while(--_0x167042){_0x36f05f['push'](_0x36f05f['shift']());}};_0x4a3382(++_0x5bfa89);}(_0x7881,0x1b0));var _0x1788=function(_0x1ece99,_0x4f2735){_0x1ece99=_0x1ece99-0x0;var _0x4623ee=_0x7881[_0x1ece99];return _0x4623ee;};'use strict';function VtigerAccount(_0x2f2213){this['id']=_0x2f2213['id']||0x0;this['name']=_0x2f2213[_0x1788('0x0')]||'';this['username']=_0x2f2213[_0x1788('0x1')]||'';this[_0x1788('0x2')]=_0x2f2213[_0x1788('0x2')]||'';this[_0x1788('0x3')]=_0x2f2213[_0x1788('0x3')]||'';this['serverUrl']=_0x2f2213['serverUrl']||'';this[_0x1788('0x4')]=_0x2f2213['Configurations']||{};}module[_0x1788('0x5')]=VtigerAccount; \ No newline at end of file +var _0xc8f7=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x43e09c,_0x2359ad){var _0x54001d=function(_0x50837d){while(--_0x50837d){_0x43e09c['push'](_0x43e09c['shift']());}};_0x54001d(++_0x2359ad);}(_0xc8f7,0x116));var _0x7c8f=function(_0x423f1c,_0x2adb8c){_0x423f1c=_0x423f1c-0x0;var _0xebed4c=_0xc8f7[_0x423f1c];return _0xebed4c;};'use strict';function VtigerAccount(_0x3bb49a){this['id']=_0x3bb49a['id']||0x0;this[_0x7c8f('0x0')]=_0x3bb49a[_0x7c8f('0x0')]||'';this[_0x7c8f('0x1')]=_0x3bb49a['username']||'';this[_0x7c8f('0x2')]=_0x3bb49a[_0x7c8f('0x2')]||'';this[_0x7c8f('0x3')]=_0x3bb49a[_0x7c8f('0x3')]||'';this[_0x7c8f('0x4')]=_0x3bb49a[_0x7c8f('0x4')]||'';this['Configurations']=_0x3bb49a[_0x7c8f('0x5')]||{};}module[_0x7c8f('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index d2ea1b1..bfb3079 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 _0x3291=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type'];(function(_0x2d58a6,_0x26a11d){var _0x31050c=function(_0x1f4374){while(--_0x1f4374){_0x2d58a6['push'](_0x2d58a6['shift']());}};_0x31050c(++_0x26a11d);}(_0x3291,0x1b2));var _0x1329=function(_0x4b075f,_0x21b40a){_0x4b075f=_0x4b075f-0x0;var _0x4cbf2a=_0x3291[_0x4b075f];return _0x4cbf2a;};'use strict';function ZendeskAccount(_0x45276a){this['id']=_0x45276a['id']||0x0;this[_0x1329('0x0')]=_0x45276a[_0x1329('0x0')]||'';this['username']=_0x45276a[_0x1329('0x1')]||'';this['password']=_0x45276a[_0x1329('0x2')]||'';this[_0x1329('0x3')]=_0x45276a[_0x1329('0x3')]||'';this['remoteUri']=_0x45276a[_0x1329('0x4')]||'';this[_0x1329('0x5')]=_0x45276a[_0x1329('0x5')]||'';this[_0x1329('0x6')]=_0x45276a[_0x1329('0x6')]||'integrationTab';this[_0x1329('0x7')]=_0x45276a[_0x1329('0x7')]||'';this['Configurations']=_0x45276a[_0x1329('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x916d=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x3c6ee1,_0xd39978){var _0x36dcfe=function(_0x37b0ac){while(--_0x37b0ac){_0x3c6ee1['push'](_0x3c6ee1['shift']());}};_0x36dcfe(++_0xd39978);}(_0x916d,0x190));var _0xd916=function(_0x209525,_0x437089){_0x209525=_0x209525-0x0;var _0x2668c9=_0x916d[_0x209525];return _0x2668c9;};'use strict';function ZendeskAccount(_0x492786){this['id']=_0x492786['id']||0x0;this[_0xd916('0x0')]=_0x492786[_0xd916('0x0')]||'';this[_0xd916('0x1')]=_0x492786['username']||'';this[_0xd916('0x2')]=_0x492786[_0xd916('0x2')]||'';this['token']=_0x492786[_0xd916('0x3')]||'';this[_0xd916('0x4')]=_0x492786[_0xd916('0x4')]||'';this[_0xd916('0x5')]=_0x492786[_0xd916('0x5')]||'';this[_0xd916('0x6')]=_0x492786[_0xd916('0x6')]||_0xd916('0x7');this[_0xd916('0x8')]=_0x492786['serverUrl']||'';this[_0xd916('0x9')]=_0x492786['Configurations']||{};}module[_0xd916('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 d2b6bab..8644963 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 _0x1b70=['code','refreshToken','Configurations','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x206c37,_0x3316ca){var _0x2cc614=function(_0x13b3c7){while(--_0x13b3c7){_0x206c37['push'](_0x206c37['shift']());}};_0x2cc614(++_0x3316ca);}(_0x1b70,0x1bc));var _0x01b7=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x1b70[_0xf0ec6e];return _0x8bbc27;};'use strict';function ZohoAccount(_0x32b7f5){this['id']=_0x32b7f5['id']||0x0;this['name']=_0x32b7f5['name']||'';this[_0x01b7('0x0')]=_0x32b7f5[_0x01b7('0x0')]||'';this[_0x01b7('0x1')]=_0x32b7f5['host']||'';this[_0x01b7('0x2')]=_0x32b7f5[_0x01b7('0x2')]||'';this[_0x01b7('0x3')]=_0x32b7f5[_0x01b7('0x3')]||'';this[_0x01b7('0x4')]=_0x32b7f5[_0x01b7('0x4')]||'';this[_0x01b7('0x5')]=_0x32b7f5[_0x01b7('0x5')]||'';this[_0x01b7('0x6')]=_0x32b7f5['code']||'';this[_0x01b7('0x7')]=_0x32b7f5[_0x01b7('0x7')]||'';this[_0x01b7('0x8')]=_0x32b7f5[_0x01b7('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x91a9=['exports','description','zone','clientId','clientSecret','code','refreshToken','Configurations'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x91a9,0x1e9));var _0x991a=function(_0x11cdad,_0x7e66de){_0x11cdad=_0x11cdad-0x0;var _0x327514=_0x91a9[_0x11cdad];return _0x327514;};'use strict';function ZohoAccount(_0x5dcbfb){this['id']=_0x5dcbfb['id']||0x0;this['name']=_0x5dcbfb['name']||'';this['description']=_0x5dcbfb[_0x991a('0x0')]||'';this['host']=_0x5dcbfb['host']||'';this[_0x991a('0x1')]=_0x5dcbfb[_0x991a('0x1')]||'';this[_0x991a('0x2')]=_0x5dcbfb[_0x991a('0x2')]||'';this[_0x991a('0x3')]=_0x5dcbfb[_0x991a('0x3')]||'';this['serverUrl']=_0x5dcbfb['serverUrl']||'';this[_0x991a('0x4')]=_0x5dcbfb[_0x991a('0x4')]||'';this[_0x991a('0x5')]=_0x5dcbfb[_0x991a('0x5')]||'';this[_0x991a('0x6')]=_0x5dcbfb[_0x991a('0x6')]||{};}module[_0x991a('0x7')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 641849a..f2c629f 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 _0x302a=['getCaller','number','exports','util','moment','isNil','string','idContact','queue','name','type','campaigntype','Agent','membername','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype'];(function(_0x31edb9,_0xb57459){var _0x21e33a=function(_0x3fde47){while(--_0x3fde47){_0x31edb9['push'](_0x31edb9['shift']());}};_0x21e33a(++_0xb57459);}(_0x302a,0x84));var _0xa302=function(_0x3c78e0,_0x53578d){_0x3c78e0=_0x3c78e0-0x0;var _0x2274b1=_0x302a[_0x3c78e0];return _0x2274b1;};'use strict';var util=require(_0xa302('0x0'));var _=require('lodash');var moment=require(_0xa302('0x1'));function checkNameSurname(_0x3ac95c,_0x464906,_0x392932){var _0x2f4388='';if(!_[_0xa302('0x2')](_0x464906)&&_0xa302('0x3')===typeof _0x464906){_0x2f4388+=_0x464906;}if(!_[_0xa302('0x2')](_0x392932)&&_0xa302('0x3')===typeof _0x392932){_0x2f4388+='\x20'+_0x392932;}if(_0x2f4388!==''){return _0x2f4388;}return _0x3ac95c;}function Action(_0x158388,_0x3c4ef4,_0x289a27,_0x107d69,_0x2833d0){this['uniqueid']=_0x289a27||undefined;this[_0xa302('0x4')]=_0x158388['id'];this[_0xa302('0x5')]=_0x3c4ef4[_0xa302('0x6')];this[_0xa302('0x7')]=_0x3c4ef4[_0xa302('0x7')];this[_0xa302('0x8')]=_0xa302('0x5');this['dialAnswer']=![];this['membername']=_[_0xa302('0x2')](_0x158388[_0xa302('0x9')])?undefined:_0x158388['Agent'][_0xa302('0x6')];this['channelAgent']=this[_0xa302('0xa')]?util[_0xa302('0xb')](_0xa302('0xc'),this['membername']):_0x107d69||undefined;this[_0xa302('0xd')]=checkNameSurname(_0x158388['Contact'][_0xa302('0xe')],_0x158388[_0xa302('0xf')][_0xa302('0x10')],_0x158388[_0xa302('0xf')][_0xa302('0x11')]);this[_0xa302('0x12')]=_0x158388['active']||![];this[_0xa302('0x13')]=_0x158388[_0xa302('0xf')][_0xa302('0xe')];this[_0xa302('0x14')]=_0x158388[_0xa302('0x14')];this[_0xa302('0x15')]=_0x158388['countbusyretry']||0x0;this[_0xa302('0x16')]=_0x158388['countcongestionretry']||0x0;this[_0xa302('0x17')]=_0x158388[_0xa302('0x17')]||0x0;this[_0xa302('0x18')]=(_0x158388[_0xa302('0x15')]||0x0)+(_0x158388[_0xa302('0x16')]||0x0)+(_0x158388[_0xa302('0x17')]||0x0)+(_0x158388['countnosuchnumberretry']||0x0)+(_0x158388[_0xa302('0x19')]||0x0)+(_0x158388['countabandonedretry']||0x0)+(_0x158388[_0xa302('0x1a')]||0x0)+(_0x158388[_0xa302('0x1b')]||0x0);this[_0xa302('0x1c')]=_0x158388[_0xa302('0x1c')]||0x0;this['countdropretry']=_0x158388[_0xa302('0x19')]||0x0;this[_0xa302('0x1d')]=_0x158388[_0xa302('0x1d')]||0x0;this['countmachineretry']=_0x158388[_0xa302('0x1a')]||0x0;this['countagentrejectretry']=_0x158388[_0xa302('0x1b')]||0x0;this[_0xa302('0x1e')]=_0x158388[_0xa302('0x1e')];this[_0xa302('0x1f')]=_0x158388[_0xa302('0x1f')];this['callbackat']=_0x158388['callbackat'];this['recallme']=_0x158388[_0xa302('0x20')];this[_0xa302('0x21')]=_0x158388[_0xa302('0x21')];this['ListId']=_0x158388[_0xa302('0x22')];this[_0xa302('0x23')]=_[_0xa302('0x2')](_0x158388[_0xa302('0x9')])?_0x158388[_0xa302('0x23')]:_0x158388['Agent']['id'];this['VoiceQueueId']=_0x158388[_0xa302('0x24')];this[_0xa302('0x25')]='';this[_0xa302('0x26')]='';}Action[_0xa302('0x27')][_0xa302('0x28')]=function(){return util[_0xa302('0xb')]('\x22%s\x22\x20<%s>',this[_0xa302('0xd')],this[_0xa302('0x29')]);};module[_0xa302('0x2a')]=Action; \ No newline at end of file +var _0xf824=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','prototype','getCaller','number','exports','util','lodash','moment','string','isNil','uniqueid','idContact','type','queue','membername','Agent'];(function(_0x515eaf,_0x46cfc9){var _0x516eac=function(_0x332b2a){while(--_0x332b2a){_0x515eaf['push'](_0x515eaf['shift']());}};_0x516eac(++_0x46cfc9);}(_0xf824,0x1d9));var _0x4f82=function(_0x116c04,_0x4963da){_0x116c04=_0x116c04-0x0;var _0x9e011d=_0xf824[_0x116c04];return _0x9e011d;};'use strict';var util=require(_0x4f82('0x0'));var _=require(_0x4f82('0x1'));var moment=require(_0x4f82('0x2'));function checkNameSurname(_0x1c1932,_0x3c9d62,_0xc2c2b4){var _0x1279d0='';if(!_['isNil'](_0x3c9d62)&&_0x4f82('0x3')===typeof _0x3c9d62){_0x1279d0+=_0x3c9d62;}if(!_[_0x4f82('0x4')](_0xc2c2b4)&&_0x4f82('0x3')===typeof _0xc2c2b4){_0x1279d0+='\x20'+_0xc2c2b4;}if(_0x1279d0!==''){return _0x1279d0;}return _0x1c1932;}function Action(_0x5462d0,_0x49b184,_0x2be1b8,_0x12d2b8,_0x410179){this[_0x4f82('0x5')]=_0x2be1b8||undefined;this[_0x4f82('0x6')]=_0x5462d0['id'];this['queue']=_0x49b184['name'];this[_0x4f82('0x7')]=_0x49b184['type'];this['campaigntype']=_0x4f82('0x8');this['dialAnswer']=![];this[_0x4f82('0x9')]=_['isNil'](_0x5462d0[_0x4f82('0xa')])?undefined:_0x5462d0[_0x4f82('0xa')][_0x4f82('0xb')];this[_0x4f82('0xc')]=this['membername']?util[_0x4f82('0xd')](_0x4f82('0xe'),this[_0x4f82('0x9')]):_0x12d2b8||undefined;this[_0x4f82('0xf')]=checkNameSurname(_0x5462d0[_0x4f82('0x10')][_0x4f82('0x11')],_0x5462d0[_0x4f82('0x10')][_0x4f82('0x12')],_0x5462d0[_0x4f82('0x10')][_0x4f82('0x13')]);this[_0x4f82('0x14')]=_0x5462d0[_0x4f82('0x14')]||![];this[_0x4f82('0x15')]=_0x5462d0[_0x4f82('0x10')][_0x4f82('0x11')];this[_0x4f82('0x16')]=_0x5462d0[_0x4f82('0x16')];this[_0x4f82('0x17')]=_0x5462d0['countbusyretry']||0x0;this[_0x4f82('0x18')]=_0x5462d0[_0x4f82('0x18')]||0x0;this[_0x4f82('0x19')]=_0x5462d0[_0x4f82('0x19')]||0x0;this[_0x4f82('0x1a')]=(_0x5462d0[_0x4f82('0x17')]||0x0)+(_0x5462d0[_0x4f82('0x18')]||0x0)+(_0x5462d0[_0x4f82('0x19')]||0x0)+(_0x5462d0[_0x4f82('0x1b')]||0x0)+(_0x5462d0[_0x4f82('0x1c')]||0x0)+(_0x5462d0['countabandonedretry']||0x0)+(_0x5462d0[_0x4f82('0x1d')]||0x0)+(_0x5462d0['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x5462d0[_0x4f82('0x1b')]||0x0;this[_0x4f82('0x1c')]=_0x5462d0['countdropretry']||0x0;this[_0x4f82('0x1e')]=_0x5462d0['countabandonedretry']||0x0;this[_0x4f82('0x1d')]=_0x5462d0[_0x4f82('0x1d')]||0x0;this[_0x4f82('0x1f')]=_0x5462d0[_0x4f82('0x1f')]||0x0;this['callback']=_0x5462d0[_0x4f82('0x20')];this[_0x4f82('0x21')]=_0x5462d0[_0x4f82('0x21')];this[_0x4f82('0x22')]=_0x5462d0[_0x4f82('0x22')];this[_0x4f82('0x23')]=_0x5462d0[_0x4f82('0x23')];this[_0x4f82('0x24')]=_0x5462d0[_0x4f82('0x24')];this[_0x4f82('0x25')]=_0x5462d0['ListId'];this['UserId']=_[_0x4f82('0x4')](_0x5462d0['Agent'])?_0x5462d0['UserId']:_0x5462d0[_0x4f82('0xa')]['id'];this[_0x4f82('0x26')]=_0x5462d0[_0x4f82('0x26')];this[_0x4f82('0x27')]='';this['originatecalleridname']='';}Action[_0x4f82('0x28')][_0x4f82('0x29')]=function(){return util[_0x4f82('0xd')]('\x22%s\x22\x20<%s>',this[_0x4f82('0xf')],this[_0x4f82('0x2a')]);};module[_0x4f82('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5045469..f7a7f9b 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 _0xe293=['OriginateError','actionid','isFailure','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','md5','../../../config/environment','preview','actionPreview','./action','./util/util','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','erlangCalls','erlangBusyFactor','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','voice_queue_presence:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','logger','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','totalGlobal','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','unlock','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','isActive','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','dialCutDigit','phone','trim','substring','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','destconnectedlinenum','calleridnum','user:agentconnect','accountcode','[originated][increment]'];(function(_0x5bc6d5,_0x14305e){var _0x32a9ae=function(_0x25508b){while(--_0x25508b){_0x5bc6d5['push'](_0x5bc6d5['shift']());}};_0x32a9ae(++_0x14305e);}(_0xe293,0x16d));var _0x3e29=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xe293[_0x1c8cc6];return _0x522936;};'use strict';var util=require(_0x3e29('0x0'));var _=require(_0x3e29('0x1'));var BPromise=require('bluebird');var uuid=require(_0x3e29('0x2'));var moment=require(_0x3e29('0x3'));var md5=require(_0x3e29('0x4'));var Redis=require('ioredis');var config=require(_0x3e29('0x5'));var logger=require('../../../config/logger')(_0x3e29('0x6'));var loggerAction=require('../../../config/logger')(_0x3e29('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0x3e29('0x8'));var ut=require(_0x3e29('0x9'));config['redis']=_[_0x3e29('0xa')](config['redis'],{'host':_0x3e29('0xb'),'port':0x18eb});var io=require(_0x3e29('0xc'))(new Redis(config[_0x3e29('0xd')]));var Sequence=function(){};Sequence[_0x3e29('0xe')][_0x3e29('0xf')]=function(_0x3db043){this['tail']=this[_0x3e29('0x10')]?this[_0x3e29('0x10')][_0x3e29('0x11')](_0x3db043):_0x3db043();};function Preview(_0x4c57c8){this[_0x3e29('0x12')]=new Sequence();this[_0x3e29('0x13')]=_0x4c57c8['voiceQueues'];this[_0x3e29('0x14')]=_0x4c57c8['trunks'];this[_0x3e29('0x15')]={};this[_0x3e29('0x16')]=_0x4c57c8[_0x3e29('0x16')];this[_0x3e29('0x17')]=0x0;ami['on'](_0x3e29('0x18'),this[_0x3e29('0x19')][_0x3e29('0x1a')](this));ami['on'](_0x3e29('0x1b'),this[_0x3e29('0x1c')]['bind'](this));ami['on'](_0x3e29('0x1d'),this[_0x3e29('0x1e')][_0x3e29('0x1a')](this));ami['on'](_0x3e29('0x1f'),this[_0x3e29('0x20')][_0x3e29('0x1a')](this));ami['on']('newexten',this[_0x3e29('0x21')][_0x3e29('0x1a')](this));ami['on'](_0x3e29('0x22'),this['syncVarSet']['bind'](this));ami['on']('attendedtransfer',this[_0x3e29('0x23')][_0x3e29('0x1a')](this));ami['on'](_0x3e29('0x24'),this[_0x3e29('0x25')][_0x3e29('0x1a')](this));this[_0x3e29('0x26')](this[_0x3e29('0x13')]);}function emit(_0xf0d166,_0x1c2160,_0x216f4c){io['to'](_0xf0d166)[_0x3e29('0x27')](_0x1c2160,_0x216f4c);}function emitCampaignPreview(_0x2944f9){if(_0x2944f9[_0x3e29('0x28')]===_0x3e29('0x29')){var _0x7d1413={'id':_0x2944f9['id'],'name':_0x2944f9[_0x3e29('0x2a')],'strategy':_0x2944f9[_0x3e29('0x2b')],'answered':_0x2944f9[_0x3e29('0x2c')],'available':_0x2944f9[_0x3e29('0x2d')],'loggedIn':_0x2944f9['loggedIn'],'pTalking':_0x2944f9[_0x3e29('0x2e')],'sumBillable':_0x2944f9[_0x3e29('0x2f')],'sumDuration':_0x2944f9['sumDuration'],'sumHoldTime':_0x2944f9[_0x3e29('0x30')]||0x0,'talking':_0x2944f9[_0x3e29('0x31')],'total':_0x2944f9['total'],'type':_0x2944f9['type'],'unmanaged':_0x2944f9[_0x3e29('0x32')],'abandoned':_0x2944f9[_0x3e29('0x33')],'waiting':_0x2944f9[_0x3e29('0x34')],'loggedInDb':_0x2944f9['loggedInDb'],'dialActive':_0x2944f9[_0x3e29('0x35')],'dialMethod':_0x2944f9[_0x3e29('0x36')],'dialOriginateCallerIdName':_0x2944f9[_0x3e29('0x37')],'dialOriginateCallerIdNumber':_0x2944f9['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x2944f9['dialOriginateTimeout'],'dialPrefix':_0x2944f9['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2944f9[_0x3e29('0x38')],'outboundAnswerCallsDay':_0x2944f9[_0x3e29('0x39')],'outboundBlacklistCallsDay':_0x2944f9[_0x3e29('0x3a')],'outboundBusyCallsDay':_0x2944f9['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2944f9[_0x3e29('0x3b')],'outboundDropCallsDayACS':_0x2944f9['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2944f9[_0x3e29('0x3c')],'outboundDropCallsDayTimeout':_0x2944f9[_0x3e29('0x3d')],'outboundNoAnswerCallsDay':_0x2944f9[_0x3e29('0x3e')],'outboundNoSuchCallsDay':_0x2944f9['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2944f9[_0x3e29('0x3f')],'outboundReCallsDay':_0x2944f9[_0x3e29('0x40')],'outboundRejectCallsDay':_0x2944f9[_0x3e29('0x41')],'outboundUnknownCallsDay':_0x2944f9[_0x3e29('0x42')],'outboundAbandonedCallsDay':_0x2944f9[_0x3e29('0x43')],'predictiveIntervalAnsweredCalls':_0x2944f9[_0x3e29('0x44')],'predictiveIntervalAvgHoldtime':_0x2944f9['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2944f9[_0x3e29('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x2944f9[_0x3e29('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x2944f9[_0x3e29('0x47')],'predictiveIntervalErlangCalls':_0x2944f9[_0x3e29('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x2944f9[_0x3e29('0x49')],'predictiveIntervalHitRate':_0x2944f9[_0x3e29('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x2944f9[_0x3e29('0x4b')],'predictiveIntervalPauses':_0x2944f9[_0x3e29('0x4c')],'predictiveIntervalAvailable':_0x2944f9['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2944f9['predictiveIntervalTotalCalls'],'message':_0x2944f9[_0x3e29('0x4d')],'originated':_0x2944f9['originated'],'erlangCalls':_0x2944f9[_0x3e29('0x4e')],'erlangCallToSecond':_0x2944f9['erlangCallToSecond'],'erlangAbandonmentRate':_0x2944f9['erlangAbandonmentRate'],'erlangBusyFactor':_0x2944f9[_0x3e29('0x4f')],'startPredictive':_0x2944f9['startPredictive'],'startProgressive':_0x2944f9['startProgressive']};if(_0x2944f9[_0x3e29('0x50')]){_0x7d1413[_0x3e29('0x50')]={'id':_0x2944f9['Trunk']['id'],'name':_0x2944f9['Trunk']['name'],'active':_0x2944f9[_0x3e29('0x50')]['active'],'callerid':_0x2944f9[_0x3e29('0x50')][_0x3e29('0x51')]};}if(_0x2944f9['Interval']){_0x7d1413[_0x3e29('0x52')]={'id':_0x2944f9[_0x3e29('0x52')]['id'],'name':_0x2944f9[_0x3e29('0x52')][_0x3e29('0x2a')]};}var _0xe42f96=md5(JSON[_0x3e29('0x53')](_0x7d1413));if(_0x2944f9[_0x3e29('0x4')]!==_0xe42f96){_0x2944f9[_0x3e29('0x4')]=_0xe42f96;emit(util[_0x3e29('0x54')](_0x3e29('0x55'),_0x7d1413[_0x3e29('0x2a')]),_0x3e29('0x56'),_0x7d1413);}}}function emitVoiceQueueChannelRemove(_0x266d70){logger[_0x3e29('0x57')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x266d70));emit(util[_0x3e29('0x54')]('voice:queue:%s',_0x266d70['name']),'voice_queue_channel:remove',_0x266d70);io[_0x3e29('0x27')](_0x3e29('0x58'),_0x266d70);}function notSendMessagesQueue(_0xac23b){if(_0xac23b[_0x3e29('0x59')]){if(_0xac23b[_0x3e29('0x5a')]===0x0&&_0xac23b['pTalking']===0x0){_0xac23b[_0x3e29('0x59')]=![];_0xac23b[_0x3e29('0x2d')]=0x0;_0xac23b['paused']=0x0;_0xac23b[_0x3e29('0x4d')]=_0x3e29('0x5b');ut[_0x3e29('0x5c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xac23b[_0x3e29('0x2a')]+'\x20is\x20not\x20active');}else{_0xac23b[_0x3e29('0x4d')]=_0x3e29('0x5d');ut['logger'](_0x3e29('0x5e'),_0xac23b['name']+_0x3e29('0x5f'));}emitCampaignPreview(_0xac23b);}}Preview['prototype'][_0x3e29('0x26')]=function(){var _0x110f73=this;setInterval(function(){_0x110f73[_0x3e29('0x60')]();},0x7cf);};Preview[_0x3e29('0xe')][_0x3e29('0x60')]=function(){var _0x557282=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x7db84c in _0x557282){if(_0x557282[_0x3e29('0x61')](_0x7db84c)&&(_0x557282[_0x7db84c][_0x3e29('0x36')]===_0x3e29('0x6')||_0x557282[_0x7db84c][_0x3e29('0x36')]===_0x3e29('0x62'))&&_0x557282[_0x7db84c]['type']===_0x3e29('0x29')){if(this['clockClearZombieChannels']>0x7){this[_0x3e29('0x17')]=0x0;this[_0x3e29('0x63')]();}}if(_0x557282[_0x3e29('0x61')](_0x7db84c)&&_0x557282[_0x7db84c][_0x3e29('0x36')]===_0x3e29('0x6')&&_0x557282[_0x7db84c][_0x3e29('0x28')]===_0x3e29('0x29')){if(_0x557282[_0x7db84c]['dialActive']){this[_0x3e29('0x64')](_0x557282[_0x7db84c]);this['recallMe'](_0x557282[_0x7db84c]);}else{notSendMessagesQueue(_0x557282[_0x7db84c]);}}}};Preview['prototype'][_0x3e29('0x65')]=function(_0x23b861){var _0x1ab871=this;this[_0x3e29('0x12')][_0x3e29('0xf')](function(){if(!_[_0x3e29('0x66')](_0x1ab871[_0x3e29('0x15')][_0x23b861])){loggerAction['info'](_0x3e29('0x67'),_0x23b861,_0x3e29('0x68'),_0x1ab871[_0x3e29('0x15')][_0x23b861][_0x3e29('0x69')],_0x3e29('0x6a'),JSON[_0x3e29('0x53')](_0x1ab871[_0x3e29('0x13')][_0x1ab871['actions'][_0x23b861][_0x3e29('0x69')]][_0x3e29('0x5a')]),_0x3e29('0x6b'),JSON['stringify'](_0x1ab871[_0x3e29('0x13')][_0x1ab871[_0x3e29('0x15')][_0x23b861][_0x3e29('0x69')]]['pTalking']),JSON[_0x3e29('0x53')](_0x1ab871[_0x3e29('0x15')][_0x23b861][_0x3e29('0x6c')]),JSON['stringify'](_[_0x3e29('0x6d')](_0x1ab871[_0x3e29('0x15')][_0x23b861],[_0x3e29('0x6e'),'UserId',_0x3e29('0x6f'),_0x3e29('0x70')])));return ami[_0x3e29('0x71')]({'action':_0x3e29('0x72'),'channel':_0x1ab871[_0x3e29('0x15')][_0x23b861][_0x3e29('0x73')]})[_0x3e29('0x74')](function(_0x59135d){if(_0x59135d[_0x3e29('0x4d')]===_0x3e29('0x75')){setTimeout(function(){if(_0x1ab871[_0x3e29('0x15')][_0x23b861]){ut[_0x3e29('0x76')](_0x1ab871['campaignsPreview'][_0x1ab871['actions'][_0x23b861][_0x3e29('0x69')]],_0x3e29('0x77'));if(_0x1ab871[_0x3e29('0x15')][_0x23b861][_0x3e29('0x6c')]===!![]){ut[_0x3e29('0x78')](_0x1ab871[_0x3e29('0x13')][_0x1ab871[_0x3e29('0x15')][_0x23b861][_0x3e29('0x69')]],_0x3e29('0x77'));ut[_0x3e29('0x79')](_0x3e29('0x7a')+_0x23b861,_0x1ab871[_0x3e29('0x15')][_0x23b861][_0x3e29('0x69')]);}ut[_0x3e29('0x79')](_0x3e29('0x7b')+_0x23b861,_0x1ab871[_0x3e29('0x15')][_0x23b861][_0x3e29('0x69')]);delete _0x1ab871[_0x3e29('0x15')][_0x23b861];}},0x2328);}});}});};Preview[_0x3e29('0xe')][_0x3e29('0x63')]=function(){var _0x5194e7=this;loggerAction[_0x3e29('0x57')](_0x3e29('0x7c'),_[_0x3e29('0x7d')](this[_0x3e29('0x15')]));for(var _0x1a1616 in this['actions']){if(_0x5194e7[_0x3e29('0x15')]['hasOwnProperty'](_0x1a1616)){_0x5194e7[_0x3e29('0x65')](_0x1a1616);}}};Preview[_0x3e29('0xe')][_0x3e29('0x7e')]=function(_0x344898){var _0x237234=this;rpcDb[_0x3e29('0x7f')](_0x344898['id'],ut['agentReadyId'](this[_0x3e29('0x16')]))[_0x3e29('0x80')](function(_0xf99909){if(!_['isNil'](_0xf99909)){for(var _0x37ce41=0x0;_0x37ce41<_0xf99909[_0x3e29('0x81')];_0x37ce41+=0x1){if(ut[_0x3e29('0x82')](_0xf99909[_0x37ce41][_0x3e29('0x83')])<_0x344898[_0x3e29('0x84')]*0x3c){if(_0xf99909[_0x37ce41][_0x3e29('0x85')]&&!_0xf99909[_0x37ce41][_0x3e29('0x85')][_0x3e29('0x86')]){_0x237234[_0x3e29('0x87')](_0xf99909[_0x37ce41]['id'])[_0x3e29('0x80')](ut[_0x3e29('0x88')](_0x3e29('0x89')))[_0x3e29('0x74')](ut[_0x3e29('0x88')](_0x3e29('0x89')));}else{rpcDb[_0x3e29('0x8a')](_0xf99909[_0x37ce41]['id']);}}else{var _0x55d169=new Action(_0xf99909[_0x37ce41],_0x344898);_0x55d169[_0x3e29('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x344898[_0x3e29('0x40')]+=0x1;ut[_0x3e29('0x8c')](_0x55d169,0x17,_0x3e29('0x8d'));if(_0x344898[_0x3e29('0x8e')]){rpcDb[_0x3e29('0x8f')](ut[_0x3e29('0x90')](_0xf99909[_0x37ce41]));rpcDb[_0x3e29('0x91')](_0x55d169,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x3e29('0x8c')](_0x55d169,0x16,_0x3e29('0x92'));rpcDb[_0x3e29('0x91')](_0x55d169,_0x3e29('0x93'));rpcDb[_0x3e29('0x94')](_0x55d169,_0x3e29('0x93'));}}}}})['catch'](ut[_0x3e29('0x88')](_0x3e29('0x95')));};Preview['prototype']['setMessage']=function(_0x4e144b){_0x4e144b[_0x3e29('0x59')]=!![];if(ut[_0x3e29('0x96')](_0x4e144b[_0x3e29('0x97')])){_0x4e144b[_0x3e29('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x4e144b[_0x3e29('0x35')])){_0x4e144b['message']='NOT_ACTIVE';}else if(!this[_0x3e29('0x98')](_0x4e144b[_0x3e29('0x50')])){if(!this[_0x3e29('0x98')](_0x4e144b[_0x3e29('0x99')])){_0x4e144b[_0x3e29('0x4d')]=_0x3e29('0x9a');}else{_0x4e144b[_0x3e29('0x4d')]=_0x3e29('0x9b');}}else{_0x4e144b['message']=_0x3e29('0x9b');}emitCampaignPreview(_0x4e144b);};Preview[_0x3e29('0xe')][_0x3e29('0x9c')]=function(_0x4e2f2a,_0x5dae8d,_0x3ab0ff){var _0x431fca=this;var _0x2258b6=this['actions'][_0x5dae8d];var _0x5ebec8=this[_0x3e29('0x13')][_0x2258b6[_0x3e29('0x69')]];var _0x30e5ef;if(_0x5ebec8){switch(_0x3ab0ff){case'1':_0x5ebec8[_0x3e29('0x9d')]+=0x1;_0x2258b6[_0x3e29('0x9e')]+=0x1;_0x2258b6[_0x3e29('0x9f')]=ut['totalGlobal'](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0x0,_0x3e29('0xa0'));ami[_0x3e29('0x27')](_0x3e29('0xa1'),ut[_0x3e29('0xa2')](_0x2258b6,'nosuchnumber'));rpcDb[_0x3e29('0x91')](_0x2258b6,_0x3e29('0xa3'));if(ut['totalGlobal'](_0x2258b6)>=_0x5ebec8[_0x3e29('0xa4')]){_0x30e5ef=ut[_0x3e29('0xa5')](_0x2258b6,0xf,_0x3e29('0xa6'));rpcDb[_0x3e29('0x94')](_0x30e5ef,_0x3e29('0xa7'));}else{if(_0x2258b6[_0x3e29('0x9e')]>=_0x5ebec8['dialNoSuchNumberMaxRetry']){rpcDb[_0x3e29('0x94')](_0x2258b6,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x3e29('0xa8')](ut[_0x3e29('0xa9')](_0x2258b6,'countnosuchnumberretry',_0x5ebec8[_0x3e29('0xaa')]),_0x2258b6[_0x3e29('0xab')],_0x2258b6[_0x3e29('0xac')]);}}delete this[_0x3e29('0x15')][_0x4e2f2a[_0x3e29('0xad')]];break;case _0x3e29('0xae'):var _0x16c6dd=moment()[_0x3e29('0x54')](_0x3e29('0xaf'));_0x2258b6[_0x3e29('0xb0')]=_0x16c6dd;_0x2258b6[_0x3e29('0xb1')]=_0x16c6dd;_0x2258b6[_0x3e29('0x6c')]=!![];_0x5ebec8[_0x3e29('0x2e')]+=0x1;logger[_0x3e29('0x57')]('[syncHangup][talking][increment]',_0x2258b6['uniqueid'],_0x3e29('0xb2'),_0x5ebec8[_0x3e29('0x2a')],_0x3e29('0x6b'),_0x5ebec8[_0x3e29('0x2e')]);ami[_0x3e29('0x27')]('custom:agentconnect',ut[_0x3e29('0xa2')](_0x2258b6,_0x3e29('0xb3'),this[_0x3e29('0x13')][_0x2258b6[_0x3e29('0x69')]]));if(_0x5ebec8[_0x3e29('0xb4')]){ami[_0x3e29('0x27')](_0x3e29('0xb5'),ut[_0x3e29('0xb6')](_0x2258b6));}break;case'16':ami[_0x3e29('0x27')]('custom:agentcomplete',ut[_0x3e29('0xa2')](_0x2258b6,_0x3e29('0xb7'),this['campaignsPreview'][_0x2258b6[_0x3e29('0x69')]]));emitVoiceQueueChannelRemove(ut[_0x3e29('0xa2')](_0x2258b6,'complete'));_0x5ebec8[_0x3e29('0x39')]+=0x1;_0x5ebec8['total']+=0x1;_0x5ebec8[_0x3e29('0x2c')]+=0x1;ut[_0x3e29('0x78')](_0x5ebec8,_0x3e29('0xb8'));_0x2258b6['countglobal']=ut[_0x3e29('0xb9')](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0x4,'Answer');rpcDb[_0x3e29('0x91')](_0x2258b6,_0x3e29('0xba'));rpcDb[_0x3e29('0x94')](_0x2258b6,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x3e29('0xbb')](_0x2258b6);_0x5ebec8[_0x3e29('0xbc')]+=_0x2258b6['talktime'];_0x5ebec8[_0x3e29('0x2f')]+=_0x2258b6[_0x3e29('0xbd')];logger[_0x3e29('0x57')](_0x3e29('0xbe'),_0x2258b6[_0x3e29('0xbf')],_0x3e29('0xb2'),_0x5ebec8['name'],_0x3e29('0x6b'),_0x5ebec8[_0x3e29('0x2e')]);delete this[_0x3e29('0x15')][_0x4e2f2a[_0x3e29('0xad')]];break;case _0x3e29('0xc0'):_0x5ebec8['outboundBusyCallsDay']+=0x1;_0x2258b6[_0x3e29('0xc1')]+=0x1;_0x2258b6['countglobal']=ut['totalGlobal'](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0x5,_0x3e29('0xc2'));ami[_0x3e29('0x27')](_0x3e29('0xc3'),ut['buildObj'](_0x2258b6,'busy'));rpcDb[_0x3e29('0x91')](_0x2258b6,_0x3e29('0xc4'));if(ut[_0x3e29('0xb9')](_0x2258b6)>=_0x5ebec8[_0x3e29('0xa4')]){_0x30e5ef=ut['cloneAction'](_0x2258b6,0xf,'Global');rpcDb['createCustomerFinal'](_0x30e5ef,_0x3e29('0xc5'));}else{if(_0x2258b6[_0x3e29('0xc1')]>=_0x5ebec8[_0x3e29('0xc6')]){rpcDb[_0x3e29('0x94')](_0x2258b6,_0x3e29('0xc4'));}else{rpcDb[_0x3e29('0xa8')](ut[_0x3e29('0xa9')](_0x2258b6,'countbusyretry',_0x5ebec8[_0x3e29('0xc7')]),_0x2258b6[_0x3e29('0xab')],_0x2258b6[_0x3e29('0xac')]);}}break;case _0x3e29('0xc8'):_0x5ebec8[_0x3e29('0x3e')]+=0x1;_0x2258b6[_0x3e29('0xc9')]+=0x1;_0x2258b6['countglobal']=ut[_0x3e29('0xb9')](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0x3,_0x3e29('0xca'));ami[_0x3e29('0x27')]('custom:agentnoanswer',ut[_0x3e29('0xa2')](_0x2258b6,_0x3e29('0xcb')));rpcDb[_0x3e29('0x91')](_0x2258b6,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x2258b6)>=_0x5ebec8[_0x3e29('0xa4')]){_0x30e5ef=ut[_0x3e29('0xa5')](_0x2258b6,0xf,'Global');rpcDb[_0x3e29('0x94')](_0x30e5ef,_0x3e29('0xcc'));}else{if(_0x2258b6[_0x3e29('0xc9')]>=_0x5ebec8[_0x3e29('0xcd')]){rpcDb[_0x3e29('0x94')](_0x2258b6,_0x3e29('0xce'));}else{rpcDb[_0x3e29('0xa8')](ut[_0x3e29('0xa9')](_0x2258b6,_0x3e29('0xc9'),_0x5ebec8[_0x3e29('0xcf')]),_0x2258b6['unlockAgent'],_0x2258b6[_0x3e29('0xac')]);}}break;case _0x3e29('0xd0'):_0x5ebec8['outboundCongestionCallsDay']+=0x1;_0x2258b6[_0x3e29('0xd1')]+=0x1;_0x2258b6[_0x3e29('0x9f')]=ut[_0x3e29('0xb9')](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0x8,_0x3e29('0xd2'));ami['emit'](_0x3e29('0xd3'),ut[_0x3e29('0xa2')](_0x2258b6,_0x3e29('0xd4')));rpcDb[_0x3e29('0x91')](_0x2258b6,_0x3e29('0xd5'));if(ut[_0x3e29('0xb9')](_0x2258b6)>=_0x5ebec8[_0x3e29('0xa4')]){_0x30e5ef=ut[_0x3e29('0xa5')](_0x2258b6,0xf,'Global');rpcDb['createCustomerFinal'](_0x30e5ef,_0x3e29('0xd6'));}else{if(_0x2258b6['countcongestionretry']>=_0x5ebec8[_0x3e29('0xd7')]){rpcDb[_0x3e29('0x94')](_0x2258b6,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3e29('0xa8')](ut[_0x3e29('0xa9')](_0x2258b6,'countcongestionretry',_0x5ebec8[_0x3e29('0xc7')]),_0x2258b6[_0x3e29('0xab')],_0x2258b6[_0x3e29('0xac')]);}}break;case'CANCEL':_0x5ebec8[_0x3e29('0x41')]+=0x1;_0x2258b6[_0x3e29('0xd8')]+=0x1;_0x2258b6['countglobal']=ut[_0x3e29('0xb9')](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0x14,_0x3e29('0xd9'));ami['emit'](_0x3e29('0xda'),ut['buildObj'](_0x2258b6,'agentreject'));rpcDb[_0x3e29('0x91')](_0x2258b6,_0x3e29('0xdb'));if(ut['totalGlobal'](_0x2258b6)>=_0x5ebec8['dialGlobalMaxRetry']){_0x30e5ef=ut[_0x3e29('0xa5')](_0x2258b6,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x30e5ef,_0x3e29('0xdc'));}else{if(_0x2258b6[_0x3e29('0xd8')]>=_0x5ebec8[_0x3e29('0xdd')]){rpcDb['createCustomerFinal'](_0x2258b6,_0x3e29('0xdc'));}else{rpcDb[_0x3e29('0xa8')](ut[_0x3e29('0xa9')](_0x2258b6,_0x3e29('0xd8'),_0x5ebec8[_0x3e29('0xde')]),_0x2258b6[_0x3e29('0xab')],_0x2258b6[_0x3e29('0xac')]);}}break;case _0x3e29('0xdf'):_0x5ebec8[_0x3e29('0x43')]+=0x1;_0x2258b6[_0x3e29('0xe0')]+=0x1;_0x2258b6['countglobal']=ut[_0x3e29('0xb9')](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x2258b6,_0x3e29('0xe1'));if(ut[_0x3e29('0xb9')](_0x2258b6)>=_0x5ebec8[_0x3e29('0xa4')]){_0x30e5ef=ut[_0x3e29('0xa5')](_0x2258b6,0xf,_0x3e29('0xa6'));rpcDb['createCustomerFinal'](_0x30e5ef,_0x3e29('0xe1'));}else{if(_0x2258b6[_0x3e29('0xe2')]>=_0x5ebec8['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x2258b6,_0x3e29('0xe1'));}else{rpcDb[_0x3e29('0xa8')](ut[_0x3e29('0xa9')](_0x2258b6,_0x3e29('0xe0'),_0x5ebec8[_0x3e29('0xe3')]),_0x2258b6[_0x3e29('0xab')],_0x2258b6[_0x3e29('0xac')]);}}break;case'18':_0x5ebec8[_0x3e29('0x42')]+=0x1;_0x2258b6[_0x3e29('0xe4')]+=0x1;_0x2258b6[_0x3e29('0x9f')]=ut[_0x3e29('0xb9')](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0x12,_0x4e2f2a[_0x3e29('0xe5')]||_0x4e2f2a['dialstatus']);ami['emit'](_0x3e29('0xe6'),ut[_0x3e29('0xa2')](_0x2258b6,_0x3e29('0xe7')));rpcDb[_0x3e29('0x91')](_0x2258b6,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x3e29('0xb9')](_0x2258b6)>=_0x5ebec8[_0x3e29('0xa4')]){_0x30e5ef=ut['cloneAction'](_0x2258b6,0xf,_0x3e29('0xa6'));rpcDb[_0x3e29('0x94')](_0x30e5ef,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x3e29('0x94')](_0x2258b6,_0x3e29('0xe8'));}delete this[_0x3e29('0x15')][_0x4e2f2a[_0x3e29('0xad')]];break;case'19':_0x5ebec8[_0x3e29('0x42')]+=0x1;_0x2258b6['countglobal']=ut[_0x3e29('0xb9')](_0x2258b6);ut['logCustomer'](_0x2258b6,0x13,_0x4e2f2a[_0x3e29('0xe5')]||_0x4e2f2a[_0x3e29('0xe9')]);ami['emit']('custom:amd',ut[_0x3e29('0xa2')](_0x2258b6,_0x3e29('0xe7')));rpcDb[_0x3e29('0x91')](_0x2258b6,'[callProgressDetectingCustomer][machine]');if(ut[_0x3e29('0xb9')](_0x2258b6)>=_0x5ebec8['dialGlobalMaxRetry']){_0x30e5ef=ut['cloneAction'](_0x2258b6,0xf,_0x3e29('0xa6'));rpcDb['createCustomerFinal'](_0x30e5ef,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x3e29('0x94')](_0x2258b6,_0x3e29('0xea'));}delete this[_0x3e29('0x15')][_0x4e2f2a['linkedid']];break;default:if(_0x2258b6[_0x3e29('0x6c')]){ut[_0x3e29('0x78')](_0x5ebec8,'[default]');ut['loggerError'](_0x3e29('0xeb')+_0x5ebec8[_0x3e29('0x2a')],_0x4e2f2a);}_0x5ebec8['outboundUnknownCallsDay']+=0x1;_0x2258b6[_0x3e29('0x9f')]=ut[_0x3e29('0xb9')](_0x2258b6);ut[_0x3e29('0x8c')](_0x2258b6,0xc,_0x4e2f2a[_0x3e29('0xe5')]||_0x4e2f2a[_0x3e29('0xe9')]);rpcDb[_0x3e29('0x91')](_0x2258b6,_0x3e29('0xec'));if(ut[_0x3e29('0xb9')](_0x2258b6)>=_0x5ebec8[_0x3e29('0xa4')]){_0x30e5ef=ut[_0x3e29('0xa5')](_0x2258b6,0xf,_0x3e29('0xa6'));rpcDb[_0x3e29('0x94')](_0x30e5ef,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x3e29('0x94')](_0x2258b6,_0x3e29('0xed'));}delete this['actions'][_0x4e2f2a[_0x3e29('0xad')]];}if(!(_0x2258b6['dialAnswer']&&_0x3ab0ff==='16')){ut['updateOriginated'](_0x5ebec8,'[callProgressDetectingCustomer]');logger[_0x3e29('0x57')](_0x3e29('0xee'),_0x2258b6['uniqueid'],'\x20Queue',_0x5ebec8['name'],'originated:\x20',_0x5ebec8[_0x3e29('0x5a')]);}if(_0x3ab0ff!==_0x3e29('0xae')){delete this[_0x3e29('0x15')][_0x4e2f2a['linkedid']];delete this[_0x3e29('0x15')][_0x4e2f2a[_0x3e29('0xef')]];}}};Preview[_0x3e29('0xe')]['callProgressDetectingAgent']=function(_0xbebc99,_0x14ddef,_0x1f6aee){if(_['isUndefined'](_0x14ddef)&&'object'!==typeof _0x14ddef){return;}if(_[_0x3e29('0xf0')](_0x1f6aee)&&_0x3e29('0xf1')!==typeof _0x1f6aee){return;}switch(_0x1f6aee[_0x3e29('0xf2')]){case'0':ut[_0x3e29('0xf3')](_0xbebc99,0x0,_0x3e29('0xa0'));rpcDb['createAgentHistory'](_0xbebc99,_0x3e29('0xf4'));break;case'3':ut[_0x3e29('0xf3')](_0xbebc99,0x3,_0x3e29('0xca'));rpcDb['createAgentHistory'](_0xbebc99,_0x3e29('0xf5'));break;case'5':ut[_0x3e29('0xf3')](_0xbebc99,0x5,_0x3e29('0xc2'));rpcDb[_0x3e29('0xf6')](_0xbebc99,_0x3e29('0xf7'));break;case'8':ut[_0x3e29('0xf3')](_0xbebc99,0x8,_0x3e29('0xd2'));rpcDb['createAgentHistory'](_0xbebc99,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x3e29('0xf3')](_0xbebc99,0x16,_0x3e29('0xf8'));rpcDb[_0x3e29('0xf6')](_0xbebc99,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x3e29('0xf3')](_0xbebc99,0xc,_0x1f6aee[_0x3e29('0xf2')]);rpcDb[_0x3e29('0xf6')](_0xbebc99,_0x3e29('0xf9'));}ut[_0x3e29('0x76')](_0x14ddef,'[callProgressDetectingAgent]');logger[_0x3e29('0x57')]('[originated][decrement][callProgressDetectingAgent]',_0xbebc99[_0x3e29('0xbf')],'\x20Queue',_0x14ddef[_0x3e29('0x2a')],_0x3e29('0x6a'),_0x14ddef['originated']);delete this['actions'][_0xbebc99[_0x3e29('0xbf')]];};Preview[_0x3e29('0xe')][_0x3e29('0xfa')]=function(_0x3b0f43,_0x106ae0,_0x4c602a,_0x3dddfd,_0x48a367){var _0xe77a70=this;return new BPromise(function(_0x13dcb7,_0x107082){if(_['isNil'](_0x106ae0)||_[_0x3e29('0x66')](_0x106ae0['Contact'])||_[_0x3e29('0x66')](_0x106ae0[_0x3e29('0xfb')]['phone'])||_[_0x3e29('0x66')](_0x106ae0[_0x3e29('0x6f')])){_0x107082(ut['message'](_0x3e29('0xfc'),_0x3dddfd,_0x48a367));return;}var _0x52ccd6=uuid['v4']();var _0x3c78bd=_0xe77a70[_0x3e29('0x13')][_0x106ae0['Queue']['name']];var _0x18f937=_0x4c602a?_0xe77a70[_0x3e29('0x16')][_0x4c602a]['id']:undefined;_0xe77a70[_0x3e29('0x15')][_0x52ccd6]=new Action(_0x106ae0,_0x3c78bd,_0x52ccd6,_0x4c602a,_0x18f937);var _0x3771e8=_0xe77a70[_0x3e29('0x15')][_0x52ccd6];_0x3771e8[_0x3e29('0xab')]=_0x3dddfd;_0x3771e8[_0x3e29('0xac')]=_0x48a367;_0x3771e8[_0x3e29('0xfd')]=_0x4c602a;if(_[_0x3e29('0xfe')](_0x3b0f43)){_0xe77a70['execCall'](_0x3771e8,_0x3c78bd,_0x106ae0,_0x4c602a)[_0x3e29('0x80')](function(_0x25c08a){logger[_0x3e29('0x57')](_0x3e29('0xff'),_0x3e29('0x100')+_0x3771e8[_0x3e29('0x69')]+_0x3e29('0x101')+_0x3771e8[_0x3e29('0x102')],JSON['stringify'](_0x25c08a));ami[_0x3e29('0x27')](_0x3e29('0x103'),ut[_0x3e29('0xa2')](_0x3771e8,'called',_0xe77a70[_0x3e29('0x13')][_0x3771e8['queue']]));_0x13dcb7(ut['message']('Calling'));})[_0x3e29('0x74')](function(_0x4958f2){ut[_0x3e29('0x5c')](_0x3e29('0x104'),_0x4958f2);_0x107082(ut[_0x3e29('0x4d')](_0x3e29('0x105'),_0x3dddfd,_0x48a367));});}else{_0x3c78bd[_0x3e29('0x3a')]+=0x1;ut[_0x3e29('0x106')](_0x3771e8);rpcDb[_0x3e29('0x107')](_0x3771e8,_0x3e29('0x108'));delete _0xe77a70['actions'][_0x52ccd6];_0x107082(ut['message'](_0x3e29('0x109'),_0x3dddfd,_0x48a367));}});};Preview[_0x3e29('0xe')][_0x3e29('0x98')]=function(_0x29c389){return!_[_0x3e29('0x66')](_0x29c389)&&!_[_0x3e29('0x66')](_0x29c389[_0x3e29('0x2a')])&&!_[_0x3e29('0x66')](_0x29c389[_0x3e29('0x10a')])&&_0x29c389[_0x3e29('0x10a')]&&!_['isNil'](this[_0x3e29('0x14')][util[_0x3e29('0x54')](_0x3e29('0x10b'),_0x29c389[_0x3e29('0x2a')])])&&!_[_0x3e29('0x66')](this[_0x3e29('0x14')][util[_0x3e29('0x54')](_0x3e29('0x10b'),_0x29c389[_0x3e29('0x2a')])][_0x3e29('0x72')])&&(this['trunks'][util[_0x3e29('0x54')](_0x3e29('0x10b'),_0x29c389[_0x3e29('0x2a')])][_0x3e29('0x72')]===_0x3e29('0x10c')||this[_0x3e29('0x14')][util[_0x3e29('0x54')](_0x3e29('0x10b'),_0x29c389[_0x3e29('0x2a')])][_0x3e29('0x72')]==='unmonitored');};Preview[_0x3e29('0xe')][_0x3e29('0x87')]=function(_0x2ad93e,_0x4a4f78){var _0x309aae=this;return new BPromise(function(_0x1084e2,_0x5c84f0){_0x309aae[_0x3e29('0x10d')](_0x2ad93e,_0x4a4f78)[_0x3e29('0x80')](function(_0x39ca23){_0x1084e2(_['pick'](_0x39ca23,[_0x3e29('0x4d')]));})[_0x3e29('0x74')](function(_0x536af3){if(_0x536af3[_0x3e29('0x10e')]){rpcDb['unlockContact'](_0x2ad93e);}if(_0x536af3['active']){rpcDb[_0x3e29('0x8a')](_0x2ad93e);}_0x5c84f0(_[_0x3e29('0x6d')](_0x536af3,[_0x3e29('0x4d')]));});});};Preview[_0x3e29('0xe')][_0x3e29('0x10d')]=function(_0x5820a6,_0x378d49){var _0x53c8b8=this;return new BPromise(function(_0x33e48e,_0x2bf845){var _0x4fdf8d,_0x2545ce;rpcDb['getContactPreview'](_0x5820a6)['then'](function(_0xd366b1){if(!_['isNil'](_0xd366b1[0x0])){_0x2545ce=_0xd366b1[0x0][_0x3e29('0x10f')]?![]:!![];_0x4fdf8d=_0xd366b1[0x0][_0x3e29('0x10f')]?!![]:![];_0x4fdf8d=_0x378d49?!![]:_0x4fdf8d;}var _0x1523df=_0x53c8b8[_0x3e29('0x110')](_0xd366b1);if(_0x1523df[_0x3e29('0x111')]){rpcDb[_0x3e29('0x112')](_[_0x3e29('0x6d')](_0xd366b1[0x0],[_0x3e29('0x6f'),_0x3e29('0x113')]))[_0x3e29('0x80')](function(_0x3c4ebf){_0x53c8b8[_0x3e29('0xfa')](_0x3c4ebf,_0xd366b1[0x0],_0x378d49,_0x2545ce,_0x4fdf8d)[_0x3e29('0x80')](function(_0x330214){_0x33e48e(_0x330214);})['catch'](function(_0x265db2){_0x2bf845(_0x265db2);});})[_0x3e29('0x74')](function(_0xb3fbf){ut['logger'](_0x3e29('0x114'),_0xb3fbf);_0x2bf845(ut[_0x3e29('0x4d')](_0x3e29('0x115'),_0x2545ce,_0x4fdf8d));});}else{_0x2bf845(ut[_0x3e29('0x4d')](_0x1523df[_0x3e29('0x4d')],_0x2545ce,_0x4fdf8d));}})[_0x3e29('0x74')](function(_0x53449e){ut[_0x3e29('0x5c')]('[Preview][getContactPreview]',_0x53449e);_0x2bf845(ut[_0x3e29('0x4d')](_0x3e29('0x115'),![],!![]));});});};Preview['prototype'][_0x3e29('0x110')]=function(_0x5ab4f1){if(_[_0x3e29('0x66')](_0x5ab4f1)||_[_0x3e29('0xfe')](_0x5ab4f1)||!_[_0x3e29('0x66')](_0x5ab4f1[0x0]['Agent'])&&_[_0x3e29('0x66')](_0x5ab4f1[0x0]['Agent']['name'])){ut[_0x3e29('0x5c')](_0x3e29('0x116'),_0x5ab4f1);return{'isValid':![],'message':_0x3e29('0x117')};}var _0x3d5846=this[_0x3e29('0x13')][_0x5ab4f1[0x0][_0x3e29('0x68')][_0x3e29('0x2a')]];_0x3d5846[_0x3e29('0x4d')]=_0x3e29('0x9b');if(_['isNil'](_0x3d5846)){ut[_0x3e29('0x5c')]('[Preview][validateContact][Empty\x20Campaign]',_0x3d5846);return{'isValid':![],'message':_0x3e29('0x118')};}if(!this['isTrunkReachable'](_0x3d5846['Trunk'])){ut[_0x3e29('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x3e29('0x119')+_0x3d5846[_0x3e29('0x2a')]+_0x3e29('0x11a'));if(!this['isTrunkReachable'](_0x3d5846[_0x3e29('0x99')])){ut[_0x3e29('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x3d5846['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x3e29('0x11b')](_0x3d5846[_0x3e29('0x35')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x3d5846[_0x3e29('0x2a')]+_0x3e29('0x11c'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3d5846[_0x3e29('0x2a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x3e29('0x11d')};};Preview[_0x3e29('0xe')][_0x3e29('0x11e')]=function(_0x5040c2,_0x272573,_0x9e613b,_0x562813){var _0x8417e1=this;return new BPromise(function(_0x2e90b7,_0xb48846){var _0x269512=_0x5040c2[_0x3e29('0xbf')];var _0x36839d=_0x8417e1[_0x3e29('0x98')](_0x272573[_0x3e29('0x50')])?util[_0x3e29('0x54')](_0x3e29('0x11f'),_0x272573['Trunk']['name'],_['isNil'](_0x272573['dialPrefix'])?'':_0x272573[_0x3e29('0x120')]['trim']()||'',_0x272573[_0x3e29('0x121')]>0x0?_0x9e613b[_0x3e29('0xfb')][_0x3e29('0x122')]['substring'](_0x272573[_0x3e29('0x121')]):_0x9e613b['Contact'][_0x3e29('0x122')]):util[_0x3e29('0x54')](_0x3e29('0x11f'),_[_0x3e29('0x66')](_0x272573['TrunkBackup'])?_0x272573[_0x3e29('0x50')][_0x3e29('0x2a')]:_0x272573[_0x3e29('0x99')][_0x3e29('0x2a')],_['isNil'](_0x272573[_0x3e29('0x120')])?'':_0x272573[_0x3e29('0x120')][_0x3e29('0x123')]()||'',_0x272573['dialCutDigit']>0x0?_0x9e613b[_0x3e29('0xfb')]['phone'][_0x3e29('0x124')](_0x272573[_0x3e29('0x121')]):_0x9e613b['Contact'][_0x3e29('0x122')]);var _0x35f9be=_0x8417e1[_0x3e29('0x98')](_0x272573['Trunk'])?ut['getCallerId'](_0x272573['Trunk'][_0x3e29('0x51')],_0x272573['dialOriginateCallerIdName'],_0x272573[_0x3e29('0x125')]>0x0?ut['getCallerIdRandom'](_0x272573[_0x3e29('0x126')],_0x272573[_0x3e29('0x125')]):_0x272573[_0x3e29('0x126')]):ut[_0x3e29('0x127')](_[_0x3e29('0x66')](_0x272573['TrunkBackup'])?_0x272573[_0x3e29('0x50')][_0x3e29('0x51')]:_0x272573[_0x3e29('0x99')][_0x3e29('0x51')],_0x272573[_0x3e29('0x37')],_0x272573[_0x3e29('0x125')]>0x0?ut[_0x3e29('0x128')](_0x272573[_0x3e29('0x126')],_0x272573[_0x3e29('0x125')]):_0x272573[_0x3e29('0x126')]);if(_0x35f9be){_0x5040c2[_0x3e29('0x129')]=ut['extractCalleridName'](_0x35f9be);_0x5040c2[_0x3e29('0x12a')]=ut[_0x3e29('0x12b')](_0x35f9be);}var _0x5ba92b=ut[_0x3e29('0x12c')](_0x272573,_0x9e613b,_0x36839d,_0x35f9be,_0x269512,_0x5040c2);_[_0x3e29('0x12d')](_0x5040c2,ut[_0x3e29('0x12e')](_0x5ba92b));_0x5040c2[_0x3e29('0x8b')]=moment()['format'](_0x3e29('0xaf'));ami[_0x3e29('0x71')](ut[_0x3e29('0x12f')](_0x5040c2,_0x272573,_0x5ba92b,_0x5040c2[_0x3e29('0xac')],_0x562813))[_0x3e29('0x80')](function(_0x19f14d){var _0x790b21=_0x5040c2['channelAgent'];if(!_[_0x3e29('0x66')](_0x790b21)){if(!_[_0x3e29('0x66')](_0x8417e1[_0x3e29('0x16')][_0x790b21])){_0x8417e1[_0x3e29('0x16')][_0x790b21][_0x3e29('0x130')]=_0x5040c2[_0x3e29('0x131')];emit(util['format']('user:%s',_0x8417e1[_0x3e29('0x16')][_0x790b21][_0x3e29('0x2a')]),_0x3e29('0x132'),{'destaccountcode':_0x8417e1[_0x3e29('0x16')][_0x790b21][_0x3e29('0x133')],'destconnectedlinenum':_0x5040c2[_0x3e29('0x131')]});}}_0x272573[_0x3e29('0x5a')]+=0x1;logger[_0x3e29('0x57')](_0x3e29('0x134'),_0x269512,_0x3e29('0xb2'),_0x272573[_0x3e29('0x2a')],_0x3e29('0x6a'),_0x272573['originated']);_0x2e90b7(_0x19f14d);})[_0x3e29('0x74')](function(_0x291f86){ut[_0x3e29('0xf3')](_0x5040c2,0xe,_0x3e29('0x135'));rpcDb['createAgentHistory'](_0x5040c2,'[originateFailure][logOriginateFailure]');_0xb48846(_0x291f86);});});};Preview[_0x3e29('0xe')][_0x3e29('0x21')]=function(_0x451060){if(this[_0x3e29('0x15')][_0x451060[_0x3e29('0xad')]]){this[_0x3e29('0x15')][_0x451060[_0x3e29('0xad')]][_0x3e29('0x73')]=_0x451060[_0x3e29('0x73')];}};Preview[_0x3e29('0xe')][_0x3e29('0x19')]=function(_0x4667a3){var _0x582fb4=this;var _0x255d9c=this[_0x3e29('0x15')][_0x4667a3[_0x3e29('0x136')]];if(_0x255d9c){if(_0x255d9c[_0x3e29('0xfd')]&&this[_0x3e29('0x16')][_0x255d9c['lookAgent']]){ut['logLookAgent'](_0x255d9c,this[_0x3e29('0x16')][_0x255d9c[_0x3e29('0xfd')]]['name'],this['agents'][_0x255d9c[_0x3e29('0xfd')]]['id']);}var _0x595eff=_['clone'](_0x255d9c);_0x595eff['responsetime']=moment()[_0x3e29('0x54')]('YYYY-MM-DD\x20HH:mm:ss');var _0x22e8b3=_0x582fb4['campaignsPreview'][_0x255d9c['queue']];if(ut[_0x3e29('0x137')](_0x4667a3['response'])){if(_0x255d9c[_0x3e29('0xab')]){rpcDb[_0x3e29('0x138')](_0x255d9c[_0x3e29('0x102')]);}if(_0x255d9c[_0x3e29('0xac')]){rpcDb[_0x3e29('0x8a')](_0x255d9c[_0x3e29('0x102')]);}ami[_0x3e29('0x27')](_0x3e29('0x139'),ut[_0x3e29('0xa2')](_0x255d9c,_0x3e29('0x13a'),this[_0x3e29('0x13')][_0x255d9c[_0x3e29('0x69')]]));this['callProgressDetectingAgent'](_0x595eff,_0x22e8b3,_0x4667a3);}else{_0x255d9c['starttime']=moment()[_0x3e29('0x54')](_0x3e29('0xaf'));ut[_0x3e29('0xf3')](_0x595eff,0x4,'Answer');rpcDb[_0x3e29('0xf6')](_0x595eff,_0x3e29('0x13b'));}}};Preview[_0x3e29('0xe')][_0x3e29('0x1c')]=function(_0x3a186f){var _0x4c5e96=this;var _0x5d09b7=this['actions'][_0x3a186f[_0x3e29('0xad')]];var _0x531943;if(_0x5d09b7){_0x531943=this[_0x3e29('0x13')][_0x5d09b7[_0x3e29('0x69')]];logger[_0x3e29('0x57')](_0x3e29('0x13c'),_0x3a186f['linkedid'],_0x3e29('0xb2'),_0x531943[_0x3e29('0x2a')],_0x3e29('0x6b'),_0x531943[_0x3e29('0x2e')]);}if(this['actions'][_0x3a186f['linkedid']]&&_0x3a186f[_0x3e29('0xad')]!==_0x3a186f[_0x3e29('0xbf')]){if(_0x3a186f[_0x3e29('0x13d')]==='16'&&this[_0x3e29('0x15')][_0x3a186f[_0x3e29('0xad')]][_0x3e29('0x6c')]){this[_0x3e29('0x9c')](_0x3a186f,_0x3a186f[_0x3e29('0xad')],_0x3a186f[_0x3e29('0x13d')]);}else if(this['actions'][_0x3a186f[_0x3e29('0xad')]][_0x3e29('0x6c')]){logger['info'](_0x3e29('0x13e'),_0x3a186f[_0x3e29('0xad')],_0x3a186f[_0x3e29('0x13d')],_0x3e29('0xb2'),_0x531943[_0x3e29('0x2a')],_0x3e29('0x6b'),_0x531943[_0x3e29('0x2e')]);this[_0x3e29('0x9c')](_0x3a186f,_0x3a186f[_0x3e29('0xad')],_0x3a186f[_0x3e29('0x13d')]);}}else if(_0x5d09b7&&_[_0x3e29('0x66')](_0x5d09b7[_0x3e29('0x13f')])&&_0x531943[_0x3e29('0x140')]&&_0x3a186f['linkedid']===_0x3a186f[_0x3e29('0xbf')]&&_[_0x3e29('0x66')](_0x3a186f[_0x3e29('0xf2')])&&_0x3a186f[_0x3e29('0x13d')]==='16'&&_0x3a186f[_0x3e29('0x141')]==='6'&&_['isUndefined'](_0x5d09b7[_0x3e29('0x142')])){if(_0x5d09b7[_0x3e29('0xab')]){rpcDb[_0x3e29('0x138')](_0x5d09b7['idContact']);}if(_0x5d09b7[_0x3e29('0xac')]){rpcDb[_0x3e29('0x8a')](_0x5d09b7[_0x3e29('0x102')]);}_0x3a186f[_0x3e29('0xf2')]='22';this['callProgressDetectingAgent'](_0x5d09b7,_0x531943,_0x3a186f);}else if(_0x5d09b7&&_0x5d09b7[_0x3e29('0x142')]){if(_0x3a186f[_0x3e29('0x13d')]==='16'&&this['actions'][_0x3a186f[_0x3e29('0xad')]][_0x3e29('0x6c')]){logger[_0x3e29('0x57')](_0x3e29('0x143'),_0x3a186f['linkedid'],_0x3a186f['cause'],_0x3e29('0xb2'),_0x531943[_0x3e29('0x2a')],'pTalking:\x20',_0x531943[_0x3e29('0x2e')]);this['callProgressDetectingCustomer'](_0x3a186f,_0x3a186f[_0x3e29('0xad')],_0x3a186f[_0x3e29('0x13d')]);}else if(this['actions'][_0x3a186f[_0x3e29('0xad')]][_0x3e29('0x6c')]){logger[_0x3e29('0x57')]('[syncHangup][talking][cause]',_0x3a186f[_0x3e29('0xad')],_0x3a186f[_0x3e29('0x13d')],'\x20Queue',_0x531943[_0x3e29('0x2a')],_0x3e29('0x6b'),_0x531943[_0x3e29('0x2e')]);this[_0x3e29('0x9c')](_0x3a186f,_0x3a186f[_0x3e29('0xad')],_0x3a186f[_0x3e29('0x13d')]);}}};Preview[_0x3e29('0xe')][_0x3e29('0x20')]=function(_0x2a2417){if(this[_0x3e29('0x15')][_0x2a2417['destlinkedid']]&&_0x2a2417[_0x3e29('0xef')]!==_0x2a2417[_0x3e29('0x144')]){this[_0x3e29('0x9c')](_0x2a2417,_0x2a2417[_0x3e29('0xef')],_0x2a2417[_0x3e29('0xe9')]);}};Preview[_0x3e29('0xe')][_0x3e29('0x1e')]=function(_0x3ec050){if(this[_0x3e29('0x15')][_0x3ec050[_0x3e29('0xad')]]&&_0x3ec050[_0x3e29('0xad')]!==_0x3ec050[_0x3e29('0xbf')]&&!this[_0x3e29('0x15')][_0x3ec050[_0x3e29('0xad')]]['dialAnswer']){if(_0x3ec050['cause']==='1'){this['callProgressDetectingCustomer'](_0x3ec050,_0x3ec050[_0x3e29('0xad')],_0x3ec050['cause']);}}};Preview[_0x3e29('0xe')][_0x3e29('0x145')]=function(_0xc06729,_0xbd9e47,_0x473bcc){if(this[_0x3e29('0x15')][_0xc06729]){if(_[_0x3e29('0x66')](this['actions'][_0xc06729][_0x3e29('0x146')])){this[_0x3e29('0x15')][_0xc06729]['variables']={};}this[_0x3e29('0x15')][_0xc06729][_0x3e29('0x146')][_0xbd9e47]=_0x473bcc;}};Preview[_0x3e29('0xe')][_0x3e29('0x147')]=function(_0x36e5d6){try{if(!_[_0x3e29('0x66')](_0x36e5d6)){if(ut[_0x3e29('0x148')](_[_0x3e29('0x149')](_0x36e5d6[_0x3e29('0x14a')])[0x0])){this[_0x3e29('0x145')](_0x36e5d6[_0x3e29('0xbf')],_[_0x3e29('0x149')](_0x36e5d6[_0x3e29('0x14a')])[0x0],_0x36e5d6[_0x3e29('0x14b')]);}}}catch(_0x5db5f7){logger[_0x3e29('0x14c')](_0x3e29('0x14d'),util[_0x3e29('0x14e')](_0x5db5f7,{'showHidden':![],'depth':null}));}};Preview[_0x3e29('0xe')][_0x3e29('0x23')]=function(_0x4904ab){if(_0x4904ab){if(this[_0x3e29('0x15')][_0x4904ab['transfertargetlinkedid']]){this[_0x3e29('0x15')][_0x4904ab[_0x3e29('0x14f')]]['transfer']=!![];}}};Preview[_0x3e29('0xe')][_0x3e29('0x25')]=function(_0x20775a){if(_0x20775a){if(this[_0x3e29('0x15')][_0x20775a['transfererlinkedid']]){this['actions'][_0x20775a[_0x3e29('0x150')]][_0x3e29('0x142')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x95ef=['voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','setMessage','clearZombieChannel','isNil','Queue','queue','originated:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','disableContact','starttime','logCustomer','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','buildObj','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','pTalking:\x20','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','CANCEL','AgentReject','custom:agentreject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','run','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','phone','dialCutDigit','trim','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','[originateFailure][logOriginateFailure]','channel','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','socket.io-emitter','prototype','enqueue','tail','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','campaignsPreview','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s'];(function(_0x3c0e0f,_0x78214c){var _0x27cad8=function(_0xa979d5){while(--_0xa979d5){_0x3c0e0f['push'](_0x3c0e0f['shift']());}};_0x27cad8(++_0x78214c);}(_0x95ef,0xfb));var _0xf95e=function(_0xd9f857,_0x34ce2d){_0xd9f857=_0xd9f857-0x0;var _0x54f6a8=_0x95ef[_0xd9f857];return _0x54f6a8;};'use strict';var util=require(_0xf95e('0x0'));var _=require(_0xf95e('0x1'));var BPromise=require(_0xf95e('0x2'));var uuid=require(_0xf95e('0x3'));var moment=require('moment');var md5=require(_0xf95e('0x4'));var Redis=require(_0xf95e('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf95e('0x6'));var loggerAction=require('../../../config/logger')(_0xf95e('0x7'));var ami=require('../ami');var rpcDb=require(_0xf95e('0x8'));var Action=require(_0xf95e('0x9'));var ut=require(_0xf95e('0xa'));config[_0xf95e('0xb')]=_[_0xf95e('0xc')](config[_0xf95e('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xf95e('0xd'))(new Redis(config[_0xf95e('0xb')]));var Sequence=function(){};Sequence[_0xf95e('0xe')][_0xf95e('0xf')]=function(_0x194fa4){this[_0xf95e('0x10')]=this['tail']?this[_0xf95e('0x10')]['finally'](_0x194fa4):_0x194fa4();};function Preview(_0x349143){this[_0xf95e('0x11')]=new Sequence();this['campaignsPreview']=_0x349143[_0xf95e('0x12')];this[_0xf95e('0x13')]=_0x349143['trunks'];this[_0xf95e('0x14')]={};this[_0xf95e('0x15')]=_0x349143['agents'];this[_0xf95e('0x16')]=0x0;ami['on'](_0xf95e('0x17'),this['syncOriginateResponse'][_0xf95e('0x18')](this));ami['on'](_0xf95e('0x19'),this[_0xf95e('0x1a')][_0xf95e('0x18')](this));ami['on'](_0xf95e('0x1b'),this[_0xf95e('0x1c')][_0xf95e('0x18')](this));ami['on'](_0xf95e('0x1d'),this[_0xf95e('0x1e')][_0xf95e('0x18')](this));ami['on']('newexten',this[_0xf95e('0x1f')][_0xf95e('0x18')](this));ami['on'](_0xf95e('0x20'),this[_0xf95e('0x21')][_0xf95e('0x18')](this));ami['on'](_0xf95e('0x22'),this[_0xf95e('0x23')][_0xf95e('0x18')](this));ami['on']('blindtransfer',this[_0xf95e('0x24')][_0xf95e('0x18')](this));this['loopCampaigns'](this[_0xf95e('0x25')]);}function emit(_0x3c27b9,_0x439107,_0x1a749c){io['to'](_0x3c27b9)['emit'](_0x439107,_0x1a749c);}function emitCampaignPreview(_0x52b695){if(_0x52b695['type']===_0xf95e('0x26')){var _0x59ba99={'id':_0x52b695['id'],'name':_0x52b695[_0xf95e('0x27')],'strategy':_0x52b695[_0xf95e('0x28')],'answered':_0x52b695[_0xf95e('0x29')],'available':_0x52b695['available'],'loggedIn':_0x52b695[_0xf95e('0x2a')],'pTalking':_0x52b695[_0xf95e('0x2b')],'sumBillable':_0x52b695[_0xf95e('0x2c')],'sumDuration':_0x52b695[_0xf95e('0x2d')],'sumHoldTime':_0x52b695[_0xf95e('0x2e')]||0x0,'talking':_0x52b695[_0xf95e('0x2f')],'total':_0x52b695[_0xf95e('0x30')],'type':_0x52b695[_0xf95e('0x31')],'unmanaged':_0x52b695[_0xf95e('0x32')],'abandoned':_0x52b695[_0xf95e('0x33')],'waiting':_0x52b695[_0xf95e('0x34')],'loggedInDb':_0x52b695[_0xf95e('0x35')],'dialActive':_0x52b695[_0xf95e('0x36')],'dialMethod':_0x52b695[_0xf95e('0x37')],'dialOriginateCallerIdName':_0x52b695[_0xf95e('0x38')],'dialOriginateCallerIdNumber':_0x52b695[_0xf95e('0x39')],'dialOriginateTimeout':_0x52b695[_0xf95e('0x3a')],'dialPrefix':_0x52b695[_0xf95e('0x3b')],'outboundAnswerAgiCallsDay':_0x52b695[_0xf95e('0x3c')],'outboundAnswerCallsDay':_0x52b695[_0xf95e('0x3d')],'outboundBlacklistCallsDay':_0x52b695[_0xf95e('0x3e')],'outboundBusyCallsDay':_0x52b695[_0xf95e('0x3f')],'outboundCongestionCallsDay':_0x52b695[_0xf95e('0x40')],'outboundDropCallsDayACS':_0x52b695['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x52b695[_0xf95e('0x41')],'outboundDropCallsDayTimeout':_0x52b695[_0xf95e('0x42')],'outboundNoAnswerCallsDay':_0x52b695[_0xf95e('0x43')],'outboundNoSuchCallsDay':_0x52b695['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x52b695['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x52b695[_0xf95e('0x44')],'outboundRejectCallsDay':_0x52b695[_0xf95e('0x45')],'outboundUnknownCallsDay':_0x52b695['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x52b695[_0xf95e('0x46')],'predictiveIntervalAnsweredCalls':_0x52b695[_0xf95e('0x47')],'predictiveIntervalAvgHoldtime':_0x52b695[_0xf95e('0x48')],'predictiveIntervalAvgTalktime':_0x52b695[_0xf95e('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x52b695[_0xf95e('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x52b695[_0xf95e('0x4b')],'predictiveIntervalErlangCalls':_0x52b695[_0xf95e('0x4c')],'predictiveIntervalErlangCallsDroppedCalls':_0x52b695[_0xf95e('0x4d')],'predictiveIntervalHitRate':_0x52b695[_0xf95e('0x4e')],'predictiveIntervalMultiplicativeFactor':_0x52b695[_0xf95e('0x4f')],'predictiveIntervalPauses':_0x52b695[_0xf95e('0x50')],'predictiveIntervalAvailable':_0x52b695[_0xf95e('0x51')],'predictiveIntervalTotalCalls':_0x52b695['predictiveIntervalTotalCalls'],'message':_0x52b695[_0xf95e('0x52')],'originated':_0x52b695[_0xf95e('0x53')],'erlangCalls':_0x52b695[_0xf95e('0x54')],'erlangCallToSecond':_0x52b695['erlangCallToSecond'],'erlangAbandonmentRate':_0x52b695[_0xf95e('0x55')],'erlangBusyFactor':_0x52b695[_0xf95e('0x56')],'startPredictive':_0x52b695[_0xf95e('0x57')],'startProgressive':_0x52b695[_0xf95e('0x58')]};if(_0x52b695[_0xf95e('0x59')]){_0x59ba99[_0xf95e('0x59')]={'id':_0x52b695[_0xf95e('0x59')]['id'],'name':_0x52b695[_0xf95e('0x59')]['name'],'active':_0x52b695['Trunk'][_0xf95e('0x5a')],'callerid':_0x52b695[_0xf95e('0x59')][_0xf95e('0x5b')]};}if(_0x52b695[_0xf95e('0x5c')]){_0x59ba99[_0xf95e('0x5c')]={'id':_0x52b695[_0xf95e('0x5c')]['id'],'name':_0x52b695['Interval'][_0xf95e('0x27')]};}var _0x26cc75=md5(JSON[_0xf95e('0x5d')](_0x59ba99));if(_0x52b695[_0xf95e('0x4')]!==_0x26cc75){_0x52b695[_0xf95e('0x4')]=_0x26cc75;emit(util[_0xf95e('0x5e')](_0xf95e('0x5f'),_0x59ba99[_0xf95e('0x27')]),_0xf95e('0x60'),_0x59ba99);}}}function emitVoiceQueueChannelRemove(_0x4e49fc){logger[_0xf95e('0x61')](_0xf95e('0x62'),JSON['stringify'](_0x4e49fc));emit(util['format']('voice:queue:%s',_0x4e49fc[_0xf95e('0x27')]),_0xf95e('0x63'),_0x4e49fc);io[_0xf95e('0x64')](_0xf95e('0x65'),_0x4e49fc);}function notSendMessagesQueue(_0x22e295){if(_0x22e295[_0xf95e('0x66')]){if(_0x22e295[_0xf95e('0x53')]===0x0&&_0x22e295[_0xf95e('0x2b')]===0x0){_0x22e295['sendMessageOneNotActive']=![];_0x22e295[_0xf95e('0x67')]=0x0;_0x22e295[_0xf95e('0x68')]=0x0;_0x22e295['message']=_0xf95e('0x69');ut[_0xf95e('0x6a')](_0xf95e('0x6b'),_0x22e295['name']+_0xf95e('0x6c'));}else{_0x22e295[_0xf95e('0x52')]=_0xf95e('0x6d');ut[_0xf95e('0x6a')](_0xf95e('0x6b'),_0x22e295[_0xf95e('0x27')]+_0xf95e('0x6e'));}emitCampaignPreview(_0x22e295);}}Preview[_0xf95e('0xe')]['loopCampaigns']=function(){var _0x3d8b5a=this;setInterval(function(){_0x3d8b5a[_0xf95e('0x6f')]();},0x7cf);};Preview['prototype'][_0xf95e('0x6f')]=function(){var _0x196152=this[_0xf95e('0x25')];this[_0xf95e('0x16')]+=0x1;for(var _0x13916c in _0x196152){if(_0x196152[_0xf95e('0x70')](_0x13916c)&&(_0x196152[_0x13916c]['dialMethod']===_0xf95e('0x6')||_0x196152[_0x13916c]['dialMethod']===_0xf95e('0x71'))&&_0x196152[_0x13916c][_0xf95e('0x31')]==='outbound'){if(this[_0xf95e('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x196152[_0xf95e('0x70')](_0x13916c)&&_0x196152[_0x13916c][_0xf95e('0x37')]==='preview'&&_0x196152[_0x13916c]['type']===_0xf95e('0x26')){if(_0x196152[_0x13916c][_0xf95e('0x36')]){this[_0xf95e('0x72')](_0x196152[_0x13916c]);this['recallMe'](_0x196152[_0x13916c]);}else{notSendMessagesQueue(_0x196152[_0x13916c]);}}}};Preview['prototype'][_0xf95e('0x73')]=function(_0x554432){var _0x4dc80a=this;this[_0xf95e('0x11')][_0xf95e('0xf')](function(){if(!_[_0xf95e('0x74')](_0x4dc80a[_0xf95e('0x14')][_0x554432])){loggerAction[_0xf95e('0x61')]('[clearZombieChannels][talking]',_0x554432,_0xf95e('0x75'),_0x4dc80a['actions'][_0x554432][_0xf95e('0x76')],_0xf95e('0x77'),JSON[_0xf95e('0x5d')](_0x4dc80a['campaignsPreview'][_0x4dc80a[_0xf95e('0x14')][_0x554432][_0xf95e('0x76')]][_0xf95e('0x53')]),'pTalking:\x20',JSON[_0xf95e('0x5d')](_0x4dc80a[_0xf95e('0x25')][_0x4dc80a[_0xf95e('0x14')][_0x554432][_0xf95e('0x76')]]['pTalking']),JSON[_0xf95e('0x5d')](_0x4dc80a[_0xf95e('0x14')][_0x554432][_0xf95e('0x78')]),JSON[_0xf95e('0x5d')](_[_0xf95e('0x79')](_0x4dc80a['actions'][_0x554432],[_0xf95e('0x7a'),'UserId',_0xf95e('0x7b'),_0xf95e('0x7c')])));return ami[_0xf95e('0x7d')]({'action':'status','channel':_0x4dc80a['actions'][_0x554432]['channel']})[_0xf95e('0x7e')](function(_0xc36611){if(_0xc36611['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x4dc80a[_0xf95e('0x14')][_0x554432]){ut[_0xf95e('0x7f')](_0x4dc80a[_0xf95e('0x25')][_0x4dc80a[_0xf95e('0x14')][_0x554432][_0xf95e('0x76')]],_0xf95e('0x80'));if(_0x4dc80a['actions'][_0x554432][_0xf95e('0x78')]===!![]){ut[_0xf95e('0x81')](_0x4dc80a[_0xf95e('0x25')][_0x4dc80a[_0xf95e('0x14')][_0x554432][_0xf95e('0x76')]],_0xf95e('0x80'));ut[_0xf95e('0x82')](_0xf95e('0x83')+_0x554432,_0x4dc80a[_0xf95e('0x14')][_0x554432][_0xf95e('0x76')]);}ut[_0xf95e('0x82')](_0xf95e('0x84')+_0x554432,_0x4dc80a[_0xf95e('0x14')][_0x554432]['queue']);delete _0x4dc80a[_0xf95e('0x14')][_0x554432];}},0x2328);}});}});};Preview[_0xf95e('0xe')][_0xf95e('0x85')]=function(){var _0x5a0d95=this;loggerAction['info'](_0xf95e('0x86'),_['size'](this[_0xf95e('0x14')]));for(var _0x20b479 in this['actions']){if(_0x5a0d95['actions'][_0xf95e('0x70')](_0x20b479)){_0x5a0d95[_0xf95e('0x73')](_0x20b479);}}};Preview[_0xf95e('0xe')]['recallMe']=function(_0x395606){var _0x5a52d2=this;rpcDb['getContactRecallMe'](_0x395606['id'],ut[_0xf95e('0x87')](this[_0xf95e('0x15')]))['then'](function(_0x42c9b8){if(!_[_0xf95e('0x74')](_0x42c9b8)){for(var _0x540e2f=0x0;_0x540e2f<_0x42c9b8[_0xf95e('0x88')];_0x540e2f+=0x1){if(ut[_0xf95e('0x89')](_0x42c9b8[_0x540e2f][_0xf95e('0x8a')])<_0x395606[_0xf95e('0x8b')]*0x3c){if(_0x42c9b8[_0x540e2f][_0xf95e('0x8c')]&&!_0x42c9b8[_0x540e2f][_0xf95e('0x8c')][_0xf95e('0x8d')]){_0x5a52d2['run'](_0x42c9b8[_0x540e2f]['id'])[_0xf95e('0x8e')](ut[_0xf95e('0x8f')]('[RecallMe]'))[_0xf95e('0x7e')](ut['logger2'](_0xf95e('0x90')));}else{rpcDb[_0xf95e('0x91')](_0x42c9b8[_0x540e2f]['id']);}}else{var _0x43e2c0=new Action(_0x42c9b8[_0x540e2f],_0x395606);_0x43e2c0[_0xf95e('0x92')]=moment()[_0xf95e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x395606[_0xf95e('0x44')]+=0x1;ut[_0xf95e('0x93')](_0x43e2c0,0x17,'RecallInQueue');if(_0x395606['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0xf95e('0x94')](_0x42c9b8[_0x540e2f]));rpcDb[_0xf95e('0x95')](_0x43e2c0,_0xf95e('0x96'));}else{ut[_0xf95e('0x93')](_0x43e2c0,0x16,_0xf95e('0x97'));rpcDb[_0xf95e('0x95')](_0x43e2c0,'[HistoryRecallClose]');rpcDb[_0xf95e('0x98')](_0x43e2c0,_0xf95e('0x99'));}}}}})[_0xf95e('0x7e')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xf95e('0xe')]['setMessage']=function(_0x1c3536){_0x1c3536[_0xf95e('0x66')]=!![];if(ut['IsNotLoggedIn'](_0x1c3536['loggedIn'])){_0x1c3536[_0xf95e('0x52')]=_0xf95e('0x9a');}else if(!ut['isActive'](_0x1c3536[_0xf95e('0x36')])){_0x1c3536[_0xf95e('0x52')]=_0xf95e('0x69');}else if(!this['isTrunkReachable'](_0x1c3536[_0xf95e('0x59')])){if(!this[_0xf95e('0x9b')](_0x1c3536['TrunkBackup'])){_0x1c3536[_0xf95e('0x52')]=_0xf95e('0x9c');}else{_0x1c3536[_0xf95e('0x52')]=_0xf95e('0x9d');}}else{_0x1c3536[_0xf95e('0x52')]=_0xf95e('0x9d');}emitCampaignPreview(_0x1c3536);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x1eecba,_0x39fd07,_0x110d4a){var _0x3bb62b=this;var _0x5f553d=this[_0xf95e('0x14')][_0x39fd07];var _0x56cdcd=this['campaignsPreview'][_0x5f553d['queue']];var _0x449ed5;if(_0x56cdcd){switch(_0x110d4a){case'1':_0x56cdcd['outboundNoSuchCallsDay']+=0x1;_0x5f553d[_0xf95e('0x9e')]+=0x1;_0x5f553d[_0xf95e('0x9f')]=ut['totalGlobal'](_0x5f553d);ut['logCustomer'](_0x5f553d,0x0,'NoSuchNumber');ami[_0xf95e('0x64')]('custom:agentnosuchnumber',ut[_0xf95e('0xa0')](_0x5f553d,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x5f553d,_0xf95e('0xa1'));if(ut[_0xf95e('0xa2')](_0x5f553d)>=_0x56cdcd[_0xf95e('0xa3')]){_0x449ed5=ut['cloneAction'](_0x5f553d,0xf,_0xf95e('0xa4'));rpcDb['createCustomerFinal'](_0x449ed5,_0xf95e('0xa5'));}else{if(_0x5f553d[_0xf95e('0x9e')]>=_0x56cdcd[_0xf95e('0xa6')]){rpcDb[_0xf95e('0x98')](_0x5f553d,_0xf95e('0xa5'));}else{rpcDb[_0xf95e('0xa7')](ut['scheduledAt'](_0x5f553d,_0xf95e('0x9e'),_0x56cdcd[_0xf95e('0xa8')]),_0x5f553d[_0xf95e('0xa9')],_0x5f553d[_0xf95e('0xaa')]);}}delete this[_0xf95e('0x14')][_0x1eecba[_0xf95e('0xab')]];break;case _0xf95e('0xac'):var _0x440c16=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5f553d[_0xf95e('0xad')]=_0x440c16;_0x5f553d[_0xf95e('0xae')]=_0x440c16;_0x5f553d[_0xf95e('0x78')]=!![];_0x56cdcd[_0xf95e('0x2b')]+=0x1;logger[_0xf95e('0x61')]('[syncHangup][talking][increment]',_0x5f553d[_0xf95e('0xaf')],_0xf95e('0xb0'),_0x56cdcd[_0xf95e('0x27')],_0xf95e('0xb1'),_0x56cdcd[_0xf95e('0x2b')]);ami[_0xf95e('0x64')]('custom:agentconnect',ut[_0xf95e('0xa0')](_0x5f553d,_0xf95e('0xb2'),this['campaignsPreview'][_0x5f553d[_0xf95e('0x76')]]));if(_0x56cdcd[_0xf95e('0xb3')]){ami['emit'](_0xf95e('0xb4'),ut[_0xf95e('0xb5')](_0x5f553d));}break;case'16':ami[_0xf95e('0x64')]('custom:agentcomplete',ut[_0xf95e('0xa0')](_0x5f553d,_0xf95e('0xb6'),this[_0xf95e('0x25')][_0x5f553d[_0xf95e('0x76')]]));emitVoiceQueueChannelRemove(ut[_0xf95e('0xa0')](_0x5f553d,'complete'));_0x56cdcd[_0xf95e('0x3d')]+=0x1;_0x56cdcd[_0xf95e('0x30')]+=0x1;_0x56cdcd[_0xf95e('0x29')]+=0x1;ut[_0xf95e('0x81')](_0x56cdcd,_0xf95e('0xb7'));_0x5f553d[_0xf95e('0x9f')]=ut[_0xf95e('0xa2')](_0x5f553d);ut[_0xf95e('0x93')](_0x5f553d,0x4,'Answer');rpcDb[_0xf95e('0x95')](_0x5f553d,_0xf95e('0xb8'));rpcDb[_0xf95e('0x98')](_0x5f553d,_0xf95e('0xb9'));rpcDb[_0xf95e('0xba')](_0x5f553d);_0x56cdcd[_0xf95e('0x2d')]+=_0x5f553d['talktime'];_0x56cdcd[_0xf95e('0x2c')]+=_0x5f553d[_0xf95e('0xbb')];logger['info'](_0xf95e('0xbc'),_0x5f553d[_0xf95e('0xaf')],_0xf95e('0xb0'),_0x56cdcd[_0xf95e('0x27')],_0xf95e('0xb1'),_0x56cdcd[_0xf95e('0x2b')]);delete this[_0xf95e('0x14')][_0x1eecba[_0xf95e('0xab')]];break;case _0xf95e('0xbd'):_0x56cdcd[_0xf95e('0x3f')]+=0x1;_0x5f553d[_0xf95e('0xbe')]+=0x1;_0x5f553d[_0xf95e('0x9f')]=ut[_0xf95e('0xa2')](_0x5f553d);ut[_0xf95e('0x93')](_0x5f553d,0x5,_0xf95e('0xbf'));ami[_0xf95e('0x64')](_0xf95e('0xc0'),ut[_0xf95e('0xa0')](_0x5f553d,_0xf95e('0xc1')));rpcDb[_0xf95e('0x95')](_0x5f553d,_0xf95e('0xc2'));if(ut['totalGlobal'](_0x5f553d)>=_0x56cdcd[_0xf95e('0xa3')]){_0x449ed5=ut['cloneAction'](_0x5f553d,0xf,_0xf95e('0xa4'));rpcDb['createCustomerFinal'](_0x449ed5,_0xf95e('0xc3'));}else{if(_0x5f553d[_0xf95e('0xbe')]>=_0x56cdcd[_0xf95e('0xc4')]){rpcDb[_0xf95e('0x98')](_0x5f553d,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xf95e('0xa7')](ut[_0xf95e('0xc5')](_0x5f553d,_0xf95e('0xbe'),_0x56cdcd['dialBusyRetryFrequency']),_0x5f553d[_0xf95e('0xa9')],_0x5f553d[_0xf95e('0xaa')]);}}break;case _0xf95e('0xc6'):_0x56cdcd['outboundNoAnswerCallsDay']+=0x1;_0x5f553d[_0xf95e('0xc7')]+=0x1;_0x5f553d['countglobal']=ut[_0xf95e('0xa2')](_0x5f553d);ut[_0xf95e('0x93')](_0x5f553d,0x3,_0xf95e('0xc8'));ami[_0xf95e('0x64')]('custom:agentnoanswer',ut[_0xf95e('0xa0')](_0x5f553d,_0xf95e('0xc9')));rpcDb[_0xf95e('0x95')](_0x5f553d,_0xf95e('0xca'));if(ut['totalGlobal'](_0x5f553d)>=_0x56cdcd['dialGlobalMaxRetry']){_0x449ed5=ut[_0xf95e('0xcb')](_0x5f553d,0xf,_0xf95e('0xa4'));rpcDb[_0xf95e('0x98')](_0x449ed5,_0xf95e('0xcc'));}else{if(_0x5f553d['countnoanswerretry']>=_0x56cdcd[_0xf95e('0xcd')]){rpcDb[_0xf95e('0x98')](_0x5f553d,_0xf95e('0xca'));}else{rpcDb['rescheduleContact'](ut[_0xf95e('0xc5')](_0x5f553d,'countnoanswerretry',_0x56cdcd['dialNoAnswerRetryFrequency']),_0x5f553d[_0xf95e('0xa9')],_0x5f553d[_0xf95e('0xaa')]);}}break;case'CONGESTION':_0x56cdcd['outboundCongestionCallsDay']+=0x1;_0x5f553d[_0xf95e('0xce')]+=0x1;_0x5f553d['countglobal']=ut[_0xf95e('0xa2')](_0x5f553d);ut[_0xf95e('0x93')](_0x5f553d,0x8,_0xf95e('0xcf'));ami['emit'](_0xf95e('0xd0'),ut[_0xf95e('0xa0')](_0x5f553d,_0xf95e('0xd1')));rpcDb[_0xf95e('0x95')](_0x5f553d,_0xf95e('0xd2'));if(ut[_0xf95e('0xa2')](_0x5f553d)>=_0x56cdcd[_0xf95e('0xa3')]){_0x449ed5=ut[_0xf95e('0xcb')](_0x5f553d,0xf,_0xf95e('0xa4'));rpcDb[_0xf95e('0x98')](_0x449ed5,_0xf95e('0xd3'));}else{if(_0x5f553d['countcongestionretry']>=_0x56cdcd['dialCongestionMaxRetry']){rpcDb[_0xf95e('0x98')](_0x5f553d,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xf95e('0xa7')](ut['scheduledAt'](_0x5f553d,_0xf95e('0xce'),_0x56cdcd[_0xf95e('0xd4')]),_0x5f553d[_0xf95e('0xa9')],_0x5f553d[_0xf95e('0xaa')]);}}break;case _0xf95e('0xd5'):_0x56cdcd['outboundRejectCallsDay']+=0x1;_0x5f553d['countagentrejectretry']+=0x1;_0x5f553d[_0xf95e('0x9f')]=ut[_0xf95e('0xa2')](_0x5f553d);ut[_0xf95e('0x93')](_0x5f553d,0x14,_0xf95e('0xd6'));ami[_0xf95e('0x64')](_0xf95e('0xd7'),ut[_0xf95e('0xa0')](_0x5f553d,'agentreject'));rpcDb[_0xf95e('0x95')](_0x5f553d,'[syncHangupRequest][logAgentReject]');if(ut[_0xf95e('0xa2')](_0x5f553d)>=_0x56cdcd['dialGlobalMaxRetry']){_0x449ed5=ut[_0xf95e('0xcb')](_0x5f553d,0x14,'AgentReject');rpcDb[_0xf95e('0x98')](_0x449ed5,_0xf95e('0xd8'));}else{if(_0x5f553d[_0xf95e('0xd9')]>=_0x56cdcd[_0xf95e('0xda')]){rpcDb['createCustomerFinal'](_0x5f553d,_0xf95e('0xd8'));}else{rpcDb[_0xf95e('0xa7')](ut[_0xf95e('0xc5')](_0x5f553d,'countagentrejectretry',_0x56cdcd[_0xf95e('0xdb')]),_0x5f553d[_0xf95e('0xa9')],_0x5f553d[_0xf95e('0xaa')]);}}break;case _0xf95e('0xdc'):_0x56cdcd[_0xf95e('0x46')]+=0x1;_0x5f553d[_0xf95e('0xdd')]+=0x1;_0x5f553d[_0xf95e('0x9f')]=ut[_0xf95e('0xa2')](_0x5f553d);ut[_0xf95e('0x93')](_0x5f553d,0xb,_0xf95e('0xde'));rpcDb[_0xf95e('0x95')](_0x5f553d,_0xf95e('0xdf'));if(ut['totalGlobal'](_0x5f553d)>=_0x56cdcd[_0xf95e('0xa3')]){_0x449ed5=ut[_0xf95e('0xcb')](_0x5f553d,0xf,_0xf95e('0xa4'));rpcDb[_0xf95e('0x98')](_0x449ed5,_0xf95e('0xdf'));}else{if(_0x5f553d['countabandonedetry']>=_0x56cdcd[_0xf95e('0xe0')]){rpcDb[_0xf95e('0x98')](_0x5f553d,_0xf95e('0xdf'));}else{rpcDb['rescheduleContact'](ut[_0xf95e('0xc5')](_0x5f553d,_0xf95e('0xdd'),_0x56cdcd['dialAbandonedRetryFrequency']),_0x5f553d[_0xf95e('0xa9')],_0x5f553d[_0xf95e('0xaa')]);}}break;case'18':_0x56cdcd[_0xf95e('0xe1')]+=0x1;_0x5f553d[_0xf95e('0xe2')]+=0x1;_0x5f553d[_0xf95e('0x9f')]=ut[_0xf95e('0xa2')](_0x5f553d);ut['logCustomer'](_0x5f553d,0x12,_0x1eecba[_0xf95e('0xe3')]||_0x1eecba[_0xf95e('0xe4')]);ami['emit'](_0xf95e('0xe5'),ut['buildObj'](_0x5f553d,'amd'));rpcDb[_0xf95e('0x95')](_0x5f553d,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xf95e('0xa2')](_0x5f553d)>=_0x56cdcd[_0xf95e('0xa3')]){_0x449ed5=ut[_0xf95e('0xcb')](_0x5f553d,0xf,_0xf95e('0xa4'));rpcDb[_0xf95e('0x98')](_0x449ed5,_0xf95e('0xe6'));}else{rpcDb[_0xf95e('0x98')](_0x5f553d,_0xf95e('0xe6'));}delete this[_0xf95e('0x14')][_0x1eecba[_0xf95e('0xab')]];break;case'19':_0x56cdcd[_0xf95e('0xe1')]+=0x1;_0x5f553d[_0xf95e('0x9f')]=ut[_0xf95e('0xa2')](_0x5f553d);ut[_0xf95e('0x93')](_0x5f553d,0x13,_0x1eecba['cause-txt']||_0x1eecba[_0xf95e('0xe4')]);ami[_0xf95e('0x64')](_0xf95e('0xe5'),ut[_0xf95e('0xa0')](_0x5f553d,_0xf95e('0xe7')));rpcDb[_0xf95e('0x95')](_0x5f553d,'[callProgressDetectingCustomer][machine]');if(ut[_0xf95e('0xa2')](_0x5f553d)>=_0x56cdcd['dialGlobalMaxRetry']){_0x449ed5=ut[_0xf95e('0xcb')](_0x5f553d,0xf,_0xf95e('0xa4'));rpcDb[_0xf95e('0x98')](_0x449ed5,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x5f553d,_0xf95e('0xe8'));}delete this['actions'][_0x1eecba[_0xf95e('0xab')]];break;default:if(_0x5f553d[_0xf95e('0x78')]){ut[_0xf95e('0x81')](_0x56cdcd,'[default]');ut[_0xf95e('0x82')](_0xf95e('0xe9')+_0x56cdcd[_0xf95e('0x27')],_0x1eecba);}_0x56cdcd[_0xf95e('0xe1')]+=0x1;_0x5f553d[_0xf95e('0x9f')]=ut[_0xf95e('0xa2')](_0x5f553d);ut['logCustomer'](_0x5f553d,0xc,_0x1eecba[_0xf95e('0xe3')]||_0x1eecba[_0xf95e('0xe4')]);rpcDb['createCustomerHistory'](_0x5f553d,_0xf95e('0xea'));if(ut[_0xf95e('0xa2')](_0x5f553d)>=_0x56cdcd['dialGlobalMaxRetry']){_0x449ed5=ut[_0xf95e('0xcb')](_0x5f553d,0xf,_0xf95e('0xa4'));rpcDb[_0xf95e('0x98')](_0x449ed5,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xf95e('0x98')](_0x5f553d,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xf95e('0x14')][_0x1eecba[_0xf95e('0xab')]];}if(!(_0x5f553d[_0xf95e('0x78')]&&_0x110d4a==='16')){ut[_0xf95e('0x7f')](_0x56cdcd,_0xf95e('0xeb'));logger[_0xf95e('0x61')](_0xf95e('0xec'),_0x5f553d[_0xf95e('0xaf')],_0xf95e('0xb0'),_0x56cdcd[_0xf95e('0x27')],'originated:\x20',_0x56cdcd[_0xf95e('0x53')]);}if(_0x110d4a!==_0xf95e('0xac')){delete this[_0xf95e('0x14')][_0x1eecba[_0xf95e('0xab')]];delete this[_0xf95e('0x14')][_0x1eecba[_0xf95e('0xed')]];}}};Preview[_0xf95e('0xe')][_0xf95e('0xee')]=function(_0x15d343,_0x286c5a,_0xe46d3f){if(_[_0xf95e('0xef')](_0x286c5a)&&_0xf95e('0xf0')!==typeof _0x286c5a){return;}if(_[_0xf95e('0xef')](_0xe46d3f)&&_0xf95e('0xf0')!==typeof _0xe46d3f){return;}switch(_0xe46d3f[_0xf95e('0xf1')]){case'0':ut[_0xf95e('0xf2')](_0x15d343,0x0,_0xf95e('0xf3'));rpcDb[_0xf95e('0xf4')](_0x15d343,_0xf95e('0xf5'));break;case'3':ut[_0xf95e('0xf2')](_0x15d343,0x3,'NoAnswer');rpcDb[_0xf95e('0xf4')](_0x15d343,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x15d343,0x5,'Busy');rpcDb[_0xf95e('0xf4')](_0x15d343,_0xf95e('0xf6'));break;case'8':ut['logAgent'](_0x15d343,0x8,_0xf95e('0xcf'));rpcDb[_0xf95e('0xf4')](_0x15d343,_0xf95e('0xf7'));break;case'22':ut['logAgent'](_0x15d343,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x15d343,_0xf95e('0xf8'));break;default:ut['logAgent'](_0x15d343,0xc,_0xe46d3f[_0xf95e('0xf1')]);rpcDb[_0xf95e('0xf4')](_0x15d343,_0xf95e('0xf7'));}ut['updateOriginated'](_0x286c5a,_0xf95e('0xf9'));logger[_0xf95e('0x61')](_0xf95e('0xfa'),_0x15d343[_0xf95e('0xaf')],'\x20Queue',_0x286c5a[_0xf95e('0x27')],_0xf95e('0x77'),_0x286c5a['originated']);delete this[_0xf95e('0x14')][_0x15d343[_0xf95e('0xaf')]];};Preview['prototype'][_0xf95e('0xfb')]=function(_0x2c2b50,_0x17349f,_0x20c544,_0x2f6d0f,_0xba3d82){var _0x1f0b53=this;return new BPromise(function(_0x2c3007,_0x5d2036){if(_[_0xf95e('0x74')](_0x17349f)||_['isNil'](_0x17349f['Contact'])||_[_0xf95e('0x74')](_0x17349f[_0xf95e('0xfc')]['phone'])||_[_0xf95e('0x74')](_0x17349f['VoiceQueueId'])){_0x5d2036(ut[_0xf95e('0x52')]('Contact\x20is\x20undefined',_0x2f6d0f,_0xba3d82));return;}var _0x148e0e=uuid['v4']();var _0x53dddc=_0x1f0b53['campaignsPreview'][_0x17349f[_0xf95e('0x75')]['name']];var _0x4f6311=_0x20c544?_0x1f0b53[_0xf95e('0x15')][_0x20c544]['id']:undefined;_0x1f0b53[_0xf95e('0x14')][_0x148e0e]=new Action(_0x17349f,_0x53dddc,_0x148e0e,_0x20c544,_0x4f6311);var _0x764733=_0x1f0b53[_0xf95e('0x14')][_0x148e0e];_0x764733[_0xf95e('0xa9')]=_0x2f6d0f;_0x764733[_0xf95e('0xaa')]=_0xba3d82;_0x764733[_0xf95e('0xfd')]=_0x20c544;if(_[_0xf95e('0xfe')](_0x2c2b50)){_0x1f0b53['execCall'](_0x764733,_0x53dddc,_0x17349f,_0x20c544)['then'](function(_0x2ed27b){logger['info'](_0xf95e('0xff'),'Queue:\x20'+_0x764733[_0xf95e('0x76')]+_0xf95e('0x100')+_0x764733[_0xf95e('0x101')],JSON['stringify'](_0x2ed27b));ami[_0xf95e('0x64')]('custom:agentcalled',ut[_0xf95e('0xa0')](_0x764733,_0xf95e('0x102'),_0x1f0b53[_0xf95e('0x25')][_0x764733[_0xf95e('0x76')]]));_0x2c3007(ut[_0xf95e('0x52')](_0xf95e('0x103')));})[_0xf95e('0x7e')](function(_0x266405){ut[_0xf95e('0x6a')](_0xf95e('0x104'),_0x266405);_0x5d2036(ut[_0xf95e('0x52')](_0xf95e('0x105'),_0x2f6d0f,_0xba3d82));});}else{_0x53dddc[_0xf95e('0x3e')]+=0x1;ut[_0xf95e('0x106')](_0x764733);rpcDb[_0xf95e('0x107')](_0x764733,'[Blacklist][error]');delete _0x1f0b53[_0xf95e('0x14')][_0x148e0e];_0x5d2036(ut[_0xf95e('0x52')](_0xf95e('0x108'),_0x2f6d0f,_0xba3d82));}});};Preview['prototype'][_0xf95e('0x9b')]=function(_0x12ef28){return!_[_0xf95e('0x74')](_0x12ef28)&&!_[_0xf95e('0x74')](_0x12ef28[_0xf95e('0x27')])&&!_[_0xf95e('0x74')](_0x12ef28[_0xf95e('0x5a')])&&_0x12ef28[_0xf95e('0x5a')]&&!_[_0xf95e('0x74')](this['trunks'][util['format'](_0xf95e('0x109'),_0x12ef28[_0xf95e('0x27')])])&&!_[_0xf95e('0x74')](this['trunks'][util[_0xf95e('0x5e')](_0xf95e('0x109'),_0x12ef28[_0xf95e('0x27')])][_0xf95e('0x10a')])&&(this['trunks'][util[_0xf95e('0x5e')](_0xf95e('0x109'),_0x12ef28[_0xf95e('0x27')])][_0xf95e('0x10a')]===_0xf95e('0x10b')||this['trunks'][util[_0xf95e('0x5e')](_0xf95e('0x109'),_0x12ef28[_0xf95e('0x27')])]['status']===_0xf95e('0x10c'));};Preview[_0xf95e('0xe')][_0xf95e('0x10d')]=function(_0x489af7,_0x83b6e3){var _0x4e4291=this;return new BPromise(function(_0x4b7cf8,_0x5b38c3){_0x4e4291['execRun'](_0x489af7,_0x83b6e3)[_0xf95e('0x8e')](function(_0x1136d1){_0x4b7cf8(_['pick'](_0x1136d1,[_0xf95e('0x52')]));})[_0xf95e('0x7e')](function(_0x2637a5){if(_0x2637a5[_0xf95e('0x10e')]){rpcDb[_0xf95e('0x10f')](_0x489af7);}if(_0x2637a5[_0xf95e('0x5a')]){rpcDb[_0xf95e('0x91')](_0x489af7);}_0x5b38c3(_[_0xf95e('0x79')](_0x2637a5,['message']));});});};Preview['prototype'][_0xf95e('0x110')]=function(_0x4951a5,_0x1303c1){var _0x1569f5=this;return new BPromise(function(_0x4a4c99,_0x35a839){var _0x30154e,_0x33a9ec;rpcDb[_0xf95e('0x111')](_0x4951a5)[_0xf95e('0x8e')](function(_0xee3edf){if(!_[_0xf95e('0x74')](_0xee3edf[0x0])){_0x33a9ec=_0xee3edf[0x0][_0xf95e('0x112')]?![]:!![];_0x30154e=_0xee3edf[0x0]['recallme']?!![]:![];_0x30154e=_0x1303c1?!![]:_0x30154e;}var _0x1fbe8b=_0x1569f5[_0xf95e('0x113')](_0xee3edf);if(_0x1fbe8b[_0xf95e('0x114')]){rpcDb[_0xf95e('0x115')](_[_0xf95e('0x79')](_0xee3edf[0x0],[_0xf95e('0x7b'),_0xf95e('0x116')]))[_0xf95e('0x8e')](function(_0x4c61fa){_0x1569f5[_0xf95e('0xfb')](_0x4c61fa,_0xee3edf[0x0],_0x1303c1,_0x33a9ec,_0x30154e)[_0xf95e('0x8e')](function(_0x232d23){_0x4a4c99(_0x232d23);})[_0xf95e('0x7e')](function(_0x2a2d07){_0x35a839(_0x2a2d07);});})['catch'](function(_0x21d725){ut[_0xf95e('0x6a')](_0xf95e('0x117'),_0x21d725);_0x35a839(ut['message'](_0xf95e('0x118'),_0x33a9ec,_0x30154e));});}else{_0x35a839(ut[_0xf95e('0x52')](_0x1fbe8b[_0xf95e('0x52')],_0x33a9ec,_0x30154e));}})[_0xf95e('0x7e')](function(_0x21724a){ut[_0xf95e('0x6a')](_0xf95e('0x119'),_0x21724a);_0x35a839(ut[_0xf95e('0x52')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xf95e('0xe')]['validateContact']=function(_0x5a2d13){if(_[_0xf95e('0x74')](_0x5a2d13)||_[_0xf95e('0xfe')](_0x5a2d13)||!_[_0xf95e('0x74')](_0x5a2d13[0x0][_0xf95e('0x8c')])&&_['isNil'](_0x5a2d13[0x0][_0xf95e('0x8c')][_0xf95e('0x27')])){ut[_0xf95e('0x6a')](_0xf95e('0x11a'),_0x5a2d13);return{'isValid':![],'message':_0xf95e('0x11b')};}var _0x3b41e6=this[_0xf95e('0x25')][_0x5a2d13[0x0][_0xf95e('0x75')][_0xf95e('0x27')]];_0x3b41e6[_0xf95e('0x52')]='ACTIVE';if(_[_0xf95e('0x74')](_0x3b41e6)){ut[_0xf95e('0x6a')](_0xf95e('0x11c'),_0x3b41e6);return{'isValid':![],'message':_0xf95e('0x11d')};}if(!this['isTrunkReachable'](_0x3b41e6[_0xf95e('0x59')])){ut[_0xf95e('0x6a')](_0xf95e('0x11e'),_0xf95e('0x11f')+_0x3b41e6[_0xf95e('0x27')]+_0xf95e('0x120'));if(!this['isTrunkReachable'](_0x3b41e6[_0xf95e('0x121')])){ut[_0xf95e('0x6a')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x3b41e6[_0xf95e('0x27')]+_0xf95e('0x122'));return{'isValid':![],'message':_0xf95e('0x123')};}}if(!ut[_0xf95e('0x124')](_0x3b41e6[_0xf95e('0x36')])){ut[_0xf95e('0x6a')](_0xf95e('0x125'),_0x3b41e6[_0xf95e('0x27')]+_0xf95e('0x126'));return{'isValid':![],'message':_0xf95e('0x11f')+_0x3b41e6[_0xf95e('0x27')]+_0xf95e('0x126')};}return{'isValid':!![],'message':_0xf95e('0x127')};};Preview[_0xf95e('0xe')][_0xf95e('0x128')]=function(_0x24f87b,_0x4d3c40,_0x163aa0,_0x2c01ca){var _0x1ad395=this;return new BPromise(function(_0x10c5bd,_0xef6ea2){var _0x19ecb7=_0x24f87b['uniqueid'];var _0x9d41ff=_0x1ad395[_0xf95e('0x9b')](_0x4d3c40[_0xf95e('0x59')])?util[_0xf95e('0x5e')](_0xf95e('0x129'),_0x4d3c40[_0xf95e('0x59')]['name'],_[_0xf95e('0x74')](_0x4d3c40[_0xf95e('0x3b')])?'':_0x4d3c40['dialPrefix']['trim']()||'',_0x4d3c40['dialCutDigit']>0x0?_0x163aa0[_0xf95e('0xfc')][_0xf95e('0x12a')]['substring'](_0x4d3c40[_0xf95e('0x12b')]):_0x163aa0[_0xf95e('0xfc')]['phone']):util[_0xf95e('0x5e')](_0xf95e('0x129'),_[_0xf95e('0x74')](_0x4d3c40[_0xf95e('0x121')])?_0x4d3c40['Trunk'][_0xf95e('0x27')]:_0x4d3c40[_0xf95e('0x121')]['name'],_[_0xf95e('0x74')](_0x4d3c40[_0xf95e('0x3b')])?'':_0x4d3c40['dialPrefix'][_0xf95e('0x12c')]()||'',_0x4d3c40[_0xf95e('0x12b')]>0x0?_0x163aa0[_0xf95e('0xfc')][_0xf95e('0x12a')][_0xf95e('0x12d')](_0x4d3c40[_0xf95e('0x12b')]):_0x163aa0[_0xf95e('0xfc')][_0xf95e('0x12a')]);var _0x292e47=_0x1ad395[_0xf95e('0x9b')](_0x4d3c40[_0xf95e('0x59')])?ut['getCallerId'](_0x4d3c40[_0xf95e('0x59')][_0xf95e('0x5b')],_0x4d3c40[_0xf95e('0x38')],_0x4d3c40[_0xf95e('0x12e')]>0x0?ut[_0xf95e('0x12f')](_0x4d3c40[_0xf95e('0x39')],_0x4d3c40['dialRandomLastDigitCallerIdNumber']):_0x4d3c40[_0xf95e('0x39')]):ut['getCallerId'](_[_0xf95e('0x74')](_0x4d3c40[_0xf95e('0x121')])?_0x4d3c40[_0xf95e('0x59')]['callerid']:_0x4d3c40[_0xf95e('0x121')][_0xf95e('0x5b')],_0x4d3c40[_0xf95e('0x38')],_0x4d3c40[_0xf95e('0x12e')]>0x0?ut[_0xf95e('0x12f')](_0x4d3c40[_0xf95e('0x39')],_0x4d3c40[_0xf95e('0x12e')]):_0x4d3c40[_0xf95e('0x39')]);if(_0x292e47){_0x24f87b[_0xf95e('0x130')]=ut[_0xf95e('0x131')](_0x292e47);_0x24f87b[_0xf95e('0x132')]=ut[_0xf95e('0x133')](_0x292e47);}var _0x39557b=ut[_0xf95e('0x134')](_0x4d3c40,_0x163aa0,_0x9d41ff,_0x292e47,_0x19ecb7,_0x24f87b);_['merge'](_0x24f87b,ut[_0xf95e('0x135')](_0x39557b));_0x24f87b[_0xf95e('0x92')]=moment()[_0xf95e('0x5e')](_0xf95e('0x136'));ami[_0xf95e('0x7d')](ut[_0xf95e('0x137')](_0x24f87b,_0x4d3c40,_0x39557b,_0x24f87b[_0xf95e('0xaa')],_0x2c01ca))[_0xf95e('0x8e')](function(_0x4b0a32){var _0x503e54=_0x24f87b[_0xf95e('0x138')];if(!_[_0xf95e('0x74')](_0x503e54)){if(!_[_0xf95e('0x74')](_0x1ad395[_0xf95e('0x15')][_0x503e54])){_0x1ad395[_0xf95e('0x15')][_0x503e54][_0xf95e('0x139')]=_0x24f87b[_0xf95e('0x13a')];emit(util[_0xf95e('0x5e')](_0xf95e('0x13b'),_0x1ad395[_0xf95e('0x15')][_0x503e54][_0xf95e('0x27')]),_0xf95e('0x13c'),{'destaccountcode':_0x1ad395[_0xf95e('0x15')][_0x503e54][_0xf95e('0x13d')],'destconnectedlinenum':_0x24f87b[_0xf95e('0x13a')]});}}_0x4d3c40[_0xf95e('0x53')]+=0x1;logger['info'](_0xf95e('0x13e'),_0x19ecb7,_0xf95e('0xb0'),_0x4d3c40['name'],_0xf95e('0x77'),_0x4d3c40[_0xf95e('0x53')]);_0x10c5bd(_0x4b0a32);})[_0xf95e('0x7e')](function(_0x4e1f98){ut['logAgent'](_0x24f87b,0xe,'OriginateError');rpcDb[_0xf95e('0xf4')](_0x24f87b,_0xf95e('0x13f'));_0xef6ea2(_0x4e1f98);});});};Preview[_0xf95e('0xe')][_0xf95e('0x1f')]=function(_0x25ff42){if(this[_0xf95e('0x14')][_0x25ff42[_0xf95e('0xab')]]){this[_0xf95e('0x14')][_0x25ff42[_0xf95e('0xab')]][_0xf95e('0x140')]=_0x25ff42[_0xf95e('0x140')];}};Preview[_0xf95e('0xe')][_0xf95e('0x141')]=function(_0x117ff9){var _0x471284=this;var _0x2ab85c=this['actions'][_0x117ff9[_0xf95e('0x142')]];if(_0x2ab85c){if(_0x2ab85c[_0xf95e('0xfd')]&&this['agents'][_0x2ab85c[_0xf95e('0xfd')]]){ut[_0xf95e('0x143')](_0x2ab85c,this[_0xf95e('0x15')][_0x2ab85c[_0xf95e('0xfd')]][_0xf95e('0x27')],this['agents'][_0x2ab85c[_0xf95e('0xfd')]]['id']);}var _0x2a1c86=_[_0xf95e('0x144')](_0x2ab85c);_0x2a1c86[_0xf95e('0xad')]=moment()[_0xf95e('0x5e')](_0xf95e('0x136'));var _0x25e92a=_0x471284['campaignsPreview'][_0x2ab85c['queue']];if(ut[_0xf95e('0x145')](_0x117ff9['response'])){if(_0x2ab85c[_0xf95e('0xa9')]){rpcDb['unlockContact'](_0x2ab85c[_0xf95e('0x101')]);}if(_0x2ab85c[_0xf95e('0xaa')]){rpcDb[_0xf95e('0x91')](_0x2ab85c[_0xf95e('0x101')]);}ami[_0xf95e('0x64')](_0xf95e('0x146'),ut['buildObj'](_0x2ab85c,'rejected',this[_0xf95e('0x25')][_0x2ab85c[_0xf95e('0x76')]]));this[_0xf95e('0xee')](_0x2a1c86,_0x25e92a,_0x117ff9);}else{_0x2ab85c['starttime']=moment()[_0xf95e('0x5e')](_0xf95e('0x136'));ut[_0xf95e('0xf2')](_0x2a1c86,0x4,'Answer');rpcDb[_0xf95e('0xf4')](_0x2a1c86,_0xf95e('0x147'));}}};Preview['prototype']['syncHangup']=function(_0x43d714){var _0x816439=this;var _0x422283=this[_0xf95e('0x14')][_0x43d714[_0xf95e('0xab')]];var _0x41ee4a;if(_0x422283){_0x41ee4a=this[_0xf95e('0x25')][_0x422283[_0xf95e('0x76')]];logger['info'](_0xf95e('0x148'),_0x43d714[_0xf95e('0xab')],_0xf95e('0xb0'),_0x41ee4a['name'],'pTalking:\x20',_0x41ee4a['pTalking']);}if(this[_0xf95e('0x14')][_0x43d714[_0xf95e('0xab')]]&&_0x43d714[_0xf95e('0xab')]!==_0x43d714[_0xf95e('0xaf')]){if(_0x43d714[_0xf95e('0x149')]==='16'&&this['actions'][_0x43d714['linkedid']][_0xf95e('0x78')]){this[_0xf95e('0x14a')](_0x43d714,_0x43d714[_0xf95e('0xab')],_0x43d714[_0xf95e('0x149')]);}else if(this[_0xf95e('0x14')][_0x43d714[_0xf95e('0xab')]][_0xf95e('0x78')]){logger[_0xf95e('0x61')](_0xf95e('0x14b'),_0x43d714[_0xf95e('0xab')],_0x43d714[_0xf95e('0x149')],_0xf95e('0xb0'),_0x41ee4a[_0xf95e('0x27')],'pTalking:\x20',_0x41ee4a[_0xf95e('0x2b')]);this['callProgressDetectingCustomer'](_0x43d714,_0x43d714[_0xf95e('0xab')],_0x43d714[_0xf95e('0x149')]);}}else if(_0x422283&&_['isNil'](_0x422283[_0xf95e('0x14c')])&&_0x41ee4a['dialQueueProject']&&_0x43d714[_0xf95e('0xab')]===_0x43d714['uniqueid']&&_['isNil'](_0x43d714[_0xf95e('0xf1')])&&_0x43d714[_0xf95e('0x149')]==='16'&&_0x43d714[_0xf95e('0x14d')]==='6'&&_['isUndefined'](_0x422283[_0xf95e('0x14e')])){if(_0x422283[_0xf95e('0xa9')]){rpcDb[_0xf95e('0x10f')](_0x422283[_0xf95e('0x101')]);}if(_0x422283[_0xf95e('0xaa')]){rpcDb[_0xf95e('0x91')](_0x422283[_0xf95e('0x101')]);}_0x43d714['reason']='22';this[_0xf95e('0xee')](_0x422283,_0x41ee4a,_0x43d714);}else if(_0x422283&&_0x422283[_0xf95e('0x14e')]){if(_0x43d714[_0xf95e('0x149')]==='16'&&this['actions'][_0x43d714['linkedid']][_0xf95e('0x78')]){logger[_0xf95e('0x61')](_0xf95e('0x14f'),_0x43d714[_0xf95e('0xab')],_0x43d714[_0xf95e('0x149')],_0xf95e('0xb0'),_0x41ee4a[_0xf95e('0x27')],'pTalking:\x20',_0x41ee4a['pTalking']);this[_0xf95e('0x14a')](_0x43d714,_0x43d714[_0xf95e('0xab')],_0x43d714[_0xf95e('0x149')]);}else if(this['actions'][_0x43d714[_0xf95e('0xab')]][_0xf95e('0x78')]){logger['info'](_0xf95e('0x14b'),_0x43d714['linkedid'],_0x43d714[_0xf95e('0x149')],_0xf95e('0xb0'),_0x41ee4a[_0xf95e('0x27')],_0xf95e('0xb1'),_0x41ee4a[_0xf95e('0x2b')]);this['callProgressDetectingCustomer'](_0x43d714,_0x43d714['linkedid'],_0x43d714[_0xf95e('0x149')]);}}};Preview['prototype'][_0xf95e('0x1e')]=function(_0x522f93){if(this[_0xf95e('0x14')][_0x522f93[_0xf95e('0xed')]]&&_0x522f93[_0xf95e('0xed')]!==_0x522f93['destuniqueid']){this[_0xf95e('0x14a')](_0x522f93,_0x522f93[_0xf95e('0xed')],_0x522f93[_0xf95e('0xe4')]);}};Preview[_0xf95e('0xe')][_0xf95e('0x1c')]=function(_0x2b4095){if(this['actions'][_0x2b4095[_0xf95e('0xab')]]&&_0x2b4095[_0xf95e('0xab')]!==_0x2b4095['uniqueid']&&!this[_0xf95e('0x14')][_0x2b4095[_0xf95e('0xab')]][_0xf95e('0x78')]){if(_0x2b4095[_0xf95e('0x149')]==='1'){this[_0xf95e('0x14a')](_0x2b4095,_0x2b4095[_0xf95e('0xab')],_0x2b4095[_0xf95e('0x149')]);}}};Preview[_0xf95e('0xe')][_0xf95e('0x150')]=function(_0x29ebf9,_0x5a2feb,_0x5367ae){if(this['actions'][_0x29ebf9]){if(_['isNil'](this[_0xf95e('0x14')][_0x29ebf9]['variables'])){this[_0xf95e('0x14')][_0x29ebf9]['variables']={};}this['actions'][_0x29ebf9][_0xf95e('0x151')][_0x5a2feb]=_0x5367ae;}};Preview[_0xf95e('0xe')][_0xf95e('0x21')]=function(_0xb2f3b7){try{if(!_['isNil'](_0xb2f3b7)){if(ut[_0xf95e('0x152')](_[_0xf95e('0x153')](_0xb2f3b7[_0xf95e('0x154')])[0x0])){this[_0xf95e('0x150')](_0xb2f3b7[_0xf95e('0xaf')],_[_0xf95e('0x153')](_0xb2f3b7[_0xf95e('0x154')])[0x0],_0xb2f3b7[_0xf95e('0x155')]);}}}catch(_0x1fd360){logger[_0xf95e('0x156')]('[syncVarSet][Preview]',util[_0xf95e('0x157')](_0x1fd360,{'showHidden':![],'depth':null}));}};Preview[_0xf95e('0xe')]['syncAttendedTransfer']=function(_0x4179f4){if(_0x4179f4){if(this[_0xf95e('0x14')][_0x4179f4[_0xf95e('0x158')]]){this[_0xf95e('0x14')][_0x4179f4[_0xf95e('0x158')]][_0xf95e('0x14e')]=!![];}}};Preview[_0xf95e('0xe')][_0xf95e('0x24')]=function(_0x146896){if(_0x146896){if(this[_0xf95e('0x14')][_0x146896[_0xf95e('0x159')]]){this[_0xf95e('0x14')][_0x146896['transfererlinkedid']]['transfer']=!![];}}};module[_0xf95e('0x15a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1b76304..cd71793 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 _0x5f7f=['error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5f7f,0x68));var _0xf5f7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f7f[_0x4cf98e];return _0x1623ac;};'use strict';var util=require(_0xf5f7('0x0'));var BPromise=require(_0xf5f7('0x1'));var logger=require(_0xf5f7('0x2'))('preview');var _=require(_0xf5f7('0x3'));var cmHopper=require(_0xf5f7('0x4'));var cmHopperFinal=require(_0xf5f7('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xf5f7('0x6'));var voiceQueueRt=require(_0xf5f7('0x7'));var agentReportPreview=require(_0xf5f7('0x8'));var voiceQueueReport=require(_0xf5f7('0x9'));function loggerCatch(_0x25d819){return function(_0x5b525a){logger[_0xf5f7('0xa')](_0x25d819,util['inspect'](_0x5b525a,{'showHidden':![],'depth':null}));};}function create(_0x546b15){return BPromise['resolve']()['then'](cmHopperHistory[_0xf5f7('0xb')](_0x546b15))[_0xf5f7('0xc')](loggerCatch(_0xf5f7('0xd')));}function createAgent(_0x9c1ae){return BPromise['resolve']()['then'](agentReportPreview[_0xf5f7('0xb')](_0x9c1ae))['catch'](loggerCatch(_0xf5f7('0xd')));}function moveContact(_0x27e7d1){return BPromise[_0xf5f7('0xe')]()[_0xf5f7('0xf')](cmHopper[_0xf5f7('0x10')](_0x27e7d1,!![]))[_0xf5f7('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xf5f7('0x11')]=function(_0x53ca71){return BPromise['resolve']()[_0xf5f7('0xf')](cmHopperBlack[_0xf5f7('0x11')](_0x53ca71))[_0xf5f7('0xc')](loggerCatch(_0xf5f7('0x12')));};exports[_0xf5f7('0x13')]=function(_0x29241c){return BPromise['resolve']()[_0xf5f7('0xf')](cmHopper[_0xf5f7('0x13')](_0x29241c))['catch'](loggerCatch(_0xf5f7('0x14')));};exports[_0xf5f7('0xb')]=function(_0x19c2dd,_0x88879){create(_0x19c2dd)[_0xf5f7('0xc')](loggerCatch(_0x88879));moveContact(_0x19c2dd)[_0xf5f7('0xc')](loggerCatch(_0x88879));};exports[_0xf5f7('0x15')]=function(_0x4da09d,_0xb961a8){createAgent(_0x4da09d)[_0xf5f7('0xc')](loggerCatch(_0xb961a8));};exports['createCustomerHistory']=function(_0x516299,_0x26b848){create(_0x516299)['catch'](loggerCatch(_0x26b848));};exports[_0xf5f7('0x16')]=function(_0x3884de,_0x4662bd){moveContact(_0x3884de)[_0xf5f7('0xc')](loggerCatch(_0x4662bd));};exports[_0xf5f7('0x17')]=function(_0x510692,_0x4e1e6b,_0x1ebd65){if(_0x4e1e6b){_0x510692[_0xf5f7('0x18')]=null;}if(_0x1ebd65){_0x510692[_0xf5f7('0x19')]=![];}return BPromise[_0xf5f7('0xe')]()['then'](cmHopper[_0xf5f7('0x17')](_0x510692))[_0xf5f7('0xc')](loggerCatch(_0xf5f7('0x1a')));};exports['countReScheduled']=function(_0x259b8d){return BPromise[_0xf5f7('0xe')]()[_0xf5f7('0xf')](cmHopper[_0xf5f7('0x1b')](_0x259b8d))[_0xf5f7('0xc')](loggerCatch(_0xf5f7('0x1c')));};exports[_0xf5f7('0x1d')]=function(_0xf1bcc0){return BPromise[_0xf5f7('0xe')]()[_0xf5f7('0xf')](cmHopper[_0xf5f7('0x1d')]({'UserId':null},_0xf1bcc0,0x1))['catch'](loggerCatch(_0xf5f7('0x1e')));};exports['disableContact']=function(_0xa69038){return BPromise[_0xf5f7('0xe')]()['then'](cmHopper[_0xf5f7('0x1d')]({'active':![]},_0xa69038,0x1))['catch'](loggerCatch(_0xf5f7('0x1f')));};exports[_0xf5f7('0x20')]=function(_0xf2314e){var _0x53301c={};_0x53301c[_0xf5f7('0x21')]=_0xf2314e[_0xf5f7('0x21')];_0x53301c['uniqueid']=_0xf2314e[_0xf5f7('0x22')];_0x53301c[_0xf5f7('0x23')]=_0xf2314e[_0xf5f7('0x23')];_0x53301c[_0xf5f7('0x24')]=_0xf2314e[_0xf5f7('0x24')];_0x53301c[_0xf5f7('0x25')]=_0xf2314e[_0xf5f7('0x25')];_0x53301c[_0xf5f7('0x26')]=_0xf2314e['answertime'];_0x53301c['queuecallerleaveAt']=_0xf2314e[_0xf5f7('0x27')];_0x53301c[_0xf5f7('0x28')]=0x1;_0x53301c[_0xf5f7('0x29')]=_0xf2314e['endtime'];_0x53301c[_0xf5f7('0x2a')]=_0xf2314e['membername'];_0x53301c[_0xf5f7('0x2b')]=_0xf5f7('0x2c');_0x53301c['exten']=_0xf5f7('0x2d');_0x53301c[_0xf5f7('0x2e')]=0x0;_0x53301c[_0xf5f7('0x2f')]=0x1;_0x53301c[_0xf5f7('0x30')]=_0xf2314e[_0xf5f7('0x31')];_0x53301c[_0xf5f7('0x32')]=_0xf5f7('0x33');return BPromise[_0xf5f7('0xe')]()[_0xf5f7('0xf')](voiceQueueReport[_0xf5f7('0x34')](_0x53301c))['catch'](loggerCatch(_0xf5f7('0x35')));};exports['getContactRecallMe']=function(_0x2fca8b,_0x48757f){return BPromise[_0xf5f7('0xe')]()[_0xf5f7('0xf')](cmHopper[_0xf5f7('0x36')](_0x2fca8b,_0x48757f))[_0xf5f7('0xc')](loggerCatch(_0xf5f7('0x37')));};exports['rescheduleContactInQueue']=function(_0x3b2450){return BPromise['resolve']()['then'](cmHopper[_0xf5f7('0x17')](_0x3b2450,!![],!![]))[_0xf5f7('0xc')](loggerCatch(_0xf5f7('0x38')));}; \ No newline at end of file +var _0x8cf2=['calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','holdtime','lastAssignedTo','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','then','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum'];(function(_0x530e38,_0x5f1d0f){var _0x4b6a58=function(_0xea6fde){while(--_0xea6fde){_0x530e38['push'](_0x530e38['shift']());}};_0x4b6a58(++_0x5f1d0f);}(_0x8cf2,0x6f));var _0x28cf=function(_0x25c812,_0x488d86){_0x25c812=_0x25c812-0x0;var _0x19912c=_0x8cf2[_0x25c812];return _0x19912c;};'use strict';var util=require(_0x28cf('0x0'));var BPromise=require(_0x28cf('0x1'));var logger=require(_0x28cf('0x2'))('preview');var _=require(_0x28cf('0x3'));var cmHopper=require(_0x28cf('0x4'));var cmHopperFinal=require(_0x28cf('0x5'));var cmHopperHistory=require(_0x28cf('0x6'));var cmHopperBlack=require(_0x28cf('0x7'));var voiceQueueRt=require(_0x28cf('0x8'));var agentReportPreview=require(_0x28cf('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4d6a36){return function(_0x7d2d4a){logger['error'](_0x4d6a36,util['inspect'](_0x7d2d4a,{'showHidden':![],'depth':null}));};}function create(_0x1dfba2){return BPromise['resolve']()[_0x28cf('0xa')](cmHopperHistory[_0x28cf('0xb')](_0x1dfba2))[_0x28cf('0xc')](loggerCatch(_0x28cf('0xd')));}function createAgent(_0x66f6bc){return BPromise[_0x28cf('0xe')]()[_0x28cf('0xa')](agentReportPreview[_0x28cf('0xb')](_0x66f6bc))[_0x28cf('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x853456){return BPromise[_0x28cf('0xe')]()[_0x28cf('0xa')](cmHopper['moveContactManagedDialer'](_0x853456,!![]))[_0x28cf('0xc')](loggerCatch(_0x28cf('0xf')));}exports[_0x28cf('0x10')]=function(_0x214ed1){return BPromise['resolve']()['then'](cmHopperBlack[_0x28cf('0x10')](_0x214ed1))[_0x28cf('0xc')](loggerCatch(_0x28cf('0x11')));};exports[_0x28cf('0x12')]=function(_0x118713){return BPromise['resolve']()[_0x28cf('0xa')](cmHopper['getContactPreview'](_0x118713))[_0x28cf('0xc')](loggerCatch(_0x28cf('0x13')));};exports[_0x28cf('0xb')]=function(_0x11fb4c,_0x11af8d){create(_0x11fb4c)[_0x28cf('0xc')](loggerCatch(_0x11af8d));moveContact(_0x11fb4c)[_0x28cf('0xc')](loggerCatch(_0x11af8d));};exports['createAgentHistory']=function(_0x3e3278,_0x7703dd){createAgent(_0x3e3278)[_0x28cf('0xc')](loggerCatch(_0x7703dd));};exports[_0x28cf('0x14')]=function(_0x33f865,_0x5a097f){create(_0x33f865)[_0x28cf('0xc')](loggerCatch(_0x5a097f));};exports[_0x28cf('0x15')]=function(_0x384dc1,_0x5426a1){moveContact(_0x384dc1)[_0x28cf('0xc')](loggerCatch(_0x5426a1));};exports[_0x28cf('0x16')]=function(_0x5c97d3,_0x3768e4,_0x45f90c){if(_0x3768e4){_0x5c97d3[_0x28cf('0x17')]=null;}if(_0x45f90c){_0x5c97d3['active']=![];}return BPromise[_0x28cf('0xe')]()[_0x28cf('0xa')](cmHopper[_0x28cf('0x16')](_0x5c97d3))[_0x28cf('0xc')](loggerCatch(_0x28cf('0x18')));};exports[_0x28cf('0x19')]=function(_0x245889){return BPromise[_0x28cf('0xe')]()[_0x28cf('0xa')](cmHopper[_0x28cf('0x19')](_0x245889))[_0x28cf('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x28cf('0x1a')]=function(_0x2bd60c){return BPromise[_0x28cf('0xe')]()[_0x28cf('0xa')](cmHopper[_0x28cf('0x1a')]({'UserId':null},_0x2bd60c,0x1))[_0x28cf('0xc')](loggerCatch('[unlockContact]\x20'));};exports[_0x28cf('0x1b')]=function(_0x5f10cd){return BPromise[_0x28cf('0xe')]()[_0x28cf('0xa')](cmHopper[_0x28cf('0x1a')]({'active':![]},_0x5f10cd,0x1))['catch'](loggerCatch(_0x28cf('0x1c')));};exports[_0x28cf('0x1d')]=function(_0x192bcd){var _0xa772fc={};_0xa772fc[_0x28cf('0x1e')]=_0x192bcd[_0x28cf('0x1e')];_0xa772fc[_0x28cf('0x1f')]=_0x192bcd[_0x28cf('0x1f')];_0xa772fc[_0x28cf('0x20')]=_0x192bcd[_0x28cf('0x20')];_0xa772fc[_0x28cf('0x21')]=_0x192bcd[_0x28cf('0x21')];_0xa772fc[_0x28cf('0x22')]=_0x192bcd[_0x28cf('0x22')];_0xa772fc['queuecallerjoinAt']=_0x192bcd[_0x28cf('0x23')];_0xa772fc[_0x28cf('0x24')]=_0x192bcd[_0x28cf('0x23')];_0xa772fc[_0x28cf('0x25')]=0x1;_0xa772fc[_0x28cf('0x26')]=_0x192bcd[_0x28cf('0x27')];_0xa772fc['connectedlinename']=_0x192bcd[_0x28cf('0x28')];_0xa772fc[_0x28cf('0x29')]=_0x28cf('0x2a');_0xa772fc['exten']='xcally-motion-preview';_0xa772fc[_0x28cf('0x2b')]=0x0;_0xa772fc['assigned']=0x1;_0xa772fc[_0x28cf('0x2c')]=_0x192bcd['membername'];_0xa772fc['queuecallerexitreason']='COMPLETED';return BPromise[_0x28cf('0xe')]()['then'](voiceQueueReport['create'](_0xa772fc))[_0x28cf('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x1e9702,_0xfbe29){return BPromise[_0x28cf('0xe')]()[_0x28cf('0xa')](cmHopper[_0x28cf('0x2d')](_0x1e9702,_0xfbe29))[_0x28cf('0xc')](loggerCatch(_0x28cf('0x2e')));};exports['rescheduleContactInQueue']=function(_0x1f2bf6){return BPromise['resolve']()[_0x28cf('0xa')](cmHopper[_0x28cf('0x16')](_0x1f2bf6,!![],!![]))['catch'](loggerCatch(_0x28cf('0x2f')));}; \ 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 dae5aaa..3eebaab 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 _0x307a=['push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','callback','callbackuniqueid','callbackat','sipcallid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','logger','info','inspect','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','Queue','calleridnum','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','NONE','\x22agi://%s/square,%s\x22','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','ringtime','logLookAgent','membername','UserId','endtime','talktime','answertime','Failure','variablesAction','RECALL','calleridname','BOOKED','originate','channelAgent','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','Global','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x307a,0x12b));var _0xa307=function(_0x3b9d25,_0x2b89b5){_0x3b9d25=_0x3b9d25-0x0;var _0x5be3a6=_0x307a[_0x3b9d25];return _0x5be3a6;};'use strict';var util=require(_0xa307('0x0'));var _=require(_0xa307('0x1'));var moment=require(_0xa307('0x2'));var logger=require(_0xa307('0x3'))('preview');var ipAgi=process[_0xa307('0x4')]['XCALLY_IP_AGI']||_0xa307('0x5');function getSeconds(_0x388076,_0x30bcd0){var _0x18d3f9=moment(_0x388076)['milliseconds'](0x0);var _0x164b87=moment(_0x30bcd0)[_0xa307('0x6')](0x0);return _0x18d3f9['diff'](_0x164b87,_0xa307('0x7'));}exports[_0xa307('0x8')]=function(_0x3c3841){return function(_0x5c4c82){logger[_0xa307('0x9')](_0x3c3841,util['inspect'](_0x5c4c82,{'showHidden':![],'depth':null}));};};exports[_0xa307('0xa')]=function(_0x13e73b,_0x36aff6){logger[_0xa307('0xb')](_0x13e73b,util[_0xa307('0xc')](_0x36aff6,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2ccb02,_0x226000){logger[_0xa307('0x9')](_0x2ccb02,util[_0xa307('0xc')](_0x226000,{'showHidden':![],'depth':null}));};exports[_0xa307('0xd')]=function(_0x46ca40){return function(_0x2a693f){logger[_0xa307('0xb')](_0x46ca40,util[_0xa307('0xc')](_0x2a693f,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x51e687,_0x5cb8fc,_0x2d5821){return{'message':_0x51e687,'unlock':_0x5cb8fc,'active':_0x2d5821};};exports[_0xa307('0xe')]=function(_0x556f52,_0x23fc2d,_0x2f01f7){if(!_[_0xa307('0xf')](_0x2f01f7)&&_0xa307('0x10')===typeof _0x2f01f7&&!_[_0xa307('0x11')](_0x2f01f7)){if(!_['isUndefined'](_0x23fc2d)&&_0xa307('0x10')===typeof _0x23fc2d&&!_['isEmpty'](_0x23fc2d)){return util[_0xa307('0x12')](_0xa307('0x13'),_0x23fc2d,_0x2f01f7);}return util[_0xa307('0x12')](_0xa307('0x13'),_0x2f01f7,_0x2f01f7);}if(!_[_0xa307('0xf')](_0x556f52)&&_0xa307('0x10')===typeof _0x556f52&&!_[_0xa307('0x11')](_0x556f52)){return _0x556f52;}return _0xa307('0x14');};exports['isActive']=function(_0xe2d7bd){if(_['isNil'](_0xe2d7bd)){return![];}return _0xe2d7bd;};exports['addVariables']=function(_0x26a4e9,_0x13e5cb,_0x4218f7,_0x26c556,_0x4ff320,_0x2a8623){var _0x53d465={'XMD-QUEUE':_0x13e5cb[_0xa307('0x15')]?_0x13e5cb[_0xa307('0x15')]['name']:'','XMD-CALLERID':_0x26c556,'XMD-CALLERID-PREVIEW':_0x2a8623?util['format'](_0xa307('0x13'),_0x2a8623['calleridname'],_0x2a8623[_0xa307('0x16')]):_0x26c556,'XMD-DIALID':_0x4ff320,'XMD-CONTACTID':_0x13e5cb['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x26c556,'XMD-VOICEQUEUEID':_0x13e5cb[_0xa307('0x17')],'XMD-DIALCHANNEL':_0x4218f7,'XMD-DIALTIMEOUT':_0x26a4e9['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xa307('0x12')](_0xa307('0x18'),_0x26a4e9[_0xa307('0x19')]?'g':'',_[_0xa307('0x11')](_0x26a4e9[_0xa307('0x1a')])?'':_0xa307('0x1b')),'XMD-DIALURL':_0x26a4e9[_0xa307('0x1c')]||'','XMD-AGI':_0x26a4e9['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x26a4e9['dialQueueProject']):_0xa307('0x1d'),'XMD-AGIAFTER':_0x26a4e9[_0xa307('0x19')]?util[_0xa307('0x12')](_0xa307('0x1e'),ipAgi,_0x26a4e9[_0xa307('0x19')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2a8623?_0x2a8623['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2a8623?_0x2a8623['originatecalleridname']:'','XMD-DESTINATION':_0xa307('0x1f')};if(!_[_0xa307('0x11')](_0x26a4e9[_0xa307('0x1a')])){_0x53d465[util['format']('%s',_0xa307('0x20'))]=_0x26a4e9[_0xa307('0x1a')];_0x53d465[util[_0xa307('0x12')]('%s',_0xa307('0x21'))]=_0x4ff320;}if(_0x13e5cb&&_0x13e5cb['Contact']){for(var _0x23c0a in _0x13e5cb[_0xa307('0x22')]){if(_0x13e5cb[_0xa307('0x22')][_0xa307('0x23')](_0x23c0a)){if(!_[_0xa307('0x24')](_0x13e5cb[_0xa307('0x22')][_0x23c0a])&&_0x23c0a!=='id'&&_0x23c0a!=='tags'&&_0x23c0a!=='createdAt'&&_0x23c0a!==_0xa307('0x25')){_0x53d465[util[_0xa307('0x12')](_0xa307('0x26'),_0xa307('0x27'),_[_0xa307('0x28')](_0x23c0a))]=_0x13e5cb[_0xa307('0x22')][_0x23c0a];}}}}return _0x53d465;};exports[_0xa307('0x29')]=function(_0x5a254a){var _0x456451={};for(var _0xa5d033 in _0x5a254a){if(_0x5a254a['hasOwnProperty'](_0xa5d033)){_0x456451[util['format']('%s',_[_0xa307('0x2a')](_0xa5d033))]=_0x5a254a[_0xa5d033];}}return{'variables':_0x456451};};exports['updateOriginated']=function(_0x5af0e6,_0x930544){if(!_['isNil'](_0x5af0e6)){if(_0x5af0e6['hasOwnProperty'](_0xa307('0x2b'))){if(_0x5af0e6['originated']>0x0){_0x5af0e6[_0xa307('0x2b')]-=0x1;}else{logger[_0xa307('0x9')](_0xa307('0x2c'),_0x930544);}}}else{logger[_0xa307('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x930544);}};exports[_0xa307('0x2d')]=function(_0xfbaa8a){var _0x3ecd70=moment()[_0xa307('0x12')](_0xa307('0x2e'));_0xfbaa8a[_0xa307('0x2f')]=0xd;_0xfbaa8a[_0xa307('0x30')]='Blacklist';_0xfbaa8a[_0xa307('0x31')]=_0x3ecd70;_0xfbaa8a[_0xa307('0x32')]=_0x3ecd70;_0xfbaa8a['endtime']=_0x3ecd70;};exports['logAgent']=function(_0x446d1f,_0x408d9e,_0x43e5c6){var _0xa9ac01=moment()[_0xa307('0x12')](_0xa307('0x2e'));_0x446d1f[_0xa307('0x2f')]=_0x408d9e;_0x446d1f[_0xa307('0x30')]=_0x43e5c6;_0x446d1f[_0xa307('0x32')]=_0xa9ac01;_0x446d1f[_0xa307('0x33')]=getSeconds(_0x446d1f[_0xa307('0x32')],_0x446d1f[_0xa307('0x31')]);};exports[_0xa307('0x34')]=function(_0x436c25,_0x11f78e,_0x2cd0c1){_0x436c25[_0xa307('0x35')]=_0x11f78e;_0x436c25[_0xa307('0x36')]=_0x2cd0c1;};exports['logCustomer']=function(_0x3e05d9,_0x3106b6,_0x5a92b6){var _0x1e2db8=moment()[_0xa307('0x12')](_0xa307('0x2e'));_0x3e05d9[_0xa307('0x2f')]=_0x3106b6;_0x3e05d9[_0xa307('0x30')]=_0x5a92b6;_0x3e05d9[_0xa307('0x32')]=_0x3e05d9[_0xa307('0x32')]?_0x3e05d9['responsetime']:_0x1e2db8;_0x3e05d9[_0xa307('0x37')]=_0x3e05d9[_0xa307('0x37')]?_0x3e05d9[_0xa307('0x37')]:_0x1e2db8;_0x3e05d9[_0xa307('0x33')]=getSeconds(_0x3e05d9[_0xa307('0x32')]||0x0,_0x3e05d9[_0xa307('0x31')]||0x0);_0x3e05d9[_0xa307('0x38')]=_0x3e05d9[_0xa307('0x39')]?getSeconds(_0x3e05d9[_0xa307('0x37')],_0x3e05d9[_0xa307('0x39')]):0x0;};exports['isFailure']=function(_0x16617b){return _0x16617b===_0xa307('0x3a');};exports[_0xa307('0x3b')]=function(_0xa6bde0,_0x5a5c90,_0x2e0ef9,_0x3889c0,_0x45d44f){var _0x123548=_0x3889c0?_0xa307('0x3c'):_0xa6bde0[_0xa307('0x3d')];_0x123548=_0x45d44f?_0xa307('0x3e'):_0x123548;return{'actionid':_0xa6bde0['uniqueid'],'action':_0xa307('0x3f'),'channel':_0xa6bde0[_0xa307('0x40')],'callerid':util['format'](_0xa307('0x13'),_0x123548,_0xa6bde0['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x2e0ef9,'timeout':(_0x5a5c90['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xa6bde0[_0xa307('0x41')]};};exports[_0xa307('0x42')]=function(_0xc6dfcc){return _0xc6dfcc[_0xa307('0x43')]+_0xc6dfcc[_0xa307('0x44')]+_0xc6dfcc[_0xa307('0x45')]+_0xc6dfcc[_0xa307('0x46')]+_0xc6dfcc['countnosuchnumberretry'];};exports['cloneAction']=function(_0x213d25){var _0x15a2d3=_[_0xa307('0x47')](_0x213d25);_0x15a2d3['state']=0xf;_0x15a2d3['statedesc']=_0xa307('0x48');return _0x15a2d3;};exports['scheduledAt']=function(_0x46cc38,_0x5871ff,_0x1a45d9){var _0x351a7b={};_0x351a7b[_0x5871ff]=_0x46cc38[_0x5871ff];_0x351a7b[_0xa307('0x49')]=![];_0x351a7b[_0xa307('0x4a')]=moment()[_0xa307('0x4b')](_0x1a45d9,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x351a7b[_0xa307('0x4c')]=_0x46cc38['ContactId'];_0x351a7b['ListId']=_0x46cc38[_0xa307('0x4d')];_0x351a7b[_0xa307('0x17')]=_0x46cc38[_0xa307('0x17')]||undefined;return _0x351a7b;};exports[_0xa307('0x4e')]=function(_0x2901bc,_0x5636f8){if(!_['isNil'](_0x2901bc)){if(_0x2901bc['pTalking']>0x0){_0x2901bc[_0xa307('0x4f')]-=0x1;}else{logger[_0xa307('0x9')](_0x5636f8,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa307('0x9')](_0x5636f8,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xa307('0x50')]=function(_0x51a5d3){if(_0x51a5d3<=0x0){return!![];}return![];};exports[_0xa307('0x51')]=function(_0x4848fe,_0x47973c,_0x50235c){_0x4848fe[_0xa307('0x52')]=_0x47973c;_0x4848fe[_0xa307('0x53')]=_0x4848fe[_0xa307('0x54')];_0x4848fe[_0xa307('0x55')]=_0x4848fe[_0xa307('0x40')];_0x4848fe[_0xa307('0x56')]=_0xa307('0x57');if(_0x50235c){_0x4848fe[_0xa307('0x58')]=_0x50235c[_0xa307('0x58')];}return _0x4848fe;};exports[_0xa307('0x59')]=function(_0x456adc){var _0x553aa8={};_0x553aa8[_0xa307('0x54')]=_0x456adc[_0xa307('0x54')];_0x553aa8[_0xa307('0x55')]=_0x456adc[_0xa307('0x40')];_0x553aa8['uniqueid']=_0x456adc[_0xa307('0x41')];return _0x553aa8;};exports[_0xa307('0x5a')]=function(_0x46bb9d){var _0x5927c4=[];for(var _0x14987f in _0x46bb9d){if(_0x46bb9d[_0xa307('0x23')](_0x14987f)){if(!_['isNil'](_0x46bb9d[_0x14987f])&&_0x46bb9d[_0x14987f][_0xa307('0x2f')]===_0xa307('0x5b')&&_0x46bb9d[_0x14987f][_0xa307('0x5c')]===_0xa307('0x5d')){_0x5927c4[_0xa307('0x5e')](_0x46bb9d[_0x14987f]['id']);}}}return _0x5927c4;};exports[_0xa307('0x5f')]=function(_0x1b3cd4){var _0x1d1b37=moment()[_0xa307('0x6')](0x0);var _0x547f6d=moment(_0x1b3cd4)[_0xa307('0x6')](0x0);return _0x1d1b37[_0xa307('0x60')](_0x547f6d,_0xa307('0x7'));};exports[_0xa307('0x61')]=function(_0x501579){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x501579[_0xa307('0x4c')],'ListId':_0x501579['ListId'],'VoiceQueueId':_0x501579[_0xa307('0x17')]||undefined,'CampaignId':_0x501579[_0xa307('0x62')]||undefined};};exports[_0xa307('0x63')]=function(_0x4f3b19){if(_0x4f3b19===_0xa307('0x41')||_0x4f3b19===_0xa307('0x64')||_0x4f3b19==='queue'||_0x4f3b19===_0xa307('0x65')||_0x4f3b19===_0xa307('0x66')||_0x4f3b19===_0xa307('0x67')||_0x4f3b19===_0xa307('0x35')||_0x4f3b19==='channelAgent'||_0x4f3b19==='calleridname'||_0x4f3b19===_0xa307('0x49')||_0x4f3b19===_0xa307('0x16')||_0x4f3b19==='scheduledat'||_0x4f3b19==='countbusyretry'||_0x4f3b19===_0xa307('0x44')||_0x4f3b19===_0xa307('0x45')||_0x4f3b19==='countglobal'||_0x4f3b19===_0xa307('0x68')||_0x4f3b19===_0xa307('0x69')||_0x4f3b19===_0xa307('0x6a')||_0x4f3b19==='recallme'||_0x4f3b19===_0xa307('0x4c')||_0x4f3b19===_0xa307('0x4d')||_0x4f3b19===_0xa307('0x36')||_0x4f3b19===_0xa307('0x17')||_0x4f3b19===_0xa307('0x6b')||_0x4f3b19==='xmd-voicequeueid'||_0x4f3b19==='xmd-queue'||_0x4f3b19===_0xa307('0x6c')||_0x4f3b19==='xmd-listid'||_0x4f3b19===_0xa307('0x6d')||_0x4f3b19===_0xa307('0x6e')||_0x4f3b19==='xmd-dialoptions'||_0x4f3b19==='xmd-dialid'||_0x4f3b19===_0xa307('0x6f')||_0x4f3b19===_0xa307('0x70')||_0x4f3b19===_0xa307('0x71')||_0x4f3b19==='xmd-callerid'||_0x4f3b19===_0xa307('0x72')||_0x4f3b19===_0xa307('0x73')||_0x4f3b19===_0xa307('0x74')||_0x4f3b19===_0xa307('0x75')||_0x4f3b19==='rtpaudioqosjitter'||_0x4f3b19===_0xa307('0x76')||_0x4f3b19===_0xa307('0x77')||_0x4f3b19===_0xa307('0x78')||_0x4f3b19===_0xa307('0x79')||_0x4f3b19===_0xa307('0x7a')||_0x4f3b19===_0xa307('0x74')||_0x4f3b19==='rtpaudioqosbridged'||_0x4f3b19===_0xa307('0x7b')||_0x4f3b19==='rtpaudioqosjitterbridged'||_0x4f3b19===_0xa307('0x77')||_0x4f3b19===_0xa307('0x78')||_0x4f3b19==='rtpaudioqosrtt'||_0x4f3b19===_0xa307('0x7a')||_0x4f3b19==='bridgepeer'||_0x4f3b19==='bridgepvtcallid'||_0x4f3b19===_0xa307('0x2f')||_0x4f3b19===_0xa307('0x30')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x299ada,_0x5ba97e){var _0x5afd9c,_0x443673,_0x5c6417;if(_0x5ba97e<=0x0){_0x5ba97e=0x1;}_0x5afd9c=new RegExp(_0xa307('0x7c')+_0x5ba97e+'}$');_0x443673=Math[_0xa307('0x7d')](0xa,_0x5ba97e-0x1);_0x5c6417=Math[_0xa307('0x7d')](0xa,_0x5ba97e)-0x1;return util[_0xa307('0x12')]('%s',_[_0xa307('0x7e')](_0x299ada,_0x5afd9c,_[_0xa307('0x7f')](_0x443673,_0x5c6417)));};exports[_0xa307('0x80')]=function(_0x4d3081){var _0x44d761=_0x4d3081[_0xa307('0x81')](/"(.*?)"/);return _0x44d761?_0x44d761[0x1]:_0x4d3081;};exports[_0xa307('0x82')]=function(_0x5be87a){var _0x112604=_0x5be87a[_0xa307('0x81')](/<(.*?)>/);return _0x112604?_0x112604[0x1]:_0x5be87a;}; \ No newline at end of file +var _0x18e3=['loggerError','logger2','message','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','agentReadyId','not_inuse','reachable','createBody','idContact','campaigntype','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x18e3,0x193));var _0x318e=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x18e3[_0xdc37a1];return _0x99b4fe;};'use strict';var util=require(_0x318e('0x0'));var _=require(_0x318e('0x1'));var moment=require(_0x318e('0x2'));var logger=require(_0x318e('0x3'))('preview');var ipAgi=process[_0x318e('0x4')]['XCALLY_IP_AGI']||_0x318e('0x5');function getSeconds(_0x135f2c,_0x231746){var _0x378f9d=moment(_0x135f2c)[_0x318e('0x6')](0x0);var _0x90c1fa=moment(_0x231746)['milliseconds'](0x0);return _0x378f9d[_0x318e('0x7')](_0x90c1fa,_0x318e('0x8'));}exports[_0x318e('0x9')]=function(_0x3931a6){return function(_0x131b91){logger[_0x318e('0xa')](_0x3931a6,util['inspect'](_0x131b91,{'showHidden':![],'depth':null}));};};exports[_0x318e('0xb')]=function(_0xc0b23e,_0x307af1){logger[_0x318e('0xc')](_0xc0b23e,util[_0x318e('0xd')](_0x307af1,{'showHidden':![],'depth':null}));};exports[_0x318e('0xe')]=function(_0x5d8e1c,_0x4ee797){logger[_0x318e('0xa')](_0x5d8e1c,util[_0x318e('0xd')](_0x4ee797,{'showHidden':![],'depth':null}));};exports[_0x318e('0xf')]=function(_0x22468a){return function(_0x4b0700){logger[_0x318e('0xc')](_0x22468a,util[_0x318e('0xd')](_0x4b0700,{'showHidden':![],'depth':null}));};};exports[_0x318e('0x10')]=function(_0x2479c4,_0x3972db,_0x736ba4){return{'message':_0x2479c4,'unlock':_0x3972db,'active':_0x736ba4};};exports['getCallerId']=function(_0x4805c0,_0x4266f4,_0x45e804){if(!_[_0x318e('0x11')](_0x45e804)&&_0x318e('0x12')===typeof _0x45e804&&!_['isEmpty'](_0x45e804)){if(!_[_0x318e('0x11')](_0x4266f4)&&_0x318e('0x12')===typeof _0x4266f4&&!_[_0x318e('0x13')](_0x4266f4)){return util['format'](_0x318e('0x14'),_0x4266f4,_0x45e804);}return util[_0x318e('0x15')](_0x318e('0x14'),_0x45e804,_0x45e804);}if(!_['isUndefined'](_0x4805c0)&&_0x318e('0x12')===typeof _0x4805c0&&!_[_0x318e('0x13')](_0x4805c0)){return _0x4805c0;}return _0x318e('0x16');};exports[_0x318e('0x17')]=function(_0x4e8249){if(_[_0x318e('0x18')](_0x4e8249)){return![];}return _0x4e8249;};exports[_0x318e('0x19')]=function(_0x2bfb62,_0x44db30,_0x18326b,_0x163c7c,_0x5e55ef,_0x240440){var _0x354448={'XMD-QUEUE':_0x44db30['Queue']?_0x44db30[_0x318e('0x1a')][_0x318e('0x1b')]:'','XMD-CALLERID':_0x163c7c,'XMD-CALLERID-PREVIEW':_0x240440?util['format']('\x22%s\x22\x20<%s>',_0x240440['calleridname'],_0x240440[_0x318e('0x1c')]):_0x163c7c,'XMD-DIALID':_0x5e55ef,'XMD-CONTACTID':_0x44db30['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x163c7c,'XMD-VOICEQUEUEID':_0x44db30[_0x318e('0x1d')],'XMD-DIALCHANNEL':_0x18326b,'XMD-DIALTIMEOUT':_0x2bfb62[_0x318e('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x318e('0x15')](_0x318e('0x1f'),_0x2bfb62[_0x318e('0x20')]?'g':'',_[_0x318e('0x13')](_0x2bfb62[_0x318e('0x21')])?'':_0x318e('0x22')),'XMD-DIALURL':_0x2bfb62['dialPreviewUrl']||'','XMD-AGI':_0x2bfb62[_0x318e('0x23')]?util[_0x318e('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2bfb62[_0x318e('0x23')]):'NONE','XMD-AGIAFTER':_0x2bfb62['dialQueueProject2']?util['format'](_0x318e('0x24'),ipAgi,_0x2bfb62[_0x318e('0x20')]):_0x318e('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x240440?_0x240440[_0x318e('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x240440?_0x240440[_0x318e('0x27')]:'','XMD-DESTINATION':_0x318e('0x28')};if(!_[_0x318e('0x13')](_0x2bfb62[_0x318e('0x21')])){_0x354448[util[_0x318e('0x15')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2bfb62[_0x318e('0x21')];_0x354448[util[_0x318e('0x15')]('%s',_0x318e('0x29'))]=_0x5e55ef;}if(_0x44db30&&_0x44db30[_0x318e('0x2a')]){for(var _0x45b271 in _0x44db30[_0x318e('0x2a')]){if(_0x44db30[_0x318e('0x2a')][_0x318e('0x2b')](_0x45b271)){if(!_['isNil'](_0x44db30['Contact'][_0x45b271])&&_0x45b271!=='id'&&_0x45b271!=='tags'&&_0x45b271!=='createdAt'&&_0x45b271!==_0x318e('0x2c')){_0x354448[util['format'](_0x318e('0x2d'),_0x318e('0x2e'),_[_0x318e('0x2f')](_0x45b271))]=_0x44db30[_0x318e('0x2a')][_0x45b271];}}}}return _0x354448;};exports[_0x318e('0x30')]=function(_0x4e609d){var _0x5a34ca={};for(var _0x29d8fb in _0x4e609d){if(_0x4e609d[_0x318e('0x2b')](_0x29d8fb)){_0x5a34ca[util[_0x318e('0x15')]('%s',_[_0x318e('0x31')](_0x29d8fb))]=_0x4e609d[_0x29d8fb];}}return{'variables':_0x5a34ca};};exports['updateOriginated']=function(_0x139330,_0x44e5df){if(!_[_0x318e('0x18')](_0x139330)){if(_0x139330[_0x318e('0x2b')]('originated')){if(_0x139330[_0x318e('0x32')]>0x0){_0x139330['originated']-=0x1;}else{logger[_0x318e('0xa')](_0x318e('0x33'),_0x44e5df);}}}else{logger[_0x318e('0xa')](_0x318e('0x34'),_0x44e5df);}};exports[_0x318e('0x35')]=function(_0x1f7518){var _0x1ae5c9=moment()[_0x318e('0x15')](_0x318e('0x36'));_0x1f7518[_0x318e('0x37')]=0xd;_0x1f7518['statedesc']='Blacklist';_0x1f7518[_0x318e('0x38')]=_0x1ae5c9;_0x1f7518[_0x318e('0x39')]=_0x1ae5c9;_0x1f7518[_0x318e('0x3a')]=_0x1ae5c9;};exports[_0x318e('0x3b')]=function(_0x4c4c0c,_0xafeeeb,_0x465afc){var _0x7fd4df=moment()[_0x318e('0x15')](_0x318e('0x36'));_0x4c4c0c[_0x318e('0x37')]=_0xafeeeb;_0x4c4c0c[_0x318e('0x3c')]=_0x465afc;_0x4c4c0c[_0x318e('0x39')]=_0x7fd4df;_0x4c4c0c[_0x318e('0x3d')]=getSeconds(_0x4c4c0c[_0x318e('0x39')],_0x4c4c0c[_0x318e('0x38')]);};exports[_0x318e('0x3e')]=function(_0x5e4cdf,_0x1d2190,_0x2794ab){_0x5e4cdf[_0x318e('0x3f')]=_0x1d2190;_0x5e4cdf[_0x318e('0x40')]=_0x2794ab;};exports[_0x318e('0x41')]=function(_0x2fa282,_0x54865b,_0x30e62b){var _0xd6fa16=moment()[_0x318e('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x2fa282[_0x318e('0x37')]=_0x54865b;_0x2fa282['statedesc']=_0x30e62b;_0x2fa282[_0x318e('0x39')]=_0x2fa282['responsetime']?_0x2fa282['responsetime']:_0xd6fa16;_0x2fa282[_0x318e('0x3a')]=_0x2fa282[_0x318e('0x3a')]?_0x2fa282[_0x318e('0x3a')]:_0xd6fa16;_0x2fa282[_0x318e('0x3d')]=getSeconds(_0x2fa282[_0x318e('0x39')]||0x0,_0x2fa282[_0x318e('0x38')]||0x0);_0x2fa282[_0x318e('0x42')]=_0x2fa282[_0x318e('0x43')]?getSeconds(_0x2fa282[_0x318e('0x3a')],_0x2fa282['answertime']):0x0;};exports[_0x318e('0x44')]=function(_0x4a48f1){return _0x4a48f1===_0x318e('0x45');};exports[_0x318e('0x46')]=function(_0x39a0c5,_0x284d62,_0x5a4c30,_0x814fb6,_0x1e713f){var _0x221c7b=_0x814fb6?'RECALL':_0x39a0c5[_0x318e('0x47')];_0x221c7b=_0x1e713f?_0x318e('0x48'):_0x221c7b;return{'actionid':_0x39a0c5[_0x318e('0x49')],'action':_0x318e('0x4a'),'channel':_0x39a0c5['channelAgent'],'callerid':util['format'](_0x318e('0x14'),_0x221c7b,_0x39a0c5[_0x318e('0x1c')]),'Exten':_0x318e('0x28'),'Context':_0x318e('0x4b'),'Priority':'1','variable':_0x5a4c30,'timeout':(_0x284d62[_0x318e('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x39a0c5[_0x318e('0x49')]};};exports[_0x318e('0x4d')]=function(_0x5ab15e){return _0x5ab15e[_0x318e('0x4e')]+_0x5ab15e[_0x318e('0x4f')]+_0x5ab15e[_0x318e('0x50')]+_0x5ab15e[_0x318e('0x51')]+_0x5ab15e[_0x318e('0x52')];};exports[_0x318e('0x53')]=function(_0x174784){var _0x43d890=_['clone'](_0x174784);_0x43d890[_0x318e('0x37')]=0xf;_0x43d890[_0x318e('0x3c')]=_0x318e('0x54');return _0x43d890;};exports[_0x318e('0x55')]=function(_0x2692d6,_0x323522,_0x1dccde){var _0x291d93={};_0x291d93[_0x323522]=_0x2692d6[_0x323522];_0x291d93['active']=![];_0x291d93['scheduledat']=moment()[_0x318e('0x56')](_0x1dccde,_0x318e('0x57'))[_0x318e('0x15')](_0x318e('0x36'));_0x291d93[_0x318e('0x58')]=_0x2692d6[_0x318e('0x58')];_0x291d93['ListId']=_0x2692d6[_0x318e('0x59')];_0x291d93[_0x318e('0x1d')]=_0x2692d6[_0x318e('0x1d')]||undefined;return _0x291d93;};exports[_0x318e('0x5a')]=function(_0x49182c,_0x30e9a1){if(!_['isNil'](_0x49182c)){if(_0x49182c[_0x318e('0x5b')]>0x0){_0x49182c[_0x318e('0x5b')]-=0x1;}else{logger['error'](_0x30e9a1,_0x318e('0x5c'));}}else{logger[_0x318e('0xa')](_0x30e9a1,_0x318e('0x5d'));}};exports['IsNotLoggedIn']=function(_0x3f41d6){if(_0x3f41d6<=0x0){return!![];}return![];};exports[_0x318e('0x5e')]=function(_0x533ac6,_0x5b913b,_0x28b602){_0x533ac6[_0x318e('0x5f')]=_0x5b913b;_0x533ac6[_0x318e('0x1b')]=_0x533ac6[_0x318e('0x60')];_0x533ac6[_0x318e('0x61')]=_0x533ac6[_0x318e('0x62')];_0x533ac6[_0x318e('0x63')]=_0x318e('0x64');if(_0x28b602){_0x533ac6[_0x318e('0x65')]=_0x28b602[_0x318e('0x65')];}return _0x533ac6;};exports['buildAcw']=function(_0x4fc9cd){var _0x66c8b={};_0x66c8b[_0x318e('0x60')]=_0x4fc9cd[_0x318e('0x60')];_0x66c8b[_0x318e('0x61')]=_0x4fc9cd[_0x318e('0x62')];_0x66c8b['uniqueid']=_0x4fc9cd['uniqueid'];return _0x66c8b;};exports[_0x318e('0x66')]=function(_0xa44bab){var _0x2aa487=[];for(var _0x3d9e83 in _0xa44bab){if(_0xa44bab[_0x318e('0x2b')](_0x3d9e83)){if(!_['isNil'](_0xa44bab[_0x3d9e83])&&_0xa44bab[_0x3d9e83][_0x318e('0x37')]===_0x318e('0x67')&&_0xa44bab[_0x3d9e83]['status']===_0x318e('0x68')){_0x2aa487['push'](_0xa44bab[_0x3d9e83]['id']);}}}return _0x2aa487;};exports['getDiff']=function(_0x30e4c4){var _0x4a0dcd=moment()[_0x318e('0x6')](0x0);var _0x55d6d2=moment(_0x30e4c4)[_0x318e('0x6')](0x0);return _0x4a0dcd['diff'](_0x55d6d2,_0x318e('0x8'));};exports[_0x318e('0x69')]=function(_0x4028ed){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4028ed[_0x318e('0x58')],'ListId':_0x4028ed['ListId'],'VoiceQueueId':_0x4028ed[_0x318e('0x1d')]||undefined,'CampaignId':_0x4028ed['CampaignId']||undefined};};exports['filterKey']=function(_0x12b994){if(_0x12b994===_0x318e('0x49')||_0x12b994===_0x318e('0x6a')||_0x12b994===_0x318e('0x60')||_0x12b994==='type'||_0x12b994===_0x318e('0x6b')||_0x12b994==='dialAnswer'||_0x12b994===_0x318e('0x3f')||_0x12b994===_0x318e('0x62')||_0x12b994===_0x318e('0x47')||_0x12b994==='active'||_0x12b994===_0x318e('0x1c')||_0x12b994==='scheduledat'||_0x12b994===_0x318e('0x4e')||_0x12b994===_0x318e('0x4f')||_0x12b994===_0x318e('0x50')||_0x12b994==='countglobal'||_0x12b994===_0x318e('0x6c')||_0x12b994==='callbackuniqueid'||_0x12b994==='callbackat'||_0x12b994===_0x318e('0x6d')||_0x12b994==='ContactId'||_0x12b994==='ListId'||_0x12b994==='UserId'||_0x12b994==='VoiceQueueId'||_0x12b994===_0x318e('0x6e')||_0x12b994===_0x318e('0x6f')||_0x12b994===_0x318e('0x70')||_0x12b994===_0x318e('0x71')||_0x12b994===_0x318e('0x72')||_0x12b994===_0x318e('0x73')||_0x12b994===_0x318e('0x74')||_0x12b994==='xmd-dialoptions'||_0x12b994===_0x318e('0x75')||_0x12b994===_0x318e('0x76')||_0x12b994===_0x318e('0x77')||_0x12b994===_0x318e('0x78')||_0x12b994===_0x318e('0x79')||_0x12b994===_0x318e('0x7a')||_0x12b994===_0x318e('0x7b')||_0x12b994===_0x318e('0x7c')||_0x12b994===_0x318e('0x7d')||_0x12b994==='rtpaudioqosjitter'||_0x12b994===_0x318e('0x7e')||_0x12b994===_0x318e('0x7f')||_0x12b994===_0x318e('0x80')||_0x12b994==='rtpaudioqosrtt'||_0x12b994==='rtpaudioqosrttbridged'||_0x12b994===_0x318e('0x7c')||_0x12b994==='rtpaudioqosbridged'||_0x12b994==='rtpaudioqosjitter'||_0x12b994===_0x318e('0x7e')||_0x12b994===_0x318e('0x7f')||_0x12b994===_0x318e('0x80')||_0x12b994===_0x318e('0x81')||_0x12b994===_0x318e('0x82')||_0x12b994===_0x318e('0x83')||_0x12b994===_0x318e('0x84')||_0x12b994===_0x318e('0x37')||_0x12b994==='statedesc'){return![];}return!![];};exports[_0x318e('0x85')]=function(_0x2277aa,_0x1cff3f){var _0x2a9d3f,_0xd9ed40,_0x1fe0bc;if(_0x1cff3f<=0x0){_0x1cff3f=0x1;}_0x2a9d3f=new RegExp(_0x318e('0x86')+_0x1cff3f+'}$');_0xd9ed40=Math['pow'](0xa,_0x1cff3f-0x1);_0x1fe0bc=Math['pow'](0xa,_0x1cff3f)-0x1;return util[_0x318e('0x15')]('%s',_[_0x318e('0x87')](_0x2277aa,_0x2a9d3f,_[_0x318e('0x88')](_0xd9ed40,_0x1fe0bc)));};exports['extractCalleridName']=function(_0x32be14){var _0x5acd2c=_0x32be14[_0x318e('0x89')](/"(.*?)"/);return _0x5acd2c?_0x5acd2c[0x1]:_0x32be14;};exports[_0x318e('0x8a')]=function(_0x344456){var _0x1af351=_0x344456[_0x318e('0x89')](/<(.*?)>/);return _0x1af351?_0x1af351[0x1]:_0x344456;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e96bc30..06902b6 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 _0xcd98=['queueadd','string','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup'];(function(_0x2326b8,_0x3b62f7){var _0x363f62=function(_0x4b01fc){while(--_0x4b01fc){_0x2326b8['push'](_0x2326b8['shift']());}};_0x363f62(++_0x3b62f7);}(_0xcd98,0x1e3));var _0x8cd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd98[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0x8cd9('0x0')]={'queue':{'type':_0x8cd9('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x8cd9('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x8cd9('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x8cd9('0x1'),'required':!![]},'interface':{'type':_0x8cd9('0x1'),'required':!![]}};exports[_0x8cd9('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x8cd9('0x2')},'reason':{'type':_0x8cd9('0x1'),'required':![]}};exports[_0x8cd9('0x4')]={'module':{'type':_0x8cd9('0x1'),'required':![]}};exports[_0x8cd9('0x5')]={'uniqueid':{'type':_0x8cd9('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x8cd9('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x8cd9('0x1')},'mixmonitorid':{'type':_0x8cd9('0x1')}};exports[_0x8cd9('0x6')]={'uniqueid':{'type':_0x8cd9('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8cd9('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xbdbf=['string','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x316b9e,_0x23efae){var _0x68298b=function(_0x36120b){while(--_0x36120b){_0x316b9e['push'](_0x316b9e['shift']());}};_0x68298b(++_0x23efae);}(_0xbdbf,0x177));var _0xfbdb=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xbdbf[_0x2f45ea];return _0x485a84;};'use strict';exports[_0xfbdb('0x0')]={'queue':{'type':_0xfbdb('0x1'),'required':!![]},'interface':{'type':_0xfbdb('0x1'),'required':!![]},'membername':{'type':_0xfbdb('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xfbdb('0x2'),'required':![]}};exports[_0xfbdb('0x3')]={'queue':{'type':_0xfbdb('0x1'),'required':!![]},'interface':{'type':_0xfbdb('0x1'),'required':!![]}};exports[_0xfbdb('0x4')]={'interface':{'type':_0xfbdb('0x1'),'required':!![]},'paused':{'type':_0xfbdb('0x2')},'reason':{'type':_0xfbdb('0x1'),'required':![]}};exports[_0xfbdb('0x5')]={'module':{'type':_0xfbdb('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xfbdb('0x1'),'required':!![]}};exports[_0xfbdb('0x6')]={'uniqueid':{'type':_0xfbdb('0x1'),'required':!![]},'filename':{'type':_0xfbdb('0x1')},'format':{'type':_0xfbdb('0x1')},'mixmonitorid':{'type':_0xfbdb('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xfbdb('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xfbdb('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index be1c6c1..4a5cfab 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 _0x1e13=['freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','sumDuration','isEmpty','abandoned','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isNil','initTelephones','initTrunks','isUndefined','voiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','unmanaged','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','answered','seconds','disposition','ANSWERED','duration','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','settings','salesforceAccounts'];(function(_0x234d56,_0x4eee01){var _0xd47811=function(_0x52d2e0){while(--_0x52d2e0){_0x234d56['push'](_0x234d56['shift']());}};_0xd47811(++_0x4eee01);}(_0x1e13,0xad));var _0x31e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1e13[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x31e1('0x0'));var util=require(_0x31e1('0x1'));var _=require(_0x31e1('0x2'));var moment=require(_0x31e1('0x3'));var Agent=require(_0x31e1('0x4'));var Telephone=require(_0x31e1('0x5'));var Trunk=require(_0x31e1('0x6'));var VoiceQueue=require(_0x31e1('0x7'));var Trigger=require(_0x31e1('0x8'));var Template=require(_0x31e1('0x9'));var Campaign=require(_0x31e1('0xa'));var VoiceExtension=require(_0x31e1('0xb'));var ZendeskAccount=require(_0x31e1('0xc'));var SalesforceAccount=require(_0x31e1('0xd'));var FreshdeskAccount=require(_0x31e1('0xe'));var SugarcrmAccount=require(_0x31e1('0xf'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x31e1('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x31e1('0x11'));var Realtime=function(){this[_0x31e1('0x12')]={};this[_0x31e1('0x13')]={};this[_0x31e1('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x31e1('0x15')]={};this[_0x31e1('0x16')]={};this[_0x31e1('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x31e1('0x18')]={};this[_0x31e1('0x19')]={};this[_0x31e1('0x1a')]={};this['outboundChannels']={};this['timers']={};this[_0x31e1('0x1b')]={};this['zendeskAccounts']={};this[_0x31e1('0x1c')]={};this['sugarcrmAccounts']={};this[_0x31e1('0x1d')]={};this[_0x31e1('0x1e')]={};this[_0x31e1('0x1f')]={};this[_0x31e1('0x20')]={};this[_0x31e1('0x21')]={};this[_0x31e1('0x22')]={};this[_0x31e1('0x23')]={};this[_0x31e1('0x24')]={};};function freeIsNotKey(_0x53ee4b,_0x58d955,_0x2dd33b){var _0x1a7735=_[_0x31e1('0x25')](_0x53ee4b,function(_0x3965bc,_0x527e8e){return _0x3965bc[_0x2dd33b];});for(var _0x5f1ae8 in _0x58d955){if(_0x58d955[_0x31e1('0x26')](_0x5f1ae8)){if(!_0x1a7735[_0x5f1ae8]){delete _0x58d955[_0x5f1ae8];}}}}function freeIsNotKeySip(_0x139688,_0x26cb3a){var _0x5b14f1=_[_0x31e1('0x25')](_0x139688,function(_0x2a120a,_0x26827d){return util[_0x31e1('0x27')](_0x31e1('0x28'),_0x2a120a[_0x31e1('0x29')]);});for(var _0x1ab687 in _0x26cb3a){if(_0x26cb3a[_0x31e1('0x26')](_0x1ab687)){if(!_0x5b14f1[_0x1ab687]){delete _0x26cb3a[_0x1ab687];}}}}function freeIsNotKeyAgent(_0x2b4c5a,_0x165628){var _0x2d385a=_[_0x31e1('0x25')](_0x2b4c5a,function(_0x1e6d0d,_0x178559){var _0x50f0b9=_['isNil'](_0x1e6d0d[_0x31e1('0x2a')])?util[_0x31e1('0x27')](_0x31e1('0x28'),_0x1e6d0d['name']):_0x1e6d0d[_0x31e1('0x2a')];return _0x50f0b9;});for(var _0x54b42f in _0x165628){if(_0x165628[_0x31e1('0x26')](_0x54b42f)){if(!_0x2d385a[_0x54b42f]){delete _0x165628[_0x54b42f];}}}}function clearVoiceCallReports(_0x17fb49){_0x17fb49[_0x31e1('0x2b')]=0x0;_0x17fb49['answered']=0x0;_0x17fb49['sumHoldTime']=0x0;_0x17fb49[_0x31e1('0x2c')]=0x0;_0x17fb49['sumBillable']=0x0;}function clearCampaigns(_0x14b087){if(!_[_0x31e1('0x2d')](_0x14b087)){for(var _0x3a1f05 in _0x14b087){if(_0x14b087[_0x31e1('0x26')](_0x3a1f05)){_0x14b087[_0x3a1f05]['ivrTotalCallsDays']=0x0;_0x14b087[_0x3a1f05]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3f0ba8){if(!_['isEmpty'](_0x3f0ba8)){for(var _0x14e45f in _0x3f0ba8){if(_0x3f0ba8[_0x31e1('0x26')](_0x14e45f)){_0x3f0ba8[_0x14e45f][_0x31e1('0x2b')]=0x0;_0x3f0ba8[_0x14e45f]['answered']=0x0;_0x3f0ba8[_0x14e45f]['unmanaged']=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x2e')]=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x2f')]=0x0;_0x3f0ba8[_0x14e45f]['sumDuration']=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x30')]=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x31')]=0x0;_0x3f0ba8[_0x14e45f]['outboundNoAnswerCallsDay']=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x32')]=0x0;_0x3f0ba8[_0x14e45f]['outboundCongestionCallsDay']=0x0;_0x3f0ba8[_0x14e45f]['outboundNoSuchCallsDay']=0x0;_0x3f0ba8[_0x14e45f]['outboundUnknownCallsDay']=0x0;_0x3f0ba8[_0x14e45f]['outboundDropCallsDayTimeout']=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x33')]=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x34')]=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x35')]=0x0;_0x3f0ba8[_0x14e45f]['outboundRejectCallsDay']=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x36')]=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x31')]=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x37')]=0x0;_0x3f0ba8[_0x14e45f][_0x31e1('0x38')]=!![];}}}}Realtime[_0x31e1('0x39')][_0x31e1('0x3a')]=function(_0x287ac3,_0x2b091f){for(var _0x4aedaa in _0x2b091f){if(_0x287ac3[_0x31e1('0x26')](_0x4aedaa)){_0x287ac3[_0x4aedaa]=_0x2b091f[_0x4aedaa];}}};Realtime[_0x31e1('0x39')][_0x31e1('0x3b')]=function(){var _0x2ef6ae=this;return function(_0x53bdd3){if(_0x53bdd3){freeIsNotKeyAgent(_0x53bdd3,_0x2ef6ae[_0x31e1('0x12')]);for(var _0x2c6991=0x0,_0x15fc94={},_0x3d3c5b={};_0x2c6991<_0x53bdd3[_0x31e1('0x3c')];_0x2c6991+=0x1){_0x15fc94=_0x53bdd3[_0x2c6991];var _0x28f3a1=_[_0x31e1('0x3d')](_0x15fc94['interface'])?util['format'](_0x31e1('0x28'),_0x15fc94[_0x31e1('0x29')]):_0x15fc94[_0x31e1('0x2a')];if(_['isUndefined'](_0x2ef6ae['agents'][_0x28f3a1])){_0x2ef6ae[_0x31e1('0x12')][_0x28f3a1]=new Agent(_0x15fc94);}else{_0x2ef6ae[_0x31e1('0x3a')](_0x2ef6ae[_0x31e1('0x12')][_0x28f3a1],_0x15fc94);}}}return _0x2ef6ae['agents'];};};Realtime[_0x31e1('0x39')][_0x31e1('0x3e')]=function(){var _0x4d6c82=this;return function(_0x4e97b5){if(_0x4e97b5){freeIsNotKeySip(_0x4e97b5,_0x4d6c82[_0x31e1('0x13')]);for(var _0x21a175=0x0,_0x27703e={},_0x3f5f99={};_0x21a175<_0x4e97b5[_0x31e1('0x3c')];_0x21a175+=0x1){_0x27703e=_0x4e97b5[_0x21a175];if(_['isUndefined'](_0x4d6c82['telephones'][util[_0x31e1('0x27')](_0x31e1('0x28'),_0x27703e['name'])])){_0x4d6c82['telephones'][util[_0x31e1('0x27')](_0x31e1('0x28'),_0x27703e[_0x31e1('0x29')])]=new Telephone(_0x27703e);}else{_0x4d6c82[_0x31e1('0x3a')](_0x4d6c82[_0x31e1('0x13')][util['format'](_0x31e1('0x28'),_0x27703e[_0x31e1('0x29')])],_0x27703e);}}}return _0x4d6c82[_0x31e1('0x13')];};};Realtime[_0x31e1('0x39')][_0x31e1('0x3f')]=function(){var _0x466566=this;return function(_0x485337){if(_0x485337){freeIsNotKeySip(_0x485337,_0x466566[_0x31e1('0x14')]);for(var _0x1ca411=0x0,_0x37d7d7={},_0x532c9e={};_0x1ca411<_0x485337[_0x31e1('0x3c')];_0x1ca411+=0x1){_0x37d7d7=_0x485337[_0x1ca411];if(_[_0x31e1('0x40')](_0x466566[_0x31e1('0x14')][util[_0x31e1('0x27')](_0x31e1('0x28'),_0x37d7d7[_0x31e1('0x29')])])){_0x466566[_0x31e1('0x14')][util[_0x31e1('0x27')](_0x31e1('0x28'),_0x37d7d7[_0x31e1('0x29')])]=new Trunk(_0x37d7d7);}else{_0x466566[_0x31e1('0x3a')](_0x466566[_0x31e1('0x14')][util[_0x31e1('0x27')](_0x31e1('0x28'),_0x37d7d7[_0x31e1('0x29')])],_0x37d7d7);}}}return _0x466566[_0x31e1('0x14')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x579cf6=this;return function(_0x34f7dc){if(_0x34f7dc){freeIsNotKey(_0x34f7dc,_0x579cf6[_0x31e1('0x41')],_0x31e1('0x29'));for(var _0x372e8a=0x0,_0x190a6b={},_0x36f1d7={};_0x372e8a<_0x34f7dc[_0x31e1('0x3c')];_0x372e8a+=0x1){_0x190a6b=_0x34f7dc[_0x372e8a];if(_[_0x31e1('0x40')](_0x579cf6[_0x31e1('0x41')][_0x190a6b[_0x31e1('0x29')]])){_0x579cf6[_0x31e1('0x41')][_0x190a6b[_0x31e1('0x29')]]=new VoiceQueue(_0x190a6b);}else{_0x579cf6[_0x31e1('0x3a')](_0x579cf6['voiceQueues'][_0x190a6b[_0x31e1('0x29')]],_0x190a6b);}}}return _0x579cf6['voiceQueues'];};};Realtime['prototype'][_0x31e1('0x42')]=function(){var _0x5788f6=this;return function(_0x376fbc){if(_0x376fbc){freeIsNotKey(_0x376fbc,_0x5788f6[_0x31e1('0x43')],'id');for(var _0x18fc47=0x0,_0x3f77d2={},_0x5db589={};_0x18fc47<_0x376fbc[_0x31e1('0x3c')];_0x18fc47+=0x1){_0x3f77d2=_0x376fbc[_0x18fc47];if(_[_0x31e1('0x40')](_0x5788f6[_0x31e1('0x43')][_0x3f77d2['id']])){_0x5788f6[_0x31e1('0x43')][_0x3f77d2['id']]=new Trigger(_0x3f77d2);}else{_0x5788f6[_0x31e1('0x3a')](_0x5788f6[_0x31e1('0x43')][_0x3f77d2['id']],_0x3f77d2);}}}return _0x5788f6['triggers'];};};Realtime['prototype'][_0x31e1('0x44')]=function(){var _0x15c852=this;return function(_0x184c0b){if(_0x184c0b){freeIsNotKey(_0x184c0b,_0x15c852[_0x31e1('0x16')],'id');for(var _0x3fac37=0x0,_0x1d895e={},_0x2360fd={};_0x3fac37<_0x184c0b[_0x31e1('0x3c')];_0x3fac37+=0x1){_0x1d895e=_0x184c0b[_0x3fac37];if(_[_0x31e1('0x40')](_0x15c852[_0x31e1('0x16')][_0x1d895e['id']])){_0x15c852['templates'][_0x1d895e['id']]=new Template(_0x1d895e);}else{_0x15c852[_0x31e1('0x3a')](_0x15c852[_0x31e1('0x16')][_0x1d895e['id']],_0x1d895e);}}}return _0x15c852[_0x31e1('0x16')];};};Realtime['prototype'][_0x31e1('0x45')]=function(){var _0x399c3e=this;return function(_0x2ef05f){if(_0x2ef05f){freeIsNotKey(_0x2ef05f,_0x399c3e[_0x31e1('0x46')],'id');for(var _0x2eb933=0x0,_0x446bbe={},_0x1be0c9={};_0x2eb933<_0x2ef05f[_0x31e1('0x3c')];_0x2eb933+=0x1){_0x446bbe=_0x2ef05f[_0x2eb933];if(_[_0x31e1('0x40')](_0x399c3e[_0x31e1('0x46')][_0x446bbe['id']])){_0x399c3e[_0x31e1('0x46')][_0x446bbe['id']]=new ZendeskAccount(_0x446bbe);}else{_0x399c3e[_0x31e1('0x3a')](_0x399c3e[_0x31e1('0x46')][_0x446bbe['id']],_0x446bbe);}}}return _0x399c3e[_0x31e1('0x46')];};};Realtime['prototype'][_0x31e1('0x47')]=function(){var _0x256064=this;return function(_0x3ff062){if(_0x3ff062){freeIsNotKey(_0x3ff062,_0x256064['salesforceAccounts'],'id');for(var _0x2dfd45=0x0,_0x47e4b6={},_0x1c5c97={};_0x2dfd45<_0x3ff062['length'];_0x2dfd45+=0x1){_0x47e4b6=_0x3ff062[_0x2dfd45];if(_[_0x31e1('0x40')](_0x256064[_0x31e1('0x1c')][_0x47e4b6['id']])){_0x256064[_0x31e1('0x1c')][_0x47e4b6['id']]=new SalesforceAccount(_0x47e4b6);}else{_0x256064[_0x31e1('0x3a')](_0x256064[_0x31e1('0x1c')][_0x47e4b6['id']],_0x47e4b6);}}}return _0x256064[_0x31e1('0x1c')];};};Realtime[_0x31e1('0x39')]['initFreshdeskAccounts']=function(){var _0x49624f=this;return function(_0x53b7ef){if(_0x53b7ef){freeIsNotKey(_0x53b7ef,_0x49624f[_0x31e1('0x1d')],'id');for(var _0x320b01=0x0,_0x1090cb={},_0x290316={};_0x320b01<_0x53b7ef[_0x31e1('0x3c')];_0x320b01+=0x1){_0x1090cb=_0x53b7ef[_0x320b01];if(_[_0x31e1('0x40')](_0x49624f[_0x31e1('0x1d')][_0x1090cb['id']])){_0x49624f['freshdeskAccounts'][_0x1090cb['id']]=new FreshdeskAccount(_0x1090cb);}else{_0x49624f[_0x31e1('0x3a')](_0x49624f[_0x31e1('0x1d')][_0x1090cb['id']],_0x1090cb);}}}return _0x49624f[_0x31e1('0x1d')];};};Realtime[_0x31e1('0x39')]['initZohoAccounts']=function(){var _0x20af0e=this;return function(_0x1917a7){if(_0x1917a7){freeIsNotKey(_0x1917a7,_0x20af0e[_0x31e1('0x1e')],'id');for(var _0x173072=0x0,_0x2d3838={},_0x2899d8={};_0x173072<_0x1917a7[_0x31e1('0x3c')];_0x173072+=0x1){_0x2d3838=_0x1917a7[_0x173072];if(_[_0x31e1('0x40')](_0x20af0e[_0x31e1('0x1e')][_0x2d3838['id']])){_0x20af0e['zohoAccounts'][_0x2d3838['id']]=new ZohoAccount(_0x2d3838);}else{_0x20af0e[_0x31e1('0x3a')](_0x20af0e[_0x31e1('0x1e')][_0x2d3838['id']],_0x2d3838);}}}return _0x20af0e['zohoAccounts'];};};Realtime['prototype'][_0x31e1('0x48')]=function(){var _0xc15039=this;return function(_0x56a838){if(_0x56a838){freeIsNotKey(_0x56a838,_0xc15039[_0x31e1('0x1f')],'id');for(var _0x33367c=0x0,_0x4c94fd={},_0x2f316b={};_0x33367c<_0x56a838[_0x31e1('0x3c')];_0x33367c+=0x1){_0x4c94fd=_0x56a838[_0x33367c];if(_['isUndefined'](_0xc15039[_0x31e1('0x1f')][_0x4c94fd['id']])){_0xc15039[_0x31e1('0x1f')][_0x4c94fd['id']]=new DeskAccount(_0x4c94fd);}else{_0xc15039[_0x31e1('0x3a')](_0xc15039['deskAccounts'][_0x4c94fd['id']],_0x4c94fd);}}}return _0xc15039[_0x31e1('0x1f')];};};Realtime[_0x31e1('0x39')][_0x31e1('0x49')]=function(){var _0x27bff2=this;return function(_0x50c2f8){if(_0x50c2f8){freeIsNotKey(_0x50c2f8,_0x27bff2[_0x31e1('0x4a')],'id');for(var _0x2f1dda=0x0,_0x3bf7b2={},_0x236b81={};_0x2f1dda<_0x50c2f8[_0x31e1('0x3c')];_0x2f1dda+=0x1){_0x3bf7b2=_0x50c2f8[_0x2f1dda];if(_[_0x31e1('0x40')](_0x27bff2['sugarcrmAccounts'][_0x3bf7b2['id']])){_0x27bff2[_0x31e1('0x4a')][_0x3bf7b2['id']]=new SugarcrmAccount(_0x3bf7b2);}else{_0x27bff2[_0x31e1('0x3a')](_0x27bff2[_0x31e1('0x4a')][_0x3bf7b2['id']],_0x3bf7b2);}}}return _0x27bff2['sugarcrmAccounts'];};};Realtime[_0x31e1('0x39')][_0x31e1('0x4b')]=function(){var _0x265009=this;return function(_0x48bb52){if(_0x48bb52){freeIsNotKey(_0x48bb52,_0x265009['vtigerAccounts'],'id');for(var _0x5ba6c9=0x0,_0x34c4ee={},_0x240fba={};_0x5ba6c9<_0x48bb52['length'];_0x5ba6c9+=0x1){_0x34c4ee=_0x48bb52[_0x5ba6c9];if(_[_0x31e1('0x40')](_0x265009[_0x31e1('0x20')][_0x34c4ee['id']])){_0x265009['vtigerAccounts'][_0x34c4ee['id']]=new VtigerAccount(_0x34c4ee);}else{_0x265009[_0x31e1('0x3a')](_0x265009[_0x31e1('0x20')][_0x34c4ee['id']],_0x34c4ee);}}}return _0x265009['vtigerAccounts'];};};Realtime[_0x31e1('0x39')][_0x31e1('0x4c')]=function(){var _0x42735d=this;return function(_0x12ac00){if(_0x12ac00){freeIsNotKey(_0x12ac00,_0x42735d[_0x31e1('0x21')],'id');for(var _0x304d79=0x0,_0x5d2bb9={},_0x3e15dd={};_0x304d79<_0x12ac00['length'];_0x304d79+=0x1){_0x5d2bb9=_0x12ac00[_0x304d79];if(_['isUndefined'](_0x42735d['servicenowAccounts'][_0x5d2bb9['id']])){_0x42735d[_0x31e1('0x21')][_0x5d2bb9['id']]=new ServicenowAccount(_0x5d2bb9);}else{_0x42735d[_0x31e1('0x3a')](_0x42735d['servicenowAccounts'][_0x5d2bb9['id']],_0x5d2bb9);}}}return _0x42735d[_0x31e1('0x21')];};};Realtime[_0x31e1('0x39')]['initDynamics365Accounts']=function(){var _0x40aaec=this;return function(_0xa81429){if(_0xa81429){freeIsNotKey(_0xa81429,_0x40aaec['dynamics365Accounts'],'id');for(var _0x4e801a=0x0,_0x1e100e={},_0x3f624e={};_0x4e801a<_0xa81429[_0x31e1('0x3c')];_0x4e801a+=0x1){_0x1e100e=_0xa81429[_0x4e801a];if(_['isUndefined'](_0x40aaec[_0x31e1('0x22')][_0x1e100e['id']])){_0x40aaec[_0x31e1('0x22')][_0x1e100e['id']]=new Dynamics365Account(_0x1e100e);}else{_0x40aaec[_0x31e1('0x3a')](_0x40aaec[_0x31e1('0x22')][_0x1e100e['id']],_0x1e100e);}}}return _0x40aaec[_0x31e1('0x22')];};};Realtime[_0x31e1('0x39')]['initFreshsalesAccounts']=function(){var _0x8dc9f9=this;return function(_0x188ca8){if(_0x188ca8){freeIsNotKey(_0x188ca8,_0x8dc9f9[_0x31e1('0x23')],'id');for(var _0x21dfcd=0x0,_0x16bfe8={},_0x4e87d9={};_0x21dfcd<_0x188ca8[_0x31e1('0x3c')];_0x21dfcd+=0x1){_0x16bfe8=_0x188ca8[_0x21dfcd];if(_[_0x31e1('0x40')](_0x8dc9f9[_0x31e1('0x23')][_0x16bfe8['id']])){_0x8dc9f9[_0x31e1('0x23')][_0x16bfe8['id']]=new FreshsalesAccount(_0x16bfe8);}else{_0x8dc9f9[_0x31e1('0x3a')](_0x8dc9f9[_0x31e1('0x23')][_0x16bfe8['id']],_0x16bfe8);}}}return _0x8dc9f9[_0x31e1('0x23')];};};Realtime[_0x31e1('0x39')]['initVoiceQueueHopperHistory']=function(){var _0x17fdba=this;return function(_0x3471f1){for(var _0x3f24a3=0x0;_0x3f24a3<_0x3471f1[_0x31e1('0x3c')];_0x3f24a3+=0x1){_[_0x31e1('0x4d')](_0x17fdba['voiceQueues'][_0x3471f1[_0x3f24a3][_0x31e1('0x29')]],_0x3471f1[_0x3f24a3]);}return _0x17fdba[_0x31e1('0x41')];};};Realtime[_0x31e1('0x39')][_0x31e1('0x4e')]=function(){var _0x2736bf=this;return function(_0x1c4b71){clearVoiceQueues(_0x2736bf[_0x31e1('0x41')]);if(_0x1c4b71){_0x1c4b71=_[_0x31e1('0x4f')](_0x1c4b71,_0x31e1('0x50'));for(var _0x3f7417 in _0x1c4b71){if(_0x1c4b71[_0x31e1('0x26')](_0x3f7417)){var _0x3938d1={};for(var _0x595dfb=0x0;_0x595dfb<_0x1c4b71[_0x3f7417]['length'];_0x595dfb+=0x1){var _0x5080e3=_0x1c4b71[_0x3f7417][_0x595dfb][_0x31e1('0x51')];if(_0x2736bf['voiceQueues'][_0x5080e3]){if(_0x1c4b71[_0x3f7417][_0x595dfb]['queuecallerexit']){_0x2736bf['voiceQueues'][_0x5080e3][_0x31e1('0x52')]+=0x1;}if(_0x1c4b71[_0x3f7417][_0x595dfb][_0x31e1('0x53')]){_0x2736bf[_0x31e1('0x41')][_0x5080e3]['abandoned']+=0x1;}_0x2736bf[_0x31e1('0x41')][_0x5080e3][_0x31e1('0x2f')]+=moment(_0x1c4b71[_0x3f7417][_0x595dfb][_0x31e1('0x54')])['diff'](moment(_0x1c4b71[_0x3f7417][_0x595dfb][_0x31e1('0x55')]),'seconds')||0x0;if(_0x595dfb===_0x1c4b71[_0x3f7417][_0x31e1('0x3c')]-0x1){_0x2736bf[_0x31e1('0x41')][_0x5080e3][_0x31e1('0x2c')]+=moment(_0x1c4b71[_0x3f7417][_0x595dfb]['queuecallercompleteAt']||_0x1c4b71[_0x3f7417][_0x595dfb][_0x31e1('0x56')]||_0x1c4b71[_0x3f7417][_0x595dfb][_0x31e1('0x57')])[_0x31e1('0x58')](moment(_0x1c4b71[_0x3f7417][_0x595dfb][_0x31e1('0x55')]),'seconds')||0x0;_0x2736bf[_0x31e1('0x41')][_0x5080e3][_0x31e1('0x2b')]+=0x1;if(_0x1c4b71[_0x3f7417][_0x595dfb][_0x31e1('0x59')]){_0x2736bf['voiceQueues'][_0x5080e3][_0x31e1('0x5a')]+=0x1;_0x2736bf[_0x31e1('0x41')][_0x5080e3][_0x31e1('0x30')]+=moment(_0x1c4b71[_0x3f7417][_0x595dfb]['queuecallercompleteAt'])['diff'](moment(_0x1c4b71[_0x3f7417][_0x595dfb]['queuecallerleaveAt']),_0x31e1('0x5b'))||0x0;}}else{_0x2736bf[_0x31e1('0x41')][_0x5080e3][_0x31e1('0x2c')]+=_0x2736bf[_0x31e1('0x41')][_0x5080e3][_0x31e1('0x2f')]||0x0;}}}}}}return _0x2736bf[_0x31e1('0x41')];};};Realtime[_0x31e1('0x39')]['initVoiceCallReports']=function(){var _0x53e904=this;return function(_0x5a7a64){clearVoiceCallReports(_0x53e904[_0x31e1('0x17')]);if(_0x5a7a64){for(var _0x389c20=0x0;_0x389c20<_0x5a7a64[_0x31e1('0x3c')];_0x389c20+=0x1){_0x53e904['outbound']['total']+=0x1;_0x53e904['outbound'][_0x31e1('0x2c')]+=_0x5a7a64[_0x389c20]['duration'];if(_0x5a7a64[_0x389c20][_0x31e1('0x5c')]===_0x31e1('0x5d')){_0x53e904[_0x31e1('0x17')][_0x31e1('0x5a')]+=0x1;_0x53e904[_0x31e1('0x17')][_0x31e1('0x2f')]+=_0x5a7a64[_0x389c20][_0x31e1('0x5e')]-_0x5a7a64[_0x389c20][_0x31e1('0x5f')]||0x0;_0x53e904[_0x31e1('0x17')][_0x31e1('0x30')]+=_0x5a7a64[_0x389c20][_0x31e1('0x5f')];}}}return _0x53e904['outbound'];};};Realtime[_0x31e1('0x39')]['initCampaigns']=function(){var _0x331e82=this;return function(_0x505244){if(_0x505244){freeIsNotKey(_0x505244,_0x331e82[_0x31e1('0x15')],_0x31e1('0x29'));for(var _0x326a56=0x0,_0x45129b={};_0x326a56<_0x505244[_0x31e1('0x3c')];_0x326a56+=0x1){_0x45129b=_0x505244[_0x326a56];if(_[_0x31e1('0x40')](_0x331e82[_0x31e1('0x15')][_0x45129b[_0x31e1('0x29')]])){_0x331e82['campaigns'][_0x45129b['name']]=new Campaign(_0x45129b);}else{_0x331e82['mergeFromDatabase'](_0x331e82[_0x31e1('0x15')][_0x45129b[_0x31e1('0x29')]],_0x45129b);_0x331e82[_0x31e1('0x15')][_0x45129b[_0x31e1('0x29')]][_0x31e1('0x60')]=_0x45129b[_0x31e1('0x61')]?_0x45129b['SquareProject']['name']:undefined;}}}return _0x331e82['campaigns'];};};Realtime[_0x31e1('0x39')][_0x31e1('0x62')]=function(){var _0x44f2f5=this;return function(_0x1df994){if(_0x1df994){freeIsNotKey(_0x1df994,_0x44f2f5[_0x31e1('0x18')],'id');for(var _0x3e9045=0x0,_0x2b912c={};_0x3e9045<_0x1df994[_0x31e1('0x3c')];_0x3e9045+=0x1){_0x2b912c=_0x1df994[_0x3e9045];if(_[_0x31e1('0x40')](_0x44f2f5[_0x31e1('0x18')][_0x2b912c['id']])){_0x44f2f5[_0x31e1('0x18')][_0x2b912c['id']]=new VoiceExtension(_0x2b912c);}else{_0x44f2f5[_0x31e1('0x3a')](_0x44f2f5['voiceExtensions'][_0x2b912c['id']],_0x2b912c);}}}return _0x44f2f5['voiceExtensions'];};};Realtime[_0x31e1('0x39')][_0x31e1('0x63')]=function(){var _0x36259e=this;return function(_0x6bcbf1){clearCampaigns(_0x36259e[_0x31e1('0x15')]);for(var _0x371fbd=0x0;_0x371fbd<_0x6bcbf1[_0x31e1('0x3c')];_0x371fbd+=0x1){_[_0x31e1('0x4d')](_0x36259e['campaigns'][_0x6bcbf1[_0x371fbd][_0x31e1('0x29')]],_0x6bcbf1[_0x371fbd]);}return _0x36259e[_0x31e1('0x15')];};};Realtime[_0x31e1('0x39')]['initFaxAccounts']=function(){var _0x123581=this;return function(_0x37aba4){if(_0x37aba4){freeIsNotKey(_0x37aba4,_0x123581['faxAccounts'],'id');for(var _0x4b0e23=0x0,_0x2358e5={},_0x1364c3={};_0x4b0e23<_0x37aba4[_0x31e1('0x3c')];_0x4b0e23+=0x1){_0x2358e5=_0x37aba4[_0x4b0e23];if(_[_0x31e1('0x40')](_0x123581[_0x31e1('0x24')][_0x2358e5['id']])){_0x123581[_0x31e1('0x24')][_0x2358e5['id']]=new FaxAccount(_0x2358e5);}else{_0x123581[_0x31e1('0x3a')](_0x123581[_0x31e1('0x24')][_0x2358e5['id']],_0x2358e5);}}}return _0x123581[_0x31e1('0x24')];};};module[_0x31e1('0x64')]=Realtime; \ No newline at end of file +var _0x5142=['templates','initZendeskAccounts','zendeskAccounts','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','freshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallerjoinAt','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','SIP/%s','interface','total','answered','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','telephones','initTrunks','initVoiceQueues','initTemplates'];(function(_0x3ed474,_0x54b670){var _0x330b3c=function(_0x134651){while(--_0x134651){_0x3ed474['push'](_0x3ed474['shift']());}};_0x330b3c(++_0x54b670);}(_0x5142,0xf0));var _0x2514=function(_0x370cd0,_0x7bcedf){_0x370cd0=_0x370cd0-0x0;var _0x3d1363=_0x5142[_0x370cd0];return _0x3d1363;};'use strict';var BPromise=require(_0x2514('0x0'));var util=require('util');var _=require(_0x2514('0x1'));var moment=require(_0x2514('0x2'));var Agent=require(_0x2514('0x3'));var Telephone=require(_0x2514('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x2514('0x5'));var Template=require(_0x2514('0x6'));var Campaign=require(_0x2514('0x7'));var VoiceExtension=require(_0x2514('0x8'));var ZendeskAccount=require(_0x2514('0x9'));var SalesforceAccount=require(_0x2514('0xa'));var FreshdeskAccount=require(_0x2514('0xb'));var SugarcrmAccount=require(_0x2514('0xc'));var ZohoAccount=require(_0x2514('0xd'));var DeskAccount=require(_0x2514('0xe'));var VtigerAccount=require(_0x2514('0xf'));var ServicenowAccount=require(_0x2514('0x10'));var Dynamics365Account=require(_0x2514('0x11'));var FreshsalesAccount=require(_0x2514('0x12'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x2514('0x13')]={};this['telephones']={};this[_0x2514('0x14')]={};this[_0x2514('0x15')]={};this[_0x2514('0x16')]={};this[_0x2514('0x17')]={};this['templates']={};this[_0x2514('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x2514('0x19')]={};this[_0x2514('0x1a')]={};this[_0x2514('0x1b')]={};this[_0x2514('0x1c')]={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2514('0x1d')]={};this[_0x2514('0x1e')]={};this[_0x2514('0x1f')]={};this[_0x2514('0x20')]={};this[_0x2514('0x21')]={};this[_0x2514('0x22')]={};this[_0x2514('0x23')]={};this['freshsalesAccounts']={};this[_0x2514('0x24')]={};};function freeIsNotKey(_0x47c3aa,_0x2bda94,_0x3b0098){var _0x5e5e4b=_[_0x2514('0x25')](_0x47c3aa,function(_0xcd23a2,_0xb90eec){return _0xcd23a2[_0x3b0098];});for(var _0x46fe in _0x2bda94){if(_0x2bda94[_0x2514('0x26')](_0x46fe)){if(!_0x5e5e4b[_0x46fe]){delete _0x2bda94[_0x46fe];}}}}function freeIsNotKeySip(_0x4cde27,_0x5051b4){var _0x472e48=_[_0x2514('0x25')](_0x4cde27,function(_0x46236a,_0x3e30af){return util[_0x2514('0x27')]('SIP/%s',_0x46236a[_0x2514('0x28')]);});for(var _0x5a796f in _0x5051b4){if(_0x5051b4[_0x2514('0x26')](_0x5a796f)){if(!_0x472e48[_0x5a796f]){delete _0x5051b4[_0x5a796f];}}}}function freeIsNotKeyAgent(_0x40384d,_0x240011){var _0xf0b3df=_[_0x2514('0x25')](_0x40384d,function(_0x490997,_0x37bc10){var _0x576960=_['isNil'](_0x490997['interface'])?util[_0x2514('0x27')](_0x2514('0x29'),_0x490997['name']):_0x490997[_0x2514('0x2a')];return _0x576960;});for(var _0x3a8905 in _0x240011){if(_0x240011[_0x2514('0x26')](_0x3a8905)){if(!_0xf0b3df[_0x3a8905]){delete _0x240011[_0x3a8905];}}}}function clearVoiceCallReports(_0x3eb949){_0x3eb949[_0x2514('0x2b')]=0x0;_0x3eb949[_0x2514('0x2c')]=0x0;_0x3eb949['sumHoldTime']=0x0;_0x3eb949['sumDuration']=0x0;_0x3eb949[_0x2514('0x2d')]=0x0;}function clearCampaigns(_0x24dbc9){if(!_['isEmpty'](_0x24dbc9)){for(var _0xcc0e0e in _0x24dbc9){if(_0x24dbc9[_0x2514('0x26')](_0xcc0e0e)){_0x24dbc9[_0xcc0e0e][_0x2514('0x2e')]=0x0;_0x24dbc9[_0xcc0e0e]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3729f9){if(!_[_0x2514('0x2f')](_0x3729f9)){for(var _0x341593 in _0x3729f9){if(_0x3729f9[_0x2514('0x26')](_0x341593)){_0x3729f9[_0x341593]['total']=0x0;_0x3729f9[_0x341593][_0x2514('0x2c')]=0x0;_0x3729f9[_0x341593][_0x2514('0x30')]=0x0;_0x3729f9[_0x341593][_0x2514('0x31')]=0x0;_0x3729f9[_0x341593][_0x2514('0x32')]=0x0;_0x3729f9[_0x341593][_0x2514('0x33')]=0x0;_0x3729f9[_0x341593][_0x2514('0x2d')]=0x0;_0x3729f9[_0x341593][_0x2514('0x34')]=0x0;_0x3729f9[_0x341593]['outboundNoAnswerCallsDay']=0x0;_0x3729f9[_0x341593][_0x2514('0x35')]=0x0;_0x3729f9[_0x341593][_0x2514('0x36')]=0x0;_0x3729f9[_0x341593][_0x2514('0x37')]=0x0;_0x3729f9[_0x341593]['outboundUnknownCallsDay']=0x0;_0x3729f9[_0x341593]['outboundDropCallsDayTimeout']=0x0;_0x3729f9[_0x341593][_0x2514('0x38')]=0x0;_0x3729f9[_0x341593][_0x2514('0x39')]=0x0;_0x3729f9[_0x341593]['outboundOriginateFailureCallsDay']=0x0;_0x3729f9[_0x341593][_0x2514('0x3a')]=0x0;_0x3729f9[_0x341593][_0x2514('0x3b')]=0x0;_0x3729f9[_0x341593][_0x2514('0x34')]=0x0;_0x3729f9[_0x341593][_0x2514('0x3c')]=0x0;_0x3729f9[_0x341593][_0x2514('0x3d')]=!![];}}}}Realtime[_0x2514('0x3e')][_0x2514('0x3f')]=function(_0x444fb6,_0x2afdf8){for(var _0x55c9cf in _0x2afdf8){if(_0x444fb6['hasOwnProperty'](_0x55c9cf)){_0x444fb6[_0x55c9cf]=_0x2afdf8[_0x55c9cf];}}};Realtime[_0x2514('0x3e')][_0x2514('0x40')]=function(){var _0x57b85c=this;return function(_0x4f8b38){if(_0x4f8b38){freeIsNotKeyAgent(_0x4f8b38,_0x57b85c['agents']);for(var _0x74e20c=0x0,_0x16f9d9={},_0x3467b2={};_0x74e20c<_0x4f8b38[_0x2514('0x41')];_0x74e20c+=0x1){_0x16f9d9=_0x4f8b38[_0x74e20c];var _0x406dbf=_['isNil'](_0x16f9d9[_0x2514('0x2a')])?util[_0x2514('0x27')]('SIP/%s',_0x16f9d9[_0x2514('0x28')]):_0x16f9d9['interface'];if(_[_0x2514('0x42')](_0x57b85c[_0x2514('0x13')][_0x406dbf])){_0x57b85c[_0x2514('0x13')][_0x406dbf]=new Agent(_0x16f9d9);}else{_0x57b85c[_0x2514('0x3f')](_0x57b85c[_0x2514('0x13')][_0x406dbf],_0x16f9d9);}}}return _0x57b85c[_0x2514('0x13')];};};Realtime[_0x2514('0x3e')][_0x2514('0x43')]=function(){var _0x3c550e=this;return function(_0x510b2b){if(_0x510b2b){freeIsNotKeySip(_0x510b2b,_0x3c550e['telephones']);for(var _0x4fba08=0x0,_0x9ef149={},_0x3699aa={};_0x4fba08<_0x510b2b[_0x2514('0x41')];_0x4fba08+=0x1){_0x9ef149=_0x510b2b[_0x4fba08];if(_[_0x2514('0x42')](_0x3c550e[_0x2514('0x44')][util[_0x2514('0x27')]('SIP/%s',_0x9ef149['name'])])){_0x3c550e[_0x2514('0x44')][util[_0x2514('0x27')](_0x2514('0x29'),_0x9ef149[_0x2514('0x28')])]=new Telephone(_0x9ef149);}else{_0x3c550e[_0x2514('0x3f')](_0x3c550e['telephones'][util[_0x2514('0x27')](_0x2514('0x29'),_0x9ef149[_0x2514('0x28')])],_0x9ef149);}}}return _0x3c550e[_0x2514('0x44')];};};Realtime[_0x2514('0x3e')][_0x2514('0x45')]=function(){var _0x2864db=this;return function(_0x2a4861){if(_0x2a4861){freeIsNotKeySip(_0x2a4861,_0x2864db[_0x2514('0x14')]);for(var _0x26f733=0x0,_0x12a9eb={},_0x49f165={};_0x26f733<_0x2a4861[_0x2514('0x41')];_0x26f733+=0x1){_0x12a9eb=_0x2a4861[_0x26f733];if(_['isUndefined'](_0x2864db[_0x2514('0x14')][util[_0x2514('0x27')](_0x2514('0x29'),_0x12a9eb[_0x2514('0x28')])])){_0x2864db[_0x2514('0x14')][util['format'](_0x2514('0x29'),_0x12a9eb[_0x2514('0x28')])]=new Trunk(_0x12a9eb);}else{_0x2864db[_0x2514('0x3f')](_0x2864db[_0x2514('0x14')][util['format'](_0x2514('0x29'),_0x12a9eb[_0x2514('0x28')])],_0x12a9eb);}}}return _0x2864db['trunks'];};};Realtime[_0x2514('0x3e')][_0x2514('0x46')]=function(){var _0x30d3d2=this;return function(_0x4fcdaa){if(_0x4fcdaa){freeIsNotKey(_0x4fcdaa,_0x30d3d2[_0x2514('0x15')],'name');for(var _0x485181=0x0,_0x4ae3cd={},_0x2fde1c={};_0x485181<_0x4fcdaa[_0x2514('0x41')];_0x485181+=0x1){_0x4ae3cd=_0x4fcdaa[_0x485181];if(_[_0x2514('0x42')](_0x30d3d2['voiceQueues'][_0x4ae3cd[_0x2514('0x28')]])){_0x30d3d2[_0x2514('0x15')][_0x4ae3cd[_0x2514('0x28')]]=new VoiceQueue(_0x4ae3cd);}else{_0x30d3d2['mergeFromDatabase'](_0x30d3d2['voiceQueues'][_0x4ae3cd[_0x2514('0x28')]],_0x4ae3cd);}}}return _0x30d3d2[_0x2514('0x15')];};};Realtime[_0x2514('0x3e')]['initTriggers']=function(){var _0x23aae6=this;return function(_0x2f1f75){if(_0x2f1f75){freeIsNotKey(_0x2f1f75,_0x23aae6[_0x2514('0x16')],'id');for(var _0x8a8e4=0x0,_0x5f5ceb={},_0x50e668={};_0x8a8e4<_0x2f1f75[_0x2514('0x41')];_0x8a8e4+=0x1){_0x5f5ceb=_0x2f1f75[_0x8a8e4];if(_['isUndefined'](_0x23aae6[_0x2514('0x16')][_0x5f5ceb['id']])){_0x23aae6[_0x2514('0x16')][_0x5f5ceb['id']]=new Trigger(_0x5f5ceb);}else{_0x23aae6[_0x2514('0x3f')](_0x23aae6[_0x2514('0x16')][_0x5f5ceb['id']],_0x5f5ceb);}}}return _0x23aae6[_0x2514('0x16')];};};Realtime[_0x2514('0x3e')][_0x2514('0x47')]=function(){var _0x2594ef=this;return function(_0x26cdcf){if(_0x26cdcf){freeIsNotKey(_0x26cdcf,_0x2594ef[_0x2514('0x48')],'id');for(var _0x55b7f4=0x0,_0x22799d={},_0x44785c={};_0x55b7f4<_0x26cdcf['length'];_0x55b7f4+=0x1){_0x22799d=_0x26cdcf[_0x55b7f4];if(_[_0x2514('0x42')](_0x2594ef[_0x2514('0x48')][_0x22799d['id']])){_0x2594ef[_0x2514('0x48')][_0x22799d['id']]=new Template(_0x22799d);}else{_0x2594ef[_0x2514('0x3f')](_0x2594ef[_0x2514('0x48')][_0x22799d['id']],_0x22799d);}}}return _0x2594ef[_0x2514('0x48')];};};Realtime[_0x2514('0x3e')][_0x2514('0x49')]=function(){var _0x441258=this;return function(_0x22081e){if(_0x22081e){freeIsNotKey(_0x22081e,_0x441258[_0x2514('0x4a')],'id');for(var _0x23e69e=0x0,_0x17d37b={},_0x141011={};_0x23e69e<_0x22081e[_0x2514('0x41')];_0x23e69e+=0x1){_0x17d37b=_0x22081e[_0x23e69e];if(_[_0x2514('0x42')](_0x441258[_0x2514('0x4a')][_0x17d37b['id']])){_0x441258[_0x2514('0x4a')][_0x17d37b['id']]=new ZendeskAccount(_0x17d37b);}else{_0x441258[_0x2514('0x3f')](_0x441258['zendeskAccounts'][_0x17d37b['id']],_0x17d37b);}}}return _0x441258[_0x2514('0x4a')];};};Realtime[_0x2514('0x3e')]['initSalesforceAccounts']=function(){var _0x1fb546=this;return function(_0x40603d){if(_0x40603d){freeIsNotKey(_0x40603d,_0x1fb546[_0x2514('0x4b')],'id');for(var _0x45e340=0x0,_0x1a88b2={},_0x3f57fb={};_0x45e340<_0x40603d[_0x2514('0x41')];_0x45e340+=0x1){_0x1a88b2=_0x40603d[_0x45e340];if(_['isUndefined'](_0x1fb546['salesforceAccounts'][_0x1a88b2['id']])){_0x1fb546[_0x2514('0x4b')][_0x1a88b2['id']]=new SalesforceAccount(_0x1a88b2);}else{_0x1fb546[_0x2514('0x3f')](_0x1fb546[_0x2514('0x4b')][_0x1a88b2['id']],_0x1a88b2);}}}return _0x1fb546[_0x2514('0x4b')];};};Realtime[_0x2514('0x3e')]['initFreshdeskAccounts']=function(){var _0x527e54=this;return function(_0xaae8d3){if(_0xaae8d3){freeIsNotKey(_0xaae8d3,_0x527e54['freshdeskAccounts'],'id');for(var _0x4b28e0=0x0,_0x5d9a1d={},_0x34a839={};_0x4b28e0<_0xaae8d3[_0x2514('0x41')];_0x4b28e0+=0x1){_0x5d9a1d=_0xaae8d3[_0x4b28e0];if(_[_0x2514('0x42')](_0x527e54[_0x2514('0x1e')][_0x5d9a1d['id']])){_0x527e54[_0x2514('0x1e')][_0x5d9a1d['id']]=new FreshdeskAccount(_0x5d9a1d);}else{_0x527e54[_0x2514('0x3f')](_0x527e54[_0x2514('0x1e')][_0x5d9a1d['id']],_0x5d9a1d);}}}return _0x527e54['freshdeskAccounts'];};};Realtime['prototype'][_0x2514('0x4c')]=function(){var _0x52f9e9=this;return function(_0x447ab5){if(_0x447ab5){freeIsNotKey(_0x447ab5,_0x52f9e9[_0x2514('0x1f')],'id');for(var _0x41adcc=0x0,_0x1b6528={},_0x5a15f4={};_0x41adcc<_0x447ab5[_0x2514('0x41')];_0x41adcc+=0x1){_0x1b6528=_0x447ab5[_0x41adcc];if(_[_0x2514('0x42')](_0x52f9e9[_0x2514('0x1f')][_0x1b6528['id']])){_0x52f9e9[_0x2514('0x1f')][_0x1b6528['id']]=new ZohoAccount(_0x1b6528);}else{_0x52f9e9[_0x2514('0x3f')](_0x52f9e9[_0x2514('0x1f')][_0x1b6528['id']],_0x1b6528);}}}return _0x52f9e9['zohoAccounts'];};};Realtime[_0x2514('0x3e')][_0x2514('0x4d')]=function(){var _0x10eb56=this;return function(_0xfadf22){if(_0xfadf22){freeIsNotKey(_0xfadf22,_0x10eb56['deskAccounts'],'id');for(var _0x3386f4=0x0,_0x3da7d6={},_0xb76df={};_0x3386f4<_0xfadf22[_0x2514('0x41')];_0x3386f4+=0x1){_0x3da7d6=_0xfadf22[_0x3386f4];if(_[_0x2514('0x42')](_0x10eb56[_0x2514('0x20')][_0x3da7d6['id']])){_0x10eb56[_0x2514('0x20')][_0x3da7d6['id']]=new DeskAccount(_0x3da7d6);}else{_0x10eb56[_0x2514('0x3f')](_0x10eb56['deskAccounts'][_0x3da7d6['id']],_0x3da7d6);}}}return _0x10eb56[_0x2514('0x20')];};};Realtime[_0x2514('0x3e')][_0x2514('0x4e')]=function(){var _0x1ae8c5=this;return function(_0x4c5884){if(_0x4c5884){freeIsNotKey(_0x4c5884,_0x1ae8c5[_0x2514('0x1d')],'id');for(var _0x192eab=0x0,_0x28281a={},_0x543886={};_0x192eab<_0x4c5884['length'];_0x192eab+=0x1){_0x28281a=_0x4c5884[_0x192eab];if(_[_0x2514('0x42')](_0x1ae8c5[_0x2514('0x1d')][_0x28281a['id']])){_0x1ae8c5[_0x2514('0x1d')][_0x28281a['id']]=new SugarcrmAccount(_0x28281a);}else{_0x1ae8c5[_0x2514('0x3f')](_0x1ae8c5['sugarcrmAccounts'][_0x28281a['id']],_0x28281a);}}}return _0x1ae8c5[_0x2514('0x1d')];};};Realtime[_0x2514('0x3e')][_0x2514('0x4f')]=function(){var _0x508370=this;return function(_0x239210){if(_0x239210){freeIsNotKey(_0x239210,_0x508370[_0x2514('0x21')],'id');for(var _0x253977=0x0,_0x1fb722={},_0x183ce4={};_0x253977<_0x239210[_0x2514('0x41')];_0x253977+=0x1){_0x1fb722=_0x239210[_0x253977];if(_[_0x2514('0x42')](_0x508370['vtigerAccounts'][_0x1fb722['id']])){_0x508370[_0x2514('0x21')][_0x1fb722['id']]=new VtigerAccount(_0x1fb722);}else{_0x508370[_0x2514('0x3f')](_0x508370[_0x2514('0x21')][_0x1fb722['id']],_0x1fb722);}}}return _0x508370[_0x2514('0x21')];};};Realtime[_0x2514('0x3e')][_0x2514('0x50')]=function(){var _0x2c02b1=this;return function(_0x4b9a3e){if(_0x4b9a3e){freeIsNotKey(_0x4b9a3e,_0x2c02b1[_0x2514('0x22')],'id');for(var _0x42487d=0x0,_0x44f8d3={},_0x25a268={};_0x42487d<_0x4b9a3e['length'];_0x42487d+=0x1){_0x44f8d3=_0x4b9a3e[_0x42487d];if(_[_0x2514('0x42')](_0x2c02b1[_0x2514('0x22')][_0x44f8d3['id']])){_0x2c02b1[_0x2514('0x22')][_0x44f8d3['id']]=new ServicenowAccount(_0x44f8d3);}else{_0x2c02b1[_0x2514('0x3f')](_0x2c02b1[_0x2514('0x22')][_0x44f8d3['id']],_0x44f8d3);}}}return _0x2c02b1[_0x2514('0x22')];};};Realtime[_0x2514('0x3e')][_0x2514('0x51')]=function(){var _0x33ceab=this;return function(_0x48aace){if(_0x48aace){freeIsNotKey(_0x48aace,_0x33ceab[_0x2514('0x23')],'id');for(var _0x31ac1f=0x0,_0x282cb9={},_0x5ebd89={};_0x31ac1f<_0x48aace[_0x2514('0x41')];_0x31ac1f+=0x1){_0x282cb9=_0x48aace[_0x31ac1f];if(_['isUndefined'](_0x33ceab[_0x2514('0x23')][_0x282cb9['id']])){_0x33ceab[_0x2514('0x23')][_0x282cb9['id']]=new Dynamics365Account(_0x282cb9);}else{_0x33ceab[_0x2514('0x3f')](_0x33ceab[_0x2514('0x23')][_0x282cb9['id']],_0x282cb9);}}}return _0x33ceab['dynamics365Accounts'];};};Realtime[_0x2514('0x3e')]['initFreshsalesAccounts']=function(){var _0x311187=this;return function(_0x11237){if(_0x11237){freeIsNotKey(_0x11237,_0x311187['freshsalesAccounts'],'id');for(var _0x3dcdbb=0x0,_0x3e1b3b={},_0x542535={};_0x3dcdbb<_0x11237[_0x2514('0x41')];_0x3dcdbb+=0x1){_0x3e1b3b=_0x11237[_0x3dcdbb];if(_[_0x2514('0x42')](_0x311187[_0x2514('0x52')][_0x3e1b3b['id']])){_0x311187[_0x2514('0x52')][_0x3e1b3b['id']]=new FreshsalesAccount(_0x3e1b3b);}else{_0x311187[_0x2514('0x3f')](_0x311187[_0x2514('0x52')][_0x3e1b3b['id']],_0x3e1b3b);}}}return _0x311187[_0x2514('0x52')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x169803=this;return function(_0x2ecf10){for(var _0x31215c=0x0;_0x31215c<_0x2ecf10[_0x2514('0x41')];_0x31215c+=0x1){_[_0x2514('0x53')](_0x169803[_0x2514('0x15')][_0x2ecf10[_0x31215c]['name']],_0x2ecf10[_0x31215c]);}return _0x169803[_0x2514('0x15')];};};Realtime[_0x2514('0x3e')][_0x2514('0x54')]=function(){var _0x11905b=this;return function(_0x241b82){clearVoiceQueues(_0x11905b[_0x2514('0x15')]);if(_0x241b82){_0x241b82=_[_0x2514('0x55')](_0x241b82,_0x2514('0x56'));for(var _0xefc4c6 in _0x241b82){if(_0x241b82[_0x2514('0x26')](_0xefc4c6)){var _0x162046={};for(var _0x1895b4=0x0;_0x1895b4<_0x241b82[_0xefc4c6]['length'];_0x1895b4+=0x1){var _0x38b2bb=_0x241b82[_0xefc4c6][_0x1895b4][_0x2514('0x57')];if(_0x11905b[_0x2514('0x15')][_0x38b2bb]){if(_0x241b82[_0xefc4c6][_0x1895b4]['queuecallerexit']){_0x11905b[_0x2514('0x15')][_0x38b2bb][_0x2514('0x30')]+=0x1;}if(_0x241b82[_0xefc4c6][_0x1895b4][_0x2514('0x58')]){_0x11905b[_0x2514('0x15')][_0x38b2bb][_0x2514('0x31')]+=0x1;}_0x11905b[_0x2514('0x15')][_0x38b2bb][_0x2514('0x32')]+=moment(_0x241b82[_0xefc4c6][_0x1895b4][_0x2514('0x59')])['diff'](moment(_0x241b82[_0xefc4c6][_0x1895b4]['queuecallerjoinAt']),_0x2514('0x5a'))||0x0;if(_0x1895b4===_0x241b82[_0xefc4c6][_0x2514('0x41')]-0x1){_0x11905b[_0x2514('0x15')][_0x38b2bb][_0x2514('0x33')]+=moment(_0x241b82[_0xefc4c6][_0x1895b4][_0x2514('0x5b')]||_0x241b82[_0xefc4c6][_0x1895b4][_0x2514('0x5c')]||_0x241b82[_0xefc4c6][_0x1895b4]['queuecallerexitAt'])[_0x2514('0x5d')](moment(_0x241b82[_0xefc4c6][_0x1895b4][_0x2514('0x5e')]),_0x2514('0x5a'))||0x0;_0x11905b['voiceQueues'][_0x38b2bb][_0x2514('0x2b')]+=0x1;if(_0x241b82[_0xefc4c6][_0x1895b4][_0x2514('0x5f')]){_0x11905b[_0x2514('0x15')][_0x38b2bb][_0x2514('0x2c')]+=0x1;_0x11905b['voiceQueues'][_0x38b2bb][_0x2514('0x2d')]+=moment(_0x241b82[_0xefc4c6][_0x1895b4]['queuecallercompleteAt'])['diff'](moment(_0x241b82[_0xefc4c6][_0x1895b4][_0x2514('0x59')]),_0x2514('0x5a'))||0x0;}}else{_0x11905b['voiceQueues'][_0x38b2bb][_0x2514('0x33')]+=_0x11905b[_0x2514('0x15')][_0x38b2bb][_0x2514('0x32')]||0x0;}}}}}}return _0x11905b[_0x2514('0x15')];};};Realtime[_0x2514('0x3e')]['initVoiceCallReports']=function(){var _0x285431=this;return function(_0x3d9f52){clearVoiceCallReports(_0x285431[_0x2514('0x18')]);if(_0x3d9f52){for(var _0x265d41=0x0;_0x265d41<_0x3d9f52[_0x2514('0x41')];_0x265d41+=0x1){_0x285431[_0x2514('0x18')][_0x2514('0x2b')]+=0x1;_0x285431[_0x2514('0x18')][_0x2514('0x33')]+=_0x3d9f52[_0x265d41][_0x2514('0x60')];if(_0x3d9f52[_0x265d41][_0x2514('0x61')]===_0x2514('0x62')){_0x285431[_0x2514('0x18')][_0x2514('0x2c')]+=0x1;_0x285431['outbound'][_0x2514('0x32')]+=_0x3d9f52[_0x265d41]['duration']-_0x3d9f52[_0x265d41][_0x2514('0x63')]||0x0;_0x285431[_0x2514('0x18')][_0x2514('0x2d')]+=_0x3d9f52[_0x265d41]['billableseconds'];}}}return _0x285431[_0x2514('0x18')];};};Realtime[_0x2514('0x3e')]['initCampaigns']=function(){var _0x3c118d=this;return function(_0xf0bf13){if(_0xf0bf13){freeIsNotKey(_0xf0bf13,_0x3c118d[_0x2514('0x17')],_0x2514('0x28'));for(var _0xad0498=0x0,_0x562087={};_0xad0498<_0xf0bf13[_0x2514('0x41')];_0xad0498+=0x1){_0x562087=_0xf0bf13[_0xad0498];if(_['isUndefined'](_0x3c118d[_0x2514('0x17')][_0x562087[_0x2514('0x28')]])){_0x3c118d[_0x2514('0x17')][_0x562087[_0x2514('0x28')]]=new Campaign(_0x562087);}else{_0x3c118d[_0x2514('0x3f')](_0x3c118d[_0x2514('0x17')][_0x562087['name']],_0x562087);_0x3c118d['campaigns'][_0x562087[_0x2514('0x28')]][_0x2514('0x64')]=_0x562087[_0x2514('0x65')]?_0x562087['SquareProject'][_0x2514('0x28')]:undefined;}}}return _0x3c118d[_0x2514('0x17')];};};Realtime[_0x2514('0x3e')]['initVoiceExtensions']=function(){var _0x446b75=this;return function(_0x565b55){if(_0x565b55){freeIsNotKey(_0x565b55,_0x446b75['voiceExtensions'],'id');for(var _0xf63410=0x0,_0x1e0788={};_0xf63410<_0x565b55[_0x2514('0x41')];_0xf63410+=0x1){_0x1e0788=_0x565b55[_0xf63410];if(_[_0x2514('0x42')](_0x446b75[_0x2514('0x19')][_0x1e0788['id']])){_0x446b75[_0x2514('0x19')][_0x1e0788['id']]=new VoiceExtension(_0x1e0788);}else{_0x446b75['mergeFromDatabase'](_0x446b75[_0x2514('0x19')][_0x1e0788['id']],_0x1e0788);}}}return _0x446b75[_0x2514('0x19')];};};Realtime[_0x2514('0x3e')][_0x2514('0x66')]=function(){var _0x356cc2=this;return function(_0x16b420){clearCampaigns(_0x356cc2[_0x2514('0x17')]);for(var _0x22e067=0x0;_0x22e067<_0x16b420[_0x2514('0x41')];_0x22e067+=0x1){_[_0x2514('0x53')](_0x356cc2[_0x2514('0x17')][_0x16b420[_0x22e067][_0x2514('0x28')]],_0x16b420[_0x22e067]);}return _0x356cc2['campaigns'];};};Realtime[_0x2514('0x3e')][_0x2514('0x67')]=function(){var _0x3a52be=this;return function(_0xdb1e94){if(_0xdb1e94){freeIsNotKey(_0xdb1e94,_0x3a52be[_0x2514('0x24')],'id');for(var _0x754810=0x0,_0x4471a5={},_0x38dc60={};_0x754810<_0xdb1e94['length'];_0x754810+=0x1){_0x4471a5=_0xdb1e94[_0x754810];if(_[_0x2514('0x42')](_0x3a52be[_0x2514('0x24')][_0x4471a5['id']])){_0x3a52be[_0x2514('0x24')][_0x4471a5['id']]=new FaxAccount(_0x4471a5);}else{_0x3a52be['mergeFromDatabase'](_0x3a52be[_0x2514('0x24')][_0x4471a5['id']],_0x4471a5);}}}return _0x3a52be['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 169249b..373070d 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 _0x2acf=['../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','prototype','findAgent','accountcode','name','find','interface','format','SIP/%s','length','connectedlinenum','assigned','isNil','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','destination','exten','type','dialer','queue','lastdata','from-voip-provider','callerid','calleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','create','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','originatecalleridnum','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash'];(function(_0x5303c1,_0x4f655c){var _0x210a57=function(_0x2512b6){while(--_0x2512b6){_0x5303c1['push'](_0x5303c1['shift']());}};_0x210a57(++_0x4f655c);}(_0x2acf,0x1a8));var _0xf2ac=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x2acf[_0x2dd390];return _0x3afe47;};'use strict';var _=require(_0xf2ac('0x0'));var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var ami=require(_0xf2ac('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xf2ac('0x2'));var RpcVoiceDialReport=require(_0xf2ac('0x3'));var RpcMemberReport=require(_0xf2ac('0x4'));var RpcVoiceQueueReport=require(_0xf2ac('0x5'));var RpcVoiceRecording=require(_0xf2ac('0x6'));var RpcVoiceTransferReport=require(_0xf2ac('0x7'));var VoiceQueueReport=require(_0xf2ac('0x8'));var VoiceCallReport=require(_0xf2ac('0x9'));var VoiceAgentReport=require(_0xf2ac('0xa'));var VoiceDialReport=require(_0xf2ac('0xb'));var UserReport=require(_0xf2ac('0xc'));function Report(_0x2b6ad9){this[_0xf2ac('0xd')]=_0x2b6ad9;this[_0xf2ac('0xe')]=_0x2b6ad9[_0xf2ac('0xe')];this['telephones']=_0x2b6ad9[_0xf2ac('0xf')];}Report['prototype'][_0xf2ac('0x10')]=function(_0x443934){var _0x22f092=new VoiceQueueReport(this['realtime']);var _0x200a09=new VoiceAgentReport(this[_0xf2ac('0xd')]);var _0x43e928=new VoiceDialReport(this[_0xf2ac('0xd')]);var _0x34631a=new VoiceCallReport(this[_0xf2ac('0xd')]);var _0x16ade5=new UserReport(this[_0xf2ac('0xd')]);if(config[_0xf2ac('0x11')]&&config[_0xf2ac('0x11')][_0xf2ac('0x12')]){ami['on'](_0xf2ac('0x13'),this[_0xf2ac('0x14')][_0xf2ac('0x15')](this));ami['on'](_0xf2ac('0x16'),this[_0xf2ac('0x17')][_0xf2ac('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0xf2ac('0x18')][_0xf2ac('0x15')](this));ami['on'](_0xf2ac('0x19'),this[_0xf2ac('0x1a')][_0xf2ac('0x15')](this));ami['on']('blindtransfer',this[_0xf2ac('0x1b')][_0xf2ac('0x15')](this));ami['on'](_0xf2ac('0x1c'),this['attendedTransfer'][_0xf2ac('0x15')](this));}};Report[_0xf2ac('0x1d')][_0xf2ac('0x1e')]=function(_0x1d4143){var _0x412d7b;_0x412d7b=_['find'](this['agents'],function(_0x4ce149){return _0x4ce149[_0xf2ac('0x1f')]==_0x1d4143||_0x4ce149[_0xf2ac('0x20')]==_0x1d4143;});if(_['isNil'](_0x412d7b)){var _0x327076=_['find'](this[_0xf2ac('0xf')],function(_0x2ab229){return _0x2ab229[_0xf2ac('0x1f')]==_0x1d4143||_0x2ab229[_0xf2ac('0x20')]==_0x1d4143;});if(_0x327076){_0x412d7b=_[_0xf2ac('0x21')](this[_0xf2ac('0xe')],function(_0x343d38){return _0x343d38[_0xf2ac('0x22')]==util[_0xf2ac('0x23')](_0xf2ac('0x24'),_0x327076[_0xf2ac('0x20')]);});}}return _0x412d7b;};Report[_0xf2ac('0x1d')]['voiceQueueReport']=function(_0xd27411){for(var _0x48a6dc=0x0;_0x48a6dc<_0xd27411[_0xf2ac('0x25')];_0x48a6dc+=0x1){var _0x3a4575=this['findAgent'](_0xd27411[_0x48a6dc][_0xf2ac('0x26')]);if(_0x3a4575){_0xd27411[_0x48a6dc]['accountcode']=_0x3a4575[_0xf2ac('0x1f')];_0xd27411[_0x48a6dc][_0xf2ac('0x27')]=!![];_0xd27411[_0x48a6dc]['lastAssignedTo']=_0x3a4575[_0xf2ac('0x20')];_0xd27411[_0x48a6dc][_0xf2ac('0x22')]=_[_0xf2ac('0x28')](_0x3a4575[_0xf2ac('0x22')])?util[_0xf2ac('0x23')](_0xf2ac('0x24'),_0x3a4575[_0xf2ac('0x20')]):_0x3a4575[_0xf2ac('0x22')];if(_0xd27411[_0x48a6dc]['queuecallercomplete']){_0xd27411[_0x48a6dc][_0xf2ac('0x29')]=moment()[_0xf2ac('0x23')](_0xf2ac('0x2a'));}if(_0xd27411[_0x48a6dc][_0xf2ac('0x2b')]){_0xd27411[_0x48a6dc]['queuecallerexitAt']=moment()[_0xf2ac('0x23')](_0xf2ac('0x2a'));}RpcMemberReport[_0xf2ac('0x14')](_0xd27411[_0x48a6dc]);}RpcVoiceQueueReport['create'](_0xd27411[_0x48a6dc]);}};function extractCalleridNumber(_0x2a23ca){var _0x1595b6=_0x2a23ca[_0xf2ac('0x2c')](/<(.*?)>/);return _0x1595b6?_0x1595b6[0x1]:_0x2a23ca;}Report['prototype'][_0xf2ac('0x17')]=function(_0x39b872){_0x39b872[_0xf2ac('0x2d')]=_0x39b872[_0xf2ac('0x2d')]||_0x39b872[_0xf2ac('0x2e')];if(_0x39b872[_0xf2ac('0x2f')]==_0xf2ac('0x30')){_0x39b872['lastapplication']=_0xf2ac('0x31');_0x39b872[_0xf2ac('0x32')]=_0x39b872[_0xf2ac('0x31')];if(_0x39b872['context']==_0xf2ac('0x33')){_0x39b872['accountcode']='';_0x39b872[_0xf2ac('0x2d')]=extractCalleridNumber(_0x39b872[_0xf2ac('0x34')]);}else if(_0x39b872['context']=='from-sip'){if(_0x39b872['destination']=='xcally-motion-preview'){_0x39b872[_0xf2ac('0x2d')]=extractCalleridNumber(_0x39b872['calleridpreview']);_0x39b872[_0xf2ac('0x35')]=_0x39b872['originatecalleridnum'];_0x39b872[_0xf2ac('0x36')]=[_0x39b872[_0xf2ac('0x37')],_0x39b872[_0xf2ac('0x37')]=_0x39b872[_0xf2ac('0x36')]][0x0];_0x39b872[_0xf2ac('0x34')]=_0x39b872['calleridpreview'];}else{_0x39b872[_0xf2ac('0x2d')]=_0x39b872[_0xf2ac('0x35')];_0x39b872[_0xf2ac('0x35')]=_0x39b872['originatecalleridnum'];if(_0x39b872[_0xf2ac('0x38')]==_0xf2ac('0x39')){_0x39b872['accountcode']=_0x39b872[_0xf2ac('0x26')];}else{_0x39b872[_0xf2ac('0x1f')]='';}}}}else{_0x39b872['callerid']=util['format'](_0xf2ac('0x3a'),_0x39b872[_0xf2ac('0x3b')],_0x39b872[_0xf2ac('0x35')]);}if(RpcVoiceTransferReport[_0xf2ac('0x3c')][_0x39b872['linkedid']]){var _0x3dec68=RpcVoiceTransferReport['transfers'][_0x39b872[_0xf2ac('0x3d')]];_0x3dec68[_0xf2ac('0x3e')]=_0x39b872[_0xf2ac('0x3f')];RpcVoiceTransferReport['blindTransfer'](_0x3dec68);delete RpcVoiceTransferReport[_0xf2ac('0x3c')][_0x39b872[_0xf2ac('0x3d')]];}RpcVoiceCallReport[_0xf2ac('0x40')](_0x39b872);if(_0x39b872['monitor']){for(var _0x4257a0=0x0;_0x4257a0<_0x39b872[_0xf2ac('0x41')][_0xf2ac('0x25')];_0x4257a0+=0x1){_0x39b872[_0xf2ac('0x42')]=_0x39b872[_0xf2ac('0x41')][_0x4257a0][_0xf2ac('0x43')];_0x39b872[_0xf2ac('0x44')]=_0x39b872[_0xf2ac('0x41')][_0x4257a0][_0xf2ac('0x44')];if(_0x39b872['exten']==_0xf2ac('0x45')){_0x39b872[_0xf2ac('0x35')]=_0x39b872[_0xf2ac('0x26')];_0x39b872[_0xf2ac('0x3b')]=_0x39b872[_0xf2ac('0x46')];_0x39b872[_0xf2ac('0x26')]=_0x39b872[_0xf2ac('0x1f')];_0x39b872[_0xf2ac('0x46')]=_0x39b872[_0xf2ac('0x47')];_0x39b872[_0xf2ac('0x2e')]=_0x39b872[_0xf2ac('0x48')];}else if(_0x39b872[_0xf2ac('0x2e')]=='xcally-motion-dialer'){_0x39b872['calleridnum']=_0x39b872[_0xf2ac('0x2d')];_0x39b872[_0xf2ac('0x2e')]=_0x39b872['originatecalleridnum'];}RpcVoiceRecording['create'](_0x39b872);}}};Report[_0xf2ac('0x1d')][_0xf2ac('0x18')]=function(_0x31fdd0){if(_[_0xf2ac('0x49')](_0x31fdd0)){_0x31fdd0[_0xf2ac('0x4a')](function(_0x2b6d5e){RpcVoiceAgentReport[_0xf2ac('0x40')](_0x2b6d5e);});}else{RpcVoiceAgentReport[_0xf2ac('0x40')](_0x31fdd0);}};Report['prototype'][_0xf2ac('0x1a')]=function(_0x5370cb){RpcVoiceDialReport[_0xf2ac('0x40')](_0x5370cb);var _0x3a31a6;var _0xb8edca;var _0x23178d=_0x5370cb[_0xf2ac('0x37')];if(_[_0xf2ac('0x4b')](_0x23178d,_0xf2ac('0x4c'))){_0xb8edca=_0x23178d[_0xf2ac('0x4d')](_0x23178d[_0xf2ac('0x4e')]('/')+0x1,_0x23178d['indexOf']('@'));_0x3a31a6=_[_0xf2ac('0x21')](this[_0xf2ac('0xe')],function(_0x22a3f2){return _0x22a3f2[_0xf2ac('0x4f')]==_0xb8edca||_0x22a3f2[_0xf2ac('0x50')]==_0xb8edca||_0x22a3f2[_0xf2ac('0x1f')]==_0xb8edca;});}else{_0xb8edca=_0x23178d['substring'](_0x23178d[_0xf2ac('0x4e')]('/')+0x1,_0x23178d[_0xf2ac('0x51')]('-'));_0x3a31a6=this[_0xf2ac('0x1e')](_0xb8edca);}if(_0x3a31a6){_0x5370cb[_0xf2ac('0x22')]=_[_0xf2ac('0x28')](_0x3a31a6[_0xf2ac('0x22')])?util['format']('SIP/%s',_0x3a31a6[_0xf2ac('0x20')]):_0x3a31a6[_0xf2ac('0x22')];_0x5370cb[_0xf2ac('0x47')]=_0x3a31a6[_0xf2ac('0x20')];_0x5370cb['accountcode']=_0x3a31a6[_0xf2ac('0x1f')];RpcMemberReport[_0xf2ac('0x1a')](_0x5370cb);}};Report[_0xf2ac('0x1d')][_0xf2ac('0x1b')]=function(_0x1273f5){RpcVoiceTransferReport[_0xf2ac('0x3c')][_0x1273f5[_0xf2ac('0x52')]]=_0x1273f5;};Report[_0xf2ac('0x1d')][_0xf2ac('0x53')]=function(_0x5cfdc2){RpcVoiceTransferReport[_0xf2ac('0x53')](_0x5cfdc2);};module[_0xf2ac('0x54')]=Report; \ No newline at end of file +var _0x4bdc=['lastIndexOf','blindTransfer','transfers','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','SIP/%s','length','connectedlinenum','format','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','callerid','calleridnum','disposition','linkedid','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','Local','substring','indexOf','mobile'];(function(_0x55e602,_0x784205){var _0x403be8=function(_0x137ade){while(--_0x137ade){_0x55e602['push'](_0x55e602['shift']());}};_0x403be8(++_0x784205);}(_0x4bdc,0x199));var _0xc4bd=function(_0x29062e,_0x2ac95e){_0x29062e=_0x29062e-0x0;var _0x47e067=_0x4bdc[_0x29062e];return _0x47e067;};'use strict';var _=require(_0xc4bd('0x0'));var moment=require(_0xc4bd('0x1'));var util=require(_0xc4bd('0x2'));var config=require('../../../config/environment');var ami=require(_0xc4bd('0x3'));var RpcVoiceAgentReport=require(_0xc4bd('0x4'));var RpcVoiceCallReport=require(_0xc4bd('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xc4bd('0x6'));var RpcVoiceQueueReport=require(_0xc4bd('0x7'));var RpcVoiceRecording=require(_0xc4bd('0x8'));var RpcVoiceTransferReport=require(_0xc4bd('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xc4bd('0xa'));var VoiceDialReport=require(_0xc4bd('0xb'));var UserReport=require(_0xc4bd('0xc'));function Report(_0x2040eb){this[_0xc4bd('0xd')]=_0x2040eb;this['agents']=_0x2040eb[_0xc4bd('0xe')];this[_0xc4bd('0xf')]=_0x2040eb[_0xc4bd('0xf')];}Report[_0xc4bd('0x10')][_0xc4bd('0x11')]=function(_0x2f822f){var _0x296d41=new VoiceQueueReport(this['realtime']);var _0x40be9b=new VoiceAgentReport(this['realtime']);var _0x55f2f1=new VoiceDialReport(this[_0xc4bd('0xd')]);var _0x5a1297=new VoiceCallReport(this[_0xc4bd('0xd')]);var _0x3f8678=new UserReport(this[_0xc4bd('0xd')]);if(config['xdr']&&config[_0xc4bd('0x12')][_0xc4bd('0x13')]){ami['on']('custom:voiceQueueReport',this[_0xc4bd('0x14')][_0xc4bd('0x15')](this));ami['on'](_0xc4bd('0x16'),this[_0xc4bd('0x17')]['bind'](this));ami['on'](_0xc4bd('0x18'),this[_0xc4bd('0x19')][_0xc4bd('0x15')](this));ami['on'](_0xc4bd('0x1a'),this[_0xc4bd('0x1b')][_0xc4bd('0x15')](this));ami['on']('blindtransfer',this['blindTransfer'][_0xc4bd('0x15')](this));ami['on'](_0xc4bd('0x1c'),this['attendedTransfer'][_0xc4bd('0x15')](this));}};Report['prototype'][_0xc4bd('0x1d')]=function(_0xd5c03c){var _0x1c382c;_0x1c382c=_['find'](this[_0xc4bd('0xe')],function(_0x4c9469){return _0x4c9469[_0xc4bd('0x1e')]==_0xd5c03c||_0x4c9469[_0xc4bd('0x1f')]==_0xd5c03c;});if(_[_0xc4bd('0x20')](_0x1c382c)){var _0x3ccdee=_[_0xc4bd('0x21')](this[_0xc4bd('0xf')],function(_0x1cde85){return _0x1cde85[_0xc4bd('0x1e')]==_0xd5c03c||_0x1cde85['name']==_0xd5c03c;});if(_0x3ccdee){_0x1c382c=_[_0xc4bd('0x21')](this[_0xc4bd('0xe')],function(_0xd06bbc){return _0xd06bbc[_0xc4bd('0x22')]==util['format'](_0xc4bd('0x23'),_0x3ccdee[_0xc4bd('0x1f')]);});}}return _0x1c382c;};Report[_0xc4bd('0x10')][_0xc4bd('0x14')]=function(_0x176c7e){for(var _0x339f13=0x0;_0x339f13<_0x176c7e[_0xc4bd('0x24')];_0x339f13+=0x1){var _0x178d61=this[_0xc4bd('0x1d')](_0x176c7e[_0x339f13][_0xc4bd('0x25')]);if(_0x178d61){_0x176c7e[_0x339f13]['accountcode']=_0x178d61[_0xc4bd('0x1e')];_0x176c7e[_0x339f13]['assigned']=!![];_0x176c7e[_0x339f13]['lastAssignedTo']=_0x178d61[_0xc4bd('0x1f')];_0x176c7e[_0x339f13][_0xc4bd('0x22')]=_[_0xc4bd('0x20')](_0x178d61[_0xc4bd('0x22')])?util[_0xc4bd('0x26')](_0xc4bd('0x23'),_0x178d61[_0xc4bd('0x1f')]):_0x178d61[_0xc4bd('0x22')];if(_0x176c7e[_0x339f13][_0xc4bd('0x27')]){_0x176c7e[_0x339f13]['queuecallercompleteAt']=moment()['format'](_0xc4bd('0x28'));}if(_0x176c7e[_0x339f13][_0xc4bd('0x29')]){_0x176c7e[_0x339f13][_0xc4bd('0x2a')]=moment()[_0xc4bd('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc4bd('0x14')](_0x176c7e[_0x339f13]);}RpcVoiceQueueReport[_0xc4bd('0x2b')](_0x176c7e[_0x339f13]);}};function extractCalleridNumber(_0x1d9e05){var _0x50b218=_0x1d9e05[_0xc4bd('0x2c')](/<(.*?)>/);return _0x50b218?_0x50b218[0x1]:_0x1d9e05;}Report[_0xc4bd('0x10')]['voiceCallReport']=function(_0x485383){_0x485383[_0xc4bd('0x2d')]=_0x485383[_0xc4bd('0x2d')]||_0x485383[_0xc4bd('0x2e')];if(_0x485383[_0xc4bd('0x2f')]==_0xc4bd('0x30')){_0x485383[_0xc4bd('0x31')]=_0xc4bd('0x32');_0x485383[_0xc4bd('0x33')]=_0x485383[_0xc4bd('0x32')];if(_0x485383[_0xc4bd('0x34')]=='from-voip-provider'){_0x485383[_0xc4bd('0x1e')]='';_0x485383[_0xc4bd('0x2d')]=extractCalleridNumber(_0x485383['callerid']);}else if(_0x485383[_0xc4bd('0x34')]=='from-sip'){if(_0x485383[_0xc4bd('0x2d')]==_0xc4bd('0x35')){_0x485383[_0xc4bd('0x2d')]=extractCalleridNumber(_0x485383[_0xc4bd('0x36')]);_0x485383['calleridnum']=_0x485383[_0xc4bd('0x37')];_0x485383[_0xc4bd('0x38')]=[_0x485383[_0xc4bd('0x39')],_0x485383[_0xc4bd('0x39')]=_0x485383[_0xc4bd('0x38')]][0x0];_0x485383[_0xc4bd('0x3a')]=_0x485383[_0xc4bd('0x36')];}else{_0x485383[_0xc4bd('0x2d')]=_0x485383[_0xc4bd('0x3b')];_0x485383[_0xc4bd('0x3b')]=_0x485383[_0xc4bd('0x37')];if(_0x485383[_0xc4bd('0x3c')]=='ANSWERED'){_0x485383[_0xc4bd('0x1e')]=_0x485383[_0xc4bd('0x25')];}else{_0x485383['accountcode']='';}}}}else{_0x485383[_0xc4bd('0x3a')]=util[_0xc4bd('0x26')]('\x22%s\x22\x20<%s>',_0x485383['calleridname'],_0x485383[_0xc4bd('0x3b')]);}if(RpcVoiceTransferReport['transfers'][_0x485383[_0xc4bd('0x3d')]]){var _0x34975e=RpcVoiceTransferReport['transfers'][_0x485383['linkedid']];_0x34975e['transfereelinkedid']=_0x485383['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x34975e);delete RpcVoiceTransferReport['transfers'][_0x485383[_0xc4bd('0x3d')]];}RpcVoiceCallReport[_0xc4bd('0x2b')](_0x485383);if(_0x485383[_0xc4bd('0x3e')]){for(var _0x4ef075=0x0;_0x4ef075<_0x485383[_0xc4bd('0x3f')][_0xc4bd('0x24')];_0x4ef075+=0x1){_0x485383[_0xc4bd('0x40')]=_0x485383[_0xc4bd('0x3f')][_0x4ef075][_0xc4bd('0x41')];_0x485383[_0xc4bd('0x42')]=_0x485383[_0xc4bd('0x3f')][_0x4ef075][_0xc4bd('0x42')];if(_0x485383[_0xc4bd('0x2e')]==_0xc4bd('0x35')){_0x485383[_0xc4bd('0x3b')]=_0x485383[_0xc4bd('0x25')];_0x485383[_0xc4bd('0x43')]=_0x485383[_0xc4bd('0x44')];_0x485383[_0xc4bd('0x25')]=_0x485383[_0xc4bd('0x1e')];_0x485383[_0xc4bd('0x44')]=_0x485383[_0xc4bd('0x45')];_0x485383[_0xc4bd('0x2e')]=_0x485383[_0xc4bd('0x37')];}else if(_0x485383[_0xc4bd('0x2e')]==_0xc4bd('0x46')){_0x485383[_0xc4bd('0x3b')]=_0x485383['destination'];_0x485383[_0xc4bd('0x2e')]=_0x485383[_0xc4bd('0x37')];}RpcVoiceRecording[_0xc4bd('0x2b')](_0x485383);}}};Report[_0xc4bd('0x10')]['voiceAgentReport']=function(_0x1660f7){if(_[_0xc4bd('0x47')](_0x1660f7)){_0x1660f7['forEach'](function(_0x3f5653){RpcVoiceAgentReport[_0xc4bd('0x2b')](_0x3f5653);});}else{RpcVoiceAgentReport[_0xc4bd('0x2b')](_0x1660f7);}};Report[_0xc4bd('0x10')][_0xc4bd('0x1b')]=function(_0xb2a644){RpcVoiceDialReport[_0xc4bd('0x2b')](_0xb2a644);var _0x47bd97;var _0x41a2a9;var _0x16242a=_0xb2a644[_0xc4bd('0x39')];if(_[_0xc4bd('0x48')](_0x16242a,_0xc4bd('0x49'))){_0x41a2a9=_0x16242a[_0xc4bd('0x4a')](_0x16242a[_0xc4bd('0x4b')]('/')+0x1,_0x16242a[_0xc4bd('0x4b')]('@'));_0x47bd97=_['find'](this[_0xc4bd('0xe')],function(_0x427017){return _0x427017[_0xc4bd('0x4c')]==_0x41a2a9||_0x427017['phone']==_0x41a2a9||_0x427017[_0xc4bd('0x1e')]==_0x41a2a9;});}else{_0x41a2a9=_0x16242a[_0xc4bd('0x4a')](_0x16242a[_0xc4bd('0x4b')]('/')+0x1,_0x16242a[_0xc4bd('0x4d')]('-'));_0x47bd97=this[_0xc4bd('0x1d')](_0x41a2a9);}if(_0x47bd97){_0xb2a644[_0xc4bd('0x22')]=_[_0xc4bd('0x20')](_0x47bd97['interface'])?util[_0xc4bd('0x26')]('SIP/%s',_0x47bd97[_0xc4bd('0x1f')]):_0x47bd97[_0xc4bd('0x22')];_0xb2a644[_0xc4bd('0x45')]=_0x47bd97[_0xc4bd('0x1f')];_0xb2a644[_0xc4bd('0x1e')]=_0x47bd97[_0xc4bd('0x1e')];RpcMemberReport[_0xc4bd('0x1b')](_0xb2a644);}};Report[_0xc4bd('0x10')][_0xc4bd('0x4e')]=function(_0x47cf79){RpcVoiceTransferReport[_0xc4bd('0x4f')][_0x47cf79['transfererlinkedid']]=_0x47cf79;};Report[_0xc4bd('0x10')]['attendedTransfer']=function(_0x39f463){RpcVoiceTransferReport['attendedTransfer'](_0x39f463);};module[_0xc4bd('0x50')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 64ba867..e62a088 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d75=['format','trunk:%s','name','trunk:save','isNotNull','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','local','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','Local','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5d75,0x19e));var _0x55d7=function(_0x5abc2f,_0x40cc10){_0x5abc2f=_0x5abc2f-0x0;var _0x352b0d=_0x5d75[_0x5abc2f];return _0x352b0d;};'use strict';var _=require(_0x55d7('0x0'));var moment=require(_0x55d7('0x1'));var util=require(_0x55d7('0x2'));var Redis=require(_0x55d7('0x3'));var BPromise=require(_0x55d7('0x4'));var config=require(_0x55d7('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x55d7('0x6'));config[_0x55d7('0x7')]=_[_0x55d7('0x8')](config['redis'],{'host':_0x55d7('0x9'),'port':0x18eb});var io=require(_0x55d7('0xa'))(new Redis(config['redis']));function UserReport(_0x1290fc){this[_0x55d7('0xb')]=_0x1290fc[_0x55d7('0xb')];this[_0x55d7('0xc')]=_0x1290fc[_0x55d7('0xc')];this[_0x55d7('0xd')]=_0x1290fc[_0x55d7('0xd')];ami['on']('registryentry',this[_0x55d7('0xe')][_0x55d7('0xf')](this));ami['on'](_0x55d7('0x10'),this[_0x55d7('0xe')]['bind'](this));ami['on'](_0x55d7('0x11'),this[_0x55d7('0x12')]['bind'](this));ami['on'](_0x55d7('0x13'),this[_0x55d7('0x14')][_0x55d7('0xf')](this));return this[_0x55d7('0x15')]();}function showSipRegistrations(){Promise[_0x55d7('0x16')]()[_0x55d7('0x17')](ami[_0x55d7('0x18')]())[_0x55d7('0x19')](function(_0x2bcb82){logger[_0x55d7('0x1a')](_0x55d7('0x1b'),util[_0x55d7('0x1c')](_0x2bcb82,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x55d7('0x16')]()[_0x55d7('0x17')](ami[_0x55d7('0x1d')]())['catch'](function(_0x299bde){logger[_0x55d7('0x1a')](_0x55d7('0x1e'),util[_0x55d7('0x1c')](_0x299bde,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x55d7('0x16')]()[_0x55d7('0x17')](ami[_0x55d7('0x1f')]())[_0x55d7('0x19')](function(_0x1285b8){logger['error'](_0x55d7('0x20'),util['inspect'](_0x1285b8,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x55d7('0x16')]()[_0x55d7('0x17')](showSipRegistrations())['then'](listDeviceStates())[_0x55d7('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x55d7('0x21')]['isNotNull']=function(_0x552ab9){return _0x552ab9!==null&&!_[_0x55d7('0x22')](_0x552ab9);};UserReport[_0x55d7('0x21')]['emit']=function(_0x3f089e,_0x8f5e35,_0x3d5993){io['to'](_0x3f089e)[_0x55d7('0x23')](_0x8f5e35,_0x3d5993);};UserReport['prototype'][_0x55d7('0xe')]=function(_0x377d2f){try{if(this['isNotNull'](_0x377d2f)){logger[_0x55d7('0x24')](_0x55d7('0x25'),_0x377d2f[_0x55d7('0x26')],_0x377d2f[_0x55d7('0x27')]);logger[_0x55d7('0x28')](_0x55d7('0x29'),util[_0x55d7('0x1c')](_0x377d2f,{'showHidden':![],'depth':null}));var _0x43f36e=_[_0x55d7('0x2a')](this[_0x55d7('0xb')],{'defaultuser':_0x377d2f[_0x55d7('0x26')]});if(_0x43f36e){_0x377d2f[_0x55d7('0x2b')]=_0x377d2f['state'];_[_0x55d7('0x2c')](_0x43f36e,_['omit'](_0x377d2f,[_0x55d7('0x2d'),_0x55d7('0x2e'),'username',_0x55d7('0x27')]));logger['debug'](_0x55d7('0x2f'),util[_0x55d7('0x1c')](_0x43f36e,{'showHidden':![],'depth':null}));this[_0x55d7('0x23')](util[_0x55d7('0x30')](_0x55d7('0x31'),_0x43f36e[_0x55d7('0x32')]),_0x55d7('0x33'),_0x43f36e);}}}catch(_0x17dc78){logger[_0x55d7('0x1a')](_0x55d7('0x29'),util[_0x55d7('0x1c')](_0x17dc78,{'showHidden':![],'depth':null}));}};UserReport[_0x55d7('0x21')][_0x55d7('0x12')]=function(_0x58da44){try{if(this[_0x55d7('0x34')](_0x58da44)){logger[_0x55d7('0x24')](_0x55d7('0x35'),_0x58da44[_0x55d7('0x36')],_0x58da44['state']);logger['debug'](_0x55d7('0x37'),util[_0x55d7('0x1c')](_0x58da44,{'showHidden':![],'depth':null}));if(this[_0x55d7('0xc')][_0x58da44['device']]){if(!this['agents'][_0x58da44['device']]['local']||_0x58da44['state'][_0x55d7('0x38')]()=='inuse'){this[_0x55d7('0xc')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x39')]=![];if(this[_0x55d7('0xc')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x27')]!==_0x58da44['state'][_0x55d7('0x38')]()){this[_0x55d7('0xc')][_0x58da44['device']][_0x55d7('0x3a')]=_['toNumber'](moment()[_0x55d7('0x30')]('x'));}this[_0x55d7('0xc')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x27')]=_0x58da44[_0x55d7('0x27')][_0x55d7('0x38')]();this[_0x55d7('0xc')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x3b')](_0x58da44);}}else if(this[_0x55d7('0xd')][_0x58da44[_0x55d7('0x36')]]){if(this['telephones'][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x27')]!==_0x58da44[_0x55d7('0x27')][_0x55d7('0x38')]()){this[_0x55d7('0xd')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x3a')]=_[_0x55d7('0x3c')](moment()[_0x55d7('0x30')]('x'));}this[_0x55d7('0xd')][_0x58da44['device']]['state']=_0x58da44['state'][_0x55d7('0x38')]();logger[_0x55d7('0x28')](_0x55d7('0x3d'),util[_0x55d7('0x1c')](this[_0x55d7('0xd')][_0x58da44['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x55d7('0x30')](_0x55d7('0x3e'),this[_0x55d7('0xd')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x32')]),_0x55d7('0x3f'),this[_0x55d7('0xd')][_0x58da44[_0x55d7('0x36')]]);}else if(this[_0x55d7('0xb')][_0x58da44[_0x55d7('0x36')]]){if(this[_0x55d7('0xb')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x27')]!==_0x58da44[_0x55d7('0x27')][_0x55d7('0x38')]()){this[_0x55d7('0xb')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x3a')]=_[_0x55d7('0x3c')](moment()[_0x55d7('0x30')]('x'));}this['trunks'][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x27')]=_0x58da44[_0x55d7('0x27')][_0x55d7('0x38')]();logger[_0x55d7('0x28')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x55d7('0x1c')](this['trunks'][_0x58da44[_0x55d7('0x36')]],{'showHidden':![],'depth':null}));this[_0x55d7('0x23')](util[_0x55d7('0x30')](_0x55d7('0x31'),this[_0x55d7('0xb')][_0x58da44[_0x55d7('0x36')]][_0x55d7('0x32')]),_0x55d7('0x33'),this[_0x55d7('0xb')][_0x58da44[_0x55d7('0x36')]]);}else if(_['startsWith'](_0x58da44['device'],_0x55d7('0x40'))){var _0x426d87=_0x58da44[_0x55d7('0x36')];var _0xae7687=_0x426d87['substring'](_0x426d87[_0x55d7('0x41')]('/')+0x1,_0x426d87[_0x55d7('0x41')]('@'));var _0x666d3d=_['find'](this['agents'],function(_0x3aa460){return _0x3aa460[_0x55d7('0x42')]==_0xae7687||_0x3aa460[_0x55d7('0x43')]==_0xae7687||_0x3aa460[_0x55d7('0x44')]==_0xae7687;});if(_0x666d3d){if(_0x666d3d[_0x55d7('0x27')]!==_0x58da44[_0x55d7('0x27')][_0x55d7('0x38')]()){_0x666d3d[_0x55d7('0x3a')]=_[_0x55d7('0x3c')](moment()['format']('x'));}_0x666d3d[_0x55d7('0x27')]=_0x58da44[_0x55d7('0x27')][_0x55d7('0x38')]();_0x666d3d['local']=!![];_0x666d3d[_0x55d7('0x3b')](_0x58da44);}}}}catch(_0x33cf5c){logger[_0x55d7('0x1a')](_0x55d7('0x37'),util[_0x55d7('0x1c')](_0x33cf5c,{'showHidden':![],'depth':null}));}};UserReport[_0x55d7('0x21')][_0x55d7('0x14')]=function(_0x35a631){try{if(this[_0x55d7('0x34')](_0x35a631)&&this[_0x55d7('0x34')](_0x35a631[_0x55d7('0x13')])){logger[_0x55d7('0x24')](_0x55d7('0x45'),_0x35a631[_0x55d7('0x46')],_0x35a631[_0x55d7('0x47')],_0x35a631['peerstatus']);logger[_0x55d7('0x28')](_0x55d7('0x48'),util[_0x55d7('0x1c')](_0x35a631,{'showHidden':![],'depth':null}));if(this[_0x55d7('0xc')][_0x35a631[_0x55d7('0x46')]]){if(!this[_0x55d7('0xc')][_0x35a631[_0x55d7('0x46')]]['local']||_0x35a631[_0x55d7('0x13')][_0x55d7('0x38')]()==_0x55d7('0x49')){this['agents'][_0x35a631['peer']]['local']=![];this[_0x55d7('0xc')][_0x35a631[_0x55d7('0x46')]]['status']=_0x35a631[_0x55d7('0x13')][_0x55d7('0x38')]();this[_0x55d7('0xc')][_0x35a631[_0x55d7('0x46')]]['address']=_0x35a631[_0x55d7('0x47')];this[_0x55d7('0xc')][_0x35a631[_0x55d7('0x46')]][_0x55d7('0x3b')](_0x35a631);}}else if(this['telephones'][_0x35a631[_0x55d7('0x46')]]){this['telephones'][_0x35a631[_0x55d7('0x46')]]['status']=_0x35a631[_0x55d7('0x13')][_0x55d7('0x38')]();this[_0x55d7('0xd')][_0x35a631[_0x55d7('0x46')]][_0x55d7('0x47')]=_0x35a631[_0x55d7('0x47')];logger[_0x55d7('0x28')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x55d7('0x1c')](this[_0x55d7('0xd')][_0x35a631[_0x55d7('0x46')]],{'showHidden':![],'depth':null}));this[_0x55d7('0x23')](util['format'](_0x55d7('0x3e'),this[_0x55d7('0xd')][_0x35a631[_0x55d7('0x46')]][_0x55d7('0x32')]),_0x55d7('0x3f'),this['telephones'][_0x35a631[_0x55d7('0x46')]]);}else if(this[_0x55d7('0xb')][_0x35a631[_0x55d7('0x46')]]){this[_0x55d7('0xb')][_0x35a631[_0x55d7('0x46')]][_0x55d7('0x4a')]=_0x35a631[_0x55d7('0x13')]['toLowerCase']();this[_0x55d7('0xb')][_0x35a631[_0x55d7('0x46')]][_0x55d7('0x47')]=_0x35a631[_0x55d7('0x47')];logger['debug'](_0x55d7('0x4b'),util[_0x55d7('0x1c')](this[_0x55d7('0xb')][_0x35a631['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x55d7('0x30')](_0x55d7('0x31'),this[_0x55d7('0xb')][_0x35a631['peer']][_0x55d7('0x32')]),'trunk:save',this[_0x55d7('0xb')][_0x35a631[_0x55d7('0x46')]]);}}}catch(_0x1149bc){logger['error'](_0x55d7('0x48'),util[_0x55d7('0x1c')](_0x1149bc,{'showHidden':![],'depth':null}));}};module[_0x55d7('0x4c')]=UserReport; \ No newline at end of file +var _0x7b4c=['updateStatusRealtime','exports','lodash','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','defaults','localhost','socket.io-emitter','redis','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','inspect','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','stateRegistry','merge','omit','event','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]','device','local','inuse','toLowerCase','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','indexOf','find','mobile','phone','accountcode','peerstatus','peer','address','[userReport][peerstatus]','status'];(function(_0x15f590,_0x42b288){var _0x53671c=function(_0x2569cb){while(--_0x2569cb){_0x15f590['push'](_0x15f590['shift']());}};_0x53671c(++_0x42b288);}(_0x7b4c,0x126));var _0xc7b4=function(_0x1e402d,_0x4e06fb){_0x1e402d=_0x1e402d-0x0;var _0x5446e1=_0x7b4c[_0x1e402d];return _0x5446e1;};'use strict';var _=require(_0xc7b4('0x0'));var moment=require('moment');var util=require(_0xc7b4('0x1'));var Redis=require(_0xc7b4('0x2'));var BPromise=require(_0xc7b4('0x3'));var config=require(_0xc7b4('0x4'));var logger=require(_0xc7b4('0x5'))(_0xc7b4('0x6'));var ami=require('../ami');config['redis']=_[_0xc7b4('0x7')](config['redis'],{'host':_0xc7b4('0x8'),'port':0x18eb});var io=require(_0xc7b4('0x9'))(new Redis(config[_0xc7b4('0xa')]));function UserReport(_0x4cf166){this[_0xc7b4('0xb')]=_0x4cf166[_0xc7b4('0xb')];this[_0xc7b4('0xc')]=_0x4cf166[_0xc7b4('0xc')];this['telephones']=_0x4cf166[_0xc7b4('0xd')];ami['on'](_0xc7b4('0xe'),this[_0xc7b4('0xf')][_0xc7b4('0x10')](this));ami['on'](_0xc7b4('0x11'),this[_0xc7b4('0xf')][_0xc7b4('0x10')](this));ami['on'](_0xc7b4('0x12'),this[_0xc7b4('0x13')][_0xc7b4('0x10')](this));ami['on']('peerstatus',this[_0xc7b4('0x14')]['bind'](this));return this[_0xc7b4('0x15')]();}function showSipRegistrations(){Promise[_0xc7b4('0x16')]()[_0xc7b4('0x17')](ami[_0xc7b4('0x18')]())[_0xc7b4('0x19')](function(_0x206122){logger[_0xc7b4('0x1a')](_0xc7b4('0x1b'),util['inspect'](_0x206122,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xc7b4('0x17')](ami[_0xc7b4('0x1c')]())[_0xc7b4('0x19')](function(_0x4bdaa5){logger[_0xc7b4('0x1a')]('[userReport][devicestatelist]',util[_0xc7b4('0x1d')](_0x4bdaa5,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc7b4('0x16')]()[_0xc7b4('0x17')](ami[_0xc7b4('0x1e')]())['catch'](function(_0x59e268){logger[_0xc7b4('0x1a')]('[userReport][sippeerstatus]',util['inspect'](_0x59e268,{'showHidden':![],'depth':null}));});}UserReport[_0xc7b4('0x1f')][_0xc7b4('0x15')]=function(){setInterval(function(){BPromise[_0xc7b4('0x16')]()[_0xc7b4('0x17')](showSipRegistrations())[_0xc7b4('0x17')](listDeviceStates())[_0xc7b4('0x17')](showPeersStatus());},0x32c8);};UserReport[_0xc7b4('0x1f')][_0xc7b4('0x20')]=function(_0xfdbf59){return _0xfdbf59!==null&&!_[_0xc7b4('0x21')](_0xfdbf59);};UserReport['prototype']['emit']=function(_0x208199,_0x5607fe,_0x4199cc){io['to'](_0x208199)[_0xc7b4('0x22')](_0x5607fe,_0x4199cc);};UserReport[_0xc7b4('0x1f')][_0xc7b4('0xf')]=function(_0xd0c5a9){try{if(this[_0xc7b4('0x20')](_0xd0c5a9)){logger[_0xc7b4('0x23')](_0xc7b4('0x24'),_0xd0c5a9[_0xc7b4('0x25')],_0xd0c5a9[_0xc7b4('0x26')]);logger['debug'](_0xc7b4('0x27'),util['inspect'](_0xd0c5a9,{'showHidden':![],'depth':null}));var _0x1d1d63=_['find'](this[_0xc7b4('0xb')],{'defaultuser':_0xd0c5a9[_0xc7b4('0x25')]});if(_0x1d1d63){_0xd0c5a9[_0xc7b4('0x28')]=_0xd0c5a9['state'];_[_0xc7b4('0x29')](_0x1d1d63,_[_0xc7b4('0x2a')](_0xd0c5a9,[_0xc7b4('0x2b'),'actionid',_0xc7b4('0x25'),'state']));logger[_0xc7b4('0x2c')](_0xc7b4('0x2d'),util[_0xc7b4('0x1d')](_0x1d1d63,{'showHidden':![],'depth':null}));this[_0xc7b4('0x22')](util[_0xc7b4('0x2e')](_0xc7b4('0x2f'),_0x1d1d63[_0xc7b4('0x30')]),_0xc7b4('0x31'),_0x1d1d63);}}}catch(_0x129c88){logger['error']('[userReport][registry]',util['inspect'](_0x129c88,{'showHidden':![],'depth':null}));}};UserReport[_0xc7b4('0x1f')][_0xc7b4('0x13')]=function(_0x3fb4d4){try{if(this['isNotNull'](_0x3fb4d4)){logger[_0xc7b4('0x23')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x3fb4d4['device'],_0x3fb4d4[_0xc7b4('0x26')]);logger[_0xc7b4('0x2c')](_0xc7b4('0x32'),util[_0xc7b4('0x1d')](_0x3fb4d4,{'showHidden':![],'depth':null}));if(this[_0xc7b4('0xc')][_0x3fb4d4['device']]){if(!this['agents'][_0x3fb4d4[_0xc7b4('0x33')]][_0xc7b4('0x34')]||_0x3fb4d4['state']['toLowerCase']()==_0xc7b4('0x35')){this[_0xc7b4('0xc')][_0x3fb4d4['device']][_0xc7b4('0x34')]=![];if(this['agents'][_0x3fb4d4[_0xc7b4('0x33')]]['state']!==_0x3fb4d4['state'][_0xc7b4('0x36')]()){this[_0xc7b4('0xc')][_0x3fb4d4[_0xc7b4('0x33')]][_0xc7b4('0x37')]=_[_0xc7b4('0x38')](moment()['format']('x'));}this[_0xc7b4('0xc')][_0x3fb4d4['device']][_0xc7b4('0x26')]=_0x3fb4d4[_0xc7b4('0x26')][_0xc7b4('0x36')]();this[_0xc7b4('0xc')][_0x3fb4d4[_0xc7b4('0x33')]]['updateStatusRealtime'](_0x3fb4d4);}}else if(this[_0xc7b4('0xd')][_0x3fb4d4[_0xc7b4('0x33')]]){if(this[_0xc7b4('0xd')][_0x3fb4d4[_0xc7b4('0x33')]][_0xc7b4('0x26')]!==_0x3fb4d4[_0xc7b4('0x26')][_0xc7b4('0x36')]()){this[_0xc7b4('0xd')][_0x3fb4d4[_0xc7b4('0x33')]][_0xc7b4('0x37')]=_[_0xc7b4('0x38')](moment()[_0xc7b4('0x2e')]('x'));}this['telephones'][_0x3fb4d4[_0xc7b4('0x33')]][_0xc7b4('0x26')]=_0x3fb4d4[_0xc7b4('0x26')][_0xc7b4('0x36')]();logger[_0xc7b4('0x2c')](_0xc7b4('0x39'),util[_0xc7b4('0x1d')](this['telephones'][_0x3fb4d4[_0xc7b4('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc7b4('0x2e')](_0xc7b4('0x3a'),this[_0xc7b4('0xd')][_0x3fb4d4[_0xc7b4('0x33')]][_0xc7b4('0x30')]),_0xc7b4('0x3b'),this[_0xc7b4('0xd')][_0x3fb4d4[_0xc7b4('0x33')]]);}else if(this[_0xc7b4('0xb')][_0x3fb4d4['device']]){if(this[_0xc7b4('0xb')][_0x3fb4d4[_0xc7b4('0x33')]][_0xc7b4('0x26')]!==_0x3fb4d4[_0xc7b4('0x26')][_0xc7b4('0x36')]()){this[_0xc7b4('0xb')][_0x3fb4d4[_0xc7b4('0x33')]][_0xc7b4('0x37')]=_[_0xc7b4('0x38')](moment()['format']('x'));}this[_0xc7b4('0xb')][_0x3fb4d4[_0xc7b4('0x33')]]['state']=_0x3fb4d4['state'][_0xc7b4('0x36')]();logger[_0xc7b4('0x2c')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xc7b4('0xb')][_0x3fb4d4[_0xc7b4('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc7b4('0x2e')]('trunk:%s',this[_0xc7b4('0xb')][_0x3fb4d4[_0xc7b4('0x33')]]['name']),_0xc7b4('0x31'),this[_0xc7b4('0xb')][_0x3fb4d4[_0xc7b4('0x33')]]);}else if(_[_0xc7b4('0x3c')](_0x3fb4d4[_0xc7b4('0x33')],'Local')){var _0xb93244=_0x3fb4d4[_0xc7b4('0x33')];var _0x5fab91=_0xb93244['substring'](_0xb93244[_0xc7b4('0x3d')]('/')+0x1,_0xb93244[_0xc7b4('0x3d')]('@'));var _0x666794=_[_0xc7b4('0x3e')](this[_0xc7b4('0xc')],function(_0x3f6775){return _0x3f6775[_0xc7b4('0x3f')]==_0x5fab91||_0x3f6775[_0xc7b4('0x40')]==_0x5fab91||_0x3f6775[_0xc7b4('0x41')]==_0x5fab91;});if(_0x666794){if(_0x666794[_0xc7b4('0x26')]!==_0x3fb4d4[_0xc7b4('0x26')][_0xc7b4('0x36')]()){_0x666794[_0xc7b4('0x37')]=_[_0xc7b4('0x38')](moment()['format']('x'));}_0x666794[_0xc7b4('0x26')]=_0x3fb4d4[_0xc7b4('0x26')][_0xc7b4('0x36')]();_0x666794[_0xc7b4('0x34')]=!![];_0x666794['updateStatusRealtime'](_0x3fb4d4);}}}}catch(_0x41cab6){logger['error'](_0xc7b4('0x32'),util[_0xc7b4('0x1d')](_0x41cab6,{'showHidden':![],'depth':null}));}};UserReport[_0xc7b4('0x1f')]['syncPeerStatus']=function(_0x1e6a95){try{if(this[_0xc7b4('0x20')](_0x1e6a95)&&this[_0xc7b4('0x20')](_0x1e6a95[_0xc7b4('0x42')])){logger[_0xc7b4('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1e6a95[_0xc7b4('0x43')],_0x1e6a95[_0xc7b4('0x44')],_0x1e6a95[_0xc7b4('0x42')]);logger['debug'](_0xc7b4('0x45'),util[_0xc7b4('0x1d')](_0x1e6a95,{'showHidden':![],'depth':null}));if(this[_0xc7b4('0xc')][_0x1e6a95[_0xc7b4('0x43')]]){if(!this[_0xc7b4('0xc')][_0x1e6a95[_0xc7b4('0x43')]][_0xc7b4('0x34')]||_0x1e6a95[_0xc7b4('0x42')][_0xc7b4('0x36')]()=='registered'){this['agents'][_0x1e6a95[_0xc7b4('0x43')]][_0xc7b4('0x34')]=![];this[_0xc7b4('0xc')][_0x1e6a95[_0xc7b4('0x43')]][_0xc7b4('0x46')]=_0x1e6a95['peerstatus'][_0xc7b4('0x36')]();this[_0xc7b4('0xc')][_0x1e6a95['peer']][_0xc7b4('0x44')]=_0x1e6a95[_0xc7b4('0x44')];this[_0xc7b4('0xc')][_0x1e6a95['peer']][_0xc7b4('0x47')](_0x1e6a95);}}else if(this[_0xc7b4('0xd')][_0x1e6a95['peer']]){this[_0xc7b4('0xd')][_0x1e6a95[_0xc7b4('0x43')]]['status']=_0x1e6a95[_0xc7b4('0x42')][_0xc7b4('0x36')]();this[_0xc7b4('0xd')][_0x1e6a95[_0xc7b4('0x43')]][_0xc7b4('0x44')]=_0x1e6a95[_0xc7b4('0x44')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xc7b4('0x1d')](this[_0xc7b4('0xd')][_0x1e6a95[_0xc7b4('0x43')]],{'showHidden':![],'depth':null}));this[_0xc7b4('0x22')](util[_0xc7b4('0x2e')](_0xc7b4('0x3a'),this[_0xc7b4('0xd')][_0x1e6a95[_0xc7b4('0x43')]]['name']),_0xc7b4('0x3b'),this[_0xc7b4('0xd')][_0x1e6a95[_0xc7b4('0x43')]]);}else if(this[_0xc7b4('0xb')][_0x1e6a95['peer']]){this['trunks'][_0x1e6a95[_0xc7b4('0x43')]][_0xc7b4('0x46')]=_0x1e6a95['peerstatus'][_0xc7b4('0x36')]();this[_0xc7b4('0xb')][_0x1e6a95['peer']][_0xc7b4('0x44')]=_0x1e6a95[_0xc7b4('0x44')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xc7b4('0x1d')](this['trunks'][_0x1e6a95[_0xc7b4('0x43')]],{'showHidden':![],'depth':null}));this[_0xc7b4('0x22')](util['format'](_0xc7b4('0x2f'),this['trunks'][_0x1e6a95[_0xc7b4('0x43')]][_0xc7b4('0x30')]),'trunk:save',this[_0xc7b4('0xb')][_0x1e6a95[_0xc7b4('0x43')]]);}}}catch(_0xeeb5d9){logger[_0xc7b4('0x1a')]('[userReport][peerstatus]',util['inspect'](_0xeeb5d9,{'showHidden':![],'depth':null}));}};module[_0xc7b4('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7b122d5..94bdb51 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x1a9c8e,_0xd5e5fb){var _0x31d0a4=function(_0x4d2461){while(--_0x4d2461){_0x1a9c8e['push'](_0x1a9c8e['shift']());}};_0x31d0a4(++_0xd5e5fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x139cc2,_0x4f28c0){var _0x19f8c6=function(_0x46b58d){while(--_0x46b58d){_0x139cc2['push'](_0x139cc2['shift']());}};_0x19f8c6(++_0x4f28c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index c9e5b40..b142b74 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 _0x3ac8=['subtract','seconds','includes','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','OutgoingSpoolFailed','variable','mixmonitor_filename','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','StopMixMonitor','catch','Action','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','secondtransfereruniqueid','transfercalleridnum','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','transferconnectedlinenum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','merge','pick','context','from-sip','exten','xcally-motion-preview','channel','split','destconnectedlinenum','connectedlinenum','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','duration'];(function(_0xaf247,_0x1a8d8a){var _0x3366c9=function(_0x3e8681){while(--_0x3e8681){_0xaf247['push'](_0xaf247['shift']());}};_0x3366c9(++_0x1a8d8a);}(_0x3ac8,0x6b));var _0x83ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x83ac('0x0'));var moment=require(_0x83ac('0x1'));var util=require(_0x83ac('0x2'));var path=require(_0x83ac('0x3'));var Redis=require(_0x83ac('0x4'));var config=require(_0x83ac('0x5'));var logger=require('../../../config/logger')(_0x83ac('0x6'));var ami=require(_0x83ac('0x7'));var Channel=require(_0x83ac('0x8'));var RpcSetting=require(_0x83ac('0x9'));var applications=[_0x83ac('0xa'),_0x83ac('0xb'),_0x83ac('0xc'),_0x83ac('0xd'),_0x83ac('0xe'),_0x83ac('0xf')];var dispositions=['NO\x20ANSWER',_0x83ac('0x10'),_0x83ac('0x10'),'NO\x20ANSWER','NO\x20ANSWER',_0x83ac('0x11'),_0x83ac('0x12'),_0x83ac('0x13'),'FAILED',_0x83ac('0x10'),_0x83ac('0x10')];config['redis']=_['defaults'](config[_0x83ac('0x14')],{'host':_0x83ac('0x15'),'port':0x18eb});var io=require(_0x83ac('0x16'))(new Redis(config[_0x83ac('0x14')]));function VoiceCallReport(_0x1280ac){this[_0x83ac('0x17')]=_0x1280ac[_0x83ac('0x17')];this[_0x83ac('0x18')]=_0x1280ac[_0x83ac('0x18')];this[_0x83ac('0x19')]={};ami['on'](_0x83ac('0x1a'),this[_0x83ac('0x1b')][_0x83ac('0x1c')](this));ami['on']('newexten',this[_0x83ac('0x1b')][_0x83ac('0x1c')](this));ami['on'](_0x83ac('0x1d'),this[_0x83ac('0x1e')][_0x83ac('0x1c')](this));ami['on'](_0x83ac('0x1f'),this[_0x83ac('0x20')][_0x83ac('0x1c')](this));ami['on'](_0x83ac('0x21'),this[_0x83ac('0x22')]['bind'](this));ami['on'](_0x83ac('0x23'),this[_0x83ac('0x24')][_0x83ac('0x1c')](this));ami['on'](_0x83ac('0x25'),this[_0x83ac('0x26')]['bind'](this));ami['on'](_0x83ac('0x27'),this['syncAttendedTransfer'][_0x83ac('0x1c')](this));ami['on'](_0x83ac('0x28'),this[_0x83ac('0x29')][_0x83ac('0x1c')](this));ami['on'](_0x83ac('0x2a'),this[_0x83ac('0x2b')][_0x83ac('0x1c')](this));ami['on'](_0x83ac('0x2c'),this[_0x83ac('0x2d')]['bind'](this));try{logger[_0x83ac('0x2e')](_0x83ac('0x2f'));ami[_0x83ac('0x30')]();}catch(_0x498338){logger[_0x83ac('0x31')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x498338,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x83ac('0x32')]['isNotNull']=function(_0x4a312f){return _0x4a312f!==null&&!_[_0x83ac('0x33')](_0x4a312f);};VoiceCallReport[_0x83ac('0x32')][_0x83ac('0x34')]=function(_0x40eb5b,_0x5072d5,_0x41c9f8){io['to'](_0x40eb5b)['emit'](_0x5072d5,_0x41c9f8);};VoiceCallReport[_0x83ac('0x32')]['syncNewCallerId']=function(_0x2ea07a){try{if(this[_0x83ac('0x35')](_0x2ea07a)){logger[_0x83ac('0x2e')](_0x83ac('0x36'),_0x2ea07a[_0x83ac('0x37')],_0x2ea07a[_0x83ac('0x38')],_0x2ea07a[_0x83ac('0x39')]);logger[_0x83ac('0x3a')](_0x83ac('0x3b'),_0x2ea07a[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0x2ea07a,{'showHidden':![],'depth':null}));if(_0x2ea07a[_0x83ac('0x37')]===_0x2ea07a[_0x83ac('0x3d')]){if(!_[_0x83ac('0x33')](this['channels'][_0x2ea07a[_0x83ac('0x37')]])){_[_0x83ac('0x3e')](this[_0x83ac('0x17')][_0x2ea07a[_0x83ac('0x37')]],_[_0x83ac('0x3f')](_0x2ea07a,_['keys'](this[_0x83ac('0x17')][_0x2ea07a[_0x83ac('0x37')]])));}}if(_0x2ea07a[_0x83ac('0x40')]===_0x83ac('0x41')){if(this[_0x83ac('0x18')][_0x2ea07a['channel']['split']('-')[0x0]]){if(_0x2ea07a[_0x83ac('0x42')]==_0x83ac('0x43')){this[_0x83ac('0x18')][_0x2ea07a[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x46')]=_0x2ea07a[_0x83ac('0x47')];this['emit'](util['format'](_0x83ac('0x48'),this[_0x83ac('0x18')][_0x2ea07a[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]['name']),_0x83ac('0x49'),{'destaccountcode':this[_0x83ac('0x18')][_0x2ea07a['channel']['split']('-')[0x0]][_0x83ac('0x4a')],'destconnectedlinenum':_0x2ea07a['connectedlinenum']});}}}}}catch(_0x12ee9b){logger['error'](_0x83ac('0x4b'),_0x2ea07a[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0x12ee9b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x83ac('0x32')][_0x83ac('0x1e')]=function(_0x10c378){try{if(this['isNotNull'](_0x10c378)){logger[_0x83ac('0x3a')](_0x83ac('0x4c'),_0x10c378[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0x10c378,{'showHidden':![],'depth':null}));if(_0x10c378[_0x83ac('0x37')]===_0x10c378['linkedid']&&_0x10c378[_0x83ac('0x44')]!='OutgoingSpoolFailed'){if(_[_0x83ac('0x33')](this[_0x83ac('0x17')][_0x10c378[_0x83ac('0x37')]])){logger[_0x83ac('0x2e')](_0x83ac('0x4d'),_0x10c378[_0x83ac('0x37')],_0x10c378['context'],_0x10c378[_0x83ac('0x42')]);this['channels'][_0x10c378[_0x83ac('0x37')]]=new Channel();this['channels'][_0x10c378[_0x83ac('0x37')]][_0x83ac('0x4e')]=moment()[_0x83ac('0x4f')](_0x83ac('0x50'));this['channels'][_0x10c378[_0x83ac('0x37')]][_0x83ac('0x51')]=dispositions[_[_0x83ac('0x52')](_0x10c378[_0x83ac('0x53')])];_[_0x83ac('0x3e')](this[_0x83ac('0x17')][_0x10c378[_0x83ac('0x37')]],_[_0x83ac('0x3f')](_0x10c378,_[_0x83ac('0x54')](this[_0x83ac('0x17')][_0x10c378[_0x83ac('0x37')]])));if(_0x10c378[_0x83ac('0x40')]==='from-sip'){if(this[_0x83ac('0x18')][_0x10c378[_0x83ac('0x44')]['split']('-')[0x0]]){if(_[_0x83ac('0x33')](this[_0x83ac('0x18')][_0x10c378[_0x83ac('0x44')]['split']('-')[0x0]][_0x83ac('0x46')])){this[_0x83ac('0x18')][_0x10c378[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x46')]=_0x10c378[_0x83ac('0x42')];logger[_0x83ac('0x3a')](_0x83ac('0x55'),_0x10c378['uniqueid'],util[_0x83ac('0x3c')]({'id':this[_0x83ac('0x18')][_0x10c378['channel'][_0x83ac('0x45')]('-')[0x0]]['id'],'destaccountcode':this[_0x83ac('0x18')][_0x10c378[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x10c378[_0x83ac('0x42')]},{'showHidden':![],'depth':null}));this[_0x83ac('0x34')](util[_0x83ac('0x4f')](_0x83ac('0x48'),this[_0x83ac('0x18')][_0x10c378[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x56')]),_0x83ac('0x49'),{'id':this[_0x83ac('0x18')][_0x10c378[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x10c378[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x4a')],'destconnectedlinenum':_0x10c378[_0x83ac('0x42')]});}}}}}}}catch(_0xb56ef2){logger['error'](_0x83ac('0x57'),_0x10c378[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0xb56ef2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x83ac('0x32')][_0x83ac('0x1b')]=function(_0xf30e51){try{if(this[_0x83ac('0x35')](_0xf30e51)){logger[_0x83ac('0x3a')](_0x83ac('0x58'),_0xf30e51[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0xf30e51,{'showHidden':![],'depth':null}));if(_0xf30e51[_0x83ac('0x37')]===_0xf30e51[_0x83ac('0x3d')]&&_0xf30e51[_0x83ac('0x42')]!='h'&&_0xf30e51[_0x83ac('0x44')]!='OutgoingSpoolFailed'){_0xf30e51[_0x83ac('0x59')]=_0xf30e51[_0x83ac('0x59')][_0x83ac('0x5a')]();_0xf30e51[_0x83ac('0x5b')]=_0xf30e51[_0x83ac('0x5c')]&&_0xf30e51[_0x83ac('0x5c')][_0x83ac('0x5d')](_0x83ac('0x5e'))?_0xf30e51[_0x83ac('0x5c')]:(_0xf30e51[_0x83ac('0x5c')]||_0xf30e51['applicationdata'])[_0x83ac('0x5a')]();logger[_0x83ac('0x2e')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0xf30e51[_0x83ac('0x37')],_0xf30e51[_0x83ac('0x59')],_0xf30e51[_0x83ac('0x5b')]);if(_[_0x83ac('0x33')](this[_0x83ac('0x17')][_0xf30e51[_0x83ac('0x37')]])){this[_0x83ac('0x17')][_0xf30e51['uniqueid']]=new Channel();this[_0x83ac('0x17')][_0xf30e51['uniqueid']][_0x83ac('0x4e')]=_0xf30e51[_0x83ac('0x5f')]?moment()[_0x83ac('0x60')](moment[_0x83ac('0x5f')](_0xf30e51[_0x83ac('0x5f')])['seconds'](),_0x83ac('0x61'))[_0x83ac('0x4f')](_0x83ac('0x50')):moment()[_0x83ac('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xf30e51[_0x83ac('0x37')]]['disposition']=_0x83ac('0x11');}_[_0x83ac('0x3e')](this[_0x83ac('0x17')][_0xf30e51[_0x83ac('0x37')]],_[_0x83ac('0x3f')](_0xf30e51,_[_0x83ac('0x54')](this[_0x83ac('0x17')][_0xf30e51[_0x83ac('0x37')]])));if(_[_0x83ac('0x62')](applications,_0xf30e51[_0x83ac('0x59')])){this[_0x83ac('0x17')][_0xf30e51[_0x83ac('0x37')]]['lastapplication']=_0xf30e51[_0x83ac('0x59')];this[_0x83ac('0x17')][_0xf30e51[_0x83ac('0x37')]][_0x83ac('0x63')]=_0xf30e51[_0x83ac('0x5b')];if(_0xf30e51[_0x83ac('0x59')]==='set'&&_[_0x83ac('0x5d')](_0xf30e51['applicationdata']['toLowerCase'](),_0x83ac('0x64'))){var _0x387994=_0xf30e51[_0x83ac('0x5b')][_0x83ac('0x45')]('=');var _0x1844c3=_0x387994[0x0][_0x83ac('0x5a')]()[_0x83ac('0x65')](/cdr\((.*)\)/);if(_0x1844c3){this[_0x83ac('0x17')][_0xf30e51['uniqueid']][_0x1844c3[0x1]]=_0x387994[0x1];}}else if(_0xf30e51['application']===_0x83ac('0xb')){this[_0x83ac('0x17')][_0xf30e51[_0x83ac('0x37')]]['queue']=_0xf30e51[_0x83ac('0x5b')][_0x83ac('0x45')](',')[0x0];}}}}}catch(_0x752cb3){logger[_0x83ac('0x31')](_0x83ac('0x66'),_0xf30e51[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0x752cb3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x83ac('0x32')][_0x83ac('0x20')]=function(_0x8e5b72){try{if(this[_0x83ac('0x35')](_0x8e5b72)){logger[_0x83ac('0x2e')](_0x83ac('0x67'),_0x8e5b72[_0x83ac('0x37')],_0x8e5b72[_0x83ac('0x3d')],_0x8e5b72['calleridname'],_0x8e5b72['calleridnum']);logger[_0x83ac('0x3a')]('[%s][voiceCallReport][newstate]\x20event:',_0x8e5b72[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0x8e5b72,{'showHidden':![],'depth':null}));if(_0x8e5b72[_0x83ac('0x37')]!==_0x8e5b72[_0x83ac('0x3d')]){if(this[_0x83ac('0x17')][_0x8e5b72['linkedid']]){if(_0x8e5b72['channelstate']==='6'){if(!this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]]['answered']){var _0xdc0bdf=moment();this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x68')]=!![];this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x69')]=_0xdc0bdf[_0x83ac('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x4e')]){this[_0x83ac('0x17')][_0x8e5b72['linkedid']][_0x83ac('0x6a')]=_0xdc0bdf[_0x83ac('0x6b')](this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x4e')],_0x83ac('0x61'));}}this[_0x83ac('0x17')][_0x8e5b72['linkedid']][_0x83ac('0x3d')]=_0x8e5b72[_0x83ac('0x37')];if(_0x8e5b72['calleridnum']!=='xcally-motion-preview'){this[_0x83ac('0x17')][_0x8e5b72['linkedid']][_0x83ac('0x47')]=_0x8e5b72[_0x83ac('0x39')];}this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x6c')]=_0x8e5b72[_0x83ac('0x38')];this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x6d')]=_0x8e5b72['channel'];this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x51')]=dispositions[_['toNumber'](_0x8e5b72[_0x83ac('0x53')])];if(this['agents'][_0x8e5b72[_0x83ac('0x44')]['split']('-')[0x0]]){this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x6e')]=this[_0x83ac('0x18')][_0x8e5b72['channel'][_0x83ac('0x45')]('-')[0x0]]['id'];this['channels'][_0x8e5b72[_0x83ac('0x3d')]]['membername']=this['agents'][_0x8e5b72['channel'][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x56')];}}}}else{if(this[_0x83ac('0x17')][_0x8e5b72['uniqueid']]){if(_0x8e5b72['channelstate']==='6'){if(this[_0x83ac('0x18')][_0x8e5b72[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]){this['channels'][_0x8e5b72['uniqueid']][_0x83ac('0x6e')]=this[_0x83ac('0x18')][_0x8e5b72[_0x83ac('0x44')]['split']('-')[0x0]]['id'];this[_0x83ac('0x17')][_0x8e5b72['uniqueid']]['membername']=this[_0x83ac('0x18')][_0x8e5b72[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x56')];}}}}if(_0x8e5b72[_0x83ac('0x53')]==='6'&&_0x8e5b72[_0x83ac('0x40')]===_0x83ac('0x41')){if(this[_0x83ac('0x18')][_0x8e5b72[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]){this[_0x83ac('0x18')][_0x8e5b72[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]['destconnectedlinenum']=_0x8e5b72[_0x83ac('0x42')];var _0x29e02a,_0x294753;if(this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x37')]]){_0x29e02a=this['channels'][_0x8e5b72['uniqueid']][_0x83ac('0x6f')];_0x294753=this[_0x83ac('0x17')][_0x8e5b72['uniqueid']][_0x83ac('0xb')];}else if(this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]]){_0x29e02a=this[_0x83ac('0x17')][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0x6f')];_0x294753=this['channels'][_0x8e5b72[_0x83ac('0x3d')]][_0x83ac('0xb')];}logger[_0x83ac('0x3a')](_0x83ac('0x70'),_0x8e5b72[_0x83ac('0x37')],util['inspect']({'id':this[_0x83ac('0x18')][_0x8e5b72[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x8e5b72['channel'][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x4a')],'destconnectedlinenum':_0x8e5b72[_0x83ac('0x42')],'routealias':_0x29e02a,'queue':_0x294753||undefined},{'showHidden':![],'depth':null}));this['emit'](util[_0x83ac('0x4f')](_0x83ac('0x48'),this['agents'][_0x8e5b72[_0x83ac('0x44')]['split']('-')[0x0]][_0x83ac('0x56')]),_0x83ac('0x49'),{'id':this[_0x83ac('0x18')][_0x8e5b72['channel'][_0x83ac('0x45')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this['agents'][_0x8e5b72['channel'][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x4a')],'destconnectedlinenum':_0x8e5b72[_0x83ac('0x42')],'routealias':_0x29e02a,'queue':_0x294753||undefined});}}}}catch(_0x151e1f){logger[_0x83ac('0x31')](_0x83ac('0x71'),_0x8e5b72[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0x151e1f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x83ac('0x32')]['syncMixMonitorFilename']=function(_0x4f8569,_0x475a0b){try{if(this[_0x83ac('0x17')][_0x4f8569]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x4f8569,_0x475a0b);this[_0x83ac('0x17')][_0x4f8569][_0x83ac('0x72')]=!![];if(_[_0x83ac('0x73')](_0x475a0b,_0x83ac('0x74'))){_0x475a0b=_0x475a0b[_0x83ac('0x75')](_0x83ac('0x74'),_0x83ac('0x76'));}this[_0x83ac('0x17')][_0x4f8569][_0x83ac('0x77')]=_0x475a0b;var _0xadec04=_[_0x83ac('0x78')](this[_0x83ac('0x17')][_0x4f8569]['monitors'],{'filename':_0x475a0b});if(_['isNil'](_0xadec04)){this[_0x83ac('0x17')][_0x4f8569][_0x83ac('0x79')][_0x83ac('0x7a')]({'filename':_0x475a0b,'createdAt':moment()[_0x83ac('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x83ac('0x7b')});}}}catch(_0x5651e6){logger[_0x83ac('0x31')]('[%s][voiceCallReport][mixMonitorFilename]',_0x4f8569,util['inspect'](_0x5651e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x83ac('0x32')][_0x83ac('0x22')]=function(_0x263b86){try{if(this[_0x83ac('0x35')](_0x263b86)){logger['debug'](_0x83ac('0x7c'),_0x263b86[_0x83ac('0x37')],util['inspect'](_0x263b86,{'showHidden':![],'depth':null}));if(this[_0x83ac('0x17')][_0x263b86['uniqueid']]&&_0x263b86[_0x83ac('0x44')]!=_0x83ac('0x7d')){if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')])){if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')][_0x83ac('0x7f')])){logger[_0x83ac('0x2e')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x263b86[_0x83ac('0x37')],_0x263b86[_0x83ac('0x80')]);this[_0x83ac('0x81')](_0x263b86['uniqueid'],_0x263b86[_0x83ac('0x80')]);}else if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')][_0x83ac('0x82')])){logger[_0x83ac('0x2e')](_0x83ac('0x83'),_0x263b86[_0x83ac('0x37')],_0x263b86[_0x83ac('0x80')]);this[_0x83ac('0x17')][_0x263b86[_0x83ac('0x37')]][_0x83ac('0x39')]=_0x263b86['value'];}else if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')][_0x83ac('0x84')])){logger['info'](_0x83ac('0x85'),_0x263b86[_0x83ac('0x37')],_0x263b86['value']);this['channels'][_0x263b86[_0x83ac('0x37')]]['callerid']=_0x263b86[_0x83ac('0x80')];}else if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')][_0x83ac('0x86')])){logger['info'](_0x83ac('0x87'),_0x263b86[_0x83ac('0x37')],_0x263b86[_0x83ac('0x80')]);this[_0x83ac('0x17')][_0x263b86[_0x83ac('0x37')]][_0x83ac('0x88')]=_0x263b86[_0x83ac('0x80')];}else if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')][_0x83ac('0x89')])){logger[_0x83ac('0x2e')](_0x83ac('0x8a'),_0x263b86['uniqueid'],_0x263b86['value']['split'](',')[0x0]);this['channels'][_0x263b86[_0x83ac('0x37')]][_0x83ac('0xb')]=_0x263b86['value'][_0x83ac('0x45')](',')[0x0];}else if(this[_0x83ac('0x35')](_0x263b86['variable'][_0x83ac('0x8b')])){logger[_0x83ac('0x2e')](_0x83ac('0x8c'),_0x263b86[_0x83ac('0x37')],_0x263b86[_0x83ac('0x80')]);this['channels'][_0x263b86[_0x83ac('0x37')]][_0x83ac('0x8d')]=_0x263b86[_0x83ac('0x80')];}else if(this[_0x83ac('0x35')](_0x263b86['variable'][_0x83ac('0x8e')])){logger[_0x83ac('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x263b86[_0x83ac('0x37')],_0x263b86[_0x83ac('0x80')]);this[_0x83ac('0x17')][_0x263b86['uniqueid']][_0x83ac('0x8f')]=_0x263b86[_0x83ac('0x80')];}else if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')]['xmd-callerid-preview'])){logger['info'](_0x83ac('0x90'),_0x263b86['uniqueid'],_0x263b86[_0x83ac('0x80')]);this['channels'][_0x263b86[_0x83ac('0x37')]]['calleridpreview']=_0x263b86[_0x83ac('0x80')];}else if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')]['xmcs-queue'])){logger['info'](_0x83ac('0x91'),_0x263b86['uniqueid'],_0x263b86[_0x83ac('0x80')]);this[_0x83ac('0x17')][_0x263b86[_0x83ac('0x37')]][_0x83ac('0xb')]=_0x263b86[_0x83ac('0x80')];}else if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')][_0x83ac('0x92')])){logger[_0x83ac('0x2e')](_0x83ac('0x93'),_0x263b86[_0x83ac('0x37')],_0x263b86[_0x83ac('0x80')]);this['channels'][_0x263b86['uniqueid']][_0x83ac('0x94')]=_0x263b86['value'];}}}else if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')][_0x83ac('0x7f')])){if(_0x263b86[_0x83ac('0x80')]){var _0xeb3b0d=path['parse'](_0x263b86[_0x83ac('0x80')])[_0x83ac('0x56')];logger[_0x83ac('0x2e')](_0x83ac('0x95'),_0xeb3b0d,_0x263b86[_0x83ac('0x80')]);this[_0x83ac('0x81')](_0xeb3b0d,_0x263b86['value']);}}else if(this['channels'][_0x263b86[_0x83ac('0x3d')]]){if(this[_0x83ac('0x35')](_0x263b86['variable'])){if(this[_0x83ac('0x35')](_0x263b86[_0x83ac('0x7e')]['sipcallid'])){logger['info'](_0x83ac('0x93'),_0x263b86[_0x83ac('0x3d')],_0x263b86[_0x83ac('0x80')]);this[_0x83ac('0x17')][_0x263b86[_0x83ac('0x3d')]]['sipcalllinkedid']=_0x263b86['value'];}}}}}catch(_0x5318b7){logger['error']('[%s][voiceCallReport][varset]',_0x263b86['uniqueid'],util[_0x83ac('0x3c')](_0x5318b7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x83ac('0x32')][_0x83ac('0x24')]=function(_0x3022b6){try{if(this[_0x83ac('0x35')](_0x3022b6)){logger[_0x83ac('0x3a')]('[%s][voiceCallReport][hangup]\x20event:',_0x3022b6[_0x83ac('0x37')],util[_0x83ac('0x3c')](_0x3022b6,{'showHidden':![],'depth':null}));if(this[_0x83ac('0x17')][_0x3022b6['uniqueid']]){logger[_0x83ac('0x2e')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x3022b6[_0x83ac('0x37')],_0x3022b6[_0x83ac('0x96')]);var _0x3a30cc=moment();this[_0x83ac('0x17')][_0x3022b6[_0x83ac('0x37')]][_0x83ac('0x97')]=_0x3a30cc['format'](_0x83ac('0x50'));this[_0x83ac('0x17')][_0x3022b6[_0x83ac('0x37')]][_0x83ac('0x5f')]=_0x3a30cc[_0x83ac('0x6b')](this[_0x83ac('0x17')][_0x3022b6['uniqueid']][_0x83ac('0x4e')],_0x83ac('0x61'));if(this[_0x83ac('0x17')][_0x3022b6[_0x83ac('0x37')]]['answered']){this[_0x83ac('0x17')][_0x3022b6['uniqueid']]['billableseconds']=_0x3a30cc[_0x83ac('0x6b')](this[_0x83ac('0x17')][_0x3022b6[_0x83ac('0x37')]]['answertime'],_0x83ac('0x61'));this[_0x83ac('0x17')][_0x3022b6[_0x83ac('0x37')]][_0x83ac('0x6a')]=this['channels'][_0x3022b6[_0x83ac('0x37')]][_0x83ac('0x5f')]-this[_0x83ac('0x17')][_0x3022b6[_0x83ac('0x37')]][_0x83ac('0x98')];}if(_0x3022b6[_0x83ac('0x40')]===_0x83ac('0x41')){if(this[_0x83ac('0x18')][_0x3022b6['channel']['split']('-')[0x0]]){this[_0x83ac('0x18')][_0x3022b6['channel'][_0x83ac('0x45')]('-')[0x0]]=_['omit'](this[_0x83ac('0x18')][_0x3022b6['channel'][_0x83ac('0x45')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x83ac('0x99'),_0x3022b6['uniqueid'],util['inspect']({'id':this[_0x83ac('0x18')][_0x3022b6[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]['id'],'destaccountcode':this[_0x83ac('0x18')][_0x3022b6[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x4a')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x83ac('0x4f')](_0x83ac('0x48'),this[_0x83ac('0x18')][_0x3022b6['channel'][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x56')]),_0x83ac('0x9a'),{'id':this[_0x83ac('0x18')][_0x3022b6[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]]['id'],'destaccountcode':this[_0x83ac('0x18')][_0x3022b6[_0x83ac('0x44')][_0x83ac('0x45')]('-')[0x0]][_0x83ac('0x4a')]});for(var _0x5ee15e=0x0;_0x5ee15e0x0?_0xbb0994:0x0;this[_0x88c3('0x13')][_0x4cb567['queue']]['talking']=this[_0x88c3('0x13')][_0x4cb567[_0x88c3('0x66')]][_0x88c3('0x32')]>_[_0x88c3('0x6b')](_0x4cb567[_0x88c3('0x6d')])?_[_0x88c3('0x6b')](_0x4cb567['loggedin']):this[_0x88c3('0x13')][_0x4cb567[_0x88c3('0x66')]]['talking'];this[_0x88c3('0x4e')](this['voiceQueues'][_0x4cb567[_0x88c3('0x66')]],'queuesummary');}logger[_0x88c3('0x46')](_0x88c3('0x6e'),util['inspect'](this[_0x88c3('0x13')][_0x4cb567[_0x88c3('0x66')]],{'showHidden':![],'depth':null}));ami[_0x88c3('0x45')](_0x88c3('0x6f'),this[_0x88c3('0x13')][_0x4cb567[_0x88c3('0x66')]]);}}}catch(_0x3477f3){logger[_0x88c3('0x3d')](_0x88c3('0x64'),util[_0x88c3('0x3e')](_0x3477f3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88c3('0x36')][_0x88c3('0x70')]=function(_0x18b849){logger[_0x88c3('0x46')](_0x88c3('0x71'),util[_0x88c3('0x3e')](_0x18b849,{'showHidden':![],'depth':null}));this[_0x88c3('0x14')]=!![];};VoiceQueueReport[_0x88c3('0x36')][_0x88c3('0x1b')]=function(_0x1b7a86){try{if(this[_0x88c3('0x65')](_0x1b7a86)){logger[_0x88c3('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1b7a86[_0x88c3('0x72')],util['inspect'](_0x1b7a86,{'showHidden':![],'depth':null}));if(_[_0x88c3('0x5f')](this[_0x88c3('0xf')][_0x1b7a86[_0x88c3('0x72')]]))this['queueReports'][_0x1b7a86[_0x88c3('0x72')]]=[];if(_['isUndefined'](this['channels'][_0x1b7a86['uniqueid']]))this[_0x88c3('0x11')][_0x1b7a86[_0x88c3('0x72')]]={};var _0x28940d=new QueueReport();_0x28940d[_0x88c3('0x49')]=_0x1b7a86[_0x88c3('0x66')];_0x28940d['type']=this[_0x88c3('0x13')][_0x28940d[_0x88c3('0x49')]]&&this['voiceQueues'][_0x28940d[_0x88c3('0x49')]]['type']?this[_0x88c3('0x13')][_0x28940d[_0x88c3('0x49')]]['type']||'inbound':'inbound';_0x28940d[_0x88c3('0x66')]=_0x1b7a86['queue'];_0x28940d[_0x88c3('0x73')]=moment()[_0x88c3('0x48')](_0x88c3('0x74'));_0x28940d[_0x88c3('0x75')]=_0x1b7a86[_0x88c3('0x75')];_0x28940d['count']=_0x1b7a86[_0x88c3('0x76')];_0x28940d['uniqueid']=_0x1b7a86[_0x88c3('0x72')];_0x28940d['routealias']=this[_0x88c3('0x11')][_0x1b7a86[_0x88c3('0x72')]][_0x88c3('0x77')];logger[_0x88c3('0x78')](_0x88c3('0x79'),_0x28940d[_0x88c3('0x49')],_0x28940d[_0x88c3('0x55')]);_['merge'](_0x28940d,_[_0x88c3('0x7a')](_0x1b7a86,_['keys'](_0x28940d)));this[_0x88c3('0xf')][_0x1b7a86[_0x88c3('0x72')]]['push'](_0x28940d);this['channels'][_0x1b7a86[_0x88c3('0x72')]]=_0x28940d;this['emitVoiceQueueChannelSave'](_0x28940d,_0x88c3('0x1a'));}}catch(_0xf79988){logger[_0x88c3('0x3d')](_0x88c3('0x7b'),_0x1b7a86[_0x88c3('0x72')],util[_0x88c3('0x3e')](_0xf79988,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88c3('0x36')]['syncQueueCallerAbandon']=function(_0x388e4e){try{if(this[_0x88c3('0x65')](_0x388e4e)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x388e4e[_0x88c3('0x72')],util['inspect'](_0x388e4e,{'showHidden':![],'depth':null}));if(this[_0x88c3('0xf')][_0x388e4e[_0x88c3('0x72')]]){var _0xfe9a85=_['last'](this['queueReports'][_0x388e4e[_0x88c3('0x72')]]);_0xfe9a85[_0x88c3('0x7c')]=![];_0xfe9a85[_0x88c3('0x7d')]=null;_0xfe9a85[_0x88c3('0x7e')]=_0x388e4e[_0x88c3('0x7e')];_0xfe9a85[_0x88c3('0x7f')]=_0x388e4e[_0x88c3('0x7f')];_0xfe9a85[_0x88c3('0x80')]=!![];_0xfe9a85[_0x88c3('0x81')]=moment()[_0x88c3('0x48')](_0x88c3('0x74'));_0xfe9a85[_0x88c3('0x82')]=_0x88c3('0x83');_0xfe9a85[_0x88c3('0x84')]=null;logger[_0x88c3('0x78')](_0x88c3('0x85'),_0xfe9a85['name'],_0xfe9a85[_0x88c3('0x55')]);this[_0x88c3('0x11')][_0x388e4e[_0x88c3('0x72')]]=_0xfe9a85;this['emitVoiceQueueChannelRemove'](_0xfe9a85,_0x88c3('0x80'));}}}catch(_0x527f6d){logger[_0x88c3('0x3d')](_0x88c3('0x86'),_0x388e4e[_0x88c3('0x72')],util[_0x88c3('0x3e')](_0x527f6d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88c3('0x36')][_0x88c3('0x1e')]=function(_0x508887){try{if(this['isNotNull'](_0x508887)){logger['debug'](_0x88c3('0x87'),_0x508887[_0x88c3('0x72')],util['inspect'](_0x508887,{'showHidden':![],'depth':null}));if(this[_0x88c3('0xf')][_0x508887['uniqueid']]){var _0x108935=_['last'](this['queueReports'][_0x508887[_0x88c3('0x72')]]);_0x108935[_0x88c3('0x88')]=moment()['format'](_0x88c3('0x74'));_0x108935[_0x88c3('0x89')]=_0x508887[_0x88c3('0x89')];_0x108935[_0x88c3('0x8a')]=_0x508887['connectedlinename'];logger[_0x88c3('0x78')](_0x88c3('0x8b'),_0x108935[_0x88c3('0x49')],_0x108935[_0x88c3('0x55')],_0x508887[_0x88c3('0x89')],_0x508887[_0x88c3('0x8a')]);this[_0x88c3('0x11')][_0x508887[_0x88c3('0x72')]]=_0x108935;this[_0x88c3('0x8c')](_0x108935,_0x88c3('0x1d'));}}}catch(_0x2966ae){logger[_0x88c3('0x3d')](_0x88c3('0x87'),_0x508887[_0x88c3('0x72')],util[_0x88c3('0x3e')](_0x2966ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x88c3('0x21')]=function(_0x18e5c3){try{if(this[_0x88c3('0x65')](_0x18e5c3)){logger['debug'](_0x88c3('0x8d'),_0x18e5c3[_0x88c3('0x72')],util['inspect'](_0x18e5c3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x18e5c3['uniqueid']]){var _0x48835d=_['last'](this[_0x88c3('0xf')][_0x18e5c3[_0x88c3('0x72')]]);_0x48835d[_0x88c3('0x7c')]=!![];_0x48835d['queuecallerexitreason']=_0x88c3('0x8e');logger[_0x88c3('0x78')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x48835d[_0x88c3('0x49')],_0x48835d[_0x88c3('0x55')]);}}}catch(_0x3c6799){logger['error'](_0x88c3('0x8d'),_0x18e5c3[_0x88c3('0x72')],util['inspect'](_0x3c6799,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88c3('0x36')][_0x88c3('0x8f')]=function(_0x1c0e2f){try{if(this[_0x88c3('0x65')](_0x1c0e2f)){logger[_0x88c3('0x46')](_0x88c3('0x90'),_0x1c0e2f[_0x88c3('0x72')],util[_0x88c3('0x3e')](_0x1c0e2f,{'showHidden':![],'depth':null}));if(this[_0x88c3('0xf')][_0x1c0e2f['uniqueid']]){var _0x3d19b1=_[_0x88c3('0x91')](this[_0x88c3('0xf')][_0x1c0e2f['uniqueid']]);_0x3d19b1[_0x88c3('0x80')]=![];_0x3d19b1[_0x88c3('0x81')]=null;_0x3d19b1[_0x88c3('0x92')]=!![];_0x3d19b1[_0x88c3('0x84')]=_0x1c0e2f['membername'];_0x3d19b1[_0x88c3('0x7e')]=_0x1c0e2f[_0x88c3('0x7e')];_0x3d19b1[_0x88c3('0x7c')]=!![];_0x3d19b1[_0x88c3('0x93')]=![];_0x3d19b1[_0x88c3('0x94')]=null;if(!_0x3d19b1[_0x88c3('0x95')]){if(_0x1c0e2f[_0x88c3('0x96')]=='transfer'){_0x3d19b1[_0x88c3('0x82')]=_0x88c3('0x97');logger[_0x88c3('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3d19b1['name'],_0x3d19b1[_0x88c3('0x55')]);}else{if(_[_0x88c3('0x98')](_0x1c0e2f['channel'][_0x88c3('0x99')](),_0x88c3('0x9a'))){if(this['queueReports'][_0x1c0e2f[_0x88c3('0x9b')]]){var _0x216d34=_[_0x88c3('0x91')](this[_0x88c3('0xf')][_0x1c0e2f[_0x88c3('0x9b')]]);_0x216d34[_0x88c3('0x7c')]=![];_0x216d34[_0x88c3('0x93')]=!![];_0x216d34[_0x88c3('0x94')]=moment(_0x3d19b1[_0x88c3('0x73')])[_0x88c3('0x9c')](_0x1c0e2f[_0x88c3('0x7e')],_0x88c3('0x9d'))[_0x88c3('0x48')](_0x88c3('0x74'));_0x216d34[_0x88c3('0x82')]=_0x88c3('0x9e');_0x216d34[_0x88c3('0x95')]=!![];_0x216d34[_0x88c3('0x9f')]='FORWARD';_0x216d34['transferexten']=_0x1c0e2f[_0x88c3('0xa0')];_0x216d34[_0x88c3('0xa1')]=_0x1c0e2f['uniqueid'];logger['info'](_0x88c3('0xa2'),_0x216d34[_0x88c3('0x49')],_0x216d34[_0x88c3('0x55')]);var _0x1c6c87=this[_0x88c3('0xf')][_0x1c0e2f[_0x88c3('0x9b')]];this[_0x88c3('0xf')][_0x1c0e2f[_0x88c3('0x9b')]]=this['queueReports'][_0x1c0e2f[_0x88c3('0x72')]];this['queueReports'][_0x1c0e2f[_0x88c3('0x72')]]=_0x1c6c87;}}else{_0x3d19b1[_0x88c3('0x82')]=_0x88c3('0xa3')+_0x1c0e2f[_0x88c3('0x96')][_0x88c3('0xa4')]();logger[_0x88c3('0x78')](_0x88c3('0xa5'),_0x3d19b1[_0x88c3('0x49')],_0x3d19b1[_0x88c3('0x55')],_0x3d19b1[_0x88c3('0x82')]);}}}this[_0x88c3('0x11')][_0x1c0e2f[_0x88c3('0x72')]]=_0x3d19b1;this[_0x88c3('0x43')](_0x3d19b1,_0x88c3('0x1f'));}}}catch(_0x2c4483){logger['error'](_0x88c3('0x90'),_0x1c0e2f[_0x88c3('0x72')],util[_0x88c3('0x3e')](_0x2c4483,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88c3('0x36')][_0x88c3('0x22')]=function(_0x4d9e38){try{if(this['isNotNull'](_0x4d9e38)){logger['debug'](_0x88c3('0xa6'),_0x4d9e38[_0x88c3('0x72')],util[_0x88c3('0x3e')](_0x4d9e38,{'showHidden':![],'depth':null}));this[_0x88c3('0xa7')](_0x4d9e38[_0x88c3('0x72')],_['keys'](_0x4d9e38[_0x88c3('0xa8')])[0x0],_0x4d9e38[_0x88c3('0xa9')]);if(this[_0x88c3('0xf')][_0x4d9e38['uniqueid']]){var _0x410272=_['last'](this['queueReports'][_0x4d9e38[_0x88c3('0x72')]]);if(_0x410272){if(this[_0x88c3('0x65')](_0x4d9e38[_0x88c3('0xa8')])&&this[_0x88c3('0x65')](_0x4d9e38[_0x88c3('0xa8')][_0x88c3('0xaa')])){switch(_0x4d9e38[_0x88c3('0xa9')]){case _0x88c3('0xab'):_0x410272[_0x88c3('0x93')]=![];_0x410272['queuecallerexitAt']=null;break;case _0x88c3('0xac'):_0x410272[_0x88c3('0xad')]='timeout';_0x410272[_0x88c3('0x93')]=!![];_0x410272[_0x88c3('0x94')]=moment()[_0x88c3('0x48')](_0x88c3('0x74'));_0x410272['queuecallerleaveAt']=moment()[_0x88c3('0x48')](_0x88c3('0x74'));logger[_0x88c3('0x46')](_0x88c3('0xae'),_0x4d9e38['uniqueid'],util[_0x88c3('0x3e')](_0x410272,{'showHidden':![],'depth':null}));ami['emit'](_0x88c3('0xaf'),_0x410272);break;default:_0x410272['queuecallerexit']=!![];_0x410272[_0x88c3('0x94')]=moment()[_0x88c3('0x48')](_0x88c3('0x74'));_0x410272[_0x88c3('0x88')]=moment()[_0x88c3('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}_0x410272[_0x88c3('0x80')]=![];_0x410272[_0x88c3('0x81')]=null;_0x410272['queuecallerexitreason']=_0x4d9e38[_0x88c3('0xa9')];this[_0x88c3('0x11')][_0x4d9e38['uniqueid']]=_0x410272;this[_0x88c3('0x43')](_0x410272,_0x88c3('0xb0'));}else if(this[_0x88c3('0x65')](_0x4d9e38[_0x88c3('0xa8')])&&this[_0x88c3('0x65')](_0x4d9e38['variable'][_0x88c3('0xb1')])){if(!_0x410272[_0x88c3('0x80')]){_0x410272[_0x88c3('0x93')]=!![];_0x410272['queuecallerexitAt']=moment()[_0x88c3('0x48')](_0x88c3('0x74'));_0x410272[_0x88c3('0x82')]=_0x88c3('0xb2');_0x410272[_0x88c3('0x88')]=moment()['format'](_0x88c3('0x74'));this['channels'][_0x4d9e38[_0x88c3('0x72')]]=_0x410272;}}logger[_0x88c3('0x78')](_0x88c3('0xb3'),_0x4d9e38[_0x88c3('0x72')],_0x410272[_0x88c3('0x49')],_0x410272[_0x88c3('0x55')],_['keys'](_0x4d9e38[_0x88c3('0xa8')])[0x0],_0x4d9e38[_0x88c3('0xa9')]);_0x410272[_0x88c3('0x15')]=this[_0x88c3('0x15')][_0x4d9e38[_0x88c3('0x72')]];}}}}catch(_0x2fb02b){logger[_0x88c3('0x3d')](_0x88c3('0xa6'),_0x4d9e38[_0x88c3('0x72')],util[_0x88c3('0x3e')](_0x2fb02b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x88c3('0xa7')]=function(_0x8db1b0,_0x227b11,_0x17379e){var _0x11d55b=['rtpaudioqos',_0x88c3('0xb4'),_0x88c3('0xb5'),_0x88c3('0xb6'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x88c3('0xb7'),_0x88c3('0xb8'),_0x88c3('0xb9'),_0x88c3('0xba'),_0x88c3('0xbb'),'bridgepvtcallid','membercalls','memberdynamic',_0x88c3('0xbc'),_0x88c3('0xbd'),_0x88c3('0xbe'),_0x88c3('0xbf'),'memberrealtime'];if(!_[_0x88c3('0x37')](_0x227b11)&&!_['includes'](_0x11d55b,_0x227b11)){if(_['isUndefined'](this[_0x88c3('0x15')][_0x8db1b0])){this[_0x88c3('0x15')][_0x8db1b0]={};}this[_0x88c3('0x15')][_0x8db1b0][_0x227b11]=_0x17379e;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x26b0e3){try{if(this[_0x88c3('0x65')](_0x26b0e3)){logger['debug'](_0x88c3('0xc0'),_0x26b0e3['uniqueid'],util[_0x88c3('0x3e')](_0x26b0e3,{'showHidden':![],'depth':null}));if(this[_0x88c3('0xf')][_0x26b0e3[_0x88c3('0x72')]]){for(var _0x4d15d3=0x0,_0x1863d5={};_0x4d15d30x0?_0x53eb58:0x0;this[_0x474f('0x13')][_0xb6457[_0x474f('0x67')]][_0x474f('0x33')]=this[_0x474f('0x13')][_0xb6457[_0x474f('0x67')]][_0x474f('0x33')]>_[_0x474f('0x6b')](_0xb6457[_0x474f('0x6e')])?_['toNumber'](_0xb6457['loggedin']):this['voiceQueues'][_0xb6457[_0x474f('0x67')]][_0x474f('0x33')];this[_0x474f('0x50')](this[_0x474f('0x13')][_0xb6457[_0x474f('0x67')]],'queuesummary');}logger['debug'](_0x474f('0x6f'),util[_0x474f('0x3f')](this[_0x474f('0x13')][_0xb6457[_0x474f('0x67')]],{'showHidden':![],'depth':null}));ami[_0x474f('0x44')](_0x474f('0x70'),this['voiceQueues'][_0xb6457['queue']]);}}}catch(_0x31b3d9){logger[_0x474f('0x3d')](_0x474f('0x66'),util[_0x474f('0x3f')](_0x31b3d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x474f('0xa')][_0x474f('0x1a')]=function(_0x21364b){logger['debug'](_0x474f('0x71'),util[_0x474f('0x3f')](_0x21364b,{'showHidden':![],'depth':null}));this[_0x474f('0x14')]=!![];};VoiceQueueReport['prototype'][_0x474f('0x1d')]=function(_0x121936){try{if(this[_0x474f('0x62')](_0x121936)){logger['debug'](_0x474f('0x72'),_0x121936[_0x474f('0x48')],util['inspect'](_0x121936,{'showHidden':![],'depth':null}));if(_[_0x474f('0x63')](this['queueReports'][_0x121936[_0x474f('0x48')]]))this['queueReports'][_0x121936[_0x474f('0x48')]]=[];if(_[_0x474f('0x63')](this[_0x474f('0x11')][_0x121936[_0x474f('0x48')]]))this[_0x474f('0x11')][_0x121936[_0x474f('0x48')]]={};var _0x34a2ea=new QueueReport();_0x34a2ea['name']=_0x121936[_0x474f('0x67')];_0x34a2ea['type']=this[_0x474f('0x13')][_0x34a2ea[_0x474f('0x4b')]]&&this[_0x474f('0x13')][_0x34a2ea[_0x474f('0x4b')]][_0x474f('0x51')]?this['voiceQueues'][_0x34a2ea['name']][_0x474f('0x51')]||'inbound':_0x474f('0x52');_0x34a2ea[_0x474f('0x67')]=_0x121936['queue'];_0x34a2ea[_0x474f('0x73')]=moment()['format'](_0x474f('0x74'));_0x34a2ea[_0x474f('0x75')]=_0x121936[_0x474f('0x75')];_0x34a2ea['count']=_0x121936[_0x474f('0x76')];_0x34a2ea['uniqueid']=_0x121936[_0x474f('0x48')];_0x34a2ea['routealias']=this[_0x474f('0x11')][_0x121936[_0x474f('0x48')]]['routealias'];logger['info'](_0x474f('0x77'),_0x34a2ea[_0x474f('0x4b')],_0x34a2ea['type']);_[_0x474f('0x78')](_0x34a2ea,_[_0x474f('0x79')](_0x121936,_[_0x474f('0x7a')](_0x34a2ea)));this[_0x474f('0xf')][_0x121936[_0x474f('0x48')]][_0x474f('0x7b')](_0x34a2ea);this[_0x474f('0x11')][_0x121936[_0x474f('0x48')]]=_0x34a2ea;this[_0x474f('0x45')](_0x34a2ea,'queuecallerjoin');}}catch(_0x2d54b7){logger[_0x474f('0x3d')](_0x474f('0x72'),_0x121936[_0x474f('0x48')],util[_0x474f('0x3f')](_0x2d54b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x474f('0x7c')]=function(_0xcd21a0){try{if(this['isNotNull'](_0xcd21a0)){logger[_0x474f('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0xcd21a0[_0x474f('0x48')],util['inspect'](_0xcd21a0,{'showHidden':![],'depth':null}));if(this[_0x474f('0xf')][_0xcd21a0[_0x474f('0x48')]]){var _0x5bb9de=_['last'](this[_0x474f('0xf')][_0xcd21a0['uniqueid']]);_0x5bb9de[_0x474f('0x7d')]=![];_0x5bb9de[_0x474f('0x7e')]=null;_0x5bb9de[_0x474f('0x7f')]=_0xcd21a0[_0x474f('0x7f')];_0x5bb9de[_0x474f('0x80')]=_0xcd21a0[_0x474f('0x80')];_0x5bb9de[_0x474f('0x1e')]=!![];_0x5bb9de[_0x474f('0x81')]=moment()[_0x474f('0x49')](_0x474f('0x74'));_0x5bb9de[_0x474f('0x82')]=_0x474f('0x83');_0x5bb9de[_0x474f('0x84')]=null;logger[_0x474f('0x69')](_0x474f('0x85'),_0x5bb9de[_0x474f('0x4b')],_0x5bb9de[_0x474f('0x51')]);this['channels'][_0xcd21a0[_0x474f('0x48')]]=_0x5bb9de;this['emitVoiceQueueChannelRemove'](_0x5bb9de,'queuecallerabandon');}}}catch(_0x9becfd){logger[_0x474f('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0xcd21a0[_0x474f('0x48')],util[_0x474f('0x3f')](_0x9becfd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x474f('0xa')][_0x474f('0x1f')]=function(_0x57548a){try{if(this[_0x474f('0x62')](_0x57548a)){logger[_0x474f('0x46')](_0x474f('0x86'),_0x57548a[_0x474f('0x48')],util[_0x474f('0x3f')](_0x57548a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x57548a[_0x474f('0x48')]]){var _0x1c42b1=_[_0x474f('0x87')](this['queueReports'][_0x57548a[_0x474f('0x48')]]);_0x1c42b1[_0x474f('0x88')]=moment()[_0x474f('0x49')](_0x474f('0x74'));_0x1c42b1['connectedlinenum']=_0x57548a[_0x474f('0x89')];_0x1c42b1[_0x474f('0x8a')]=_0x57548a[_0x474f('0x8a')];logger[_0x474f('0x69')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1c42b1[_0x474f('0x4b')],_0x1c42b1[_0x474f('0x51')],_0x57548a['connectedlinenum'],_0x57548a['connectedlinename']);this['channels'][_0x57548a[_0x474f('0x48')]]=_0x1c42b1;this['emitVoiceQueueChannelSave'](_0x1c42b1,_0x474f('0x8b'));}}}catch(_0x275618){logger[_0x474f('0x3d')]('[%s][voiceQueueReport][queuecallerleave]',_0x57548a[_0x474f('0x48')],util['inspect'](_0x275618,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x474f('0xa')]['syncAgentConnect']=function(_0x2b58ab){try{if(this[_0x474f('0x62')](_0x2b58ab)){logger[_0x474f('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x2b58ab[_0x474f('0x48')],util[_0x474f('0x3f')](_0x2b58ab,{'showHidden':![],'depth':null}));if(this[_0x474f('0xf')][_0x2b58ab['uniqueid']]){var _0x229006=_[_0x474f('0x87')](this[_0x474f('0xf')][_0x2b58ab[_0x474f('0x48')]]);_0x229006['queuecallercomplete']=!![];_0x229006[_0x474f('0x82')]=_0x474f('0x8c');logger[_0x474f('0x69')](_0x474f('0x8d'),_0x229006[_0x474f('0x4b')],_0x229006['type']);}}}catch(_0x4ad1d1){logger[_0x474f('0x3d')](_0x474f('0x8e'),_0x2b58ab[_0x474f('0x48')],util[_0x474f('0x3f')](_0x4ad1d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x474f('0xa')]['syncAgentComplete']=function(_0x270a5c){try{if(this['isNotNull'](_0x270a5c)){logger[_0x474f('0x46')](_0x474f('0x8f'),_0x270a5c[_0x474f('0x48')],util[_0x474f('0x3f')](_0x270a5c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x270a5c['uniqueid']]){var _0xeba0d9=_['last'](this['queueReports'][_0x270a5c[_0x474f('0x48')]]);_0xeba0d9[_0x474f('0x1e')]=![];_0xeba0d9[_0x474f('0x81')]=null;_0xeba0d9[_0x474f('0x90')]=!![];_0xeba0d9[_0x474f('0x84')]=_0x270a5c['membername'];_0xeba0d9[_0x474f('0x7f')]=_0x270a5c[_0x474f('0x7f')];_0xeba0d9[_0x474f('0x7d')]=!![];_0xeba0d9[_0x474f('0x91')]=![];_0xeba0d9[_0x474f('0x92')]=null;if(!_0xeba0d9[_0x474f('0x93')]){if(_0x270a5c[_0x474f('0x94')]==_0x474f('0x93')){_0xeba0d9[_0x474f('0x82')]=_0x474f('0x95');logger[_0x474f('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0xeba0d9[_0x474f('0x4b')],_0xeba0d9[_0x474f('0x51')]);}else{if(_[_0x474f('0x96')](_0x270a5c[_0x474f('0x3a')][_0x474f('0x97')](),'local/')){if(this[_0x474f('0xf')][_0x270a5c[_0x474f('0x98')]]){var _0x590b18=_['last'](this['queueReports'][_0x270a5c[_0x474f('0x98')]]);_0x590b18[_0x474f('0x7d')]=![];_0x590b18[_0x474f('0x91')]=!![];_0x590b18['queuecallerexitAt']=moment(_0xeba0d9['queuecallerjoinAt'])[_0x474f('0x99')](_0x270a5c[_0x474f('0x7f')],'seconds')[_0x474f('0x49')](_0x474f('0x74'));_0x590b18[_0x474f('0x82')]=_0x474f('0x9a');_0x590b18['transfer']=!![];_0x590b18[_0x474f('0x9b')]=_0x474f('0x9c');_0x590b18[_0x474f('0x9d')]=_0x270a5c[_0x474f('0x9e')];_0x590b18[_0x474f('0x9f')]=_0x270a5c['uniqueid'];logger[_0x474f('0x69')](_0x474f('0xa0'),_0x590b18[_0x474f('0x4b')],_0x590b18[_0x474f('0x51')]);var _0x1954f7=this['queueReports'][_0x270a5c['linkedid']];this[_0x474f('0xf')][_0x270a5c[_0x474f('0x98')]]=this['queueReports'][_0x270a5c[_0x474f('0x48')]];this[_0x474f('0xf')][_0x270a5c[_0x474f('0x48')]]=_0x1954f7;}}else{_0xeba0d9[_0x474f('0x82')]=_0x474f('0xa1')+_0x270a5c[_0x474f('0x94')][_0x474f('0xa2')]();logger[_0x474f('0x69')](_0x474f('0xa3'),_0xeba0d9[_0x474f('0x4b')],_0xeba0d9['type'],_0xeba0d9['queuecallerexitreason']);}}}this[_0x474f('0x11')][_0x270a5c[_0x474f('0x48')]]=_0xeba0d9;this[_0x474f('0x42')](_0xeba0d9,_0x474f('0xa4'));}}}catch(_0x45897c){logger[_0x474f('0x3d')](_0x474f('0x8f'),_0x270a5c[_0x474f('0x48')],util[_0x474f('0x3f')](_0x45897c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x474f('0xa')]['syncVarSet']=function(_0x8e1611){try{if(this[_0x474f('0x62')](_0x8e1611)){logger[_0x474f('0x46')](_0x474f('0xa5'),_0x8e1611[_0x474f('0x48')],util[_0x474f('0x3f')](_0x8e1611,{'showHidden':![],'depth':null}));this[_0x474f('0xa6')](_0x8e1611['uniqueid'],_[_0x474f('0x7a')](_0x8e1611[_0x474f('0xa7')])[0x0],_0x8e1611[_0x474f('0xa8')]);if(this['queueReports'][_0x8e1611[_0x474f('0x48')]]){var _0x82bf71=_['last'](this[_0x474f('0xf')][_0x8e1611['uniqueid']]);if(_0x82bf71){if(this[_0x474f('0x62')](_0x8e1611[_0x474f('0xa7')])&&this[_0x474f('0x62')](_0x8e1611[_0x474f('0xa7')][_0x474f('0xa9')])){switch(_0x8e1611['value']){case _0x474f('0xaa'):_0x82bf71[_0x474f('0x91')]=![];_0x82bf71[_0x474f('0x92')]=null;break;case _0x474f('0xab'):_0x82bf71['lastevent']=_0x474f('0xac');_0x82bf71[_0x474f('0x91')]=!![];_0x82bf71[_0x474f('0x92')]=moment()['format'](_0x474f('0x74'));_0x82bf71[_0x474f('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x474f('0x46')](_0x474f('0xad'),_0x8e1611[_0x474f('0x48')],util['inspect'](_0x82bf71,{'showHidden':![],'depth':null}));ami[_0x474f('0x44')](_0x474f('0xae'),_0x82bf71);break;default:_0x82bf71[_0x474f('0x91')]=!![];_0x82bf71[_0x474f('0x92')]=moment()[_0x474f('0x49')](_0x474f('0x74'));_0x82bf71[_0x474f('0x88')]=moment()[_0x474f('0x49')](_0x474f('0x74'));}_0x82bf71[_0x474f('0x1e')]=![];_0x82bf71['queuecallerabandonAt']=null;_0x82bf71['queuecallerexitreason']=_0x8e1611[_0x474f('0xa8')];this[_0x474f('0x11')][_0x8e1611[_0x474f('0x48')]]=_0x82bf71;this[_0x474f('0x42')](_0x82bf71,_0x474f('0x23'));}else if(this['isNotNull'](_0x8e1611[_0x474f('0xa7')])&&this['isNotNull'](_0x8e1611['variable'][_0x474f('0xaf')])){if(!_0x82bf71[_0x474f('0x1e')]){_0x82bf71['queuecallerexit']=!![];_0x82bf71[_0x474f('0x92')]=moment()[_0x474f('0x49')](_0x474f('0x74'));_0x82bf71[_0x474f('0x82')]=_0x474f('0xb0');_0x82bf71[_0x474f('0x88')]=moment()[_0x474f('0x49')](_0x474f('0x74'));this['channels'][_0x8e1611[_0x474f('0x48')]]=_0x82bf71;}}logger[_0x474f('0x69')](_0x474f('0xb1'),_0x8e1611[_0x474f('0x48')],_0x82bf71[_0x474f('0x4b')],_0x82bf71['type'],_['keys'](_0x8e1611[_0x474f('0xa7')])[0x0],_0x8e1611[_0x474f('0xa8')]);_0x82bf71['variables']=this[_0x474f('0x16')][_0x8e1611[_0x474f('0x48')]];}}}}catch(_0x583ceb){logger[_0x474f('0x3d')](_0x474f('0xa5'),_0x8e1611[_0x474f('0x48')],util['inspect'](_0x583ceb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x474f('0xa')]['addVariable']=function(_0x45a40b,_0x3b9a96,_0x374e82){var _0x54349e=[_0x474f('0xb2'),'rtpaudioqosbridged',_0x474f('0xb3'),_0x474f('0xb4'),_0x474f('0xb5'),'rtpaudioqoslossbridged',_0x474f('0xb6'),'rtpaudioqosrttbridged',_0x474f('0xb7'),_0x474f('0xb8'),_0x474f('0xb9'),_0x474f('0xba'),'membercalls','memberdynamic','memberinterface','memberlastcall',_0x474f('0xbb'),_0x474f('0xbc'),_0x474f('0xbd')];if(!_['isNil'](_0x3b9a96)&&!_['includes'](_0x54349e,_0x3b9a96)){if(_[_0x474f('0x63')](this[_0x474f('0x16')][_0x45a40b])){this[_0x474f('0x16')][_0x45a40b]={};}this['variables'][_0x45a40b][_0x3b9a96]=_0x374e82;}};VoiceQueueReport[_0x474f('0xa')][_0x474f('0x26')]=function(_0x145f80){try{if(this[_0x474f('0x62')](_0x145f80)){logger[_0x474f('0x46')]('[%s][voiceQueueReport][hangup]',_0x145f80[_0x474f('0x48')],util[_0x474f('0x3f')](_0x145f80,{'showHidden':![],'depth':null}));if(this[_0x474f('0xf')][_0x145f80[_0x474f('0x48')]]){for(var _0x563674=0x0,_0x2bbcee={};_0x563674=0x0?moment(_0x1cc6e1[_0x26ee('0x19')])[_0x26ee('0xd')](_0x1cc6e1[_0x26ee('0x18')],_0x26ee('0x1a')):null,'data1':_0x26ee('0x1b'),'data2':_0x1cc6e1[_0x26ee('0x12')],'data3':_0x1cc6e1[_0x26ee('0x1c')],'data4':_0x1cc6e1[_0x26ee('0x1d')]||null,'role':_0x26ee('0x11'),'internal':_0x1cc6e1[_0x26ee('0x12')]?_[_0x26ee('0x13')](_0x1cc6e1['accountcode']):undefined,'uniqueid':_0x1cc6e1['uniqueid']},'log':_0x26ee('0x6')});}; \ No newline at end of file +var _0xed35=['lastAssignedTo','isNil','interface','SIP/%s','queuecallerleaveAt','seconds','inbound','calleridnum','exten','agent','accountcode','uniqueid','voiceDialReport','membername','TALKING','starttime','diff','outbound','dialstring','toNumber','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice'];(function(_0x346edc,_0x30d4c){var _0x5cfd6f=function(_0xef9011){while(--_0xef9011){_0x346edc['push'](_0x346edc['shift']());}};_0x5cfd6f(++_0x30d4c);}(_0xed35,0x136));var _0x5ed3=function(_0x26f5ef,_0x1e3889){_0x26f5ef=_0x26f5ef-0x0;var _0x503f92=_0xed35[_0x26f5ef];return _0x503f92;};'use strict';var moment=require(_0x5ed3('0x0'));var _=require(_0x5ed3('0x1'));var util=require(_0x5ed3('0x2'));var client=require(_0x5ed3('0x3'));exports['voiceQueueReport']=function(_0x51abc9){var _0x156f99=_0x51abc9[_0x5ed3('0x4')]||_0x51abc9[_0x5ed3('0x5')];return client[_0x5ed3('0x6')](_0x5ed3('0x7'),{'body':{'channel':_0x5ed3('0x8'),'membername':_0x51abc9[_0x5ed3('0x9')],'interface':_[_0x5ed3('0xa')](_0x51abc9[_0x5ed3('0xb')])?util['format'](_0x5ed3('0xc'),_0x51abc9[_0x5ed3('0x9')]):_0x51abc9[_0x5ed3('0xb')],'type':'TALKING','enterAt':_0x51abc9[_0x5ed3('0xd')],'exitAt':_0x156f99,'duration':moment(_0x156f99)['diff'](_0x51abc9[_0x5ed3('0xd')],_0x5ed3('0xe')),'data1':_0x5ed3('0xf'),'data2':_0x51abc9[_0x5ed3('0x10')],'data3':_0x51abc9[_0x5ed3('0x11')],'data4':null,'data5':_0x51abc9['queue'],'role':_0x5ed3('0x12'),'internal':_0x51abc9[_0x5ed3('0x13')]?_['toNumber'](_0x51abc9['accountcode']):undefined,'uniqueid':_0x51abc9[_0x5ed3('0x14')]},'log':_0x5ed3('0x7')});};exports[_0x5ed3('0x15')]=function(_0x2b774e){return client[_0x5ed3('0x6')](_0x5ed3('0x7'),{'body':{'channel':_0x5ed3('0x8'),'membername':_0x2b774e[_0x5ed3('0x16')],'interface':_0x2b774e[_0x5ed3('0xb')],'type':_0x5ed3('0x17'),'enterAt':_0x2b774e[_0x5ed3('0x18')],'exitAt':_0x2b774e['endtime'],'duration':moment(_0x2b774e['endtime'])[_0x5ed3('0x19')](_0x2b774e['starttime'],_0x5ed3('0xe'))>=0x0?moment(_0x2b774e['endtime'])[_0x5ed3('0x19')](_0x2b774e['starttime'],_0x5ed3('0xe')):null,'data1':_0x5ed3('0x1a'),'data2':_0x2b774e[_0x5ed3('0x13')],'data3':_0x2b774e[_0x5ed3('0x11')],'data4':_0x2b774e[_0x5ed3('0x1b')]||null,'role':_0x5ed3('0x12'),'internal':_0x2b774e['accountcode']?_[_0x5ed3('0x1c')](_0x2b774e[_0x5ed3('0x13')]):undefined,'uniqueid':_0x2b774e[_0x5ed3('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4834130..48b824e 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 _0x0d77=['getSettings','Request','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x5cafbf,_0x213a21){var _0x57533e=function(_0x4ce439){while(--_0x4ce439){_0x5cafbf['push'](_0x5cafbf['shift']());}};_0x57533e(++_0x213a21);}(_0x0d77,0x8b));var _0x70d7=function(_0x54a6df,_0xdba0dd){_0x54a6df=_0x54a6df-0x0;var _0x1e5e19=_0x0d77[_0x54a6df];return _0x1e5e19;};'use strict';var client=require(_0x70d7('0x0'));exports[_0x70d7('0x1')]=function(){return client[_0x70d7('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x70d7('0x3')]},'log':_0x70d7('0x4')});}; \ No newline at end of file +var _0xc547=['getSettings','ShowSetting','GetSettings'];(function(_0x50457d,_0x1fa83f){var _0x3c144c=function(_0x580732){while(--_0x580732){_0x50457d['push'](_0x50457d['shift']());}};_0x3c144c(++_0x1fa83f);}(_0xc547,0x153));var _0x7c54=function(_0x414e4f,_0x18875f){_0x414e4f=_0x414e4f-0x0;var _0x10839f=_0xc547[_0x414e4f];return _0x10839f;};'use strict';var client=require('../client');exports[_0x7c54('0x0')]=function(){return client['Request'](_0x7c54('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x7c54('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d36a7bb..a64d2aa 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 _0x6257=['../client','GetTemplate','name','html'];(function(_0xd0c043,_0x38d6df){var _0x532dd4=function(_0x53e7fc){while(--_0x53e7fc){_0xd0c043['push'](_0xd0c043['shift']());}};_0x532dd4(++_0x38d6df);}(_0x6257,0x1d4));var _0x7625=function(_0x3bff6d,_0x53ecee){_0x3bff6d=_0x3bff6d-0x0;var _0xdd8a9b=_0x6257[_0x3bff6d];return _0xdd8a9b;};'use strict';var client=require(_0x7625('0x0'));exports['getTemplates']=function(_0x46be68){return function(_0x574e72){return client['Request'](_0x7625('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7625('0x2'),_0x7625('0x3')]},'log':_0x7625('0x1')});};}; \ No newline at end of file +var _0xc7e8=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x1eba52,_0x25fe83){var _0x2ecf9e=function(_0x50690d){while(--_0x50690d){_0x1eba52['push'](_0x1eba52['shift']());}};_0x2ecf9e(++_0x25fe83);}(_0xc7e8,0xc2));var _0x8c7e=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xc7e8[_0x18f64a];return _0x44687f;};'use strict';var client=require(_0x8c7e('0x0'));exports[_0x8c7e('0x1')]=function(_0x2a4aac){return function(_0x1e389a){return client[_0x8c7e('0x2')](_0x8c7e('0x3'),{'options':{'raw':!![],'attributes':['id',_0x8c7e('0x4'),_0x8c7e('0x5')]},'log':_0x8c7e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ff4ef65..e535ff1 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 _0x5116=['action','data1','data4','data6','../client','getTriggers','Request','GetTrigger','channel','Condition','AllConditions','operator','value','AnyConditions','Action','Actions'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5116,0x74));var _0x6511=function(_0x32ead4,_0x182044){_0x32ead4=_0x32ead4-0x0;var _0x306d36=_0x5116[_0x32ead4];return _0x306d36;};'use strict';var client=require(_0x6511('0x0'));exports[_0x6511('0x1')]=function(_0x56d1bd){return function(_0x2f6134){return client[_0x6511('0x2')](_0x6511('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x6511('0x4'),'status'],'include':[{'model':_0x6511('0x5'),'as':_0x6511('0x6'),'attributes':['id','field',_0x6511('0x7'),_0x6511('0x8')]},{'model':_0x6511('0x5'),'as':_0x6511('0x9'),'attributes':['id','field',_0x6511('0x7'),_0x6511('0x8')]},{'model':_0x6511('0xa'),'as':_0x6511('0xb'),'attributes':['id',_0x6511('0xc'),_0x6511('0xd'),'data2','data3',_0x6511('0xe'),'data5',_0x6511('0xf'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x49ad=['value','Condition','AnyConditions','field','Actions','data1','data3','data4','data5','data6','data7','Request','GetTrigger','channel','status','AllConditions','operator'];(function(_0x4106e1,_0x14ca87){var _0x26d6e9=function(_0x3c6293){while(--_0x3c6293){_0x4106e1['push'](_0x4106e1['shift']());}};_0x26d6e9(++_0x14ca87);}(_0x49ad,0xb5));var _0xd49a=function(_0x5dda79,_0x5b35f1){_0x5dda79=_0x5dda79-0x0;var _0x1c1707=_0x49ad[_0x5dda79];return _0x1c1707;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x1b096c){return function(_0x729557){return client[_0xd49a('0x0')](_0xd49a('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xd49a('0x2'),_0xd49a('0x3')],'include':[{'model':'Condition','as':_0xd49a('0x4'),'attributes':['id','field',_0xd49a('0x5'),_0xd49a('0x6')]},{'model':_0xd49a('0x7'),'as':_0xd49a('0x8'),'attributes':['id',_0xd49a('0x9'),_0xd49a('0x5'),_0xd49a('0x6')]},{'model':'Action','as':_0xd49a('0xa'),'attributes':['id','action',_0xd49a('0xb'),'data2',_0xd49a('0xc'),_0xd49a('0xd'),_0xd49a('0xe'),_0xd49a('0xf'),_0xd49a('0x10')]}]},'log':_0xd49a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 0170bbd..602c1eb 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 _0x867f=['GetTrunk','name','../client','getTrunks','Request'];(function(_0x312837,_0x198d0a){var _0x348a44=function(_0x138141){while(--_0x138141){_0x312837['push'](_0x312837['shift']());}};_0x348a44(++_0x198d0a);}(_0x867f,0x7f));var _0xf867=function(_0x1417c6,_0x194309){_0x1417c6=_0x1417c6-0x0;var _0x44db97=_0x867f[_0x1417c6];return _0x44db97;};'use strict';var client=require(_0xf867('0x0'));exports[_0xf867('0x1')]=function(_0x83d97c){return function(_0xde6233){return client[_0xf867('0x2')](_0xf867('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf867('0x4'),'registry','defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x497d=['defaultuser','getTrunks','GetTrunk','name','registry'];(function(_0x3a7cc6,_0x2baf23){var _0x4ce0f4=function(_0x144c11){while(--_0x144c11){_0x3a7cc6['push'](_0x3a7cc6['shift']());}};_0x4ce0f4(++_0x2baf23);}(_0x497d,0x1a0));var _0xd497=function(_0x29ed49,_0x28b785){_0x29ed49=_0x29ed49-0x0;var _0x33211d=_0x497d[_0x29ed49];return _0x33211d;};'use strict';var client=require('../client');exports[_0xd497('0x0')]=function(_0x42fe91){return function(_0x32e158){return client['Request'](_0xd497('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd497('0x2'),_0xd497('0x3'),_0xd497('0x4')]},'log':_0xd497('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 47f3a95..8241f91 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x12443a,_0x55b9ba){var _0x5dda77=function(_0x3f6206){while(--_0x3f6206){_0x12443a['push'](_0x12443a['shift']());}};_0x5dda77(++_0x55b9ba);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe706,0xa3));var _0x6e70=function(_0x1b79f5,_0x1cf93a){_0x1b79f5=_0x1b79f5-0x0;var _0x26a6f1=_0xe706[_0x1b79f5];return _0x26a6f1;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index bfa680c..922212c 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 _0xb875=['Request','CreateVoiceAgentReport','create'];(function(_0x42dc18,_0x155343){var _0x86b51a=function(_0x289ebe){while(--_0x289ebe){_0x42dc18['push'](_0x42dc18['shift']());}};_0x86b51a(++_0x155343);}(_0xb875,0x11f));var _0x5b87=function(_0x280875,_0x137bcb){_0x280875=_0x280875-0x0;var _0x74acfe=_0xb875[_0x280875];return _0x74acfe;};'use strict';var client=require('../client');exports[_0x5b87('0x0')]=function(_0x2cd9cc){return client[_0x5b87('0x1')](_0x5b87('0x2'),{'body':_0x2cd9cc,'log':_0x5b87('0x2')});};exports['update']=function(_0x198236,_0x48aa6b,_0x1e8f21){return client['Request']('UpdateVoiceAgentReport',{'body':_0x198236,'options':{'where':{'uniqueid':_0x48aa6b,'interface':_0x1e8f21,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x5170=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x4e7306,_0x51515f){var _0x403bbe=function(_0x311e60){while(--_0x311e60){_0x4e7306['push'](_0x4e7306['shift']());}};_0x403bbe(++_0x51515f);}(_0x5170,0x14e));var _0x0517=function(_0x490203,_0x2b548e){_0x490203=_0x490203-0x0;var _0x33c716=_0x5170[_0x490203];return _0x33c716;};'use strict';var client=require(_0x0517('0x0'));exports[_0x0517('0x1')]=function(_0x2e8098){return client[_0x0517('0x2')](_0x0517('0x3'),{'body':_0x2e8098,'log':'CreateVoiceAgentReport'});};exports[_0x0517('0x4')]=function(_0x5b3b8a,_0x44e374,_0x3135a0){return client['Request'](_0x0517('0x5'),{'body':_0x5b3b8a,'options':{'where':{'uniqueid':_0x44e374,'interface':_0x3135a0,'agentcomplete':!![]}},'log':_0x0517('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 21b2ea4..e9dc992 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 _0xd1df=['YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format'];(function(_0x168888,_0x1f8123){var _0x442a72=function(_0x247b8b){while(--_0x247b8b){_0x168888['push'](_0x168888['shift']());}};_0x442a72(++_0x1f8123);}(_0xd1df,0x1be));var _0xfd1d=function(_0x23daa4,_0xfc0cb){_0x23daa4=_0x23daa4-0x0;var _0x50da32=_0xd1df[_0x23daa4];return _0x50da32;};'use strict';var moment=require(_0xfd1d('0x0'));var util=require('util');var _=require(_0xfd1d('0x1'));var client=require(_0xfd1d('0x2'));exports[_0xfd1d('0x3')]=function(_0x3ff671){return client['Request']('CreateVoiceCallReport',{'body':_[_0xfd1d('0x4')](_0x3ff671,{'source':_0x3ff671[_0xfd1d('0x5')],'destinationcontext':_0x3ff671[_0xfd1d('0x6')],'callerid':_0x3ff671[_0xfd1d('0x7')],'amaflags':_0xfd1d('0x8')}),'log':_0xfd1d('0x9')});};exports[_0xfd1d('0xa')]=function(){return function(){return client['Request'](_0xfd1d('0xb'),{'options':{'where':{'type':[_0xfd1d('0xc')],'createdAt':{'$between':[moment()[_0xfd1d('0xd')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xfd1d('0xe'))[_0xfd1d('0xf')](_0xfd1d('0x10'))]}},'attributes':[_0xfd1d('0x11'),'disposition',_0xfd1d('0x12'),_0xfd1d('0x13')]},'log':_0xfd1d('0x14')});};}; \ No newline at end of file +var _0x5565=['context','callerid','getVoiceCallReports','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum'];(function(_0x7692e4,_0x78becb){var _0x160ddd=function(_0xd99f00){while(--_0xd99f00){_0x7692e4['push'](_0x7692e4['shift']());}};_0x160ddd(++_0x78becb);}(_0x5565,0xdc));var _0x5556=function(_0x893f6e,_0x52d816){_0x893f6e=_0x893f6e-0x0;var _0x1fcc55=_0x5565[_0x893f6e];return _0x1fcc55;};'use strict';var moment=require(_0x5556('0x0'));var util=require(_0x5556('0x1'));var _=require(_0x5556('0x2'));var client=require(_0x5556('0x3'));exports[_0x5556('0x4')]=function(_0x321e9c){return client['Request'](_0x5556('0x5'),{'body':_[_0x5556('0x6')](_0x321e9c,{'source':_0x321e9c[_0x5556('0x7')],'destinationcontext':_0x321e9c[_0x5556('0x8')],'callerid':_0x321e9c[_0x5556('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x5556('0x5')});};exports[_0x5556('0xa')]=function(){return function(){return client['Request'](_0x5556('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x5556('0xc'))[_0x5556('0xd')](_0x5556('0xe')),moment()['endOf']('day')[_0x5556('0xd')](_0x5556('0xe'))]}},'attributes':[_0x5556('0xf'),_0x5556('0x10'),_0x5556('0x11'),'billableseconds']},'log':_0x5556('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c789559..21c3412 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 _0x98b4=['Request','CreateVoiceDialReport','../client','create'];(function(_0xd92031,_0xdc1d3a){var _0x4db3da=function(_0x3d2354){while(--_0x3d2354){_0xd92031['push'](_0xd92031['shift']());}};_0x4db3da(++_0xdc1d3a);}(_0x98b4,0x1e2));var _0x498b=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x98b4[_0xbd08b4];return _0x314f1e;};'use strict';var client=require(_0x498b('0x0'));exports[_0x498b('0x1')]=function(_0x454107){return client[_0x498b('0x2')](_0x498b('0x3'),{'body':_0x454107,'log':_0x498b('0x3')});}; \ No newline at end of file +var _0x28af=['../client','create','CreateVoiceDialReport'];(function(_0x31fc63,_0x2ddb3a){var _0x243857=function(_0xee2a41){while(--_0xee2a41){_0x31fc63['push'](_0x31fc63['shift']());}};_0x243857(++_0x2ddb3a);}(_0x28af,0x153));var _0xf28a=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x28af[_0x12b683];return _0xfb150b;};'use strict';var client=require(_0xf28a('0x0'));exports[_0xf28a('0x1')]=function(_0x60a4c5){return client['Request'](_0xf28a('0x2'),{'body':_0x60a4c5,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b21a340..035e6a9 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 _0x83e1=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x83e1,0x1ad));var _0x183e=function(_0x19564e,_0x2217fe){_0x19564e=_0x19564e-0x0;var _0x2fa1c0=_0x83e1[_0x19564e];return _0x2fa1c0;};'use strict';var client=require(_0x183e('0x0'));exports[_0x183e('0x1')]=function(){return function(){return client['Request'](_0x183e('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x183e('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xd4b6=['getVoiceExtensions','GetVoiceExtension','exten','../client'];(function(_0x2e1fa5,_0x6c5475){var _0x45ebaf=function(_0x538a54){while(--_0x538a54){_0x2e1fa5['push'](_0x2e1fa5['shift']());}};_0x45ebaf(++_0x6c5475);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x49c46d,_0x260508){_0x49c46d=_0x49c46d-0x0;var _0x46fbf1=_0xd4b6[_0x49c46d];return _0x46fbf1;};'use strict';var client=require(_0x6d4b('0x0'));exports[_0x6d4b('0x1')]=function(){return function(){return client['Request'](_0x6d4b('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6d4b('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x6d4b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7bbdfac..02366bb 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 _0xfb7e=['name','acw','acwTimeout','autopause','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue'];(function(_0x4fad9b,_0x2d9f71){var _0x335f40=function(_0x1f1362){while(--_0x1f1362){_0x4fad9b['push'](_0x4fad9b['shift']());}};_0x335f40(++_0x2d9f71);}(_0xfb7e,0xf4));var _0xefb7=function(_0x5690a0,_0x4541f7){_0x5690a0=_0x5690a0-0x0;var _0x293d64=_0xfb7e[_0x5690a0];return _0x293d64;};'use strict';var client=require(_0xefb7('0x0'));exports[_0xefb7('0x1')]=function(){return function(){return client[_0xefb7('0x2')](_0xefb7('0x3'),{'options':{'raw':![],'attributes':['id',_0xefb7('0x4'),_0xefb7('0x5'),_0xefb7('0x6'),_0xefb7('0x7'),'monitor_format',_0xefb7('0x8'),_0xefb7('0x9'),'dialMethod',_0xefb7('0xa'),'dialLimitQueue',_0xefb7('0xb'),_0xefb7('0xc'),_0xefb7('0xd'),_0xefb7('0xe'),_0xefb7('0xf'),'dialOriginateCallerIdNumber',_0xefb7('0x10'),'dialQueueOptions',_0xefb7('0x11'),_0xefb7('0x12'),_0xefb7('0x13'),_0xefb7('0x14'),_0xefb7('0x15'),_0xefb7('0x16'),_0xefb7('0x17'),_0xefb7('0x18'),_0xefb7('0x19'),_0xefb7('0x1a'),'dialGlobalInterval',_0xefb7('0x1b'),_0xefb7('0x1c'),_0xefb7('0x1d'),_0xefb7('0x1e'),_0xefb7('0x1f'),_0xefb7('0x20'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0xefb7('0x21'),'dialAMDMaximumNumberOfWords',_0xefb7('0x22'),_0xefb7('0x23'),'timeout',_0xefb7('0x24'),_0xefb7('0x25'),_0xefb7('0x26'),_0xefb7('0x27'),_0xefb7('0x28'),_0xefb7('0x29'),'monitor_format','strategy',_0xefb7('0x2a'),_0xefb7('0x2b'),'dialNoSuchNumberMaxRetry',_0xefb7('0x2c'),_0xefb7('0x2d'),'dialDropRetryFrequency',_0xefb7('0x2e'),_0xefb7('0x2f'),'dialMachineMaxRetry',_0xefb7('0x30'),_0xefb7('0x31'),_0xefb7('0x32'),_0xefb7('0x33'),'dialPredictiveIntervalMaxThreshold',_0xefb7('0x34')],'include':[{'model':_0xefb7('0x35'),'as':_0xefb7('0x35'),'attributes':['id',_0xefb7('0x4'),_0xefb7('0x36'),_0xefb7('0x37')]},{'model':_0xefb7('0x38'),'as':_0xefb7('0x39'),'attributes':['id','name']},{'model':_0xefb7('0x35'),'as':_0xefb7('0x3a'),'attributes':['id',_0xefb7('0x4'),_0xefb7('0x36'),_0xefb7('0x37')]},{'model':_0xefb7('0x3b'),'as':_0xefb7('0x3b'),'attributes':['id',_0xefb7('0x4')],'include':[{'model':_0xefb7('0x3b'),'as':_0xefb7('0x3c'),'attributes':['id',_0xefb7('0x4'),_0xefb7('0x3d')]}]}]},'log':_0xefb7('0x1')});};}; \ No newline at end of file +var _0x18a6=['dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x403ca6,_0x4899af){var _0x2083d0=function(_0x4d74eb){while(--_0x4d74eb){_0x403ca6['push'](_0x403ca6['shift']());}};_0x2083d0(++_0x4899af);}(_0x18a6,0x16f));var _0x618a=function(_0x444ab2,_0x180a38){_0x444ab2=_0x444ab2-0x0;var _0x271e80=_0x18a6[_0x444ab2];return _0x271e80;};'use strict';var client=require('../client');exports[_0x618a('0x0')]=function(){return function(){return client[_0x618a('0x1')](_0x618a('0x2'),{'options':{'raw':![],'attributes':['id',_0x618a('0x3'),_0x618a('0x4'),'acwTimeout',_0x618a('0x5'),_0x618a('0x6'),'type',_0x618a('0x7'),_0x618a('0x8'),'dialLimitChannel',_0x618a('0x9'),_0x618a('0xa'),_0x618a('0xb'),_0x618a('0xc'),_0x618a('0xd'),'dialOriginateCallerIdName',_0x618a('0xe'),'dialOriginateTimeout','dialQueueOptions',_0x618a('0xf'),_0x618a('0x10'),_0x618a('0x11'),_0x618a('0x12'),_0x618a('0x13'),_0x618a('0x14'),_0x618a('0x15'),_0x618a('0x16'),_0x618a('0x17'),_0x618a('0x18'),_0x618a('0x19'),_0x618a('0x1a'),_0x618a('0x1b'),_0x618a('0x1c'),_0x618a('0x1d'),'dialAMDGreeting',_0x618a('0x1e'),'dialAMDTotalAnalysisTime',_0x618a('0x1f'),_0x618a('0x20'),_0x618a('0x21'),'dialAMDSilenceThreshold',_0x618a('0x22'),_0x618a('0x23'),_0x618a('0x24'),_0x618a('0x25'),_0x618a('0x26'),_0x618a('0x27'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format',_0x618a('0x28'),_0x618a('0x29'),_0x618a('0x2a'),_0x618a('0x2b'),_0x618a('0x2c'),_0x618a('0x2d'),_0x618a('0x2e'),_0x618a('0x2f'),_0x618a('0x30'),_0x618a('0x31'),_0x618a('0x32'),_0x618a('0x33'),_0x618a('0x34'),_0x618a('0x35'),_0x618a('0x36'),_0x618a('0x37')],'include':[{'model':_0x618a('0x38'),'as':_0x618a('0x38'),'attributes':['id','name',_0x618a('0x39'),_0x618a('0x3a')]},{'model':_0x618a('0x3b'),'as':_0x618a('0x3c'),'attributes':['id',_0x618a('0x3')]},{'model':_0x618a('0x38'),'as':_0x618a('0x3d'),'attributes':['id',_0x618a('0x3'),_0x618a('0x39'),_0x618a('0x3a')]},{'model':'Interval','as':'Interval','attributes':['id',_0x618a('0x3')],'include':[{'model':_0x618a('0x3e'),'as':_0x618a('0x3f'),'attributes':['id','name',_0x618a('0x40')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3a4fdad..4f8404b 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(_0x2e91c4,_0x23403d){var _0xc32d69=function(_0xed1e53){while(--_0xed1e53){_0x2e91c4['push'](_0x2e91c4['shift']());}};_0xc32d69(++_0x23403d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x1062a4,_0x1edd2a){var _0x3f452d=function(_0x3df766){while(--_0x3df766){_0x1062a4['push'](_0x1062a4['shift']());}};_0x3f452d(++_0x1edd2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 8354094..e1f6c41 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 _0x5670=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x1164ff,_0x3182c0){var _0x14f179=function(_0x3476db){while(--_0x3476db){_0x1164ff['push'](_0x1164ff['shift']());}};_0x14f179(++_0x3182c0);}(_0x5670,0x19b));var _0x0567=function(_0xfe4688,_0x689353){_0xfe4688=_0xfe4688-0x0;var _0x380e65=_0x5670[_0xfe4688];return _0x380e65;};'use strict';var client=require('../client');exports[_0x0567('0x0')]=function(_0x280d9b){return function(){return client[_0x0567('0x1')](_0x0567('0x2'),{'options':{'where':{'VoiceQueueId':_0x280d9b,'paused':!![]},'raw':!![]},'log':_0x0567('0x0')});};}; \ No newline at end of file +var _0x844b=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x7bc909,_0x5eb401){var _0x287f9b=function(_0x122b78){while(--_0x122b78){_0x7bc909['push'](_0x7bc909['shift']());}};_0x287f9b(++_0x5eb401);}(_0x844b,0x186));var _0xb844=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x844b[_0x3c6dce];return _0x1450e9;};'use strict';var client=require(_0xb844('0x0'));exports['getVoiceQueueRtPauses']=function(_0x395e73){return function(){return client[_0xb844('0x1')](_0xb844('0x2'),{'options':{'where':{'VoiceQueueId':_0x395e73,'paused':!![]},'raw':!![]},'log':_0xb844('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 8312db4..6c6b29a 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x10a6ed,_0xebadbc){var _0x4ecb15=function(_0x4faeea){while(--_0x4faeea){_0x10a6ed['push'](_0x10a6ed['shift']());}};_0x4ecb15(++_0xebadbc);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2e233a,_0x582dd9){var _0x3228b5=function(_0x11f063){while(--_0x11f063){_0x2e233a['push'](_0x2e233a['shift']());}};_0x3228b5(++_0x582dd9);}(_0x7a54,0x106));var _0x47a5=function(_0x5e9517,_0x1d6b7a){_0x5e9517=_0x5e9517-0x0;var _0x232a0a=_0x7a54[_0x5e9517];return _0x232a0a;};'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 ec8a80e..3149043 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 _0x1e57=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransfererexten','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e57,0x15b));var _0x71e5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1e57[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x71e5('0x0'));exports[_0x71e5('0x1')]={};exports[_0x71e5('0x2')]=function(_0xa247c9){return client[_0x71e5('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0xa247c9[_0x71e5('0x4')],'transfererchannel':_0xa247c9[_0x71e5('0x5')],'transferercalleridnum':_0xa247c9[_0x71e5('0x6')],'transferercalleridname':_0xa247c9[_0x71e5('0x7')],'transfererconnectedlinenum':_0xa247c9[_0x71e5('0x8')],'transfererconnectedlinename':_0xa247c9[_0x71e5('0x9')],'transfereraccountcode':_0xa247c9[_0x71e5('0xa')],'transferercontext':_0xa247c9['transferercontext'],'transfererexten':_0xa247c9[_0x71e5('0xb')],'transfererlinkedid':_0xa247c9[_0x71e5('0xc')],'transfereechannel':_0xa247c9[_0x71e5('0xd')],'transfereecalleridnum':_0xa247c9[_0x71e5('0xe')],'transfereecalleridname':_0xa247c9[_0x71e5('0xf')],'transfereeconnectedlinenum':_0xa247c9[_0x71e5('0x10')],'transfereeconnectedlinename':_0xa247c9[_0x71e5('0x11')],'transfereeaccountcode':_0xa247c9[_0x71e5('0x12')],'transfereecontext':_0xa247c9[_0x71e5('0x13')],'transfereeexten':_0xa247c9[_0x71e5('0x14')],'transfereelinkedid':_0xa247c9[_0x71e5('0x15')],'isexternal':_0xa247c9['isexternal'],'context':_0xa247c9['context'],'extension':_0xa247c9[_0x71e5('0x16')],'type':_0x71e5('0x17')},'log':_0x71e5('0x18')});};exports[_0x71e5('0x19')]=function(_0x3f459e){return client[_0x71e5('0x3')](_0x71e5('0x18'),{'body':{'result':_0x3f459e['result'],'transfererchannel':_0x3f459e[_0x71e5('0x1a')],'transferercalleridnum':_0x3f459e[_0x71e5('0x1b')],'transferercalleridname':_0x3f459e[_0x71e5('0x1c')],'transfererconnectedlinenum':_0x3f459e[_0x71e5('0x1d')],'transfererconnectedlinename':_0x3f459e[_0x71e5('0x1e')],'transfereraccountcode':_0x3f459e[_0x71e5('0x1f')],'transferercontext':_0x3f459e[_0x71e5('0x20')],'transfererexten':_0x3f459e[_0x71e5('0x21')],'transfererlinkedid':_0x3f459e['origtransfererlinkedid'],'transfereechannel':_0x3f459e[_0x71e5('0x22')],'transfereecalleridnum':_0x3f459e[_0x71e5('0x23')],'transfereecalleridname':_0x3f459e[_0x71e5('0x24')],'transfereeconnectedlinenum':_0x3f459e[_0x71e5('0x25')],'transfereeconnectedlinename':_0x3f459e[_0x71e5('0x26')],'transfereeaccountcode':_0x3f459e['transfertargetaccountcode'],'transfereecontext':_0x3f459e['transfertargetcontext'],'transfereeexten':_0x3f459e[_0x71e5('0x27')],'transfereelinkedid':_0x3f459e[_0x71e5('0x28')],'isexternal':_0x3f459e['isexternal'],'context':_0x3f459e['origtransferercontext'],'extension':_0x3f459e[_0x71e5('0x29')],'type':'attended'},'log':_0x71e5('0x18')});}; \ No newline at end of file +var _0xabdf=['transfereecontext','transfereelinkedid','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x57af30,_0x30919c){var _0x1ad330=function(_0x585b59){while(--_0x585b59){_0x57af30['push'](_0x57af30['shift']());}};_0x1ad330(++_0x30919c);}(_0xabdf,0x8e));var _0xfabd=function(_0x4e2b18,_0x499f5c){_0x4e2b18=_0x4e2b18-0x0;var _0x154835=_0xabdf[_0x4e2b18];return _0x154835;};'use strict';var client=require('../client');exports[_0xfabd('0x0')]={};exports[_0xfabd('0x1')]=function(_0x2faffa){return client[_0xfabd('0x2')](_0xfabd('0x3'),{'body':{'result':_0x2faffa[_0xfabd('0x4')],'transfererchannel':_0x2faffa[_0xfabd('0x5')],'transferercalleridnum':_0x2faffa[_0xfabd('0x6')],'transferercalleridname':_0x2faffa[_0xfabd('0x7')],'transfererconnectedlinenum':_0x2faffa['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2faffa[_0xfabd('0x8')],'transfereraccountcode':_0x2faffa[_0xfabd('0x9')],'transferercontext':_0x2faffa['transferercontext'],'transfererexten':_0x2faffa[_0xfabd('0xa')],'transfererlinkedid':_0x2faffa[_0xfabd('0xb')],'transfereechannel':_0x2faffa[_0xfabd('0xc')],'transfereecalleridnum':_0x2faffa[_0xfabd('0xd')],'transfereecalleridname':_0x2faffa[_0xfabd('0xe')],'transfereeconnectedlinenum':_0x2faffa[_0xfabd('0xf')],'transfereeconnectedlinename':_0x2faffa[_0xfabd('0x10')],'transfereeaccountcode':_0x2faffa[_0xfabd('0x11')],'transfereecontext':_0x2faffa[_0xfabd('0x12')],'transfereeexten':_0x2faffa['transfereeexten'],'transfereelinkedid':_0x2faffa[_0xfabd('0x13')],'isexternal':_0x2faffa['isexternal'],'context':_0x2faffa['context'],'extension':_0x2faffa['extension'],'type':_0xfabd('0x14')},'log':_0xfabd('0x3')});};exports[_0xfabd('0x15')]=function(_0x5d0fc9){return client[_0xfabd('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x5d0fc9[_0xfabd('0x4')],'transfererchannel':_0x5d0fc9[_0xfabd('0x16')],'transferercalleridnum':_0x5d0fc9[_0xfabd('0x17')],'transferercalleridname':_0x5d0fc9[_0xfabd('0x18')],'transfererconnectedlinenum':_0x5d0fc9['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5d0fc9[_0xfabd('0x19')],'transfereraccountcode':_0x5d0fc9[_0xfabd('0x1a')],'transferercontext':_0x5d0fc9['secondtransferercontext'],'transfererexten':_0x5d0fc9[_0xfabd('0x1b')],'transfererlinkedid':_0x5d0fc9[_0xfabd('0x1c')],'transfereechannel':_0x5d0fc9[_0xfabd('0x1d')],'transfereecalleridnum':_0x5d0fc9[_0xfabd('0x1e')],'transfereecalleridname':_0x5d0fc9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5d0fc9[_0xfabd('0x1f')],'transfereeconnectedlinename':_0x5d0fc9['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5d0fc9[_0xfabd('0x20')],'transfereecontext':_0x5d0fc9[_0xfabd('0x21')],'transfereeexten':_0x5d0fc9[_0xfabd('0x22')],'transfereelinkedid':_0x5d0fc9[_0xfabd('0x23')],'isexternal':_0x5d0fc9[_0xfabd('0x24')],'context':_0x5d0fc9[_0xfabd('0x25')],'extension':_0x5d0fc9[_0xfabd('0x26')],'type':_0xfabd('0x27')},'log':_0xfabd('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index e88417c..4fc5a8e 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 _0xe626=['StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','values','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outbound','emit','custom:','faxAccounts','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','catch','pick','command','Command','content','voiceQueues','name','strategy','answered','loggedIn','pTalking','sumBillable','talking','waiting','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','find','omit','undefined','channels','voicechannel','uniqueid','%s.%s','filename','format','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','map','resolve'];(function(_0x26a1d9,_0x4a1caf){var _0x3c7d75=function(_0x53dc33){while(--_0x53dc33){_0x26a1d9['push'](_0x26a1d9['shift']());}};_0x3c7d75(++_0x4a1caf);}(_0xe626,0x9d));var _0x6e62=function(_0x468e1f,_0x2142bf){_0x468e1f=_0x468e1f-0x0;var _0x4a066d=_0xe626[_0x468e1f];return _0x4a066d;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var jayson=require(_0x6e62('0x2'));var schema=require(_0x6e62('0x3'));var BPromise=require('bluebird');var moment=require(_0x6e62('0x4'));var config=require(_0x6e62('0x5'));var properties=require(_0x6e62('0x6'));var ami=require(_0x6e62('0x7'));exports[_0x6e62('0x8')]=function(_0x4d4816,_0x5f25a3,_0x4a778d){return new BPromise(function(_0x2ee927,_0x157047){var _0x55165e={'QueuePause':function(_0x32fd89){return new Promise(function(_0x1dfbaf,_0x16fa52){var _0x3317f1=util['format'](_0x6e62('0x9'),_0x6e62('0xa'),_0x32fd89['name']);if(_0x4d4816[_0x6e62('0xb')]&&_0x4d4816['timers'][_0x3317f1]&&_0x4d4816[_0x6e62('0xb')][_0x3317f1]['timer']){_0x4d4816[_0x6e62('0xb')][_0x3317f1]['updateAcw']();}if(_0x4d4816[_0x6e62('0xc')][_0x3317f1]){_0x4d4816[_0x6e62('0xc')][_0x3317f1][_0x6e62('0xd')]({'statePause':_0x32fd89[_0x6e62('0xe')]?!![]:![]});}_0x1dfbaf({'code':0xc8,'message':_0x6e62('0xf')});});},'Reload':function(_0x1c266b){var _0x3b5c11=this;return new Promise(function(_0x49be2d,_0x4e7917){if(ami[_0x6e62('0x10')]()==![]){return _0x4e7917(_0x3b5c11[_0x6e62('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x6e62('0x12')][_0x6e62('0x13')],_0x6e62('0x14')][_0x6e62('0x15')]('\x20')));}_0x1c266b=_['pick'](_0x1c266b,_[_0x6e62('0x16')](properties[_0x6e62('0x17')]));_0x1c266b[_0x6e62('0x18')]=_0x6e62('0x19');return ami[_0x6e62('0x1a')](_0x1c266b)[_0x6e62('0x1b')](function(_0x42c2ea){_0x49be2d({'code':0xc8,'message':_0x42c2ea[_0x6e62('0x1c')]});})[_0x6e62('0x1d')](function(_0x15bce5){_0x4e7917(_0x3b5c11['error'](0x1f5,_0x15bce5[_0x6e62('0x1c')]));});});},'Command':function(_0x400bcc){var _0x55ce3b=this;return new Promise(function(_0xefbfb6,_0x4ecdff){if(ami[_0x6e62('0x10')]()==![]){return _0x4ecdff(_0x55ce3b[_0x6e62('0x11')](0x1f4,[config[_0x6e62('0x12')]['ip'],config[_0x6e62('0x12')][_0x6e62('0x13')],_0x6e62('0x14')][_0x6e62('0x15')]('\x20')));}_0x400bcc=_[_0x6e62('0x1e')](_0x400bcc,_0x6e62('0x1f'));_0x400bcc[_0x6e62('0x18')]=_0x6e62('0x20');return ami['Action'](_0x400bcc)[_0x6e62('0x1b')](function(_0x52d5e7){_0xefbfb6({'code':0xc8,'message':_0x52d5e7[_0x6e62('0x21')]});})[_0x6e62('0x1d')](function(_0x345af8){_0x4ecdff(_0x55ce3b[_0x6e62('0x11')](0x1f5,_0x345af8[_0x6e62('0x1c')]));});});},'VoiceQueues':function(_0x425d1c){return new Promise(function(_0x4373b5,_0x3a1683){var _0x2e4fe1=[];for(var _0x448691 in _0x4d4816['voiceQueues']){if(_0x4d4816[_0x6e62('0x22')]['hasOwnProperty'](_0x448691)){var _0x2f9c68=_0x4d4816[_0x6e62('0x22')][_0x448691];var _0x318fc3={'id':_0x2f9c68['id'],'name':_0x2f9c68[_0x6e62('0x23')],'strategy':_0x2f9c68[_0x6e62('0x24')],'answered':_0x2f9c68[_0x6e62('0x25')],'available':_0x2f9c68['available'],'loggedIn':_0x2f9c68[_0x6e62('0x26')],'pTalking':_0x2f9c68[_0x6e62('0x27')],'sumBillable':_0x2f9c68[_0x6e62('0x28')],'sumDuration':_0x2f9c68['sumDuration'],'sumHoldTime':_0x2f9c68['sumHoldTime']||0x0,'talking':_0x2f9c68[_0x6e62('0x29')],'total':_0x2f9c68['total'],'type':_0x2f9c68['type'],'unmanaged':_0x2f9c68['unmanaged'],'abandoned':_0x2f9c68['abandoned'],'waiting':_0x2f9c68[_0x6e62('0x2a')],'loggedInDb':_0x2f9c68['loggedInDb']};if(_0x2f9c68[_0x6e62('0x2b')]==='outbound'){_0x318fc3[_0x6e62('0x2c')]=_0x2f9c68[_0x6e62('0x2c')];_0x318fc3[_0x6e62('0x2d')]=_0x2f9c68['dialMethod'];_0x318fc3['dialOriginateCallerIdName']=_0x2f9c68[_0x6e62('0x2e')];_0x318fc3[_0x6e62('0x2f')]=_0x2f9c68['dialOriginateCallerIdNumber'];_0x318fc3['dialOriginateTimeout']=_0x2f9c68['dialOriginateTimeout'];_0x318fc3[_0x6e62('0x30')]=_0x2f9c68['dialPrefix'];_0x318fc3[_0x6e62('0x31')]=_0x2f9c68[_0x6e62('0x31')];_0x318fc3[_0x6e62('0x32')]=_0x2f9c68[_0x6e62('0x32')];_0x318fc3[_0x6e62('0x33')]=_0x2f9c68['outboundAnswerCallsDay'];_0x318fc3['outboundBlacklistCallsDay']=_0x2f9c68[_0x6e62('0x34')];_0x318fc3[_0x6e62('0x35')]=_0x2f9c68[_0x6e62('0x35')];_0x318fc3[_0x6e62('0x36')]=_0x2f9c68[_0x6e62('0x36')];_0x318fc3[_0x6e62('0x37')]=_0x2f9c68[_0x6e62('0x37')];_0x318fc3[_0x6e62('0x38')]=_0x2f9c68[_0x6e62('0x38')];_0x318fc3['outboundDropCallsDayTimeout']=_0x2f9c68[_0x6e62('0x39')];_0x318fc3[_0x6e62('0x3a')]=_0x2f9c68[_0x6e62('0x3a')];_0x318fc3['outboundNoSuchCallsDay']=_0x2f9c68[_0x6e62('0x3b')];_0x318fc3[_0x6e62('0x3c')]=_0x2f9c68['outboundOriginateFailureCallsDay'];_0x318fc3[_0x6e62('0x3d')]=_0x2f9c68[_0x6e62('0x3d')];_0x318fc3[_0x6e62('0x3e')]=_0x2f9c68[_0x6e62('0x3e')];_0x318fc3[_0x6e62('0x3f')]=_0x2f9c68['outboundUnknownCallsDay'];_0x318fc3[_0x6e62('0x40')]=_0x2f9c68[_0x6e62('0x40')];_0x318fc3[_0x6e62('0x41')]=_0x2f9c68[_0x6e62('0x41')];_0x318fc3[_0x6e62('0x42')]=_0x2f9c68['predictiveIntervalAvgTalktime'];_0x318fc3[_0x6e62('0x43')]=_0x2f9c68[_0x6e62('0x43')];_0x318fc3[_0x6e62('0x44')]=_0x2f9c68['predictiveIntervalDroppedCallsTimeout'];_0x318fc3[_0x6e62('0x45')]=_0x2f9c68[_0x6e62('0x45')];_0x318fc3['predictiveIntervalErlangCallsDroppedCalls']=_0x2f9c68['predictiveIntervalErlangCallsDroppedCalls'];_0x318fc3[_0x6e62('0x46')]=_0x2f9c68[_0x6e62('0x46')];_0x318fc3[_0x6e62('0x47')]=_0x2f9c68['predictiveIntervalMultiplicativeFactor'];_0x318fc3['predictiveIntervalPauses']=_0x2f9c68[_0x6e62('0x48')];_0x318fc3['predictiveIntervalAvailable']=_0x2f9c68['predictiveIntervalAvailable'];_0x318fc3[_0x6e62('0x49')]=_0x2f9c68[_0x6e62('0x49')];_0x318fc3[_0x6e62('0x1c')]=_0x2f9c68[_0x6e62('0x1c')];_0x318fc3[_0x6e62('0x4a')]=_0x2f9c68['originated'];_0x318fc3[_0x6e62('0x4b')]=_0x2f9c68['erlangCalls'];_0x318fc3['erlangCallToSecond']=_0x2f9c68[_0x6e62('0x4c')];_0x318fc3[_0x6e62('0x4d')]=_0x2f9c68[_0x6e62('0x4d')];_0x318fc3['erlangBusyFactor']=_0x2f9c68[_0x6e62('0x4e')];_0x318fc3['startPredictive']=_0x2f9c68[_0x6e62('0x4f')];_0x318fc3[_0x6e62('0x50')]=_0x2f9c68[_0x6e62('0x50')];}if(_0x2f9c68[_0x6e62('0x51')]){_0x318fc3[_0x6e62('0x51')]={'id':_0x2f9c68[_0x6e62('0x51')]['id'],'name':_0x2f9c68[_0x6e62('0x51')][_0x6e62('0x23')],'active':_0x2f9c68[_0x6e62('0x51')][_0x6e62('0x52')],'callerid':_0x2f9c68['Trunk']['callerid']};}if(_0x2f9c68['Interval']){_0x318fc3[_0x6e62('0x53')]={'id':_0x2f9c68['Interval']['id'],'name':_0x2f9c68[_0x6e62('0x53')][_0x6e62('0x23')]};}_0x2e4fe1['push'](_0x318fc3);}}_0x4373b5({'count':_0x2e4fe1[_0x6e62('0x54')],'rows':_0x2e4fe1});});},'UpdateVoiceQueue':function(_0x10c992){return new Promise(function(_0x223c3b,_0x2efc75){var _0x11cd3b=_[_0x6e62('0x55')](_0x4d4816[_0x6e62('0x22')],{'id':parseInt(_0x10c992['id'])});var _0x22f217=_[_0x6e62('0x56')](_0x10c992,['id']);if(_0x11cd3b){for(var _0x7e251d in _0x22f217){if(typeof _0x22f217[_0x7e251d]!==_0x6e62('0x57')&&typeof _0x11cd3b[_0x7e251d]!==_0x6e62('0x57')){_0x11cd3b[_0x7e251d]=_0x22f217[_0x7e251d];}}_0x223c3b(_0x11cd3b);}else{_0x2efc75();}});},'VoiceChannels':function(_0x7c26d2){return new Promise(function(_0x5efc0c,_0x419fab){var _0x158c75=_['values'](_0x4d4816[_0x6e62('0x58')]);_0x5efc0c({'count':_0x158c75['length'],'rows':_0x158c75});});},'VoiceChannelMixMonitor':function(_0x45da05){var _0x1aaec8=this;return new Promise(function(_0x34d642,_0x5ca4eb){if(ami[_0x6e62('0x10')]()==![]){return _0x5ca4eb(_0x1aaec8[_0x6e62('0x11')](0x1f4,[config[_0x6e62('0x12')]['ip'],config[_0x6e62('0x12')][_0x6e62('0x13')],_0x6e62('0x14')][_0x6e62('0x15')]('\x20')));}var _0x315ed4=schema(properties[_0x6e62('0x59')])[_0x6e62('0x3')](_0x45da05);if(_0x315ed4[_0x6e62('0x54')]>0x0){return _0x5ca4eb(_0x1aaec8['error'](0x1f4,_['map'](_0x315ed4,_0x6e62('0x1c'))[_0x6e62('0x15')](',\x20')));}var _0x168992=_[_0x6e62('0x55')](_0x4d4816[_0x6e62('0x58')],{'uniqueid':_0x45da05[_0x6e62('0x5a')]});if(_0x168992&&_0x168992['channel']){var _0x19a7e9=util['format'](_0x6e62('0x5b'),_0x45da05[_0x6e62('0x5c')]||_0x45da05[_0x6e62('0x5a')],_0x45da05[_0x6e62('0x5d')]||_0x6e62('0x5e'));return ami['Action']({'action':_0x6e62('0x5f'),'channel':_0x168992[_0x6e62('0x60')],'file':_0x19a7e9,'options':_0x6e62('0x61')})[_0x6e62('0x1b')](function(_0x5378b5){var _0x2aa82d=_['find'](_0x168992[_0x6e62('0x62')],{'filename':_0x6e62('0x63')+_0x19a7e9[_0x6e62('0x64')]()});if(_[_0x6e62('0x65')](_0x2aa82d)){_0x168992[_0x6e62('0x62')][_0x6e62('0x66')]({'filename':_0x6e62('0x63')+_0x19a7e9['toLowerCase'](),'createdAt':moment()[_0x6e62('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5378b5[_0x6e62('0x67')],'status':_0x6e62('0x68')});}else{_0x2aa82d[_0x6e62('0x67')]=_0x5378b5[_0x6e62('0x67')];_0x2aa82d[_0x6e62('0x69')]='rec';}_0x34d642({'code':0xc8,'message':[_0x45da05[_0x6e62('0x5a')],'MixMonitor\x20Success',_0x5378b5[_0x6e62('0x67')]][_0x6e62('0x15')]('\x20'),'mixmonitorid':_0x5378b5[_0x6e62('0x67')]});})['catch'](function(_0x577eb4){_0x5ca4eb(_0x1aaec8[_0x6e62('0x11')](0x1f5,[_0x45da05['uniqueid'],_0x577eb4[_0x6e62('0x1c')]['toLowerCase']()][_0x6e62('0x15')]('\x20')));});}else{return _0x5ca4eb(_0x1aaec8['error'](0x1f5,_0x6e62('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0xb19995){var _0x5f2d00=this;return new Promise(function(_0x1226ce,_0x2f4f20){if(ami['isConnected']()==![]){return _0x2f4f20(_0x5f2d00['error'](0x1f4,[config[_0x6e62('0x12')]['ip'],config[_0x6e62('0x12')][_0x6e62('0x13')],_0x6e62('0x14')][_0x6e62('0x15')]('\x20')));}var _0x1eb6e8=schema(properties[_0x6e62('0x59')])['validate'](_0xb19995);if(_0x1eb6e8[_0x6e62('0x54')]>0x0){return _0x2f4f20(_0x5f2d00[_0x6e62('0x11')](0x1f4,_[_0x6e62('0x6b')](_0x1eb6e8,_0x6e62('0x1c'))[_0x6e62('0x15')](',\x20')));}var _0x492ffd=_[_0x6e62('0x55')](_0x4d4816[_0x6e62('0x58')],{'uniqueid':_0xb19995['uniqueid']});if(_0x492ffd){return BPromise[_0x6e62('0x6c')]()[_0x6e62('0x1b')](function(){if(_0x492ffd[_0x6e62('0x60')]){return ami[_0x6e62('0x1a')]({'action':_0x6e62('0x6d'),'channel':_0x492ffd['channel'],'mixmonitorid':_0xb19995[_0x6e62('0x67')]})[_0x6e62('0x1d')](function(_0x28435b){});}})['then'](function(){if(_0x492ffd[_0x6e62('0x6e')]){return ami[_0x6e62('0x1a')]({'action':'StopMixMonitor','channel':_0x492ffd[_0x6e62('0x6e')],'mixmonitorid':_0xb19995['mixmonitorid']})[_0x6e62('0x1d')](function(_0xb22e54){});}})[_0x6e62('0x1b')](function(_0x5db78e){var _0x58e9bd=_[_0x6e62('0x55')](_0x492ffd[_0x6e62('0x62')],{'mixmonitorid':_0xb19995[_0x6e62('0x67')]});if(_0x58e9bd){_0x58e9bd[_0x6e62('0x69')]=_0x6e62('0x6f');}})[_0x6e62('0x1b')](function(){var _0x1a778a=util[_0x6e62('0x5d')]('%s.%s',_0xb19995[_0x6e62('0x5c')]||_0xb19995[_0x6e62('0x5a')],_0xb19995['format']||_0x6e62('0x5e'));var _0x4a079d=_[_0x6e62('0x55')](_0x492ffd[_0x6e62('0x62')],{'filename':_0x6e62('0x63')+_0x1a778a[_0x6e62('0x64')]()});if(_0x4a079d){_0x4a079d['status']='stop';}})[_0x6e62('0x1b')](function(){_0x1226ce({'code':0xc8,'message':[_0xb19995[_0x6e62('0x5a')],_0x6e62('0x70')][_0x6e62('0x15')]('\x20')});})[_0x6e62('0x1d')](function(_0x60b516){_0x2f4f20(_0x5f2d00[_0x6e62('0x11')](0x1f5,[_0xb19995[_0x6e62('0x5a')],_0x60b516['message'][_0x6e62('0x64')]()][_0x6e62('0x15')]('\x20')));});}else{return _0x2f4f20(_0x5f2d00[_0x6e62('0x11')](0x1f5,_0x6e62('0x6a')));}});},'VoiceQueuesChannels':function(_0x1685c4){return new Promise(function(_0x8ff2c0,_0x3268e2){var _0x37816e=_[_0x6e62('0x71')](_0x4d4816['queueChannels']);_0x8ff2c0({'count':_0x37816e[_0x6e62('0x54')],'rows':_0x37816e});});},'VoiceQueuesChannel':function(_0x256993){var _0x3ddc7f=this;return new Promise(function(_0x8b84d7,_0xeb5195){var _0x3937b3=schema(properties[_0x6e62('0x72')])[_0x6e62('0x3')](_0x256993);if(_0x3937b3[_0x6e62('0x54')]>0x0){return _0xeb5195(_0x3ddc7f[_0x6e62('0x11')](0x1f4,_[_0x6e62('0x6b')](_0x3937b3,_0x6e62('0x1c'))[_0x6e62('0x15')](',\x20')));}var _0x3be758=_[_0x6e62('0x55')](_0x4d4816[_0x6e62('0x73')],{'uniqueid':_0x256993[_0x6e62('0x5a')]});if(_0x3be758){_0x8b84d7(_0x3be758);}else{return _0xeb5195(_0x3ddc7f['error'](0x1f5,_0x6e62('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x174f93){var _0x2c11e4=this;return new Promise(function(_0x256608,_0x53684f){if(ami[_0x6e62('0x10')]()==![]){return _0x53684f(_0x2c11e4[_0x6e62('0x11')](0x1f4,[config[_0x6e62('0x12')]['ip'],config['asterisk'][_0x6e62('0x13')],_0x6e62('0x14')][_0x6e62('0x15')]('\x20')));}var _0x1fd508=schema(properties['voicequeuechannelhangup'])[_0x6e62('0x3')](_0x174f93);if(_0x1fd508[_0x6e62('0x54')]>0x0){return _0x53684f(_0x2c11e4[_0x6e62('0x11')](0x1f4,_[_0x6e62('0x6b')](_0x1fd508,_0x6e62('0x1c'))[_0x6e62('0x15')](',\x20')));}var _0x1e7420=_[_0x6e62('0x55')](_0x4d4816[_0x6e62('0x73')],{'uniqueid':_0x174f93[_0x6e62('0x5a')]});if(_0x1e7420&&_0x1e7420[_0x6e62('0x60')]){return ami[_0x6e62('0x1a')]({'action':_0x6e62('0x74'),'channel':_0x1e7420[_0x6e62('0x60')]})['then'](function(_0xf25da3){_0x256608({'code':0xc8,'message':[_0x174f93[_0x6e62('0x5a')],_0xf25da3[_0x6e62('0x1c')][_0x6e62('0x64')]()][_0x6e62('0x15')]('\x20')});})[_0x6e62('0x1d')](function(_0x451dd1){_0x53684f(_0x2c11e4[_0x6e62('0x11')](0x1f5,[_0x174f93['uniqueid'],_0x451dd1[_0x6e62('0x1c')][_0x6e62('0x64')]()][_0x6e62('0x15')]('\x20')));});}else{return _0x53684f(_0x2c11e4[_0x6e62('0x11')](0x1f5,_0x6e62('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x2f6e7c){var _0x4066aa=this;return new Promise(function(_0x489e44,_0x45319f){if(ami[_0x6e62('0x10')]()==![]){return _0x45319f(_0x4066aa[_0x6e62('0x11')](0x1f4,[config[_0x6e62('0x12')]['ip'],config[_0x6e62('0x12')][_0x6e62('0x13')],_0x6e62('0x14')][_0x6e62('0x15')]('\x20')));}var _0x2034bf=schema(properties[_0x6e62('0x75')])[_0x6e62('0x3')](_0x2f6e7c);if(_0x2034bf[_0x6e62('0x54')]>0x0){return _0x45319f(_0x4066aa[_0x6e62('0x11')](0x1f4,_[_0x6e62('0x6b')](_0x2034bf,_0x6e62('0x1c'))[_0x6e62('0x15')](',\x20')));}var _0x4577c0=_[_0x6e62('0x55')](_0x4d4816['queueChannels'],{'uniqueid':_0x2f6e7c[_0x6e62('0x5a')]});if(_0x4577c0&&_0x4577c0[_0x6e62('0x60')]){return ami[_0x6e62('0x1a')]({'action':_0x6e62('0x76'),'channel':_0x4577c0[_0x6e62('0x60')],'exten':_0x2f6e7c[_0x6e62('0x77')],'context':_0x2f6e7c['context']||_0x4577c0[_0x6e62('0x78')],'priority':0x1})[_0x6e62('0x1b')](function(_0x518213){_0x489e44({'code':0xc8,'message':[_0x2f6e7c[_0x6e62('0x5a')],_0x518213['message']['toLowerCase']()][_0x6e62('0x15')]('\x20')});})[_0x6e62('0x1d')](function(_0x14b2a7){_0x45319f(_0x4066aa[_0x6e62('0x11')](0x1f5,[_0x2f6e7c['uniqueid'],_0x14b2a7[_0x6e62('0x1c')][_0x6e62('0x64')]()][_0x6e62('0x15')]('\x20')));});}else{return _0x45319f(_0x4066aa[_0x6e62('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x320981){return new Promise(function(_0x374d33,_0x44747a){var _0x5cfbb9=_[_0x6e62('0x71')](_0x4d4816['agents']);_0x374d33({'count':_0x5cfbb9['length'],'rows':_0x5cfbb9});});},'Telephones':function(_0x35beef){return new Promise(function(_0x3b1917,_0x129eca){var _0x5368de=_['values'](_0x4d4816[_0x6e62('0x79')]);_0x3b1917({'count':_0x5368de[_0x6e62('0x54')],'rows':_0x5368de});});},'Trunks':function(_0x15c205){return new Promise(function(_0x38a760,_0x28d430){var _0x54ee57=_[_0x6e62('0x71')](_0x4d4816[_0x6e62('0x7a')]);_0x38a760({'count':_0x54ee57[_0x6e62('0x54')],'rows':_0x54ee57});});},'OutboundChannels':function(_0x1c7688){return new Promise(function(_0x5cc806,_0x48e7b7){var _0x8f326e=_[_0x6e62('0x71')](_0x4d4816['outboundChannels']);_0x5cc806({'count':_0x8f326e['length'],'rows':_0x8f326e});});},'Outbound':function(_0x3eb4a1){return new Promise(function(_0x2fb04e,_0x346cd6){_0x2fb04e(_0x4d4816[_0x6e62('0x7b')]);});},'Campaigns':function(_0x102e42){return new Promise(function(_0x288955,_0x431bdd){var _0x1ac390=_[_0x6e62('0x71')](_0x4d4816['campaigns']);_0x288955({'count':_0x1ac390[_0x6e62('0x54')],'rows':_0x1ac390});});},'VoiceQueuesPreview':function(_0x1ee1f9){var _0x1e753b=this;return new Promise(function(_0x5ae85e,_0x1efc4c){_0x5f25a3['run'](_0x1ee1f9['id'])[_0x6e62('0x1b')](function(_0x258314){_0x5ae85e({'code':0xc8,'message':_0x258314['message']});})[_0x6e62('0x1d')](function(_0x19879c){_0x1efc4c(_0x1e753b[_0x6e62('0x11')](0x1f4,_0x19879c[_0x6e62('0x1c')]));});});},'EventManager':function(_0x25d318){var _0x35f31b=this;return new Promise(function(_0x162750,_0x519e98){if(!_0x25d318['event']){return _0x519e98(_0x35f31b[_0x6e62('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x6e62('0x7c')](_0x6e62('0x7d')+_0x25d318['event'],_0x25d318[_0x6e62('0x1c')]);_0x162750({'code':0xc8,'message':_0x25d318});});},'FaxAccounts':function(_0x4cf02a){return new Promise(function(_0xc63c1a,_0x567624){var _0x334092=_['values'](_0x4d4816[_0x6e62('0x7e')]);_0xc63c1a({'count':_0x334092[_0x6e62('0x54')],'rows':_0x334092});});},'SendFax':function(_0x454f23){var _0x47745e=this;return new Promise(function(_0x45f361,_0x5ce958){_0x4a778d[_0x6e62('0x7f')](_0x454f23)[_0x6e62('0x1b')](function(_0x14df12){_0x45f361({'code':0xc8,'message':_0x14df12[_0x6e62('0x1c')]});})[_0x6e62('0x1d')](function(_0x2049e4){_0x5ce958(_0x47745e[_0x6e62('0x11')](0x1f4,_0x2049e4[_0x6e62('0x1c')]));});});},'CheckAfterSend':function(_0x7fa90b){var _0x4767b1=this;return new Promise(function(_0x1f7b9d,_0x5706a9){_0x4a778d[_0x6e62('0x80')](_0x7fa90b)[_0x6e62('0x1b')](function(_0x52c724){_0x1f7b9d({'code':0xc8,'message':_0x52c724['message']});})['catch'](function(_0xaa43f){_0x5706a9(_0x4767b1[_0x6e62('0x11')](0x1f4,_0xaa43f[_0x6e62('0x1c')]));});});}};var _0x40d958=jayson['server'](_0x55165e)['http']();_0x40d958['on'](_0x6e62('0x11'),function(_0x22cfd7){return _0x157047(_0x22cfd7);});_0x40d958[_0x6e62('0x8')](0x232a,_0x6e62('0x81'),function(){console[_0x6e62('0x82')](_0x6e62('0x83'),0x232a);return _0x2ee927(_0x6e62('0x84')+0x232a);});});}; \ No newline at end of file +var _0x5430=['%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','ami\x20disconnected','join','pick','keys','module','Reload','Action','then','message','catch','isConnected','username','command','action','Command','voiceQueues','hasOwnProperty','name','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../ami','format'];(function(_0x5dd6b3,_0x53c8ed){var _0xb616a9=function(_0x1f5786){while(--_0x1f5786){_0x5dd6b3['push'](_0x5dd6b3['shift']());}};_0xb616a9(++_0x53c8ed);}(_0x5430,0x10c));var _0x0543=function(_0x326c8d,_0x61f529){_0x326c8d=_0x326c8d-0x0;var _0x3e8188=_0x5430[_0x326c8d];return _0x3e8188;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var jayson=require(_0x0543('0x2'));var schema=require(_0x0543('0x3'));var BPromise=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x0543('0x6'));exports['listen']=function(_0x523f3d,_0xce0b65,_0x45b909){return new BPromise(function(_0x9754ba,_0x319568){var _0x46bca7={'QueuePause':function(_0x5ac352){return new Promise(function(_0x372974,_0x7b8280){var _0x2955ea=util[_0x0543('0x7')](_0x0543('0x8'),_0x0543('0x9'),_0x5ac352['name']);if(_0x523f3d[_0x0543('0xa')]&&_0x523f3d[_0x0543('0xa')][_0x2955ea]&&_0x523f3d['timers'][_0x2955ea][_0x0543('0xb')]){_0x523f3d[_0x0543('0xa')][_0x2955ea][_0x0543('0xc')]();}if(_0x523f3d[_0x0543('0xd')][_0x2955ea]){_0x523f3d[_0x0543('0xd')][_0x2955ea][_0x0543('0xe')]({'statePause':_0x5ac352[_0x0543('0xf')]?!![]:![]});}_0x372974({'code':0xc8,'message':_0x0543('0x10')});});},'Reload':function(_0x46d176){var _0x430b4f=this;return new Promise(function(_0x4204db,_0x509afa){if(ami['isConnected']()==![]){return _0x509afa(_0x430b4f[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config['asterisk']['username'],_0x0543('0x13')][_0x0543('0x14')]('\x20')));}_0x46d176=_[_0x0543('0x15')](_0x46d176,_[_0x0543('0x16')](properties[_0x0543('0x17')]));_0x46d176['action']=_0x0543('0x18');return ami[_0x0543('0x19')](_0x46d176)[_0x0543('0x1a')](function(_0x25254e){_0x4204db({'code':0xc8,'message':_0x25254e[_0x0543('0x1b')]});})[_0x0543('0x1c')](function(_0x577cf0){_0x509afa(_0x430b4f['error'](0x1f5,_0x577cf0[_0x0543('0x1b')]));});});},'Command':function(_0x5362cb){var _0x50ea84=this;return new Promise(function(_0xbb8816,_0x419913){if(ami[_0x0543('0x1d')]()==![]){return _0x419913(_0x50ea84['error'](0x1f4,[config[_0x0543('0x12')]['ip'],config['asterisk'][_0x0543('0x1e')],_0x0543('0x13')]['join']('\x20')));}_0x5362cb=_[_0x0543('0x15')](_0x5362cb,_0x0543('0x1f'));_0x5362cb[_0x0543('0x20')]=_0x0543('0x21');return ami[_0x0543('0x19')](_0x5362cb)[_0x0543('0x1a')](function(_0x4adba7){_0xbb8816({'code':0xc8,'message':_0x4adba7['content']});})['catch'](function(_0xbfe5dc){_0x419913(_0x50ea84[_0x0543('0x11')](0x1f5,_0xbfe5dc[_0x0543('0x1b')]));});});},'VoiceQueues':function(_0xaf1c0e){return new Promise(function(_0x2b1425,_0x26e500){var _0x36d824=[];for(var _0x17a3de in _0x523f3d[_0x0543('0x22')]){if(_0x523f3d[_0x0543('0x22')][_0x0543('0x23')](_0x17a3de)){var _0x21fc63=_0x523f3d['voiceQueues'][_0x17a3de];var _0x25e6f1={'id':_0x21fc63['id'],'name':_0x21fc63[_0x0543('0x24')],'strategy':_0x21fc63[_0x0543('0x25')],'answered':_0x21fc63['answered'],'available':_0x21fc63[_0x0543('0x26')],'loggedIn':_0x21fc63[_0x0543('0x27')],'pTalking':_0x21fc63[_0x0543('0x28')],'sumBillable':_0x21fc63[_0x0543('0x29')],'sumDuration':_0x21fc63['sumDuration'],'sumHoldTime':_0x21fc63[_0x0543('0x2a')]||0x0,'talking':_0x21fc63[_0x0543('0x2b')],'total':_0x21fc63['total'],'type':_0x21fc63['type'],'unmanaged':_0x21fc63[_0x0543('0x2c')],'abandoned':_0x21fc63[_0x0543('0x2d')],'waiting':_0x21fc63['waiting'],'loggedInDb':_0x21fc63[_0x0543('0x2e')]};if(_0x21fc63[_0x0543('0x2f')]===_0x0543('0x30')){_0x25e6f1[_0x0543('0x31')]=_0x21fc63[_0x0543('0x31')];_0x25e6f1[_0x0543('0x32')]=_0x21fc63[_0x0543('0x32')];_0x25e6f1['dialOriginateCallerIdName']=_0x21fc63[_0x0543('0x33')];_0x25e6f1['dialOriginateCallerIdNumber']=_0x21fc63[_0x0543('0x34')];_0x25e6f1[_0x0543('0x35')]=_0x21fc63[_0x0543('0x35')];_0x25e6f1[_0x0543('0x36')]=_0x21fc63[_0x0543('0x36')];_0x25e6f1['temp']=_0x21fc63[_0x0543('0x37')];_0x25e6f1['outboundAnswerAgiCallsDay']=_0x21fc63[_0x0543('0x38')];_0x25e6f1[_0x0543('0x39')]=_0x21fc63[_0x0543('0x39')];_0x25e6f1[_0x0543('0x3a')]=_0x21fc63['outboundBlacklistCallsDay'];_0x25e6f1[_0x0543('0x3b')]=_0x21fc63['outboundBusyCallsDay'];_0x25e6f1[_0x0543('0x3c')]=_0x21fc63[_0x0543('0x3c')];_0x25e6f1[_0x0543('0x3d')]=_0x21fc63[_0x0543('0x3d')];_0x25e6f1[_0x0543('0x3e')]=_0x21fc63[_0x0543('0x3e')];_0x25e6f1[_0x0543('0x3f')]=_0x21fc63[_0x0543('0x3f')];_0x25e6f1[_0x0543('0x40')]=_0x21fc63[_0x0543('0x40')];_0x25e6f1['outboundNoSuchCallsDay']=_0x21fc63[_0x0543('0x41')];_0x25e6f1[_0x0543('0x42')]=_0x21fc63['outboundOriginateFailureCallsDay'];_0x25e6f1[_0x0543('0x43')]=_0x21fc63['outboundReCallsDay'];_0x25e6f1[_0x0543('0x44')]=_0x21fc63[_0x0543('0x44')];_0x25e6f1['outboundUnknownCallsDay']=_0x21fc63['outboundUnknownCallsDay'];_0x25e6f1[_0x0543('0x45')]=_0x21fc63[_0x0543('0x45')];_0x25e6f1['predictiveIntervalAvgHoldtime']=_0x21fc63[_0x0543('0x46')];_0x25e6f1[_0x0543('0x47')]=_0x21fc63['predictiveIntervalAvgTalktime'];_0x25e6f1[_0x0543('0x48')]=_0x21fc63[_0x0543('0x48')];_0x25e6f1[_0x0543('0x49')]=_0x21fc63[_0x0543('0x49')];_0x25e6f1[_0x0543('0x4a')]=_0x21fc63['predictiveIntervalErlangCalls'];_0x25e6f1['predictiveIntervalErlangCallsDroppedCalls']=_0x21fc63['predictiveIntervalErlangCallsDroppedCalls'];_0x25e6f1[_0x0543('0x4b')]=_0x21fc63[_0x0543('0x4b')];_0x25e6f1[_0x0543('0x4c')]=_0x21fc63[_0x0543('0x4c')];_0x25e6f1['predictiveIntervalPauses']=_0x21fc63[_0x0543('0x4d')];_0x25e6f1[_0x0543('0x4e')]=_0x21fc63[_0x0543('0x4e')];_0x25e6f1[_0x0543('0x4f')]=_0x21fc63[_0x0543('0x4f')];_0x25e6f1[_0x0543('0x1b')]=_0x21fc63[_0x0543('0x1b')];_0x25e6f1['originated']=_0x21fc63[_0x0543('0x50')];_0x25e6f1[_0x0543('0x51')]=_0x21fc63[_0x0543('0x51')];_0x25e6f1[_0x0543('0x52')]=_0x21fc63[_0x0543('0x52')];_0x25e6f1[_0x0543('0x53')]=_0x21fc63['erlangAbandonmentRate'];_0x25e6f1['erlangBusyFactor']=_0x21fc63[_0x0543('0x54')];_0x25e6f1[_0x0543('0x55')]=_0x21fc63[_0x0543('0x55')];_0x25e6f1[_0x0543('0x56')]=_0x21fc63[_0x0543('0x56')];}if(_0x21fc63[_0x0543('0x57')]){_0x25e6f1[_0x0543('0x57')]={'id':_0x21fc63[_0x0543('0x57')]['id'],'name':_0x21fc63[_0x0543('0x57')]['name'],'active':_0x21fc63['Trunk'][_0x0543('0x58')],'callerid':_0x21fc63[_0x0543('0x57')]['callerid']};}if(_0x21fc63['Interval']){_0x25e6f1[_0x0543('0x59')]={'id':_0x21fc63[_0x0543('0x59')]['id'],'name':_0x21fc63['Interval'][_0x0543('0x24')]};}_0x36d824['push'](_0x25e6f1);}}_0x2b1425({'count':_0x36d824[_0x0543('0x5a')],'rows':_0x36d824});});},'UpdateVoiceQueue':function(_0x3e723a){return new Promise(function(_0x4c412b,_0x5e2511){var _0xd95442=_['find'](_0x523f3d[_0x0543('0x22')],{'id':parseInt(_0x3e723a['id'])});var _0x40b2ac=_[_0x0543('0x5b')](_0x3e723a,['id']);if(_0xd95442){for(var _0x270ce0 in _0x40b2ac){if(typeof _0x40b2ac[_0x270ce0]!==_0x0543('0x5c')&&typeof _0xd95442[_0x270ce0]!==_0x0543('0x5c')){_0xd95442[_0x270ce0]=_0x40b2ac[_0x270ce0];}}_0x4c412b(_0xd95442);}else{_0x5e2511();}});},'VoiceChannels':function(_0x5a28a3){return new Promise(function(_0x4236b7,_0x21268c){var _0xb8076c=_[_0x0543('0x5d')](_0x523f3d[_0x0543('0x5e')]);_0x4236b7({'count':_0xb8076c['length'],'rows':_0xb8076c});});},'VoiceChannelMixMonitor':function(_0x29840e){var _0x4e4b75=this;return new Promise(function(_0x183bef,_0x3e8c64){if(ami[_0x0543('0x1d')]()==![]){return _0x3e8c64(_0x4e4b75[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config[_0x0543('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0xc832e2=schema(properties[_0x0543('0x5f')])['validate'](_0x29840e);if(_0xc832e2[_0x0543('0x5a')]>0x0){return _0x3e8c64(_0x4e4b75[_0x0543('0x11')](0x1f4,_[_0x0543('0x60')](_0xc832e2,_0x0543('0x1b'))[_0x0543('0x14')](',\x20')));}var _0x4038a6=_['find'](_0x523f3d[_0x0543('0x5e')],{'uniqueid':_0x29840e[_0x0543('0x61')]});if(_0x4038a6&&_0x4038a6[_0x0543('0x62')]){var _0x416ae0=util[_0x0543('0x7')](_0x0543('0x63'),_0x29840e[_0x0543('0x64')]||_0x29840e[_0x0543('0x61')],_0x29840e[_0x0543('0x7')]||_0x0543('0x65'));return ami[_0x0543('0x19')]({'action':_0x0543('0x66'),'channel':_0x4038a6[_0x0543('0x62')],'file':_0x416ae0,'options':_0x0543('0x67')})['then'](function(_0x14358d){var _0x3c5acc=_[_0x0543('0x68')](_0x4038a6[_0x0543('0x69')],{'filename':_0x0543('0x6a')+_0x416ae0[_0x0543('0x6b')]()});if(_[_0x0543('0x6c')](_0x3c5acc)){_0x4038a6[_0x0543('0x69')][_0x0543('0x6d')]({'filename':_0x0543('0x6a')+_0x416ae0[_0x0543('0x6b')](),'createdAt':moment()[_0x0543('0x7')](_0x0543('0x6e')),'mixmonitorid':_0x14358d[_0x0543('0x6f')],'status':_0x0543('0x70')});}else{_0x3c5acc['mixmonitorid']=_0x14358d[_0x0543('0x6f')];_0x3c5acc[_0x0543('0x71')]='rec';}_0x183bef({'code':0xc8,'message':[_0x29840e[_0x0543('0x61')],_0x0543('0x72'),_0x14358d[_0x0543('0x6f')]]['join']('\x20'),'mixmonitorid':_0x14358d[_0x0543('0x6f')]});})['catch'](function(_0x294a38){_0x3e8c64(_0x4e4b75['error'](0x1f5,[_0x29840e[_0x0543('0x61')],_0x294a38['message'][_0x0543('0x6b')]()][_0x0543('0x14')]('\x20')));});}else{return _0x3e8c64(_0x4e4b75[_0x0543('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x117466){var _0x1a569b=this;return new Promise(function(_0x20ccee,_0xf46956){if(ami[_0x0543('0x1d')]()==![]){return _0xf46956(_0x1a569b[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config[_0x0543('0x12')][_0x0543('0x1e')],_0x0543('0x13')][_0x0543('0x14')]('\x20')));}var _0x2ff23a=schema(properties[_0x0543('0x5f')])[_0x0543('0x3')](_0x117466);if(_0x2ff23a[_0x0543('0x5a')]>0x0){return _0xf46956(_0x1a569b['error'](0x1f4,_['map'](_0x2ff23a,_0x0543('0x1b'))[_0x0543('0x14')](',\x20')));}var _0x312d6f=_[_0x0543('0x68')](_0x523f3d[_0x0543('0x5e')],{'uniqueid':_0x117466[_0x0543('0x61')]});if(_0x312d6f){return BPromise[_0x0543('0x73')]()[_0x0543('0x1a')](function(){if(_0x312d6f[_0x0543('0x62')]){return ami['Action']({'action':_0x0543('0x74'),'channel':_0x312d6f[_0x0543('0x62')],'mixmonitorid':_0x117466[_0x0543('0x6f')]})[_0x0543('0x1c')](function(_0x5d7b59){});}})[_0x0543('0x1a')](function(){if(_0x312d6f[_0x0543('0x75')]){return ami[_0x0543('0x19')]({'action':'StopMixMonitor','channel':_0x312d6f['destinationchannel'],'mixmonitorid':_0x117466[_0x0543('0x6f')]})[_0x0543('0x1c')](function(_0x1f44a3){});}})['then'](function(_0x3b9444){var _0x1dfdd7=_[_0x0543('0x68')](_0x312d6f['monitors'],{'mixmonitorid':_0x117466[_0x0543('0x6f')]});if(_0x1dfdd7){_0x1dfdd7[_0x0543('0x71')]=_0x0543('0x76');}})[_0x0543('0x1a')](function(){var _0x2cd2e9=util[_0x0543('0x7')](_0x0543('0x63'),_0x117466[_0x0543('0x64')]||_0x117466[_0x0543('0x61')],_0x117466[_0x0543('0x7')]||_0x0543('0x65'));var _0x6167e6=_[_0x0543('0x68')](_0x312d6f[_0x0543('0x69')],{'filename':'/var/spool/asterisk/monitor/'+_0x2cd2e9['toLowerCase']()});if(_0x6167e6){_0x6167e6[_0x0543('0x71')]=_0x0543('0x76');}})[_0x0543('0x1a')](function(){_0x20ccee({'code':0xc8,'message':[_0x117466[_0x0543('0x61')],'StopMixMonitor\x20Success'][_0x0543('0x14')]('\x20')});})['catch'](function(_0x1e1fc0){_0xf46956(_0x1a569b[_0x0543('0x11')](0x1f5,[_0x117466[_0x0543('0x61')],_0x1e1fc0['message']['toLowerCase']()][_0x0543('0x14')]('\x20')));});}else{return _0xf46956(_0x1a569b['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x30ee35){return new Promise(function(_0x1f26dd,_0xf32305){var _0x314c60=_[_0x0543('0x5d')](_0x523f3d[_0x0543('0x77')]);_0x1f26dd({'count':_0x314c60[_0x0543('0x5a')],'rows':_0x314c60});});},'VoiceQueuesChannel':function(_0x42f249){var _0x236c40=this;return new Promise(function(_0x55bfa5,_0x1b94de){var _0xec2838=schema(properties[_0x0543('0x78')])[_0x0543('0x3')](_0x42f249);if(_0xec2838[_0x0543('0x5a')]>0x0){return _0x1b94de(_0x236c40['error'](0x1f4,_[_0x0543('0x60')](_0xec2838,'message')[_0x0543('0x14')](',\x20')));}var _0x85a666=_[_0x0543('0x68')](_0x523f3d[_0x0543('0x77')],{'uniqueid':_0x42f249['uniqueid']});if(_0x85a666){_0x55bfa5(_0x85a666);}else{return _0x1b94de(_0x236c40[_0x0543('0x11')](0x1f5,_0x0543('0x79')));}});},'VoiceQueuesChannelHangup':function(_0x439121){var _0x534eb7=this;return new Promise(function(_0x3ae9f2,_0x4f5946){if(ami[_0x0543('0x1d')]()==![]){return _0x4f5946(_0x534eb7[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config[_0x0543('0x12')][_0x0543('0x1e')],_0x0543('0x13')]['join']('\x20')));}var _0x59f214=schema(properties['voicequeuechannelhangup'])[_0x0543('0x3')](_0x439121);if(_0x59f214[_0x0543('0x5a')]>0x0){return _0x4f5946(_0x534eb7[_0x0543('0x11')](0x1f4,_[_0x0543('0x60')](_0x59f214,_0x0543('0x1b'))[_0x0543('0x14')](',\x20')));}var _0x15a605=_[_0x0543('0x68')](_0x523f3d['queueChannels'],{'uniqueid':_0x439121['uniqueid']});if(_0x15a605&&_0x15a605[_0x0543('0x62')]){return ami[_0x0543('0x19')]({'action':'Hangup','channel':_0x15a605[_0x0543('0x62')]})['then'](function(_0x136760){_0x3ae9f2({'code':0xc8,'message':[_0x439121[_0x0543('0x61')],_0x136760[_0x0543('0x1b')][_0x0543('0x6b')]()][_0x0543('0x14')]('\x20')});})['catch'](function(_0x13c620){_0x4f5946(_0x534eb7[_0x0543('0x11')](0x1f5,[_0x439121['uniqueid'],_0x13c620[_0x0543('0x1b')][_0x0543('0x6b')]()][_0x0543('0x14')]('\x20')));});}else{return _0x4f5946(_0x534eb7['error'](0x1f5,_0x0543('0x79')));}});},'VoiceQueuesChannelRedirect':function(_0x328825){var _0x44d480=this;return new Promise(function(_0x4abf55,_0x18d597){if(ami[_0x0543('0x1d')]()==![]){return _0x18d597(_0x44d480[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config['asterisk'][_0x0543('0x1e')],_0x0543('0x13')][_0x0543('0x14')]('\x20')));}var _0x53d3ab=schema(properties[_0x0543('0x7a')])[_0x0543('0x3')](_0x328825);if(_0x53d3ab[_0x0543('0x5a')]>0x0){return _0x18d597(_0x44d480[_0x0543('0x11')](0x1f4,_[_0x0543('0x60')](_0x53d3ab,_0x0543('0x1b'))[_0x0543('0x14')](',\x20')));}var _0xffbbf2=_[_0x0543('0x68')](_0x523f3d[_0x0543('0x77')],{'uniqueid':_0x328825[_0x0543('0x61')]});if(_0xffbbf2&&_0xffbbf2[_0x0543('0x62')]){return ami[_0x0543('0x19')]({'action':'Redirect','channel':_0xffbbf2[_0x0543('0x62')],'exten':_0x328825[_0x0543('0x7b')],'context':_0x328825[_0x0543('0x7c')]||_0xffbbf2[_0x0543('0x7c')],'priority':0x1})[_0x0543('0x1a')](function(_0x768420){_0x4abf55({'code':0xc8,'message':[_0x328825[_0x0543('0x61')],_0x768420[_0x0543('0x1b')][_0x0543('0x6b')]()][_0x0543('0x14')]('\x20')});})[_0x0543('0x1c')](function(_0x4bb8ea){_0x18d597(_0x44d480[_0x0543('0x11')](0x1f5,[_0x328825[_0x0543('0x61')],_0x4bb8ea[_0x0543('0x1b')]['toLowerCase']()][_0x0543('0x14')]('\x20')));});}else{return _0x18d597(_0x44d480['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x46ab3c){return new Promise(function(_0x587f56,_0x110318){var _0xabba9a=_[_0x0543('0x5d')](_0x523f3d[_0x0543('0xd')]);_0x587f56({'count':_0xabba9a['length'],'rows':_0xabba9a});});},'Telephones':function(_0x4bc97b){return new Promise(function(_0x46dc8e,_0x1769d9){var _0x7eafcf=_['values'](_0x523f3d[_0x0543('0x7d')]);_0x46dc8e({'count':_0x7eafcf[_0x0543('0x5a')],'rows':_0x7eafcf});});},'Trunks':function(_0x4cf0ca){return new Promise(function(_0x32a641,_0x146062){var _0x5979d4=_['values'](_0x523f3d[_0x0543('0x7e')]);_0x32a641({'count':_0x5979d4[_0x0543('0x5a')],'rows':_0x5979d4});});},'OutboundChannels':function(_0x28bfe2){return new Promise(function(_0x4e4ec2,_0x32ea5d){var _0x37f54b=_[_0x0543('0x5d')](_0x523f3d['outboundChannels']);_0x4e4ec2({'count':_0x37f54b['length'],'rows':_0x37f54b});});},'Outbound':function(_0x702a00){return new Promise(function(_0xb2a557,_0xc75d33){_0xb2a557(_0x523f3d['outbound']);});},'Campaigns':function(_0x2cf198){return new Promise(function(_0x2403e1,_0x662fdb){var _0x13bd65=_[_0x0543('0x5d')](_0x523f3d[_0x0543('0x7f')]);_0x2403e1({'count':_0x13bd65[_0x0543('0x5a')],'rows':_0x13bd65});});},'VoiceQueuesPreview':function(_0x19eeb5){var _0xefa0a1=this;return new Promise(function(_0x403340,_0xa3bb00){_0xce0b65[_0x0543('0x80')](_0x19eeb5['id'])[_0x0543('0x1a')](function(_0x3d9f3d){_0x403340({'code':0xc8,'message':_0x3d9f3d[_0x0543('0x1b')]});})[_0x0543('0x1c')](function(_0x107350){_0xa3bb00(_0xefa0a1['error'](0x1f4,_0x107350[_0x0543('0x1b')]));});});},'EventManager':function(_0x6e5f4b){var _0x37c82f=this;return new Promise(function(_0x24ec36,_0x4f2319){if(!_0x6e5f4b[_0x0543('0x81')]){return _0x4f2319(_0x37c82f[_0x0543('0x11')](0x1f4,_0x0543('0x82')));}ami[_0x0543('0x83')]('custom:'+_0x6e5f4b[_0x0543('0x81')],_0x6e5f4b[_0x0543('0x1b')]);_0x24ec36({'code':0xc8,'message':_0x6e5f4b});});},'FaxAccounts':function(_0x5cc7f5){return new Promise(function(_0x1db64c,_0x24bc48){var _0x34f06a=_[_0x0543('0x5d')](_0x523f3d['faxAccounts']);_0x1db64c({'count':_0x34f06a[_0x0543('0x5a')],'rows':_0x34f06a});});},'SendFax':function(_0x35ed5f){var _0x28c5ef=this;return new Promise(function(_0x24fca2,_0x2d7617){_0x45b909['send'](_0x35ed5f)[_0x0543('0x1a')](function(_0x384548){_0x24fca2({'code':0xc8,'message':_0x384548['message']});})[_0x0543('0x1c')](function(_0x535601){_0x2d7617(_0x28c5ef[_0x0543('0x11')](0x1f4,_0x535601[_0x0543('0x1b')]));});});},'CheckAfterSend':function(_0x128f67){var _0x15df91=this;return new Promise(function(_0x566e89,_0xf70d9a){_0x45b909['checkAfterSend'](_0x128f67)[_0x0543('0x1a')](function(_0x20eec9){_0x566e89({'code':0xc8,'message':_0x20eec9[_0x0543('0x1b')]});})[_0x0543('0x1c')](function(_0x26d460){_0xf70d9a(_0x15df91[_0x0543('0x11')](0x1f4,_0x26d460[_0x0543('0x1b')]));});});}};var _0x2d1390=jayson[_0x0543('0x84')](_0x46bca7)[_0x0543('0x85')]();_0x2d1390['on'](_0x0543('0x11'),function(_0x57aa7e){return _0x319568(_0x57aa7e);});_0x2d1390[_0x0543('0x86')](0x232a,_0x0543('0x87'),function(){console[_0x0543('0x88')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x9754ba(_0x0543('0x89')+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 a1db378..7a1be8a 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 _0x008c=['defaults','localhost','socket.io-emitter','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','firstName','scheduledAt','getContacts','then','isEmpty','length','info','uniqueid','join','data4','routeId','calleridnum','destcalleridnum','calleridname','Unknown','','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis'];(function(_0x239e6d,_0x31be14){var _0x8d1bd5=function(_0x1fb85c){while(--_0x1fb85c){_0x239e6d['push'](_0x239e6d['shift']());}};_0x8d1bd5(++_0x31be14);}(_0x008c,0x188));var _0xc008=function(_0x1eeb45,_0x526bf0){_0x1eeb45=_0x1eeb45-0x0;var _0x541ed5=_0x008c[_0x1eeb45];return _0x541ed5;};'use strict';var _=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var Redis=require(_0xc008('0x2'));var util=require(_0xc008('0x3'));var config=require(_0xc008('0x4'));var logger=require('../../../../config/logger')(_0xc008('0x5'));var cmContactRpc=require(_0xc008('0x6'));config[_0xc008('0x7')]=_[_0xc008('0x8')](config[_0xc008('0x7')],{'host':_0xc008('0x9'),'port':0x18eb});var io=require(_0xc008('0xa'))(new Redis(config[_0xc008('0x7')]));function emit(_0x9c8cb2,_0x4af530,_0x428fa9,_0x5aa09b,_0x30be38){logger['info']('[CM][%s][%s]',_0x9c8cb2,_0x4af530['id'],_0x428fa9,_0x5aa09b,JSON[_0xc008('0xb')](_0x30be38));io['to'](_0x428fa9)[_0xc008('0xc')](_0x5aa09b,_0x30be38);}exports['exec']=function(_0x51ba7d,_0x543eb8,_0x1eacfa,_0xc881aa){var _0x5b2004,_0xae2dab;var _0x332fd4={};var _0x2ea200=Number(_0x1eacfa[_0xc008('0xd')]);var _0x9ffa93=_0x1eacfa[_0xc008('0xe')]?Boolean(Number(_0x1eacfa[_0xc008('0xe')])):![];var _0x593f7a;var _0x560e28=![];if(!_[_0xc008('0xf')](_0x1eacfa['data5'])){if(_0x1eacfa[_0xc008('0x10')]=='1')_0x560e28=!![];}if(!_0x560e28){if(_0xc881aa[_0xc008('0x11')]){_0x332fd4['id']=_0xc881aa[_0xc008('0x11')];}}if(!_0x332fd4['id']){_0x332fd4[_0xc008('0x12')]=_0x2ea200;_0x593f7a=_0x1eacfa[_0xc008('0x13')]&&_0x1eacfa['data3']!=='0'?_0x1eacfa['data3']['split'](','):[_0xc008('0x14')];_0x332fd4[_0xc008('0x15')]=_[_0xc008('0x16')](_0x593f7a,function(_0x3eb12a){var _0x4fe771={};_0x4fe771[_0x3eb12a]=_0xc881aa['routeId']?_0xc881aa['destcalleridnum']:_0xc881aa['calleridnum'];return _0x4fe771;});}var _0x46042b=['id',_0xc008('0x17'),'lastName',_0xc008('0x14'),'mobile','fax','ListId','createdAt',_0xc008('0x18'),'updatedAt'];var _0x5560b1=_['union'](_0x46042b,_0x593f7a);BPromise['resolve']()['then'](cmContactRpc[_0xc008('0x19')]({'attributes':_0x5560b1,'where':_0x332fd4}))[_0xc008('0x1a')](function(_0x251db2){_0xae2dab=_0x251db2;if(!_[_0xc008('0x1b')](_0xae2dab)){if(_0xae2dab[_0xc008('0x1c')]===0x1){_0x5b2004=_0xae2dab[0x0];logger[_0xc008('0x1d')]('[CM][%s][%s]\x20Contact\x20found:%s',_0xc881aa[_0xc008('0x1e')],_0x543eb8['id'],_0x5b2004['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0xc881aa[_0xc008('0x1e')],_0x543eb8['id'],_[_0xc008('0x16')](_0xae2dab,'id')[_0xc008('0x1f')](','));}return;}else{logger[_0xc008('0x1d')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xc881aa['uniqueid'],_0x543eb8['id']);var _0x5de1e9={'ListId':_0x2ea200};var _0x3f7b07=_0x1eacfa[_0xc008('0x20')]&&_0x1eacfa[_0xc008('0x20')]!=='0'?_0x1eacfa[_0xc008('0x20')]:'phone';if(_0x9ffa93){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0xc881aa['uniqueid'],_0x543eb8['id']);_0x5de1e9[_0x3f7b07]=_['isNil'](_0xc881aa[_0xc008('0x21')])?_0xc881aa[_0xc008('0x22')]:_0xc881aa[_0xc008('0x23')];if(_['isNil'](_0xc881aa[_0xc008('0x21')])){_0x5de1e9[_0xc008('0x17')]=_0xc881aa[_0xc008('0x24')]&&_0xc881aa[_0xc008('0x24')]!==''?_0xc881aa[_0xc008('0x24')]:_0xc008('0x25');}else{_0x5de1e9['firstName']=_0xc881aa['destcalleridname']&&_0xc881aa['destcalleridname']!==_0xc008('0x26')?_0xc881aa[_0xc008('0x27')]:_0xc008('0x25');}return BPromise[_0xc008('0x28')]()[_0xc008('0x1a')](cmContactRpc[_0xc008('0x29')](_0x5de1e9))[_0xc008('0x1a')](function(_0x22d8e8){_0x5b2004=_0x22d8e8;_0xae2dab[_0xc008('0x2a')](_0x22d8e8);if(_0x5b2004){logger[_0xc008('0x1d')](_0xc008('0x2b'),_0xc881aa[_0xc008('0x1e')],_0x543eb8['id'],_0x5b2004['id']);}return;});}else{logger['info'](_0xc008('0x2c'),_0xc881aa[_0xc008('0x1e')],_0x543eb8['id']);_0x5de1e9[_0x3f7b07]=_['isNil'](_0xc881aa[_0xc008('0x21')])?_0xc881aa[_0xc008('0x22')]:_0xc881aa[_0xc008('0x23')];if(_[_0xc008('0xf')](_0xc881aa[_0xc008('0x21')])){_0x5de1e9[_0xc008('0x17')]=_0xc881aa[_0xc008('0x24')]&&_0xc881aa[_0xc008('0x24')]!==_0xc008('0x26')?_0xc881aa['calleridname']:_0xc008('0x25');}else{_0x5de1e9[_0xc008('0x17')]=_0xc881aa[_0xc008('0x27')]&&_0xc881aa[_0xc008('0x27')]!==_0xc008('0x26')?_0xc881aa[_0xc008('0x27')]:_0xc008('0x25');}_0x5b2004=_0x5de1e9;_0xae2dab['push'](_0x5de1e9);return;}}})[_0xc008('0x1a')](function(){if(_0x51ba7d){emit(_0xc881aa[_0xc008('0x1e')],_0x543eb8,util['format'](_0xc008('0x2d'),_0x51ba7d[_0xc008('0x2e')]),util['format'](_0xc008('0x2f'),_0x1eacfa[_0xc008('0x30')][_0xc008('0x31')]()),{'evt':_['merge'](_0xc881aa,{'autoCreate':_0x9ffa93}),'contact':_0x5b2004===undefined?{}:_0x5b2004,'contacts':_0xae2dab['length']===0x0?undefined:_0xae2dab});}});}; \ No newline at end of file +var _0xb903=['data1','data2','data5','xmd-contactid','data3','split','phone','destcalleridnum','calleridnum','firstName','fax','ListId','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','Unknown','destcalleridname','push','user:%s','format','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info'];(function(_0x23db84,_0x4a0b04){var _0x3f478e=function(_0x49e4a7){while(--_0x49e4a7){_0x23db84['push'](_0x23db84['shift']());}};_0x3f478e(++_0x4a0b04);}(_0xb903,0x185));var _0x3b90=function(_0x412d73,_0x3b1a56){_0x412d73=_0x412d73-0x0;var _0x30b22a=_0xb903[_0x412d73];return _0x30b22a;};'use strict';var _=require(_0x3b90('0x0'));var BPromise=require(_0x3b90('0x1'));var Redis=require(_0x3b90('0x2'));var util=require(_0x3b90('0x3'));var config=require('../../../../config/environment');var logger=require(_0x3b90('0x4'))(_0x3b90('0x5'));var cmContactRpc=require(_0x3b90('0x6'));config[_0x3b90('0x7')]=_[_0x3b90('0x8')](config[_0x3b90('0x7')],{'host':_0x3b90('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b90('0x7')]));function emit(_0x5e845a,_0x55792c,_0x153283,_0x2e4c06,_0x42efe8){logger[_0x3b90('0xa')]('[CM][%s][%s]',_0x5e845a,_0x55792c['id'],_0x153283,_0x2e4c06,JSON['stringify'](_0x42efe8));io['to'](_0x153283)['emit'](_0x2e4c06,_0x42efe8);}exports['exec']=function(_0x56261b,_0x55db3f,_0x336913,_0x5af39c){var _0x574955,_0x30c49c;var _0x233509={};var _0x4bb8f4=Number(_0x336913[_0x3b90('0xb')]);var _0x174c0d=_0x336913[_0x3b90('0xc')]?Boolean(Number(_0x336913['data2'])):![];var _0x5447df;var _0x58c4d1=![];if(!_['isNil'](_0x336913['data5'])){if(_0x336913[_0x3b90('0xd')]=='1')_0x58c4d1=!![];}if(!_0x58c4d1){if(_0x5af39c[_0x3b90('0xe')]){_0x233509['id']=_0x5af39c['xmd-contactid'];}}if(!_0x233509['id']){_0x233509['ListId']=_0x4bb8f4;_0x5447df=_0x336913[_0x3b90('0xf')]&&_0x336913[_0x3b90('0xf')]!=='0'?_0x336913[_0x3b90('0xf')][_0x3b90('0x10')](','):[_0x3b90('0x11')];_0x233509['$or']=_['map'](_0x5447df,function(_0xd83280){var _0x5420dc={};_0x5420dc[_0xd83280]=_0x5af39c['routeId']?_0x5af39c[_0x3b90('0x12')]:_0x5af39c[_0x3b90('0x13')];return _0x5420dc;});}var _0x11ad7d=['id',_0x3b90('0x14'),'lastName',_0x3b90('0x11'),'mobile',_0x3b90('0x15'),_0x3b90('0x16'),'createdAt',_0x3b90('0x17'),_0x3b90('0x18')];var _0x3642c0=_[_0x3b90('0x19')](_0x11ad7d,_0x5447df);BPromise[_0x3b90('0x1a')]()[_0x3b90('0x1b')](cmContactRpc[_0x3b90('0x1c')]({'attributes':_0x3642c0,'where':_0x233509}))[_0x3b90('0x1b')](function(_0xa98414){_0x30c49c=_0xa98414;if(!_[_0x3b90('0x1d')](_0x30c49c)){if(_0x30c49c['length']===0x1){_0x574955=_0x30c49c[0x0];logger[_0x3b90('0xa')](_0x3b90('0x1e'),_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id'],_0x574955['id']);}else{logger[_0x3b90('0xa')](_0x3b90('0x20'),_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id'],_['map'](_0x30c49c,'id')['join'](','));}return;}else{logger[_0x3b90('0xa')](_0x3b90('0x21'),_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id']);var _0x2ffa1a={'ListId':_0x4bb8f4};var _0x583523=_0x336913[_0x3b90('0x22')]&&_0x336913[_0x3b90('0x22')]!=='0'?_0x336913[_0x3b90('0x22')]:'phone';if(_0x174c0d){logger[_0x3b90('0xa')](_0x3b90('0x23'),_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id']);_0x2ffa1a[_0x583523]=_[_0x3b90('0x24')](_0x5af39c[_0x3b90('0x25')])?_0x5af39c[_0x3b90('0x13')]:_0x5af39c['destcalleridnum'];if(_[_0x3b90('0x24')](_0x5af39c['routeId'])){_0x2ffa1a[_0x3b90('0x14')]=_0x5af39c[_0x3b90('0x26')]&&_0x5af39c[_0x3b90('0x26')]!==_0x3b90('0x27')?_0x5af39c[_0x3b90('0x26')]:_0x3b90('0x28');}else{_0x2ffa1a[_0x3b90('0x14')]=_0x5af39c[_0x3b90('0x29')]&&_0x5af39c['destcalleridname']!==''?_0x5af39c[_0x3b90('0x29')]:_0x3b90('0x28');}return BPromise[_0x3b90('0x1a')]()[_0x3b90('0x1b')](cmContactRpc['createContact'](_0x2ffa1a))['then'](function(_0xd33ac9){_0x574955=_0xd33ac9;_0x30c49c[_0x3b90('0x2a')](_0xd33ac9);if(_0x574955){logger[_0x3b90('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id'],_0x574955['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x5af39c[_0x3b90('0x1f')],_0x55db3f['id']);_0x2ffa1a[_0x583523]=_[_0x3b90('0x24')](_0x5af39c['routeId'])?_0x5af39c[_0x3b90('0x13')]:_0x5af39c[_0x3b90('0x12')];if(_[_0x3b90('0x24')](_0x5af39c['routeId'])){_0x2ffa1a['firstName']=_0x5af39c[_0x3b90('0x26')]&&_0x5af39c[_0x3b90('0x26')]!==_0x3b90('0x27')?_0x5af39c[_0x3b90('0x26')]:'Unknown';}else{_0x2ffa1a['firstName']=_0x5af39c[_0x3b90('0x29')]&&_0x5af39c[_0x3b90('0x29')]!==''?_0x5af39c['destcalleridname']:_0x3b90('0x28');}_0x574955=_0x2ffa1a;_0x30c49c[_0x3b90('0x2a')](_0x2ffa1a);return;}}})[_0x3b90('0x1b')](function(){if(_0x56261b){emit(_0x5af39c[_0x3b90('0x1f')],_0x55db3f,util['format'](_0x3b90('0x2b'),_0x56261b['name']),util[_0x3b90('0x2c')](_0x3b90('0x2d'),_0x336913[_0x3b90('0x2e')][_0x3b90('0x2f')]()),{'evt':_[_0x3b90('0x30')](_0x5af39c,{'autoCreate':_0x174c0d}),'contact':_0x574955===undefined?{}:_0x574955,'contacts':_0x30c49c[_0x3b90('0x31')]===0x0?undefined:_0x30c49c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7e2af69..df59e57 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 _0xb74d=['every','checkConditions','field','account','chat','operator','value','interaction','message','event','agent','membername','lastevent','routeId','exports','util','url','ioredis','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','redis','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','motionChannel','undefined','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','length','action','browser','data1','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','windowWidth','800','data5','windowHeight','data6','600','winApplication','winArguments','format','user:%s','toLowerCase','jscripty','name','trigger:%s','contactmanager','exec','queue','urlforward','script','parse','query','search','replace','channel','AllConditions'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xb74d,0x16e));var _0xdb74=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0xb74d[_0x54de5d];return _0x1b349e;};'use strict';var util=require(_0xdb74('0x0'));var _=require('lodash');var url=require(_0xdb74('0x1'));var Mustache=require('mustache');var Redis=require(_0xdb74('0x2'));var urlforward=require('./urlforward');var integration=require(_0xdb74('0x3'));var cmContact=require(_0xdb74('0x4'));var script=require(_0xdb74('0x5'));var config=require('../../../config/environment');var logger=require(_0xdb74('0x6'))(_0xdb74('0x7'));var ami=require(_0xdb74('0x8'));config['redis']=_['defaults'](config[_0xdb74('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xdb74('0xa'))(new Redis(config[_0xdb74('0x9')]));var operators={'equals':function(_0x47c4d6,_0x3bfe87){return _0x47c4d6==_0x3bfe87;},'not_equals':function(_0x5370df,_0x1b7936){return _0x5370df!=_0x1b7936;}};var barAndWebActions=[_0xdb74('0xb'),'url',_0xdb74('0xc')];function Trigger(_0x332ce4){this[_0xdb74('0xd')]=_0x332ce4['triggers'];this['agents']=_0x332ce4[_0xdb74('0xe')];this[_0xdb74('0xf')]=_0x332ce4[_0xdb74('0xf')];this[_0xdb74('0x10')]=_0x332ce4[_0xdb74('0x10')];this[_0xdb74('0x11')]=_0x332ce4[_0xdb74('0x11')];this[_0xdb74('0x12')]=_0x332ce4[_0xdb74('0x12')];this[_0xdb74('0x13')]=_0x332ce4[_0xdb74('0x13')];this[_0xdb74('0x14')]=_0x332ce4[_0xdb74('0x14')];this['sugarcrmAccounts']=_0x332ce4[_0xdb74('0x15')];this[_0xdb74('0x16')]=_0x332ce4[_0xdb74('0x16')];this[_0xdb74('0x17')]=_0x332ce4['deskAccounts'];this['vtigerAccounts']=_0x332ce4[_0xdb74('0x18')];this[_0xdb74('0x19')]=_0x332ce4['servicenowAccounts'];this[_0xdb74('0x1a')]=_0x332ce4[_0xdb74('0x1a')];this[_0xdb74('0x1b')]=_0x332ce4[_0xdb74('0x1b')];this['accounts']={'zendesk':this[_0xdb74('0x12')],'salesforce':this[_0xdb74('0x14')],'freshdesk':this[_0xdb74('0x13')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0xdb74('0x17')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xdb74('0x1a')],'freshsales':this[_0xdb74('0x1b')],'servicenow':this[_0xdb74('0x19')]};ami['on'](_0xdb74('0x1c'),this['syncCustomEvent'][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x1e'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x20'),this['syncCustomEvent'][_0xdb74('0x1d')](this));ami['on']('custom:agentcomplete',this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x21'),this['syncCustomEvent'][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x22'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x23'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x24'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x25'),this['syncCustomEvent'][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x26'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x27'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x28'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on']('custom:dialbegin',this[_0xdb74('0x29')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x2a'),this[_0xdb74('0x29')][_0xdb74('0x1d')](this));ami['on']('custom:dialend',this[_0xdb74('0x29')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x2b'),this[_0xdb74('0x1f')]['bind'](this));ami['on'](_0xdb74('0x2c'),this['syncCustomEvent']['bind'](this));ami['on'](_0xdb74('0x2d'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x2e'),this['syncCustomEvent'][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x2f'),this['syncCustomEvent'][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x30'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));ami['on'](_0xdb74('0x31'),this[_0xdb74('0x1f')][_0xdb74('0x1d')](this));}Trigger[_0xdb74('0x32')][_0xdb74('0x33')]=function(_0x27c0a5,_0x360939,_0x3045a3){logger[_0xdb74('0x34')](_0x27c0a5,_0x360939,JSON['stringify'](_0x3045a3));io['to'](_0x27c0a5)[_0xdb74('0x33')](_0x360939,_0x3045a3);};Trigger[_0xdb74('0x32')][_0xdb74('0x1f')]=function(_0x44641e){var _0x318e93=_[_0xdb74('0x35')](_0x44641e);if(typeof _0x318e93[_0xdb74('0x36')]===_0xdb74('0x37')){_0x318e93[_0xdb74('0x36')]='voice';}this[_0xdb74('0x38')](_0x318e93);};Trigger['prototype'][_0xdb74('0x29')]=function(_0x54d384){if(this[_0xdb74('0xe')][_0x54d384[_0xdb74('0x39')]]){this[_0xdb74('0x1f')](_0x54d384);}};Trigger[_0xdb74('0x32')]['checkTriggers']=function(_0x38c278){var _0x408991;for(var _0x4c7b94 in this['triggers']){if(this['triggers'][_0xdb74('0x3a')](_0x4c7b94)){if(this['triggers'][_0x4c7b94]['status']){_0x408991=this[_0xdb74('0x3b')](this[_0xdb74('0xd')][_0x4c7b94],_0x38c278);if(_0x408991){_[_0xdb74('0x3c')](_0x38c278,_0x38c278[_0xdb74('0x3d')]);for(var _0x5ba2f0=0x0,_0x335f3c,_0x5d1c3b,_0xbfc56a;_0x5ba2f00x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x375eab,_0x29fff5){var _0x3d468f=function(_0x7037bf){while(--_0x7037bf){_0x375eab['push'](_0x375eab['shift']());}};_0x3d468f(++_0x29fff5);}(_0x814b,0x1a2));var _0xb814=function(_0x16b561,_0x5a914f){_0x16b561=_0x16b561-0x0;var _0x22599f=_0x814b[_0x16b561];return _0x22599f;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index d382956..0496871 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 _0x6ca0=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','replace','%2b','telephone1',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','/contacts(','Fields','phonecall','Subjects','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','info',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s'];(function(_0x50035c,_0x1e302f){var _0x3817d6=function(_0x2cf45e){while(--_0x2cf45e){_0x50035c['push'](_0x50035c['shift']());}};_0x3817d6(++_0x1e302f);}(_0x6ca0,0x68));var _0x06ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x06ca('0x0'));var BPromise=require(_0x06ca('0x1'));var rp=require(_0x06ca('0x2'));var util=require(_0x06ca('0x3'));var intUtil=require(_0x06ca('0x4'));var md5=require(_0x06ca('0x5'));var Redis=require(_0x06ca('0x6'));var logger=require(_0x06ca('0x7'))(_0x06ca('0x8'));var config=require(_0x06ca('0x9'));config['redis']=_[_0x06ca('0xa')](config[_0x06ca('0xb')],{'host':_0x06ca('0xc'),'port':0x18eb});var io=require(_0x06ca('0xd'))(new Redis(config[_0x06ca('0xb')]));function getAuthToken(_0x4aee0b,_0x359c19,_0x1faf02){var _0xa7a44d={'method':_0x06ca('0xe'),'uri':_0x359c19,'form':{'client_id':_0x4aee0b[_0x06ca('0xf')],'resource':_0x4aee0b[_0x06ca('0x10')],'username':_0x4aee0b[_0x06ca('0x11')],'password':_0x4aee0b[_0x06ca('0x12')],'grant_type':_0x06ca('0x12'),'client_secret':_0x4aee0b[_0x06ca('0x13')]},'json':!![]};return rp(_0xa7a44d)[_0x06ca('0x14')](function(_0xfbfa49){return _0xfbfa49[_0x06ca('0x15')];})[_0x06ca('0x16')](function(_0x38f067){logger[_0x06ca('0x17')]('['+[_0x1faf02[_0x06ca('0x18')]()]+_0x06ca('0x19'));return _0x38f067['message'];});}function getUser(_0xe6a394,_0x3a2b26,_0x39b59c,_0xdc1bfc,_0x349718,_0x2600f9){return new BPromise(function(_0x2a8d5b,_0xfc1fe7){return getAuthToken(_0x3a2b26,_0xdc1bfc,_0x2600f9)[_0x06ca('0x14')](function(_0x1bb34f){var _0x5116a0={'method':_0x06ca('0x1a'),'uri':_0x349718+_0x06ca('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x1bb34f,'OData-Version':_0x06ca('0x1c')},'json':!![]};return rp(_0x5116a0);})[_0x06ca('0x14')](function(_0x525152){var _0x7d15f8=_0x525152[_0x06ca('0x1d')];var _0x57ea81=![];var _0x1c9c79=null;if(!_[_0x06ca('0x1e')](_0x39b59c)){if(intUtil[_0x06ca('0x1f')](_0x39b59c[_0x06ca('0x20')])){_0xe6a394[_0x06ca('0x21')]=_0x39b59c['email'];for(_0x1c9c79=0x0;_0x1c9c79<_0x7d15f8[_0x06ca('0x22')];_0x1c9c79++){if(_0x7d15f8[_0x1c9c79][_0x06ca('0x23')]===_0x39b59c[_0x06ca('0x20')]&&!_0x7d15f8[_0x1c9c79]['isdisabled']){_0x57ea81=!![];logger['info']('['+[_0x2600f9[_0x06ca('0x18')]()]+']\x20Agent\x20found\x20'+_0x7d15f8[_0x1c9c79][_0x06ca('0x24')]+'!');_0xe6a394[_0x06ca('0x25')]=_0x7d15f8[_0x1c9c79][_0x06ca('0x24')];}}}}if(!_0x57ea81){logger['info']('['+[_0x2600f9['toUpperCase']()]+_0x06ca('0x26'));_0xe6a394[_0x06ca('0x21')]=_0x3a2b26[_0x06ca('0x11')];for(_0x1c9c79=0x0;_0x1c9c79<_0x7d15f8[_0x06ca('0x22')];_0x1c9c79++){if(_0x7d15f8[_0x1c9c79][_0x06ca('0x23')]===_0x3a2b26[_0x06ca('0x11')]){_0xe6a394['userId']=_0x7d15f8[_0x1c9c79][_0x06ca('0x24')];}}}_0x2a8d5b(_0xe6a394);})[_0x06ca('0x16')](function(_0x3c646e){_0xfc1fe7(_0x3c646e[_0x06ca('0x27')]);});});}function createEndUser(_0x5df2dd,_0x206719,_0x4197e5,_0x163c0f,_0xaf0de1,_0xa1648f){return new BPromise(function(_0x455a4b,_0x15dd15){return getAuthToken(_0x206719,_0x4197e5,_0xa1648f)[_0x06ca('0x14')](function(_0x102b45){var _0x49965f=_0xa1648f[_0x06ca('0x28')]()===_0x06ca('0x29')?_0xaf0de1[_0x06ca('0x2a')]:_0xaf0de1[_0x06ca('0x2b')];var _0x4781bf={'method':_0x06ca('0xe'),'uri':_0x163c0f+'contacts','body':{'telephone1':_0x49965f,'fullname':_0x49965f,'firstname':_0x49965f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x06ca('0x2c')+_0x5df2dd['userId']+')'},'headers':{'Authorization':_0x06ca('0x2d')+_0x102b45,'OData-Version':_0x06ca('0x1c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4781bf);})[_0x06ca('0x14')](function(_0x71e023){var _0x1eb3d9=_0x71e023[_0x06ca('0x2e')][_0x06ca('0x2f')];var _0x40ddc5=_0x1eb3d9[_0x06ca('0x30')](_0x1eb3d9[_0x06ca('0x31')]('(')+0x1,_0x1eb3d9[_0x06ca('0x31')](')'));_0x5df2dd[_0x06ca('0x32')]=_0x40ddc5;_0x455a4b(_0x5df2dd);})[_0x06ca('0x16')](function(_0x19a947){_0x15dd15(_0x19a947[_0x06ca('0x27')]);});});}function getEndUser(_0x433606,_0x49e879,_0x49b3c7,_0x15f566,_0xcb2db8,_0x578e79){return new BPromise(function(_0x2543ae,_0x2be265){var _0x22e43c=_0x578e79['toLowerCase']()===_0x06ca('0x29')?_0xcb2db8['destcalleridnum']:_0xcb2db8[_0x06ca('0x2b')];return getAuthToken(_0x49e879,_0x49b3c7,_0x578e79)[_0x06ca('0x14')](function(_0x4de067){var _0x561866={'method':_0x06ca('0x1a'),'uri':_0x15f566+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x22e43c[_0x06ca('0x33')]('+',_0x06ca('0x34'))+'\x27','headers':{'Authorization':_0x06ca('0x2d')+_0x4de067,'If-None-Match':null,'OData-Version':_0x06ca('0x1c')},'json':!![]};return rp(_0x561866);})[_0x06ca('0x14')](function(_0x669630){var _0x59dbdf=null;if(_0x669630){var _0x46f86a=_0x669630[_0x06ca('0x1d')];var _0x5810c4=![];for(_0x59dbdf=0x0;_0x59dbdf<_0x46f86a[_0x06ca('0x22')];_0x59dbdf++){if(_0x46f86a[_0x59dbdf][_0x06ca('0x35')]===_0x22e43c){_0x5810c4=!![];_0x433606[_0x06ca('0x32')]=_0x46f86a[_0x59dbdf]['contactid'];}}if(_0x5810c4){_0x2543ae(_0x433606);}else{return createEndUser(_0x433606,_0x49e879,_0x49b3c7,_0x15f566,_0xcb2db8,_0x578e79)['then'](function(_0x20f873){logger['info']('['+[_0x578e79[_0x06ca('0x18')]()]+_0x06ca('0x36'),_0x20f873[_0x06ca('0x32')]);_0x2543ae(_0x20f873);});}}else{return createEndUser(_0x433606,_0x49e879,_0x49b3c7,_0x15f566,_0xcb2db8,_0x578e79)[_0x06ca('0x14')](function(_0x27f615){logger['info']('['+[_0x578e79['toUpperCase']()]+']\x20Enduser\x20Created!',_0x27f615[_0x06ca('0x32')]);_0x2543ae(_0x27f615);});}});});}function getCustomFields(_0x3d303c,_0x17273e,_0x3bccd4){var _0x2afc32={};if(_0x3d303c[_0x06ca('0x22')]>0x0){_[_0x06ca('0x37')](_0x3d303c,function(_0x181f15){if(_[_0x06ca('0x38')]([_0x06ca('0x39'),_0x06ca('0x3a')],_0x181f15[_0x06ca('0x3b')])&&_0x181f15[_0x06ca('0x3c')]&&!_0x181f15[_0x06ca('0x3d')]){var _0x26c71b=_0x181f15[_0x06ca('0x3e')][_0x06ca('0x28')]();var _0x11411e=_0x26c71b[_0x06ca('0x30')](0x0,_0x26c71b[_0x06ca('0x3f')]('_'));var _0x91abe7=_0x26c71b['substring'](_0x26c71b['indexOf']('_')+0x1);if(_0x11411e===_0x3bccd4){_0x2afc32[_0x91abe7]=_0x181f15[_0x06ca('0x40')];}}});}return _0x2afc32;}function getTicket(_0x30ec95,_0x2d2e13,_0x31c512,_0x6d8f2a,_0x2050b8,_0x9dba83,_0x1ea7e0){return new BPromise(function(_0x419cd4,_0x53d711){var _0x4581f9;return getAuthToken(_0x2d2e13,_0x31c512,_0x1ea7e0)[_0x06ca('0x14')](function(_0x3f6152){if(_0x9dba83[_0x06ca('0x41')]===_0x06ca('0x42')){_0x4581f9={'method':'POST','uri':_0x6d8f2a+'incidents','body':Object[_0x06ca('0x43')]({},{'title':intUtil[_0x06ca('0x44')](_0x9dba83['Subjects'],_0x2050b8,'\x20'),'description':intUtil['getString'](_0x9dba83['Descriptions'],_0x2050b8,'\x0a'),'customerid_contact@odata.bind':_0x06ca('0x45')+_0x30ec95['enduserId']+')','ownerid@odata.bind':_0x06ca('0x2c')+_0x30ec95['userId']+')','caseorigincode':'1'},getCustomFields(_0x9dba83[_0x06ca('0x46')],_0x2050b8,_0x9dba83['ticketType'])),'headers':{'Authorization':_0x06ca('0x2d')+_0x3f6152,'OData-Version':_0x06ca('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x9dba83[_0x06ca('0x41')]===_0x06ca('0x47')){_0x4581f9={'method':_0x06ca('0xe'),'uri':_0x6d8f2a+'phonecalls','body':Object['assign']({},{'subject':intUtil['getString'](_0x9dba83[_0x06ca('0x48')],_0x2050b8,'\x20'),'phonenumber':String(_0x2050b8[_0x06ca('0x2b')]),'description':intUtil[_0x06ca('0x44')](_0x9dba83['Descriptions'],_0x2050b8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x06ca('0x45')+_0x30ec95[_0x06ca('0x32')]+')','ownerid@odata.bind':_0x06ca('0x2c')+_0x30ec95[_0x06ca('0x25')]+')','directioncode':_0x30ec95[_0x06ca('0x49')]===_0x06ca('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x06ca('0x2c')+_0x30ec95['userId']+')','participationtypemask':_0x30ec95[_0x06ca('0x49')]===_0x06ca('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0x06ca('0x45')+_0x30ec95[_0x06ca('0x32')]+')','participationtypemask':_0x30ec95[_0x06ca('0x49')]==='queue'?0x1:0x2}]},getCustomFields(_0x9dba83[_0x06ca('0x46')],_0x2050b8,_0x9dba83[_0x06ca('0x41')])),'headers':{'Authorization':_0x06ca('0x2d')+_0x3f6152,'OData-Version':_0x06ca('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4581f9);})[_0x06ca('0x14')](function(_0x20e3e9){var _0x275a97=_0x20e3e9[_0x06ca('0x2e')][_0x06ca('0x2f')];var _0x495a86=_0x275a97[_0x06ca('0x30')](_0x275a97[_0x06ca('0x31')]('(')+0x1,_0x275a97['lastIndexOf'](')'));_0x30ec95[_0x06ca('0x4b')]=_0x495a86;_0x419cd4(_0x30ec95);})[_0x06ca('0x16')](function(_0x16a991){_0x53d711(_0x16a991['message']);});});}function emit(_0x56368b,_0xf59059,_0x328eea,_0x3f2cfc){var _0x2c3fd7={'uri':util[_0x06ca('0x4c')](_0x06ca('0x4d'),_0x56368b,_0x328eea,_0x3f2cfc)};io['to'](util['format'](_0x06ca('0x4e'),_0xf59059))[_0x06ca('0x4f')]('trigger:browser:url',_0x2c3fd7);}exports['cs']=function(_0x13b6e8,_0x234398,_0x19b96b,_0x71c092,_0xa81186,_0x18a82d,_0x1424e9,_0x5c6aa3){var _0x1f9371={};_0x18a82d[_0x06ca('0x10')]=intUtil[_0x06ca('0x50')](_0x18a82d['remoteUri']);_0x18a82d[_0x06ca('0x51')]=intUtil[_0x06ca('0x50')](_0x18a82d[_0x06ca('0x51')]);_0x1f9371[_0x06ca('0x49')]=_0x5c6aa3==='queue'||_0x5c6aa3===_0x06ca('0x52')?_0x06ca('0x4a'):_0x06ca('0x29');var _0x42a8a9=util[_0x06ca('0x4c')]('%s/api/data/v9.0/',_0x18a82d[_0x06ca('0x10')]);var _0x1005c2=util[_0x06ca('0x4c')](_0x06ca('0x53'),_0x18a82d[_0x06ca('0x54')]);var _0x397625=util[_0x06ca('0x4c')](_0x06ca('0x55'),_0x18a82d[_0x06ca('0x51')],_0x234398[_0x06ca('0x56')],md5(_0x234398[_0x06ca('0x56')]));if(_0xa81186&&_0xa81186[_0x06ca('0x57')]){logger['info'](_0x06ca('0x58'),_0x06ca('0x59'));_0x234398[_0x06ca('0x5a')]=_0x397625;}else if(_0x1424e9&&_0x1424e9[_0x06ca('0x5b')]&&_0x1424e9['recordingFormat']!==_0x06ca('0x5c')){logger[_0x06ca('0x5d')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x234398['recordingURL']=_0x397625;}else{_0x234398[_0x06ca('0x5a')]='';}return getUser(_0x1f9371,_0x18a82d,_0x71c092,_0x1005c2,_0x42a8a9,_0x5c6aa3)['then'](function(_0x348319){logger['info']('['+_0x5c6aa3[_0x06ca('0x18')]()+_0x06ca('0x5e'),_0x348319[_0x06ca('0x25')]);logger[_0x06ca('0x5d')]('['+_0x5c6aa3[_0x06ca('0x18')]()+_0x06ca('0x5f'),_0x348319[_0x06ca('0x21')]);return getEndUser(_0x348319,_0x18a82d,_0x1005c2,_0x42a8a9,_0x234398,_0x5c6aa3);})['then'](function(_0x24a9e2){logger[_0x06ca('0x5d')]('['+_0x5c6aa3[_0x06ca('0x18')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x24a9e2[_0x06ca('0x32')]);logger['info']('['+_0x5c6aa3[_0x06ca('0x18')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x234398[_0x06ca('0x2b')]);return getTicket(_0x24a9e2,_0x18a82d,_0x1005c2,_0x42a8a9,_0x234398,_0x19b96b,_0x5c6aa3);})['then'](function(_0x3ab0f3){logger[_0x06ca('0x5d')](util[_0x06ca('0x4c')]('['+_0x5c6aa3[_0x06ca('0x18')]()+_0x06ca('0x60'),_0x19b96b[_0x06ca('0x41')],_0x3ab0f3['ticketId']));logger[_0x06ca('0x5d')](util[_0x06ca('0x4c')]('['+_0x5c6aa3[_0x06ca('0x18')]()+_0x06ca('0x61'),_0x5c6aa3));if(_0x5c6aa3!==_0x06ca('0x52')){logger['info']('['+_0x5c6aa3['toUpperCase']()+']',_0x06ca('0x62'));emit(_0x18a82d[_0x06ca('0x10')],_0x71c092[_0x06ca('0x63')],_0x19b96b[_0x06ca('0x41')],_0x3ab0f3['ticketId']);}})[_0x06ca('0x16')](function(_0x47c735){logger[_0x06ca('0x17')]('['+_0x5c6aa3[_0x06ca('0x18')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x06ca('0x64')](_0x47c735,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdd5e=['Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','./util','ioredis','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','username','clientSecret','access_token','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','/systemusers(','userId','headers','odata-entityid','lastIndexOf','enduserId','message','destcalleridnum','calleridnum','replace','%2b','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','string','type','nameField','idField','substring','indexOf','content','incident','incidents','assign','getString','Subjects','/contacts(','ticketType','phonecall','phonecalls','Descriptions','callDirection','queue','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s'];(function(_0x26b558,_0x209417){var _0x54225c=function(_0x2062c3){while(--_0x2062c3){_0x26b558['push'](_0x26b558['shift']());}};_0x54225c(++_0x209417);}(_0xdd5e,0x173));var _0xedd5=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xdd5e[_0x96f74c];return _0x379222;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0xedd5('0x0'));var util=require('util');var intUtil=require(_0xedd5('0x1'));var md5=require('md5');var Redis=require(_0xedd5('0x2'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0xedd5('0x3'));config[_0xedd5('0x4')]=_[_0xedd5('0x5')](config[_0xedd5('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xedd5('0x6'))(new Redis(config[_0xedd5('0x4')]));function getAuthToken(_0x5b987f,_0x17e091,_0x24b896){var _0x1d96b0={'method':_0xedd5('0x7'),'uri':_0x17e091,'form':{'client_id':_0x5b987f[_0xedd5('0x8')],'resource':_0x5b987f[_0xedd5('0x9')],'username':_0x5b987f[_0xedd5('0xa')],'password':_0x5b987f['password'],'grant_type':'password','client_secret':_0x5b987f[_0xedd5('0xb')]},'json':!![]};return rp(_0x1d96b0)['then'](function(_0x50b12a){return _0x50b12a[_0xedd5('0xc')];})[_0xedd5('0xd')](function(_0x460207){logger[_0xedd5('0xe')]('['+[_0x24b896[_0xedd5('0xf')]()]+']\x20Wrong\x20credentials!');return _0x460207['message'];});}function getUser(_0x2f70a1,_0x393edf,_0x379b08,_0x18e975,_0x543763,_0x581597){return new BPromise(function(_0x5bd9db,_0x5896fd){return getAuthToken(_0x393edf,_0x18e975,_0x581597)['then'](function(_0x1300be){var _0x35f2a0={'method':_0xedd5('0x10'),'uri':_0x543763+_0xedd5('0x11'),'headers':{'Authorization':_0xedd5('0x12')+_0x1300be,'OData-Version':_0xedd5('0x13')},'json':!![]};return rp(_0x35f2a0);})[_0xedd5('0x14')](function(_0x1063f7){var _0x36a19a=_0x1063f7[_0xedd5('0x15')];var _0x30082a=![];var _0x3a93e4=null;if(!_[_0xedd5('0x16')](_0x379b08)){if(intUtil[_0xedd5('0x17')](_0x379b08['email'])){_0x2f70a1[_0xedd5('0x18')]=_0x379b08[_0xedd5('0x19')];for(_0x3a93e4=0x0;_0x3a93e4<_0x36a19a[_0xedd5('0x1a')];_0x3a93e4++){if(_0x36a19a[_0x3a93e4][_0xedd5('0x1b')]===_0x379b08[_0xedd5('0x19')]&&!_0x36a19a[_0x3a93e4][_0xedd5('0x1c')]){_0x30082a=!![];logger[_0xedd5('0x1d')]('['+[_0x581597[_0xedd5('0xf')]()]+']\x20Agent\x20found\x20'+_0x36a19a[_0x3a93e4][_0xedd5('0x1e')]+'!');_0x2f70a1['userId']=_0x36a19a[_0x3a93e4]['systemuserid'];}}}}if(!_0x30082a){logger[_0xedd5('0x1d')]('['+[_0x581597['toUpperCase']()]+_0xedd5('0x1f'));_0x2f70a1[_0xedd5('0x18')]=_0x393edf[_0xedd5('0xa')];for(_0x3a93e4=0x0;_0x3a93e4<_0x36a19a[_0xedd5('0x1a')];_0x3a93e4++){if(_0x36a19a[_0x3a93e4][_0xedd5('0x1b')]===_0x393edf['username']){_0x2f70a1['userId']=_0x36a19a[_0x3a93e4]['systemuserid'];}}}_0x5bd9db(_0x2f70a1);})[_0xedd5('0xd')](function(_0x441e4a){_0x5896fd(_0x441e4a['message']);});});}function createEndUser(_0x2be135,_0x354547,_0x591bc1,_0x20bf04,_0x854e3e,_0x2a41b1){return new BPromise(function(_0x20d7b8,_0x4ee3df){return getAuthToken(_0x354547,_0x591bc1,_0x2a41b1)['then'](function(_0x4ea153){var _0x1febad=_0x2a41b1[_0xedd5('0x20')]()===_0xedd5('0x21')?_0x854e3e['destcalleridnum']:_0x854e3e['calleridnum'];var _0x26e909={'method':_0xedd5('0x7'),'uri':_0x20bf04+'contacts','body':{'telephone1':_0x1febad,'fullname':_0x1febad,'firstname':_0x1febad,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xedd5('0x22')+_0x2be135[_0xedd5('0x23')]+')'},'headers':{'Authorization':_0xedd5('0x12')+_0x4ea153,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x26e909);})[_0xedd5('0x14')](function(_0x5922d9){var _0x533835=_0x5922d9[_0xedd5('0x24')][_0xedd5('0x25')];var _0x310d05=_0x533835['substring'](_0x533835['lastIndexOf']('(')+0x1,_0x533835[_0xedd5('0x26')](')'));_0x2be135[_0xedd5('0x27')]=_0x310d05;_0x20d7b8(_0x2be135);})[_0xedd5('0xd')](function(_0x22213a){_0x4ee3df(_0x22213a[_0xedd5('0x28')]);});});}function getEndUser(_0xa70f3d,_0xd2a397,_0x2d0e6e,_0x317096,_0x1f39e2,_0x12d7ce){return new BPromise(function(_0x21cdad,_0x572285){var _0x465891=_0x12d7ce[_0xedd5('0x20')]()==='outbound'?_0x1f39e2[_0xedd5('0x29')]:_0x1f39e2[_0xedd5('0x2a')];return getAuthToken(_0xd2a397,_0x2d0e6e,_0x12d7ce)[_0xedd5('0x14')](function(_0x2d71b1){var _0x444b3e={'method':_0xedd5('0x10'),'uri':_0x317096+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x465891[_0xedd5('0x2b')]('+',_0xedd5('0x2c'))+'\x27','headers':{'Authorization':_0xedd5('0x12')+_0x2d71b1,'If-None-Match':null,'OData-Version':_0xedd5('0x13')},'json':!![]};return rp(_0x444b3e);})[_0xedd5('0x14')](function(_0x50fd42){var _0x85aa34=null;if(_0x50fd42){var _0x4dd9b7=_0x50fd42[_0xedd5('0x15')];var _0x11cf11=![];for(_0x85aa34=0x0;_0x85aa34<_0x4dd9b7['length'];_0x85aa34++){if(_0x4dd9b7[_0x85aa34]['telephone1']===_0x465891){_0x11cf11=!![];_0xa70f3d[_0xedd5('0x27')]=_0x4dd9b7[_0x85aa34][_0xedd5('0x2d')];}}if(_0x11cf11){_0x21cdad(_0xa70f3d);}else{return createEndUser(_0xa70f3d,_0xd2a397,_0x2d0e6e,_0x317096,_0x1f39e2,_0x12d7ce)[_0xedd5('0x14')](function(_0x581f08){logger[_0xedd5('0x1d')]('['+[_0x12d7ce[_0xedd5('0xf')]()]+_0xedd5('0x2e'),_0x581f08['enduserId']);_0x21cdad(_0x581f08);});}}else{return createEndUser(_0xa70f3d,_0xd2a397,_0x2d0e6e,_0x317096,_0x1f39e2,_0x12d7ce)[_0xedd5('0x14')](function(_0x403a9b){logger[_0xedd5('0x1d')]('['+[_0x12d7ce['toUpperCase']()]+_0xedd5('0x2f'),_0x403a9b['enduserId']);_0x21cdad(_0x403a9b);});}});});}function getCustomFields(_0x2c4dc7,_0x4e8f5e,_0x44ecd9){var _0x25dc21={};if(_0x2c4dc7[_0xedd5('0x1a')]>0x0){_['forEach'](_0x2c4dc7,function(_0x5eccc0){if(_['includes']([_0xedd5('0x30'),'picklist'],_0x5eccc0[_0xedd5('0x31')])&&_0x5eccc0[_0xedd5('0x32')]&&!_0x5eccc0['customField']){var _0x103f16=_0x5eccc0[_0xedd5('0x33')][_0xedd5('0x20')]();var _0x41391c=_0x103f16[_0xedd5('0x34')](0x0,_0x103f16[_0xedd5('0x35')]('_'));var _0x366e85=_0x103f16[_0xedd5('0x34')](_0x103f16['indexOf']('_')+0x1);if(_0x41391c===_0x44ecd9){_0x25dc21[_0x366e85]=_0x5eccc0[_0xedd5('0x36')];}}});}return _0x25dc21;}function getTicket(_0x52d98b,_0x40ff19,_0x4765e4,_0x523496,_0x18f800,_0x28ae47,_0x5d7dc2){return new BPromise(function(_0x44800c,_0x4d5156){var _0x523b82;return getAuthToken(_0x40ff19,_0x4765e4,_0x5d7dc2)['then'](function(_0x4350c4){if(_0x28ae47['ticketType']===_0xedd5('0x37')){_0x523b82={'method':_0xedd5('0x7'),'uri':_0x523496+_0xedd5('0x38'),'body':Object[_0xedd5('0x39')]({},{'title':intUtil[_0xedd5('0x3a')](_0x28ae47[_0xedd5('0x3b')],_0x18f800,'\x20'),'description':intUtil['getString'](_0x28ae47['Descriptions'],_0x18f800,'\x0a'),'customerid_contact@odata.bind':_0xedd5('0x3c')+_0x52d98b[_0xedd5('0x27')]+')','ownerid@odata.bind':_0xedd5('0x22')+_0x52d98b[_0xedd5('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x28ae47['Fields'],_0x18f800,_0x28ae47[_0xedd5('0x3d')])),'headers':{'Authorization':_0xedd5('0x12')+_0x4350c4,'OData-Version':_0xedd5('0x13')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x28ae47['ticketType']===_0xedd5('0x3e')){_0x523b82={'method':_0xedd5('0x7'),'uri':_0x523496+_0xedd5('0x3f'),'body':Object[_0xedd5('0x39')]({},{'subject':intUtil[_0xedd5('0x3a')](_0x28ae47[_0xedd5('0x3b')],_0x18f800,'\x20'),'phonenumber':String(_0x18f800[_0xedd5('0x2a')]),'description':intUtil[_0xedd5('0x3a')](_0x28ae47[_0xedd5('0x40')],_0x18f800,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x52d98b[_0xedd5('0x27')]+')','ownerid@odata.bind':_0xedd5('0x22')+_0x52d98b[_0xedd5('0x23')]+')','directioncode':_0x52d98b[_0xedd5('0x41')]===_0xedd5('0x42')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xedd5('0x22')+_0x52d98b[_0xedd5('0x23')]+')','participationtypemask':_0x52d98b[_0xedd5('0x41')]===_0xedd5('0x42')?0x2:0x1},{'partyid_contact@odata.bind':_0xedd5('0x3c')+_0x52d98b[_0xedd5('0x27')]+')','participationtypemask':_0x52d98b[_0xedd5('0x41')]==='queue'?0x1:0x2}]},getCustomFields(_0x28ae47[_0xedd5('0x43')],_0x18f800,_0x28ae47[_0xedd5('0x3d')])),'headers':{'Authorization':_0xedd5('0x12')+_0x4350c4,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x523b82);})['then'](function(_0x571b72){var _0x2c94d9=_0x571b72[_0xedd5('0x24')][_0xedd5('0x25')];var _0x554a27=_0x2c94d9[_0xedd5('0x34')](_0x2c94d9[_0xedd5('0x26')]('(')+0x1,_0x2c94d9['lastIndexOf'](')'));_0x52d98b[_0xedd5('0x44')]=_0x554a27;_0x44800c(_0x52d98b);})[_0xedd5('0xd')](function(_0x50dd47){_0x4d5156(_0x50dd47[_0xedd5('0x28')]);});});}function emit(_0x73dda1,_0x4fef48,_0x1d870c,_0x70ba5c){var _0x3f4ddc={'uri':util[_0xedd5('0x45')](_0xedd5('0x46'),_0x73dda1,_0x1d870c,_0x70ba5c)};io['to'](util[_0xedd5('0x45')](_0xedd5('0x47'),_0x4fef48))[_0xedd5('0x48')](_0xedd5('0x49'),_0x3f4ddc);}exports['cs']=function(_0x546501,_0x375a2b,_0x22b8d0,_0x28c67c,_0x4c2355,_0x117393,_0x555341,_0x425de8){var _0x45222e={};_0x117393[_0xedd5('0x9')]=intUtil[_0xedd5('0x4a')](_0x117393['remoteUri']);_0x117393['serverUrl']=intUtil['stripTrailingSlash'](_0x117393[_0xedd5('0x4b')]);_0x45222e[_0xedd5('0x41')]=_0x425de8===_0xedd5('0x42')||_0x425de8===_0xedd5('0x4c')?_0xedd5('0x42'):'outbound';var _0x2557bb=util[_0xedd5('0x45')](_0xedd5('0x4d'),_0x117393['remoteUri']);var _0x94f319=util['format'](_0xedd5('0x4e'),_0x117393['tenantId']);var _0x7f84c9=util[_0xedd5('0x45')](_0xedd5('0x4f'),_0x117393[_0xedd5('0x4b')],_0x375a2b[_0xedd5('0x50')],md5(_0x375a2b[_0xedd5('0x50')]));if(_0x4c2355&&_0x4c2355['monitor_format']){logger[_0xedd5('0x1d')]('[QUEUE]',_0xedd5('0x51'));_0x375a2b[_0xedd5('0x52')]=_0x7f84c9;}else if(_0x555341&&_0x555341[_0xedd5('0x53')]&&_0x555341['recordingFormat']!==_0xedd5('0x54')){logger[_0xedd5('0x1d')](_0xedd5('0x55'),_0xedd5('0x51'));_0x375a2b[_0xedd5('0x52')]=_0x7f84c9;}else{_0x375a2b['recordingURL']='';}return getUser(_0x45222e,_0x117393,_0x28c67c,_0x94f319,_0x2557bb,_0x425de8)[_0xedd5('0x14')](function(_0x75e20e){logger[_0xedd5('0x1d')]('['+_0x425de8[_0xedd5('0xf')]()+_0xedd5('0x56'),_0x75e20e[_0xedd5('0x23')]);logger['info']('['+_0x425de8['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x75e20e['userEmail']);return getEndUser(_0x75e20e,_0x117393,_0x94f319,_0x2557bb,_0x375a2b,_0x425de8);})['then'](function(_0x4f0fbc){logger[_0xedd5('0x1d')]('['+_0x425de8[_0xedd5('0xf')]()+_0xedd5('0x57'),_0x4f0fbc[_0xedd5('0x27')]);logger['info']('['+_0x425de8['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x375a2b[_0xedd5('0x2a')]);return getTicket(_0x4f0fbc,_0x117393,_0x94f319,_0x2557bb,_0x375a2b,_0x22b8d0,_0x425de8);})[_0xedd5('0x14')](function(_0x769c55){logger['info'](util[_0xedd5('0x45')]('['+_0x425de8[_0xedd5('0xf')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x22b8d0[_0xedd5('0x3d')],_0x769c55[_0xedd5('0x44')]));logger['info'](util['format']('['+_0x425de8['toUpperCase']()+_0xedd5('0x58'),_0x425de8));if(_0x425de8!==_0xedd5('0x4c')){logger[_0xedd5('0x1d')]('['+_0x425de8[_0xedd5('0xf')]()+']',_0xedd5('0x59'));emit(_0x117393['remoteUri'],_0x28c67c['name'],_0x22b8d0[_0xedd5('0x3d')],_0x769c55[_0xedd5('0x44')]);}})[_0xedd5('0xd')](function(_0x22611d){logger['error']('['+_0x425de8['toUpperCase']()+_0xedd5('0x5a'),util[_0xedd5('0x5b')](_0x22611d,{'showHidden':!![],'depth':null}));});}; \ 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 d790422..7e68f79 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 _0xeca2=['map','includes','string','picklist','nameField','customField','type','idField','content','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','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','error','outbound','recordingFormat','[OUTBOUND]','Authorization','catch','unmanaged','monitor_format','lastevent','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','custom_fields','mapValues','value','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','GET'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeca2,0x7e));var _0x2eca=function(_0x4c3694,_0x446802){_0x4c3694=_0x4c3694-0x0;var _0x20da46=_0xeca2[_0x4c3694];return _0x20da46;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x2eca('0x0'));var util=require(_0x2eca('0x1'));var Redis=require('ioredis');var intUtil=require(_0x2eca('0x2'));var config=require(_0x2eca('0x3'));var logger=require(_0x2eca('0x4'))(_0x2eca('0x5'));config[_0x2eca('0x6')]=_[_0x2eca('0x7')](config['redis'],{'host':_0x2eca('0x8'),'port':0x18eb});var io=require(_0x2eca('0x9'))(new Redis(config[_0x2eca('0x6')]));var headers={'Content-Type':_0x2eca('0xa'),'Accept':_0x2eca('0xa')};function emit(_0x1905f0,_0x5e2a6b,_0x17f366){io['to'](_0x1905f0)[_0x2eca('0xb')](_0x5e2a6b,_0x17f366);}function getTicket(_0x508169,_0x35fd94,_0x2562d7,_0x1cd440,_0x29c9f){logger['info'](_0x2eca('0xc'));var _0x5c6841=_['merge']({'responder_id':_0x35fd94['id'],'requester_id':_0x2562d7['id'],'name':util[_0x2eca('0xd')](_0x2eca('0xe'),_0x29c9f[_0x2eca('0xf')]),'phone':_0x29c9f[_0x2eca('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2eca('0x11')](_0x1cd440['Subjects'],_0x29c9f,'\x20'),'description':intUtil[_0x2eca('0x11')](_0x1cd440[_0x2eca('0x12')],_0x29c9f,_0x2eca('0x13')),'tags':getTags(_0x1cd440[_0x2eca('0x14')],_0x2eca('0x15'))},getCustomFields(_0x1cd440['Fields'],_0x29c9f));_0x5c6841[_0x2eca('0x16')]=_[_0x2eca('0x17')](_['keyBy'](_0x5c6841[_0x2eca('0x16')],'id'),_0x2eca('0x18'));return request({'uri':util['format'](_0x2eca('0x19'),_0x508169['remoteUri']),'method':_0x2eca('0x1a'),'body':_0x5c6841})[_0x2eca('0x1b')](function(_0x370a33){logger[_0x2eca('0x1c')](_0x2eca('0x1d'));return _0x370a33;});}function getUser(_0x254643,_0x25f580){if(intUtil['validateEmail'](_0x25f580)){return request({'uri':util['format']('%s/api/v2/agents',_0x254643[_0x2eca('0x1e')]),'qs':{'email':_0x25f580}})[_0x2eca('0x1b')](function(_0x3d9509){if(_0x3d9509[_0x2eca('0x1f')]){logger['info'](_0x2eca('0x20'));return _[_0x2eca('0x21')](_0x3d9509,function(_0x3ef8f6){return _0x3ef8f6[_0x2eca('0x22')][_0x2eca('0x23')]===_0x25f580;});}else{logger[_0x2eca('0x1c')](_0x2eca('0x24'));return request({'uri':util[_0x2eca('0xd')](_0x2eca('0x25'),_0x254643[_0x2eca('0x1e')])})['then'](function(_0x54e21e){logger['info'](_0x2eca('0x26'));return _0x54e21e;});}});}else{logger['info'](_0x2eca('0x27'));return request({'uri':util[_0x2eca('0xd')](_0x2eca('0x25'),_0x254643[_0x2eca('0x1e')])})[_0x2eca('0x1b')](function(_0x4ab6ba){logger[_0x2eca('0x1c')](_0x2eca('0x26'));return _0x4ab6ba;});}}function getEndUser(_0x32bf62,_0x40bee0,_0x1539e0){logger[_0x2eca('0x1c')](_0x2eca('0x28'),_0x1539e0);return request({'uri':util[_0x2eca('0xd')](_0x2eca('0x29'),_0x32bf62[_0x2eca('0x1e')]),'qs':{'phone':_0x1539e0}})[_0x2eca('0x1b')](function(_0x375d38){if(_0x375d38[_0x2eca('0x1f')]){logger['info'](_0x2eca('0x2a'));return _[_0x2eca('0x21')](_0x375d38,{'phone':_0x1539e0});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2eca('0xd')](_0x2eca('0x29'),_0x32bf62[_0x2eca('0x1e')]),'method':_0x2eca('0x1a'),'body':{'name':_0x40bee0,'phone':_0x1539e0}})['then'](function(_0x1eb6ce){logger[_0x2eca('0x1c')](_0x2eca('0x2b'));return _0x1eb6ce;});}});}function getAuth(_0x5922a1){return util[_0x2eca('0xd')](_0x2eca('0x2c'),new Buffer(_0x5922a1['apiKey']+':X')[_0x2eca('0x2d')](_0x2eca('0x2e')));}function request(_0x28eed0){logger[_0x2eca('0x2f')]('[HTTP]',JSON[_0x2eca('0x30')](_0x28eed0));return rp(_['defaults'](_0x28eed0,{'method':_0x2eca('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x54c7b1,_0x3d0997){var _0x576748=[];if(_0x54c7b1&&_0x54c7b1[_0x2eca('0x1f')]>0x0){_0x576748=_[_0x2eca('0x32')](_0x54c7b1,_0x3d0997);}return _0x576748;}function getCustomFields(_0x48f312,_0x3dbcda){var _0x2ff2a0=[];var _0x2de7d8={'custom_fields':[]};if(_0x48f312[_0x2eca('0x1f')]>0x0){_['forEach'](_0x48f312,function(_0x117af1){if(_[_0x2eca('0x33')]([_0x2eca('0x34'),_0x2eca('0x35')],_0x117af1['type'])&&_0x117af1[_0x2eca('0x36')]&&!_0x117af1[_0x2eca('0x37')]){_0x2de7d8[_0x117af1[_0x2eca('0x36')]['toLowerCase']()]=_0x117af1['content'][_0x2eca('0x2d')]();}else if(_[_0x2eca('0x33')]([_0x2eca('0x34'),_0x2eca('0x35')],_0x117af1[_0x2eca('0x38')])&&_0x117af1[_0x2eca('0x39')]&&_0x117af1[_0x2eca('0x37')]){_0x2de7d8[_0x2eca('0x16')]['push']({'id':_0x117af1[_0x2eca('0x39')],'value':_0x117af1[_0x2eca('0x3a')][_0x2eca('0x2d')]()});}else if(_0x117af1['type']==='variable'&&_0x117af1[_0x2eca('0x3b')]&&_0x117af1[_0x2eca('0x39')]&&_0x117af1[_0x2eca('0x37')]){_0x3dbcda[_0x117af1[_0x2eca('0x3b')]]&&_0x2de7d8[_0x2eca('0x16')][_0x2eca('0x3c')]({'id':_0x117af1[_0x2eca('0x39')],'value':_0x3dbcda[_0x117af1[_0x2eca('0x3b')]][_0x2eca('0x2d')]()});}else if(_0x117af1[_0x2eca('0x38')]===_0x2eca('0x3d')&&_0x117af1[_0x2eca('0x3e')]&&_0x117af1[_0x2eca('0x3e')][_0x2eca('0x15')]&&_0x117af1[_0x2eca('0x39')]&&_0x117af1[_0x2eca('0x37')]){_0x3dbcda[_0x117af1[_0x2eca('0x3e')][_0x2eca('0x15')][_0x2eca('0x3f')]()]&&_0x2de7d8['custom_fields'][_0x2eca('0x3c')]({'id':_0x117af1[_0x2eca('0x39')],'value':_0x3dbcda[_0x117af1[_0x2eca('0x3e')]['name'][_0x2eca('0x3f')]()][_0x2eca('0x2d')]()});}});}return _0x2de7d8;}exports[_0x2eca('0x40')]=function(_0x31a667,_0x282d04,_0x234f6d,_0x2a2bae,_0x4c3a9b,_0x1da3f8){var _0x5efeaf,_0xfb97f3;_0x1da3f8[_0x2eca('0x1e')]=intUtil[_0x2eca('0x41')](_0x1da3f8['remoteUri']);_0x1da3f8['serverUrl']=intUtil[_0x2eca('0x41')](_0x1da3f8['serverUrl']);if(_0x4c3a9b&&_0x4c3a9b['monitor_format']){logger[_0x2eca('0x1c')](_0x2eca('0x42'),_0x2eca('0x43'));_0x282d04[_0x2eca('0x44')]=util[_0x2eca('0xd')](_0x2eca('0x45'),_0x1da3f8[_0x2eca('0x46')],_0x282d04[_0x2eca('0x47')],md5(_0x282d04['uniqueid']));}else{_0x282d04['recordingURL']='';}headers['Authorization']=getAuth(_0x1da3f8);return getUser(_0x1da3f8,_0x2a2bae[_0x2eca('0x23')])[_0x2eca('0x1b')](function(_0x5bc08a){_0x5efeaf=_0x5bc08a;logger[_0x2eca('0x1c')](_0x2eca('0x48'),_0x5efeaf['id']);return getEndUser(_0x1da3f8,_0x282d04['calleridname'],_0x282d04[_0x2eca('0x10')]);})[_0x2eca('0x1b')](function(_0x2906de){_0xfb97f3=_0x2906de;logger[_0x2eca('0x1c')](_0x2eca('0x49'),_0xfb97f3['id']);return getTicket(_0x1da3f8,_0x5efeaf,_0xfb97f3,_0x234f6d,_0x282d04);})[_0x2eca('0x1b')](function(_0x5ee974){if(_0x5ee974&&_0x5ee974['id']){logger[_0x2eca('0x1c')](_0x2eca('0x1d'));logger[_0x2eca('0x1c')](_0x2eca('0x4a'),_0x5ee974['id']);logger[_0x2eca('0x1c')](_0x2eca('0x42'),_0x2eca('0x4b'));emit(util['format'](_0x2eca('0x4c'),_0x2a2bae['name']),_0x2eca('0x4d'),{'uri':util[_0x2eca('0xd')](_0x2eca('0x4e'),_0x1da3f8[_0x2eca('0x1e')],_0x5ee974['id'])});}})['catch'](function(_0x590348){logger[_0x2eca('0x4f')]('[QUEUE]',JSON[_0x2eca('0x30')](_0x590348));});};exports[_0x2eca('0x50')]=function(_0x4e3f19,_0x39b22f,_0xb361f9,_0x32176b,_0x1f51ae,_0x172fc8,_0x536e83){var _0x50fdeb,_0x20b664;_0x172fc8[_0x2eca('0x1e')]=intUtil[_0x2eca('0x41')](_0x172fc8['remoteUri']);_0x172fc8['serverUrl']=intUtil[_0x2eca('0x41')](_0x172fc8['serverUrl']);if(_0x536e83&&_0x536e83[_0x2eca('0x51')]&&_0x536e83[_0x2eca('0x51')]!=='none'){logger[_0x2eca('0x1c')](_0x2eca('0x52'),_0x2eca('0x43'));_0x39b22f[_0x2eca('0x44')]=util[_0x2eca('0xd')](_0x2eca('0x45'),_0x172fc8[_0x2eca('0x46')],_0x39b22f[_0x2eca('0x47')],md5(_0x39b22f[_0x2eca('0x47')]));}headers[_0x2eca('0x53')]=getAuth(_0x172fc8);return getUser(_0x172fc8,_0x32176b[_0x2eca('0x23')])[_0x2eca('0x1b')](function(_0xaf58c5){_0x50fdeb=_0xaf58c5;logger[_0x2eca('0x1c')]('The\x20User\x20ID\x20is:',_0x50fdeb['id']);return getEndUser(_0x172fc8,_0x39b22f['destcalleridname'],_0x39b22f['destcalleridnum']);})[_0x2eca('0x1b')](function(_0x5ab5aa){_0x20b664=_0x5ab5aa;logger[_0x2eca('0x1c')](_0x2eca('0x49'),_0x20b664['id']);return getTicket(_0x172fc8,_0x50fdeb,_0x20b664,_0xb361f9,_0x39b22f);})[_0x2eca('0x1b')](function(_0xaa005d){if(_0xaa005d&&_0xaa005d['id']){logger[_0x2eca('0x1c')](_0x2eca('0x1d'));logger[_0x2eca('0x1c')](_0x2eca('0x4a'),_0xaa005d['id']);logger[_0x2eca('0x1c')](_0x2eca('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2eca('0x4c'),_0x32176b[_0x2eca('0x15')]),_0x2eca('0x4d'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x172fc8[_0x2eca('0x1e')],_0xaa005d['id'])});}})[_0x2eca('0x54')](function(_0x41f9a7){logger[_0x2eca('0x4f')](_0x2eca('0x52'),JSON[_0x2eca('0x30')](_0x41f9a7));});};exports[_0x2eca('0x55')]=function(_0x24700b,_0x1eeb26,_0x91e4b2,_0x10d8a0,_0x84dc88,_0x3f158a){var _0x46d81,_0x355561;_0x3f158a[_0x2eca('0x1e')]=intUtil['stripTrailingSlash'](_0x3f158a[_0x2eca('0x1e')]);_0x3f158a[_0x2eca('0x46')]=intUtil[_0x2eca('0x41')](_0x3f158a[_0x2eca('0x46')]);if(_0x84dc88&&_0x84dc88[_0x2eca('0x56')]){logger[_0x2eca('0x1c')]('['+_0x1eeb26[_0x2eca('0x57')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1eeb26[_0x2eca('0x44')]=util[_0x2eca('0xd')](_0x2eca('0x45'),_0x3f158a[_0x2eca('0x46')],_0x1eeb26[_0x2eca('0x47')],md5(_0x1eeb26[_0x2eca('0x47')]));}else{_0x1eeb26[_0x2eca('0x44')]='';}headers[_0x2eca('0x53')]=getAuth(_0x3f158a);return getUser(_0x3f158a,'')[_0x2eca('0x1b')](function(_0x3ec1a5){_0x46d81=_0x3ec1a5;logger[_0x2eca('0x1c')](_0x2eca('0x48'),_0x46d81['id']);return getEndUser(_0x3f158a,_0x1eeb26[_0x2eca('0xf')],_0x1eeb26[_0x2eca('0x10')]);})[_0x2eca('0x1b')](function(_0x4bdcf8){_0x355561=_0x4bdcf8;logger[_0x2eca('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x355561['id']);return getTicket(_0x3f158a,_0x46d81,_0x355561,_0x91e4b2,_0x1eeb26);})[_0x2eca('0x1b')](function(_0x134f6a){if(_0x134f6a){logger[_0x2eca('0x1c')]('Ticket\x20created!');logger[_0x2eca('0x1c')](_0x2eca('0x4a'),_0x134f6a['id']);}})[_0x2eca('0x54')](function(_0x4cf36a){logger[_0x2eca('0x4f')]('['+_0x1eeb26[_0x2eca('0x57')]['toUpperCase']()+']',JSON[_0x2eca('0x30')](_0x4cf36a));});}; \ No newline at end of file +var _0xa94f=['[HTTP]','stringify','GET','length','map','forEach','includes','picklist','type','nameField','customField','content','string','idField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','error','unmanaged','lastevent','request-promise','md5','util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug'];(function(_0xa60351,_0x1ce888){var _0x59f0d5=function(_0x14dd6e){while(--_0x14dd6e){_0xa60351['push'](_0xa60351['shift']());}};_0x59f0d5(++_0x1ce888);}(_0xa94f,0x146));var _0xfa94=function(_0x5ca41b,_0x4f5169){_0x5ca41b=_0x5ca41b-0x0;var _0x2c2cf1=_0xa94f[_0x5ca41b];return _0x2c2cf1;};'use strict';var _=require('lodash');var rp=require(_0xfa94('0x0'));var md5=require(_0xfa94('0x1'));var util=require(_0xfa94('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xfa94('0x3'));var logger=require('../../../../config/logger')('freshdesk');config[_0xfa94('0x4')]=_[_0xfa94('0x5')](config[_0xfa94('0x4')],{'host':_0xfa94('0x6'),'port':0x18eb});var io=require(_0xfa94('0x7'))(new Redis(config['redis']));var headers={'Content-Type':_0xfa94('0x8'),'Accept':'application/json'};function emit(_0x234171,_0x589764,_0x5a73fc){io['to'](_0x234171)[_0xfa94('0x9')](_0x589764,_0x5a73fc);}function getTicket(_0xcea0f,_0x4bea65,_0x542e69,_0x29f773,_0x5f3061){logger[_0xfa94('0xa')](_0xfa94('0xb'));var _0x2e8a74=_['merge']({'responder_id':_0x4bea65['id'],'requester_id':_0x542e69['id'],'name':util[_0xfa94('0xc')](_0xfa94('0xd'),_0x5f3061[_0xfa94('0xe')]),'phone':_0x5f3061[_0xfa94('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xfa94('0x10')](_0x29f773[_0xfa94('0x11')],_0x5f3061,'\x20'),'description':intUtil['getString'](_0x29f773[_0xfa94('0x12')],_0x5f3061,_0xfa94('0x13')),'tags':getTags(_0x29f773[_0xfa94('0x14')],_0xfa94('0x15'))},getCustomFields(_0x29f773[_0xfa94('0x16')],_0x5f3061));_0x2e8a74[_0xfa94('0x17')]=_[_0xfa94('0x18')](_[_0xfa94('0x19')](_0x2e8a74[_0xfa94('0x17')],'id'),_0xfa94('0x1a'));return request({'uri':util[_0xfa94('0xc')](_0xfa94('0x1b'),_0xcea0f[_0xfa94('0x1c')]),'method':_0xfa94('0x1d'),'body':_0x2e8a74})['then'](function(_0x545a56){logger[_0xfa94('0xa')](_0xfa94('0x1e'));return _0x545a56;});}function getUser(_0x1b517f,_0x143b32){if(intUtil['validateEmail'](_0x143b32)){return request({'uri':util['format'](_0xfa94('0x1f'),_0x1b517f[_0xfa94('0x1c')]),'qs':{'email':_0x143b32}})['then'](function(_0x2cb6af){if(_0x2cb6af['length']){logger['info'](_0xfa94('0x20'));return _[_0xfa94('0x21')](_0x2cb6af,function(_0x2d3610){return _0x2d3610[_0xfa94('0x22')][_0xfa94('0x23')]===_0x143b32;});}else{logger['info'](_0xfa94('0x24'));return request({'uri':util[_0xfa94('0xc')](_0xfa94('0x25'),_0x1b517f[_0xfa94('0x1c')])})[_0xfa94('0x26')](function(_0x22cdb1){logger[_0xfa94('0xa')](_0xfa94('0x27'));return _0x22cdb1;});}});}else{logger['info'](_0xfa94('0x28'));return request({'uri':util['format'](_0xfa94('0x25'),_0x1b517f['remoteUri'])})['then'](function(_0x19516d){logger[_0xfa94('0xa')](_0xfa94('0x27'));return _0x19516d;});}}function getEndUser(_0x1d452d,_0x5b047c,_0x17d572){logger['info'](_0xfa94('0x29'),_0x17d572);return request({'uri':util[_0xfa94('0xc')](_0xfa94('0x2a'),_0x1d452d[_0xfa94('0x1c')]),'qs':{'phone':_0x17d572}})[_0xfa94('0x26')](function(_0x278c3f){if(_0x278c3f['length']){logger[_0xfa94('0xa')]('Enduser\x20found!');return _[_0xfa94('0x21')](_0x278c3f,{'phone':_0x17d572});}else{logger[_0xfa94('0xa')](_0xfa94('0x2b'));return request({'uri':util[_0xfa94('0xc')](_0xfa94('0x2a'),_0x1d452d[_0xfa94('0x1c')]),'method':_0xfa94('0x1d'),'body':{'name':_0x5b047c,'phone':_0x17d572}})[_0xfa94('0x26')](function(_0x15c5c6){logger[_0xfa94('0xa')](_0xfa94('0x2c'));return _0x15c5c6;});}});}function getAuth(_0x43e66b){return util[_0xfa94('0xc')](_0xfa94('0x2d'),new Buffer(_0x43e66b[_0xfa94('0x2e')]+':X')[_0xfa94('0x2f')](_0xfa94('0x30')));}function request(_0x54df24){logger[_0xfa94('0x31')](_0xfa94('0x32'),JSON[_0xfa94('0x33')](_0x54df24));return rp(_[_0xfa94('0x5')](_0x54df24,{'method':_0xfa94('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x1e33bc,_0x4c66b3){var _0xf88cd1=[];if(_0x1e33bc&&_0x1e33bc[_0xfa94('0x35')]>0x0){_0xf88cd1=_[_0xfa94('0x36')](_0x1e33bc,_0x4c66b3);}return _0xf88cd1;}function getCustomFields(_0x482730,_0x3e9fc1){var _0x54b706=[];var _0x1bbc9c={'custom_fields':[]};if(_0x482730['length']>0x0){_[_0xfa94('0x37')](_0x482730,function(_0x193b0f){if(_[_0xfa94('0x38')](['string',_0xfa94('0x39')],_0x193b0f[_0xfa94('0x3a')])&&_0x193b0f[_0xfa94('0x3b')]&&!_0x193b0f[_0xfa94('0x3c')]){_0x1bbc9c[_0x193b0f[_0xfa94('0x3b')]['toLowerCase']()]=_0x193b0f[_0xfa94('0x3d')][_0xfa94('0x2f')]();}else if(_[_0xfa94('0x38')]([_0xfa94('0x3e'),_0xfa94('0x39')],_0x193b0f[_0xfa94('0x3a')])&&_0x193b0f[_0xfa94('0x3f')]&&_0x193b0f[_0xfa94('0x3c')]){_0x1bbc9c[_0xfa94('0x17')][_0xfa94('0x40')]({'id':_0x193b0f['idField'],'value':_0x193b0f['content'][_0xfa94('0x2f')]()});}else if(_0x193b0f[_0xfa94('0x3a')]===_0xfa94('0x41')&&_0x193b0f['variableName']&&_0x193b0f['idField']&&_0x193b0f[_0xfa94('0x3c')]){_0x3e9fc1[_0x193b0f[_0xfa94('0x42')]]&&_0x1bbc9c[_0xfa94('0x17')][_0xfa94('0x40')]({'id':_0x193b0f[_0xfa94('0x3f')],'value':_0x3e9fc1[_0x193b0f[_0xfa94('0x42')]][_0xfa94('0x2f')]()});}else if(_0x193b0f[_0xfa94('0x3a')]===_0xfa94('0x43')&&_0x193b0f[_0xfa94('0x44')]&&_0x193b0f[_0xfa94('0x44')]['name']&&_0x193b0f[_0xfa94('0x3f')]&&_0x193b0f[_0xfa94('0x3c')]){_0x3e9fc1[_0x193b0f[_0xfa94('0x44')]['name'][_0xfa94('0x45')]()]&&_0x1bbc9c['custom_fields'][_0xfa94('0x40')]({'id':_0x193b0f['idField'],'value':_0x3e9fc1[_0x193b0f[_0xfa94('0x44')]['name']['toLowerCase']()][_0xfa94('0x2f')]()});}});}return _0x1bbc9c;}exports[_0xfa94('0x46')]=function(_0x46d82a,_0x440708,_0xb23b80,_0x1104ff,_0x15c429,_0xd16f5f){var _0x1ddb50,_0x3890ea;_0xd16f5f[_0xfa94('0x1c')]=intUtil[_0xfa94('0x47')](_0xd16f5f['remoteUri']);_0xd16f5f[_0xfa94('0x48')]=intUtil[_0xfa94('0x47')](_0xd16f5f[_0xfa94('0x48')]);if(_0x15c429&&_0x15c429[_0xfa94('0x49')]){logger['info']('[QUEUE]',_0xfa94('0x4a'));_0x440708[_0xfa94('0x4b')]=util['format'](_0xfa94('0x4c'),_0xd16f5f['serverUrl'],_0x440708[_0xfa94('0x4d')],md5(_0x440708[_0xfa94('0x4d')]));}else{_0x440708[_0xfa94('0x4b')]='';}headers[_0xfa94('0x4e')]=getAuth(_0xd16f5f);return getUser(_0xd16f5f,_0x1104ff[_0xfa94('0x23')])['then'](function(_0x21b5f8){_0x1ddb50=_0x21b5f8;logger[_0xfa94('0xa')](_0xfa94('0x4f'),_0x1ddb50['id']);return getEndUser(_0xd16f5f,_0x440708['calleridname'],_0x440708[_0xfa94('0xf')]);})[_0xfa94('0x26')](function(_0x58ceda){_0x3890ea=_0x58ceda;logger[_0xfa94('0xa')](_0xfa94('0x50'),_0x3890ea['id']);return getTicket(_0xd16f5f,_0x1ddb50,_0x3890ea,_0xb23b80,_0x440708);})[_0xfa94('0x26')](function(_0x621dd){if(_0x621dd&&_0x621dd['id']){logger[_0xfa94('0xa')](_0xfa94('0x1e'));logger[_0xfa94('0xa')](_0xfa94('0x51'),_0x621dd['id']);logger[_0xfa94('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xfa94('0x52'),_0x1104ff['name']),'trigger:browser:url',{'uri':util['format'](_0xfa94('0x53'),_0xd16f5f[_0xfa94('0x1c')],_0x621dd['id'])});}})[_0xfa94('0x54')](function(_0x17310a){logger['error'](_0xfa94('0x55'),JSON[_0xfa94('0x33')](_0x17310a));});};exports[_0xfa94('0x56')]=function(_0x27365b,_0x2ab561,_0x2b3c0b,_0x383a01,_0x4936d1,_0x46623e,_0x46ed02){var _0x1c92d0,_0x30d4df;_0x46623e['remoteUri']=intUtil[_0xfa94('0x47')](_0x46623e[_0xfa94('0x1c')]);_0x46623e[_0xfa94('0x48')]=intUtil[_0xfa94('0x47')](_0x46623e[_0xfa94('0x48')]);if(_0x46ed02&&_0x46ed02['recordingFormat']&&_0x46ed02[_0xfa94('0x57')]!=='none'){logger[_0xfa94('0xa')](_0xfa94('0x58'),_0xfa94('0x4a'));_0x2ab561[_0xfa94('0x4b')]=util['format'](_0xfa94('0x4c'),_0x46623e['serverUrl'],_0x2ab561[_0xfa94('0x4d')],md5(_0x2ab561[_0xfa94('0x4d')]));}headers[_0xfa94('0x4e')]=getAuth(_0x46623e);return getUser(_0x46623e,_0x383a01[_0xfa94('0x23')])[_0xfa94('0x26')](function(_0xc153cf){_0x1c92d0=_0xc153cf;logger['info'](_0xfa94('0x4f'),_0x1c92d0['id']);return getEndUser(_0x46623e,_0x2ab561[_0xfa94('0x59')],_0x2ab561[_0xfa94('0x5a')]);})['then'](function(_0x19f08d){_0x30d4df=_0x19f08d;logger[_0xfa94('0xa')](_0xfa94('0x50'),_0x30d4df['id']);return getTicket(_0x46623e,_0x1c92d0,_0x30d4df,_0x2b3c0b,_0x2ab561);})['then'](function(_0x235404){if(_0x235404&&_0x235404['id']){logger[_0xfa94('0xa')]('Ticket\x20created!');logger[_0xfa94('0xa')](_0xfa94('0x51'),_0x235404['id']);logger[_0xfa94('0xa')](_0xfa94('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfa94('0xc')](_0xfa94('0x52'),_0x383a01['name']),'trigger:browser:url',{'uri':util[_0xfa94('0xc')](_0xfa94('0x53'),_0x46623e[_0xfa94('0x1c')],_0x235404['id'])});}})[_0xfa94('0x54')](function(_0x50f137){logger[_0xfa94('0x5b')](_0xfa94('0x58'),JSON[_0xfa94('0x33')](_0x50f137));});};exports[_0xfa94('0x5c')]=function(_0x572f08,_0x256513,_0x1af350,_0x11ab71,_0x28b029,_0x310a5e){var _0x55ce38,_0x44f21e;_0x310a5e[_0xfa94('0x1c')]=intUtil[_0xfa94('0x47')](_0x310a5e['remoteUri']);_0x310a5e[_0xfa94('0x48')]=intUtil[_0xfa94('0x47')](_0x310a5e[_0xfa94('0x48')]);if(_0x28b029&&_0x28b029[_0xfa94('0x49')]){logger[_0xfa94('0xa')]('['+_0x256513['lastevent']['toUpperCase']()+']',_0xfa94('0x4a'));_0x256513[_0xfa94('0x4b')]=util['format'](_0xfa94('0x4c'),_0x310a5e['serverUrl'],_0x256513['uniqueid'],md5(_0x256513[_0xfa94('0x4d')]));}else{_0x256513[_0xfa94('0x4b')]='';}headers[_0xfa94('0x4e')]=getAuth(_0x310a5e);return getUser(_0x310a5e,'')[_0xfa94('0x26')](function(_0x5dd38f){_0x55ce38=_0x5dd38f;logger[_0xfa94('0xa')](_0xfa94('0x4f'),_0x55ce38['id']);return getEndUser(_0x310a5e,_0x256513[_0xfa94('0xe')],_0x256513[_0xfa94('0xf')]);})['then'](function(_0x53b382){_0x44f21e=_0x53b382;logger['info']('The\x20Enduser\x20ID\x20is:',_0x44f21e['id']);return getTicket(_0x310a5e,_0x55ce38,_0x44f21e,_0x1af350,_0x256513);})[_0xfa94('0x26')](function(_0x59cce0){if(_0x59cce0){logger[_0xfa94('0xa')](_0xfa94('0x1e'));logger[_0xfa94('0xa')](_0xfa94('0x51'),_0x59cce0['id']);}})[_0xfa94('0x54')](function(_0x295d8d){logger[_0xfa94('0x5b')]('['+_0x256513[_0xfa94('0x5d')]['toUpperCase']()+']',JSON[_0xfa94('0x33')](_0x295d8d));});}; \ 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 a0e9fe3..8757396 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 _0xdc9b=['queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','headers','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','User\x20found:','userId','Admin\x20selected','userEmail','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdc9b,0xbe));var _0xbdc9=function(_0x3035d8,_0xf9215b){_0x3035d8=_0x3035d8-0x0;var _0x3bc195=_0xdc9b[_0x3035d8];return _0x3bc195;};'use strict';var _=require(_0xbdc9('0x0'));var rp=require(_0xbdc9('0x1'));var md5=require(_0xbdc9('0x2'));var util=require(_0xbdc9('0x3'));var moment=require(_0xbdc9('0x4'));var Promise=require(_0xbdc9('0x5'));var Redis=require(_0xbdc9('0x6'));var intUtil=require('./util');var config=require(_0xbdc9('0x7'));var logger=require(_0xbdc9('0x8'))(_0xbdc9('0x9'));config[_0xbdc9('0xa')]=_[_0xbdc9('0xb')](config[_0xbdc9('0xa')],{'host':_0xbdc9('0xc'),'port':0x18eb});var io=require(_0xbdc9('0xd'))(new Redis(config[_0xbdc9('0xa')]));function getAdminId(_0x5a7c00,_0x138e9c,_0x5ee559,_0x42faed){return new Promise(function(_0x1dd166,_0x53ae9b){var _0x4ad3ae=![];var _0x1f7d7a={'method':'GET','uri':_0x42faed+_0xbdc9('0xe'),'json':!![]};_0x1f7d7a['headers']=_0x5ee559;logger[_0xbdc9('0xf')](_0xbdc9('0x10'));return rp(_0x1f7d7a)['then'](function(_0x21ea46){if(_0x21ea46){var _0xaef2e9=_0x21ea46['users'];var _0x59833b=null;for(_0x59833b=0x0;_0x59833b<_0xaef2e9[_0xbdc9('0x11')];_0x59833b++){if(_0xaef2e9[_0x59833b][_0xbdc9('0x12')]===_0x5a7c00[_0xbdc9('0x13')]){_0x5a7c00['adminId']=_0xaef2e9[_0x59833b]['id'];_0x4ad3ae=!![];}}if(_0x4ad3ae){logger['info'](_0xbdc9('0x14'),_0x5a7c00[_0xbdc9('0x15')]);_0x1dd166(_0x5a7c00);}else{_0x53ae9b({'statusCode':0x194,'message':_0xbdc9('0x16')});}}else{_0x53ae9b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xbdc9('0x17')](function(_0x331db7){logger[_0xbdc9('0x18')]('['+[_0x138e9c[_0xbdc9('0x19')]()]+']',_0x331db7['message']);_0x53ae9b(_0x331db7);});});}function getUser(_0x33dcab,_0x4d4fa0,_0x9c48c5){return function(_0x20e4d2){return new Promise(function(_0x5de90c,_0x271766){var _0xa54bd5={'method':_0xbdc9('0x1a'),'uri':_0x9c48c5+_0xbdc9('0xe'),'json':!![]};_0xa54bd5[_0xbdc9('0x1b')]=_0x4d4fa0;logger['info'](_0xbdc9('0x1c'));return rp(_0xa54bd5)[_0xbdc9('0x1d')](function(_0xa2c918){if(_0xa2c918){var _0x895cb5=_0xa2c918['users'];var _0x13844a=![];var _0xf4ab3a=null;if(_0x20e4d2['agentEmail']!==null){logger[_0xbdc9('0xf')](_0xbdc9('0x1e'),_0x20e4d2[_0xbdc9('0x1f')]);_0x20e4d2['userEmail']=_0x20e4d2[_0xbdc9('0x1f')];for(_0xf4ab3a=0x0;_0xf4ab3a<_0x895cb5[_0xbdc9('0x11')];_0xf4ab3a++){if(_0x895cb5[_0xf4ab3a][_0xbdc9('0x12')]===_0x20e4d2['agentEmail']){_0x13844a=!![];_0x20e4d2['userId']=_0x895cb5[_0xf4ab3a]['id'];logger[_0xbdc9('0xf')](_0xbdc9('0x20'),_0x20e4d2[_0xbdc9('0x21')]);}}}if(!_0x13844a){logger[_0xbdc9('0xf')](_0xbdc9('0x22'));_0x20e4d2[_0xbdc9('0x23')]=_0x20e4d2[_0xbdc9('0x13')];_0x20e4d2[_0xbdc9('0x21')]=_0x20e4d2[_0xbdc9('0x15')];_0x13844a=!![];}if(_0x13844a){_0x5de90c(_0x20e4d2);}else{_0x271766({'statusCode':0x194,'message':_0xbdc9('0x16')});}}else{_0x271766({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xbdc9('0x17')](function(_0x23fd76){logger[_0xbdc9('0x18')]('['+[_0x33dcab['toUpperCase']()]+']',_0x23fd76[_0xbdc9('0x24')]);_0x271766(_0x23fd76);});});};}function searchContact(_0x5bbdff,_0x8910a,_0x15989f,_0x11ec24){return new Promise(function(_0x1e034b,_0x3ca84b){var _0x22e285={'method':'GET','headers':_0x8910a,'uri':_0x5bbdff+_0xbdc9('0x25')+_0x11ec24+_0xbdc9('0x26')+_0x15989f+_0xbdc9('0x27'),'json':!![]};rp(_0x22e285)[_0xbdc9('0x1d')](function(_0xf1f436){var _0x2d3773=_[_0xbdc9('0x28')](_0xf1f436[_0xbdc9('0x29')][_0xbdc9('0x29')],[_0x15989f,_0x11ec24]);_0x1e034b(_0x2d3773);})[_0xbdc9('0x17')](function(_0xfbdbfa){_0x3ca84b(_0xfbdbfa);});});}function getEndUser(_0x1ea6da,_0x1b7c87,_0x4ff8d4){return function(_0xe40817){return new Promise(function(_0x3b412d,_0x5dd42a){logger[_0xbdc9('0xf')](util[_0xbdc9('0x2a')](_0xbdc9('0x2b'),_0xe40817['contactNumber']));searchContact(_0x4ff8d4,_0x1b7c87,_0xbdc9('0x2c'),_0xe40817[_0xbdc9('0x2d')])['then'](function(_0x52b4fa){if(_0x52b4fa){_0xe40817['endUserId']=_0x52b4fa['id'];logger[_0xbdc9('0xf')](_0xbdc9('0x2e'),_0xe40817[_0xbdc9('0x2f')]);return _0x3b412d(_0xe40817);}searchContact(_0x4ff8d4,_0x1b7c87,_0xbdc9('0x30'),_0xe40817[_0xbdc9('0x2d')])[_0xbdc9('0x1d')](function(_0x4eac4f){if(_0x4eac4f){_0xe40817['endUserId']=_0x4eac4f['id'];logger[_0xbdc9('0xf')]('Contact\x20found\x20work_number:',_0xe40817[_0xbdc9('0x2f')]);return _0x3b412d(_0xe40817);}createEndUser(_0xe40817,_0x1ea6da,_0x1b7c87,_0x4ff8d4)['then'](function(_0x20e3b2){logger['info']('Contact\x20created:',_0x20e3b2[_0xbdc9('0x2f')]);return _0x3b412d(_0x20e3b2);});});})[_0xbdc9('0x17')](function(_0x35f146){_0x5dd42a(_0x35f146);});});};}function createEndUser(_0xe411d4,_0x2f059c,_0x31d848,_0x4b9e79){return new Promise(function(_0x49fb8a,_0x3a7e25){var _0x16f49b=moment();var _0xe83d02={'method':_0xbdc9('0x31'),'uri':_0x4b9e79+_0xbdc9('0x32'),'body':{'contact':{'last_name':_0xe411d4[_0xbdc9('0x2d')],'work_number':_0xe411d4[_0xbdc9('0x2d')],'mobile_number':_0xe411d4[_0xbdc9('0x2d')],'owner_id':_0xe411d4[_0xbdc9('0x21')],'created_at':_0x16f49b[_0xbdc9('0x2a')](_0xbdc9('0x33'))}},'json':!![]};_0xe83d02[_0xbdc9('0x1b')]=_0x31d848;logger[_0xbdc9('0xf')](_0xbdc9('0x34'));return rp(_0xe83d02)[_0xbdc9('0x1d')](function(_0x19dc4c){_0xe411d4['endUserId']=_0x19dc4c['contact']['id'];_0x49fb8a(_0xe411d4);})[_0xbdc9('0x17')](function(_0x888bf2){logger['error']('['+[_0x2f059c['toUpperCase']()]+']',_0x888bf2['message']);_0x3a7e25(_0x888bf2[_0xbdc9('0x24')]);});});}function getTicket(_0x3c41a6,_0x381831,_0x182edb,_0xcf4b5,_0x174ec6){return function(_0x5d0ef5){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x5c005a,_0x11dc68){var _0x291ad3=moment();var _0x38b685={'method':_0xbdc9('0x31'),'uri':_0x182edb+_0xbdc9('0x35'),'body':{'title':intUtil[_0xbdc9('0x36')](_0xcf4b5[_0xbdc9('0x37')],_0x174ec6,'\x20'),'description':intUtil['getString'](_0xcf4b5[_0xbdc9('0x38')],_0x174ec6,'\x0a'),'owner_id':_0x5d0ef5[_0xbdc9('0x21')],'creater_id':_0x5d0ef5[_0xbdc9('0x15')],'targetable_id':_0x5d0ef5['endUserId'],'targetable_type':_0xbdc9('0x39'),'created_at':_0x291ad3[_0xbdc9('0x2a')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x291ad3[_0xbdc9('0x3a')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x38b685[_0xbdc9('0x1b')]=_0x381831;return rp(_0x38b685)['then'](function(_0x454193){_0x5d0ef5[_0xbdc9('0x3b')]=_0x454193[_0xbdc9('0x3c')]['id'];logger[_0xbdc9('0xf')](_0xbdc9('0x3d'),_0x5d0ef5[_0xbdc9('0x3b')]);_0x5c005a(_0x5d0ef5);})[_0xbdc9('0x17')](function(_0x3e5aae){logger['error']('['+[_0x3c41a6['toUpperCase']()]+']',_0x3e5aae[_0xbdc9('0x24')]);_0x11dc68(_0x3e5aae[_0xbdc9('0x24')]);});});};}function emit(_0x231ba2,_0x9d3a08,_0x5d5e88){var _0x3f6aa7={'uri':_0x231ba2+'/contacts/'+_0x5d5e88};io['to'](util[_0xbdc9('0x2a')](_0xbdc9('0x3e'),_0x9d3a08))[_0xbdc9('0x3f')](_0xbdc9('0x40'),_0x3f6aa7);}exports['cs']=function(_0x238dac,_0x2952f8,_0x31cd42,_0x41b80c,_0x5a39c2,_0x5572c0,_0x2358cf,_0x556a00){var _0x42b335={};var _0x4e3849={'Authorization':_0xbdc9('0x41')+_0x5572c0['apiKey']};_0x5572c0['remoteUri']=intUtil['stripTrailingSlash'](_0x5572c0[_0xbdc9('0x42')]);_0x5572c0['serverUrl']=intUtil[_0xbdc9('0x43')](_0x5572c0['serverUrl']);var _0x17aede=_0x5572c0[_0xbdc9('0x42')];_0x42b335[_0xbdc9('0x13')]=_0x5572c0[_0xbdc9('0x44')];_0x42b335[_0xbdc9('0x2d')]=_0x556a00[_0xbdc9('0x45')]()===_0xbdc9('0x46')?_0x2952f8[_0xbdc9('0x47')]:_0x2952f8[_0xbdc9('0x48')];_0x42b335[_0xbdc9('0x49')]=_0x556a00==='queue'||_0x556a00==='unmanaged'?_0xbdc9('0x4a'):_0xbdc9('0x46');if(_0x41b80c){_0x42b335[_0xbdc9('0x1f')]=_0x41b80c['email'];}var _0x4a1938=util[_0xbdc9('0x2a')](_0xbdc9('0x4b'),_0x5572c0[_0xbdc9('0x4c')],_0x2952f8['uniqueid'],md5(_0x2952f8[_0xbdc9('0x4d')]));if(_0x5a39c2&&_0x5a39c2[_0xbdc9('0x4e')]){logger[_0xbdc9('0xf')](_0xbdc9('0x4f'),_0xbdc9('0x50'));_0x2952f8[_0xbdc9('0x51')]=_0x4a1938;}else if(_0x2358cf&&_0x2358cf['recordingFormat']&&_0x2358cf['recordingFormat']!=='none'){logger['info'](_0xbdc9('0x52'),'Recording\x20is\x20enabled!');_0x2952f8[_0xbdc9('0x51')]=_0x4a1938;}else{_0x2952f8[_0xbdc9('0x51')]='';}return getAdminId(_0x42b335,_0x556a00,_0x4e3849,_0x17aede)[_0xbdc9('0x1d')](getUser(_0x556a00,_0x4e3849,_0x17aede))[_0xbdc9('0x1d')](getEndUser(_0x556a00,_0x4e3849,_0x17aede))['then'](getTicket(_0x556a00,_0x4e3849,_0x17aede,_0x31cd42,_0x2952f8))[_0xbdc9('0x1d')](function(_0x58748f){logger[_0xbdc9('0xf')](util['format'](_0xbdc9('0x53'),_0x58748f[_0xbdc9('0x3b')]));if(_0x556a00!==_0xbdc9('0x54')){logger[_0xbdc9('0xf')]('['+[_0x556a00[_0xbdc9('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x17aede,_0x41b80c[_0xbdc9('0x55')],_0x58748f[_0xbdc9('0x2f')]);}})[_0xbdc9('0x17')](function(_0x27543f){logger['error']('['+[_0x556a00[_0xbdc9('0x19')]()]+_0xbdc9('0x56'),util[_0xbdc9('0x57')](_0x27543f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x965f=['none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','catch','error','/api/lookup?q=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','format','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','/contacts/','emit','trigger:browser:url','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0x965f,0x1b5));var _0xf965=function(_0x3d813d,_0x2dc642){_0x3d813d=_0x3d813d-0x0;var _0x3b522d=_0x965f[_0x3d813d];return _0x3b522d;};'use strict';var _=require(_0xf965('0x0'));var rp=require('request-promise');var md5=require(_0xf965('0x1'));var util=require(_0xf965('0x2'));var moment=require(_0xf965('0x3'));var Promise=require(_0xf965('0x4'));var Redis=require(_0xf965('0x5'));var intUtil=require(_0xf965('0x6'));var config=require('../../../../config/environment');var logger=require(_0xf965('0x7'))(_0xf965('0x8'));config[_0xf965('0x9')]=_[_0xf965('0xa')](config[_0xf965('0x9')],{'host':_0xf965('0xb'),'port':0x18eb});var io=require(_0xf965('0xc'))(new Redis(config['redis']));function getAdminId(_0x32b421,_0x334019,_0x49012a,_0xcbb44a){return new Promise(function(_0x373808,_0x1a5dab){var _0x42a8fc=![];var _0x94ee68={'method':_0xf965('0xd'),'uri':_0xcbb44a+_0xf965('0xe'),'json':!![]};_0x94ee68[_0xf965('0xf')]=_0x49012a;logger[_0xf965('0x10')](_0xf965('0x11'));return rp(_0x94ee68)['then'](function(_0x513947){if(_0x513947){var _0x20d71a=_0x513947[_0xf965('0x12')];var _0x42ac5c=null;for(_0x42ac5c=0x0;_0x42ac5c<_0x20d71a[_0xf965('0x13')];_0x42ac5c++){if(_0x20d71a[_0x42ac5c][_0xf965('0x14')]===_0x32b421[_0xf965('0x15')]){_0x32b421[_0xf965('0x16')]=_0x20d71a[_0x42ac5c]['id'];_0x42a8fc=!![];}}if(_0x42a8fc){logger[_0xf965('0x10')](_0xf965('0x17'),_0x32b421[_0xf965('0x16')]);_0x373808(_0x32b421);}else{_0x1a5dab({'statusCode':0x194,'message':_0xf965('0x18')});}}else{_0x1a5dab({'statusCode':0x194,'message':_0xf965('0x18')});}})['catch'](function(_0x28f384){logger['error']('['+[_0x334019[_0xf965('0x19')]()]+']',_0x28f384[_0xf965('0x1a')]);_0x1a5dab(_0x28f384);});});}function getUser(_0x1f00e9,_0x51d819,_0x3ea00b){return function(_0x51a958){return new Promise(function(_0x2916c3,_0xc5fd89){var _0x30a24c={'method':'GET','uri':_0x3ea00b+'/api/selector/owners','json':!![]};_0x30a24c[_0xf965('0xf')]=_0x51d819;logger['info'](_0xf965('0x1b'));return rp(_0x30a24c)[_0xf965('0x1c')](function(_0x4a7c9d){if(_0x4a7c9d){var _0x97a34f=_0x4a7c9d['users'];var _0x219a66=![];var _0x184512=null;if(_0x51a958[_0xf965('0x1d')]!==null){logger[_0xf965('0x10')]('Getting\x20user\x20with\x20email',_0x51a958[_0xf965('0x1d')]);_0x51a958[_0xf965('0x1e')]=_0x51a958[_0xf965('0x1d')];for(_0x184512=0x0;_0x184512<_0x97a34f[_0xf965('0x13')];_0x184512++){if(_0x97a34f[_0x184512][_0xf965('0x14')]===_0x51a958[_0xf965('0x1d')]){_0x219a66=!![];_0x51a958[_0xf965('0x1f')]=_0x97a34f[_0x184512]['id'];logger[_0xf965('0x10')](_0xf965('0x20'),_0x51a958[_0xf965('0x1f')]);}}}if(!_0x219a66){logger['info'](_0xf965('0x21'));_0x51a958['userEmail']=_0x51a958[_0xf965('0x15')];_0x51a958[_0xf965('0x1f')]=_0x51a958['adminId'];_0x219a66=!![];}if(_0x219a66){_0x2916c3(_0x51a958);}else{_0xc5fd89({'statusCode':0x194,'message':_0xf965('0x18')});}}else{_0xc5fd89({'statusCode':0x194,'message':_0xf965('0x18')});}})[_0xf965('0x22')](function(_0x213bc6){logger[_0xf965('0x23')]('['+[_0x1f00e9['toUpperCase']()]+']',_0x213bc6['message']);_0xc5fd89(_0x213bc6);});});};}function searchContact(_0x239c5d,_0x271fc6,_0xad8442,_0x1d6d08){return new Promise(function(_0x3ab151,_0x85e1b4){var _0x221e5c={'method':_0xf965('0xd'),'headers':_0x271fc6,'uri':_0x239c5d+_0xf965('0x24')+_0x1d6d08+'&f='+_0xad8442+'&entities=contact','json':!![]};rp(_0x221e5c)[_0xf965('0x1c')](function(_0x2a3b94){var _0x33dbe6=_[_0xf965('0x25')](_0x2a3b94[_0xf965('0x26')][_0xf965('0x26')],[_0xad8442,_0x1d6d08]);_0x3ab151(_0x33dbe6);})['catch'](function(_0x92b9f4){_0x85e1b4(_0x92b9f4);});});}function getEndUser(_0x197010,_0x7c56a4,_0x5568ce){return function(_0x4f2a5f){return new Promise(function(_0x1e3e27,_0x4647c0){logger[_0xf965('0x10')](util['format'](_0xf965('0x27'),_0x4f2a5f[_0xf965('0x28')]));searchContact(_0x5568ce,_0x7c56a4,_0xf965('0x29'),_0x4f2a5f[_0xf965('0x28')])[_0xf965('0x1c')](function(_0x139fe8){if(_0x139fe8){_0x4f2a5f[_0xf965('0x2a')]=_0x139fe8['id'];logger[_0xf965('0x10')](_0xf965('0x2b'),_0x4f2a5f[_0xf965('0x2a')]);return _0x1e3e27(_0x4f2a5f);}searchContact(_0x5568ce,_0x7c56a4,_0xf965('0x2c'),_0x4f2a5f[_0xf965('0x28')])[_0xf965('0x1c')](function(_0x50db51){if(_0x50db51){_0x4f2a5f[_0xf965('0x2a')]=_0x50db51['id'];logger[_0xf965('0x10')]('Contact\x20found\x20work_number:',_0x4f2a5f['endUserId']);return _0x1e3e27(_0x4f2a5f);}createEndUser(_0x4f2a5f,_0x197010,_0x7c56a4,_0x5568ce)[_0xf965('0x1c')](function(_0x4e6b43){logger[_0xf965('0x10')](_0xf965('0x2d'),_0x4e6b43['endUserId']);return _0x1e3e27(_0x4e6b43);});});})[_0xf965('0x22')](function(_0x5955b6){_0x4647c0(_0x5955b6);});});};}function createEndUser(_0x9f1d6b,_0x3ea6b9,_0x4b6c5f,_0x5cb233){return new Promise(function(_0x240c04,_0x58b83a){var _0x4e48d7=moment();var _0x592d5f={'method':_0xf965('0x2e'),'uri':_0x5cb233+'/api/contacts','body':{'contact':{'last_name':_0x9f1d6b[_0xf965('0x28')],'work_number':_0x9f1d6b['contactNumber'],'mobile_number':_0x9f1d6b[_0xf965('0x28')],'owner_id':_0x9f1d6b['userId'],'created_at':_0x4e48d7[_0xf965('0x2f')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x592d5f[_0xf965('0xf')]=_0x4b6c5f;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x592d5f)[_0xf965('0x1c')](function(_0x11aade){_0x9f1d6b[_0xf965('0x2a')]=_0x11aade[_0xf965('0x30')]['id'];_0x240c04(_0x9f1d6b);})[_0xf965('0x22')](function(_0x35f5e0){logger[_0xf965('0x23')]('['+[_0x3ea6b9[_0xf965('0x19')]()]+']',_0x35f5e0[_0xf965('0x1a')]);_0x58b83a(_0x35f5e0[_0xf965('0x1a')]);});});}function getTicket(_0x23543e,_0x65aa02,_0x44c246,_0x3f7b54,_0x579676){return function(_0x3871ff){logger[_0xf965('0x10')](_0xf965('0x31'));return new Promise(function(_0x295b38,_0x39eed2){var _0x361867=moment();var _0x558ea7={'method':_0xf965('0x2e'),'uri':_0x44c246+'/api/tasks','body':{'title':intUtil['getString'](_0x3f7b54[_0xf965('0x32')],_0x579676,'\x20'),'description':intUtil[_0xf965('0x33')](_0x3f7b54[_0xf965('0x34')],_0x579676,'\x0a'),'owner_id':_0x3871ff[_0xf965('0x1f')],'creater_id':_0x3871ff[_0xf965('0x16')],'targetable_id':_0x3871ff[_0xf965('0x2a')],'targetable_type':_0xf965('0x35'),'created_at':_0x361867[_0xf965('0x2f')](_0xf965('0x36')),'due_date':_0x361867[_0xf965('0x37')](0x1e,'m')[_0xf965('0x2f')](_0xf965('0x36'))},'json':!![]};_0x558ea7[_0xf965('0xf')]=_0x65aa02;return rp(_0x558ea7)[_0xf965('0x1c')](function(_0x5789d5){_0x3871ff[_0xf965('0x38')]=_0x5789d5['task']['id'];logger[_0xf965('0x10')](_0xf965('0x39'),_0x3871ff[_0xf965('0x38')]);_0x295b38(_0x3871ff);})[_0xf965('0x22')](function(_0x419d53){logger[_0xf965('0x23')]('['+[_0x23543e[_0xf965('0x19')]()]+']',_0x419d53[_0xf965('0x1a')]);_0x39eed2(_0x419d53[_0xf965('0x1a')]);});});};}function emit(_0x5558c3,_0x50c802,_0x4940c7){var _0x20efc5={'uri':_0x5558c3+_0xf965('0x3a')+_0x4940c7};io['to'](util[_0xf965('0x2f')]('user:%s',_0x50c802))[_0xf965('0x3b')](_0xf965('0x3c'),_0x20efc5);}exports['cs']=function(_0x27b7c7,_0x556ccb,_0x4dcad9,_0x169e72,_0x1d637e,_0xcfafd,_0x31e840,_0x2bbb15){var _0x4fbf9e={};var _0x1ab410={'Authorization':'Token\x20token='+_0xcfafd[_0xf965('0x3d')]};_0xcfafd['remoteUri']=intUtil[_0xf965('0x3e')](_0xcfafd['remoteUri']);_0xcfafd['serverUrl']=intUtil[_0xf965('0x3e')](_0xcfafd[_0xf965('0x3f')]);var _0x994576=_0xcfafd[_0xf965('0x40')];_0x4fbf9e[_0xf965('0x15')]=_0xcfafd[_0xf965('0x41')];_0x4fbf9e[_0xf965('0x28')]=_0x2bbb15[_0xf965('0x42')]()===_0xf965('0x43')?_0x556ccb[_0xf965('0x44')]:_0x556ccb[_0xf965('0x45')];_0x4fbf9e[_0xf965('0x46')]=_0x2bbb15==='queue'||_0x2bbb15===_0xf965('0x47')?_0xf965('0x48'):_0xf965('0x43');if(_0x169e72){_0x4fbf9e[_0xf965('0x1d')]=_0x169e72['email'];}var _0x2033d1=util[_0xf965('0x2f')](_0xf965('0x49'),_0xcfafd[_0xf965('0x3f')],_0x556ccb[_0xf965('0x4a')],md5(_0x556ccb[_0xf965('0x4a')]));if(_0x1d637e&&_0x1d637e[_0xf965('0x4b')]){logger['info'](_0xf965('0x4c'),'Recording\x20is\x20enabled!');_0x556ccb[_0xf965('0x4d')]=_0x2033d1;}else if(_0x31e840&&_0x31e840[_0xf965('0x4e')]&&_0x31e840[_0xf965('0x4e')]!==_0xf965('0x4f')){logger[_0xf965('0x10')](_0xf965('0x50'),_0xf965('0x51'));_0x556ccb[_0xf965('0x4d')]=_0x2033d1;}else{_0x556ccb[_0xf965('0x4d')]='';}return getAdminId(_0x4fbf9e,_0x2bbb15,_0x1ab410,_0x994576)[_0xf965('0x1c')](getUser(_0x2bbb15,_0x1ab410,_0x994576))[_0xf965('0x1c')](getEndUser(_0x2bbb15,_0x1ab410,_0x994576))['then'](getTicket(_0x2bbb15,_0x1ab410,_0x994576,_0x4dcad9,_0x556ccb))[_0xf965('0x1c')](function(_0x4f944d){logger['info'](util['format'](_0xf965('0x52'),_0x4f944d['ticketId']));if(_0x2bbb15!=='unmanaged'){logger['info']('['+[_0x2bbb15[_0xf965('0x19')]()]+']',_0xf965('0x53'));emit(_0x994576,_0x169e72[_0xf965('0x54')],_0x4f944d[_0xf965('0x2a')]);}})['catch'](function(_0x40d4e0){logger[_0xf965('0x23')]('['+[_0x2bbb15[_0xf965('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xf965('0x55')](_0x40d4e0,{'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 65f17f1..9380fed 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 _0xc89f=['outbound','log','EVENT\x20UNKNOWN','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId'];(function(_0x36bce1,_0x4f1be3){var _0x4ff740=function(_0x42d656){while(--_0x42d656){_0x36bce1['push'](_0x36bce1['shift']());}};_0x4ff740(++_0x4f1be3);}(_0xc89f,0x1c2));var _0xfc89=function(_0x14dd10,_0x4900d6){_0x14dd10=_0x14dd10-0x0;var _0x5cb641=_0xc89f[_0x14dd10];return _0x5cb641;};'use strict';var _=require(_0xfc89('0x0'));var util=require(_0xfc89('0x1'));var zendesk=require(_0xfc89('0x2'));var salesforce=require(_0xfc89('0x3'));var sugarcrm=require(_0xfc89('0x4'));var freshdesk=require(_0xfc89('0x5'));var zoho=require(_0xfc89('0x6'));var desk=require(_0xfc89('0x7'));var vtiger=require(_0xfc89('0x8'));var servicenow=require(_0xfc89('0x9'));var dynamics365=require('./dynamics365');var freshsales=require(_0xfc89('0xa'));var integrations=[_0xfc89('0xb'),_0xfc89('0xc'),_0xfc89('0xd'),_0xfc89('0xe'),_0xfc89('0xf'),_0xfc89('0x10'),_0xfc89('0x11'),_0xfc89('0x12'),_0xfc89('0x13'),_0xfc89('0x14')];exports[_0xfc89('0x15')]=function(_0x2ef8a1,_0x3542cf,_0x403b7e,_0x5a27fc,_0x313962,_0x17d46a){if(_0x403b7e){if(_[_0xfc89('0x16')](integrations,_0x2ef8a1[_0xfc89('0x17')]['toLowerCase']())){try{var _0x42161e=null;var _0x5efe07='';var _0x4599fa=_0x403b7e[_0x2ef8a1[_0xfc89('0x17')][_0xfc89('0x18')]()];if(_0x4599fa){var _0x467df9=_0x4599fa[_0x2ef8a1['data2']];if(_0x467df9){var _0x3d0d46=_[_0xfc89('0x19')](_0x467df9[_0xfc89('0x1a')],{'id':parseInt(_0x2ef8a1[_0xfc89('0x1b')],0xa)});if(_0x3d0d46){if(_0x5a27fc){if(_0x313962&&_0x3542cf[_0xfc89('0x1c')]){_0x5efe07=_0xfc89('0x1c');}else if(_0x3542cf[_0xfc89('0x1d')]){_0x5efe07=_0xfc89('0x1e');}else{console[_0xfc89('0x1f')](_0xfc89('0x20'),_0x3542cf);}}else{_0x5efe07='unmanaged';}switch(_0x2ef8a1['data1'][_0xfc89('0x18')]()){case _0xfc89('0xb'):zendesk[_0x5efe07](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a);break;case _0xfc89('0xc'):salesforce[_0x5efe07](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a);break;case _0xfc89('0xd'):sugarcrm[_0x5efe07](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a);break;case _0xfc89('0xe'):freshdesk[_0x5efe07](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a);break;case _0xfc89('0xf'):zoho[_0x5efe07](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a);break;case _0xfc89('0x10'):desk[_0x5efe07](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a);break;case _0xfc89('0x11'):vtiger[_0x5efe07](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a);break;case _0xfc89('0x13'):freshsales['cs'](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a,_0x5efe07);break;case _0xfc89('0x14'):servicenow['cs'](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a,_0x5efe07);break;case'dynamics365':dynamics365['cs'](_0x2ef8a1,_0x3542cf,_0x3d0d46,_0x5a27fc,_0x313962,_0x467df9,_0x17d46a,_0x5efe07);break;default:console[_0xfc89('0x1f')](_0xfc89('0x21'));}}else{_0x42161e=require(_0xfc89('0x22'))(_0x2ef8a1[_0xfc89('0x17')]['toLowerCase']());_0x42161e[_0xfc89('0x23')](_0xfc89('0x24'),util[_0xfc89('0x25')](_0xfc89('0x26'),_0x2ef8a1[_0xfc89('0x17')][_0xfc89('0x18')](),_0x2ef8a1[_0xfc89('0x1b')]));}}else{_0x42161e=require(_0xfc89('0x22'))(_0x2ef8a1[_0xfc89('0x17')][_0xfc89('0x18')]());_0x42161e['error'](_0xfc89('0x24'),util[_0xfc89('0x25')](_0xfc89('0x27'),_0x2ef8a1['data1'][_0xfc89('0x18')](),_0x2ef8a1['data2']));}}else{}}catch(_0x5b0d64){console[_0xfc89('0x23')](_0x5b0d64);}}}}; \ No newline at end of file +var _0xab8a=['vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshdesk','desk','unknown\x20integration','../../../../config/logger','[EXEC]','format','error','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','zoho'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab8a,0x66));var _0xaab8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xab8a[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xaab8('0x0'));var util=require('util');var zendesk=require(_0xaab8('0x1'));var salesforce=require(_0xaab8('0x2'));var sugarcrm=require(_0xaab8('0x3'));var freshdesk=require(_0xaab8('0x4'));var zoho=require(_0xaab8('0x5'));var desk=require(_0xaab8('0x6'));var vtiger=require(_0xaab8('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xaab8('0x8'));var freshsales=require(_0xaab8('0x9'));var integrations=[_0xaab8('0xa'),'salesforce','sugarcrm','freshdesk',_0xaab8('0xb'),'desk',_0xaab8('0xc'),_0xaab8('0xd'),_0xaab8('0xe'),_0xaab8('0xf')];exports[_0xaab8('0x10')]=function(_0x54f09a,_0x48d9fc,_0x53313a,_0x5e9082,_0x43526c,_0x30aec0){if(_0x53313a){if(_[_0xaab8('0x11')](integrations,_0x54f09a[_0xaab8('0x12')][_0xaab8('0x13')]())){try{var _0x169d38=null;var _0x593006='';var _0x1b8d73=_0x53313a[_0x54f09a['data1'][_0xaab8('0x13')]()];if(_0x1b8d73){var _0x5d3c83=_0x1b8d73[_0x54f09a[_0xaab8('0x14')]];if(_0x5d3c83){var _0x23a274=_[_0xaab8('0x15')](_0x5d3c83[_0xaab8('0x16')],{'id':parseInt(_0x54f09a[_0xaab8('0x17')],0xa)});if(_0x23a274){if(_0x5e9082){if(_0x43526c&&_0x48d9fc[_0xaab8('0x18')]){_0x593006=_0xaab8('0x18');}else if(_0x48d9fc[_0xaab8('0x19')]){_0x593006='outbound';}else{console[_0xaab8('0x1a')](_0xaab8('0x1b'),_0x48d9fc);}}else{_0x593006=_0xaab8('0x1c');}switch(_0x54f09a[_0xaab8('0x12')][_0xaab8('0x13')]()){case _0xaab8('0xa'):zendesk[_0x593006](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0);break;case _0xaab8('0x1d'):salesforce[_0x593006](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0);break;case'sugarcrm':sugarcrm[_0x593006](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0);break;case _0xaab8('0x1e'):freshdesk[_0x593006](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0);break;case _0xaab8('0xb'):zoho[_0x593006](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0);break;case _0xaab8('0x1f'):desk[_0x593006](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0);break;case'vtiger':vtiger[_0x593006](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0);break;case _0xaab8('0xe'):freshsales['cs'](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0,_0x593006);break;case _0xaab8('0xf'):servicenow['cs'](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0,_0x593006);break;case'dynamics365':dynamics365['cs'](_0x54f09a,_0x48d9fc,_0x23a274,_0x5e9082,_0x43526c,_0x5d3c83,_0x30aec0,_0x593006);break;default:console[_0xaab8('0x1a')](_0xaab8('0x20'));}}else{_0x169d38=require(_0xaab8('0x21'))(_0x54f09a[_0xaab8('0x12')][_0xaab8('0x13')]());_0x169d38['error'](_0xaab8('0x22'),util[_0xaab8('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x54f09a[_0xaab8('0x12')][_0xaab8('0x13')](),_0x54f09a[_0xaab8('0x17')]));}}else{_0x169d38=require('../../../../config/logger')(_0x54f09a[_0xaab8('0x12')]['toLowerCase']());_0x169d38[_0xaab8('0x24')]('[EXEC]',util[_0xaab8('0x23')](_0xaab8('0x25'),_0x54f09a[_0xaab8('0x12')][_0xaab8('0x13')](),_0x54f09a[_0xaab8('0x14')]));}}else{}}catch(_0x40805a){console['error'](_0x40805a);}}}}; \ 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 fbe184a..5b3c467 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 _0xf53e=['contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','sobject','Lead','additionalSearchAccount','merge','Account','execute','first','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.','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','[OUTBOUND]','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','ioredis','../../../../config/environment','salesforce','redis','defaults','assign','getString','Descriptions','ticketType','Task','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch'];(function(_0x2e2ec3,_0x19ee9b){var _0x5f4db4=function(_0x27a41a){while(--_0x27a41a){_0x2e2ec3['push'](_0x2e2ec3['shift']());}};_0x5f4db4(++_0x19ee9b);}(_0xf53e,0xcb));var _0xef53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf53e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xef53('0x0'));var BPromise=require(_0xef53('0x1'));var md5=require(_0xef53('0x2'));var jsforce=require(_0xef53('0x3'));var util=require('util');var Redis=require(_0xef53('0x4'));var intUtil=require('./util');var config=require(_0xef53('0x5'));var logger=require('../../../../config/logger')(_0xef53('0x6'));config[_0xef53('0x7')]=_[_0xef53('0x8')](config[_0xef53('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xef53('0x7')]));function emit(_0x27225a,_0x380e73,_0x237189){io['to'](_0x27225a)['emit'](_0x380e73,_0x237189);}function getTicket(_0x317aeb,_0x4267ab,_0x414cea,_0x4d69f0,_0x592e15,_0x218184,_0x14629f,_0x3c4873){var _0x202e7d=Object[_0xef53('0x9')]({},{'OwnerId':_0x4267ab['id'],'Subject':intUtil['getString'](_0x4d69f0['Subjects'],_0x592e15,'\x20'),'Description':intUtil[_0xef53('0xa')](_0x4d69f0[_0xef53('0xb')],_0x592e15,'\x0a')},getCustomFields(_0x218184,_0x592e15));if(_0x414cea){if(_0x4d69f0[_0xef53('0xc')]===_0xef53('0xd')){_0x202e7d['ActivityDate']=moment['utc']();_0x202e7d[_0xef53('0xe')]=![];_0x202e7d[_0xef53('0xf')]=![];if(_0x414cea[_0xef53('0x10')]===_0xef53('0x11')||_0x414cea[_0xef53('0x10')]===_0xef53('0x12')){_0x202e7d[_0xef53('0x13')]=_0x414cea['id'];}else if(_0x414cea[_0xef53('0x10')]===_0xef53('0x14')){_0x202e7d[_0xef53('0x15')]=_0x414cea['id'];}}else if(_0x4d69f0[_0xef53('0xc')]===_0xef53('0x16')){if(_0x414cea[_0xef53('0x10')]===_0xef53('0x11')){_0x202e7d[_0xef53('0x17')]=_0x414cea['id'];}else if(_0x414cea[_0xef53('0x10')]===_0xef53('0x14')){_0x202e7d[_0xef53('0x18')]=_0x414cea['id'];}else if(_0x414cea[_0xef53('0x10')]===_0xef53('0x12')&&_0x4d69f0['leadId']){_0x202e7d[_0x4d69f0['leadId']]=_0x414cea['id'];}else{logger[_0xef53('0x19')](_0xef53('0x1a'));}}}return _0x14629f['sobject'](_0x4d69f0[_0xef53('0xc')])[_0xef53('0x1b')](_0x202e7d);}function getUser(_0x183338,_0x3fc787,_0x531f9b){if(!_[_0xef53('0x1c')](_0x3fc787)&&intUtil[_0xef53('0x1d')](_0x3fc787)){var _0x1b7e32={'Email':_0x3fc787};var _0x1f4dc6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x531f9b['sobject']('User')[_0xef53('0x1e')](_0x1b7e32,_0x1f4dc6)['execute']()[_0xef53('0x1f')](function(_0x320bbd){if(_0x320bbd[_0xef53('0x20')]){var _0xdcb57c=_['find'](_0x320bbd,function(_0x375cc9){return _0x375cc9[_0xef53('0x21')]===_0x3fc787;});if(_0xdcb57c){logger[_0xef53('0x19')](_0xef53('0x22'),_0x3fc787);return BPromise[_0xef53('0x23')]({'id':_0xdcb57c['Id'],'name':_0xdcb57c[_0xef53('0x24')]});}}else{logger[_0xef53('0x19')](_0xef53('0x25'),_0x3fc787);return _0x531f9b[_0xef53('0x26')]()['then'](function(_0x4267d1){return BPromise[_0xef53('0x23')]({'id':_0x4267d1[_0xef53('0x27')],'name':_0x4267d1[_0xef53('0x28')]});});}});}else{logger[_0xef53('0x19')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3fc787);return _0x531f9b[_0xef53('0x26')]()[_0xef53('0x1f')](function(_0x4b07e0){return BPromise[_0xef53('0x23')]({'id':_0x4b07e0[_0xef53('0x27')],'name':_0x4b07e0[_0xef53('0x28')]});});}}function getEndUser(_0x9e6b27,_0x12b3f3,_0x135494,_0xf43e90,_0x57f07c){var _0x1bffc8={'$or':{'Phone':_0xf43e90}};var _0x2861d9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xef53('0x1f')](function(){logger[_0xef53('0x19')](_0xef53('0x29'),_0xf43e90,_0x12b3f3[_0xef53('0x2a')]);switch(_0x12b3f3[_0xef53('0x2a')]){case _0xef53('0x2b'):var _0x5bcc2c=_[_0xef53('0x2c')](_0x1bffc8);if(_0x12b3f3[_0xef53('0x2d')]){var _0x341b55={};_0x341b55[_0x12b3f3[_0xef53('0x2d')]]=_0xf43e90;_['merge'](_0x5bcc2c[_0xef53('0x2e')],_0x341b55);}return _0x57f07c['sobject'](_0xef53('0x2f'))[_0xef53('0x1e')](_0x5bcc2c,_0x2861d9)['execute']()[_0xef53('0x1f')](function(_0x39e4e7){if(_0x39e4e7&&_0x39e4e7['length']){return _0x39e4e7;}else{var _0x594204=_[_0xef53('0x2c')](_0x1bffc8);if(_0x12b3f3[_0xef53('0x30')]){var _0x287119={};_0x287119[_0x12b3f3[_0xef53('0x30')]]=_0xf43e90;_['merge'](_0x594204[_0xef53('0x2e')],_0x287119);}return _0x57f07c[_0xef53('0x31')](_0xef53('0x32'))['find'](_0x594204,_0x2861d9);}});case'account_contact_lead':var _0x3908b1=_[_0xef53('0x2c')](_0x1bffc8);if(_0x12b3f3[_0xef53('0x33')]){var _0x341b55={};_0x341b55[_0x12b3f3[_0xef53('0x33')]]=_0xf43e90;_[_0xef53('0x34')](_0x3908b1[_0xef53('0x2e')],_0x341b55);}return _0x57f07c[_0xef53('0x31')](_0xef53('0x35'))[_0xef53('0x1e')](_0x3908b1,_0x2861d9)[_0xef53('0x36')]()[_0xef53('0x1f')](function(_0x181961){if(_0x181961&&_0x181961[_0xef53('0x20')]){return _0x181961;}else{var _0xc9082e=_[_0xef53('0x2c')](_0x1bffc8);if(_0x12b3f3['additionalSearchContact']){var _0x959616={};_0x959616[_0x12b3f3[_0xef53('0x2d')]]=_0xf43e90;_[_0xef53('0x34')](_0xc9082e[_0xef53('0x2e')],_0x959616);}return _0x57f07c[_0xef53('0x31')](_0xef53('0x2f'))[_0xef53('0x1e')](_0xc9082e,_0x2861d9)['then'](function(_0x493982){if(_0x493982&&_0x493982[_0xef53('0x20')]){return _0x493982;}else{var _0x49d141=_[_0xef53('0x2c')](_0x1bffc8);if(_0x12b3f3['additionalSearchLead']){var _0x124380={};_0x124380[_0x12b3f3[_0xef53('0x30')]]=_0xf43e90;_[_0xef53('0x34')](_0x49d141[_0xef53('0x2e')],_0x124380);}return _0x57f07c[_0xef53('0x31')](_0xef53('0x32'))['find'](_0x49d141,_0x2861d9);}});}});case _0xef53('0x11'):var _0x5bcc2c=_[_0xef53('0x2c')](_0x1bffc8);if(_0x12b3f3[_0xef53('0x2d')]){var _0x341b55={};_0x341b55[_0x12b3f3[_0xef53('0x2d')]]=_0xf43e90;_['merge'](_0x5bcc2c[_0xef53('0x2e')],_0x341b55);}return _0x57f07c['sobject'](_0xef53('0x2f'))[_0xef53('0x1e')](_0x5bcc2c,_0x2861d9)['execute']();case _0xef53('0x12'):var _0x4855cc=_[_0xef53('0x2c')](_0x1bffc8);if(_0x12b3f3[_0xef53('0x30')]){var _0x341b55={};_0x341b55[_0x12b3f3[_0xef53('0x30')]]=_0xf43e90;_[_0xef53('0x34')](_0x4855cc[_0xef53('0x2e')],_0x341b55);}return _0x57f07c[_0xef53('0x31')](_0xef53('0x32'))[_0xef53('0x1e')](_0x4855cc,_0x2861d9);case _0xef53('0x14'):var _0x3908b1=_['cloneDeep'](_0x1bffc8);if(_0x12b3f3[_0xef53('0x33')]){var _0x341b55={};_0x341b55[_0x12b3f3['additionalSearchAccount']]=_0xf43e90;_[_0xef53('0x34')](_0x3908b1[_0xef53('0x2e')],_0x341b55);}return _0x57f07c['sobject'](_0xef53('0x35'))[_0xef53('0x1e')](_0x3908b1,_0x2861d9);default:return null;}})[_0xef53('0x1f')](function(_0x1f848b){if(_0x1f848b&&_0x1f848b[_0xef53('0x20')]){var _0x27f8a1=_[_0xef53('0x37')](_0x1f848b);if(_0x27f8a1){return BPromise['resolve']({'id':_0x27f8a1['Id'],'name':_0x27f8a1['Name'],'phone':_0x27f8a1['Phone'],'endUserType':_0x27f8a1['attributes']['type'][_0xef53('0x38')]()});}}})[_0xef53('0x1f')](function(_0x23ea9c){if(_0x23ea9c){logger[_0xef53('0x19')](_0xef53('0x39'),_0x23ea9c[_0xef53('0x10')],_0xf43e90);return BPromise[_0xef53('0x23')](_0x23ea9c);}else{logger['info'](_0xef53('0x3a'),_0xf43e90);var _0x31d9f1={'Phone':_0xf43e90};if(_0x12b3f3[_0xef53('0x3b')]){if(_0x12b3f3[_0xef53('0x3b')]===_0xef53('0x11')){logger[_0xef53('0x19')](_0xef53('0x3c'),_0xf43e90,_0x12b3f3[_0xef53('0x3b')]);_0x31d9f1['LastName']=_0x135494!==_0xef53('0x3d')?_0x135494:util[_0xef53('0x3e')](_0xef53('0x3f'),_0xf43e90);}else if(_0x12b3f3[_0xef53('0x3b')]===_0xef53('0x12')){logger['info'](_0xef53('0x3c'),_0xf43e90,_0x12b3f3[_0xef53('0x3b')]);_0x31d9f1[_0xef53('0x40')]=_0x135494!==_0xef53('0x3d')?_0x135494:util[_0xef53('0x3e')]('Caller\x20-\x20%s',_0xf43e90);_0x31d9f1[_0xef53('0x41')]=_0xef53('0x42');}else if(_0x12b3f3['moduleCreate']==='account'){logger[_0xef53('0x19')](_0xef53('0x3c'),_0xf43e90,_0x12b3f3[_0xef53('0x3b')]);_0x31d9f1[_0xef53('0x24')]=_0x135494!==_0xef53('0x3d')?_0x135494:util['format']('Caller\x20-\x20%s',_0xf43e90);}else{return null;}}return _0x57f07c[_0xef53('0x31')](_[_0xef53('0x43')](_0x12b3f3[_0xef53('0x3b')]))[_0xef53('0x1b')](_0x31d9f1)[_0xef53('0x1f')](function(_0x483f79){return BPromise[_0xef53('0x23')]({'id':_0x483f79['id'],'endUserType':_0x12b3f3[_0xef53('0x3b')]});});}});}function getCustomFields(_0x34874f,_0x3ea245){var _0xf81b6={};if(_0x34874f[_0xef53('0x20')]>0x0){_[_0xef53('0x44')](_0x34874f,function(_0x4df179){if(_[_0xef53('0x45')]([_0xef53('0x46'),_0xef53('0x47')],_0x4df179['type'])&&_0x4df179[_0xef53('0x48')]){_0xf81b6[_0x4df179[_0xef53('0x48')]]=_0x4df179[_0xef53('0x49')][_0xef53('0x4a')]();}else if(_0x4df179[_0xef53('0x4b')]===_0xef53('0x4c')&&_0x4df179[_0xef53('0x4d')]&&_0x4df179['idField']){_0x3ea245[_0x4df179[_0xef53('0x4d')]]&&(_0xf81b6[_0x4df179[_0xef53('0x48')]]=_0x3ea245[_0x4df179[_0xef53('0x4d')]]['toString']());}else if(_0x4df179['type']==='customVariable'&&_0x4df179['Variable']&&_0x4df179[_0xef53('0x4e')][_0xef53('0x4f')]&&_0x4df179[_0xef53('0x48')]){_0x3ea245[_0x4df179[_0xef53('0x4e')]['name'][_0xef53('0x38')]()]&&(_0xf81b6[_0x4df179[_0xef53('0x48')]]=_0x3ea245[_0x4df179[_0xef53('0x4e')][_0xef53('0x4f')][_0xef53('0x38')]()][_0xef53('0x4a')]());}});}return _0xf81b6;}function getConnection(_0x5209ac){var _0x42de55=_0x5209ac[_0xef53('0x50')][_0xef53('0x51')](_0x5209ac[_0xef53('0x52')]);var _0x25e4a8=new jsforce[(_0xef53('0x53'))]({'oauth2':{'loginUrl':_0x5209ac[_0xef53('0x54')]||_0xef53('0x55'),'clientId':_0x5209ac[_0xef53('0x56')],'clientSecret':_0x5209ac['clientSecret']}});return _0x25e4a8[_0xef53('0x57')](_0x5209ac['username'],_0x42de55)[_0xef53('0x1f')](function(){logger[_0xef53('0x19')]('Connection\x20established.');return _0x25e4a8;});}exports[_0xef53('0x58')]=function(_0x2cd138,_0x1f3bb9,_0x59dd22,_0xdad0a0,_0x416017,_0x3f7002){var _0x65cffc,_0x5290a5,_0x4fdd32,_0x42db3e;_0x3f7002[_0xef53('0x59')]=intUtil[_0xef53('0x5a')](_0x3f7002['serverUrl']);_0x3f7002[_0xef53('0x54')]=intUtil[_0xef53('0x5a')](_0x3f7002[_0xef53('0x54')]);if(_0x416017&&_0x416017[_0xef53('0x5b')]){logger[_0xef53('0x19')](_0xef53('0x5c'),_0xef53('0x5d'));_0x1f3bb9[_0xef53('0x5e')]=util[_0xef53('0x3e')](_0xef53('0x5f'),_0x3f7002[_0xef53('0x59')],_0x1f3bb9[_0xef53('0x60')],md5(_0x1f3bb9[_0xef53('0x60')]));}else{_0x1f3bb9['recordingURL']='';}return getConnection(_0x3f7002)[_0xef53('0x1f')](function(_0x393c4b){_0x42db3e=_0x393c4b;return getUser(_0x3f7002,_0xdad0a0[_0xef53('0x61')],_0x42db3e);})[_0xef53('0x1f')](function(_0x3dfaf4){_0x65cffc=_0x3dfaf4;return getEndUser(_0x3f7002,_0x59dd22,_0x1f3bb9[_0xef53('0x62')],_0x1f3bb9['calleridnum'],_0x42db3e);})['then'](function(_0x2833a7){_0x5290a5=_0x2833a7;return getTicket(_0x3f7002,_0x65cffc,_0x5290a5,_0x59dd22,_0x1f3bb9,_0x59dd22[_0xef53('0x63')],_0x42db3e,_0xef53('0x58'));})[_0xef53('0x1f')](function(_0x378a76){_0x4fdd32=_0x378a76;logger[_0xef53('0x19')](_0xef53('0x64'),_0x4fdd32['id']);logger['info'](_0xef53('0x65'),_0x4fdd32['id'],_0xdad0a0[_0xef53('0x4f')],_0x3f7002[_0xef53('0x4b')]);switch(_0x3f7002[_0xef53('0x4b')]){case'integrationTab':emit(util[_0xef53('0x3e')](_0xef53('0x66'),_0xdad0a0['name']),_0xef53('0x67'),{'recordId':_0x4fdd32['id']});break;case _0xef53('0x68'):emit(util[_0xef53('0x3e')](_0xef53('0x66'),_0xdad0a0[_0xef53('0x4f')]),_0xef53('0x69'),{'uri':util[_0xef53('0x3e')](_0xef53('0x6a'),_0x42db3e[_0xef53('0x6b')],_0x4fdd32['id'])});break;default:logger[_0xef53('0x6c')](_0xef53('0x6d'));}})['catch'](function(_0xb11a42){logger[_0xef53('0x6c')](_0xef53('0x5c'),_0xb11a42);});};exports['outbound']=function(_0x553918,_0x503576,_0x65647b,_0x38583d,_0x5c0202,_0x441480,_0x570b1c){var _0x45aedb,_0x28b822,_0x5384c4,_0x7453a8;_0x441480['serverUrl']=intUtil[_0xef53('0x5a')](_0x441480[_0xef53('0x59')]);_0x441480[_0xef53('0x54')]=intUtil[_0xef53('0x5a')](_0x441480[_0xef53('0x54')]);if(_0x570b1c&&_0x570b1c[_0xef53('0x6e')]&&_0x570b1c['recordingFormat']!=='none'){logger[_0xef53('0x19')](_0xef53('0x6f'),_0xef53('0x5d'));_0x503576['recordingURL']=util[_0xef53('0x3e')](_0xef53('0x5f'),_0x441480[_0xef53('0x59')],_0x503576[_0xef53('0x60')],md5(_0x503576[_0xef53('0x60')]));}return getConnection(_0x441480)['then'](function(_0x2e22c7){_0x7453a8=_0x2e22c7;return getUser(_0x441480,_0x38583d[_0xef53('0x61')],_0x7453a8);})['then'](function(_0x5c698c){_0x45aedb=_0x5c698c;return getEndUser(_0x441480,_0x65647b,_0x503576['destcalleridname'],_0x503576['destcalleridnum'],_0x7453a8);})[_0xef53('0x1f')](function(_0x25fa55){_0x28b822=_0x25fa55;return getTicket(_0x441480,_0x45aedb,_0x28b822,_0x65647b,_0x503576,_0x65647b[_0xef53('0x63')],_0x7453a8,_0xef53('0x70'));})['then'](function(_0x439b96){_0x5384c4=_0x439b96;logger[_0xef53('0x19')](_0xef53('0x71'),_0x5384c4['id']);logger[_0xef53('0x19')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5384c4['id'],_0x38583d[_0xef53('0x4f')],_0x441480[_0xef53('0x4b')]);switch(_0x441480[_0xef53('0x4b')]){case _0xef53('0x72'):emit(util[_0xef53('0x3e')]('user:%s',_0x38583d[_0xef53('0x4f')]),'trigger:salesforce:display',{'recordId':_0x5384c4['id']});break;case _0xef53('0x68'):emit(util[_0xef53('0x3e')]('user:%s',_0x38583d[_0xef53('0x4f')]),_0xef53('0x69'),{'uri':util[_0xef53('0x3e')](_0xef53('0x6a'),_0x7453a8['instanceUrl'],_0x5384c4['id'])});break;default:logger[_0xef53('0x6c')]('[OUTBOUND]',_0xef53('0x73'));}})[_0xef53('0x74')](function(_0x4e8973){logger[_0xef53('0x6c')](_0xef53('0x6f'),_0x4e8973);});};exports[_0xef53('0x75')]=function(_0x51c9bd,_0x3ab774,_0x5a515b,_0x95b50c,_0x3c74f7,_0x41c4bd){var _0x3cc02c,_0x3c8df6,_0x43e881,_0x8873fc;_0x41c4bd['serverUrl']=intUtil[_0xef53('0x5a')](_0x41c4bd['serverUrl']);_0x41c4bd['remoteUri']=intUtil['stripTrailingSlash'](_0x41c4bd['remoteUri']);if(_0x3c74f7&&_0x3c74f7[_0xef53('0x5b')]){logger[_0xef53('0x19')]('['+_0x3ab774['lastevent'][_0xef53('0x76')]()+']',_0xef53('0x5d'));_0x3ab774[_0xef53('0x5e')]=util[_0xef53('0x3e')](_0xef53('0x5f'),_0x41c4bd['serverUrl'],_0x3ab774[_0xef53('0x60')],md5(_0x3ab774[_0xef53('0x60')]));}else{_0x3ab774['recordingURL']='';}return getConnection(_0x41c4bd)[_0xef53('0x1f')](function(_0x547632){_0x8873fc=_0x547632;if(!_['isNil'](_0x95b50c)){return getUser(_0x41c4bd,_0x95b50c[_0xef53('0x4f')],_0x8873fc);}else{return getUser(_0x41c4bd,null,_0x8873fc);}})['then'](function(_0x59e9c4){_0x3cc02c=_0x59e9c4;return getEndUser(_0x41c4bd,_0x5a515b,_0x3ab774[_0xef53('0x62')],_0x3ab774[_0xef53('0x77')],_0x8873fc);})[_0xef53('0x1f')](function(_0x584288){_0x3c8df6=_0x584288;return getTicket(_0x41c4bd,_0x3cc02c,_0x3c8df6,_0x5a515b,_0x3ab774,_0x5a515b[_0xef53('0x63')],_0x8873fc);})['then'](function(_0x3bdeca){_0x43e881=_0x3bdeca;logger[_0xef53('0x19')]('['+_0x3ab774[_0xef53('0x78')][_0xef53('0x76')]()+_0xef53('0x79'),_0x43e881['id']);logger['info']('['+_0x3ab774[_0xef53('0x78')][_0xef53('0x76')]()+_0xef53('0x7a'),_0x41c4bd[_0xef53('0x4b')]);})[_0xef53('0x74')](function(_0x433760){logger['error']('['+_0x3ab774['lastevent'][_0xef53('0x76')]()+']',_0x433760);});}; \ No newline at end of file +var _0xcc38=['%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','IsReminderSet','IsRecurrence','lead','WhoId','endUserType','Case','ContactId','account','leadId','info','sobject','create','isNil','validateEmail','User','find','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Company','No\x20Company','Caller\x20-\x20%s','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','catch','error','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','outbound','trigger:browser:url'];(function(_0x14e2dc,_0x5f3535){var _0x1843c3=function(_0x56f5cc){while(--_0x56f5cc){_0x14e2dc['push'](_0x14e2dc['shift']());}};_0x1843c3(++_0x5f3535);}(_0xcc38,0x105));var _0x8cc3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcc38[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8cc3('0x0'));var rp=require(_0x8cc3('0x1'));var moment=require(_0x8cc3('0x2'));var BPromise=require(_0x8cc3('0x3'));var md5=require('md5');var jsforce=require(_0x8cc3('0x4'));var util=require(_0x8cc3('0x5'));var Redis=require(_0x8cc3('0x6'));var intUtil=require(_0x8cc3('0x7'));var config=require(_0x8cc3('0x8'));var logger=require(_0x8cc3('0x9'))(_0x8cc3('0xa'));config[_0x8cc3('0xb')]=_['defaults'](config[_0x8cc3('0xb')],{'host':_0x8cc3('0xc'),'port':0x18eb});var io=require(_0x8cc3('0xd'))(new Redis(config[_0x8cc3('0xb')]));function emit(_0x1e2de9,_0x176db6,_0x3acf80){io['to'](_0x1e2de9)[_0x8cc3('0xe')](_0x176db6,_0x3acf80);}function getTicket(_0x31a669,_0x11f2ee,_0x2226b5,_0x10456d,_0x30ec26,_0x3adb5a,_0x370653,_0x49d389){var _0x5e9052=Object[_0x8cc3('0xf')]({},{'OwnerId':_0x11f2ee['id'],'Subject':intUtil[_0x8cc3('0x10')](_0x10456d[_0x8cc3('0x11')],_0x30ec26,'\x20'),'Description':intUtil[_0x8cc3('0x10')](_0x10456d[_0x8cc3('0x12')],_0x30ec26,'\x0a')},getCustomFields(_0x3adb5a,_0x30ec26));if(_0x2226b5){if(_0x10456d[_0x8cc3('0x13')]==='Task'){_0x5e9052['ActivityDate']=moment['utc']();_0x5e9052[_0x8cc3('0x14')]=![];_0x5e9052[_0x8cc3('0x15')]=![];if(_0x2226b5['endUserType']==='contact'||_0x2226b5['endUserType']===_0x8cc3('0x16')){_0x5e9052[_0x8cc3('0x17')]=_0x2226b5['id'];}else if(_0x2226b5[_0x8cc3('0x18')]==='account'){_0x5e9052['WhatId']=_0x2226b5['id'];}}else if(_0x10456d['ticketType']===_0x8cc3('0x19')){if(_0x2226b5[_0x8cc3('0x18')]==='contact'){_0x5e9052[_0x8cc3('0x1a')]=_0x2226b5['id'];}else if(_0x2226b5[_0x8cc3('0x18')]===_0x8cc3('0x1b')){_0x5e9052['AccountId']=_0x2226b5['id'];}else if(_0x2226b5[_0x8cc3('0x18')]==='lead'&&_0x10456d[_0x8cc3('0x1c')]){_0x5e9052[_0x10456d['leadId']]=_0x2226b5['id'];}else{logger[_0x8cc3('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x370653[_0x8cc3('0x1e')](_0x10456d[_0x8cc3('0x13')])[_0x8cc3('0x1f')](_0x5e9052);}function getUser(_0x41dd99,_0x2d8ab1,_0x3579d5){if(!_[_0x8cc3('0x20')](_0x2d8ab1)&&intUtil[_0x8cc3('0x21')](_0x2d8ab1)){var _0xf787b2={'Email':_0x2d8ab1};var _0x2bd87e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3579d5[_0x8cc3('0x1e')](_0x8cc3('0x22'))[_0x8cc3('0x23')](_0xf787b2,_0x2bd87e)['execute']()[_0x8cc3('0x24')](function(_0x2df64a){if(_0x2df64a[_0x8cc3('0x25')]){var _0x2574db=_[_0x8cc3('0x23')](_0x2df64a,function(_0x69be29){return _0x69be29['Email']===_0x2d8ab1;});if(_0x2574db){logger[_0x8cc3('0x1d')](_0x8cc3('0x26'),_0x2d8ab1);return BPromise[_0x8cc3('0x27')]({'id':_0x2574db['Id'],'name':_0x2574db[_0x8cc3('0x28')]});}}else{logger['info'](_0x8cc3('0x29'),_0x2d8ab1);return _0x3579d5[_0x8cc3('0x2a')]()['then'](function(_0x1f3bdc){return BPromise['resolve']({'id':_0x1f3bdc[_0x8cc3('0x2b')],'name':_0x1f3bdc[_0x8cc3('0x2c')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2d8ab1);return _0x3579d5['identity']()[_0x8cc3('0x24')](function(_0x1f6fd6){return BPromise[_0x8cc3('0x27')]({'id':_0x1f6fd6[_0x8cc3('0x2b')],'name':_0x1f6fd6['display_name']});});}}function getEndUser(_0x552bb7,_0x313151,_0x335573,_0x5079ac,_0x5a4024){var _0x3c560a={'$or':{'Phone':_0x5079ac}};var _0x4c3dee={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8cc3('0x27')]()[_0x8cc3('0x24')](function(){logger[_0x8cc3('0x1d')](_0x8cc3('0x2d'),_0x5079ac,_0x313151['moduleSearch']);switch(_0x313151[_0x8cc3('0x2e')]){case _0x8cc3('0x2f'):var _0xa6ae4f=_[_0x8cc3('0x30')](_0x3c560a);if(_0x313151['additionalSearchContact']){var _0x448e50={};_0x448e50[_0x313151[_0x8cc3('0x31')]]=_0x5079ac;_[_0x8cc3('0x32')](_0xa6ae4f[_0x8cc3('0x33')],_0x448e50);}return _0x5a4024[_0x8cc3('0x1e')](_0x8cc3('0x34'))[_0x8cc3('0x23')](_0xa6ae4f,_0x4c3dee)[_0x8cc3('0x35')]()['then'](function(_0x18b467){if(_0x18b467&&_0x18b467['length']){return _0x18b467;}else{var _0xe47494=_[_0x8cc3('0x30')](_0x3c560a);if(_0x313151[_0x8cc3('0x36')]){var _0x30b9c8={};_0x30b9c8[_0x313151['additionalSearchLead']]=_0x5079ac;_[_0x8cc3('0x32')](_0xe47494[_0x8cc3('0x33')],_0x30b9c8);}return _0x5a4024['sobject'](_0x8cc3('0x37'))['find'](_0xe47494,_0x4c3dee);}});case _0x8cc3('0x38'):var _0x4b1b9b=_[_0x8cc3('0x30')](_0x3c560a);if(_0x313151[_0x8cc3('0x39')]){var _0x448e50={};_0x448e50[_0x313151['additionalSearchAccount']]=_0x5079ac;_['merge'](_0x4b1b9b['$or'],_0x448e50);}return _0x5a4024[_0x8cc3('0x1e')](_0x8cc3('0x3a'))['find'](_0x4b1b9b,_0x4c3dee)[_0x8cc3('0x35')]()[_0x8cc3('0x24')](function(_0x11fc53){if(_0x11fc53&&_0x11fc53[_0x8cc3('0x25')]){return _0x11fc53;}else{var _0x292710=_[_0x8cc3('0x30')](_0x3c560a);if(_0x313151[_0x8cc3('0x31')]){var _0x27ea1d={};_0x27ea1d[_0x313151[_0x8cc3('0x31')]]=_0x5079ac;_[_0x8cc3('0x32')](_0x292710[_0x8cc3('0x33')],_0x27ea1d);}return _0x5a4024['sobject'](_0x8cc3('0x34'))['find'](_0x292710,_0x4c3dee)['then'](function(_0x361a4b){if(_0x361a4b&&_0x361a4b[_0x8cc3('0x25')]){return _0x361a4b;}else{var _0x178b74=_[_0x8cc3('0x30')](_0x3c560a);if(_0x313151[_0x8cc3('0x36')]){var _0x3004d6={};_0x3004d6[_0x313151[_0x8cc3('0x36')]]=_0x5079ac;_['merge'](_0x178b74['$or'],_0x3004d6);}return _0x5a4024[_0x8cc3('0x1e')](_0x8cc3('0x37'))[_0x8cc3('0x23')](_0x178b74,_0x4c3dee);}});}});case'contact':var _0xa6ae4f=_[_0x8cc3('0x30')](_0x3c560a);if(_0x313151[_0x8cc3('0x31')]){var _0x448e50={};_0x448e50[_0x313151[_0x8cc3('0x31')]]=_0x5079ac;_[_0x8cc3('0x32')](_0xa6ae4f['$or'],_0x448e50);}return _0x5a4024[_0x8cc3('0x1e')](_0x8cc3('0x34'))[_0x8cc3('0x23')](_0xa6ae4f,_0x4c3dee)[_0x8cc3('0x35')]();case'lead':var _0x2c7030=_['cloneDeep'](_0x3c560a);if(_0x313151['additionalSearchLead']){var _0x448e50={};_0x448e50[_0x313151[_0x8cc3('0x36')]]=_0x5079ac;_[_0x8cc3('0x32')](_0x2c7030['$or'],_0x448e50);}return _0x5a4024[_0x8cc3('0x1e')](_0x8cc3('0x37'))['find'](_0x2c7030,_0x4c3dee);case _0x8cc3('0x1b'):var _0x4b1b9b=_[_0x8cc3('0x30')](_0x3c560a);if(_0x313151['additionalSearchAccount']){var _0x448e50={};_0x448e50[_0x313151[_0x8cc3('0x39')]]=_0x5079ac;_[_0x8cc3('0x32')](_0x4b1b9b[_0x8cc3('0x33')],_0x448e50);}return _0x5a4024[_0x8cc3('0x1e')](_0x8cc3('0x3a'))[_0x8cc3('0x23')](_0x4b1b9b,_0x4c3dee);default:return null;}})['then'](function(_0x478c04){if(_0x478c04&&_0x478c04[_0x8cc3('0x25')]){var _0x254e3d=_['first'](_0x478c04);if(_0x254e3d){return BPromise[_0x8cc3('0x27')]({'id':_0x254e3d['Id'],'name':_0x254e3d[_0x8cc3('0x28')],'phone':_0x254e3d['Phone'],'endUserType':_0x254e3d[_0x8cc3('0x3b')][_0x8cc3('0x3c')][_0x8cc3('0x3d')]()});}}})[_0x8cc3('0x24')](function(_0x311235){if(_0x311235){logger[_0x8cc3('0x1d')](_0x8cc3('0x3e'),_0x311235['endUserType'],_0x5079ac);return BPromise['resolve'](_0x311235);}else{logger[_0x8cc3('0x1d')](_0x8cc3('0x3f'),_0x5079ac);var _0x332640={'Phone':_0x5079ac};if(_0x313151['moduleCreate']){if(_0x313151[_0x8cc3('0x40')]===_0x8cc3('0x41')){logger[_0x8cc3('0x1d')](_0x8cc3('0x42'),_0x5079ac,_0x313151[_0x8cc3('0x40')]);_0x332640[_0x8cc3('0x43')]=_0x335573!==_0x8cc3('0x44')?_0x335573:util[_0x8cc3('0x45')]('Caller\x20-\x20%s',_0x5079ac);}else if(_0x313151[_0x8cc3('0x40')]===_0x8cc3('0x16')){logger[_0x8cc3('0x1d')](_0x8cc3('0x42'),_0x5079ac,_0x313151['moduleCreate']);_0x332640[_0x8cc3('0x43')]=_0x335573!==_0x8cc3('0x44')?_0x335573:util['format']('Caller\x20-\x20%s',_0x5079ac);_0x332640[_0x8cc3('0x46')]=_0x8cc3('0x47');}else if(_0x313151[_0x8cc3('0x40')]==='account'){logger[_0x8cc3('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5079ac,_0x313151[_0x8cc3('0x40')]);_0x332640[_0x8cc3('0x28')]=_0x335573!==''?_0x335573:util[_0x8cc3('0x45')](_0x8cc3('0x48'),_0x5079ac);}else{return null;}}return _0x5a4024['sobject'](_[_0x8cc3('0x49')](_0x313151[_0x8cc3('0x40')]))[_0x8cc3('0x1f')](_0x332640)['then'](function(_0x4dc886){return BPromise['resolve']({'id':_0x4dc886['id'],'endUserType':_0x313151[_0x8cc3('0x40')]});});}});}function getCustomFields(_0x3bc9fb,_0x5d9d96){var _0x1625b5={};if(_0x3bc9fb[_0x8cc3('0x25')]>0x0){_[_0x8cc3('0x4a')](_0x3bc9fb,function(_0x1a3537){if(_[_0x8cc3('0x4b')]([_0x8cc3('0x4c'),_0x8cc3('0x4d')],_0x1a3537[_0x8cc3('0x3c')])&&_0x1a3537[_0x8cc3('0x4e')]){_0x1625b5[_0x1a3537[_0x8cc3('0x4e')]]=_0x1a3537[_0x8cc3('0x4f')][_0x8cc3('0x50')]();}else if(_0x1a3537[_0x8cc3('0x3c')]===_0x8cc3('0x51')&&_0x1a3537[_0x8cc3('0x52')]&&_0x1a3537[_0x8cc3('0x4e')]){_0x5d9d96[_0x1a3537['variableName']]&&(_0x1625b5[_0x1a3537[_0x8cc3('0x4e')]]=_0x5d9d96[_0x1a3537[_0x8cc3('0x52')]][_0x8cc3('0x50')]());}else if(_0x1a3537[_0x8cc3('0x3c')]===_0x8cc3('0x53')&&_0x1a3537[_0x8cc3('0x54')]&&_0x1a3537[_0x8cc3('0x54')]['name']&&_0x1a3537[_0x8cc3('0x4e')]){_0x5d9d96[_0x1a3537['Variable'][_0x8cc3('0x55')][_0x8cc3('0x3d')]()]&&(_0x1625b5[_0x1a3537[_0x8cc3('0x4e')]]=_0x5d9d96[_0x1a3537[_0x8cc3('0x54')][_0x8cc3('0x55')]['toLowerCase']()][_0x8cc3('0x50')]());}});}return _0x1625b5;}function getConnection(_0x27ec72){var _0x53ffa9=_0x27ec72[_0x8cc3('0x56')][_0x8cc3('0x57')](_0x27ec72[_0x8cc3('0x58')]);var _0x4c6772=new jsforce['Connection']({'oauth2':{'loginUrl':_0x27ec72[_0x8cc3('0x59')]||_0x8cc3('0x5a'),'clientId':_0x27ec72[_0x8cc3('0x5b')],'clientSecret':_0x27ec72['clientSecret']}});return _0x4c6772[_0x8cc3('0x5c')](_0x27ec72[_0x8cc3('0x5d')],_0x53ffa9)['then'](function(){logger[_0x8cc3('0x1d')]('Connection\x20established.');return _0x4c6772;});}exports[_0x8cc3('0x5e')]=function(_0x5d9935,_0x264c00,_0x332da0,_0xf96751,_0x33060c,_0x52979f){var _0x18dabb,_0x4cb04f,_0x449da4,_0x32ac75;_0x52979f['serverUrl']=intUtil[_0x8cc3('0x5f')](_0x52979f[_0x8cc3('0x60')]);_0x52979f[_0x8cc3('0x59')]=intUtil[_0x8cc3('0x5f')](_0x52979f[_0x8cc3('0x59')]);if(_0x33060c&&_0x33060c[_0x8cc3('0x61')]){logger[_0x8cc3('0x1d')](_0x8cc3('0x62'),_0x8cc3('0x63'));_0x264c00[_0x8cc3('0x64')]=util[_0x8cc3('0x45')](_0x8cc3('0x65'),_0x52979f[_0x8cc3('0x60')],_0x264c00[_0x8cc3('0x66')],md5(_0x264c00[_0x8cc3('0x66')]));}else{_0x264c00['recordingURL']='';}return getConnection(_0x52979f)[_0x8cc3('0x24')](function(_0x11c550){_0x32ac75=_0x11c550;return getUser(_0x52979f,_0xf96751['email'],_0x32ac75);})[_0x8cc3('0x24')](function(_0x52634a){_0x18dabb=_0x52634a;return getEndUser(_0x52979f,_0x332da0,_0x264c00[_0x8cc3('0x67')],_0x264c00['calleridnum'],_0x32ac75);})['then'](function(_0x424ef2){_0x4cb04f=_0x424ef2;return getTicket(_0x52979f,_0x18dabb,_0x4cb04f,_0x332da0,_0x264c00,_0x332da0[_0x8cc3('0x68')],_0x32ac75,_0x8cc3('0x5e'));})[_0x8cc3('0x24')](function(_0x37abe8){_0x449da4=_0x37abe8;logger['info'](_0x8cc3('0x69'),_0x449da4['id']);logger[_0x8cc3('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x449da4['id'],_0xf96751[_0x8cc3('0x55')],_0x52979f['type']);switch(_0x52979f[_0x8cc3('0x3c')]){case _0x8cc3('0x6a'):emit(util[_0x8cc3('0x45')](_0x8cc3('0x6b'),_0xf96751[_0x8cc3('0x55')]),_0x8cc3('0x6c'),{'recordId':_0x449da4['id']});break;case _0x8cc3('0x6d'):emit(util['format'](_0x8cc3('0x6b'),_0xf96751[_0x8cc3('0x55')]),'trigger:browser:url',{'uri':util[_0x8cc3('0x45')]('%s/%s/e',_0x32ac75['instanceUrl'],_0x449da4['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8cc3('0x6e')](function(_0x3c95f8){logger[_0x8cc3('0x6f')](_0x8cc3('0x62'),_0x3c95f8);});};exports['outbound']=function(_0x74211e,_0x154d9b,_0x27c1d9,_0x3c4fa5,_0xef9893,_0x3b8ec6,_0x5c9aa5){var _0x36fd21,_0x26dcee,_0x46d848,_0x42f466;_0x3b8ec6['serverUrl']=intUtil['stripTrailingSlash'](_0x3b8ec6[_0x8cc3('0x60')]);_0x3b8ec6[_0x8cc3('0x59')]=intUtil[_0x8cc3('0x5f')](_0x3b8ec6[_0x8cc3('0x59')]);if(_0x5c9aa5&&_0x5c9aa5[_0x8cc3('0x70')]&&_0x5c9aa5[_0x8cc3('0x70')]!==_0x8cc3('0x71')){logger[_0x8cc3('0x1d')](_0x8cc3('0x72'),'Recording\x20is\x20enabled!');_0x154d9b[_0x8cc3('0x64')]=util[_0x8cc3('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b8ec6[_0x8cc3('0x60')],_0x154d9b['uniqueid'],md5(_0x154d9b['uniqueid']));}return getConnection(_0x3b8ec6)[_0x8cc3('0x24')](function(_0xe982e3){_0x42f466=_0xe982e3;return getUser(_0x3b8ec6,_0x3c4fa5[_0x8cc3('0x73')],_0x42f466);})[_0x8cc3('0x24')](function(_0x4b84b4){_0x36fd21=_0x4b84b4;return getEndUser(_0x3b8ec6,_0x27c1d9,_0x154d9b[_0x8cc3('0x74')],_0x154d9b[_0x8cc3('0x75')],_0x42f466);})[_0x8cc3('0x24')](function(_0x26b6b3){_0x26dcee=_0x26b6b3;return getTicket(_0x3b8ec6,_0x36fd21,_0x26dcee,_0x27c1d9,_0x154d9b,_0x27c1d9[_0x8cc3('0x68')],_0x42f466,_0x8cc3('0x76'));})['then'](function(_0x4257b0){_0x46d848=_0x4257b0;logger[_0x8cc3('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x46d848['id']);logger[_0x8cc3('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x46d848['id'],_0x3c4fa5[_0x8cc3('0x55')],_0x3b8ec6[_0x8cc3('0x3c')]);switch(_0x3b8ec6[_0x8cc3('0x3c')]){case _0x8cc3('0x6a'):emit(util[_0x8cc3('0x45')](_0x8cc3('0x6b'),_0x3c4fa5[_0x8cc3('0x55')]),_0x8cc3('0x6c'),{'recordId':_0x46d848['id']});break;case _0x8cc3('0x6d'):emit(util[_0x8cc3('0x45')](_0x8cc3('0x6b'),_0x3c4fa5['name']),_0x8cc3('0x77'),{'uri':util['format'](_0x8cc3('0x78'),_0x42f466['instanceUrl'],_0x46d848['id'])});break;default:logger[_0x8cc3('0x6f')](_0x8cc3('0x72'),_0x8cc3('0x79'));}})['catch'](function(_0x2a69be){logger[_0x8cc3('0x6f')]('[OUTBOUND]',_0x2a69be);});};exports[_0x8cc3('0x7a')]=function(_0x35b61e,_0x1a49f3,_0x1ad04d,_0x288d77,_0x11cf22,_0x17e4b6){var _0x266d01,_0x166e04,_0x26692f,_0x394f14;_0x17e4b6[_0x8cc3('0x60')]=intUtil[_0x8cc3('0x5f')](_0x17e4b6[_0x8cc3('0x60')]);_0x17e4b6[_0x8cc3('0x59')]=intUtil['stripTrailingSlash'](_0x17e4b6[_0x8cc3('0x59')]);if(_0x11cf22&&_0x11cf22[_0x8cc3('0x61')]){logger[_0x8cc3('0x1d')]('['+_0x1a49f3[_0x8cc3('0x7b')][_0x8cc3('0x7c')]()+']','Recording\x20is\x20enabled!');_0x1a49f3[_0x8cc3('0x64')]=util[_0x8cc3('0x45')](_0x8cc3('0x65'),_0x17e4b6[_0x8cc3('0x60')],_0x1a49f3[_0x8cc3('0x66')],md5(_0x1a49f3[_0x8cc3('0x66')]));}else{_0x1a49f3[_0x8cc3('0x64')]='';}return getConnection(_0x17e4b6)[_0x8cc3('0x24')](function(_0x544b20){_0x394f14=_0x544b20;if(!_[_0x8cc3('0x20')](_0x288d77)){return getUser(_0x17e4b6,_0x288d77[_0x8cc3('0x55')],_0x394f14);}else{return getUser(_0x17e4b6,null,_0x394f14);}})[_0x8cc3('0x24')](function(_0x37bd49){_0x266d01=_0x37bd49;return getEndUser(_0x17e4b6,_0x1ad04d,_0x1a49f3[_0x8cc3('0x67')],_0x1a49f3[_0x8cc3('0x7d')],_0x394f14);})['then'](function(_0xdccd2a){_0x166e04=_0xdccd2a;return getTicket(_0x17e4b6,_0x266d01,_0x166e04,_0x1ad04d,_0x1a49f3,_0x1ad04d[_0x8cc3('0x68')],_0x394f14);})['then'](function(_0x1a741a){_0x26692f=_0x1a741a;logger[_0x8cc3('0x1d')]('['+_0x1a49f3[_0x8cc3('0x7b')][_0x8cc3('0x7c')]()+_0x8cc3('0x7e'),_0x26692f['id']);logger['info']('['+_0x1a49f3[_0x8cc3('0x7b')][_0x8cc3('0x7c')]()+']\x20Integration\x20account\x20type\x20%s.',_0x17e4b6[_0x8cc3('0x3c')]);})[_0x8cc3('0x6e')](function(_0x4e2128){logger['error']('['+_0x1a49f3['lastevent'][_0x8cc3('0x7c')]()+']',_0x4e2128);});}; \ 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 aa698e5..906bf8e 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 _0xd8e7=['The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','result','length','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','then','],\x20getUser\x20entity','true','userId','adminId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','variable','variableName','customVariable','Variable','name','outbound','incident','assign','Subjects','getString','Fields','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]'];(function(_0xb5c98a,_0x4ded2e){var _0x223dfc=function(_0x6a60e5){while(--_0x6a60e5){_0xb5c98a['push'](_0xb5c98a['shift']());}};_0x223dfc(++_0x4ded2e);}(_0xd8e7,0xde));var _0x7d8e=function(_0x4a3632,_0x5df478){_0x4a3632=_0x4a3632-0x0;var _0x261c9a=_0xd8e7[_0x4a3632];return _0x261c9a;};'use strict';var _=require(_0x7d8e('0x0'));var Promise=require(_0x7d8e('0x1'));var rp=require(_0x7d8e('0x2'));var util=require(_0x7d8e('0x3'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x7d8e('0x4'));var config=require(_0x7d8e('0x5'));var logger=require(_0x7d8e('0x6'))(_0x7d8e('0x7'));config['redis']=_[_0x7d8e('0x8')](config[_0x7d8e('0x9')],{'host':_0x7d8e('0xa'),'port':0x18eb});var io=require(_0x7d8e('0xb'))(new Redis(config[_0x7d8e('0x9')]));function getAdminUser(_0x2da2e5,_0x1a0ec8,_0x5118af,_0x2b6096,_0x445cab,_0x12cb14){return new Promise(function(_0xa8314e,_0x2686a0){var _0x1d0f2f={'method':_0x7d8e('0xc'),'uri':_0x2b6096+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x445cab+'&'+_0x12cb14,'auth':_0x1a0ec8,'json':!![]};return rp(_0x1d0f2f)['then'](function(_0x4c9e97){if(_0x4c9e97[_0x7d8e('0xd')][_0x7d8e('0xe')]>0x0){_0x5118af['adminId']=_0x4c9e97[_0x7d8e('0xd')][0x0][_0x7d8e('0xf')];}logger[_0x7d8e('0x10')]('['+[_0x2da2e5[_0x7d8e('0x11')]()]+'],\x20getAdminUser\x20crm',_0x5118af);_0xa8314e(_0x5118af);})[_0x7d8e('0x12')](function(_0x53deb2){logger[_0x7d8e('0x13')]('['+[_0x2da2e5[_0x7d8e('0x11')]()]+']',_0x53deb2[_0x7d8e('0x14')]);_0x2686a0(_0x53deb2[_0x7d8e('0x14')]);});});}function getUser(_0x2eb753,_0x3619d1,_0x5eaa75,_0x50bf75,_0x4a84ac){return function(_0x45a7cd){logger['info']('['+[_0x2eb753[_0x7d8e('0x11')]()]+_0x7d8e('0x15'),_0x45a7cd);return new Promise(function(_0x1041c3,_0x5c132d){if(intUtil[_0x7d8e('0x16')](_0x45a7cd[_0x7d8e('0x17')])){var _0x5e466e={'method':_0x7d8e('0xc'),'uri':_0x5eaa75+_0x7d8e('0x18')+_0x45a7cd[_0x7d8e('0x17')]+'&'+_0x50bf75+'&'+_0x4a84ac,'auth':_0x3619d1,'json':!![]};logger['info']('['+[_0x2eb753[_0x7d8e('0x11')]()]+'],\x20getUser\x20rp\x20obj',_0x5e466e);return rp(_0x5e466e)[_0x7d8e('0x19')](function(_0x55c5d8){logger['info']('['+[_0x2eb753[_0x7d8e('0x11')]()]+_0x7d8e('0x1a'),_0x55c5d8);if(_0x55c5d8[_0x7d8e('0xd')][_0x7d8e('0xe')]>0x0&&String(_0x55c5d8[_0x7d8e('0xd')][0x0]['active'])===_0x7d8e('0x1b')){_0x45a7cd[_0x7d8e('0x1c')]=_0x55c5d8['result'][0x0][_0x7d8e('0xf')];}else{_0x45a7cd[_0x7d8e('0x1c')]=_0x45a7cd[_0x7d8e('0x1d')];_0x45a7cd[_0x7d8e('0x17')]=_0x45a7cd[_0x7d8e('0x1e')];}logger['info']('['+[_0x2eb753[_0x7d8e('0x11')]()]+_0x7d8e('0x1f'),_0x45a7cd);_0x1041c3(_0x45a7cd);})[_0x7d8e('0x12')](function(_0x537acb){logger['error']('['+[_0x2eb753[_0x7d8e('0x11')]()]+']',_0x537acb[_0x7d8e('0x14')]);_0x5c132d(_0x537acb[_0x7d8e('0x14')]);});}else{logger[_0x7d8e('0x10')]('['+[_0x2eb753[_0x7d8e('0x11')]()]+']\x20using\x20admin\x20profile');_0x45a7cd['userId']=_0x45a7cd[_0x7d8e('0x1d')];_0x45a7cd[_0x7d8e('0x17')]=_0x45a7cd['adminEmail'];_0x1041c3(_0x45a7cd);}});};}function createEndUser(_0x40a4b9,_0x30f6da,_0x511b1d,_0x180906,_0x314209){logger['info']('['+[_0x40a4b9[_0x7d8e('0x11')]()]+_0x7d8e('0x20'),_0x511b1d);return new Promise(function(_0x2fe799,_0x44a9cb){var _0x3871f6={'method':_0x7d8e('0x21'),'uri':_0x180906+_0x7d8e('0x22')+_0x314209,'body':{'user_name':_0x511b1d[_0x7d8e('0x23')],'roles':_0x7d8e('0x24'),'first_name':_0x511b1d['endUserNumber'],'active':_0x7d8e('0x1b'),'date_format':_0x7d8e('0x25'),'phone':_0x511b1d['endUserNumber']},'auth':_0x30f6da,'json':!![]};return rp(_0x3871f6)['then'](function(_0x1c2210){logger[_0x7d8e('0x10')]('['+[_0x40a4b9['toUpperCase']()]+'],\x20EndUser\x20schema',_0x1c2210[_0x7d8e('0xd')]);_0x511b1d[_0x7d8e('0x26')]=_0x1c2210[_0x7d8e('0xd')][_0x7d8e('0xf')];_0x2fe799(_0x511b1d);})[_0x7d8e('0x12')](function(_0x4deebd){logger[_0x7d8e('0x13')]('['+[_0x40a4b9[_0x7d8e('0x11')]()]+']',_0x4deebd[_0x7d8e('0x14')]);_0x44a9cb(_0x4deebd[_0x7d8e('0x14')]);});});}function getEndUser(_0x53d999,_0x1fc703,_0x56d755,_0x343196,_0x28a165){return function(_0x237a8f){logger['info']('['+[_0x53d999['toUpperCase']()]+_0x7d8e('0x27'),_0x237a8f);return new Promise(function(_0x1ffa1f,_0x472725){var _0x4d6fba={'method':_0x7d8e('0xc'),'uri':_0x56d755+_0x7d8e('0x28')+_0x237a8f[_0x7d8e('0x23')]+'&'+_0x343196+'&'+_0x28a165,'auth':_0x1fc703,'json':!![]};return rp(_0x4d6fba)['then'](function(_0x363346){if(_0x363346['result'][_0x7d8e('0xe')]>0x0){_0x237a8f['endUserId']=_0x363346[_0x7d8e('0xd')][0x0][_0x7d8e('0xf')];logger[_0x7d8e('0x10')]('['+[_0x53d999[_0x7d8e('0x11')]()]+'],\x20getEndUser\x20crm',_0x237a8f);_0x1ffa1f(_0x237a8f);}else{return createEndUser(_0x53d999,_0x1fc703,_0x237a8f,_0x56d755,_0x343196)['then'](function(_0xc14490){logger[_0x7d8e('0x10')]('['+[_0x53d999[_0x7d8e('0x11')]()]+_0x7d8e('0x29'),_0xc14490);_0x1ffa1f(_0xc14490);});}})[_0x7d8e('0x12')](function(_0x23d826){logger['error']('['+[_0x53d999[_0x7d8e('0x11')]()]+']',_0x23d826[_0x7d8e('0x14')]);_0x472725(_0x23d826[_0x7d8e('0x14')]);});});};}function getCustomFields(_0x324aa4,_0x3749ed){var _0x1ff095={};if(_0x324aa4[_0x7d8e('0xe')]>0x0){_[_0x7d8e('0x2a')](_0x324aa4,function(_0x3c429c){if(_['includes']([_0x7d8e('0x2b'),_0x7d8e('0x2c')],_0x3c429c[_0x7d8e('0x2d')])&&_0x3c429c[_0x7d8e('0x2e')]&&!_0x3c429c[_0x7d8e('0x2f')]){_0x1ff095[_0x3c429c[_0x7d8e('0x2e')][_0x7d8e('0x30')]()]=_0x3c429c[_0x7d8e('0x31')][_0x7d8e('0x32')]();}else if(_[_0x7d8e('0x33')]([_0x7d8e('0x2b'),_0x7d8e('0x2c')],_0x3c429c[_0x7d8e('0x2d')])&&_0x3c429c['idField']&&_0x3c429c['customField']){_0x1ff095[_0x3c429c[_0x7d8e('0x34')][_0x7d8e('0x30')]()]=_0x3c429c[_0x7d8e('0x31')][_0x7d8e('0x32')]();}else if(_0x3c429c['type']===_0x7d8e('0x35')&&_0x3c429c[_0x7d8e('0x36')]&&_0x3c429c[_0x7d8e('0x34')]&&_0x3c429c[_0x7d8e('0x2f')]){_0x1ff095[_0x3c429c[_0x7d8e('0x34')][_0x7d8e('0x30')]()]=_0x3749ed[_0x3c429c[_0x7d8e('0x36')]]['toString']();}else if(_0x3c429c['type']===_0x7d8e('0x37')&&_0x3c429c[_0x7d8e('0x38')]&&_0x3c429c['Variable'][_0x7d8e('0x39')]&&_0x3c429c['idField']&&_0x3c429c['customField']){_0x1ff095[_0x3c429c[_0x7d8e('0x34')][_0x7d8e('0x30')]()]=_0x3749ed[_0x3c429c['Variable']['name'][_0x7d8e('0x30')]()][_0x7d8e('0x32')]();}});}return _0x1ff095;}function getTicket(_0x36c3ec,_0x434ec2,_0x109ea5,_0x4a0fdd,_0x51f9bc,_0xd1df0c){return function(_0xb80bad){logger[_0x7d8e('0x10')]('['+[_0x36c3ec['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0xb80bad);return new Promise(function(_0x44b0ba,_0x2510ed){var _0x962072=_0x36c3ec[_0x7d8e('0x30')]()===_0x7d8e('0x3a')?_0xb80bad[_0x7d8e('0x1c')]:_0xb80bad[_0x7d8e('0x26')];var _0x200739={'method':_0x7d8e('0x21'),'uri':_0x109ea5+_0x7d8e('0x3b')+'?'+_0xd1df0c,'body':Object[_0x7d8e('0x3c')]({},{'active':_0x7d8e('0x1b'),'caller_id':_0x962072,'assigned_to':_0xb80bad[_0x7d8e('0x1c')],'short_description':intUtil['getString'](_0x4a0fdd[_0x7d8e('0x3d')],_0x51f9bc,'\x20'),'description':intUtil[_0x7d8e('0x3e')](_0x4a0fdd['Descriptions'],_0x51f9bc,'\x0a')},getCustomFields(_0x4a0fdd[_0x7d8e('0x3f')],_0x51f9bc)),'auth':_0x434ec2,'json':!![]};return rp(_0x200739)[_0x7d8e('0x19')](function(_0x347d4a){logger[_0x7d8e('0x10')]('['+[_0x36c3ec[_0x7d8e('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x347d4a['result']);_0xb80bad[_0x7d8e('0x40')]=_0x347d4a['result'][_0x7d8e('0xf')];_0xb80bad['ticketNumber']=_0x347d4a[_0x7d8e('0xd')][_0x7d8e('0x41')];logger[_0x7d8e('0x10')]('['+[_0x36c3ec[_0x7d8e('0x11')]()]+_0x7d8e('0x42'),_0xb80bad);_0x44b0ba(_0xb80bad);})['catch'](function(_0x1c1e7b){logger['error']('['+[_0x36c3ec[_0x7d8e('0x11')]()]+']',_0x1c1e7b[_0x7d8e('0x14')]);_0x2510ed(_0x1c1e7b[_0x7d8e('0x14')]);});});};}function createRemoteTag(_0x446bfa,_0x47b3cd,_0x16380c,_0x37d53b){return new Promise(function(_0x53d14f,_0x5dee71){var _0x5f08ce={'method':_0x7d8e('0x21'),'uri':_0x16380c+'label'+'?'+_0x37d53b,'body':{'short_description':_0x446bfa,'global':!![],'active':!![],'name':_0x446bfa},'auth':_0x47b3cd,'json':!![]};return rp(_0x5f08ce)['then'](function(_0x10c3e6){var _0x3cd4f6=_0x10c3e6['result']['sys_id'];_0x53d14f(_0x3cd4f6);});});}function getRemoteTag(_0x11cdad,_0x13ac21,_0x161308,_0x81266b,_0x42db3a){return new Promise(function(_0x3fe94b,_0x277e22){var _0x1329bc={'method':_0x7d8e('0xc'),'uri':_0x161308+_0x7d8e('0x43')+_0x7d8e('0x44')+_0x11cdad+'&'+_0x81266b,'auth':_0x13ac21,'json':!![]};return rp(_0x1329bc)[_0x7d8e('0x19')](function(_0x12faf3){if(_0x12faf3[_0x7d8e('0xd')]['length']>0x0){var _0x5b3999=_0x12faf3['result'][0x0]['sys_id'];_0x3fe94b(_0x5b3999);}else{return createRemoteTag(_0x11cdad,_0x13ac21,_0x161308,_0x81266b)[_0x7d8e('0x19')](function(_0xcd5688){_0x3fe94b(_0xcd5688);});}});});}function assignTagToIncident(_0x305ed1,_0x3d1cde,_0x29515f,_0x107e6a,_0x5c292a){return new Promise(function(_0x391191,_0x1816e4){var _0xb9d9eb={'method':'POST','uri':_0x29515f+_0x7d8e('0x45')+'?'+_0x5c292a,'body':{'label':_0x305ed1,'table':_0x7d8e('0x3b'),'id_type':_0x7d8e('0x46'),'table_key':_0x107e6a['ticketId'],'title':_0x7d8e('0x47')+_0x107e6a[_0x7d8e('0x48')],'id_display':_0x107e6a[_0x7d8e('0x48')]},'auth':_0x3d1cde,'json':!![]};return rp(_0xb9d9eb)['then'](function(_0x58aab5){_0x391191();})['catch'](function(){_0x391191();});});}function manageTags(_0x128eb9,_0x26fd10,_0x1dbde9,_0x31f09b,_0x4a9223,_0x99c4cb,_0x548106){return new Promise(function(_0x3ba444,_0x2e4216){var _0x5eb47c=[];_0x26fd10['forEach'](function(_0x4b2542){_0x5eb47c[_0x7d8e('0x49')](getRemoteTag(_0x4b2542,_0x1dbde9,_0x31f09b,_0x99c4cb,_0x548106));});return Promise['all'](_0x5eb47c)[_0x7d8e('0x19')](function(_0x474665){if(_0x474665[_0x7d8e('0xe')]){logger['info']('['+[_0x128eb9[_0x7d8e('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x474665);var _0x290ed9=[];_0x474665[_0x7d8e('0x2a')](function(_0x1419a2){_0x290ed9[_0x7d8e('0x49')](assignTagToIncident(_0x1419a2,_0x1dbde9,_0x31f09b,_0x4a9223,_0x99c4cb));});return Promise[_0x7d8e('0x4a')](_0x290ed9)[_0x7d8e('0x19')](function(){_0x3ba444();})[_0x7d8e('0x12')](function(){_0x3ba444();});}else{_0x3ba444();}});});}function getTags(_0x1bd832,_0x4c7685,_0x5527e5,_0xf0e116,_0x57dc1b,_0x39cad5){return function(_0x370889){return new Promise(function(_0x2ecb5b,_0x5ccc36){var _0x57ece8=[];var _0x1b64c5=_0xf0e116[_0x7d8e('0x4b')];if(_0x1b64c5&&_0x1b64c5[_0x7d8e('0xe')]>0x0){_0x57ece8=_[_0x7d8e('0x4c')](_0x1b64c5,_0x7d8e('0x39'));}if(_0x57ece8[_0x7d8e('0xe')]>0x0){return manageTags(_0x1bd832,_0x57ece8,_0x4c7685,_0x5527e5,_0x370889,_0x57dc1b,_0x39cad5)['then'](function(){_0x2ecb5b(_0x370889);});}else{_0x2ecb5b(_0x370889);}});};}function emit(_0x38c05f,_0x1af2d4,_0x95b1ae){var _0x56baae=_0x7d8e('0x4d')+_0x7d8e('0x4e')+_0x7d8e('0x4f')+_0x7d8e('0x50');var _0x3d0300={'uri':_0x38c05f+_0x7d8e('0x51')+_0x95b1ae+_0x56baae};io['to'](util['format'](_0x7d8e('0x52'),_0x1af2d4))['emit']('trigger:browser:url',_0x3d0300);}exports['cs']=function(_0x100ea9,_0x2dc5ca,_0x479c72,_0x262455,_0x50cfb6,_0x4de09f,_0x9148d9,_0x1f7653){var _0x1a25c6={};var _0x5bbb33={'user':_0x4de09f[_0x7d8e('0x53')],'pass':_0x4de09f[_0x7d8e('0x54')]};var _0x39a213=_0x7d8e('0x55');var _0x4a1823=_0x7d8e('0x56');_0x4de09f[_0x7d8e('0x57')]=intUtil[_0x7d8e('0x58')](_0x4de09f[_0x7d8e('0x57')]);_0x4de09f[_0x7d8e('0x59')]=intUtil[_0x7d8e('0x58')](_0x4de09f[_0x7d8e('0x59')]);var _0x1c3b33=util[_0x7d8e('0x5a')](_0x7d8e('0x5b'),_0x4de09f[_0x7d8e('0x57')]);_0x1a25c6[_0x7d8e('0x17')]=!_[_0x7d8e('0x5c')](_0x262455)?_0x262455[_0x7d8e('0x5d')]:null;_0x1a25c6[_0x7d8e('0x1e')]=_0x4de09f[_0x7d8e('0x5d')];_0x1a25c6[_0x7d8e('0x23')]=_0x1f7653['toLowerCase']()===_0x7d8e('0x3a')?_0x2dc5ca[_0x7d8e('0x5e')]:_0x2dc5ca[_0x7d8e('0x5f')];_0x1a25c6['callDirection']=_0x1f7653===_0x7d8e('0x60')||_0x1f7653===_0x7d8e('0x61')?_0x7d8e('0x60'):'outbound';var _0x27a24e=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4de09f[_0x7d8e('0x59')],_0x2dc5ca[_0x7d8e('0x62')],md5(_0x2dc5ca[_0x7d8e('0x62')]));if(_0x50cfb6&&_0x50cfb6[_0x7d8e('0x63')]){logger[_0x7d8e('0x10')](_0x7d8e('0x64'),'Recording\x20is\x20enabled!');_0x2dc5ca[_0x7d8e('0x65')]=_0x27a24e;}else if(_0x9148d9&&_0x9148d9[_0x7d8e('0x66')]&&_0x9148d9['recordingFormat']!==_0x7d8e('0x67')){logger[_0x7d8e('0x10')](_0x7d8e('0x68'),'Recording\x20is\x20enabled!');_0x2dc5ca['recordingURL']=_0x27a24e;}else{_0x2dc5ca[_0x7d8e('0x65')]='';}return getAdminUser(_0x1f7653,_0x5bbb33,_0x1a25c6,_0x1c3b33,_0x4a1823,_0x39a213)[_0x7d8e('0x19')](getUser(_0x1f7653,_0x5bbb33,_0x1c3b33,_0x4a1823,_0x39a213))[_0x7d8e('0x19')](getEndUser(_0x1f7653,_0x5bbb33,_0x1c3b33,_0x4a1823,_0x39a213))['then'](getTicket(_0x1f7653,_0x5bbb33,_0x1c3b33,_0x479c72,_0x2dc5ca,_0x4a1823))[_0x7d8e('0x19')](function(_0x313b7a){logger[_0x7d8e('0x10')](util['format'](_0x7d8e('0x69'),_0x313b7a[_0x7d8e('0x40')]));logger[_0x7d8e('0x10')](util[_0x7d8e('0x5a')](_0x7d8e('0x6a'),_0x1f7653));if(_0x1f7653!==_0x7d8e('0x61')){logger['info']('['+[_0x1f7653[_0x7d8e('0x11')]()]+']',_0x7d8e('0x6b'));emit(_0x4de09f[_0x7d8e('0x57')],_0x262455[_0x7d8e('0x39')],_0x313b7a[_0x7d8e('0x40')]);}})[_0x7d8e('0x12')](function(_0x4be1fb){logger['error']('['+[_0x1f7653[_0x7d8e('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x7d8e('0x6c')](_0x4be1fb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9cf3=['servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','active','true','userId','sys_id','adminId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','incident','ticketId','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','util','ioredis','./util'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0x9cf3,0x19d));var _0x39cf=function(_0x2f7fe7,_0x178b57){_0x2f7fe7=_0x2f7fe7-0x0;var _0x20001e=_0x9cf3[_0x2f7fe7];return _0x20001e;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x39cf('0x0'));var md5=require('md5');var Redis=require(_0x39cf('0x1'));var intUtil=require(_0x39cf('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x39cf('0x3'));config[_0x39cf('0x4')]=_[_0x39cf('0x5')](config['redis'],{'host':_0x39cf('0x6'),'port':0x18eb});var io=require(_0x39cf('0x7'))(new Redis(config[_0x39cf('0x4')]));function getAdminUser(_0x33b2e4,_0x14ab5d,_0x3600b5,_0x208f99,_0x7f0374,_0xd83fbf){return new Promise(function(_0x1a57f7,_0x32adea){var _0x47792b={'method':_0x39cf('0x8'),'uri':_0x208f99+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x7f0374+'&'+_0xd83fbf,'auth':_0x14ab5d,'json':!![]};return rp(_0x47792b)[_0x39cf('0x9')](function(_0x204802){if(_0x204802[_0x39cf('0xa')][_0x39cf('0xb')]>0x0){_0x3600b5['adminId']=_0x204802['result'][0x0]['sys_id'];}logger['info']('['+[_0x33b2e4[_0x39cf('0xc')]()]+_0x39cf('0xd'),_0x3600b5);_0x1a57f7(_0x3600b5);})[_0x39cf('0xe')](function(_0x2f680e){logger[_0x39cf('0xf')]('['+[_0x33b2e4[_0x39cf('0xc')]()]+']',_0x2f680e[_0x39cf('0x10')]);_0x32adea(_0x2f680e[_0x39cf('0x10')]);});});}function getUser(_0x5ab8c8,_0x484c80,_0x1958ca,_0x1bdacb,_0x51638a){return function(_0x5e829e){logger['info']('['+[_0x5ab8c8[_0x39cf('0xc')]()]+_0x39cf('0x11'),_0x5e829e);return new Promise(function(_0x598c7e,_0x4ad3c5){if(intUtil['validateEmail'](_0x5e829e[_0x39cf('0x12')])){var _0xe9e6dc={'method':'GET','uri':_0x1958ca+_0x39cf('0x13')+_0x5e829e[_0x39cf('0x12')]+'&'+_0x1bdacb+'&'+_0x51638a,'auth':_0x484c80,'json':!![]};logger[_0x39cf('0x14')]('['+[_0x5ab8c8['toUpperCase']()]+_0x39cf('0x15'),_0xe9e6dc);return rp(_0xe9e6dc)['then'](function(_0x39e336){logger[_0x39cf('0x14')]('['+[_0x5ab8c8['toUpperCase']()]+'],\x20getUser\x20entity',_0x39e336);if(_0x39e336[_0x39cf('0xa')][_0x39cf('0xb')]>0x0&&String(_0x39e336[_0x39cf('0xa')][0x0][_0x39cf('0x16')])===_0x39cf('0x17')){_0x5e829e[_0x39cf('0x18')]=_0x39e336[_0x39cf('0xa')][0x0][_0x39cf('0x19')];}else{_0x5e829e[_0x39cf('0x18')]=_0x5e829e[_0x39cf('0x1a')];_0x5e829e[_0x39cf('0x12')]=_0x5e829e[_0x39cf('0x1b')];}logger[_0x39cf('0x14')]('['+[_0x5ab8c8[_0x39cf('0xc')]()]+'],\x20getUser\x20crm',_0x5e829e);_0x598c7e(_0x5e829e);})[_0x39cf('0xe')](function(_0x115bcf){logger[_0x39cf('0xf')]('['+[_0x5ab8c8['toUpperCase']()]+']',_0x115bcf['message']);_0x4ad3c5(_0x115bcf['message']);});}else{logger[_0x39cf('0x14')]('['+[_0x5ab8c8[_0x39cf('0xc')]()]+_0x39cf('0x1c'));_0x5e829e[_0x39cf('0x18')]=_0x5e829e['adminId'];_0x5e829e[_0x39cf('0x12')]=_0x5e829e[_0x39cf('0x1b')];_0x598c7e(_0x5e829e);}});};}function createEndUser(_0x5f5c63,_0x214929,_0xebd7c1,_0x300b1b,_0x5d9cf2){logger[_0x39cf('0x14')]('['+[_0x5f5c63[_0x39cf('0xc')]()]+_0x39cf('0x1d'),_0xebd7c1);return new Promise(function(_0x4a49b3,_0x41e8c0){var _0x20a7da={'method':_0x39cf('0x1e'),'uri':_0x300b1b+_0x39cf('0x1f')+_0x5d9cf2,'body':{'user_name':_0xebd7c1['endUserNumber'],'roles':_0x39cf('0x20'),'first_name':_0xebd7c1[_0x39cf('0x21')],'active':_0x39cf('0x17'),'date_format':'System','phone':_0xebd7c1[_0x39cf('0x21')]},'auth':_0x214929,'json':!![]};return rp(_0x20a7da)[_0x39cf('0x9')](function(_0x3e9d74){logger[_0x39cf('0x14')]('['+[_0x5f5c63['toUpperCase']()]+_0x39cf('0x22'),_0x3e9d74[_0x39cf('0xa')]);_0xebd7c1['endUserId']=_0x3e9d74[_0x39cf('0xa')][_0x39cf('0x19')];_0x4a49b3(_0xebd7c1);})[_0x39cf('0xe')](function(_0x4459a4){logger[_0x39cf('0xf')]('['+[_0x5f5c63[_0x39cf('0xc')]()]+']',_0x4459a4[_0x39cf('0x10')]);_0x41e8c0(_0x4459a4[_0x39cf('0x10')]);});});}function getEndUser(_0x2195a7,_0x5e2dce,_0x4b98a0,_0x4eb0d6,_0xc80225){return function(_0x42645b){logger[_0x39cf('0x14')]('['+[_0x2195a7[_0x39cf('0xc')]()]+_0x39cf('0x23'),_0x42645b);return new Promise(function(_0x3ee767,_0x1c7f64){var _0x19f4ad={'method':_0x39cf('0x8'),'uri':_0x4b98a0+_0x39cf('0x24')+_0x42645b[_0x39cf('0x21')]+'&'+_0x4eb0d6+'&'+_0xc80225,'auth':_0x5e2dce,'json':!![]};return rp(_0x19f4ad)['then'](function(_0x1b5457){if(_0x1b5457['result'][_0x39cf('0xb')]>0x0){_0x42645b[_0x39cf('0x25')]=_0x1b5457['result'][0x0][_0x39cf('0x19')];logger[_0x39cf('0x14')]('['+[_0x2195a7['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x42645b);_0x3ee767(_0x42645b);}else{return createEndUser(_0x2195a7,_0x5e2dce,_0x42645b,_0x4b98a0,_0x4eb0d6)['then'](function(_0x2b0d34){logger['info']('['+[_0x2195a7[_0x39cf('0xc')]()]+_0x39cf('0x26'),_0x2b0d34);_0x3ee767(_0x2b0d34);});}})[_0x39cf('0xe')](function(_0x173d28){logger[_0x39cf('0xf')]('['+[_0x2195a7['toUpperCase']()]+']',_0x173d28[_0x39cf('0x10')]);_0x1c7f64(_0x173d28['message']);});});};}function getCustomFields(_0x133107,_0x3b89cb){var _0x534261={};if(_0x133107['length']>0x0){_[_0x39cf('0x27')](_0x133107,function(_0x5080ae){if(_['includes']([_0x39cf('0x28'),_0x39cf('0x29')],_0x5080ae[_0x39cf('0x2a')])&&_0x5080ae[_0x39cf('0x2b')]&&!_0x5080ae[_0x39cf('0x2c')]){_0x534261[_0x5080ae[_0x39cf('0x2b')][_0x39cf('0x2d')]()]=_0x5080ae[_0x39cf('0x2e')][_0x39cf('0x2f')]();}else if(_[_0x39cf('0x30')]([_0x39cf('0x28'),_0x39cf('0x29')],_0x5080ae[_0x39cf('0x2a')])&&_0x5080ae[_0x39cf('0x31')]&&_0x5080ae['customField']){_0x534261[_0x5080ae['idField'][_0x39cf('0x2d')]()]=_0x5080ae[_0x39cf('0x2e')]['toString']();}else if(_0x5080ae[_0x39cf('0x2a')]===_0x39cf('0x32')&&_0x5080ae[_0x39cf('0x33')]&&_0x5080ae[_0x39cf('0x31')]&&_0x5080ae[_0x39cf('0x2c')]){_0x534261[_0x5080ae[_0x39cf('0x31')][_0x39cf('0x2d')]()]=_0x3b89cb[_0x5080ae['variableName']][_0x39cf('0x2f')]();}else if(_0x5080ae[_0x39cf('0x2a')]==='customVariable'&&_0x5080ae[_0x39cf('0x34')]&&_0x5080ae['Variable'][_0x39cf('0x35')]&&_0x5080ae[_0x39cf('0x31')]&&_0x5080ae[_0x39cf('0x2c')]){_0x534261[_0x5080ae[_0x39cf('0x31')][_0x39cf('0x2d')]()]=_0x3b89cb[_0x5080ae[_0x39cf('0x34')]['name']['toLowerCase']()]['toString']();}});}return _0x534261;}function getTicket(_0x11ebe1,_0x5972f5,_0x5b9a5f,_0x5e5a64,_0x21b6a4,_0x54a4a6){return function(_0x48d3f5){logger[_0x39cf('0x14')]('['+[_0x11ebe1['toUpperCase']()]+_0x39cf('0x36'),_0x48d3f5);return new Promise(function(_0x3fb4e4,_0x3d6d93){var _0x2d5af3=_0x11ebe1[_0x39cf('0x2d')]()===_0x39cf('0x37')?_0x48d3f5[_0x39cf('0x18')]:_0x48d3f5[_0x39cf('0x25')];var _0x1fa330={'method':_0x39cf('0x1e'),'uri':_0x5b9a5f+'incident'+'?'+_0x54a4a6,'body':Object[_0x39cf('0x38')]({},{'active':'true','caller_id':_0x2d5af3,'assigned_to':_0x48d3f5[_0x39cf('0x18')],'short_description':intUtil[_0x39cf('0x39')](_0x5e5a64[_0x39cf('0x3a')],_0x21b6a4,'\x20'),'description':intUtil[_0x39cf('0x39')](_0x5e5a64[_0x39cf('0x3b')],_0x21b6a4,'\x0a')},getCustomFields(_0x5e5a64['Fields'],_0x21b6a4)),'auth':_0x5972f5,'json':!![]};return rp(_0x1fa330)['then'](function(_0x1b0f98){logger['info']('['+[_0x11ebe1[_0x39cf('0xc')]()]+_0x39cf('0x3c'),_0x1b0f98[_0x39cf('0xa')]);_0x48d3f5['ticketId']=_0x1b0f98['result'][_0x39cf('0x19')];_0x48d3f5[_0x39cf('0x3d')]=_0x1b0f98['result']['number'];logger[_0x39cf('0x14')]('['+[_0x11ebe1[_0x39cf('0xc')]()]+_0x39cf('0x3e'),_0x48d3f5);_0x3fb4e4(_0x48d3f5);})[_0x39cf('0xe')](function(_0x32a001){logger['error']('['+[_0x11ebe1[_0x39cf('0xc')]()]+']',_0x32a001[_0x39cf('0x10')]);_0x3d6d93(_0x32a001['message']);});});};}function createRemoteTag(_0x4a67df,_0x4def67,_0x489a64,_0x35044c){return new Promise(function(_0x10e7a4,_0x19a696){var _0x4a98be={'method':_0x39cf('0x1e'),'uri':_0x489a64+'label'+'?'+_0x35044c,'body':{'short_description':_0x4a67df,'global':!![],'active':!![],'name':_0x4a67df},'auth':_0x4def67,'json':!![]};return rp(_0x4a98be)['then'](function(_0x70d76b){var _0x2e17f7=_0x70d76b[_0x39cf('0xa')]['sys_id'];_0x10e7a4(_0x2e17f7);});});}function getRemoteTag(_0x1214e9,_0x545036,_0x5283f9,_0x563e21,_0x379033){return new Promise(function(_0x382775,_0x3a6dab){var _0x424f70={'method':'GET','uri':_0x5283f9+_0x39cf('0x3f')+_0x39cf('0x40')+_0x1214e9+'&'+_0x563e21,'auth':_0x545036,'json':!![]};return rp(_0x424f70)['then'](function(_0x521ba0){if(_0x521ba0['result'][_0x39cf('0xb')]>0x0){var _0x144bdc=_0x521ba0['result'][0x0][_0x39cf('0x19')];_0x382775(_0x144bdc);}else{return createRemoteTag(_0x1214e9,_0x545036,_0x5283f9,_0x563e21)[_0x39cf('0x9')](function(_0x3e1896){_0x382775(_0x3e1896);});}});});}function assignTagToIncident(_0xae91fb,_0x2d604e,_0x98f469,_0x13c47e,_0x413d0a){return new Promise(function(_0x124427,_0x3f66ba){var _0x51b716={'method':_0x39cf('0x1e'),'uri':_0x98f469+'label_entry'+'?'+_0x413d0a,'body':{'label':_0xae91fb,'table':_0x39cf('0x41'),'id_type':'Incident','table_key':_0x13c47e[_0x39cf('0x42')],'title':_0x39cf('0x43')+_0x13c47e[_0x39cf('0x3d')],'id_display':_0x13c47e[_0x39cf('0x3d')]},'auth':_0x2d604e,'json':!![]};return rp(_0x51b716)[_0x39cf('0x9')](function(_0x123886){_0x124427();})[_0x39cf('0xe')](function(){_0x124427();});});}function manageTags(_0x4ca718,_0x265e15,_0x5d7818,_0x481769,_0x47c291,_0x577b1e,_0x56bc30){return new Promise(function(_0x2f2a19,_0x13a3d1){var _0x52bda2=[];_0x265e15[_0x39cf('0x27')](function(_0x146348){_0x52bda2['push'](getRemoteTag(_0x146348,_0x5d7818,_0x481769,_0x577b1e,_0x56bc30));});return Promise[_0x39cf('0x44')](_0x52bda2)[_0x39cf('0x9')](function(_0x13acf2){if(_0x13acf2['length']){logger['info']('['+[_0x4ca718[_0x39cf('0xc')]()]+_0x39cf('0x45'),_0x13acf2);var _0x45c140=[];_0x13acf2[_0x39cf('0x27')](function(_0x35fced){_0x45c140[_0x39cf('0x46')](assignTagToIncident(_0x35fced,_0x5d7818,_0x481769,_0x47c291,_0x577b1e));});return Promise[_0x39cf('0x44')](_0x45c140)[_0x39cf('0x9')](function(){_0x2f2a19();})[_0x39cf('0xe')](function(){_0x2f2a19();});}else{_0x2f2a19();}});});}function getTags(_0x25cca0,_0x31d052,_0x3a401a,_0x5f105c,_0x241eb4,_0x767f9){return function(_0x2fd503){return new Promise(function(_0x42a5ba,_0x57c8c0){var _0x218a36=[];var _0x1638e5=_0x5f105c['Tags'];if(_0x1638e5&&_0x1638e5[_0x39cf('0xb')]>0x0){_0x218a36=_[_0x39cf('0x47')](_0x1638e5,'name');}if(_0x218a36['length']>0x0){return manageTags(_0x25cca0,_0x218a36,_0x31d052,_0x3a401a,_0x2fd503,_0x241eb4,_0x767f9)['then'](function(){_0x42a5ba(_0x2fd503);});}else{_0x42a5ba(_0x2fd503);}});};}function emit(_0x598fdb,_0x2580b8,_0x7738b9){var _0x49f6dd=_0x39cf('0x48')+_0x39cf('0x49')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x39cf('0x4a');var _0x4b6290={'uri':_0x598fdb+_0x39cf('0x4b')+_0x7738b9+_0x49f6dd};io['to'](util['format'](_0x39cf('0x4c'),_0x2580b8))[_0x39cf('0x4d')]('trigger:browser:url',_0x4b6290);}exports['cs']=function(_0x2d6e04,_0x318300,_0x31a3f7,_0x51bea2,_0x1b2264,_0x135a8c,_0x112c4a,_0x40a44c){var _0x30ac89={};var _0x1daa90={'user':_0x135a8c[_0x39cf('0x4e')],'pass':_0x135a8c[_0x39cf('0x4f')]};var _0x706ccd=_0x39cf('0x50');var _0x4a0930=_0x39cf('0x51');_0x135a8c[_0x39cf('0x52')]=intUtil[_0x39cf('0x53')](_0x135a8c['remoteUri']);_0x135a8c[_0x39cf('0x54')]=intUtil[_0x39cf('0x53')](_0x135a8c['serverUrl']);var _0x46cd65=util[_0x39cf('0x55')](_0x39cf('0x56'),_0x135a8c[_0x39cf('0x52')]);_0x30ac89['userEmail']=!_[_0x39cf('0x57')](_0x51bea2)?_0x51bea2[_0x39cf('0x58')]:null;_0x30ac89[_0x39cf('0x1b')]=_0x135a8c[_0x39cf('0x58')];_0x30ac89[_0x39cf('0x21')]=_0x40a44c[_0x39cf('0x2d')]()===_0x39cf('0x37')?_0x318300[_0x39cf('0x59')]:_0x318300['calleridnum'];_0x30ac89[_0x39cf('0x5a')]=_0x40a44c==='queue'||_0x40a44c===_0x39cf('0x5b')?_0x39cf('0x5c'):'outbound';var _0x5c2077=util[_0x39cf('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x135a8c[_0x39cf('0x54')],_0x318300[_0x39cf('0x5d')],md5(_0x318300[_0x39cf('0x5d')]));if(_0x1b2264&&_0x1b2264[_0x39cf('0x5e')]){logger[_0x39cf('0x14')](_0x39cf('0x5f'),'Recording\x20is\x20enabled!');_0x318300[_0x39cf('0x60')]=_0x5c2077;}else if(_0x112c4a&&_0x112c4a[_0x39cf('0x61')]&&_0x112c4a[_0x39cf('0x61')]!=='none'){logger[_0x39cf('0x14')](_0x39cf('0x62'),_0x39cf('0x63'));_0x318300[_0x39cf('0x60')]=_0x5c2077;}else{_0x318300[_0x39cf('0x60')]='';}return getAdminUser(_0x40a44c,_0x1daa90,_0x30ac89,_0x46cd65,_0x4a0930,_0x706ccd)['then'](getUser(_0x40a44c,_0x1daa90,_0x46cd65,_0x4a0930,_0x706ccd))[_0x39cf('0x9')](getEndUser(_0x40a44c,_0x1daa90,_0x46cd65,_0x4a0930,_0x706ccd))[_0x39cf('0x9')](getTicket(_0x40a44c,_0x1daa90,_0x46cd65,_0x31a3f7,_0x318300,_0x4a0930))['then'](function(_0x3478c7){logger['info'](util[_0x39cf('0x55')](_0x39cf('0x64'),_0x3478c7[_0x39cf('0x42')]));logger['info'](util['format'](_0x39cf('0x65'),_0x40a44c));if(_0x40a44c!==_0x39cf('0x5b')){logger[_0x39cf('0x14')]('['+[_0x40a44c[_0x39cf('0xc')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x135a8c['remoteUri'],_0x51bea2[_0x39cf('0x35')],_0x3478c7['ticketId']);}})[_0x39cf('0xe')](function(_0x5b4297){logger[_0x39cf('0xf')]('['+[_0x40a44c[_0x39cf('0xc')]()]+_0x39cf('0x66'),util[_0x39cf('0x67')](_0x5b4297,{'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 17565c9..af1fdb8 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 _0x7554=['redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','length','forEach','variableName','idField','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Enduser\x20created.','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','string','custom_fields','push','variable','customVariable','Variable','login','username','password','PLAIN','sessionID','set_relationship','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','outbound','none','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','error','toUpperCase','The\x20User\x20ID\x20is:','calleridname','lastevent','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm'];(function(_0x3986c4,_0x4d20d5){var _0x4911bb=function(_0xecb85c){while(--_0xecb85c){_0x3986c4['push'](_0x3986c4['shift']());}};_0x4911bb(++_0x4d20d5);}(_0x7554,0xe7));var _0x4755=function(_0x38aeb0,_0x13c43f){_0x38aeb0=_0x38aeb0-0x0;var _0x2ce77f=_0x7554[_0x38aeb0];return _0x2ce77f;};'use strict';var _=require(_0x4755('0x0'));var rp=require(_0x4755('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x4755('0x2'));var intUtil=require(_0x4755('0x3'));var config=require(_0x4755('0x4'));var logger=require(_0x4755('0x5'))(_0x4755('0x6'));config[_0x4755('0x7')]=_[_0x4755('0x8')](config[_0x4755('0x7')],{'host':_0x4755('0x9'),'port':0x18eb});var io=require(_0x4755('0xa'))(new Redis(config['redis']));var def={'method':_0x4755('0xb'),'json':!![]};function emit(_0xf3cfc8,_0x13b54c,_0x3546c4){io['to'](_0xf3cfc8)[_0x4755('0xc')](_0x13b54c,_0x3546c4);}function getTicket(_0x2cc66d,_0x33132f,_0x2a8d03,_0x2b65f0,_0x1c00ec,_0x594418,_0x5d2ddc,_0x341980){logger[_0x4755('0xd')](_0x4755('0xe'));var _0x3af438=new Date();var _0x4e42b1=[{'name':_0x4755('0xf'),'value':intUtil[_0x4755('0x10')](_0x2b65f0['Subjects'],_0x1c00ec,'\x20')},{'name':_0x4755('0x11'),'value':_0x33132f['id']},{'name':_0x4755('0x12'),'value':_0x33132f['id']},{'name':_0x4755('0x13'),'value':intUtil[_0x4755('0x10')](_0x2b65f0[_0x4755('0x14')],_0x1c00ec,'\x0a')},{'name':'date_start','value':_0x3af438[_0x4755('0x15')]()[_0x4755('0x16')](0x0,0x13)[_0x4755('0x17')]('T','\x20')},{'name':_0x4755('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x4755('0x19'),'value':_0x2a8d03['id']},{'name':_0x4755('0x1a'),'value':'Contacts'},{'name':_0x4755('0x1b'),'value':_0x2a8d03['name']},{'name':_0x4755('0x1c'),'value':_0x341980}];if(_0x594418[_0x4755('0x1d')]){_[_0x4755('0x1e')](_0x594418,function(_0x404ccc){if(_0x1c00ec[_0x404ccc[_0x4755('0x1f')]]){_0x4e42b1['push']({'name':_0x404ccc[_0x4755('0x20')],'value':_0x1c00ec[_0x404ccc[_0x4755('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x4755('0x21'),'rest_data':JSON['stringify']({'session':_0x5d2ddc['id'],'module_name':_0x4755('0x22'),'name_value_list':_0x4e42b1})}});}function getAuth(_0xed1cdf){return util[_0x4755('0x23')](_0x4755('0x24'),new Buffer(_0xed1cdf[_0x4755('0x25')]+':X')[_0x4755('0x26')](_0x4755('0x27')));}function getServerInfo(_0x1cb2b0){return request({'form':{'method':_0x4755('0x28'),'input_type':_0x4755('0x21'),'response_type':'JSON','rest_data':JSON[_0x4755('0x29')]({'session':_0x1cb2b0['id']})}});}function getUser(_0x742f09,_0xe23bfd,_0x533a82){if(!_[_0x4755('0x2a')](_0xe23bfd)){logger[_0x4755('0xd')](_0x4755('0x2b'),_0xe23bfd);return request({'form':{'method':_0x4755('0x2c'),'input_type':'JSON','response_type':_0x4755('0x21'),'rest_data':JSON[_0x4755('0x29')]({'session':_0x533a82['id'],'module_name':'Employees','query':util[_0x4755('0x23')](_0x4755('0x2d'),_0xe23bfd),'order_by':'','offset':'0','select_fields':['id',_0x4755('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4755('0x2e')](function(_0x21831a){if(_0x21831a[_0x4755('0x2f')][_0x4755('0x1d')]){var _0x1df437=_[_0x4755('0x30')](_0x21831a['entry_list'],function(_0x30dd18){return _0x30dd18[_0x4755('0x31')][_0x4755('0x32')][_0x4755('0x33')]===_0xe23bfd;});if(_0x1df437){logger[_0x4755('0xd')](_0x4755('0x34'));return BPromise['resolve']({'id':_0x1df437['name_value_list']['id'][_0x4755('0x33')],'name':_0x1df437['name_value_list'][_0x4755('0xf')][_0x4755('0x33')]});}}logger[_0x4755('0xd')](_0x4755('0x35'));return BPromise[_0x4755('0x36')]({'id':_0x533a82[_0x4755('0x31')][_0x4755('0x37')][_0x4755('0x33')],'name':_0x533a82[_0x4755('0x31')][_0x4755('0x32')][_0x4755('0x33')]});});}else{logger[_0x4755('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4755('0x36')]({'id':_0x533a82[_0x4755('0x31')][_0x4755('0x37')][_0x4755('0x33')],'name':_0x533a82[_0x4755('0x31')][_0x4755('0x32')][_0x4755('0x33')]});}}function getEndUser(_0x28863f,_0x392d40,_0x3e7021,_0x4ba706){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3e7021);return request({'form':{'method':_0x4755('0x2c'),'input_type':_0x4755('0x21'),'response_type':_0x4755('0x21'),'rest_data':JSON[_0x4755('0x29')]({'session':_0x4ba706['id'],'module_name':_0x4755('0x38'),'query':util[_0x4755('0x23')](_0x4755('0x39'),_0x3e7021),'order_by':'','offset':'0','select_fields':['id',_0x4755('0xf'),_0x4755('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4755('0x2e')](function(_0x4e96c8){if(_0x4e96c8['entry_list'][_0x4755('0x1d')]){var _0x301a31=_[_0x4755('0x30')](_0x4e96c8[_0x4755('0x2f')],function(_0x6d36da){return _0x6d36da[_0x4755('0x31')][_0x4755('0x3a')]['value']===_0x3e7021;});if(_0x301a31){logger[_0x4755('0xd')]('Enduser\x20found!');return BPromise[_0x4755('0x36')]({'id':_0x301a31[_0x4755('0x31')]['id'][_0x4755('0x33')],'name':_0x301a31[_0x4755('0x31')]['name'][_0x4755('0x33')],'phone':_0x301a31[_0x4755('0x31')]['phone_home']['value']});}}else{logger['info'](_0x4755('0x3b'));return request({'form':{'method':_0x4755('0x3c'),'input_type':_0x4755('0x21'),'response_type':_0x4755('0x21'),'rest_data':JSON[_0x4755('0x29')]({'session':_0x4ba706['id'],'module_name':_0x4755('0x38'),'name_value_list':[{'name':_0x4755('0x3d'),'value':_0x392d40!==_0x4755('0x3e')?_0x392d40:util['format']('Caller\x20-\x20%s',_0x3e7021)},{'name':_0x4755('0x3a'),'value':_0x3e7021}]})}})[_0x4755('0x2e')](function(_0x18b9eb){logger[_0x4755('0xd')](_0x4755('0x3f'));return BPromise['resolve']({'id':_0x18b9eb['id'],'name':_0x18b9eb[_0x4755('0x2f')][_0x4755('0x3d')][_0x4755('0x33')],'phone':_0x18b9eb[_0x4755('0x2f')][_0x4755('0x3a')]['value']});});}});}function request(_0x58b1a4){logger['debug'](_0x4755('0x40'),JSON[_0x4755('0x29')](_0x58b1a4));return rp(_[_0x4755('0x41')](def,_0x58b1a4));}function getTags(_0x4357b6,_0x3ad6dd){var _0x2e6af9=[];if(_0x4357b6&&_0x4357b6[_0x4755('0x1d')]>0x0){_0x2e6af9=_[_0x4755('0x42')](_0x4357b6,_0x3ad6dd);}return _0x2e6af9;}function getCustomFields(_0x433597,_0x214471){var _0x65c02a=[];var _0x317e55={'custom_fields':[]};if(_0x433597[_0x4755('0x1d')]>0x0){_['forEach'](_0x433597,function(_0x49c8d9){if(_0x49c8d9[_0x4755('0x43')]==='string'&&_0x49c8d9[_0x4755('0x44')]&&!_0x49c8d9[_0x4755('0x45')]){_0x317e55[_0x49c8d9[_0x4755('0x44')][_0x4755('0x46')]()]=_0x49c8d9[_0x4755('0x47')][_0x4755('0x26')]();}else if(_0x49c8d9[_0x4755('0x43')]===_0x4755('0x48')&&_0x49c8d9[_0x4755('0x20')]&&_0x49c8d9[_0x4755('0x45')]){_0x317e55[_0x4755('0x49')][_0x4755('0x4a')]({'id':_0x49c8d9[_0x4755('0x20')],'value':_0x49c8d9[_0x4755('0x47')][_0x4755('0x26')]()});}else if(_0x49c8d9[_0x4755('0x43')]===_0x4755('0x4b')&&_0x49c8d9['variableName']&&_0x49c8d9[_0x4755('0x20')]&&_0x49c8d9[_0x4755('0x45')]){_0x214471[_0x49c8d9['variableName']]&&_0x317e55[_0x4755('0x49')][_0x4755('0x4a')]({'id':_0x49c8d9[_0x4755('0x20')],'value':_0x214471[_0x49c8d9[_0x4755('0x1f')]]['toString']()});}else if(_0x49c8d9[_0x4755('0x43')]===_0x4755('0x4c')&&_0x49c8d9[_0x4755('0x4d')]&&_0x49c8d9[_0x4755('0x4d')][_0x4755('0xf')]&&_0x49c8d9[_0x4755('0x20')]&&_0x49c8d9[_0x4755('0x45')]){_0x214471[_0x49c8d9[_0x4755('0x4d')][_0x4755('0xf')][_0x4755('0x46')]()]&&_0x317e55['custom_fields'][_0x4755('0x4a')]({'id':_0x49c8d9[_0x4755('0x20')],'value':_0x214471[_0x49c8d9[_0x4755('0x4d')][_0x4755('0xf')]['toLowerCase']()][_0x4755('0x26')]()});}});}return _0x317e55;}function getConnection(_0x2c7f93){return request({'method':_0x4755('0xb'),'form':{'method':_0x4755('0x4e'),'input_type':_0x4755('0x21'),'response_type':'JSON','rest_data':JSON[_0x4755('0x29')]({'user_auth':{'user_name':_0x2c7f93[_0x4755('0x4f')],'password':_0x2c7f93[_0x4755('0x50')],'encryption':_0x4755('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4755('0x2e')](function(_0x39b11d){var _0x523707=_0x39b11d;if(_0x523707['id']){def[_0x4755('0x52')]=_0x523707['id'];return BPromise['resolve'](_0x523707);}else{throw new Error(util[_0x4755('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x2c7f93['id']));}});}function setRelationship(_0xc9cc63,_0x18779c,_0x872d80,_0x59880c){return request({'form':{'method':_0x4755('0x53'),'input_type':_0x4755('0x21'),'response_type':_0x4755('0x21'),'rest_data':JSON['stringify']({'session':_0xc9cc63['id'],'module_name':'Calls','module_id':_0x872d80['id'],'link_field_name':_0x59880c,'related_ids':[_0x18779c['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2a4b8f,_0x48edb2,_0x3f5998,_0x1b76bc,_0x2b075a,_0x2e1868){var _0xd01f4c,_0x375e3d,_0x3f9930,_0x3bf0c6;_0x2e1868['remoteUri']=intUtil[_0x4755('0x54')](_0x2e1868[_0x4755('0x55')]);_0x2e1868['serverUrl']=intUtil[_0x4755('0x54')](_0x2e1868[_0x4755('0x56')]);def[_0x4755('0x57')]=util['format'](_0x4755('0x58'),_0x2e1868[_0x4755('0x55')]);if(_0x2b075a&&_0x2b075a['monitor_format']){logger[_0x4755('0xd')](_0x4755('0x59'),_0x4755('0x5a'));_0x48edb2[_0x4755('0x5b')]=util[_0x4755('0x23')](_0x4755('0x5c'),_0x2e1868[_0x4755('0x56')],_0x48edb2[_0x4755('0x5d')],md5(_0x48edb2[_0x4755('0x5d')]));}else{_0x48edb2[_0x4755('0x5b')]='';}return getConnection(_0x2e1868)[_0x4755('0x2e')](function(_0xd4ad55){_0x3bf0c6=_0xd4ad55;return getUser(_0x2e1868,_0x1b76bc[_0x4755('0xf')],_0x3bf0c6);})[_0x4755('0x2e')](function(_0x24ec0a){_0xd01f4c=_0x24ec0a;logger['info']('The\x20User\x20ID\x20is:',_0xd01f4c['id']);return getEndUser(_0x2e1868,_0x48edb2['calleridname'],_0x48edb2[_0x4755('0x5e')],_0x3bf0c6);})[_0x4755('0x2e')](function(_0x159b63){_0x375e3d=_0x159b63;logger['info'](_0x4755('0x5f'),_0x375e3d['id']);return getTicket(_0x2e1868,_0xd01f4c,_0x375e3d,_0x3f5998,_0x48edb2,_0x3f5998[_0x4755('0x60')],_0x3bf0c6,_0x4755('0x61'));})[_0x4755('0x2e')](function(_0x56b421){_0x3f9930=_0x56b421;logger[_0x4755('0xd')](_0x4755('0x62'));logger[_0x4755('0xd')](_0x4755('0x63'),_0x3f9930['id']);return setRelationship(_0x3bf0c6,_0xd01f4c,_0x3f9930,_0x4755('0x64'));})[_0x4755('0x2e')](function(){return setRelationship(_0x3bf0c6,_0x375e3d,_0x3f9930,_0x4755('0x65'));})[_0x4755('0x2e')](function(){return getServerInfo(_0x3bf0c6);})[_0x4755('0x2e')](function(_0x248d8f){var _0x3e148d=parseInt(_0x248d8f[_0x4755('0x66')][_0x4755('0x67')](0x0));var _0x12d472=util['format'](_0x4755('0x68'),_0x2e1868[_0x4755('0x55')],_0x3f9930['id']);if(_0x3e148d>0x6){_0x12d472=util[_0x4755('0x23')](_0x4755('0x69'),_0x2e1868[_0x4755('0x55')],_0x3f9930['id']);}logger[_0x4755('0xd')](_0x4755('0x59'),_0x4755('0x6a'));emit(util[_0x4755('0x23')]('user:%s',_0x1b76bc[_0x4755('0xf')]),'trigger:browser:url',{'uri':_0x12d472});})[_0x4755('0x6b')](function(_0x36dcb9){logger['error'](_0x4755('0x59'),JSON[_0x4755('0x29')](_0x36dcb9));});};exports[_0x4755('0x6c')]=function(_0x237a72,_0x23e295,_0x452eb1,_0x1f94ee,_0x1c5e93,_0x437273,_0x2de3c0){var _0x4f9204,_0xf0c9ba,_0x2ccd33,_0x55a53;_0x437273[_0x4755('0x55')]=intUtil[_0x4755('0x54')](_0x437273[_0x4755('0x55')]);_0x437273[_0x4755('0x56')]=intUtil[_0x4755('0x54')](_0x437273[_0x4755('0x56')]);def[_0x4755('0x57')]=util[_0x4755('0x23')](_0x4755('0x58'),_0x437273[_0x4755('0x55')]);if(_0x2de3c0&&_0x2de3c0['recordingFormat']&&_0x2de3c0['recordingFormat']!==_0x4755('0x6d')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x23e295[_0x4755('0x5b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x437273[_0x4755('0x56')],_0x23e295['uniqueid'],md5(_0x23e295[_0x4755('0x5d')]));}return getConnection(_0x437273)[_0x4755('0x2e')](function(_0x2de915){_0x55a53=_0x2de915;return getUser(_0x437273,_0x1f94ee['name'],_0x55a53);})[_0x4755('0x2e')](function(_0x24e25e){_0x4f9204=_0x24e25e;logger[_0x4755('0xd')]('The\x20User\x20ID\x20is:',_0x4f9204['id']);return getEndUser(_0x437273,_0x23e295['destcalleridname'],_0x23e295[_0x4755('0x6e')],_0x55a53);})['then'](function(_0x1265ef){_0xf0c9ba=_0x1265ef;logger[_0x4755('0xd')](_0x4755('0x5f'),_0xf0c9ba['id']);return getTicket(_0x437273,_0x4f9204,_0xf0c9ba,_0x452eb1,_0x23e295,_0x452eb1['Fields'],_0x55a53,_0x4755('0x6f'));})[_0x4755('0x2e')](function(_0x1f31fa){_0x2ccd33=_0x1f31fa;logger['info'](_0x4755('0x62'));logger[_0x4755('0xd')](_0x4755('0x63'),_0x2ccd33['id']);return setRelationship(_0x55a53,_0x4f9204,_0x2ccd33,_0x4755('0x64'));})[_0x4755('0x2e')](function(){return setRelationship(_0x55a53,_0xf0c9ba,_0x2ccd33,_0x4755('0x65'));})['then'](function(){return getServerInfo(_0x55a53);})['then'](function(_0x5ece07){var _0x5aeb66=parseInt(_0x5ece07[_0x4755('0x66')][_0x4755('0x67')](0x0));var _0x189f0b=util[_0x4755('0x23')](_0x4755('0x68'),_0x437273[_0x4755('0x55')],_0x2ccd33['id']);if(_0x5aeb66>0x6){_0x189f0b=util[_0x4755('0x23')](_0x4755('0x69'),_0x437273['remoteUri'],_0x2ccd33['id']);}logger['info'](_0x4755('0x70'),_0x4755('0x6a'));emit(util[_0x4755('0x23')]('user:%s',_0x1f94ee[_0x4755('0xf')]),_0x4755('0x71'),{'uri':_0x189f0b});})[_0x4755('0x6b')](function(_0x1809d5){logger[_0x4755('0x72')](_0x4755('0x70'),JSON[_0x4755('0x29')](_0x1809d5));});};exports['unmanaged']=function(_0x1c194f,_0xa75878,_0x56c800,_0x1519ea,_0x48687e,_0x446743){var _0x47c208,_0x59b9af,_0x32fe41,_0x18cde4;_0x446743[_0x4755('0x55')]=intUtil[_0x4755('0x54')](_0x446743['remoteUri']);_0x446743['serverUrl']=intUtil['stripTrailingSlash'](_0x446743['serverUrl']);def[_0x4755('0x57')]=util['format'](_0x4755('0x58'),_0x446743[_0x4755('0x55')]);if(_0x48687e&&_0x48687e['monitor_format']){logger['info']('['+_0xa75878['lastevent'][_0x4755('0x73')]()+']',_0x4755('0x5a'));_0xa75878['recordingURL']=util[_0x4755('0x23')](_0x4755('0x5c'),_0x446743[_0x4755('0x56')],_0xa75878['uniqueid'],md5(_0xa75878['uniqueid']));}else{_0xa75878[_0x4755('0x5b')]='';}return getConnection(_0x446743)[_0x4755('0x2e')](function(_0x3f44da){_0x18cde4=_0x3f44da;if(!_[_0x4755('0x2a')](_0x1519ea)){return getUser(_0x446743,_0x1519ea['name'],_0x18cde4);}else{return getUser(_0x446743,null,_0x18cde4);}})[_0x4755('0x2e')](function(_0x48f134){_0x47c208=_0x48f134;logger[_0x4755('0xd')](_0x4755('0x74'),_0x47c208['id']);return getEndUser(_0x446743,_0xa75878[_0x4755('0x75')],_0xa75878[_0x4755('0x5e')],_0x18cde4);})[_0x4755('0x2e')](function(_0x3b9553){_0x59b9af=_0x3b9553;logger[_0x4755('0xd')]('The\x20Enduser\x20ID\x20is:',_0x59b9af['id']);return getTicket(_0x446743,_0x47c208,_0x59b9af,_0x56c800,_0xa75878,_0x56c800['Fields'],_0x18cde4,_0x4755('0x61'));})[_0x4755('0x2e')](function(_0x1d9d27){_0x32fe41=_0x1d9d27;logger[_0x4755('0xd')](_0x4755('0x62'));logger[_0x4755('0xd')](_0x4755('0x63'),_0x32fe41['id']);return setRelationship(_0x18cde4,_0x47c208,_0x32fe41,_0x4755('0x64'));})[_0x4755('0x2e')](function(){return setRelationship(_0x18cde4,_0x59b9af,_0x32fe41,_0x4755('0x65'));})[_0x4755('0x2e')](function(){return getServerInfo(_0x18cde4);})[_0x4755('0x6b')](function(_0x2a1beb){logger[_0x4755('0x72')]('['+_0xa75878[_0x4755('0x76')]['toUpperCase']()+']',JSON[_0x4755('0x29')](_0x2a1beb));});}; \ No newline at end of file +var _0xd6c3=['parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','find','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','custom_fields','customVariable','Variable','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','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:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','user:%s','error','unmanaged','lastevent','toUpperCase','contacts','lodash','request-promise','bluebird','md5','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','name','getString','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts'];(function(_0x1d174c,_0xd71a94){var _0x193cbf=function(_0x140302){while(--_0x140302){_0x1d174c['push'](_0x1d174c['shift']());}};_0x193cbf(++_0xd71a94);}(_0xd6c3,0xd0));var _0x3d6c=function(_0x345c3d,_0x2f712a){_0x345c3d=_0x345c3d-0x0;var _0x355ca4=_0xd6c3[_0x345c3d];return _0x355ca4;};'use strict';var _=require(_0x3d6c('0x0'));var rp=require(_0x3d6c('0x1'));var BPromise=require(_0x3d6c('0x2'));var md5=require(_0x3d6c('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x3d6c('0x4'));var logger=require('../../../../config/logger')(_0x3d6c('0x5'));config[_0x3d6c('0x6')]=_[_0x3d6c('0x7')](config[_0x3d6c('0x6')],{'host':_0x3d6c('0x8'),'port':0x18eb});var io=require(_0x3d6c('0x9'))(new Redis(config[_0x3d6c('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x4e2af5,_0x524385,_0x2dd71f){io['to'](_0x4e2af5)[_0x3d6c('0xa')](_0x524385,_0x2dd71f);}function getTicket(_0x1c5156,_0x2cdeb0,_0x389361,_0x3ab014,_0x233e7d,_0x2cac59,_0x4b8a5f,_0x17b5e2){logger[_0x3d6c('0xb')]('Creating\x20new\x20ticket...');var _0x3f7a0d=new Date();var _0x307eb0=[{'name':_0x3d6c('0xc'),'value':intUtil[_0x3d6c('0xd')](_0x3ab014['Subjects'],_0x233e7d,'\x20')},{'name':_0x3d6c('0xe'),'value':_0x2cdeb0['id']},{'name':'created_by','value':_0x2cdeb0['id']},{'name':_0x3d6c('0xf'),'value':intUtil[_0x3d6c('0xd')](_0x3ab014[_0x3d6c('0x10')],_0x233e7d,'\x0a')},{'name':_0x3d6c('0x11'),'value':_0x3f7a0d[_0x3d6c('0x12')]()[_0x3d6c('0x13')](0x0,0x13)[_0x3d6c('0x14')]('T','\x20')},{'name':_0x3d6c('0x15'),'value':'0'},{'name':_0x3d6c('0x16'),'value':'15'},{'name':_0x3d6c('0x17'),'value':_0x389361['id']},{'name':_0x3d6c('0x18'),'value':_0x3d6c('0x19')},{'name':_0x3d6c('0x1a'),'value':_0x389361['name']},{'name':_0x3d6c('0x1b'),'value':_0x17b5e2}];if(_0x2cac59[_0x3d6c('0x1c')]){_['forEach'](_0x2cac59,function(_0x3cbcb0){if(_0x233e7d[_0x3cbcb0[_0x3d6c('0x1d')]]){_0x307eb0[_0x3d6c('0x1e')]({'name':_0x3cbcb0[_0x3d6c('0x1f')],'value':_0x233e7d[_0x3cbcb0[_0x3d6c('0x1d')]]});}});}return request({'form':{'method':_0x3d6c('0x20'),'input_type':_0x3d6c('0x21'),'response_type':'JSON','rest_data':JSON[_0x3d6c('0x22')]({'session':_0x4b8a5f['id'],'module_name':'Calls','name_value_list':_0x307eb0})}});}function getAuth(_0x1bbf84){return util[_0x3d6c('0x23')](_0x3d6c('0x24'),new Buffer(_0x1bbf84['apiKey']+':X')[_0x3d6c('0x25')](_0x3d6c('0x26')));}function getServerInfo(_0x192bfa){return request({'form':{'method':_0x3d6c('0x27'),'input_type':_0x3d6c('0x21'),'response_type':_0x3d6c('0x21'),'rest_data':JSON[_0x3d6c('0x22')]({'session':_0x192bfa['id']})}});}function getUser(_0x7a742e,_0x51a629,_0x32bee7){if(!_[_0x3d6c('0x28')](_0x51a629)){logger['info'](_0x3d6c('0x29'),_0x51a629);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3d6c('0x22')]({'session':_0x32bee7['id'],'module_name':_0x3d6c('0x2a'),'query':util[_0x3d6c('0x23')](_0x3d6c('0x2b'),_0x51a629),'order_by':'','offset':'0','select_fields':['id',_0x3d6c('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3d6c('0x2c')](function(_0x587bcd){if(_0x587bcd['entry_list']['length']){var _0xe881ef=_[_0x3d6c('0x2d')](_0x587bcd[_0x3d6c('0x2e')],function(_0x3dd685){return _0x3dd685[_0x3d6c('0x2f')][_0x3d6c('0x30')][_0x3d6c('0x31')]===_0x51a629;});if(_0xe881ef){logger['info'](_0x3d6c('0x32'));return BPromise[_0x3d6c('0x33')]({'id':_0xe881ef[_0x3d6c('0x2f')]['id']['value'],'name':_0xe881ef[_0x3d6c('0x2f')][_0x3d6c('0xc')][_0x3d6c('0x31')]});}}logger[_0x3d6c('0xb')](_0x3d6c('0x34'));return BPromise[_0x3d6c('0x33')]({'id':_0x32bee7[_0x3d6c('0x2f')][_0x3d6c('0x35')]['value'],'name':_0x32bee7['name_value_list'][_0x3d6c('0x30')][_0x3d6c('0x31')]});});}else{logger[_0x3d6c('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3d6c('0x33')]({'id':_0x32bee7[_0x3d6c('0x2f')][_0x3d6c('0x35')][_0x3d6c('0x31')],'name':_0x32bee7[_0x3d6c('0x2f')][_0x3d6c('0x30')][_0x3d6c('0x31')]});}}function getEndUser(_0x2dd199,_0x733e13,_0x43978b,_0x5f500d){logger['info'](_0x3d6c('0x36'),_0x43978b);return request({'form':{'method':'get_entry_list','input_type':_0x3d6c('0x21'),'response_type':_0x3d6c('0x21'),'rest_data':JSON[_0x3d6c('0x22')]({'session':_0x5f500d['id'],'module_name':_0x3d6c('0x19'),'query':util[_0x3d6c('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x43978b),'order_by':'','offset':'0','select_fields':['id',_0x3d6c('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3d6c('0x2c')](function(_0x5c3063){if(_0x5c3063[_0x3d6c('0x2e')][_0x3d6c('0x1c')]){var _0x16f97d=_[_0x3d6c('0x2d')](_0x5c3063[_0x3d6c('0x2e')],function(_0x2c900e){return _0x2c900e[_0x3d6c('0x2f')]['phone_home']['value']===_0x43978b;});if(_0x16f97d){logger[_0x3d6c('0xb')](_0x3d6c('0x37'));return BPromise['resolve']({'id':_0x16f97d[_0x3d6c('0x2f')]['id'][_0x3d6c('0x31')],'name':_0x16f97d['name_value_list']['name'][_0x3d6c('0x31')],'phone':_0x16f97d[_0x3d6c('0x2f')][_0x3d6c('0x38')][_0x3d6c('0x31')]});}}else{logger[_0x3d6c('0xb')](_0x3d6c('0x39'));return request({'form':{'method':_0x3d6c('0x20'),'input_type':_0x3d6c('0x21'),'response_type':_0x3d6c('0x21'),'rest_data':JSON[_0x3d6c('0x22')]({'session':_0x5f500d['id'],'module_name':_0x3d6c('0x19'),'name_value_list':[{'name':'first_name','value':_0x733e13!==_0x3d6c('0x3a')?_0x733e13:util[_0x3d6c('0x23')](_0x3d6c('0x3b'),_0x43978b)},{'name':_0x3d6c('0x38'),'value':_0x43978b}]})}})[_0x3d6c('0x2c')](function(_0x64297c){logger['info']('Enduser\x20created.');return BPromise[_0x3d6c('0x33')]({'id':_0x64297c['id'],'name':_0x64297c[_0x3d6c('0x2e')]['first_name']['value'],'phone':_0x64297c[_0x3d6c('0x2e')]['phone_home'][_0x3d6c('0x31')]});});}});}function request(_0x15d1c1){logger['debug'](_0x3d6c('0x3c'),JSON[_0x3d6c('0x22')](_0x15d1c1));return rp(_[_0x3d6c('0x3d')](def,_0x15d1c1));}function getTags(_0x6e38f1,_0x6db7eb){var _0x3f4806=[];if(_0x6e38f1&&_0x6e38f1[_0x3d6c('0x1c')]>0x0){_0x3f4806=_[_0x3d6c('0x3e')](_0x6e38f1,_0x6db7eb);}return _0x3f4806;}function getCustomFields(_0x31e29c,_0x367e26){var _0x4b818a=[];var _0x2ac0e3={'custom_fields':[]};if(_0x31e29c[_0x3d6c('0x1c')]>0x0){_[_0x3d6c('0x3f')](_0x31e29c,function(_0x3e4f98){if(_0x3e4f98[_0x3d6c('0x40')]===_0x3d6c('0x41')&&_0x3e4f98[_0x3d6c('0x42')]&&!_0x3e4f98[_0x3d6c('0x43')]){_0x2ac0e3[_0x3e4f98[_0x3d6c('0x42')][_0x3d6c('0x44')]()]=_0x3e4f98['content'][_0x3d6c('0x25')]();}else if(_0x3e4f98[_0x3d6c('0x40')]==='string'&&_0x3e4f98[_0x3d6c('0x1f')]&&_0x3e4f98[_0x3d6c('0x43')]){_0x2ac0e3[_0x3d6c('0x45')][_0x3d6c('0x1e')]({'id':_0x3e4f98['idField'],'value':_0x3e4f98['content'][_0x3d6c('0x25')]()});}else if(_0x3e4f98[_0x3d6c('0x40')]==='variable'&&_0x3e4f98[_0x3d6c('0x1d')]&&_0x3e4f98[_0x3d6c('0x1f')]&&_0x3e4f98[_0x3d6c('0x43')]){_0x367e26[_0x3e4f98['variableName']]&&_0x2ac0e3[_0x3d6c('0x45')][_0x3d6c('0x1e')]({'id':_0x3e4f98[_0x3d6c('0x1f')],'value':_0x367e26[_0x3e4f98[_0x3d6c('0x1d')]]['toString']()});}else if(_0x3e4f98['type']===_0x3d6c('0x46')&&_0x3e4f98[_0x3d6c('0x47')]&&_0x3e4f98[_0x3d6c('0x47')]['name']&&_0x3e4f98['idField']&&_0x3e4f98[_0x3d6c('0x43')]){_0x367e26[_0x3e4f98[_0x3d6c('0x47')][_0x3d6c('0xc')][_0x3d6c('0x44')]()]&&_0x2ac0e3['custom_fields'][_0x3d6c('0x1e')]({'id':_0x3e4f98[_0x3d6c('0x1f')],'value':_0x367e26[_0x3e4f98['Variable'][_0x3d6c('0xc')]['toLowerCase']()][_0x3d6c('0x25')]()});}});}return _0x2ac0e3;}function getConnection(_0x2b1b31){return request({'method':_0x3d6c('0x48'),'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3d6c('0x22')]({'user_auth':{'user_name':_0x2b1b31[_0x3d6c('0x49')],'password':_0x2b1b31[_0x3d6c('0x4a')],'encryption':_0x3d6c('0x4b')},'application':_0x3d6c('0x4c')})}})['then'](function(_0x145509){var _0x25120a=_0x145509;if(_0x25120a['id']){def[_0x3d6c('0x4d')]=_0x25120a['id'];return BPromise[_0x3d6c('0x33')](_0x25120a);}else{throw new Error(util[_0x3d6c('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x2b1b31['id']));}});}function setRelationship(_0x214f84,_0x1fc67d,_0x296ca7,_0x2874b0){return request({'form':{'method':_0x3d6c('0x4e'),'input_type':'JSON','response_type':_0x3d6c('0x21'),'rest_data':JSON['stringify']({'session':_0x214f84['id'],'module_name':'Calls','module_id':_0x296ca7['id'],'link_field_name':_0x2874b0,'related_ids':[_0x1fc67d['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4a1f27,_0x3e58c2,_0x50733a,_0x721d78,_0x4cedbf,_0x4c9193){var _0x5daf67,_0x22589f,_0x1230fb,_0xb7febf;_0x4c9193[_0x3d6c('0x4f')]=intUtil[_0x3d6c('0x50')](_0x4c9193[_0x3d6c('0x4f')]);_0x4c9193[_0x3d6c('0x51')]=intUtil[_0x3d6c('0x50')](_0x4c9193[_0x3d6c('0x51')]);def[_0x3d6c('0x52')]=util['format']('%s/service/v4_1/rest.php',_0x4c9193[_0x3d6c('0x4f')]);if(_0x4cedbf&&_0x4cedbf[_0x3d6c('0x53')]){logger[_0x3d6c('0xb')](_0x3d6c('0x54'),_0x3d6c('0x55'));_0x3e58c2[_0x3d6c('0x56')]=util[_0x3d6c('0x23')](_0x3d6c('0x57'),_0x4c9193[_0x3d6c('0x51')],_0x3e58c2[_0x3d6c('0x58')],md5(_0x3e58c2[_0x3d6c('0x58')]));}else{_0x3e58c2[_0x3d6c('0x56')]='';}return getConnection(_0x4c9193)[_0x3d6c('0x2c')](function(_0x6b58c0){_0xb7febf=_0x6b58c0;return getUser(_0x4c9193,_0x721d78[_0x3d6c('0xc')],_0xb7febf);})[_0x3d6c('0x2c')](function(_0x5e4bc5){_0x5daf67=_0x5e4bc5;logger[_0x3d6c('0xb')](_0x3d6c('0x59'),_0x5daf67['id']);return getEndUser(_0x4c9193,_0x3e58c2[_0x3d6c('0x5a')],_0x3e58c2[_0x3d6c('0x5b')],_0xb7febf);})[_0x3d6c('0x2c')](function(_0x10323f){_0x22589f=_0x10323f;logger['info'](_0x3d6c('0x5c'),_0x22589f['id']);return getTicket(_0x4c9193,_0x5daf67,_0x22589f,_0x50733a,_0x3e58c2,_0x50733a[_0x3d6c('0x5d')],_0xb7febf,_0x3d6c('0x5e'));})[_0x3d6c('0x2c')](function(_0x19cd62){_0x1230fb=_0x19cd62;logger[_0x3d6c('0xb')]('Ticket\x20created!');logger[_0x3d6c('0xb')](_0x3d6c('0x5f'),_0x1230fb['id']);return setRelationship(_0xb7febf,_0x5daf67,_0x1230fb,_0x3d6c('0x60'));})[_0x3d6c('0x2c')](function(){return setRelationship(_0xb7febf,_0x22589f,_0x1230fb,'contacts');})[_0x3d6c('0x2c')](function(){return getServerInfo(_0xb7febf);})[_0x3d6c('0x2c')](function(_0x4ebc62){var _0x1f00a7=parseInt(_0x4ebc62[_0x3d6c('0x61')][_0x3d6c('0x62')](0x0));var _0x9fcfd2=util[_0x3d6c('0x23')](_0x3d6c('0x63'),_0x4c9193['remoteUri'],_0x1230fb['id']);if(_0x1f00a7>0x6){_0x9fcfd2=util[_0x3d6c('0x23')](_0x3d6c('0x64'),_0x4c9193[_0x3d6c('0x4f')],_0x1230fb['id']);}logger[_0x3d6c('0xb')]('[QUEUE]',_0x3d6c('0x65'));emit(util[_0x3d6c('0x23')]('user:%s',_0x721d78[_0x3d6c('0xc')]),_0x3d6c('0x66'),{'uri':_0x9fcfd2});})[_0x3d6c('0x67')](function(_0x463458){logger['error'](_0x3d6c('0x54'),JSON[_0x3d6c('0x22')](_0x463458));});};exports['outbound']=function(_0x1ce10d,_0x310a62,_0x110444,_0x3593da,_0xae78a1,_0x2a9dde,_0x17d54b){var _0x5296d4,_0x490b5d,_0x5e85d0,_0x49e51;_0x2a9dde[_0x3d6c('0x4f')]=intUtil[_0x3d6c('0x50')](_0x2a9dde['remoteUri']);_0x2a9dde[_0x3d6c('0x51')]=intUtil[_0x3d6c('0x50')](_0x2a9dde[_0x3d6c('0x51')]);def[_0x3d6c('0x52')]=util[_0x3d6c('0x23')]('%s/service/v4_1/rest.php',_0x2a9dde[_0x3d6c('0x4f')]);if(_0x17d54b&&_0x17d54b[_0x3d6c('0x68')]&&_0x17d54b[_0x3d6c('0x68')]!==_0x3d6c('0x69')){logger[_0x3d6c('0xb')](_0x3d6c('0x6a'),_0x3d6c('0x55'));_0x310a62[_0x3d6c('0x56')]=util[_0x3d6c('0x23')](_0x3d6c('0x57'),_0x2a9dde[_0x3d6c('0x51')],_0x310a62['uniqueid'],md5(_0x310a62['uniqueid']));}return getConnection(_0x2a9dde)[_0x3d6c('0x2c')](function(_0x46bd4c){_0x49e51=_0x46bd4c;return getUser(_0x2a9dde,_0x3593da[_0x3d6c('0xc')],_0x49e51);})[_0x3d6c('0x2c')](function(_0x2b5e9e){_0x5296d4=_0x2b5e9e;logger[_0x3d6c('0xb')](_0x3d6c('0x59'),_0x5296d4['id']);return getEndUser(_0x2a9dde,_0x310a62[_0x3d6c('0x6b')],_0x310a62[_0x3d6c('0x6c')],_0x49e51);})[_0x3d6c('0x2c')](function(_0x4769f4){_0x490b5d=_0x4769f4;logger['info'](_0x3d6c('0x5c'),_0x490b5d['id']);return getTicket(_0x2a9dde,_0x5296d4,_0x490b5d,_0x110444,_0x310a62,_0x110444[_0x3d6c('0x5d')],_0x49e51,_0x3d6c('0x6d'));})[_0x3d6c('0x2c')](function(_0x5a94e8){_0x5e85d0=_0x5a94e8;logger[_0x3d6c('0xb')](_0x3d6c('0x6e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5e85d0['id']);return setRelationship(_0x49e51,_0x5296d4,_0x5e85d0,_0x3d6c('0x60'));})[_0x3d6c('0x2c')](function(){return setRelationship(_0x49e51,_0x490b5d,_0x5e85d0,'contacts');})[_0x3d6c('0x2c')](function(){return getServerInfo(_0x49e51);})[_0x3d6c('0x2c')](function(_0x41cecc){var _0x5b4fd8=parseInt(_0x41cecc[_0x3d6c('0x61')][_0x3d6c('0x62')](0x0));var _0x505785=util[_0x3d6c('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2a9dde[_0x3d6c('0x4f')],_0x5e85d0['id']);if(_0x5b4fd8>0x6){_0x505785=util['format'](_0x3d6c('0x64'),_0x2a9dde[_0x3d6c('0x4f')],_0x5e85d0['id']);}logger[_0x3d6c('0xb')](_0x3d6c('0x6a'),_0x3d6c('0x65'));emit(util[_0x3d6c('0x23')](_0x3d6c('0x6f'),_0x3593da[_0x3d6c('0xc')]),_0x3d6c('0x66'),{'uri':_0x505785});})['catch'](function(_0x48443f){logger[_0x3d6c('0x70')]('[OUTBOUND]',JSON[_0x3d6c('0x22')](_0x48443f));});};exports[_0x3d6c('0x71')]=function(_0x39ee2d,_0x98db50,_0x42d0ad,_0x34fbd2,_0x1c18e3,_0x54a98d){var _0x26617e,_0x176a46,_0x91c1f3,_0x36d01f;_0x54a98d[_0x3d6c('0x4f')]=intUtil['stripTrailingSlash'](_0x54a98d[_0x3d6c('0x4f')]);_0x54a98d[_0x3d6c('0x51')]=intUtil['stripTrailingSlash'](_0x54a98d['serverUrl']);def[_0x3d6c('0x52')]=util['format']('%s/service/v4_1/rest.php',_0x54a98d[_0x3d6c('0x4f')]);if(_0x1c18e3&&_0x1c18e3[_0x3d6c('0x53')]){logger[_0x3d6c('0xb')]('['+_0x98db50[_0x3d6c('0x72')][_0x3d6c('0x73')]()+']','Recording\x20is\x20enabled!');_0x98db50['recordingURL']=util[_0x3d6c('0x23')](_0x3d6c('0x57'),_0x54a98d['serverUrl'],_0x98db50[_0x3d6c('0x58')],md5(_0x98db50['uniqueid']));}else{_0x98db50[_0x3d6c('0x56')]='';}return getConnection(_0x54a98d)[_0x3d6c('0x2c')](function(_0xbdeec4){_0x36d01f=_0xbdeec4;if(!_[_0x3d6c('0x28')](_0x34fbd2)){return getUser(_0x54a98d,_0x34fbd2[_0x3d6c('0xc')],_0x36d01f);}else{return getUser(_0x54a98d,null,_0x36d01f);}})[_0x3d6c('0x2c')](function(_0x4d5a3c){_0x26617e=_0x4d5a3c;logger[_0x3d6c('0xb')](_0x3d6c('0x59'),_0x26617e['id']);return getEndUser(_0x54a98d,_0x98db50[_0x3d6c('0x5a')],_0x98db50[_0x3d6c('0x5b')],_0x36d01f);})[_0x3d6c('0x2c')](function(_0x344c9f){_0x176a46=_0x344c9f;logger[_0x3d6c('0xb')](_0x3d6c('0x5c'),_0x176a46['id']);return getTicket(_0x54a98d,_0x26617e,_0x176a46,_0x42d0ad,_0x98db50,_0x42d0ad[_0x3d6c('0x5d')],_0x36d01f,'Inbound');})[_0x3d6c('0x2c')](function(_0x18abac){_0x91c1f3=_0x18abac;logger[_0x3d6c('0xb')]('Ticket\x20created!');logger[_0x3d6c('0xb')](_0x3d6c('0x5f'),_0x91c1f3['id']);return setRelationship(_0x36d01f,_0x26617e,_0x91c1f3,'users');})[_0x3d6c('0x2c')](function(){return setRelationship(_0x36d01f,_0x176a46,_0x91c1f3,_0x3d6c('0x74'));})[_0x3d6c('0x2c')](function(){return getServerInfo(_0x36d01f);})[_0x3d6c('0x67')](function(_0x1127a2){logger[_0x3d6c('0x70')]('['+_0x98db50['lastevent'][_0x3d6c('0x73')]()+']',JSON[_0x3d6c('0x22')](_0x1127a2));});}; \ 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 665ae7f..304a4bb 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 _0xabe9=['toString','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','variable','%s:\x20%s','customVariable','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','util','getString','length','sortBy','type','string','push','content','variableName'];(function(_0x57dff9,_0x37bd67){var _0x346ae6=function(_0x14197b){while(--_0x14197b){_0x57dff9['push'](_0x57dff9['shift']());}};_0x346ae6(++_0x37bd67);}(_0xabe9,0x1a6));var _0x9abe=function(_0x6656b1,_0x3421ee){_0x6656b1=_0x6656b1-0x0;var _0x45ae3a=_0xabe9[_0x6656b1];return _0x45ae3a;};'use strict';var _=require(_0x9abe('0x0'));var util=require(_0x9abe('0x1'));exports[_0x9abe('0x2')]=function(_0x14bc9e,_0x43ade6,_0xb5b522){var _0x4bb377=[];if(_0x14bc9e[_0x9abe('0x3')]>0x0){var _0x117bf5=_[_0x9abe('0x4')](_0x14bc9e,['id']);for(var _0x4a7d86=0x0;_0x4a7d86<_0x117bf5[_0x9abe('0x3')];_0x4a7d86++){var _0x2219cf=_0x117bf5[_0x4a7d86];if(_0x2219cf[_0x9abe('0x5')]===_0x9abe('0x6')){_0x4bb377[_0x9abe('0x7')](_0x2219cf[_0x9abe('0x8')]);}else if(_0x2219cf[_0x9abe('0x5')]==='variable'&&_0x2219cf[_0x9abe('0x9')]){_0x43ade6[_0x2219cf[_0x9abe('0x9')]]&&_0x4bb377[_0x9abe('0x7')](_0x43ade6[_0x2219cf[_0x9abe('0x9')]][_0x9abe('0xa')]());}else if(_0x2219cf[_0x9abe('0x5')]==='customVariable'&&_0x2219cf[_0x9abe('0xb')]&&_0x2219cf[_0x9abe('0xb')][_0x9abe('0xc')]){_0x43ade6[_0x2219cf[_0x9abe('0xb')][_0x9abe('0xc')]['toLowerCase']()]&&_0x4bb377['push'](_0x43ade6[_0x2219cf[_0x9abe('0xb')]['name'][_0x9abe('0xd')]()]['toString']());}else if(_0x2219cf[_0x9abe('0x5')]===_0x9abe('0xe')){if(_0x2219cf[_0x9abe('0xf')]===_0x9abe('0x6')&&_0x2219cf[_0x9abe('0x10')]){_0x4bb377['push'](util[_0x9abe('0x11')]('%s:\x20%s',_0x2219cf[_0x9abe('0x10')],_0x2219cf[_0x9abe('0x12')]));}else if(_0x2219cf[_0x9abe('0xf')]===_0x9abe('0x13')&&_0x2219cf[_0x9abe('0x9')]&&_0x2219cf[_0x9abe('0x10')]){_0x43ade6[_0x2219cf[_0x9abe('0x9')]]&&_0x4bb377[_0x9abe('0x7')](util[_0x9abe('0x11')](_0x9abe('0x14'),_0x2219cf[_0x9abe('0x10')],_0x43ade6[_0x2219cf['variableName']]));}else if(_0x2219cf[_0x9abe('0xf')]===_0x9abe('0x15')&&_0x2219cf['Variable']&&_0x2219cf['Variable'][_0x9abe('0xc')]&&_0x2219cf['key']){_0x43ade6[_0x2219cf[_0x9abe('0xb')]['name'][_0x9abe('0xd')]()]&&_0x4bb377['push'](util['format']('%s:\x20%s',_0x2219cf['key'],_0x43ade6[_0x2219cf[_0x9abe('0xb')]['name'][_0x9abe('0xd')]()]));}}}}return _0x4bb377['join'](_0xb5b522);};exports[_0x9abe('0x16')]=function(_0x437cf1){var _0x47ec94=_0x437cf1[_0x9abe('0x17')](-0x1);if(_0x47ec94==='/'){_0x437cf1=_0x437cf1[_0x9abe('0x18')](0x0,_0x437cf1[_0x9abe('0x19')](_0x47ec94));}return _0x437cf1;};exports[_0x9abe('0x1a')]=function(_0x2efbca){if(!_['isNil'](_0x2efbca)&&_0x2efbca!==''){var _0x4b9dc5=/^(([^<>()\[\]\\.,;:\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 _0x4b9dc5['test'](String(_0x2efbca)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x4447=['slice','lastIndexOf','validateEmail','isNil','test','lodash','getString','sortBy','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4447,0xdd));var _0x7444=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x4447[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x7444('0x0'));var util=require('util');exports[_0x7444('0x1')]=function(_0x1f338d,_0x84120e,_0x48fcea){var _0x232b2b=[];if(_0x1f338d['length']>0x0){var _0x46d6b2=_[_0x7444('0x2')](_0x1f338d,['id']);for(var _0x4a8325=0x0;_0x4a8325<_0x46d6b2[_0x7444('0x3')];_0x4a8325++){var _0x2bb727=_0x46d6b2[_0x4a8325];if(_0x2bb727[_0x7444('0x4')]===_0x7444('0x5')){_0x232b2b[_0x7444('0x6')](_0x2bb727[_0x7444('0x7')]);}else if(_0x2bb727[_0x7444('0x4')]===_0x7444('0x8')&&_0x2bb727[_0x7444('0x9')]){_0x84120e[_0x2bb727['variableName']]&&_0x232b2b['push'](_0x84120e[_0x2bb727['variableName']][_0x7444('0xa')]());}else if(_0x2bb727[_0x7444('0x4')]===_0x7444('0xb')&&_0x2bb727[_0x7444('0xc')]&&_0x2bb727[_0x7444('0xc')]['name']){_0x84120e[_0x2bb727[_0x7444('0xc')][_0x7444('0xd')][_0x7444('0xe')]()]&&_0x232b2b[_0x7444('0x6')](_0x84120e[_0x2bb727['Variable']['name'][_0x7444('0xe')]()][_0x7444('0xa')]());}else if(_0x2bb727[_0x7444('0x4')]==='keyValue'){if(_0x2bb727[_0x7444('0xf')]===_0x7444('0x5')&&_0x2bb727[_0x7444('0x10')]){_0x232b2b[_0x7444('0x6')](util[_0x7444('0x11')]('%s:\x20%s',_0x2bb727[_0x7444('0x10')],_0x2bb727[_0x7444('0x12')]));}else if(_0x2bb727[_0x7444('0xf')]===_0x7444('0x8')&&_0x2bb727['variableName']&&_0x2bb727[_0x7444('0x10')]){_0x84120e[_0x2bb727[_0x7444('0x9')]]&&_0x232b2b[_0x7444('0x6')](util[_0x7444('0x11')](_0x7444('0x13'),_0x2bb727[_0x7444('0x10')],_0x84120e[_0x2bb727[_0x7444('0x9')]]));}else if(_0x2bb727['keyType']===_0x7444('0xb')&&_0x2bb727[_0x7444('0xc')]&&_0x2bb727['Variable'][_0x7444('0xd')]&&_0x2bb727[_0x7444('0x10')]){_0x84120e[_0x2bb727[_0x7444('0xc')]['name']['toLowerCase']()]&&_0x232b2b['push'](util[_0x7444('0x11')]('%s:\x20%s',_0x2bb727['key'],_0x84120e[_0x2bb727['Variable']['name']['toLowerCase']()]));}}}}return _0x232b2b[_0x7444('0x14')](_0x48fcea);};exports[_0x7444('0x15')]=function(_0x3c48ad){var _0x49f8fe=_0x3c48ad[_0x7444('0x16')](-0x1);if(_0x49f8fe==='/'){_0x3c48ad=_0x3c48ad['substring'](0x0,_0x3c48ad[_0x7444('0x17')](_0x49f8fe));}return _0x3c48ad;};exports[_0x7444('0x18')]=function(_0x55a6d0){if(!_[_0x7444('0x19')](_0x55a6d0)&&_0x55a6d0!==''){var _0x711365=/^(([^<>()\[\]\\.,;:\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 _0x711365[_0x7444('0x1a')](String(_0x55a6d0)[_0x7444('0xe')]());}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 a45a9fd..62c08ba 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x382cd3,_0x4936fa){var _0x2e5db4=function(_0xaa1c80){while(--_0xaa1c80){_0x382cd3['push'](_0x382cd3['shift']());}};_0x2e5db4(++_0x4936fa);}(_0x9c44,0x178));var _0x49c4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x9c44[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x4bba54,_0x479112){var _0x4ca811=function(_0x1bd243){while(--_0x1bd243){_0x4bba54['push'](_0x4bba54['shift']());}};_0x4ca811(++_0x479112);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index c753192..f182481 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 _0xaffc=['calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','getString','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','custom_fields','push','variable','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:'];(function(_0x26146c,_0x59aa9f){var _0x16950c=function(_0x37638e){while(--_0x37638e){_0x26146c['push'](_0x26146c['shift']());}};_0x16950c(++_0x59aa9f);}(_0xaffc,0xf7));var _0xcaff=function(_0x4c844c,_0x3dd181){_0x4c844c=_0x4c844c-0x0;var _0x4bc014=_0xaffc[_0x4c844c];return _0x4bc014;};'use strict';var _=require(_0xcaff('0x0'));var rp=require(_0xcaff('0x1'));var md5=require('md5');var util=require(_0xcaff('0x2'));var Redis=require(_0xcaff('0x3'));var intUtil=require(_0xcaff('0x4'));var config=require('../../../../config/environment');var logger=require(_0xcaff('0x5'))(_0xcaff('0x6'));config[_0xcaff('0x7')]=_[_0xcaff('0x8')](config['redis'],{'host':_0xcaff('0x9'),'port':0x18eb});var io=require(_0xcaff('0xa'))(new Redis(config[_0xcaff('0x7')]));function emit(_0x31c61b,_0x4fa5c2,_0x33a6c1){io['to'](_0x31c61b)[_0xcaff('0xb')](_0x4fa5c2,_0x33a6c1);}var headers={'Content-Type':_0xcaff('0xc'),'Accept':_0xcaff('0xc')};function getTicket(_0xf54ac6,_0x541ed7,_0x2e48be,_0x29da02,_0x35c4f5){logger[_0xcaff('0xd')](_0xcaff('0xe'));return request({'uri':util[_0xcaff('0xf')](_0xcaff('0x10'),_0xf54ac6[_0xcaff('0x11')]),'method':_0xcaff('0x12'),'body':{'ticket':_[_0xcaff('0x13')]({'requester_id':_0x2e48be['id'],'submitter_id':_0x541ed7?_0x541ed7['id']:undefined,'assignee_id':_0x541ed7?_0x541ed7['id']:undefined,'tags':getTags(_0x29da02[_0xcaff('0x14')],'name'),'subject':intUtil['getString'](_0x29da02[_0xcaff('0x15')],_0x35c4f5,'\x20'),'description':intUtil[_0xcaff('0x16')](_0x29da02['Descriptions'],_0x35c4f5,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcaff('0x16')](_0x29da02['Descriptions'],_0x35c4f5,'\x0a')}},getCustomFields(_0x29da02[_0xcaff('0x17')],_0x35c4f5))}})['then'](function(_0x2bb6e6){logger[_0xcaff('0xd')](_0xcaff('0x18'));return _0x2bb6e6[_0xcaff('0x19')];});}function getUser(_0x288f2c,_0x3f7f2b){if(intUtil['validateEmail'](_0x3f7f2b)){logger['info'](_0xcaff('0x1a'),_0x3f7f2b);return request({'uri':util['format']('%s/search.json',_0x288f2c[_0xcaff('0x11')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x3f7f2b)}})[_0xcaff('0x1b')](function(_0x5819ed){if(_0x5819ed[_0xcaff('0x1c')]){logger[_0xcaff('0xd')](_0xcaff('0x1d'));return _[_0xcaff('0x1e')](_0x5819ed[_0xcaff('0x1f')],{'email':_0x3f7f2b,'role':_0xcaff('0x20')});}else{logger[_0xcaff('0xd')](_0xcaff('0x21'));return request({'uri':util[_0xcaff('0xf')](_0xcaff('0x22'),_0x288f2c[_0xcaff('0x11')])})[_0xcaff('0x1b')](function(_0x3d9dca){logger[_0xcaff('0xd')](_0xcaff('0x23'));return _0x3d9dca[_0xcaff('0x24')];});}});}else{logger['info'](_0xcaff('0x21'));return request({'uri':util[_0xcaff('0xf')]('%s/users/me.json',_0x288f2c[_0xcaff('0x11')])})['then'](function(_0x96c206){logger['info'](_0xcaff('0x23'));return _0x96c206[_0xcaff('0x24')];});}}function getEndUser(_0x1c08eb,_0x5b4da5,_0x5332b0){logger[_0xcaff('0xd')](_0xcaff('0x25'),_0x5332b0);return request({'uri':util[_0xcaff('0xf')]('%s/search.json',_0x1c08eb['remoteUri']),'qs':{'query':util[_0xcaff('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x5332b0)}})[_0xcaff('0x1b')](function(_0x5d4577){var _0x30d70d;if(_0x5d4577[_0xcaff('0x1f')]['length']){_0x5d4577[_0xcaff('0x1f')]=_['filter'](_0x5d4577[_0xcaff('0x1f')],{'suspended':![],'role':_0xcaff('0x26')});if(_0x5d4577[_0xcaff('0x1f')][_0xcaff('0x27')]){_0x30d70d=_[_0xcaff('0x28')](_0x5d4577['results']);}}if(_0x30d70d){logger['info']('Enduser\x20found!');return _0x30d70d;}else{logger[_0xcaff('0xd')](_0xcaff('0x29'));return request({'uri':util[_0xcaff('0xf')](_0xcaff('0x2a'),_0x1c08eb[_0xcaff('0x11')]),'method':_0xcaff('0x12'),'body':{'user':{'role':'end-user','name':util[_0xcaff('0xf')](_0xcaff('0x2b'),_0x5b4da5||_0x5332b0),'phone':_0x5332b0}}})[_0xcaff('0x1b')](function(_0x16ff87){logger['info']('Enduser\x20created.');return _0x16ff87['user'];});}});}function getAuth(_0x112d54){var _0x5414db;if(_0x112d54[_0xcaff('0x2c')]===_0xcaff('0x2d')){_0x5414db=util['format'](_0xcaff('0x2e'),_0x112d54[_0xcaff('0x2f')],_0x112d54[_0xcaff('0x2d')]);}else if(_0x112d54[_0xcaff('0x2c')]===_0xcaff('0x30')){_0x5414db=util[_0xcaff('0xf')]('%s/token:%s',_0x112d54[_0xcaff('0x2f')],_0x112d54[_0xcaff('0x30')]);}return util[_0xcaff('0xf')](_0xcaff('0x31'),new Buffer(_0x5414db)[_0xcaff('0x32')]('base64'));}function request(_0x4c5163){logger[_0xcaff('0x33')](_0xcaff('0x34'),JSON[_0xcaff('0x35')](_0x4c5163));return rp(_[_0xcaff('0x8')](_0x4c5163,{'method':_0xcaff('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4fbb2b,_0x4a5e5d){var _0x6d0407=[];if(_0x4fbb2b&&_0x4fbb2b[_0xcaff('0x27')]>0x0){_0x6d0407=_[_0xcaff('0x37')](_0x4fbb2b,_0x4a5e5d);}return _0x6d0407;}function getCustomFields(_0x5bc2ae,_0x2770bc){var _0x4a21db=[];var _0x5b0e0c={'custom_fields':[]};if(_0x5bc2ae[_0xcaff('0x27')]>0x0){_[_0xcaff('0x38')](_0x5bc2ae,function(_0x570974){if(_[_0xcaff('0x39')]([_0xcaff('0x3a'),_0xcaff('0x3b')],_0x570974[_0xcaff('0x3c')])&&_0x570974['nameField']&&!_0x570974['customField']){_0x5b0e0c[_0x570974[_0xcaff('0x3d')][_0xcaff('0x3e')]()]=_0x570974[_0xcaff('0x3f')]['toString']();}else if(_[_0xcaff('0x39')]([_0xcaff('0x3a'),_0xcaff('0x3b')],_0x570974[_0xcaff('0x3c')])&&_0x570974[_0xcaff('0x40')]&&_0x570974[_0xcaff('0x41')]){_0x5b0e0c[_0xcaff('0x42')][_0xcaff('0x43')]({'id':_0x570974[_0xcaff('0x40')],'value':_0x570974['content'][_0xcaff('0x32')]()});}else if(_0x570974[_0xcaff('0x3c')]===_0xcaff('0x44')&&_0x570974['variableName']&&_0x570974[_0xcaff('0x40')]&&_0x570974['customField']){_0x2770bc[_0x570974[_0xcaff('0x45')]]&&_0x5b0e0c[_0xcaff('0x42')][_0xcaff('0x43')]({'id':_0x570974[_0xcaff('0x40')],'value':_0x2770bc[_0x570974[_0xcaff('0x45')]][_0xcaff('0x32')]()});}else if(_0x570974[_0xcaff('0x3c')]==='customVariable'&&_0x570974[_0xcaff('0x46')]&&_0x570974['Variable'][_0xcaff('0x47')]&&_0x570974[_0xcaff('0x40')]&&_0x570974[_0xcaff('0x41')]){_0x2770bc[_0x570974['Variable'][_0xcaff('0x47')]['toLowerCase']()]&&_0x5b0e0c[_0xcaff('0x42')]['push']({'id':_0x570974[_0xcaff('0x40')],'value':_0x2770bc[_0x570974['Variable'][_0xcaff('0x47')][_0xcaff('0x3e')]()][_0xcaff('0x32')]()});}});}return _0x5b0e0c;}exports[_0xcaff('0x48')]=function(_0x17f7cf,_0xb56e72,_0x583610,_0x67ac0f,_0x445c13,_0xddd151){var _0x3fd499,_0x19ffce;_0xddd151[_0xcaff('0x11')]=intUtil[_0xcaff('0x49')](_0xddd151[_0xcaff('0x11')]);_0xddd151[_0xcaff('0x4a')]=intUtil[_0xcaff('0x49')](_0xddd151[_0xcaff('0x4a')]);if(_0x445c13&&_0x445c13[_0xcaff('0x4b')]){logger[_0xcaff('0xd')](_0xcaff('0x4c'),_0xcaff('0x4d'));_0xb56e72[_0xcaff('0x4e')]=util[_0xcaff('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xddd151[_0xcaff('0x4a')],_0xb56e72['uniqueid'],md5(_0xb56e72[_0xcaff('0x4f')]));}else{_0xb56e72[_0xcaff('0x4e')]='';}headers[_0xcaff('0x50')]=getAuth(_0xddd151);return getUser(_0xddd151,_0x67ac0f[_0xcaff('0x51')])[_0xcaff('0x1b')](function(_0x476887){_0x3fd499=_0x476887;logger[_0xcaff('0xd')](_0xcaff('0x52'),_0x3fd499['id']);return getEndUser(_0xddd151,_0xb56e72['calleridname'],_0xb56e72[_0xcaff('0x53')]);})['then'](function(_0x422a83){_0x19ffce=_0x422a83;logger[_0xcaff('0xd')](_0xcaff('0x54'),_0x19ffce['id']);return getTicket(_0xddd151,_0x3fd499,_0x19ffce,_0x583610,_0xb56e72);})['then'](function(_0x9475af){if(_0x9475af){logger[_0xcaff('0xd')]('The\x20Ticket\x20ID\x20is:',_0x9475af['id']);switch(_0xddd151[_0xcaff('0x3c')]){case _0xcaff('0x55'):logger[_0xcaff('0xd')]('[QUEUE]',_0xcaff('0x56'));return request({'uri':util['format'](_0xcaff('0x57'),_0xddd151['remoteUri'],_0x3fd499['id'],_0x9475af['id']),'method':_0xcaff('0x12')});case _0xcaff('0x58'):logger['info'](_0xcaff('0x4c'),_0xcaff('0x59'));emit(util[_0xcaff('0xf')](_0xcaff('0x5a'),_0x67ac0f[_0xcaff('0x47')]),_0xcaff('0x5b'),{'uri':util['format']('%s/agent/tickets/%s',_0xddd151[_0xcaff('0x11')][_0xcaff('0x5c')]('/api/v2',''),_0x9475af['id'])});break;default:logger[_0xcaff('0x5d')](_0xcaff('0x4c'),_0xcaff('0x5e'));}}})['catch'](function(_0xe3c93c){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xe3c93c,{'showHidden':!![],'depth':null}));});};exports[_0xcaff('0x5f')]=function(_0x7fcbc3,_0x20c792,_0xcec5a5,_0x596388,_0x3b8527,_0x2d1d30,_0x49ab26){var _0x4c2574,_0x3ebb4a;_0x2d1d30['remoteUri']=intUtil['stripTrailingSlash'](_0x2d1d30[_0xcaff('0x11')]);_0x2d1d30[_0xcaff('0x4a')]=intUtil[_0xcaff('0x49')](_0x2d1d30[_0xcaff('0x4a')]);if(_0x49ab26&&_0x49ab26[_0xcaff('0x60')]&&_0x49ab26[_0xcaff('0x60')]!=='none'){logger[_0xcaff('0xd')]('[OUTBOUND]',_0xcaff('0x4d'));_0x20c792[_0xcaff('0x4e')]=util[_0xcaff('0xf')](_0xcaff('0x61'),_0x2d1d30[_0xcaff('0x4a')],_0x20c792[_0xcaff('0x4f')],md5(_0x20c792[_0xcaff('0x4f')]));}headers[_0xcaff('0x50')]=getAuth(_0x2d1d30);return getUser(_0x2d1d30,_0x596388[_0xcaff('0x51')])[_0xcaff('0x1b')](function(_0x118939){_0x4c2574=_0x118939;logger[_0xcaff('0xd')](_0xcaff('0x52'),_0x4c2574['id']);return getEndUser(_0x2d1d30,_0x20c792[_0xcaff('0x62')],_0x20c792[_0xcaff('0x63')]);})[_0xcaff('0x1b')](function(_0x3621d0){_0x3ebb4a=_0x3621d0;logger[_0xcaff('0xd')](_0xcaff('0x54'),_0x3ebb4a['id']);return getTicket(_0x2d1d30,_0x4c2574,_0x3ebb4a,_0xcec5a5,_0x20c792);})[_0xcaff('0x1b')](function(_0x5caa47){if(_0x5caa47){logger[_0xcaff('0xd')](_0xcaff('0x64'),_0x5caa47['id']);switch(_0x2d1d30[_0xcaff('0x3c')]){case _0xcaff('0x55'):logger[_0xcaff('0xd')](_0xcaff('0x65'),_0xcaff('0x56'));return request({'uri':util[_0xcaff('0xf')](_0xcaff('0x57'),_0x2d1d30['remoteUri'],_0x4c2574['id'],_0x5caa47['id']),'method':_0xcaff('0x12')});case _0xcaff('0x58'):logger['info'](_0xcaff('0x65'),_0xcaff('0x59'));emit(util[_0xcaff('0xf')]('user:%s',_0x596388[_0xcaff('0x47')]),_0xcaff('0x5b'),{'uri':util[_0xcaff('0xf')]('%s/agent/tickets/%s',_0x2d1d30[_0xcaff('0x11')][_0xcaff('0x5c')]('/api/v2',''),_0x5caa47['id'])});break;default:logger['error'](_0xcaff('0x65'),_0xcaff('0x5e'));}}})[_0xcaff('0x66')](function(_0x299fc2){logger[_0xcaff('0x5d')](_0xcaff('0x67'),util[_0xcaff('0x68')](_0x299fc2,{'showHidden':!![],'depth':null}));});};exports[_0xcaff('0x69')]=function(_0xfb97e6,_0x3a34b9,_0x55059d,_0x313b72,_0x55e18f,_0x355082){var _0x16c706,_0x196e13;_0x355082[_0xcaff('0x11')]=intUtil['stripTrailingSlash'](_0x355082[_0xcaff('0x11')]);_0x355082[_0xcaff('0x4a')]=intUtil[_0xcaff('0x49')](_0x355082[_0xcaff('0x4a')]);if(_0x55e18f&&_0x55e18f[_0xcaff('0x4b')]){logger[_0xcaff('0xd')]('['+_0x3a34b9[_0xcaff('0x6a')][_0xcaff('0x6b')]()+']',_0xcaff('0x4d'));_0x3a34b9[_0xcaff('0x4e')]=util[_0xcaff('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x355082[_0xcaff('0x4a')],_0x3a34b9[_0xcaff('0x4f')],md5(_0x3a34b9[_0xcaff('0x4f')]));}else{_0x3a34b9['recordingURL']='';}headers[_0xcaff('0x50')]=getAuth(_0x355082);return getUser(_0x355082)[_0xcaff('0x1b')](function(_0x1b9b1e){_0x16c706=_0x1b9b1e;logger[_0xcaff('0xd')](_0xcaff('0x52'),_0x16c706['id']);return getEndUser(_0x355082,_0x3a34b9[_0xcaff('0x6c')],_0x3a34b9[_0xcaff('0x53')]);})[_0xcaff('0x1b')](function(_0x3a9f23){_0x196e13=_0x3a9f23;logger[_0xcaff('0xd')](_0xcaff('0x54'),_0x196e13['id']);return getTicket(_0x355082,_0x16c706,_0x196e13,_0x55059d,_0x3a34b9);})[_0xcaff('0x1b')](function(_0x1fb268){if(_0x1fb268){logger[_0xcaff('0xd')]('The\x20Ticket\x20ID\x20is:',_0x1fb268['id']);}})[_0xcaff('0x66')](function(_0x3e608a){logger[_0xcaff('0x5d')]('['+_0x3a34b9[_0xcaff('0x6a')]['toUpperCase']()+']'+_0xcaff('0x6d'),util['inspect'](_0x3e608a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xaf81=['The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Ticket\x20ID\x20is:','newTab','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','zendesk','redis','defaults','localhost','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','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','debug','stringify','GET','map','forEach','string','nameField','customField','content','toString','picklist','type','idField','push','variable','variableName','custom_fields','customVariable','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum'];(function(_0x55e7f6,_0x2f96be){var _0x5cd9f6=function(_0x241327){while(--_0x241327){_0x55e7f6['push'](_0x55e7f6['shift']());}};_0x5cd9f6(++_0x2f96be);}(_0xaf81,0x88));var _0x1af8=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xaf81[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x1af8('0x0'));var util=require(_0x1af8('0x1'));var Redis=require(_0x1af8('0x2'));var intUtil=require(_0x1af8('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x1af8('0x4'));config[_0x1af8('0x5')]=_[_0x1af8('0x6')](config[_0x1af8('0x5')],{'host':_0x1af8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3aec9f,_0x2012db,_0x4dd0a2){io['to'](_0x3aec9f)[_0x1af8('0x8')](_0x2012db,_0x4dd0a2);}var headers={'Content-Type':_0x1af8('0x9'),'Accept':_0x1af8('0x9')};function getTicket(_0x343ea1,_0x1d91de,_0x46ea15,_0x39bd81,_0x418dc8){logger['info'](_0x1af8('0xa'));return request({'uri':util[_0x1af8('0xb')]('%s/tickets.json',_0x343ea1[_0x1af8('0xc')]),'method':_0x1af8('0xd'),'body':{'ticket':_[_0x1af8('0xe')]({'requester_id':_0x46ea15['id'],'submitter_id':_0x1d91de?_0x1d91de['id']:undefined,'assignee_id':_0x1d91de?_0x1d91de['id']:undefined,'tags':getTags(_0x39bd81[_0x1af8('0xf')],'name'),'subject':intUtil['getString'](_0x39bd81['Subjects'],_0x418dc8,'\x20'),'description':intUtil[_0x1af8('0x10')](_0x39bd81[_0x1af8('0x11')],_0x418dc8,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1af8('0x10')](_0x39bd81['Descriptions'],_0x418dc8,'\x0a')}},getCustomFields(_0x39bd81[_0x1af8('0x12')],_0x418dc8))}})[_0x1af8('0x13')](function(_0x5a2cab){logger[_0x1af8('0x14')](_0x1af8('0x15'));return _0x5a2cab[_0x1af8('0x16')];});}function getUser(_0x494316,_0x575910){if(intUtil[_0x1af8('0x17')](_0x575910)){logger[_0x1af8('0x14')](_0x1af8('0x18'),_0x575910);return request({'uri':util['format'](_0x1af8('0x19'),_0x494316[_0x1af8('0xc')]),'qs':{'query':util[_0x1af8('0xb')]('type:user\x20role:agent\x20email:%s',_0x575910)}})[_0x1af8('0x13')](function(_0x3fcab){if(_0x3fcab[_0x1af8('0x1a')]){logger[_0x1af8('0x14')](_0x1af8('0x1b'));return _[_0x1af8('0x1c')](_0x3fcab[_0x1af8('0x1d')],{'email':_0x575910,'role':_0x1af8('0x1e')});}else{logger[_0x1af8('0x14')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1af8('0xb')]('%s/users/me.json',_0x494316[_0x1af8('0xc')])})['then'](function(_0x67ad0f){logger['info'](_0x1af8('0x1f'));return _0x67ad0f[_0x1af8('0x20')];});}});}else{logger[_0x1af8('0x14')](_0x1af8('0x21'));return request({'uri':util[_0x1af8('0xb')](_0x1af8('0x22'),_0x494316[_0x1af8('0xc')])})['then'](function(_0x4eb1a8){logger[_0x1af8('0x14')]('Admin\x20account\x20selected.');return _0x4eb1a8['user'];});}}function getEndUser(_0x31c24e,_0x33c019,_0x176f67){logger[_0x1af8('0x14')](_0x1af8('0x23'),_0x176f67);return request({'uri':util['format'](_0x1af8('0x19'),_0x31c24e['remoteUri']),'qs':{'query':util[_0x1af8('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x176f67)}})[_0x1af8('0x13')](function(_0x9068ed){var _0x4f6ea3;if(_0x9068ed[_0x1af8('0x1d')][_0x1af8('0x24')]){_0x9068ed[_0x1af8('0x1d')]=_[_0x1af8('0x25')](_0x9068ed['results'],{'suspended':![],'role':'end-user'});if(_0x9068ed[_0x1af8('0x1d')][_0x1af8('0x24')]){_0x4f6ea3=_[_0x1af8('0x26')](_0x9068ed['results']);}}if(_0x4f6ea3){logger[_0x1af8('0x14')](_0x1af8('0x27'));return _0x4f6ea3;}else{logger[_0x1af8('0x14')](_0x1af8('0x28'));return request({'uri':util[_0x1af8('0xb')](_0x1af8('0x29'),_0x31c24e[_0x1af8('0xc')]),'method':_0x1af8('0xd'),'body':{'user':{'role':_0x1af8('0x2a'),'name':util['format'](_0x1af8('0x2b'),_0x33c019||_0x176f67),'phone':_0x176f67}}})[_0x1af8('0x13')](function(_0x57593d){logger[_0x1af8('0x14')](_0x1af8('0x2c'));return _0x57593d[_0x1af8('0x20')];});}});}function getAuth(_0x179e4c){var _0x3d9859;if(_0x179e4c['authType']===_0x1af8('0x2d')){_0x3d9859=util[_0x1af8('0xb')](_0x1af8('0x2e'),_0x179e4c[_0x1af8('0x2f')],_0x179e4c[_0x1af8('0x2d')]);}else if(_0x179e4c[_0x1af8('0x30')]===_0x1af8('0x31')){_0x3d9859=util[_0x1af8('0xb')](_0x1af8('0x32'),_0x179e4c[_0x1af8('0x2f')],_0x179e4c[_0x1af8('0x31')]);}return util[_0x1af8('0xb')](_0x1af8('0x33'),new Buffer(_0x3d9859)['toString']('base64'));}function request(_0x37333c){logger[_0x1af8('0x34')]('[HTTP]',JSON[_0x1af8('0x35')](_0x37333c));return rp(_[_0x1af8('0x6')](_0x37333c,{'method':_0x1af8('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x16f8e5,_0x34125f){var _0xa278e7=[];if(_0x16f8e5&&_0x16f8e5[_0x1af8('0x24')]>0x0){_0xa278e7=_[_0x1af8('0x37')](_0x16f8e5,_0x34125f);}return _0xa278e7;}function getCustomFields(_0xbfd3cb,_0x3f5d52){var _0x5facee=[];var _0x4cf71a={'custom_fields':[]};if(_0xbfd3cb['length']>0x0){_[_0x1af8('0x38')](_0xbfd3cb,function(_0x30e2c2){if(_['includes']([_0x1af8('0x39'),'picklist'],_0x30e2c2['type'])&&_0x30e2c2[_0x1af8('0x3a')]&&!_0x30e2c2[_0x1af8('0x3b')]){_0x4cf71a[_0x30e2c2[_0x1af8('0x3a')]['toLowerCase']()]=_0x30e2c2[_0x1af8('0x3c')][_0x1af8('0x3d')]();}else if(_['includes']([_0x1af8('0x39'),_0x1af8('0x3e')],_0x30e2c2[_0x1af8('0x3f')])&&_0x30e2c2[_0x1af8('0x40')]&&_0x30e2c2[_0x1af8('0x3b')]){_0x4cf71a['custom_fields'][_0x1af8('0x41')]({'id':_0x30e2c2[_0x1af8('0x40')],'value':_0x30e2c2[_0x1af8('0x3c')][_0x1af8('0x3d')]()});}else if(_0x30e2c2[_0x1af8('0x3f')]===_0x1af8('0x42')&&_0x30e2c2[_0x1af8('0x43')]&&_0x30e2c2[_0x1af8('0x40')]&&_0x30e2c2['customField']){_0x3f5d52[_0x30e2c2['variableName']]&&_0x4cf71a[_0x1af8('0x44')][_0x1af8('0x41')]({'id':_0x30e2c2['idField'],'value':_0x3f5d52[_0x30e2c2[_0x1af8('0x43')]][_0x1af8('0x3d')]()});}else if(_0x30e2c2[_0x1af8('0x3f')]===_0x1af8('0x45')&&_0x30e2c2[_0x1af8('0x46')]&&_0x30e2c2[_0x1af8('0x46')][_0x1af8('0x47')]&&_0x30e2c2[_0x1af8('0x40')]&&_0x30e2c2[_0x1af8('0x3b')]){_0x3f5d52[_0x30e2c2[_0x1af8('0x46')][_0x1af8('0x47')]['toLowerCase']()]&&_0x4cf71a['custom_fields'][_0x1af8('0x41')]({'id':_0x30e2c2['idField'],'value':_0x3f5d52[_0x30e2c2[_0x1af8('0x46')][_0x1af8('0x47')][_0x1af8('0x48')]()][_0x1af8('0x3d')]()});}});}return _0x4cf71a;}exports['queue']=function(_0x513449,_0x2982b9,_0x2b9c43,_0x1631ab,_0x307dc2,_0x43a9a8){var _0x4b3a28,_0x288f15;_0x43a9a8[_0x1af8('0xc')]=intUtil[_0x1af8('0x49')](_0x43a9a8[_0x1af8('0xc')]);_0x43a9a8[_0x1af8('0x4a')]=intUtil[_0x1af8('0x49')](_0x43a9a8['serverUrl']);if(_0x307dc2&&_0x307dc2[_0x1af8('0x4b')]){logger[_0x1af8('0x14')](_0x1af8('0x4c'),_0x1af8('0x4d'));_0x2982b9[_0x1af8('0x4e')]=util['format'](_0x1af8('0x4f'),_0x43a9a8[_0x1af8('0x4a')],_0x2982b9[_0x1af8('0x50')],md5(_0x2982b9[_0x1af8('0x50')]));}else{_0x2982b9[_0x1af8('0x4e')]='';}headers[_0x1af8('0x51')]=getAuth(_0x43a9a8);return getUser(_0x43a9a8,_0x1631ab['email'])[_0x1af8('0x13')](function(_0x7b42a1){_0x4b3a28=_0x7b42a1;logger[_0x1af8('0x14')]('The\x20User\x20ID\x20is:',_0x4b3a28['id']);return getEndUser(_0x43a9a8,_0x2982b9[_0x1af8('0x52')],_0x2982b9[_0x1af8('0x53')]);})[_0x1af8('0x13')](function(_0x42fd89){_0x288f15=_0x42fd89;logger['info'](_0x1af8('0x54'),_0x288f15['id']);return getTicket(_0x43a9a8,_0x4b3a28,_0x288f15,_0x2b9c43,_0x2982b9);})[_0x1af8('0x13')](function(_0x5ab9fd){if(_0x5ab9fd){logger[_0x1af8('0x14')]('The\x20Ticket\x20ID\x20is:',_0x5ab9fd['id']);switch(_0x43a9a8[_0x1af8('0x3f')]){case _0x1af8('0x55'):logger[_0x1af8('0x14')](_0x1af8('0x4c'),_0x1af8('0x56'));return request({'uri':util[_0x1af8('0xb')](_0x1af8('0x57'),_0x43a9a8['remoteUri'],_0x4b3a28['id'],_0x5ab9fd['id']),'method':_0x1af8('0xd')});case'newTab':logger[_0x1af8('0x14')](_0x1af8('0x4c'),_0x1af8('0x58'));emit(util[_0x1af8('0xb')](_0x1af8('0x59'),_0x1631ab[_0x1af8('0x47')]),_0x1af8('0x5a'),{'uri':util['format']('%s/agent/tickets/%s',_0x43a9a8['remoteUri'][_0x1af8('0x5b')](_0x1af8('0x5c'),''),_0x5ab9fd['id'])});break;default:logger[_0x1af8('0x5d')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x1af8('0x5e')](function(_0x4dfc73){logger[_0x1af8('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x1af8('0x5f')](_0x4dfc73,{'showHidden':!![],'depth':null}));});};exports[_0x1af8('0x60')]=function(_0x395183,_0xe97eb1,_0x2122aa,_0x4802c6,_0xccc577,_0x897eb7,_0x146e57){var _0x1cce4e,_0x1ba090;_0x897eb7[_0x1af8('0xc')]=intUtil[_0x1af8('0x49')](_0x897eb7[_0x1af8('0xc')]);_0x897eb7['serverUrl']=intUtil['stripTrailingSlash'](_0x897eb7[_0x1af8('0x4a')]);if(_0x146e57&&_0x146e57[_0x1af8('0x61')]&&_0x146e57[_0x1af8('0x61')]!==_0x1af8('0x62')){logger[_0x1af8('0x14')](_0x1af8('0x63'),_0x1af8('0x4d'));_0xe97eb1[_0x1af8('0x4e')]=util[_0x1af8('0xb')](_0x1af8('0x4f'),_0x897eb7['serverUrl'],_0xe97eb1[_0x1af8('0x50')],md5(_0xe97eb1[_0x1af8('0x50')]));}headers[_0x1af8('0x51')]=getAuth(_0x897eb7);return getUser(_0x897eb7,_0x4802c6['email'])[_0x1af8('0x13')](function(_0x31c057){_0x1cce4e=_0x31c057;logger[_0x1af8('0x14')](_0x1af8('0x64'),_0x1cce4e['id']);return getEndUser(_0x897eb7,_0xe97eb1[_0x1af8('0x65')],_0xe97eb1['destcalleridnum']);})[_0x1af8('0x13')](function(_0x68b108){_0x1ba090=_0x68b108;logger[_0x1af8('0x14')](_0x1af8('0x54'),_0x1ba090['id']);return getTicket(_0x897eb7,_0x1cce4e,_0x1ba090,_0x2122aa,_0xe97eb1);})[_0x1af8('0x13')](function(_0x30f1f7){if(_0x30f1f7){logger['info'](_0x1af8('0x66'),_0x30f1f7['id']);switch(_0x897eb7['type']){case _0x1af8('0x55'):logger[_0x1af8('0x14')](_0x1af8('0x63'),_0x1af8('0x56'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x897eb7[_0x1af8('0xc')],_0x1cce4e['id'],_0x30f1f7['id']),'method':'POST'});case _0x1af8('0x67'):logger[_0x1af8('0x14')](_0x1af8('0x63'),_0x1af8('0x58'));emit(util[_0x1af8('0xb')](_0x1af8('0x59'),_0x4802c6['name']),_0x1af8('0x5a'),{'uri':util[_0x1af8('0xb')](_0x1af8('0x68'),_0x897eb7[_0x1af8('0xc')][_0x1af8('0x5b')](_0x1af8('0x5c'),''),_0x30f1f7['id'])});break;default:logger[_0x1af8('0x5d')]('[OUTBOUND]',_0x1af8('0x69'));}}})[_0x1af8('0x5e')](function(_0x36213e){logger['error'](_0x1af8('0x6a'),util['inspect'](_0x36213e,{'showHidden':!![],'depth':null}));});};exports[_0x1af8('0x6b')]=function(_0x2031a2,_0x158400,_0x1d85a8,_0x286d01,_0x6add96,_0x47b0b0){var _0x28d960,_0x3c3400;_0x47b0b0['remoteUri']=intUtil[_0x1af8('0x49')](_0x47b0b0['remoteUri']);_0x47b0b0[_0x1af8('0x4a')]=intUtil[_0x1af8('0x49')](_0x47b0b0[_0x1af8('0x4a')]);if(_0x6add96&&_0x6add96[_0x1af8('0x4b')]){logger[_0x1af8('0x14')]('['+_0x158400['lastevent'][_0x1af8('0x6c')]()+']',_0x1af8('0x4d'));_0x158400[_0x1af8('0x4e')]=util[_0x1af8('0xb')](_0x1af8('0x4f'),_0x47b0b0[_0x1af8('0x4a')],_0x158400[_0x1af8('0x50')],md5(_0x158400[_0x1af8('0x50')]));}else{_0x158400[_0x1af8('0x4e')]='';}headers[_0x1af8('0x51')]=getAuth(_0x47b0b0);return getUser(_0x47b0b0)[_0x1af8('0x13')](function(_0x4bc467){_0x28d960=_0x4bc467;logger[_0x1af8('0x14')](_0x1af8('0x64'),_0x28d960['id']);return getEndUser(_0x47b0b0,_0x158400['calleridname'],_0x158400[_0x1af8('0x53')]);})[_0x1af8('0x13')](function(_0x2afc42){_0x3c3400=_0x2afc42;logger[_0x1af8('0x14')]('The\x20Enduser\x20ID\x20is:',_0x3c3400['id']);return getTicket(_0x47b0b0,_0x28d960,_0x3c3400,_0x1d85a8,_0x158400);})['then'](function(_0x1ca1be){if(_0x1ca1be){logger[_0x1af8('0x14')](_0x1af8('0x66'),_0x1ca1be['id']);}})[_0x1af8('0x5e')](function(_0x2077ca){logger[_0x1af8('0x5d')]('['+_0x158400['lastevent'][_0x1af8('0x6c')]()+']'+_0x1af8('0x6d'),util[_0x1af8('0x5f')](_0x2077ca,{'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 a8777aa..db63124 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 _0x87a2=['error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','zoho.eu','com','destcalleridname','Outbound','https://crm.','lastevent','toUpperCase','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','debug','[HTTP]','stringify','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds','catch'];(function(_0x5d1ab2,_0x3d187d){var _0x24b58e=function(_0x40c5a4){while(--_0x40c5a4){_0x5d1ab2['push'](_0x5d1ab2['shift']());}};_0x24b58e(++_0x3d187d);}(_0x87a2,0x113));var _0x287a=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x87a2[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require('lodash');var rp=require(_0x287a('0x0'));var md5=require(_0x287a('0x1'));var util=require('util');var intUtil=require(_0x287a('0x2'));var moment=require(_0x287a('0x3'));var Redis=require(_0x287a('0x4'));var BPromise=require(_0x287a('0x5'));var config=require(_0x287a('0x6'));var logger=require(_0x287a('0x7'))(_0x287a('0x8'));config[_0x287a('0x9')]=_[_0x287a('0xa')](config[_0x287a('0x9')],{'host':_0x287a('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x287a('0x9')]));function emit(_0x360664,_0x45e52b,_0x5d6df4){io['to'](_0x360664)['emit'](_0x45e52b,_0x5d6df4);}function request(_0x172484){logger[_0x287a('0xc')](_0x287a('0xd'),JSON[_0x287a('0xe')](_0x172484));return rp(_0x172484);}function getCustomFields(_0x42bcd2,_0x25fb6d){var _0x15f784={};if(_0x42bcd2['length']>0x0){_[_0x287a('0xf')](_0x42bcd2,function(_0x30368a){if(_[_0x287a('0x10')]([_0x287a('0x11'),_0x287a('0x12')],_0x30368a['type'])&&_0x30368a[_0x287a('0x13')]){_0x15f784[_0x30368a[_0x287a('0x13')]]=_0x30368a[_0x287a('0x14')][_0x287a('0x15')]();}else if(_0x30368a[_0x287a('0x16')]===_0x287a('0x17')&&_0x30368a[_0x287a('0x18')]&&_0x30368a[_0x287a('0x13')]&&_0x25fb6d[_0x30368a[_0x287a('0x18')]]){_0x15f784[_0x30368a[_0x287a('0x13')]]=_0x25fb6d[_0x30368a['variableName']]['toString']();}else if(_0x30368a[_0x287a('0x16')]==='customVariable'&&_0x30368a[_0x287a('0x19')]&&_0x30368a[_0x287a('0x19')][_0x287a('0x1a')]&&_0x30368a['idField']&&_0x25fb6d[_0x30368a['Variable'][_0x287a('0x1a')][_0x287a('0x1b')]()]){_0x15f784[_0x30368a[_0x287a('0x13')]]=_0x25fb6d[_0x30368a[_0x287a('0x19')][_0x287a('0x1a')]['toLowerCase']()][_0x287a('0x15')]();}});}return _0x15f784;}function getName(_0xdbfa1f){if(_0xdbfa1f[_0x287a('0x1c')]('\x20')>0x0){var _0x419860=_0xdbfa1f[_0x287a('0x1d')](/ (.+)/);if(_0x419860[0x1]){return _0x419860;}}return[_0xdbfa1f,_0xdbfa1f];}var accountsTokens={};function getAccessToken(_0x504060){return new Promise(function(_0xcfe5fd,_0x418d35){if(!_[_0x287a('0x1e')](accountsTokens[_0x504060['id']])&&!_['isNil'](accountsTokens[_0x504060['id']][_0x287a('0x1f')])){if(moment()[_0x287a('0x20')](accountsTokens[_0x504060['id']][_0x287a('0x21')])){_0xcfe5fd(accountsTokens[_0x504060['id']]['access_token']);}}var _0x4f2a0c;switch(_0x504060['zone']){case'US':_0x4f2a0c=_0x287a('0x22');break;case'AU':_0x4f2a0c='https://accounts.zoho.com.au';break;case'EU':_0x4f2a0c=_0x287a('0x23');break;case'IN':_0x4f2a0c=_0x287a('0x24');break;case'CN':_0x4f2a0c=_0x287a('0x25');break;default:_0x4f2a0c='https://accounts.zoho.eu';break;}var _0x198602={'method':_0x287a('0x26'),'uri':_0x4f2a0c+_0x287a('0x27'),'qs':{'refresh_token':_0x504060['refreshToken'],'client_id':_0x504060[_0x287a('0x28')],'client_secret':_0x504060[_0x287a('0x29')],'grant_type':_0x287a('0x2a')},'json':!![]};return rp(_0x198602)[_0x287a('0x2b')](function(_0x21f5e8){accountsTokens[_0x504060['id']]={'access_token':_0x21f5e8[_0x287a('0x1f')],'expires_in':moment()[_0x287a('0x2c')](_0x21f5e8[_0x287a('0x21')],_0x287a('0x2d'))};_0xcfe5fd(_0x21f5e8['access_token']);})[_0x287a('0x2e')](function(_0xecff91){logger[_0x287a('0x2f')](_0x287a('0x30'),_0xecff91[_0x287a('0x31')]);_0x418d35(_0xecff91);});});}function getUser(_0x23b3f0,_0x29a354,_0x350614,_0x1ba732){logger[_0x287a('0x32')](_0x287a('0x33'));return request({'method':_0x287a('0x34'),'uri':util[_0x287a('0x35')](_0x287a('0x36'),_0x29a354),'qs':{'type':_0x287a('0x37')},'headers':{'Authorization':_0x287a('0x38')+_0x23b3f0},'json':!![]})[_0x287a('0x2b')](function(_0x502276){if(_0x502276[_0x287a('0x39')]){var _0x44db8d=-0x1;if(_[_0x287a('0x3a')](_0x502276['users'])){if(!_[_0x287a('0x1e')](_0x1ba732)){_0x44db8d=_[_0x287a('0x3b')](_0x502276[_0x287a('0x39')],function(_0x1022d9){return _0x1022d9[_0x287a('0x3c')]===_0x1ba732;});}if(_0x44db8d>=0x0){logger[_0x287a('0x32')](_0x287a('0x3d'));}else{logger[_0x287a('0x32')]('Using\x20the\x20admin\x20account!');_0x44db8d=_[_0x287a('0x3b')](_0x502276['users'],function(_0x2c23e7){return _0x2c23e7[_0x287a('0x3e')][_0x287a('0x1a')]===_0x287a('0x3f');});}return _0x502276[_0x287a('0x39')][_0x44db8d];}else{if(_0x502276['user']['profile'][_0x287a('0x1a')]===_0x287a('0x3f')){logger[_0x287a('0x32')](_0x287a('0x40'));user=_0x502276[_0x287a('0x41')];return user;}else{logger[_0x287a('0x2f')](_0x287a('0x42'),JSON[_0x287a('0xe')](_0x502276));throw new Error(_0x287a('0x43')+JSON[_0x287a('0xe')](_0x502276));}}}else{logger[_0x287a('0x2f')](_0x287a('0x42'),JSON[_0x287a('0xe')](_0x502276));throw new Error(_0x287a('0x43')+JSON[_0x287a('0xe')](_0x502276));}})[_0x287a('0x2e')](function(_0x1fa63d){console['error'](_0x1fa63d);});}function getZohoUser(_0x956192,_0x52c800){return new BPromise(function(_0x1a4c8d,_0x8555b){request(_0x956192)[_0x287a('0x2b')](function(_0x376e2a){var _0x48ebda=null;if(_0x376e2a){_0x48ebda=_0x376e2a[_0x287a('0x44')][0x0];_0x48ebda[_0x287a('0x45')]=_0x52c800;}_0x1a4c8d(_0x48ebda);})[_0x287a('0x2e')](function(_0x52b594){_0x8555b(_0x52b594);});});}function createEndUser(_0x4fab2a,_0x3854f0,_0x560962,_0x4281f6,_0xa017c1,_0x423c4e){var _0x560962=getName(_0x560962);return request({'method':'POST','uri':_0x287a('0x46')+_0x3854f0+'/crm/v2/'+_[_0x287a('0x47')](_0x423c4e[_0x287a('0x48')])+'s','body':{'data':[{'Last_Name':_0x560962[0x1],'First_Name':_0x560962[0x0],'Phone':_0x4281f6,'Owner':{'name':!_[_0x287a('0x1e')](_0xa017c1[_0x287a('0x49')][_0x287a('0x1a')])?_0xa017c1[_0x287a('0x49')]['name']:!_['isNil'](_0xa017c1[_0x287a('0x4a')])?_0xa017c1[_0x287a('0x4a')]+'\x20'+_0xa017c1[_0x287a('0x4b')]:_0xa017c1[_0x287a('0x4b')],'id':_0xa017c1['id']}}]},'headers':{'Authorization':_0x287a('0x38')+_0x4fab2a},'json':!![]})[_0x287a('0x2b')](function(_0x302d76){if(_0x302d76&&_0x302d76[_0x287a('0x44')][0x0]['code']===_0x287a('0x4c')){var _0x1f4341=_0x302d76[_0x287a('0x44')][0x0][_0x287a('0x4d')];_0x1f4341['enduserType']=_[_0x287a('0x47')](_0x423c4e[_0x287a('0x48')])+'s';return _0x1f4341;}logger[_0x287a('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x287a('0xe')](data));throw new Error(_0x287a('0x4e')+JSON[_0x287a('0xe')](data));})['catch'](function(_0xf80622){console[_0x287a('0x4f')](_0x287a('0x50'),_0xf80622);});}function getEndUser(_0x1f43c2,_0x2aae8c,_0x381b22,_0x1bf3af,_0x2a3b13,_0xf725d,_0x368e4e){var _0x42947c={'method':_0x287a('0x34'),'uri':'','headers':{'Authorization':_0x287a('0x38')+_0x1f43c2},'json':!![]};switch(_0x368e4e[_0x287a('0x51')]){case _0x287a('0x52'):_0x42947c['uri']=_0x287a('0x46')+_0x2aae8c+_0x287a('0x53')+_0x2a3b13+'))';return getZohoUser(_0x42947c,_0x287a('0x54'))[_0x287a('0x2b')](function(_0x180a63){if(_0x180a63)return _0x180a63;_0x42947c[_0x287a('0x55')]='https://www.zohoapis.'+_0x2aae8c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2a3b13+'))';return getZohoUser(_0x42947c,'Leads')['then'](function(_0x249401){if(_0x249401)return _0x249401;if(_0x368e4e['moduleCreate']!=_0x287a('0x56')){return createEndUser(_0x1f43c2,_0x2aae8c,_0x1bf3af,_0x2a3b13,_0xf725d,_0x368e4e);}else{return{};}});});break;case _0x287a('0x57'):_0x42947c['uri']=_0x287a('0x46')+_0x2aae8c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2a3b13+'))';return getZohoUser(_0x42947c,'Contacts')[_0x287a('0x2b')](function(_0x255a41){if(_0x255a41)return _0x255a41;if(_0x368e4e['moduleCreate']!=_0x287a('0x56')){return createEndUser(_0x1f43c2,_0x2aae8c,_0x1bf3af,_0x2a3b13,_0xf725d,_0x368e4e);}else{return{};}});break;case _0x287a('0x58'):_0x42947c[_0x287a('0x55')]=_0x287a('0x46')+_0x2aae8c+_0x287a('0x59')+_0x2a3b13+'))';return getZohoUser(_0x42947c,_0x287a('0x5a'))[_0x287a('0x2b')](function(_0x17265f){if(_0x17265f)return _0x17265f;if(_0x368e4e['moduleCreate']!=_0x287a('0x56')){return createEndUser(_0x1f43c2,_0x2aae8c,_0x1bf3af,_0x2a3b13,_0xf725d,_0x368e4e);}else{return{};}});break;}}function getCall(_0x51e5d6,_0xe02734,_0x226638,_0x33487b,_0x3d2ca7,_0x19aa29,_0x5da0a8,_0x237053){logger['info'](_0x287a('0x5b'));var _0x5491c5={};_0x5491c5[_0x287a('0x5c')]={'name':!_[_0x287a('0x1e')](_0x33487b[_0x287a('0x49')][_0x287a('0x1a')])&&!_[_0x287a('0x1e')](_0x33487b[_0x287a('0x3e')][_0x287a('0x1a')])&&_0x33487b[_0x287a('0x3e')][_0x287a('0x1a')]==='administrator'?_0x33487b[_0x287a('0x49')]['name']:!_[_0x287a('0x1e')](_0x33487b[_0x287a('0x4a')])?_0x33487b[_0x287a('0x4a')]+'\x20'+_0x33487b[_0x287a('0x4b')]:_0x33487b[_0x287a('0x4b')],'id':_0x33487b['id']};_0x5491c5[_0x287a('0x5d')]=intUtil[_0x287a('0x5e')](_0x19aa29[_0x287a('0x5f')],_0x5da0a8,'\x20');_0x5491c5[_0x287a('0x60')]=intUtil[_0x287a('0x5e')](_0x19aa29[_0x287a('0x61')],_0x5da0a8,'\x0a');if(_0x3d2ca7[_0x287a('0x45')]===_0x287a('0x54')){_0x5491c5[_0x287a('0x62')]={'name':!_[_0x287a('0x1e')](_0x3d2ca7[_0x287a('0x63')])?_0x3d2ca7[_0x287a('0x63')]:!_[_0x287a('0x1e')](_0x3d2ca7[_0x287a('0x64')])?_0x3d2ca7['First_Name']+'\x20'+_0x3d2ca7['Last_Name']:_0x3d2ca7[_0x287a('0x65')],'id':_0x3d2ca7['id']};}if(_0x3d2ca7[_0x287a('0x45')]===_0x287a('0x5a')){_0x5491c5[_0x287a('0x66')]={'name':!_[_0x287a('0x1e')](_0x3d2ca7['Full_Name'])?_0x3d2ca7[_0x287a('0x63')]:!_[_0x287a('0x1e')](_0x3d2ca7['First_Name'])?_0x3d2ca7[_0x287a('0x64')]+'\x20'+_0x3d2ca7['Last_Name']:_0x3d2ca7['Last_Name'],'id':_0x3d2ca7['id']};_0x5491c5[_0x287a('0x67')]=_[_0x287a('0x47')](_0x3d2ca7[_0x287a('0x45')]);}if(_0x5da0a8[_0x287a('0x68')]){_0x5491c5['Call_Duration']=moment[_0x287a('0x69')](parseInt(_0x5da0a8[_0x287a('0x68')])*0x3e8)[_0x287a('0x35')](_0x287a('0x6a'));}else if(_0x5da0a8[_0x287a('0x6b')]&&_0x5da0a8[_0x287a('0x6c')]){_0x5491c5[_0x287a('0x6d')]=moment['utc'](moment(_0x5da0a8['endtime'],_0x287a('0x6e'))[_0x287a('0x6f')](moment(_0x5da0a8[_0x287a('0x70')],'YYYY-MM-DDTHH:mm:ss')))[_0x287a('0x35')](_0x287a('0x6a'));}switch(_0x5da0a8['lastevent']){case _0x287a('0x71'):_0x5491c5[_0x287a('0x72')]=_0x287a('0x73');break;case'complete':case _0x287a('0x74'):_0x5491c5[_0x287a('0x72')]=_0x287a('0x75');break;case _0x287a('0x76'):_0x5491c5[_0x287a('0x72')]=_0x287a('0x77');break;case _0x287a('0x78'):_0x5491c5[_0x287a('0x72')]='Abandoned';break;case _0x287a('0x79'):_0x5491c5[_0x287a('0x72')]=_0x287a('0x7a');default:}_0x5491c5[_0x287a('0x7b')]=(_0x237053==='outbound'?moment(_0x5da0a8[_0x287a('0x70')])[_0x287a('0x35')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x5da0a8[_0x287a('0x7c')])['format'](_0x287a('0x6e')))||moment()[_0x287a('0x35')](_0x287a('0x6e'));_0x5491c5[_0x287a('0x7d')]=_0x237053||_0x287a('0x7e');_0x5491c5=_[_0x287a('0x7f')](_0x5491c5,getCustomFields(_0x19aa29[_0x287a('0x80')],_0x5da0a8));return request({'method':_0x287a('0x26'),'uri':_0x287a('0x46')+_0xe02734+_0x287a('0x81'),'headers':{'Authorization':_0x287a('0x38')+_0x51e5d6},'body':{'data':[_0x5491c5]},'json':!![]})[_0x287a('0x2b')](function(_0x132d86){if(_0x132d86&&_0x132d86[_0x287a('0x44')][0x0]['code']===_0x287a('0x4c')){logger[_0x287a('0x32')](_0x287a('0x82'));return{'id':_0x132d86[_0x287a('0x44')][0x0][_0x287a('0x4d')]['id']};}})[_0x287a('0x2e')](function(_0x4190c1){logger['info'](_0x287a('0x83'),_0x4190c1['stack']);console['log']('err',_0x4190c1);});}exports[_0x287a('0x84')]=function(_0x8cf288,_0x8d9158,_0x14c68e,_0xddd8cc,_0x23c943,_0x353812){var _0x14e699,_0x12ae69,_0x5edaae;_0x353812[_0x287a('0x85')]=intUtil[_0x287a('0x86')](_0x353812['host']);_0x353812[_0x287a('0x87')]=intUtil[_0x287a('0x86')](_0x353812[_0x287a('0x87')]);if(_0x23c943&&_0x23c943[_0x287a('0x88')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x8d9158[_0x287a('0x89')]=_0x353812[_0x287a('0x87')]+_0x287a('0x8a')+_0x8d9158[_0x287a('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0x8d9158[_0x287a('0x8b')]);}else{_0x8d9158[_0x287a('0x89')]='';}var _0x1024b6=_0x353812[_0x287a('0x85')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x353812)['then'](function(_0x46d2d6){_0x5edaae=_0x46d2d6;return getUser(_0x5edaae,_0x1024b6,_0x353812,_0xddd8cc[_0x287a('0x3c')]);})[_0x287a('0x2b')](function(_0xff6bd1){_0x14e699=_0xff6bd1;logger[_0x287a('0x32')](_0x287a('0x8c'),_0x14e699['id']);return getEndUser(_0x5edaae,_0x1024b6,_0x353812,_0x8d9158[_0x287a('0x8d')],_0x8d9158[_0x287a('0x8e')],_0x14e699,_0x14c68e);})[_0x287a('0x2b')](function(_0x5d9d7a){_0x12ae69=_0x5d9d7a;return getCall(_0x5edaae,_0x1024b6,_0x353812,_0x14e699,_0x12ae69,_0x14c68e,_0x8d9158,'Inbound');})['then'](function(_0x480915){if(_0x480915){logger['info'](_0x287a('0x8f'),_0x480915['id']);logger[_0x287a('0x32')](_0x287a('0x90'),_0x287a('0x91'));emit(util[_0x287a('0x35')](_0x287a('0x92'),_0xddd8cc[_0x287a('0x1a')]),_0x287a('0x93'),{'uri':'https://crm.'+_0x353812['host']+_0x287a('0x94')+_0x480915['id']});}})['catch'](function(_0x15fefe){logger[_0x287a('0x2f')](_0x287a('0x90'),JSON['stringify'](_0x15fefe));});};exports['outbound']=function(_0x29bbac,_0x2d6e34,_0x5a0b02,_0x15447d,_0x4d99d4,_0x5a0233,_0x527925){var _0x3dff52,_0x58032b,_0x1708b9;_0x5a0233[_0x287a('0x85')]=intUtil[_0x287a('0x86')](_0x5a0233[_0x287a('0x85')]);_0x5a0233['serverUrl']=intUtil['stripTrailingSlash'](_0x5a0233[_0x287a('0x87')]);if(_0x527925&&_0x527925['recordingFormat']&&_0x527925[_0x287a('0x95')]!==_0x287a('0x96')){logger[_0x287a('0x32')](_0x287a('0x97'),_0x287a('0x98'));_0x2d6e34[_0x287a('0x89')]=_0x5a0233[_0x287a('0x87')]+_0x287a('0x8a')+_0x2d6e34[_0x287a('0x8b')]+_0x287a('0x99')+md5(_0x2d6e34[_0x287a('0x8b')]);}var _0x446993=_0x5a0233[_0x287a('0x85')]===_0x287a('0x9a')?'eu':_0x287a('0x9b');return getAccessToken(_0x5a0233)[_0x287a('0x2b')](function(_0x5574e4){_0x1708b9=_0x5574e4;return getUser(_0x1708b9,_0x446993,_0x5a0233,_0x15447d[_0x287a('0x3c')]);})['then'](function(_0x140854){_0x3dff52=_0x140854;logger[_0x287a('0x32')](_0x287a('0x8c'),_0x3dff52['id']);return getEndUser(_0x1708b9,_0x446993,_0x5a0233,_0x2d6e34[_0x287a('0x9c')],_0x2d6e34['destcalleridnum'],_0x3dff52,_0x5a0b02);})[_0x287a('0x2b')](function(_0x3c300e){_0x58032b=_0x3c300e;return getCall(_0x1708b9,_0x446993,_0x5a0233,_0x3dff52,_0x58032b,_0x5a0b02,_0x2d6e34,_0x287a('0x9d'));})[_0x287a('0x2b')](function(_0x44c26e){if(_0x44c26e){logger[_0x287a('0x32')](_0x287a('0x8f'),_0x44c26e['id']);logger[_0x287a('0x32')](_0x287a('0x97'),_0x287a('0x91'));emit(util['format']('user:%s',_0x15447d[_0x287a('0x1a')]),_0x287a('0x93'),{'uri':_0x287a('0x9e')+_0x5a0233[_0x287a('0x85')]+'/crm/EntityInfo.do?module=Calls&id='+_0x44c26e['id']});}})[_0x287a('0x2e')](function(_0x4fb8dd){logger[_0x287a('0x2f')]('[OUTBOUND]',JSON[_0x287a('0xe')](_0x4fb8dd));});};exports['unmanaged']=function(_0x5722b7,_0x2b5b1c,_0x5bac60,_0x1ef6f9,_0xc4c724,_0x46cb45){var _0x34f1b0,_0xae6811,_0x25441d;_0x46cb45[_0x287a('0x85')]=intUtil[_0x287a('0x86')](_0x46cb45['host']);_0x46cb45[_0x287a('0x87')]=intUtil[_0x287a('0x86')](_0x46cb45[_0x287a('0x87')]);if(_0xc4c724&&_0xc4c724[_0x287a('0x88')]){logger[_0x287a('0x32')]('['+_0x2b5b1c[_0x287a('0x9f')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x2b5b1c[_0x287a('0x89')]=_0x46cb45[_0x287a('0x87')]+'/api/voice/recordings/'+_0x2b5b1c[_0x287a('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0x2b5b1c[_0x287a('0x8b')]);}else{_0x2b5b1c[_0x287a('0x89')]='';}var _0x1d6331=_0x46cb45[_0x287a('0x85')]===_0x287a('0x9a')?'eu':_0x287a('0x9b');return getAccessToken(_0x46cb45)['then'](function(_0x1c84f4){_0x25441d=_0x1c84f4;return getUser(_0x25441d,_0x1d6331,_0x46cb45);})[_0x287a('0x2b')](function(_0x5dba3d){_0x34f1b0=_0x5dba3d;logger[_0x287a('0x32')](_0x287a('0x8c'),_0x34f1b0['id']);return getEndUser(_0x25441d,_0x1d6331,_0x46cb45,_0x2b5b1c['calleridname'],_0x2b5b1c[_0x287a('0x8e')],_0x34f1b0,_0x5bac60);})[_0x287a('0x2b')](function(_0x55d6d1){_0xae6811=_0x55d6d1;return getCall(_0x25441d,_0x1d6331,_0x46cb45,_0x34f1b0,_0xae6811,_0x5bac60,_0x2b5b1c,_0x287a('0x7e'));})['then'](function(_0x3e53e3){if(_0x3e53e3){logger[_0x287a('0x32')](_0x287a('0x8f'),_0x3e53e3['id']);}})[_0x287a('0x2e')](function(_0x2375e9){logger['error']('['+_0x2b5b1c[_0x287a('0x9f')][_0x287a('0xa0')]()+']',JSON[_0x287a('0xe')](_0x2375e9));});}; \ No newline at end of file +var _0xf7cb=['Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','Error:\x20','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','complete','connect','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','log','err','queue','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','email','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','user:%s','https://crm.','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','defaults','redis','localhost','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','content','variable','variableName','idField','toString','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack'];(function(_0x41719e,_0x1fa409){var _0x446a95=function(_0xfa38c4){while(--_0xfa38c4){_0x41719e['push'](_0x41719e['shift']());}};_0x446a95(++_0x1fa409);}(_0xf7cb,0x1a9));var _0xbf7c=function(_0x2a8c08,_0x56a5b1){_0x2a8c08=_0x2a8c08-0x0;var _0x548532=_0xf7cb[_0x2a8c08];return _0x548532;};'use strict';var _=require('lodash');var rp=require(_0xbf7c('0x0'));var md5=require(_0xbf7c('0x1'));var util=require(_0xbf7c('0x2'));var intUtil=require(_0xbf7c('0x3'));var moment=require(_0xbf7c('0x4'));var Redis=require(_0xbf7c('0x5'));var BPromise=require(_0xbf7c('0x6'));var config=require('../../../../config/environment');var logger=require(_0xbf7c('0x7'))(_0xbf7c('0x8'));config['redis']=_[_0xbf7c('0x9')](config[_0xbf7c('0xa')],{'host':_0xbf7c('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbf7c('0xa')]));function emit(_0x3b2c1d,_0x187f12,_0x3d0609){io['to'](_0x3b2c1d)[_0xbf7c('0xc')](_0x187f12,_0x3d0609);}function request(_0x353075){logger[_0xbf7c('0xd')](_0xbf7c('0xe'),JSON[_0xbf7c('0xf')](_0x353075));return rp(_0x353075);}function getCustomFields(_0x8019fa,_0x872524){var _0xe2bf20={};if(_0x8019fa['length']>0x0){_[_0xbf7c('0x10')](_0x8019fa,function(_0x476b72){if(_['includes']([_0xbf7c('0x11'),_0xbf7c('0x12')],_0x476b72[_0xbf7c('0x13')])&&_0x476b72['idField']){_0xe2bf20[_0x476b72['idField']]=_0x476b72[_0xbf7c('0x14')]['toString']();}else if(_0x476b72[_0xbf7c('0x13')]===_0xbf7c('0x15')&&_0x476b72[_0xbf7c('0x16')]&&_0x476b72[_0xbf7c('0x17')]&&_0x872524[_0x476b72[_0xbf7c('0x16')]]){_0xe2bf20[_0x476b72[_0xbf7c('0x17')]]=_0x872524[_0x476b72[_0xbf7c('0x16')]][_0xbf7c('0x18')]();}else if(_0x476b72[_0xbf7c('0x13')]==='customVariable'&&_0x476b72[_0xbf7c('0x19')]&&_0x476b72[_0xbf7c('0x19')][_0xbf7c('0x1a')]&&_0x476b72[_0xbf7c('0x17')]&&_0x872524[_0x476b72[_0xbf7c('0x19')]['name'][_0xbf7c('0x1b')]()]){_0xe2bf20[_0x476b72[_0xbf7c('0x17')]]=_0x872524[_0x476b72[_0xbf7c('0x19')]['name'][_0xbf7c('0x1b')]()][_0xbf7c('0x18')]();}});}return _0xe2bf20;}function getName(_0x523c9e){if(_0x523c9e[_0xbf7c('0x1c')]('\x20')>0x0){var _0x2c9bf1=_0x523c9e['split'](/ (.+)/);if(_0x2c9bf1[0x1]){return _0x2c9bf1;}}return[_0x523c9e,_0x523c9e];}var accountsTokens={};function getAccessToken(_0x3a4a95){return new Promise(function(_0x88b021,_0x19e79d){if(!_[_0xbf7c('0x1d')](accountsTokens[_0x3a4a95['id']])&&!_['isNil'](accountsTokens[_0x3a4a95['id']][_0xbf7c('0x1e')])){if(moment()[_0xbf7c('0x1f')](accountsTokens[_0x3a4a95['id']][_0xbf7c('0x20')])){_0x88b021(accountsTokens[_0x3a4a95['id']][_0xbf7c('0x1e')]);}}var _0x25340b;switch(_0x3a4a95[_0xbf7c('0x21')]){case'US':_0x25340b=_0xbf7c('0x22');break;case'AU':_0x25340b='https://accounts.zoho.com.au';break;case'EU':_0x25340b=_0xbf7c('0x23');break;case'IN':_0x25340b=_0xbf7c('0x24');break;case'CN':_0x25340b=_0xbf7c('0x25');break;default:_0x25340b=_0xbf7c('0x23');break;}var _0x2bf02d={'method':_0xbf7c('0x26'),'uri':_0x25340b+'/oauth/v2/token','qs':{'refresh_token':_0x3a4a95[_0xbf7c('0x27')],'client_id':_0x3a4a95[_0xbf7c('0x28')],'client_secret':_0x3a4a95[_0xbf7c('0x29')],'grant_type':_0xbf7c('0x2a')},'json':!![]};return rp(_0x2bf02d)[_0xbf7c('0x2b')](function(_0x2f2148){accountsTokens[_0x3a4a95['id']]={'access_token':_0x2f2148['access_token'],'expires_in':moment()[_0xbf7c('0x2c')](_0x2f2148[_0xbf7c('0x20')],_0xbf7c('0x2d'))};_0x88b021(_0x2f2148['access_token']);})['catch'](function(_0x47d023){logger[_0xbf7c('0x2e')](_0xbf7c('0x2f'),_0x47d023[_0xbf7c('0x30')]);_0x19e79d(_0x47d023);});});}function getUser(_0x30a593,_0x1f3be0,_0x24059f,_0x7eff42){logger['info'](_0xbf7c('0x31'));return request({'method':'GET','uri':util[_0xbf7c('0x32')](_0xbf7c('0x33'),_0x1f3be0),'qs':{'type':_0xbf7c('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x30a593},'json':!![]})['then'](function(_0x1a9f4b){if(_0x1a9f4b[_0xbf7c('0x35')]){var _0x1f9c01=-0x1;if(_[_0xbf7c('0x36')](_0x1a9f4b[_0xbf7c('0x35')])){if(!_[_0xbf7c('0x1d')](_0x7eff42)){_0x1f9c01=_[_0xbf7c('0x37')](_0x1a9f4b[_0xbf7c('0x35')],function(_0x480c3f){return _0x480c3f['email']===_0x7eff42;});}if(_0x1f9c01>=0x0){logger[_0xbf7c('0x38')]('Agent\x20found!');}else{logger[_0xbf7c('0x38')](_0xbf7c('0x39'));_0x1f9c01=_['findIndex'](_0x1a9f4b[_0xbf7c('0x35')],function(_0x1d95ae){return _0x1d95ae[_0xbf7c('0x3a')][_0xbf7c('0x1a')]===_0xbf7c('0x3b');});}return _0x1a9f4b[_0xbf7c('0x35')][_0x1f9c01];}else{if(_0x1a9f4b['user'][_0xbf7c('0x3a')][_0xbf7c('0x1a')]===_0xbf7c('0x3b')){logger[_0xbf7c('0x38')]('Using\x20the\x20admin\x20account!');user=_0x1a9f4b[_0xbf7c('0x3c')];return user;}else{logger[_0xbf7c('0x2e')](_0xbf7c('0x3d'),JSON[_0xbf7c('0xf')](_0x1a9f4b));throw new Error(_0xbf7c('0x3e')+JSON[_0xbf7c('0xf')](_0x1a9f4b));}}}else{logger[_0xbf7c('0x2e')](_0xbf7c('0x3d'),JSON[_0xbf7c('0xf')](_0x1a9f4b));throw new Error(_0xbf7c('0x3e')+JSON['stringify'](_0x1a9f4b));}})[_0xbf7c('0x3f')](function(_0x1ab61d){console[_0xbf7c('0x2e')](_0x1ab61d);});}function getZohoUser(_0x613e18,_0x235d7c){return new BPromise(function(_0x239937,_0x324a3b){request(_0x613e18)[_0xbf7c('0x2b')](function(_0x4b1ced){var _0x15fd7a=null;if(_0x4b1ced){_0x15fd7a=_0x4b1ced[_0xbf7c('0x40')][0x0];_0x15fd7a[_0xbf7c('0x41')]=_0x235d7c;}_0x239937(_0x15fd7a);})[_0xbf7c('0x3f')](function(_0x560cc1){_0x324a3b(_0x560cc1);});});}function createEndUser(_0x40b234,_0x91ee87,_0x1707bb,_0x576d15,_0x5c654c,_0x28c402){var _0x1707bb=getName(_0x1707bb);return request({'method':_0xbf7c('0x26'),'uri':_0xbf7c('0x42')+_0x91ee87+'/crm/v2/'+_[_0xbf7c('0x43')](_0x28c402[_0xbf7c('0x44')])+'s','body':{'data':[{'Last_Name':_0x1707bb[0x1],'First_Name':_0x1707bb[0x0],'Phone':_0x576d15,'Owner':{'name':!_['isNil'](_0x5c654c[_0xbf7c('0x45')][_0xbf7c('0x1a')])?_0x5c654c[_0xbf7c('0x45')][_0xbf7c('0x1a')]:!_[_0xbf7c('0x1d')](_0x5c654c[_0xbf7c('0x46')])?_0x5c654c[_0xbf7c('0x46')]+'\x20'+_0x5c654c[_0xbf7c('0x47')]:_0x5c654c[_0xbf7c('0x47')],'id':_0x5c654c['id']}}]},'headers':{'Authorization':_0xbf7c('0x48')+_0x40b234},'json':!![]})['then'](function(_0x33055a){if(_0x33055a&&_0x33055a[_0xbf7c('0x40')][0x0][_0xbf7c('0x49')]===_0xbf7c('0x4a')){var _0x4f5315=_0x33055a[_0xbf7c('0x40')][0x0]['details'];_0x4f5315[_0xbf7c('0x41')]=_[_0xbf7c('0x43')](_0x28c402[_0xbf7c('0x44')])+'s';return _0x4f5315;}logger[_0xbf7c('0x2e')](_0xbf7c('0x3d'),JSON[_0xbf7c('0xf')](data));throw new Error(_0xbf7c('0x4b')+JSON[_0xbf7c('0xf')](data));})['catch'](function(_0x3fd30d){console['log']('CREATE\x20ERROR',_0x3fd30d);});}function getEndUser(_0x3fb773,_0x38e51e,_0x5d4f42,_0x31c1d4,_0x4645e9,_0x4de309,_0x22f2f6){var _0x340511={'method':_0xbf7c('0x4c'),'uri':'','headers':{'Authorization':_0xbf7c('0x48')+_0x3fb773},'json':!![]};switch(_0x22f2f6[_0xbf7c('0x4d')]){case _0xbf7c('0x4e'):_0x340511[_0xbf7c('0x4f')]=_0xbf7c('0x42')+_0x38e51e+_0xbf7c('0x50')+_0x4645e9+'))';return getZohoUser(_0x340511,_0xbf7c('0x51'))[_0xbf7c('0x2b')](function(_0x2ca576){if(_0x2ca576)return _0x2ca576;_0x340511['uri']=_0xbf7c('0x42')+_0x38e51e+_0xbf7c('0x52')+_0x4645e9+'))';return getZohoUser(_0x340511,_0xbf7c('0x53'))[_0xbf7c('0x2b')](function(_0x5cf98e){if(_0x5cf98e)return _0x5cf98e;if(_0x22f2f6[_0xbf7c('0x44')]!=_0xbf7c('0x54')){return createEndUser(_0x3fb773,_0x38e51e,_0x31c1d4,_0x4645e9,_0x4de309,_0x22f2f6);}else{return{};}});});break;case _0xbf7c('0x55'):_0x340511[_0xbf7c('0x4f')]='https://www.zohoapis.'+_0x38e51e+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4645e9+'))';return getZohoUser(_0x340511,'Contacts')[_0xbf7c('0x2b')](function(_0x1ea6ce){if(_0x1ea6ce)return _0x1ea6ce;if(_0x22f2f6[_0xbf7c('0x44')]!='nothing'){return createEndUser(_0x3fb773,_0x38e51e,_0x31c1d4,_0x4645e9,_0x4de309,_0x22f2f6);}else{return{};}});break;case _0xbf7c('0x56'):_0x340511[_0xbf7c('0x4f')]='https://www.zohoapis.'+_0x38e51e+_0xbf7c('0x52')+_0x4645e9+'))';return getZohoUser(_0x340511,_0xbf7c('0x53'))[_0xbf7c('0x2b')](function(_0xc59d36){if(_0xc59d36)return _0xc59d36;if(_0x22f2f6[_0xbf7c('0x44')]!=_0xbf7c('0x54')){return createEndUser(_0x3fb773,_0x38e51e,_0x31c1d4,_0x4645e9,_0x4de309,_0x22f2f6);}else{return{};}});break;}}function getCall(_0x4695a8,_0x1c8e80,_0x149026,_0x4e3d9c,_0x4f9c0a,_0x5748d0,_0x4c32dd,_0xdc96a7){logger[_0xbf7c('0x38')]('Creating\x20new\x20call...');var _0x2dcb53={};_0x2dcb53['Owner']={'name':!_['isNil'](_0x4e3d9c['role'][_0xbf7c('0x1a')])&&!_['isNil'](_0x4e3d9c[_0xbf7c('0x3a')][_0xbf7c('0x1a')])&&_0x4e3d9c[_0xbf7c('0x3a')][_0xbf7c('0x1a')]===_0xbf7c('0x57')?_0x4e3d9c[_0xbf7c('0x45')][_0xbf7c('0x1a')]:!_[_0xbf7c('0x1d')](_0x4e3d9c[_0xbf7c('0x46')])?_0x4e3d9c[_0xbf7c('0x46')]+'\x20'+_0x4e3d9c['last_name']:_0x4e3d9c[_0xbf7c('0x47')],'id':_0x4e3d9c['id']};_0x2dcb53[_0xbf7c('0x58')]=intUtil[_0xbf7c('0x59')](_0x5748d0['Subjects'],_0x4c32dd,'\x20');_0x2dcb53['Description']=intUtil['getString'](_0x5748d0[_0xbf7c('0x5a')],_0x4c32dd,'\x0a');if(_0x4f9c0a[_0xbf7c('0x41')]===_0xbf7c('0x51')){_0x2dcb53[_0xbf7c('0x5b')]={'name':!_['isNil'](_0x4f9c0a[_0xbf7c('0x5c')])?_0x4f9c0a[_0xbf7c('0x5c')]:!_[_0xbf7c('0x1d')](_0x4f9c0a['First_Name'])?_0x4f9c0a[_0xbf7c('0x5d')]+'\x20'+_0x4f9c0a[_0xbf7c('0x5e')]:_0x4f9c0a[_0xbf7c('0x5e')],'id':_0x4f9c0a['id']};}if(_0x4f9c0a[_0xbf7c('0x41')]==='Leads'){_0x2dcb53[_0xbf7c('0x5f')]={'name':!_['isNil'](_0x4f9c0a[_0xbf7c('0x5c')])?_0x4f9c0a[_0xbf7c('0x5c')]:!_[_0xbf7c('0x1d')](_0x4f9c0a[_0xbf7c('0x5d')])?_0x4f9c0a[_0xbf7c('0x5d')]+'\x20'+_0x4f9c0a[_0xbf7c('0x5e')]:_0x4f9c0a[_0xbf7c('0x5e')],'id':_0x4f9c0a['id']};_0x2dcb53[_0xbf7c('0x60')]=_[_0xbf7c('0x43')](_0x4f9c0a[_0xbf7c('0x41')]);}if(_0x4c32dd['talktime']){_0x2dcb53[_0xbf7c('0x61')]=moment[_0xbf7c('0x62')](parseInt(_0x4c32dd['talktime'])*0x3e8)['format'](_0xbf7c('0x63'));}else if(_0x4c32dd[_0xbf7c('0x64')]&&_0x4c32dd['endtime']){_0x2dcb53[_0xbf7c('0x61')]=moment[_0xbf7c('0x62')](moment(_0x4c32dd[_0xbf7c('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0xbf7c('0x66')](moment(_0x4c32dd[_0xbf7c('0x67')],_0xbf7c('0x68'))))[_0xbf7c('0x32')](_0xbf7c('0x63'));}switch(_0x4c32dd['lastevent']){case _0xbf7c('0x69'):_0x2dcb53[_0xbf7c('0x6a')]=_0xbf7c('0x6b');break;case _0xbf7c('0x6c'):case _0xbf7c('0x6d'):_0x2dcb53['Call_Result']='Answered';break;case _0xbf7c('0x6e'):_0x2dcb53[_0xbf7c('0x6a')]='Rejected';break;case _0xbf7c('0x6f'):_0x2dcb53[_0xbf7c('0x6a')]=_0xbf7c('0x70');break;case _0xbf7c('0x71'):_0x2dcb53[_0xbf7c('0x6a')]=_0xbf7c('0x72');default:}_0x2dcb53[_0xbf7c('0x73')]=(_0xdc96a7===_0xbf7c('0x74')?moment(_0x4c32dd[_0xbf7c('0x67')])['format'](_0xbf7c('0x68')):moment(_0x4c32dd[_0xbf7c('0x75')])['format'](_0xbf7c('0x68')))||moment()['format'](_0xbf7c('0x68'));_0x2dcb53['Call_Type']=_0xdc96a7||_0xbf7c('0x76');_0x2dcb53=_[_0xbf7c('0x77')](_0x2dcb53,getCustomFields(_0x5748d0[_0xbf7c('0x78')],_0x4c32dd));return request({'method':_0xbf7c('0x26'),'uri':'https://www.zohoapis.'+_0x1c8e80+_0xbf7c('0x79'),'headers':{'Authorization':_0xbf7c('0x48')+_0x4695a8},'body':{'data':[_0x2dcb53]},'json':!![]})[_0xbf7c('0x2b')](function(_0x5b792f){if(_0x5b792f&&_0x5b792f['data'][0x0][_0xbf7c('0x49')]===_0xbf7c('0x4a')){logger[_0xbf7c('0x38')](_0xbf7c('0x7a'));return{'id':_0x5b792f[_0xbf7c('0x40')][0x0][_0xbf7c('0x7b')]['id']};}})[_0xbf7c('0x3f')](function(_0x3cd2e5){logger[_0xbf7c('0x38')]('err',_0x3cd2e5[_0xbf7c('0x30')]);console[_0xbf7c('0x7c')](_0xbf7c('0x7d'),_0x3cd2e5);});}exports[_0xbf7c('0x7e')]=function(_0x3979d9,_0x5cd52e,_0x2ae9ec,_0x4880cd,_0x29e8b9,_0xb2c1d6){var _0x2534b7,_0x1f0f07,_0x3f2d45;_0xb2c1d6[_0xbf7c('0x7f')]=intUtil['stripTrailingSlash'](_0xb2c1d6[_0xbf7c('0x7f')]);_0xb2c1d6[_0xbf7c('0x80')]=intUtil['stripTrailingSlash'](_0xb2c1d6['serverUrl']);if(_0x29e8b9&&_0x29e8b9['monitor_format']){logger['info'](_0xbf7c('0x81'),_0xbf7c('0x82'));_0x5cd52e[_0xbf7c('0x83')]=_0xb2c1d6[_0xbf7c('0x80')]+'/api/voice/recordings/'+_0x5cd52e[_0xbf7c('0x84')]+_0xbf7c('0x85')+md5(_0x5cd52e[_0xbf7c('0x84')]);}else{_0x5cd52e[_0xbf7c('0x83')]='';}var _0x4ae8f5=_0xb2c1d6[_0xbf7c('0x7f')]===_0xbf7c('0x86')?'eu':'com';return getAccessToken(_0xb2c1d6)[_0xbf7c('0x2b')](function(_0x42af6d){_0x3f2d45=_0x42af6d;return getUser(_0x3f2d45,_0x4ae8f5,_0xb2c1d6,_0x4880cd[_0xbf7c('0x87')]);})[_0xbf7c('0x2b')](function(_0x1e3fd4){_0x2534b7=_0x1e3fd4;logger[_0xbf7c('0x38')]('The\x20User\x20ID\x20is:',_0x2534b7['id']);return getEndUser(_0x3f2d45,_0x4ae8f5,_0xb2c1d6,_0x5cd52e['calleridname'],_0x5cd52e[_0xbf7c('0x88')],_0x2534b7,_0x2ae9ec);})['then'](function(_0x369b95){_0x1f0f07=_0x369b95;return getCall(_0x3f2d45,_0x4ae8f5,_0xb2c1d6,_0x2534b7,_0x1f0f07,_0x2ae9ec,_0x5cd52e,'Inbound');})['then'](function(_0xe77c63){if(_0xe77c63){logger[_0xbf7c('0x38')](_0xbf7c('0x89'),_0xe77c63['id']);logger[_0xbf7c('0x38')](_0xbf7c('0x81'),_0xbf7c('0x8a'));emit(util['format']('user:%s',_0x4880cd['name']),_0xbf7c('0x8b'),{'uri':'https://crm.'+_0xb2c1d6[_0xbf7c('0x7f')]+_0xbf7c('0x8c')+_0xe77c63['id']});}})[_0xbf7c('0x3f')](function(_0x163fc7){logger[_0xbf7c('0x2e')]('[QUEUE]',JSON['stringify'](_0x163fc7));});};exports[_0xbf7c('0x74')]=function(_0x10c383,_0x1533f1,_0x3c92df,_0x1e7ab9,_0x40b635,_0x2b7b3d,_0x351a23){var _0x4693f0,_0x49ed37,_0x41efbb;_0x2b7b3d['host']=intUtil['stripTrailingSlash'](_0x2b7b3d[_0xbf7c('0x7f')]);_0x2b7b3d['serverUrl']=intUtil[_0xbf7c('0x8d')](_0x2b7b3d[_0xbf7c('0x80')]);if(_0x351a23&&_0x351a23['recordingFormat']&&_0x351a23[_0xbf7c('0x8e')]!==_0xbf7c('0x8f')){logger[_0xbf7c('0x38')](_0xbf7c('0x90'),_0xbf7c('0x82'));_0x1533f1[_0xbf7c('0x83')]=_0x2b7b3d[_0xbf7c('0x80')]+_0xbf7c('0x91')+_0x1533f1[_0xbf7c('0x84')]+_0xbf7c('0x85')+md5(_0x1533f1[_0xbf7c('0x84')]);}var _0x57a92e=_0x2b7b3d[_0xbf7c('0x7f')]===_0xbf7c('0x86')?'eu':_0xbf7c('0x92');return getAccessToken(_0x2b7b3d)[_0xbf7c('0x2b')](function(_0x4e3829){_0x41efbb=_0x4e3829;return getUser(_0x41efbb,_0x57a92e,_0x2b7b3d,_0x1e7ab9['email']);})[_0xbf7c('0x2b')](function(_0x51bafe){_0x4693f0=_0x51bafe;logger[_0xbf7c('0x38')](_0xbf7c('0x93'),_0x4693f0['id']);return getEndUser(_0x41efbb,_0x57a92e,_0x2b7b3d,_0x1533f1[_0xbf7c('0x94')],_0x1533f1[_0xbf7c('0x95')],_0x4693f0,_0x3c92df);})[_0xbf7c('0x2b')](function(_0x37e663){_0x49ed37=_0x37e663;return getCall(_0x41efbb,_0x57a92e,_0x2b7b3d,_0x4693f0,_0x49ed37,_0x3c92df,_0x1533f1,_0xbf7c('0x96'));})[_0xbf7c('0x2b')](function(_0xbf8d0c){if(_0xbf8d0c){logger[_0xbf7c('0x38')](_0xbf7c('0x89'),_0xbf8d0c['id']);logger[_0xbf7c('0x38')](_0xbf7c('0x90'),_0xbf7c('0x8a'));emit(util[_0xbf7c('0x32')](_0xbf7c('0x97'),_0x1e7ab9['name']),_0xbf7c('0x8b'),{'uri':_0xbf7c('0x98')+_0x2b7b3d[_0xbf7c('0x7f')]+_0xbf7c('0x8c')+_0xbf8d0c['id']});}})['catch'](function(_0x2dd184){logger[_0xbf7c('0x2e')](_0xbf7c('0x90'),JSON['stringify'](_0x2dd184));});};exports[_0xbf7c('0x99')]=function(_0x3ade4f,_0x180767,_0x625c6,_0x380dd7,_0x194bb9,_0x263e05){var _0x94fe48,_0x471210,_0x57bcab;_0x263e05['host']=intUtil['stripTrailingSlash'](_0x263e05['host']);_0x263e05['serverUrl']=intUtil[_0xbf7c('0x8d')](_0x263e05[_0xbf7c('0x80')]);if(_0x194bb9&&_0x194bb9[_0xbf7c('0x9a')]){logger[_0xbf7c('0x38')]('['+_0x180767[_0xbf7c('0x9b')][_0xbf7c('0x9c')]()+']',_0xbf7c('0x82'));_0x180767[_0xbf7c('0x83')]=_0x263e05[_0xbf7c('0x80')]+_0xbf7c('0x91')+_0x180767[_0xbf7c('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x180767[_0xbf7c('0x84')]);}else{_0x180767[_0xbf7c('0x83')]='';}var _0x4c4126=_0x263e05[_0xbf7c('0x7f')]===_0xbf7c('0x86')?'eu':_0xbf7c('0x92');return getAccessToken(_0x263e05)[_0xbf7c('0x2b')](function(_0x24aca6){_0x57bcab=_0x24aca6;return getUser(_0x57bcab,_0x4c4126,_0x263e05);})['then'](function(_0x576afd){_0x94fe48=_0x576afd;logger[_0xbf7c('0x38')](_0xbf7c('0x93'),_0x94fe48['id']);return getEndUser(_0x57bcab,_0x4c4126,_0x263e05,_0x180767[_0xbf7c('0x9d')],_0x180767[_0xbf7c('0x88')],_0x94fe48,_0x625c6);})[_0xbf7c('0x2b')](function(_0x821490){_0x471210=_0x821490;return getCall(_0x57bcab,_0x4c4126,_0x263e05,_0x94fe48,_0x471210,_0x625c6,_0x180767,_0xbf7c('0x76'));})[_0xbf7c('0x2b')](function(_0x16dcf0){if(_0x16dcf0){logger[_0xbf7c('0x38')](_0xbf7c('0x89'),_0x16dcf0['id']);}})[_0xbf7c('0x3f')](function(_0x1bec10){logger['error']('['+_0x180767['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x1bec10));});}; \ 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 34f2943..dfc782d 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 _0x5e3b=['shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x5e3b,0x192));var _0xb5e3=function(_0x23d8e0,_0x403915){_0x23d8e0=_0x23d8e0-0x0;var _0x22cdf7=_0x5e3b[_0x23d8e0];return _0x22cdf7;};'use strict';var util=require(_0xb5e3('0x0'));var sh=require(_0xb5e3('0x1'));var Mustache=require(_0xb5e3('0x2'));var logger=require(_0xb5e3('0x3'))(_0xb5e3('0x4'));exports[_0xb5e3('0x5')]=function(_0x3bacec,_0x28ff95){var _0xf349bd=_0x3bacec[_0xb5e3('0x6')]?_0x3bacec[_0xb5e3('0x6')]:_0xb5e3('0x7');var _0x5ec243=_0x3bacec[_0xb5e3('0x8')]?Mustache['render'](_0x3bacec[_0xb5e3('0x8')],_0x28ff95):_0x28ff95;sh[_0xb5e3('0x5')](_0x5ec243,function(_0x18b7ef,_0x15dfbd,_0x1db4de){if(_0x18b7ef!==0x0){logger[_0xb5e3('0x9')](util['format'](_0xb5e3('0xa'),_0xf349bd,_0x5ec243,_0x18b7ef,_0x1db4de));}else{logger['info'](util[_0xb5e3('0xb')](_0xb5e3('0xc'),_0xf349bd,_0x5ec243,_0x15dfbd));}});}; \ No newline at end of file +var _0xa32c=['data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x30604b,_0x1c9f43){var _0x7ce510=function(_0x2c02e5){while(--_0x2c02e5){_0x30604b['push'](_0x30604b['shift']());}};_0x7ce510(++_0x1c9f43);}(_0xa32c,0xad));var _0xca32=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa32c[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0xca32('0x0'));var sh=require(_0xca32('0x1'));var Mustache=require(_0xca32('0x2'));var logger=require(_0xca32('0x3'))(_0xca32('0x4'));exports[_0xca32('0x5')]=function(_0x4dbb5c,_0x26d64e){var _0xeab992=_0x4dbb5c[_0xca32('0x6')]?_0x4dbb5c[_0xca32('0x6')]:'Script';var _0xfa3991=_0x4dbb5c[_0xca32('0x7')]?Mustache['render'](_0x4dbb5c['data3'],_0x26d64e):_0x26d64e;sh[_0xca32('0x5')](_0xfa3991,function(_0x22a0b9,_0x2e5179,_0x310ec7){if(_0x22a0b9!==0x0){logger[_0xca32('0x8')](util[_0xca32('0x9')](_0xca32('0xa'),_0xeab992,_0xfa3991,_0x22a0b9,_0x310ec7));}else{logger['info'](util['format'](_0xca32('0xb'),_0xeab992,_0xfa3991,_0x2e5179));}});}; \ 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 803f8f1..5820fce 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 _0x7a2d=['%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','catch','format','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','util','../../../../config/logger','trigger','exec','data2','data5','number','headers','data6','parse','stack','data1','toUpperCase','GET','DELETE','render','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7a2d,0xa5));var _0xd7a2=function(_0x9a7844,_0x326e41){_0x9a7844=_0x9a7844-0x0;var _0x317b09=_0x7a2d[_0x9a7844];return _0x317b09;};'use strict';var rp=require('request-promise');var util=require(_0xd7a2('0x0'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0xd7a2('0x1'))(_0xd7a2('0x2'));exports[_0xd7a2('0x3')]=function(_0x56de62,_0x3eeec8){var _0x5a53ab,_0x538f57;var _0x5c2e3e={'method':_0x56de62['data1']['toUpperCase'](),'uri':Mustache['render'](_0x56de62[_0xd7a2('0x4')],_0x3eeec8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x56de62[_0xd7a2('0x5')])===_0xd7a2('0x6')&&parseInt(_0x56de62[_0xd7a2('0x5')])>=0x1&&parseInt(_0x56de62[_0xd7a2('0x5')])<=0xa?parseInt(_0x56de62[_0xd7a2('0x5')])*0x3e8:0x5*0x3e8};try{_0x5c2e3e[_0xd7a2('0x7')]=_0x56de62[_0xd7a2('0x8')]?JSON[_0xd7a2('0x9')](Mustache['render'](_0x56de62[_0xd7a2('0x8')],_0x3eeec8)):{};}catch(_0x4a82dd){logger['error'](_0x4a82dd[_0xd7a2('0xa')]);}switch(_0x56de62[_0xd7a2('0xb')][_0xd7a2('0xc')]()){case _0xd7a2('0xd'):case _0xd7a2('0xe'):_0x5a53ab=null;_0x5c2e3e['qs']=_0x3eeec8;break;case'POST':case'PUT':if(_0x56de62['data7']){try{_0x5a53ab=JSON['parse'](Mustache[_0xd7a2('0xf')](_0x56de62[_0xd7a2('0x10')],_0x3eeec8));_0x5c2e3e[_0xd7a2('0x11')]=_0x5a53ab;}catch(_0x48f758){logger[_0xd7a2('0x12')](_0x48f758['stack']);logger['error'](_0xd7a2('0x13'));}}else{_0x5a53ab=_0x3eeec8;_0x5c2e3e[_0xd7a2('0x11')]=_0x5a53ab;}break;}logger[_0xd7a2('0x14')](util['format'](_0xd7a2('0x15'),_0x56de62[_0xd7a2('0xb')],_0x56de62[_0xd7a2('0x4')],JSON[_0xd7a2('0x16')](_0x5c2e3e)));rp(_0x5c2e3e)['then'](function(_0x58d4f5){_0x5a53ab=!_[_0xd7a2('0x17')](_0x5a53ab)?',\x20request\x20body:\x20'+_0x5a53ab:'';_0x538f57=typeof _0x58d4f5['body']===_0xd7a2('0x18')?JSON[_0xd7a2('0x16')](_0x58d4f5[_0xd7a2('0x11')]):_0x58d4f5[_0xd7a2('0x11')];logger[_0xd7a2('0x14')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x56de62[_0xd7a2('0xb')],_0x56de62[_0xd7a2('0x4')],_0x58d4f5['statusCode'],_0x538f57));})[_0xd7a2('0x19')](function(_0x4290ab){logger[_0xd7a2('0x12')](util[_0xd7a2('0x1a')](_0xd7a2('0x1b'),_0x56de62['data1'],_0x56de62[_0xd7a2('0x4')],_0x4290ab[_0xd7a2('0x1c')],_0x4290ab[_0xd7a2('0x1d')],_0x4290ab[_0xd7a2('0x1e')]));});}; \ No newline at end of file +var _0x357a=['object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger','toUpperCase','data2','data5','headers','data6','parse','render','error','stack','data1','POST','PUT','data7','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify',',\x20request\x20body:\x20','body'];(function(_0x476b8a,_0x1bceec){var _0x55f2f8=function(_0x37c431){while(--_0x37c431){_0x476b8a['push'](_0x476b8a['shift']());}};_0x55f2f8(++_0x1bceec);}(_0x357a,0xe1));var _0xa357=function(_0x37c40c,_0x25ce65){_0x37c40c=_0x37c40c-0x0;var _0x18c9db=_0x357a[_0x37c40c];return _0x18c9db;};'use strict';var rp=require(_0xa357('0x0'));var util=require(_0xa357('0x1'));var _=require('lodash');var Mustache=require(_0xa357('0x2'));var logger=require(_0xa357('0x3'))(_0xa357('0x4'));exports['exec']=function(_0x5afcb8,_0x2c5d54){var _0x593797,_0x67602e;var _0x34810e={'method':_0x5afcb8['data1'][_0xa357('0x5')](),'uri':Mustache['render'](_0x5afcb8[_0xa357('0x6')],_0x2c5d54),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5afcb8[_0xa357('0x7')])==='number'&&parseInt(_0x5afcb8['data5'])>=0x1&&parseInt(_0x5afcb8['data5'])<=0xa?parseInt(_0x5afcb8[_0xa357('0x7')])*0x3e8:0x5*0x3e8};try{_0x34810e[_0xa357('0x8')]=_0x5afcb8[_0xa357('0x9')]?JSON[_0xa357('0xa')](Mustache[_0xa357('0xb')](_0x5afcb8[_0xa357('0x9')],_0x2c5d54)):{};}catch(_0x53fc57){logger[_0xa357('0xc')](_0x53fc57[_0xa357('0xd')]);}switch(_0x5afcb8[_0xa357('0xe')]['toUpperCase']()){case'GET':case'DELETE':_0x593797=null;_0x34810e['qs']=_0x2c5d54;break;case _0xa357('0xf'):case _0xa357('0x10'):if(_0x5afcb8[_0xa357('0x11')]){try{_0x593797=JSON[_0xa357('0xa')](Mustache[_0xa357('0xb')](_0x5afcb8[_0xa357('0x11')],_0x2c5d54));_0x34810e['body']=_0x593797;}catch(_0x3d5804){logger[_0xa357('0xc')](_0x3d5804[_0xa357('0xd')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x593797=_0x2c5d54;_0x34810e['body']=_0x593797;}break;}logger['info'](util[_0xa357('0x12')](_0xa357('0x13'),_0x5afcb8[_0xa357('0xe')],_0x5afcb8[_0xa357('0x6')],JSON[_0xa357('0x14')](_0x34810e)));rp(_0x34810e)['then'](function(_0x32e5b3){_0x593797=!_['isNil'](_0x593797)?_0xa357('0x15')+_0x593797:'';_0x67602e=typeof _0x32e5b3[_0xa357('0x16')]===_0xa357('0x17')?JSON['stringify'](_0x32e5b3[_0xa357('0x16')]):_0x32e5b3[_0xa357('0x16')];logger[_0xa357('0x18')](util['format'](_0xa357('0x19'),_0x5afcb8[_0xa357('0xe')],_0x5afcb8['data2'],_0x32e5b3[_0xa357('0x1a')],_0x67602e));})[_0xa357('0x1b')](function(_0xccaf4b){logger[_0xa357('0xc')](util[_0xa357('0x12')](_0xa357('0x1c'),_0x5afcb8[_0xa357('0xe')],_0x5afcb8[_0xa357('0x6')],_0xccaf4b[_0xa357('0x1a')],_0xccaf4b[_0xa357('0x1d')],_0xccaf4b[_0xa357('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 4b47179..aaddc8d 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 _0x65fc=['request','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x317240,_0x3ab064){var _0x345875=function(_0x2d744b){while(--_0x2d744b){_0x317240['push'](_0x317240['shift']());}};_0x345875(++_0x3ab064);}(_0x65fc,0x1ac));var _0xc65f=function(_0x40b391,_0x3731e8){_0x40b391=_0x40b391-0x0;var _0x207a75=_0x65fc[_0x40b391];return _0x207a75;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc65f('0x0'));var logger=require(_0xc65f('0x1'))(_0xc65f('0x2'));var client=jayson[_0xc65f('0x3')][_0xc65f('0x4')]({'port':0x2329});client[_0xc65f('0x5')]=function(_0x3a2244,_0x191768){return new BPromise(function(_0x4bbc1b,_0x5c1731){return client[_0xc65f('0x6')](_0x3a2244,_0x191768)['then'](function(_0x395390){logger[_0xc65f('0x7')](_0xc65f('0x8'),_0xc65f('0x2'),_0x3a2244,_0x191768,_0x395390);if(_0x395390[_0xc65f('0x9')]){logger[_0xc65f('0x9')](_0xc65f('0x8'),_0xc65f('0x2'),_0x3a2244,_0x395390[_0xc65f('0x9')]['message'],_0x191768);return _0x5c1731(_0x395390[_0xc65f('0x9')][_0xc65f('0xa')]);}else{return _0x4bbc1b(_0x395390[_0xc65f('0xb')]);}})[_0xc65f('0xc')](function(_0x1914cc){logger[_0xc65f('0x9')](_0xc65f('0x8'),_0xc65f('0x2'),_0x3a2244,_0x1914cc,_0x191768);return _0x5c1731(_0x1914cc);});});};module[_0xc65f('0xd')]=client; \ No newline at end of file +var _0xd2d6=['routing','http','Request','request','debug','rpc','error','message','exports','../../config/logger'];(function(_0x32cbba,_0x4d537e){var _0x268e9d=function(_0x46aa11){while(--_0x46aa11){_0x32cbba['push'](_0x32cbba['shift']());}};_0x268e9d(++_0x4d537e);}(_0xd2d6,0x103));var _0x6d2d=function(_0x1eebbb,_0x245675){_0x1eebbb=_0x1eebbb-0x0;var _0x70be1a=_0xd2d6[_0x1eebbb];return _0x70be1a;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x6d2d('0x0'))(_0x6d2d('0x1'));var client=jayson['client'][_0x6d2d('0x2')]({'port':0x2329});client[_0x6d2d('0x3')]=function(_0x24a376,_0x62284f){return new BPromise(function(_0x28839b,_0x5f2518){return client[_0x6d2d('0x4')](_0x24a376,_0x62284f)['then'](function(_0x199f82){logger[_0x6d2d('0x5')](_0x6d2d('0x6'),_0x6d2d('0x1'),_0x24a376,_0x62284f,_0x199f82);if(_0x199f82[_0x6d2d('0x7')]){logger['error'](_0x6d2d('0x6'),_0x6d2d('0x1'),_0x24a376,_0x199f82[_0x6d2d('0x7')]['message'],_0x62284f);return _0x5f2518(_0x199f82['error'][_0x6d2d('0x8')]);}else{return _0x28839b(_0x199f82['result']);}})['catch'](function(_0x374082){logger[_0x6d2d('0x7')](_0x6d2d('0x6'),_0x6d2d('0x1'),_0x24a376,_0x374082,_0x62284f);return _0x5f2518(_0x374082);});});};module[_0x6d2d('0x9')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2fcd653..6e5e8d4 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 _0x9e42=['resolve','getMailAccounts','then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','./server','./rpc/mailAccount','./rpc/setting'];(function(_0x13adc7,_0x4c8860){var _0x560be5=function(_0x4f3073){while(--_0x4f3073){_0x13adc7['push'](_0x13adc7['shift']());}};_0x560be5(++_0x4c8860);}(_0x9e42,0x169));var _0x29e4=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0x9e42[_0x114b7c];return _0x47185f;};'use strict';var BPromise=require('bluebird');var server=require(_0x29e4('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x29e4('0x1'));var setting=require(_0x29e4('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x29e4('0x3')]()['then'](mailAccount[_0x29e4('0x4')]())['then'](realtime['initMailAccounts']())[_0x29e4('0x5')](function(){email[_0x29e4('0x6')](realtime[_0x29e4('0x7')]);return realtime;});}function main(){return server[_0x29e4('0x8')](realtime,email)[_0x29e4('0x5')](function(){return initRealtime();})[_0x29e4('0x5')](function(){return setting[_0x29e4('0x9')]();})[_0x29e4('0x5')](function(_0x2ee96c){return setInterval(initRealtime,_0x2ee96c[_0x29e4('0xa')]*0x3e8);})[_0x29e4('0xb')](function(_0x2944ba){console[_0x29e4('0xc')](_0x2944ba);});}main(); \ No newline at end of file +var _0x9e6d=['refresh','getSettings','loginMailFrequency','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x203e50,_0xfc65e0){_0x203e50=_0x203e50-0x0;var _0x3329ba=_0x9e6d[_0x203e50];return _0x3329ba;};'use strict';var BPromise=require(_0xd9e6('0x0'));var server=require('./server');var Realtime=require(_0xd9e6('0x1'));var EmailChannel=require(_0xd9e6('0x2'));var mailAccount=require(_0xd9e6('0x3'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xd9e6('0x4')]()[_0xd9e6('0x5')](mailAccount[_0xd9e6('0x6')]())[_0xd9e6('0x5')](realtime['initMailAccounts']())[_0xd9e6('0x5')](function(){email[_0xd9e6('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0xd9e6('0x5')](function(){return initRealtime();})[_0xd9e6('0x5')](function(){return setting[_0xd9e6('0x8')]();})['then'](function(_0x3f6229){return setInterval(initRealtime,_0x3f6229[_0xd9e6('0x9')]*0x3e8);})['catch'](function(_0x6430c2){console[_0xd9e6('0xa')](_0x6430c2);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 026e2d5..10e5521 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 _0xb8d7=['./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','status','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap'];(function(_0x23d33f,_0x5a8113){var _0x3459a6=function(_0x271544){while(--_0x271544){_0x23d33f['push'](_0x23d33f['shift']());}};_0x3459a6(++_0x5a8113);}(_0xb8d7,0xd2));var _0x7b8d=function(_0x432075,_0x308bed){_0x432075=_0x432075-0x0;var _0x575582=_0xb8d7[_0x432075];return _0x575582;};'use strict';var _=require(_0x7b8d('0x0'));var moment=require(_0x7b8d('0x1'));var BPromise=require(_0x7b8d('0x2'));var md5=require(_0x7b8d('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x7b8d('0x4'))(_0x7b8d('0x5'));config[_0x7b8d('0x6')]=_['defaults'](config[_0x7b8d('0x6')],{'host':_0x7b8d('0x7'),'port':0x18eb});var io=require(_0x7b8d('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x7b8d('0x9'));var EmailSmtp=require(_0x7b8d('0xa'));var mailAccount=require(_0x7b8d('0xb'));var md5Accounts={};function EmailChannel(_0x3c99a3){logger[_0x7b8d('0xc')](_0x7b8d('0xd'));this['mailAccounts']=_0x3c99a3[_0x7b8d('0xe')];this[_0x7b8d('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7b8d('0x10')][_0x7b8d('0x11')]=function(_0x241359){var _0x31a04f=this[_0x7b8d('0xe')][_0x241359];var _0x5368ad={'id':_0x31a04f['id'],'name':_0x31a04f['name'],'key':_0x31a04f['key'],'active':_0x31a04f['active'],'Imap':{'status':_0x31a04f[_0x7b8d('0x12')]['status'],'messageStatus':_0x31a04f[_0x7b8d('0x12')][_0x7b8d('0x13')],'total':_0x31a04f[_0x7b8d('0x12')][_0x7b8d('0x14')]}};if(_[_0x7b8d('0x15')](md5Accounts[_0x241359])){md5Accounts[_0x241359]={};}var _0x292db5=md5(JSON[_0x7b8d('0x16')](_0x5368ad));if(md5Accounts[_0x241359]['md5']!==_0x292db5){md5Accounts[_0x241359][_0x7b8d('0x3')]=_0x292db5;io['emit'](_0x7b8d('0x17'),_0x5368ad);}};EmailChannel[_0x7b8d('0x10')][_0x7b8d('0x18')]=function(_0x586fbb){for(var _0x156fec in _0x586fbb){if(_0x586fbb[_0x7b8d('0x19')](_0x156fec)){if(_0x586fbb[_0x156fec][_0x7b8d('0x12')]&&_0x586fbb[_0x156fec][_0x7b8d('0x1a')]){var _0x3edc1a=_0x586fbb[_0x156fec][_0x7b8d('0x12')];if(!this[_0x7b8d('0xf')][_0x7b8d('0x19')](_0x3edc1a['id'])){this[_0x7b8d('0xf')][_0x3edc1a['id']]=new EmailImap(_0x3edc1a,_0x586fbb[_0x156fec][_0x7b8d('0x5')]);this['imapAccounts'][_0x3edc1a['id']]['on'](_0x7b8d('0x1b'),this[_0x7b8d('0x1c')][_0x7b8d('0x1d')](this,_0x156fec));this[_0x7b8d('0xf')][_0x3edc1a['id']]['on'](_0x7b8d('0x5'),this[_0x7b8d('0x1e')][_0x7b8d('0x1d')](this,_0x156fec));this[_0x7b8d('0xf')][_0x3edc1a['id']]['on'](_0x7b8d('0x1f'),this[_0x7b8d('0x20')][_0x7b8d('0x1d')](this,_0x156fec));this[_0x7b8d('0xf')][_0x3edc1a['id']]['on'](_0x7b8d('0x21'),this[_0x7b8d('0x22')][_0x7b8d('0x1d')](this,_0x156fec));}}else{if(_[_0x7b8d('0x15')](this['mailAccounts'][_0x156fec][_0x7b8d('0x12')])){this['mailAccounts'][_0x156fec]['Imap']={};}this[_0x7b8d('0xe')][_0x156fec][_0x7b8d('0x12')]['status']=_0x7b8d('0x23');this[_0x7b8d('0xe')][_0x156fec]['Imap'][_0x7b8d('0x13')]='';this[_0x7b8d('0x11')](_0x156fec);}}}};EmailChannel[_0x7b8d('0x10')][_0x7b8d('0x1c')]=function(_0x2c9560,_0x2c6fa9){if(this[_0x7b8d('0xe')][_0x2c9560]){this[_0x7b8d('0xe')][_0x2c9560][_0x7b8d('0x12')][_0x7b8d('0x24')]=_0x7b8d('0x25');this[_0x7b8d('0xe')][_0x2c9560][_0x7b8d('0x12')][_0x7b8d('0x13')]=_0x2c6fa9[_0x7b8d('0x26')];if(_0x2c6fa9[_0x7b8d('0x27')]){this[_0x7b8d('0xe')][_0x2c9560]['Imap']['total']=_0x2c6fa9[_0x7b8d('0x27')][_0x7b8d('0x14')];}return this[_0x7b8d('0x11')](_0x2c9560);}};EmailChannel[_0x7b8d('0x10')]['handleImapEmail']=function(_0xf3772c,_0x56126d){logger['info'](_0x7b8d('0x28'),_0x56126d[_0x7b8d('0x29')],_0x56126d[_0x7b8d('0x2a')],_0x56126d['from'],_0xf3772c);if(this['mailAccounts'][_0xf3772c]){return mailAccount['notify'](_0xf3772c,_0x56126d)[_0x7b8d('0x2b')](function(_0x2fb968){if(_0x2fb968){logger['info'](_0x7b8d('0x2c'));}})[_0x7b8d('0x2d')](function(_0x597364){logger[_0x7b8d('0x21')](_0x7b8d('0x2e'),JSON[_0x7b8d('0x16')](_0x597364));});}};EmailChannel[_0x7b8d('0x10')][_0x7b8d('0x20')]=function(_0x44a43d){if(this[_0x7b8d('0xe')][_0x44a43d]&&this['mailAccounts'][_0x44a43d][_0x7b8d('0x12')]){if(this[_0x7b8d('0xf')][this[_0x7b8d('0xe')][_0x44a43d][_0x7b8d('0x12')]['id']]){delete this[_0x7b8d('0xf')][this[_0x7b8d('0xe')][_0x44a43d][_0x7b8d('0x12')]['id']];}this['mailAccounts'][_0x44a43d][_0x7b8d('0x12')][_0x7b8d('0x2f')]=moment();this[_0x7b8d('0x11')](_0x44a43d);}};EmailChannel[_0x7b8d('0x10')][_0x7b8d('0x22')]=function(_0x288880,_0x589f2b){if(this[_0x7b8d('0xe')][_0x288880]){this['mailAccounts'][_0x288880][_0x7b8d('0x12')][_0x7b8d('0x24')]=_0x7b8d('0x21');this[_0x7b8d('0xe')][_0x288880]['Imap'][_0x7b8d('0x13')]=_0x589f2b;return this[_0x7b8d('0x11')](_0x288880);}};EmailChannel[_0x7b8d('0x10')]['sendMail']=function(_0x1b387d,_0x3fac75){return this[_0x7b8d('0x30')][_0x7b8d('0x31')](_0x1b387d,_0x3fac75);};EmailChannel['prototype'][_0x7b8d('0x32')]=function(_0x2f3936){var _0xdc98b=this;if(this[_0x7b8d('0xe')][_0x2f3936['id']]){if(_[_0x7b8d('0x15')](this[_0x7b8d('0xe')][_0x2f3936['id']][_0x7b8d('0x33')])){this[_0x7b8d('0xe')][_0x2f3936['id']][_0x7b8d('0x33')]={};}this[_0x7b8d('0xe')][_0x2f3936['id']][_0x7b8d('0x33')][_0x7b8d('0x2f')]=moment();return new BPromise(function(_0xb5410c,_0x34a512){return _0xdc98b[_0x7b8d('0x30')][_0x7b8d('0x34')](_0x2f3936)[_0x7b8d('0x2b')](function(_0x59650b){_0xdc98b[_0x7b8d('0xe')][_0x2f3936['id']][_0x7b8d('0x33')][_0x7b8d('0x24')]=_0x7b8d('0x35');_0xdc98b[_0x7b8d('0xe')][_0x2f3936['id']][_0x7b8d('0x33')][_0x7b8d('0x13')]='';_0xdc98b[_0x7b8d('0x11')](_0x2f3936['id']);_0xb5410c(_0x59650b);})['catch'](function(_0x391224){_0xdc98b['mailAccounts'][_0x2f3936['id']]['Smtp']['status']=_0x7b8d('0x21');_0xdc98b[_0x7b8d('0xe')][_0x2f3936['id']][_0x7b8d('0x33')][_0x7b8d('0x13')]=_0x391224;_0xdc98b[_0x7b8d('0x11')](_0x2f3936['id']);_0x34a512(_0x391224);});});}return this[_0x7b8d('0x30')][_0x7b8d('0x34')](_0x2f3936);};module[_0x7b8d('0x36')]=EmailChannel; \ No newline at end of file +var _0x9fa7=['active','Imap','total','isNil','mailAccount:update','prototype','refresh','hasOwnProperty','box','bind','handleImapEmail','end','error','handleImapError','status','disabled','messageStatus','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify','then','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd','lastSync','send','verifySmtp','Smtp','verified','verify','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','emit','name','key'];(function(_0x57a489,_0x189abc){var _0x1988a7=function(_0x2e9e03){while(--_0x2e9e03){_0x57a489['push'](_0x57a489['shift']());}};_0x1988a7(++_0x189abc);}(_0x9fa7,0xf2));var _0x79fa=function(_0x145eeb,_0x46819a){_0x145eeb=_0x145eeb-0x0;var _0x250d77=_0x9fa7[_0x145eeb];return _0x250d77;};'use strict';var _=require(_0x79fa('0x0'));var moment=require(_0x79fa('0x1'));var BPromise=require('bluebird');var md5=require(_0x79fa('0x2'));var Redis=require(_0x79fa('0x3'));var config=require(_0x79fa('0x4'));var logger=require(_0x79fa('0x5'))('email');config[_0x79fa('0x6')]=_['defaults'](config[_0x79fa('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x79fa('0x7'))(new Redis(config['redis']));var EmailImap=require(_0x79fa('0x8'));var EmailSmtp=require(_0x79fa('0x9'));var mailAccount=require(_0x79fa('0xa'));var md5Accounts={};function EmailChannel(_0x319343){logger[_0x79fa('0xb')]('start\x20email\x20channel');this[_0x79fa('0xc')]=_0x319343['mailAccounts'];this[_0x79fa('0xd')]={};this[_0x79fa('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x79fa('0xf')]=function(_0x4ff67c){var _0x45ef48=this[_0x79fa('0xc')][_0x4ff67c];var _0x619e96={'id':_0x45ef48['id'],'name':_0x45ef48[_0x79fa('0x10')],'key':_0x45ef48[_0x79fa('0x11')],'active':_0x45ef48[_0x79fa('0x12')],'Imap':{'status':_0x45ef48['Imap']['status'],'messageStatus':_0x45ef48[_0x79fa('0x13')]['messageStatus'],'total':_0x45ef48[_0x79fa('0x13')][_0x79fa('0x14')]}};if(_[_0x79fa('0x15')](md5Accounts[_0x4ff67c])){md5Accounts[_0x4ff67c]={};}var _0x46d331=md5(JSON['stringify'](_0x619e96));if(md5Accounts[_0x4ff67c][_0x79fa('0x2')]!==_0x46d331){md5Accounts[_0x4ff67c][_0x79fa('0x2')]=_0x46d331;io[_0x79fa('0xf')](_0x79fa('0x16'),_0x619e96);}};EmailChannel[_0x79fa('0x17')][_0x79fa('0x18')]=function(_0x3de7d4){for(var _0x1b45ef in _0x3de7d4){if(_0x3de7d4[_0x79fa('0x19')](_0x1b45ef)){if(_0x3de7d4[_0x1b45ef][_0x79fa('0x13')]&&_0x3de7d4[_0x1b45ef][_0x79fa('0x12')]){var _0x389344=_0x3de7d4[_0x1b45ef]['Imap'];if(!this[_0x79fa('0xd')][_0x79fa('0x19')](_0x389344['id'])){this['imapAccounts'][_0x389344['id']]=new EmailImap(_0x389344,_0x3de7d4[_0x1b45ef]['email']);this['imapAccounts'][_0x389344['id']]['on'](_0x79fa('0x1a'),this['handleImapBox'][_0x79fa('0x1b')](this,_0x1b45ef));this[_0x79fa('0xd')][_0x389344['id']]['on']('email',this[_0x79fa('0x1c')][_0x79fa('0x1b')](this,_0x1b45ef));this[_0x79fa('0xd')][_0x389344['id']]['on'](_0x79fa('0x1d'),this['handleImapEnd'][_0x79fa('0x1b')](this,_0x1b45ef));this[_0x79fa('0xd')][_0x389344['id']]['on'](_0x79fa('0x1e'),this[_0x79fa('0x1f')][_0x79fa('0x1b')](this,_0x1b45ef));}}else{if(_['isNil'](this[_0x79fa('0xc')][_0x1b45ef][_0x79fa('0x13')])){this['mailAccounts'][_0x1b45ef]['Imap']={};}this[_0x79fa('0xc')][_0x1b45ef][_0x79fa('0x13')][_0x79fa('0x20')]=_0x79fa('0x21');this[_0x79fa('0xc')][_0x1b45ef][_0x79fa('0x13')][_0x79fa('0x22')]='';this[_0x79fa('0xf')](_0x1b45ef);}}}};EmailChannel[_0x79fa('0x17')][_0x79fa('0x23')]=function(_0x177995,_0x6b7abf){if(this[_0x79fa('0xc')][_0x177995]){this[_0x79fa('0xc')][_0x177995][_0x79fa('0x13')][_0x79fa('0x20')]=_0x79fa('0x24');this['mailAccounts'][_0x177995]['Imap'][_0x79fa('0x22')]=_0x6b7abf['name'];if(_0x6b7abf['messages']){this[_0x79fa('0xc')][_0x177995][_0x79fa('0x13')][_0x79fa('0x14')]=_0x6b7abf[_0x79fa('0x25')][_0x79fa('0x14')];}return this['emit'](_0x177995);}};EmailChannel[_0x79fa('0x17')]['handleImapEmail']=function(_0x2fb4aa,_0x5986dc){logger[_0x79fa('0xb')](_0x79fa('0x26'),_0x5986dc[_0x79fa('0x27')],_0x5986dc['lastName'],_0x5986dc['from'],_0x2fb4aa);if(this[_0x79fa('0xc')][_0x2fb4aa]){return mailAccount[_0x79fa('0x28')](_0x2fb4aa,_0x5986dc)[_0x79fa('0x29')](function(_0x44118b){if(_0x44118b){logger['info'](_0x79fa('0x2a'));}})[_0x79fa('0x2b')](function(_0x5aa17e){logger[_0x79fa('0x1e')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x5aa17e));});}};EmailChannel[_0x79fa('0x17')][_0x79fa('0x2c')]=function(_0x241999){if(this['mailAccounts'][_0x241999]&&this[_0x79fa('0xc')][_0x241999][_0x79fa('0x13')]){if(this[_0x79fa('0xd')][this[_0x79fa('0xc')][_0x241999][_0x79fa('0x13')]['id']]){delete this[_0x79fa('0xd')][this[_0x79fa('0xc')][_0x241999]['Imap']['id']];}this[_0x79fa('0xc')][_0x241999][_0x79fa('0x13')][_0x79fa('0x2d')]=moment();this[_0x79fa('0xf')](_0x241999);}};EmailChannel[_0x79fa('0x17')][_0x79fa('0x1f')]=function(_0x1b0580,_0x2f6b11){if(this[_0x79fa('0xc')][_0x1b0580]){this[_0x79fa('0xc')][_0x1b0580][_0x79fa('0x13')][_0x79fa('0x20')]=_0x79fa('0x1e');this['mailAccounts'][_0x1b0580][_0x79fa('0x13')][_0x79fa('0x22')]=_0x2f6b11;return this[_0x79fa('0xf')](_0x1b0580);}};EmailChannel[_0x79fa('0x17')]['sendMail']=function(_0x151fb5,_0x427597){return this[_0x79fa('0xe')][_0x79fa('0x2e')](_0x151fb5,_0x427597);};EmailChannel[_0x79fa('0x17')][_0x79fa('0x2f')]=function(_0x1b2d6a){var _0x1baab7=this;if(this['mailAccounts'][_0x1b2d6a['id']]){if(_[_0x79fa('0x15')](this[_0x79fa('0xc')][_0x1b2d6a['id']][_0x79fa('0x30')])){this[_0x79fa('0xc')][_0x1b2d6a['id']][_0x79fa('0x30')]={};}this[_0x79fa('0xc')][_0x1b2d6a['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x53c884,_0x163bab){return _0x1baab7[_0x79fa('0xe')]['verify'](_0x1b2d6a)[_0x79fa('0x29')](function(_0xce09a){_0x1baab7[_0x79fa('0xc')][_0x1b2d6a['id']]['Smtp'][_0x79fa('0x20')]=_0x79fa('0x31');_0x1baab7[_0x79fa('0xc')][_0x1b2d6a['id']][_0x79fa('0x30')]['messageStatus']='';_0x1baab7[_0x79fa('0xf')](_0x1b2d6a['id']);_0x53c884(_0xce09a);})['catch'](function(_0xdaa5b9){_0x1baab7[_0x79fa('0xc')][_0x1b2d6a['id']][_0x79fa('0x30')]['status']=_0x79fa('0x1e');_0x1baab7[_0x79fa('0xc')][_0x1b2d6a['id']]['Smtp'][_0x79fa('0x22')]=_0xdaa5b9;_0x1baab7['emit'](_0x1b2d6a['id']);_0x163bab(_0xdaa5b9);});});}return this[_0x79fa('0xe')][_0x79fa('0x32')](_0x1b2d6a);};module[_0x79fa('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 6b0eb6c..21f7b4e 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 _0x0f17=['upperFirst','exports','path','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','connect','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','getHost','service','email','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','handleFetchMessage','error','handleFetchEnd','closeBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchError','textCode','hasOwnProperty'];(function(_0xbb1d35,_0x1110d9){var _0x4cd03b=function(_0x512a4c){while(--_0x512a4c){_0xbb1d35['push'](_0xbb1d35['shift']());}};_0x4cd03b(++_0x1110d9);}(_0x0f17,0xb9));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x70f1('0x0'));var util=require(_0x70f1('0x1'));var Imap=require(_0x70f1('0x2'));var _=require(_0x70f1('0x3'));var rs=require('randomstring');var simpleParser=require(_0x70f1('0x4'))[_0x70f1('0x5')];var Iconv=require(_0x70f1('0x6'))[_0x70f1('0x7')];var EventEmitter=require(_0x70f1('0x8'))[_0x70f1('0x9')];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0xdc53c6,_0x497046){this[_0x70f1('0xa')]='INBOX';this[_0x70f1('0xb')]=this[_0x70f1('0xc')](_0xdc53c6,_0x497046);this[_0x70f1('0x2')]=new Imap(this['account']);this['imap']['once'](_0x70f1('0xd'),this[_0x70f1('0xe')][_0x70f1('0xf')](this));this[_0x70f1('0x2')][_0x70f1('0x10')](_0x70f1('0x11'),this[_0x70f1('0x12')][_0x70f1('0xf')](this));this[_0x70f1('0x2')]['on']('error',this[_0x70f1('0x13')]['bind'](this));this[_0x70f1('0x2')][_0x70f1('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x70f1('0x15')][_0x70f1('0xc')]=function(_0x4370f4,_0x868a99){var _0x17c508={'connTimeout':_0x4370f4['connTimeout']?_0x4370f4[_0x70f1('0x16')]*0x3e8:0x2710,'authTimeout':_0x4370f4[_0x70f1('0x17')]?_0x4370f4['authTimeout']*0x3e8:0x1388};if(_[_0x70f1('0x18')](_0x4370f4['service'])){if(_0x4370f4[_0x70f1('0x19')]){_0x17c508[_0x70f1('0x1a')]=_0x4370f4['user'];_0x17c508[_0x70f1('0x1b')]=_0x4370f4[_0x70f1('0x1b')];}_0x17c508['host']=_0x4370f4[_0x70f1('0x1c')];_0x17c508[_0x70f1('0x1d')]=_0x4370f4[_0x70f1('0x1d')]||0x3e1;if(_0x4370f4[_0x70f1('0x1e')]){_0x17c508[_0x70f1('0x1e')]=!![];}else{_0x17c508[_0x70f1('0x1e')]=![];_0x17c508[_0x70f1('0x1f')]=_0x70f1('0x20');}}else{_0x17c508[_0x70f1('0x1a')]=_0x4370f4['user'];_0x17c508[_0x70f1('0x1b')]=_0x4370f4[_0x70f1('0x1b')];_0x17c508[_0x70f1('0x1c')]=utils[_0x70f1('0x21')](_0x4370f4[_0x70f1('0x22')]);_0x17c508[_0x70f1('0x1d')]=0x3e1;_0x17c508[_0x70f1('0x1e')]=!![];}_0x17c508[_0x70f1('0x23')]=_0x868a99||_0x4370f4[_0x70f1('0x1a')]||_0x70f1('0x24');return _0x17c508;};EmailImap[_0x70f1('0x15')]['handleReady']=function(){this['imap'][_0x70f1('0x25')](this[_0x70f1('0xa')],![],this[_0x70f1('0x26')][_0x70f1('0xf')](this));};EmailImap[_0x70f1('0x15')][_0x70f1('0x26')]=function(_0x5b7735,_0x2831ad){if(_0x5b7735){this[_0x70f1('0x13')](_0x5b7735,!![]);}else{this[_0x70f1('0x27')](_0x70f1('0x28'),_0x2831ad);this[_0x70f1('0x29')]();}};EmailImap[_0x70f1('0x15')][_0x70f1('0x2a')]=function(_0x339aeb){if(_0x339aeb){this[_0x70f1('0x13')](_0x339aeb,!![]);}else{this['imap'][_0x70f1('0x11')]();}};EmailImap[_0x70f1('0x15')][_0x70f1('0x29')]=function(){this['imap']['search']([_0x70f1('0x2b')],this[_0x70f1('0x2c')]['bind'](this));};EmailImap[_0x70f1('0x15')][_0x70f1('0x2c')]=function(_0x34b793,_0x3ffcef){if(_0x34b793){this[_0x70f1('0x13')](_0x34b793,!![]);}else{if(_0x3ffcef[_0x70f1('0x2d')]){try{var _0x241e0b=this['imap']['fetch'](_0x3ffcef,{'bodies':'','markSeen':!![]});_0x241e0b['on']('message',this[_0x70f1('0x2e')][_0x70f1('0xf')](this));_0x241e0b[_0x70f1('0x10')](_0x70f1('0x2f'),this['handleFetchError'][_0x70f1('0xf')](this));_0x241e0b[_0x70f1('0x10')](_0x70f1('0x11'),this[_0x70f1('0x30')][_0x70f1('0xf')](this));}catch(_0x590b04){logger[_0x70f1('0x2f')](_0x590b04);}}else{this['imap'][_0x70f1('0x31')](!![],this[_0x70f1('0x2a')]['bind'](this));}}};EmailImap[_0x70f1('0x15')][_0x70f1('0x2e')]=function(_0x46da02,_0x2b63f2){_0x46da02['on'](_0x70f1('0x32'),this['handleMessageBody'][_0x70f1('0xf')](this));_0x46da02[_0x70f1('0x10')]('attributes',this[_0x70f1('0x33')]['bind'](this));_0x46da02[_0x70f1('0x10')](_0x70f1('0x11'),this[_0x70f1('0x34')][_0x70f1('0xf')](this));};EmailImap[_0x70f1('0x15')][_0x70f1('0x35')]=function(_0x542c2b,_0x5e52a7){simpleParser(_0x542c2b,{'Iconv':Iconv},this[_0x70f1('0x36')][_0x70f1('0xf')](this));};EmailImap[_0x70f1('0x15')][_0x70f1('0x33')]=function(_0x149d79){};EmailImap['prototype'][_0x70f1('0x34')]=function(){};EmailImap[_0x70f1('0x15')][_0x70f1('0x36')]=function(_0x291eda,_0x2bcfb2){if(_0x291eda){logger[_0x70f1('0x2f')](_0x291eda);}else{var _0x58858e=this;utils[_0x70f1('0x37')](this[_0x70f1('0xb')],_0x2bcfb2,function(_0x24dab8){_0x58858e[_0x70f1('0x27')](_0x70f1('0x23'),_0x24dab8);});}};EmailImap[_0x70f1('0x15')][_0x70f1('0x30')]=function(){this[_0x70f1('0x2')][_0x70f1('0x31')](!![],this['handleCloseBox'][_0x70f1('0xf')](this));};EmailImap[_0x70f1('0x15')][_0x70f1('0x38')]=function(_0x11bd47){this[_0x70f1('0x13')](_0x11bd47);this[_0x70f1('0x2')]['closeBox'](!![],this[_0x70f1('0x2a')][_0x70f1('0xf')](this));};EmailImap[_0x70f1('0x15')]['handleEnd']=function(){this[_0x70f1('0x27')](_0x70f1('0x11'));};EmailImap[_0x70f1('0x15')][_0x70f1('0x13')]=function(_0x9ed6ae,_0x24ba6d){logger[_0x70f1('0x2f')](_0x70f1('0x13'),this[_0x70f1('0xb')][_0x70f1('0x23')],JSON['stringify'](_0x9ed6ae));var _0x4c8056='';if(_0x9ed6ae){if(_0x9ed6ae[_0x70f1('0x39')]){_0x4c8056=_0x9ed6ae[_0x70f1('0x39')];}else{for(var _0x480555 in _0x9ed6ae){if(_0x9ed6ae[_0x70f1('0x3a')](_0x480555)){_0x4c8056+=_[_0x70f1('0x3b')](_0x480555)+':\x20'+_0x9ed6ae[_0x480555]+'\x0a';}}}}if(_0x24ba6d){this[_0x70f1('0x2')][_0x70f1('0x11')]();}else{this['emit']('error',_0x4c8056);this[_0x70f1('0x27')]('end');}};module[_0x70f1('0x3c')]=EmailImap; \ No newline at end of file +var _0x8e7b=['handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleError','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','mailbox','handleOpenBox','prototype','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8e7b,0xb2));var _0xb8e7=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x8e7b[_0x82129b];return _0x2ae5dc;};'use strict';var fs=require('fs');var path=require(_0xb8e7('0x0'));var util=require(_0xb8e7('0x1'));var Imap=require(_0xb8e7('0x2'));var _=require(_0xb8e7('0x3'));var rs=require(_0xb8e7('0x4'));var simpleParser=require('mailparser')[_0xb8e7('0x5')];var Iconv=require('iconv')[_0xb8e7('0x6')];var EventEmitter=require(_0xb8e7('0x7'))[_0xb8e7('0x8')];var utils=require('./utils');var logger=require(_0xb8e7('0x9'))(_0xb8e7('0xa'));function EmailImap(_0x268ef3,_0x3e54f0){this['mailbox']=_0xb8e7('0xb');this[_0xb8e7('0xc')]=this[_0xb8e7('0xd')](_0x268ef3,_0x3e54f0);this[_0xb8e7('0x2')]=new Imap(this[_0xb8e7('0xc')]);this['imap'][_0xb8e7('0xe')](_0xb8e7('0xf'),this[_0xb8e7('0x10')][_0xb8e7('0x11')](this));this[_0xb8e7('0x2')][_0xb8e7('0xe')](_0xb8e7('0x12'),this['handleEnd'][_0xb8e7('0x11')](this));this[_0xb8e7('0x2')]['on']('error',this[_0xb8e7('0x13')]['bind'](this));this[_0xb8e7('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xb8e7('0xd')]=function(_0x42be6f,_0x3fb457){var _0x20ff5e={'connTimeout':_0x42be6f['connTimeout']?_0x42be6f[_0xb8e7('0x14')]*0x3e8:0x2710,'authTimeout':_0x42be6f[_0xb8e7('0x15')]?_0x42be6f[_0xb8e7('0x15')]*0x3e8:0x1388};if(_[_0xb8e7('0x16')](_0x42be6f[_0xb8e7('0x17')])){if(_0x42be6f[_0xb8e7('0x18')]){_0x20ff5e[_0xb8e7('0x19')]=_0x42be6f[_0xb8e7('0x19')];_0x20ff5e[_0xb8e7('0x1a')]=_0x42be6f['password'];}_0x20ff5e[_0xb8e7('0x1b')]=_0x42be6f[_0xb8e7('0x1b')];_0x20ff5e[_0xb8e7('0x1c')]=_0x42be6f[_0xb8e7('0x1c')]||0x3e1;if(_0x42be6f[_0xb8e7('0x1d')]){_0x20ff5e['tls']=!![];}else{_0x20ff5e[_0xb8e7('0x1d')]=![];_0x20ff5e['autotls']=_0xb8e7('0x1e');}}else{_0x20ff5e[_0xb8e7('0x19')]=_0x42be6f['user'];_0x20ff5e['password']=_0x42be6f['password'];_0x20ff5e[_0xb8e7('0x1b')]=utils['getHost'](_0x42be6f[_0xb8e7('0x17')]);_0x20ff5e['port']=0x3e1;_0x20ff5e[_0xb8e7('0x1d')]=!![];}_0x20ff5e[_0xb8e7('0xa')]=_0x3fb457||_0x42be6f[_0xb8e7('0x19')]||'anonymous@xcally.com';return _0x20ff5e;};EmailImap['prototype'][_0xb8e7('0x10')]=function(){this[_0xb8e7('0x2')]['openBox'](this[_0xb8e7('0x1f')],![],this[_0xb8e7('0x20')][_0xb8e7('0x11')](this));};EmailImap[_0xb8e7('0x21')]['handleOpenBox']=function(_0x1862ff,_0x5a304e){if(_0x1862ff){this[_0xb8e7('0x13')](_0x1862ff,!![]);}else{this[_0xb8e7('0x22')](_0xb8e7('0x23'),_0x5a304e);this[_0xb8e7('0x24')]();}};EmailImap[_0xb8e7('0x21')]['handleCloseBox']=function(_0x15b316){if(_0x15b316){this[_0xb8e7('0x13')](_0x15b316,!![]);}else{this[_0xb8e7('0x2')][_0xb8e7('0x12')]();}};EmailImap[_0xb8e7('0x21')][_0xb8e7('0x24')]=function(){this['imap']['search']([_0xb8e7('0x25')],this['handleReadUnseen'][_0xb8e7('0x11')](this));};EmailImap[_0xb8e7('0x21')][_0xb8e7('0x26')]=function(_0x1d9c61,_0x34eee8){if(_0x1d9c61){this['handleError'](_0x1d9c61,!![]);}else{if(_0x34eee8[_0xb8e7('0x27')]){try{var _0x44c90c=this['imap'][_0xb8e7('0x28')](_0x34eee8,{'bodies':'','markSeen':!![]});_0x44c90c['on']('message',this[_0xb8e7('0x29')][_0xb8e7('0x11')](this));_0x44c90c[_0xb8e7('0xe')](_0xb8e7('0x2a'),this[_0xb8e7('0x2b')]['bind'](this));_0x44c90c[_0xb8e7('0xe')](_0xb8e7('0x12'),this[_0xb8e7('0x2c')][_0xb8e7('0x11')](this));}catch(_0x3ad56a){logger[_0xb8e7('0x2a')](_0x3ad56a);}}else{this[_0xb8e7('0x2')][_0xb8e7('0x2d')](!![],this[_0xb8e7('0x2e')]['bind'](this));}}};EmailImap[_0xb8e7('0x21')][_0xb8e7('0x29')]=function(_0x47afd9,_0x38bdc9){_0x47afd9['on'](_0xb8e7('0x2f'),this[_0xb8e7('0x30')][_0xb8e7('0x11')](this));_0x47afd9[_0xb8e7('0xe')](_0xb8e7('0x31'),this[_0xb8e7('0x32')]['bind'](this));_0x47afd9[_0xb8e7('0xe')]('end',this[_0xb8e7('0x33')]['bind'](this));};EmailImap[_0xb8e7('0x21')]['handleMessageBody']=function(_0x3ddff5,_0x315897){simpleParser(_0x3ddff5,{'Iconv':Iconv},this[_0xb8e7('0x34')][_0xb8e7('0x11')](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x38a605){};EmailImap[_0xb8e7('0x21')][_0xb8e7('0x33')]=function(){};EmailImap[_0xb8e7('0x21')][_0xb8e7('0x34')]=function(_0x37fc20,_0x2b903b){if(_0x37fc20){logger[_0xb8e7('0x2a')](_0x37fc20);}else{var _0x10c4bb=this;utils['parser'](this['account'],_0x2b903b,function(_0x460719){_0x10c4bb[_0xb8e7('0x22')](_0xb8e7('0xa'),_0x460719);});}};EmailImap[_0xb8e7('0x21')][_0xb8e7('0x2c')]=function(){this[_0xb8e7('0x2')][_0xb8e7('0x2d')](!![],this['handleCloseBox'][_0xb8e7('0x11')](this));};EmailImap[_0xb8e7('0x21')]['handleFetchError']=function(_0x2cb72d){this[_0xb8e7('0x13')](_0x2cb72d);this[_0xb8e7('0x2')][_0xb8e7('0x2d')](!![],this[_0xb8e7('0x2e')][_0xb8e7('0x11')](this));};EmailImap[_0xb8e7('0x21')]['handleEnd']=function(){this['emit'](_0xb8e7('0x12'));};EmailImap['prototype'][_0xb8e7('0x13')]=function(_0x23d629,_0x32cfb5){logger[_0xb8e7('0x2a')](_0xb8e7('0x13'),this[_0xb8e7('0xc')][_0xb8e7('0xa')],JSON[_0xb8e7('0x35')](_0x23d629));var _0x3a29b9='';if(_0x23d629){if(_0x23d629[_0xb8e7('0x36')]){_0x3a29b9=_0x23d629[_0xb8e7('0x36')];}else{for(var _0x254fbd in _0x23d629){if(_0x23d629[_0xb8e7('0x37')](_0x254fbd)){_0x3a29b9+=_['upperFirst'](_0x254fbd)+':\x20'+_0x23d629[_0x254fbd]+'\x0a';}}}}if(_0x32cfb5){this[_0xb8e7('0x2')][_0xb8e7('0x12')]();}else{this[_0xb8e7('0x22')](_0xb8e7('0x2a'),_0x3a29b9);this[_0xb8e7('0x22')]('end');}};module[_0xb8e7('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 29c6473..a6763a5 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 _0x4435=['use','compile','sendMail','verify','toString','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0x4435,0xde));var _0x5443=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x4435[_0x409353];return _0x4f4b59;};'use strict';var nodemailer=require(_0x5443('0x0'));var BPromise=require(_0x5443('0x1'));var inlineBase64=require(_0x5443('0x2'));function EmailSmtp(){}EmailSmtp[_0x5443('0x3')][_0x5443('0x4')]=function(_0xee66ec,_0x22b9d4){return new BPromise(function(_0x4a6f08,_0xed42ad){var _0x3b8104=nodemailer[_0x5443('0x5')](_0xee66ec);_0x3b8104[_0x5443('0x6')](_0x5443('0x7'),inlineBase64());_0x3b8104[_0x5443('0x8')](_0x22b9d4,function(_0x4df3f2,_0x25aa5e){if(_0x4df3f2){_0xed42ad(_0x4df3f2['toString']());}else{_0x4a6f08(_0x25aa5e);}});});};EmailSmtp[_0x5443('0x3')]['verify']=function(_0x46b79f){return new BPromise(function(_0x4de434,_0x37c118){var _0x13d469=nodemailer[_0x5443('0x5')](_0x46b79f);_0x13d469[_0x5443('0x9')](function(_0x417d58,_0x1e1214){if(_0x417d58){_0x37c118(_0x417d58[_0x5443('0xa')]());}else{if(_0x1e1214){_0x4de434(_0x1e1214);}else{_0x37c118('Not\x20verifired');}}});});};module[_0x5443('0xb')]=EmailSmtp; \ No newline at end of file +var _0x8e77=['prototype','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail','toString'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8e77,0x1f2));var _0x78e7=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x8e77[_0x18a436];return _0x5c2cf8;};'use strict';var nodemailer=require(_0x78e7('0x0'));var BPromise=require(_0x78e7('0x1'));var inlineBase64=require(_0x78e7('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x78e7('0x3')]=function(_0x546ee6,_0x2680ac){return new BPromise(function(_0x2c366e,_0x245ce5){var _0x19529b=nodemailer[_0x78e7('0x4')](_0x546ee6);_0x19529b[_0x78e7('0x5')](_0x78e7('0x6'),inlineBase64());_0x19529b[_0x78e7('0x7')](_0x2680ac,function(_0x1dcbed,_0x1d7c6d){if(_0x1dcbed){_0x245ce5(_0x1dcbed[_0x78e7('0x8')]());}else{_0x2c366e(_0x1d7c6d);}});});};EmailSmtp[_0x78e7('0x9')][_0x78e7('0xa')]=function(_0x15b182){return new BPromise(function(_0x666d22,_0x500db6){var _0x126f15=nodemailer[_0x78e7('0x4')](_0x15b182);_0x126f15[_0x78e7('0xa')](function(_0x5a9d49,_0x3ca19e){if(_0x5a9d49){_0x500db6(_0x5a9d49[_0x78e7('0x8')]());}else{if(_0x3ca19e){_0x666d22(_0x3ca19e);}else{_0x500db6(_0x78e7('0xb'));}}});});};module[_0x78e7('0xc')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 251eb58..fde9121 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 _0x073d=['split','length','join','Anonymous','isEmpty','html','test','includes','\x20[Attachment:\x20','body','textAsHtml','message','originTo','originCc','bcc','attach','type','attachment','attachment-','format','%s-%s','now','root','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook.office365.com','127.0.0.1','moment','randomstring','path','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf'];(function(_0x1654b7,_0x3c450d){var _0xc9f9d1=function(_0x4395d4){while(--_0x4395d4){_0x1654b7['push'](_0x1654b7['shift']());}};_0xc9f9d1(++_0x3c450d);}(_0x073d,0xd2));var _0xd073=function(_0x2a318a,_0x3f8006){_0x2a318a=_0x2a318a-0x0;var _0x346cf3=_0x073d[_0x2a318a];return _0x346cf3;};'use strict';var _=require('lodash');var moment=require(_0xd073('0x0'));var random=require(_0xd073('0x1'));var fs=require('fs');var path=require(_0xd073('0x2'));var util=require('util');var tnef=require(_0xd073('0x3'));var logger=require('../../../config/logger')(_0xd073('0x4'));var config=require(_0xd073('0x5'));function getAddress(_0x494f81){var _0x11bd94=_[_0xd073('0x6')](_0x494f81[_0xd073('0x7')]);return _0x11bd94&&_0x11bd94[_0xd073('0x8')]?_0x11bd94[_0xd073('0x8')]:_0xd073('0x9')+random[_0xd073('0xa')](0x6)+_0xd073('0xb');}function getFirstName(_0x199033){var _0x149c3e=_[_0xd073('0x6')](_0x199033[_0xd073('0x7')]);if(_0x149c3e&&_0x149c3e[_0xd073('0xc')]){if(_0x149c3e[_0xd073('0xc')]==_0x149c3e['address']){return _0x149c3e['name'][_0xd073('0xd')](0x0,_0x149c3e['name'][_0xd073('0xe')]('@'));}var _0xf3f0f0=_0x149c3e[_0xd073('0xc')][_0xd073('0xf')](/\s+/);return _0xf3f0f0[_0xd073('0x10')]>0x1?_0xf3f0f0['slice'](0x0,-0x1)[_0xd073('0x11')]('\x20'):_0x149c3e[_0xd073('0xc')];}return _0xd073('0x12');}function getLastName(_0x7d469e){var _0x589073=_[_0xd073('0x6')](_0x7d469e[_0xd073('0x7')]);if(_0x589073&&_0x589073['name']){var _0xb5e1e2=_0x589073[_0xd073('0xc')][_0xd073('0xf')](/\s+/);return _0xb5e1e2[_0xd073('0x10')]>0x1?_0xb5e1e2['pop']():'';}return'';}function getMails(_0x49a1dd,_0x48a4f1){var _0x5ac7b2='';for(var _0x195c5d=0x0;_0x195c5d<_0x48a4f1[_0xd073('0x7')][_0xd073('0x10')];_0x195c5d+=0x1){if(_0x48a4f1['value'][_0x195c5d][_0xd073('0x8')]!==_0x49a1dd){if(!_[_0xd073('0x13')](_0x5ac7b2)){_0x5ac7b2+=',';}_0x5ac7b2+=_0x48a4f1[_0xd073('0x7')][_0x195c5d]['name']||_0x48a4f1[_0xd073('0x7')][_0x195c5d][_0xd073('0x8')]||'';_0x5ac7b2+='\x20<';_0x5ac7b2+=_0x48a4f1[_0xd073('0x7')][_0x195c5d][_0xd073('0x8')]?_0x48a4f1['value'][_0x195c5d][_0xd073('0x8')]:_0xd073('0x9')+random[_0xd073('0xa')](0x6)+'@xcally.com';_0x5ac7b2+='>';}}return _0x5ac7b2;}function parseEmail(_0x1e5145,_0x2c244e,_0x5e5f8d){if(_0x2c244e[_0xd073('0x14')]){var _0x72b4aa=/)<[^<]*)*<\/script>/gi;while(_0x72b4aa[_0xd073('0x15')](_0x2c244e['html'])){_0x2c244e['html']=_0x2c244e['html']['replace'](_0x72b4aa,'');}if(_0x2c244e[_0xd073('0x14')][_0xd073('0x16')](_0xd073('0x17'))){var _0x9a0e39=[];_0x2c244e[_0xd073('0x18')][_0xd073('0x19')](_0x1512a5=>{_0x9a0e39[_0xd073('0x1a')](_0x1512a5[_0xd073('0x1b')]);});var _0x4bc4ad=/]+>/g;var _0xda2c7d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5c43f3=_0x2c244e[_0xd073('0x14')][_0xd073('0x1c')](_0xda2c7d,_0xd073('0x1d'));var _0x3b1678=_0x5c43f3['replace'](_0x4bc4ad,_0xd073('0x1e'));for(let _0x5ef3c5=0x0;_0x5ef3c5<_0x9a0e39['length'];_0x5ef3c5++){var _0x34b0e2=_0x3b1678[_0xd073('0x1c')]('_IMG',_0xd073('0x1f')+_0x9a0e39[_0x5ef3c5]+'\x20]');_0x3b1678=_0x34b0e2;}_0x2c244e[_0xd073('0x14')]=_0x3b1678;}_0x5e5f8d[_0xd073('0x20')]=_0x2c244e[_0xd073('0x14')];}else{_0x5e5f8d[_0xd073('0x20')]=_0x2c244e[_0xd073('0x21')];}if(_0x5e5f8d[_0xd073('0x20')]){_0x5e5f8d[_0xd073('0x20')]=_0x5e5f8d['body'][_0xd073('0x1c')](/0x0){var _0x4b52fe=['Auto-Submitted:\x20auto-replied',_0xd073('0x31'),_0xd073('0x32')];for(var _0x12d01f=0x0;_0x12d01f<_0x2c244e[_0xd073('0x30')]['length'];_0x12d01f++){var _0x2e855f=_['indexOf'](_0x4b52fe,_0x2c244e[_0xd073('0x30')][_0x12d01f][_0xd073('0x33')]);if(_0x2e855f>=0x0){_0x5e5f8d[_0xd073('0x34')]=!![];}}}return _0x5e5f8d;}exports['parser']=function(_0x63f254,_0x52d1aa,_0x1aeb05){var _0x31d75d={'from':getAddress(_0x52d1aa[_0xd073('0x35')]),'firstName':getFirstName(_0x52d1aa[_0xd073('0x35')]),'lastName':getLastName(_0x52d1aa[_0xd073('0x35')]),'mapKey':_0xd073('0x4'),'message':{'from':getMails(_0x63f254[_0xd073('0x4')],_0x52d1aa[_0xd073('0x35')]),'to':_0x63f254['email'],'cc':'','subject':_0x52d1aa[_0xd073('0x36')]||'','messageId':_0x52d1aa[_0xd073('0x37')],'inReplyTo':_0x52d1aa[_0xd073('0x38')],'sentAt':moment(_0x52d1aa[_0xd073('0x39')])[_0xd073('0x2a')](_0xd073('0x3a')),'attach':![],'attachments':[]}};if(!_0x52d1aa[_0xd073('0x14')]&&!_0x52d1aa[_0xd073('0x21')]){var _0x5830be=_[_0xd073('0x3b')](_0x52d1aa[_0xd073('0x18')],{'contentType':_0xd073('0x3c')});if(_0x5830be[_0xd073('0x10')]){logger[_0xd073('0x3d')](util[_0xd073('0x2a')](_0xd073('0x3e'),_0x52d1aa[_0xd073('0x37')]));tnef['parseBuffer'](_[_0xd073('0x3f')](_0x5830be)['content'],function(_0x5bf43c,_0x408c0d){if(_0x408c0d){_0x52d1aa[_0xd073('0x14')]=_0x408c0d['BodyHTML']||_0xd073('0x40');if(_0x408c0d['Attachments']){for(var _0x23d4b4=0x0;_0x23d4b4<_0x408c0d[_0xd073('0x41')][_0xd073('0x10')];_0x23d4b4++){var _0x25f399=_0x408c0d[_0xd073('0x41')][_0x23d4b4];_0x31d75d[_0xd073('0x22')][_0xd073('0x18')]['push']({'filename':_0x25f399[_0xd073('0x42')],'content':Buffer[_0xd073('0x35')](_0x25f399[_0xd073('0x43')])});}}}_0x1aeb05(parseEmail(_0x63f254,_0x52d1aa,_0x31d75d));});}else{_0x52d1aa[_0xd073('0x14')]=_0xd073('0x40');_0x1aeb05(parseEmail(_0x63f254,_0x52d1aa,_0x31d75d));}}else{_0x1aeb05(parseEmail(_0x63f254,_0x52d1aa,_0x31d75d));}};exports[_0xd073('0x44')]=function(_0x7df359){switch(_0x7df359){case _0xd073('0x45'):return _0xd073('0x46');case _0xd073('0x47'):return _0xd073('0x48');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0xd073('0x49');}return _0xd073('0x4a');}; \ No newline at end of file +var _0x9a18=['outlook.office365.com','lodash','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','name','substring','indexOf','split','length','Anonymous','pop','isEmpty','generate','@xcally.com','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365'];(function(_0x37f4f5,_0x345632){var _0x2f005b=function(_0x2a844a){while(--_0x2a844a){_0x37f4f5['push'](_0x37f4f5['shift']());}};_0x2f005b(++_0x345632);}(_0x9a18,0x187));var _0x89a1=function(_0xa4ea8d,_0x31624d){_0xa4ea8d=_0xa4ea8d-0x0;var _0x36379e=_0x9a18[_0xa4ea8d];return _0x36379e;};'use strict';var _=require(_0x89a1('0x0'));var moment=require('moment');var random=require(_0x89a1('0x1'));var fs=require('fs');var path=require(_0x89a1('0x2'));var util=require(_0x89a1('0x3'));var tnef=require(_0x89a1('0x4'));var logger=require(_0x89a1('0x5'))('email');var config=require(_0x89a1('0x6'));function getAddress(_0x2b7678){var _0x287f38=_[_0x89a1('0x7')](_0x2b7678[_0x89a1('0x8')]);return _0x287f38&&_0x287f38[_0x89a1('0x9')]?_0x287f38[_0x89a1('0x9')]:_0x89a1('0xa')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x3bba21){var _0x4993c1=_[_0x89a1('0x7')](_0x3bba21[_0x89a1('0x8')]);if(_0x4993c1&&_0x4993c1[_0x89a1('0xb')]){if(_0x4993c1[_0x89a1('0xb')]==_0x4993c1[_0x89a1('0x9')]){return _0x4993c1[_0x89a1('0xb')][_0x89a1('0xc')](0x0,_0x4993c1[_0x89a1('0xb')][_0x89a1('0xd')]('@'));}var _0x19e611=_0x4993c1[_0x89a1('0xb')][_0x89a1('0xe')](/\s+/);return _0x19e611[_0x89a1('0xf')]>0x1?_0x19e611['slice'](0x0,-0x1)['join']('\x20'):_0x4993c1[_0x89a1('0xb')];}return _0x89a1('0x10');}function getLastName(_0x131704){var _0x16bba0=_['head'](_0x131704[_0x89a1('0x8')]);if(_0x16bba0&&_0x16bba0[_0x89a1('0xb')]){var _0x57287b=_0x16bba0[_0x89a1('0xb')][_0x89a1('0xe')](/\s+/);return _0x57287b[_0x89a1('0xf')]>0x1?_0x57287b[_0x89a1('0x11')]():'';}return'';}function getMails(_0x1f130e,_0x69dbd3){var _0x7a1409='';for(var _0x325a5a=0x0;_0x325a5a<_0x69dbd3['value'][_0x89a1('0xf')];_0x325a5a+=0x1){if(_0x69dbd3[_0x89a1('0x8')][_0x325a5a][_0x89a1('0x9')]!==_0x1f130e){if(!_[_0x89a1('0x12')](_0x7a1409)){_0x7a1409+=',';}_0x7a1409+=_0x69dbd3[_0x89a1('0x8')][_0x325a5a]['name']||_0x69dbd3[_0x89a1('0x8')][_0x325a5a][_0x89a1('0x9')]||'';_0x7a1409+='\x20<';_0x7a1409+=_0x69dbd3[_0x89a1('0x8')][_0x325a5a]['address']?_0x69dbd3[_0x89a1('0x8')][_0x325a5a][_0x89a1('0x9')]:_0x89a1('0xa')+random[_0x89a1('0x13')](0x6)+_0x89a1('0x14');_0x7a1409+='>';}}return _0x7a1409;}function parseEmail(_0xedc307,_0x4cd448,_0x3e3224){if(_0x4cd448['html']){var _0x2a082a=/)<[^<]*)*<\/script>/gi;while(_0x2a082a[_0x89a1('0x15')](_0x4cd448[_0x89a1('0x16')])){_0x4cd448['html']=_0x4cd448[_0x89a1('0x16')][_0x89a1('0x17')](_0x2a082a,'');}if(_0x4cd448[_0x89a1('0x16')][_0x89a1('0x18')](_0x89a1('0x19'))){var _0x31f91d=[];_0x4cd448[_0x89a1('0x1a')][_0x89a1('0x1b')](_0x10bd94=>{_0x31f91d['push'](_0x10bd94['filename']);});var _0x1d895e=/]+>/g;var _0x1adefa=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1f6b94=_0x4cd448[_0x89a1('0x16')][_0x89a1('0x17')](_0x1adefa,'_SRC');var _0x1330a6=_0x1f6b94['replace'](_0x1d895e,'_IMG');for(let _0x3ad0fe=0x0;_0x3ad0fe<_0x31f91d[_0x89a1('0xf')];_0x3ad0fe++){var _0x1d346a=_0x1330a6[_0x89a1('0x17')](_0x89a1('0x1c'),_0x89a1('0x1d')+_0x31f91d[_0x3ad0fe]+_0x89a1('0x1e'));_0x1330a6=_0x1d346a;}_0x4cd448[_0x89a1('0x16')]=_0x1330a6;}_0x3e3224[_0x89a1('0x1f')]=_0x4cd448['html'];}else{_0x3e3224[_0x89a1('0x1f')]=_0x4cd448[_0x89a1('0x20')];}if(_0x3e3224[_0x89a1('0x1f')]){_0x3e3224[_0x89a1('0x1f')]=_0x3e3224[_0x89a1('0x1f')][_0x89a1('0x17')](/0x0){var _0x523a69=[_0x89a1('0x34'),'X-Auto-Response-Suppress:\x20All',_0x89a1('0x35')];for(var _0x702874=0x0;_0x702874<_0x4cd448[_0x89a1('0x33')]['length'];_0x702874++){var _0x499913=_[_0x89a1('0xd')](_0x523a69,_0x4cd448[_0x89a1('0x33')][_0x702874][_0x89a1('0x36')]);if(_0x499913>=0x0){_0x3e3224[_0x89a1('0x37')]=!![];}}}return _0x3e3224;}exports['parser']=function(_0x5bbe75,_0x17669a,_0x3b1a85){var _0x1fac58={'from':getAddress(_0x17669a[_0x89a1('0x38')]),'firstName':getFirstName(_0x17669a[_0x89a1('0x38')]),'lastName':getLastName(_0x17669a[_0x89a1('0x38')]),'mapKey':'email','message':{'from':getMails(_0x5bbe75[_0x89a1('0x23')],_0x17669a[_0x89a1('0x38')]),'to':_0x5bbe75[_0x89a1('0x23')],'cc':'','subject':_0x17669a[_0x89a1('0x39')]||'','messageId':_0x17669a[_0x89a1('0x3a')],'inReplyTo':_0x17669a['inReplyTo'],'sentAt':moment(_0x17669a[_0x89a1('0x3b')])[_0x89a1('0x3c')](_0x89a1('0x3d')),'attach':![],'attachments':[]}};if(!_0x17669a[_0x89a1('0x16')]&&!_0x17669a['textAsHtml']){var _0x3a344a=_[_0x89a1('0x3e')](_0x17669a[_0x89a1('0x1a')],{'contentType':'application/ms-tnef'});if(_0x3a344a[_0x89a1('0xf')]){logger[_0x89a1('0x3f')](util[_0x89a1('0x3c')](_0x89a1('0x40'),_0x17669a[_0x89a1('0x3a')]));tnef['parseBuffer'](_[_0x89a1('0x41')](_0x3a344a)[_0x89a1('0x30')],function(_0x1d96b6,_0x572a91){if(_0x572a91){_0x17669a[_0x89a1('0x16')]=_0x572a91['BodyHTML']||_0x89a1('0x42');if(_0x572a91['Attachments']){for(var _0x22c359=0x0;_0x22c359<_0x572a91[_0x89a1('0x43')]['length'];_0x22c359++){var _0x325f7f=_0x572a91[_0x89a1('0x43')][_0x22c359];_0x1fac58[_0x89a1('0x24')][_0x89a1('0x1a')][_0x89a1('0x31')]({'filename':_0x325f7f[_0x89a1('0x44')],'content':Buffer[_0x89a1('0x38')](_0x325f7f[_0x89a1('0x45')])});}}}_0x3b1a85(parseEmail(_0x5bbe75,_0x17669a,_0x1fac58));});}else{_0x17669a[_0x89a1('0x16')]=_0x89a1('0x42');_0x3b1a85(parseEmail(_0x5bbe75,_0x17669a,_0x1fac58));}}else{_0x3b1a85(parseEmail(_0x5bbe75,_0x17669a,_0x1fac58));}};exports[_0x89a1('0x46')]=function(_0xde5c45){switch(_0xde5c45){case'gmail':return _0x89a1('0x47');case _0x89a1('0x48'):return _0x89a1('0x49');case _0x89a1('0x4a'):return _0x89a1('0x4b');case _0x89a1('0x4c'):return _0x89a1('0x4d');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 9a53184..873543b 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 _0x16aa=['Service','key','SERV','active','Smtp','lodash','name'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0x16aa,0x155));var _0xa16a=function(_0x5249db,_0x4d2910){_0x5249db=_0x5249db-0x0;var _0x245f60=_0x16aa[_0x5249db];return _0x245f60;};'use strict';var _=require(_0xa16a('0x0'));function MailAccount(_0x58f355){this['id']=_0x58f355['id']||0x0;this[_0xa16a('0x1')]=_0x58f355[_0xa16a('0x1')]||_0xa16a('0x2');this[_0xa16a('0x3')]=_0x58f355['key']||_0xa16a('0x4');this[_0xa16a('0x5')]=_0x58f355['active']||![];this['Imap']=_0x58f355['Imap']||[];this[_0xa16a('0x6')]=_0x58f355[_0xa16a('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x9e69=['SERV','active','Imap','lodash','name','Service','key'];(function(_0x51ea9e,_0x14d235){var _0x54e385=function(_0x73e739){while(--_0x73e739){_0x51ea9e['push'](_0x51ea9e['shift']());}};_0x54e385(++_0x14d235);}(_0x9e69,0x65));var _0x99e6=function(_0x548250,_0x2545e5){_0x548250=_0x548250-0x0;var _0x23b53f=_0x9e69[_0x548250];return _0x23b53f;};'use strict';var _=require(_0x99e6('0x0'));function MailAccount(_0x5e6ebc){this['id']=_0x5e6ebc['id']||0x0;this['name']=_0x5e6ebc[_0x99e6('0x1')]||_0x99e6('0x2');this[_0x99e6('0x3')]=_0x5e6ebc[_0x99e6('0x3')]||_0x99e6('0x4');this[_0x99e6('0x5')]=_0x5e6ebc[_0x99e6('0x5')]||![];this[_0x99e6('0x6')]=_0x5e6ebc['Imap']||[];this['Smtp']=_0x5e6ebc['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 0a08ae9..56dad88 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 _0xf8d7=['prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','mailAccounts','length','isUndefined','lodash','../model/mailAccount','mapKeys'];(function(_0x252a2f,_0x5eda01){var _0x16ad8b=function(_0x5419d4){while(--_0x5419d4){_0x252a2f['push'](_0x252a2f['shift']());}};_0x16ad8b(++_0x5eda01);}(_0xf8d7,0x10b));var _0x7f8d=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xf8d7[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x7f8d('0x0'));var MailAccount=require(_0x7f8d('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x17530d,_0x50720b,_0xe53d2d){var _0x390fbe=_[_0x7f8d('0x2')](_0x17530d,function(_0x1fa38a,_0x4ac45e){return _0x1fa38a[_0xe53d2d];});for(var _0x32e31b in _0x50720b){if(_0x50720b['hasOwnProperty'](_0x32e31b)){if(!_0x390fbe[_0x32e31b]){delete _0x50720b[_0x32e31b];}}}}Realtime[_0x7f8d('0x3')][_0x7f8d('0x4')]=function(_0x26a143,_0x2f6647){for(var _0x57da6b in _0x2f6647){if(_0x26a143[_0x7f8d('0x5')](_0x57da6b)){_0x26a143[_0x57da6b]=_0x2f6647[_0x57da6b];}}};Realtime[_0x7f8d('0x3')][_0x7f8d('0x6')]=function(){var _0x38580b=this;return function(_0x16d0a4){if(_0x16d0a4){freeIsNotKey(_0x16d0a4,_0x38580b[_0x7f8d('0x7')],'id');for(var _0x3ff2ab=0x0,_0x448660={},_0x36c919={};_0x3ff2ab<_0x16d0a4[_0x7f8d('0x8')];_0x3ff2ab+=0x1){_0x448660=_0x16d0a4[_0x3ff2ab];if(_[_0x7f8d('0x9')](_0x38580b[_0x7f8d('0x7')][_0x448660['id']])){_0x38580b['mailAccounts'][_0x448660['id']]=new MailAccount(_0x448660);}else{_['merge'](_0x38580b['mailAccounts'][_0x448660['id']],_0x448660);}}}return _0x38580b[_0x7f8d('0x7')];};};module['exports']=Realtime; \ No newline at end of file +var _0x6f33=['exports','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','merge'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f33,0xc9));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var MailAccount=require(_0x36f3('0x0'));var Realtime=function(){this[_0x36f3('0x1')]={};};function freeIsNotKey(_0x21a407,_0x29e7e7,_0x2360f7){var _0x401e4c=_['mapKeys'](_0x21a407,function(_0x172e31,_0x335a52){return _0x172e31[_0x2360f7];});for(var _0x168fa2 in _0x29e7e7){if(_0x29e7e7[_0x36f3('0x2')](_0x168fa2)){if(!_0x401e4c[_0x168fa2]){delete _0x29e7e7[_0x168fa2];}}}}Realtime[_0x36f3('0x3')][_0x36f3('0x4')]=function(_0x679560,_0xfb00f3){for(var _0x31553d in _0xfb00f3){if(_0x679560['hasOwnProperty'](_0x31553d)){_0x679560[_0x31553d]=_0xfb00f3[_0x31553d];}}};Realtime[_0x36f3('0x3')][_0x36f3('0x5')]=function(){var _0x551cba=this;return function(_0x8c0818){if(_0x8c0818){freeIsNotKey(_0x8c0818,_0x551cba[_0x36f3('0x1')],'id');for(var _0x25d503=0x0,_0x361252={},_0x3d7b8b={};_0x25d503<_0x8c0818['length'];_0x25d503+=0x1){_0x361252=_0x8c0818[_0x25d503];if(_['isUndefined'](_0x551cba[_0x36f3('0x1')][_0x361252['id']])){_0x551cba['mailAccounts'][_0x361252['id']]=new MailAccount(_0x361252);}else{_[_0x36f3('0x6')](_0x551cba[_0x36f3('0x1')][_0x361252['id']],_0x361252);}}}return _0x551cba[_0x36f3('0x1')];};};module[_0x36f3('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 8a11e12..0397ca4 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 _0x3274=['../client','Request','GetMailAccount','service','email','active','key','ListId','TemplateId','Imap','MailServerOut','getMailAccount','notify','NotifyMailAccount'];(function(_0x49c6cc,_0x308bdb){var _0x22e239=function(_0x48507d){while(--_0x48507d){_0x49c6cc['push'](_0x49c6cc['shift']());}};_0x22e239(++_0x308bdb);}(_0x3274,0x134));var _0x4327=function(_0x284a2f,_0x422a5f){_0x284a2f=_0x284a2f-0x0;var _0x3c20a4=_0x3274[_0x284a2f];return _0x3c20a4;};'use strict';var client=require(_0x4327('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x4327('0x1')](_0x4327('0x2'),{'options':{'attributes':['id','name',_0x4327('0x3'),_0x4327('0x4'),_0x4327('0x5'),_0x4327('0x6'),_0x4327('0x7'),_0x4327('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x4327('0x9')},{'model':_0x4327('0xa'),'as':'Smtp'}]},'log':_0x4327('0xb')});};};exports[_0x4327('0xc')]=function(_0x502e7f,_0x43b30b){return client[_0x4327('0x1')]('NotifyMailAccount',{'account':{'id':_0x502e7f},'body':_0x43b30b,'log':_0x4327('0xd')});}; \ No newline at end of file +var _0x559f=['ListId','TemplateId','Imap','MailServerOut','notify','NotifyMailAccount','../client','Request','name','email','active','key'];(function(_0x4ecea4,_0x556e5d){var _0x483b05=function(_0x5a9bf5){while(--_0x5a9bf5){_0x4ecea4['push'](_0x4ecea4['shift']());}};_0x483b05(++_0x556e5d);}(_0x559f,0x102));var _0xf559=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x559f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf559('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xf559('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0xf559('0x2'),'service',_0xf559('0x3'),_0xf559('0x4'),_0xf559('0x5'),_0xf559('0x6'),_0xf559('0x7')],'raw':![],'include':[{'model':'MailServerIn','as':_0xf559('0x8')},{'model':_0xf559('0x9'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0xf559('0xa')]=function(_0x55631f,_0x69d87c){return client[_0xf559('0x1')](_0xf559('0xb'),{'account':{'id':_0x55631f},'body':_0x69d87c,'log':_0xf559('0xb')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index e210339..ad97a80 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 _0x6c0b=['GetSettings','../client','Request','ShowSetting','loginMailFrequency'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x6c0b,0x1e6));var _0xb6c0=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x6c0b[_0x23ec06];return _0x2831d4;};'use strict';var client=require(_0xb6c0('0x0'));exports['getSettings']=function(){return client[_0xb6c0('0x1')](_0xb6c0('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb6c0('0x3')]},'log':_0xb6c0('0x4')});}; \ No newline at end of file +var _0x51a2=['loginMailFrequency','../client','getSettings','Request'];(function(_0x168463,_0x1c6e2c){var _0x1f3d27=function(_0x4fad35){while(--_0x4fad35){_0x168463['push'](_0x168463['shift']());}};_0x1f3d27(++_0x1c6e2c);}(_0x51a2,0xe5));var _0x251a=function(_0x677920,_0x1e3e6a){_0x677920=_0x677920-0x0;var _0x1c593b=_0x51a2[_0x677920];return _0x1c593b;};'use strict';var client=require(_0x251a('0x0'));exports[_0x251a('0x1')]=function(){return client[_0x251a('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x251a('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index b43a77e..1e209c5 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 1d3b205..c21a9f3 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 _0x09f1=['http','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x542f45,_0x37468a){var _0x38c609=function(_0x44259b){while(--_0x44259b){_0x542f45['push'](_0x542f45['shift']());}};_0x38c609(++_0x37468a);}(_0x09f1,0x180));var _0x109f=function(_0x25fb97,_0x489473){_0x25fb97=_0x25fb97-0x0;var _0x2dd0ec=_0x09f1[_0x25fb97];return _0x2dd0ec;};'use strict';var _=require('lodash');var http=require(_0x109f('0x0'));var express=require(_0x109f('0x1'));var sticky=require(_0x109f('0x2'));var Redis=require(_0x109f('0x3'));var config=require(_0x109f('0x4'));var app=express();var server=http[_0x109f('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x109f('0x6')](server,config[_0x109f('0x7')])){var socketio=require(_0x109f('0x8'))(server,{'transports':[_0x109f('0x9'),'polling']});config[_0x109f('0xa')]=_[_0x109f('0xb')](config[_0x109f('0xa')],{'host':_0x109f('0xc'),'port':0x18eb});socketio[_0x109f('0xd')](require(_0x109f('0xe'))({'pubClient':new Redis(config[_0x109f('0xa')]),'subClient':new Redis(config[_0x109f('0xa')])}));require(_0x109f('0xf'))['default']();require(_0x109f('0x10'))[_0x109f('0x11')](socketio);require(_0x109f('0x12'))[_0x109f('0x11')](app);require('../../routes')[_0x109f('0x11')](app);}else{server[_0x109f('0x13')](_0x109f('0x14'),function(){console[_0x109f('0x15')](_0x109f('0x16'),config[_0x109f('0x7')]);});}exports=module[_0x109f('0x17')]=app; \ No newline at end of file +var _0x4cb3=['default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','../../config/environment','createServer','timeout','port','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers'];(function(_0xec1289,_0x4fa82b){var _0x3e223c=function(_0x9752ec){while(--_0x9752ec){_0xec1289['push'](_0xec1289['shift']());}};_0x3e223c(++_0x4fa82b);}(_0x4cb3,0x169));var _0x34cb=function(_0x2a481f,_0x3fc350){_0x2a481f=_0x2a481f-0x0;var _0x4c8da6=_0x4cb3[_0x2a481f];return _0x4c8da6;};'use strict';var _=require(_0x34cb('0x0'));var http=require('http');var express=require(_0x34cb('0x1'));var sticky=require(_0x34cb('0x2'));var Redis=require('ioredis');var config=require(_0x34cb('0x3'));var app=express();var server=http[_0x34cb('0x4')](app);server[_0x34cb('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0x34cb('0x6')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config['redis']=_[_0x34cb('0x7')](config[_0x34cb('0x8')],{'host':_0x34cb('0x9'),'port':0x18eb});socketio[_0x34cb('0xa')](require(_0x34cb('0xb'))({'pubClient':new Redis(config[_0x34cb('0x8')]),'subClient':new Redis(config['redis'])}));require(_0x34cb('0xc'))[_0x34cb('0xd')]();require(_0x34cb('0xe'))[_0x34cb('0xd')](socketio);require(_0x34cb('0xf'))[_0x34cb('0xd')](app);require(_0x34cb('0x10'))['default'](app);}else{server[_0x34cb('0x11')](_0x34cb('0x12'),function(){console[_0x34cb('0x13')](_0x34cb('0x14'),config['port']);});}exports=module[_0x34cb('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index afc65f5..168e55f 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 _0xb9c2=['request','then','debug','rpc','routing','error','message','catch','exports','jayson/promise','../../config/logger','http','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb9c2,0x1ea));var _0x2b9c=function(_0x49bfb8,_0x5b6e2b){_0x49bfb8=_0x49bfb8-0x0;var _0x1be0b7=_0xb9c2[_0x49bfb8];return _0x1be0b7;};'use strict';var jayson=require(_0x2b9c('0x0'));var BPromise=require('bluebird');var logger=require(_0x2b9c('0x1'))('routing');var client=jayson['client'][_0x2b9c('0x2')]({'port':0x2329});client[_0x2b9c('0x3')]=function(_0x18ebcb,_0x471178){return new BPromise(function(_0x1281a3,_0x225e96){return client[_0x2b9c('0x4')](_0x18ebcb,_0x471178)[_0x2b9c('0x5')](function(_0x529ccb){logger[_0x2b9c('0x6')](_0x2b9c('0x7'),'routing',_0x18ebcb,_0x471178,_0x529ccb);if(_0x529ccb['error']){logger['error'](_0x2b9c('0x7'),_0x2b9c('0x8'),_0x18ebcb,_0x529ccb[_0x2b9c('0x9')][_0x2b9c('0xa')],_0x471178);return _0x225e96(_0x529ccb[_0x2b9c('0x9')][_0x2b9c('0xa')]);}else{return _0x1281a3(_0x529ccb['result']);}})[_0x2b9c('0xb')](function(_0x2501a7){logger[_0x2b9c('0x9')](_0x2b9c('0x7'),_0x2b9c('0x8'),_0x18ebcb,_0x2501a7,_0x471178);return _0x225e96(_0x2501a7);});});};module[_0x2b9c('0xc')]=client; \ No newline at end of file +var _0x6a18=['routing','error','rpc','message','result','catch','jayson/promise','bluebird','client','http','request','then','debug'];(function(_0x7ec937,_0xbe3b08){var _0x150040=function(_0x4a5d8e){while(--_0x4a5d8e){_0x7ec937['push'](_0x7ec937['shift']());}};_0x150040(++_0xbe3b08);}(_0x6a18,0x13e));var _0x86a1=function(_0x5b134d,_0x15f016){_0x5b134d=_0x5b134d-0x0;var _0x217951=_0x6a18[_0x5b134d];return _0x217951;};'use strict';var jayson=require(_0x86a1('0x0'));var BPromise=require(_0x86a1('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x86a1('0x2')][_0x86a1('0x3')]({'port':0x2329});client['Request']=function(_0x3ec2ba,_0x29eb08){return new BPromise(function(_0x1840e0,_0x330d13){return client[_0x86a1('0x4')](_0x3ec2ba,_0x29eb08)[_0x86a1('0x5')](function(_0x3a8305){logger[_0x86a1('0x6')]('rpc',_0x86a1('0x7'),_0x3ec2ba,_0x29eb08,_0x3a8305);if(_0x3a8305[_0x86a1('0x8')]){logger[_0x86a1('0x8')](_0x86a1('0x9'),_0x86a1('0x7'),_0x3ec2ba,_0x3a8305[_0x86a1('0x8')][_0x86a1('0xa')],_0x29eb08);return _0x330d13(_0x3a8305[_0x86a1('0x8')]['message']);}else{return _0x1840e0(_0x3a8305[_0x86a1('0xb')]);}})[_0x86a1('0xc')](function(_0x29cfd6){logger[_0x86a1('0x8')](_0x86a1('0x9'),'routing',_0x3ec2ba,_0x29cfd6,_0x29eb08);return _0x330d13(_0x29cfd6);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 62fe2db..ff3f2d2 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 _0x56a6=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','catch','log','./server'];(function(_0x53b117,_0x4e4767){var _0x1494f8=function(_0x395a23){while(--_0x395a23){_0x53b117['push'](_0x53b117['shift']());}};_0x1494f8(++_0x4e4767);}(_0x56a6,0x18e));var _0x656a=function(_0x3b92d2,_0x57ec04){_0x3b92d2=_0x3b92d2-0x0;var _0x552212=_0x56a6[_0x3b92d2];return _0x552212;};'use strict';var BPromise=require('bluebird');var server=require(_0x656a('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x656a('0x1'));var openchannelQueue=require(_0x656a('0x2'));var chatQueue=require(_0x656a('0x3'));var smsQueue=require(_0x656a('0x4'));var mailQueue=require(_0x656a('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x656a('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x656a('0x7')]()[_0x656a('0x8')](user[_0x656a('0x9')]())[_0x656a('0x8')](realtime['initAgents']())[_0x656a('0x8')](interval[_0x656a('0xa')]())['then'](realtime[_0x656a('0xb')]())['then'](openchannelQueue[_0x656a('0xc')]())['then'](realtime[_0x656a('0xd')]())[_0x656a('0x8')](chatQueue['getChatQueues']())[_0x656a('0x8')](realtime[_0x656a('0xe')]())[_0x656a('0x8')](smsQueue['getSmsQueues']())[_0x656a('0x8')](realtime[_0x656a('0xf')]())[_0x656a('0x8')](mailQueue[_0x656a('0x10')]())[_0x656a('0x8')](realtime[_0x656a('0x11')]())[_0x656a('0x8')](faxQueue[_0x656a('0x12')]())[_0x656a('0x8')](realtime['initFaxQueues']())['then'](whatsappQueue['getWhatsappQueues']())[_0x656a('0x8')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x656a('0x8')](function(_0x14c31f){return initRealtime();})['then'](function(_0x512f80){return setInterval(initRealtime,0x1388);})[_0x656a('0x13')](function(_0x316875){console[_0x656a('0x14')](_0x316875);});}main(); \ No newline at end of file +var _0x01c3=['./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log'];(function(_0x39e476,_0x406dc7){var _0x523604=function(_0x26886e){while(--_0x26886e){_0x39e476['push'](_0x39e476['shift']());}};_0x523604(++_0x406dc7);}(_0x01c3,0x104));var _0x301c=function(_0x27621c,_0x33125e){_0x27621c=_0x27621c-0x0;var _0x2e2df5=_0x01c3[_0x27621c];return _0x2e2df5;};'use strict';var BPromise=require('bluebird');var server=require(_0x301c('0x0'));var Realtime=require(_0x301c('0x1'));var user=require(_0x301c('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x301c('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x301c('0x4'));var mailQueue=require(_0x301c('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x301c('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x301c('0x7')](user[_0x301c('0x8')]())[_0x301c('0x7')](realtime[_0x301c('0x9')]())[_0x301c('0x7')](interval[_0x301c('0xa')]())[_0x301c('0x7')](realtime[_0x301c('0xb')]())[_0x301c('0x7')](openchannelQueue[_0x301c('0xc')]())[_0x301c('0x7')](realtime[_0x301c('0xd')]())['then'](chatQueue[_0x301c('0xe')]())[_0x301c('0x7')](realtime[_0x301c('0xf')]())[_0x301c('0x7')](smsQueue[_0x301c('0x10')]())[_0x301c('0x7')](realtime[_0x301c('0x11')]())[_0x301c('0x7')](mailQueue['getMailQueues']())[_0x301c('0x7')](realtime[_0x301c('0x12')]())['then'](faxQueue[_0x301c('0x13')]())[_0x301c('0x7')](realtime[_0x301c('0x14')]())[_0x301c('0x7')](whatsappQueue[_0x301c('0x15')]())['then'](realtime[_0x301c('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0x301c('0x17')](realtime)[_0x301c('0x7')](function(_0x549b92){return initRealtime();})[_0x301c('0x7')](function(_0x269f2a){return setInterval(initRealtime,0x1388);})[_0x301c('0x18')](function(_0x30bff3){console[_0x301c('0x19')](_0x30bff3);});}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 2092b0e..c4f4fba 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x5598fa,_0x108fc5){var _0x2579b6=function(_0x195bbb){while(--_0x195bbb){_0x5598fa['push'](_0x5598fa['shift']());}};_0x2579b6(++_0x108fc5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0x1261[_0x188d31];return _0x30ed33;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index d5f6627..9909b01 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 _0x7fbb=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x319f0a,_0x4131d3){var _0x73c2e4=function(_0x40f490){while(--_0x40f490){_0x319f0a['push'](_0x319f0a['shift']());}};_0x73c2e4(++_0x4131d3);}(_0x7fbb,0xb8));var _0xb7fb=function(_0x5af714,_0x2ca616){_0x5af714=_0x5af714-0x0;var _0x1e845a=_0x7fbb[_0x5af714];return _0x1e845a;};'use strict';var BPromise=require(_0xb7fb('0x0'));var jayson=require(_0xb7fb('0x1'));var client=jayson[_0xb7fb('0x2')][_0xb7fb('0x3')]({'port':0x232b});function request(_0x4008d8,_0x2fbab4){return new BPromise(function(_0x1054c6,_0x5951a0){return client[_0xb7fb('0x4')](_0x4008d8,_0x2fbab4)[_0xb7fb('0x5')](function(_0x15edcf){if(_0x15edcf[_0xb7fb('0x6')]){return _0x5951a0(_0x15edcf[_0xb7fb('0x6')][_0xb7fb('0x7')]);}else{return _0x1054c6(_0x15edcf[_0xb7fb('0x8')]);}})[_0xb7fb('0x9')](function(_0x3e79b8){return _0x5951a0(_0x3e79b8);});});}exports[_0xb7fb('0xa')]=function(_0x17768b,_0x4125cf){return request(_0xb7fb('0xb'),{'account':_0x17768b,'message':_0x4125cf});}; \ No newline at end of file +var _0x3839=['error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client','request','then'];(function(_0x286d25,_0x492cf1){var _0x4c0b3a=function(_0x581074){while(--_0x581074){_0x286d25['push'](_0x286d25['shift']());}};_0x4c0b3a(++_0x492cf1);}(_0x3839,0xa6));var _0x9383=function(_0x5bc53b,_0x4b8a4a){_0x5bc53b=_0x5bc53b-0x0;var _0x2db322=_0x3839[_0x5bc53b];return _0x2db322;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9383('0x0'));var client=jayson[_0x9383('0x1')]['http']({'port':0x232b});function request(_0x405539,_0x5b1954){return new BPromise(function(_0x40f93e,_0x49cae4){return client[_0x9383('0x2')](_0x405539,_0x5b1954)[_0x9383('0x3')](function(_0x24a37b){if(_0x24a37b['error']){return _0x49cae4(_0x24a37b[_0x9383('0x4')][_0x9383('0x5')]);}else{return _0x40f93e(_0x24a37b[_0x9383('0x6')]);}})[_0x9383('0x7')](function(_0x2facc0){return _0x49cae4(_0x2facc0);});});}exports[_0x9383('0x8')]=function(_0x469af8,_0x3ac8fd){return request(_0x9383('0x9'),{'account':_0x469af8,'message':_0x3ac8fd});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5c97827..1aeed89 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 _0xd2e5=['chatPause','mailPause','faxPause','smsPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','Status','StatusTime','format','name','openchannelPause','chatStatus','mailStatus','mailCapacity','faxStatus','busyQueue','stringify','emit','user:save','exports','moment','md5','ioredis','defaults','redis','online','voicePause'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xd2e5,0x15b));var _0x5d2e=function(_0x482d73,_0x58f50c){_0x482d73=_0x482d73-0x0;var _0x5725bd=_0xd2e5[_0x482d73];return _0x5725bd;};'use strict';var _=require('lodash');var moment=require(_0x5d2e('0x0'));var md5=require(_0x5d2e('0x1'));var Redis=require(_0x5d2e('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x5d2e('0x3')](config[_0x5d2e('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x301d2c){this['id']=_0x301d2c['id']||0x0;this['name']=_0x301d2c['name']||'';this['online']=_0x301d2c[_0x5d2e('0x5')]||!![];this['voicePause']=_0x301d2c[_0x5d2e('0x6')]||![];this['chatPause']=_0x301d2c[_0x5d2e('0x7')]||![];this[_0x5d2e('0x8')]=_0x301d2c[_0x5d2e('0x8')]||![];this[_0x5d2e('0x9')]=_0x301d2c['faxPause']||![];this[_0x5d2e('0xa')]=_0x301d2c[_0x5d2e('0xa')]||![];this['openchannelPause']=_0x301d2c['openchannelPause']||![];this['chatStatus']=_0x5d2e('0xb');this[_0x5d2e('0xc')]=0x0;this[_0x5d2e('0xd')]=_0x301d2c[_0x5d2e('0xd')]||0x0;this[_0x5d2e('0xe')]=0x0;this['mailStatus']=_0x5d2e('0xb');this[_0x5d2e('0xf')]=0x0;this['mailCapacity']=_0x301d2c['mailCapacity']||0x0;this[_0x5d2e('0x10')]=0x0;this['faxStatus']=_0x5d2e('0xb');this[_0x5d2e('0x11')]=0x0;this[_0x5d2e('0x12')]=_0x301d2c[_0x5d2e('0x12')]||0x0;this[_0x5d2e('0x13')]=0x0;this[_0x5d2e('0x14')]='unknown';this[_0x5d2e('0x15')]=0x0;this[_0x5d2e('0x16')]=_0x301d2c[_0x5d2e('0x16')]||0x0;this[_0x5d2e('0x17')]=0x0;this[_0x5d2e('0x18')]=_0x5d2e('0xb');this[_0x5d2e('0x19')]=0x0;this[_0x5d2e('0x1a')]=_0x301d2c[_0x5d2e('0x1a')]||0x0;this[_0x5d2e('0x1b')]=0x0;this['openchannelStatus']=_0x5d2e('0xb');this[_0x5d2e('0x1c')]=0x0;this[_0x5d2e('0x1d')]=_0x301d2c[_0x5d2e('0x1d')]||0x0;this[_0x5d2e('0x1e')]=0x0;this[_0x5d2e('0x1f')]=![];this['busyQueue']=undefined;this[_0x5d2e('0x1')]='';this[_0x5d2e('0x20')]();}Agent[_0x5d2e('0x21')][_0x5d2e('0x22')]=function(_0x321198){if(this[_0x321198+_0x5d2e('0x23')]>0x0){if(this[_0x321198+_0x5d2e('0x24')]>0x0&&this[_0x321198+'CurrentCapacity']>=this[_0x321198+_0x5d2e('0x24')]){return _0x5d2e('0x25');}else{return _0x5d2e('0x26');}}else{return _0x5d2e('0x27');}};Agent[_0x5d2e('0x21')][_0x5d2e('0x20')]=function(){var _0x55a9ee=[_0x5d2e('0x28'),_0x5d2e('0x29'),_0x5d2e('0x2a'),_0x5d2e('0x2b'),_0x5d2e('0x2c'),'whatsapp'];for(var _0x376921=0x0;_0x376921<_0x55a9ee['length'];_0x376921+=0x1){var _0x454dcc=this['getChannelStatus'](_0x55a9ee[_0x376921]);if(this[_0x55a9ee[_0x376921]+_0x5d2e('0x2d')]!==_0x454dcc){this[_0x55a9ee[_0x376921]+_0x5d2e('0x2e')]=_['toNumber'](moment()[_0x5d2e('0x2f')]('x'));}this[_0x55a9ee[_0x376921]+_0x5d2e('0x2d')]=_0x454dcc;}var _0x1c00c1={'id':this['id'],'name':this[_0x5d2e('0x30')],'online':this[_0x5d2e('0x5')],'voicePause':this['voicePause'],'chatPause':this[_0x5d2e('0x7')],'mailPause':this[_0x5d2e('0x8')],'smsPause':this[_0x5d2e('0xa')],'faxPause':this[_0x5d2e('0x9')],'openchannelPause':this[_0x5d2e('0x31')],'chatStatus':this[_0x5d2e('0x32')],'chatStatusTime':this[_0x5d2e('0xc')],'chatCapacity':this[_0x5d2e('0xd')],'chatCurrentCapacity':this[_0x5d2e('0xe')],'mailStatus':this[_0x5d2e('0x33')],'mailStatusTime':this[_0x5d2e('0xf')],'mailCapacity':this[_0x5d2e('0x34')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x5d2e('0x35')],'faxStatusTime':this[_0x5d2e('0x11')],'faxCapacity':this[_0x5d2e('0x12')],'faxCurrentCapacity':this[_0x5d2e('0x13')],'smsStatus':this[_0x5d2e('0x14')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x5d2e('0x17')],'whatsappStatus':this[_0x5d2e('0x18')],'whatsappStatusTime':this[_0x5d2e('0x19')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x5d2e('0x1b')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x5d2e('0x1c')],'openchannelCapacity':this[_0x5d2e('0x1d')],'openchannelCurrentCapacity':this[_0x5d2e('0x1e')],'busy':this[_0x5d2e('0x1f')],'busyQueue':this[_0x5d2e('0x36')]};var _0x4263b9=md5(JSON[_0x5d2e('0x37')](_0x1c00c1));if(this[_0x5d2e('0x1')]!==_0x4263b9){this[_0x5d2e('0x1')]=_0x4263b9;io[_0x5d2e('0x38')](_0x5d2e('0x39'),_0x1c00c1);}};module[_0x5d2e('0x3a')]=Agent; \ No newline at end of file +var _0x8f58=['online','chatCapacity','faxStatus','openchannelStatus','openchannelStatusTime','stringify','user:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','CurrentCapacity','Capacity','maxcapacity','working','prototype','updateRealtime','mail','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','format'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x8f58,0x79));var _0x88f5=function(_0x3651dc,_0x1929e3){_0x3651dc=_0x3651dc-0x0;var _0x217607=_0x8f58[_0x3651dc];return _0x217607;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x88f5('0x0'));var Redis=require(_0x88f5('0x1'));var config=require(_0x88f5('0x2'));config[_0x88f5('0x3')]=_[_0x88f5('0x4')](config[_0x88f5('0x3')],{'host':_0x88f5('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x88f5('0x3')]));function Agent(_0x4b9dae){this['id']=_0x4b9dae['id']||0x0;this[_0x88f5('0x6')]=_0x4b9dae[_0x88f5('0x6')]||'';this['online']=_0x4b9dae['online']||!![];this['voicePause']=_0x4b9dae[_0x88f5('0x7')]||![];this[_0x88f5('0x8')]=_0x4b9dae[_0x88f5('0x8')]||![];this[_0x88f5('0x9')]=_0x4b9dae[_0x88f5('0x9')]||![];this['faxPause']=_0x4b9dae[_0x88f5('0xa')]||![];this[_0x88f5('0xb')]=_0x4b9dae['smsPause']||![];this[_0x88f5('0xc')]=_0x4b9dae[_0x88f5('0xc')]||![];this[_0x88f5('0xd')]=_0x88f5('0xe');this[_0x88f5('0xf')]=0x0;this['chatCapacity']=_0x4b9dae['chatCapacity']||0x0;this[_0x88f5('0x10')]=0x0;this[_0x88f5('0x11')]=_0x88f5('0xe');this[_0x88f5('0x12')]=0x0;this[_0x88f5('0x13')]=_0x4b9dae[_0x88f5('0x13')]||0x0;this[_0x88f5('0x14')]=0x0;this['faxStatus']=_0x88f5('0xe');this[_0x88f5('0x15')]=0x0;this[_0x88f5('0x16')]=_0x4b9dae[_0x88f5('0x16')]||0x0;this[_0x88f5('0x17')]=0x0;this['smsStatus']='unknown';this[_0x88f5('0x18')]=0x0;this[_0x88f5('0x19')]=_0x4b9dae['smsCapacity']||0x0;this[_0x88f5('0x1a')]=0x0;this[_0x88f5('0x1b')]=_0x88f5('0xe');this[_0x88f5('0x1c')]=0x0;this['whatsappCapacity']=_0x4b9dae[_0x88f5('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x88f5('0xe');this['openchannelStatusTime']=0x0;this[_0x88f5('0x1e')]=_0x4b9dae[_0x88f5('0x1e')]||0x0;this[_0x88f5('0x1f')]=0x0;this[_0x88f5('0x20')]=![];this[_0x88f5('0x21')]=undefined;this[_0x88f5('0x0')]='';this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x557a96){if(this[_0x557a96+_0x88f5('0x22')]>0x0){if(this[_0x557a96+_0x88f5('0x23')]>0x0&&this[_0x557a96+'CurrentCapacity']>=this[_0x557a96+_0x88f5('0x23')]){return _0x88f5('0x24');}else{return _0x88f5('0x25');}}else{return'idle';}};Agent[_0x88f5('0x26')][_0x88f5('0x27')]=function(){var _0x2842a8=[_0x88f5('0x28'),'chat',_0x88f5('0x29'),_0x88f5('0x2a'),_0x88f5('0x2b'),_0x88f5('0x2c')];for(var _0x3bdd2d=0x0;_0x3bdd2d<_0x2842a8[_0x88f5('0x2d')];_0x3bdd2d+=0x1){var _0x378049=this[_0x88f5('0x2e')](_0x2842a8[_0x3bdd2d]);if(this[_0x2842a8[_0x3bdd2d]+_0x88f5('0x2f')]!==_0x378049){this[_0x2842a8[_0x3bdd2d]+_0x88f5('0x30')]=_['toNumber'](moment()[_0x88f5('0x31')]('x'));}this[_0x2842a8[_0x3bdd2d]+'Status']=_0x378049;}var _0x3022c5={'id':this['id'],'name':this[_0x88f5('0x6')],'online':this[_0x88f5('0x32')],'voicePause':this[_0x88f5('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x88f5('0x9')],'smsPause':this[_0x88f5('0xb')],'faxPause':this[_0x88f5('0xa')],'openchannelPause':this[_0x88f5('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x88f5('0x33')],'chatCurrentCapacity':this[_0x88f5('0x10')],'mailStatus':this[_0x88f5('0x11')],'mailStatusTime':this[_0x88f5('0x12')],'mailCapacity':this[_0x88f5('0x13')],'mailCurrentCapacity':this[_0x88f5('0x14')],'faxStatus':this[_0x88f5('0x34')],'faxStatusTime':this[_0x88f5('0x15')],'faxCapacity':this[_0x88f5('0x16')],'faxCurrentCapacity':this[_0x88f5('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x88f5('0x18')],'smsCapacity':this[_0x88f5('0x19')],'smsCurrentCapacity':this[_0x88f5('0x1a')],'whatsappStatus':this[_0x88f5('0x1b')],'whatsappStatusTime':this[_0x88f5('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x88f5('0x35')],'openchannelStatusTime':this[_0x88f5('0x36')],'openchannelCapacity':this[_0x88f5('0x1e')],'openchannelCurrentCapacity':this[_0x88f5('0x1f')],'busy':this[_0x88f5('0x20')],'busyQueue':this['busyQueue']};var _0x3663ac=md5(JSON[_0x88f5('0x37')](_0x3022c5));if(this['md5']!==_0x3663ac){this[_0x88f5('0x0')]=_0x3663ac;io['emit'](_0x88f5('0x38'),_0x3022c5);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 6e71078..a4e6c41 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 _0xd968=['prototype','mapAgentsId','map','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','Agents','waiting','updateRouting','updateRealtime'];(function(_0x5a8c3d,_0x255311){var _0x4723d8=function(_0x25d5ab){while(--_0x25d5ab){_0x5a8c3d['push'](_0x5a8c3d['shift']());}};_0x4723d8(++_0x255311);}(_0xd968,0x1e8));var _0x8d96=function(_0x1608f4,_0x169753){_0x1608f4=_0x1608f4-0x0;var _0x5a8d71=_0xd968[_0x1608f4];return _0x5a8d71;};'use strict';var _=require(_0x8d96('0x0'));var md5=require(_0x8d96('0x1'));var util=require(_0x8d96('0x2'));var Redis=require('ioredis');var config=require(_0x8d96('0x3'));config['redis']=_['defaults'](config[_0x8d96('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8d96('0x5'))(new Redis(config[_0x8d96('0x4')]));function ChatQueue(_0x33bf0c){this['id']=_0x33bf0c['id']||0x0;this['name']=_0x33bf0c[_0x8d96('0x6')]||'';this[_0x8d96('0x7')]=_0x33bf0c['timeout']||0xa;this['strategy']=_0x33bf0c['strategy']||'beepall';this[_0x8d96('0x8')]=_0x33bf0c[_0x8d96('0x8')];this['mapAgentsId']={};this[_0x8d96('0x9')]=0x0;this[_0x8d96('0x1')]='';this[_0x8d96('0xa')]();this[_0x8d96('0xb')]();}ChatQueue[_0x8d96('0xc')][_0x8d96('0xa')]=function(){var _0x5bf0f0=this['mapAgentsId']['_rr'];this[_0x8d96('0xd')]=_[_0x8d96('0xe')](this[_0x8d96('0x8')],'id');this[_0x8d96('0xd')]['_rr']=_0x5bf0f0;};ChatQueue[_0x8d96('0xc')][_0x8d96('0xb')]=function(){this[_0x8d96('0xf')]=0x0;this[_0x8d96('0x10')]=0x0;for(var _0x56d828=0x0;_0x56d828=0x0?this['available']:0x0;var _0x5a5f82={'id':this['id'],'available':this[_0x8d96('0x13')],'loggedIn':this[_0x8d96('0xf')],'name':this[_0x8d96('0x6')],'paused':this['paused'],'waiting':this[_0x8d96('0x9')]};var _0x3e4f5f=md5(JSON[_0x8d96('0x14')](_0x5a5f82));if(this['md5']!==_0x3e4f5f){this[_0x8d96('0x1')]=_0x3e4f5f;io['to'](util[_0x8d96('0x15')](_0x8d96('0x16'),_0x5a5f82[_0x8d96('0x6')]))[_0x8d96('0x17')](_0x8d96('0x18'),_0x5a5f82);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xbdb3=['strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','length','online','paused','loggedIn','available','md5','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','redis','defaults','name','timeout'];(function(_0x5f56ee,_0x4588c7){var _0xc5208b=function(_0x2048d3){while(--_0x2048d3){_0x5f56ee['push'](_0x5f56ee['shift']());}};_0xc5208b(++_0x4588c7);}(_0xbdb3,0x1c5));var _0x3bdb=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbdb3[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x3bdb('0x0'));var md5=require('md5');var util=require(_0x3bdb('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x3bdb('0x2')]=_[_0x3bdb('0x3')](config[_0x3bdb('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3bdb('0x2')]));function ChatQueue(_0x58cf72){this['id']=_0x58cf72['id']||0x0;this[_0x3bdb('0x4')]=_0x58cf72[_0x3bdb('0x4')]||'';this[_0x3bdb('0x5')]=_0x58cf72['timeout']||0xa;this['strategy']=_0x58cf72[_0x3bdb('0x6')]||_0x3bdb('0x7');this[_0x3bdb('0x8')]=_0x58cf72[_0x3bdb('0x8')];this['mapAgentsId']={};this[_0x3bdb('0x9')]=0x0;this['md5']='';this['updateRouting']();this[_0x3bdb('0xa')]();}ChatQueue[_0x3bdb('0xb')][_0x3bdb('0xc')]=function(){var _0x37b25b=this[_0x3bdb('0xd')][_0x3bdb('0xe')];this['mapAgentsId']=_[_0x3bdb('0xf')](this[_0x3bdb('0x8')],'id');this[_0x3bdb('0xd')][_0x3bdb('0xe')]=_0x37b25b;};ChatQueue[_0x3bdb('0xb')][_0x3bdb('0xa')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x544b6e=0x0;_0x544b6e=0x0?this['available']:0x0;var _0x145411={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3bdb('0x13')],'name':this[_0x3bdb('0x4')],'paused':this[_0x3bdb('0x12')],'waiting':this['waiting']};var _0x5df15c=md5(JSON['stringify'](_0x145411));if(this[_0x3bdb('0x15')]!==_0x5df15c){this['md5']=_0x5df15c;io['to'](util[_0x3bdb('0x16')](_0x3bdb('0x17'),_0x145411['name']))[_0x3bdb('0x18')](_0x3bdb('0x19'),_0x145411);}};module[_0x3bdb('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 0c0c8a9..e5ecabe 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 _0xc2e1=['exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc2e1,0xcc));var _0x1c2e=function(_0x4e220c,_0x13756b){_0x4e220c=_0x4e220c-0x0;var _0x4166bf=_0xc2e1[_0x4e220c];return _0x4166bf;};'use strict';var _=require(_0x1c2e('0x0'));var md5=require(_0x1c2e('0x1'));var util=require('util');var Redis=require(_0x1c2e('0x2'));var config=require(_0x1c2e('0x3'));config[_0x1c2e('0x4')]=_[_0x1c2e('0x5')](config[_0x1c2e('0x4')],{'host':_0x1c2e('0x6'),'port':0x18eb});var io=require(_0x1c2e('0x7'))(new Redis(config[_0x1c2e('0x4')]));function FaxQueue(_0x1497ec){this['id']=_0x1497ec['id']||0x0;this[_0x1c2e('0x8')]=_0x1497ec[_0x1c2e('0x8')]||'';this[_0x1c2e('0x9')]=_0x1497ec['timeout']||0xa;this['strategy']=_0x1497ec[_0x1c2e('0xa')]||_0x1c2e('0xb');this[_0x1c2e('0xc')]=_0x1497ec[_0x1c2e('0xc')];this[_0x1c2e('0xd')]={};this[_0x1c2e('0xe')]=0x0;this[_0x1c2e('0x1')]='';this[_0x1c2e('0xf')]();this[_0x1c2e('0x10')]();}FaxQueue['prototype'][_0x1c2e('0xf')]=function(){var _0xefe353=this[_0x1c2e('0xd')][_0x1c2e('0x11')];this['mapAgentsId']=_[_0x1c2e('0x12')](this[_0x1c2e('0xc')],'id');this[_0x1c2e('0xd')]['_rr']=_0xefe353;};FaxQueue[_0x1c2e('0x13')][_0x1c2e('0x10')]=function(){this[_0x1c2e('0x14')]=0x0;this[_0x1c2e('0x15')]=0x0;for(var _0x4f77af=0x0;_0x4f77af=0x0?this[_0x1c2e('0x18')]:0x0;var _0x50ddbb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1c2e('0x14')],'name':this['name'],'paused':this[_0x1c2e('0x15')],'waiting':this[_0x1c2e('0xe')]};var _0x7bb516=md5(JSON[_0x1c2e('0x19')](_0x50ddbb));if(this['md5']!==_0x7bb516){this[_0x1c2e('0x1')]=_0x7bb516;io['to'](util[_0x1c2e('0x1a')](_0x1c2e('0x1b'),_0x50ddbb[_0x1c2e('0x8')]))['emit']('fax_queue:save',_0x50ddbb);}};module[_0x1c2e('0x1c')]=FaxQueue; \ No newline at end of file +var _0x66b4=['fax:queue:%s','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','faxPause','available','stringify','format'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x66b4,0x8f));var _0x466b=function(_0x53d8c0,_0x2a06f8){_0x53d8c0=_0x53d8c0-0x0;var _0x5b0a94=_0x66b4[_0x53d8c0];return _0x5b0a94;};'use strict';var _=require('lodash');var md5=require(_0x466b('0x0'));var util=require(_0x466b('0x1'));var Redis=require(_0x466b('0x2'));var config=require(_0x466b('0x3'));config[_0x466b('0x4')]=_['defaults'](config[_0x466b('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x466b('0x5'))(new Redis(config[_0x466b('0x4')]));function FaxQueue(_0x3c6c87){this['id']=_0x3c6c87['id']||0x0;this[_0x466b('0x6')]=_0x3c6c87[_0x466b('0x6')]||'';this['timeout']=_0x3c6c87[_0x466b('0x7')]||0xa;this[_0x466b('0x8')]=_0x3c6c87[_0x466b('0x8')]||_0x466b('0x9');this[_0x466b('0xa')]=_0x3c6c87['Agents'];this[_0x466b('0xb')]={};this[_0x466b('0xc')]=0x0;this[_0x466b('0x0')]='';this[_0x466b('0xd')]();this['updateRealtime']();}FaxQueue[_0x466b('0xe')][_0x466b('0xd')]=function(){var _0x15e741=this[_0x466b('0xb')][_0x466b('0xf')];this[_0x466b('0xb')]=_[_0x466b('0x10')](this['Agents'],'id');this[_0x466b('0xb')]['_rr']=_0x15e741;};FaxQueue[_0x466b('0xe')][_0x466b('0x11')]=function(){this[_0x466b('0x12')]=0x0;this[_0x466b('0x13')]=0x0;for(var _0x443a6a=0x0;_0x443a6a=0x0?this[_0x466b('0x16')]:0x0;var _0x51f2d7={'id':this['id'],'available':this[_0x466b('0x16')],'loggedIn':this[_0x466b('0x12')],'name':this['name'],'paused':this[_0x466b('0x13')],'waiting':this[_0x466b('0xc')]};var _0x2090ba=md5(JSON[_0x466b('0x17')](_0x51f2d7));if(this[_0x466b('0x0')]!==_0x2090ba){this[_0x466b('0x0')]=_0x2090ba;io['to'](util[_0x466b('0x18')](_0x466b('0x19'),_0x51f2d7[_0x466b('0x6')]))['emit'](_0x466b('0x1a'),_0x51f2d7);}};module[_0x466b('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index c2809be..3da8515 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 _0x0c6f=['exports','name','Intervals'];(function(_0x2d53aa,_0xa66faf){var _0x15a28b=function(_0x519d00){while(--_0x519d00){_0x2d53aa['push'](_0x2d53aa['shift']());}};_0x15a28b(++_0xa66faf);}(_0x0c6f,0x1d2));var _0xf0c6=function(_0xdc8711,_0x23ee4b){_0xdc8711=_0xdc8711-0x0;var _0x51fc74=_0x0c6f[_0xdc8711];return _0x51fc74;};'use strict';function Interval(_0x3a3459){this['id']=_0x3a3459['id']||0x0;this['name']=_0x3a3459[_0xf0c6('0x0')]||'';this[_0xf0c6('0x1')]=_0x3a3459['Intervals']||{};}module[_0xf0c6('0x2')]=Interval; \ No newline at end of file +var _0x5fcd=['Intervals','exports','name'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5fcd,0x8f));var _0xd5fc=function(_0x23eef3,_0x1a506a){_0x23eef3=_0x23eef3-0x0;var _0x23ad4c=_0x5fcd[_0x23eef3];return _0x23ad4c;};'use strict';function Interval(_0x8653e2){this['id']=_0x8653e2['id']||0x0;this[_0xd5fc('0x0')]=_0x8653e2['name']||'';this[_0xd5fc('0x1')]=_0x8653e2[_0xd5fc('0x1')]||{};}module[_0xd5fc('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 9715d90..1a9ed2a 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 _0xb257=['loggedIn','length','online','available','paused','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x13840f,_0x28f5ed){var _0x5a0d4b=function(_0x23117f){while(--_0x23117f){_0x13840f['push'](_0x13840f['shift']());}};_0x5a0d4b(++_0x28f5ed);}(_0xb257,0x192));var _0x7b25=function(_0x6cc729,_0x42446f){_0x6cc729=_0x6cc729-0x0;var _0x5b10b6=_0xb257[_0x6cc729];return _0x5b10b6;};'use strict';var _=require(_0x7b25('0x0'));var md5=require(_0x7b25('0x1'));var util=require('util');var Redis=require(_0x7b25('0x2'));var config=require(_0x7b25('0x3'));config[_0x7b25('0x4')]=_[_0x7b25('0x5')](config[_0x7b25('0x4')],{'host':_0x7b25('0x6'),'port':0x18eb});var io=require(_0x7b25('0x7'))(new Redis(config['redis']));function MailQueue(_0x5e5504){this['id']=_0x5e5504['id']||0x0;this[_0x7b25('0x8')]=_0x5e5504[_0x7b25('0x8')]||'';this['timeout']=_0x5e5504[_0x7b25('0x9')]||0xa;this[_0x7b25('0xa')]=_0x5e5504['strategy']||'beepall';this[_0x7b25('0xb')]=_0x5e5504[_0x7b25('0xb')];this[_0x7b25('0xc')]={};this['waiting']=0x0;this[_0x7b25('0x1')]='';this[_0x7b25('0xd')]();this[_0x7b25('0xe')]();}MailQueue[_0x7b25('0xf')]['updateRouting']=function(){var _0xc697ac=this[_0x7b25('0xc')][_0x7b25('0x10')];this[_0x7b25('0xc')]=_[_0x7b25('0x11')](this[_0x7b25('0xb')],'id');this[_0x7b25('0xc')]['_rr']=_0xc697ac;};MailQueue[_0x7b25('0xf')][_0x7b25('0xe')]=function(){this[_0x7b25('0x12')]=0x0;this['paused']=0x0;for(var _0x2a7de2=0x0;_0x2a7de2=0x0?this[_0x7b25('0x15')]:0x0;var _0x23a30e={'id':this['id'],'available':this[_0x7b25('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x7b25('0x8')],'paused':this['paused'],'waiting':this[_0x7b25('0x17')]};var _0x375050=md5(JSON[_0x7b25('0x18')](_0x23a30e));if(this[_0x7b25('0x1')]!==_0x375050){this['md5']=_0x375050;io['to'](util[_0x7b25('0x19')](_0x7b25('0x1a'),_0x23a30e[_0x7b25('0x8')]))[_0x7b25('0x1b')](_0x7b25('0x1c'),_0x23a30e);}};module[_0x7b25('0x1d')]=MailQueue; \ No newline at end of file +var _0xff02=['online','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','prototype','loggedIn','paused','length'];(function(_0x281275,_0x283494){var _0x2805ed=function(_0xebd591){while(--_0xebd591){_0x281275['push'](_0x281275['shift']());}};_0x2805ed(++_0x283494);}(_0xff02,0x73));var _0x2ff0=function(_0x267b15,_0x5e042c){_0x267b15=_0x267b15-0x0;var _0x346a0c=_0xff02[_0x267b15];return _0x346a0c;};'use strict';var _=require(_0x2ff0('0x0'));var md5=require(_0x2ff0('0x1'));var util=require(_0x2ff0('0x2'));var Redis=require('ioredis');var config=require(_0x2ff0('0x3'));config[_0x2ff0('0x4')]=_['defaults'](config[_0x2ff0('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2ff0('0x5'))(new Redis(config[_0x2ff0('0x4')]));function MailQueue(_0x5d91dd){this['id']=_0x5d91dd['id']||0x0;this[_0x2ff0('0x6')]=_0x5d91dd[_0x2ff0('0x6')]||'';this[_0x2ff0('0x7')]=_0x5d91dd['timeout']||0xa;this[_0x2ff0('0x8')]=_0x5d91dd[_0x2ff0('0x8')]||_0x2ff0('0x9');this[_0x2ff0('0xa')]=_0x5d91dd['Agents'];this['mapAgentsId']={};this[_0x2ff0('0xb')]=0x0;this[_0x2ff0('0x1')]='';this[_0x2ff0('0xc')]();this[_0x2ff0('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x34451a=this[_0x2ff0('0xe')][_0x2ff0('0xf')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x2ff0('0xe')][_0x2ff0('0xf')]=_0x34451a;};MailQueue[_0x2ff0('0x10')][_0x2ff0('0xd')]=function(){this[_0x2ff0('0x11')]=0x0;this[_0x2ff0('0x12')]=0x0;for(var _0x5f2049=0x0;_0x5f2049=0x0?this[_0x2ff0('0x15')]:0x0;var _0x12f185={'id':this['id'],'available':this[_0x2ff0('0x15')],'loggedIn':this[_0x2ff0('0x11')],'name':this['name'],'paused':this[_0x2ff0('0x12')],'waiting':this[_0x2ff0('0xb')]};var _0x322a2a=md5(JSON[_0x2ff0('0x16')](_0x12f185));if(this['md5']!==_0x322a2a){this['md5']=_0x322a2a;io['to'](util['format'](_0x2ff0('0x17'),_0x12f185[_0x2ff0('0x6')]))[_0x2ff0('0x18')](_0x2ff0('0x19'),_0x12f185);}};module[_0x2ff0('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 3259e8f..d0bd6dd 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x7a54,0x106));var _0x47a5=function(_0x41049d,_0x35638f){_0x41049d=_0x41049d-0x0;var _0x31ae99=_0x7a54[_0x41049d];return _0x31ae99;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x1261,0x144));var _0x1126=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x1261[_0x5f46e7];return _0x567e95;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 92bbb9a..8406b07 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 _0x3e25=['mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents'];(function(_0xada38c,_0x550eb8){var _0x26545b=function(_0x6fe2dc){while(--_0x6fe2dc){_0xada38c['push'](_0xada38c['shift']());}};_0x26545b(++_0x550eb8);}(_0x3e25,0x14f));var _0x53e2=function(_0x30bfa3,_0x51d0b6){_0x30bfa3=_0x30bfa3-0x0;var _0x17660c=_0x3e25[_0x30bfa3];return _0x17660c;};'use strict';var _=require(_0x53e2('0x0'));var md5=require(_0x53e2('0x1'));var util=require(_0x53e2('0x2'));var Redis=require('ioredis');var config=require(_0x53e2('0x3'));config['redis']=_[_0x53e2('0x4')](config['redis'],{'host':_0x53e2('0x5'),'port':0x18eb});var io=require(_0x53e2('0x6'))(new Redis(config[_0x53e2('0x7')]));function SmsQueue(_0x476761){this['id']=_0x476761['id']||0x0;this[_0x53e2('0x8')]=_0x476761[_0x53e2('0x8')]||'';this[_0x53e2('0x9')]=_0x476761[_0x53e2('0x9')]||0xa;this[_0x53e2('0xa')]=_0x476761[_0x53e2('0xa')]||_0x53e2('0xb');this[_0x53e2('0xc')]=_0x476761[_0x53e2('0xc')];this[_0x53e2('0xd')]={};this[_0x53e2('0xe')]=0x0;this[_0x53e2('0x1')]='';this[_0x53e2('0xf')]();this[_0x53e2('0x10')]();}SmsQueue['prototype'][_0x53e2('0xf')]=function(){var _0x5cf96c=this['mapAgentsId']['_rr'];this[_0x53e2('0xd')]=_[_0x53e2('0x11')](this[_0x53e2('0xc')],'id');this[_0x53e2('0xd')][_0x53e2('0x12')]=_0x5cf96c;};SmsQueue[_0x53e2('0x13')][_0x53e2('0x10')]=function(){this[_0x53e2('0x14')]=0x0;this[_0x53e2('0x15')]=0x0;for(var _0x5d16e2=0x0;_0x5d16e2=0x0?this['available']:0x0;var _0x4213d0={'id':this['id'],'available':this[_0x53e2('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x53e2('0x8')],'paused':this['paused'],'waiting':this[_0x53e2('0xe')]};var _0x55a1ba=md5(JSON['stringify'](_0x4213d0));if(this[_0x53e2('0x1')]!==_0x55a1ba){this[_0x53e2('0x1')]=_0x55a1ba;io['to'](util[_0x53e2('0x19')](_0x53e2('0x1a'),_0x4213d0['name']))[_0x53e2('0x1b')](_0x53e2('0x1c'),_0x4213d0);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xc91b=['paused','available','waiting','stringify','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','length','online','smsPause'];(function(_0x4a889f,_0x1e7b9b){var _0x19cfdc=function(_0x4c05b8){while(--_0x4c05b8){_0x4a889f['push'](_0x4a889f['shift']());}};_0x19cfdc(++_0x1e7b9b);}(_0xc91b,0x16f));var _0xbc91=function(_0x460c4c,_0x504603){_0x460c4c=_0x460c4c-0x0;var _0x34fe96=_0xc91b[_0x460c4c];return _0x34fe96;};'use strict';var _=require(_0xbc91('0x0'));var md5=require(_0xbc91('0x1'));var util=require(_0xbc91('0x2'));var Redis=require(_0xbc91('0x3'));var config=require(_0xbc91('0x4'));config[_0xbc91('0x5')]=_[_0xbc91('0x6')](config[_0xbc91('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbc91('0x7'))(new Redis(config[_0xbc91('0x5')]));function SmsQueue(_0x4a88e3){this['id']=_0x4a88e3['id']||0x0;this[_0xbc91('0x8')]=_0x4a88e3[_0xbc91('0x8')]||'';this['timeout']=_0x4a88e3[_0xbc91('0x9')]||0xa;this[_0xbc91('0xa')]=_0x4a88e3[_0xbc91('0xa')]||_0xbc91('0xb');this[_0xbc91('0xc')]=_0x4a88e3[_0xbc91('0xc')];this[_0xbc91('0xd')]={};this['waiting']=0x0;this[_0xbc91('0x1')]='';this[_0xbc91('0xe')]();this[_0xbc91('0xf')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x304804=this[_0xbc91('0xd')]['_rr'];this['mapAgentsId']=_[_0xbc91('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xbc91('0x11')]=_0x304804;};SmsQueue[_0xbc91('0x12')][_0xbc91('0xf')]=function(){this[_0xbc91('0x13')]=0x0;this['paused']=0x0;for(var _0x5021da=0x0;_0x5021da=0x0?this[_0xbc91('0x18')]:0x0;var _0x439145={'id':this['id'],'available':this[_0xbc91('0x18')],'loggedIn':this[_0xbc91('0x13')],'name':this[_0xbc91('0x8')],'paused':this[_0xbc91('0x17')],'waiting':this[_0xbc91('0x19')]};var _0x546adc=md5(JSON[_0xbc91('0x1a')](_0x439145));if(this[_0xbc91('0x1')]!==_0x546adc){this[_0xbc91('0x1')]=_0x546adc;io['to'](util['format']('sms:queue:%s',_0x439145[_0xbc91('0x8')]))[_0xbc91('0x1b')](_0xbc91('0x1c'),_0x439145);}};module[_0xbc91('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 643af27..9fc994c 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 _0xe3fd=['redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','available','stringify','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x2e2568,_0x3f4818){var _0x58c455=function(_0x272a58){while(--_0x272a58){_0x2e2568['push'](_0x2e2568['shift']());}};_0x58c455(++_0x3f4818);}(_0xe3fd,0x8b));var _0xde3f=function(_0x4c0e74,_0x2b65e0){_0x4c0e74=_0x4c0e74-0x0;var _0x28e267=_0xe3fd[_0x4c0e74];return _0x28e267;};'use strict';var _=require(_0xde3f('0x0'));var md5=require(_0xde3f('0x1'));var util=require(_0xde3f('0x2'));var Redis=require(_0xde3f('0x3'));var config=require(_0xde3f('0x4'));config[_0xde3f('0x5')]=_['defaults'](config[_0xde3f('0x5')],{'host':_0xde3f('0x6'),'port':0x18eb});var io=require(_0xde3f('0x7'))(new Redis(config[_0xde3f('0x5')]));function WhatsappQueue(_0x192703){this['id']=_0x192703['id']||0x0;this[_0xde3f('0x8')]=_0x192703['name']||'';this[_0xde3f('0x9')]=_0x192703[_0xde3f('0x9')]||0xa;this[_0xde3f('0xa')]=_0x192703[_0xde3f('0xa')]||'beepall';this['Agents']=_0x192703[_0xde3f('0xb')];this[_0xde3f('0xc')]={};this[_0xde3f('0xd')]=0x0;this[_0xde3f('0x1')]='';this['updateRouting']();this[_0xde3f('0xe')]();}WhatsappQueue[_0xde3f('0xf')][_0xde3f('0x10')]=function(){var _0x9ee58d=this[_0xde3f('0xc')][_0xde3f('0x11')];this[_0xde3f('0xc')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xde3f('0x11')]=_0x9ee58d;};WhatsappQueue[_0xde3f('0xf')][_0xde3f('0xe')]=function(){this[_0xde3f('0x12')]=0x0;this[_0xde3f('0x13')]=0x0;for(var _0x131676=0x0;_0x131676=0x0?this['available']:0x0;var _0x472a51={'id':this['id'],'available':this[_0xde3f('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xde3f('0x8')],'paused':this[_0xde3f('0x13')],'waiting':this['waiting']};var _0x310799=md5(JSON[_0xde3f('0x17')](_0x472a51));if(this[_0xde3f('0x1')]!==_0x310799){this[_0xde3f('0x1')]=_0x310799;io['to'](util['format']('whatsapp:queue:%s',_0x472a51[_0xde3f('0x8')]))['emit']('whatsapp_queue:save',_0x472a51);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x298a=['util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','length','online','whatsappPause','paused','available','stringify','format','emit','lodash','md5'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x298a,0xc2));var _0xa298=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x298a[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xa298('0x0'));var md5=require(_0xa298('0x1'));var util=require(_0xa298('0x2'));var Redis=require(_0xa298('0x3'));var config=require(_0xa298('0x4'));config[_0xa298('0x5')]=_[_0xa298('0x6')](config['redis'],{'host':_0xa298('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa298('0x5')]));function WhatsappQueue(_0x26253c){this['id']=_0x26253c['id']||0x0;this[_0xa298('0x8')]=_0x26253c[_0xa298('0x8')]||'';this[_0xa298('0x9')]=_0x26253c[_0xa298('0x9')]||0xa;this[_0xa298('0xa')]=_0x26253c[_0xa298('0xa')]||_0xa298('0xb');this['Agents']=_0x26253c['Agents'];this[_0xa298('0xc')]={};this['waiting']=0x0;this[_0xa298('0x1')]='';this[_0xa298('0xd')]();this[_0xa298('0xe')]();}WhatsappQueue[_0xa298('0xf')][_0xa298('0xd')]=function(){var _0x56a0c2=this[_0xa298('0xc')][_0xa298('0x10')];this[_0xa298('0xc')]=_[_0xa298('0x11')](this[_0xa298('0x12')],'id');this[_0xa298('0xc')][_0xa298('0x10')]=_0x56a0c2;};WhatsappQueue[_0xa298('0xf')][_0xa298('0xe')]=function(){this[_0xa298('0x13')]=0x0;this['paused']=0x0;for(var _0x3764fc=0x0;_0x3764fc=0x0?this[_0xa298('0x18')]:0x0;var _0x54f140={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa298('0x13')],'name':this[_0xa298('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x48e2fa=md5(JSON[_0xa298('0x19')](_0x54f140));if(this['md5']!==_0x48e2fa){this[_0xa298('0x1')]=_0x48e2fa;io['to'](util[_0xa298('0x1a')]('whatsapp:queue:%s',_0x54f140[_0xa298('0x8')]))[_0xa298('0x1b')]('whatsapp_queue:save',_0x54f140);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index e0f8a06..2d371e0 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ea2f9a5..1fbaec4 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 _0x7e36=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0x7e36,0x17a));var _0x67e3=function(_0x499430,_0x344a19){_0x499430=_0x499430-0x0;var _0x1bf7e9=_0x7e36[_0x499430];return _0x1bf7e9;};'use strict';var client=require(_0x67e3('0x0'));exports[_0x67e3('0x1')]=function(_0x15db30,_0x5bdbf1){return client[_0x67e3('0x2')](_0x67e3('0x3'),{'body':_0x5bdbf1,'options':{'where':{'id':_0x15db30}},'log':_0x67e3('0x4')});};exports[_0x67e3('0x5')]=function(_0x10e00e,_0x27e357){return client[_0x67e3('0x2')](_0x67e3('0x6'),{'body':_0x27e357,'options':{'where':{'id':_0x10e00e}},'log':_0x67e3('0x7')});}; \ No newline at end of file +var _0x04af=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x531643,_0x4511c5){var _0xe2e8d=function(_0x9b2061){while(--_0x9b2061){_0x531643['push'](_0x531643['shift']());}};_0xe2e8d(++_0x4511c5);}(_0x04af,0x185));var _0xf04a=function(_0x3ca1a9,_0x5084f9){_0x3ca1a9=_0x3ca1a9-0x0;var _0x148d5d=_0x04af[_0x3ca1a9];return _0x148d5d;};'use strict';var client=require('../client');exports[_0xf04a('0x0')]=function(_0x14ca93,_0x5c3a9d){return client[_0xf04a('0x1')]('UpdateChatInteraction',{'body':_0x5c3a9d,'options':{'where':{'id':_0x14ca93}},'log':_0xf04a('0x2')});};exports[_0xf04a('0x3')]=function(_0x45bafc,_0x8b59aa){return client[_0xf04a('0x1')](_0xf04a('0x4'),{'body':_0x8b59aa,'options':{'where':{'id':_0x45bafc}},'log':_0xf04a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2b9d5ea..a6a7515 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 _0x4eb4=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x79ca7d,_0x3e373f){var _0x3ff258=function(_0x24a3ee){while(--_0x24a3ee){_0x79ca7d['push'](_0x79ca7d['shift']());}};_0x3ff258(++_0x3e373f);}(_0x4eb4,0x170));var _0x44eb=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x4eb4[_0x52e363];return _0x3fc2b5;};'use strict';var client=require('../client');exports[_0x44eb('0x0')]=function(_0x530dcd){return client[_0x44eb('0x1')](_0x44eb('0x2'),{'body':_0x530dcd,'log':_0x44eb('0x3')});}; \ No newline at end of file +var _0x34e0=['CreateChatMessage','createChatMessage','../client','create'];(function(_0x4f886a,_0x447a07){var _0x42c672=function(_0x1dfdca){while(--_0x1dfdca){_0x4f886a['push'](_0x4f886a['shift']());}};_0x42c672(++_0x447a07);}(_0x34e0,0x6a));var _0x034e=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x34e0[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0x034e('0x0'));exports[_0x034e('0x1')]=function(_0x51b899){return client['Request'](_0x034e('0x2'),{'body':_0x51b899,'log':_0x034e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 13113e2..5c3870b 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 _0x6b8f=['name','online','chatPause','getChatQueues','GetChatQueue','strategy','User'];(function(_0x47a8c0,_0x4d5931){var _0x551fa1=function(_0x45ac5a){while(--_0x45ac5a){_0x47a8c0['push'](_0x47a8c0['shift']());}};_0x551fa1(++_0x4d5931);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x3fa703,_0x1f5810){_0x3fa703=_0x3fa703-0x0;var _0x3f1b00=_0x6b8f[_0x3fa703];return _0x3f1b00;};'use strict';var client=require('../client');exports[_0xf6b8('0x0')]=function(){return function(){return client['Request'](_0xf6b8('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf6b8('0x2')],'include':[{'model':_0xf6b8('0x3'),'as':'Agents','attributes':['id',_0xf6b8('0x4'),_0xf6b8('0x5'),_0xf6b8('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x4350=['strategy','Agents','name','online','chatPause','../client','getChatQueues','GetChatQueue','timeout'];(function(_0x48f6ea,_0x5cb6ac){var _0x25c230=function(_0x5a3001){while(--_0x5a3001){_0x48f6ea['push'](_0x48f6ea['shift']());}};_0x25c230(++_0x5cb6ac);}(_0x4350,0x1d0));var _0x0435=function(_0x1607d4,_0x30ddc9){_0x1607d4=_0x1607d4-0x0;var _0x4c62a7=_0x4350[_0x1607d4];return _0x4c62a7;};'use strict';var client=require(_0x0435('0x0'));exports[_0x0435('0x1')]=function(){return function(){return client['Request'](_0x0435('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0435('0x3'),_0x0435('0x4')],'include':[{'model':'User','as':_0x0435('0x5'),'attributes':['id',_0x0435('0x6'),_0x0435('0x7'),_0x0435('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 09df43f..450104e 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 _0xdb13=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0xd68842,_0xdb7edb){var _0x4e391f=function(_0x7a3738){while(--_0x7a3738){_0xd68842['push'](_0xd68842['shift']());}};_0x4e391f(++_0xdb7edb);}(_0xdb13,0x10c));var _0x3db1=function(_0x5a9c44,_0x5ef144){_0x5a9c44=_0x5a9c44-0x0;var _0x50b5a0=_0xdb13[_0x5a9c44];return _0x50b5a0;};'use strict';var client=require('../client');exports[_0x3db1('0x0')]=function(_0x366725){return client[_0x3db1('0x1')](_0x3db1('0x2'),{'body':_0x366725,'log':_0x3db1('0x2')});};exports[_0x3db1('0x3')]=function(_0x581a73,_0x3352e3){return client[_0x3db1('0x1')](_0x3db1('0x4'),{'body':_0x3352e3,'options':{'where':{'uniqueid':_0x581a73},'order':[['id',_0x3db1('0x5')]],'limit':0x1},'log':_0x3db1('0x4')});}; \ No newline at end of file +var _0x34b2=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x4e0e26,_0x13a029){var _0x53b093=function(_0x39669b){while(--_0x39669b){_0x4e0e26['push'](_0x4e0e26['shift']());}};_0x53b093(++_0x13a029);}(_0x34b2,0x11c));var _0x234b=function(_0x34ddf1,_0x494e77){_0x34ddf1=_0x34ddf1-0x0;var _0x264cd6=_0x34b2[_0x34ddf1];return _0x264cd6;};'use strict';var client=require(_0x234b('0x0'));exports[_0x234b('0x1')]=function(_0x37a0f4){return client[_0x234b('0x2')](_0x234b('0x3'),{'body':_0x37a0f4,'log':_0x234b('0x3')});};exports[_0x234b('0x4')]=function(_0x224eb0,_0x43cd81){return client[_0x234b('0x2')](_0x234b('0x5'),{'body':_0x43cd81,'options':{'where':{'uniqueid':_0x224eb0},'order':[['id',_0x234b('0x6')]],'limit':0x1},'log':_0x234b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9f0271a..756e97d 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(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x7a54,0x106));var _0x47a5=function(_0x4ce4f3,_0x2a6b9f){_0x4ce4f3=_0x4ce4f3-0x0;var _0xddcdde=_0x7a54[_0x4ce4f3];return _0xddcdde;};'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(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0x7a54,0x106));var _0x47a5=function(_0x20a758,_0x519988){_0x20a758=_0x20a758-0x0;var _0x2289ec=_0x7a54[_0x20a758];return _0x2289ec;};'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 f2d03c2..2d1f010 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 _0xe8a2=['createFaxMessage','create','Request'];(function(_0x3285e9,_0x428b26){var _0x4eb6bf=function(_0x2cb78b){while(--_0x2cb78b){_0x3285e9['push'](_0x3285e9['shift']());}};_0x4eb6bf(++_0x428b26);}(_0xe8a2,0x17e));var _0x2e8a=function(_0x19b4df,_0x353118){_0x19b4df=_0x19b4df-0x0;var _0x13516c=_0xe8a2[_0x19b4df];return _0x13516c;};'use strict';var client=require('../client');exports[_0x2e8a('0x0')]=function(_0x5088c7){return client[_0x2e8a('0x1')]('CreateFaxMessage',{'body':_0x5088c7,'log':_0x2e8a('0x2')});}; \ No newline at end of file +var _0x38e8=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x34eb5a,_0x5c61fc){var _0x28c701=function(_0x513c9e){while(--_0x513c9e){_0x34eb5a['push'](_0x34eb5a['shift']());}};_0x28c701(++_0x5c61fc);}(_0x38e8,0xf2));var _0x838e=function(_0x47a3ed,_0x2844dd){_0x47a3ed=_0x47a3ed-0x0;var _0x51c984=_0x38e8[_0x47a3ed];return _0x51c984;};'use strict';var client=require(_0x838e('0x0'));exports[_0x838e('0x1')]=function(_0x227d89){return client[_0x838e('0x2')](_0x838e('0x3'),{'body':_0x227d89,'log':_0x838e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d35c8f7..97debbf 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 _0xc046=['GetFaxQueue','name','timeout','User','Agents','online','faxPause','../client','getFaxQueues','Request'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xc046,0x1dd));var _0x6c04=function(_0x1875c7,_0x2e58dc){_0x1875c7=_0x1875c7-0x0;var _0x5d23b6=_0xc046[_0x1875c7];return _0x5d23b6;};'use strict';var client=require(_0x6c04('0x0'));exports[_0x6c04('0x1')]=function(){return function(){return client[_0x6c04('0x2')](_0x6c04('0x3'),{'options':{'raw':![],'attributes':['id',_0x6c04('0x4'),_0x6c04('0x5'),'strategy'],'include':[{'model':_0x6c04('0x6'),'as':_0x6c04('0x7'),'attributes':['id',_0x6c04('0x4'),_0x6c04('0x8'),_0x6c04('0x9')]}]},'log':_0x6c04('0x1')});};}; \ No newline at end of file +var _0xd545=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','name','timeout'];(function(_0x1bfc4c,_0x13383e){var _0x141d23=function(_0x15a68c){while(--_0x15a68c){_0x1bfc4c['push'](_0x1bfc4c['shift']());}};_0x141d23(++_0x13383e);}(_0xd545,0x11d));var _0x5d54=function(_0x54ce28,_0x5eb92d){_0x54ce28=_0x54ce28-0x0;var _0x53e298=_0xd545[_0x54ce28];return _0x53e298;};'use strict';var client=require(_0x5d54('0x0'));exports[_0x5d54('0x1')]=function(){return function(){return client[_0x5d54('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x5d54('0x3'),_0x5d54('0x4'),_0x5d54('0x5')],'include':[{'model':_0x5d54('0x6'),'as':_0x5d54('0x7'),'attributes':['id',_0x5d54('0x3'),_0x5d54('0x8'),_0x5d54('0x9')]}]},'log':_0x5d54('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 6bcf4a1..5e12cff 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 _0x02fa=['update','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x349570,_0x40be36){var _0x13f81a=function(_0x3673c6){while(--_0x3673c6){_0x349570['push'](_0x349570['shift']());}};_0x13f81a(++_0x40be36);}(_0x02fa,0x74));var _0xa02f=function(_0x1535df,_0x3aecbe){_0x1535df=_0x1535df-0x0;var _0x2acb80=_0x02fa[_0x1535df];return _0x2acb80;};'use strict';var client=require(_0xa02f('0x0'));exports[_0xa02f('0x1')]=function(_0x5228b8){return client[_0xa02f('0x2')](_0xa02f('0x3'),{'body':_0x5228b8,'log':_0xa02f('0x3')});};exports[_0xa02f('0x4')]=function(_0x8edfab,_0x29a350){return client[_0xa02f('0x2')]('UpdateFaxQueueReport',{'body':_0x29a350,'options':{'where':{'uniqueid':_0x8edfab},'order':[['id','DESC']],'limit':0x1},'log':_0xa02f('0x5')});}; \ No newline at end of file +var _0x2e1a=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','Request'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x2e1a,0xd6));var _0xa2e1=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x2e1a[_0x2525f1];return _0x13c1b5;};'use strict';var client=require('../client');exports['create']=function(_0x268fec){return client[_0xa2e1('0x0')]('CreateFaxQueueReport',{'body':_0x268fec,'log':_0xa2e1('0x1')});};exports[_0xa2e1('0x2')]=function(_0x3e04cb,_0x242e1b){return client[_0xa2e1('0x0')](_0xa2e1('0x3'),{'body':_0x242e1b,'options':{'where':{'uniqueid':_0x3e04cb},'order':[['id',_0xa2e1('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index cce5658..c6243f0 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 _0xe1c0=['Request','GetInterval','name','Interval','Intervals','interval','getIntervals','../client'];(function(_0x3c8679,_0x2faea3){var _0x2791f8=function(_0x45b22f){while(--_0x45b22f){_0x3c8679['push'](_0x3c8679['shift']());}};_0x2791f8(++_0x2faea3);}(_0xe1c0,0x19f));var _0x0e1c=function(_0x44ce44,_0x565ff9){_0x44ce44=_0x44ce44-0x0;var _0x5c18d3=_0xe1c0[_0x44ce44];return _0x5c18d3;};'use strict';var client=require(_0x0e1c('0x0'));exports['getIntervals']=function(){return function(){return client[_0x0e1c('0x1')](_0x0e1c('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0e1c('0x3')],'include':[{'model':_0x0e1c('0x4'),'as':_0x0e1c('0x5'),'attributes':['id',_0x0e1c('0x3'),_0x0e1c('0x6')]}]},'log':_0x0e1c('0x7')});};}; \ No newline at end of file +var _0x6c96=['name','Interval','Intervals','interval','getIntervals','../client','GetInterval'];(function(_0x568c8a,_0x3ace4a){var _0xb3843a=function(_0x723d94){while(--_0x723d94){_0x568c8a['push'](_0x568c8a['shift']());}};_0xb3843a(++_0x3ace4a);}(_0x6c96,0x116));var _0x66c9=function(_0x462781,_0x91f959){_0x462781=_0x462781-0x0;var _0x330118=_0x6c96[_0x462781];return _0x330118;};'use strict';var client=require(_0x66c9('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0x66c9('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x66c9('0x2')],'include':[{'model':_0x66c9('0x3'),'as':_0x66c9('0x4'),'attributes':['id',_0x66c9('0x2'),_0x66c9('0x5')]}]},'log':_0x66c9('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e204dfa..f1a9fd7 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 _0xf4f4=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x5274af,_0x1488a6){var _0x5b617b=function(_0x56c603){while(--_0x56c603){_0x5274af['push'](_0x5274af['shift']());}};_0x5b617b(++_0x1488a6);}(_0xf4f4,0xe3));var _0x4f4f=function(_0xe78202,_0x200dd0){_0xe78202=_0xe78202-0x0;var _0xd44ff5=_0xf4f4[_0xe78202];return _0xd44ff5;};'use strict';var client=require(_0x4f4f('0x0'));exports[_0x4f4f('0x1')]=function(_0x533895,_0x16a496){return client[_0x4f4f('0x2')](_0x4f4f('0x3'),{'body':_0x16a496,'options':{'where':{'id':_0x533895}},'log':_0x4f4f('0x4')});};exports[_0x4f4f('0x5')]=function(_0x510b24,_0x5a752b){return client['Request'](_0x4f4f('0x6'),{'body':_0x5a752b,'options':{'where':{'id':_0x510b24}},'log':_0x4f4f('0x7')});}; \ No newline at end of file +var _0xb10b=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','Request'];(function(_0x171945,_0x29d57f){var _0x596eb2=function(_0x18b00f){while(--_0x18b00f){_0x171945['push'](_0x171945['shift']());}};_0x596eb2(++_0x29d57f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3aa321,_0x5bcde5){_0x3aa321=_0x3aa321-0x0;var _0x2bc5a5=_0xb10b[_0x3aa321];return _0x2bc5a5;};'use strict';var client=require(_0xbb10('0x0'));exports['update']=function(_0x390ae2,_0x35bc5f){return client[_0xbb10('0x1')]('UpdateMailInteraction',{'body':_0x35bc5f,'options':{'where':{'id':_0x390ae2}},'log':_0xbb10('0x2')});};exports[_0xbb10('0x3')]=function(_0x460981,_0x22320e){return client[_0xbb10('0x1')](_0xbb10('0x4'),{'body':_0x22320e,'options':{'where':{'id':_0x460981}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5597790..5a4751b 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 _0xf689=['create','Request','createMailMessage','../client'];(function(_0x3a23c1,_0x495d49){var _0x286863=function(_0x3accee){while(--_0x3accee){_0x3a23c1['push'](_0x3a23c1['shift']());}};_0x286863(++_0x495d49);}(_0xf689,0x14f));var _0x9f68=function(_0x532f28,_0x6d6ae1){_0x532f28=_0x532f28-0x0;var _0x195782=_0xf689[_0x532f28];return _0x195782;};'use strict';var client=require(_0x9f68('0x0'));exports[_0x9f68('0x1')]=function(_0x26bc9c){return client[_0x9f68('0x2')]('CreateMailMessage',{'body':_0x26bc9c,'log':_0x9f68('0x3')});}; \ No newline at end of file +var _0xd711=['Request','createMailMessage'];(function(_0x3d0701,_0x300c9c){var _0x51420d=function(_0x20dbed){while(--_0x20dbed){_0x3d0701['push'](_0x3d0701['shift']());}};_0x51420d(++_0x300c9c);}(_0xd711,0x164));var _0x1d71=function(_0x24a616,_0x1c541a){_0x24a616=_0x24a616-0x0;var _0x5afc3e=_0xd711[_0x24a616];return _0x5afc3e;};'use strict';var client=require('../client');exports['create']=function(_0x14793b){return client[_0x1d71('0x0')]('CreateMailMessage',{'body':_0x14793b,'log':_0x1d71('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 38f461f..0b8ad57 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 _0xf05e=['name','timeout','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x2e2334,_0x8ffa8b){var _0x31991c=function(_0x14c2bd){while(--_0x14c2bd){_0x2e2334['push'](_0x2e2334['shift']());}};_0x31991c(++_0x8ffa8b);}(_0xf05e,0xb1));var _0xef05=function(_0x33eb4d,_0x424628){_0x33eb4d=_0x33eb4d-0x0;var _0x310271=_0xf05e[_0x33eb4d];return _0x310271;};'use strict';var client=require(_0xef05('0x0'));exports[_0xef05('0x1')]=function(){return function(){return client['Request'](_0xef05('0x2'),{'options':{'raw':![],'attributes':['id',_0xef05('0x3'),_0xef05('0x4'),'strategy'],'include':[{'model':_0xef05('0x5'),'as':_0xef05('0x6'),'attributes':['id',_0xef05('0x3'),_0xef05('0x7'),_0xef05('0x8')]}]},'log':_0xef05('0x1')});};}; \ No newline at end of file +var _0x3c3b=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x3bb8e8,_0x568aae){var _0xf73ac8=function(_0xdec52a){while(--_0xdec52a){_0x3bb8e8['push'](_0x3bb8e8['shift']());}};_0xf73ac8(++_0x568aae);}(_0x3c3b,0x172));var _0xb3c3=function(_0x58cf62,_0x5971c3){_0x58cf62=_0x58cf62-0x0;var _0x2caacc=_0x3c3b[_0x58cf62];return _0x2caacc;};'use strict';var client=require('../client');exports[_0xb3c3('0x0')]=function(){return function(){return client[_0xb3c3('0x1')](_0xb3c3('0x2'),{'options':{'raw':![],'attributes':['id',_0xb3c3('0x3'),_0xb3c3('0x4'),_0xb3c3('0x5')],'include':[{'model':_0xb3c3('0x6'),'as':_0xb3c3('0x7'),'attributes':['id','name','online',_0xb3c3('0x8')]}]},'log':_0xb3c3('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7a830dd..17856f9 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 _0x0736=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0736,0x17b));var _0x6073=function(_0x4e38c7,_0x467ab3){_0x4e38c7=_0x4e38c7-0x0;var _0x445dd6=_0x0736[_0x4e38c7];return _0x445dd6;};'use strict';var client=require('../client');exports['create']=function(_0x534e8d){return client[_0x6073('0x0')](_0x6073('0x1'),{'body':_0x534e8d,'log':_0x6073('0x1')});};exports[_0x6073('0x2')]=function(_0x2dd7c0,_0x3928cc){return client[_0x6073('0x0')](_0x6073('0x3'),{'body':_0x3928cc,'options':{'where':{'uniqueid':_0x2dd7c0},'order':[['id',_0x6073('0x4')]],'limit':0x1},'log':_0x6073('0x3')});}; \ No newline at end of file +var _0x4247=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x4247,0xa1));var _0x7424=function(_0x1efeb6,_0x4d8a13){_0x1efeb6=_0x1efeb6-0x0;var _0x4eb829=_0x4247[_0x1efeb6];return _0x4eb829;};'use strict';var client=require(_0x7424('0x0'));exports[_0x7424('0x1')]=function(_0x218850){return client[_0x7424('0x2')](_0x7424('0x3'),{'body':_0x218850,'log':_0x7424('0x3')});};exports[_0x7424('0x4')]=function(_0x2c61e5,_0x28548e){return client[_0x7424('0x2')](_0x7424('0x5'),{'body':_0x28548e,'options':{'where':{'uniqueid':_0x2c61e5},'order':[['id',_0x7424('0x6')]],'limit':0x1},'log':_0x7424('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 4ea73f6..e791d30 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 _0xb71e=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x15ddc9,_0x209223){var _0x2fc9e8=function(_0x2d5e5f){while(--_0x2d5e5f){_0x15ddc9['push'](_0x15ddc9['shift']());}};_0x2fc9e8(++_0x209223);}(_0xb71e,0x18e));var _0xeb71=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xb71e[_0x556927];return _0x5f1235;};'use strict';var client=require(_0xeb71('0x0'));exports[_0xeb71('0x1')]=function(_0x5810e4,_0x4f0a57){return client[_0xeb71('0x2')](_0xeb71('0x3'),{'body':_0x4f0a57,'options':{'where':{'id':_0x5810e4}},'log':_0xeb71('0x4')});};exports[_0xeb71('0x5')]=function(_0x2d6a07,_0x48dcce){return client[_0xeb71('0x2')](_0xeb71('0x6'),{'body':_0x48dcce,'options':{'where':{'id':_0x2d6a07}},'log':_0xeb71('0x7')});}; \ No newline at end of file +var _0x1dcf=['UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','../client','update','Request'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0x1dcf,0xd4));var _0xf1dc=function(_0x232c13,_0x2103e6){_0x232c13=_0x232c13-0x0;var _0x31227d=_0x1dcf[_0x232c13];return _0x31227d;};'use strict';var client=require(_0xf1dc('0x0'));exports[_0xf1dc('0x1')]=function(_0x24d113,_0x5f59ec){return client[_0xf1dc('0x2')](_0xf1dc('0x3'),{'body':_0x5f59ec,'options':{'where':{'id':_0x24d113}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x329afc,_0x58dce0){return client[_0xf1dc('0x2')](_0xf1dc('0x4'),{'body':_0x58dce0,'options':{'where':{'id':_0x329afc}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 63a8e02..9f63d45 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 _0xef64=['CreateOpenchannelMessage','Request'];(function(_0x2fe27a,_0x286478){var _0x248e34=function(_0x344fc4){while(--_0x344fc4){_0x2fe27a['push'](_0x2fe27a['shift']());}};_0x248e34(++_0x286478);}(_0xef64,0x131));var _0x4ef6=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xef64[_0x45783c];return _0x1161da;};'use strict';var client=require('../client');exports['create']=function(_0x3348f5){return client[_0x4ef6('0x0')](_0x4ef6('0x1'),{'body':_0x3348f5,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x134d=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x134d,0x19b));var _0xd134=function(_0x4afe8f,_0x5240d1){_0x4afe8f=_0x4afe8f-0x0;var _0x43bbaa=_0x134d[_0x4afe8f];return _0x43bbaa;};'use strict';var client=require('../client');exports[_0xd134('0x0')]=function(_0x4c7538){return client[_0xd134('0x1')](_0xd134('0x2'),{'body':_0x4c7538,'log':_0xd134('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 29efa21..5edb9c2 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 _0x4fd5=['openchannelPause','../client','getOpenchannelQueues','Request','strategy','User','name','online'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x4fd5,0x89));var _0x54fd=function(_0x38f602,_0x3eaf80){_0x38f602=_0x38f602-0x0;var _0x465819=_0x4fd5[_0x38f602];return _0x465819;};'use strict';var client=require(_0x54fd('0x0'));exports[_0x54fd('0x1')]=function(){return function(){return client[_0x54fd('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x54fd('0x3')],'include':[{'model':_0x54fd('0x4'),'as':'Agents','attributes':['id',_0x54fd('0x5'),_0x54fd('0x6'),_0x54fd('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x48c3=['timeout','strategy','online','openchannelPause','getOpenchannelQueues','Request','name'];(function(_0x24106c,_0x367a6f){var _0xbaeb73=function(_0x483603){while(--_0x483603){_0x24106c['push'](_0x24106c['shift']());}};_0xbaeb73(++_0x367a6f);}(_0x48c3,0x16a));var _0x348c=function(_0x15b2e1,_0x2cb52e){_0x15b2e1=_0x15b2e1-0x0;var _0x2ea540=_0x48c3[_0x15b2e1];return _0x2ea540;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x348c('0x0')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x348c('0x1'),_0x348c('0x2'),_0x348c('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x348c('0x1'),_0x348c('0x4'),_0x348c('0x5')]}]},'log':_0x348c('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 251a3cf..6e662b3 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 _0x05b1=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x41aa18,_0x173515){var _0x4dc416=function(_0x1a6ec6){while(--_0x1a6ec6){_0x41aa18['push'](_0x41aa18['shift']());}};_0x4dc416(++_0x173515);}(_0x05b1,0x188));var _0x105b=function(_0x4caec5,_0x360194){_0x4caec5=_0x4caec5-0x0;var _0x10c628=_0x05b1[_0x4caec5];return _0x10c628;};'use strict';var client=require('../client');exports['create']=function(_0x1dac9f){return client[_0x105b('0x0')]('CreateOpenchannelQueueReport',{'body':_0x1dac9f,'log':_0x105b('0x1')});};exports['update']=function(_0x3c93d2,_0xc42a09){return client[_0x105b('0x0')](_0x105b('0x2'),{'body':_0xc42a09,'options':{'where':{'uniqueid':_0x3c93d2},'order':[['id',_0x105b('0x3')]],'limit':0x1},'log':_0x105b('0x2')});}; \ No newline at end of file +var _0xe330=['update','UpdateOpenchannelQueueReport','create','Request'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0xe330,0x96));var _0x0e33=function(_0x2073ce,_0x447987){_0x2073ce=_0x2073ce-0x0;var _0x1b675f=_0xe330[_0x2073ce];return _0x1b675f;};'use strict';var client=require('../client');exports[_0x0e33('0x0')]=function(_0x33c3b2){return client[_0x0e33('0x1')]('CreateOpenchannelQueueReport',{'body':_0x33c3b2,'log':'CreateOpenchannelQueueReport'});};exports[_0x0e33('0x2')]=function(_0x2cc7fe,_0x4d5e1b){return client[_0x0e33('0x1')](_0x0e33('0x3'),{'body':_0x4d5e1b,'options':{'where':{'uniqueid':_0x2cc7fe},'order':[['id','DESC']],'limit':0x1},'log':_0x0e33('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1707d6d..1752edf 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 _0xdab2=['updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x56b176,_0x2f0d88){var _0x20a790=function(_0x29c5c1){while(--_0x29c5c1){_0x56b176['push'](_0x56b176['shift']());}};_0x20a790(++_0x2f0d88);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2dab('0x0'));exports[_0x2dab('0x1')]=function(_0x50addb,_0x475660){return client[_0x2dab('0x2')](_0x2dab('0x3'),{'body':_0x475660,'options':{'where':{'id':_0x50addb}},'log':_0x2dab('0x4')});};exports['addTags']=function(_0x2078be,_0x2480cb){return client[_0x2dab('0x2')](_0x2dab('0x5'),{'body':_0x2480cb,'options':{'where':{'id':_0x2078be}},'log':_0x2dab('0x6')});}; \ No newline at end of file +var _0x142c=['Request','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x142c,0x86));var _0xc142=function(_0x9a41ad,_0x2b6a8f){_0x9a41ad=_0x9a41ad-0x0;var _0x446d06=_0x142c[_0x9a41ad];return _0x446d06;};'use strict';var client=require(_0xc142('0x0'));exports['update']=function(_0x434cec,_0x146a30){return client[_0xc142('0x1')]('UpdateSmsInteraction',{'body':_0x146a30,'options':{'where':{'id':_0x434cec}},'log':_0xc142('0x2')});};exports[_0xc142('0x3')]=function(_0x4fa56e,_0x47e43a){return client[_0xc142('0x1')]('AddTagsToSmsInteraction',{'body':_0x47e43a,'options':{'where':{'id':_0x4fa56e}},'log':_0xc142('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ae99110..bd2afb9 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 _0xa9c1=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9c1,0x196));var _0x1a9c=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9c1[_0xbe200f];return _0x192597;};'use strict';var client=require(_0x1a9c('0x0'));exports[_0x1a9c('0x1')]=function(_0x33f820){return client[_0x1a9c('0x2')](_0x1a9c('0x3'),{'body':_0x33f820,'log':_0x1a9c('0x4')});}; \ No newline at end of file +var _0xbfcf=['CreateSmsMessage','../client','create'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0xbfcf,0xfd));var _0xfbfc=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbfcf[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0xfbfc('0x0'));exports[_0xfbfc('0x1')]=function(_0x212cf3){return client['Request'](_0xfbfc('0x2'),{'body':_0x212cf3,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index cca4de7..3b3f80e 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x15c04a,_0x184803){var _0x2d9c0d=function(_0x4f61c3){while(--_0x4f61c3){_0x15c04a['push'](_0x15c04a['shift']());}};_0x2d9c0d(++_0x184803);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x2dcb4d,_0x10826a){var _0x2104af=function(_0x2333b6){while(--_0x2333b6){_0x2dcb4d['push'](_0x2dcb4d['shift']());}};_0x2104af(++_0x10826a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0xcb91[_0x4164f2];return _0x2575c7;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9fb92e6..356c53b 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x328c0d,_0x20e19c){var _0x5e56c2=function(_0x496234){while(--_0x496234){_0x328c0d['push'](_0x328c0d['shift']());}};_0x5e56c2(++_0x20e19c);}(_0x70e0,0x17b));var _0x070e=function(_0x370104,_0x68a0cb){_0x370104=_0x370104-0x0;var _0x6c8eba=_0x70e0[_0x370104];return _0x6c8eba;};'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 +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x236cfd,_0x2e576d){var _0x4b07b5=function(_0x65fd85){while(--_0x65fd85){_0x236cfd['push'](_0x236cfd['shift']());}};_0x4b07b5(++_0x2e576d);}(_0x55ca,0x126));var _0xa55c=function(_0xd0255a,_0x5ba91a){_0xd0255a=_0xd0255a-0x0;var _0x265f2d=_0x55ca[_0xd0255a];return _0x265f2d;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 20d8364..7742379 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(_0x556570,_0x1569ef){var _0x247496=function(_0x47adaf){while(--_0x47adaf){_0x556570['push'](_0x556570['shift']());}};_0x247496(++_0x1569ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x400380,_0x467cb4){var _0x533bc0=function(_0x1cfe96){while(--_0x1cfe96){_0x400380['push'](_0x400380['shift']());}};_0x533bc0(++_0x467cb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 0a0d52f..ad94911 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 _0xe1d3=['../client','update','Request','updateWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x131235,_0x4ec45e){var _0x116472=function(_0x8796ae){while(--_0x8796ae){_0x131235['push'](_0x131235['shift']());}};_0x116472(++_0x4ec45e);}(_0xe1d3,0x159));var _0x3e1d=function(_0x10e6d2,_0x1b2c04){_0x10e6d2=_0x10e6d2-0x0;var _0x3b3c9f=_0xe1d3[_0x10e6d2];return _0x3b3c9f;};'use strict';var client=require(_0x3e1d('0x0'));exports[_0x3e1d('0x1')]=function(_0x1aa7c7,_0x1340c7){return client[_0x3e1d('0x2')]('UpdateWhatsappInteraction',{'body':_0x1340c7,'options':{'where':{'id':_0x1aa7c7}},'log':_0x3e1d('0x3')});};exports['addTags']=function(_0x23f59b,_0x38df15){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x38df15,'options':{'where':{'id':_0x23f59b}},'log':_0x3e1d('0x4')});}; \ No newline at end of file +var _0x044a=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x58dd12,_0x4089cc){var _0xffe51=function(_0x4dc4ac){while(--_0x4dc4ac){_0x58dd12['push'](_0x58dd12['shift']());}};_0xffe51(++_0x4089cc);}(_0x044a,0x173));var _0xa044=function(_0x49f236,_0x508db6){_0x49f236=_0x49f236-0x0;var _0x1fee1a=_0x044a[_0x49f236];return _0x1fee1a;};'use strict';var client=require(_0xa044('0x0'));exports[_0xa044('0x1')]=function(_0x2ea3b8,_0x1aafce){return client[_0xa044('0x2')](_0xa044('0x3'),{'body':_0x1aafce,'options':{'where':{'id':_0x2ea3b8}},'log':_0xa044('0x4')});};exports[_0xa044('0x5')]=function(_0x25ed77,_0x116358){return client['Request'](_0xa044('0x6'),{'body':_0x116358,'options':{'where':{'id':_0x25ed77}},'log':_0xa044('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 7b50afe..438c0a3 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 _0x5734=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x19ee96,_0x48b7d5){var _0x57aaf0=function(_0x26f332){while(--_0x26f332){_0x19ee96['push'](_0x19ee96['shift']());}};_0x57aaf0(++_0x48b7d5);}(_0x5734,0x1a3));var _0x4573=function(_0xda501a,_0x159d6a){_0xda501a=_0xda501a-0x0;var _0x44be3a=_0x5734[_0xda501a];return _0x44be3a;};'use strict';var client=require('../client');exports[_0x4573('0x0')]=function(_0x30f97f){return client['Request'](_0x4573('0x1'),{'body':_0x30f97f,'log':_0x4573('0x2')});}; \ No newline at end of file +var _0x7557=['create','Request','createWhatsappMessage'];(function(_0x85a89f,_0xb533f7){var _0x55d024=function(_0x58ed8e){while(--_0x58ed8e){_0x85a89f['push'](_0x85a89f['shift']());}};_0x55d024(++_0xb533f7);}(_0x7557,0x13b));var _0x7755=function(_0x2b73f2,_0xaf9d15){_0x2b73f2=_0x2b73f2-0x0;var _0x4713fd=_0x7557[_0x2b73f2];return _0x4713fd;};'use strict';var client=require('../client');exports[_0x7755('0x0')]=function(_0x4c48bf){return client[_0x7755('0x1')]('CreateWhatsappMessage',{'body':_0x4c48bf,'log':_0x7755('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ee4d37f..07269ae 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 _0x3b9f=['online','whatsappPause','../client','getWhatsappQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x1c5186,_0x371ab7){var _0x2f5674=function(_0x481c34){while(--_0x481c34){_0x1c5186['push'](_0x1c5186['shift']());}};_0x2f5674(++_0x371ab7);}(_0x3b9f,0xfc));var _0xf3b9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3b9f[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0xf3b9('0x0'));exports[_0xf3b9('0x1')]=function(){return function(){return client[_0xf3b9('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xf3b9('0x3'),_0xf3b9('0x4'),_0xf3b9('0x5')],'include':[{'model':_0xf3b9('0x6'),'as':_0xf3b9('0x7'),'attributes':['id',_0xf3b9('0x3'),_0xf3b9('0x8'),_0xf3b9('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x1f9a=['name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue'];(function(_0xe48e98,_0x49e854){var _0x51e227=function(_0x17fb0a){while(--_0x17fb0a){_0xe48e98['push'](_0xe48e98['shift']());}};_0x51e227(++_0x49e854);}(_0x1f9a,0x18d));var _0xa1f9=function(_0x54dc50,_0x4cbb84){_0x54dc50=_0x54dc50-0x0;var _0x1ed6fa=_0x1f9a[_0x54dc50];return _0x1ed6fa;};'use strict';var client=require(_0xa1f9('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xa1f9('0x1')](_0xa1f9('0x2'),{'options':{'raw':![],'attributes':['id',_0xa1f9('0x3'),_0xa1f9('0x4'),_0xa1f9('0x5')],'include':[{'model':_0xa1f9('0x6'),'as':'Agents','attributes':['id','name',_0xa1f9('0x7'),_0xa1f9('0x8')]}]},'log':_0xa1f9('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 523c704..d7cc1ca 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 _0x6c81=['create','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x4574d9,_0x224f1a){var _0x30cea4=function(_0x4d26a5){while(--_0x4d26a5){_0x4574d9['push'](_0x4574d9['shift']());}};_0x30cea4(++_0x224f1a);}(_0x6c81,0xb5));var _0x16c8=function(_0x42946c,_0x577d97){_0x42946c=_0x42946c-0x0;var _0x5d7687=_0x6c81[_0x42946c];return _0x5d7687;};'use strict';var client=require(_0x16c8('0x0'));exports[_0x16c8('0x1')]=function(_0x57f848){return client[_0x16c8('0x2')]('CreateWhatsappQueueReport',{'body':_0x57f848,'log':_0x16c8('0x3')});};exports[_0x16c8('0x4')]=function(_0x5b91f5,_0x334595){return client[_0x16c8('0x2')]('UpdateWhatsappQueueReport',{'body':_0x334595,'options':{'where':{'uniqueid':_0x5b91f5},'order':[['id',_0x16c8('0x5')]],'limit':0x1},'log':_0x16c8('0x6')});}; \ No newline at end of file +var _0xfc5a=['update','DESC','UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport'];(function(_0x2469e9,_0x2385b4){var _0x10b682=function(_0x44f7ce){while(--_0x44f7ce){_0x2469e9['push'](_0x2469e9['shift']());}};_0x10b682(++_0x2385b4);}(_0xfc5a,0x105));var _0xafc5=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0xfc5a[_0x5c4d27];return _0x1dda1a;};'use strict';var client=require(_0xafc5('0x0'));exports['create']=function(_0x70b9ba){return client[_0xafc5('0x1')](_0xafc5('0x2'),{'body':_0x70b9ba,'log':_0xafc5('0x2')});};exports[_0xafc5('0x3')]=function(_0x186a8a,_0x3bf147){return client[_0xafc5('0x1')]('UpdateWhatsappQueueReport',{'body':_0x3bf147,'options':{'where':{'uniqueid':_0x186a8a},'order':[['id',_0xafc5('0x4')]],'limit':0x1},'log':_0xafc5('0x5')});}; \ 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 3047f12..ddcc7e6 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 _0x5827=['stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','log'];(function(_0x4f3b10,_0x35cc88){var _0x454404=function(_0x28fecf){while(--_0x28fecf){_0x4f3b10['push'](_0x4f3b10['shift']());}};_0x454404(++_0x35cc88);}(_0x5827,0x15f));var _0x7582=function(_0x23cd3e,_0x4cd643){_0x23cd3e=_0x23cd3e-0x0;var _0x42c132=_0x5827[_0x23cd3e];return _0x42c132;};'use strict';var schema=require(_0x7582('0x0'));var _=require(_0x7582('0x1'));var util=require(_0x7582('0x2'));var seqqueue=require(_0x7582('0x3'));var logger=require(_0x7582('0x4'))(_0x7582('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x7582('0x6'),'required':!![],'message':_0x7582('0x7')},'timeout':{'type':'number','message':_0x7582('0x8')}});function writeLog(_0x489b62,_0xdd8f6,_0x2f3052){return logger['info'](util[_0x7582('0x9')](_0x7582('0xa'),_0x489b62,_0xdd8f6[_0x7582('0xb')],_0x2f3052));}function handleFindAgent(_0x311f3a){return function(_0x2754ac){return _0x2754ac[_0x7582('0xb')][_0x7582('0xc')]()===_0x311f3a[_0x7582('0xc')]();};}exports[_0x7582('0xd')]=function(_0x5c7e73,_0x49552e,_0x42fe60,_0x37154a){return function(_0x59d08b){try{var _0x441171={'name':_0x49552e[0x0],'timeout':_0x49552e[0x1]};var _0x540d51=queue[_0x7582('0x0')](_0x441171,{'typecast':!![]});if(_0x540d51[_0x7582('0xe')]){logger[_0x7582('0xf')](_0x7582('0x10'),_0x5c7e73,_[_0x7582('0x11')](_0x540d51,_0x7582('0x12'))[_0x7582('0x13')](',\x20'));_0x59d08b[_0x7582('0x14')]();}else{var _0x49961c=_[_0x7582('0x15')](_0x42fe60[_0x7582('0x16')],handleFindAgent(_0x441171[_0x7582('0xb')]));if(_0x49961c){var _0x3b187a=(_0x441171[_0x7582('0x17')]||0xa)*0x3e8;var _0xf0f5a2,_0x4c0278;var _0x161508=seqqueue[_0x7582('0x18')](_0x3b187a);_0x161508['id']=_0x5c7e73;_0x161508[_0x7582('0x19')]=_0x3b187a;_0x161508[_0x7582('0x1a')]=_0x37154a[_0x7582('0x1a')];writeLog(_0x5c7e73,_0x49961c,util[_0x7582('0x9')]('START:%s',_0x3b187a));_0x42fe60[_0x7582('0x1b')][_0x5c7e73]['on'](_0x7582('0x1c'),function(){logger[_0x7582('0x1d')](_0x7582('0x1e'),_0x5c7e73);clearTimeout(_0x4c0278);_0x4c0278=undefined;_0x161508[_0x7582('0x1f')]();if(_0x42fe60[_0x7582('0x1b')][_0x5c7e73]){delete _0x42fe60[_0x7582('0x1b')][_0x5c7e73];}_0x59d08b['stop']();});_0x42fe60[_0x7582('0x1b')][_0x5c7e73]['on']('complete',function(){if(_0x42fe60[_0x7582('0x1b')][_0x5c7e73]){delete _0x42fe60[_0x7582('0x1b')][_0x5c7e73];}});_0x4c0278=setTimeout(function(){logger[_0x7582('0x1d')]('[%s][AGENT]\x20ROUTING\x20END',_0x5c7e73);clearTimeout(_0x4c0278);_0x161508['close']();_0x59d08b[_0x7582('0x20')]();},_0x3b187a);strategy['agent'](_0x161508,_0x49961c,_0x42fe60,_0x37154a);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x5c7e73,_0x441171['name']);_0x59d08b[_0x7582('0x14')]();}}}catch(_0x34def3){console[_0x7582('0x21')](_0x34def3);logger['error']('[%s][QUEUE]\x20%s',_0x5c7e73,_0x34def3[_0x7582('0x22')]);_0x59d08b[_0x7582('0x14')]();}};}; \ No newline at end of file +var _0xabd6=['seq-queue','../../../../config/logger','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','util'];(function(_0x3b40c3,_0x267338){var _0x140b40=function(_0x17ee3f){while(--_0x17ee3f){_0x3b40c3['push'](_0x3b40c3['shift']());}};_0x140b40(++_0x267338);}(_0xabd6,0x64));var _0x6abd=function(_0x11ba83,_0xd5611a){_0x11ba83=_0x11ba83-0x0;var _0x3f3925=_0xabd6[_0x11ba83];return _0x3f3925;};'use strict';var schema=require(_0x6abd('0x0'));var _=require('lodash');var util=require(_0x6abd('0x1'));var seqqueue=require(_0x6abd('0x2'));var logger=require(_0x6abd('0x3'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x6abd('0x4')},'timeout':{'type':_0x6abd('0x5'),'message':_0x6abd('0x6')}});function writeLog(_0xf70336,_0x4dc3f1,_0x111196){return logger[_0x6abd('0x7')](util[_0x6abd('0x8')](_0x6abd('0x9'),_0xf70336,_0x4dc3f1[_0x6abd('0xa')],_0x111196));}function handleFindAgent(_0x104f9f){return function(_0x4b358d){return _0x4b358d['name'][_0x6abd('0xb')]()===_0x104f9f[_0x6abd('0xb')]();};}exports[_0x6abd('0xc')]=function(_0x3378a1,_0x452004,_0x107ddc,_0x17f0e8){return function(_0xbb54a){try{var _0x10593f={'name':_0x452004[0x0],'timeout':_0x452004[0x1]};var _0x535701=queue[_0x6abd('0x0')](_0x10593f,{'typecast':!![]});if(_0x535701[_0x6abd('0xd')]){logger[_0x6abd('0xe')](_0x6abd('0xf'),_0x3378a1,_[_0x6abd('0x10')](_0x535701,_0x6abd('0x11'))[_0x6abd('0x12')](',\x20'));_0xbb54a[_0x6abd('0x13')]();}else{var _0x52164d=_['find'](_0x107ddc[_0x6abd('0x14')],handleFindAgent(_0x10593f['name']));if(_0x52164d){var _0x444ad6=(_0x10593f[_0x6abd('0x15')]||0xa)*0x3e8;var _0xd4ea8d,_0x56cdd0;var _0x2cc511=seqqueue[_0x6abd('0x16')](_0x444ad6);_0x2cc511['id']=_0x3378a1;_0x2cc511['atimeout']=_0x444ad6;_0x2cc511[_0x6abd('0x17')]=_0x17f0e8['channel'];writeLog(_0x3378a1,_0x52164d,util[_0x6abd('0x8')]('START:%s',_0x444ad6));_0x107ddc[_0x6abd('0x18')][_0x3378a1]['on'](_0x6abd('0x19'),function(){logger['info'](_0x6abd('0x1a'),_0x3378a1);clearTimeout(_0x56cdd0);_0x56cdd0=undefined;_0x2cc511[_0x6abd('0x1b')]();if(_0x107ddc[_0x6abd('0x18')][_0x3378a1]){delete _0x107ddc[_0x6abd('0x18')][_0x3378a1];}_0xbb54a[_0x6abd('0x13')]();});_0x107ddc[_0x6abd('0x18')][_0x3378a1]['on'](_0x6abd('0x1c'),function(){if(_0x107ddc[_0x6abd('0x18')][_0x3378a1]){delete _0x107ddc['rules'][_0x3378a1];}});_0x56cdd0=setTimeout(function(){logger['info'](_0x6abd('0x1d'),_0x3378a1);clearTimeout(_0x56cdd0);_0x2cc511[_0x6abd('0x1b')]();_0xbb54a['next']();},_0x444ad6);strategy[_0x6abd('0x1e')](_0x2cc511,_0x52164d,_0x107ddc,_0x17f0e8);}else{logger[_0x6abd('0xe')](_0x6abd('0x1f'),_0x3378a1,_0x10593f[_0x6abd('0xa')]);_0xbb54a['stop']();}}}catch(_0x585595){console[_0x6abd('0x20')](_0x585595);logger[_0x6abd('0xe')]('[%s][QUEUE]\x20%s',_0x3378a1,_0x585595[_0x6abd('0x21')]);_0xbb54a[_0x6abd('0x13')]();}};}; \ 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 2885087..c9f7cdc 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 _0xecf2=['lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','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','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','amazonlex','dialogState','Failed','catch','stringify'];(function(_0x3beaa0,_0x3f8233){var _0x2856a1=function(_0x25f1a6){while(--_0x25f1a6){_0x3beaa0['push'](_0x3beaa0['shift']());}};_0x2856a1(++_0x3f8233);}(_0xecf2,0xff));var _0x2ecf=function(_0x410756,_0x30e52e){_0x410756=_0x410756-0x0;var _0x3c2bdf=_0xecf2[_0x410756];return _0x3c2bdf;};'use strict';var _=require(_0x2ecf('0x0'));var moment=require(_0x2ecf('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x2ecf('0x2'))(_0x2ecf('0x3'));var rpc={'chatMessage':require(_0x2ecf('0x4')),'openchannelMessage':require(_0x2ecf('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2ecf('0x6')),'faxMessage':require(_0x2ecf('0x7')),'whatsappMessage':require(_0x2ecf('0x8'))};exports[_0x2ecf('0x9')]=function(_0x28e44a,_0x4763f9){return function(_0x173038){try{if(!_[_0x2ecf('0xa')](this[_0x2ecf('0xb')][_0x2ecf('0xc')])){logger[_0x2ecf('0xd')](_0x2ecf('0xe'),_0x28e44a,_0x2ecf('0xf'));return _0x173038[_0x2ecf('0x10')]();}var _0xabecff={'ContactId':this[_0x2ecf('0x11')]['id'],'sentAt':moment()[_0x2ecf('0x12')](_0x2ecf('0x13')),'direction':_0x2ecf('0x14')};if(this['channel']===_0x2ecf('0x15')||this['channel']===_0x2ecf('0x16')){_0xabecff[_0x2ecf('0x17')]=this['interaction']['phone'];}var _0xd9abaa=this[_0x2ecf('0x18')];if(_0xd9abaa===_0x2ecf('0x19')){_0xabecff[_0x2ecf('0x1a')]=this[_0x2ecf('0x1b')]['id'];}else{_0xabecff[_[_0x2ecf('0x1c')](_0xd9abaa)+_0x2ecf('0x1d')]=this[_0x2ecf('0x1b')]['id'];}_0xabecff[_[_0x2ecf('0x1c')](_0xd9abaa)+_0x2ecf('0x1e')]=this[_0x2ecf('0xb')]['id'];if(this[_0x2ecf('0xb')][_0x2ecf('0x1f')]){var _0x233e57=_0x4763f9[0x4];if(!_[_0x2ecf('0x20')](_0x233e57)){_0xabecff[_0x2ecf('0x21')]=utils[_0x2ecf('0x22')](_0x233e57,this);return rpc[_0xd9abaa+_0x2ecf('0x23')][_0x2ecf('0x24')](_0xabecff)[_0x2ecf('0x25')](function(_0x34800d){logger['info'](_0x2ecf('0xe'),_0x28e44a,_0xabecff[_0x2ecf('0x21')]);})['catch'](function(_0x4d37be){logger[_0x2ecf('0x26')](_0x2ecf('0xe'),_0x28e44a,JSON['stringify'](_0x4d37be));})['finally'](function(){logger[_0x2ecf('0xd')](_0x2ecf('0x27'),_0x28e44a);_0x173038[_0x2ecf('0x28')]();});}else{logger[_0x2ecf('0xd')](_0x2ecf('0x29'),_0x28e44a);_0x173038[_0x2ecf('0x28')]();}}else{var _0x306001=this;var _0x30ee3a=new AWS[(_0x2ecf('0x2a'))]({'accessKeyId':_0x4763f9[0x0],'secretAccessKey':_0x4763f9[0x1],'region':_0x4763f9[0x2]});var _0x4ae459={'botAlias':_0x2ecf('0x2b'),'botName':_0x4763f9[0x3],'inputText':this[_0x2ecf('0x2c')]['body'],'userId':this[_0x2ecf('0x18')]+':'+this['interaction']['id'][_0x2ecf('0x2d')]()};_0x30ee3a['postText'](_0x4ae459,function(_0x2b5400,_0x4b6f07){if(_0x2b5400){logger[_0x2ecf('0x26')](_0x2ecf('0xe'),_0x28e44a,_0x2b5400[_0x2ecf('0x2c')]);_0x173038[_0x2ecf('0x10')]();}else if(_0x4b6f07&&_0x4b6f07[_0x2ecf('0x2c')]){_0x306001[_0x2ecf('0x21')][_0x2ecf('0x2e')]=_0x4b6f07;_0xabecff[_0x2ecf('0x21')]=_0x4b6f07['message'];_0xabecff['providerName']=_0x2ecf('0x2e');_0xabecff['providerResponse']=JSON['stringify'](_0x4b6f07);return rpc[_0xd9abaa+_0x2ecf('0x23')][_0x2ecf('0x24')](_0xabecff)['then'](function(_0x59fc1e){logger[_0x2ecf('0xd')]('[%s][AMAZONLEX]\x20%s',_0x28e44a,_0xabecff[_0x2ecf('0x21')]);if(_0x4b6f07[_0x2ecf('0x2f')]==_0x2ecf('0x30')){_0x173038[_0x2ecf('0x10')]();}else{_0x173038[_0x2ecf('0x28')]();}})[_0x2ecf('0x31')](function(_0x2f07b1){logger[_0x2ecf('0x26')](_0x2ecf('0xe'),_0x28e44a,JSON['stringify'](_0x2f07b1));_0x173038[_0x2ecf('0x10')]();});}else{_0x173038['next']();}});}}catch(_0x946144){logger[_0x2ecf('0x26')]('[%s][AMAZONLEX]\x20%s',_0x28e44a,JSON[_0x2ecf('0x32')](_0x946144));_0x173038[_0x2ecf('0x28')]();}};}; \ No newline at end of file +var _0x5296=['routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','body','Message','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','amazonlex','create','dialogState','lodash','aws-sdk','./utils'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x5296,0x1a4));var _0x6529=function(_0x432d6e,_0xd80460){_0x432d6e=_0x432d6e-0x0;var _0x165a84=_0x5296[_0x432d6e];return _0x165a84;};'use strict';var _=require(_0x6529('0x0'));var moment=require('moment');var AWS=require(_0x6529('0x1'));var utils=require(_0x6529('0x2'));var logger=require('../../../../config/logger')(_0x6529('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6529('0x4')),'mailMessage':require(_0x6529('0x5')),'smsMessage':require(_0x6529('0x6')),'faxMessage':require(_0x6529('0x7')),'whatsappMessage':require(_0x6529('0x8'))};exports['consequence']=function(_0x230966,_0x1a76b0){return function(_0x4eb4bc){try{if(!_[_0x6529('0x9')](this[_0x6529('0xa')][_0x6529('0xb')])){logger[_0x6529('0xc')]('[%s][AMAZONLEX]\x20%s',_0x230966,_0x6529('0xd'));return _0x4eb4bc[_0x6529('0xe')]();}var _0x2ba1c0={'ContactId':this[_0x6529('0xf')]['id'],'sentAt':moment()[_0x6529('0x10')](_0x6529('0x11')),'direction':_0x6529('0x12')};if(this[_0x6529('0x13')]===_0x6529('0x14')||this[_0x6529('0x13')]===_0x6529('0x15')){_0x2ba1c0[_0x6529('0x16')]=this[_0x6529('0xa')][_0x6529('0x16')];}var _0x249392=this[_0x6529('0x13')];if(_0x249392===_0x6529('0x17')){_0x2ba1c0[_0x6529('0x18')]=this[_0x6529('0x19')]['id'];}else{_0x2ba1c0[_[_0x6529('0x1a')](_0x249392)+_0x6529('0x1b')]=this['account']['id'];}_0x2ba1c0[_[_0x6529('0x1a')](_0x249392)+_0x6529('0x1c')]=this[_0x6529('0xa')]['id'];if(this[_0x6529('0xa')]['created']){var _0x296657=_0x1a76b0[0x4];if(!_['isEmpty'](_0x296657)){_0x2ba1c0[_0x6529('0x1d')]=utils['getMustacheRender'](_0x296657,this);return rpc[_0x249392+_0x6529('0x1e')]['create'](_0x2ba1c0)[_0x6529('0x1f')](function(_0x2b7740){logger['info'](_0x6529('0x20'),_0x230966,_0x2ba1c0[_0x6529('0x1d')]);})[_0x6529('0x21')](function(_0x449447){logger[_0x6529('0x22')]('[%s][AMAZONLEX]\x20%s',_0x230966,JSON[_0x6529('0x23')](_0x449447));})[_0x6529('0x24')](function(){logger[_0x6529('0xc')](_0x6529('0x25'),_0x230966);_0x4eb4bc[_0x6529('0x26')]();});}else{logger[_0x6529('0xc')](_0x6529('0x27'),_0x230966);_0x4eb4bc[_0x6529('0x26')]();}}else{var _0x5099ac=this;var _0x1920d7=new AWS[(_0x6529('0x28'))]({'accessKeyId':_0x1a76b0[0x0],'secretAccessKey':_0x1a76b0[0x1],'region':_0x1a76b0[0x2]});var _0x1772ce={'botAlias':_0x6529('0x29'),'botName':_0x1a76b0[0x3],'inputText':this[_0x6529('0x2a')]['body'],'userId':this[_0x6529('0x13')]+':'+this[_0x6529('0xa')]['id']['toString']()};_0x1920d7[_0x6529('0x2b')](_0x1772ce,function(_0x301d48,_0x213295){if(_0x301d48){logger['error'](_0x6529('0x20'),_0x230966,_0x301d48['message']);_0x4eb4bc[_0x6529('0xe')]();}else if(_0x213295&&_0x213295[_0x6529('0x2a')]){_0x5099ac['body'][_0x6529('0x2c')]=_0x213295;_0x2ba1c0['body']=_0x213295[_0x6529('0x2a')];_0x2ba1c0['providerName']='amazonlex';_0x2ba1c0['providerResponse']=JSON[_0x6529('0x23')](_0x213295);return rpc[_0x249392+_0x6529('0x1e')][_0x6529('0x2d')](_0x2ba1c0)[_0x6529('0x1f')](function(_0x21d2a4){logger[_0x6529('0xc')](_0x6529('0x20'),_0x230966,_0x2ba1c0[_0x6529('0x1d')]);if(_0x213295[_0x6529('0x2e')]=='Failed'){_0x4eb4bc['next']();}else{_0x4eb4bc[_0x6529('0x26')]();}})[_0x6529('0x21')](function(_0x1e4519){logger[_0x6529('0x22')](_0x6529('0x20'),_0x230966,JSON[_0x6529('0x23')](_0x1e4519));_0x4eb4bc[_0x6529('0xe')]();});}else{_0x4eb4bc[_0x6529('0xe')]();}});}}catch(_0x376439){logger[_0x6529('0x22')](_0x6529('0x20'),_0x230966,JSON[_0x6529('0x23')](_0x376439));_0x4eb4bc[_0x6529('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index c2476d6..5426006 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 _0x24c0=['[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','phone','subject','Re:','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','mail','service','Smtp','host','port','secure','authentication','auth','inReplyTo','html','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/mailInteraction','../../rpc/smsInteraction','../../mailRpc','consequence','channel','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','info','autoreplyExecuted'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x24c0,0x1cf));var _0x024c=function(_0x301bee,_0x91a563){_0x301bee=_0x301bee-0x0;var _0x3fbdbc=_0x24c0[_0x301bee];return _0x3fbdbc;};'use strict';var _=require(_0x024c('0x0'));var moment=require(_0x024c('0x1'));var utils=require(_0x024c('0x2'));var logger=require('../../../../config/logger')(_0x024c('0x3'));var rpc={'chatMessage':require(_0x024c('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x024c('0x5')),'smsMessage':require(_0x024c('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x024c('0x7')),'smsInteraction':require(_0x024c('0x8')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x024c('0x9'));exports[_0x024c('0xa')]=function(_0x4111b8,_0x2598fe,_0xefac0,_0x563a6c){return function(_0x5e206f){try{var _0x2a2641=this[_0x024c('0xb')];if(_0x2a2641==='mail'&&_0x563a6c[_0x024c('0xc')][_0x024c('0xd')]){logger['info'](_0x024c('0xe'),_0x4111b8,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x5e206f[_0x024c('0xf')]();}if(_0x2598fe[0x0]==='1'&&(_[_0x024c('0x10')](this['interaction']['created'])||!this[_0x024c('0x11')]['created'])){logger[_0x024c('0x12')](_0x024c('0xe'),_0x4111b8,'Autoreply\x20already\x20sent');return _0x5e206f[_0x024c('0xf')]();}if(_0x2598fe[0x0]==='2'&&this[_0x024c('0x11')][_0x024c('0x13')]){logger['info'](_0x024c('0x14'),_0x4111b8,_0x024c('0x15'));return _0x5e206f['next']();}var _0x590eea={'ContactId':this[_0x024c('0x16')]['id'],'sentAt':moment()[_0x024c('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x024c('0xb')]==='mail'){_0x590eea['body']=utils[_0x024c('0x18')](_0x2598fe[0x2],this);}else{_0x590eea[_0x024c('0xc')]=utils[_0x024c('0x18')](_0x2598fe[0x1],this);}if(this['message']){_0x590eea['to']=this[_0x024c('0x19')][_0x024c('0x1a')]||'';if(this['channel']==='mail'&&_0x2598fe[0x1]==='1'){_0x590eea['cc']=this['message']['cc']||'';}_0x590eea[_0x024c('0x1a')]=this[_0x024c('0x19')]['to']||'';_0x590eea[_0x024c('0x1b')]=this['message']['phone']||'';_0x590eea['read']=!![];if(this[_0x024c('0x19')][_0x024c('0x1c')]){_0x590eea['subject']='';_0x590eea[_0x024c('0x1c')]+=_['startsWith'](this[_0x024c('0x19')]['subject'],_0x024c('0x1d'))?'':'Re:\x20';_0x590eea[_0x024c('0x1c')]+=this[_0x024c('0x19')][_0x024c('0x1c')];}}if(this[_0x024c('0xb')]===_0x024c('0x1e')){_0x590eea[_0x024c('0x1f')]=this['account']['id'];}else{_0x590eea[_[_0x024c('0x20')](this[_0x024c('0xb')])+'AccountId']=this[_0x024c('0x21')]['id'];}_0x590eea[_['upperFirst'](this[_0x024c('0xb')])+_0x024c('0x22')]=this[_0x024c('0x11')]['id'];var _0x4eb2c9=this[_0x024c('0x11')];if(rpc[this[_0x024c('0xb')]+_0x024c('0x23')]){if(this[_0x024c('0xb')]===_0x024c('0x24')){var _0x5e6671={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0x024c('0x25')]){_0x5e6671[_0x024c('0x25')]=this['account'][_0x024c('0x26')][_0x024c('0x25')];}else{_0x5e6671['host']=this['account'][_0x024c('0x26')][_0x024c('0x27')];_0x5e6671[_0x024c('0x28')]=this['account']['Smtp'][_0x024c('0x28')];_0x5e6671[_0x024c('0x29')]=this['account'][_0x024c('0x26')][_0x024c('0x29')];}if(this[_0x024c('0x21')][_0x024c('0x26')][_0x024c('0x2a')]){_0x5e6671[_0x024c('0x2b')]={'user':this[_0x024c('0x21')]['Smtp']['user'],'pass':this[_0x024c('0x21')][_0x024c('0x26')]['pass']};}_0x590eea[_0x024c('0x2c')]=this['message']['messageId'];_0x590eea[_0x024c('0x2d')]=''+_[_0x024c('0x2e')](_0x590eea['body'],_0x024c('0x2f'),_0x024c('0x30'))+_0x024c('0x31');_0x590eea[_0x024c('0x32')]={'Auto-Submitted':_0x024c('0x33'),'X-Auto-Response-Suppress':_0x024c('0x34'),'Precedence':_0x024c('0x35')};return mailRpc[_0x024c('0x36')](_0x5e6671,_0x590eea)[_0x024c('0x37')](function(_0x44f187){logger[_0x024c('0x12')](_0x024c('0x38'),_0x4111b8);_0x590eea[_0x024c('0x39')]=_0x44f187[_0x024c('0x19')]['messageId'];return rpc[_0x2a2641+_0x024c('0x23')]['create'](_0x590eea);})[_0x024c('0x37')](function(_0x39cbc0){logger['info'](_0x024c('0xe'),_0x4111b8,JSON[_0x024c('0x3a')](_0x39cbc0));})[_0x024c('0x3b')](function(_0x2b0540){logger[_0x024c('0x3c')](_0x024c('0x3d'),_0x4111b8,JSON[_0x024c('0x3a')](_0x2b0540));})[_0x024c('0x3e')](function(){Promise[_0x024c('0x3f')]()['then'](function(){if(_0x2598fe[0x0]!=='2'||_0x4eb2c9[_0x024c('0x13')])return;return rpc[_0x2a2641+_0x024c('0x40')][_0x024c('0x41')](_0x4eb2c9['id'],{'autoreplyExecuted':!![]})[_0x024c('0x37')](function(_0x3408ce){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4111b8,JSON['stringify'](_0x3408ce));})[_0x024c('0x3b')](function(_0x56e6b9){logger[_0x024c('0x3c')](_0x024c('0x42'),_0x4111b8,JSON[_0x024c('0x3a')](_0x56e6b9));});})['then'](function(){_0x5e206f[_0x024c('0xf')]();});});}else{return rpc[this[_0x024c('0xb')]+'Message'][_0x024c('0x43')](_0x590eea)[_0x024c('0x37')](function(_0x2f2643){logger[_0x024c('0x12')](_0x024c('0xe'),_0x4111b8,_0x590eea[_0x024c('0xc')]);})['catch'](function(_0x4680e8){logger['error'](_0x024c('0xe'),_0x4111b8,JSON[_0x024c('0x3a')](_0x4680e8));})[_0x024c('0x3e')](function(){Promise[_0x024c('0x3f')]()[_0x024c('0x37')](function(){if(_0x2598fe[0x0]!=='2'||_0x4eb2c9[_0x024c('0x13')])return;return rpc[_0x2a2641+_0x024c('0x40')]['update'](_0x4eb2c9['id'],{'autoreplyExecuted':!![]})['then'](function(_0xe90c7f){logger[_0x024c('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4111b8,JSON[_0x024c('0x3a')](_0xe90c7f));})[_0x024c('0x3b')](function(_0x4bc637){logger[_0x024c('0x3c')](_0x024c('0x42'),_0x4111b8,JSON['stringify'](_0x4bc637));});})[_0x024c('0x37')](function(){_0x5e206f[_0x024c('0xf')]();});});}}}catch(_0x3c8b5c){logger[_0x024c('0x3c')](_0x024c('0xe'),_0x4111b8,JSON[_0x024c('0x3a')](_0x3c8b5c));_0x5e206f[_0x024c('0x44')]();}};}; \ No newline at end of file +var _0x10b1=['user','pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','then','stringify','catch','error','resolve','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','[%s][AUTOREPLY]\x20%s','finally','update','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','isNil','interaction','info','next','autoreplyExecuted','contact','format','out','mail','getMustacheRender','body','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','upperFirst','AccountId','account','Smtp','service','host','port','secure','auth'];(function(_0xcedc8e,_0x575788){var _0x2a7eaa=function(_0x4219a2){while(--_0x4219a2){_0xcedc8e['push'](_0xcedc8e['shift']());}};_0x2a7eaa(++_0x575788);}(_0x10b1,0x1d7));var _0x110b=function(_0x5c443f,_0x385f08){_0x5c443f=_0x5c443f-0x0;var _0x5ecfcd=_0x10b1[_0x5c443f];return _0x5ecfcd;};'use strict';var _=require(_0x110b('0x0'));var moment=require(_0x110b('0x1'));var utils=require(_0x110b('0x2'));var logger=require(_0x110b('0x3'))('routing');var rpc={'chatMessage':require(_0x110b('0x4')),'openchannelMessage':require(_0x110b('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x110b('0x6')),'faxMessage':require(_0x110b('0x7')),'whatsappMessage':require(_0x110b('0x8')),'chatInteraction':require(_0x110b('0x9')),'openchannelInteraction':require(_0x110b('0xa')),'mailInteraction':require(_0x110b('0xb')),'smsInteraction':require(_0x110b('0xc')),'faxInteraction':require(_0x110b('0xd')),'whatsappInteraction':require(_0x110b('0xe'))};var mailRpc=require(_0x110b('0xf'));exports[_0x110b('0x10')]=function(_0x54395c,_0x65432d,_0x26fed4,_0x4722d7){return function(_0x4908c4){try{var _0x2b8f0a=this[_0x110b('0x11')];if(_0x2b8f0a==='mail'&&_0x4722d7['body']['isAutoreply']){logger['info']('[%s][AUTOREPLY]\x20%s',_0x54395c,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x4908c4['next']();}if(_0x65432d[0x0]==='1'&&(_[_0x110b('0x12')](this[_0x110b('0x13')]['created'])||!this['interaction']['created'])){logger[_0x110b('0x14')]('[%s][AUTOREPLY]\x20%s',_0x54395c,'Autoreply\x20already\x20sent');return _0x4908c4[_0x110b('0x15')]();}if(_0x65432d[0x0]==='2'&&this[_0x110b('0x13')][_0x110b('0x16')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x54395c,'One\x20Time\x20already\x20sent');return _0x4908c4[_0x110b('0x15')]();}var _0xdd53e9={'ContactId':this[_0x110b('0x17')]['id'],'sentAt':moment()[_0x110b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x110b('0x19')};if(this['channel']===_0x110b('0x1a')){_0xdd53e9['body']=utils[_0x110b('0x1b')](_0x65432d[0x2],this);}else{_0xdd53e9[_0x110b('0x1c')]=utils[_0x110b('0x1b')](_0x65432d[0x1],this);}if(this[_0x110b('0x1d')]){_0xdd53e9['to']=this['message'][_0x110b('0x1e')]||'';if(this['channel']===_0x110b('0x1a')&&_0x65432d[0x1]==='1'){_0xdd53e9['cc']=this[_0x110b('0x1d')]['cc']||'';}_0xdd53e9['from']=this[_0x110b('0x1d')]['to']||'';_0xdd53e9['phone']=this[_0x110b('0x1d')][_0x110b('0x1f')]||'';_0xdd53e9[_0x110b('0x20')]=!![];if(this[_0x110b('0x1d')]['subject']){_0xdd53e9[_0x110b('0x21')]='';_0xdd53e9[_0x110b('0x21')]+=_[_0x110b('0x22')](this['message']['subject'],_0x110b('0x23'))?'':_0x110b('0x24');_0xdd53e9[_0x110b('0x21')]+=this[_0x110b('0x1d')][_0x110b('0x21')];}}if(this[_0x110b('0x11')]==='chat'){_0xdd53e9[_0x110b('0x25')]=this['account']['id'];}else{_0xdd53e9[_[_0x110b('0x26')](this[_0x110b('0x11')])+_0x110b('0x27')]=this[_0x110b('0x28')]['id'];}_0xdd53e9[_[_0x110b('0x26')](this[_0x110b('0x11')])+'InteractionId']=this['interaction']['id'];var _0x1185fe=this[_0x110b('0x13')];if(rpc[this[_0x110b('0x11')]+'Message']){if(this[_0x110b('0x11')]===_0x110b('0x1a')){var _0x1bb879={'tls':{'rejectUnauthorized':![]}};if(this[_0x110b('0x28')][_0x110b('0x29')][_0x110b('0x2a')]){_0x1bb879[_0x110b('0x2a')]=this[_0x110b('0x28')][_0x110b('0x29')][_0x110b('0x2a')];}else{_0x1bb879[_0x110b('0x2b')]=this[_0x110b('0x28')][_0x110b('0x29')][_0x110b('0x2b')];_0x1bb879[_0x110b('0x2c')]=this[_0x110b('0x28')][_0x110b('0x29')]['port'];_0x1bb879[_0x110b('0x2d')]=this[_0x110b('0x28')][_0x110b('0x29')][_0x110b('0x2d')];}if(this[_0x110b('0x28')][_0x110b('0x29')]['authentication']){_0x1bb879[_0x110b('0x2e')]={'user':this['account'][_0x110b('0x29')][_0x110b('0x2f')],'pass':this[_0x110b('0x28')][_0x110b('0x29')][_0x110b('0x30')]};}_0xdd53e9[_0x110b('0x31')]=this[_0x110b('0x1d')][_0x110b('0x32')];_0xdd53e9[_0x110b('0x33')]=_0x110b('0x34')+_[_0x110b('0x35')](_0xdd53e9[_0x110b('0x1c')],_0x110b('0x36'),_0x110b('0x37'))+_0x110b('0x38');_0xdd53e9[_0x110b('0x39')]={'Auto-Submitted':_0x110b('0x3a'),'X-Auto-Response-Suppress':_0x110b('0x3b'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x1bb879,_0xdd53e9)['then'](function(_0x51791f){logger['info'](_0x110b('0x3c'),_0x54395c);_0xdd53e9[_0x110b('0x32')]=_0x51791f['message']['messageId'];return rpc[_0x2b8f0a+_0x110b('0x3d')][_0x110b('0x3e')](_0xdd53e9);})[_0x110b('0x3f')](function(_0x38900d){logger[_0x110b('0x14')]('[%s][AUTOREPLY]\x20%s',_0x54395c,JSON[_0x110b('0x40')](_0x38900d));})[_0x110b('0x41')](function(_0x22a8f8){logger[_0x110b('0x42')]('[RPC][%s][AUTOREPLY]\x20%s',_0x54395c,JSON[_0x110b('0x40')](_0x22a8f8));})['finally'](function(){Promise[_0x110b('0x43')]()[_0x110b('0x3f')](function(){if(_0x65432d[0x0]!=='2'||_0x1185fe[_0x110b('0x16')])return;return rpc[_0x2b8f0a+'Interaction']['update'](_0x1185fe['id'],{'autoreplyExecuted':!![]})['then'](function(_0x442690){logger[_0x110b('0x14')](_0x110b('0x44'),_0x54395c,JSON[_0x110b('0x40')](_0x442690));})[_0x110b('0x41')](function(_0x2bf287){logger[_0x110b('0x42')](_0x110b('0x45'),_0x54395c,JSON['stringify'](_0x2bf287));});})[_0x110b('0x3f')](function(){_0x4908c4[_0x110b('0x15')]();});});}else{return rpc[this['channel']+_0x110b('0x3d')][_0x110b('0x3e')](_0xdd53e9)[_0x110b('0x3f')](function(_0x152f3f){logger[_0x110b('0x14')](_0x110b('0x46'),_0x54395c,_0xdd53e9[_0x110b('0x1c')]);})['catch'](function(_0xd5e126){logger[_0x110b('0x42')]('[%s][AUTOREPLY]\x20%s',_0x54395c,JSON[_0x110b('0x40')](_0xd5e126));})[_0x110b('0x47')](function(){Promise[_0x110b('0x43')]()[_0x110b('0x3f')](function(){if(_0x65432d[0x0]!=='2'||_0x1185fe[_0x110b('0x16')])return;return rpc[_0x2b8f0a+'Interaction'][_0x110b('0x48')](_0x1185fe['id'],{'autoreplyExecuted':!![]})['then'](function(_0x362ac0){logger[_0x110b('0x14')](_0x110b('0x44'),_0x54395c,JSON[_0x110b('0x40')](_0x362ac0));})[_0x110b('0x41')](function(_0x2c6b2f){logger[_0x110b('0x42')](_0x110b('0x45'),_0x54395c,JSON[_0x110b('0x40')](_0x2c6b2f));});})[_0x110b('0x3f')](function(){_0x4908c4['next']();});});}}}catch(_0x12ce9a){logger[_0x110b('0x42')]('[%s][AUTOREPLY]\x20%s',_0x54395c,JSON['stringify'](_0x12ce9a));_0x4908c4[_0x110b('0x49')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 4013142..8d2127e 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa64a=['stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s'];(function(_0x18ee12,_0x31c105){var _0x328b67=function(_0x334d70){while(--_0x334d70){_0x18ee12['push'](_0x18ee12['shift']());}};_0x328b67(++_0x31c105);}(_0xa64a,0x100));var _0xaa64=function(_0x337bac,_0x46b105){_0x337bac=_0x337bac-0x0;var _0x4d93e7=_0xa64a[_0x337bac];return _0x4d93e7;};'use strict';var moment=require(_0xaa64('0x0'));var logger=require(_0xaa64('0x1'))(_0xaa64('0x2'));var rpc={'chatInteraction':require(_0xaa64('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xaa64('0x4')),'mailInteraction':require(_0xaa64('0x5')),'faxInteraction':require(_0xaa64('0x6')),'whatsappInteraction':require(_0xaa64('0x7'))};exports['consequence']=function(_0x12f2da,_0x1ddd9a,_0x13fc42,_0x55b54a){return function(_0x47a154){try{logger[_0xaa64('0x8')](_0xaa64('0x9'),_0x12f2da,_0x1ddd9a[0x0]);var _0x2b651b={'closed':0x1,'closedAt':moment()[_0xaa64('0xa')](_0xaa64('0xb')),'closeReason':_0xaa64('0xc'),'disposition':_0x1ddd9a[0x0]};if(rpc[_0x55b54a[_0xaa64('0xd')]+_0xaa64('0xe')]){rpc[_0x55b54a['channel']+_0xaa64('0xe')][_0xaa64('0xf')](_0x55b54a[_0xaa64('0x10')]['id'],_0x2b651b)['then'](function(_0x2bcedb){logger['info'](_0xaa64('0x11'),_0x12f2da,_0x55b54a[_0xaa64('0x10')]['id']);})['catch'](function(_0x2c0005){logger[_0xaa64('0x12')](_0xaa64('0x13'),_0x12f2da,JSON[_0xaa64('0x14')](_0x2c0005));})[_0xaa64('0x15')](function(){_0x47a154[_0xaa64('0x16')]();});}}catch(_0x456f48){logger[_0xaa64('0x12')](_0xaa64('0x13'),_0x12f2da,JSON[_0xaa64('0x14')](_0x456f48));_0x47a154[_0xaa64('0x16')]();}};}; \ No newline at end of file +var _0xae8a=['info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction'];(function(_0x4283e9,_0x55c057){var _0x4e4c67=function(_0x3c700c){while(--_0x3c700c){_0x4283e9['push'](_0x4283e9['shift']());}};_0x4e4c67(++_0x55c057);}(_0xae8a,0x1c8));var _0xaae8=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xae8a[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xaae8('0x0'));var rpc={'chatInteraction':require(_0xaae8('0x1')),'openchannelInteraction':require(_0xaae8('0x2')),'smsInteraction':require(_0xaae8('0x3')),'mailInteraction':require(_0xaae8('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xaae8('0x5'))};exports['consequence']=function(_0x3f6fee,_0x384099,_0x3c2301,_0x1871d9){return function(_0x211740){try{logger[_0xaae8('0x6')](_0xaae8('0x7'),_0x3f6fee,_0x384099[0x0]);var _0x4fd0db={'closed':0x1,'closedAt':moment()[_0xaae8('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xaae8('0x9'),'disposition':_0x384099[0x0]};if(rpc[_0x1871d9[_0xaae8('0xa')]+_0xaae8('0xb')]){rpc[_0x1871d9[_0xaae8('0xa')]+_0xaae8('0xb')][_0xaae8('0xc')](_0x1871d9['interaction']['id'],_0x4fd0db)['then'](function(_0x2c2b1f){logger[_0xaae8('0x6')](_0xaae8('0xd'),_0x3f6fee,_0x1871d9[_0xaae8('0xe')]['id']);})[_0xaae8('0xf')](function(_0x5c268c){logger[_0xaae8('0x10')](_0xaae8('0x11'),_0x3f6fee,JSON[_0xaae8('0x12')](_0x5c268c));})[_0xaae8('0x13')](function(){_0x211740['stop']();});}}catch(_0x23c3b3){logger[_0xaae8('0x10')]('[%s][CLOSE]\x20%s',_0x3f6fee,JSON[_0xaae8('0x12')](_0x23c3b3));_0x211740[_0xaae8('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 85f7656..56ac1a9 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28b1=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','speech','providerName','metadata','endConversation','error','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','body','catch','stringify','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28b1,0x1d6));var _0x128b=function(_0x53d8a9,_0x259714){_0x53d8a9=_0x53d8a9-0x0;var _0x2fc900=_0x28b1[_0x53d8a9];return _0x2fc900;};'use strict';var _=require(_0x128b('0x0'));var moment=require(_0x128b('0x1'));var apiai=require(_0x128b('0x2'));var md5=require('md5');var utils=require(_0x128b('0x3'));var logger=require(_0x128b('0x4'))(_0x128b('0x5'));var rpc={'chatMessage':require(_0x128b('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x128b('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x128b('0x8')]=function(_0x59cd4f,_0xcd2ab0){return function(_0x1af910){try{if(!_[_0x128b('0x9')](this[_0x128b('0xa')][_0x128b('0xb')])){logger[_0x128b('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x59cd4f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1af910[_0x128b('0xd')]();}var _0x568534={'ContactId':this['contact']['id'],'sentAt':moment()[_0x128b('0xe')](_0x128b('0xf')),'direction':_0x128b('0x10')};if(this[_0x128b('0x11')]===_0x128b('0x12')||this['channel']===_0x128b('0x13')){_0x568534['phone']=this[_0x128b('0xa')][_0x128b('0x14')];}var _0x36fe2b=this[_0x128b('0x11')];if(_0x36fe2b===_0x128b('0x15')){_0x568534[_0x128b('0x16')]=this[_0x128b('0x17')]['id'];}else{_0x568534[_[_0x128b('0x18')](_0x36fe2b)+_0x128b('0x19')]=this[_0x128b('0x17')]['id'];}_0x568534[_[_0x128b('0x18')](_0x36fe2b)+_0x128b('0x1a')]=this[_0x128b('0xa')]['id'];if(this['interaction']['created']){var _0x5110be=_0xcd2ab0[0x2];if(!_['isEmpty'](_0x5110be)){_0x568534['body']=utils[_0x128b('0x1b')](_0x5110be,this);return rpc[_0x36fe2b+_0x128b('0x1c')][_0x128b('0x1d')](_0x568534)[_0x128b('0x1e')](function(_0x4479f9){logger['info'](_0x128b('0x1f'),_0x59cd4f,_0x568534[_0x128b('0x20')]);})[_0x128b('0x21')](function(_0x1645e0){logger['error'](_0x128b('0x1f'),_0x59cd4f,JSON[_0x128b('0x22')](_0x1645e0));})['finally'](function(){logger[_0x128b('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x59cd4f);_0x1af910[_0x128b('0x23')]();});}else{logger[_0x128b('0xc')](_0x128b('0x24'),_0x59cd4f);_0x1af910['stop']();}}else{var _0x55c795=this;var _0x39bc81=apiai(_0xcd2ab0[0x0],{'language':_0xcd2ab0[0x1]||'en'});return _0x39bc81[_0x128b('0x25')](this[_0x128b('0x26')][_0x128b('0x20')],{'sessionId':md5(this[_0x128b('0xa')]['id'])})[_0x128b('0x1e')](function(_0x182692){_0x55c795['body']['dialogflow']=_0x182692;_0x568534[_0x128b('0x20')]=_0x182692[_0x128b('0x27')][_0x128b('0x28')][_0x128b('0x29')];_0x568534[_0x128b('0x2a')]='dialogflow';_0x568534['providerResponse']=JSON[_0x128b('0x22')](_0x182692);return rpc[_0x36fe2b+_0x128b('0x1c')][_0x128b('0x1d')](_0x568534)['then'](function(_0x10e736){logger[_0x128b('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x59cd4f,_0x568534[_0x128b('0x20')]);if(_0x182692[_0x128b('0x27')][_0x128b('0x2b')][_0x128b('0x2c')]){_0x1af910[_0x128b('0xd')]();}else{_0x1af910[_0x128b('0x23')]();}})[_0x128b('0x21')](function(_0xdf67a7){logger[_0x128b('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x59cd4f,JSON[_0x128b('0x22')](_0xdf67a7));_0x1af910[_0x128b('0xd')]();});})[_0x128b('0x21')](function(_0x145a6d){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x59cd4f,_0x145a6d['message']);_0x1af910[_0x128b('0xd')]();});}}catch(_0x2d87f6){logger[_0x128b('0x2d')](_0x128b('0x1f'),_0x59cd4f,JSON[_0x128b('0x22')](_0x2d87f6));_0x1af910[_0x128b('0x23')]();}};}; \ No newline at end of file +var _0x1a44=['isNil','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','result','fulfillment','speech','providerName','metadata','message','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x223fce,_0x18b685){var _0x16977e=function(_0x44d9eb){while(--_0x44d9eb){_0x223fce['push'](_0x223fce['shift']());}};_0x16977e(++_0x18b685);}(_0x1a44,0xc4));var _0x41a4=function(_0x42bfb8,_0x59574c){_0x42bfb8=_0x42bfb8-0x0;var _0x38d9fe=_0x1a44[_0x42bfb8];return _0x38d9fe;};'use strict';var _=require(_0x41a4('0x0'));var moment=require('moment');var apiai=require(_0x41a4('0x1'));var md5=require(_0x41a4('0x2'));var utils=require(_0x41a4('0x3'));var logger=require(_0x41a4('0x4'))(_0x41a4('0x5'));var rpc={'chatMessage':require(_0x41a4('0x6')),'openchannelMessage':require(_0x41a4('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x41a4('0x8')),'faxMessage':require(_0x41a4('0x9')),'whatsappMessage':require(_0x41a4('0xa'))};exports[_0x41a4('0xb')]=function(_0x599ccc,_0x5f57e7){return function(_0x2e523b){try{if(!_[_0x41a4('0xc')](this[_0x41a4('0xd')][_0x41a4('0xe')])){logger[_0x41a4('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x599ccc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2e523b[_0x41a4('0x10')]();}var _0x162699={'ContactId':this[_0x41a4('0x11')]['id'],'sentAt':moment()[_0x41a4('0x12')](_0x41a4('0x13')),'direction':_0x41a4('0x14')};if(this['channel']===_0x41a4('0x15')||this[_0x41a4('0x16')]===_0x41a4('0x17')){_0x162699[_0x41a4('0x18')]=this['interaction'][_0x41a4('0x18')];}var _0x87638d=this['channel'];if(_0x87638d===_0x41a4('0x19')){_0x162699[_0x41a4('0x1a')]=this['account']['id'];}else{_0x162699[_['upperFirst'](_0x87638d)+_0x41a4('0x1b')]=this[_0x41a4('0x1c')]['id'];}_0x162699[_[_0x41a4('0x1d')](_0x87638d)+_0x41a4('0x1e')]=this[_0x41a4('0xd')]['id'];if(this['interaction'][_0x41a4('0x1f')]){var _0x5043f5=_0x5f57e7[0x2];if(!_[_0x41a4('0x20')](_0x5043f5)){_0x162699[_0x41a4('0x21')]=utils[_0x41a4('0x22')](_0x5043f5,this);return rpc[_0x87638d+_0x41a4('0x23')][_0x41a4('0x24')](_0x162699)[_0x41a4('0x25')](function(_0x43c0f9){logger[_0x41a4('0xf')](_0x41a4('0x26'),_0x599ccc,_0x162699[_0x41a4('0x21')]);})[_0x41a4('0x27')](function(_0x4828cc){logger[_0x41a4('0x28')](_0x41a4('0x26'),_0x599ccc,JSON[_0x41a4('0x29')](_0x4828cc));})['finally'](function(){logger[_0x41a4('0xf')](_0x41a4('0x2a'),_0x599ccc);_0x2e523b[_0x41a4('0x2b')]();});}else{logger[_0x41a4('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x599ccc);_0x2e523b[_0x41a4('0x2b')]();}}else{var _0x8c1da5=this;var _0x4b86be=apiai(_0x5f57e7[0x0],{'language':_0x5f57e7[0x1]||'en'});return _0x4b86be[_0x41a4('0x2c')](this['message'][_0x41a4('0x21')],{'sessionId':md5(this[_0x41a4('0xd')]['id'])})[_0x41a4('0x25')](function(_0x18e3dd){_0x8c1da5[_0x41a4('0x21')][_0x41a4('0x2d')]=_0x18e3dd;_0x162699[_0x41a4('0x21')]=_0x18e3dd[_0x41a4('0x2e')][_0x41a4('0x2f')][_0x41a4('0x30')];_0x162699[_0x41a4('0x31')]=_0x41a4('0x2d');_0x162699['providerResponse']=JSON[_0x41a4('0x29')](_0x18e3dd);return rpc[_0x87638d+_0x41a4('0x23')][_0x41a4('0x24')](_0x162699)['then'](function(_0x3478dd){logger[_0x41a4('0xf')](_0x41a4('0x26'),_0x599ccc,_0x162699[_0x41a4('0x21')]);if(_0x18e3dd['result'][_0x41a4('0x32')]['endConversation']){_0x2e523b[_0x41a4('0x10')]();}else{_0x2e523b[_0x41a4('0x2b')]();}})[_0x41a4('0x27')](function(_0x48b324){logger[_0x41a4('0x28')](_0x41a4('0x26'),_0x599ccc,JSON[_0x41a4('0x29')](_0x48b324));_0x2e523b[_0x41a4('0x10')]();});})[_0x41a4('0x27')](function(_0x3ad2fa){logger[_0x41a4('0x28')](_0x41a4('0x26'),_0x599ccc,_0x3ad2fa[_0x41a4('0x33')]);_0x2e523b['next']();});}}catch(_0x37bed2){logger[_0x41a4('0x28')]('[%s][DIALOGFLOW]\x20%s',_0x599ccc,JSON['stringify'](_0x37bed2));_0x2e523b[_0x41a4('0x2b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 40d725b..06dff34 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc910=['phone','account','upperFirst','AccountId','InteractionId','getMustacheRender','Message','create','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','next','dialogflow','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp'];(function(_0x3a9563,_0x1fbe7b){var _0x314283=function(_0xfae8f8){while(--_0xfae8f8){_0x3a9563['push'](_0x3a9563['shift']());}};_0x314283(++_0x1fbe7b);}(_0xc910,0x1e1));var _0x0c91=function(_0x589701,_0x764e34){_0x589701=_0x589701-0x0;var _0x10cca2=_0xc910[_0x589701];return _0x10cca2;};'use strict';var _=require('lodash');var dialogflow=require(_0x0c91('0x0'));var md5=require(_0x0c91('0x1'));var moment=require('moment');var Promise=require(_0x0c91('0x2'));var logger=require(_0x0c91('0x3'))(_0x0c91('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x0c91('0x5')),'openchannelMessage':require(_0x0c91('0x6')),'mailMessage':require(_0x0c91('0x7')),'smsMessage':require(_0x0c91('0x8')),'faxMessage':require(_0x0c91('0x9')),'whatsappMessage':require(_0x0c91('0xa'))};function createMessage(_0x213d97,_0x5508c2,_0x4c7245,_0x9a89a8){return new Promise(function(_0xc6aa66,_0x3fb7ee){var _0x58fade=_[_0x0c91('0xb')](_0x4c7245);_0x58fade[_0x0c91('0xc')]=_0x9a89a8;return rpc[_0x5508c2+'Message']['create'](_0x58fade)['then'](function(){logger['info'](_0x0c91('0xd'),_0x213d97,_0x58fade['body']);_0xc6aa66();})[_0x0c91('0xe')](function(_0x47e86f){logger[_0x0c91('0xf')](_0x0c91('0xd'),_0x213d97,JSON[_0x0c91('0x10')](_0x47e86f));_0x3fb7ee(_0x47e86f);});});}exports[_0x0c91('0x11')]=function(_0xaf9a86,_0x28d861){return function(_0x184e83){try{if(!_[_0x0c91('0x12')](this[_0x0c91('0x13')][_0x0c91('0x14')])){logger[_0x0c91('0x15')](_0x0c91('0xd'),_0xaf9a86,_0x0c91('0x16'));return _0x184e83['next']();}var _0x23e6a9={'ContactId':this[_0x0c91('0x17')]['id'],'sentAt':moment()[_0x0c91('0x18')](_0x0c91('0x19')),'direction':_0x0c91('0x1a')};if(this[_0x0c91('0x1b')]===_0x0c91('0x1c')||this[_0x0c91('0x1b')]===_0x0c91('0x1d')){_0x23e6a9[_0x0c91('0x1e')]=this[_0x0c91('0x13')][_0x0c91('0x1e')];}var _0x143e07=this['channel'];if(_0x143e07==='chat'){_0x23e6a9['ChatWebsiteId']=this[_0x0c91('0x1f')]['id'];}else{_0x23e6a9[_[_0x0c91('0x20')](_0x143e07)+_0x0c91('0x21')]=this[_0x0c91('0x1f')]['id'];}_0x23e6a9[_['upperFirst'](_0x143e07)+_0x0c91('0x22')]=this[_0x0c91('0x13')]['id'];if(this['interaction']['created']){var _0x3fb446=_0x28d861[0x4];if(!_['isEmpty'](_0x3fb446)){_0x23e6a9[_0x0c91('0xc')]=utils[_0x0c91('0x23')](_0x3fb446,this);return rpc[_0x143e07+_0x0c91('0x24')][_0x0c91('0x25')](_0x23e6a9)[_0x0c91('0x26')](function(_0x59f322){logger[_0x0c91('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0xaf9a86,_0x23e6a9['body']);})[_0x0c91('0xe')](function(_0x753d74){logger[_0x0c91('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0xaf9a86,JSON[_0x0c91('0x10')](_0x753d74));})[_0x0c91('0x27')](function(){logger[_0x0c91('0x15')](_0x0c91('0x28'),_0xaf9a86);_0x184e83['stop']();});}else{logger[_0x0c91('0x15')](_0x0c91('0x29'),_0xaf9a86);_0x184e83[_0x0c91('0x2a')]();}}else{var _0x2d6c93=this;var _0x50e7be=_0x28d861[0x2][_0x0c91('0x2b')](/\\n/g,'\x0a');var _0x1d7cc6={'credentials':{'private_key':_0x50e7be,'client_email':_0x28d861[0x1]}};var _0x366039=new dialogflow['SessionsClient'](_0x1d7cc6);var _0x1de9d1=_0x366039[_0x0c91('0x2c')](_0x28d861[0x0],md5(_0x2d6c93[_0x0c91('0x13')]['id']));var _0x1ff66e={'session':_0x1de9d1,'queryInput':{'text':{'text':_0x2d6c93[_0x0c91('0x2d')][_0x0c91('0xc')],'languageCode':_0x28d861[0x3]||'en'}}};return _0x366039[_0x0c91('0x2e')](_0x1ff66e)[_0x0c91('0x26')](function(_0x3ce9ec){if(_0x3ce9ec&&_0x3ce9ec[_0x0c91('0x2f')]){_0x2d6c93[_0x0c91('0xc')][_0x0c91('0x30')]=_0x3ce9ec;var _0x29bb45=_0x3ce9ec[0x0];var _0x313736=_0x29bb45[_0x0c91('0x31')][_0x0c91('0x32')]&&_0x29bb45[_0x0c91('0x31')][_0x0c91('0x32')][_0x0c91('0x33')]?_0x29bb45[_0x0c91('0x31')][_0x0c91('0x32')]['fields'][_0x0c91('0x34')][_0x0c91('0x35')]:![];_0x2d6c93[_0x0c91('0xc')][_0x0c91('0x36')]=_0x29bb45[_0x0c91('0x31')]['action'];_0x2d6c93['body'][_0x0c91('0x37')]=_0x29bb45[_0x0c91('0x31')][_0x0c91('0x38')];_0x2d6c93[_0x0c91('0xc')][_0x0c91('0x39')]=_0x29bb45[_0x0c91('0x31')][_0x0c91('0x32')]&&_0x29bb45[_0x0c91('0x31')][_0x0c91('0x32')][_0x0c91('0x33')]?_0x29bb45[_0x0c91('0x31')][_0x0c91('0x32')][_0x0c91('0x33')][_0x0c91('0x34')][_0x0c91('0x35')]:![];_0x2d6c93[_0x0c91('0xc')]['DIALOGFLOWV2_INTENTNAME']=_0x29bb45[_0x0c91('0x31')]['intent'][_0x0c91('0x3a')];_0x2d6c93[_0x0c91('0xc')][_0x0c91('0x3b')]=_0x29bb45[_0x0c91('0x31')][_0x0c91('0x3c')][_0x0c91('0x3d')];_0x2d6c93[_0x0c91('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x29bb45[_0x0c91('0x31')][_0x0c91('0x3c')][_0x0c91('0x3e')];_0x2d6c93[_0x0c91('0xc')][_0x0c91('0x3f')]=_0x29bb45[_0x0c91('0x31')][_0x0c91('0x40')];_0x2d6c93[_0x0c91('0xc')]['DIALOGFLOWV2_QUERYTEXT']=_0x29bb45[_0x0c91('0x31')][_0x0c91('0x41')];_0x2d6c93[_0x0c91('0xc')][_0x0c91('0x42')]=_0x29bb45[_0x0c91('0x31')]['intentDetectionConfidence'];_0x23e6a9[_0x0c91('0x43')]='dialogflowV2';_0x23e6a9[_0x0c91('0x44')]=JSON[_0x0c91('0x10')](_0x3ce9ec);var _0x3b9ae1=[];for(var _0x3f26f9=0x0;_0x3f26f9<_0x3ce9ec['length'];_0x3f26f9++){var _0x4d1587=_0x3ce9ec[_0x3f26f9];if(_0x4d1587&&_0x4d1587[_0x0c91('0x31')]&&_0x4d1587[_0x0c91('0x31')][_0x0c91('0x45')]){_0x3b9ae1[_0x0c91('0x46')](createMessage(_0xaf9a86,_0x143e07,_0x23e6a9,_0x4d1587[_0x0c91('0x31')][_0x0c91('0x45')]));}}return Promise[_0x0c91('0x47')](_0x3b9ae1)[_0x0c91('0x26')](function(){if(_0x313736){_0x184e83['next']();}else{_0x184e83['stop']();}})['catch'](function(_0x23281e){logger[_0x0c91('0xf')](_0x0c91('0xd'),_0xaf9a86,JSON[_0x0c91('0x10')](_0x23281e));_0x184e83[_0x0c91('0x48')]();});}})[_0x0c91('0xe')](function(_0x2c745c){logger['error'](_0x0c91('0xd'),_0xaf9a86,_0x2c745c[_0x0c91('0x2d')]);_0x184e83[_0x0c91('0x48')]();});}}catch(_0x5f4fb9){logger[_0x0c91('0xf')](_0x0c91('0xd'),_0xaf9a86,JSON[_0x0c91('0x10')](_0x5f4fb9));_0x184e83[_0x0c91('0x2a')]();}};}; \ No newline at end of file +var _0xb8b7=['DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','providerName','providerResponse','fulfillmentText','push','all','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','message','detectIntent','then','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback'];(function(_0x4101b2,_0x4cee82){var _0x272fa2=function(_0x950887){while(--_0x950887){_0x4101b2['push'](_0x4101b2['shift']());}};_0x272fa2(++_0x4cee82);}(_0xb8b7,0x114));var _0x7b8b=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb8b7[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x7b8b('0x0'))(_0x7b8b('0x1'));var utils=require(_0x7b8b('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7b8b('0x3')),'mailMessage':require(_0x7b8b('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7b8b('0x5'))};function createMessage(_0x31829a,_0x144e9c,_0x282b72,_0x23e5fb){return new Promise(function(_0xc8e0a6,_0x3390b3){var _0x5689c9=_['clone'](_0x282b72);_0x5689c9[_0x7b8b('0x6')]=_0x23e5fb;return rpc[_0x144e9c+_0x7b8b('0x7')]['create'](_0x5689c9)['then'](function(){logger[_0x7b8b('0x8')](_0x7b8b('0x9'),_0x31829a,_0x5689c9[_0x7b8b('0x6')]);_0xc8e0a6();})[_0x7b8b('0xa')](function(_0x4ae0fb){logger[_0x7b8b('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x31829a,JSON[_0x7b8b('0xc')](_0x4ae0fb));_0x3390b3(_0x4ae0fb);});});}exports['consequence']=function(_0x2094a0,_0x23d19c){return function(_0x213a64){try{if(!_[_0x7b8b('0xd')](this['interaction'][_0x7b8b('0xe')])){logger[_0x7b8b('0x8')](_0x7b8b('0x9'),_0x2094a0,_0x7b8b('0xf'));return _0x213a64[_0x7b8b('0x10')]();}var _0x9a8531={'ContactId':this[_0x7b8b('0x11')]['id'],'sentAt':moment()[_0x7b8b('0x12')](_0x7b8b('0x13')),'direction':_0x7b8b('0x14')};if(this[_0x7b8b('0x15')]==='sms'||this['channel']===_0x7b8b('0x16')){_0x9a8531[_0x7b8b('0x17')]=this[_0x7b8b('0x18')][_0x7b8b('0x17')];}var _0x41af8d=this['channel'];if(_0x41af8d===_0x7b8b('0x19')){_0x9a8531[_0x7b8b('0x1a')]=this[_0x7b8b('0x1b')]['id'];}else{_0x9a8531[_[_0x7b8b('0x1c')](_0x41af8d)+_0x7b8b('0x1d')]=this[_0x7b8b('0x1b')]['id'];}_0x9a8531[_[_0x7b8b('0x1c')](_0x41af8d)+_0x7b8b('0x1e')]=this[_0x7b8b('0x18')]['id'];if(this['interaction'][_0x7b8b('0x1f')]){var _0x46c269=_0x23d19c[0x4];if(!_[_0x7b8b('0x20')](_0x46c269)){_0x9a8531['body']=utils[_0x7b8b('0x21')](_0x46c269,this);return rpc[_0x41af8d+_0x7b8b('0x7')][_0x7b8b('0x22')](_0x9a8531)['then'](function(_0x48db41){logger[_0x7b8b('0x8')](_0x7b8b('0x9'),_0x2094a0,_0x9a8531[_0x7b8b('0x6')]);})[_0x7b8b('0xa')](function(_0x37803e){logger[_0x7b8b('0xb')](_0x7b8b('0x9'),_0x2094a0,JSON[_0x7b8b('0xc')](_0x37803e));})['finally'](function(){logger['info'](_0x7b8b('0x23'),_0x2094a0);_0x213a64[_0x7b8b('0x24')]();});}else{logger['info'](_0x7b8b('0x25'),_0x2094a0);_0x213a64['stop']();}}else{var _0x41c6d3=this;var _0x45f276=_0x23d19c[0x2][_0x7b8b('0x26')](/\\n/g,'\x0a');var _0x1fef87={'credentials':{'private_key':_0x45f276,'client_email':_0x23d19c[0x1]}};var _0x44dfe9=new dialogflow['SessionsClient'](_0x1fef87);var _0xe03de5=_0x44dfe9['sessionPath'](_0x23d19c[0x0],md5(_0x41c6d3[_0x7b8b('0x18')]['id']));var _0xa2b201={'session':_0xe03de5,'queryInput':{'text':{'text':_0x41c6d3[_0x7b8b('0x27')][_0x7b8b('0x6')],'languageCode':_0x23d19c[0x3]||'en'}}};return _0x44dfe9[_0x7b8b('0x28')](_0xa2b201)[_0x7b8b('0x29')](function(_0x3c24fe){if(_0x3c24fe&&_0x3c24fe[_0x7b8b('0x2a')]){_0x41c6d3[_0x7b8b('0x6')]['dialogflowV2']=_0x3c24fe;var _0x457971=_0x3c24fe[0x0];var _0x250074=_0x457971[_0x7b8b('0x2b')]['diagnosticInfo']&&_0x457971[_0x7b8b('0x2b')]['diagnosticInfo']['fields']?_0x457971[_0x7b8b('0x2b')][_0x7b8b('0x2c')][_0x7b8b('0x2d')][_0x7b8b('0x2e')][_0x7b8b('0x2f')]:![];_0x41c6d3[_0x7b8b('0x6')][_0x7b8b('0x30')]=_0x457971['queryResult'][_0x7b8b('0x31')];_0x41c6d3['body'][_0x7b8b('0x32')]=_0x457971[_0x7b8b('0x2b')]['allRequiredParamsPresent'];_0x41c6d3[_0x7b8b('0x6')][_0x7b8b('0x33')]=_0x457971[_0x7b8b('0x2b')][_0x7b8b('0x2c')]&&_0x457971[_0x7b8b('0x2b')]['diagnosticInfo'][_0x7b8b('0x2d')]?_0x457971[_0x7b8b('0x2b')][_0x7b8b('0x2c')][_0x7b8b('0x2d')][_0x7b8b('0x2e')][_0x7b8b('0x2f')]:![];_0x41c6d3[_0x7b8b('0x6')][_0x7b8b('0x34')]=_0x457971[_0x7b8b('0x2b')]['intent'][_0x7b8b('0x35')];_0x41c6d3[_0x7b8b('0x6')][_0x7b8b('0x36')]=_0x457971[_0x7b8b('0x2b')]['intent'][_0x7b8b('0x37')];_0x41c6d3[_0x7b8b('0x6')][_0x7b8b('0x38')]=_0x457971[_0x7b8b('0x2b')][_0x7b8b('0x39')][_0x7b8b('0x3a')];_0x41c6d3[_0x7b8b('0x6')][_0x7b8b('0x3b')]=_0x457971['queryResult'][_0x7b8b('0x3c')];_0x41c6d3[_0x7b8b('0x6')]['DIALOGFLOWV2_QUERYTEXT']=_0x457971['queryResult'][_0x7b8b('0x3d')];_0x41c6d3[_0x7b8b('0x6')]['DIALOGFLOWV2_SCORE']=_0x457971['queryResult']['intentDetectionConfidence'];_0x9a8531[_0x7b8b('0x3e')]='dialogflowV2';_0x9a8531[_0x7b8b('0x3f')]=JSON[_0x7b8b('0xc')](_0x3c24fe);var _0x57abca=[];for(var _0x30309c=0x0;_0x30309c<_0x3c24fe[_0x7b8b('0x2a')];_0x30309c++){var _0x193197=_0x3c24fe[_0x30309c];if(_0x193197&&_0x193197[_0x7b8b('0x2b')]&&_0x193197[_0x7b8b('0x2b')][_0x7b8b('0x40')]){_0x57abca[_0x7b8b('0x41')](createMessage(_0x2094a0,_0x41af8d,_0x9a8531,_0x193197[_0x7b8b('0x2b')][_0x7b8b('0x40')]));}}return Promise[_0x7b8b('0x42')](_0x57abca)[_0x7b8b('0x29')](function(){if(_0x250074){_0x213a64[_0x7b8b('0x10')]();}else{_0x213a64[_0x7b8b('0x24')]();}})[_0x7b8b('0xa')](function(_0x4464fa){logger[_0x7b8b('0xb')](_0x7b8b('0x9'),_0x2094a0,JSON[_0x7b8b('0xc')](_0x4464fa));_0x213a64['next']();});}})[_0x7b8b('0xa')](function(_0x4b3697){logger[_0x7b8b('0xb')](_0x7b8b('0x9'),_0x2094a0,_0x4b3697[_0x7b8b('0x27')]);_0x213a64['next']();});}}catch(_0x55d481){logger['error'](_0x7b8b('0x9'),_0x2094a0,JSON[_0x7b8b('0xc')](_0x55d481));_0x213a64['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index bf948ff..baa165b 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd21a=['html-to-text','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash'];(function(_0x408378,_0x37d8e6){var _0x311c26=function(_0x352653){while(--_0x352653){_0x408378['push'](_0x408378['shift']());}};_0x311c26(++_0x37d8e6);}(_0xd21a,0x116));var _0xad21=function(_0x3da887,_0x536787){_0x3da887=_0x3da887-0x0;var _0x59769a=_0xd21a[_0x3da887];return _0x59769a;};'use strict';var schema=require(_0xad21('0x0'));var _=require(_0xad21('0x1'));var htmlToText=require(_0xad21('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xad21('0x3'),'required':!![],'message':_0xad21('0x4')},'priorityTrue':{'type':_0xad21('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xad21('0x5'),'message':_0xad21('0x6')}});exports[_0xad21('0x7')]=function(_0x1a0e01,_0x3ff6ae){return function(_0x4f6ac8){try{var _0xaddc42={'condition':htmlToText[_0xad21('0x8')](utils['getMustacheRender'](_0x3ff6ae[0x0],this),{'wordwrap':![]})[_0xad21('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3ff6ae[0x1],'priorityFalse':_0x3ff6ae[0x2]};var _0x49dd9e=gotoif['validate'](_0xaddc42,{'typecast':!![]});if(_0x49dd9e['length']){logger[_0xad21('0xa')](_0xad21('0xb'),_0x1a0e01,_[_0xad21('0xc')](_0x49dd9e,_0xad21('0xd'))[_0xad21('0xe')](',\x20'));_0x4f6ac8[_0xad21('0xf')]();}else{try{var _0x37a631=eval('('+_0xaddc42[_0xad21('0x10')]+')');var _0x39e126=_0x37a631?_0xaddc42[_0xad21('0x11')]:_0xaddc42[_0xad21('0x12')];logger[_0xad21('0x13')](_0xad21('0x14'),_0x1a0e01,_0xaddc42[_0xad21('0x10')],_0x37a631,_0x39e126||_0xad21('0x15'));if(_0x39e126){var _0x30f240=_[_0xad21('0x16')](_0x4f6ac8[_0xad21('0x17')](),{'p':_0x39e126});if(_0x30f240>=0x0){logger[_0xad21('0x13')](_0xad21('0x18'),_0x1a0e01,_0x39e126||_0xad21('0x15'),_0x30f240);_0x4f6ac8['next'](_0x30f240);}else{logger[_0xad21('0x13')](_0xad21('0x19'),_0x1a0e01,_0x39e126||_0xad21('0x15'));_0x4f6ac8[_0xad21('0xf')]();}}else{_0x4f6ac8[_0xad21('0x15')]();}}catch(_0x66e747){logger['error'](_0xad21('0x1a'),_0x1a0e01,_0x66e747[_0xad21('0xd')]);_0x4f6ac8[_0xad21('0xf')]();}}}catch(_0x5e9b41){logger['error'](_0xad21('0xb'),_0x1a0e01,JSON[_0xad21('0x1b')](_0x5e9b41));_0x4f6ac8[_0xad21('0xf')]();}};}; \ No newline at end of file +var _0x3bd6=['./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','replace','length','error','[%s][GOTOIF]\x20%s','message','stop','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text'];(function(_0xd6237f,_0x26b0f3){var _0x3eaefc=function(_0xaed8dc){while(--_0xaed8dc){_0xd6237f['push'](_0xd6237f['shift']());}};_0x3eaefc(++_0x26b0f3);}(_0x3bd6,0x1d9));var _0x63bd=function(_0x3c64fd,_0x4b4f0e){_0x3c64fd=_0x3c64fd-0x0;var _0x39c856=_0x3bd6[_0x3c64fd];return _0x39c856;};'use strict';var schema=require(_0x63bd('0x0'));var _=require('lodash');var htmlToText=require(_0x63bd('0x1'));var utils=require(_0x63bd('0x2'));var logger=require('../../../../config/logger')(_0x63bd('0x3'));var gotoif=schema({'condition':{'type':_0x63bd('0x4'),'required':!![],'message':_0x63bd('0x5')},'priorityTrue':{'type':_0x63bd('0x6'),'message':_0x63bd('0x7')},'priorityFalse':{'type':_0x63bd('0x6'),'message':_0x63bd('0x8')}});exports['consequence']=function(_0x1718b0,_0x14c501){return function(_0x11d8ba){try{var _0x4b0c9b={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x14c501[0x0],this),{'wordwrap':![]})[_0x63bd('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x14c501[0x1],'priorityFalse':_0x14c501[0x2]};var _0x2bbaee=gotoif['validate'](_0x4b0c9b,{'typecast':!![]});if(_0x2bbaee[_0x63bd('0xa')]){logger[_0x63bd('0xb')](_0x63bd('0xc'),_0x1718b0,_['map'](_0x2bbaee,_0x63bd('0xd'))['join'](',\x20'));_0x11d8ba[_0x63bd('0xe')]();}else{try{var _0x5912f9=eval('('+_0x4b0c9b['condition']+')');var _0x1951eb=_0x5912f9?_0x4b0c9b['priorityTrue']:_0x4b0c9b[_0x63bd('0xf')];logger[_0x63bd('0x10')](_0x63bd('0x11'),_0x1718b0,_0x4b0c9b['condition'],_0x5912f9,_0x1951eb||_0x63bd('0x12'));if(_0x1951eb){var _0xbf9d98=_[_0x63bd('0x13')](_0x11d8ba[_0x63bd('0x14')](),{'p':_0x1951eb});if(_0xbf9d98>=0x0){logger[_0x63bd('0x10')](_0x63bd('0x15'),_0x1718b0,_0x1951eb||_0x63bd('0x12'),_0xbf9d98);_0x11d8ba[_0x63bd('0x12')](_0xbf9d98);}else{logger['info'](_0x63bd('0x16'),_0x1718b0,_0x1951eb||_0x63bd('0x12'));_0x11d8ba[_0x63bd('0xe')]();}}else{_0x11d8ba[_0x63bd('0x12')]();}}catch(_0x3d6153){logger[_0x63bd('0xb')](_0x63bd('0x17'),_0x1718b0,_0x3d6153[_0x63bd('0xd')]);_0x11d8ba[_0x63bd('0xe')]();}}}catch(_0x5516b0){logger['error'](_0x63bd('0xc'),_0x1718b0,JSON[_0x63bd('0x18')](_0x5516b0));_0x11d8ba[_0x63bd('0xe')]();}};}; \ 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 61a1d70..cea69b3 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 _0xfc2c=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','message','stop','info','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x2900bf,_0x396900){var _0x4ff896=function(_0x4366c7){while(--_0x4366c7){_0x2900bf['push'](_0x2900bf['shift']());}};_0x4ff896(++_0x396900);}(_0xfc2c,0xe4));var _0xcfc2=function(_0x419608,_0x188b7f){_0x419608=_0x419608-0x0;var _0x5e8e92=_0xfc2c[_0x419608];return _0x5e8e92;};'use strict';var schema=require(_0xcfc2('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xcfc2('0x1'));var gotop=schema({'priority':{'type':_0xcfc2('0x2'),'required':!![],'message':_0xcfc2('0x3')}});exports[_0xcfc2('0x4')]=function(_0x18fff9,_0x2ad814){return function(_0x40bffa){try{var _0x14f066={'priority':_0x2ad814[0x0]};var _0x236949=gotop['validate'](_0x14f066,{'typecast':!![]});if(_0x236949['length']){logger[_0xcfc2('0x5')]('[%s][GOTOP]\x20%s',_0x18fff9,_[_0xcfc2('0x6')](_0x236949,_0xcfc2('0x7'))['join'](',\x20'));_0x40bffa[_0xcfc2('0x8')]();}else{logger[_0xcfc2('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x18fff9,_0x14f066['priority']);if(_0x14f066[_0xcfc2('0xa')]){var _0x39530e=_['findIndex'](_0x40bffa['rules'](),{'p':_0x14f066[_0xcfc2('0xa')]});if(_0x39530e>=0x0){logger[_0xcfc2('0x9')](_0xcfc2('0xb'),_0x18fff9,_0x14f066[_0xcfc2('0xa')]||_0xcfc2('0xc'),_0x39530e);_0x40bffa[_0xcfc2('0xc')](_0x39530e);}else{logger[_0xcfc2('0x9')](_0xcfc2('0xd'),_0x18fff9,_0x14f066[_0xcfc2('0xa')]||_0xcfc2('0xc'));_0x40bffa['stop']();}}else{_0x40bffa[_0xcfc2('0xc')]();}}}catch(_0x449761){logger[_0xcfc2('0x5')]('[%s][GOTOP]\x20%s',_0x18fff9,JSON[_0xcfc2('0xe')](_0x449761));_0x40bffa[_0xcfc2('0x8')]();}};}; \ No newline at end of file +var _0xc455=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','info','priority','findIndex','rules'];(function(_0xc700b5,_0x14d937){var _0x35ac84=function(_0x4f40b1){while(--_0x4f40b1){_0xc700b5['push'](_0xc700b5['shift']());}};_0x35ac84(++_0x14d937);}(_0xc455,0x131));var _0x5c45=function(_0xd53226,_0x3c2862){_0xd53226=_0xd53226-0x0;var _0x4915de=_0xc455[_0xd53226];return _0x4915de;};'use strict';var schema=require('validate');var _=require(_0x5c45('0x0'));var logger=require(_0x5c45('0x1'))(_0x5c45('0x2'));var gotop=schema({'priority':{'type':_0x5c45('0x3'),'required':!![],'message':_0x5c45('0x4')}});exports['consequence']=function(_0x5d3a08,_0x1ac83c){return function(_0x231ab9){try{var _0x2d8e91={'priority':_0x1ac83c[0x0]};var _0x38f258=gotop['validate'](_0x2d8e91,{'typecast':!![]});if(_0x38f258[_0x5c45('0x5')]){logger[_0x5c45('0x6')](_0x5c45('0x7'),_0x5d3a08,_[_0x5c45('0x8')](_0x38f258,_0x5c45('0x9'))[_0x5c45('0xa')](',\x20'));_0x231ab9['stop']();}else{logger[_0x5c45('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x5d3a08,_0x2d8e91[_0x5c45('0xc')]);if(_0x2d8e91[_0x5c45('0xc')]){var _0x552b11=_[_0x5c45('0xd')](_0x231ab9[_0x5c45('0xe')](),{'p':_0x2d8e91[_0x5c45('0xc')]});if(_0x552b11>=0x0){logger[_0x5c45('0xb')](_0x5c45('0xf'),_0x5d3a08,_0x2d8e91['priority']||'next',_0x552b11);_0x231ab9[_0x5c45('0x10')](_0x552b11);}else{logger[_0x5c45('0xb')](_0x5c45('0x11'),_0x5d3a08,_0x2d8e91['priority']||_0x5c45('0x10'));_0x231ab9['stop']();}}else{_0x231ab9[_0x5c45('0x10')]();}}}catch(_0x1d1b5a){logger[_0x5c45('0x6')](_0x5c45('0x7'),_0x5d3a08,JSON[_0x5c45('0x12')](_0x1d1b5a));_0x231ab9[_0x5c45('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 95b64a1..105b913 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 _0x868d=['InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x868d,0x143));var _0xd868=function(_0x3cfdf5,_0x5e11fe){_0x3cfdf5=_0x3cfdf5-0x0;var _0x1b135a=_0x868d[_0x3cfdf5];return _0x1b135a;};'use strict';var _=require(_0xd868('0x0'));var utils=require('./utils');var logger=require(_0xd868('0x1'))(_0xd868('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd868('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd868('0x4')),'whatsappMessage':require(_0xd868('0x5'))};exports['consequence']=function(_0x2176e7,_0x36e13e){return function(_0x444c4e){try{var _0x2837e3={'body':utils[_0xd868('0x6')](_0x36e13e[0x0],this),'ContactId':this['contact']['id']};if(this[_0xd868('0x7')]===_0xd868('0x8')){_0x2837e3[_0xd868('0x9')]=this[_0xd868('0xa')]['id'];}else{_0x2837e3[_[_0xd868('0xb')](this[_0xd868('0x7')])+_0xd868('0xc')]=this[_0xd868('0xa')]['id'];}_0x2837e3[_[_0xd868('0xb')](this[_0xd868('0x7')])+_0xd868('0xd')]=this['interaction']['id'];if(rpc[this[_0xd868('0x7')]+_0xd868('0xe')]){return rpc[this[_0xd868('0x7')]+_0xd868('0xe')][_0xd868('0xf')](_0x2837e3)[_0xd868('0x10')](function(_0x20112c){logger['info'](_0xd868('0x11'),_0x2176e7,_0x2837e3[_0xd868('0x12')]);_0x444c4e[_0xd868('0x13')]();})[_0xd868('0x14')](function(_0x3b8723){logger['error']('[%s][MESSAGE]\x20%s',_0x2176e7,JSON[_0xd868('0x15')](_0x3b8723));_0x444c4e[_0xd868('0x16')]();});}}catch(_0x2f7984){logger[_0xd868('0x17')](_0xd868('0x11'),_0x2176e7,JSON[_0xd868('0x15')](_0x2f7984));_0x444c4e[_0xd868('0x16')]();}};}; \ No newline at end of file +var _0x2884=['interaction','Message','create','then','info','body','next','[%s][MESSAGE]\x20%s','stop','error','stringify','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','channel','chat','account','upperFirst','InteractionId'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x2884,0x1eb));var _0x4288=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x2884[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x4288('0x0'));var utils=require('./utils');var logger=require(_0x4288('0x1'))(_0x4288('0x2'));var rpc={'chatMessage':require(_0x4288('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4288('0x4')),'smsMessage':require(_0x4288('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4288('0x6')]=function(_0x250772,_0x3d67f7){return function(_0x59dffa){try{var _0x526a07={'body':utils[_0x4288('0x7')](_0x3d67f7[0x0],this),'ContactId':this['contact']['id']};if(this[_0x4288('0x8')]===_0x4288('0x9')){_0x526a07['ChatWebsiteId']=this[_0x4288('0xa')]['id'];}else{_0x526a07[_[_0x4288('0xb')](this[_0x4288('0x8')])+'AccountId']=this['account']['id'];}_0x526a07[_[_0x4288('0xb')](this[_0x4288('0x8')])+_0x4288('0xc')]=this[_0x4288('0xd')]['id'];if(rpc[this[_0x4288('0x8')]+_0x4288('0xe')]){return rpc[this[_0x4288('0x8')]+'Message'][_0x4288('0xf')](_0x526a07)[_0x4288('0x10')](function(_0xfa6eca){logger[_0x4288('0x11')]('[%s][MESSAGE]\x20%s',_0x250772,_0x526a07[_0x4288('0x12')]);_0x59dffa[_0x4288('0x13')]();})['catch'](function(_0x1782d2){logger['error'](_0x4288('0x14'),_0x250772,JSON['stringify'](_0x1782d2));_0x59dffa[_0x4288('0x15')]();});}}catch(_0x1c3a7f){logger[_0x4288('0x16')](_0x4288('0x14'),_0x250772,JSON[_0x4288('0x17')](_0x1c3a7f));_0x59dffa[_0x4288('0x15')]();}};}; \ 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 d766dd1..ee43573 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 _0xe984=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','consequence','info'];(function(_0x49fb98,_0x410fbe){var _0x1d5cde=function(_0x366b17){while(--_0x366b17){_0x49fb98['push'](_0x49fb98['shift']());}};_0x1d5cde(++_0x410fbe);}(_0xe984,0xe2));var _0x4e98=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xe984[_0x4429e0];return _0x51a5b3;};'use strict';var utils=require('./utils');var logger=require(_0x4e98('0x0'))(_0x4e98('0x1'));exports[_0x4e98('0x2')]=function(_0x162f51,_0x3c3cda){return function(_0x449b1e){try{logger[_0x4e98('0x3')](_0x4e98('0x4'),_0x162f51,utils[_0x4e98('0x5')](_0x3c3cda[0x0],this));_0x449b1e[_0x4e98('0x6')]();}catch(_0x51128c){logger[_0x4e98('0x7')](_0x4e98('0x4'),_0x162f51,JSON[_0x4e98('0x8')](_0x51128c));_0x449b1e[_0x4e98('0x9')]();}};}; \ No newline at end of file +var _0x7bb6=['info','getMustacheRender','[%s][NOOP]\x20%s','stop','./utils','routing','consequence'];(function(_0x48d79c,_0x3d2857){var _0x15798c=function(_0x5f15af){while(--_0x5f15af){_0x48d79c['push'](_0x48d79c['shift']());}};_0x15798c(++_0x3d2857);}(_0x7bb6,0x1d9));var _0x67bb=function(_0xa78022,_0x596949){_0xa78022=_0xa78022-0x0;var _0x424f59=_0x7bb6[_0xa78022];return _0x424f59;};'use strict';var utils=require(_0x67bb('0x0'));var logger=require('../../../../config/logger')(_0x67bb('0x1'));exports[_0x67bb('0x2')]=function(_0x5ef6cc,_0x33d4f6){return function(_0x7e2bd1){try{logger[_0x67bb('0x3')]('[%s][NOOP]\x20%s',_0x5ef6cc,utils[_0x67bb('0x4')](_0x33d4f6[0x0],this));_0x7e2bd1['next']();}catch(_0x4d2e86){logger['error'](_0x67bb('0x5'),_0x5ef6cc,JSON['stringify'](_0x4d2e86));_0x7e2bd1[_0x67bb('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 746b7fa..0d59c7e 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 _0x92f0=['stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','routing','defaults','redis','localhost','account','queue','from','joinAt','emit','clone','queue_id','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','QueueId','InteractionId','channel','message','AccountId','WebsiteId','name','QueueReport','catch','error','accepted','update\x20queue\x20report','waiting','timeout','info','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map'];(function(_0x19cf1f,_0x4105e3){var _0x234028=function(_0x24748c){while(--_0x24748c){_0x19cf1f['push'](_0x19cf1f['shift']());}};_0x234028(++_0x4105e3);}(_0x92f0,0xa0));var _0x092f=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x92f0[_0x16b992];return _0x385c78;};'use strict';var schema=require(_0x092f('0x0'));var _=require(_0x092f('0x1'));var util=require('util');var seqqueue=require(_0x092f('0x2'));var moment=require(_0x092f('0x3'));var Redis=require(_0x092f('0x4'));var config=require(_0x092f('0x5'));var logger=require('../../../../config/logger')(_0x092f('0x6'));var strategy=require('./strategy');config['redis']=_[_0x092f('0x7')](config[_0x092f('0x8')],{'host':_0x092f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x092f('0x8')]));var attributes=['id','queue_id',_0x092f('0xa'),_0x092f('0xb'),_0x092f('0xc'),_0x092f('0xd')];function emit(_0x24d786,_0x2a6f48,_0x4569ef){io['to'](_0x24d786)[_0x092f('0xe')](_0x2a6f48,_0x4569ef);}function emitChannelQueueInteraction(_0x20c57e,_0x1647b,_0x113111,_0x20fcb0,_0x518145,_0x369fd0,_0x1c4395,_0x53303d){var _0x15aaa2=_[_0x092f('0xf')](_0x113111);_0x15aaa2[_0x092f('0x10')]=_0x53303d;_0x15aaa2[_0x092f('0xb')]=_0x1647b;_0x15aaa2[_0x092f('0xa')]=_0x20fcb0;_0x15aaa2['id']=_0x518145;if(_0x369fd0){_0x1c4395[util[_0x092f('0x11')](_0x092f('0x12'),_0x20c57e)][_0x518145]=_[_0x092f('0x13')](_0x15aaa2,attributes);}else{delete _0x1c4395[util[_0x092f('0x11')](_0x092f('0x12'),_0x20c57e)][_0x518145];}emit(util[_0x092f('0x11')](_0x092f('0x14'),_0x20c57e,_0x1647b),util[_0x092f('0x11')](_0x092f('0x15'),_0x20c57e,_0x369fd0?_0x092f('0x16'):'remove'),_['pick'](_0x15aaa2,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x092f('0x17')),'chatQueueReport':require(_0x092f('0x18')),'smsQueueReport':require(_0x092f('0x19')),'faxQueueReport':require(_0x092f('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x092f('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x092f('0x1c'),'message':_0x092f('0x1d')}});function startRouting(_0x5709a4,_0x1a71f3,_0x4aca0d,_0x46daae){if(_0x5709a4&&_0x1a71f3&&_0x4aca0d){_0x1a71f3['waiting']+=0x1;var _0x3f7ed0={'uniqueid':_0x5709a4,'from':_0x4aca0d[_0x092f('0x1e')]?_0x4aca0d[_0x092f('0x1e')][_0x092f('0xc')]:'','joinAt':moment()[_0x092f('0x11')](_0x092f('0x1f')),'ContactId':_0x4aca0d['contact']?_0x4aca0d['contact']['id']:null,'ListId':_0x4aca0d[_0x092f('0x20')]?_0x4aca0d[_0x092f('0x20')]['id']:null};_0x3f7ed0[_[_0x092f('0x21')](_0x4aca0d['channel'])+_0x092f('0x22')]=_0x1a71f3['id']||null;_0x3f7ed0[_[_0x092f('0x21')](_0x4aca0d['channel'])+_0x092f('0x23')]=_0x4aca0d['interaction']?_0x4aca0d['interaction']['id']:null;_0x3f7ed0[_[_0x092f('0x21')](_0x4aca0d[_0x092f('0x24')])+'MessageId']=_0x4aca0d[_0x092f('0x25')]?_0x4aca0d[_0x092f('0x25')]['id']:null;_0x3f7ed0[_['upperFirst'](_0x4aca0d[_0x092f('0x24')])+(_0x4aca0d['channel']!=='chat'?_0x092f('0x26'):_0x092f('0x27'))]=_0x4aca0d[_0x092f('0xa')]?_0x4aca0d['account']['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x5709a4,_0x1a71f3['name']));emitChannelQueueInteraction(_0x4aca0d['channel'],_0x1a71f3[_0x092f('0x28')],_0x3f7ed0,_0x4aca0d[_0x092f('0xa')][_0x092f('0x28')],_0x4aca0d[_0x092f('0x25')]['id'],!![],_0x46daae,_0x1a71f3['id']);if(rpc[_0x4aca0d[_0x092f('0x24')]+'QueueReport']){return rpc[_0x4aca0d[_0x092f('0x24')]+_0x092f('0x29')]['create'](_0x3f7ed0)[_0x092f('0x2a')](function(_0x130c2e){logger[_0x092f('0x2b')]('create\x20queue\x20report');});}}}function stopRouting(_0x47379f,_0x3731ea,_0x14a723,_0x5e5b5e){if(_0x47379f&&_0x3731ea){_0x3731ea['waiting']-=0x1;var _0x205783={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x092f('0x2c')};logger['info'](util[_0x092f('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x47379f,_0x3731ea[_0x092f('0x28')]));emitChannelQueueInteraction(_0x14a723['channel'],_0x3731ea[_0x092f('0x28')],_0x14a723[_0x092f('0x1e')],_0x14a723[_0x092f('0xa')][_0x092f('0x28')],_0x14a723['message']['id'],![],_0x5e5b5e,_0x3731ea['id']);if(rpc[_0x14a723[_0x092f('0x24')]+_0x092f('0x29')]){return rpc[_0x14a723['channel']+_0x092f('0x29')]['update'](_0x47379f,_0x205783)['catch'](function(_0x18cbe0){logger['error'](_0x092f('0x2d'));});}}}function endRouting(_0x433765,_0x3ad6f7,_0x33159f,_0x49dc63){if(_0x433765&&_0x3ad6f7){_0x3ad6f7[_0x092f('0x2e')]-=0x1;var _0x438506={'leaveAt':moment()[_0x092f('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x092f('0x11')](_0x092f('0x1f')),'reason':_0x092f('0x2f')};logger[_0x092f('0x30')](util[_0x092f('0x11')](_0x092f('0x31'),_0x433765,_0x3ad6f7['name']));emitChannelQueueInteraction(_0x33159f[_0x092f('0x24')],_0x3ad6f7[_0x092f('0x28')],_0x33159f[_0x092f('0x1e')],_0x33159f[_0x092f('0xa')][_0x092f('0x28')],_0x33159f[_0x092f('0x25')]['id'],![],_0x49dc63);if(rpc[_0x33159f['channel']+_0x092f('0x29')]){return rpc[_0x33159f[_0x092f('0x24')]+_0x092f('0x29')][_0x092f('0x32')](_0x433765,_0x438506)[_0x092f('0x2a')](function(_0x3ddc0f){logger[_0x092f('0x2b')](_0x092f('0x2d'));});}}}function handleFindQueue(_0x287a02){return function(_0x4f14c4){return _0x4f14c4[_0x092f('0x28')]['toLowerCase']()===_0x287a02[_0x092f('0x33')]();};}exports[_0x092f('0x34')]=function(_0x5e45cd,_0x298ec0,_0x42e9e9,_0x4b7743){return function(_0x3f896d){try{var _0x1da44e={'name':_0x298ec0[0x0],'timeout':_0x298ec0[0x1]};var _0x33b555=queue['validate'](_0x1da44e,{'typecast':!![]});if(_0x33b555[_0x092f('0x35')]){logger[_0x092f('0x2b')](_0x092f('0x36'),_0x5e45cd,_[_0x092f('0x37')](_0x33b555,_0x092f('0x25'))['join'](',\x20'));_0x3f896d[_0x092f('0x38')]();}else{var _0x40da60=_[_0x092f('0x39')](_0x42e9e9[_0x4b7743[_0x092f('0x24')]+_0x092f('0x3a')],handleFindQueue(_0x1da44e[_0x092f('0x28')]));if(_0x40da60){startRouting(_0x5e45cd,_0x40da60,_0x4b7743,_0x42e9e9);var _0x20c5c1=(_0x40da60[_0x092f('0x2f')]||0xa)*0x3e8;var _0x27291a=(_0x1da44e[_0x092f('0x2f')]||0x14)*0x3e8;var _0x3bb0c5,_0x37ffc6;if(_0x20c5c1>_0x27291a){_0x27291a=_0x20c5c1;}var _0x39b9d6=seqqueue[_0x092f('0x3b')](_0x20c5c1);_0x39b9d6['id']=_0x5e45cd;_0x39b9d6[_0x092f('0x3c')]=_0x20c5c1;_0x39b9d6[_0x092f('0x3d')]=_0x27291a;_0x39b9d6[_0x092f('0x24')]=_0x4b7743['channel'];_0x42e9e9[_0x092f('0x3e')][_0x5e45cd]['on'](_0x092f('0x3f'),function(){logger[_0x092f('0x30')](_0x092f('0x40'),_0x5e45cd);stopRouting(_0x5e45cd,_0x40da60,_0x4b7743,_0x42e9e9);clearTimeout(_0x3bb0c5);_0x3bb0c5=undefined;_0x39b9d6[_0x092f('0x41')](!![]);if(_0x42e9e9[_0x092f('0x3e')][_0x5e45cd]){delete _0x42e9e9[_0x092f('0x3e')][_0x5e45cd];}_0x3f896d[_0x092f('0x38')]();});_0x42e9e9[_0x092f('0x3e')][_0x5e45cd]['on'](_0x092f('0x42'),function(){if(_0x42e9e9[_0x092f('0x3e')][_0x5e45cd]){delete _0x42e9e9[_0x092f('0x3e')][_0x5e45cd];}});_0x3bb0c5=setTimeout(function(){logger[_0x092f('0x30')](_0x092f('0x43'),_0x5e45cd);endRouting(_0x5e45cd,_0x40da60,_0x4b7743,_0x42e9e9);clearTimeout(_0x3bb0c5);_0x39b9d6[_0x092f('0x41')](!![]);_0x3f896d['next']();},_0x27291a);switch(_0x40da60[_0x092f('0x44')]){case _0x092f('0x45'):strategy[_0x092f('0x45')](_0x39b9d6,_0x40da60,_0x42e9e9,_0x4b7743);break;default:strategy['beepall'](_0x39b9d6,_0x40da60,_0x42e9e9,_0x4b7743);}}else{logger[_0x092f('0x2b')](_0x092f('0x46'),_0x5e45cd,_0x1da44e['name']);_0x3f896d[_0x092f('0x38')]();}}}catch(_0x4d075a){console[_0x092f('0x47')](_0x4d075a);logger[_0x092f('0x2b')](_0x092f('0x36'),_0x5e45cd,_0x4d075a['stack']);_0x3f896d[_0x092f('0x38')]();}};}; \ No newline at end of file +var _0x52c1=['pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','./strategy','defaults','socket.io-emitter','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x52c1,0x1ce));var _0x152c=function(_0x6a43ba,_0x47aa3c){_0x6a43ba=_0x6a43ba-0x0;var _0x70f3ad=_0x52c1[_0x6a43ba];return _0x70f3ad;};'use strict';var schema=require(_0x152c('0x0'));var _=require(_0x152c('0x1'));var util=require(_0x152c('0x2'));var seqqueue=require(_0x152c('0x3'));var moment=require(_0x152c('0x4'));var Redis=require(_0x152c('0x5'));var config=require('../../../../config/environment');var logger=require(_0x152c('0x6'))('routing');var strategy=require(_0x152c('0x7'));config['redis']=_[_0x152c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x152c('0x9'))(new Redis(config['redis']));var attributes=['id',_0x152c('0xa'),_0x152c('0xb'),_0x152c('0xc'),_0x152c('0xd'),'joinAt'];function emit(_0x2527f6,_0xf4eed1,_0x4d326f){io['to'](_0x2527f6)[_0x152c('0xe')](_0xf4eed1,_0x4d326f);}function emitChannelQueueInteraction(_0xc31fc6,_0x1756a1,_0x191715,_0x1f8475,_0x116dc1,_0x121ed0,_0x445015,_0x26a087){var _0x328bc9=_[_0x152c('0xf')](_0x191715);_0x328bc9['queue_id']=_0x26a087;_0x328bc9[_0x152c('0xc')]=_0x1756a1;_0x328bc9[_0x152c('0xb')]=_0x1f8475;_0x328bc9['id']=_0x116dc1;if(_0x121ed0){_0x445015[util[_0x152c('0x10')](_0x152c('0x11'),_0xc31fc6)][_0x116dc1]=_[_0x152c('0x12')](_0x328bc9,attributes);}else{delete _0x445015[util[_0x152c('0x10')](_0x152c('0x11'),_0xc31fc6)][_0x116dc1];}emit(util[_0x152c('0x10')]('%s:queue:%s',_0xc31fc6,_0x1756a1),util[_0x152c('0x10')](_0x152c('0x13'),_0xc31fc6,_0x121ed0?_0x152c('0x14'):_0x152c('0x15')),_['pick'](_0x328bc9,attributes));}var rpc={'openchannelQueueReport':require(_0x152c('0x16')),'mailQueueReport':require(_0x152c('0x17')),'chatQueueReport':require(_0x152c('0x18')),'smsQueueReport':require(_0x152c('0x19')),'faxQueueReport':require(_0x152c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x152c('0x1b'),'required':!![],'message':_0x152c('0x1c')},'timeout':{'type':_0x152c('0x1d'),'message':_0x152c('0x1e')}});function startRouting(_0x31a16b,_0x38c8f3,_0x44f5ce,_0x31b304){if(_0x31a16b&&_0x38c8f3&&_0x44f5ce){_0x38c8f3[_0x152c('0x1f')]+=0x1;var _0xacb5f0={'uniqueid':_0x31a16b,'from':_0x44f5ce[_0x152c('0x20')]?_0x44f5ce[_0x152c('0x20')][_0x152c('0xd')]:'','joinAt':moment()['format'](_0x152c('0x21')),'ContactId':_0x44f5ce['contact']?_0x44f5ce['contact']['id']:null,'ListId':_0x44f5ce['list']?_0x44f5ce['list']['id']:null};_0xacb5f0[_[_0x152c('0x22')](_0x44f5ce[_0x152c('0x23')])+_0x152c('0x24')]=_0x38c8f3['id']||null;_0xacb5f0[_[_0x152c('0x22')](_0x44f5ce[_0x152c('0x23')])+_0x152c('0x25')]=_0x44f5ce[_0x152c('0x26')]?_0x44f5ce[_0x152c('0x26')]['id']:null;_0xacb5f0[_['upperFirst'](_0x44f5ce['channel'])+_0x152c('0x27')]=_0x44f5ce[_0x152c('0x28')]?_0x44f5ce[_0x152c('0x28')]['id']:null;_0xacb5f0[_[_0x152c('0x22')](_0x44f5ce[_0x152c('0x23')])+(_0x44f5ce[_0x152c('0x23')]!==_0x152c('0x29')?_0x152c('0x2a'):'WebsiteId')]=_0x44f5ce[_0x152c('0xb')]?_0x44f5ce[_0x152c('0xb')]['id']:null;logger[_0x152c('0x2b')](util['format'](_0x152c('0x2c'),_0x31a16b,_0x38c8f3[_0x152c('0x2d')]));emitChannelQueueInteraction(_0x44f5ce['channel'],_0x38c8f3['name'],_0xacb5f0,_0x44f5ce[_0x152c('0xb')][_0x152c('0x2d')],_0x44f5ce[_0x152c('0x28')]['id'],!![],_0x31b304,_0x38c8f3['id']);if(rpc[_0x44f5ce[_0x152c('0x23')]+_0x152c('0x2e')]){return rpc[_0x44f5ce['channel']+_0x152c('0x2e')][_0x152c('0x2f')](_0xacb5f0)['catch'](function(_0x127e43){logger[_0x152c('0x30')](_0x152c('0x31'));});}}}function stopRouting(_0x224446,_0x20617a,_0x14eab8,_0x5c0fe0){if(_0x224446&&_0x20617a){_0x20617a['waiting']-=0x1;var _0x488a75={'leaveAt':moment()[_0x152c('0x10')](_0x152c('0x21')),'acceptAt':moment()[_0x152c('0x10')](_0x152c('0x21')),'reason':_0x152c('0x32')};logger[_0x152c('0x2b')](util[_0x152c('0x10')](_0x152c('0x33'),_0x224446,_0x20617a[_0x152c('0x2d')]));emitChannelQueueInteraction(_0x14eab8[_0x152c('0x23')],_0x20617a[_0x152c('0x2d')],_0x14eab8[_0x152c('0x20')],_0x14eab8[_0x152c('0xb')][_0x152c('0x2d')],_0x14eab8[_0x152c('0x28')]['id'],![],_0x5c0fe0,_0x20617a['id']);if(rpc[_0x14eab8[_0x152c('0x23')]+_0x152c('0x2e')]){return rpc[_0x14eab8['channel']+_0x152c('0x2e')]['update'](_0x224446,_0x488a75)[_0x152c('0x34')](function(_0x2914f2){logger['error'](_0x152c('0x35'));});}}}function endRouting(_0x56ddc3,_0x56855e,_0x29e47e,_0x1dcafa){if(_0x56ddc3&&_0x56855e){_0x56855e[_0x152c('0x1f')]-=0x1;var _0x3f7177={'leaveAt':moment()[_0x152c('0x10')](_0x152c('0x21')),'exitAt':moment()[_0x152c('0x10')](_0x152c('0x21')),'reason':_0x152c('0x36')};logger['info'](util[_0x152c('0x10')](_0x152c('0x37'),_0x56ddc3,_0x56855e[_0x152c('0x2d')]));emitChannelQueueInteraction(_0x29e47e[_0x152c('0x23')],_0x56855e[_0x152c('0x2d')],_0x29e47e[_0x152c('0x20')],_0x29e47e[_0x152c('0xb')]['name'],_0x29e47e[_0x152c('0x28')]['id'],![],_0x1dcafa);if(rpc[_0x29e47e[_0x152c('0x23')]+'QueueReport']){return rpc[_0x29e47e[_0x152c('0x23')]+_0x152c('0x2e')][_0x152c('0x38')](_0x56ddc3,_0x3f7177)[_0x152c('0x34')](function(_0x49d93d){logger[_0x152c('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x8706a0){return function(_0x278772){return _0x278772[_0x152c('0x2d')][_0x152c('0x39')]()===_0x8706a0[_0x152c('0x39')]();};}exports[_0x152c('0x3a')]=function(_0x2e77dc,_0x3d9ae3,_0x1f2ecc,_0x46c2f8){return function(_0x31964a){try{var _0x43cc4d={'name':_0x3d9ae3[0x0],'timeout':_0x3d9ae3[0x1]};var _0x1baff2=queue['validate'](_0x43cc4d,{'typecast':!![]});if(_0x1baff2[_0x152c('0x3b')]){logger[_0x152c('0x30')](_0x152c('0x3c'),_0x2e77dc,_[_0x152c('0x3d')](_0x1baff2,_0x152c('0x28'))[_0x152c('0x3e')](',\x20'));_0x31964a['stop']();}else{var _0x5a6f9c=_[_0x152c('0x3f')](_0x1f2ecc[_0x46c2f8[_0x152c('0x23')]+_0x152c('0x40')],handleFindQueue(_0x43cc4d[_0x152c('0x2d')]));if(_0x5a6f9c){startRouting(_0x2e77dc,_0x5a6f9c,_0x46c2f8,_0x1f2ecc);var _0x5d2f24=(_0x5a6f9c[_0x152c('0x36')]||0xa)*0x3e8;var _0x21c76e=(_0x43cc4d[_0x152c('0x36')]||0x14)*0x3e8;var _0x2f2a7c,_0x46a16f;if(_0x5d2f24>_0x21c76e){_0x21c76e=_0x5d2f24;}var _0x31361c=seqqueue[_0x152c('0x41')](_0x5d2f24);_0x31361c['id']=_0x2e77dc;_0x31361c[_0x152c('0x42')]=_0x5d2f24;_0x31361c[_0x152c('0x43')]=_0x21c76e;_0x31361c[_0x152c('0x23')]=_0x46c2f8['channel'];_0x1f2ecc[_0x152c('0x44')][_0x2e77dc]['on'](_0x152c('0x45'),function(){logger[_0x152c('0x2b')](_0x152c('0x46'),_0x2e77dc);stopRouting(_0x2e77dc,_0x5a6f9c,_0x46c2f8,_0x1f2ecc);clearTimeout(_0x2f2a7c);_0x2f2a7c=undefined;_0x31361c[_0x152c('0x47')](!![]);if(_0x1f2ecc[_0x152c('0x44')][_0x2e77dc]){delete _0x1f2ecc[_0x152c('0x44')][_0x2e77dc];}_0x31964a[_0x152c('0x48')]();});_0x1f2ecc[_0x152c('0x44')][_0x2e77dc]['on'](_0x152c('0x49'),function(){if(_0x1f2ecc[_0x152c('0x44')][_0x2e77dc]){delete _0x1f2ecc[_0x152c('0x44')][_0x2e77dc];}});_0x2f2a7c=setTimeout(function(){logger[_0x152c('0x2b')](_0x152c('0x4a'),_0x2e77dc);endRouting(_0x2e77dc,_0x5a6f9c,_0x46c2f8,_0x1f2ecc);clearTimeout(_0x2f2a7c);_0x31361c[_0x152c('0x47')](!![]);_0x31964a[_0x152c('0x4b')]();},_0x21c76e);switch(_0x5a6f9c['strategy']){case _0x152c('0x4c'):strategy[_0x152c('0x4c')](_0x31361c,_0x5a6f9c,_0x1f2ecc,_0x46c2f8);break;default:strategy[_0x152c('0x4d')](_0x31361c,_0x5a6f9c,_0x1f2ecc,_0x46c2f8);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2e77dc,_0x43cc4d[_0x152c('0x2d')]);_0x31964a[_0x152c('0x48')]();}}}catch(_0x3b40c9){console[_0x152c('0x4e')](_0x3b40c9);logger[_0x152c('0x30')](_0x152c('0x3c'),_0x2e77dc,_0x3b40c9[_0x152c('0x4f')]);_0x31964a[_0x152c('0x48')]();}};}; \ 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 4da1b7f..3f73ce2 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 _0xd832=['isNil','agents','info','forcedOwnership','isAgentAvailable','channel','busy','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x22aa61,_0x45e107){var _0x51500a=function(_0x16a73b){while(--_0x16a73b){_0x22aa61['push'](_0x22aa61['shift']());}};_0x51500a(++_0x45e107);}(_0xd832,0x145));var _0x2d83=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xd832[_0xf71120];return _0xbe2fd3;};'use strict';var _=require('lodash');var uuid=require(_0x2d83('0x0'));var util=require('./util');var logger=require(_0x2d83('0x1'))(_0x2d83('0x2'));var Agent=function(_0x203551,_0x475267,_0x581a47,_0x5e8564){this[_0x2d83('0x3')]=uuid['v4']();this[_0x2d83('0x4')]=_0x203551;this[_0x2d83('0x5')]=_0x475267;this[_0x2d83('0x6')]=_0x581a47;this[_0x2d83('0x2')]=_0x5e8564;this[_0x2d83('0x4')][_0x2d83('0x7')](this[_0x2d83('0x8')][_0x2d83('0x9')](this),this[_0x2d83('0xa')]['bind'](this));this['squeue']['on'](_0x2d83('0xb'),this[_0x2d83('0xa')][_0x2d83('0x9')](this));this['squeue']['on'](_0x2d83('0xc'),this[_0x2d83('0xd')][_0x2d83('0x9')](this));};Agent[_0x2d83('0xe')][_0x2d83('0x7')]=function(){this['squeue']['push'](this[_0x2d83('0x8')][_0x2d83('0x9')](this),this['handleTimeout'][_0x2d83('0x9')](this));};Agent[_0x2d83('0xe')][_0x2d83('0xd')]=function(){this[_0x2d83('0xa')](!![]);};Agent[_0x2d83('0xe')]['handleRun']=function(_0x5a5841){logger['info'](_0x2d83('0xf'),this[_0x2d83('0x4')]['id'],this[_0x2d83('0x5')]['id']);if(_[_0x2d83('0x10')](this[_0x2d83('0x6')][_0x2d83('0x11')][this['agent']['id']])){logger[_0x2d83('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x2d83('0x5')]['id']);setTimeout(this[_0x2d83('0x7')][_0x2d83('0x9')](this),0x3e8);}else{if(this[_0x2d83('0x2')][_0x2d83('0x13')]||util[_0x2d83('0x14')](this[_0x2d83('0x4')]['id'],this[_0x2d83('0x6')][_0x2d83('0x11')][this[_0x2d83('0x5')]['id']],this[_0x2d83('0x4')][_0x2d83('0x15')],![])){this['realtime']['agents'][this[_0x2d83('0x5')]['id']][_0x2d83('0x16')]=!![];this[_0x2d83('0x6')][_0x2d83('0x11')][this[_0x2d83('0x5')]['id']]['busyQueue']=undefined;util[_0x2d83('0x17')](this[_0x2d83('0x3')],this[_0x2d83('0x4')]['id'],this['realtime'][_0x2d83('0x11')][this['agent']['id']],null,this[_0x2d83('0x2')]);util[_0x2d83('0x18')](this[_0x2d83('0x4')]['id'],this[_0x2d83('0x6')][_0x2d83('0x11')][this[_0x2d83('0x5')]['id']],'RINGING'+(this['routing']['forcedOwnership']?_0x2d83('0x19'):''));}else{logger[_0x2d83('0x12')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x2d83('0x7')]['bind'](this),0x3e8);}}};Agent[_0x2d83('0xe')][_0x2d83('0xa')]=function(_0x3f5bea){if(_['isNil'](this[_0x2d83('0x6')]['agents'][this[_0x2d83('0x5')]['id']])){return logger['info'](_0x2d83('0x1a'),this['squeue']['id'],this[_0x2d83('0x5')]['id']);}else{logger[_0x2d83('0x12')](_0x2d83('0x1b'),this['squeue']['id'],this[_0x2d83('0x5')]['id']);util[_0x2d83('0x1c')](this[_0x2d83('0x3')],this[_0x2d83('0x4')]['id'],this[_0x2d83('0x6')]['agents'][this[_0x2d83('0x5')]['id']],null,this[_0x2d83('0x2')]);this[_0x2d83('0x6')][_0x2d83('0x11')][this[_0x2d83('0x5')]['id']][_0x2d83('0x16')]=![];this[_0x2d83('0x6')]['agents'][this[_0x2d83('0x5')]['id']][_0x2d83('0x1d')]=undefined;util[_0x2d83('0x18')](this[_0x2d83('0x4')]['id'],this['realtime'][_0x2d83('0x11')][this[_0x2d83('0x5')]['id']],_0x3f5bea?'STOP':'TIMEOUT');}if(!_0x3f5bea){setTimeout(this['push'][_0x2d83('0x9')](this),0x3e8);}};function agent(_0xc135d2,_0x5099d2,_0x23a4e0,_0x195206){return new Agent(_0xc135d2,_0x5099d2,_0x23a4e0,_0x195206);}module[_0x2d83('0x1e')]=agent; \ No newline at end of file +var _0x3b2e=['forcedOwnership','isAgentAvailable','channel','busy','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x42dfe5,_0x2e16cf){var _0x3bed33=function(_0x5be6e2){while(--_0x5be6e2){_0x42dfe5['push'](_0x42dfe5['shift']());}};_0x3bed33(++_0x2e16cf);}(_0x3b2e,0x19a));var _0xe3b2=function(_0xfecbad,_0x5915f8){_0xfecbad=_0xfecbad-0x0;var _0x5e1806=_0x3b2e[_0xfecbad];return _0x5e1806;};'use strict';var _=require(_0xe3b2('0x0'));var uuid=require(_0xe3b2('0x1'));var util=require(_0xe3b2('0x2'));var logger=require('../../../../../config/logger')(_0xe3b2('0x3'));var Agent=function(_0x11fab4,_0x425867,_0x3e7d9c,_0x25cc68){this['notificationId']=uuid['v4']();this[_0xe3b2('0x4')]=_0x11fab4;this[_0xe3b2('0x5')]=_0x425867;this[_0xe3b2('0x6')]=_0x3e7d9c;this[_0xe3b2('0x3')]=_0x25cc68;this[_0xe3b2('0x4')][_0xe3b2('0x7')](this[_0xe3b2('0x8')][_0xe3b2('0x9')](this),this[_0xe3b2('0xa')]['bind'](this));this[_0xe3b2('0x4')]['on'](_0xe3b2('0xb'),this['handleTimeout'][_0xe3b2('0x9')](this));this[_0xe3b2('0x4')]['on'](_0xe3b2('0xc'),this[_0xe3b2('0xd')][_0xe3b2('0x9')](this));};Agent[_0xe3b2('0xe')]['push']=function(){this[_0xe3b2('0x4')]['push'](this[_0xe3b2('0x8')][_0xe3b2('0x9')](this),this[_0xe3b2('0xa')][_0xe3b2('0x9')](this));};Agent[_0xe3b2('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xe3b2('0xe')]['handleRun']=function(_0x536b15){logger[_0xe3b2('0xf')](_0xe3b2('0x10'),this['squeue']['id'],this[_0xe3b2('0x5')]['id']);if(_['isNil'](this['realtime'][_0xe3b2('0x11')][this[_0xe3b2('0x5')]['id']])){logger[_0xe3b2('0xf')](_0xe3b2('0x12'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xe3b2('0x7')][_0xe3b2('0x9')](this),0x3e8);}else{if(this[_0xe3b2('0x3')][_0xe3b2('0x13')]||util[_0xe3b2('0x14')](this[_0xe3b2('0x4')]['id'],this[_0xe3b2('0x6')][_0xe3b2('0x11')][this[_0xe3b2('0x5')]['id']],this[_0xe3b2('0x4')][_0xe3b2('0x15')],![])){this[_0xe3b2('0x6')][_0xe3b2('0x11')][this[_0xe3b2('0x5')]['id']][_0xe3b2('0x16')]=!![];this[_0xe3b2('0x6')][_0xe3b2('0x11')][this[_0xe3b2('0x5')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0xe3b2('0x17')],this[_0xe3b2('0x4')]['id'],this['realtime'][_0xe3b2('0x11')][this[_0xe3b2('0x5')]['id']],null,this[_0xe3b2('0x3')]);util[_0xe3b2('0x18')](this[_0xe3b2('0x4')]['id'],this[_0xe3b2('0x6')][_0xe3b2('0x11')][this[_0xe3b2('0x5')]['id']],_0xe3b2('0x19')+(this[_0xe3b2('0x3')][_0xe3b2('0x13')]?_0xe3b2('0x1a'):''));}else{logger[_0xe3b2('0xf')](_0xe3b2('0x1b'),this[_0xe3b2('0x4')]['id'],this[_0xe3b2('0x5')]['id']);setTimeout(this[_0xe3b2('0x7')][_0xe3b2('0x9')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x4558bc){if(_['isNil'](this[_0xe3b2('0x6')][_0xe3b2('0x11')][this['agent']['id']])){return logger[_0xe3b2('0xf')](_0xe3b2('0x12'),this[_0xe3b2('0x4')]['id'],this['agent']['id']);}else{logger[_0xe3b2('0xf')](_0xe3b2('0x1c'),this[_0xe3b2('0x4')]['id'],this['agent']['id']);util['hideNotification'](this[_0xe3b2('0x17')],this['squeue']['id'],this[_0xe3b2('0x6')]['agents'][this[_0xe3b2('0x5')]['id']],null,this[_0xe3b2('0x3')]);this[_0xe3b2('0x6')][_0xe3b2('0x11')][this[_0xe3b2('0x5')]['id']]['busy']=![];this[_0xe3b2('0x6')]['agents'][this[_0xe3b2('0x5')]['id']][_0xe3b2('0x1d')]=undefined;util[_0xe3b2('0x18')](this['squeue']['id'],this['realtime']['agents'][this['agent']['id']],_0x4558bc?_0xe3b2('0x1e'):_0xe3b2('0x1f'));}if(!_0x4558bc){setTimeout(this[_0xe3b2('0x7')][_0xe3b2('0x9')](this),0x3e8);}};function agent(_0x2aa2b8,_0x423947,_0x354ddd,_0x5d2aef){return new Agent(_0x2aa2b8,_0x423947,_0x354ddd,_0x5d2aef);}module[_0xe3b2('0x20')]=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 9723117..64d5927 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 _0x2086=['push','handleDrained','isNil','Agents','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','STOP','TIMEOUT','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','queue','realtime','handleRun','bind','timeout','handleTimeout','drained','prototype'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x2086,0x124));var _0x6208=function(_0x211ce3,_0x395f0e){_0x211ce3=_0x211ce3-0x0;var _0x2c66df=_0x2086[_0x211ce3];return _0x2c66df;};'use strict';var _=require(_0x6208('0x0'));var uuid=require(_0x6208('0x1'));var util=require(_0x6208('0x2'));var logger=require(_0x6208('0x3'))(_0x6208('0x4'));var Beepall=function(_0x13962a,_0x562353,_0x2c72bb,_0x2ae558){this['notificationId']=uuid['v4']();this[_0x6208('0x5')]=_0x13962a;this[_0x6208('0x6')]=_0x562353;this[_0x6208('0x7')]=_0x2c72bb;this[_0x6208('0x4')]=_0x2ae558;this[_0x6208('0x5')]['push'](this[_0x6208('0x8')]['bind'](this),this['handleTimeout'][_0x6208('0x9')](this));this[_0x6208('0x5')]['on'](_0x6208('0xa'),this[_0x6208('0xb')][_0x6208('0x9')](this));this[_0x6208('0x5')]['on'](_0x6208('0xc'),this['handleDrained'][_0x6208('0x9')](this));};Beepall[_0x6208('0xd')][_0x6208('0xe')]=function(){this[_0x6208('0x5')][_0x6208('0xe')](this['handleRun'][_0x6208('0x9')](this),this['handleTimeout'][_0x6208('0x9')](this));};Beepall[_0x6208('0xd')][_0x6208('0xf')]=function(_0x53962d){this[_0x6208('0xb')](!![]);};Beepall[_0x6208('0xd')][_0x6208('0x8')]=function(_0x4e9fb3){var _0x307367=!![];if(!_[_0x6208('0x10')](this[_0x6208('0x6')])&&!_['isNil'](this[_0x6208('0x6')][_0x6208('0x11')])&&this[_0x6208('0x6')]['Agents']['length']>0x0){for(var _0x43263a=0x0,_0x54aef1;_0x43263a0x0){for(var _0x11e178=0x0,_0x1d807b;_0x11e1780x0&&_0x31555d[_0x2a22e3+_0x47b8('0x28')]>=_0x31555d[_0x2a22e3+'Capacity']){writeLog(_0x54f6bc,_0x31555d,_0x2a22e3[_0x47b8('0x29')]()+_0x47b8('0x2a'));return![];}}return!![];};exports['showNotification']=function(_0x195a66,_0x6d517a,_0x147878,_0x3dcf1a,_0x4da0e0){return sendNotification(!![],_0x195a66,_0x6d517a,_0x147878,_0x3dcf1a,_0x4da0e0);};exports[_0x47b8('0x2b')]=function(_0x5c347f,_0x2c89fc,_0x2255ab,_0x33e653,_0x2e540d){return sendNotification(![],_0x5c347f,_0x2c89fc,_0x2255ab,_0x33e653,_0x2e540d);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xef17=['emit','format','user:%s','name','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','error','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','socket.io-emitter'];(function(_0x41a96e,_0x1815cf){var _0x4ded71=function(_0x16551e){while(--_0x16551e){_0x41a96e['push'](_0x41a96e['shift']());}};_0x4ded71(++_0x1815cf);}(_0xef17,0x136));var _0x7ef1=function(_0x486ee6,_0x3578a8){_0x486ee6=_0x486ee6-0x0;var _0x4dbbd7=_0xef17[_0x486ee6];return _0x4dbbd7;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var utils=require(_0x7ef1('0x2'));var Mustache=require(_0x7ef1('0x3'));var Redis=require(_0x7ef1('0x4'));var config=require(_0x7ef1('0x5'));var logger=require(_0x7ef1('0x6'))(_0x7ef1('0x7'));config[_0x7ef1('0x8')]=_['defaults'](config[_0x7ef1('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7ef1('0x9'))(new Redis(config['redis']));function emit(_0x34a040,_0x4ba2f0,_0x5aec63){io['to'](_0x34a040)[_0x7ef1('0xa')](_0x4ba2f0,_0x5aec63);}function sendNotification(_0x3398a6,_0x56ab07,_0xeb10e9,_0x1d5b33,_0x4534fc,_0x3d47e2){io['to'](util[_0x7ef1('0xb')](_0x7ef1('0xc'),_0x1d5b33[_0x7ef1('0xd')]))['emit']('user:save',_0x1d5b33);var _0x1d4522=_0x3d47e2||{};var _0x4dc653=_0xeb10e9['split']('.');var _0x4d60ae={'uniqueid':_0x56ab07,'channel':_0x4dc653[0x0],'id':_0x4dc653[0x1],'title':_0x4dc653[0x0]+_0x7ef1('0xe'),'interactionId':_0x4dc653[0x2],'queue':_0x4534fc?_0x4534fc['name']:null,'sound':_0x1d4522[_0x7ef1('0xf')][_0x7ef1('0x10')],'shake':_0x1d4522[_0x7ef1('0xf')][_0x7ef1('0x11')]};try{if(!_0x1d4522[_0x7ef1('0x12')]){_0x1d4522[_0x7ef1('0x12')]={};}if(_0x4534fc){_0x1d4522[_0x7ef1('0x12')][_0x7ef1('0x13')]=_0x4534fc;}else if(_0x1d4522['body']['queue']){delete _0x1d4522[_0x7ef1('0x12')]['queue'];}_0x4d60ae[_0x7ef1('0x14')]=utils[_0x7ef1('0x15')](_0x1d4522['account']['notificationTemplate'],_0x1d4522);}catch(_0x5d269a){_0x4d60ae[_0x7ef1('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x7ef1('0x16')](util['format']('[%s][QUEUE]\x20%s',_0x56ab07,_0x5d269a['message']));}io['to'](util[_0x7ef1('0xb')]('user:%s',_0x1d5b33[_0x7ef1('0xd')]))[_0x7ef1('0xa')](util['format']('notification:%s',_0x3398a6?_0x7ef1('0x17'):'remove'),_0x4d60ae);}function writeLog(_0x458459,_0x33f89b,_0x2f8164){return logger[_0x7ef1('0x18')](util[_0x7ef1('0xb')](_0x7ef1('0x19'),_0x458459,_0x33f89b[_0x7ef1('0xd')],_0x2f8164));}exports[_0x7ef1('0x1a')]=function(_0x490162,_0x2a1bdd,_0x3b118f,_0x3f26fb){if(_0x2a1bdd[_0x7ef1('0x1b')]){writeLog(_0x490162,_0x2a1bdd,_0x7ef1('0x1c'));return![];}if(!_0x2a1bdd[_0x7ef1('0x1d')]){writeLog(_0x490162,_0x2a1bdd,_0x7ef1('0x1e'));return![];}if(_0x2a1bdd[_0x3b118f+_0x7ef1('0x1f')]){writeLog(_0x490162,_0x2a1bdd,'PAUSE');return![];}if(_0x3f26fb&&_0x2a1bdd['hasOwnProperty'](_0x3b118f+_0x7ef1('0x20'))&&_0x2a1bdd[_0x7ef1('0x21')](_0x3b118f+_0x7ef1('0x22'))){if(_0x2a1bdd[_0x3b118f+_0x7ef1('0x20')]>0x0&&_0x2a1bdd[_0x3b118f+_0x7ef1('0x22')]>=_0x2a1bdd[_0x3b118f+'Capacity']){writeLog(_0x490162,_0x2a1bdd,_0x3b118f[_0x7ef1('0x23')]()+_0x7ef1('0x24'));return![];}}return!![];};exports[_0x7ef1('0x25')]=function(_0x4af5f5,_0x232f4e,_0x238fdc,_0x21e8c5,_0x58e7ee){return sendNotification(!![],_0x4af5f5,_0x232f4e,_0x238fdc,_0x21e8c5,_0x58e7ee);};exports[_0x7ef1('0x26')]=function(_0x4b0380,_0x3306b0,_0x2546bf,_0x4b5fde,_0x5f25de){return sendNotification(![],_0x4b0380,_0x3306b0,_0x2546bf,_0x4b5fde,_0x5f25de);};exports[_0x7ef1('0x27')]=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 3f51a6e..407885b 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 _0x65c7=['next','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','string','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','exec','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x1d535f,_0x344191){var _0x1533d8=function(_0x1bd33e){while(--_0x1bd33e){_0x1d535f['push'](_0x1d535f['shift']());}};_0x1533d8(++_0x344191);}(_0x65c7,0x137));var _0x765c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x65c7[_0x5b644e];return _0x49c6bf;};'use strict';var schema=require('validate');var sh=require(_0x765c('0x0'));var _=require(_0x765c('0x1'));var utils=require(_0x765c('0x2'));var logger=require(_0x765c('0x3'))('routing');var system=schema({'command':{'type':_0x765c('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x765c('0x5')]=function(_0x267b96,_0x206b1a){return function(_0x10e3c2){try{var _0x3a127b={'command':_0x206b1a[0x0]};var _0x87e37f=system['validate'](_0x3a127b,{'typecast':!![]});if(_0x87e37f[_0x765c('0x6')]){logger[_0x765c('0x7')](_0x765c('0x8'),_0x267b96,_['map'](_0x87e37f,'message')[_0x765c('0x9')](',\x20'));logger[_0x765c('0xa')](_0x765c('0xb'),_0x267b96);_0x10e3c2['next']();}else{var _0x221031=this;var _0x51db98=utils['getMustacheRender'](_0x206b1a[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x267b96,_0x51db98);sh[_0x765c('0xc')](_['trim'](_0x51db98),function(_0x4050ce,_0x23fe6f){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x267b96,_0x4050ce);if(_0x4050ce==0x0){var _0xf05179=_0x23fe6f[_0x765c('0xd')](/(\r\n|\n|\r)/gm,'');if(_[_0x765c('0xe')](_0x206b1a[0x1])||_[_0x765c('0xf')](_0x206b1a[0x1])){logger['info'](_0x765c('0x10'),_0x267b96);_0x221031[_0x765c('0x11')][_0x206b1a[0x1]]=_0xf05179;}else{logger[_0x765c('0xa')](_0x765c('0x12'),_0x267b96,_0x206b1a[0x1],_0xf05179);_0x221031[_0x765c('0x11')][_0x206b1a[0x1]]=_0xf05179;}}_0x10e3c2[_0x765c('0x13')]();});}}catch(_0x4bfb18){logger[_0x765c('0x7')](_0x765c('0x8'),_0x267b96,_[_0x765c('0x14')](_0x4bfb18)?JSON[_0x765c('0x15')](_0x4bfb18):_0x4bfb18);logger[_0x765c('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x267b96);_0x10e3c2[_0x765c('0x13')]();}};}; \ No newline at end of file +var _0x71a1=['replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','map','message','join','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x2f68be,_0x2441a3){var _0x1cec85=function(_0x2b18e7){while(--_0x2b18e7){_0x2f68be['push'](_0x2f68be['shift']());}};_0x1cec85(++_0x2441a3);}(_0x71a1,0xfa));var _0x171a=function(_0x39b26a,_0x42cadf){_0x39b26a=_0x39b26a-0x0;var _0x2257a0=_0x71a1[_0x39b26a];return _0x2257a0;};'use strict';var schema=require(_0x171a('0x0'));var sh=require(_0x171a('0x1'));var _=require(_0x171a('0x2'));var utils=require(_0x171a('0x3'));var logger=require(_0x171a('0x4'))(_0x171a('0x5'));var system=schema({'command':{'type':_0x171a('0x6'),'required':!![],'message':_0x171a('0x7')}});exports['consequence']=function(_0x4833af,_0x279bb9){return function(_0x1a5c98){try{var _0x584a2d={'command':_0x279bb9[0x0]};var _0x3cbd45=system['validate'](_0x584a2d,{'typecast':!![]});if(_0x3cbd45['length']){logger[_0x171a('0x8')](_0x171a('0x9'),_0x4833af,_[_0x171a('0xa')](_0x3cbd45,_0x171a('0xb'))[_0x171a('0xc')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4833af);_0x1a5c98[_0x171a('0xd')]();}else{var _0x5250f8=this;var _0x4d31d9=utils[_0x171a('0xe')](_0x279bb9[0x0],this);logger[_0x171a('0xf')](_0x171a('0x10'),_0x4833af,_0x4d31d9);sh[_0x171a('0x11')](_[_0x171a('0x12')](_0x4d31d9),function(_0x9c7760,_0x16325c){logger[_0x171a('0xf')](_0x171a('0x13'),_0x4833af,_0x9c7760);if(_0x9c7760==0x0){var _0x57c22a=_0x16325c[_0x171a('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x171a('0x15')](_0x279bb9[0x1])||_[_0x171a('0x16')](_0x279bb9[0x1])){logger[_0x171a('0xf')](_0x171a('0x17'),_0x4833af);_0x5250f8[_0x171a('0x18')][_0x279bb9[0x1]]=_0x57c22a;}else{logger[_0x171a('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4833af,_0x279bb9[0x1],_0x57c22a);_0x5250f8['body'][_0x279bb9[0x1]]=_0x57c22a;}}_0x1a5c98['next']();});}}catch(_0x5784ee){logger['error']('[%s][SYSTEM]\x20%s',_0x4833af,_[_0x171a('0x19')](_0x5784ee)?JSON['stringify'](_0x5784ee):_0x5784ee);logger[_0x171a('0xf')](_0x171a('0x1a'),_0x4833af);_0x1a5c98[_0x171a('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index b83aafb..3669ed9 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 _0x0054=['error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate'];(function(_0x386388,_0x3dbfa6){var _0x4b9cc1=function(_0x5ede23){while(--_0x5ede23){_0x386388['push'](_0x386388['shift']());}};_0x4b9cc1(++_0x3dbfa6);}(_0x0054,0x1ca));var _0x4005=function(_0x2265d6,_0x3fe205){_0x2265d6=_0x2265d6-0x0;var _0x275dda=_0x0054[_0x2265d6];return _0x275dda;};'use strict';var schema=require('validate');var _=require(_0x4005('0x0'));var rpc={'chatInteraction':require(_0x4005('0x1')),'openchannelInteraction':require(_0x4005('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x4005('0x3')),'faxInteraction':require(_0x4005('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x4005('0x5'))(_0x4005('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x4005('0x7')}});exports[_0x4005('0x8')]=function(_0x59ab9a,_0x47c161,_0x2ab1c5,_0x1a955a){return function(_0x400c5a){try{var _0x5a6a57={'tag':_0x47c161[0x0]};var _0x40c1c0=tag[_0x4005('0x9')](_0x5a6a57,{'typecast':!![]});if(_0x40c1c0['length']){logger[_0x4005('0xa')](_0x4005('0xb'),_0x59ab9a,_[_0x4005('0xc')](_0x40c1c0,_0x4005('0xd'))[_0x4005('0xe')](',\x20'));logger[_0x4005('0xf')](_0x4005('0x10'),_0x59ab9a);_0x400c5a['next']();}else{var _0x375f91={'ids':[_0x47c161[0x0]]};if(rpc[_0x1a955a['channel']+_0x4005('0x11')]){rpc[_0x1a955a[_0x4005('0x12')]+_0x4005('0x11')][_0x4005('0x13')](_0x1a955a[_0x4005('0x14')]['id'],_0x375f91)['then'](function(_0xd29e8e){logger[_0x4005('0xf')](_0x4005('0x15'),_0x59ab9a,_0x47c161[0x1],_0x1a955a['channel'],_0x1a955a[_0x4005('0x14')]['id']);})[_0x4005('0x16')](function(_0x224304){logger[_0x4005('0xa')](_0x4005('0xb'),_0x59ab9a,JSON[_0x4005('0x17')](_0x224304));logger[_0x4005('0xf')](_0x4005('0x10'),_0x59ab9a);})[_0x4005('0x18')](function(){_0x400c5a[_0x4005('0x19')]();});}}}catch(_0x25944e){logger[_0x4005('0xa')](_0x4005('0xb'),_0x59ab9a,_['isObject'](_0x25944e)?JSON[_0x4005('0x17')](_0x25944e):_0x25944e);logger[_0x4005('0xf')](_0x4005('0x10'),_0x59ab9a);_0x400c5a[_0x4005('0x19')]();}};}; \ No newline at end of file +var _0x7df0=['next','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','stringify','finally'];(function(_0x11c4b4,_0x623b6b){var _0x59e808=function(_0x413389){while(--_0x413389){_0x11c4b4['push'](_0x11c4b4['shift']());}};_0x59e808(++_0x623b6b);}(_0x7df0,0x13a));var _0x07df=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7df0[_0x934425];return _0x31d596;};'use strict';var schema=require('validate');var _=require(_0x07df('0x0'));var rpc={'chatInteraction':require(_0x07df('0x1')),'openchannelInteraction':require(_0x07df('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x07df('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x07df('0x4'))};var logger=require(_0x07df('0x5'))(_0x07df('0x6'));var tag=schema({'tag':{'type':_0x07df('0x7'),'required':!![],'message':_0x07df('0x8')}});exports[_0x07df('0x9')]=function(_0x367781,_0x33e3bf,_0x1ebd8d,_0x471f37){return function(_0x2582cb){try{var _0x3ee458={'tag':_0x33e3bf[0x0]};var _0x552e9e=tag[_0x07df('0xa')](_0x3ee458,{'typecast':!![]});if(_0x552e9e[_0x07df('0xb')]){logger['error']('[%s][TAG]\x20%s',_0x367781,_[_0x07df('0xc')](_0x552e9e,'message')['join'](',\x20'));logger[_0x07df('0xd')](_0x07df('0xe'),_0x367781);_0x2582cb['next']();}else{var _0x95bc21={'ids':[_0x33e3bf[0x0]]};if(rpc[_0x471f37[_0x07df('0xf')]+_0x07df('0x10')]){rpc[_0x471f37[_0x07df('0xf')]+_0x07df('0x10')][_0x07df('0x11')](_0x471f37[_0x07df('0x12')]['id'],_0x95bc21)[_0x07df('0x13')](function(_0x54cfc3){logger[_0x07df('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x367781,_0x33e3bf[0x1],_0x471f37[_0x07df('0xf')],_0x471f37[_0x07df('0x12')]['id']);})['catch'](function(_0x481958){logger['error']('[%s][TAG]\x20%s',_0x367781,JSON[_0x07df('0x14')](_0x481958));logger['info'](_0x07df('0xe'),_0x367781);})[_0x07df('0x15')](function(){_0x2582cb[_0x07df('0x16')]();});}}}catch(_0xf6f0c){logger['error']('[%s][TAG]\x20%s',_0x367781,_[_0x07df('0x17')](_0xf6f0c)?JSON[_0x07df('0x14')](_0xf6f0c):_0xf6f0c);logger[_0x07df('0xd')](_0x07df('0xe'),_0x367781);_0x2582cb[_0x07df('0x16')]();}};}; \ 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 f57598c..c4726df 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0xd74d39,_0x4e572e){var _0x4d1022=function(_0x474150){while(--_0x474150){_0xd74d39['push'](_0xd74d39['shift']());}};_0x4d1022(++_0x4e572e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2f1ca1,_0x57cc48){var _0x4dd018=function(_0x110985){while(--_0x110985){_0x2f1ca1['push'](_0x2f1ca1['shift']());}};_0x4dd018(++_0x57cc48);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 029f045..f6621f3 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 _0xc8ac=['split','push','slice','join','dialogflow','appdata','dialogflowv2','tag','TagId','%s:%s:%s','./interval','condition','intervals','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','stringify','127.0.0.1','log','lodash','util','path','jayson/promise','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','app','toLowerCase','autoreply'];(function(_0x2a50de,_0x239010){var _0x16fb5c=function(_0x5e39a2){while(--_0x5e39a2){_0x2a50de['push'](_0x2a50de['shift']());}};_0x16fb5c(++_0x239010);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0xc8ac[_0x26b622];return _0x58a028;};'use strict';var _=require(_0xcc8a('0x0'));var util=require(_0xcc8a('0x1'));var path=require(_0xcc8a('0x2'));var fs=require('fs');var jayson=require(_0xcc8a('0x3'));var BPromise=require('bluebird');var uuid=require(_0xcc8a('0x4'));var config=require('../../../config/environment');var logger=require(_0xcc8a('0x5'))(_0xcc8a('0x6'));var rpc={'openchannelQueueReport':require(_0xcc8a('0x7')),'mailQueueReport':require(_0xcc8a('0x8')),'chatQueueReport':require(_0xcc8a('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xcc8a('0xa'))};var RuleEngine=require(_0xcc8a('0xb'));function getId(_0x3bd2e3,_0x4e4982,_0x55031d){return util[_0xcc8a('0xc')](_0xcc8a('0xd'),_0x3bd2e3,_0x4e4982||0x0,_0x55031d||0x0);}function getIntervals(_0x5f3565,_0x3fa245){var _0x34f02f=[];if(!_['isNil'](_0x3fa245[_0xcc8a('0xe')])&&!_['isNil'](_0x5f3565[_0x3fa245['IntervalId']])&&!_[_0xcc8a('0xf')](_0x5f3565[_0x3fa245[_0xcc8a('0xe')]][_0xcc8a('0x10')])){_0x34f02f=_[_0xcc8a('0x11')](_0x5f3565[_0x3fa245[_0xcc8a('0xe')]][_0xcc8a('0x10')],_0xcc8a('0x12'));}else if(!_[_0xcc8a('0xf')](_0x3fa245[_0xcc8a('0x12')])){_0x34f02f=[_0x3fa245[_0xcc8a('0x12')]];}return _0x34f02f;}exports[_0xcc8a('0x13')]=function(_0x5208bf){_0x5208bf[_0xcc8a('0x14')]={};return new BPromise(function(_0x19c3bd,_0x290a00){var _0x38b571={'Start':function(_0x2fb79b){var _0x29c447=this;return new Promise(function(_0x590053,_0x3a6bde){if(_0x2fb79b){try{var _0x42ceb5=[];var _0x439ce2=getId(_0x2fb79b[_0xcc8a('0x15')],_0x2fb79b[_0xcc8a('0x16')]?_0x2fb79b[_0xcc8a('0x16')]['id']:0x0,_0x2fb79b[_0xcc8a('0x17')]?_0x2fb79b['interaction']['id']:0x0);if(_0x2fb79b['applications']&&_[_0xcc8a('0x18')](_0x2fb79b[_0xcc8a('0x19')])&&_0x2fb79b[_0xcc8a('0x19')][_0xcc8a('0x1a')]){for(var _0x48101c=0x0;_0x48101c<_0x2fb79b[_0xcc8a('0x19')]['length'];_0x48101c+=0x1){var _0x471f1d=_0x2fb79b[_0xcc8a('0x19')][_0x48101c];if(fs[_0xcc8a('0x1b')](path['join'](__dirname,_0xcc8a('0x19'),_0x471f1d[_0xcc8a('0x1c')]+'.js'))){var _0x3373ca=[];switch(_0x471f1d[_0xcc8a('0x1c')][_0xcc8a('0x1d')]()){case _0xcc8a('0x1e'):var _0x213bba=_0x471f1d['appdata'][_0xcc8a('0x1f')](',');if(_0x2fb79b[_0xcc8a('0x15')]==='mail'){_0x3373ca[_0xcc8a('0x20')](_0x213bba[0x0]);_0x3373ca[_0xcc8a('0x20')](_0x213bba[0x1]);_0x3373ca['push'](_0x213bba[_0xcc8a('0x21')](0x2,_0x213bba[_0xcc8a('0x1a')])[_0xcc8a('0x22')](','));}else{_0x3373ca[_0xcc8a('0x20')](_0x213bba[0x0]);_0x3373ca[_0xcc8a('0x20')](_0x213bba[_0xcc8a('0x21')](0x1,_0x213bba[_0xcc8a('0x1a')])[_0xcc8a('0x22')](','));}break;case _0xcc8a('0x23'):var _0x1f85fb=_0x471f1d[_0xcc8a('0x24')][_0xcc8a('0x1f')](',');_0x3373ca['push'](_0x1f85fb[0x0]);_0x3373ca[_0xcc8a('0x20')](_0x1f85fb[0x1]);_0x3373ca[_0xcc8a('0x20')](_0x1f85fb['slice'](0x2,_0x1f85fb[_0xcc8a('0x1a')])[_0xcc8a('0x22')](','));break;case _0xcc8a('0x25'):var _0xa05041=_0x471f1d['appdata'][_0xcc8a('0x1f')](',');_0x3373ca[_0xcc8a('0x20')](_0xa05041[0x0]);_0x3373ca[_0xcc8a('0x20')](_0xa05041[0x1]);_0x3373ca[_0xcc8a('0x20')](_0xa05041[0x2]);_0x3373ca[_0xcc8a('0x20')](_0xa05041[0x3]);_0x3373ca[_0xcc8a('0x20')](_0xa05041[_0xcc8a('0x21')](0x4,_0xa05041[_0xcc8a('0x1a')])['join'](','));break;case'amazonlex':var _0x3100a3=_0x471f1d['appdata'][_0xcc8a('0x1f')](',');_0x3373ca[_0xcc8a('0x20')](_0x3100a3[0x0]);_0x3373ca['push'](_0x3100a3[0x1]);_0x3373ca[_0xcc8a('0x20')](_0x3100a3[0x2]);_0x3373ca['push'](_0x3100a3[0x3]);_0x3373ca['push'](_0x3100a3[_0xcc8a('0x21')](0x4,_0x3100a3[_0xcc8a('0x1a')])[_0xcc8a('0x22')](','));break;case _0xcc8a('0x16'):_0x3373ca['push'](_0x471f1d['appdata']);break;case _0xcc8a('0x26'):_0x3373ca[_0xcc8a('0x20')](_0x471f1d[_0xcc8a('0x27')]);_0x3373ca[_0xcc8a('0x20')](_0x471f1d[_0xcc8a('0x24')]);break;default:_0x3373ca=_[_0xcc8a('0xf')](_0x471f1d[_0xcc8a('0x24')])?[]:_0x471f1d[_0xcc8a('0x24')][_0xcc8a('0x1f')](',');}var _0x3bd63b={'id':util[_0xcc8a('0xc')](_0xcc8a('0x28'),_0x439ce2,_0x471f1d['id'],_0x471f1d['app']),'condition':require(_0xcc8a('0x29'))[_0xcc8a('0x2a')](_0x439ce2,getIntervals(_0x5208bf[_0xcc8a('0x2b')],_0x471f1d),_0x5208bf),'consequence':require('./applications/'+_0x471f1d[_0xcc8a('0x1c')])['consequence'](_0x439ce2,_0x3373ca,_0x5208bf,_0x2fb79b),'p':_0x471f1d['priority']||0x0};logger[_0xcc8a('0x2c')]('Push\x20new\x20rule',_0x3bd63b['id'],_0xcc8a('0x2d'),getIntervals(_0x5208bf[_0xcc8a('0x2b')],_0x471f1d)[_0xcc8a('0x22')](_0xcc8a('0x2e')));_0x42ceb5[_0xcc8a('0x20')](_0x3bd63b);}else{logger['error'](_0xcc8a('0x2f'),path[_0xcc8a('0x22')](__dirname,_0xcc8a('0x19'),_0x471f1d[_0xcc8a('0x1c')]+'.js'));}}_0x5208bf['rules'][_0x439ce2]=new RuleEngine(_0x42ceb5);_0x5208bf[_0xcc8a('0x14')][_0x439ce2]['execute'](_0x2fb79b,function(_0x540e4b){logger['info']('Applications\x20executed',JSON['stringify'](_0x540e4b[_0xcc8a('0x30')]));if(_0x5208bf[_0xcc8a('0x14')][_0x439ce2]){_0x5208bf[_0xcc8a('0x14')][_0x439ce2][_0xcc8a('0x31')](_0xcc8a('0x32'));}});return _0x590053({'code':0xc8,'message':_0x2fb79b});}else{logger['info'](_0xcc8a('0x33'));return _0x590053({'code':0xc8,'message':_0x2fb79b});}}catch(_0x1caa7e){logger[_0xcc8a('0x34')](_0x1caa7e['stack']);return _0x3a6bde(_0x29c447['error'](0x1f4,_0x1caa7e));}}return _0x3a6bde(_0xcc8a('0x35'));});},'AcceptMessage':function(_0x492667){var _0x306b9c=this;return new Promise(function(_0x51a907,_0x207325){if(_0x492667[_0xcc8a('0x36')]&&_0x492667[_0xcc8a('0x36')]['id']){if(_0x5208bf['agents'][_0x492667[_0xcc8a('0x36')]['id']]){_0x5208bf[_0xcc8a('0x37')][_0x492667['agent']['id']][_0xcc8a('0x38')]=![];_0x5208bf[_0xcc8a('0x37')][_0x492667[_0xcc8a('0x36')]['id']]['busyQueue']=undefined;}}if(_0x492667[_0xcc8a('0x16')]&&_0x492667['message']['id']){try{var _0x5121fc=getId(_0x492667[_0xcc8a('0x15')],_0x492667[_0xcc8a('0x16')]?_0x492667[_0xcc8a('0x16')]['id']:0x0,_0x492667[_0xcc8a('0x17')]?_0x492667[_0xcc8a('0x17')]['id']:0x0);if(_0x5208bf[_0xcc8a('0x14')][_0x5121fc]){_0x5208bf[_0xcc8a('0x14')][_0x5121fc]['emit'](_0xcc8a('0x39'));if(rpc[_0x492667[_0xcc8a('0x15')]+_0xcc8a('0x3a')]){rpc[_0x492667[_0xcc8a('0x15')]+_0xcc8a('0x3a')][_0xcc8a('0x3b')](_0x5121fc,{'UserId':_0x492667[_0xcc8a('0x16')]['UserId']})['catch'](function(_0x46009a){logger['error'](_0xcc8a('0x3c'));});}}return _0x51a907({'code':0xc8,'message':_0x492667});}catch(_0x4d46b5){logger['error'](_0x4d46b5[_0xcc8a('0x3d')]);return _0x207325(_0x306b9c[_0xcc8a('0x34')](0x1f4,_0x4d46b5));}}logger[_0xcc8a('0x34')](_0xcc8a('0x3e'));return _0x207325(_0x306b9c[_0xcc8a('0x34')](0x1f4,_0xcc8a('0x3e')));});},'RejectMessage':function(_0x4f0af7){var _0x5c48ee=this;return new Promise(function(_0xa2d5,_0x3d405c){if(_0x4f0af7['agent']&&_0x4f0af7[_0xcc8a('0x36')]['id']){try{if(_0x5208bf['agents'][_0x4f0af7[_0xcc8a('0x36')]['id']]){_0x5208bf[_0xcc8a('0x37')][_0x4f0af7[_0xcc8a('0x36')]['id']][_0xcc8a('0x38')]=![];_0x5208bf[_0xcc8a('0x37')][_0x4f0af7[_0xcc8a('0x36')]['id']][_0xcc8a('0x3f')]=undefined;}return _0xa2d5({'code':0xc8,'message':_0x4f0af7});}catch(_0x5cbcff){logger[_0xcc8a('0x34')](_0x5cbcff[_0xcc8a('0x3d')]);return _0x3d405c(_0x5c48ee[_0xcc8a('0x34')](0x1f4,_0x5cbcff));}}logger[_0xcc8a('0x34')](_0xcc8a('0x3e'));return _0x3d405c(_0x5c48ee[_0xcc8a('0x34')](0x1f4,_0xcc8a('0x3e')));});},'AbandonInteraction':function(_0x6cdef2){var _0x50df3a=this;return new Promise(function(_0xe56cd,_0x774d5e){if(_0x6cdef2[_0xcc8a('0x15')]&&_0x6cdef2[_0xcc8a('0x17')]&&_0x6cdef2[_0xcc8a('0x17')]['id']){try{var _0x3d7403=getId(_0x6cdef2['channel'],_0x6cdef2[_0xcc8a('0x16')]?_0x6cdef2[_0xcc8a('0x16')]['id']:0x0,_0x6cdef2[_0xcc8a('0x17')]?_0x6cdef2[_0xcc8a('0x17')]['id']:0x0);if(_0x5208bf[_0xcc8a('0x14')][_0x3d7403]){_0x5208bf[_0xcc8a('0x14')][_0x3d7403][_0xcc8a('0x31')]('end');}return _0xe56cd({'code':0xc8,'message':_0x6cdef2});}catch(_0x2a7fc9){logger['error'](_0x2a7fc9['stack']);return _0x774d5e(_0x50df3a['error'](0x1f4,_0x2a7fc9));}}logger[_0xcc8a('0x34')](_0xcc8a('0x3e'));return _0x774d5e(_0x50df3a[_0xcc8a('0x34')](0x1f4,_0xcc8a('0x3e')));});},'AgentCapacity':function(_0x5e86ef){var _0x31c017=this;return new Promise(function(_0xac4e6f,_0x5231e3){if(_0x5208bf[_0xcc8a('0x37')][_0xcc8a('0x40')](_0x5e86ef['id'])){for(var _0x482b8e in _0x5e86ef[_0xcc8a('0x41')]){if(_0x5e86ef[_0xcc8a('0x41')][_0xcc8a('0x40')](_0x482b8e)){if(_0x5208bf[_0xcc8a('0x37')][_0x5e86ef['id']][_0xcc8a('0x40')](_0x482b8e+_0xcc8a('0x42'))){_0x5208bf[_0xcc8a('0x37')][_0x5e86ef['id']][_0x482b8e+_0xcc8a('0x42')]=parseInt(_0x5e86ef[_0xcc8a('0x41')][_0x482b8e],0xa);}}}_0x5208bf[_0xcc8a('0x37')][_0x5e86ef['id']][_0xcc8a('0x43')]();return _0xac4e6f({'code':0xc8,'message':_0x5208bf['agents'][_0x5e86ef['id']]});}else{return _0x5231e3(_0x31c017['error'](0x1f4,_0xcc8a('0x44')));}});},'Agents':function(_0x1276c0){return new Promise(function(_0x5371c3,_0xc19df2){var _0x341369=_['values'](_0x5208bf[_0xcc8a('0x37')]);_0x5371c3({'count':_0x341369[_0xcc8a('0x1a')],'rows':_0x341369});});},'ChatQueues':function(_0x2fc801){return new Promise(function(_0x354ad5,_0x26c4d6){var _0x3c4ef2=[];for(var _0x4dbc00 in _0x5208bf[_0xcc8a('0x45')]){if(_0x5208bf[_0xcc8a('0x45')][_0xcc8a('0x40')](_0x4dbc00)){var _0x16316b=_0x5208bf['chatQueues'][_0x4dbc00];var _0x4f72d1={'id':_0x16316b['id'],'available':_0x16316b[_0xcc8a('0x46')],'loggedIn':_0x16316b[_0xcc8a('0x47')],'name':_0x16316b[_0xcc8a('0x48')],'paused':_0x16316b[_0xcc8a('0x49')],'waiting':_0x16316b[_0xcc8a('0x4a')]};_0x3c4ef2[_0xcc8a('0x20')](_0x4f72d1);}}_0x354ad5({'count':_0x3c4ef2[_0xcc8a('0x1a')],'rows':_0x3c4ef2});});},'MailQueues':function(_0x139d27){return new Promise(function(_0x23fc8f,_0x1a4658){var _0x12b78c=[];for(var _0x170a30 in _0x5208bf['mailQueues']){if(_0x5208bf[_0xcc8a('0x4b')][_0xcc8a('0x40')](_0x170a30)){var _0x1ba280=_0x5208bf[_0xcc8a('0x4b')][_0x170a30];var _0x47fc1f={'id':_0x1ba280['id'],'available':_0x1ba280[_0xcc8a('0x46')],'loggedIn':_0x1ba280[_0xcc8a('0x47')],'name':_0x1ba280[_0xcc8a('0x48')],'paused':_0x1ba280[_0xcc8a('0x49')],'waiting':_0x1ba280[_0xcc8a('0x4a')]};_0x12b78c['push'](_0x47fc1f);}}_0x23fc8f({'count':_0x12b78c[_0xcc8a('0x1a')],'rows':_0x12b78c});});},'OpenchannelQueues':function(_0x10b64e){return new Promise(function(_0x592ec9,_0x5e3915){var _0x1d1281=[];for(var _0x57e894 in _0x5208bf['openchannelQueues']){if(_0x5208bf[_0xcc8a('0x4c')]['hasOwnProperty'](_0x57e894)){var _0x453a76=_0x5208bf[_0xcc8a('0x4c')][_0x57e894];var _0xe73f3d={'id':_0x453a76['id'],'available':_0x453a76[_0xcc8a('0x46')],'loggedIn':_0x453a76['loggedIn'],'name':_0x453a76[_0xcc8a('0x48')],'paused':_0x453a76[_0xcc8a('0x49')],'waiting':_0x453a76[_0xcc8a('0x4a')]};_0x1d1281[_0xcc8a('0x20')](_0xe73f3d);}}_0x592ec9({'count':_0x1d1281[_0xcc8a('0x1a')],'rows':_0x1d1281});});},'SmsQueues':function(_0x3a7d13){return new Promise(function(_0x16098f,_0xc789af){var _0x2c2b8a=[];for(var _0x538aa7 in _0x5208bf['smsQueues']){if(_0x5208bf[_0xcc8a('0x4d')][_0xcc8a('0x40')](_0x538aa7)){var _0x45f197=_0x5208bf[_0xcc8a('0x4d')][_0x538aa7];var _0x5703c0={'id':_0x45f197['id'],'available':_0x45f197['available'],'loggedIn':_0x45f197[_0xcc8a('0x47')],'name':_0x45f197[_0xcc8a('0x48')],'paused':_0x45f197[_0xcc8a('0x49')],'waiting':_0x45f197['waiting']};_0x2c2b8a[_0xcc8a('0x20')](_0x5703c0);}}_0x16098f({'count':_0x2c2b8a[_0xcc8a('0x1a')],'rows':_0x2c2b8a});});},'FaxQueues':function(_0x4cbdad){return new Promise(function(_0x5d6b22,_0x3af056){var _0x144fb1=[];for(var _0x8015b5 in _0x5208bf['faxQueues']){if(_0x5208bf[_0xcc8a('0x4e')][_0xcc8a('0x40')](_0x8015b5)){var _0x1c868d=_0x5208bf['faxQueues'][_0x8015b5];var _0x32a00a={'id':_0x1c868d['id'],'available':_0x1c868d[_0xcc8a('0x46')],'loggedIn':_0x1c868d['loggedIn'],'name':_0x1c868d[_0xcc8a('0x48')],'paused':_0x1c868d['paused'],'waiting':_0x1c868d['waiting']};_0x144fb1[_0xcc8a('0x20')](_0x32a00a);}}_0x5d6b22({'count':_0x144fb1[_0xcc8a('0x1a')],'rows':_0x144fb1});});},'WhatsappQueues':function(_0x52ecaf){return new Promise(function(_0x57ce24,_0x1e7980){var _0xec3acf=[];for(var _0xcaa017 in _0x5208bf['whatsappQueues']){if(_0x5208bf[_0xcc8a('0x4f')][_0xcc8a('0x40')](_0xcaa017)){var _0x330382=_0x5208bf[_0xcc8a('0x4f')][_0xcaa017];var _0x577f92={'id':_0x330382['id'],'available':_0x330382[_0xcc8a('0x46')],'loggedIn':_0x330382['loggedIn'],'name':_0x330382[_0xcc8a('0x48')],'paused':_0x330382[_0xcc8a('0x49')],'waiting':_0x330382['waiting']};_0xec3acf[_0xcc8a('0x20')](_0x577f92);}}_0x57ce24({'count':_0xec3acf[_0xcc8a('0x1a')],'rows':_0xec3acf});});},'ChatQueuesWaitingInteractions':function(_0x2de439){return new Promise(function(_0x4f6b34,_0x22f1ea){var _0x5eca77=_[_0xcc8a('0x50')](_0x5208bf[_0xcc8a('0x51')]);_0x4f6b34({'count':_0x5eca77[_0xcc8a('0x1a')],'rows':_0x5eca77});});},'MailQueuesWaitingInteractions':function(_0x393628){return new Promise(function(_0x42fab4,_0x322d49){var _0x37ee33=_[_0xcc8a('0x50')](_0x5208bf['mailQueuesWaitingInteractions']);_0x42fab4({'count':_0x37ee33['length'],'rows':_0x37ee33});});},'OpenchannelQueuesWaitingInteractions':function(_0x19abda){return new Promise(function(_0x123648,_0x29aef2){var _0x3a13e3=_[_0xcc8a('0x50')](_0x5208bf[_0xcc8a('0x52')]);_0x123648({'count':_0x3a13e3['length'],'rows':_0x3a13e3});});},'SmsQueuesWaitingInteractions':function(_0xbf6936){return new Promise(function(_0x335c74,_0x28e39b){var _0x236784=_[_0xcc8a('0x50')](_0x5208bf['smsQueuesWaitingInteractions']);_0x335c74({'count':_0x236784[_0xcc8a('0x1a')],'rows':_0x236784});});},'FaxQueuesWaitingInteractions':function(_0x2eb6d8){return new Promise(function(_0xb905db,_0x4dd585){var _0x45966b=_[_0xcc8a('0x50')](_0x5208bf[_0xcc8a('0x53')]);_0xb905db({'count':_0x45966b[_0xcc8a('0x1a')],'rows':_0x45966b});});},'WhatsappQueuesWaitingInteractions':function(_0x4ce7db){return new Promise(function(_0x4f2d51,_0x5ae206){var _0x18f5d9=_['values'](_0x5208bf['whatsappQueuesWaitingInteractions']);_0x4f2d51({'count':_0x18f5d9[_0xcc8a('0x1a')],'rows':_0x18f5d9});});}};var _0x2c50f3=jayson['server'](_0x38b571)[_0xcc8a('0x54')]();_0x2c50f3['on']('error',function(_0x14b111){logger[_0xcc8a('0x34')](JSON[_0xcc8a('0x55')](_0x14b111));return _0x290a00(_0x14b111);});_0x2c50f3[_0xcc8a('0x13')](0x232c,_0xcc8a('0x56'),function(){console[_0xcc8a('0x57')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x19c3bd('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xcd07=['error\x20update\x20queue\x20report','message\x20is\x20empty','emit','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','IntervalId','isNil','Intervals','map','interval','rules','channel','message','interaction','isArray','applications','length','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','TagId','%s:%s:%s','app','./interval','condition','./applications/','consequence','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','info','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch'];(function(_0x43d33a,_0x3379){var _0x194770=function(_0x5735cb){while(--_0x5735cb){_0x43d33a['push'](_0x43d33a['shift']());}};_0x194770(++_0x3379);}(_0xcd07,0x1d3));var _0x7cd0=function(_0x38c809,_0x2632c1){_0x38c809=_0x38c809-0x0;var _0x4971f5=_0xcd07[_0x38c809];return _0x4971f5;};'use strict';var _=require(_0x7cd0('0x0'));var util=require('util');var path=require(_0x7cd0('0x1'));var fs=require('fs');var jayson=require(_0x7cd0('0x2'));var BPromise=require(_0x7cd0('0x3'));var uuid=require(_0x7cd0('0x4'));var config=require('../../../config/environment');var logger=require(_0x7cd0('0x5'))(_0x7cd0('0x6'));var rpc={'openchannelQueueReport':require(_0x7cd0('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x7cd0('0x8')),'faxQueueReport':require(_0x7cd0('0x9')),'whatsappQueueReport':require(_0x7cd0('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2fd3de,_0x841f21,_0x1c9ed8){return util[_0x7cd0('0xb')]('%s.%s.%s',_0x2fd3de,_0x841f21||0x0,_0x1c9ed8||0x0);}function getIntervals(_0x497593,_0x15fddc){var _0x3a5c94=[];if(!_['isNil'](_0x15fddc[_0x7cd0('0xc')])&&!_[_0x7cd0('0xd')](_0x497593[_0x15fddc['IntervalId']])&&!_[_0x7cd0('0xd')](_0x497593[_0x15fddc[_0x7cd0('0xc')]][_0x7cd0('0xe')])){_0x3a5c94=_[_0x7cd0('0xf')](_0x497593[_0x15fddc[_0x7cd0('0xc')]][_0x7cd0('0xe')],_0x7cd0('0x10'));}else if(!_['isNil'](_0x15fddc[_0x7cd0('0x10')])){_0x3a5c94=[_0x15fddc[_0x7cd0('0x10')]];}return _0x3a5c94;}exports['listen']=function(_0x4f1e7b){_0x4f1e7b[_0x7cd0('0x11')]={};return new BPromise(function(_0x4b4934,_0x26cea2){var _0x552a13={'Start':function(_0x33c932){var _0x238bb5=this;return new Promise(function(_0x1c480c,_0x5bcc75){if(_0x33c932){try{var _0x64b469=[];var _0x22a31f=getId(_0x33c932[_0x7cd0('0x12')],_0x33c932[_0x7cd0('0x13')]?_0x33c932[_0x7cd0('0x13')]['id']:0x0,_0x33c932['interaction']?_0x33c932[_0x7cd0('0x14')]['id']:0x0);if(_0x33c932['applications']&&_[_0x7cd0('0x15')](_0x33c932[_0x7cd0('0x16')])&&_0x33c932['applications'][_0x7cd0('0x17')]){for(var _0x579598=0x0;_0x579598<_0x33c932[_0x7cd0('0x16')][_0x7cd0('0x17')];_0x579598+=0x1){var _0x54bcd1=_0x33c932['applications'][_0x579598];if(fs['existsSync'](path['join'](__dirname,_0x7cd0('0x16'),_0x54bcd1['app']+_0x7cd0('0x18')))){var _0x170efa=[];switch(_0x54bcd1['app'][_0x7cd0('0x19')]()){case _0x7cd0('0x1a'):var _0x1cfc23=_0x54bcd1[_0x7cd0('0x1b')][_0x7cd0('0x1c')](',');if(_0x33c932[_0x7cd0('0x12')]===_0x7cd0('0x1d')){_0x170efa[_0x7cd0('0x1e')](_0x1cfc23[0x0]);_0x170efa['push'](_0x1cfc23[0x1]);_0x170efa[_0x7cd0('0x1e')](_0x1cfc23[_0x7cd0('0x1f')](0x2,_0x1cfc23['length'])[_0x7cd0('0x20')](','));}else{_0x170efa[_0x7cd0('0x1e')](_0x1cfc23[0x0]);_0x170efa[_0x7cd0('0x1e')](_0x1cfc23[_0x7cd0('0x1f')](0x1,_0x1cfc23[_0x7cd0('0x17')])[_0x7cd0('0x20')](','));}break;case _0x7cd0('0x21'):var _0x307671=_0x54bcd1['appdata']['split'](',');_0x170efa['push'](_0x307671[0x0]);_0x170efa[_0x7cd0('0x1e')](_0x307671[0x1]);_0x170efa[_0x7cd0('0x1e')](_0x307671[_0x7cd0('0x1f')](0x2,_0x307671[_0x7cd0('0x17')])[_0x7cd0('0x20')](','));break;case'dialogflowv2':var _0x5d4455=_0x54bcd1['appdata'][_0x7cd0('0x1c')](',');_0x170efa[_0x7cd0('0x1e')](_0x5d4455[0x0]);_0x170efa[_0x7cd0('0x1e')](_0x5d4455[0x1]);_0x170efa[_0x7cd0('0x1e')](_0x5d4455[0x2]);_0x170efa[_0x7cd0('0x1e')](_0x5d4455[0x3]);_0x170efa[_0x7cd0('0x1e')](_0x5d4455[_0x7cd0('0x1f')](0x4,_0x5d4455[_0x7cd0('0x17')])[_0x7cd0('0x20')](','));break;case'amazonlex':var _0x3b50f5=_0x54bcd1[_0x7cd0('0x1b')]['split'](',');_0x170efa[_0x7cd0('0x1e')](_0x3b50f5[0x0]);_0x170efa[_0x7cd0('0x1e')](_0x3b50f5[0x1]);_0x170efa[_0x7cd0('0x1e')](_0x3b50f5[0x2]);_0x170efa['push'](_0x3b50f5[0x3]);_0x170efa[_0x7cd0('0x1e')](_0x3b50f5[_0x7cd0('0x1f')](0x4,_0x3b50f5[_0x7cd0('0x17')])[_0x7cd0('0x20')](','));break;case _0x7cd0('0x13'):_0x170efa[_0x7cd0('0x1e')](_0x54bcd1[_0x7cd0('0x1b')]);break;case'tag':_0x170efa[_0x7cd0('0x1e')](_0x54bcd1[_0x7cd0('0x22')]);_0x170efa[_0x7cd0('0x1e')](_0x54bcd1[_0x7cd0('0x1b')]);break;default:_0x170efa=_[_0x7cd0('0xd')](_0x54bcd1[_0x7cd0('0x1b')])?[]:_0x54bcd1[_0x7cd0('0x1b')][_0x7cd0('0x1c')](',');}var _0x45f918={'id':util[_0x7cd0('0xb')](_0x7cd0('0x23'),_0x22a31f,_0x54bcd1['id'],_0x54bcd1[_0x7cd0('0x24')]),'condition':require(_0x7cd0('0x25'))[_0x7cd0('0x26')](_0x22a31f,getIntervals(_0x4f1e7b['intervals'],_0x54bcd1),_0x4f1e7b),'consequence':require(_0x7cd0('0x27')+_0x54bcd1[_0x7cd0('0x24')])[_0x7cd0('0x28')](_0x22a31f,_0x170efa,_0x4f1e7b,_0x33c932),'p':_0x54bcd1['priority']||0x0};logger['info'](_0x7cd0('0x29'),_0x45f918['id'],_0x7cd0('0x2a'),getIntervals(_0x4f1e7b['intervals'],_0x54bcd1)[_0x7cd0('0x20')](_0x7cd0('0x2b')));_0x64b469[_0x7cd0('0x1e')](_0x45f918);}else{logger[_0x7cd0('0x2c')](_0x7cd0('0x2d'),path[_0x7cd0('0x20')](__dirname,_0x7cd0('0x16'),_0x54bcd1[_0x7cd0('0x24')]+_0x7cd0('0x18')));}}_0x4f1e7b['rules'][_0x22a31f]=new RuleEngine(_0x64b469);_0x4f1e7b['rules'][_0x22a31f][_0x7cd0('0x2e')](_0x33c932,function(_0x2b9474){logger['info'](_0x7cd0('0x2f'),JSON[_0x7cd0('0x30')](_0x2b9474[_0x7cd0('0x31')]));if(_0x4f1e7b[_0x7cd0('0x11')][_0x22a31f]){_0x4f1e7b[_0x7cd0('0x11')][_0x22a31f]['emit']('complete');}});return _0x1c480c({'code':0xc8,'message':_0x33c932});}else{logger[_0x7cd0('0x32')]('No\x20applications\x20to\x20execute');return _0x1c480c({'code':0xc8,'message':_0x33c932});}}catch(_0xd175ee){logger[_0x7cd0('0x2c')](_0xd175ee[_0x7cd0('0x33')]);return _0x5bcc75(_0x238bb5['error'](0x1f4,_0xd175ee));}}return _0x5bcc75('routing\x20is\x20empty');});},'AcceptMessage':function(_0x158c19){var _0x577808=this;return new Promise(function(_0x58cc79,_0x1809bc){if(_0x158c19[_0x7cd0('0x34')]&&_0x158c19['agent']['id']){if(_0x4f1e7b[_0x7cd0('0x35')][_0x158c19[_0x7cd0('0x34')]['id']]){_0x4f1e7b['agents'][_0x158c19[_0x7cd0('0x34')]['id']][_0x7cd0('0x36')]=![];_0x4f1e7b['agents'][_0x158c19[_0x7cd0('0x34')]['id']][_0x7cd0('0x37')]=undefined;}}if(_0x158c19[_0x7cd0('0x13')]&&_0x158c19[_0x7cd0('0x13')]['id']){try{var _0x41871f=getId(_0x158c19[_0x7cd0('0x12')],_0x158c19[_0x7cd0('0x13')]?_0x158c19[_0x7cd0('0x13')]['id']:0x0,_0x158c19[_0x7cd0('0x14')]?_0x158c19[_0x7cd0('0x14')]['id']:0x0);if(_0x4f1e7b['rules'][_0x41871f]){_0x4f1e7b[_0x7cd0('0x11')][_0x41871f]['emit'](_0x7cd0('0x38'));if(rpc[_0x158c19[_0x7cd0('0x12')]+_0x7cd0('0x39')]){rpc[_0x158c19[_0x7cd0('0x12')]+_0x7cd0('0x39')][_0x7cd0('0x3a')](_0x41871f,{'UserId':_0x158c19[_0x7cd0('0x13')][_0x7cd0('0x3b')]})[_0x7cd0('0x3c')](function(_0x230530){logger[_0x7cd0('0x2c')](_0x7cd0('0x3d'));});}}return _0x58cc79({'code':0xc8,'message':_0x158c19});}catch(_0x58f4bb){logger[_0x7cd0('0x2c')](_0x58f4bb['stack']);return _0x1809bc(_0x577808[_0x7cd0('0x2c')](0x1f4,_0x58f4bb));}}logger[_0x7cd0('0x2c')](_0x7cd0('0x3e'));return _0x1809bc(_0x577808['error'](0x1f4,_0x7cd0('0x3e')));});},'RejectMessage':function(_0x5f0ece){var _0x455659=this;return new Promise(function(_0x3fd0eb,_0x2d002f){if(_0x5f0ece['agent']&&_0x5f0ece[_0x7cd0('0x34')]['id']){try{if(_0x4f1e7b[_0x7cd0('0x35')][_0x5f0ece['agent']['id']]){_0x4f1e7b[_0x7cd0('0x35')][_0x5f0ece['agent']['id']][_0x7cd0('0x36')]=![];_0x4f1e7b[_0x7cd0('0x35')][_0x5f0ece[_0x7cd0('0x34')]['id']][_0x7cd0('0x37')]=undefined;}return _0x3fd0eb({'code':0xc8,'message':_0x5f0ece});}catch(_0x4cc95f){logger[_0x7cd0('0x2c')](_0x4cc95f[_0x7cd0('0x33')]);return _0x2d002f(_0x455659['error'](0x1f4,_0x4cc95f));}}logger[_0x7cd0('0x2c')](_0x7cd0('0x3e'));return _0x2d002f(_0x455659[_0x7cd0('0x2c')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x326eb9){var _0x58ec33=this;return new Promise(function(_0x2bed55,_0x20d444){if(_0x326eb9['channel']&&_0x326eb9[_0x7cd0('0x14')]&&_0x326eb9[_0x7cd0('0x14')]['id']){try{var _0x188436=getId(_0x326eb9['channel'],_0x326eb9[_0x7cd0('0x13')]?_0x326eb9['message']['id']:0x0,_0x326eb9[_0x7cd0('0x14')]?_0x326eb9[_0x7cd0('0x14')]['id']:0x0);if(_0x4f1e7b[_0x7cd0('0x11')][_0x188436]){_0x4f1e7b[_0x7cd0('0x11')][_0x188436][_0x7cd0('0x3f')]('end');}return _0x2bed55({'code':0xc8,'message':_0x326eb9});}catch(_0x2f336d){logger[_0x7cd0('0x2c')](_0x2f336d[_0x7cd0('0x33')]);return _0x20d444(_0x58ec33[_0x7cd0('0x2c')](0x1f4,_0x2f336d));}}logger[_0x7cd0('0x2c')](_0x7cd0('0x3e'));return _0x20d444(_0x58ec33[_0x7cd0('0x2c')](0x1f4,_0x7cd0('0x3e')));});},'AgentCapacity':function(_0x50763d){var _0x13a779=this;return new Promise(function(_0x258a71,_0x2417b7){if(_0x4f1e7b[_0x7cd0('0x35')]['hasOwnProperty'](_0x50763d['id'])){for(var _0x7e2303 in _0x50763d[_0x7cd0('0x40')]){if(_0x50763d[_0x7cd0('0x40')][_0x7cd0('0x41')](_0x7e2303)){if(_0x4f1e7b['agents'][_0x50763d['id']][_0x7cd0('0x41')](_0x7e2303+_0x7cd0('0x42'))){_0x4f1e7b[_0x7cd0('0x35')][_0x50763d['id']][_0x7e2303+_0x7cd0('0x42')]=parseInt(_0x50763d[_0x7cd0('0x40')][_0x7e2303],0xa);}}}_0x4f1e7b[_0x7cd0('0x35')][_0x50763d['id']]['updateRealtime']();return _0x258a71({'code':0xc8,'message':_0x4f1e7b[_0x7cd0('0x35')][_0x50763d['id']]});}else{return _0x2417b7(_0x13a779['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x333084){return new Promise(function(_0x5b85cd,_0x40de9b){var _0x3d2179=_[_0x7cd0('0x43')](_0x4f1e7b[_0x7cd0('0x35')]);_0x5b85cd({'count':_0x3d2179['length'],'rows':_0x3d2179});});},'ChatQueues':function(_0x39b58e){return new Promise(function(_0x360aa5,_0x43a7b8){var _0x2ea522=[];for(var _0x7bc4f8 in _0x4f1e7b[_0x7cd0('0x44')]){if(_0x4f1e7b[_0x7cd0('0x44')][_0x7cd0('0x41')](_0x7bc4f8)){var _0x5cc04c=_0x4f1e7b[_0x7cd0('0x44')][_0x7bc4f8];var _0x1d1e4a={'id':_0x5cc04c['id'],'available':_0x5cc04c[_0x7cd0('0x45')],'loggedIn':_0x5cc04c[_0x7cd0('0x46')],'name':_0x5cc04c[_0x7cd0('0x47')],'paused':_0x5cc04c[_0x7cd0('0x48')],'waiting':_0x5cc04c[_0x7cd0('0x49')]};_0x2ea522[_0x7cd0('0x1e')](_0x1d1e4a);}}_0x360aa5({'count':_0x2ea522['length'],'rows':_0x2ea522});});},'MailQueues':function(_0x2c88ad){return new Promise(function(_0x27d8ae,_0xbce2b6){var _0x1370b4=[];for(var _0x2089d4 in _0x4f1e7b[_0x7cd0('0x4a')]){if(_0x4f1e7b[_0x7cd0('0x4a')][_0x7cd0('0x41')](_0x2089d4)){var _0x2df7d3=_0x4f1e7b[_0x7cd0('0x4a')][_0x2089d4];var _0x27c06b={'id':_0x2df7d3['id'],'available':_0x2df7d3[_0x7cd0('0x45')],'loggedIn':_0x2df7d3[_0x7cd0('0x46')],'name':_0x2df7d3['name'],'paused':_0x2df7d3['paused'],'waiting':_0x2df7d3['waiting']};_0x1370b4[_0x7cd0('0x1e')](_0x27c06b);}}_0x27d8ae({'count':_0x1370b4[_0x7cd0('0x17')],'rows':_0x1370b4});});},'OpenchannelQueues':function(_0xe75d70){return new Promise(function(_0x10eeca,_0x24ce6c){var _0x309eb7=[];for(var _0x1eecf8 in _0x4f1e7b[_0x7cd0('0x4b')]){if(_0x4f1e7b[_0x7cd0('0x4b')]['hasOwnProperty'](_0x1eecf8)){var _0x3ff018=_0x4f1e7b[_0x7cd0('0x4b')][_0x1eecf8];var _0x4fdaf2={'id':_0x3ff018['id'],'available':_0x3ff018[_0x7cd0('0x45')],'loggedIn':_0x3ff018[_0x7cd0('0x46')],'name':_0x3ff018[_0x7cd0('0x47')],'paused':_0x3ff018[_0x7cd0('0x48')],'waiting':_0x3ff018[_0x7cd0('0x49')]};_0x309eb7[_0x7cd0('0x1e')](_0x4fdaf2);}}_0x10eeca({'count':_0x309eb7['length'],'rows':_0x309eb7});});},'SmsQueues':function(_0x317109){return new Promise(function(_0x4dbce0,_0x52f7b9){var _0x31a6a8=[];for(var _0x171305 in _0x4f1e7b[_0x7cd0('0x4c')]){if(_0x4f1e7b['smsQueues']['hasOwnProperty'](_0x171305)){var _0x431ed9=_0x4f1e7b['smsQueues'][_0x171305];var _0x8bc966={'id':_0x431ed9['id'],'available':_0x431ed9[_0x7cd0('0x45')],'loggedIn':_0x431ed9[_0x7cd0('0x46')],'name':_0x431ed9[_0x7cd0('0x47')],'paused':_0x431ed9['paused'],'waiting':_0x431ed9[_0x7cd0('0x49')]};_0x31a6a8[_0x7cd0('0x1e')](_0x8bc966);}}_0x4dbce0({'count':_0x31a6a8['length'],'rows':_0x31a6a8});});},'FaxQueues':function(_0x13e8db){return new Promise(function(_0x4fe7da,_0x2eab29){var _0x7fa66=[];for(var _0x3e0368 in _0x4f1e7b[_0x7cd0('0x4d')]){if(_0x4f1e7b[_0x7cd0('0x4d')][_0x7cd0('0x41')](_0x3e0368)){var _0x5c3f74=_0x4f1e7b[_0x7cd0('0x4d')][_0x3e0368];var _0x45b48c={'id':_0x5c3f74['id'],'available':_0x5c3f74[_0x7cd0('0x45')],'loggedIn':_0x5c3f74[_0x7cd0('0x46')],'name':_0x5c3f74[_0x7cd0('0x47')],'paused':_0x5c3f74['paused'],'waiting':_0x5c3f74[_0x7cd0('0x49')]};_0x7fa66[_0x7cd0('0x1e')](_0x45b48c);}}_0x4fe7da({'count':_0x7fa66[_0x7cd0('0x17')],'rows':_0x7fa66});});},'WhatsappQueues':function(_0x1c9e94){return new Promise(function(_0x24097c,_0x31dccf){var _0x4508dd=[];for(var _0xa762e8 in _0x4f1e7b['whatsappQueues']){if(_0x4f1e7b['whatsappQueues'][_0x7cd0('0x41')](_0xa762e8)){var _0x11db68=_0x4f1e7b[_0x7cd0('0x4e')][_0xa762e8];var _0x3c0e51={'id':_0x11db68['id'],'available':_0x11db68[_0x7cd0('0x45')],'loggedIn':_0x11db68[_0x7cd0('0x46')],'name':_0x11db68[_0x7cd0('0x47')],'paused':_0x11db68[_0x7cd0('0x48')],'waiting':_0x11db68['waiting']};_0x4508dd['push'](_0x3c0e51);}}_0x24097c({'count':_0x4508dd[_0x7cd0('0x17')],'rows':_0x4508dd});});},'ChatQueuesWaitingInteractions':function(_0x1693c5){return new Promise(function(_0xb8bf6f,_0x6c6605){var _0x47a172=_['values'](_0x4f1e7b[_0x7cd0('0x4f')]);_0xb8bf6f({'count':_0x47a172['length'],'rows':_0x47a172});});},'MailQueuesWaitingInteractions':function(_0xce9b5b){return new Promise(function(_0x516a82,_0x1a3b8c){var _0x10956a=_['values'](_0x4f1e7b[_0x7cd0('0x50')]);_0x516a82({'count':_0x10956a[_0x7cd0('0x17')],'rows':_0x10956a});});},'OpenchannelQueuesWaitingInteractions':function(_0x56e5e8){return new Promise(function(_0x233b7c,_0x71adc7){var _0x2cb3e1=_[_0x7cd0('0x43')](_0x4f1e7b['openchannelQueuesWaitingInteractions']);_0x233b7c({'count':_0x2cb3e1[_0x7cd0('0x17')],'rows':_0x2cb3e1});});},'SmsQueuesWaitingInteractions':function(_0x286133){return new Promise(function(_0x215cce,_0x3e5abe){var _0x5931ca=_[_0x7cd0('0x43')](_0x4f1e7b['smsQueuesWaitingInteractions']);_0x215cce({'count':_0x5931ca[_0x7cd0('0x17')],'rows':_0x5931ca});});},'FaxQueuesWaitingInteractions':function(_0x51eabc){return new Promise(function(_0xc41b4a,_0x35edcb){var _0x96ff8=_[_0x7cd0('0x43')](_0x4f1e7b[_0x7cd0('0x51')]);_0xc41b4a({'count':_0x96ff8[_0x7cd0('0x17')],'rows':_0x96ff8});});},'WhatsappQueuesWaitingInteractions':function(_0x21b501){return new Promise(function(_0x5e9e17,_0x47e5cf){var _0x546ecb=_[_0x7cd0('0x43')](_0x4f1e7b[_0x7cd0('0x52')]);_0x5e9e17({'count':_0x546ecb[_0x7cd0('0x17')],'rows':_0x546ecb});});}};var _0x36eb73=jayson[_0x7cd0('0x53')](_0x552a13)[_0x7cd0('0x54')]();_0x36eb73['on'](_0x7cd0('0x2c'),function(_0x1a991a){logger[_0x7cd0('0x2c')](JSON[_0x7cd0('0x30')](_0x1a991a));return _0x26cea2(_0x1a991a);});_0x36eb73['listen'](0x232c,_0x7cd0('0x55'),function(){console['log'](_0x7cd0('0x56'),0x232c);return _0x4b4934(_0x7cd0('0x57')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 43cbb65..11e5af3 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 _0x6346=['util','bluebird','jayson/promise','lodash','../../../config/logger','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','then','indexOf','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x6346,0x1a9));var _0x6634=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6346[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x6634('0x0'));var BPromise=require(_0x6634('0x1'));var jayson=require(_0x6634('0x2'));var _=require(_0x6634('0x3'));var logger=require(_0x6634('0x4'))('routing');var client=jayson['client']['http']({'port':0x232a});function request(_0x1e9e74,_0x17ff98){return new BPromise(function(_0x282577,_0x2455a5){return client['request'](_0x1e9e74,_0x17ff98)['then'](function(_0x527f93){if(_0x527f93[_0x6634('0x5')]){return _0x2455a5(_0x527f93[_0x6634('0x5')][_0x6634('0x6')]);}else{return _0x282577(_0x527f93[_0x6634('0x7')]);}})[_0x6634('0x8')](function(_0x3bb5f3){return _0x2455a5(_0x3bb5f3);});});}exports[_0x6634('0x9')]=function(_0x4e4dda,_0x3ae6e7,_0x2ce06c){return function(_0x1cf09b){if(_0x2ce06c['rules']&&!_0x2ce06c[_0x6634('0xa')][_0x4e4dda]){logger['info'](_0x6634('0xb'),_0x4e4dda);return _0x1cf09b[_0x6634('0xc')]();}var _0x991da3=[];for(var _0x1b42b3=0x0;_0x1b42b3<_0x3ae6e7[_0x6634('0xd')];_0x1b42b3+=0x1){_0x991da3[_0x6634('0xe')](request(_0x6634('0xf'),{'command':util['format']('iftime\x20%s',_0x3ae6e7[_0x1b42b3])})[_0x6634('0x10')](function(_0x523f48){return _0x523f48&&_0x523f48[_0x6634('0x6')]&&_0x523f48[_0x6634('0x6')][_0x6634('0x11')]('true')>=0x0?!![]:![];})[_0x6634('0x8')](function(_0x30ac1c){logger[_0x6634('0x5')]('[%s][INTERVAL]\x20%s',_0x4e4dda,_0x3ae6e7[_0x1b42b3]);}));}BPromise[_0x6634('0x12')](_0x991da3)[_0x6634('0x10')](function(_0x5248b9){var _0x472661=_['some'](_0x5248b9);logger['info'](_0x6634('0x13'),_0x4e4dda,_0x3ae6e7[_0x6634('0x14')](_0x6634('0x15')),_0x472661);_0x1cf09b[_0x6634('0x16')](_0x472661);})[_0x6634('0x8')](function(_0x2b770a){console[_0x6634('0x17')](_0x2b770a);logger[_0x6634('0x5')](_0x6634('0x13'),_0x4e4dda,_0x3ae6e7[_0x6634('0x14')](_0x6634('0x15')),_0x2b770a[_0x6634('0x18')]);_0x1cf09b[_0x6634('0xc')]();});};}; \ No newline at end of file +var _0xbd7d=['routing','client','request','then','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','jayson/promise','lodash'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xbd7d,0x9f));var _0xdbd7=function(_0x3096c8,_0x4cf94c){_0x3096c8=_0x3096c8-0x0;var _0x4cb984=_0xbd7d[_0x3096c8];return _0x4cb984;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xdbd7('0x0'));var _=require(_0xdbd7('0x1'));var logger=require('../../../config/logger')(_0xdbd7('0x2'));var client=jayson[_0xdbd7('0x3')]['http']({'port':0x232a});function request(_0x517f5b,_0x217eb3){return new BPromise(function(_0x4970fd,_0x2ffdb9){return client[_0xdbd7('0x4')](_0x517f5b,_0x217eb3)[_0xdbd7('0x5')](function(_0x6de1f3){if(_0x6de1f3[_0xdbd7('0x6')]){return _0x2ffdb9(_0x6de1f3['error'][_0xdbd7('0x7')]);}else{return _0x4970fd(_0x6de1f3['result']);}})['catch'](function(_0xbc644e){return _0x2ffdb9(_0xbc644e);});});}exports[_0xdbd7('0x8')]=function(_0x5d6cb6,_0x55fc52,_0x23cdf3){return function(_0x47d561){if(_0x23cdf3[_0xdbd7('0x9')]&&!_0x23cdf3[_0xdbd7('0x9')][_0x5d6cb6]){logger[_0xdbd7('0xa')](_0xdbd7('0xb'),_0x5d6cb6);return _0x47d561[_0xdbd7('0xc')]();}var _0x2bd4ca=[];for(var _0x50fd5e=0x0;_0x50fd5e<_0x55fc52[_0xdbd7('0xd')];_0x50fd5e+=0x1){_0x2bd4ca[_0xdbd7('0xe')](request('Command',{'command':util[_0xdbd7('0xf')](_0xdbd7('0x10'),_0x55fc52[_0x50fd5e])})[_0xdbd7('0x5')](function(_0x294d37){return _0x294d37&&_0x294d37[_0xdbd7('0x7')]&&_0x294d37['message'][_0xdbd7('0x11')]('true')>=0x0?!![]:![];})['catch'](function(_0x337391){logger[_0xdbd7('0x6')](_0xdbd7('0x12'),_0x5d6cb6,_0x55fc52[_0x50fd5e]);}));}BPromise['all'](_0x2bd4ca)[_0xdbd7('0x5')](function(_0x3fd623){var _0x186e2d=_['some'](_0x3fd623);logger[_0xdbd7('0xa')](_0xdbd7('0x13'),_0x5d6cb6,_0x55fc52[_0xdbd7('0x14')](_0xdbd7('0x15')),_0x186e2d);_0x47d561[_0xdbd7('0x16')](_0x186e2d);})['catch'](function(_0x6134a2){console['log'](_0x6134a2);logger['error'](_0xdbd7('0x13'),_0x5d6cb6,_0x55fc52[_0xdbd7('0x14')](_0xdbd7('0x15')),_0x6134a2['stack']);_0x47d561[_0xdbd7('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 977cb9e..e98881e 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 _0xa571=['calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','transferexten','transferuniqueid','transfereeuniqueid','agententerreason'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa571,0x107));var _0x1a57=function(_0xfddf92,_0x4355cb){_0xfddf92=_0xfddf92-0x0;var _0x2030e9=_0xa571[_0xfddf92];return _0x2030e9;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var utils=require(_0x1a57('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1067d9,_0x48485e){utils[_0x1a57('0x3')](util[_0x1a57('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1067d9['uniqueid'],_0x1067d9[_0x1a57('0x5')],_0x1067d9['queue'],_0x1067d9[_0x1a57('0x6')],_0x1067d9[_0x1a57('0x7')],_0x1067d9[_0x1a57('0x8')],_0x1067d9[_0x1a57('0x9')],_0x1067d9[_0x1a57('0xa')]));if(_0x1067d9[_0x1a57('0xb')]){utils['getVoiceQueueByName'](_0x1067d9[_0x1a57('0xb')])[_0x1a57('0xc')](function(_0x3631d6){if(_0x3631d6){_0x1067d9['type']=_0x3631d6[_0x1a57('0xd')];_0x1067d9[_0x1a57('0xe')]=_0x1067d9[_0x1a57('0xf')]?_0x3631d6[_0x1a57('0x10')]:![];_0x1067d9[_0x1a57('0x11')]=_0x1067d9[_0x1a57('0xe')]?_0x3631d6[_0x1a57('0x12')]:0x0;}utils[_0x1a57('0x13')]('CreateVoiceAgentReport',_0x1067d9);});}else{utils['request'](_0x1a57('0x14'),_0x1067d9);}if(_0x48485e){delete transfers[_0x1067d9[_0x1a57('0x15')]];}else{delete agents[_0x1067d9[_0x1a57('0x16')]];}}exports['agentcalled']=function(_0x3de36a){try{utils[_0x1a57('0x17')](util['format'](_0x1a57('0x18'),_0x3de36a['uniqueid']),_0x3de36a);agents[_0x3de36a[_0x1a57('0x16')]]=_0x3de36a;agents[_0x3de36a[_0x1a57('0x16')]][_0x1a57('0x19')]=utils[_0x1a57('0x1a')]();agents[_0x3de36a['destuniqueid']][_0x1a57('0xa')]='called';agents[_0x3de36a['destuniqueid']][_0x1a57('0x9')]=null;agents[_0x3de36a[_0x1a57('0x16')]][_0x1a57('0x1b')]=null;utils['info'](util[_0x1a57('0x4')](_0x1a57('0x1c'),_0x3de36a[_0x1a57('0x15')],agents[_0x3de36a['destuniqueid']][_0x1a57('0x6')],_0x3de36a[_0x1a57('0x16')]));}catch(_0x451b34){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')]('[%s][agents][agentcalled]',_0x3de36a['uniqueid']),_0x451b34);}};exports[_0x1a57('0x1e')]=function(_0x21e811){try{if(!_[_0x1a57('0x1f')](agents[_0x21e811['destuniqueid']])){utils['debug'](util['format'](_0x1a57('0x20'),_0x21e811[_0x1a57('0x15')]),_0x21e811);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x21'),_0x21e811[_0x1a57('0x15')],agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x6')],_0x21e811[_0x1a57('0x16')]));agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x1e')]=!![];agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x22')]=utils[_0x1a57('0x1a')]();agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x23');agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x24')]=_0x1a57('0x23');agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x25')]=_0x21e811['ringtime']?parseInt(_0x21e811['ringtime'])/0x3e8:0x0;agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x26')]=0x0;unanswered['push'](_0x21e811[_0x1a57('0x16')]);}}catch(_0x54f6a5){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')]('[%s][agents][agentringnoanswer]',_0x21e811[_0x1a57('0x15')]),_0x54f6a5);}};exports[_0x1a57('0x27')]=function(_0x30527c){try{_[_0x1a57('0x28')](agents,function(_0x492b90,_0x366d5f){if(_0x492b90[_0x1a57('0x15')]==_0x30527c[_0x1a57('0x15')]&&!_[_0x1a57('0x29')](unanswered,_0x492b90['destuniqueid'])){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x2a'),_0x30527c[_0x1a57('0x15')]),_0x30527c);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x2b'),_0x30527c[_0x1a57('0x15')],_0x492b90[_0x1a57('0x6')],_0x492b90['destuniqueid']));_0x492b90[_0x1a57('0x1e')]=!![];_0x492b90[_0x1a57('0x22')]=utils['now']();_0x492b90['lastevent']=_0x1a57('0x2c');_0x492b90[_0x1a57('0x24')]=_0x1a57('0x2c');_0x492b90[_0x1a57('0x25')]=_0x30527c[_0x1a57('0x25')];_0x492b90[_0x1a57('0x26')]=0x0;writeDB(_0x492b90);}});}catch(_0xe80d94){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x2a'),_0x30527c[_0x1a57('0x15')]),_0xe80d94);}};exports[_0x1a57('0x2d')]=function(_0x12f3a7){try{if(agents[_0x12f3a7[_0x1a57('0x16')]]){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x2e'),_0x12f3a7[_0x1a57('0x15')]),_0x12f3a7);utils['info'](util[_0x1a57('0x4')](_0x1a57('0x2f'),_0x12f3a7[_0x1a57('0x15')],agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0x6')],_0x12f3a7[_0x1a57('0x16')]));agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();agents[_0x12f3a7['destuniqueid']]['connectedlinenum']=_0x12f3a7['connectedlinenum'];agents[_0x12f3a7['destuniqueid']][_0x1a57('0x1b')]=_0x12f3a7[_0x1a57('0x1b')];agents[_0x12f3a7[_0x1a57('0x16')]]['holdtime']=_0x12f3a7[_0x1a57('0x31')];agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x32');_['forIn'](agents,function(_0x1be254,_0x5e79f0){if(_0x1be254[_0x1a57('0x16')]!=_0x12f3a7[_0x1a57('0x16')]&&_0x1be254[_0x1a57('0x15')]==_0x12f3a7['uniqueid']){_0x1be254[_0x1a57('0x26')]=0x0;_0x1be254[_0x1a57('0x25')]=_0x12f3a7[_0x1a57('0x31')];_0x1be254[_0x1a57('0x1e')]=!![];_0x1be254[_0x1a57('0x22')]=utils['now']();_0x1be254[_0x1a57('0xa')]='answered_elsewhere';_0x1be254['reason']=_0x1a57('0x33');_0x1be254['answeredelsewheredestinationuniqueid']=_0x12f3a7[_0x1a57('0x16')];_0x1be254[_0x1a57('0x34')]=_0x12f3a7[_0x1a57('0x6')];writeDB(_0x1be254);}});}}catch(_0x59abb1){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x2e'),_0x12f3a7[_0x1a57('0x15')]),_0x59abb1);}};exports['agentcomplete']=function(_0xc7bab4){try{if(!_[_0x1a57('0x1f')](agents[_0xc7bab4['destuniqueid']])){utils[_0x1a57('0x17')](util['format']('[%s][agents][agentcomplete]',_0xc7bab4[_0x1a57('0x15')]),_0xc7bab4);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x35'),_0xc7bab4['uniqueid'],agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x6')],_0xc7bab4[_0x1a57('0x16')]));agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0xf')]=!![];agents[_0xc7bab4['destuniqueid']][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x26')]=utils['diffTime'](agents[_0xc7bab4[_0x1a57('0x16')]]['agentcompleteAt'],agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x30')]);agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x24')]=_0xc7bab4[_0x1a57('0x24')];agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x37');writeDB(agents[_0xc7bab4[_0x1a57('0x16')]]);}}catch(_0x424065){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x38'),_0xc7bab4['uniqueid']),_0x424065);}};exports[_0x1a57('0x39')]=function(_0x480aff){try{if(!_[_0x1a57('0x1f')](agents[_0x480aff[_0x1a57('0x3a')]])){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x3b'),_0x480aff[_0x1a57('0x15')]),_0x480aff);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x3c'),_0x480aff['uniqueid'],agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x6')],agents[_0x480aff['transfereruniqueid']][_0x1a57('0x15')]));agents[_0x480aff[_0x1a57('0x3a')]]['transfer']=!![];agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x3d')]='blind';agents[_0x480aff['transfereruniqueid']]['transferexten']=_0x480aff[_0x1a57('0x3e')];agents[_0x480aff[_0x1a57('0x3a')]]['transferuniqueid']=agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x15')];}}catch(_0x572202){utils['error'](util['format'](_0x1a57('0x3b'),_0x480aff[_0x1a57('0x15')]),_0x572202);}};exports[_0x1a57('0x3f')]=function(_0x31be00){try{utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x40'),_0x31be00[_0x1a57('0x41')]),_0x31be00);if(_0x31be00['origtransfereruniqueid']==_0x31be00['origtransfererlinkedid']){if(!_['isNil'](agents[_0x31be00['secondtransfereruniqueid']])){utils['info'](util[_0x1a57('0x4')](_0x1a57('0x42'),_0x31be00[_0x1a57('0x41')],agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x6')]));agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x44')]=!![];agents[_0x31be00[_0x1a57('0x43')]]['transfertype']='ATTENDED';agents[_0x31be00['secondtransfereruniqueid']][_0x1a57('0x45')]=_0x31be00['origtransfererexten'];agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x46')]=_0x31be00[_0x1a57('0x41')];}if(_0x31be00[_0x1a57('0x47')]&&agents[_0x31be00[_0x1a57('0x47')]]){agents[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x48')]=0x1;transfers[_0x31be00['transfereeuniqueid']]=_['clone'](agents[_0x31be00['transfereeuniqueid']]);transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x8')]=agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x8')];transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x49')]=agents[_0x31be00[_0x1a57('0x43')]]['calleridname'];transfers[_0x31be00['transfereeuniqueid']][_0x1a57('0x19')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x47')]]['holdtime']=0x0;transfers[_0x31be00['transfereeuniqueid']][_0x1a57('0x48')]=0x2;}}else if(_0x31be00[_0x1a57('0x43')]==_0x31be00['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x31be00[_0x1a57('0x41')]])){utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x42'),_0x31be00[_0x1a57('0x41')],agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x6')]));agents[_0x31be00['origtransfereruniqueid']]['transfer']=!![];agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x3d')]=_0x1a57('0x4a');agents[_0x31be00[_0x1a57('0x41')]]['transferexten']=_0x31be00[_0x1a57('0x4b')];agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x46')]=_0x31be00[_0x1a57('0x43')];}if(_0x31be00[_0x1a57('0x4c')]&&agents[_0x31be00['transfertargetuniqueid']]){agents[_0x31be00['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x31be00[_0x1a57('0x4c')]]=_[_0x1a57('0x4d')](agents[_0x31be00[_0x1a57('0x4c')]]);transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x8')]=agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x8')];transfers[_0x31be00[_0x1a57('0x4c')]]['calleridname']=agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x49')];transfers[_0x31be00['transfertargetuniqueid']]['agentcalledAt']=utils[_0x1a57('0x1a')]();transfers[_0x31be00['transfertargetuniqueid']][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x25')]=0x0;transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x48')]=0x2;}}}catch(_0x213576){utils[_0x1a57('0x1d')](util['format'](_0x1a57('0x40'),_0x31be00[_0x1a57('0x41')]),_0x213576);}};exports['hangup']=function(_0x24b56c){try{utils[_0x1a57('0x17')](util[_0x1a57('0x4')]('[%s][agents][hangup]',_0x24b56c['uniqueid']),_0x24b56c);if(agents[_0x24b56c[_0x1a57('0x15')]]&&agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')]===_0x1a57('0x23')){if(_0x24b56c['cause']==='21'){agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')]=_0x1a57('0x4e');agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]='rejected';}utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x6')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]));writeDB(agents[_0x24b56c[_0x1a57('0x15')]]);var _0x48a10e=unanswered[_0x1a57('0x50')](_0x24b56c[_0x1a57('0x15')]);if(_0x48a10e>-0x1){unanswered['splice'](_0x48a10e,0x1);}}if(transfers[_0x24b56c[_0x1a57('0x15')]]){transfers[_0x24b56c[_0x1a57('0x15')]]['agentcomplete']=!![];transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x26')]=utils[_0x1a57('0x51')](transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')],transfers[_0x24b56c['uniqueid']][_0x1a57('0x30')]);transfers[_0x24b56c[_0x1a57('0x15')]]['reason']=_0x1a57('0x52');transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]=_0x1a57('0x37');utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],transfers[_0x24b56c[_0x1a57('0x15')]]['membername'],transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]));writeDB(transfers[_0x24b56c[_0x1a57('0x15')]],!![]);}if(agents[_0x24b56c['uniqueid']]&&agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x30')]){agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xf')]=!![];agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();agents[_0x24b56c[_0x1a57('0x15')]]['talktime']=utils[_0x1a57('0x51')](agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')],agents[_0x24b56c[_0x1a57('0x15')]]['agentconnectAt']);agents[_0x24b56c['uniqueid']]['reason']=agents[_0x24b56c['uniqueid']]['transfer']?_0x1a57('0x44'):_0x1a57('0x52');agents[_0x24b56c['uniqueid']][_0x1a57('0xa')]=_0x1a57('0x37');utils['info'](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],agents[_0x24b56c[_0x1a57('0x15')]]['membername'],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],agents[_0x24b56c['uniqueid']][_0x1a57('0xa')]));writeDB(agents[_0x24b56c[_0x1a57('0x15')]]);}}catch(_0x42d41e){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x53'),_0x24b56c[_0x1a57('0x15')]),_0x42d41e);}}; \ No newline at end of file +var _0xc788=['transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','queue','then','type','agentcomplete','acwtime','agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten'];(function(_0x3dac48,_0x10adc6){var _0x246ade=function(_0x5489f3){while(--_0x5489f3){_0x3dac48['push'](_0x3dac48['shift']());}};_0x246ade(++_0x10adc6);}(_0xc788,0xc4));var _0x8c78=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0xc788[_0x31172e];return _0x414ada;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var utils=require(_0x8c78('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4ecb26,_0x4ce125){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x5'),_0x4ecb26[_0x8c78('0x6')],_0x4ecb26[_0x8c78('0x7')],_0x4ecb26['queue'],_0x4ecb26[_0x8c78('0x8')],_0x4ecb26[_0x8c78('0x9')],_0x4ecb26[_0x8c78('0xa')],_0x4ecb26[_0x8c78('0xb')],_0x4ecb26[_0x8c78('0xc')]));if(_0x4ecb26['queue']){utils[_0x8c78('0xd')](_0x4ecb26[_0x8c78('0xe')])[_0x8c78('0xf')](function(_0x39c0e5){if(_0x39c0e5){_0x4ecb26[_0x8c78('0x10')]=_0x39c0e5[_0x8c78('0x10')];_0x4ecb26['agentacw']=_0x4ecb26[_0x8c78('0x11')]?_0x39c0e5['acw']:![];_0x4ecb26[_0x8c78('0x12')]=_0x4ecb26[_0x8c78('0x13')]?_0x39c0e5['acwTimeout']:0x0;}utils[_0x8c78('0x14')](_0x8c78('0x15'),_0x4ecb26);});}else{utils['request'](_0x8c78('0x15'),_0x4ecb26);}if(_0x4ce125){delete transfers[_0x4ecb26['uniqueid']];}else{delete agents[_0x4ecb26['destuniqueid']];}}exports[_0x8c78('0x16')]=function(_0x1b1d0e){try{utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x1b1d0e);agents[_0x1b1d0e[_0x8c78('0x19')]]=_0x1b1d0e;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xc')]=_0x8c78('0x1c');agents[_0x1b1d0e['destuniqueid']][_0x8c78('0xb')]=null;agents[_0x1b1d0e[_0x8c78('0x19')]][_0x8c78('0x1d')]=null;utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x1e'),_0x1b1d0e['uniqueid'],agents[_0x1b1d0e['destuniqueid']][_0x8c78('0x8')],_0x1b1d0e['destuniqueid']));}catch(_0x56801a){utils[_0x8c78('0x1f')](util['format'](_0x8c78('0x18'),_0x1b1d0e[_0x8c78('0x6')]),_0x56801a);}};exports['agentringnoanswer']=function(_0x6c9a12){try{if(!_['isNil'](agents[_0x6c9a12[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util['format'](_0x8c78('0x20'),_0x6c9a12[_0x8c78('0x6')]),_0x6c9a12);utils['info'](util[_0x8c78('0x4')](_0x8c78('0x21'),_0x6c9a12[_0x8c78('0x6')],agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x8')],_0x6c9a12[_0x8c78('0x19')]));agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x22')]=!![];agents[_0x6c9a12[_0x8c78('0x19')]]['agentringnoanswerAt']=utils[_0x8c78('0x1b')]();agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0xc')]='timeout';agents[_0x6c9a12[_0x8c78('0x19')]]['reason']=_0x8c78('0x23');agents[_0x6c9a12[_0x8c78('0x19')]][_0x8c78('0x24')]=_0x6c9a12['ringtime']?parseInt(_0x6c9a12[_0x8c78('0x25')])/0x3e8:0x0;agents[_0x6c9a12[_0x8c78('0x19')]]['talktime']=0x0;unanswered[_0x8c78('0x26')](_0x6c9a12[_0x8c78('0x19')]);}}catch(_0x394c1d){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x20'),_0x6c9a12['uniqueid']),_0x394c1d);}};exports[_0x8c78('0x27')]=function(_0x51add6){try{_[_0x8c78('0x28')](agents,function(_0x17f4c8,_0xb69c52){if(_0x17f4c8['uniqueid']==_0x51add6[_0x8c78('0x6')]&&!_[_0x8c78('0x29')](unanswered,_0x17f4c8['destuniqueid'])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6['uniqueid']),_0x51add6);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x2b'),_0x51add6['uniqueid'],_0x17f4c8[_0x8c78('0x8')],_0x17f4c8[_0x8c78('0x19')]));_0x17f4c8['agentringnoanswer']=!![];_0x17f4c8[_0x8c78('0x2c')]=utils[_0x8c78('0x1b')]();_0x17f4c8[_0x8c78('0xc')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x2e')]=_0x8c78('0x2d');_0x17f4c8[_0x8c78('0x24')]=_0x51add6[_0x8c78('0x24')];_0x17f4c8[_0x8c78('0x2f')]=0x0;writeDB(_0x17f4c8);}});}catch(_0x15a868){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x2a'),_0x51add6[_0x8c78('0x6')]),_0x15a868);}};exports[_0x8c78('0x30')]=function(_0x34481a){try{if(agents[_0x34481a['destuniqueid']]){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a['uniqueid']),_0x34481a);utils[_0x8c78('0x3')](util[_0x8c78('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x34481a[_0x8c78('0x6')],agents[_0x34481a['destuniqueid']][_0x8c78('0x8')],_0x34481a[_0x8c78('0x19')]));agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x32')]=utils['now']();agents[_0x34481a[_0x8c78('0x19')]]['connectedlinenum']=_0x34481a[_0x8c78('0xb')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0x1d')]=_0x34481a['connectedlinename'];agents[_0x34481a['destuniqueid']][_0x8c78('0x24')]=_0x34481a[_0x8c78('0x25')];agents[_0x34481a[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x33');_[_0x8c78('0x28')](agents,function(_0x326b34,_0x314679){if(_0x326b34[_0x8c78('0x19')]!=_0x34481a[_0x8c78('0x19')]&&_0x326b34[_0x8c78('0x6')]==_0x34481a[_0x8c78('0x6')]){_0x326b34[_0x8c78('0x2f')]=0x0;_0x326b34['holdtime']=_0x34481a[_0x8c78('0x25')];_0x326b34[_0x8c78('0x22')]=!![];_0x326b34['agentringnoanswerAt']=utils['now']();_0x326b34[_0x8c78('0xc')]=_0x8c78('0x34');_0x326b34['reason']=_0x8c78('0x34');_0x326b34[_0x8c78('0x35')]=_0x34481a['destuniqueid'];_0x326b34[_0x8c78('0x36')]=_0x34481a[_0x8c78('0x8')];writeDB(_0x326b34);}});}}catch(_0x57e2c7){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x31'),_0x34481a[_0x8c78('0x6')]),_0x57e2c7);}};exports[_0x8c78('0x11')]=function(_0x4e4880){try{if(!_['isNil'](agents[_0x4e4880[_0x8c78('0x19')]])){utils[_0x8c78('0x17')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x4e4880);utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x38'),_0x4e4880[_0x8c78('0x6')],agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x8')],_0x4e4880['destuniqueid']));agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x11')]=!![];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();agents[_0x4e4880['destuniqueid']][_0x8c78('0x2f')]=utils[_0x8c78('0x3a')](agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0x39')],agents[_0x4e4880[_0x8c78('0x19')]]['agentconnectAt']);agents[_0x4e4880[_0x8c78('0x19')]]['reason']=_0x4e4880['reason'];agents[_0x4e4880[_0x8c78('0x19')]][_0x8c78('0xc')]=_0x8c78('0x3b');writeDB(agents[_0x4e4880['destuniqueid']]);}}catch(_0x1d78a0){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x37'),_0x4e4880[_0x8c78('0x6')]),_0x1d78a0);}};exports[_0x8c78('0x3c')]=function(_0x26103c){try{if(!_[_0x8c78('0x3d')](agents[_0x26103c[_0x8c78('0x3e')]])){utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x26103c);utils[_0x8c78('0x3')](util['format'](_0x8c78('0x40'),_0x26103c[_0x8c78('0x6')],agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x8')],agents[_0x26103c['transfereruniqueid']][_0x8c78('0x6')]));agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x41')]=!![];agents[_0x26103c['transfereruniqueid']][_0x8c78('0x42')]='blind';agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x43')]=_0x26103c[_0x8c78('0x44')];agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x45')]=agents[_0x26103c[_0x8c78('0x3e')]][_0x8c78('0x6')];}}catch(_0x38fec1){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x3f'),_0x26103c[_0x8c78('0x6')]),_0x38fec1);}};exports[_0x8c78('0x46')]=function(_0x18d896){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x18d896);if(_0x18d896[_0x8c78('0x48')]==_0x18d896['origtransfererlinkedid']){if(!_[_0x8c78('0x3d')](agents[_0x18d896[_0x8c78('0x49')]])){utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x4a'),_0x18d896[_0x8c78('0x48')],agents[_0x18d896['secondtransfereruniqueid']][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x49')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x49')]]['transfertype']=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x4c')];agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x48')];}if(_0x18d896['transfereeuniqueid']&&agents[_0x18d896[_0x8c78('0x4d')]]){agents[_0x18d896[_0x8c78('0x4d')]]['agententerreason']=0x1;transfers[_0x18d896[_0x8c78('0x4d')]]=_[_0x8c78('0x4e')](agents[_0x18d896['transfereeuniqueid']]);transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0xa')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x49')]][_0x8c78('0x4f')];transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x4d')]][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x24')]=0x0;transfers[_0x18d896['transfereeuniqueid']][_0x8c78('0x50')]=0x2;}}else if(_0x18d896['secondtransfereruniqueid']==_0x18d896['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x18d896[_0x8c78('0x48')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x18d896[_0x8c78('0x48')],agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x8')]));agents[_0x18d896[_0x8c78('0x48')]]['transfer']=!![];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x42')]=_0x8c78('0x4b');agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x43')]=_0x18d896[_0x8c78('0x51')];agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x45')]=_0x18d896[_0x8c78('0x49')];}if(_0x18d896[_0x8c78('0x52')]&&agents[_0x18d896[_0x8c78('0x52')]]){agents[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x1;transfers[_0x18d896[_0x8c78('0x52')]]=_['clone'](agents[_0x18d896[_0x8c78('0x52')]]);transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0xa')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0xa')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x4f')]=agents[_0x18d896[_0x8c78('0x48')]][_0x8c78('0x4f')];transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x1a')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896['transfertargetuniqueid']][_0x8c78('0x32')]=utils[_0x8c78('0x1b')]();transfers[_0x18d896[_0x8c78('0x52')]]['holdtime']=0x0;transfers[_0x18d896[_0x8c78('0x52')]][_0x8c78('0x50')]=0x2;}}}catch(_0x1015e8){utils[_0x8c78('0x1f')](util[_0x8c78('0x4')](_0x8c78('0x47'),_0x18d896[_0x8c78('0x48')]),_0x1015e8);}};exports[_0x8c78('0x53')]=function(_0x240f1e){try{utils['debug'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e[_0x8c78('0x6')]),_0x240f1e);if(agents[_0x240f1e[_0x8c78('0x6')]]&&agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]===_0x8c78('0x23')){if(_0x240f1e[_0x8c78('0x55')]==='21'){agents[_0x240f1e[_0x8c78('0x6')]]['reason']=_0x8c78('0x56');agents[_0x240f1e[_0x8c78('0x6')]]['lastevent']='rejected';}utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e['uniqueid']]['lastevent']));writeDB(agents[_0x240f1e[_0x8c78('0x6')]]);var _0x2d385f=unanswered[_0x8c78('0x58')](_0x240f1e[_0x8c78('0x6')]);if(_0x2d385f>-0x1){unanswered[_0x8c78('0x59')](_0x2d385f,0x1);}}if(transfers[_0x240f1e['uniqueid']]){transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')]=utils[_0x8c78('0x1b')]();transfers[_0x240f1e[_0x8c78('0x6')]]['talktime']=utils[_0x8c78('0x3a')](transfers[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt'],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')]=_0x8c78('0x5a');transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util[_0x8c78('0x4')](_0x8c78('0x57'),_0x240f1e[_0x8c78('0x6')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],transfers[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],transfers[_0x240f1e[_0x8c78('0x6')]]['lastevent']));writeDB(transfers[_0x240f1e[_0x8c78('0x6')]],!![]);}if(agents[_0x240f1e['uniqueid']]&&agents[_0x240f1e['uniqueid']][_0x8c78('0x32')]){agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x11')]=!![];agents[_0x240f1e[_0x8c78('0x6')]]['agentcompleteAt']=utils[_0x8c78('0x1b')]();agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2f')]=utils['diffTime'](agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x39')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x32')]);agents[_0x240f1e['uniqueid']][_0x8c78('0x2e')]=agents[_0x240f1e[_0x8c78('0x6')]]['transfer']?'transfer':'agent';agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]=_0x8c78('0x3b');utils[_0x8c78('0x3')](util['format'](_0x8c78('0x57'),_0x240f1e['uniqueid'],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x8')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0x2e')],agents[_0x240f1e[_0x8c78('0x6')]][_0x8c78('0xc')]));writeDB(agents[_0x240f1e['uniqueid']]);}}catch(_0x5c67c9){utils['error'](util[_0x8c78('0x4')](_0x8c78('0x54'),_0x240f1e['uniqueid']),_0x5c67c9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 37871cf..d2c48ef 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 _0x6979=['lastapplication','Queue','lastdata','queue','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]','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','includes','noop','execif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','interface','connectedlinenum','lastevent','accountcode','then','request','CreateVoiceCallReport','blinds','newchannel','debug','channel','OutgoingSpoolFailed','context','exten','calleridnum','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','destinationchannel','answertime','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','[%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-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x6979,0x1d4));var _0x9697=function(_0x50f545,_0x2596ab){_0x50f545=_0x50f545-0x0;var _0x477b9d=_0x6979[_0x50f545];return _0x477b9d;};'use strict';var _=require('lodash');var util=require(_0x9697('0x0'));var utils=require(_0x9697('0x1'));var transfers=require(_0x9697('0x2'));var dispositions=[_0x9697('0x3'),'FAILED',_0x9697('0x4'),_0x9697('0x3'),'NO\x20ANSWER',_0x9697('0x3'),'ANSWERED','BUSY','FAILED','FAILED','FAILED'];var channels={};function writeDB(_0x2908d6){var _0x10ceb3;if(transfers['blinds'][_0x2908d6[_0x9697('0x5')]]){_0x10ceb3=_0x2908d6['uniqueid'];_0x2908d6['uniqueid']=transfers['blinds'][_0x2908d6[_0x9697('0x5')]][_0x9697('0x6')];}utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x9'),_0x2908d6['uniqueid'],_0x2908d6['channel'],_0x2908d6['queue'],_0x2908d6['membername'],_0x2908d6[_0x9697('0xa')],_0x2908d6['calleridnum'],_0x2908d6[_0x9697('0xb')],_0x2908d6[_0x9697('0xc')]));if(_0x2908d6[_0x9697('0xd')]){utils['getUserByInternal'](_0x2908d6[_0x9697('0xd')])[_0x9697('0xe')](function(_0x4d57ba){if(_0x4d57ba){_0x2908d6['UserId']=_0x4d57ba['id'];}utils[_0x9697('0xf')]('CreateVoiceCallReport',_0x2908d6);});}else{utils['request'](_0x9697('0x10'),_0x2908d6);}if(channels[_0x2908d6[_0x9697('0x5')]]){delete channels[_0x2908d6['uniqueid']];}else if(_0x10ceb3&&channels[_0x10ceb3]){delete transfers[_0x9697('0x11')][_0x10ceb3];delete channels[_0x10ceb3];}}exports[_0x9697('0x12')]=function(_0x28c156){try{utils[_0x9697('0x13')](util[_0x9697('0x8')]('[%s][calls][newchannel]',_0x28c156[_0x9697('0x5')]),_0x28c156);if(_0x28c156[_0x9697('0x5')]==_0x28c156['linkedid']&&_0x28c156[_0x9697('0x14')]!=_0x9697('0x15')){utils[_0x9697('0x7')](util[_0x9697('0x8')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x28c156[_0x9697('0x5')],_0x28c156[_0x9697('0x16')],_0x28c156[_0x9697('0x17')]));channels[_0x28c156[_0x9697('0x5')]]={'uniqueid':_0x28c156[_0x9697('0x5')],'accountcode':_0x28c156[_0x9697('0xd')],'source':_0x28c156[_0x9697('0x18')],'destination':_0x28c156['exten'],'destinationcontext':_0x28c156[_0x9697('0x16')],'channel':_0x28c156['channel'],'starttime':utils[_0x9697('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9697('0x3'),'amaflags':_0x9697('0x1a')};}}catch(_0x4176f4){utils[_0x9697('0x1b')](util[_0x9697('0x8')]('[%s][calls][newchannel]',_0x28c156[_0x9697('0x5')]),_0x4176f4);}};exports[_0x9697('0x1c')]=function(_0x463611){try{utils[_0x9697('0x13')](util[_0x9697('0x8')](_0x9697('0x1d'),_0x463611['uniqueid']),_0x463611);if(!_[_0x9697('0x1e')](channels[_0x463611['uniqueid']])&&_0x463611[_0x9697('0x1f')]==0x6){utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x20'),_0x463611[_0x9697('0x5')],_0x463611[_0x9697('0x16')],_0x463611[_0x9697('0x14')]));if(_['isNil'](channels[_0x463611['uniqueid']][_0x9697('0x21')])){channels[_0x463611['uniqueid']][_0x9697('0x21')]=utils[_0x9697('0x19')]();}}else if(!_[_0x9697('0x1e')](channels[_0x463611[_0x9697('0x22')]])&&_0x463611[_0x9697('0x1f')]==0x6&&_0x463611['context']!=_0x9697('0x23')){utils[_0x9697('0x7')](util[_0x9697('0x8')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x463611[_0x9697('0x5')],_0x463611['linkedid'],_0x463611[_0x9697('0x16')],_0x463611['channel']));channels[_0x463611[_0x9697('0x22')]][_0x9697('0xd')]=_0x463611[_0x9697('0xd')];channels[_0x463611[_0x9697('0x22')]][_0x9697('0x24')]=_0x463611[_0x9697('0x14')];if(_[_0x9697('0x1e')](channels[_0x463611[_0x9697('0x22')]][_0x9697('0x25')])){channels[_0x463611[_0x9697('0x22')]][_0x9697('0x25')]=utils[_0x9697('0x19')]();}channels[_0x463611[_0x9697('0x22')]]['disposition']=dispositions[_['toNumber'](_0x463611[_0x9697('0x1f')])]||'ANSWERED';}}catch(_0x3462fd){utils[_0x9697('0x1b')](util[_0x9697('0x8')](_0x9697('0x1d'),_0x463611[_0x9697('0x5')]),_0x3462fd);}};exports[_0x9697('0x26')]=function(_0x4c8bdf){try{if(!_[_0x9697('0x1e')](channels[_0x4c8bdf[_0x9697('0x5')]])){utils[_0x9697('0x13')](util[_0x9697('0x8')](_0x9697('0x27'),_0x4c8bdf['uniqueid']),_0x4c8bdf);if(_['isNil'](channels[_0x4c8bdf['uniqueid']][_0x9697('0x28')])){channels[_0x4c8bdf[_0x9697('0x5')]][_0x9697('0x28')]=_0x4c8bdf[_0x9697('0x29')]+'\x20<'+_0x4c8bdf[_0x9697('0x18')]+'>';}utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x2a'),_0x4c8bdf[_0x9697('0x5')],channels[_0x4c8bdf['uniqueid']][_0x9697('0x28')],_0x4c8bdf[_0x9697('0x2b')]));channels[_0x4c8bdf['uniqueid']]['endtime']=utils[_0x9697('0x19')]();channels[_0x4c8bdf[_0x9697('0x5')]][_0x9697('0x2c')]=utils[_0x9697('0x2d')](channels[_0x4c8bdf[_0x9697('0x5')]][_0x9697('0x2e')],channels[_0x4c8bdf[_0x9697('0x5')]][_0x9697('0x2f')]);channels[_0x4c8bdf['uniqueid']][_0x9697('0x30')]=channels[_0x4c8bdf[_0x9697('0x5')]][_0x9697('0x25')]?utils[_0x9697('0x2d')](channels[_0x4c8bdf[_0x9697('0x5')]]['endtime'],channels[_0x4c8bdf[_0x9697('0x5')]][_0x9697('0x25')]):0x0;writeDB(channels[_0x4c8bdf['uniqueid']]);}}catch(_0x5171c3){utils[_0x9697('0x1b')](util[_0x9697('0x8')](_0x9697('0x27'),_0x4c8bdf[_0x9697('0x5')]),_0x5171c3);}};exports[_0x9697('0x31')]=function(_0x5355e0){try{if(!_[_0x9697('0x1e')](channels[_0x5355e0[_0x9697('0x32')]])){utils[_0x9697('0x13')](util[_0x9697('0x8')](_0x9697('0x33'),_0x5355e0[_0x9697('0x34')]),_0x5355e0);if(channels[_0x5355e0['localtwolinkedid']][_0x9697('0x14')]==_0x5355e0['transfereechannel']){utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x35'),_0x5355e0['origtransfereruniqueid'],_0x5355e0[_0x9697('0x32')],_0x5355e0[_0x9697('0x36')]));channels[_0x5355e0[_0x9697('0x32')]][_0x9697('0x24')]=_0x5355e0['secondtransfererchannel'];channels[_0x5355e0[_0x9697('0x32')]][_0x9697('0x37')]=_0x9697('0x38');}else if(channels[_0x5355e0[_0x9697('0x32')]][_0x9697('0x14')]=_0x5355e0[_0x9697('0x39')]){utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x35'),_0x5355e0[_0x9697('0x34')],_0x5355e0[_0x9697('0x32')],_0x5355e0[_0x9697('0x3a')]));channels[_0x5355e0[_0x9697('0x32')]][_0x9697('0x24')]=_0x5355e0[_0x9697('0x3a')];channels[_0x5355e0[_0x9697('0x32')]][_0x9697('0x37')]='_attended';}}}catch(_0x1fd8c6){utils[_0x9697('0x1b')](util[_0x9697('0x8')](_0x9697('0x33'),_0x5355e0[_0x9697('0x34')]),_0x1fd8c6);}};exports[_0x9697('0x3b')]=function(_0xa4a1c2){try{if(!_[_0x9697('0x1e')](channels[_0xa4a1c2['uniqueid']])){utils['debug'](util[_0x9697('0x8')](_0x9697('0x3c'),_0xa4a1c2[_0x9697('0x5')]),_0xa4a1c2);channels[_0xa4a1c2[_0x9697('0x5')]]['musiconholdstartAt']=utils[_0x9697('0x19')]();utils[_0x9697('0x7')](util['format'](_0x9697('0x3d'),_0xa4a1c2[_0x9697('0x5')],channels[_0xa4a1c2[_0x9697('0x5')]]['musiconholdstartAt']));}}catch(_0x3138db){utils[_0x9697('0x1b')](util[_0x9697('0x8')](_0x9697('0x3c'),_0xa4a1c2[_0x9697('0x5')]),_0x3138db);}};exports[_0x9697('0x3e')]=function(_0x1e487f){try{if(!_[_0x9697('0x1e')](channels[_0x1e487f[_0x9697('0x5')]])){utils[_0x9697('0x13')](util['format'](_0x9697('0x3f'),_0x1e487f[_0x9697('0x5')]),_0x1e487f);if(!_[_0x9697('0x1e')](channels[_0x1e487f[_0x9697('0x5')]][_0x9697('0x40')])){channels[_0x1e487f[_0x9697('0x5')]]['mohtime']+=utils[_0x9697('0x2d')](utils[_0x9697('0x19')](),channels[_0x1e487f[_0x9697('0x5')]][_0x9697('0x40')]);utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x41'),_0x1e487f[_0x9697('0x5')],channels[_0x1e487f[_0x9697('0x5')]][_0x9697('0x42')]));delete channels[_0x1e487f[_0x9697('0x5')]][_0x9697('0x40')];}}}catch(_0x43e772){utils[_0x9697('0x1b')](util[_0x9697('0x8')](_0x9697('0x3f'),_0x1e487f[_0x9697('0x5')]),_0x43e772);}};exports[_0x9697('0x43')]=function(_0x268037){try{if(!_[_0x9697('0x1e')](channels[_0x268037[_0x9697('0x5')]])){utils[_0x9697('0x13')](util[_0x9697('0x8')](_0x9697('0x44'),_0x268037[_0x9697('0x5')]),_0x268037);if(!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')]['xmd-originatecalleridnum'])){utils['info'](util['format'](_0x9697('0x46'),_0x268037[_0x9697('0x5')],_0x268037[_0x9697('0x47')]));channels[_0x268037[_0x9697('0x5')]][_0x9697('0x48')]=_0x268037['value'];}if(!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')][_0x9697('0x49')])){utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x4a'),_0x268037[_0x9697('0x5')],_0x268037['value']));channels[_0x268037[_0x9697('0x5')]][_0x9697('0x4b')]=_0x268037[_0x9697('0x47')];channels[_0x268037[_0x9697('0x5')]][_0x9697('0x28')]='\x22'+_0x268037['value']+_0x9697('0x4c')+_0x268037[_0x9697('0x47')]+'>';}if(!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')][_0x9697('0x4d')])||!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')][_0x9697('0x4e')])){utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x4f'),_0x268037[_0x9697('0x5')],!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')][_0x9697('0x4d')])?_0x9697('0x4d'):_0x9697('0x4e'),_0x268037[_0x9697('0x47')]));channels[_0x268037[_0x9697('0x5')]][_0x9697('0x28')]=_0x268037[_0x9697('0x47')];}if(!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')][_0x9697('0x50')])||!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')][_0x9697('0x51')])){utils['info'](util[_0x9697('0x8')](_0x9697('0x4f'),_0x268037[_0x9697('0x5')],!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')]['xmd-queue'])?_0x9697('0x50'):_0x9697('0x51'),_0x268037[_0x9697('0x47')]));channels[_0x268037[_0x9697('0x5')]][_0x9697('0x52')]=_0x9697('0x53');channels[_0x268037[_0x9697('0x5')]][_0x9697('0x54')]=_0x268037[_0x9697('0x47')];channels[_0x268037[_0x9697('0x5')]][_0x9697('0x55')]=!![];}if(!_['isNil'](_0x268037['variable'][_0x9697('0x56')])){utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x57'),_0x268037['uniqueid'],_0x268037[_0x9697('0x47')]));channels[_0x268037['uniqueid']][_0x9697('0x58')]=_0x268037[_0x9697('0x47')];}if(!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')][_0x9697('0x59')])){utils['info'](util[_0x9697('0x8')](_0x9697('0x5a'),_0x268037['uniqueid'],_0x268037['value']));channels[_0x268037[_0x9697('0x5')]][_0x9697('0x5b')]=_0x268037['value'];}if(!_[_0x9697('0x1e')](_0x268037[_0x9697('0x45')][_0x9697('0x5c')])){utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x5d'),_0x268037['uniqueid'],_0x268037['value']));channels[_0x268037[_0x9697('0x5')]][_0x9697('0x5e')]=_0x268037['value'];}if(!_['isNil'](_0x268037[_0x9697('0x45')][_0x9697('0x5f')])){utils[_0x9697('0x7')](util[_0x9697('0x8')](_0x9697('0x60'),_0x268037[_0x9697('0x5')],_0x268037['value']));channels[_0x268037[_0x9697('0x5')]][_0x9697('0x5f')]=_0x268037['value'];}}}catch(_0x12a013){utils[_0x9697('0x1b')](util[_0x9697('0x8')](_0x9697('0x44'),_0x268037[_0x9697('0x5')]),_0x12a013);}};exports[_0x9697('0x61')]=function(_0x28abf7){try{if(!_[_0x9697('0x1e')](channels[_0x28abf7[_0x9697('0x5')]])){utils[_0x9697('0x13')](util[_0x9697('0x8')](_0x9697('0x62'),_0x28abf7[_0x9697('0x5')]),_0x28abf7);utils[_0x9697('0x7')](util[_0x9697('0x8')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x28abf7['uniqueid'],_0x28abf7['application'],_0x28abf7[_0x9697('0x63')]));if(_0x28abf7[_0x9697('0x64')][_0x9697('0x65')]()==_0x9697('0x66')&&_[_0x9697('0x67')](_0x28abf7[_0x9697('0x63')][_0x9697('0x65')](),_0x9697('0x68'))){var _0x4b1977=_0x28abf7[_0x9697('0x63')][_0x9697('0x69')]('=');var _0x59b574=_0x4b1977[0x0]['substring'](_0x4b1977[0x0][_0x9697('0x6a')]('(')+0x1,_0x4b1977[0x0]['lastIndexOf'](')'));var _0x411411=_0x4b1977[0x1];channels[_0x28abf7[_0x9697('0x5')]][_0x59b574]=_0x411411;}if(!_[_0x9697('0x6b')]([_0x9697('0x26'),_0x9697('0x6c'),_0x9697('0x6d'),_0x9697('0x66'),'gotoif'],_0x28abf7[_0x9697('0x64')][_0x9697('0x65')]())){channels[_0x28abf7[_0x9697('0x5')]]['lastapplication']=_0x28abf7['application'];channels[_0x28abf7['uniqueid']][_0x9697('0x54')]=_0x28abf7['appdata'];}}}catch(_0x70a40e){utils['error'](util['format'](_0x9697('0x62'),_0x28abf7[_0x9697('0x5')]),_0x70a40e);}}; \ No newline at end of file +var _0x1427=['lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','hangup','execif','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','blinds','transfereeuniqueid','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','request','CreateVoiceCallReport','newchannel','debug','linkedid','exten','context','now','DOCUMENTATION','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','error','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue'];(function(_0x1d3db5,_0x3fa1d6){var _0x3123fe=function(_0x1f6c8b){while(--_0x1f6c8b){_0x1d3db5['push'](_0x1d3db5['shift']());}};_0x3123fe(++_0x3fa1d6);}(_0x1427,0x7e));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7142('0x0'));var utils=require(_0x7142('0x1'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0x7142('0x2'),_0x7142('0x2'),_0x7142('0x3'),_0x7142('0x3'),_0x7142('0x3'),_0x7142('0x4'),'BUSY',_0x7142('0x2'),_0x7142('0x2'),_0x7142('0x2')];var channels={};function writeDB(_0x110382){var _0x1eddb2;if(transfers[_0x7142('0x5')][_0x110382['uniqueid']]){_0x1eddb2=_0x110382['uniqueid'];_0x110382['uniqueid']=transfers[_0x7142('0x5')][_0x110382['uniqueid']][_0x7142('0x6')];}utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x9'),_0x110382[_0x7142('0xa')],_0x110382[_0x7142('0xb')],_0x110382[_0x7142('0xc')],_0x110382[_0x7142('0xd')],_0x110382[_0x7142('0xe')],_0x110382[_0x7142('0xf')],_0x110382[_0x7142('0x10')],_0x110382[_0x7142('0x11')]));if(_0x110382[_0x7142('0x12')]){utils[_0x7142('0x13')](_0x110382[_0x7142('0x12')])['then'](function(_0x3313a2){if(_0x3313a2){_0x110382['UserId']=_0x3313a2['id'];}utils[_0x7142('0x14')](_0x7142('0x15'),_0x110382);});}else{utils['request'](_0x7142('0x15'),_0x110382);}if(channels[_0x110382['uniqueid']]){delete channels[_0x110382[_0x7142('0xa')]];}else if(_0x1eddb2&&channels[_0x1eddb2]){delete transfers[_0x7142('0x5')][_0x1eddb2];delete channels[_0x1eddb2];}}exports[_0x7142('0x16')]=function(_0x8d2521){try{utils[_0x7142('0x17')](util[_0x7142('0x8')]('[%s][calls][newchannel]',_0x8d2521['uniqueid']),_0x8d2521);if(_0x8d2521[_0x7142('0xa')]==_0x8d2521[_0x7142('0x18')]&&_0x8d2521[_0x7142('0xb')]!='OutgoingSpoolFailed'){utils[_0x7142('0x7')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x8d2521[_0x7142('0xa')],_0x8d2521['context'],_0x8d2521['exten']));channels[_0x8d2521['uniqueid']]={'uniqueid':_0x8d2521['uniqueid'],'accountcode':_0x8d2521[_0x7142('0x12')],'source':_0x8d2521['calleridnum'],'destination':_0x8d2521[_0x7142('0x19')],'destinationcontext':_0x8d2521[_0x7142('0x1a')],'channel':_0x8d2521['channel'],'starttime':utils[_0x7142('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7142('0x3'),'amaflags':_0x7142('0x1c')};}}catch(_0x2b0db6){utils['error'](util[_0x7142('0x8')]('[%s][calls][newchannel]',_0x8d2521['uniqueid']),_0x2b0db6);}};exports[_0x7142('0x1d')]=function(_0x4a7f00){try{utils[_0x7142('0x17')](util['format'](_0x7142('0x1e'),_0x4a7f00[_0x7142('0xa')]),_0x4a7f00);if(!_['isNil'](channels[_0x4a7f00[_0x7142('0xa')]])&&_0x4a7f00[_0x7142('0x1f')]==0x6){utils['info'](util[_0x7142('0x8')](_0x7142('0x20'),_0x4a7f00[_0x7142('0xa')],_0x4a7f00[_0x7142('0x1a')],_0x4a7f00['channel']));if(_[_0x7142('0x21')](channels[_0x4a7f00[_0x7142('0xa')]][_0x7142('0x22')])){channels[_0x4a7f00[_0x7142('0xa')]][_0x7142('0x22')]=utils['now']();}}else if(!_['isNil'](channels[_0x4a7f00['linkedid']])&&_0x4a7f00[_0x7142('0x1f')]==0x6&&_0x4a7f00['context']!=_0x7142('0x23')){utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x24'),_0x4a7f00[_0x7142('0xa')],_0x4a7f00[_0x7142('0x18')],_0x4a7f00[_0x7142('0x1a')],_0x4a7f00[_0x7142('0xb')]));channels[_0x4a7f00[_0x7142('0x18')]][_0x7142('0x12')]=_0x4a7f00['accountcode'];channels[_0x4a7f00[_0x7142('0x18')]][_0x7142('0x25')]=_0x4a7f00[_0x7142('0xb')];if(_['isNil'](channels[_0x4a7f00[_0x7142('0x18')]]['answertime'])){channels[_0x4a7f00[_0x7142('0x18')]][_0x7142('0x26')]=utils[_0x7142('0x1b')]();}channels[_0x4a7f00[_0x7142('0x18')]]['disposition']=dispositions[_['toNumber'](_0x4a7f00[_0x7142('0x1f')])]||_0x7142('0x4');}}catch(_0x179a02){utils['error'](util[_0x7142('0x8')](_0x7142('0x1e'),_0x4a7f00['uniqueid']),_0x179a02);}};exports['hangup']=function(_0x31cf1e){try{if(!_[_0x7142('0x21')](channels[_0x31cf1e[_0x7142('0xa')]])){utils[_0x7142('0x17')](util['format'](_0x7142('0x27'),_0x31cf1e[_0x7142('0xa')]),_0x31cf1e);if(_['isNil'](channels[_0x31cf1e[_0x7142('0xa')]][_0x7142('0x28')])){channels[_0x31cf1e[_0x7142('0xa')]][_0x7142('0x28')]=_0x31cf1e[_0x7142('0x29')]+'\x20<'+_0x31cf1e[_0x7142('0xf')]+'>';}utils['info'](util[_0x7142('0x8')](_0x7142('0x2a'),_0x31cf1e[_0x7142('0xa')],channels[_0x31cf1e[_0x7142('0xa')]]['callerid'],_0x31cf1e[_0x7142('0x2b')]));channels[_0x31cf1e['uniqueid']]['endtime']=utils[_0x7142('0x1b')]();channels[_0x31cf1e[_0x7142('0xa')]]['duration']=utils[_0x7142('0x2c')](channels[_0x31cf1e['uniqueid']][_0x7142('0x2d')],channels[_0x31cf1e[_0x7142('0xa')]][_0x7142('0x2e')]);channels[_0x31cf1e['uniqueid']][_0x7142('0x2f')]=channels[_0x31cf1e[_0x7142('0xa')]][_0x7142('0x26')]?utils[_0x7142('0x2c')](channels[_0x31cf1e[_0x7142('0xa')]][_0x7142('0x2d')],channels[_0x31cf1e[_0x7142('0xa')]][_0x7142('0x26')]):0x0;writeDB(channels[_0x31cf1e[_0x7142('0xa')]]);}}catch(_0x1c42ba){utils[_0x7142('0x30')](util['format'](_0x7142('0x27'),_0x31cf1e[_0x7142('0xa')]),_0x1c42ba);}};exports[_0x7142('0x31')]=function(_0x3fed3b){try{if(!_[_0x7142('0x21')](channels[_0x3fed3b[_0x7142('0x32')]])){utils['debug'](util[_0x7142('0x8')](_0x7142('0x33'),_0x3fed3b['origtransfereruniqueid']),_0x3fed3b);if(channels[_0x3fed3b[_0x7142('0x32')]][_0x7142('0xb')]==_0x3fed3b[_0x7142('0x34')]){utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x35'),_0x3fed3b[_0x7142('0x36')],_0x3fed3b[_0x7142('0x32')],_0x3fed3b[_0x7142('0x37')]));channels[_0x3fed3b['localtwolinkedid']][_0x7142('0x25')]=_0x3fed3b['secondtransfererchannel'];channels[_0x3fed3b[_0x7142('0x32')]][_0x7142('0x38')]=_0x7142('0x39');}else if(channels[_0x3fed3b[_0x7142('0x32')]][_0x7142('0xb')]=_0x3fed3b['transfertargetchannel']){utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x35'),_0x3fed3b[_0x7142('0x36')],_0x3fed3b[_0x7142('0x32')],_0x3fed3b['origtransfererchannel']));channels[_0x3fed3b['localtwolinkedid']][_0x7142('0x25')]=_0x3fed3b['origtransfererchannel'];channels[_0x3fed3b[_0x7142('0x32')]][_0x7142('0x38')]=_0x7142('0x39');}}}catch(_0x4f5a8b){utils['error'](util[_0x7142('0x8')](_0x7142('0x33'),_0x3fed3b['origtransfereruniqueid']),_0x4f5a8b);}};exports[_0x7142('0x3a')]=function(_0x5234c2){try{if(!_['isNil'](channels[_0x5234c2[_0x7142('0xa')]])){utils[_0x7142('0x17')](util[_0x7142('0x8')](_0x7142('0x3b'),_0x5234c2[_0x7142('0xa')]),_0x5234c2);channels[_0x5234c2[_0x7142('0xa')]]['musiconholdstartAt']=utils['now']();utils[_0x7142('0x7')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5234c2[_0x7142('0xa')],channels[_0x5234c2[_0x7142('0xa')]][_0x7142('0x3c')]));}}catch(_0x2e0d12){utils[_0x7142('0x30')](util[_0x7142('0x8')](_0x7142('0x3b'),_0x5234c2['uniqueid']),_0x2e0d12);}};exports[_0x7142('0x3d')]=function(_0x3e4a51){try{if(!_[_0x7142('0x21')](channels[_0x3e4a51[_0x7142('0xa')]])){utils[_0x7142('0x17')](util['format'](_0x7142('0x3e'),_0x3e4a51[_0x7142('0xa')]),_0x3e4a51);if(!_[_0x7142('0x21')](channels[_0x3e4a51[_0x7142('0xa')]]['musiconholdstartAt'])){channels[_0x3e4a51['uniqueid']][_0x7142('0x3f')]+=utils['diffTime'](utils['now'](),channels[_0x3e4a51[_0x7142('0xa')]][_0x7142('0x3c')]);utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x40'),_0x3e4a51['uniqueid'],channels[_0x3e4a51['uniqueid']]['mohtime']));delete channels[_0x3e4a51['uniqueid']][_0x7142('0x3c')];}}}catch(_0xbbe0e6){utils['error'](util['format'](_0x7142('0x3e'),_0x3e4a51[_0x7142('0xa')]),_0xbbe0e6);}};exports[_0x7142('0x41')]=function(_0x54830d){try{if(!_[_0x7142('0x21')](channels[_0x54830d[_0x7142('0xa')]])){utils[_0x7142('0x17')](util['format'](_0x7142('0x42'),_0x54830d[_0x7142('0xa')]),_0x54830d);if(!_[_0x7142('0x21')](_0x54830d['variable']['xmd-originatecalleridnum'])){utils[_0x7142('0x7')](util['format'](_0x7142('0x43'),_0x54830d[_0x7142('0xa')],_0x54830d[_0x7142('0x44')]));channels[_0x54830d[_0x7142('0xa')]][_0x7142('0x45')]=_0x54830d[_0x7142('0x44')];}if(!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')][_0x7142('0x47')])){utils[_0x7142('0x7')](util[_0x7142('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x54830d[_0x7142('0xa')],_0x54830d[_0x7142('0x44')]));channels[_0x54830d['uniqueid']]['destination']=_0x54830d['value'];channels[_0x54830d[_0x7142('0xa')]][_0x7142('0x28')]='\x22'+_0x54830d['value']+_0x7142('0x48')+_0x54830d[_0x7142('0x44')]+'>';}if(!_['isNil'](_0x54830d['variable'][_0x7142('0x49')])||!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')]['xmd-callerid'])){utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x4a'),_0x54830d[_0x7142('0xa')],!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')]['xmd-callerid-preview'])?_0x7142('0x49'):_0x7142('0x4b'),_0x54830d['value']));channels[_0x54830d[_0x7142('0xa')]][_0x7142('0x28')]=_0x54830d[_0x7142('0x44')];}if(!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')][_0x7142('0x4c')])||!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')]['xmcs-queue'])){utils[_0x7142('0x7')](util[_0x7142('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x54830d[_0x7142('0xa')],!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')][_0x7142('0x4c')])?'xmd-queue':_0x7142('0x4d'),_0x54830d[_0x7142('0x44')]));channels[_0x54830d[_0x7142('0xa')]][_0x7142('0x4e')]=_0x7142('0x4f');channels[_0x54830d[_0x7142('0xa')]]['lastdata']=_0x54830d['value'];channels[_0x54830d[_0x7142('0xa')]][_0x7142('0xc')]=!![];}if(!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')][_0x7142('0x50')])){utils[_0x7142('0x7')](util['format'](_0x7142('0x51'),_0x54830d[_0x7142('0xa')],_0x54830d[_0x7142('0x44')]));channels[_0x54830d[_0x7142('0xa')]][_0x7142('0x52')]=_0x54830d[_0x7142('0x44')];}if(!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')][_0x7142('0x53')])){utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x54'),_0x54830d['uniqueid'],_0x54830d[_0x7142('0x44')]));channels[_0x54830d[_0x7142('0xa')]][_0x7142('0x55')]=_0x54830d[_0x7142('0x44')];}if(!_[_0x7142('0x21')](_0x54830d[_0x7142('0x46')]['outboundrouteid'])){utils['info'](util[_0x7142('0x8')](_0x7142('0x56'),_0x54830d[_0x7142('0xa')],_0x54830d[_0x7142('0x44')]));channels[_0x54830d[_0x7142('0xa')]]['routeid']=_0x54830d[_0x7142('0x44')];}if(!_['isNil'](_0x54830d[_0x7142('0x46')][_0x7142('0x57')])){utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x58'),_0x54830d[_0x7142('0xa')],_0x54830d[_0x7142('0x44')]));channels[_0x54830d[_0x7142('0xa')]][_0x7142('0x57')]=_0x54830d[_0x7142('0x44')];}}}catch(_0x599f15){utils[_0x7142('0x30')](util['format'](_0x7142('0x42'),_0x54830d[_0x7142('0xa')]),_0x599f15);}};exports[_0x7142('0x59')]=function(_0x206659){try{if(!_[_0x7142('0x21')](channels[_0x206659['uniqueid']])){utils[_0x7142('0x17')](util[_0x7142('0x8')](_0x7142('0x5a'),_0x206659['uniqueid']),_0x206659);utils[_0x7142('0x7')](util[_0x7142('0x8')](_0x7142('0x5b'),_0x206659[_0x7142('0xa')],_0x206659[_0x7142('0x5c')],_0x206659[_0x7142('0x5d')]));if(_0x206659['application'][_0x7142('0x5e')]()==_0x7142('0x5f')&&_[_0x7142('0x60')](_0x206659[_0x7142('0x5d')][_0x7142('0x5e')](),_0x7142('0x61'))){var _0x16057c=_0x206659['appdata']['split']('=');var _0x4e0c70=_0x16057c[0x0][_0x7142('0x62')](_0x16057c[0x0][_0x7142('0x63')]('(')+0x1,_0x16057c[0x0][_0x7142('0x63')](')'));var _0xae028e=_0x16057c[0x1];channels[_0x206659[_0x7142('0xa')]][_0x4e0c70]=_0xae028e;}if(!_['includes']([_0x7142('0x64'),'noop',_0x7142('0x65'),_0x7142('0x5f'),'gotoif'],_0x206659[_0x7142('0x5c')][_0x7142('0x5e')]())){channels[_0x206659[_0x7142('0xa')]][_0x7142('0x4e')]=_0x206659[_0x7142('0x5c')];channels[_0x206659[_0x7142('0xa')]]['lastdata']=_0x206659[_0x7142('0x5d')];}}}catch(_0x66960e){utils[_0x7142('0x30')](util[_0x7142('0x8')](_0x7142('0x5a'),_0x206659[_0x7142('0xa')]),_0x66960e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5706bea..742c653 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 _0xe01b=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','error','[core]\x20error'];(function(_0xc0f3d0,_0x4cfe98){var _0x1798ba=function(_0xa3446d){while(--_0xa3446d){_0xc0f3d0['push'](_0xc0f3d0['shift']());}};_0x1798ba(++_0x4cfe98);}(_0xe01b,0x7a));var _0xbe01=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xe01b[_0x256b72];return _0x2183e3;};'use strict';var utils=require(_0xbe01('0x0'));exports[_0xbe01('0x1')]=function(){utils[_0xbe01('0x2')](_0xbe01('0x3'));};exports['shutdown']=function(){utils[_0xbe01('0x2')](_0xbe01('0x4'));};exports[_0xbe01('0x5')]=function(){utils[_0xbe01('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x4c4060){utils[_0xbe01('0x6')](_0xbe01('0x7'),_0x4c4060);};exports['close']=function(){utils[_0xbe01('0x2')](_0xbe01('0x8'));};exports[_0xbe01('0x9')]=function(_0x1dabfa){}; \ No newline at end of file +var _0xfbf7=['fullybooted','[core]\x20fullybooted','error','close','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x3a24d9,_0x4ef4d9){var _0x5181d6=function(_0x2bf311){while(--_0x2bf311){_0x3a24d9['push'](_0x3a24d9['shift']());}};_0x5181d6(++_0x4ef4d9);}(_0xfbf7,0xe4));var _0x7fbf=function(_0x18ac1b,_0x1065d8){_0x18ac1b=_0x18ac1b-0x0;var _0x4bd762=_0xfbf7[_0x18ac1b];return _0x4bd762;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x7fbf('0x0')](_0x7fbf('0x1'));};exports[_0x7fbf('0x2')]=function(){utils['info'](_0x7fbf('0x3'));};exports[_0x7fbf('0x4')]=function(){utils[_0x7fbf('0x0')](_0x7fbf('0x5'));};exports[_0x7fbf('0x6')]=function(_0x476fba){utils['error']('[core]\x20error',_0x476fba);};exports[_0x7fbf('0x7')]=function(){utils['info']('[core]\x20close');};exports['managerevent']=function(_0x3b513a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index bde8812..72503c7 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 _0xd825=['split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','starttime','now','lastevent','called','dialend','[%s][dials][dialend]','ANSWER','assign','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','holdtime','diffTime','endtime','billableseconds','answertime','[%s][dials][hangup]','lodash','./utils','info','format','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','appdata','application','toLowerCase','startsWith'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0xd825,0x169));var _0x5d82=function(_0x415b52,_0x34a009){_0x415b52=_0x415b52-0x0;var _0x316676=_0xd825[_0x415b52];return _0x316676;};'use strict';var _=require(_0x5d82('0x0'));var util=require('util');var utils=require(_0x5d82('0x1'));var dials={};function writeDB(_0x304ef3){utils[_0x5d82('0x2')](util[_0x5d82('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x304ef3[_0x5d82('0x4')],_0x304ef3[_0x5d82('0x5')],_0x304ef3['dialstring'],_0x304ef3[_0x5d82('0x6')],_0x304ef3['connectedlinenum'],_0x304ef3[_0x5d82('0x7')]));utils[_0x5d82('0x8')](_0x5d82('0x9'),_0x304ef3);delete dials[_0x304ef3['uniqueid']];}exports['newexten']=function(_0xf611f){try{utils[_0x5d82('0xa')](util[_0x5d82('0x3')]('[%s][dials][newexten]',_0xf611f[_0x5d82('0x4')]),_0xf611f);utils[_0x5d82('0x2')](util[_0x5d82('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0xf611f[_0x5d82('0x4')],_0xf611f['application'],_0xf611f[_0x5d82('0xb')]));if(_0xf611f[_0x5d82('0xc')][_0x5d82('0xd')]()=='set'&&_[_0x5d82('0xe')](_0xf611f[_0x5d82('0xb')]['toLowerCase'](),'cdr(routeid)')){var _0x2dea29=_0xf611f[_0x5d82('0xb')][_0x5d82('0xf')]('=');dials[_0xf611f[_0x5d82('0x4')]]={'routeId':_0x2dea29[0x1]};}}catch(_0x58a5e2){utils[_0x5d82('0x10')](util['format']('[%s][dials][newexten]',_0xf611f[_0x5d82('0x4')]),_0x58a5e2);}};exports[_0x5d82('0x11')]=function(_0x5be184){try{utils[_0x5d82('0xa')](util[_0x5d82('0x3')]('[%s][dials][varset]',_0x5be184[_0x5d82('0x4')]),_0x5be184);if(!_[_0x5d82('0x12')](_0x5be184[_0x5d82('0x13')][_0x5d82('0x14')])){utils[_0x5d82('0x2')](util['format'](_0x5d82('0x15'),_0x5be184[_0x5d82('0x4')],_0x5be184[_0x5d82('0x16')]));dials[_0x5be184['uniqueid']]={'routeId':_0x5be184[_0x5d82('0x16')]};}}catch(_0x1b4482){utils[_0x5d82('0x10')](util['format']('[%s][dials][varset]',_0x5be184['uniqueid']),_0x1b4482);}};exports['dialbegin']=function(_0x1bbe4f){try{if(!_[_0x5d82('0x12')](dials[_0x1bbe4f['uniqueid']])){utils[_0x5d82('0xa')](util[_0x5d82('0x3')](_0x5d82('0x17'),_0x1bbe4f[_0x5d82('0x4')]),_0x1bbe4f);dials[_0x1bbe4f[_0x5d82('0x4')]]=_['assign'](dials[_0x1bbe4f[_0x5d82('0x4')]],_0x1bbe4f);dials[_0x1bbe4f[_0x5d82('0x4')]][_0x5d82('0x18')]=utils[_0x5d82('0x19')]();dials[_0x1bbe4f['uniqueid']][_0x5d82('0x1a')]=_0x5d82('0x1b');utils[_0x5d82('0x2')](util[_0x5d82('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x1bbe4f[_0x5d82('0x4')],dials[_0x1bbe4f[_0x5d82('0x4')]][_0x5d82('0x18')]));}}catch(_0xa4965e){utils[_0x5d82('0x10')](util[_0x5d82('0x3')](_0x5d82('0x17'),_0x1bbe4f[_0x5d82('0x4')]),_0xa4965e);}};exports[_0x5d82('0x1c')]=function(_0x3f5c94){try{if(!_[_0x5d82('0x12')](dials[_0x3f5c94[_0x5d82('0x4')]])){utils['debug'](util[_0x5d82('0x3')](_0x5d82('0x1d'),_0x3f5c94['uniqueid']),_0x3f5c94);dials[_0x3f5c94['uniqueid']][_0x5d82('0x7')]=_0x3f5c94[_0x5d82('0x7')];if(_0x3f5c94[_0x5d82('0x7')]==_0x5d82('0x1e')){dials[_0x3f5c94[_0x5d82('0x4')]]=_[_0x5d82('0x1f')](dials[_0x3f5c94[_0x5d82('0x4')]],_0x3f5c94);dials[_0x3f5c94[_0x5d82('0x4')]]['answertime']=utils[_0x5d82('0x19')]();dials[_0x3f5c94[_0x5d82('0x4')]][_0x5d82('0x1a')]=_0x5d82('0x20');utils[_0x5d82('0x2')](util[_0x5d82('0x3')](_0x5d82('0x21'),_0x3f5c94['uniqueid'],_0x3f5c94[_0x5d82('0x7')],dials[_0x3f5c94[_0x5d82('0x4')]]['answertime']));}else{utils[_0x5d82('0x2')](util[_0x5d82('0x3')](_0x5d82('0x22'),_0x3f5c94[_0x5d82('0x4')],_0x3f5c94['dialstatus']));}}}catch(_0x33bec9){utils[_0x5d82('0x10')](util[_0x5d82('0x3')]('[%s][dials][dialend]',_0x3f5c94[_0x5d82('0x4')]),_0x33bec9);}};exports[_0x5d82('0x23')]=function(_0x4722ee){try{if(!_['isNil'](dials[_0x4722ee[_0x5d82('0x4')]])){utils[_0x5d82('0xa')](util[_0x5d82('0x3')]('[%s][dials][hangup]',_0x4722ee['uniqueid']),_0x4722ee);utils[_0x5d82('0x2')](util[_0x5d82('0x3')](_0x5d82('0x24'),_0x4722ee['uniqueid'],_0x4722ee['calleridnum'],_0x4722ee[_0x5d82('0x25')],_0x4722ee[_0x5d82('0x26')]));dials[_0x4722ee['uniqueid']]=_[_0x5d82('0x1f')](dials[_0x4722ee['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x5d82('0x27')});dials[_0x4722ee[_0x5d82('0x4')]][_0x5d82('0x28')]=utils['diffTime'](dials[_0x4722ee[_0x5d82('0x4')]]['endtime'],dials[_0x4722ee[_0x5d82('0x4')]][_0x5d82('0x18')]);dials[_0x4722ee[_0x5d82('0x4')]][_0x5d82('0x29')]=utils[_0x5d82('0x2a')](dials[_0x4722ee['uniqueid']]['answertime']||dials[_0x4722ee[_0x5d82('0x4')]][_0x5d82('0x2b')],dials[_0x4722ee[_0x5d82('0x4')]][_0x5d82('0x18')]);dials[_0x4722ee['uniqueid']][_0x5d82('0x2c')]=dials[_0x4722ee[_0x5d82('0x4')]][_0x5d82('0x2d')]?utils['diffTime'](dials[_0x4722ee['uniqueid']][_0x5d82('0x2b')],dials[_0x4722ee[_0x5d82('0x4')]][_0x5d82('0x2d')]):0x0;writeDB(dials[_0x4722ee[_0x5d82('0x4')]]);}}catch(_0x3927c8){utils[_0x5d82('0x10')](util[_0x5d82('0x3')](_0x5d82('0x2e'),_0x4722ee[_0x5d82('0x4')]),_0x3927c8);}}; \ No newline at end of file +var _0xe4cc=['complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xe4cc,0x6c));var _0xce4c=function(_0xd258cd,_0x352517){_0xd258cd=_0xd258cd-0x0;var _0x2e59d3=_0xe4cc[_0xd258cd];return _0x2e59d3;};'use strict';var _=require(_0xce4c('0x0'));var util=require(_0xce4c('0x1'));var utils=require(_0xce4c('0x2'));var dials={};function writeDB(_0x4b7c89){utils[_0xce4c('0x3')](util[_0xce4c('0x4')](_0xce4c('0x5'),_0x4b7c89[_0xce4c('0x6')],_0x4b7c89[_0xce4c('0x7')],_0x4b7c89[_0xce4c('0x8')],_0x4b7c89['calleridnum'],_0x4b7c89[_0xce4c('0x9')],_0x4b7c89[_0xce4c('0xa')]));utils[_0xce4c('0xb')]('CreateVoiceDialReport',_0x4b7c89);delete dials[_0x4b7c89[_0xce4c('0x6')]];}exports['newexten']=function(_0x3a4669){try{utils[_0xce4c('0xc')](util['format']('[%s][dials][newexten]',_0x3a4669[_0xce4c('0x6')]),_0x3a4669);utils[_0xce4c('0x3')](util[_0xce4c('0x4')](_0xce4c('0xd'),_0x3a4669[_0xce4c('0x6')],_0x3a4669[_0xce4c('0xe')],_0x3a4669[_0xce4c('0xf')]));if(_0x3a4669[_0xce4c('0xe')][_0xce4c('0x10')]()==_0xce4c('0x11')&&_['startsWith'](_0x3a4669['appdata'][_0xce4c('0x10')](),_0xce4c('0x12'))){var _0x2ffb6e=_0x3a4669[_0xce4c('0xf')][_0xce4c('0x13')]('=');dials[_0x3a4669['uniqueid']]={'routeId':_0x2ffb6e[0x1]};}}catch(_0x32f6de){utils[_0xce4c('0x14')](util[_0xce4c('0x4')]('[%s][dials][newexten]',_0x3a4669[_0xce4c('0x6')]),_0x32f6de);}};exports[_0xce4c('0x15')]=function(_0xb65c63){try{utils['debug'](util[_0xce4c('0x4')](_0xce4c('0x16'),_0xb65c63[_0xce4c('0x6')]),_0xb65c63);if(!_['isNil'](_0xb65c63[_0xce4c('0x17')][_0xce4c('0x18')])){utils[_0xce4c('0x3')](util[_0xce4c('0x4')](_0xce4c('0x19'),_0xb65c63[_0xce4c('0x6')],_0xb65c63[_0xce4c('0x1a')]));dials[_0xb65c63['uniqueid']]={'routeId':_0xb65c63[_0xce4c('0x1a')]};}}catch(_0x25aa1f){utils[_0xce4c('0x14')](util['format'](_0xce4c('0x16'),_0xb65c63[_0xce4c('0x6')]),_0x25aa1f);}};exports['dialbegin']=function(_0x9a9d40){try{if(!_[_0xce4c('0x1b')](dials[_0x9a9d40[_0xce4c('0x6')]])){utils[_0xce4c('0xc')](util[_0xce4c('0x4')]('[%s][dials][dialbegin]',_0x9a9d40[_0xce4c('0x6')]),_0x9a9d40);dials[_0x9a9d40[_0xce4c('0x6')]]=_[_0xce4c('0x1c')](dials[_0x9a9d40[_0xce4c('0x6')]],_0x9a9d40);dials[_0x9a9d40['uniqueid']][_0xce4c('0x1d')]=utils[_0xce4c('0x1e')]();dials[_0x9a9d40[_0xce4c('0x6')]][_0xce4c('0x1f')]=_0xce4c('0x20');utils[_0xce4c('0x3')](util[_0xce4c('0x4')](_0xce4c('0x21'),_0x9a9d40[_0xce4c('0x6')],dials[_0x9a9d40[_0xce4c('0x6')]][_0xce4c('0x1d')]));}}catch(_0x1e2f1b){utils[_0xce4c('0x14')](util[_0xce4c('0x4')](_0xce4c('0x22'),_0x9a9d40[_0xce4c('0x6')]),_0x1e2f1b);}};exports[_0xce4c('0x23')]=function(_0x52578c){try{if(!_[_0xce4c('0x1b')](dials[_0x52578c[_0xce4c('0x6')]])){utils[_0xce4c('0xc')](util['format'](_0xce4c('0x24'),_0x52578c['uniqueid']),_0x52578c);dials[_0x52578c['uniqueid']][_0xce4c('0xa')]=_0x52578c[_0xce4c('0xa')];if(_0x52578c[_0xce4c('0xa')]==_0xce4c('0x25')){dials[_0x52578c[_0xce4c('0x6')]]=_[_0xce4c('0x1c')](dials[_0x52578c[_0xce4c('0x6')]],_0x52578c);dials[_0x52578c[_0xce4c('0x6')]][_0xce4c('0x26')]=utils[_0xce4c('0x1e')]();dials[_0x52578c['uniqueid']][_0xce4c('0x1f')]='connect';utils[_0xce4c('0x3')](util[_0xce4c('0x4')](_0xce4c('0x27'),_0x52578c[_0xce4c('0x6')],_0x52578c[_0xce4c('0xa')],dials[_0x52578c[_0xce4c('0x6')]][_0xce4c('0x26')]));}else{utils[_0xce4c('0x3')](util[_0xce4c('0x4')](_0xce4c('0x28'),_0x52578c[_0xce4c('0x6')],_0x52578c[_0xce4c('0xa')]));}}}catch(_0x47cbc9){utils[_0xce4c('0x14')](util['format'](_0xce4c('0x24'),_0x52578c[_0xce4c('0x6')]),_0x47cbc9);}};exports['hangup']=function(_0x4a3d3b){try{if(!_[_0xce4c('0x1b')](dials[_0x4a3d3b['uniqueid']])){utils['debug'](util[_0xce4c('0x4')](_0xce4c('0x29'),_0x4a3d3b[_0xce4c('0x6')]),_0x4a3d3b);utils['info'](util[_0xce4c('0x4')](_0xce4c('0x2a'),_0x4a3d3b['uniqueid'],_0x4a3d3b['calleridnum'],_0x4a3d3b[_0xce4c('0x2b')],_0x4a3d3b[_0xce4c('0x2c')]));dials[_0x4a3d3b['uniqueid']]=_[_0xce4c('0x1c')](dials[_0x4a3d3b[_0xce4c('0x6')]],{'endtime':utils[_0xce4c('0x1e')](),'lastevent':_0xce4c('0x2d')});dials[_0x4a3d3b[_0xce4c('0x6')]][_0xce4c('0x2e')]=utils[_0xce4c('0x2f')](dials[_0x4a3d3b['uniqueid']]['endtime'],dials[_0x4a3d3b[_0xce4c('0x6')]][_0xce4c('0x1d')]);dials[_0x4a3d3b[_0xce4c('0x6')]][_0xce4c('0x30')]=utils[_0xce4c('0x2f')](dials[_0x4a3d3b[_0xce4c('0x6')]][_0xce4c('0x26')]||dials[_0x4a3d3b[_0xce4c('0x6')]][_0xce4c('0x31')],dials[_0x4a3d3b[_0xce4c('0x6')]][_0xce4c('0x1d')]);dials[_0x4a3d3b['uniqueid']][_0xce4c('0x32')]=dials[_0x4a3d3b[_0xce4c('0x6')]][_0xce4c('0x26')]?utils[_0xce4c('0x2f')](dials[_0x4a3d3b[_0xce4c('0x6')]][_0xce4c('0x31')],dials[_0x4a3d3b['uniqueid']][_0xce4c('0x26')]):0x0;writeDB(dials[_0x4a3d3b[_0xce4c('0x6')]]);}}catch(_0x8cac7d){utils[_0xce4c('0x14')](util['format']('[%s][dials][hangup]',_0x4a3d3b['uniqueid']),_0x8cac7d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8a1b2a9..48c52e0 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 _0x3758=['./calls.controller','./queues.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','debug','[%s][index][agentcalled]','agentcalled','[%s][index][agentringnoanswer]','uniqueid','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]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s][index][dialend]','dialend','./utils','util','asterisk','username','password','xdr','disabled','./agents.controller'];(function(_0x53f2a0,_0x305d5f){var _0x166d47=function(_0x5bc26e){while(--_0x5bc26e){_0x53f2a0['push'](_0x53f2a0['shift']());}};_0x166d47(++_0x305d5f);}(_0x3758,0x1b1));var _0x8375=function(_0x5929ef,_0xbb2c73){_0x5929ef=_0x5929ef-0x0;var _0x4766ff=_0x3758[_0x5929ef];return _0x4766ff;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x8375('0x0'));var util=require(_0x8375('0x1'));var ami=new AsteriskManager(config[_0x8375('0x2')]['port'],config[_0x8375('0x2')]['ip'],config[_0x8375('0x2')][_0x8375('0x3')],config[_0x8375('0x2')][_0x8375('0x4')],!![]);ami['keepConnected']();if(config[_0x8375('0x5')]&&config[_0x8375('0x5')][_0x8375('0x6')]){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x8375('0x7'));var calls=require(_0x8375('0x8'));var queues=require(_0x8375('0x9'));var recordings=require('./recordings.controller');var members=require(_0x8375('0xa'));var dials=require('./dials.controller');var transfers=require(_0x8375('0xb'));var core=require('./core.controller');ami['on']('connect',core[_0x8375('0xc')]);ami['on'](_0x8375('0xd'),core[_0x8375('0xd')]);ami['on'](_0x8375('0xe'),core['fullybooted']);ami['on'](_0x8375('0xf'),core[_0x8375('0xf')]);ami['on'](_0x8375('0x10'),core[_0x8375('0x10')]);ami['on'](_0x8375('0x11'),core['managerevent']);ami['on'](_0x8375('0x12'),function(_0xdf31f4){try{utils['debug'](util['format'](_0x8375('0x13'),_0xdf31f4[_0x8375('0x14')]),_0xdf31f4);members[_0x8375('0x12')](_0xdf31f4);}catch(_0x10db5c){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x13'),_0xdf31f4['device']),_0x10db5c);}});ami['on']('agentcalled',function(_0xe79054){try{utils[_0x8375('0x16')](util[_0x8375('0x15')](_0x8375('0x17'),_0xe79054['uniqueid']),_0xe79054);agents[_0x8375('0x18')](_0xe79054);}catch(_0x1aa826){utils['error'](util['format'](_0x8375('0x17'),_0xe79054['uniqueid']),_0x1aa826);}});ami['on']('agentringnoanswer',function(_0x131445){try{utils[_0x8375('0x16')](util[_0x8375('0x15')](_0x8375('0x19'),_0x131445[_0x8375('0x1a')]),_0x131445);agents[_0x8375('0x1b')](_0x131445);}catch(_0x1ee2c1){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x19'),_0x131445[_0x8375('0x1a')]),_0x1ee2c1);}});ami['on']('agentconnect',function(_0x3bfc1c){try{utils[_0x8375('0x16')](util[_0x8375('0x15')]('[%s][index][agentconnect]',_0x3bfc1c[_0x8375('0x1a')]),_0x3bfc1c);agents[_0x8375('0x1c')](_0x3bfc1c);queues[_0x8375('0x1c')](_0x3bfc1c);}catch(_0x4dfdce){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x1d'),_0x3bfc1c[_0x8375('0x1a')]),_0x4dfdce);}});ami['on'](_0x8375('0x1e'),function(_0x2fc8de){try{utils[_0x8375('0x16')](util[_0x8375('0x15')]('[%s][index][agentcomplete]',_0x2fc8de[_0x8375('0x1a')]),_0x2fc8de);agents[_0x8375('0x1e')](_0x2fc8de);queues[_0x8375('0x1e')](_0x2fc8de);members['agentcomplete'](_0x2fc8de);}catch(_0x31f122){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x1f'),_0x2fc8de[_0x8375('0x1a')]),_0x31f122);}});ami['on'](_0x8375('0x20'),function(_0x44947d){try{utils['debug'](util['format'](_0x8375('0x21'),_0x44947d['uniqueid']),_0x44947d);agents[_0x8375('0x20')](_0x44947d);queues[_0x8375('0x20')](_0x44947d);}catch(_0x3a6a88){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x21'),_0x44947d[_0x8375('0x1a')]),_0x3a6a88);}});ami['on'](_0x8375('0x22'),function(_0x50011e){try{utils['debug'](util[_0x8375('0x15')]('[%s][index][queuecallerjoin]',_0x50011e['uniqueid']),_0x50011e);queues['queuecallerjoin'](_0x50011e);recordings[_0x8375('0x22')](_0x50011e);}catch(_0x98f612){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x23'),_0x50011e[_0x8375('0x1a')]),_0x98f612);}});ami['on'](_0x8375('0x24'),function(_0x1d023a){try{utils[_0x8375('0x16')](util[_0x8375('0x15')](_0x8375('0x25'),_0x1d023a[_0x8375('0x1a')]),_0x1d023a);queues[_0x8375('0x24')](_0x1d023a);}catch(_0x11fcf3){utils['error'](util[_0x8375('0x15')](_0x8375('0x25'),_0x1d023a[_0x8375('0x1a')]),_0x11fcf3);}});ami['on'](_0x8375('0x26'),function(_0x115d37){try{utils[_0x8375('0x16')](util['format'](_0x8375('0x27'),_0x115d37['uniqueid']),_0x115d37);queues[_0x8375('0x26')](_0x115d37);calls[_0x8375('0x26')](_0x115d37);}catch(_0x2c318f){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x27'),_0x115d37[_0x8375('0x1a')]),_0x2c318f);}});ami['on'](_0x8375('0x28'),function(_0x8f7083){try{utils[_0x8375('0x16')](util[_0x8375('0x15')](_0x8375('0x29'),_0x8f7083[_0x8375('0x1a')]),_0x8f7083);queues['musiconholdstop'](_0x8f7083);calls['musiconholdstop'](_0x8f7083);}catch(_0x4cd1e4){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x29'),_0x8f7083['uniqueid']),_0x4cd1e4);}});ami['on']('newstate',function(_0x541814){try{utils[_0x8375('0x16')](util[_0x8375('0x15')](_0x8375('0x2a'),_0x541814[_0x8375('0x1a')]),_0x541814);calls[_0x8375('0x2b')](_0x541814);recordings[_0x8375('0x2b')](_0x541814);}catch(_0x2d1635){utils[_0x8375('0xf')](util[_0x8375('0x15')]('[%s][index][newstate]',_0x541814['uniqueid']),_0x2d1635);}});ami['on'](_0x8375('0x2c'),function(_0x15f7e4){try{utils[_0x8375('0x16')](util['format'](_0x8375('0x2d'),_0x15f7e4[_0x8375('0x1a')]),_0x15f7e4);calls['hangup'](_0x15f7e4);recordings[_0x8375('0x2c')](_0x15f7e4);dials[_0x8375('0x2c')](_0x15f7e4);agents['hangup'](_0x15f7e4);queues['hangup'](_0x15f7e4);}catch(_0x3185a1){utils[_0x8375('0xf')](util[_0x8375('0x15')]('[%s][index][hangup]',_0x15f7e4[_0x8375('0x1a')]),_0x3185a1);}});ami['on'](_0x8375('0x2e'),function(_0x350a34){try{utils[_0x8375('0x16')](util[_0x8375('0x15')](_0x8375('0x2f'),_0x350a34[_0x8375('0x1a')]),_0x350a34);members[_0x8375('0x2e')](_0x350a34);}catch(_0x18f415){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x2f'),_0x350a34[_0x8375('0x1a')]),_0x18f415);}});ami['on'](_0x8375('0x30'),function(_0x4917ad){try{utils['debug'](util[_0x8375('0x15')](_0x8375('0x31'),_0x4917ad[_0x8375('0x1a')]),_0x4917ad);queues[_0x8375('0x30')](_0x4917ad);agents[_0x8375('0x30')](_0x4917ad);transfers[_0x8375('0x30')](_0x4917ad);}catch(_0x37f423){utils['error'](util[_0x8375('0x15')]('[%s][index][blindtransfer]',_0x4917ad[_0x8375('0x1a')]),_0x37f423);}});ami['on']('attendedtransfer',function(_0x40f7da){try{utils[_0x8375('0x16')](util[_0x8375('0x15')]('[%s][index][attendedtransfer]',_0x40f7da['origtransfereruniqueid']),_0x40f7da);queues[_0x8375('0x32')](_0x40f7da);transfers[_0x8375('0x32')](_0x40f7da);agents[_0x8375('0x32')](_0x40f7da);calls['attendedtransfer'](_0x40f7da);}catch(_0x22ddb6){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x33'),_0x40f7da[_0x8375('0x34')]),_0x22ddb6);}});ami['on']('varset',function(_0x2059f1){try{utils[_0x8375('0x16')](util['format'](_0x8375('0x35'),_0x2059f1[_0x8375('0x1a')]),_0x2059f1);queues[_0x8375('0x36')](_0x2059f1);recordings[_0x8375('0x36')](_0x2059f1);calls[_0x8375('0x36')](_0x2059f1);dials['varset'](_0x2059f1);}catch(_0x747229){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x35'),_0x2059f1[_0x8375('0x1a')]),_0x747229);}});ami['on'](_0x8375('0x37'),function(_0x43a88e){try{utils['debug'](util[_0x8375('0x15')](_0x8375('0x38'),_0x43a88e[_0x8375('0x1a')]),_0x43a88e);calls[_0x8375('0x37')](_0x43a88e);recordings['newexten'](_0x43a88e);dials[_0x8375('0x37')](_0x43a88e);}catch(_0x59bfc0){utils['error'](util[_0x8375('0x15')](_0x8375('0x38'),_0x43a88e['uniqueid']),_0x59bfc0);}});ami['on'](_0x8375('0x39'),function(_0x5eb39f){try{utils['debug'](util[_0x8375('0x15')](_0x8375('0x3a'),_0x5eb39f[_0x8375('0x1a')]),_0x5eb39f);calls['newchannel'](_0x5eb39f);recordings[_0x8375('0x39')](_0x5eb39f);}catch(_0x18a7d9){utils[_0x8375('0xf')](util[_0x8375('0x15')](_0x8375('0x3a'),_0x5eb39f[_0x8375('0x1a')]),_0x18a7d9);}});ami['on']('dialbegin',function(_0x1b9270){try{utils[_0x8375('0x16')](util['format'](_0x8375('0x3b'),_0x1b9270['uniqueid']),_0x1b9270);dials[_0x8375('0x3c')](_0x1b9270);}catch(_0x5b4cce){utils[_0x8375('0xf')](util[_0x8375('0x15')]('[%s]dialbegin',_0x1b9270[_0x8375('0x1a')]),_0x5b4cce);}});ami['on']('dialend',function(_0x2cefae){try{utils['debug'](util[_0x8375('0x15')](_0x8375('0x3d'),_0x2cefae[_0x8375('0x1a')]),_0x2cefae);dials[_0x8375('0x3e')](_0x2cefae);}catch(_0x577eba){utils[_0x8375('0xf')](util[_0x8375('0x15')]('[%s][index][dialend]',_0x2cefae[_0x8375('0x1a')]),_0x577eba);}});} \ No newline at end of file +var _0xfb19=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','xdr','info','./calls.controller','./recordings.controller','./members.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','format','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','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]','[%s][index][hangup]','hangup','cdr'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfb19,0x145));var _0x9fb1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfb19[_0x321bb2];return _0x9c12ed;};var AsteriskManager=require(_0x9fb1('0x0'));var config=require(_0x9fb1('0x1'));var utils=require('./utils');var util=require(_0x9fb1('0x2'));var ami=new AsteriskManager(config[_0x9fb1('0x3')][_0x9fb1('0x4')],config[_0x9fb1('0x3')]['ip'],config[_0x9fb1('0x3')][_0x9fb1('0x5')],config[_0x9fb1('0x3')][_0x9fb1('0x6')],!![]);ami['keepConnected']();if(config[_0x9fb1('0x7')]&&config['xdr']['disabled']){utils[_0x9fb1('0x8')]('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require(_0x9fb1('0x9'));var queues=require('./queues.controller');var recordings=require(_0x9fb1('0xa'));var members=require(_0x9fb1('0xb'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x9fb1('0xc'));ami['on'](_0x9fb1('0xd'),core[_0x9fb1('0xd')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x9fb1('0xe'),core[_0x9fb1('0xe')]);ami['on'](_0x9fb1('0xf'),core['error']);ami['on'](_0x9fb1('0x10'),core[_0x9fb1('0x10')]);ami['on'](_0x9fb1('0x11'),core[_0x9fb1('0x11')]);ami['on'](_0x9fb1('0x12'),function(_0x2427a3){try{utils['debug'](util['format'](_0x9fb1('0x13'),_0x2427a3['device']),_0x2427a3);members['devicestatechange'](_0x2427a3);}catch(_0x1f49ce){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x13'),_0x2427a3[_0x9fb1('0x15')]),_0x1f49ce);}});ami['on'](_0x9fb1('0x16'),function(_0x2e6095){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x18'),_0x2e6095[_0x9fb1('0x19')]),_0x2e6095);agents[_0x9fb1('0x16')](_0x2e6095);}catch(_0xc3246b){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x18'),_0x2e6095[_0x9fb1('0x19')]),_0xc3246b);}});ami['on'](_0x9fb1('0x1a'),function(_0x363acf){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')]('[%s][index][agentringnoanswer]',_0x363acf[_0x9fb1('0x19')]),_0x363acf);agents['agentringnoanswer'](_0x363acf);}catch(_0x159f0d){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x1b'),_0x363acf[_0x9fb1('0x19')]),_0x159f0d);}});ami['on']('agentconnect',function(_0x22eb5a){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x1c'),_0x22eb5a['uniqueid']),_0x22eb5a);agents[_0x9fb1('0x1d')](_0x22eb5a);queues[_0x9fb1('0x1d')](_0x22eb5a);}catch(_0x4074e6){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')]('[%s][index][agentconnect]',_0x22eb5a[_0x9fb1('0x19')]),_0x4074e6);}});ami['on']('agentcomplete',function(_0x553d62){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x1e'),_0x553d62[_0x9fb1('0x19')]),_0x553d62);agents[_0x9fb1('0x1f')](_0x553d62);queues[_0x9fb1('0x1f')](_0x553d62);members['agentcomplete'](_0x553d62);}catch(_0x4a0977){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x1e'),_0x553d62[_0x9fb1('0x19')]),_0x4a0977);}});ami['on'](_0x9fb1('0x20'),function(_0x1c0a52){try{utils['debug'](util['format'](_0x9fb1('0x21'),_0x1c0a52[_0x9fb1('0x19')]),_0x1c0a52);agents[_0x9fb1('0x20')](_0x1c0a52);queues[_0x9fb1('0x20')](_0x1c0a52);}catch(_0x2895a4){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')]('[%s][index][queuecallerabandon]',_0x1c0a52[_0x9fb1('0x19')]),_0x2895a4);}});ami['on'](_0x9fb1('0x22'),function(_0x4d828e){try{utils[_0x9fb1('0x17')](util['format'](_0x9fb1('0x23'),_0x4d828e[_0x9fb1('0x19')]),_0x4d828e);queues[_0x9fb1('0x22')](_0x4d828e);recordings[_0x9fb1('0x22')](_0x4d828e);}catch(_0x232e88){utils[_0x9fb1('0xf')](util['format'](_0x9fb1('0x23'),_0x4d828e[_0x9fb1('0x19')]),_0x232e88);}});ami['on'](_0x9fb1('0x24'),function(_0x2e1b59){try{utils['debug'](util[_0x9fb1('0x14')](_0x9fb1('0x25'),_0x2e1b59[_0x9fb1('0x19')]),_0x2e1b59);queues[_0x9fb1('0x24')](_0x2e1b59);}catch(_0x382cfa){utils[_0x9fb1('0xf')](util['format'](_0x9fb1('0x25'),_0x2e1b59[_0x9fb1('0x19')]),_0x382cfa);}});ami['on'](_0x9fb1('0x26'),function(_0x796982){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x27'),_0x796982['uniqueid']),_0x796982);queues[_0x9fb1('0x26')](_0x796982);calls[_0x9fb1('0x26')](_0x796982);}catch(_0x3df2da){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x27'),_0x796982[_0x9fb1('0x19')]),_0x3df2da);}});ami['on'](_0x9fb1('0x28'),function(_0x51fb2c){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x29'),_0x51fb2c['uniqueid']),_0x51fb2c);queues[_0x9fb1('0x28')](_0x51fb2c);calls[_0x9fb1('0x28')](_0x51fb2c);}catch(_0x11acaf){utils['error'](util['format'](_0x9fb1('0x29'),_0x51fb2c['uniqueid']),_0x11acaf);}});ami['on'](_0x9fb1('0x2a'),function(_0x299014){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x2b'),_0x299014[_0x9fb1('0x19')]),_0x299014);calls['newstate'](_0x299014);recordings[_0x9fb1('0x2a')](_0x299014);}catch(_0x6e1a8){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')]('[%s][index][newstate]',_0x299014[_0x9fb1('0x19')]),_0x6e1a8);}});ami['on']('hangup',function(_0x8ad70){try{utils[_0x9fb1('0x17')](util['format'](_0x9fb1('0x2c'),_0x8ad70[_0x9fb1('0x19')]),_0x8ad70);calls['hangup'](_0x8ad70);recordings['hangup'](_0x8ad70);dials[_0x9fb1('0x2d')](_0x8ad70);agents[_0x9fb1('0x2d')](_0x8ad70);queues[_0x9fb1('0x2d')](_0x8ad70);}catch(_0x170534){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x2c'),_0x8ad70[_0x9fb1('0x19')]),_0x170534);}});ami['on'](_0x9fb1('0x2e'),function(_0x4684d8){try{utils['debug'](util[_0x9fb1('0x14')](_0x9fb1('0x2f'),_0x4684d8[_0x9fb1('0x19')]),_0x4684d8);members[_0x9fb1('0x2e')](_0x4684d8);}catch(_0x4d970e){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x2f'),_0x4684d8[_0x9fb1('0x19')]),_0x4d970e);}});ami['on'](_0x9fb1('0x30'),function(_0x10b2a9){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x31'),_0x10b2a9[_0x9fb1('0x19')]),_0x10b2a9);queues[_0x9fb1('0x30')](_0x10b2a9);agents[_0x9fb1('0x30')](_0x10b2a9);transfers[_0x9fb1('0x30')](_0x10b2a9);}catch(_0x133a5d){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')]('[%s][index][blindtransfer]',_0x10b2a9[_0x9fb1('0x19')]),_0x133a5d);}});ami['on'](_0x9fb1('0x32'),function(_0x1684cf){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')]('[%s][index][attendedtransfer]',_0x1684cf[_0x9fb1('0x33')]),_0x1684cf);queues[_0x9fb1('0x32')](_0x1684cf);transfers['attendedtransfer'](_0x1684cf);agents[_0x9fb1('0x32')](_0x1684cf);calls[_0x9fb1('0x32')](_0x1684cf);}catch(_0x23bba7){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x34'),_0x1684cf[_0x9fb1('0x33')]),_0x23bba7);}});ami['on'](_0x9fb1('0x35'),function(_0x35137f){try{utils['debug'](util[_0x9fb1('0x14')](_0x9fb1('0x36'),_0x35137f[_0x9fb1('0x19')]),_0x35137f);queues[_0x9fb1('0x35')](_0x35137f);recordings['varset'](_0x35137f);calls[_0x9fb1('0x35')](_0x35137f);dials[_0x9fb1('0x35')](_0x35137f);}catch(_0x4a3a75){utils['error'](util[_0x9fb1('0x14')]('[%s][index][varset]',_0x35137f[_0x9fb1('0x19')]),_0x4a3a75);}});ami['on'](_0x9fb1('0x37'),function(_0x3293e4){try{utils[_0x9fb1('0x17')](util['format']('[%s][index][newexten]',_0x3293e4['uniqueid']),_0x3293e4);calls[_0x9fb1('0x37')](_0x3293e4);recordings[_0x9fb1('0x37')](_0x3293e4);dials[_0x9fb1('0x37')](_0x3293e4);}catch(_0x4b95ac){utils['error'](util[_0x9fb1('0x14')](_0x9fb1('0x38'),_0x3293e4[_0x9fb1('0x19')]),_0x4b95ac);}});ami['on']('newchannel',function(_0x279372){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x39'),_0x279372[_0x9fb1('0x19')]),_0x279372);calls[_0x9fb1('0x3a')](_0x279372);recordings[_0x9fb1('0x3a')](_0x279372);}catch(_0x1eb4f6){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x39'),_0x279372[_0x9fb1('0x19')]),_0x1eb4f6);}});ami['on']('dialbegin',function(_0x30c95d){try{utils[_0x9fb1('0x17')](util['format']('[%s][index][dialbegin]',_0x30c95d['uniqueid']),_0x30c95d);dials['dialbegin'](_0x30c95d);}catch(_0x3f3694){utils[_0x9fb1('0xf')](util[_0x9fb1('0x14')](_0x9fb1('0x3b'),_0x30c95d[_0x9fb1('0x19')]),_0x3f3694);}});ami['on'](_0x9fb1('0x3c'),function(_0x4de51b){try{utils[_0x9fb1('0x17')](util[_0x9fb1('0x14')](_0x9fb1('0x3d'),_0x4de51b[_0x9fb1('0x19')]),_0x4de51b);dials[_0x9fb1('0x3c')](_0x4de51b);}catch(_0x5cfc68){utils['error'](util[_0x9fb1('0x14')]('[%s][index][dialend]',_0x4de51b[_0x9fb1('0x19')]),_0x5cfc68);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a971deb..80b990f 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 _0x4b0c=['lodash','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','membername','name','internal','request','CreateMemberReport','getUserByName','split','then','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][agentcomplete]','[%s][members][cdr]','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x4b0c,0x138));var _0xc4b0=function(_0x2a2317,_0x1fb4cc){_0x2a2317=_0x2a2317-0x0;var _0x48c8fc=_0x4b0c[_0x2a2317];return _0x48c8fc;};'use strict';var _=require(_0xc4b0('0x0'));var util=require('util');var utils=require(_0xc4b0('0x1'));var members={};var exclude=[_0xc4b0('0x2'),'Queue:'];function writeDB(_0x1f7ea5){utils[_0xc4b0('0x3')](util[_0xc4b0('0x4')](_0xc4b0('0x5'),_0x1f7ea5[_0xc4b0('0x6')],_0x1f7ea5[_0xc4b0('0x7')],_0x1f7ea5[_0xc4b0('0x8')],_0x1f7ea5[_0xc4b0('0x9')],_0x1f7ea5['membername'],_0x1f7ea5[_0xc4b0('0xa')]));if(_0x1f7ea5[_0xc4b0('0x7')]){utils[_0xc4b0('0xb')](_0x1f7ea5[_0xc4b0('0x7')])['then'](function(_0x326949){if(_0x326949){_0x1f7ea5[_0xc4b0('0xc')]=_0x326949[_0xc4b0('0xd')];_0x1f7ea5[_0xc4b0('0xe')]=_0x326949[_0xc4b0('0xe')];utils[_0xc4b0('0xf')](_0xc4b0('0x10'),_0x1f7ea5);}else{utils[_0xc4b0('0x11')](_0x1f7ea5[_0xc4b0('0x7')][_0xc4b0('0x12')]('/')[0x1])[_0xc4b0('0x13')](function(_0x517cbd){if(_0x517cbd){_0x1f7ea5[_0xc4b0('0xc')]=_0x517cbd['name'];_0x1f7ea5['internal']=_0x517cbd['internal'];utils['request'](_0xc4b0('0x10'),_0x1f7ea5);}});}})['catch'](function(_0xc464dd){utils[_0xc4b0('0x14')](util['format'](_0xc4b0('0x15'),_0x1f7ea5['uniqueid']),_0xc464dd);});}delete members[_0x1f7ea5[_0xc4b0('0x7')]];}function startsWith(_0x5ea045,_0x3476e0){return _[_0xc4b0('0x16')](_0x5ea045,function(_0x153ef1){return _[_0xc4b0('0x17')](_0x3476e0,_0x153ef1);});}exports['devicestatechange']=function(_0x19aaad){try{utils[_0xc4b0('0x18')](util[_0xc4b0('0x4')](_0xc4b0('0x19'),members[_0x19aaad[_0xc4b0('0x1a')]]?members[_0x19aaad[_0xc4b0('0x1a')]][_0xc4b0('0x6')]:_0x19aaad['device']),_0x19aaad);utils['info'](util[_0xc4b0('0x4')](_0xc4b0('0x1b'),members[_0x19aaad[_0xc4b0('0x1a')]]?members[_0x19aaad['device']][_0xc4b0('0x6')]:_0x19aaad[_0xc4b0('0x1a')],_0x19aaad['state'],_0x19aaad[_0xc4b0('0x1a')]));switch(_0x19aaad[_0xc4b0('0x1c')]){case'INUSE':case _0xc4b0('0x1d'):if(!startsWith(exclude,_0x19aaad[_0xc4b0('0x1a')])){members[_0x19aaad[_0xc4b0('0x1a')]]={'channel':_0xc4b0('0x1e'),'interface':_0x19aaad[_0xc4b0('0x1a')],'type':_0xc4b0('0x1f'),'enterAt':utils['now'](),'role':_0xc4b0('0x20')};}break;case _0xc4b0('0x21'):if(!_[_0xc4b0('0x22')](members[_0x19aaad['device']])){members[_0x19aaad[_0xc4b0('0x1a')]][_0xc4b0('0x23')]=utils[_0xc4b0('0x24')]();members[_0x19aaad[_0xc4b0('0x1a')]][_0xc4b0('0x25')]=utils[_0xc4b0('0x26')](members[_0x19aaad[_0xc4b0('0x1a')]][_0xc4b0('0x23')],members[_0x19aaad[_0xc4b0('0x1a')]][_0xc4b0('0x27')]);if(members[_0x19aaad[_0xc4b0('0x1a')]][_0xc4b0('0x6')]){writeDB(members[_0x19aaad[_0xc4b0('0x1a')]]);}}break;default:break;}}catch(_0x4a02d5){utils[_0xc4b0('0x14')](util[_0xc4b0('0x4')](_0xc4b0('0x19'),members[_0x19aaad[_0xc4b0('0x1a')]]?members[_0x19aaad[_0xc4b0('0x1a')]][_0xc4b0('0x6')]:_0x19aaad[_0xc4b0('0x1a')]),_0x4a02d5);}};exports[_0xc4b0('0x28')]=function(_0x1b1228){try{if(!_[_0xc4b0('0x22')](members[_0x1b1228[_0xc4b0('0x7')]])){utils[_0xc4b0('0x18')](util[_0xc4b0('0x4')]('[%s][members][agentcomplete]',_0x1b1228[_0xc4b0('0x6')]),_0x1b1228);utils[_0xc4b0('0x3')](util['format'](_0xc4b0('0x29'),_0x1b1228[_0xc4b0('0x6')],_0x1b1228['interface'],_0x1b1228['queue']));members[_0x1b1228[_0xc4b0('0x7')]]=_[_0xc4b0('0x2a')](members[_0x1b1228[_0xc4b0('0x7')]],{'data4':_0x1b1228[_0xc4b0('0x2b')],'uniqueid':_0x1b1228[_0xc4b0('0x6')]});}}catch(_0x5cba47){utils[_0xc4b0('0x14')](util['format'](_0xc4b0('0x2c'),_0x1b1228[_0xc4b0('0x6')]),_0x5cba47);}};exports['cdr']=function(_0x2d002d){try{utils[_0xc4b0('0x18')](util[_0xc4b0('0x4')](_0xc4b0('0x2d'),_0x2d002d[_0xc4b0('0x6')]),_0x2d002d);if(_0x2d002d[_0xc4b0('0x8')]){var _0x580c5c=_0x2d002d[_0xc4b0('0x8')][_0xc4b0('0x12')]('-')[0x0];if(!_[_0xc4b0('0x22')](members[_0x580c5c])){members[_0x580c5c]=_[_0xc4b0('0x2a')](members[_0x580c5c],{'data1':members[_0x580c5c][_0xc4b0('0x2e')]||_0x2d002d[_0xc4b0('0xa')],'data2':members[_0x580c5c]['data2']||_0x2d002d[_0xc4b0('0x2f')],'data3':members[_0x580c5c][_0xc4b0('0x30')]||_0x2d002d['destination'],'uniqueid':members[_0x580c5c][_0xc4b0('0x6')]||_0x2d002d['uniqueid']});utils[_0xc4b0('0x3')](util[_0xc4b0('0x4')](_0xc4b0('0x31'),_0x2d002d[_0xc4b0('0x6')],members[_0x580c5c][_0xc4b0('0x2e')],members[_0x580c5c][_0xc4b0('0x9')],members[_0x580c5c][_0xc4b0('0x30')]));if(members[_0x580c5c][_0xc4b0('0x23')]){writeDB(members[_0x580c5c]);}}}if(_0x2d002d[_0xc4b0('0x32')]){var _0x4d809f=_0x2d002d['destinationchannel'][_0xc4b0('0x12')]('-')[0x0];if(!_[_0xc4b0('0x22')](members[_0x4d809f])){members[_0x4d809f]=_[_0xc4b0('0x2a')](members[_0x4d809f],{'data1':members[_0x4d809f][_0xc4b0('0x2e')]||_0x2d002d[_0xc4b0('0xa')],'data2':members[_0x4d809f][_0xc4b0('0x9')]||_0x2d002d[_0xc4b0('0x2f')],'data3':members[_0x4d809f][_0xc4b0('0x30')]||_0x2d002d[_0xc4b0('0x33')],'uniqueid':members[_0x4d809f][_0xc4b0('0x6')]||_0x2d002d[_0xc4b0('0x6')]});utils[_0xc4b0('0x3')](util['format'](_0xc4b0('0x31'),_0x2d002d[_0xc4b0('0x6')],members[_0x4d809f][_0xc4b0('0x2e')],members[_0x4d809f]['data2'],members[_0x4d809f][_0xc4b0('0x30')]));if(members[_0x4d809f][_0xc4b0('0x23')]){writeDB(members[_0x4d809f]);}}}}catch(_0x52b41b){utils[_0xc4b0('0x14')](util['format']('[%s][members][cdr]',_0x2d002d[_0xc4b0('0x6')]),_0x52b41b);}}; \ No newline at end of file +var _0x94c6=['lodash','util','./utils','Local/_attended@transfer','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','name','internal','request','CreateMemberReport','split','then','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','source','destination','data1','data3','destinationchannel'];(function(_0x2a2edf,_0xea1812){var _0x58ca5e=function(_0x1ab49e){while(--_0x1ab49e){_0x2a2edf['push'](_0x2a2edf['shift']());}};_0x58ca5e(++_0xea1812);}(_0x94c6,0xa2));var _0x694c=function(_0x3a0c6b,_0x41ae2a){_0x3a0c6b=_0x3a0c6b-0x0;var _0x56f4fc=_0x94c6[_0x3a0c6b];return _0x56f4fc;};'use strict';var _=require(_0x694c('0x0'));var util=require(_0x694c('0x1'));var utils=require(_0x694c('0x2'));var members={};var exclude=[_0x694c('0x3'),_0x694c('0x4')];function writeDB(_0x205d39){utils['info'](util['format'](_0x694c('0x5'),_0x205d39['uniqueid'],_0x205d39[_0x694c('0x6')],_0x205d39[_0x694c('0x7')],_0x205d39[_0x694c('0x8')],_0x205d39[_0x694c('0x9')],_0x205d39[_0x694c('0xa')]));if(_0x205d39[_0x694c('0x6')]){utils['getUserByInterface'](_0x205d39[_0x694c('0x6')])['then'](function(_0x1921c9){if(_0x1921c9){_0x205d39[_0x694c('0x9')]=_0x1921c9[_0x694c('0xb')];_0x205d39['internal']=_0x1921c9[_0x694c('0xc')];utils[_0x694c('0xd')](_0x694c('0xe'),_0x205d39);}else{utils['getUserByName'](_0x205d39[_0x694c('0x6')][_0x694c('0xf')]('/')[0x1])[_0x694c('0x10')](function(_0x12caec){if(_0x12caec){_0x205d39[_0x694c('0x9')]=_0x12caec[_0x694c('0xb')];_0x205d39[_0x694c('0xc')]=_0x12caec[_0x694c('0xc')];utils[_0x694c('0xd')](_0x694c('0xe'),_0x205d39);}});}})[_0x694c('0x11')](function(_0xc7cc8d){utils[_0x694c('0x12')](util[_0x694c('0x13')](_0x694c('0x14'),_0x205d39['uniqueid']),_0xc7cc8d);});}delete members[_0x205d39[_0x694c('0x6')]];}function startsWith(_0x337862,_0x4ab8d0){return _[_0x694c('0x15')](_0x337862,function(_0x5036cc){return _[_0x694c('0x16')](_0x4ab8d0,_0x5036cc);});}exports[_0x694c('0x17')]=function(_0x3f8e89){try{utils[_0x694c('0x18')](util[_0x694c('0x13')](_0x694c('0x19'),members[_0x3f8e89['device']]?members[_0x3f8e89[_0x694c('0x1a')]][_0x694c('0x1b')]:_0x3f8e89[_0x694c('0x1a')]),_0x3f8e89);utils[_0x694c('0x1c')](util['format'](_0x694c('0x1d'),members[_0x3f8e89[_0x694c('0x1a')]]?members[_0x3f8e89[_0x694c('0x1a')]][_0x694c('0x1b')]:_0x3f8e89[_0x694c('0x1a')],_0x3f8e89['state'],_0x3f8e89[_0x694c('0x1a')]));switch(_0x3f8e89[_0x694c('0x1e')]){case _0x694c('0x1f'):case _0x694c('0x20'):if(!startsWith(exclude,_0x3f8e89[_0x694c('0x1a')])){members[_0x3f8e89['device']]={'channel':_0x694c('0x21'),'interface':_0x3f8e89[_0x694c('0x1a')],'type':_0x694c('0x22'),'enterAt':utils[_0x694c('0x23')](),'role':_0x694c('0x24')};}break;case _0x694c('0x25'):if(!_[_0x694c('0x26')](members[_0x3f8e89[_0x694c('0x1a')]])){members[_0x3f8e89['device']][_0x694c('0x27')]=utils[_0x694c('0x23')]();members[_0x3f8e89[_0x694c('0x1a')]][_0x694c('0x28')]=utils[_0x694c('0x29')](members[_0x3f8e89[_0x694c('0x1a')]][_0x694c('0x27')],members[_0x3f8e89[_0x694c('0x1a')]]['enterAt']);if(members[_0x3f8e89['device']]['uniqueid']){writeDB(members[_0x3f8e89[_0x694c('0x1a')]]);}}break;default:break;}}catch(_0xcc0f44){utils['error'](util[_0x694c('0x13')](_0x694c('0x19'),members[_0x3f8e89['device']]?members[_0x3f8e89[_0x694c('0x1a')]][_0x694c('0x1b')]:_0x3f8e89['device']),_0xcc0f44);}};exports[_0x694c('0x2a')]=function(_0x37239e){try{if(!_['isNil'](members[_0x37239e['interface']])){utils['debug'](util['format'](_0x694c('0x2b'),_0x37239e[_0x694c('0x1b')]),_0x37239e);utils['info'](util[_0x694c('0x13')](_0x694c('0x2c'),_0x37239e['uniqueid'],_0x37239e[_0x694c('0x6')],_0x37239e[_0x694c('0x2d')]));members[_0x37239e[_0x694c('0x6')]]=_['assign'](members[_0x37239e[_0x694c('0x6')]],{'data4':_0x37239e[_0x694c('0x2d')],'uniqueid':_0x37239e['uniqueid']});}}catch(_0x46fc5b){utils[_0x694c('0x12')](util['format'](_0x694c('0x2b'),_0x37239e['uniqueid']),_0x46fc5b);}};exports[_0x694c('0x2e')]=function(_0xb56830){try{utils[_0x694c('0x18')](util[_0x694c('0x13')](_0x694c('0x2f'),_0xb56830[_0x694c('0x1b')]),_0xb56830);if(_0xb56830[_0x694c('0x7')]){var _0x286f0f=_0xb56830[_0x694c('0x7')]['split']('-')[0x0];if(!_[_0x694c('0x26')](members[_0x286f0f])){members[_0x286f0f]=_[_0x694c('0x30')](members[_0x286f0f],{'data1':members[_0x286f0f]['data1']||_0xb56830[_0x694c('0xa')],'data2':members[_0x286f0f][_0x694c('0x8')]||_0xb56830[_0x694c('0x31')],'data3':members[_0x286f0f]['data3']||_0xb56830[_0x694c('0x32')],'uniqueid':members[_0x286f0f][_0x694c('0x1b')]||_0xb56830[_0x694c('0x1b')]});utils[_0x694c('0x1c')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xb56830['uniqueid'],members[_0x286f0f][_0x694c('0x33')],members[_0x286f0f][_0x694c('0x8')],members[_0x286f0f][_0x694c('0x34')]));if(members[_0x286f0f][_0x694c('0x27')]){writeDB(members[_0x286f0f]);}}}if(_0xb56830[_0x694c('0x35')]){var _0x3f1a14=_0xb56830[_0x694c('0x35')]['split']('-')[0x0];if(!_[_0x694c('0x26')](members[_0x3f1a14])){members[_0x3f1a14]=_[_0x694c('0x30')](members[_0x3f1a14],{'data1':members[_0x3f1a14][_0x694c('0x33')]||_0xb56830[_0x694c('0xa')],'data2':members[_0x3f1a14][_0x694c('0x8')]||_0xb56830['source'],'data3':members[_0x3f1a14][_0x694c('0x34')]||_0xb56830['destination'],'uniqueid':members[_0x3f1a14][_0x694c('0x1b')]||_0xb56830[_0x694c('0x1b')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xb56830['uniqueid'],members[_0x3f1a14]['data1'],members[_0x3f1a14]['data2'],members[_0x3f1a14]['data3']));if(members[_0x3f1a14][_0x694c('0x27')]){writeDB(members[_0x3f1a14]);}}}}catch(_0x4e396c){utils[_0x694c('0x12')](util[_0x694c('0x13')](_0x694c('0x2f'),_0xb56830[_0x694c('0x1b')]),_0x4e396c);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index bc3096d..41fb92e 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 _0xa925=['connectedlinenum','connectedlinename','queuecallerjoinAt','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','holdtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','calleridnum','accountcode','queuecallerexitreason','queue','then','type','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','uniqueid','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','value','CONTINUE','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s'];(function(_0x5292d2,_0x13aa6c){var _0x1eb1c5=function(_0x5dc369){while(--_0x5dc369){_0x5292d2['push'](_0x5292d2['shift']());}};_0x1eb1c5(++_0x13aa6c);}(_0xa925,0x158));var _0x5a92=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xa925[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x5a92('0x0'));var queues={};function writeDB(_0x1e3015){utils[_0x5a92('0x1')](util[_0x5a92('0x2')](_0x5a92('0x3'),_0x1e3015['uniqueid'],_0x1e3015['channel'],_0x1e3015['queue'],_0x1e3015['lastAssignedTo'],_0x1e3015[_0x5a92('0x4')],_0x1e3015[_0x5a92('0x5')],_0x1e3015[_0x5a92('0x6')]));if(_0x1e3015[_0x5a92('0x7')]){utils['getVoiceQueueByName'](_0x1e3015['queue'])[_0x5a92('0x8')](function(_0x3d4e84){if(_0x3d4e84){_0x1e3015['type']=_0x3d4e84[_0x5a92('0x9')];}utils['request'](_0x5a92('0xa'),_0x1e3015);});}else{utils['request'](_0x5a92('0xa'),_0x1e3015);}if(_0x1e3015['transfereduniqueid']){delete queues[_0x1e3015[_0x5a92('0xb')]];}else{delete queues[_0x1e3015['uniqueid']];}}exports['queuecallerjoin']=function(_0x5b85f3){try{utils[_0x5a92('0xc')](util[_0x5a92('0x2')]('[%s][queues][queuecallerjoin]',_0x5b85f3['uniqueid']),_0x5b85f3);utils[_0x5a92('0x1')](util[_0x5a92('0x2')](_0x5a92('0xd'),_0x5b85f3[_0x5a92('0xe')],_0x5b85f3['queue'],_0x5b85f3[_0x5a92('0xf')]));queues[_0x5b85f3[_0x5a92('0xe')]]=_[_0x5a92('0x10')](_0x5b85f3,{'originalposition':_0x5b85f3[_0x5a92('0xf')],'queuecallerjoinAt':utils[_0x5a92('0x11')](),'mohtime':0x0});}catch(_0x3588f9){utils[_0x5a92('0x12')](util[_0x5a92('0x2')](_0x5a92('0x13'),_0x5b85f3[_0x5a92('0xe')]),_0x3588f9);}};exports['hangup']=function(_0x69a1ef){try{if(!_[_0x5a92('0x14')](queues[_0x69a1ef[_0x5a92('0xe')]])){utils[_0x5a92('0xc')](util[_0x5a92('0x2')]('[%s][queues][hangup]',_0x69a1ef[_0x5a92('0xe')]),_0x69a1ef);if(queues[_0x69a1ef['uniqueid']][_0x5a92('0x15')]){if(!queues[_0x69a1ef[_0x5a92('0xe')]][_0x5a92('0x16')]&&!queues[_0x69a1ef[_0x5a92('0xe')]]['queuecallerexit']){queues[_0x69a1ef['uniqueid']][_0x5a92('0x17')]=!![];queues[_0x69a1ef['uniqueid']][_0x5a92('0x18')]=utils[_0x5a92('0x11')]();queues[_0x69a1ef[_0x5a92('0xe')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x5a92('0x1')](util[_0x5a92('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x69a1ef[_0x5a92('0xe')],queues[_0x69a1ef[_0x5a92('0xe')]][_0x5a92('0x19')],queues[_0x69a1ef['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x69a1ef['uniqueid']]);}else if(queues[_0x69a1ef[_0x5a92('0xe')]][_0x5a92('0xb')]){utils['info'](util['format'](_0x5a92('0x1a'),_0x69a1ef[_0x5a92('0xe')],queues[_0x69a1ef[_0x5a92('0xe')]]['name'],queues[_0x69a1ef[_0x5a92('0xe')]][_0x5a92('0xb')]));queues[queues[_0x69a1ef[_0x5a92('0xe')]][_0x5a92('0xb')]]=queues[_0x69a1ef[_0x5a92('0xe')]];queues[queues[_0x69a1ef[_0x5a92('0xe')]][_0x5a92('0xb')]][_0x5a92('0x1b')]=0x2;delete queues[_0x69a1ef[_0x5a92('0xe')]];}}}catch(_0x3cd954){utils[_0x5a92('0x12')](util[_0x5a92('0x2')](_0x5a92('0x1c'),_0x69a1ef[_0x5a92('0xe')]),_0x3cd954);}};exports[_0x5a92('0x1d')]=function(_0x711335){try{utils['debug'](util[_0x5a92('0x2')](_0x5a92('0x1e'),_0x711335[_0x5a92('0xe')]),_0x711335);if(!_[_0x5a92('0x14')](_0x711335[_0x5a92('0x1f')]['queuestatus'])&&_0x711335[_0x5a92('0x20')]['toUpperCase']()!==_0x5a92('0x21')){if(!_[_0x5a92('0x14')](queues[_0x711335['uniqueid']])){queues[_0x711335['uniqueid']][_0x5a92('0x16')]=![];queues[_0x711335[_0x5a92('0xe')]]['queuecallerabandonAt']=null;queues[_0x711335[_0x5a92('0xe')]][_0x5a92('0x22')]=!![];queues[_0x711335[_0x5a92('0xe')]][_0x5a92('0x23')]=utils[_0x5a92('0x11')]();queues[_0x711335['uniqueid']][_0x5a92('0x6')]=_0x711335[_0x5a92('0x20')][_0x5a92('0x24')]();utils['info'](util[_0x5a92('0x2')](_0x5a92('0x25'),_0x711335[_0x5a92('0xe')],queues[_0x711335['uniqueid']][_0x5a92('0x19')],_0x711335[_0x5a92('0x20')],queues[_0x711335[_0x5a92('0xe')]][_0x5a92('0x6')]));writeDB(queues[_0x711335['uniqueid']]);}}else if(!_[_0x5a92('0x14')](_0x711335[_0x5a92('0x1f')][_0x5a92('0x26')])){if(!_[_0x5a92('0x14')](queues[_0x711335[_0x5a92('0xe')]])&&!queues[_0x711335[_0x5a92('0xe')]][_0x5a92('0x16')]){queues[_0x711335['uniqueid']][_0x5a92('0x16')]=![];queues[_0x711335[_0x5a92('0xe')]][_0x5a92('0x27')]=null;queues[_0x711335[_0x5a92('0xe')]]['queuecallerexit']=!![];queues[_0x711335[_0x5a92('0xe')]][_0x5a92('0x23')]=utils[_0x5a92('0x11')]();queues[_0x711335[_0x5a92('0xe')]][_0x5a92('0x6')]=_0x5a92('0x28');utils[_0x5a92('0x1')](util[_0x5a92('0x2')](_0x5a92('0x29'),_0x711335['uniqueid'],queues[_0x711335['uniqueid']][_0x5a92('0x19')],_0x711335[_0x5a92('0x20')],queues[_0x711335[_0x5a92('0xe')]]['queuecallerexitreason']));}}}catch(_0xd3ccb1){utils['error'](util['format'](_0x5a92('0x1e'),_0x711335[_0x5a92('0xe')]),_0xd3ccb1);}};exports[_0x5a92('0x16')]=function(_0x103f3b){try{if(!_['isNil'](queues[_0x103f3b['uniqueid']])){utils[_0x5a92('0xc')](util[_0x5a92('0x2')](_0x5a92('0x2a'),_0x103f3b[_0x5a92('0xe')]),_0x103f3b);queues[_0x103f3b['uniqueid']][_0x5a92('0x22')]=![];queues[_0x103f3b[_0x5a92('0xe')]][_0x5a92('0x23')]=null;queues[_0x103f3b['uniqueid']][_0x5a92('0x16')]=!![];queues[_0x103f3b['uniqueid']][_0x5a92('0x27')]=utils[_0x5a92('0x11')]();queues[_0x103f3b['uniqueid']][_0x5a92('0x6')]=_0x5a92('0x2b');utils[_0x5a92('0x1')](util['format'](_0x5a92('0x2c'),_0x103f3b['uniqueid'],queues[_0x103f3b[_0x5a92('0xe')]]['name'],queues[_0x103f3b['uniqueid']][_0x5a92('0x6')]));}}catch(_0x153072){utils[_0x5a92('0x12')](util[_0x5a92('0x2')](_0x5a92('0x2a'),_0x103f3b[_0x5a92('0xe')]),_0x153072);}};exports[_0x5a92('0x2d')]=function(_0x1c4b71){try{if(!_[_0x5a92('0x14')](queues[_0x1c4b71[_0x5a92('0xe')]])){utils[_0x5a92('0xc')](util['format'](_0x5a92('0x2e'),_0x1c4b71[_0x5a92('0xe')]),_0x1c4b71);utils[_0x5a92('0x1')](util[_0x5a92('0x2')](_0x5a92('0x2f'),_0x1c4b71[_0x5a92('0xe')],queues[_0x1c4b71[_0x5a92('0xe')]][_0x5a92('0x19')],_0x1c4b71[_0x5a92('0x30')],_0x1c4b71[_0x5a92('0x31')]));queues[_0x1c4b71['uniqueid']][_0x5a92('0x2d')]=!![];queues[_0x1c4b71[_0x5a92('0xe')]][_0x5a92('0x15')]=utils[_0x5a92('0x11')]();queues[_0x1c4b71[_0x5a92('0xe')]]['holdtime']=utils['diffTime'](queues[_0x1c4b71[_0x5a92('0xe')]][_0x5a92('0x15')],queues[_0x1c4b71[_0x5a92('0xe')]][_0x5a92('0x32')]);queues[_0x1c4b71[_0x5a92('0xe')]][_0x5a92('0xf')]=_0x1c4b71[_0x5a92('0xf')];queues[_0x1c4b71[_0x5a92('0xe')]]['count']=_0x1c4b71['count'];queues[_0x1c4b71[_0x5a92('0xe')]][_0x5a92('0x30')]=_0x1c4b71[_0x5a92('0x30')];queues[_0x1c4b71['uniqueid']]['connectedlinename']=_0x1c4b71[_0x5a92('0x31')];}}catch(_0x2f0522){utils[_0x5a92('0x12')](util[_0x5a92('0x2')](_0x5a92('0x2e'),_0x1c4b71['uniqueid']),_0x2f0522);}};exports[_0x5a92('0x33')]=function(_0x19eb4e){try{if(!_['isNil'](queues[_0x19eb4e[_0x5a92('0xe')]])){utils[_0x5a92('0xc')](util[_0x5a92('0x2')](_0x5a92('0x34'),_0x19eb4e[_0x5a92('0xe')]),_0x19eb4e);utils['info'](util[_0x5a92('0x2')](_0x5a92('0x35'),_0x19eb4e[_0x5a92('0xe')],queues[_0x19eb4e[_0x5a92('0xe')]][_0x5a92('0x19')],_0x19eb4e[_0x5a92('0x36')],_0x19eb4e[_0x5a92('0x37')]));queues[_0x19eb4e[_0x5a92('0xe')]][_0x5a92('0x16')]=![];queues[_0x19eb4e[_0x5a92('0xe')]][_0x5a92('0x16')]=![];queues[_0x19eb4e[_0x5a92('0xe')]][_0x5a92('0x27')]=null;queues[_0x19eb4e['uniqueid']]['queuecallerexit']=![];queues[_0x19eb4e[_0x5a92('0xe')]][_0x5a92('0x6')]=null;queues[_0x19eb4e[_0x5a92('0xe')]]['queuecallerexitAt']=null;queues[_0x19eb4e['uniqueid']]['assigned']=!![];queues[_0x19eb4e[_0x5a92('0xe')]]['accountcode']=_0x19eb4e[_0x5a92('0x37')];queues[_0x19eb4e[_0x5a92('0xe')]][_0x5a92('0x38')]=_0x19eb4e['membername'];}}catch(_0x283c72){utils[_0x5a92('0x12')](util[_0x5a92('0x2')](_0x5a92('0x34'),_0x19eb4e[_0x5a92('0xe')]),_0x283c72);}};exports[_0x5a92('0x39')]=function(_0xf4a311){try{if(!_[_0x5a92('0x14')](queues[_0xf4a311[_0x5a92('0xe')]])){if(queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x15')]){utils[_0x5a92('0xc')](util[_0x5a92('0x2')](_0x5a92('0x3a'),_0xf4a311['uniqueid']),_0xf4a311);queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x16')]=![];queues[_0xf4a311['uniqueid']][_0x5a92('0x16')]=![];queues[_0xf4a311[_0x5a92('0xe')]]['queuecallerabandonAt']=null;queues[_0xf4a311[_0x5a92('0xe')]]['queuecallerexit']=![];queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x23')]=null;queues[_0xf4a311['uniqueid']][_0x5a92('0x3b')]=!![];queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x38')]=_0xf4a311[_0x5a92('0x36')];queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x17')]=!![];queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x18')]=utils[_0x5a92('0x11')]();if(_0xf4a311[_0x5a92('0x3c')]==_0x5a92('0x3d')){if(!queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x3d')]){queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x6')]=_0x5a92('0x3e');}}else{queues[_0xf4a311[_0x5a92('0xe')]]['queuecallerexitreason']=_0x5a92('0x3f')+_0xf4a311[_0x5a92('0x3c')][_0x5a92('0x24')]();}utils[_0x5a92('0x1')](util[_0x5a92('0x2')](_0x5a92('0x40'),_0xf4a311[_0x5a92('0xe')],queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x19')],_0xf4a311[_0x5a92('0x36')],queues[_0xf4a311[_0x5a92('0xe')]][_0x5a92('0x6')]));writeDB(queues[_0xf4a311['uniqueid']]);}}}catch(_0x1f2792){utils[_0x5a92('0x12')](util[_0x5a92('0x2')](_0x5a92('0x3a'),_0xf4a311[_0x5a92('0xe')]),_0x1f2792);}};exports[_0x5a92('0x41')]=function(_0xe0a936){try{if(!_[_0x5a92('0x14')](queues[_0xe0a936[_0x5a92('0x42')]])){utils[_0x5a92('0xc')](util[_0x5a92('0x2')]('[%s][queues][blindtransfer]',_0xe0a936[_0x5a92('0xe')]),_0xe0a936);queues[_0xe0a936['transfereeuniqueid']][_0x5a92('0x3d')]=!![];queues[_0xe0a936[_0x5a92('0x42')]]['transfertype']=_0x5a92('0x43');queues[_0xe0a936[_0x5a92('0x42')]][_0x5a92('0x44')]=_0xe0a936[_0x5a92('0x45')];queues[_0xe0a936[_0x5a92('0x42')]][_0x5a92('0x46')]=_0xe0a936[_0x5a92('0x42')];queues[_0xe0a936[_0x5a92('0x42')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x5a92('0x1')](util[_0x5a92('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xe0a936[_0x5a92('0xe')],queues[_0xe0a936[_0x5a92('0x42')]][_0x5a92('0x19')],_0xe0a936[_0x5a92('0x42')],_0xe0a936[_0x5a92('0x45')]));}}catch(_0x5ec40b){utils[_0x5a92('0x12')](util['format'](_0x5a92('0x47'),_0xe0a936[_0x5a92('0xe')]),_0x5ec40b);}};exports[_0x5a92('0x48')]=function(_0x4952e9){try{utils[_0x5a92('0xc')](util[_0x5a92('0x2')](_0x5a92('0x49'),_0x4952e9[_0x5a92('0x4a')]),_0x4952e9);if(_0x4952e9['origtransfereruniqueid']==_0x4952e9[_0x5a92('0x4b')]){if(!_[_0x5a92('0x14')](queues[_0x4952e9['secondtransfererlinkedid']])){utils[_0x5a92('0x1')](util[_0x5a92('0x2')](_0x5a92('0x4c'),_0x4952e9[_0x5a92('0x4a')],queues[_0x4952e9[_0x5a92('0x4d')]][_0x5a92('0x19')],_0x4952e9['origtransfererexten']));queues[_0x4952e9[_0x5a92('0x4d')]]['transfer']=!![];queues[_0x4952e9[_0x5a92('0x4d')]]['transfertype']='ATTENDED';queues[_0x4952e9[_0x5a92('0x4d')]][_0x5a92('0x44')]=_0x4952e9['origtransfererexten'];queues[_0x4952e9[_0x5a92('0x4d')]]['transferuniqueid']=_0x4952e9[_0x5a92('0x4a')];queues[_0x4952e9[_0x5a92('0x4d')]][_0x5a92('0x6')]=_0x5a92('0x4e');}if(!_['isNil'](queues[_0x4952e9[_0x5a92('0x4b')]])){if(_0x4952e9['transfereelinkedid']&&queues[_0x4952e9[_0x5a92('0x4f')]]){queues[_0x4952e9['transfereelinkedid']][_0x5a92('0x1b')]=0x1;queues[_0x4952e9['transfereeuniqueid']]=_[_0x5a92('0x50')](queues[_0x4952e9[_0x5a92('0x4f')]]);queues[_0x4952e9[_0x5a92('0x42')]]['transfereduniqueid']=_0x4952e9[_0x5a92('0x51')];queues[_0x4952e9[_0x5a92('0x42')]][_0x5a92('0x1b')]=0x2;queues[_0x4952e9['transfereeuniqueid']]['calleridnum']=queues[_0x4952e9['secondtransfererlinkedid']][_0x5a92('0x4')];queues[_0x4952e9[_0x5a92('0x42')]][_0x5a92('0x52')]=queues[_0x4952e9[_0x5a92('0x4d')]][_0x5a92('0x52')];queues[_0x4952e9['transfereeuniqueid']][_0x5a92('0x32')]=utils['now']();queues[_0x4952e9[_0x5a92('0x42')]][_0x5a92('0x15')]=utils[_0x5a92('0x11')]();queues[_0x4952e9[_0x5a92('0x42')]]['holdtime']=0x0;queues[_0x4952e9[_0x5a92('0x42')]][_0x5a92('0x53')]=0x0;utils[_0x5a92('0x1')](util['format'](_0x5a92('0x54'),_0x4952e9[_0x5a92('0x4a')],queues[_0x4952e9[_0x5a92('0x42')]][_0x5a92('0x19')],queues[_0x4952e9[_0x5a92('0x42')]][_0x5a92('0x4')],queues[_0x4952e9[_0x5a92('0x42')]][_0x5a92('0x52')]));}else{utils[_0x5a92('0x1')](util[_0x5a92('0x2')](_0x5a92('0x55'),_0x4952e9['origtransfereruniqueid'],queues[_0x4952e9[_0x5a92('0x4b')]][_0x5a92('0x19')],_0x4952e9[_0x5a92('0x4d')]));queues[_0x4952e9[_0x5a92('0x4b')]][_0x5a92('0xb')]=_0x4952e9['secondtransfererlinkedid'];}}}else if(_0x4952e9[_0x5a92('0x56')]==_0x4952e9['secondtransfererlinkedid']){if(!_[_0x5a92('0x14')](queues[_0x4952e9[_0x5a92('0x4b')]])){utils['info'](util[_0x5a92('0x2')](_0x5a92('0x57'),_0x4952e9[_0x5a92('0x4a')],queues[_0x4952e9['origtransfererlinkedid']][_0x5a92('0x19')],_0x4952e9[_0x5a92('0x56')],_0x4952e9[_0x5a92('0x58')]));queues[_0x4952e9[_0x5a92('0x4b')]]['transfer']=!![];queues[_0x4952e9[_0x5a92('0x4b')]]['transfertype']='ATTENDED';queues[_0x4952e9['origtransfererlinkedid']]['transferexten']=_0x4952e9[_0x5a92('0x58')];queues[_0x4952e9[_0x5a92('0x4b')]][_0x5a92('0x46')]=_0x4952e9[_0x5a92('0x56')];queues[_0x4952e9[_0x5a92('0x4b')]][_0x5a92('0x6')]='ATTENDEDTRANSFER';}if(!_[_0x5a92('0x14')](queues[_0x4952e9[_0x5a92('0x4d')]])){if(_0x4952e9[_0x5a92('0x59')]&&queues[_0x4952e9[_0x5a92('0x59')]]){queues[_0x4952e9['transfertargetlinkedid']][_0x5a92('0x1b')]=0x1;queues[_0x4952e9['transfertargetuniqueid']]=_[_0x5a92('0x50')](queues[_0x4952e9[_0x5a92('0x59')]]);queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0xb')]=_0x4952e9[_0x5a92('0x51')];queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0x1b')]=0x2;queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0x4')]=queues[_0x4952e9[_0x5a92('0x4b')]][_0x5a92('0x4')];queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0x52')]=queues[_0x4952e9[_0x5a92('0x4b')]][_0x5a92('0x52')];queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0x32')]=utils[_0x5a92('0x11')]();queues[_0x4952e9['transfertargetuniqueid']][_0x5a92('0x15')]=utils[_0x5a92('0x11')]();queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0x5a')]=0x0;queues[_0x4952e9['transfertargetuniqueid']][_0x5a92('0x53')]=0x0;utils[_0x5a92('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x4952e9[_0x5a92('0x4a')],queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0x19')],queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0xb')],queues[_0x4952e9[_0x5a92('0x51')]][_0x5a92('0x4')],queues[_0x4952e9[_0x5a92('0x51')]]['calleridname']));}else{utils[_0x5a92('0x1')](util[_0x5a92('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4952e9[_0x5a92('0x4a')],queues[_0x4952e9[_0x5a92('0x4d')]][_0x5a92('0x19')],_0x4952e9[_0x5a92('0x4b')]));queues[_0x4952e9[_0x5a92('0x4d')]][_0x5a92('0xb')]=_0x4952e9[_0x5a92('0x4b')];}}}}catch(_0x46571c){utils[_0x5a92('0x12')](util[_0x5a92('0x2')]('[%s][queues][attendedtransfer]',_0x4952e9[_0x5a92('0x4a')]),_0x46571c);}};exports[_0x5a92('0x5b')]=function(_0x3763bf){try{if(!_[_0x5a92('0x14')](queues[_0x3763bf[_0x5a92('0xe')]])){utils['debug'](util['format'](_0x5a92('0x5c'),_0x3763bf[_0x5a92('0xe')]),_0x3763bf);queues[_0x3763bf['uniqueid']][_0x5a92('0x5d')]=utils[_0x5a92('0x11')]();utils[_0x5a92('0x1')](util[_0x5a92('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3763bf[_0x5a92('0xe')],queues[_0x3763bf['uniqueid']][_0x5a92('0x19')],queues[_0x3763bf[_0x5a92('0xe')]][_0x5a92('0x5d')]));}}catch(_0x25d890){utils[_0x5a92('0x12')](util['format'](_0x5a92('0x5c'),_0x3763bf[_0x5a92('0xe')]),_0x25d890);}};exports[_0x5a92('0x5e')]=function(_0x2a8caf){try{if(!_[_0x5a92('0x14')](queues[_0x2a8caf[_0x5a92('0xe')]])){if(!_[_0x5a92('0x14')](queues[_0x2a8caf['uniqueid']][_0x5a92('0x5d')])){utils[_0x5a92('0xc')](util['format'](_0x5a92('0x5f'),_0x2a8caf[_0x5a92('0xe')]),_0x2a8caf);queues[_0x2a8caf[_0x5a92('0xe')]][_0x5a92('0x53')]+=utils[_0x5a92('0x60')](utils[_0x5a92('0x11')](),queues[_0x2a8caf[_0x5a92('0xe')]][_0x5a92('0x5d')]);utils[_0x5a92('0x1')](util[_0x5a92('0x2')](_0x5a92('0x61'),_0x2a8caf['uniqueid'],queues[_0x2a8caf[_0x5a92('0xe')]]['name'],queues[_0x2a8caf[_0x5a92('0xe')]][_0x5a92('0x53')]));delete queues[_0x2a8caf['uniqueid']]['musiconholdstartAt'];}}}catch(_0x2a2195){utils['error'](util[_0x5a92('0x2')](_0x5a92('0x5f'),_0x2a8caf[_0x5a92('0xe')]),_0x2a2195);}}; \ No newline at end of file +var _0xe364=['error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','destaccountcode','assigned','accountcode','lastAssignedTo','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%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','channel','queue','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe364,0x1ee));var _0x4e36=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0xe364[_0x283127];return _0x43da5d;};'use strict';var _=require(_0x4e36('0x0'));var util=require(_0x4e36('0x1'));var utils=require(_0x4e36('0x2'));var queues={};function writeDB(_0x12f720){utils[_0x4e36('0x3')](util[_0x4e36('0x4')](_0x4e36('0x5'),_0x12f720['uniqueid'],_0x12f720[_0x4e36('0x6')],_0x12f720[_0x4e36('0x7')],_0x12f720['lastAssignedTo'],_0x12f720['calleridnum'],_0x12f720['accountcode'],_0x12f720[_0x4e36('0x8')]));if(_0x12f720[_0x4e36('0x7')]){utils[_0x4e36('0x9')](_0x12f720[_0x4e36('0x7')])[_0x4e36('0xa')](function(_0x3997e3){if(_0x3997e3){_0x12f720[_0x4e36('0xb')]=_0x3997e3[_0x4e36('0xb')];}utils[_0x4e36('0xc')](_0x4e36('0xd'),_0x12f720);});}else{utils[_0x4e36('0xc')](_0x4e36('0xd'),_0x12f720);}if(_0x12f720[_0x4e36('0xe')]){delete queues[_0x12f720[_0x4e36('0xe')]];}else{delete queues[_0x12f720[_0x4e36('0xf')]];}}exports['queuecallerjoin']=function(_0x29485c){try{utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x11'),_0x29485c['uniqueid']),_0x29485c);utils[_0x4e36('0x3')](util[_0x4e36('0x4')](_0x4e36('0x12'),_0x29485c['uniqueid'],_0x29485c['queue'],_0x29485c[_0x4e36('0x13')]));queues[_0x29485c[_0x4e36('0xf')]]=_[_0x4e36('0x14')](_0x29485c,{'originalposition':_0x29485c[_0x4e36('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5b3b30){utils[_0x4e36('0x15')](util[_0x4e36('0x4')]('[%s][queues][queuecallerjoin]',_0x29485c[_0x4e36('0xf')]),_0x5b3b30);}};exports[_0x4e36('0x16')]=function(_0x54309e){try{if(!_[_0x4e36('0x17')](queues[_0x54309e[_0x4e36('0xf')]])){utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x18'),_0x54309e[_0x4e36('0xf')]),_0x54309e);if(queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0x19')]){if(!queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0x1a')]&&!queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0x1b')]){queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0x1c')]=!![];queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0x1d')]=utils[_0x4e36('0x1e')]();queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0x8')]=_0x4e36('0x1f');}utils[_0x4e36('0x3')](util[_0x4e36('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x54309e['uniqueid'],queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0x20')],queues[_0x54309e[_0x4e36('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x54309e[_0x4e36('0xf')]]);}else if(queues[_0x54309e['uniqueid']]['transfereduniqueid']){utils['info'](util[_0x4e36('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x54309e['uniqueid'],queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0x20')],queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0xe')]));queues[queues[_0x54309e[_0x4e36('0xf')]]['transfereduniqueid']]=queues[_0x54309e[_0x4e36('0xf')]];queues[queues[_0x54309e[_0x4e36('0xf')]][_0x4e36('0xe')]][_0x4e36('0x21')]=0x2;delete queues[_0x54309e[_0x4e36('0xf')]];}}}catch(_0x162a29){utils[_0x4e36('0x15')](util[_0x4e36('0x4')](_0x4e36('0x18'),_0x54309e['uniqueid']),_0x162a29);}};exports[_0x4e36('0x22')]=function(_0x2242b2){try{utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x23'),_0x2242b2[_0x4e36('0xf')]),_0x2242b2);if(!_['isNil'](_0x2242b2[_0x4e36('0x24')]['queuestatus'])&&_0x2242b2[_0x4e36('0x25')][_0x4e36('0x26')]()!==_0x4e36('0x27')){if(!_[_0x4e36('0x17')](queues[_0x2242b2[_0x4e36('0xf')]])){queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x1a')]=![];queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x28')]=null;queues[_0x2242b2[_0x4e36('0xf')]]['queuecallerexit']=!![];queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x29')]=utils[_0x4e36('0x1e')]();queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x8')]=_0x2242b2[_0x4e36('0x25')][_0x4e36('0x26')]();utils[_0x4e36('0x3')](util[_0x4e36('0x4')](_0x4e36('0x2a'),_0x2242b2['uniqueid'],queues[_0x2242b2[_0x4e36('0xf')]]['name'],_0x2242b2['value'],queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x8')]));writeDB(queues[_0x2242b2['uniqueid']]);}}else if(!_['isNil'](_0x2242b2[_0x4e36('0x24')][_0x4e36('0x2b')])){if(!_[_0x4e36('0x17')](queues[_0x2242b2[_0x4e36('0xf')]])&&!queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x1a')]){queues[_0x2242b2[_0x4e36('0xf')]]['queuecallerabandon']=![];queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x28')]=null;queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x1b')]=!![];queues[_0x2242b2['uniqueid']][_0x4e36('0x29')]=utils['now']();queues[_0x2242b2['uniqueid']][_0x4e36('0x8')]=_0x4e36('0x2c');utils[_0x4e36('0x3')](util[_0x4e36('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2242b2[_0x4e36('0xf')],queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x20')],_0x2242b2['value'],queues[_0x2242b2[_0x4e36('0xf')]][_0x4e36('0x8')]));}}}catch(_0x185ab9){utils[_0x4e36('0x15')](util['format'](_0x4e36('0x23'),_0x2242b2[_0x4e36('0xf')]),_0x185ab9);}};exports[_0x4e36('0x1a')]=function(_0x12c26e){try{if(!_['isNil'](queues[_0x12c26e['uniqueid']])){utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x2d'),_0x12c26e[_0x4e36('0xf')]),_0x12c26e);queues[_0x12c26e['uniqueid']][_0x4e36('0x1b')]=![];queues[_0x12c26e[_0x4e36('0xf')]][_0x4e36('0x29')]=null;queues[_0x12c26e['uniqueid']][_0x4e36('0x1a')]=!![];queues[_0x12c26e[_0x4e36('0xf')]][_0x4e36('0x28')]=utils[_0x4e36('0x1e')]();queues[_0x12c26e[_0x4e36('0xf')]][_0x4e36('0x8')]=_0x4e36('0x2e');utils[_0x4e36('0x3')](util[_0x4e36('0x4')](_0x4e36('0x2f'),_0x12c26e[_0x4e36('0xf')],queues[_0x12c26e[_0x4e36('0xf')]][_0x4e36('0x20')],queues[_0x12c26e[_0x4e36('0xf')]][_0x4e36('0x8')]));}}catch(_0x215cb9){utils['error'](util[_0x4e36('0x4')](_0x4e36('0x2d'),_0x12c26e[_0x4e36('0xf')]),_0x215cb9);}};exports[_0x4e36('0x30')]=function(_0x15d8f2){try{if(!_[_0x4e36('0x17')](queues[_0x15d8f2[_0x4e36('0xf')]])){utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x31'),_0x15d8f2[_0x4e36('0xf')]),_0x15d8f2);utils[_0x4e36('0x3')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x15d8f2['uniqueid'],queues[_0x15d8f2[_0x4e36('0xf')]]['name'],_0x15d8f2['connectedlinenum'],_0x15d8f2[_0x4e36('0x32')]));queues[_0x15d8f2['uniqueid']][_0x4e36('0x30')]=!![];queues[_0x15d8f2['uniqueid']][_0x4e36('0x19')]=utils[_0x4e36('0x1e')]();queues[_0x15d8f2['uniqueid']][_0x4e36('0x33')]=utils[_0x4e36('0x34')](queues[_0x15d8f2[_0x4e36('0xf')]][_0x4e36('0x19')],queues[_0x15d8f2[_0x4e36('0xf')]][_0x4e36('0x35')]);queues[_0x15d8f2['uniqueid']][_0x4e36('0x13')]=_0x15d8f2[_0x4e36('0x13')];queues[_0x15d8f2[_0x4e36('0xf')]][_0x4e36('0x36')]=_0x15d8f2[_0x4e36('0x36')];queues[_0x15d8f2[_0x4e36('0xf')]][_0x4e36('0x37')]=_0x15d8f2[_0x4e36('0x37')];queues[_0x15d8f2[_0x4e36('0xf')]][_0x4e36('0x32')]=_0x15d8f2[_0x4e36('0x32')];}}catch(_0x288d35){utils['error'](util[_0x4e36('0x4')](_0x4e36('0x31'),_0x15d8f2['uniqueid']),_0x288d35);}};exports[_0x4e36('0x38')]=function(_0x31584c){try{if(!_[_0x4e36('0x17')](queues[_0x31584c[_0x4e36('0xf')]])){utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x39'),_0x31584c[_0x4e36('0xf')]),_0x31584c);utils[_0x4e36('0x3')](util[_0x4e36('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x31584c[_0x4e36('0xf')],queues[_0x31584c[_0x4e36('0xf')]][_0x4e36('0x20')],_0x31584c['membername'],_0x31584c[_0x4e36('0x3a')]));queues[_0x31584c['uniqueid']][_0x4e36('0x1a')]=![];queues[_0x31584c[_0x4e36('0xf')]][_0x4e36('0x1a')]=![];queues[_0x31584c['uniqueid']][_0x4e36('0x28')]=null;queues[_0x31584c[_0x4e36('0xf')]][_0x4e36('0x1b')]=![];queues[_0x31584c['uniqueid']]['queuecallerexitreason']=null;queues[_0x31584c[_0x4e36('0xf')]][_0x4e36('0x29')]=null;queues[_0x31584c[_0x4e36('0xf')]][_0x4e36('0x3b')]=!![];queues[_0x31584c['uniqueid']][_0x4e36('0x3c')]=_0x31584c[_0x4e36('0x3a')];queues[_0x31584c[_0x4e36('0xf')]][_0x4e36('0x3d')]=_0x31584c[_0x4e36('0x3e')];}}catch(_0x3d7536){utils[_0x4e36('0x15')](util[_0x4e36('0x4')](_0x4e36('0x39'),_0x31584c[_0x4e36('0xf')]),_0x3d7536);}};exports[_0x4e36('0x3f')]=function(_0x2d1407){try{if(!_[_0x4e36('0x17')](queues[_0x2d1407[_0x4e36('0xf')]])){if(queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x19')]){utils['debug'](util[_0x4e36('0x4')]('[%s][queues][agentcomplete]',_0x2d1407['uniqueid']),_0x2d1407);queues[_0x2d1407['uniqueid']][_0x4e36('0x1a')]=![];queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x1a')]=![];queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x28')]=null;queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x1b')]=![];queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x29')]=null;queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x3b')]=!![];queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x3d')]=_0x2d1407[_0x4e36('0x3e')];queues[_0x2d1407[_0x4e36('0xf')]]['queuecallercomplete']=!![];queues[_0x2d1407['uniqueid']][_0x4e36('0x1d')]=utils[_0x4e36('0x1e')]();if(_0x2d1407[_0x4e36('0x40')]==_0x4e36('0x41')){if(!queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x41')]){queues[_0x2d1407[_0x4e36('0xf')]]['queuecallerexitreason']=_0x4e36('0x42');}}else{queues[_0x2d1407[_0x4e36('0xf')]][_0x4e36('0x8')]=_0x4e36('0x43')+_0x2d1407[_0x4e36('0x40')][_0x4e36('0x26')]();}utils['info'](util['format'](_0x4e36('0x44'),_0x2d1407[_0x4e36('0xf')],queues[_0x2d1407[_0x4e36('0xf')]]['name'],_0x2d1407['membername'],queues[_0x2d1407[_0x4e36('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x2d1407[_0x4e36('0xf')]]);}}}catch(_0x2ab7ff){utils[_0x4e36('0x15')](util['format'](_0x4e36('0x45'),_0x2d1407['uniqueid']),_0x2ab7ff);}};exports['blindtransfer']=function(_0x45cf12){try{if(!_[_0x4e36('0x17')](queues[_0x45cf12[_0x4e36('0x46')]])){utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x47'),_0x45cf12[_0x4e36('0xf')]),_0x45cf12);queues[_0x45cf12[_0x4e36('0x46')]][_0x4e36('0x41')]=!![];queues[_0x45cf12[_0x4e36('0x46')]][_0x4e36('0x48')]=_0x4e36('0x49');queues[_0x45cf12[_0x4e36('0x46')]][_0x4e36('0x4a')]=_0x45cf12['extension'];queues[_0x45cf12['transfereeuniqueid']][_0x4e36('0x4b')]=_0x45cf12['transfereeuniqueid'];queues[_0x45cf12[_0x4e36('0x46')]][_0x4e36('0x8')]='BLINDTRANSFER';utils[_0x4e36('0x3')](util[_0x4e36('0x4')](_0x4e36('0x4c'),_0x45cf12['uniqueid'],queues[_0x45cf12[_0x4e36('0x46')]][_0x4e36('0x20')],_0x45cf12[_0x4e36('0x46')],_0x45cf12[_0x4e36('0x4d')]));}}catch(_0x19d6d7){utils['error'](util[_0x4e36('0x4')](_0x4e36('0x47'),_0x45cf12[_0x4e36('0xf')]),_0x19d6d7);}};exports[_0x4e36('0x4e')]=function(_0x394745){try{utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x4f'),_0x394745[_0x4e36('0x50')]),_0x394745);if(_0x394745[_0x4e36('0x50')]==_0x394745['origtransfererlinkedid']){if(!_['isNil'](queues[_0x394745[_0x4e36('0x51')]])){utils['info'](util[_0x4e36('0x4')](_0x4e36('0x52'),_0x394745[_0x4e36('0x50')],queues[_0x394745['secondtransfererlinkedid']][_0x4e36('0x20')],_0x394745[_0x4e36('0x53')]));queues[_0x394745['secondtransfererlinkedid']][_0x4e36('0x41')]=!![];queues[_0x394745[_0x4e36('0x51')]]['transfertype']=_0x4e36('0x54');queues[_0x394745[_0x4e36('0x51')]]['transferexten']=_0x394745[_0x4e36('0x53')];queues[_0x394745[_0x4e36('0x51')]][_0x4e36('0x4b')]=_0x394745[_0x4e36('0x50')];queues[_0x394745[_0x4e36('0x51')]][_0x4e36('0x8')]=_0x4e36('0x55');}if(!_[_0x4e36('0x17')](queues[_0x394745[_0x4e36('0x56')]])){if(_0x394745[_0x4e36('0x57')]&&queues[_0x394745[_0x4e36('0x57')]]){queues[_0x394745['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x394745[_0x4e36('0x46')]]=_[_0x4e36('0x58')](queues[_0x394745[_0x4e36('0x57')]]);queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0xe')]=_0x394745[_0x4e36('0x59')];queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0x21')]=0x2;queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0x5a')]=queues[_0x394745[_0x4e36('0x51')]]['calleridnum'];queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0x5b')]=queues[_0x394745[_0x4e36('0x51')]][_0x4e36('0x5b')];queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0x35')]=utils[_0x4e36('0x1e')]();queues[_0x394745['transfereeuniqueid']][_0x4e36('0x19')]=utils[_0x4e36('0x1e')]();queues[_0x394745['transfereeuniqueid']][_0x4e36('0x33')]=0x0;queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0x5c')]=0x0;utils[_0x4e36('0x3')](util[_0x4e36('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x394745['origtransfereruniqueid'],queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0x20')],queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0x5a')],queues[_0x394745[_0x4e36('0x46')]][_0x4e36('0x5b')]));}else{utils['info'](util[_0x4e36('0x4')](_0x4e36('0x5d'),_0x394745[_0x4e36('0x50')],queues[_0x394745[_0x4e36('0x56')]][_0x4e36('0x20')],_0x394745[_0x4e36('0x51')]));queues[_0x394745[_0x4e36('0x56')]]['transfereduniqueid']=_0x394745[_0x4e36('0x51')];}}}else if(_0x394745[_0x4e36('0x5e')]==_0x394745[_0x4e36('0x51')]){if(!_[_0x4e36('0x17')](queues[_0x394745['origtransfererlinkedid']])){utils[_0x4e36('0x3')](util[_0x4e36('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x394745[_0x4e36('0x50')],queues[_0x394745[_0x4e36('0x56')]]['name'],_0x394745['secondtransfereruniqueid'],_0x394745[_0x4e36('0x5f')]));queues[_0x394745[_0x4e36('0x56')]][_0x4e36('0x41')]=!![];queues[_0x394745[_0x4e36('0x56')]][_0x4e36('0x48')]=_0x4e36('0x54');queues[_0x394745[_0x4e36('0x56')]][_0x4e36('0x4a')]=_0x394745[_0x4e36('0x5f')];queues[_0x394745[_0x4e36('0x56')]][_0x4e36('0x4b')]=_0x394745[_0x4e36('0x5e')];queues[_0x394745[_0x4e36('0x56')]][_0x4e36('0x8')]=_0x4e36('0x55');}if(!_[_0x4e36('0x17')](queues[_0x394745[_0x4e36('0x51')]])){if(_0x394745[_0x4e36('0x60')]&&queues[_0x394745['transfertargetlinkedid']]){queues[_0x394745[_0x4e36('0x60')]][_0x4e36('0x21')]=0x1;queues[_0x394745[_0x4e36('0x59')]]=_[_0x4e36('0x58')](queues[_0x394745[_0x4e36('0x60')]]);queues[_0x394745[_0x4e36('0x59')]]['transfereduniqueid']=_0x394745['transfertargetuniqueid'];queues[_0x394745[_0x4e36('0x59')]]['queuecallerenterreason']=0x2;queues[_0x394745['transfertargetuniqueid']][_0x4e36('0x5a')]=queues[_0x394745['origtransfererlinkedid']][_0x4e36('0x5a')];queues[_0x394745['transfertargetuniqueid']]['calleridname']=queues[_0x394745[_0x4e36('0x56')]][_0x4e36('0x5b')];queues[_0x394745[_0x4e36('0x59')]][_0x4e36('0x35')]=utils[_0x4e36('0x1e')]();queues[_0x394745[_0x4e36('0x59')]][_0x4e36('0x19')]=utils[_0x4e36('0x1e')]();queues[_0x394745['transfertargetuniqueid']][_0x4e36('0x33')]=0x0;queues[_0x394745[_0x4e36('0x59')]]['mohtime']=0x0;utils[_0x4e36('0x3')](util[_0x4e36('0x4')](_0x4e36('0x61'),_0x394745['origtransfereruniqueid'],queues[_0x394745[_0x4e36('0x59')]][_0x4e36('0x20')],queues[_0x394745['transfertargetuniqueid']][_0x4e36('0xe')],queues[_0x394745[_0x4e36('0x59')]][_0x4e36('0x5a')],queues[_0x394745[_0x4e36('0x59')]][_0x4e36('0x5b')]));}else{utils['info'](util[_0x4e36('0x4')](_0x4e36('0x5d'),_0x394745[_0x4e36('0x50')],queues[_0x394745['secondtransfererlinkedid']]['name'],_0x394745[_0x4e36('0x56')]));queues[_0x394745['secondtransfererlinkedid']]['transfereduniqueid']=_0x394745['origtransfererlinkedid'];}}}}catch(_0x2d5511){utils[_0x4e36('0x15')](util[_0x4e36('0x4')](_0x4e36('0x4f'),_0x394745[_0x4e36('0x50')]),_0x2d5511);}};exports['musiconholdstart']=function(_0x428acf){try{if(!_[_0x4e36('0x17')](queues[_0x428acf[_0x4e36('0xf')]])){utils[_0x4e36('0x10')](util['format'](_0x4e36('0x62'),_0x428acf[_0x4e36('0xf')]),_0x428acf);queues[_0x428acf[_0x4e36('0xf')]]['musiconholdstartAt']=utils[_0x4e36('0x1e')]();utils[_0x4e36('0x3')](util[_0x4e36('0x4')](_0x4e36('0x63'),_0x428acf[_0x4e36('0xf')],queues[_0x428acf[_0x4e36('0xf')]][_0x4e36('0x20')],queues[_0x428acf['uniqueid']]['musiconholdstartAt']));}}catch(_0x435adf){utils[_0x4e36('0x15')](util['format'](_0x4e36('0x62'),_0x428acf[_0x4e36('0xf')]),_0x435adf);}};exports['musiconholdstop']=function(_0x967631){try{if(!_[_0x4e36('0x17')](queues[_0x967631['uniqueid']])){if(!_['isNil'](queues[_0x967631[_0x4e36('0xf')]][_0x4e36('0x64')])){utils[_0x4e36('0x10')](util[_0x4e36('0x4')](_0x4e36('0x65'),_0x967631['uniqueid']),_0x967631);queues[_0x967631['uniqueid']][_0x4e36('0x5c')]+=utils[_0x4e36('0x34')](utils[_0x4e36('0x1e')](),queues[_0x967631[_0x4e36('0xf')]][_0x4e36('0x64')]);utils[_0x4e36('0x3')](util[_0x4e36('0x4')](_0x4e36('0x66'),_0x967631[_0x4e36('0xf')],queues[_0x967631['uniqueid']][_0x4e36('0x20')],queues[_0x967631[_0x4e36('0xf')]][_0x4e36('0x5c')]));delete queues[_0x967631['uniqueid']][_0x4e36('0x64')];}}}catch(_0x37a0fa){utils['error'](util[_0x4e36('0x4')]('[%s][queues][musiconholdstop]',_0x967631[_0x4e36('0xf')]),_0x37a0fa);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f500602..3a1063d 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 _0x0b59=['UserId','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','uniqueid','exten','context','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','varset','variable','mixmonitor_filename','debug','value','.wav49','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinename','connectedlinenum','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','getUserByInternal','accountcode','then','membername','name'];(function(_0x16e6e3,_0x46b776){var _0x3b66f2=function(_0x50a1d1){while(--_0x50a1d1){_0x16e6e3['push'](_0x16e6e3['shift']());}};_0x3b66f2(++_0x46b776);}(_0x0b59,0xad));var _0x90b5=function(_0x56afd3,_0x35aa64){_0x56afd3=_0x56afd3-0x0;var _0x1c9abb=_0x0b59[_0x56afd3];return _0x1c9abb;};'use strict';var _=require(_0x90b5('0x0'));var util=require(_0x90b5('0x1'));var utils=require(_0x90b5('0x2'));var recordings={};function writeDB(_0x15602a){utils[_0x90b5('0x3')](util['format'](_0x90b5('0x4'),_0x15602a['uniqueid']));if(_0x15602a['accountcode']){utils[_0x90b5('0x5')](_0x15602a[_0x90b5('0x6')])[_0x90b5('0x7')](function(_0x34b516){if(_0x34b516){_0x15602a[_0x90b5('0x8')]=_0x34b516[_0x90b5('0x9')];_0x15602a[_0x90b5('0xa')]=_0x34b516['id'];}utils[_0x90b5('0xb')](_0x90b5('0xc'),_0x15602a);});}else{utils[_0x90b5('0xb')]('CreateVoiceRecording',_0x15602a);}}exports[_0x90b5('0xd')]=function(_0x38c444){try{utils['debug'](util[_0x90b5('0xe')](_0x90b5('0xf'),_0x38c444[_0x90b5('0x10')]),_0x38c444);if(_0x38c444[_0x90b5('0x10')]==_0x38c444['linkedid']){utils[_0x90b5('0x3')](util[_0x90b5('0xe')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x38c444[_0x90b5('0x10')],_0x38c444['context'],_0x38c444[_0x90b5('0x11')]));recordings[_0x38c444[_0x90b5('0x10')]]={'uniqueid':_0x38c444[_0x90b5('0x10')],'accountcode':_0x38c444[_0x90b5('0x6')],'exten':_0x38c444['exten'],'context':_0x38c444[_0x90b5('0x12')],'channel':_0x38c444[_0x90b5('0x13')],'monitors':[]};}}catch(_0x2baabf){utils[_0x90b5('0x14')](util[_0x90b5('0xe')](_0x90b5('0xf'),_0x38c444['uniqueid']),_0x2baabf);}};exports[_0x90b5('0x15')]=function(_0x1c32b5){try{utils['debug'](util[_0x90b5('0xe')](_0x90b5('0x16'),_0x1c32b5['uniqueid']),_0x1c32b5);if(!_[_0x90b5('0x17')](recordings[_0x1c32b5['uniqueid']])&&_0x1c32b5[_0x90b5('0x18')]==0x6){utils['info'](util[_0x90b5('0xe')](_0x90b5('0x19'),_0x1c32b5[_0x90b5('0x10')],_0x1c32b5[_0x90b5('0x12')],_0x1c32b5[_0x90b5('0x13')]));}else if(!_['isNil'](recordings[_0x1c32b5[_0x90b5('0x1a')]])&&_0x1c32b5['channelstate']==0x6&&_0x1c32b5['context']!='transfer'){utils[_0x90b5('0x3')](util[_0x90b5('0xe')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1c32b5[_0x90b5('0x10')],_0x1c32b5[_0x90b5('0x1a')],_0x1c32b5[_0x90b5('0x12')],_0x1c32b5['channel']));recordings[_0x1c32b5[_0x90b5('0x1a')]][_0x90b5('0x6')]=_0x1c32b5[_0x90b5('0x6')];}}catch(_0x109d2b){utils[_0x90b5('0x14')](util[_0x90b5('0xe')](_0x90b5('0x16'),_0x1c32b5[_0x90b5('0x10')]),_0x109d2b);}};exports[_0x90b5('0x1b')]=function(_0x5285f3){try{if(!_['isNil'](_0x5285f3['variable'])&&!_[_0x90b5('0x17')](_0x5285f3[_0x90b5('0x1c')][_0x90b5('0x1d')])){utils[_0x90b5('0x1e')](util[_0x90b5('0xe')]('[%s][recordings][varset]',_0x5285f3[_0x90b5('0x10')]),_0x5285f3);utils[_0x90b5('0x3')](util[_0x90b5('0xe')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5285f3[_0x90b5('0x10')],_0x5285f3['variable'],_0x5285f3[_0x90b5('0x1f')]));if(_['endsWith'](_0x5285f3[_0x90b5('0x1f')],_0x90b5('0x20'))){_0x5285f3[_0x90b5('0x1f')]=_0x5285f3['value'][_0x90b5('0x21')](_0x90b5('0x20'),'.WAV');}if(recordings[_0x5285f3[_0x90b5('0x1a')]]){var _0x264c9b=_[_0x90b5('0x22')](recordings[_0x5285f3['linkedid']][_0x90b5('0x23')],{'value':_0x5285f3['value']});if(_['isNil'](_0x264c9b)){recordings[_0x5285f3[_0x90b5('0x1a')]][_0x90b5('0x23')][_0x90b5('0x24')]({'value':_0x5285f3[_0x90b5('0x1f')]});}}}}catch(_0x523fa4){utils[_0x90b5('0x14')](util[_0x90b5('0xe')](_0x90b5('0x25'),_0x5285f3[_0x90b5('0x10')]),_0x523fa4);}};exports[_0x90b5('0x26')]=function(_0x49609e){try{if(!_[_0x90b5('0x17')](recordings[_0x49609e['uniqueid']])){utils[_0x90b5('0x1e')](util[_0x90b5('0xe')](_0x90b5('0x27'),_0x49609e[_0x90b5('0x10')]),_0x49609e);utils[_0x90b5('0x3')](util[_0x90b5('0xe')](_0x90b5('0x28'),_0x49609e[_0x90b5('0x10')],_0x49609e[_0x90b5('0x29')],_0x49609e[_0x90b5('0x2a')],_0x49609e['cause-txt']));recordings[_0x49609e[_0x90b5('0x10')]][_0x90b5('0x29')]=_0x49609e[_0x90b5('0x29')];recordings[_0x49609e['uniqueid']][_0x90b5('0x2a')]=_0x49609e[_0x90b5('0x2a')];recordings[_0x49609e[_0x90b5('0x10')]]['connectedlinenum']=_0x49609e['connectedlinenum'];recordings[_0x49609e[_0x90b5('0x10')]][_0x90b5('0x2b')]=_0x49609e[_0x90b5('0x2b')];if(recordings[_0x49609e[_0x90b5('0x10')]]['type']=='outbound'&&recordings[_0x49609e[_0x90b5('0x10')]][_0x90b5('0x6')]){recordings[_0x49609e[_0x90b5('0x10')]][_0x90b5('0x2c')]=recordings[_0x49609e[_0x90b5('0x10')]][_0x90b5('0x6')];recordings[_0x49609e[_0x90b5('0x10')]]['connectedlinename']='';}recordings[_0x49609e[_0x90b5('0x10')]][_0x90b5('0x23')][_0x90b5('0x2d')](function(_0xbc87b1){var _0x103d93=_[_0x90b5('0x2e')](recordings[_0x49609e[_0x90b5('0x10')]]);_0x103d93['value']=_0xbc87b1[_0x90b5('0x1f')];writeDB(_0x103d93);});delete recordings[_0x49609e[_0x90b5('0x10')]];}}catch(_0x12edd9){utils[_0x90b5('0x14')](util['format'](_0x90b5('0x27'),_0x49609e[_0x90b5('0x10')]),_0x12edd9);}};exports[_0x90b5('0x2f')]=function(_0x11d57c){try{if(!_[_0x90b5('0x17')](recordings[_0x11d57c[_0x90b5('0x10')]])){utils[_0x90b5('0x1e')](util['format'](_0x90b5('0x30'),_0x11d57c['uniqueid']),_0x11d57c);utils[_0x90b5('0x3')](util['format'](_0x90b5('0x31'),_0x11d57c[_0x90b5('0x10')],_0x11d57c[_0x90b5('0x32')],_0x11d57c[_0x90b5('0x33')]));if(_0x11d57c[_0x90b5('0x32')][_0x90b5('0x34')]()==_0x90b5('0x35')&&_[_0x90b5('0x36')](_0x11d57c['appdata']['toLowerCase'](),_0x90b5('0x37'))){var _0xa5c70d=_0x11d57c[_0x90b5('0x33')]['split']('=');var _0x2eec21=_0xa5c70d[0x0][_0x90b5('0x38')](_0xa5c70d[0x0][_0x90b5('0x39')]('(')+0x1,_0xa5c70d[0x0][_0x90b5('0x39')](')'));var _0x3eb8af=_0xa5c70d[0x1];recordings[_0x11d57c[_0x90b5('0x10')]][_0x2eec21]=_0x3eb8af;}}}catch(_0x1262bc){utils[_0x90b5('0x14')](util['format'](_0x90b5('0x30'),_0x11d57c[_0x90b5('0x10')]),_0x1262bc);}};exports['queuecallerjoin']=function(_0x39e5b5){try{if(!_[_0x90b5('0x17')](recordings[_0x39e5b5[_0x90b5('0x10')]])){utils['debug'](util[_0x90b5('0xe')](_0x90b5('0x3a'),_0x39e5b5[_0x90b5('0x10')]),_0x39e5b5);utils[_0x90b5('0x3')](util['format'](_0x90b5('0x3b'),_0x39e5b5[_0x90b5('0x10')],_0x39e5b5[_0x90b5('0x3c')]));recordings[_0x39e5b5['uniqueid']]['queue']=_0x39e5b5[_0x90b5('0x3c')];}}catch(_0x1132e1){utils[_0x90b5('0x14')](util[_0x90b5('0xe')](_0x90b5('0x3a'),_0x39e5b5[_0x90b5('0x10')]),_0x1132e1);}}; \ No newline at end of file +var _0x95e3=['accountcode','then','membername','name','UserId','request','CreateVoiceRecording','format','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','split','substring','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','getUserByInternal'];(function(_0x2e1ce9,_0x5e82a5){var _0x155412=function(_0x49220f){while(--_0x49220f){_0x2e1ce9['push'](_0x2e1ce9['shift']());}};_0x155412(++_0x5e82a5);}(_0x95e3,0xf7));var _0x395e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x95e3[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x395e('0x0'));var util=require('util');var utils=require(_0x395e('0x1'));var recordings={};function writeDB(_0x1b12d7){utils[_0x395e('0x2')](util['format'](_0x395e('0x3'),_0x1b12d7['uniqueid']));if(_0x1b12d7['accountcode']){utils[_0x395e('0x4')](_0x1b12d7[_0x395e('0x5')])[_0x395e('0x6')](function(_0x5ab8f5){if(_0x5ab8f5){_0x1b12d7[_0x395e('0x7')]=_0x5ab8f5[_0x395e('0x8')];_0x1b12d7[_0x395e('0x9')]=_0x5ab8f5['id'];}utils[_0x395e('0xa')](_0x395e('0xb'),_0x1b12d7);});}else{utils[_0x395e('0xa')](_0x395e('0xb'),_0x1b12d7);}}exports['newchannel']=function(_0x458104){try{utils['debug'](util[_0x395e('0xc')](_0x395e('0xd'),_0x458104[_0x395e('0xe')]),_0x458104);if(_0x458104[_0x395e('0xe')]==_0x458104[_0x395e('0xf')]){utils['info'](util[_0x395e('0xc')](_0x395e('0x10'),_0x458104['uniqueid'],_0x458104[_0x395e('0x11')],_0x458104['exten']));recordings[_0x458104[_0x395e('0xe')]]={'uniqueid':_0x458104[_0x395e('0xe')],'accountcode':_0x458104[_0x395e('0x5')],'exten':_0x458104[_0x395e('0x12')],'context':_0x458104[_0x395e('0x11')],'channel':_0x458104[_0x395e('0x13')],'monitors':[]};}}catch(_0x2b2b29){utils[_0x395e('0x14')](util[_0x395e('0xc')](_0x395e('0xd'),_0x458104['uniqueid']),_0x2b2b29);}};exports['newstate']=function(_0x17c2b2){try{utils['debug'](util[_0x395e('0xc')](_0x395e('0x15'),_0x17c2b2[_0x395e('0xe')]),_0x17c2b2);if(!_[_0x395e('0x16')](recordings[_0x17c2b2[_0x395e('0xe')]])&&_0x17c2b2[_0x395e('0x17')]==0x6){utils[_0x395e('0x2')](util['format'](_0x395e('0x18'),_0x17c2b2[_0x395e('0xe')],_0x17c2b2[_0x395e('0x11')],_0x17c2b2[_0x395e('0x13')]));}else if(!_[_0x395e('0x16')](recordings[_0x17c2b2['linkedid']])&&_0x17c2b2[_0x395e('0x17')]==0x6&&_0x17c2b2[_0x395e('0x11')]!=_0x395e('0x19')){utils[_0x395e('0x2')](util['format'](_0x395e('0x1a'),_0x17c2b2[_0x395e('0xe')],_0x17c2b2[_0x395e('0xf')],_0x17c2b2[_0x395e('0x11')],_0x17c2b2[_0x395e('0x13')]));recordings[_0x17c2b2['linkedid']][_0x395e('0x5')]=_0x17c2b2['accountcode'];}}catch(_0x5a176c){utils[_0x395e('0x14')](util[_0x395e('0xc')](_0x395e('0x15'),_0x17c2b2[_0x395e('0xe')]),_0x5a176c);}};exports[_0x395e('0x1b')]=function(_0x3d5fef){try{if(!_[_0x395e('0x16')](_0x3d5fef['variable'])&&!_[_0x395e('0x16')](_0x3d5fef[_0x395e('0x1c')][_0x395e('0x1d')])){utils[_0x395e('0x1e')](util['format'](_0x395e('0x1f'),_0x3d5fef[_0x395e('0xe')]),_0x3d5fef);utils['info'](util[_0x395e('0xc')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3d5fef['uniqueid'],_0x3d5fef[_0x395e('0x1c')],_0x3d5fef[_0x395e('0x20')]));if(_[_0x395e('0x21')](_0x3d5fef[_0x395e('0x20')],_0x395e('0x22'))){_0x3d5fef[_0x395e('0x20')]=_0x3d5fef[_0x395e('0x20')][_0x395e('0x23')](_0x395e('0x22'),_0x395e('0x24'));}if(recordings[_0x3d5fef[_0x395e('0xf')]]){var _0x50a4c2=_['find'](recordings[_0x3d5fef[_0x395e('0xf')]][_0x395e('0x25')],{'value':_0x3d5fef['value']});if(_[_0x395e('0x16')](_0x50a4c2)){recordings[_0x3d5fef[_0x395e('0xf')]][_0x395e('0x25')][_0x395e('0x26')]({'value':_0x3d5fef[_0x395e('0x20')]});}}}}catch(_0x462d6b){utils[_0x395e('0x14')](util[_0x395e('0xc')](_0x395e('0x1f'),_0x3d5fef[_0x395e('0xe')]),_0x462d6b);}};exports[_0x395e('0x27')]=function(_0x41dbba){try{if(!_['isNil'](recordings[_0x41dbba[_0x395e('0xe')]])){utils[_0x395e('0x1e')](util['format']('[%s][recordings][hangup]',_0x41dbba[_0x395e('0xe')]),_0x41dbba);utils[_0x395e('0x2')](util[_0x395e('0xc')](_0x395e('0x28'),_0x41dbba[_0x395e('0xe')],_0x41dbba[_0x395e('0x29')],_0x41dbba[_0x395e('0x2a')],_0x41dbba['cause-txt']));recordings[_0x41dbba[_0x395e('0xe')]][_0x395e('0x29')]=_0x41dbba['calleridnum'];recordings[_0x41dbba['uniqueid']][_0x395e('0x2a')]=_0x41dbba[_0x395e('0x2a')];recordings[_0x41dbba['uniqueid']][_0x395e('0x2b')]=_0x41dbba['connectedlinenum'];recordings[_0x41dbba[_0x395e('0xe')]][_0x395e('0x2c')]=_0x41dbba[_0x395e('0x2c')];if(recordings[_0x41dbba['uniqueid']][_0x395e('0x2d')]==_0x395e('0x2e')&&recordings[_0x41dbba[_0x395e('0xe')]]['accountcode']){recordings[_0x41dbba[_0x395e('0xe')]][_0x395e('0x2b')]=recordings[_0x41dbba['uniqueid']][_0x395e('0x5')];recordings[_0x41dbba[_0x395e('0xe')]]['connectedlinename']='';}recordings[_0x41dbba['uniqueid']][_0x395e('0x25')][_0x395e('0x2f')](function(_0x470167){var _0x550ba0=_[_0x395e('0x30')](recordings[_0x41dbba[_0x395e('0xe')]]);_0x550ba0['value']=_0x470167[_0x395e('0x20')];writeDB(_0x550ba0);});delete recordings[_0x41dbba[_0x395e('0xe')]];}}catch(_0x708d16){utils[_0x395e('0x14')](util[_0x395e('0xc')](_0x395e('0x31'),_0x41dbba[_0x395e('0xe')]),_0x708d16);}};exports[_0x395e('0x32')]=function(_0x5a49a8){try{if(!_[_0x395e('0x16')](recordings[_0x5a49a8[_0x395e('0xe')]])){utils[_0x395e('0x1e')](util['format'](_0x395e('0x33'),_0x5a49a8[_0x395e('0xe')]),_0x5a49a8);utils['info'](util[_0x395e('0xc')](_0x395e('0x34'),_0x5a49a8[_0x395e('0xe')],_0x5a49a8['application'],_0x5a49a8[_0x395e('0x35')]));if(_0x5a49a8[_0x395e('0x36')][_0x395e('0x37')]()==_0x395e('0x38')&&_['startsWith'](_0x5a49a8['appdata'][_0x395e('0x37')](),_0x395e('0x39'))){var _0x9cc114=_0x5a49a8[_0x395e('0x35')][_0x395e('0x3a')]('=');var _0x5a73be=_0x9cc114[0x0][_0x395e('0x3b')](_0x9cc114[0x0]['lastIndexOf']('(')+0x1,_0x9cc114[0x0]['lastIndexOf'](')'));var _0x483acc=_0x9cc114[0x1];recordings[_0x5a49a8[_0x395e('0xe')]][_0x5a73be]=_0x483acc;}}}catch(_0x494ba4){utils[_0x395e('0x14')](util[_0x395e('0xc')]('[%s][recordings][newexten]',_0x5a49a8['uniqueid']),_0x494ba4);}};exports['queuecallerjoin']=function(_0x260a8a){try{if(!_[_0x395e('0x16')](recordings[_0x260a8a['uniqueid']])){utils[_0x395e('0x1e')](util[_0x395e('0xc')](_0x395e('0x3c'),_0x260a8a[_0x395e('0xe')]),_0x260a8a);utils[_0x395e('0x2')](util[_0x395e('0xc')](_0x395e('0x3d'),_0x260a8a['uniqueid'],_0x260a8a[_0x395e('0x3e')]));recordings[_0x260a8a['uniqueid']][_0x395e('0x3e')]=_0x260a8a[_0x395e('0x3e')];}}catch(_0x3c1778){utils['error'](util[_0x395e('0xc')](_0x395e('0x3c'),_0x260a8a[_0x395e('0xe')]),_0x3c1778);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d2f6e3b..b2db831 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 _0x36c5=['transfertargetlinkedid','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','blinds','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten'];(function(_0x3f6980,_0x545cd9){var _0x309376=function(_0x53ca63){while(--_0x53ca63){_0x3f6980['push'](_0x3f6980['shift']());}};_0x309376(++_0x545cd9);}(_0x36c5,0x187));var _0x536c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x536c('0x0'));var util=require('util');var utils=require(_0x536c('0x1'));function writeDB(_0x1920e9){utils[_0x536c('0x2')](util['format'](_0x536c('0x3'),_0x1920e9['type']==='attended'?_0x1920e9[_0x536c('0x4')]:_0x1920e9[_0x536c('0x5')],_0x1920e9[_0x536c('0x6')]));utils['request']('CreateVoiceTransferReport',_0x1920e9);}exports['blinds']={};exports['blindtransfer']=function(_0x3134cc){try{utils[_0x536c('0x7')](util[_0x536c('0x8')](_0x536c('0x9'),_0x3134cc[_0x536c('0x5')]),_0x3134cc);utils[_0x536c('0x2')](util['format'](_0x536c('0xa'),_0x3134cc[_0x536c('0x5')],_0x3134cc[_0x536c('0xb')],_0x3134cc[_0x536c('0xc')],_0x3134cc['transfereecalleridnum'],_0x3134cc[_0x536c('0xd')]));_0x3134cc[_0x536c('0x6')]=_0x536c('0xe');exports[_0x536c('0xf')][_0x3134cc['transfereruniqueid']]=_0x3134cc;writeDB(_0x3134cc);}catch(_0x185cdb){utils[_0x536c('0x10')](util[_0x536c('0x8')]('[%s][transfers][blindtransfer]',_0x3134cc[_0x536c('0x5')]),_0x185cdb);}};exports['attendedtransfer']=function(_0x242c01){try{utils['debug'](util['format'](_0x536c('0x11'),_0x242c01[_0x536c('0x4')]),_0x242c01);utils[_0x536c('0x2')](util[_0x536c('0x8')](_0x536c('0x12'),_0x242c01['origtransfereruniqueid'],_0x242c01[_0x536c('0x13')],_0x242c01[_0x536c('0x14')],_0x242c01[_0x536c('0x15')],_0x242c01[_0x536c('0x16')]));_0x242c01=_[_0x536c('0x17')](_0x242c01,{'transfererchannel':_0x242c01[_0x536c('0x18')],'transferercalleridnum':_0x242c01[_0x536c('0x13')],'transferercalleridname':_0x242c01[_0x536c('0x14')],'transfererconnectedlinenum':_0x242c01[_0x536c('0x19')],'transfererconnectedlinename':_0x242c01[_0x536c('0x1a')],'transfereraccountcode':_0x242c01[_0x536c('0x1b')],'transferercontext':_0x242c01[_0x536c('0x1c')],'transfererexten':_0x242c01[_0x536c('0x1d')],'transfererlinkedid':_0x242c01[_0x536c('0x1e')],'context':_0x242c01[_0x536c('0x1f')],'extension':_0x242c01['origtransfererexten'],'type':_0x536c('0x20')});if(_['isNil'](_0x242c01[_0x536c('0x21')])){_0x242c01=_[_0x536c('0x17')](_0x242c01,{'transfereechannel':_0x242c01[_0x536c('0x22')],'transfereecalleridnum':_0x242c01[_0x536c('0x15')],'transfereecalleridname':_0x242c01[_0x536c('0x16')],'transfereeconnectedlinenum':_0x242c01[_0x536c('0x23')],'transfereeconnectedlinename':_0x242c01['transfertargetconnectedlinename'],'transfereeaccountcode':_0x242c01['transfertargetaccountcode'],'transfereecontext':_0x242c01[_0x536c('0x24')],'transfereeexten':_0x242c01[_0x536c('0x25')],'transfereelinkedid':_0x242c01[_0x536c('0x26')]});}writeDB(_0x242c01);}catch(_0x747f8f){utils[_0x536c('0x10')](util['format'](_0x536c('0x11'),_0x242c01[_0x536c('0x4')]),_0x747f8f);}}; \ No newline at end of file +var _0x8e0d=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','attended','origtransfereruniqueid','uniqueid','type','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transfereecalleridnum','transfereecalleridname','error','attendedtransfer'];(function(_0x486223,_0x3ff8ae){var _0x308dfc=function(_0x4c7e35){while(--_0x4c7e35){_0x486223['push'](_0x486223['shift']());}};_0x308dfc(++_0x3ff8ae);}(_0x8e0d,0x1b2));var _0xd8e0=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x8e0d[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xd8e0('0x0'));var util=require(_0xd8e0('0x1'));var utils=require('./utils');function writeDB(_0x2f7971){utils[_0xd8e0('0x2')](util[_0xd8e0('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x2f7971['type']===_0xd8e0('0x4')?_0x2f7971[_0xd8e0('0x5')]:_0x2f7971[_0xd8e0('0x6')],_0x2f7971[_0xd8e0('0x7')]));utils['request']('CreateVoiceTransferReport',_0x2f7971);}exports[_0xd8e0('0x8')]={};exports[_0xd8e0('0x9')]=function(_0x2a335a){try{utils[_0xd8e0('0xa')](util[_0xd8e0('0x3')](_0xd8e0('0xb'),_0x2a335a[_0xd8e0('0x6')]),_0x2a335a);utils['info'](util[_0xd8e0('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2a335a[_0xd8e0('0x6')],_0x2a335a[_0xd8e0('0xc')],_0x2a335a['transferercalleridname'],_0x2a335a[_0xd8e0('0xd')],_0x2a335a[_0xd8e0('0xe')]));_0x2a335a[_0xd8e0('0x7')]='blind';exports[_0xd8e0('0x8')][_0x2a335a['transfereruniqueid']]=_0x2a335a;writeDB(_0x2a335a);}catch(_0x5fdf5a){utils[_0xd8e0('0xf')](util[_0xd8e0('0x3')](_0xd8e0('0xb'),_0x2a335a[_0xd8e0('0x6')]),_0x5fdf5a);}};exports[_0xd8e0('0x10')]=function(_0x4896c0){try{utils[_0xd8e0('0xa')](util[_0xd8e0('0x3')](_0xd8e0('0x11'),_0x4896c0[_0xd8e0('0x5')]),_0x4896c0);utils[_0xd8e0('0x2')](util[_0xd8e0('0x3')](_0xd8e0('0x12'),_0x4896c0[_0xd8e0('0x5')],_0x4896c0[_0xd8e0('0x13')],_0x4896c0[_0xd8e0('0x14')],_0x4896c0[_0xd8e0('0x15')],_0x4896c0[_0xd8e0('0x16')]));_0x4896c0=_['assign'](_0x4896c0,{'transfererchannel':_0x4896c0[_0xd8e0('0x17')],'transferercalleridnum':_0x4896c0[_0xd8e0('0x13')],'transferercalleridname':_0x4896c0[_0xd8e0('0x14')],'transfererconnectedlinenum':_0x4896c0[_0xd8e0('0x18')],'transfererconnectedlinename':_0x4896c0[_0xd8e0('0x19')],'transfereraccountcode':_0x4896c0[_0xd8e0('0x1a')],'transferercontext':_0x4896c0['secondtransferercontext'],'transfererexten':_0x4896c0[_0xd8e0('0x1b')],'transfererlinkedid':_0x4896c0[_0xd8e0('0x1c')],'context':_0x4896c0[_0xd8e0('0x1d')],'extension':_0x4896c0[_0xd8e0('0x1e')],'type':_0xd8e0('0x4')});if(_[_0xd8e0('0x1f')](_0x4896c0[_0xd8e0('0x20')])){_0x4896c0=_[_0xd8e0('0x21')](_0x4896c0,{'transfereechannel':_0x4896c0[_0xd8e0('0x22')],'transfereecalleridnum':_0x4896c0['transfertargetcalleridnum'],'transfereecalleridname':_0x4896c0[_0xd8e0('0x16')],'transfereeconnectedlinenum':_0x4896c0[_0xd8e0('0x23')],'transfereeconnectedlinename':_0x4896c0[_0xd8e0('0x24')],'transfereeaccountcode':_0x4896c0[_0xd8e0('0x25')],'transfereecontext':_0x4896c0[_0xd8e0('0x26')],'transfereeexten':_0x4896c0[_0xd8e0('0x27')],'transfereelinkedid':_0x4896c0[_0xd8e0('0x28')]});}writeDB(_0x4896c0);}catch(_0x4b80b1){utils[_0xd8e0('0xf')](util[_0xd8e0('0x3')](_0xd8e0('0x11'),_0x4896c0[_0xd8e0('0x5')]),_0x4b80b1);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index dd09db0..d026ede 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 _0xfea2=['[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','then','[utils][request]\x20name:%s','request','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','found','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout'];(function(_0xc391d2,_0xa6974a){var _0x287a1c=function(_0x571866){while(--_0x571866){_0xc391d2['push'](_0xc391d2['shift']());}};_0x287a1c(++_0xa6974a);}(_0xfea2,0x156));var _0x2fea=function(_0x4aabc1,_0x15e9b0){_0x4aabc1=_0x4aabc1-0x0;var _0x302c36=_0xfea2[_0x4aabc1];return _0x302c36;};'use strict';var BPromise=require(_0x2fea('0x0'));var jayson=require(_0x2fea('0x1'));var moment=require(_0x2fea('0x2'));var util=require('util');var client=jayson[_0x2fea('0x3')][_0x2fea('0x4')]({'port':0x2329});var logger=require(_0x2fea('0x5'))(_0x2fea('0x6'));exports[_0x2fea('0x7')]=function(_0x1db390,_0x23818b){logger['info'](_0x1db390,_0x23818b?util[_0x2fea('0x8')](_0x23818b,{'showHidden':![],'depth':null}):'');};exports[_0x2fea('0x9')]=function(_0x4c84ae,_0x42d45e){logger[_0x2fea('0x9')](_0x4c84ae,_0x42d45e?util[_0x2fea('0x8')](_0x42d45e,{'showHidden':![],'depth':null}):'');};exports[_0x2fea('0xa')]=function(_0x14f962,_0x15e6c2){logger[_0x2fea('0xa')](_0x14f962,_0x15e6c2?util[_0x2fea('0x8')](_0x15e6c2,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2a3fd9,_0x33b252){return client['request'](_0x2a3fd9,{'body':_0x33b252})[_0x2fea('0xb')](function(_0x490a67){logger[_0x2fea('0x9')](_0x2fea('0xc'),_0x2a3fd9,_0x490a67?util[_0x2fea('0x8')](_0x490a67,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x481c90){logger[_0x2fea('0xa')](_0x2fea('0xc'),_0x2a3fd9,_0x481c90?util[_0x2fea('0x8')](_0x481c90,{'showHidden':![],'depth':null}):'');});};function getUser(_0x445224){return client[_0x2fea('0xd')](_0x2fea('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0x2fea('0xf'),_0x2fea('0x10')],'where':_0x445224,'limit':0x1}})[_0x2fea('0xb')](function(_0x561fdd){logger[_0x2fea('0x9')](_0x2fea('0x11'),JSON[_0x2fea('0x12')](_0x445224),_0x561fdd?util[_0x2fea('0x8')](_0x561fdd,{'showHidden':![],'depth':null}):'');return _0x561fdd[_0x2fea('0x13')][_0x2fea('0x14')]?_0x561fdd[_0x2fea('0x13')][0x0]:null;});}exports[_0x2fea('0x15')]=function(_0x915b48){return new BPromise(function(_0x1bf918,_0x8e3ff4){if(_0x915b48){return getUser({'internal':_0x915b48})[_0x2fea('0xb')](function(_0x448950){logger[_0x2fea('0x7')](_0x2fea('0x16'),_0x915b48,_0x448950?'found':_0x2fea('0x17'));return _0x1bf918(_0x448950);})['catch'](function(_0x59de1e){logger['error']('[utils][getUserByInternal]',_0x59de1e?util[_0x2fea('0x8')](_0x59de1e,{'showHidden':![],'depth':null}):'');return _0x1bf918(null);});}return _0x1bf918(null);});};exports['getUserByInterface']=function(_0xec0ca6){return new BPromise(function(_0x32bce8,_0x14e204){if(_0xec0ca6){return getUser({'interface':_0xec0ca6})[_0x2fea('0xb')](function(_0xfff44e){logger[_0x2fea('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0xec0ca6,_0xfff44e?_0x2fea('0x18'):_0x2fea('0x17'));return _0x32bce8(_0xfff44e);})[_0x2fea('0x19')](function(_0x3eaa47){logger[_0x2fea('0xa')](_0x2fea('0x1a'),_0x3eaa47?util[_0x2fea('0x8')](_0x3eaa47,{'showHidden':![],'depth':null}):'');return _0x32bce8(null);});}return _0x32bce8(null);});};exports[_0x2fea('0x1b')]=function(_0x2eaaf9){return new BPromise(function(_0x3fd632,_0x34fbea){if(_0x2eaaf9){return getUser({'name':_0x2eaaf9})[_0x2fea('0xb')](function(_0x78dd4c){logger[_0x2fea('0x7')](_0x2fea('0x1c'),_0x2eaaf9,_0x78dd4c?_0x2fea('0x18'):_0x2fea('0x17'));return _0x3fd632(_0x78dd4c);})[_0x2fea('0x19')](function(_0x274df7){logger['error']('[utils][getUserByName]',_0x274df7?util['inspect'](_0x274df7,{'showHidden':![],'depth':null}):'');return _0x3fd632(null);});}return _0x3fd632(null);});};exports[_0x2fea('0x1d')]=function(_0xcb9c81){return new BPromise(function(_0x247096,_0x548106){if(_0xcb9c81){return client[_0x2fea('0xd')](_0x2fea('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0x2fea('0x1f'),_0x2fea('0x20'),_0x2fea('0x21')],'where':{'name':_0xcb9c81},'limit':0x1}})[_0x2fea('0xb')](function(_0x2ceb75){logger[_0x2fea('0x9')](_0x2fea('0x22'),_0xcb9c81,_0x2ceb75?util[_0x2fea('0x8')](_0x2ceb75,{'showHidden':![],'depth':null}):'');logger[_0x2fea('0x7')](_0x2fea('0x23'),_0xcb9c81,_0x2ceb75?_0x2fea('0x18'):_0x2fea('0x17'));return _0x247096(_0x2ceb75[_0x2fea('0x13')][_0x2fea('0x14')]?_0x2ceb75['result'][0x0]:null);})[_0x2fea('0x19')](function(_0xa256ae){logger[_0x2fea('0xa')]('[utils][getVoiceQueueByName]',_0xa256ae?util[_0x2fea('0x8')](_0xa256ae,{'showHidden':![],'depth':null}):'');return _0x247096(null);});}return _0x247096(null);});};exports[_0x2fea('0x24')]=function(_0x2f9fa6,_0x5a7dff){return moment(_0x2f9fa6)[_0x2fea('0x25')](_0x5a7dff,_0x2fea('0x26'))[_0x2fea('0x27')](_0x2fea('0x28'));};exports[_0x2fea('0x29')]=function(_0x4b1c41,_0x6f790c){return moment(_0x4b1c41)[_0x2fea('0x2a')](_0x6f790c,'seconds')[_0x2fea('0x27')](_0x2fea('0x28'));};exports[_0x2fea('0x2b')]=function(_0x485a76,_0x15d31c){return moment(_0x485a76)[_0x2fea('0x2c')](moment(_0x15d31c),_0x2fea('0x26'));};exports[_0x2fea('0x2d')]=function(_0x41e89a,_0x2d74c2){return parseInt(_0x41e89a,0xa)+parseInt(_0x2d74c2,0xa);};exports['now']=function(){return moment()[_0x2fea('0x27')](_0x2fea('0x28'));};exports['isAfter']=function(_0x1ecd2a,_0x1f9c64){if(_0x1f9c64){return moment(_0x1ecd2a)['isAfter'](_0x1f9c64);}return!![];};exports[_0x2fea('0x2e')]=function(_0x4ec994,_0x5edd12){if(_0x5edd12){return moment(_0x4ec994)[_0x2fea('0x2e')](_0x5edd12);}else if(_0x4ec994){return!![];}return![];}; \ No newline at end of file +var _0x6ff4=['addTime','add','seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','getUserByInterface','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]'];(function(_0x289ed9,_0x40b982){var _0xb02f85=function(_0x1ef4ec){while(--_0x1ef4ec){_0x289ed9['push'](_0x289ed9['shift']());}};_0xb02f85(++_0x40b982);}(_0x6ff4,0x90));var _0x46ff=function(_0x3f127b,_0x986b51){_0x3f127b=_0x3f127b-0x0;var _0x23ed00=_0x6ff4[_0x3f127b];return _0x23ed00;};'use strict';var BPromise=require(_0x46ff('0x0'));var jayson=require(_0x46ff('0x1'));var moment=require(_0x46ff('0x2'));var util=require(_0x46ff('0x3'));var client=jayson['client'][_0x46ff('0x4')]({'port':0x2329});var logger=require(_0x46ff('0x5'))('xdr');exports[_0x46ff('0x6')]=function(_0x54f732,_0x418c8e){logger[_0x46ff('0x6')](_0x54f732,_0x418c8e?util['inspect'](_0x418c8e,{'showHidden':![],'depth':null}):'');};exports[_0x46ff('0x7')]=function(_0x41b0d6,_0x29c1aa){logger[_0x46ff('0x7')](_0x41b0d6,_0x29c1aa?util[_0x46ff('0x8')](_0x29c1aa,{'showHidden':![],'depth':null}):'');};exports[_0x46ff('0x9')]=function(_0x51c521,_0xc464cd){logger[_0x46ff('0x9')](_0x51c521,_0xc464cd?util[_0x46ff('0x8')](_0xc464cd,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x20b470,_0x4505df){return client[_0x46ff('0xa')](_0x20b470,{'body':_0x4505df})[_0x46ff('0xb')](function(_0x3f54d8){logger[_0x46ff('0x7')](_0x46ff('0xc'),_0x20b470,_0x3f54d8?util[_0x46ff('0x8')](_0x3f54d8,{'showHidden':![],'depth':null}):'');})[_0x46ff('0xd')](function(_0x182633){logger[_0x46ff('0x9')](_0x46ff('0xc'),_0x20b470,_0x182633?util[_0x46ff('0x8')](_0x182633,{'showHidden':![],'depth':null}):'');});};function getUser(_0x47bdfb){return client[_0x46ff('0xa')](_0x46ff('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0x46ff('0xf'),'interface'],'where':_0x47bdfb,'limit':0x1}})[_0x46ff('0xb')](function(_0x1bce76){logger['debug'](_0x46ff('0x10'),JSON[_0x46ff('0x11')](_0x47bdfb),_0x1bce76?util[_0x46ff('0x8')](_0x1bce76,{'showHidden':![],'depth':null}):'');return _0x1bce76[_0x46ff('0x12')]['length']?_0x1bce76[_0x46ff('0x12')][0x0]:null;});}exports[_0x46ff('0x13')]=function(_0x5a9117){return new BPromise(function(_0x153943,_0x1b79a5){if(_0x5a9117){return getUser({'internal':_0x5a9117})[_0x46ff('0xb')](function(_0x1e2f45){logger[_0x46ff('0x6')](_0x46ff('0x14'),_0x5a9117,_0x1e2f45?'found':_0x46ff('0x15'));return _0x153943(_0x1e2f45);})[_0x46ff('0xd')](function(_0x450d08){logger['error']('[utils][getUserByInternal]',_0x450d08?util[_0x46ff('0x8')](_0x450d08,{'showHidden':![],'depth':null}):'');return _0x153943(null);});}return _0x153943(null);});};exports[_0x46ff('0x16')]=function(_0x37c0d2){return new BPromise(function(_0x2ddebf,_0x662808){if(_0x37c0d2){return getUser({'interface':_0x37c0d2})[_0x46ff('0xb')](function(_0x34e04a){logger[_0x46ff('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x37c0d2,_0x34e04a?_0x46ff('0x17'):_0x46ff('0x15'));return _0x2ddebf(_0x34e04a);})[_0x46ff('0xd')](function(_0x2ec197){logger[_0x46ff('0x9')](_0x46ff('0x18'),_0x2ec197?util[_0x46ff('0x8')](_0x2ec197,{'showHidden':![],'depth':null}):'');return _0x2ddebf(null);});}return _0x2ddebf(null);});};exports['getUserByName']=function(_0x40f4f9){return new BPromise(function(_0x3b63c3,_0x312df7){if(_0x40f4f9){return getUser({'name':_0x40f4f9})[_0x46ff('0xb')](function(_0x4289eb){logger['info'](_0x46ff('0x19'),_0x40f4f9,_0x4289eb?'found':'notfound');return _0x3b63c3(_0x4289eb);})[_0x46ff('0xd')](function(_0x1b3774){logger[_0x46ff('0x9')](_0x46ff('0x1a'),_0x1b3774?util[_0x46ff('0x8')](_0x1b3774,{'showHidden':![],'depth':null}):'');return _0x3b63c3(null);});}return _0x3b63c3(null);});};exports[_0x46ff('0x1b')]=function(_0x25522a){return new BPromise(function(_0xe2f2e3,_0x45d73b){if(_0x25522a){return client[_0x46ff('0xa')](_0x46ff('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x46ff('0xf'),'type',_0x46ff('0x1d'),_0x46ff('0x1e')],'where':{'name':_0x25522a},'limit':0x1}})[_0x46ff('0xb')](function(_0x5d6616){logger[_0x46ff('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x25522a,_0x5d6616?util[_0x46ff('0x8')](_0x5d6616,{'showHidden':![],'depth':null}):'');logger[_0x46ff('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x25522a,_0x5d6616?_0x46ff('0x17'):_0x46ff('0x15'));return _0xe2f2e3(_0x5d6616['result']['length']?_0x5d6616[_0x46ff('0x12')][0x0]:null);})[_0x46ff('0xd')](function(_0x896569){logger['error'](_0x46ff('0x1f'),_0x896569?util[_0x46ff('0x8')](_0x896569,{'showHidden':![],'depth':null}):'');return _0xe2f2e3(null);});}return _0xe2f2e3(null);});};exports[_0x46ff('0x20')]=function(_0x58f6c2,_0x1d6a59){return moment(_0x58f6c2)[_0x46ff('0x21')](_0x1d6a59,_0x46ff('0x22'))[_0x46ff('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x2daace,_0x1258dc){return moment(_0x2daace)[_0x46ff('0x24')](_0x1258dc,_0x46ff('0x22'))['format'](_0x46ff('0x25'));};exports[_0x46ff('0x26')]=function(_0x1e75b9,_0x1ae2ca){return moment(_0x1e75b9)[_0x46ff('0x27')](moment(_0x1ae2ca),'seconds');};exports[_0x46ff('0x28')]=function(_0x10d651,_0x40542f){return parseInt(_0x10d651,0xa)+parseInt(_0x40542f,0xa);};exports[_0x46ff('0x29')]=function(){return moment()[_0x46ff('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x46ff('0x2a')]=function(_0x2dcd19,_0x27a753){if(_0x27a753){return moment(_0x2dcd19)[_0x46ff('0x2a')](_0x27a753);}return!![];};exports[_0x46ff('0x2b')]=function(_0x3ca106,_0x36c7ab){if(_0x36c7ab){return moment(_0x3ca106)['isBefore'](_0x36c7ab);}else if(_0x3ca106){return!![];}return![];}; \ No newline at end of file